From: Cris Di Sclafani Date: Fri, 29 Jan 2021 11:18:27 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.14 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22my-avatar.png/%22?a=commitdiff_plain;h=c488117191a25d51546c691aabf82e3b45e8bff1;p=motion2.git Built motion from commit (unavailable).|2.5.14 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a4cbd41..eae4637 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.14", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-01-29T10:42:46.393Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.14", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-01-29T11:11:04.506Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e299de4..0d4d4ad 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.14", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-01-29T10:42:46.393Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.14", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-01-29T11:11:04.506Z", "url": "http://apidocjs.com", "version": "0.19.0" } } diff --git a/server/api/UserChatInteraction/UserChatInteraction.attributes.js b/server/api/UserChatInteraction/UserChatInteraction.attributes.js index abe53de..d6e0255 100644 --- a/server/api/UserChatInteraction/UserChatInteraction.attributes.js +++ b/server/api/UserChatInteraction/UserChatInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc82=['sequelize','exports','INTEGER'];(function(_0x275047,_0x1e51a7){var _0x4c2039=function(_0x8529a2){while(--_0x8529a2){_0x275047['push'](_0x275047['shift']());}};_0x4c2039(++_0x1e51a7);}(_0xcc82,0xd2));var _0x2cc8=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0xcc82[_0x5a26db];return _0x4619dd;};'use strict';var Sequelize=require(_0x2cc8('0x0'));module[_0x2cc8('0x1')]={'ChatInteractionId':{'type':Sequelize[_0x2cc8('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x2cc8('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x3c3c=['INTEGER','exports'];(function(_0x593f80,_0x4db9f6){var _0xad2a20=function(_0x1c684f){while(--_0x1c684f){_0x593f80['push'](_0x593f80['shift']());}};_0xad2a20(++_0x4db9f6);}(_0x3c3c,0x1c3));var _0xc3c3=function(_0xfcb070,_0x130a50){_0xfcb070=_0xfcb070-0x0;var _0x5289c4=_0x3c3c[_0xfcb070];return _0x5289c4;};'use strict';var Sequelize=require('sequelize');module[_0xc3c3('0x0')]={'ChatInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xc3c3('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index b936571..f2fa254 100644 --- a/server/api/UserChatInteraction/UserChatInteraction.controller.js +++ b/server/api/UserChatInteraction/UserChatInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe833=['reject','then','get','UserChatInteractions','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','UserChatInteraction','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xe833,0x1c6));var _0x3e83=function(_0x28e86a,_0x5d7a95){_0x28e86a=_0x28e86a-0x0;var _0x472cb1=_0xe833[_0x28e86a];return _0x472cb1;};'use strict';var pdf=require(_0x3e83('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e83('0x1'));var jsonpatch=require(_0x3e83('0x2'));var rp=require('request-promise');var moment=require(_0x3e83('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3e83('0x4'));var util=require(_0x3e83('0x5'));var path=require(_0x3e83('0x6'));var sox=require(_0x3e83('0x7'));var csv=require('to-csv');var ejs=require(_0x3e83('0x8'));var fs=require('fs');var _=require(_0x3e83('0x9'));var squel=require(_0x3e83('0xa'));var crypto=require(_0x3e83('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3e83('0xc'));var toCsv=require(_0x3e83('0xd'));var querystring=require(_0x3e83('0xe'));var Papa=require(_0x3e83('0xf'));var Redis=require('ioredis');var authService=require(_0x3e83('0x10'));var qs=require(_0x3e83('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e83('0x12'));var logger=require(_0x3e83('0x13'))(_0x3e83('0x14'));var utils=require(_0x3e83('0x15'));var config=require(_0x3e83('0x16'));var licenseUtil=require(_0x3e83('0x17'));var db=require(_0x3e83('0x18'))['db'];function respondWithStatusCode(_0x39dae7,_0x14b09a){_0x14b09a=_0x14b09a||0xcc;return function(_0x58d7b8){if(_0x58d7b8){return _0x39dae7['sendStatus'](_0x14b09a);}return _0x39dae7[_0x3e83('0x19')](_0x14b09a)[_0x3e83('0x1a')]();};}function respondWithResult(_0x1c5040,_0x1b4ffd){_0x1b4ffd=_0x1b4ffd||0xc8;return function(_0x488c23){if(_0x488c23){return _0x1c5040[_0x3e83('0x19')](_0x1b4ffd)[_0x3e83('0x1b')](_0x488c23);}};}function respondWithFilteredResult(_0x3c3a68,_0x32354b){return function(_0x349fb8){if(_0x349fb8){var _0x189a6c=_0x349fb8[_0x3e83('0x1c')],_0x16a2d4=_0x32354b[_0x3e83('0x1d')],_0x3e09f2=_0x32354b['offset']+_0x32354b['limit'],_0x1a9135;if(_0x3e09f2>=_0x189a6c){_0x3e09f2=_0x189a6c;_0x1a9135=0xc8;}else{_0x1a9135=0xce;}_0x3c3a68[_0x3e83('0x19')](_0x1a9135);return _0x3c3a68['set'](_0x3e83('0x1e'),_0x16a2d4+'-'+_0x3e09f2+'/'+_0x189a6c)[_0x3e83('0x1b')](_0x349fb8);}return null;};}function patchUpdates(_0x285662){return function(_0x3b0cd8){try{jsonpatch[_0x3e83('0x1f')](_0x3b0cd8,_0x285662,!![]);}catch(_0x48dd3d){return BPromise[_0x3e83('0x20')](_0x48dd3d);}return _0x3b0cd8['save']();};}function saveUpdates(_0x4d4102,_0x471233){return function(_0x5f56fa){if(_0x5f56fa){return _0x5f56fa['update'](_0x4d4102)['then'](function(_0x404d7b){return _0x404d7b;});}return null;};}function removeEntity(_0x41772b,_0x4fd0ff){return function(_0x19a9ac){if(_0x19a9ac){return _0x19a9ac['destroy']()[_0x3e83('0x21')](function(){var _0x5e2f67=_0x19a9ac[_0x3e83('0x22')]({'plain':!![]});var _0x5cd263=_0x3e83('0x23');return db[_0x3e83('0x24')][_0x3e83('0x25')]({'where':{'type':_0x5cd263,'resourceId':_0x5e2f67['id']}})[_0x3e83('0x21')](function(){return _0x19a9ac;});})[_0x3e83('0x21')](function(){_0x41772b[_0x3e83('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8561,_0x1738f2){return function(_0x54147b){if(!_0x54147b){_0x1b8561[_0x3e83('0x26')](0x194);}return _0x54147b;};}function handleError(_0x23364c,_0x5d9e19){_0x5d9e19=_0x5d9e19||0x1f4;return function(_0x214e80){logger[_0x3e83('0x27')](_0x214e80[_0x3e83('0x28')]);if(_0x214e80[_0x3e83('0x29')]){delete _0x214e80['name'];}_0x23364c[_0x3e83('0x19')](_0x5d9e19)[_0x3e83('0x2a')](_0x214e80);};}exports[_0x3e83('0x2b')]=function(_0x59693b,_0x490e58){var _0x5ee7a3={},_0x4a5f69={},_0x541caa={'count':0x0,'rows':[]};var _0x5e3db9=_[_0x3e83('0x2c')](db[_0x3e83('0x2d')][_0x3e83('0x2e')],function(_0x4e9a6e){return{'name':_0x4e9a6e[_0x3e83('0x2f')],'type':_0x4e9a6e[_0x3e83('0x30')]['key']};});_0x4a5f69[_0x3e83('0x31')]=_['map'](_0x5e3db9,_0x3e83('0x29'));_0x4a5f69[_0x3e83('0x32')]=_['keys'](_0x59693b[_0x3e83('0x32')]);_0x4a5f69[_0x3e83('0x33')]=_['intersection'](_0x4a5f69[_0x3e83('0x31')],_0x4a5f69[_0x3e83('0x32')]);_0x5ee7a3[_0x3e83('0x34')]=_['intersection'](_0x4a5f69[_0x3e83('0x31')],qs[_0x3e83('0x35')](_0x59693b[_0x3e83('0x32')]['fields']));_0x5ee7a3['attributes']=_0x5ee7a3[_0x3e83('0x34')]['length']?_0x5ee7a3['attributes']:_0x4a5f69[_0x3e83('0x31')];if(!_0x59693b['query'][_0x3e83('0x36')](_0x3e83('0x37'))){_0x5ee7a3[_0x3e83('0x38')]=qs[_0x3e83('0x38')](_0x59693b['query']['limit']);_0x5ee7a3[_0x3e83('0x1d')]=qs[_0x3e83('0x1d')](_0x59693b[_0x3e83('0x32')][_0x3e83('0x1d')]);}_0x5ee7a3['order']=qs[_0x3e83('0x39')](_0x59693b[_0x3e83('0x32')][_0x3e83('0x39')]);_0x5ee7a3[_0x3e83('0x3a')]=qs[_0x3e83('0x33')](_[_0x3e83('0x3b')](_0x59693b[_0x3e83('0x32')],_0x4a5f69[_0x3e83('0x33')]),_0x5e3db9);if(_0x59693b[_0x3e83('0x32')][_0x3e83('0x3c')]){_0x5ee7a3[_0x3e83('0x3a')]=_[_0x3e83('0x3d')](_0x5ee7a3[_0x3e83('0x3a')],{'$or':_[_0x3e83('0x2c')](_0x5e3db9,function(_0x276cf1){if(_0x276cf1['type']!=='VIRTUAL'){var _0x15dbb8={};_0x15dbb8[_0x276cf1[_0x3e83('0x29')]]={'$like':'%'+_0x59693b[_0x3e83('0x32')][_0x3e83('0x3c')]+'%'};return _0x15dbb8;}})});}_0x5ee7a3=_['merge']({},_0x5ee7a3,_0x59693b['options']);var _0x24f9d3={'where':_0x5ee7a3[_0x3e83('0x3a')]};return db['UserChatInteraction'][_0x3e83('0x1c')](_0x24f9d3)['then'](function(_0x54ce70){_0x541caa[_0x3e83('0x1c')]=_0x54ce70;if(_0x59693b['query'][_0x3e83('0x3e')]){_0x5ee7a3[_0x3e83('0x3f')]=[{'all':!![]}];}return db['UserChatInteraction'][_0x3e83('0x40')](_0x5ee7a3);})['then'](function(_0x2e5cac){_0x541caa[_0x3e83('0x41')]=_0x2e5cac;return _0x541caa;})[_0x3e83('0x21')](respondWithFilteredResult(_0x490e58,_0x5ee7a3))[_0x3e83('0x42')](handleError(_0x490e58,null));};exports[_0x3e83('0x43')]=function(_0x2862dd,_0x37d94e){var _0x1d7ebd={'raw':!![],'where':{'id':_0x2862dd[_0x3e83('0x44')]['id']}},_0x163561={};_0x163561[_0x3e83('0x31')]=_[_0x3e83('0x45')](db[_0x3e83('0x2d')][_0x3e83('0x2e')]);_0x163561['query']=_[_0x3e83('0x45')](_0x2862dd[_0x3e83('0x32')]);_0x163561[_0x3e83('0x33')]=_[_0x3e83('0x46')](_0x163561[_0x3e83('0x31')],_0x163561['query']);_0x1d7ebd['attributes']=_[_0x3e83('0x46')](_0x163561[_0x3e83('0x31')],qs['fields'](_0x2862dd[_0x3e83('0x32')][_0x3e83('0x35')]));_0x1d7ebd[_0x3e83('0x34')]=_0x1d7ebd[_0x3e83('0x34')][_0x3e83('0x47')]?_0x1d7ebd[_0x3e83('0x34')]:_0x163561[_0x3e83('0x31')];if(_0x2862dd['query'][_0x3e83('0x3e')]){_0x1d7ebd[_0x3e83('0x3f')]=[{'all':!![]}];}_0x1d7ebd=_[_0x3e83('0x3d')]({},_0x1d7ebd,_0x2862dd[_0x3e83('0x48')]);return db[_0x3e83('0x2d')]['find'](_0x1d7ebd)['then'](handleEntityNotFound(_0x37d94e,null))[_0x3e83('0x21')](respondWithResult(_0x37d94e,null))['catch'](handleError(_0x37d94e,null));};exports[_0x3e83('0x49')]=function(_0x339e17,_0x4cd216){return db[_0x3e83('0x2d')]['create'](_0x339e17[_0x3e83('0x4a')],{})[_0x3e83('0x21')](function(_0x3345a2){var _0x8ce28b=_0x339e17[_0x3e83('0x4b')][_0x3e83('0x22')]({'plain':!![]});if(!_0x8ce28b)throw new Error(_0x3e83('0x4c'));if(_0x8ce28b['role']===_0x3e83('0x4b')){var _0x46280e=_0x3345a2[_0x3e83('0x22')]({'plain':!![]});var _0x46f04f='UserChatInteractions';return db['UserProfileSection'][_0x3e83('0x4d')]({'where':{'name':_0x46f04f,'userProfileId':_0x8ce28b['userProfileId']},'raw':!![]})[_0x3e83('0x21')](function(_0x2fab0e){if(_0x2fab0e&&_0x2fab0e[_0x3e83('0x4e')]===0x0){return db[_0x3e83('0x24')][_0x3e83('0x49')]({'name':_0x46280e[_0x3e83('0x29')],'resourceId':_0x46280e['id'],'type':_0x2fab0e[_0x3e83('0x29')],'sectionId':_0x2fab0e['id']},{})[_0x3e83('0x21')](function(){return _0x3345a2;});}else{return _0x3345a2;}})[_0x3e83('0x42')](function(_0x200859){logger['error'](_0x3e83('0x4f'),_0x200859);throw _0x200859;});}return _0x3345a2;})['then'](respondWithResult(_0x4cd216,0xc9))['catch'](handleError(_0x4cd216,null));};exports[_0x3e83('0x50')]=function(_0x491d16,_0x46800d){if(_0x491d16[_0x3e83('0x4a')]['id']){delete _0x491d16[_0x3e83('0x4a')]['id'];}return db[_0x3e83('0x2d')]['find']({'where':{'id':_0x491d16[_0x3e83('0x44')]['id']}})['then'](handleEntityNotFound(_0x46800d,null))[_0x3e83('0x21')](saveUpdates(_0x491d16[_0x3e83('0x4a')],null))['then'](respondWithResult(_0x46800d,null))[_0x3e83('0x42')](handleError(_0x46800d,null));};exports['destroy']=function(_0x23620f,_0x40d140){return db[_0x3e83('0x2d')]['find']({'where':{'id':_0x23620f[_0x3e83('0x44')]['id']}})[_0x3e83('0x21')](handleEntityNotFound(_0x40d140,null))[_0x3e83('0x21')](removeEntity(_0x40d140,null))[_0x3e83('0x42')](handleError(_0x40d140,null));}; \ No newline at end of file +var _0x89a4=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserChatInteractions','UserProfileResource','error','name','index','map','UserChatInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x89a4,0x1e4));var _0x489a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x89a4[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x489a('0x0'));var rimraf=require(_0x489a('0x1'));var zipdir=require(_0x489a('0x2'));var jsonpatch=require(_0x489a('0x3'));var rp=require('request-promise');var moment=require(_0x489a('0x4'));var BPromise=require(_0x489a('0x5'));var Mustache=require(_0x489a('0x6'));var util=require(_0x489a('0x7'));var path=require(_0x489a('0x8'));var sox=require('sox');var csv=require(_0x489a('0x9'));var ejs=require(_0x489a('0xa'));var fs=require('fs');var _=require(_0x489a('0xb'));var squel=require(_0x489a('0xc'));var crypto=require(_0x489a('0xd'));var jsforce=require(_0x489a('0xe'));var deskjs=require(_0x489a('0xf'));var toCsv=require(_0x489a('0x9'));var querystring=require(_0x489a('0x10'));var Papa=require(_0x489a('0x11'));var Redis=require(_0x489a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x489a('0x13'));var as=require(_0x489a('0x14'));var hardwareService=require(_0x489a('0x15'));var logger=require(_0x489a('0x16'))(_0x489a('0x17'));var utils=require(_0x489a('0x18'));var config=require(_0x489a('0x19'));var licenseUtil=require(_0x489a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bb703,_0x62e0d4){_0x62e0d4=_0x62e0d4||0xcc;return function(_0x263120){if(_0x263120){return _0x3bb703[_0x489a('0x1b')](_0x62e0d4);}return _0x3bb703[_0x489a('0x1c')](_0x62e0d4)[_0x489a('0x1d')]();};}function respondWithResult(_0x544a1b,_0x388bb6){_0x388bb6=_0x388bb6||0xc8;return function(_0x479b4b){if(_0x479b4b){return _0x544a1b['status'](_0x388bb6)[_0x489a('0x1e')](_0x479b4b);}};}function respondWithFilteredResult(_0x244695,_0x50fba0){return function(_0xa28784){if(_0xa28784){var _0x4387d0=_0xa28784[_0x489a('0x1f')],_0x5e3660=_0x50fba0[_0x489a('0x20')],_0x48e78a=_0x50fba0[_0x489a('0x20')]+_0x50fba0[_0x489a('0x21')],_0x539bda;if(_0x48e78a>=_0x4387d0){_0x48e78a=_0x4387d0;_0x539bda=0xc8;}else{_0x539bda=0xce;}_0x244695[_0x489a('0x1c')](_0x539bda);return _0x244695[_0x489a('0x22')](_0x489a('0x23'),_0x5e3660+'-'+_0x48e78a+'/'+_0x4387d0)['json'](_0xa28784);}return null;};}function patchUpdates(_0x2fbe7f){return function(_0x4295cd){try{jsonpatch[_0x489a('0x24')](_0x4295cd,_0x2fbe7f,!![]);}catch(_0x24f1cd){return BPromise[_0x489a('0x25')](_0x24f1cd);}return _0x4295cd[_0x489a('0x26')]();};}function saveUpdates(_0x48077d,_0x3d06dc){return function(_0x412d51){if(_0x412d51){return _0x412d51[_0x489a('0x27')](_0x48077d)['then'](function(_0x48d1ed){return _0x48d1ed;});}return null;};}function removeEntity(_0x2c723f,_0x551ed3){return function(_0x508584){if(_0x508584){return _0x508584[_0x489a('0x28')]()[_0x489a('0x29')](function(){var _0x5b73e0=_0x508584[_0x489a('0x2a')]({'plain':!![]});var _0x4b9ced=_0x489a('0x2b');return db[_0x489a('0x2c')][_0x489a('0x28')]({'where':{'type':_0x4b9ced,'resourceId':_0x5b73e0['id']}})[_0x489a('0x29')](function(){return _0x508584;});})[_0x489a('0x29')](function(){_0x2c723f[_0x489a('0x1c')](0xcc)[_0x489a('0x1d')]();});}};}function handleEntityNotFound(_0x32740c,_0x482768){return function(_0x5ea922){if(!_0x5ea922){_0x32740c['sendStatus'](0x194);}return _0x5ea922;};}function handleError(_0x142388,_0x5557cd){_0x5557cd=_0x5557cd||0x1f4;return function(_0x268d03){logger[_0x489a('0x2d')](_0x268d03['stack']);if(_0x268d03[_0x489a('0x2e')]){delete _0x268d03[_0x489a('0x2e')];}_0x142388[_0x489a('0x1c')](_0x5557cd)['send'](_0x268d03);};}exports[_0x489a('0x2f')]=function(_0x588518,_0x2aed14){var _0x2efb9d={},_0xe1b5c2={},_0x4346f5={'count':0x0,'rows':[]};var _0x185598=_[_0x489a('0x30')](db[_0x489a('0x31')][_0x489a('0x32')],function(_0x249523){return{'name':_0x249523[_0x489a('0x33')],'type':_0x249523[_0x489a('0x34')]['key']};});_0xe1b5c2['model']=_['map'](_0x185598,_0x489a('0x2e'));_0xe1b5c2[_0x489a('0x35')]=_[_0x489a('0x36')](_0x588518[_0x489a('0x35')]);_0xe1b5c2[_0x489a('0x37')]=_[_0x489a('0x38')](_0xe1b5c2[_0x489a('0x39')],_0xe1b5c2['query']);_0x2efb9d[_0x489a('0x3a')]=_[_0x489a('0x38')](_0xe1b5c2[_0x489a('0x39')],qs[_0x489a('0x3b')](_0x588518[_0x489a('0x35')][_0x489a('0x3b')]));_0x2efb9d['attributes']=_0x2efb9d[_0x489a('0x3a')][_0x489a('0x3c')]?_0x2efb9d[_0x489a('0x3a')]:_0xe1b5c2['model'];if(!_0x588518[_0x489a('0x35')][_0x489a('0x3d')](_0x489a('0x3e'))){_0x2efb9d[_0x489a('0x21')]=qs[_0x489a('0x21')](_0x588518[_0x489a('0x35')][_0x489a('0x21')]);_0x2efb9d['offset']=qs['offset'](_0x588518['query'][_0x489a('0x20')]);}_0x2efb9d[_0x489a('0x3f')]=qs[_0x489a('0x40')](_0x588518['query'][_0x489a('0x40')]);_0x2efb9d[_0x489a('0x41')]=qs[_0x489a('0x37')](_['pick'](_0x588518[_0x489a('0x35')],_0xe1b5c2[_0x489a('0x37')]),_0x185598);if(_0x588518[_0x489a('0x35')][_0x489a('0x42')]){_0x2efb9d[_0x489a('0x41')]=_[_0x489a('0x43')](_0x2efb9d[_0x489a('0x41')],{'$or':_['map'](_0x185598,function(_0x1de917){if(_0x1de917[_0x489a('0x34')]!==_0x489a('0x44')){var _0x3d9e70={};_0x3d9e70[_0x1de917[_0x489a('0x2e')]]={'$like':'%'+_0x588518[_0x489a('0x35')][_0x489a('0x42')]+'%'};return _0x3d9e70;}})});}_0x2efb9d=_['merge']({},_0x2efb9d,_0x588518[_0x489a('0x45')]);var _0x11cefb={'where':_0x2efb9d['where']};return db[_0x489a('0x31')][_0x489a('0x1f')](_0x11cefb)[_0x489a('0x29')](function(_0x2da3ed){_0x4346f5[_0x489a('0x1f')]=_0x2da3ed;if(_0x588518[_0x489a('0x35')]['includeAll']){_0x2efb9d[_0x489a('0x46')]=[{'all':!![]}];}return db[_0x489a('0x31')][_0x489a('0x47')](_0x2efb9d);})['then'](function(_0x23fd09){_0x4346f5[_0x489a('0x48')]=_0x23fd09;return _0x4346f5;})[_0x489a('0x29')](respondWithFilteredResult(_0x2aed14,_0x2efb9d))['catch'](handleError(_0x2aed14,null));};exports[_0x489a('0x49')]=function(_0x31fcc1,_0x3ca557){var _0x183c3f={'raw':!![],'where':{'id':_0x31fcc1[_0x489a('0x4a')]['id']}},_0x398e9a={};_0x398e9a[_0x489a('0x39')]=_[_0x489a('0x36')](db[_0x489a('0x31')]['rawAttributes']);_0x398e9a[_0x489a('0x35')]=_[_0x489a('0x36')](_0x31fcc1[_0x489a('0x35')]);_0x398e9a[_0x489a('0x37')]=_[_0x489a('0x38')](_0x398e9a[_0x489a('0x39')],_0x398e9a[_0x489a('0x35')]);_0x183c3f[_0x489a('0x3a')]=_[_0x489a('0x38')](_0x398e9a[_0x489a('0x39')],qs['fields'](_0x31fcc1['query'][_0x489a('0x3b')]));_0x183c3f[_0x489a('0x3a')]=_0x183c3f[_0x489a('0x3a')][_0x489a('0x3c')]?_0x183c3f[_0x489a('0x3a')]:_0x398e9a[_0x489a('0x39')];if(_0x31fcc1[_0x489a('0x35')]['includeAll']){_0x183c3f[_0x489a('0x46')]=[{'all':!![]}];}_0x183c3f=_['merge']({},_0x183c3f,_0x31fcc1[_0x489a('0x45')]);return db[_0x489a('0x31')][_0x489a('0x4b')](_0x183c3f)['then'](handleEntityNotFound(_0x3ca557,null))[_0x489a('0x29')](respondWithResult(_0x3ca557,null))['catch'](handleError(_0x3ca557,null));};exports['create']=function(_0xf44740,_0x37a037){return db[_0x489a('0x31')][_0x489a('0x4c')](_0xf44740['body'],{})[_0x489a('0x29')](function(_0x58c323){var _0x272b86=_0xf44740['user'][_0x489a('0x2a')]({'plain':!![]});if(!_0x272b86)throw new Error(_0x489a('0x4d'));if(_0x272b86[_0x489a('0x4e')]==='user'){var _0x535c80=_0x58c323[_0x489a('0x2a')]({'plain':!![]});var _0x1aba8f=_0x489a('0x2b');return db['UserProfileSection'][_0x489a('0x4b')]({'where':{'name':_0x1aba8f,'userProfileId':_0x272b86[_0x489a('0x4f')]},'raw':!![]})['then'](function(_0x5885be){if(_0x5885be&&_0x5885be[_0x489a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x535c80[_0x489a('0x2e')],'resourceId':_0x535c80['id'],'type':_0x5885be[_0x489a('0x2e')],'sectionId':_0x5885be['id']},{})[_0x489a('0x29')](function(){return _0x58c323;});}else{return _0x58c323;}})[_0x489a('0x51')](function(_0x3653a2){logger[_0x489a('0x2d')](_0x489a('0x52'),_0x3653a2);throw _0x3653a2;});}return _0x58c323;})[_0x489a('0x29')](respondWithResult(_0x37a037,0xc9))[_0x489a('0x51')](handleError(_0x37a037,null));};exports[_0x489a('0x27')]=function(_0x3d3b14,_0x4b4511){if(_0x3d3b14['body']['id']){delete _0x3d3b14['body']['id'];}return db[_0x489a('0x31')]['find']({'where':{'id':_0x3d3b14['params']['id']}})['then'](handleEntityNotFound(_0x4b4511,null))[_0x489a('0x29')](saveUpdates(_0x3d3b14['body'],null))[_0x489a('0x29')](respondWithResult(_0x4b4511,null))[_0x489a('0x51')](handleError(_0x4b4511,null));};exports['destroy']=function(_0x1953ee,_0x3ea4b3){return db[_0x489a('0x31')]['find']({'where':{'id':_0x1953ee[_0x489a('0x4a')]['id']}})[_0x489a('0x29')](handleEntityNotFound(_0x3ea4b3,null))[_0x489a('0x29')](removeEntity(_0x3ea4b3,null))['catch'](handleError(_0x3ea4b3,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index 727cd9f..f9f30cb 100644 --- a/server/api/UserChatInteraction/UserChatInteraction.model.js +++ b/server/api/UserChatInteraction/UserChatInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6513=['api','moment','request-promise','path','rimraf','define','UserChatInteraction','user_has_chat_interactions','lodash','util','../../config/logger'];(function(_0x4940b3,_0x1fb603){var _0x2c4629=function(_0x465385){while(--_0x465385){_0x4940b3['push'](_0x4940b3['shift']());}};_0x2c4629(++_0x1fb603);}(_0x6513,0x97));var _0x3651=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x6513[_0x154940];return _0x401409;};'use strict';var _=require(_0x3651('0x0'));var util=require(_0x3651('0x1'));var logger=require(_0x3651('0x2'))(_0x3651('0x3'));var moment=require(_0x3651('0x4'));var BPromise=require('bluebird');var rp=require(_0x3651('0x5'));var fs=require('fs');var path=require(_0x3651('0x6'));var rimraf=require(_0x3651('0x7'));var config=require('../../config/environment');var attributes=require('./UserChatInteraction.attributes');module['exports']=function(_0x1673d9,_0x38a5d9){return _0x1673d9[_0x3651('0x8')](_0x3651('0x9'),attributes,{'tableName':_0x3651('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4309=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserChatInteraction','user_has_chat_interactions','lodash','util','../../config/logger'];(function(_0x21125f,_0x8079f8){var _0x2f421d=function(_0x231299){while(--_0x231299){_0x21125f['push'](_0x21125f['shift']());}};_0x2f421d(++_0x8079f8);}(_0x4309,0x1c4));var _0x9430=function(_0x39d20c,_0x7456ee){_0x39d20c=_0x39d20c-0x0;var _0x5f585b=_0x4309[_0x39d20c];return _0x5f585b;};'use strict';var _=require(_0x9430('0x0'));var util=require(_0x9430('0x1'));var logger=require(_0x9430('0x2'))(_0x9430('0x3'));var moment=require(_0x9430('0x4'));var BPromise=require('bluebird');var rp=require(_0x9430('0x5'));var fs=require('fs');var path=require(_0x9430('0x6'));var rimraf=require(_0x9430('0x7'));var config=require(_0x9430('0x8'));var attributes=require('./UserChatInteraction.attributes');module[_0x9430('0x9')]=function(_0x32a6c3,_0x4da31c){return _0x32a6c3[_0x9430('0xa')](_0x9430('0xb'),attributes,{'tableName':_0x9430('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.rpc.js b/server/api/UserChatInteraction/UserChatInteraction.rpc.js index 6c83ce1..39abc12 100644 --- a/server/api/UserChatInteraction/UserChatInteraction.rpc.js +++ b/server/api/UserChatInteraction/UserChatInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb495=['jayson/promise','http','request','then','info','UserChatInteraction,\x20%s,\x20%s','debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2f4dcc,_0x546a13){var _0x49fa25=function(_0x5a01f0){while(--_0x5a01f0){_0x2f4dcc['push'](_0x2f4dcc['shift']());}};_0x49fa25(++_0x546a13);}(_0xb495,0x111));var _0x5b49=function(_0xcd120c,_0x1bca47){_0xcd120c=_0xcd120c-0x0;var _0x1f73da=_0xb495[_0xcd120c];return _0x1f73da;};'use strict';var _=require(_0x5b49('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5b49('0x1'));var rs=require(_0x5b49('0x2'));var fs=require('fs');var Redis=require(_0x5b49('0x3'));var db=require(_0x5b49('0x4'))['db'];var utils=require(_0x5b49('0x5'));var logger=require('../../config/logger')(_0x5b49('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b49('0x7'));var client=jayson['client'][_0x5b49('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x470db5,_0x5150b6,_0x2ab859){return new BPromise(function(_0x189410,_0x5748ae){return client[_0x5b49('0x9')](_0x470db5,_0x2ab859)[_0x5b49('0xa')](function(_0x5b56dd){logger[_0x5b49('0xb')](_0x5b49('0xc'),_0x5150b6,'request\x20sent');logger[_0x5b49('0xd')](_0x5b49('0xe'),_0x5150b6,_0x5b49('0xf'),JSON[_0x5b49('0x10')](_0x5b56dd));if(_0x5b56dd[_0x5b49('0x11')]){if(_0x5b56dd[_0x5b49('0x11')]['code']===0x1f4){logger[_0x5b49('0x11')](_0x5b49('0xc'),_0x5150b6,_0x5b56dd[_0x5b49('0x11')]['message']);return _0x5748ae(_0x5b56dd['error']['message']);}logger['error'](_0x5b49('0xc'),_0x5150b6,_0x5b56dd[_0x5b49('0x11')][_0x5b49('0x12')]);return _0x189410(_0x5b56dd[_0x5b49('0x11')][_0x5b49('0x12')]);}else{logger[_0x5b49('0xb')](_0x5b49('0xc'),_0x5150b6,_0x5b49('0xf'));_0x189410(_0x5b56dd[_0x5b49('0x13')][_0x5b49('0x12')]);}})['catch'](function(_0xb9836e){logger['error'](_0x5b49('0xc'),_0x5150b6,_0xb9836e);_0x5748ae(_0xb9836e);});});} \ No newline at end of file +var _0xfe56=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','UserChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xfe56,0x190));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x6fe5('0x0'));var moment=require('moment');var BPromise=require(_0x6fe5('0x1'));var rs=require(_0x6fe5('0x2'));var fs=require('fs');var Redis=require(_0x6fe5('0x3'));var db=require(_0x6fe5('0x4'))['db'];var utils=require(_0x6fe5('0x5'));var logger=require('../../config/logger')(_0x6fe5('0x6'));var config=require(_0x6fe5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6fe5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14b8c9,_0x3208e6,_0x38f909){return new BPromise(function(_0x40c32c,_0xb05a84){return client[_0x6fe5('0x9')](_0x14b8c9,_0x38f909)[_0x6fe5('0xa')](function(_0x4cd16d){logger[_0x6fe5('0xb')](_0x6fe5('0xc'),_0x3208e6,_0x6fe5('0xd'));logger['debug']('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x3208e6,_0x6fe5('0xd'),JSON[_0x6fe5('0xe')](_0x4cd16d));if(_0x4cd16d['error']){if(_0x4cd16d[_0x6fe5('0xf')][_0x6fe5('0x10')]===0x1f4){logger[_0x6fe5('0xf')](_0x6fe5('0xc'),_0x3208e6,_0x4cd16d[_0x6fe5('0xf')][_0x6fe5('0x11')]);return _0xb05a84(_0x4cd16d[_0x6fe5('0xf')]['message']);}logger[_0x6fe5('0xf')](_0x6fe5('0xc'),_0x3208e6,_0x4cd16d['error'][_0x6fe5('0x11')]);return _0x40c32c(_0x4cd16d['error'][_0x6fe5('0x11')]);}else{logger[_0x6fe5('0xb')](_0x6fe5('0xc'),_0x3208e6,_0x6fe5('0xd'));_0x40c32c(_0x4cd16d[_0x6fe5('0x12')][_0x6fe5('0x11')]);}})[_0x6fe5('0x13')](function(_0x25497c){logger[_0x6fe5('0xf')](_0x6fe5('0xc'),_0x3208e6,_0x25497c);_0xb05a84(_0x25497c);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index bb0f9d4..ffdd4e6 100644 --- a/server/api/UserChatInteraction/index.js +++ b/server/api/UserChatInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a1a=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x3979d4,_0x2f816f){var _0x381f3c=function(_0x3d5408){while(--_0x3d5408){_0x3979d4['push'](_0x3979d4['shift']());}};_0x381f3c(++_0x2f816f);}(_0x7a1a,0x65));var _0xa7a1=function(_0x5e10a0,_0x5b99da){_0x5e10a0=_0x5e10a0-0x0;var _0x259327=_0x7a1a[_0x5e10a0];return _0x259327;};'use strict';var multer=require(_0xa7a1('0x0'));var util=require(_0xa7a1('0x1'));var path=require(_0xa7a1('0x2'));var timeout=require(_0xa7a1('0x3'));var express=require(_0xa7a1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa7a1('0x5'));var config=require(_0xa7a1('0x6'));var controller=require('./UserChatInteraction.controller');router[_0xa7a1('0x7')]('/',auth[_0xa7a1('0x8')](),controller['index']);router[_0xa7a1('0x7')](_0xa7a1('0x9'),auth[_0xa7a1('0x8')](),controller[_0xa7a1('0xa')]);router[_0xa7a1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa7a1('0xc')](_0xa7a1('0x9'),auth[_0xa7a1('0x8')](),controller[_0xa7a1('0xd')]);router[_0xa7a1('0xe')](_0xa7a1('0x9'),auth['isAuthenticated'](),controller[_0xa7a1('0xf')]);module[_0xa7a1('0x10')]=router; \ No newline at end of file +var _0x655c=['../../components/interaction/service','./UserChatInteraction.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xc6d25f,_0x11195a){var _0x3f3a93=function(_0x321811){while(--_0x321811){_0xc6d25f['push'](_0xc6d25f['shift']());}};_0x3f3a93(++_0x11195a);}(_0x655c,0x1c1));var _0xc655=function(_0x2e2015,_0x59be18){_0x2e2015=_0x2e2015-0x0;var _0x541dad=_0x655c[_0x2e2015];return _0x541dad;};'use strict';var multer=require(_0xc655('0x0'));var util=require(_0xc655('0x1'));var path=require(_0xc655('0x2'));var timeout=require(_0xc655('0x3'));var express=require(_0xc655('0x4'));var router=express[_0xc655('0x5')]();var auth=require(_0xc655('0x6'));var interaction=require(_0xc655('0x7'));var config=require('../../config/environment');var controller=require(_0xc655('0x8'));router[_0xc655('0x9')]('/',auth['isAuthenticated'](),controller[_0xc655('0xa')]);router[_0xc655('0x9')](_0xc655('0xb'),auth[_0xc655('0xc')](),controller[_0xc655('0xd')]);router[_0xc655('0xe')]('/',auth[_0xc655('0xc')](),controller['create']);router[_0xc655('0xf')]('/:id',auth[_0xc655('0xc')](),controller[_0xc655('0x10')]);router['delete']('/:id',auth[_0xc655('0xc')](),controller[_0xc655('0x11')]);module[_0xc655('0x12')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index 9575530..f2b93c5 100644 --- a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js +++ b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93d6=['exports','INTEGER','sequelize'];(function(_0xb1b594,_0x36a359){var _0x23a380=function(_0x2c7b9c){while(--_0x2c7b9c){_0xb1b594['push'](_0xb1b594['shift']());}};_0x23a380(++_0x36a359);}(_0x93d6,0xda));var _0x693d=function(_0x1c721e,_0x4a02b1){_0x1c721e=_0x1c721e-0x0;var _0x2b3458=_0x93d6[_0x1c721e];return _0x2b3458;};'use strict';var Sequelize=require(_0x693d('0x0'));module[_0x693d('0x1')]={'FaxInteractionId':{'type':Sequelize[_0x693d('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x693d('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x225d=['INTEGER','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x225d,0x12a));var _0xd225=function(_0x13bc34,_0x3d9a38){_0x13bc34=_0x13bc34-0x0;var _0x5898b0=_0x225d[_0x13bc34];return _0x5898b0;};'use strict';var Sequelize=require(_0xd225('0x0'));module[_0xd225('0x1')]={'FaxInteractionId':{'type':Sequelize[_0xd225('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xd225('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js index 2014635..b54bbc8 100644 --- a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js +++ b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4067=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserFaxInteractions','UserProfileResource','error','stack','name','index','map','UserFaxInteraction','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','keys','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x4d0c2c,_0x370f92){var _0x17995a=function(_0x4fa883){while(--_0x4fa883){_0x4d0c2c['push'](_0x4d0c2c['shift']());}};_0x17995a(++_0x370f92);}(_0x4067,0x1d8));var _0x7406=function(_0xdf6edb,_0x343e0d){_0xdf6edb=_0xdf6edb-0x0;var _0x37fd36=_0x4067[_0xdf6edb];return _0x37fd36;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7406('0x0'));var rimraf=require(_0x7406('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7406('0x2'));var rp=require(_0x7406('0x3'));var moment=require(_0x7406('0x4'));var BPromise=require(_0x7406('0x5'));var Mustache=require(_0x7406('0x6'));var util=require(_0x7406('0x7'));var path=require('path');var sox=require(_0x7406('0x8'));var csv=require(_0x7406('0x9'));var ejs=require(_0x7406('0xa'));var fs=require('fs');var _=require(_0x7406('0xb'));var squel=require(_0x7406('0xc'));var crypto=require(_0x7406('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7406('0x9'));var querystring=require(_0x7406('0xe'));var Papa=require(_0x7406('0xf'));var Redis=require(_0x7406('0x10'));var authService=require(_0x7406('0x11'));var qs=require(_0x7406('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7406('0x13'));var logger=require(_0x7406('0x14'))(_0x7406('0x15'));var utils=require(_0x7406('0x16'));var config=require(_0x7406('0x17'));var licenseUtil=require(_0x7406('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x501f48,_0x2f0246){_0x2f0246=_0x2f0246||0xcc;return function(_0x24d05f){if(_0x24d05f){return _0x501f48[_0x7406('0x19')](_0x2f0246);}return _0x501f48['status'](_0x2f0246)[_0x7406('0x1a')]();};}function respondWithResult(_0x3dee06,_0x138546){_0x138546=_0x138546||0xc8;return function(_0x1296f2){if(_0x1296f2){return _0x3dee06[_0x7406('0x1b')](_0x138546)['json'](_0x1296f2);}};}function respondWithFilteredResult(_0x2341e3,_0x4ee936){return function(_0x23061b){if(_0x23061b){var _0x3d6559=_0x23061b[_0x7406('0x1c')],_0x4ca453=_0x4ee936['offset'],_0x244ecd=_0x4ee936[_0x7406('0x1d')]+_0x4ee936[_0x7406('0x1e')],_0x3f6321;if(_0x244ecd>=_0x3d6559){_0x244ecd=_0x3d6559;_0x3f6321=0xc8;}else{_0x3f6321=0xce;}_0x2341e3[_0x7406('0x1b')](_0x3f6321);return _0x2341e3['set'](_0x7406('0x1f'),_0x4ca453+'-'+_0x244ecd+'/'+_0x3d6559)['json'](_0x23061b);}return null;};}function patchUpdates(_0x4c6e72){return function(_0xfa8380){try{jsonpatch[_0x7406('0x20')](_0xfa8380,_0x4c6e72,!![]);}catch(_0x209d41){return BPromise[_0x7406('0x21')](_0x209d41);}return _0xfa8380[_0x7406('0x22')]();};}function saveUpdates(_0x4708f7,_0x2c79ad){return function(_0x3e8301){if(_0x3e8301){return _0x3e8301[_0x7406('0x23')](_0x4708f7)[_0x7406('0x24')](function(_0x44017e){return _0x44017e;});}return null;};}function removeEntity(_0x8aacd5,_0x379860){return function(_0x142fbd){if(_0x142fbd){return _0x142fbd[_0x7406('0x25')]()[_0x7406('0x24')](function(){var _0x5ed315=_0x142fbd[_0x7406('0x26')]({'plain':!![]});var _0x148cff=_0x7406('0x27');return db[_0x7406('0x28')][_0x7406('0x25')]({'where':{'type':_0x148cff,'resourceId':_0x5ed315['id']}})[_0x7406('0x24')](function(){return _0x142fbd;});})[_0x7406('0x24')](function(){_0x8aacd5['status'](0xcc)[_0x7406('0x1a')]();});}};}function handleEntityNotFound(_0x546812,_0xa32fe7){return function(_0x43cdf0){if(!_0x43cdf0){_0x546812[_0x7406('0x19')](0x194);}return _0x43cdf0;};}function handleError(_0x3eccfb,_0x1cf716){_0x1cf716=_0x1cf716||0x1f4;return function(_0x5ba901){logger[_0x7406('0x29')](_0x5ba901[_0x7406('0x2a')]);if(_0x5ba901[_0x7406('0x2b')]){delete _0x5ba901[_0x7406('0x2b')];}_0x3eccfb[_0x7406('0x1b')](_0x1cf716)['send'](_0x5ba901);};}exports[_0x7406('0x2c')]=function(_0x320406,_0x4880cf){var _0x2f91f3={},_0x292ca0={},_0x641ee7={'count':0x0,'rows':[]};var _0x56e135=_[_0x7406('0x2d')](db[_0x7406('0x2e')][_0x7406('0x2f')],function(_0x14f0e4){return{'name':_0x14f0e4['fieldName'],'type':_0x14f0e4[_0x7406('0x30')][_0x7406('0x31')]};});_0x292ca0[_0x7406('0x32')]=_[_0x7406('0x2d')](_0x56e135,_0x7406('0x2b'));_0x292ca0[_0x7406('0x33')]=_['keys'](_0x320406[_0x7406('0x33')]);_0x292ca0[_0x7406('0x34')]=_['intersection'](_0x292ca0[_0x7406('0x32')],_0x292ca0[_0x7406('0x33')]);_0x2f91f3[_0x7406('0x35')]=_[_0x7406('0x36')](_0x292ca0[_0x7406('0x32')],qs['fields'](_0x320406['query'][_0x7406('0x37')]));_0x2f91f3['attributes']=_0x2f91f3[_0x7406('0x35')]['length']?_0x2f91f3[_0x7406('0x35')]:_0x292ca0[_0x7406('0x32')];if(!_0x320406[_0x7406('0x33')][_0x7406('0x38')](_0x7406('0x39'))){_0x2f91f3[_0x7406('0x1e')]=qs[_0x7406('0x1e')](_0x320406[_0x7406('0x33')][_0x7406('0x1e')]);_0x2f91f3[_0x7406('0x1d')]=qs[_0x7406('0x1d')](_0x320406['query'][_0x7406('0x1d')]);}_0x2f91f3[_0x7406('0x3a')]=qs[_0x7406('0x3b')](_0x320406['query'][_0x7406('0x3b')]);_0x2f91f3[_0x7406('0x3c')]=qs[_0x7406('0x34')](_[_0x7406('0x3d')](_0x320406[_0x7406('0x33')],_0x292ca0[_0x7406('0x34')]),_0x56e135);if(_0x320406[_0x7406('0x33')]['filter']){_0x2f91f3[_0x7406('0x3c')]=_[_0x7406('0x3e')](_0x2f91f3[_0x7406('0x3c')],{'$or':_[_0x7406('0x2d')](_0x56e135,function(_0x4e3b05){if(_0x4e3b05[_0x7406('0x30')]!==_0x7406('0x3f')){var _0x158a32={};_0x158a32[_0x4e3b05[_0x7406('0x2b')]]={'$like':'%'+_0x320406[_0x7406('0x33')][_0x7406('0x40')]+'%'};return _0x158a32;}})});}_0x2f91f3=_[_0x7406('0x3e')]({},_0x2f91f3,_0x320406['options']);var _0x1928aa={'where':_0x2f91f3[_0x7406('0x3c')]};return db[_0x7406('0x2e')][_0x7406('0x1c')](_0x1928aa)[_0x7406('0x24')](function(_0x112fdb){_0x641ee7[_0x7406('0x1c')]=_0x112fdb;if(_0x320406[_0x7406('0x33')][_0x7406('0x41')]){_0x2f91f3[_0x7406('0x42')]=[{'all':!![]}];}return db[_0x7406('0x2e')][_0x7406('0x43')](_0x2f91f3);})[_0x7406('0x24')](function(_0x3c7b10){_0x641ee7['rows']=_0x3c7b10;return _0x641ee7;})[_0x7406('0x24')](respondWithFilteredResult(_0x4880cf,_0x2f91f3))[_0x7406('0x44')](handleError(_0x4880cf,null));};exports[_0x7406('0x45')]=function(_0x5ec0ac,_0x159836){var _0x4658bf={'raw':!![],'where':{'id':_0x5ec0ac[_0x7406('0x46')]['id']}},_0xfca08f={};_0xfca08f['model']=_['keys'](db[_0x7406('0x2e')][_0x7406('0x2f')]);_0xfca08f[_0x7406('0x33')]=_[_0x7406('0x47')](_0x5ec0ac[_0x7406('0x33')]);_0xfca08f[_0x7406('0x34')]=_[_0x7406('0x36')](_0xfca08f[_0x7406('0x32')],_0xfca08f[_0x7406('0x33')]);_0x4658bf[_0x7406('0x35')]=_[_0x7406('0x36')](_0xfca08f[_0x7406('0x32')],qs[_0x7406('0x37')](_0x5ec0ac[_0x7406('0x33')][_0x7406('0x37')]));_0x4658bf[_0x7406('0x35')]=_0x4658bf['attributes']['length']?_0x4658bf[_0x7406('0x35')]:_0xfca08f[_0x7406('0x32')];if(_0x5ec0ac[_0x7406('0x33')][_0x7406('0x41')]){_0x4658bf['include']=[{'all':!![]}];}_0x4658bf=_[_0x7406('0x3e')]({},_0x4658bf,_0x5ec0ac[_0x7406('0x48')]);return db[_0x7406('0x2e')]['find'](_0x4658bf)[_0x7406('0x24')](handleEntityNotFound(_0x159836,null))[_0x7406('0x24')](respondWithResult(_0x159836,null))['catch'](handleError(_0x159836,null));};exports[_0x7406('0x49')]=function(_0x52a488,_0x2955e8){return db[_0x7406('0x2e')][_0x7406('0x49')](_0x52a488[_0x7406('0x4a')],{})[_0x7406('0x24')](function(_0x9b2a66){var _0x1acff8=_0x52a488['user'][_0x7406('0x26')]({'plain':!![]});if(!_0x1acff8)throw new Error(_0x7406('0x4b'));if(_0x1acff8[_0x7406('0x4c')]===_0x7406('0x4d')){var _0x24998f=_0x9b2a66[_0x7406('0x26')]({'plain':!![]});var _0x3e5664=_0x7406('0x27');return db[_0x7406('0x4e')][_0x7406('0x4f')]({'where':{'name':_0x3e5664,'userProfileId':_0x1acff8[_0x7406('0x50')]},'raw':!![]})[_0x7406('0x24')](function(_0x2ffbef){if(_0x2ffbef&&_0x2ffbef[_0x7406('0x51')]===0x0){return db[_0x7406('0x28')][_0x7406('0x49')]({'name':_0x24998f['name'],'resourceId':_0x24998f['id'],'type':_0x2ffbef[_0x7406('0x2b')],'sectionId':_0x2ffbef['id']},{})[_0x7406('0x24')](function(){return _0x9b2a66;});}else{return _0x9b2a66;}})[_0x7406('0x44')](function(_0x204296){logger[_0x7406('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204296);throw _0x204296;});}return _0x9b2a66;})[_0x7406('0x24')](respondWithResult(_0x2955e8,0xc9))[_0x7406('0x44')](handleError(_0x2955e8,null));};exports[_0x7406('0x23')]=function(_0xcea5c6,_0x11fd09){if(_0xcea5c6[_0x7406('0x4a')]['id']){delete _0xcea5c6['body']['id'];}return db[_0x7406('0x2e')]['find']({'where':{'id':_0xcea5c6['params']['id']}})[_0x7406('0x24')](handleEntityNotFound(_0x11fd09,null))[_0x7406('0x24')](saveUpdates(_0xcea5c6[_0x7406('0x4a')],null))[_0x7406('0x24')](respondWithResult(_0x11fd09,null))[_0x7406('0x44')](handleError(_0x11fd09,null));};exports['destroy']=function(_0xbf83f2,_0x1a12b4){return db[_0x7406('0x2e')]['find']({'where':{'id':_0xbf83f2[_0x7406('0x46')]['id']}})[_0x7406('0x24')](handleEntityNotFound(_0x1a12b4,null))[_0x7406('0x24')](removeEntity(_0x1a12b4,null))[_0x7406('0x44')](handleError(_0x1a12b4,null));}; \ No newline at end of file +var _0x9b8c=['attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserFaxInteractions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','UserFaxInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x9b8c,0x100));var _0xc9b8=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0x9b8c[_0x548d7d];return _0xb1c878;};'use strict';var pdf=require(_0xc9b8('0x0'));var emlformat=require(_0xc9b8('0x1'));var rimraf=require(_0xc9b8('0x2'));var zipdir=require(_0xc9b8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9b8('0x4'));var moment=require(_0xc9b8('0x5'));var BPromise=require(_0xc9b8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc9b8('0x7'));var sox=require(_0xc9b8('0x8'));var csv=require(_0xc9b8('0x9'));var ejs=require(_0xc9b8('0xa'));var fs=require('fs');var _=require(_0xc9b8('0xb'));var squel=require(_0xc9b8('0xc'));var crypto=require(_0xc9b8('0xd'));var jsforce=require(_0xc9b8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc9b8('0x9'));var querystring=require('querystring');var Papa=require(_0xc9b8('0xf'));var Redis=require(_0xc9b8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc9b8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9b8('0x12'));var logger=require(_0xc9b8('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc9b8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9b8('0x15'))['db'];function respondWithStatusCode(_0x56296f,_0x395d84){_0x395d84=_0x395d84||0xcc;return function(_0x3dd659){if(_0x3dd659){return _0x56296f['sendStatus'](_0x395d84);}return _0x56296f[_0xc9b8('0x16')](_0x395d84)[_0xc9b8('0x17')]();};}function respondWithResult(_0x12449b,_0x41b675){_0x41b675=_0x41b675||0xc8;return function(_0x4da533){if(_0x4da533){return _0x12449b['status'](_0x41b675)[_0xc9b8('0x18')](_0x4da533);}};}function respondWithFilteredResult(_0x58d1f6,_0x3a9b9a){return function(_0x17ff73){if(_0x17ff73){var _0x1f398b=_0x17ff73[_0xc9b8('0x19')],_0x577472=_0x3a9b9a[_0xc9b8('0x1a')],_0x3cf4de=_0x3a9b9a['offset']+_0x3a9b9a[_0xc9b8('0x1b')],_0x3778bf;if(_0x3cf4de>=_0x1f398b){_0x3cf4de=_0x1f398b;_0x3778bf=0xc8;}else{_0x3778bf=0xce;}_0x58d1f6[_0xc9b8('0x16')](_0x3778bf);return _0x58d1f6[_0xc9b8('0x1c')](_0xc9b8('0x1d'),_0x577472+'-'+_0x3cf4de+'/'+_0x1f398b)[_0xc9b8('0x18')](_0x17ff73);}return null;};}function patchUpdates(_0x2ee8a6){return function(_0x37cb46){try{jsonpatch[_0xc9b8('0x1e')](_0x37cb46,_0x2ee8a6,!![]);}catch(_0x55d8c9){return BPromise[_0xc9b8('0x1f')](_0x55d8c9);}return _0x37cb46[_0xc9b8('0x20')]();};}function saveUpdates(_0x5e8ce7,_0x33c6ed){return function(_0x5adccf){if(_0x5adccf){return _0x5adccf[_0xc9b8('0x21')](_0x5e8ce7)[_0xc9b8('0x22')](function(_0x5395a8){return _0x5395a8;});}return null;};}function removeEntity(_0x2e4594,_0x187acc){return function(_0x566692){if(_0x566692){return _0x566692[_0xc9b8('0x23')]()[_0xc9b8('0x22')](function(){var _0x2b6fe3=_0x566692['get']({'plain':!![]});var _0x294bca='UserFaxInteractions';return db[_0xc9b8('0x24')][_0xc9b8('0x23')]({'where':{'type':_0x294bca,'resourceId':_0x2b6fe3['id']}})[_0xc9b8('0x22')](function(){return _0x566692;});})[_0xc9b8('0x22')](function(){_0x2e4594[_0xc9b8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49a4dd,_0xce6a2d){return function(_0x5ba638){if(!_0x5ba638){_0x49a4dd['sendStatus'](0x194);}return _0x5ba638;};}function handleError(_0x5dbb3e,_0x5aa1ac){_0x5aa1ac=_0x5aa1ac||0x1f4;return function(_0x2ec8a6){logger[_0xc9b8('0x25')](_0x2ec8a6[_0xc9b8('0x26')]);if(_0x2ec8a6['name']){delete _0x2ec8a6[_0xc9b8('0x27')];}_0x5dbb3e[_0xc9b8('0x16')](_0x5aa1ac)[_0xc9b8('0x28')](_0x2ec8a6);};}exports['index']=function(_0x270b07,_0x252d1d){var _0x3e1ef0={},_0x3f8e41={},_0x2bfd86={'count':0x0,'rows':[]};var _0xc85f7b=_[_0xc9b8('0x29')](db[_0xc9b8('0x2a')][_0xc9b8('0x2b')],function(_0x8a2e98){return{'name':_0x8a2e98[_0xc9b8('0x2c')],'type':_0x8a2e98[_0xc9b8('0x2d')][_0xc9b8('0x2e')]};});_0x3f8e41['model']=_['map'](_0xc85f7b,_0xc9b8('0x27'));_0x3f8e41['query']=_[_0xc9b8('0x2f')](_0x270b07[_0xc9b8('0x30')]);_0x3f8e41[_0xc9b8('0x31')]=_[_0xc9b8('0x32')](_0x3f8e41[_0xc9b8('0x33')],_0x3f8e41[_0xc9b8('0x30')]);_0x3e1ef0[_0xc9b8('0x34')]=_['intersection'](_0x3f8e41[_0xc9b8('0x33')],qs['fields'](_0x270b07[_0xc9b8('0x30')][_0xc9b8('0x35')]));_0x3e1ef0['attributes']=_0x3e1ef0['attributes'][_0xc9b8('0x36')]?_0x3e1ef0[_0xc9b8('0x34')]:_0x3f8e41[_0xc9b8('0x33')];if(!_0x270b07[_0xc9b8('0x30')]['hasOwnProperty'](_0xc9b8('0x37'))){_0x3e1ef0[_0xc9b8('0x1b')]=qs[_0xc9b8('0x1b')](_0x270b07['query']['limit']);_0x3e1ef0[_0xc9b8('0x1a')]=qs[_0xc9b8('0x1a')](_0x270b07[_0xc9b8('0x30')][_0xc9b8('0x1a')]);}_0x3e1ef0['order']=qs[_0xc9b8('0x38')](_0x270b07[_0xc9b8('0x30')][_0xc9b8('0x38')]);_0x3e1ef0[_0xc9b8('0x39')]=qs[_0xc9b8('0x31')](_['pick'](_0x270b07[_0xc9b8('0x30')],_0x3f8e41[_0xc9b8('0x31')]),_0xc85f7b);if(_0x270b07[_0xc9b8('0x30')]['filter']){_0x3e1ef0[_0xc9b8('0x39')]=_[_0xc9b8('0x3a')](_0x3e1ef0[_0xc9b8('0x39')],{'$or':_[_0xc9b8('0x29')](_0xc85f7b,function(_0x4f93bb){if(_0x4f93bb['type']!==_0xc9b8('0x3b')){var _0x57c12f={};_0x57c12f[_0x4f93bb[_0xc9b8('0x27')]]={'$like':'%'+_0x270b07[_0xc9b8('0x30')]['filter']+'%'};return _0x57c12f;}})});}_0x3e1ef0=_[_0xc9b8('0x3a')]({},_0x3e1ef0,_0x270b07[_0xc9b8('0x3c')]);var _0x560ae0={'where':_0x3e1ef0[_0xc9b8('0x39')]};return db['UserFaxInteraction'][_0xc9b8('0x19')](_0x560ae0)[_0xc9b8('0x22')](function(_0x41fe06){_0x2bfd86[_0xc9b8('0x19')]=_0x41fe06;if(_0x270b07['query'][_0xc9b8('0x3d')]){_0x3e1ef0[_0xc9b8('0x3e')]=[{'all':!![]}];}return db[_0xc9b8('0x2a')][_0xc9b8('0x3f')](_0x3e1ef0);})[_0xc9b8('0x22')](function(_0x4934a8){_0x2bfd86['rows']=_0x4934a8;return _0x2bfd86;})[_0xc9b8('0x22')](respondWithFilteredResult(_0x252d1d,_0x3e1ef0))[_0xc9b8('0x40')](handleError(_0x252d1d,null));};exports[_0xc9b8('0x41')]=function(_0x44fd97,_0x273ceb){var _0xce57c5={'raw':!![],'where':{'id':_0x44fd97[_0xc9b8('0x42')]['id']}},_0x33ac53={};_0x33ac53[_0xc9b8('0x33')]=_['keys'](db[_0xc9b8('0x2a')][_0xc9b8('0x2b')]);_0x33ac53['query']=_['keys'](_0x44fd97[_0xc9b8('0x30')]);_0x33ac53[_0xc9b8('0x31')]=_['intersection'](_0x33ac53[_0xc9b8('0x33')],_0x33ac53[_0xc9b8('0x30')]);_0xce57c5[_0xc9b8('0x34')]=_[_0xc9b8('0x32')](_0x33ac53['model'],qs[_0xc9b8('0x35')](_0x44fd97[_0xc9b8('0x30')][_0xc9b8('0x35')]));_0xce57c5[_0xc9b8('0x34')]=_0xce57c5[_0xc9b8('0x34')]['length']?_0xce57c5[_0xc9b8('0x34')]:_0x33ac53[_0xc9b8('0x33')];if(_0x44fd97[_0xc9b8('0x30')]['includeAll']){_0xce57c5['include']=[{'all':!![]}];}_0xce57c5=_['merge']({},_0xce57c5,_0x44fd97[_0xc9b8('0x3c')]);return db[_0xc9b8('0x2a')][_0xc9b8('0x43')](_0xce57c5)[_0xc9b8('0x22')](handleEntityNotFound(_0x273ceb,null))[_0xc9b8('0x22')](respondWithResult(_0x273ceb,null))[_0xc9b8('0x40')](handleError(_0x273ceb,null));};exports[_0xc9b8('0x44')]=function(_0x505e83,_0x4ff7a){return db[_0xc9b8('0x2a')][_0xc9b8('0x44')](_0x505e83[_0xc9b8('0x45')],{})[_0xc9b8('0x22')](function(_0xc13008){var _0x55cd0d=_0x505e83[_0xc9b8('0x46')][_0xc9b8('0x47')]({'plain':!![]});if(!_0x55cd0d)throw new Error(_0xc9b8('0x48'));if(_0x55cd0d['role']===_0xc9b8('0x46')){var _0xc0e9d1=_0xc13008['get']({'plain':!![]});var _0x39003b=_0xc9b8('0x49');return db[_0xc9b8('0x4a')][_0xc9b8('0x43')]({'where':{'name':_0x39003b,'userProfileId':_0x55cd0d['userProfileId']},'raw':!![]})[_0xc9b8('0x22')](function(_0x1c1ab5){if(_0x1c1ab5&&_0x1c1ab5[_0xc9b8('0x4b')]===0x0){return db[_0xc9b8('0x24')][_0xc9b8('0x44')]({'name':_0xc0e9d1[_0xc9b8('0x27')],'resourceId':_0xc0e9d1['id'],'type':_0x1c1ab5[_0xc9b8('0x27')],'sectionId':_0x1c1ab5['id']},{})[_0xc9b8('0x22')](function(){return _0xc13008;});}else{return _0xc13008;}})[_0xc9b8('0x40')](function(_0x24fc51){logger[_0xc9b8('0x25')](_0xc9b8('0x4c'),_0x24fc51);throw _0x24fc51;});}return _0xc13008;})[_0xc9b8('0x22')](respondWithResult(_0x4ff7a,0xc9))[_0xc9b8('0x40')](handleError(_0x4ff7a,null));};exports['update']=function(_0x4bf501,_0xe68ccb){if(_0x4bf501[_0xc9b8('0x45')]['id']){delete _0x4bf501['body']['id'];}return db[_0xc9b8('0x2a')][_0xc9b8('0x43')]({'where':{'id':_0x4bf501[_0xc9b8('0x42')]['id']}})['then'](handleEntityNotFound(_0xe68ccb,null))[_0xc9b8('0x22')](saveUpdates(_0x4bf501[_0xc9b8('0x45')],null))[_0xc9b8('0x22')](respondWithResult(_0xe68ccb,null))[_0xc9b8('0x40')](handleError(_0xe68ccb,null));};exports['destroy']=function(_0x424eee,_0x2b8fb7){return db['UserFaxInteraction'][_0xc9b8('0x43')]({'where':{'id':_0x424eee[_0xc9b8('0x42')]['id']}})[_0xc9b8('0x22')](handleEntityNotFound(_0x2b8fb7,null))['then'](removeEntity(_0x2b8fb7,null))[_0xc9b8('0x40')](handleError(_0x2b8fb7,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index 5a6f737..ffbdc22 100644 --- a/server/api/UserFaxInteraction/UserFaxInteraction.model.js +++ b/server/api/UserFaxInteraction/UserFaxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['request-promise','path','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','util','api','moment','bluebird'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./UserFaxInteraction.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','util','api','moment','bluebird'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./UserFaxInteraction.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js index f2e3d62..3deaf4d 100644 --- a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js +++ b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb576=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','UserFaxInteraction,\x20%s,\x20%s','request\x20sent','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x35f3b5,_0xcbee2d){var _0x5d2a4c=function(_0x118d66){while(--_0x118d66){_0x35f3b5['push'](_0x35f3b5['shift']());}};_0x5d2a4c(++_0xcbee2d);}(_0xb576,0x193));var _0x6b57=function(_0x55370,_0x5adaf2){_0x55370=_0x55370-0x0;var _0x42fa1b=_0xb576[_0x55370];return _0x42fa1b;};'use strict';var _=require(_0x6b57('0x0'));var util=require(_0x6b57('0x1'));var moment=require(_0x6b57('0x2'));var BPromise=require(_0x6b57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b57('0x4'))['db'];var utils=require(_0x6b57('0x5'));var logger=require(_0x6b57('0x6'))(_0x6b57('0x7'));var config=require(_0x6b57('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6b57('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4975bf,_0x53e89c,_0x3c765c){return new BPromise(function(_0xae0e7f,_0x4f333c){return client[_0x6b57('0xa')](_0x4975bf,_0x3c765c)['then'](function(_0x3f25af){logger['info'](_0x6b57('0xb'),_0x53e89c,_0x6b57('0xc'));logger[_0x6b57('0xd')](_0x6b57('0xe'),_0x53e89c,'request\x20sent',JSON[_0x6b57('0xf')](_0x3f25af));if(_0x3f25af['error']){if(_0x3f25af[_0x6b57('0x10')][_0x6b57('0x11')]===0x1f4){logger[_0x6b57('0x10')](_0x6b57('0xb'),_0x53e89c,_0x3f25af[_0x6b57('0x10')][_0x6b57('0x12')]);return _0x4f333c(_0x3f25af[_0x6b57('0x10')][_0x6b57('0x12')]);}logger[_0x6b57('0x10')](_0x6b57('0xb'),_0x53e89c,_0x3f25af['error']['message']);return _0xae0e7f(_0x3f25af['error']['message']);}else{logger['info'](_0x6b57('0xb'),_0x53e89c,_0x6b57('0xc'));_0xae0e7f(_0x3f25af[_0x6b57('0x13')]['message']);}})[_0x6b57('0x14')](function(_0x493555){logger['error']('UserFaxInteraction,\x20%s,\x20%s',_0x53e89c,_0x493555);_0x4f333c(_0x493555);});});} \ No newline at end of file +var _0x294e=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxInteraction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x422a71,_0x37d9bf){var _0x552a4e=function(_0x5a5c33){while(--_0x5a5c33){_0x422a71['push'](_0x422a71['shift']());}};_0x552a4e(++_0x37d9bf);}(_0x294e,0x1e5));var _0xe294=function(_0x15ea72,_0x49b8f3){_0x15ea72=_0x15ea72-0x0;var _0x2efd3e=_0x294e[_0x15ea72];return _0x2efd3e;};'use strict';var _=require(_0xe294('0x0'));var util=require(_0xe294('0x1'));var moment=require(_0xe294('0x2'));var BPromise=require(_0xe294('0x3'));var rs=require(_0xe294('0x4'));var fs=require('fs');var Redis=require(_0xe294('0x5'));var db=require(_0xe294('0x6'))['db'];var utils=require(_0xe294('0x7'));var logger=require('../../config/logger')(_0xe294('0x8'));var config=require(_0xe294('0x9'));var jayson=require(_0xe294('0xa'));var client=jayson[_0xe294('0xb')][_0xe294('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x446f51,_0x5c4854,_0x396e25){return new BPromise(function(_0x265313,_0x12958c){return client[_0xe294('0xd')](_0x446f51,_0x396e25)[_0xe294('0xe')](function(_0xd94730){logger[_0xe294('0xf')]('UserFaxInteraction,\x20%s,\x20%s',_0x5c4854,_0xe294('0x10'));logger[_0xe294('0x11')](_0xe294('0x12'),_0x5c4854,_0xe294('0x10'),JSON[_0xe294('0x13')](_0xd94730));if(_0xd94730[_0xe294('0x14')]){if(_0xd94730[_0xe294('0x14')][_0xe294('0x15')]===0x1f4){logger['error'](_0xe294('0x16'),_0x5c4854,_0xd94730[_0xe294('0x14')][_0xe294('0x17')]);return _0x12958c(_0xd94730[_0xe294('0x14')][_0xe294('0x17')]);}logger[_0xe294('0x14')](_0xe294('0x16'),_0x5c4854,_0xd94730[_0xe294('0x14')]['message']);return _0x265313(_0xd94730['error'][_0xe294('0x17')]);}else{logger['info']('UserFaxInteraction,\x20%s,\x20%s',_0x5c4854,'request\x20sent');_0x265313(_0xd94730[_0xe294('0x18')][_0xe294('0x17')]);}})[_0xe294('0x19')](function(_0x29f08a){logger[_0xe294('0x14')](_0xe294('0x16'),_0x5c4854,_0x29f08a);_0x12958c(_0x29f08a);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 9949f1a..79ed0dc 100644 --- a/server/api/UserFaxInteraction/index.js +++ b/server/api/UserFaxInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe366=['update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserFaxInteraction.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x179b74,_0x5dc97d){var _0x268f76=function(_0x19c8c2){while(--_0x19c8c2){_0x179b74['push'](_0x179b74['shift']());}};_0x268f76(++_0x5dc97d);}(_0xe366,0xdb));var _0x6e36=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xe366[_0x1e3c16];return _0x47a0c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6e36('0x0'));var timeout=require(_0x6e36('0x1'));var express=require(_0x6e36('0x2'));var router=express[_0x6e36('0x3')]();var auth=require(_0x6e36('0x4'));var interaction=require(_0x6e36('0x5'));var config=require(_0x6e36('0x6'));var controller=require(_0x6e36('0x7'));router[_0x6e36('0x8')]('/',auth[_0x6e36('0x9')](),controller['index']);router['get'](_0x6e36('0xa'),auth[_0x6e36('0x9')](),controller[_0x6e36('0xb')]);router[_0x6e36('0xc')]('/',auth['isAuthenticated'](),controller[_0x6e36('0xd')]);router[_0x6e36('0xe')](_0x6e36('0xa'),auth[_0x6e36('0x9')](),controller[_0x6e36('0xf')]);router['delete'](_0x6e36('0xa'),auth[_0x6e36('0x9')](),controller[_0x6e36('0x10')]);module[_0x6e36('0x11')]=router; \ No newline at end of file +var _0x3e8f=['../../components/interaction/service','./UserFaxInteraction.controller','get','isAuthenticated','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x28fe74,_0x455459){var _0xc09d36=function(_0x4a975a){while(--_0x4a975a){_0x28fe74['push'](_0x28fe74['shift']());}};_0xc09d36(++_0x455459);}(_0x3e8f,0x1a2));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf3e8('0x0'));var util=require(_0xf3e8('0x1'));var path=require(_0xf3e8('0x2'));var timeout=require(_0xf3e8('0x3'));var express=require(_0xf3e8('0x4'));var router=express[_0xf3e8('0x5')]();var auth=require(_0xf3e8('0x6'));var interaction=require(_0xf3e8('0x7'));var config=require('../../config/environment');var controller=require(_0xf3e8('0x8'));router[_0xf3e8('0x9')]('/',auth[_0xf3e8('0xa')](),controller['index']);router['get'](_0xf3e8('0xb'),auth[_0xf3e8('0xa')](),controller[_0xf3e8('0xc')]);router['post']('/',auth[_0xf3e8('0xa')](),controller['create']);router['put']('/:id',auth[_0xf3e8('0xa')](),controller[_0xf3e8('0xd')]);router[_0xf3e8('0xe')](_0xf3e8('0xb'),auth[_0xf3e8('0xa')](),controller[_0xf3e8('0xf')]);module[_0xf3e8('0x10')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index f1bafa6..4d68f80 100644 --- a/server/api/UserMailInteraction/UserMailInteraction.attributes.js +++ b/server/api/UserMailInteraction/UserMailInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x846d=['sequelize','exports','INTEGER'];(function(_0x4e129e,_0x32ba47){var _0xeb52f1=function(_0x37b7c2){while(--_0x37b7c2){_0x4e129e['push'](_0x4e129e['shift']());}};_0xeb52f1(++_0x32ba47);}(_0x846d,0x147));var _0xd846=function(_0x18fe54,_0xff789){_0x18fe54=_0x18fe54-0x0;var _0xccb1ee=_0x846d[_0x18fe54];return _0xccb1ee;};'use strict';var Sequelize=require(_0xd846('0x0'));module[_0xd846('0x1')]={'MailInteractionId':{'type':Sequelize[_0xd846('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0x0107=['exports','INTEGER','sequelize'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x0107,0x137));var _0x7010=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x0107[_0xd09668];return _0x68726;};'use strict';var Sequelize=require(_0x7010('0x0'));module[_0x7010('0x1')]={'MailInteractionId':{'type':Sequelize[_0x7010('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x7010('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index 709a1f6..3d3f322 100644 --- a/server/api/UserMailInteraction/UserMailInteraction.controller.js +++ b/server/api/UserMailInteraction/UserMailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb471=['map','options','count','includeAll','include','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','get','UserMailInteractions','UserProfileResource','destroy','error','stack','name','send','index','UserMailInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','sort','pick','filter','where','merge'];(function(_0x33ff1c,_0x3054ed){var _0x329f1=function(_0x24e302){while(--_0x24e302){_0x33ff1c['push'](_0x33ff1c['shift']());}};_0x329f1(++_0x3054ed);}(_0xb471,0x159));var _0x1b47=function(_0x41410c,_0x4ebc54){_0x41410c=_0x41410c-0x0;var _0x4982fb=_0xb471[_0x41410c];return _0x4982fb;};'use strict';var pdf=require(_0x1b47('0x0'));var emlformat=require(_0x1b47('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1b47('0x2'));var rp=require(_0x1b47('0x3'));var moment=require('moment');var BPromise=require(_0x1b47('0x4'));var Mustache=require(_0x1b47('0x5'));var util=require(_0x1b47('0x6'));var path=require(_0x1b47('0x7'));var sox=require(_0x1b47('0x8'));var csv=require(_0x1b47('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1b47('0xa'));var crypto=require(_0x1b47('0xb'));var jsforce=require(_0x1b47('0xc'));var deskjs=require(_0x1b47('0xd'));var toCsv=require(_0x1b47('0x9'));var querystring=require(_0x1b47('0xe'));var Papa=require(_0x1b47('0xf'));var Redis=require(_0x1b47('0x10'));var authService=require(_0x1b47('0x11'));var qs=require(_0x1b47('0x12'));var as=require(_0x1b47('0x13'));var hardwareService=require(_0x1b47('0x14'));var logger=require(_0x1b47('0x15'))('api');var utils=require(_0x1b47('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1b47('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3558a7,_0xb703a6){_0xb703a6=_0xb703a6||0xcc;return function(_0x59fe0a){if(_0x59fe0a){return _0x3558a7[_0x1b47('0x18')](_0xb703a6);}return _0x3558a7[_0x1b47('0x19')](_0xb703a6)[_0x1b47('0x1a')]();};}function respondWithResult(_0x5365b8,_0x4abef1){_0x4abef1=_0x4abef1||0xc8;return function(_0x3e1a83){if(_0x3e1a83){return _0x5365b8[_0x1b47('0x19')](_0x4abef1)[_0x1b47('0x1b')](_0x3e1a83);}};}function respondWithFilteredResult(_0x412c3c,_0x45c1f2){return function(_0x39bae5){if(_0x39bae5){var _0xdfac23=_0x39bae5['count'],_0x11d986=_0x45c1f2['offset'],_0x510fd0=_0x45c1f2[_0x1b47('0x1c')]+_0x45c1f2['limit'],_0x27f8ba;if(_0x510fd0>=_0xdfac23){_0x510fd0=_0xdfac23;_0x27f8ba=0xc8;}else{_0x27f8ba=0xce;}_0x412c3c['status'](_0x27f8ba);return _0x412c3c[_0x1b47('0x1d')](_0x1b47('0x1e'),_0x11d986+'-'+_0x510fd0+'/'+_0xdfac23)[_0x1b47('0x1b')](_0x39bae5);}return null;};}function patchUpdates(_0x26cfbe){return function(_0xb728b){try{jsonpatch[_0x1b47('0x1f')](_0xb728b,_0x26cfbe,!![]);}catch(_0x17acfb){return BPromise[_0x1b47('0x20')](_0x17acfb);}return _0xb728b[_0x1b47('0x21')]();};}function saveUpdates(_0x3d0caa,_0x158eb4){return function(_0x37b0c7){if(_0x37b0c7){return _0x37b0c7[_0x1b47('0x22')](_0x3d0caa)['then'](function(_0xdc2cd3){return _0xdc2cd3;});}return null;};}function removeEntity(_0x53d193,_0x31b001){return function(_0x223de6){if(_0x223de6){return _0x223de6['destroy']()[_0x1b47('0x23')](function(){var _0x17207e=_0x223de6[_0x1b47('0x24')]({'plain':!![]});var _0x372e6b=_0x1b47('0x25');return db[_0x1b47('0x26')][_0x1b47('0x27')]({'where':{'type':_0x372e6b,'resourceId':_0x17207e['id']}})[_0x1b47('0x23')](function(){return _0x223de6;});})[_0x1b47('0x23')](function(){_0x53d193[_0x1b47('0x19')](0xcc)[_0x1b47('0x1a')]();});}};}function handleEntityNotFound(_0x5be7de,_0x3a0f5d){return function(_0x1bf471){if(!_0x1bf471){_0x5be7de[_0x1b47('0x18')](0x194);}return _0x1bf471;};}function handleError(_0x2d6246,_0x3b89eb){_0x3b89eb=_0x3b89eb||0x1f4;return function(_0x4ebdc8){logger[_0x1b47('0x28')](_0x4ebdc8[_0x1b47('0x29')]);if(_0x4ebdc8[_0x1b47('0x2a')]){delete _0x4ebdc8[_0x1b47('0x2a')];}_0x2d6246[_0x1b47('0x19')](_0x3b89eb)[_0x1b47('0x2b')](_0x4ebdc8);};}exports[_0x1b47('0x2c')]=function(_0x26814b,_0x1fbbaf){var _0x4afe3b={},_0x5dbbca={},_0x25cc4f={'count':0x0,'rows':[]};var _0x27db6c=_['map'](db[_0x1b47('0x2d')][_0x1b47('0x2e')],function(_0x4587aa){return{'name':_0x4587aa[_0x1b47('0x2f')],'type':_0x4587aa[_0x1b47('0x30')][_0x1b47('0x31')]};});_0x5dbbca[_0x1b47('0x32')]=_['map'](_0x27db6c,_0x1b47('0x2a'));_0x5dbbca[_0x1b47('0x33')]=_[_0x1b47('0x34')](_0x26814b['query']);_0x5dbbca[_0x1b47('0x35')]=_['intersection'](_0x5dbbca[_0x1b47('0x32')],_0x5dbbca['query']);_0x4afe3b['attributes']=_[_0x1b47('0x36')](_0x5dbbca['model'],qs[_0x1b47('0x37')](_0x26814b['query']['fields']));_0x4afe3b[_0x1b47('0x38')]=_0x4afe3b[_0x1b47('0x38')][_0x1b47('0x39')]?_0x4afe3b[_0x1b47('0x38')]:_0x5dbbca['model'];if(!_0x26814b[_0x1b47('0x33')]['hasOwnProperty'](_0x1b47('0x3a'))){_0x4afe3b['limit']=qs[_0x1b47('0x3b')](_0x26814b[_0x1b47('0x33')]['limit']);_0x4afe3b[_0x1b47('0x1c')]=qs[_0x1b47('0x1c')](_0x26814b[_0x1b47('0x33')][_0x1b47('0x1c')]);}_0x4afe3b['order']=qs['sort'](_0x26814b[_0x1b47('0x33')][_0x1b47('0x3c')]);_0x4afe3b['where']=qs[_0x1b47('0x35')](_[_0x1b47('0x3d')](_0x26814b[_0x1b47('0x33')],_0x5dbbca[_0x1b47('0x35')]),_0x27db6c);if(_0x26814b[_0x1b47('0x33')][_0x1b47('0x3e')]){_0x4afe3b[_0x1b47('0x3f')]=_[_0x1b47('0x40')](_0x4afe3b[_0x1b47('0x3f')],{'$or':_[_0x1b47('0x41')](_0x27db6c,function(_0x2f5b85){if(_0x2f5b85[_0x1b47('0x30')]!=='VIRTUAL'){var _0x19f69e={};_0x19f69e[_0x2f5b85[_0x1b47('0x2a')]]={'$like':'%'+_0x26814b['query'][_0x1b47('0x3e')]+'%'};return _0x19f69e;}})});}_0x4afe3b=_[_0x1b47('0x40')]({},_0x4afe3b,_0x26814b[_0x1b47('0x42')]);var _0x31c51a={'where':_0x4afe3b[_0x1b47('0x3f')]};return db[_0x1b47('0x2d')][_0x1b47('0x43')](_0x31c51a)[_0x1b47('0x23')](function(_0x3e692a){_0x25cc4f[_0x1b47('0x43')]=_0x3e692a;if(_0x26814b[_0x1b47('0x33')][_0x1b47('0x44')]){_0x4afe3b[_0x1b47('0x45')]=[{'all':!![]}];}return db['UserMailInteraction']['findAll'](_0x4afe3b);})[_0x1b47('0x23')](function(_0x391089){_0x25cc4f[_0x1b47('0x46')]=_0x391089;return _0x25cc4f;})['then'](respondWithFilteredResult(_0x1fbbaf,_0x4afe3b))[_0x1b47('0x47')](handleError(_0x1fbbaf,null));};exports[_0x1b47('0x48')]=function(_0x910afd,_0x447097){var _0x52d76a={'raw':!![],'where':{'id':_0x910afd['params']['id']}},_0xbf37b6={};_0xbf37b6['model']=_[_0x1b47('0x34')](db[_0x1b47('0x2d')]['rawAttributes']);_0xbf37b6[_0x1b47('0x33')]=_['keys'](_0x910afd[_0x1b47('0x33')]);_0xbf37b6['filters']=_[_0x1b47('0x36')](_0xbf37b6[_0x1b47('0x32')],_0xbf37b6['query']);_0x52d76a[_0x1b47('0x38')]=_[_0x1b47('0x36')](_0xbf37b6[_0x1b47('0x32')],qs[_0x1b47('0x37')](_0x910afd[_0x1b47('0x33')]['fields']));_0x52d76a['attributes']=_0x52d76a[_0x1b47('0x38')]['length']?_0x52d76a[_0x1b47('0x38')]:_0xbf37b6['model'];if(_0x910afd[_0x1b47('0x33')][_0x1b47('0x44')]){_0x52d76a[_0x1b47('0x45')]=[{'all':!![]}];}_0x52d76a=_[_0x1b47('0x40')]({},_0x52d76a,_0x910afd[_0x1b47('0x42')]);return db[_0x1b47('0x2d')][_0x1b47('0x49')](_0x52d76a)['then'](handleEntityNotFound(_0x447097,null))[_0x1b47('0x23')](respondWithResult(_0x447097,null))[_0x1b47('0x47')](handleError(_0x447097,null));};exports[_0x1b47('0x4a')]=function(_0x2d11b3,_0x337214){return db[_0x1b47('0x2d')]['create'](_0x2d11b3['body'],{})['then'](function(_0x24737a){var _0x49b918=_0x2d11b3[_0x1b47('0x4b')]['get']({'plain':!![]});if(!_0x49b918)throw new Error(_0x1b47('0x4c'));if(_0x49b918[_0x1b47('0x4d')]===_0x1b47('0x4b')){var _0x19701e=_0x24737a[_0x1b47('0x24')]({'plain':!![]});var _0x4da6ab=_0x1b47('0x25');return db[_0x1b47('0x4e')][_0x1b47('0x49')]({'where':{'name':_0x4da6ab,'userProfileId':_0x49b918[_0x1b47('0x4f')]},'raw':!![]})[_0x1b47('0x23')](function(_0x508afe){if(_0x508afe&&_0x508afe['autoAssociation']===0x0){return db[_0x1b47('0x26')][_0x1b47('0x4a')]({'name':_0x19701e[_0x1b47('0x2a')],'resourceId':_0x19701e['id'],'type':_0x508afe[_0x1b47('0x2a')],'sectionId':_0x508afe['id']},{})[_0x1b47('0x23')](function(){return _0x24737a;});}else{return _0x24737a;}})[_0x1b47('0x47')](function(_0x1144a3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1144a3);throw _0x1144a3;});}return _0x24737a;})[_0x1b47('0x23')](respondWithResult(_0x337214,0xc9))[_0x1b47('0x47')](handleError(_0x337214,null));};exports[_0x1b47('0x22')]=function(_0x41bb51,_0xa75eda){if(_0x41bb51[_0x1b47('0x50')]['id']){delete _0x41bb51[_0x1b47('0x50')]['id'];}return db['UserMailInteraction'][_0x1b47('0x49')]({'where':{'id':_0x41bb51[_0x1b47('0x51')]['id']}})['then'](handleEntityNotFound(_0xa75eda,null))[_0x1b47('0x23')](saveUpdates(_0x41bb51[_0x1b47('0x50')],null))[_0x1b47('0x23')](respondWithResult(_0xa75eda,null))[_0x1b47('0x47')](handleError(_0xa75eda,null));};exports[_0x1b47('0x27')]=function(_0x597e1e,_0xce41d5){return db[_0x1b47('0x2d')]['find']({'where':{'id':_0x597e1e[_0x1b47('0x51')]['id']}})[_0x1b47('0x23')](handleEntityNotFound(_0xce41d5,null))['then'](removeEntity(_0xce41d5,null))[_0x1b47('0x47')](handleError(_0xce41d5,null));}; \ No newline at end of file +var _0x29f5=['Content-Range','apply','reject','then','destroy','get','error','stack','send','index','UserMailInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserMailInteractions','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x279988,_0x3449ef){var _0xd82b05=function(_0x51df2f){while(--_0x51df2f){_0x279988['push'](_0x279988['shift']());}};_0xd82b05(++_0x3449ef);}(_0x29f5,0xe2));var _0x529f=function(_0x2322b1,_0x18f0dc){_0x2322b1=_0x2322b1-0x0;var _0x57dd72=_0x29f5[_0x2322b1];return _0x57dd72;};'use strict';var pdf=require(_0x529f('0x0'));var emlformat=require(_0x529f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x529f('0x2'));var jsonpatch=require(_0x529f('0x3'));var rp=require(_0x529f('0x4'));var moment=require(_0x529f('0x5'));var BPromise=require(_0x529f('0x6'));var Mustache=require('mustache');var util=require(_0x529f('0x7'));var path=require(_0x529f('0x8'));var sox=require(_0x529f('0x9'));var csv=require(_0x529f('0xa'));var ejs=require(_0x529f('0xb'));var fs=require('fs');var _=require(_0x529f('0xc'));var squel=require(_0x529f('0xd'));var crypto=require(_0x529f('0xe'));var jsforce=require(_0x529f('0xf'));var deskjs=require(_0x529f('0x10'));var toCsv=require(_0x529f('0xa'));var querystring=require(_0x529f('0x11'));var Papa=require(_0x529f('0x12'));var Redis=require(_0x529f('0x13'));var authService=require(_0x529f('0x14'));var qs=require(_0x529f('0x15'));var as=require(_0x529f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x529f('0x17'))('api');var utils=require(_0x529f('0x18'));var config=require(_0x529f('0x19'));var licenseUtil=require(_0x529f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20f499,_0x188721){_0x188721=_0x188721||0xcc;return function(_0x39cf21){if(_0x39cf21){return _0x20f499[_0x529f('0x1b')](_0x188721);}return _0x20f499['status'](_0x188721)[_0x529f('0x1c')]();};}function respondWithResult(_0x29dae5,_0x43a837){_0x43a837=_0x43a837||0xc8;return function(_0x8bfbe1){if(_0x8bfbe1){return _0x29dae5[_0x529f('0x1d')](_0x43a837)[_0x529f('0x1e')](_0x8bfbe1);}};}function respondWithFilteredResult(_0x59cacd,_0x2432de){return function(_0x2b2222){if(_0x2b2222){var _0x16a0e8=_0x2b2222[_0x529f('0x1f')],_0x1687bc=_0x2432de[_0x529f('0x20')],_0x14d3be=_0x2432de['offset']+_0x2432de[_0x529f('0x21')],_0x1ea02d;if(_0x14d3be>=_0x16a0e8){_0x14d3be=_0x16a0e8;_0x1ea02d=0xc8;}else{_0x1ea02d=0xce;}_0x59cacd[_0x529f('0x1d')](_0x1ea02d);return _0x59cacd[_0x529f('0x22')](_0x529f('0x23'),_0x1687bc+'-'+_0x14d3be+'/'+_0x16a0e8)[_0x529f('0x1e')](_0x2b2222);}return null;};}function patchUpdates(_0x24dc80){return function(_0x578cae){try{jsonpatch[_0x529f('0x24')](_0x578cae,_0x24dc80,!![]);}catch(_0x2cc303){return BPromise[_0x529f('0x25')](_0x2cc303);}return _0x578cae['save']();};}function saveUpdates(_0x4bb7f0,_0xc83cbc){return function(_0x22da7f){if(_0x22da7f){return _0x22da7f['update'](_0x4bb7f0)[_0x529f('0x26')](function(_0x84dbf8){return _0x84dbf8;});}return null;};}function removeEntity(_0x721cc7,_0x40e8f0){return function(_0x14f725){if(_0x14f725){return _0x14f725[_0x529f('0x27')]()[_0x529f('0x26')](function(){var _0x4071b6=_0x14f725[_0x529f('0x28')]({'plain':!![]});var _0x5e1d7f='UserMailInteractions';return db['UserProfileResource'][_0x529f('0x27')]({'where':{'type':_0x5e1d7f,'resourceId':_0x4071b6['id']}})[_0x529f('0x26')](function(){return _0x14f725;});})[_0x529f('0x26')](function(){_0x721cc7[_0x529f('0x1d')](0xcc)[_0x529f('0x1c')]();});}};}function handleEntityNotFound(_0x4d26bb,_0x5ccfa7){return function(_0x467382){if(!_0x467382){_0x4d26bb[_0x529f('0x1b')](0x194);}return _0x467382;};}function handleError(_0x52f0cb,_0x12ad2c){_0x12ad2c=_0x12ad2c||0x1f4;return function(_0x393a19){logger[_0x529f('0x29')](_0x393a19[_0x529f('0x2a')]);if(_0x393a19['name']){delete _0x393a19['name'];}_0x52f0cb[_0x529f('0x1d')](_0x12ad2c)[_0x529f('0x2b')](_0x393a19);};}exports[_0x529f('0x2c')]=function(_0x52c2cb,_0x27f3fe){var _0x5489ab={},_0x59a8fc={},_0x320dd3={'count':0x0,'rows':[]};var _0x438102=_['map'](db[_0x529f('0x2d')][_0x529f('0x2e')],function(_0x1e004f){return{'name':_0x1e004f[_0x529f('0x2f')],'type':_0x1e004f[_0x529f('0x30')][_0x529f('0x31')]};});_0x59a8fc[_0x529f('0x32')]=_[_0x529f('0x33')](_0x438102,'name');_0x59a8fc[_0x529f('0x34')]=_[_0x529f('0x35')](_0x52c2cb['query']);_0x59a8fc[_0x529f('0x36')]=_[_0x529f('0x37')](_0x59a8fc[_0x529f('0x32')],_0x59a8fc[_0x529f('0x34')]);_0x5489ab[_0x529f('0x38')]=_[_0x529f('0x37')](_0x59a8fc[_0x529f('0x32')],qs['fields'](_0x52c2cb[_0x529f('0x34')][_0x529f('0x39')]));_0x5489ab['attributes']=_0x5489ab[_0x529f('0x38')][_0x529f('0x3a')]?_0x5489ab['attributes']:_0x59a8fc[_0x529f('0x32')];if(!_0x52c2cb[_0x529f('0x34')][_0x529f('0x3b')](_0x529f('0x3c'))){_0x5489ab[_0x529f('0x21')]=qs[_0x529f('0x21')](_0x52c2cb[_0x529f('0x34')][_0x529f('0x21')]);_0x5489ab[_0x529f('0x20')]=qs[_0x529f('0x20')](_0x52c2cb[_0x529f('0x34')][_0x529f('0x20')]);}_0x5489ab[_0x529f('0x3d')]=qs[_0x529f('0x3e')](_0x52c2cb[_0x529f('0x34')][_0x529f('0x3e')]);_0x5489ab[_0x529f('0x3f')]=qs[_0x529f('0x36')](_[_0x529f('0x40')](_0x52c2cb[_0x529f('0x34')],_0x59a8fc[_0x529f('0x36')]),_0x438102);if(_0x52c2cb[_0x529f('0x34')][_0x529f('0x41')]){_0x5489ab[_0x529f('0x3f')]=_['merge'](_0x5489ab[_0x529f('0x3f')],{'$or':_[_0x529f('0x33')](_0x438102,function(_0x30c8cc){if(_0x30c8cc[_0x529f('0x30')]!==_0x529f('0x42')){var _0x352ed1={};_0x352ed1[_0x30c8cc[_0x529f('0x43')]]={'$like':'%'+_0x52c2cb[_0x529f('0x34')][_0x529f('0x41')]+'%'};return _0x352ed1;}})});}_0x5489ab=_['merge']({},_0x5489ab,_0x52c2cb['options']);var _0x29920c={'where':_0x5489ab[_0x529f('0x3f')]};return db[_0x529f('0x2d')]['count'](_0x29920c)[_0x529f('0x26')](function(_0x5a7abc){_0x320dd3[_0x529f('0x1f')]=_0x5a7abc;if(_0x52c2cb[_0x529f('0x34')][_0x529f('0x44')]){_0x5489ab[_0x529f('0x45')]=[{'all':!![]}];}return db[_0x529f('0x2d')][_0x529f('0x46')](_0x5489ab);})[_0x529f('0x26')](function(_0x6f23d4){_0x320dd3[_0x529f('0x47')]=_0x6f23d4;return _0x320dd3;})[_0x529f('0x26')](respondWithFilteredResult(_0x27f3fe,_0x5489ab))[_0x529f('0x48')](handleError(_0x27f3fe,null));};exports[_0x529f('0x49')]=function(_0x2e6928,_0x7515f4){var _0x35a242={'raw':!![],'where':{'id':_0x2e6928[_0x529f('0x4a')]['id']}},_0x1310ec={};_0x1310ec[_0x529f('0x32')]=_[_0x529f('0x35')](db['UserMailInteraction'][_0x529f('0x2e')]);_0x1310ec['query']=_[_0x529f('0x35')](_0x2e6928[_0x529f('0x34')]);_0x1310ec[_0x529f('0x36')]=_[_0x529f('0x37')](_0x1310ec['model'],_0x1310ec[_0x529f('0x34')]);_0x35a242[_0x529f('0x38')]=_['intersection'](_0x1310ec[_0x529f('0x32')],qs['fields'](_0x2e6928[_0x529f('0x34')]['fields']));_0x35a242[_0x529f('0x38')]=_0x35a242[_0x529f('0x38')][_0x529f('0x3a')]?_0x35a242['attributes']:_0x1310ec[_0x529f('0x32')];if(_0x2e6928[_0x529f('0x34')][_0x529f('0x44')]){_0x35a242[_0x529f('0x45')]=[{'all':!![]}];}_0x35a242=_['merge']({},_0x35a242,_0x2e6928[_0x529f('0x4b')]);return db['UserMailInteraction']['find'](_0x35a242)[_0x529f('0x26')](handleEntityNotFound(_0x7515f4,null))[_0x529f('0x26')](respondWithResult(_0x7515f4,null))[_0x529f('0x48')](handleError(_0x7515f4,null));};exports['create']=function(_0x18ad4f,_0x4fe681){return db['UserMailInteraction'][_0x529f('0x4c')](_0x18ad4f[_0x529f('0x4d')],{})[_0x529f('0x26')](function(_0x55221f){var _0x67eb7f=_0x18ad4f['user']['get']({'plain':!![]});if(!_0x67eb7f)throw new Error(_0x529f('0x4e'));if(_0x67eb7f['role']===_0x529f('0x4f')){var _0x15b43a=_0x55221f['get']({'plain':!![]});var _0x33efc5=_0x529f('0x50');return db[_0x529f('0x51')]['find']({'where':{'name':_0x33efc5,'userProfileId':_0x67eb7f[_0x529f('0x52')]},'raw':!![]})[_0x529f('0x26')](function(_0x20d0d9){if(_0x20d0d9&&_0x20d0d9['autoAssociation']===0x0){return db[_0x529f('0x53')][_0x529f('0x4c')]({'name':_0x15b43a[_0x529f('0x43')],'resourceId':_0x15b43a['id'],'type':_0x20d0d9[_0x529f('0x43')],'sectionId':_0x20d0d9['id']},{})[_0x529f('0x26')](function(){return _0x55221f;});}else{return _0x55221f;}})['catch'](function(_0xb0e96d){logger[_0x529f('0x29')](_0x529f('0x54'),_0xb0e96d);throw _0xb0e96d;});}return _0x55221f;})['then'](respondWithResult(_0x4fe681,0xc9))['catch'](handleError(_0x4fe681,null));};exports[_0x529f('0x55')]=function(_0x567a3,_0x405213){if(_0x567a3[_0x529f('0x4d')]['id']){delete _0x567a3[_0x529f('0x4d')]['id'];}return db[_0x529f('0x2d')][_0x529f('0x56')]({'where':{'id':_0x567a3[_0x529f('0x4a')]['id']}})[_0x529f('0x26')](handleEntityNotFound(_0x405213,null))['then'](saveUpdates(_0x567a3[_0x529f('0x4d')],null))[_0x529f('0x26')](respondWithResult(_0x405213,null))[_0x529f('0x48')](handleError(_0x405213,null));};exports[_0x529f('0x27')]=function(_0x401161,_0x50382e){return db[_0x529f('0x2d')]['find']({'where':{'id':_0x401161['params']['id']}})[_0x529f('0x26')](handleEntityNotFound(_0x50382e,null))[_0x529f('0x26')](removeEntity(_0x50382e,null))['catch'](handleError(_0x50382e,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index efc5a3e..73b31ba 100644 --- a/server/api/UserMailInteraction/UserMailInteraction.model.js +++ b/server/api/UserMailInteraction/UserMailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81fa=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./UserMailInteraction.attributes','exports','define','UserMailInteraction','user_has_mail_interactions'];(function(_0x47321e,_0x4b140e){var _0x4d2626=function(_0x1c8053){while(--_0x1c8053){_0x47321e['push'](_0x47321e['shift']());}};_0x4d2626(++_0x4b140e);}(_0x81fa,0xdd));var _0xa81f=function(_0x519b55,_0x1597a7){_0x519b55=_0x519b55-0x0;var _0x5baf3d=_0x81fa[_0x519b55];return _0x5baf3d;};'use strict';var _=require(_0xa81f('0x0'));var util=require(_0xa81f('0x1'));var logger=require('../../config/logger')(_0xa81f('0x2'));var moment=require(_0xa81f('0x3'));var BPromise=require(_0xa81f('0x4'));var rp=require(_0xa81f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa81f('0x6'));var config=require(_0xa81f('0x7'));var attributes=require(_0xa81f('0x8'));module[_0xa81f('0x9')]=function(_0x1dc233,_0x158719){return _0x1dc233[_0xa81f('0xa')](_0xa81f('0xb'),attributes,{'tableName':_0xa81f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7184=['../../config/environment','exports','UserMailInteraction','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x482020,_0x1ad206){var _0x337dc1=function(_0xe23d3){while(--_0xe23d3){_0x482020['push'](_0x482020['shift']());}};_0x337dc1(++_0x1ad206);}(_0x7184,0xd5));var _0x4718=function(_0x130b30,_0x3d45b6){_0x130b30=_0x130b30-0x0;var _0x1b9f34=_0x7184[_0x130b30];return _0x1b9f34;};'use strict';var _=require(_0x4718('0x0'));var util=require(_0x4718('0x1'));var logger=require('../../config/logger')(_0x4718('0x2'));var moment=require('moment');var BPromise=require(_0x4718('0x3'));var rp=require(_0x4718('0x4'));var fs=require('fs');var path=require(_0x4718('0x5'));var rimraf=require(_0x4718('0x6'));var config=require(_0x4718('0x7'));var attributes=require('./UserMailInteraction.attributes');module[_0x4718('0x8')]=function(_0x3a47db,_0x41db3d){return _0x3a47db['define'](_0x4718('0x9'),attributes,{'tableName':'user_has_mail_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.rpc.js b/server/api/UserMailInteraction/UserMailInteraction.rpc.js index 2d35bf1..f38b682 100644 --- a/server/api/UserMailInteraction/UserMailInteraction.rpc.js +++ b/server/api/UserMailInteraction/UserMailInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b93=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','error','UserMailInteraction,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x8b93,0xaa));var _0x38b9=function(_0x4be419,_0x158156){_0x4be419=_0x4be419-0x0;var _0x36d0f8=_0x8b93[_0x4be419];return _0x36d0f8;};'use strict';var _=require(_0x38b9('0x0'));var util=require(_0x38b9('0x1'));var moment=require('moment');var BPromise=require(_0x38b9('0x2'));var rs=require(_0x38b9('0x3'));var fs=require('fs');var Redis=require(_0x38b9('0x4'));var db=require(_0x38b9('0x5'))['db'];var utils=require(_0x38b9('0x6'));var logger=require(_0x38b9('0x7'))(_0x38b9('0x8'));var config=require(_0x38b9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38b9('0xa')][_0x38b9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x102ceb,_0x43af3c,_0x2e59b9){return new BPromise(function(_0x368a2c,_0x59d61e){return client[_0x38b9('0xc')](_0x102ceb,_0x2e59b9)[_0x38b9('0xd')](function(_0x9b5244){logger[_0x38b9('0xe')]('UserMailInteraction,\x20%s,\x20%s',_0x43af3c,_0x38b9('0xf'));logger[_0x38b9('0x10')](_0x38b9('0x11'),_0x43af3c,_0x38b9('0xf'),JSON['stringify'](_0x9b5244));if(_0x9b5244[_0x38b9('0x12')]){if(_0x9b5244['error']['code']===0x1f4){logger[_0x38b9('0x12')](_0x38b9('0x13'),_0x43af3c,_0x9b5244[_0x38b9('0x12')]['message']);return _0x59d61e(_0x9b5244[_0x38b9('0x12')][_0x38b9('0x14')]);}logger['error'](_0x38b9('0x13'),_0x43af3c,_0x9b5244[_0x38b9('0x12')][_0x38b9('0x14')]);return _0x368a2c(_0x9b5244[_0x38b9('0x12')]['message']);}else{logger['info'](_0x38b9('0x13'),_0x43af3c,_0x38b9('0xf'));_0x368a2c(_0x9b5244[_0x38b9('0x15')][_0x38b9('0x14')]);}})['catch'](function(_0x3152a5){logger[_0x38b9('0x12')](_0x38b9('0x13'),_0x43af3c,_0x3152a5);_0x59d61e(_0x3152a5);});});} \ No newline at end of file +var _0xfab0=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash'];(function(_0x1d4c5f,_0x51d3d6){var _0x505a59=function(_0x5eea33){while(--_0x5eea33){_0x1d4c5f['push'](_0x1d4c5f['shift']());}};_0x505a59(++_0x51d3d6);}(_0xfab0,0x1df));var _0x0fab=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0xfab0[_0x15fc7a];return _0x3aa9f4;};'use strict';var _=require(_0x0fab('0x0'));var util=require(_0x0fab('0x1'));var moment=require(_0x0fab('0x2'));var BPromise=require(_0x0fab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fab('0x4'));var db=require(_0x0fab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fab('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0fab('0x7')][_0x0fab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5819af,_0x1c133c,_0x4bb6c5){return new BPromise(function(_0x56da66,_0x22aef6){return client[_0x0fab('0x9')](_0x5819af,_0x4bb6c5)[_0x0fab('0xa')](function(_0x1e1f18){logger[_0x0fab('0xb')](_0x0fab('0xc'),_0x1c133c,_0x0fab('0xd'));logger[_0x0fab('0xe')]('UserMailInteraction,\x20%s,\x20%s,\x20%s',_0x1c133c,'request\x20sent',JSON['stringify'](_0x1e1f18));if(_0x1e1f18['error']){if(_0x1e1f18['error'][_0x0fab('0xf')]===0x1f4){logger[_0x0fab('0x10')](_0x0fab('0xc'),_0x1c133c,_0x1e1f18['error'][_0x0fab('0x11')]);return _0x22aef6(_0x1e1f18[_0x0fab('0x10')]['message']);}logger['error']('UserMailInteraction,\x20%s,\x20%s',_0x1c133c,_0x1e1f18[_0x0fab('0x10')][_0x0fab('0x11')]);return _0x56da66(_0x1e1f18[_0x0fab('0x10')]['message']);}else{logger[_0x0fab('0xb')](_0x0fab('0xc'),_0x1c133c,_0x0fab('0xd'));_0x56da66(_0x1e1f18[_0x0fab('0x12')][_0x0fab('0x11')]);}})[_0x0fab('0x13')](function(_0x32096f){logger[_0x0fab('0x10')](_0x0fab('0xc'),_0x1c133c,_0x32096f);_0x22aef6(_0x32096f);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index e092454..804e099 100644 --- a/server/api/UserMailInteraction/index.js +++ b/server/api/UserMailInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['isAuthenticated','get','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./UserMailInteraction.controller'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x10b1bf,_0x1924b3){_0x10b1bf=_0x10b1bf-0x0;var _0x2c6dc2=_0x9c5a[_0x10b1bf];return _0x2c6dc2;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var auth=require(_0xa9c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9c5('0x6'));var controller=require(_0xa9c5('0x7'));router['get']('/',auth[_0xa9c5('0x8')](),controller['index']);router[_0xa9c5('0x9')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa9c5('0xb')]('/',auth[_0xa9c5('0x8')](),controller['create']);router[_0xa9c5('0xc')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller[_0xa9c5('0xd')]);router[_0xa9c5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa9c5('0xf')]);module[_0xa9c5('0x10')]=router; \ No newline at end of file +var _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0xa79875,_0x7fed99){var _0x5ef5a1=function(_0x5f311a){while(--_0x5f311a){_0xa79875['push'](_0xa79875['shift']());}};_0x5ef5a1(++_0x7fed99);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x749e18,_0x5a2155){_0x749e18=_0x749e18-0x0;var _0x561ddb=_0xbd51[_0x749e18];return _0x561ddb;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./UserMailInteraction.controller');router[_0x1bd5('0x5')]('/',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x7')]);router['get'](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0xa')]('/',auth[_0x1bd5('0x6')](),controller['create']);router[_0x1bd5('0xb')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index f7f5dcb..08c6dde 100644 --- a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js +++ b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x413a=['sequelize','INTEGER'];(function(_0x5da046,_0x5260ad){var _0x53773d=function(_0x2490f1){while(--_0x2490f1){_0x5da046['push'](_0x5da046['shift']());}};_0x53773d(++_0x5260ad);}(_0x413a,0x1ba));var _0xa413=function(_0x3719b9,_0x1321fb){_0x3719b9=_0x3719b9-0x0;var _0x4c5bcb=_0x413a[_0x3719b9];return _0x4c5bcb;};'use strict';var Sequelize=require(_0xa413('0x0'));module['exports']={'OpenchannelInteractionId':{'type':Sequelize[_0xa413('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xa413('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x7898=['sequelize','INTEGER'];(function(_0x183873,_0x4a3e41){var _0x310f03=function(_0x2aad40){while(--_0x2aad40){_0x183873['push'](_0x183873['shift']());}};_0x310f03(++_0x4a3e41);}(_0x7898,0x160));var _0x8789=function(_0x2f9849,_0x209c0e){_0x2f9849=_0x2f9849-0x0;var _0x1aefac=_0x7898[_0x2f9849];return _0x1aefac;};'use strict';var Sequelize=require(_0x8789('0x0'));module['exports']={'OpenchannelInteractionId':{'type':Sequelize[_0x8789('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x8789('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js index 943e12f..3a20e69 100644 --- a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js +++ b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4c4=['rows','catch','show','params','length','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','get','UserOpenchannelInteraction','error','stack','name','send','rawAttributes','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filters','merge','where','type','VIRTUAL','options','includeAll','include'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc4c4,0xec));var _0x4c4c=function(_0x4af8cf,_0x51a87c){_0x4af8cf=_0x4af8cf-0x0;var _0x1cb78d=_0xc4c4[_0x4af8cf];return _0x1cb78d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4c4c('0x0'));var rimraf=require(_0x4c4c('0x1'));var zipdir=require(_0x4c4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4c4c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4c4c('0x4'));var util=require('util');var path=require(_0x4c4c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4c4c('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4c4c('0x7'));var crypto=require(_0x4c4c('0x8'));var jsforce=require(_0x4c4c('0x9'));var deskjs=require(_0x4c4c('0xa'));var toCsv=require(_0x4c4c('0xb'));var querystring=require(_0x4c4c('0xc'));var Papa=require('papaparse');var Redis=require(_0x4c4c('0xd'));var authService=require(_0x4c4c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4c4c('0xf'));var hardwareService=require(_0x4c4c('0x10'));var logger=require(_0x4c4c('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4c4c('0x12'))['db'];function respondWithStatusCode(_0x11ecbb,_0x432853){_0x432853=_0x432853||0xcc;return function(_0x10911a){if(_0x10911a){return _0x11ecbb[_0x4c4c('0x13')](_0x432853);}return _0x11ecbb[_0x4c4c('0x14')](_0x432853)[_0x4c4c('0x15')]();};}function respondWithResult(_0x26c91b,_0x3fe687){_0x3fe687=_0x3fe687||0xc8;return function(_0x3e45cd){if(_0x3e45cd){return _0x26c91b['status'](_0x3fe687)['json'](_0x3e45cd);}};}function respondWithFilteredResult(_0x375322,_0x55395e){return function(_0x3968a4){if(_0x3968a4){var _0x5661c7=_0x3968a4[_0x4c4c('0x16')],_0x597fb4=_0x55395e[_0x4c4c('0x17')],_0x122bd5=_0x55395e[_0x4c4c('0x17')]+_0x55395e['limit'],_0x39f121;if(_0x122bd5>=_0x5661c7){_0x122bd5=_0x5661c7;_0x39f121=0xc8;}else{_0x39f121=0xce;}_0x375322[_0x4c4c('0x14')](_0x39f121);return _0x375322[_0x4c4c('0x18')]('Content-Range',_0x597fb4+'-'+_0x122bd5+'/'+_0x5661c7)[_0x4c4c('0x19')](_0x3968a4);}return null;};}function patchUpdates(_0x5ee2d9){return function(_0x14e8ec){try{jsonpatch[_0x4c4c('0x1a')](_0x14e8ec,_0x5ee2d9,!![]);}catch(_0x53ccfe){return BPromise[_0x4c4c('0x1b')](_0x53ccfe);}return _0x14e8ec[_0x4c4c('0x1c')]();};}function saveUpdates(_0x3ec61c,_0x4289dd){return function(_0x4e4b00){if(_0x4e4b00){return _0x4e4b00[_0x4c4c('0x1d')](_0x3ec61c)[_0x4c4c('0x1e')](function(_0x30e877){return _0x30e877;});}return null;};}function removeEntity(_0x45ac87,_0x186e2f){return function(_0x145ed4){if(_0x145ed4){return _0x145ed4[_0x4c4c('0x1f')]()[_0x4c4c('0x1e')](function(){var _0x54f6b9=_0x145ed4[_0x4c4c('0x20')]({'plain':!![]});var _0x57bfbc=_0x4c4c('0x21');return db['UserProfileResource'][_0x4c4c('0x1f')]({'where':{'type':_0x57bfbc,'resourceId':_0x54f6b9['id']}})[_0x4c4c('0x1e')](function(){return _0x145ed4;});})[_0x4c4c('0x1e')](function(){_0x45ac87['status'](0xcc)[_0x4c4c('0x15')]();});}};}function handleEntityNotFound(_0x3c2539,_0x131086){return function(_0x580933){if(!_0x580933){_0x3c2539[_0x4c4c('0x13')](0x194);}return _0x580933;};}function handleError(_0x1b2468,_0x4b41e3){_0x4b41e3=_0x4b41e3||0x1f4;return function(_0x828044){logger[_0x4c4c('0x22')](_0x828044[_0x4c4c('0x23')]);if(_0x828044['name']){delete _0x828044[_0x4c4c('0x24')];}_0x1b2468[_0x4c4c('0x14')](_0x4b41e3)[_0x4c4c('0x25')](_0x828044);};}exports['index']=function(_0x3b9a61,_0x333af5){var _0x579fec={},_0x1040e7={},_0x480151={'count':0x0,'rows':[]};var _0x3f6811=_['map'](db[_0x4c4c('0x21')][_0x4c4c('0x26')],function(_0x57ded0){return{'name':_0x57ded0['fieldName'],'type':_0x57ded0['type'][_0x4c4c('0x27')]};});_0x1040e7['model']=_[_0x4c4c('0x28')](_0x3f6811,_0x4c4c('0x24'));_0x1040e7[_0x4c4c('0x29')]=_[_0x4c4c('0x2a')](_0x3b9a61[_0x4c4c('0x29')]);_0x1040e7['filters']=_[_0x4c4c('0x2b')](_0x1040e7[_0x4c4c('0x2c')],_0x1040e7['query']);_0x579fec['attributes']=_[_0x4c4c('0x2b')](_0x1040e7[_0x4c4c('0x2c')],qs[_0x4c4c('0x2d')](_0x3b9a61[_0x4c4c('0x29')][_0x4c4c('0x2d')]));_0x579fec[_0x4c4c('0x2e')]=_0x579fec['attributes']['length']?_0x579fec[_0x4c4c('0x2e')]:_0x1040e7[_0x4c4c('0x2c')];if(!_0x3b9a61[_0x4c4c('0x29')][_0x4c4c('0x2f')](_0x4c4c('0x30'))){_0x579fec[_0x4c4c('0x31')]=qs[_0x4c4c('0x31')](_0x3b9a61[_0x4c4c('0x29')]['limit']);_0x579fec[_0x4c4c('0x17')]=qs[_0x4c4c('0x17')](_0x3b9a61[_0x4c4c('0x29')][_0x4c4c('0x17')]);}_0x579fec[_0x4c4c('0x32')]=qs[_0x4c4c('0x33')](_0x3b9a61[_0x4c4c('0x29')][_0x4c4c('0x33')]);_0x579fec['where']=qs[_0x4c4c('0x34')](_['pick'](_0x3b9a61['query'],_0x1040e7[_0x4c4c('0x34')]),_0x3f6811);if(_0x3b9a61[_0x4c4c('0x29')]['filter']){_0x579fec['where']=_[_0x4c4c('0x35')](_0x579fec[_0x4c4c('0x36')],{'$or':_[_0x4c4c('0x28')](_0x3f6811,function(_0x13a527){if(_0x13a527[_0x4c4c('0x37')]!==_0x4c4c('0x38')){var _0x47915d={};_0x47915d[_0x13a527[_0x4c4c('0x24')]]={'$like':'%'+_0x3b9a61[_0x4c4c('0x29')]['filter']+'%'};return _0x47915d;}})});}_0x579fec=_['merge']({},_0x579fec,_0x3b9a61[_0x4c4c('0x39')]);var _0x2b93b4={'where':_0x579fec[_0x4c4c('0x36')]};return db[_0x4c4c('0x21')]['count'](_0x2b93b4)[_0x4c4c('0x1e')](function(_0x1c5667){_0x480151[_0x4c4c('0x16')]=_0x1c5667;if(_0x3b9a61[_0x4c4c('0x29')][_0x4c4c('0x3a')]){_0x579fec[_0x4c4c('0x3b')]=[{'all':!![]}];}return db[_0x4c4c('0x21')]['findAll'](_0x579fec);})[_0x4c4c('0x1e')](function(_0x394a24){_0x480151[_0x4c4c('0x3c')]=_0x394a24;return _0x480151;})[_0x4c4c('0x1e')](respondWithFilteredResult(_0x333af5,_0x579fec))[_0x4c4c('0x3d')](handleError(_0x333af5,null));};exports[_0x4c4c('0x3e')]=function(_0x244e87,_0x5a2df5){var _0x445913={'raw':!![],'where':{'id':_0x244e87[_0x4c4c('0x3f')]['id']}},_0x42d1ba={};_0x42d1ba[_0x4c4c('0x2c')]=_['keys'](db[_0x4c4c('0x21')][_0x4c4c('0x26')]);_0x42d1ba[_0x4c4c('0x29')]=_[_0x4c4c('0x2a')](_0x244e87[_0x4c4c('0x29')]);_0x42d1ba[_0x4c4c('0x34')]=_[_0x4c4c('0x2b')](_0x42d1ba[_0x4c4c('0x2c')],_0x42d1ba[_0x4c4c('0x29')]);_0x445913[_0x4c4c('0x2e')]=_['intersection'](_0x42d1ba['model'],qs[_0x4c4c('0x2d')](_0x244e87[_0x4c4c('0x29')][_0x4c4c('0x2d')]));_0x445913[_0x4c4c('0x2e')]=_0x445913[_0x4c4c('0x2e')][_0x4c4c('0x40')]?_0x445913[_0x4c4c('0x2e')]:_0x42d1ba[_0x4c4c('0x2c')];if(_0x244e87['query'][_0x4c4c('0x3a')]){_0x445913[_0x4c4c('0x3b')]=[{'all':!![]}];}_0x445913=_['merge']({},_0x445913,_0x244e87[_0x4c4c('0x39')]);return db[_0x4c4c('0x21')][_0x4c4c('0x41')](_0x445913)['then'](handleEntityNotFound(_0x5a2df5,null))['then'](respondWithResult(_0x5a2df5,null))[_0x4c4c('0x3d')](handleError(_0x5a2df5,null));};exports[_0x4c4c('0x42')]=function(_0x3a817b,_0x135411){return db[_0x4c4c('0x21')]['create'](_0x3a817b[_0x4c4c('0x43')],{})[_0x4c4c('0x1e')](function(_0x109c3d){var _0x5d6f7d=_0x3a817b['user'][_0x4c4c('0x20')]({'plain':!![]});if(!_0x5d6f7d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d6f7d[_0x4c4c('0x44')]===_0x4c4c('0x45')){var _0x35928b=_0x109c3d['get']({'plain':!![]});var _0x2296df='UserOpenchannelInteraction';return db[_0x4c4c('0x46')][_0x4c4c('0x41')]({'where':{'name':_0x2296df,'userProfileId':_0x5d6f7d[_0x4c4c('0x47')]},'raw':!![]})[_0x4c4c('0x1e')](function(_0xe9bb6a){if(_0xe9bb6a&&_0xe9bb6a['autoAssociation']===0x0){return db[_0x4c4c('0x48')][_0x4c4c('0x42')]({'name':_0x35928b[_0x4c4c('0x24')],'resourceId':_0x35928b['id'],'type':_0xe9bb6a[_0x4c4c('0x24')],'sectionId':_0xe9bb6a['id']},{})[_0x4c4c('0x1e')](function(){return _0x109c3d;});}else{return _0x109c3d;}})[_0x4c4c('0x3d')](function(_0x25f417){logger[_0x4c4c('0x22')](_0x4c4c('0x49'),_0x25f417);throw _0x25f417;});}return _0x109c3d;})[_0x4c4c('0x1e')](respondWithResult(_0x135411,0xc9))[_0x4c4c('0x3d')](handleError(_0x135411,null));};exports[_0x4c4c('0x1d')]=function(_0x3ae5ff,_0x5d3598){if(_0x3ae5ff[_0x4c4c('0x43')]['id']){delete _0x3ae5ff[_0x4c4c('0x43')]['id'];}return db[_0x4c4c('0x21')][_0x4c4c('0x41')]({'where':{'id':_0x3ae5ff[_0x4c4c('0x3f')]['id']}})[_0x4c4c('0x1e')](handleEntityNotFound(_0x5d3598,null))['then'](saveUpdates(_0x3ae5ff[_0x4c4c('0x43')],null))[_0x4c4c('0x1e')](respondWithResult(_0x5d3598,null))[_0x4c4c('0x3d')](handleError(_0x5d3598,null));};exports[_0x4c4c('0x1f')]=function(_0x572563,_0x562c8e){return db[_0x4c4c('0x21')][_0x4c4c('0x41')]({'where':{'id':_0x572563[_0x4c4c('0x3f')]['id']}})[_0x4c4c('0x1e')](handleEntityNotFound(_0x562c8e,null))[_0x4c4c('0x1e')](removeEntity(_0x562c8e,null))[_0x4c4c('0x3d')](handleError(_0x562c8e,null));}; \ No newline at end of file +var _0x9ef7=['params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','get','UserOpenchannelInteraction','UserProfileResource','stack','name','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x5789d2,_0x3dc359){var _0x168a71=function(_0x9a3d59){while(--_0x9a3d59){_0x5789d2['push'](_0x5789d2['shift']());}};_0x168a71(++_0x3dc359);}(_0x9ef7,0x151));var _0x79ef=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x9ef7[_0x278e3c];return _0x3e2d9b;};'use strict';var pdf=require(_0x79ef('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x79ef('0x1'));var zipdir=require(_0x79ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79ef('0x3'));var moment=require(_0x79ef('0x4'));var BPromise=require(_0x79ef('0x5'));var Mustache=require(_0x79ef('0x6'));var util=require('util');var path=require(_0x79ef('0x7'));var sox=require('sox');var csv=require(_0x79ef('0x8'));var ejs=require(_0x79ef('0x9'));var fs=require('fs');var _=require(_0x79ef('0xa'));var squel=require('squel');var crypto=require(_0x79ef('0xb'));var jsforce=require(_0x79ef('0xc'));var deskjs=require(_0x79ef('0xd'));var toCsv=require(_0x79ef('0x8'));var querystring=require(_0x79ef('0xe'));var Papa=require(_0x79ef('0xf'));var Redis=require(_0x79ef('0x10'));var authService=require(_0x79ef('0x11'));var qs=require(_0x79ef('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79ef('0x13'));var logger=require(_0x79ef('0x14'))(_0x79ef('0x15'));var utils=require(_0x79ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x79ef('0x17'));var db=require(_0x79ef('0x18'))['db'];function respondWithStatusCode(_0x4c9ce3,_0x140e64){_0x140e64=_0x140e64||0xcc;return function(_0xfc4abc){if(_0xfc4abc){return _0x4c9ce3[_0x79ef('0x19')](_0x140e64);}return _0x4c9ce3[_0x79ef('0x1a')](_0x140e64)[_0x79ef('0x1b')]();};}function respondWithResult(_0x5b3942,_0x14f257){_0x14f257=_0x14f257||0xc8;return function(_0x380f54){if(_0x380f54){return _0x5b3942['status'](_0x14f257)[_0x79ef('0x1c')](_0x380f54);}};}function respondWithFilteredResult(_0x4fe831,_0x1a55a9){return function(_0x257430){if(_0x257430){var _0x45f653=_0x257430[_0x79ef('0x1d')],_0x2e2326=_0x1a55a9['offset'],_0x167d30=_0x1a55a9[_0x79ef('0x1e')]+_0x1a55a9[_0x79ef('0x1f')],_0x53550b;if(_0x167d30>=_0x45f653){_0x167d30=_0x45f653;_0x53550b=0xc8;}else{_0x53550b=0xce;}_0x4fe831[_0x79ef('0x1a')](_0x53550b);return _0x4fe831['set'](_0x79ef('0x20'),_0x2e2326+'-'+_0x167d30+'/'+_0x45f653)[_0x79ef('0x1c')](_0x257430);}return null;};}function patchUpdates(_0x3bcff4){return function(_0x422a4a){try{jsonpatch[_0x79ef('0x21')](_0x422a4a,_0x3bcff4,!![]);}catch(_0x2a95a0){return BPromise['reject'](_0x2a95a0);}return _0x422a4a['save']();};}function saveUpdates(_0x2da92d,_0x361539){return function(_0xaed950){if(_0xaed950){return _0xaed950[_0x79ef('0x22')](_0x2da92d)[_0x79ef('0x23')](function(_0x54132a){return _0x54132a;});}return null;};}function removeEntity(_0x49e3fe,_0x2c2716){return function(_0x14b32f){if(_0x14b32f){return _0x14b32f[_0x79ef('0x24')]()[_0x79ef('0x23')](function(){var _0x41eb86=_0x14b32f[_0x79ef('0x25')]({'plain':!![]});var _0x1e842f=_0x79ef('0x26');return db[_0x79ef('0x27')][_0x79ef('0x24')]({'where':{'type':_0x1e842f,'resourceId':_0x41eb86['id']}})[_0x79ef('0x23')](function(){return _0x14b32f;});})[_0x79ef('0x23')](function(){_0x49e3fe['status'](0xcc)[_0x79ef('0x1b')]();});}};}function handleEntityNotFound(_0x58071a,_0x5bbbc1){return function(_0x59a934){if(!_0x59a934){_0x58071a[_0x79ef('0x19')](0x194);}return _0x59a934;};}function handleError(_0x541657,_0x222d37){_0x222d37=_0x222d37||0x1f4;return function(_0x4b1a03){logger['error'](_0x4b1a03[_0x79ef('0x28')]);if(_0x4b1a03[_0x79ef('0x29')]){delete _0x4b1a03[_0x79ef('0x29')];}_0x541657['status'](_0x222d37)['send'](_0x4b1a03);};}exports['index']=function(_0x4bfaf2,_0x296e4d){var _0x53aadb={},_0x479dee={},_0x377be4={'count':0x0,'rows':[]};var _0x38bc23=_['map'](db[_0x79ef('0x26')][_0x79ef('0x2a')],function(_0x27e9ea){return{'name':_0x27e9ea[_0x79ef('0x2b')],'type':_0x27e9ea[_0x79ef('0x2c')][_0x79ef('0x2d')]};});_0x479dee['model']=_[_0x79ef('0x2e')](_0x38bc23,_0x79ef('0x29'));_0x479dee[_0x79ef('0x2f')]=_[_0x79ef('0x30')](_0x4bfaf2[_0x79ef('0x2f')]);_0x479dee['filters']=_[_0x79ef('0x31')](_0x479dee['model'],_0x479dee[_0x79ef('0x2f')]);_0x53aadb[_0x79ef('0x32')]=_[_0x79ef('0x31')](_0x479dee[_0x79ef('0x33')],qs[_0x79ef('0x34')](_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x34')]));_0x53aadb[_0x79ef('0x32')]=_0x53aadb[_0x79ef('0x32')]['length']?_0x53aadb[_0x79ef('0x32')]:_0x479dee[_0x79ef('0x33')];if(!_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x35')](_0x79ef('0x36'))){_0x53aadb[_0x79ef('0x1f')]=qs[_0x79ef('0x1f')](_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x1f')]);_0x53aadb[_0x79ef('0x1e')]=qs[_0x79ef('0x1e')](_0x4bfaf2['query'][_0x79ef('0x1e')]);}_0x53aadb[_0x79ef('0x37')]=qs[_0x79ef('0x38')](_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x38')]);_0x53aadb[_0x79ef('0x39')]=qs[_0x79ef('0x3a')](_['pick'](_0x4bfaf2[_0x79ef('0x2f')],_0x479dee[_0x79ef('0x3a')]),_0x38bc23);if(_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x3b')]){_0x53aadb[_0x79ef('0x39')]=_[_0x79ef('0x3c')](_0x53aadb[_0x79ef('0x39')],{'$or':_['map'](_0x38bc23,function(_0x447d73){if(_0x447d73['type']!==_0x79ef('0x3d')){var _0x533637={};_0x533637[_0x447d73[_0x79ef('0x29')]]={'$like':'%'+_0x4bfaf2['query'][_0x79ef('0x3b')]+'%'};return _0x533637;}})});}_0x53aadb=_['merge']({},_0x53aadb,_0x4bfaf2[_0x79ef('0x3e')]);var _0x39d140={'where':_0x53aadb[_0x79ef('0x39')]};return db[_0x79ef('0x26')][_0x79ef('0x1d')](_0x39d140)[_0x79ef('0x23')](function(_0x1fa1fd){_0x377be4[_0x79ef('0x1d')]=_0x1fa1fd;if(_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x3f')]){_0x53aadb['include']=[{'all':!![]}];}return db[_0x79ef('0x26')][_0x79ef('0x40')](_0x53aadb);})['then'](function(_0x337370){_0x377be4[_0x79ef('0x41')]=_0x337370;return _0x377be4;})['then'](respondWithFilteredResult(_0x296e4d,_0x53aadb))[_0x79ef('0x42')](handleError(_0x296e4d,null));};exports[_0x79ef('0x43')]=function(_0x36536f,_0x3b2bcd){var _0x49f0b6={'raw':!![],'where':{'id':_0x36536f[_0x79ef('0x44')]['id']}},_0x5cb3db={};_0x5cb3db[_0x79ef('0x33')]=_['keys'](db[_0x79ef('0x26')][_0x79ef('0x2a')]);_0x5cb3db[_0x79ef('0x2f')]=_[_0x79ef('0x30')](_0x36536f[_0x79ef('0x2f')]);_0x5cb3db['filters']=_['intersection'](_0x5cb3db[_0x79ef('0x33')],_0x5cb3db[_0x79ef('0x2f')]);_0x49f0b6['attributes']=_[_0x79ef('0x31')](_0x5cb3db[_0x79ef('0x33')],qs[_0x79ef('0x34')](_0x36536f[_0x79ef('0x2f')][_0x79ef('0x34')]));_0x49f0b6[_0x79ef('0x32')]=_0x49f0b6[_0x79ef('0x32')]['length']?_0x49f0b6[_0x79ef('0x32')]:_0x5cb3db['model'];if(_0x36536f['query'][_0x79ef('0x3f')]){_0x49f0b6[_0x79ef('0x45')]=[{'all':!![]}];}_0x49f0b6=_[_0x79ef('0x3c')]({},_0x49f0b6,_0x36536f[_0x79ef('0x3e')]);return db[_0x79ef('0x26')][_0x79ef('0x46')](_0x49f0b6)['then'](handleEntityNotFound(_0x3b2bcd,null))[_0x79ef('0x23')](respondWithResult(_0x3b2bcd,null))['catch'](handleError(_0x3b2bcd,null));};exports[_0x79ef('0x47')]=function(_0x4087f2,_0x1d3aaa){return db['UserOpenchannelInteraction']['create'](_0x4087f2[_0x79ef('0x48')],{})['then'](function(_0x3d8715){var _0x1e4b90=_0x4087f2[_0x79ef('0x49')][_0x79ef('0x25')]({'plain':!![]});if(!_0x1e4b90)throw new Error(_0x79ef('0x4a'));if(_0x1e4b90[_0x79ef('0x4b')]==='user'){var _0x1f5775=_0x3d8715[_0x79ef('0x25')]({'plain':!![]});var _0x39d0be=_0x79ef('0x26');return db[_0x79ef('0x4c')]['find']({'where':{'name':_0x39d0be,'userProfileId':_0x1e4b90[_0x79ef('0x4d')]},'raw':!![]})[_0x79ef('0x23')](function(_0x1b178e){if(_0x1b178e&&_0x1b178e[_0x79ef('0x4e')]===0x0){return db[_0x79ef('0x27')][_0x79ef('0x47')]({'name':_0x1f5775[_0x79ef('0x29')],'resourceId':_0x1f5775['id'],'type':_0x1b178e[_0x79ef('0x29')],'sectionId':_0x1b178e['id']},{})[_0x79ef('0x23')](function(){return _0x3d8715;});}else{return _0x3d8715;}})[_0x79ef('0x42')](function(_0x1edd56){logger[_0x79ef('0x4f')](_0x79ef('0x50'),_0x1edd56);throw _0x1edd56;});}return _0x3d8715;})['then'](respondWithResult(_0x1d3aaa,0xc9))[_0x79ef('0x42')](handleError(_0x1d3aaa,null));};exports[_0x79ef('0x22')]=function(_0x3b7774,_0x4a4e7b){if(_0x3b7774['body']['id']){delete _0x3b7774['body']['id'];}return db[_0x79ef('0x26')]['find']({'where':{'id':_0x3b7774[_0x79ef('0x44')]['id']}})[_0x79ef('0x23')](handleEntityNotFound(_0x4a4e7b,null))[_0x79ef('0x23')](saveUpdates(_0x3b7774[_0x79ef('0x48')],null))[_0x79ef('0x23')](respondWithResult(_0x4a4e7b,null))[_0x79ef('0x42')](handleError(_0x4a4e7b,null));};exports[_0x79ef('0x24')]=function(_0x3d39ca,_0x1ad544){return db[_0x79ef('0x26')][_0x79ef('0x46')]({'where':{'id':_0x3d39ca['params']['id']}})[_0x79ef('0x23')](handleEntityNotFound(_0x1ad544,null))['then'](removeEntity(_0x1ad544,null))[_0x79ef('0x42')](handleError(_0x1ad544,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index d98c7f7..bea13fa 100644 --- a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js +++ b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc6a=['user_has_openchannel_interactions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./UserOpenchannelInteraction.attributes','define','UserOpenchannelInteraction'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0xcc6a,0x1a5));var _0xacc6=function(_0x126391,_0x3845b2){_0x126391=_0x126391-0x0;var _0x391a18=_0xcc6a[_0x126391];return _0x391a18;};'use strict';var _=require('lodash');var util=require(_0xacc6('0x0'));var logger=require(_0xacc6('0x1'))(_0xacc6('0x2'));var moment=require(_0xacc6('0x3'));var BPromise=require(_0xacc6('0x4'));var rp=require(_0xacc6('0x5'));var fs=require('fs');var path=require(_0xacc6('0x6'));var rimraf=require(_0xacc6('0x7'));var config=require('../../config/environment');var attributes=require(_0xacc6('0x8'));module['exports']=function(_0x1026ed,_0x165b17){return _0x1026ed[_0xacc6('0x9')](_0xacc6('0xa'),attributes,{'tableName':_0xacc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6ac=['user_has_openchannel_interactions','lodash','util','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x4cbca0,_0x4107dc){var _0xf74ef5=function(_0x14f80a){while(--_0x14f80a){_0x4cbca0['push'](_0x4cbca0['shift']());}};_0xf74ef5(++_0x4107dc);}(_0xf6ac,0x160));var _0xcf6a=function(_0x329f22,_0xe1ba1d){_0x329f22=_0x329f22-0x0;var _0x3490b3=_0xf6ac[_0x329f22];return _0x3490b3;};'use strict';var _=require(_0xcf6a('0x0'));var util=require(_0xcf6a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcf6a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf6a('0x3'));var rimraf=require(_0xcf6a('0x4'));var config=require(_0xcf6a('0x5'));var attributes=require('./UserOpenchannelInteraction.attributes');module[_0xcf6a('0x6')]=function(_0x2a96ef,_0x38eb2d){return _0x2a96ef[_0xcf6a('0x7')]('UserOpenchannelInteraction',attributes,{'tableName':_0xcf6a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js index 97fc300..2c0930d 100644 --- a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js +++ b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cf5=['error','code','message','UserOpenchannelInteraction,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x397808,_0x892bd5){var _0x454b17=function(_0x52433c){while(--_0x52433c){_0x397808['push'](_0x397808['shift']());}};_0x454b17(++_0x892bd5);}(_0x1cf5,0x78));var _0x51cf=function(_0x550a9f,_0x4784c6){_0x550a9f=_0x550a9f-0x0;var _0x2a8aa4=_0x1cf5[_0x550a9f];return _0x2a8aa4;};'use strict';var _=require('lodash');var util=require(_0x51cf('0x0'));var moment=require(_0x51cf('0x1'));var BPromise=require(_0x51cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51cf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x51cf('0x4'));var logger=require(_0x51cf('0x5'))(_0x51cf('0x6'));var config=require(_0x51cf('0x7'));var jayson=require(_0x51cf('0x8'));var client=jayson[_0x51cf('0x9')][_0x51cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x496b4a,_0x16c5d0,_0x1ea4b1){return new BPromise(function(_0x2659f8,_0x4adb50){return client[_0x51cf('0xb')](_0x496b4a,_0x1ea4b1)[_0x51cf('0xc')](function(_0x577f2c){logger[_0x51cf('0xd')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x16c5d0,'request\x20sent');logger[_0x51cf('0xe')](_0x51cf('0xf'),_0x16c5d0,_0x51cf('0x10'),JSON[_0x51cf('0x11')](_0x577f2c));if(_0x577f2c[_0x51cf('0x12')]){if(_0x577f2c['error'][_0x51cf('0x13')]===0x1f4){logger[_0x51cf('0x12')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x16c5d0,_0x577f2c['error'][_0x51cf('0x14')]);return _0x4adb50(_0x577f2c[_0x51cf('0x12')]['message']);}logger['error']('UserOpenchannelInteraction,\x20%s,\x20%s',_0x16c5d0,_0x577f2c[_0x51cf('0x12')]['message']);return _0x2659f8(_0x577f2c[_0x51cf('0x12')][_0x51cf('0x14')]);}else{logger['info'](_0x51cf('0x15'),_0x16c5d0,'request\x20sent');_0x2659f8(_0x577f2c['result']['message']);}})[_0x51cf('0x16')](function(_0x8b7ff6){logger[_0x51cf('0x12')](_0x51cf('0x15'),_0x16c5d0,_0x8b7ff6);_0x4adb50(_0x8b7ff6);});});} \ No newline at end of file +var _0x5b2e=['catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x3ac073,_0x507907){var _0x646059=function(_0x4f6524){while(--_0x4f6524){_0x3ac073['push'](_0x3ac073['shift']());}};_0x646059(++_0x507907);}(_0x5b2e,0xe5));var _0xe5b2=function(_0x3a45e7,_0x9ac45){_0x3a45e7=_0x3a45e7-0x0;var _0x4d3e0f=_0x5b2e[_0x3a45e7];return _0x4d3e0f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe5b2('0x0'));var rs=require(_0xe5b2('0x1'));var fs=require('fs');var Redis=require(_0xe5b2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5b2('0x3'));var logger=require(_0xe5b2('0x4'))(_0xe5b2('0x5'));var config=require(_0xe5b2('0x6'));var jayson=require(_0xe5b2('0x7'));var client=jayson['client'][_0xe5b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23fdcb,_0x47a565,_0x109939){return new BPromise(function(_0x615ad,_0x4e13dc){return client[_0xe5b2('0x9')](_0x23fdcb,_0x109939)[_0xe5b2('0xa')](function(_0xaf13c4){logger[_0xe5b2('0xb')](_0xe5b2('0xc'),_0x47a565,'request\x20sent');logger[_0xe5b2('0xd')]('UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x47a565,_0xe5b2('0xe'),JSON['stringify'](_0xaf13c4));if(_0xaf13c4[_0xe5b2('0xf')]){if(_0xaf13c4['error'][_0xe5b2('0x10')]===0x1f4){logger['error'](_0xe5b2('0xc'),_0x47a565,_0xaf13c4['error'][_0xe5b2('0x11')]);return _0x4e13dc(_0xaf13c4[_0xe5b2('0xf')]['message']);}logger[_0xe5b2('0xf')](_0xe5b2('0xc'),_0x47a565,_0xaf13c4[_0xe5b2('0xf')][_0xe5b2('0x11')]);return _0x615ad(_0xaf13c4[_0xe5b2('0xf')][_0xe5b2('0x11')]);}else{logger['info']('UserOpenchannelInteraction,\x20%s,\x20%s',_0x47a565,_0xe5b2('0xe'));_0x615ad(_0xaf13c4['result'][_0xe5b2('0x11')]);}})[_0xe5b2('0x12')](function(_0x409235){logger[_0xe5b2('0xf')](_0xe5b2('0xc'),_0x47a565,_0x409235);_0x4e13dc(_0x409235);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 1028a04..1da53ab 100644 --- a/server/api/UserOpenchannelInteraction/index.js +++ b/server/api/UserOpenchannelInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1042=['express','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','util','connect-timeout'];(function(_0x3da215,_0x329253){var _0x6a5d1=function(_0x17a516){while(--_0x17a516){_0x3da215['push'](_0x3da215['shift']());}};_0x6a5d1(++_0x329253);}(_0x1042,0x10c));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2104('0x0'));var path=require('path');var timeout=require(_0x2104('0x1'));var express=require(_0x2104('0x2'));var router=express['Router']();var auth=require(_0x2104('0x3'));var interaction=require(_0x2104('0x4'));var config=require('../../config/environment');var controller=require('./UserOpenchannelInteraction.controller');router[_0x2104('0x5')]('/',auth['isAuthenticated'](),controller[_0x2104('0x6')]);router[_0x2104('0x5')](_0x2104('0x7'),auth[_0x2104('0x8')](),controller['show']);router[_0x2104('0x9')]('/',auth['isAuthenticated'](),controller[_0x2104('0xa')]);router[_0x2104('0xb')](_0x2104('0x7'),auth[_0x2104('0x8')](),controller[_0x2104('0xc')]);router[_0x2104('0xd')](_0x2104('0x7'),auth[_0x2104('0x8')](),controller[_0x2104('0xe')]);module['exports']=router; \ No newline at end of file +var _0x138e=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./UserOpenchannelInteraction.controller'];(function(_0x55795a,_0x53d9b5){var _0x26ffa5=function(_0x4a3519){while(--_0x4a3519){_0x55795a['push'](_0x55795a['shift']());}};_0x26ffa5(++_0x53d9b5);}(_0x138e,0x102));var _0xe138=function(_0x448e04,_0x16ea2e){_0x448e04=_0x448e04-0x0;var _0x2cd368=_0x138e[_0x448e04];return _0x2cd368;};'use strict';var multer=require('multer');var util=require(_0xe138('0x0'));var path=require(_0xe138('0x1'));var timeout=require(_0xe138('0x2'));var express=require(_0xe138('0x3'));var router=express[_0xe138('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe138('0x5'));var config=require(_0xe138('0x6'));var controller=require(_0xe138('0x7'));router['get']('/',auth[_0xe138('0x8')](),controller[_0xe138('0x9')]);router[_0xe138('0xa')](_0xe138('0xb'),auth['isAuthenticated'](),controller[_0xe138('0xc')]);router[_0xe138('0xd')]('/',auth['isAuthenticated'](),controller[_0xe138('0xe')]);router[_0xe138('0xf')](_0xe138('0xb'),auth['isAuthenticated'](),controller[_0xe138('0x10')]);router[_0xe138('0x11')](_0xe138('0xb'),auth[_0xe138('0x8')](),controller['destroy']);module[_0xe138('0x12')]=router; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js index 7f528fa..a0c9279 100644 --- a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js +++ b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a7a=['INTEGER','sequelize','exports'];(function(_0x50c5b2,_0x133fa9){var _0x2e9ccd=function(_0x2bc05b){while(--_0x2bc05b){_0x50c5b2['push'](_0x50c5b2['shift']());}};_0x2e9ccd(++_0x133fa9);}(_0x6a7a,0x172));var _0xa6a7=function(_0x41d404,_0x3b2593){_0x41d404=_0x41d404-0x0;var _0x550de4=_0x6a7a[_0x41d404];return _0x550de4;};'use strict';var Sequelize=require(_0xa6a7('0x0'));module[_0xa6a7('0x1')]={'SmsInteractionId':{'type':Sequelize[_0xa6a7('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xa6a7('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0xb69c=['exports','INTEGER'];(function(_0x592906,_0xa59c87){var _0x5cc0f0=function(_0x2b8ca6){while(--_0x2b8ca6){_0x592906['push'](_0x592906['shift']());}};_0x5cc0f0(++_0xa59c87);}(_0xb69c,0x126));var _0xcb69=function(_0x4b993c,_0x339641){_0x4b993c=_0x4b993c-0x0;var _0x3f6f95=_0xb69c[_0x4b993c];return _0x3f6f95;};'use strict';var Sequelize=require('sequelize');module[_0xcb69('0x0')]={'SmsInteractionId':{'type':Sequelize[_0xcb69('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xcb69('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index 5616b36..7ab829b 100644 --- a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js +++ b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['destroy','then','UserSmsInteractions','UserProfileResource','stack','name','send','index','map','UserSmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x2a6b2c,_0x2d0e86){var _0x565647=function(_0x18f056){while(--_0x18f056){_0x2a6b2c['push'](_0x2a6b2c['shift']());}};_0x565647(++_0x2d0e86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['update']=function(_0x53975a,_0x39d77d){if(_0x53975a[_0x0a9e('0x48')]['id']){delete _0x53975a[_0x0a9e('0x48')]['id'];}return db['UserSmsInteraction'][_0x0a9e('0x4e')]({'where':{'id':_0x53975a[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x39d77d,null))['then'](saveUpdates(_0x53975a[_0x0a9e('0x48')],null))['then'](respondWithResult(_0x39d77d,null))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports['destroy']=function(_0x2e5e62,_0x3c20b2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x2e5e62[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3c20b2,null))['then'](removeEntity(_0x3c20b2,null))['catch'](handleError(_0x3c20b2,null));}; \ No newline at end of file +var _0xa9e0=['destroy','then','UserSmsInteractions','UserProfileResource','stack','name','send','index','map','UserSmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x502678,_0x426bc2){var _0x278ef9=function(_0x5a2f93){while(--_0x5a2f93){_0x502678['push'](_0x502678['shift']());}};_0x278ef9(++_0x426bc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['update']=function(_0x53975a,_0x39d77d){if(_0x53975a[_0x0a9e('0x48')]['id']){delete _0x53975a[_0x0a9e('0x48')]['id'];}return db['UserSmsInteraction'][_0x0a9e('0x4e')]({'where':{'id':_0x53975a[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x39d77d,null))['then'](saveUpdates(_0x53975a[_0x0a9e('0x48')],null))['then'](respondWithResult(_0x39d77d,null))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports['destroy']=function(_0x2e5e62,_0x3c20b2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x2e5e62[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3c20b2,null))['then'](removeEntity(_0x3c20b2,null))['catch'](handleError(_0x3c20b2,null));}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.model.js b/server/api/UserSmsInteraction/UserSmsInteraction.model.js index d17ab3c..5d64692 100644 --- a/server/api/UserSmsInteraction/UserSmsInteraction.model.js +++ b/server/api/UserSmsInteraction/UserSmsInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79df=['request-promise','path','../../config/environment','./UserSmsInteraction.attributes','define','UserSmsInteraction','user_has_sms_interactions','util','../../config/logger','moment'];(function(_0x21c48,_0x49ac0a){var _0x1f2cea=function(_0x51a5eb){while(--_0x51a5eb){_0x21c48['push'](_0x21c48['shift']());}};_0x1f2cea(++_0x49ac0a);}(_0x79df,0xa7));var _0xf79d=function(_0x60d448,_0x5d5c9e){_0x60d448=_0x60d448-0x0;var _0x1b59ef=_0x79df[_0x60d448];return _0x1b59ef;};'use strict';var _=require('lodash');var util=require(_0xf79d('0x0'));var logger=require(_0xf79d('0x1'))('api');var moment=require(_0xf79d('0x2'));var BPromise=require('bluebird');var rp=require(_0xf79d('0x3'));var fs=require('fs');var path=require(_0xf79d('0x4'));var rimraf=require('rimraf');var config=require(_0xf79d('0x5'));var attributes=require(_0xf79d('0x6'));module['exports']=function(_0x1ee54a,_0xa842c5){return _0x1ee54a[_0xf79d('0x7')](_0xf79d('0x8'),attributes,{'tableName':_0xf79d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe71d=['path','rimraf','./UserSmsInteraction.attributes','exports','UserSmsInteraction','user_has_sms_interactions','lodash','util','../../config/logger','api','request-promise'];(function(_0x270c23,_0x9c0606){var _0x68e7e9=function(_0x5ee190){while(--_0x5ee190){_0x270c23['push'](_0x270c23['shift']());}};_0x68e7e9(++_0x9c0606);}(_0xe71d,0xf8));var _0xde71=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe71d[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xde71('0x0'));var util=require(_0xde71('0x1'));var logger=require(_0xde71('0x2'))(_0xde71('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde71('0x4'));var fs=require('fs');var path=require(_0xde71('0x5'));var rimraf=require(_0xde71('0x6'));var config=require('../../config/environment');var attributes=require(_0xde71('0x7'));module[_0xde71('0x8')]=function(_0x4e8892,_0x15cd7c){return _0x4e8892['define'](_0xde71('0x9'),attributes,{'tableName':_0xde71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js b/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js index 0401b92..0f12ca9 100644 --- a/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js +++ b/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x986f=['rpc','../../config/environment','jayson/promise','client','http','then','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1d7599,_0x49929f){var _0x55da12=function(_0x3f7a5f){while(--_0x3f7a5f){_0x1d7599['push'](_0x1d7599['shift']());}};_0x55da12(++_0x49929f);}(_0x986f,0xcf));var _0xf986=function(_0x5a78e2,_0x1914b0){_0x5a78e2=_0x5a78e2-0x0;var _0x29a6e7=_0x986f[_0x5a78e2];return _0x29a6e7;};'use strict';var _=require(_0xf986('0x0'));var util=require(_0xf986('0x1'));var moment=require(_0xf986('0x2'));var BPromise=require(_0xf986('0x3'));var rs=require(_0xf986('0x4'));var fs=require('fs');var Redis=require(_0xf986('0x5'));var db=require(_0xf986('0x6'))['db'];var utils=require(_0xf986('0x7'));var logger=require(_0xf986('0x8'))(_0xf986('0x9'));var config=require(_0xf986('0xa'));var jayson=require(_0xf986('0xb'));var client=jayson[_0xf986('0xc')][_0xf986('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x242118,_0x2f2f96,_0x126c43){return new BPromise(function(_0x316399,_0x6df5f4){return client['request'](_0x242118,_0x126c43)[_0xf986('0xe')](function(_0x406d39){logger[_0xf986('0xf')](_0xf986('0x10'),_0x2f2f96,'request\x20sent');logger['debug']('UserSmsInteraction,\x20%s,\x20%s,\x20%s',_0x2f2f96,_0xf986('0x11'),JSON[_0xf986('0x12')](_0x406d39));if(_0x406d39['error']){if(_0x406d39[_0xf986('0x13')][_0xf986('0x14')]===0x1f4){logger[_0xf986('0x13')](_0xf986('0x10'),_0x2f2f96,_0x406d39[_0xf986('0x13')][_0xf986('0x15')]);return _0x6df5f4(_0x406d39[_0xf986('0x13')][_0xf986('0x15')]);}logger['error'](_0xf986('0x10'),_0x2f2f96,_0x406d39[_0xf986('0x13')]['message']);return _0x316399(_0x406d39['error'][_0xf986('0x15')]);}else{logger[_0xf986('0xf')](_0xf986('0x10'),_0x2f2f96,_0xf986('0x11'));_0x316399(_0x406d39[_0xf986('0x16')][_0xf986('0x15')]);}})[_0xf986('0x17')](function(_0x1f6c48){logger[_0xf986('0x13')](_0xf986('0x10'),_0x2f2f96,_0x1f6c48);_0x6df5f4(_0x1f6c48);});});} \ No newline at end of file +var _0xf217=['info','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','UserSmsInteraction,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xf217,0x1a9));var _0x7f21=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xf217[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x7f21('0x0'));var util=require(_0x7f21('0x1'));var moment=require(_0x7f21('0x2'));var BPromise=require(_0x7f21('0x3'));var rs=require(_0x7f21('0x4'));var fs=require('fs');var Redis=require(_0x7f21('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f21('0x6'));var logger=require(_0x7f21('0x7'))(_0x7f21('0x8'));var config=require(_0x7f21('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7f21('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35a221,_0x534362,_0x33a95d){return new BPromise(function(_0x299f89,_0x55b1a3){return client[_0x7f21('0xb')](_0x35a221,_0x33a95d)['then'](function(_0x33ef1b){logger[_0x7f21('0xc')]('UserSmsInteraction,\x20%s,\x20%s',_0x534362,'request\x20sent');logger[_0x7f21('0xd')](_0x7f21('0xe'),_0x534362,_0x7f21('0xf'),JSON[_0x7f21('0x10')](_0x33ef1b));if(_0x33ef1b['error']){if(_0x33ef1b['error'][_0x7f21('0x11')]===0x1f4){logger[_0x7f21('0x12')]('UserSmsInteraction,\x20%s,\x20%s',_0x534362,_0x33ef1b[_0x7f21('0x12')][_0x7f21('0x13')]);return _0x55b1a3(_0x33ef1b['error'][_0x7f21('0x13')]);}logger['error'](_0x7f21('0x14'),_0x534362,_0x33ef1b[_0x7f21('0x12')][_0x7f21('0x13')]);return _0x299f89(_0x33ef1b['error'][_0x7f21('0x13')]);}else{logger[_0x7f21('0xc')]('UserSmsInteraction,\x20%s,\x20%s',_0x534362,'request\x20sent');_0x299f89(_0x33ef1b[_0x7f21('0x15')][_0x7f21('0x13')]);}})[_0x7f21('0x16')](function(_0x4053ce){logger[_0x7f21('0x12')](_0x7f21('0x14'),_0x534362,_0x4053ce);_0x55b1a3(_0x4053ce);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index 30ccf2d..48f1768 100644 --- a/server/api/UserSmsInteraction/index.js +++ b/server/api/UserSmsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b4f=['create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','index','isAuthenticated','post'];(function(_0x57c83a,_0xf5b714){var _0x517492=function(_0x28e04e){while(--_0x28e04e){_0x57c83a['push'](_0x57c83a['shift']());}};_0x517492(++_0xf5b714);}(_0x7b4f,0xcc));var _0xf7b4=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0x7b4f[_0x323419];return _0x4c0be7;};'use strict';var multer=require(_0xf7b4('0x0'));var util=require(_0xf7b4('0x1'));var path=require(_0xf7b4('0x2'));var timeout=require(_0xf7b4('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xf7b4('0x4'));var interaction=require(_0xf7b4('0x5'));var config=require(_0xf7b4('0x6'));var controller=require(_0xf7b4('0x7'));router[_0xf7b4('0x8')]('/',auth['isAuthenticated'](),controller[_0xf7b4('0x9')]);router[_0xf7b4('0x8')]('/:id',auth[_0xf7b4('0xa')](),controller['show']);router[_0xf7b4('0xb')]('/',auth['isAuthenticated'](),controller[_0xf7b4('0xc')]);router[_0xf7b4('0xd')]('/:id',auth[_0xf7b4('0xa')](),controller[_0xf7b4('0xe')]);router['delete'](_0xf7b4('0xf'),auth[_0xf7b4('0xa')](),controller[_0xf7b4('0x10')]);module[_0xf7b4('0x11')]=router; \ No newline at end of file +var _0xc685=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated','index','post','create','put','update','/:id','destroy','exports','multer','util'];(function(_0x37e288,_0x397fdf){var _0x4a2d6e=function(_0x44f5fb){while(--_0x44f5fb){_0x37e288['push'](_0x37e288['shift']());}};_0x4a2d6e(++_0x397fdf);}(_0xc685,0xd6));var _0x5c68=function(_0x321648,_0x4f6001){_0x321648=_0x321648-0x0;var _0x464689=_0xc685[_0x321648];return _0x464689;};'use strict';var multer=require(_0x5c68('0x0'));var util=require(_0x5c68('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c68('0x2'));var router=express[_0x5c68('0x3')]();var auth=require(_0x5c68('0x4'));var interaction=require(_0x5c68('0x5'));var config=require(_0x5c68('0x6'));var controller=require(_0x5c68('0x7'));router[_0x5c68('0x8')]('/',auth[_0x5c68('0x9')](),controller[_0x5c68('0xa')]);router[_0x5c68('0x8')]('/:id',auth[_0x5c68('0x9')](),controller['show']);router[_0x5c68('0xb')]('/',auth['isAuthenticated'](),controller[_0x5c68('0xc')]);router[_0x5c68('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5c68('0xe')]);router['delete'](_0x5c68('0xf'),auth[_0x5c68('0x9')](),controller[_0x5c68('0x10')]);module[_0x5c68('0x11')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index e4fed40..715a7b2 100644 --- a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js +++ b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c13=['INTEGER','exports'];(function(_0x37b5c2,_0x39b2b5){var _0x1ab57c=function(_0x3248d0){while(--_0x3248d0){_0x37b5c2['push'](_0x37b5c2['shift']());}};_0x1ab57c(++_0x39b2b5);}(_0x5c13,0x1ef));var _0x35c1=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0x5c13[_0x339129];return _0x1570df;};'use strict';var Sequelize=require('sequelize');module[_0x35c1('0x0')]={'WhatsappInteractionId':{'type':Sequelize[_0x35c1('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0xa9e5=['sequelize','exports','INTEGER'];(function(_0x1a7a7d,_0x125c62){var _0xc6f97b=function(_0x18b77a){while(--_0x18b77a){_0x1a7a7d['push'](_0x1a7a7d['shift']());}};_0xc6f97b(++_0x125c62);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x550180,_0x146ffe){_0x550180=_0x550180-0x0;var _0x1a93d7=_0xa9e5[_0x550180];return _0x1a93d7;};'use strict';var Sequelize=require(_0x5a9e('0x0'));module[_0x5a9e('0x1')]={'WhatsappInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x5a9e('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index 6ca3d13..a27615d 100644 --- a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js +++ b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f1b=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','UserWhatsappInteractions','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','UserWhatsappInteraction','includeAll','include','findAll','rows','catch','show','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x2c4ca7,_0x5abe87){var _0xc82d75=function(_0x27780f){while(--_0x27780f){_0x2c4ca7['push'](_0x2c4ca7['shift']());}};_0xc82d75(++_0x5abe87);}(_0x5f1b,0x103));var _0xb5f1=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0x5f1b[_0x2525f1];return _0x13c1b5;};'use strict';var pdf=require(_0xb5f1('0x0'));var emlformat=require(_0xb5f1('0x1'));var rimraf=require(_0xb5f1('0x2'));var zipdir=require(_0xb5f1('0x3'));var jsonpatch=require(_0xb5f1('0x4'));var rp=require(_0xb5f1('0x5'));var moment=require('moment');var BPromise=require(_0xb5f1('0x6'));var Mustache=require(_0xb5f1('0x7'));var util=require(_0xb5f1('0x8'));var path=require(_0xb5f1('0x9'));var sox=require(_0xb5f1('0xa'));var csv=require(_0xb5f1('0xb'));var ejs=require(_0xb5f1('0xc'));var fs=require('fs');var _=require(_0xb5f1('0xd'));var squel=require(_0xb5f1('0xe'));var crypto=require(_0xb5f1('0xf'));var jsforce=require(_0xb5f1('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb5f1('0xb'));var querystring=require(_0xb5f1('0x11'));var Papa=require(_0xb5f1('0x12'));var Redis=require(_0xb5f1('0x13'));var authService=require(_0xb5f1('0x14'));var qs=require(_0xb5f1('0x15'));var as=require(_0xb5f1('0x16'));var hardwareService=require(_0xb5f1('0x17'));var logger=require(_0xb5f1('0x18'))(_0xb5f1('0x19'));var utils=require(_0xb5f1('0x1a'));var config=require(_0xb5f1('0x1b'));var licenseUtil=require(_0xb5f1('0x1c'));var db=require(_0xb5f1('0x1d'))['db'];function respondWithStatusCode(_0x4f9b6f,_0x1e58d4){_0x1e58d4=_0x1e58d4||0xcc;return function(_0x1030fb){if(_0x1030fb){return _0x4f9b6f[_0xb5f1('0x1e')](_0x1e58d4);}return _0x4f9b6f[_0xb5f1('0x1f')](_0x1e58d4)['end']();};}function respondWithResult(_0x22f8a8,_0xc18a47){_0xc18a47=_0xc18a47||0xc8;return function(_0x36ceae){if(_0x36ceae){return _0x22f8a8['status'](_0xc18a47)[_0xb5f1('0x20')](_0x36ceae);}};}function respondWithFilteredResult(_0xaee531,_0x2db424){return function(_0x3f639f){if(_0x3f639f){var _0x5b7e37=_0x3f639f[_0xb5f1('0x21')],_0x1ec43c=_0x2db424[_0xb5f1('0x22')],_0x5e0d8a=_0x2db424['offset']+_0x2db424[_0xb5f1('0x23')],_0x3c1b87;if(_0x5e0d8a>=_0x5b7e37){_0x5e0d8a=_0x5b7e37;_0x3c1b87=0xc8;}else{_0x3c1b87=0xce;}_0xaee531['status'](_0x3c1b87);return _0xaee531[_0xb5f1('0x24')](_0xb5f1('0x25'),_0x1ec43c+'-'+_0x5e0d8a+'/'+_0x5b7e37)[_0xb5f1('0x20')](_0x3f639f);}return null;};}function patchUpdates(_0x124399){return function(_0x463f5d){try{jsonpatch[_0xb5f1('0x26')](_0x463f5d,_0x124399,!![]);}catch(_0x56f303){return BPromise[_0xb5f1('0x27')](_0x56f303);}return _0x463f5d['save']();};}function saveUpdates(_0x4e943b,_0x172f72){return function(_0x1b9aa0){if(_0x1b9aa0){return _0x1b9aa0[_0xb5f1('0x28')](_0x4e943b)['then'](function(_0x547b47){return _0x547b47;});}return null;};}function removeEntity(_0x559645,_0x1c091e){return function(_0x50a69d){if(_0x50a69d){return _0x50a69d['destroy']()[_0xb5f1('0x29')](function(){var _0x452eb8=_0x50a69d['get']({'plain':!![]});var _0x400ee3=_0xb5f1('0x2a');return db[_0xb5f1('0x2b')][_0xb5f1('0x2c')]({'where':{'type':_0x400ee3,'resourceId':_0x452eb8['id']}})[_0xb5f1('0x29')](function(){return _0x50a69d;});})[_0xb5f1('0x29')](function(){_0x559645[_0xb5f1('0x1f')](0xcc)[_0xb5f1('0x2d')]();});}};}function handleEntityNotFound(_0x337437,_0x4e9b0e){return function(_0xb3c60a){if(!_0xb3c60a){_0x337437[_0xb5f1('0x1e')](0x194);}return _0xb3c60a;};}function handleError(_0x1fe360,_0x3718f2){_0x3718f2=_0x3718f2||0x1f4;return function(_0x287fad){logger[_0xb5f1('0x2e')](_0x287fad[_0xb5f1('0x2f')]);if(_0x287fad[_0xb5f1('0x30')]){delete _0x287fad['name'];}_0x1fe360[_0xb5f1('0x1f')](_0x3718f2)[_0xb5f1('0x31')](_0x287fad);};}exports[_0xb5f1('0x32')]=function(_0x3f49c1,_0x56aabe){var _0x4869db={},_0xdfe0d6={},_0x1af549={'count':0x0,'rows':[]};var _0x3040d1=_[_0xb5f1('0x33')](db['UserWhatsappInteraction'][_0xb5f1('0x34')],function(_0x10d3ca){return{'name':_0x10d3ca['fieldName'],'type':_0x10d3ca[_0xb5f1('0x35')][_0xb5f1('0x36')]};});_0xdfe0d6[_0xb5f1('0x37')]=_[_0xb5f1('0x33')](_0x3040d1,'name');_0xdfe0d6['query']=_[_0xb5f1('0x38')](_0x3f49c1[_0xb5f1('0x39')]);_0xdfe0d6['filters']=_['intersection'](_0xdfe0d6[_0xb5f1('0x37')],_0xdfe0d6[_0xb5f1('0x39')]);_0x4869db[_0xb5f1('0x3a')]=_[_0xb5f1('0x3b')](_0xdfe0d6[_0xb5f1('0x37')],qs['fields'](_0x3f49c1[_0xb5f1('0x39')]['fields']));_0x4869db[_0xb5f1('0x3a')]=_0x4869db[_0xb5f1('0x3a')][_0xb5f1('0x3c')]?_0x4869db[_0xb5f1('0x3a')]:_0xdfe0d6[_0xb5f1('0x37')];if(!_0x3f49c1[_0xb5f1('0x39')][_0xb5f1('0x3d')](_0xb5f1('0x3e'))){_0x4869db[_0xb5f1('0x23')]=qs[_0xb5f1('0x23')](_0x3f49c1['query']['limit']);_0x4869db[_0xb5f1('0x22')]=qs[_0xb5f1('0x22')](_0x3f49c1[_0xb5f1('0x39')]['offset']);}_0x4869db[_0xb5f1('0x3f')]=qs[_0xb5f1('0x40')](_0x3f49c1[_0xb5f1('0x39')][_0xb5f1('0x40')]);_0x4869db[_0xb5f1('0x41')]=qs[_0xb5f1('0x42')](_[_0xb5f1('0x43')](_0x3f49c1['query'],_0xdfe0d6['filters']),_0x3040d1);if(_0x3f49c1['query'][_0xb5f1('0x44')]){_0x4869db[_0xb5f1('0x41')]=_[_0xb5f1('0x45')](_0x4869db[_0xb5f1('0x41')],{'$or':_[_0xb5f1('0x33')](_0x3040d1,function(_0x62a805){if(_0x62a805['type']!==_0xb5f1('0x46')){var _0x2e8a34={};_0x2e8a34[_0x62a805[_0xb5f1('0x30')]]={'$like':'%'+_0x3f49c1[_0xb5f1('0x39')]['filter']+'%'};return _0x2e8a34;}})});}_0x4869db=_[_0xb5f1('0x45')]({},_0x4869db,_0x3f49c1[_0xb5f1('0x47')]);var _0x43583f={'where':_0x4869db['where']};return db[_0xb5f1('0x48')]['count'](_0x43583f)[_0xb5f1('0x29')](function(_0x10710a){_0x1af549[_0xb5f1('0x21')]=_0x10710a;if(_0x3f49c1[_0xb5f1('0x39')][_0xb5f1('0x49')]){_0x4869db[_0xb5f1('0x4a')]=[{'all':!![]}];}return db[_0xb5f1('0x48')][_0xb5f1('0x4b')](_0x4869db);})[_0xb5f1('0x29')](function(_0x3fa6ed){_0x1af549[_0xb5f1('0x4c')]=_0x3fa6ed;return _0x1af549;})['then'](respondWithFilteredResult(_0x56aabe,_0x4869db))[_0xb5f1('0x4d')](handleError(_0x56aabe,null));};exports[_0xb5f1('0x4e')]=function(_0x13155e,_0x4ca2de){var _0x3aca69={'raw':!![],'where':{'id':_0x13155e['params']['id']}},_0x44c35b={};_0x44c35b[_0xb5f1('0x37')]=_[_0xb5f1('0x38')](db['UserWhatsappInteraction'][_0xb5f1('0x34')]);_0x44c35b[_0xb5f1('0x39')]=_[_0xb5f1('0x38')](_0x13155e[_0xb5f1('0x39')]);_0x44c35b[_0xb5f1('0x42')]=_['intersection'](_0x44c35b[_0xb5f1('0x37')],_0x44c35b['query']);_0x3aca69['attributes']=_['intersection'](_0x44c35b[_0xb5f1('0x37')],qs[_0xb5f1('0x4f')](_0x13155e[_0xb5f1('0x39')][_0xb5f1('0x4f')]));_0x3aca69['attributes']=_0x3aca69[_0xb5f1('0x3a')][_0xb5f1('0x3c')]?_0x3aca69[_0xb5f1('0x3a')]:_0x44c35b[_0xb5f1('0x37')];if(_0x13155e[_0xb5f1('0x39')][_0xb5f1('0x49')]){_0x3aca69[_0xb5f1('0x4a')]=[{'all':!![]}];}_0x3aca69=_[_0xb5f1('0x45')]({},_0x3aca69,_0x13155e[_0xb5f1('0x47')]);return db[_0xb5f1('0x48')]['find'](_0x3aca69)[_0xb5f1('0x29')](handleEntityNotFound(_0x4ca2de,null))[_0xb5f1('0x29')](respondWithResult(_0x4ca2de,null))['catch'](handleError(_0x4ca2de,null));};exports[_0xb5f1('0x50')]=function(_0x4c8014,_0x58c566){return db[_0xb5f1('0x48')][_0xb5f1('0x50')](_0x4c8014['body'],{})[_0xb5f1('0x29')](function(_0x3b348e){var _0x3d7bdc=_0x4c8014[_0xb5f1('0x51')]['get']({'plain':!![]});if(!_0x3d7bdc)throw new Error(_0xb5f1('0x52'));if(_0x3d7bdc['role']==='user'){var _0xb27b85=_0x3b348e[_0xb5f1('0x53')]({'plain':!![]});var _0x2fb6cd=_0xb5f1('0x2a');return db[_0xb5f1('0x54')][_0xb5f1('0x55')]({'where':{'name':_0x2fb6cd,'userProfileId':_0x3d7bdc[_0xb5f1('0x56')]},'raw':!![]})[_0xb5f1('0x29')](function(_0x6f9dde){if(_0x6f9dde&&_0x6f9dde[_0xb5f1('0x57')]===0x0){return db['UserProfileResource'][_0xb5f1('0x50')]({'name':_0xb27b85['name'],'resourceId':_0xb27b85['id'],'type':_0x6f9dde['name'],'sectionId':_0x6f9dde['id']},{})[_0xb5f1('0x29')](function(){return _0x3b348e;});}else{return _0x3b348e;}})[_0xb5f1('0x4d')](function(_0x352972){logger[_0xb5f1('0x2e')](_0xb5f1('0x58'),_0x352972);throw _0x352972;});}return _0x3b348e;})[_0xb5f1('0x29')](respondWithResult(_0x58c566,0xc9))[_0xb5f1('0x4d')](handleError(_0x58c566,null));};exports[_0xb5f1('0x28')]=function(_0x4dead3,_0x121151){if(_0x4dead3[_0xb5f1('0x59')]['id']){delete _0x4dead3[_0xb5f1('0x59')]['id'];}return db[_0xb5f1('0x48')]['find']({'where':{'id':_0x4dead3[_0xb5f1('0x5a')]['id']}})[_0xb5f1('0x29')](handleEntityNotFound(_0x121151,null))[_0xb5f1('0x29')](saveUpdates(_0x4dead3['body'],null))[_0xb5f1('0x29')](respondWithResult(_0x121151,null))[_0xb5f1('0x4d')](handleError(_0x121151,null));};exports[_0xb5f1('0x2c')]=function(_0x11db57,_0x120df0){return db[_0xb5f1('0x48')]['find']({'where':{'id':_0x11db57[_0xb5f1('0x5a')]['id']}})[_0xb5f1('0x29')](handleEntityNotFound(_0x120df0,null))['then'](removeEntity(_0x120df0,null))[_0xb5f1('0x4d')](handleError(_0x120df0,null));}; \ No newline at end of file +var _0x4c23=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','UserWhatsappInteraction','show','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf'];(function(_0x36c174,_0xa233ec){var _0x4ec6c3=function(_0x3359f6){while(--_0x3359f6){_0x36c174['push'](_0x36c174['shift']());}};_0x4ec6c3(++_0xa233ec);}(_0x4c23,0xef));var _0x34c2=function(_0x5665ef,_0x80100f){_0x5665ef=_0x5665ef-0x0;var _0x5b13f0=_0x4c23[_0x5665ef];return _0x5b13f0;};'use strict';var pdf=require(_0x34c2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x34c2('0x1'));var zipdir=require(_0x34c2('0x2'));var jsonpatch=require(_0x34c2('0x3'));var rp=require(_0x34c2('0x4'));var moment=require(_0x34c2('0x5'));var BPromise=require(_0x34c2('0x6'));var Mustache=require('mustache');var util=require(_0x34c2('0x7'));var path=require(_0x34c2('0x8'));var sox=require(_0x34c2('0x9'));var csv=require(_0x34c2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x34c2('0xb'));var squel=require(_0x34c2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x34c2('0xd'));var toCsv=require(_0x34c2('0xa'));var querystring=require('querystring');var Papa=require(_0x34c2('0xe'));var Redis=require(_0x34c2('0xf'));var authService=require(_0x34c2('0x10'));var qs=require(_0x34c2('0x11'));var as=require(_0x34c2('0x12'));var hardwareService=require(_0x34c2('0x13'));var logger=require(_0x34c2('0x14'))(_0x34c2('0x15'));var utils=require('../../config/utils');var config=require(_0x34c2('0x16'));var licenseUtil=require(_0x34c2('0x17'));var db=require(_0x34c2('0x18'))['db'];function respondWithStatusCode(_0x26fb50,_0x23c927){_0x23c927=_0x23c927||0xcc;return function(_0x2e6b29){if(_0x2e6b29){return _0x26fb50[_0x34c2('0x19')](_0x23c927);}return _0x26fb50[_0x34c2('0x1a')](_0x23c927)[_0x34c2('0x1b')]();};}function respondWithResult(_0x2529d5,_0x2e4ba2){_0x2e4ba2=_0x2e4ba2||0xc8;return function(_0x9161be){if(_0x9161be){return _0x2529d5[_0x34c2('0x1a')](_0x2e4ba2)['json'](_0x9161be);}};}function respondWithFilteredResult(_0x14c1f9,_0x49af1c){return function(_0x296600){if(_0x296600){var _0x488aaf=_0x296600[_0x34c2('0x1c')],_0x16901a=_0x49af1c[_0x34c2('0x1d')],_0x5b37cf=_0x49af1c['offset']+_0x49af1c[_0x34c2('0x1e')],_0x5e2fad;if(_0x5b37cf>=_0x488aaf){_0x5b37cf=_0x488aaf;_0x5e2fad=0xc8;}else{_0x5e2fad=0xce;}_0x14c1f9[_0x34c2('0x1a')](_0x5e2fad);return _0x14c1f9[_0x34c2('0x1f')](_0x34c2('0x20'),_0x16901a+'-'+_0x5b37cf+'/'+_0x488aaf)[_0x34c2('0x21')](_0x296600);}return null;};}function patchUpdates(_0x34ec96){return function(_0x2a9e07){try{jsonpatch[_0x34c2('0x22')](_0x2a9e07,_0x34ec96,!![]);}catch(_0xdbb703){return BPromise[_0x34c2('0x23')](_0xdbb703);}return _0x2a9e07['save']();};}function saveUpdates(_0x565e8f,_0x3b2573){return function(_0x5abf2a){if(_0x5abf2a){return _0x5abf2a[_0x34c2('0x24')](_0x565e8f)[_0x34c2('0x25')](function(_0x16d58f){return _0x16d58f;});}return null;};}function removeEntity(_0x3ecfa0,_0x5f076d){return function(_0x1a55e9){if(_0x1a55e9){return _0x1a55e9[_0x34c2('0x26')]()[_0x34c2('0x25')](function(){var _0x2e5803=_0x1a55e9['get']({'plain':!![]});var _0x2a1b4d='UserWhatsappInteractions';return db['UserProfileResource'][_0x34c2('0x26')]({'where':{'type':_0x2a1b4d,'resourceId':_0x2e5803['id']}})['then'](function(){return _0x1a55e9;});})[_0x34c2('0x25')](function(){_0x3ecfa0[_0x34c2('0x1a')](0xcc)[_0x34c2('0x1b')]();});}};}function handleEntityNotFound(_0x99a0b9,_0x19e7c1){return function(_0x4ce7ab){if(!_0x4ce7ab){_0x99a0b9[_0x34c2('0x19')](0x194);}return _0x4ce7ab;};}function handleError(_0x19883e,_0x254985){_0x254985=_0x254985||0x1f4;return function(_0x15cc2e){logger[_0x34c2('0x27')](_0x15cc2e['stack']);if(_0x15cc2e[_0x34c2('0x28')]){delete _0x15cc2e[_0x34c2('0x28')];}_0x19883e[_0x34c2('0x1a')](_0x254985)[_0x34c2('0x29')](_0x15cc2e);};}exports[_0x34c2('0x2a')]=function(_0x9eacba,_0x3df53b){var _0x475028={},_0x2d5adf={},_0x8cbe79={'count':0x0,'rows':[]};var _0x1a0d6c=_[_0x34c2('0x2b')](db['UserWhatsappInteraction'][_0x34c2('0x2c')],function(_0x59772b){return{'name':_0x59772b[_0x34c2('0x2d')],'type':_0x59772b[_0x34c2('0x2e')]['key']};});_0x2d5adf[_0x34c2('0x2f')]=_[_0x34c2('0x2b')](_0x1a0d6c,'name');_0x2d5adf[_0x34c2('0x30')]=_[_0x34c2('0x31')](_0x9eacba[_0x34c2('0x30')]);_0x2d5adf[_0x34c2('0x32')]=_[_0x34c2('0x33')](_0x2d5adf[_0x34c2('0x2f')],_0x2d5adf[_0x34c2('0x30')]);_0x475028[_0x34c2('0x34')]=_[_0x34c2('0x33')](_0x2d5adf[_0x34c2('0x2f')],qs[_0x34c2('0x35')](_0x9eacba[_0x34c2('0x30')][_0x34c2('0x35')]));_0x475028['attributes']=_0x475028[_0x34c2('0x34')][_0x34c2('0x36')]?_0x475028[_0x34c2('0x34')]:_0x2d5adf[_0x34c2('0x2f')];if(!_0x9eacba['query']['hasOwnProperty'](_0x34c2('0x37'))){_0x475028[_0x34c2('0x1e')]=qs[_0x34c2('0x1e')](_0x9eacba['query']['limit']);_0x475028[_0x34c2('0x1d')]=qs['offset'](_0x9eacba[_0x34c2('0x30')]['offset']);}_0x475028[_0x34c2('0x38')]=qs['sort'](_0x9eacba[_0x34c2('0x30')][_0x34c2('0x39')]);_0x475028[_0x34c2('0x3a')]=qs['filters'](_[_0x34c2('0x3b')](_0x9eacba[_0x34c2('0x30')],_0x2d5adf[_0x34c2('0x32')]),_0x1a0d6c);if(_0x9eacba['query'][_0x34c2('0x3c')]){_0x475028[_0x34c2('0x3a')]=_[_0x34c2('0x3d')](_0x475028[_0x34c2('0x3a')],{'$or':_[_0x34c2('0x2b')](_0x1a0d6c,function(_0x186597){if(_0x186597[_0x34c2('0x2e')]!==_0x34c2('0x3e')){var _0x259e90={};_0x259e90[_0x186597[_0x34c2('0x28')]]={'$like':'%'+_0x9eacba[_0x34c2('0x30')]['filter']+'%'};return _0x259e90;}})});}_0x475028=_['merge']({},_0x475028,_0x9eacba[_0x34c2('0x3f')]);var _0x2b1d62={'where':_0x475028[_0x34c2('0x3a')]};return db['UserWhatsappInteraction']['count'](_0x2b1d62)[_0x34c2('0x25')](function(_0x3aa699){_0x8cbe79[_0x34c2('0x1c')]=_0x3aa699;if(_0x9eacba[_0x34c2('0x30')][_0x34c2('0x40')]){_0x475028[_0x34c2('0x41')]=[{'all':!![]}];}return db[_0x34c2('0x42')]['findAll'](_0x475028);})[_0x34c2('0x25')](function(_0x28c529){_0x8cbe79['rows']=_0x28c529;return _0x8cbe79;})[_0x34c2('0x25')](respondWithFilteredResult(_0x3df53b,_0x475028))['catch'](handleError(_0x3df53b,null));};exports[_0x34c2('0x43')]=function(_0x4743ee,_0xd932cb){var _0x24526a={'raw':!![],'where':{'id':_0x4743ee[_0x34c2('0x44')]['id']}},_0x1c55f9={};_0x1c55f9[_0x34c2('0x2f')]=_['keys'](db[_0x34c2('0x42')][_0x34c2('0x2c')]);_0x1c55f9[_0x34c2('0x30')]=_[_0x34c2('0x31')](_0x4743ee[_0x34c2('0x30')]);_0x1c55f9['filters']=_[_0x34c2('0x33')](_0x1c55f9[_0x34c2('0x2f')],_0x1c55f9[_0x34c2('0x30')]);_0x24526a[_0x34c2('0x34')]=_[_0x34c2('0x33')](_0x1c55f9[_0x34c2('0x2f')],qs[_0x34c2('0x35')](_0x4743ee['query'][_0x34c2('0x35')]));_0x24526a[_0x34c2('0x34')]=_0x24526a[_0x34c2('0x34')]['length']?_0x24526a['attributes']:_0x1c55f9['model'];if(_0x4743ee[_0x34c2('0x30')][_0x34c2('0x40')]){_0x24526a[_0x34c2('0x41')]=[{'all':!![]}];}_0x24526a=_[_0x34c2('0x3d')]({},_0x24526a,_0x4743ee[_0x34c2('0x3f')]);return db[_0x34c2('0x42')][_0x34c2('0x45')](_0x24526a)[_0x34c2('0x25')](handleEntityNotFound(_0xd932cb,null))[_0x34c2('0x25')](respondWithResult(_0xd932cb,null))[_0x34c2('0x46')](handleError(_0xd932cb,null));};exports[_0x34c2('0x47')]=function(_0x1e592d,_0x2071cc){return db[_0x34c2('0x42')][_0x34c2('0x47')](_0x1e592d['body'],{})['then'](function(_0x430e15){var _0x4e0048=_0x1e592d[_0x34c2('0x48')][_0x34c2('0x49')]({'plain':!![]});if(!_0x4e0048)throw new Error(_0x34c2('0x4a'));if(_0x4e0048[_0x34c2('0x4b')]===_0x34c2('0x48')){var _0x4bd769=_0x430e15[_0x34c2('0x49')]({'plain':!![]});var _0x4468b4='UserWhatsappInteractions';return db['UserProfileSection']['find']({'where':{'name':_0x4468b4,'userProfileId':_0x4e0048['userProfileId']},'raw':!![]})['then'](function(_0x57eb8e){if(_0x57eb8e&&_0x57eb8e[_0x34c2('0x4c')]===0x0){return db[_0x34c2('0x4d')][_0x34c2('0x47')]({'name':_0x4bd769[_0x34c2('0x28')],'resourceId':_0x4bd769['id'],'type':_0x57eb8e['name'],'sectionId':_0x57eb8e['id']},{})[_0x34c2('0x25')](function(){return _0x430e15;});}else{return _0x430e15;}})[_0x34c2('0x46')](function(_0x8350e6){logger[_0x34c2('0x27')](_0x34c2('0x4e'),_0x8350e6);throw _0x8350e6;});}return _0x430e15;})[_0x34c2('0x25')](respondWithResult(_0x2071cc,0xc9))[_0x34c2('0x46')](handleError(_0x2071cc,null));};exports[_0x34c2('0x24')]=function(_0x2b7b0d,_0x27056e){if(_0x2b7b0d['body']['id']){delete _0x2b7b0d[_0x34c2('0x4f')]['id'];}return db[_0x34c2('0x42')]['find']({'where':{'id':_0x2b7b0d['params']['id']}})['then'](handleEntityNotFound(_0x27056e,null))[_0x34c2('0x25')](saveUpdates(_0x2b7b0d['body'],null))[_0x34c2('0x25')](respondWithResult(_0x27056e,null))[_0x34c2('0x46')](handleError(_0x27056e,null));};exports[_0x34c2('0x26')]=function(_0x559408,_0x1c3c6e){return db['UserWhatsappInteraction']['find']({'where':{'id':_0x559408['params']['id']}})['then'](handleEntityNotFound(_0x1c3c6e,null))[_0x34c2('0x25')](removeEntity(_0x1c3c6e,null))[_0x34c2('0x46')](handleError(_0x1c3c6e,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index 465065d..cadd40e 100644 --- a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js +++ b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd70=['../../config/environment','./UserWhatsappInteraction.attributes','exports','define','UserWhatsappInteraction','user_has_whatsapp_interactions','lodash','util','api','moment','path','rimraf'];(function(_0x113c39,_0x4ffc0d){var _0x5c6a32=function(_0x379020){while(--_0x379020){_0x113c39['push'](_0x113c39['shift']());}};_0x5c6a32(++_0x4ffc0d);}(_0xbd70,0x72));var _0x0bd7=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xbd70[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x0bd7('0x0'));var util=require(_0x0bd7('0x1'));var logger=require('../../config/logger')(_0x0bd7('0x2'));var moment=require(_0x0bd7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bd7('0x4'));var rimraf=require(_0x0bd7('0x5'));var config=require(_0x0bd7('0x6'));var attributes=require(_0x0bd7('0x7'));module[_0x0bd7('0x8')]=function(_0xf9619a,_0x1f8caa){return _0xf9619a[_0x0bd7('0x9')](_0x0bd7('0xa'),attributes,{'tableName':_0x0bd7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f05=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports','define','UserWhatsappInteraction','lodash','util','../../config/logger','api'];(function(_0x4276ab,_0x4cd191){var _0x5417c2=function(_0xfead6d){while(--_0xfead6d){_0x4276ab['push'](_0x4276ab['shift']());}};_0x5417c2(++_0x4cd191);}(_0x5f05,0x1bc));var _0x55f0=function(_0x5e0cb4,_0x433832){_0x5e0cb4=_0x5e0cb4-0x0;var _0x547c2a=_0x5f05[_0x5e0cb4];return _0x547c2a;};'use strict';var _=require(_0x55f0('0x0'));var util=require(_0x55f0('0x1'));var logger=require(_0x55f0('0x2'))(_0x55f0('0x3'));var moment=require(_0x55f0('0x4'));var BPromise=require(_0x55f0('0x5'));var rp=require(_0x55f0('0x6'));var fs=require('fs');var path=require(_0x55f0('0x7'));var rimraf=require(_0x55f0('0x8'));var config=require(_0x55f0('0x9'));var attributes=require(_0x55f0('0xa'));module[_0x55f0('0xb')]=function(_0x14919e,_0x51481c){return _0x14919e[_0x55f0('0xc')](_0x55f0('0xd'),attributes,{'tableName':'user_has_whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js index fb1076a..f79120a 100644 --- a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js +++ b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78ba=['http','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x78ba,0x1db));var _0xa78b=function(_0x3bbf9d,_0x3b9798){_0x3bbf9d=_0x3bbf9d-0x0;var _0x205c8e=_0x78ba[_0x3bbf9d];return _0x205c8e;};'use strict';var _=require(_0xa78b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa78b('0x1'));var db=require(_0xa78b('0x2'))['db'];var utils=require(_0xa78b('0x3'));var logger=require(_0xa78b('0x4'))(_0xa78b('0x5'));var config=require(_0xa78b('0x6'));var jayson=require(_0xa78b('0x7'));var client=jayson['client'][_0xa78b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9ecd7d,_0x9c8416,_0x4653c0){return new BPromise(function(_0x2fc63c,_0x5c2a7b){return client[_0xa78b('0x9')](_0x9ecd7d,_0x4653c0)[_0xa78b('0xa')](function(_0x4cd033){logger[_0xa78b('0xb')](_0xa78b('0xc'),_0x9c8416,_0xa78b('0xd'));logger[_0xa78b('0xe')](_0xa78b('0xf'),_0x9c8416,_0xa78b('0xd'),JSON['stringify'](_0x4cd033));if(_0x4cd033[_0xa78b('0x10')]){if(_0x4cd033[_0xa78b('0x10')][_0xa78b('0x11')]===0x1f4){logger[_0xa78b('0x10')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x9c8416,_0x4cd033[_0xa78b('0x10')]['message']);return _0x5c2a7b(_0x4cd033[_0xa78b('0x10')][_0xa78b('0x12')]);}logger['error'](_0xa78b('0xc'),_0x9c8416,_0x4cd033[_0xa78b('0x10')][_0xa78b('0x12')]);return _0x2fc63c(_0x4cd033[_0xa78b('0x10')]['message']);}else{logger['info']('UserWhatsappInteraction,\x20%s,\x20%s',_0x9c8416,_0xa78b('0xd'));_0x2fc63c(_0x4cd033[_0xa78b('0x13')][_0xa78b('0x12')]);}})[_0xa78b('0x14')](function(_0x475ae0){logger[_0xa78b('0x10')](_0xa78b('0xc'),_0x9c8416,_0x475ae0);_0x5c2a7b(_0x475ae0);});});} \ No newline at end of file +var _0x55a5=['info','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x2fb7a6,_0x185f4e){var _0x42e812=function(_0x5d30db){while(--_0x5d30db){_0x2fb7a6['push'](_0x2fb7a6['shift']());}};_0x42e812(++_0x185f4e);}(_0x55a5,0x16b));var _0x555a=function(_0x349b5c,_0x55e5fa){_0x349b5c=_0x349b5c-0x0;var _0x3efcac=_0x55a5[_0x349b5c];return _0x3efcac;};'use strict';var _=require(_0x555a('0x0'));var util=require('util');var moment=require(_0x555a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x555a('0x2'));var db=require(_0x555a('0x3'))['db'];var utils=require(_0x555a('0x4'));var logger=require(_0x555a('0x5'))('rpc');var config=require(_0x555a('0x6'));var jayson=require(_0x555a('0x7'));var client=jayson[_0x555a('0x8')][_0x555a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x214ffb,_0x49a78a,_0x34e96e){return new BPromise(function(_0x25e75a,_0x41b26d){return client['request'](_0x214ffb,_0x34e96e)[_0x555a('0xa')](function(_0x437eae){logger[_0x555a('0xb')](_0x555a('0xc'),_0x49a78a,_0x555a('0xd'));logger[_0x555a('0xe')](_0x555a('0xf'),_0x49a78a,_0x555a('0xd'),JSON[_0x555a('0x10')](_0x437eae));if(_0x437eae[_0x555a('0x11')]){if(_0x437eae[_0x555a('0x11')][_0x555a('0x12')]===0x1f4){logger[_0x555a('0x11')](_0x555a('0xc'),_0x49a78a,_0x437eae[_0x555a('0x11')][_0x555a('0x13')]);return _0x41b26d(_0x437eae[_0x555a('0x11')][_0x555a('0x13')]);}logger[_0x555a('0x11')](_0x555a('0xc'),_0x49a78a,_0x437eae['error'][_0x555a('0x13')]);return _0x25e75a(_0x437eae[_0x555a('0x11')][_0x555a('0x13')]);}else{logger['info'](_0x555a('0xc'),_0x49a78a,_0x555a('0xd'));_0x25e75a(_0x437eae[_0x555a('0x14')]['message']);}})[_0x555a('0x15')](function(_0x4e6c31){logger[_0x555a('0x11')](_0x555a('0xc'),_0x49a78a,_0x4e6c31);_0x41b26d(_0x4e6c31);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index b102965..0172ff3 100644 --- a/server/api/UserWhatsappInteraction/index.js +++ b/server/api/UserWhatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80df=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserWhatsappInteraction.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x2f2903,_0x17f78f){var _0x5ca101=function(_0x14e54d){while(--_0x14e54d){_0x2f2903['push'](_0x2f2903['shift']());}};_0x5ca101(++_0x17f78f);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var path=require(_0xf80d('0x2'));var timeout=require(_0xf80d('0x3'));var express=require('express');var router=express[_0xf80d('0x4')]();var auth=require(_0xf80d('0x5'));var interaction=require(_0xf80d('0x6'));var config=require(_0xf80d('0x7'));var controller=require(_0xf80d('0x8'));router[_0xf80d('0x9')]('/',auth[_0xf80d('0xa')](),controller[_0xf80d('0xb')]);router[_0xf80d('0x9')](_0xf80d('0xc'),auth['isAuthenticated'](),controller[_0xf80d('0xd')]);router[_0xf80d('0xe')]('/',auth[_0xf80d('0xa')](),controller[_0xf80d('0xf')]);router[_0xf80d('0x10')](_0xf80d('0xc'),auth[_0xf80d('0xa')](),controller[_0xf80d('0x11')]);router[_0xf80d('0x12')](_0xf80d('0xc'),auth[_0xf80d('0xa')](),controller[_0xf80d('0x13')]);module[_0xf80d('0x14')]=router; \ No newline at end of file +var _0xdfe9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./UserWhatsappInteraction.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','Router'];(function(_0x5de944,_0x3d7621){var _0x24ce5a=function(_0x7cdd83){while(--_0x7cdd83){_0x5de944['push'](_0x5de944['shift']());}};_0x24ce5a(++_0x3d7621);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x260edf,_0x2a3230){_0x260edf=_0x260edf-0x0;var _0x4f2438=_0xdfe9[_0x260edf];return _0x4f2438;};'use strict';var multer=require(_0x9dfe('0x0'));var util=require('util');var path=require(_0x9dfe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9dfe('0x2')]();var auth=require(_0x9dfe('0x3'));var interaction=require(_0x9dfe('0x4'));var config=require(_0x9dfe('0x5'));var controller=require(_0x9dfe('0x6'));router[_0x9dfe('0x7')]('/',auth[_0x9dfe('0x8')](),controller[_0x9dfe('0x9')]);router[_0x9dfe('0x7')](_0x9dfe('0xa'),auth[_0x9dfe('0x8')](),controller['show']);router[_0x9dfe('0xb')]('/',auth[_0x9dfe('0x8')](),controller[_0x9dfe('0xc')]);router[_0x9dfe('0xd')](_0x9dfe('0xa'),auth[_0x9dfe('0x8')](),controller[_0x9dfe('0xe')]);router[_0x9dfe('0xf')]('/:id',auth[_0x9dfe('0x8')](),controller[_0x9dfe('0x10')]);module[_0x9dfe('0x11')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 16c18e4..3a41618 100644 --- a/server/api/action/action.attributes.js +++ b/server/api/action/action.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9217=['STRING','contactManager','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','VIRTUAL','getDataValue','action'];(function(_0xf48a95,_0x392322){var _0x125d23=function(_0xd7e992){while(--_0xd7e992){_0xf48a95['push'](_0xf48a95['shift']());}};_0x125d23(++_0x392322);}(_0x9217,0x91));var _0x7921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9217[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7921('0x0'));module[_0x7921('0x1')]={'name':{'type':Sequelize[_0x7921('0x2')],'get':function(_0x19a9ba){return this[_0x7921('0x3')](_0x7921('0x4'));}},'action':{'type':Sequelize[_0x7921('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7921('0x6'),'integration',_0x7921('0x7'),_0x7921('0x8'),'urlForward',_0x7921('0x9'),_0x7921('0xa'),_0x7921('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x7921('0xc')},'data1':{'type':Sequelize[_0x7921('0x5')](0x1000),'comment':_0x7921('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x7921('0x5')](0x1000),'comment':_0x7921('0xe')},'data4':{'type':Sequelize[_0x7921('0x5')](0x1000)},'data5':{'type':Sequelize[_0x7921('0x5')](0x1000)},'data6':{'type':Sequelize[_0x7921('0x5')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa510=['action','STRING','contactManager','integration','motionbar','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xa510,0x6a));var _0x0a51=function(_0x29a5b6,_0x2d81a9){_0x29a5b6=_0x29a5b6-0x0;var _0x592375=_0xa510[_0x29a5b6];return _0x592375;};'use strict';var Sequelize=require(_0x0a51('0x0'));module[_0x0a51('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x238d84){return this['getDataValue'](_0x0a51('0x2'));}},'action':{'type':Sequelize[_0x0a51('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0a51('0x4'),_0x0a51('0x5'),_0x0a51('0x6'),'jscripty',_0x0a51('0x7'),_0x0a51('0x8'),'bot',_0x0a51('0x9')]],'msg':_0x0a51('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x0a51('0x3')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x0a51('0x3')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x0a51('0x3')](0x1000),'comment':_0x0a51('0xb')},'data4':{'type':Sequelize[_0x0a51('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index d49f4da..4e8e86d 100644 --- a/server/api/action/action.controller.js +++ b/server/api/action/action.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7eff=['stack','name','send','update','body','Action','find','params','destroy','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','error'];(function(_0x24653f,_0x1043b7){var _0x26b3f6=function(_0x46e335){while(--_0x46e335){_0x24653f['push'](_0x24653f['shift']());}};_0x26b3f6(++_0x1043b7);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf7ef('0x0'));var rimraf=require(_0xf7ef('0x1'));var zipdir=require(_0xf7ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7ef('0x3'));var moment=require(_0xf7ef('0x4'));var BPromise=require(_0xf7ef('0x5'));var Mustache=require(_0xf7ef('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf7ef('0x7'));var csv=require(_0xf7ef('0x8'));var ejs=require(_0xf7ef('0x9'));var fs=require('fs');var _=require(_0xf7ef('0xa'));var squel=require(_0xf7ef('0xb'));var crypto=require(_0xf7ef('0xc'));var jsforce=require(_0xf7ef('0xd'));var deskjs=require(_0xf7ef('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf7ef('0xf'));var Papa=require(_0xf7ef('0x10'));var Redis=require('ioredis');var authService=require(_0xf7ef('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7ef('0x12'));var logger=require('../../config/logger')(_0xf7ef('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf7ef('0x14'))['db'];function respondWithStatusCode(_0x4e45fd,_0x5e6a8e){_0x5e6a8e=_0x5e6a8e||0xcc;return function(_0x56b5d7){if(_0x56b5d7){return _0x4e45fd[_0xf7ef('0x15')](_0x5e6a8e);}return _0x4e45fd[_0xf7ef('0x16')](_0x5e6a8e)[_0xf7ef('0x17')]();};}function respondWithResult(_0xf6e5a0,_0x5d5112){_0x5d5112=_0x5d5112||0xc8;return function(_0x27a4a7){if(_0x27a4a7){return _0xf6e5a0['status'](_0x5d5112)[_0xf7ef('0x18')](_0x27a4a7);}};}function respondWithFilteredResult(_0x35746b,_0x4996b7){return function(_0x39ef6f){if(_0x39ef6f){var _0x4856bd=_0x39ef6f[_0xf7ef('0x19')],_0x148942=_0x4996b7[_0xf7ef('0x1a')],_0x16a102=_0x4996b7[_0xf7ef('0x1a')]+_0x4996b7[_0xf7ef('0x1b')],_0x1695c1;if(_0x16a102>=_0x4856bd){_0x16a102=_0x4856bd;_0x1695c1=0xc8;}else{_0x1695c1=0xce;}_0x35746b['status'](_0x1695c1);return _0x35746b['set']('Content-Range',_0x148942+'-'+_0x16a102+'/'+_0x4856bd)[_0xf7ef('0x18')](_0x39ef6f);}return null;};}function patchUpdates(_0x515e54){return function(_0x371688){try{jsonpatch[_0xf7ef('0x1c')](_0x371688,_0x515e54,!![]);}catch(_0x1011a4){return BPromise[_0xf7ef('0x1d')](_0x1011a4);}return _0x371688[_0xf7ef('0x1e')]();};}function saveUpdates(_0x29cbf1,_0x4d1cf0){return function(_0x49e49a){if(_0x49e49a){return _0x49e49a['update'](_0x29cbf1)[_0xf7ef('0x1f')](function(_0x247e92){return _0x247e92;});}return null;};}function removeEntity(_0x1a95c6,_0x20c27b){return function(_0x5d70f5){if(_0x5d70f5){return _0x5d70f5['destroy']()[_0xf7ef('0x1f')](function(){_0x1a95c6[_0xf7ef('0x16')](0xcc)[_0xf7ef('0x17')]();});}};}function handleEntityNotFound(_0x168da4,_0x39e820){return function(_0x1ee788){if(!_0x1ee788){_0x168da4['sendStatus'](0x194);}return _0x1ee788;};}function handleError(_0xeb86b3,_0x45ac79){_0x45ac79=_0x45ac79||0x1f4;return function(_0x47c243){logger[_0xf7ef('0x20')](_0x47c243[_0xf7ef('0x21')]);if(_0x47c243[_0xf7ef('0x22')]){delete _0x47c243[_0xf7ef('0x22')];}_0xeb86b3[_0xf7ef('0x16')](_0x45ac79)[_0xf7ef('0x23')](_0x47c243);};}exports[_0xf7ef('0x24')]=function(_0x31db15,_0x2c69e4){if(_0x31db15['body']['id']){delete _0x31db15[_0xf7ef('0x25')]['id'];}return db[_0xf7ef('0x26')][_0xf7ef('0x27')]({'where':{'id':_0x31db15[_0xf7ef('0x28')]['id']}})['then'](handleEntityNotFound(_0x2c69e4,null))[_0xf7ef('0x1f')](saveUpdates(_0x31db15[_0xf7ef('0x25')],null))[_0xf7ef('0x1f')](respondWithResult(_0x2c69e4,null))['catch'](handleError(_0x2c69e4,null));};exports[_0xf7ef('0x29')]=function(_0x4eda42,_0xf8dba7){return db[_0xf7ef('0x26')][_0xf7ef('0x27')]({'where':{'id':_0x4eda42[_0xf7ef('0x28')]['id']}})['then'](handleEntityNotFound(_0xf8dba7,null))[_0xf7ef('0x1f')](removeEntity(_0xf8dba7,null))[_0xf7ef('0x2a')](handleError(_0xf8dba7,null));}; \ No newline at end of file +var _0xb091=['set','Content-Range','save','update','then','destroy','error','stack','name','send','body','Action','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x3d642f,_0x141b14){var _0x3a52b2=function(_0x430743){while(--_0x430743){_0x3d642f['push'](_0x3d642f['shift']());}};_0x3a52b2(++_0x141b14);}(_0xb091,0x16e));var _0x1b09=function(_0x7f4d6,_0x47ccaa){_0x7f4d6=_0x7f4d6-0x0;var _0x2f8e2f=_0xb091[_0x7f4d6];return _0x2f8e2f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b09('0x0'));var rimraf=require(_0x1b09('0x1'));var zipdir=require(_0x1b09('0x2'));var jsonpatch=require(_0x1b09('0x3'));var rp=require('request-promise');var moment=require(_0x1b09('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b09('0x5'));var path=require(_0x1b09('0x6'));var sox=require('sox');var csv=require(_0x1b09('0x7'));var ejs=require(_0x1b09('0x8'));var fs=require('fs');var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0x7'));var querystring=require(_0x1b09('0xd'));var Papa=require(_0x1b09('0xe'));var Redis=require(_0x1b09('0xf'));var authService=require(_0x1b09('0x10'));var qs=require(_0x1b09('0x11'));var as=require(_0x1b09('0x12'));var hardwareService=require(_0x1b09('0x13'));var logger=require('../../config/logger')(_0x1b09('0x14'));var utils=require(_0x1b09('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x16'))['db'];function respondWithStatusCode(_0x4284ad,_0x3ae4a0){_0x3ae4a0=_0x3ae4a0||0xcc;return function(_0x1046f8){if(_0x1046f8){return _0x4284ad[_0x1b09('0x17')](_0x3ae4a0);}return _0x4284ad[_0x1b09('0x18')](_0x3ae4a0)[_0x1b09('0x19')]();};}function respondWithResult(_0x58392d,_0x37fdb2){_0x37fdb2=_0x37fdb2||0xc8;return function(_0x515ade){if(_0x515ade){return _0x58392d[_0x1b09('0x18')](_0x37fdb2)[_0x1b09('0x1a')](_0x515ade);}};}function respondWithFilteredResult(_0x11ab46,_0x37673e){return function(_0x10b7eb){if(_0x10b7eb){var _0x1dc96b=_0x10b7eb[_0x1b09('0x1b')],_0x64689a=_0x37673e[_0x1b09('0x1c')],_0x33129b=_0x37673e[_0x1b09('0x1c')]+_0x37673e[_0x1b09('0x1d')],_0x1196b2;if(_0x33129b>=_0x1dc96b){_0x33129b=_0x1dc96b;_0x1196b2=0xc8;}else{_0x1196b2=0xce;}_0x11ab46['status'](_0x1196b2);return _0x11ab46[_0x1b09('0x1e')](_0x1b09('0x1f'),_0x64689a+'-'+_0x33129b+'/'+_0x1dc96b)['json'](_0x10b7eb);}return null;};}function patchUpdates(_0x5cf855){return function(_0xe93ac4){try{jsonpatch['apply'](_0xe93ac4,_0x5cf855,!![]);}catch(_0x267b5e){return BPromise['reject'](_0x267b5e);}return _0xe93ac4[_0x1b09('0x20')]();};}function saveUpdates(_0x4b2eab,_0x2d6dba){return function(_0x1e8f97){if(_0x1e8f97){return _0x1e8f97[_0x1b09('0x21')](_0x4b2eab)[_0x1b09('0x22')](function(_0x363e78){return _0x363e78;});}return null;};}function removeEntity(_0x39e569,_0x48b803){return function(_0x5e2806){if(_0x5e2806){return _0x5e2806[_0x1b09('0x23')]()[_0x1b09('0x22')](function(){_0x39e569['status'](0xcc)[_0x1b09('0x19')]();});}};}function handleEntityNotFound(_0x11d0d5,_0x6e132c){return function(_0xb22064){if(!_0xb22064){_0x11d0d5['sendStatus'](0x194);}return _0xb22064;};}function handleError(_0xe0d931,_0x15be49){_0x15be49=_0x15be49||0x1f4;return function(_0x4936d0){logger[_0x1b09('0x24')](_0x4936d0[_0x1b09('0x25')]);if(_0x4936d0['name']){delete _0x4936d0[_0x1b09('0x26')];}_0xe0d931[_0x1b09('0x18')](_0x15be49)[_0x1b09('0x27')](_0x4936d0);};}exports[_0x1b09('0x21')]=function(_0x547fbb,_0xb3cf07){if(_0x547fbb[_0x1b09('0x28')]['id']){delete _0x547fbb['body']['id'];}return db[_0x1b09('0x29')][_0x1b09('0x2a')]({'where':{'id':_0x547fbb[_0x1b09('0x2b')]['id']}})[_0x1b09('0x22')](handleEntityNotFound(_0xb3cf07,null))[_0x1b09('0x22')](saveUpdates(_0x547fbb[_0x1b09('0x28')],null))[_0x1b09('0x22')](respondWithResult(_0xb3cf07,null))['catch'](handleError(_0xb3cf07,null));};exports[_0x1b09('0x23')]=function(_0x3e6a4d,_0x4bf0ad){return db[_0x1b09('0x29')][_0x1b09('0x2a')]({'where':{'id':_0x3e6a4d[_0x1b09('0x2b')]['id']}})[_0x1b09('0x22')](handleEntityNotFound(_0x4bf0ad,null))[_0x1b09('0x22')](removeEntity(_0x4bf0ad,null))['catch'](handleError(_0x4bf0ad,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 97e0ba5..690e1a5 100644 --- a/server/api/action/action.model.js +++ b/server/api/action/action.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e02=['./action.attributes','define','Action','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xb824a4,_0x1399b5){var _0x8cb75b=function(_0x21a061){while(--_0x21a061){_0xb824a4['push'](_0xb824a4['shift']());}};_0x8cb75b(++_0x1399b5);}(_0x3e02,0x179));var _0x23e0=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x3e02[_0x1551af];return _0xd8eb82;};'use strict';var _=require(_0x23e0('0x0'));var util=require('util');var logger=require(_0x23e0('0x1'))(_0x23e0('0x2'));var moment=require(_0x23e0('0x3'));var BPromise=require(_0x23e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23e0('0x5'));var rimraf=require(_0x23e0('0x6'));var config=require(_0x23e0('0x7'));var attributes=require(_0x23e0('0x8'));module['exports']=function(_0x5a6cab,_0x11436c){return _0x5a6cab[_0x23e0('0x9')](_0x23e0('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c56=['rimraf','../../config/environment','./action.attributes','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x387a94,_0x80a6a6){var _0x127502=function(_0x1f5a24){while(--_0x1f5a24){_0x387a94['push'](_0x387a94['shift']());}};_0x127502(++_0x80a6a6);}(_0x9c56,0x1e3));var _0x69c5=function(_0x44e016,_0x2a4ac3){_0x44e016=_0x44e016-0x0;var _0x5bc0a0=_0x9c56[_0x44e016];return _0x5bc0a0;};'use strict';var _=require(_0x69c5('0x0'));var util=require(_0x69c5('0x1'));var logger=require('../../config/logger')(_0x69c5('0x2'));var moment=require(_0x69c5('0x3'));var BPromise=require(_0x69c5('0x4'));var rp=require(_0x69c5('0x5'));var fs=require('fs');var path=require(_0x69c5('0x6'));var rimraf=require(_0x69c5('0x7'));var config=require(_0x69c5('0x8'));var attributes=require(_0x69c5('0x9'));module['exports']=function(_0x4ad12a,_0xeff164){return _0x4ad12a['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 31da3a9..63fe47b 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x47e8a9,_0x2dd75d){var _0x2eead4=function(_0x51b2fd){while(--_0x51b2fd){_0x47e8a9['push'](_0x47e8a9['shift']());}};_0x2eead4(++_0x2dd75d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 5946d33..0641248 100644 --- a/server/api/action/index.js +++ b/server/api/action/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eac=['../../config/environment','./action.controller','put','update','delete','/:id','destroy','exports','multer','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5e9db2,_0x3b1a63){var _0x3d3590=function(_0x39f7d7){while(--_0x39f7d7){_0x5e9db2['push'](_0x5e9db2['shift']());}};_0x3d3590(++_0x3b1a63);}(_0x3eac,0x98));var _0xc3ea=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x3eac[_0x1ac6ec];return _0x48a489;};'use strict';var multer=require(_0xc3ea('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3ea('0x1'));var router=express['Router']();var auth=require(_0xc3ea('0x2'));var interaction=require(_0xc3ea('0x3'));var config=require(_0xc3ea('0x4'));var controller=require(_0xc3ea('0x5'));router[_0xc3ea('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xc3ea('0x7')]);router[_0xc3ea('0x8')](_0xc3ea('0x9'),auth['isAuthenticated'](),controller[_0xc3ea('0xa')]);module[_0xc3ea('0xb')]=router; \ No newline at end of file +var _0x283b=['/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update'];(function(_0x418f13,_0x4b40fe){var _0x4ee5cc=function(_0x2006b3){while(--_0x2006b3){_0x418f13['push'](_0x418f13['shift']());}};_0x4ee5cc(++_0x4b40fe);}(_0x283b,0xb9));var _0xb283=function(_0x4a40ce,_0x396eba){_0x4a40ce=_0x4a40ce-0x0;var _0x1919f0=_0x283b[_0x4a40ce];return _0x1919f0;};'use strict';var multer=require(_0xb283('0x0'));var util=require(_0xb283('0x1'));var path=require('path');var timeout=require(_0xb283('0x2'));var express=require(_0xb283('0x3'));var router=express[_0xb283('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb283('0x5'));var config=require(_0xb283('0x6'));var controller=require(_0xb283('0x7'));router[_0xb283('0x8')]('/:id',auth[_0xb283('0x9')](),controller[_0xb283('0xa')]);router['delete'](_0xb283('0xb'),auth[_0xb283('0x9')](),controller[_0xb283('0xc')]);module[_0xb283('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 89b15d5..9224e36 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc42c=['STRING','TEXT','sequelize','exports'];(function(_0x364d9d,_0xad17d4){var _0x4755bf=function(_0x360526){while(--_0x360526){_0x364d9d['push'](_0x364d9d['shift']());}};_0x4755bf(++_0xad17d4);}(_0xc42c,0x1ce));var _0xcc42=function(_0x1f7afb,_0x37ec35){_0x1f7afb=_0x1f7afb-0x0;var _0x4554a2=_0xc42c[_0x1f7afb];return _0x4554a2;};'use strict';var Sequelize=require(_0xcc42('0x0'));module[_0xcc42('0x1')]={'name':{'type':Sequelize[_0xcc42('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcc42('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xcc42('0x3')]},'joins':{'type':Sequelize[_0xcc42('0x3')]}}; \ No newline at end of file +var _0xe375=['sequelize','STRING','TEXT'];(function(_0x5b1636,_0x560a6e){var _0x2982d8=function(_0x303a5b){while(--_0x303a5b){_0x5b1636['push'](_0x5b1636['shift']());}};_0x2982d8(++_0x560a6e);}(_0xe375,0x8a));var _0x5e37=function(_0x44036f,_0x367150){_0x44036f=_0x44036f-0x0;var _0x55a334=_0xe375[_0x44036f];return _0x55a334;};'use strict';var Sequelize=require(_0x5e37('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e37('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5e37('0x1')]},'table':{'type':Sequelize[_0x5e37('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5e37('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 552c634..a6e479b 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.controller.js +++ b/server/api/analyticCustomReport/analyticCustomReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x717f=['conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','SELECT','GROUP_CONCAT(%s)','DATE(%s)','ROUND(%s)','IS\x20NOT\x20EMPTY','getFields','from','groupBy','sequelize','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','../../files/reports','savename','countTable','COUNT(*)','run','runReport','AnalyticMetric','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','get','UserProfileResource','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table'];(function(_0x95eec7,_0xab09a7){var _0x291ad6=function(_0x86c333){while(--_0x86c333){_0x95eec7['push'](_0x95eec7['shift']());}};_0x291ad6(++_0xab09a7);}(_0x717f,0x178));var _0xf717=function(_0x307c8d,_0x34fa36){_0x307c8d=_0x307c8d-0x0;var _0x14c2b1=_0x717f[_0x307c8d];return _0x14c2b1;};'use strict';var pdf=require(_0xf717('0x0'));var emlformat=require(_0xf717('0x1'));var rimraf=require(_0xf717('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf717('0x3'));var rp=require(_0xf717('0x4'));var moment=require(_0xf717('0x5'));var BPromise=require(_0xf717('0x6'));var Mustache=require(_0xf717('0x7'));var util=require('util');var path=require(_0xf717('0x8'));var sox=require(_0xf717('0x9'));var csv=require(_0xf717('0xa'));var ejs=require(_0xf717('0xb'));var fs=require('fs');var _=require(_0xf717('0xc'));var squel=require(_0xf717('0xd'));var crypto=require(_0xf717('0xe'));var jsforce=require(_0xf717('0xf'));var deskjs=require(_0xf717('0x10'));var toCsv=require(_0xf717('0xa'));var querystring=require(_0xf717('0x11'));var Papa=require('papaparse');var Redis=require(_0xf717('0x12'));var authService=require(_0xf717('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf717('0x14'));var hardwareService=require(_0xf717('0x15'));var logger=require(_0xf717('0x16'))('api');var utils=require(_0xf717('0x17'));var config=require(_0xf717('0x18'));var licenseUtil=require(_0xf717('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf717('0x1a'))[_0xf717('0x1b')];function respondWithStatusCode(_0x163787,_0x5b5d66){_0x5b5d66=_0x5b5d66||0xcc;return function(_0x456208){if(_0x456208){return _0x163787[_0xf717('0x1c')](_0x5b5d66);}return _0x163787[_0xf717('0x1d')](_0x5b5d66)[_0xf717('0x1e')]();};}function respondWithResult(_0x1f92e1,_0x4feea0){_0x4feea0=_0x4feea0||0xc8;return function(_0xee08a7){if(_0xee08a7){return _0x1f92e1[_0xf717('0x1d')](_0x4feea0)['json'](_0xee08a7);}};}function respondWithFilteredResult(_0x105d81,_0x19e4c7){return function(_0xfe8ea3){if(_0xfe8ea3){var _0x1068f2=_0xfe8ea3[_0xf717('0x1f')],_0x2c526b=_0x19e4c7[_0xf717('0x20')],_0x23afd6=_0x19e4c7['offset']+_0x19e4c7[_0xf717('0x21')],_0x4ccfe3;if(_0x23afd6>=_0x1068f2){_0x23afd6=_0x1068f2;_0x4ccfe3=0xc8;}else{_0x4ccfe3=0xce;}_0x105d81[_0xf717('0x1d')](_0x4ccfe3);return _0x105d81[_0xf717('0x22')](_0xf717('0x23'),_0x2c526b+'-'+_0x23afd6+'/'+_0x1068f2)[_0xf717('0x24')](_0xfe8ea3);}return null;};}function patchUpdates(_0x414743){return function(_0x3e408c){try{jsonpatch[_0xf717('0x25')](_0x3e408c,_0x414743,!![]);}catch(_0xc31dca){return BPromise['reject'](_0xc31dca);}return _0x3e408c['save']();};}function saveUpdates(_0xea116e,_0x5d1eef){return function(_0x56f9ab){if(_0x56f9ab){return _0x56f9ab[_0xf717('0x26')](_0xea116e)['then'](function(_0x2f1bde){return _0x2f1bde;});}return null;};}function removeEntity(_0x34c2d5,_0x4a70ee){return function(_0x2ecb9f){if(_0x2ecb9f){return _0x2ecb9f['destroy']()[_0xf717('0x27')](function(){var _0x4c8340=_0x2ecb9f[_0xf717('0x28')]({'plain':!![]});var _0x90888b='CustomReports';return db[_0xf717('0x29')]['destroy']({'where':{'type':_0x90888b,'resourceId':_0x4c8340['id']}})[_0xf717('0x27')](function(){return _0x2ecb9f;});})[_0xf717('0x27')](function(){_0x34c2d5[_0xf717('0x1d')](0xcc)[_0xf717('0x1e')]();});}};}function handleEntityNotFound(_0x41d339,_0x516fc9){return function(_0x48affe){if(!_0x48affe){_0x41d339[_0xf717('0x1c')](0x194);}return _0x48affe;};}function handleError(_0x65a825,_0x2b04be){_0x2b04be=_0x2b04be||0x1f4;return function(_0x5ca9e7){logger[_0xf717('0x2a')](_0x5ca9e7['stack']);if(_0x5ca9e7[_0xf717('0x2b')]){delete _0x5ca9e7['name'];}_0x65a825[_0xf717('0x1d')](_0x2b04be)[_0xf717('0x2c')](_0x5ca9e7);};}exports[_0xf717('0x2d')]=function(_0x148201,_0xda83aa){var _0x50df21={},_0x4ee7eb={},_0x33f237={'count':0x0,'rows':[]};var _0x91f79c=_[_0xf717('0x2e')](db[_0xf717('0x2f')][_0xf717('0x30')],function(_0x519313){return{'name':_0x519313[_0xf717('0x31')],'type':_0x519313[_0xf717('0x32')][_0xf717('0x33')]};});_0x4ee7eb['model']=_[_0xf717('0x2e')](_0x91f79c,_0xf717('0x2b'));_0x4ee7eb[_0xf717('0x34')]=_[_0xf717('0x35')](_0x148201[_0xf717('0x34')]);_0x4ee7eb['filters']=_[_0xf717('0x36')](_0x4ee7eb[_0xf717('0x37')],_0x4ee7eb[_0xf717('0x34')]);_0x50df21['attributes']=_['intersection'](_0x4ee7eb['model'],qs['fields'](_0x148201[_0xf717('0x34')]['fields']));_0x50df21[_0xf717('0x38')]=_0x50df21['attributes'][_0xf717('0x39')]?_0x50df21[_0xf717('0x38')]:_0x4ee7eb[_0xf717('0x37')];if(!_0x148201[_0xf717('0x34')][_0xf717('0x3a')](_0xf717('0x3b'))){_0x50df21[_0xf717('0x21')]=qs[_0xf717('0x21')](_0x148201[_0xf717('0x34')][_0xf717('0x21')]);_0x50df21[_0xf717('0x20')]=qs[_0xf717('0x20')](_0x148201[_0xf717('0x34')][_0xf717('0x20')]);}_0x50df21[_0xf717('0x3c')]=qs[_0xf717('0x3d')](_0x148201[_0xf717('0x34')][_0xf717('0x3d')]);_0x50df21[_0xf717('0x3e')]=qs[_0xf717('0x3f')](_[_0xf717('0x40')](_0x148201[_0xf717('0x34')],_0x4ee7eb[_0xf717('0x3f')]),_0x91f79c);if(_0x148201['query']['filter']){_0x50df21[_0xf717('0x3e')]=_[_0xf717('0x41')](_0x50df21['where'],{'$or':_[_0xf717('0x2e')](_0x91f79c,function(_0x72e2a1){if(_0x72e2a1[_0xf717('0x32')]!==_0xf717('0x42')){var _0x3bd3da={};_0x3bd3da[_0x72e2a1['name']]={'$like':'%'+_0x148201[_0xf717('0x34')][_0xf717('0x43')]+'%'};return _0x3bd3da;}})});}_0x50df21=_['merge']({},_0x50df21,_0x148201[_0xf717('0x44')]);var _0x41df72={'where':_0x50df21[_0xf717('0x3e')]};return db[_0xf717('0x2f')][_0xf717('0x1f')](_0x41df72)[_0xf717('0x27')](function(_0x26c58a){_0x33f237[_0xf717('0x1f')]=_0x26c58a;if(_0x148201[_0xf717('0x34')]['includeAll']){_0x50df21[_0xf717('0x45')]=[{'all':!![]}];}return db[_0xf717('0x2f')][_0xf717('0x46')](_0x50df21);})[_0xf717('0x27')](function(_0x28557c){_0x33f237[_0xf717('0x47')]=_0x28557c;return _0x33f237;})[_0xf717('0x27')](respondWithFilteredResult(_0xda83aa,_0x50df21))[_0xf717('0x48')](handleError(_0xda83aa,null));};exports[_0xf717('0x49')]=function(_0xcab015,_0x4cf976){var _0x51cfb5={'raw':![],'where':{'id':_0xcab015[_0xf717('0x4a')]['id']}},_0x442197={};_0x442197[_0xf717('0x37')]=_['keys'](db['AnalyticCustomReport']['rawAttributes']);_0x442197[_0xf717('0x34')]=_[_0xf717('0x35')](_0xcab015[_0xf717('0x34')]);_0x442197[_0xf717('0x3f')]=_[_0xf717('0x36')](_0x442197['model'],_0x442197[_0xf717('0x34')]);_0x51cfb5[_0xf717('0x38')]=_[_0xf717('0x36')](_0x442197[_0xf717('0x37')],qs[_0xf717('0x4b')](_0xcab015[_0xf717('0x34')][_0xf717('0x4b')]));_0x51cfb5[_0xf717('0x38')]=_0x51cfb5[_0xf717('0x38')][_0xf717('0x39')]?_0x51cfb5[_0xf717('0x38')]:_0x442197[_0xf717('0x37')];if(_0xcab015['query'][_0xf717('0x4c')]){_0x51cfb5['include']=[{'all':!![]}];}_0x51cfb5=_[_0xf717('0x41')]({},_0x51cfb5,_0xcab015['options']);return db[_0xf717('0x2f')][_0xf717('0x4d')](_0x51cfb5)[_0xf717('0x27')](handleEntityNotFound(_0x4cf976,null))['then'](respondWithResult(_0x4cf976,null))[_0xf717('0x48')](handleError(_0x4cf976,null));};exports[_0xf717('0x4e')]=function(_0x4dfa1a,_0x4c3019){return db[_0xf717('0x2f')][_0xf717('0x4e')](_0x4dfa1a['body'],{})[_0xf717('0x27')](function(_0x271f5a){var _0x1c8198=_0x4dfa1a[_0xf717('0x4f')][_0xf717('0x28')]({'plain':!![]});if(!_0x1c8198)throw new Error(_0xf717('0x50'));if(_0x1c8198[_0xf717('0x51')]===_0xf717('0x4f')){var _0x5aff22=_0x271f5a[_0xf717('0x28')]({'plain':!![]});var _0x398e0b=_0xf717('0x52');return db[_0xf717('0x53')]['find']({'where':{'name':_0x398e0b,'userProfileId':_0x1c8198[_0xf717('0x54')]},'raw':!![]})['then'](function(_0x5cdd24){if(_0x5cdd24&&_0x5cdd24['autoAssociation']===0x0){return db[_0xf717('0x29')][_0xf717('0x4e')]({'name':_0x5aff22[_0xf717('0x2b')],'resourceId':_0x5aff22['id'],'type':_0xf717('0x55'),'sectionId':_0x5cdd24['id']},{})['then'](function(){return _0x271f5a;});}else{return _0x271f5a;}})[_0xf717('0x48')](function(_0xf9b141){logger[_0xf717('0x2a')](_0xf717('0x56'),_0xf9b141);throw _0xf9b141;});}return _0x271f5a;})[_0xf717('0x27')](respondWithResult(_0x4c3019,0xc9))[_0xf717('0x48')](handleError(_0x4c3019,null));};exports[_0xf717('0x26')]=function(_0x1fdc6e,_0x145722){if(_0x1fdc6e[_0xf717('0x57')]['id']){delete _0x1fdc6e[_0xf717('0x57')]['id'];}return db[_0xf717('0x2f')][_0xf717('0x4d')]({'where':{'id':_0x1fdc6e[_0xf717('0x4a')]['id']}})[_0xf717('0x27')](handleEntityNotFound(_0x145722,null))[_0xf717('0x27')](saveUpdates(_0x1fdc6e[_0xf717('0x57')],null))[_0xf717('0x27')](respondWithResult(_0x145722,null))['catch'](handleError(_0x145722,null));};exports[_0xf717('0x58')]=function(_0x11afcf,_0x448ed4){return db[_0xf717('0x2f')][_0xf717('0x4d')]({'where':{'id':_0x11afcf[_0xf717('0x4a')]['id']}})['then'](handleEntityNotFound(_0x448ed4,null))[_0xf717('0x27')](removeEntity(_0x448ed4,null))[_0xf717('0x48')](handleError(_0x448ed4,null));};exports['preview']=function(_0x446f2c,_0x108f8e){var _0x4ca39c=0xa;var _0x5d9e54=[_0xf717('0x59'),_0xf717('0x5a'),_0xf717('0x5b'),_0xf717('0x5c')];var _0x39f6c4={'SUM':_0xf717('0x5d'),'COUNT':_0xf717('0x5e'),'COUNT DISTINCT':_0xf717('0x5f'),'MAX':_0xf717('0x60'),'MIN':_0xf717('0x61'),'AVG':_0xf717('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf717('0x63'),'GROUP_CONCAT DESC':_0xf717('0x64')};var _0x2ea3cc={'SEC_TO_TIME':_0xf717('0x65'),'DATE':'DATE(%s)','HOUR':_0xf717('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf717('0x67')};var _0x10a0f7=function(_0x5a4f1d){return!_[_0xf717('0x68')]([_0xf717('0x69'),_0xf717('0x6a'),_0xf717('0x6b'),'IS\x20NOT\x20EMPTY'],_0x5a4f1d);};var _0x189703=function(_0x3859e6){if(!_0x3859e6||!_0x3859e6[_0xf717('0x6c')][_0xf717('0x39')]){return'';}for(var _0x526425='(',_0x114a9b=0x0;_0x114a9b<_0x3859e6[_0xf717('0x6c')][_0xf717('0x39')];_0x114a9b+=0x1){_0x114a9b>0x0&&(_0x526425+='\x20'+_0x3859e6[_0xf717('0x6d')]+'\x20');_0x526425+=_0x3859e6[_0xf717('0x6c')][_0x114a9b]['group']?_0x189703(_0x3859e6[_0xf717('0x6c')][_0x114a9b][_0xf717('0x6e')]):_0x3859e6[_0xf717('0x6c')][_0x114a9b][_0xf717('0x6f')]+'\x20'+_0x3859e6[_0xf717('0x6c')][_0x114a9b][_0xf717('0x70')]+(_0x10a0f7(_0x3859e6[_0xf717('0x6c')][_0x114a9b][_0xf717('0x70')])?'\x20'+_0x3859e6[_0xf717('0x6c')][_0x114a9b][_0xf717('0x71')]:'');}return _0x526425+')';};var _0x33dd09={'where':{'id':_0x446f2c[_0xf717('0x4a')]['id']}},_0x1130b0,_0x13ca83,_0x427d97,_0x273f62,_0x35d2c9;_0x33dd09=_[_0xf717('0x41')]({},_0x33dd09,_0x446f2c[_0xf717('0x44')]);return db['AnalyticCustomReport'][_0xf717('0x4d')](_0x33dd09)['then'](function(_0x1cab65){if(_0x1cab65){_0x1130b0=_0x1cab65;return _0x1cab65['getFields']();}return null;})[_0xf717('0x27')](function(_0x5e8117){if(_0x5e8117){if(!_0x5e8117[_0xf717('0x39')]){throw new db[(_0xf717('0x72'))][(_0xf717('0x73'))](_0xf717('0x74'),0x193);}_0x13ca83=_0x5e8117;return db['AnalyticMetric'][_0xf717('0x46')]({'raw':!![]});}return null;})[_0xf717('0x27')](function(_0x4c78f6){if(_0x4c78f6){_0x427d97=_[_0xf717('0x75')](_0x4c78f6,'id');var _0x29fc1d;var _0x55a620=squel[_0xf717('0x76')]();_0x55a620['from'](_0x1130b0['table']);for(var _0x3eee20=0x0;_0x3eee20<_0x13ca83[_0xf717('0x39')];_0x3eee20+=0x1){_0x29fc1d=_0x13ca83[_0x3eee20][_0xf717('0x77')]?_0x427d97[_0x13ca83[_0x3eee20][_0xf717('0x77')]][_0xf717('0x78')]:_0x13ca83[_0x3eee20][_0xf717('0x6f')];_0x29fc1d=_0x13ca83[_0x3eee20][_0xf717('0x79')]?_[_0xf717('0x7a')](_0x39f6c4[_0x13ca83[_0x3eee20][_0xf717('0x79')]],'%s',_0x29fc1d):_0x29fc1d;_0x29fc1d=_0x13ca83[_0x3eee20][_0xf717('0x7b')]?_[_0xf717('0x7a')](_0x2ea3cc[_0x13ca83[_0x3eee20]['format']],'%s',_0x29fc1d):_0x29fc1d;if(_0x13ca83[_0x3eee20]['groupBy']){_0x55a620[_0xf717('0x6e')](_0x29fc1d);}_0x13ca83[_0x3eee20][_0xf717('0x7c')]&&_0x55a620[_0xf717('0x3c')](_0x29fc1d,_0x13ca83[_0x3eee20][_0xf717('0x7c')]===_0xf717('0x7d')?![]:!![]);_0x55a620[_0xf717('0x6f')](_0x29fc1d,_0x13ca83[_0x3eee20][_0xf717('0x7e')]||_0x29fc1d);}if(_0x1130b0[_0xf717('0x7f')]){_0x1130b0['joins']=JSON[_0xf717('0x80')](_0x1130b0[_0xf717('0x7f')]);for(var _0x53031a=0x0;_0x53031a<_0x1130b0['joins']['length'];_0x53031a+=0x1){if(_0x1130b0[_0xf717('0x7f')][_0x53031a][_0xf717('0x32')]&&_[_0xf717('0x68')](_0x5d9e54,_0x1130b0[_0xf717('0x7f')][_0x53031a]['type'])&&_0x1130b0[_0xf717('0x7f')][_0x53031a][_0xf717('0x81')]&&_0x1130b0[_0xf717('0x7f')][_0x53031a][_0xf717('0x82')]&&_0x1130b0[_0xf717('0x7f')][_0x53031a][_0xf717('0x83')]){_0x55a620[_0x1130b0[_0xf717('0x7f')][_0x53031a][_0xf717('0x32')]](_0x1130b0['joins'][_0x53031a]['foreignTable'],null,util['format'](_0xf717('0x84'),_0x1130b0[_0xf717('0x85')],_0x1130b0['joins'][_0x53031a][_0xf717('0x81')],_0x1130b0[_0xf717('0x7f')][_0x53031a][_0xf717('0x82')],_0x1130b0[_0xf717('0x7f')][_0x53031a]['foreignKey']));}}}if(_0x1130b0['conditions']){_0x1130b0[_0xf717('0x86')]=JSON[_0xf717('0x80')](_0x1130b0[_0xf717('0x86')]);_0x55a620[_0xf717('0x3e')](_0x189703(_0x1130b0['conditions'][_0xf717('0x6e')]));}_0x35d2c9=_0x55a620[_0xf717('0x87')]();_0x55a620[_0xf717('0x21')](_0x4ca39c);_0x55a620[_0xf717('0x20')](0x0);logger[_0xf717('0x88')](_0xf717('0x89'),_0x55a620['toString']());return db['sequelize']['query'](_0x55a620[_0xf717('0x8a')](),{'type':db['sequelize'][_0xf717('0x8b')][_0xf717('0x8c')]});}})[_0xf717('0x27')](respondWithResult(_0x108f8e,null))['catch'](handleError(_0x108f8e,null));};function runReport(_0x2c6802,_0x577ebe,_0x271179){var _0x47e050=_0x577ebe[_0xf717('0x2b')];var _0x1ae9ad=0xa;var _0x51df94=[_0xf717('0x59'),'left_join','right_join',_0xf717('0x5c')];var _0x389436={'SUM':_0xf717('0x5d'),'COUNT':_0xf717('0x5e'),'COUNT DISTINCT':_0xf717('0x5f'),'MAX':_0xf717('0x60'),'MIN':_0xf717('0x61'),'AVG':_0xf717('0x62'),'GROUP_CONCAT':_0xf717('0x8d'),'GROUP_CONCAT ASC':_0xf717('0x63'),'GROUP_CONCAT DESC':_0xf717('0x64')};var _0x4fd6e4={'SEC_TO_TIME':_0xf717('0x65'),'DATE':_0xf717('0x8e'),'HOUR':_0xf717('0x66'),'ROUND':_0xf717('0x8f'),'UNIX_TIMESTAMP':_0xf717('0x67')};var _0xb91e2f=function(_0x137804){return!_[_0xf717('0x68')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xf717('0x6b'),_0xf717('0x90')],_0x137804);};var _0x5043ed=function(_0x2dd5dd){if(!_0x2dd5dd||!_0x2dd5dd[_0xf717('0x6c')][_0xf717('0x39')]){return'';}for(var _0x1cafd2='(',_0x324584=0x0;_0x324584<_0x2dd5dd['rules'][_0xf717('0x39')];_0x324584+=0x1){_0x324584>0x0&&(_0x1cafd2+='\x20'+_0x2dd5dd['operator']+'\x20');_0x1cafd2+=_0x2dd5dd[_0xf717('0x6c')][_0x324584]['group']?_0x5043ed(_0x2dd5dd[_0xf717('0x6c')][_0x324584][_0xf717('0x6e')]):_0x2dd5dd[_0xf717('0x6c')][_0x324584][_0xf717('0x6f')]+'\x20'+_0x2dd5dd[_0xf717('0x6c')][_0x324584]['condition']+(_0xb91e2f(_0x2dd5dd[_0xf717('0x6c')][_0x324584][_0xf717('0x70')])?'\x20'+_0x2dd5dd[_0xf717('0x6c')][_0x324584][_0xf717('0x71')]:'');}return _0x1cafd2+')';};var _0x1b73fd={'where':{'id':_0x2c6802['id']}},_0x380e94,_0x11f193,_0x1e3ded,_0x1bdcfc,_0x15423f;_0x1b73fd=_[_0xf717('0x41')]({},_0x1b73fd,_0x271179);return db[_0xf717('0x2f')]['find'](_0x1b73fd)[_0xf717('0x27')](function(_0x443c96){if(_0x443c96){_0x380e94=_0x443c96;return _0x443c96[_0xf717('0x91')]();}return null;})[_0xf717('0x27')](function(_0x2640ba){if(_0x2640ba){if(!_0x2640ba['length']){throw new db[(_0xf717('0x72'))][(_0xf717('0x73'))](_0xf717('0x74'),0x193);}_0x11f193=_0x2640ba;return db['AnalyticMetric'][_0xf717('0x46')]({'raw':!![]});}return null;})[_0xf717('0x27')](function(_0x190ead){if(_0x190ead){_0x1e3ded=_[_0xf717('0x75')](_0x190ead,'id');var _0x216e5f;var _0x8bd37a=squel['select']();_0x8bd37a[_0xf717('0x92')](_0x380e94[_0xf717('0x85')]);for(var _0x39341a=0x0;_0x39341a<_0x11f193[_0xf717('0x39')];_0x39341a+=0x1){_0x216e5f=_0x11f193[_0x39341a]['MetricId']?_0x1e3ded[_0x11f193[_0x39341a][_0xf717('0x77')]][_0xf717('0x78')]:_0x11f193[_0x39341a]['field'];_0x216e5f=_0x11f193[_0x39341a][_0xf717('0x79')]?_[_0xf717('0x7a')](_0x389436[_0x11f193[_0x39341a][_0xf717('0x79')]],'%s',_0x216e5f):_0x216e5f;_0x216e5f=_0x11f193[_0x39341a][_0xf717('0x7b')]?_[_0xf717('0x7a')](_0x4fd6e4[_0x11f193[_0x39341a]['format']],'%s',_0x216e5f):_0x216e5f;if(_0x11f193[_0x39341a][_0xf717('0x93')]){_0x8bd37a[_0xf717('0x6e')](_0x216e5f);}_0x11f193[_0x39341a][_0xf717('0x7c')]&&_0x8bd37a[_0xf717('0x3c')](_0x216e5f,_0x11f193[_0x39341a]['orderBy']===_0xf717('0x7d')?![]:!![]);_0x8bd37a[_0xf717('0x6f')](_0x216e5f,_0x11f193[_0x39341a]['alias']||_0x216e5f);}if(_0x380e94['joins']){_0x380e94[_0xf717('0x7f')]=JSON[_0xf717('0x80')](_0x380e94[_0xf717('0x7f')]);for(var _0x2bd320=0x0;_0x2bd320<_0x380e94[_0xf717('0x7f')]['length'];_0x2bd320+=0x1){if(_0x380e94[_0xf717('0x7f')][_0x2bd320][_0xf717('0x32')]&&_[_0xf717('0x68')](_0x51df94,_0x380e94['joins'][_0x2bd320][_0xf717('0x32')])&&_0x380e94['joins'][_0x2bd320][_0xf717('0x81')]&&_0x380e94[_0xf717('0x7f')][_0x2bd320][_0xf717('0x82')]&&_0x380e94[_0xf717('0x7f')][_0x2bd320][_0xf717('0x83')]){_0x8bd37a[_0x380e94[_0xf717('0x7f')][_0x2bd320][_0xf717('0x32')]](_0x380e94[_0xf717('0x7f')][_0x2bd320]['foreignTable'],null,util[_0xf717('0x7b')](_0xf717('0x84'),_0x380e94['table'],_0x380e94['joins'][_0x2bd320][_0xf717('0x81')],_0x380e94[_0xf717('0x7f')][_0x2bd320][_0xf717('0x82')],_0x380e94[_0xf717('0x7f')][_0x2bd320][_0xf717('0x83')]));}}}if(_0x380e94[_0xf717('0x86')]){_0x380e94['conditions']=JSON[_0xf717('0x80')](_0x380e94[_0xf717('0x86')]);_0x8bd37a[_0xf717('0x3e')](_0x5043ed(_0x380e94[_0xf717('0x86')][_0xf717('0x6e')]));}_0x15423f=_0x8bd37a[_0xf717('0x87')]();_0x8bd37a['limit'](_0x1ae9ad);_0x8bd37a[_0xf717('0x20')](0x0);logger[_0xf717('0x88')](_0xf717('0x89'),_0x8bd37a[_0xf717('0x8a')]());return db[_0xf717('0x94')][_0xf717('0x34')](_0x8bd37a[_0xf717('0x8a')](),{'type':db[_0xf717('0x94')][_0xf717('0x8b')][_0xf717('0x8c')]});}})[_0xf717('0x27')](function(_0x14347a){if(!_0x14347a['length']){throw new db[(_0xf717('0x72'))][(_0xf717('0x73'))](_0xf717('0x95'),0xcc);}if(_0x577ebe[_0xf717('0x96')]===_0xf717('0x97')){return null;}var _0xe62483=_[_0xf717('0x41')](_0x577ebe,{'name':_0x577ebe[_0xf717('0x98')]||_0x577ebe[_0xf717('0x2b')]||_0x380e94[_0xf717('0x2b')],'basename':_0x47e050,'savename':util[_0xf717('0x7b')](_0xf717('0x99'),_0x577ebe['name']||_0x380e94[_0xf717('0x2b')],require(_0xf717('0x9a'))[_0xf717('0x9b')](0x4),_0x577ebe[_0xf717('0x96')]||'csv'),'reportId':_0x380e94['id'],'reportType':_0xf717('0x9c')});return db['AnalyticExtractedReport']['create'](_0xe62483,{'raw':!![]});})[_0xf717('0x27')](function(_0x35a08b){if(_0x380e94[_0xf717('0x85')]===_0xf717('0x9d')){_0x15423f[_0xf717('0x3e')](_0x380e94[_0xf717('0x85')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x577ebe[_0xf717('0x9e')],_0x577ebe[_0xf717('0x9f')]);}else{_0x15423f[_0xf717('0x3e')](_0x380e94[_0xf717('0x85')]+_0xf717('0xa0'),_0x577ebe[_0xf717('0x9e')],_0x577ebe[_0xf717('0x9f')]);}if(_0x35a08b){logger[_0xf717('0xa1')](_0xf717('0xa2'),_0x15423f[_0xf717('0x8a')]());require('child_process')['fork'](path[_0xf717('0x59')](__dirname,'../../components/export/',_0x35a08b[_0xf717('0x96')]),[_0x35a08b['id'],_0x15423f[_0xf717('0x8a')](),path[_0xf717('0x59')](__dirname,_0xf717('0xa3'),_0x35a08b[_0xf717('0xa4')]),_0x47e050]);return _0x35a08b;}else{var _0x1000ec=squel[_0xf717('0x76')]();_0x1000ec[_0xf717('0x92')]('('+_0x15423f[_0xf717('0x8a')]()+')',_0xf717('0xa5'));_0x1000ec[_0xf717('0x6f')](_0xf717('0xa6'),_0xf717('0x1f'));_0x15423f[_0xf717('0x21')](_0x577ebe[_0xf717('0x21')]||_0x1ae9ad);_0x15423f[_0xf717('0x20')](_0x577ebe[_0xf717('0x20')]||0x0);return dbH[_0xf717('0x94')][_0xf717('0x34')](_0x1000ec[_0xf717('0x8a')](),{'type':dbH[_0xf717('0x94')][_0xf717('0x8b')][_0xf717('0x8c')]})[_0xf717('0x27')](function(_0x1196a6){if(!_0x1196a6[_0xf717('0x39')]){_0x1bdcfc=0x0;}else{_0x1bdcfc=_0x1196a6[0x0][_0xf717('0x1f')]||0x0;}return dbH[_0xf717('0x94')][_0xf717('0x34')](_0x15423f[_0xf717('0x8a')](),{'type':dbH[_0xf717('0x94')]['QueryTypes'][_0xf717('0x8c')]});})['then'](function(_0x494f4){return{'rows':_0x494f4||[],'count':_0x1bdcfc};});}});}exports[_0xf717('0xa7')]=function(_0x2e88e9,_0xfd2b18){return runReport(_0x2e88e9[_0xf717('0x4a')],_0x2e88e9[_0xf717('0x34')],_0x2e88e9[_0xf717('0x44')])['then'](respondWithResult(_0xfd2b18,null))[_0xf717('0x48')](handleError(_0xfd2b18,null));};exports[_0xf717('0xa8')]=runReport;exports[_0xf717('0x34')]=function(_0x5940b9,_0x4156e8){var _0x43d6a9=0xa;var _0x573e0c=[_0xf717('0x59'),_0xf717('0x5a'),_0xf717('0x5b'),_0xf717('0x5c')];var _0x17769b={'SUM':_0xf717('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf717('0x5f'),'MAX':_0xf717('0x60'),'MIN':_0xf717('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf717('0x8d'),'GROUP_CONCAT ASC':_0xf717('0x63'),'GROUP_CONCAT DESC':_0xf717('0x64')};var _0x32d960={'SEC_TO_TIME':_0xf717('0x65'),'DATE':_0xf717('0x8e'),'HOUR':_0xf717('0x66'),'ROUND':_0xf717('0x8f'),'UNIX_TIMESTAMP':_0xf717('0x67')};var _0x4d495d=function(_0x53a73f){return!_[_0xf717('0x68')](['IS\x20NULL',_0xf717('0x6a'),_0xf717('0x6b'),_0xf717('0x90')],_0x53a73f);};var _0x33a8f7=function(_0x4072b2){if(!_0x4072b2||!_0x4072b2[_0xf717('0x6c')][_0xf717('0x39')]){return'';}for(var _0x39bfe6='(',_0x927df4=0x0;_0x927df4<_0x4072b2[_0xf717('0x6c')]['length'];_0x927df4+=0x1){_0x927df4>0x0&&(_0x39bfe6+='\x20'+_0x4072b2[_0xf717('0x6d')]+'\x20');_0x39bfe6+=_0x4072b2[_0xf717('0x6c')][_0x927df4][_0xf717('0x6e')]?_0x33a8f7(_0x4072b2[_0xf717('0x6c')][_0x927df4][_0xf717('0x6e')]):_0x4072b2[_0xf717('0x6c')][_0x927df4][_0xf717('0x6f')]+'\x20'+_0x4072b2[_0xf717('0x6c')][_0x927df4][_0xf717('0x70')]+(_0x4d495d(_0x4072b2[_0xf717('0x6c')][_0x927df4][_0xf717('0x70')])?'\x20'+_0x4072b2[_0xf717('0x6c')][_0x927df4][_0xf717('0x71')]:'');}return _0x39bfe6+')';};var _0x4110c3={'where':{'id':_0x5940b9[_0xf717('0x4a')]['id']}},_0x82a366,_0x479060,_0x1a54b1,_0x2f0085,_0x2b1b8f;_0x4110c3=_[_0xf717('0x41')]({},_0x4110c3,_0x5940b9[_0xf717('0x44')]);return db[_0xf717('0x2f')][_0xf717('0x4d')](_0x4110c3)[_0xf717('0x27')](function(_0x486b02){if(_0x486b02){_0x82a366=_0x486b02;return _0x486b02[_0xf717('0x91')]();}return null;})['then'](function(_0xa4a294){if(_0xa4a294){if(!_0xa4a294[_0xf717('0x39')]){throw new db['Sequelize'][(_0xf717('0x73'))](_0xf717('0x74'),0x193);}_0x479060=_0xa4a294;return db[_0xf717('0xa9')]['findAll']({'raw':!![]});}return null;})[_0xf717('0x27')](function(_0x580b90){if(_0x580b90){_0x1a54b1=_[_0xf717('0x75')](_0x580b90,'id');var _0x570562;var _0x298e36=squel[_0xf717('0x76')]();_0x298e36[_0xf717('0x92')](_0x82a366[_0xf717('0x85')]);for(var _0x4990e7=0x0;_0x4990e7<_0x479060[_0xf717('0x39')];_0x4990e7+=0x1){_0x570562=_0x479060[_0x4990e7][_0xf717('0x77')]?_0x1a54b1[_0x479060[_0x4990e7][_0xf717('0x77')]]['metric']:_0x479060[_0x4990e7][_0xf717('0x6f')];_0x570562=_0x479060[_0x4990e7][_0xf717('0x79')]?_[_0xf717('0x7a')](_0x17769b[_0x479060[_0x4990e7][_0xf717('0x79')]],'%s',_0x570562):_0x570562;_0x570562=_0x479060[_0x4990e7][_0xf717('0x7b')]?_[_0xf717('0x7a')](_0x32d960[_0x479060[_0x4990e7][_0xf717('0x7b')]],'%s',_0x570562):_0x570562;if(_0x479060[_0x4990e7][_0xf717('0x93')]){_0x298e36[_0xf717('0x6e')](_0x570562);}_0x479060[_0x4990e7]['orderBy']&&_0x298e36[_0xf717('0x3c')](_0x570562,_0x479060[_0x4990e7][_0xf717('0x7c')]===_0xf717('0x7d')?![]:!![]);_0x298e36[_0xf717('0x6f')](_0x570562,_0x479060[_0x4990e7][_0xf717('0x7e')]||_0x570562);}if(_0x82a366[_0xf717('0x7f')]){_0x82a366[_0xf717('0x7f')]=JSON[_0xf717('0x80')](_0x82a366[_0xf717('0x7f')]);for(var _0x3db351=0x0;_0x3db351<_0x82a366[_0xf717('0x7f')][_0xf717('0x39')];_0x3db351+=0x1){if(_0x82a366[_0xf717('0x7f')][_0x3db351]['type']&&_['includes'](_0x573e0c,_0x82a366['joins'][_0x3db351][_0xf717('0x32')])&&_0x82a366[_0xf717('0x7f')][_0x3db351]['parentKey']&&_0x82a366['joins'][_0x3db351][_0xf717('0x82')]&&_0x82a366[_0xf717('0x7f')][_0x3db351]['foreignKey']){_0x298e36[_0x82a366[_0xf717('0x7f')][_0x3db351][_0xf717('0x32')]](_0x82a366[_0xf717('0x7f')][_0x3db351]['foreignTable'],null,util[_0xf717('0x7b')](_0xf717('0x84'),_0x82a366[_0xf717('0x85')],_0x82a366[_0xf717('0x7f')][_0x3db351]['parentKey'],_0x82a366[_0xf717('0x7f')][_0x3db351][_0xf717('0x82')],_0x82a366[_0xf717('0x7f')][_0x3db351][_0xf717('0x83')]));}}}if(_0x82a366[_0xf717('0x86')]){_0x82a366[_0xf717('0x86')]=JSON[_0xf717('0x80')](_0x82a366[_0xf717('0x86')]);_0x298e36['where'](_0x33a8f7(_0x82a366[_0xf717('0x86')][_0xf717('0x6e')]));}_0x2b1b8f=_0x298e36[_0xf717('0x87')]();_0x298e36[_0xf717('0x21')](_0x43d6a9);_0x298e36[_0xf717('0x20')](0x0);logger['debug'](_0xf717('0x89'),_0x298e36[_0xf717('0x8a')]());return db[_0xf717('0x94')][_0xf717('0x34')](_0x298e36[_0xf717('0x8a')](),{'type':db[_0xf717('0x94')][_0xf717('0x8b')]['SELECT']});}})[_0xf717('0x27')](function(){return{'sql':_0x2b1b8f[_0xf717('0x8a')]()};})[_0xf717('0x27')](respondWithResult(_0x4156e8,null))[_0xf717('0x48')](handleError(_0x4156e8,null));}; \ No newline at end of file +var _0x9865=['MIN(%s)','SEC_TO_TIME(%s)','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status','count','offset','set','reject','save','update','then','CustomReports','UserProfileResource','destroy','sendStatus','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','map','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','MetricId','metric','replace','function','format','orderBy','DESC','field','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','value','AnalyticMetric','groupBy','alias','No\x20available\x20data','web','fullPath','randomstring','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','../../components/export/','countTable','run','runReport','MAX(%s)'];(function(_0xa1c85c,_0x558def){var _0x1bec7f=function(_0x358fca){while(--_0x358fca){_0xa1c85c['push'](_0xa1c85c['shift']());}};_0x1bec7f(++_0x558def);}(_0x9865,0xab));var _0x5986=function(_0x4b034c,_0x337cfd){_0x4b034c=_0x4b034c-0x0;var _0x8b8dc6=_0x9865[_0x4b034c];return _0x8b8dc6;};'use strict';var pdf=require(_0x5986('0x0'));var emlformat=require(_0x5986('0x1'));var rimraf=require(_0x5986('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5986('0x3'));var rp=require('request-promise');var moment=require(_0x5986('0x4'));var BPromise=require(_0x5986('0x5'));var Mustache=require(_0x5986('0x6'));var util=require(_0x5986('0x7'));var path=require(_0x5986('0x8'));var sox=require(_0x5986('0x9'));var csv=require(_0x5986('0xa'));var ejs=require(_0x5986('0xb'));var fs=require('fs');var _=require(_0x5986('0xc'));var squel=require(_0x5986('0xd'));var crypto=require(_0x5986('0xe'));var jsforce=require(_0x5986('0xf'));var deskjs=require(_0x5986('0x10'));var toCsv=require(_0x5986('0xa'));var querystring=require(_0x5986('0x11'));var Papa=require(_0x5986('0x12'));var Redis=require(_0x5986('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5986('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5986('0x15'));var logger=require(_0x5986('0x16'))('api');var utils=require(_0x5986('0x17'));var config=require(_0x5986('0x18'));var licenseUtil=require(_0x5986('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5986('0x1a'))[_0x5986('0x1b')];function respondWithStatusCode(_0x5ba478,_0x6caa9e){_0x6caa9e=_0x6caa9e||0xcc;return function(_0x3d2a8f){if(_0x3d2a8f){return _0x5ba478['sendStatus'](_0x6caa9e);}return _0x5ba478['status'](_0x6caa9e)[_0x5986('0x1c')]();};}function respondWithResult(_0x304486,_0x27bb13){_0x27bb13=_0x27bb13||0xc8;return function(_0x26fd23){if(_0x26fd23){return _0x304486[_0x5986('0x1d')](_0x27bb13)['json'](_0x26fd23);}};}function respondWithFilteredResult(_0x133554,_0x47de55){return function(_0x23b38b){if(_0x23b38b){var _0x3297fb=_0x23b38b[_0x5986('0x1e')],_0x525deb=_0x47de55[_0x5986('0x1f')],_0x327619=_0x47de55[_0x5986('0x1f')]+_0x47de55['limit'],_0x5e55ab;if(_0x327619>=_0x3297fb){_0x327619=_0x3297fb;_0x5e55ab=0xc8;}else{_0x5e55ab=0xce;}_0x133554[_0x5986('0x1d')](_0x5e55ab);return _0x133554[_0x5986('0x20')]('Content-Range',_0x525deb+'-'+_0x327619+'/'+_0x3297fb)['json'](_0x23b38b);}return null;};}function patchUpdates(_0x579673){return function(_0x575ca8){try{jsonpatch['apply'](_0x575ca8,_0x579673,!![]);}catch(_0x15d56e){return BPromise[_0x5986('0x21')](_0x15d56e);}return _0x575ca8[_0x5986('0x22')]();};}function saveUpdates(_0x44bc96,_0x2af1b4){return function(_0x5f3afa){if(_0x5f3afa){return _0x5f3afa[_0x5986('0x23')](_0x44bc96)[_0x5986('0x24')](function(_0x665249){return _0x665249;});}return null;};}function removeEntity(_0x102d33,_0x2dc72a){return function(_0x4088b7){if(_0x4088b7){return _0x4088b7['destroy']()[_0x5986('0x24')](function(){var _0x28b2ae=_0x4088b7['get']({'plain':!![]});var _0x197d70=_0x5986('0x25');return db[_0x5986('0x26')][_0x5986('0x27')]({'where':{'type':_0x197d70,'resourceId':_0x28b2ae['id']}})['then'](function(){return _0x4088b7;});})[_0x5986('0x24')](function(){_0x102d33[_0x5986('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c280,_0x2b5d6b){return function(_0x5ec393){if(!_0x5ec393){_0x34c280[_0x5986('0x28')](0x194);}return _0x5ec393;};}function handleError(_0x34d2b1,_0x10a43a){_0x10a43a=_0x10a43a||0x1f4;return function(_0x3cd48e){logger['error'](_0x3cd48e[_0x5986('0x29')]);if(_0x3cd48e[_0x5986('0x2a')]){delete _0x3cd48e['name'];}_0x34d2b1['status'](_0x10a43a)[_0x5986('0x2b')](_0x3cd48e);};}exports[_0x5986('0x2c')]=function(_0x193eea,_0x2de574){var _0x3dd62e={},_0x438123={},_0x3c864e={'count':0x0,'rows':[]};var _0x51a002=_['map'](db[_0x5986('0x2d')][_0x5986('0x2e')],function(_0x1cee90){return{'name':_0x1cee90[_0x5986('0x2f')],'type':_0x1cee90[_0x5986('0x30')][_0x5986('0x31')]};});_0x438123[_0x5986('0x32')]=_['map'](_0x51a002,_0x5986('0x2a'));_0x438123[_0x5986('0x33')]=_[_0x5986('0x34')](_0x193eea[_0x5986('0x33')]);_0x438123[_0x5986('0x35')]=_[_0x5986('0x36')](_0x438123[_0x5986('0x32')],_0x438123[_0x5986('0x33')]);_0x3dd62e[_0x5986('0x37')]=_[_0x5986('0x36')](_0x438123[_0x5986('0x32')],qs[_0x5986('0x38')](_0x193eea[_0x5986('0x33')]['fields']));_0x3dd62e[_0x5986('0x37')]=_0x3dd62e[_0x5986('0x37')][_0x5986('0x39')]?_0x3dd62e[_0x5986('0x37')]:_0x438123[_0x5986('0x32')];if(!_0x193eea['query']['hasOwnProperty'](_0x5986('0x3a'))){_0x3dd62e['limit']=qs['limit'](_0x193eea[_0x5986('0x33')][_0x5986('0x3b')]);_0x3dd62e[_0x5986('0x1f')]=qs[_0x5986('0x1f')](_0x193eea[_0x5986('0x33')]['offset']);}_0x3dd62e[_0x5986('0x3c')]=qs[_0x5986('0x3d')](_0x193eea[_0x5986('0x33')]['sort']);_0x3dd62e['where']=qs[_0x5986('0x35')](_[_0x5986('0x3e')](_0x193eea['query'],_0x438123[_0x5986('0x35')]),_0x51a002);if(_0x193eea[_0x5986('0x33')][_0x5986('0x3f')]){_0x3dd62e[_0x5986('0x40')]=_['merge'](_0x3dd62e[_0x5986('0x40')],{'$or':_[_0x5986('0x41')](_0x51a002,function(_0xfd2142){if(_0xfd2142[_0x5986('0x30')]!=='VIRTUAL'){var _0x1dca35={};_0x1dca35[_0xfd2142['name']]={'$like':'%'+_0x193eea[_0x5986('0x33')][_0x5986('0x3f')]+'%'};return _0x1dca35;}})});}_0x3dd62e=_['merge']({},_0x3dd62e,_0x193eea[_0x5986('0x42')]);var _0x4fc921={'where':_0x3dd62e[_0x5986('0x40')]};return db['AnalyticCustomReport']['count'](_0x4fc921)[_0x5986('0x24')](function(_0x2459f4){_0x3c864e[_0x5986('0x1e')]=_0x2459f4;if(_0x193eea[_0x5986('0x33')][_0x5986('0x43')]){_0x3dd62e[_0x5986('0x44')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x5986('0x45')](_0x3dd62e);})[_0x5986('0x24')](function(_0x529ac1){_0x3c864e[_0x5986('0x46')]=_0x529ac1;return _0x3c864e;})['then'](respondWithFilteredResult(_0x2de574,_0x3dd62e))[_0x5986('0x47')](handleError(_0x2de574,null));};exports[_0x5986('0x48')]=function(_0x30f25b,_0x599165){var _0x427355={'raw':![],'where':{'id':_0x30f25b[_0x5986('0x49')]['id']}},_0x5ceeb8={};_0x5ceeb8['model']=_[_0x5986('0x34')](db['AnalyticCustomReport'][_0x5986('0x2e')]);_0x5ceeb8[_0x5986('0x33')]=_[_0x5986('0x34')](_0x30f25b[_0x5986('0x33')]);_0x5ceeb8[_0x5986('0x35')]=_[_0x5986('0x36')](_0x5ceeb8[_0x5986('0x32')],_0x5ceeb8[_0x5986('0x33')]);_0x427355[_0x5986('0x37')]=_['intersection'](_0x5ceeb8[_0x5986('0x32')],qs[_0x5986('0x38')](_0x30f25b[_0x5986('0x33')][_0x5986('0x38')]));_0x427355['attributes']=_0x427355[_0x5986('0x37')][_0x5986('0x39')]?_0x427355[_0x5986('0x37')]:_0x5ceeb8['model'];if(_0x30f25b[_0x5986('0x33')][_0x5986('0x43')]){_0x427355[_0x5986('0x44')]=[{'all':!![]}];}_0x427355=_[_0x5986('0x4a')]({},_0x427355,_0x30f25b['options']);return db[_0x5986('0x2d')][_0x5986('0x4b')](_0x427355)[_0x5986('0x24')](handleEntityNotFound(_0x599165,null))['then'](respondWithResult(_0x599165,null))[_0x5986('0x47')](handleError(_0x599165,null));};exports[_0x5986('0x4c')]=function(_0x20ead9,_0x21b341){return db[_0x5986('0x2d')][_0x5986('0x4c')](_0x20ead9[_0x5986('0x4d')],{})[_0x5986('0x24')](function(_0x536592){var _0x48251a=_0x20ead9[_0x5986('0x4e')][_0x5986('0x4f')]({'plain':!![]});if(!_0x48251a)throw new Error(_0x5986('0x50'));if(_0x48251a['role']===_0x5986('0x4e')){var _0x150873=_0x536592[_0x5986('0x4f')]({'plain':!![]});var _0x203d43=_0x5986('0x51');return db[_0x5986('0x52')][_0x5986('0x4b')]({'where':{'name':_0x203d43,'userProfileId':_0x48251a[_0x5986('0x53')]},'raw':!![]})[_0x5986('0x24')](function(_0x51fbe6){if(_0x51fbe6&&_0x51fbe6[_0x5986('0x54')]===0x0){return db[_0x5986('0x26')]['create']({'name':_0x150873[_0x5986('0x2a')],'resourceId':_0x150873['id'],'type':_0x5986('0x25'),'sectionId':_0x51fbe6['id']},{})['then'](function(){return _0x536592;});}else{return _0x536592;}})[_0x5986('0x47')](function(_0x5d9b4f){logger[_0x5986('0x55')](_0x5986('0x56'),_0x5d9b4f);throw _0x5d9b4f;});}return _0x536592;})[_0x5986('0x24')](respondWithResult(_0x21b341,0xc9))[_0x5986('0x47')](handleError(_0x21b341,null));};exports[_0x5986('0x23')]=function(_0x18c4e0,_0x229110){if(_0x18c4e0[_0x5986('0x4d')]['id']){delete _0x18c4e0['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x18c4e0[_0x5986('0x49')]['id']}})['then'](handleEntityNotFound(_0x229110,null))[_0x5986('0x24')](saveUpdates(_0x18c4e0[_0x5986('0x4d')],null))['then'](respondWithResult(_0x229110,null))[_0x5986('0x47')](handleError(_0x229110,null));};exports[_0x5986('0x27')]=function(_0x362873,_0x3cc633){return db[_0x5986('0x2d')][_0x5986('0x4b')]({'where':{'id':_0x362873['params']['id']}})['then'](handleEntityNotFound(_0x3cc633,null))['then'](removeEntity(_0x3cc633,null))['catch'](handleError(_0x3cc633,null));};exports['preview']=function(_0x15dc0f,_0x39aa92){var _0x543911=0xa;var _0x16b85b=[_0x5986('0x57'),_0x5986('0x58'),_0x5986('0x59'),_0x5986('0x5a')];var _0x493cfd={'SUM':_0x5986('0x5b'),'COUNT':_0x5986('0x5c'),'COUNT DISTINCT':_0x5986('0x5d'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x5986('0x5e'),'GROUP_CONCAT':_0x5986('0x5f'),'GROUP_CONCAT ASC':_0x5986('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xefb502={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5986('0x61'),'HOUR':_0x5986('0x62'),'ROUND':_0x5986('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31469a=function(_0x191386){return!_[_0x5986('0x64')]([_0x5986('0x65'),_0x5986('0x66'),_0x5986('0x67'),'IS\x20NOT\x20EMPTY'],_0x191386);};var _0x2a11cd=function(_0x57c9f6){if(!_0x57c9f6||!_0x57c9f6[_0x5986('0x68')][_0x5986('0x39')]){return'';}for(var _0x3703fc='(',_0x45488d=0x0;_0x45488d<_0x57c9f6[_0x5986('0x68')][_0x5986('0x39')];_0x45488d+=0x1){_0x45488d>0x0&&(_0x3703fc+='\x20'+_0x57c9f6[_0x5986('0x69')]+'\x20');_0x3703fc+=_0x57c9f6[_0x5986('0x68')][_0x45488d][_0x5986('0x6a')]?_0x2a11cd(_0x57c9f6[_0x5986('0x68')][_0x45488d]['group']):_0x57c9f6['rules'][_0x45488d]['field']+'\x20'+_0x57c9f6[_0x5986('0x68')][_0x45488d][_0x5986('0x6b')]+(_0x31469a(_0x57c9f6[_0x5986('0x68')][_0x45488d][_0x5986('0x6b')])?'\x20'+_0x57c9f6[_0x5986('0x68')][_0x45488d]['value']:'');}return _0x3703fc+')';};var _0x36d034={'where':{'id':_0x15dc0f[_0x5986('0x49')]['id']}},_0x4bc446,_0x411872,_0x16b02a,_0x33d5e3,_0x3fb469;_0x36d034=_[_0x5986('0x4a')]({},_0x36d034,_0x15dc0f[_0x5986('0x42')]);return db['AnalyticCustomReport'][_0x5986('0x4b')](_0x36d034)[_0x5986('0x24')](function(_0x56ae80){if(_0x56ae80){_0x4bc446=_0x56ae80;return _0x56ae80[_0x5986('0x6c')]();}return null;})['then'](function(_0x2df2ef){if(_0x2df2ef){if(!_0x2df2ef['length']){throw new db[(_0x5986('0x6d'))][(_0x5986('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x411872=_0x2df2ef;return db['AnalyticMetric'][_0x5986('0x45')]({'raw':!![]});}return null;})[_0x5986('0x24')](function(_0x39da90){if(_0x39da90){_0x16b02a=_[_0x5986('0x6f')](_0x39da90,'id');var _0x1cf74d;var _0x439532=squel[_0x5986('0x70')]();_0x439532[_0x5986('0x71')](_0x4bc446['table']);for(var _0x1c9552=0x0;_0x1c9552<_0x411872[_0x5986('0x39')];_0x1c9552+=0x1){_0x1cf74d=_0x411872[_0x1c9552][_0x5986('0x72')]?_0x16b02a[_0x411872[_0x1c9552]['MetricId']][_0x5986('0x73')]:_0x411872[_0x1c9552]['field'];_0x1cf74d=_0x411872[_0x1c9552]['function']?_[_0x5986('0x74')](_0x493cfd[_0x411872[_0x1c9552][_0x5986('0x75')]],'%s',_0x1cf74d):_0x1cf74d;_0x1cf74d=_0x411872[_0x1c9552][_0x5986('0x76')]?_[_0x5986('0x74')](_0xefb502[_0x411872[_0x1c9552][_0x5986('0x76')]],'%s',_0x1cf74d):_0x1cf74d;if(_0x411872[_0x1c9552]['groupBy']){_0x439532[_0x5986('0x6a')](_0x1cf74d);}_0x411872[_0x1c9552][_0x5986('0x77')]&&_0x439532['order'](_0x1cf74d,_0x411872[_0x1c9552][_0x5986('0x77')]===_0x5986('0x78')?![]:!![]);_0x439532[_0x5986('0x79')](_0x1cf74d,_0x411872[_0x1c9552]['alias']||_0x1cf74d);}if(_0x4bc446['joins']){_0x4bc446[_0x5986('0x7a')]=JSON[_0x5986('0x7b')](_0x4bc446[_0x5986('0x7a')]);for(var _0x14382b=0x0;_0x14382b<_0x4bc446[_0x5986('0x7a')]['length'];_0x14382b+=0x1){if(_0x4bc446[_0x5986('0x7a')][_0x14382b]['type']&&_[_0x5986('0x64')](_0x16b85b,_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x30')])&&_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7c')]&&_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7d')]&&_0x4bc446[_0x5986('0x7a')][_0x14382b]['foreignKey']){_0x439532[_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x30')]](_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7d')],null,util[_0x5986('0x76')](_0x5986('0x7e'),_0x4bc446[_0x5986('0x7f')],_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7c')],_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7d')],_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x80')]));}}}if(_0x4bc446['conditions']){_0x4bc446[_0x5986('0x81')]=JSON[_0x5986('0x7b')](_0x4bc446[_0x5986('0x81')]);_0x439532['where'](_0x2a11cd(_0x4bc446['conditions'][_0x5986('0x6a')]));}_0x3fb469=_0x439532[_0x5986('0x82')]();_0x439532['limit'](_0x543911);_0x439532['offset'](0x0);logger[_0x5986('0x83')](_0x5986('0x84'),_0x439532['toString']());return db[_0x5986('0x85')][_0x5986('0x33')](_0x439532[_0x5986('0x86')](),{'type':db[_0x5986('0x85')][_0x5986('0x87')][_0x5986('0x88')]});}})[_0x5986('0x24')](respondWithResult(_0x39aa92,null))[_0x5986('0x47')](handleError(_0x39aa92,null));};function runReport(_0x449da5,_0x1395e,_0x3fb0dc){var _0x48b1ea=_0x1395e[_0x5986('0x2a')];var _0x223b95=0xa;var _0x3782f1=[_0x5986('0x57'),_0x5986('0x58'),_0x5986('0x59'),'cross_join'];var _0xd808d6={'SUM':_0x5986('0x5b'),'COUNT':_0x5986('0x5c'),'COUNT DISTINCT':_0x5986('0x5d'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x5986('0x5e'),'GROUP_CONCAT':_0x5986('0x5f'),'GROUP_CONCAT ASC':_0x5986('0x60'),'GROUP_CONCAT DESC':_0x5986('0x89')};var _0x4e6e76={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x5986('0x62'),'ROUND':_0x5986('0x63'),'UNIX_TIMESTAMP':_0x5986('0x8a')};var _0x25bd3a=function(_0x2b698c){return!_[_0x5986('0x64')]([_0x5986('0x65'),'IS\x20NOT\x20NULL',_0x5986('0x67'),_0x5986('0x8b')],_0x2b698c);};var _0x2fefde=function(_0x2af2b2){if(!_0x2af2b2||!_0x2af2b2['rules']['length']){return'';}for(var _0x728b87='(',_0x22c886=0x0;_0x22c886<_0x2af2b2[_0x5986('0x68')][_0x5986('0x39')];_0x22c886+=0x1){_0x22c886>0x0&&(_0x728b87+='\x20'+_0x2af2b2[_0x5986('0x69')]+'\x20');_0x728b87+=_0x2af2b2[_0x5986('0x68')][_0x22c886][_0x5986('0x6a')]?_0x2fefde(_0x2af2b2[_0x5986('0x68')][_0x22c886][_0x5986('0x6a')]):_0x2af2b2['rules'][_0x22c886][_0x5986('0x79')]+'\x20'+_0x2af2b2['rules'][_0x22c886][_0x5986('0x6b')]+(_0x25bd3a(_0x2af2b2['rules'][_0x22c886][_0x5986('0x6b')])?'\x20'+_0x2af2b2[_0x5986('0x68')][_0x22c886][_0x5986('0x8c')]:'');}return _0x728b87+')';};var _0x54a0db={'where':{'id':_0x449da5['id']}},_0x2e7ad5,_0x104017,_0x2429aa,_0x1ce58d,_0x171375;_0x54a0db=_[_0x5986('0x4a')]({},_0x54a0db,_0x3fb0dc);return db[_0x5986('0x2d')][_0x5986('0x4b')](_0x54a0db)[_0x5986('0x24')](function(_0x5a0945){if(_0x5a0945){_0x2e7ad5=_0x5a0945;return _0x5a0945[_0x5986('0x6c')]();}return null;})['then'](function(_0x4f33a3){if(_0x4f33a3){if(!_0x4f33a3[_0x5986('0x39')]){throw new db[(_0x5986('0x6d'))][(_0x5986('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x104017=_0x4f33a3;return db[_0x5986('0x8d')][_0x5986('0x45')]({'raw':!![]});}return null;})['then'](function(_0x3ab806){if(_0x3ab806){_0x2429aa=_[_0x5986('0x6f')](_0x3ab806,'id');var _0xdbfe60;var _0x24d75a=squel[_0x5986('0x70')]();_0x24d75a[_0x5986('0x71')](_0x2e7ad5[_0x5986('0x7f')]);for(var _0x303255=0x0;_0x303255<_0x104017[_0x5986('0x39')];_0x303255+=0x1){_0xdbfe60=_0x104017[_0x303255][_0x5986('0x72')]?_0x2429aa[_0x104017[_0x303255]['MetricId']]['metric']:_0x104017[_0x303255][_0x5986('0x79')];_0xdbfe60=_0x104017[_0x303255][_0x5986('0x75')]?_[_0x5986('0x74')](_0xd808d6[_0x104017[_0x303255]['function']],'%s',_0xdbfe60):_0xdbfe60;_0xdbfe60=_0x104017[_0x303255]['format']?_[_0x5986('0x74')](_0x4e6e76[_0x104017[_0x303255][_0x5986('0x76')]],'%s',_0xdbfe60):_0xdbfe60;if(_0x104017[_0x303255][_0x5986('0x8e')]){_0x24d75a[_0x5986('0x6a')](_0xdbfe60);}_0x104017[_0x303255]['orderBy']&&_0x24d75a[_0x5986('0x3c')](_0xdbfe60,_0x104017[_0x303255]['orderBy']===_0x5986('0x78')?![]:!![]);_0x24d75a['field'](_0xdbfe60,_0x104017[_0x303255][_0x5986('0x8f')]||_0xdbfe60);}if(_0x2e7ad5[_0x5986('0x7a')]){_0x2e7ad5[_0x5986('0x7a')]=JSON['parse'](_0x2e7ad5['joins']);for(var _0x1bd417=0x0;_0x1bd417<_0x2e7ad5[_0x5986('0x7a')]['length'];_0x1bd417+=0x1){if(_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['type']&&_[_0x5986('0x64')](_0x3782f1,_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x30')])&&_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['parentKey']&&_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x7d')]&&_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['foreignKey']){_0x24d75a[_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['type']](_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['foreignTable'],null,util['format'](_0x5986('0x7e'),_0x2e7ad5[_0x5986('0x7f')],_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x7c')],_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x7d')],_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x80')]));}}}if(_0x2e7ad5[_0x5986('0x81')]){_0x2e7ad5[_0x5986('0x81')]=JSON[_0x5986('0x7b')](_0x2e7ad5[_0x5986('0x81')]);_0x24d75a[_0x5986('0x40')](_0x2fefde(_0x2e7ad5[_0x5986('0x81')][_0x5986('0x6a')]));}_0x171375=_0x24d75a[_0x5986('0x82')]();_0x24d75a[_0x5986('0x3b')](_0x223b95);_0x24d75a[_0x5986('0x1f')](0x0);logger[_0x5986('0x83')]('Limited\x20Query:',_0x24d75a[_0x5986('0x86')]());return db['sequelize'][_0x5986('0x33')](_0x24d75a[_0x5986('0x86')](),{'type':db[_0x5986('0x85')][_0x5986('0x87')][_0x5986('0x88')]});}})['then'](function(_0x50e0f7){if(!_0x50e0f7[_0x5986('0x39')]){throw new db[(_0x5986('0x6d'))][(_0x5986('0x6e'))](_0x5986('0x90'),0xcc);}if(_0x1395e['output']===_0x5986('0x91')){return null;}var _0x4ac5f2=_[_0x5986('0x4a')](_0x1395e,{'name':_0x1395e[_0x5986('0x92')]||_0x1395e[_0x5986('0x2a')]||_0x2e7ad5[_0x5986('0x2a')],'basename':_0x48b1ea,'savename':util['format']('%s-%s.%s',_0x1395e[_0x5986('0x2a')]||_0x2e7ad5[_0x5986('0x2a')],require(_0x5986('0x93'))[_0x5986('0x94')](0x4),_0x1395e[_0x5986('0x95')]||_0x5986('0x96')),'reportId':_0x2e7ad5['id'],'reportType':_0x5986('0x97')});return db[_0x5986('0x98')][_0x5986('0x4c')](_0x4ac5f2,{'raw':!![]});})[_0x5986('0x24')](function(_0x5a37a1){if(_0x2e7ad5[_0x5986('0x7f')]==='cdr'){_0x171375['where'](_0x2e7ad5[_0x5986('0x7f')]+_0x5986('0x99'),_0x1395e['startDate'],_0x1395e[_0x5986('0x9a')]);}else{_0x171375[_0x5986('0x40')](_0x2e7ad5[_0x5986('0x7f')]+_0x5986('0x9b'),_0x1395e[_0x5986('0x9c')],_0x1395e[_0x5986('0x9a')]);}if(_0x5a37a1){logger[_0x5986('0x9d')](_0x5986('0x9e'),_0x171375[_0x5986('0x86')]());require(_0x5986('0x9f'))['fork'](path[_0x5986('0x57')](__dirname,_0x5986('0xa0'),_0x5a37a1[_0x5986('0x95')]),[_0x5a37a1['id'],_0x171375[_0x5986('0x86')](),path['join'](__dirname,'../../files/reports',_0x5a37a1['savename']),_0x48b1ea]);return _0x5a37a1;}else{var _0x17bb05=squel[_0x5986('0x70')]();_0x17bb05[_0x5986('0x71')]('('+_0x171375[_0x5986('0x86')]()+')',_0x5986('0xa1'));_0x17bb05['field']('COUNT(*)',_0x5986('0x1e'));_0x171375[_0x5986('0x3b')](_0x1395e[_0x5986('0x3b')]||_0x223b95);_0x171375[_0x5986('0x1f')](_0x1395e[_0x5986('0x1f')]||0x0);return dbH[_0x5986('0x85')]['query'](_0x17bb05['toString'](),{'type':dbH[_0x5986('0x85')]['QueryTypes'][_0x5986('0x88')]})[_0x5986('0x24')](function(_0x24eca1){if(!_0x24eca1[_0x5986('0x39')]){_0x1ce58d=0x0;}else{_0x1ce58d=_0x24eca1[0x0]['count']||0x0;}return dbH[_0x5986('0x85')][_0x5986('0x33')](_0x171375['toString'](),{'type':dbH[_0x5986('0x85')][_0x5986('0x87')][_0x5986('0x88')]});})[_0x5986('0x24')](function(_0x9a01bc){return{'rows':_0x9a01bc||[],'count':_0x1ce58d};});}});}exports[_0x5986('0xa2')]=function(_0x258d20,_0x5acffc){return runReport(_0x258d20['params'],_0x258d20[_0x5986('0x33')],_0x258d20[_0x5986('0x42')])['then'](respondWithResult(_0x5acffc,null))[_0x5986('0x47')](handleError(_0x5acffc,null));};exports[_0x5986('0xa3')]=runReport;exports[_0x5986('0x33')]=function(_0xa625b,_0x27f845){var _0x227bb6=0xa;var _0x110f33=[_0x5986('0x57'),_0x5986('0x58'),_0x5986('0x59'),'cross_join'];var _0x19c7c4={'SUM':_0x5986('0x5b'),'COUNT':_0x5986('0x5c'),'COUNT DISTINCT':_0x5986('0x5d'),'MAX':_0x5986('0xa4'),'MIN':_0x5986('0xa5'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5986('0x5f'),'GROUP_CONCAT ASC':_0x5986('0x60'),'GROUP_CONCAT DESC':_0x5986('0x89')};var _0x273a37={'SEC_TO_TIME':_0x5986('0xa6'),'DATE':_0x5986('0x61'),'HOUR':_0x5986('0x62'),'ROUND':_0x5986('0x63'),'UNIX_TIMESTAMP':_0x5986('0x8a')};var _0x52e9a3=function(_0xc46e90){return!_[_0x5986('0x64')](['IS\x20NULL',_0x5986('0x66'),'IS\x20EMPTY',_0x5986('0x8b')],_0xc46e90);};var _0x4f370e=function(_0x1078ff){if(!_0x1078ff||!_0x1078ff[_0x5986('0x68')][_0x5986('0x39')]){return'';}for(var _0x309b59='(',_0x56ecbe=0x0;_0x56ecbe<_0x1078ff['rules'][_0x5986('0x39')];_0x56ecbe+=0x1){_0x56ecbe>0x0&&(_0x309b59+='\x20'+_0x1078ff['operator']+'\x20');_0x309b59+=_0x1078ff['rules'][_0x56ecbe][_0x5986('0x6a')]?_0x4f370e(_0x1078ff[_0x5986('0x68')][_0x56ecbe]['group']):_0x1078ff[_0x5986('0x68')][_0x56ecbe]['field']+'\x20'+_0x1078ff[_0x5986('0x68')][_0x56ecbe][_0x5986('0x6b')]+(_0x52e9a3(_0x1078ff['rules'][_0x56ecbe]['condition'])?'\x20'+_0x1078ff[_0x5986('0x68')][_0x56ecbe]['value']:'');}return _0x309b59+')';};var _0x472ade={'where':{'id':_0xa625b[_0x5986('0x49')]['id']}},_0x57891b,_0x4caa44,_0x45af1c,_0x16b144,_0x3a30bb;_0x472ade=_['merge']({},_0x472ade,_0xa625b['options']);return db[_0x5986('0x2d')][_0x5986('0x4b')](_0x472ade)['then'](function(_0x39827a){if(_0x39827a){_0x57891b=_0x39827a;return _0x39827a[_0x5986('0x6c')]();}return null;})['then'](function(_0x221584){if(_0x221584){if(!_0x221584[_0x5986('0x39')]){throw new db[(_0x5986('0x6d'))][(_0x5986('0x6e'))](_0x5986('0xa7'),0x193);}_0x4caa44=_0x221584;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x56559b){if(_0x56559b){_0x45af1c=_[_0x5986('0x6f')](_0x56559b,'id');var _0x5b1307;var _0x5018e4=squel[_0x5986('0x70')]();_0x5018e4[_0x5986('0x71')](_0x57891b['table']);for(var _0x24467d=0x0;_0x24467d<_0x4caa44[_0x5986('0x39')];_0x24467d+=0x1){_0x5b1307=_0x4caa44[_0x24467d][_0x5986('0x72')]?_0x45af1c[_0x4caa44[_0x24467d]['MetricId']][_0x5986('0x73')]:_0x4caa44[_0x24467d]['field'];_0x5b1307=_0x4caa44[_0x24467d][_0x5986('0x75')]?_['replace'](_0x19c7c4[_0x4caa44[_0x24467d][_0x5986('0x75')]],'%s',_0x5b1307):_0x5b1307;_0x5b1307=_0x4caa44[_0x24467d][_0x5986('0x76')]?_[_0x5986('0x74')](_0x273a37[_0x4caa44[_0x24467d][_0x5986('0x76')]],'%s',_0x5b1307):_0x5b1307;if(_0x4caa44[_0x24467d][_0x5986('0x8e')]){_0x5018e4[_0x5986('0x6a')](_0x5b1307);}_0x4caa44[_0x24467d][_0x5986('0x77')]&&_0x5018e4[_0x5986('0x3c')](_0x5b1307,_0x4caa44[_0x24467d]['orderBy']===_0x5986('0x78')?![]:!![]);_0x5018e4[_0x5986('0x79')](_0x5b1307,_0x4caa44[_0x24467d][_0x5986('0x8f')]||_0x5b1307);}if(_0x57891b[_0x5986('0x7a')]){_0x57891b[_0x5986('0x7a')]=JSON[_0x5986('0x7b')](_0x57891b[_0x5986('0x7a')]);for(var _0x28b022=0x0;_0x28b022<_0x57891b['joins'][_0x5986('0x39')];_0x28b022+=0x1){if(_0x57891b[_0x5986('0x7a')][_0x28b022]['type']&&_[_0x5986('0x64')](_0x110f33,_0x57891b['joins'][_0x28b022]['type'])&&_0x57891b['joins'][_0x28b022][_0x5986('0x7c')]&&_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x7d')]&&_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x80')]){_0x5018e4[_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x30')]](_0x57891b['joins'][_0x28b022]['foreignTable'],null,util[_0x5986('0x76')](_0x5986('0x7e'),_0x57891b['table'],_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x7c')],_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x7d')],_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x80')]));}}}if(_0x57891b[_0x5986('0x81')]){_0x57891b[_0x5986('0x81')]=JSON[_0x5986('0x7b')](_0x57891b[_0x5986('0x81')]);_0x5018e4[_0x5986('0x40')](_0x4f370e(_0x57891b['conditions'][_0x5986('0x6a')]));}_0x3a30bb=_0x5018e4['clone']();_0x5018e4['limit'](_0x227bb6);_0x5018e4[_0x5986('0x1f')](0x0);logger['debug'](_0x5986('0x84'),_0x5018e4[_0x5986('0x86')]());return db[_0x5986('0x85')][_0x5986('0x33')](_0x5018e4[_0x5986('0x86')](),{'type':db[_0x5986('0x85')][_0x5986('0x87')][_0x5986('0x88')]});}})['then'](function(){return{'sql':_0x3a30bb['toString']()};})['then'](respondWithResult(_0x27f845,null))[_0x5986('0x47')](handleError(_0x27f845,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 49c2d12..8436020 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.model.js +++ b/server/api/analyticCustomReport/analyticCustomReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1691=['analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x1691,0x1ed));var _0x1169=function(_0x4b0b3b,_0x2cabb4){_0x4b0b3b=_0x4b0b3b-0x0;var _0x243eec=_0x1691[_0x4b0b3b];return _0x243eec;};'use strict';var _=require(_0x1169('0x0'));var util=require(_0x1169('0x1'));var logger=require('../../config/logger')(_0x1169('0x2'));var moment=require(_0x1169('0x3'));var BPromise=require(_0x1169('0x4'));var rp=require(_0x1169('0x5'));var fs=require('fs');var path=require(_0x1169('0x6'));var rimraf=require(_0x1169('0x7'));var config=require(_0x1169('0x8'));var attributes=require(_0x1169('0x9'));module['exports']=function(_0x31a248,_0x4afc51){return _0x31a248[_0x1169('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x1169('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeca9=['lodash','util','api','moment','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x5dbd62,_0x2579b0){var _0x4bfd3e=function(_0x252d45){while(--_0x252d45){_0x5dbd62['push'](_0x5dbd62['shift']());}};_0x4bfd3e(++_0x2579b0);}(_0xeca9,0x79));var _0x9eca=function(_0x59c69b,_0x5be2c4){_0x59c69b=_0x59c69b-0x0;var _0x12cbe6=_0xeca9[_0x59c69b];return _0x12cbe6;};'use strict';var _=require(_0x9eca('0x0'));var util=require(_0x9eca('0x1'));var logger=require('../../config/logger')(_0x9eca('0x2'));var moment=require(_0x9eca('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9eca('0x4'));var rimraf=require(_0x9eca('0x5'));var config=require(_0x9eca('0x6'));var attributes=require(_0x9eca('0x7'));module['exports']=function(_0x2de5e9,_0x191881){return _0x2de5e9[_0x9eca('0x8')](_0x9eca('0x9'),attributes,{'tableName':_0x9eca('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 64b109b..5baf891 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.rpc.js +++ b/server/api/analyticCustomReport/analyticCustomReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25fa=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x36a560,_0x57378b){var _0x10923a=function(_0xd1fa18){while(--_0xd1fa18){_0x36a560['push'](_0x36a560['shift']());}};_0x10923a(++_0x57378b);}(_0x25fa,0xdb));var _0xa25f=function(_0x27c5ad,_0x3c5cce){_0x27c5ad=_0x27c5ad-0x0;var _0x3cb7af=_0x25fa[_0x27c5ad];return _0x3cb7af;};'use strict';var _=require(_0xa25f('0x0'));var util=require(_0xa25f('0x1'));var moment=require(_0xa25f('0x2'));var BPromise=require(_0xa25f('0x3'));var rs=require(_0xa25f('0x4'));var fs=require('fs');var Redis=require(_0xa25f('0x5'));var db=require(_0xa25f('0x6'))['db'];var utils=require(_0xa25f('0x7'));var logger=require('../../config/logger')(_0xa25f('0x8'));var config=require(_0xa25f('0x9'));var jayson=require(_0xa25f('0xa'));var client=jayson[_0xa25f('0xb')][_0xa25f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x430151,_0x26f7fd,_0x4d52e3){return new BPromise(function(_0x1f8dde,_0xa0100c){return client[_0xa25f('0xd')](_0x430151,_0x4d52e3)[_0xa25f('0xe')](function(_0x38c5a0){logger[_0xa25f('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x26f7fd,_0xa25f('0x10'));logger[_0xa25f('0x11')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x26f7fd,_0xa25f('0x10'),JSON[_0xa25f('0x12')](_0x38c5a0));if(_0x38c5a0[_0xa25f('0x13')]){if(_0x38c5a0[_0xa25f('0x13')][_0xa25f('0x14')]===0x1f4){logger[_0xa25f('0x13')](_0xa25f('0x15'),_0x26f7fd,_0x38c5a0[_0xa25f('0x13')]['message']);return _0xa0100c(_0x38c5a0['error'][_0xa25f('0x16')]);}logger[_0xa25f('0x13')](_0xa25f('0x15'),_0x26f7fd,_0x38c5a0[_0xa25f('0x13')]['message']);return _0x1f8dde(_0x38c5a0['error'][_0xa25f('0x16')]);}else{logger[_0xa25f('0xf')](_0xa25f('0x15'),_0x26f7fd,_0xa25f('0x10'));_0x1f8dde(_0x38c5a0[_0xa25f('0x17')][_0xa25f('0x16')]);}})[_0xa25f('0x18')](function(_0xa9869f){logger[_0xa25f('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x26f7fd,_0xa9869f);_0xa0100c(_0xa9869f);});});} \ No newline at end of file +var _0xb815=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x26f3ea,_0x21db54){var _0x99a77c=function(_0x5be3ca){while(--_0x5be3ca){_0x26f3ea['push'](_0x26f3ea['shift']());}};_0x99a77c(++_0x21db54);}(_0xb815,0xa0));var _0x5b81=function(_0x3e98d1,_0x45e559){_0x3e98d1=_0x3e98d1-0x0;var _0x2fcfb0=_0xb815[_0x3e98d1];return _0x2fcfb0;};'use strict';var _=require(_0x5b81('0x0'));var util=require(_0x5b81('0x1'));var moment=require(_0x5b81('0x2'));var BPromise=require(_0x5b81('0x3'));var rs=require(_0x5b81('0x4'));var fs=require('fs');var Redis=require(_0x5b81('0x5'));var db=require(_0x5b81('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b81('0x7'))(_0x5b81('0x8'));var config=require(_0x5b81('0x9'));var jayson=require(_0x5b81('0xa'));var client=jayson[_0x5b81('0xb')][_0x5b81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f30ab,_0x225465,_0xeb3a44){return new BPromise(function(_0x4fcf45,_0x3912f7){return client[_0x5b81('0xd')](_0x2f30ab,_0xeb3a44)[_0x5b81('0xe')](function(_0x5356e8){logger[_0x5b81('0xf')](_0x5b81('0x10'),_0x225465,_0x5b81('0x11'));logger['debug'](_0x5b81('0x12'),_0x225465,_0x5b81('0x11'),JSON['stringify'](_0x5356e8));if(_0x5356e8[_0x5b81('0x13')]){if(_0x5356e8[_0x5b81('0x13')][_0x5b81('0x14')]===0x1f4){logger[_0x5b81('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x225465,_0x5356e8[_0x5b81('0x13')][_0x5b81('0x15')]);return _0x3912f7(_0x5356e8[_0x5b81('0x13')][_0x5b81('0x15')]);}logger[_0x5b81('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x225465,_0x5356e8[_0x5b81('0x13')]['message']);return _0x4fcf45(_0x5356e8[_0x5b81('0x13')][_0x5b81('0x15')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x225465,_0x5b81('0x11'));_0x4fcf45(_0x5356e8[_0x5b81('0x16')]['message']);}})['catch'](function(_0x5924af){logger[_0x5b81('0x13')](_0x5b81('0x10'),_0x225465,_0x5924af);_0x3912f7(_0x5924af);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 155a8da..46b623e 100644 --- a/server/api/analyticCustomReport/index.js +++ b/server/api/analyticCustomReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d82=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/:id/preview','isAuthenticated','/:id/run','run','/:id/query','query','create','update','delete','destroy','exports','multer','util'];(function(_0x24f49d,_0x22466b){var _0x46e9c7=function(_0x43a1bb){while(--_0x43a1bb){_0x24f49d['push'](_0x24f49d['shift']());}};_0x46e9c7(++_0x22466b);}(_0x7d82,0x12a));var _0x27d8=function(_0x946a92,_0x339762){_0x946a92=_0x946a92-0x0;var _0x58f18b=_0x7d82[_0x946a92];return _0x58f18b;};'use strict';var multer=require(_0x27d8('0x0'));var util=require(_0x27d8('0x1'));var path=require(_0x27d8('0x2'));var timeout=require(_0x27d8('0x3'));var express=require(_0x27d8('0x4'));var router=express[_0x27d8('0x5')]();var auth=require(_0x27d8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x27d8('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x27d8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x27d8('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x27d8('0x8')](_0x27d8('0x9'),auth[_0x27d8('0xa')](),controller['preview']);router[_0x27d8('0x8')](_0x27d8('0xb'),auth[_0x27d8('0xa')](),controller[_0x27d8('0xc')]);router['get'](_0x27d8('0xd'),auth[_0x27d8('0xa')](),controller[_0x27d8('0xe')]);router['post']('/',auth[_0x27d8('0xa')](),controller[_0x27d8('0xf')]);router['put']('/:id',auth[_0x27d8('0xa')](),controller[_0x27d8('0x10')]);router[_0x27d8('0x11')]('/:id',auth[_0x27d8('0xa')](),controller[_0x27d8('0x12')]);module[_0x27d8('0x13')]=router; \ No newline at end of file +var _0x107d=['index','get','/:id','show','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','post','create','delete','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x107d,0x173));var _0xd107=function(_0x4df998,_0x4f3540){_0x4df998=_0x4df998-0x0;var _0xf9deb8=_0x107d[_0x4df998];return _0xf9deb8;};'use strict';var multer=require('multer');var util=require(_0xd107('0x0'));var path=require('path');var timeout=require(_0xd107('0x1'));var express=require(_0xd107('0x2'));var router=express['Router']();var auth=require(_0xd107('0x3'));var interaction=require(_0xd107('0x4'));var config=require(_0xd107('0x5'));var controller=require(_0xd107('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd107('0x7')]);router[_0xd107('0x8')](_0xd107('0x9'),auth['isAuthenticated'](),controller[_0xd107('0xa')]);router[_0xd107('0x8')](_0xd107('0xb'),auth[_0xd107('0xc')](),controller[_0xd107('0xd')]);router[_0xd107('0x8')](_0xd107('0xe'),auth['isAuthenticated'](),controller[_0xd107('0xf')]);router[_0xd107('0x8')](_0xd107('0x10'),auth[_0xd107('0xc')](),controller['query']);router[_0xd107('0x11')]('/',auth[_0xd107('0xc')](),controller[_0xd107('0x12')]);router['put'](_0xd107('0x9'),auth[_0xd107('0xc')](),controller['update']);router[_0xd107('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd107('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 11a8cb7..1224e29 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d19=['sequelize','STRING','TEXT'];(function(_0x4b7894,_0x1e5b7c){var _0x245143=function(_0xe825be){while(--_0xe825be){_0x4b7894['push'](_0x4b7894['shift']());}};_0x245143(++_0x1e5b7c);}(_0x6d19,0xab));var _0x96d1=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x6d19[_0x1d87fc];return _0x492b56;};'use strict';var Sequelize=require(_0x96d1('0x0'));module['exports']={'name':{'type':Sequelize[_0x96d1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x96d1('0x1')]},'parent':{'type':Sequelize[_0x96d1('0x1')]},'table':{'type':Sequelize[_0x96d1('0x1')]},'conditions':{'type':Sequelize[_0x96d1('0x2')]},'joins':{'type':Sequelize[_0x96d1('0x2')]}}; \ No newline at end of file +var _0xb3d1=['STRING','TEXT','sequelize','exports'];(function(_0x2c87fb,_0x3d584a){var _0x22cfd7=function(_0x2af648){while(--_0x2af648){_0x2c87fb['push'](_0x2c87fb['shift']());}};_0x22cfd7(++_0x3d584a);}(_0xb3d1,0x186));var _0x1b3d=function(_0x1e9bf5,_0x2b8466){_0x1e9bf5=_0x1e9bf5-0x0;var _0x3e43a0=_0xb3d1[_0x1e9bf5];return _0x3e43a0;};'use strict';var Sequelize=require(_0x1b3d('0x0'));module[_0x1b3d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1b3d('0x2')]},'parent':{'type':Sequelize[_0x1b3d('0x2')]},'table':{'type':Sequelize[_0x1b3d('0x2')]},'conditions':{'type':Sequelize[_0x1b3d('0x3')]},'joins':{'type':Sequelize[_0x1b3d('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c9f215b..932d40a 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb60=['metric','function','format','replace','orderBy','order','DESC','joins','foreignKey','parentKey','foreignTable','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','from','groupBy','alias','%s.%s\x20=\x20%s.%s','SELECT','No\x20available\x20data','output','web','%s-%s.%s','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','SUM(%s)','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','set','apply','reject','save','destroy','then','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId'];(function(_0x3bed9f,_0x1280eb){var _0x18dec9=function(_0x536544){while(--_0x536544){_0x3bed9f['push'](_0x3bed9f['shift']());}};_0x18dec9(++_0x1280eb);}(_0xdb60,0xd3));var _0x0db6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb60[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0db6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0db6('0x1'));var zipdir=require(_0x0db6('0x2'));var jsonpatch=require(_0x0db6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0db6('0x4'));var Mustache=require(_0x0db6('0x5'));var util=require('util');var path=require(_0x0db6('0x6'));var sox=require(_0x0db6('0x7'));var csv=require(_0x0db6('0x8'));var ejs=require(_0x0db6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0db6('0xa'));var crypto=require('crypto');var jsforce=require(_0x0db6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0db6('0x8'));var querystring=require('querystring');var Papa=require(_0x0db6('0xc'));var Redis=require(_0x0db6('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0db6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0db6('0xf'));var config=require(_0x0db6('0x10'));var licenseUtil=require(_0x0db6('0x11'));var db=require(_0x0db6('0x12'))['db'];var dbH=require(_0x0db6('0x12'))[_0x0db6('0x13')];function respondWithStatusCode(_0x53704b,_0xacb901){_0xacb901=_0xacb901||0xcc;return function(_0x210887){if(_0x210887){return _0x53704b[_0x0db6('0x14')](_0xacb901);}return _0x53704b[_0x0db6('0x15')](_0xacb901)[_0x0db6('0x16')]();};}function respondWithResult(_0x32a5dd,_0x547c15){_0x547c15=_0x547c15||0xc8;return function(_0x405655){if(_0x405655){return _0x32a5dd['status'](_0x547c15)[_0x0db6('0x17')](_0x405655);}};}function respondWithFilteredResult(_0x5a347f,_0x36e768){return function(_0x3ac051){if(_0x3ac051){var _0x393433=_0x3ac051[_0x0db6('0x18')],_0x4c2432=_0x36e768[_0x0db6('0x19')],_0x3d8e35=_0x36e768[_0x0db6('0x19')]+_0x36e768['limit'],_0x30302a;if(_0x3d8e35>=_0x393433){_0x3d8e35=_0x393433;_0x30302a=0xc8;}else{_0x30302a=0xce;}_0x5a347f['status'](_0x30302a);return _0x5a347f[_0x0db6('0x1a')]('Content-Range',_0x4c2432+'-'+_0x3d8e35+'/'+_0x393433)['json'](_0x3ac051);}return null;};}function patchUpdates(_0x2dad1a){return function(_0x4de7c2){try{jsonpatch[_0x0db6('0x1b')](_0x4de7c2,_0x2dad1a,!![]);}catch(_0x572577){return BPromise[_0x0db6('0x1c')](_0x572577);}return _0x4de7c2[_0x0db6('0x1d')]();};}function saveUpdates(_0x5c5c46,_0x83b860){return function(_0x18daf3){if(_0x18daf3){return _0x18daf3['update'](_0x5c5c46)['then'](function(_0x5a9a2f){return _0x5a9a2f;});}return null;};}function removeEntity(_0x5764ee,_0x241ed1){return function(_0x16f6bd){if(_0x16f6bd){return _0x16f6bd[_0x0db6('0x1e')]()[_0x0db6('0x1f')](function(){var _0x14ef00=_0x16f6bd[_0x0db6('0x20')]({'plain':!![]});var _0x417894=_0x0db6('0x21');return db[_0x0db6('0x22')][_0x0db6('0x1e')]({'where':{'type':_0x417894,'resourceId':_0x14ef00['id']}})[_0x0db6('0x1f')](function(){return _0x16f6bd;});})[_0x0db6('0x1f')](function(){_0x5764ee['status'](0xcc)[_0x0db6('0x16')]();});}};}function handleEntityNotFound(_0x1016af,_0x5e9008){return function(_0x38be85){if(!_0x38be85){_0x1016af[_0x0db6('0x14')](0x194);}return _0x38be85;};}function handleError(_0xeaf67d,_0x6af12d){_0x6af12d=_0x6af12d||0x1f4;return function(_0x38350c){logger[_0x0db6('0x23')](_0x38350c[_0x0db6('0x24')]);if(_0x38350c['name']){delete _0x38350c[_0x0db6('0x25')];}_0xeaf67d['status'](_0x6af12d)[_0x0db6('0x26')](_0x38350c);};}exports[_0x0db6('0x27')]=function(_0x8ba7db,_0x4412d3){var _0x9e7f0={},_0x514d9e={},_0x88399b={'count':0x0,'rows':[]};var _0x3af8bc=_[_0x0db6('0x28')](db[_0x0db6('0x29')][_0x0db6('0x2a')],function(_0x5cb7d9){return{'name':_0x5cb7d9[_0x0db6('0x2b')],'type':_0x5cb7d9['type'][_0x0db6('0x2c')]};});_0x514d9e[_0x0db6('0x2d')]=_[_0x0db6('0x28')](_0x3af8bc,_0x0db6('0x25'));_0x514d9e[_0x0db6('0x2e')]=_[_0x0db6('0x2f')](_0x8ba7db['query']);_0x514d9e[_0x0db6('0x30')]=_['intersection'](_0x514d9e[_0x0db6('0x2d')],_0x514d9e['query']);_0x9e7f0[_0x0db6('0x31')]=_[_0x0db6('0x32')](_0x514d9e[_0x0db6('0x2d')],qs[_0x0db6('0x33')](_0x8ba7db['query'][_0x0db6('0x33')]));_0x9e7f0[_0x0db6('0x31')]=_0x9e7f0['attributes'][_0x0db6('0x34')]?_0x9e7f0[_0x0db6('0x31')]:_0x514d9e[_0x0db6('0x2d')];if(!_0x8ba7db[_0x0db6('0x2e')][_0x0db6('0x35')](_0x0db6('0x36'))){_0x9e7f0[_0x0db6('0x37')]=qs[_0x0db6('0x37')](_0x8ba7db[_0x0db6('0x2e')][_0x0db6('0x37')]);_0x9e7f0[_0x0db6('0x19')]=qs['offset'](_0x8ba7db[_0x0db6('0x2e')][_0x0db6('0x19')]);}_0x9e7f0['order']=qs['sort'](_0x8ba7db[_0x0db6('0x2e')]['sort']);_0x9e7f0[_0x0db6('0x38')]=qs[_0x0db6('0x30')](_[_0x0db6('0x39')](_0x8ba7db[_0x0db6('0x2e')],_0x514d9e['filters']),_0x3af8bc);if(_0x8ba7db['query'][_0x0db6('0x3a')]){_0x9e7f0['where']=_[_0x0db6('0x3b')](_0x9e7f0['where'],{'$or':_[_0x0db6('0x28')](_0x3af8bc,function(_0x258af0){if(_0x258af0[_0x0db6('0x3c')]!=='VIRTUAL'){var _0x429c9a={};_0x429c9a[_0x258af0['name']]={'$like':'%'+_0x8ba7db['query'][_0x0db6('0x3a')]+'%'};return _0x429c9a;}})});}_0x9e7f0=_['merge']({},_0x9e7f0,_0x8ba7db[_0x0db6('0x3d')]);var _0x34ed7c={'where':_0x9e7f0[_0x0db6('0x38')]};return db[_0x0db6('0x29')][_0x0db6('0x18')](_0x34ed7c)[_0x0db6('0x1f')](function(_0x782989){_0x88399b[_0x0db6('0x18')]=_0x782989;if(_0x8ba7db[_0x0db6('0x2e')][_0x0db6('0x3e')]){_0x9e7f0['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x0db6('0x3f')](_0x9e7f0);})['then'](function(_0x4c567a){_0x88399b[_0x0db6('0x40')]=_0x4c567a;return _0x88399b;})['then'](respondWithFilteredResult(_0x4412d3,_0x9e7f0))[_0x0db6('0x41')](handleError(_0x4412d3,null));};exports['show']=function(_0x369bfb,_0x2c0c3d){var _0x1d6608={'raw':!![],'where':{'id':_0x369bfb[_0x0db6('0x42')]['id']}},_0x5c9812={};_0x5c9812['model']=_[_0x0db6('0x2f')](db[_0x0db6('0x29')][_0x0db6('0x2a')]);_0x5c9812['query']=_[_0x0db6('0x2f')](_0x369bfb[_0x0db6('0x2e')]);_0x5c9812[_0x0db6('0x30')]=_[_0x0db6('0x32')](_0x5c9812[_0x0db6('0x2d')],_0x5c9812[_0x0db6('0x2e')]);_0x1d6608[_0x0db6('0x31')]=_['intersection'](_0x5c9812[_0x0db6('0x2d')],qs['fields'](_0x369bfb[_0x0db6('0x2e')]['fields']));_0x1d6608['attributes']=_0x1d6608[_0x0db6('0x31')][_0x0db6('0x34')]?_0x1d6608[_0x0db6('0x31')]:_0x5c9812[_0x0db6('0x2d')];if(_0x369bfb['query'][_0x0db6('0x3e')]){_0x1d6608[_0x0db6('0x43')]=[{'all':!![]}];}_0x1d6608=_[_0x0db6('0x3b')]({},_0x1d6608,_0x369bfb['options']);return db[_0x0db6('0x29')][_0x0db6('0x44')](_0x1d6608)[_0x0db6('0x1f')](handleEntityNotFound(_0x2c0c3d,null))[_0x0db6('0x1f')](respondWithResult(_0x2c0c3d,null))[_0x0db6('0x41')](handleError(_0x2c0c3d,null));};exports['create']=function(_0xbe2b0e,_0x3326e2){return db[_0x0db6('0x29')][_0x0db6('0x45')](_0xbe2b0e[_0x0db6('0x46')],{})['then'](function(_0x23bcf7){var _0x2c9a60=_0xbe2b0e[_0x0db6('0x47')][_0x0db6('0x20')]({'plain':!![]});if(!_0x2c9a60)throw new Error(_0x0db6('0x48'));if(_0x2c9a60['role']==='user'){var _0x1fa0d2=_0x23bcf7[_0x0db6('0x20')]({'plain':!![]});var _0x419dad=_0x0db6('0x49');return db[_0x0db6('0x4a')][_0x0db6('0x44')]({'where':{'name':_0x419dad,'userProfileId':_0x2c9a60[_0x0db6('0x4b')]},'raw':!![]})[_0x0db6('0x1f')](function(_0x556cd7){if(_0x556cd7&&_0x556cd7[_0x0db6('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x1fa0d2[_0x0db6('0x25')],'resourceId':_0x1fa0d2['id'],'type':_0x0db6('0x21'),'sectionId':_0x556cd7['id']},{})[_0x0db6('0x1f')](function(){return _0x23bcf7;});}else{return _0x23bcf7;}})[_0x0db6('0x41')](function(_0x32f0ab){logger[_0x0db6('0x23')](_0x0db6('0x4d'),_0x32f0ab);throw _0x32f0ab;});}return _0x23bcf7;})[_0x0db6('0x1f')](respondWithResult(_0x3326e2,0xc9))[_0x0db6('0x41')](handleError(_0x3326e2,null));};exports[_0x0db6('0x4e')]=function(_0x8caad3,_0x49ea34){if(_0x8caad3['body']['id']){delete _0x8caad3[_0x0db6('0x46')]['id'];}return db[_0x0db6('0x29')][_0x0db6('0x44')]({'where':{'id':_0x8caad3[_0x0db6('0x42')]['id']}})[_0x0db6('0x1f')](handleEntityNotFound(_0x49ea34,null))['then'](saveUpdates(_0x8caad3['body'],null))[_0x0db6('0x1f')](respondWithResult(_0x49ea34,null))['catch'](handleError(_0x49ea34,null));};exports[_0x0db6('0x1e')]=function(_0x4199e1,_0x56c054){return db[_0x0db6('0x29')]['find']({'where':{'id':_0x4199e1[_0x0db6('0x42')]['id']}})[_0x0db6('0x1f')](handleEntityNotFound(_0x56c054,null))[_0x0db6('0x1f')](removeEntity(_0x56c054,null))[_0x0db6('0x41')](handleError(_0x56c054,null));};exports[_0x0db6('0x4f')]=function(_0x121f2b,_0x5143ef){var _0x51a9f3=0xa;var _0x32384b=[_0x0db6('0x50'),'left_join',_0x0db6('0x51'),_0x0db6('0x52')];var _0x35ad2c={'SUM':'SUM(%s)','COUNT':_0x0db6('0x53'),'COUNT DISTINCT':_0x0db6('0x54'),'MAX':_0x0db6('0x55'),'MIN':_0x0db6('0x56'),'AVG':_0x0db6('0x57'),'GROUP_CONCAT':_0x0db6('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x29c169={'SEC_TO_TIME':_0x0db6('0x59'),'DATE':_0x0db6('0x5a'),'HOUR':_0x0db6('0x5b'),'ROUND':_0x0db6('0x5c'),'UNIX_TIMESTAMP':_0x0db6('0x5d')};var _0x49ee9b=function(_0x4f52f1){return!_[_0x0db6('0x5e')]([_0x0db6('0x5f'),_0x0db6('0x60'),_0x0db6('0x61'),_0x0db6('0x62')],_0x4f52f1);};var _0x30908e=function(_0x31e0be){if(!_0x31e0be||!_0x31e0be['rules'][_0x0db6('0x34')]){return'';}for(var _0x37f134='(',_0x32a2e0=0x0;_0x32a2e0<_0x31e0be[_0x0db6('0x63')][_0x0db6('0x34')];_0x32a2e0+=0x1){_0x32a2e0>0x0&&(_0x37f134+='\x20'+_0x31e0be[_0x0db6('0x64')]+'\x20');_0x37f134+=_0x31e0be[_0x0db6('0x63')][_0x32a2e0][_0x0db6('0x65')]?_0x30908e(_0x31e0be['rules'][_0x32a2e0][_0x0db6('0x65')]):_0x31e0be[_0x0db6('0x63')][_0x32a2e0][_0x0db6('0x66')]+'\x20'+_0x31e0be['rules'][_0x32a2e0][_0x0db6('0x67')]+(_0x49ee9b(_0x31e0be[_0x0db6('0x63')][_0x32a2e0][_0x0db6('0x67')])?'\x20'+_0x31e0be['rules'][_0x32a2e0][_0x0db6('0x68')]:'');}return _0x37f134+')';};var _0x5a40ee={'where':{'id':_0x121f2b['params']['id']}},_0xb3ad39,_0x3ba333,_0x4e053b,_0x54cfdf,_0x147039;_0x5a40ee=_['merge']({},_0x5a40ee,_0x121f2b[_0x0db6('0x3d')]);return db[_0x0db6('0x29')][_0x0db6('0x44')](_0x5a40ee)['then'](function(_0x2299ec){if(_0x2299ec){_0xb3ad39=_0x2299ec;return _0x2299ec[_0x0db6('0x69')]();}return null;})[_0x0db6('0x1f')](function(_0x39c77f){if(_0x39c77f){if(!_0x39c77f[_0x0db6('0x34')]){throw new db[(_0x0db6('0x6a'))][(_0x0db6('0x6b'))](_0x0db6('0x6c'),0x193);}_0x3ba333=_0x39c77f;return db['AnalyticMetric'][_0x0db6('0x3f')]({'raw':!![]});}return null;})[_0x0db6('0x1f')](function(_0x24b5eb){if(_0x24b5eb){_0x4e053b=_[_0x0db6('0x6d')](_0x24b5eb,'id');var _0x1ba7e2;var _0x2064c1=squel[_0x0db6('0x6e')]();_0x2064c1['from'](_0xb3ad39[_0x0db6('0x6f')]);for(var _0x16166e=0x0;_0x16166e<_0x3ba333[_0x0db6('0x34')];_0x16166e+=0x1){_0x1ba7e2=_0x3ba333[_0x16166e][_0x0db6('0x70')]?_0x4e053b[_0x3ba333[_0x16166e][_0x0db6('0x70')]][_0x0db6('0x71')]:_0x3ba333[_0x16166e][_0x0db6('0x66')];_0x1ba7e2=_0x3ba333[_0x16166e]['function']?_['replace'](_0x35ad2c[_0x3ba333[_0x16166e][_0x0db6('0x72')]],'%s',_0x1ba7e2):_0x1ba7e2;_0x1ba7e2=_0x3ba333[_0x16166e][_0x0db6('0x73')]?_[_0x0db6('0x74')](_0x29c169[_0x3ba333[_0x16166e][_0x0db6('0x73')]],'%s',_0x1ba7e2):_0x1ba7e2;if(_0x3ba333[_0x16166e]['groupBy']){_0x2064c1[_0x0db6('0x65')](_0x1ba7e2);}_0x3ba333[_0x16166e][_0x0db6('0x75')]&&_0x2064c1[_0x0db6('0x76')](_0x1ba7e2,_0x3ba333[_0x16166e][_0x0db6('0x75')]===_0x0db6('0x77')?![]:!![]);_0x2064c1['field'](_0x1ba7e2,_0x3ba333[_0x16166e]['alias']||_0x1ba7e2);}if(_0xb3ad39[_0x0db6('0x78')]){_0xb3ad39['joins']=JSON['parse'](_0xb3ad39[_0x0db6('0x78')]);for(var _0x3aa9c0=0x0;_0x3aa9c0<_0xb3ad39[_0x0db6('0x78')][_0x0db6('0x34')];_0x3aa9c0+=0x1){if(_0xb3ad39['joins'][_0x3aa9c0]['type']&&_[_0x0db6('0x5e')](_0x32384b,_0xb3ad39['joins'][_0x3aa9c0][_0x0db6('0x3c')])&&_0xb3ad39[_0x0db6('0x78')][_0x3aa9c0]['parentKey']&&_0xb3ad39[_0x0db6('0x78')][_0x3aa9c0]['foreignTable']&&_0xb3ad39['joins'][_0x3aa9c0][_0x0db6('0x79')]){_0x2064c1[_0xb3ad39['joins'][_0x3aa9c0][_0x0db6('0x3c')]](_0xb3ad39['joins'][_0x3aa9c0]['foreignTable'],null,util[_0x0db6('0x73')]('%s.%s\x20=\x20%s.%s',_0xb3ad39['table'],_0xb3ad39[_0x0db6('0x78')][_0x3aa9c0][_0x0db6('0x7a')],_0xb3ad39['joins'][_0x3aa9c0][_0x0db6('0x7b')],_0xb3ad39[_0x0db6('0x78')][_0x3aa9c0][_0x0db6('0x79')]));}}}if(_0xb3ad39['conditions']){_0xb3ad39[_0x0db6('0x7c')]=JSON[_0x0db6('0x7d')](_0xb3ad39[_0x0db6('0x7c')]);_0x2064c1[_0x0db6('0x38')](_0x30908e(_0xb3ad39['conditions'][_0x0db6('0x65')]));}_0x147039=_0x2064c1[_0x0db6('0x7e')]();_0x2064c1[_0x0db6('0x37')](_0x51a9f3);_0x2064c1[_0x0db6('0x19')](0x0);logger[_0x0db6('0x7f')](_0x0db6('0x80'),_0x2064c1[_0x0db6('0x81')]());return db['sequelize']['query'](_0x2064c1[_0x0db6('0x81')](),{'type':db[_0x0db6('0x82')][_0x0db6('0x83')]['SELECT']});}})[_0x0db6('0x1f')](respondWithResult(_0x5143ef,null))['catch'](handleError(_0x5143ef,null));};function runReport(_0x24cf8c,_0x2b444d,_0x10d84f){var _0x8d54b8=_0x2b444d[_0x0db6('0x25')];var _0x2344f4=0xa;var _0x309e5b=[_0x0db6('0x50'),_0x0db6('0x84'),_0x0db6('0x51'),_0x0db6('0x52')];var _0x56ec24={'SUM':'SUM(%s)','COUNT':_0x0db6('0x53'),'COUNT DISTINCT':_0x0db6('0x54'),'MAX':_0x0db6('0x55'),'MIN':_0x0db6('0x56'),'AVG':_0x0db6('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0db6('0x85'),'GROUP_CONCAT DESC':_0x0db6('0x86')};var _0x4a43e3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x0db6('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0db6('0x5d')};var _0x1d15bd=function(_0x4ab02c){return!_[_0x0db6('0x5e')]([_0x0db6('0x5f'),_0x0db6('0x60'),_0x0db6('0x61'),_0x0db6('0x62')],_0x4ab02c);};var _0x5e41fc=function(_0x3582fe){if(!_0x3582fe||!_0x3582fe['rules'][_0x0db6('0x34')]){return'';}for(var _0x47d4f9='(',_0x1f590d=0x0;_0x1f590d<_0x3582fe['rules']['length'];_0x1f590d+=0x1){_0x1f590d>0x0&&(_0x47d4f9+='\x20'+_0x3582fe[_0x0db6('0x64')]+'\x20');_0x47d4f9+=_0x3582fe[_0x0db6('0x63')][_0x1f590d][_0x0db6('0x65')]?_0x5e41fc(_0x3582fe[_0x0db6('0x63')][_0x1f590d][_0x0db6('0x65')]):_0x3582fe['rules'][_0x1f590d][_0x0db6('0x66')]+'\x20'+_0x3582fe[_0x0db6('0x63')][_0x1f590d][_0x0db6('0x67')]+(_0x1d15bd(_0x3582fe['rules'][_0x1f590d][_0x0db6('0x67')])?'\x20'+_0x3582fe[_0x0db6('0x63')][_0x1f590d][_0x0db6('0x68')]:'');}return _0x47d4f9+')';};var _0x40e8c7={'where':{'id':_0x24cf8c['id']}},_0x25751b,_0x463411,_0x2f78d8,_0x30016f,_0x429c1c;_0x40e8c7=_[_0x0db6('0x3b')]({},_0x40e8c7,_0x10d84f);return db[_0x0db6('0x29')][_0x0db6('0x44')](_0x40e8c7)[_0x0db6('0x1f')](function(_0x1e77ad){if(_0x1e77ad){_0x25751b=_0x1e77ad;return _0x1e77ad[_0x0db6('0x69')]();}return null;})['then'](function(_0x56af07){if(_0x56af07){if(!_0x56af07[_0x0db6('0x34')]){throw new db[(_0x0db6('0x6a'))][(_0x0db6('0x6b'))](_0x0db6('0x6c'),0x193);}_0x463411=_0x56af07;return db['AnalyticMetric'][_0x0db6('0x3f')]({'raw':!![]});}return null;})[_0x0db6('0x1f')](function(_0x4222bf){if(_0x4222bf){_0x2f78d8=_[_0x0db6('0x6d')](_0x4222bf,'id');var _0x1ab5df;var _0x464afd=squel[_0x0db6('0x6e')]();_0x464afd[_0x0db6('0x87')](_0x25751b['table']);for(var _0x567c0f=0x0;_0x567c0f<_0x463411[_0x0db6('0x34')];_0x567c0f+=0x1){_0x1ab5df=_0x463411[_0x567c0f][_0x0db6('0x70')]?_0x2f78d8[_0x463411[_0x567c0f]['MetricId']][_0x0db6('0x71')]:_0x463411[_0x567c0f][_0x0db6('0x66')];_0x1ab5df=_0x463411[_0x567c0f][_0x0db6('0x72')]?_['replace'](_0x56ec24[_0x463411[_0x567c0f]['function']],'%s',_0x1ab5df):_0x1ab5df;_0x1ab5df=_0x463411[_0x567c0f][_0x0db6('0x73')]?_[_0x0db6('0x74')](_0x4a43e3[_0x463411[_0x567c0f][_0x0db6('0x73')]],'%s',_0x1ab5df):_0x1ab5df;if(_0x463411[_0x567c0f][_0x0db6('0x88')]){_0x464afd['group'](_0x1ab5df);}_0x463411[_0x567c0f][_0x0db6('0x75')]&&_0x464afd[_0x0db6('0x76')](_0x1ab5df,_0x463411[_0x567c0f]['orderBy']==='DESC'?![]:!![]);_0x464afd[_0x0db6('0x66')](_0x1ab5df,_0x463411[_0x567c0f][_0x0db6('0x89')]||_0x1ab5df);}if(_0x25751b[_0x0db6('0x78')]){_0x25751b[_0x0db6('0x78')]=JSON[_0x0db6('0x7d')](_0x25751b[_0x0db6('0x78')]);for(var _0x3623a1=0x0;_0x3623a1<_0x25751b[_0x0db6('0x78')][_0x0db6('0x34')];_0x3623a1+=0x1){if(_0x25751b[_0x0db6('0x78')][_0x3623a1][_0x0db6('0x3c')]&&_['includes'](_0x309e5b,_0x25751b[_0x0db6('0x78')][_0x3623a1]['type'])&&_0x25751b[_0x0db6('0x78')][_0x3623a1][_0x0db6('0x7a')]&&_0x25751b['joins'][_0x3623a1][_0x0db6('0x7b')]&&_0x25751b['joins'][_0x3623a1]['foreignKey']){_0x464afd[_0x25751b[_0x0db6('0x78')][_0x3623a1][_0x0db6('0x3c')]](_0x25751b[_0x0db6('0x78')][_0x3623a1][_0x0db6('0x7b')],null,util[_0x0db6('0x73')](_0x0db6('0x8a'),_0x25751b[_0x0db6('0x6f')],_0x25751b[_0x0db6('0x78')][_0x3623a1][_0x0db6('0x7a')],_0x25751b[_0x0db6('0x78')][_0x3623a1][_0x0db6('0x7b')],_0x25751b[_0x0db6('0x78')][_0x3623a1][_0x0db6('0x79')]));}}}if(_0x25751b[_0x0db6('0x7c')]){_0x25751b['conditions']=JSON[_0x0db6('0x7d')](_0x25751b[_0x0db6('0x7c')]);_0x464afd[_0x0db6('0x38')](_0x5e41fc(_0x25751b[_0x0db6('0x7c')]['group']));}_0x429c1c=_0x464afd[_0x0db6('0x7e')]();_0x464afd[_0x0db6('0x37')](_0x2344f4);_0x464afd['offset'](0x0);logger[_0x0db6('0x7f')](_0x0db6('0x80'),_0x464afd['toString']());return db[_0x0db6('0x82')][_0x0db6('0x2e')](_0x464afd[_0x0db6('0x81')](),{'type':db[_0x0db6('0x82')][_0x0db6('0x83')][_0x0db6('0x8b')]});}})[_0x0db6('0x1f')](function(_0x1e7903){if(!_0x1e7903[_0x0db6('0x34')]){throw new db[(_0x0db6('0x6a'))][(_0x0db6('0x6b'))](_0x0db6('0x8c'),0xcc);}if(_0x2b444d[_0x0db6('0x8d')]===_0x0db6('0x8e')){return null;}var _0x153642=_['merge'](_0x2b444d,{'name':_0x2b444d['fullPath']||_0x2b444d[_0x0db6('0x25')]||_0x25751b[_0x0db6('0x25')],'basename':_0x8d54b8,'savename':util[_0x0db6('0x73')](_0x0db6('0x8f'),_0x2b444d[_0x0db6('0x25')]||_0x25751b[_0x0db6('0x25')],require('randomstring')[_0x0db6('0x90')](0x4),_0x2b444d[_0x0db6('0x8d')]||'csv'),'reportId':_0x25751b['id'],'reportType':_0x0db6('0x91')});return db[_0x0db6('0x92')]['create'](_0x153642,{'raw':!![]});})[_0x0db6('0x1f')](function(_0x386ae0){if(_0x25751b[_0x0db6('0x6f')]==='cdr'){_0x429c1c[_0x0db6('0x38')](_0x25751b[_0x0db6('0x6f')]+_0x0db6('0x93'),_0x2b444d['startDate'],_0x2b444d[_0x0db6('0x94')]);}else{_0x429c1c[_0x0db6('0x38')](_0x25751b['table']+_0x0db6('0x95'),_0x2b444d[_0x0db6('0x96')],_0x2b444d['endDate']);}if(_0x386ae0){logger['info'](_0x0db6('0x97'),_0x429c1c['toString']());require(_0x0db6('0x98'))[_0x0db6('0x99')](path['join'](__dirname,'../../components/export/',_0x386ae0[_0x0db6('0x8d')]),[_0x386ae0['id'],_0x429c1c[_0x0db6('0x81')](),path[_0x0db6('0x50')](__dirname,_0x0db6('0x9a'),_0x386ae0[_0x0db6('0x9b')]),_0x8d54b8]);return _0x386ae0;}else{var _0xb4975a=squel['select']();_0xb4975a[_0x0db6('0x87')]('('+_0x429c1c[_0x0db6('0x81')]()+')',_0x0db6('0x9c'));_0xb4975a[_0x0db6('0x66')](_0x0db6('0x9d'),'count');_0x429c1c[_0x0db6('0x37')](_0x2b444d[_0x0db6('0x37')]||_0x2344f4);_0x429c1c[_0x0db6('0x19')](_0x2b444d[_0x0db6('0x19')]||0x0);return dbH[_0x0db6('0x82')][_0x0db6('0x2e')](_0xb4975a[_0x0db6('0x81')](),{'type':dbH[_0x0db6('0x82')][_0x0db6('0x83')][_0x0db6('0x8b')]})['then'](function(_0x488ba1){if(!_0x488ba1['length']){_0x30016f=0x0;}else{_0x30016f=_0x488ba1[0x0][_0x0db6('0x18')]||0x0;}return dbH[_0x0db6('0x82')]['query'](_0x429c1c[_0x0db6('0x81')](),{'type':dbH[_0x0db6('0x82')][_0x0db6('0x83')]['SELECT']});})[_0x0db6('0x1f')](function(_0x4b2f13){return{'rows':_0x4b2f13||[],'count':_0x30016f};});}});}exports[_0x0db6('0x9e')]=function(_0x35026e,_0x5d8252){return runReport(_0x35026e[_0x0db6('0x42')],_0x35026e[_0x0db6('0x2e')],_0x35026e['options'])['then'](respondWithResult(_0x5d8252,null))['catch'](handleError(_0x5d8252,null));};exports[_0x0db6('0x9f')]=runReport;exports[_0x0db6('0x2e')]=function(_0x5937c3,_0x41b798){var _0x179490=0xa;var _0x18e651=[_0x0db6('0x50'),_0x0db6('0x84'),_0x0db6('0x51'),_0x0db6('0x52')];var _0x191761={'SUM':_0x0db6('0xa0'),'COUNT':_0x0db6('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0db6('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0db6('0x86')};var _0x225314={'SEC_TO_TIME':_0x0db6('0x59'),'DATE':_0x0db6('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x0db6('0x5c'),'UNIX_TIMESTAMP':_0x0db6('0x5d')};var _0x399b74=function(_0x41f5d3){return!_[_0x0db6('0x5e')]([_0x0db6('0x5f'),_0x0db6('0x60'),_0x0db6('0x61'),_0x0db6('0x62')],_0x41f5d3);};var _0x3c8d6c=function(_0x431125){if(!_0x431125||!_0x431125[_0x0db6('0x63')]['length']){return'';}for(var _0x5cb97c='(',_0x27e088=0x0;_0x27e088<_0x431125[_0x0db6('0x63')][_0x0db6('0x34')];_0x27e088+=0x1){_0x27e088>0x0&&(_0x5cb97c+='\x20'+_0x431125[_0x0db6('0x64')]+'\x20');_0x5cb97c+=_0x431125[_0x0db6('0x63')][_0x27e088][_0x0db6('0x65')]?_0x3c8d6c(_0x431125[_0x0db6('0x63')][_0x27e088][_0x0db6('0x65')]):_0x431125['rules'][_0x27e088][_0x0db6('0x66')]+'\x20'+_0x431125['rules'][_0x27e088]['condition']+(_0x399b74(_0x431125[_0x0db6('0x63')][_0x27e088]['condition'])?'\x20'+_0x431125[_0x0db6('0x63')][_0x27e088][_0x0db6('0x68')]:'');}return _0x5cb97c+')';};var _0x30e6be={'where':{'id':_0x5937c3[_0x0db6('0x42')]['id']}},_0x33e1cd,_0x5d2276,_0x37e54b,_0x1bb451,_0x48592a;_0x30e6be=_[_0x0db6('0x3b')]({},_0x30e6be,_0x5937c3[_0x0db6('0x3d')]);return db[_0x0db6('0x29')][_0x0db6('0x44')](_0x30e6be)[_0x0db6('0x1f')](function(_0x47bef4){if(_0x47bef4){_0x33e1cd=_0x47bef4;return _0x47bef4['getFields']();}return null;})[_0x0db6('0x1f')](function(_0x3be93d){if(_0x3be93d){if(!_0x3be93d[_0x0db6('0x34')]){throw new db[(_0x0db6('0x6a'))][(_0x0db6('0x6b'))](_0x0db6('0x6c'),0x193);}_0x5d2276=_0x3be93d;return db[_0x0db6('0xa1')][_0x0db6('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x432fa1){if(_0x432fa1){_0x37e54b=_['keyBy'](_0x432fa1,'id');var _0x4e9ac8;var _0x2ffe4f=squel['select']();_0x2ffe4f[_0x0db6('0x87')](_0x33e1cd[_0x0db6('0x6f')]);for(var _0x45dc36=0x0;_0x45dc36<_0x5d2276['length'];_0x45dc36+=0x1){_0x4e9ac8=_0x5d2276[_0x45dc36][_0x0db6('0x70')]?_0x37e54b[_0x5d2276[_0x45dc36]['MetricId']][_0x0db6('0x71')]:_0x5d2276[_0x45dc36]['field'];_0x4e9ac8=_0x5d2276[_0x45dc36][_0x0db6('0x72')]?_[_0x0db6('0x74')](_0x191761[_0x5d2276[_0x45dc36][_0x0db6('0x72')]],'%s',_0x4e9ac8):_0x4e9ac8;_0x4e9ac8=_0x5d2276[_0x45dc36][_0x0db6('0x73')]?_[_0x0db6('0x74')](_0x225314[_0x5d2276[_0x45dc36]['format']],'%s',_0x4e9ac8):_0x4e9ac8;if(_0x5d2276[_0x45dc36][_0x0db6('0x88')]){_0x2ffe4f[_0x0db6('0x65')](_0x4e9ac8);}_0x5d2276[_0x45dc36]['orderBy']&&_0x2ffe4f[_0x0db6('0x76')](_0x4e9ac8,_0x5d2276[_0x45dc36][_0x0db6('0x75')]===_0x0db6('0x77')?![]:!![]);_0x2ffe4f[_0x0db6('0x66')](_0x4e9ac8,_0x5d2276[_0x45dc36]['alias']||_0x4e9ac8);}if(_0x33e1cd[_0x0db6('0x78')]){_0x33e1cd['joins']=JSON[_0x0db6('0x7d')](_0x33e1cd['joins']);for(var _0x22243d=0x0;_0x22243d<_0x33e1cd['joins'][_0x0db6('0x34')];_0x22243d+=0x1){if(_0x33e1cd[_0x0db6('0x78')][_0x22243d][_0x0db6('0x3c')]&&_[_0x0db6('0x5e')](_0x18e651,_0x33e1cd[_0x0db6('0x78')][_0x22243d][_0x0db6('0x3c')])&&_0x33e1cd['joins'][_0x22243d]['parentKey']&&_0x33e1cd[_0x0db6('0x78')][_0x22243d]['foreignTable']&&_0x33e1cd['joins'][_0x22243d][_0x0db6('0x79')]){_0x2ffe4f[_0x33e1cd[_0x0db6('0x78')][_0x22243d][_0x0db6('0x3c')]](_0x33e1cd[_0x0db6('0x78')][_0x22243d][_0x0db6('0x7b')],null,util['format'](_0x0db6('0x8a'),_0x33e1cd[_0x0db6('0x6f')],_0x33e1cd[_0x0db6('0x78')][_0x22243d][_0x0db6('0x7a')],_0x33e1cd['joins'][_0x22243d][_0x0db6('0x7b')],_0x33e1cd['joins'][_0x22243d]['foreignKey']));}}}if(_0x33e1cd[_0x0db6('0x7c')]){_0x33e1cd[_0x0db6('0x7c')]=JSON[_0x0db6('0x7d')](_0x33e1cd[_0x0db6('0x7c')]);_0x2ffe4f['where'](_0x3c8d6c(_0x33e1cd[_0x0db6('0x7c')][_0x0db6('0x65')]));}_0x48592a=_0x2ffe4f[_0x0db6('0x7e')]();_0x2ffe4f[_0x0db6('0x37')](_0x179490);_0x2ffe4f[_0x0db6('0x19')](0x0);logger[_0x0db6('0x7f')](_0x0db6('0x80'),_0x2ffe4f['toString']());return db[_0x0db6('0x82')]['query'](_0x2ffe4f[_0x0db6('0x81')](),{'type':db[_0x0db6('0x82')][_0x0db6('0x83')][_0x0db6('0x8b')]});}})[_0x0db6('0x1f')](function(){return{'sql':_0x48592a[_0x0db6('0x81')]()};})['then'](respondWithResult(_0x41b798,null))[_0x0db6('0x41')](handleError(_0x41b798,null));}; \ No newline at end of file +var _0x6e0d=['type','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','keys','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','preview','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','SELECT','join','SUM(%s)','COUNT(DISTINCT\x20%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','condition','getFields','Sequelize','keyBy','from','alias','%s.%s\x20=\x20%s.%s','debug','Limited\x20Query:','output','%s-%s.%s','randomstring','generate','csv','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x54d6bd,_0x2fafaf){var _0x3387e2=function(_0x234b2a){while(--_0x234b2a){_0x54d6bd['push'](_0x54d6bd['shift']());}};_0x3387e2(++_0x2fafaf);}(_0x6e0d,0x11c));var _0xd6e0=function(_0x79b695,_0x25ce22){_0x79b695=_0x79b695-0x0;var _0x49bd94=_0x6e0d[_0x79b695];return _0x49bd94;};'use strict';var pdf=require(_0xd6e0('0x0'));var emlformat=require(_0xd6e0('0x1'));var rimraf=require(_0xd6e0('0x2'));var zipdir=require(_0xd6e0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6e0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd6e0('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd6e0('0x6'));var fs=require('fs');var _=require(_0xd6e0('0x7'));var squel=require(_0xd6e0('0x8'));var crypto=require(_0xd6e0('0x9'));var jsforce=require(_0xd6e0('0xa'));var deskjs=require(_0xd6e0('0xb'));var toCsv=require(_0xd6e0('0xc'));var querystring=require(_0xd6e0('0xd'));var Papa=require('papaparse');var Redis=require(_0xd6e0('0xe'));var authService=require(_0xd6e0('0xf'));var qs=require(_0xd6e0('0x10'));var as=require(_0xd6e0('0x11'));var hardwareService=require(_0xd6e0('0x12'));var logger=require(_0xd6e0('0x13'))(_0xd6e0('0x14'));var utils=require(_0xd6e0('0x15'));var config=require(_0xd6e0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6e0('0x17'))['db'];var dbH=require(_0xd6e0('0x17'))[_0xd6e0('0x18')];function respondWithStatusCode(_0x20900b,_0x4e12d9){_0x4e12d9=_0x4e12d9||0xcc;return function(_0x284d81){if(_0x284d81){return _0x20900b['sendStatus'](_0x4e12d9);}return _0x20900b[_0xd6e0('0x19')](_0x4e12d9)[_0xd6e0('0x1a')]();};}function respondWithResult(_0x5a8474,_0x14db3b){_0x14db3b=_0x14db3b||0xc8;return function(_0x351ea7){if(_0x351ea7){return _0x5a8474[_0xd6e0('0x19')](_0x14db3b)['json'](_0x351ea7);}};}function respondWithFilteredResult(_0x4ee253,_0x430454){return function(_0x12d6bc){if(_0x12d6bc){var _0x4d5698=_0x12d6bc[_0xd6e0('0x1b')],_0x152408=_0x430454[_0xd6e0('0x1c')],_0xc60e68=_0x430454[_0xd6e0('0x1c')]+_0x430454['limit'],_0x1e0c84;if(_0xc60e68>=_0x4d5698){_0xc60e68=_0x4d5698;_0x1e0c84=0xc8;}else{_0x1e0c84=0xce;}_0x4ee253[_0xd6e0('0x19')](_0x1e0c84);return _0x4ee253[_0xd6e0('0x1d')](_0xd6e0('0x1e'),_0x152408+'-'+_0xc60e68+'/'+_0x4d5698)['json'](_0x12d6bc);}return null;};}function patchUpdates(_0x40d3f8){return function(_0x1cbd3a){try{jsonpatch[_0xd6e0('0x1f')](_0x1cbd3a,_0x40d3f8,!![]);}catch(_0x214704){return BPromise[_0xd6e0('0x20')](_0x214704);}return _0x1cbd3a[_0xd6e0('0x21')]();};}function saveUpdates(_0x35ff86,_0x5424f2){return function(_0x2dc451){if(_0x2dc451){return _0x2dc451[_0xd6e0('0x22')](_0x35ff86)[_0xd6e0('0x23')](function(_0x3bf1a3){return _0x3bf1a3;});}return null;};}function removeEntity(_0x58d29a,_0x5afb0e){return function(_0x65da56){if(_0x65da56){return _0x65da56['destroy']()[_0xd6e0('0x23')](function(){var _0x21b610=_0x65da56[_0xd6e0('0x24')]({'plain':!![]});var _0x126a2e=_0xd6e0('0x25');return db[_0xd6e0('0x26')]['destroy']({'where':{'type':_0x126a2e,'resourceId':_0x21b610['id']}})['then'](function(){return _0x65da56;});})[_0xd6e0('0x23')](function(){_0x58d29a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e7a71,_0x902721){return function(_0x49764e){if(!_0x49764e){_0x3e7a71[_0xd6e0('0x27')](0x194);}return _0x49764e;};}function handleError(_0x10d005,_0x4380e1){_0x4380e1=_0x4380e1||0x1f4;return function(_0x5c4367){logger[_0xd6e0('0x28')](_0x5c4367[_0xd6e0('0x29')]);if(_0x5c4367[_0xd6e0('0x2a')]){delete _0x5c4367[_0xd6e0('0x2a')];}_0x10d005[_0xd6e0('0x19')](_0x4380e1)[_0xd6e0('0x2b')](_0x5c4367);};}exports[_0xd6e0('0x2c')]=function(_0x58129e,_0x1674d5){var _0x3c1219={},_0x5715c2={},_0xc5d309={'count':0x0,'rows':[]};var _0x3bf92f=_[_0xd6e0('0x2d')](db['AnalyticDefaultReport'][_0xd6e0('0x2e')],function(_0x5d63c4){return{'name':_0x5d63c4[_0xd6e0('0x2f')],'type':_0x5d63c4[_0xd6e0('0x30')]['key']};});_0x5715c2['model']=_['map'](_0x3bf92f,_0xd6e0('0x2a'));_0x5715c2['query']=_['keys'](_0x58129e[_0xd6e0('0x31')]);_0x5715c2[_0xd6e0('0x32')]=_['intersection'](_0x5715c2[_0xd6e0('0x33')],_0x5715c2[_0xd6e0('0x31')]);_0x3c1219['attributes']=_['intersection'](_0x5715c2[_0xd6e0('0x33')],qs['fields'](_0x58129e[_0xd6e0('0x31')][_0xd6e0('0x34')]));_0x3c1219['attributes']=_0x3c1219[_0xd6e0('0x35')][_0xd6e0('0x36')]?_0x3c1219[_0xd6e0('0x35')]:_0x5715c2[_0xd6e0('0x33')];if(!_0x58129e['query'][_0xd6e0('0x37')](_0xd6e0('0x38'))){_0x3c1219[_0xd6e0('0x39')]=qs[_0xd6e0('0x39')](_0x58129e[_0xd6e0('0x31')][_0xd6e0('0x39')]);_0x3c1219[_0xd6e0('0x1c')]=qs['offset'](_0x58129e['query'][_0xd6e0('0x1c')]);}_0x3c1219[_0xd6e0('0x3a')]=qs[_0xd6e0('0x3b')](_0x58129e['query'][_0xd6e0('0x3b')]);_0x3c1219[_0xd6e0('0x3c')]=qs[_0xd6e0('0x32')](_[_0xd6e0('0x3d')](_0x58129e[_0xd6e0('0x31')],_0x5715c2[_0xd6e0('0x32')]),_0x3bf92f);if(_0x58129e['query'][_0xd6e0('0x3e')]){_0x3c1219[_0xd6e0('0x3c')]=_[_0xd6e0('0x3f')](_0x3c1219['where'],{'$or':_[_0xd6e0('0x2d')](_0x3bf92f,function(_0x3c3e70){if(_0x3c3e70[_0xd6e0('0x30')]!==_0xd6e0('0x40')){var _0x4b9bac={};_0x4b9bac[_0x3c3e70[_0xd6e0('0x2a')]]={'$like':'%'+_0x58129e[_0xd6e0('0x31')][_0xd6e0('0x3e')]+'%'};return _0x4b9bac;}})});}_0x3c1219=_[_0xd6e0('0x3f')]({},_0x3c1219,_0x58129e['options']);var _0x5aafae={'where':_0x3c1219['where']};return db[_0xd6e0('0x41')]['count'](_0x5aafae)['then'](function(_0x13aba6){_0xc5d309[_0xd6e0('0x1b')]=_0x13aba6;if(_0x58129e[_0xd6e0('0x31')][_0xd6e0('0x42')]){_0x3c1219[_0xd6e0('0x43')]=[{'all':!![]}];}return db[_0xd6e0('0x41')][_0xd6e0('0x44')](_0x3c1219);})[_0xd6e0('0x23')](function(_0x3fbe5f){_0xc5d309[_0xd6e0('0x45')]=_0x3fbe5f;return _0xc5d309;})[_0xd6e0('0x23')](respondWithFilteredResult(_0x1674d5,_0x3c1219))[_0xd6e0('0x46')](handleError(_0x1674d5,null));};exports['show']=function(_0x1fe806,_0x4c102b){var _0x2ae689={'raw':!![],'where':{'id':_0x1fe806['params']['id']}},_0x256198={};_0x256198[_0xd6e0('0x33')]=_['keys'](db[_0xd6e0('0x41')][_0xd6e0('0x2e')]);_0x256198[_0xd6e0('0x31')]=_[_0xd6e0('0x47')](_0x1fe806[_0xd6e0('0x31')]);_0x256198[_0xd6e0('0x32')]=_[_0xd6e0('0x48')](_0x256198['model'],_0x256198['query']);_0x2ae689[_0xd6e0('0x35')]=_[_0xd6e0('0x48')](_0x256198[_0xd6e0('0x33')],qs['fields'](_0x1fe806[_0xd6e0('0x31')][_0xd6e0('0x34')]));_0x2ae689[_0xd6e0('0x35')]=_0x2ae689[_0xd6e0('0x35')][_0xd6e0('0x36')]?_0x2ae689[_0xd6e0('0x35')]:_0x256198[_0xd6e0('0x33')];if(_0x1fe806[_0xd6e0('0x31')]['includeAll']){_0x2ae689['include']=[{'all':!![]}];}_0x2ae689=_[_0xd6e0('0x3f')]({},_0x2ae689,_0x1fe806[_0xd6e0('0x49')]);return db['AnalyticDefaultReport'][_0xd6e0('0x4a')](_0x2ae689)[_0xd6e0('0x23')](handleEntityNotFound(_0x4c102b,null))[_0xd6e0('0x23')](respondWithResult(_0x4c102b,null))[_0xd6e0('0x46')](handleError(_0x4c102b,null));};exports['create']=function(_0x4d9e62,_0x1e5b9e){return db['AnalyticDefaultReport'][_0xd6e0('0x4b')](_0x4d9e62[_0xd6e0('0x4c')],{})[_0xd6e0('0x23')](function(_0x4e0446){var _0x1ac419=_0x4d9e62[_0xd6e0('0x4d')][_0xd6e0('0x24')]({'plain':!![]});if(!_0x1ac419)throw new Error(_0xd6e0('0x4e'));if(_0x1ac419[_0xd6e0('0x4f')]===_0xd6e0('0x4d')){var _0x4295d6=_0x4e0446[_0xd6e0('0x24')]({'plain':!![]});var _0x14efd6=_0xd6e0('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x14efd6,'userProfileId':_0x1ac419[_0xd6e0('0x51')]},'raw':!![]})[_0xd6e0('0x23')](function(_0x4bd18e){if(_0x4bd18e&&_0x4bd18e[_0xd6e0('0x52')]===0x0){return db[_0xd6e0('0x26')][_0xd6e0('0x4b')]({'name':_0x4295d6['name'],'resourceId':_0x4295d6['id'],'type':'DefaultReports','sectionId':_0x4bd18e['id']},{})['then'](function(){return _0x4e0446;});}else{return _0x4e0446;}})[_0xd6e0('0x46')](function(_0x1a6c12){logger[_0xd6e0('0x28')](_0xd6e0('0x53'),_0x1a6c12);throw _0x1a6c12;});}return _0x4e0446;})[_0xd6e0('0x23')](respondWithResult(_0x1e5b9e,0xc9))[_0xd6e0('0x46')](handleError(_0x1e5b9e,null));};exports[_0xd6e0('0x22')]=function(_0x18d5d4,_0x2add3d){if(_0x18d5d4[_0xd6e0('0x4c')]['id']){delete _0x18d5d4[_0xd6e0('0x4c')]['id'];}return db[_0xd6e0('0x41')]['find']({'where':{'id':_0x18d5d4['params']['id']}})[_0xd6e0('0x23')](handleEntityNotFound(_0x2add3d,null))[_0xd6e0('0x23')](saveUpdates(_0x18d5d4[_0xd6e0('0x4c')],null))[_0xd6e0('0x23')](respondWithResult(_0x2add3d,null))[_0xd6e0('0x46')](handleError(_0x2add3d,null));};exports[_0xd6e0('0x54')]=function(_0x3485d4,_0x5da95b){return db[_0xd6e0('0x41')]['find']({'where':{'id':_0x3485d4[_0xd6e0('0x55')]['id']}})[_0xd6e0('0x23')](handleEntityNotFound(_0x5da95b,null))['then'](removeEntity(_0x5da95b,null))[_0xd6e0('0x46')](handleError(_0x5da95b,null));};exports[_0xd6e0('0x56')]=function(_0x41a50b,_0x34d8fd){var _0x4142df=0xa;var _0x5bd8ec=['join',_0xd6e0('0x57'),_0xd6e0('0x58'),_0xd6e0('0x59')];var _0x54e7ff={'SUM':'SUM(%s)','COUNT':_0xd6e0('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd6e0('0x5b'),'MIN':_0xd6e0('0x5c'),'AVG':_0xd6e0('0x5d'),'GROUP_CONCAT':_0xd6e0('0x5e'),'GROUP_CONCAT ASC':_0xd6e0('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x18e9c6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd6e0('0x60'),'HOUR':_0xd6e0('0x61'),'ROUND':_0xd6e0('0x62'),'UNIX_TIMESTAMP':_0xd6e0('0x63')};var _0x3fbe2b=function(_0x2fea38){return!_[_0xd6e0('0x64')]([_0xd6e0('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xd6e0('0x66')],_0x2fea38);};var _0x13dae3=function(_0x4b87f2){if(!_0x4b87f2||!_0x4b87f2['rules'][_0xd6e0('0x36')]){return'';}for(var _0x13cb04='(',_0x1ccd1a=0x0;_0x1ccd1a<_0x4b87f2[_0xd6e0('0x67')][_0xd6e0('0x36')];_0x1ccd1a+=0x1){_0x1ccd1a>0x0&&(_0x13cb04+='\x20'+_0x4b87f2[_0xd6e0('0x68')]+'\x20');_0x13cb04+=_0x4b87f2['rules'][_0x1ccd1a]['group']?_0x13dae3(_0x4b87f2[_0xd6e0('0x67')][_0x1ccd1a][_0xd6e0('0x69')]):_0x4b87f2[_0xd6e0('0x67')][_0x1ccd1a]['field']+'\x20'+_0x4b87f2[_0xd6e0('0x67')][_0x1ccd1a]['condition']+(_0x3fbe2b(_0x4b87f2['rules'][_0x1ccd1a]['condition'])?'\x20'+_0x4b87f2[_0xd6e0('0x67')][_0x1ccd1a][_0xd6e0('0x6a')]:'');}return _0x13cb04+')';};var _0x39a547={'where':{'id':_0x41a50b[_0xd6e0('0x55')]['id']}},_0xdddaae,_0x20b09e,_0x13d38d,_0x34ae96,_0x288560;_0x39a547=_[_0xd6e0('0x3f')]({},_0x39a547,_0x41a50b[_0xd6e0('0x49')]);return db[_0xd6e0('0x41')][_0xd6e0('0x4a')](_0x39a547)[_0xd6e0('0x23')](function(_0x623e5e){if(_0x623e5e){_0xdddaae=_0x623e5e;return _0x623e5e['getFields']();}return null;})['then'](function(_0x5f4915){if(_0x5f4915){if(!_0x5f4915[_0xd6e0('0x36')]){throw new db['Sequelize'][(_0xd6e0('0x6b'))](_0xd6e0('0x6c'),0x193);}_0x20b09e=_0x5f4915;return db[_0xd6e0('0x6d')][_0xd6e0('0x44')]({'raw':!![]});}return null;})['then'](function(_0x361937){if(_0x361937){_0x13d38d=_['keyBy'](_0x361937,'id');var _0x5a69f7;var _0xd206ab=squel[_0xd6e0('0x6e')]();_0xd206ab['from'](_0xdddaae[_0xd6e0('0x6f')]);for(var _0x3b0479=0x0;_0x3b0479<_0x20b09e['length'];_0x3b0479+=0x1){_0x5a69f7=_0x20b09e[_0x3b0479]['MetricId']?_0x13d38d[_0x20b09e[_0x3b0479][_0xd6e0('0x70')]][_0xd6e0('0x71')]:_0x20b09e[_0x3b0479][_0xd6e0('0x72')];_0x5a69f7=_0x20b09e[_0x3b0479][_0xd6e0('0x73')]?_[_0xd6e0('0x74')](_0x54e7ff[_0x20b09e[_0x3b0479]['function']],'%s',_0x5a69f7):_0x5a69f7;_0x5a69f7=_0x20b09e[_0x3b0479]['format']?_[_0xd6e0('0x74')](_0x18e9c6[_0x20b09e[_0x3b0479][_0xd6e0('0x75')]],'%s',_0x5a69f7):_0x5a69f7;if(_0x20b09e[_0x3b0479][_0xd6e0('0x76')]){_0xd206ab[_0xd6e0('0x69')](_0x5a69f7);}_0x20b09e[_0x3b0479][_0xd6e0('0x77')]&&_0xd206ab[_0xd6e0('0x3a')](_0x5a69f7,_0x20b09e[_0x3b0479][_0xd6e0('0x77')]===_0xd6e0('0x78')?![]:!![]);_0xd206ab[_0xd6e0('0x72')](_0x5a69f7,_0x20b09e[_0x3b0479]['alias']||_0x5a69f7);}if(_0xdddaae[_0xd6e0('0x79')]){_0xdddaae['joins']=JSON[_0xd6e0('0x7a')](_0xdddaae[_0xd6e0('0x79')]);for(var _0x2dd03=0x0;_0x2dd03<_0xdddaae[_0xd6e0('0x79')]['length'];_0x2dd03+=0x1){if(_0xdddaae['joins'][_0x2dd03][_0xd6e0('0x30')]&&_['includes'](_0x5bd8ec,_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x30')])&&_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7b')]&&_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7c')]&&_0xdddaae[_0xd6e0('0x79')][_0x2dd03]['foreignKey']){_0xd206ab[_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x30')]](_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7c')],null,util[_0xd6e0('0x75')]('%s.%s\x20=\x20%s.%s',_0xdddaae['table'],_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7b')],_0xdddaae['joins'][_0x2dd03][_0xd6e0('0x7c')],_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7d')]));}}}if(_0xdddaae['conditions']){_0xdddaae[_0xd6e0('0x7e')]=JSON[_0xd6e0('0x7a')](_0xdddaae[_0xd6e0('0x7e')]);_0xd206ab[_0xd6e0('0x3c')](_0x13dae3(_0xdddaae['conditions'][_0xd6e0('0x69')]));}_0x288560=_0xd206ab[_0xd6e0('0x7f')]();_0xd206ab[_0xd6e0('0x39')](_0x4142df);_0xd206ab['offset'](0x0);logger['debug']('Limited\x20Query:',_0xd206ab[_0xd6e0('0x80')]());return db[_0xd6e0('0x81')][_0xd6e0('0x31')](_0xd206ab[_0xd6e0('0x80')](),{'type':db['sequelize'][_0xd6e0('0x82')][_0xd6e0('0x83')]});}})[_0xd6e0('0x23')](respondWithResult(_0x34d8fd,null))[_0xd6e0('0x46')](handleError(_0x34d8fd,null));};function runReport(_0x2c416f,_0x487e2d,_0x26d07d){var _0x2d0a91=_0x487e2d[_0xd6e0('0x2a')];var _0x2b2d09=0xa;var _0x39026f=[_0xd6e0('0x84'),'left_join','right_join',_0xd6e0('0x59')];var _0x518fde={'SUM':_0xd6e0('0x85'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd6e0('0x86'),'MAX':_0xd6e0('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd6e0('0x5e'),'GROUP_CONCAT ASC':_0xd6e0('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x10b31e={'SEC_TO_TIME':_0xd6e0('0x87'),'DATE':_0xd6e0('0x60'),'HOUR':'HOUR(%s)','ROUND':_0xd6e0('0x62'),'UNIX_TIMESTAMP':_0xd6e0('0x63')};var _0x298b82=function(_0x31f538){return!_[_0xd6e0('0x64')]([_0xd6e0('0x65'),_0xd6e0('0x88'),_0xd6e0('0x89'),_0xd6e0('0x66')],_0x31f538);};var _0x1de95f=function(_0x31b919){if(!_0x31b919||!_0x31b919[_0xd6e0('0x67')][_0xd6e0('0x36')]){return'';}for(var _0x92b9a7='(',_0x745af=0x0;_0x745af<_0x31b919[_0xd6e0('0x67')][_0xd6e0('0x36')];_0x745af+=0x1){_0x745af>0x0&&(_0x92b9a7+='\x20'+_0x31b919[_0xd6e0('0x68')]+'\x20');_0x92b9a7+=_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x69')]?_0x1de95f(_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x69')]):_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x72')]+'\x20'+_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x8a')]+(_0x298b82(_0x31b919[_0xd6e0('0x67')][_0x745af]['condition'])?'\x20'+_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x6a')]:'');}return _0x92b9a7+')';};var _0x4770eb={'where':{'id':_0x2c416f['id']}},_0x28d2fc,_0xd8806b,_0x4e9155,_0x4b0f3d,_0xd855df;_0x4770eb=_['merge']({},_0x4770eb,_0x26d07d);return db[_0xd6e0('0x41')][_0xd6e0('0x4a')](_0x4770eb)[_0xd6e0('0x23')](function(_0x103009){if(_0x103009){_0x28d2fc=_0x103009;return _0x103009[_0xd6e0('0x8b')]();}return null;})[_0xd6e0('0x23')](function(_0xd01f75){if(_0xd01f75){if(!_0xd01f75[_0xd6e0('0x36')]){throw new db[(_0xd6e0('0x8c'))][(_0xd6e0('0x6b'))](_0xd6e0('0x6c'),0x193);}_0xd8806b=_0xd01f75;return db[_0xd6e0('0x6d')][_0xd6e0('0x44')]({'raw':!![]});}return null;})['then'](function(_0x5ee1c6){if(_0x5ee1c6){_0x4e9155=_[_0xd6e0('0x8d')](_0x5ee1c6,'id');var _0x47c4a0;var _0x12b7b3=squel[_0xd6e0('0x6e')]();_0x12b7b3[_0xd6e0('0x8e')](_0x28d2fc[_0xd6e0('0x6f')]);for(var _0x230bb9=0x0;_0x230bb9<_0xd8806b['length'];_0x230bb9+=0x1){_0x47c4a0=_0xd8806b[_0x230bb9]['MetricId']?_0x4e9155[_0xd8806b[_0x230bb9]['MetricId']]['metric']:_0xd8806b[_0x230bb9][_0xd6e0('0x72')];_0x47c4a0=_0xd8806b[_0x230bb9][_0xd6e0('0x73')]?_[_0xd6e0('0x74')](_0x518fde[_0xd8806b[_0x230bb9][_0xd6e0('0x73')]],'%s',_0x47c4a0):_0x47c4a0;_0x47c4a0=_0xd8806b[_0x230bb9][_0xd6e0('0x75')]?_['replace'](_0x10b31e[_0xd8806b[_0x230bb9][_0xd6e0('0x75')]],'%s',_0x47c4a0):_0x47c4a0;if(_0xd8806b[_0x230bb9][_0xd6e0('0x76')]){_0x12b7b3[_0xd6e0('0x69')](_0x47c4a0);}_0xd8806b[_0x230bb9][_0xd6e0('0x77')]&&_0x12b7b3[_0xd6e0('0x3a')](_0x47c4a0,_0xd8806b[_0x230bb9][_0xd6e0('0x77')]===_0xd6e0('0x78')?![]:!![]);_0x12b7b3['field'](_0x47c4a0,_0xd8806b[_0x230bb9][_0xd6e0('0x8f')]||_0x47c4a0);}if(_0x28d2fc[_0xd6e0('0x79')]){_0x28d2fc['joins']=JSON[_0xd6e0('0x7a')](_0x28d2fc['joins']);for(var _0x1c77e9=0x0;_0x1c77e9<_0x28d2fc['joins']['length'];_0x1c77e9+=0x1){if(_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x30')]&&_[_0xd6e0('0x64')](_0x39026f,_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x30')])&&_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9]['parentKey']&&_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x7c')]&&_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9]['foreignKey']){_0x12b7b3[_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9]['type']](_0x28d2fc['joins'][_0x1c77e9][_0xd6e0('0x7c')],null,util[_0xd6e0('0x75')](_0xd6e0('0x90'),_0x28d2fc['table'],_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x7b')],_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x7c')],_0x28d2fc['joins'][_0x1c77e9][_0xd6e0('0x7d')]));}}}if(_0x28d2fc[_0xd6e0('0x7e')]){_0x28d2fc[_0xd6e0('0x7e')]=JSON['parse'](_0x28d2fc[_0xd6e0('0x7e')]);_0x12b7b3[_0xd6e0('0x3c')](_0x1de95f(_0x28d2fc[_0xd6e0('0x7e')][_0xd6e0('0x69')]));}_0xd855df=_0x12b7b3[_0xd6e0('0x7f')]();_0x12b7b3[_0xd6e0('0x39')](_0x2b2d09);_0x12b7b3[_0xd6e0('0x1c')](0x0);logger[_0xd6e0('0x91')](_0xd6e0('0x92'),_0x12b7b3['toString']());return db[_0xd6e0('0x81')]['query'](_0x12b7b3[_0xd6e0('0x80')](),{'type':db[_0xd6e0('0x81')]['QueryTypes'][_0xd6e0('0x83')]});}})['then'](function(_0xde8f01){if(!_0xde8f01['length']){throw new db[(_0xd6e0('0x8c'))][(_0xd6e0('0x6b'))]('No\x20available\x20data',0xcc);}if(_0x487e2d[_0xd6e0('0x93')]==='web'){return null;}var _0x344062=_[_0xd6e0('0x3f')](_0x487e2d,{'name':_0x487e2d['fullPath']||_0x487e2d[_0xd6e0('0x2a')]||_0x28d2fc[_0xd6e0('0x2a')],'basename':_0x2d0a91,'savename':util[_0xd6e0('0x75')](_0xd6e0('0x94'),_0x487e2d[_0xd6e0('0x2a')]||_0x28d2fc[_0xd6e0('0x2a')],require(_0xd6e0('0x95'))[_0xd6e0('0x96')](0x4),_0x487e2d[_0xd6e0('0x93')]||_0xd6e0('0x97')),'reportId':_0x28d2fc['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0xd6e0('0x4b')](_0x344062,{'raw':!![]});})[_0xd6e0('0x23')](function(_0x52675e){if(_0x28d2fc[_0xd6e0('0x6f')]===_0xd6e0('0x98')){_0xd855df[_0xd6e0('0x3c')](_0x28d2fc[_0xd6e0('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x487e2d[_0xd6e0('0x99')],_0x487e2d[_0xd6e0('0x9a')]);}else{_0xd855df[_0xd6e0('0x3c')](_0x28d2fc[_0xd6e0('0x6f')]+_0xd6e0('0x9b'),_0x487e2d[_0xd6e0('0x99')],_0x487e2d[_0xd6e0('0x9a')]);}if(_0x52675e){logger[_0xd6e0('0x9c')](_0xd6e0('0x9d'),_0xd855df[_0xd6e0('0x80')]());require(_0xd6e0('0x9e'))[_0xd6e0('0x9f')](path['join'](__dirname,_0xd6e0('0xa0'),_0x52675e[_0xd6e0('0x93')]),[_0x52675e['id'],_0xd855df[_0xd6e0('0x80')](),path[_0xd6e0('0x84')](__dirname,_0xd6e0('0xa1'),_0x52675e[_0xd6e0('0xa2')]),_0x2d0a91]);return _0x52675e;}else{var _0x429851=squel['select']();_0x429851['from']('('+_0xd855df['toString']()+')',_0xd6e0('0xa3'));_0x429851[_0xd6e0('0x72')]('COUNT(*)','count');_0xd855df[_0xd6e0('0x39')](_0x487e2d[_0xd6e0('0x39')]||_0x2b2d09);_0xd855df[_0xd6e0('0x1c')](_0x487e2d[_0xd6e0('0x1c')]||0x0);return dbH[_0xd6e0('0x81')]['query'](_0x429851['toString'](),{'type':dbH[_0xd6e0('0x81')]['QueryTypes'][_0xd6e0('0x83')]})[_0xd6e0('0x23')](function(_0x28695f){if(!_0x28695f[_0xd6e0('0x36')]){_0x4b0f3d=0x0;}else{_0x4b0f3d=_0x28695f[0x0][_0xd6e0('0x1b')]||0x0;}return dbH['sequelize']['query'](_0xd855df[_0xd6e0('0x80')](),{'type':dbH['sequelize'][_0xd6e0('0x82')][_0xd6e0('0x83')]});})[_0xd6e0('0x23')](function(_0x4a49fc){return{'rows':_0x4a49fc||[],'count':_0x4b0f3d};});}});}exports[_0xd6e0('0xa4')]=function(_0x42c170,_0x5d821a){return runReport(_0x42c170[_0xd6e0('0x55')],_0x42c170['query'],_0x42c170[_0xd6e0('0x49')])[_0xd6e0('0x23')](respondWithResult(_0x5d821a,null))[_0xd6e0('0x46')](handleError(_0x5d821a,null));};exports[_0xd6e0('0xa5')]=runReport;exports[_0xd6e0('0x31')]=function(_0x1dabcb,_0x5610b2){var _0x1cd655=0xa;var _0x424caa=['join',_0xd6e0('0x57'),'right_join',_0xd6e0('0x59')];var _0x2feda4={'SUM':_0xd6e0('0x85'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd6e0('0x86'),'MAX':_0xd6e0('0x5b'),'MIN':_0xd6e0('0x5c'),'AVG':_0xd6e0('0x5d'),'GROUP_CONCAT':_0xd6e0('0x5e'),'GROUP_CONCAT ASC':_0xd6e0('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3e41d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd6e0('0x60'),'HOUR':_0xd6e0('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd6e0('0x63')};var _0x429390=function(_0x41851f){return!_[_0xd6e0('0x64')]([_0xd6e0('0x65'),'IS\x20NOT\x20NULL',_0xd6e0('0x89'),_0xd6e0('0x66')],_0x41851f);};var _0x4a6634=function(_0x292977){if(!_0x292977||!_0x292977['rules'][_0xd6e0('0x36')]){return'';}for(var _0x45754c='(',_0x11e0e1=0x0;_0x11e0e1<_0x292977[_0xd6e0('0x67')][_0xd6e0('0x36')];_0x11e0e1+=0x1){_0x11e0e1>0x0&&(_0x45754c+='\x20'+_0x292977[_0xd6e0('0x68')]+'\x20');_0x45754c+=_0x292977[_0xd6e0('0x67')][_0x11e0e1][_0xd6e0('0x69')]?_0x4a6634(_0x292977[_0xd6e0('0x67')][_0x11e0e1][_0xd6e0('0x69')]):_0x292977['rules'][_0x11e0e1][_0xd6e0('0x72')]+'\x20'+_0x292977['rules'][_0x11e0e1][_0xd6e0('0x8a')]+(_0x429390(_0x292977[_0xd6e0('0x67')][_0x11e0e1][_0xd6e0('0x8a')])?'\x20'+_0x292977[_0xd6e0('0x67')][_0x11e0e1][_0xd6e0('0x6a')]:'');}return _0x45754c+')';};var _0x429799={'where':{'id':_0x1dabcb[_0xd6e0('0x55')]['id']}},_0x5a98d8,_0x1cb3dc,_0x1208b1,_0x5ca320,_0x4e6aa9;_0x429799=_[_0xd6e0('0x3f')]({},_0x429799,_0x1dabcb['options']);return db[_0xd6e0('0x41')][_0xd6e0('0x4a')](_0x429799)[_0xd6e0('0x23')](function(_0x54fae1){if(_0x54fae1){_0x5a98d8=_0x54fae1;return _0x54fae1[_0xd6e0('0x8b')]();}return null;})[_0xd6e0('0x23')](function(_0x1cf891){if(_0x1cf891){if(!_0x1cf891['length']){throw new db[(_0xd6e0('0x8c'))][(_0xd6e0('0x6b'))](_0xd6e0('0x6c'),0x193);}_0x1cb3dc=_0x1cf891;return db[_0xd6e0('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xd6e0('0x23')](function(_0x5eaa04){if(_0x5eaa04){_0x1208b1=_[_0xd6e0('0x8d')](_0x5eaa04,'id');var _0xfc88b;var _0x585d69=squel[_0xd6e0('0x6e')]();_0x585d69[_0xd6e0('0x8e')](_0x5a98d8[_0xd6e0('0x6f')]);for(var _0x24f160=0x0;_0x24f160<_0x1cb3dc['length'];_0x24f160+=0x1){_0xfc88b=_0x1cb3dc[_0x24f160][_0xd6e0('0x70')]?_0x1208b1[_0x1cb3dc[_0x24f160]['MetricId']]['metric']:_0x1cb3dc[_0x24f160]['field'];_0xfc88b=_0x1cb3dc[_0x24f160][_0xd6e0('0x73')]?_[_0xd6e0('0x74')](_0x2feda4[_0x1cb3dc[_0x24f160]['function']],'%s',_0xfc88b):_0xfc88b;_0xfc88b=_0x1cb3dc[_0x24f160][_0xd6e0('0x75')]?_['replace'](_0x3e41d2[_0x1cb3dc[_0x24f160][_0xd6e0('0x75')]],'%s',_0xfc88b):_0xfc88b;if(_0x1cb3dc[_0x24f160][_0xd6e0('0x76')]){_0x585d69[_0xd6e0('0x69')](_0xfc88b);}_0x1cb3dc[_0x24f160][_0xd6e0('0x77')]&&_0x585d69[_0xd6e0('0x3a')](_0xfc88b,_0x1cb3dc[_0x24f160][_0xd6e0('0x77')]===_0xd6e0('0x78')?![]:!![]);_0x585d69[_0xd6e0('0x72')](_0xfc88b,_0x1cb3dc[_0x24f160][_0xd6e0('0x8f')]||_0xfc88b);}if(_0x5a98d8['joins']){_0x5a98d8[_0xd6e0('0x79')]=JSON[_0xd6e0('0x7a')](_0x5a98d8[_0xd6e0('0x79')]);for(var _0x3b70b3=0x0;_0x3b70b3<_0x5a98d8[_0xd6e0('0x79')][_0xd6e0('0x36')];_0x3b70b3+=0x1){if(_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3][_0xd6e0('0x30')]&&_[_0xd6e0('0x64')](_0x424caa,_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3]['type'])&&_0x5a98d8['joins'][_0x3b70b3]['parentKey']&&_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3][_0xd6e0('0x7c')]&&_0x5a98d8['joins'][_0x3b70b3][_0xd6e0('0x7d')]){_0x585d69[_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3]['type']](_0x5a98d8['joins'][_0x3b70b3][_0xd6e0('0x7c')],null,util['format'](_0xd6e0('0x90'),_0x5a98d8[_0xd6e0('0x6f')],_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3][_0xd6e0('0x7b')],_0x5a98d8['joins'][_0x3b70b3][_0xd6e0('0x7c')],_0x5a98d8['joins'][_0x3b70b3][_0xd6e0('0x7d')]));}}}if(_0x5a98d8['conditions']){_0x5a98d8[_0xd6e0('0x7e')]=JSON[_0xd6e0('0x7a')](_0x5a98d8[_0xd6e0('0x7e')]);_0x585d69[_0xd6e0('0x3c')](_0x4a6634(_0x5a98d8['conditions'][_0xd6e0('0x69')]));}_0x4e6aa9=_0x585d69[_0xd6e0('0x7f')]();_0x585d69['limit'](_0x1cd655);_0x585d69[_0xd6e0('0x1c')](0x0);logger[_0xd6e0('0x91')](_0xd6e0('0x92'),_0x585d69[_0xd6e0('0x80')]());return db[_0xd6e0('0x81')][_0xd6e0('0x31')](_0x585d69[_0xd6e0('0x80')](),{'type':db[_0xd6e0('0x81')][_0xd6e0('0x82')][_0xd6e0('0x83')]});}})[_0xd6e0('0x23')](function(){return{'sql':_0x4e6aa9['toString']()};})[_0xd6e0('0x23')](respondWithResult(_0x5610b2,null))['catch'](handleError(_0x5610b2,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a47192f..79aaac2 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.model.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5f9=['bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment'];(function(_0xa22054,_0x464303){var _0x4bee13=function(_0x26b6d7){while(--_0x26b6d7){_0xa22054['push'](_0xa22054['shift']());}};_0x4bee13(++_0x464303);}(_0xf5f9,0x6a));var _0x9f5f=function(_0x462694,_0x214866){_0x462694=_0x462694-0x0;var _0x135819=_0xf5f9[_0x462694];return _0x135819;};'use strict';var _=require(_0x9f5f('0x0'));var util=require(_0x9f5f('0x1'));var logger=require('../../config/logger')(_0x9f5f('0x2'));var moment=require(_0x9f5f('0x3'));var BPromise=require(_0x9f5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f5f('0x5'));var rimraf=require(_0x9f5f('0x6'));var config=require(_0x9f5f('0x7'));var attributes=require(_0x9f5f('0x8'));module['exports']=function(_0x1992f6,_0x3a4855){return _0x1992f6['define'](_0x9f5f('0x9'),attributes,{'tableName':_0x9f5f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6640=['AnalyticDefaultReport','analytics_default_reports','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0xc0ebb8,_0xe977bd){var _0x5f23dc=function(_0x24f053){while(--_0x24f053){_0xc0ebb8['push'](_0xc0ebb8['shift']());}};_0x5f23dc(++_0xe977bd);}(_0x6640,0x160));var _0x0664=function(_0x430095,_0x122722){_0x430095=_0x430095-0x0;var _0x115f8a=_0x6640[_0x430095];return _0x115f8a;};'use strict';var _=require(_0x0664('0x0'));var util=require(_0x0664('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0664('0x2'));var BPromise=require(_0x0664('0x3'));var rp=require(_0x0664('0x4'));var fs=require('fs');var path=require(_0x0664('0x5'));var rimraf=require('rimraf');var config=require(_0x0664('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x0664('0x7')]=function(_0x25a2e9,_0x10d141){return _0x25a2e9['define'](_0x0664('0x8'),attributes,{'tableName':_0x0664('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 6cbe01c..9490bfb 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82b0=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3f9631,_0x1e656d){var _0x2a44ef=function(_0x54c4aa){while(--_0x54c4aa){_0x3f9631['push'](_0x3f9631['shift']());}};_0x2a44ef(++_0x1e656d);}(_0x82b0,0x81));var _0x082b=function(_0x41f4a0,_0x59e659){_0x41f4a0=_0x41f4a0-0x0;var _0x395b4c=_0x82b0[_0x41f4a0];return _0x395b4c;};'use strict';var _=require(_0x082b('0x0'));var util=require(_0x082b('0x1'));var moment=require(_0x082b('0x2'));var BPromise=require('bluebird');var rs=require(_0x082b('0x3'));var fs=require('fs');var Redis=require(_0x082b('0x4'));var db=require(_0x082b('0x5'))['db'];var utils=require(_0x082b('0x6'));var logger=require('../../config/logger')(_0x082b('0x7'));var config=require(_0x082b('0x8'));var jayson=require(_0x082b('0x9'));var client=jayson[_0x082b('0xa')][_0x082b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e8485,_0x16b989,_0x3b9c2a){return new BPromise(function(_0x339585,_0x3ff037){return client[_0x082b('0xc')](_0x5e8485,_0x3b9c2a)[_0x082b('0xd')](function(_0xa65fdf){logger[_0x082b('0xe')](_0x082b('0xf'),_0x16b989,_0x082b('0x10'));logger[_0x082b('0x11')](_0x082b('0x12'),_0x16b989,_0x082b('0x10'),JSON[_0x082b('0x13')](_0xa65fdf));if(_0xa65fdf['error']){if(_0xa65fdf['error'][_0x082b('0x14')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x16b989,_0xa65fdf[_0x082b('0x15')][_0x082b('0x16')]);return _0x3ff037(_0xa65fdf['error'][_0x082b('0x16')]);}logger[_0x082b('0x15')](_0x082b('0xf'),_0x16b989,_0xa65fdf[_0x082b('0x15')][_0x082b('0x16')]);return _0x339585(_0xa65fdf['error'][_0x082b('0x16')]);}else{logger[_0x082b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x16b989,_0x082b('0x10'));_0x339585(_0xa65fdf['result'][_0x082b('0x16')]);}})[_0x082b('0x17')](function(_0x4e5791){logger[_0x082b('0x15')](_0x082b('0xf'),_0x16b989,_0x4e5791);_0x3ff037(_0x4e5791);});});} \ No newline at end of file +var _0xf81a=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x1dfa5e,_0x1e4454){var _0x5ba663=function(_0x1a53ff){while(--_0x1a53ff){_0x1dfa5e['push'](_0x1dfa5e['shift']());}};_0x5ba663(++_0x1e4454);}(_0xf81a,0x16b));var _0xaf81=function(_0x4e856f,_0x46cd50){_0x4e856f=_0x4e856f-0x0;var _0xa634c0=_0xf81a[_0x4e856f];return _0xa634c0;};'use strict';var _=require(_0xaf81('0x0'));var util=require(_0xaf81('0x1'));var moment=require(_0xaf81('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf81('0x3'));var fs=require('fs');var Redis=require(_0xaf81('0x4'));var db=require(_0xaf81('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf81('0x6'))(_0xaf81('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf81('0x8'));var client=jayson[_0xaf81('0x9')][_0xaf81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cfd36,_0x268973,_0x365b31){return new BPromise(function(_0x4c3052,_0x3f0ac8){return client[_0xaf81('0xb')](_0x5cfd36,_0x365b31)[_0xaf81('0xc')](function(_0x3efaaf){logger['info'](_0xaf81('0xd'),_0x268973,_0xaf81('0xe'));logger[_0xaf81('0xf')](_0xaf81('0x10'),_0x268973,_0xaf81('0xe'),JSON[_0xaf81('0x11')](_0x3efaaf));if(_0x3efaaf['error']){if(_0x3efaaf['error'][_0xaf81('0x12')]===0x1f4){logger['error'](_0xaf81('0xd'),_0x268973,_0x3efaaf[_0xaf81('0x13')][_0xaf81('0x14')]);return _0x3f0ac8(_0x3efaaf[_0xaf81('0x13')]['message']);}logger[_0xaf81('0x13')](_0xaf81('0xd'),_0x268973,_0x3efaaf[_0xaf81('0x13')][_0xaf81('0x14')]);return _0x4c3052(_0x3efaaf[_0xaf81('0x13')]['message']);}else{logger[_0xaf81('0x15')](_0xaf81('0xd'),_0x268973,'request\x20sent');_0x4c3052(_0x3efaaf[_0xaf81('0x16')][_0xaf81('0x14')]);}})[_0xaf81('0x17')](function(_0x508df4){logger[_0xaf81('0x13')](_0xaf81('0xd'),_0x268973,_0x508df4);_0x3f0ac8(_0x508df4);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index dc34a76..89602ab 100644 --- a/server/api/analyticDefaultReport/index.js +++ b/server/api/analyticDefaultReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7ce=['/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x3c3365,_0x3c1f5b){var _0x5091ad=function(_0x2d87a9){while(--_0x2d87a9){_0x3c3365['push'](_0x3c3365['shift']());}};_0x5091ad(++_0x3c1f5b);}(_0xf7ce,0x83));var _0xef7c=function(_0x5bda42,_0x3c45e3){_0x5bda42=_0x5bda42-0x0;var _0x27b619=_0xf7ce[_0x5bda42];return _0x27b619;};'use strict';var multer=require(_0xef7c('0x0'));var util=require(_0xef7c('0x1'));var path=require(_0xef7c('0x2'));var timeout=require(_0xef7c('0x3'));var express=require(_0xef7c('0x4'));var router=express[_0xef7c('0x5')]();var auth=require(_0xef7c('0x6'));var interaction=require(_0xef7c('0x7'));var config=require(_0xef7c('0x8'));var controller=require(_0xef7c('0x9'));router[_0xef7c('0xa')]('/',auth[_0xef7c('0xb')](),controller[_0xef7c('0xc')]);router[_0xef7c('0xa')](_0xef7c('0xd'),auth[_0xef7c('0xb')](),controller[_0xef7c('0xe')]);router[_0xef7c('0xa')](_0xef7c('0xf'),auth['isAuthenticated'](),controller[_0xef7c('0x10')]);router[_0xef7c('0xa')]('/:id/run',auth[_0xef7c('0xb')](),controller[_0xef7c('0x11')]);router[_0xef7c('0xa')](_0xef7c('0x12'),auth['isAuthenticated'](),controller[_0xef7c('0x13')]);router[_0xef7c('0x14')]('/',auth[_0xef7c('0xb')](),controller[_0xef7c('0x15')]);router['put'](_0xef7c('0xd'),auth[_0xef7c('0xb')](),controller[_0xef7c('0x16')]);router['delete'](_0xef7c('0xd'),auth[_0xef7c('0xb')](),controller['destroy']);module[_0xef7c('0x17')]=router; \ No newline at end of file +var _0x767d=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','destroy','exports'];(function(_0x4cef35,_0x42dc26){var _0x4752bc=function(_0x54ea54){while(--_0x54ea54){_0x4cef35['push'](_0x4cef35['shift']());}};_0x4752bc(++_0x42dc26);}(_0x767d,0x17a));var _0xd767=function(_0x451224,_0xa75638){_0x451224=_0x451224-0x0;var _0x3b49c1=_0x767d[_0x451224];return _0x3b49c1;};'use strict';var multer=require('multer');var util=require(_0xd767('0x0'));var path=require(_0xd767('0x1'));var timeout=require(_0xd767('0x2'));var express=require('express');var router=express[_0xd767('0x3')]();var auth=require(_0xd767('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd767('0x5'));var controller=require(_0xd767('0x6'));router[_0xd767('0x7')]('/',auth[_0xd767('0x8')](),controller['index']);router['get'](_0xd767('0x9'),auth[_0xd767('0x8')](),controller['show']);router[_0xd767('0x7')](_0xd767('0xa'),auth[_0xd767('0x8')](),controller[_0xd767('0xb')]);router[_0xd767('0x7')](_0xd767('0xc'),auth['isAuthenticated'](),controller[_0xd767('0xd')]);router['get'](_0xd767('0xe'),auth['isAuthenticated'](),controller[_0xd767('0xf')]);router[_0xd767('0x10')]('/',auth[_0xd767('0x8')](),controller[_0xd767('0x11')]);router['put'](_0xd767('0x9'),auth['isAuthenticated'](),controller[_0xd767('0x12')]);router['delete'](_0xd767('0x9'),auth[_0xd767('0x8')](),controller[_0xd767('0x13')]);module[_0xd767('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f282b1d..499abaa 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44c7=['xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x44c7,0x180));var _0x744c=function(_0x614c79,_0x49172a){_0x614c79=_0x614c79-0x0;var _0xbe6bb3=_0x44c7[_0x614c79];return _0xbe6bb3;};'use strict';var Sequelize=require(_0x744c('0x0'));var moment=require('moment');module[_0x744c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x744c('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x744c('0x3')](_0x744c('0x4'),_0x744c('0x5'),_0x744c('0x6')),'allowNull':![],'defaultValue':_0x744c('0x4')},'savename':{'type':Sequelize[_0x744c('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x744c('0x7')]},'endDate':{'type':Sequelize[_0x744c('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x744c('0x8')},'type':{'type':Sequelize[_0x744c('0x3')](_0x744c('0x9'),_0x744c('0xa')),'allowNull':![],'defaultValue':_0x744c('0x9')},'reportId':{'type':Sequelize[_0x744c('0xb')](0xb)[_0x744c('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5482=['xlsx','DATE','Loading','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x47d493,_0x3bedfb){var _0x50242a=function(_0x473bd6){while(--_0x473bd6){_0x47d493['push'](_0x47d493['shift']());}};_0x50242a(++_0x3bedfb);}(_0x5482,0x14b));var _0x2548=function(_0x103965,_0x1b794e){_0x103965=_0x103965-0x0;var _0x40c90b=_0x5482[_0x103965];return _0x40c90b;};'use strict';var Sequelize=require(_0x2548('0x0'));var moment=require(_0x2548('0x1'));module[_0x2548('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x2548('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x2548('0x4')](_0x2548('0x5'),_0x2548('0x6'),_0x2548('0x7')),'allowNull':![],'defaultValue':_0x2548('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x2548('0x8')]},'endDate':{'type':Sequelize[_0x2548('0x8')]},'status':{'type':Sequelize[_0x2548('0x3')],'defaultValue':_0x2548('0x9')},'type':{'type':Sequelize['ENUM'](_0x2548('0xa'),_0x2548('0xb')),'allowNull':![],'defaultValue':_0x2548('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x2548('0xc')]},'reportType':{'type':Sequelize[_0x2548('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 28f1c15..2a68333 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x128c=['ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','then','destroy','get','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','toLowerCase','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv'];(function(_0xa80908,_0x1fbb08){var _0x1e8bed=function(_0x4e45b7){while(--_0x4e45b7){_0xa80908['push'](_0xa80908['shift']());}};_0x1e8bed(++_0x1fbb08);}(_0x128c,0x168));var _0xc128=function(_0x49637b,_0xc06536){_0x49637b=_0x49637b-0x0;var _0x885ad5=_0x128c[_0x49637b];return _0x885ad5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc128('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc128('0x1'));var rp=require(_0xc128('0x2'));var moment=require(_0xc128('0x3'));var BPromise=require(_0xc128('0x4'));var Mustache=require(_0xc128('0x5'));var util=require('util');var path=require(_0xc128('0x6'));var sox=require('sox');var csv=require(_0xc128('0x7'));var ejs=require(_0xc128('0x8'));var fs=require('fs');var _=require(_0xc128('0x9'));var squel=require(_0xc128('0xa'));var crypto=require(_0xc128('0xb'));var jsforce=require(_0xc128('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc128('0x7'));var querystring=require('querystring');var Papa=require(_0xc128('0xd'));var Redis=require(_0xc128('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc128('0xf'));var as=require(_0xc128('0x10'));var hardwareService=require(_0xc128('0x11'));var logger=require(_0xc128('0x12'))(_0xc128('0x13'));var utils=require('../../config/utils');var config=require(_0xc128('0x14'));var licenseUtil=require(_0xc128('0x15'));var db=require(_0xc128('0x16'))['db'];function respondWithStatusCode(_0x3e3325,_0x239b89){_0x239b89=_0x239b89||0xcc;return function(_0x2fafbc){if(_0x2fafbc){return _0x3e3325[_0xc128('0x17')](_0x239b89);}return _0x3e3325[_0xc128('0x18')](_0x239b89)[_0xc128('0x19')]();};}function respondWithResult(_0x5be16d,_0x3f789e){_0x3f789e=_0x3f789e||0xc8;return function(_0x40d57c){if(_0x40d57c){return _0x5be16d[_0xc128('0x18')](_0x3f789e)['json'](_0x40d57c);}};}function respondWithFilteredResult(_0x2bcc7,_0x118096){return function(_0x14ab67){if(_0x14ab67){var _0x1b5f44=_0x14ab67[_0xc128('0x1a')],_0x258213=_0x118096['offset'],_0xa40f89=_0x118096[_0xc128('0x1b')]+_0x118096[_0xc128('0x1c')],_0x401ca2;if(_0xa40f89>=_0x1b5f44){_0xa40f89=_0x1b5f44;_0x401ca2=0xc8;}else{_0x401ca2=0xce;}_0x2bcc7['status'](_0x401ca2);return _0x2bcc7[_0xc128('0x1d')]('Content-Range',_0x258213+'-'+_0xa40f89+'/'+_0x1b5f44)['json'](_0x14ab67);}return null;};}function patchUpdates(_0x1ad5c8){return function(_0x1e4fe6){try{jsonpatch[_0xc128('0x1e')](_0x1e4fe6,_0x1ad5c8,!![]);}catch(_0x336b3f){return BPromise[_0xc128('0x1f')](_0x336b3f);}return _0x1e4fe6[_0xc128('0x20')]();};}function saveUpdates(_0xf11127,_0x26f58f){return function(_0xc50026){if(_0xc50026){return _0xc50026[_0xc128('0x21')](_0xf11127)[_0xc128('0x22')](function(_0x517c19){return _0x517c19;});}return null;};}function removeEntity(_0x7afb55,_0x39052f){return function(_0x137d43){if(_0x137d43){return _0x137d43[_0xc128('0x23')]()[_0xc128('0x22')](function(){var _0x4518d3=_0x137d43[_0xc128('0x24')]({'plain':!![]});var _0x26c2a4='ExtractedReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x26c2a4,'resourceId':_0x4518d3['id']}})[_0xc128('0x22')](function(){return _0x137d43;});})[_0xc128('0x22')](function(){_0x7afb55[_0xc128('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29dcbb,_0xffff4c){return function(_0x56a654){if(!_0x56a654){_0x29dcbb[_0xc128('0x17')](0x194);}return _0x56a654;};}function handleError(_0x53dbe8,_0x510063){_0x510063=_0x510063||0x1f4;return function(_0x4529d9){logger[_0xc128('0x25')](_0x4529d9[_0xc128('0x26')]);if(_0x4529d9['name']){delete _0x4529d9[_0xc128('0x27')];}_0x53dbe8[_0xc128('0x18')](_0x510063)['send'](_0x4529d9);};}exports[_0xc128('0x28')]=function(_0x2f3e89,_0x446acc){var _0x1ca5cc={},_0x3155f6={},_0x35c16a={'count':0x0,'rows':[]};var _0x3007fd=_[_0xc128('0x29')](db[_0xc128('0x2a')][_0xc128('0x2b')],function(_0xd901f7){return{'name':_0xd901f7['fieldName'],'type':_0xd901f7[_0xc128('0x2c')][_0xc128('0x2d')]};});_0x3155f6[_0xc128('0x2e')]=_[_0xc128('0x29')](_0x3007fd,'name');_0x3155f6[_0xc128('0x2f')]=_['keys'](_0x2f3e89[_0xc128('0x2f')]);_0x3155f6['filters']=_['intersection'](_0x3155f6[_0xc128('0x2e')],_0x3155f6[_0xc128('0x2f')]);_0x1ca5cc[_0xc128('0x30')]=_[_0xc128('0x31')](_0x3155f6['model'],qs[_0xc128('0x32')](_0x2f3e89[_0xc128('0x2f')][_0xc128('0x32')]));_0x1ca5cc[_0xc128('0x30')]=_0x1ca5cc[_0xc128('0x30')][_0xc128('0x33')]?_0x1ca5cc[_0xc128('0x30')]:_0x3155f6[_0xc128('0x2e')];if(!_0x2f3e89[_0xc128('0x2f')][_0xc128('0x34')](_0xc128('0x35'))){_0x1ca5cc[_0xc128('0x1c')]=qs[_0xc128('0x1c')](_0x2f3e89[_0xc128('0x2f')][_0xc128('0x1c')]);_0x1ca5cc[_0xc128('0x1b')]=qs[_0xc128('0x1b')](_0x2f3e89[_0xc128('0x2f')]['offset']);}_0x1ca5cc[_0xc128('0x36')]=qs[_0xc128('0x37')](_0x2f3e89['query'][_0xc128('0x37')]);_0x1ca5cc[_0xc128('0x38')]=qs[_0xc128('0x39')](_['pick'](_0x2f3e89[_0xc128('0x2f')],_0x3155f6['filters']),_0x3007fd);if(_0x2f3e89[_0xc128('0x2f')]['filter']){_0x1ca5cc[_0xc128('0x38')]=_['merge'](_0x1ca5cc[_0xc128('0x38')],{'$or':_[_0xc128('0x29')](_0x3007fd,function(_0x5cf92a){if(_0x5cf92a[_0xc128('0x2c')]!=='VIRTUAL'){var _0x217170={};_0x217170[_0x5cf92a['name']]={'$like':'%'+_0x2f3e89[_0xc128('0x2f')][_0xc128('0x3a')]+'%'};return _0x217170;}})});}_0x1ca5cc=_['merge']({},_0x1ca5cc,_0x2f3e89['options']);var _0xa884c9={'where':_0x1ca5cc[_0xc128('0x38')]};return db[_0xc128('0x2a')][_0xc128('0x1a')](_0xa884c9)[_0xc128('0x22')](function(_0x414059){_0x35c16a[_0xc128('0x1a')]=_0x414059;if(_0x2f3e89[_0xc128('0x2f')][_0xc128('0x3b')]){_0x1ca5cc[_0xc128('0x3c')]=[{'all':!![]}];}return db[_0xc128('0x2a')][_0xc128('0x3d')](_0x1ca5cc);})[_0xc128('0x22')](function(_0x5190dc){_0x35c16a[_0xc128('0x3e')]=_0x5190dc;return _0x35c16a;})[_0xc128('0x22')](respondWithFilteredResult(_0x446acc,_0x1ca5cc))[_0xc128('0x3f')](handleError(_0x446acc,null));};exports[_0xc128('0x40')]=function(_0x1ef714,_0x4e4033){var _0x46a97a={'raw':!![],'where':{'id':_0x1ef714['params']['id']}},_0x1e99c2={};_0x1e99c2[_0xc128('0x2e')]=_[_0xc128('0x41')](db['AnalyticExtractedReport'][_0xc128('0x2b')]);_0x1e99c2['query']=_['keys'](_0x1ef714[_0xc128('0x2f')]);_0x1e99c2[_0xc128('0x39')]=_[_0xc128('0x31')](_0x1e99c2[_0xc128('0x2e')],_0x1e99c2[_0xc128('0x2f')]);_0x46a97a[_0xc128('0x30')]=_[_0xc128('0x31')](_0x1e99c2[_0xc128('0x2e')],qs[_0xc128('0x32')](_0x1ef714[_0xc128('0x2f')][_0xc128('0x32')]));_0x46a97a[_0xc128('0x30')]=_0x46a97a[_0xc128('0x30')]['length']?_0x46a97a['attributes']:_0x1e99c2[_0xc128('0x2e')];if(_0x1ef714[_0xc128('0x2f')][_0xc128('0x3b')]){_0x46a97a['include']=[{'all':!![]}];}_0x46a97a=_[_0xc128('0x42')]({},_0x46a97a,_0x1ef714['options']);return db[_0xc128('0x2a')][_0xc128('0x43')](_0x46a97a)[_0xc128('0x22')](handleEntityNotFound(_0x4e4033,null))[_0xc128('0x22')](respondWithResult(_0x4e4033,null))[_0xc128('0x3f')](handleError(_0x4e4033,null));};exports[_0xc128('0x44')]=function(_0x32a912,_0x15130c){return db['AnalyticExtractedReport']['create'](_0x32a912[_0xc128('0x45')],{})[_0xc128('0x22')](function(_0xcf96de){var _0x1e92a3=_0x32a912['user'][_0xc128('0x24')]({'plain':!![]});if(!_0x1e92a3)throw new Error(_0xc128('0x46'));if(_0x1e92a3[_0xc128('0x47')]===_0xc128('0x48')){var _0x4263eb=_0xcf96de['get']({'plain':!![]});var _0xed2d93='ExtractedReports';return db[_0xc128('0x49')]['find']({'where':{'name':_0xed2d93,'userProfileId':_0x1e92a3['userProfileId']},'raw':!![]})['then'](function(_0x58e172){if(_0x58e172&&_0x58e172[_0xc128('0x4a')]===0x0){return db[_0xc128('0x4b')]['create']({'name':_0x4263eb['name'],'resourceId':_0x4263eb['id'],'type':_0x58e172[_0xc128('0x27')],'sectionId':_0x58e172['id']},{})[_0xc128('0x22')](function(){return _0xcf96de;});}else{return _0xcf96de;}})[_0xc128('0x3f')](function(_0x51b1c0){logger[_0xc128('0x25')](_0xc128('0x4c'),_0x51b1c0);throw _0x51b1c0;});}return _0xcf96de;})[_0xc128('0x22')](respondWithResult(_0x15130c,0xc9))[_0xc128('0x3f')](handleError(_0x15130c,null));};exports['update']=function(_0x4801fb,_0x471e49){if(_0x4801fb['body']['id']){delete _0x4801fb[_0xc128('0x45')]['id'];}return db['AnalyticExtractedReport'][_0xc128('0x43')]({'where':{'id':_0x4801fb['params']['id']}})[_0xc128('0x22')](handleEntityNotFound(_0x471e49,null))[_0xc128('0x22')](saveUpdates(_0x4801fb['body'],null))['then'](respondWithResult(_0x471e49,null))[_0xc128('0x3f')](handleError(_0x471e49,null));};exports[_0xc128('0x23')]=function(_0x632b0b,_0x479247){return db[_0xc128('0x2a')]['find']({'where':{'id':_0x632b0b[_0xc128('0x4d')]['id']}})[_0xc128('0x22')](handleEntityNotFound(_0x479247,null))[_0xc128('0x22')](removeEntity(_0x479247,null))[_0xc128('0x3f')](handleError(_0x479247,null));};exports[_0xc128('0x4e')]=function(_0x24c704,_0x3fba7b,_0x45e957){return db[_0xc128('0x2a')][_0xc128('0x43')]({'where':{'id':_0x24c704[_0xc128('0x4d')]['id']},'attributes':[_0xc128('0x27'),_0xc128('0x4f'),_0xc128('0x50'),_0xc128('0x51')],'raw':!![]})[_0xc128('0x22')](handleEntityNotFound(_0x3fba7b,null))[_0xc128('0x22')](function(_0x4e14a7){if(_0x4e14a7){if(!fs[_0xc128('0x52')](path[_0xc128('0x53')](config['root'],_0xc128('0x54'),_0x4e14a7['savename']))){throw new db[(_0xc128('0x55'))]['ValidationError'](_0xc128('0x56'));}if(_0x24c704[_0xc128('0x2f')][_0xc128('0x57')]){return _0x3fba7b[_0xc128('0x17')](0xc8);}return _0x3fba7b[_0xc128('0x4e')](path[_0xc128('0x53')](config[_0xc128('0x58')],'server/files/reports',_0x4e14a7['savename']),util[_0xc128('0x59')](_0xc128('0x5a'),_0x4e14a7[_0xc128('0x4f')]||_0x4e14a7[_0xc128('0x27')],_0x4e14a7[_0xc128('0x51')][_0xc128('0x5b')]()));}})[_0xc128('0x3f')](handleError(_0x3fba7b,null));}; \ No newline at end of file +var _0xcb29=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','join','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2f486c,_0x37162d){var _0x4c2e34=function(_0x41840b){while(--_0x41840b){_0x2f486c['push'](_0x2f486c['shift']());}};_0x4c2e34(++_0x37162d);}(_0xcb29,0x123));var _0x9cb2=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xcb29[_0x5d7227];return _0x15ac55;};'use strict';var pdf=require(_0x9cb2('0x0'));var emlformat=require(_0x9cb2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9cb2('0x2'));var jsonpatch=require(_0x9cb2('0x3'));var rp=require(_0x9cb2('0x4'));var moment=require(_0x9cb2('0x5'));var BPromise=require(_0x9cb2('0x6'));var Mustache=require(_0x9cb2('0x7'));var util=require(_0x9cb2('0x8'));var path=require(_0x9cb2('0x9'));var sox=require(_0x9cb2('0xa'));var csv=require(_0x9cb2('0xb'));var ejs=require(_0x9cb2('0xc'));var fs=require('fs');var _=require(_0x9cb2('0xd'));var squel=require(_0x9cb2('0xe'));var crypto=require(_0x9cb2('0xf'));var jsforce=require(_0x9cb2('0x10'));var deskjs=require(_0x9cb2('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9cb2('0x12'));var Papa=require(_0x9cb2('0x13'));var Redis=require(_0x9cb2('0x14'));var authService=require(_0x9cb2('0x15'));var qs=require(_0x9cb2('0x16'));var as=require(_0x9cb2('0x17'));var hardwareService=require(_0x9cb2('0x18'));var logger=require(_0x9cb2('0x19'))(_0x9cb2('0x1a'));var utils=require(_0x9cb2('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x9cb2('0x1c'));var db=require(_0x9cb2('0x1d'))['db'];function respondWithStatusCode(_0xb84017,_0x361349){_0x361349=_0x361349||0xcc;return function(_0x302e18){if(_0x302e18){return _0xb84017[_0x9cb2('0x1e')](_0x361349);}return _0xb84017[_0x9cb2('0x1f')](_0x361349)['end']();};}function respondWithResult(_0x5a54a7,_0x41676c){_0x41676c=_0x41676c||0xc8;return function(_0x1b3ce3){if(_0x1b3ce3){return _0x5a54a7[_0x9cb2('0x1f')](_0x41676c)['json'](_0x1b3ce3);}};}function respondWithFilteredResult(_0x4ca64e,_0x220ccd){return function(_0x5d1357){if(_0x5d1357){var _0x59b25e=_0x5d1357[_0x9cb2('0x20')],_0x7240d4=_0x220ccd[_0x9cb2('0x21')],_0x11d67a=_0x220ccd['offset']+_0x220ccd[_0x9cb2('0x22')],_0xb5f1cc;if(_0x11d67a>=_0x59b25e){_0x11d67a=_0x59b25e;_0xb5f1cc=0xc8;}else{_0xb5f1cc=0xce;}_0x4ca64e[_0x9cb2('0x1f')](_0xb5f1cc);return _0x4ca64e[_0x9cb2('0x23')](_0x9cb2('0x24'),_0x7240d4+'-'+_0x11d67a+'/'+_0x59b25e)[_0x9cb2('0x25')](_0x5d1357);}return null;};}function patchUpdates(_0x4d47d2){return function(_0x51ca8c){try{jsonpatch[_0x9cb2('0x26')](_0x51ca8c,_0x4d47d2,!![]);}catch(_0x390174){return BPromise[_0x9cb2('0x27')](_0x390174);}return _0x51ca8c[_0x9cb2('0x28')]();};}function saveUpdates(_0xe83b21,_0x5406d5){return function(_0x541407){if(_0x541407){return _0x541407[_0x9cb2('0x29')](_0xe83b21)[_0x9cb2('0x2a')](function(_0x14e328){return _0x14e328;});}return null;};}function removeEntity(_0x83248a,_0x18f2a4){return function(_0x1d88c2){if(_0x1d88c2){return _0x1d88c2[_0x9cb2('0x2b')]()[_0x9cb2('0x2a')](function(){var _0x587a1a=_0x1d88c2[_0x9cb2('0x2c')]({'plain':!![]});var _0x10562d=_0x9cb2('0x2d');return db[_0x9cb2('0x2e')]['destroy']({'where':{'type':_0x10562d,'resourceId':_0x587a1a['id']}})[_0x9cb2('0x2a')](function(){return _0x1d88c2;});})['then'](function(){_0x83248a[_0x9cb2('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ccdc0,_0x13848d){return function(_0x382364){if(!_0x382364){_0x5ccdc0['sendStatus'](0x194);}return _0x382364;};}function handleError(_0x5a8e17,_0x428d54){_0x428d54=_0x428d54||0x1f4;return function(_0x2e7910){logger[_0x9cb2('0x2f')](_0x2e7910[_0x9cb2('0x30')]);if(_0x2e7910[_0x9cb2('0x31')]){delete _0x2e7910[_0x9cb2('0x31')];}_0x5a8e17[_0x9cb2('0x1f')](_0x428d54)[_0x9cb2('0x32')](_0x2e7910);};}exports[_0x9cb2('0x33')]=function(_0x256139,_0x520a3a){var _0x334df7={},_0x962bf={},_0x3f49e0={'count':0x0,'rows':[]};var _0x22678d=_[_0x9cb2('0x34')](db[_0x9cb2('0x35')][_0x9cb2('0x36')],function(_0x209f8f){return{'name':_0x209f8f[_0x9cb2('0x37')],'type':_0x209f8f[_0x9cb2('0x38')][_0x9cb2('0x39')]};});_0x962bf[_0x9cb2('0x3a')]=_[_0x9cb2('0x34')](_0x22678d,_0x9cb2('0x31'));_0x962bf[_0x9cb2('0x3b')]=_['keys'](_0x256139['query']);_0x962bf[_0x9cb2('0x3c')]=_[_0x9cb2('0x3d')](_0x962bf[_0x9cb2('0x3a')],_0x962bf[_0x9cb2('0x3b')]);_0x334df7['attributes']=_[_0x9cb2('0x3d')](_0x962bf[_0x9cb2('0x3a')],qs[_0x9cb2('0x3e')](_0x256139['query'][_0x9cb2('0x3e')]));_0x334df7[_0x9cb2('0x3f')]=_0x334df7[_0x9cb2('0x3f')][_0x9cb2('0x40')]?_0x334df7[_0x9cb2('0x3f')]:_0x962bf[_0x9cb2('0x3a')];if(!_0x256139[_0x9cb2('0x3b')][_0x9cb2('0x41')](_0x9cb2('0x42'))){_0x334df7[_0x9cb2('0x22')]=qs[_0x9cb2('0x22')](_0x256139['query'][_0x9cb2('0x22')]);_0x334df7[_0x9cb2('0x21')]=qs[_0x9cb2('0x21')](_0x256139[_0x9cb2('0x3b')][_0x9cb2('0x21')]);}_0x334df7[_0x9cb2('0x43')]=qs['sort'](_0x256139[_0x9cb2('0x3b')]['sort']);_0x334df7['where']=qs[_0x9cb2('0x3c')](_['pick'](_0x256139[_0x9cb2('0x3b')],_0x962bf[_0x9cb2('0x3c')]),_0x22678d);if(_0x256139['query'][_0x9cb2('0x44')]){_0x334df7[_0x9cb2('0x45')]=_[_0x9cb2('0x46')](_0x334df7[_0x9cb2('0x45')],{'$or':_[_0x9cb2('0x34')](_0x22678d,function(_0x2be3b2){if(_0x2be3b2['type']!==_0x9cb2('0x47')){var _0x4d2dcb={};_0x4d2dcb[_0x2be3b2[_0x9cb2('0x31')]]={'$like':'%'+_0x256139[_0x9cb2('0x3b')][_0x9cb2('0x44')]+'%'};return _0x4d2dcb;}})});}_0x334df7=_[_0x9cb2('0x46')]({},_0x334df7,_0x256139[_0x9cb2('0x48')]);var _0x2da4cd={'where':_0x334df7['where']};return db['AnalyticExtractedReport']['count'](_0x2da4cd)[_0x9cb2('0x2a')](function(_0x4b789a){_0x3f49e0['count']=_0x4b789a;if(_0x256139['query'][_0x9cb2('0x49')]){_0x334df7[_0x9cb2('0x4a')]=[{'all':!![]}];}return db[_0x9cb2('0x35')][_0x9cb2('0x4b')](_0x334df7);})[_0x9cb2('0x2a')](function(_0x8b2cb4){_0x3f49e0[_0x9cb2('0x4c')]=_0x8b2cb4;return _0x3f49e0;})[_0x9cb2('0x2a')](respondWithFilteredResult(_0x520a3a,_0x334df7))['catch'](handleError(_0x520a3a,null));};exports['show']=function(_0x3fa5b1,_0x4e11e7){var _0x3556b5={'raw':!![],'where':{'id':_0x3fa5b1[_0x9cb2('0x4d')]['id']}},_0x203c8d={};_0x203c8d[_0x9cb2('0x3a')]=_['keys'](db[_0x9cb2('0x35')][_0x9cb2('0x36')]);_0x203c8d[_0x9cb2('0x3b')]=_[_0x9cb2('0x4e')](_0x3fa5b1[_0x9cb2('0x3b')]);_0x203c8d[_0x9cb2('0x3c')]=_[_0x9cb2('0x3d')](_0x203c8d[_0x9cb2('0x3a')],_0x203c8d['query']);_0x3556b5[_0x9cb2('0x3f')]=_[_0x9cb2('0x3d')](_0x203c8d[_0x9cb2('0x3a')],qs[_0x9cb2('0x3e')](_0x3fa5b1[_0x9cb2('0x3b')][_0x9cb2('0x3e')]));_0x3556b5[_0x9cb2('0x3f')]=_0x3556b5[_0x9cb2('0x3f')]['length']?_0x3556b5[_0x9cb2('0x3f')]:_0x203c8d[_0x9cb2('0x3a')];if(_0x3fa5b1[_0x9cb2('0x3b')][_0x9cb2('0x49')]){_0x3556b5[_0x9cb2('0x4a')]=[{'all':!![]}];}_0x3556b5=_['merge']({},_0x3556b5,_0x3fa5b1['options']);return db[_0x9cb2('0x35')]['find'](_0x3556b5)[_0x9cb2('0x2a')](handleEntityNotFound(_0x4e11e7,null))[_0x9cb2('0x2a')](respondWithResult(_0x4e11e7,null))[_0x9cb2('0x4f')](handleError(_0x4e11e7,null));};exports[_0x9cb2('0x50')]=function(_0x571d1d,_0x50cb91){return db['AnalyticExtractedReport']['create'](_0x571d1d[_0x9cb2('0x51')],{})[_0x9cb2('0x2a')](function(_0x498e63){var _0x277e9e=_0x571d1d[_0x9cb2('0x52')][_0x9cb2('0x2c')]({'plain':!![]});if(!_0x277e9e)throw new Error(_0x9cb2('0x53'));if(_0x277e9e[_0x9cb2('0x54')]==='user'){var _0x1b02c7=_0x498e63['get']({'plain':!![]});var _0x19680c=_0x9cb2('0x2d');return db['UserProfileSection'][_0x9cb2('0x55')]({'where':{'name':_0x19680c,'userProfileId':_0x277e9e[_0x9cb2('0x56')]},'raw':!![]})[_0x9cb2('0x2a')](function(_0x4f2178){if(_0x4f2178&&_0x4f2178['autoAssociation']===0x0){return db[_0x9cb2('0x2e')][_0x9cb2('0x50')]({'name':_0x1b02c7[_0x9cb2('0x31')],'resourceId':_0x1b02c7['id'],'type':_0x4f2178[_0x9cb2('0x31')],'sectionId':_0x4f2178['id']},{})[_0x9cb2('0x2a')](function(){return _0x498e63;});}else{return _0x498e63;}})[_0x9cb2('0x4f')](function(_0x407e10){logger['error'](_0x9cb2('0x57'),_0x407e10);throw _0x407e10;});}return _0x498e63;})[_0x9cb2('0x2a')](respondWithResult(_0x50cb91,0xc9))[_0x9cb2('0x4f')](handleError(_0x50cb91,null));};exports[_0x9cb2('0x29')]=function(_0x24369a,_0x67b1f3){if(_0x24369a[_0x9cb2('0x51')]['id']){delete _0x24369a[_0x9cb2('0x51')]['id'];}return db[_0x9cb2('0x35')]['find']({'where':{'id':_0x24369a[_0x9cb2('0x4d')]['id']}})[_0x9cb2('0x2a')](handleEntityNotFound(_0x67b1f3,null))['then'](saveUpdates(_0x24369a[_0x9cb2('0x51')],null))[_0x9cb2('0x2a')](respondWithResult(_0x67b1f3,null))['catch'](handleError(_0x67b1f3,null));};exports[_0x9cb2('0x2b')]=function(_0x281080,_0x4529f7){return db['AnalyticExtractedReport'][_0x9cb2('0x55')]({'where':{'id':_0x281080[_0x9cb2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4529f7,null))[_0x9cb2('0x2a')](removeEntity(_0x4529f7,null))[_0x9cb2('0x4f')](handleError(_0x4529f7,null));};exports[_0x9cb2('0x58')]=function(_0x37e930,_0x5020ea,_0x52f5c3){return db[_0x9cb2('0x35')][_0x9cb2('0x55')]({'where':{'id':_0x37e930[_0x9cb2('0x4d')]['id']},'attributes':[_0x9cb2('0x31'),'basename','savename',_0x9cb2('0x59')],'raw':!![]})[_0x9cb2('0x2a')](handleEntityNotFound(_0x5020ea,null))[_0x9cb2('0x2a')](function(_0x315068){if(_0x315068){if(!fs[_0x9cb2('0x5a')](path[_0x9cb2('0x5b')](config[_0x9cb2('0x5c')],_0x9cb2('0x5d'),_0x315068[_0x9cb2('0x5e')]))){throw new db[(_0x9cb2('0x5f'))]['ValidationError'](_0x9cb2('0x60'));}if(_0x37e930[_0x9cb2('0x3b')][_0x9cb2('0x61')]){return _0x5020ea[_0x9cb2('0x1e')](0xc8);}return _0x5020ea[_0x9cb2('0x58')](path['join'](config[_0x9cb2('0x5c')],_0x9cb2('0x5d'),_0x315068[_0x9cb2('0x5e')]),util[_0x9cb2('0x62')](_0x9cb2('0x63'),_0x315068['basename']||_0x315068['name'],_0x315068[_0x9cb2('0x59')][_0x9cb2('0x64')]()));}})[_0x9cb2('0x4f')](handleError(_0x5020ea,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0c25bb9..6f3d023 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.model.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe037=['path','rimraf','./analyticExtractedReport.attributes','exports','lodash','util','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe037,0xb8));var _0x7e03=function(_0x2b2b33,_0x56606f){_0x2b2b33=_0x2b2b33-0x0;var _0x229157=_0xe037[_0x2b2b33];return _0x229157;};'use strict';var _=require(_0x7e03('0x0'));var util=require(_0x7e03('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7e03('0x2'));var BPromise=require(_0x7e03('0x3'));var rp=require(_0x7e03('0x4'));var fs=require('fs');var path=require(_0x7e03('0x5'));var rimraf=require(_0x7e03('0x6'));var config=require('../../config/environment');var attributes=require(_0x7e03('0x7'));module[_0x7e03('0x8')]=function(_0x3fc457,_0x2aac95){return _0x3fc457['define']('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9baf=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x31e387,_0x211c57){var _0x159e7e=function(_0x2763ec){while(--_0x2763ec){_0x31e387['push'](_0x31e387['shift']());}};_0x159e7e(++_0x211c57);}(_0x9baf,0x18b));var _0xf9ba=function(_0x49bc4f,_0x44adb1){_0x49bc4f=_0x49bc4f-0x0;var _0x4ff1a5=_0x9baf[_0x49bc4f];return _0x4ff1a5;};'use strict';var _=require(_0xf9ba('0x0'));var util=require(_0xf9ba('0x1'));var logger=require(_0xf9ba('0x2'))(_0xf9ba('0x3'));var moment=require(_0xf9ba('0x4'));var BPromise=require('bluebird');var rp=require(_0xf9ba('0x5'));var fs=require('fs');var path=require(_0xf9ba('0x6'));var rimraf=require(_0xf9ba('0x7'));var config=require(_0xf9ba('0x8'));var attributes=require(_0xf9ba('0x9'));module[_0xf9ba('0xa')]=function(_0x4beaf7,_0x44142b){return _0x4beaf7[_0xf9ba('0xb')](_0xf9ba('0xc'),attributes,{'tableName':_0xf9ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 947b2db..52ffd2a 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1279=['http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3811d4,_0x506bb5){var _0x489c5a=function(_0x4bbfd2){while(--_0x4bbfd2){_0x3811d4['push'](_0x3811d4['shift']());}};_0x489c5a(++_0x506bb5);}(_0x1279,0x6d));var _0x9127=function(_0x53c17d,_0x1da782){_0x53c17d=_0x53c17d-0x0;var _0x2fa49d=_0x1279[_0x53c17d];return _0x2fa49d;};'use strict';var _=require(_0x9127('0x0'));var util=require(_0x9127('0x1'));var moment=require(_0x9127('0x2'));var BPromise=require(_0x9127('0x3'));var rs=require(_0x9127('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9127('0x5'))['db'];var utils=require(_0x9127('0x6'));var logger=require('../../config/logger')(_0x9127('0x7'));var config=require(_0x9127('0x8'));var jayson=require(_0x9127('0x9'));var client=jayson[_0x9127('0xa')][_0x9127('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a04f8,_0x3d3f6f,_0x4f7503){return new BPromise(function(_0x4e64c2,_0x4c14ed){return client[_0x9127('0xc')](_0x3a04f8,_0x4f7503)['then'](function(_0x95ac){logger[_0x9127('0xd')](_0x9127('0xe'),_0x3d3f6f,_0x9127('0xf'));logger[_0x9127('0x10')](_0x9127('0x11'),_0x3d3f6f,_0x9127('0xf'),JSON[_0x9127('0x12')](_0x95ac));if(_0x95ac[_0x9127('0x13')]){if(_0x95ac[_0x9127('0x13')][_0x9127('0x14')]===0x1f4){logger['error'](_0x9127('0xe'),_0x3d3f6f,_0x95ac[_0x9127('0x13')][_0x9127('0x15')]);return _0x4c14ed(_0x95ac['error'][_0x9127('0x15')]);}logger[_0x9127('0x13')](_0x9127('0xe'),_0x3d3f6f,_0x95ac[_0x9127('0x13')][_0x9127('0x15')]);return _0x4e64c2(_0x95ac[_0x9127('0x13')][_0x9127('0x15')]);}else{logger[_0x9127('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3d3f6f,'request\x20sent');_0x4e64c2(_0x95ac[_0x9127('0x16')][_0x9127('0x15')]);}})[_0x9127('0x17')](function(_0x233035){logger[_0x9127('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3d3f6f,_0x233035);_0x4c14ed(_0x233035);});});} \ No newline at end of file +var _0xc898=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xd7117d,_0x39df47){var _0x4f0e04=function(_0x25999f){while(--_0x25999f){_0xd7117d['push'](_0xd7117d['shift']());}};_0x4f0e04(++_0x39df47);}(_0xc898,0xa2));var _0x8c89=function(_0x37f08d,_0x3aae9d){_0x37f08d=_0x37f08d-0x0;var _0x3432a5=_0xc898[_0x37f08d];return _0x3432a5;};'use strict';var _=require(_0x8c89('0x0'));var util=require(_0x8c89('0x1'));var moment=require(_0x8c89('0x2'));var BPromise=require(_0x8c89('0x3'));var rs=require(_0x8c89('0x4'));var fs=require('fs');var Redis=require(_0x8c89('0x5'));var db=require(_0x8c89('0x6'))['db'];var utils=require(_0x8c89('0x7'));var logger=require(_0x8c89('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8c89('0x9'));var client=jayson['client'][_0x8c89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb28c,_0x239c7f,_0x40c352){return new BPromise(function(_0x2d36f8,_0x532755){return client['request'](_0x5eb28c,_0x40c352)['then'](function(_0x1c261f){logger[_0x8c89('0xb')](_0x8c89('0xc'),_0x239c7f,'request\x20sent');logger[_0x8c89('0xd')](_0x8c89('0xe'),_0x239c7f,_0x8c89('0xf'),JSON[_0x8c89('0x10')](_0x1c261f));if(_0x1c261f[_0x8c89('0x11')]){if(_0x1c261f[_0x8c89('0x11')]['code']===0x1f4){logger[_0x8c89('0x11')](_0x8c89('0xc'),_0x239c7f,_0x1c261f[_0x8c89('0x11')]['message']);return _0x532755(_0x1c261f[_0x8c89('0x11')]['message']);}logger[_0x8c89('0x11')](_0x8c89('0xc'),_0x239c7f,_0x1c261f[_0x8c89('0x11')]['message']);return _0x2d36f8(_0x1c261f['error'][_0x8c89('0x12')]);}else{logger[_0x8c89('0xb')](_0x8c89('0xc'),_0x239c7f,_0x8c89('0xf'));_0x2d36f8(_0x1c261f['result'][_0x8c89('0x12')]);}})[_0x8c89('0x13')](function(_0x291fd8){logger[_0x8c89('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x239c7f,_0x291fd8);_0x532755(_0x291fd8);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d28688c..ef90f39 100644 --- a/server/api/analyticExtractedReport/index.js +++ b/server/api/analyticExtractedReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d0d=['../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','put','update','delete','destroy','util','path','../../components/interaction/service'];(function(_0x3f7b77,_0x5ce116){var _0x57d0ac=function(_0x551c75){while(--_0x551c75){_0x3f7b77['push'](_0x3f7b77['shift']());}};_0x57d0ac(++_0x5ce116);}(_0x1d0d,0x183));var _0xd1d0=function(_0x5a5821,_0x1ea9f9){_0x5a5821=_0x5a5821-0x0;var _0x3d4ed9=_0x1d0d[_0x5a5821];return _0x3d4ed9;};'use strict';var multer=require('multer');var util=require(_0xd1d0('0x0'));var path=require(_0xd1d0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd1d0('0x2'));var config=require(_0xd1d0('0x3'));var controller=require(_0xd1d0('0x4'));router[_0xd1d0('0x5')]('/',auth['isAuthenticated'](),controller[_0xd1d0('0x6')]);router[_0xd1d0('0x5')](_0xd1d0('0x7'),auth[_0xd1d0('0x8')](),controller[_0xd1d0('0x9')]);router[_0xd1d0('0x5')](_0xd1d0('0xa'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xd1d0('0x8')](),controller['create']);router[_0xd1d0('0xb')](_0xd1d0('0x7'),auth[_0xd1d0('0x8')](),controller[_0xd1d0('0xc')]);router[_0xd1d0('0xd')](_0xd1d0('0x7'),auth[_0xd1d0('0x8')](),controller[_0xd1d0('0xe')]);module['exports']=router; \ No newline at end of file +var _0x87a2=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update','destroy','exports','util','path','express','Router','../../components/auth/service'];(function(_0x1c0f5e,_0x47555b){var _0x256b90=function(_0xd129d3){while(--_0xd129d3){_0x1c0f5e['push'](_0x1c0f5e['shift']());}};_0x256b90(++_0x47555b);}(_0x87a2,0x113));var _0x287a=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x87a2[_0x46401e];return _0x447cba;};'use strict';var multer=require('multer');var util=require(_0x287a('0x0'));var path=require(_0x287a('0x1'));var timeout=require('connect-timeout');var express=require(_0x287a('0x2'));var router=express[_0x287a('0x3')]();var auth=require(_0x287a('0x4'));var interaction=require(_0x287a('0x5'));var config=require(_0x287a('0x6'));var controller=require(_0x287a('0x7'));router[_0x287a('0x8')]('/',auth[_0x287a('0x9')](),controller[_0x287a('0xa')]);router[_0x287a('0x8')](_0x287a('0xb'),auth['isAuthenticated'](),controller[_0x287a('0xc')]);router[_0x287a('0x8')](_0x287a('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x287a('0xe')]('/',auth[_0x287a('0x9')](),controller[_0x287a('0xf')]);router[_0x287a('0x10')](_0x287a('0xb'),auth[_0x287a('0x9')](),controller[_0x287a('0x11')]);router['delete'](_0x287a('0xb'),auth[_0x287a('0x9')](),controller[_0x287a('0x12')]);module[_0x287a('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3482972..4e7c3cc 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x50bbcd,_0xb578b9){var _0x189bca=function(_0x169167){while(--_0x169167){_0x50bbcd['push'](_0x50bbcd['shift']());}};_0x189bca(++_0xb578b9);}(_0x1261,0x144));var _0x1126=function(_0x250d2a,_0x2983be){_0x250d2a=_0x250d2a-0x0;var _0x5738fa=_0x1261[_0x250d2a];return _0x5738fa;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING'];(function(_0x120a99,_0x29e4ca){var _0x1a5701=function(_0x1b2b37){while(--_0x1b2b37){_0x120a99['push'](_0x120a99['shift']());}};_0x1a5701(++_0x29e4ca);}(_0xe14b,0x93));var _0xbe14=function(_0x1eca71,_0x4326f7){_0x1eca71=_0x1eca71-0x0;var _0x4cbdfd=_0xe14b[_0x1eca71];return _0x4cbdfd;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7fb03c7..e8ba306 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.controller.js +++ b/server/api/analyticFieldReport/analyticFieldReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f71=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','bulkCreate','update','bulkDestroy','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0x4f71,0x70));var _0x14f7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4f71[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x14f7('0x0'));var emlformat=require(_0x14f7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x14f7('0x2'));var jsonpatch=require(_0x14f7('0x3'));var rp=require('request-promise');var moment=require(_0x14f7('0x4'));var BPromise=require(_0x14f7('0x5'));var Mustache=require(_0x14f7('0x6'));var util=require('util');var path=require(_0x14f7('0x7'));var sox=require(_0x14f7('0x8'));var csv=require(_0x14f7('0x9'));var ejs=require(_0x14f7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x14f7('0xb'));var crypto=require('crypto');var jsforce=require(_0x14f7('0xc'));var deskjs=require(_0x14f7('0xd'));var toCsv=require(_0x14f7('0x9'));var querystring=require(_0x14f7('0xe'));var Papa=require(_0x14f7('0xf'));var Redis=require(_0x14f7('0x10'));var authService=require(_0x14f7('0x11'));var qs=require(_0x14f7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x14f7('0x13'));var utils=require('../../config/utils');var config=require(_0x14f7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x552147,_0x34eb44){_0x34eb44=_0x34eb44||0xcc;return function(_0x1003f2){if(_0x1003f2){return _0x552147[_0x14f7('0x15')](_0x34eb44);}return _0x552147[_0x14f7('0x16')](_0x34eb44)[_0x14f7('0x17')]();};}function respondWithResult(_0x1f6788,_0x3e74fa){_0x3e74fa=_0x3e74fa||0xc8;return function(_0xa4dfc7){if(_0xa4dfc7){return _0x1f6788['status'](_0x3e74fa)[_0x14f7('0x18')](_0xa4dfc7);}};}function respondWithFilteredResult(_0x45c186,_0x1c43f7){return function(_0x5391e3){if(_0x5391e3){var _0x216f67=_0x5391e3[_0x14f7('0x19')],_0x1a17b0=_0x1c43f7[_0x14f7('0x1a')],_0x40e42c=_0x1c43f7[_0x14f7('0x1a')]+_0x1c43f7[_0x14f7('0x1b')],_0x39bc3a;if(_0x40e42c>=_0x216f67){_0x40e42c=_0x216f67;_0x39bc3a=0xc8;}else{_0x39bc3a=0xce;}_0x45c186[_0x14f7('0x16')](_0x39bc3a);return _0x45c186['set'](_0x14f7('0x1c'),_0x1a17b0+'-'+_0x40e42c+'/'+_0x216f67)['json'](_0x5391e3);}return null;};}function patchUpdates(_0x5e8d99){return function(_0x2216f7){try{jsonpatch[_0x14f7('0x1d')](_0x2216f7,_0x5e8d99,!![]);}catch(_0x3935e7){return BPromise[_0x14f7('0x1e')](_0x3935e7);}return _0x2216f7['save']();};}function saveUpdates(_0x1e2c87,_0x35ed06){return function(_0x5cf5e7){if(_0x5cf5e7){return _0x5cf5e7['update'](_0x1e2c87)[_0x14f7('0x1f')](function(_0xa1f98e){return _0xa1f98e;});}return null;};}function removeEntity(_0x5162db,_0x2467f7){return function(_0x570cf3){if(_0x570cf3){return _0x570cf3[_0x14f7('0x20')]()['then'](function(){_0x5162db[_0x14f7('0x16')](0xcc)[_0x14f7('0x17')]();});}};}function handleEntityNotFound(_0x1ad54c,_0x3ca363){return function(_0x12033c){if(!_0x12033c){_0x1ad54c[_0x14f7('0x15')](0x194);}return _0x12033c;};}function handleError(_0x36bc5e,_0x5113e5){_0x5113e5=_0x5113e5||0x1f4;return function(_0x241945){logger[_0x14f7('0x21')](_0x241945[_0x14f7('0x22')]);if(_0x241945[_0x14f7('0x23')]){delete _0x241945[_0x14f7('0x23')];}_0x36bc5e[_0x14f7('0x16')](_0x5113e5)['send'](_0x241945);};}exports[_0x14f7('0x24')]=function(_0x1185d4,_0x32ed89){var _0x4b3379={},_0x282b1b={},_0x4444e5={'count':0x0,'rows':[]};var _0x5c5d63=_[_0x14f7('0x25')](db['AnalyticFieldReport'][_0x14f7('0x26')],function(_0x3853bb){return{'name':_0x3853bb[_0x14f7('0x27')],'type':_0x3853bb['type'][_0x14f7('0x28')]};});_0x282b1b['model']=_[_0x14f7('0x25')](_0x5c5d63,_0x14f7('0x23'));_0x282b1b['query']=_[_0x14f7('0x29')](_0x1185d4[_0x14f7('0x2a')]);_0x282b1b[_0x14f7('0x2b')]=_[_0x14f7('0x2c')](_0x282b1b[_0x14f7('0x2d')],_0x282b1b['query']);_0x4b3379[_0x14f7('0x2e')]=_[_0x14f7('0x2c')](_0x282b1b[_0x14f7('0x2d')],qs[_0x14f7('0x2f')](_0x1185d4[_0x14f7('0x2a')]['fields']));_0x4b3379['attributes']=_0x4b3379[_0x14f7('0x2e')]['length']?_0x4b3379[_0x14f7('0x2e')]:_0x282b1b[_0x14f7('0x2d')];if(!_0x1185d4[_0x14f7('0x2a')][_0x14f7('0x30')](_0x14f7('0x31'))){_0x4b3379[_0x14f7('0x1b')]=qs['limit'](_0x1185d4['query'][_0x14f7('0x1b')]);_0x4b3379['offset']=qs['offset'](_0x1185d4[_0x14f7('0x2a')][_0x14f7('0x1a')]);}_0x4b3379[_0x14f7('0x32')]=qs['sort'](_0x1185d4[_0x14f7('0x2a')][_0x14f7('0x33')]);_0x4b3379[_0x14f7('0x34')]=qs[_0x14f7('0x2b')](_[_0x14f7('0x35')](_0x1185d4[_0x14f7('0x2a')],_0x282b1b[_0x14f7('0x2b')]),_0x5c5d63);if(_0x1185d4[_0x14f7('0x2a')][_0x14f7('0x36')]){_0x4b3379[_0x14f7('0x34')]=_[_0x14f7('0x37')](_0x4b3379[_0x14f7('0x34')],{'$or':_['map'](_0x5c5d63,function(_0x14fae2){if(_0x14fae2[_0x14f7('0x38')]!==_0x14f7('0x39')){var _0x52e319={};_0x52e319[_0x14fae2['name']]={'$like':'%'+_0x1185d4['query'][_0x14f7('0x36')]+'%'};return _0x52e319;}})});}_0x4b3379=_[_0x14f7('0x37')]({},_0x4b3379,_0x1185d4['options']);var _0x4d8952={'where':_0x4b3379[_0x14f7('0x34')]};return db[_0x14f7('0x3a')][_0x14f7('0x19')](_0x4d8952)[_0x14f7('0x1f')](function(_0xbd0d97){_0x4444e5[_0x14f7('0x19')]=_0xbd0d97;if(_0x1185d4[_0x14f7('0x2a')][_0x14f7('0x3b')]){_0x4b3379['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x14f7('0x3c')](_0x4b3379);})[_0x14f7('0x1f')](function(_0x22bdf3){_0x4444e5[_0x14f7('0x3d')]=_0x22bdf3;return _0x4444e5;})[_0x14f7('0x1f')](respondWithFilteredResult(_0x32ed89,_0x4b3379))[_0x14f7('0x3e')](handleError(_0x32ed89,null));};exports[_0x14f7('0x3f')]=function(_0x809631,_0x5009d5){var _0x43d597={'raw':![],'where':{'id':_0x809631[_0x14f7('0x40')]['id']}},_0x5b403c={};_0x5b403c[_0x14f7('0x2d')]=_[_0x14f7('0x29')](db[_0x14f7('0x3a')][_0x14f7('0x26')]);_0x5b403c[_0x14f7('0x2a')]=_[_0x14f7('0x29')](_0x809631[_0x14f7('0x2a')]);_0x5b403c[_0x14f7('0x2b')]=_[_0x14f7('0x2c')](_0x5b403c['model'],_0x5b403c[_0x14f7('0x2a')]);_0x43d597[_0x14f7('0x2e')]=_['intersection'](_0x5b403c[_0x14f7('0x2d')],qs[_0x14f7('0x2f')](_0x809631['query'][_0x14f7('0x2f')]));_0x43d597['attributes']=_0x43d597[_0x14f7('0x2e')][_0x14f7('0x41')]?_0x43d597[_0x14f7('0x2e')]:_0x5b403c[_0x14f7('0x2d')];if(_0x809631[_0x14f7('0x2a')][_0x14f7('0x3b')]){_0x43d597[_0x14f7('0x42')]=[{'all':!![]}];}_0x43d597=_[_0x14f7('0x37')]({},_0x43d597,_0x809631[_0x14f7('0x43')]);return db['AnalyticFieldReport'][_0x14f7('0x44')](_0x43d597)[_0x14f7('0x1f')](handleEntityNotFound(_0x5009d5,null))[_0x14f7('0x1f')](respondWithResult(_0x5009d5,null))[_0x14f7('0x3e')](handleError(_0x5009d5,null));};exports[_0x14f7('0x45')]=function(_0x41424e,_0x49f4d5){return db[_0x14f7('0x3a')][_0x14f7('0x45')](_0x41424e[_0x14f7('0x46')],{})[_0x14f7('0x1f')](respondWithResult(_0x49f4d5,0xc9))['catch'](handleError(_0x49f4d5,null));};exports[_0x14f7('0x47')]=function(_0x27f1a,_0x3b91f1){return db[_0x14f7('0x3a')]['bulkCreate'](_0x27f1a['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3b91f1,0xc9))['catch'](handleError(_0x3b91f1,null));};exports[_0x14f7('0x48')]=function(_0x326340,_0x53d16f){if(_0x326340[_0x14f7('0x46')]['id']){delete _0x326340[_0x14f7('0x46')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x326340[_0x14f7('0x40')]['id']}})['then'](handleEntityNotFound(_0x53d16f,null))['then'](saveUpdates(_0x326340[_0x14f7('0x46')],null))['then'](respondWithResult(_0x53d16f,null))[_0x14f7('0x3e')](handleError(_0x53d16f,null));};exports[_0x14f7('0x20')]=function(_0x3328f9,_0x341d01){return db[_0x14f7('0x3a')][_0x14f7('0x44')]({'where':{'id':_0x3328f9['params']['id']}})[_0x14f7('0x1f')](handleEntityNotFound(_0x341d01,null))['then'](removeEntity(_0x341d01,null))[_0x14f7('0x3e')](handleError(_0x341d01,null));};exports[_0x14f7('0x49')]=function(_0x5f4408,_0x277e59){return db[_0x14f7('0x3a')][_0x14f7('0x20')]({'where':{'id':_0x5f4408['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x277e59,0xcc))[_0x14f7('0x3e')](handleError(_0x277e59,null));};exports[_0x14f7('0x4a')]=function(_0x2d41dd,_0x416091,_0x4f2c69){return db[_0x14f7('0x4b')][_0x14f7('0x4c')]({'where':{'id':_0x2d41dd[_0x14f7('0x40')]['id']}})[_0x14f7('0x1f')](handleEntityNotFound(_0x416091,null))[_0x14f7('0x1f')](function(_0xea07ff){if(_0xea07ff){return db['sequelize'][_0x14f7('0x4d')](function(_0x5c91b8){return db[_0x14f7('0x3a')][_0x14f7('0x20')]({'where':{'CustomReportId':_0x2d41dd[_0x14f7('0x40')]['id']},'transaction':_0x5c91b8})[_0x14f7('0x1f')](function(_0x5963b8){var _0x32d4dd=_['map'](_0x2d41dd['body'],function(_0x9a91fa){delete _0x9a91fa['id'];_0x9a91fa[_0x14f7('0x4e')]=_0x2d41dd[_0x14f7('0x40')]['id'];return _0x9a91fa;});return db[_0x14f7('0x3a')][_0x14f7('0x47')](_0x32d4dd,{'transaction':_0x5c91b8});});})[_0x14f7('0x1f')](function(){return db[_0x14f7('0x3a')][_0x14f7('0x3c')]({'where':{'CustomReportId':_0x2d41dd['params']['id']}});});}})[_0x14f7('0x1f')](respondWithResult(_0x416091,null))[_0x14f7('0x3e')](handleError(_0x416091,null));}; \ No newline at end of file +var _0x8d55=['filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','apply','reject','update','then','destroy','end','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d55,0x6a));var _0x58d5=function(_0x480e3d,_0x5a3f9c){_0x480e3d=_0x480e3d-0x0;var _0x4eb9e4=_0x8d55[_0x480e3d];return _0x4eb9e4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x58d5('0x0'));var jsonpatch=require(_0x58d5('0x1'));var rp=require('request-promise');var moment=require(_0x58d5('0x2'));var BPromise=require(_0x58d5('0x3'));var Mustache=require(_0x58d5('0x4'));var util=require(_0x58d5('0x5'));var path=require(_0x58d5('0x6'));var sox=require(_0x58d5('0x7'));var csv=require(_0x58d5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x58d5('0x9'));var squel=require(_0x58d5('0xa'));var crypto=require(_0x58d5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x58d5('0xc'));var toCsv=require(_0x58d5('0x8'));var querystring=require(_0x58d5('0xd'));var Papa=require(_0x58d5('0xe'));var Redis=require(_0x58d5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x58d5('0x10'));var as=require(_0x58d5('0x11'));var hardwareService=require(_0x58d5('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x58d5('0x13'));var config=require(_0x58d5('0x14'));var licenseUtil=require(_0x58d5('0x15'));var db=require(_0x58d5('0x16'))['db'];function respondWithStatusCode(_0x58b735,_0x772bc7){_0x772bc7=_0x772bc7||0xcc;return function(_0x2dd847){if(_0x2dd847){return _0x58b735[_0x58d5('0x17')](_0x772bc7);}return _0x58b735[_0x58d5('0x18')](_0x772bc7)['end']();};}function respondWithResult(_0x406982,_0x5a4c33){_0x5a4c33=_0x5a4c33||0xc8;return function(_0x26748d){if(_0x26748d){return _0x406982['status'](_0x5a4c33)['json'](_0x26748d);}};}function respondWithFilteredResult(_0x56e4b2,_0x456c3d){return function(_0x3d84d0){if(_0x3d84d0){var _0x118d93=_0x3d84d0[_0x58d5('0x19')],_0x21939e=_0x456c3d['offset'],_0x2e8266=_0x456c3d[_0x58d5('0x1a')]+_0x456c3d['limit'],_0x38f7fd;if(_0x2e8266>=_0x118d93){_0x2e8266=_0x118d93;_0x38f7fd=0xc8;}else{_0x38f7fd=0xce;}_0x56e4b2['status'](_0x38f7fd);return _0x56e4b2[_0x58d5('0x1b')]('Content-Range',_0x21939e+'-'+_0x2e8266+'/'+_0x118d93)['json'](_0x3d84d0);}return null;};}function patchUpdates(_0x4d1900){return function(_0x4fca07){try{jsonpatch[_0x58d5('0x1c')](_0x4fca07,_0x4d1900,!![]);}catch(_0x18033f){return BPromise[_0x58d5('0x1d')](_0x18033f);}return _0x4fca07['save']();};}function saveUpdates(_0xf7622,_0x4de161){return function(_0x540115){if(_0x540115){return _0x540115[_0x58d5('0x1e')](_0xf7622)[_0x58d5('0x1f')](function(_0x439c3c){return _0x439c3c;});}return null;};}function removeEntity(_0x5f1471,_0x261363){return function(_0x448840){if(_0x448840){return _0x448840[_0x58d5('0x20')]()[_0x58d5('0x1f')](function(){_0x5f1471[_0x58d5('0x18')](0xcc)[_0x58d5('0x21')]();});}};}function handleEntityNotFound(_0x179e9f,_0x1c23c7){return function(_0xd44880){if(!_0xd44880){_0x179e9f[_0x58d5('0x17')](0x194);}return _0xd44880;};}function handleError(_0x29070a,_0x49fbb1){_0x49fbb1=_0x49fbb1||0x1f4;return function(_0x57c825){logger['error'](_0x57c825[_0x58d5('0x22')]);if(_0x57c825[_0x58d5('0x23')]){delete _0x57c825[_0x58d5('0x23')];}_0x29070a[_0x58d5('0x18')](_0x49fbb1)[_0x58d5('0x24')](_0x57c825);};}exports['index']=function(_0x499174,_0x8748af){var _0x39d27e={},_0x14698d={},_0x57daf1={'count':0x0,'rows':[]};var _0x44cfa4=_[_0x58d5('0x25')](db[_0x58d5('0x26')][_0x58d5('0x27')],function(_0x4ea9a7){return{'name':_0x4ea9a7[_0x58d5('0x28')],'type':_0x4ea9a7[_0x58d5('0x29')]['key']};});_0x14698d[_0x58d5('0x2a')]=_[_0x58d5('0x25')](_0x44cfa4,_0x58d5('0x23'));_0x14698d['query']=_[_0x58d5('0x2b')](_0x499174['query']);_0x14698d[_0x58d5('0x2c')]=_[_0x58d5('0x2d')](_0x14698d['model'],_0x14698d[_0x58d5('0x2e')]);_0x39d27e['attributes']=_[_0x58d5('0x2d')](_0x14698d[_0x58d5('0x2a')],qs[_0x58d5('0x2f')](_0x499174['query']['fields']));_0x39d27e[_0x58d5('0x30')]=_0x39d27e[_0x58d5('0x30')][_0x58d5('0x31')]?_0x39d27e['attributes']:_0x14698d[_0x58d5('0x2a')];if(!_0x499174[_0x58d5('0x2e')][_0x58d5('0x32')](_0x58d5('0x33'))){_0x39d27e[_0x58d5('0x34')]=qs['limit'](_0x499174[_0x58d5('0x2e')][_0x58d5('0x34')]);_0x39d27e['offset']=qs[_0x58d5('0x1a')](_0x499174[_0x58d5('0x2e')]['offset']);}_0x39d27e['order']=qs[_0x58d5('0x35')](_0x499174[_0x58d5('0x2e')][_0x58d5('0x35')]);_0x39d27e[_0x58d5('0x36')]=qs[_0x58d5('0x2c')](_[_0x58d5('0x37')](_0x499174['query'],_0x14698d[_0x58d5('0x2c')]),_0x44cfa4);if(_0x499174[_0x58d5('0x2e')]['filter']){_0x39d27e[_0x58d5('0x36')]=_[_0x58d5('0x38')](_0x39d27e[_0x58d5('0x36')],{'$or':_[_0x58d5('0x25')](_0x44cfa4,function(_0x55a65e){if(_0x55a65e[_0x58d5('0x29')]!==_0x58d5('0x39')){var _0x36f7cd={};_0x36f7cd[_0x55a65e[_0x58d5('0x23')]]={'$like':'%'+_0x499174['query'][_0x58d5('0x3a')]+'%'};return _0x36f7cd;}})});}_0x39d27e=_[_0x58d5('0x38')]({},_0x39d27e,_0x499174['options']);var _0x389072={'where':_0x39d27e[_0x58d5('0x36')]};return db[_0x58d5('0x26')]['count'](_0x389072)[_0x58d5('0x1f')](function(_0x3fc00a){_0x57daf1[_0x58d5('0x19')]=_0x3fc00a;if(_0x499174[_0x58d5('0x2e')][_0x58d5('0x3b')]){_0x39d27e[_0x58d5('0x3c')]=[{'all':!![]}];}return db[_0x58d5('0x26')][_0x58d5('0x3d')](_0x39d27e);})[_0x58d5('0x1f')](function(_0x4a65d4){_0x57daf1[_0x58d5('0x3e')]=_0x4a65d4;return _0x57daf1;})['then'](respondWithFilteredResult(_0x8748af,_0x39d27e))[_0x58d5('0x3f')](handleError(_0x8748af,null));};exports[_0x58d5('0x40')]=function(_0x2f4f38,_0x57c79e){var _0x228647={'raw':![],'where':{'id':_0x2f4f38[_0x58d5('0x41')]['id']}},_0x2102c1={};_0x2102c1[_0x58d5('0x2a')]=_[_0x58d5('0x2b')](db[_0x58d5('0x26')]['rawAttributes']);_0x2102c1['query']=_[_0x58d5('0x2b')](_0x2f4f38[_0x58d5('0x2e')]);_0x2102c1[_0x58d5('0x2c')]=_[_0x58d5('0x2d')](_0x2102c1[_0x58d5('0x2a')],_0x2102c1[_0x58d5('0x2e')]);_0x228647[_0x58d5('0x30')]=_['intersection'](_0x2102c1[_0x58d5('0x2a')],qs[_0x58d5('0x2f')](_0x2f4f38['query'][_0x58d5('0x2f')]));_0x228647[_0x58d5('0x30')]=_0x228647[_0x58d5('0x30')][_0x58d5('0x31')]?_0x228647[_0x58d5('0x30')]:_0x2102c1[_0x58d5('0x2a')];if(_0x2f4f38[_0x58d5('0x2e')][_0x58d5('0x3b')]){_0x228647[_0x58d5('0x3c')]=[{'all':!![]}];}_0x228647=_[_0x58d5('0x38')]({},_0x228647,_0x2f4f38['options']);return db[_0x58d5('0x26')][_0x58d5('0x42')](_0x228647)[_0x58d5('0x1f')](handleEntityNotFound(_0x57c79e,null))[_0x58d5('0x1f')](respondWithResult(_0x57c79e,null))[_0x58d5('0x3f')](handleError(_0x57c79e,null));};exports[_0x58d5('0x43')]=function(_0x413e43,_0x443e0c){return db[_0x58d5('0x26')][_0x58d5('0x43')](_0x413e43[_0x58d5('0x44')],{})[_0x58d5('0x1f')](respondWithResult(_0x443e0c,0xc9))['catch'](handleError(_0x443e0c,null));};exports['bulkCreate']=function(_0x28f9de,_0x388023){return db['AnalyticFieldReport'][_0x58d5('0x45')](_0x28f9de[_0x58d5('0x44')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x388023,0xc9))[_0x58d5('0x3f')](handleError(_0x388023,null));};exports['update']=function(_0x28121d,_0x24c670){if(_0x28121d[_0x58d5('0x44')]['id']){delete _0x28121d[_0x58d5('0x44')]['id'];}return db[_0x58d5('0x26')][_0x58d5('0x42')]({'where':{'id':_0x28121d['params']['id']}})['then'](handleEntityNotFound(_0x24c670,null))[_0x58d5('0x1f')](saveUpdates(_0x28121d[_0x58d5('0x44')],null))[_0x58d5('0x1f')](respondWithResult(_0x24c670,null))[_0x58d5('0x3f')](handleError(_0x24c670,null));};exports[_0x58d5('0x20')]=function(_0x300363,_0xab7ba8){return db['AnalyticFieldReport']['find']({'where':{'id':_0x300363[_0x58d5('0x41')]['id']}})[_0x58d5('0x1f')](handleEntityNotFound(_0xab7ba8,null))[_0x58d5('0x1f')](removeEntity(_0xab7ba8,null))[_0x58d5('0x3f')](handleError(_0xab7ba8,null));};exports[_0x58d5('0x46')]=function(_0x35c5d9,_0x2e75e4){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x35c5d9['query'][_0x58d5('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x58d5('0x1f')](respondWithResult(_0x2e75e4,0xcc))[_0x58d5('0x3f')](handleError(_0x2e75e4,null));};exports[_0x58d5('0x48')]=function(_0xe1e1b0,_0x256f34,_0x268983){return db[_0x58d5('0x49')]['findOne']({'where':{'id':_0xe1e1b0[_0x58d5('0x41')]['id']}})[_0x58d5('0x1f')](handleEntityNotFound(_0x256f34,null))[_0x58d5('0x1f')](function(_0x3a84f8){if(_0x3a84f8){return db[_0x58d5('0x4a')]['transaction'](function(_0x455c00){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0xe1e1b0['params']['id']},'transaction':_0x455c00})[_0x58d5('0x1f')](function(_0x43e8f6){var _0x3d8544=_[_0x58d5('0x25')](_0xe1e1b0[_0x58d5('0x44')],function(_0x54e6e1){delete _0x54e6e1['id'];_0x54e6e1['CustomReportId']=_0xe1e1b0['params']['id'];return _0x54e6e1;});return db[_0x58d5('0x26')][_0x58d5('0x45')](_0x3d8544,{'transaction':_0x455c00});});})[_0x58d5('0x1f')](function(){return db[_0x58d5('0x26')][_0x58d5('0x3d')]({'where':{'CustomReportId':_0xe1e1b0[_0x58d5('0x41')]['id']}});});}})['then'](respondWithResult(_0x256f34,null))['catch'](handleError(_0x256f34,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 2944ef6..29c090c 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.model.js +++ b/server/api/analyticFieldReport/analyticFieldReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5959=['path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3170ac,_0x3973c7){var _0x493ce2=function(_0x287051){while(--_0x287051){_0x3170ac['push'](_0x3170ac['shift']());}};_0x493ce2(++_0x3973c7);}(_0x5959,0x126));var _0x9595=function(_0x52ae40,_0x23c2bf){_0x52ae40=_0x52ae40-0x0;var _0xab6ed1=_0x5959[_0x52ae40];return _0xab6ed1;};'use strict';var _=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var logger=require(_0x9595('0x2'))(_0x9595('0x3'));var moment=require('moment');var BPromise=require(_0x9595('0x4'));var rp=require(_0x9595('0x5'));var fs=require('fs');var path=require(_0x9595('0x6'));var rimraf=require(_0x9595('0x7'));var config=require(_0x9595('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x9595('0x9')]=function(_0x50ddd3,_0x5eb55a){return _0x50ddd3[_0x9595('0xa')](_0x9595('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37c0=['api','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x37c0,0xda));var _0x037c=function(_0x589495,_0x33aa81){_0x589495=_0x589495-0x0;var _0x5057d5=_0x37c0[_0x589495];return _0x5057d5;};'use strict';var _=require(_0x037c('0x0'));var util=require(_0x037c('0x1'));var logger=require('../../config/logger')(_0x037c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x037c('0x3'));var fs=require('fs');var path=require(_0x037c('0x4'));var rimraf=require(_0x037c('0x5'));var config=require(_0x037c('0x6'));var attributes=require(_0x037c('0x7'));module['exports']=function(_0x1a4aec,_0x3f20d6){return _0x1a4aec[_0x037c('0x8')](_0x037c('0x9'),attributes,{'tableName':_0x037c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 4bfd7a9..eca68b8 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.rpc.js +++ b/server/api/analyticFieldReport/analyticFieldReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5afb=['message','result','lodash','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x1cca0b,_0x1a1e2f){var _0x12f70a=function(_0x375dfa){while(--_0x375dfa){_0x1cca0b['push'](_0x1cca0b['shift']());}};_0x12f70a(++_0x1a1e2f);}(_0x5afb,0x17e));var _0xb5af=function(_0x1d4eed,_0x4922b2){_0x1d4eed=_0x1d4eed-0x0;var _0x10911b=_0x5afb[_0x1d4eed];return _0x10911b;};'use strict';var _=require(_0xb5af('0x0'));var util=require(_0xb5af('0x1'));var moment=require('moment');var BPromise=require(_0xb5af('0x2'));var rs=require(_0xb5af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb5af('0x4'))(_0xb5af('0x5'));var config=require('../../config/environment');var jayson=require(_0xb5af('0x6'));var client=jayson['client'][_0xb5af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x576050,_0x15feef,_0x5148ba){return new BPromise(function(_0x4c7f82,_0x56bcfc){return client[_0xb5af('0x8')](_0x576050,_0x5148ba)[_0xb5af('0x9')](function(_0x49ca46){logger[_0xb5af('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15feef,_0xb5af('0xb'));logger[_0xb5af('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x15feef,_0xb5af('0xb'),JSON[_0xb5af('0xd')](_0x49ca46));if(_0x49ca46[_0xb5af('0xe')]){if(_0x49ca46[_0xb5af('0xe')][_0xb5af('0xf')]===0x1f4){logger['error'](_0xb5af('0x10'),_0x15feef,_0x49ca46[_0xb5af('0xe')][_0xb5af('0x11')]);return _0x56bcfc(_0x49ca46['error']['message']);}logger[_0xb5af('0xe')](_0xb5af('0x10'),_0x15feef,_0x49ca46[_0xb5af('0xe')][_0xb5af('0x11')]);return _0x4c7f82(_0x49ca46[_0xb5af('0xe')][_0xb5af('0x11')]);}else{logger[_0xb5af('0xa')](_0xb5af('0x10'),_0x15feef,_0xb5af('0xb'));_0x4c7f82(_0x49ca46[_0xb5af('0x12')][_0xb5af('0x11')]);}})['catch'](function(_0x563801){logger['error'](_0xb5af('0x10'),_0x15feef,_0x563801);_0x56bcfc(_0x563801);});});} \ No newline at end of file +var _0x79bb=['error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x506a19,_0x1aa991){var _0x23f2b5=function(_0x29821c){while(--_0x29821c){_0x506a19['push'](_0x506a19['shift']());}};_0x23f2b5(++_0x1aa991);}(_0x79bb,0xca));var _0xb79b=function(_0x117554,_0x4a3ef6){_0x117554=_0x117554-0x0;var _0x189f20=_0x79bb[_0x117554];return _0x189f20;};'use strict';var _=require(_0xb79b('0x0'));var util=require('util');var moment=require(_0xb79b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb79b('0x2'))['db'];var utils=require(_0xb79b('0x3'));var logger=require(_0xb79b('0x4'))(_0xb79b('0x5'));var config=require(_0xb79b('0x6'));var jayson=require(_0xb79b('0x7'));var client=jayson[_0xb79b('0x8')][_0xb79b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29cf9e,_0x2f58e4,_0x4ce479){return new BPromise(function(_0x362dc1,_0x828be5){return client[_0xb79b('0xa')](_0x29cf9e,_0x4ce479)[_0xb79b('0xb')](function(_0x45880c){logger[_0xb79b('0xc')](_0xb79b('0xd'),_0x2f58e4,_0xb79b('0xe'));logger[_0xb79b('0xf')](_0xb79b('0x10'),_0x2f58e4,_0xb79b('0xe'),JSON[_0xb79b('0x11')](_0x45880c));if(_0x45880c[_0xb79b('0x12')]){if(_0x45880c[_0xb79b('0x12')][_0xb79b('0x13')]===0x1f4){logger[_0xb79b('0x12')](_0xb79b('0xd'),_0x2f58e4,_0x45880c[_0xb79b('0x12')]['message']);return _0x828be5(_0x45880c['error']['message']);}logger[_0xb79b('0x12')](_0xb79b('0xd'),_0x2f58e4,_0x45880c[_0xb79b('0x12')][_0xb79b('0x14')]);return _0x362dc1(_0x45880c[_0xb79b('0x12')][_0xb79b('0x14')]);}else{logger['info'](_0xb79b('0xd'),_0x2f58e4,_0xb79b('0xe'));_0x362dc1(_0x45880c['result'][_0xb79b('0x14')]);}})[_0xb79b('0x15')](function(_0x4d0854){logger['error'](_0xb79b('0xd'),_0x2f58e4,_0x4d0854);_0x828be5(_0x4d0854);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 60747c7..7b99471 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x470df7,_0x18dd2b){var _0xeea7fb=function(_0x2cbad7){while(--_0x2cbad7){_0x470df7['push'](_0x470df7['shift']());}};_0xeea7fb(++_0x18dd2b);}(_0x3e74,0x175));var _0x43e7=function(_0x42f3d8,_0x1ba9a7){_0x42f3d8=_0x42f3d8-0x0;var _0x1a1440=_0x3e74[_0x42f3d8];return _0x1a1440;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 97d3cc1..806540e 100644 --- a/server/api/analyticMetric/analyticMetric.attributes.js +++ b/server/api/analyticMetric/analyticMetric.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c00=['TEXT','sequelize','exports','STRING'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0x6c00,0x1a9));var _0x06c0=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x6c00[_0x1857c6];return _0x51011c;};'use strict';var Sequelize=require(_0x06c0('0x0'));module[_0x06c0('0x1')]={'name':{'type':Sequelize[_0x06c0('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x06c0('0x2')]},'metric':{'type':Sequelize[_0x06c0('0x3')]},'description':{'type':Sequelize[_0x06c0('0x2')]}}; \ No newline at end of file +var _0x88c8=['exports','STRING','sequelize'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x88c8,0x7a));var _0x888c=function(_0x22e244,_0x5dc5e2){_0x22e244=_0x22e244-0x0;var _0x3ab6a4=_0x88c8[_0x22e244];return _0x3ab6a4;};'use strict';var Sequelize=require(_0x888c('0x0'));module[_0x888c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x888c('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index b23aa26..d342163 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4113=['util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','limit','status','reject','save','update','destroy','get','Metrics','error','name','send','index','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','AnalyticMetric','then','includeAll','include','findAll','rows','catch','show','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1b60d1,_0x1e0d56){var _0x221fe1=function(_0x15c4ed){while(--_0x15c4ed){_0x1b60d1['push'](_0x1b60d1['shift']());}};_0x221fe1(++_0x1e0d56);}(_0x4113,0x18d));var _0x3411=function(_0x4bdda,_0x183e0e){_0x4bdda=_0x4bdda-0x0;var _0x51f02e=_0x4113[_0x4bdda];return _0x51f02e;};'use strict';var pdf=require(_0x3411('0x0'));var emlformat=require(_0x3411('0x1'));var rimraf=require(_0x3411('0x2'));var zipdir=require(_0x3411('0x3'));var jsonpatch=require(_0x3411('0x4'));var rp=require(_0x3411('0x5'));var moment=require(_0x3411('0x6'));var BPromise=require(_0x3411('0x7'));var Mustache=require('mustache');var util=require(_0x3411('0x8'));var path=require(_0x3411('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3411('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3411('0xb'));var crypto=require(_0x3411('0xc'));var jsforce=require(_0x3411('0xd'));var deskjs=require(_0x3411('0xe'));var toCsv=require(_0x3411('0xf'));var querystring=require(_0x3411('0x10'));var Papa=require(_0x3411('0x11'));var Redis=require(_0x3411('0x12'));var authService=require(_0x3411('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3411('0x14'));var hardwareService=require(_0x3411('0x15'));var logger=require('../../config/logger')(_0x3411('0x16'));var utils=require(_0x3411('0x17'));var config=require(_0x3411('0x18'));var licenseUtil=require(_0x3411('0x19'));var db=require(_0x3411('0x1a'))['db'];function respondWithStatusCode(_0x2148db,_0x44f002){_0x44f002=_0x44f002||0xcc;return function(_0x187deb){if(_0x187deb){return _0x2148db[_0x3411('0x1b')](_0x44f002);}return _0x2148db['status'](_0x44f002)['end']();};}function respondWithResult(_0x420940,_0x302264){_0x302264=_0x302264||0xc8;return function(_0x32b300){if(_0x32b300){return _0x420940['status'](_0x302264)[_0x3411('0x1c')](_0x32b300);}};}function respondWithFilteredResult(_0x5347c4,_0x5716ce){return function(_0x1ecd95){if(_0x1ecd95){var _0x507edf=_0x1ecd95[_0x3411('0x1d')],_0x3062e8=_0x5716ce['offset'],_0x25080c=_0x5716ce['offset']+_0x5716ce[_0x3411('0x1e')],_0x134f7a;if(_0x25080c>=_0x507edf){_0x25080c=_0x507edf;_0x134f7a=0xc8;}else{_0x134f7a=0xce;}_0x5347c4[_0x3411('0x1f')](_0x134f7a);return _0x5347c4['set']('Content-Range',_0x3062e8+'-'+_0x25080c+'/'+_0x507edf)[_0x3411('0x1c')](_0x1ecd95);}return null;};}function patchUpdates(_0x366e91){return function(_0x5ba35e){try{jsonpatch['apply'](_0x5ba35e,_0x366e91,!![]);}catch(_0xcb21a5){return BPromise[_0x3411('0x20')](_0xcb21a5);}return _0x5ba35e[_0x3411('0x21')]();};}function saveUpdates(_0x54a97e,_0x33ff20){return function(_0xaa3565){if(_0xaa3565){return _0xaa3565[_0x3411('0x22')](_0x54a97e)['then'](function(_0x3ddc6b){return _0x3ddc6b;});}return null;};}function removeEntity(_0xe7db79,_0x3e9fdd){return function(_0x387549){if(_0x387549){return _0x387549[_0x3411('0x23')]()['then'](function(){var _0x30b5ff=_0x387549[_0x3411('0x24')]({'plain':!![]});var _0x27f845=_0x3411('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x27f845,'resourceId':_0x30b5ff['id']}})['then'](function(){return _0x387549;});})['then'](function(){_0xe7db79[_0x3411('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34afe6,_0x124e77){return function(_0x5ba4cb){if(!_0x5ba4cb){_0x34afe6[_0x3411('0x1b')](0x194);}return _0x5ba4cb;};}function handleError(_0x5e34a4,_0x262960){_0x262960=_0x262960||0x1f4;return function(_0x4b0ae5){logger[_0x3411('0x26')](_0x4b0ae5['stack']);if(_0x4b0ae5['name']){delete _0x4b0ae5[_0x3411('0x27')];}_0x5e34a4[_0x3411('0x1f')](_0x262960)[_0x3411('0x28')](_0x4b0ae5);};}exports[_0x3411('0x29')]=function(_0x1a8436,_0x35d2af){var _0x3dacda={},_0x52509f={},_0x54f734={'count':0x0,'rows':[]};var _0x1e3b23=_['map'](db['AnalyticMetric']['rawAttributes'],function(_0x3c8439){return{'name':_0x3c8439[_0x3411('0x2a')],'type':_0x3c8439[_0x3411('0x2b')][_0x3411('0x2c')]};});_0x52509f[_0x3411('0x2d')]=_['map'](_0x1e3b23,_0x3411('0x27'));_0x52509f[_0x3411('0x2e')]=_[_0x3411('0x2f')](_0x1a8436[_0x3411('0x2e')]);_0x52509f['filters']=_['intersection'](_0x52509f[_0x3411('0x2d')],_0x52509f[_0x3411('0x2e')]);_0x3dacda['attributes']=_[_0x3411('0x30')](_0x52509f[_0x3411('0x2d')],qs[_0x3411('0x31')](_0x1a8436[_0x3411('0x2e')][_0x3411('0x31')]));_0x3dacda[_0x3411('0x32')]=_0x3dacda['attributes']['length']?_0x3dacda['attributes']:_0x52509f[_0x3411('0x2d')];if(!_0x1a8436[_0x3411('0x2e')][_0x3411('0x33')](_0x3411('0x34'))){_0x3dacda[_0x3411('0x1e')]=qs['limit'](_0x1a8436[_0x3411('0x2e')][_0x3411('0x1e')]);_0x3dacda[_0x3411('0x35')]=qs[_0x3411('0x35')](_0x1a8436[_0x3411('0x2e')][_0x3411('0x35')]);}_0x3dacda['order']=qs[_0x3411('0x36')](_0x1a8436[_0x3411('0x2e')][_0x3411('0x36')]);_0x3dacda['where']=qs[_0x3411('0x37')](_[_0x3411('0x38')](_0x1a8436['query'],_0x52509f[_0x3411('0x37')]),_0x1e3b23);if(_0x1a8436[_0x3411('0x2e')][_0x3411('0x39')]){_0x3dacda[_0x3411('0x3a')]=_[_0x3411('0x3b')](_0x3dacda[_0x3411('0x3a')],{'$or':_[_0x3411('0x3c')](_0x1e3b23,function(_0xc64cd6){if(_0xc64cd6[_0x3411('0x2b')]!==_0x3411('0x3d')){var _0x551733={};_0x551733[_0xc64cd6[_0x3411('0x27')]]={'$like':'%'+_0x1a8436[_0x3411('0x2e')][_0x3411('0x39')]+'%'};return _0x551733;}})});}_0x3dacda=_['merge']({},_0x3dacda,_0x1a8436[_0x3411('0x3e')]);var _0x278eea={'where':_0x3dacda['where']};return db[_0x3411('0x3f')][_0x3411('0x1d')](_0x278eea)[_0x3411('0x40')](function(_0x2510d2){_0x54f734[_0x3411('0x1d')]=_0x2510d2;if(_0x1a8436['query'][_0x3411('0x41')]){_0x3dacda[_0x3411('0x42')]=[{'all':!![]}];}return db[_0x3411('0x3f')][_0x3411('0x43')](_0x3dacda);})[_0x3411('0x40')](function(_0x84d1ab){_0x54f734[_0x3411('0x44')]=_0x84d1ab;return _0x54f734;})[_0x3411('0x40')](respondWithFilteredResult(_0x35d2af,_0x3dacda))[_0x3411('0x45')](handleError(_0x35d2af,null));};exports[_0x3411('0x46')]=function(_0x3f1fc4,_0x293dbc){var _0x3e2a91={'raw':!![],'where':{'id':_0x3f1fc4['params']['id']}},_0x249f15={};_0x249f15[_0x3411('0x2d')]=_[_0x3411('0x2f')](db[_0x3411('0x3f')]['rawAttributes']);_0x249f15[_0x3411('0x2e')]=_[_0x3411('0x2f')](_0x3f1fc4[_0x3411('0x2e')]);_0x249f15[_0x3411('0x37')]=_['intersection'](_0x249f15[_0x3411('0x2d')],_0x249f15[_0x3411('0x2e')]);_0x3e2a91[_0x3411('0x32')]=_[_0x3411('0x30')](_0x249f15['model'],qs[_0x3411('0x31')](_0x3f1fc4[_0x3411('0x2e')][_0x3411('0x31')]));_0x3e2a91['attributes']=_0x3e2a91[_0x3411('0x32')][_0x3411('0x47')]?_0x3e2a91[_0x3411('0x32')]:_0x249f15['model'];if(_0x3f1fc4['query'][_0x3411('0x41')]){_0x3e2a91[_0x3411('0x42')]=[{'all':!![]}];}_0x3e2a91=_['merge']({},_0x3e2a91,_0x3f1fc4[_0x3411('0x3e')]);return db[_0x3411('0x3f')]['find'](_0x3e2a91)[_0x3411('0x40')](handleEntityNotFound(_0x293dbc,null))[_0x3411('0x40')](respondWithResult(_0x293dbc,null))[_0x3411('0x45')](handleError(_0x293dbc,null));};exports['create']=function(_0x2b56bc,_0x62d745){return db[_0x3411('0x3f')][_0x3411('0x48')](_0x2b56bc[_0x3411('0x49')],{})[_0x3411('0x40')](function(_0x40f82b){var _0x51284c=_0x2b56bc['user'][_0x3411('0x24')]({'plain':!![]});if(!_0x51284c)throw new Error(_0x3411('0x4a'));if(_0x51284c[_0x3411('0x4b')]==='user'){var _0x3d6e65=_0x40f82b[_0x3411('0x24')]({'plain':!![]});var _0x47bb55=_0x3411('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x47bb55,'userProfileId':_0x51284c['userProfileId']},'raw':!![]})[_0x3411('0x40')](function(_0x55e0fe){if(_0x55e0fe&&_0x55e0fe[_0x3411('0x4c')]===0x0){return db[_0x3411('0x4d')][_0x3411('0x48')]({'name':_0x3d6e65['name'],'resourceId':_0x3d6e65['id'],'type':_0x55e0fe[_0x3411('0x27')],'sectionId':_0x55e0fe['id']},{})['then'](function(){return _0x40f82b;});}else{return _0x40f82b;}})['catch'](function(_0x4c2f2e){logger['error'](_0x3411('0x4e'),_0x4c2f2e);throw _0x4c2f2e;});}return _0x40f82b;})[_0x3411('0x40')](respondWithResult(_0x62d745,0xc9))[_0x3411('0x45')](handleError(_0x62d745,null));};exports[_0x3411('0x22')]=function(_0x55be50,_0x41859a){if(_0x55be50[_0x3411('0x49')]['id']){delete _0x55be50[_0x3411('0x49')]['id'];}return db['AnalyticMetric'][_0x3411('0x4f')]({'where':{'id':_0x55be50[_0x3411('0x50')]['id']}})[_0x3411('0x40')](handleEntityNotFound(_0x41859a,null))[_0x3411('0x40')](saveUpdates(_0x55be50[_0x3411('0x49')],null))['then'](respondWithResult(_0x41859a,null))[_0x3411('0x45')](handleError(_0x41859a,null));};exports['destroy']=function(_0x5046e5,_0x2fdba8){return db[_0x3411('0x3f')]['find']({'where':{'id':_0x5046e5[_0x3411('0x50')]['id']}})['then'](handleEntityNotFound(_0x2fdba8,null))[_0x3411('0x40')](removeEntity(_0x2fdba8,null))[_0x3411('0x45')](handleError(_0x2fdba8,null));}; \ No newline at end of file +var _0xa24b=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','destroy','then','get','Metrics','UserProfileResource','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type'];(function(_0x786334,_0x14bb53){var _0x2bcc75=function(_0x566423){while(--_0x566423){_0x786334['push'](_0x786334['shift']());}};_0x2bcc75(++_0x14bb53);}(_0xa24b,0x19f));var _0xba24=function(_0x1ee65b,_0x1e9ea4){_0x1ee65b=_0x1ee65b-0x0;var _0x519e4a=_0xa24b[_0x1ee65b];return _0x519e4a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba24('0x0'));var rimraf=require(_0xba24('0x1'));var zipdir=require(_0xba24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba24('0x3'));var moment=require(_0xba24('0x4'));var BPromise=require(_0xba24('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xba24('0x6'));var sox=require(_0xba24('0x7'));var csv=require(_0xba24('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xba24('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba24('0xa'));var as=require(_0xba24('0xb'));var hardwareService=require(_0xba24('0xc'));var logger=require(_0xba24('0xd'))(_0xba24('0xe'));var utils=require('../../config/utils');var config=require(_0xba24('0xf'));var licenseUtil=require(_0xba24('0x10'));var db=require(_0xba24('0x11'))['db'];function respondWithStatusCode(_0x3286fe,_0x497a0d){_0x497a0d=_0x497a0d||0xcc;return function(_0x5bb314){if(_0x5bb314){return _0x3286fe[_0xba24('0x12')](_0x497a0d);}return _0x3286fe['status'](_0x497a0d)[_0xba24('0x13')]();};}function respondWithResult(_0x4e0a9c,_0x301348){_0x301348=_0x301348||0xc8;return function(_0x4abf53){if(_0x4abf53){return _0x4e0a9c[_0xba24('0x14')](_0x301348)[_0xba24('0x15')](_0x4abf53);}};}function respondWithFilteredResult(_0x37be9f,_0x4f47dd){return function(_0x4e32a5){if(_0x4e32a5){var _0x195b52=_0x4e32a5[_0xba24('0x16')],_0x1aa694=_0x4f47dd[_0xba24('0x17')],_0x46e9c9=_0x4f47dd['offset']+_0x4f47dd['limit'],_0x369eac;if(_0x46e9c9>=_0x195b52){_0x46e9c9=_0x195b52;_0x369eac=0xc8;}else{_0x369eac=0xce;}_0x37be9f['status'](_0x369eac);return _0x37be9f[_0xba24('0x18')](_0xba24('0x19'),_0x1aa694+'-'+_0x46e9c9+'/'+_0x195b52)['json'](_0x4e32a5);}return null;};}function patchUpdates(_0x31946f){return function(_0x3c81dd){try{jsonpatch[_0xba24('0x1a')](_0x3c81dd,_0x31946f,!![]);}catch(_0x429008){return BPromise[_0xba24('0x1b')](_0x429008);}return _0x3c81dd['save']();};}function saveUpdates(_0x1037df,_0x9f0f80){return function(_0x5a6100){if(_0x5a6100){return _0x5a6100['update'](_0x1037df)['then'](function(_0x56547e){return _0x56547e;});}return null;};}function removeEntity(_0x536c38,_0x5778ce){return function(_0x9fe2cf){if(_0x9fe2cf){return _0x9fe2cf[_0xba24('0x1c')]()[_0xba24('0x1d')](function(){var _0x1b46d3=_0x9fe2cf[_0xba24('0x1e')]({'plain':!![]});var _0x1aee83=_0xba24('0x1f');return db[_0xba24('0x20')][_0xba24('0x1c')]({'where':{'type':_0x1aee83,'resourceId':_0x1b46d3['id']}})[_0xba24('0x1d')](function(){return _0x9fe2cf;});})[_0xba24('0x1d')](function(){_0x536c38[_0xba24('0x14')](0xcc)[_0xba24('0x13')]();});}};}function handleEntityNotFound(_0x3e9685,_0x289c13){return function(_0x4fbadf){if(!_0x4fbadf){_0x3e9685[_0xba24('0x12')](0x194);}return _0x4fbadf;};}function handleError(_0x5ada81,_0x4d5066){_0x4d5066=_0x4d5066||0x1f4;return function(_0x3f2960){logger['error'](_0x3f2960[_0xba24('0x21')]);if(_0x3f2960[_0xba24('0x22')]){delete _0x3f2960[_0xba24('0x22')];}_0x5ada81[_0xba24('0x14')](_0x4d5066)['send'](_0x3f2960);};}exports[_0xba24('0x23')]=function(_0x53d45e,_0x5b0658){var _0x23df05={},_0x4a908d={},_0x4ccce8={'count':0x0,'rows':[]};var _0x33c1c9=_[_0xba24('0x24')](db[_0xba24('0x25')][_0xba24('0x26')],function(_0x34b2e7){return{'name':_0x34b2e7[_0xba24('0x27')],'type':_0x34b2e7[_0xba24('0x28')]['key']};});_0x4a908d['model']=_[_0xba24('0x24')](_0x33c1c9,_0xba24('0x22'));_0x4a908d[_0xba24('0x29')]=_[_0xba24('0x2a')](_0x53d45e[_0xba24('0x29')]);_0x4a908d[_0xba24('0x2b')]=_[_0xba24('0x2c')](_0x4a908d[_0xba24('0x2d')],_0x4a908d[_0xba24('0x29')]);_0x23df05[_0xba24('0x2e')]=_[_0xba24('0x2c')](_0x4a908d[_0xba24('0x2d')],qs[_0xba24('0x2f')](_0x53d45e[_0xba24('0x29')]['fields']));_0x23df05[_0xba24('0x2e')]=_0x23df05[_0xba24('0x2e')][_0xba24('0x30')]?_0x23df05[_0xba24('0x2e')]:_0x4a908d[_0xba24('0x2d')];if(!_0x53d45e['query'][_0xba24('0x31')](_0xba24('0x32'))){_0x23df05[_0xba24('0x33')]=qs['limit'](_0x53d45e[_0xba24('0x29')]['limit']);_0x23df05[_0xba24('0x17')]=qs[_0xba24('0x17')](_0x53d45e[_0xba24('0x29')][_0xba24('0x17')]);}_0x23df05[_0xba24('0x34')]=qs['sort'](_0x53d45e[_0xba24('0x29')][_0xba24('0x35')]);_0x23df05[_0xba24('0x36')]=qs[_0xba24('0x2b')](_['pick'](_0x53d45e['query'],_0x4a908d['filters']),_0x33c1c9);if(_0x53d45e[_0xba24('0x29')][_0xba24('0x37')]){_0x23df05[_0xba24('0x36')]=_['merge'](_0x23df05['where'],{'$or':_['map'](_0x33c1c9,function(_0x335a2f){if(_0x335a2f[_0xba24('0x28')]!==_0xba24('0x38')){var _0xc725ce={};_0xc725ce[_0x335a2f[_0xba24('0x22')]]={'$like':'%'+_0x53d45e[_0xba24('0x29')][_0xba24('0x37')]+'%'};return _0xc725ce;}})});}_0x23df05=_[_0xba24('0x39')]({},_0x23df05,_0x53d45e[_0xba24('0x3a')]);var _0x1f5a2f={'where':_0x23df05['where']};return db[_0xba24('0x25')][_0xba24('0x16')](_0x1f5a2f)['then'](function(_0x8b2186){_0x4ccce8[_0xba24('0x16')]=_0x8b2186;if(_0x53d45e[_0xba24('0x29')][_0xba24('0x3b')]){_0x23df05[_0xba24('0x3c')]=[{'all':!![]}];}return db[_0xba24('0x25')][_0xba24('0x3d')](_0x23df05);})['then'](function(_0x30b6c1){_0x4ccce8[_0xba24('0x3e')]=_0x30b6c1;return _0x4ccce8;})[_0xba24('0x1d')](respondWithFilteredResult(_0x5b0658,_0x23df05))[_0xba24('0x3f')](handleError(_0x5b0658,null));};exports[_0xba24('0x40')]=function(_0x2d9b65,_0x132ceb){var _0x1b9b12={'raw':!![],'where':{'id':_0x2d9b65['params']['id']}},_0x504ec5={};_0x504ec5[_0xba24('0x2d')]=_[_0xba24('0x2a')](db[_0xba24('0x25')][_0xba24('0x26')]);_0x504ec5[_0xba24('0x29')]=_[_0xba24('0x2a')](_0x2d9b65[_0xba24('0x29')]);_0x504ec5[_0xba24('0x2b')]=_[_0xba24('0x2c')](_0x504ec5[_0xba24('0x2d')],_0x504ec5[_0xba24('0x29')]);_0x1b9b12['attributes']=_[_0xba24('0x2c')](_0x504ec5[_0xba24('0x2d')],qs[_0xba24('0x2f')](_0x2d9b65['query'][_0xba24('0x2f')]));_0x1b9b12['attributes']=_0x1b9b12[_0xba24('0x2e')]['length']?_0x1b9b12[_0xba24('0x2e')]:_0x504ec5[_0xba24('0x2d')];if(_0x2d9b65[_0xba24('0x29')][_0xba24('0x3b')]){_0x1b9b12[_0xba24('0x3c')]=[{'all':!![]}];}_0x1b9b12=_[_0xba24('0x39')]({},_0x1b9b12,_0x2d9b65[_0xba24('0x3a')]);return db[_0xba24('0x25')]['find'](_0x1b9b12)['then'](handleEntityNotFound(_0x132ceb,null))[_0xba24('0x1d')](respondWithResult(_0x132ceb,null))['catch'](handleError(_0x132ceb,null));};exports['create']=function(_0x289ace,_0x31b03d){return db[_0xba24('0x25')]['create'](_0x289ace['body'],{})[_0xba24('0x1d')](function(_0x2df0b5){var _0x8d7350=_0x289ace[_0xba24('0x41')][_0xba24('0x1e')]({'plain':!![]});if(!_0x8d7350)throw new Error(_0xba24('0x42'));if(_0x8d7350[_0xba24('0x43')]==='user'){var _0x1516ad=_0x2df0b5['get']({'plain':!![]});var _0x423f15=_0xba24('0x1f');return db[_0xba24('0x44')][_0xba24('0x45')]({'where':{'name':_0x423f15,'userProfileId':_0x8d7350[_0xba24('0x46')]},'raw':!![]})[_0xba24('0x1d')](function(_0x1a928f){if(_0x1a928f&&_0x1a928f['autoAssociation']===0x0){return db['UserProfileResource'][_0xba24('0x47')]({'name':_0x1516ad[_0xba24('0x22')],'resourceId':_0x1516ad['id'],'type':_0x1a928f[_0xba24('0x22')],'sectionId':_0x1a928f['id']},{})['then'](function(){return _0x2df0b5;});}else{return _0x2df0b5;}})['catch'](function(_0x2bfd3f){logger['error'](_0xba24('0x48'),_0x2bfd3f);throw _0x2bfd3f;});}return _0x2df0b5;})['then'](respondWithResult(_0x31b03d,0xc9))[_0xba24('0x3f')](handleError(_0x31b03d,null));};exports[_0xba24('0x49')]=function(_0x4cd6d6,_0x21551e){if(_0x4cd6d6[_0xba24('0x4a')]['id']){delete _0x4cd6d6[_0xba24('0x4a')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x4cd6d6['params']['id']}})[_0xba24('0x1d')](handleEntityNotFound(_0x21551e,null))[_0xba24('0x1d')](saveUpdates(_0x4cd6d6['body'],null))[_0xba24('0x1d')](respondWithResult(_0x21551e,null))[_0xba24('0x3f')](handleError(_0x21551e,null));};exports[_0xba24('0x1c')]=function(_0x3a6ea1,_0x41e072){return db[_0xba24('0x25')][_0xba24('0x45')]({'where':{'id':_0x3a6ea1[_0xba24('0x4b')]['id']}})[_0xba24('0x1d')](handleEntityNotFound(_0x41e072,null))['then'](removeEntity(_0x41e072,null))[_0xba24('0x3f')](handleError(_0x41e072,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2aa25b0..89267ec 100644 --- a/server/api/analyticMetric/analyticMetric.model.js +++ b/server/api/analyticMetric/analyticMetric.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5159=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','util'];(function(_0x156836,_0x20ebf3){var _0x87b37c=function(_0x1dc929){while(--_0x1dc929){_0x156836['push'](_0x156836['shift']());}};_0x87b37c(++_0x20ebf3);}(_0x5159,0xa1));var _0x9515=function(_0x122a25,_0x58c0f5){_0x122a25=_0x122a25-0x0;var _0x192de8=_0x5159[_0x122a25];return _0x192de8;};'use strict';var _=require('lodash');var util=require(_0x9515('0x0'));var logger=require(_0x9515('0x1'))(_0x9515('0x2'));var moment=require(_0x9515('0x3'));var BPromise=require(_0x9515('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9515('0x5'));var rimraf=require(_0x9515('0x6'));var config=require(_0x9515('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x9515('0x8')]=function(_0x46a686,_0x56063a){return _0x46a686['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6996=['exports','analytics_metrics','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x148806,_0x5e76a0){var _0x1b1f87=function(_0x54afc0){while(--_0x54afc0){_0x148806['push'](_0x148806['shift']());}};_0x1b1f87(++_0x5e76a0);}(_0x6996,0x65));var _0x6699=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x6996[_0x22eb96];return _0x5e1adf;};'use strict';var _=require(_0x6699('0x0'));var util=require('util');var logger=require(_0x6699('0x1'))(_0x6699('0x2'));var moment=require(_0x6699('0x3'));var BPromise=require(_0x6699('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6699('0x5'));var rimraf=require(_0x6699('0x6'));var config=require(_0x6699('0x7'));var attributes=require(_0x6699('0x8'));module[_0x6699('0x9')]=function(_0x18aed7,_0x28eec4){return _0x18aed7['define']('AnalyticMetric',attributes,{'tableName':_0x6699('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 1ae2aa9..7c23072 100644 --- a/server/api/analyticMetric/analyticMetric.rpc.js +++ b/server/api/analyticMetric/analyticMetric.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb746=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s'];(function(_0x76005c,_0x5c9647){var _0x12617f=function(_0x5db48d){while(--_0x5db48d){_0x76005c['push'](_0x76005c['shift']());}};_0x12617f(++_0x5c9647);}(_0xb746,0x71));var _0x6b74=function(_0x48b8fc,_0x5b46d8){_0x48b8fc=_0x48b8fc-0x0;var _0x1dc3be=_0xb746[_0x48b8fc];return _0x1dc3be;};'use strict';var _=require(_0x6b74('0x0'));var util=require(_0x6b74('0x1'));var moment=require(_0x6b74('0x2'));var BPromise=require(_0x6b74('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b74('0x4'));var db=require(_0x6b74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b74('0x6'))('rpc');var config=require(_0x6b74('0x7'));var jayson=require(_0x6b74('0x8'));var client=jayson['client'][_0x6b74('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27a8b6,_0x270bad,_0x10839d){return new BPromise(function(_0x12152b,_0x5623c3){return client[_0x6b74('0xa')](_0x27a8b6,_0x10839d)[_0x6b74('0xb')](function(_0x2d212b){logger['info'](_0x6b74('0xc'),_0x270bad,_0x6b74('0xd'));logger[_0x6b74('0xe')](_0x6b74('0xf'),_0x270bad,_0x6b74('0xd'),JSON[_0x6b74('0x10')](_0x2d212b));if(_0x2d212b[_0x6b74('0x11')]){if(_0x2d212b['error'][_0x6b74('0x12')]===0x1f4){logger[_0x6b74('0x11')](_0x6b74('0xc'),_0x270bad,_0x2d212b[_0x6b74('0x11')]['message']);return _0x5623c3(_0x2d212b[_0x6b74('0x11')]['message']);}logger[_0x6b74('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x270bad,_0x2d212b[_0x6b74('0x11')][_0x6b74('0x13')]);return _0x12152b(_0x2d212b[_0x6b74('0x11')][_0x6b74('0x13')]);}else{logger['info'](_0x6b74('0xc'),_0x270bad,_0x6b74('0xd'));_0x12152b(_0x2d212b[_0x6b74('0x14')]['message']);}})['catch'](function(_0x4164bd){logger[_0x6b74('0x11')](_0x6b74('0xc'),_0x270bad,_0x4164bd);_0x5623c3(_0x4164bd);});});} \ No newline at end of file +var _0x3651=['request\x20sent','debug','stringify','error','code','message','info','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0xa62c0d,_0x2b4feb){var _0x5b62e4=function(_0x571fd3){while(--_0x571fd3){_0xa62c0d['push'](_0xa62c0d['shift']());}};_0x5b62e4(++_0x2b4feb);}(_0x3651,0x6e));var _0x1365=function(_0x2f7bab,_0x5ef284){_0x2f7bab=_0x2f7bab-0x0;var _0x450cae=_0x3651[_0x2f7bab];return _0x450cae;};'use strict';var _=require(_0x1365('0x0'));var util=require('util');var moment=require(_0x1365('0x1'));var BPromise=require(_0x1365('0x2'));var rs=require(_0x1365('0x3'));var fs=require('fs');var Redis=require(_0x1365('0x4'));var db=require(_0x1365('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1365('0x6'))(_0x1365('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1365('0x8')][_0x1365('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d279d,_0x13fafd,_0x584fb8){return new BPromise(function(_0x20e754,_0x3c2b45){return client['request'](_0x2d279d,_0x584fb8)['then'](function(_0x3d7ca7){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x13fafd,_0x1365('0xa'));logger[_0x1365('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x13fafd,'request\x20sent',JSON[_0x1365('0xc')](_0x3d7ca7));if(_0x3d7ca7['error']){if(_0x3d7ca7[_0x1365('0xd')][_0x1365('0xe')]===0x1f4){logger[_0x1365('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x13fafd,_0x3d7ca7[_0x1365('0xd')]['message']);return _0x3c2b45(_0x3d7ca7[_0x1365('0xd')][_0x1365('0xf')]);}logger[_0x1365('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x13fafd,_0x3d7ca7[_0x1365('0xd')]['message']);return _0x20e754(_0x3d7ca7[_0x1365('0xd')][_0x1365('0xf')]);}else{logger[_0x1365('0x10')](_0x1365('0x11'),_0x13fafd,_0x1365('0xa'));_0x20e754(_0x3d7ca7[_0x1365('0x12')][_0x1365('0xf')]);}})[_0x1365('0x13')](function(_0x1564fb){logger['error'](_0x1365('0x11'),_0x13fafd,_0x1564fb);_0x3c2b45(_0x1564fb);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 93850aa..f1c41f5 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','isAuthenticated','show','post','create','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x56aae2,_0x4cce4f){var _0x425590=function(_0x23c5f3){while(--_0x23c5f3){_0x56aae2['push'](_0x56aae2['shift']());}};_0x425590(++_0x4cce4f);}(_0x4819,0xcd));var _0x9481=function(_0x44e8fb,_0x23e56a){_0x44e8fb=_0x44e8fb-0x0;var _0x1d5476=_0x4819[_0x44e8fb];return _0x1d5476;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')]('/',auth[_0x9481('0xb')](),controller[_0x9481('0xe')]);router['put'](_0x9481('0xf'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);router['delete'](_0x9481('0xf'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);module[_0x9481('0x12')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','show','update','/:id','exports','multer','util','path','express'];(function(_0x4b319d,_0x1679a0){var _0x481c1b=function(_0xd6ef14){while(--_0xd6ef14){_0x4b319d['push'](_0x4b319d['shift']());}};_0x481c1b(++_0x1679a0);}(_0x7a54,0x106));var _0x47a5=function(_0x293b76,_0x4450c8){_0x293b76=_0x293b76-0x0;var _0x13a4ab=_0x7a54[_0x293b76];return _0x13a4ab;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['post']('/',auth[_0x47a5('0x9')](),controller['create']);router['put']('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xb')]);router['delete'](_0x47a5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 651a168..bbe90c7 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0994=['exports','TEXT'];(function(_0x4dd2f5,_0xf9961b){var _0x18f105=function(_0xf217e6){while(--_0xf217e6){_0x4dd2f5['push'](_0x4dd2f5['shift']());}};_0x18f105(++_0xf9961b);}(_0x0994,0x150));var _0x4099=function(_0x22386b,_0x167d25){_0x22386b=_0x22386b-0x0;var _0x4469bc=_0x0994[_0x22386b];return _0x4469bc;};'use strict';var Sequelize=require('sequelize');module[_0x4099('0x0')]={'tree':{'type':Sequelize[_0x4099('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb809=['TEXT','sequelize','exports'];(function(_0x10721d,_0x54acca){var _0x5b1286=function(_0x38bf5e){while(--_0x38bf5e){_0x10721d['push'](_0x10721d['shift']());}};_0x5b1286(++_0x54acca);}(_0xb809,0x1e7));var _0x9b80=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0xb809[_0x39ea42];return _0x33f5b7;};'use strict';var Sequelize=require(_0x9b80('0x0'));module[_0x9b80('0x1')]={'tree':{'type':Sequelize[_0x9b80('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index bffc4e0..8efbc7b 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.controller.js +++ b/server/api/analyticTreeReport/analyticTreeReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x621a=['where','pick','filter','merge','type','VIRTUAL','AnalyticTreeReport','then','includeAll','include','findAll','rows','show','keys','length','options','find','create','catch','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x284ec9,_0x5f4189){var _0x3c51da=function(_0x385873){while(--_0x385873){_0x284ec9['push'](_0x284ec9['shift']());}};_0x3c51da(++_0x5f4189);}(_0x621a,0x1e3));var _0xa621=function(_0x382bba,_0x552036){_0x382bba=_0x382bba-0x0;var _0x208ad7=_0x621a[_0x382bba];return _0x208ad7;};'use strict';var pdf=require(_0xa621('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa621('0x1'));var zipdir=require(_0xa621('0x2'));var jsonpatch=require(_0xa621('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa621('0x4'));var Mustache=require(_0xa621('0x5'));var util=require(_0xa621('0x6'));var path=require(_0xa621('0x7'));var sox=require(_0xa621('0x8'));var csv=require(_0xa621('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa621('0xa'));var squel=require('squel');var crypto=require(_0xa621('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa621('0xc'));var toCsv=require(_0xa621('0x9'));var querystring=require(_0xa621('0xd'));var Papa=require(_0xa621('0xe'));var Redis=require(_0xa621('0xf'));var authService=require(_0xa621('0x10'));var qs=require(_0xa621('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa621('0x12'));var logger=require(_0xa621('0x13'))(_0xa621('0x14'));var utils=require(_0xa621('0x15'));var config=require(_0xa621('0x16'));var licenseUtil=require(_0xa621('0x17'));var db=require(_0xa621('0x18'))['db'];function respondWithStatusCode(_0x475b7f,_0x5633de){_0x5633de=_0x5633de||0xcc;return function(_0x1616f7){if(_0x1616f7){return _0x475b7f[_0xa621('0x19')](_0x5633de);}return _0x475b7f[_0xa621('0x1a')](_0x5633de)['end']();};}function respondWithResult(_0x263501,_0x37a55e){_0x37a55e=_0x37a55e||0xc8;return function(_0x2cf079){if(_0x2cf079){return _0x263501[_0xa621('0x1a')](_0x37a55e)[_0xa621('0x1b')](_0x2cf079);}};}function respondWithFilteredResult(_0x2567b0,_0x5b5d4d){return function(_0x37b3cf){if(_0x37b3cf){var _0x5f352c=_0x37b3cf[_0xa621('0x1c')],_0x32edde=_0x5b5d4d[_0xa621('0x1d')],_0x418889=_0x5b5d4d['offset']+_0x5b5d4d[_0xa621('0x1e')],_0x4de9e6;if(_0x418889>=_0x5f352c){_0x418889=_0x5f352c;_0x4de9e6=0xc8;}else{_0x4de9e6=0xce;}_0x2567b0[_0xa621('0x1a')](_0x4de9e6);return _0x2567b0[_0xa621('0x1f')](_0xa621('0x20'),_0x32edde+'-'+_0x418889+'/'+_0x5f352c)[_0xa621('0x1b')](_0x37b3cf);}return null;};}function patchUpdates(_0x30b798){return function(_0x3dfb7a){try{jsonpatch['apply'](_0x3dfb7a,_0x30b798,!![]);}catch(_0x35f62f){return BPromise[_0xa621('0x21')](_0x35f62f);}return _0x3dfb7a[_0xa621('0x22')]();};}function saveUpdates(_0x267c3c,_0x2acd01){return function(_0x196dbd){if(_0x196dbd){return _0x196dbd[_0xa621('0x23')](_0x267c3c)['then'](function(_0x2926a1){return _0x2926a1;});}return null;};}function removeEntity(_0x2aeffe,_0x448469){return function(_0x45c42b){if(_0x45c42b){return _0x45c42b[_0xa621('0x24')]()['then'](function(){_0x2aeffe[_0xa621('0x1a')](0xcc)[_0xa621('0x25')]();});}};}function handleEntityNotFound(_0x3ab525,_0x4fae38){return function(_0xa93945){if(!_0xa93945){_0x3ab525[_0xa621('0x19')](0x194);}return _0xa93945;};}function handleError(_0x26afaf,_0x345c46){_0x345c46=_0x345c46||0x1f4;return function(_0x152b1e){logger[_0xa621('0x26')](_0x152b1e[_0xa621('0x27')]);if(_0x152b1e[_0xa621('0x28')]){delete _0x152b1e[_0xa621('0x28')];}_0x26afaf['status'](_0x345c46)['send'](_0x152b1e);};}exports[_0xa621('0x29')]=function(_0x474612,_0x5a3962){var _0x4a613a={},_0x39aa31={},_0x5b2499={'count':0x0,'rows':[]};var _0x1e7abd=_[_0xa621('0x2a')](db['AnalyticTreeReport'][_0xa621('0x2b')],function(_0x56421e){return{'name':_0x56421e[_0xa621('0x2c')],'type':_0x56421e['type'][_0xa621('0x2d')]};});_0x39aa31['model']=_[_0xa621('0x2a')](_0x1e7abd,'name');_0x39aa31[_0xa621('0x2e')]=_['keys'](_0x474612[_0xa621('0x2e')]);_0x39aa31[_0xa621('0x2f')]=_[_0xa621('0x30')](_0x39aa31['model'],_0x39aa31[_0xa621('0x2e')]);_0x4a613a[_0xa621('0x31')]=_['intersection'](_0x39aa31[_0xa621('0x32')],qs[_0xa621('0x33')](_0x474612[_0xa621('0x2e')]['fields']));_0x4a613a[_0xa621('0x31')]=_0x4a613a[_0xa621('0x31')]['length']?_0x4a613a[_0xa621('0x31')]:_0x39aa31[_0xa621('0x32')];if(!_0x474612[_0xa621('0x2e')][_0xa621('0x34')](_0xa621('0x35'))){_0x4a613a[_0xa621('0x1e')]=qs[_0xa621('0x1e')](_0x474612['query'][_0xa621('0x1e')]);_0x4a613a[_0xa621('0x1d')]=qs['offset'](_0x474612[_0xa621('0x2e')][_0xa621('0x1d')]);}_0x4a613a[_0xa621('0x36')]=qs['sort'](_0x474612['query'][_0xa621('0x37')]);_0x4a613a[_0xa621('0x38')]=qs[_0xa621('0x2f')](_[_0xa621('0x39')](_0x474612['query'],_0x39aa31['filters']),_0x1e7abd);if(_0x474612[_0xa621('0x2e')][_0xa621('0x3a')]){_0x4a613a['where']=_[_0xa621('0x3b')](_0x4a613a[_0xa621('0x38')],{'$or':_[_0xa621('0x2a')](_0x1e7abd,function(_0x1e01d5){if(_0x1e01d5[_0xa621('0x3c')]!==_0xa621('0x3d')){var _0x1ae421={};_0x1ae421[_0x1e01d5[_0xa621('0x28')]]={'$like':'%'+_0x474612[_0xa621('0x2e')]['filter']+'%'};return _0x1ae421;}})});}_0x4a613a=_[_0xa621('0x3b')]({},_0x4a613a,_0x474612['options']);var _0x380c58={'where':_0x4a613a['where']};return db[_0xa621('0x3e')][_0xa621('0x1c')](_0x380c58)[_0xa621('0x3f')](function(_0x406637){_0x5b2499['count']=_0x406637;if(_0x474612[_0xa621('0x2e')][_0xa621('0x40')]){_0x4a613a[_0xa621('0x41')]=[{'all':!![]}];}return db[_0xa621('0x3e')][_0xa621('0x42')](_0x4a613a);})['then'](function(_0x4b25d5){_0x5b2499[_0xa621('0x43')]=_0x4b25d5;return _0x5b2499;})[_0xa621('0x3f')](respondWithFilteredResult(_0x5a3962,_0x4a613a))['catch'](handleError(_0x5a3962,null));};exports[_0xa621('0x44')]=function(_0xbee1a4,_0x9b4cb4){var _0x51888b={'raw':!![],'where':{'id':_0xbee1a4['params']['id']}},_0x4e2e02={};_0x4e2e02[_0xa621('0x32')]=_[_0xa621('0x45')](db[_0xa621('0x3e')][_0xa621('0x2b')]);_0x4e2e02['query']=_[_0xa621('0x45')](_0xbee1a4[_0xa621('0x2e')]);_0x4e2e02[_0xa621('0x2f')]=_[_0xa621('0x30')](_0x4e2e02['model'],_0x4e2e02['query']);_0x51888b['attributes']=_[_0xa621('0x30')](_0x4e2e02[_0xa621('0x32')],qs[_0xa621('0x33')](_0xbee1a4['query'][_0xa621('0x33')]));_0x51888b[_0xa621('0x31')]=_0x51888b['attributes'][_0xa621('0x46')]?_0x51888b[_0xa621('0x31')]:_0x4e2e02[_0xa621('0x32')];if(_0xbee1a4[_0xa621('0x2e')][_0xa621('0x40')]){_0x51888b[_0xa621('0x41')]=[{'all':!![]}];}_0x51888b=_[_0xa621('0x3b')]({},_0x51888b,_0xbee1a4[_0xa621('0x47')]);return db[_0xa621('0x3e')][_0xa621('0x48')](_0x51888b)[_0xa621('0x3f')](handleEntityNotFound(_0x9b4cb4,null))[_0xa621('0x3f')](respondWithResult(_0x9b4cb4,null))['catch'](handleError(_0x9b4cb4,null));};exports['create']=function(_0xee075c,_0x25a845){return db[_0xa621('0x3e')][_0xa621('0x49')](_0xee075c['body'],{})[_0xa621('0x3f')](respondWithResult(_0x25a845,0xc9))[_0xa621('0x4a')](handleError(_0x25a845,null));};exports['update']=function(_0x52a0e7,_0x1f8ae6){if(_0x52a0e7[_0xa621('0x4b')]['id']){delete _0x52a0e7[_0xa621('0x4b')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x52a0e7[_0xa621('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f8ae6,null))[_0xa621('0x3f')](saveUpdates(_0x52a0e7[_0xa621('0x4b')],null))[_0xa621('0x3f')](respondWithResult(_0x1f8ae6,null))[_0xa621('0x4a')](handleError(_0x1f8ae6,null));};exports[_0xa621('0x24')]=function(_0x18eff3,_0x485eb4){return db['AnalyticTreeReport'][_0xa621('0x48')]({'where':{'id':_0x18eff3[_0xa621('0x4c')]['id']}})[_0xa621('0x3f')](handleEntityNotFound(_0x485eb4,null))[_0xa621('0x3f')](removeEntity(_0x485eb4,null))['catch'](handleError(_0x485eb4,null));}; \ No newline at end of file +var _0x0c52=['index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','catch','show','params','keys','length','includeAll','options','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','error','stack','name','send'];(function(_0x287131,_0x4f6fd3){var _0x344111=function(_0x4b9c66){while(--_0x4b9c66){_0x287131['push'](_0x287131['shift']());}};_0x344111(++_0x4f6fd3);}(_0x0c52,0x6b));var _0x20c5=function(_0x23d893,_0x59afd7){_0x23d893=_0x23d893-0x0;var _0x35edbc=_0x0c52[_0x23d893];return _0x35edbc;};'use strict';var pdf=require(_0x20c5('0x0'));var emlformat=require(_0x20c5('0x1'));var rimraf=require(_0x20c5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x20c5('0x3'));var moment=require(_0x20c5('0x4'));var BPromise=require(_0x20c5('0x5'));var Mustache=require(_0x20c5('0x6'));var util=require('util');var path=require(_0x20c5('0x7'));var sox=require(_0x20c5('0x8'));var csv=require(_0x20c5('0x9'));var ejs=require(_0x20c5('0xa'));var fs=require('fs');var _=require(_0x20c5('0xb'));var squel=require(_0x20c5('0xc'));var crypto=require(_0x20c5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x20c5('0xe'));var toCsv=require(_0x20c5('0x9'));var querystring=require(_0x20c5('0xf'));var Papa=require('papaparse');var Redis=require(_0x20c5('0x10'));var authService=require(_0x20c5('0x11'));var qs=require(_0x20c5('0x12'));var as=require(_0x20c5('0x13'));var hardwareService=require(_0x20c5('0x14'));var logger=require(_0x20c5('0x15'))(_0x20c5('0x16'));var utils=require(_0x20c5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x20c5('0x18'));var db=require(_0x20c5('0x19'))['db'];function respondWithStatusCode(_0x175bf7,_0x135fff){_0x135fff=_0x135fff||0xcc;return function(_0x2cf4d6){if(_0x2cf4d6){return _0x175bf7[_0x20c5('0x1a')](_0x135fff);}return _0x175bf7[_0x20c5('0x1b')](_0x135fff)[_0x20c5('0x1c')]();};}function respondWithResult(_0x3d38b2,_0x570118){_0x570118=_0x570118||0xc8;return function(_0x489362){if(_0x489362){return _0x3d38b2['status'](_0x570118)[_0x20c5('0x1d')](_0x489362);}};}function respondWithFilteredResult(_0x31a4f7,_0x2956c3){return function(_0x348626){if(_0x348626){var _0x422503=_0x348626[_0x20c5('0x1e')],_0x3e889b=_0x2956c3[_0x20c5('0x1f')],_0x443e73=_0x2956c3['offset']+_0x2956c3[_0x20c5('0x20')],_0x46dce1;if(_0x443e73>=_0x422503){_0x443e73=_0x422503;_0x46dce1=0xc8;}else{_0x46dce1=0xce;}_0x31a4f7[_0x20c5('0x1b')](_0x46dce1);return _0x31a4f7[_0x20c5('0x21')]('Content-Range',_0x3e889b+'-'+_0x443e73+'/'+_0x422503)[_0x20c5('0x1d')](_0x348626);}return null;};}function patchUpdates(_0x2934e6){return function(_0x388413){try{jsonpatch['apply'](_0x388413,_0x2934e6,!![]);}catch(_0x47c053){return BPromise[_0x20c5('0x22')](_0x47c053);}return _0x388413[_0x20c5('0x23')]();};}function saveUpdates(_0x252a75,_0x2740f8){return function(_0x1acd1f){if(_0x1acd1f){return _0x1acd1f[_0x20c5('0x24')](_0x252a75)['then'](function(_0x5c50fb){return _0x5c50fb;});}return null;};}function removeEntity(_0x9054ff,_0x1a759a){return function(_0x1c35bd){if(_0x1c35bd){return _0x1c35bd[_0x20c5('0x25')]()[_0x20c5('0x26')](function(){_0x9054ff['status'](0xcc)[_0x20c5('0x1c')]();});}};}function handleEntityNotFound(_0x508d74,_0x268470){return function(_0x5078e2){if(!_0x5078e2){_0x508d74[_0x20c5('0x1a')](0x194);}return _0x5078e2;};}function handleError(_0x3dcc42,_0x211201){_0x211201=_0x211201||0x1f4;return function(_0x30fc1a){logger[_0x20c5('0x27')](_0x30fc1a[_0x20c5('0x28')]);if(_0x30fc1a[_0x20c5('0x29')]){delete _0x30fc1a[_0x20c5('0x29')];}_0x3dcc42[_0x20c5('0x1b')](_0x211201)[_0x20c5('0x2a')](_0x30fc1a);};}exports[_0x20c5('0x2b')]=function(_0x4421a6,_0xb7dc70){var _0xbae92={},_0x1c61d5={},_0x524148={'count':0x0,'rows':[]};var _0x5d332d=_[_0x20c5('0x2c')](db[_0x20c5('0x2d')][_0x20c5('0x2e')],function(_0x387385){return{'name':_0x387385[_0x20c5('0x2f')],'type':_0x387385[_0x20c5('0x30')][_0x20c5('0x31')]};});_0x1c61d5['model']=_['map'](_0x5d332d,_0x20c5('0x29'));_0x1c61d5[_0x20c5('0x32')]=_['keys'](_0x4421a6[_0x20c5('0x32')]);_0x1c61d5[_0x20c5('0x33')]=_[_0x20c5('0x34')](_0x1c61d5[_0x20c5('0x35')],_0x1c61d5['query']);_0xbae92[_0x20c5('0x36')]=_[_0x20c5('0x34')](_0x1c61d5[_0x20c5('0x35')],qs[_0x20c5('0x37')](_0x4421a6[_0x20c5('0x32')][_0x20c5('0x37')]));_0xbae92[_0x20c5('0x36')]=_0xbae92[_0x20c5('0x36')]['length']?_0xbae92['attributes']:_0x1c61d5[_0x20c5('0x35')];if(!_0x4421a6[_0x20c5('0x32')]['hasOwnProperty'](_0x20c5('0x38'))){_0xbae92['limit']=qs['limit'](_0x4421a6[_0x20c5('0x32')][_0x20c5('0x20')]);_0xbae92[_0x20c5('0x1f')]=qs[_0x20c5('0x1f')](_0x4421a6[_0x20c5('0x32')]['offset']);}_0xbae92[_0x20c5('0x39')]=qs[_0x20c5('0x3a')](_0x4421a6[_0x20c5('0x32')][_0x20c5('0x3a')]);_0xbae92[_0x20c5('0x3b')]=qs[_0x20c5('0x33')](_[_0x20c5('0x3c')](_0x4421a6['query'],_0x1c61d5[_0x20c5('0x33')]),_0x5d332d);if(_0x4421a6[_0x20c5('0x32')][_0x20c5('0x3d')]){_0xbae92[_0x20c5('0x3b')]=_[_0x20c5('0x3e')](_0xbae92['where'],{'$or':_[_0x20c5('0x2c')](_0x5d332d,function(_0x2dee9e){if(_0x2dee9e['type']!==_0x20c5('0x3f')){var _0x230481={};_0x230481[_0x2dee9e[_0x20c5('0x29')]]={'$like':'%'+_0x4421a6[_0x20c5('0x32')][_0x20c5('0x3d')]+'%'};return _0x230481;}})});}_0xbae92=_[_0x20c5('0x3e')]({},_0xbae92,_0x4421a6['options']);var _0x4b2fc8={'where':_0xbae92[_0x20c5('0x3b')]};return db['AnalyticTreeReport'][_0x20c5('0x1e')](_0x4b2fc8)['then'](function(_0x43eb81){_0x524148[_0x20c5('0x1e')]=_0x43eb81;if(_0x4421a6[_0x20c5('0x32')]['includeAll']){_0xbae92[_0x20c5('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0xbae92);})[_0x20c5('0x26')](function(_0x36dc31){_0x524148['rows']=_0x36dc31;return _0x524148;})[_0x20c5('0x26')](respondWithFilteredResult(_0xb7dc70,_0xbae92))[_0x20c5('0x41')](handleError(_0xb7dc70,null));};exports[_0x20c5('0x42')]=function(_0x1f8ee1,_0x50aa86){var _0x13e931={'raw':!![],'where':{'id':_0x1f8ee1[_0x20c5('0x43')]['id']}},_0x12d23c={};_0x12d23c[_0x20c5('0x35')]=_[_0x20c5('0x44')](db[_0x20c5('0x2d')][_0x20c5('0x2e')]);_0x12d23c['query']=_[_0x20c5('0x44')](_0x1f8ee1['query']);_0x12d23c[_0x20c5('0x33')]=_[_0x20c5('0x34')](_0x12d23c[_0x20c5('0x35')],_0x12d23c[_0x20c5('0x32')]);_0x13e931[_0x20c5('0x36')]=_['intersection'](_0x12d23c[_0x20c5('0x35')],qs[_0x20c5('0x37')](_0x1f8ee1[_0x20c5('0x32')]['fields']));_0x13e931[_0x20c5('0x36')]=_0x13e931['attributes'][_0x20c5('0x45')]?_0x13e931['attributes']:_0x12d23c[_0x20c5('0x35')];if(_0x1f8ee1[_0x20c5('0x32')][_0x20c5('0x46')]){_0x13e931[_0x20c5('0x40')]=[{'all':!![]}];}_0x13e931=_[_0x20c5('0x3e')]({},_0x13e931,_0x1f8ee1[_0x20c5('0x47')]);return db[_0x20c5('0x2d')]['find'](_0x13e931)[_0x20c5('0x26')](handleEntityNotFound(_0x50aa86,null))['then'](respondWithResult(_0x50aa86,null))[_0x20c5('0x41')](handleError(_0x50aa86,null));};exports['create']=function(_0x25a906,_0x54c5c3){return db[_0x20c5('0x2d')][_0x20c5('0x48')](_0x25a906[_0x20c5('0x49')],{})[_0x20c5('0x26')](respondWithResult(_0x54c5c3,0xc9))[_0x20c5('0x41')](handleError(_0x54c5c3,null));};exports[_0x20c5('0x24')]=function(_0x530fd0,_0x449d73){if(_0x530fd0['body']['id']){delete _0x530fd0[_0x20c5('0x49')]['id'];}return db[_0x20c5('0x2d')][_0x20c5('0x4a')]({'where':{'id':_0x530fd0[_0x20c5('0x43')]['id']}})[_0x20c5('0x26')](handleEntityNotFound(_0x449d73,null))[_0x20c5('0x26')](saveUpdates(_0x530fd0[_0x20c5('0x49')],null))['then'](respondWithResult(_0x449d73,null))[_0x20c5('0x41')](handleError(_0x449d73,null));};exports[_0x20c5('0x25')]=function(_0x3985dd,_0x1fc972){return db[_0x20c5('0x2d')]['find']({'where':{'id':_0x3985dd[_0x20c5('0x43')]['id']}})[_0x20c5('0x26')](handleEntityNotFound(_0x1fc972,null))[_0x20c5('0x26')](removeEntity(_0x1fc972,null))[_0x20c5('0x41')](handleError(_0x1fc972,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 90d1cd6..c5ee8c6 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.model.js +++ b/server/api/analyticTreeReport/analyticTreeReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9582=['bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment'];(function(_0x362d66,_0x322877){var _0x33f654=function(_0x13735f){while(--_0x13735f){_0x362d66['push'](_0x362d66['shift']());}};_0x33f654(++_0x322877);}(_0x9582,0x95));var _0x2958=function(_0x53dd46,_0x47e1b8){_0x53dd46=_0x53dd46-0x0;var _0x5e5aa3=_0x9582[_0x53dd46];return _0x5e5aa3;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var logger=require(_0x2958('0x2'))(_0x2958('0x3'));var moment=require(_0x2958('0x4'));var BPromise=require(_0x2958('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2958('0x6'));var rimraf=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var attributes=require(_0x2958('0x9'));module[_0x2958('0xa')]=function(_0xbde128,_0x88ffaa){return _0xbde128[_0x2958('0xb')](_0x2958('0xc'),attributes,{'tableName':_0x2958('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a12=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util'];(function(_0x40f09a,_0x3743b6){var _0x2eb96c=function(_0xe6203d){while(--_0xe6203d){_0x40f09a['push'](_0x40f09a['shift']());}};_0x2eb96c(++_0x3743b6);}(_0x7a12,0xe8));var _0x27a1=function(_0x323d9c,_0x3414f5){_0x323d9c=_0x323d9c-0x0;var _0x9f86e7=_0x7a12[_0x323d9c];return _0x9f86e7;};'use strict';var _=require(_0x27a1('0x0'));var util=require(_0x27a1('0x1'));var logger=require(_0x27a1('0x2'))(_0x27a1('0x3'));var moment=require(_0x27a1('0x4'));var BPromise=require(_0x27a1('0x5'));var rp=require(_0x27a1('0x6'));var fs=require('fs');var path=require(_0x27a1('0x7'));var rimraf=require('rimraf');var config=require(_0x27a1('0x8'));var attributes=require(_0x27a1('0x9'));module[_0x27a1('0xa')]=function(_0x389116,_0x2ccadb){return _0x389116[_0x27a1('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x27a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 1712367..8fec3ea 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x407a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x42423d,_0x5ce01f){var _0x4a5845=function(_0x9e5368){while(--_0x9e5368){_0x42423d['push'](_0x42423d['shift']());}};_0x4a5845(++_0x5ce01f);}(_0x407a,0x80));var _0xa407=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x407a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa407('0x0'));var util=require(_0xa407('0x1'));var moment=require('moment');var BPromise=require(_0xa407('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa407('0x3'))['db'];var utils=require(_0xa407('0x4'));var logger=require(_0xa407('0x5'))(_0xa407('0x6'));var config=require(_0xa407('0x7'));var jayson=require(_0xa407('0x8'));var client=jayson['client'][_0xa407('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x530f93,_0x4992e6,_0x4b0ce7){return new BPromise(function(_0x9f9c2f,_0x17bdfc){return client[_0xa407('0xa')](_0x530f93,_0x4b0ce7)[_0xa407('0xb')](function(_0x3e84f3){logger['info'](_0xa407('0xc'),_0x4992e6,_0xa407('0xd'));logger[_0xa407('0xe')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x4992e6,'request\x20sent',JSON[_0xa407('0xf')](_0x3e84f3));if(_0x3e84f3[_0xa407('0x10')]){if(_0x3e84f3[_0xa407('0x10')][_0xa407('0x11')]===0x1f4){logger[_0xa407('0x10')](_0xa407('0xc'),_0x4992e6,_0x3e84f3['error'][_0xa407('0x12')]);return _0x17bdfc(_0x3e84f3['error'][_0xa407('0x12')]);}logger[_0xa407('0x10')](_0xa407('0xc'),_0x4992e6,_0x3e84f3[_0xa407('0x10')][_0xa407('0x12')]);return _0x9f9c2f(_0x3e84f3[_0xa407('0x10')]['message']);}else{logger[_0xa407('0x13')](_0xa407('0xc'),_0x4992e6,_0xa407('0xd'));_0x9f9c2f(_0x3e84f3[_0xa407('0x14')][_0xa407('0x12')]);}})[_0xa407('0x15')](function(_0x377086){logger[_0xa407('0x10')](_0xa407('0xc'),_0x4992e6,_0x377086);_0x17bdfc(_0x377086);});});} \ No newline at end of file +var _0xa696=['AnalyticTreeReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4973be,_0x4f971b){var _0x17c0da=function(_0x1d458a){while(--_0x1d458a){_0x4973be['push'](_0x4973be['shift']());}};_0x17c0da(++_0x4f971b);}(_0xa696,0x16b));var _0x6a69=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xa696[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x6a69('0x0'));var util=require(_0x6a69('0x1'));var moment=require(_0x6a69('0x2'));var BPromise=require(_0x6a69('0x3'));var rs=require(_0x6a69('0x4'));var fs=require('fs');var Redis=require(_0x6a69('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a69('0x6'));var logger=require(_0x6a69('0x7'))(_0x6a69('0x8'));var config=require('../../config/environment');var jayson=require(_0x6a69('0x9'));var client=jayson['client'][_0x6a69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x194368,_0x1d8c1a,_0x77f90f){return new BPromise(function(_0x51ec47,_0x559bfd){return client['request'](_0x194368,_0x77f90f)[_0x6a69('0xb')](function(_0x501bd4){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x1d8c1a,_0x6a69('0xc'));logger[_0x6a69('0xd')](_0x6a69('0xe'),_0x1d8c1a,_0x6a69('0xc'),JSON['stringify'](_0x501bd4));if(_0x501bd4[_0x6a69('0xf')]){if(_0x501bd4['error'][_0x6a69('0x10')]===0x1f4){logger[_0x6a69('0xf')](_0x6a69('0x11'),_0x1d8c1a,_0x501bd4[_0x6a69('0xf')][_0x6a69('0x12')]);return _0x559bfd(_0x501bd4[_0x6a69('0xf')][_0x6a69('0x12')]);}logger['error'](_0x6a69('0x11'),_0x1d8c1a,_0x501bd4[_0x6a69('0xf')][_0x6a69('0x12')]);return _0x51ec47(_0x501bd4[_0x6a69('0xf')]['message']);}else{logger['info'](_0x6a69('0x11'),_0x1d8c1a,'request\x20sent');_0x51ec47(_0x501bd4[_0x6a69('0x13')][_0x6a69('0x12')]);}})['catch'](function(_0x3e46b3){logger['error'](_0x6a69('0x11'),_0x1d8c1a,_0x3e46b3);_0x559bfd(_0x3e46b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e8651f3..34b7ff8 100644 --- a/server/api/analyticTreeReport/index.js +++ b/server/api/analyticTreeReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa7c=['connect-timeout','express','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','multer','util'];(function(_0x23c4d9,_0x1c2a46){var _0x26c18e=function(_0x3126e7){while(--_0x3126e7){_0x23c4d9['push'](_0x23c4d9['shift']());}};_0x26c18e(++_0x1c2a46);}(_0xaa7c,0x12e));var _0xcaa7=function(_0x5dda49,_0x444c0d){_0x5dda49=_0x5dda49-0x0;var _0x366fd9=_0xaa7c[_0x5dda49];return _0x366fd9;};'use strict';var multer=require(_0xcaa7('0x0'));var util=require(_0xcaa7('0x1'));var path=require('path');var timeout=require(_0xcaa7('0x2'));var express=require(_0xcaa7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcaa7('0x4'));var config=require(_0xcaa7('0x5'));var controller=require(_0xcaa7('0x6'));router[_0xcaa7('0x7')]('/',auth[_0xcaa7('0x8')](),controller[_0xcaa7('0x9')]);router[_0xcaa7('0x7')](_0xcaa7('0xa'),auth[_0xcaa7('0x8')](),controller['show']);router[_0xcaa7('0xb')]('/',auth[_0xcaa7('0x8')](),controller[_0xcaa7('0xc')]);router[_0xcaa7('0xd')](_0xcaa7('0xa'),auth[_0xcaa7('0x8')](),controller[_0xcaa7('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcaa7('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8c82=['update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','show','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c82,0x1a7));var _0x28c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c82[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x28c8('0x0'));var util=require(_0x28c8('0x1'));var path=require('path');var timeout=require(_0x28c8('0x2'));var express=require(_0x28c8('0x3'));var router=express[_0x28c8('0x4')]();var auth=require(_0x28c8('0x5'));var interaction=require(_0x28c8('0x6'));var config=require(_0x28c8('0x7'));var controller=require(_0x28c8('0x8'));router['get']('/',auth[_0x28c8('0x9')](),controller['index']);router['get']('/:id',auth[_0x28c8('0x9')](),controller[_0x28c8('0xa')]);router[_0x28c8('0xb')]('/',auth[_0x28c8('0x9')](),controller[_0x28c8('0xc')]);router[_0x28c8('0xd')]('/:id',auth[_0x28c8('0x9')](),controller[_0x28c8('0xe')]);router[_0x28c8('0xf')](_0x28c8('0x10'),auth[_0x28c8('0x9')](),controller[_0x28c8('0x11')]);module[_0x28c8('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9f04eec..a0f315a 100644 --- a/server/api/attachment/attachment.attributes.js +++ b/server/api/attachment/attachment.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e02=['STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e02,0x18d));var _0x24e0=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x4e02[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x24e0('0x0'));module[_0x24e0('0x1')]={'name':{'type':Sequelize[_0x24e0('0x2')]},'basename':{'type':Sequelize[_0x24e0('0x2')]},'type':{'type':Sequelize[_0x24e0('0x2')]}}; \ No newline at end of file +var _0xf2de=['exports','STRING','sequelize'];(function(_0x307a10,_0x181503){var _0x40b1a5=function(_0x166703){while(--_0x166703){_0x307a10['push'](_0x307a10['shift']());}};_0x40b1a5(++_0x181503);}(_0xf2de,0xc2));var _0xef2d=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xf2de[_0x494d1f];return _0x457b6e;};'use strict';var Sequelize=require(_0xef2d('0x0'));module[_0xef2d('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xef2d('0x2')]},'type':{'type':Sequelize[_0xef2d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3c419bd..a770114 100644 --- a/server/api/attachment/attachment.controller.js +++ b/server/api/attachment/attachment.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9be8=['rows','catch','rawAttributes','include','options','find','clone','params','get','createdAt','updatedAt','body','create','file','originalname','basename','filename','download','findOne','root','server/files/attachments/','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','json','reject','update','then','destroy','error','stack','name','index','map','Attachment','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x56766b,_0x4d2e09){var _0x279b14=function(_0x3b6cc1){while(--_0x3b6cc1){_0x56766b['push'](_0x56766b['shift']());}};_0x279b14(++_0x4d2e09);}(_0x9be8,0x1b9));var _0x89be=function(_0xba96b0,_0x36e8f8){_0xba96b0=_0xba96b0-0x0;var _0xdad969=_0x9be8[_0xba96b0];return _0xdad969;};'use strict';var pdf=require(_0x89be('0x0'));var emlformat=require(_0x89be('0x1'));var rimraf=require(_0x89be('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x89be('0x3'));var moment=require(_0x89be('0x4'));var BPromise=require(_0x89be('0x5'));var Mustache=require(_0x89be('0x6'));var util=require(_0x89be('0x7'));var path=require(_0x89be('0x8'));var sox=require(_0x89be('0x9'));var csv=require(_0x89be('0xa'));var ejs=require(_0x89be('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x89be('0xc'));var crypto=require('crypto');var jsforce=require(_0x89be('0xd'));var deskjs=require(_0x89be('0xe'));var toCsv=require(_0x89be('0xa'));var querystring=require('querystring');var Papa=require(_0x89be('0xf'));var Redis=require('ioredis');var authService=require(_0x89be('0x10'));var qs=require(_0x89be('0x11'));var as=require(_0x89be('0x12'));var hardwareService=require(_0x89be('0x13'));var logger=require(_0x89be('0x14'))(_0x89be('0x15'));var utils=require(_0x89be('0x16'));var config=require(_0x89be('0x17'));var licenseUtil=require(_0x89be('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a48e1,_0x16a657){_0x16a657=_0x16a657||0xcc;return function(_0x4a2a29){if(_0x4a2a29){return _0x1a48e1[_0x89be('0x19')](_0x16a657);}return _0x1a48e1[_0x89be('0x1a')](_0x16a657)[_0x89be('0x1b')]();};}function respondWithResult(_0x4e7b8e,_0x156fc5){_0x156fc5=_0x156fc5||0xc8;return function(_0x77d029){if(_0x77d029){return _0x4e7b8e[_0x89be('0x1a')](_0x156fc5)['json'](_0x77d029);}};}function respondWithFilteredResult(_0x3ecaa0,_0x3834dd){return function(_0x38cc86){if(_0x38cc86){var _0x30d0b4=_0x38cc86[_0x89be('0x1c')],_0x1808c1=_0x3834dd[_0x89be('0x1d')],_0x28df4d=_0x3834dd['offset']+_0x3834dd[_0x89be('0x1e')],_0x5bc93f;if(_0x28df4d>=_0x30d0b4){_0x28df4d=_0x30d0b4;_0x5bc93f=0xc8;}else{_0x5bc93f=0xce;}_0x3ecaa0[_0x89be('0x1a')](_0x5bc93f);return _0x3ecaa0[_0x89be('0x1f')]('Content-Range',_0x1808c1+'-'+_0x28df4d+'/'+_0x30d0b4)[_0x89be('0x20')](_0x38cc86);}return null;};}function patchUpdates(_0x394440){return function(_0x5dc720){try{jsonpatch['apply'](_0x5dc720,_0x394440,!![]);}catch(_0x55dc25){return BPromise[_0x89be('0x21')](_0x55dc25);}return _0x5dc720['save']();};}function saveUpdates(_0xe7f6be,_0x43a8b5){return function(_0x29dfd2){if(_0x29dfd2){return _0x29dfd2[_0x89be('0x22')](_0xe7f6be)[_0x89be('0x23')](function(_0x34bc25){return _0x34bc25;});}return null;};}function removeEntity(_0x7cad79,_0x25844c){return function(_0x325c4c){if(_0x325c4c){return _0x325c4c[_0x89be('0x24')]()[_0x89be('0x23')](function(){_0x7cad79[_0x89be('0x1a')](0xcc)[_0x89be('0x1b')]();});}};}function handleEntityNotFound(_0x59cc4a,_0x2029e4){return function(_0x152f6b){if(!_0x152f6b){_0x59cc4a[_0x89be('0x19')](0x194);}return _0x152f6b;};}function handleError(_0x3ee123,_0x573cba){_0x573cba=_0x573cba||0x1f4;return function(_0x1b985e){logger[_0x89be('0x25')](_0x1b985e[_0x89be('0x26')]);if(_0x1b985e[_0x89be('0x27')]){delete _0x1b985e[_0x89be('0x27')];}_0x3ee123['status'](_0x573cba)['send'](_0x1b985e);};}exports[_0x89be('0x28')]=function(_0x2c55f2,_0x661cae){var _0x5f53ce={},_0x1d0253={},_0x493009={'count':0x0,'rows':[]};var _0x27d615=_[_0x89be('0x29')](db[_0x89be('0x2a')]['rawAttributes'],function(_0x1cbc52){return{'name':_0x1cbc52[_0x89be('0x2b')],'type':_0x1cbc52[_0x89be('0x2c')]['key']};});_0x1d0253[_0x89be('0x2d')]=_[_0x89be('0x29')](_0x27d615,'name');_0x1d0253[_0x89be('0x2e')]=_[_0x89be('0x2f')](_0x2c55f2[_0x89be('0x2e')]);_0x1d0253[_0x89be('0x30')]=_[_0x89be('0x31')](_0x1d0253[_0x89be('0x2d')],_0x1d0253[_0x89be('0x2e')]);_0x5f53ce[_0x89be('0x32')]=_[_0x89be('0x31')](_0x1d0253[_0x89be('0x2d')],qs[_0x89be('0x33')](_0x2c55f2[_0x89be('0x2e')][_0x89be('0x33')]));_0x5f53ce[_0x89be('0x32')]=_0x5f53ce[_0x89be('0x32')][_0x89be('0x34')]?_0x5f53ce[_0x89be('0x32')]:_0x1d0253[_0x89be('0x2d')];if(!_0x2c55f2['query'][_0x89be('0x35')](_0x89be('0x36'))){_0x5f53ce['limit']=qs['limit'](_0x2c55f2[_0x89be('0x2e')]['limit']);_0x5f53ce['offset']=qs[_0x89be('0x1d')](_0x2c55f2[_0x89be('0x2e')]['offset']);}_0x5f53ce[_0x89be('0x37')]=qs[_0x89be('0x38')](_0x2c55f2[_0x89be('0x2e')][_0x89be('0x38')]);_0x5f53ce[_0x89be('0x39')]=qs['filters'](_[_0x89be('0x3a')](_0x2c55f2[_0x89be('0x2e')],_0x1d0253[_0x89be('0x30')]),_0x27d615);if(_0x2c55f2[_0x89be('0x2e')][_0x89be('0x3b')]){_0x5f53ce[_0x89be('0x39')]=_[_0x89be('0x3c')](_0x5f53ce[_0x89be('0x39')],{'$or':_[_0x89be('0x29')](_0x27d615,function(_0x3d6646){if(_0x3d6646[_0x89be('0x2c')]!==_0x89be('0x3d')){var _0x427bb6={};_0x427bb6[_0x3d6646[_0x89be('0x27')]]={'$like':'%'+_0x2c55f2[_0x89be('0x2e')][_0x89be('0x3b')]+'%'};return _0x427bb6;}})});}_0x5f53ce=_[_0x89be('0x3c')]({},_0x5f53ce,_0x2c55f2['options']);var _0x6a6b5a={'where':_0x5f53ce[_0x89be('0x39')]};return db['Attachment'][_0x89be('0x1c')](_0x6a6b5a)['then'](function(_0x3c6fa7){_0x493009[_0x89be('0x1c')]=_0x3c6fa7;if(_0x2c55f2['query'][_0x89be('0x3e')]){_0x5f53ce['include']=[{'all':!![]}];}return db[_0x89be('0x2a')]['findAll'](_0x5f53ce);})[_0x89be('0x23')](function(_0x40db12){_0x493009[_0x89be('0x3f')]=_0x40db12;return _0x493009;})[_0x89be('0x23')](respondWithFilteredResult(_0x661cae,_0x5f53ce))[_0x89be('0x40')](handleError(_0x661cae,null));};exports['show']=function(_0x132b0f,_0x4f6ec5){var _0x3910d2={'raw':!![],'where':{'id':_0x132b0f['params']['id']}},_0x562a6b={};_0x562a6b[_0x89be('0x2d')]=_['keys'](db['Attachment'][_0x89be('0x41')]);_0x562a6b[_0x89be('0x2e')]=_['keys'](_0x132b0f[_0x89be('0x2e')]);_0x562a6b['filters']=_['intersection'](_0x562a6b[_0x89be('0x2d')],_0x562a6b[_0x89be('0x2e')]);_0x3910d2['attributes']=_['intersection'](_0x562a6b[_0x89be('0x2d')],qs[_0x89be('0x33')](_0x132b0f[_0x89be('0x2e')][_0x89be('0x33')]));_0x3910d2[_0x89be('0x32')]=_0x3910d2[_0x89be('0x32')]['length']?_0x3910d2['attributes']:_0x562a6b[_0x89be('0x2d')];if(_0x132b0f[_0x89be('0x2e')][_0x89be('0x3e')]){_0x3910d2[_0x89be('0x42')]=[{'all':!![]}];}_0x3910d2=_['merge']({},_0x3910d2,_0x132b0f[_0x89be('0x43')]);return db[_0x89be('0x2a')][_0x89be('0x44')](_0x3910d2)[_0x89be('0x23')](handleEntityNotFound(_0x4f6ec5,null))['then'](respondWithResult(_0x4f6ec5,null))[_0x89be('0x40')](handleError(_0x4f6ec5,null));};exports[_0x89be('0x45')]=function(_0x3485cc,_0x4548cc){var _0x5b015d={'where':{'id':_0x3485cc[_0x89be('0x46')]['id']}},_0x3c8b14={};_0x3c8b14[_0x89be('0x2d')]=_[_0x89be('0x2f')](db[_0x89be('0x2a')][_0x89be('0x41')]);_0x5b015d[_0x89be('0x32')]=_[_0x89be('0x31')](_0x3c8b14['model'],qs[_0x89be('0x33')](_0x3485cc['query'][_0x89be('0x33')]));_0x5b015d['attributes']=_0x5b015d[_0x89be('0x32')][_0x89be('0x34')]?_0x5b015d['attributes']:_0x3c8b14[_0x89be('0x2d')];if(_0x3485cc['query'][_0x89be('0x3e')]){_0x5b015d[_0x89be('0x42')]=[{'all':!![]}];}_0x5b015d=_[_0x89be('0x3c')]({},_0x5b015d,_0x3485cc['options']);return db['Attachment']['find'](_0x5b015d)['then'](handleEntityNotFound(_0x4548cc,null))[_0x89be('0x23')](function(_0x256ae0){if(_0x256ae0){var _0x2024ec=_0x256ae0[_0x89be('0x47')]({'plain':!![]});_0x2024ec=qs['omit'](_0x2024ec,['id',_0x89be('0x48'),_0x89be('0x49')]);_0x3485cc[_0x89be('0x4a')]=_['omit'](_0x3485cc[_0x89be('0x4a')],['id',_0x89be('0x48'),'updatedAt']);return db['Attachment'][_0x89be('0x4b')](_['merge'](_0x2024ec,_0x3485cc['body']),{'include':_0x3485cc[_0x89be('0x2e')][_0x89be('0x3e')]?[{'all':!![]}]:undefined});}})[_0x89be('0x23')](respondWithResult(_0x4548cc,0xc9))['catch'](handleError(_0x4548cc,null));};exports[_0x89be('0x22')]=function(_0x33b734,_0x50fc28){if(_0x33b734[_0x89be('0x4a')]['id']){delete _0x33b734[_0x89be('0x4a')]['id'];}return db['Attachment'][_0x89be('0x44')]({'where':{'id':_0x33b734[_0x89be('0x46')]['id']}})[_0x89be('0x23')](handleEntityNotFound(_0x50fc28,null))[_0x89be('0x23')](saveUpdates(_0x33b734[_0x89be('0x4a')],null))[_0x89be('0x23')](respondWithResult(_0x50fc28,null))[_0x89be('0x40')](handleError(_0x50fc28,null));};exports['destroy']=function(_0x37291f,_0x42065b){return db[_0x89be('0x2a')]['find']({'where':{'id':_0x37291f['params']['id']}})[_0x89be('0x23')](handleEntityNotFound(_0x42065b,null))[_0x89be('0x23')](removeEntity(_0x42065b,null))[_0x89be('0x40')](handleError(_0x42065b,null));};exports['create']=function(_0xe2d1ac,_0x1e69e6,_0x782a0c){_0xe2d1ac[_0x89be('0x4a')]['name']=_0xe2d1ac[_0x89be('0x4c')][_0x89be('0x4d')];_0xe2d1ac[_0x89be('0x4a')][_0x89be('0x4e')]=_0xe2d1ac['file'][_0x89be('0x4f')];_0xe2d1ac[_0x89be('0x4a')][_0x89be('0x2c')]=_0xe2d1ac[_0x89be('0x4c')]['mimetype'];return db[_0x89be('0x2a')][_0x89be('0x4b')](_0xe2d1ac[_0x89be('0x4a')])[_0x89be('0x23')](respondWithResult(_0x1e69e6,0xc9))[_0x89be('0x40')](handleError(_0x1e69e6,null));};exports[_0x89be('0x50')]=function(_0x239c40,_0x4a5d58,_0x19e28d){return db['Attachment'][_0x89be('0x51')]({'where':{'id':_0x239c40['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4a5d58,null))[_0x89be('0x23')](function(_0x5b2f56){if(_0x5b2f56){return _0x4a5d58[_0x89be('0x50')](path['join'](config[_0x89be('0x52')],_0x89be('0x53'),_0x5b2f56[_0x89be('0x4e')]));}})[_0x89be('0x40')](handleError(_0x4a5d58,null));}; \ No newline at end of file +var _0x0cf6=['update','then','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','include','rows','params','fields','find','catch','clone','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','findOne','download','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x41cfb9,_0x3a53f9){var _0x515941=function(_0x201b5d){while(--_0x201b5d){_0x41cfb9['push'](_0x41cfb9['shift']());}};_0x515941(++_0x3a53f9);}(_0x0cf6,0x1de));var _0x60cf=function(_0x4e437e,_0x3388e0){_0x4e437e=_0x4e437e-0x0;var _0x3eca24=_0x0cf6[_0x4e437e];return _0x3eca24;};'use strict';var pdf=require(_0x60cf('0x0'));var emlformat=require(_0x60cf('0x1'));var rimraf=require(_0x60cf('0x2'));var zipdir=require(_0x60cf('0x3'));var jsonpatch=require(_0x60cf('0x4'));var rp=require(_0x60cf('0x5'));var moment=require(_0x60cf('0x6'));var BPromise=require(_0x60cf('0x7'));var Mustache=require(_0x60cf('0x8'));var util=require('util');var path=require(_0x60cf('0x9'));var sox=require(_0x60cf('0xa'));var csv=require(_0x60cf('0xb'));var ejs=require(_0x60cf('0xc'));var fs=require('fs');var _=require(_0x60cf('0xd'));var squel=require('squel');var crypto=require(_0x60cf('0xe'));var jsforce=require(_0x60cf('0xf'));var deskjs=require(_0x60cf('0x10'));var toCsv=require(_0x60cf('0xb'));var querystring=require('querystring');var Papa=require(_0x60cf('0x11'));var Redis=require(_0x60cf('0x12'));var authService=require(_0x60cf('0x13'));var qs=require(_0x60cf('0x14'));var as=require(_0x60cf('0x15'));var hardwareService=require(_0x60cf('0x16'));var logger=require(_0x60cf('0x17'))(_0x60cf('0x18'));var utils=require(_0x60cf('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x60cf('0x1a'))['db'];function respondWithStatusCode(_0x30bc67,_0x59bd2e){_0x59bd2e=_0x59bd2e||0xcc;return function(_0x4a9bfb){if(_0x4a9bfb){return _0x30bc67[_0x60cf('0x1b')](_0x59bd2e);}return _0x30bc67[_0x60cf('0x1c')](_0x59bd2e)[_0x60cf('0x1d')]();};}function respondWithResult(_0x42dd0e,_0x2b21fa){_0x2b21fa=_0x2b21fa||0xc8;return function(_0x3238de){if(_0x3238de){return _0x42dd0e[_0x60cf('0x1c')](_0x2b21fa)['json'](_0x3238de);}};}function respondWithFilteredResult(_0x137a07,_0x21b269){return function(_0x2ed0d7){if(_0x2ed0d7){var _0x133e50=_0x2ed0d7[_0x60cf('0x1e')],_0x471d81=_0x21b269[_0x60cf('0x1f')],_0x3dc566=_0x21b269[_0x60cf('0x1f')]+_0x21b269[_0x60cf('0x20')],_0xdc6bfa;if(_0x3dc566>=_0x133e50){_0x3dc566=_0x133e50;_0xdc6bfa=0xc8;}else{_0xdc6bfa=0xce;}_0x137a07[_0x60cf('0x1c')](_0xdc6bfa);return _0x137a07[_0x60cf('0x21')](_0x60cf('0x22'),_0x471d81+'-'+_0x3dc566+'/'+_0x133e50)['json'](_0x2ed0d7);}return null;};}function patchUpdates(_0x2e68ba){return function(_0x44f31f){try{jsonpatch[_0x60cf('0x23')](_0x44f31f,_0x2e68ba,!![]);}catch(_0x156bf9){return BPromise[_0x60cf('0x24')](_0x156bf9);}return _0x44f31f[_0x60cf('0x25')]();};}function saveUpdates(_0x1e2026,_0x35138b){return function(_0x60d5c4){if(_0x60d5c4){return _0x60d5c4[_0x60cf('0x26')](_0x1e2026)[_0x60cf('0x27')](function(_0x3f5aa0){return _0x3f5aa0;});}return null;};}function removeEntity(_0x3324a4,_0x5397ba){return function(_0x46ed55){if(_0x46ed55){return _0x46ed55['destroy']()['then'](function(){_0x3324a4[_0x60cf('0x1c')](0xcc)[_0x60cf('0x1d')]();});}};}function handleEntityNotFound(_0x180068,_0x303114){return function(_0x697da5){if(!_0x697da5){_0x180068['sendStatus'](0x194);}return _0x697da5;};}function handleError(_0x3d03f3,_0x4f819e){_0x4f819e=_0x4f819e||0x1f4;return function(_0x48b70d){logger[_0x60cf('0x28')](_0x48b70d[_0x60cf('0x29')]);if(_0x48b70d[_0x60cf('0x2a')]){delete _0x48b70d[_0x60cf('0x2a')];}_0x3d03f3[_0x60cf('0x1c')](_0x4f819e)['send'](_0x48b70d);};}exports[_0x60cf('0x2b')]=function(_0x5d6581,_0x5374f6){var _0x11d432={},_0x3e6cfc={},_0x273c03={'count':0x0,'rows':[]};var _0x3d05c5=_[_0x60cf('0x2c')](db[_0x60cf('0x2d')][_0x60cf('0x2e')],function(_0x4e3080){return{'name':_0x4e3080[_0x60cf('0x2f')],'type':_0x4e3080[_0x60cf('0x30')][_0x60cf('0x31')]};});_0x3e6cfc['model']=_[_0x60cf('0x2c')](_0x3d05c5,'name');_0x3e6cfc[_0x60cf('0x32')]=_[_0x60cf('0x33')](_0x5d6581[_0x60cf('0x32')]);_0x3e6cfc[_0x60cf('0x34')]=_[_0x60cf('0x35')](_0x3e6cfc[_0x60cf('0x36')],_0x3e6cfc[_0x60cf('0x32')]);_0x11d432[_0x60cf('0x37')]=_['intersection'](_0x3e6cfc[_0x60cf('0x36')],qs['fields'](_0x5d6581[_0x60cf('0x32')]['fields']));_0x11d432[_0x60cf('0x37')]=_0x11d432[_0x60cf('0x37')][_0x60cf('0x38')]?_0x11d432[_0x60cf('0x37')]:_0x3e6cfc[_0x60cf('0x36')];if(!_0x5d6581[_0x60cf('0x32')][_0x60cf('0x39')]('nolimit')){_0x11d432['limit']=qs[_0x60cf('0x20')](_0x5d6581[_0x60cf('0x32')][_0x60cf('0x20')]);_0x11d432[_0x60cf('0x1f')]=qs[_0x60cf('0x1f')](_0x5d6581['query'][_0x60cf('0x1f')]);}_0x11d432[_0x60cf('0x3a')]=qs[_0x60cf('0x3b')](_0x5d6581['query'][_0x60cf('0x3b')]);_0x11d432['where']=qs[_0x60cf('0x34')](_['pick'](_0x5d6581['query'],_0x3e6cfc[_0x60cf('0x34')]),_0x3d05c5);if(_0x5d6581[_0x60cf('0x32')][_0x60cf('0x3c')]){_0x11d432[_0x60cf('0x3d')]=_[_0x60cf('0x3e')](_0x11d432['where'],{'$or':_['map'](_0x3d05c5,function(_0x41dc22){if(_0x41dc22[_0x60cf('0x30')]!=='VIRTUAL'){var _0x2a8b5d={};_0x2a8b5d[_0x41dc22[_0x60cf('0x2a')]]={'$like':'%'+_0x5d6581[_0x60cf('0x32')][_0x60cf('0x3c')]+'%'};return _0x2a8b5d;}})});}_0x11d432=_[_0x60cf('0x3e')]({},_0x11d432,_0x5d6581[_0x60cf('0x3f')]);var _0xfef15b={'where':_0x11d432['where']};return db[_0x60cf('0x2d')][_0x60cf('0x1e')](_0xfef15b)[_0x60cf('0x27')](function(_0x164990){_0x273c03[_0x60cf('0x1e')]=_0x164990;if(_0x5d6581[_0x60cf('0x32')][_0x60cf('0x40')]){_0x11d432[_0x60cf('0x41')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x11d432);})['then'](function(_0x1a14ae){_0x273c03[_0x60cf('0x42')]=_0x1a14ae;return _0x273c03;})['then'](respondWithFilteredResult(_0x5374f6,_0x11d432))['catch'](handleError(_0x5374f6,null));};exports['show']=function(_0x5d834a,_0x20fe9e){var _0x1cbdb6={'raw':!![],'where':{'id':_0x5d834a[_0x60cf('0x43')]['id']}},_0x3822b7={};_0x3822b7[_0x60cf('0x36')]=_[_0x60cf('0x33')](db[_0x60cf('0x2d')][_0x60cf('0x2e')]);_0x3822b7[_0x60cf('0x32')]=_[_0x60cf('0x33')](_0x5d834a['query']);_0x3822b7[_0x60cf('0x34')]=_[_0x60cf('0x35')](_0x3822b7[_0x60cf('0x36')],_0x3822b7[_0x60cf('0x32')]);_0x1cbdb6['attributes']=_['intersection'](_0x3822b7[_0x60cf('0x36')],qs['fields'](_0x5d834a[_0x60cf('0x32')][_0x60cf('0x44')]));_0x1cbdb6[_0x60cf('0x37')]=_0x1cbdb6['attributes'][_0x60cf('0x38')]?_0x1cbdb6[_0x60cf('0x37')]:_0x3822b7[_0x60cf('0x36')];if(_0x5d834a[_0x60cf('0x32')][_0x60cf('0x40')]){_0x1cbdb6['include']=[{'all':!![]}];}_0x1cbdb6=_['merge']({},_0x1cbdb6,_0x5d834a[_0x60cf('0x3f')]);return db[_0x60cf('0x2d')][_0x60cf('0x45')](_0x1cbdb6)[_0x60cf('0x27')](handleEntityNotFound(_0x20fe9e,null))[_0x60cf('0x27')](respondWithResult(_0x20fe9e,null))[_0x60cf('0x46')](handleError(_0x20fe9e,null));};exports[_0x60cf('0x47')]=function(_0x2d6712,_0x18d8a0){var _0x52c4f8={'where':{'id':_0x2d6712['params']['id']}},_0x718a68={};_0x718a68[_0x60cf('0x36')]=_[_0x60cf('0x33')](db['Attachment'][_0x60cf('0x2e')]);_0x52c4f8[_0x60cf('0x37')]=_['intersection'](_0x718a68[_0x60cf('0x36')],qs[_0x60cf('0x44')](_0x2d6712[_0x60cf('0x32')][_0x60cf('0x44')]));_0x52c4f8[_0x60cf('0x37')]=_0x52c4f8['attributes'][_0x60cf('0x38')]?_0x52c4f8['attributes']:_0x718a68[_0x60cf('0x36')];if(_0x2d6712[_0x60cf('0x32')][_0x60cf('0x40')]){_0x52c4f8[_0x60cf('0x41')]=[{'all':!![]}];}_0x52c4f8=_[_0x60cf('0x3e')]({},_0x52c4f8,_0x2d6712[_0x60cf('0x3f')]);return db[_0x60cf('0x2d')]['find'](_0x52c4f8)[_0x60cf('0x27')](handleEntityNotFound(_0x18d8a0,null))['then'](function(_0x404db5){if(_0x404db5){var _0x1de378=_0x404db5['get']({'plain':!![]});_0x1de378=qs[_0x60cf('0x48')](_0x1de378,['id',_0x60cf('0x49'),_0x60cf('0x4a')]);_0x2d6712['body']=_[_0x60cf('0x48')](_0x2d6712[_0x60cf('0x4b')],['id',_0x60cf('0x49'),_0x60cf('0x4a')]);return db[_0x60cf('0x2d')]['create'](_[_0x60cf('0x3e')](_0x1de378,_0x2d6712['body']),{'include':_0x2d6712['query'][_0x60cf('0x40')]?[{'all':!![]}]:undefined});}})[_0x60cf('0x27')](respondWithResult(_0x18d8a0,0xc9))[_0x60cf('0x46')](handleError(_0x18d8a0,null));};exports['update']=function(_0x17c407,_0x570d00){if(_0x17c407[_0x60cf('0x4b')]['id']){delete _0x17c407['body']['id'];}return db[_0x60cf('0x2d')][_0x60cf('0x45')]({'where':{'id':_0x17c407[_0x60cf('0x43')]['id']}})['then'](handleEntityNotFound(_0x570d00,null))[_0x60cf('0x27')](saveUpdates(_0x17c407[_0x60cf('0x4b')],null))[_0x60cf('0x27')](respondWithResult(_0x570d00,null))[_0x60cf('0x46')](handleError(_0x570d00,null));};exports['destroy']=function(_0x5f50df,_0x1efdb2){return db[_0x60cf('0x2d')]['find']({'where':{'id':_0x5f50df[_0x60cf('0x43')]['id']}})['then'](handleEntityNotFound(_0x1efdb2,null))[_0x60cf('0x27')](removeEntity(_0x1efdb2,null))[_0x60cf('0x46')](handleError(_0x1efdb2,null));};exports[_0x60cf('0x4c')]=function(_0x21e9b5,_0xd3f59,_0x20d953){_0x21e9b5[_0x60cf('0x4b')][_0x60cf('0x2a')]=_0x21e9b5[_0x60cf('0x4d')][_0x60cf('0x4e')];_0x21e9b5[_0x60cf('0x4b')][_0x60cf('0x4f')]=_0x21e9b5['file']['filename'];_0x21e9b5[_0x60cf('0x4b')][_0x60cf('0x30')]=_0x21e9b5['file'][_0x60cf('0x50')];return db[_0x60cf('0x2d')][_0x60cf('0x4c')](_0x21e9b5[_0x60cf('0x4b')])[_0x60cf('0x27')](respondWithResult(_0xd3f59,0xc9))[_0x60cf('0x46')](handleError(_0xd3f59,null));};exports['download']=function(_0x3f2986,_0x1dd745,_0xa86a81){return db[_0x60cf('0x2d')][_0x60cf('0x51')]({'where':{'id':_0x3f2986[_0x60cf('0x43')]['id']},'raw':!![]})[_0x60cf('0x27')](handleEntityNotFound(_0x1dd745,null))[_0x60cf('0x27')](function(_0x4ca999){if(_0x4ca999){return _0x1dd745[_0x60cf('0x52')](path[_0x60cf('0x53')](config[_0x60cf('0x54')],_0x60cf('0x55'),_0x4ca999['basename']));}})[_0x60cf('0x46')](handleError(_0x1dd745,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 69d0600..910b762 100644 --- a/server/api/attachment/attachment.model.js +++ b/server/api/attachment/attachment.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ffa=['rimraf','../../config/environment','exports','Attachment','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5a1070,_0x29af36){var _0x38b69b=function(_0x2905a0){while(--_0x2905a0){_0x5a1070['push'](_0x5a1070['shift']());}};_0x38b69b(++_0x29af36);}(_0x4ffa,0x124));var _0xa4ff=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4ffa[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4ff('0x0'))('api');var moment=require(_0xa4ff('0x1'));var BPromise=require(_0xa4ff('0x2'));var rp=require(_0xa4ff('0x3'));var fs=require('fs');var path=require(_0xa4ff('0x4'));var rimraf=require(_0xa4ff('0x5'));var config=require(_0xa4ff('0x6'));var attributes=require('./attachment.attributes');module[_0xa4ff('0x7')]=function(_0x1d6a4c,_0x2bf21d){return _0x1d6a4c['define'](_0xa4ff('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f1a=['moment','bluebird','request-promise','path','./attachment.attributes','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0x31a3b8,_0x5a0fe9){var _0x17fbd8=function(_0x128ccc){while(--_0x128ccc){_0x31a3b8['push'](_0x31a3b8['shift']());}};_0x17fbd8(++_0x5a0fe9);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x14e4e0,_0x1fd9b4){_0x14e4e0=_0x14e4e0-0x0;var _0x4a8c67=_0x8f1a[_0x14e4e0];return _0x4a8c67;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var logger=require(_0xa8f1('0x2'))(_0xa8f1('0x3'));var moment=require(_0xa8f1('0x4'));var BPromise=require(_0xa8f1('0x5'));var rp=require(_0xa8f1('0x6'));var fs=require('fs');var path=require(_0xa8f1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8f1('0x8'));module['exports']=function(_0x1b067d,_0x3d62e4){return _0x1b067d['define'](_0xa8f1('0x9'),attributes,{'tableName':_0xa8f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 7332e91..d0b4e86 100644 --- a/server/api/attachment/attachment.rpc.js +++ b/server/api/attachment/attachment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a20=['client','http','request','then','info','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','create','body','options','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x520b04,_0x157710){var _0x2732a0=function(_0x3b68e6){while(--_0x3b68e6){_0x520b04['push'](_0x520b04['shift']());}};_0x2732a0(++_0x157710);}(_0x3a20,0x124));var _0x03a2=function(_0x20d6e9,_0x182436){_0x20d6e9=_0x20d6e9-0x0;var _0x4b5f9d=_0x3a20[_0x20d6e9];return _0x4b5f9d;};'use strict';var _=require('lodash');var util=require(_0x03a2('0x0'));var moment=require(_0x03a2('0x1'));var BPromise=require(_0x03a2('0x2'));var rs=require(_0x03a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x03a2('0x4'));var logger=require('../../config/logger')(_0x03a2('0x5'));var config=require(_0x03a2('0x6'));var jayson=require(_0x03a2('0x7'));var client=jayson[_0x03a2('0x8')][_0x03a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b7546,_0xe70511,_0x4a8e14){return new BPromise(function(_0x400f20,_0x45e2b8){return client[_0x03a2('0xa')](_0x4b7546,_0x4a8e14)[_0x03a2('0xb')](function(_0x4a358c){logger[_0x03a2('0xc')]('Attachment,\x20%s,\x20%s',_0xe70511,_0x03a2('0xd'));logger['debug'](_0x03a2('0xe'),_0xe70511,_0x03a2('0xd'),JSON[_0x03a2('0xf')](_0x4a358c));if(_0x4a358c[_0x03a2('0x10')]){if(_0x4a358c['error'][_0x03a2('0x11')]===0x1f4){logger[_0x03a2('0x10')](_0x03a2('0x12'),_0xe70511,_0x4a358c['error'][_0x03a2('0x13')]);return _0x45e2b8(_0x4a358c['error']['message']);}logger['error'](_0x03a2('0x12'),_0xe70511,_0x4a358c['error'][_0x03a2('0x13')]);return _0x400f20(_0x4a358c['error'][_0x03a2('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0xe70511,_0x03a2('0xd'));_0x400f20(_0x4a358c['result'][_0x03a2('0x13')]);}})[_0x03a2('0x14')](function(_0x4336d2){logger['error'](_0x03a2('0x12'),_0xe70511,_0x4336d2);_0x45e2b8(_0x4336d2);});});}exports[_0x03a2('0x15')]=function(_0x1f24fb){var _0x58771e=this;return new Promise(function(_0x6106f0,_0x3cf1d3){return db['Attachment'][_0x03a2('0x16')](_0x1f24fb[_0x03a2('0x17')],{'raw':_0x1f24fb[_0x03a2('0x18')]?_0x1f24fb[_0x03a2('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x03a2('0xb')](function(_0x261028){logger[_0x03a2('0xc')]('CreateAttachment',_0x1f24fb);logger['debug'](_0x03a2('0x15'),_0x1f24fb,JSON[_0x03a2('0xf')](_0x261028));_0x6106f0(_0x261028);})['catch'](function(_0x1cabe8){logger[_0x03a2('0x10')](_0x03a2('0x15'),_0x1cabe8[_0x03a2('0x13')],_0x1f24fb);_0x3cf1d3(_0x58771e[_0x03a2('0x10')](0x1f4,_0x1cabe8['message']));});});}; \ No newline at end of file +var _0x9d6e=['CreateAttachment','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw'];(function(_0x65a0db,_0x55c5a0){var _0x987620=function(_0x23d53f){while(--_0x23d53f){_0x65a0db['push'](_0x65a0db['shift']());}};_0x987620(++_0x55c5a0);}(_0x9d6e,0x1a1));var _0xe9d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d6e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe9d6('0x0'));var moment=require(_0xe9d6('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9d6('0x2'));var fs=require('fs');var Redis=require(_0xe9d6('0x3'));var db=require(_0xe9d6('0x4'))['db'];var utils=require(_0xe9d6('0x5'));var logger=require(_0xe9d6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe9d6('0x7'));var client=jayson[_0xe9d6('0x8')][_0xe9d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19b62b,_0x3b1fd0,_0x40ee39){return new BPromise(function(_0x53162d,_0x55b32f){return client[_0xe9d6('0xa')](_0x19b62b,_0x40ee39)[_0xe9d6('0xb')](function(_0x52be38){logger[_0xe9d6('0xc')](_0xe9d6('0xd'),_0x3b1fd0,_0xe9d6('0xe'));logger['debug'](_0xe9d6('0xf'),_0x3b1fd0,_0xe9d6('0xe'),JSON[_0xe9d6('0x10')](_0x52be38));if(_0x52be38[_0xe9d6('0x11')]){if(_0x52be38[_0xe9d6('0x11')][_0xe9d6('0x12')]===0x1f4){logger[_0xe9d6('0x11')](_0xe9d6('0xd'),_0x3b1fd0,_0x52be38[_0xe9d6('0x11')][_0xe9d6('0x13')]);return _0x55b32f(_0x52be38[_0xe9d6('0x11')][_0xe9d6('0x13')]);}logger[_0xe9d6('0x11')](_0xe9d6('0xd'),_0x3b1fd0,_0x52be38['error']['message']);return _0x53162d(_0x52be38['error'][_0xe9d6('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x3b1fd0,'request\x20sent');_0x53162d(_0x52be38['result']['message']);}})[_0xe9d6('0x14')](function(_0x22380d){logger[_0xe9d6('0x11')](_0xe9d6('0xd'),_0x3b1fd0,_0x22380d);_0x55b32f(_0x22380d);});});}exports['CreateAttachment']=function(_0x51f98f){var _0x45390f=this;return new Promise(function(_0x3aee8c,_0x4d3405){return db['Attachment'][_0xe9d6('0x15')](_0x51f98f[_0xe9d6('0x16')],{'raw':_0x51f98f[_0xe9d6('0x17')]?_0x51f98f[_0xe9d6('0x17')][_0xe9d6('0x18')]===undefined?!![]:![]:!![]})[_0xe9d6('0xb')](function(_0x293402){logger[_0xe9d6('0xc')](_0xe9d6('0x19'),_0x51f98f);logger['debug'](_0xe9d6('0x19'),_0x51f98f,JSON[_0xe9d6('0x10')](_0x293402));_0x3aee8c(_0x293402);})[_0xe9d6('0x14')](function(_0x2fe1f4){logger['error']('CreateAttachment',_0x2fe1f4['message'],_0x51f98f);_0x4d3405(_0x45390f['error'](0x1f4,_0x2fe1f4[_0xe9d6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 14d6910..ffddcfc 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71a1=['format','originalname','replace','single','file','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/download','download','post','clone','diskStorage','join','root'];(function(_0x2ce317,_0x9f50ba){var _0x4fd0fe=function(_0xaa3dd9){while(--_0xaa3dd9){_0x2ce317['push'](_0x2ce317['shift']());}};_0x4fd0fe(++_0x9f50ba);}(_0x71a1,0x1eb));var _0x171a=function(_0x4479b6,_0x2d77eb){_0x4479b6=_0x4479b6-0x0;var _0x173ff9=_0x71a1[_0x4479b6];return _0x173ff9;};'use strict';var multer=require(_0x171a('0x0'));var util=require(_0x171a('0x1'));var path=require(_0x171a('0x2'));var timeout=require(_0x171a('0x3'));var express=require(_0x171a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x171a('0x5'));var config=require(_0x171a('0x6'));var controller=require('./attachment.controller');router['get']('/',auth[_0x171a('0x7')](),controller[_0x171a('0x8')]);router['get'](_0x171a('0x9'),auth[_0x171a('0x7')](),controller[_0x171a('0xa')]);router[_0x171a('0xb')](_0x171a('0xc'),auth[_0x171a('0x7')](),controller[_0x171a('0xd')]);router[_0x171a('0xe')]('/:id/clone',auth['isAuthenticated'](),controller[_0x171a('0xf')]);var upload=multer({'storage':multer[_0x171a('0x10')]({'destination':function(_0x23c2df,_0x678957,_0x390973){_0x390973(null,path[_0x171a('0x11')](config[_0x171a('0x12')],'server/files/attachments/'));},'filename':function(_0x2775e3,_0x5b0154,_0x26f64b){_0x26f64b(null,util[_0x171a('0x13')]('%s-%s',Date['now'](),_0x5b0154[_0x171a('0x14')][_0x171a('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x171a('0xe')]('/',upload[_0x171a('0x16')](_0x171a('0x17')),controller[_0x171a('0x18')]);router[_0x171a('0x19')](_0x171a('0x9'),auth[_0x171a('0x7')](),controller[_0x171a('0x1a')]);router[_0x171a('0x1b')](_0x171a('0x9'),auth[_0x171a('0x7')](),controller[_0x171a('0x1c')]);module[_0x171a('0x1d')]=router; \ No newline at end of file +var _0xa19c=['single','file','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','/:id','show','/:id/download','isAuthenticated','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa19c,0xce));var _0xca19=function(_0xe3ca1f,_0x1e954e){_0xe3ca1f=_0xe3ca1f-0x0;var _0x3f1f9a=_0xa19c[_0xe3ca1f];return _0x3f1f9a;};'use strict';var multer=require(_0xca19('0x0'));var util=require(_0xca19('0x1'));var path=require(_0xca19('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xca19('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xca19('0x4'));var config=require(_0xca19('0x5'));var controller=require(_0xca19('0x6'));router[_0xca19('0x7')]('/',auth['isAuthenticated'](),controller[_0xca19('0x8')]);router['get'](_0xca19('0x9'),auth['isAuthenticated'](),controller[_0xca19('0xa')]);router['get'](_0xca19('0xb'),auth[_0xca19('0xc')](),controller[_0xca19('0xd')]);router[_0xca19('0xe')](_0xca19('0xf'),auth['isAuthenticated'](),controller[_0xca19('0x10')]);var upload=multer({'storage':multer[_0xca19('0x11')]({'destination':function(_0x3ff87d,_0x32434a,_0x3c6e10){_0x3c6e10(null,path[_0xca19('0x12')](config[_0xca19('0x13')],_0xca19('0x14')));},'filename':function(_0x127e02,_0x1389ce,_0x274a91){_0x274a91(null,util['format'](_0xca19('0x15'),Date[_0xca19('0x16')](),_0x1389ce[_0xca19('0x17')][_0xca19('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xca19('0xe')]('/',upload[_0xca19('0x19')](_0xca19('0x1a')),controller[_0xca19('0x1b')]);router[_0xca19('0x1c')](_0xca19('0x9'),auth[_0xca19('0xc')](),controller[_0xca19('0x1d')]);router[_0xca19('0x1e')]('/:id',auth[_0xca19('0xc')](),controller[_0xca19('0x1f')]);module[_0xca19('0x20')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a6866d9..cbb9a77 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8ca=['catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','login','authenticate','google','/login','email','callback','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','blockDuration','then','User','find','map','emails','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe8ca,0x1c9));var _0xae8c=function(_0x405069,_0x14db45){_0x405069=_0x405069-0x0;var _0xd7c425=_0xe8ca[_0x405069];return _0xd7c425;};'use strict';var _=require(_0xae8c('0x0'));var passport=require(_0xae8c('0x1'));var GoogleStrategy=require(_0xae8c('0x2'))['Strategy'];var moment=require(_0xae8c('0x3'));var db=require(_0xae8c('0x4'))['db'];var config=require(_0xae8c('0x5'));var signToken=require(_0xae8c('0x6'))['signToken'];var utils=require('../../config/utils');exports[_0xae8c('0x7')]=passport[_0xae8c('0x8')](_0xae8c('0x9'),{'failureRedirect':_0xae8c('0xa'),'scope':['profile',_0xae8c('0xb')],'session':![]});exports[_0xae8c('0xc')]=passport['authenticate'](_0xae8c('0x9'),{'failureRedirect':_0xae8c('0xa'),'session':![]});passport[_0xae8c('0xd')](new GoogleStrategy({'clientID':config[_0xae8c('0x9')]?config[_0xae8c('0x9')][_0xae8c('0xe')]:'id','clientSecret':config[_0xae8c('0x9')]?config['google'][_0xae8c('0xf')]:_0xae8c('0x10'),'callbackURL':config[_0xae8c('0x9')]?config[_0xae8c('0x9')][_0xae8c('0x11')]:''},function(_0x5ce7de,_0x33e2af,_0x3bc456,_0x112887){var _0x345129,_0x13c6e4;return db[_0xae8c('0x12')][_0xae8c('0x13')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xae8c('0x14')],'raw':!![]})[_0xae8c('0x15')](function(_0x2c2b3d){_0x345129=_0x2c2b3d;return db[_0xae8c('0x16')][_0xae8c('0x17')]({'where':{'email':_[_0xae8c('0x18')](_0x3bc456[_0xae8c('0x19')],_0xae8c('0x1a')),'role':{'$or':[_0xae8c('0x1b'),_0xae8c('0x1c'),_0xae8c('0x1d')]}}});})[_0xae8c('0x15')](function(_0x4cf89a){_0x13c6e4=_0x4cf89a;if(_0x13c6e4){if(_0x13c6e4['disabled']){return _0x112887(_0xae8c('0x1e'));}else if(_0x345129[_0xae8c('0x14')]>0x0){if(_0x13c6e4[_0xae8c('0x1f')]){if(moment(_0x13c6e4[_0xae8c('0x20')])[_0xae8c('0x21')](_0x345129[_0xae8c('0x14')],_0xae8c('0x22'))>moment()){return _0x112887('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xae8c('0x23')](_0x13c6e4,0x0,![],null)[_0xae8c('0x15')](function(){return utils[_0xae8c('0x24')](_0x13c6e4);})['then'](function(){return _0x112887(null,_0x13c6e4);});}}else{return utils[_0xae8c('0x24')](_0x13c6e4)[_0xae8c('0x15')](function(){return _0x112887(null,_0x13c6e4);});}}else{return utils[_0xae8c('0x24')](_0x13c6e4)[_0xae8c('0x15')](function(){return _0x112887(null,_0x13c6e4);});}}return _0x112887(_0xae8c('0x1e'));})[_0xae8c('0x25')](function(_0x2bbb79){_0x112887(_0x2bbb79);});})); \ No newline at end of file +var _0x490b=['User','find','map','value','user','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','add','getLicense','catch','lodash','passport','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','authenticate','/login','profile','email','callback','google','clientID','clientSecret','callbackURL','allowedLoginAttempts'];(function(_0x53450e,_0x3417d4){var _0x4d6c5a=function(_0x2961a1){while(--_0x2961a1){_0x53450e['push'](_0x53450e['shift']());}};_0x4d6c5a(++_0x3417d4);}(_0x490b,0xde));var _0xb490=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0x490b[_0x3c7d53];return _0x2c8387;};'use strict';var _=require(_0xb490('0x0'));var passport=require(_0xb490('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xb490('0x2')];var moment=require(_0xb490('0x3'));var db=require(_0xb490('0x4'))['db'];var config=require(_0xb490('0x5'));var signToken=require(_0xb490('0x6'))[_0xb490('0x7')];var utils=require('../../config/utils');exports['login']=passport[_0xb490('0x8')]('google',{'failureRedirect':_0xb490('0x9'),'scope':[_0xb490('0xa'),_0xb490('0xb')],'session':![]});exports[_0xb490('0xc')]=passport[_0xb490('0x8')](_0xb490('0xd'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0xb490('0xd')][_0xb490('0xe')]:'id','clientSecret':config[_0xb490('0xd')]?config[_0xb490('0xd')][_0xb490('0xf')]:'secret','callbackURL':config[_0xb490('0xd')]?config['google'][_0xb490('0x10')]:''},function(_0x6a288a,_0x54c63b,_0x339711,_0x50224a){var _0x4f40e2,_0x5521b2;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xb490('0x11'),'blockDuration'],'raw':!![]})['then'](function(_0x31b114){_0x4f40e2=_0x31b114;return db[_0xb490('0x12')][_0xb490('0x13')]({'where':{'email':_[_0xb490('0x14')](_0x339711['emails'],_0xb490('0x15')),'role':{'$or':['admin',_0xb490('0x16'),'agent']}}});})[_0xb490('0x17')](function(_0x514875){_0x5521b2=_0x514875;if(_0x5521b2){if(_0x5521b2['disabled']){return _0x50224a(_0xb490('0x18'));}else if(_0x4f40e2[_0xb490('0x19')]>0x0){if(_0x5521b2['blocked']){if(moment(_0x5521b2[_0xb490('0x1a')])[_0xb490('0x1b')](_0x4f40e2[_0xb490('0x19')],'minutes')>moment()){return _0x50224a(_0xb490('0x18'));}else{return utils['clearBlockUser'](_0x5521b2,0x0,![],null)[_0xb490('0x17')](function(){return utils[_0xb490('0x1c')](_0x5521b2);})[_0xb490('0x17')](function(){return _0x50224a(null,_0x5521b2);});}}else{return utils[_0xb490('0x1c')](_0x5521b2)['then'](function(){return _0x50224a(null,_0x5521b2);});}}else{return utils[_0xb490('0x1c')](_0x5521b2)[_0xb490('0x17')](function(){return _0x50224a(null,_0x5521b2);});}}return _0x50224a(_0xb490('0x18'));})[_0xb490('0x1d')](function(_0x573891){_0x50224a(_0x573891);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 3ae2c06..437b816 100644 --- a/server/api/authGoogle/index.js +++ b/server/api/authGoogle/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf1d=['/callback','callback','isMiddleware','login','setTokenCookie','express','passport','Router','./authGoogle.controller','../../components/auth/service','get'];(function(_0x51d3ca,_0xac81b){var _0x4e5794=function(_0x2b2948){while(--_0x2b2948){_0x51d3ca['push'](_0x51d3ca['shift']());}};_0x4e5794(++_0xac81b);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x4ee036,_0x4619dd){_0x4ee036=_0x4ee036-0x0;var _0x5789f1=_0xaf1d[_0x4ee036];return _0x5789f1;};'use strict';var express=require(_0xdaf1('0x0'));var passport=require(_0xdaf1('0x1'));var router=express[_0xdaf1('0x2')]();var controller=require(_0xdaf1('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xdaf1('0x4'));router[_0xdaf1('0x5')]('/',controller['login']);router[_0xdaf1('0x5')](_0xdaf1('0x6'),controller[_0xdaf1('0x7')],authService[_0xdaf1('0x8')],userController[_0xdaf1('0x9')],authService[_0xdaf1('0xa')]);module['exports']=router; \ No newline at end of file +var _0x593e=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x82c14e,_0x333edc){var _0x201931=function(_0x255615){while(--_0x255615){_0x82c14e['push'](_0x82c14e['shift']());}};_0x201931(++_0x333edc);}(_0x593e,0xcb));var _0xe593=function(_0x4ea1da,_0x4afdd7){_0x4ea1da=_0x4ea1da-0x0;var _0x201ce4=_0x593e[_0x4ea1da];return _0x201ce4;};'use strict';var express=require(_0xe593('0x0'));var passport=require(_0xe593('0x1'));var router=express[_0xe593('0x2')]();var controller=require(_0xe593('0x3'));var userController=require(_0xe593('0x4'));var authService=require(_0xe593('0x5'));router[_0xe593('0x6')]('/',controller[_0xe593('0x7')]);router['get'](_0xe593('0x8'),controller[_0xe593('0x9')],authService[_0xe593('0xa')],userController[_0xe593('0x7')],authService[_0xe593('0xb')]);module[_0xe593('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index f7c9497..f5b5dac 100644 --- a/server/api/authLocal/authLocal.controller.js +++ b/server/api/authLocal/authLocal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d17=['This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','validatePasswordHistory','previousPasswords','send','Password\x20reset!','use','util','passport','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','blockDuration','findOne','name','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','then','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','catch','MailAccount','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','secure','authentication','auth','pass','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find'];(function(_0x6ffe0a,_0x196d01){var _0x183bd1=function(_0x10beea){while(--_0x10beea){_0x6ffe0a['push'](_0x6ffe0a['shift']());}};_0x183bd1(++_0x196d01);}(_0x5d17,0x114));var _0x75d1=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x5d17[_0x446208];return _0xe49563;};'use strict';var util=require(_0x75d1('0x0'));var passport=require(_0x75d1('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x75d1('0x2'));var _=require(_0x75d1('0x3'));var rs=require(_0x75d1('0x4'));var moment=require('moment');var db=require(_0x75d1('0x5'))['db'];var authService=require(_0x75d1('0x6'));var utils=require(_0x75d1('0x7'));var client=jayson[_0x75d1('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x458681,_0x116a51,_0x5c957a,_0x1ee61b){var _0x3a9d5e,_0x105607;return db[_0x75d1('0x9')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x75d1('0xa')],'raw':!![]})['then'](function(_0x57be31){_0x3a9d5e=_0x57be31;return _0x458681[_0x75d1('0xb')]({'attributes':['id',_0x75d1('0xc'),'password',_0x75d1('0xd'),_0x75d1('0xe'),_0x75d1('0xf'),_0x75d1('0x10'),_0x75d1('0x11'),_0x75d1('0x12')],'where':{'name':_0x116a51,'role':{'$or':['admin',_0x75d1('0x13'),_0x75d1('0x14')]}}});})[_0x75d1('0x15')](function(_0x314a71){if(!_0x314a71||_0x314a71&&_0x314a71['name']!==_0x116a51){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x105607=_0x314a71;return _0x105607;}})['then'](function(){_0x105607[_0x75d1('0x16')](_0x5c957a,function(_0x12fa32,_0x2fd022){var _0x52e649=_0x105607[_0x75d1('0x12')]+0x1;if(_0x12fa32){return _0x1ee61b(_0x12fa32);}else if(!_0x2fd022){if(_0x105607[_0x75d1('0xf')]){return _0x1ee61b(null,![],{'message':_0x75d1('0x17')});}else if(_0x3a9d5e[_0x75d1('0x18')]>0x0){if(_0x105607[_0x75d1('0x10')]){if(_0x3a9d5e[_0x75d1('0xa')]>0x0){if(moment(_0x105607[_0x75d1('0x11')])[_0x75d1('0x19')](_0x3a9d5e[_0x75d1('0xa')],_0x75d1('0x1a'))>moment()){return _0x1ee61b(null,![],{'message':_0x75d1('0x17')});}else{return utils['clearBlockUser'](_0x105607,_0x52e649,![],null)['then'](function(){return _0x1ee61b(null,![],{'message':_0x75d1('0x17')});});}}else{return _0x1ee61b(null,![],{'message':_0x75d1('0x17')});}}else{if(_0x52e649>=_0x3a9d5e['allowedLoginAttempts']){return utils[_0x75d1('0x1b')](_0x105607,0x0,!![],moment())[_0x75d1('0x15')](function(){return _0x1ee61b(null,![],{'message':_0x75d1('0x17')});});}else{return utils[_0x75d1('0x1b')](_0x105607,_0x52e649,![],null)[_0x75d1('0x15')](function(){return _0x1ee61b(null,![],{'message':_0x75d1('0x17')});});}}}else{return _0x1ee61b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x105607[_0x75d1('0xf')]){return _0x1ee61b(null,![],{'message':_0x75d1('0x17')});}else if(_0x3a9d5e['allowedLoginAttempts']>0x0){if(_0x105607[_0x75d1('0x10')]){if(_0x3a9d5e[_0x75d1('0xa')]>0x0){if(moment(_0x105607['blockedAt'])[_0x75d1('0x19')](_0x3a9d5e['blockDuration'],_0x75d1('0x1a'))>moment()){return _0x1ee61b(null,![],{'message':_0x75d1('0x17')});}else{return utils[_0x75d1('0x1b')](_0x105607,0x0,![],null)['then'](function(){return utils['getLicense'](_0x105607);})[_0x75d1('0x15')](function(){return _0x1ee61b(null,_0x105607);});}}else{return _0x1ee61b(null,![],{'message':_0x75d1('0x17')});}}else{return utils[_0x75d1('0x1b')](_0x105607,0x0,![],null)[_0x75d1('0x15')](function(){return utils['getLicense'](_0x105607);})[_0x75d1('0x15')](function(){return _0x1ee61b(null,_0x105607);})[_0x75d1('0x1c')](function(_0x367238){return _0x1ee61b(null,![],_0x367238);});}}else{if(_0x105607['blocked']){return _0x1ee61b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x105607)[_0x75d1('0x15')](function(){return _0x1ee61b(null,_0x105607);});}}}});})[_0x75d1('0x1c')](function(_0x45c182){return _0x1ee61b(null,![],_0x45c182);});}function sendServiceMail(_0x468bf0){return db[_0x75d1('0x1d')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x75d1('0x1e')],'include':[{'model':db[_0x75d1('0x1f')],'as':'Smtp'}]})[_0x75d1('0x15')](function(_0x5aa4fa){if(!_0x5aa4fa){throw new Error(_0x75d1('0x20'));}var _0x244da6={'tls':{'rejectUnauthorized':![]}};if(_0x5aa4fa[_0x75d1('0x21')][_0x75d1('0x22')]){_0x244da6[_0x75d1('0x22')]=_0x5aa4fa['Smtp'][_0x75d1('0x22')];}else{_0x244da6[_0x75d1('0x23')]=_0x5aa4fa[_0x75d1('0x21')][_0x75d1('0x23')];_0x244da6['port']=_0x5aa4fa[_0x75d1('0x21')]['port'];_0x244da6[_0x75d1('0x24')]=_0x5aa4fa[_0x75d1('0x21')]['secure'];}if(_0x5aa4fa[_0x75d1('0x21')][_0x75d1('0x25')]){_0x244da6[_0x75d1('0x26')]={'user':_0x5aa4fa[_0x75d1('0x21')][_0x75d1('0x13')],'pass':_0x5aa4fa['Smtp'][_0x75d1('0x27')]};}var _0x5ee66c={'account':_0x244da6,'message':_[_0x75d1('0x28')]({'from':util[_0x75d1('0x29')]('\x22%s\x22\x20<%s>',_0x5aa4fa['name'],_0x5aa4fa['email']||_0x5aa4fa[_0x75d1('0x21')][_0x75d1('0x13')])},_0x468bf0)};return client[_0x75d1('0x2a')](_0x75d1('0x2b'),_0x5ee66c);})[_0x75d1('0x15')](function(_0x372e23){if(_0x372e23[_0x75d1('0x2c')]){throw new Error(util[_0x75d1('0x29')](_0x75d1('0x2d'),_0x372e23['error'][_0x75d1('0x2e')]||JSON[_0x75d1('0x2f')](_0x372e23[_0x75d1('0x2c')])));}return!![];});}function handleError(_0x62b37e,_0x6d48a5,_0x55194b){return _0x62b37e['status'](_0x6d48a5||0x1f4)['send']({'message':_0x55194b?_0x55194b[_0x75d1('0x2e')]||_0x55194b:''});}exports[_0x75d1('0x30')]=function(_0x7c9dc3,_0x29d72f,_0x460b92){passport[_0x75d1('0x16')]('local',function(_0x5553b9,_0x5efaea,_0x3f2569){var _0x4cb084=_0x5553b9||_0x3f2569;if(_0x4cb084){return handleError(_0x29d72f,0x191,_0x4cb084);}if(!_0x5efaea){return handleError(_0x29d72f,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x450aa5={'payload':{'id':_0x5efaea['id'],'role':_0x5efaea[_0x75d1('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x75d1('0x31')](_0x450aa5)[_0x75d1('0x15')](function(_0x4e0cfd){_0x29d72f[_0x75d1('0x32')]({'id':_0x5efaea['id'],'token':_0x4e0cfd,'statusCall':'','isAlreadyLogged':_0x5efaea[_0x75d1('0x33')]});});}})(_0x7c9dc3,_0x29d72f,_0x460b92);};exports[_0x75d1('0x34')]=function(_0x3d4137,_0x33bbe7,_0xbc6473){if(!_0x3d4137[_0x75d1('0x35')][_0x75d1('0x1e')]){return handleError(_0x33bbe7,0x1f4,{'message':_0x75d1('0x36')});}var _0x31703b=rs[_0x75d1('0x37')]();_0x3d4137[_0x75d1('0x35')][_0x75d1('0x1e')]=_0x3d4137[_0x75d1('0x35')][_0x75d1('0x1e')][_0x75d1('0x38')]()[_0x75d1('0x39')]();var _0x2ad3ef;return db[_0x75d1('0x9')][_0x75d1('0xb')]({'where':{'id':0x1},'attributes':[_0x75d1('0x18'),_0x75d1('0xa')],'raw':!![]})['then'](function(_0x5b2949){_0x2ad3ef=_0x5b2949;return db[_0x75d1('0x3a')][_0x75d1('0x3b')]({'where':{'email':_0x3d4137[_0x75d1('0x35')][_0x75d1('0x1e')]}});})['then'](function(_0x3904a0){if(!_0x3904a0){throw new Error(_0x75d1('0x3c'));}if(_0x3904a0[_0x75d1('0xf')]){throw new Error(_0x75d1('0x3d'));}if(_0x3904a0['blocked']){if(moment(_0x3904a0[_0x75d1('0x11')])[_0x75d1('0x19')](_0x2ad3ef[_0x75d1('0xa')],_0x75d1('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x3904a0[_0x75d1('0x10')]=![];_0x3904a0['blockedAt']=null;}}_0x3904a0[_0x75d1('0x3e')]=_0x31703b;_0x3904a0[_0x75d1('0x3f')]=Date[_0x75d1('0x40')]()+0x36ee80;return _0x3904a0[_0x75d1('0x41')]();})[_0x75d1('0x15')](function(){return sendServiceMail({'to':_0x3d4137[_0x75d1('0x35')]['email'],'subject':_0x75d1('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x75d1('0x43')+_0x3d4137[_0x75d1('0x44')][_0x75d1('0x23')]+_0x75d1('0x45')+_0x31703b+'\x0a\x0a'+_0x75d1('0x46')});})[_0x75d1('0x15')](function(){_0x33bbe7[_0x75d1('0x47')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x75d1('0x1c')](function(_0x8ce3d2){return handleError(_0x33bbe7,0x1f4,_0x8ce3d2);});};exports['reset']=function(_0x2d380d,_0x2fa44a,_0x2066c8){return db['User'][_0x75d1('0x3b')]({'where':{'resetPasswordToken':_0x2d380d[_0x75d1('0x48')][_0x75d1('0x49')],'resetPasswordExpires':{'$gt':Date[_0x75d1('0x40')]()}}})[_0x75d1('0x15')](function(_0x41869d){if(!_0x41869d){throw new Error(_0x75d1('0x4a'));}return db['Setting'][_0x75d1('0xb')]({'attributes':['id',_0x75d1('0x4b'),_0x75d1('0x4c'),_0x75d1('0x4d')]})[_0x75d1('0x15')](function(_0x326f42){if(_0x326f42[_0x75d1('0x4b')])authService['validatePasswordPattern'](_0x2d380d[_0x75d1('0x35')][_0x75d1('0x4e')]);if(!_0x326f42[_0x75d1('0x4c')]||!_0x41869d['previousPasswords'])return _0x41869d;authService[_0x75d1('0x4f')](_0x2d380d[_0x75d1('0x35')][_0x75d1('0x4e')],_0x41869d[_0x75d1('0x50')],_0x326f42[_0x75d1('0x4d')]);return _0x41869d;})[_0x75d1('0x15')](function(){_0x41869d['password']=_0x2d380d[_0x75d1('0x35')][_0x75d1('0x4e')];_0x41869d[_0x75d1('0x3e')]=null;_0x41869d[_0x75d1('0x3f')]=null;return _0x41869d[_0x75d1('0x41')]();});})[_0x75d1('0x15')](function(){_0x2fa44a[_0x75d1('0x47')](0xc8)[_0x75d1('0x51')]({'message':_0x75d1('0x52')});})[_0x75d1('0x1c')](function(_0x1038d2){return handleError(_0x2fa44a,0x1f4,_0x1038d2);});};passport[_0x75d1('0x53')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x41d54f,_0x4c1f5e,_0x18ae80){return localAuthenticate(db[_0x75d1('0x3a')],_0x41d54f,_0x4c1f5e,_0x18ae80);})); \ No newline at end of file +var _0x3f8a=['authentication','auth','merge','\x22%s\x22\x20<%s>','email','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','trim','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','status','catch','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add','minutes','clearBlockUser','getLicense','MailAccount','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure'];(function(_0x5cfb28,_0x3e0693){var _0x5e6336=function(_0x2cbcc1){while(--_0x2cbcc1){_0x5cfb28['push'](_0x5cfb28['shift']());}};_0x5e6336(++_0x3e0693);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x394a2d,_0x460cf0){_0x394a2d=_0x394a2d-0x0;var _0x4a5274=_0x3f8a[_0x394a2d];return _0x4a5274;};'use strict';var util=require(_0xa3f8('0x0'));var passport=require(_0xa3f8('0x1'));var LocalStrategy=require(_0xa3f8('0x2'))[_0xa3f8('0x3')];var jayson=require('jayson/promise');var _=require(_0xa3f8('0x4'));var rs=require(_0xa3f8('0x5'));var moment=require(_0xa3f8('0x6'));var db=require(_0xa3f8('0x7'))['db'];var authService=require(_0xa3f8('0x8'));var utils=require(_0xa3f8('0x9'));var client=jayson[_0xa3f8('0xa')][_0xa3f8('0xb')]({'port':0x232b});function localAuthenticate(_0x1f160a,_0xf895d9,_0xcfea5,_0x268332){var _0x2faf2e,_0x2448de;return db[_0xa3f8('0xc')][_0xa3f8('0xd')]({'where':{'id':0x1},'attributes':[_0xa3f8('0xe'),'blockDuration'],'raw':!![]})[_0xa3f8('0xf')](function(_0x13a082){_0x2faf2e=_0x13a082;return _0x1f160a[_0xa3f8('0xd')]({'attributes':['id',_0xa3f8('0x10'),'password',_0xa3f8('0x11'),_0xa3f8('0x12'),_0xa3f8('0x13'),_0xa3f8('0x14'),_0xa3f8('0x15'),_0xa3f8('0x16')],'where':{'name':_0xf895d9,'role':{'$or':[_0xa3f8('0x17'),_0xa3f8('0x18'),_0xa3f8('0x19')]}}});})[_0xa3f8('0xf')](function(_0x21b88f){if(!_0x21b88f||_0x21b88f&&_0x21b88f[_0xa3f8('0x10')]!==_0xf895d9){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2448de=_0x21b88f;return _0x2448de;}})[_0xa3f8('0xf')](function(){_0x2448de[_0xa3f8('0x1a')](_0xcfea5,function(_0x45014f,_0x21a170){var _0x5caebf=_0x2448de[_0xa3f8('0x16')]+0x1;if(_0x45014f){return _0x268332(_0x45014f);}else if(!_0x21a170){if(_0x2448de[_0xa3f8('0x13')]){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}else if(_0x2faf2e[_0xa3f8('0xe')]>0x0){if(_0x2448de[_0xa3f8('0x14')]){if(_0x2faf2e[_0xa3f8('0x1c')]>0x0){if(moment(_0x2448de[_0xa3f8('0x15')])[_0xa3f8('0x1d')](_0x2faf2e[_0xa3f8('0x1c')],_0xa3f8('0x1e'))>moment()){return _0x268332(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa3f8('0x1f')](_0x2448de,_0x5caebf,![],null)['then'](function(){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});});}}else{return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}}else{if(_0x5caebf>=_0x2faf2e[_0xa3f8('0xe')]){return utils[_0xa3f8('0x1f')](_0x2448de,0x0,!![],moment())['then'](function(){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});});}else{return utils['clearBlockUser'](_0x2448de,_0x5caebf,![],null)[_0xa3f8('0xf')](function(){return _0x268332(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}}else{if(_0x2448de[_0xa3f8('0x13')]){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}else if(_0x2faf2e[_0xa3f8('0xe')]>0x0){if(_0x2448de[_0xa3f8('0x14')]){if(_0x2faf2e[_0xa3f8('0x1c')]>0x0){if(moment(_0x2448de[_0xa3f8('0x15')])['add'](_0x2faf2e[_0xa3f8('0x1c')],'minutes')>moment()){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}else{return utils[_0xa3f8('0x1f')](_0x2448de,0x0,![],null)[_0xa3f8('0xf')](function(){return utils[_0xa3f8('0x20')](_0x2448de);})[_0xa3f8('0xf')](function(){return _0x268332(null,_0x2448de);});}}else{return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}}else{return utils[_0xa3f8('0x1f')](_0x2448de,0x0,![],null)[_0xa3f8('0xf')](function(){return utils[_0xa3f8('0x20')](_0x2448de);})[_0xa3f8('0xf')](function(){return _0x268332(null,_0x2448de);})['catch'](function(_0x1c3358){return _0x268332(null,![],_0x1c3358);});}}else{if(_0x2448de[_0xa3f8('0x14')]){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}else{return utils['getLicense'](_0x2448de)[_0xa3f8('0xf')](function(){return _0x268332(null,_0x2448de);});}}}});})['catch'](function(_0xbad6a6){return _0x268332(null,![],_0xbad6a6);});}function sendServiceMail(_0x3a3746){return db[_0xa3f8('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0xa3f8('0x10'),'email'],'include':[{'model':db[_0xa3f8('0x22')],'as':_0xa3f8('0x23')}]})[_0xa3f8('0xf')](function(_0x406140){if(!_0x406140){throw new Error(_0xa3f8('0x24'));}var _0x3bf3f8={'tls':{'rejectUnauthorized':![]}};if(_0x406140[_0xa3f8('0x23')][_0xa3f8('0x25')]){_0x3bf3f8[_0xa3f8('0x25')]=_0x406140[_0xa3f8('0x23')][_0xa3f8('0x25')];}else{_0x3bf3f8['host']=_0x406140[_0xa3f8('0x23')][_0xa3f8('0x26')];_0x3bf3f8[_0xa3f8('0x27')]=_0x406140[_0xa3f8('0x23')][_0xa3f8('0x27')];_0x3bf3f8['secure']=_0x406140[_0xa3f8('0x23')][_0xa3f8('0x28')];}if(_0x406140['Smtp'][_0xa3f8('0x29')]){_0x3bf3f8[_0xa3f8('0x2a')]={'user':_0x406140['Smtp'][_0xa3f8('0x18')],'pass':_0x406140['Smtp']['pass']};}var _0x129190={'account':_0x3bf3f8,'message':_[_0xa3f8('0x2b')]({'from':util['format'](_0xa3f8('0x2c'),_0x406140['name'],_0x406140[_0xa3f8('0x2d')]||_0x406140[_0xa3f8('0x23')][_0xa3f8('0x18')])},_0x3a3746)};return client[_0xa3f8('0x2e')]('SendMail',_0x129190);})[_0xa3f8('0xf')](function(_0x53c7b2){if(_0x53c7b2[_0xa3f8('0x2f')]){throw new Error(util['format'](_0xa3f8('0x30'),_0x53c7b2['error']['message']||JSON['stringify'](_0x53c7b2[_0xa3f8('0x2f')])));}return!![];});}function handleError(_0x1674f1,_0x1acf4f,_0x2ffeb3){return _0x1674f1['status'](_0x1acf4f||0x1f4)[_0xa3f8('0x31')]({'message':_0x2ffeb3?_0x2ffeb3[_0xa3f8('0x32')]||_0x2ffeb3:''});}exports[_0xa3f8('0x33')]=function(_0x858f53,_0x238da1,_0x3655c0){passport['authenticate'](_0xa3f8('0x34'),function(_0x3dfb9,_0x38c75b,_0x51de10){var _0x941bde=_0x3dfb9||_0x51de10;if(_0x941bde){return handleError(_0x238da1,0x191,_0x941bde);}if(!_0x38c75b){return handleError(_0x238da1,0x194,{'message':_0xa3f8('0x35')});}else{var _0x5ce212={'payload':{'id':_0x38c75b['id'],'role':_0x38c75b[_0xa3f8('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5ce212)[_0xa3f8('0xf')](function(_0x5a077c){_0x238da1[_0xa3f8('0x36')]({'id':_0x38c75b['id'],'token':_0x5a077c,'statusCall':'','isAlreadyLogged':_0x38c75b[_0xa3f8('0x37')]});});}})(_0x858f53,_0x238da1,_0x3655c0);};exports[_0xa3f8('0x38')]=function(_0x2a77be,_0x10534b,_0x53fc38){if(!_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')]){return handleError(_0x10534b,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x27c938=rs['generate']();_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')]=_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')][_0xa3f8('0x3a')]()['toLowerCase']();var _0x180e87;return db[_0xa3f8('0xc')][_0xa3f8('0xd')]({'where':{'id':0x1},'attributes':[_0xa3f8('0xe'),_0xa3f8('0x1c')],'raw':!![]})['then'](function(_0x306f08){_0x180e87=_0x306f08;return db[_0xa3f8('0x3b')][_0xa3f8('0x3c')]({'where':{'email':_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')]}});})[_0xa3f8('0xf')](function(_0x497217){if(!_0x497217){throw new Error(_0xa3f8('0x3d'));}if(_0x497217[_0xa3f8('0x13')]){throw new Error(_0xa3f8('0x3e'));}if(_0x497217[_0xa3f8('0x14')]){if(moment(_0x497217[_0xa3f8('0x15')])[_0xa3f8('0x1d')](_0x180e87['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x497217[_0xa3f8('0x14')]=![];_0x497217[_0xa3f8('0x15')]=null;}}_0x497217[_0xa3f8('0x3f')]=_0x27c938;_0x497217[_0xa3f8('0x40')]=Date[_0xa3f8('0x41')]()+0x36ee80;return _0x497217[_0xa3f8('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')],'subject':_0xa3f8('0x43'),'text':_0xa3f8('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xa3f8('0x45')+_0x2a77be[_0xa3f8('0x46')][_0xa3f8('0x26')]+'/reset/'+_0x27c938+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x10534b[_0xa3f8('0x47')](0xc8)[_0xa3f8('0x31')]({'message':'Reset\x20Email\x20sent!'});})[_0xa3f8('0x48')](function(_0x1f7af7){return handleError(_0x10534b,0x1f4,_0x1f7af7);});};exports[_0xa3f8('0x49')]=function(_0x142481,_0x14932f,_0x3c74b5){return db[_0xa3f8('0x3b')][_0xa3f8('0x3c')]({'where':{'resetPasswordToken':_0x142481[_0xa3f8('0x4a')][_0xa3f8('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xa3f8('0x41')]()}}})[_0xa3f8('0xf')](function(_0x23f44b){if(!_0x23f44b){throw new Error(_0xa3f8('0x4c'));}return db[_0xa3f8('0xc')][_0xa3f8('0xd')]({'attributes':['id',_0xa3f8('0x4d'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xa3f8('0xf')](function(_0x33fd07){if(_0x33fd07['securePassword'])authService[_0xa3f8('0x4e')](_0x142481[_0xa3f8('0x39')][_0xa3f8('0x4f')]);if(!_0x33fd07[_0xa3f8('0x50')]||!_0x23f44b[_0xa3f8('0x51')])return _0x23f44b;authService[_0xa3f8('0x52')](_0x142481[_0xa3f8('0x39')][_0xa3f8('0x4f')],_0x23f44b[_0xa3f8('0x51')],_0x33fd07[_0xa3f8('0x53')]);return _0x23f44b;})[_0xa3f8('0xf')](function(){_0x23f44b[_0xa3f8('0x4f')]=_0x142481[_0xa3f8('0x39')][_0xa3f8('0x4f')];_0x23f44b[_0xa3f8('0x3f')]=null;_0x23f44b[_0xa3f8('0x40')]=null;return _0x23f44b['save']();});})['then'](function(){_0x14932f[_0xa3f8('0x47')](0xc8)['send']({'message':_0xa3f8('0x54')});})[_0xa3f8('0x48')](function(_0x344083){return handleError(_0x14932f,0x1f4,_0x344083);});};passport['use'](new LocalStrategy({'usernameField':_0xa3f8('0x10'),'passwordField':_0xa3f8('0x4f')},function(_0x418be8,_0x1b221b,_0x572305){return localAuthenticate(db[_0xa3f8('0x3b')],_0x418be8,_0x1b221b,_0x572305);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a153b49..a0f47d1 100644 --- a/server/api/authLocal/index.js +++ b/server/api/authLocal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee3e=['post','login','/forgot','forgot','/reset/:token','exports','express','Router'];(function(_0x170561,_0x368fcf){var _0x56e9c9=function(_0x1e0d68){while(--_0x1e0d68){_0x170561['push'](_0x170561['shift']());}};_0x56e9c9(++_0x368fcf);}(_0xee3e,0xae));var _0xeee3=function(_0x511966,_0x4fda4a){_0x511966=_0x511966-0x0;var _0x309c36=_0xee3e[_0x511966];return _0x309c36;};'use strict';var express=require(_0xeee3('0x0'));var router=express[_0xeee3('0x1')]();var controller=require('./authLocal.controller');router[_0xeee3('0x2')]('/',controller[_0xeee3('0x3')]);router['post'](_0xeee3('0x4'),controller[_0xeee3('0x5')]);router[_0xeee3('0x2')](_0xeee3('0x6'),controller['reset']);module[_0xeee3('0x7')]=router; \ No newline at end of file +var _0x7c1c=['/reset/:token','reset','exports','express','./authLocal.controller','post','login','/forgot'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0x7c1c,0x1d3));var _0xc7c1=function(_0x73771f,_0x477a21){_0x73771f=_0x73771f-0x0;var _0xd52787=_0x7c1c[_0x73771f];return _0xd52787;};'use strict';var express=require(_0xc7c1('0x0'));var router=express['Router']();var controller=require(_0xc7c1('0x1'));router[_0xc7c1('0x2')]('/',controller[_0xc7c1('0x3')]);router[_0xc7c1('0x2')](_0xc7c1('0x4'),controller['forgot']);router[_0xc7c1('0x2')](_0xc7c1('0x5'),controller[_0xc7c1('0x6')]);module[_0xc7c1('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 080b54d..9ceffab 100644 --- a/server/api/automation/automation.attributes.js +++ b/server/api/automation/automation.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd42f=['exports','STRING','sequelize'];(function(_0x3e858f,_0x4bf7e0){var _0x22244c=function(_0x4b3280){while(--_0x4b3280){_0x3e858f['push'](_0x3e858f['shift']());}};_0x22244c(++_0x4bf7e0);}(_0xd42f,0x1c4));var _0xfd42=function(_0x158541,_0x16ec74){_0x158541=_0x158541-0x0;var _0x1fee53=_0xd42f[_0x158541];return _0x1fee53;};'use strict';var Sequelize=require(_0xfd42('0x0'));module[_0xfd42('0x1')]={'name':{'type':Sequelize[_0xfd42('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xfd42('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xf594=['BOOLEAN','sequelize','exports','STRING'];(function(_0x354057,_0x350290){var _0x4f38c7=function(_0x4f2a8a){while(--_0x4f2a8a){_0x354057['push'](_0x354057['shift']());}};_0x4f38c7(++_0x350290);}(_0xf594,0x141));var _0x4f59=function(_0x5deb9a,_0x13417f){_0x5deb9a=_0x5deb9a-0x0;var _0x1f8d57=_0xf594[_0x5deb9a];return _0x1f8d57;};'use strict';var Sequelize=require(_0x4f59('0x0'));module[_0x4f59('0x1')]={'name':{'type':Sequelize[_0x4f59('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x4f59('0x2')]},'description':{'type':Sequelize[_0x4f59('0x2')]},'status':{'type':Sequelize[_0x4f59('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index ed30a4e..8a0d930 100644 --- a/server/api/automation/automation.controller.js +++ b/server/api/automation/automation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x4aa88a,_0x38b501){var _0x4c6808=function(_0x3e3c30){while(--_0x3e3c30){_0x4aa88a['push'](_0x4aa88a['shift']());}};_0x4c6808(++_0x38b501);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x17281c,_0x442caa){var _0x25da6b=function(_0x10fbb2){while(--_0x10fbb2){_0x17281c['push'](_0x17281c['shift']());}};_0x25da6b(++_0x442caa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 9d2fbab..b9cf5b1 100644 --- a/server/api/automation/automation.model.js +++ b/server/api/automation/automation.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ccf=['request-promise','path','rimraf','exports','define','Automation','tools_automations','lodash','../../config/logger','api','moment'];(function(_0x337b47,_0x2e2ff2){var _0x1b7f7b=function(_0x25c0e4){while(--_0x25c0e4){_0x337b47['push'](_0x337b47['shift']());}};_0x1b7f7b(++_0x2e2ff2);}(_0x9ccf,0x10f));var _0xf9cc=function(_0x498b22,_0x131b18){_0x498b22=_0x498b22-0x0;var _0x327881=_0x9ccf[_0x498b22];return _0x327881;};'use strict';var _=require(_0xf9cc('0x0'));var util=require('util');var logger=require(_0xf9cc('0x1'))(_0xf9cc('0x2'));var moment=require(_0xf9cc('0x3'));var BPromise=require('bluebird');var rp=require(_0xf9cc('0x4'));var fs=require('fs');var path=require(_0xf9cc('0x5'));var rimraf=require(_0xf9cc('0x6'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0xf9cc('0x7')]=function(_0x575026,_0x3ffe1d){return _0x575026[_0xf9cc('0x8')](_0xf9cc('0x9'),attributes,{'tableName':_0xf9cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe900=['./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xe900,0x89));var _0x0e90=function(_0x5e7cbd,_0x322cac){_0x5e7cbd=_0x5e7cbd-0x0;var _0xcdeed2=_0xe900[_0x5e7cbd];return _0xcdeed2;};'use strict';var _=require(_0x0e90('0x0'));var util=require('util');var logger=require(_0x0e90('0x1'))(_0x0e90('0x2'));var moment=require(_0x0e90('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e90('0x4'));var fs=require('fs');var path=require(_0x0e90('0x5'));var rimraf=require('rimraf');var config=require(_0x0e90('0x6'));var attributes=require(_0x0e90('0x7'));module[_0x0e90('0x8')]=function(_0x413d4b,_0x34a068){return _0x413d4b[_0x0e90('0x9')](_0x0e90('0xa'),attributes,{'tableName':_0x0e90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index cb1cb65..29f9fc8 100644 --- a/server/api/automation/automation.rpc.js +++ b/server/api/automation/automation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc392=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xc392,0x1de));var _0x2c39=function(_0x3d53e0,_0x541888){_0x3d53e0=_0x3d53e0-0x0;var _0x6462bf=_0xc392[_0x3d53e0];return _0x6462bf;};'use strict';var _=require('lodash');var util=require(_0x2c39('0x0'));var moment=require(_0x2c39('0x1'));var BPromise=require(_0x2c39('0x2'));var rs=require(_0x2c39('0x3'));var fs=require('fs');var Redis=require(_0x2c39('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c39('0x5'));var logger=require(_0x2c39('0x6'))(_0x2c39('0x7'));var config=require(_0x2c39('0x8'));var jayson=require(_0x2c39('0x9'));var client=jayson[_0x2c39('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e8107,_0x5ed68d,_0x34d54d){return new BPromise(function(_0x549420,_0x4bf0f6){return client[_0x2c39('0xb')](_0x1e8107,_0x34d54d)['then'](function(_0x5dcbb3){logger[_0x2c39('0xc')](_0x2c39('0xd'),_0x5ed68d,_0x2c39('0xe'));logger[_0x2c39('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x5ed68d,'request\x20sent',JSON[_0x2c39('0x10')](_0x5dcbb3));if(_0x5dcbb3[_0x2c39('0x11')]){if(_0x5dcbb3['error'][_0x2c39('0x12')]===0x1f4){logger[_0x2c39('0x11')](_0x2c39('0xd'),_0x5ed68d,_0x5dcbb3[_0x2c39('0x11')][_0x2c39('0x13')]);return _0x4bf0f6(_0x5dcbb3[_0x2c39('0x11')][_0x2c39('0x13')]);}logger[_0x2c39('0x11')](_0x2c39('0xd'),_0x5ed68d,_0x5dcbb3['error'][_0x2c39('0x13')]);return _0x549420(_0x5dcbb3[_0x2c39('0x11')]['message']);}else{logger[_0x2c39('0xc')](_0x2c39('0xd'),_0x5ed68d,_0x2c39('0xe'));_0x549420(_0x5dcbb3[_0x2c39('0x14')]['message']);}})[_0x2c39('0x15')](function(_0x152d35){logger[_0x2c39('0x11')](_0x2c39('0xd'),_0x5ed68d,_0x152d35);_0x4bf0f6(_0x152d35);});});} \ No newline at end of file +var _0xc95c=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x42db23,_0x112b01){var _0x2d1e4e=function(_0x96342f){while(--_0x96342f){_0x42db23['push'](_0x42db23['shift']());}};_0x2d1e4e(++_0x112b01);}(_0xc95c,0x18d));var _0xcc95=function(_0x447efa,_0x453712){_0x447efa=_0x447efa-0x0;var _0x591b57=_0xc95c[_0x447efa];return _0x591b57;};'use strict';var _=require(_0xcc95('0x0'));var util=require(_0xcc95('0x1'));var moment=require(_0xcc95('0x2'));var BPromise=require(_0xcc95('0x3'));var rs=require(_0xcc95('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc95('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc95('0x6'))(_0xcc95('0x7'));var config=require(_0xcc95('0x8'));var jayson=require(_0xcc95('0x9'));var client=jayson['client'][_0xcc95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14f31e,_0x1ae85b,_0x5254d0){return new BPromise(function(_0x5ed6ee,_0x22ee88){return client['request'](_0x14f31e,_0x5254d0)[_0xcc95('0xb')](function(_0x15c142){logger[_0xcc95('0xc')](_0xcc95('0xd'),_0x1ae85b,_0xcc95('0xe'));logger[_0xcc95('0xf')](_0xcc95('0x10'),_0x1ae85b,'request\x20sent',JSON[_0xcc95('0x11')](_0x15c142));if(_0x15c142[_0xcc95('0x12')]){if(_0x15c142[_0xcc95('0x12')][_0xcc95('0x13')]===0x1f4){logger[_0xcc95('0x12')]('Automation,\x20%s,\x20%s',_0x1ae85b,_0x15c142['error']['message']);return _0x22ee88(_0x15c142[_0xcc95('0x12')][_0xcc95('0x14')]);}logger[_0xcc95('0x12')](_0xcc95('0xd'),_0x1ae85b,_0x15c142[_0xcc95('0x12')][_0xcc95('0x14')]);return _0x5ed6ee(_0x15c142[_0xcc95('0x12')]['message']);}else{logger[_0xcc95('0xc')]('Automation,\x20%s,\x20%s',_0x1ae85b,_0xcc95('0xe'));_0x5ed6ee(_0x15c142[_0xcc95('0x15')]['message']);}})[_0xcc95('0x16')](function(_0x518254){logger[_0xcc95('0x12')](_0xcc95('0xd'),_0x1ae85b,_0x518254);_0x22ee88(_0x518254);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c62fa8c..91c4c25 100644 --- a/server/api/automation/index.js +++ b/server/api/automation/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dc5=['index','/:id','show','getConditions','/:id/actions','getActions','post','/:id/conditions','addConditions','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4dc5,0x96));var _0x54dc=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x4dc5[_0x34843e];return _0x598f7f;};'use strict';var multer=require('multer');var util=require(_0x54dc('0x0'));var path=require(_0x54dc('0x1'));var timeout=require(_0x54dc('0x2'));var express=require(_0x54dc('0x3'));var router=express[_0x54dc('0x4')]();var auth=require(_0x54dc('0x5'));var interaction=require(_0x54dc('0x6'));var config=require(_0x54dc('0x7'));var controller=require(_0x54dc('0x8'));router[_0x54dc('0x9')]('/',auth[_0x54dc('0xa')](),controller[_0x54dc('0xb')]);router[_0x54dc('0x9')](_0x54dc('0xc'),auth[_0x54dc('0xa')](),controller[_0x54dc('0xd')]);router[_0x54dc('0x9')]('/:id/conditions',auth[_0x54dc('0xa')](),controller[_0x54dc('0xe')]);router[_0x54dc('0x9')](_0x54dc('0xf'),auth[_0x54dc('0xa')](),controller[_0x54dc('0x10')]);router[_0x54dc('0x11')]('/',auth[_0x54dc('0xa')](),controller['create']);router[_0x54dc('0x11')](_0x54dc('0x12'),auth[_0x54dc('0xa')](),controller[_0x54dc('0x13')]);router[_0x54dc('0x11')]('/:id/actions',auth[_0x54dc('0xa')](),controller['addActions']);router[_0x54dc('0x14')]('/:id',auth[_0x54dc('0xa')](),controller['update']);router[_0x54dc('0x15')](_0x54dc('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x54dc('0x16')]=router; \ No newline at end of file +var _0x1ab2=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','put','/:id','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ab2,0x198));var _0x21ab=function(_0x489b2e,_0xe9b2ff){_0x489b2e=_0x489b2e-0x0;var _0x83b43f=_0x1ab2[_0x489b2e];return _0x83b43f;};'use strict';var multer=require(_0x21ab('0x0'));var util=require(_0x21ab('0x1'));var path=require(_0x21ab('0x2'));var timeout=require(_0x21ab('0x3'));var express=require(_0x21ab('0x4'));var router=express['Router']();var auth=require(_0x21ab('0x5'));var interaction=require(_0x21ab('0x6'));var config=require(_0x21ab('0x7'));var controller=require(_0x21ab('0x8'));router['get']('/',auth[_0x21ab('0x9')](),controller[_0x21ab('0xa')]);router[_0x21ab('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x21ab('0xb')](_0x21ab('0xc'),auth[_0x21ab('0x9')](),controller[_0x21ab('0xd')]);router['get'](_0x21ab('0xe'),auth[_0x21ab('0x9')](),controller[_0x21ab('0xf')]);router[_0x21ab('0x10')]('/',auth['isAuthenticated'](),controller[_0x21ab('0x11')]);router[_0x21ab('0x10')](_0x21ab('0xc'),auth[_0x21ab('0x9')](),controller[_0x21ab('0x12')]);router[_0x21ab('0x10')](_0x21ab('0xe'),auth[_0x21ab('0x9')](),controller['addActions']);router[_0x21ab('0x13')](_0x21ab('0x14'),auth[_0x21ab('0x9')](),controller[_0x21ab('0x15')]);router['delete'](_0x21ab('0x14'),auth[_0x21ab('0x9')](),controller[_0x21ab('0x16')]);module[_0x21ab('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 83497fb..a25bb26 100644 --- a/server/api/campaign/campaign.attributes.js +++ b/server/api/campaign/campaign.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8635=['#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0x8635,0x6b));var _0x5863=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x8635[_0x2d344f];return _0x2e796b;};'use strict';var Sequelize=require(_0x5863('0x0'));module[_0x5863('0x1')]={'name':{'type':Sequelize[_0x5863('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5863('0x3')](_0x5863('0x4')),'allowNull':![],'defaultValue':_0x5863('0x4')},'description':{'type':Sequelize[_0x5863('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5863('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x5863('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5863('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5863('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5863('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5863('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5863('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5863('0x8')](0x3)[_0x5863('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5863('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5863('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5863('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x5863('0x8')](0x3)[_0x5863('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5863('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5863('0x8')](0x5)[_0x5863('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5863('0x6')],'defaultValue':0x3,'comment':_0x5863('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5863('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5863('0x8')](0x3)[_0x5863('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5863('0xf')},'dialTimezone':{'type':Sequelize[_0x5863('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5863('0x2')],'defaultValue':_0x5863('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x5863('0x3')](_0x5863('0x11'),_0x5863('0x12'),_0x5863('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5863('0x14')],'defaultValue':0x0,'comment':_0x5863('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x5863('0x8')](0x9)[_0x5863('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x5863('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5863('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5863('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5863('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5863('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5863('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5863('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5863('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5863('0x8')](0x9)[_0x5863('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5863('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5863('0x8')](0x9)[_0x5863('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5863('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5863('0x3')](_0x5863('0x1b'),_0x5863('0x1c')),'defaultValue':_0x5863('0x1b')},'dialPrefix':{'type':Sequelize[_0x5863('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5863('0x8')](0x3)[_0x5863('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5863('0x1d')},'dialCutDigit':{'type':Sequelize[_0x5863('0x8')](0x3)[_0x5863('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5863('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5863('0x8')](0x3)[_0x5863('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5863('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5863('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5863('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5863('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x5863('0x8')](0x5)[_0x5863('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5863('0x8')](0x3)[_0x5863('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5863('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5863('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5863('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x5863('0x8')](0x3)[_0x5863('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5863('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5863('0x8')](0x5)[_0x5863('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5863('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5863('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5863('0x8')](0x5)[_0x5863('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5863('0x26')}}; \ No newline at end of file +var _0x55bb=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','STRING','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x3a35a7,_0xcb49ba){var _0x15b518=function(_0x5b67c9){while(--_0x5b67c9){_0x3a35a7['push'](_0x3a35a7['shift']());}};_0x15b518(++_0xcb49ba);}(_0x55bb,0x176));var _0xb55b=function(_0x2a99eb,_0x3c6d20){_0x2a99eb=_0x2a99eb-0x0;var _0xc55166=_0x55bb[_0x2a99eb];return _0xc55166;};'use strict';var Sequelize=require(_0xb55b('0x0'));module[_0xb55b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb55b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb55b('0x3')](_0xb55b('0x4')),'allowNull':![],'defaultValue':_0xb55b('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb55b('0x5')},'limitCalls':{'type':Sequelize[_0xb55b('0x6')](0x4)[_0xb55b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb55b('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb55b('0xe')},'dialTimezone':{'type':Sequelize[_0xb55b('0xf')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb55b('0xf')],'defaultValue':_0xb55b('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xb55b('0x3')](_0xb55b('0x11'),_0xb55b('0x12'),_0xb55b('0x13')),'defaultValue':_0xb55b('0x11')},'dialAMDActive':{'type':Sequelize[_0xb55b('0x14')],'defaultValue':0x0,'comment':_0xb55b('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0xb55b('0x6')](0x9)[_0xb55b('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb55b('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xb55b('0x6')](0x9)[_0xb55b('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb55b('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb55b('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb55b('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xb55b('0x6')](0x9)[_0xb55b('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb55b('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb55b('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb55b('0x6')](0x9)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb55b('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb55b('0x6')](0x5)[_0xb55b('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb55b('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb55b('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xb55b('0x3')](_0xb55b('0x1c'),'ASC'),'defaultValue':_0xb55b('0x1c')},'dialPrefix':{'type':Sequelize[_0xb55b('0xf')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb55b('0x1d')},'dialCutDigit':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb55b('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index c9995ac..4c35c41 100644 --- a/server/api/campaign/campaign.controller.js +++ b/server/api/campaign/campaign.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x339bf5,_0x34e00b){var _0x1d6c61=function(_0x46a30d){while(--_0x46a30d){_0x339bf5['push'](_0x339bf5['shift']());}};_0x1d6c61(++_0x34e00b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file +var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x4d6c8e,_0x32d100){var _0x28a3a7=function(_0x285270){while(--_0x285270){_0x4d6c8e['push'](_0x4d6c8e['shift']());}};_0x28a3a7(++_0x32d100);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 294337a..da1fad6 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c19=['define','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./campaign.attributes','exports'];(function(_0x10d01f,_0x550096){var _0x2b242e=function(_0x500603){while(--_0x500603){_0x10d01f['push'](_0x10d01f['shift']());}};_0x2b242e(++_0x550096);}(_0x8c19,0x15f));var _0x98c1=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x8c19[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x98c1('0x0'));var util=require(_0x98c1('0x1'));var logger=require(_0x98c1('0x2'))(_0x98c1('0x3'));var moment=require('moment');var BPromise=require(_0x98c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x98c1('0x5'));var config=require(_0x98c1('0x6'));var attributes=require(_0x98c1('0x7'));module[_0x98c1('0x8')]=function(_0x2093ce,_0x44f0eb){return _0x2093ce[_0x98c1('0x9')]('Campaign',attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdb7=['request-promise','path','../../config/environment','./campaign.attributes','exports','Campaign','lodash','util','moment','bluebird'];(function(_0x40b5ce,_0xeb5c4d){var _0x141335=function(_0x1b73d9){while(--_0x1b73d9){_0x40b5ce['push'](_0x40b5ce['shift']());}};_0x141335(++_0xeb5c4d);}(_0xcdb7,0x146));var _0x7cdb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcdb7[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7cdb('0x0'));var util=require(_0x7cdb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7cdb('0x2'));var BPromise=require(_0x7cdb('0x3'));var rp=require(_0x7cdb('0x4'));var fs=require('fs');var path=require(_0x7cdb('0x5'));var rimraf=require('rimraf');var config=require(_0x7cdb('0x6'));var attributes=require(_0x7cdb('0x7'));module[_0x7cdb('0x8')]=function(_0x4db8fa,_0x378c2d){return _0x4db8fa['define'](_0x7cdb('0x9'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 7e08652..d20126a 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x36ec85,_0x2c9cb2){var _0x5e107b=function(_0x1d8521){while(--_0x1d8521){_0x36ec85['push'](_0x36ec85['shift']());}};_0x5e107b(++_0x2c9cb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 3e8465a..a51f874 100644 --- a/server/api/campaign/index.js +++ b/server/api/campaign/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcde1=['/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','addLists','addBlackLists','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xcde1,0xcb));var _0x1cde=function(_0x13fece,_0xa64d78){_0x13fece=_0x13fece-0x0;var _0x3d8c64=_0xcde1[_0x13fece];return _0x3d8c64;};'use strict';var multer=require(_0x1cde('0x0'));var util=require(_0x1cde('0x1'));var path=require(_0x1cde('0x2'));var timeout=require(_0x1cde('0x3'));var express=require(_0x1cde('0x4'));var router=express[_0x1cde('0x5')]();var auth=require(_0x1cde('0x6'));var interaction=require(_0x1cde('0x7'));var config=require(_0x1cde('0x8'));var controller=require(_0x1cde('0x9'));router[_0x1cde('0xa')]('/',auth[_0x1cde('0xb')](),controller[_0x1cde('0xc')]);router[_0x1cde('0xa')]('/:id',auth[_0x1cde('0xb')](),controller[_0x1cde('0xd')]);router[_0x1cde('0xa')]('/:id/hoppers',auth[_0x1cde('0xb')](),controller['getHoppers']);router[_0x1cde('0xa')](_0x1cde('0xe'),auth['isAuthenticated'](),controller[_0x1cde('0xf')]);router['get']('/:id/hopper_finals',auth[_0x1cde('0xb')](),controller[_0x1cde('0x10')]);router[_0x1cde('0xa')](_0x1cde('0x11'),auth['isAuthenticated'](),controller[_0x1cde('0x12')]);router['get'](_0x1cde('0x13'),auth[_0x1cde('0xb')](),controller[_0x1cde('0x14')]);router['get'](_0x1cde('0x15'),auth[_0x1cde('0xb')](),controller['getBlackLists']);router[_0x1cde('0x16')]('/',auth[_0x1cde('0xb')](),controller['create']);router[_0x1cde('0x16')](_0x1cde('0x17'),auth[_0x1cde('0xb')](),controller[_0x1cde('0x18')]);router['post']('/:id/lists',auth[_0x1cde('0xb')](),controller[_0x1cde('0x19')]);router[_0x1cde('0x16')]('/:id/blacklists',auth[_0x1cde('0xb')](),controller[_0x1cde('0x1a')]);router['put'](_0x1cde('0x1b'),auth['isAuthenticated'](),controller[_0x1cde('0x1c')]);router[_0x1cde('0x1d')]('/:id',auth[_0x1cde('0xb')](),controller['destroy']);router[_0x1cde('0x1d')](_0x1cde('0x13'),auth[_0x1cde('0xb')](),controller['removeLists']);router[_0x1cde('0x1d')](_0x1cde('0x15'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x1cde('0x1e')]=router; \ No newline at end of file +var _0x22c4=['getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','/:id','update','delete','destroy','removeBlackLists','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','show','getHoppers','/:id/hopper_finals','/:id/hopper_black'];(function(_0x1534dd,_0x476702){var _0x2f392e=function(_0x1d6dd1){while(--_0x1d6dd1){_0x1534dd['push'](_0x1534dd['shift']());}};_0x2f392e(++_0x476702);}(_0x22c4,0xc4));var _0x422c=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x22c4[_0x5311e8];return _0x582ad8;};'use strict';var multer=require(_0x422c('0x0'));var util=require('util');var path=require(_0x422c('0x1'));var timeout=require('connect-timeout');var express=require(_0x422c('0x2'));var router=express[_0x422c('0x3')]();var auth=require(_0x422c('0x4'));var interaction=require(_0x422c('0x5'));var config=require('../../config/environment');var controller=require(_0x422c('0x6'));router[_0x422c('0x7')]('/',auth[_0x422c('0x8')](),controller[_0x422c('0x9')]);router[_0x422c('0x7')]('/:id',auth[_0x422c('0x8')](),controller[_0x422c('0xa')]);router[_0x422c('0x7')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x422c('0xb')]);router[_0x422c('0x7')]('/:id/hopper_histories',auth[_0x422c('0x8')](),controller['getHopperHistories']);router['get'](_0x422c('0xc'),auth[_0x422c('0x8')](),controller['getHopperFinals']);router[_0x422c('0x7')](_0x422c('0xd'),auth[_0x422c('0x8')](),controller[_0x422c('0xe')]);router['get'](_0x422c('0xf'),auth['isAuthenticated'](),controller[_0x422c('0x10')]);router[_0x422c('0x7')](_0x422c('0x11'),auth[_0x422c('0x8')](),controller[_0x422c('0x12')]);router[_0x422c('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x422c('0x14'),auth[_0x422c('0x8')](),controller[_0x422c('0x15')]);router[_0x422c('0x13')](_0x422c('0xf'),auth[_0x422c('0x8')](),controller[_0x422c('0x16')]);router[_0x422c('0x13')](_0x422c('0x11'),auth[_0x422c('0x8')](),controller[_0x422c('0x17')]);router[_0x422c('0x18')](_0x422c('0x19'),auth['isAuthenticated'](),controller[_0x422c('0x1a')]);router[_0x422c('0x1b')](_0x422c('0x19'),auth[_0x422c('0x8')](),controller[_0x422c('0x1c')]);router['delete'](_0x422c('0xf'),auth['isAuthenticated'](),controller['removeLists']);router[_0x422c('0x1b')](_0x422c('0x11'),auth['isAuthenticated'](),controller[_0x422c('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e6f48a3..a87f2c2 100644 --- a/server/api/cannedAnswer/cannedAnswer.attributes.js +++ b/server/api/cannedAnswer/cannedAnswer.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x497f=['sequelize','exports','STRING','TEXT','key'];(function(_0x4ece1e,_0x404ef8){var _0x223f9a=function(_0x6909ac){while(--_0x6909ac){_0x4ece1e['push'](_0x4ece1e['shift']());}};_0x223f9a(++_0x404ef8);}(_0x497f,0xeb));var _0xf497=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x497f[_0x1f1a97];return _0x29fc6a;};'use strict';var Sequelize=require(_0xf497('0x0'));module[_0xf497('0x1')]={'key':{'type':Sequelize[_0xf497('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xf497('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xf497('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xf497('0x4'));}}}; \ No newline at end of file +var _0x1a6a=['TEXT','VIRTUAL','key','sequelize','STRING'];(function(_0x4b4744,_0x42897a){var _0x52d833=function(_0x58724c){while(--_0x58724c){_0x4b4744['push'](_0x4b4744['shift']());}};_0x52d833(++_0x42897a);}(_0x1a6a,0x12f));var _0xa1a6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x1a6a[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0xa1a6('0x0'));module['exports']={'key':{'type':Sequelize[_0xa1a6('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xa1a6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa1a6('0x1')]},'name':{'type':Sequelize[_0xa1a6('0x3')],'get':function(){return this['getDataValue'](_0xa1a6('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index abbba1d..461b4f4 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 43b2e6a..aaacf37 100644 --- a/server/api/cannedAnswer/cannedAnswer.model.js +++ b/server/api/cannedAnswer/cannedAnswer.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x991a=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x25aeea,_0x23928a){var _0x2dbcd0=function(_0x2dfcd5){while(--_0x2dfcd5){_0x25aeea['push'](_0x25aeea['shift']());}};_0x2dbcd0(++_0x23928a);}(_0x991a,0x12e));var _0xa991=function(_0x107c41,_0x361296){_0x107c41=_0x107c41-0x0;var _0x32a597=_0x991a[_0x107c41];return _0x32a597;};'use strict';var _=require('lodash');var util=require(_0xa991('0x0'));var logger=require(_0xa991('0x1'))(_0xa991('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa991('0x3'));var fs=require('fs');var path=require(_0xa991('0x4'));var rimraf=require(_0xa991('0x5'));var config=require(_0xa991('0x6'));var attributes=require(_0xa991('0x7'));module[_0xa991('0x8')]=function(_0x425ae2,_0x561c2f){return _0x425ae2[_0xa991('0x9')](_0xa991('0xa'),attributes,{'tableName':_0xa991('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa991('0xc')});}; \ No newline at end of file +var _0x78d8=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','api','rimraf'];(function(_0x25a245,_0x158aa9){var _0x3990e7=function(_0x3fee5b){while(--_0x3fee5b){_0x25a245['push'](_0x25a245['shift']());}};_0x3990e7(++_0x158aa9);}(_0x78d8,0x15c));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x878d('0x0'));var logger=require(_0x878d('0x1'))(_0x878d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x878d('0x3'));var config=require(_0x878d('0x4'));var attributes=require(_0x878d('0x5'));module[_0x878d('0x6')]=function(_0x144302,_0x2c2d79){return _0x144302[_0x878d('0x7')](_0x878d('0x8'),attributes,{'tableName':_0x878d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x878d('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 959625b..2a4ef85 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2943=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x1e377e,_0x59cda0){var _0x22925e=function(_0x4c6eb1){while(--_0x4c6eb1){_0x1e377e['push'](_0x1e377e['shift']());}};_0x22925e(++_0x59cda0);}(_0x2943,0x1c8));var _0x3294=function(_0x5a17d6,_0x514820){_0x5a17d6=_0x5a17d6-0x0;var _0x409d71=_0x2943[_0x5a17d6];return _0x409d71;};'use strict';var _=require(_0x3294('0x0'));var util=require(_0x3294('0x1'));var moment=require('moment');var BPromise=require(_0x3294('0x2'));var rs=require(_0x3294('0x3'));var fs=require('fs');var Redis=require(_0x3294('0x4'));var db=require(_0x3294('0x5'))['db'];var utils=require(_0x3294('0x6'));var logger=require('../../config/logger')(_0x3294('0x7'));var config=require(_0x3294('0x8'));var jayson=require(_0x3294('0x9'));var client=jayson[_0x3294('0xa')][_0x3294('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4285e0,_0x2097a5,_0x8e7044){return new BPromise(function(_0x56619a,_0x30fdb1){return client[_0x3294('0xc')](_0x4285e0,_0x8e7044)[_0x3294('0xd')](function(_0x1195be){logger[_0x3294('0xe')](_0x3294('0xf'),_0x2097a5,'request\x20sent');logger['debug'](_0x3294('0x10'),_0x2097a5,_0x3294('0x11'),JSON[_0x3294('0x12')](_0x1195be));if(_0x1195be[_0x3294('0x13')]){if(_0x1195be[_0x3294('0x13')]['code']===0x1f4){logger[_0x3294('0x13')](_0x3294('0xf'),_0x2097a5,_0x1195be[_0x3294('0x13')][_0x3294('0x14')]);return _0x30fdb1(_0x1195be[_0x3294('0x13')]['message']);}logger['error']('CannedAnswer,\x20%s,\x20%s',_0x2097a5,_0x1195be[_0x3294('0x13')][_0x3294('0x14')]);return _0x56619a(_0x1195be[_0x3294('0x13')][_0x3294('0x14')]);}else{logger[_0x3294('0xe')](_0x3294('0xf'),_0x2097a5,_0x3294('0x11'));_0x56619a(_0x1195be[_0x3294('0x15')][_0x3294('0x14')]);}})[_0x3294('0x16')](function(_0x5c4e7e){logger[_0x3294('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x2097a5,_0x5c4e7e);_0x30fdb1(_0x5c4e7e);});});} \ No newline at end of file +var _0x174e=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s'];(function(_0x3c787b,_0x15f957){var _0x3605fb=function(_0x3ae1c8){while(--_0x3ae1c8){_0x3c787b['push'](_0x3c787b['shift']());}};_0x3605fb(++_0x15f957);}(_0x174e,0xbf));var _0xe174=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x174e[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xe174('0x0'));var util=require(_0xe174('0x1'));var moment=require(_0xe174('0x2'));var BPromise=require(_0xe174('0x3'));var rs=require(_0xe174('0x4'));var fs=require('fs');var Redis=require(_0xe174('0x5'));var db=require(_0xe174('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe174('0x7'));var config=require(_0xe174('0x8'));var jayson=require(_0xe174('0x9'));var client=jayson[_0xe174('0xa')][_0xe174('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ba677,_0x577b25,_0x15b7eb){return new BPromise(function(_0x1b6981,_0x3214e1){return client[_0xe174('0xc')](_0x1ba677,_0x15b7eb)['then'](function(_0x37cb15){logger[_0xe174('0xd')](_0xe174('0xe'),_0x577b25,'request\x20sent');logger['debug'](_0xe174('0xf'),_0x577b25,_0xe174('0x10'),JSON[_0xe174('0x11')](_0x37cb15));if(_0x37cb15[_0xe174('0x12')]){if(_0x37cb15['error'][_0xe174('0x13')]===0x1f4){logger[_0xe174('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x577b25,_0x37cb15['error'][_0xe174('0x14')]);return _0x3214e1(_0x37cb15[_0xe174('0x12')]['message']);}logger['error'](_0xe174('0xe'),_0x577b25,_0x37cb15[_0xe174('0x12')][_0xe174('0x14')]);return _0x1b6981(_0x37cb15[_0xe174('0x12')][_0xe174('0x14')]);}else{logger[_0xe174('0xd')](_0xe174('0xe'),_0x577b25,_0xe174('0x10'));_0x1b6981(_0x37cb15[_0xe174('0x15')][_0xe174('0x14')]);}})[_0xe174('0x16')](function(_0x3097af){logger['error'](_0xe174('0xe'),_0x577b25,_0x3097af);_0x3214e1(_0x3097af);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index b9cc0d1..b94231b 100644 --- a/server/api/cannedAnswer/index.js +++ b/server/api/cannedAnswer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacf9=['./cannedAnswer.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x482057,_0x5b5502){var _0x486e18=function(_0x435790){while(--_0x435790){_0x482057['push'](_0x482057['shift']());}};_0x486e18(++_0x5b5502);}(_0xacf9,0x198));var _0x9acf=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xacf9[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require(_0x9acf('0x0'));var path=require(_0x9acf('0x1'));var timeout=require(_0x9acf('0x2'));var express=require('express');var router=express[_0x9acf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9acf('0x4'));var config=require(_0x9acf('0x5'));var controller=require(_0x9acf('0x6'));router['get']('/',auth[_0x9acf('0x7')](),controller[_0x9acf('0x8')]);router[_0x9acf('0x9')](_0x9acf('0xa'),auth[_0x9acf('0x7')](),controller[_0x9acf('0xb')]);router[_0x9acf('0xc')]('/',auth[_0x9acf('0x7')](),controller[_0x9acf('0xd')]);router[_0x9acf('0xe')](_0x9acf('0xa'),auth[_0x9acf('0x7')](),controller[_0x9acf('0xf')]);router[_0x9acf('0x10')]('/:id',auth[_0x9acf('0x7')](),controller['destroy']);module[_0x9acf('0x11')]=router; \ No newline at end of file +var _0xbf8d=['show','post','create','put','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id'];(function(_0x3f9547,_0x2c7d73){var _0x30ad70=function(_0x52aab5){while(--_0x52aab5){_0x3f9547['push'](_0x3f9547['shift']());}};_0x30ad70(++_0x2c7d73);}(_0xbf8d,0x117));var _0xdbf8=function(_0x579e75,_0x40fe61){_0x579e75=_0x579e75-0x0;var _0x53a03f=_0xbf8d[_0x579e75];return _0x53a03f;};'use strict';var multer=require('multer');var util=require(_0xdbf8('0x0'));var path=require(_0xdbf8('0x1'));var timeout=require('connect-timeout');var express=require(_0xdbf8('0x2'));var router=express[_0xdbf8('0x3')]();var auth=require(_0xdbf8('0x4'));var interaction=require(_0xdbf8('0x5'));var config=require(_0xdbf8('0x6'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xdbf8('0x7')](),controller['index']);router[_0xdbf8('0x8')](_0xdbf8('0x9'),auth['isAuthenticated'](),controller[_0xdbf8('0xa')]);router[_0xdbf8('0xb')]('/',auth['isAuthenticated'](),controller[_0xdbf8('0xc')]);router[_0xdbf8('0xd')](_0xdbf8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xdbf8('0xe')](_0xdbf8('0x9'),auth[_0xdbf8('0x7')](),controller[_0xdbf8('0xf')]);module[_0xdbf8('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 3035ebf..4f46974 100644 --- a/server/api/cdr/cdr.attributes.js +++ b/server/api/cdr/cdr.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbceb=['sequelize','DATE','STRING','INTEGER'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbceb,0x1a8));var _0xbbce=function(_0x2d483c,_0x2a1364){_0x2d483c=_0x2d483c-0x0;var _0x53dd4e=_0xbceb[_0x2d483c];return _0x53dd4e;};'use strict';var Sequelize=require(_0xbbce('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xbbce('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xbbce('0x2')]},'src':{'type':Sequelize[_0xbbce('0x2')]},'dst':{'type':Sequelize[_0xbbce('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xbbce('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xbbce('0x2')]},'duration':{'type':Sequelize[_0xbbce('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbbce('0x2')]},'amaflags':{'type':Sequelize[_0xbbce('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xbbce('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbbce('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xbbce('0x2')]},'peeraccount':{'type':Sequelize[_0xbbce('0x2')]},'type':{'type':Sequelize[_0xbbce('0x2')]},'tag':{'type':Sequelize[_0xbbce('0x2')]}}; \ No newline at end of file +var _0xb735=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x5708f5,_0x273841){var _0x655c4b=function(_0x1d58d1){while(--_0x1d58d1){_0x5708f5['push'](_0x5708f5['shift']());}};_0x655c4b(++_0x273841);}(_0xb735,0x96));var _0x5b73=function(_0x246f92,_0xcf7bd4){_0x246f92=_0x246f92-0x0;var _0x2b8e7d=_0xb735[_0x246f92];return _0x2b8e7d;};'use strict';var Sequelize=require(_0x5b73('0x0'));module[_0x5b73('0x1')]={'calldate':{'type':Sequelize[_0x5b73('0x2')],'allowNull':![],'defaultValue':_0x5b73('0x3')},'clid':{'type':Sequelize[_0x5b73('0x4')]},'src':{'type':Sequelize[_0x5b73('0x4')]},'dst':{'type':Sequelize[_0x5b73('0x4')]},'dcontext':{'type':Sequelize[_0x5b73('0x4')]},'channel':{'type':Sequelize[_0x5b73('0x4')]},'dstchannel':{'type':Sequelize[_0x5b73('0x4')]},'lastapp':{'type':Sequelize[_0x5b73('0x4')]},'lastdata':{'type':Sequelize[_0x5b73('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5b73('0x4')]},'amaflags':{'type':Sequelize[_0x5b73('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5b73('0x4')]},'userfield':{'type':Sequelize[_0x5b73('0x4')]},'uniqueid':{'type':Sequelize[_0x5b73('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x5b73('0x4')]},'peeraccount':{'type':Sequelize[_0x5b73('0x4')]},'type':{'type':Sequelize[_0x5b73('0x4')]},'tag':{'type':Sequelize[_0x5b73('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 872eade..3d72286 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0c7=['jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','status','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto'];(function(_0x5c5ecf,_0x5f2e26){var _0x3c108f=function(_0x15af9e){while(--_0x15af9e){_0x5c5ecf['push'](_0x5c5ecf['shift']());}};_0x3c108f(++_0x5f2e26);}(_0xb0c7,0x1e9));var _0x7b0c=function(_0x39d518,_0x32b600){_0x39d518=_0x39d518-0x0;var _0x2feade=_0xb0c7[_0x39d518];return _0x2feade;};'use strict';var pdf=require(_0x7b0c('0x0'));var emlformat=require(_0x7b0c('0x1'));var rimraf=require(_0x7b0c('0x2'));var zipdir=require(_0x7b0c('0x3'));var jsonpatch=require(_0x7b0c('0x4'));var rp=require(_0x7b0c('0x5'));var moment=require(_0x7b0c('0x6'));var BPromise=require(_0x7b0c('0x7'));var Mustache=require(_0x7b0c('0x8'));var util=require(_0x7b0c('0x9'));var path=require(_0x7b0c('0xa'));var sox=require(_0x7b0c('0xb'));var csv=require('to-csv');var ejs=require(_0x7b0c('0xc'));var fs=require('fs');var _=require(_0x7b0c('0xd'));var squel=require('squel');var crypto=require(_0x7b0c('0xe'));var jsforce=require(_0x7b0c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b0c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7b0c('0x11'));var as=require(_0x7b0c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b0c('0x13'))('api');var utils=require(_0x7b0c('0x14'));var config=require(_0x7b0c('0x15'));var licenseUtil=require(_0x7b0c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508714,_0x3fa0a0){_0x3fa0a0=_0x3fa0a0||0xcc;return function(_0xbb4f34){if(_0xbb4f34){return _0x508714[_0x7b0c('0x17')](_0x3fa0a0);}return _0x508714['status'](_0x3fa0a0)[_0x7b0c('0x18')]();};}function respondWithResult(_0x4b3d65,_0x5bef17){_0x5bef17=_0x5bef17||0xc8;return function(_0x2b81e1){if(_0x2b81e1){return _0x4b3d65['status'](_0x5bef17)[_0x7b0c('0x19')](_0x2b81e1);}};}function respondWithFilteredResult(_0x1c0f15,_0x2847e8){return function(_0x518e18){if(_0x518e18){var _0xc9a097=_0x518e18[_0x7b0c('0x1a')],_0x4482b8=_0x2847e8[_0x7b0c('0x1b')],_0x291d9f=_0x2847e8[_0x7b0c('0x1b')]+_0x2847e8['limit'],_0x44631c;if(_0x291d9f>=_0xc9a097){_0x291d9f=_0xc9a097;_0x44631c=0xc8;}else{_0x44631c=0xce;}_0x1c0f15[_0x7b0c('0x1c')](_0x44631c);return _0x1c0f15[_0x7b0c('0x1d')](_0x7b0c('0x1e'),_0x4482b8+'-'+_0x291d9f+'/'+_0xc9a097)[_0x7b0c('0x19')](_0x518e18);}return null;};}function patchUpdates(_0x53d25c){return function(_0x3b05bc){try{jsonpatch['apply'](_0x3b05bc,_0x53d25c,!![]);}catch(_0x6a9769){return BPromise[_0x7b0c('0x1f')](_0x6a9769);}return _0x3b05bc[_0x7b0c('0x20')]();};}function saveUpdates(_0x1a6467,_0x161025){return function(_0xdd417a){if(_0xdd417a){return _0xdd417a[_0x7b0c('0x21')](_0x1a6467)[_0x7b0c('0x22')](function(_0x1312ab){return _0x1312ab;});}return null;};}function removeEntity(_0x1a83c1,_0x19f88e){return function(_0x4e80a0){if(_0x4e80a0){return _0x4e80a0['destroy']()[_0x7b0c('0x22')](function(){_0x1a83c1[_0x7b0c('0x1c')](0xcc)[_0x7b0c('0x18')]();});}};}function handleEntityNotFound(_0x3d7bd6,_0x5aa1ab){return function(_0x4ea417){if(!_0x4ea417){_0x3d7bd6[_0x7b0c('0x17')](0x194);}return _0x4ea417;};}function handleError(_0x6ac088,_0x11ac3e){_0x11ac3e=_0x11ac3e||0x1f4;return function(_0x2917da){logger[_0x7b0c('0x23')](_0x2917da[_0x7b0c('0x24')]);if(_0x2917da[_0x7b0c('0x25')]){delete _0x2917da[_0x7b0c('0x25')];}_0x6ac088[_0x7b0c('0x1c')](_0x11ac3e)[_0x7b0c('0x26')](_0x2917da);};}exports[_0x7b0c('0x27')]=function(_0x57006e,_0x3496f5){var _0x3a55c2={},_0xf036f7={},_0x181d9e={'count':0x0,'rows':[]};var _0x59f6a1=_[_0x7b0c('0x28')](db[_0x7b0c('0x29')][_0x7b0c('0x2a')],function(_0x1a433a){return{'name':_0x1a433a['fieldName'],'type':_0x1a433a['type'][_0x7b0c('0x2b')]};});_0xf036f7[_0x7b0c('0x2c')]=_[_0x7b0c('0x28')](_0x59f6a1,_0x7b0c('0x25'));_0xf036f7[_0x7b0c('0x2d')]=_['keys'](_0x57006e[_0x7b0c('0x2d')]);_0xf036f7[_0x7b0c('0x2e')]=_[_0x7b0c('0x2f')](_0xf036f7['model'],_0xf036f7['query']);_0x3a55c2[_0x7b0c('0x30')]=_[_0x7b0c('0x2f')](_0xf036f7['model'],qs[_0x7b0c('0x31')](_0x57006e[_0x7b0c('0x2d')][_0x7b0c('0x31')]));_0x3a55c2[_0x7b0c('0x30')]=_0x3a55c2['attributes']['length']?_0x3a55c2[_0x7b0c('0x30')]:_0xf036f7[_0x7b0c('0x2c')];if(!_0x57006e['query'][_0x7b0c('0x32')](_0x7b0c('0x33'))){_0x3a55c2[_0x7b0c('0x34')]=qs[_0x7b0c('0x34')](_0x57006e[_0x7b0c('0x2d')][_0x7b0c('0x34')]);_0x3a55c2[_0x7b0c('0x1b')]=qs[_0x7b0c('0x1b')](_0x57006e[_0x7b0c('0x2d')][_0x7b0c('0x1b')]);}_0x3a55c2['order']=qs['sort'](_0x57006e['query']['sort']);_0x3a55c2[_0x7b0c('0x35')]=qs['filters'](_[_0x7b0c('0x36')](_0x57006e[_0x7b0c('0x2d')],_0xf036f7[_0x7b0c('0x2e')]),_0x59f6a1);if(_0x57006e[_0x7b0c('0x2d')][_0x7b0c('0x37')]){_0x3a55c2[_0x7b0c('0x35')]=_[_0x7b0c('0x38')](_0x3a55c2[_0x7b0c('0x35')],{'$or':_[_0x7b0c('0x28')](_0x59f6a1,function(_0x20ad6d){if(_0x20ad6d[_0x7b0c('0x39')]!==_0x7b0c('0x3a')){var _0x23a2b0={};_0x23a2b0[_0x20ad6d[_0x7b0c('0x25')]]={'$like':'%'+_0x57006e[_0x7b0c('0x2d')][_0x7b0c('0x37')]+'%'};return _0x23a2b0;}})});}_0x3a55c2=_[_0x7b0c('0x38')]({},_0x3a55c2,_0x57006e[_0x7b0c('0x3b')]);var _0x3a76aa={'where':_0x3a55c2[_0x7b0c('0x35')]};return db[_0x7b0c('0x29')][_0x7b0c('0x1a')](_0x3a76aa)['then'](function(_0x59eed1){_0x181d9e[_0x7b0c('0x1a')]=_0x59eed1;if(_0x57006e[_0x7b0c('0x2d')][_0x7b0c('0x3c')]){_0x3a55c2[_0x7b0c('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x7b0c('0x3e')](_0x3a55c2);})[_0x7b0c('0x22')](function(_0x5b5ad){_0x181d9e['rows']=_0x5b5ad;return _0x181d9e;})[_0x7b0c('0x22')](respondWithFilteredResult(_0x3496f5,_0x3a55c2))[_0x7b0c('0x3f')](handleError(_0x3496f5,null));};exports[_0x7b0c('0x40')]=function(_0x106c1b,_0x3a01ee){var _0x5ebf21={'raw':!![],'where':{'id':_0x106c1b['params']['id']}},_0x4f7db2={};_0x4f7db2[_0x7b0c('0x2c')]=_[_0x7b0c('0x41')](db['Cdr'][_0x7b0c('0x2a')]);_0x4f7db2[_0x7b0c('0x2d')]=_[_0x7b0c('0x41')](_0x106c1b[_0x7b0c('0x2d')]);_0x4f7db2[_0x7b0c('0x2e')]=_['intersection'](_0x4f7db2[_0x7b0c('0x2c')],_0x4f7db2[_0x7b0c('0x2d')]);_0x5ebf21['attributes']=_[_0x7b0c('0x2f')](_0x4f7db2[_0x7b0c('0x2c')],qs['fields'](_0x106c1b[_0x7b0c('0x2d')]['fields']));_0x5ebf21['attributes']=_0x5ebf21[_0x7b0c('0x30')][_0x7b0c('0x42')]?_0x5ebf21[_0x7b0c('0x30')]:_0x4f7db2[_0x7b0c('0x2c')];if(_0x106c1b[_0x7b0c('0x2d')]['includeAll']){_0x5ebf21[_0x7b0c('0x3d')]=[{'all':!![]}];}_0x5ebf21=_[_0x7b0c('0x38')]({},_0x5ebf21,_0x106c1b['options']);return db[_0x7b0c('0x29')][_0x7b0c('0x43')](_0x5ebf21)[_0x7b0c('0x22')](handleEntityNotFound(_0x3a01ee,null))[_0x7b0c('0x22')](respondWithResult(_0x3a01ee,null))[_0x7b0c('0x3f')](handleError(_0x3a01ee,null));};exports[_0x7b0c('0x44')]=function(_0x140661,_0x44fc45){return db[_0x7b0c('0x29')][_0x7b0c('0x44')](_0x140661[_0x7b0c('0x45')],{})[_0x7b0c('0x22')](respondWithResult(_0x44fc45,0xc9))[_0x7b0c('0x3f')](handleError(_0x44fc45,null));};exports[_0x7b0c('0x21')]=function(_0x5d4f05,_0x175f88){if(_0x5d4f05[_0x7b0c('0x45')]['id']){delete _0x5d4f05[_0x7b0c('0x45')]['id'];}return db['Cdr']['find']({'where':{'id':_0x5d4f05[_0x7b0c('0x46')]['id']}})[_0x7b0c('0x22')](handleEntityNotFound(_0x175f88,null))[_0x7b0c('0x22')](saveUpdates(_0x5d4f05[_0x7b0c('0x45')],null))[_0x7b0c('0x22')](respondWithResult(_0x175f88,null))['catch'](handleError(_0x175f88,null));};exports['destroy']=function(_0x18f8b5,_0x3a15b6){return db[_0x7b0c('0x29')][_0x7b0c('0x43')]({'where':{'id':_0x18f8b5[_0x7b0c('0x46')]['id']}})[_0x7b0c('0x22')](handleEntityNotFound(_0x3a15b6,null))[_0x7b0c('0x22')](removeEntity(_0x3a15b6,null))[_0x7b0c('0x3f')](handleError(_0x3a15b6,null));};exports[_0x7b0c('0x47')]=function(_0x18b31e,_0x215734){return db[_0x7b0c('0x29')][_0x7b0c('0x47')]()['then'](respondWithResult(_0x215734,null))[_0x7b0c('0x3f')](handleError(_0x215734,null));}; \ No newline at end of file +var _0xa48d=['update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','count','include','findAll','rows','catch','params','includeAll','options','find','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xa48d,0x1a0));var _0xda48=function(_0x22369e,_0x1a67ee){_0x22369e=_0x22369e-0x0;var _0x240791=_0xa48d[_0x22369e];return _0x240791;};'use strict';var pdf=require(_0xda48('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xda48('0x1'));var zipdir=require(_0xda48('0x2'));var jsonpatch=require(_0xda48('0x3'));var rp=require(_0xda48('0x4'));var moment=require(_0xda48('0x5'));var BPromise=require(_0xda48('0x6'));var Mustache=require('mustache');var util=require(_0xda48('0x7'));var path=require(_0xda48('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda48('0x9'));var fs=require('fs');var _=require(_0xda48('0xa'));var squel=require(_0xda48('0xb'));var crypto=require(_0xda48('0xc'));var jsforce=require(_0xda48('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xda48('0xe'));var querystring=require(_0xda48('0xf'));var Papa=require(_0xda48('0x10'));var Redis=require('ioredis');var authService=require(_0xda48('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xda48('0x12'));var hardwareService=require(_0xda48('0x13'));var logger=require(_0xda48('0x14'))('api');var utils=require(_0xda48('0x15'));var config=require(_0xda48('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4464ae,_0x53e510){_0x53e510=_0x53e510||0xcc;return function(_0x48919d){if(_0x48919d){return _0x4464ae[_0xda48('0x17')](_0x53e510);}return _0x4464ae['status'](_0x53e510)[_0xda48('0x18')]();};}function respondWithResult(_0x2bf6ac,_0x4f72bd){_0x4f72bd=_0x4f72bd||0xc8;return function(_0x5a36b3){if(_0x5a36b3){return _0x2bf6ac['status'](_0x4f72bd)[_0xda48('0x19')](_0x5a36b3);}};}function respondWithFilteredResult(_0x549fd9,_0x4b5c98){return function(_0x3a0058){if(_0x3a0058){var _0x192251=_0x3a0058['count'],_0x265499=_0x4b5c98[_0xda48('0x1a')],_0x497750=_0x4b5c98[_0xda48('0x1a')]+_0x4b5c98[_0xda48('0x1b')],_0x425b14;if(_0x497750>=_0x192251){_0x497750=_0x192251;_0x425b14=0xc8;}else{_0x425b14=0xce;}_0x549fd9[_0xda48('0x1c')](_0x425b14);return _0x549fd9[_0xda48('0x1d')](_0xda48('0x1e'),_0x265499+'-'+_0x497750+'/'+_0x192251)[_0xda48('0x19')](_0x3a0058);}return null;};}function patchUpdates(_0x4b7933){return function(_0x12503e){try{jsonpatch[_0xda48('0x1f')](_0x12503e,_0x4b7933,!![]);}catch(_0x41da95){return BPromise[_0xda48('0x20')](_0x41da95);}return _0x12503e[_0xda48('0x21')]();};}function saveUpdates(_0x4d0078,_0x51715d){return function(_0x394b73){if(_0x394b73){return _0x394b73[_0xda48('0x22')](_0x4d0078)[_0xda48('0x23')](function(_0xcc3462){return _0xcc3462;});}return null;};}function removeEntity(_0x4170be,_0x1e00ac){return function(_0x4a012a){if(_0x4a012a){return _0x4a012a['destroy']()[_0xda48('0x23')](function(){_0x4170be[_0xda48('0x1c')](0xcc)[_0xda48('0x18')]();});}};}function handleEntityNotFound(_0x33056d,_0x34e656){return function(_0x1d41ae){if(!_0x1d41ae){_0x33056d['sendStatus'](0x194);}return _0x1d41ae;};}function handleError(_0x281019,_0xa6ef4b){_0xa6ef4b=_0xa6ef4b||0x1f4;return function(_0x5540bd){logger[_0xda48('0x24')](_0x5540bd[_0xda48('0x25')]);if(_0x5540bd[_0xda48('0x26')]){delete _0x5540bd[_0xda48('0x26')];}_0x281019['status'](_0xa6ef4b)[_0xda48('0x27')](_0x5540bd);};}exports[_0xda48('0x28')]=function(_0x186be1,_0x164660){var _0x1d6f4c={},_0x311af2={},_0x3cdbda={'count':0x0,'rows':[]};var _0x981ffc=_[_0xda48('0x29')](db[_0xda48('0x2a')][_0xda48('0x2b')],function(_0x3bf87b){return{'name':_0x3bf87b[_0xda48('0x2c')],'type':_0x3bf87b['type'][_0xda48('0x2d')]};});_0x311af2[_0xda48('0x2e')]=_[_0xda48('0x29')](_0x981ffc,_0xda48('0x26'));_0x311af2[_0xda48('0x2f')]=_[_0xda48('0x30')](_0x186be1[_0xda48('0x2f')]);_0x311af2[_0xda48('0x31')]=_[_0xda48('0x32')](_0x311af2[_0xda48('0x2e')],_0x311af2[_0xda48('0x2f')]);_0x1d6f4c[_0xda48('0x33')]=_[_0xda48('0x32')](_0x311af2['model'],qs[_0xda48('0x34')](_0x186be1[_0xda48('0x2f')][_0xda48('0x34')]));_0x1d6f4c['attributes']=_0x1d6f4c[_0xda48('0x33')][_0xda48('0x35')]?_0x1d6f4c['attributes']:_0x311af2['model'];if(!_0x186be1[_0xda48('0x2f')][_0xda48('0x36')](_0xda48('0x37'))){_0x1d6f4c[_0xda48('0x1b')]=qs[_0xda48('0x1b')](_0x186be1[_0xda48('0x2f')][_0xda48('0x1b')]);_0x1d6f4c['offset']=qs['offset'](_0x186be1['query'][_0xda48('0x1a')]);}_0x1d6f4c['order']=qs[_0xda48('0x38')](_0x186be1[_0xda48('0x2f')]['sort']);_0x1d6f4c['where']=qs[_0xda48('0x31')](_[_0xda48('0x39')](_0x186be1['query'],_0x311af2[_0xda48('0x31')]),_0x981ffc);if(_0x186be1['query'][_0xda48('0x3a')]){_0x1d6f4c[_0xda48('0x3b')]=_[_0xda48('0x3c')](_0x1d6f4c[_0xda48('0x3b')],{'$or':_[_0xda48('0x29')](_0x981ffc,function(_0x5e7ba1){if(_0x5e7ba1[_0xda48('0x3d')]!==_0xda48('0x3e')){var _0x106d66={};_0x106d66[_0x5e7ba1[_0xda48('0x26')]]={'$like':'%'+_0x186be1[_0xda48('0x2f')][_0xda48('0x3a')]+'%'};return _0x106d66;}})});}_0x1d6f4c=_[_0xda48('0x3c')]({},_0x1d6f4c,_0x186be1['options']);var _0x69a670={'where':_0x1d6f4c[_0xda48('0x3b')]};return db['Cdr']['count'](_0x69a670)[_0xda48('0x23')](function(_0x177c11){_0x3cdbda[_0xda48('0x3f')]=_0x177c11;if(_0x186be1[_0xda48('0x2f')]['includeAll']){_0x1d6f4c[_0xda48('0x40')]=[{'all':!![]}];}return db[_0xda48('0x2a')][_0xda48('0x41')](_0x1d6f4c);})['then'](function(_0x4a338d){_0x3cdbda[_0xda48('0x42')]=_0x4a338d;return _0x3cdbda;})[_0xda48('0x23')](respondWithFilteredResult(_0x164660,_0x1d6f4c))[_0xda48('0x43')](handleError(_0x164660,null));};exports['show']=function(_0x505d6b,_0x5ce198){var _0x30d7f9={'raw':!![],'where':{'id':_0x505d6b[_0xda48('0x44')]['id']}},_0x35989e={};_0x35989e[_0xda48('0x2e')]=_[_0xda48('0x30')](db[_0xda48('0x2a')][_0xda48('0x2b')]);_0x35989e['query']=_[_0xda48('0x30')](_0x505d6b[_0xda48('0x2f')]);_0x35989e['filters']=_[_0xda48('0x32')](_0x35989e[_0xda48('0x2e')],_0x35989e[_0xda48('0x2f')]);_0x30d7f9[_0xda48('0x33')]=_[_0xda48('0x32')](_0x35989e[_0xda48('0x2e')],qs[_0xda48('0x34')](_0x505d6b[_0xda48('0x2f')]['fields']));_0x30d7f9[_0xda48('0x33')]=_0x30d7f9[_0xda48('0x33')][_0xda48('0x35')]?_0x30d7f9[_0xda48('0x33')]:_0x35989e[_0xda48('0x2e')];if(_0x505d6b['query'][_0xda48('0x45')]){_0x30d7f9['include']=[{'all':!![]}];}_0x30d7f9=_[_0xda48('0x3c')]({},_0x30d7f9,_0x505d6b[_0xda48('0x46')]);return db['Cdr'][_0xda48('0x47')](_0x30d7f9)[_0xda48('0x23')](handleEntityNotFound(_0x5ce198,null))[_0xda48('0x23')](respondWithResult(_0x5ce198,null))[_0xda48('0x43')](handleError(_0x5ce198,null));};exports['create']=function(_0x4af24e,_0x22e738){return db['Cdr']['create'](_0x4af24e[_0xda48('0x48')],{})[_0xda48('0x23')](respondWithResult(_0x22e738,0xc9))[_0xda48('0x43')](handleError(_0x22e738,null));};exports[_0xda48('0x22')]=function(_0x5cab3a,_0xb47a85){if(_0x5cab3a[_0xda48('0x48')]['id']){delete _0x5cab3a[_0xda48('0x48')]['id'];}return db[_0xda48('0x2a')][_0xda48('0x47')]({'where':{'id':_0x5cab3a[_0xda48('0x44')]['id']}})[_0xda48('0x23')](handleEntityNotFound(_0xb47a85,null))[_0xda48('0x23')](saveUpdates(_0x5cab3a[_0xda48('0x48')],null))[_0xda48('0x23')](respondWithResult(_0xb47a85,null))[_0xda48('0x43')](handleError(_0xb47a85,null));};exports[_0xda48('0x49')]=function(_0x4e5e20,_0x1aeb06){return db[_0xda48('0x2a')][_0xda48('0x47')]({'where':{'id':_0x4e5e20[_0xda48('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aeb06,null))[_0xda48('0x23')](removeEntity(_0x1aeb06,null))[_0xda48('0x43')](handleError(_0x1aeb06,null));};exports[_0xda48('0x4a')]=function(_0x43826b,_0x12af66){return db[_0xda48('0x2a')]['describe']()[_0xda48('0x23')](respondWithResult(_0x12af66,null))[_0xda48('0x43')](handleError(_0x12af66,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c3d0d3a..4d10ff6 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['../../config/environment','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdb28,0x106));var _0x8db2=function(_0x361e45,_0x46a9dd){_0x361e45=_0x361e45-0x0;var _0x5571c0=_0xdb28[_0x361e45];return _0x5571c0;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./cdr.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'name':_0x8db2('0xc'),'fields':[_0x8db2('0xc')]},{'name':_0x8db2('0xd'),'fields':[_0x8db2('0xd')]},{'name':_0x8db2('0xe'),'fields':['disposition']},{'name':_0x8db2('0xf'),'fields':[_0x8db2('0xf')]},{'name':_0x8db2('0x10'),'fields':['src']},{'name':_0x8db2('0x11'),'fields':[_0x8db2('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','uniqueid','util','api','moment'];(function(_0x1753bc,_0x440440){var _0x8c4313=function(_0x2247cf){while(--_0x2247cf){_0x1753bc['push'](_0x1753bc['shift']());}};_0x8c4313(++_0x440440);}(_0xadb5,0xad));var _0x5adb=function(_0x3b637c,_0x1e148b){_0x3b637c=_0x3b637c-0x0;var _0x433089=_0xadb5[_0x3b637c];return _0x433089;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./cdr.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xb')]},{'name':_0x5adb('0xc'),'fields':[_0x5adb('0xc')]},{'name':_0x5adb('0xd'),'fields':[_0x5adb('0xd')]},{'name':_0x5adb('0xe'),'fields':[_0x5adb('0xe')]},{'name':'src','fields':['src']},{'name':_0x5adb('0xf'),'fields':[_0x5adb('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6b6778a..2df64a2 100644 --- a/server/api/cdr/cdr.rpc.js +++ b/server/api/cdr/cdr.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee50=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x8e230a,_0x455ae3){var _0x346e37=function(_0x42bb0a){while(--_0x42bb0a){_0x8e230a['push'](_0x8e230a['shift']());}};_0x346e37(++_0x455ae3);}(_0xee50,0xce));var _0x0ee5=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xee50[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x0ee5('0x0'));var util=require(_0x0ee5('0x1'));var moment=require(_0x0ee5('0x2'));var BPromise=require(_0x0ee5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ee5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ee5('0x5'))(_0x0ee5('0x6'));var config=require(_0x0ee5('0x7'));var jayson=require(_0x0ee5('0x8'));var client=jayson[_0x0ee5('0x9')][_0x0ee5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47cd2a,_0x29156f,_0x3dbe6e){return new BPromise(function(_0x3b86a2,_0x1bd91a){return client[_0x0ee5('0xb')](_0x47cd2a,_0x3dbe6e)['then'](function(_0x4aa2b5){logger[_0x0ee5('0xc')](_0x0ee5('0xd'),_0x29156f,_0x0ee5('0xe'));logger[_0x0ee5('0xf')](_0x0ee5('0x10'),_0x29156f,'request\x20sent',JSON[_0x0ee5('0x11')](_0x4aa2b5));if(_0x4aa2b5['error']){if(_0x4aa2b5[_0x0ee5('0x12')][_0x0ee5('0x13')]===0x1f4){logger[_0x0ee5('0x12')](_0x0ee5('0xd'),_0x29156f,_0x4aa2b5[_0x0ee5('0x12')][_0x0ee5('0x14')]);return _0x1bd91a(_0x4aa2b5[_0x0ee5('0x12')]['message']);}logger[_0x0ee5('0x12')](_0x0ee5('0xd'),_0x29156f,_0x4aa2b5['error'][_0x0ee5('0x14')]);return _0x3b86a2(_0x4aa2b5['error'][_0x0ee5('0x14')]);}else{logger[_0x0ee5('0xc')](_0x0ee5('0xd'),_0x29156f,_0x0ee5('0xe'));_0x3b86a2(_0x4aa2b5[_0x0ee5('0x15')]['message']);}})[_0x0ee5('0x16')](function(_0x51456d){logger[_0x0ee5('0x12')](_0x0ee5('0xd'),_0x29156f,_0x51456d);_0x1bd91a(_0x51456d);});});} \ No newline at end of file +var _0x4385=['jayson/promise','client','http','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x23e5b7,_0x201e66){var _0x4ec4aa=function(_0x512618){while(--_0x512618){_0x23e5b7['push'](_0x23e5b7['shift']());}};_0x4ec4aa(++_0x201e66);}(_0x4385,0x133));var _0x5438=function(_0x39bfca,_0x1a1881){_0x39bfca=_0x39bfca-0x0;var _0x24519a=_0x4385[_0x39bfca];return _0x24519a;};'use strict';var _=require(_0x5438('0x0'));var util=require('util');var moment=require(_0x5438('0x1'));var BPromise=require(_0x5438('0x2'));var rs=require(_0x5438('0x3'));var fs=require('fs');var Redis=require(_0x5438('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5438('0x5'));var logger=require(_0x5438('0x6'))(_0x5438('0x7'));var config=require('../../config/environment');var jayson=require(_0x5438('0x8'));var client=jayson[_0x5438('0x9')][_0x5438('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x499d54,_0x16b63,_0x5ae176){return new BPromise(function(_0x15af6c,_0xa5b2b8){return client['request'](_0x499d54,_0x5ae176)[_0x5438('0xb')](function(_0x2c3e40){logger['info'](_0x5438('0xc'),_0x16b63,_0x5438('0xd'));logger['debug'](_0x5438('0xe'),_0x16b63,_0x5438('0xd'),JSON['stringify'](_0x2c3e40));if(_0x2c3e40[_0x5438('0xf')]){if(_0x2c3e40[_0x5438('0xf')][_0x5438('0x10')]===0x1f4){logger[_0x5438('0xf')](_0x5438('0xc'),_0x16b63,_0x2c3e40['error'][_0x5438('0x11')]);return _0xa5b2b8(_0x2c3e40[_0x5438('0xf')][_0x5438('0x11')]);}logger[_0x5438('0xf')](_0x5438('0xc'),_0x16b63,_0x2c3e40[_0x5438('0xf')][_0x5438('0x11')]);return _0x15af6c(_0x2c3e40['error'][_0x5438('0x11')]);}else{logger[_0x5438('0x12')](_0x5438('0xc'),_0x16b63,_0x5438('0xd'));_0x15af6c(_0x2c3e40[_0x5438('0x13')][_0x5438('0x11')]);}})[_0x5438('0x14')](function(_0x33b61b){logger['error'](_0x5438('0xc'),_0x16b63,_0x33b61b);_0xa5b2b8(_0x33b61b);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c9d1b1f..bc8dd02 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7a2=['show','post','put','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x4b500e,_0xde46cf){var _0x1750b3=function(_0x11378b){while(--_0x11378b){_0x4b500e['push'](_0x4b500e['shift']());}};_0x1750b3(++_0xde46cf);}(_0xf7a2,0xc4));var _0x2f7a=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xf7a2[_0x86b219];return _0x1f320c;};'use strict';var multer=require('multer');var util=require(_0x2f7a('0x0'));var path=require(_0x2f7a('0x1'));var timeout=require(_0x2f7a('0x2'));var express=require(_0x2f7a('0x3'));var router=express['Router']();var auth=require(_0x2f7a('0x4'));var interaction=require(_0x2f7a('0x5'));var config=require(_0x2f7a('0x6'));var controller=require(_0x2f7a('0x7'));router['get']('/',auth[_0x2f7a('0x8')](),controller[_0x2f7a('0x9')]);router[_0x2f7a('0xa')](_0x2f7a('0xb'),auth[_0x2f7a('0x8')](),controller['describe']);router[_0x2f7a('0xa')](_0x2f7a('0xc'),auth[_0x2f7a('0x8')](),controller[_0x2f7a('0xd')]);router[_0x2f7a('0xe')]('/',auth[_0x2f7a('0x8')](),controller['create']);router[_0x2f7a('0xf')]('/:id',auth[_0x2f7a('0x8')](),controller[_0x2f7a('0x10')]);router['delete'](_0x2f7a('0xc'),auth[_0x2f7a('0x8')](),controller[_0x2f7a('0x11')]);module[_0x2f7a('0x12')]=router; \ No newline at end of file +var _0xf5e2=['create','put','update','exports','multer','express','Router','../../config/environment','./cdr.controller','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x161951,_0x542e06){var _0x5c9c1a=function(_0x221fc2){while(--_0x221fc2){_0x161951['push'](_0x161951['shift']());}};_0x5c9c1a(++_0x542e06);}(_0xf5e2,0x144));var _0x2f5e=function(_0x52e0a9,_0x110044){_0x52e0a9=_0x52e0a9-0x0;var _0x37015a=_0xf5e2[_0x52e0a9];return _0x37015a;};'use strict';var multer=require(_0x2f5e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2f5e('0x1'));var router=express[_0x2f5e('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f5e('0x3'));var controller=require(_0x2f5e('0x4'));router[_0x2f5e('0x5')]('/',auth['isAuthenticated'](),controller[_0x2f5e('0x6')]);router['get'](_0x2f5e('0x7'),auth['isAuthenticated'](),controller[_0x2f5e('0x8')]);router['get'](_0x2f5e('0x9'),auth[_0x2f5e('0xa')](),controller[_0x2f5e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2f5e('0xc')]);router[_0x2f5e('0xd')](_0x2f5e('0x9'),auth['isAuthenticated'](),controller[_0x2f5e('0xe')]);router['delete'](_0x2f5e('0x9'),auth[_0x2f5e('0xa')](),controller['destroy']);module[_0x2f5e('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 7f6bf9d..173b0b5 100644 --- a/server/api/chatApplication/chatApplication.attributes.js +++ b/server/api/chatApplication/chatApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d75=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5d602e,_0x2b89ce){var _0x1eaad4=function(_0x4d3335){while(--_0x4d3335){_0x5d602e['push'](_0x5d602e['shift']());}};_0x1eaad4(++_0x2b89ce);}(_0x9d75,0x162));var _0x59d7=function(_0x3b3b16,_0x3689d2){_0x3b3b16=_0x3b3b16-0x0;var _0x31be1d=_0x9d75[_0x3b3b16];return _0x31be1d;};'use strict';var Sequelize=require(_0x59d7('0x0'));module[_0x59d7('0x1')]={'priority':{'type':Sequelize[_0x59d7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x59d7('0x3')],'allowNull':![],'defaultValue':_0x59d7('0x4')},'appdata':{'type':Sequelize[_0x59d7('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x59d7('0x3')],'defaultValue':_0x59d7('0x6')}}; \ No newline at end of file +var _0x065b=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x3c5249,_0x52a4a6){var _0x5ea511=function(_0x4f97c6){while(--_0x4f97c6){_0x3c5249['push'](_0x3c5249['shift']());}};_0x5ea511(++_0x52a4a6);}(_0x065b,0x84));var _0xb065=function(_0x5a7244,_0x605a4){_0x5a7244=_0x5a7244-0x0;var _0x77ff1b=_0x065b[_0x5a7244];return _0x77ff1b;};'use strict';var Sequelize=require(_0xb065('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb065('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb065('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb065('0x3')]()},'description':{'type':Sequelize[_0xb065('0x2')]},'interval':{'type':Sequelize[_0xb065('0x2')],'defaultValue':_0xb065('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 8a6e65d..1742b9a 100644 --- a/server/api/chatApplication/chatApplication.controller.js +++ b/server/api/chatApplication/chatApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1f5=['send','show','params','model','ChatApplication','query','keys','filters','intersection','attributes','length','includeAll','include','merge','options','find','catch','update','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name'];(function(_0x1b4e16,_0x3bd038){var _0x12beef=function(_0x5c45ce){while(--_0x5c45ce){_0x1b4e16['push'](_0x1b4e16['shift']());}};_0x12beef(++_0x3bd038);}(_0xe1f5,0x1b7));var _0x5e1f=function(_0x98c423,_0x304915){_0x98c423=_0x98c423-0x0;var _0x584b36=_0xe1f5[_0x98c423];return _0x584b36;};'use strict';var pdf=require(_0x5e1f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5e1f('0x1'));var zipdir=require(_0x5e1f('0x2'));var jsonpatch=require(_0x5e1f('0x3'));var rp=require('request-promise');var moment=require(_0x5e1f('0x4'));var BPromise=require(_0x5e1f('0x5'));var Mustache=require(_0x5e1f('0x6'));var util=require('util');var path=require(_0x5e1f('0x7'));var sox=require('sox');var csv=require(_0x5e1f('0x8'));var ejs=require(_0x5e1f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5e1f('0xa'));var crypto=require(_0x5e1f('0xb'));var jsforce=require(_0x5e1f('0xc'));var deskjs=require(_0x5e1f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5e1f('0xe'));var Papa=require(_0x5e1f('0xf'));var Redis=require(_0x5e1f('0x10'));var authService=require(_0x5e1f('0x11'));var qs=require(_0x5e1f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e1f('0x13'));var logger=require(_0x5e1f('0x14'))('api');var utils=require(_0x5e1f('0x15'));var config=require(_0x5e1f('0x16'));var licenseUtil=require(_0x5e1f('0x17'));var db=require(_0x5e1f('0x18'))['db'];function respondWithStatusCode(_0x24f0ba,_0x3a1227){_0x3a1227=_0x3a1227||0xcc;return function(_0x45a513){if(_0x45a513){return _0x24f0ba['sendStatus'](_0x3a1227);}return _0x24f0ba[_0x5e1f('0x19')](_0x3a1227)[_0x5e1f('0x1a')]();};}function respondWithResult(_0x101c24,_0x613a01){_0x613a01=_0x613a01||0xc8;return function(_0x529a3a){if(_0x529a3a){return _0x101c24[_0x5e1f('0x19')](_0x613a01)[_0x5e1f('0x1b')](_0x529a3a);}};}function respondWithFilteredResult(_0x5a3792,_0x23a89d){return function(_0xbef365){if(_0xbef365){var _0x245899=_0xbef365[_0x5e1f('0x1c')],_0x41ebe1=_0x23a89d[_0x5e1f('0x1d')],_0x48e956=_0x23a89d[_0x5e1f('0x1d')]+_0x23a89d[_0x5e1f('0x1e')],_0x4de93b;if(_0x48e956>=_0x245899){_0x48e956=_0x245899;_0x4de93b=0xc8;}else{_0x4de93b=0xce;}_0x5a3792['status'](_0x4de93b);return _0x5a3792[_0x5e1f('0x1f')](_0x5e1f('0x20'),_0x41ebe1+'-'+_0x48e956+'/'+_0x245899)[_0x5e1f('0x1b')](_0xbef365);}return null;};}function patchUpdates(_0x32057b){return function(_0x59db61){try{jsonpatch[_0x5e1f('0x21')](_0x59db61,_0x32057b,!![]);}catch(_0x99b27a){return BPromise[_0x5e1f('0x22')](_0x99b27a);}return _0x59db61['save']();};}function saveUpdates(_0x2e5797,_0x56755a){return function(_0x4cde55){if(_0x4cde55){return _0x4cde55['update'](_0x2e5797)[_0x5e1f('0x23')](function(_0x3c70e5){return _0x3c70e5;});}return null;};}function removeEntity(_0x5dcf12,_0x9a310){return function(_0xd28e3a){if(_0xd28e3a){return _0xd28e3a[_0x5e1f('0x24')]()[_0x5e1f('0x23')](function(){_0x5dcf12[_0x5e1f('0x19')](0xcc)[_0x5e1f('0x1a')]();});}};}function handleEntityNotFound(_0x6a2604,_0x67578){return function(_0x180db0){if(!_0x180db0){_0x6a2604[_0x5e1f('0x25')](0x194);}return _0x180db0;};}function handleError(_0x44448f,_0x10ed35){_0x10ed35=_0x10ed35||0x1f4;return function(_0x5d2d69){logger[_0x5e1f('0x26')](_0x5d2d69[_0x5e1f('0x27')]);if(_0x5d2d69[_0x5e1f('0x28')]){delete _0x5d2d69[_0x5e1f('0x28')];}_0x44448f['status'](_0x10ed35)[_0x5e1f('0x29')](_0x5d2d69);};}exports[_0x5e1f('0x2a')]=function(_0x1c46a0,_0x3f1b79){var _0xd6bbf9={'raw':!![],'where':{'id':_0x1c46a0[_0x5e1f('0x2b')]['id']}},_0x38d9f5={};_0x38d9f5[_0x5e1f('0x2c')]=_['keys'](db[_0x5e1f('0x2d')]['rawAttributes']);_0x38d9f5[_0x5e1f('0x2e')]=_[_0x5e1f('0x2f')](_0x1c46a0[_0x5e1f('0x2e')]);_0x38d9f5[_0x5e1f('0x30')]=_[_0x5e1f('0x31')](_0x38d9f5[_0x5e1f('0x2c')],_0x38d9f5[_0x5e1f('0x2e')]);_0xd6bbf9[_0x5e1f('0x32')]=_[_0x5e1f('0x31')](_0x38d9f5[_0x5e1f('0x2c')],qs['fields'](_0x1c46a0[_0x5e1f('0x2e')]['fields']));_0xd6bbf9[_0x5e1f('0x32')]=_0xd6bbf9[_0x5e1f('0x32')][_0x5e1f('0x33')]?_0xd6bbf9[_0x5e1f('0x32')]:_0x38d9f5[_0x5e1f('0x2c')];if(_0x1c46a0['query'][_0x5e1f('0x34')]){_0xd6bbf9[_0x5e1f('0x35')]=[{'all':!![]}];}_0xd6bbf9=_[_0x5e1f('0x36')]({},_0xd6bbf9,_0x1c46a0[_0x5e1f('0x37')]);return db['ChatApplication'][_0x5e1f('0x38')](_0xd6bbf9)[_0x5e1f('0x23')](handleEntityNotFound(_0x3f1b79,null))['then'](respondWithResult(_0x3f1b79,null))[_0x5e1f('0x39')](handleError(_0x3f1b79,null));};exports[_0x5e1f('0x3a')]=function(_0x3fbc50,_0x542982){if(_0x3fbc50[_0x5e1f('0x3b')]['id']){delete _0x3fbc50[_0x5e1f('0x3b')]['id'];}return db['ChatApplication'][_0x5e1f('0x38')]({'where':{'id':_0x3fbc50[_0x5e1f('0x2b')]['id']}})[_0x5e1f('0x23')](handleEntityNotFound(_0x542982,null))[_0x5e1f('0x23')](saveUpdates(_0x3fbc50['body'],null))[_0x5e1f('0x23')](respondWithResult(_0x542982,null))[_0x5e1f('0x39')](handleError(_0x542982,null));};exports['destroy']=function(_0x4bb6ed,_0x2ec5db){return db[_0x5e1f('0x2d')][_0x5e1f('0x38')]({'where':{'id':_0x4bb6ed[_0x5e1f('0x2b')]['id']}})[_0x5e1f('0x23')](handleEntityNotFound(_0x2ec5db,null))[_0x5e1f('0x23')](removeEntity(_0x2ec5db,null))[_0x5e1f('0x39')](handleError(_0x2ec5db,null));}; \ No newline at end of file +var _0xfc87=['moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','status','end','json','offset','limit','set','update','then','destroy','sendStatus','stack','name','show','keys','ChatApplication','query','filters','model','attributes','intersection','fields','length','includeAll','merge','find','catch','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x105df9,_0x3dc4f1){var _0x2e0281=function(_0x484f31){while(--_0x484f31){_0x105df9['push'](_0x105df9['shift']());}};_0x2e0281(++_0x3dc4f1);}(_0xfc87,0x1ce));var _0x7fc8=function(_0x4b2a30,_0x1156cf){_0x4b2a30=_0x4b2a30-0x0;var _0xa17628=_0xfc87[_0x4b2a30];return _0xa17628;};'use strict';var pdf=require(_0x7fc8('0x0'));var emlformat=require(_0x7fc8('0x1'));var rimraf=require(_0x7fc8('0x2'));var zipdir=require(_0x7fc8('0x3'));var jsonpatch=require(_0x7fc8('0x4'));var rp=require(_0x7fc8('0x5'));var moment=require(_0x7fc8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7fc8('0x7'));var util=require(_0x7fc8('0x8'));var path=require(_0x7fc8('0x9'));var sox=require(_0x7fc8('0xa'));var csv=require('to-csv');var ejs=require(_0x7fc8('0xb'));var fs=require('fs');var _=require(_0x7fc8('0xc'));var squel=require('squel');var crypto=require(_0x7fc8('0xd'));var jsforce=require(_0x7fc8('0xe'));var deskjs=require(_0x7fc8('0xf'));var toCsv=require(_0x7fc8('0x10'));var querystring=require(_0x7fc8('0x11'));var Papa=require(_0x7fc8('0x12'));var Redis=require(_0x7fc8('0x13'));var authService=require(_0x7fc8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fc8('0x15'))(_0x7fc8('0x16'));var utils=require('../../config/utils');var config=require(_0x7fc8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaa4bb,_0x543718){_0x543718=_0x543718||0xcc;return function(_0x53589d){if(_0x53589d){return _0xaa4bb['sendStatus'](_0x543718);}return _0xaa4bb[_0x7fc8('0x18')](_0x543718)[_0x7fc8('0x19')]();};}function respondWithResult(_0x1a9522,_0x54dcd7){_0x54dcd7=_0x54dcd7||0xc8;return function(_0x5a8756){if(_0x5a8756){return _0x1a9522['status'](_0x54dcd7)[_0x7fc8('0x1a')](_0x5a8756);}};}function respondWithFilteredResult(_0x16c008,_0x24aca7){return function(_0xe2734e){if(_0xe2734e){var _0x597e62=_0xe2734e['count'],_0x2b76c6=_0x24aca7[_0x7fc8('0x1b')],_0x17b285=_0x24aca7[_0x7fc8('0x1b')]+_0x24aca7[_0x7fc8('0x1c')],_0x4db820;if(_0x17b285>=_0x597e62){_0x17b285=_0x597e62;_0x4db820=0xc8;}else{_0x4db820=0xce;}_0x16c008['status'](_0x4db820);return _0x16c008[_0x7fc8('0x1d')]('Content-Range',_0x2b76c6+'-'+_0x17b285+'/'+_0x597e62)['json'](_0xe2734e);}return null;};}function patchUpdates(_0x16482c){return function(_0x1b5067){try{jsonpatch['apply'](_0x1b5067,_0x16482c,!![]);}catch(_0x2366c9){return BPromise['reject'](_0x2366c9);}return _0x1b5067['save']();};}function saveUpdates(_0x2bea09,_0x205b2b){return function(_0x16541c){if(_0x16541c){return _0x16541c[_0x7fc8('0x1e')](_0x2bea09)[_0x7fc8('0x1f')](function(_0x24d2a9){return _0x24d2a9;});}return null;};}function removeEntity(_0xbe5e7e,_0x3cabf2){return function(_0x2bd0af){if(_0x2bd0af){return _0x2bd0af[_0x7fc8('0x20')]()[_0x7fc8('0x1f')](function(){_0xbe5e7e[_0x7fc8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bfbd3,_0x4e2b80){return function(_0x1366d7){if(!_0x1366d7){_0x1bfbd3[_0x7fc8('0x21')](0x194);}return _0x1366d7;};}function handleError(_0x5ef18c,_0x1d6432){_0x1d6432=_0x1d6432||0x1f4;return function(_0x55ad8f){logger['error'](_0x55ad8f[_0x7fc8('0x22')]);if(_0x55ad8f[_0x7fc8('0x23')]){delete _0x55ad8f[_0x7fc8('0x23')];}_0x5ef18c['status'](_0x1d6432)['send'](_0x55ad8f);};}exports[_0x7fc8('0x24')]=function(_0x4861cd,_0x474d98){var _0x1a751b={'raw':!![],'where':{'id':_0x4861cd['params']['id']}},_0x1cdbdf={};_0x1cdbdf['model']=_[_0x7fc8('0x25')](db[_0x7fc8('0x26')]['rawAttributes']);_0x1cdbdf['query']=_['keys'](_0x4861cd[_0x7fc8('0x27')]);_0x1cdbdf[_0x7fc8('0x28')]=_['intersection'](_0x1cdbdf[_0x7fc8('0x29')],_0x1cdbdf['query']);_0x1a751b[_0x7fc8('0x2a')]=_[_0x7fc8('0x2b')](_0x1cdbdf[_0x7fc8('0x29')],qs[_0x7fc8('0x2c')](_0x4861cd['query'][_0x7fc8('0x2c')]));_0x1a751b['attributes']=_0x1a751b['attributes'][_0x7fc8('0x2d')]?_0x1a751b['attributes']:_0x1cdbdf[_0x7fc8('0x29')];if(_0x4861cd[_0x7fc8('0x27')][_0x7fc8('0x2e')]){_0x1a751b['include']=[{'all':!![]}];}_0x1a751b=_[_0x7fc8('0x2f')]({},_0x1a751b,_0x4861cd['options']);return db[_0x7fc8('0x26')][_0x7fc8('0x30')](_0x1a751b)[_0x7fc8('0x1f')](handleEntityNotFound(_0x474d98,null))[_0x7fc8('0x1f')](respondWithResult(_0x474d98,null))[_0x7fc8('0x31')](handleError(_0x474d98,null));};exports['update']=function(_0x357f14,_0x4c7bc9){if(_0x357f14['body']['id']){delete _0x357f14[_0x7fc8('0x32')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x357f14[_0x7fc8('0x33')]['id']}})[_0x7fc8('0x1f')](handleEntityNotFound(_0x4c7bc9,null))['then'](saveUpdates(_0x357f14[_0x7fc8('0x32')],null))['then'](respondWithResult(_0x4c7bc9,null))[_0x7fc8('0x31')](handleError(_0x4c7bc9,null));};exports['destroy']=function(_0x58df23,_0x8a7e3e){return db[_0x7fc8('0x26')][_0x7fc8('0x30')]({'where':{'id':_0x58df23[_0x7fc8('0x33')]['id']}})[_0x7fc8('0x1f')](handleEntityNotFound(_0x8a7e3e,null))['then'](removeEntity(_0x8a7e3e,null))[_0x7fc8('0x31')](handleError(_0x8a7e3e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5efdccd..2fd04fc 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5e9801f..8c570b2 100644 --- a/server/api/chatApplication/chatApplication.rpc.js +++ b/server/api/chatApplication/chatApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44a6=['jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x44a6,0x1ac));var _0x644a=function(_0x2369f4,_0x999c53){_0x2369f4=_0x2369f4-0x0;var _0x5b56f1=_0x44a6[_0x2369f4];return _0x5b56f1;};'use strict';var _=require(_0x644a('0x0'));var util=require(_0x644a('0x1'));var moment=require(_0x644a('0x2'));var BPromise=require(_0x644a('0x3'));var rs=require(_0x644a('0x4'));var fs=require('fs');var Redis=require(_0x644a('0x5'));var db=require(_0x644a('0x6'))['db'];var utils=require(_0x644a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x644a('0x8'));var jayson=require(_0x644a('0x9'));var client=jayson[_0x644a('0xa')][_0x644a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b0988,_0x23b41f,_0x8b9dc5){return new BPromise(function(_0x3f60b8,_0x522114){return client['request'](_0x5b0988,_0x8b9dc5)[_0x644a('0xc')](function(_0x7ba2cc){logger['info'](_0x644a('0xd'),_0x23b41f,'request\x20sent');logger[_0x644a('0xe')](_0x644a('0xf'),_0x23b41f,_0x644a('0x10'),JSON[_0x644a('0x11')](_0x7ba2cc));if(_0x7ba2cc['error']){if(_0x7ba2cc[_0x644a('0x12')]['code']===0x1f4){logger[_0x644a('0x12')]('ChatApplication,\x20%s,\x20%s',_0x23b41f,_0x7ba2cc[_0x644a('0x12')]['message']);return _0x522114(_0x7ba2cc['error'][_0x644a('0x13')]);}logger[_0x644a('0x12')](_0x644a('0xd'),_0x23b41f,_0x7ba2cc[_0x644a('0x12')][_0x644a('0x13')]);return _0x3f60b8(_0x7ba2cc[_0x644a('0x12')][_0x644a('0x13')]);}else{logger[_0x644a('0x14')]('ChatApplication,\x20%s,\x20%s',_0x23b41f,_0x644a('0x10'));_0x3f60b8(_0x7ba2cc[_0x644a('0x15')][_0x644a('0x13')]);}})[_0x644a('0x16')](function(_0xa75f70){logger[_0x644a('0x12')](_0x644a('0xd'),_0x23b41f,_0xa75f70);_0x522114(_0xa75f70);});});} \ No newline at end of file +var _0x8684=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8684,0x1ed));var _0x4868=function(_0xe61a8e,_0x5506ea){_0xe61a8e=_0xe61a8e-0x0;var _0xbe8518=_0x8684[_0xe61a8e];return _0xbe8518;};'use strict';var _=require(_0x4868('0x0'));var util=require(_0x4868('0x1'));var moment=require('moment');var BPromise=require(_0x4868('0x2'));var rs=require(_0x4868('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4868('0x4'))(_0x4868('0x5'));var config=require(_0x4868('0x6'));var jayson=require(_0x4868('0x7'));var client=jayson[_0x4868('0x8')][_0x4868('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a7ab3,_0x339d22,_0x18051a){return new BPromise(function(_0x5b8a07,_0x3746e8){return client[_0x4868('0xa')](_0x2a7ab3,_0x18051a)[_0x4868('0xb')](function(_0x384b71){logger[_0x4868('0xc')](_0x4868('0xd'),_0x339d22,_0x4868('0xe'));logger[_0x4868('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x339d22,_0x4868('0xe'),JSON[_0x4868('0x10')](_0x384b71));if(_0x384b71[_0x4868('0x11')]){if(_0x384b71[_0x4868('0x11')][_0x4868('0x12')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x339d22,_0x384b71[_0x4868('0x11')]['message']);return _0x3746e8(_0x384b71[_0x4868('0x11')][_0x4868('0x13')]);}logger[_0x4868('0x11')](_0x4868('0xd'),_0x339d22,_0x384b71[_0x4868('0x11')][_0x4868('0x13')]);return _0x5b8a07(_0x384b71[_0x4868('0x11')][_0x4868('0x13')]);}else{logger[_0x4868('0xc')](_0x4868('0xd'),_0x339d22,_0x4868('0xe'));_0x5b8a07(_0x384b71[_0x4868('0x14')][_0x4868('0x13')]);}})[_0x4868('0x15')](function(_0x2ef2af){logger[_0x4868('0x11')](_0x4868('0xd'),_0x339d22,_0x2ef2af);_0x3746e8(_0x2ef2af);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 81241a8..7ea4a97 100644 --- a/server/api/chatApplication/index.js +++ b/server/api/chatApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb18=['get','/:id','isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb18,0xe0));var _0x8bb1=function(_0x2ed1ad,_0x1fb8a1){_0x2ed1ad=_0x2ed1ad-0x0;var _0x1deb5e=_0xbb18[_0x2ed1ad];return _0x1deb5e;};'use strict';var multer=require(_0x8bb1('0x0'));var util=require(_0x8bb1('0x1'));var path=require(_0x8bb1('0x2'));var timeout=require(_0x8bb1('0x3'));var express=require(_0x8bb1('0x4'));var router=express[_0x8bb1('0x5')]();var auth=require(_0x8bb1('0x6'));var interaction=require(_0x8bb1('0x7'));var config=require(_0x8bb1('0x8'));var controller=require(_0x8bb1('0x9'));router[_0x8bb1('0xa')](_0x8bb1('0xb'),auth[_0x8bb1('0xc')](),controller[_0x8bb1('0xd')]);router[_0x8bb1('0xe')](_0x8bb1('0xb'),auth[_0x8bb1('0xc')](),controller[_0x8bb1('0xf')]);router[_0x8bb1('0x10')](_0x8bb1('0xb'),auth[_0x8bb1('0xc')](),controller['destroy']);module[_0x8bb1('0x11')]=router; \ No newline at end of file +var _0xab53=['isAuthenticated','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','show','put'];(function(_0x1322fa,_0x1a1690){var _0x3c9af7=function(_0x5e0e16){while(--_0x5e0e16){_0x1322fa['push'](_0x1322fa['shift']());}};_0x3c9af7(++_0x1a1690);}(_0xab53,0x9a));var _0x3ab5=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xab53[_0x47a349];return _0x18ab75;};'use strict';var multer=require(_0x3ab5('0x0'));var util=require(_0x3ab5('0x1'));var path=require(_0x3ab5('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ab5('0x3'));var router=express[_0x3ab5('0x4')]();var auth=require(_0x3ab5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3ab5('0x6'));var controller=require(_0x3ab5('0x7'));router['get'](_0x3ab5('0x8'),auth['isAuthenticated'](),controller[_0x3ab5('0x9')]);router[_0x3ab5('0xa')](_0x3ab5('0x8'),auth[_0x3ab5('0xb')](),controller[_0x3ab5('0xc')]);router[_0x3ab5('0xd')](_0x3ab5('0x8'),auth[_0x3ab5('0xb')](),controller['destroy']);module[_0x3ab5('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index ee0f30b..e05a29d 100644 --- a/server/api/chatGroup/chatGroup.attributes.js +++ b/server/api/chatGroup/chatGroup.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf08b=['exports','STRING','sequelize'];(function(_0x2f53c4,_0x400acc){var _0xf8b604=function(_0x2cf04c){while(--_0x2cf04c){_0x2f53c4['push'](_0x2f53c4['shift']());}};_0xf8b604(++_0x400acc);}(_0xf08b,0x1b8));var _0xbf08=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf08b[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xbf08('0x0'));module[_0xbf08('0x1')]={'name':{'type':Sequelize[_0xbf08('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x447f=['exports','STRING','sequelize'];(function(_0x43039d,_0x4f36bb){var _0x24927d=function(_0x54f7ea){while(--_0x54f7ea){_0x43039d['push'](_0x43039d['shift']());}};_0x24927d(++_0x4f36bb);}(_0x447f,0x89));var _0xf447=function(_0x19b002,_0x4c9ae2){_0x19b002=_0x19b002-0x0;var _0x3e2f36=_0x447f[_0x19b002];return _0x3e2f36;};'use strict';var Sequelize=require(_0xf447('0x0'));module[_0xf447('0x1')]={'name':{'type':Sequelize[_0xf447('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 935dbe9..7923760 100644 --- a/server/api/chatGroup/chatGroup.controller.js +++ b/server/api/chatGroup/chatGroup.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf470=['options','findAll','rows','catch','params','includeAll','include','merge','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','jayson/promise','http','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','ChatGroup','rawAttributes','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xf470,0xfd));var _0x0f47=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xf470[_0x474bc0];return _0x4b24cf;};'use strict';var pdf=require(_0x0f47('0x0'));var emlformat=require(_0x0f47('0x1'));var rimraf=require(_0x0f47('0x2'));var zipdir=require(_0x0f47('0x3'));var jsonpatch=require(_0x0f47('0x4'));var rp=require(_0x0f47('0x5'));var moment=require('moment');var BPromise=require(_0x0f47('0x6'));var Mustache=require(_0x0f47('0x7'));var util=require('util');var path=require(_0x0f47('0x8'));var sox=require(_0x0f47('0x9'));var csv=require(_0x0f47('0xa'));var ejs=require(_0x0f47('0xb'));var fs=require('fs');var _=require(_0x0f47('0xc'));var squel=require(_0x0f47('0xd'));var crypto=require(_0x0f47('0xe'));var jsforce=require(_0x0f47('0xf'));var deskjs=require(_0x0f47('0x10'));var toCsv=require(_0x0f47('0xa'));var querystring=require(_0x0f47('0x11'));var Papa=require(_0x0f47('0x12'));var Redis=require(_0x0f47('0x13'));var authService=require(_0x0f47('0x14'));var qs=require(_0x0f47('0x15'));var as=require(_0x0f47('0x16'));var hardwareService=require(_0x0f47('0x17'));var logger=require(_0x0f47('0x18'))(_0x0f47('0x19'));var utils=require('../../config/utils');var config=require(_0x0f47('0x1a'));var licenseUtil=require(_0x0f47('0x1b'));var db=require(_0x0f47('0x1c'))['db'];config[_0x0f47('0x1d')]=_[_0x0f47('0x1e')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0f47('0x1f'))(new Redis(config[_0x0f47('0x1d')]));require(_0x0f47('0x20'))[_0x0f47('0x21')](socket);var jayson=require(_0x0f47('0x22'));var client=jayson['client'][_0x0f47('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x553f66,_0x4e5c11,_0x1e08f6,_0x2c2ba8){return new BPromise(function(_0x3edb61,_0x1e84eb){var _0x475754=_0x2c2ba8||client;return _0x475754[_0x0f47('0x24')](_0x553f66,_0x1e08f6)[_0x0f47('0x25')](function(_0x4c0247){logger[_0x0f47('0x26')](_0x0f47('0x27'),_0x4e5c11,'request\x20sent');logger[_0x0f47('0x28')](_0x0f47('0x29'),_0x4e5c11,_0x0f47('0x2a'),JSON[_0x0f47('0x2b')](_0x4c0247));if(_0x4c0247[_0x0f47('0x2c')]){if(_0x4c0247[_0x0f47('0x2c')][_0x0f47('0x2d')]===0x1f4){logger[_0x0f47('0x2c')](_0x0f47('0x27'),_0x4e5c11,_0x4c0247[_0x0f47('0x2c')][_0x0f47('0x2e')]);return _0x1e84eb(_0x4c0247['error']['message']);}logger['error'](_0x0f47('0x27'),_0x4e5c11,_0x4c0247['error']['message']);return _0x3edb61(_0x4c0247[_0x0f47('0x2c')][_0x0f47('0x2e')]);}else{logger[_0x0f47('0x26')](_0x0f47('0x27'),_0x4e5c11,_0x0f47('0x2a'));_0x3edb61(_0x4c0247[_0x0f47('0x2f')][_0x0f47('0x2e')]);}})['catch'](function(_0x4fb61b){logger[_0x0f47('0x2c')](_0x0f47('0x27'),_0x4e5c11,_0x4fb61b);_0x1e84eb(_0x4fb61b);});});}function respondWithStatusCode(_0x3c0ae0,_0x49f2ff){_0x49f2ff=_0x49f2ff||0xcc;return function(_0x365482){if(_0x365482){return _0x3c0ae0[_0x0f47('0x30')](_0x49f2ff);}return _0x3c0ae0[_0x0f47('0x31')](_0x49f2ff)[_0x0f47('0x32')]();};}function respondWithResult(_0x513fa1,_0x2955b9){_0x2955b9=_0x2955b9||0xc8;return function(_0x327ebb){if(_0x327ebb){return _0x513fa1[_0x0f47('0x31')](_0x2955b9)[_0x0f47('0x33')](_0x327ebb);}};}function respondWithFilteredResult(_0x19e916,_0x7982eb){return function(_0x1142cd){if(_0x1142cd){var _0xd47c98=_0x1142cd[_0x0f47('0x34')],_0x2b902e=_0x7982eb['offset'],_0x2648f1=_0x7982eb[_0x0f47('0x35')]+_0x7982eb[_0x0f47('0x36')],_0x8e5d1f;if(_0x2648f1>=_0xd47c98){_0x2648f1=_0xd47c98;_0x8e5d1f=0xc8;}else{_0x8e5d1f=0xce;}_0x19e916[_0x0f47('0x31')](_0x8e5d1f);return _0x19e916[_0x0f47('0x37')](_0x0f47('0x38'),_0x2b902e+'-'+_0x2648f1+'/'+_0xd47c98)['json'](_0x1142cd);}return null;};}function patchUpdates(_0x9970a5){return function(_0x3e62a4){try{jsonpatch[_0x0f47('0x39')](_0x3e62a4,_0x9970a5,!![]);}catch(_0x503fd2){return BPromise[_0x0f47('0x3a')](_0x503fd2);}return _0x3e62a4[_0x0f47('0x3b')]();};}function saveUpdates(_0x465b62,_0xb7deb0){return function(_0xcfb085){if(_0xcfb085){return _0xcfb085[_0x0f47('0x3c')](_0x465b62)['then'](function(_0x53ea2e){return _0x53ea2e;});}return null;};}function removeEntity(_0x5342d9,_0x29d2e9){return function(_0x4f0aab){if(_0x4f0aab){return _0x4f0aab[_0x0f47('0x3d')]()['then'](function(){_0x5342d9[_0x0f47('0x31')](0xcc)[_0x0f47('0x32')]();});}};}function handleEntityNotFound(_0x5d10d3,_0x444d87){return function(_0x4e879e){if(!_0x4e879e){_0x5d10d3[_0x0f47('0x30')](0x194);}return _0x4e879e;};}function handleError(_0xee9cd,_0x3dd653){_0x3dd653=_0x3dd653||0x1f4;return function(_0x164175){logger[_0x0f47('0x2c')](_0x164175['stack']);if(_0x164175[_0x0f47('0x3e')]){delete _0x164175[_0x0f47('0x3e')];}_0xee9cd[_0x0f47('0x31')](_0x3dd653)[_0x0f47('0x3f')](_0x164175);};}exports[_0x0f47('0x40')]=function(_0x47cf68,_0x501d1f){var _0x53a730={},_0x4081d2={},_0x813d0d={'count':0x0,'rows':[]};var _0x419e5c=_['map'](db[_0x0f47('0x41')][_0x0f47('0x42')],function(_0x4814fe){return{'name':_0x4814fe['fieldName'],'type':_0x4814fe['type'][_0x0f47('0x43')]};});_0x4081d2['model']=_[_0x0f47('0x44')](_0x419e5c,_0x0f47('0x3e'));_0x4081d2['query']=_[_0x0f47('0x45')](_0x47cf68[_0x0f47('0x46')]);_0x4081d2[_0x0f47('0x47')]=_[_0x0f47('0x48')](_0x4081d2[_0x0f47('0x49')],_0x4081d2[_0x0f47('0x46')]);_0x53a730[_0x0f47('0x4a')]=_[_0x0f47('0x48')](_0x4081d2['model'],qs[_0x0f47('0x4b')](_0x47cf68[_0x0f47('0x46')][_0x0f47('0x4b')]));_0x53a730[_0x0f47('0x4a')]=_0x53a730[_0x0f47('0x4a')][_0x0f47('0x4c')]?_0x53a730['attributes']:_0x4081d2[_0x0f47('0x49')];if(!_0x47cf68['query'][_0x0f47('0x4d')](_0x0f47('0x4e'))){_0x53a730['limit']=qs[_0x0f47('0x36')](_0x47cf68[_0x0f47('0x46')][_0x0f47('0x36')]);_0x53a730[_0x0f47('0x35')]=qs[_0x0f47('0x35')](_0x47cf68['query']['offset']);}_0x53a730[_0x0f47('0x4f')]=qs[_0x0f47('0x50')](_0x47cf68[_0x0f47('0x46')][_0x0f47('0x50')]);_0x53a730[_0x0f47('0x51')]=qs[_0x0f47('0x47')](_[_0x0f47('0x52')](_0x47cf68['query'],_0x4081d2['filters']),_0x419e5c);if(_0x47cf68[_0x0f47('0x46')][_0x0f47('0x53')]){_0x53a730[_0x0f47('0x51')]=_['merge'](_0x53a730[_0x0f47('0x51')],{'$or':_[_0x0f47('0x44')](_0x419e5c,function(_0x27c2cc){if(_0x27c2cc[_0x0f47('0x54')]!==_0x0f47('0x55')){var _0x1f0c60={};_0x1f0c60[_0x27c2cc[_0x0f47('0x3e')]]={'$like':'%'+_0x47cf68[_0x0f47('0x46')][_0x0f47('0x53')]+'%'};return _0x1f0c60;}})});}_0x53a730=_['merge']({},_0x53a730,_0x47cf68[_0x0f47('0x56')]);var _0x2e975c={'where':_0x53a730[_0x0f47('0x51')]};return db[_0x0f47('0x41')][_0x0f47('0x34')](_0x2e975c)[_0x0f47('0x25')](function(_0x259763){_0x813d0d[_0x0f47('0x34')]=_0x259763;if(_0x47cf68[_0x0f47('0x46')]['includeAll']){_0x53a730['include']=[{'all':!![]}];}return db[_0x0f47('0x41')][_0x0f47('0x57')](_0x53a730);})[_0x0f47('0x25')](function(_0x334c6f){_0x813d0d[_0x0f47('0x58')]=_0x334c6f;return _0x813d0d;})[_0x0f47('0x25')](respondWithFilteredResult(_0x501d1f,_0x53a730))[_0x0f47('0x59')](handleError(_0x501d1f,null));};exports['show']=function(_0x358c09,_0x143667){var _0x4a7347={'raw':!![],'where':{'id':_0x358c09[_0x0f47('0x5a')]['id']}},_0x6a478={};_0x6a478[_0x0f47('0x49')]=_[_0x0f47('0x45')](db['ChatGroup'][_0x0f47('0x42')]);_0x6a478[_0x0f47('0x46')]=_[_0x0f47('0x45')](_0x358c09[_0x0f47('0x46')]);_0x6a478['filters']=_[_0x0f47('0x48')](_0x6a478[_0x0f47('0x49')],_0x6a478[_0x0f47('0x46')]);_0x4a7347[_0x0f47('0x4a')]=_[_0x0f47('0x48')](_0x6a478[_0x0f47('0x49')],qs[_0x0f47('0x4b')](_0x358c09[_0x0f47('0x46')][_0x0f47('0x4b')]));_0x4a7347['attributes']=_0x4a7347[_0x0f47('0x4a')][_0x0f47('0x4c')]?_0x4a7347[_0x0f47('0x4a')]:_0x6a478[_0x0f47('0x49')];if(_0x358c09[_0x0f47('0x46')][_0x0f47('0x5b')]){_0x4a7347[_0x0f47('0x5c')]=[{'all':!![]}];}_0x4a7347=_[_0x0f47('0x5d')]({},_0x4a7347,_0x358c09[_0x0f47('0x56')]);return db[_0x0f47('0x41')][_0x0f47('0x5e')](_0x4a7347)[_0x0f47('0x25')](handleEntityNotFound(_0x143667,null))[_0x0f47('0x25')](respondWithResult(_0x143667,null))['catch'](handleError(_0x143667,null));};exports[_0x0f47('0x5f')]=function(_0x285cdd,_0x16f210){return db['ChatGroup'][_0x0f47('0x5f')](_0x285cdd[_0x0f47('0x60')],{})[_0x0f47('0x25')](respondWithResult(_0x16f210,0xc9))[_0x0f47('0x59')](handleError(_0x16f210,null));};exports[_0x0f47('0x3c')]=function(_0x4d9708,_0x1eaced){if(_0x4d9708['body']['id']){delete _0x4d9708[_0x0f47('0x60')]['id'];}return db[_0x0f47('0x41')][_0x0f47('0x5e')]({'where':{'id':_0x4d9708[_0x0f47('0x5a')]['id']}})[_0x0f47('0x25')](handleEntityNotFound(_0x1eaced,null))[_0x0f47('0x25')](saveUpdates(_0x4d9708['body'],null))['then'](respondWithResult(_0x1eaced,null))[_0x0f47('0x59')](handleError(_0x1eaced,null));};exports['destroy']=function(_0x2c6650,_0x3f2dc9){return db[_0x0f47('0x41')]['find']({'where':{'id':_0x2c6650['params']['id']}})['then'](handleEntityNotFound(_0x3f2dc9,null))['then'](removeEntity(_0x3f2dc9,null))['catch'](handleError(_0x3f2dc9,null));};exports[_0x0f47('0x61')]=function(_0x650220,_0x255b3f){return db[_0x0f47('0x41')]['describe']()[_0x0f47('0x25')](respondWithResult(_0x255b3f,null))['catch'](handleError(_0x255b3f,null));};exports[_0x0f47('0x62')]=function(_0x2df94b,_0x1f4b7c,_0xd39a78){return db[_0x0f47('0x63')][_0x0f47('0x34')]({'where':{'ChatGroupId':_0x2df94b[_0x0f47('0x5a')]['id'],'ToId':_0x2df94b[_0x0f47('0x64')]['id'],'read':![]}})[_0x0f47('0x25')](function(_0x3c759e){return{'id':_[_0x0f47('0x65')](_0x2df94b[_0x0f47('0x5a')]['id']),'count':_0x3c759e};})[_0x0f47('0x25')](respondWithResult(_0x1f4b7c,null))[_0x0f47('0x59')](handleError(_0x1f4b7c,null));};exports['addMembers']=function(_0x77686e,_0x3a76df,_0x3e6c34){return db[_0x0f47('0x41')][_0x0f47('0x5e')]({'where':{'id':_0x77686e[_0x0f47('0x5a')]['id']}})[_0x0f47('0x25')](handleEntityNotFound(_0x3a76df,null))[_0x0f47('0x25')](function(_0x328133){if(_0x328133){return _0x328133[_0x0f47('0x66')](_0x77686e[_0x0f47('0x60')][_0x0f47('0x67')],_[_0x0f47('0x68')](_0x77686e['body'],[_0x0f47('0x67'),'id'])||{});}})[_0x0f47('0x25')](respondWithResult(_0x3a76df,null))[_0x0f47('0x59')](handleError(_0x3a76df,null));};exports[_0x0f47('0x69')]=function(_0x192ead,_0x58a976,_0x14d193){var _0x1e51e8={};var _0x206a55={};var _0x2fbf13;var _0x11fe7b;return db[_0x0f47('0x41')][_0x0f47('0x6a')]({'where':{'id':_0x192ead['params']['id']}})[_0x0f47('0x25')](handleEntityNotFound(_0x58a976,null))[_0x0f47('0x25')](function(_0x2fd5ce){if(_0x2fd5ce){_0x2fbf13=_0x2fd5ce;_0x206a55['model']=_[_0x0f47('0x45')](db['User'][_0x0f47('0x42')]);_0x206a55[_0x0f47('0x46')]=_[_0x0f47('0x45')](_0x192ead[_0x0f47('0x46')]);_0x206a55[_0x0f47('0x47')]=_[_0x0f47('0x48')](_0x206a55[_0x0f47('0x49')],_0x206a55['query']);_0x1e51e8[_0x0f47('0x4a')]=_[_0x0f47('0x48')](_0x206a55[_0x0f47('0x49')],qs[_0x0f47('0x4b')](_0x192ead[_0x0f47('0x46')]['fields']));_0x1e51e8[_0x0f47('0x4a')]=_0x1e51e8[_0x0f47('0x4a')]['length']?_0x1e51e8[_0x0f47('0x4a')]:_0x206a55[_0x0f47('0x49')];_0x1e51e8[_0x0f47('0x4f')]=qs['sort'](_0x192ead[_0x0f47('0x46')]['sort']);_0x1e51e8['where']=qs[_0x0f47('0x47')](_['pick'](_0x192ead['query'],_0x206a55[_0x0f47('0x47')]));if(_0x192ead[_0x0f47('0x46')]['filter']){_0x1e51e8['where']=_[_0x0f47('0x5d')](_0x1e51e8['where'],{'$or':_['map'](_0x1e51e8['attributes'],function(_0x4ea9de){var _0x1571f1={};_0x1571f1[_0x4ea9de]={'$like':'%'+_0x192ead['query'][_0x0f47('0x53')]+'%'};return _0x1571f1;})});}_0x1e51e8=_['merge']({},_0x1e51e8,_0x192ead[_0x0f47('0x56')]);return _0x2fbf13[_0x0f47('0x69')](_0x1e51e8);}})[_0x0f47('0x25')](function(_0x58fde6){if(_0x58fde6){_0x11fe7b=_0x58fde6[_0x0f47('0x4c')];if(!_0x192ead[_0x0f47('0x46')]['hasOwnProperty'](_0x0f47('0x4e'))){_0x1e51e8['limit']=qs[_0x0f47('0x36')](_0x192ead[_0x0f47('0x46')]['limit']);_0x1e51e8[_0x0f47('0x35')]=qs[_0x0f47('0x35')](_0x192ead[_0x0f47('0x46')][_0x0f47('0x35')]);}return _0x2fbf13[_0x0f47('0x69')](_0x1e51e8);}})['then'](function(_0x3b6330){if(_0x3b6330){return _0x3b6330?{'count':_0x11fe7b,'rows':_0x3b6330}:null;}})[_0x0f47('0x25')](respondWithResult(_0x58a976,null))[_0x0f47('0x59')](handleError(_0x58a976,null));};exports[_0x0f47('0x6b')]=function(_0x4dd1b7,_0x5d846f,_0x49825d){return db[_0x0f47('0x41')][_0x0f47('0x5e')]({'where':{'id':_0x4dd1b7[_0x0f47('0x5a')]['id']}})[_0x0f47('0x25')](handleEntityNotFound(_0x5d846f,null))['then'](function(_0x1390eb){if(_0x1390eb){return _0x1390eb[_0x0f47('0x6b')](_0x4dd1b7[_0x0f47('0x46')][_0x0f47('0x67')]);}})['then'](respondWithStatusCode(_0x5d846f,null))['catch'](handleError(_0x5d846f,null));};exports[_0x0f47('0x6c')]=function(_0x4bf003,_0x56d593,_0x74bfde){if(_0x4bf003['body']['id']){delete _0x4bf003[_0x0f47('0x60')]['id'];}return db[_0x0f47('0x41')][_0x0f47('0x5e')]({'where':{'id':_0x4bf003[_0x0f47('0x5a')]['id']}})[_0x0f47('0x25')](handleEntityNotFound(_0x56d593,null))[_0x0f47('0x25')](function(_0x15274a){if(_0x15274a){_0x4bf003['body'][_0x0f47('0x6d')]=_0x15274a['id'];return db['ChatInternalMessage'][_0x0f47('0x5f')](_0x4bf003[_0x0f47('0x60')]);}})[_0x0f47('0x25')](respondWithResult(_0x56d593,null))['catch'](handleError(_0x56d593,null));};exports[_0x0f47('0x6e')]=function(_0x16b19d,_0x3b6620,_0x1c225f){var _0x3b64ff={};var _0x52121d={};var _0x160f34;var _0x241023;return db[_0x0f47('0x41')][_0x0f47('0x6a')]({'where':{'id':_0x16b19d[_0x0f47('0x5a')]['id']}})[_0x0f47('0x25')](handleEntityNotFound(_0x3b6620,null))[_0x0f47('0x25')](function(_0x1caf33){if(_0x1caf33){_0x160f34=_0x1caf33;_0x52121d[_0x0f47('0x49')]=_[_0x0f47('0x45')](db['ChatInternalMessage'][_0x0f47('0x42')]);_0x52121d[_0x0f47('0x46')]=_[_0x0f47('0x45')](_0x16b19d['query']);_0x52121d[_0x0f47('0x47')]=_['intersection'](_0x52121d[_0x0f47('0x49')],_0x52121d[_0x0f47('0x46')]);_0x3b64ff[_0x0f47('0x4a')]=_[_0x0f47('0x48')](_0x52121d[_0x0f47('0x49')],qs[_0x0f47('0x4b')](_0x16b19d[_0x0f47('0x46')][_0x0f47('0x4b')]));_0x3b64ff[_0x0f47('0x4a')]=_0x3b64ff[_0x0f47('0x4a')][_0x0f47('0x4c')]?_0x3b64ff['attributes']:_0x52121d['model'];_0x3b64ff[_0x0f47('0x4f')]=qs[_0x0f47('0x50')](_0x16b19d['query'][_0x0f47('0x50')]);_0x3b64ff['where']=qs['filters'](_[_0x0f47('0x52')](_0x16b19d[_0x0f47('0x46')],_0x52121d[_0x0f47('0x47')]));if(_0x16b19d['query']['filter']){_0x3b64ff[_0x0f47('0x51')]=_[_0x0f47('0x5d')](_0x3b64ff['where'],{'$or':_[_0x0f47('0x44')](_0x3b64ff[_0x0f47('0x4a')],function(_0x2ab0a5){var _0x18941e={};_0x18941e[_0x2ab0a5]={'$like':'%'+_0x16b19d[_0x0f47('0x46')][_0x0f47('0x53')]+'%'};return _0x18941e;})});}if(_0x16b19d['query'][_0x0f47('0x6f')]){var _0x20d82c=_0x16b19d['query'][_0x0f47('0x6f')][_0x0f47('0x70')](',');var _0x32de9b={};_0x32de9b[_0x20d82c[0x0]]={'$gte':moment(_0x20d82c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3b64ff[_0x0f47('0x51')]=_['merge'](_0x3b64ff['where'],_0x32de9b);}_0x3b64ff=_['merge']({},_0x3b64ff,_0x16b19d['options']);return _0x160f34[_0x0f47('0x6e')](_0x3b64ff);}})[_0x0f47('0x25')](function(_0x4871c6){if(_0x4871c6){_0x241023=_0x4871c6[_0x0f47('0x4c')];if(!_0x16b19d[_0x0f47('0x46')][_0x0f47('0x4d')](_0x0f47('0x4e'))){_0x3b64ff[_0x0f47('0x36')]=qs[_0x0f47('0x36')](_0x16b19d['query'][_0x0f47('0x36')]);_0x3b64ff[_0x0f47('0x35')]=qs[_0x0f47('0x35')](_0x16b19d[_0x0f47('0x46')]['offset']);}return _0x160f34[_0x0f47('0x6e')](_0x3b64ff);}})[_0x0f47('0x25')](function(_0x25705a){if(_0x25705a){return _0x25705a?{'count':_0x241023,'rows':_0x25705a}:null;}})[_0x0f47('0x25')](respondWithResult(_0x3b6620,null))[_0x0f47('0x59')](handleError(_0x3b6620,null));}; \ No newline at end of file +var _0x1bb4=['fields','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','getMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params'];(function(_0x599dcb,_0x1e4e79){var _0x5898c7=function(_0x381b02){while(--_0x381b02){_0x599dcb['push'](_0x599dcb['shift']());}};_0x5898c7(++_0x1e4e79);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x56a3fc,_0x2f5c06){_0x56a3fc=_0x56a3fc-0x0;var _0x4069f9=_0x1bb4[_0x56a3fc];return _0x4069f9;};'use strict';var pdf=require(_0x41bb('0x0'));var emlformat=require(_0x41bb('0x1'));var rimraf=require(_0x41bb('0x2'));var zipdir=require(_0x41bb('0x3'));var jsonpatch=require(_0x41bb('0x4'));var rp=require('request-promise');var moment=require(_0x41bb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x41bb('0x6'));var util=require('util');var path=require(_0x41bb('0x7'));var sox=require('sox');var csv=require(_0x41bb('0x8'));var ejs=require(_0x41bb('0x9'));var fs=require('fs');var _=require(_0x41bb('0xa'));var squel=require('squel');var crypto=require(_0x41bb('0xb'));var jsforce=require(_0x41bb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x41bb('0x8'));var querystring=require(_0x41bb('0xd'));var Papa=require(_0x41bb('0xe'));var Redis=require('ioredis');var authService=require(_0x41bb('0xf'));var qs=require(_0x41bb('0x10'));var as=require(_0x41bb('0x11'));var hardwareService=require(_0x41bb('0x12'));var logger=require(_0x41bb('0x13'))('api');var utils=require(_0x41bb('0x14'));var config=require(_0x41bb('0x15'));var licenseUtil=require(_0x41bb('0x16'));var db=require(_0x41bb('0x17'))['db'];config[_0x41bb('0x18')]=_[_0x41bb('0x19')](config[_0x41bb('0x18')],{'host':_0x41bb('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0x41bb('0x1b')](socket);var jayson=require(_0x41bb('0x1c'));var client=jayson[_0x41bb('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x514d8f,_0x18bf70,_0xa66c46,_0xfa8f14){return new BPromise(function(_0x2b3dbd,_0x358246){var _0x4a1687=_0xfa8f14||client;return _0x4a1687[_0x41bb('0x1e')](_0x514d8f,_0xa66c46)['then'](function(_0x1d2ead){logger[_0x41bb('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x18bf70,_0x41bb('0x20'));logger[_0x41bb('0x21')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x18bf70,'request\x20sent',JSON[_0x41bb('0x22')](_0x1d2ead));if(_0x1d2ead['error']){if(_0x1d2ead[_0x41bb('0x23')][_0x41bb('0x24')]===0x1f4){logger[_0x41bb('0x23')](_0x41bb('0x25'),_0x18bf70,_0x1d2ead[_0x41bb('0x23')][_0x41bb('0x26')]);return _0x358246(_0x1d2ead[_0x41bb('0x23')][_0x41bb('0x26')]);}logger[_0x41bb('0x23')](_0x41bb('0x25'),_0x18bf70,_0x1d2ead['error'][_0x41bb('0x26')]);return _0x2b3dbd(_0x1d2ead[_0x41bb('0x23')][_0x41bb('0x26')]);}else{logger[_0x41bb('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x18bf70,'request\x20sent');_0x2b3dbd(_0x1d2ead[_0x41bb('0x27')][_0x41bb('0x26')]);}})[_0x41bb('0x28')](function(_0x58c3f7){logger[_0x41bb('0x23')](_0x41bb('0x25'),_0x18bf70,_0x58c3f7);_0x358246(_0x58c3f7);});});}function respondWithStatusCode(_0x592239,_0x310f09){_0x310f09=_0x310f09||0xcc;return function(_0x5c09bf){if(_0x5c09bf){return _0x592239[_0x41bb('0x29')](_0x310f09);}return _0x592239[_0x41bb('0x2a')](_0x310f09)[_0x41bb('0x2b')]();};}function respondWithResult(_0x1ed303,_0x3d515e){_0x3d515e=_0x3d515e||0xc8;return function(_0x237817){if(_0x237817){return _0x1ed303[_0x41bb('0x2a')](_0x3d515e)[_0x41bb('0x2c')](_0x237817);}};}function respondWithFilteredResult(_0x3f28b0,_0x2ba1cd){return function(_0x430131){if(_0x430131){var _0x16b1f6=_0x430131[_0x41bb('0x2d')],_0x148ea5=_0x2ba1cd[_0x41bb('0x2e')],_0x4645c8=_0x2ba1cd[_0x41bb('0x2e')]+_0x2ba1cd[_0x41bb('0x2f')],_0x501f78;if(_0x4645c8>=_0x16b1f6){_0x4645c8=_0x16b1f6;_0x501f78=0xc8;}else{_0x501f78=0xce;}_0x3f28b0[_0x41bb('0x2a')](_0x501f78);return _0x3f28b0[_0x41bb('0x30')](_0x41bb('0x31'),_0x148ea5+'-'+_0x4645c8+'/'+_0x16b1f6)[_0x41bb('0x2c')](_0x430131);}return null;};}function patchUpdates(_0x3590d6){return function(_0x76c3c7){try{jsonpatch[_0x41bb('0x32')](_0x76c3c7,_0x3590d6,!![]);}catch(_0x7c3a3c){return BPromise[_0x41bb('0x33')](_0x7c3a3c);}return _0x76c3c7[_0x41bb('0x34')]();};}function saveUpdates(_0x142661,_0xfb737f){return function(_0x58eb96){if(_0x58eb96){return _0x58eb96[_0x41bb('0x35')](_0x142661)[_0x41bb('0x36')](function(_0x28faac){return _0x28faac;});}return null;};}function removeEntity(_0x7a9b34,_0x8df1f3){return function(_0xb2041a){if(_0xb2041a){return _0xb2041a[_0x41bb('0x37')]()['then'](function(){_0x7a9b34['status'](0xcc)[_0x41bb('0x2b')]();});}};}function handleEntityNotFound(_0xe7d034,_0x2ca65f){return function(_0x7c4fb2){if(!_0x7c4fb2){_0xe7d034[_0x41bb('0x29')](0x194);}return _0x7c4fb2;};}function handleError(_0x11f3c9,_0x346cbc){_0x346cbc=_0x346cbc||0x1f4;return function(_0x333738){logger['error'](_0x333738['stack']);if(_0x333738['name']){delete _0x333738[_0x41bb('0x38')];}_0x11f3c9[_0x41bb('0x2a')](_0x346cbc)[_0x41bb('0x39')](_0x333738);};}exports[_0x41bb('0x3a')]=function(_0x243ecd,_0x5b130a){var _0x233fa2={},_0x2293c7={},_0x463fd0={'count':0x0,'rows':[]};var _0x1a8a53=_[_0x41bb('0x3b')](db[_0x41bb('0x3c')][_0x41bb('0x3d')],function(_0x3ecb67){return{'name':_0x3ecb67[_0x41bb('0x3e')],'type':_0x3ecb67[_0x41bb('0x3f')]['key']};});_0x2293c7['model']=_['map'](_0x1a8a53,_0x41bb('0x38'));_0x2293c7[_0x41bb('0x40')]=_[_0x41bb('0x41')](_0x243ecd[_0x41bb('0x40')]);_0x2293c7['filters']=_[_0x41bb('0x42')](_0x2293c7[_0x41bb('0x43')],_0x2293c7['query']);_0x233fa2['attributes']=_[_0x41bb('0x42')](_0x2293c7[_0x41bb('0x43')],qs['fields'](_0x243ecd[_0x41bb('0x40')]['fields']));_0x233fa2[_0x41bb('0x44')]=_0x233fa2[_0x41bb('0x44')][_0x41bb('0x45')]?_0x233fa2[_0x41bb('0x44')]:_0x2293c7[_0x41bb('0x43')];if(!_0x243ecd[_0x41bb('0x40')][_0x41bb('0x46')](_0x41bb('0x47'))){_0x233fa2[_0x41bb('0x2f')]=qs[_0x41bb('0x2f')](_0x243ecd['query'][_0x41bb('0x2f')]);_0x233fa2[_0x41bb('0x2e')]=qs[_0x41bb('0x2e')](_0x243ecd['query'][_0x41bb('0x2e')]);}_0x233fa2[_0x41bb('0x48')]=qs[_0x41bb('0x49')](_0x243ecd['query'][_0x41bb('0x49')]);_0x233fa2[_0x41bb('0x4a')]=qs[_0x41bb('0x4b')](_[_0x41bb('0x4c')](_0x243ecd[_0x41bb('0x40')],_0x2293c7[_0x41bb('0x4b')]),_0x1a8a53);if(_0x243ecd[_0x41bb('0x40')][_0x41bb('0x4d')]){_0x233fa2['where']=_[_0x41bb('0x4e')](_0x233fa2[_0x41bb('0x4a')],{'$or':_[_0x41bb('0x3b')](_0x1a8a53,function(_0x520754){if(_0x520754[_0x41bb('0x3f')]!==_0x41bb('0x4f')){var _0x4034c1={};_0x4034c1[_0x520754[_0x41bb('0x38')]]={'$like':'%'+_0x243ecd[_0x41bb('0x40')][_0x41bb('0x4d')]+'%'};return _0x4034c1;}})});}_0x233fa2=_['merge']({},_0x233fa2,_0x243ecd['options']);var _0x4c5b15={'where':_0x233fa2[_0x41bb('0x4a')]};return db[_0x41bb('0x3c')][_0x41bb('0x2d')](_0x4c5b15)['then'](function(_0x595cb5){_0x463fd0['count']=_0x595cb5;if(_0x243ecd[_0x41bb('0x40')][_0x41bb('0x50')]){_0x233fa2[_0x41bb('0x51')]=[{'all':!![]}];}return db[_0x41bb('0x3c')][_0x41bb('0x52')](_0x233fa2);})[_0x41bb('0x36')](function(_0x4a72eb){_0x463fd0[_0x41bb('0x53')]=_0x4a72eb;return _0x463fd0;})[_0x41bb('0x36')](respondWithFilteredResult(_0x5b130a,_0x233fa2))[_0x41bb('0x28')](handleError(_0x5b130a,null));};exports['show']=function(_0x590f8f,_0x5d2e2e){var _0x1efcd1={'raw':!![],'where':{'id':_0x590f8f[_0x41bb('0x54')]['id']}},_0x2147b6={};_0x2147b6[_0x41bb('0x43')]=_[_0x41bb('0x41')](db['ChatGroup'][_0x41bb('0x3d')]);_0x2147b6[_0x41bb('0x40')]=_['keys'](_0x590f8f[_0x41bb('0x40')]);_0x2147b6[_0x41bb('0x4b')]=_[_0x41bb('0x42')](_0x2147b6['model'],_0x2147b6[_0x41bb('0x40')]);_0x1efcd1['attributes']=_[_0x41bb('0x42')](_0x2147b6['model'],qs[_0x41bb('0x55')](_0x590f8f[_0x41bb('0x40')]['fields']));_0x1efcd1[_0x41bb('0x44')]=_0x1efcd1['attributes']['length']?_0x1efcd1[_0x41bb('0x44')]:_0x2147b6[_0x41bb('0x43')];if(_0x590f8f[_0x41bb('0x40')]['includeAll']){_0x1efcd1[_0x41bb('0x51')]=[{'all':!![]}];}_0x1efcd1=_['merge']({},_0x1efcd1,_0x590f8f[_0x41bb('0x56')]);return db[_0x41bb('0x3c')][_0x41bb('0x57')](_0x1efcd1)['then'](handleEntityNotFound(_0x5d2e2e,null))['then'](respondWithResult(_0x5d2e2e,null))['catch'](handleError(_0x5d2e2e,null));};exports['create']=function(_0x27bd50,_0x19cd26){return db[_0x41bb('0x3c')][_0x41bb('0x58')](_0x27bd50['body'],{})[_0x41bb('0x36')](respondWithResult(_0x19cd26,0xc9))[_0x41bb('0x28')](handleError(_0x19cd26,null));};exports[_0x41bb('0x35')]=function(_0x3f407c,_0x336630){if(_0x3f407c[_0x41bb('0x59')]['id']){delete _0x3f407c['body']['id'];}return db[_0x41bb('0x3c')]['find']({'where':{'id':_0x3f407c[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x336630,null))[_0x41bb('0x36')](saveUpdates(_0x3f407c[_0x41bb('0x59')],null))[_0x41bb('0x36')](respondWithResult(_0x336630,null))[_0x41bb('0x28')](handleError(_0x336630,null));};exports[_0x41bb('0x37')]=function(_0xc7c4c,_0x1bae35){return db[_0x41bb('0x3c')][_0x41bb('0x57')]({'where':{'id':_0xc7c4c[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x1bae35,null))['then'](removeEntity(_0x1bae35,null))[_0x41bb('0x28')](handleError(_0x1bae35,null));};exports[_0x41bb('0x5a')]=function(_0x5cfa0f,_0xceb0df){return db[_0x41bb('0x3c')][_0x41bb('0x5a')]()['then'](respondWithResult(_0xceb0df,null))['catch'](handleError(_0xceb0df,null));};exports[_0x41bb('0x5b')]=function(_0xaa011c,_0xfc7c88,_0x34aa8a){return db[_0x41bb('0x5c')][_0x41bb('0x2d')]({'where':{'ChatGroupId':_0xaa011c[_0x41bb('0x54')]['id'],'ToId':_0xaa011c[_0x41bb('0x5d')]['id'],'read':![]}})[_0x41bb('0x36')](function(_0x103d28){return{'id':_[_0x41bb('0x5e')](_0xaa011c[_0x41bb('0x54')]['id']),'count':_0x103d28};})[_0x41bb('0x36')](respondWithResult(_0xfc7c88,null))[_0x41bb('0x28')](handleError(_0xfc7c88,null));};exports[_0x41bb('0x5f')]=function(_0x219e6c,_0xb083f0,_0x1aab5a){return db[_0x41bb('0x3c')][_0x41bb('0x57')]({'where':{'id':_0x219e6c[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0xb083f0,null))['then'](function(_0x5e6b79){if(_0x5e6b79){return _0x5e6b79[_0x41bb('0x5f')](_0x219e6c[_0x41bb('0x59')][_0x41bb('0x60')],_[_0x41bb('0x61')](_0x219e6c[_0x41bb('0x59')],['ids','id'])||{});}})[_0x41bb('0x36')](respondWithResult(_0xb083f0,null))[_0x41bb('0x28')](handleError(_0xb083f0,null));};exports['getMembers']=function(_0x215ef6,_0x58f1ce,_0x1ef3f2){var _0x103651={};var _0x16a281={};var _0x1422ea;var _0x250e59;return db[_0x41bb('0x3c')][_0x41bb('0x62')]({'where':{'id':_0x215ef6[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x58f1ce,null))[_0x41bb('0x36')](function(_0x12d23c){if(_0x12d23c){_0x1422ea=_0x12d23c;_0x16a281[_0x41bb('0x43')]=_[_0x41bb('0x41')](db[_0x41bb('0x63')]['rawAttributes']);_0x16a281[_0x41bb('0x40')]=_[_0x41bb('0x41')](_0x215ef6['query']);_0x16a281['filters']=_[_0x41bb('0x42')](_0x16a281[_0x41bb('0x43')],_0x16a281[_0x41bb('0x40')]);_0x103651[_0x41bb('0x44')]=_['intersection'](_0x16a281[_0x41bb('0x43')],qs[_0x41bb('0x55')](_0x215ef6[_0x41bb('0x40')]['fields']));_0x103651[_0x41bb('0x44')]=_0x103651['attributes'][_0x41bb('0x45')]?_0x103651[_0x41bb('0x44')]:_0x16a281['model'];_0x103651[_0x41bb('0x48')]=qs[_0x41bb('0x49')](_0x215ef6[_0x41bb('0x40')][_0x41bb('0x49')]);_0x103651[_0x41bb('0x4a')]=qs[_0x41bb('0x4b')](_[_0x41bb('0x4c')](_0x215ef6['query'],_0x16a281[_0x41bb('0x4b')]));if(_0x215ef6[_0x41bb('0x40')]['filter']){_0x103651[_0x41bb('0x4a')]=_['merge'](_0x103651[_0x41bb('0x4a')],{'$or':_[_0x41bb('0x3b')](_0x103651['attributes'],function(_0x3a1eb2){var _0x3a830a={};_0x3a830a[_0x3a1eb2]={'$like':'%'+_0x215ef6[_0x41bb('0x40')]['filter']+'%'};return _0x3a830a;})});}_0x103651=_[_0x41bb('0x4e')]({},_0x103651,_0x215ef6[_0x41bb('0x56')]);return _0x1422ea[_0x41bb('0x64')](_0x103651);}})['then'](function(_0xcd9ae6){if(_0xcd9ae6){_0x250e59=_0xcd9ae6[_0x41bb('0x45')];if(!_0x215ef6[_0x41bb('0x40')][_0x41bb('0x46')](_0x41bb('0x47'))){_0x103651['limit']=qs[_0x41bb('0x2f')](_0x215ef6['query'][_0x41bb('0x2f')]);_0x103651[_0x41bb('0x2e')]=qs[_0x41bb('0x2e')](_0x215ef6['query'][_0x41bb('0x2e')]);}return _0x1422ea['getMembers'](_0x103651);}})['then'](function(_0x4d0505){if(_0x4d0505){return _0x4d0505?{'count':_0x250e59,'rows':_0x4d0505}:null;}})['then'](respondWithResult(_0x58f1ce,null))[_0x41bb('0x28')](handleError(_0x58f1ce,null));};exports['removeMembers']=function(_0x41f287,_0x47194d,_0x5deb5d){return db['ChatGroup']['find']({'where':{'id':_0x41f287[_0x41bb('0x54')]['id']}})['then'](handleEntityNotFound(_0x47194d,null))['then'](function(_0x2068a2){if(_0x2068a2){return _0x2068a2['removeMembers'](_0x41f287[_0x41bb('0x40')][_0x41bb('0x60')]);}})['then'](respondWithStatusCode(_0x47194d,null))['catch'](handleError(_0x47194d,null));};exports[_0x41bb('0x65')]=function(_0xd7619,_0x42bd49,_0x289430){if(_0xd7619[_0x41bb('0x59')]['id']){delete _0xd7619[_0x41bb('0x59')]['id'];}return db[_0x41bb('0x3c')][_0x41bb('0x57')]({'where':{'id':_0xd7619[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x42bd49,null))[_0x41bb('0x36')](function(_0x3d8a3d){if(_0x3d8a3d){_0xd7619['body'][_0x41bb('0x66')]=_0x3d8a3d['id'];return db[_0x41bb('0x5c')][_0x41bb('0x58')](_0xd7619[_0x41bb('0x59')]);}})[_0x41bb('0x36')](respondWithResult(_0x42bd49,null))[_0x41bb('0x28')](handleError(_0x42bd49,null));};exports[_0x41bb('0x67')]=function(_0x23e66a,_0x13aec1,_0x6e988f){var _0x2a4df8={};var _0x1a1009={};var _0x4977eb;var _0x2de632;return db['ChatGroup'][_0x41bb('0x62')]({'where':{'id':_0x23e66a[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x13aec1,null))[_0x41bb('0x36')](function(_0x4c70d9){if(_0x4c70d9){_0x4977eb=_0x4c70d9;_0x1a1009[_0x41bb('0x43')]=_[_0x41bb('0x41')](db['ChatInternalMessage'][_0x41bb('0x3d')]);_0x1a1009[_0x41bb('0x40')]=_[_0x41bb('0x41')](_0x23e66a[_0x41bb('0x40')]);_0x1a1009[_0x41bb('0x4b')]=_[_0x41bb('0x42')](_0x1a1009['model'],_0x1a1009[_0x41bb('0x40')]);_0x2a4df8[_0x41bb('0x44')]=_['intersection'](_0x1a1009[_0x41bb('0x43')],qs[_0x41bb('0x55')](_0x23e66a[_0x41bb('0x40')]['fields']));_0x2a4df8['attributes']=_0x2a4df8['attributes'][_0x41bb('0x45')]?_0x2a4df8[_0x41bb('0x44')]:_0x1a1009['model'];_0x2a4df8[_0x41bb('0x48')]=qs[_0x41bb('0x49')](_0x23e66a['query'][_0x41bb('0x49')]);_0x2a4df8['where']=qs[_0x41bb('0x4b')](_[_0x41bb('0x4c')](_0x23e66a[_0x41bb('0x40')],_0x1a1009['filters']));if(_0x23e66a[_0x41bb('0x40')][_0x41bb('0x4d')]){_0x2a4df8['where']=_[_0x41bb('0x4e')](_0x2a4df8[_0x41bb('0x4a')],{'$or':_[_0x41bb('0x3b')](_0x2a4df8[_0x41bb('0x44')],function(_0x857e70){var _0x2d6c12={};_0x2d6c12[_0x857e70]={'$like':'%'+_0x23e66a[_0x41bb('0x40')][_0x41bb('0x4d')]+'%'};return _0x2d6c12;})});}if(_0x23e66a[_0x41bb('0x40')][_0x41bb('0x68')]){var _0x26205d=_0x23e66a['query'][_0x41bb('0x68')][_0x41bb('0x69')](',');var _0x31e373={};_0x31e373[_0x26205d[0x0]]={'$gte':moment(_0x26205d[0x1])[_0x41bb('0x6a')](_0x41bb('0x6b'))};_0x2a4df8[_0x41bb('0x4a')]=_[_0x41bb('0x4e')](_0x2a4df8[_0x41bb('0x4a')],_0x31e373);}_0x2a4df8=_[_0x41bb('0x4e')]({},_0x2a4df8,_0x23e66a['options']);return _0x4977eb['getMessages'](_0x2a4df8);}})[_0x41bb('0x36')](function(_0x758bed){if(_0x758bed){_0x2de632=_0x758bed[_0x41bb('0x45')];if(!_0x23e66a[_0x41bb('0x40')][_0x41bb('0x46')](_0x41bb('0x47'))){_0x2a4df8[_0x41bb('0x2f')]=qs[_0x41bb('0x2f')](_0x23e66a[_0x41bb('0x40')][_0x41bb('0x2f')]);_0x2a4df8[_0x41bb('0x2e')]=qs[_0x41bb('0x2e')](_0x23e66a['query']['offset']);}return _0x4977eb[_0x41bb('0x67')](_0x2a4df8);}})[_0x41bb('0x36')](function(_0x4c1b4b){if(_0x4c1b4b){return _0x4c1b4b?{'count':_0x2de632,'rows':_0x4c1b4b}:null;}})[_0x41bb('0x36')](respondWithResult(_0x13aec1,null))[_0x41bb('0x28')](handleError(_0x13aec1,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 04c087b..f90a064 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0xadb5,0xad));var _0x5adb=function(_0x307304,_0x2f7a94){_0x307304=_0x307304-0x0;var _0x3a94b8=_0xadb5[_0x307304];return _0x3a94b8;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x350d11,_0x49e715){var _0x68bb83=function(_0x48c74f){while(--_0x48c74f){_0x350d11['push'](_0x350d11['shift']());}};_0x68bb83(++_0x49e715);}(_0x5f2f,0x73));var _0xf5f2=function(_0x39f9f6,_0x3152c0){_0x39f9f6=_0x39f9f6-0x0;var _0x1f262e=_0x5f2f[_0x39f9f6];return _0x1f262e;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 1f4b071..5f84cb0 100644 --- a/server/api/chatGroup/chatGroup.model.js +++ b/server/api/chatGroup/chatGroup.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38d3=['define','ChatGroup','chat_groups','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x38d3,0x1a7));var _0x338d=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x38d3[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x338d('0x0'));var util=require(_0x338d('0x1'));var logger=require('../../config/logger')(_0x338d('0x2'));var moment=require(_0x338d('0x3'));var BPromise=require(_0x338d('0x4'));var rp=require(_0x338d('0x5'));var fs=require('fs');var path=require(_0x338d('0x6'));var rimraf=require(_0x338d('0x7'));var config=require(_0x338d('0x8'));var attributes=require(_0x338d('0x9'));module[_0x338d('0xa')]=function(_0x4e32b4,_0x2a056d){return _0x4e32b4[_0x338d('0xb')](_0x338d('0xc'),attributes,{'tableName':_0x338d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96aa=['request-promise','path','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','api','moment','bluebird'];(function(_0x2140a8,_0x22e3cd){var _0xbb816b=function(_0x3f8dfb){while(--_0x3f8dfb){_0x2140a8['push'](_0x2140a8['shift']());}};_0xbb816b(++_0x22e3cd);}(_0x96aa,0x67));var _0xa96a=function(_0x172029,_0x41a3cd){_0x172029=_0x172029-0x0;var _0x1bb677=_0x96aa[_0x172029];return _0x1bb677;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var logger=require('../../config/logger')(_0xa96a('0x2'));var moment=require(_0xa96a('0x3'));var BPromise=require(_0xa96a('0x4'));var rp=require(_0xa96a('0x5'));var fs=require('fs');var path=require(_0xa96a('0x6'));var rimraf=require('rimraf');var config=require(_0xa96a('0x7'));var attributes=require(_0xa96a('0x8'));module['exports']=function(_0x464684,_0x2e9a41){return _0x464684[_0xa96a('0x9')](_0xa96a('0xa'),attributes,{'tableName':_0xa96a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 7909a24..6937d00 100644 --- a/server/api/chatGroup/chatGroup.rpc.js +++ b/server/api/chatGroup/chatGroup.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e9b=['redis','defaults','localhost','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3e9b,0x95));var _0xb3e9=function(_0x2dda39,_0x331a81){_0x2dda39=_0x2dda39-0x0;var _0x2cfe3a=_0x3e9b[_0x2dda39];return _0x2cfe3a;};'use strict';var _=require(_0xb3e9('0x0'));var util=require(_0xb3e9('0x1'));var moment=require(_0xb3e9('0x2'));var BPromise=require(_0xb3e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3e9('0x4'));var db=require(_0xb3e9('0x5'))['db'];var utils=require(_0xb3e9('0x6'));var logger=require(_0xb3e9('0x7'))(_0xb3e9('0x8'));var config=require(_0xb3e9('0x9'));var jayson=require(_0xb3e9('0xa'));var client=jayson[_0xb3e9('0xb')][_0xb3e9('0xc')]({'port':0x232a});config[_0xb3e9('0xd')]=_[_0xb3e9('0xe')](config[_0xb3e9('0xd')],{'host':_0xb3e9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3e9('0xd')]));require(_0xb3e9('0x10'))[_0xb3e9('0x11')](socket);function respondWithRpcPromise(_0x3e827c,_0x1286b4,_0x39ec63){return new BPromise(function(_0x2f1d93,_0x45e442){return client[_0xb3e9('0x12')](_0x3e827c,_0x39ec63)[_0xb3e9('0x13')](function(_0xa154bb){logger['info'](_0xb3e9('0x14'),_0x1286b4,_0xb3e9('0x15'));logger['debug'](_0xb3e9('0x16'),_0x1286b4,_0xb3e9('0x15'),JSON['stringify'](_0xa154bb));if(_0xa154bb[_0xb3e9('0x17')]){if(_0xa154bb[_0xb3e9('0x17')]['code']===0x1f4){logger[_0xb3e9('0x17')](_0xb3e9('0x14'),_0x1286b4,_0xa154bb[_0xb3e9('0x17')][_0xb3e9('0x18')]);return _0x45e442(_0xa154bb['error'][_0xb3e9('0x18')]);}logger['error'](_0xb3e9('0x14'),_0x1286b4,_0xa154bb[_0xb3e9('0x17')][_0xb3e9('0x18')]);return _0x2f1d93(_0xa154bb['error'][_0xb3e9('0x18')]);}else{logger[_0xb3e9('0x19')](_0xb3e9('0x14'),_0x1286b4,_0xb3e9('0x15'));_0x2f1d93(_0xa154bb[_0xb3e9('0x1a')]['message']);}})['catch'](function(_0x53b4a5){logger['error'](_0xb3e9('0x14'),_0x1286b4,_0x53b4a5);_0x45e442(_0x53b4a5);});});} \ No newline at end of file +var _0x823b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x3d2580,_0x5bcf59){var _0x1bed34=function(_0x4838e5){while(--_0x4838e5){_0x3d2580['push'](_0x3d2580['shift']());}};_0x1bed34(++_0x5bcf59);}(_0x823b,0xb8));var _0xb823=function(_0x48e3fe,_0x5d2bf1){_0x48e3fe=_0x48e3fe-0x0;var _0x5c0e1e=_0x823b[_0x48e3fe];return _0x5c0e1e;};'use strict';var _=require('lodash');var util=require(_0xb823('0x0'));var moment=require(_0xb823('0x1'));var BPromise=require(_0xb823('0x2'));var rs=require(_0xb823('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb823('0x4'));var logger=require(_0xb823('0x5'))(_0xb823('0x6'));var config=require(_0xb823('0x7'));var jayson=require(_0xb823('0x8'));var client=jayson[_0xb823('0x9')][_0xb823('0xa')]({'port':0x232a});config[_0xb823('0xb')]=_[_0xb823('0xc')](config['redis'],{'host':_0xb823('0xd'),'port':0x18eb});var socket=require(_0xb823('0xe'))(new Redis(config[_0xb823('0xb')]));require(_0xb823('0xf'))['register'](socket);function respondWithRpcPromise(_0x3c6a42,_0x4258b5,_0x126221){return new BPromise(function(_0x5d61cc,_0x532fcb){return client[_0xb823('0x10')](_0x3c6a42,_0x126221)[_0xb823('0x11')](function(_0x3b391e){logger[_0xb823('0x12')]('ChatGroup,\x20%s,\x20%s',_0x4258b5,_0xb823('0x13'));logger[_0xb823('0x14')](_0xb823('0x15'),_0x4258b5,'request\x20sent',JSON['stringify'](_0x3b391e));if(_0x3b391e['error']){if(_0x3b391e[_0xb823('0x16')][_0xb823('0x17')]===0x1f4){logger['error'](_0xb823('0x18'),_0x4258b5,_0x3b391e[_0xb823('0x16')][_0xb823('0x19')]);return _0x532fcb(_0x3b391e[_0xb823('0x16')][_0xb823('0x19')]);}logger[_0xb823('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4258b5,_0x3b391e[_0xb823('0x16')]['message']);return _0x5d61cc(_0x3b391e[_0xb823('0x16')][_0xb823('0x19')]);}else{logger[_0xb823('0x12')](_0xb823('0x18'),_0x4258b5,_0xb823('0x13'));_0x5d61cc(_0x3b391e['result'][_0xb823('0x19')]);}})[_0xb823('0x1a')](function(_0x3f7494){logger[_0xb823('0x16')](_0xb823('0x18'),_0x4258b5,_0x3f7494);_0x532fcb(_0x3f7494);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index ce4cf3d..bbb331b 100644 --- a/server/api/chatGroup/chatGroup.socket.js +++ b/server/api/chatGroup/chatGroup.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5046=['./chatGroup.events','remove','emit','register','length','chatGroup:'];(function(_0xf848f2,_0x9bde0){var _0x4f383a=function(_0x1df091){while(--_0x1df091){_0xf848f2['push'](_0xf848f2['shift']());}};_0x4f383a(++_0x9bde0);}(_0x5046,0x132));var _0x6504=function(_0x119dfb,_0x1bacce){_0x119dfb=_0x119dfb-0x0;var _0x2130ae=_0x5046[_0x119dfb];return _0x2130ae;};'use strict';var ChatGroupEvents=require(_0x6504('0x0'));var events=['save',_0x6504('0x1'),'update'];function createListener(_0x5367f3,_0x355a51){return function(_0x4d6b88){_0x355a51[_0x6504('0x2')](_0x5367f3,_0x4d6b88);};}function removeListener(_0x501052,_0x5f5105){return function(){ChatGroupEvents['removeListener'](_0x501052,_0x5f5105);};}exports[_0x6504('0x3')]=function(_0x29262d){for(var _0x2fdf2b=0x0,_0x109352=events[_0x6504('0x4')];_0x2fdf2b<_0x109352;_0x2fdf2b++){var _0x22dadd=events[_0x2fdf2b];var _0x3c0c6c=createListener(_0x6504('0x5')+_0x22dadd,_0x29262d);ChatGroupEvents['on'](_0x22dadd,_0x3c0c6c);}}; \ No newline at end of file +var _0x9770=['remove','emit','removeListener','register','./chatGroup.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9770,0x12a));var _0x0977=function(_0x3b3e16,_0x1ffbff){_0x3b3e16=_0x3b3e16-0x0;var _0x473145=_0x9770[_0x3b3e16];return _0x473145;};'use strict';var ChatGroupEvents=require(_0x0977('0x0'));var events=[_0x0977('0x1'),_0x0977('0x2'),'update'];function createListener(_0x334796,_0x18c3a8){return function(_0x25ee21){_0x18c3a8[_0x0977('0x3')](_0x334796,_0x25ee21);};}function removeListener(_0x201b49,_0x5ce251){return function(){ChatGroupEvents[_0x0977('0x4')](_0x201b49,_0x5ce251);};}exports[_0x0977('0x5')]=function(_0x4afa39){for(var _0x370f1a=0x0,_0x2fb9ce=events['length'];_0x370f1a<_0x2fb9ce;_0x370f1a++){var _0x539401=events[_0x370f1a];var _0x3d28ab=createListener('chatGroup:'+_0x539401,_0x4afa39);ChatGroupEvents['on'](_0x539401,_0x3d28ab);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 39aa7e8..e410718 100644 --- a/server/api/chatGroup/index.js +++ b/server/api/chatGroup/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35df=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/messages','getMessages','create','post','/:id/members','addMembers','update','delete','exports','path','connect-timeout'];(function(_0x1c6d19,_0x314ca4){var _0x31a38a=function(_0x14421b){while(--_0x14421b){_0x1c6d19['push'](_0x1c6d19['shift']());}};_0x31a38a(++_0x314ca4);}(_0x35df,0x76));var _0xf35d=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x35df[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf35d('0x0'));var timeout=require(_0xf35d('0x1'));var express=require(_0xf35d('0x2'));var router=express[_0xf35d('0x3')]();var auth=require(_0xf35d('0x4'));var interaction=require(_0xf35d('0x5'));var config=require(_0xf35d('0x6'));var controller=require(_0xf35d('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf35d('0x8')]('/describe',auth[_0xf35d('0x9')](),controller[_0xf35d('0xa')]);router['get'](_0xf35d('0xb'),auth[_0xf35d('0x9')](),controller[_0xf35d('0xc')]);router[_0xf35d('0x8')](_0xf35d('0xd'),auth['isAuthenticated'](),controller[_0xf35d('0xe')]);router['get']('/:id/members',auth[_0xf35d('0x9')](),controller['getMembers']);router['get'](_0xf35d('0xf'),auth[_0xf35d('0x9')](),controller[_0xf35d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf35d('0x11')]);router[_0xf35d('0x12')](_0xf35d('0x13'),auth[_0xf35d('0x9')](),controller[_0xf35d('0x14')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['put']('/:id',auth[_0xf35d('0x9')](),controller[_0xf35d('0x15')]);router[_0xf35d('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xf35d('0x16')](_0xf35d('0x13'),auth[_0xf35d('0x9')](),controller['removeMembers']);module[_0xf35d('0x17')]=router; \ No newline at end of file +var _0x896e=['/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers','/:id/messages','put','update','delete','destroy','exports','multer','express','Router','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xc70b9d,_0x12b259){var _0x193ecf=function(_0x44bf4c){while(--_0x44bf4c){_0xc70b9d['push'](_0xc70b9d['shift']());}};_0x193ecf(++_0x12b259);}(_0x896e,0x120));var _0xe896=function(_0x4b6a7f,_0x5b8d25){_0x4b6a7f=_0x4b6a7f-0x0;var _0x5508af=_0x896e[_0x4b6a7f];return _0x5508af;};'use strict';var multer=require(_0xe896('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe896('0x1'));var router=express[_0xe896('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe896('0x3'));var controller=require(_0xe896('0x4'));router[_0xe896('0x5')]('/',auth[_0xe896('0x6')](),controller[_0xe896('0x7')]);router['get'](_0xe896('0x8'),auth[_0xe896('0x6')](),controller[_0xe896('0x9')]);router[_0xe896('0x5')](_0xe896('0xa'),auth[_0xe896('0x6')](),controller[_0xe896('0xb')]);router['get'](_0xe896('0xc'),auth[_0xe896('0x6')](),controller[_0xe896('0xd')]);router[_0xe896('0x5')](_0xe896('0xe'),auth[_0xe896('0x6')](),controller['getMembers']);router[_0xe896('0x5')]('/:id/messages',auth[_0xe896('0x6')](),controller[_0xe896('0xf')]);router[_0xe896('0x10')]('/',auth[_0xe896('0x6')](),controller[_0xe896('0x11')]);router[_0xe896('0x10')]('/:id/members',auth[_0xe896('0x6')](),controller[_0xe896('0x12')]);router[_0xe896('0x10')](_0xe896('0x13'),auth[_0xe896('0x6')](),controller['addMessage']);router[_0xe896('0x14')](_0xe896('0xa'),auth['isAuthenticated'](),controller[_0xe896('0x15')]);router[_0xe896('0x16')]('/:id',auth[_0xe896('0x6')](),controller[_0xe896('0x17')]);router[_0xe896('0x16')]('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module[_0xe896('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 1630f3d..7639b63 100644 --- a/server/api/chatInteraction/chatInteraction.attributes.js +++ b/server/api/chatInteraction/chatInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04ae=['DATE','out','exports','INTEGER','ENUM','TEXT','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x04ae,0x1e5));var _0xe04a=function(_0x5a53eb,_0x1a65c6){_0x5a53eb=_0x5a53eb-0x0;var _0x2fba4f=_0x04ae[_0x5a53eb];return _0x2fba4f;};'use strict';var Sequelize=require('sequelize');module[_0xe04a('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xe04a('0x1')]},'ratingType':{'type':Sequelize[_0xe04a('0x2')]('star','thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xe04a('0x3')]},'pathTranscript':{'type':Sequelize[_0xe04a('0x3')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe04a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe04a('0x4')]},'note':{'type':Sequelize[_0xe04a('0x4')]},'browserName':{'type':Sequelize[_0xe04a('0x4')]},'browserVersion':{'type':Sequelize[_0xe04a('0x4')]},'osName':{'type':Sequelize[_0xe04a('0x4')]},'osVersion':{'type':Sequelize[_0xe04a('0x4')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xe04a('0x4')]},'deviceType':{'type':Sequelize[_0xe04a('0x4')]},'referer':{'type':Sequelize[_0xe04a('0x3')]},'customerIp':{'type':Sequelize[_0xe04a('0x4')]},'formData':{'type':Sequelize[_0xe04a('0x3')]('long')},'read1stAt':{'type':Sequelize[_0xe04a('0x5')]},'lastMsgAt':{'type':Sequelize[_0xe04a('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xe04a('0x2')]('in',_0xe04a('0x6')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe04a('0x4')]},'customerPort':{'type':Sequelize[_0xe04a('0x4')]},'vidaooSessionId':{'type':Sequelize[_0xe04a('0x3')]}}; \ No newline at end of file +var _0xc94e=['long','DATE','out','BOOLEAN','ENUM','star','TEXT','STRING'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0xc94e,0x1f3));var _0xec94=function(_0x1a83ad,_0x59477e){_0x1a83ad=_0x1a83ad-0x0;var _0x3af492=_0xc94e[_0x1a83ad];return _0x3af492;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xec94('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xec94('0x1')]('star','thumb'),'defaultValue':_0xec94('0x2')},'ratingMessage':{'type':Sequelize[_0xec94('0x3')]},'pathTranscript':{'type':Sequelize[_0xec94('0x3')]},'mailTranscript':{'type':Sequelize[_0xec94('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xec94('0x4')]},'secondDisposition':{'type':Sequelize[_0xec94('0x4')]},'thirdDisposition':{'type':Sequelize[_0xec94('0x4')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xec94('0x4')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xec94('0x4')]},'deviceVendor':{'type':Sequelize[_0xec94('0x4')]},'deviceType':{'type':Sequelize[_0xec94('0x4')]},'referer':{'type':Sequelize[_0xec94('0x3')]},'customerIp':{'type':Sequelize[_0xec94('0x4')]},'formData':{'type':Sequelize[_0xec94('0x3')](_0xec94('0x5'))},'read1stAt':{'type':Sequelize[_0xec94('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xec94('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xec94('0x4')]},'vidaooSessionId':{'type':Sequelize[_0xec94('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 72263a4..ee41808 100644 --- a/server/api/chatInteraction/chatInteraction.controller.js +++ b/server/api/chatInteraction/chatInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fae=['Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','hasOwnProperty','includeAgent','addTags','setTags','removeTags','unix','server','tmp','files','Contact','firstName','lastName','attachments','Account','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Chat','YYYY-MM-DD','closedAt','disposition','osName','referer','customerIp','customerPort','existsSync','createReadStream','createWriteStream','out','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatInteraction.socket','register','client','http','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','index','ChatInteraction','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','nolimit','sort','where','pick','select','field','color','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','operator','value','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','UserId','buildExpression','text','body','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','clone','order','contactName','DESC','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','catch','params','filters','includeAll','options','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','ValidationError','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','update','closed','file','originalname','basename','filename','mimetype','Unauthorized','Attachment','attachId','download','root','close','mailTranscript','join','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','System','customer','Visitor','agentIdentifier','website_alias','alias','agentAlias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','sendMail'];(function(_0x405754,_0x2f76c5){var _0x2a76f6=function(_0x29a203){while(--_0x29a203){_0x405754['push'](_0x405754['shift']());}};_0x2a76f6(++_0x2f76c5);}(_0x6fae,0x15b));var _0xe6fa=function(_0x3aae99,_0x36b0c1){_0x3aae99=_0x3aae99-0x0;var _0x22bf2c=_0x6fae[_0x3aae99];return _0x22bf2c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6fa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6fa('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe6fa('0x2'));var Mustache=require(_0xe6fa('0x3'));var util=require(_0xe6fa('0x4'));var path=require('path');var sox=require(_0xe6fa('0x5'));var csv=require(_0xe6fa('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe6fa('0x7'));var squel=require(_0xe6fa('0x8'));var crypto=require(_0xe6fa('0x9'));var jsforce=require(_0xe6fa('0xa'));var deskjs=require(_0xe6fa('0xb'));var toCsv=require(_0xe6fa('0x6'));var querystring=require(_0xe6fa('0xc'));var Papa=require(_0xe6fa('0xd'));var Redis=require(_0xe6fa('0xe'));var authService=require(_0xe6fa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe6fa('0x10'));var hardwareService=require(_0xe6fa('0x11'));var logger=require(_0xe6fa('0x12'))(_0xe6fa('0x13'));var utils=require(_0xe6fa('0x14'));var config=require(_0xe6fa('0x15'));var licenseUtil=require(_0xe6fa('0x16'));var db=require(_0xe6fa('0x17'))['db'];config[_0xe6fa('0x18')]=_['defaults'](config[_0xe6fa('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe6fa('0x19'))(new Redis(config['redis']));require(_0xe6fa('0x1a'))[_0xe6fa('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe6fa('0x1c')][_0xe6fa('0x1d')]({'port':0x232b});var client9004=jayson[_0xe6fa('0x1c')][_0xe6fa('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x1d6eb0,_0x55b749,_0x3670ce,_0x3c88b5){return new BPromise(function(_0x1eb45e,_0x2dc570){var _0x577ae=_0x3c88b5||client;return _0x577ae['request'](_0x1d6eb0,_0x3670ce)['then'](function(_0x29a3a6){logger['info'](_0xe6fa('0x1e'),_0x55b749,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x55b749,_0xe6fa('0x1f'),JSON[_0xe6fa('0x20')](_0x29a3a6));if(_0x29a3a6[_0xe6fa('0x21')]){if(_0x29a3a6[_0xe6fa('0x21')][_0xe6fa('0x22')]===0x1f4){logger['error'](_0xe6fa('0x1e'),_0x55b749,_0x29a3a6['error'][_0xe6fa('0x23')]);return _0x2dc570(_0x29a3a6[_0xe6fa('0x21')][_0xe6fa('0x23')]);}logger[_0xe6fa('0x21')](_0xe6fa('0x1e'),_0x55b749,_0x29a3a6['error']['message']);return _0x1eb45e(_0x29a3a6[_0xe6fa('0x21')]['message']);}else{logger[_0xe6fa('0x24')](_0xe6fa('0x1e'),_0x55b749,'request\x20sent');_0x1eb45e(_0x29a3a6[_0xe6fa('0x25')]['message']);}})['catch'](function(_0x1c4f63){logger[_0xe6fa('0x21')](_0xe6fa('0x1e'),_0x55b749,_0x1c4f63);_0x2dc570(_0x1c4f63);});});}function respondWithStatusCode(_0x280d62,_0x47aba7){_0x47aba7=_0x47aba7||0xcc;return function(_0x3bfb57){if(_0x3bfb57){return _0x280d62[_0xe6fa('0x26')](_0x47aba7);}return _0x280d62[_0xe6fa('0x27')](_0x47aba7)[_0xe6fa('0x28')]();};}function respondWithResult(_0x1d5bf0,_0x398b72){_0x398b72=_0x398b72||0xc8;return function(_0x203d11){if(_0x203d11){return _0x1d5bf0[_0xe6fa('0x27')](_0x398b72)['json'](_0x203d11);}};}function respondWithFilteredResult(_0x6297ed,_0x16e0b7){return function(_0x555511){if(_0x555511){var _0x221fdb=_0x555511[_0xe6fa('0x29')],_0xe29d3e=_0x16e0b7[_0xe6fa('0x2a')],_0x391003=_0x16e0b7[_0xe6fa('0x2a')]+_0x16e0b7[_0xe6fa('0x2b')],_0x24d6d9;if(_0x391003>=_0x221fdb){_0x391003=_0x221fdb;_0x24d6d9=0xc8;}else{_0x24d6d9=0xce;}_0x6297ed[_0xe6fa('0x27')](_0x24d6d9);return _0x6297ed[_0xe6fa('0x2c')](_0xe6fa('0x2d'),_0xe29d3e+'-'+_0x391003+'/'+_0x221fdb)[_0xe6fa('0x2e')](_0x555511);}return null;};}function patchUpdates(_0x7a6030){return function(_0x4eb671){try{jsonpatch[_0xe6fa('0x2f')](_0x4eb671,_0x7a6030,!![]);}catch(_0x56295a){return BPromise[_0xe6fa('0x30')](_0x56295a);}return _0x4eb671[_0xe6fa('0x31')]();};}function saveUpdates(_0x26ccfd,_0x4e8bc7){return function(_0x2c1248){if(_0x2c1248){return _0x2c1248['update'](_0x26ccfd)[_0xe6fa('0x32')](function(_0x45ae6b){return _0x45ae6b;});}return null;};}function removeEntity(_0x564e3c,_0x2f4689){return function(_0xe83ef3){if(_0xe83ef3){return _0xe83ef3[_0xe6fa('0x33')]()[_0xe6fa('0x32')](function(){_0x564e3c[_0xe6fa('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8e94c1,_0xed48c9){return function(_0x800f3a){if(!_0x800f3a){_0x8e94c1[_0xe6fa('0x26')](0x194);}return _0x800f3a;};}function handleError(_0xefa3c8,_0x121e7c){_0x121e7c=_0x121e7c||0x1f4;return function(_0x53a7ba){logger['error'](_0x53a7ba[_0xe6fa('0x34')]);if(_0x53a7ba['name']){delete _0x53a7ba[_0xe6fa('0x35')];}_0xefa3c8[_0xe6fa('0x27')](_0x121e7c)[_0xe6fa('0x36')](_0x53a7ba);};}function getInteractionUsers(_0x3e835d,_0x38b3e1){return new BPromise(function(_0x3de68d,_0x24678d){try{if(_0x38b3e1[_0x3e835d['id']]){_0x3e835d[_0xe6fa('0x37')]=_[_0xe6fa('0x38')](_0x38b3e1[_0x3e835d['id']],function(_0x5f19a3){return{'id':_0x5f19a3['id'],'fullname':_0x5f19a3[_0xe6fa('0x39')]};});}}catch(_0x1a08ab){_0x24678d(_0x1a08ab);}_0x3de68d(_0x3e835d);});}function getInteractionTags(_0x21b158,_0x1a2202){return new BPromise(function(_0x263fdf,_0x30f97c){try{if(_0x21b158['TagIds']){_0x21b158['Tags']=[];_0x21b158[_0xe6fa('0x3a')][_0xe6fa('0x3b')](',')[_0xe6fa('0x3c')](function(_0x86f910){_0x21b158[_0xe6fa('0x3d')][_0xe6fa('0x3e')](_0x1a2202[_0x86f910]);});}delete _0x21b158[_0xe6fa('0x3a')];}catch(_0x4022cd){_0x30f97c(_0x4022cd);}_0x263fdf(_0x21b158);});}function updateChatInteraction(_0x5e6bf8,_0x5c42d0,_0x2f8dd4){return new BPromise(function(_0x27c703,_0x5c253c){return getInteractionUsers(_0x5e6bf8,_0x2f8dd4)['then'](function(_0x323f11){return getInteractionTags(_0x323f11,_0x5c42d0);})[_0xe6fa('0x32')](function(_0x3ec4b3){_0x27c703(_0x3ec4b3);})['catch'](function(_0x1645cc){_0x5c253c(_0x1645cc);});});}exports[_0xe6fa('0x3f')]=function(_0x48108e,_0x1d2e3b){var _0x510a4c={},_0x4fcb5d={},_0x598b2d={'count':0x0,'rows':[]};var _0x53f25a=_['map'](db[_0xe6fa('0x40')][_0xe6fa('0x41')],function(_0x2f59dd){return{'name':_0x2f59dd[_0xe6fa('0x42')],'type':_0x2f59dd[_0xe6fa('0x43')][_0xe6fa('0x44')]};});_0x4fcb5d['model']=_[_0xe6fa('0x38')](_0x53f25a,_0xe6fa('0x35'));_0x4fcb5d[_0xe6fa('0x45')]=_[_0xe6fa('0x46')](_0x48108e[_0xe6fa('0x45')]);_0x4fcb5d['filters']=_['intersection'](_0x4fcb5d[_0xe6fa('0x47')],_0x4fcb5d[_0xe6fa('0x45')]);_0x510a4c[_0xe6fa('0x48')]=_[_0xe6fa('0x49')](_0x4fcb5d[_0xe6fa('0x47')],qs['fields'](_0x48108e['query']['fields']));_0x510a4c[_0xe6fa('0x48')]=_0x510a4c[_0xe6fa('0x48')]['length']?_0x510a4c['attributes']:_0x4fcb5d['model'];if(!_0x48108e[_0xe6fa('0x45')]['hasOwnProperty'](_0xe6fa('0x4a'))){_0x510a4c[_0xe6fa('0x2b')]=qs[_0xe6fa('0x2b')](_0x48108e[_0xe6fa('0x45')][_0xe6fa('0x2b')]);_0x510a4c['offset']=qs[_0xe6fa('0x2a')](_0x48108e[_0xe6fa('0x45')][_0xe6fa('0x2a')]);}_0x510a4c['order']=qs['sort'](_0x48108e['query'][_0xe6fa('0x4b')]);_0x510a4c[_0xe6fa('0x4c')]=qs['filters'](_[_0xe6fa('0x4d')](_0x48108e[_0xe6fa('0x45')],_0x4fcb5d['filters']),_0x53f25a);var _0x4b99bb=[];var _0xaeb762=squel[_0xe6fa('0x4e')]()[_0xe6fa('0x4f')]('id')['field'](_0xe6fa('0x35'))[_0xe6fa('0x4f')](_0xe6fa('0x50'))['from']('tools_tags');var _0x36e7a7=squel[_0xe6fa('0x4e')]()['field'](_0xe6fa('0x51'))[_0xe6fa('0x4f')](_0xe6fa('0x52'))[_0xe6fa('0x4f')](_0xe6fa('0x53'))[_0xe6fa('0x54')](_0xe6fa('0x55'),'ui')['left_join'](_0xe6fa('0x56'),'u',_0xe6fa('0x57'));var _0x4b1f0e=squel[_0xe6fa('0x4e')]()['from'](_0xe6fa('0x58'),'i')[_0xe6fa('0x59')](_0xe6fa('0x5a'),'c',_0xe6fa('0x5b'))[_0xe6fa('0x59')](_0xe6fa('0x56'),'o',_0xe6fa('0x5c'))[_0xe6fa('0x59')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0xe6fa('0x59')]('chat_messages','me',_0xe6fa('0x5d'))[_0xe6fa('0x59')](_0xe6fa('0x5e'),'it',_0xe6fa('0x5f'))[_0xe6fa('0x59')](_0xe6fa('0x60'),'t',_0xe6fa('0x61'));var _0x284c29=squel[_0xe6fa('0x62')]();var _0x4a2b3b=[];var _0x5315ef=squel[_0xe6fa('0x62')]();var _0x492984;if(_0x48108e[_0xe6fa('0x45')][_0xe6fa('0x63')]){_0x492984=as[_0xe6fa('0x64')](_0x48108e[_0xe6fa('0x45')]['search']);var _0x43b9a2=_0x492984[_0xe6fa('0x65')];for(var _0x348ced=0x0;_0x348ced<_0x492984['conditions']['length'];_0x348ced++){var _0x592b72=_0x492984[_0xe6fa('0x66')][_0x348ced];var _0x48ef8b='i';var _0x14bf07=_[_0xe6fa('0x67')](_0x53f25a,[_0xe6fa('0x35'),_0x592b72[_0xe6fa('0x4f')]]);if(!_0x14bf07){switch(_0x592b72[_0xe6fa('0x4f')]){case _0xe6fa('0x68'):if(_0x592b72['value']==0x1){_0x4b1f0e[_0xe6fa('0x69')]('`'+_0x592b72[_0xe6fa('0x4f')]+'`\x20=\x200');}else{_0x4b1f0e['having']('`'+_0x592b72[_0xe6fa('0x4f')]+_0xe6fa('0x6a'));}break;case'Contact':if(_0x592b72[_0xe6fa('0x6b')]==='$substring'){if(_0x592b72[_0xe6fa('0x6c')][_0xe6fa('0x3b')]('\x20')[_0xe6fa('0x6d')]>0x1){_0x284c29[_0x43b9a2](_0xe6fa('0x6e'),qs[_0xe6fa('0x6f')](_0x592b72[_0xe6fa('0x6c')]),null);}else{var _0x2b4c86='%'+_0x592b72['value']+'%';_0x284c29[_0x43b9a2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2b4c86,_0x2b4c86,_0x2b4c86);}}else{_0x14bf07=_['find'](_0x53f25a,['name',_0xe6fa('0x70')]);_0x592b72[_0xe6fa('0x4f')]=_0xe6fa('0x70');_0x7ef425=as['buildExpression'](_0x48ef8b,_0x14bf07[_0xe6fa('0x43')],_0x592b72);_0x284c29[_0x43b9a2](_0x7ef425['text'],_0x7ef425['value'][_0xe6fa('0x71')],_0x7ef425['value'][_0xe6fa('0x28')]);}break;case _0xe6fa('0x72'):var _0x3009a4=_0x592b72[_0xe6fa('0x6c')][_0xe6fa('0x3b')](',')['map'](function(_0x1d2051){return Number(_0x1d2051);});_0x3009a4[_0xe6fa('0x3c')](function(_0x52ca02){_0x5315ef['or'](_0xe6fa('0x73'),'%,'+_0x52ca02+',%');});_0x4a2b3b=_['union'](_0x4a2b3b,_0x3009a4);break;case _0xe6fa('0x74'):if(_0x592b72['operator']===_0xe6fa('0x75')){_0x284c29[_0x43b9a2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x592b72[_0xe6fa('0x6c')]+'%',null);}else{_0x14bf07=_[_0xe6fa('0x67')](_0x53f25a,[_0xe6fa('0x35'),'UserId']);_0x592b72[_0xe6fa('0x4f')]=_0xe6fa('0x76');_0x7ef425=as[_0xe6fa('0x77')](_0x48ef8b,_0x14bf07[_0xe6fa('0x43')],_0x592b72);_0x284c29[_0x43b9a2](_0x7ef425[_0xe6fa('0x78')],_0x7ef425['value'][_0xe6fa('0x71')],_0x7ef425[_0xe6fa('0x6c')][_0xe6fa('0x28')]);}break;case _0xe6fa('0x79'):_0x7ef425=as[_0xe6fa('0x77')]('me',null,_0x592b72);_0x284c29[_0x43b9a2](_0x7ef425[_0xe6fa('0x78')],_0x7ef425[_0xe6fa('0x6c')][_0xe6fa('0x71')],_0x7ef425[_0xe6fa('0x6c')][_0xe6fa('0x28')]);break;}}else{var _0x7ef425=as['buildExpression'](_0x48ef8b,_0x14bf07[_0xe6fa('0x43')],_0x592b72);_0x284c29[_0x43b9a2](_0x7ef425[_0xe6fa('0x78')],_0x7ef425[_0xe6fa('0x6c')][_0xe6fa('0x71')],_0x7ef425[_0xe6fa('0x6c')][_0xe6fa('0x28')]);}}}else{var _0x15f2db=_(_0x48108e[_0xe6fa('0x45')])['keys']()[_0xe6fa('0x38')](function(_0x53c879){return _[_0xe6fa('0x7a')](_0x53f25a,['name',_0x53c879])?_0x53c879:undefined;})[_0xe6fa('0x7b')]()['value']();if(!_[_0xe6fa('0x7c')](_0x15f2db)){_0x15f2db['forEach'](function(_0x2b70be){if(_0x2b70be===_0xe6fa('0x7d')){_0x4b1f0e[_0xe6fa('0x4c')](_0xe6fa('0x7e'),[]['concat'](_0x48108e[_0xe6fa('0x45')][_0x2b70be]));}else if(_0x2b70be===_0xe6fa('0x7f')){var _0x54a1ac=JSON['parse'](_0x48108e[_0xe6fa('0x45')][_0x2b70be])[_0xe6fa('0x80')];var _0x4b0524=JSON['parse'](_0x48108e['query'][_0x2b70be])[_0xe6fa('0x81')];_0x4b1f0e[_0xe6fa('0x4c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x54a1ac,_0x4b0524);}else{if(_0x48108e[_0xe6fa('0x45')][_0x2b70be]==='null'){_0x4b1f0e[_0xe6fa('0x4c')]('i.'+_0x2b70be+_0xe6fa('0x82'));}else{_0x4b1f0e[_0xe6fa('0x4c')]('i.'+_0x2b70be+_0xe6fa('0x83'),_0x48108e[_0xe6fa('0x45')][_0x2b70be]);}}});}if(_0x48108e['query'][_0xe6fa('0x84')]){if(_0x48108e[_0xe6fa('0x45')]['read']==0x1){_0x4b1f0e[_0xe6fa('0x69')](_0xe6fa('0x85'));}else{_0x4b1f0e[_0xe6fa('0x69')]('`unreadMessages`\x20>\x200');}}if(_0x48108e['query']['tag']){_0x4a2b3b=_[_0xe6fa('0x86')](_0x48108e[_0xe6fa('0x45')][_0xe6fa('0x87')])?_0x48108e[_0xe6fa('0x45')][_0xe6fa('0x87')]:new Array(_0x48108e[_0xe6fa('0x45')]['tag']);_0x4a2b3b[_0xe6fa('0x3c')](function(_0x2e22f7){_0x5315ef['or'](_0xe6fa('0x73'),'%,'+_0x2e22f7+',%');});}if(_0x48108e[_0xe6fa('0x45')][_0xe6fa('0x88')]){var _0x24b81d=_0x48108e[_0xe6fa('0x45')][_0xe6fa('0x88')][_0xe6fa('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe6fa('0x8a')](_0x24b81d)){_0x284c29['or'](_0xe6fa('0x8b'),_0x24b81d+'%');}else{_0x284c29['or'](_0xe6fa('0x8c'),qs['getFullTextValue'](_0x24b81d))['or'](_0xe6fa('0x8d'),_0x24b81d+'%');}}}_0x4b1f0e[_0xe6fa('0x4c')](_0x284c29);_0x4b1f0e[_0xe6fa('0x8e')]('i.id');var _0x37e9ad={'type':db['Sequelize']['QueryTypes'][_0xe6fa('0x8f')],'raw':!![]};var _0x47096a=_0x4b1f0e[_0xe6fa('0x90')]();_0x47096a[_0xe6fa('0x4f')]('i.id');_0x47096a[_0xe6fa('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe6fa('0x68'));if(_0x510a4c[_0xe6fa('0x91')]){_0x510a4c[_0xe6fa('0x91')][_0xe6fa('0x3c')](function(_0x119636){var _0x436f62=_0x119636[0x0]===_0xe6fa('0x92')?_0x119636[0x0]:'i.'+_0x119636[0x0];_0x4b1f0e[_0xe6fa('0x91')](_0x436f62,_0x119636[0x1]===_0xe6fa('0x93')?![]:!![]);});}if(!_[_0xe6fa('0x7c')](_0x4a2b3b)){_0x4b1f0e[_0xe6fa('0x69')](_0x5315ef);_0x47096a[_0xe6fa('0x4c')]('t.id\x20IN\x20?',_0x4a2b3b);}BPromise[_0xe6fa('0x94')]()[_0xe6fa('0x32')](function(){if(!_0x492984){if(_0x48108e['query']['ChatWebsiteId']||_0x48108e[_0xe6fa('0x45')][_0xe6fa('0x95')])return;_0x47096a['where'](_0xe6fa('0x96'));_0x4b1f0e[_0xe6fa('0x4c')](_0xe6fa('0x96'));return;}if(_0x48108e[_0xe6fa('0x97')]['role']!=='agent')return;return _0x48108e[_0xe6fa('0x97')][_0xe6fa('0x98')]({'attributes':['id'],'raw':!![]})[_0xe6fa('0x32')](function(_0x1a8ab1){if(_[_0xe6fa('0x7c')](_0x1a8ab1)){_0x47096a[_0xe6fa('0x4c')](_0xe6fa('0x99'));_0x4b1f0e[_0xe6fa('0x4c')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x47096a[_0xe6fa('0x4c')](_0xe6fa('0x7e'),_['map'](_0x1a8ab1,'id'));_0x4b1f0e['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xe6fa('0x38')](_0x1a8ab1,'id'));}});})[_0xe6fa('0x32')](function(){if(_0x48108e[_0xe6fa('0x97')][_0xe6fa('0x9a')]===_0xe6fa('0x9b')&&!_0x492984&&!_0x48108e[_0xe6fa('0x45')][_0xe6fa('0x7d')])return[];return db[_0xe6fa('0x9c')][_0xe6fa('0x45')](_0x47096a[_0xe6fa('0x9d')](),_0x37e9ad);})['then'](function(_0x9a0c81){_0x598b2d[_0xe6fa('0x29')]=_0x9a0c81['length'];if(_0x598b2d[_0xe6fa('0x29')]===0x0)return[];return db[_0xe6fa('0x9c')][_0xe6fa('0x45')](_0xaeb762['toString'](),_0x37e9ad)[_0xe6fa('0x32')](function(_0x3b54b9){_0x4b99bb=_[_0xe6fa('0x9e')](_0x3b54b9,'id');_0x37e9ad=_[_0xe6fa('0x9f')](_0x37e9ad,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48108e['query'][_0xe6fa('0xa0')]){_0x510a4c[_0xe6fa('0x48')][_0xe6fa('0x3c')](function(_0x2c6121){_0x4b1f0e[_0xe6fa('0x4f')]('i.'+_0x2c6121);});}else{_0x4b1f0e['field'](_0xe6fa('0xa1'),_0xe6fa('0x68'));_0x4b1f0e[_0xe6fa('0x4f')](_0xe6fa('0xa2'),_0xe6fa('0xa3'));_0x4b1f0e[_0xe6fa('0x4f')](_0xe6fa('0xa4'),_0xe6fa('0xa5'));_0x4b1f0e['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xe6fa('0x92'));_0x4b1f0e[_0xe6fa('0x4f')]('i.*');_0x4b1f0e[_0xe6fa('0x4f')](_0xe6fa('0xa6'),_0xe6fa('0xa7'));_0x4b1f0e[_0xe6fa('0x4f')](_0xe6fa('0xa8'),_0xe6fa('0xa9'));_0x4b1f0e[_0xe6fa('0x4f')](_0xe6fa('0xaa'),_0xe6fa('0xab'));_0x4b1f0e['field'](_0xe6fa('0xac'),_0xe6fa('0xad'));_0x4b1f0e['field']('c.mobile','Contact.mobile');_0x4b1f0e[_0xe6fa('0x4f')](_0xe6fa('0xae'),'Contact.fax');_0x4b1f0e[_0xe6fa('0x4f')](_0xe6fa('0xaf'),_0xe6fa('0xb0'));_0x4b1f0e['field'](_0xe6fa('0xb1'),_0xe6fa('0xb2'));_0x4b1f0e[_0xe6fa('0x4f')](_0xe6fa('0xb3'),'TagIds');}if(_0x510a4c['limit'])_0x4b1f0e['limit'](_0x510a4c[_0xe6fa('0x2b')]);if(_0x510a4c[_0xe6fa('0x2a')])_0x4b1f0e['offset'](_0x510a4c[_0xe6fa('0x2a')]);return db[_0xe6fa('0x9c')][_0xe6fa('0x45')](_0x4b1f0e[_0xe6fa('0x9d')](),_0x37e9ad);})['then'](function(_0x27a12){_0x36e7a7[_0xe6fa('0x4c')](_0xe6fa('0xb4'),_[_0xe6fa('0x38')](_0x27a12,'id'));return db['sequelize'][_0xe6fa('0x45')](_0x36e7a7[_0xe6fa('0x9d')](),_0x37e9ad)['then'](function(_0x1b3bf7){var _0x16fc04=_[_0xe6fa('0xb5')](_0x1b3bf7,_0xe6fa('0xb6'));var _0xcec9cc=[];_0x27a12[_0xe6fa('0x3c')](function(_0x16a4fe){_0xcec9cc['push'](updateChatInteraction(_0x16a4fe,_0x4b99bb,_0x16fc04));});return BPromise[_0xe6fa('0xb7')](_0xcec9cc);});});})[_0xe6fa('0x32')](function(_0x4baf00){_0x598b2d[_0xe6fa('0xb8')]=_0x4baf00;return _0x598b2d;})[_0xe6fa('0x32')](respondWithFilteredResult(_0x1d2e3b,_0x510a4c))[_0xe6fa('0xb9')](handleError(_0x1d2e3b,null));};exports['show']=function(_0x55bf71,_0x23d8d4){var _0x38471f={'raw':![],'where':{'id':_0x55bf71[_0xe6fa('0xba')]['id']}},_0x46d7b6={};_0x46d7b6[_0xe6fa('0x47')]=_['keys'](db[_0xe6fa('0x40')]['rawAttributes']);_0x46d7b6[_0xe6fa('0x45')]=_['keys'](_0x55bf71[_0xe6fa('0x45')]);_0x46d7b6[_0xe6fa('0xbb')]=_[_0xe6fa('0x49')](_0x46d7b6['model'],_0x46d7b6[_0xe6fa('0x45')]);_0x38471f[_0xe6fa('0x48')]=_[_0xe6fa('0x49')](_0x46d7b6['model'],qs[_0xe6fa('0xa0')](_0x55bf71[_0xe6fa('0x45')]['fields']));_0x38471f[_0xe6fa('0x48')]=_0x38471f[_0xe6fa('0x48')][_0xe6fa('0x6d')]?_0x38471f[_0xe6fa('0x48')]:_0x46d7b6[_0xe6fa('0x47')];if(_0x55bf71['query'][_0xe6fa('0xbc')]){_0x38471f['include']=[{'all':!![]}];}_0x38471f=_['merge']({},_0x38471f,_0x55bf71[_0xe6fa('0xbd')]);return db[_0xe6fa('0x40')][_0xe6fa('0x67')](_0x38471f)['then'](handleEntityNotFound(_0x23d8d4,null))[_0xe6fa('0x32')](respondWithResult(_0x23d8d4,null))['catch'](handleError(_0x23d8d4,null));};exports['create']=function(_0x1a4a42,_0x2b2752){return db[_0xe6fa('0x40')][_0xe6fa('0xbe')](_0x1a4a42[_0xe6fa('0x79')],{})[_0xe6fa('0x32')](respondWithResult(_0x2b2752,0xc9))['catch'](handleError(_0x2b2752,null));};exports['update']=function(_0x4cc573,_0x43dcc9){if(_0x4cc573[_0xe6fa('0x79')]['id']){delete _0x4cc573[_0xe6fa('0x79')]['id'];}return db[_0xe6fa('0x40')][_0xe6fa('0x67')]({'where':{'id':_0x4cc573[_0xe6fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x43dcc9,null))[_0xe6fa('0x32')](saveUpdates(_0x4cc573['body'],null))['then'](respondWithResult(_0x43dcc9,null))[_0xe6fa('0xb9')](handleError(_0x43dcc9,null));};exports[_0xe6fa('0x33')]=function(_0x4de134,_0x5ecfaf){return db[_0xe6fa('0x40')][_0xe6fa('0x67')]({'where':{'id':_0x4de134[_0xe6fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x5ecfaf,null))[_0xe6fa('0x32')](removeEntity(_0x5ecfaf,null))[_0xe6fa('0xb9')](handleError(_0x5ecfaf,null));};exports[_0xe6fa('0xbf')]=function(_0x12ea16,_0x38da3a){return db[_0xe6fa('0x40')][_0xe6fa('0xbf')]()[_0xe6fa('0x32')](respondWithResult(_0x38da3a,null))[_0xe6fa('0xb9')](handleError(_0x38da3a,null));};exports['createVidaooSession']=function(_0x31f2ba,_0x53c2b4){var _0x5991ba=_0x31f2ba['params']['id'];var _0x295ee4;var _0x37df08;var _0x97e7ce;return db['ChatInteraction'][_0xe6fa('0xc0')]({'where':{'id':_0x5991ba}})[_0xe6fa('0x32')](function(_0x104ec7){_0x295ee4=_0x104ec7;return db[_0xe6fa('0xc1')][_0xe6fa('0xc0')]({'where':{'id':_0x104ec7[_0xe6fa('0x7d')]},'attributes':['id',_0xe6fa('0xc2'),_0xe6fa('0xc3')],'raw':!![]});})[_0xe6fa('0x32')](function(_0x4f4bdf){if(_0x4f4bdf&&_0x4f4bdf['vidaooApiKey']&&_0x4f4bdf[_0xe6fa('0xc3')]){_0x37df08=_0x4f4bdf;var _0x2571e5={'rejectUnauthorized':![],'method':_0xe6fa('0xc4'),'uri':_0xe6fa('0xc5'),'headers':{'X-APIKEY':_0x4f4bdf['vidaooApiKey']},'body':{'name':_0xe6fa('0xc6')+_0x5991ba},'redirect':_0xe6fa('0xc7'),'json':!![]};return rp(_0x2571e5);}else{throw new db[(_0xe6fa('0xc8'))]['ValidationError'](_0xe6fa('0xc9'));}})[_0xe6fa('0x32')](function(_0x5d4912){_0x97e7ce=_0x5d4912;if(_0x97e7ce['id']){var _0x47b412={'body':_0x97e7ce[_0xe6fa('0xca')],'ChatWebsiteId':_0x37df08['id'],'ChatInteractionId':_0x295ee4['id'],'direction':'out','UserId':_0x31f2ba[_0xe6fa('0x97')]['id']};return db['ChatMessage'][_0xe6fa('0xbe')](_0x47b412,{});}else{throw new db[(_0xe6fa('0xc8'))][(_0xe6fa('0xcb'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xe6fa('0x32')](function(){return _0x295ee4[_0xe6fa('0xcc')]({'vidaooSessionId':_0x97e7ce['id']});})[_0xe6fa('0x32')](respondWithResult(_0x53c2b4,null))['catch'](handleError(_0x53c2b4,null));};exports[_0xe6fa('0xcd')]=function(_0x443207,_0x2ddf77){if(_0x443207[_0xe6fa('0x79')]['id']){delete _0x443207[_0xe6fa('0x79')]['id'];}return db[_0xe6fa('0x40')][_0xe6fa('0x67')]({'where':{'id':_0x443207['params']['id']}})[_0xe6fa('0x32')](handleEntityNotFound(_0x2ddf77,null))[_0xe6fa('0x32')](saveUpdates(_0x443207[_0xe6fa('0x79')],null))[_0xe6fa('0x32')](respondWithResult(_0x2ddf77,null))[_0xe6fa('0xb9')](handleError(_0x2ddf77,null));};exports[_0xe6fa('0xce')]=function(_0xaa7bba,_0x511725,_0x330e1c){if(_0xaa7bba[_0xe6fa('0x79')]['id']){delete _0xaa7bba[_0xe6fa('0x79')]['id'];}return db[_0xe6fa('0x40')]['find']({'where':{'id':_0xaa7bba[_0xe6fa('0xba')]['id']}})[_0xe6fa('0x32')](function(_0x427d6c){if(!_0x427d6c){logger[_0xe6fa('0x21')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xe6fa('0xce'),0x194,_0xe6fa('0xcf'));_0x511725[_0xe6fa('0x26')](0x194);}else{if(_0x427d6c[_0xe6fa('0x76')]){throw new db[(_0xe6fa('0xc8'))][(_0xe6fa('0xcb'))](_0xe6fa('0xd0'));}}return _0x427d6c;})['then'](function(_0x53e62b){if(_0x53e62b){return _0x53e62b[_0xe6fa('0xd1')]({'closed':_0xaa7bba[_0xe6fa('0x79')][_0xe6fa('0xd2')],'disposition':_0xaa7bba[_0xe6fa('0x79')]['disposition']})[_0xe6fa('0x32')](function(_0x43284e){return _0x43284e;});}})['then'](function(_0x567479){return respondWithRpcPromise('AbandonInteraction',_0xe6fa('0xce'),_0xaa7bba[_0xe6fa('0x79')],client9004);})[_0xe6fa('0x32')](respondWithResult(_0x511725,null))[_0xe6fa('0xb9')](handleError(_0x511725,null));};exports['attachmentUpload']=function(_0x24f82c,_0x5321a9,_0x52c03d){_0x24f82c['body'][_0xe6fa('0x35')]=_0x24f82c[_0xe6fa('0xd3')][_0xe6fa('0xd4')];_0x24f82c[_0xe6fa('0x79')][_0xe6fa('0xd5')]=_0x24f82c[_0xe6fa('0xd3')][_0xe6fa('0xd6')];_0x24f82c['body'][_0xe6fa('0x43')]=_0x24f82c[_0xe6fa('0xd3')][_0xe6fa('0xd7')];return db['Attachment']['create'](_0x24f82c[_0xe6fa('0x79')])[_0xe6fa('0x32')](respondWithResult(_0x5321a9,0xc9))[_0xe6fa('0xb9')](handleError(_0x5321a9,null));};exports['attachmentDownload']=function(_0x1d480c,_0x2dffcb,_0x376a78){return db[_0xe6fa('0x40')][_0xe6fa('0xc0')]({'where':{'id':_0x1d480c[_0xe6fa('0xba')]['id']},'raw':!![]})[_0xe6fa('0x32')](handleEntityNotFound(_0x2dffcb,null))['then'](function(_0x1e3d94){if(_0x1e3d94){if(_0x1e3d94[_0xe6fa('0xd2')]){return _0x2dffcb[_0xe6fa('0x27')](0x193)[_0xe6fa('0x2e')]({'status':0x193,'message':_0xe6fa('0xd8')});}return db[_0xe6fa('0xd9')][_0xe6fa('0xc0')]({'where':{'id':_0x1d480c[_0xe6fa('0x45')][_0xe6fa('0xda')]},'raw':!![]})[_0xe6fa('0x32')](handleEntityNotFound(_0x2dffcb,null));}})['then'](function(_0x4d7fdf){if(_0x4d7fdf){return _0x2dffcb[_0xe6fa('0xdb')](path['join'](config[_0xe6fa('0xdc')],'server/files/attachments/',_0x4d7fdf[_0xe6fa('0xd5')]));}})[_0xe6fa('0xb9')](handleError(_0x2dffcb,null));};exports[_0xe6fa('0xdd')]=function(_0x3061ee,_0x24c044){var _0x23b826=null;var _0x1edfbe=null;var _0x48f7b1=null;var _0x2e1de6=null;if(_0x3061ee['body']['id']){delete _0x3061ee[_0xe6fa('0x79')]['id'];}if(_0x3061ee[_0xe6fa('0x79')][_0xe6fa('0xde')]){_0x2e1de6=path[_0xe6fa('0xdf')](config[_0xe6fa('0xdc')],_0xe6fa('0xe0'),util[_0xe6fa('0xe1')](_0xe6fa('0xe2'),Date[_0xe6fa('0xe3')]()));_0x3061ee[_0xe6fa('0x79')][_0xe6fa('0xe4')]=_0x2e1de6;}return db[_0xe6fa('0x40')][_0xe6fa('0x67')]({'where':{'id':_0x3061ee[_0xe6fa('0xba')]['id']},'include':[{'model':db[_0xe6fa('0xe5')],'as':_0xe6fa('0xe6'),'include':[{'model':db[_0xe6fa('0x74')],'as':_0xe6fa('0x74')}]}]})[_0xe6fa('0x32')](handleEntityNotFound(_0x24c044,null))[_0xe6fa('0x32')](saveUpdates(_0x3061ee[_0xe6fa('0x79')],null))['then'](function(_0x3a1e8e){if(_0x3a1e8e){_0x23b826=_0x3a1e8e;return db[_0xe6fa('0xc1')][_0xe6fa('0x67')]({'where':{'id':_0x23b826[_0xe6fa('0x7d')]}});}})[_0xe6fa('0x32')](function(_0x5c99dd){if(_0x5c99dd){_0x48f7b1=_0x5c99dd;return db[_0xe6fa('0xe7')]['find']({'where':{'id':_0x23b826[_0xe6fa('0x70')]}});}})[_0xe6fa('0x32')](function(_0x4f36c6){if(_0x4f36c6){_0x1edfbe=_0x4f36c6;if(_0x2e1de6){var _0x370bc9=null;for(var _0x4e457c=0x1;_0x4e457c<_0x23b826[_0xe6fa('0xe6')]['length'];++_0x4e457c){_0x370bc9=_0x23b826[_0xe6fa('0xe6')][_0x4e457c];var _0xee8c1e=_0x370bc9[_0xe6fa('0x76')]?util[_0xe6fa('0xe1')]('%s%d',_0x48f7b1['agentAlias'],_0x370bc9[_0xe6fa('0x76')]):_0xe6fa('0xe8');var _0x46acf2=_0x3061ee['body'][_0xe6fa('0xe9')]||util[_0xe6fa('0xe1')]('%s%d',_0xe6fa('0xea'),_0x370bc9[_0xe6fa('0x70')]);switch(_0x48f7b1[_0xe6fa('0xeb')]){case _0xe6fa('0xec'):_0xee8c1e=_0x370bc9[_0xe6fa('0x76')]?util[_0xe6fa('0xe1')]('%s%d',_0x48f7b1['agentAlias'],_0x370bc9[_0xe6fa('0x76')]):'System';break;case'agent_alias':_0xee8c1e=_0x370bc9[_0xe6fa('0x76')]?_0x370bc9[_0xe6fa('0x74')][_0xe6fa('0xed')]||_0x370bc9[_0xe6fa('0x74')]['fullname']:_0xe6fa('0xe8');break;case'agent_fullname':_0xee8c1e=_0x370bc9[_0xe6fa('0x76')]?_0x370bc9['User']['fullname']:_0xe6fa('0xe8');break;default:_0xee8c1e=_0x370bc9[_0xe6fa('0x76')]?util[_0xe6fa('0xe1')]('%s%d',_0x48f7b1[_0xe6fa('0xee')],_0x370bc9['UserId']):'System';}var _0x54cdde=util[_0xe6fa('0xe1')](_0xe6fa('0xef'),moment(_0x370bc9[_0xe6fa('0x7f')])[_0xe6fa('0xe1')](_0xe6fa('0xf0')),_0x370bc9[_0xe6fa('0xf1')]==='in'?_0x46acf2:_0xee8c1e,_0x370bc9[_0xe6fa('0x79')]);if(!_0x370bc9[_0xe6fa('0xf2')]){fs[_0xe6fa('0xf3')](_0x2e1de6,_0x54cdde);}}return db[_0xe6fa('0xf4')][_0xe6fa('0xc0')]({'where':{'service':!![]},'include':[{'model':db[_0xe6fa('0xf5')],'as':_0xe6fa('0xf6'),'raw':!![]}]});}}})[_0xe6fa('0x32')](function(_0x4fc1da){if(_0x4fc1da&&_0x4fc1da['Smtp']&&_0x3061ee[_0xe6fa('0x79')]){var _0xbcd62e={'tls':{'rejectUnauthorized':![]}};if(_0x4fc1da['Smtp'][_0xe6fa('0xf7')]){_0xbcd62e[_0xe6fa('0xf7')]=_0x4fc1da[_0xe6fa('0xf6')][_0xe6fa('0xf7')];}else{_0xbcd62e[_0xe6fa('0xf8')]=_0x4fc1da[_0xe6fa('0xf6')]['host'];_0xbcd62e[_0xe6fa('0xf9')]=_0x4fc1da[_0xe6fa('0xf6')][_0xe6fa('0xf9')];_0xbcd62e[_0xe6fa('0xfa')]=_0x4fc1da[_0xe6fa('0xf6')][_0xe6fa('0xfa')];}if(_0x4fc1da['Smtp']['authentication']){_0xbcd62e['auth']={'user':_0x4fc1da[_0xe6fa('0xf6')][_0xe6fa('0x97')],'pass':_0x4fc1da['Smtp'][_0xe6fa('0xfb')]};}return respondWithRpcPromise('SendMail',_0xe6fa('0xfc'),{'account':_0xbcd62e,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4fc1da[_0xe6fa('0x35')],_0x4fc1da['email']||_0x4fc1da[_0xe6fa('0xf6')][_0xe6fa('0x97')]),'to':_0x3061ee[_0xe6fa('0x79')][_0xe6fa('0xde')],'subject':_0xe6fa('0xfd'),'text':util['format'](_0xe6fa('0xfe'),_0x3061ee[_0xe6fa('0x79')]['mailTranscript']),'attachments':[{'path':_0x2e1de6}]}})['then'](function(){return _0x23b826;})['catch'](function(_0x30c4c8){console['error'](_0x30c4c8);});}else{return _0x23b826;}})[_0xe6fa('0x32')](respondWithStatusCode(_0x24c044,0xc8))[_0xe6fa('0xb9')](handleError(_0x24c044,null));};exports['addMessage']=function(_0x33b4bc,_0xf5c679,_0x16c87e){return db[_0xe6fa('0xe5')]['find']({'where':{'id':_0x33b4bc[_0xe6fa('0xba')]['id']}})[_0xe6fa('0x32')](handleEntityNotFound(_0xf5c679,null))[_0xe6fa('0x32')](function(_0x42adc6){if(_0x42adc6){return _0x42adc6[_0xe6fa('0xff')](_0x33b4bc[_0xe6fa('0x79')][_0xe6fa('0x100')],_[_0xe6fa('0x101')](_0x33b4bc[_0xe6fa('0x79')],[_0xe6fa('0x100'),'id'])||{});}})['then'](respondWithResult(_0xf5c679,null))['catch'](handleError(_0xf5c679,null));};exports['getMessages']=function(_0x13e1c7,_0x5dc66a,_0x8ed4cd){var _0x59d7ec={'raw':![],'where':{}};var _0xd4670d={};var _0x4b0a07={'count':0x0,'rows':[]};return db[_0xe6fa('0x40')]['findOne']({'where':{'id':_0x13e1c7[_0xe6fa('0xba')]['id']}})[_0xe6fa('0x32')](handleEntityNotFound(_0x5dc66a,null))['then'](function(_0x240895){if(_0x240895){_0xd4670d[_0xe6fa('0x47')]=_[_0xe6fa('0x46')](db[_0xe6fa('0xe5')][_0xe6fa('0x41')]);_0xd4670d['query']=_[_0xe6fa('0x46')](_0x13e1c7[_0xe6fa('0x45')]);_0xd4670d[_0xe6fa('0xbb')]=_[_0xe6fa('0x49')](_0xd4670d['model'],_0xd4670d[_0xe6fa('0x45')]);_0x59d7ec[_0xe6fa('0x48')]=_['intersection'](_0xd4670d[_0xe6fa('0x47')],qs['fields'](_0x13e1c7[_0xe6fa('0x45')][_0xe6fa('0xa0')]));_0x59d7ec[_0xe6fa('0x48')]=_0x59d7ec['attributes'][_0xe6fa('0x6d')]?_0x59d7ec[_0xe6fa('0x48')]:_0xd4670d[_0xe6fa('0x47')];if(!_0x13e1c7[_0xe6fa('0x45')]['hasOwnProperty'](_0xe6fa('0x4a'))){_0x59d7ec[_0xe6fa('0x2b')]=qs['limit'](_0x13e1c7[_0xe6fa('0x45')]['limit']);_0x59d7ec[_0xe6fa('0x2a')]=qs[_0xe6fa('0x2a')](_0x13e1c7[_0xe6fa('0x45')][_0xe6fa('0x2a')]);}_0x59d7ec[_0xe6fa('0x91')]=qs[_0xe6fa('0x4b')](_0x13e1c7['query']['sort']);_0x59d7ec[_0xe6fa('0x4c')]=qs[_0xe6fa('0xbb')](_[_0xe6fa('0x4d')](_0x13e1c7[_0xe6fa('0x45')],_0xd4670d[_0xe6fa('0xbb')]));_0x59d7ec['where'][_0xe6fa('0xb6')]=_0x240895['id'];if(_0x13e1c7[_0xe6fa('0x45')][_0xe6fa('0x88')]){_0x59d7ec[_0xe6fa('0x4c')]=_[_0xe6fa('0x9f')](_0x59d7ec[_0xe6fa('0x4c')],{'$or':_['map'](_0x59d7ec[_0xe6fa('0x48')],function(_0x565753){var _0x3c70b9={};_0x3c70b9[_0x565753]={'$like':'%'+_0x13e1c7[_0xe6fa('0x45')][_0xe6fa('0x88')]+'%'};return _0x3c70b9;})});}if(_0x13e1c7[_0xe6fa('0x45')][_0xe6fa('0x80')]){var _0x392a43=_0x13e1c7[_0xe6fa('0x45')]['$gte']['split'](',');var _0x312756={};_0x312756[_0x392a43[0x0]]={'$gte':moment(_0x392a43[0x1])[_0xe6fa('0xe1')](_0xe6fa('0x102'))};_0x59d7ec[_0xe6fa('0x4c')]=_[_0xe6fa('0x9f')](_0x59d7ec['where'],_0x312756);}_0x59d7ec=_[_0xe6fa('0x9f')]({},_0x59d7ec,_0x13e1c7[_0xe6fa('0xbd')]);return db[_0xe6fa('0xe5')][_0xe6fa('0x29')]({'where':_0x59d7ec[_0xe6fa('0x4c')]})[_0xe6fa('0x32')](function(_0x308356){_0x4b0a07['count']=_0x308356;if(_0x13e1c7[_0xe6fa('0x45')]['includeAll']){_0x59d7ec[_0xe6fa('0x103')]=[{'all':!![]}];}return db[_0xe6fa('0xe5')][_0xe6fa('0x104')](_0x59d7ec);})['then'](function(_0x35f7f1){_0x4b0a07[_0xe6fa('0xb8')]=_0x35f7f1;return _0x4b0a07;});}})[_0xe6fa('0x32')](respondWithFilteredResult(_0x5dc66a,_0x59d7ec))['catch'](handleError(_0x5dc66a,null));};exports[_0xe6fa('0x105')]=function(_0x268338,_0x1d841f,_0x57cf88){var _0x29a4d6={'where':{}},_0x4077cc={},_0x4bffe3={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xe6fa('0xc0')]({'where':{'id':_0x268338[_0xe6fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x1d841f,null))[_0xe6fa('0x32')](function(_0x5c0aef){if(_0x5c0aef){_0x4077cc[_0xe6fa('0x47')]=_['keys'](db['ChatMessage'][_0xe6fa('0x41')]);_0x4077cc[_0xe6fa('0x45')]=_[_0xe6fa('0x46')](_0x268338[_0xe6fa('0x45')]);_0x4077cc[_0xe6fa('0xbb')]=_[_0xe6fa('0x49')](_0x4077cc[_0xe6fa('0x47')],_0x4077cc['query']);_0x29a4d6[_0xe6fa('0x48')]=_[_0xe6fa('0x49')](_0x4077cc[_0xe6fa('0x47')],qs[_0xe6fa('0xa0')](_0x268338[_0xe6fa('0x45')][_0xe6fa('0xa0')]));_0x29a4d6[_0xe6fa('0x48')]=_0x29a4d6[_0xe6fa('0x48')][_0xe6fa('0x6d')]?_0x29a4d6[_0xe6fa('0x48')]:_0x4077cc[_0xe6fa('0x47')];if(!_0x268338['query'][_0xe6fa('0x106')](_0xe6fa('0x4a'))){_0x29a4d6[_0xe6fa('0x2b')]=qs[_0xe6fa('0x2b')](_0x268338[_0xe6fa('0x45')][_0xe6fa('0x2b')]);_0x29a4d6['offset']=qs[_0xe6fa('0x2a')](_0x268338[_0xe6fa('0x45')][_0xe6fa('0x2a')]);}_0x29a4d6['order']=qs[_0xe6fa('0x4b')](_0x268338[_0xe6fa('0x45')]['sort']);_0x29a4d6[_0xe6fa('0x4c')]=qs['filters'](_[_0xe6fa('0x4d')](_0x268338['query'],_0x4077cc[_0xe6fa('0xbb')]));_0x29a4d6[_0xe6fa('0x4c')][_0xe6fa('0xb6')]=_0x5c0aef['id'];if(_0x268338[_0xe6fa('0x45')]['filter']){_0x29a4d6[_0xe6fa('0x4c')]=_[_0xe6fa('0x9f')](_0x29a4d6[_0xe6fa('0x4c')],{'$or':_[_0xe6fa('0x38')](_0x29a4d6[_0xe6fa('0x48')],function(_0x38666d){var _0x535a9d={};_0x535a9d[_0x38666d]={'$like':'%'+_0x268338[_0xe6fa('0x45')]['filter']+'%'};return _0x535a9d;})});}_0x29a4d6[_0xe6fa('0x4c')]['secret']=![];if(_0x268338['query']['id']){_0x29a4d6[_0xe6fa('0x4c')]['id']={'$gt':_0x268338[_0xe6fa('0x45')]['id']};}_0x29a4d6=_['merge']({},_0x29a4d6,_0x268338[_0xe6fa('0xbd')]);return db['ChatMessage'][_0xe6fa('0x29')]({'where':_0x29a4d6['where']})[_0xe6fa('0x32')](function(_0x2e9e35){_0x4bffe3[_0xe6fa('0x29')]=_0x2e9e35;_0x29a4d6[_0xe6fa('0x103')]=[];if(_0x268338['query'][_0xe6fa('0x107')]){_0x29a4d6[_0xe6fa('0x103')][_0xe6fa('0x3e')]({'model':db[_0xe6fa('0x74')],'as':_0xe6fa('0x74'),'attributes':['id',_0xe6fa('0x39'),_0xe6fa('0xed')]});}if(_0x268338[_0xe6fa('0x45')][_0xe6fa('0xbc')]){_0x29a4d6[_0xe6fa('0x103')]=[{'all':!![]}];}return db[_0xe6fa('0xe5')][_0xe6fa('0x104')](_0x29a4d6);})[_0xe6fa('0x32')](function(_0x3052ed){_0x4bffe3[_0xe6fa('0xb8')]=_0x3052ed;return _0x4bffe3;});}})[_0xe6fa('0x32')](respondWithFilteredResult(_0x1d841f,_0x29a4d6))[_0xe6fa('0xb9')](handleError(_0x1d841f,null));};exports[_0xe6fa('0x108')]=function(_0x606011,_0x4f79c2,_0x43895a){return db[_0xe6fa('0x40')][_0xe6fa('0x67')]({'where':{'id':_0x606011[_0xe6fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x4f79c2,null))[_0xe6fa('0x32')](function(_0x3cb5c4){if(_0x3cb5c4){return _0x3cb5c4[_0xe6fa('0x109')](_0x606011[_0xe6fa('0x79')][_0xe6fa('0x100')],_['omit'](_0x606011['body'],['ids','id'])||{})['spread'](function(){return db[_0xe6fa('0x72')][_0xe6fa('0x104')]({'attributes':['id',_0xe6fa('0x35'),_0xe6fa('0x50')],'where':{'id':_0x606011[_0xe6fa('0x79')][_0xe6fa('0x100')]}});})['then'](function(_0x243b33){socket['emit']('chatInteractionTags:save',{'id':Number(_0x606011[_0xe6fa('0xba')]['id']),'tags':_0x243b33||[]});return{'id':Number(_0x606011['params']['id']),'tags':_0x243b33||[]};});}})['then'](respondWithResult(_0x4f79c2,null))[_0xe6fa('0xb9')](handleError(_0x4f79c2,null));};exports[_0xe6fa('0x10a')]=function(_0x42c1ca,_0x5b7ddc,_0x4da7b5){return db[_0xe6fa('0x40')]['find']({'where':{'id':_0x42c1ca[_0xe6fa('0xba')]['id']}})[_0xe6fa('0x32')](handleEntityNotFound(_0x5b7ddc,null))[_0xe6fa('0x32')](function(_0x34ce65){if(_0x34ce65){return _0x34ce65[_0xe6fa('0x10a')](_0x42c1ca['query'][_0xe6fa('0x100')]);}})[_0xe6fa('0x32')](respondWithStatusCode(_0x5b7ddc,null))['catch'](handleError(_0x5b7ddc,null));};exports['download']=function(_0x5e744a,_0x10d87c){var _0x51ef97=moment()[_0xe6fa('0x10b')]()['toString']();var _0x46d6f2=path[_0xe6fa('0xdf')](config['root'],_0xe6fa('0x10c'),'files',_0xe6fa('0x10d'));var _0x28b7dd=path[_0xe6fa('0xdf')](config[_0xe6fa('0xdc')],_0xe6fa('0x10c'),_0xe6fa('0x10e'),'attachments');var _0x290f93=path[_0xe6fa('0xdf')](_0x46d6f2,_0x51ef97);var _0x2e6ef7=util[_0xe6fa('0xe1')]('transcript-%d-%s.zip',_0x5e744a[_0xe6fa('0xba')]['id'],_0x51ef97);var _0x1c5042=path[_0xe6fa('0xdf')](_0x46d6f2,_0x2e6ef7);var _0x198277=[];_0x198277[_0xe6fa('0x3e')]({'model':db[_0xe6fa('0x74')],'as':_0xe6fa('0x74'),'attributes':['id',_0xe6fa('0x39')],'raw':!![]});_0x198277[_0xe6fa('0x3e')]({'model':db['CmContact'],'as':_0xe6fa('0x10f'),'attributes':['id',_0xe6fa('0x110'),_0xe6fa('0x111')],'raw':!![]});if(_0x5e744a[_0xe6fa('0x45')][_0xe6fa('0x112')]){_0x198277[_0xe6fa('0x3e')]({'model':db[_0xe6fa('0xd9')],'as':_0xe6fa('0xd9'),'raw':!![]});}var _0x55b197=[{'model':db[_0xe6fa('0xe5')],'as':'Messages','attributes':['id','body',_0xe6fa('0x7f'),'direction','secret',_0xe6fa('0x84')],'include':_0x198277}];_0x55b197[_0xe6fa('0x3e')]({'model':db[_0xe6fa('0xc1')],'as':_0xe6fa('0x113'),'attributes':['id','name']});_0x55b197[_0xe6fa('0x3e')]({'model':db['User'],'as':_0xe6fa('0x114'),'attributes':['id',_0xe6fa('0x39')]});return db[_0xe6fa('0x40')][_0xe6fa('0x67')]({'where':{'id':_0x5e744a[_0xe6fa('0xba')]['id']},'include':_0x55b197})['then'](handleEntityNotFound(_0x10d87c,null))['then'](function(_0x4e97ec){if(_0x4e97ec){var _0x5087ef=_0x4e97ec['get']({'plain':!![]});fs[_0xe6fa('0x115')](_0x290f93);var _0x19e388={'format':'A4','border':_0xe6fa('0x116'),'header':{'height':'40px','contents':{'first':_0xe6fa('0x117')}},'footer':{'height':_0xe6fa('0x118'),'contents':{'default':util[_0xe6fa('0xe1')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xe6fa('0xe1')](_0xe6fa('0x119'),_0xe6fa('0x11a'),_0x5087ef['id']),moment()['format'](_0xe6fa('0x11b'))[_0xe6fa('0x9d')]())}}};var _0x3ce8c4={'channel':_0xe6fa('0x11a'),'account':_0x5087ef['Account']['name'],'agent':_0x5087ef[_0xe6fa('0x114')]?_0x5087ef['Owner'][_0xe6fa('0x39')]:'N.A.','createdAt':moment(_0x5087ef[_0xe6fa('0x7f')])[_0xe6fa('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe6fa('0x9d')](),'closedAt':_0x5087ef[_0xe6fa('0xd2')]?moment(_0x5087ef[_0xe6fa('0x11c')])[_0xe6fa('0xe1')](_0xe6fa('0x102'))[_0xe6fa('0x9d')]():'','disposition':_0x5087ef[_0xe6fa('0x11d')],'chatInfo':{'browser':_0x5087ef['browserName'],'os':_0x5087ef[_0xe6fa('0x11e')],'referer':_0x5087ef[_0xe6fa('0x11f')],'customerIp':_0x5087ef[_0xe6fa('0x120')],'customerPort':_0x5087ef[_0xe6fa('0x121')]?_0x5087ef[_0xe6fa('0x121')]:'N.A.'},'messages':_(_0x5087ef[_0xe6fa('0xe6')])['tail']()['filter']({'secret':![]})['map'](function(_0x476280){if(_0x476280['Attachment']){var _0x64dc94=path[_0xe6fa('0xdf')](_0x28b7dd,_0x476280['Attachment'][_0xe6fa('0xd5')]);if(fs[_0xe6fa('0x122')](_0x64dc94)){fs[_0xe6fa('0x123')](_0x64dc94)['pipe'](fs[_0xe6fa('0x124')](path[_0xe6fa('0xdf')](_0x290f93,_0x476280['Attachment'][_0xe6fa('0xd5')])));}}return{'date':moment(_0x476280['createdAt'])[_0xe6fa('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe6fa('0x9d')](),'sender':_0x476280[_0xe6fa('0xf1')]===_0xe6fa('0x125')?_0x476280['User']?_0x476280['User'][_0xe6fa('0x39')]:'System':_0x476280[_0xe6fa('0x10f')]['firstName']+(_0x476280['Contact']['lastName']?'\x20'+_0x476280['Contact'][_0xe6fa('0x111')]:''),'body':_0x476280[_0xe6fa('0xd9')]?_0x476280['Attachment'][_0xe6fa('0xd5')]:_0x476280[_0xe6fa('0x79')],'direction':_0x476280[_0xe6fa('0xf1')]===_0xe6fa('0x125')?'A':'C','secret':_0x476280[_0xe6fa('0xf2')],'read':_0x476280[_0xe6fa('0x84')],'attachment':_0x476280['Attachment']};})[_0xe6fa('0x6c')]()};return ejs['renderFile'](path[_0xe6fa('0xdf')](config[_0xe6fa('0xdc')],'server','views','downloadInteraction.html'),{'interaction':_0x3ce8c4})[_0xe6fa('0x32')](function(_0x1dcbe8){return new BPromise(function(_0x5e1dcb,_0x9432cb){pdf[_0xe6fa('0xbe')](_0x1dcbe8,_0x19e388)[_0xe6fa('0x126')](path[_0xe6fa('0xdf')](_0x290f93,_0xe6fa('0x127')+_0x5087ef['id']+'-'+_0x51ef97+_0xe6fa('0x128')),function(_0x2960e7,_0x4d91f5){if(_0x2960e7)return _0x9432cb(_0x2960e7);_0x5e1dcb(_0x4d91f5);});});})[_0xe6fa('0x32')](function(){return new BPromise(function(_0x4b2b25,_0x13779c){zipdir(_0x290f93,{'saveTo':_0x1c5042},function(_0x12b265,_0x4e1944){if(_0x12b265)return _0x13779c(_0x12b265);return _0x4b2b25(_0x4e1944);});})[_0xe6fa('0x32')](function(){return new BPromise(function(_0x126a7e,_0x4b5ae4){rimraf(_0x290f93,function(_0x374531){if(_0x374531)_0x4b5ae4(_0x374531);return _0x126a7e();});});})['then'](function(){return _0x10d87c['download'](_0x1c5042,_0x2e6ef7,function(_0x224d3a){if(_0x224d3a){console[_0xe6fa('0x129')](_0xe6fa('0x12a'),_0x224d3a);}else{fs[_0xe6fa('0x12b')](_0x1c5042);}});});});}else{return _0x10d87c['sendStatus'](0xc8);}})[_0xe6fa('0xb9')](handleError(_0x10d87c,null));}; \ No newline at end of file +var _0xb4c3=['register','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','status','end','json','offset','limit','Content-Range','reject','update','then','sendStatus','stack','name','Users','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','operator','$substring','value','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','buildExpression','compact','isEmpty','ChatWebsiteId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','count','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','catch','show','params','keys','includeAll','include','options','create','body','destroy','describe','createVidaooSession','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','attachId','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','agentAlias','System','Visitor','website_alias','%s%d','agent_alias','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatInteractionId','findAll','rows','getMyMessages','alias','addTags','setTags','spread','removeTags','download','unix','server','files','tmp','attachments','CmContact','firstName','lastName','direction','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Account','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerIp','customerPort','N.A.','tail','basename','pipe','createWriteStream','Contact','downloadInteraction.html','toFile','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket'];(function(_0xb0505,_0x3bba57){var _0x11d790=function(_0x3d368a){while(--_0x3d368a){_0xb0505['push'](_0xb0505['shift']());}};_0x11d790(++_0x3bba57);}(_0xb4c3,0x115));var _0x3b4c=function(_0x210cd7,_0x1ad9d6){_0x210cd7=_0x210cd7-0x0;var _0x4d4d64=_0xb4c3[_0x210cd7];return _0x4d4d64;};'use strict';var pdf=require(_0x3b4c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3b4c('0x1'));var zipdir=require(_0x3b4c('0x2'));var jsonpatch=require(_0x3b4c('0x3'));var rp=require(_0x3b4c('0x4'));var moment=require(_0x3b4c('0x5'));var BPromise=require(_0x3b4c('0x6'));var Mustache=require(_0x3b4c('0x7'));var util=require('util');var path=require(_0x3b4c('0x8'));var sox=require('sox');var csv=require(_0x3b4c('0x9'));var ejs=require(_0x3b4c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3b4c('0xb'));var crypto=require(_0x3b4c('0xc'));var jsforce=require(_0x3b4c('0xd'));var deskjs=require(_0x3b4c('0xe'));var toCsv=require(_0x3b4c('0x9'));var querystring=require(_0x3b4c('0xf'));var Papa=require(_0x3b4c('0x10'));var Redis=require(_0x3b4c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b4c('0x12'));var hardwareService=require(_0x3b4c('0x13'));var logger=require(_0x3b4c('0x14'))(_0x3b4c('0x15'));var utils=require(_0x3b4c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b4c('0x17'));var db=require(_0x3b4c('0x18'))['db'];config[_0x3b4c('0x19')]=_[_0x3b4c('0x1a')](config[_0x3b4c('0x19')],{'host':_0x3b4c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3b4c('0x1c'))[_0x3b4c('0x1d')](socket);var jayson=require(_0x3b4c('0x1e'));var client=jayson[_0x3b4c('0x1f')][_0x3b4c('0x20')]({'port':0x232b});var client9004=jayson[_0x3b4c('0x1f')][_0x3b4c('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x68fed1,_0x159ac8,_0x1c0810,_0x7bad30){return new BPromise(function(_0x5c5946,_0x1e3f8f){var _0x525630=_0x7bad30||client;return _0x525630[_0x3b4c('0x21')](_0x68fed1,_0x1c0810)['then'](function(_0x1cc3e9){logger[_0x3b4c('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x159ac8,_0x3b4c('0x23'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x159ac8,'request\x20sent',JSON[_0x3b4c('0x24')](_0x1cc3e9));if(_0x1cc3e9[_0x3b4c('0x25')]){if(_0x1cc3e9[_0x3b4c('0x25')][_0x3b4c('0x26')]===0x1f4){logger['error'](_0x3b4c('0x27'),_0x159ac8,_0x1cc3e9[_0x3b4c('0x25')][_0x3b4c('0x28')]);return _0x1e3f8f(_0x1cc3e9[_0x3b4c('0x25')][_0x3b4c('0x28')]);}logger['error'](_0x3b4c('0x27'),_0x159ac8,_0x1cc3e9[_0x3b4c('0x25')][_0x3b4c('0x28')]);return _0x5c5946(_0x1cc3e9[_0x3b4c('0x25')]['message']);}else{logger['info'](_0x3b4c('0x27'),_0x159ac8,_0x3b4c('0x23'));_0x5c5946(_0x1cc3e9['result'][_0x3b4c('0x28')]);}})['catch'](function(_0x182319){logger[_0x3b4c('0x25')](_0x3b4c('0x27'),_0x159ac8,_0x182319);_0x1e3f8f(_0x182319);});});}function respondWithStatusCode(_0x3f8194,_0x15185c){_0x15185c=_0x15185c||0xcc;return function(_0x268cb9){if(_0x268cb9){return _0x3f8194['sendStatus'](_0x15185c);}return _0x3f8194[_0x3b4c('0x29')](_0x15185c)[_0x3b4c('0x2a')]();};}function respondWithResult(_0x3d0c55,_0x1fd850){_0x1fd850=_0x1fd850||0xc8;return function(_0x2f3467){if(_0x2f3467){return _0x3d0c55['status'](_0x1fd850)[_0x3b4c('0x2b')](_0x2f3467);}};}function respondWithFilteredResult(_0x324611,_0x334fcc){return function(_0x23a48e){if(_0x23a48e){var _0x316df1=_0x23a48e['count'],_0x2f3d88=_0x334fcc[_0x3b4c('0x2c')],_0xa1ea95=_0x334fcc['offset']+_0x334fcc[_0x3b4c('0x2d')],_0x55bc9a;if(_0xa1ea95>=_0x316df1){_0xa1ea95=_0x316df1;_0x55bc9a=0xc8;}else{_0x55bc9a=0xce;}_0x324611[_0x3b4c('0x29')](_0x55bc9a);return _0x324611['set'](_0x3b4c('0x2e'),_0x2f3d88+'-'+_0xa1ea95+'/'+_0x316df1)[_0x3b4c('0x2b')](_0x23a48e);}return null;};}function patchUpdates(_0x3c18b0){return function(_0x5ea060){try{jsonpatch['apply'](_0x5ea060,_0x3c18b0,!![]);}catch(_0x55fd34){return BPromise[_0x3b4c('0x2f')](_0x55fd34);}return _0x5ea060['save']();};}function saveUpdates(_0x23d0fe,_0x396a60){return function(_0x2fabee){if(_0x2fabee){return _0x2fabee[_0x3b4c('0x30')](_0x23d0fe)[_0x3b4c('0x31')](function(_0x550152){return _0x550152;});}return null;};}function removeEntity(_0x5a54a2,_0x45d47a){return function(_0x57d7c9){if(_0x57d7c9){return _0x57d7c9['destroy']()[_0x3b4c('0x31')](function(){_0x5a54a2['status'](0xcc)[_0x3b4c('0x2a')]();});}};}function handleEntityNotFound(_0x4dc344,_0x5c904){return function(_0x118f6b){if(!_0x118f6b){_0x4dc344[_0x3b4c('0x32')](0x194);}return _0x118f6b;};}function handleError(_0x5c9fa0,_0x3533c2){_0x3533c2=_0x3533c2||0x1f4;return function(_0x138f73){logger[_0x3b4c('0x25')](_0x138f73[_0x3b4c('0x33')]);if(_0x138f73['name']){delete _0x138f73[_0x3b4c('0x34')];}_0x5c9fa0['status'](_0x3533c2)['send'](_0x138f73);};}function getInteractionUsers(_0x56cb42,_0x35ccd8){return new BPromise(function(_0x53b117,_0x1bf769){try{if(_0x35ccd8[_0x56cb42['id']]){_0x56cb42[_0x3b4c('0x35')]=_[_0x3b4c('0x36')](_0x35ccd8[_0x56cb42['id']],function(_0x1bd78f){return{'id':_0x1bd78f['id'],'fullname':_0x1bd78f[_0x3b4c('0x37')]};});}}catch(_0x431e2f){_0x1bf769(_0x431e2f);}_0x53b117(_0x56cb42);});}function getInteractionTags(_0x3d3a3e,_0x446af4){return new BPromise(function(_0x428bc6,_0x5f4b80){try{if(_0x3d3a3e[_0x3b4c('0x38')]){_0x3d3a3e[_0x3b4c('0x39')]=[];_0x3d3a3e['TagIds']['split'](',')[_0x3b4c('0x3a')](function(_0x6b65ad){_0x3d3a3e['Tags'][_0x3b4c('0x3b')](_0x446af4[_0x6b65ad]);});}delete _0x3d3a3e[_0x3b4c('0x38')];}catch(_0xe540f7){_0x5f4b80(_0xe540f7);}_0x428bc6(_0x3d3a3e);});}function updateChatInteraction(_0x15796e,_0x1da032,_0x353d88){return new BPromise(function(_0x149d85,_0xfe3c47){return getInteractionUsers(_0x15796e,_0x353d88)[_0x3b4c('0x31')](function(_0x22d8e5){return getInteractionTags(_0x22d8e5,_0x1da032);})[_0x3b4c('0x31')](function(_0x42699b){_0x149d85(_0x42699b);})['catch'](function(_0x21da82){_0xfe3c47(_0x21da82);});});}exports[_0x3b4c('0x3c')]=function(_0x2d287c,_0x31f736){var _0x5f419c={},_0x1612ea={},_0x347879={'count':0x0,'rows':[]};var _0xbee826=_['map'](db[_0x3b4c('0x3d')][_0x3b4c('0x3e')],function(_0x158f0d){return{'name':_0x158f0d[_0x3b4c('0x3f')],'type':_0x158f0d[_0x3b4c('0x40')]['key']};});_0x1612ea[_0x3b4c('0x41')]=_[_0x3b4c('0x36')](_0xbee826,'name');_0x1612ea['query']=_['keys'](_0x2d287c[_0x3b4c('0x42')]);_0x1612ea[_0x3b4c('0x43')]=_[_0x3b4c('0x44')](_0x1612ea['model'],_0x1612ea['query']);_0x5f419c[_0x3b4c('0x45')]=_[_0x3b4c('0x44')](_0x1612ea['model'],qs[_0x3b4c('0x46')](_0x2d287c['query'][_0x3b4c('0x46')]));_0x5f419c[_0x3b4c('0x45')]=_0x5f419c[_0x3b4c('0x45')][_0x3b4c('0x47')]?_0x5f419c[_0x3b4c('0x45')]:_0x1612ea[_0x3b4c('0x41')];if(!_0x2d287c['query'][_0x3b4c('0x48')](_0x3b4c('0x49'))){_0x5f419c['limit']=qs[_0x3b4c('0x2d')](_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x2d')]);_0x5f419c[_0x3b4c('0x2c')]=qs[_0x3b4c('0x2c')](_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x2c')]);}_0x5f419c[_0x3b4c('0x4a')]=qs[_0x3b4c('0x4b')](_0x2d287c[_0x3b4c('0x42')]['sort']);_0x5f419c[_0x3b4c('0x4c')]=qs[_0x3b4c('0x43')](_[_0x3b4c('0x4d')](_0x2d287c['query'],_0x1612ea[_0x3b4c('0x43')]),_0xbee826);var _0x54a80b=[];var _0x353102=squel[_0x3b4c('0x4e')]()[_0x3b4c('0x4f')]('id')[_0x3b4c('0x4f')]('name')['field'](_0x3b4c('0x50'))[_0x3b4c('0x51')](_0x3b4c('0x52'));var _0xbc40af=squel[_0x3b4c('0x4e')]()['field'](_0x3b4c('0x53'))[_0x3b4c('0x4f')]('u.fullname')[_0x3b4c('0x4f')](_0x3b4c('0x54'))[_0x3b4c('0x51')](_0x3b4c('0x55'),'ui')['left_join'](_0x3b4c('0x56'),'u',_0x3b4c('0x57'));var _0x3c2f74=squel[_0x3b4c('0x4e')]()[_0x3b4c('0x51')]('chat_interactions','i')[_0x3b4c('0x58')](_0x3b4c('0x59'),'c',_0x3b4c('0x5a'))['left_join'](_0x3b4c('0x56'),'o',_0x3b4c('0x5b'))[_0x3b4c('0x58')]('chat_websites','a',_0x3b4c('0x5c'))[_0x3b4c('0x58')](_0x3b4c('0x5d'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x3b4c('0x58')](_0x3b4c('0x5e'),'it',_0x3b4c('0x5f'))[_0x3b4c('0x58')](_0x3b4c('0x52'),'t',_0x3b4c('0x60'));var _0x5d88c5=squel[_0x3b4c('0x61')]();var _0x241d8a=[];var _0x3b879d=squel[_0x3b4c('0x61')]();var _0x2d56ae;if(_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x62')]){_0x2d56ae=as['parseSearch'](_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x62')]);var _0xedf7c7=_0x2d56ae[_0x3b4c('0x63')];for(var _0x38a353=0x0;_0x38a353<_0x2d56ae[_0x3b4c('0x64')][_0x3b4c('0x47')];_0x38a353++){var _0x5075bd=_0x2d56ae[_0x3b4c('0x64')][_0x38a353];var _0x5de131='i';var _0x1539ed=_[_0x3b4c('0x65')](_0xbee826,[_0x3b4c('0x34'),_0x5075bd[_0x3b4c('0x4f')]]);if(!_0x1539ed){switch(_0x5075bd['field']){case _0x3b4c('0x66'):if(_0x5075bd['value']==0x1){_0x3c2f74[_0x3b4c('0x67')]('`'+_0x5075bd[_0x3b4c('0x4f')]+'`\x20=\x200');}else{_0x3c2f74[_0x3b4c('0x67')]('`'+_0x5075bd['field']+_0x3b4c('0x68'));}break;case'Contact':if(_0x5075bd[_0x3b4c('0x69')]===_0x3b4c('0x6a')){if(_0x5075bd[_0x3b4c('0x6b')][_0x3b4c('0x6c')]('\x20')[_0x3b4c('0x47')]>0x1){_0x5d88c5[_0xedf7c7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5075bd[_0x3b4c('0x6b')]),null);}else{var _0x382850='%'+_0x5075bd[_0x3b4c('0x6b')]+'%';_0x5d88c5[_0xedf7c7](_0x3b4c('0x6d'),_0x382850,_0x382850,_0x382850);}}else{_0x1539ed=_[_0x3b4c('0x65')](_0xbee826,[_0x3b4c('0x34'),_0x3b4c('0x6e')]);_0x5075bd[_0x3b4c('0x4f')]=_0x3b4c('0x6e');_0x5bd28a=as['buildExpression'](_0x5de131,_0x1539ed[_0x3b4c('0x40')],_0x5075bd);_0x5d88c5[_0xedf7c7](_0x5bd28a[_0x3b4c('0x6f')],_0x5bd28a[_0x3b4c('0x6b')]['start'],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x2a')]);}break;case _0x3b4c('0x70'):var _0x24861a=_0x5075bd[_0x3b4c('0x6b')][_0x3b4c('0x6c')](',')[_0x3b4c('0x36')](function(_0x17824e){return Number(_0x17824e);});_0x24861a[_0x3b4c('0x3a')](function(_0x3c5ee7){_0x3b879d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c5ee7+',%');});_0x241d8a=_[_0x3b4c('0x71')](_0x241d8a,_0x24861a);break;case _0x3b4c('0x72'):if(_0x5075bd['operator']===_0x3b4c('0x6a')){_0x5d88c5[_0xedf7c7](_0x3b4c('0x73'),'%'+_0x5075bd[_0x3b4c('0x6b')]+'%',null);}else{_0x1539ed=_['find'](_0xbee826,[_0x3b4c('0x34'),_0x3b4c('0x74')]);_0x5075bd['field']=_0x3b4c('0x74');_0x5bd28a=as['buildExpression'](_0x5de131,_0x1539ed[_0x3b4c('0x40')],_0x5075bd);_0x5d88c5[_0xedf7c7](_0x5bd28a[_0x3b4c('0x6f')],_0x5bd28a['value']['start'],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x2a')]);}break;case'body':_0x5bd28a=as['buildExpression']('me',null,_0x5075bd);_0x5d88c5[_0xedf7c7](_0x5bd28a[_0x3b4c('0x6f')],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x75')],_0x5bd28a[_0x3b4c('0x6b')]['end']);break;}}else{var _0x5bd28a=as[_0x3b4c('0x76')](_0x5de131,_0x1539ed['type'],_0x5075bd);_0x5d88c5[_0xedf7c7](_0x5bd28a[_0x3b4c('0x6f')],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x75')],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x2a')]);}}}else{var _0x52d6ad=_(_0x2d287c[_0x3b4c('0x42')])['keys']()[_0x3b4c('0x36')](function(_0x449828){return _['some'](_0xbee826,[_0x3b4c('0x34'),_0x449828])?_0x449828:undefined;})[_0x3b4c('0x77')]()['value']();if(!_[_0x3b4c('0x78')](_0x52d6ad)){_0x52d6ad[_0x3b4c('0x3a')](function(_0xdb925c){if(_0xdb925c===_0x3b4c('0x79')){_0x3c2f74[_0x3b4c('0x4c')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x2d287c[_0x3b4c('0x42')][_0xdb925c]));}else if(_0xdb925c===_0x3b4c('0x7a')){var _0x215620=JSON[_0x3b4c('0x7b')](_0x2d287c['query'][_0xdb925c])[_0x3b4c('0x7c')];var _0x187178=JSON['parse'](_0x2d287c[_0x3b4c('0x42')][_0xdb925c])[_0x3b4c('0x7d')];_0x3c2f74[_0x3b4c('0x4c')](_0x3b4c('0x7e'),_0x215620,_0x187178);}else{if(_0x2d287c[_0x3b4c('0x42')][_0xdb925c]===_0x3b4c('0x7f')){_0x3c2f74[_0x3b4c('0x4c')]('i.'+_0xdb925c+_0x3b4c('0x80'));}else{_0x3c2f74[_0x3b4c('0x4c')]('i.'+_0xdb925c+_0x3b4c('0x81'),_0x2d287c[_0x3b4c('0x42')][_0xdb925c]);}}});}if(_0x2d287c[_0x3b4c('0x42')]['read']){if(_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x82')]==0x1){_0x3c2f74[_0x3b4c('0x67')]('`unreadMessages`\x20=\x200');}else{_0x3c2f74['having'](_0x3b4c('0x83'));}}if(_0x2d287c[_0x3b4c('0x42')]['tag']){_0x241d8a=_[_0x3b4c('0x84')](_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x85')])?_0x2d287c['query'][_0x3b4c('0x85')]:new Array(_0x2d287c['query'][_0x3b4c('0x85')]);_0x241d8a['forEach'](function(_0x476351){_0x3b879d['or'](_0x3b4c('0x86'),'%,'+_0x476351+',%');});}if(_0x2d287c['query'][_0x3b4c('0x87')]){var _0x3a5194=_0x2d287c['query'][_0x3b4c('0x87')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3a5194)){_0x5d88c5['or'](_0x3b4c('0x88'),_0x3a5194+'%');}else{_0x5d88c5['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b4c('0x89')](_0x3a5194))['or'](_0x3b4c('0x8a'),_0x3a5194+'%');}}}_0x3c2f74[_0x3b4c('0x4c')](_0x5d88c5);_0x3c2f74[_0x3b4c('0x8b')](_0x3b4c('0x8c'));var _0xe1d2ee={'type':db[_0x3b4c('0x8d')][_0x3b4c('0x8e')][_0x3b4c('0x8f')],'raw':!![]};var _0x54443c=_0x3c2f74[_0x3b4c('0x90')]();_0x54443c[_0x3b4c('0x4f')](_0x3b4c('0x8c'));_0x54443c['field'](_0x3b4c('0x91'),'unreadMessages');if(_0x5f419c[_0x3b4c('0x4a')]){_0x5f419c[_0x3b4c('0x4a')][_0x3b4c('0x3a')](function(_0x6604b){var _0x471bc2=_0x6604b[0x0]===_0x3b4c('0x92')?_0x6604b[0x0]:'i.'+_0x6604b[0x0];_0x3c2f74['order'](_0x471bc2,_0x6604b[0x1]===_0x3b4c('0x93')?![]:!![]);});}if(!_[_0x3b4c('0x78')](_0x241d8a)){_0x3c2f74['having'](_0x3b879d);_0x54443c[_0x3b4c('0x4c')]('t.id\x20IN\x20?',_0x241d8a);}BPromise[_0x3b4c('0x94')]()[_0x3b4c('0x31')](function(){if(!_0x2d56ae){if(_0x2d287c[_0x3b4c('0x42')]['ChatWebsiteId']||_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x95')])return;_0x54443c['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3c2f74['where'](_0x3b4c('0x96'));return;}if(_0x2d287c[_0x3b4c('0x97')][_0x3b4c('0x98')]!==_0x3b4c('0x99'))return;return _0x2d287c[_0x3b4c('0x97')][_0x3b4c('0x9a')]({'attributes':['id'],'raw':!![]})[_0x3b4c('0x31')](function(_0x57419b){if(_[_0x3b4c('0x78')](_0x57419b)){_0x54443c[_0x3b4c('0x4c')](_0x3b4c('0x9b'));_0x3c2f74[_0x3b4c('0x4c')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x54443c['where'](_0x3b4c('0x9c'),_[_0x3b4c('0x36')](_0x57419b,'id'));_0x3c2f74[_0x3b4c('0x4c')](_0x3b4c('0x9c'),_['map'](_0x57419b,'id'));}});})[_0x3b4c('0x31')](function(){if(_0x2d287c[_0x3b4c('0x97')][_0x3b4c('0x98')]===_0x3b4c('0x99')&&!_0x2d56ae&&!_0x2d287c[_0x3b4c('0x42')]['ChatWebsiteId'])return[];return db[_0x3b4c('0x9d')]['query'](_0x54443c[_0x3b4c('0x9e')](),_0xe1d2ee);})['then'](function(_0x17caa1){_0x347879[_0x3b4c('0x9f')]=_0x17caa1[_0x3b4c('0x47')];if(_0x347879[_0x3b4c('0x9f')]===0x0)return[];return db[_0x3b4c('0x9d')][_0x3b4c('0x42')](_0x353102[_0x3b4c('0x9e')](),_0xe1d2ee)[_0x3b4c('0x31')](function(_0x34ca37){_0x54a80b=_['keyBy'](_0x34ca37,'id');_0xe1d2ee=_[_0x3b4c('0xa0')](_0xe1d2ee,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d287c['query'][_0x3b4c('0x46')]){_0x5f419c[_0x3b4c('0x45')]['forEach'](function(_0x3ec2b6){_0x3c2f74[_0x3b4c('0x4f')]('i.'+_0x3ec2b6);});}else{_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0x91'),_0x3b4c('0x66'));_0x3c2f74['field'](_0x3b4c('0xa1'),_0x3b4c('0xa2'));_0x3c2f74[_0x3b4c('0x4f')]('a.mandatoryDisposition',_0x3b4c('0xa3'));_0x3c2f74['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3b4c('0x92'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xa4'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xa5'),_0x3b4c('0xa6'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xa7'),'Contact.lastName');_0x3c2f74['field'](_0x3b4c('0xa8'),'Contact.email');_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xa9'),_0x3b4c('0xaa'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xab'),_0x3b4c('0xac'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xad'),_0x3b4c('0xae'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xaf'),_0x3b4c('0xb0'));_0x3c2f74['field'](_0x3b4c('0xb1'),'Owner.internal');_0x3c2f74['field'](_0x3b4c('0xb2'),_0x3b4c('0x38'));}if(_0x5f419c[_0x3b4c('0x2d')])_0x3c2f74[_0x3b4c('0x2d')](_0x5f419c[_0x3b4c('0x2d')]);if(_0x5f419c['offset'])_0x3c2f74['offset'](_0x5f419c[_0x3b4c('0x2c')]);return db['sequelize'][_0x3b4c('0x42')](_0x3c2f74['toString'](),_0xe1d2ee);})[_0x3b4c('0x31')](function(_0x22186f){_0xbc40af[_0x3b4c('0x4c')]('ui.ChatInteractionId\x20IN\x20?',_[_0x3b4c('0x36')](_0x22186f,'id'));return db[_0x3b4c('0x9d')]['query'](_0xbc40af[_0x3b4c('0x9e')](),_0xe1d2ee)[_0x3b4c('0x31')](function(_0x4f1890){var _0x101f52=_[_0x3b4c('0xb3')](_0x4f1890,'ChatInteractionId');var _0x6a0151=[];_0x22186f['forEach'](function(_0x2f3a63){_0x6a0151[_0x3b4c('0x3b')](updateChatInteraction(_0x2f3a63,_0x54a80b,_0x101f52));});return BPromise[_0x3b4c('0xb4')](_0x6a0151);});});})[_0x3b4c('0x31')](function(_0x116429){_0x347879['rows']=_0x116429;return _0x347879;})[_0x3b4c('0x31')](respondWithFilteredResult(_0x31f736,_0x5f419c))[_0x3b4c('0xb5')](handleError(_0x31f736,null));};exports[_0x3b4c('0xb6')]=function(_0x436db0,_0x5db897){var _0x1f2ed3={'raw':![],'where':{'id':_0x436db0[_0x3b4c('0xb7')]['id']}},_0x305a94={};_0x305a94['model']=_[_0x3b4c('0xb8')](db['ChatInteraction'][_0x3b4c('0x3e')]);_0x305a94[_0x3b4c('0x42')]=_['keys'](_0x436db0[_0x3b4c('0x42')]);_0x305a94[_0x3b4c('0x43')]=_[_0x3b4c('0x44')](_0x305a94[_0x3b4c('0x41')],_0x305a94[_0x3b4c('0x42')]);_0x1f2ed3[_0x3b4c('0x45')]=_[_0x3b4c('0x44')](_0x305a94[_0x3b4c('0x41')],qs[_0x3b4c('0x46')](_0x436db0[_0x3b4c('0x42')][_0x3b4c('0x46')]));_0x1f2ed3[_0x3b4c('0x45')]=_0x1f2ed3[_0x3b4c('0x45')]['length']?_0x1f2ed3[_0x3b4c('0x45')]:_0x305a94[_0x3b4c('0x41')];if(_0x436db0['query'][_0x3b4c('0xb9')]){_0x1f2ed3[_0x3b4c('0xba')]=[{'all':!![]}];}_0x1f2ed3=_['merge']({},_0x1f2ed3,_0x436db0[_0x3b4c('0xbb')]);return db[_0x3b4c('0x3d')][_0x3b4c('0x65')](_0x1f2ed3)['then'](handleEntityNotFound(_0x5db897,null))[_0x3b4c('0x31')](respondWithResult(_0x5db897,null))[_0x3b4c('0xb5')](handleError(_0x5db897,null));};exports[_0x3b4c('0xbc')]=function(_0x4f9f11,_0x481b3f){return db[_0x3b4c('0x3d')][_0x3b4c('0xbc')](_0x4f9f11[_0x3b4c('0xbd')],{})[_0x3b4c('0x31')](respondWithResult(_0x481b3f,0xc9))[_0x3b4c('0xb5')](handleError(_0x481b3f,null));};exports[_0x3b4c('0x30')]=function(_0x44f098,_0x178b92){if(_0x44f098[_0x3b4c('0xbd')]['id']){delete _0x44f098[_0x3b4c('0xbd')]['id'];}return db['ChatInteraction'][_0x3b4c('0x65')]({'where':{'id':_0x44f098[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x178b92,null))[_0x3b4c('0x31')](saveUpdates(_0x44f098[_0x3b4c('0xbd')],null))['then'](respondWithResult(_0x178b92,null))[_0x3b4c('0xb5')](handleError(_0x178b92,null));};exports[_0x3b4c('0xbe')]=function(_0x48d3ef,_0x429feb){return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x48d3ef[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x429feb,null))['then'](removeEntity(_0x429feb,null))[_0x3b4c('0xb5')](handleError(_0x429feb,null));};exports[_0x3b4c('0xbf')]=function(_0x2d9c60,_0x2b2556){return db[_0x3b4c('0x3d')][_0x3b4c('0xbf')]()[_0x3b4c('0x31')](respondWithResult(_0x2b2556,null))['catch'](handleError(_0x2b2556,null));};exports[_0x3b4c('0xc0')]=function(_0xf7f352,_0x207357){var _0x4f4767=_0xf7f352[_0x3b4c('0xb7')]['id'];var _0x1a7d0d;var _0x448800;var _0x1ae814;return db['ChatInteraction']['findOne']({'where':{'id':_0x4f4767}})[_0x3b4c('0x31')](function(_0x1d46b4){_0x1a7d0d=_0x1d46b4;return db['ChatWebsite']['findOne']({'where':{'id':_0x1d46b4[_0x3b4c('0x79')]},'attributes':['id',_0x3b4c('0xc1'),_0x3b4c('0xc2')],'raw':!![]});})[_0x3b4c('0x31')](function(_0xae84cf){if(_0xae84cf&&_0xae84cf[_0x3b4c('0xc1')]&&_0xae84cf[_0x3b4c('0xc2')]){_0x448800=_0xae84cf;var _0x425e3f={'rejectUnauthorized':![],'method':_0x3b4c('0xc3'),'uri':_0x3b4c('0xc4'),'headers':{'X-APIKEY':_0xae84cf[_0x3b4c('0xc1')]},'body':{'name':_0x3b4c('0xc5')+_0x4f4767},'redirect':_0x3b4c('0xc6'),'json':!![]};return rp(_0x425e3f);}else{throw new db['Sequelize'][(_0x3b4c('0xc7'))](_0x3b4c('0xc8'));}})[_0x3b4c('0x31')](function(_0x301ce0){_0x1ae814=_0x301ce0;if(_0x1ae814['id']){var _0x27f69d={'body':_0x1ae814[_0x3b4c('0xc9')],'ChatWebsiteId':_0x448800['id'],'ChatInteractionId':_0x1a7d0d['id'],'direction':_0x3b4c('0xca'),'UserId':_0xf7f352[_0x3b4c('0x97')]['id']};return db[_0x3b4c('0xcb')][_0x3b4c('0xbc')](_0x27f69d,{});}else{throw new db[(_0x3b4c('0x8d'))][(_0x3b4c('0xc7'))](_0x3b4c('0xcc'));}})[_0x3b4c('0x31')](function(){return _0x1a7d0d[_0x3b4c('0xcd')]({'vidaooSessionId':_0x1ae814['id']});})['then'](respondWithResult(_0x207357,null))[_0x3b4c('0xb5')](handleError(_0x207357,null));};exports[_0x3b4c('0xce')]=function(_0x17857a,_0x4040f6){if(_0x17857a[_0x3b4c('0xbd')]['id']){delete _0x17857a[_0x3b4c('0xbd')]['id'];}return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x17857a[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x4040f6,null))[_0x3b4c('0x31')](saveUpdates(_0x17857a[_0x3b4c('0xbd')],null))['then'](respondWithResult(_0x4040f6,null))[_0x3b4c('0xb5')](handleError(_0x4040f6,null));};exports['abandon']=function(_0x3a42ae,_0x281749,_0x13b231){if(_0x3a42ae[_0x3b4c('0xbd')]['id']){delete _0x3a42ae['body']['id'];}return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x3a42ae[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](function(_0x209a12){if(!_0x209a12){logger[_0x3b4c('0x25')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x281749[_0x3b4c('0x32')](0x194);}else{if(_0x209a12[_0x3b4c('0x74')]){throw new db[(_0x3b4c('0x8d'))][(_0x3b4c('0xc7'))](_0x3b4c('0xcf'));}}return _0x209a12;})[_0x3b4c('0x31')](function(_0x2c8316){if(_0x2c8316){return _0x2c8316[_0x3b4c('0x30')]({'closed':_0x3a42ae[_0x3b4c('0xbd')][_0x3b4c('0xd0')],'disposition':_0x3a42ae['body'][_0x3b4c('0xd1')]})[_0x3b4c('0x31')](function(_0x2022bc){return _0x2022bc;});}})['then'](function(_0xa7fb6b){return respondWithRpcPromise(_0x3b4c('0xd2'),_0x3b4c('0xd3'),_0x3a42ae['body'],client9004);})[_0x3b4c('0x31')](respondWithResult(_0x281749,null))[_0x3b4c('0xb5')](handleError(_0x281749,null));};exports[_0x3b4c('0xd4')]=function(_0x52cfd0,_0x12845f,_0x12fd01){_0x52cfd0['body'][_0x3b4c('0x34')]=_0x52cfd0[_0x3b4c('0xd5')][_0x3b4c('0xd6')];_0x52cfd0['body']['basename']=_0x52cfd0[_0x3b4c('0xd5')][_0x3b4c('0xd7')];_0x52cfd0['body'][_0x3b4c('0x40')]=_0x52cfd0[_0x3b4c('0xd5')][_0x3b4c('0xd8')];return db[_0x3b4c('0xd9')]['create'](_0x52cfd0['body'])['then'](respondWithResult(_0x12845f,0xc9))[_0x3b4c('0xb5')](handleError(_0x12845f,null));};exports[_0x3b4c('0xda')]=function(_0x25af4f,_0x5af489,_0x53bf5c){return db[_0x3b4c('0x3d')][_0x3b4c('0xdb')]({'where':{'id':_0x25af4f[_0x3b4c('0xb7')]['id']},'raw':!![]})[_0x3b4c('0x31')](handleEntityNotFound(_0x5af489,null))[_0x3b4c('0x31')](function(_0x1bf2e2){if(_0x1bf2e2){if(_0x1bf2e2[_0x3b4c('0xd0')]){return _0x5af489[_0x3b4c('0x29')](0x193)['json']({'status':0x193,'message':_0x3b4c('0xdc')});}return db['Attachment'][_0x3b4c('0xdb')]({'where':{'id':_0x25af4f['query'][_0x3b4c('0xdd')]},'raw':!![]})['then'](handleEntityNotFound(_0x5af489,null));}})[_0x3b4c('0x31')](function(_0x2de478){if(_0x2de478){return _0x5af489['download'](path[_0x3b4c('0xde')](config[_0x3b4c('0xdf')],_0x3b4c('0xe0'),_0x2de478['basename']));}})[_0x3b4c('0xb5')](handleError(_0x5af489,null));};exports['close']=function(_0x56f7d0,_0x101b81){var _0xda4bc7=null;var _0x2fd9ac=null;var _0x73174e=null;var _0x5c7087=null;if(_0x56f7d0['body']['id']){delete _0x56f7d0[_0x3b4c('0xbd')]['id'];}if(_0x56f7d0[_0x3b4c('0xbd')][_0x3b4c('0xe1')]){_0x5c7087=path[_0x3b4c('0xde')](config[_0x3b4c('0xdf')],_0x3b4c('0xe2'),util[_0x3b4c('0xe3')](_0x3b4c('0xe4'),Date[_0x3b4c('0xe5')]()));_0x56f7d0['body'][_0x3b4c('0xe6')]=_0x5c7087;}return db['ChatInteraction'][_0x3b4c('0x65')]({'where':{'id':_0x56f7d0[_0x3b4c('0xb7')]['id']},'include':[{'model':db[_0x3b4c('0xcb')],'as':_0x3b4c('0xe7'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x3b4c('0x31')](handleEntityNotFound(_0x101b81,null))[_0x3b4c('0x31')](saveUpdates(_0x56f7d0[_0x3b4c('0xbd')],null))[_0x3b4c('0x31')](function(_0x52b83b){if(_0x52b83b){_0xda4bc7=_0x52b83b;return db[_0x3b4c('0xe8')]['find']({'where':{'id':_0xda4bc7[_0x3b4c('0x79')]}});}})['then'](function(_0x9c65bb){if(_0x9c65bb){_0x73174e=_0x9c65bb;return db['CmContact']['find']({'where':{'id':_0xda4bc7[_0x3b4c('0x6e')]}});}})['then'](function(_0x21360c){if(_0x21360c){_0x2fd9ac=_0x21360c;if(_0x5c7087){var _0x41f68f=null;for(var _0x305f63=0x1;_0x305f63<_0xda4bc7[_0x3b4c('0xe7')]['length'];++_0x305f63){_0x41f68f=_0xda4bc7['Messages'][_0x305f63];var _0x44f407=_0x41f68f[_0x3b4c('0x74')]?util[_0x3b4c('0xe3')]('%s%d',_0x73174e[_0x3b4c('0xe9')],_0x41f68f[_0x3b4c('0x74')]):_0x3b4c('0xea');var _0x520bb8=_0x56f7d0[_0x3b4c('0xbd')]['customer']||util[_0x3b4c('0xe3')]('%s%d',_0x3b4c('0xeb'),_0x41f68f[_0x3b4c('0x6e')]);switch(_0x73174e['agentIdentifier']){case _0x3b4c('0xec'):_0x44f407=_0x41f68f[_0x3b4c('0x74')]?util[_0x3b4c('0xe3')](_0x3b4c('0xed'),_0x73174e[_0x3b4c('0xe9')],_0x41f68f[_0x3b4c('0x74')]):_0x3b4c('0xea');break;case _0x3b4c('0xee'):_0x44f407=_0x41f68f[_0x3b4c('0x74')]?_0x41f68f[_0x3b4c('0x72')]['alias']||_0x41f68f[_0x3b4c('0x72')][_0x3b4c('0x37')]:_0x3b4c('0xea');break;case'agent_fullname':_0x44f407=_0x41f68f[_0x3b4c('0x74')]?_0x41f68f[_0x3b4c('0x72')][_0x3b4c('0x37')]:_0x3b4c('0xea');break;default:_0x44f407=_0x41f68f['UserId']?util[_0x3b4c('0xe3')](_0x3b4c('0xed'),_0x73174e[_0x3b4c('0xe9')],_0x41f68f['UserId']):_0x3b4c('0xea');}var _0x3dc2ff=util[_0x3b4c('0xe3')]('[%s]\x20%s:\x20%s\x0a',moment(_0x41f68f['createdAt'])[_0x3b4c('0xe3')](_0x3b4c('0xef')),_0x41f68f['direction']==='in'?_0x520bb8:_0x44f407,_0x41f68f[_0x3b4c('0xbd')]);if(!_0x41f68f[_0x3b4c('0xf0')]){fs[_0x3b4c('0xf1')](_0x5c7087,_0x3dc2ff);}}return db[_0x3b4c('0xf2')][_0x3b4c('0xdb')]({'where':{'service':!![]},'include':[{'model':db[_0x3b4c('0xf3')],'as':_0x3b4c('0xf4'),'raw':!![]}]});}}})['then'](function(_0x2819da){if(_0x2819da&&_0x2819da[_0x3b4c('0xf4')]&&_0x56f7d0[_0x3b4c('0xbd')]){var _0x12c0f3={'tls':{'rejectUnauthorized':![]}};if(_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xf5')]){_0x12c0f3[_0x3b4c('0xf5')]=_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xf5')];}else{_0x12c0f3[_0x3b4c('0xf6')]=_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xf6')];_0x12c0f3[_0x3b4c('0xf7')]=_0x2819da['Smtp']['port'];_0x12c0f3['secure']=_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xf8')];}if(_0x2819da[_0x3b4c('0xf4')]['authentication']){_0x12c0f3[_0x3b4c('0xf9')]={'user':_0x2819da['Smtp'][_0x3b4c('0x97')],'pass':_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xfa')]};}return respondWithRpcPromise('SendMail',_0x3b4c('0xfb'),{'account':_0x12c0f3,'message':{'from':util['format'](_0x3b4c('0xfc'),_0x2819da[_0x3b4c('0x34')],_0x2819da[_0x3b4c('0xfd')]||_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0x97')]),'to':_0x56f7d0[_0x3b4c('0xbd')][_0x3b4c('0xe1')],'subject':_0x3b4c('0xfe'),'text':util[_0x3b4c('0xe3')](_0x3b4c('0xff'),_0x56f7d0[_0x3b4c('0xbd')][_0x3b4c('0xe1')]),'attachments':[{'path':_0x5c7087}]}})['then'](function(){return _0xda4bc7;})['catch'](function(_0x403957){console[_0x3b4c('0x25')](_0x403957);});}else{return _0xda4bc7;}})['then'](respondWithStatusCode(_0x101b81,0xc8))[_0x3b4c('0xb5')](handleError(_0x101b81,null));};exports['addMessage']=function(_0x4ef0c2,_0x6b199d,_0x2a601c){return db['ChatMessage'][_0x3b4c('0x65')]({'where':{'id':_0x4ef0c2[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x6b199d,null))[_0x3b4c('0x31')](function(_0x589c63){if(_0x589c63){return _0x589c63[_0x3b4c('0x100')](_0x4ef0c2[_0x3b4c('0xbd')][_0x3b4c('0x101')],_[_0x3b4c('0x102')](_0x4ef0c2['body'],[_0x3b4c('0x101'),'id'])||{});}})[_0x3b4c('0x31')](respondWithResult(_0x6b199d,null))['catch'](handleError(_0x6b199d,null));};exports[_0x3b4c('0x103')]=function(_0x5f53e3,_0x150867,_0x5b1c42){var _0x30d86b={'raw':![],'where':{}};var _0x7c4960={};var _0x496959={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x3b4c('0xdb')]({'where':{'id':_0x5f53e3[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x150867,null))['then'](function(_0xbe9dd9){if(_0xbe9dd9){_0x7c4960[_0x3b4c('0x41')]=_[_0x3b4c('0xb8')](db[_0x3b4c('0xcb')][_0x3b4c('0x3e')]);_0x7c4960[_0x3b4c('0x42')]=_[_0x3b4c('0xb8')](_0x5f53e3[_0x3b4c('0x42')]);_0x7c4960[_0x3b4c('0x43')]=_['intersection'](_0x7c4960[_0x3b4c('0x41')],_0x7c4960[_0x3b4c('0x42')]);_0x30d86b[_0x3b4c('0x45')]=_[_0x3b4c('0x44')](_0x7c4960[_0x3b4c('0x41')],qs[_0x3b4c('0x46')](_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x46')]));_0x30d86b[_0x3b4c('0x45')]=_0x30d86b[_0x3b4c('0x45')]['length']?_0x30d86b[_0x3b4c('0x45')]:_0x7c4960[_0x3b4c('0x41')];if(!_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x48')](_0x3b4c('0x49'))){_0x30d86b['limit']=qs[_0x3b4c('0x2d')](_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x2d')]);_0x30d86b['offset']=qs['offset'](_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x2c')]);}_0x30d86b[_0x3b4c('0x4a')]=qs['sort'](_0x5f53e3[_0x3b4c('0x42')]['sort']);_0x30d86b['where']=qs[_0x3b4c('0x43')](_['pick'](_0x5f53e3['query'],_0x7c4960[_0x3b4c('0x43')]));_0x30d86b[_0x3b4c('0x4c')][_0x3b4c('0x104')]=_0xbe9dd9['id'];if(_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x87')]){_0x30d86b[_0x3b4c('0x4c')]=_['merge'](_0x30d86b[_0x3b4c('0x4c')],{'$or':_[_0x3b4c('0x36')](_0x30d86b[_0x3b4c('0x45')],function(_0xcceea7){var _0x3fcc60={};_0x3fcc60[_0xcceea7]={'$like':'%'+_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x87')]+'%'};return _0x3fcc60;})});}if(_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x7c')]){var _0x10c80f=_0x5f53e3['query'][_0x3b4c('0x7c')][_0x3b4c('0x6c')](',');var _0x4d725b={};_0x4d725b[_0x10c80f[0x0]]={'$gte':moment(_0x10c80f[0x1])[_0x3b4c('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30d86b[_0x3b4c('0x4c')]=_['merge'](_0x30d86b['where'],_0x4d725b);}_0x30d86b=_[_0x3b4c('0xa0')]({},_0x30d86b,_0x5f53e3[_0x3b4c('0xbb')]);return db[_0x3b4c('0xcb')][_0x3b4c('0x9f')]({'where':_0x30d86b[_0x3b4c('0x4c')]})['then'](function(_0x57acff){_0x496959[_0x3b4c('0x9f')]=_0x57acff;if(_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0xb9')]){_0x30d86b[_0x3b4c('0xba')]=[{'all':!![]}];}return db[_0x3b4c('0xcb')][_0x3b4c('0x105')](_0x30d86b);})[_0x3b4c('0x31')](function(_0x5e0cbb){_0x496959[_0x3b4c('0x106')]=_0x5e0cbb;return _0x496959;});}})[_0x3b4c('0x31')](respondWithFilteredResult(_0x150867,_0x30d86b))[_0x3b4c('0xb5')](handleError(_0x150867,null));};exports[_0x3b4c('0x107')]=function(_0x215d93,_0x5e62c9,_0xb0b907){var _0x4807bf={'where':{}},_0xc8eee9={},_0x2b0909={'count':0x0,'rows':[]};return db[_0x3b4c('0x3d')][_0x3b4c('0xdb')]({'where':{'id':_0x215d93[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x5e62c9,null))[_0x3b4c('0x31')](function(_0x2cc80c){if(_0x2cc80c){_0xc8eee9[_0x3b4c('0x41')]=_[_0x3b4c('0xb8')](db[_0x3b4c('0xcb')]['rawAttributes']);_0xc8eee9[_0x3b4c('0x42')]=_[_0x3b4c('0xb8')](_0x215d93[_0x3b4c('0x42')]);_0xc8eee9[_0x3b4c('0x43')]=_['intersection'](_0xc8eee9[_0x3b4c('0x41')],_0xc8eee9[_0x3b4c('0x42')]);_0x4807bf[_0x3b4c('0x45')]=_[_0x3b4c('0x44')](_0xc8eee9[_0x3b4c('0x41')],qs['fields'](_0x215d93[_0x3b4c('0x42')]['fields']));_0x4807bf['attributes']=_0x4807bf[_0x3b4c('0x45')]['length']?_0x4807bf[_0x3b4c('0x45')]:_0xc8eee9['model'];if(!_0x215d93[_0x3b4c('0x42')][_0x3b4c('0x48')](_0x3b4c('0x49'))){_0x4807bf[_0x3b4c('0x2d')]=qs[_0x3b4c('0x2d')](_0x215d93[_0x3b4c('0x42')]['limit']);_0x4807bf[_0x3b4c('0x2c')]=qs[_0x3b4c('0x2c')](_0x215d93[_0x3b4c('0x42')]['offset']);}_0x4807bf[_0x3b4c('0x4a')]=qs[_0x3b4c('0x4b')](_0x215d93['query']['sort']);_0x4807bf['where']=qs[_0x3b4c('0x43')](_['pick'](_0x215d93['query'],_0xc8eee9[_0x3b4c('0x43')]));_0x4807bf[_0x3b4c('0x4c')]['ChatInteractionId']=_0x2cc80c['id'];if(_0x215d93[_0x3b4c('0x42')][_0x3b4c('0x87')]){_0x4807bf['where']=_['merge'](_0x4807bf[_0x3b4c('0x4c')],{'$or':_['map'](_0x4807bf['attributes'],function(_0x68d79f){var _0x38bf8f={};_0x38bf8f[_0x68d79f]={'$like':'%'+_0x215d93['query'][_0x3b4c('0x87')]+'%'};return _0x38bf8f;})});}_0x4807bf[_0x3b4c('0x4c')][_0x3b4c('0xf0')]=![];if(_0x215d93[_0x3b4c('0x42')]['id']){_0x4807bf[_0x3b4c('0x4c')]['id']={'$gt':_0x215d93[_0x3b4c('0x42')]['id']};}_0x4807bf=_['merge']({},_0x4807bf,_0x215d93[_0x3b4c('0xbb')]);return db['ChatMessage'][_0x3b4c('0x9f')]({'where':_0x4807bf['where']})[_0x3b4c('0x31')](function(_0x398810){_0x2b0909[_0x3b4c('0x9f')]=_0x398810;_0x4807bf[_0x3b4c('0xba')]=[];if(_0x215d93[_0x3b4c('0x42')]['includeAgent']){_0x4807bf[_0x3b4c('0xba')][_0x3b4c('0x3b')]({'model':db[_0x3b4c('0x72')],'as':_0x3b4c('0x72'),'attributes':['id',_0x3b4c('0x37'),_0x3b4c('0x108')]});}if(_0x215d93[_0x3b4c('0x42')][_0x3b4c('0xb9')]){_0x4807bf[_0x3b4c('0xba')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4807bf);})[_0x3b4c('0x31')](function(_0x3713ab){_0x2b0909[_0x3b4c('0x106')]=_0x3713ab;return _0x2b0909;});}})[_0x3b4c('0x31')](respondWithFilteredResult(_0x5e62c9,_0x4807bf))[_0x3b4c('0xb5')](handleError(_0x5e62c9,null));};exports[_0x3b4c('0x109')]=function(_0x41c3a7,_0x264c8b,_0x4762f0){return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x41c3a7[_0x3b4c('0xb7')]['id']}})['then'](handleEntityNotFound(_0x264c8b,null))[_0x3b4c('0x31')](function(_0xa8ec8d){if(_0xa8ec8d){return _0xa8ec8d[_0x3b4c('0x10a')](_0x41c3a7['body'][_0x3b4c('0x101')],_[_0x3b4c('0x102')](_0x41c3a7[_0x3b4c('0xbd')],[_0x3b4c('0x101'),'id'])||{})[_0x3b4c('0x10b')](function(){return db[_0x3b4c('0x70')]['findAll']({'attributes':['id',_0x3b4c('0x34'),'color'],'where':{'id':_0x41c3a7[_0x3b4c('0xbd')][_0x3b4c('0x101')]}});})[_0x3b4c('0x31')](function(_0x1e871f){socket['emit']('chatInteractionTags:save',{'id':Number(_0x41c3a7[_0x3b4c('0xb7')]['id']),'tags':_0x1e871f||[]});return{'id':Number(_0x41c3a7[_0x3b4c('0xb7')]['id']),'tags':_0x1e871f||[]};});}})['then'](respondWithResult(_0x264c8b,null))[_0x3b4c('0xb5')](handleError(_0x264c8b,null));};exports[_0x3b4c('0x10c')]=function(_0x2902fc,_0x3f91b9,_0x3f79f7){return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x2902fc[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x3f91b9,null))['then'](function(_0x1b1ba4){if(_0x1b1ba4){return _0x1b1ba4[_0x3b4c('0x10c')](_0x2902fc['query'][_0x3b4c('0x101')]);}})[_0x3b4c('0x31')](respondWithStatusCode(_0x3f91b9,null))[_0x3b4c('0xb5')](handleError(_0x3f91b9,null));};exports[_0x3b4c('0x10d')]=function(_0x1b7d1f,_0x210d93){var _0x482393=moment()[_0x3b4c('0x10e')]()[_0x3b4c('0x9e')]();var _0x215b92=path[_0x3b4c('0xde')](config['root'],_0x3b4c('0x10f'),_0x3b4c('0x110'),_0x3b4c('0x111'));var _0x289db2=path[_0x3b4c('0xde')](config[_0x3b4c('0xdf')],_0x3b4c('0x10f'),_0x3b4c('0x110'),_0x3b4c('0x112'));var _0x2c4101=path[_0x3b4c('0xde')](_0x215b92,_0x482393);var _0x315fb3=util[_0x3b4c('0xe3')]('transcript-%d-%s.zip',_0x1b7d1f[_0x3b4c('0xb7')]['id'],_0x482393);var _0x5d4316=path[_0x3b4c('0xde')](_0x215b92,_0x315fb3);var _0x283c77=[];_0x283c77[_0x3b4c('0x3b')]({'model':db[_0x3b4c('0x72')],'as':'User','attributes':['id',_0x3b4c('0x37')],'raw':!![]});_0x283c77[_0x3b4c('0x3b')]({'model':db[_0x3b4c('0x113')],'as':'Contact','attributes':['id',_0x3b4c('0x114'),_0x3b4c('0x115')],'raw':!![]});if(_0x1b7d1f[_0x3b4c('0x42')]['attachments']){_0x283c77[_0x3b4c('0x3b')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x31f95e=[{'model':db[_0x3b4c('0xcb')],'as':_0x3b4c('0xe7'),'attributes':['id',_0x3b4c('0xbd'),_0x3b4c('0x7a'),_0x3b4c('0x116'),_0x3b4c('0xf0'),_0x3b4c('0x82')],'include':_0x283c77}];_0x31f95e['push']({'model':db[_0x3b4c('0xe8')],'as':'Account','attributes':['id',_0x3b4c('0x34')]});_0x31f95e[_0x3b4c('0x3b')]({'model':db[_0x3b4c('0x72')],'as':_0x3b4c('0x117'),'attributes':['id','fullname']});return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x1b7d1f[_0x3b4c('0xb7')]['id']},'include':_0x31f95e})[_0x3b4c('0x31')](handleEntityNotFound(_0x210d93,null))[_0x3b4c('0x31')](function(_0x37662b){if(_0x37662b){var _0x22d0b4=_0x37662b[_0x3b4c('0x118')]({'plain':!![]});fs[_0x3b4c('0x119')](_0x2c4101);var _0x2e4a88={'format':'A4','border':'10px','header':{'height':_0x3b4c('0x11a'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x3b4c('0x11b'),'contents':{'default':util[_0x3b4c('0xe3')](_0x3b4c('0x11c'),util[_0x3b4c('0xe3')](_0x3b4c('0x11d'),_0x3b4c('0x11e'),_0x22d0b4['id']),moment()[_0x3b4c('0xe3')](_0x3b4c('0x11f'))[_0x3b4c('0x9e')]())}}};var _0x3e02bc={'channel':_0x3b4c('0x11e'),'account':_0x22d0b4[_0x3b4c('0x120')]['name'],'agent':_0x22d0b4[_0x3b4c('0x117')]?_0x22d0b4[_0x3b4c('0x117')]['fullname']:'N.A.','createdAt':moment(_0x22d0b4['createdAt'])[_0x3b4c('0xe3')](_0x3b4c('0x121'))['toString'](),'closedAt':_0x22d0b4[_0x3b4c('0xd0')]?moment(_0x22d0b4[_0x3b4c('0x122')])[_0x3b4c('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3b4c('0x9e')]():'','disposition':_0x22d0b4[_0x3b4c('0xd1')],'chatInfo':{'browser':_0x22d0b4[_0x3b4c('0x123')],'os':_0x22d0b4['osName'],'referer':_0x22d0b4[_0x3b4c('0x124')],'customerIp':_0x22d0b4[_0x3b4c('0x125')],'customerPort':_0x22d0b4[_0x3b4c('0x126')]?_0x22d0b4['customerPort']:_0x3b4c('0x127')},'messages':_(_0x22d0b4[_0x3b4c('0xe7')])[_0x3b4c('0x128')]()[_0x3b4c('0x87')]({'secret':![]})['map'](function(_0x21a6b6){if(_0x21a6b6['Attachment']){var _0x5f3f1f=path['join'](_0x289db2,_0x21a6b6[_0x3b4c('0xd9')][_0x3b4c('0x129')]);if(fs['existsSync'](_0x5f3f1f)){fs['createReadStream'](_0x5f3f1f)[_0x3b4c('0x12a')](fs[_0x3b4c('0x12b')](path[_0x3b4c('0xde')](_0x2c4101,_0x21a6b6[_0x3b4c('0xd9')][_0x3b4c('0x129')])));}}return{'date':moment(_0x21a6b6[_0x3b4c('0x7a')])[_0x3b4c('0xe3')](_0x3b4c('0x121'))['toString'](),'sender':_0x21a6b6[_0x3b4c('0x116')]==='out'?_0x21a6b6['User']?_0x21a6b6[_0x3b4c('0x72')][_0x3b4c('0x37')]:_0x3b4c('0xea'):_0x21a6b6[_0x3b4c('0x12c')][_0x3b4c('0x114')]+(_0x21a6b6[_0x3b4c('0x12c')][_0x3b4c('0x115')]?'\x20'+_0x21a6b6[_0x3b4c('0x12c')]['lastName']:''),'body':_0x21a6b6[_0x3b4c('0xd9')]?_0x21a6b6[_0x3b4c('0xd9')]['basename']:_0x21a6b6[_0x3b4c('0xbd')],'direction':_0x21a6b6[_0x3b4c('0x116')]===_0x3b4c('0xca')?'A':'C','secret':_0x21a6b6[_0x3b4c('0xf0')],'read':_0x21a6b6['read'],'attachment':_0x21a6b6['Attachment']};})['value']()};return ejs['renderFile'](path[_0x3b4c('0xde')](config[_0x3b4c('0xdf')],_0x3b4c('0x10f'),'views',_0x3b4c('0x12d')),{'interaction':_0x3e02bc})['then'](function(_0x2b7c29){return new BPromise(function(_0x297acb,_0xc95dfa){pdf['create'](_0x2b7c29,_0x2e4a88)[_0x3b4c('0x12e')](path[_0x3b4c('0xde')](_0x2c4101,'transcript-'+_0x22d0b4['id']+'-'+_0x482393+'.pdf'),function(_0x3f2e23,_0x1739b5){if(_0x3f2e23)return _0xc95dfa(_0x3f2e23);_0x297acb(_0x1739b5);});});})['then'](function(){return new BPromise(function(_0x356c83,_0x24cc96){zipdir(_0x2c4101,{'saveTo':_0x5d4316},function(_0x11c2b4,_0x1c825e){if(_0x11c2b4)return _0x24cc96(_0x11c2b4);return _0x356c83(_0x1c825e);});})[_0x3b4c('0x31')](function(){return new BPromise(function(_0x206695,_0x4d9887){rimraf(_0x2c4101,function(_0x382c52){if(_0x382c52)_0x4d9887(_0x382c52);return _0x206695();});});})[_0x3b4c('0x31')](function(){return _0x210d93[_0x3b4c('0x10d')](_0x5d4316,_0x315fb3,function(_0x5c6d05){if(_0x5c6d05){console[_0x3b4c('0x12f')](_0x3b4c('0x130'),_0x5c6d05);}else{fs[_0x3b4c('0x131')](_0x5d4316);}});});});}else{return _0x210d93[_0x3b4c('0x32')](0xc8);}})[_0x3b4c('0xb5')](handleError(_0x210d93,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 0909393..0cc905d 100644 --- a/server/api/chatInteraction/chatInteraction.events.js +++ b/server/api/chatInteraction/chatInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3336=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x2b8f78,_0x18ba80){var _0x3b1d8c=function(_0x3eb3cd){while(--_0x3eb3cd){_0x2b8f78['push'](_0x2b8f78['shift']());}};_0x3b1d8c(++_0x18ba80);}(_0x3336,0x106));var _0x6333=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x3336[_0x15b399];return _0x199f2d;};'use strict';var EventEmitter=require(_0x6333('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x6333('0x1'))['db'][_0x6333('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6333('0x3')](0x0);var events={'afterCreate':_0x6333('0x4'),'afterUpdate':_0x6333('0x5'),'afterDestroy':_0x6333('0x6')};function emitEvent(_0x4c920e){return function(_0xe53ff0,_0x93f57b,_0x2934da){_0xe53ff0[_0x6333('0x7')]({'attributes':['id'],'raw':!![]})[_0x6333('0x8')](function(_0x2ea717){_0xe53ff0[_0x6333('0x9')](_0x6333('0xa'),_0x2ea717[_0x6333('0xb')](function(_0x5d04f7){return{'id':_0x5d04f7['id']};}));return ChatMessage[_0x6333('0xc')]({'where':{'ChatInteractionId':_0xe53ff0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6333('0x8')](function(_0x1e015e){_0xe53ff0[_0x6333('0x9')](_0x6333('0xd'),_0x1e015e[_0x6333('0xe')]);ChatInteractionEvents[_0x6333('0xf')](_0x4c920e+':'+_0xe53ff0['id'],_0xe53ff0);ChatInteractionEvents[_0x6333('0xf')](_0x4c920e,_0xe53ff0);_0x2934da(null);})[_0x6333('0x10')](_0x2934da(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x6333('0x11')](e,emitEvent(event));}}module[_0x6333('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0xdce9=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','hook','exports','events'];(function(_0x1fcf30,_0x221e1b){var _0x3c7c3d=function(_0x2bcc14){while(--_0x2bcc14){_0x1fcf30['push'](_0x1fcf30['shift']());}};_0x3c7c3d(++_0x221e1b);}(_0xdce9,0x1e5));var _0x9dce=function(_0x308a14,_0xab44bf){_0x308a14=_0x308a14-0x0;var _0x46c3a4=_0xdce9[_0x308a14];return _0x46c3a4;};'use strict';var EventEmitter=require(_0x9dce('0x0'));var ChatInteraction=require(_0x9dce('0x1'))['db'][_0x9dce('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x9dce('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9dce('0x4')](0x0);var events={'afterCreate':_0x9dce('0x5'),'afterUpdate':_0x9dce('0x6'),'afterDestroy':_0x9dce('0x7')};function emitEvent(_0x1ed2dd){return function(_0x423d37,_0x58b009,_0x1dde23){_0x423d37['getUsers']({'attributes':['id'],'raw':!![]})[_0x9dce('0x8')](function(_0x2e79ee){_0x423d37[_0x9dce('0x9')](_0x9dce('0xa'),_0x2e79ee[_0x9dce('0xb')](function(_0x6747b0){return{'id':_0x6747b0['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x423d37['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9dce('0x8')](function(_0x303d46){_0x423d37['setDataValue'](_0x9dce('0xc'),_0x303d46[_0x9dce('0xd')]);ChatInteractionEvents[_0x9dce('0xe')](_0x1ed2dd+':'+_0x423d37['id'],_0x423d37);ChatInteractionEvents[_0x9dce('0xe')](_0x1ed2dd,_0x423d37);_0x1dde23(null);})['catch'](_0x1dde23(null));};}for(var e in events){if(events[_0x9dce('0xf')](e)){var event=events[e];ChatInteraction[_0x9dce('0x10')](e,emitEvent(event));}}module[_0x9dce('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 864273d..9a1606a 100644 --- a/server/api/chatInteraction/chatInteraction.model.js +++ b/server/api/chatInteraction/chatInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68cf=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','exports','define','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3625d5,_0x4b3766){var _0x1a6816=function(_0x226008){while(--_0x226008){_0x3625d5['push'](_0x3625d5['shift']());}};_0x1a6816(++_0x4b3766);}(_0x68cf,0x11f));var _0xf68c=function(_0x24ba17,_0x3a80eb){_0x24ba17=_0x24ba17-0x0;var _0x158af4=_0x68cf[_0x24ba17];return _0x158af4;};'use strict';var _=require(_0xf68c('0x0'));var util=require(_0xf68c('0x1'));var logger=require(_0xf68c('0x2'))(_0xf68c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf68c('0x4'));var rimraf=require(_0xf68c('0x5'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0xf68c('0x6')]=function(_0x2d8d8e,_0x5675b2){return _0x2d8d8e[_0xf68c('0x7')]('ChatInteraction',attributes,{'tableName':_0xf68c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x114827,_0xc375b,_0x43ffb6){if(_0x114827[_0xf68c('0x9')](_0xf68c('0xa'))){_0x114827[_0xf68c('0xb')]=moment()['format'](_0xf68c('0xc'));}_0x43ffb6(null,_0x114827);}},'charset':_0xf68c('0xd'),'collate':_0xf68c('0xe')});}; \ No newline at end of file +var _0xb780=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xb780,0x1b5));var _0x0b78=function(_0x529fa3,_0x507a9c){_0x529fa3=_0x529fa3-0x0;var _0x42f497=_0xb780[_0x529fa3];return _0x42f497;};'use strict';var _=require(_0x0b78('0x0'));var util=require('util');var logger=require(_0x0b78('0x1'))(_0x0b78('0x2'));var moment=require(_0x0b78('0x3'));var BPromise=require(_0x0b78('0x4'));var rp=require(_0x0b78('0x5'));var fs=require('fs');var path=require(_0x0b78('0x6'));var rimraf=require(_0x0b78('0x7'));var config=require('../../config/environment');var attributes=require(_0x0b78('0x8'));module['exports']=function(_0x8b75a3,_0x46e6c7){return _0x8b75a3[_0x0b78('0x9')](_0x0b78('0xa'),attributes,{'tableName':_0x0b78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a2264,_0x298485,_0x5e321b){if(_0x1a2264[_0x0b78('0xc')](_0x0b78('0xd'))){_0x1a2264[_0x0b78('0xe')]=moment()[_0x0b78('0xf')](_0x0b78('0x10'));}_0x5e321b(null,_0x1a2264);}},'charset':'utf8mb4','collate':_0x0b78('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4411b23..5bf0ec5 100644 --- a/server/api/chatInteraction/chatInteraction.rpc.js +++ b/server/api/chatInteraction/chatInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a38=['../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','AddTagsToChatInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x148721,_0x1713ad){var _0x414045=function(_0x5bab20){while(--_0x5bab20){_0x148721['push'](_0x148721['shift']());}};_0x414045(++_0x1713ad);}(_0x1a38,0x1a5));var _0x81a3=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x1a38[_0x5d30b4];return _0x1acfb8;};'use strict';var _=require(_0x81a3('0x0'));var util=require(_0x81a3('0x1'));var moment=require(_0x81a3('0x2'));var BPromise=require(_0x81a3('0x3'));var rs=require(_0x81a3('0x4'));var fs=require('fs');var Redis=require(_0x81a3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x81a3('0x6'));var logger=require(_0x81a3('0x7'))(_0x81a3('0x8'));var config=require(_0x81a3('0x9'));var jayson=require(_0x81a3('0xa'));var client=jayson[_0x81a3('0xb')][_0x81a3('0xc')]({'port':0x232a});config['redis']=_[_0x81a3('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x81a3('0xe'))(new Redis(config[_0x81a3('0xf')]));require(_0x81a3('0x10'))[_0x81a3('0x11')](socket);function respondWithRpcPromise(_0x1bd2ad,_0x7f8c4f,_0x18c609){return new BPromise(function(_0x2b20e7,_0x106ec1){return client['request'](_0x1bd2ad,_0x18c609)[_0x81a3('0x12')](function(_0x583147){logger['info'](_0x81a3('0x13'),_0x7f8c4f,'request\x20sent');logger[_0x81a3('0x14')](_0x81a3('0x15'),_0x7f8c4f,_0x81a3('0x16'),JSON[_0x81a3('0x17')](_0x583147));if(_0x583147[_0x81a3('0x18')]){if(_0x583147['error']['code']===0x1f4){logger[_0x81a3('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x7f8c4f,_0x583147[_0x81a3('0x18')][_0x81a3('0x19')]);return _0x106ec1(_0x583147[_0x81a3('0x18')][_0x81a3('0x19')]);}logger[_0x81a3('0x18')](_0x81a3('0x13'),_0x7f8c4f,_0x583147['error'][_0x81a3('0x19')]);return _0x2b20e7(_0x583147[_0x81a3('0x18')]['message']);}else{logger[_0x81a3('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x7f8c4f,_0x81a3('0x16'));_0x2b20e7(_0x583147[_0x81a3('0x1b')][_0x81a3('0x19')]);}})[_0x81a3('0x1c')](function(_0x1ec024){logger[_0x81a3('0x18')](_0x81a3('0x13'),_0x7f8c4f,_0x1ec024);_0x106ec1(_0x1ec024);});});}exports[_0x81a3('0x1d')]=function(_0x5e6be8){var _0x638da=this;return new Promise(function(_0x53cfe1,_0x2e9257){return db[_0x81a3('0x1e')][_0x81a3('0x1f')](_0x5e6be8[_0x81a3('0x20')],{'raw':_0x5e6be8['options']?_0x5e6be8[_0x81a3('0x21')][_0x81a3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6be8[_0x81a3('0x21')]?_0x5e6be8['options'][_0x81a3('0x23')]||null:null,'attributes':_0x5e6be8[_0x81a3('0x21')]?_0x5e6be8[_0x81a3('0x21')][_0x81a3('0x24')]||null:null,'limit':_0x5e6be8[_0x81a3('0x21')]?_0x5e6be8[_0x81a3('0x21')]['limit']||null:null})[_0x81a3('0x12')](function(_0x5c539b){logger['info'](_0x81a3('0x1d'),_0x5e6be8);logger[_0x81a3('0x14')](_0x81a3('0x1d'),_0x5e6be8,JSON[_0x81a3('0x17')](_0x5c539b));_0x53cfe1(_0x5c539b);})['catch'](function(_0x24878f){logger[_0x81a3('0x18')]('UpdateChatInteraction',_0x24878f['message'],_0x5e6be8);_0x2e9257(_0x638da['error'](0x1f4,_0x24878f[_0x81a3('0x19')]));});});};exports[_0x81a3('0x25')]=function(_0x57dbea){return new Promise(function(_0x133eff,_0x21839a){return db[_0x81a3('0x1e')]['find']({'where':_0x57dbea['options']?_0x57dbea[_0x81a3('0x21')][_0x81a3('0x23')]||null:null})['then'](function(_0x81b7fd){if(_0x81b7fd){return _0x81b7fd[_0x81a3('0x26')](_0x57dbea[_0x81a3('0x20')][_0x81a3('0x27')],_[_0x81a3('0x28')](_0x57dbea[_0x81a3('0x20')],[_0x81a3('0x27'),'id'])||{});}})[_0x81a3('0x29')](function(_0xf241fd){logger['info'](_0x81a3('0x2a'),_0x57dbea);logger[_0x81a3('0x14')](_0x81a3('0x2a'),_0x57dbea,JSON[_0x81a3('0x17')](_0xf241fd));_0x133eff(_0xf241fd);})[_0x81a3('0x1c')](function(_0x389f24){logger[_0x81a3('0x18')]('AddTags',_0x389f24['message'],_0x57dbea);_0x21839a(_this[_0x81a3('0x18')](0x1f4,_0x389f24['message']));});});}; \ No newline at end of file +var _0x425c=['ChatInteraction,\x20%s,\x20%s','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','debug','AddTagsToChatInteraction','addTags','omit','ids','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x57f74a,_0x3f8b13){var _0x15b677=function(_0x332610){while(--_0x332610){_0x57f74a['push'](_0x57f74a['shift']());}};_0x15b677(++_0x3f8b13);}(_0x425c,0x1ed));var _0xc425=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x425c[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xc425('0x0'));var util=require(_0xc425('0x1'));var moment=require(_0xc425('0x2'));var BPromise=require(_0xc425('0x3'));var rs=require(_0xc425('0x4'));var fs=require('fs');var Redis=require(_0xc425('0x5'));var db=require(_0xc425('0x6'))['db'];var utils=require(_0xc425('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc425('0x8'));var jayson=require(_0xc425('0x9'));var client=jayson[_0xc425('0xa')][_0xc425('0xb')]({'port':0x232a});config[_0xc425('0xc')]=_[_0xc425('0xd')](config['redis'],{'host':_0xc425('0xe'),'port':0x18eb});var socket=require(_0xc425('0xf'))(new Redis(config[_0xc425('0xc')]));require(_0xc425('0x10'))[_0xc425('0x11')](socket);function respondWithRpcPromise(_0x51540c,_0x235077,_0x3fd493){return new BPromise(function(_0x873831,_0x50e353){return client['request'](_0x51540c,_0x3fd493)[_0xc425('0x12')](function(_0x8c6da7){logger[_0xc425('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x235077,_0xc425('0x14'));logger['debug'](_0xc425('0x15'),_0x235077,_0xc425('0x14'),JSON['stringify'](_0x8c6da7));if(_0x8c6da7['error']){if(_0x8c6da7[_0xc425('0x16')]['code']===0x1f4){logger[_0xc425('0x16')](_0xc425('0x17'),_0x235077,_0x8c6da7['error']['message']);return _0x50e353(_0x8c6da7[_0xc425('0x16')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x235077,_0x8c6da7[_0xc425('0x16')][_0xc425('0x18')]);return _0x873831(_0x8c6da7[_0xc425('0x16')][_0xc425('0x18')]);}else{logger[_0xc425('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x235077,_0xc425('0x14'));_0x873831(_0x8c6da7[_0xc425('0x19')]['message']);}})[_0xc425('0x1a')](function(_0x53738c){logger[_0xc425('0x16')](_0xc425('0x17'),_0x235077,_0x53738c);_0x50e353(_0x53738c);});});}exports['UpdateChatInteraction']=function(_0x30724f){var _0x112120=this;return new Promise(function(_0x4c3c09,_0x360234){return db['ChatInteraction'][_0xc425('0x1b')](_0x30724f[_0xc425('0x1c')],{'raw':_0x30724f[_0xc425('0x1d')]?_0x30724f[_0xc425('0x1d')][_0xc425('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30724f[_0xc425('0x1d')]?_0x30724f['options'][_0xc425('0x1f')]||null:null,'attributes':_0x30724f['options']?_0x30724f[_0xc425('0x1d')][_0xc425('0x20')]||null:null,'limit':_0x30724f['options']?_0x30724f[_0xc425('0x1d')][_0xc425('0x21')]||null:null})['then'](function(_0xf11511){logger[_0xc425('0x13')](_0xc425('0x22'),_0x30724f);logger[_0xc425('0x23')](_0xc425('0x22'),_0x30724f,JSON['stringify'](_0xf11511));_0x4c3c09(_0xf11511);})[_0xc425('0x1a')](function(_0x339129){logger[_0xc425('0x16')](_0xc425('0x22'),_0x339129[_0xc425('0x18')],_0x30724f);_0x360234(_0x112120[_0xc425('0x16')](0x1f4,_0x339129[_0xc425('0x18')]));});});};exports[_0xc425('0x24')]=function(_0xd19ccc){return new Promise(function(_0x2153ee,_0x4c8e12){return db['ChatInteraction']['find']({'where':_0xd19ccc[_0xc425('0x1d')]?_0xd19ccc['options']['where']||null:null})[_0xc425('0x12')](function(_0x1d2423){if(_0x1d2423){return _0x1d2423[_0xc425('0x25')](_0xd19ccc[_0xc425('0x1c')]['ids'],_[_0xc425('0x26')](_0xd19ccc[_0xc425('0x1c')],[_0xc425('0x27'),'id'])||{});}})[_0xc425('0x28')](function(_0x5b3364){logger[_0xc425('0x13')]('AddTags',_0xd19ccc);logger[_0xc425('0x23')](_0xc425('0x29'),_0xd19ccc,JSON[_0xc425('0x2a')](_0x5b3364));_0x2153ee(_0x5b3364);})[_0xc425('0x1a')](function(_0x4ad857){logger[_0xc425('0x16')](_0xc425('0x29'),_0x4ad857[_0xc425('0x18')],_0xd19ccc);_0x4c8e12(_this[_0xc425('0x16')](0x1f4,_0x4ad857[_0xc425('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index bba16ec..44c565d 100644 --- a/server/api/chatInteraction/chatInteraction.socket.js +++ b/server/api/chatInteraction/chatInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf36b=['length','chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener','register'];(function(_0x30983f,_0x4e86d5){var _0x335626=function(_0x1f53f5){while(--_0x1f53f5){_0x30983f['push'](_0x30983f['shift']());}};_0x335626(++_0x4e86d5);}(_0xf36b,0x122));var _0xbf36=function(_0x43c7cd,_0x349ab0){_0x43c7cd=_0x43c7cd-0x0;var _0x3da32f=_0xf36b[_0x43c7cd];return _0x3da32f;};'use strict';var ChatInteractionEvents=require(_0xbf36('0x0'));var events=['save',_0xbf36('0x1'),_0xbf36('0x2')];function createListener(_0x73cd19,_0x575718){return function(_0x4aac95){_0x575718[_0xbf36('0x3')](_0x73cd19,_0x4aac95);};}function removeListener(_0x24df86,_0x4ae590){return function(){ChatInteractionEvents[_0xbf36('0x4')](_0x24df86,_0x4ae590);};}exports[_0xbf36('0x5')]=function(_0x22227b){for(var _0x3d6fc0=0x0,_0x2a48e9=events[_0xbf36('0x6')];_0x3d6fc0<_0x2a48e9;_0x3d6fc0++){var _0x101234=events[_0x3d6fc0];var _0x325230=createListener(_0xbf36('0x7')+_0x101234,_0x22227b);ChatInteractionEvents['on'](_0x101234,_0x325230);}}; \ No newline at end of file +var _0x7243=['emit','register','length','chatInteraction:','./chatInteraction.events','save','update'];(function(_0x41923f,_0x1fe455){var _0x5022dc=function(_0x2051c3){while(--_0x2051c3){_0x41923f['push'](_0x41923f['shift']());}};_0x5022dc(++_0x1fe455);}(_0x7243,0xba));var _0x3724=function(_0x3647d8,_0x1d1c2f){_0x3647d8=_0x3647d8-0x0;var _0x1b9d0b=_0x7243[_0x3647d8];return _0x1b9d0b;};'use strict';var ChatInteractionEvents=require(_0x3724('0x0'));var events=[_0x3724('0x1'),'remove',_0x3724('0x2')];function createListener(_0x269798,_0x507e6b){return function(_0x182613){_0x507e6b[_0x3724('0x3')](_0x269798,_0x182613);};}function removeListener(_0x3714ae,_0x3897be){return function(){ChatInteractionEvents['removeListener'](_0x3714ae,_0x3897be);};}exports[_0x3724('0x4')]=function(_0x14927f){for(var _0x1c2f49=0x0,_0x3ad51=events[_0x3724('0x5')];_0x1c2f49<_0x3ad51;_0x1c2f49++){var _0x1d86bc=events[_0x1c2f49];var _0x537a5e=createListener(_0x3724('0x6')+_0x1d86bc,_0x14927f);ChatInteractionEvents['on'](_0x1d86bc,_0x537a5e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ed7845b..31b4801 100644 --- a/server/api/chatInteraction/index.js +++ b/server/api/chatInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24b4=['chatinteraction:update','update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put'];(function(_0x5b47d9,_0x1327ce){var _0x4151f0=function(_0x24bda2){while(--_0x24bda2){_0x5b47d9['push'](_0x5b47d9['shift']());}};_0x4151f0(++_0x1327ce);}(_0x24b4,0x192));var _0x424b=function(_0x3c74bd,_0x4a1b18){_0x3c74bd=_0x3c74bd-0x0;var _0x7c4f81=_0x24b4[_0x3c74bd];return _0x7c4f81;};'use strict';var multer=require(_0x424b('0x0'));var util=require(_0x424b('0x1'));var path=require('path');var timeout=require(_0x424b('0x2'));var express=require(_0x424b('0x3'));var router=express['Router']();var auth=require(_0x424b('0x4'));var interaction=require(_0x424b('0x5'));var config=require(_0x424b('0x6'));var controller=require(_0x424b('0x7'));router[_0x424b('0x8')]('/',auth['isAuthenticated'](),controller[_0x424b('0x9')]);router['get'](_0x424b('0xa'),auth[_0x424b('0xb')](),controller[_0x424b('0xc')]);router[_0x424b('0x8')](_0x424b('0xd'),auth[_0x424b('0xe')](),controller[_0x424b('0xf')]);router[_0x424b('0x8')](_0x424b('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x424b('0x11')]);router[_0x424b('0x8')](_0x424b('0x12'),auth[_0x424b('0xb')](),controller[_0x424b('0x13')]);router[_0x424b('0x8')](_0x424b('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x424b('0x15')]);router[_0x424b('0x8')](_0x424b('0x16'),auth[_0x424b('0xb')](),controller[_0x424b('0x17')]);router[_0x424b('0x18')]('/',auth[_0x424b('0xb')](),controller[_0x424b('0x19')]);router[_0x424b('0x18')](_0x424b('0x1a'),auth['isAuthenticated'](),controller[_0x424b('0x1b')]);var upload=multer({'storage':multer[_0x424b('0x1c')]({'destination':function(_0x2d1ebd,_0x2b2bed,_0x950ade){_0x950ade(null,path[_0x424b('0x1d')](config[_0x424b('0x1e')],_0x424b('0x1f')));},'filename':function(_0x192b43,_0x34b8c8,_0x278337){_0x278337(null,util[_0x424b('0x20')](_0x424b('0x21'),Date[_0x424b('0x22')](),_0x34b8c8[_0x424b('0x23')][_0x424b('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x424b('0x25')](_0x424b('0x26')),controller[_0x424b('0x27')]);router[_0x424b('0x18')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x424b('0x18')](_0x424b('0x28'),auth['isAuthenticated'](),interaction[_0x424b('0x29')](_0x424b('0x2a'),_0x424b('0x2b')),controller[_0x424b('0x2c')]);router[_0x424b('0x2d')]('/:id',auth[_0x424b('0xb')](),interaction['tracked'](_0x424b('0x2a'),_0x424b('0x2e')),controller[_0x424b('0x2f')]);router[_0x424b('0x2d')]('/:id/custom_update',controller[_0x424b('0x30')]);router[_0x424b('0x2d')]('/:id/abandon',auth[_0x424b('0xe')](),controller[_0x424b('0x31')]);router['put'](_0x424b('0x32'),controller[_0x424b('0x33')]);router[_0x424b('0x34')](_0x424b('0xd'),auth[_0x424b('0xb')](),interaction[_0x424b('0x29')](_0x424b('0x2a'),_0x424b('0x35')),controller[_0x424b('0x36')]);router['delete'](_0x424b('0x28'),auth[_0x424b('0xb')](),controller[_0x424b('0x37')]);module['exports']=router; \ No newline at end of file +var _0x3752=['chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','tracked','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','close','delete','chat'];(function(_0x4e12a2,_0x4afb09){var _0x3a1d3b=function(_0x2855d3){while(--_0x2855d3){_0x4e12a2['push'](_0x4e12a2['shift']());}};_0x3a1d3b(++_0x4afb09);}(_0x3752,0x112));var _0x2375=function(_0xb4bdb3,_0x48dca0){_0xb4bdb3=_0xb4bdb3-0x0;var _0x4c8c02=_0x3752[_0xb4bdb3];return _0x4c8c02;};'use strict';var multer=require('multer');var util=require(_0x2375('0x0'));var path=require(_0x2375('0x1'));var timeout=require(_0x2375('0x2'));var express=require(_0x2375('0x3'));var router=express[_0x2375('0x4')]();var auth=require(_0x2375('0x5'));var interaction=require(_0x2375('0x6'));var config=require(_0x2375('0x7'));var controller=require(_0x2375('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2375('0x9')]);router[_0x2375('0xa')](_0x2375('0xb'),auth[_0x2375('0xc')](),controller[_0x2375('0xd')]);router[_0x2375('0xa')](_0x2375('0xe'),auth[_0x2375('0xf')](),controller[_0x2375('0x10')]);router['get'](_0x2375('0x11'),auth[_0x2375('0xf')](),controller['attachmentDownload']);router['get'](_0x2375('0x12'),auth['isAuthenticated'](),controller[_0x2375('0x13')]);router[_0x2375('0xa')](_0x2375('0x14'),auth[_0x2375('0xf')](),controller['getMyMessages']);router['get'](_0x2375('0x15'),auth[_0x2375('0xc')](),controller[_0x2375('0x16')]);router[_0x2375('0x17')]('/',auth[_0x2375('0xc')](),controller[_0x2375('0x18')]);router[_0x2375('0x17')](_0x2375('0x19'),auth[_0x2375('0xc')](),controller[_0x2375('0x1a')]);var upload=multer({'storage':multer[_0x2375('0x1b')]({'destination':function(_0x4a7157,_0x3a91a6,_0x2650a7){_0x2650a7(null,path[_0x2375('0x1c')](config[_0x2375('0x1d')],_0x2375('0x1e')));},'filename':function(_0x17ba24,_0x8a2ede,_0x1c5762){_0x1c5762(null,util[_0x2375('0x1f')](_0x2375('0x20'),Date[_0x2375('0x21')](),_0x8a2ede[_0x2375('0x22')][_0x2375('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2375('0x17')](_0x2375('0x24'),upload[_0x2375('0x25')]('file'),controller[_0x2375('0x26')]);router[_0x2375('0x17')](_0x2375('0x12'),auth[_0x2375('0xf')](),controller['addMessage']);router[_0x2375('0x17')]('/:id/tags',auth[_0x2375('0xc')](),interaction[_0x2375('0x27')]('chat',_0x2375('0x28')),controller[_0x2375('0x29')]);router[_0x2375('0x2a')](_0x2375('0xe'),auth[_0x2375('0xc')](),interaction[_0x2375('0x27')]('chat','chatinteraction:update'),controller[_0x2375('0x2b')]);router['put'](_0x2375('0x2c'),controller[_0x2375('0x2d')]);router[_0x2375('0x2a')](_0x2375('0x2e'),auth[_0x2375('0xf')](),controller['abandon']);router[_0x2375('0x2a')]('/:id/close',controller[_0x2375('0x2f')]);router[_0x2375('0x30')](_0x2375('0xe'),auth[_0x2375('0xc')](),interaction[_0x2375('0x27')](_0x2375('0x31'),_0x2375('0x32')),controller[_0x2375('0x33')]);router['delete']('/:id/tags',auth[_0x2375('0xc')](),controller[_0x2375('0x34')]);module[_0x2375('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 73ffd09..1c0ef25 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x77d76e,_0x106ed2){_0x77d76e=_0x77d76e-0x0;var _0x5620c8=_0x0b0e[_0x77d76e];return _0x5620c8;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe0b0('0x3')]}}; \ No newline at end of file +var _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x2eee05,_0x2ba3f7){var _0x2aa6a8=function(_0x279144){while(--_0x279144){_0x2eee05['push'](_0x2eee05['shift']());}};_0x2aa6a8(++_0x2ba3f7);}(_0x57ca,0x108));var _0xa57c=function(_0x185934,_0x36c5e2){_0x185934=_0x185934-0x0;var _0x23daa9=_0x57ca[_0x185934];return _0x23daa9;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9c12edb..239166a 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.controller.js +++ b/server/api/chatInternalMessage/chatInternalMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadfc=['../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','ChatInternalMessage','count','includeAll','rows','catch','params','length','include','find','create','body','describe','get','createdAt','lastMessage','getUsers','User','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','findAll','isEmpty','agent','resourceId','push','FromId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5f48d4,_0x1bedc6){var _0x463662=function(_0x1673ed){while(--_0x1673ed){_0x5f48d4['push'](_0x5f48d4['shift']());}};_0x463662(++_0x1bedc6);}(_0xadfc,0xc0));var _0xcadf=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xadfc[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcadf('0x0'));var rimraf=require(_0xcadf('0x1'));var zipdir=require(_0xcadf('0x2'));var jsonpatch=require(_0xcadf('0x3'));var rp=require(_0xcadf('0x4'));var moment=require(_0xcadf('0x5'));var BPromise=require(_0xcadf('0x6'));var Mustache=require(_0xcadf('0x7'));var util=require('util');var path=require(_0xcadf('0x8'));var sox=require(_0xcadf('0x9'));var csv=require(_0xcadf('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcadf('0xb'));var squel=require(_0xcadf('0xc'));var crypto=require(_0xcadf('0xd'));var jsforce=require(_0xcadf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcadf('0xf'));var Redis=require(_0xcadf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcadf('0x11'));var as=require(_0xcadf('0x12'));var hardwareService=require(_0xcadf('0x13'));var logger=require(_0xcadf('0x14'))('api');var utils=require(_0xcadf('0x15'));var config=require(_0xcadf('0x16'));var licenseUtil=require(_0xcadf('0x17'));var db=require(_0xcadf('0x18'))['db'];config['redis']=_['defaults'](config[_0xcadf('0x19')],{'host':_0xcadf('0x1a'),'port':0x18eb});var socket=require(_0xcadf('0x1b'))(new Redis(config[_0xcadf('0x19')]));require(_0xcadf('0x1c'))['register'](socket);function respondWithStatusCode(_0x4b1e60,_0x278331){_0x278331=_0x278331||0xcc;return function(_0x282cf1){if(_0x282cf1){return _0x4b1e60[_0xcadf('0x1d')](_0x278331);}return _0x4b1e60[_0xcadf('0x1e')](_0x278331)[_0xcadf('0x1f')]();};}function respondWithResult(_0x3d3b0d,_0x5bb603){_0x5bb603=_0x5bb603||0xc8;return function(_0x2a606e){if(_0x2a606e){return _0x3d3b0d[_0xcadf('0x1e')](_0x5bb603)[_0xcadf('0x20')](_0x2a606e);}};}function respondWithFilteredResult(_0x445dea,_0xed3a9e){return function(_0x2fa175){if(_0x2fa175){var _0x310734=_0x2fa175['count'],_0x55115e=_0xed3a9e['offset'],_0x2a454a=_0xed3a9e[_0xcadf('0x21')]+_0xed3a9e[_0xcadf('0x22')],_0x5d8b0b;if(_0x2a454a>=_0x310734){_0x2a454a=_0x310734;_0x5d8b0b=0xc8;}else{_0x5d8b0b=0xce;}_0x445dea['status'](_0x5d8b0b);return _0x445dea[_0xcadf('0x23')](_0xcadf('0x24'),_0x55115e+'-'+_0x2a454a+'/'+_0x310734)[_0xcadf('0x20')](_0x2fa175);}return null;};}function patchUpdates(_0x254693){return function(_0x30ce82){try{jsonpatch['apply'](_0x30ce82,_0x254693,!![]);}catch(_0xd3589b){return BPromise[_0xcadf('0x25')](_0xd3589b);}return _0x30ce82[_0xcadf('0x26')]();};}function saveUpdates(_0x2afd18,_0x1ec1d1){return function(_0x432a02){if(_0x432a02){return _0x432a02[_0xcadf('0x27')](_0x2afd18)['then'](function(_0x1451d3){return _0x1451d3;});}return null;};}function removeEntity(_0x272ef0,_0x59f44b){return function(_0x1641bd){if(_0x1641bd){return _0x1641bd[_0xcadf('0x28')]()[_0xcadf('0x29')](function(){_0x272ef0[_0xcadf('0x1e')](0xcc)[_0xcadf('0x1f')]();});}};}function handleEntityNotFound(_0x322927,_0x4a79a5){return function(_0x46b2b6){if(!_0x46b2b6){_0x322927['sendStatus'](0x194);}return _0x46b2b6;};}function handleError(_0x4674f4,_0x3d8e66){_0x3d8e66=_0x3d8e66||0x1f4;return function(_0x1d75fb){logger[_0xcadf('0x2a')](_0x1d75fb['stack']);if(_0x1d75fb[_0xcadf('0x2b')]){delete _0x1d75fb[_0xcadf('0x2b')];}_0x4674f4[_0xcadf('0x1e')](_0x3d8e66)[_0xcadf('0x2c')](_0x1d75fb);};}exports[_0xcadf('0x2d')]=function(_0xefcf26,_0x3ae0cb){var _0x550e58={},_0x1b1df7={},_0x578a90={'count':0x0,'rows':[]};var _0x4b4549=_[_0xcadf('0x2e')](db['ChatInternalMessage'][_0xcadf('0x2f')],function(_0x176d51){return{'name':_0x176d51[_0xcadf('0x30')],'type':_0x176d51[_0xcadf('0x31')][_0xcadf('0x32')]};});_0x1b1df7[_0xcadf('0x33')]=_[_0xcadf('0x2e')](_0x4b4549,'name');_0x1b1df7[_0xcadf('0x34')]=_['keys'](_0xefcf26[_0xcadf('0x34')]);_0x1b1df7[_0xcadf('0x35')]=_[_0xcadf('0x36')](_0x1b1df7['model'],_0x1b1df7[_0xcadf('0x34')]);_0x550e58[_0xcadf('0x37')]=_[_0xcadf('0x36')](_0x1b1df7[_0xcadf('0x33')],qs[_0xcadf('0x38')](_0xefcf26[_0xcadf('0x34')][_0xcadf('0x38')]));_0x550e58[_0xcadf('0x37')]=_0x550e58['attributes']['length']?_0x550e58[_0xcadf('0x37')]:_0x1b1df7[_0xcadf('0x33')];if(!_0xefcf26['query'][_0xcadf('0x39')](_0xcadf('0x3a'))){_0x550e58[_0xcadf('0x22')]=qs[_0xcadf('0x22')](_0xefcf26[_0xcadf('0x34')]['limit']);_0x550e58['offset']=qs['offset'](_0xefcf26[_0xcadf('0x34')][_0xcadf('0x21')]);}_0x550e58[_0xcadf('0x3b')]=qs['sort'](_0xefcf26['query'][_0xcadf('0x3c')]);_0x550e58['where']=qs[_0xcadf('0x35')](_['pick'](_0xefcf26['query'],_0x1b1df7[_0xcadf('0x35')]),_0x4b4549);if(_0xefcf26[_0xcadf('0x34')]['filter']){_0x550e58[_0xcadf('0x3d')]=_[_0xcadf('0x3e')](_0x550e58['where'],{'$or':_[_0xcadf('0x2e')](_0x4b4549,function(_0x570e66){if(_0x570e66[_0xcadf('0x31')]!==_0xcadf('0x3f')){var _0x2794f9={};_0x2794f9[_0x570e66[_0xcadf('0x2b')]]={'$like':'%'+_0xefcf26[_0xcadf('0x34')][_0xcadf('0x40')]+'%'};return _0x2794f9;}})});}_0x550e58=_[_0xcadf('0x3e')]({},_0x550e58,_0xefcf26[_0xcadf('0x41')]);var _0x589394={'where':_0x550e58[_0xcadf('0x3d')]};return db[_0xcadf('0x42')][_0xcadf('0x43')](_0x589394)[_0xcadf('0x29')](function(_0x36fdb0){_0x578a90[_0xcadf('0x43')]=_0x36fdb0;if(_0xefcf26[_0xcadf('0x34')][_0xcadf('0x44')]){_0x550e58['include']=[{'all':!![]}];}return db[_0xcadf('0x42')]['findAll'](_0x550e58);})[_0xcadf('0x29')](function(_0x4236ac){_0x578a90[_0xcadf('0x45')]=_0x4236ac;return _0x578a90;})['then'](respondWithFilteredResult(_0x3ae0cb,_0x550e58))[_0xcadf('0x46')](handleError(_0x3ae0cb,null));};exports['show']=function(_0x32988f,_0x56d6c9){var _0x1b6eb1={'raw':!![],'where':{'id':_0x32988f[_0xcadf('0x47')]['id']}},_0xda9bd2={};_0xda9bd2['model']=_['keys'](db[_0xcadf('0x42')][_0xcadf('0x2f')]);_0xda9bd2['query']=_['keys'](_0x32988f[_0xcadf('0x34')]);_0xda9bd2[_0xcadf('0x35')]=_['intersection'](_0xda9bd2[_0xcadf('0x33')],_0xda9bd2[_0xcadf('0x34')]);_0x1b6eb1[_0xcadf('0x37')]=_[_0xcadf('0x36')](_0xda9bd2[_0xcadf('0x33')],qs[_0xcadf('0x38')](_0x32988f[_0xcadf('0x34')][_0xcadf('0x38')]));_0x1b6eb1[_0xcadf('0x37')]=_0x1b6eb1[_0xcadf('0x37')][_0xcadf('0x48')]?_0x1b6eb1[_0xcadf('0x37')]:_0xda9bd2['model'];if(_0x32988f['query'][_0xcadf('0x44')]){_0x1b6eb1[_0xcadf('0x49')]=[{'all':!![]}];}_0x1b6eb1=_['merge']({},_0x1b6eb1,_0x32988f[_0xcadf('0x41')]);return db['ChatInternalMessage'][_0xcadf('0x4a')](_0x1b6eb1)['then'](handleEntityNotFound(_0x56d6c9,null))['then'](respondWithResult(_0x56d6c9,null))[_0xcadf('0x46')](handleError(_0x56d6c9,null));};exports[_0xcadf('0x4b')]=function(_0x105ae0,_0x4bffd1){return db[_0xcadf('0x42')][_0xcadf('0x4b')](_0x105ae0['body'],{})[_0xcadf('0x29')](respondWithResult(_0x4bffd1,0xc9))['catch'](handleError(_0x4bffd1,null));};exports[_0xcadf('0x27')]=function(_0x26ae14,_0x3b58a9){if(_0x26ae14[_0xcadf('0x4c')]['id']){delete _0x26ae14[_0xcadf('0x4c')]['id'];}return db[_0xcadf('0x42')][_0xcadf('0x4a')]({'where':{'id':_0x26ae14[_0xcadf('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b58a9,null))[_0xcadf('0x29')](saveUpdates(_0x26ae14[_0xcadf('0x4c')],null))[_0xcadf('0x29')](respondWithResult(_0x3b58a9,null))[_0xcadf('0x46')](handleError(_0x3b58a9,null));};exports[_0xcadf('0x28')]=function(_0x48fcbc,_0x50df78){return db[_0xcadf('0x42')][_0xcadf('0x4a')]({'where':{'id':_0x48fcbc[_0xcadf('0x47')]['id']}})[_0xcadf('0x29')](handleEntityNotFound(_0x50df78,null))[_0xcadf('0x29')](removeEntity(_0x50df78,null))['catch'](handleError(_0x50df78,null));};exports[_0xcadf('0x4d')]=function(_0x2a2195,_0x21715f){return db[_0xcadf('0x42')][_0xcadf('0x4d')]()[_0xcadf('0x29')](respondWithResult(_0x21715f,null))[_0xcadf('0x46')](handleError(_0x21715f,null));};function wrapUser(_0x1da13e){return function(_0x154b01){var _0x151af6=_0x1da13e[_0xcadf('0x4e')]({'plain':!![]});_0x151af6['messages']=[];if(_0x154b01){_0x151af6['lastMessageAt']=_0x154b01[_0xcadf('0x4f')];_0x151af6[_0xcadf('0x50')]=_0x154b01;}else{_0x151af6['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x151af6['lastMessage']={};}return _0x151af6;};}exports[_0xcadf('0x51')]=function(_0x183543,_0xe418fd,_0x2c76a0){var _0x1add1e=[];return db[_0xcadf('0x52')]['findAll']({'where':{'role':['agent','admin',_0xcadf('0x53')]},'attributes':['id',_0xcadf('0x54'),_0xcadf('0x2b'),_0xcadf('0x55'),_0xcadf('0x56'),_0xcadf('0x57'),'online',_0xcadf('0x58'),_0xcadf('0x59'),_0xcadf('0x5a')],'order':qs[_0xcadf('0x3c')](_0xcadf('0x5b')),'include':[{'model':db[_0xcadf('0x5c')],'as':_0xcadf('0x5d'),'attributes':['id',_0xcadf('0x2b'),_0xcadf('0x31')],'through':{'attributes':[]}}]})[_0xcadf('0x29')](function(_0x185c0e){if(_0x185c0e){var _0x266bcd=_0x183543['user'][_0xcadf('0x4e')]({'plain':!![]});if(!_0x266bcd)throw new Error(_0xcadf('0x5e'));if(_0x266bcd[_0xcadf('0x55')]===_0xcadf('0x53')){return db[_0xcadf('0x5f')][_0xcadf('0x4a')]({'where':{'name':_0xcadf('0x60'),'userProfileId':_0x266bcd[_0xcadf('0x61')]},'raw':!![]})['then'](function(_0x57a235){if(_0x57a235){if(_0x57a235[_0xcadf('0x62')]===0x0){return db[_0xcadf('0x63')][_0xcadf('0x64')]({'where':{'sectionId':_0x57a235['id']},'raw':!![]})['then'](function(_0x3ac2e9){var _0x1873d8=[];if(_[_0xcadf('0x65')](_0x3ac2e9)){_0x1873d8=_[_0xcadf('0x40')](_0x185c0e,function(_0x1a65d7){if(_0x1a65d7[_0xcadf('0x55')]!==_0xcadf('0x66')){return _0x1a65d7;}});return _0x1873d8;}else{for(var _0x1ea7a8=0x0;_0x1ea7a8<_0x185c0e['length'];_0x1ea7a8++){var _0x1d40e4=_0x185c0e[_0x1ea7a8];if(_0x1d40e4[_0xcadf('0x55')]===_0xcadf('0x66')){var _0x404050=_[_0xcadf('0x4a')](_0x3ac2e9,function(_0x2a2472){return _0x2a2472[_0xcadf('0x67')]===_0x1d40e4['id'];});if(_0x404050)_0x1873d8[_0xcadf('0x68')](_0x1d40e4);}else{_0x1873d8['push'](_0x1d40e4);}}return _0x1873d8;}});}else{return _0x185c0e;}}else{var _0xecff95=_[_0xcadf('0x40')](_0x185c0e,function(_0x8608d5){if(_0x8608d5['role']!==_0xcadf('0x66')){return _0x8608d5;}});return _0xecff95;}});}else{return _0x185c0e;}}})['then'](function(_0x557c88){var _0x2d5a79=[];if(_0x557c88){_0x1add1e=_0x557c88;for(var _0x1773f9=0x0;_0x1773f9<_0x557c88['length'];_0x1773f9+=0x1){_0x1add1e[_0x1773f9]['messages']=[];_0x2d5a79[_0xcadf('0x68')](db[_0xcadf('0x42')][_0xcadf('0x4a')]({'where':{'FromId':[_0x183543[_0xcadf('0x53')]['id'],_0x557c88[_0x1773f9]['id']],'ToId':[_0x183543[_0xcadf('0x53')]['id'],_0x557c88[_0x1773f9]['id']],'ChatGroupId':null},'attributes':['id',_0xcadf('0x4f'),_0xcadf('0x69'),'ToId','read',_0xcadf('0x4c')],'order':qs[_0xcadf('0x3c')](_0xcadf('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xcadf('0x29')](wrapUser(_0x557c88[_0x1773f9])));}return BPromise[_0xcadf('0x6b')](_0x2d5a79);}return[];})[_0xcadf('0x29')](function(_0x532cbe){return{'rows':_0x532cbe,'count':_0x532cbe[_0xcadf('0x48')]};})[_0xcadf('0x29')](respondWithResult(_0xe418fd,null))[_0xcadf('0x46')](handleError(_0xe418fd,null));}; \ No newline at end of file +var _0x19d0=['-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','html-pdf','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','VIRTUAL','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','get','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar'];(function(_0x581041,_0x2fdcec){var _0xc686b9=function(_0xafdda1){while(--_0xafdda1){_0x581041['push'](_0x581041['shift']());}};_0xc686b9(++_0x2fdcec);}(_0x19d0,0xe5));var _0x019d=function(_0x269667,_0x485d5f){_0x269667=_0x269667-0x0;var _0xf5d9fd=_0x19d0[_0x269667];return _0xf5d9fd;};'use strict';var pdf=require(_0x019d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x019d('0x1'));var BPromise=require(_0x019d('0x2'));var Mustache=require(_0x019d('0x3'));var util=require(_0x019d('0x4'));var path=require(_0x019d('0x5'));var sox=require(_0x019d('0x6'));var csv=require('to-csv');var ejs=require(_0x019d('0x7'));var fs=require('fs');var _=require(_0x019d('0x8'));var squel=require(_0x019d('0x9'));var crypto=require('crypto');var jsforce=require(_0x019d('0xa'));var deskjs=require(_0x019d('0xb'));var toCsv=require(_0x019d('0xc'));var querystring=require('querystring');var Papa=require(_0x019d('0xd'));var Redis=require(_0x019d('0xe'));var authService=require(_0x019d('0xf'));var qs=require(_0x019d('0x10'));var as=require(_0x019d('0x11'));var hardwareService=require(_0x019d('0x12'));var logger=require(_0x019d('0x13'))('api');var utils=require(_0x019d('0x14'));var config=require(_0x019d('0x15'));var licenseUtil=require(_0x019d('0x16'));var db=require(_0x019d('0x17'))['db'];config[_0x019d('0x18')]=_[_0x019d('0x19')](config['redis'],{'host':_0x019d('0x1a'),'port':0x18eb});var socket=require(_0x019d('0x1b'))(new Redis(config[_0x019d('0x18')]));require(_0x019d('0x1c'))[_0x019d('0x1d')](socket);function respondWithStatusCode(_0x16cc4a,_0x51f4a4){_0x51f4a4=_0x51f4a4||0xcc;return function(_0x51daf4){if(_0x51daf4){return _0x16cc4a[_0x019d('0x1e')](_0x51f4a4);}return _0x16cc4a[_0x019d('0x1f')](_0x51f4a4)['end']();};}function respondWithResult(_0x554ce7,_0x23e1ac){_0x23e1ac=_0x23e1ac||0xc8;return function(_0x38233c){if(_0x38233c){return _0x554ce7[_0x019d('0x1f')](_0x23e1ac)[_0x019d('0x20')](_0x38233c);}};}function respondWithFilteredResult(_0x5ba948,_0x4d4336){return function(_0x2bd6fd){if(_0x2bd6fd){var _0x469a46=_0x2bd6fd[_0x019d('0x21')],_0x41cc81=_0x4d4336['offset'],_0x51ca53=_0x4d4336[_0x019d('0x22')]+_0x4d4336[_0x019d('0x23')],_0x118e4d;if(_0x51ca53>=_0x469a46){_0x51ca53=_0x469a46;_0x118e4d=0xc8;}else{_0x118e4d=0xce;}_0x5ba948[_0x019d('0x1f')](_0x118e4d);return _0x5ba948['set'](_0x019d('0x24'),_0x41cc81+'-'+_0x51ca53+'/'+_0x469a46)[_0x019d('0x20')](_0x2bd6fd);}return null;};}function patchUpdates(_0x1c7e7f){return function(_0x1181a3){try{jsonpatch[_0x019d('0x25')](_0x1181a3,_0x1c7e7f,!![]);}catch(_0x32f026){return BPromise[_0x019d('0x26')](_0x32f026);}return _0x1181a3[_0x019d('0x27')]();};}function saveUpdates(_0x538afc,_0x137436){return function(_0x129c63){if(_0x129c63){return _0x129c63[_0x019d('0x28')](_0x538afc)[_0x019d('0x29')](function(_0x17aea8){return _0x17aea8;});}return null;};}function removeEntity(_0x282517,_0x5a508d){return function(_0x4eaec5){if(_0x4eaec5){return _0x4eaec5[_0x019d('0x2a')]()[_0x019d('0x29')](function(){_0x282517[_0x019d('0x1f')](0xcc)[_0x019d('0x2b')]();});}};}function handleEntityNotFound(_0xdc3dd3,_0x45be32){return function(_0x418039){if(!_0x418039){_0xdc3dd3['sendStatus'](0x194);}return _0x418039;};}function handleError(_0x3a36dc,_0x362293){_0x362293=_0x362293||0x1f4;return function(_0x551497){logger[_0x019d('0x2c')](_0x551497[_0x019d('0x2d')]);if(_0x551497[_0x019d('0x2e')]){delete _0x551497[_0x019d('0x2e')];}_0x3a36dc['status'](_0x362293)[_0x019d('0x2f')](_0x551497);};}exports[_0x019d('0x30')]=function(_0x317a69,_0x1c1e03){var _0x5b026e={},_0x571d73={},_0x1e9838={'count':0x0,'rows':[]};var _0x409fc5=_[_0x019d('0x31')](db[_0x019d('0x32')][_0x019d('0x33')],function(_0x403fe7){return{'name':_0x403fe7['fieldName'],'type':_0x403fe7[_0x019d('0x34')][_0x019d('0x35')]};});_0x571d73[_0x019d('0x36')]=_[_0x019d('0x31')](_0x409fc5,_0x019d('0x2e'));_0x571d73[_0x019d('0x37')]=_['keys'](_0x317a69[_0x019d('0x37')]);_0x571d73[_0x019d('0x38')]=_[_0x019d('0x39')](_0x571d73[_0x019d('0x36')],_0x571d73[_0x019d('0x37')]);_0x5b026e[_0x019d('0x3a')]=_[_0x019d('0x39')](_0x571d73[_0x019d('0x36')],qs[_0x019d('0x3b')](_0x317a69['query'][_0x019d('0x3b')]));_0x5b026e[_0x019d('0x3a')]=_0x5b026e[_0x019d('0x3a')][_0x019d('0x3c')]?_0x5b026e[_0x019d('0x3a')]:_0x571d73[_0x019d('0x36')];if(!_0x317a69[_0x019d('0x37')]['hasOwnProperty']('nolimit')){_0x5b026e[_0x019d('0x23')]=qs[_0x019d('0x23')](_0x317a69[_0x019d('0x37')][_0x019d('0x23')]);_0x5b026e['offset']=qs[_0x019d('0x22')](_0x317a69[_0x019d('0x37')][_0x019d('0x22')]);}_0x5b026e[_0x019d('0x3d')]=qs['sort'](_0x317a69['query'][_0x019d('0x3e')]);_0x5b026e[_0x019d('0x3f')]=qs[_0x019d('0x38')](_['pick'](_0x317a69[_0x019d('0x37')],_0x571d73[_0x019d('0x38')]),_0x409fc5);if(_0x317a69[_0x019d('0x37')][_0x019d('0x40')]){_0x5b026e[_0x019d('0x3f')]=_['merge'](_0x5b026e[_0x019d('0x3f')],{'$or':_['map'](_0x409fc5,function(_0x30aa1a){if(_0x30aa1a['type']!==_0x019d('0x41')){var _0x4bce42={};_0x4bce42[_0x30aa1a[_0x019d('0x2e')]]={'$like':'%'+_0x317a69['query'][_0x019d('0x40')]+'%'};return _0x4bce42;}})});}_0x5b026e=_['merge']({},_0x5b026e,_0x317a69['options']);var _0x4c829a={'where':_0x5b026e[_0x019d('0x3f')]};return db[_0x019d('0x32')]['count'](_0x4c829a)[_0x019d('0x29')](function(_0x5ed99e){_0x1e9838[_0x019d('0x21')]=_0x5ed99e;if(_0x317a69[_0x019d('0x37')]['includeAll']){_0x5b026e[_0x019d('0x42')]=[{'all':!![]}];}return db[_0x019d('0x32')][_0x019d('0x43')](_0x5b026e);})[_0x019d('0x29')](function(_0x198a08){_0x1e9838[_0x019d('0x44')]=_0x198a08;return _0x1e9838;})[_0x019d('0x29')](respondWithFilteredResult(_0x1c1e03,_0x5b026e))[_0x019d('0x45')](handleError(_0x1c1e03,null));};exports['show']=function(_0x295cc7,_0x1381ac){var _0x1e7e19={'raw':!![],'where':{'id':_0x295cc7[_0x019d('0x46')]['id']}},_0x37fb72={};_0x37fb72[_0x019d('0x36')]=_[_0x019d('0x47')](db[_0x019d('0x32')]['rawAttributes']);_0x37fb72[_0x019d('0x37')]=_[_0x019d('0x47')](_0x295cc7[_0x019d('0x37')]);_0x37fb72['filters']=_['intersection'](_0x37fb72[_0x019d('0x36')],_0x37fb72[_0x019d('0x37')]);_0x1e7e19[_0x019d('0x3a')]=_[_0x019d('0x39')](_0x37fb72[_0x019d('0x36')],qs[_0x019d('0x3b')](_0x295cc7[_0x019d('0x37')][_0x019d('0x3b')]));_0x1e7e19['attributes']=_0x1e7e19[_0x019d('0x3a')][_0x019d('0x3c')]?_0x1e7e19[_0x019d('0x3a')]:_0x37fb72[_0x019d('0x36')];if(_0x295cc7[_0x019d('0x37')][_0x019d('0x48')]){_0x1e7e19[_0x019d('0x42')]=[{'all':!![]}];}_0x1e7e19=_['merge']({},_0x1e7e19,_0x295cc7[_0x019d('0x49')]);return db[_0x019d('0x32')][_0x019d('0x4a')](_0x1e7e19)[_0x019d('0x29')](handleEntityNotFound(_0x1381ac,null))['then'](respondWithResult(_0x1381ac,null))['catch'](handleError(_0x1381ac,null));};exports[_0x019d('0x4b')]=function(_0xad1f7f,_0x4326ec){return db['ChatInternalMessage'][_0x019d('0x4b')](_0xad1f7f[_0x019d('0x4c')],{})[_0x019d('0x29')](respondWithResult(_0x4326ec,0xc9))[_0x019d('0x45')](handleError(_0x4326ec,null));};exports['update']=function(_0x2872bf,_0x63f11d){if(_0x2872bf[_0x019d('0x4c')]['id']){delete _0x2872bf[_0x019d('0x4c')]['id'];}return db[_0x019d('0x32')][_0x019d('0x4a')]({'where':{'id':_0x2872bf[_0x019d('0x46')]['id']}})[_0x019d('0x29')](handleEntityNotFound(_0x63f11d,null))['then'](saveUpdates(_0x2872bf[_0x019d('0x4c')],null))[_0x019d('0x29')](respondWithResult(_0x63f11d,null))[_0x019d('0x45')](handleError(_0x63f11d,null));};exports['destroy']=function(_0x2283e8,_0xf5c3f2){return db['ChatInternalMessage']['find']({'where':{'id':_0x2283e8[_0x019d('0x46')]['id']}})[_0x019d('0x29')](handleEntityNotFound(_0xf5c3f2,null))[_0x019d('0x29')](removeEntity(_0xf5c3f2,null))[_0x019d('0x45')](handleError(_0xf5c3f2,null));};exports[_0x019d('0x4d')]=function(_0x5e6395,_0x5ef9f9){return db[_0x019d('0x32')][_0x019d('0x4d')]()[_0x019d('0x29')](respondWithResult(_0x5ef9f9,null))[_0x019d('0x45')](handleError(_0x5ef9f9,null));};function wrapUser(_0x40a135){return function(_0x1919c6){var _0x36b34f=_0x40a135[_0x019d('0x4e')]({'plain':!![]});_0x36b34f[_0x019d('0x4f')]=[];if(_0x1919c6){_0x36b34f[_0x019d('0x50')]=_0x1919c6['createdAt'];_0x36b34f[_0x019d('0x51')]=_0x1919c6;}else{_0x36b34f[_0x019d('0x50')]=moment(0x0)['format'](_0x019d('0x52'));_0x36b34f[_0x019d('0x51')]={};}return _0x36b34f;};}exports['getUsers']=function(_0x25e316,_0x4aef9e,_0x1a1468){var _0x1ec193=[];return db[_0x019d('0x53')][_0x019d('0x43')]({'where':{'role':[_0x019d('0x54'),_0x019d('0x55'),_0x019d('0x56')]},'attributes':['id',_0x019d('0x57'),'name',_0x019d('0x58'),_0x019d('0x59'),_0x019d('0x5a'),_0x019d('0x5b'),_0x019d('0x5c'),_0x019d('0x5d'),_0x019d('0x5e')],'order':qs[_0x019d('0x3e')](_0x019d('0x5f')),'include':[{'model':db['VoiceQueue'],'as':_0x019d('0x60'),'attributes':['id',_0x019d('0x2e'),_0x019d('0x34')],'through':{'attributes':[]}}]})[_0x019d('0x29')](function(_0x26a561){if(_0x26a561){var _0x5e1650=_0x25e316[_0x019d('0x56')]['get']({'plain':!![]});if(!_0x5e1650)throw new Error(_0x019d('0x61'));if(_0x5e1650['role']===_0x019d('0x56')){return db[_0x019d('0x62')]['find']({'where':{'name':'Agents','userProfileId':_0x5e1650[_0x019d('0x63')]},'raw':!![]})['then'](function(_0x80d077){if(_0x80d077){if(_0x80d077['autoAssociation']===0x0){return db[_0x019d('0x64')][_0x019d('0x43')]({'where':{'sectionId':_0x80d077['id']},'raw':!![]})['then'](function(_0x3605ce){var _0x368602=[];if(_[_0x019d('0x65')](_0x3605ce)){_0x368602=_[_0x019d('0x40')](_0x26a561,function(_0x59ca94){if(_0x59ca94[_0x019d('0x58')]!==_0x019d('0x54')){return _0x59ca94;}});return _0x368602;}else{for(var _0x3372aa=0x0;_0x3372aa<_0x26a561[_0x019d('0x3c')];_0x3372aa++){var _0x47ac16=_0x26a561[_0x3372aa];if(_0x47ac16[_0x019d('0x58')]===_0x019d('0x54')){var _0x28c70a=_['find'](_0x3605ce,function(_0x17aaa9){return _0x17aaa9[_0x019d('0x66')]===_0x47ac16['id'];});if(_0x28c70a)_0x368602[_0x019d('0x67')](_0x47ac16);}else{_0x368602[_0x019d('0x67')](_0x47ac16);}}return _0x368602;}});}else{return _0x26a561;}}else{var _0x45b0aa=_[_0x019d('0x40')](_0x26a561,function(_0x1924b3){if(_0x1924b3[_0x019d('0x58')]!==_0x019d('0x54')){return _0x1924b3;}});return _0x45b0aa;}});}else{return _0x26a561;}}})[_0x019d('0x29')](function(_0xd60385){var _0x458496=[];if(_0xd60385){_0x1ec193=_0xd60385;for(var _0x48c6ba=0x0;_0x48c6ba<_0xd60385[_0x019d('0x3c')];_0x48c6ba+=0x1){_0x1ec193[_0x48c6ba][_0x019d('0x4f')]=[];_0x458496[_0x019d('0x67')](db[_0x019d('0x32')][_0x019d('0x4a')]({'where':{'FromId':[_0x25e316[_0x019d('0x56')]['id'],_0xd60385[_0x48c6ba]['id']],'ToId':[_0x25e316[_0x019d('0x56')]['id'],_0xd60385[_0x48c6ba]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x019d('0x68'),'ToId',_0x019d('0x69'),'body'],'order':qs[_0x019d('0x3e')](_0x019d('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xd60385[_0x48c6ba])));}return BPromise[_0x019d('0x6b')](_0x458496);}return[];})[_0x019d('0x29')](function(_0x1b8c1a){return{'rows':_0x1b8c1a,'count':_0x1b8c1a[_0x019d('0x3c')]};})[_0x019d('0x29')](respondWithResult(_0x4aef9e,null))[_0x019d('0x45')](handleError(_0x4aef9e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e5b8a9a..bed0b3d 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.events.js +++ b/server/api/chatInternalMessage/chatInternalMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd84b=['remove','emit','hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x4876b6,_0x7321aa){var _0x583251=function(_0x30f43a){while(--_0x30f43a){_0x4876b6['push'](_0x4876b6['shift']());}};_0x583251(++_0x7321aa);}(_0xd84b,0x177));var _0xbd84=function(_0x1820b4,_0x366c58){_0x1820b4=_0x1820b4-0x0;var _0x3e09d7=_0xd84b[_0x1820b4];return _0x3e09d7;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xbd84('0x0'))['db'][_0xbd84('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xbd84('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbd84('0x3')};function emitEvent(_0xbd7482){return function(_0x2f0d5e,_0x7f1712,_0x49b0bf){ChatInternalMessageEvents['emit'](_0xbd7482+':'+_0x2f0d5e['id'],_0x2f0d5e);ChatInternalMessageEvents[_0xbd84('0x4')](_0xbd7482,_0x2f0d5e);_0x49b0bf(null);};}for(var e in events){if(events[_0xbd84('0x5')](e)){var event=events[e];ChatInternalMessage[_0xbd84('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x3c7b=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x205b6e,_0x36a183){var _0x974b6b=function(_0x3ba59f){while(--_0x3ba59f){_0x205b6e['push'](_0x205b6e['shift']());}};_0x974b6b(++_0x36a183);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x48f948,_0x3ebee8){_0x48f948=_0x48f948-0x0;var _0x13cead=_0x3c7b[_0x48f948];return _0x13cead;};'use strict';var EventEmitter=require(_0xb3c7('0x0'));var ChatInternalMessage=require(_0xb3c7('0x1'))['db'][_0xb3c7('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb3c7('0x3')](0x0);var events={'afterCreate':_0xb3c7('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x500bea){return function(_0x5b34ef,_0x234fe5,_0x44c399){ChatInternalMessageEvents['emit'](_0x500bea+':'+_0x5b34ef['id'],_0x5b34ef);ChatInternalMessageEvents[_0xb3c7('0x5')](_0x500bea,_0x5b34ef);_0x44c399(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xb3c7('0x6')](e,emitEvent(event));}}module[_0xb3c7('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 59e92a0..c32b734 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x3a9dcc,_0x3ecf00){var _0xec0d99=function(_0x2ed9a2){while(--_0x2ed9a2){_0x3a9dcc['push'](_0x3a9dcc['shift']());}};_0xec0d99(++_0x3ecf00);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xb7e7[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file +var _0x4fc2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2ad1a0,_0x7850b2){var _0x1a9268=function(_0x5ce2d2){while(--_0x5ce2d2){_0x2ad1a0['push'](_0x2ad1a0['shift']());}};_0x1a9268(++_0x7850b2);}(_0x4fc2,0x111));var _0x24fc=function(_0x247a5e,_0x40b75d){_0x247a5e=_0x247a5e-0x0;var _0x16e004=_0x4fc2[_0x247a5e];return _0x16e004;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24fc('0xb'),'collate':_0x24fc('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index cecf987..dc8f572 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.rpc.js +++ b/server/api/chatInternalMessage/chatInternalMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf536=['../../config/environment','jayson/promise','client','redis','./chatInternalMessage.socket','register','request','then','request\x20sent','debug','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x91d25b,_0x2afc16){var _0x3636e3=function(_0x1189ee){while(--_0x1189ee){_0x91d25b['push'](_0x91d25b['shift']());}};_0x3636e3(++_0x2afc16);}(_0xf536,0x162));var _0x6f53=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0xf536[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require(_0x6f53('0x0'));var util=require(_0x6f53('0x1'));var moment=require(_0x6f53('0x2'));var BPromise=require(_0x6f53('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f53('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f53('0x5'))('rpc');var config=require(_0x6f53('0x6'));var jayson=require(_0x6f53('0x7'));var client=jayson[_0x6f53('0x8')]['http']({'port':0x232a});config[_0x6f53('0x9')]=_['defaults'](config[_0x6f53('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f53('0x9')]));require(_0x6f53('0xa'))[_0x6f53('0xb')](socket);function respondWithRpcPromise(_0x9b07da,_0x147300,_0x2662cf){return new BPromise(function(_0x4c7d71,_0x110eed){return client[_0x6f53('0xc')](_0x9b07da,_0x2662cf)[_0x6f53('0xd')](function(_0x2011a8){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x147300,_0x6f53('0xe'));logger[_0x6f53('0xf')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x147300,_0x6f53('0xe'),JSON[_0x6f53('0x10')](_0x2011a8));if(_0x2011a8[_0x6f53('0x11')]){if(_0x2011a8[_0x6f53('0x11')][_0x6f53('0x12')]===0x1f4){logger[_0x6f53('0x11')](_0x6f53('0x13'),_0x147300,_0x2011a8[_0x6f53('0x11')][_0x6f53('0x14')]);return _0x110eed(_0x2011a8[_0x6f53('0x11')][_0x6f53('0x14')]);}logger[_0x6f53('0x11')](_0x6f53('0x13'),_0x147300,_0x2011a8[_0x6f53('0x11')][_0x6f53('0x14')]);return _0x4c7d71(_0x2011a8[_0x6f53('0x11')][_0x6f53('0x14')]);}else{logger[_0x6f53('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x147300,_0x6f53('0xe'));_0x4c7d71(_0x2011a8[_0x6f53('0x16')]['message']);}})[_0x6f53('0x17')](function(_0x4f7949){logger['error'](_0x6f53('0x13'),_0x147300,_0x4f7949);_0x110eed(_0x4f7949);});});} \ No newline at end of file +var _0x76c1=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x194e6f,_0x2f43db){var _0x46cb85=function(_0x5eef56){while(--_0x5eef56){_0x194e6f['push'](_0x194e6f['shift']());}};_0x46cb85(++_0x2f43db);}(_0x76c1,0x7d));var _0x176c=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x76c1[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x176c('0x0'));var util=require(_0x176c('0x1'));var moment=require(_0x176c('0x2'));var BPromise=require(_0x176c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x176c('0x4'));var db=require(_0x176c('0x5'))['db'];var utils=require(_0x176c('0x6'));var logger=require(_0x176c('0x7'))(_0x176c('0x8'));var config=require(_0x176c('0x9'));var jayson=require(_0x176c('0xa'));var client=jayson['client'][_0x176c('0xb')]({'port':0x232a});config[_0x176c('0xc')]=_[_0x176c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x176c('0xe'))(new Redis(config['redis']));require(_0x176c('0xf'))['register'](socket);function respondWithRpcPromise(_0x4e4f96,_0x3a7f15,_0x40c770){return new BPromise(function(_0xf93c94,_0x18e506){return client['request'](_0x4e4f96,_0x40c770)[_0x176c('0x10')](function(_0x1cdd66){logger[_0x176c('0x11')](_0x176c('0x12'),_0x3a7f15,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x3a7f15,_0x176c('0x13'),JSON['stringify'](_0x1cdd66));if(_0x1cdd66[_0x176c('0x14')]){if(_0x1cdd66['error'][_0x176c('0x15')]===0x1f4){logger[_0x176c('0x14')](_0x176c('0x12'),_0x3a7f15,_0x1cdd66[_0x176c('0x14')][_0x176c('0x16')]);return _0x18e506(_0x1cdd66[_0x176c('0x14')][_0x176c('0x16')]);}logger[_0x176c('0x14')](_0x176c('0x12'),_0x3a7f15,_0x1cdd66[_0x176c('0x14')][_0x176c('0x16')]);return _0xf93c94(_0x1cdd66[_0x176c('0x14')][_0x176c('0x16')]);}else{logger[_0x176c('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x3a7f15,_0x176c('0x13'));_0xf93c94(_0x1cdd66[_0x176c('0x17')][_0x176c('0x16')]);}})[_0x176c('0x18')](function(_0x393d35){logger[_0x176c('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x3a7f15,_0x393d35);_0x18e506(_0x393d35);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7871ef7..41aa2ea 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.socket.js +++ b/server/api/chatInternalMessage/chatInternalMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3667=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x4c9f5d,_0x1913a8){var _0xbbaef1=function(_0x283d83){while(--_0x283d83){_0x4c9f5d['push'](_0x4c9f5d['shift']());}};_0xbbaef1(++_0x1913a8);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0x7366('0x0'));var events=[_0x7366('0x1'),_0x7366('0x2'),_0x7366('0x3')];function createListener(_0x3c601d,_0x5d1072){return function(_0x27a90d){_0x5d1072[_0x7366('0x4')](_0x3c601d,_0x27a90d);};}function removeListener(_0x4b32a7,_0x27726b){return function(){ChatInternalMessageEvents[_0x7366('0x5')](_0x4b32a7,_0x27726b);};}exports[_0x7366('0x6')]=function(_0x1c0cf4){for(var _0x101e3d=0x0,_0x589397=events[_0x7366('0x7')];_0x101e3d<_0x589397;_0x101e3d++){var _0xa1a3c5=events[_0x101e3d];var _0x2dd32b=createListener(_0x7366('0x8')+_0xa1a3c5,_0x1c0cf4);ChatInternalMessageEvents['on'](_0xa1a3c5,_0x2dd32b);}}; \ No newline at end of file +var _0xf1e1=['remove','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0xd7bcf0,_0x5da944){var _0xcb918a=function(_0x30556c){while(--_0x30556c){_0xd7bcf0['push'](_0xd7bcf0['shift']());}};_0xcb918a(++_0x5da944);}(_0xf1e1,0x102));var _0x1f1e=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xf1e1[_0x270adf];return _0x29eda9;};'use strict';var ChatInternalMessageEvents=require(_0x1f1e('0x0'));var events=['save',_0x1f1e('0x1'),'update'];function createListener(_0x436258,_0x490554){return function(_0xdd125){_0x490554[_0x1f1e('0x2')](_0x436258,_0xdd125);};}function removeListener(_0x2243c6,_0x2ab1f9){return function(){ChatInternalMessageEvents[_0x1f1e('0x3')](_0x2243c6,_0x2ab1f9);};}exports[_0x1f1e('0x4')]=function(_0x1bdcee){for(var _0x3242af=0x0,_0x1db643=events[_0x1f1e('0x5')];_0x3242af<_0x1db643;_0x3242af++){var _0x46e32b=events[_0x3242af];var _0x3699d2=createListener(_0x1f1e('0x6')+_0x46e32b,_0x1bdcee);ChatInternalMessageEvents['on'](_0x46e32b,_0x3699d2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c2a3c89..7ebdf82 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x6cdd49,_0x4162d8){var _0x5bd85c=function(_0x5e57df){while(--_0x5e57df){_0x6cdd49['push'](_0x6cdd49['shift']());}};_0x5bd85c(++_0x4162d8);}(_0xe706,0xa3));var _0x6e70=function(_0x2fab67,_0x510e24){_0x2fab67=_0x2fab67-0x0;var _0x3b0237=_0xe706[_0x2fab67];return _0x3b0237;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['put']('/:id',controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);module[_0x6e70('0x17')]=router; \ No newline at end of file +var _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x1949c6,_0x11fc26){var _0x992ce7=function(_0x5930c9){while(--_0x5930c9){_0x1949c6['push'](_0x1949c6['shift']());}};_0x992ce7(++_0x11fc26);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0xcb91[_0x336264];return _0x53cf91;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 03a3b9b..5d7e867 100644 --- a/server/api/chatMessage/chatMessage.attributes.js +++ b/server/api/chatMessage/chatMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5274=['TEXT','BOOLEAN','out','DATE','STRING','sequelize','exports'];(function(_0x5d02b5,_0x1eb74c){var _0x2a6828=function(_0x4d96ab){while(--_0x4d96ab){_0x5d02b5['push'](_0x5d02b5['shift']());}};_0x2a6828(++_0x1eb74c);}(_0x5274,0x98));var _0x4527=function(_0x555c17,_0x2e6c2a){_0x555c17=_0x555c17-0x0;var _0x15a073=_0x5274[_0x555c17];return _0x15a073;};'use strict';var Sequelize=require(_0x4527('0x0'));module[_0x4527('0x1')]={'body':{'type':Sequelize[_0x4527('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4527('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4527('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x4527('0x5')]},'providerName':{'type':Sequelize[_0x4527('0x6')]},'providerResponse':{'type':Sequelize[_0x4527('0x2')]}}; \ No newline at end of file +var _0xf20c=['ENUM','out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xf20c,0x144));var _0xcf20=function(_0x3485f8,_0x1b66cf){_0x3485f8=_0x3485f8-0x0;var _0x1fbba7=_0xf20c[_0x3485f8];return _0x1fbba7;};'use strict';var Sequelize=require('sequelize');module[_0xcf20('0x0')]={'body':{'type':Sequelize[_0xcf20('0x1')](_0xcf20('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcf20('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf20('0x4')]('in',_0xcf20('0x5')),'defaultValue':_0xcf20('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xcf20('0x6')]},'providerName':{'type':Sequelize[_0xcf20('0x7')]},'providerResponse':{'type':Sequelize[_0xcf20('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index fc6c5cf..536425a 100644 --- a/server/api/chatMessage/chatMessage.controller.js +++ b/server/api/chatMessage/chatMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbac4=['rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter','where','map','VIRTUAL','merge','ChatMessage','includeAll','findAll','rows','show','params','rawAttributes','include','options','find','create','body','describe','../../config/logger','accept','chat','read','readAt','format','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','UserId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','parse','formData','chat-interactions','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','event'];(function(_0x53443e,_0x49f6b6){var _0x39babd=function(_0x1f5c27){while(--_0x1f5c27){_0x53443e['push'](_0x53443e['shift']());}};_0x39babd(++_0x49f6b6);}(_0xbac4,0x184));var _0x4bac=function(_0x2fbb38,_0x241c93){_0x2fbb38=_0x2fbb38-0x0;var _0xdd1340=_0xbac4[_0x2fbb38];return _0xdd1340;};'use strict';var pdf=require(_0x4bac('0x0'));var emlformat=require(_0x4bac('0x1'));var rimraf=require(_0x4bac('0x2'));var zipdir=require(_0x4bac('0x3'));var jsonpatch=require(_0x4bac('0x4'));var rp=require(_0x4bac('0x5'));var moment=require(_0x4bac('0x6'));var BPromise=require(_0x4bac('0x7'));var Mustache=require(_0x4bac('0x8'));var util=require(_0x4bac('0x9'));var path=require(_0x4bac('0xa'));var sox=require(_0x4bac('0xb'));var csv=require(_0x4bac('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4bac('0xd'));var squel=require(_0x4bac('0xe'));var crypto=require(_0x4bac('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4bac('0x10'));var Papa=require('papaparse');var Redis=require(_0x4bac('0x11'));var authService=require(_0x4bac('0x12'));var qs=require(_0x4bac('0x13'));var as=require(_0x4bac('0x14'));var hardwareService=require(_0x4bac('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4bac('0x16'));var config=require(_0x4bac('0x17'));var licenseUtil=require(_0x4bac('0x18'));var db=require(_0x4bac('0x19'))['db'];config[_0x4bac('0x1a')]=_['defaults'](config['redis'],{'host':_0x4bac('0x1b'),'port':0x18eb});var socket=require(_0x4bac('0x1c'))(new Redis(config[_0x4bac('0x1a')]));require(_0x4bac('0x1d'))[_0x4bac('0x1e')](socket);var jayson=require(_0x4bac('0x1f'));var client=jayson[_0x4bac('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x4bac('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d30b,_0x16846,_0xad977,_0x574780){return new BPromise(function(_0x5e3b24,_0x1f9bf0){var _0x3b3b00=_0x574780||client;return _0x3b3b00[_0x4bac('0x21')](_0x10d30b,_0xad977)['then'](function(_0x49bd3a){logger['info'](_0x4bac('0x22'),_0x16846,_0x4bac('0x23'));logger[_0x4bac('0x24')](_0x4bac('0x25'),_0x16846,'request\x20sent',JSON[_0x4bac('0x26')](_0x49bd3a));if(_0x49bd3a['error']){if(_0x49bd3a[_0x4bac('0x27')][_0x4bac('0x28')]===0x1f4){logger[_0x4bac('0x27')](_0x4bac('0x22'),_0x16846,_0x49bd3a[_0x4bac('0x27')][_0x4bac('0x29')]);return _0x1f9bf0(_0x49bd3a[_0x4bac('0x27')]['message']);}logger[_0x4bac('0x27')]('ChatMessage,\x20%s,\x20%s',_0x16846,_0x49bd3a[_0x4bac('0x27')][_0x4bac('0x29')]);return _0x5e3b24(_0x49bd3a['error']['message']);}else{logger[_0x4bac('0x2a')](_0x4bac('0x22'),_0x16846,_0x4bac('0x23'));_0x5e3b24(_0x49bd3a[_0x4bac('0x2b')][_0x4bac('0x29')]);}})[_0x4bac('0x2c')](function(_0x3235a9){logger[_0x4bac('0x27')](_0x4bac('0x22'),_0x16846,_0x3235a9);_0x1f9bf0(_0x3235a9);});});}function respondWithStatusCode(_0x312270,_0x492f78){_0x492f78=_0x492f78||0xcc;return function(_0x10cbf3){if(_0x10cbf3){return _0x312270[_0x4bac('0x2d')](_0x492f78);}return _0x312270['status'](_0x492f78)[_0x4bac('0x2e')]();};}function respondWithResult(_0x4f0766,_0x1d6fb8){_0x1d6fb8=_0x1d6fb8||0xc8;return function(_0x2f2171){if(_0x2f2171){return _0x4f0766[_0x4bac('0x2f')](_0x1d6fb8)[_0x4bac('0x30')](_0x2f2171);}};}function respondWithFilteredResult(_0x35cd01,_0x55494b){return function(_0xfbc480){if(_0xfbc480){var _0x5b70d5=_0xfbc480[_0x4bac('0x31')],_0x4cd152=_0x55494b[_0x4bac('0x32')],_0x441825=_0x55494b[_0x4bac('0x32')]+_0x55494b[_0x4bac('0x33')],_0x459148;if(_0x441825>=_0x5b70d5){_0x441825=_0x5b70d5;_0x459148=0xc8;}else{_0x459148=0xce;}_0x35cd01['status'](_0x459148);return _0x35cd01['set'](_0x4bac('0x34'),_0x4cd152+'-'+_0x441825+'/'+_0x5b70d5)['json'](_0xfbc480);}return null;};}function patchUpdates(_0xfde974){return function(_0x4166d8){try{jsonpatch['apply'](_0x4166d8,_0xfde974,!![]);}catch(_0x4bdf69){return BPromise[_0x4bac('0x35')](_0x4bdf69);}return _0x4166d8[_0x4bac('0x36')]();};}function saveUpdates(_0x435453,_0x415c81){return function(_0x41c9ae){if(_0x41c9ae){return _0x41c9ae[_0x4bac('0x37')](_0x435453)[_0x4bac('0x38')](function(_0x2834ef){return _0x2834ef;});}return null;};}function removeEntity(_0x36839b,_0x5cd736){return function(_0x17956d){if(_0x17956d){return _0x17956d[_0x4bac('0x39')]()[_0x4bac('0x38')](function(){_0x36839b[_0x4bac('0x2f')](0xcc)[_0x4bac('0x2e')]();});}};}function handleEntityNotFound(_0x38c1c8,_0x27570a){return function(_0x1b2c45){if(!_0x1b2c45){_0x38c1c8[_0x4bac('0x2d')](0x194);}return _0x1b2c45;};}function handleError(_0xd6ddd4,_0x164b80){_0x164b80=_0x164b80||0x1f4;return function(_0x22ded2){logger[_0x4bac('0x27')](_0x22ded2[_0x4bac('0x3a')]);if(_0x22ded2[_0x4bac('0x3b')]){delete _0x22ded2[_0x4bac('0x3b')];}_0xd6ddd4[_0x4bac('0x2f')](_0x164b80)[_0x4bac('0x3c')](_0x22ded2);};}exports[_0x4bac('0x3d')]=function(_0x373ad9,_0x2c4a69){var _0xb58f07={},_0x1a5afa={},_0x37cce4={'count':0x0,'rows':[]};var _0xf20bc1=_['map'](db['ChatMessage']['rawAttributes'],function(_0x55c13f){return{'name':_0x55c13f[_0x4bac('0x3e')],'type':_0x55c13f[_0x4bac('0x3f')][_0x4bac('0x40')]};});_0x1a5afa[_0x4bac('0x41')]=_['map'](_0xf20bc1,'name');_0x1a5afa[_0x4bac('0x42')]=_[_0x4bac('0x43')](_0x373ad9[_0x4bac('0x42')]);_0x1a5afa[_0x4bac('0x44')]=_[_0x4bac('0x45')](_0x1a5afa[_0x4bac('0x41')],_0x1a5afa[_0x4bac('0x42')]);_0xb58f07[_0x4bac('0x46')]=_[_0x4bac('0x45')](_0x1a5afa[_0x4bac('0x41')],qs['fields'](_0x373ad9[_0x4bac('0x42')][_0x4bac('0x47')]));_0xb58f07[_0x4bac('0x46')]=_0xb58f07[_0x4bac('0x46')][_0x4bac('0x48')]?_0xb58f07[_0x4bac('0x46')]:_0x1a5afa[_0x4bac('0x41')];if(!_0x373ad9[_0x4bac('0x42')]['hasOwnProperty']('nolimit')){_0xb58f07['limit']=qs['limit'](_0x373ad9[_0x4bac('0x42')][_0x4bac('0x33')]);_0xb58f07[_0x4bac('0x32')]=qs[_0x4bac('0x32')](_0x373ad9['query']['offset']);}_0xb58f07['order']=qs[_0x4bac('0x49')](_0x373ad9['query']['sort']);_0xb58f07['where']=qs[_0x4bac('0x44')](_[_0x4bac('0x4a')](_0x373ad9[_0x4bac('0x42')],_0x1a5afa[_0x4bac('0x44')]),_0xf20bc1);if(_0x373ad9[_0x4bac('0x42')][_0x4bac('0x4b')]){_0xb58f07[_0x4bac('0x4c')]=_['merge'](_0xb58f07[_0x4bac('0x4c')],{'$or':_[_0x4bac('0x4d')](_0xf20bc1,function(_0x268efb){if(_0x268efb[_0x4bac('0x3f')]!==_0x4bac('0x4e')){var _0x57f721={};_0x57f721[_0x268efb[_0x4bac('0x3b')]]={'$like':'%'+_0x373ad9['query']['filter']+'%'};return _0x57f721;}})});}_0xb58f07=_[_0x4bac('0x4f')]({},_0xb58f07,_0x373ad9['options']);var _0x18057f={'where':_0xb58f07[_0x4bac('0x4c')]};return db[_0x4bac('0x50')][_0x4bac('0x31')](_0x18057f)[_0x4bac('0x38')](function(_0x121aea){_0x37cce4['count']=_0x121aea;if(_0x373ad9['query'][_0x4bac('0x51')]){_0xb58f07['include']=[{'all':!![]}];}return db[_0x4bac('0x50')][_0x4bac('0x52')](_0xb58f07);})[_0x4bac('0x38')](function(_0x5c684a){_0x37cce4[_0x4bac('0x53')]=_0x5c684a;return _0x37cce4;})[_0x4bac('0x38')](respondWithFilteredResult(_0x2c4a69,_0xb58f07))[_0x4bac('0x2c')](handleError(_0x2c4a69,null));};exports[_0x4bac('0x54')]=function(_0xaee98a,_0xac83d1){var _0x593b56={'raw':!![],'where':{'id':_0xaee98a[_0x4bac('0x55')]['id']}},_0x24a5c8={};_0x24a5c8['model']=_['keys'](db[_0x4bac('0x50')][_0x4bac('0x56')]);_0x24a5c8['query']=_[_0x4bac('0x43')](_0xaee98a[_0x4bac('0x42')]);_0x24a5c8[_0x4bac('0x44')]=_[_0x4bac('0x45')](_0x24a5c8[_0x4bac('0x41')],_0x24a5c8[_0x4bac('0x42')]);_0x593b56[_0x4bac('0x46')]=_[_0x4bac('0x45')](_0x24a5c8[_0x4bac('0x41')],qs[_0x4bac('0x47')](_0xaee98a[_0x4bac('0x42')]['fields']));_0x593b56['attributes']=_0x593b56[_0x4bac('0x46')][_0x4bac('0x48')]?_0x593b56[_0x4bac('0x46')]:_0x24a5c8['model'];if(_0xaee98a[_0x4bac('0x42')][_0x4bac('0x51')]){_0x593b56[_0x4bac('0x57')]=[{'all':!![]}];}_0x593b56=_['merge']({},_0x593b56,_0xaee98a[_0x4bac('0x58')]);return db[_0x4bac('0x50')][_0x4bac('0x59')](_0x593b56)[_0x4bac('0x38')](handleEntityNotFound(_0xac83d1,null))[_0x4bac('0x38')](respondWithResult(_0xac83d1,null))[_0x4bac('0x2c')](handleError(_0xac83d1,null));};exports[_0x4bac('0x5a')]=function(_0x5ae60c,_0x28fa33){return db[_0x4bac('0x50')]['create'](_0x5ae60c[_0x4bac('0x5b')],{})[_0x4bac('0x38')](respondWithResult(_0x28fa33,0xc9))[_0x4bac('0x2c')](handleError(_0x28fa33,null));};exports[_0x4bac('0x37')]=function(_0x420c39,_0x11630c){if(_0x420c39[_0x4bac('0x5b')]['id']){delete _0x420c39[_0x4bac('0x5b')]['id'];}return db['ChatMessage'][_0x4bac('0x59')]({'where':{'id':_0x420c39[_0x4bac('0x55')]['id']}})['then'](handleEntityNotFound(_0x11630c,null))[_0x4bac('0x38')](saveUpdates(_0x420c39[_0x4bac('0x5b')],null))[_0x4bac('0x38')](respondWithResult(_0x11630c,null))['catch'](handleError(_0x11630c,null));};exports[_0x4bac('0x39')]=function(_0x45028f,_0xac145a){return db[_0x4bac('0x50')][_0x4bac('0x59')]({'where':{'id':_0x45028f[_0x4bac('0x55')]['id']}})[_0x4bac('0x38')](handleEntityNotFound(_0xac145a,null))[_0x4bac('0x38')](removeEntity(_0xac145a,null))['catch'](handleError(_0xac145a,null));};exports[_0x4bac('0x5c')]=function(_0x298923,_0x204be8){return db[_0x4bac('0x50')][_0x4bac('0x5c')]()[_0x4bac('0x38')](respondWithResult(_0x204be8,null))[_0x4bac('0x2c')](handleError(_0x204be8,null));};var interaction_log=require(_0x4bac('0x5d'))('chat-interactions');exports[_0x4bac('0x5e')]=function(_0x54dcd2,_0x3704c3,_0x53ad9d){var _0x116101={'channel':_0x4bac('0x5f')};if(_0x54dcd2[_0x4bac('0x5b')]['id']){delete _0x54dcd2[_0x4bac('0x5b')]['id'];}_0x54dcd2['body'][_0x4bac('0x60')]=!![];_0x54dcd2[_0x4bac('0x5b')][_0x4bac('0x61')]=moment()[_0x4bac('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x54dcd2[_0x4bac('0x5b')]['UserId']=_0x54dcd2[_0x4bac('0x5b')]['UserId']||_0x54dcd2[_0x4bac('0x63')]['id'];return db[_0x4bac('0x50')]['find']({'where':{'id':_0x54dcd2[_0x4bac('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x4bac('0x64')],'as':_0x4bac('0x65')}]})['then'](handleEntityNotFound(_0x3704c3,null))['then'](saveUpdates(_0x54dcd2['body'],null))[_0x4bac('0x38')](function(_0x527b1f){if(_0x527b1f){_0x116101[_0x4bac('0x29')]=_0x527b1f[_0x4bac('0x66')]({'plain':!![]});return db[_0x4bac('0x67')][_0x4bac('0x59')]({'where':{'id':_0x527b1f[_0x4bac('0x68')]}});}return null;})[_0x4bac('0x38')](handleEntityNotFound(_0x3704c3,null))[_0x4bac('0x38')](function(_0x5a966d){if(_0x5a966d){return _0x5a966d[_0x4bac('0x37')]({'UserId':_0x54dcd2['body'][_0x4bac('0x69')],'read1stAt':_[_0x4bac('0x6a')](_0x5a966d[_0x4bac('0x6b')])?moment()[_0x4bac('0x62')](_0x4bac('0x6c')):undefined});}return null;})['then'](function(_0x544441){if(_0x544441){_0x116101[_0x4bac('0x6d')]=_0x544441['get']({'plain':!![]});interaction_log['info'](_0x4bac('0x6e'),_0x54dcd2[_0x4bac('0x63')]['id'],_0x54dcd2[_0x4bac('0x63')][_0x4bac('0x3b')],_0x54dcd2[_0x4bac('0x63')]['role'],_0x116101[_0x4bac('0x6d')]['id'],_0x54dcd2['body']?JSON[_0x4bac('0x26')](_0x54dcd2[_0x4bac('0x5b')]):_0x4bac('0x6f'));return respondWithRpcPromise(_0x4bac('0x70'),_0x4bac('0x71'),_0x116101);}return null;})[_0x4bac('0x38')](function(_0x3268c8){if(_0x3268c8){if(_0x54dcd2[_0x4bac('0x5b')][_0x4bac('0x72')]){_0x116101[_0x4bac('0x29')][_0x4bac('0x73')]=util[_0x4bac('0x62')](_0x4bac('0x74'),_0x54dcd2[_0x4bac('0x63')]['name']);_0x116101[_0x4bac('0x29')]['channel']=_0x116101[_0x4bac('0x75')];_0x116101[_0x4bac('0x29')]['event']='accept';return respondWithRpcPromise(_0x4bac('0x76'),_0x4bac('0x76'),{'event':_0x4bac('0x77'),'message':_[_0x4bac('0x4f')](_0x116101['message'],JSON[_0x4bac('0x78')](_0x116101[_0x4bac('0x6d')][_0x4bac('0x79')]))},client9002)[_0x4bac('0x38')](function(){return _0x116101;});}return _0x116101;}return null;})['then'](respondWithResult(_0x3704c3,null))[_0x4bac('0x2c')](handleError(_0x3704c3,null));};var interaction_log=require('../../config/logger')(_0x4bac('0x7a'));exports[_0x4bac('0x35')]=function(_0x31692e,_0x5aab8a,_0x23bffc){var _0x277437={'agent':{},'channel':_0x4bac('0x5f')};if(_0x31692e['body']['id']){delete _0x31692e[_0x4bac('0x5b')]['id'];}_0x31692e[_0x4bac('0x5b')][_0x4bac('0x69')]=_0x31692e[_0x4bac('0x5b')][_0x4bac('0x69')]||_0x31692e[_0x4bac('0x63')]['id'];_0x277437[_0x4bac('0x7b')]['id']=_0x31692e['body'][_0x4bac('0x69')];return db['ChatMessage']['find']({'where':{'id':_0x31692e[_0x4bac('0x55')]['id'],'UserId':null}})[_0x4bac('0x38')](handleEntityNotFound(_0x5aab8a,null))[_0x4bac('0x38')](function(_0xff2a1a){if(_0xff2a1a){_0x277437[_0x4bac('0x29')]=_0xff2a1a['get']({'plain':!![]});return db[_0x4bac('0x67')][_0x4bac('0x59')]({'where':{'id':_0xff2a1a[_0x4bac('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x5aab8a,null))['then'](function(_0x2f2756){if(_0x2f2756){_0x277437['interaction']=_0x2f2756[_0x4bac('0x66')]({'plain':!![]});interaction_log[_0x4bac('0x2a')](_0x4bac('0x7c'),_0x31692e[_0x4bac('0x63')]['id'],_0x31692e[_0x4bac('0x63')]['name'],_0x31692e[_0x4bac('0x63')][_0x4bac('0x7d')],_0x277437[_0x4bac('0x6d')]['id'],_0x31692e[_0x4bac('0x5b')]?JSON[_0x4bac('0x26')](_0x31692e[_0x4bac('0x5b')]):_0x4bac('0x6f'));return respondWithRpcPromise('RejectMessage',_0x4bac('0x7e'),_0x277437);}return null;})[_0x4bac('0x38')](function(_0x567fb2){if(_0x567fb2){_0x567fb2[_0x4bac('0x29')]['interface']=util[_0x4bac('0x62')](_0x4bac('0x74'),_0x31692e['user'][_0x4bac('0x3b')]);_0x567fb2[_0x4bac('0x29')][_0x4bac('0x75')]=_0x277437[_0x4bac('0x75')];_0x567fb2['message'][_0x4bac('0x7f')]='reject';respondWithRpcPromise(_0x4bac('0x76'),_0x4bac('0x76'),{'event':_0x4bac('0x80'),'message':_0x567fb2[_0x4bac('0x29')]},client9002);return _0x277437;}return null;})[_0x4bac('0x38')](respondWithResult(_0x5aab8a,null))['catch'](handleError(_0x5aab8a,null));}; \ No newline at end of file +var _0x0720=['include','find','create','body','describe','../../config/logger','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','interface','SIP/%s','channel','event','accept','EventManager','parse','formData','chat-interactions','chat','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','show','params','fields'];(function(_0x477fdb,_0x462b55){var _0x32beaf=function(_0x1f9528){while(--_0x1f9528){_0x477fdb['push'](_0x477fdb['shift']());}};_0x32beaf(++_0x462b55);}(_0x0720,0x183));var _0x0072=function(_0x5737ac,_0x147697){_0x5737ac=_0x5737ac-0x0;var _0x599c28=_0x0720[_0x5737ac];return _0x599c28;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0072('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0072('0x1'));var jsonpatch=require(_0x0072('0x2'));var rp=require(_0x0072('0x3'));var moment=require(_0x0072('0x4'));var BPromise=require(_0x0072('0x5'));var Mustache=require(_0x0072('0x6'));var util=require(_0x0072('0x7'));var path=require('path');var sox=require(_0x0072('0x8'));var csv=require(_0x0072('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0072('0xa'));var squel=require(_0x0072('0xb'));var crypto=require(_0x0072('0xc'));var jsforce=require(_0x0072('0xd'));var deskjs=require(_0x0072('0xe'));var toCsv=require(_0x0072('0x9'));var querystring=require(_0x0072('0xf'));var Papa=require(_0x0072('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0072('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0072('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0072('0x13'));var config=require(_0x0072('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0072('0x15'))['db'];config[_0x0072('0x16')]=_[_0x0072('0x17')](config[_0x0072('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0072('0x18'))(new Redis(config[_0x0072('0x16')]));require(_0x0072('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0072('0x1a')][_0x0072('0x1b')]({'port':0x232c});var client9002=jayson[_0x0072('0x1a')][_0x0072('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4aeda2,_0x478241,_0x345ded,_0x13afe1){return new BPromise(function(_0x1cd69d,_0x5bd16e){var _0xbbb6a0=_0x13afe1||client;return _0xbbb6a0['request'](_0x4aeda2,_0x345ded)[_0x0072('0x1c')](function(_0x3df269){logger[_0x0072('0x1d')](_0x0072('0x1e'),_0x478241,_0x0072('0x1f'));logger[_0x0072('0x20')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x478241,_0x0072('0x1f'),JSON[_0x0072('0x21')](_0x3df269));if(_0x3df269[_0x0072('0x22')]){if(_0x3df269['error'][_0x0072('0x23')]===0x1f4){logger[_0x0072('0x22')](_0x0072('0x1e'),_0x478241,_0x3df269[_0x0072('0x22')][_0x0072('0x24')]);return _0x5bd16e(_0x3df269[_0x0072('0x22')][_0x0072('0x24')]);}logger[_0x0072('0x22')]('ChatMessage,\x20%s,\x20%s',_0x478241,_0x3df269[_0x0072('0x22')]['message']);return _0x1cd69d(_0x3df269[_0x0072('0x22')][_0x0072('0x24')]);}else{logger[_0x0072('0x1d')](_0x0072('0x1e'),_0x478241,'request\x20sent');_0x1cd69d(_0x3df269[_0x0072('0x25')]['message']);}})[_0x0072('0x26')](function(_0x3b5b7f){logger['error'](_0x0072('0x1e'),_0x478241,_0x3b5b7f);_0x5bd16e(_0x3b5b7f);});});}function respondWithStatusCode(_0x1ece3a,_0x547d09){_0x547d09=_0x547d09||0xcc;return function(_0x1641d7){if(_0x1641d7){return _0x1ece3a['sendStatus'](_0x547d09);}return _0x1ece3a['status'](_0x547d09)['end']();};}function respondWithResult(_0x3bfdeb,_0x44c821){_0x44c821=_0x44c821||0xc8;return function(_0x45d93a){if(_0x45d93a){return _0x3bfdeb[_0x0072('0x27')](_0x44c821)['json'](_0x45d93a);}};}function respondWithFilteredResult(_0x545c0b,_0xfe695d){return function(_0x4ac5bc){if(_0x4ac5bc){var _0x59f726=_0x4ac5bc[_0x0072('0x28')],_0xd4858d=_0xfe695d[_0x0072('0x29')],_0x472cf1=_0xfe695d[_0x0072('0x29')]+_0xfe695d[_0x0072('0x2a')],_0xd0669a;if(_0x472cf1>=_0x59f726){_0x472cf1=_0x59f726;_0xd0669a=0xc8;}else{_0xd0669a=0xce;}_0x545c0b[_0x0072('0x27')](_0xd0669a);return _0x545c0b[_0x0072('0x2b')](_0x0072('0x2c'),_0xd4858d+'-'+_0x472cf1+'/'+_0x59f726)[_0x0072('0x2d')](_0x4ac5bc);}return null;};}function patchUpdates(_0x31a800){return function(_0x98e44d){try{jsonpatch[_0x0072('0x2e')](_0x98e44d,_0x31a800,!![]);}catch(_0x35f24e){return BPromise[_0x0072('0x2f')](_0x35f24e);}return _0x98e44d[_0x0072('0x30')]();};}function saveUpdates(_0x70bc94,_0x58f97f){return function(_0x31bfef){if(_0x31bfef){return _0x31bfef[_0x0072('0x31')](_0x70bc94)[_0x0072('0x1c')](function(_0xe90d9b){return _0xe90d9b;});}return null;};}function removeEntity(_0x5761dc,_0x57fdba){return function(_0x3ef6f5){if(_0x3ef6f5){return _0x3ef6f5[_0x0072('0x32')]()[_0x0072('0x1c')](function(){_0x5761dc[_0x0072('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d9cff,_0x579a1c){return function(_0x4ab8cd){if(!_0x4ab8cd){_0x3d9cff[_0x0072('0x33')](0x194);}return _0x4ab8cd;};}function handleError(_0x2eb260,_0x4c5b66){_0x4c5b66=_0x4c5b66||0x1f4;return function(_0xddad91){logger['error'](_0xddad91[_0x0072('0x34')]);if(_0xddad91[_0x0072('0x35')]){delete _0xddad91[_0x0072('0x35')];}_0x2eb260[_0x0072('0x27')](_0x4c5b66)[_0x0072('0x36')](_0xddad91);};}exports[_0x0072('0x37')]=function(_0x5a140a,_0x10e599){var _0x1fab2e={},_0x4c49ed={},_0x2176a0={'count':0x0,'rows':[]};var _0x40b780=_[_0x0072('0x38')](db[_0x0072('0x39')][_0x0072('0x3a')],function(_0xc19ffc){return{'name':_0xc19ffc['fieldName'],'type':_0xc19ffc[_0x0072('0x3b')][_0x0072('0x3c')]};});_0x4c49ed[_0x0072('0x3d')]=_[_0x0072('0x38')](_0x40b780,'name');_0x4c49ed[_0x0072('0x3e')]=_[_0x0072('0x3f')](_0x5a140a[_0x0072('0x3e')]);_0x4c49ed['filters']=_['intersection'](_0x4c49ed['model'],_0x4c49ed[_0x0072('0x3e')]);_0x1fab2e['attributes']=_[_0x0072('0x40')](_0x4c49ed[_0x0072('0x3d')],qs['fields'](_0x5a140a['query']['fields']));_0x1fab2e[_0x0072('0x41')]=_0x1fab2e[_0x0072('0x41')][_0x0072('0x42')]?_0x1fab2e['attributes']:_0x4c49ed[_0x0072('0x3d')];if(!_0x5a140a[_0x0072('0x3e')][_0x0072('0x43')](_0x0072('0x44'))){_0x1fab2e[_0x0072('0x2a')]=qs[_0x0072('0x2a')](_0x5a140a[_0x0072('0x3e')][_0x0072('0x2a')]);_0x1fab2e['offset']=qs['offset'](_0x5a140a[_0x0072('0x3e')]['offset']);}_0x1fab2e[_0x0072('0x45')]=qs[_0x0072('0x46')](_0x5a140a[_0x0072('0x3e')]['sort']);_0x1fab2e[_0x0072('0x47')]=qs[_0x0072('0x48')](_[_0x0072('0x49')](_0x5a140a['query'],_0x4c49ed[_0x0072('0x48')]),_0x40b780);if(_0x5a140a[_0x0072('0x3e')][_0x0072('0x4a')]){_0x1fab2e['where']=_[_0x0072('0x4b')](_0x1fab2e['where'],{'$or':_[_0x0072('0x38')](_0x40b780,function(_0x25b977){if(_0x25b977['type']!=='VIRTUAL'){var _0xb428fb={};_0xb428fb[_0x25b977['name']]={'$like':'%'+_0x5a140a['query']['filter']+'%'};return _0xb428fb;}})});}_0x1fab2e=_[_0x0072('0x4b')]({},_0x1fab2e,_0x5a140a[_0x0072('0x4c')]);var _0xb4c749={'where':_0x1fab2e[_0x0072('0x47')]};return db[_0x0072('0x39')]['count'](_0xb4c749)[_0x0072('0x1c')](function(_0xffd1e4){_0x2176a0[_0x0072('0x28')]=_0xffd1e4;if(_0x5a140a[_0x0072('0x3e')][_0x0072('0x4d')]){_0x1fab2e['include']=[{'all':!![]}];}return db[_0x0072('0x39')]['findAll'](_0x1fab2e);})[_0x0072('0x1c')](function(_0x4d011c){_0x2176a0['rows']=_0x4d011c;return _0x2176a0;})['then'](respondWithFilteredResult(_0x10e599,_0x1fab2e))[_0x0072('0x26')](handleError(_0x10e599,null));};exports[_0x0072('0x4e')]=function(_0x3225be,_0x542dc1){var _0xb16a35={'raw':!![],'where':{'id':_0x3225be[_0x0072('0x4f')]['id']}},_0x4b6bc6={};_0x4b6bc6[_0x0072('0x3d')]=_[_0x0072('0x3f')](db['ChatMessage'][_0x0072('0x3a')]);_0x4b6bc6[_0x0072('0x3e')]=_[_0x0072('0x3f')](_0x3225be[_0x0072('0x3e')]);_0x4b6bc6[_0x0072('0x48')]=_[_0x0072('0x40')](_0x4b6bc6[_0x0072('0x3d')],_0x4b6bc6['query']);_0xb16a35['attributes']=_[_0x0072('0x40')](_0x4b6bc6[_0x0072('0x3d')],qs[_0x0072('0x50')](_0x3225be[_0x0072('0x3e')][_0x0072('0x50')]));_0xb16a35[_0x0072('0x41')]=_0xb16a35['attributes'][_0x0072('0x42')]?_0xb16a35[_0x0072('0x41')]:_0x4b6bc6['model'];if(_0x3225be[_0x0072('0x3e')][_0x0072('0x4d')]){_0xb16a35[_0x0072('0x51')]=[{'all':!![]}];}_0xb16a35=_[_0x0072('0x4b')]({},_0xb16a35,_0x3225be['options']);return db[_0x0072('0x39')][_0x0072('0x52')](_0xb16a35)['then'](handleEntityNotFound(_0x542dc1,null))[_0x0072('0x1c')](respondWithResult(_0x542dc1,null))[_0x0072('0x26')](handleError(_0x542dc1,null));};exports[_0x0072('0x53')]=function(_0x279b42,_0x4e8e47){return db['ChatMessage'][_0x0072('0x53')](_0x279b42['body'],{})[_0x0072('0x1c')](respondWithResult(_0x4e8e47,0xc9))[_0x0072('0x26')](handleError(_0x4e8e47,null));};exports[_0x0072('0x31')]=function(_0x29220c,_0x4fa041){if(_0x29220c[_0x0072('0x54')]['id']){delete _0x29220c[_0x0072('0x54')]['id'];}return db[_0x0072('0x39')][_0x0072('0x52')]({'where':{'id':_0x29220c[_0x0072('0x4f')]['id']}})[_0x0072('0x1c')](handleEntityNotFound(_0x4fa041,null))[_0x0072('0x1c')](saveUpdates(_0x29220c[_0x0072('0x54')],null))[_0x0072('0x1c')](respondWithResult(_0x4fa041,null))[_0x0072('0x26')](handleError(_0x4fa041,null));};exports['destroy']=function(_0x1c083c,_0x51c1bb){return db[_0x0072('0x39')][_0x0072('0x52')]({'where':{'id':_0x1c083c['params']['id']}})[_0x0072('0x1c')](handleEntityNotFound(_0x51c1bb,null))[_0x0072('0x1c')](removeEntity(_0x51c1bb,null))[_0x0072('0x26')](handleError(_0x51c1bb,null));};exports[_0x0072('0x55')]=function(_0x148d83,_0x496b51){return db[_0x0072('0x39')]['describe']()['then'](respondWithResult(_0x496b51,null))[_0x0072('0x26')](handleError(_0x496b51,null));};var interaction_log=require(_0x0072('0x56'))('chat-interactions');exports['accept']=function(_0x143b97,_0x47c5cb,_0x3002d4){var _0x3104e2={'channel':'chat'};if(_0x143b97[_0x0072('0x54')]['id']){delete _0x143b97[_0x0072('0x54')]['id'];}_0x143b97[_0x0072('0x54')]['read']=!![];_0x143b97[_0x0072('0x54')][_0x0072('0x57')]=moment()[_0x0072('0x58')](_0x0072('0x59'));_0x143b97[_0x0072('0x54')][_0x0072('0x5a')]=_0x143b97[_0x0072('0x54')][_0x0072('0x5a')]||_0x143b97[_0x0072('0x5b')]['id'];return db[_0x0072('0x39')][_0x0072('0x52')]({'where':{'id':_0x143b97['params']['id'],'UserId':null},'include':[{'model':db[_0x0072('0x5c')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x47c5cb,null))[_0x0072('0x1c')](saveUpdates(_0x143b97[_0x0072('0x54')],null))['then'](function(_0x4f58fa){if(_0x4f58fa){_0x3104e2[_0x0072('0x24')]=_0x4f58fa[_0x0072('0x5d')]({'plain':!![]});return db[_0x0072('0x5e')][_0x0072('0x52')]({'where':{'id':_0x4f58fa[_0x0072('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x47c5cb,null))[_0x0072('0x1c')](function(_0x1e4adf){if(_0x1e4adf){return _0x1e4adf['update']({'UserId':_0x143b97[_0x0072('0x54')][_0x0072('0x5a')],'read1stAt':_['isNil'](_0x1e4adf[_0x0072('0x60')])?moment()[_0x0072('0x58')](_0x0072('0x59')):undefined});}return null;})['then'](function(_0x392ed2){if(_0x392ed2){_0x3104e2['interaction']=_0x392ed2['get']({'plain':!![]});interaction_log[_0x0072('0x1d')](_0x0072('0x61'),_0x143b97[_0x0072('0x5b')]['id'],_0x143b97[_0x0072('0x5b')][_0x0072('0x35')],_0x143b97[_0x0072('0x5b')][_0x0072('0x62')],_0x3104e2[_0x0072('0x63')]['id'],_0x143b97[_0x0072('0x54')]?JSON['stringify'](_0x143b97[_0x0072('0x54')]):_0x0072('0x64'));return respondWithRpcPromise('AcceptMessage',_0x0072('0x65'),_0x3104e2);}return null;})[_0x0072('0x1c')](function(_0x36d54b){if(_0x36d54b){if(_0x143b97[_0x0072('0x54')]['manual']){_0x3104e2['message'][_0x0072('0x66')]=util[_0x0072('0x58')](_0x0072('0x67'),_0x143b97['user'][_0x0072('0x35')]);_0x3104e2['message'][_0x0072('0x68')]=_0x3104e2[_0x0072('0x68')];_0x3104e2['message'][_0x0072('0x69')]=_0x0072('0x6a');return respondWithRpcPromise(_0x0072('0x6b'),_0x0072('0x6b'),{'event':'acceptmessage','message':_[_0x0072('0x4b')](_0x3104e2[_0x0072('0x24')],JSON[_0x0072('0x6c')](_0x3104e2[_0x0072('0x63')][_0x0072('0x6d')]))},client9002)[_0x0072('0x1c')](function(){return _0x3104e2;});}return _0x3104e2;}return null;})['then'](respondWithResult(_0x47c5cb,null))[_0x0072('0x26')](handleError(_0x47c5cb,null));};var interaction_log=require(_0x0072('0x56'))(_0x0072('0x6e'));exports[_0x0072('0x2f')]=function(_0x473e4d,_0x2b84a2,_0x27e2fe){var _0x44fed8={'agent':{},'channel':_0x0072('0x6f')};if(_0x473e4d[_0x0072('0x54')]['id']){delete _0x473e4d[_0x0072('0x54')]['id'];}_0x473e4d[_0x0072('0x54')][_0x0072('0x5a')]=_0x473e4d[_0x0072('0x54')][_0x0072('0x5a')]||_0x473e4d[_0x0072('0x5b')]['id'];_0x44fed8[_0x0072('0x70')]['id']=_0x473e4d['body'][_0x0072('0x5a')];return db[_0x0072('0x39')]['find']({'where':{'id':_0x473e4d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b84a2,null))[_0x0072('0x1c')](function(_0x210287){if(_0x210287){_0x44fed8[_0x0072('0x24')]=_0x210287[_0x0072('0x5d')]({'plain':!![]});return db[_0x0072('0x5e')][_0x0072('0x52')]({'where':{'id':_0x210287[_0x0072('0x5f')]}});}return null;})[_0x0072('0x1c')](handleEntityNotFound(_0x2b84a2,null))[_0x0072('0x1c')](function(_0x185c1f){if(_0x185c1f){_0x44fed8['interaction']=_0x185c1f[_0x0072('0x5d')]({'plain':!![]});interaction_log[_0x0072('0x1d')](_0x0072('0x71'),_0x473e4d['user']['id'],_0x473e4d[_0x0072('0x5b')]['name'],_0x473e4d[_0x0072('0x5b')]['role'],_0x44fed8[_0x0072('0x63')]['id'],_0x473e4d[_0x0072('0x54')]?JSON['stringify'](_0x473e4d['body']):_0x0072('0x64'));return respondWithRpcPromise(_0x0072('0x72'),_0x0072('0x73'),_0x44fed8);}return null;})[_0x0072('0x1c')](function(_0x4ebe65){if(_0x4ebe65){_0x4ebe65[_0x0072('0x24')][_0x0072('0x66')]=util[_0x0072('0x58')](_0x0072('0x67'),_0x473e4d['user']['name']);_0x4ebe65[_0x0072('0x24')][_0x0072('0x68')]=_0x44fed8[_0x0072('0x68')];_0x4ebe65['message'][_0x0072('0x69')]='reject';respondWithRpcPromise(_0x0072('0x6b'),'EventManager',{'event':_0x0072('0x74'),'message':_0x4ebe65[_0x0072('0x24')]},client9002);return _0x44fed8;}return null;})[_0x0072('0x1c')](respondWithResult(_0x2b84a2,null))[_0x0072('0x26')](handleError(_0x2b84a2,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 4d15e25..6748748 100644 --- a/server/api/chatMessage/chatMessage.events.js +++ b/server/api/chatMessage/chatMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8419=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb','ChatMessage'];(function(_0xb19941,_0x589a72){var _0x20b096=function(_0x1f6949){while(--_0x1f6949){_0xb19941['push'](_0xb19941['shift']());}};_0x20b096(++_0x589a72);}(_0x8419,0xa6));var _0x9841=function(_0x37cdee,_0x29ffea){_0x37cdee=_0x37cdee-0x0;var _0x2bfd1c=_0x8419[_0x37cdee];return _0x2bfd1c;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x9841('0x0'))['db'][_0x9841('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9841('0x2')](0x0);var events={'afterCreate':_0x9841('0x3'),'afterUpdate':'update','afterDestroy':_0x9841('0x4')};function emitEvent(_0x340f95){return function(_0x5ea64a,_0xf5485d,_0x56ada3){ChatMessageEvents['emit'](_0x340f95+':'+_0x5ea64a['id'],_0x5ea64a);ChatMessageEvents[_0x9841('0x5')](_0x340f95,_0x5ea64a);_0x56ada3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x9841('0x6')](e,emitEvent(event));}}module[_0x9841('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x4911=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x17eae9,_0x23d6ee){var _0x187c53=function(_0xc6a57c){while(--_0xc6a57c){_0x17eae9['push'](_0x17eae9['shift']());}};_0x187c53(++_0x23d6ee);}(_0x4911,0x17a));var _0x1491=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0x4911[_0x834bb6];return _0xa35d00;};'use strict';var EventEmitter=require(_0x1491('0x0'));var ChatMessage=require(_0x1491('0x1'))['db'][_0x1491('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1491('0x3')](0x0);var events={'afterCreate':_0x1491('0x4'),'afterUpdate':_0x1491('0x5'),'afterDestroy':_0x1491('0x6')};function emitEvent(_0xdc7d02){return function(_0x30ea85,_0x29a260,_0x2d521){ChatMessageEvents['emit'](_0xdc7d02+':'+_0x30ea85['id'],_0x30ea85);ChatMessageEvents[_0x1491('0x7')](_0xdc7d02,_0x30ea85);_0x2d521(null);};}for(var e in events){if(events[_0x1491('0x8')](e)){var event=events[e];ChatMessage[_0x1491('0x9')](e,emitEvent(event));}}module[_0x1491('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 256e9eb..3a89cdb 100644 --- a/server/api/chatMessage/chatMessage.model.js +++ b/server/api/chatMessage/chatMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x778f=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','chat_messages','FULLTEXT','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update'];(function(_0x5037f3,_0x22d8eb){var _0x52b90f=function(_0x11b219){while(--_0x11b219){_0x5037f3['push'](_0x5037f3['shift']());}};_0x52b90f(++_0x22d8eb);}(_0x778f,0xdc));var _0xf778=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x778f[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0xf778('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf778('0x1'));var moment=require(_0xf778('0x2'));var BPromise=require(_0xf778('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf778('0x4'));var rimraf=require(_0xf778('0x5'));var config=require(_0xf778('0x6'));var attributes=require(_0xf778('0x7'));module['exports']=function(_0x10ea7b,_0x32cf6f){return _0x10ea7b['define']('ChatMessage',attributes,{'tableName':_0xf778('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xf778('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x348ec1,_0x2c9e01,_0x103b73){var _0x25a4f2=_0x10ea7b['models'];var _0xbe1cc1=_0x348ec1['get']({'plain':!![]});if(_0xbe1cc1[_0xf778('0xa')][_0xf778('0xb')]()==='in'||_0xbe1cc1['direction']['toLowerCase']()===_0xf778('0xc')&&!_0xbe1cc1['secret']&&!_[_0xf778('0xd')](_0xbe1cc1[_0xf778('0xe')])){_0x25a4f2[_0xf778('0xf')][_0xf778('0x10')]({'where':{'id':_0xbe1cc1[_0xf778('0x11')]}})[_0xf778('0x12')](function(_0x2b5af0){if(_0x2b5af0){_0x2b5af0[_0xf778('0x13')]({'lastMsgAt':_0xbe1cc1['createdAt'],'lastMsgDirection':_0xbe1cc1[_0xf778('0xa')][_0xf778('0xb')]()});}})[_0xf778('0x14')](function(_0x1ef096){console[_0xf778('0x15')](_0x1ef096);});}_0x103b73();}},'charset':_0xf778('0x16'),'collate':_0xf778('0x17')});}; \ No newline at end of file +var _0x4a76=['ChatInteractionId','createdAt','catch','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne'];(function(_0x480f4a,_0x2ea3f8){var _0xdccb7d=function(_0x151258){while(--_0x151258){_0x480f4a['push'](_0x480f4a['shift']());}};_0xdccb7d(++_0x2ea3f8);}(_0x4a76,0x16d));var _0x64a7=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4a76[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x64a7('0x0'));var util=require('util');var logger=require(_0x64a7('0x1'))(_0x64a7('0x2'));var moment=require(_0x64a7('0x3'));var BPromise=require(_0x64a7('0x4'));var rp=require(_0x64a7('0x5'));var fs=require('fs');var path=require(_0x64a7('0x6'));var rimraf=require(_0x64a7('0x7'));var config=require(_0x64a7('0x8'));var attributes=require(_0x64a7('0x9'));module[_0x64a7('0xa')]=function(_0x40e5cb,_0x3757d1){return _0x40e5cb[_0x64a7('0xb')](_0x64a7('0xc'),attributes,{'tableName':_0x64a7('0xd'),'paranoid':![],'indexes':[{'name':_0x64a7('0xe'),'fields':[_0x64a7('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f5de7,_0x2db43c,_0x4d3105){var _0x5bcc28=_0x40e5cb[_0x64a7('0x10')];var _0x344348=_0x5f5de7[_0x64a7('0x11')]({'plain':!![]});if(_0x344348[_0x64a7('0x12')][_0x64a7('0x13')]()==='in'||_0x344348[_0x64a7('0x12')][_0x64a7('0x13')]()==='out'&&!_0x344348[_0x64a7('0x14')]&&!_[_0x64a7('0x15')](_0x344348[_0x64a7('0x16')])){_0x5bcc28[_0x64a7('0x17')][_0x64a7('0x18')]({'where':{'id':_0x344348[_0x64a7('0x19')]}})['then'](function(_0x8d3b16){if(_0x8d3b16){_0x8d3b16['update']({'lastMsgAt':_0x344348[_0x64a7('0x1a')],'lastMsgDirection':_0x344348[_0x64a7('0x12')]['toLowerCase']()});}})[_0x64a7('0x1b')](function(_0x1fecae){console[_0x64a7('0x1c')](_0x1fecae);});}_0x4d3105();}},'charset':_0x64a7('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e18eaef..a060bd9 100644 --- a/server/api/chatMessage/chatMessage.rpc.js +++ b/server/api/chatMessage/chatMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9068=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x9068,0x119));var _0x8906=function(_0x1e2ccf,_0x367b8b){_0x1e2ccf=_0x1e2ccf-0x0;var _0x1c4080=_0x9068[_0x1e2ccf];return _0x1c4080;};'use strict';var _=require(_0x8906('0x0'));var util=require(_0x8906('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8906('0x2'));var fs=require('fs');var Redis=require(_0x8906('0x3'));var db=require(_0x8906('0x4'))['db'];var utils=require(_0x8906('0x5'));var logger=require(_0x8906('0x6'))(_0x8906('0x7'));var config=require(_0x8906('0x8'));var jayson=require(_0x8906('0x9'));var client=jayson[_0x8906('0xa')][_0x8906('0xb')]({'port':0x232a});config['redis']=_[_0x8906('0xc')](config[_0x8906('0xd')],{'host':_0x8906('0xe'),'port':0x18eb});var socket=require(_0x8906('0xf'))(new Redis(config['redis']));require(_0x8906('0x10'))[_0x8906('0x11')](socket);function respondWithRpcPromise(_0x2c57af,_0x44ede9,_0x34adb3){return new BPromise(function(_0x2781e8,_0x52b121){return client[_0x8906('0x12')](_0x2c57af,_0x34adb3)[_0x8906('0x13')](function(_0xf0c21e){logger['info'](_0x8906('0x14'),_0x44ede9,'request\x20sent');logger[_0x8906('0x15')](_0x8906('0x16'),_0x44ede9,'request\x20sent',JSON[_0x8906('0x17')](_0xf0c21e));if(_0xf0c21e['error']){if(_0xf0c21e['error'][_0x8906('0x18')]===0x1f4){logger[_0x8906('0x19')](_0x8906('0x14'),_0x44ede9,_0xf0c21e[_0x8906('0x19')][_0x8906('0x1a')]);return _0x52b121(_0xf0c21e[_0x8906('0x19')][_0x8906('0x1a')]);}logger[_0x8906('0x19')](_0x8906('0x14'),_0x44ede9,_0xf0c21e[_0x8906('0x19')][_0x8906('0x1a')]);return _0x2781e8(_0xf0c21e[_0x8906('0x19')][_0x8906('0x1a')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x44ede9,_0x8906('0x1b'));_0x2781e8(_0xf0c21e[_0x8906('0x1c')][_0x8906('0x1a')]);}})[_0x8906('0x1d')](function(_0x3468ad){logger[_0x8906('0x19')](_0x8906('0x14'),_0x44ede9,_0x3468ad);_0x52b121(_0x3468ad);});});}exports[_0x8906('0x1e')]=function(_0x144fd6){var _0x25aa21=this;return new Promise(function(_0x4ec816,_0x540834){return db[_0x8906('0x1f')][_0x8906('0x20')](_0x144fd6[_0x8906('0x21')],{'raw':_0x144fd6['options']?_0x144fd6[_0x8906('0x22')][_0x8906('0x23')]===undefined?!![]:![]:!![]})[_0x8906('0x13')](function(_0x3fb45a){logger['info']('CreateChatMessage',_0x144fd6);logger[_0x8906('0x15')](_0x8906('0x1e'),_0x144fd6,JSON[_0x8906('0x17')](_0x3fb45a));_0x4ec816(_0x3fb45a);})[_0x8906('0x1d')](function(_0x2c6d91){logger['error']('CreateChatMessage',_0x2c6d91[_0x8906('0x1a')],_0x144fd6);_0x540834(_0x25aa21[_0x8906('0x19')](0x1f4,_0x2c6d91[_0x8906('0x1a')]));});});}; \ No newline at end of file +var _0x800c=['defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x1cd042,_0x5c7451){var _0x29a214=function(_0x466a98){while(--_0x466a98){_0x1cd042['push'](_0x1cd042['shift']());}};_0x29a214(++_0x5c7451);}(_0x800c,0x79));var _0xc800=function(_0x1e7286,_0xc259ee){_0x1e7286=_0x1e7286-0x0;var _0x3ab62a=_0x800c[_0x1e7286];return _0x3ab62a;};'use strict';var _=require(_0xc800('0x0'));var util=require('util');var moment=require(_0xc800('0x1'));var BPromise=require(_0xc800('0x2'));var rs=require(_0xc800('0x3'));var fs=require('fs');var Redis=require(_0xc800('0x4'));var db=require(_0xc800('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc800('0x6'))(_0xc800('0x7'));var config=require(_0xc800('0x8'));var jayson=require(_0xc800('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc800('0xa')]=_[_0xc800('0xb')](config[_0xc800('0xa')],{'host':_0xc800('0xc'),'port':0x18eb});var socket=require(_0xc800('0xd'))(new Redis(config[_0xc800('0xa')]));require('./chatMessage.socket')[_0xc800('0xe')](socket);function respondWithRpcPromise(_0xf56cc4,_0x35ba01,_0x5aac7f){return new BPromise(function(_0x11d025,_0x523318){return client[_0xc800('0xf')](_0xf56cc4,_0x5aac7f)[_0xc800('0x10')](function(_0x452b0b){logger[_0xc800('0x11')](_0xc800('0x12'),_0x35ba01,_0xc800('0x13'));logger[_0xc800('0x14')](_0xc800('0x15'),_0x35ba01,_0xc800('0x13'),JSON[_0xc800('0x16')](_0x452b0b));if(_0x452b0b[_0xc800('0x17')]){if(_0x452b0b[_0xc800('0x17')][_0xc800('0x18')]===0x1f4){logger[_0xc800('0x17')](_0xc800('0x12'),_0x35ba01,_0x452b0b[_0xc800('0x17')][_0xc800('0x19')]);return _0x523318(_0x452b0b['error'][_0xc800('0x19')]);}logger[_0xc800('0x17')]('ChatMessage,\x20%s,\x20%s',_0x35ba01,_0x452b0b[_0xc800('0x17')][_0xc800('0x19')]);return _0x11d025(_0x452b0b[_0xc800('0x17')]['message']);}else{logger[_0xc800('0x11')](_0xc800('0x12'),_0x35ba01,_0xc800('0x13'));_0x11d025(_0x452b0b['result'][_0xc800('0x19')]);}})[_0xc800('0x1a')](function(_0x50221f){logger[_0xc800('0x17')](_0xc800('0x12'),_0x35ba01,_0x50221f);_0x523318(_0x50221f);});});}exports['CreateChatMessage']=function(_0x16e753){var _0x4bd155=this;return new Promise(function(_0x23f6c3,_0x4317da){return db[_0xc800('0x1b')][_0xc800('0x1c')](_0x16e753[_0xc800('0x1d')],{'raw':_0x16e753[_0xc800('0x1e')]?_0x16e753[_0xc800('0x1e')][_0xc800('0x1f')]===undefined?!![]:![]:!![]})[_0xc800('0x10')](function(_0x3bee42){logger[_0xc800('0x11')](_0xc800('0x20'),_0x16e753);logger['debug'](_0xc800('0x20'),_0x16e753,JSON[_0xc800('0x16')](_0x3bee42));_0x23f6c3(_0x3bee42);})[_0xc800('0x1a')](function(_0x1aca57){logger[_0xc800('0x17')](_0xc800('0x20'),_0x1aca57[_0xc800('0x19')],_0x16e753);_0x4317da(_0x4bd155[_0xc800('0x17')](0x1f4,_0x1aca57['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7fc5997..c17ecf6 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01d9=['./chatMessage.events','save','remove','update','emit','removeListener','register','length','chatMessage:'];(function(_0x357dfe,_0x498e50){var _0x4bbc02=function(_0x2df20b){while(--_0x2df20b){_0x357dfe['push'](_0x357dfe['shift']());}};_0x4bbc02(++_0x498e50);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var ChatMessageEvents=require(_0x901d('0x0'));var events=[_0x901d('0x1'),_0x901d('0x2'),_0x901d('0x3')];function createListener(_0x521cc9,_0x2ce1fd){return function(_0x28bf48){_0x2ce1fd[_0x901d('0x4')](_0x521cc9,_0x28bf48);};}function removeListener(_0x8f7b4,_0x214f38){return function(){ChatMessageEvents[_0x901d('0x5')](_0x8f7b4,_0x214f38);};}exports[_0x901d('0x6')]=function(_0x4e7842){for(var _0x1e5d7d=0x0,_0x6c9ac8=events[_0x901d('0x7')];_0x1e5d7d<_0x6c9ac8;_0x1e5d7d++){var _0x12c39f=events[_0x1e5d7d];var _0x313f85=createListener(_0x901d('0x8')+_0x12c39f,_0x4e7842);ChatMessageEvents['on'](_0x12c39f,_0x313f85);}}; \ No newline at end of file +var _0x5d58=['register'];(function(_0x41f99d,_0x5db144){var _0x39855b=function(_0x30cb83){while(--_0x30cb83){_0x41f99d['push'](_0x41f99d['shift']());}};_0x39855b(++_0x5db144);}(_0x5d58,0x187));var _0x85d5=function(_0x575589,_0x25f057){_0x575589=_0x575589-0x0;var _0x26ba7d=_0x5d58[_0x575589];return _0x26ba7d;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove','update'];function createListener(_0x501631,_0x64d32c){return function(_0x1eff3b){_0x64d32c['emit'](_0x501631,_0x1eff3b);};}function removeListener(_0x1469fc,_0x30bfe8){return function(){ChatMessageEvents['removeListener'](_0x1469fc,_0x30bfe8);};}exports[_0x85d5('0x0')]=function(_0x2d457a){for(var _0x578fad=0x0,_0x46e7b4=events['length'];_0x578fad<_0x46e7b4;_0x578fad++){var _0x98c963=events[_0x578fad];var _0x3fecca=createListener('chatMessage:'+_0x98c963,_0x2d457a);ChatMessageEvents['on'](_0x98c963,_0x3fecca);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d10ec6d..73c0acc 100644 --- a/server/api/chatMessage/index.js +++ b/server/api/chatMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports'];(function(_0x46d1e1,_0x3e6284){var _0x128ae0=function(_0x3f02f1){while(--_0x3f02f1){_0x46d1e1['push'](_0x46d1e1['shift']());}};_0x128ae0(++_0x3e6284);}(_0x91a8,0x17a));var _0x891a=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x91a8[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x891a('0x0'));var util=require(_0x891a('0x1'));var path=require(_0x891a('0x2'));var timeout=require(_0x891a('0x3'));var express=require('express');var router=express[_0x891a('0x4')]();var auth=require(_0x891a('0x5'));var interaction=require(_0x891a('0x6'));var config=require(_0x891a('0x7'));var controller=require(_0x891a('0x8'));router[_0x891a('0x9')]('/',auth[_0x891a('0xa')](),controller['index']);router[_0x891a('0x9')](_0x891a('0xb'),auth['isAuthenticated'](),controller[_0x891a('0xc')]);router['get'](_0x891a('0xd'),auth[_0x891a('0xa')](),controller[_0x891a('0xe')]);router[_0x891a('0xf')]('/',auth[_0x891a('0xa')](),interaction[_0x891a('0x10')](_0x891a('0x11'),_0x891a('0x12')),controller[_0x891a('0x13')]);router[_0x891a('0x14')](_0x891a('0xd'),controller[_0x891a('0x15')]);router[_0x891a('0x14')](_0x891a('0x16'),auth[_0x891a('0xa')](),controller[_0x891a('0x17')]);router[_0x891a('0x14')]('/:id/reject',auth[_0x891a('0xa')](),controller['reject']);router[_0x891a('0x18')](_0x891a('0xd'),auth[_0x891a('0xa')](),controller[_0x891a('0x19')]);module[_0x891a('0x1a')]=router; \ No newline at end of file +var _0x6128=['../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','tracked','chat','chatmessage:create','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0xaa3384,_0x2d409c){var _0x2ef945=function(_0x24c67b){while(--_0x24c67b){_0xaa3384['push'](_0xaa3384['shift']());}};_0x2ef945(++_0x2d409c);}(_0x6128,0x17a));var _0x8612=function(_0x1205b2,_0x1addbd){_0x1205b2=_0x1205b2-0x0;var _0x5c55b7=_0x6128[_0x1205b2];return _0x5c55b7;};'use strict';var multer=require(_0x8612('0x0'));var util=require(_0x8612('0x1'));var path=require(_0x8612('0x2'));var timeout=require('connect-timeout');var express=require(_0x8612('0x3'));var router=express[_0x8612('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8612('0x5'));var config=require(_0x8612('0x6'));var controller=require(_0x8612('0x7'));router[_0x8612('0x8')]('/',auth['isAuthenticated'](),controller[_0x8612('0x9')]);router[_0x8612('0x8')](_0x8612('0xa'),auth[_0x8612('0xb')](),controller[_0x8612('0xc')]);router[_0x8612('0x8')](_0x8612('0xd'),auth[_0x8612('0xb')](),controller['show']);router[_0x8612('0xe')]('/',auth[_0x8612('0xb')](),interaction[_0x8612('0xf')](_0x8612('0x10'),_0x8612('0x11')),controller['create']);router['put']('/:id',controller['update']);router[_0x8612('0x12')](_0x8612('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0x8612('0x12')](_0x8612('0x14'),auth['isAuthenticated'](),controller[_0x8612('0x15')]);router['delete'](_0x8612('0xd'),auth[_0x8612('0xb')](),controller[_0x8612('0x16')]);module[_0x8612('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 92117e9..d7aeb74 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c50=['exports','TEXT','medium','sequelize'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x3c50,0x167));var _0x03c5=function(_0xf6ae30,_0x4c4f07){_0xf6ae30=_0xf6ae30-0x0;var _0x35903d=_0x3c50[_0xf6ae30];return _0x35903d;};'use strict';var Sequelize=require(_0x03c5('0x0'));module[_0x03c5('0x1')]={'body':{'type':Sequelize[_0x03c5('0x2')](_0x03c5('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xd2c9=['sequelize','exports','TEXT','medium'];(function(_0x1548c9,_0x4aa1ae){var _0x5cb8b5=function(_0x3a787d){while(--_0x3a787d){_0x1548c9['push'](_0x1548c9['shift']());}};_0x5cb8b5(++_0x4aa1ae);}(_0xd2c9,0x1a8));var _0x9d2c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2c9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9d2c('0x0'));module[_0x9d2c('0x1')]={'body':{'type':Sequelize[_0x9d2c('0x2')](_0x9d2c('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 4315ebb..9ab7fd1 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7fa=['set','Content-Range','json','save','then','destroy','name','send','index','map','ChatOfflineMessage','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xaa7f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa7f('0x1'));var jsonpatch=require(_0xaa7f('0x2'));var rp=require(_0xaa7f('0x3'));var moment=require(_0xaa7f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa7f('0x5'));var util=require(_0xaa7f('0x6'));var path=require(_0xaa7f('0x7'));var sox=require(_0xaa7f('0x8'));var csv=require('to-csv');var ejs=require(_0xaa7f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa7f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaa7f('0xb'));var toCsv=require(_0xaa7f('0xc'));var querystring=require(_0xaa7f('0xd'));var Papa=require(_0xaa7f('0xe'));var Redis=require('ioredis');var authService=require(_0xaa7f('0xf'));var qs=require(_0xaa7f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa7f('0x11'));var logger=require(_0xaa7f('0x12'))(_0xaa7f('0x13'));var utils=require(_0xaa7f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa7f('0x15'))['db'];function respondWithStatusCode(_0x7e736,_0x2d03f3){_0x2d03f3=_0x2d03f3||0xcc;return function(_0x8c42d8){if(_0x8c42d8){return _0x7e736[_0xaa7f('0x16')](_0x2d03f3);}return _0x7e736[_0xaa7f('0x17')](_0x2d03f3)[_0xaa7f('0x18')]();};}function respondWithResult(_0x347929,_0x992494){_0x992494=_0x992494||0xc8;return function(_0x4dfb46){if(_0x4dfb46){return _0x347929[_0xaa7f('0x17')](_0x992494)['json'](_0x4dfb46);}};}function respondWithFilteredResult(_0x3c1615,_0x6ba90d){return function(_0x470c74){if(_0x470c74){var _0x48844f=_0x470c74[_0xaa7f('0x19')],_0x7276be=_0x6ba90d[_0xaa7f('0x1a')],_0x9a6745=_0x6ba90d[_0xaa7f('0x1a')]+_0x6ba90d[_0xaa7f('0x1b')],_0x1bd3f9;if(_0x9a6745>=_0x48844f){_0x9a6745=_0x48844f;_0x1bd3f9=0xc8;}else{_0x1bd3f9=0xce;}_0x3c1615['status'](_0x1bd3f9);return _0x3c1615[_0xaa7f('0x1c')](_0xaa7f('0x1d'),_0x7276be+'-'+_0x9a6745+'/'+_0x48844f)[_0xaa7f('0x1e')](_0x470c74);}return null;};}function patchUpdates(_0x2a0171){return function(_0x4d1119){try{jsonpatch['apply'](_0x4d1119,_0x2a0171,!![]);}catch(_0x182476){return BPromise['reject'](_0x182476);}return _0x4d1119[_0xaa7f('0x1f')]();};}function saveUpdates(_0x21e870,_0x4eac0b){return function(_0x25cce3){if(_0x25cce3){return _0x25cce3['update'](_0x21e870)[_0xaa7f('0x20')](function(_0xcf5c01){return _0xcf5c01;});}return null;};}function removeEntity(_0x3e203b,_0x516d7e){return function(_0x1436f7){if(_0x1436f7){return _0x1436f7[_0xaa7f('0x21')]()[_0xaa7f('0x20')](function(){_0x3e203b[_0xaa7f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e3d5e,_0x28d627){return function(_0x3effde){if(!_0x3effde){_0x5e3d5e[_0xaa7f('0x16')](0x194);}return _0x3effde;};}function handleError(_0x246a18,_0x316b30){_0x316b30=_0x316b30||0x1f4;return function(_0x1bd627){logger['error'](_0x1bd627['stack']);if(_0x1bd627['name']){delete _0x1bd627[_0xaa7f('0x22')];}_0x246a18['status'](_0x316b30)[_0xaa7f('0x23')](_0x1bd627);};}exports[_0xaa7f('0x24')]=function(_0x4c79fa,_0x46c83e){var _0x48e8e8={},_0x41b368={},_0xa26af={'count':0x0,'rows':[]};var _0x1fefc9=_[_0xaa7f('0x25')](db[_0xaa7f('0x26')]['rawAttributes'],function(_0x1541e1){return{'name':_0x1541e1[_0xaa7f('0x27')],'type':_0x1541e1[_0xaa7f('0x28')]['key']};});_0x41b368[_0xaa7f('0x29')]=_[_0xaa7f('0x25')](_0x1fefc9,_0xaa7f('0x22'));_0x41b368[_0xaa7f('0x2a')]=_[_0xaa7f('0x2b')](_0x4c79fa[_0xaa7f('0x2a')]);_0x41b368['filters']=_[_0xaa7f('0x2c')](_0x41b368[_0xaa7f('0x29')],_0x41b368['query']);_0x48e8e8[_0xaa7f('0x2d')]=_[_0xaa7f('0x2c')](_0x41b368[_0xaa7f('0x29')],qs[_0xaa7f('0x2e')](_0x4c79fa[_0xaa7f('0x2a')][_0xaa7f('0x2e')]));_0x48e8e8[_0xaa7f('0x2d')]=_0x48e8e8[_0xaa7f('0x2d')][_0xaa7f('0x2f')]?_0x48e8e8[_0xaa7f('0x2d')]:_0x41b368[_0xaa7f('0x29')];if(!_0x4c79fa[_0xaa7f('0x2a')][_0xaa7f('0x30')](_0xaa7f('0x31'))){_0x48e8e8[_0xaa7f('0x1b')]=qs['limit'](_0x4c79fa[_0xaa7f('0x2a')]['limit']);_0x48e8e8[_0xaa7f('0x1a')]=qs[_0xaa7f('0x1a')](_0x4c79fa['query'][_0xaa7f('0x1a')]);}_0x48e8e8[_0xaa7f('0x32')]=qs['sort'](_0x4c79fa[_0xaa7f('0x2a')][_0xaa7f('0x33')]);_0x48e8e8['where']=qs['filters'](_[_0xaa7f('0x34')](_0x4c79fa[_0xaa7f('0x2a')],_0x41b368[_0xaa7f('0x35')]),_0x1fefc9);if(_0x4c79fa[_0xaa7f('0x2a')][_0xaa7f('0x36')]){_0x48e8e8['where']=_['merge'](_0x48e8e8[_0xaa7f('0x37')],{'$or':_[_0xaa7f('0x25')](_0x1fefc9,function(_0x34dc5f){if(_0x34dc5f[_0xaa7f('0x28')]!==_0xaa7f('0x38')){var _0x34ce95={};_0x34ce95[_0x34dc5f[_0xaa7f('0x22')]]={'$like':'%'+_0x4c79fa['query'][_0xaa7f('0x36')]+'%'};return _0x34ce95;}})});}_0x48e8e8=_[_0xaa7f('0x39')]({},_0x48e8e8,_0x4c79fa[_0xaa7f('0x3a')]);var _0x109084={'where':_0x48e8e8[_0xaa7f('0x37')]};return db[_0xaa7f('0x26')][_0xaa7f('0x19')](_0x109084)[_0xaa7f('0x20')](function(_0x1e3924){_0xa26af[_0xaa7f('0x19')]=_0x1e3924;if(_0x4c79fa[_0xaa7f('0x2a')][_0xaa7f('0x3b')]){_0x48e8e8[_0xaa7f('0x3c')]=[{'all':!![]}];}return db[_0xaa7f('0x26')]['findAll'](_0x48e8e8);})[_0xaa7f('0x20')](function(_0x2c45e2){_0xa26af[_0xaa7f('0x3d')]=_0x2c45e2;return _0xa26af;})[_0xaa7f('0x20')](respondWithFilteredResult(_0x46c83e,_0x48e8e8))[_0xaa7f('0x3e')](handleError(_0x46c83e,null));};exports[_0xaa7f('0x3f')]=function(_0x2e4b7b,_0x3713d5){var _0x5e7360={'raw':!![],'where':{'id':_0x2e4b7b[_0xaa7f('0x40')]['id']}},_0x1c15dc={};_0x1c15dc[_0xaa7f('0x29')]=_[_0xaa7f('0x2b')](db['ChatOfflineMessage']['rawAttributes']);_0x1c15dc[_0xaa7f('0x2a')]=_['keys'](_0x2e4b7b['query']);_0x1c15dc['filters']=_['intersection'](_0x1c15dc[_0xaa7f('0x29')],_0x1c15dc[_0xaa7f('0x2a')]);_0x5e7360[_0xaa7f('0x2d')]=_[_0xaa7f('0x2c')](_0x1c15dc[_0xaa7f('0x29')],qs[_0xaa7f('0x2e')](_0x2e4b7b[_0xaa7f('0x2a')][_0xaa7f('0x2e')]));_0x5e7360['attributes']=_0x5e7360[_0xaa7f('0x2d')]['length']?_0x5e7360['attributes']:_0x1c15dc['model'];if(_0x2e4b7b[_0xaa7f('0x2a')][_0xaa7f('0x3b')]){_0x5e7360[_0xaa7f('0x3c')]=[{'all':!![]}];}_0x5e7360=_[_0xaa7f('0x39')]({},_0x5e7360,_0x2e4b7b[_0xaa7f('0x3a')]);return db['ChatOfflineMessage'][_0xaa7f('0x41')](_0x5e7360)[_0xaa7f('0x20')](handleEntityNotFound(_0x3713d5,null))[_0xaa7f('0x20')](respondWithResult(_0x3713d5,null))['catch'](handleError(_0x3713d5,null));};exports[_0xaa7f('0x42')]=function(_0x189bb4,_0x3f2880){return db['ChatOfflineMessage'][_0xaa7f('0x42')](_0x189bb4[_0xaa7f('0x43')],{})[_0xaa7f('0x20')](respondWithResult(_0x3f2880,0xc9))[_0xaa7f('0x3e')](handleError(_0x3f2880,null));};exports[_0xaa7f('0x44')]=function(_0x5a481b,_0x851a8e){if(_0x5a481b[_0xaa7f('0x43')]['id']){delete _0x5a481b['body']['id'];}return db[_0xaa7f('0x26')][_0xaa7f('0x41')]({'where':{'id':_0x5a481b[_0xaa7f('0x40')]['id']}})[_0xaa7f('0x20')](handleEntityNotFound(_0x851a8e,null))[_0xaa7f('0x20')](saveUpdates(_0x5a481b[_0xaa7f('0x43')],null))[_0xaa7f('0x20')](respondWithResult(_0x851a8e,null))[_0xaa7f('0x3e')](handleError(_0x851a8e,null));};exports['destroy']=function(_0x54eaf5,_0x3e6644){return db[_0xaa7f('0x26')][_0xaa7f('0x41')]({'where':{'id':_0x54eaf5[_0xaa7f('0x40')]['id']}})[_0xaa7f('0x20')](handleEntityNotFound(_0x3e6644,null))['then'](removeEntity(_0x3e6644,null))[_0xaa7f('0x3e')](handleError(_0x3e6644,null));};exports['describe']=function(_0x387a8d,_0x5e2c3c){return db['ChatOfflineMessage'][_0xaa7f('0x45')]()[_0xaa7f('0x20')](respondWithResult(_0x5e2c3c,null))[_0xaa7f('0x3e')](handleError(_0x5e2c3c,null));}; \ No newline at end of file +var _0x33a5=['sort','where','filter','VIRTUAL','merge','options','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','query','order'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x33a5,0x180));var _0x533a=function(_0x1d7119,_0x43dd94){_0x1d7119=_0x1d7119-0x0;var _0x2fd750=_0x33a5[_0x1d7119];return _0x2fd750;};'use strict';var pdf=require(_0x533a('0x0'));var emlformat=require(_0x533a('0x1'));var rimraf=require(_0x533a('0x2'));var zipdir=require(_0x533a('0x3'));var jsonpatch=require(_0x533a('0x4'));var rp=require('request-promise');var moment=require(_0x533a('0x5'));var BPromise=require(_0x533a('0x6'));var Mustache=require(_0x533a('0x7'));var util=require(_0x533a('0x8'));var path=require(_0x533a('0x9'));var sox=require(_0x533a('0xa'));var csv=require(_0x533a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x533a('0xc'));var squel=require(_0x533a('0xd'));var crypto=require('crypto');var jsforce=require(_0x533a('0xe'));var deskjs=require(_0x533a('0xf'));var toCsv=require(_0x533a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x533a('0x10'));var qs=require(_0x533a('0x11'));var as=require(_0x533a('0x12'));var hardwareService=require(_0x533a('0x13'));var logger=require(_0x533a('0x14'))(_0x533a('0x15'));var utils=require(_0x533a('0x16'));var config=require(_0x533a('0x17'));var licenseUtil=require(_0x533a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd50489,_0x25565d){_0x25565d=_0x25565d||0xcc;return function(_0x248efd){if(_0x248efd){return _0xd50489[_0x533a('0x19')](_0x25565d);}return _0xd50489['status'](_0x25565d)['end']();};}function respondWithResult(_0x3e829c,_0x38d662){_0x38d662=_0x38d662||0xc8;return function(_0x249785){if(_0x249785){return _0x3e829c[_0x533a('0x1a')](_0x38d662)[_0x533a('0x1b')](_0x249785);}};}function respondWithFilteredResult(_0xaa0bda,_0x2deab5){return function(_0x3d3c2f){if(_0x3d3c2f){var _0x4f3604=_0x3d3c2f[_0x533a('0x1c')],_0x18a6c0=_0x2deab5[_0x533a('0x1d')],_0x51b6bb=_0x2deab5['offset']+_0x2deab5['limit'],_0x592d0d;if(_0x51b6bb>=_0x4f3604){_0x51b6bb=_0x4f3604;_0x592d0d=0xc8;}else{_0x592d0d=0xce;}_0xaa0bda['status'](_0x592d0d);return _0xaa0bda[_0x533a('0x1e')](_0x533a('0x1f'),_0x18a6c0+'-'+_0x51b6bb+'/'+_0x4f3604)[_0x533a('0x1b')](_0x3d3c2f);}return null;};}function patchUpdates(_0x13dbaa){return function(_0x46d304){try{jsonpatch['apply'](_0x46d304,_0x13dbaa,!![]);}catch(_0x4c998e){return BPromise[_0x533a('0x20')](_0x4c998e);}return _0x46d304[_0x533a('0x21')]();};}function saveUpdates(_0x4d738b,_0x4b4793){return function(_0x3297c2){if(_0x3297c2){return _0x3297c2[_0x533a('0x22')](_0x4d738b)['then'](function(_0x114adc){return _0x114adc;});}return null;};}function removeEntity(_0x36ffcb,_0x1fac0d){return function(_0x1d5e61){if(_0x1d5e61){return _0x1d5e61[_0x533a('0x23')]()[_0x533a('0x24')](function(){_0x36ffcb[_0x533a('0x1a')](0xcc)[_0x533a('0x25')]();});}};}function handleEntityNotFound(_0x36d7ce,_0xedfdbb){return function(_0x49400a){if(!_0x49400a){_0x36d7ce[_0x533a('0x19')](0x194);}return _0x49400a;};}function handleError(_0x5035bd,_0x1ac3ab){_0x1ac3ab=_0x1ac3ab||0x1f4;return function(_0x21ab17){logger[_0x533a('0x26')](_0x21ab17[_0x533a('0x27')]);if(_0x21ab17[_0x533a('0x28')]){delete _0x21ab17[_0x533a('0x28')];}_0x5035bd[_0x533a('0x1a')](_0x1ac3ab)[_0x533a('0x29')](_0x21ab17);};}exports['index']=function(_0x1d7fcd,_0x289d80){var _0xf20f={},_0x1b3ee9={},_0x3a1843={'count':0x0,'rows':[]};var _0x168d2c=_[_0x533a('0x2a')](db[_0x533a('0x2b')][_0x533a('0x2c')],function(_0x4e69d9){return{'name':_0x4e69d9[_0x533a('0x2d')],'type':_0x4e69d9[_0x533a('0x2e')][_0x533a('0x2f')]};});_0x1b3ee9[_0x533a('0x30')]=_[_0x533a('0x2a')](_0x168d2c,'name');_0x1b3ee9['query']=_[_0x533a('0x31')](_0x1d7fcd['query']);_0x1b3ee9[_0x533a('0x32')]=_[_0x533a('0x33')](_0x1b3ee9['model'],_0x1b3ee9['query']);_0xf20f[_0x533a('0x34')]=_['intersection'](_0x1b3ee9[_0x533a('0x30')],qs[_0x533a('0x35')](_0x1d7fcd['query']['fields']));_0xf20f[_0x533a('0x34')]=_0xf20f[_0x533a('0x34')][_0x533a('0x36')]?_0xf20f[_0x533a('0x34')]:_0x1b3ee9[_0x533a('0x30')];if(!_0x1d7fcd['query'][_0x533a('0x37')](_0x533a('0x38'))){_0xf20f['limit']=qs[_0x533a('0x39')](_0x1d7fcd[_0x533a('0x3a')][_0x533a('0x39')]);_0xf20f[_0x533a('0x1d')]=qs[_0x533a('0x1d')](_0x1d7fcd[_0x533a('0x3a')][_0x533a('0x1d')]);}_0xf20f[_0x533a('0x3b')]=qs[_0x533a('0x3c')](_0x1d7fcd[_0x533a('0x3a')][_0x533a('0x3c')]);_0xf20f[_0x533a('0x3d')]=qs[_0x533a('0x32')](_['pick'](_0x1d7fcd[_0x533a('0x3a')],_0x1b3ee9[_0x533a('0x32')]),_0x168d2c);if(_0x1d7fcd[_0x533a('0x3a')][_0x533a('0x3e')]){_0xf20f[_0x533a('0x3d')]=_['merge'](_0xf20f[_0x533a('0x3d')],{'$or':_[_0x533a('0x2a')](_0x168d2c,function(_0x47eada){if(_0x47eada['type']!==_0x533a('0x3f')){var _0x55a08b={};_0x55a08b[_0x47eada[_0x533a('0x28')]]={'$like':'%'+_0x1d7fcd['query'][_0x533a('0x3e')]+'%'};return _0x55a08b;}})});}_0xf20f=_[_0x533a('0x40')]({},_0xf20f,_0x1d7fcd[_0x533a('0x41')]);var _0x11071f={'where':_0xf20f['where']};return db['ChatOfflineMessage'][_0x533a('0x1c')](_0x11071f)[_0x533a('0x24')](function(_0x461364){_0x3a1843['count']=_0x461364;if(_0x1d7fcd[_0x533a('0x3a')]['includeAll']){_0xf20f['include']=[{'all':!![]}];}return db[_0x533a('0x2b')]['findAll'](_0xf20f);})['then'](function(_0x4f94cb){_0x3a1843['rows']=_0x4f94cb;return _0x3a1843;})[_0x533a('0x24')](respondWithFilteredResult(_0x289d80,_0xf20f))[_0x533a('0x42')](handleError(_0x289d80,null));};exports[_0x533a('0x43')]=function(_0x1e2b4b,_0x4e260f){var _0x26e657={'raw':!![],'where':{'id':_0x1e2b4b[_0x533a('0x44')]['id']}},_0xab0604={};_0xab0604[_0x533a('0x30')]=_[_0x533a('0x31')](db[_0x533a('0x2b')][_0x533a('0x2c')]);_0xab0604[_0x533a('0x3a')]=_['keys'](_0x1e2b4b[_0x533a('0x3a')]);_0xab0604[_0x533a('0x32')]=_[_0x533a('0x33')](_0xab0604[_0x533a('0x30')],_0xab0604['query']);_0x26e657[_0x533a('0x34')]=_[_0x533a('0x33')](_0xab0604[_0x533a('0x30')],qs[_0x533a('0x35')](_0x1e2b4b[_0x533a('0x3a')][_0x533a('0x35')]));_0x26e657[_0x533a('0x34')]=_0x26e657[_0x533a('0x34')][_0x533a('0x36')]?_0x26e657[_0x533a('0x34')]:_0xab0604[_0x533a('0x30')];if(_0x1e2b4b['query']['includeAll']){_0x26e657[_0x533a('0x45')]=[{'all':!![]}];}_0x26e657=_[_0x533a('0x40')]({},_0x26e657,_0x1e2b4b[_0x533a('0x41')]);return db[_0x533a('0x2b')][_0x533a('0x46')](_0x26e657)['then'](handleEntityNotFound(_0x4e260f,null))['then'](respondWithResult(_0x4e260f,null))[_0x533a('0x42')](handleError(_0x4e260f,null));};exports['create']=function(_0x335aae,_0x114dd1){return db[_0x533a('0x2b')][_0x533a('0x47')](_0x335aae[_0x533a('0x48')],{})[_0x533a('0x24')](respondWithResult(_0x114dd1,0xc9))[_0x533a('0x42')](handleError(_0x114dd1,null));};exports[_0x533a('0x22')]=function(_0x558f8,_0x3defd3){if(_0x558f8[_0x533a('0x48')]['id']){delete _0x558f8[_0x533a('0x48')]['id'];}return db[_0x533a('0x2b')][_0x533a('0x46')]({'where':{'id':_0x558f8[_0x533a('0x44')]['id']}})['then'](handleEntityNotFound(_0x3defd3,null))[_0x533a('0x24')](saveUpdates(_0x558f8['body'],null))['then'](respondWithResult(_0x3defd3,null))[_0x533a('0x42')](handleError(_0x3defd3,null));};exports[_0x533a('0x23')]=function(_0x5be481,_0x55a80d){return db[_0x533a('0x2b')][_0x533a('0x46')]({'where':{'id':_0x5be481[_0x533a('0x44')]['id']}})[_0x533a('0x24')](handleEntityNotFound(_0x55a80d,null))[_0x533a('0x24')](removeEntity(_0x55a80d,null))[_0x533a('0x42')](handleError(_0x55a80d,null));};exports[_0x533a('0x49')]=function(_0x1957df,_0x16ee27){return db[_0x533a('0x2b')]['describe']()[_0x533a('0x24')](respondWithResult(_0x16ee27,null))[_0x533a('0x42')](handleError(_0x16ee27,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 18e490f..2492b60 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.model.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c12=['request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c12,0x188));var _0x25c1=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0x5c12[_0x104a84];return _0x4973ff;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))('api');var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rp=require(_0x25c1('0x4'));var fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require(_0x25c1('0x8'));module['exports']=function(_0x204287,_0x42ac16){return _0x204287[_0x25c1('0x9')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25c1('0xa'),'collate':_0x25c1('0xb')});}; \ No newline at end of file +var _0x303a=['bluebird','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','lodash','../../config/logger','api','moment'];(function(_0x36fbe0,_0x447b3c){var _0x2e0727=function(_0x54ccff){while(--_0x54ccff){_0x36fbe0['push'](_0x36fbe0['shift']());}};_0x2e0727(++_0x447b3c);}(_0x303a,0x1a0));var _0xa303=function(_0x19f183,_0x540981){_0x19f183=_0x19f183-0x0;var _0x317275=_0x303a[_0x19f183];return _0x317275;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var logger=require(_0xa303('0x1'))(_0xa303('0x2'));var moment=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa303('0x5'));var rimraf=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var attributes=require(_0xa303('0x8'));module[_0xa303('0x9')]=function(_0x1c7ee9,_0x2bc3d7){return _0x1c7ee9[_0xa303('0xa')](_0xa303('0xb'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index bd6dcd9..0edaaf6 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4db=['then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatOfflineMessage,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x45940a,_0x2016d7){var _0x3c9d7a=function(_0x120eca){while(--_0x120eca){_0x45940a['push'](_0x45940a['shift']());}};_0x3c9d7a(++_0x2016d7);}(_0xd4db,0x159));var _0xbd4d=function(_0x1254a3,_0x2a30b8){_0x1254a3=_0x1254a3-0x0;var _0x5ae21b=_0xd4db[_0x1254a3];return _0x5ae21b;};'use strict';var _=require(_0xbd4d('0x0'));var util=require(_0xbd4d('0x1'));var moment=require('moment');var BPromise=require(_0xbd4d('0x2'));var rs=require(_0xbd4d('0x3'));var fs=require('fs');var Redis=require(_0xbd4d('0x4'));var db=require(_0xbd4d('0x5'))['db'];var utils=require(_0xbd4d('0x6'));var logger=require('../../config/logger')(_0xbd4d('0x7'));var config=require(_0xbd4d('0x8'));var jayson=require(_0xbd4d('0x9'));var client=jayson['client'][_0xbd4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x510242,_0x223caf,_0x37b06b){return new BPromise(function(_0x2cc46e,_0xa4a494){return client[_0xbd4d('0xb')](_0x510242,_0x37b06b)[_0xbd4d('0xc')](function(_0x4d1409){logger[_0xbd4d('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x223caf,_0xbd4d('0xe'));logger[_0xbd4d('0xf')](_0xbd4d('0x10'),_0x223caf,_0xbd4d('0xe'),JSON[_0xbd4d('0x11')](_0x4d1409));if(_0x4d1409[_0xbd4d('0x12')]){if(_0x4d1409[_0xbd4d('0x12')]['code']===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x223caf,_0x4d1409[_0xbd4d('0x12')]['message']);return _0xa4a494(_0x4d1409[_0xbd4d('0x12')][_0xbd4d('0x13')]);}logger[_0xbd4d('0x12')](_0xbd4d('0x14'),_0x223caf,_0x4d1409[_0xbd4d('0x12')][_0xbd4d('0x13')]);return _0x2cc46e(_0x4d1409[_0xbd4d('0x12')][_0xbd4d('0x13')]);}else{logger[_0xbd4d('0xd')](_0xbd4d('0x14'),_0x223caf,'request\x20sent');_0x2cc46e(_0x4d1409['result'][_0xbd4d('0x13')]);}})['catch'](function(_0x3e996a){logger['error'](_0xbd4d('0x14'),_0x223caf,_0x3e996a);_0xa4a494(_0x3e996a);});});} \ No newline at end of file +var _0xf6a5=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x5e4611,_0x450168){var _0x76346e=function(_0x13369f){while(--_0x13369f){_0x5e4611['push'](_0x5e4611['shift']());}};_0x76346e(++_0x450168);}(_0xf6a5,0x116));var _0x5f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f6a('0x0'));var util=require(_0x5f6a('0x1'));var moment=require(_0x5f6a('0x2'));var BPromise=require(_0x5f6a('0x3'));var rs=require(_0x5f6a('0x4'));var fs=require('fs');var Redis=require(_0x5f6a('0x5'));var db=require(_0x5f6a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5f6a('0x7'));var jayson=require(_0x5f6a('0x8'));var client=jayson[_0x5f6a('0x9')][_0x5f6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc369b6,_0x1b22ee,_0xf1e514){return new BPromise(function(_0x55fff7,_0x2e64e6){return client[_0x5f6a('0xb')](_0xc369b6,_0xf1e514)[_0x5f6a('0xc')](function(_0x43c8ed){logger[_0x5f6a('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b22ee,'request\x20sent');logger[_0x5f6a('0xe')](_0x5f6a('0xf'),_0x1b22ee,_0x5f6a('0x10'),JSON[_0x5f6a('0x11')](_0x43c8ed));if(_0x43c8ed[_0x5f6a('0x12')]){if(_0x43c8ed[_0x5f6a('0x12')]['code']===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1b22ee,_0x43c8ed[_0x5f6a('0x12')][_0x5f6a('0x13')]);return _0x2e64e6(_0x43c8ed[_0x5f6a('0x12')][_0x5f6a('0x13')]);}logger[_0x5f6a('0x12')](_0x5f6a('0x14'),_0x1b22ee,_0x43c8ed[_0x5f6a('0x12')][_0x5f6a('0x13')]);return _0x55fff7(_0x43c8ed[_0x5f6a('0x12')][_0x5f6a('0x13')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x1b22ee,_0x5f6a('0x10'));_0x55fff7(_0x43c8ed[_0x5f6a('0x15')][_0x5f6a('0x13')]);}})[_0x5f6a('0x16')](function(_0x5ec8c7){logger[_0x5f6a('0x12')](_0x5f6a('0x14'),_0x1b22ee,_0x5ec8c7);_0x2e64e6(_0x5ec8c7);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index df14c42..72b075a 100644 --- a/server/api/chatOfflineMessage/index.js +++ b/server/api/chatOfflineMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0198=['Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','describe','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','path'];(function(_0x1da7cf,_0x581d81){var _0x2bfff3=function(_0x2eebae){while(--_0x2eebae){_0x1da7cf['push'](_0x1da7cf['shift']());}};_0x2bfff3(++_0x581d81);}(_0x0198,0x1c9));var _0x8019=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x0198[_0x529abc];return _0x453afa;};'use strict';var multer=require(_0x8019('0x0'));var util=require('util');var path=require(_0x8019('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8019('0x2')]();var auth=require(_0x8019('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8019('0x4'));var controller=require(_0x8019('0x5'));router[_0x8019('0x6')]('/',auth['isAuthenticated'](),controller[_0x8019('0x7')]);router[_0x8019('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x8019('0x8')]);router[_0x8019('0x6')](_0x8019('0x9'),auth[_0x8019('0xa')](),controller[_0x8019('0xb')]);router['post']('/',auth[_0x8019('0xa')](),controller[_0x8019('0xc')]);router[_0x8019('0xd')](_0x8019('0x9'),auth[_0x8019('0xa')](),controller[_0x8019('0xe')]);router['delete']('/:id',auth[_0x8019('0xa')](),controller[_0x8019('0xf')]);module[_0x8019('0x10')]=router; \ No newline at end of file +var _0xac7f=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete'];(function(_0x2d4a23,_0x3301b9){var _0x73659d=function(_0x228267){while(--_0x228267){_0x2d4a23['push'](_0x2d4a23['shift']());}};_0x73659d(++_0x3301b9);}(_0xac7f,0x190));var _0xfac7=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xac7f[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require('multer');var util=require(_0xfac7('0x0'));var path=require(_0xfac7('0x1'));var timeout=require(_0xfac7('0x2'));var express=require(_0xfac7('0x3'));var router=express[_0xfac7('0x4')]();var auth=require(_0xfac7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfac7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xfac7('0x7')]);router[_0xfac7('0x8')](_0xfac7('0x9'),auth[_0xfac7('0xa')](),controller[_0xfac7('0xb')]);router[_0xfac7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfac7('0xc')]);router[_0xfac7('0xd')]('/',auth[_0xfac7('0xa')](),controller[_0xfac7('0xe')]);router['put'](_0xfac7('0xf'),auth[_0xfac7('0xa')](),controller[_0xfac7('0x10')]);router[_0xfac7('0x11')]('/:id',auth[_0xfac7('0xa')](),controller['destroy']);module[_0xfac7('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 95a1e63..eb4d826 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.attributes.js +++ b/server/api/chatProactiveAction/chatProactiveAction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe817=['timeout','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x167ab1,_0x5f3faf){var _0x20606f=function(_0x20c916){while(--_0x20c916){_0x167ab1['push'](_0x167ab1['shift']());}};_0x20606f(++_0x5f3faf);}(_0xe817,0x1f3));var _0x7e81=function(_0x207ea9,_0x3c995a){_0x207ea9=_0x207ea9-0x0;var _0x34d6b4=_0xe817[_0x207ea9];return _0x34d6b4;};'use strict';var Sequelize=require(_0x7e81('0x0'));module[_0x7e81('0x1')]={'name':{'type':Sequelize[_0x7e81('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7e81('0x3')](_0x7e81('0x4'),_0x7e81('0x5')),'defaultValue':_0x7e81('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa315=['sequelize','exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x3c44ff,_0x5bf30a){var _0x3627b4=function(_0x582c00){while(--_0x582c00){_0x3c44ff['push'](_0x3c44ff['shift']());}};_0x3627b4(++_0x5bf30a);}(_0xa315,0xd2));var _0x5a31=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xa315[_0x39772f];return _0xc9edbf;};'use strict';var Sequelize=require(_0x5a31('0x0'));module[_0x5a31('0x1')]={'name':{'type':Sequelize[_0x5a31('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5a31('0x3')](_0x5a31('0x4'),_0x5a31('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5a31('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 9c68a0c..6e51d4d 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b4a=['body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','update','destroy','then','end','name','show','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','catch'];(function(_0x19261b,_0x26644a){var _0x19ca03=function(_0x22f336){while(--_0x22f336){_0x19261b['push'](_0x19261b['shift']());}};_0x19ca03(++_0x26644a);}(_0x5b4a,0x11b));var _0xa5b4=function(_0x34b5ca,_0x594010){_0x34b5ca=_0x34b5ca-0x0;var _0x2d72c0=_0x5b4a[_0x34b5ca];return _0x2d72c0;};'use strict';var pdf=require(_0xa5b4('0x0'));var emlformat=require(_0xa5b4('0x1'));var rimraf=require(_0xa5b4('0x2'));var zipdir=require(_0xa5b4('0x3'));var jsonpatch=require(_0xa5b4('0x4'));var rp=require(_0xa5b4('0x5'));var moment=require(_0xa5b4('0x6'));var BPromise=require(_0xa5b4('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa5b4('0x8'));var sox=require(_0xa5b4('0x9'));var csv=require(_0xa5b4('0xa'));var ejs=require(_0xa5b4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa5b4('0xc'));var jsforce=require(_0xa5b4('0xd'));var deskjs=require(_0xa5b4('0xe'));var toCsv=require(_0xa5b4('0xa'));var querystring=require(_0xa5b4('0xf'));var Papa=require(_0xa5b4('0x10'));var Redis=require(_0xa5b4('0x11'));var authService=require(_0xa5b4('0x12'));var qs=require(_0xa5b4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5b4('0x14'))(_0xa5b4('0x15'));var utils=require(_0xa5b4('0x16'));var config=require(_0xa5b4('0x17'));var licenseUtil=require(_0xa5b4('0x18'));var db=require(_0xa5b4('0x19'))['db'];function respondWithStatusCode(_0xa14492,_0x4687ea){_0x4687ea=_0x4687ea||0xcc;return function(_0xf255ab){if(_0xf255ab){return _0xa14492[_0xa5b4('0x1a')](_0x4687ea);}return _0xa14492[_0xa5b4('0x1b')](_0x4687ea)['end']();};}function respondWithResult(_0x1eff21,_0x5c126a){_0x5c126a=_0x5c126a||0xc8;return function(_0x30c1e9){if(_0x30c1e9){return _0x1eff21['status'](_0x5c126a)[_0xa5b4('0x1c')](_0x30c1e9);}};}function respondWithFilteredResult(_0x2fc5eb,_0x4b00db){return function(_0x2165f5){if(_0x2165f5){var _0x240d94=_0x2165f5['count'],_0x1b9c2d=_0x4b00db[_0xa5b4('0x1d')],_0x5b1bdb=_0x4b00db[_0xa5b4('0x1d')]+_0x4b00db[_0xa5b4('0x1e')],_0x243542;if(_0x5b1bdb>=_0x240d94){_0x5b1bdb=_0x240d94;_0x243542=0xc8;}else{_0x243542=0xce;}_0x2fc5eb[_0xa5b4('0x1b')](_0x243542);return _0x2fc5eb[_0xa5b4('0x1f')](_0xa5b4('0x20'),_0x1b9c2d+'-'+_0x5b1bdb+'/'+_0x240d94)[_0xa5b4('0x1c')](_0x2165f5);}return null;};}function patchUpdates(_0xc67ed1){return function(_0x45be89){try{jsonpatch[_0xa5b4('0x21')](_0x45be89,_0xc67ed1,!![]);}catch(_0x139511){return BPromise['reject'](_0x139511);}return _0x45be89['save']();};}function saveUpdates(_0x5b6d16,_0x45e89d){return function(_0x509b3f){if(_0x509b3f){return _0x509b3f[_0xa5b4('0x22')](_0x5b6d16)['then'](function(_0x559aea){return _0x559aea;});}return null;};}function removeEntity(_0x7d8e62,_0x290e19){return function(_0x76218f){if(_0x76218f){return _0x76218f[_0xa5b4('0x23')]()[_0xa5b4('0x24')](function(){_0x7d8e62['status'](0xcc)[_0xa5b4('0x25')]();});}};}function handleEntityNotFound(_0x328f24,_0x34ec9e){return function(_0x959414){if(!_0x959414){_0x328f24[_0xa5b4('0x1a')](0x194);}return _0x959414;};}function handleError(_0x1284ef,_0x46710a){_0x46710a=_0x46710a||0x1f4;return function(_0x3bf5a2){logger['error'](_0x3bf5a2['stack']);if(_0x3bf5a2[_0xa5b4('0x26')]){delete _0x3bf5a2[_0xa5b4('0x26')];}_0x1284ef[_0xa5b4('0x1b')](_0x46710a)['send'](_0x3bf5a2);};}exports[_0xa5b4('0x27')]=function(_0x2c8bbe,_0x17c877){var _0x495775={'raw':!![],'where':{'id':_0x2c8bbe['params']['id']}},_0x2bd0e8={};_0x2bd0e8[_0xa5b4('0x28')]=_[_0xa5b4('0x29')](db[_0xa5b4('0x2a')][_0xa5b4('0x2b')]);_0x2bd0e8[_0xa5b4('0x2c')]=_[_0xa5b4('0x29')](_0x2c8bbe[_0xa5b4('0x2c')]);_0x2bd0e8['filters']=_[_0xa5b4('0x2d')](_0x2bd0e8[_0xa5b4('0x28')],_0x2bd0e8[_0xa5b4('0x2c')]);_0x495775[_0xa5b4('0x2e')]=_[_0xa5b4('0x2d')](_0x2bd0e8[_0xa5b4('0x28')],qs[_0xa5b4('0x2f')](_0x2c8bbe['query'][_0xa5b4('0x2f')]));_0x495775['attributes']=_0x495775[_0xa5b4('0x2e')][_0xa5b4('0x30')]?_0x495775[_0xa5b4('0x2e')]:_0x2bd0e8[_0xa5b4('0x28')];if(_0x2c8bbe['query'][_0xa5b4('0x31')]){_0x495775[_0xa5b4('0x32')]=[{'all':!![]}];}_0x495775=_[_0xa5b4('0x33')]({},_0x495775,_0x2c8bbe['options']);return db['ChatProactiveAction']['find'](_0x495775)[_0xa5b4('0x24')](handleEntityNotFound(_0x17c877,null))[_0xa5b4('0x24')](respondWithResult(_0x17c877,null))['catch'](handleError(_0x17c877,null));};exports['create']=function(_0x13b094,_0x449c65){return db['ChatProactiveAction']['create'](_0x13b094['body'],{})[_0xa5b4('0x24')](respondWithResult(_0x449c65,0xc9))[_0xa5b4('0x34')](handleError(_0x449c65,null));};exports[_0xa5b4('0x22')]=function(_0x54eaae,_0x4ac275){if(_0x54eaae[_0xa5b4('0x35')]['id']){delete _0x54eaae[_0xa5b4('0x35')]['id'];}return db[_0xa5b4('0x2a')][_0xa5b4('0x36')]({'where':{'id':_0x54eaae[_0xa5b4('0x37')]['id']}})[_0xa5b4('0x24')](handleEntityNotFound(_0x4ac275,null))[_0xa5b4('0x24')](saveUpdates(_0x54eaae['body'],null))['then'](respondWithResult(_0x4ac275,null))['catch'](handleError(_0x4ac275,null));};exports[_0xa5b4('0x23')]=function(_0x22fcbf,_0x1e092d){return db['ChatProactiveAction'][_0xa5b4('0x36')]({'where':{'id':_0x22fcbf[_0xa5b4('0x37')]['id']}})[_0xa5b4('0x24')](handleEntityNotFound(_0x1e092d,null))[_0xa5b4('0x24')](removeEntity(_0x1e092d,null))['catch'](handleError(_0x1e092d,null));}; \ No newline at end of file +var _0x7eec=['options','ChatProactiveAction','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','rawAttributes','query','keys','filters','intersection','fields','attributes','include','merge'];(function(_0x58d3c7,_0x3fd69e){var _0x14b6ea=function(_0x3cbedc){while(--_0x3cbedc){_0x58d3c7['push'](_0x58d3c7['shift']());}};_0x14b6ea(++_0x3fd69e);}(_0x7eec,0x132));var _0xc7ee=function(_0x4d389b,_0x4e8b97){_0x4d389b=_0x4d389b-0x0;var _0x34a089=_0x7eec[_0x4d389b];return _0x34a089;};'use strict';var pdf=require(_0xc7ee('0x0'));var emlformat=require(_0xc7ee('0x1'));var rimraf=require(_0xc7ee('0x2'));var zipdir=require(_0xc7ee('0x3'));var jsonpatch=require(_0xc7ee('0x4'));var rp=require(_0xc7ee('0x5'));var moment=require(_0xc7ee('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc7ee('0x7'));var util=require('util');var path=require(_0xc7ee('0x8'));var sox=require(_0xc7ee('0x9'));var csv=require(_0xc7ee('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc7ee('0xb'));var squel=require('squel');var crypto=require(_0xc7ee('0xc'));var jsforce=require(_0xc7ee('0xd'));var deskjs=require(_0xc7ee('0xe'));var toCsv=require(_0xc7ee('0xa'));var querystring=require(_0xc7ee('0xf'));var Papa=require('papaparse');var Redis=require(_0xc7ee('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc7ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7ee('0x12'));var logger=require(_0xc7ee('0x13'))(_0xc7ee('0x14'));var utils=require(_0xc7ee('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc7ee('0x16'));var db=require(_0xc7ee('0x17'))['db'];function respondWithStatusCode(_0x407b16,_0x2b24a6){_0x2b24a6=_0x2b24a6||0xcc;return function(_0x2ba850){if(_0x2ba850){return _0x407b16[_0xc7ee('0x18')](_0x2b24a6);}return _0x407b16[_0xc7ee('0x19')](_0x2b24a6)[_0xc7ee('0x1a')]();};}function respondWithResult(_0x36935e,_0x2e2ff8){_0x2e2ff8=_0x2e2ff8||0xc8;return function(_0x3ca1ce){if(_0x3ca1ce){return _0x36935e[_0xc7ee('0x19')](_0x2e2ff8)[_0xc7ee('0x1b')](_0x3ca1ce);}};}function respondWithFilteredResult(_0x14a982,_0x171aa8){return function(_0x4e4c25){if(_0x4e4c25){var _0x25dd15=_0x4e4c25[_0xc7ee('0x1c')],_0x48fc80=_0x171aa8[_0xc7ee('0x1d')],_0x81958=_0x171aa8[_0xc7ee('0x1d')]+_0x171aa8['limit'],_0x4c8a72;if(_0x81958>=_0x25dd15){_0x81958=_0x25dd15;_0x4c8a72=0xc8;}else{_0x4c8a72=0xce;}_0x14a982[_0xc7ee('0x19')](_0x4c8a72);return _0x14a982[_0xc7ee('0x1e')](_0xc7ee('0x1f'),_0x48fc80+'-'+_0x81958+'/'+_0x25dd15)[_0xc7ee('0x1b')](_0x4e4c25);}return null;};}function patchUpdates(_0x29eded){return function(_0x58314d){try{jsonpatch[_0xc7ee('0x20')](_0x58314d,_0x29eded,!![]);}catch(_0x19c1de){return BPromise[_0xc7ee('0x21')](_0x19c1de);}return _0x58314d[_0xc7ee('0x22')]();};}function saveUpdates(_0x431d87,_0x55a6ad){return function(_0x2c9eff){if(_0x2c9eff){return _0x2c9eff[_0xc7ee('0x23')](_0x431d87)['then'](function(_0x3db280){return _0x3db280;});}return null;};}function removeEntity(_0x30b2af,_0x56b3da){return function(_0x261923){if(_0x261923){return _0x261923[_0xc7ee('0x24')]()[_0xc7ee('0x25')](function(){_0x30b2af[_0xc7ee('0x19')](0xcc)[_0xc7ee('0x1a')]();});}};}function handleEntityNotFound(_0x568adb,_0x161ef8){return function(_0x5774cb){if(!_0x5774cb){_0x568adb[_0xc7ee('0x18')](0x194);}return _0x5774cb;};}function handleError(_0xe0f6bf,_0x248cb5){_0x248cb5=_0x248cb5||0x1f4;return function(_0x18debd){logger[_0xc7ee('0x26')](_0x18debd[_0xc7ee('0x27')]);if(_0x18debd['name']){delete _0x18debd[_0xc7ee('0x28')];}_0xe0f6bf[_0xc7ee('0x19')](_0x248cb5)[_0xc7ee('0x29')](_0x18debd);};}exports[_0xc7ee('0x2a')]=function(_0x3508d3,_0x4052c8){var _0x21a954={'raw':!![],'where':{'id':_0x3508d3[_0xc7ee('0x2b')]['id']}},_0x501756={};_0x501756[_0xc7ee('0x2c')]=_['keys'](db['ChatProactiveAction'][_0xc7ee('0x2d')]);_0x501756[_0xc7ee('0x2e')]=_[_0xc7ee('0x2f')](_0x3508d3[_0xc7ee('0x2e')]);_0x501756[_0xc7ee('0x30')]=_[_0xc7ee('0x31')](_0x501756[_0xc7ee('0x2c')],_0x501756[_0xc7ee('0x2e')]);_0x21a954['attributes']=_[_0xc7ee('0x31')](_0x501756[_0xc7ee('0x2c')],qs[_0xc7ee('0x32')](_0x3508d3[_0xc7ee('0x2e')]['fields']));_0x21a954[_0xc7ee('0x33')]=_0x21a954['attributes']['length']?_0x21a954['attributes']:_0x501756['model'];if(_0x3508d3['query']['includeAll']){_0x21a954[_0xc7ee('0x34')]=[{'all':!![]}];}_0x21a954=_[_0xc7ee('0x35')]({},_0x21a954,_0x3508d3[_0xc7ee('0x36')]);return db[_0xc7ee('0x37')][_0xc7ee('0x38')](_0x21a954)[_0xc7ee('0x25')](handleEntityNotFound(_0x4052c8,null))[_0xc7ee('0x25')](respondWithResult(_0x4052c8,null))[_0xc7ee('0x39')](handleError(_0x4052c8,null));};exports[_0xc7ee('0x3a')]=function(_0x36d287,_0x24fef0){return db[_0xc7ee('0x37')][_0xc7ee('0x3a')](_0x36d287['body'],{})[_0xc7ee('0x25')](respondWithResult(_0x24fef0,0xc9))['catch'](handleError(_0x24fef0,null));};exports['update']=function(_0x3623a5,_0x55d087){if(_0x3623a5[_0xc7ee('0x3b')]['id']){delete _0x3623a5[_0xc7ee('0x3b')]['id'];}return db[_0xc7ee('0x37')][_0xc7ee('0x38')]({'where':{'id':_0x3623a5[_0xc7ee('0x2b')]['id']}})[_0xc7ee('0x25')](handleEntityNotFound(_0x55d087,null))[_0xc7ee('0x25')](saveUpdates(_0x3623a5[_0xc7ee('0x3b')],null))[_0xc7ee('0x25')](respondWithResult(_0x55d087,null))[_0xc7ee('0x39')](handleError(_0x55d087,null));};exports[_0xc7ee('0x24')]=function(_0x2b9882,_0x4d9313){return db[_0xc7ee('0x37')]['find']({'where':{'id':_0x2b9882[_0xc7ee('0x2b')]['id']}})[_0xc7ee('0x25')](handleEntityNotFound(_0x4d9313,null))[_0xc7ee('0x25')](removeEntity(_0x4d9313,null))[_0xc7ee('0x39')](handleError(_0x4d9313,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index cf18642..1d7aaff 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.model.js +++ b/server/api/chatProactiveAction/chatProactiveAction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85a9=['path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d8e2a,_0x2f8715){var _0x48db00=function(_0x3589cb){while(--_0x3589cb){_0x1d8e2a['push'](_0x1d8e2a['shift']());}};_0x48db00(++_0x2f8715);}(_0x85a9,0x149));var _0x985a=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0x85a9[_0x569caa];return _0x44cb5a;};'use strict';var _=require(_0x985a('0x0'));var util=require(_0x985a('0x1'));var logger=require(_0x985a('0x2'))(_0x985a('0x3'));var moment=require(_0x985a('0x4'));var BPromise=require(_0x985a('0x5'));var rp=require(_0x985a('0x6'));var fs=require('fs');var path=require(_0x985a('0x7'));var rimraf=require(_0x985a('0x8'));var config=require(_0x985a('0x9'));var attributes=require('./chatProactiveAction.attributes');module[_0x985a('0xa')]=function(_0x1a1ec3,_0x2028d8){return _0x1a1ec3[_0x985a('0xb')](_0x985a('0xc'),attributes,{'tableName':_0x985a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa67c=['request-promise','path','rimraf','../../config/environment','ChatProactiveAction','lodash','../../config/logger','api','bluebird'];(function(_0x4b6c08,_0x51473c){var _0x53b1bb=function(_0x47822){while(--_0x47822){_0x4b6c08['push'](_0x4b6c08['shift']());}};_0x53b1bb(++_0x51473c);}(_0xa67c,0x1eb));var _0xca67=function(_0x12f911,_0x4b7cc2){_0x12f911=_0x12f911-0x0;var _0xda369f=_0xa67c[_0x12f911];return _0xda369f;};'use strict';var _=require(_0xca67('0x0'));var util=require('util');var logger=require(_0xca67('0x1'))(_0xca67('0x2'));var moment=require('moment');var BPromise=require(_0xca67('0x3'));var rp=require(_0xca67('0x4'));var fs=require('fs');var path=require(_0xca67('0x5'));var rimraf=require(_0xca67('0x6'));var config=require(_0xca67('0x7'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x153c02,_0x3d9582){return _0x153c02['define'](_0xca67('0x8'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 05a6907..e8744b5 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.rpc.js +++ b/server/api/chatProactiveAction/chatProactiveAction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x198a=['../../config/logger','jayson/promise','client','request','then','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x198a,0x173));var _0xa198=function(_0x52625f,_0x56a272){_0x52625f=_0x52625f-0x0;var _0x4fff14=_0x198a[_0x52625f];return _0x4fff14;};'use strict';var _=require(_0xa198('0x0'));var util=require(_0xa198('0x1'));var moment=require(_0xa198('0x2'));var BPromise=require(_0xa198('0x3'));var rs=require(_0xa198('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa198('0x5'))['db'];var utils=require(_0xa198('0x6'));var logger=require(_0xa198('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa198('0x8'));var client=jayson[_0xa198('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12cb57,_0x5be064,_0xeab6d3){return new BPromise(function(_0x301e6f,_0x5c4027){return client[_0xa198('0xa')](_0x12cb57,_0xeab6d3)[_0xa198('0xb')](function(_0x3f717a){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5be064,_0xa198('0xc'));logger[_0xa198('0xd')](_0xa198('0xe'),_0x5be064,_0xa198('0xc'),JSON['stringify'](_0x3f717a));if(_0x3f717a['error']){if(_0x3f717a[_0xa198('0xf')][_0xa198('0x10')]===0x1f4){logger[_0xa198('0xf')](_0xa198('0x11'),_0x5be064,_0x3f717a[_0xa198('0xf')][_0xa198('0x12')]);return _0x5c4027(_0x3f717a['error'][_0xa198('0x12')]);}logger['error'](_0xa198('0x11'),_0x5be064,_0x3f717a['error'][_0xa198('0x12')]);return _0x301e6f(_0x3f717a['error'][_0xa198('0x12')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5be064,'request\x20sent');_0x301e6f(_0x3f717a[_0xa198('0x13')][_0xa198('0x12')]);}})[_0xa198('0x14')](function(_0x57234c){logger['error'](_0xa198('0x11'),_0x5be064,_0x57234c);_0x5c4027(_0x57234c);});});} \ No newline at end of file +var _0x57b3=['error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x57b3,0x13e));var _0x357b=function(_0x21f595,_0x4b32b6){_0x21f595=_0x21f595-0x0;var _0x5bafbb=_0x57b3[_0x21f595];return _0x5bafbb;};'use strict';var _=require(_0x357b('0x0'));var util=require('util');var moment=require(_0x357b('0x1'));var BPromise=require(_0x357b('0x2'));var rs=require(_0x357b('0x3'));var fs=require('fs');var Redis=require(_0x357b('0x4'));var db=require(_0x357b('0x5'))['db'];var utils=require(_0x357b('0x6'));var logger=require(_0x357b('0x7'))('rpc');var config=require(_0x357b('0x8'));var jayson=require(_0x357b('0x9'));var client=jayson[_0x357b('0xa')][_0x357b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42e213,_0x1be68a,_0x152e27){return new BPromise(function(_0x4e5df4,_0x24a58e){return client['request'](_0x42e213,_0x152e27)[_0x357b('0xc')](function(_0x308b57){logger[_0x357b('0xd')](_0x357b('0xe'),_0x1be68a,_0x357b('0xf'));logger['debug'](_0x357b('0x10'),_0x1be68a,_0x357b('0xf'),JSON[_0x357b('0x11')](_0x308b57));if(_0x308b57['error']){if(_0x308b57[_0x357b('0x12')]['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x1be68a,_0x308b57['error'][_0x357b('0x13')]);return _0x24a58e(_0x308b57['error'][_0x357b('0x13')]);}logger[_0x357b('0x12')](_0x357b('0xe'),_0x1be68a,_0x308b57[_0x357b('0x12')][_0x357b('0x13')]);return _0x4e5df4(_0x308b57[_0x357b('0x12')][_0x357b('0x13')]);}else{logger[_0x357b('0xd')](_0x357b('0xe'),_0x1be68a,_0x357b('0xf'));_0x4e5df4(_0x308b57['result']['message']);}})[_0x357b('0x14')](function(_0x3ec11f){logger[_0x357b('0x12')](_0x357b('0xe'),_0x1be68a,_0x3ec11f);_0x24a58e(_0x3ec11f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 43cd47b..13f3e6a 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x59fe=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','create','put','update','delete','util'];(function(_0x421d11,_0x3589b2){var _0x5a935f=function(_0x2b7415){while(--_0x2b7415){_0x421d11['push'](_0x421d11['shift']());}};_0x5a935f(++_0x3589b2);}(_0x59fe,0x178));var _0xe59f=function(_0x358e05,_0x167aed){_0x358e05=_0x358e05-0x0;var _0x549450=_0x59fe[_0x358e05];return _0x549450;};'use strict';var multer=require('multer');var util=require(_0xe59f('0x0'));var path=require(_0xe59f('0x1'));var timeout=require(_0xe59f('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe59f('0x3'));var interaction=require(_0xe59f('0x4'));var config=require(_0xe59f('0x5'));var controller=require('./chatProactiveAction.controller');router[_0xe59f('0x6')](_0xe59f('0x7'),auth[_0xe59f('0x8')](),controller['show']);router['post']('/',auth[_0xe59f('0x8')](),controller[_0xe59f('0x9')]);router[_0xe59f('0xa')](_0xe59f('0x7'),auth[_0xe59f('0x8')](),controller[_0xe59f('0xb')]);router[_0xe59f('0xc')](_0xe59f('0x7'),auth[_0xe59f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf725=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xf725,0x7e));var _0x5f72=function(_0x186cf7,_0x1de895){_0x186cf7=_0x186cf7-0x0;var _0x14202f=_0xf725[_0x186cf7];return _0x14202f;};'use strict';var multer=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var path=require(_0x5f72('0x2'));var timeout=require(_0x5f72('0x3'));var express=require(_0x5f72('0x4'));var router=express[_0x5f72('0x5')]();var auth=require(_0x5f72('0x6'));var interaction=require(_0x5f72('0x7'));var config=require(_0x5f72('0x8'));var controller=require(_0x5f72('0x9'));router['get'](_0x5f72('0xa'),auth[_0x5f72('0xb')](),controller[_0x5f72('0xc')]);router[_0x5f72('0xd')]('/',auth[_0x5f72('0xb')](),controller[_0x5f72('0xe')]);router[_0x5f72('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5f72('0x10')]);router[_0x5f72('0x11')]('/:id',auth[_0x5f72('0xb')](),controller[_0x5f72('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a8aea2d..bd1c078 100644 --- a/server/api/chatQueue/chatQueue.attributes.js +++ b/server/api/chatQueue/chatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x691f=['INTEGER','rrmemory','roundrobin','sequelize','exports'];(function(_0x336c81,_0x375c5a){var _0x5f087f=function(_0x4f396a){while(--_0x4f396a){_0x336c81['push'](_0x336c81['shift']());}};_0x5f087f(++_0x375c5a);}(_0x691f,0x111));var _0xf691=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x691f[_0x13843f];return _0x1063ae;};'use strict';var Sequelize=require(_0xf691('0x0'));module[_0xf691('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf691('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf691('0x3'),'beepall',_0xf691('0x4'))}}; \ No newline at end of file +var _0x8c2b=['INTEGER','ENUM','beepall','sequelize','exports','STRING','name'];(function(_0x16247f,_0x1909df){var _0x93822a=function(_0x3cf991){while(--_0x3cf991){_0x16247f['push'](_0x16247f['shift']());}};_0x93822a(++_0x1909df);}(_0x8c2b,0x8f));var _0xb8c2=function(_0xd1021,_0x59249a){_0xd1021=_0xd1021-0x0;var _0x3de50d=_0x8c2b[_0xd1021];return _0x3de50d;};'use strict';var Sequelize=require(_0xb8c2('0x0'));module[_0xb8c2('0x1')]={'name':{'type':Sequelize[_0xb8c2('0x2')],'unique':_0xb8c2('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb8c2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb8c2('0x5')]('rrmemory',_0xb8c2('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index cc5f27b..60ca795 100644 --- a/server/api/chatQueue/chatQueue.controller.js +++ b/server/api/chatQueue/chatQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49f0=['index','map','ChatQueue','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','show','params','intersection','length','includeAll','find','create','body','get','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','pick','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','Team','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','spread','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','send'];(function(_0x167d28,_0x582a10){var _0x5a6737=function(_0x1bbb46){while(--_0x1bbb46){_0x167d28['push'](_0x167d28['shift']());}};_0x5a6737(++_0x582a10);}(_0x49f0,0xf7));var _0x049f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x49f0[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0x049f('0x0'));var emlformat=require(_0x049f('0x1'));var rimraf=require(_0x049f('0x2'));var zipdir=require(_0x049f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x049f('0x4'));var moment=require(_0x049f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x049f('0x6'));var path=require(_0x049f('0x7'));var sox=require(_0x049f('0x8'));var csv=require(_0x049f('0x9'));var ejs=require(_0x049f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x049f('0xb'));var crypto=require('crypto');var jsforce=require(_0x049f('0xc'));var deskjs=require(_0x049f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x049f('0xe'));var Redis=require(_0x049f('0xf'));var authService=require(_0x049f('0x10'));var qs=require(_0x049f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x049f('0x12'));var logger=require(_0x049f('0x13'))(_0x049f('0x14'));var utils=require(_0x049f('0x15'));var config=require(_0x049f('0x16'));var licenseUtil=require(_0x049f('0x17'));var db=require(_0x049f('0x18'))['db'];config[_0x049f('0x19')]=_[_0x049f('0x1a')](config[_0x049f('0x19')],{'host':_0x049f('0x1b'),'port':0x18eb});var socket=require(_0x049f('0x1c'))(new Redis(config[_0x049f('0x19')]));require(_0x049f('0x1d'))[_0x049f('0x1e')](socket);var jayson=require(_0x049f('0x1f'));var client=jayson[_0x049f('0x20')][_0x049f('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x75b89d,_0x3318ee,_0xa3a5b5,_0x5a0fe3){return new BPromise(function(_0x4d78e7,_0x41bce4){var _0x29e72d=_0x5a0fe3||client;return _0x29e72d[_0x049f('0x22')](_0x75b89d,_0xa3a5b5)[_0x049f('0x23')](function(_0x5404da){logger[_0x049f('0x24')](_0x049f('0x25'),_0x3318ee,'request\x20sent');logger[_0x049f('0x26')](_0x049f('0x27'),_0x3318ee,'request\x20sent',JSON[_0x049f('0x28')](_0x5404da));if(_0x5404da['error']){if(_0x5404da[_0x049f('0x29')][_0x049f('0x2a')]===0x1f4){logger[_0x049f('0x29')]('ChatQueue,\x20%s,\x20%s',_0x3318ee,_0x5404da['error'][_0x049f('0x2b')]);return _0x41bce4(_0x5404da[_0x049f('0x29')][_0x049f('0x2b')]);}logger['error'](_0x049f('0x25'),_0x3318ee,_0x5404da[_0x049f('0x29')][_0x049f('0x2b')]);return _0x4d78e7(_0x5404da['error']['message']);}else{logger[_0x049f('0x24')](_0x049f('0x25'),_0x3318ee,_0x049f('0x2c'));_0x4d78e7(_0x5404da[_0x049f('0x2d')]['message']);}})[_0x049f('0x2e')](function(_0x47430d){logger[_0x049f('0x29')](_0x049f('0x25'),_0x3318ee,_0x47430d);_0x41bce4(_0x47430d);});});}function respondWithStatusCode(_0x4ea26c,_0x445bbc){_0x445bbc=_0x445bbc||0xcc;return function(_0x2c9ab1){if(_0x2c9ab1){return _0x4ea26c[_0x049f('0x2f')](_0x445bbc);}return _0x4ea26c[_0x049f('0x30')](_0x445bbc)[_0x049f('0x31')]();};}function respondWithResult(_0x717ce8,_0x242163){_0x242163=_0x242163||0xc8;return function(_0x21ac7c){if(_0x21ac7c){return _0x717ce8['status'](_0x242163)[_0x049f('0x32')](_0x21ac7c);}};}function respondWithFilteredResult(_0x1ca4ed,_0x2478c6){return function(_0x2a65ef){if(_0x2a65ef){var _0x19c4e6=_0x2a65ef[_0x049f('0x33')],_0x557a7c=_0x2478c6['offset'],_0x33c6e5=_0x2478c6[_0x049f('0x34')]+_0x2478c6['limit'],_0xaa0f29;if(_0x33c6e5>=_0x19c4e6){_0x33c6e5=_0x19c4e6;_0xaa0f29=0xc8;}else{_0xaa0f29=0xce;}_0x1ca4ed[_0x049f('0x30')](_0xaa0f29);return _0x1ca4ed[_0x049f('0x35')](_0x049f('0x36'),_0x557a7c+'-'+_0x33c6e5+'/'+_0x19c4e6)[_0x049f('0x32')](_0x2a65ef);}return null;};}function patchUpdates(_0x3515cb){return function(_0x488ee7){try{jsonpatch[_0x049f('0x37')](_0x488ee7,_0x3515cb,!![]);}catch(_0x5f52e7){return BPromise[_0x049f('0x38')](_0x5f52e7);}return _0x488ee7[_0x049f('0x39')]();};}function saveUpdates(_0x233c1b,_0xcaad71){return function(_0x11dcf2){if(_0x11dcf2){return _0x11dcf2[_0x049f('0x3a')](_0x233c1b)['then'](function(_0x27002c){return _0x27002c;});}return null;};}function removeEntity(_0x514752,_0x567250){return function(_0x4eab05){if(_0x4eab05){return _0x4eab05[_0x049f('0x3b')]()[_0x049f('0x23')](function(){var _0x2c8ae9=_0x4eab05['get']({'plain':!![]});var _0x1291e=_0x049f('0x3c');return db[_0x049f('0x3d')][_0x049f('0x3b')]({'where':{'type':_0x1291e,'resourceId':_0x2c8ae9['id']}})[_0x049f('0x23')](function(){return _0x4eab05;});})[_0x049f('0x23')](function(){_0x514752['status'](0xcc)[_0x049f('0x31')]();});}};}function handleEntityNotFound(_0x297667,_0x5e6725){return function(_0x2dc17c){if(!_0x2dc17c){_0x297667['sendStatus'](0x194);}return _0x2dc17c;};}function handleError(_0x5225fb,_0x317cce){_0x317cce=_0x317cce||0x1f4;return function(_0x1ccec8){logger[_0x049f('0x29')](_0x1ccec8[_0x049f('0x3e')]);if(_0x1ccec8[_0x049f('0x3f')]){delete _0x1ccec8['name'];}_0x5225fb[_0x049f('0x30')](_0x317cce)[_0x049f('0x40')](_0x1ccec8);};}exports[_0x049f('0x41')]=function(_0x5abae8,_0x1db514){var _0x19cbac={},_0x2060d5={},_0x2a9abd={'count':0x0,'rows':[]};var _0x1367b6=_[_0x049f('0x42')](db[_0x049f('0x43')][_0x049f('0x44')],function(_0x513c96){return{'name':_0x513c96[_0x049f('0x45')],'type':_0x513c96[_0x049f('0x46')]['key']};});_0x2060d5[_0x049f('0x47')]=_[_0x049f('0x42')](_0x1367b6,_0x049f('0x3f'));_0x2060d5[_0x049f('0x48')]=_[_0x049f('0x49')](_0x5abae8[_0x049f('0x48')]);_0x2060d5[_0x049f('0x4a')]=_['intersection'](_0x2060d5['model'],_0x2060d5[_0x049f('0x48')]);_0x19cbac[_0x049f('0x4b')]=_['intersection'](_0x2060d5[_0x049f('0x47')],qs[_0x049f('0x4c')](_0x5abae8['query'][_0x049f('0x4c')]));_0x19cbac['attributes']=_0x19cbac['attributes']['length']?_0x19cbac['attributes']:_0x2060d5[_0x049f('0x47')];if(!_0x5abae8['query'][_0x049f('0x4d')](_0x049f('0x4e'))){_0x19cbac[_0x049f('0x4f')]=qs['limit'](_0x5abae8[_0x049f('0x48')][_0x049f('0x4f')]);_0x19cbac[_0x049f('0x34')]=qs[_0x049f('0x34')](_0x5abae8[_0x049f('0x48')]['offset']);}_0x19cbac[_0x049f('0x50')]=qs['sort'](_0x5abae8[_0x049f('0x48')][_0x049f('0x51')]);_0x19cbac[_0x049f('0x52')]=qs[_0x049f('0x4a')](_['pick'](_0x5abae8[_0x049f('0x48')],_0x2060d5['filters']),_0x1367b6);if(_0x5abae8[_0x049f('0x48')][_0x049f('0x53')]){_0x19cbac[_0x049f('0x52')]=_[_0x049f('0x54')](_0x19cbac[_0x049f('0x52')],{'$or':_[_0x049f('0x42')](_0x1367b6,function(_0x2a04e1){if(_0x2a04e1['type']!==_0x049f('0x55')){var _0x489513={};_0x489513[_0x2a04e1[_0x049f('0x3f')]]={'$like':'%'+_0x5abae8['query'][_0x049f('0x53')]+'%'};return _0x489513;}})});}_0x19cbac=_['merge']({},_0x19cbac,_0x5abae8[_0x049f('0x56')]);var _0x10f261={'where':_0x19cbac['where']};return db[_0x049f('0x43')]['count'](_0x10f261)['then'](function(_0x404d86){_0x2a9abd[_0x049f('0x33')]=_0x404d86;if(_0x5abae8[_0x049f('0x48')]['includeAll']){_0x19cbac[_0x049f('0x57')]=[{'all':!![]}];}return db[_0x049f('0x43')]['findAll'](_0x19cbac);})['then'](function(_0x18c83c){_0x2a9abd['rows']=_0x18c83c;return _0x2a9abd;})[_0x049f('0x23')](respondWithFilteredResult(_0x1db514,_0x19cbac))['catch'](handleError(_0x1db514,null));};exports[_0x049f('0x58')]=function(_0x4f6f9b,_0x2d005f){var _0x47a37d={'raw':!![],'where':{'id':_0x4f6f9b[_0x049f('0x59')]['id']}},_0x1de6f5={};_0x1de6f5[_0x049f('0x47')]=_[_0x049f('0x49')](db['ChatQueue'][_0x049f('0x44')]);_0x1de6f5[_0x049f('0x48')]=_[_0x049f('0x49')](_0x4f6f9b[_0x049f('0x48')]);_0x1de6f5[_0x049f('0x4a')]=_['intersection'](_0x1de6f5[_0x049f('0x47')],_0x1de6f5['query']);_0x47a37d[_0x049f('0x4b')]=_[_0x049f('0x5a')](_0x1de6f5[_0x049f('0x47')],qs[_0x049f('0x4c')](_0x4f6f9b[_0x049f('0x48')][_0x049f('0x4c')]));_0x47a37d[_0x049f('0x4b')]=_0x47a37d[_0x049f('0x4b')][_0x049f('0x5b')]?_0x47a37d['attributes']:_0x1de6f5[_0x049f('0x47')];if(_0x4f6f9b[_0x049f('0x48')][_0x049f('0x5c')]){_0x47a37d['include']=[{'all':!![]}];}_0x47a37d=_[_0x049f('0x54')]({},_0x47a37d,_0x4f6f9b[_0x049f('0x56')]);return db[_0x049f('0x43')][_0x049f('0x5d')](_0x47a37d)[_0x049f('0x23')](handleEntityNotFound(_0x2d005f,null))[_0x049f('0x23')](respondWithResult(_0x2d005f,null))['catch'](handleError(_0x2d005f,null));};exports[_0x049f('0x5e')]=function(_0xe42361,_0x2a7e9d){return db['ChatQueue']['create'](_0xe42361[_0x049f('0x5f')],{})[_0x049f('0x23')](function(_0x39ab21){var _0x525748=_0xe42361['user'][_0x049f('0x60')]({'plain':!![]});if(!_0x525748)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x525748[_0x049f('0x61')]===_0x049f('0x62')){var _0x55d3cb=_0x39ab21[_0x049f('0x60')]({'plain':!![]});var _0x2095e0=_0x049f('0x3c');return db['UserProfileSection'][_0x049f('0x5d')]({'where':{'name':_0x2095e0,'userProfileId':_0x525748['userProfileId']},'raw':!![]})['then'](function(_0x56c365){if(_0x56c365&&_0x56c365['autoAssociation']===0x0){return db[_0x049f('0x3d')]['create']({'name':_0x55d3cb[_0x049f('0x3f')],'resourceId':_0x55d3cb['id'],'type':_0x56c365['name'],'sectionId':_0x56c365['id']},{})[_0x049f('0x23')](function(){return _0x39ab21;});}else{return _0x39ab21;}})[_0x049f('0x2e')](function(_0x488a8c){logger[_0x049f('0x29')](_0x049f('0x63'),_0x488a8c);throw _0x488a8c;});}return _0x39ab21;})[_0x049f('0x23')](respondWithResult(_0x2a7e9d,0xc9))['catch'](handleError(_0x2a7e9d,null));};exports[_0x049f('0x3a')]=function(_0x508ae3,_0x4204fd){if(_0x508ae3['body']['id']){delete _0x508ae3['body']['id'];}return db[_0x049f('0x43')][_0x049f('0x5d')]({'where':{'id':_0x508ae3[_0x049f('0x59')]['id']}})[_0x049f('0x23')](handleEntityNotFound(_0x4204fd,null))[_0x049f('0x23')](saveUpdates(_0x508ae3[_0x049f('0x5f')],null))[_0x049f('0x23')](respondWithResult(_0x4204fd,null))[_0x049f('0x2e')](handleError(_0x4204fd,null));};exports[_0x049f('0x3b')]=function(_0x342232,_0x354367){return db[_0x049f('0x43')][_0x049f('0x5d')]({'where':{'id':_0x342232['params']['id']}})[_0x049f('0x23')](handleEntityNotFound(_0x354367,null))[_0x049f('0x23')](removeEntity(_0x354367,null))[_0x049f('0x2e')](handleError(_0x354367,null));};exports[_0x049f('0x64')]=function(_0x1187b9,_0x22a708){return db[_0x049f('0x43')][_0x049f('0x64')]()[_0x049f('0x23')](respondWithResult(_0x22a708,null))['catch'](handleError(_0x22a708,null));};exports[_0x049f('0x65')]=function(_0x35c84d,_0x273e83,_0x322cec){var _0x32c690={'raw':!![],'where':{}},_0x5bf4f6={},_0x4e1a1f;return db[_0x049f('0x43')]['findOne']({'where':{'id':_0x35c84d['params']['id']}})[_0x049f('0x23')](handleEntityNotFound(_0x273e83,null))[_0x049f('0x23')](function(_0x416092){if(_0x416092){_0x4e1a1f=_0x416092[_0x049f('0x60')]({'plain':!![]});_0x5bf4f6[_0x049f('0x47')]=_[_0x049f('0x49')](db[_0x049f('0x66')][_0x049f('0x44')]);_0x5bf4f6[_0x049f('0x48')]=_[_0x049f('0x49')](_0x35c84d['query']);_0x5bf4f6[_0x049f('0x4a')]=_[_0x049f('0x5a')](_0x5bf4f6[_0x049f('0x47')],_0x5bf4f6[_0x049f('0x48')]);_0x32c690[_0x049f('0x4b')]=_[_0x049f('0x5a')](_0x5bf4f6[_0x049f('0x47')],qs[_0x049f('0x4c')](_0x35c84d[_0x049f('0x48')][_0x049f('0x4c')]));_0x32c690[_0x049f('0x4b')]=_0x32c690[_0x049f('0x4b')]['length']?_0x32c690[_0x049f('0x4b')]:_0x5bf4f6[_0x049f('0x47')];if(!_0x35c84d['query']['hasOwnProperty'](_0x049f('0x4e'))){_0x32c690[_0x049f('0x4f')]=qs[_0x049f('0x4f')](_0x35c84d['query'][_0x049f('0x4f')]);_0x32c690[_0x049f('0x34')]=qs['offset'](_0x35c84d[_0x049f('0x48')]['offset']);}_0x32c690[_0x049f('0x50')]=qs['sort'](_0x35c84d[_0x049f('0x48')]['sort']);_0x32c690[_0x049f('0x52')]=qs['filters'](_[_0x049f('0x67')](_0x35c84d[_0x049f('0x48')],_0x5bf4f6[_0x049f('0x4a')]));_0x32c690[_0x049f('0x52')][_0x049f('0x68')]=_0x416092['id'];if(_0x35c84d[_0x049f('0x48')][_0x049f('0x53')]){_0x32c690[_0x049f('0x52')]=_[_0x049f('0x54')](_0x32c690['where'],{'$or':_[_0x049f('0x42')](_0x32c690[_0x049f('0x4b')],function(_0x20d96c){var _0x35b15b={};_0x35b15b[_0x20d96c]={'$like':'%'+_0x35c84d[_0x049f('0x48')][_0x049f('0x53')]+'%'};return _0x35b15b;})});}_0x32c690=_['merge']({},_0x32c690,_0x35c84d[_0x049f('0x56')]);return db[_0x049f('0x66')][_0x049f('0x69')](_0x32c690);}})[_0x049f('0x23')](function(_0x1633fd){if(_0x1633fd){return db[_0x049f('0x6a')][_0x049f('0x6b')]({'where':{'id':_[_0x049f('0x42')](_0x1633fd,_0x049f('0x6c')),'role':_0x049f('0x6d')},'attributes':['id',_0x049f('0x3f'),_0x049f('0x6e'),_0x049f('0x6f'),_0x049f('0x70')]});}})[_0x049f('0x23')](function(_0x11bd31){if(_0x11bd31){return{'count':_0x11bd31[_0x049f('0x33')],'rows':_[_0x049f('0x42')](_0x11bd31[_0x049f('0x71')],function(_0x1babf3){return{'membername':_0x1babf3['name'],'UserId':_0x1babf3['id'],'queue_name':_0x4e1a1f[_0x049f('0x3f')],'ChatQueueId':_0x4e1a1f['id'],'interface':util[_0x049f('0x72')](_0x049f('0x73'),_0x049f('0x74'),_0x1babf3[_0x049f('0x3f')]),'penalty':0x0,'paused':_0x1babf3['chatPause'],'createdAt':_0x1babf3['createdAt'],'updatedAt':_0x1babf3[_0x049f('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x273e83,_0x32c690))[_0x049f('0x2e')](handleError(_0x273e83,null));};exports[_0x049f('0x75')]=function(_0x3d4b60,_0x111186,_0x25db8e){var _0x551825={};var _0x11fdad={};var _0x18d801;var _0x37926e;return db[_0x049f('0x43')]['findOne']({'where':{'id':_0x3d4b60[_0x049f('0x59')]['id']}})[_0x049f('0x23')](handleEntityNotFound(_0x111186,null))[_0x049f('0x23')](function(_0x5c2d7f){if(_0x5c2d7f){_0x18d801=_0x5c2d7f;_0x11fdad['model']=_[_0x049f('0x49')](db['Team']['rawAttributes']);_0x11fdad[_0x049f('0x48')]=_['keys'](_0x3d4b60[_0x049f('0x48')]);_0x11fdad['filters']=_[_0x049f('0x5a')](_0x11fdad[_0x049f('0x47')],_0x11fdad['query']);_0x551825[_0x049f('0x4b')]=_[_0x049f('0x5a')](_0x11fdad[_0x049f('0x47')],qs['fields'](_0x3d4b60[_0x049f('0x48')][_0x049f('0x4c')]));_0x551825['attributes']=_0x551825['attributes'][_0x049f('0x5b')]?_0x551825['attributes']:_0x11fdad[_0x049f('0x47')];_0x551825[_0x049f('0x50')]=qs[_0x049f('0x51')](_0x3d4b60[_0x049f('0x48')][_0x049f('0x51')]);_0x551825['where']=qs[_0x049f('0x4a')](_['pick'](_0x3d4b60['query'],_0x11fdad[_0x049f('0x4a')]));if(_0x3d4b60[_0x049f('0x48')][_0x049f('0x53')]){_0x551825[_0x049f('0x52')]=_['merge'](_0x551825[_0x049f('0x52')],{'$or':_[_0x049f('0x42')](_0x551825[_0x049f('0x4b')],function(_0x13e98b){var _0x590c3e={};_0x590c3e[_0x13e98b]={'$like':'%'+_0x3d4b60[_0x049f('0x48')][_0x049f('0x53')]+'%'};return _0x590c3e;})});}_0x551825=_[_0x049f('0x54')]({},_0x551825,_0x3d4b60[_0x049f('0x56')]);return _0x18d801['getTeams'](_0x551825);}})[_0x049f('0x23')](function(_0x6fa9e){if(_0x6fa9e){_0x37926e=_0x6fa9e[_0x049f('0x5b')];if(!_0x3d4b60[_0x049f('0x48')]['hasOwnProperty'](_0x049f('0x4e'))){_0x551825[_0x049f('0x4f')]=qs[_0x049f('0x4f')](_0x3d4b60[_0x049f('0x48')][_0x049f('0x4f')]);_0x551825['offset']=qs['offset'](_0x3d4b60[_0x049f('0x48')][_0x049f('0x34')]);}return _0x18d801[_0x049f('0x75')](_0x551825);}})[_0x049f('0x23')](function(_0x2e0baa){if(_0x2e0baa){return _0x2e0baa?{'count':_0x37926e,'rows':_0x2e0baa}:null;}})[_0x049f('0x23')](respondWithResult(_0x111186,null))[_0x049f('0x2e')](handleError(_0x111186,null));};exports[_0x049f('0x76')]=function(_0x343050,_0x2664a5,_0x2051e0){var _0xbacfa9=_0x343050[_0x049f('0x5f')][_0x049f('0x77')];return db['Team'][_0x049f('0x69')]({'where':{'id':_0xbacfa9},'attributes':['id'],'include':[{'model':db['User'],'as':_0x049f('0x78'),'attributes':['id',_0x049f('0x3f'),'online',_0x049f('0x79'),_0x049f('0x7a')],'raw':!![]}]})['then'](function(_0x298262){if(_0x298262){var _0x427f80=_[_0x049f('0x7b')](_0x298262,function(_0x1990ae){var _0x5aed49=_0x1990ae[_0x049f('0x60')]({'plain':!![]});return _0x5aed49['Agents'];});return db['ChatQueue'][_0x049f('0x5d')]({'where':{'id':_0x343050['params']['id']}})[_0x049f('0x23')](function(_0x4f07bc){return db[_0x049f('0x7c')][_0x049f('0x7d')](function(_0x3baf60){return _0x4f07bc[_0x049f('0x76')](_0xbacfa9,{'transaction':_0x3baf60})[_0x049f('0x23')](function(){return BPromise[_0x049f('0x7e')](_0x427f80,function(_0x1f5689){return db[_0x049f('0x66')][_0x049f('0x7f')]({'where':{'UserId':_0x1f5689['id'],'ChatQueueId':_0x343050[_0x049f('0x59')]['id']},'transaction':_0x3baf60});});})[_0x049f('0x23')](function(){_0x427f80[_0x049f('0x80')](function(_0x321e0c){socket['emit'](_0x049f('0x81'),{'UserId':_0x321e0c['id'],'ChatQueueId':_0x4f07bc['id']});});});});});}})[_0x049f('0x23')](respondWithStatusCode(_0x2664a5,null))[_0x049f('0x2e')](handleError(_0x2664a5,null));};exports[_0x049f('0x82')]=function(_0xc15cdb,_0x56eb36,_0x4a6d08){return db[_0x049f('0x83')][_0x049f('0x69')]({'where':{'id':_0xc15cdb[_0x049f('0x48')][_0x049f('0x77')]},'attributes':['id'],'include':[{'model':db[_0x049f('0x6a')],'as':_0x049f('0x78'),'attributes':['id'],'raw':!![]}]})[_0x049f('0x23')](handleEntityNotFound(_0x56eb36,null))[_0x049f('0x23')](function(_0x2faa6c){var _0x2beb42=_[_0x049f('0x42')](_0x2faa6c,'id');var _0x5461cf=[];var _0x33f3d9=[];var _0x48ae02=squel['select']();_0x48ae02[_0x049f('0x84')]('tq.TeamId')[_0x049f('0x85')](_0x049f('0x86'),'tq')[_0x049f('0x87')](_0x049f('0x88'),'ut',_0x049f('0x89'))[_0x049f('0x52')]('ChatQueueId\x20=\x20?',_0xc15cdb['params']['id']);for(var _0x571ee2=0x0;_0x571ee2<_0x2faa6c[_0x049f('0x5b')];_0x571ee2+=0x1){let _0x26049d=_0x2faa6c[_0x571ee2];for(var _0x156279=0x0;_0x156279<_0x26049d['Agents'][_0x049f('0x5b')];_0x156279+=0x1){let _0x33268f=_0x26049d[_0x049f('0x78')][_0x156279];var _0x406a50=_0x48ae02[_0x049f('0x8a')]();_0x406a50[_0x049f('0x52')](_0x049f('0x8b'),_0x33268f['id']);_0x33f3d9[_0x049f('0x8c')](db['sequelize'][_0x049f('0x48')](_0x406a50['toString'](),{'type':db[_0x049f('0x7c')]['QueryTypes'][_0x049f('0x8d')]})[_0x049f('0x23')](function(_0x4f7711){if(_0x4f7711['length']===0x1){return _0x33268f['id'];}else{var _0x2eb316=_[_0x049f('0x8e')](_[_0x049f('0x42')](_0x4f7711,_0x049f('0x8f')),function(_0x50bba7){return _[_0x049f('0x90')](_0x2beb42,_0x50bba7);});if(_0x2eb316){return _0x33268f['id'];}}}));}}return BPromise[_0x049f('0x91')](_0x33f3d9)[_0x049f('0x23')](function(_0x19a83f){_0x5461cf=_(_0x5461cf)[_0x049f('0x92')](_0x19a83f)[_0x049f('0x93')]()[_0x049f('0x94')]();return db['ChatQueue'][_0x049f('0x5d')]({'where':{'id':_0xc15cdb[_0x049f('0x59')]['id']}})[_0x049f('0x23')](function(_0x35ce5d){return db[_0x049f('0x7c')]['transaction'](function(_0x5ac005){return _0x35ce5d[_0x049f('0x82')](_0xc15cdb[_0x049f('0x48')][_0x049f('0x77')],{'transaction':_0x5ac005})[_0x049f('0x23')](function(){if(!_[_0x049f('0x95')](_0x5461cf)){return _0x35ce5d[_0x049f('0x96')](_0x5461cf,{'transaction':_0x5ac005});}})[_0x049f('0x23')](function(){_0x5461cf[_0x049f('0x80')](function(_0x5aea19){socket[_0x049f('0x97')]('userChatQueue:remove',{'UserId':_0x5aea19,'ChatQueueId':_0x35ce5d['id']});});});});});});})['then'](respondWithStatusCode(_0x56eb36,null))['catch'](handleError(_0x56eb36,null));};exports[_0x049f('0x98')]=function(_0x354948,_0x3377de,_0x28a1df){return db['ChatQueue'][_0x049f('0x5d')]({'where':{'id':_0x354948['params']['id']}})[_0x049f('0x23')](handleEntityNotFound(_0x3377de,null))[_0x049f('0x23')](function(_0x219c51){if(_0x219c51){return _0x219c51['addAgents'](_0x354948['body']['ids'],_['omit'](_0x354948[_0x049f('0x5f')],[_0x049f('0x77'),'id'])||{})[_0x049f('0x99')](function(_0x5811d3){for(var _0x5126f1=0x0;_0x5126f1<_0x354948[_0x049f('0x5f')][_0x049f('0x77')][_0x049f('0x5b')];_0x5126f1+=0x1){socket[_0x049f('0x97')](_0x049f('0x81'),{'UserId':_0x354948[_0x049f('0x5f')][_0x049f('0x77')][_0x5126f1],'ChatQueueId':_0x354948[_0x049f('0x59')]['id']});}return _0x5811d3;});}})[_0x049f('0x23')](respondWithResult(_0x3377de,null))[_0x049f('0x2e')](handleError(_0x3377de,null));};exports[_0x049f('0x96')]=function(_0x32e0b5,_0x56c3c1,_0x19f840){return db[_0x049f('0x43')]['find']({'where':{'id':_0x32e0b5[_0x049f('0x59')]['id']}})['then'](handleEntityNotFound(_0x56c3c1,null))[_0x049f('0x23')](function(_0x53e790){if(_0x53e790){return _0x53e790['removeAgents'](_0x32e0b5[_0x049f('0x48')][_0x049f('0x77')])[_0x049f('0x23')](function(){if(_['isArray'](_0x32e0b5['query']['ids'])){for(var _0xa4ac11=0x0;_0xa4ac11<_0x32e0b5[_0x049f('0x48')][_0x049f('0x77')][_0x049f('0x5b')];_0xa4ac11+=0x1){socket['emit'](_0x049f('0x9a'),{'UserId':Number(_0x32e0b5[_0x049f('0x48')]['ids'][_0xa4ac11]),'ChatQueueId':Number(_0x32e0b5[_0x049f('0x59')]['id'])});}}else{socket[_0x049f('0x97')](_0x049f('0x9a'),{'UserId':Number(_0x32e0b5[_0x049f('0x48')][_0x049f('0x77')]),'ChatQueueId':Number(_0x32e0b5['params']['id'])});}});}})[_0x049f('0x23')](respondWithStatusCode(_0x56c3c1,null))['catch'](handleError(_0x56c3c1,null));};exports[_0x049f('0x9b')]=function(_0x236687,_0x5a3726,_0x390a17){var _0x5b6430={};var _0x37a2e7={};var _0xdcb277;var _0x316ed8;return db[_0x049f('0x43')]['findOne']({'where':{'id':_0x236687[_0x049f('0x59')]['id']}})[_0x049f('0x23')](handleEntityNotFound(_0x5a3726,null))[_0x049f('0x23')](function(_0x4f6053){if(_0x4f6053){_0xdcb277=_0x4f6053;_0x37a2e7[_0x049f('0x47')]=_[_0x049f('0x49')](db[_0x049f('0x6a')][_0x049f('0x44')]);_0x37a2e7['query']=_['keys'](_0x236687['query']);_0x37a2e7[_0x049f('0x4a')]=_[_0x049f('0x5a')](_0x37a2e7[_0x049f('0x47')],_0x37a2e7[_0x049f('0x48')]);_0x5b6430['attributes']=_['intersection'](_0x37a2e7['model'],qs[_0x049f('0x4c')](_0x236687[_0x049f('0x48')]['fields']));_0x5b6430[_0x049f('0x4b')]=_0x5b6430['attributes']['length']?_0x5b6430[_0x049f('0x4b')]:_0x37a2e7[_0x049f('0x47')];_0x5b6430[_0x049f('0x50')]=qs[_0x049f('0x51')](_0x236687[_0x049f('0x48')][_0x049f('0x51')]);_0x5b6430[_0x049f('0x52')]=qs[_0x049f('0x4a')](_['pick'](_0x236687[_0x049f('0x48')],_0x37a2e7[_0x049f('0x4a')]));if(_0x236687[_0x049f('0x48')][_0x049f('0x53')]){_0x5b6430[_0x049f('0x52')]=_['merge'](_0x5b6430['where'],{'$or':_['map'](_0x5b6430[_0x049f('0x4b')],function(_0x1159ac){var _0x28ab04={};_0x28ab04[_0x1159ac]={'$like':'%'+_0x236687['query'][_0x049f('0x53')]+'%'};return _0x28ab04;})});}_0x5b6430=_['merge']({},_0x5b6430,_0x236687[_0x049f('0x56')]);return _0xdcb277['getAgents'](_0x5b6430);}})['then'](function(_0x5409a7){if(_0x5409a7){_0x316ed8=_0x5409a7[_0x049f('0x5b')];if(!_0x236687[_0x049f('0x48')][_0x049f('0x4d')]('nolimit')){_0x5b6430[_0x049f('0x4f')]=qs[_0x049f('0x4f')](_0x236687[_0x049f('0x48')][_0x049f('0x4f')]);_0x5b6430[_0x049f('0x34')]=qs[_0x049f('0x34')](_0x236687[_0x049f('0x48')][_0x049f('0x34')]);}return _0xdcb277['getAgents'](_0x5b6430);}})['then'](function(_0x25ec0b){if(_0x25ec0b){return _0x25ec0b?{'count':_0x316ed8,'rows':_0x25ec0b}:null;}})[_0x049f('0x23')](respondWithResult(_0x5a3726,null))[_0x049f('0x2e')](handleError(_0x5a3726,null));}; \ No newline at end of file +var _0xdf0e=['Agents','clone','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','count','offset','limit','status','set','json','apply','reject','save','destroy','then','get','UserProfileResource','stack','name','send','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','where','VIRTUAL','merge','options','ChatQueue','includeAll','rows','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','userProfileId','autoAssociation','update','describe','findOne','UserChatQueue','nolimit','ChatQueueId','findAll','User','findAndCountAll','agent','updatedAt','createdAt','%s/%s','SIP','chatPause','getTeams','Team','hasOwnProperty','addTeams','ids','online','interface','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?'];(function(_0x31b950,_0x48a4e9){var _0x415d87=function(_0x42cb07){while(--_0x42cb07){_0x31b950['push'](_0x31b950['shift']());}};_0x415d87(++_0x48a4e9);}(_0xdf0e,0xa9));var _0xedf0=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xdf0e[_0x492535];return _0x256620;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedf0('0x0'));var rimraf=require(_0xedf0('0x1'));var zipdir=require(_0xedf0('0x2'));var jsonpatch=require(_0xedf0('0x3'));var rp=require(_0xedf0('0x4'));var moment=require(_0xedf0('0x5'));var BPromise=require(_0xedf0('0x6'));var Mustache=require(_0xedf0('0x7'));var util=require(_0xedf0('0x8'));var path=require(_0xedf0('0x9'));var sox=require(_0xedf0('0xa'));var csv=require(_0xedf0('0xb'));var ejs=require(_0xedf0('0xc'));var fs=require('fs');var _=require(_0xedf0('0xd'));var squel=require('squel');var crypto=require(_0xedf0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xedf0('0xf'));var toCsv=require(_0xedf0('0xb'));var querystring=require(_0xedf0('0x10'));var Papa=require(_0xedf0('0x11'));var Redis=require(_0xedf0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xedf0('0x13'));var as=require(_0xedf0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedf0('0x15'));var utils=require(_0xedf0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xedf0('0x17'));var db=require(_0xedf0('0x18'))['db'];config[_0xedf0('0x19')]=_[_0xedf0('0x1a')](config[_0xedf0('0x19')],{'host':_0xedf0('0x1b'),'port':0x18eb});var socket=require(_0xedf0('0x1c'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xedf0('0x1d')](socket);var jayson=require(_0xedf0('0x1e'));var client=jayson['client'][_0xedf0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4686c0,_0x5e7526,_0xe60ed8,_0x2b4d97){return new BPromise(function(_0x54ee20,_0x120d53){var _0x320415=_0x2b4d97||client;return _0x320415[_0xedf0('0x20')](_0x4686c0,_0xe60ed8)['then'](function(_0x3df6c4){logger[_0xedf0('0x21')](_0xedf0('0x22'),_0x5e7526,_0xedf0('0x23'));logger[_0xedf0('0x24')](_0xedf0('0x25'),_0x5e7526,_0xedf0('0x23'),JSON[_0xedf0('0x26')](_0x3df6c4));if(_0x3df6c4[_0xedf0('0x27')]){if(_0x3df6c4[_0xedf0('0x27')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5e7526,_0x3df6c4[_0xedf0('0x27')][_0xedf0('0x28')]);return _0x120d53(_0x3df6c4[_0xedf0('0x27')]['message']);}logger[_0xedf0('0x27')](_0xedf0('0x22'),_0x5e7526,_0x3df6c4['error'][_0xedf0('0x28')]);return _0x54ee20(_0x3df6c4[_0xedf0('0x27')][_0xedf0('0x28')]);}else{logger[_0xedf0('0x21')](_0xedf0('0x22'),_0x5e7526,_0xedf0('0x23'));_0x54ee20(_0x3df6c4['result']['message']);}})[_0xedf0('0x29')](function(_0x43ed3f){logger[_0xedf0('0x27')](_0xedf0('0x22'),_0x5e7526,_0x43ed3f);_0x120d53(_0x43ed3f);});});}function respondWithStatusCode(_0x457d31,_0x138423){_0x138423=_0x138423||0xcc;return function(_0x381455){if(_0x381455){return _0x457d31[_0xedf0('0x2a')](_0x138423);}return _0x457d31['status'](_0x138423)[_0xedf0('0x2b')]();};}function respondWithResult(_0x3a12a1,_0x25896c){_0x25896c=_0x25896c||0xc8;return function(_0x5ac843){if(_0x5ac843){return _0x3a12a1['status'](_0x25896c)['json'](_0x5ac843);}};}function respondWithFilteredResult(_0x48f0a1,_0x26fb18){return function(_0x4cfa62){if(_0x4cfa62){var _0x127a80=_0x4cfa62[_0xedf0('0x2c')],_0x2df2df=_0x26fb18[_0xedf0('0x2d')],_0x38c356=_0x26fb18[_0xedf0('0x2d')]+_0x26fb18[_0xedf0('0x2e')],_0x72849c;if(_0x38c356>=_0x127a80){_0x38c356=_0x127a80;_0x72849c=0xc8;}else{_0x72849c=0xce;}_0x48f0a1[_0xedf0('0x2f')](_0x72849c);return _0x48f0a1[_0xedf0('0x30')]('Content-Range',_0x2df2df+'-'+_0x38c356+'/'+_0x127a80)[_0xedf0('0x31')](_0x4cfa62);}return null;};}function patchUpdates(_0xd56486){return function(_0x376f59){try{jsonpatch[_0xedf0('0x32')](_0x376f59,_0xd56486,!![]);}catch(_0xdbcbc1){return BPromise[_0xedf0('0x33')](_0xdbcbc1);}return _0x376f59[_0xedf0('0x34')]();};}function saveUpdates(_0x3c04b4,_0x3c81ab){return function(_0x390bc1){if(_0x390bc1){return _0x390bc1['update'](_0x3c04b4)['then'](function(_0x3b9772){return _0x3b9772;});}return null;};}function removeEntity(_0x5a1773,_0x44e740){return function(_0x156aa9){if(_0x156aa9){return _0x156aa9[_0xedf0('0x35')]()[_0xedf0('0x36')](function(){var _0x5c6575=_0x156aa9[_0xedf0('0x37')]({'plain':!![]});var _0x265eb2='ChatQueues';return db[_0xedf0('0x38')][_0xedf0('0x35')]({'where':{'type':_0x265eb2,'resourceId':_0x5c6575['id']}})[_0xedf0('0x36')](function(){return _0x156aa9;});})[_0xedf0('0x36')](function(){_0x5a1773[_0xedf0('0x2f')](0xcc)[_0xedf0('0x2b')]();});}};}function handleEntityNotFound(_0x4e0a49,_0x2d9868){return function(_0xdd5eed){if(!_0xdd5eed){_0x4e0a49[_0xedf0('0x2a')](0x194);}return _0xdd5eed;};}function handleError(_0x2a78e0,_0x3f5052){_0x3f5052=_0x3f5052||0x1f4;return function(_0x34bdab){logger[_0xedf0('0x27')](_0x34bdab[_0xedf0('0x39')]);if(_0x34bdab['name']){delete _0x34bdab[_0xedf0('0x3a')];}_0x2a78e0[_0xedf0('0x2f')](_0x3f5052)[_0xedf0('0x3b')](_0x34bdab);};}exports[_0xedf0('0x3c')]=function(_0x16973b,_0x338599){var _0x4e264d={},_0x56e76d={},_0x43d43b={'count':0x0,'rows':[]};var _0x50fd9d=_[_0xedf0('0x3d')](db['ChatQueue']['rawAttributes'],function(_0x58a41d){return{'name':_0x58a41d['fieldName'],'type':_0x58a41d[_0xedf0('0x3e')][_0xedf0('0x3f')]};});_0x56e76d[_0xedf0('0x40')]=_[_0xedf0('0x3d')](_0x50fd9d,_0xedf0('0x3a'));_0x56e76d[_0xedf0('0x41')]=_[_0xedf0('0x42')](_0x16973b['query']);_0x56e76d[_0xedf0('0x43')]=_['intersection'](_0x56e76d[_0xedf0('0x40')],_0x56e76d[_0xedf0('0x41')]);_0x4e264d[_0xedf0('0x44')]=_[_0xedf0('0x45')](_0x56e76d[_0xedf0('0x40')],qs[_0xedf0('0x46')](_0x16973b[_0xedf0('0x41')][_0xedf0('0x46')]));_0x4e264d['attributes']=_0x4e264d['attributes'][_0xedf0('0x47')]?_0x4e264d[_0xedf0('0x44')]:_0x56e76d['model'];if(!_0x16973b[_0xedf0('0x41')]['hasOwnProperty']('nolimit')){_0x4e264d[_0xedf0('0x2e')]=qs['limit'](_0x16973b[_0xedf0('0x41')]['limit']);_0x4e264d[_0xedf0('0x2d')]=qs[_0xedf0('0x2d')](_0x16973b[_0xedf0('0x41')][_0xedf0('0x2d')]);}_0x4e264d[_0xedf0('0x48')]=qs[_0xedf0('0x49')](_0x16973b[_0xedf0('0x41')][_0xedf0('0x49')]);_0x4e264d['where']=qs[_0xedf0('0x43')](_[_0xedf0('0x4a')](_0x16973b[_0xedf0('0x41')],_0x56e76d[_0xedf0('0x43')]),_0x50fd9d);if(_0x16973b['query'][_0xedf0('0x4b')]){_0x4e264d[_0xedf0('0x4c')]=_['merge'](_0x4e264d[_0xedf0('0x4c')],{'$or':_[_0xedf0('0x3d')](_0x50fd9d,function(_0x14b9c3){if(_0x14b9c3[_0xedf0('0x3e')]!==_0xedf0('0x4d')){var _0x25ba31={};_0x25ba31[_0x14b9c3[_0xedf0('0x3a')]]={'$like':'%'+_0x16973b[_0xedf0('0x41')]['filter']+'%'};return _0x25ba31;}})});}_0x4e264d=_[_0xedf0('0x4e')]({},_0x4e264d,_0x16973b[_0xedf0('0x4f')]);var _0x2fe5b8={'where':_0x4e264d['where']};return db[_0xedf0('0x50')][_0xedf0('0x2c')](_0x2fe5b8)[_0xedf0('0x36')](function(_0x1958c3){_0x43d43b[_0xedf0('0x2c')]=_0x1958c3;if(_0x16973b[_0xedf0('0x41')][_0xedf0('0x51')]){_0x4e264d['include']=[{'all':!![]}];}return db[_0xedf0('0x50')]['findAll'](_0x4e264d);})['then'](function(_0x41466c){_0x43d43b[_0xedf0('0x52')]=_0x41466c;return _0x43d43b;})[_0xedf0('0x36')](respondWithFilteredResult(_0x338599,_0x4e264d))[_0xedf0('0x29')](handleError(_0x338599,null));};exports['show']=function(_0x510029,_0x2bbf8b){var _0xbe424f={'raw':!![],'where':{'id':_0x510029[_0xedf0('0x53')]['id']}},_0x28f77c={};_0x28f77c[_0xedf0('0x40')]=_[_0xedf0('0x42')](db[_0xedf0('0x50')][_0xedf0('0x54')]);_0x28f77c['query']=_[_0xedf0('0x42')](_0x510029[_0xedf0('0x41')]);_0x28f77c[_0xedf0('0x43')]=_[_0xedf0('0x45')](_0x28f77c[_0xedf0('0x40')],_0x28f77c[_0xedf0('0x41')]);_0xbe424f[_0xedf0('0x44')]=_[_0xedf0('0x45')](_0x28f77c[_0xedf0('0x40')],qs[_0xedf0('0x46')](_0x510029[_0xedf0('0x41')][_0xedf0('0x46')]));_0xbe424f[_0xedf0('0x44')]=_0xbe424f['attributes']['length']?_0xbe424f[_0xedf0('0x44')]:_0x28f77c[_0xedf0('0x40')];if(_0x510029[_0xedf0('0x41')]['includeAll']){_0xbe424f['include']=[{'all':!![]}];}_0xbe424f=_[_0xedf0('0x4e')]({},_0xbe424f,_0x510029[_0xedf0('0x4f')]);return db[_0xedf0('0x50')][_0xedf0('0x55')](_0xbe424f)['then'](handleEntityNotFound(_0x2bbf8b,null))[_0xedf0('0x36')](respondWithResult(_0x2bbf8b,null))[_0xedf0('0x29')](handleError(_0x2bbf8b,null));};exports[_0xedf0('0x56')]=function(_0x2318ad,_0x4f94fd){return db[_0xedf0('0x50')][_0xedf0('0x56')](_0x2318ad[_0xedf0('0x57')],{})[_0xedf0('0x36')](function(_0x2f4030){var _0x364935=_0x2318ad[_0xedf0('0x58')][_0xedf0('0x37')]({'plain':!![]});if(!_0x364935)throw new Error(_0xedf0('0x59'));if(_0x364935[_0xedf0('0x5a')]===_0xedf0('0x58')){var _0x4eefda=_0x2f4030['get']({'plain':!![]});var _0x4a93b0=_0xedf0('0x5b');return db['UserProfileSection'][_0xedf0('0x55')]({'where':{'name':_0x4a93b0,'userProfileId':_0x364935[_0xedf0('0x5c')]},'raw':!![]})[_0xedf0('0x36')](function(_0x435efd){if(_0x435efd&&_0x435efd[_0xedf0('0x5d')]===0x0){return db[_0xedf0('0x38')][_0xedf0('0x56')]({'name':_0x4eefda[_0xedf0('0x3a')],'resourceId':_0x4eefda['id'],'type':_0x435efd['name'],'sectionId':_0x435efd['id']},{})[_0xedf0('0x36')](function(){return _0x2f4030;});}else{return _0x2f4030;}})[_0xedf0('0x29')](function(_0x495da0){logger[_0xedf0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x495da0);throw _0x495da0;});}return _0x2f4030;})[_0xedf0('0x36')](respondWithResult(_0x4f94fd,0xc9))[_0xedf0('0x29')](handleError(_0x4f94fd,null));};exports[_0xedf0('0x5e')]=function(_0xaab9b0,_0x72e21d){if(_0xaab9b0[_0xedf0('0x57')]['id']){delete _0xaab9b0[_0xedf0('0x57')]['id'];}return db[_0xedf0('0x50')][_0xedf0('0x55')]({'where':{'id':_0xaab9b0['params']['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x72e21d,null))[_0xedf0('0x36')](saveUpdates(_0xaab9b0[_0xedf0('0x57')],null))['then'](respondWithResult(_0x72e21d,null))[_0xedf0('0x29')](handleError(_0x72e21d,null));};exports[_0xedf0('0x35')]=function(_0x2384c2,_0x3f8644){return db[_0xedf0('0x50')][_0xedf0('0x55')]({'where':{'id':_0x2384c2['params']['id']}})['then'](handleEntityNotFound(_0x3f8644,null))[_0xedf0('0x36')](removeEntity(_0x3f8644,null))[_0xedf0('0x29')](handleError(_0x3f8644,null));};exports[_0xedf0('0x5f')]=function(_0x486310,_0x56dd05){return db[_0xedf0('0x50')][_0xedf0('0x5f')]()[_0xedf0('0x36')](respondWithResult(_0x56dd05,null))['catch'](handleError(_0x56dd05,null));};exports['getMembers']=function(_0x548b6b,_0x2f81a2,_0x45a482){var _0x129c55={'raw':!![],'where':{}},_0x42862f={},_0x5b4ffc;return db[_0xedf0('0x50')][_0xedf0('0x60')]({'where':{'id':_0x548b6b[_0xedf0('0x53')]['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x2f81a2,null))[_0xedf0('0x36')](function(_0x193acc){if(_0x193acc){_0x5b4ffc=_0x193acc[_0xedf0('0x37')]({'plain':!![]});_0x42862f[_0xedf0('0x40')]=_[_0xedf0('0x42')](db[_0xedf0('0x61')][_0xedf0('0x54')]);_0x42862f[_0xedf0('0x41')]=_[_0xedf0('0x42')](_0x548b6b[_0xedf0('0x41')]);_0x42862f['filters']=_['intersection'](_0x42862f[_0xedf0('0x40')],_0x42862f[_0xedf0('0x41')]);_0x129c55[_0xedf0('0x44')]=_['intersection'](_0x42862f[_0xedf0('0x40')],qs[_0xedf0('0x46')](_0x548b6b['query'][_0xedf0('0x46')]));_0x129c55[_0xedf0('0x44')]=_0x129c55[_0xedf0('0x44')]['length']?_0x129c55[_0xedf0('0x44')]:_0x42862f[_0xedf0('0x40')];if(!_0x548b6b[_0xedf0('0x41')]['hasOwnProperty'](_0xedf0('0x62'))){_0x129c55[_0xedf0('0x2e')]=qs[_0xedf0('0x2e')](_0x548b6b[_0xedf0('0x41')][_0xedf0('0x2e')]);_0x129c55[_0xedf0('0x2d')]=qs[_0xedf0('0x2d')](_0x548b6b[_0xedf0('0x41')]['offset']);}_0x129c55[_0xedf0('0x48')]=qs[_0xedf0('0x49')](_0x548b6b['query']['sort']);_0x129c55[_0xedf0('0x4c')]=qs[_0xedf0('0x43')](_[_0xedf0('0x4a')](_0x548b6b[_0xedf0('0x41')],_0x42862f[_0xedf0('0x43')]));_0x129c55[_0xedf0('0x4c')][_0xedf0('0x63')]=_0x193acc['id'];if(_0x548b6b[_0xedf0('0x41')]['filter']){_0x129c55[_0xedf0('0x4c')]=_[_0xedf0('0x4e')](_0x129c55['where'],{'$or':_[_0xedf0('0x3d')](_0x129c55[_0xedf0('0x44')],function(_0x4a2fdf){var _0x349662={};_0x349662[_0x4a2fdf]={'$like':'%'+_0x548b6b['query']['filter']+'%'};return _0x349662;})});}_0x129c55=_[_0xedf0('0x4e')]({},_0x129c55,_0x548b6b[_0xedf0('0x4f')]);return db[_0xedf0('0x61')][_0xedf0('0x64')](_0x129c55);}})[_0xedf0('0x36')](function(_0x14effd){if(_0x14effd){return db[_0xedf0('0x65')][_0xedf0('0x66')]({'where':{'id':_['map'](_0x14effd,'UserId'),'role':_0xedf0('0x67')},'attributes':['id',_0xedf0('0x3a'),'chatPause',_0xedf0('0x68'),_0xedf0('0x69')]});}})['then'](function(_0x568d57){if(_0x568d57){return{'count':_0x568d57[_0xedf0('0x2c')],'rows':_['map'](_0x568d57[_0xedf0('0x52')],function(_0xd0c211){return{'membername':_0xd0c211[_0xedf0('0x3a')],'UserId':_0xd0c211['id'],'queue_name':_0x5b4ffc[_0xedf0('0x3a')],'ChatQueueId':_0x5b4ffc['id'],'interface':util['format'](_0xedf0('0x6a'),_0xedf0('0x6b'),_0xd0c211['name']),'penalty':0x0,'paused':_0xd0c211[_0xedf0('0x6c')],'createdAt':_0xd0c211[_0xedf0('0x69')],'updatedAt':_0xd0c211[_0xedf0('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xedf0('0x36')](respondWithFilteredResult(_0x2f81a2,_0x129c55))[_0xedf0('0x29')](handleError(_0x2f81a2,null));};exports[_0xedf0('0x6d')]=function(_0x13360c,_0x559524,_0x37d900){var _0xabb84c={};var _0x58ba36={};var _0x23df4d;var _0x39bbac;return db['ChatQueue']['findOne']({'where':{'id':_0x13360c[_0xedf0('0x53')]['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x559524,null))[_0xedf0('0x36')](function(_0x3308dd){if(_0x3308dd){_0x23df4d=_0x3308dd;_0x58ba36[_0xedf0('0x40')]=_[_0xedf0('0x42')](db[_0xedf0('0x6e')][_0xedf0('0x54')]);_0x58ba36[_0xedf0('0x41')]=_['keys'](_0x13360c[_0xedf0('0x41')]);_0x58ba36[_0xedf0('0x43')]=_['intersection'](_0x58ba36['model'],_0x58ba36[_0xedf0('0x41')]);_0xabb84c[_0xedf0('0x44')]=_[_0xedf0('0x45')](_0x58ba36['model'],qs['fields'](_0x13360c[_0xedf0('0x41')][_0xedf0('0x46')]));_0xabb84c[_0xedf0('0x44')]=_0xabb84c[_0xedf0('0x44')]['length']?_0xabb84c['attributes']:_0x58ba36[_0xedf0('0x40')];_0xabb84c[_0xedf0('0x48')]=qs[_0xedf0('0x49')](_0x13360c[_0xedf0('0x41')]['sort']);_0xabb84c['where']=qs['filters'](_[_0xedf0('0x4a')](_0x13360c[_0xedf0('0x41')],_0x58ba36['filters']));if(_0x13360c[_0xedf0('0x41')][_0xedf0('0x4b')]){_0xabb84c[_0xedf0('0x4c')]=_[_0xedf0('0x4e')](_0xabb84c[_0xedf0('0x4c')],{'$or':_[_0xedf0('0x3d')](_0xabb84c[_0xedf0('0x44')],function(_0x25ffb3){var _0x3a568b={};_0x3a568b[_0x25ffb3]={'$like':'%'+_0x13360c[_0xedf0('0x41')]['filter']+'%'};return _0x3a568b;})});}_0xabb84c=_['merge']({},_0xabb84c,_0x13360c[_0xedf0('0x4f')]);return _0x23df4d['getTeams'](_0xabb84c);}})['then'](function(_0x368ee5){if(_0x368ee5){_0x39bbac=_0x368ee5[_0xedf0('0x47')];if(!_0x13360c[_0xedf0('0x41')][_0xedf0('0x6f')](_0xedf0('0x62'))){_0xabb84c[_0xedf0('0x2e')]=qs['limit'](_0x13360c[_0xedf0('0x41')][_0xedf0('0x2e')]);_0xabb84c[_0xedf0('0x2d')]=qs[_0xedf0('0x2d')](_0x13360c['query'][_0xedf0('0x2d')]);}return _0x23df4d[_0xedf0('0x6d')](_0xabb84c);}})['then'](function(_0x3f5feb){if(_0x3f5feb){return _0x3f5feb?{'count':_0x39bbac,'rows':_0x3f5feb}:null;}})['then'](respondWithResult(_0x559524,null))[_0xedf0('0x29')](handleError(_0x559524,null));};exports[_0xedf0('0x70')]=function(_0x3ea80d,_0x240273,_0x57a473){var _0x214163=_0x3ea80d[_0xedf0('0x57')][_0xedf0('0x71')];return db[_0xedf0('0x6e')][_0xedf0('0x64')]({'where':{'id':_0x214163},'attributes':['id'],'include':[{'model':db[_0xedf0('0x65')],'as':'Agents','attributes':['id','name',_0xedf0('0x72'),'voicePause',_0xedf0('0x73')],'raw':!![]}]})['then'](function(_0x1066dd){if(_0x1066dd){var _0x22e384=_['flatMap'](_0x1066dd,function(_0x315a4f){var _0x269a9d=_0x315a4f[_0xedf0('0x37')]({'plain':!![]});return _0x269a9d['Agents'];});return db[_0xedf0('0x50')][_0xedf0('0x55')]({'where':{'id':_0x3ea80d['params']['id']}})[_0xedf0('0x36')](function(_0xedfc0){return db['sequelize'][_0xedf0('0x74')](function(_0x4f2717){return _0xedfc0['addTeams'](_0x214163,{'transaction':_0x4f2717})['then'](function(){return BPromise[_0xedf0('0x75')](_0x22e384,function(_0x5a06ba){return db[_0xedf0('0x61')][_0xedf0('0x76')]({'where':{'UserId':_0x5a06ba['id'],'ChatQueueId':_0x3ea80d[_0xedf0('0x53')]['id']},'transaction':_0x4f2717});});})[_0xedf0('0x36')](function(){_0x22e384[_0xedf0('0x77')](function(_0x4ec58a){socket[_0xedf0('0x78')](_0xedf0('0x79'),{'UserId':_0x4ec58a['id'],'ChatQueueId':_0xedfc0['id']});});});});});}})[_0xedf0('0x36')](respondWithStatusCode(_0x240273,null))['catch'](handleError(_0x240273,null));};exports[_0xedf0('0x7a')]=function(_0x39e3e1,_0x5034c7,_0x206dfb){return db[_0xedf0('0x6e')][_0xedf0('0x64')]({'where':{'id':_0x39e3e1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xedf0('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5034c7,null))[_0xedf0('0x36')](function(_0x142435){var _0x5b7785=_[_0xedf0('0x3d')](_0x142435,'id');var _0x366cf0=[];var _0x1c0b59=[];var _0x13d522=squel['select']();_0x13d522[_0xedf0('0x7b')]('tq.TeamId')[_0xedf0('0x7c')](_0xedf0('0x7d'),'tq')['join'](_0xedf0('0x7e'),'ut',_0xedf0('0x7f'))[_0xedf0('0x4c')](_0xedf0('0x80'),_0x39e3e1[_0xedf0('0x53')]['id']);for(var _0x50764d=0x0;_0x50764d<_0x142435[_0xedf0('0x47')];_0x50764d+=0x1){let _0x1dd8aa=_0x142435[_0x50764d];for(var _0x2da4b2=0x0;_0x2da4b2<_0x1dd8aa['Agents'][_0xedf0('0x47')];_0x2da4b2+=0x1){let _0x22cc8e=_0x1dd8aa[_0xedf0('0x81')][_0x2da4b2];var _0x438af5=_0x13d522[_0xedf0('0x82')]();_0x438af5[_0xedf0('0x4c')](_0xedf0('0x83'),_0x22cc8e['id']);_0x1c0b59[_0xedf0('0x84')](db['sequelize'][_0xedf0('0x41')](_0x438af5[_0xedf0('0x85')](),{'type':db[_0xedf0('0x86')]['QueryTypes'][_0xedf0('0x87')]})[_0xedf0('0x36')](function(_0xc81009){if(_0xc81009['length']===0x1){return _0x22cc8e['id'];}else{var _0x4240b4=_[_0xedf0('0x88')](_[_0xedf0('0x3d')](_0xc81009,_0xedf0('0x89')),function(_0x3722c0){return _[_0xedf0('0x8a')](_0x5b7785,_0x3722c0);});if(_0x4240b4){return _0x22cc8e['id'];}}}));}}return BPromise['all'](_0x1c0b59)['then'](function(_0x577e44){_0x366cf0=_(_0x366cf0)[_0xedf0('0x8b')](_0x577e44)[_0xedf0('0x8c')]()[_0xedf0('0x8d')]();return db[_0xedf0('0x50')][_0xedf0('0x55')]({'where':{'id':_0x39e3e1[_0xedf0('0x53')]['id']}})[_0xedf0('0x36')](function(_0x1076fb){return db[_0xedf0('0x86')][_0xedf0('0x74')](function(_0xd30409){return _0x1076fb[_0xedf0('0x7a')](_0x39e3e1[_0xedf0('0x41')][_0xedf0('0x71')],{'transaction':_0xd30409})[_0xedf0('0x36')](function(){if(!_[_0xedf0('0x8e')](_0x366cf0)){return _0x1076fb[_0xedf0('0x8f')](_0x366cf0,{'transaction':_0xd30409});}})['then'](function(){_0x366cf0[_0xedf0('0x77')](function(_0x3045e8){socket[_0xedf0('0x78')](_0xedf0('0x90'),{'UserId':_0x3045e8,'ChatQueueId':_0x1076fb['id']});});});});});});})[_0xedf0('0x36')](respondWithStatusCode(_0x5034c7,null))[_0xedf0('0x29')](handleError(_0x5034c7,null));};exports['addAgents']=function(_0x37caf9,_0x6bd522,_0x300d50){return db['ChatQueue']['find']({'where':{'id':_0x37caf9[_0xedf0('0x53')]['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x6bd522,null))[_0xedf0('0x36')](function(_0x17de8f){if(_0x17de8f){return _0x17de8f[_0xedf0('0x91')](_0x37caf9[_0xedf0('0x57')]['ids'],_[_0xedf0('0x92')](_0x37caf9[_0xedf0('0x57')],[_0xedf0('0x71'),'id'])||{})[_0xedf0('0x93')](function(_0x102c57){for(var _0x2729bb=0x0;_0x2729bb<_0x37caf9[_0xedf0('0x57')][_0xedf0('0x71')]['length'];_0x2729bb+=0x1){socket[_0xedf0('0x78')]('userChatQueue:save',{'UserId':_0x37caf9['body']['ids'][_0x2729bb],'ChatQueueId':_0x37caf9['params']['id']});}return _0x102c57;});}})[_0xedf0('0x36')](respondWithResult(_0x6bd522,null))[_0xedf0('0x29')](handleError(_0x6bd522,null));};exports[_0xedf0('0x8f')]=function(_0x1b73c3,_0x1f8c42,_0x39966f){return db['ChatQueue'][_0xedf0('0x55')]({'where':{'id':_0x1b73c3['params']['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x1f8c42,null))[_0xedf0('0x36')](function(_0x570e2b){if(_0x570e2b){return _0x570e2b[_0xedf0('0x8f')](_0x1b73c3[_0xedf0('0x41')][_0xedf0('0x71')])[_0xedf0('0x36')](function(){if(_['isArray'](_0x1b73c3[_0xedf0('0x41')][_0xedf0('0x71')])){for(var _0x663e2a=0x0;_0x663e2a<_0x1b73c3['query']['ids'][_0xedf0('0x47')];_0x663e2a+=0x1){socket['emit'](_0xedf0('0x90'),{'UserId':Number(_0x1b73c3[_0xedf0('0x41')][_0xedf0('0x71')][_0x663e2a]),'ChatQueueId':Number(_0x1b73c3['params']['id'])});}}else{socket[_0xedf0('0x78')](_0xedf0('0x90'),{'UserId':Number(_0x1b73c3[_0xedf0('0x41')][_0xedf0('0x71')]),'ChatQueueId':Number(_0x1b73c3[_0xedf0('0x53')]['id'])});}});}})[_0xedf0('0x36')](respondWithStatusCode(_0x1f8c42,null))[_0xedf0('0x29')](handleError(_0x1f8c42,null));};exports[_0xedf0('0x94')]=function(_0x225927,_0x1ff066,_0x4ad1c0){var _0x1b4123={};var _0x3301dc={};var _0x7e92b;var _0x45e540;return db['ChatQueue']['findOne']({'where':{'id':_0x225927[_0xedf0('0x53')]['id']}})['then'](handleEntityNotFound(_0x1ff066,null))[_0xedf0('0x36')](function(_0xe45bdd){if(_0xe45bdd){_0x7e92b=_0xe45bdd;_0x3301dc['model']=_['keys'](db[_0xedf0('0x65')][_0xedf0('0x54')]);_0x3301dc[_0xedf0('0x41')]=_[_0xedf0('0x42')](_0x225927['query']);_0x3301dc[_0xedf0('0x43')]=_['intersection'](_0x3301dc[_0xedf0('0x40')],_0x3301dc[_0xedf0('0x41')]);_0x1b4123[_0xedf0('0x44')]=_[_0xedf0('0x45')](_0x3301dc[_0xedf0('0x40')],qs['fields'](_0x225927[_0xedf0('0x41')]['fields']));_0x1b4123['attributes']=_0x1b4123[_0xedf0('0x44')]['length']?_0x1b4123[_0xedf0('0x44')]:_0x3301dc[_0xedf0('0x40')];_0x1b4123['order']=qs[_0xedf0('0x49')](_0x225927[_0xedf0('0x41')][_0xedf0('0x49')]);_0x1b4123[_0xedf0('0x4c')]=qs[_0xedf0('0x43')](_[_0xedf0('0x4a')](_0x225927[_0xedf0('0x41')],_0x3301dc['filters']));if(_0x225927[_0xedf0('0x41')][_0xedf0('0x4b')]){_0x1b4123[_0xedf0('0x4c')]=_[_0xedf0('0x4e')](_0x1b4123[_0xedf0('0x4c')],{'$or':_['map'](_0x1b4123['attributes'],function(_0x2104ca){var _0x305379={};_0x305379[_0x2104ca]={'$like':'%'+_0x225927['query']['filter']+'%'};return _0x305379;})});}_0x1b4123=_[_0xedf0('0x4e')]({},_0x1b4123,_0x225927['options']);return _0x7e92b[_0xedf0('0x94')](_0x1b4123);}})[_0xedf0('0x36')](function(_0x64e782){if(_0x64e782){_0x45e540=_0x64e782[_0xedf0('0x47')];if(!_0x225927[_0xedf0('0x41')][_0xedf0('0x6f')]('nolimit')){_0x1b4123[_0xedf0('0x2e')]=qs[_0xedf0('0x2e')](_0x225927[_0xedf0('0x41')]['limit']);_0x1b4123[_0xedf0('0x2d')]=qs[_0xedf0('0x2d')](_0x225927[_0xedf0('0x41')][_0xedf0('0x2d')]);}return _0x7e92b['getAgents'](_0x1b4123);}})['then'](function(_0x56ebc1){if(_0x56ebc1){return _0x56ebc1?{'count':_0x45e540,'rows':_0x56ebc1}:null;}})[_0xedf0('0x36')](respondWithResult(_0x1ff066,null))[_0xedf0('0x29')](handleError(_0x1ff066,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 2e5545e..787dd0a 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x2d4242,_0x4d55a){var _0x3334ce=function(_0x404af4){while(--_0x404af4){_0x2d4242['push'](_0x2d4242['shift']());}};_0x3334ce(++_0x4d55a);}(_0xb10b,0x12a));var _0xbb10=function(_0x211b9c,_0x3e4a38){_0x211b9c=_0x211b9c-0x0;var _0x5be03d=_0xb10b[_0x211b9c];return _0x5be03d;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x2b16c8,_0x33d9aa){var _0x4a7e1f=function(_0x5eb6ab){while(--_0x5eb6ab){_0x2b16c8['push'](_0x2b16c8['shift']());}};_0x4a7e1f(++_0x33d9aa);}(_0xb10b,0x12a));var _0xbb10=function(_0x31bd8b,_0x56fa02){_0x31bd8b=_0x31bd8b-0x0;var _0x1506e4=_0xb10b[_0x31bd8b];return _0x1506e4;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 13642c5..9974e50 100644 --- a/server/api/chatQueue/chatQueue.model.js +++ b/server/api/chatQueue/chatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57dd=['path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2349af,_0x4ddac4){var _0x1d5ffd=function(_0x5796cc){while(--_0x5796cc){_0x2349af['push'](_0x2349af['shift']());}};_0x1d5ffd(++_0x4ddac4);}(_0x57dd,0x19a));var _0xd57d=function(_0x44f318,_0x3d8d75){_0x44f318=_0x44f318-0x0;var _0x11f6f1=_0x57dd[_0x44f318];return _0x11f6f1;};'use strict';var _=require(_0xd57d('0x0'));var util=require(_0xd57d('0x1'));var logger=require(_0xd57d('0x2'))(_0xd57d('0x3'));var moment=require(_0xd57d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd57d('0x5'));var fs=require('fs');var path=require(_0xd57d('0x6'));var rimraf=require(_0xd57d('0x7'));var config=require(_0xd57d('0x8'));var attributes=require(_0xd57d('0x9'));module['exports']=function(_0x3c0502,_0xe98ed0){return _0x3c0502[_0xd57d('0xa')](_0xd57d('0xb'),attributes,{'tableName':_0xd57d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07d4=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x37e2f5,_0x587cf9){var _0x41c16c=function(_0x18b8b6){while(--_0x18b8b6){_0x37e2f5['push'](_0x37e2f5['shift']());}};_0x41c16c(++_0x587cf9);}(_0x07d4,0xb6));var _0x407d=function(_0x13b3b5,_0x52d8d8){_0x13b3b5=_0x13b3b5-0x0;var _0x337cd0=_0x07d4[_0x13b3b5];return _0x337cd0;};'use strict';var _=require(_0x407d('0x0'));var util=require('util');var logger=require(_0x407d('0x1'))(_0x407d('0x2'));var moment=require(_0x407d('0x3'));var BPromise=require(_0x407d('0x4'));var rp=require(_0x407d('0x5'));var fs=require('fs');var path=require(_0x407d('0x6'));var rimraf=require('rimraf');var config=require(_0x407d('0x7'));var attributes=require(_0x407d('0x8'));module[_0x407d('0x9')]=function(_0x1cbd9c,_0x3d142d){return _0x1cbd9c[_0x407d('0xa')](_0x407d('0xb'),attributes,{'tableName':_0x407d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 02552fb..2a70099 100644 --- a/server/api/chatQueue/chatQueue.rpc.js +++ b/server/api/chatQueue/chatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcefd=['GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','map','model','include','stringify','catch','ShowChatQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','error','code','message','ChatQueue,\x20%s,\x20%s','result'];(function(_0x4076b5,_0x4b07d9){var _0x249506=function(_0x195b72){while(--_0x195b72){_0x4076b5['push'](_0x4076b5['shift']());}};_0x249506(++_0x4b07d9);}(_0xcefd,0x1bd));var _0xdcef=function(_0x28d2e5,_0x30179f){_0x28d2e5=_0x28d2e5-0x0;var _0x19372b=_0xcefd[_0x28d2e5];return _0x19372b;};'use strict';var _=require('lodash');var util=require(_0xdcef('0x0'));var moment=require(_0xdcef('0x1'));var BPromise=require(_0xdcef('0x2'));var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require(_0xdcef('0x6'));var logger=require('../../config/logger')(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require(_0xdcef('0x9'));var client=jayson[_0xdcef('0xa')][_0xdcef('0xb')]({'port':0x232a});config['redis']=_[_0xdcef('0xc')](config[_0xdcef('0xd')],{'host':_0xdcef('0xe'),'port':0x18eb});var socket=require(_0xdcef('0xf'))(new Redis(config['redis']));require(_0xdcef('0x10'))[_0xdcef('0x11')](socket);function respondWithRpcPromise(_0x2b6b4c,_0x49e6ab,_0x40c723){return new BPromise(function(_0x4e5a2c,_0x336306){return client[_0xdcef('0x12')](_0x2b6b4c,_0x40c723)[_0xdcef('0x13')](function(_0xde013){logger[_0xdcef('0x14')]('ChatQueue,\x20%s,\x20%s',_0x49e6ab,_0xdcef('0x15'));logger[_0xdcef('0x16')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x49e6ab,_0xdcef('0x15'),JSON['stringify'](_0xde013));if(_0xde013[_0xdcef('0x17')]){if(_0xde013[_0xdcef('0x17')][_0xdcef('0x18')]===0x1f4){logger[_0xdcef('0x17')]('ChatQueue,\x20%s,\x20%s',_0x49e6ab,_0xde013[_0xdcef('0x17')][_0xdcef('0x19')]);return _0x336306(_0xde013['error'][_0xdcef('0x19')]);}logger[_0xdcef('0x17')](_0xdcef('0x1a'),_0x49e6ab,_0xde013['error']['message']);return _0x4e5a2c(_0xde013[_0xdcef('0x17')][_0xdcef('0x19')]);}else{logger[_0xdcef('0x14')]('ChatQueue,\x20%s,\x20%s',_0x49e6ab,_0xdcef('0x15'));_0x4e5a2c(_0xde013[_0xdcef('0x1b')][_0xdcef('0x19')]);}})['catch'](function(_0x2e5bec){logger['error'](_0xdcef('0x1a'),_0x49e6ab,_0x2e5bec);_0x336306(_0x2e5bec);});});}exports[_0xdcef('0x1c')]=function(_0x151719){var _0x443776=this;return new Promise(function(_0x1ba061,_0x13ac84){return db[_0xdcef('0x1d')][_0xdcef('0x1e')]({'raw':_0x151719[_0xdcef('0x1f')]?_0x151719['options'][_0xdcef('0x20')]===undefined?!![]:![]:!![],'where':_0x151719[_0xdcef('0x1f')]?_0x151719[_0xdcef('0x1f')][_0xdcef('0x21')]||null:null,'attributes':_0x151719['options']?_0x151719[_0xdcef('0x1f')][_0xdcef('0x22')]||null:null,'limit':_0x151719['options']?_0x151719[_0xdcef('0x1f')][_0xdcef('0x23')]||null:null,'include':_0x151719[_0xdcef('0x1f')]?_0x151719[_0xdcef('0x1f')]['include']?_[_0xdcef('0x24')](_0x151719['options']['include'],function(_0xf9b6a5){return{'model':db[_0xf9b6a5[_0xdcef('0x25')]],'as':_0xf9b6a5['as'],'attributes':_0xf9b6a5[_0xdcef('0x22')],'include':_0xf9b6a5[_0xdcef('0x26')]?_[_0xdcef('0x24')](_0xf9b6a5[_0xdcef('0x26')],function(_0x1ca0cf){return{'model':db[_0x1ca0cf[_0xdcef('0x25')]],'as':_0x1ca0cf['as'],'attributes':_0x1ca0cf[_0xdcef('0x22')],'include':_0x1ca0cf[_0xdcef('0x26')]?_['map'](_0x1ca0cf[_0xdcef('0x26')],function(_0x5413fe){return{'model':db[_0x5413fe[_0xdcef('0x25')]],'as':_0x5413fe['as'],'attributes':_0x5413fe['attributes']};}):[]};}):[]};}):[]:[]})[_0xdcef('0x13')](function(_0x565a31){logger['info'](_0xdcef('0x1c'),_0x151719);logger[_0xdcef('0x16')](_0xdcef('0x1c'),_0x151719,JSON[_0xdcef('0x27')](_0x565a31));_0x1ba061(_0x565a31);})[_0xdcef('0x28')](function(_0x538866){logger['error']('GetChatQueue',_0x538866[_0xdcef('0x19')],_0x151719);_0x13ac84(_0x443776[_0xdcef('0x17')](0x1f4,_0x538866[_0xdcef('0x19')]));});});};exports[_0xdcef('0x29')]=function(_0x1bf9b5){var _0x336b99=this;return new Promise(function(_0x5d58e9,_0x10df6b){return db[_0xdcef('0x1d')][_0xdcef('0x2a')]({'raw':_0x1bf9b5['options']?_0x1bf9b5[_0xdcef('0x1f')][_0xdcef('0x20')]===undefined?!![]:![]:!![],'where':_0x1bf9b5['options']?_0x1bf9b5[_0xdcef('0x1f')]['where']||null:null,'attributes':_0x1bf9b5[_0xdcef('0x1f')]?_0x1bf9b5[_0xdcef('0x1f')][_0xdcef('0x22')]||null:null,'include':_0x1bf9b5[_0xdcef('0x1f')]?_0x1bf9b5[_0xdcef('0x1f')]['include']?_['map'](_0x1bf9b5['options'][_0xdcef('0x26')],function(_0xef2940){return{'model':db[_0xef2940[_0xdcef('0x25')]],'as':_0xef2940['as'],'attributes':_0xef2940[_0xdcef('0x22')],'include':_0xef2940['include']?_[_0xdcef('0x24')](_0xef2940[_0xdcef('0x26')],function(_0xeb262e){return{'model':db[_0xeb262e[_0xdcef('0x25')]],'as':_0xeb262e['as'],'attributes':_0xeb262e[_0xdcef('0x22')],'include':_0xeb262e[_0xdcef('0x26')]?_[_0xdcef('0x24')](_0xeb262e[_0xdcef('0x26')],function(_0x3032b9){return{'model':db[_0x3032b9['model']],'as':_0x3032b9['as'],'attributes':_0x3032b9[_0xdcef('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdcef('0x13')](function(_0xe8f933){logger[_0xdcef('0x14')]('ShowChatQueue',_0x1bf9b5);logger[_0xdcef('0x16')]('ShowChatQueue',_0x1bf9b5,JSON[_0xdcef('0x27')](_0xe8f933));_0x5d58e9(_0xe8f933);})[_0xdcef('0x28')](function(_0x3159d2){logger[_0xdcef('0x17')](_0xdcef('0x29'),_0x3159d2[_0xdcef('0x19')],_0x1bf9b5);_0x10df6b(_0x336b99[_0xdcef('0x17')](0x1f4,_0x3159d2['message']));});});}; \ No newline at end of file +var _0x1c45=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetChatQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ChatQueue','find','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x23017d,_0x38695c){var _0x315230=function(_0x3ceca1){while(--_0x3ceca1){_0x23017d['push'](_0x23017d['shift']());}};_0x315230(++_0x38695c);}(_0x1c45,0x1b0));var _0x51c4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c45[_0x432682];return _0x463d05;};'use strict';var _=require(_0x51c4('0x0'));var util=require(_0x51c4('0x1'));var moment=require(_0x51c4('0x2'));var BPromise=require(_0x51c4('0x3'));var rs=require(_0x51c4('0x4'));var fs=require('fs');var Redis=require(_0x51c4('0x5'));var db=require(_0x51c4('0x6'))['db'];var utils=require(_0x51c4('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x51c4('0x8'));var jayson=require(_0x51c4('0x9'));var client=jayson[_0x51c4('0xa')][_0x51c4('0xb')]({'port':0x232a});config[_0x51c4('0xc')]=_[_0x51c4('0xd')](config[_0x51c4('0xc')],{'host':_0x51c4('0xe'),'port':0x18eb});var socket=require(_0x51c4('0xf'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x51c4('0x10')](socket);function respondWithRpcPromise(_0x3f0716,_0x42e523,_0xab88cb){return new BPromise(function(_0x109781,_0x1882e7){return client['request'](_0x3f0716,_0xab88cb)[_0x51c4('0x11')](function(_0xb3ac98){logger[_0x51c4('0x12')](_0x51c4('0x13'),_0x42e523,_0x51c4('0x14'));logger[_0x51c4('0x15')](_0x51c4('0x16'),_0x42e523,_0x51c4('0x14'),JSON[_0x51c4('0x17')](_0xb3ac98));if(_0xb3ac98[_0x51c4('0x18')]){if(_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x19')]===0x1f4){logger[_0x51c4('0x18')]('ChatQueue,\x20%s,\x20%s',_0x42e523,_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);return _0x1882e7(_0xb3ac98['error'][_0x51c4('0x1a')]);}logger[_0x51c4('0x18')](_0x51c4('0x13'),_0x42e523,_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);return _0x109781(_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);}else{logger['info'](_0x51c4('0x13'),_0x42e523,_0x51c4('0x14'));_0x109781(_0xb3ac98['result'][_0x51c4('0x1a')]);}})['catch'](function(_0x2b3e0b){logger[_0x51c4('0x18')](_0x51c4('0x13'),_0x42e523,_0x2b3e0b);_0x1882e7(_0x2b3e0b);});});}exports[_0x51c4('0x1b')]=function(_0x535690){var _0x3a67ed=this;return new Promise(function(_0x3842d8,_0x47878a){return db['ChatQueue'][_0x51c4('0x1c')]({'raw':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x1e')]===undefined?!![]:![]:!![],'where':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')]['where']||null:null,'attributes':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x1f')]||null:null,'limit':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x20')]||null:null,'include':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x535690[_0x51c4('0x1d')]['include'],function(_0x367065){return{'model':db[_0x367065[_0x51c4('0x23')]],'as':_0x367065['as'],'attributes':_0x367065[_0x51c4('0x1f')],'include':_0x367065[_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x367065[_0x51c4('0x21')],function(_0xe2f167){return{'model':db[_0xe2f167[_0x51c4('0x23')]],'as':_0xe2f167['as'],'attributes':_0xe2f167[_0x51c4('0x1f')],'include':_0xe2f167[_0x51c4('0x21')]?_[_0x51c4('0x22')](_0xe2f167[_0x51c4('0x21')],function(_0x32ef99){return{'model':db[_0x32ef99[_0x51c4('0x23')]],'as':_0x32ef99['as'],'attributes':_0x32ef99[_0x51c4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cfff4){logger[_0x51c4('0x12')]('GetChatQueue',_0x535690);logger[_0x51c4('0x15')](_0x51c4('0x1b'),_0x535690,JSON[_0x51c4('0x17')](_0x3cfff4));_0x3842d8(_0x3cfff4);})[_0x51c4('0x24')](function(_0x227940){logger['error'](_0x51c4('0x1b'),_0x227940[_0x51c4('0x1a')],_0x535690);_0x47878a(_0x3a67ed[_0x51c4('0x18')](0x1f4,_0x227940[_0x51c4('0x1a')]));});});};exports['ShowChatQueue']=function(_0x4af023){var _0xb46c43=this;return new Promise(function(_0x3e4cbd,_0x4fd966){return db[_0x51c4('0x25')][_0x51c4('0x26')]({'raw':_0x4af023['options']?_0x4af023['options'][_0x51c4('0x1e')]===undefined?!![]:![]:!![],'where':_0x4af023[_0x51c4('0x1d')]?_0x4af023[_0x51c4('0x1d')]['where']||null:null,'attributes':_0x4af023[_0x51c4('0x1d')]?_0x4af023[_0x51c4('0x1d')][_0x51c4('0x1f')]||null:null,'include':_0x4af023[_0x51c4('0x1d')]?_0x4af023['options'][_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x4af023['options'][_0x51c4('0x21')],function(_0x4dcbda){return{'model':db[_0x4dcbda[_0x51c4('0x23')]],'as':_0x4dcbda['as'],'attributes':_0x4dcbda[_0x51c4('0x1f')],'include':_0x4dcbda[_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x4dcbda[_0x51c4('0x21')],function(_0x4f77a7){return{'model':db[_0x4f77a7[_0x51c4('0x23')]],'as':_0x4f77a7['as'],'attributes':_0x4f77a7['attributes'],'include':_0x4f77a7[_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x4f77a7[_0x51c4('0x21')],function(_0x3169c8){return{'model':db[_0x3169c8[_0x51c4('0x23')]],'as':_0x3169c8['as'],'attributes':_0x3169c8[_0x51c4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x51c4('0x11')](function(_0xfcc949){logger[_0x51c4('0x12')](_0x51c4('0x27'),_0x4af023);logger[_0x51c4('0x15')](_0x51c4('0x27'),_0x4af023,JSON[_0x51c4('0x17')](_0xfcc949));_0x3e4cbd(_0xfcc949);})[_0x51c4('0x24')](function(_0x493d97){logger[_0x51c4('0x18')](_0x51c4('0x27'),_0x493d97[_0x51c4('0x1a')],_0x4af023);_0x4fd966(_0xb46c43[_0x51c4('0x18')](0x1f4,_0x493d97[_0x51c4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8fb531a..16ffadd 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0xa1c275,_0xed85ac){var _0x494c5b=function(_0x1545e8){while(--_0x1545e8){_0xa1c275['push'](_0xa1c275['shift']());}};_0x494c5b(++_0xed85ac);}(_0x0b0e,0x187));var _0xe0b0=function(_0x14f7fe,_0x5132c4){_0x14f7fe=_0x14f7fe-0x0;var _0x3d8309=_0x0b0e[_0x14f7fe];return _0x3d8309;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x405e13,_0x1ed8d3){var _0x5eb8a5=function(_0x3fbeb0){while(--_0x3fbeb0){_0x405e13['push'](_0x405e13['shift']());}};_0x5eb8a5(++_0x1ed8d3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c227d,_0x23bb40){_0x5c227d=_0x5c227d-0x0;var _0x33986a=_0x5f2f[_0x5c227d];return _0x33986a;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ad17ebd..7b4e1f2 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeea1=['delete','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','post','create','/:id/users','addAgents','put','update'];(function(_0x3ad931,_0x19124d){var _0x4ea111=function(_0x384c17){while(--_0x384c17){_0x3ad931['push'](_0x3ad931['shift']());}};_0x4ea111(++_0x19124d);}(_0xeea1,0x1de));var _0x1eea=function(_0x9419c4,_0x19365c){_0x9419c4=_0x9419c4-0x0;var _0x25c12e=_0xeea1[_0x9419c4];return _0x25c12e;};'use strict';var multer=require(_0x1eea('0x0'));var util=require(_0x1eea('0x1'));var path=require(_0x1eea('0x2'));var timeout=require(_0x1eea('0x3'));var express=require('express');var router=express[_0x1eea('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1eea('0x5'));var config=require(_0x1eea('0x6'));var controller=require('./chatQueue.controller');router[_0x1eea('0x7')]('/',auth[_0x1eea('0x8')](),controller[_0x1eea('0x9')]);router[_0x1eea('0x7')](_0x1eea('0xa'),auth[_0x1eea('0x8')](),controller[_0x1eea('0xb')]);router[_0x1eea('0x7')](_0x1eea('0xc'),auth[_0x1eea('0x8')](),controller[_0x1eea('0xd')]);router[_0x1eea('0x7')](_0x1eea('0xe'),auth[_0x1eea('0x8')](),controller['getMembers']);router[_0x1eea('0x7')](_0x1eea('0xf'),auth[_0x1eea('0x8')](),controller['getTeams']);router[_0x1eea('0x7')]('/:id/users',auth[_0x1eea('0x8')](),controller['getAgents']);router[_0x1eea('0x10')]('/',auth[_0x1eea('0x8')](),controller[_0x1eea('0x11')]);router[_0x1eea('0x10')](_0x1eea('0xf'),auth[_0x1eea('0x8')](),controller['addTeams']);router[_0x1eea('0x10')](_0x1eea('0x12'),auth[_0x1eea('0x8')](),controller[_0x1eea('0x13')]);router[_0x1eea('0x14')](_0x1eea('0xc'),auth['isAuthenticated'](),controller[_0x1eea('0x15')]);router[_0x1eea('0x16')]('/:id',auth[_0x1eea('0x8')](),controller['destroy']);router[_0x1eea('0x16')](_0x1eea('0xf'),auth['isAuthenticated'](),controller[_0x1eea('0x17')]);router[_0x1eea('0x16')](_0x1eea('0x12'),auth[_0x1eea('0x8')](),controller['removeAgents']);module[_0x1eea('0x18')]=router; \ No newline at end of file +var _0x162c=['/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x162c,0x189));var _0xc162=function(_0xa30bad,_0x40e784){_0xa30bad=_0xa30bad-0x0;var _0x118bd3=_0x162c[_0xa30bad];return _0x118bd3;};'use strict';var multer=require(_0xc162('0x0'));var util=require('util');var path=require(_0xc162('0x1'));var timeout=require('connect-timeout');var express=require(_0xc162('0x2'));var router=express[_0xc162('0x3')]();var auth=require(_0xc162('0x4'));var interaction=require(_0xc162('0x5'));var config=require(_0xc162('0x6'));var controller=require('./chatQueue.controller');router[_0xc162('0x7')]('/',auth['isAuthenticated'](),controller[_0xc162('0x8')]);router['get'](_0xc162('0x9'),auth[_0xc162('0xa')](),controller[_0xc162('0xb')]);router[_0xc162('0x7')](_0xc162('0xc'),auth[_0xc162('0xa')](),controller['show']);router[_0xc162('0x7')](_0xc162('0xd'),auth['isAuthenticated'](),controller[_0xc162('0xe')]);router[_0xc162('0x7')](_0xc162('0xf'),auth[_0xc162('0xa')](),controller[_0xc162('0x10')]);router[_0xc162('0x7')]('/:id/users',auth[_0xc162('0xa')](),controller[_0xc162('0x11')]);router[_0xc162('0x12')]('/',auth[_0xc162('0xa')](),controller[_0xc162('0x13')]);router[_0xc162('0x12')](_0xc162('0xf'),auth[_0xc162('0xa')](),controller[_0xc162('0x14')]);router[_0xc162('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0xc162('0x15')]);router[_0xc162('0x16')](_0xc162('0xc'),auth[_0xc162('0xa')](),controller[_0xc162('0x17')]);router[_0xc162('0x18')](_0xc162('0xc'),auth['isAuthenticated'](),controller[_0xc162('0x19')]);router[_0xc162('0x18')](_0xc162('0xf'),auth[_0xc162('0xa')](),controller[_0xc162('0x1a')]);router[_0xc162('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xc162('0x1b')]);module[_0xc162('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 9af0d64..3a6f4a1 100644 --- a/server/api/chatQueueReport/chatQueueReport.attributes.js +++ b/server/api/chatQueueReport/chatQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb451=['STRING','DATE','moment','sequelize','exports'];(function(_0x57e50b,_0x16e856){var _0x4a1016=function(_0x3db554){while(--_0x3db554){_0x57e50b['push'](_0x57e50b['shift']());}};_0x4a1016(++_0x16e856);}(_0xb451,0x1e7));var _0x1b45=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0xb451[_0x3e182f];return _0x23edc9;};'use strict';var moment=require(_0x1b45('0x0'));var Sequelize=require(_0x1b45('0x1'));module[_0x1b45('0x2')]={'uniqueid':{'type':Sequelize[_0x1b45('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1b45('0x3')]},'joinAt':{'type':Sequelize[_0x1b45('0x4')]},'leaveAt':{'type':Sequelize[_0x1b45('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1b45('0x4')]},'reason':{'type':Sequelize[_0x1b45('0x3')]}}; \ No newline at end of file +var _0x140a=['exports','STRING','DATE','moment'];(function(_0x579d00,_0x2f2a51){var _0x4d06e0=function(_0x2f3328){while(--_0x2f3328){_0x579d00['push'](_0x579d00['shift']());}};_0x4d06e0(++_0x2f2a51);}(_0x140a,0xfb));var _0xa140=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x140a[_0x2b5eae];return _0x5f3ac9;};'use strict';var moment=require(_0xa140('0x0'));var Sequelize=require('sequelize');module[_0xa140('0x1')]={'uniqueid':{'type':Sequelize[_0xa140('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa140('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa140('0x3')]},'exitAt':{'type':Sequelize[_0xa140('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 0bf0d8d..f3f9a1e 100644 --- a/server/api/chatQueueReport/chatQueueReport.controller.js +++ b/server/api/chatQueueReport/chatQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a73=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','VIRTUAL','merge','options','include','rows','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0x8a73,0x7c));var _0x38a7=function(_0x41d7ae,_0x26ff08){_0x41d7ae=_0x41d7ae-0x0;var _0x1baa77=_0x8a73[_0x41d7ae];return _0x1baa77;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x38a7('0x0'));var zipdir=require(_0x38a7('0x1'));var jsonpatch=require(_0x38a7('0x2'));var rp=require('request-promise');var moment=require(_0x38a7('0x3'));var BPromise=require(_0x38a7('0x4'));var Mustache=require('mustache');var util=require(_0x38a7('0x5'));var path=require(_0x38a7('0x6'));var sox=require('sox');var csv=require(_0x38a7('0x7'));var ejs=require(_0x38a7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x38a7('0x9'));var crypto=require(_0x38a7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38a7('0x7'));var querystring=require(_0x38a7('0xb'));var Papa=require(_0x38a7('0xc'));var Redis=require(_0x38a7('0xd'));var authService=require(_0x38a7('0xe'));var qs=require(_0x38a7('0xf'));var as=require(_0x38a7('0x10'));var hardwareService=require(_0x38a7('0x11'));var logger=require(_0x38a7('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x38a7('0x13'));var licenseUtil=require(_0x38a7('0x14'));var db=require(_0x38a7('0x15'))['db'];function respondWithStatusCode(_0xcd9e75,_0x49d23b){_0x49d23b=_0x49d23b||0xcc;return function(_0xd1f7f9){if(_0xd1f7f9){return _0xcd9e75[_0x38a7('0x16')](_0x49d23b);}return _0xcd9e75[_0x38a7('0x17')](_0x49d23b)[_0x38a7('0x18')]();};}function respondWithResult(_0x1a7e19,_0x2ef6eb){_0x2ef6eb=_0x2ef6eb||0xc8;return function(_0x3bd85b){if(_0x3bd85b){return _0x1a7e19[_0x38a7('0x17')](_0x2ef6eb)[_0x38a7('0x19')](_0x3bd85b);}};}function respondWithFilteredResult(_0x32ab4f,_0x49fd42){return function(_0x54d500){if(_0x54d500){var _0x43adc8=_0x54d500[_0x38a7('0x1a')],_0x5a4c18=_0x49fd42['offset'],_0x1811d4=_0x49fd42['offset']+_0x49fd42[_0x38a7('0x1b')],_0x48d540;if(_0x1811d4>=_0x43adc8){_0x1811d4=_0x43adc8;_0x48d540=0xc8;}else{_0x48d540=0xce;}_0x32ab4f[_0x38a7('0x17')](_0x48d540);return _0x32ab4f[_0x38a7('0x1c')](_0x38a7('0x1d'),_0x5a4c18+'-'+_0x1811d4+'/'+_0x43adc8)[_0x38a7('0x19')](_0x54d500);}return null;};}function patchUpdates(_0x217fa3){return function(_0x5cf10f){try{jsonpatch[_0x38a7('0x1e')](_0x5cf10f,_0x217fa3,!![]);}catch(_0x13392b){return BPromise[_0x38a7('0x1f')](_0x13392b);}return _0x5cf10f[_0x38a7('0x20')]();};}function saveUpdates(_0x25c8a0,_0x3f27ff){return function(_0xedfe20){if(_0xedfe20){return _0xedfe20[_0x38a7('0x21')](_0x25c8a0)[_0x38a7('0x22')](function(_0x5b0ec2){return _0x5b0ec2;});}return null;};}function removeEntity(_0x3f5bec,_0x4077bb){return function(_0x4623f1){if(_0x4623f1){return _0x4623f1[_0x38a7('0x23')]()['then'](function(){_0x3f5bec[_0x38a7('0x17')](0xcc)[_0x38a7('0x18')]();});}};}function handleEntityNotFound(_0x20029b,_0x355744){return function(_0x3e602f){if(!_0x3e602f){_0x20029b[_0x38a7('0x16')](0x194);}return _0x3e602f;};}function handleError(_0x579e44,_0x34df54){_0x34df54=_0x34df54||0x1f4;return function(_0x18f830){logger['error'](_0x18f830[_0x38a7('0x24')]);if(_0x18f830[_0x38a7('0x25')]){delete _0x18f830['name'];}_0x579e44['status'](_0x34df54)[_0x38a7('0x26')](_0x18f830);};}exports[_0x38a7('0x27')]=function(_0x473fd0,_0x4ea226){var _0x326846={},_0x5d15cb={},_0x224c1d={'count':0x0,'rows':[]};var _0x300d9=_[_0x38a7('0x28')](db[_0x38a7('0x29')][_0x38a7('0x2a')],function(_0x5d4240){return{'name':_0x5d4240[_0x38a7('0x2b')],'type':_0x5d4240[_0x38a7('0x2c')][_0x38a7('0x2d')]};});_0x5d15cb[_0x38a7('0x2e')]=_[_0x38a7('0x28')](_0x300d9,'name');_0x5d15cb['query']=_[_0x38a7('0x2f')](_0x473fd0[_0x38a7('0x30')]);_0x5d15cb['filters']=_[_0x38a7('0x31')](_0x5d15cb[_0x38a7('0x2e')],_0x5d15cb[_0x38a7('0x30')]);_0x326846[_0x38a7('0x32')]=_[_0x38a7('0x31')](_0x5d15cb[_0x38a7('0x2e')],qs[_0x38a7('0x33')](_0x473fd0[_0x38a7('0x30')][_0x38a7('0x33')]));_0x326846[_0x38a7('0x32')]=_0x326846[_0x38a7('0x32')][_0x38a7('0x34')]?_0x326846[_0x38a7('0x32')]:_0x5d15cb[_0x38a7('0x2e')];if(!_0x473fd0[_0x38a7('0x30')][_0x38a7('0x35')]('nolimit')){_0x326846[_0x38a7('0x1b')]=qs['limit'](_0x473fd0[_0x38a7('0x30')][_0x38a7('0x1b')]);_0x326846[_0x38a7('0x36')]=qs[_0x38a7('0x36')](_0x473fd0['query'][_0x38a7('0x36')]);}_0x326846[_0x38a7('0x37')]=qs[_0x38a7('0x38')](_0x473fd0[_0x38a7('0x30')]['sort']);_0x326846[_0x38a7('0x39')]=qs[_0x38a7('0x3a')](_[_0x38a7('0x3b')](_0x473fd0[_0x38a7('0x30')],_0x5d15cb[_0x38a7('0x3a')]),_0x300d9);if(_0x473fd0[_0x38a7('0x30')]['filter']){_0x326846[_0x38a7('0x39')]=_['merge'](_0x326846[_0x38a7('0x39')],{'$or':_['map'](_0x300d9,function(_0x19fd56){if(_0x19fd56[_0x38a7('0x2c')]!==_0x38a7('0x3c')){var _0x192a38={};_0x192a38[_0x19fd56['name']]={'$like':'%'+_0x473fd0['query']['filter']+'%'};return _0x192a38;}})});}_0x326846=_[_0x38a7('0x3d')]({},_0x326846,_0x473fd0[_0x38a7('0x3e')]);var _0x12ada6={'where':_0x326846[_0x38a7('0x39')]};return db['ChatQueueReport']['count'](_0x12ada6)[_0x38a7('0x22')](function(_0x53e515){_0x224c1d[_0x38a7('0x1a')]=_0x53e515;if(_0x473fd0['query']['includeAll']){_0x326846[_0x38a7('0x3f')]=[{'all':!![]}];}return db[_0x38a7('0x29')]['findAll'](_0x326846);})[_0x38a7('0x22')](function(_0xff9b8){_0x224c1d[_0x38a7('0x40')]=_0xff9b8;return _0x224c1d;})['then'](respondWithFilteredResult(_0x4ea226,_0x326846))[_0x38a7('0x41')](handleError(_0x4ea226,null));};exports['show']=function(_0x4d14c7,_0x27bc81){var _0x3e58af={'raw':!![],'where':{'id':_0x4d14c7[_0x38a7('0x42')]['id']}},_0x474bec={};_0x474bec[_0x38a7('0x2e')]=_[_0x38a7('0x2f')](db[_0x38a7('0x29')]['rawAttributes']);_0x474bec[_0x38a7('0x30')]=_['keys'](_0x4d14c7[_0x38a7('0x30')]);_0x474bec[_0x38a7('0x3a')]=_[_0x38a7('0x31')](_0x474bec[_0x38a7('0x2e')],_0x474bec['query']);_0x3e58af[_0x38a7('0x32')]=_[_0x38a7('0x31')](_0x474bec[_0x38a7('0x2e')],qs[_0x38a7('0x33')](_0x4d14c7['query']['fields']));_0x3e58af[_0x38a7('0x32')]=_0x3e58af[_0x38a7('0x32')][_0x38a7('0x34')]?_0x3e58af[_0x38a7('0x32')]:_0x474bec['model'];if(_0x4d14c7[_0x38a7('0x30')][_0x38a7('0x43')]){_0x3e58af['include']=[{'all':!![]}];}_0x3e58af=_[_0x38a7('0x3d')]({},_0x3e58af,_0x4d14c7['options']);return db['ChatQueueReport'][_0x38a7('0x44')](_0x3e58af)['then'](handleEntityNotFound(_0x27bc81,null))[_0x38a7('0x22')](respondWithResult(_0x27bc81,null))[_0x38a7('0x41')](handleError(_0x27bc81,null));};exports[_0x38a7('0x45')]=function(_0x37de9d,_0x2702c5){return db[_0x38a7('0x29')]['create'](_0x37de9d[_0x38a7('0x46')],{})[_0x38a7('0x22')](respondWithResult(_0x2702c5,0xc9))['catch'](handleError(_0x2702c5,null));};exports['update']=function(_0x26ab61,_0x127dc3){if(_0x26ab61[_0x38a7('0x46')]['id']){delete _0x26ab61[_0x38a7('0x46')]['id'];}return db[_0x38a7('0x29')]['find']({'where':{'id':_0x26ab61[_0x38a7('0x42')]['id']}})[_0x38a7('0x22')](handleEntityNotFound(_0x127dc3,null))[_0x38a7('0x22')](saveUpdates(_0x26ab61[_0x38a7('0x46')],null))[_0x38a7('0x22')](respondWithResult(_0x127dc3,null))['catch'](handleError(_0x127dc3,null));};exports['destroy']=function(_0x18ddf9,_0x350c49){return db['ChatQueueReport'][_0x38a7('0x44')]({'where':{'id':_0x18ddf9[_0x38a7('0x42')]['id']}})['then'](handleEntityNotFound(_0x350c49,null))[_0x38a7('0x22')](removeEntity(_0x350c49,null))[_0x38a7('0x41')](handleError(_0x350c49,null));};exports['describe']=function(_0x257c3,_0x52037a){return db[_0x38a7('0x29')][_0x38a7('0x47')]()[_0x38a7('0x22')](respondWithResult(_0x52037a,null))['catch'](handleError(_0x52037a,null));}; \ No newline at end of file +var _0x823f=['../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','catch','show','params','include','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x823f,0x161));var _0xf823=function(_0x5390a3,_0x4d60f7){_0x5390a3=_0x5390a3-0x0;var _0x45d220=_0x823f[_0x5390a3];return _0x45d220;};'use strict';var pdf=require(_0xf823('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf823('0x1'));var jsonpatch=require(_0xf823('0x2'));var rp=require(_0xf823('0x3'));var moment=require(_0xf823('0x4'));var BPromise=require(_0xf823('0x5'));var Mustache=require('mustache');var util=require(_0xf823('0x6'));var path=require(_0xf823('0x7'));var sox=require(_0xf823('0x8'));var csv=require(_0xf823('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf823('0xa'));var squel=require(_0xf823('0xb'));var crypto=require(_0xf823('0xc'));var jsforce=require(_0xf823('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf823('0x9'));var querystring=require(_0xf823('0xe'));var Papa=require(_0xf823('0xf'));var Redis=require('ioredis');var authService=require(_0xf823('0x10'));var qs=require(_0xf823('0x11'));var as=require(_0xf823('0x12'));var hardwareService=require(_0xf823('0x13'));var logger=require('../../config/logger')(_0xf823('0x14'));var utils=require(_0xf823('0x15'));var config=require(_0xf823('0x16'));var licenseUtil=require(_0xf823('0x17'));var db=require(_0xf823('0x18'))['db'];function respondWithStatusCode(_0x5b8ba9,_0x1a04a3){_0x1a04a3=_0x1a04a3||0xcc;return function(_0x3e676f){if(_0x3e676f){return _0x5b8ba9['sendStatus'](_0x1a04a3);}return _0x5b8ba9[_0xf823('0x19')](_0x1a04a3)[_0xf823('0x1a')]();};}function respondWithResult(_0x5ab1d0,_0x46d7db){_0x46d7db=_0x46d7db||0xc8;return function(_0x2e2795){if(_0x2e2795){return _0x5ab1d0['status'](_0x46d7db)['json'](_0x2e2795);}};}function respondWithFilteredResult(_0x56e99a,_0x3810d8){return function(_0x1f183b){if(_0x1f183b){var _0x1c00ca=_0x1f183b[_0xf823('0x1b')],_0x222b2f=_0x3810d8[_0xf823('0x1c')],_0x2bea02=_0x3810d8[_0xf823('0x1c')]+_0x3810d8[_0xf823('0x1d')],_0x2399c0;if(_0x2bea02>=_0x1c00ca){_0x2bea02=_0x1c00ca;_0x2399c0=0xc8;}else{_0x2399c0=0xce;}_0x56e99a[_0xf823('0x19')](_0x2399c0);return _0x56e99a[_0xf823('0x1e')](_0xf823('0x1f'),_0x222b2f+'-'+_0x2bea02+'/'+_0x1c00ca)[_0xf823('0x20')](_0x1f183b);}return null;};}function patchUpdates(_0x3cde30){return function(_0x20672c){try{jsonpatch['apply'](_0x20672c,_0x3cde30,!![]);}catch(_0x2373b4){return BPromise[_0xf823('0x21')](_0x2373b4);}return _0x20672c[_0xf823('0x22')]();};}function saveUpdates(_0x4a099e,_0x4ec5a7){return function(_0x122df6){if(_0x122df6){return _0x122df6[_0xf823('0x23')](_0x4a099e)['then'](function(_0x409da7){return _0x409da7;});}return null;};}function removeEntity(_0x2868b5,_0x3ca843){return function(_0x6bd316){if(_0x6bd316){return _0x6bd316[_0xf823('0x24')]()[_0xf823('0x25')](function(){_0x2868b5['status'](0xcc)[_0xf823('0x1a')]();});}};}function handleEntityNotFound(_0x394c92,_0x49f968){return function(_0x4e610a){if(!_0x4e610a){_0x394c92[_0xf823('0x26')](0x194);}return _0x4e610a;};}function handleError(_0x2a47d6,_0x5a236b){_0x5a236b=_0x5a236b||0x1f4;return function(_0xca43f3){logger[_0xf823('0x27')](_0xca43f3[_0xf823('0x28')]);if(_0xca43f3[_0xf823('0x29')]){delete _0xca43f3['name'];}_0x2a47d6[_0xf823('0x19')](_0x5a236b)['send'](_0xca43f3);};}exports[_0xf823('0x2a')]=function(_0x48d973,_0x561d90){var _0x2d90ad={},_0x5d0a53={},_0x545e2d={'count':0x0,'rows':[]};var _0x558e66=_[_0xf823('0x2b')](db[_0xf823('0x2c')][_0xf823('0x2d')],function(_0x322d40){return{'name':_0x322d40[_0xf823('0x2e')],'type':_0x322d40[_0xf823('0x2f')][_0xf823('0x30')]};});_0x5d0a53[_0xf823('0x31')]=_[_0xf823('0x2b')](_0x558e66,_0xf823('0x29'));_0x5d0a53[_0xf823('0x32')]=_[_0xf823('0x33')](_0x48d973[_0xf823('0x32')]);_0x5d0a53[_0xf823('0x34')]=_[_0xf823('0x35')](_0x5d0a53['model'],_0x5d0a53[_0xf823('0x32')]);_0x2d90ad[_0xf823('0x36')]=_[_0xf823('0x35')](_0x5d0a53[_0xf823('0x31')],qs[_0xf823('0x37')](_0x48d973[_0xf823('0x32')][_0xf823('0x37')]));_0x2d90ad[_0xf823('0x36')]=_0x2d90ad[_0xf823('0x36')][_0xf823('0x38')]?_0x2d90ad[_0xf823('0x36')]:_0x5d0a53[_0xf823('0x31')];if(!_0x48d973['query'][_0xf823('0x39')](_0xf823('0x3a'))){_0x2d90ad[_0xf823('0x1d')]=qs[_0xf823('0x1d')](_0x48d973[_0xf823('0x32')][_0xf823('0x1d')]);_0x2d90ad[_0xf823('0x1c')]=qs['offset'](_0x48d973[_0xf823('0x32')]['offset']);}_0x2d90ad[_0xf823('0x3b')]=qs[_0xf823('0x3c')](_0x48d973[_0xf823('0x32')][_0xf823('0x3c')]);_0x2d90ad[_0xf823('0x3d')]=qs[_0xf823('0x34')](_[_0xf823('0x3e')](_0x48d973['query'],_0x5d0a53[_0xf823('0x34')]),_0x558e66);if(_0x48d973['query']['filter']){_0x2d90ad['where']=_[_0xf823('0x3f')](_0x2d90ad[_0xf823('0x3d')],{'$or':_[_0xf823('0x2b')](_0x558e66,function(_0x93adb1){if(_0x93adb1[_0xf823('0x2f')]!==_0xf823('0x40')){var _0xe114={};_0xe114[_0x93adb1[_0xf823('0x29')]]={'$like':'%'+_0x48d973['query'][_0xf823('0x41')]+'%'};return _0xe114;}})});}_0x2d90ad=_[_0xf823('0x3f')]({},_0x2d90ad,_0x48d973['options']);var _0x19341f={'where':_0x2d90ad[_0xf823('0x3d')]};return db[_0xf823('0x2c')][_0xf823('0x1b')](_0x19341f)[_0xf823('0x25')](function(_0x3a1e29){_0x545e2d[_0xf823('0x1b')]=_0x3a1e29;if(_0x48d973[_0xf823('0x32')]['includeAll']){_0x2d90ad['include']=[{'all':!![]}];}return db[_0xf823('0x2c')][_0xf823('0x42')](_0x2d90ad);})[_0xf823('0x25')](function(_0x5a759e){_0x545e2d['rows']=_0x5a759e;return _0x545e2d;})[_0xf823('0x25')](respondWithFilteredResult(_0x561d90,_0x2d90ad))[_0xf823('0x43')](handleError(_0x561d90,null));};exports[_0xf823('0x44')]=function(_0xa93682,_0x2b11d4){var _0x2991f0={'raw':!![],'where':{'id':_0xa93682[_0xf823('0x45')]['id']}},_0x57cb5d={};_0x57cb5d['model']=_[_0xf823('0x33')](db[_0xf823('0x2c')]['rawAttributes']);_0x57cb5d['query']=_['keys'](_0xa93682[_0xf823('0x32')]);_0x57cb5d[_0xf823('0x34')]=_['intersection'](_0x57cb5d[_0xf823('0x31')],_0x57cb5d[_0xf823('0x32')]);_0x2991f0[_0xf823('0x36')]=_[_0xf823('0x35')](_0x57cb5d[_0xf823('0x31')],qs[_0xf823('0x37')](_0xa93682[_0xf823('0x32')][_0xf823('0x37')]));_0x2991f0[_0xf823('0x36')]=_0x2991f0['attributes'][_0xf823('0x38')]?_0x2991f0[_0xf823('0x36')]:_0x57cb5d[_0xf823('0x31')];if(_0xa93682[_0xf823('0x32')]['includeAll']){_0x2991f0[_0xf823('0x46')]=[{'all':!![]}];}_0x2991f0=_[_0xf823('0x3f')]({},_0x2991f0,_0xa93682['options']);return db[_0xf823('0x2c')][_0xf823('0x47')](_0x2991f0)['then'](handleEntityNotFound(_0x2b11d4,null))[_0xf823('0x25')](respondWithResult(_0x2b11d4,null))[_0xf823('0x43')](handleError(_0x2b11d4,null));};exports[_0xf823('0x48')]=function(_0x7d6da5,_0x2e57f7){return db['ChatQueueReport'][_0xf823('0x48')](_0x7d6da5[_0xf823('0x49')],{})[_0xf823('0x25')](respondWithResult(_0x2e57f7,0xc9))[_0xf823('0x43')](handleError(_0x2e57f7,null));};exports[_0xf823('0x23')]=function(_0x3e06b3,_0x2ae884){if(_0x3e06b3[_0xf823('0x49')]['id']){delete _0x3e06b3['body']['id'];}return db[_0xf823('0x2c')][_0xf823('0x47')]({'where':{'id':_0x3e06b3[_0xf823('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ae884,null))['then'](saveUpdates(_0x3e06b3[_0xf823('0x49')],null))['then'](respondWithResult(_0x2ae884,null))[_0xf823('0x43')](handleError(_0x2ae884,null));};exports[_0xf823('0x24')]=function(_0x41af96,_0x1b4796){return db[_0xf823('0x2c')][_0xf823('0x47')]({'where':{'id':_0x41af96[_0xf823('0x45')]['id']}})[_0xf823('0x25')](handleEntityNotFound(_0x1b4796,null))['then'](removeEntity(_0x1b4796,null))[_0xf823('0x43')](handleError(_0x1b4796,null));};exports[_0xf823('0x4a')]=function(_0x529c55,_0x47ef44){return db[_0xf823('0x2c')][_0xf823('0x4a')]()['then'](respondWithResult(_0x47ef44,null))[_0xf823('0x43')](handleError(_0x47ef44,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 0f016b9..c68d2f5 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdba=['uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbdba,0x187));var _0xabdb=function(_0x2e3459,_0x13b648){_0x2e3459=_0x2e3459-0x0;var _0x2d5e3d=_0xbdba[_0x2e3459];return _0x2d5e3d;};'use strict';var _=require('lodash');var util=require(_0xabdb('0x0'));var logger=require(_0xabdb('0x1'))(_0xabdb('0x2'));var moment=require(_0xabdb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabdb('0x4'));var rimraf=require(_0xabdb('0x5'));var config=require(_0xabdb('0x6'));var attributes=require(_0xabdb('0x7'));module[_0xabdb('0x8')]=function(_0x1d703a,_0x1232d6){return _0x1d703a[_0xabdb('0x9')](_0xabdb('0xa'),attributes,{'tableName':_0xabdb('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xabdb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf349=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','uniqueid','lodash'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xf349,0x1ee));var _0x9f34=function(_0xfd3d87,_0x10aa44){_0xfd3d87=_0xfd3d87-0x0;var _0x21fc4a=_0xf349[_0xfd3d87];return _0x21fc4a;};'use strict';var _=require(_0x9f34('0x0'));var util=require(_0x9f34('0x1'));var logger=require(_0x9f34('0x2'))(_0x9f34('0x3'));var moment=require(_0x9f34('0x4'));var BPromise=require(_0x9f34('0x5'));var rp=require(_0x9f34('0x6'));var fs=require('fs');var path=require(_0x9f34('0x7'));var rimraf=require(_0x9f34('0x8'));var config=require(_0x9f34('0x9'));var attributes=require(_0x9f34('0xa'));module[_0x9f34('0xb')]=function(_0x53fa0f,_0x1d555b){return _0x53fa0f[_0x9f34('0xc')](_0x9f34('0xd'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9f34('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1720294..1ca539e 100644 --- a/server/api/chatQueueReport/chatQueueReport.rpc.js +++ b/server/api/chatQueueReport/chatQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c67=['result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','body','attributes','limit','UpdateChatQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x2a22fd,_0x52af47){var _0x59ecca=function(_0x35a2ee){while(--_0x35a2ee){_0x2a22fd['push'](_0x2a22fd['shift']());}};_0x59ecca(++_0x52af47);}(_0x0c67,0xa7));var _0x70c6=function(_0xaa0bfc,_0x120ef7){_0xaa0bfc=_0xaa0bfc-0x0;var _0x1e48c9=_0x0c67[_0xaa0bfc];return _0x1e48c9;};'use strict';var _=require(_0x70c6('0x0'));var util=require(_0x70c6('0x1'));var moment=require(_0x70c6('0x2'));var BPromise=require(_0x70c6('0x3'));var rs=require(_0x70c6('0x4'));var fs=require('fs');var Redis=require(_0x70c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x70c6('0x6'))(_0x70c6('0x7'));var config=require(_0x70c6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70c6('0x9')][_0x70c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x355348,_0x562b5a,_0x7de986){return new BPromise(function(_0x42d3c6,_0x4f38ad){return client[_0x70c6('0xb')](_0x355348,_0x7de986)[_0x70c6('0xc')](function(_0x54697c){logger[_0x70c6('0xd')](_0x70c6('0xe'),_0x562b5a,'request\x20sent');logger[_0x70c6('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x562b5a,_0x70c6('0x10'),JSON['stringify'](_0x54697c));if(_0x54697c[_0x70c6('0x11')]){if(_0x54697c['error']['code']===0x1f4){logger[_0x70c6('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x562b5a,_0x54697c['error'][_0x70c6('0x12')]);return _0x4f38ad(_0x54697c[_0x70c6('0x11')]['message']);}logger[_0x70c6('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x562b5a,_0x54697c[_0x70c6('0x11')][_0x70c6('0x12')]);return _0x42d3c6(_0x54697c[_0x70c6('0x11')]['message']);}else{logger[_0x70c6('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x562b5a,_0x70c6('0x10'));_0x42d3c6(_0x54697c[_0x70c6('0x13')][_0x70c6('0x12')]);}})[_0x70c6('0x14')](function(_0x6e5e95){logger[_0x70c6('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x562b5a,_0x6e5e95);_0x4f38ad(_0x6e5e95);});});}exports[_0x70c6('0x15')]=function(_0x373117){var _0x44ff0c=this;return new Promise(function(_0x4852be,_0x3a136a){return db[_0x70c6('0x16')][_0x70c6('0x17')](_0x373117['body'],{'raw':_0x373117['options']?_0x373117[_0x70c6('0x18')][_0x70c6('0x19')]===undefined?!![]:![]:!![]})[_0x70c6('0xc')](function(_0x4040ef){logger[_0x70c6('0xd')](_0x70c6('0x15'),_0x373117);logger[_0x70c6('0xf')](_0x70c6('0x15'),_0x373117,JSON['stringify'](_0x4040ef));_0x4852be(_0x4040ef);})[_0x70c6('0x14')](function(_0x1fd9b2){logger['error'](_0x70c6('0x15'),_0x1fd9b2['message'],_0x373117);_0x3a136a(_0x44ff0c[_0x70c6('0x11')](0x1f4,_0x1fd9b2[_0x70c6('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x3d8a08){var _0x11e0f8=this;return new Promise(function(_0x5c84cb,_0x3fd040){return db[_0x70c6('0x16')]['update'](_0x3d8a08[_0x70c6('0x1a')],{'raw':_0x3d8a08[_0x70c6('0x18')]?_0x3d8a08[_0x70c6('0x18')][_0x70c6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d8a08[_0x70c6('0x18')]?_0x3d8a08[_0x70c6('0x18')]['where']||null:null,'attributes':_0x3d8a08[_0x70c6('0x18')]?_0x3d8a08[_0x70c6('0x18')][_0x70c6('0x1b')]||null:null,'limit':_0x3d8a08[_0x70c6('0x18')]?_0x3d8a08['options'][_0x70c6('0x1c')]||null:null})['then'](function(_0x512da0){logger[_0x70c6('0xd')](_0x70c6('0x1d'),_0x3d8a08);logger[_0x70c6('0xf')]('UpdateChatQueueReport',_0x3d8a08,JSON[_0x70c6('0x1e')](_0x512da0));_0x5c84cb(_0x512da0);})[_0x70c6('0x14')](function(_0xd318c){logger[_0x70c6('0x11')](_0x70c6('0x1d'),_0xd318c[_0x70c6('0x12')],_0x3d8a08);_0x3fd040(_0x11e0f8[_0x70c6('0x11')](0x1f4,_0xd318c[_0x70c6('0x12')]));});});}; \ No newline at end of file +var _0x92e5=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','attributes','limit'];(function(_0x54ed23,_0x137310){var _0x51df35=function(_0x16cc4e){while(--_0x16cc4e){_0x54ed23['push'](_0x54ed23['shift']());}};_0x51df35(++_0x137310);}(_0x92e5,0x17a));var _0x592e=function(_0x2a152f,_0x1bc9ce){_0x2a152f=_0x2a152f-0x0;var _0x3f4113=_0x92e5[_0x2a152f];return _0x3f4113;};'use strict';var _=require(_0x592e('0x0'));var util=require(_0x592e('0x1'));var moment=require('moment');var BPromise=require(_0x592e('0x2'));var rs=require(_0x592e('0x3'));var fs=require('fs');var Redis=require(_0x592e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x592e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x592e('0x6'));var client=jayson[_0x592e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x259660,_0x31ade9,_0x35f645){return new BPromise(function(_0x5534f9,_0x52e91c){return client['request'](_0x259660,_0x35f645)[_0x592e('0x8')](function(_0x4cf979){logger[_0x592e('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x31ade9,_0x592e('0xa'));logger[_0x592e('0xb')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x31ade9,'request\x20sent',JSON[_0x592e('0xc')](_0x4cf979));if(_0x4cf979['error']){if(_0x4cf979[_0x592e('0xd')][_0x592e('0xe')]===0x1f4){logger[_0x592e('0xd')](_0x592e('0xf'),_0x31ade9,_0x4cf979[_0x592e('0xd')][_0x592e('0x10')]);return _0x52e91c(_0x4cf979[_0x592e('0xd')]['message']);}logger[_0x592e('0xd')](_0x592e('0xf'),_0x31ade9,_0x4cf979['error'][_0x592e('0x10')]);return _0x5534f9(_0x4cf979['error'][_0x592e('0x10')]);}else{logger[_0x592e('0x9')](_0x592e('0xf'),_0x31ade9,_0x592e('0xa'));_0x5534f9(_0x4cf979['result']['message']);}})['catch'](function(_0x29d852){logger[_0x592e('0xd')](_0x592e('0xf'),_0x31ade9,_0x29d852);_0x52e91c(_0x29d852);});});}exports[_0x592e('0x11')]=function(_0x4fcc68){var _0x66532f=this;return new Promise(function(_0x335812,_0xfde0f7){return db[_0x592e('0x12')][_0x592e('0x13')](_0x4fcc68[_0x592e('0x14')],{'raw':_0x4fcc68[_0x592e('0x15')]?_0x4fcc68[_0x592e('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x143781){logger[_0x592e('0x9')](_0x592e('0x11'),_0x4fcc68);logger[_0x592e('0xb')](_0x592e('0x11'),_0x4fcc68,JSON[_0x592e('0xc')](_0x143781));_0x335812(_0x143781);})['catch'](function(_0x36bf64){logger[_0x592e('0xd')](_0x592e('0x11'),_0x36bf64['message'],_0x4fcc68);_0xfde0f7(_0x66532f[_0x592e('0xd')](0x1f4,_0x36bf64[_0x592e('0x10')]));});});};exports[_0x592e('0x16')]=function(_0x3d35d7){var _0x4cffa3=this;return new Promise(function(_0x182578,_0x4e92b5){return db[_0x592e('0x12')][_0x592e('0x17')](_0x3d35d7['body'],{'raw':_0x3d35d7[_0x592e('0x15')]?_0x3d35d7[_0x592e('0x15')][_0x592e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d35d7[_0x592e('0x15')]?_0x3d35d7[_0x592e('0x15')][_0x592e('0x19')]||null:null,'attributes':_0x3d35d7[_0x592e('0x15')]?_0x3d35d7['options'][_0x592e('0x1a')]||null:null,'limit':_0x3d35d7[_0x592e('0x15')]?_0x3d35d7[_0x592e('0x15')][_0x592e('0x1b')]||null:null})[_0x592e('0x8')](function(_0x17a43c){logger[_0x592e('0x9')](_0x592e('0x16'),_0x3d35d7);logger[_0x592e('0xb')]('UpdateChatQueueReport',_0x3d35d7,JSON['stringify'](_0x17a43c));_0x182578(_0x17a43c);})[_0x592e('0x1c')](function(_0xa72d8b){logger[_0x592e('0xd')](_0x592e('0x16'),_0xa72d8b[_0x592e('0x10')],_0x3d35d7);_0x4e92b5(_0x4cffa3[_0x592e('0xd')](0x1f4,_0xa72d8b[_0x592e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8b321d5..4c14c82 100644 --- a/server/api/chatQueueReport/index.js +++ b/server/api/chatQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4f4=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xf4f4,0x169));var _0x4f4f=function(_0x245801,_0x3d8556){_0x245801=_0x245801-0x0;var _0xbbe558=_0xf4f4[_0x245801];return _0xbbe558;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require('express');var router=express[_0x4f4f('0x3')]();var auth=require(_0x4f4f('0x4'));var interaction=require(_0x4f4f('0x5'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x6'));router['get']('/',auth[_0x4f4f('0x7')](),controller[_0x4f4f('0x8')]);router[_0x4f4f('0x9')](_0x4f4f('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x4f4f('0x9')](_0x4f4f('0xb'),auth[_0x4f4f('0x7')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xd')]('/',auth[_0x4f4f('0x7')](),controller['create']);router[_0x4f4f('0xe')](_0x4f4f('0xb'),auth['isAuthenticated'](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x10')](_0x4f4f('0xb'),auth[_0x4f4f('0x7')](),controller[_0x4f4f('0x11')]);module[_0x4f4f('0x12')]=router; \ No newline at end of file +var _0xe089=['path','connect-timeout','express','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xe089,0xc6));var _0x9e08=function(_0x3871be,_0x5ca3e8){_0x3871be=_0x3871be-0x0;var _0x4f460d=_0xe089[_0x3871be];return _0x4f460d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e08('0x0'));var timeout=require(_0x9e08('0x1'));var express=require(_0x9e08('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9e08('0x3'));var controller=require(_0x9e08('0x4'));router[_0x9e08('0x5')]('/',auth[_0x9e08('0x6')](),controller[_0x9e08('0x7')]);router[_0x9e08('0x5')](_0x9e08('0x8'),auth[_0x9e08('0x6')](),controller['describe']);router[_0x9e08('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x9e08('0x9')]);router[_0x9e08('0xa')]('/',auth[_0x9e08('0x6')](),controller[_0x9e08('0xb')]);router[_0x9e08('0xc')]('/:id',auth[_0x9e08('0x6')](),controller[_0x9e08('0xd')]);router[_0x9e08('0xe')](_0x9e08('0xf'),auth[_0x9e08('0x6')](),controller[_0x9e08('0x10')]);module[_0x9e08('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a571375..13d793e 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ea2=['moment','sequelize','ENUM','account','queue','DATE'];(function(_0x2ffcb1,_0x559b0d){var _0x333da2=function(_0x1430e2){while(--_0x1430e2){_0x2ffcb1['push'](_0x2ffcb1['shift']());}};_0x333da2(++_0x559b0d);}(_0x8ea2,0x162));var _0x28ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea2[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x28ea('0x0'));var Sequelize=require(_0x28ea('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x28ea('0x2')](_0x28ea('0x3'),'agent',_0x28ea('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x28ea('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xc24c=['STRING','ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x4f52c3,_0x58f7c8){var _0x15be4b=function(_0x5d6e35){while(--_0x5d6e35){_0x4f52c3['push'](_0x4f52c3['shift']());}};_0x15be4b(++_0x58f7c8);}(_0xc24c,0x18e));var _0xcc24=function(_0x425ea4,_0x10376d){_0x425ea4=_0x425ea4-0x0;var _0x2a7690=_0xc24c[_0x425ea4];return _0x2a7690;};'use strict';var moment=require(_0xcc24('0x0'));var Sequelize=require(_0xcc24('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcc24('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcc24('0x3')]('account',_0xcc24('0x4'),'queue'),'allowNull':![],'defaultValue':_0xcc24('0x5')},'transferredAt':{'type':Sequelize[_0xcc24('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xcc24('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index dc73e72..9f96060 100644 --- a/server/api/chatTransferReport/chatTransferReport.controller.js +++ b/server/api/chatTransferReport/chatTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95b5=['status','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','end','count','offset','limit'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x95b5,0x7a));var _0x595b=function(_0x3e0932,_0x3621ee){_0x3e0932=_0x3e0932-0x0;var _0x1b04aa=_0x95b5[_0x3e0932];return _0x1b04aa;};'use strict';var pdf=require(_0x595b('0x0'));var emlformat=require(_0x595b('0x1'));var rimraf=require(_0x595b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x595b('0x3'));var rp=require(_0x595b('0x4'));var moment=require(_0x595b('0x5'));var BPromise=require(_0x595b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x595b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x595b('0x8'));var squel=require('squel');var crypto=require(_0x595b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x595b('0xa'));var toCsv=require(_0x595b('0x7'));var querystring=require(_0x595b('0xb'));var Papa=require(_0x595b('0xc'));var Redis=require(_0x595b('0xd'));var authService=require(_0x595b('0xe'));var qs=require(_0x595b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x595b('0x10'))(_0x595b('0x11'));var utils=require(_0x595b('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x595b('0x13'))['db'];function respondWithStatusCode(_0x4dc806,_0x21ce50){_0x21ce50=_0x21ce50||0xcc;return function(_0x8985ea){if(_0x8985ea){return _0x4dc806['sendStatus'](_0x21ce50);}return _0x4dc806['status'](_0x21ce50)[_0x595b('0x14')]();};}function respondWithResult(_0x21daad,_0x3338e4){_0x3338e4=_0x3338e4||0xc8;return function(_0x5ee655){if(_0x5ee655){return _0x21daad['status'](_0x3338e4)['json'](_0x5ee655);}};}function respondWithFilteredResult(_0x595eff,_0x5eed7f){return function(_0x4ff99d){if(_0x4ff99d){var _0x12087e=_0x4ff99d[_0x595b('0x15')],_0x213da2=_0x5eed7f[_0x595b('0x16')],_0x563bcf=_0x5eed7f['offset']+_0x5eed7f[_0x595b('0x17')],_0xbdf5b0;if(_0x563bcf>=_0x12087e){_0x563bcf=_0x12087e;_0xbdf5b0=0xc8;}else{_0xbdf5b0=0xce;}_0x595eff[_0x595b('0x18')](_0xbdf5b0);return _0x595eff[_0x595b('0x19')](_0x595b('0x1a'),_0x213da2+'-'+_0x563bcf+'/'+_0x12087e)[_0x595b('0x1b')](_0x4ff99d);}return null;};}function patchUpdates(_0x290fcd){return function(_0x1de9a0){try{jsonpatch[_0x595b('0x1c')](_0x1de9a0,_0x290fcd,!![]);}catch(_0x147822){return BPromise[_0x595b('0x1d')](_0x147822);}return _0x1de9a0[_0x595b('0x1e')]();};}function saveUpdates(_0x4887fa,_0x43407f){return function(_0xa52680){if(_0xa52680){return _0xa52680[_0x595b('0x1f')](_0x4887fa)['then'](function(_0x4febde){return _0x4febde;});}return null;};}function removeEntity(_0x5b5c0d,_0x582bb0){return function(_0x302410){if(_0x302410){return _0x302410[_0x595b('0x20')]()[_0x595b('0x21')](function(){_0x5b5c0d['status'](0xcc)[_0x595b('0x14')]();});}};}function handleEntityNotFound(_0x1f41cd,_0x50369d){return function(_0x19f943){if(!_0x19f943){_0x1f41cd[_0x595b('0x22')](0x194);}return _0x19f943;};}function handleError(_0x5a63d,_0x4637ed){_0x4637ed=_0x4637ed||0x1f4;return function(_0x13737d){logger[_0x595b('0x23')](_0x13737d[_0x595b('0x24')]);if(_0x13737d[_0x595b('0x25')]){delete _0x13737d[_0x595b('0x25')];}_0x5a63d['status'](_0x4637ed)[_0x595b('0x26')](_0x13737d);};}exports['index']=function(_0x336b9e,_0x57086b){var _0x12bb5a={},_0x297210={},_0x52e597={'count':0x0,'rows':[]};var _0x1306b9=_[_0x595b('0x27')](db[_0x595b('0x28')][_0x595b('0x29')],function(_0x4df432){return{'name':_0x4df432[_0x595b('0x2a')],'type':_0x4df432['type'][_0x595b('0x2b')]};});_0x297210[_0x595b('0x2c')]=_[_0x595b('0x27')](_0x1306b9,_0x595b('0x25'));_0x297210[_0x595b('0x2d')]=_[_0x595b('0x2e')](_0x336b9e[_0x595b('0x2d')]);_0x297210[_0x595b('0x2f')]=_[_0x595b('0x30')](_0x297210[_0x595b('0x2c')],_0x297210[_0x595b('0x2d')]);_0x12bb5a[_0x595b('0x31')]=_['intersection'](_0x297210[_0x595b('0x2c')],qs[_0x595b('0x32')](_0x336b9e[_0x595b('0x2d')]['fields']));_0x12bb5a[_0x595b('0x31')]=_0x12bb5a['attributes'][_0x595b('0x33')]?_0x12bb5a['attributes']:_0x297210[_0x595b('0x2c')];if(!_0x336b9e[_0x595b('0x2d')][_0x595b('0x34')](_0x595b('0x35'))){_0x12bb5a[_0x595b('0x17')]=qs['limit'](_0x336b9e[_0x595b('0x2d')][_0x595b('0x17')]);_0x12bb5a[_0x595b('0x16')]=qs['offset'](_0x336b9e['query']['offset']);}_0x12bb5a[_0x595b('0x36')]=qs[_0x595b('0x37')](_0x336b9e['query'][_0x595b('0x37')]);_0x12bb5a[_0x595b('0x38')]=qs[_0x595b('0x2f')](_[_0x595b('0x39')](_0x336b9e[_0x595b('0x2d')],_0x297210[_0x595b('0x2f')]),_0x1306b9);if(_0x336b9e[_0x595b('0x2d')][_0x595b('0x3a')]){_0x12bb5a[_0x595b('0x38')]=_[_0x595b('0x3b')](_0x12bb5a[_0x595b('0x38')],{'$or':_[_0x595b('0x27')](_0x1306b9,function(_0x2a75e0){if(_0x2a75e0[_0x595b('0x3c')]!=='VIRTUAL'){var _0x3d57d5={};_0x3d57d5[_0x2a75e0[_0x595b('0x25')]]={'$like':'%'+_0x336b9e[_0x595b('0x2d')][_0x595b('0x3a')]+'%'};return _0x3d57d5;}})});}_0x12bb5a=_[_0x595b('0x3b')]({},_0x12bb5a,_0x336b9e[_0x595b('0x3d')]);var _0x582841={'where':_0x12bb5a[_0x595b('0x38')]};return db[_0x595b('0x28')]['count'](_0x582841)[_0x595b('0x21')](function(_0x181a10){_0x52e597[_0x595b('0x15')]=_0x181a10;if(_0x336b9e[_0x595b('0x2d')][_0x595b('0x3e')]){_0x12bb5a[_0x595b('0x3f')]=[{'all':!![]}];}return db[_0x595b('0x28')][_0x595b('0x40')](_0x12bb5a);})[_0x595b('0x21')](function(_0x14e3d1){_0x52e597[_0x595b('0x41')]=_0x14e3d1;return _0x52e597;})['then'](respondWithFilteredResult(_0x57086b,_0x12bb5a))[_0x595b('0x42')](handleError(_0x57086b,null));};exports[_0x595b('0x43')]=function(_0x5b29d1,_0x255e99){var _0xe0de1a={'raw':!![],'where':{'id':_0x5b29d1[_0x595b('0x44')]['id']}},_0x335f4e={};_0x335f4e['model']=_[_0x595b('0x2e')](db['ChatTransferReport'][_0x595b('0x29')]);_0x335f4e[_0x595b('0x2d')]=_[_0x595b('0x2e')](_0x5b29d1[_0x595b('0x2d')]);_0x335f4e[_0x595b('0x2f')]=_[_0x595b('0x30')](_0x335f4e[_0x595b('0x2c')],_0x335f4e[_0x595b('0x2d')]);_0xe0de1a[_0x595b('0x31')]=_[_0x595b('0x30')](_0x335f4e[_0x595b('0x2c')],qs[_0x595b('0x32')](_0x5b29d1[_0x595b('0x2d')][_0x595b('0x32')]));_0xe0de1a[_0x595b('0x31')]=_0xe0de1a['attributes'][_0x595b('0x33')]?_0xe0de1a[_0x595b('0x31')]:_0x335f4e['model'];if(_0x5b29d1[_0x595b('0x2d')][_0x595b('0x3e')]){_0xe0de1a[_0x595b('0x3f')]=[{'all':!![]}];}_0xe0de1a=_[_0x595b('0x3b')]({},_0xe0de1a,_0x5b29d1[_0x595b('0x3d')]);return db['ChatTransferReport'][_0x595b('0x45')](_0xe0de1a)[_0x595b('0x21')](handleEntityNotFound(_0x255e99,null))[_0x595b('0x21')](respondWithResult(_0x255e99,null))[_0x595b('0x42')](handleError(_0x255e99,null));};exports[_0x595b('0x46')]=function(_0x4068e8,_0x490711){return db[_0x595b('0x28')][_0x595b('0x46')](_0x4068e8[_0x595b('0x47')],{})[_0x595b('0x21')](respondWithResult(_0x490711,0xc9))['catch'](handleError(_0x490711,null));};exports[_0x595b('0x1f')]=function(_0x2e4560,_0x441fed){if(_0x2e4560['body']['id']){delete _0x2e4560[_0x595b('0x47')]['id'];}return db[_0x595b('0x28')]['find']({'where':{'id':_0x2e4560['params']['id']}})[_0x595b('0x21')](handleEntityNotFound(_0x441fed,null))['then'](saveUpdates(_0x2e4560[_0x595b('0x47')],null))[_0x595b('0x21')](respondWithResult(_0x441fed,null))[_0x595b('0x42')](handleError(_0x441fed,null));};exports['destroy']=function(_0x28cf35,_0x140934){return db[_0x595b('0x28')][_0x595b('0x45')]({'where':{'id':_0x28cf35[_0x595b('0x44')]['id']}})[_0x595b('0x21')](handleEntityNotFound(_0x140934,null))['then'](removeEntity(_0x140934,null))[_0x595b('0x42')](handleError(_0x140934,null));};exports[_0x595b('0x48')]=function(_0xd78198,_0xc57959){return db['ChatTransferReport'][_0x595b('0x48')]()[_0x595b('0x21')](respondWithResult(_0xc57959,null))['catch'](handleError(_0xc57959,null));}; \ No newline at end of file +var _0xdf71=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdf71,0xd2));var _0x1df7=function(_0x523d5b,_0x1808f0){_0x523d5b=_0x523d5b-0x0;var _0x4d5b4c=_0xdf71[_0x523d5b];return _0x4d5b4c;};'use strict';var pdf=require(_0x1df7('0x0'));var emlformat=require(_0x1df7('0x1'));var rimraf=require(_0x1df7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1df7('0x3'));var rp=require(_0x1df7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1df7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1df7('0x6'));var csv=require(_0x1df7('0x7'));var ejs=require(_0x1df7('0x8'));var fs=require('fs');var _=require(_0x1df7('0x9'));var squel=require('squel');var crypto=require(_0x1df7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1df7('0xb'));var toCsv=require(_0x1df7('0x7'));var querystring=require(_0x1df7('0xc'));var Papa=require(_0x1df7('0xd'));var Redis=require(_0x1df7('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1df7('0xf'));var hardwareService=require(_0x1df7('0x10'));var logger=require(_0x1df7('0x11'))(_0x1df7('0x12'));var utils=require(_0x1df7('0x13'));var config=require(_0x1df7('0x14'));var licenseUtil=require(_0x1df7('0x15'));var db=require(_0x1df7('0x16'))['db'];function respondWithStatusCode(_0x5187b7,_0x160f25){_0x160f25=_0x160f25||0xcc;return function(_0x4f8694){if(_0x4f8694){return _0x5187b7['sendStatus'](_0x160f25);}return _0x5187b7[_0x1df7('0x17')](_0x160f25)['end']();};}function respondWithResult(_0x41a8f8,_0x441d37){_0x441d37=_0x441d37||0xc8;return function(_0x408574){if(_0x408574){return _0x41a8f8[_0x1df7('0x17')](_0x441d37)[_0x1df7('0x18')](_0x408574);}};}function respondWithFilteredResult(_0x44e973,_0x5aa14a){return function(_0x3a6cc1){if(_0x3a6cc1){var _0x425442=_0x3a6cc1[_0x1df7('0x19')],_0x4c054a=_0x5aa14a['offset'],_0x2a55e4=_0x5aa14a['offset']+_0x5aa14a[_0x1df7('0x1a')],_0x2c4319;if(_0x2a55e4>=_0x425442){_0x2a55e4=_0x425442;_0x2c4319=0xc8;}else{_0x2c4319=0xce;}_0x44e973[_0x1df7('0x17')](_0x2c4319);return _0x44e973[_0x1df7('0x1b')](_0x1df7('0x1c'),_0x4c054a+'-'+_0x2a55e4+'/'+_0x425442)[_0x1df7('0x18')](_0x3a6cc1);}return null;};}function patchUpdates(_0x10f4cf){return function(_0x4b8a77){try{jsonpatch[_0x1df7('0x1d')](_0x4b8a77,_0x10f4cf,!![]);}catch(_0x53f19d){return BPromise[_0x1df7('0x1e')](_0x53f19d);}return _0x4b8a77['save']();};}function saveUpdates(_0x11c393,_0x46d868){return function(_0x385edb){if(_0x385edb){return _0x385edb[_0x1df7('0x1f')](_0x11c393)[_0x1df7('0x20')](function(_0x453903){return _0x453903;});}return null;};}function removeEntity(_0x595ccd,_0x18708d){return function(_0x4da20c){if(_0x4da20c){return _0x4da20c[_0x1df7('0x21')]()[_0x1df7('0x20')](function(){_0x595ccd[_0x1df7('0x17')](0xcc)[_0x1df7('0x22')]();});}};}function handleEntityNotFound(_0x379f44,_0x446810){return function(_0x3b0446){if(!_0x3b0446){_0x379f44['sendStatus'](0x194);}return _0x3b0446;};}function handleError(_0x50eda4,_0x1c102b){_0x1c102b=_0x1c102b||0x1f4;return function(_0x47ef19){logger[_0x1df7('0x23')](_0x47ef19['stack']);if(_0x47ef19['name']){delete _0x47ef19[_0x1df7('0x24')];}_0x50eda4['status'](_0x1c102b)[_0x1df7('0x25')](_0x47ef19);};}exports[_0x1df7('0x26')]=function(_0x35055b,_0x2b7aaa){var _0x12747b={},_0x50dfae={},_0x48e1e3={'count':0x0,'rows':[]};var _0x4e082d=_[_0x1df7('0x27')](db[_0x1df7('0x28')][_0x1df7('0x29')],function(_0x5a41ee){return{'name':_0x5a41ee['fieldName'],'type':_0x5a41ee[_0x1df7('0x2a')][_0x1df7('0x2b')]};});_0x50dfae[_0x1df7('0x2c')]=_[_0x1df7('0x27')](_0x4e082d,'name');_0x50dfae[_0x1df7('0x2d')]=_[_0x1df7('0x2e')](_0x35055b[_0x1df7('0x2d')]);_0x50dfae['filters']=_[_0x1df7('0x2f')](_0x50dfae[_0x1df7('0x2c')],_0x50dfae[_0x1df7('0x2d')]);_0x12747b[_0x1df7('0x30')]=_[_0x1df7('0x2f')](_0x50dfae[_0x1df7('0x2c')],qs[_0x1df7('0x31')](_0x35055b['query'][_0x1df7('0x31')]));_0x12747b['attributes']=_0x12747b[_0x1df7('0x30')][_0x1df7('0x32')]?_0x12747b[_0x1df7('0x30')]:_0x50dfae[_0x1df7('0x2c')];if(!_0x35055b[_0x1df7('0x2d')][_0x1df7('0x33')](_0x1df7('0x34'))){_0x12747b[_0x1df7('0x1a')]=qs['limit'](_0x35055b[_0x1df7('0x2d')][_0x1df7('0x1a')]);_0x12747b[_0x1df7('0x35')]=qs['offset'](_0x35055b[_0x1df7('0x2d')][_0x1df7('0x35')]);}_0x12747b[_0x1df7('0x36')]=qs['sort'](_0x35055b[_0x1df7('0x2d')][_0x1df7('0x37')]);_0x12747b[_0x1df7('0x38')]=qs[_0x1df7('0x39')](_['pick'](_0x35055b['query'],_0x50dfae[_0x1df7('0x39')]),_0x4e082d);if(_0x35055b[_0x1df7('0x2d')][_0x1df7('0x3a')]){_0x12747b[_0x1df7('0x38')]=_[_0x1df7('0x3b')](_0x12747b[_0x1df7('0x38')],{'$or':_[_0x1df7('0x27')](_0x4e082d,function(_0x1132b3){if(_0x1132b3['type']!=='VIRTUAL'){var _0x1d4ebd={};_0x1d4ebd[_0x1132b3['name']]={'$like':'%'+_0x35055b[_0x1df7('0x2d')][_0x1df7('0x3a')]+'%'};return _0x1d4ebd;}})});}_0x12747b=_['merge']({},_0x12747b,_0x35055b[_0x1df7('0x3c')]);var _0xcce1d8={'where':_0x12747b['where']};return db[_0x1df7('0x28')][_0x1df7('0x19')](_0xcce1d8)['then'](function(_0x1c0f07){_0x48e1e3[_0x1df7('0x19')]=_0x1c0f07;if(_0x35055b[_0x1df7('0x2d')][_0x1df7('0x3d')]){_0x12747b[_0x1df7('0x3e')]=[{'all':!![]}];}return db[_0x1df7('0x28')][_0x1df7('0x3f')](_0x12747b);})[_0x1df7('0x20')](function(_0x1ca74c){_0x48e1e3['rows']=_0x1ca74c;return _0x48e1e3;})[_0x1df7('0x20')](respondWithFilteredResult(_0x2b7aaa,_0x12747b))[_0x1df7('0x40')](handleError(_0x2b7aaa,null));};exports['show']=function(_0x53996d,_0x530a85){var _0x5d3085={'raw':!![],'where':{'id':_0x53996d[_0x1df7('0x41')]['id']}},_0x346f90={};_0x346f90[_0x1df7('0x2c')]=_[_0x1df7('0x2e')](db[_0x1df7('0x28')]['rawAttributes']);_0x346f90['query']=_[_0x1df7('0x2e')](_0x53996d[_0x1df7('0x2d')]);_0x346f90[_0x1df7('0x39')]=_['intersection'](_0x346f90[_0x1df7('0x2c')],_0x346f90['query']);_0x5d3085[_0x1df7('0x30')]=_[_0x1df7('0x2f')](_0x346f90[_0x1df7('0x2c')],qs[_0x1df7('0x31')](_0x53996d[_0x1df7('0x2d')][_0x1df7('0x31')]));_0x5d3085[_0x1df7('0x30')]=_0x5d3085[_0x1df7('0x30')][_0x1df7('0x32')]?_0x5d3085[_0x1df7('0x30')]:_0x346f90[_0x1df7('0x2c')];if(_0x53996d[_0x1df7('0x2d')][_0x1df7('0x3d')]){_0x5d3085['include']=[{'all':!![]}];}_0x5d3085=_['merge']({},_0x5d3085,_0x53996d[_0x1df7('0x3c')]);return db[_0x1df7('0x28')][_0x1df7('0x42')](_0x5d3085)[_0x1df7('0x20')](handleEntityNotFound(_0x530a85,null))[_0x1df7('0x20')](respondWithResult(_0x530a85,null))[_0x1df7('0x40')](handleError(_0x530a85,null));};exports[_0x1df7('0x43')]=function(_0x44246f,_0x370b25){return db[_0x1df7('0x28')][_0x1df7('0x43')](_0x44246f[_0x1df7('0x44')],{})[_0x1df7('0x20')](respondWithResult(_0x370b25,0xc9))[_0x1df7('0x40')](handleError(_0x370b25,null));};exports[_0x1df7('0x1f')]=function(_0x2e7718,_0x64bebc){if(_0x2e7718['body']['id']){delete _0x2e7718['body']['id'];}return db[_0x1df7('0x28')][_0x1df7('0x42')]({'where':{'id':_0x2e7718[_0x1df7('0x41')]['id']}})[_0x1df7('0x20')](handleEntityNotFound(_0x64bebc,null))[_0x1df7('0x20')](saveUpdates(_0x2e7718[_0x1df7('0x44')],null))[_0x1df7('0x20')](respondWithResult(_0x64bebc,null))[_0x1df7('0x40')](handleError(_0x64bebc,null));};exports[_0x1df7('0x21')]=function(_0x1cff29,_0x13b3ce){return db['ChatTransferReport'][_0x1df7('0x42')]({'where':{'id':_0x1cff29[_0x1df7('0x41')]['id']}})[_0x1df7('0x20')](handleEntityNotFound(_0x13b3ce,null))['then'](removeEntity(_0x13b3ce,null))[_0x1df7('0x40')](handleError(_0x13b3ce,null));};exports[_0x1df7('0x45')]=function(_0x41e05c,_0x59bcc1){return db[_0x1df7('0x28')]['describe']()[_0x1df7('0x20')](respondWithResult(_0x59bcc1,null))[_0x1df7('0x40')](handleError(_0x59bcc1,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 7daae2e..5a313e0 100644 --- a/server/api/chatTransferReport/chatTransferReport.model.js +++ b/server/api/chatTransferReport/chatTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0941=['rimraf','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','path'];(function(_0x25cff8,_0x1b07b9){var _0x2869a2=function(_0x2cd956){while(--_0x2cd956){_0x25cff8['push'](_0x25cff8['shift']());}};_0x2869a2(++_0x1b07b9);}(_0x0941,0x165));var _0x1094=function(_0x1d8323,_0x2393bf){_0x1d8323=_0x1d8323-0x0;var _0x4991d9=_0x0941[_0x1d8323];return _0x4991d9;};'use strict';var _=require(_0x1094('0x0'));var util=require(_0x1094('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1094('0x2'));var BPromise=require(_0x1094('0x3'));var rp=require(_0x1094('0x4'));var fs=require('fs');var path=require(_0x1094('0x5'));var rimraf=require(_0x1094('0x6'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x1c48eb,_0x5bfe7f){return _0x1c48eb[_0x1094('0x7')](_0x1094('0x8'),attributes,{'tableName':_0x1094('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1094('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb09=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x33a779,_0x4d6e39){var _0x22f24f=function(_0x582b84){while(--_0x582b84){_0x33a779['push'](_0x33a779['shift']());}};_0x22f24f(++_0x4d6e39);}(_0xfb09,0x19d));var _0x9fb0=function(_0x159ec6,_0x42ff9a){_0x159ec6=_0x159ec6-0x0;var _0x337b21=_0xfb09[_0x159ec6];return _0x337b21;};'use strict';var _=require(_0x9fb0('0x0'));var util=require('util');var logger=require(_0x9fb0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9fb0('0x2'));var rp=require(_0x9fb0('0x3'));var fs=require('fs');var path=require(_0x9fb0('0x4'));var rimraf=require('rimraf');var config=require(_0x9fb0('0x5'));var attributes=require(_0x9fb0('0x6'));module['exports']=function(_0x3bad46,_0x19b030){return _0x3bad46['define'](_0x9fb0('0x7'),attributes,{'tableName':_0x9fb0('0x8'),'paranoid':![],'indexes':[{'name':_0x9fb0('0x9'),'fields':[_0x9fb0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8ea5de1..9789e04 100644 --- a/server/api/chatTransferReport/chatTransferReport.rpc.js +++ b/server/api/chatTransferReport/chatTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa702=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','then'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa702,0x1ae));var _0x2a70=function(_0x4ffb26,_0x559252){_0x4ffb26=_0x4ffb26-0x0;var _0x4aa378=_0xa702[_0x4ffb26];return _0x4aa378;};'use strict';var _=require(_0x2a70('0x0'));var util=require(_0x2a70('0x1'));var moment=require(_0x2a70('0x2'));var BPromise=require(_0x2a70('0x3'));var rs=require(_0x2a70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a70('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a70('0x6'));var config=require('../../config/environment');var jayson=require(_0x2a70('0x7'));var client=jayson[_0x2a70('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e5a2,_0x26a166,_0x261c54){return new BPromise(function(_0x51e726,_0x768a34){return client['request'](_0x54e5a2,_0x261c54)[_0x2a70('0x9')](function(_0x3f3a15){logger[_0x2a70('0xa')](_0x2a70('0xb'),_0x26a166,_0x2a70('0xc'));logger[_0x2a70('0xd')](_0x2a70('0xe'),_0x26a166,_0x2a70('0xc'),JSON[_0x2a70('0xf')](_0x3f3a15));if(_0x3f3a15[_0x2a70('0x10')]){if(_0x3f3a15[_0x2a70('0x10')][_0x2a70('0x11')]===0x1f4){logger['error'](_0x2a70('0xb'),_0x26a166,_0x3f3a15[_0x2a70('0x10')][_0x2a70('0x12')]);return _0x768a34(_0x3f3a15[_0x2a70('0x10')][_0x2a70('0x12')]);}logger['error'](_0x2a70('0xb'),_0x26a166,_0x3f3a15[_0x2a70('0x10')]['message']);return _0x51e726(_0x3f3a15[_0x2a70('0x10')][_0x2a70('0x12')]);}else{logger['info'](_0x2a70('0xb'),_0x26a166,_0x2a70('0xc'));_0x51e726(_0x3f3a15['result']['message']);}})[_0x2a70('0x13')](function(_0x450273){logger[_0x2a70('0x10')](_0x2a70('0xb'),_0x26a166,_0x450273);_0x768a34(_0x450273);});});} \ No newline at end of file +var _0xc4bc=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc4bc,0x1e2));var _0xcc4b=function(_0x3514db,_0x17706d){_0x3514db=_0x3514db-0x0;var _0x34f65d=_0xc4bc[_0x3514db];return _0x34f65d;};'use strict';var _=require(_0xcc4b('0x0'));var util=require('util');var moment=require(_0xcc4b('0x1'));var BPromise=require(_0xcc4b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc4b('0x3'));var db=require(_0xcc4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc4b('0x5'))(_0xcc4b('0x6'));var config=require('../../config/environment');var jayson=require(_0xcc4b('0x7'));var client=jayson[_0xcc4b('0x8')][_0xcc4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28e541,_0x5504e0,_0x8e1b01){return new BPromise(function(_0x4694bd,_0x357438){return client['request'](_0x28e541,_0x8e1b01)[_0xcc4b('0xa')](function(_0x4be97b){logger[_0xcc4b('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x5504e0,'request\x20sent');logger[_0xcc4b('0xc')](_0xcc4b('0xd'),_0x5504e0,_0xcc4b('0xe'),JSON[_0xcc4b('0xf')](_0x4be97b));if(_0x4be97b[_0xcc4b('0x10')]){if(_0x4be97b['error'][_0xcc4b('0x11')]===0x1f4){logger[_0xcc4b('0x10')](_0xcc4b('0x12'),_0x5504e0,_0x4be97b[_0xcc4b('0x10')][_0xcc4b('0x13')]);return _0x357438(_0x4be97b[_0xcc4b('0x10')][_0xcc4b('0x13')]);}logger[_0xcc4b('0x10')](_0xcc4b('0x12'),_0x5504e0,_0x4be97b[_0xcc4b('0x10')]['message']);return _0x4694bd(_0x4be97b[_0xcc4b('0x10')][_0xcc4b('0x13')]);}else{logger[_0xcc4b('0xb')](_0xcc4b('0x12'),_0x5504e0,_0xcc4b('0xe'));_0x4694bd(_0x4be97b[_0xcc4b('0x14')][_0xcc4b('0x13')]);}})[_0xcc4b('0x15')](function(_0x48cddc){logger[_0xcc4b('0x10')](_0xcc4b('0x12'),_0x5504e0,_0x48cddc);_0x357438(_0x48cddc);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a1ca34f..6c5d045 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1a30e5,_0x424172){var _0x412337=function(_0x541594){while(--_0x541594){_0x1a30e5['push'](_0x1a30e5['shift']());}};_0x412337(++_0x424172);}(_0x5f2f,0x73));var _0xf5f2=function(_0x360554,_0x426254){_0x360554=_0x360554-0x0;var _0xf15052=_0x5f2f[_0x360554];return _0xf15052;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x391325,_0x171dd9){var _0x439160=function(_0x5aa314){while(--_0x5aa314){_0x391325['push'](_0x391325['shift']());}};_0x439160(++_0x171dd9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb7e7[_0x1f9f37];return _0x21c080;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 696078b..d9a7abb 100644 --- a/server/api/chatWebsite/chatWebsite.attributes.js +++ b/server/api/chatWebsite/chatWebsite.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa63f=['star','thumb','stringify','name','text','input','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa63f,0x1b6));var _0xfa63=function(_0x4a1e96,_0x143e6b){_0x4a1e96=_0x4a1e96-0x0;var _0x5acea9=_0xa63f[_0x4a1e96];return _0x5acea9;};'use strict';var Sequelize=require(_0xfa63('0x0'));var rs=require(_0xfa63('0x1'));module[_0xfa63('0x2')]={'name':{'type':Sequelize[_0xfa63('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xfa63('0x3')],'allowNull':![],'unique':_0xfa63('0x4')},'description':{'type':Sequelize[_0xfa63('0x3')]},'mapKey':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x5')},'mapKeyOffline':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x6')},'customerAlias':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xfa63('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xfa63('0x3')],'allowNull':![],'defaultValue':_0xfa63('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xfa63('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xfa63('0xa'),'squared'),'defaultValue':_0xfa63('0xa')},'header_online':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0xb')},'start_chat_button':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0xc')},'offline_chat_button':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0xd')},'header_offline':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xfa63('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xfa63('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xfa63('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x11')},'noteTitle':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x12')},'placeholderMessage':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xfa63('0x14')},'closingMessageButton':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0xd')},'skipMessageButton':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0xfa63('0x15'),_0xfa63('0x16')),'defaultValue':_0xfa63('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xfa63('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xfa63('0xf')],'defaultValue':function(){return JSON[_0xfa63('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xfa63('0x18'),'type':_0xfa63('0x19'),'required':!![]},'props':{'title':_0xfa63('0x18'),'helpText':''}},{'type':_0xfa63('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xfa63('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xfa63('0x1b')]('onlineForm')?JSON['parse'](this[_0xfa63('0x1b')](_0xfa63('0x1c'))):{};},'set':function(_0x4e1ec2){return this[_0xfa63('0x1d')]('onlineForm',JSON[_0xfa63('0x17')](_0x4e1ec2));}},'offlineForm':{'type':Sequelize[_0xfa63('0xf')],'defaultValue':function(){return JSON[_0xfa63('0x17')]({'items':[{'type':_0xfa63('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xfa63('0x5'),'type':_0xfa63('0x5')},'variable':null},{'type':_0xfa63('0x1e'),'config':{'placeholder':_0xfa63('0x1f')},'props':{'title':'Comments','helpText':_0xfa63('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xfa63('0x1b')](_0xfa63('0x21'))?JSON[_0xfa63('0x22')](this[_0xfa63('0x1b')](_0xfa63('0x21'))):{};},'set':function(_0x2c714d){return this[_0xfa63('0x1d')](_0xfa63('0x21'),JSON[_0xfa63('0x17')](_0x2c714d));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xfa63('0x23')]();}},'autoclose':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x24')},'waitingMessage':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x26')},'offlineMessageBody':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x28')},'skipUnmanaged':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x29')},'sendUnmanaged':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xfa63('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xfa63('0x3')]},'notificationTemplate':{'type':Sequelize[_0xfa63('0xf')],'defaultValue':function(){return _0xfa63('0x2a');}},'notificationSound':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':_0xfa63('0x2b')},'verticalAlignment':{'type':Sequelize[_0xfa63('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xfa63('0x2c')},'defaultTitle':{'type':Sequelize[_0xfa63('0x3')]},'customerAvatar':{'type':Sequelize[_0xfa63('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfa63('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfa63('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfa63('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xfa63('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfa63('0x8')],'comment':_0xfa63('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfa63('0x30'),'set':function(_0x3b40e6){if(!_0x3b40e6)this[_0xfa63('0x1d')](_0xfa63('0x31'),null);this[_0xfa63('0x1d')](_0xfa63('0x32'),_0x3b40e6);}},'vidaooEscalation':{'type':Sequelize[_0xfa63('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd24d=['website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xbda624,_0xcc2832){var _0x5470cc=function(_0x680f24){while(--_0x680f24){_0xbda624['push'](_0xbda624['shift']());}};_0x5470cc(++_0xcc2832);}(_0xd24d,0x168));var _0xdd24=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd24d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xdd24('0x0'));var rs=require(_0xdd24('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'unique':_0xdd24('0x3')},'description':{'type':Sequelize[_0xdd24('0x2')]},'mapKey':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x4')},'mapKeyOffline':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0x5')},'customerAlias':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'defaultValue':_0xdd24('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'defaultValue':_0xdd24('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdd24('0x2')]},'animation':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdd24('0x9')]('rounded','squared'),'defaultValue':_0xdd24('0xa')},'header_online':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0xb')},'start_chat_button':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0xd')},'download_transcript':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdd24('0xe')]},'closingQuestion':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0xdd24('0x11'),_0xdd24('0x12')),'defaultValue':_0xdd24('0x11')},'ratingStarsNumber':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xdd24('0x13')]({'items':[{'type':_0xdd24('0x14'),'variable':null,'config':{'placeholder':_0xdd24('0x15'),'type':_0xdd24('0x16'),'required':!![]},'props':{'title':_0xdd24('0x15'),'helpText':''}},{'type':_0xdd24('0x14'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xdd24('0x4'),'type':_0xdd24('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdd24('0x17')](_0xdd24('0x18'))?JSON[_0xdd24('0x19')](this[_0xdd24('0x17')](_0xdd24('0x18'))):{};},'set':function(_0x5391a0){return this[_0xdd24('0x1a')](_0xdd24('0x18'),JSON['stringify'](_0x5391a0));}},'offlineForm':{'type':Sequelize[_0xdd24('0xe')],'defaultValue':function(){return JSON[_0xdd24('0x13')]({'items':[{'type':_0xdd24('0x14'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xdd24('0x4')},'variable':null},{'type':_0xdd24('0x1b'),'config':{'placeholder':_0xdd24('0x1c')},'props':{'title':_0xdd24('0x1c'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xdd24('0x17')](_0xdd24('0x1d'))?JSON[_0xdd24('0x19')](this[_0xdd24('0x17')](_0xdd24('0x1d'))):{};},'set':function(_0x4c5afc){return this[_0xdd24('0x1a')](_0xdd24('0x1d'),JSON[_0xdd24('0x13')](_0x4c5afc));}},'token':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdd24('0x2')]},'forwardOffline':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdd24('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0x1e')},'offlineMessageSubject':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x1f')},'offlineMessageBody':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x20')},'enableUnmanagedNote':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0x21')},'skipUnmanaged':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x22')},'sendUnmanaged':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdd24('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdd24('0x2')]},'notificationTemplate':{'type':Sequelize[_0xdd24('0xe')],'defaultValue':function(){return _0xdd24('0x23');}},'notificationSound':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x24')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0x25')},'verticalAlignment':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x26')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'defaultValue':_0xdd24('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdd24('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdd24('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x28')},'systemAvatar':{'type':Sequelize[_0xdd24('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdd24('0x7')],'comment':_0xdd24('0x29')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdd24('0x2a'),'set':function(_0xbeb82c){if(!_0xbeb82c)this[_0xdd24('0x1a')]('mandatoryDispositionPauseId',null);this[_0xdd24('0x1a')](_0xdd24('0x2b'),_0xbeb82c);}},'vidaooEscalation':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 5ab770b..42f8b61 100644 --- a/server/api/chatWebsite/chatWebsite.controller.js +++ b/server/api/chatWebsite/chatWebsite.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x445e=['CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','priority','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','notify','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','user','offlineMessageSubject','addInteraction','omit','Contact','Owner','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','some','server/files/chat/iframe.js','remote','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','textColor','addApplications','sequelize','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','request','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','then','destroy','get','ChatWebsites','stack','name','send','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','getAnswers','CannedAnswer','sitepic','file','filename','addSystemAvatar','systemAvatar','join','root','getLicense','custom','isNil','existsSync','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','headers','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x445e,0x192));var _0xe445=function(_0x340b5f,_0x1dabc7){_0x340b5f=_0x340b5f-0x0;var _0x150ddf=_0x445e[_0x340b5f];return _0x150ddf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe445('0x0'));var rimraf=require(_0xe445('0x1'));var zipdir=require(_0xe445('0x2'));var jsonpatch=require(_0xe445('0x3'));var rp=require(_0xe445('0x4'));var moment=require(_0xe445('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe445('0x6'));var path=require('path');var sox=require(_0xe445('0x7'));var csv=require(_0xe445('0x8'));var ejs=require(_0xe445('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe445('0xa'));var crypto=require('crypto');var jsforce=require(_0xe445('0xb'));var deskjs=require(_0xe445('0xc'));var toCsv=require(_0xe445('0x8'));var querystring=require('querystring');var Papa=require(_0xe445('0xd'));var Redis=require(_0xe445('0xe'));var authService=require(_0xe445('0xf'));var qs=require(_0xe445('0x10'));var as=require(_0xe445('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe445('0x12'))(_0xe445('0x13'));var utils=require(_0xe445('0x14'));var config=require(_0xe445('0x15'));var licenseUtil=require(_0xe445('0x16'));var db=require(_0xe445('0x17'))['db'];config[_0xe445('0x18')]=_[_0xe445('0x19')](config[_0xe445('0x18')],{'host':_0xe445('0x1a'),'port':0x18eb});var socket=require(_0xe445('0x1b'))(new Redis(config['redis']));require(_0xe445('0x1c'))[_0xe445('0x1d')](socket);var jayson=require(_0xe445('0x1e'));var client=jayson['client'][_0xe445('0x1f')]({'port':0x232c});var client9002=jayson[_0xe445('0x20')][_0xe445('0x1f')]({'port':0x232a});var client9003=jayson['client'][_0xe445('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x3fcd67,_0x3df87d,_0x3ccdde,_0x5b1de5){return new BPromise(function(_0x2e863a,_0x139d98){var _0x1dca4a=_0x5b1de5||client;return _0x1dca4a[_0xe445('0x21')](_0x3fcd67,_0x3ccdde)['then'](function(_0x3ebc3d){logger[_0xe445('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x3df87d,'request\x20sent');logger[_0xe445('0x23')](_0xe445('0x24'),_0x3df87d,_0xe445('0x25'),JSON[_0xe445('0x26')](_0x3ebc3d));if(_0x3ebc3d[_0xe445('0x27')]){if(_0x3ebc3d[_0xe445('0x27')][_0xe445('0x28')]===0x1f4){logger[_0xe445('0x27')](_0xe445('0x29'),_0x3df87d,_0x3ebc3d[_0xe445('0x27')]['message']);return _0x139d98(_0x3ebc3d[_0xe445('0x27')][_0xe445('0x2a')]);}logger[_0xe445('0x27')](_0xe445('0x29'),_0x3df87d,_0x3ebc3d[_0xe445('0x27')][_0xe445('0x2a')]);return _0x2e863a(_0x3ebc3d[_0xe445('0x27')]['message']);}else{logger[_0xe445('0x22')](_0xe445('0x29'),_0x3df87d,_0xe445('0x25'));_0x2e863a(_0x3ebc3d[_0xe445('0x2b')]['message']);}})[_0xe445('0x2c')](function(_0x72a358){logger['error'](_0xe445('0x29'),_0x3df87d,_0x72a358);_0x139d98(_0x72a358);});});}function respondWithStatusCode(_0x107899,_0xbe28d){_0xbe28d=_0xbe28d||0xcc;return function(_0x3eb927){if(_0x3eb927){return _0x107899[_0xe445('0x2d')](_0xbe28d);}return _0x107899[_0xe445('0x2e')](_0xbe28d)[_0xe445('0x2f')]();};}function respondWithResult(_0x313287,_0x5f1d9c){_0x5f1d9c=_0x5f1d9c||0xc8;return function(_0x3999e6){if(_0x3999e6){return _0x313287['status'](_0x5f1d9c)[_0xe445('0x30')](_0x3999e6);}};}function respondWithFilteredResult(_0xd4291e,_0x5d266c){return function(_0x17a306){if(_0x17a306){var _0x318e35=_0x17a306[_0xe445('0x31')],_0x39b37f=_0x5d266c[_0xe445('0x32')],_0x1a23d2=_0x5d266c[_0xe445('0x32')]+_0x5d266c[_0xe445('0x33')],_0xdf52b7;if(_0x1a23d2>=_0x318e35){_0x1a23d2=_0x318e35;_0xdf52b7=0xc8;}else{_0xdf52b7=0xce;}_0xd4291e[_0xe445('0x2e')](_0xdf52b7);return _0xd4291e[_0xe445('0x34')](_0xe445('0x35'),_0x39b37f+'-'+_0x1a23d2+'/'+_0x318e35)['json'](_0x17a306);}return null;};}function patchUpdates(_0x1780e9){return function(_0x246c87){try{jsonpatch[_0xe445('0x36')](_0x246c87,_0x1780e9,!![]);}catch(_0x1738ca){return BPromise['reject'](_0x1738ca);}return _0x246c87['save']();};}function saveUpdates(_0xb9903d,_0x5e4dcd){return function(_0x320c31){if(_0x320c31){return _0x320c31['update'](_0xb9903d)[_0xe445('0x37')](function(_0xd8597a){return _0xd8597a;});}return null;};}function removeEntity(_0x2d2343,_0x3fde3f){return function(_0x8d78dd){if(_0x8d78dd){return _0x8d78dd[_0xe445('0x38')]()[_0xe445('0x37')](function(){var _0x34c3e4=_0x8d78dd[_0xe445('0x39')]({'plain':!![]});var _0x54ce9c=_0xe445('0x3a');return db['UserProfileResource'][_0xe445('0x38')]({'where':{'type':_0x54ce9c,'resourceId':_0x34c3e4['id']}})[_0xe445('0x37')](function(){return _0x8d78dd;});})['then'](function(){_0x2d2343[_0xe445('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x879c32,_0x22f5a7){return function(_0x363a83){if(!_0x363a83){_0x879c32[_0xe445('0x2d')](0x194);}return _0x363a83;};}function handleError(_0x45aecf,_0x48ad6b){_0x48ad6b=_0x48ad6b||0x1f4;return function(_0x507663){logger[_0xe445('0x27')](_0x507663[_0xe445('0x3b')]);if(_0x507663[_0xe445('0x3c')]){delete _0x507663[_0xe445('0x3c')];}_0x45aecf[_0xe445('0x2e')](_0x48ad6b)[_0xe445('0x3d')](_0x507663);};}exports['index']=function(_0x4248db,_0x2841c1){var _0x9a5251={'include':[{'model':db[_0xe445('0x3e')],'as':_0xe445('0x3f')}]},_0x4d92ff={},_0x555f25={'count':0x0,'rows':[]};var _0x4e6ed7=_['map'](db[_0xe445('0x40')][_0xe445('0x41')],function(_0x7dc35e){return{'name':_0x7dc35e[_0xe445('0x42')],'type':_0x7dc35e[_0xe445('0x43')][_0xe445('0x44')]};});_0x4d92ff[_0xe445('0x45')]=_[_0xe445('0x46')](_0x4e6ed7,_0xe445('0x3c'));_0x4d92ff[_0xe445('0x47')]=_[_0xe445('0x48')](_0x4248db[_0xe445('0x47')]);_0x4d92ff['filters']=_[_0xe445('0x49')](_0x4d92ff[_0xe445('0x45')],_0x4d92ff['query']);_0x9a5251[_0xe445('0x4a')]=_[_0xe445('0x49')](_0x4d92ff[_0xe445('0x45')],qs[_0xe445('0x4b')](_0x4248db[_0xe445('0x47')][_0xe445('0x4b')]));_0x9a5251[_0xe445('0x4a')]=_0x9a5251[_0xe445('0x4a')][_0xe445('0x4c')]?_0x9a5251[_0xe445('0x4a')]:_0x4d92ff[_0xe445('0x45')];if(!_0x4248db[_0xe445('0x47')][_0xe445('0x4d')](_0xe445('0x4e'))){_0x9a5251['limit']=qs[_0xe445('0x33')](_0x4248db['query'][_0xe445('0x33')]);_0x9a5251[_0xe445('0x32')]=qs[_0xe445('0x32')](_0x4248db[_0xe445('0x47')]['offset']);}_0x9a5251[_0xe445('0x4f')]=qs[_0xe445('0x50')](_0x4248db[_0xe445('0x47')][_0xe445('0x50')]);_0x9a5251['where']=qs[_0xe445('0x51')](_['pick'](_0x4248db[_0xe445('0x47')],_0x4d92ff[_0xe445('0x51')]),_0x4e6ed7);if(_0x4248db[_0xe445('0x47')][_0xe445('0x52')]){_0x9a5251[_0xe445('0x53')]=_[_0xe445('0x54')](_0x9a5251[_0xe445('0x53')],{'$or':_['map'](_0x4e6ed7,function(_0xd171b6){if(_0xd171b6['type']!=='VIRTUAL'){var _0x250597={};_0x250597[_0xd171b6[_0xe445('0x3c')]]={'$like':'%'+_0x4248db['query']['filter']+'%'};return _0x250597;}})});}_0x9a5251=_[_0xe445('0x54')]({},_0x9a5251,_0x4248db[_0xe445('0x55')]);var _0x282d1e={'where':_0x9a5251[_0xe445('0x53')]};return db[_0xe445('0x40')]['count'](_0x282d1e)['then'](function(_0x591859){_0x555f25[_0xe445('0x31')]=_0x591859;if(_0x4248db['query'][_0xe445('0x56')]){_0x9a5251[_0xe445('0x57')]=[{'all':!![]}];}return db[_0xe445('0x40')][_0xe445('0x58')](_0x9a5251);})[_0xe445('0x37')](function(_0x595853){_0x555f25[_0xe445('0x59')]=_0x595853;return _0x555f25;})[_0xe445('0x37')](respondWithFilteredResult(_0x2841c1,_0x9a5251))[_0xe445('0x2c')](handleError(_0x2841c1,null));};exports[_0xe445('0x5a')]=function(_0x5af1e0,_0x45d625){var _0x3a1cec={'raw':![],'where':{'id':_0x5af1e0[_0xe445('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xe445('0x3f')}]},_0x52c6f5={};_0x52c6f5[_0xe445('0x45')]=_[_0xe445('0x48')](db[_0xe445('0x40')]['rawAttributes']);_0x52c6f5[_0xe445('0x47')]=_[_0xe445('0x48')](_0x5af1e0[_0xe445('0x47')]);_0x52c6f5['filters']=_[_0xe445('0x49')](_0x52c6f5[_0xe445('0x45')],_0x52c6f5[_0xe445('0x47')]);_0x3a1cec['attributes']=_[_0xe445('0x49')](_0x52c6f5[_0xe445('0x45')],qs['fields'](_0x5af1e0['query'][_0xe445('0x4b')]));_0x3a1cec[_0xe445('0x4a')]=_0x3a1cec[_0xe445('0x4a')][_0xe445('0x4c')]?_0x3a1cec['attributes']:_0x52c6f5['model'];if(_0x5af1e0['query'][_0xe445('0x56')]){_0x3a1cec[_0xe445('0x57')]=[{'all':!![]}];}_0x3a1cec=_['merge']({},_0x3a1cec,_0x5af1e0[_0xe445('0x55')]);return db[_0xe445('0x40')][_0xe445('0x5c')](_0x3a1cec)[_0xe445('0x37')](handleEntityNotFound(_0x45d625,null))[_0xe445('0x37')](respondWithResult(_0x45d625,null))['catch'](handleError(_0x45d625,null));};exports['create']=function(_0x1658dc,_0xc4a3cf){return db[_0xe445('0x40')][_0xe445('0x5d')](_0x1658dc[_0xe445('0x5e')],{})[_0xe445('0x37')](function(_0x27fbd1){var _0x4b1afc=_0x1658dc['user'][_0xe445('0x39')]({'plain':!![]});if(!_0x4b1afc)throw new Error(_0xe445('0x5f'));if(_0x4b1afc[_0xe445('0x60')]==='user'){var _0x328fc4=_0x27fbd1['get']({'plain':!![]});var _0x1d4216='ChatWebsites';return db['UserProfileSection']['find']({'where':{'name':_0x1d4216,'userProfileId':_0x4b1afc[_0xe445('0x61')]},'raw':!![]})['then'](function(_0x109902){if(_0x109902&&_0x109902['autoAssociation']===0x0){return db[_0xe445('0x62')][_0xe445('0x5d')]({'name':_0x328fc4[_0xe445('0x3c')],'resourceId':_0x328fc4['id'],'type':_0x109902[_0xe445('0x3c')],'sectionId':_0x109902['id']},{})['then'](function(){return _0x27fbd1;});}else{return _0x27fbd1;}})[_0xe445('0x2c')](function(_0x34d390){logger[_0xe445('0x27')](_0xe445('0x63'),_0x34d390);throw _0x34d390;});}return _0x27fbd1;})[_0xe445('0x37')](respondWithResult(_0xc4a3cf,0xc9))[_0xe445('0x2c')](handleError(_0xc4a3cf,null));};exports[_0xe445('0x64')]=function(_0x1ee4df,_0x356b60){if(_0x1ee4df[_0xe445('0x5e')]['id']){delete _0x1ee4df[_0xe445('0x5e')]['id'];}return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x1ee4df[_0xe445('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xe445('0x3f')}]})['then'](handleEntityNotFound(_0x356b60,null))[_0xe445('0x37')](saveUpdates(_0x1ee4df[_0xe445('0x5e')],null))[_0xe445('0x37')](respondWithResult(_0x356b60,null))['catch'](handleError(_0x356b60,null));};exports[_0xe445('0x38')]=function(_0x31dcd0,_0x281d9b){return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x31dcd0['params']['id']}})['then'](handleEntityNotFound(_0x281d9b,null))[_0xe445('0x37')](removeEntity(_0x281d9b,null))[_0xe445('0x2c')](handleError(_0x281d9b,null));};exports[_0xe445('0x65')]=function(_0x121905,_0x554af0){return db['ChatWebsite']['describe']()[_0xe445('0x37')](respondWithResult(_0x554af0,null))[_0xe445('0x2c')](handleError(_0x554af0,null));};exports[_0xe445('0x66')]=function(_0x32500a,_0x18c9c9,_0x2ba14f){if(_0x32500a['body']['id']){delete _0x32500a[_0xe445('0x5e')]['id'];}return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x32500a[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x18c9c9,null))[_0xe445('0x37')](function(_0x44abd4){if(_0x44abd4){_0x32500a[_0xe445('0x5e')][_0xe445('0x67')]=_0x44abd4['id'];return db[_0xe445('0x68')][_0xe445('0x5d')](_0x32500a[_0xe445('0x5e')]);}})[_0xe445('0x37')](respondWithResult(_0x18c9c9,null))[_0xe445('0x2c')](handleError(_0x18c9c9,null));};exports[_0xe445('0x69')]=function(_0x27f0a8,_0xa42536,_0xe89fb7){var _0x53ae08={'raw':![],'where':{}};var _0x329c17={};var _0x554e16={'count':0x0,'rows':[]};return db[_0xe445('0x40')][_0xe445('0x6a')]({'where':{'id':_0x27f0a8[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0xa42536,null))['then'](function(_0x31449a){if(_0x31449a){_0x329c17['model']=_[_0xe445('0x48')](db[_0xe445('0x68')]['rawAttributes']);_0x329c17[_0xe445('0x47')]=_[_0xe445('0x48')](_0x27f0a8[_0xe445('0x47')]);_0x329c17[_0xe445('0x51')]=_[_0xe445('0x49')](_0x329c17['model'],_0x329c17['query']);_0x53ae08[_0xe445('0x4a')]=_['intersection'](_0x329c17['model'],qs['fields'](_0x27f0a8[_0xe445('0x47')][_0xe445('0x4b')]));_0x53ae08[_0xe445('0x4a')]=_0x53ae08['attributes'][_0xe445('0x4c')]?_0x53ae08[_0xe445('0x4a')]:_0x329c17[_0xe445('0x45')];if(!_0x27f0a8[_0xe445('0x47')][_0xe445('0x4d')]('nolimit')){_0x53ae08[_0xe445('0x33')]=qs['limit'](_0x27f0a8['query'][_0xe445('0x33')]);_0x53ae08[_0xe445('0x32')]=qs[_0xe445('0x32')](_0x27f0a8[_0xe445('0x47')][_0xe445('0x32')]);}_0x53ae08[_0xe445('0x4f')]=qs[_0xe445('0x50')](_0x27f0a8[_0xe445('0x47')][_0xe445('0x50')]);_0x53ae08[_0xe445('0x53')]=qs[_0xe445('0x51')](_[_0xe445('0x6b')](_0x27f0a8['query'],_0x329c17[_0xe445('0x51')]));_0x53ae08[_0xe445('0x53')]['ChatWebsiteId']=_0x31449a['id'];if(_0x27f0a8[_0xe445('0x47')][_0xe445('0x52')]){_0x53ae08['where']=_[_0xe445('0x54')](_0x53ae08[_0xe445('0x53')],{'$or':_[_0xe445('0x46')](_0x53ae08[_0xe445('0x4a')],function(_0x3764e6){var _0x1cf198={};_0x1cf198[_0x3764e6]={'$like':'%'+_0x27f0a8[_0xe445('0x47')][_0xe445('0x52')]+'%'};return _0x1cf198;})});}_0x53ae08=_[_0xe445('0x54')]({},_0x53ae08,_0x27f0a8[_0xe445('0x55')]);return db[_0xe445('0x68')][_0xe445('0x31')]({'where':_0x53ae08[_0xe445('0x53')]})[_0xe445('0x37')](function(_0x48ef12){_0x554e16['count']=_0x48ef12;if(_0x27f0a8[_0xe445('0x47')][_0xe445('0x56')]){_0x53ae08[_0xe445('0x57')]=[{'all':!![]}];}return db[_0xe445('0x68')]['findAll'](_0x53ae08);})[_0xe445('0x37')](function(_0x5b3363){_0x554e16['rows']=_0x5b3363;return _0x554e16;});}})[_0xe445('0x37')](respondWithFilteredResult(_0xa42536,_0x53ae08))[_0xe445('0x2c')](handleError(_0xa42536,null));};exports['removeDispositions']=function(_0x3cc08d,_0x2387b7,_0x36775f){return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x3cc08d[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x2387b7,null))[_0xe445('0x37')](function(_0x2bdd53){if(_0x2bdd53){return _0x2bdd53[_0xe445('0x6c')](_0x3cc08d[_0xe445('0x47')][_0xe445('0x6d')]);}})[_0xe445('0x37')](respondWithStatusCode(_0x2387b7,null))[_0xe445('0x2c')](handleError(_0x2387b7,null));};exports['addAnswer']=function(_0x18d50e,_0x15a70b,_0x1fea6e){if(_0x18d50e[_0xe445('0x5e')]['id']){delete _0x18d50e['body']['id'];}return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x18d50e['params']['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x15a70b,null))[_0xe445('0x37')](function(_0x2921fc){if(_0x2921fc){_0x18d50e['body'][_0xe445('0x67')]=_0x2921fc['id'];return db['CannedAnswer']['create'](_0x18d50e['body']);}})[_0xe445('0x37')](respondWithResult(_0x15a70b,null))['catch'](handleError(_0x15a70b,null));};exports[_0xe445('0x6e')]=function(_0x20d00a,_0x19aaa0,_0x5ea74c){var _0x419f77={'raw':![],'where':{}};var _0x291187={};var _0x4ad7b1={'count':0x0,'rows':[]};return db[_0xe445('0x40')][_0xe445('0x6a')]({'where':{'id':_0x20d00a['params']['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x19aaa0,null))[_0xe445('0x37')](function(_0x2b25e5){if(_0x2b25e5){_0x291187[_0xe445('0x45')]=_[_0xe445('0x48')](db['CannedAnswer']['rawAttributes']);_0x291187[_0xe445('0x47')]=_['keys'](_0x20d00a[_0xe445('0x47')]);_0x291187['filters']=_['intersection'](_0x291187[_0xe445('0x45')],_0x291187[_0xe445('0x47')]);_0x419f77[_0xe445('0x4a')]=_['intersection'](_0x291187[_0xe445('0x45')],qs['fields'](_0x20d00a[_0xe445('0x47')]['fields']));_0x419f77[_0xe445('0x4a')]=_0x419f77[_0xe445('0x4a')][_0xe445('0x4c')]?_0x419f77[_0xe445('0x4a')]:_0x291187['model'];if(!_0x20d00a['query'][_0xe445('0x4d')](_0xe445('0x4e'))){_0x419f77[_0xe445('0x33')]=qs[_0xe445('0x33')](_0x20d00a[_0xe445('0x47')][_0xe445('0x33')]);_0x419f77[_0xe445('0x32')]=qs['offset'](_0x20d00a[_0xe445('0x47')][_0xe445('0x32')]);}_0x419f77[_0xe445('0x4f')]=qs['sort'](_0x20d00a['query']['sort']);_0x419f77[_0xe445('0x53')]=qs['filters'](_[_0xe445('0x6b')](_0x20d00a[_0xe445('0x47')],_0x291187[_0xe445('0x51')]));_0x419f77[_0xe445('0x53')][_0xe445('0x67')]=_0x2b25e5['id'];if(_0x20d00a[_0xe445('0x47')]['filter']){_0x419f77['where']=_[_0xe445('0x54')](_0x419f77[_0xe445('0x53')],{'$or':_[_0xe445('0x46')](_0x419f77['attributes'],function(_0x5b863f){var _0x336ee3={};_0x336ee3[_0x5b863f]={'$like':'%'+_0x20d00a[_0xe445('0x47')][_0xe445('0x52')]+'%'};return _0x336ee3;})});}_0x419f77=_[_0xe445('0x54')]({},_0x419f77,_0x20d00a[_0xe445('0x55')]);return db[_0xe445('0x6f')][_0xe445('0x31')]({'where':_0x419f77[_0xe445('0x53')]})[_0xe445('0x37')](function(_0x479106){_0x4ad7b1[_0xe445('0x31')]=_0x479106;if(_0x20d00a[_0xe445('0x47')][_0xe445('0x56')]){_0x419f77['include']=[{'all':!![]}];}return db[_0xe445('0x6f')]['findAll'](_0x419f77);})['then'](function(_0x478877){_0x4ad7b1[_0xe445('0x59')]=_0x478877;return _0x4ad7b1;});}})[_0xe445('0x37')](respondWithFilteredResult(_0x19aaa0,_0x419f77))['catch'](handleError(_0x19aaa0,null));};exports['removeAnswers']=function(_0x1da60a,_0x1cae52,_0x3dd341){return db['ChatWebsite'][_0xe445('0x5c')]({'where':{'id':_0x1da60a[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x1cae52,null))[_0xe445('0x37')](function(_0x3a389b){if(_0x3a389b){return _0x3a389b['removeAnswers'](_0x1da60a['query'][_0xe445('0x6d')]);}})[_0xe445('0x37')](respondWithStatusCode(_0x1cae52,null))[_0xe445('0x2c')](handleError(_0x1cae52,null));};exports['addLogo']=function(_0x3228e5,_0x2ace0e,_0x3de24a){_0x3228e5[_0xe445('0x5e')][_0xe445('0x70')]=_0x3228e5[_0xe445('0x71')]['filename'];return db['ChatWebsite'][_0xe445('0x5c')]({'where':{'id':_0x3228e5['params']['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x2ace0e,null))[_0xe445('0x37')](saveUpdates(_0x3228e5[_0xe445('0x5e')],null))['then'](respondWithResult(_0x2ace0e,null))[_0xe445('0x2c')](handleError(_0x2ace0e,null));};exports['addAvatar']=function(_0x4a136b,_0x46203b,_0x4e0267){_0x4a136b[_0xe445('0x5e')]['agentAvatar']=_0x4a136b[_0xe445('0x71')][_0xe445('0x72')];return db['ChatWebsite'][_0xe445('0x5c')]({'where':{'id':_0x4a136b[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x46203b,null))[_0xe445('0x37')](saveUpdates(_0x4a136b[_0xe445('0x5e')],null))[_0xe445('0x37')](respondWithResult(_0x46203b,null))[_0xe445('0x2c')](handleError(_0x46203b,null));};exports['addCustomerAvatar']=function(_0x274a70,_0x54c8e7,_0x1becb0){_0x274a70[_0xe445('0x5e')]['customerAvatar']=_0x274a70['file'][_0xe445('0x72')];return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x274a70[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x54c8e7,null))[_0xe445('0x37')](saveUpdates(_0x274a70[_0xe445('0x5e')],null))[_0xe445('0x37')](respondWithResult(_0x54c8e7,null))['catch'](handleError(_0x54c8e7,null));};exports[_0xe445('0x73')]=function(_0x1f556b,_0x2e3824,_0x4c0eeb){_0x1f556b[_0xe445('0x5e')][_0xe445('0x74')]=_0x1f556b[_0xe445('0x71')][_0xe445('0x72')];return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x1f556b[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x2e3824,null))[_0xe445('0x37')](saveUpdates(_0x1f556b['body'],null))[_0xe445('0x37')](respondWithResult(_0x2e3824,null))['catch'](handleError(_0x2e3824,null));};exports['getLogo']=function(_0x485a63,_0x2bad18,_0x56afc7){var _0x128f26=path[_0xe445('0x75')](config[_0xe445('0x76')],'server/files/images/logos/default_logo.svg');var _0x4bd7ce={'where':{'id':_0x485a63[_0xe445('0x5b')]['id']},'attributes':['id',_0xe445('0x70')],'raw':!![]};var _0x34224a=![];return require(_0xe445('0x16'))[_0xe445('0x77')]()[_0xe445('0x37')](function(_0x59873e){if(_0x59873e){_0x34224a=_0x59873e[_0xe445('0x78')];}})[_0xe445('0x37')](function(){return db['ChatWebsite'][_0xe445('0x5c')](_0x4bd7ce);})['then'](handleEntityNotFound(_0x2bad18,null))[_0xe445('0x37')](function(_0x264c82){if(_0x264c82){if(!_[_0xe445('0x79')](_0x264c82[_0xe445('0x70')])){if(fs[_0xe445('0x7a')](path[_0xe445('0x75')](config[_0xe445('0x76')],'server/files/images/logos/',_0x264c82['sitepic']))&&_0x34224a){_0x128f26=path[_0xe445('0x75')](config[_0xe445('0x76')],'server/files/images/logos/',_0x264c82[_0xe445('0x70')]);}}return _0x2bad18[_0xe445('0x7b')](_0x128f26);}})[_0xe445('0x2c')](handleError(_0x2bad18,null));};exports[_0xe445('0x7c')]=function(_0x3bbe99,_0x45baa2,_0x1aa2dc){var _0x6101a0=path[_0xe445('0x75')](config['root'],_0xe445('0x7d'));var _0x1f9d8a={'where':{'id':_0x3bbe99[_0xe445('0x5b')]['id']},'attributes':['id',_0xe445('0x7e')],'raw':!![]};return db[_0xe445('0x40')][_0xe445('0x5c')](_0x1f9d8a)['then'](handleEntityNotFound(_0x45baa2,null))[_0xe445('0x37')](function(_0x2c6ea4){if(_0x2c6ea4){if(!_[_0xe445('0x79')](_0x2c6ea4[_0xe445('0x7e')])){if(fs[_0xe445('0x7a')](path['join'](config[_0xe445('0x76')],_0xe445('0x7f'),_0x2c6ea4[_0xe445('0x7e')]))){_0x6101a0=path['join'](config[_0xe445('0x76')],_0xe445('0x7f'),_0x2c6ea4['agentAvatar']);}}return _0x45baa2[_0xe445('0x7b')](_0x6101a0);}})[_0xe445('0x2c')](handleError(_0x45baa2,null));};exports[_0xe445('0x80')]=function(_0x21ed72,_0x1edf58,_0x42594b){var _0x4cae22=path[_0xe445('0x75')](config[_0xe445('0x76')],_0xe445('0x81'));var _0x3c90d8={'where':{'id':_0x21ed72[_0xe445('0x5b')]['id']},'attributes':['id',_0xe445('0x82'),_0xe445('0x83')],'raw':!![]};return db['ChatWebsite'][_0xe445('0x5c')](_0x3c90d8)[_0xe445('0x37')](handleEntityNotFound(_0x1edf58,null))[_0xe445('0x37')](function(_0x2188c4){if(_0x2188c4){if(!_[_0xe445('0x79')](_0x2188c4[_0xe445('0x82')])){if(fs[_0xe445('0x7a')](path[_0xe445('0x75')](config[_0xe445('0x76')],'server/files/images/avatars/',_0x2188c4[_0xe445('0x82')]))&&_0x2188c4['showCustomerAvatar']){_0x4cae22=path[_0xe445('0x75')](config['root'],_0xe445('0x7f'),_0x2188c4[_0xe445('0x82')]);}}return _0x1edf58['download'](_0x4cae22);}})[_0xe445('0x2c')](handleError(_0x1edf58,null));};exports[_0xe445('0x84')]=function(_0x2709d4,_0x5273e5,_0x32da11){var _0x3d94db=path[_0xe445('0x75')](config[_0xe445('0x76')],_0xe445('0x85'));var _0x5f2e1b={'where':{'id':_0x2709d4[_0xe445('0x5b')]['id']},'attributes':['id',_0xe445('0x74')],'raw':!![]};return db[_0xe445('0x40')][_0xe445('0x5c')](_0x5f2e1b)[_0xe445('0x37')](handleEntityNotFound(_0x5273e5,null))[_0xe445('0x37')](function(_0x1c2532){if(_0x1c2532){if(!_['isNil'](_0x1c2532['systemAvatar'])){if(fs['existsSync'](path[_0xe445('0x75')](config[_0xe445('0x76')],_0xe445('0x7f'),_0x1c2532[_0xe445('0x74')]))){_0x3d94db=path['join'](config[_0xe445('0x76')],'server/files/images/avatars/',_0x1c2532[_0xe445('0x74')]);}}return _0x5273e5['download'](_0x3d94db);}})[_0xe445('0x2c')](handleError(_0x5273e5,null));};exports['notify']=function(_0x15854d,_0x52ea74,_0x483c22){var _0x13ef62=require(_0xe445('0x86'));var _0xb7334c=new _0x13ef62();var _0x3d667c=_0xb7334c['setUA'](_0x15854d[_0xe445('0x87')]['user-agent'])['getResult']();var _0x2f72e6={'body':_0x15854d[_0xe445('0x5e')],'channel':_0xe445('0x88')};var _0x428aa1=[];var _0x5b6e8f=[];var _0x4b9252={};var _0x201a15=![];return db[_0xe445('0x89')]['describe']()['then'](function(_0x20d612){if(!_0x20d612){throw new db[(_0xe445('0x8a'))][(_0xe445('0x8b'))](_0xe445('0x8c'));}_0x428aa1=_[_0xe445('0x8d')](_[_0xe445('0x48')](_0x20d612),[_0xe445('0x8e'),_0xe445('0x8f')]);_0x5b6e8f=_['difference'](_[_0xe445('0x48')](_0x20d612),[_0xe445('0x8e'),_0xe445('0x8f'),_0xe445('0x90'),_0xe445('0x91')]);if(_0x15854d[_0xe445('0x5e')]['id']){delete _0x15854d[_0xe445('0x5e')]['id'];}if(_[_0xe445('0x79')](_0x15854d[_0xe445('0x5e')][_0xe445('0x92')])){throw new db['Sequelize'][(_0xe445('0x8b'))](_0xe445('0x93'));}if(_[_0xe445('0x79')](_0x15854d[_0xe445('0x5e')][_0xe445('0x5e')])||_0x15854d['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0xe445('0x94'));}if(_[_0xe445('0x79')](_0x15854d[_0xe445('0x5e')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xe445('0x95')+_0x5b6e8f);}if(!_['includes'](_0x5b6e8f,_0x15854d[_0xe445('0x5e')][_0xe445('0x96')])){throw new db['Sequelize'][(_0xe445('0x8b'))](_0xe445('0x97')+_0x5b6e8f);}_0x4b9252[_0x15854d[_0xe445('0x5e')]['mapKey']]=_0x15854d[_0xe445('0x5e')]['from'];})['then'](function(){return db['ChatWebsite'][_0xe445('0x5c')]({'where':{'id':_0x15854d[_0xe445('0x5b')]['id']},'include':[{'model':db[_0xe445('0x98')],'as':_0xe445('0x99'),'include':[{'model':db['CmContact'],'as':_0xe445('0x9a'),'where':_0x4b9252,'limit':0x1,'order':[[_0xe445('0x8f'),_0xe445('0x9b')]]}]},{'model':db[_0xe445('0x9c')],'as':_0xe445('0x9d')}]});})['then'](handleEntityNotFound(_0x52ea74,null))[_0xe445('0x37')](function(_0x16ad31){if(_0x16ad31&&_0x16ad31[_0xe445('0x99')]){_0x2f72e6[_0xe445('0x9e')]=_0x16ad31;_0x2f72e6[_0xe445('0x9f')]=_0x16ad31[_0xe445('0x9d')];_0x2f72e6[_0xe445('0xa0')]=_0x16ad31[_0xe445('0x99')];_0x2f72e6[_0xe445('0x9f')]=_['orderBy'](_0x2f72e6['applications'],[_0xe445('0xa1')],['asc']);if(_0x2f72e6[_0xe445('0x9e')]['Applications']){delete _0x2f72e6[_0xe445('0x9e')][_0xe445('0x9d')];}if(_0x2f72e6[_0xe445('0x9e')]['List']&&_0x2f72e6[_0xe445('0x9e')]['List'][_0xe445('0x9a')]['length']){return _0x2f72e6[_0xe445('0x9e')]['List']['Contacts'][0x0];}var _0x9e2706=_[_0xe445('0x19')](_0x15854d['body'],{'firstName':_0x15854d[_0xe445('0x5e')][_0xe445('0x92')],'ListId':_0x16ad31[_0xe445('0x91')]});_0x9e2706[_0x15854d['body'][_0xe445('0x96')]]=_0x15854d[_0xe445('0x5e')][_0xe445('0x92')];return db[_0xe445('0x89')][_0xe445('0x5d')](_0x9e2706,{'fields':_0x428aa1,'raw':!![]});}})['then'](handleEntityNotFound(_0x52ea74,null))[_0xe445('0x37')](function(_0x32ad11){_0x2f72e6[_0xe445('0xa2')]=_0x32ad11;var _0x3d6b92=_0x15854d[_0xe445('0x5e')][_0xe445('0xa3')];if(_0x15854d[_0xe445('0x87')][_0xe445('0xa4')]){_0x3d6b92=_0x15854d[_0xe445('0x87')][_0xe445('0xa4')];}else if(_0x15854d[_0xe445('0x87')][_0xe445('0xa5')]){_0x3d6b92=_['first'](_0x15854d['headers'][_0xe445('0xa5')][_0xe445('0xa6')](','));}if(_0x32ad11){var _0x5135e1={'ContactId':_0x32ad11['id'],'ChatWebsiteId':_0x15854d[_0xe445('0x5b')]['id'],'from':(_0x32ad11[_0xe445('0xa7')]||'')+'\x20'+(_0x32ad11[_0xe445('0xa8')]||''),'customerIp':_0x3d6b92,'customerPort':_0x15854d[_0xe445('0x87')][_0xe445('0xa9')]?_0x15854d[_0xe445('0x87')]['x-real-port']:null,'referer':_0x15854d['body']['referer'],'browserName':_0x3d667c['browser']['name']&&_0x3d667c[_0xe445('0xaa')][_0xe445('0xab')]?util[_0xe445('0xac')]('%s\x20%s',_0x3d667c['browser'][_0xe445('0x3c')],_0x3d667c['browser'][_0xe445('0xab')]):_0xe445('0xad'),'browserVersion':_0x3d667c['browser'][_0xe445('0xab')]||_0xe445('0xad'),'osName':util[_0xe445('0xac')](_0xe445('0xae'),_0x3d667c['os'][_0xe445('0x3c')],_0x3d667c['os'][_0xe445('0xab')]),'osVersion':_0x3d667c['os'][_0xe445('0xab')],'deviceModel':_0x3d667c[_0xe445('0xaf')][_0xe445('0x45')]&&_0x3d667c[_0xe445('0xaf')][_0xe445('0xb0')]?util[_0xe445('0xac')]('%s\x20%s\x20%s',_0x3d667c[_0xe445('0xaf')][_0xe445('0x45')],_0x3d667c[_0xe445('0xaf')][_0xe445('0xb0')],_0x3d667c[_0xe445('0xaf')][_0xe445('0x43')]):null,'deviceVendor':_0x3d667c[_0xe445('0xaf')][_0xe445('0xb0')],'deviceType':_0x3d667c['device'][_0xe445('0x43')],'formData':JSON['stringify'](_0x15854d[_0xe445('0x5e')])};var _0x4fd6a4={'ChatWebsiteId':_0x15854d['params']['id'],'closed':![]};if(_0x15854d[_0xe445('0x5e')][_0xe445('0xb1')]){_0x4fd6a4['threadId']=_0x15854d[_0xe445('0x5e')][_0xe445('0xb1')];return db[_0xe445('0xb2')][_0xe445('0x5c')]({'where':_0x4fd6a4})['then'](function(_0x3e96fe){if(_0x3e96fe){return[_0x3e96fe,![]];}_0x5135e1[_0xe445('0xb1')]=_0x15854d['body'][_0xe445('0xb1')];_0x5135e1['externalUrl']=_0x15854d['body'][_0xe445('0xb3')];return db[_0xe445('0xb2')][_0xe445('0x5d')](_0x5135e1)[_0xe445('0x37')](function(_0x566f1a){return[_0x566f1a,!![]];});});}_0x4fd6a4[_0xe445('0xb4')]=_0x32ad11['id'];if(_0x15854d[_0xe445('0x5e')]['interaction']&&_0x15854d[_0xe445('0x5e')][_0xe445('0xb5')]['id']){_0x4fd6a4['id']=_0x15854d[_0xe445('0x5e')][_0xe445('0xb5')]['id'];return db[_0xe445('0xb2')]['find']({'where':_0x4fd6a4})[_0xe445('0x37')](function(_0x10e941){if(_0x10e941){return[_0x10e941,![]];}return db[_0xe445('0xb2')]['create'](_0x5135e1)[_0xe445('0x37')](function(_0x2ab382){return[_0x2ab382,!![]];});});}return db[_0xe445('0xb2')][_0xe445('0x5d')](_0x5135e1)['then'](function(_0x26d357){return[_0x26d357,!![]];});}})[_0xe445('0xb6')](function(_0x5992d8,_0x5c23cf){if(_0x5992d8){_0x201a15=_0x5c23cf;if(!_0x5c23cf){var _0x18dd99={'from':(_0x2f72e6[_0xe445('0xa2')][_0xe445('0xa7')]||'')+'\x20'+(_0x2f72e6[_0xe445('0xa2')]['lastName']||'')};if(_0x15854d[_0xe445('0x5e')][_0xe445('0xb1')]&&_0x15854d[_0xe445('0x5e')][_0xe445('0xb7')]&&_0x15854d[_0xe445('0x5e')]['threadId']!=_0x15854d[_0xe445('0x5e')][_0xe445('0xb7')]){_0x18dd99[_0xe445('0xb1')]=_0x15854d['body'][_0xe445('0xb7')];}return _0x5992d8['update'](_0x18dd99);}else{return _0x5992d8;}}})[_0xe445('0x37')](function(_0x531be6){_0x2f72e6[_0xe445('0xb5')]=_0x531be6['get']({'plain':!![]});_0x2f72e6[_0xe445('0xb5')][_0xe445('0xb8')]=_0x201a15;if(_0x2f72e6[_0xe445('0xb5')]['created']){if(_0x2f72e6[_0xe445('0x9e')][_0xe445('0xb9')]){_0x2f72e6['applications'][_0xe445('0xba')]({'id':0x0,'priority':_0x2f72e6['applications'][_0xe445('0x4c')]+0x1,'app':_0xe445('0xbb'),'appdata':_0xe445('0xbc'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0xe445('0x5d')]({'body':_0x15854d[_0xe445('0x5e')][_0xe445('0x5e')],'ChatWebsiteId':_0x15854d[_0xe445('0x5b')]['id'],'ChatInteractionId':_0x531be6['id'],'direction':'in','ContactId':_0x2f72e6[_0xe445('0xa2')]['id'],'AttachmentId':_0x15854d[_0xe445('0x5e')][_0xe445('0xbd')]});})[_0xe445('0x37')](function(_0x2126da){_0x2f72e6[_0xe445('0x2a')]=_0x2126da;if(_0x2f72e6['interaction'][_0xe445('0xbe')]){return db[_0xe445('0xbf')][_0xe445('0x5c')]({'attributes':['id',_0xe445('0x3c')],'where':{'id':_0x2f72e6['interaction']['UserId']}})[_0xe445('0x37')](function(_0x528918){if(_0x528918){_0x2f72e6[_0xe445('0x9f')][_0xe445('0xc0')]({'id':0x0,'priority':0x0,'app':_0xe445('0xc1'),'appdata':_0x528918['name']+','+(_0x2f72e6[_0xe445('0x9e')][_0xe445('0xc2')]||0xa),'interval':_0xe445('0xc3')});_0x2f72e6['forcedOwnership']=!![];}return respondWithRpcPromise(_0xe445('0xc4'),_0xe445('0xc5'),_0x2f72e6);});}return respondWithRpcPromise(_0xe445('0xc4'),'startRouting',_0x2f72e6);})[_0xe445('0x37')](function(_0x4dc139){respondWithRpcPromise(_0xe445('0xc6'),_0xe445('0xc6'),{'event':_0xe445('0xc7'),'message':_0x4dc139},client9002);return _0x4dc139;})['then'](respondWithResult(_0x52ea74,null))[_0xe445('0x2c')](handleError(_0x52ea74,null));};exports[_0xe445('0xc8')]=function(_0x37643a,_0x4b7b45,_0x3d5920){var _0x2bb3b5,_0x210dba,_0x4c7d18;var _0x24564a=[];var _0x53eb39=[];var _0x29894c={};return db[_0xe445('0x89')][_0xe445('0x65')]()[_0xe445('0x37')](function(_0x448550){if(!_0x448550){throw new db[(_0xe445('0x8a'))][(_0xe445('0x8b'))](_0xe445('0x8c'));}_0x53eb39=_[_0xe445('0x8d')](_['keys'](_0x448550),['createdAt',_0xe445('0x8f')]);_0x24564a=_[_0xe445('0x8d')](_[_0xe445('0x48')](_0x448550),['createdAt',_0xe445('0x8f'),_0xe445('0x90'),_0xe445('0x91')]);if(_0x37643a[_0xe445('0x5e')]['id']){delete _0x37643a[_0xe445('0x5e')]['id'];}if(_['isNil'](_0x37643a[_0xe445('0x5e')][_0xe445('0x92')])){throw _0x4b7b45[_0xe445('0x2e')](0x1f4)[_0xe445('0x3d')](new db[(_0xe445('0x8a'))][(_0xe445('0x8b'))](_0xe445('0x93')));}if(_[_0xe445('0x79')](_0x37643a[_0xe445('0x5e')][_0xe445('0x5e')])||_0x37643a[_0xe445('0x5e')][_0xe445('0x5e')]===''){throw _0x4b7b45[_0xe445('0x2e')](0x1f4)[_0xe445('0x3d')](new db[(_0xe445('0x8a'))][(_0xe445('0x8b'))](_0xe445('0x94')));}if(_[_0xe445('0x79')](_0x37643a['body'][_0xe445('0xc9')])){throw _0x4b7b45[_0xe445('0x2e')](0x1f4)[_0xe445('0x3d')](new db[(_0xe445('0x8a'))][(_0xe445('0x8b'))](_0xe445('0xca')+_0x24564a));}if(!_[_0xe445('0xcb')](_0x24564a,_0x37643a[_0xe445('0x5e')]['mapKeyOffline'])){throw _0x4b7b45[_0xe445('0x2e')](0x1f4)[_0xe445('0x3d')](new db[(_0xe445('0x8a'))][(_0xe445('0x8b'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x24564a));}_0x29894c[_0x37643a[_0xe445('0x5e')][_0xe445('0xc9')]]=_0x37643a[_0xe445('0x5e')][_0xe445('0x92')];})[_0xe445('0x37')](function(){return db['ChatWebsite'][_0xe445('0x5c')]({'where':{'id':_0x37643a[_0xe445('0x5b')]['id']},'include':[{'model':db[_0xe445('0x98')],'as':_0xe445('0x99')}]});})[_0xe445('0x37')](handleEntityNotFound(_0x4b7b45,null))[_0xe445('0x37')](function(_0x31fe9c){if(_0x31fe9c&&_0x31fe9c['List']){_0x210dba=_0x31fe9c;var _0x4a702c=_[_0xe445('0x19')](_0x37643a[_0xe445('0x5e')],{'firstName':_0x37643a[_0xe445('0x5e')][_0xe445('0x92')],'phone':_0x37643a[_0xe445('0x5e')]['from'],'ListId':_0x31fe9c['ListId']});_0x4a702c[_0x37643a['body'][_0xe445('0xc9')]]=_0x37643a[_0xe445('0x5e')][_0xe445('0x92')];return db[_0xe445('0x89')][_0xe445('0xcc')]({'where':_0x29894c,'defaults':_0x4a702c});}})[_0xe445('0xb6')](function(_0x253603){if(_0x253603){_0x4c7d18=_0x253603;var _0xe6286b=fs[_0xe445('0xcd')](path[_0xe445('0x75')](config[_0xe445('0x76')],_0xe445('0xce')),_0xe445('0xcf'));var _0x6bf0f5=ejs[_0xe445('0xd0')](_0xe6286b,{'body':_['toPairs'](_0x37643a['body'][_0xe445('0x5e')]),'bodyTitle':_0x210dba[_0xe445('0xd1')]});return db[_0xe445('0xd2')][_0xe445('0x5d')]({'body':_0x6bf0f5,'ContactId':_0x253603['id'],'ChatWebsiteId':_0x210dba['id']});}})[_0xe445('0x37')](function(_0x138b1b){if(_0x138b1b){_0x2bb3b5=_0x138b1b;return db[_0xe445('0xd3')][_0xe445('0x6a')]({'where':{'service':!![]},'include':[{'model':db[_0xe445('0xd4')],'as':_0xe445('0xd5'),'raw':!![]}]});}})[_0xe445('0x37')](function(_0x46070e){if(_0x46070e&&_0x46070e['Smtp']&&_0x210dba[_0xe445('0xd6')]){var _0x31e94f={'tls':{'rejectUnauthorized':![]}};if(_0x46070e[_0xe445('0xd5')]['service']){_0x31e94f[_0xe445('0xd7')]=_0x46070e['Smtp'][_0xe445('0xd7')];}else{_0x31e94f[_0xe445('0xd8')]=_0x46070e['Smtp'][_0xe445('0xd8')];_0x31e94f['port']=_0x46070e[_0xe445('0xd5')][_0xe445('0xd9')];_0x31e94f[_0xe445('0xda')]=_0x46070e[_0xe445('0xd5')][_0xe445('0xda')];}if(_0x46070e[_0xe445('0xd5')][_0xe445('0xdb')]){_0x31e94f[_0xe445('0xdc')]={'user':_0x46070e[_0xe445('0xd5')]['user'],'pass':_0x46070e['Smtp'][_0xe445('0xdd')]};}return respondWithRpcPromise(_0xe445('0xde'),_0xe445('0xdf'),{'account':_0x31e94f,'message':{'from':util[_0xe445('0xac')](_0xe445('0xe0'),_0x46070e[_0xe445('0x3c')],_0x46070e[_0xe445('0xe1')]||_0x46070e[_0xe445('0xd5')][_0xe445('0xe2')]),'to':_0x210dba[_0xe445('0xd6')],'subject':_0x210dba[_0xe445('0xe3')],'text':_0x2bb3b5['body']}},client9003)['then'](function(){return _0x2bb3b5;})[_0xe445('0x2c')](function(_0x358fe8){console[_0xe445('0x27')](_0x358fe8);});}})['then'](function(){if(_0x2bb3b5){return _0x2bb3b5;}})['then'](respondWithResult(_0x4b7b45,null))[_0xe445('0x2c')](handleError(_0x4b7b45,null));};exports['addInteraction']=function(_0x535910,_0x5ce3e0,_0x850ac3){return db[_0xe445('0xb2')][_0xe445('0x5c')]({'where':{'id':_0x535910[_0xe445('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5ce3e0,null))[_0xe445('0x37')](function(_0x2d8a9a){if(_0x2d8a9a){return _0x2d8a9a[_0xe445('0xe4')](_0x535910[_0xe445('0x5e')][_0xe445('0x6d')],_[_0xe445('0xe5')](_0x535910['body'],['ids','id'])||{});}})[_0xe445('0x37')](respondWithResult(_0x5ce3e0,null))[_0xe445('0x2c')](handleError(_0x5ce3e0,null));};exports['getInteractions']=function(_0x1c3b46,_0x3c7aae,_0x5341ba){var _0x330a1f={'raw':![],'where':{}};var _0x1ad93b={};var _0x54bd6d={'count':0x0,'rows':[]};return db[_0xe445('0x40')]['findOne']({'where':{'id':_0x1c3b46[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x3c7aae,null))[_0xe445('0x37')](function(_0x5a73a5){if(_0x5a73a5){_0x1ad93b[_0xe445('0x45')]=_['keys'](db['ChatInteraction'][_0xe445('0x41')]);_0x1ad93b['query']=_['keys'](_0x1c3b46[_0xe445('0x47')]);_0x1ad93b[_0xe445('0x51')]=_[_0xe445('0x49')](_0x1ad93b[_0xe445('0x45')],_0x1ad93b[_0xe445('0x47')]);_0x330a1f[_0xe445('0x4a')]=_[_0xe445('0x49')](_0x1ad93b[_0xe445('0x45')],qs[_0xe445('0x4b')](_0x1c3b46['query'][_0xe445('0x4b')]));_0x330a1f[_0xe445('0x4a')]=_0x330a1f['attributes'][_0xe445('0x4c')]?_0x330a1f[_0xe445('0x4a')]:_0x1ad93b[_0xe445('0x45')];if(!_0x1c3b46['query'][_0xe445('0x4d')](_0xe445('0x4e'))){_0x330a1f['limit']=qs['limit'](_0x1c3b46['query']['limit']);_0x330a1f[_0xe445('0x32')]=qs[_0xe445('0x32')](_0x1c3b46[_0xe445('0x47')]['offset']);}_0x330a1f[_0xe445('0x4f')]=qs[_0xe445('0x50')](_0x1c3b46[_0xe445('0x47')]['sort']);_0x330a1f[_0xe445('0x53')]=qs[_0xe445('0x51')](_['pick'](_0x1c3b46['query'],_0x1ad93b['filters']));_0x330a1f[_0xe445('0x53')]['ChatWebsiteId']=_0x5a73a5['id'];if(_0x1c3b46[_0xe445('0x47')]['filter']){_0x330a1f['where']=_[_0xe445('0x54')](_0x330a1f[_0xe445('0x53')],{'$or':_[_0xe445('0x46')](_0x330a1f[_0xe445('0x4a')],function(_0x203b8b){var _0x1642e2={};_0x1642e2[_0x203b8b]={'$like':'%'+_0x1c3b46[_0xe445('0x47')][_0xe445('0x52')]+'%'};return _0x1642e2;})});}_0x330a1f=_['merge']({},_0x330a1f,_0x1c3b46[_0xe445('0x55')]);return db[_0xe445('0xb2')][_0xe445('0x31')]({'where':_0x330a1f[_0xe445('0x53')]})[_0xe445('0x37')](function(_0x5797ca){_0x54bd6d[_0xe445('0x31')]=_0x5797ca;if(_0x1c3b46[_0xe445('0x47')][_0xe445('0x56')]){_0x330a1f[_0xe445('0x57')]=[{'model':db['CmContact'],'as':_0xe445('0xe6'),'required':![]},{'model':db['User'],'as':_0xe445('0xe7'),'attributes':[_0xe445('0x3c'),'fullname',_0xe445('0xe8')],'required':![]},{'model':db[_0xe445('0xe9')],'as':_0xe445('0xea'),'attributes':['id','name',_0xe445('0xeb')],'where':_0x1c3b46[_0xe445('0x47')]['tag']?{'id':_0x1c3b46[_0xe445('0x47')]['tag']}:undefined,'required':_0x1c3b46[_0xe445('0x47')][_0xe445('0xec')]?!![]:![]}];}return db[_0xe445('0xb2')][_0xe445('0x58')](_0x330a1f);})[_0xe445('0x37')](function(_0x4f5acb){_0x54bd6d[_0xe445('0x59')]=_0x4f5acb;return _0x54bd6d;});}})[_0xe445('0x37')](respondWithFilteredResult(_0x3c7aae,_0x330a1f))[_0xe445('0x2c')](handleError(_0x3c7aae,null));};function iftimePromise(_0x4fd850,_0x49cf61){return respondWithRpcPromise('Command',_0xe445('0xed'),{'command':_0x49cf61[_0xe445('0xee')]?util[_0xe445('0xac')](_0xe445('0xef'),_0x4fd850[_0xe445('0xf0')],_0x49cf61['timezone']):util[_0xe445('0xac')](_0xe445('0xf1'),_0x4fd850[_0xe445('0xf0')])},client9002)[_0xe445('0x37')](function(_0x4abbf1){var _0x1362cf=_0x4abbf1&&_0x4abbf1['indexOf'](_0xe445('0xf2'))>=0x0?!![]:![];logger['info'](_0xe445('0xf3'),_0x49cf61['id'],_0x4fd850['id'],_0x4fd850[_0xe445('0xf0')],_0x1362cf?'ONLINE':_0xe445('0xf4'),_0x49cf61[_0xe445('0xee')]?_0x49cf61[_0xe445('0xee')]:'No\x20timezone');return _0x1362cf;})[_0xe445('0x2c')](function(_0x50813f){logger[_0xe445('0x27')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x49cf61['id'],_0x4fd850['id'],_0x4fd850[_0xe445('0xf0')],util['inspect'](_0x50813f,{'showHidden':![],'depth':null}),_0x49cf61[_0xe445('0xee')]?_0x49cf61[_0xe445('0xee')]:_0xe445('0xf5'));return![];});}exports[_0xe445('0xed')]=function(_0x30f7dd,_0x4db064,_0x1a8ca8){var _0x30c952=0x0;var _0x4a8c88=0x0;var _0x12e1be=![];var _0x5cfa05;var _0x5f25e7;return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x30f7dd[_0xe445('0x5b')]['id']},'include':[{'model':db[_0xe445('0xf6')],'as':'Interval','include':[{'model':db[_0xe445('0xf6')],'as':_0xe445('0xf7'),'attributes':['id',_0xe445('0xf0')],'raw':!![]}]}]})[_0xe445('0x37')](handleEntityNotFound(_0x4db064,null))['then'](function(_0x29498f){if(_0x29498f){_0x5cfa05=_0x29498f;return _0x29498f[_0xe445('0xf8')]({'raw':!![]});}})[_0xe445('0x37')](function(_0x224a54){if(_0x5cfa05){if(_0x224a54){_0x5f25e7=_0x224a54;}}return require(_0xe445('0x16'))[_0xe445('0x77')]();})[_0xe445('0x37')](function(_0x3ef2e0){if(_0x3ef2e0){_0x4a8c88=_0x3ef2e0['virtual'];_0x12e1be=_0x3ef2e0['custom'];}})['then'](function(){return db[_0xe445('0xb2')]['count']({'where':{'closed':![]}});})[_0xe445('0x37')](function(_0x33fd3d){_0x30c952=_0x33fd3d;if(_0x4a8c88&&_0x33fd3d>_0x4a8c88){return db['License'][_0xe445('0x6a')]({'where':{'id':0x1}})[_0xe445('0x37')](function(_0x42f733){if(_0x42f733){_0x42f733['increment']('chatLicenseExceeded');}});}})[_0xe445('0x37')](function(){if(_0x5cfa05[_0xe445('0xf6')]&&_0x5cfa05[_0xe445('0xf6')][_0xe445('0xf7')]){var _0x4a58dd=[];for(var _0x3c2246=0x0;_0x3c2246<_0x5cfa05[_0xe445('0xf6')][_0xe445('0xf7')][_0xe445('0x4c')];_0x3c2246++){var _0x1f8bb9=_0x5cfa05[_0xe445('0xf6')][_0xe445('0xf7')][_0x3c2246][_0xe445('0x39')]({'plain':!![]});_0x4a58dd[_0xe445('0xba')](iftimePromise(_0x1f8bb9,_0x5cfa05));}return BPromise['all'](_0x4a58dd)['then'](function(_0x2bdf1e){return _[_0xe445('0xf9')](_0x2bdf1e);});}else{return!![];}})[_0xe445('0x37')](function(_0x5eb843){var _0x2ae82a=fs[_0xe445('0xcd')](path['join'](config[_0xe445('0x76')],_0xe445('0xfa')),_0xe445('0xcf'));var _0x3bb621={'remote':_0x5cfa05[_0xe445('0xfb')],'query':querystring[_0xe445('0x26')](_[_0xe445('0x54')](_0x5cfa05['get']({'plain':!![]}),{'customerIp':_0x30f7dd[_0xe445('0x87')]['x-forwarded-for']||_0x30f7dd[_0xe445('0x87')]['x-real-ip']||_0x30f7dd[_0xe445('0xfc')][_0xe445('0xfd')]||_0x30f7dd['ip'],'referer':_0x30f7dd[_0xe445('0x87')]['referer'],'openedInteractions':_0x30c952,'maxInteractions':_0x4a8c88,'virtual':_0x12e1be[_0xe445('0xfe')],'online':_0x5eb843,'custom':_0x12e1be}))[_0xe445('0xff')](/'/g,'\x5c\x27')};_0x4db064[_0xe445('0x3d')](ejs[_0xe445('0xd0')](Mustache[_0xe445('0xd0')](_0x2ae82a,_0x3bb621),{'proactiveActions':_0x5f25e7,'alignment':_0x5cfa05[_0xe445('0x100')],'verticalAlignment':_0x5cfa05[_0xe445('0x101')],'div_color':_0x5cfa05[_0xe445('0xeb')],'text_color':_0x5cfa05[_0xe445('0x102')]}));})[_0xe445('0x2c')](handleError(_0x4db064,null));};exports[_0xe445('0x103')]=function(_0x135a64,_0x298614,_0x1448b9){return db['ChatWebsite']['findOne']({'where':{'id':_0x135a64[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x298614,null))['then'](function(_0x2ef658){if(_0x2ef658){return db[_0xe445('0x104')]['transaction'](function(_0x24da82){return db[_0xe445('0x9c')][_0xe445('0x38')]({'where':{'ChatWebsiteId':_0x135a64['params']['id']},'transaction':_0x24da82})['then'](function(_0x7c0cd2){var _0x33e3c1=_[_0xe445('0x46')](_0x135a64[_0xe445('0x5e')],function(_0x2edbac){_0x2edbac['ChatWebsiteId']=_0x135a64[_0xe445('0x5b')]['id'];return _0x2edbac;});return db['ChatApplication']['bulkCreate'](_0x33e3c1,{'transaction':_0x24da82});});})[_0xe445('0x37')](function(){return db[_0xe445('0x9c')][_0xe445('0x105')]({'where':{'ChatWebsiteId':_0x135a64[_0xe445('0x5b')]['id']},'order':_0xe445('0xa1')});});}})[_0xe445('0x37')](respondWithResult(_0x298614,null))[_0xe445('0x2c')](handleError(_0x298614,null));};exports[_0xe445('0x106')]=function(_0x30998a,_0x4c001d,_0x2e57d1){var _0x2844cb={};var _0x2f2027={};var _0x1bec48;var _0x2b7858;return db[_0xe445('0x40')][_0xe445('0x6a')]({'where':{'id':_0x30998a['params']['id']}})['then'](handleEntityNotFound(_0x4c001d,null))[_0xe445('0x37')](function(_0x364b18){if(_0x364b18){_0x1bec48=_0x364b18;_0x2f2027[_0xe445('0x45')]=_[_0xe445('0x48')](db['ChatApplication'][_0xe445('0x41')]);_0x2f2027[_0xe445('0x47')]=_['keys'](_0x30998a[_0xe445('0x47')]);_0x2f2027[_0xe445('0x51')]=_[_0xe445('0x49')](_0x2f2027[_0xe445('0x45')],_0x2f2027[_0xe445('0x47')]);_0x2844cb['attributes']=_[_0xe445('0x49')](_0x2f2027[_0xe445('0x45')],qs[_0xe445('0x4b')](_0x30998a[_0xe445('0x47')]['fields']));_0x2844cb[_0xe445('0x4a')]=_0x2844cb[_0xe445('0x4a')][_0xe445('0x4c')]?_0x2844cb['attributes']:_0x2f2027[_0xe445('0x45')];_0x2844cb['order']=qs[_0xe445('0x50')](_0x30998a[_0xe445('0x47')][_0xe445('0x50')]);_0x2844cb[_0xe445('0x53')]=qs[_0xe445('0x51')](_[_0xe445('0x6b')](_0x30998a['query'],_0x2f2027[_0xe445('0x51')]));if(_0x30998a[_0xe445('0x47')][_0xe445('0x52')]){_0x2844cb[_0xe445('0x53')]=_['merge'](_0x2844cb['where'],{'$or':_['map'](_0x2844cb[_0xe445('0x4a')],function(_0x196723){var _0x1bc8fa={};_0x1bc8fa[_0x196723]={'$like':'%'+_0x30998a[_0xe445('0x47')]['filter']+'%'};return _0x1bc8fa;})});}_0x2844cb=_['merge']({},_0x2844cb,_0x30998a[_0xe445('0x55')]);return _0x1bec48[_0xe445('0x106')](_0x2844cb);}})[_0xe445('0x37')](function(_0xecffd4){if(_0xecffd4){_0x2b7858=_0xecffd4[_0xe445('0x4c')];if(!_0x30998a[_0xe445('0x47')][_0xe445('0x4d')](_0xe445('0x4e'))){_0x2844cb['limit']=qs[_0xe445('0x33')](_0x30998a['query'][_0xe445('0x33')]);_0x2844cb[_0xe445('0x32')]=qs[_0xe445('0x32')](_0x30998a[_0xe445('0x47')]['offset']);}return _0x1bec48[_0xe445('0x106')](_0x2844cb);}})['then'](function(_0x39b33c){if(_0x39b33c){return _0x39b33c?{'count':_0x2b7858,'rows':_0x39b33c}:null;}})[_0xe445('0x37')](respondWithResult(_0x4c001d,null))[_0xe445('0x2c')](handleError(_0x4c001d,null));};exports[_0xe445('0x107')]=function(_0x5240ee,_0x303965,_0x1e40f3){return db['chatProactiveAction'][_0xe445('0x5c')]({'where':{'id':_0x5240ee[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x303965,null))[_0xe445('0x37')](function(_0x5f517b){if(_0x5f517b){return _0x5f517b[_0xe445('0x107')](_0x5240ee[_0xe445('0x5e')]['ids'],_[_0xe445('0xe5')](_0x5240ee[_0xe445('0x5e')],[_0xe445('0x6d'),'id'])||{});}})[_0xe445('0x37')](respondWithResult(_0x303965,null))[_0xe445('0x2c')](handleError(_0x303965,null));};exports[_0xe445('0xf8')]=function(_0x2e71b5,_0x5ebe43,_0x504cdf){var _0x209fd5={};var _0x2672db={};var _0x38dae7;var _0x4cd414;return db[_0xe445('0x40')][_0xe445('0x6a')]({'where':{'id':_0x2e71b5['params']['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x5ebe43,null))[_0xe445('0x37')](function(_0x47604f){if(_0x47604f){_0x38dae7=_0x47604f;_0x2672db[_0xe445('0x45')]=_['keys'](db[_0xe445('0x108')]['rawAttributes']);_0x2672db['query']=_[_0xe445('0x48')](_0x2e71b5['query']);_0x2672db[_0xe445('0x51')]=_['intersection'](_0x2672db['model'],_0x2672db['query']);_0x209fd5[_0xe445('0x4a')]=_[_0xe445('0x49')](_0x2672db[_0xe445('0x45')],qs[_0xe445('0x4b')](_0x2e71b5[_0xe445('0x47')][_0xe445('0x4b')]));_0x209fd5[_0xe445('0x4a')]=_0x209fd5[_0xe445('0x4a')][_0xe445('0x4c')]?_0x209fd5['attributes']:_0x2672db[_0xe445('0x45')];_0x209fd5[_0xe445('0x4f')]=qs[_0xe445('0x50')](_0x2e71b5[_0xe445('0x47')][_0xe445('0x50')]);_0x209fd5[_0xe445('0x53')]=qs[_0xe445('0x51')](_[_0xe445('0x6b')](_0x2e71b5[_0xe445('0x47')],_0x2672db[_0xe445('0x51')]));if(_0x2e71b5[_0xe445('0x47')][_0xe445('0x52')]){_0x209fd5[_0xe445('0x53')]=_[_0xe445('0x54')](_0x209fd5[_0xe445('0x53')],{'$or':_['map'](_0x209fd5[_0xe445('0x4a')],function(_0x1b3673){var _0x43ea4d={};_0x43ea4d[_0x1b3673]={'$like':'%'+_0x2e71b5[_0xe445('0x47')][_0xe445('0x52')]+'%'};return _0x43ea4d;})});}_0x209fd5=_[_0xe445('0x54')]({},_0x209fd5,_0x2e71b5[_0xe445('0x55')]);return _0x38dae7['getProactiveActions'](_0x209fd5);}})['then'](function(_0x4d50d2){if(_0x4d50d2){_0x4cd414=_0x4d50d2[_0xe445('0x4c')];if(!_0x2e71b5[_0xe445('0x47')][_0xe445('0x4d')](_0xe445('0x4e'))){_0x209fd5[_0xe445('0x33')]=qs[_0xe445('0x33')](_0x2e71b5[_0xe445('0x47')][_0xe445('0x33')]);_0x209fd5[_0xe445('0x32')]=qs['offset'](_0x2e71b5[_0xe445('0x47')]['offset']);}return _0x38dae7[_0xe445('0xf8')](_0x209fd5);}})[_0xe445('0x37')](function(_0xc54355){if(_0xc54355){return _0xc54355?{'count':_0x4cd414,'rows':_0xc54355}:null;}})[_0xe445('0x37')](respondWithResult(_0x5ebe43,null))[_0xe445('0x2c')](handleError(_0x5ebe43,null));};exports['getFields']=function(_0x40cdd7,_0x86c9c6,_0x5bce62){var _0xf770a6=_0x40cdd7[_0xe445('0x47')][_0xe445('0x109')]==='false'?_0xe445('0x10a'):_0xe445('0x10b');return db[_0xe445('0x40')][_0xe445('0x5c')]({'attributes':['id',_0xf770a6],'where':{'id':_0x40cdd7[_0xe445('0x5b')]['id']}})['then'](handleEntityNotFound(_0x86c9c6,null))[_0xe445('0x37')](function(_0x35c4d3){if(_0x35c4d3){var _0x2159c0=_0x35c4d3[_0xf770a6];var _0x3be5aa=_0x2159c0&&_0x2159c0[_0xe445('0x10c')]?_0x2159c0[_0xe445('0x10c')]:[];_0x86c9c6['send']({'fromKey':_[_0xe445('0x79')](_0x2159c0[_0xe445('0x10d')])?undefined:_0x2159c0[_0xe445('0x10d')],'count':_0x3be5aa[_0xe445('0x4c')],'rows':_0x3be5aa});}})[_0xe445('0x2c')](handleError(_0x86c9c6,null));};exports[_0xe445('0x10e')]=function(_0x2afc40,_0x389bc4,_0x31f4b0){var _0x50ade8={'raw':![],'where':{}};var _0x38358f={};var _0x4f31bf={'count':0x0,'rows':[]};return db[_0xe445('0x40')][_0xe445('0x6a')]({'where':{'id':_0x2afc40['params']['id']}})['then'](handleEntityNotFound(_0x389bc4,null))[_0xe445('0x37')](function(_0xb206b4){if(_0xb206b4){_0x38358f[_0xe445('0x45')]=_[_0xe445('0x48')](db['ChatOfflineMessage'][_0xe445('0x41')]);_0x38358f[_0xe445('0x47')]=_[_0xe445('0x48')](_0x2afc40[_0xe445('0x47')]);_0x38358f[_0xe445('0x51')]=_[_0xe445('0x49')](_0x38358f[_0xe445('0x45')],_0x38358f['query']);_0x50ade8['attributes']=_[_0xe445('0x49')](_0x38358f[_0xe445('0x45')],qs[_0xe445('0x4b')](_0x2afc40[_0xe445('0x47')][_0xe445('0x4b')]));_0x50ade8[_0xe445('0x4a')]=_0x50ade8['attributes'][_0xe445('0x4c')]?_0x50ade8['attributes']:_0x38358f['model'];if(!_0x2afc40[_0xe445('0x47')][_0xe445('0x4d')]('nolimit')){_0x50ade8['limit']=qs[_0xe445('0x33')](_0x2afc40[_0xe445('0x47')][_0xe445('0x33')]);_0x50ade8['offset']=qs[_0xe445('0x32')](_0x2afc40['query'][_0xe445('0x32')]);}_0x50ade8[_0xe445('0x4f')]=qs[_0xe445('0x50')](_0x2afc40[_0xe445('0x47')][_0xe445('0x50')]);_0x50ade8[_0xe445('0x53')]=qs['filters'](_['pick'](_0x2afc40[_0xe445('0x47')],_0x38358f[_0xe445('0x51')]));_0x50ade8['where']['ChatWebsiteId']=_0xb206b4['id'];if(_0x2afc40['query']['filter']){_0x50ade8[_0xe445('0x53')]=_[_0xe445('0x54')](_0x50ade8[_0xe445('0x53')],{'$or':_[_0xe445('0x46')](_0x50ade8[_0xe445('0x4a')],function(_0x1d5c3e){var _0x4ead42={};_0x4ead42[_0x1d5c3e]={'$like':'%'+_0x2afc40[_0xe445('0x47')][_0xe445('0x52')]+'%'};return _0x4ead42;})});}_0x50ade8=_[_0xe445('0x54')]({},_0x50ade8,_0x2afc40[_0xe445('0x55')]);return db[_0xe445('0xd2')]['count']({'where':_0x50ade8[_0xe445('0x53')]})[_0xe445('0x37')](function(_0x39ad01){_0x4f31bf[_0xe445('0x31')]=_0x39ad01;if(_0x2afc40['query']['includeAll']){_0x50ade8[_0xe445('0x57')]=[{'all':!![]}];}else{_0x50ade8[_0xe445('0x57')]=[{'model':db[_0xe445('0x89')],'as':'Contact','required':![]}];}return db[_0xe445('0xd2')][_0xe445('0x58')](_0x50ade8);})['then'](function(_0x4814ee){_0x4f31bf['rows']=_0x4814ee;return _0x4f31bf;});}})[_0xe445('0x37')](respondWithFilteredResult(_0x389bc4,_0x50ade8))[_0xe445('0x2c')](handleError(_0x389bc4,null));};exports['addAgents']=function(_0x35e8e1,_0x4effeb,_0x22ccf9){return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x35e8e1[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x4effeb,null))[_0xe445('0x37')](function(_0x1b1fa3){if(_0x1b1fa3){return _0x1b1fa3[_0xe445('0x10f')](_0x35e8e1[_0xe445('0x5e')][_0xe445('0x6d')],_[_0xe445('0xe5')](_0x35e8e1[_0xe445('0x5e')],[_0xe445('0x6d'),'id'])||{})[_0xe445('0xb6')](function(_0x203e6d){for(var _0x19db50=0x0;_0x19db50<_0x35e8e1[_0xe445('0x5e')][_0xe445('0x6d')][_0xe445('0x4c')];_0x19db50+=0x1){socket['emit'](_0xe445('0x110'),{'UserId':_0x35e8e1[_0xe445('0x5e')][_0xe445('0x6d')][_0x19db50],'ChatWebsiteId':_0x35e8e1[_0xe445('0x5b')]['id']});}return _0x203e6d;});}})['then'](respondWithResult(_0x4effeb,null))[_0xe445('0x2c')](handleError(_0x4effeb,null));};exports[_0xe445('0x111')]=function(_0x1b0cc3,_0x218607,_0x482c52){return db[_0xe445('0x40')][_0xe445('0x5c')]({'where':{'id':_0x1b0cc3[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x218607,null))['then'](function(_0x169c12){if(_0x169c12){return _0x169c12['removeAgents'](_0x1b0cc3[_0xe445('0x47')][_0xe445('0x6d')])[_0xe445('0x37')](function(){if(_['isArray'](_0x1b0cc3['query'][_0xe445('0x6d')])){for(var _0x16f44a=0x0;_0x16f44a<_0x1b0cc3[_0xe445('0x47')][_0xe445('0x6d')]['length'];_0x16f44a+=0x1){socket[_0xe445('0x112')](_0xe445('0x113'),{'UserId':Number(_0x1b0cc3['query'][_0xe445('0x6d')][_0x16f44a]),'ChatWebsiteId':Number(_0x1b0cc3['params']['id'])});}}else{socket[_0xe445('0x112')](_0xe445('0x113'),{'UserId':Number(_0x1b0cc3['query'][_0xe445('0x6d')]),'ChatWebsiteId':Number(_0x1b0cc3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x218607,null))[_0xe445('0x2c')](handleError(_0x218607,null));};exports[_0xe445('0x114')]=function(_0x5cab88,_0x167b40,_0x4b05b4){var _0x245ffc={};var _0x544fcb={};var _0x3ca7af;var _0x5f3deb;return db[_0xe445('0x40')][_0xe445('0x6a')]({'where':{'id':_0x5cab88[_0xe445('0x5b')]['id']}})[_0xe445('0x37')](handleEntityNotFound(_0x167b40,null))[_0xe445('0x37')](function(_0xa74a88){if(_0xa74a88){_0x3ca7af=_0xa74a88;_0x544fcb[_0xe445('0x45')]=_['keys'](db[_0xe445('0xbf')][_0xe445('0x41')]);_0x544fcb[_0xe445('0x47')]=_[_0xe445('0x48')](_0x5cab88[_0xe445('0x47')]);_0x544fcb['filters']=_['intersection'](_0x544fcb[_0xe445('0x45')],_0x544fcb[_0xe445('0x47')]);_0x245ffc[_0xe445('0x4a')]=_[_0xe445('0x49')](_0x544fcb['model'],qs[_0xe445('0x4b')](_0x5cab88[_0xe445('0x47')][_0xe445('0x4b')]));_0x245ffc[_0xe445('0x4a')]=_0x245ffc[_0xe445('0x4a')]['length']?_0x245ffc[_0xe445('0x4a')]:_0x544fcb[_0xe445('0x45')];_0x245ffc['order']=qs[_0xe445('0x50')](_0x5cab88[_0xe445('0x47')][_0xe445('0x50')]);_0x245ffc[_0xe445('0x53')]=qs['filters'](_[_0xe445('0x6b')](_0x5cab88[_0xe445('0x47')],_0x544fcb[_0xe445('0x51')]));if(_0x5cab88[_0xe445('0x47')][_0xe445('0x52')]){_0x245ffc[_0xe445('0x53')]=_[_0xe445('0x54')](_0x245ffc[_0xe445('0x53')],{'$or':_[_0xe445('0x46')](_0x245ffc[_0xe445('0x4a')],function(_0xad633b){var _0x5a5202={};_0x5a5202[_0xad633b]={'$like':'%'+_0x5cab88[_0xe445('0x47')][_0xe445('0x52')]+'%'};return _0x5a5202;})});}_0x245ffc=_[_0xe445('0x54')]({},_0x245ffc,_0x5cab88['options']);return _0x3ca7af['getAgents'](_0x245ffc);}})[_0xe445('0x37')](function(_0x16a8c2){if(_0x16a8c2){_0x5f3deb=_0x16a8c2[_0xe445('0x4c')];if(!_0x5cab88[_0xe445('0x47')]['hasOwnProperty'](_0xe445('0x4e'))){_0x245ffc[_0xe445('0x33')]=qs['limit'](_0x5cab88[_0xe445('0x47')][_0xe445('0x33')]);_0x245ffc[_0xe445('0x32')]=qs['offset'](_0x5cab88['query']['offset']);}return _0x3ca7af[_0xe445('0x114')](_0x245ffc);}})[_0xe445('0x37')](function(_0x4b5ff0){if(_0x4b5ff0){return _0x4b5ff0?{'count':_0x5f3deb,'rows':_0x4b5ff0}:null;}})['then'](respondWithResult(_0x167b40,null))[_0xe445('0x2c')](handleError(_0x167b40,null));}; \ No newline at end of file +var _0x2a39=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','count','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','getResult','Sequelize','ValidationError','difference','createdAt','updatedAt','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','Applications','account','applications','orderBy','priority','asc','ListId','contact','customerIp','headers','cf-connecting-ip','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','close','unmanaged','*,*,*,*','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','no\x20available\x20attributes','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','readFileSync','utf8','render','toPairs','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','x-forwarded-for','x-real-ip','replace','alignment','verticalAlignment','addApplications','sequelize','transaction','ChatApplication','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','destroy','ChatWebsites','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','show','params','Pause','length','catch'];(function(_0x5f115e,_0x97497f){var _0x12187c=function(_0xedc797){while(--_0xedc797){_0x5f115e['push'](_0x5f115e['shift']());}};_0x12187c(++_0x97497f);}(_0x2a39,0x1e3));var _0x92a3=function(_0x235884,_0x1c4355){_0x235884=_0x235884-0x0;var _0x211158=_0x2a39[_0x235884];return _0x211158;};'use strict';var pdf=require(_0x92a3('0x0'));var emlformat=require(_0x92a3('0x1'));var rimraf=require(_0x92a3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92a3('0x3'));var rp=require(_0x92a3('0x4'));var moment=require(_0x92a3('0x5'));var BPromise=require(_0x92a3('0x6'));var Mustache=require(_0x92a3('0x7'));var util=require(_0x92a3('0x8'));var path=require(_0x92a3('0x9'));var sox=require('sox');var csv=require(_0x92a3('0xa'));var ejs=require(_0x92a3('0xb'));var fs=require('fs');var _=require(_0x92a3('0xc'));var squel=require(_0x92a3('0xd'));var crypto=require(_0x92a3('0xe'));var jsforce=require(_0x92a3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x92a3('0xa'));var querystring=require(_0x92a3('0x10'));var Papa=require('papaparse');var Redis=require(_0x92a3('0x11'));var authService=require(_0x92a3('0x12'));var qs=require(_0x92a3('0x13'));var as=require(_0x92a3('0x14'));var hardwareService=require(_0x92a3('0x15'));var logger=require(_0x92a3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x92a3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x92a3('0x18'))['db'];config[_0x92a3('0x19')]=_[_0x92a3('0x1a')](config[_0x92a3('0x19')],{'host':_0x92a3('0x1b'),'port':0x18eb});var socket=require(_0x92a3('0x1c'))(new Redis(config[_0x92a3('0x19')]));require('./chatWebsite.socket')[_0x92a3('0x1d')](socket);var jayson=require(_0x92a3('0x1e'));var client=jayson['client'][_0x92a3('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x92a3('0x20')][_0x92a3('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x2a993d,_0x3c6ef8,_0x436085,_0x18b8c5){return new BPromise(function(_0x463670,_0x4caf2a){var _0x17648d=_0x18b8c5||client;return _0x17648d[_0x92a3('0x21')](_0x2a993d,_0x436085)[_0x92a3('0x22')](function(_0x1e9743){logger[_0x92a3('0x23')](_0x92a3('0x24'),_0x3c6ef8,'request\x20sent');logger['debug'](_0x92a3('0x25'),_0x3c6ef8,'request\x20sent',JSON[_0x92a3('0x26')](_0x1e9743));if(_0x1e9743[_0x92a3('0x27')]){if(_0x1e9743['error'][_0x92a3('0x28')]===0x1f4){logger[_0x92a3('0x27')](_0x92a3('0x24'),_0x3c6ef8,_0x1e9743['error'][_0x92a3('0x29')]);return _0x4caf2a(_0x1e9743[_0x92a3('0x27')][_0x92a3('0x29')]);}logger[_0x92a3('0x27')](_0x92a3('0x24'),_0x3c6ef8,_0x1e9743['error'][_0x92a3('0x29')]);return _0x463670(_0x1e9743['error'][_0x92a3('0x29')]);}else{logger[_0x92a3('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x3c6ef8,_0x92a3('0x2a'));_0x463670(_0x1e9743[_0x92a3('0x2b')]['message']);}})['catch'](function(_0x576516){logger[_0x92a3('0x27')](_0x92a3('0x24'),_0x3c6ef8,_0x576516);_0x4caf2a(_0x576516);});});}function respondWithStatusCode(_0x10d0c6,_0x53ed7d){_0x53ed7d=_0x53ed7d||0xcc;return function(_0x419f11){if(_0x419f11){return _0x10d0c6[_0x92a3('0x2c')](_0x53ed7d);}return _0x10d0c6[_0x92a3('0x2d')](_0x53ed7d)[_0x92a3('0x2e')]();};}function respondWithResult(_0x30e0a0,_0x230dc6){_0x230dc6=_0x230dc6||0xc8;return function(_0x49d5b3){if(_0x49d5b3){return _0x30e0a0['status'](_0x230dc6)[_0x92a3('0x2f')](_0x49d5b3);}};}function respondWithFilteredResult(_0x485977,_0x16db82){return function(_0x2cba72){if(_0x2cba72){var _0x37d3dc=_0x2cba72['count'],_0x510ceb=_0x16db82[_0x92a3('0x30')],_0x4ba255=_0x16db82[_0x92a3('0x30')]+_0x16db82[_0x92a3('0x31')],_0x4b791e;if(_0x4ba255>=_0x37d3dc){_0x4ba255=_0x37d3dc;_0x4b791e=0xc8;}else{_0x4b791e=0xce;}_0x485977[_0x92a3('0x2d')](_0x4b791e);return _0x485977['set'](_0x92a3('0x32'),_0x510ceb+'-'+_0x4ba255+'/'+_0x37d3dc)[_0x92a3('0x2f')](_0x2cba72);}return null;};}function patchUpdates(_0x4d99fa){return function(_0x1cea3e){try{jsonpatch[_0x92a3('0x33')](_0x1cea3e,_0x4d99fa,!![]);}catch(_0x2bb9b5){return BPromise[_0x92a3('0x34')](_0x2bb9b5);}return _0x1cea3e[_0x92a3('0x35')]();};}function saveUpdates(_0x2fb9a0,_0x5067c4){return function(_0x22675c){if(_0x22675c){return _0x22675c['update'](_0x2fb9a0)[_0x92a3('0x22')](function(_0x1ec9cb){return _0x1ec9cb;});}return null;};}function removeEntity(_0x4b9dbd,_0x15bbe1){return function(_0x215acd){if(_0x215acd){return _0x215acd[_0x92a3('0x36')]()[_0x92a3('0x22')](function(){var _0x4ca247=_0x215acd['get']({'plain':!![]});var _0xc44233=_0x92a3('0x37');return db[_0x92a3('0x38')][_0x92a3('0x36')]({'where':{'type':_0xc44233,'resourceId':_0x4ca247['id']}})[_0x92a3('0x22')](function(){return _0x215acd;});})['then'](function(){_0x4b9dbd[_0x92a3('0x2d')](0xcc)[_0x92a3('0x2e')]();});}};}function handleEntityNotFound(_0x480bf1,_0x5c16af){return function(_0x11989e){if(!_0x11989e){_0x480bf1['sendStatus'](0x194);}return _0x11989e;};}function handleError(_0x2ccc17,_0x4c83f4){_0x4c83f4=_0x4c83f4||0x1f4;return function(_0x47a170){logger[_0x92a3('0x27')](_0x47a170[_0x92a3('0x39')]);if(_0x47a170[_0x92a3('0x3a')]){delete _0x47a170[_0x92a3('0x3a')];}_0x2ccc17['status'](_0x4c83f4)[_0x92a3('0x3b')](_0x47a170);};}exports[_0x92a3('0x3c')]=function(_0x441e80,_0x2aecb3){var _0x5b7d80={'include':[{'model':db['Pause'],'as':_0x92a3('0x3d')}]},_0x214a68={},_0x224148={'count':0x0,'rows':[]};var _0xe5fd47=_[_0x92a3('0x3e')](db['ChatWebsite'][_0x92a3('0x3f')],function(_0x54ad2f){return{'name':_0x54ad2f[_0x92a3('0x40')],'type':_0x54ad2f[_0x92a3('0x41')]['key']};});_0x214a68[_0x92a3('0x42')]=_['map'](_0xe5fd47,'name');_0x214a68[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x441e80['query']);_0x214a68['filters']=_[_0x92a3('0x45')](_0x214a68[_0x92a3('0x42')],_0x214a68[_0x92a3('0x43')]);_0x5b7d80['attributes']=_[_0x92a3('0x45')](_0x214a68['model'],qs[_0x92a3('0x46')](_0x441e80[_0x92a3('0x43')][_0x92a3('0x46')]));_0x5b7d80['attributes']=_0x5b7d80[_0x92a3('0x47')]['length']?_0x5b7d80[_0x92a3('0x47')]:_0x214a68[_0x92a3('0x42')];if(!_0x441e80['query'][_0x92a3('0x48')](_0x92a3('0x49'))){_0x5b7d80['limit']=qs[_0x92a3('0x31')](_0x441e80['query'][_0x92a3('0x31')]);_0x5b7d80[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x441e80[_0x92a3('0x43')]['offset']);}_0x5b7d80[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x441e80[_0x92a3('0x43')][_0x92a3('0x4b')]);_0x5b7d80[_0x92a3('0x4c')]=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x441e80[_0x92a3('0x43')],_0x214a68['filters']),_0xe5fd47);if(_0x441e80[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x5b7d80['where']=_[_0x92a3('0x50')](_0x5b7d80[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0xe5fd47,function(_0x2688dd){if(_0x2688dd[_0x92a3('0x41')]!==_0x92a3('0x51')){var _0x3565ec={};_0x3565ec[_0x2688dd[_0x92a3('0x3a')]]={'$like':'%'+_0x441e80[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x3565ec;}})});}_0x5b7d80=_[_0x92a3('0x50')]({},_0x5b7d80,_0x441e80[_0x92a3('0x52')]);var _0x1fa9c4={'where':_0x5b7d80[_0x92a3('0x4c')]};return db[_0x92a3('0x53')]['count'](_0x1fa9c4)[_0x92a3('0x22')](function(_0x30b111){_0x224148['count']=_0x30b111;if(_0x441e80['query'][_0x92a3('0x54')]){_0x5b7d80[_0x92a3('0x55')]=[{'all':!![]}];}return db[_0x92a3('0x53')][_0x92a3('0x56')](_0x5b7d80);})[_0x92a3('0x22')](function(_0x2d3d5a){_0x224148[_0x92a3('0x57')]=_0x2d3d5a;return _0x224148;})[_0x92a3('0x22')](respondWithFilteredResult(_0x2aecb3,_0x5b7d80))['catch'](handleError(_0x2aecb3,null));};exports[_0x92a3('0x58')]=function(_0x100b76,_0x208827){var _0x3ff344={'raw':![],'where':{'id':_0x100b76[_0x92a3('0x59')]['id']},'include':[{'model':db[_0x92a3('0x5a')],'as':'mandatoryDispositionPause'}]},_0x36b619={};_0x36b619[_0x92a3('0x42')]=_[_0x92a3('0x44')](db[_0x92a3('0x53')][_0x92a3('0x3f')]);_0x36b619['query']=_['keys'](_0x100b76[_0x92a3('0x43')]);_0x36b619['filters']=_[_0x92a3('0x45')](_0x36b619[_0x92a3('0x42')],_0x36b619['query']);_0x3ff344['attributes']=_['intersection'](_0x36b619[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x100b76[_0x92a3('0x43')]['fields']));_0x3ff344[_0x92a3('0x47')]=_0x3ff344[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x3ff344[_0x92a3('0x47')]:_0x36b619[_0x92a3('0x42')];if(_0x100b76[_0x92a3('0x43')][_0x92a3('0x54')]){_0x3ff344[_0x92a3('0x55')]=[{'all':!![]}];}_0x3ff344=_['merge']({},_0x3ff344,_0x100b76['options']);return db[_0x92a3('0x53')]['find'](_0x3ff344)[_0x92a3('0x22')](handleEntityNotFound(_0x208827,null))[_0x92a3('0x22')](respondWithResult(_0x208827,null))[_0x92a3('0x5c')](handleError(_0x208827,null));};exports['create']=function(_0x71f05e,_0x40a5ed){return db[_0x92a3('0x53')][_0x92a3('0x5d')](_0x71f05e[_0x92a3('0x5e')],{})[_0x92a3('0x22')](function(_0x3fdc5e){var _0x66e80a=_0x71f05e[_0x92a3('0x5f')][_0x92a3('0x60')]({'plain':!![]});if(!_0x66e80a)throw new Error(_0x92a3('0x61'));if(_0x66e80a[_0x92a3('0x62')]===_0x92a3('0x5f')){var _0x441c4f=_0x3fdc5e[_0x92a3('0x60')]({'plain':!![]});var _0x1c6c75=_0x92a3('0x37');return db[_0x92a3('0x63')]['find']({'where':{'name':_0x1c6c75,'userProfileId':_0x66e80a[_0x92a3('0x64')]},'raw':!![]})['then'](function(_0x265c4f){if(_0x265c4f&&_0x265c4f['autoAssociation']===0x0){return db[_0x92a3('0x38')][_0x92a3('0x5d')]({'name':_0x441c4f['name'],'resourceId':_0x441c4f['id'],'type':_0x265c4f[_0x92a3('0x3a')],'sectionId':_0x265c4f['id']},{})['then'](function(){return _0x3fdc5e;});}else{return _0x3fdc5e;}})[_0x92a3('0x5c')](function(_0x4a3329){logger[_0x92a3('0x27')](_0x92a3('0x65'),_0x4a3329);throw _0x4a3329;});}return _0x3fdc5e;})[_0x92a3('0x22')](respondWithResult(_0x40a5ed,0xc9))[_0x92a3('0x5c')](handleError(_0x40a5ed,null));};exports[_0x92a3('0x66')]=function(_0x53b332,_0x2812a8){if(_0x53b332[_0x92a3('0x5e')]['id']){delete _0x53b332['body']['id'];}return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x53b332[_0x92a3('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x92a3('0x3d')}]})[_0x92a3('0x22')](handleEntityNotFound(_0x2812a8,null))['then'](saveUpdates(_0x53b332[_0x92a3('0x5e')],null))[_0x92a3('0x22')](respondWithResult(_0x2812a8,null))[_0x92a3('0x5c')](handleError(_0x2812a8,null));};exports[_0x92a3('0x36')]=function(_0x29d0c1,_0x18ee24){return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x29d0c1['params']['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x18ee24,null))['then'](removeEntity(_0x18ee24,null))[_0x92a3('0x5c')](handleError(_0x18ee24,null));};exports[_0x92a3('0x68')]=function(_0x3c8363,_0x550534){return db[_0x92a3('0x53')][_0x92a3('0x68')]()[_0x92a3('0x22')](respondWithResult(_0x550534,null))[_0x92a3('0x5c')](handleError(_0x550534,null));};exports[_0x92a3('0x69')]=function(_0x4cbf71,_0x30c35f,_0x2b266f){if(_0x4cbf71[_0x92a3('0x5e')]['id']){delete _0x4cbf71[_0x92a3('0x5e')]['id'];}return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x4cbf71[_0x92a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x30c35f,null))['then'](function(_0x12407b){if(_0x12407b){_0x4cbf71[_0x92a3('0x5e')][_0x92a3('0x6a')]=_0x12407b['id'];return db[_0x92a3('0x6b')][_0x92a3('0x5d')](_0x4cbf71[_0x92a3('0x5e')]);}})[_0x92a3('0x22')](respondWithResult(_0x30c35f,null))[_0x92a3('0x5c')](handleError(_0x30c35f,null));};exports[_0x92a3('0x6c')]=function(_0x3df64b,_0x55d02f,_0x511283){var _0x160505={'raw':![],'where':{}};var _0x2b2a83={};var _0x357743={'count':0x0,'rows':[]};return db[_0x92a3('0x53')]['findOne']({'where':{'id':_0x3df64b[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x55d02f,null))[_0x92a3('0x22')](function(_0x8afd7f){if(_0x8afd7f){_0x2b2a83[_0x92a3('0x42')]=_['keys'](db[_0x92a3('0x6b')][_0x92a3('0x3f')]);_0x2b2a83[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x3df64b['query']);_0x2b2a83[_0x92a3('0x4d')]=_['intersection'](_0x2b2a83[_0x92a3('0x42')],_0x2b2a83[_0x92a3('0x43')]);_0x160505[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x2b2a83[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x3df64b['query']['fields']));_0x160505[_0x92a3('0x47')]=_0x160505[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x160505[_0x92a3('0x47')]:_0x2b2a83[_0x92a3('0x42')];if(!_0x3df64b[_0x92a3('0x43')]['hasOwnProperty']('nolimit')){_0x160505[_0x92a3('0x31')]=qs[_0x92a3('0x31')](_0x3df64b[_0x92a3('0x43')][_0x92a3('0x31')]);_0x160505[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x3df64b[_0x92a3('0x43')]['offset']);}_0x160505[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x3df64b['query'][_0x92a3('0x4b')]);_0x160505['where']=qs['filters'](_['pick'](_0x3df64b[_0x92a3('0x43')],_0x2b2a83[_0x92a3('0x4d')]));_0x160505['where'][_0x92a3('0x6a')]=_0x8afd7f['id'];if(_0x3df64b['query'][_0x92a3('0x4f')]){_0x160505[_0x92a3('0x4c')]=_['merge'](_0x160505[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x160505[_0x92a3('0x47')],function(_0x62b874){var _0x2a170f={};_0x2a170f[_0x62b874]={'$like':'%'+_0x3df64b[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x2a170f;})});}_0x160505=_[_0x92a3('0x50')]({},_0x160505,_0x3df64b[_0x92a3('0x52')]);return db[_0x92a3('0x6b')][_0x92a3('0x6d')]({'where':_0x160505[_0x92a3('0x4c')]})['then'](function(_0x5c71a1){_0x357743['count']=_0x5c71a1;if(_0x3df64b['query'][_0x92a3('0x54')]){_0x160505[_0x92a3('0x55')]=[{'all':!![]}];}return db[_0x92a3('0x6b')][_0x92a3('0x56')](_0x160505);})[_0x92a3('0x22')](function(_0x37f350){_0x357743[_0x92a3('0x57')]=_0x37f350;return _0x357743;});}})[_0x92a3('0x22')](respondWithFilteredResult(_0x55d02f,_0x160505))[_0x92a3('0x5c')](handleError(_0x55d02f,null));};exports[_0x92a3('0x6e')]=function(_0x38de40,_0x535611,_0x298c43){return db['ChatWebsite'][_0x92a3('0x67')]({'where':{'id':_0x38de40[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x535611,null))['then'](function(_0x117f05){if(_0x117f05){return _0x117f05[_0x92a3('0x6e')](_0x38de40['query'][_0x92a3('0x6f')]);}})[_0x92a3('0x22')](respondWithStatusCode(_0x535611,null))[_0x92a3('0x5c')](handleError(_0x535611,null));};exports[_0x92a3('0x70')]=function(_0x8c6cd2,_0x4314f9,_0x11caa9){if(_0x8c6cd2[_0x92a3('0x5e')]['id']){delete _0x8c6cd2[_0x92a3('0x5e')]['id'];}return db[_0x92a3('0x53')]['find']({'where':{'id':_0x8c6cd2['params']['id']}})['then'](handleEntityNotFound(_0x4314f9,null))['then'](function(_0x4d8fad){if(_0x4d8fad){_0x8c6cd2[_0x92a3('0x5e')][_0x92a3('0x6a')]=_0x4d8fad['id'];return db[_0x92a3('0x71')][_0x92a3('0x5d')](_0x8c6cd2['body']);}})['then'](respondWithResult(_0x4314f9,null))[_0x92a3('0x5c')](handleError(_0x4314f9,null));};exports['getAnswers']=function(_0x2b8376,_0x5496cf,_0x246c62){var _0x464672={'raw':![],'where':{}};var _0x438c91={};var _0x44f909={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x92a3('0x72')]({'where':{'id':_0x2b8376[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x5496cf,null))['then'](function(_0x109f39){if(_0x109f39){_0x438c91[_0x92a3('0x42')]=_[_0x92a3('0x44')](db['CannedAnswer'][_0x92a3('0x3f')]);_0x438c91[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x2b8376[_0x92a3('0x43')]);_0x438c91[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x438c91[_0x92a3('0x42')],_0x438c91['query']);_0x464672[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x438c91['model'],qs['fields'](_0x2b8376[_0x92a3('0x43')][_0x92a3('0x46')]));_0x464672[_0x92a3('0x47')]=_0x464672[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x464672[_0x92a3('0x47')]:_0x438c91[_0x92a3('0x42')];if(!_0x2b8376[_0x92a3('0x43')][_0x92a3('0x48')](_0x92a3('0x49'))){_0x464672[_0x92a3('0x31')]=qs['limit'](_0x2b8376[_0x92a3('0x43')][_0x92a3('0x31')]);_0x464672['offset']=qs[_0x92a3('0x30')](_0x2b8376['query']['offset']);}_0x464672['order']=qs[_0x92a3('0x4b')](_0x2b8376[_0x92a3('0x43')][_0x92a3('0x4b')]);_0x464672[_0x92a3('0x4c')]=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x2b8376[_0x92a3('0x43')],_0x438c91[_0x92a3('0x4d')]));_0x464672[_0x92a3('0x4c')][_0x92a3('0x6a')]=_0x109f39['id'];if(_0x2b8376[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x464672[_0x92a3('0x4c')]=_[_0x92a3('0x50')](_0x464672['where'],{'$or':_[_0x92a3('0x3e')](_0x464672[_0x92a3('0x47')],function(_0x354cdc){var _0x500259={};_0x500259[_0x354cdc]={'$like':'%'+_0x2b8376[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x500259;})});}_0x464672=_[_0x92a3('0x50')]({},_0x464672,_0x2b8376['options']);return db[_0x92a3('0x71')][_0x92a3('0x6d')]({'where':_0x464672[_0x92a3('0x4c')]})[_0x92a3('0x22')](function(_0x3dace1){_0x44f909['count']=_0x3dace1;if(_0x2b8376[_0x92a3('0x43')][_0x92a3('0x54')]){_0x464672['include']=[{'all':!![]}];}return db[_0x92a3('0x71')]['findAll'](_0x464672);})[_0x92a3('0x22')](function(_0x4e0c21){_0x44f909[_0x92a3('0x57')]=_0x4e0c21;return _0x44f909;});}})['then'](respondWithFilteredResult(_0x5496cf,_0x464672))[_0x92a3('0x5c')](handleError(_0x5496cf,null));};exports[_0x92a3('0x73')]=function(_0xf76327,_0x4e85eb,_0x5ba108){return db['ChatWebsite'][_0x92a3('0x67')]({'where':{'id':_0xf76327[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x4e85eb,null))[_0x92a3('0x22')](function(_0x5858f3){if(_0x5858f3){return _0x5858f3[_0x92a3('0x73')](_0xf76327['query'][_0x92a3('0x6f')]);}})[_0x92a3('0x22')](respondWithStatusCode(_0x4e85eb,null))[_0x92a3('0x5c')](handleError(_0x4e85eb,null));};exports[_0x92a3('0x74')]=function(_0x17e1a1,_0x2ea600,_0x1945dc){_0x17e1a1[_0x92a3('0x5e')]['sitepic']=_0x17e1a1[_0x92a3('0x75')][_0x92a3('0x76')];return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x17e1a1[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x2ea600,null))[_0x92a3('0x22')](saveUpdates(_0x17e1a1['body'],null))[_0x92a3('0x22')](respondWithResult(_0x2ea600,null))[_0x92a3('0x5c')](handleError(_0x2ea600,null));};exports['addAvatar']=function(_0x2525b5,_0x969363,_0x2ed84c){_0x2525b5[_0x92a3('0x5e')][_0x92a3('0x77')]=_0x2525b5[_0x92a3('0x75')][_0x92a3('0x76')];return db[_0x92a3('0x53')]['find']({'where':{'id':_0x2525b5[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x969363,null))[_0x92a3('0x22')](saveUpdates(_0x2525b5['body'],null))[_0x92a3('0x22')](respondWithResult(_0x969363,null))[_0x92a3('0x5c')](handleError(_0x969363,null));};exports[_0x92a3('0x78')]=function(_0x5d1e87,_0x3483ab,_0x1024c9){_0x5d1e87['body'][_0x92a3('0x79')]=_0x5d1e87[_0x92a3('0x75')][_0x92a3('0x76')];return db['ChatWebsite'][_0x92a3('0x67')]({'where':{'id':_0x5d1e87[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x3483ab,null))[_0x92a3('0x22')](saveUpdates(_0x5d1e87[_0x92a3('0x5e')],null))['then'](respondWithResult(_0x3483ab,null))[_0x92a3('0x5c')](handleError(_0x3483ab,null));};exports[_0x92a3('0x7a')]=function(_0x54c64f,_0x70c26,_0x4882b9){_0x54c64f['body'][_0x92a3('0x7b')]=_0x54c64f[_0x92a3('0x75')][_0x92a3('0x76')];return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x54c64f[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x70c26,null))[_0x92a3('0x22')](saveUpdates(_0x54c64f[_0x92a3('0x5e')],null))[_0x92a3('0x22')](respondWithResult(_0x70c26,null))[_0x92a3('0x5c')](handleError(_0x70c26,null));};exports[_0x92a3('0x7c')]=function(_0x20471e,_0x725b43,_0x362f64){var _0x3243e1=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x7f'));var _0x1d6db7={'where':{'id':_0x20471e['params']['id']},'attributes':['id',_0x92a3('0x80')],'raw':!![]};var _0x3607d4=![];return require(_0x92a3('0x81'))[_0x92a3('0x82')]()[_0x92a3('0x22')](function(_0x1fff18){if(_0x1fff18){_0x3607d4=_0x1fff18['custom'];}})[_0x92a3('0x22')](function(){return db[_0x92a3('0x53')][_0x92a3('0x67')](_0x1d6db7);})['then'](handleEntityNotFound(_0x725b43,null))['then'](function(_0x33b409){if(_0x33b409){if(!_[_0x92a3('0x83')](_0x33b409[_0x92a3('0x80')])){if(fs['existsSync'](path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x84'),_0x33b409['sitepic']))&&_0x3607d4){_0x3243e1=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x84'),_0x33b409[_0x92a3('0x80')]);}}return _0x725b43[_0x92a3('0x85')](_0x3243e1);}})[_0x92a3('0x5c')](handleError(_0x725b43,null));};exports[_0x92a3('0x86')]=function(_0x239b43,_0x8b448f,_0x4024ba){var _0xbb90f5=path['join'](config[_0x92a3('0x7e')],_0x92a3('0x87'));var _0x36cd88={'where':{'id':_0x239b43[_0x92a3('0x59')]['id']},'attributes':['id',_0x92a3('0x77')],'raw':!![]};return db[_0x92a3('0x53')][_0x92a3('0x67')](_0x36cd88)[_0x92a3('0x22')](handleEntityNotFound(_0x8b448f,null))[_0x92a3('0x22')](function(_0x5edf31){if(_0x5edf31){if(!_[_0x92a3('0x83')](_0x5edf31[_0x92a3('0x77')])){if(fs[_0x92a3('0x88')](path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x89'),_0x5edf31[_0x92a3('0x77')]))){_0xbb90f5=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x89'),_0x5edf31[_0x92a3('0x77')]);}}return _0x8b448f['download'](_0xbb90f5);}})['catch'](handleError(_0x8b448f,null));};exports[_0x92a3('0x8a')]=function(_0x3fbea6,_0x367451,_0x26d8ac){var _0x42d106=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x8b'));var _0x369065={'where':{'id':_0x3fbea6[_0x92a3('0x59')]['id']},'attributes':['id',_0x92a3('0x79'),_0x92a3('0x8c')],'raw':!![]};return db['ChatWebsite'][_0x92a3('0x67')](_0x369065)[_0x92a3('0x22')](handleEntityNotFound(_0x367451,null))[_0x92a3('0x22')](function(_0x59a195){if(_0x59a195){if(!_[_0x92a3('0x83')](_0x59a195[_0x92a3('0x79')])){if(fs[_0x92a3('0x88')](path[_0x92a3('0x7d')](config['root'],_0x92a3('0x89'),_0x59a195[_0x92a3('0x79')]))&&_0x59a195[_0x92a3('0x8c')]){_0x42d106=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x89'),_0x59a195[_0x92a3('0x79')]);}}return _0x367451[_0x92a3('0x85')](_0x42d106);}})[_0x92a3('0x5c')](handleError(_0x367451,null));};exports[_0x92a3('0x8d')]=function(_0x4ee0cb,_0x144b72,_0x5b503b){var _0x5aa061=path['join'](config[_0x92a3('0x7e')],_0x92a3('0x8e'));var _0x2d8f3e={'where':{'id':_0x4ee0cb[_0x92a3('0x59')]['id']},'attributes':['id',_0x92a3('0x7b')],'raw':!![]};return db[_0x92a3('0x53')][_0x92a3('0x67')](_0x2d8f3e)[_0x92a3('0x22')](handleEntityNotFound(_0x144b72,null))[_0x92a3('0x22')](function(_0xbfe5aa){if(_0xbfe5aa){if(!_[_0x92a3('0x83')](_0xbfe5aa[_0x92a3('0x7b')])){if(fs[_0x92a3('0x88')](path[_0x92a3('0x7d')](config['root'],_0x92a3('0x89'),_0xbfe5aa[_0x92a3('0x7b')]))){_0x5aa061=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],'server/files/images/avatars/',_0xbfe5aa['systemAvatar']);}}return _0x144b72[_0x92a3('0x85')](_0x5aa061);}})['catch'](handleError(_0x144b72,null));};exports['notify']=function(_0x5e05bd,_0x2e234d,_0x3c2316){var _0x52eff0=require(_0x92a3('0x8f'));var _0x5a760=new _0x52eff0();var _0xcf956f=_0x5a760[_0x92a3('0x90')](_0x5e05bd['headers']['user-agent'])[_0x92a3('0x91')]();var _0x2fae58={'body':_0x5e05bd[_0x92a3('0x5e')],'channel':'chat'};var _0x1da915=[];var _0x395295=[];var _0x49ad3b={};var _0x2b3457=![];return db['CmContact'][_0x92a3('0x68')]()[_0x92a3('0x22')](function(_0x1a17ce){if(!_0x1a17ce){throw new db[(_0x92a3('0x92'))][(_0x92a3('0x93'))]('no\x20available\x20attributes');}_0x1da915=_[_0x92a3('0x94')](_[_0x92a3('0x44')](_0x1a17ce),[_0x92a3('0x95'),'updatedAt']);_0x395295=_[_0x92a3('0x94')](_[_0x92a3('0x44')](_0x1a17ce),[_0x92a3('0x95'),_0x92a3('0x96'),'CompanyId','ListId']);if(_0x5e05bd[_0x92a3('0x5e')]['id']){delete _0x5e05bd[_0x92a3('0x5e')]['id'];}if(_['isNil'](_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x97')])){throw new db[(_0x92a3('0x92'))][(_0x92a3('0x93'))]('from\x20is\x20mandatory');}if(_[_0x92a3('0x83')](_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x5e')])||_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x5e')]===''){throw new db[(_0x92a3('0x92'))]['ValidationError'](_0x92a3('0x98'));}if(_[_0x92a3('0x83')](_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x99')])){throw new db[(_0x92a3('0x92'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x395295);}if(!_[_0x92a3('0x9a')](_0x395295,_0x5e05bd['body'][_0x92a3('0x99')])){throw new db['Sequelize'][(_0x92a3('0x93'))](_0x92a3('0x9b')+_0x395295);}_0x49ad3b[_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x99')]]=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x97')];})['then'](function(){return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x5e05bd[_0x92a3('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x92a3('0x9c'),'include':[{'model':db[_0x92a3('0x9d')],'as':_0x92a3('0x9e'),'where':_0x49ad3b,'limit':0x1,'order':[[_0x92a3('0x96'),_0x92a3('0x9f')]]}]},{'model':db['ChatApplication'],'as':_0x92a3('0xa0')}]});})[_0x92a3('0x22')](handleEntityNotFound(_0x2e234d,null))[_0x92a3('0x22')](function(_0x57eb56){if(_0x57eb56&&_0x57eb56[_0x92a3('0x9c')]){_0x2fae58[_0x92a3('0xa1')]=_0x57eb56;_0x2fae58[_0x92a3('0xa2')]=_0x57eb56[_0x92a3('0xa0')];_0x2fae58['list']=_0x57eb56[_0x92a3('0x9c')];_0x2fae58[_0x92a3('0xa2')]=_[_0x92a3('0xa3')](_0x2fae58['applications'],[_0x92a3('0xa4')],[_0x92a3('0xa5')]);if(_0x2fae58['account'][_0x92a3('0xa0')]){delete _0x2fae58[_0x92a3('0xa1')][_0x92a3('0xa0')];}if(_0x2fae58[_0x92a3('0xa1')][_0x92a3('0x9c')]&&_0x2fae58[_0x92a3('0xa1')]['List'][_0x92a3('0x9e')]['length']){return _0x2fae58[_0x92a3('0xa1')][_0x92a3('0x9c')]['Contacts'][0x0];}var _0x59829e=_['defaults'](_0x5e05bd[_0x92a3('0x5e')],{'firstName':_0x5e05bd[_0x92a3('0x5e')]['from'],'ListId':_0x57eb56[_0x92a3('0xa6')]});_0x59829e[_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x99')]]=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x97')];return db[_0x92a3('0x9d')][_0x92a3('0x5d')](_0x59829e,{'fields':_0x1da915,'raw':!![]});}})[_0x92a3('0x22')](handleEntityNotFound(_0x2e234d,null))['then'](function(_0xb685a9){_0x2fae58[_0x92a3('0xa7')]=_0xb685a9;var _0x4d61a9=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xa8')];if(_0x5e05bd[_0x92a3('0xa9')][_0x92a3('0xaa')]){_0x4d61a9=_0x5e05bd[_0x92a3('0xa9')][_0x92a3('0xaa')];}else if(_0x5e05bd[_0x92a3('0xa9')]['x-forwarded-for']){_0x4d61a9=_[_0x92a3('0xab')](_0x5e05bd[_0x92a3('0xa9')]['x-forwarded-for'][_0x92a3('0xac')](','));}if(_0xb685a9){var _0x340cda={'ContactId':_0xb685a9['id'],'ChatWebsiteId':_0x5e05bd[_0x92a3('0x59')]['id'],'from':(_0xb685a9[_0x92a3('0xad')]||'')+'\x20'+(_0xb685a9[_0x92a3('0xae')]||''),'customerIp':_0x4d61a9,'customerPort':_0x5e05bd['headers']['x-real-port']?_0x5e05bd[_0x92a3('0xa9')][_0x92a3('0xaf')]:null,'referer':_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xb0')],'browserName':_0xcf956f[_0x92a3('0xb1')][_0x92a3('0x3a')]&&_0xcf956f[_0x92a3('0xb1')][_0x92a3('0xb2')]?util[_0x92a3('0xb3')](_0x92a3('0xb4'),_0xcf956f[_0x92a3('0xb1')][_0x92a3('0x3a')],_0xcf956f[_0x92a3('0xb1')][_0x92a3('0xb2')]):_0x92a3('0xb5'),'browserVersion':_0xcf956f[_0x92a3('0xb1')]['version']||_0x92a3('0xb5'),'osName':util[_0x92a3('0xb3')](_0x92a3('0xb4'),_0xcf956f['os'][_0x92a3('0x3a')],_0xcf956f['os'][_0x92a3('0xb2')]),'osVersion':_0xcf956f['os']['version'],'deviceModel':_0xcf956f[_0x92a3('0xb6')][_0x92a3('0x42')]&&_0xcf956f[_0x92a3('0xb6')][_0x92a3('0xb7')]?util[_0x92a3('0xb3')](_0x92a3('0xb8'),_0xcf956f[_0x92a3('0xb6')][_0x92a3('0x42')],_0xcf956f[_0x92a3('0xb6')][_0x92a3('0xb7')],_0xcf956f[_0x92a3('0xb6')][_0x92a3('0x41')]):null,'deviceVendor':_0xcf956f[_0x92a3('0xb6')][_0x92a3('0xb7')],'deviceType':_0xcf956f[_0x92a3('0xb6')][_0x92a3('0x41')],'formData':JSON[_0x92a3('0x26')](_0x5e05bd[_0x92a3('0x5e')])};var _0xe4d90e={'ChatWebsiteId':_0x5e05bd[_0x92a3('0x59')]['id'],'closed':![]};if(_0x5e05bd[_0x92a3('0x5e')]['threadId']){_0xe4d90e[_0x92a3('0xb9')]=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xb9')];return db[_0x92a3('0xba')][_0x92a3('0x67')]({'where':_0xe4d90e})[_0x92a3('0x22')](function(_0x38467c){if(_0x38467c){return[_0x38467c,![]];}_0x340cda['threadId']=_0x5e05bd['body'][_0x92a3('0xb9')];_0x340cda[_0x92a3('0xbb')]=_0x5e05bd['body'][_0x92a3('0xbb')];return db[_0x92a3('0xba')][_0x92a3('0x5d')](_0x340cda)[_0x92a3('0x22')](function(_0x1bcc8c){return[_0x1bcc8c,!![]];});});}_0xe4d90e['ContactId']=_0xb685a9['id'];if(_0x5e05bd['body']['interaction']&&_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xbc')]['id']){_0xe4d90e['id']=_0x5e05bd[_0x92a3('0x5e')]['interaction']['id'];return db[_0x92a3('0xba')][_0x92a3('0x67')]({'where':_0xe4d90e})['then'](function(_0x528080){if(_0x528080){return[_0x528080,![]];}return db[_0x92a3('0xba')]['create'](_0x340cda)[_0x92a3('0x22')](function(_0x1d841a){return[_0x1d841a,!![]];});});}return db[_0x92a3('0xba')][_0x92a3('0x5d')](_0x340cda)[_0x92a3('0x22')](function(_0x2a5d19){return[_0x2a5d19,!![]];});}})[_0x92a3('0xbd')](function(_0x3528ca,_0x210b63){if(_0x3528ca){_0x2b3457=_0x210b63;if(!_0x210b63){var _0x12e8d2={'from':(_0x2fae58[_0x92a3('0xa7')]['firstName']||'')+'\x20'+(_0x2fae58[_0x92a3('0xa7')][_0x92a3('0xae')]||'')};if(_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xb9')]&&_0x5e05bd['body'][_0x92a3('0xbe')]&&_0x5e05bd[_0x92a3('0x5e')]['threadId']!=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xbe')]){_0x12e8d2[_0x92a3('0xb9')]=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xbe')];}return _0x3528ca['update'](_0x12e8d2);}else{return _0x3528ca;}}})[_0x92a3('0x22')](function(_0x570adf){_0x2fae58['interaction']=_0x570adf[_0x92a3('0x60')]({'plain':!![]});_0x2fae58[_0x92a3('0xbc')]['created']=_0x2b3457;if(_0x2fae58[_0x92a3('0xbc')][_0x92a3('0xbf')]){if(_0x2fae58['account']['autoclose']){_0x2fae58[_0x92a3('0xa2')]['push']({'id':0x0,'priority':_0x2fae58[_0x92a3('0xa2')]['length']+0x1,'app':_0x92a3('0xc0'),'appdata':_0x92a3('0xc1'),'interval':_0x92a3('0xc2')});}}return db['ChatMessage'][_0x92a3('0x5d')]({'body':_0x5e05bd['body']['body'],'ChatWebsiteId':_0x5e05bd['params']['id'],'ChatInteractionId':_0x570adf['id'],'direction':'in','ContactId':_0x2fae58['contact']['id'],'AttachmentId':_0x5e05bd['body']['AttachmentId']});})[_0x92a3('0x22')](function(_0x3ea01c){_0x2fae58[_0x92a3('0x29')]=_0x3ea01c;if(_0x2fae58[_0x92a3('0xbc')]['UserId']){return db[_0x92a3('0xc3')][_0x92a3('0x67')]({'attributes':['id',_0x92a3('0x3a')],'where':{'id':_0x2fae58[_0x92a3('0xbc')][_0x92a3('0xc4')]}})['then'](function(_0x17cd7b){if(_0x17cd7b){_0x2fae58[_0x92a3('0xa2')][_0x92a3('0xc5')]({'id':0x0,'priority':0x0,'app':_0x92a3('0xc6'),'appdata':_0x17cd7b[_0x92a3('0x3a')]+','+(_0x2fae58['account'][_0x92a3('0xc7')]||0xa),'interval':'*,*,*,*'});_0x2fae58[_0x92a3('0xc8')]=!![];}return respondWithRpcPromise(_0x92a3('0xc9'),'startRouting',_0x2fae58);});}return respondWithRpcPromise(_0x92a3('0xc9'),_0x92a3('0xca'),_0x2fae58);})[_0x92a3('0x22')](function(_0x50de3f){respondWithRpcPromise(_0x92a3('0xcb'),_0x92a3('0xcb'),{'event':_0x92a3('0xcc'),'message':_0x50de3f},client9002);return _0x50de3f;})[_0x92a3('0x22')](respondWithResult(_0x2e234d,null))[_0x92a3('0x5c')](handleError(_0x2e234d,null));};exports['offline']=function(_0x25baf,_0x1d4405,_0x44b12f){var _0x10993d,_0x41e9dd,_0x9f3fd4;var _0x1698e9=[];var _0x554969=[];var _0x233b42={};return db[_0x92a3('0x9d')][_0x92a3('0x68')]()['then'](function(_0x3cbbcd){if(!_0x3cbbcd){throw new db[(_0x92a3('0x92'))]['ValidationError'](_0x92a3('0xcd'));}_0x554969=_[_0x92a3('0x94')](_[_0x92a3('0x44')](_0x3cbbcd),[_0x92a3('0x95'),_0x92a3('0x96')]);_0x1698e9=_['difference'](_[_0x92a3('0x44')](_0x3cbbcd),['createdAt',_0x92a3('0x96'),'CompanyId',_0x92a3('0xa6')]);if(_0x25baf['body']['id']){delete _0x25baf[_0x92a3('0x5e')]['id'];}if(_[_0x92a3('0x83')](_0x25baf[_0x92a3('0x5e')][_0x92a3('0x97')])){throw _0x1d4405['status'](0x1f4)[_0x92a3('0x3b')](new db['Sequelize'][(_0x92a3('0x93'))](_0x92a3('0xce')));}if(_['isNil'](_0x25baf[_0x92a3('0x5e')][_0x92a3('0x5e')])||_0x25baf[_0x92a3('0x5e')][_0x92a3('0x5e')]===''){throw _0x1d4405[_0x92a3('0x2d')](0x1f4)[_0x92a3('0x3b')](new db[(_0x92a3('0x92'))][(_0x92a3('0x93'))](_0x92a3('0x98')));}if(_[_0x92a3('0x83')](_0x25baf[_0x92a3('0x5e')][_0x92a3('0xcf')])){throw _0x1d4405[_0x92a3('0x2d')](0x1f4)['send'](new db[(_0x92a3('0x92'))][(_0x92a3('0x93'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1698e9));}if(!_[_0x92a3('0x9a')](_0x1698e9,_0x25baf[_0x92a3('0x5e')][_0x92a3('0xcf')])){throw _0x1d4405[_0x92a3('0x2d')](0x1f4)[_0x92a3('0x3b')](new db['Sequelize'][(_0x92a3('0x93'))](_0x92a3('0xd0')+_0x1698e9));}_0x233b42[_0x25baf['body'][_0x92a3('0xcf')]]=_0x25baf[_0x92a3('0x5e')]['from'];})[_0x92a3('0x22')](function(){return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x25baf[_0x92a3('0x59')]['id']},'include':[{'model':db[_0x92a3('0xd1')],'as':_0x92a3('0x9c')}]});})[_0x92a3('0x22')](handleEntityNotFound(_0x1d4405,null))['then'](function(_0x476982){if(_0x476982&&_0x476982[_0x92a3('0x9c')]){_0x41e9dd=_0x476982;var _0x259f97=_[_0x92a3('0x1a')](_0x25baf[_0x92a3('0x5e')],{'firstName':_0x25baf[_0x92a3('0x5e')]['from'],'phone':_0x25baf[_0x92a3('0x5e')][_0x92a3('0x97')],'ListId':_0x476982[_0x92a3('0xa6')]});_0x259f97[_0x25baf[_0x92a3('0x5e')][_0x92a3('0xcf')]]=_0x25baf[_0x92a3('0x5e')][_0x92a3('0x97')];return db[_0x92a3('0x9d')][_0x92a3('0xd2')]({'where':_0x233b42,'defaults':_0x259f97});}})[_0x92a3('0xbd')](function(_0x337778){if(_0x337778){_0x9f3fd4=_0x337778;var _0x30a76b=fs[_0x92a3('0xd3')](path['join'](config[_0x92a3('0x7e')],'server/files/templates/chatOfflineMessage.ejs'),_0x92a3('0xd4'));var _0x119cc4=ejs[_0x92a3('0xd5')](_0x30a76b,{'body':_[_0x92a3('0xd6')](_0x25baf[_0x92a3('0x5e')][_0x92a3('0x5e')]),'bodyTitle':_0x41e9dd['offlineMessageBody']});return db[_0x92a3('0xd7')][_0x92a3('0x5d')]({'body':_0x119cc4,'ContactId':_0x337778['id'],'ChatWebsiteId':_0x41e9dd['id']});}})[_0x92a3('0x22')](function(_0x580441){if(_0x580441){_0x10993d=_0x580441;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x92a3('0xd8')],'as':_0x92a3('0xd9'),'raw':!![]}]});}})[_0x92a3('0x22')](function(_0x194c21){if(_0x194c21&&_0x194c21['Smtp']&&_0x41e9dd[_0x92a3('0xda')]){var _0x3722e8={'tls':{'rejectUnauthorized':![]}};if(_0x194c21[_0x92a3('0xd9')][_0x92a3('0xdb')]){_0x3722e8[_0x92a3('0xdb')]=_0x194c21['Smtp']['service'];}else{_0x3722e8[_0x92a3('0xdc')]=_0x194c21[_0x92a3('0xd9')]['host'];_0x3722e8[_0x92a3('0xdd')]=_0x194c21['Smtp'][_0x92a3('0xdd')];_0x3722e8[_0x92a3('0xde')]=_0x194c21[_0x92a3('0xd9')][_0x92a3('0xde')];}if(_0x194c21[_0x92a3('0xd9')][_0x92a3('0xdf')]){_0x3722e8[_0x92a3('0xe0')]={'user':_0x194c21[_0x92a3('0xd9')][_0x92a3('0x5f')],'pass':_0x194c21[_0x92a3('0xd9')][_0x92a3('0xe1')]};}return respondWithRpcPromise(_0x92a3('0xe2'),_0x92a3('0xe3'),{'account':_0x3722e8,'message':{'from':util[_0x92a3('0xb3')](_0x92a3('0xe4'),_0x194c21[_0x92a3('0x3a')],_0x194c21[_0x92a3('0xe5')]||_0x194c21[_0x92a3('0xd9')][_0x92a3('0x5f')]),'to':_0x41e9dd['forwardOfflineAddress'],'subject':_0x41e9dd[_0x92a3('0xe6')],'text':_0x10993d[_0x92a3('0x5e')]}},client9003)[_0x92a3('0x22')](function(){return _0x10993d;})[_0x92a3('0x5c')](function(_0x28fc20){console[_0x92a3('0x27')](_0x28fc20);});}})['then'](function(){if(_0x10993d){return _0x10993d;}})[_0x92a3('0x22')](respondWithResult(_0x1d4405,null))[_0x92a3('0x5c')](handleError(_0x1d4405,null));};exports[_0x92a3('0xe7')]=function(_0x8dce3c,_0x3be2a4,_0x3a2ad3){return db['ChatInteraction'][_0x92a3('0x67')]({'where':{'id':_0x8dce3c[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x3be2a4,null))[_0x92a3('0x22')](function(_0x4039ee){if(_0x4039ee){return _0x4039ee[_0x92a3('0xe7')](_0x8dce3c['body'][_0x92a3('0x6f')],_[_0x92a3('0xe8')](_0x8dce3c[_0x92a3('0x5e')],['ids','id'])||{});}})[_0x92a3('0x22')](respondWithResult(_0x3be2a4,null))[_0x92a3('0x5c')](handleError(_0x3be2a4,null));};exports['getInteractions']=function(_0x48a74e,_0x3b681c,_0x4421a5){var _0x271b44={'raw':![],'where':{}};var _0x1e09f6={};var _0x44bc72={'count':0x0,'rows':[]};return db[_0x92a3('0x53')][_0x92a3('0x72')]({'where':{'id':_0x48a74e[_0x92a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x3b681c,null))[_0x92a3('0x22')](function(_0x16f86d){if(_0x16f86d){_0x1e09f6['model']=_[_0x92a3('0x44')](db['ChatInteraction'][_0x92a3('0x3f')]);_0x1e09f6[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x48a74e[_0x92a3('0x43')]);_0x1e09f6[_0x92a3('0x4d')]=_['intersection'](_0x1e09f6['model'],_0x1e09f6[_0x92a3('0x43')]);_0x271b44[_0x92a3('0x47')]=_['intersection'](_0x1e09f6[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x48a74e[_0x92a3('0x43')][_0x92a3('0x46')]));_0x271b44[_0x92a3('0x47')]=_0x271b44[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x271b44[_0x92a3('0x47')]:_0x1e09f6[_0x92a3('0x42')];if(!_0x48a74e[_0x92a3('0x43')][_0x92a3('0x48')](_0x92a3('0x49'))){_0x271b44[_0x92a3('0x31')]=qs[_0x92a3('0x31')](_0x48a74e[_0x92a3('0x43')]['limit']);_0x271b44[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x48a74e[_0x92a3('0x43')][_0x92a3('0x30')]);}_0x271b44[_0x92a3('0x4a')]=qs['sort'](_0x48a74e[_0x92a3('0x43')]['sort']);_0x271b44['where']=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x48a74e[_0x92a3('0x43')],_0x1e09f6['filters']));_0x271b44['where'][_0x92a3('0x6a')]=_0x16f86d['id'];if(_0x48a74e[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x271b44[_0x92a3('0x4c')]=_['merge'](_0x271b44[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x271b44[_0x92a3('0x47')],function(_0x4a4c6b){var _0x3bea48={};_0x3bea48[_0x4a4c6b]={'$like':'%'+_0x48a74e[_0x92a3('0x43')]['filter']+'%'};return _0x3bea48;})});}_0x271b44=_[_0x92a3('0x50')]({},_0x271b44,_0x48a74e[_0x92a3('0x52')]);return db[_0x92a3('0xba')][_0x92a3('0x6d')]({'where':_0x271b44[_0x92a3('0x4c')]})['then'](function(_0x384112){_0x44bc72[_0x92a3('0x6d')]=_0x384112;if(_0x48a74e[_0x92a3('0x43')]['includeAll']){_0x271b44[_0x92a3('0x55')]=[{'model':db[_0x92a3('0x9d')],'as':_0x92a3('0xe9'),'required':![]},{'model':db['User'],'as':_0x92a3('0xea'),'attributes':[_0x92a3('0x3a'),_0x92a3('0xeb'),_0x92a3('0xec')],'required':![]},{'model':db[_0x92a3('0xed')],'as':_0x92a3('0xee'),'attributes':['id',_0x92a3('0x3a'),_0x92a3('0xef')],'where':_0x48a74e[_0x92a3('0x43')]['tag']?{'id':_0x48a74e[_0x92a3('0x43')][_0x92a3('0xf0')]}:undefined,'required':_0x48a74e[_0x92a3('0x43')][_0x92a3('0xf0')]?!![]:![]}];}return db[_0x92a3('0xba')][_0x92a3('0x56')](_0x271b44);})[_0x92a3('0x22')](function(_0x1e68f0){_0x44bc72[_0x92a3('0x57')]=_0x1e68f0;return _0x44bc72;});}})[_0x92a3('0x22')](respondWithFilteredResult(_0x3b681c,_0x271b44))[_0x92a3('0x5c')](handleError(_0x3b681c,null));};function iftimePromise(_0x1c8219,_0x2d6c49){return respondWithRpcPromise(_0x92a3('0xf1'),_0x92a3('0xf2'),{'command':_0x2d6c49[_0x92a3('0xf3')]?util[_0x92a3('0xb3')](_0x92a3('0xf4'),_0x1c8219[_0x92a3('0xf5')],_0x2d6c49[_0x92a3('0xf3')]):util[_0x92a3('0xb3')](_0x92a3('0xf6'),_0x1c8219[_0x92a3('0xf5')])},client9002)[_0x92a3('0x22')](function(_0x1e49fc){var _0x2378c8=_0x1e49fc&&_0x1e49fc['indexOf']('true')>=0x0?!![]:![];logger[_0x92a3('0x23')](_0x92a3('0xf7'),_0x2d6c49['id'],_0x1c8219['id'],_0x1c8219[_0x92a3('0xf5')],_0x2378c8?_0x92a3('0xf8'):_0x92a3('0xf9'),_0x2d6c49[_0x92a3('0xf3')]?_0x2d6c49[_0x92a3('0xf3')]:_0x92a3('0xfa'));return _0x2378c8;})[_0x92a3('0x5c')](function(_0x1b1cd3){logger[_0x92a3('0x27')](_0x92a3('0xf7'),_0x2d6c49['id'],_0x1c8219['id'],_0x1c8219[_0x92a3('0xf5')],util['inspect'](_0x1b1cd3,{'showHidden':![],'depth':null}),_0x2d6c49[_0x92a3('0xf3')]?_0x2d6c49[_0x92a3('0xf3')]:_0x92a3('0xfa'));return![];});}exports[_0x92a3('0xf2')]=function(_0x185a11,_0xf98a95,_0x24782a){var _0x4213a5=0x0;var _0x33d121=0x0;var _0x1f0035=![];var _0x4956ab;var _0x55f5a0;return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x185a11[_0x92a3('0x59')]['id']},'include':[{'model':db[_0x92a3('0xfb')],'as':'Interval','include':[{'model':db[_0x92a3('0xfb')],'as':_0x92a3('0xfc'),'attributes':['id',_0x92a3('0xf5')],'raw':!![]}]}]})[_0x92a3('0x22')](handleEntityNotFound(_0xf98a95,null))[_0x92a3('0x22')](function(_0x232dc7){if(_0x232dc7){_0x4956ab=_0x232dc7;return _0x232dc7[_0x92a3('0xfd')]({'raw':!![]});}})[_0x92a3('0x22')](function(_0x40ecd8){if(_0x4956ab){if(_0x40ecd8){_0x55f5a0=_0x40ecd8;}}return require(_0x92a3('0x81'))[_0x92a3('0x82')]();})['then'](function(_0x1cb624){if(_0x1cb624){_0x33d121=_0x1cb624[_0x92a3('0xfe')];_0x1f0035=_0x1cb624['custom'];}})[_0x92a3('0x22')](function(){return db['ChatInteraction'][_0x92a3('0x6d')]({'where':{'closed':![]}});})['then'](function(_0x4db8e3){_0x4213a5=_0x4db8e3;if(_0x33d121&&_0x4db8e3>_0x33d121){return db[_0x92a3('0xff')]['findOne']({'where':{'id':0x1}})[_0x92a3('0x22')](function(_0x5dc51e){if(_0x5dc51e){_0x5dc51e[_0x92a3('0x100')](_0x92a3('0x101'));}});}})[_0x92a3('0x22')](function(){if(_0x4956ab[_0x92a3('0xfb')]&&_0x4956ab['Interval'][_0x92a3('0xfc')]){var _0x2da61d=[];for(var _0x4731c0=0x0;_0x4731c0<_0x4956ab[_0x92a3('0xfb')]['Intervals'][_0x92a3('0x5b')];_0x4731c0++){var _0x3be4d1=_0x4956ab['Interval'][_0x92a3('0xfc')][_0x4731c0]['get']({'plain':!![]});_0x2da61d['push'](iftimePromise(_0x3be4d1,_0x4956ab));}return BPromise[_0x92a3('0x102')](_0x2da61d)[_0x92a3('0x22')](function(_0x6120df){return _[_0x92a3('0x103')](_0x6120df);});}else{return!![];}})['then'](function(_0x59c31c){var _0x54a154=fs[_0x92a3('0xd3')](path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x104')),_0x92a3('0xd4'));var _0x5ce53d={'remote':_0x4956ab[_0x92a3('0x105')],'query':querystring[_0x92a3('0x26')](_['merge'](_0x4956ab[_0x92a3('0x60')]({'plain':!![]}),{'customerIp':_0x185a11[_0x92a3('0xa9')][_0x92a3('0x106')]||_0x185a11[_0x92a3('0xa9')][_0x92a3('0x107')]||_0x185a11['connection']['remoteAddress']||_0x185a11['ip'],'referer':_0x185a11['headers']['referer'],'openedInteractions':_0x4213a5,'maxInteractions':_0x33d121,'virtual':_0x1f0035[_0x92a3('0xfe')],'online':_0x59c31c,'custom':_0x1f0035}))[_0x92a3('0x108')](/'/g,'\x5c\x27')};_0xf98a95[_0x92a3('0x3b')](ejs['render'](Mustache[_0x92a3('0xd5')](_0x54a154,_0x5ce53d),{'proactiveActions':_0x55f5a0,'alignment':_0x4956ab[_0x92a3('0x109')],'verticalAlignment':_0x4956ab[_0x92a3('0x10a')],'div_color':_0x4956ab[_0x92a3('0xef')],'text_color':_0x4956ab['textColor']}));})[_0x92a3('0x5c')](handleError(_0xf98a95,null));};exports[_0x92a3('0x10b')]=function(_0x3eafbb,_0x440db8,_0x902af8){return db[_0x92a3('0x53')]['findOne']({'where':{'id':_0x3eafbb['params']['id']}})['then'](handleEntityNotFound(_0x440db8,null))['then'](function(_0x4d1f1e){if(_0x4d1f1e){return db[_0x92a3('0x10c')][_0x92a3('0x10d')](function(_0x1229ec){return db[_0x92a3('0x10e')][_0x92a3('0x36')]({'where':{'ChatWebsiteId':_0x3eafbb[_0x92a3('0x59')]['id']},'transaction':_0x1229ec})[_0x92a3('0x22')](function(_0x5c9cd4){var _0x223fd2=_['map'](_0x3eafbb[_0x92a3('0x5e')],function(_0x1be8c4){_0x1be8c4['ChatWebsiteId']=_0x3eafbb[_0x92a3('0x59')]['id'];return _0x1be8c4;});return db[_0x92a3('0x10e')]['bulkCreate'](_0x223fd2,{'transaction':_0x1229ec});});})[_0x92a3('0x22')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x3eafbb[_0x92a3('0x59')]['id']},'order':_0x92a3('0xa4')});});}})[_0x92a3('0x22')](respondWithResult(_0x440db8,null))['catch'](handleError(_0x440db8,null));};exports[_0x92a3('0x10f')]=function(_0x20127b,_0xc6bdc0,_0x111c5a){var _0xfc3252={};var _0x32f9af={};var _0x5cf51c;var _0x261bbd;return db[_0x92a3('0x53')]['findOne']({'where':{'id':_0x20127b[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0xc6bdc0,null))[_0x92a3('0x22')](function(_0x198d72){if(_0x198d72){_0x5cf51c=_0x198d72;_0x32f9af[_0x92a3('0x42')]=_['keys'](db[_0x92a3('0x10e')][_0x92a3('0x3f')]);_0x32f9af['query']=_[_0x92a3('0x44')](_0x20127b['query']);_0x32f9af[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x32f9af['model'],_0x32f9af['query']);_0xfc3252[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x32f9af[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x20127b['query'][_0x92a3('0x46')]));_0xfc3252[_0x92a3('0x47')]=_0xfc3252[_0x92a3('0x47')][_0x92a3('0x5b')]?_0xfc3252[_0x92a3('0x47')]:_0x32f9af['model'];_0xfc3252[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x20127b[_0x92a3('0x43')][_0x92a3('0x4b')]);_0xfc3252[_0x92a3('0x4c')]=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x20127b[_0x92a3('0x43')],_0x32f9af[_0x92a3('0x4d')]));if(_0x20127b['query']['filter']){_0xfc3252[_0x92a3('0x4c')]=_[_0x92a3('0x50')](_0xfc3252['where'],{'$or':_[_0x92a3('0x3e')](_0xfc3252[_0x92a3('0x47')],function(_0x5761d4){var _0x45918d={};_0x45918d[_0x5761d4]={'$like':'%'+_0x20127b[_0x92a3('0x43')]['filter']+'%'};return _0x45918d;})});}_0xfc3252=_[_0x92a3('0x50')]({},_0xfc3252,_0x20127b['options']);return _0x5cf51c['getApplications'](_0xfc3252);}})['then'](function(_0x1011b2){if(_0x1011b2){_0x261bbd=_0x1011b2[_0x92a3('0x5b')];if(!_0x20127b[_0x92a3('0x43')][_0x92a3('0x48')](_0x92a3('0x49'))){_0xfc3252[_0x92a3('0x31')]=qs['limit'](_0x20127b['query'][_0x92a3('0x31')]);_0xfc3252[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x20127b[_0x92a3('0x43')]['offset']);}return _0x5cf51c[_0x92a3('0x10f')](_0xfc3252);}})['then'](function(_0xbaec2f){if(_0xbaec2f){return _0xbaec2f?{'count':_0x261bbd,'rows':_0xbaec2f}:null;}})[_0x92a3('0x22')](respondWithResult(_0xc6bdc0,null))[_0x92a3('0x5c')](handleError(_0xc6bdc0,null));};exports['addProactiveActions']=function(_0x327058,_0x3e1c18,_0x33b7c3){return db['chatProactiveAction']['find']({'where':{'id':_0x327058[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x3e1c18,null))[_0x92a3('0x22')](function(_0x9a6b55){if(_0x9a6b55){return _0x9a6b55[_0x92a3('0x110')](_0x327058['body'][_0x92a3('0x6f')],_[_0x92a3('0xe8')](_0x327058[_0x92a3('0x5e')],[_0x92a3('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x3e1c18,null))[_0x92a3('0x5c')](handleError(_0x3e1c18,null));};exports[_0x92a3('0xfd')]=function(_0x2c3cde,_0x33e7ac,_0x20d4c9){var _0x3bd0d4={};var _0x322061={};var _0x54b44d;var _0x327b1b;return db[_0x92a3('0x53')]['findOne']({'where':{'id':_0x2c3cde[_0x92a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x33e7ac,null))[_0x92a3('0x22')](function(_0xac3c0c){if(_0xac3c0c){_0x54b44d=_0xac3c0c;_0x322061['model']=_[_0x92a3('0x44')](db[_0x92a3('0x111')][_0x92a3('0x3f')]);_0x322061[_0x92a3('0x43')]=_['keys'](_0x2c3cde['query']);_0x322061[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x322061[_0x92a3('0x42')],_0x322061[_0x92a3('0x43')]);_0x3bd0d4[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x322061[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x46')]));_0x3bd0d4[_0x92a3('0x47')]=_0x3bd0d4[_0x92a3('0x47')]['length']?_0x3bd0d4[_0x92a3('0x47')]:_0x322061[_0x92a3('0x42')];_0x3bd0d4[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x2c3cde[_0x92a3('0x43')]['sort']);_0x3bd0d4[_0x92a3('0x4c')]=qs['filters'](_[_0x92a3('0x4e')](_0x2c3cde[_0x92a3('0x43')],_0x322061[_0x92a3('0x4d')]));if(_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x3bd0d4[_0x92a3('0x4c')]=_[_0x92a3('0x50')](_0x3bd0d4[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x3bd0d4[_0x92a3('0x47')],function(_0x4d2dab){var _0x4519f4={};_0x4519f4[_0x4d2dab]={'$like':'%'+_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x4519f4;})});}_0x3bd0d4=_[_0x92a3('0x50')]({},_0x3bd0d4,_0x2c3cde['options']);return _0x54b44d[_0x92a3('0xfd')](_0x3bd0d4);}})[_0x92a3('0x22')](function(_0x230d33){if(_0x230d33){_0x327b1b=_0x230d33[_0x92a3('0x5b')];if(!_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x48')](_0x92a3('0x49'))){_0x3bd0d4[_0x92a3('0x31')]=qs['limit'](_0x2c3cde['query']['limit']);_0x3bd0d4['offset']=qs[_0x92a3('0x30')](_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x30')]);}return _0x54b44d['getProactiveActions'](_0x3bd0d4);}})[_0x92a3('0x22')](function(_0x5a2cc6){if(_0x5a2cc6){return _0x5a2cc6?{'count':_0x327b1b,'rows':_0x5a2cc6}:null;}})[_0x92a3('0x22')](respondWithResult(_0x33e7ac,null))[_0x92a3('0x5c')](handleError(_0x33e7ac,null));};exports[_0x92a3('0x112')]=function(_0x19c59c,_0x17932c,_0x3b8bc0){var _0x1e03fd=_0x19c59c[_0x92a3('0x43')][_0x92a3('0x113')]==='false'?_0x92a3('0x114'):_0x92a3('0x115');return db[_0x92a3('0x53')][_0x92a3('0x67')]({'attributes':['id',_0x1e03fd],'where':{'id':_0x19c59c[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x17932c,null))[_0x92a3('0x22')](function(_0x38c22d){if(_0x38c22d){var _0x3b80e4=_0x38c22d[_0x1e03fd];var _0x34aceb=_0x3b80e4&&_0x3b80e4[_0x92a3('0x116')]?_0x3b80e4[_0x92a3('0x116')]:[];_0x17932c['send']({'fromKey':_[_0x92a3('0x83')](_0x3b80e4[_0x92a3('0x117')])?undefined:_0x3b80e4[_0x92a3('0x117')],'count':_0x34aceb[_0x92a3('0x5b')],'rows':_0x34aceb});}})[_0x92a3('0x5c')](handleError(_0x17932c,null));};exports[_0x92a3('0x118')]=function(_0x59dc06,_0x35e2db,_0x18b3dd){var _0x2e3f31={'raw':![],'where':{}};var _0x11071e={};var _0x18b83f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x92a3('0x72')]({'where':{'id':_0x59dc06[_0x92a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x35e2db,null))[_0x92a3('0x22')](function(_0x444812){if(_0x444812){_0x11071e['model']=_[_0x92a3('0x44')](db[_0x92a3('0xd7')][_0x92a3('0x3f')]);_0x11071e['query']=_[_0x92a3('0x44')](_0x59dc06[_0x92a3('0x43')]);_0x11071e[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x11071e[_0x92a3('0x42')],_0x11071e[_0x92a3('0x43')]);_0x2e3f31[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x11071e[_0x92a3('0x42')],qs['fields'](_0x59dc06['query'][_0x92a3('0x46')]));_0x2e3f31['attributes']=_0x2e3f31[_0x92a3('0x47')]['length']?_0x2e3f31[_0x92a3('0x47')]:_0x11071e['model'];if(!_0x59dc06['query']['hasOwnProperty'](_0x92a3('0x49'))){_0x2e3f31[_0x92a3('0x31')]=qs[_0x92a3('0x31')](_0x59dc06[_0x92a3('0x43')][_0x92a3('0x31')]);_0x2e3f31[_0x92a3('0x30')]=qs['offset'](_0x59dc06['query'][_0x92a3('0x30')]);}_0x2e3f31[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x59dc06['query'][_0x92a3('0x4b')]);_0x2e3f31['where']=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x59dc06['query'],_0x11071e[_0x92a3('0x4d')]));_0x2e3f31[_0x92a3('0x4c')][_0x92a3('0x6a')]=_0x444812['id'];if(_0x59dc06['query'][_0x92a3('0x4f')]){_0x2e3f31['where']=_[_0x92a3('0x50')](_0x2e3f31[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x2e3f31[_0x92a3('0x47')],function(_0x3a4954){var _0x2469db={};_0x2469db[_0x3a4954]={'$like':'%'+_0x59dc06[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x2469db;})});}_0x2e3f31=_[_0x92a3('0x50')]({},_0x2e3f31,_0x59dc06['options']);return db['ChatOfflineMessage']['count']({'where':_0x2e3f31['where']})[_0x92a3('0x22')](function(_0x34cf4c){_0x18b83f['count']=_0x34cf4c;if(_0x59dc06[_0x92a3('0x43')][_0x92a3('0x54')]){_0x2e3f31[_0x92a3('0x55')]=[{'all':!![]}];}else{_0x2e3f31[_0x92a3('0x55')]=[{'model':db[_0x92a3('0x9d')],'as':_0x92a3('0xe9'),'required':![]}];}return db[_0x92a3('0xd7')]['findAll'](_0x2e3f31);})['then'](function(_0x1b0ea8){_0x18b83f[_0x92a3('0x57')]=_0x1b0ea8;return _0x18b83f;});}})[_0x92a3('0x22')](respondWithFilteredResult(_0x35e2db,_0x2e3f31))[_0x92a3('0x5c')](handleError(_0x35e2db,null));};exports[_0x92a3('0x119')]=function(_0xcaa309,_0x1ae0c5,_0xf5e1a4){return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0xcaa309[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x1ae0c5,null))[_0x92a3('0x22')](function(_0x456952){if(_0x456952){return _0x456952['addAgents'](_0xcaa309[_0x92a3('0x5e')][_0x92a3('0x6f')],_[_0x92a3('0xe8')](_0xcaa309[_0x92a3('0x5e')],['ids','id'])||{})[_0x92a3('0xbd')](function(_0x4118f9){for(var _0x2fb61e=0x0;_0x2fb61e<_0xcaa309[_0x92a3('0x5e')]['ids'][_0x92a3('0x5b')];_0x2fb61e+=0x1){socket[_0x92a3('0x11a')](_0x92a3('0x11b'),{'UserId':_0xcaa309[_0x92a3('0x5e')]['ids'][_0x2fb61e],'ChatWebsiteId':_0xcaa309[_0x92a3('0x59')]['id']});}return _0x4118f9;});}})[_0x92a3('0x22')](respondWithResult(_0x1ae0c5,null))[_0x92a3('0x5c')](handleError(_0x1ae0c5,null));};exports[_0x92a3('0x11c')]=function(_0x42191d,_0x3804e3,_0x3c68c0){return db[_0x92a3('0x53')]['find']({'where':{'id':_0x42191d['params']['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x3804e3,null))[_0x92a3('0x22')](function(_0x251da0){if(_0x251da0){return _0x251da0[_0x92a3('0x11c')](_0x42191d['query'][_0x92a3('0x6f')])[_0x92a3('0x22')](function(){if(_[_0x92a3('0x11d')](_0x42191d[_0x92a3('0x43')][_0x92a3('0x6f')])){for(var _0x53b00b=0x0;_0x53b00b<_0x42191d['query'][_0x92a3('0x6f')][_0x92a3('0x5b')];_0x53b00b+=0x1){socket[_0x92a3('0x11a')](_0x92a3('0x11e'),{'UserId':Number(_0x42191d[_0x92a3('0x43')][_0x92a3('0x6f')][_0x53b00b]),'ChatWebsiteId':Number(_0x42191d['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x42191d[_0x92a3('0x43')]['ids']),'ChatWebsiteId':Number(_0x42191d[_0x92a3('0x59')]['id'])});}});}})[_0x92a3('0x22')](respondWithStatusCode(_0x3804e3,null))[_0x92a3('0x5c')](handleError(_0x3804e3,null));};exports['getAgents']=function(_0x5cf0a7,_0x211359,_0x2a3f92){var _0x38f339={};var _0x1551bf={};var _0xfceac4;var _0x159e09;return db[_0x92a3('0x53')][_0x92a3('0x72')]({'where':{'id':_0x5cf0a7[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x211359,null))['then'](function(_0x240b8e){if(_0x240b8e){_0xfceac4=_0x240b8e;_0x1551bf[_0x92a3('0x42')]=_[_0x92a3('0x44')](db['User'][_0x92a3('0x3f')]);_0x1551bf[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x5cf0a7[_0x92a3('0x43')]);_0x1551bf[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x1551bf[_0x92a3('0x42')],_0x1551bf['query']);_0x38f339[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x1551bf[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x5cf0a7[_0x92a3('0x43')][_0x92a3('0x46')]));_0x38f339[_0x92a3('0x47')]=_0x38f339[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x38f339[_0x92a3('0x47')]:_0x1551bf['model'];_0x38f339[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x5cf0a7['query']['sort']);_0x38f339['where']=qs[_0x92a3('0x4d')](_['pick'](_0x5cf0a7[_0x92a3('0x43')],_0x1551bf[_0x92a3('0x4d')]));if(_0x5cf0a7[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x38f339['where']=_['merge'](_0x38f339[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x38f339[_0x92a3('0x47')],function(_0x3db138){var _0x14c2cb={};_0x14c2cb[_0x3db138]={'$like':'%'+_0x5cf0a7[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x14c2cb;})});}_0x38f339=_['merge']({},_0x38f339,_0x5cf0a7[_0x92a3('0x52')]);return _0xfceac4[_0x92a3('0x11f')](_0x38f339);}})[_0x92a3('0x22')](function(_0x42e73b){if(_0x42e73b){_0x159e09=_0x42e73b[_0x92a3('0x5b')];if(!_0x5cf0a7['query'][_0x92a3('0x48')](_0x92a3('0x49'))){_0x38f339[_0x92a3('0x31')]=qs[_0x92a3('0x31')](_0x5cf0a7['query'][_0x92a3('0x31')]);_0x38f339[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x5cf0a7['query'][_0x92a3('0x30')]);}return _0xfceac4[_0x92a3('0x11f')](_0x38f339);}})[_0x92a3('0x22')](function(_0x524238){if(_0x524238){return _0x524238?{'count':_0x159e09,'rows':_0x524238}:null;}})[_0x92a3('0x22')](respondWithResult(_0x211359,null))[_0x92a3('0x5c')](handleError(_0x211359,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index be85ab4..be28d2f 100644 --- a/server/api/chatWebsite/chatWebsite.events.js +++ b/server/api/chatWebsite/chatWebsite.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5692=['events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x937379,_0x4688a0){var _0x465709=function(_0x450b8a){while(--_0x450b8a){_0x937379['push'](_0x937379['shift']());}};_0x465709(++_0x4688a0);}(_0x5692,0x14a));var _0x2569=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5692[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require(_0x2569('0x0'));var ChatWebsite=require(_0x2569('0x1'))['db'][_0x2569('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2569('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2569('0x4'),'afterDestroy':_0x2569('0x5')};function emitEvent(_0x3513e9){return function(_0x304540,_0x1690b7,_0x2f5384){ChatWebsiteEvents['emit'](_0x3513e9+':'+_0x304540['id'],_0x304540);ChatWebsiteEvents[_0x2569('0x6')](_0x3513e9,_0x304540);_0x2f5384(null);};}for(var e in events){if(events[_0x2569('0x7')](e)){var event=events[e];ChatWebsite[_0x2569('0x8')](e,emitEvent(event));}}module[_0x2569('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x3685=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','ChatWebsite'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x5368('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x5368('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x5368('0x2')](0x0);var events={'afterCreate':_0x5368('0x3'),'afterUpdate':_0x5368('0x4'),'afterDestroy':_0x5368('0x5')};function emitEvent(_0xf0428a){return function(_0x271e21,_0x2c9c35,_0x3bf968){ChatWebsiteEvents[_0x5368('0x6')](_0xf0428a+':'+_0x271e21['id'],_0x271e21);ChatWebsiteEvents['emit'](_0xf0428a,_0x271e21);_0x3bf968(null);};}for(var e in events){if(events[_0x5368('0x7')](e)){var event=events[e];ChatWebsite[_0x5368('0x8')](e,emitEvent(event));}}module[_0x5368('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index a424e31..2d72ec4 100644 --- a/server/api/chatWebsite/chatWebsite.model.js +++ b/server/api/chatWebsite/chatWebsite.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1152=['moment','bluebird','request-promise','path','../../config/environment','exports','lodash','util','../../config/logger','api'];(function(_0x27c22e,_0x1ebf6e){var _0x43cb55=function(_0x292c66){while(--_0x292c66){_0x27c22e['push'](_0x27c22e['shift']());}};_0x43cb55(++_0x1ebf6e);}(_0x1152,0x182));var _0x2115=function(_0x20c47c,_0x443272){_0x20c47c=_0x20c47c-0x0;var _0x1cfcd7=_0x1152[_0x20c47c];return _0x1cfcd7;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var logger=require(_0x2115('0x2'))(_0x2115('0x3'));var moment=require(_0x2115('0x4'));var BPromise=require(_0x2115('0x5'));var rp=require(_0x2115('0x6'));var fs=require('fs');var path=require(_0x2115('0x7'));var rimraf=require('rimraf');var config=require(_0x2115('0x8'));var attributes=require('./chatWebsite.attributes');module[_0x2115('0x9')]=function(_0x241dcb,_0x51a3cf){return _0x241dcb['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777d=['./chatWebsite.attributes','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4655a8,_0x136ca0){var _0x15af3d=function(_0x41a016){while(--_0x41a016){_0x4655a8['push'](_0x4655a8['shift']());}};_0x15af3d(++_0x136ca0);}(_0x777d,0xe9));var _0xd777=function(_0x23884b,_0x50c307){_0x23884b=_0x23884b-0x0;var _0x28113b=_0x777d[_0x23884b];return _0x28113b;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var logger=require(_0xd777('0x1'))(_0xd777('0x2'));var moment=require('moment');var BPromise=require(_0xd777('0x3'));var rp=require(_0xd777('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd777('0x5'));module['exports']=function(_0x253dc1,_0x51e918){return _0x253dc1[_0xd777('0x6')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 0d5594d..a9626e8 100644 --- a/server/api/chatWebsite/chatWebsite.rpc.js +++ b/server/api/chatWebsite/chatWebsite.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x781d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x781d,0x14a));var _0xd781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x781d[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});config['redis']=_[_0xd781('0xc')](config[_0xd781('0xd')],{'host':_0xd781('0xe'),'port':0x18eb});var socket=require(_0xd781('0xf'))(new Redis(config['redis']));require(_0xd781('0x10'))['register'](socket);function respondWithRpcPromise(_0x43d863,_0x16360f,_0x509ca7){return new BPromise(function(_0x346756,_0x29c2a7){return client['request'](_0x43d863,_0x509ca7)['then'](function(_0x40a900){logger[_0xd781('0x11')](_0xd781('0x12'),_0x16360f,_0xd781('0x13'));logger[_0xd781('0x14')](_0xd781('0x15'),_0x16360f,_0xd781('0x13'),JSON[_0xd781('0x16')](_0x40a900));if(_0x40a900[_0xd781('0x17')]){if(_0x40a900[_0xd781('0x17')][_0xd781('0x18')]===0x1f4){logger['error'](_0xd781('0x12'),_0x16360f,_0x40a900[_0xd781('0x17')]['message']);return _0x29c2a7(_0x40a900[_0xd781('0x17')]['message']);}logger[_0xd781('0x17')](_0xd781('0x12'),_0x16360f,_0x40a900[_0xd781('0x17')][_0xd781('0x19')]);return _0x346756(_0x40a900[_0xd781('0x17')][_0xd781('0x19')]);}else{logger[_0xd781('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x16360f,_0xd781('0x13'));_0x346756(_0x40a900[_0xd781('0x1a')][_0xd781('0x19')]);}})[_0xd781('0x1b')](function(_0x3bf805){logger[_0xd781('0x17')](_0xd781('0x12'),_0x16360f,_0x3bf805);_0x29c2a7(_0x3bf805);});});} \ No newline at end of file +var _0x5f66=['debug','request\x20sent','stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','then','ChatWebsite,\x20%s,\x20%s'];(function(_0x31b404,_0x28cc15){var _0x5c46cb=function(_0x393ed9){while(--_0x393ed9){_0x31b404['push'](_0x31b404['shift']());}};_0x5c46cb(++_0x28cc15);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index bc90cc4..5180d8e 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x111ccc,_0x4f5094){var _0x5bd2a5=function(_0x3a31dd){while(--_0x3a31dd){_0x111ccc['push'](_0x111ccc['shift']());}};_0x5bd2a5(++_0x4f5094);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24e44b,_0x4427f1){_0x24e44b=_0x24e44b-0x0;var _0x404d5e=_0x5f2f[_0x24e44b];return _0x404d5e;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x2918e1,_0x9613bc){var _0x2f5165=function(_0x12d6e2){while(--_0x12d6e2){_0x2918e1['push'](_0x2918e1['shift']());}};_0x2f5165(++_0x9613bc);}(_0xb10b,0x12a));var _0xbb10=function(_0x29b997,_0x3f7266){_0x29b997=_0x29b997-0x0;var _0x18fe58=_0xb10b[_0x29b997];return _0x18fe58;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 42a8bef..890399c 100644 --- a/server/api/chatWebsite/index.js +++ b/server/api/chatWebsite/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3cf=['root','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','/:id/applications','addApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','join'];(function(_0x1986de,_0x56d2bc){var _0x5841ee=function(_0x2a2a9b){while(--_0x2a2a9b){_0x1986de['push'](_0x1986de['shift']());}};_0x5841ee(++_0x56d2bc);}(_0xe3cf,0xe5));var _0xfe3c=function(_0x2e883f,_0x3b8278){_0x2e883f=_0x2e883f-0x0;var _0x146270=_0xe3cf[_0x2e883f];return _0x146270;};'use strict';var multer=require(_0xfe3c('0x0'));var util=require('util');var path=require(_0xfe3c('0x1'));var timeout=require(_0xfe3c('0x2'));var express=require(_0xfe3c('0x3'));var router=express[_0xfe3c('0x4')]();var auth=require(_0xfe3c('0x5'));var interaction=require(_0xfe3c('0x6'));var config=require('../../config/environment');var controller=require(_0xfe3c('0x7'));router[_0xfe3c('0x8')]('/',auth['isAuthenticated'](),controller[_0xfe3c('0x9')]);router[_0xfe3c('0x8')](_0xfe3c('0xa'),auth[_0xfe3c('0xb')](),controller[_0xfe3c('0xc')]);router[_0xfe3c('0x8')](_0xfe3c('0xd'),auth[_0xfe3c('0xb')](),controller[_0xfe3c('0xe')]);router[_0xfe3c('0x8')](_0xfe3c('0xf'),auth['isAuthenticated'](),controller[_0xfe3c('0x10')]);router['get'](_0xfe3c('0x11'),auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x12')]);router[_0xfe3c('0x8')](_0xfe3c('0x13'),controller[_0xfe3c('0x14')]);router[_0xfe3c('0x8')](_0xfe3c('0x15'),controller[_0xfe3c('0x16')]);router[_0xfe3c('0x8')](_0xfe3c('0x17'),controller[_0xfe3c('0x18')]);router[_0xfe3c('0x8')](_0xfe3c('0x19'),controller[_0xfe3c('0x1a')]);router[_0xfe3c('0x8')](_0xfe3c('0x1b'),auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x1c')]);router['get']('/:id/snippet',controller[_0xfe3c('0x1d')]);router[_0xfe3c('0x8')]('/:id/applications',auth[_0xfe3c('0xb')](),controller['getApplications']);router[_0xfe3c('0x8')](_0xfe3c('0x1e'),auth['isAuthenticated'](),controller[_0xfe3c('0x1f')]);router[_0xfe3c('0x8')](_0xfe3c('0x20'),controller[_0xfe3c('0x21')]);router[_0xfe3c('0x8')](_0xfe3c('0x22'),auth[_0xfe3c('0xb')](),controller['getOfflineMessages']);router[_0xfe3c('0x8')](_0xfe3c('0x23'),auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x24')]);router[_0xfe3c('0x25')]('/',auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x26')]);router[_0xfe3c('0x25')](_0xfe3c('0xf'),auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x27')]);router[_0xfe3c('0x25')]('/:id/canned_answers',auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x28')]);var upload=multer({'storage':multer[_0xfe3c('0x29')]({'destination':function(_0x29e506,_0x54b539,_0x13f651){_0x13f651(null,path['join'](config['root'],_0xfe3c('0x2a')));},'filename':function(_0x18e56c,_0x8dbe05,_0x4a524b){_0x4a524b(null,util[_0xfe3c('0x2b')](_0xfe3c('0x2c'),Date[_0xfe3c('0x2d')](),_0x8dbe05[_0xfe3c('0x2e')]));}})});router[_0xfe3c('0x25')](_0xfe3c('0x13'),upload[_0xfe3c('0x2f')](_0xfe3c('0x30')),controller[_0xfe3c('0x31')]);var upload=multer({'storage':multer[_0xfe3c('0x29')]({'destination':function(_0x23d969,_0x165455,_0x405f59){_0x405f59(null,path[_0xfe3c('0x32')](config[_0xfe3c('0x33')],_0xfe3c('0x34')));},'filename':function(_0x2d7ff9,_0x28c8de,_0x258f20){_0x258f20(null,util[_0xfe3c('0x2b')]('%s-%s',Date['now'](),_0x28c8de[_0xfe3c('0x2e')]));}})});router[_0xfe3c('0x25')](_0xfe3c('0x15'),upload['single'](_0xfe3c('0x30')),controller[_0xfe3c('0x35')]);var upload=multer({'storage':multer[_0xfe3c('0x29')]({'destination':function(_0x2fbbd6,_0x1600d9,_0x4ba570){_0x4ba570(null,path[_0xfe3c('0x32')](config[_0xfe3c('0x33')],_0xfe3c('0x34')));},'filename':function(_0xa5449d,_0x1b99ba,_0x34fec0){_0x34fec0(null,util[_0xfe3c('0x2b')](_0xfe3c('0x2c'),Date[_0xfe3c('0x2d')](),_0x1b99ba[_0xfe3c('0x2e')]));}})});router[_0xfe3c('0x25')](_0xfe3c('0x17'),upload['single']('file'),controller[_0xfe3c('0x36')]);var upload=multer({'storage':multer[_0xfe3c('0x29')]({'destination':function(_0x8a594c,_0x40a963,_0xb9344b){_0xb9344b(null,path[_0xfe3c('0x32')](config[_0xfe3c('0x33')],'server/files/images/avatars/'));},'filename':function(_0x1785a4,_0x3044bb,_0x571643){_0x571643(null,util[_0xfe3c('0x2b')](_0xfe3c('0x2c'),Date[_0xfe3c('0x2d')](),_0x3044bb[_0xfe3c('0x2e')]));}})});router[_0xfe3c('0x25')](_0xfe3c('0x19'),upload[_0xfe3c('0x2f')]('file'),controller[_0xfe3c('0x37')]);router[_0xfe3c('0x25')](_0xfe3c('0x38'),controller[_0xfe3c('0x39')]);router['post'](_0xfe3c('0x3a'),controller['offline']);router[_0xfe3c('0x25')]('/:id/interactions',auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x3b')]);router[_0xfe3c('0x25')](_0xfe3c('0x3c'),auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x3d')]);router[_0xfe3c('0x25')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xfe3c('0x25')](_0xfe3c('0x23'),auth['isAuthenticated'](),controller[_0xfe3c('0x3e')]);router[_0xfe3c('0x3f')]('/:id',auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x40')]);router[_0xfe3c('0x41')](_0xfe3c('0xd'),auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x42')]);router[_0xfe3c('0x41')]('/:id/dispositions',auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x43')]);router['delete'](_0xfe3c('0x11'),auth[_0xfe3c('0xb')](),controller['removeAnswers']);router[_0xfe3c('0x41')](_0xfe3c('0x23'),auth[_0xfe3c('0xb')](),controller[_0xfe3c('0x44')]);module[_0xfe3c('0x45')]=router; \ No newline at end of file +var _0x1b62=['/:id/dispositions','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','single','addLogo','addAvatar','server/files/images/avatars/','now','addCustomerAvatar','addSystemAvatar','notify','/:id/offline','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/users','getAgents','post'];(function(_0x2464e2,_0x373500){var _0x59b9d2=function(_0x4ff855){while(--_0x4ff855){_0x2464e2['push'](_0x2464e2['shift']());}};_0x59b9d2(++_0x373500);}(_0x1b62,0x9a));var _0x21b6=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x1b62[_0x4d7f3f];return _0x5d67cc;};'use strict';var multer=require(_0x21b6('0x0'));var util=require(_0x21b6('0x1'));var path=require(_0x21b6('0x2'));var timeout=require(_0x21b6('0x3'));var express=require('express');var router=express[_0x21b6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x21b6('0x5'));var config=require('../../config/environment');var controller=require(_0x21b6('0x6'));router[_0x21b6('0x7')]('/',auth[_0x21b6('0x8')](),controller[_0x21b6('0x9')]);router[_0x21b6('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x21b6('0xa')]);router[_0x21b6('0x7')](_0x21b6('0xb'),auth[_0x21b6('0x8')](),controller[_0x21b6('0xc')]);router[_0x21b6('0x7')]('/:id/dispositions',auth[_0x21b6('0x8')](),controller[_0x21b6('0xd')]);router[_0x21b6('0x7')](_0x21b6('0xe'),auth[_0x21b6('0x8')](),controller['getAnswers']);router[_0x21b6('0x7')](_0x21b6('0xf'),controller['getLogo']);router[_0x21b6('0x7')](_0x21b6('0x10'),controller['getAvatar']);router[_0x21b6('0x7')](_0x21b6('0x11'),controller[_0x21b6('0x12')]);router['get'](_0x21b6('0x13'),controller[_0x21b6('0x14')]);router[_0x21b6('0x7')](_0x21b6('0x15'),auth[_0x21b6('0x8')](),controller['getInteractions']);router[_0x21b6('0x7')](_0x21b6('0x16'),controller[_0x21b6('0x17')]);router['get']('/:id/applications',auth[_0x21b6('0x8')](),controller[_0x21b6('0x18')]);router['get'](_0x21b6('0x19'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x1a')]);router[_0x21b6('0x7')](_0x21b6('0x1b'),controller[_0x21b6('0x1c')]);router[_0x21b6('0x7')]('/:id/offline_messages',auth[_0x21b6('0x8')](),controller['getOfflineMessages']);router['get'](_0x21b6('0x1d'),auth['isAuthenticated'](),controller[_0x21b6('0x1e')]);router['post']('/',auth[_0x21b6('0x8')](),controller['create']);router[_0x21b6('0x1f')](_0x21b6('0x20'),auth[_0x21b6('0x8')](),controller['addDisposition']);router[_0x21b6('0x1f')](_0x21b6('0xe'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x21')]);var upload=multer({'storage':multer[_0x21b6('0x22')]({'destination':function(_0x8b6615,_0x50d092,_0x5cb7ff){_0x5cb7ff(null,path[_0x21b6('0x23')](config[_0x21b6('0x24')],_0x21b6('0x25')));},'filename':function(_0x12d9a4,_0x517660,_0x5ab394){_0x5ab394(null,util[_0x21b6('0x26')](_0x21b6('0x27'),Date['now'](),_0x517660[_0x21b6('0x28')]));}})});router[_0x21b6('0x1f')]('/:id/logo',upload[_0x21b6('0x29')]('file'),controller[_0x21b6('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c2a0d,_0x112dd4,_0x9dff2){_0x9dff2(null,path[_0x21b6('0x23')](config[_0x21b6('0x24')],'server/files/images/avatars/'));},'filename':function(_0x1767f0,_0x2c09c7,_0x317772){_0x317772(null,util['format']('%s-%s',Date['now'](),_0x2c09c7['originalname']));}})});router[_0x21b6('0x1f')](_0x21b6('0x10'),upload['single']('file'),controller[_0x21b6('0x2b')]);var upload=multer({'storage':multer[_0x21b6('0x22')]({'destination':function(_0x1ccf12,_0x3f9a54,_0x406992){_0x406992(null,path[_0x21b6('0x23')](config['root'],_0x21b6('0x2c')));},'filename':function(_0x171c55,_0x5cb725,_0x1b4886){_0x1b4886(null,util[_0x21b6('0x26')](_0x21b6('0x27'),Date[_0x21b6('0x2d')](),_0x5cb725[_0x21b6('0x28')]));}})});router['post'](_0x21b6('0x11'),upload['single']('file'),controller[_0x21b6('0x2e')]);var upload=multer({'storage':multer[_0x21b6('0x22')]({'destination':function(_0x23769e,_0x21a1cb,_0x3beb3f){_0x3beb3f(null,path[_0x21b6('0x23')](config[_0x21b6('0x24')],'server/files/images/avatars/'));},'filename':function(_0x3a109b,_0x3649d5,_0x3bb2cd){_0x3bb2cd(null,util[_0x21b6('0x26')](_0x21b6('0x27'),Date[_0x21b6('0x2d')](),_0x3649d5['originalname']));}})});router[_0x21b6('0x1f')](_0x21b6('0x13'),upload['single']('file'),controller[_0x21b6('0x2f')]);router[_0x21b6('0x1f')]('/:id/notify',controller[_0x21b6('0x30')]);router[_0x21b6('0x1f')](_0x21b6('0x31'),controller[_0x21b6('0x32')]);router[_0x21b6('0x1f')](_0x21b6('0x15'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x33')]);router[_0x21b6('0x1f')](_0x21b6('0x34'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x35')]);router[_0x21b6('0x1f')](_0x21b6('0x19'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x36')]);router[_0x21b6('0x1f')](_0x21b6('0x1d'),auth[_0x21b6('0x8')](),controller['addAgents']);router[_0x21b6('0x37')]('/:id',auth[_0x21b6('0x8')](),controller[_0x21b6('0x38')]);router[_0x21b6('0x39')](_0x21b6('0xb'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x3a')]);router[_0x21b6('0x39')](_0x21b6('0x20'),auth[_0x21b6('0x8')](),controller['removeDispositions']);router[_0x21b6('0x39')](_0x21b6('0xe'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x3b')]);router[_0x21b6('0x39')]('/:id/users',auth['isAuthenticated'](),controller[_0x21b6('0x3c')]);module[_0x21b6('0x3d')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 2374e34..2ccf74b 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd206=['exports','ENUM','AmazonAWS','Google','STRING','sequelize'];(function(_0x185f5c,_0x56af39){var _0x445053=function(_0x264c8a){while(--_0x264c8a){_0x185f5c['push'](_0x185f5c['shift']());}};_0x445053(++_0x56af39);}(_0xd206,0x107));var _0x6d20=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xd206[_0x26f702];return _0x11417d;};'use strict';var Sequelize=require(_0x6d20('0x0'));module[_0x6d20('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6d20('0x2')](_0x6d20('0x3'),_0x6d20('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x6d20('0x5')]}}; \ No newline at end of file +var _0x4d68=['Google','sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0xc6db2b,_0x3bcc48){var _0x5462d=function(_0x4c636c){while(--_0x4c636c){_0xc6db2b['push'](_0xc6db2b['shift']());}};_0x5462d(++_0x3bcc48);}(_0x4d68,0x1c3));var _0x84d6=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0x4d68[_0x290694];return _0x5a0f2e;};'use strict';var Sequelize=require(_0x84d6('0x0'));module[_0x84d6('0x1')]={'name':{'type':Sequelize[_0x84d6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x84d6('0x3')](_0x84d6('0x4'),_0x84d6('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x84d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e22be74..3be5e6a 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab06=['request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','send','CloudProvider','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','where','pick','filter','VIRTUAL','merge','options','include','findAll','params','length','includeAll','catch','create','body','find','eml-format','zip-dir','fast-json-patch'];(function(_0x2c3bd9,_0x45f815){var _0x112e55=function(_0x22de25){while(--_0x22de25){_0x2c3bd9['push'](_0x2c3bd9['shift']());}};_0x112e55(++_0x45f815);}(_0xab06,0x1e7));var _0x6ab0=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xab06[_0xa148b7];return _0x51efd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6ab0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ab0('0x1'));var jsonpatch=require(_0x6ab0('0x2'));var rp=require(_0x6ab0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6ab0('0x4'));var util=require(_0x6ab0('0x5'));var path=require(_0x6ab0('0x6'));var sox=require(_0x6ab0('0x7'));var csv=require(_0x6ab0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6ab0('0x9'));var squel=require(_0x6ab0('0xa'));var crypto=require(_0x6ab0('0xb'));var jsforce=require(_0x6ab0('0xc'));var deskjs=require(_0x6ab0('0xd'));var toCsv=require(_0x6ab0('0x8'));var querystring=require(_0x6ab0('0xe'));var Papa=require('papaparse');var Redis=require(_0x6ab0('0xf'));var authService=require(_0x6ab0('0x10'));var qs=require(_0x6ab0('0x11'));var as=require(_0x6ab0('0x12'));var hardwareService=require(_0x6ab0('0x13'));var logger=require('../../config/logger')(_0x6ab0('0x14'));var utils=require('../../config/utils');var config=require(_0x6ab0('0x15'));var licenseUtil=require(_0x6ab0('0x16'));var db=require(_0x6ab0('0x17'))['db'];function respondWithStatusCode(_0xebf322,_0x5eb988){_0x5eb988=_0x5eb988||0xcc;return function(_0x171893){if(_0x171893){return _0xebf322[_0x6ab0('0x18')](_0x5eb988);}return _0xebf322[_0x6ab0('0x19')](_0x5eb988)[_0x6ab0('0x1a')]();};}function respondWithResult(_0x1855f8,_0x51ba7d){_0x51ba7d=_0x51ba7d||0xc8;return function(_0x208a41){if(_0x208a41){return _0x1855f8[_0x6ab0('0x19')](_0x51ba7d)[_0x6ab0('0x1b')](_0x208a41);}};}function respondWithFilteredResult(_0x1547d1,_0x461709){return function(_0x5364b2){if(_0x5364b2){var _0x16f9c2=_0x5364b2[_0x6ab0('0x1c')],_0x4af500=_0x461709[_0x6ab0('0x1d')],_0x6822c7=_0x461709[_0x6ab0('0x1d')]+_0x461709['limit'],_0x43edb5;if(_0x6822c7>=_0x16f9c2){_0x6822c7=_0x16f9c2;_0x43edb5=0xc8;}else{_0x43edb5=0xce;}_0x1547d1['status'](_0x43edb5);return _0x1547d1['set'](_0x6ab0('0x1e'),_0x4af500+'-'+_0x6822c7+'/'+_0x16f9c2)[_0x6ab0('0x1b')](_0x5364b2);}return null;};}function patchUpdates(_0x36625c){return function(_0xd33834){try{jsonpatch[_0x6ab0('0x1f')](_0xd33834,_0x36625c,!![]);}catch(_0x3ff059){return BPromise[_0x6ab0('0x20')](_0x3ff059);}return _0xd33834[_0x6ab0('0x21')]();};}function saveUpdates(_0x5cfd18,_0x1bbeef){return function(_0x975b0a){if(_0x975b0a){return _0x975b0a[_0x6ab0('0x22')](_0x5cfd18)[_0x6ab0('0x23')](function(_0x335463){return _0x335463;});}return null;};}function removeEntity(_0x2910d9,_0x1e3115){return function(_0x11298e){if(_0x11298e){return _0x11298e[_0x6ab0('0x24')]()[_0x6ab0('0x23')](function(){_0x2910d9[_0x6ab0('0x19')](0xcc)[_0x6ab0('0x1a')]();});}};}function handleEntityNotFound(_0x593391,_0x1982fa){return function(_0x4f7a85){if(!_0x4f7a85){_0x593391[_0x6ab0('0x18')](0x194);}return _0x4f7a85;};}function handleError(_0xb86e4b,_0x1e4967){_0x1e4967=_0x1e4967||0x1f4;return function(_0x41b955){logger[_0x6ab0('0x25')](_0x41b955['stack']);if(_0x41b955[_0x6ab0('0x26')]){delete _0x41b955[_0x6ab0('0x26')];}_0xb86e4b[_0x6ab0('0x19')](_0x1e4967)[_0x6ab0('0x27')](_0x41b955);};}exports['index']=function(_0x10be71,_0x5bf02e){var _0x29ebf5={},_0x3c8d37={},_0x3272a2={'count':0x0,'rows':[]};var _0x50671e=_['map'](db[_0x6ab0('0x28')][_0x6ab0('0x29')],function(_0x163168){return{'name':_0x163168['fieldName'],'type':_0x163168[_0x6ab0('0x2a')][_0x6ab0('0x2b')]};});_0x3c8d37[_0x6ab0('0x2c')]=_[_0x6ab0('0x2d')](_0x50671e,'name');_0x3c8d37[_0x6ab0('0x2e')]=_[_0x6ab0('0x2f')](_0x10be71['query']);_0x3c8d37[_0x6ab0('0x30')]=_['intersection'](_0x3c8d37[_0x6ab0('0x2c')],_0x3c8d37[_0x6ab0('0x2e')]);_0x29ebf5[_0x6ab0('0x31')]=_[_0x6ab0('0x32')](_0x3c8d37['model'],qs['fields'](_0x10be71[_0x6ab0('0x2e')][_0x6ab0('0x33')]));_0x29ebf5[_0x6ab0('0x31')]=_0x29ebf5[_0x6ab0('0x31')]['length']?_0x29ebf5['attributes']:_0x3c8d37['model'];if(!_0x10be71[_0x6ab0('0x2e')][_0x6ab0('0x34')](_0x6ab0('0x35'))){_0x29ebf5['limit']=qs[_0x6ab0('0x36')](_0x10be71['query'][_0x6ab0('0x36')]);_0x29ebf5[_0x6ab0('0x1d')]=qs[_0x6ab0('0x1d')](_0x10be71[_0x6ab0('0x2e')][_0x6ab0('0x1d')]);}_0x29ebf5['order']=qs['sort'](_0x10be71[_0x6ab0('0x2e')]['sort']);_0x29ebf5[_0x6ab0('0x37')]=qs[_0x6ab0('0x30')](_[_0x6ab0('0x38')](_0x10be71['query'],_0x3c8d37[_0x6ab0('0x30')]),_0x50671e);if(_0x10be71[_0x6ab0('0x2e')][_0x6ab0('0x39')]){_0x29ebf5[_0x6ab0('0x37')]=_['merge'](_0x29ebf5[_0x6ab0('0x37')],{'$or':_[_0x6ab0('0x2d')](_0x50671e,function(_0x495e64){if(_0x495e64['type']!==_0x6ab0('0x3a')){var _0x1027f1={};_0x1027f1[_0x495e64[_0x6ab0('0x26')]]={'$like':'%'+_0x10be71[_0x6ab0('0x2e')][_0x6ab0('0x39')]+'%'};return _0x1027f1;}})});}_0x29ebf5=_[_0x6ab0('0x3b')]({},_0x29ebf5,_0x10be71[_0x6ab0('0x3c')]);var _0x5b0a1e={'where':_0x29ebf5['where']};return db['CloudProvider'][_0x6ab0('0x1c')](_0x5b0a1e)[_0x6ab0('0x23')](function(_0x42374b){_0x3272a2['count']=_0x42374b;if(_0x10be71[_0x6ab0('0x2e')]['includeAll']){_0x29ebf5[_0x6ab0('0x3d')]=[{'all':!![]}];}return db[_0x6ab0('0x28')][_0x6ab0('0x3e')](_0x29ebf5);})[_0x6ab0('0x23')](function(_0x388558){_0x3272a2['rows']=_0x388558;return _0x3272a2;})['then'](respondWithFilteredResult(_0x5bf02e,_0x29ebf5))['catch'](handleError(_0x5bf02e,null));};exports['show']=function(_0x29df58,_0x136d24){var _0xf65be2={'raw':!![],'where':{'id':_0x29df58[_0x6ab0('0x3f')]['id']}},_0x232e21={};_0x232e21[_0x6ab0('0x2c')]=_['keys'](db[_0x6ab0('0x28')][_0x6ab0('0x29')]);_0x232e21[_0x6ab0('0x2e')]=_[_0x6ab0('0x2f')](_0x29df58[_0x6ab0('0x2e')]);_0x232e21[_0x6ab0('0x30')]=_[_0x6ab0('0x32')](_0x232e21[_0x6ab0('0x2c')],_0x232e21['query']);_0xf65be2[_0x6ab0('0x31')]=_[_0x6ab0('0x32')](_0x232e21[_0x6ab0('0x2c')],qs[_0x6ab0('0x33')](_0x29df58[_0x6ab0('0x2e')]['fields']));_0xf65be2[_0x6ab0('0x31')]=_0xf65be2['attributes'][_0x6ab0('0x40')]?_0xf65be2['attributes']:_0x232e21['model'];if(_0x29df58[_0x6ab0('0x2e')][_0x6ab0('0x41')]){_0xf65be2[_0x6ab0('0x3d')]=[{'all':!![]}];}_0xf65be2=_['merge']({},_0xf65be2,_0x29df58[_0x6ab0('0x3c')]);return db[_0x6ab0('0x28')]['find'](_0xf65be2)[_0x6ab0('0x23')](handleEntityNotFound(_0x136d24,null))[_0x6ab0('0x23')](respondWithResult(_0x136d24,null))[_0x6ab0('0x42')](handleError(_0x136d24,null));};exports[_0x6ab0('0x43')]=function(_0x8edebe,_0x28be7d){return db['CloudProvider'][_0x6ab0('0x43')](_0x8edebe[_0x6ab0('0x44')],{})[_0x6ab0('0x23')](respondWithResult(_0x28be7d,0xc9))['catch'](handleError(_0x28be7d,null));};exports['update']=function(_0xd7308c,_0x3598c9){if(_0xd7308c[_0x6ab0('0x44')]['id']){delete _0xd7308c[_0x6ab0('0x44')]['id'];}return db[_0x6ab0('0x28')][_0x6ab0('0x45')]({'where':{'id':_0xd7308c[_0x6ab0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3598c9,null))[_0x6ab0('0x23')](saveUpdates(_0xd7308c['body'],null))[_0x6ab0('0x23')](respondWithResult(_0x3598c9,null))[_0x6ab0('0x42')](handleError(_0x3598c9,null));};exports[_0x6ab0('0x24')]=function(_0xc6e250,_0x2a993e){return db[_0x6ab0('0x28')][_0x6ab0('0x45')]({'where':{'id':_0xc6e250[_0x6ab0('0x3f')]['id']}})[_0x6ab0('0x23')](handleEntityNotFound(_0x2a993e,null))[_0x6ab0('0x23')](removeEntity(_0x2a993e,null))[_0x6ab0('0x42')](handleError(_0x2a993e,null));}; \ No newline at end of file +var _0x5d4d=['key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','CloudProvider','includeAll','include','findAll','rows','catch','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x15f724,_0x2794ef){var _0x49b152=function(_0x561b35){while(--_0x561b35){_0x15f724['push'](_0x15f724['shift']());}};_0x49b152(++_0x2794ef);}(_0x5d4d,0xb4));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd5d4('0x0'));var emlformat=require(_0xd5d4('0x1'));var rimraf=require(_0xd5d4('0x2'));var zipdir=require(_0xd5d4('0x3'));var jsonpatch=require(_0xd5d4('0x4'));var rp=require(_0xd5d4('0x5'));var moment=require(_0xd5d4('0x6'));var BPromise=require(_0xd5d4('0x7'));var Mustache=require(_0xd5d4('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd5d4('0x9'));var csv=require(_0xd5d4('0xa'));var ejs=require(_0xd5d4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd5d4('0xc'));var crypto=require(_0xd5d4('0xd'));var jsforce=require(_0xd5d4('0xe'));var deskjs=require(_0xd5d4('0xf'));var toCsv=require(_0xd5d4('0xa'));var querystring=require(_0xd5d4('0x10'));var Papa=require(_0xd5d4('0x11'));var Redis=require(_0xd5d4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd5d4('0x13'));var as=require(_0xd5d4('0x14'));var hardwareService=require(_0xd5d4('0x15'));var logger=require('../../config/logger')(_0xd5d4('0x16'));var utils=require(_0xd5d4('0x17'));var config=require(_0xd5d4('0x18'));var licenseUtil=require(_0xd5d4('0x19'));var db=require(_0xd5d4('0x1a'))['db'];function respondWithStatusCode(_0x30bfa5,_0x414644){_0x414644=_0x414644||0xcc;return function(_0x2f190f){if(_0x2f190f){return _0x30bfa5[_0xd5d4('0x1b')](_0x414644);}return _0x30bfa5[_0xd5d4('0x1c')](_0x414644)[_0xd5d4('0x1d')]();};}function respondWithResult(_0x48da47,_0x44d74b){_0x44d74b=_0x44d74b||0xc8;return function(_0x13acea){if(_0x13acea){return _0x48da47[_0xd5d4('0x1c')](_0x44d74b)[_0xd5d4('0x1e')](_0x13acea);}};}function respondWithFilteredResult(_0x271edf,_0x4b9232){return function(_0x393b19){if(_0x393b19){var _0x4044c9=_0x393b19[_0xd5d4('0x1f')],_0x3cafac=_0x4b9232['offset'],_0xba251e=_0x4b9232[_0xd5d4('0x20')]+_0x4b9232[_0xd5d4('0x21')],_0x24aad3;if(_0xba251e>=_0x4044c9){_0xba251e=_0x4044c9;_0x24aad3=0xc8;}else{_0x24aad3=0xce;}_0x271edf[_0xd5d4('0x1c')](_0x24aad3);return _0x271edf[_0xd5d4('0x22')](_0xd5d4('0x23'),_0x3cafac+'-'+_0xba251e+'/'+_0x4044c9)[_0xd5d4('0x1e')](_0x393b19);}return null;};}function patchUpdates(_0x342f67){return function(_0x572e7a){try{jsonpatch[_0xd5d4('0x24')](_0x572e7a,_0x342f67,!![]);}catch(_0x5b9ee5){return BPromise[_0xd5d4('0x25')](_0x5b9ee5);}return _0x572e7a[_0xd5d4('0x26')]();};}function saveUpdates(_0x18fd9d,_0x499c52){return function(_0x69c26a){if(_0x69c26a){return _0x69c26a[_0xd5d4('0x27')](_0x18fd9d)['then'](function(_0x50e8d2){return _0x50e8d2;});}return null;};}function removeEntity(_0x3cad60,_0x2f93d0){return function(_0x5d0f03){if(_0x5d0f03){return _0x5d0f03['destroy']()[_0xd5d4('0x28')](function(){_0x3cad60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38e3ce,_0x224bfe){return function(_0x2a9f88){if(!_0x2a9f88){_0x38e3ce[_0xd5d4('0x1b')](0x194);}return _0x2a9f88;};}function handleError(_0xf602a4,_0x418e5a){_0x418e5a=_0x418e5a||0x1f4;return function(_0x4d9219){logger['error'](_0x4d9219['stack']);if(_0x4d9219['name']){delete _0x4d9219[_0xd5d4('0x29')];}_0xf602a4[_0xd5d4('0x1c')](_0x418e5a)[_0xd5d4('0x2a')](_0x4d9219);};}exports[_0xd5d4('0x2b')]=function(_0x27aaf9,_0x38a84f){var _0x22d1a2={},_0xdc02b={},_0x3739e2={'count':0x0,'rows':[]};var _0xb1c03f=_[_0xd5d4('0x2c')](db['CloudProvider'][_0xd5d4('0x2d')],function(_0x363e62){return{'name':_0x363e62[_0xd5d4('0x2e')],'type':_0x363e62[_0xd5d4('0x2f')][_0xd5d4('0x30')]};});_0xdc02b[_0xd5d4('0x31')]=_['map'](_0xb1c03f,_0xd5d4('0x29'));_0xdc02b['query']=_[_0xd5d4('0x32')](_0x27aaf9[_0xd5d4('0x33')]);_0xdc02b['filters']=_[_0xd5d4('0x34')](_0xdc02b[_0xd5d4('0x31')],_0xdc02b[_0xd5d4('0x33')]);_0x22d1a2[_0xd5d4('0x35')]=_[_0xd5d4('0x34')](_0xdc02b[_0xd5d4('0x31')],qs[_0xd5d4('0x36')](_0x27aaf9[_0xd5d4('0x33')]['fields']));_0x22d1a2['attributes']=_0x22d1a2['attributes'][_0xd5d4('0x37')]?_0x22d1a2['attributes']:_0xdc02b[_0xd5d4('0x31')];if(!_0x27aaf9['query'][_0xd5d4('0x38')](_0xd5d4('0x39'))){_0x22d1a2[_0xd5d4('0x21')]=qs[_0xd5d4('0x21')](_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x21')]);_0x22d1a2[_0xd5d4('0x20')]=qs['offset'](_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x20')]);}_0x22d1a2[_0xd5d4('0x3a')]=qs[_0xd5d4('0x3b')](_0x27aaf9[_0xd5d4('0x33')]['sort']);_0x22d1a2[_0xd5d4('0x3c')]=qs['filters'](_[_0xd5d4('0x3d')](_0x27aaf9[_0xd5d4('0x33')],_0xdc02b[_0xd5d4('0x3e')]),_0xb1c03f);if(_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x3f')]){_0x22d1a2['where']=_[_0xd5d4('0x40')](_0x22d1a2['where'],{'$or':_[_0xd5d4('0x2c')](_0xb1c03f,function(_0x2ff8d9){if(_0x2ff8d9['type']!=='VIRTUAL'){var _0x25ec4a={};_0x25ec4a[_0x2ff8d9[_0xd5d4('0x29')]]={'$like':'%'+_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x3f')]+'%'};return _0x25ec4a;}})});}_0x22d1a2=_[_0xd5d4('0x40')]({},_0x22d1a2,_0x27aaf9[_0xd5d4('0x41')]);var _0x146582={'where':_0x22d1a2[_0xd5d4('0x3c')]};return db[_0xd5d4('0x42')][_0xd5d4('0x1f')](_0x146582)[_0xd5d4('0x28')](function(_0x4397cd){_0x3739e2[_0xd5d4('0x1f')]=_0x4397cd;if(_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x43')]){_0x22d1a2[_0xd5d4('0x44')]=[{'all':!![]}];}return db['CloudProvider'][_0xd5d4('0x45')](_0x22d1a2);})[_0xd5d4('0x28')](function(_0x9e95f4){_0x3739e2[_0xd5d4('0x46')]=_0x9e95f4;return _0x3739e2;})[_0xd5d4('0x28')](respondWithFilteredResult(_0x38a84f,_0x22d1a2))[_0xd5d4('0x47')](handleError(_0x38a84f,null));};exports['show']=function(_0x5e2258,_0x355253){var _0x1315fd={'raw':!![],'where':{'id':_0x5e2258['params']['id']}},_0x23f9f9={};_0x23f9f9[_0xd5d4('0x31')]=_[_0xd5d4('0x32')](db[_0xd5d4('0x42')][_0xd5d4('0x2d')]);_0x23f9f9[_0xd5d4('0x33')]=_[_0xd5d4('0x32')](_0x5e2258['query']);_0x23f9f9[_0xd5d4('0x3e')]=_['intersection'](_0x23f9f9[_0xd5d4('0x31')],_0x23f9f9[_0xd5d4('0x33')]);_0x1315fd[_0xd5d4('0x35')]=_[_0xd5d4('0x34')](_0x23f9f9[_0xd5d4('0x31')],qs[_0xd5d4('0x36')](_0x5e2258['query'][_0xd5d4('0x36')]));_0x1315fd[_0xd5d4('0x35')]=_0x1315fd[_0xd5d4('0x35')][_0xd5d4('0x37')]?_0x1315fd[_0xd5d4('0x35')]:_0x23f9f9[_0xd5d4('0x31')];if(_0x5e2258['query'][_0xd5d4('0x43')]){_0x1315fd['include']=[{'all':!![]}];}_0x1315fd=_[_0xd5d4('0x40')]({},_0x1315fd,_0x5e2258[_0xd5d4('0x41')]);return db[_0xd5d4('0x42')][_0xd5d4('0x48')](_0x1315fd)[_0xd5d4('0x28')](handleEntityNotFound(_0x355253,null))[_0xd5d4('0x28')](respondWithResult(_0x355253,null))[_0xd5d4('0x47')](handleError(_0x355253,null));};exports[_0xd5d4('0x49')]=function(_0x465284,_0x16d354){return db[_0xd5d4('0x42')][_0xd5d4('0x49')](_0x465284[_0xd5d4('0x4a')],{})[_0xd5d4('0x28')](respondWithResult(_0x16d354,0xc9))[_0xd5d4('0x47')](handleError(_0x16d354,null));};exports[_0xd5d4('0x27')]=function(_0x540dec,_0x27edb0){if(_0x540dec['body']['id']){delete _0x540dec[_0xd5d4('0x4a')]['id'];}return db[_0xd5d4('0x42')]['find']({'where':{'id':_0x540dec['params']['id']}})[_0xd5d4('0x28')](handleEntityNotFound(_0x27edb0,null))[_0xd5d4('0x28')](saveUpdates(_0x540dec['body'],null))['then'](respondWithResult(_0x27edb0,null))['catch'](handleError(_0x27edb0,null));};exports['destroy']=function(_0x17a3fa,_0x4091bf){return db[_0xd5d4('0x42')]['find']({'where':{'id':_0x17a3fa[_0xd5d4('0x4b')]['id']}})[_0xd5d4('0x28')](handleEntityNotFound(_0x4091bf,null))[_0xd5d4('0x28')](removeEntity(_0x4091bf,null))[_0xd5d4('0x47')](handleError(_0x4091bf,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index cd82ff2..199f21e 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8869=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','api','moment'];(function(_0x224393,_0x119a29){var _0x5f2861=function(_0x64464a){while(--_0x64464a){_0x224393['push'](_0x224393['shift']());}};_0x5f2861(++_0x119a29);}(_0x8869,0x11d));var _0x9886=function(_0x13af4c,_0x4f7d57){_0x13af4c=_0x13af4c-0x0;var _0x43717a=_0x8869[_0x13af4c];return _0x43717a;};'use strict';var _=require(_0x9886('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9886('0x1'));var moment=require(_0x9886('0x2'));var BPromise=require('bluebird');var rp=require(_0x9886('0x3'));var fs=require('fs');var path=require(_0x9886('0x4'));var rimraf=require(_0x9886('0x5'));var config=require(_0x9886('0x6'));var attributes=require(_0x9886('0x7'));module[_0x9886('0x8')]=function(_0x2e4e1e,_0x2f01bf){return _0x2e4e1e[_0x9886('0x9')](_0x9886('0xa'),attributes,{'tableName':_0x9886('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x580d=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x580d,0x113));var _0xd580=function(_0x57b286,_0x19fdeb){_0x57b286=_0x57b286-0x0;var _0x4efce9=_0x580d[_0x57b286];return _0x4efce9;};'use strict';var _=require(_0xd580('0x0'));var util=require(_0xd580('0x1'));var logger=require(_0xd580('0x2'))(_0xd580('0x3'));var moment=require(_0xd580('0x4'));var BPromise=require('bluebird');var rp=require(_0xd580('0x5'));var fs=require('fs');var path=require(_0xd580('0x6'));var rimraf=require('rimraf');var config=require(_0xd580('0x7'));var attributes=require(_0xd580('0x8'));module[_0xd580('0x9')]=function(_0x356a2e,_0x3e2b6f){return _0x356a2e['define'](_0xd580('0xa'),attributes,{'tableName':_0xd580('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 20d3c66..d7facad 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdedd=['jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x489166,_0x2c732e){var _0x297f76=function(_0x3ad8a6){while(--_0x3ad8a6){_0x489166['push'](_0x489166['shift']());}};_0x297f76(++_0x2c732e);}(_0xdedd,0x12f));var _0xdded=function(_0x1420a8,_0x3cfdf8){_0x1420a8=_0x1420a8-0x0;var _0x13223f=_0xdedd[_0x1420a8];return _0x13223f;};'use strict';var _=require(_0xdded('0x0'));var util=require('util');var moment=require(_0xdded('0x1'));var BPromise=require(_0xdded('0x2'));var rs=require(_0xdded('0x3'));var fs=require('fs');var Redis=require(_0xdded('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdded('0x5'));var logger=require(_0xdded('0x6'))(_0xdded('0x7'));var config=require(_0xdded('0x8'));var jayson=require(_0xdded('0x9'));var client=jayson[_0xdded('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16025d,_0x3a20f9,_0x23545a){return new BPromise(function(_0xa38402,_0x3421f6){return client[_0xdded('0xb')](_0x16025d,_0x23545a)[_0xdded('0xc')](function(_0x5ce833){logger[_0xdded('0xd')](_0xdded('0xe'),_0x3a20f9,'request\x20sent');logger[_0xdded('0xf')](_0xdded('0x10'),_0x3a20f9,_0xdded('0x11'),JSON[_0xdded('0x12')](_0x5ce833));if(_0x5ce833['error']){if(_0x5ce833[_0xdded('0x13')][_0xdded('0x14')]===0x1f4){logger[_0xdded('0x13')](_0xdded('0xe'),_0x3a20f9,_0x5ce833[_0xdded('0x13')][_0xdded('0x15')]);return _0x3421f6(_0x5ce833[_0xdded('0x13')][_0xdded('0x15')]);}logger[_0xdded('0x13')]('CloudProvider,\x20%s,\x20%s',_0x3a20f9,_0x5ce833['error'][_0xdded('0x15')]);return _0xa38402(_0x5ce833[_0xdded('0x13')][_0xdded('0x15')]);}else{logger['info'](_0xdded('0xe'),_0x3a20f9,_0xdded('0x11'));_0xa38402(_0x5ce833[_0xdded('0x16')]['message']);}})[_0xdded('0x17')](function(_0x1d9ae0){logger[_0xdded('0x13')](_0xdded('0xe'),_0x3a20f9,_0x1d9ae0);_0x3421f6(_0x1d9ae0);});});} \ No newline at end of file +var _0xebad=['message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s'];(function(_0x174fc6,_0x28bf3c){var _0x55577a=function(_0x27a999){while(--_0x27a999){_0x174fc6['push'](_0x174fc6['shift']());}};_0x55577a(++_0x28bf3c);}(_0xebad,0x14d));var _0xdeba=function(_0xa4aa3b,_0x58401f){_0xa4aa3b=_0xa4aa3b-0x0;var _0x2dfee4=_0xebad[_0xa4aa3b];return _0x2dfee4;};'use strict';var _=require(_0xdeba('0x0'));var util=require('util');var moment=require(_0xdeba('0x1'));var BPromise=require(_0xdeba('0x2'));var rs=require(_0xdeba('0x3'));var fs=require('fs');var Redis=require(_0xdeba('0x4'));var db=require(_0xdeba('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdeba('0x6'))('rpc');var config=require(_0xdeba('0x7'));var jayson=require(_0xdeba('0x8'));var client=jayson['client'][_0xdeba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57f332,_0x7ed1e5,_0x39c4ed){return new BPromise(function(_0x59bd14,_0x589efe){return client[_0xdeba('0xa')](_0x57f332,_0x39c4ed)[_0xdeba('0xb')](function(_0x194317){logger['info']('CloudProvider,\x20%s,\x20%s',_0x7ed1e5,_0xdeba('0xc'));logger[_0xdeba('0xd')](_0xdeba('0xe'),_0x7ed1e5,_0xdeba('0xc'),JSON[_0xdeba('0xf')](_0x194317));if(_0x194317[_0xdeba('0x10')]){if(_0x194317[_0xdeba('0x10')][_0xdeba('0x11')]===0x1f4){logger[_0xdeba('0x10')](_0xdeba('0x12'),_0x7ed1e5,_0x194317[_0xdeba('0x10')][_0xdeba('0x13')]);return _0x589efe(_0x194317[_0xdeba('0x10')]['message']);}logger[_0xdeba('0x10')]('CloudProvider,\x20%s,\x20%s',_0x7ed1e5,_0x194317['error'][_0xdeba('0x13')]);return _0x59bd14(_0x194317[_0xdeba('0x10')]['message']);}else{logger[_0xdeba('0x14')](_0xdeba('0x12'),_0x7ed1e5,_0xdeba('0xc'));_0x59bd14(_0x194317[_0xdeba('0x15')][_0xdeba('0x13')]);}})['catch'](function(_0xe101c1){logger['error'](_0xdeba('0x12'),_0x7ed1e5,_0xe101c1);_0x589efe(_0xe101c1);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 200cde1..218565c 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee2a=['destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x31bf09,_0x229707){var _0x24b679=function(_0x523fca){while(--_0x523fca){_0x31bf09['push'](_0x31bf09['shift']());}};_0x24b679(++_0x229707);}(_0xee2a,0xa1));var _0xaee2=function(_0x4c67db,_0x475aa1){_0x4c67db=_0x4c67db-0x0;var _0x42c600=_0xee2a[_0x4c67db];return _0x42c600;};'use strict';var multer=require(_0xaee2('0x0'));var util=require('util');var path=require(_0xaee2('0x1'));var timeout=require(_0xaee2('0x2'));var express=require(_0xaee2('0x3'));var router=express[_0xaee2('0x4')]();var auth=require(_0xaee2('0x5'));var interaction=require(_0xaee2('0x6'));var config=require(_0xaee2('0x7'));var controller=require(_0xaee2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xaee2('0x9')]);router[_0xaee2('0xa')](_0xaee2('0xb'),auth[_0xaee2('0xc')](),controller[_0xaee2('0xd')]);router[_0xaee2('0xe')]('/',auth[_0xaee2('0xc')](),controller[_0xaee2('0xf')]);router[_0xaee2('0x10')](_0xaee2('0xb'),auth['isAuthenticated'](),controller[_0xaee2('0x11')]);router[_0xaee2('0x12')](_0xaee2('0xb'),auth[_0xaee2('0xc')](),controller[_0xaee2('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd84b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','post','create','/:id','update','exports','util','path','connect-timeout','express'];(function(_0x5be285,_0x590183){var _0x5f1fe1=function(_0x4cb30b){while(--_0x4cb30b){_0x5be285['push'](_0x5be285['shift']());}};_0x5f1fe1(++_0x590183);}(_0xd84b,0x1a0));var _0xbd84=function(_0x3b2503,_0x5b107b){_0x3b2503=_0x3b2503-0x0;var _0x3fdef0=_0xd84b[_0x3b2503];return _0x3fdef0;};'use strict';var multer=require('multer');var util=require(_0xbd84('0x0'));var path=require(_0xbd84('0x1'));var timeout=require(_0xbd84('0x2'));var express=require(_0xbd84('0x3'));var router=express[_0xbd84('0x4')]();var auth=require(_0xbd84('0x5'));var interaction=require(_0xbd84('0x6'));var config=require(_0xbd84('0x7'));var controller=require(_0xbd84('0x8'));router['get']('/',auth[_0xbd84('0x9')](),controller['index']);router['get']('/:id',auth[_0xbd84('0x9')](),controller['show']);router[_0xbd84('0xa')]('/',auth['isAuthenticated'](),controller[_0xbd84('0xb')]);router['put'](_0xbd84('0xc'),auth['isAuthenticated'](),controller[_0xbd84('0xd')]);router['delete'](_0xbd84('0xc'),auth[_0xbd84('0x9')](),controller['destroy']);module[_0xbd84('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index cef939b..f1c1865 100644 --- a/server/api/cmCompany/cmCompany.attributes.js +++ b/server/api/cmCompany/cmCompany.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e09=['STRING','name','sequelize','exports'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0x9e09,0x1ee));var _0x99e0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9e09[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x99e0('0x0'));module[_0x99e0('0x1')]={'name':{'type':Sequelize[_0x99e0('0x2')],'unique':_0x99e0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x99e0('0x2')]},'phone':{'type':Sequelize[_0x99e0('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x99e0('0x2')]},'street':{'type':Sequelize[_0x99e0('0x2')]},'postalCode':{'type':Sequelize[_0x99e0('0x2')]},'city':{'type':Sequelize[_0x99e0('0x2')]},'country':{'type':Sequelize[_0x99e0('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x99e0('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x99e0('0x2')]},'sCity':{'type':Sequelize[_0x99e0('0x2')]},'sCountry':{'type':Sequelize[_0x99e0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x458e=['exports','STRING'];(function(_0x2ca1eb,_0xff2bce){var _0x554ae2=function(_0x19b255){while(--_0x19b255){_0x2ca1eb['push'](_0x2ca1eb['shift']());}};_0x554ae2(++_0xff2bce);}(_0x458e,0x9a));var _0xe458=function(_0x587fbb,_0x52a0d9){_0x587fbb=_0x587fbb-0x0;var _0x488b05=_0x458e[_0x587fbb];return _0x488b05;};'use strict';var Sequelize=require('sequelize');module[_0xe458('0x0')]={'name':{'type':Sequelize[_0xe458('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe458('0x1')]},'companyId':{'type':Sequelize[_0xe458('0x1')]},'website':{'type':Sequelize[_0xe458('0x1')]},'phone':{'type':Sequelize[_0xe458('0x1')]},'fax':{'type':Sequelize[_0xe458('0x1')]},'type':{'type':Sequelize[_0xe458('0x1')]},'street':{'type':Sequelize[_0xe458('0x1')]},'postalCode':{'type':Sequelize[_0xe458('0x1')]},'city':{'type':Sequelize[_0xe458('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe458('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe458('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xe458('0x1')]},'sCity':{'type':Sequelize[_0xe458('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe458('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 342a306..4725543 100644 --- a/server/api/cmCompany/cmCompany.controller.js +++ b/server/api/cmCompany/cmCompany.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaef4=['query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','count','includeAll','findAll','catch','show','params','rawAttributes','length','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','findOne','getContacts','html-pdf','eml-format','rimraf','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','apply','reject','update','destroy','then','get','Companies','UserProfileResource','sendStatus','error','name','send','index','CmCompany','describe','model','keys','intersection'];(function(_0x50875c,_0x45cfca){var _0x30fb65=function(_0x395f2c){while(--_0x395f2c){_0x50875c['push'](_0x50875c['shift']());}};_0x30fb65(++_0x45cfca);}(_0xaef4,0x73));var _0x4aef=function(_0x247bc6,_0x59b507){_0x247bc6=_0x247bc6-0x0;var _0x101532=_0xaef4[_0x247bc6];return _0x101532;};'use strict';var pdf=require(_0x4aef('0x0'));var emlformat=require(_0x4aef('0x1'));var rimraf=require(_0x4aef('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4aef('0x3'));var util=require('util');var path=require(_0x4aef('0x4'));var sox=require(_0x4aef('0x5'));var csv=require(_0x4aef('0x6'));var ejs=require(_0x4aef('0x7'));var fs=require('fs');var _=require(_0x4aef('0x8'));var squel=require(_0x4aef('0x9'));var crypto=require(_0x4aef('0xa'));var jsforce=require(_0x4aef('0xb'));var deskjs=require(_0x4aef('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4aef('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4aef('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4aef('0xf'));var hardwareService=require(_0x4aef('0x10'));var logger=require(_0x4aef('0x11'))(_0x4aef('0x12'));var utils=require(_0x4aef('0x13'));var config=require(_0x4aef('0x14'));var licenseUtil=require(_0x4aef('0x15'));var db=require(_0x4aef('0x16'))['db'];function respondWithStatusCode(_0x20ba61,_0x278a94){_0x278a94=_0x278a94||0xcc;return function(_0x3ee00f){if(_0x3ee00f){return _0x20ba61['sendStatus'](_0x278a94);}return _0x20ba61[_0x4aef('0x17')](_0x278a94)[_0x4aef('0x18')]();};}function respondWithResult(_0x4d0e9d,_0x3de105){_0x3de105=_0x3de105||0xc8;return function(_0x259d42){if(_0x259d42){return _0x4d0e9d[_0x4aef('0x17')](_0x3de105)[_0x4aef('0x19')](_0x259d42);}};}function respondWithFilteredResult(_0x228b37,_0x51ad54){return function(_0xc7c5c4){if(_0xc7c5c4){var _0x273043=_0xc7c5c4['count'],_0x206191=_0x51ad54[_0x4aef('0x1a')],_0x3b6bdf=_0x51ad54['offset']+_0x51ad54[_0x4aef('0x1b')],_0x5273cd;if(_0x3b6bdf>=_0x273043){_0x3b6bdf=_0x273043;_0x5273cd=0xc8;}else{_0x5273cd=0xce;}_0x228b37[_0x4aef('0x17')](_0x5273cd);return _0x228b37[_0x4aef('0x1c')]('Content-Range',_0x206191+'-'+_0x3b6bdf+'/'+_0x273043)['json'](_0xc7c5c4);}return null;};}function patchUpdates(_0x4cfb64){return function(_0x5d4125){try{jsonpatch[_0x4aef('0x1d')](_0x5d4125,_0x4cfb64,!![]);}catch(_0x378bc1){return BPromise[_0x4aef('0x1e')](_0x378bc1);}return _0x5d4125['save']();};}function saveUpdates(_0x87df00,_0x4741a7){return function(_0x29632a){if(_0x29632a){return _0x29632a[_0x4aef('0x1f')](_0x87df00)['then'](function(_0x360ded){return _0x360ded;});}return null;};}function removeEntity(_0x308a84,_0x1c693e){return function(_0x16db17){if(_0x16db17){return _0x16db17[_0x4aef('0x20')]()[_0x4aef('0x21')](function(){var _0x952c75=_0x16db17[_0x4aef('0x22')]({'plain':!![]});var _0x4cc999=_0x4aef('0x23');return db[_0x4aef('0x24')][_0x4aef('0x20')]({'where':{'type':_0x4cc999,'resourceId':_0x952c75['id']}})['then'](function(){return _0x16db17;});})[_0x4aef('0x21')](function(){_0x308a84[_0x4aef('0x17')](0xcc)[_0x4aef('0x18')]();});}};}function handleEntityNotFound(_0x5cd6c2,_0x457864){return function(_0x2d1631){if(!_0x2d1631){_0x5cd6c2[_0x4aef('0x25')](0x194);}return _0x2d1631;};}function handleError(_0x355ed6,_0x24918e){_0x24918e=_0x24918e||0x1f4;return function(_0x546e5e){logger[_0x4aef('0x26')](_0x546e5e['stack']);if(_0x546e5e['name']){delete _0x546e5e[_0x4aef('0x27')];}_0x355ed6[_0x4aef('0x17')](_0x24918e)[_0x4aef('0x28')](_0x546e5e);};}exports[_0x4aef('0x29')]=function(_0x3c9b54,_0x3f47ad){var _0x58acf5={},_0x33c484={},_0x14bdf4={'count':0x0,'rows':[]};return db[_0x4aef('0x2a')][_0x4aef('0x2b')]()['then'](function(_0x5cd743){_0x33c484[_0x4aef('0x2c')]=_[_0x4aef('0x2d')](_0x5cd743);_0x33c484['query']=_[_0x4aef('0x2d')](_0x3c9b54['query']);_0x33c484['filters']=_[_0x4aef('0x2e')](_0x33c484['model'],_0x33c484[_0x4aef('0x2f')]);_0x58acf5['attributes']=_[_0x4aef('0x2e')](_0x33c484[_0x4aef('0x2c')],qs['fields'](_0x3c9b54[_0x4aef('0x2f')][_0x4aef('0x30')]));_0x58acf5[_0x4aef('0x31')]=_0x58acf5[_0x4aef('0x31')]['length']?_0x58acf5[_0x4aef('0x31')]:_0x33c484['model'];if(!_0x3c9b54[_0x4aef('0x2f')][_0x4aef('0x32')](_0x4aef('0x33'))){_0x58acf5[_0x4aef('0x1b')]=qs['limit'](_0x3c9b54[_0x4aef('0x2f')]['limit']);_0x58acf5[_0x4aef('0x1a')]=qs['offset'](_0x3c9b54['query'][_0x4aef('0x1a')]);}_0x58acf5[_0x4aef('0x34')]=qs[_0x4aef('0x35')](_0x3c9b54[_0x4aef('0x2f')][_0x4aef('0x35')]);_0x58acf5[_0x4aef('0x36')]=qs[_0x4aef('0x37')](_[_0x4aef('0x38')](_0x3c9b54[_0x4aef('0x2f')],_0x33c484[_0x4aef('0x37')]),_0x5cd743);if(_0x3c9b54['query'][_0x4aef('0x39')]){_0x58acf5[_0x4aef('0x36')]=_[_0x4aef('0x3a')](_0x58acf5[_0x4aef('0x36')],{'$or':_[_0x4aef('0x3b')](_0x58acf5['attributes'],function(_0x1d2ae8){var _0x24d096={};_0x24d096[_0x1d2ae8]={'$like':'%'+_0x3c9b54[_0x4aef('0x2f')]['filter']+'%'};return _0x24d096;})});}_0x58acf5=_['merge']({},_0x58acf5,_0x3c9b54[_0x4aef('0x3c')]);var _0x2aedd6={'where':_0x58acf5[_0x4aef('0x36')]};return db['CmCompany'][_0x4aef('0x3d')](_0x2aedd6)[_0x4aef('0x21')](function(_0x114761){_0x14bdf4[_0x4aef('0x3d')]=_0x114761;if(_0x3c9b54['query'][_0x4aef('0x3e')]){_0x58acf5['include']=[{'all':!![]}];}return db[_0x4aef('0x2a')][_0x4aef('0x3f')](_0x58acf5);})[_0x4aef('0x21')](function(_0x21c89a){_0x14bdf4['rows']=_0x21c89a;return _0x14bdf4;})[_0x4aef('0x21')](respondWithFilteredResult(_0x3f47ad,_0x58acf5))[_0x4aef('0x40')](handleError(_0x3f47ad,null));})[_0x4aef('0x40')](handleError(_0x3f47ad,null));};exports[_0x4aef('0x41')]=function(_0xa19365,_0xa5a499){var _0x21dbe0={'raw':![],'where':{'id':_0xa19365[_0x4aef('0x42')]['id']}},_0x4c25f0={};_0x4c25f0[_0x4aef('0x2c')]=_[_0x4aef('0x2d')](db[_0x4aef('0x2a')][_0x4aef('0x43')]);_0x4c25f0[_0x4aef('0x2f')]=_[_0x4aef('0x2d')](_0xa19365[_0x4aef('0x2f')]);_0x4c25f0[_0x4aef('0x37')]=_[_0x4aef('0x2e')](_0x4c25f0[_0x4aef('0x2c')],_0x4c25f0[_0x4aef('0x2f')]);_0x21dbe0[_0x4aef('0x31')]=_[_0x4aef('0x2e')](_0x4c25f0[_0x4aef('0x2c')],qs[_0x4aef('0x30')](_0xa19365[_0x4aef('0x2f')]['fields']));_0x21dbe0[_0x4aef('0x31')]=_0x21dbe0[_0x4aef('0x31')][_0x4aef('0x44')]?_0x21dbe0[_0x4aef('0x31')]:_0x4c25f0[_0x4aef('0x2c')];if(_0xa19365['query'][_0x4aef('0x3e')]){_0x21dbe0[_0x4aef('0x45')]=[{'all':!![]}];}_0x21dbe0=_[_0x4aef('0x3a')]({},_0x21dbe0,_0xa19365['options']);return db[_0x4aef('0x2a')][_0x4aef('0x46')](_0x21dbe0)[_0x4aef('0x21')](handleEntityNotFound(_0xa5a499,null))[_0x4aef('0x21')](respondWithResult(_0xa5a499,null))['catch'](handleError(_0xa5a499,null));};exports['create']=function(_0x2dcc4b,_0x7bc890){return db[_0x4aef('0x2a')]['create'](_0x2dcc4b['body'],{})[_0x4aef('0x21')](function(_0xf50505){var _0x1bd698=_0x2dcc4b[_0x4aef('0x47')][_0x4aef('0x22')]({'plain':!![]});if(!_0x1bd698)throw new Error(_0x4aef('0x48'));if(_0x1bd698['role']===_0x4aef('0x47')){var _0x2287d4=_0xf50505[_0x4aef('0x22')]({'plain':!![]});var _0x5cb62f=_0x4aef('0x23');return db[_0x4aef('0x49')][_0x4aef('0x46')]({'where':{'name':_0x5cb62f,'userProfileId':_0x1bd698['userProfileId']},'raw':!![]})[_0x4aef('0x21')](function(_0x429d5b){if(_0x429d5b&&_0x429d5b[_0x4aef('0x4a')]===0x0){return db[_0x4aef('0x24')]['create']({'name':_0x2287d4[_0x4aef('0x27')],'resourceId':_0x2287d4['id'],'type':_0x429d5b['name'],'sectionId':_0x429d5b['id']},{})['then'](function(){return _0xf50505;});}else{return _0xf50505;}})[_0x4aef('0x40')](function(_0x590324){logger['error'](_0x4aef('0x4b'),_0x590324);throw _0x590324;});}return _0xf50505;})[_0x4aef('0x21')](respondWithResult(_0x7bc890,0xc9))[_0x4aef('0x40')](handleError(_0x7bc890,null));};exports[_0x4aef('0x1f')]=function(_0x3f64e2,_0x564dd0){if(_0x3f64e2['body']['id']){delete _0x3f64e2[_0x4aef('0x4c')]['id'];}return db[_0x4aef('0x2a')][_0x4aef('0x46')]({'where':{'id':_0x3f64e2['params']['id']}})[_0x4aef('0x21')](handleEntityNotFound(_0x564dd0,null))[_0x4aef('0x21')](saveUpdates(_0x3f64e2[_0x4aef('0x4c')],null))[_0x4aef('0x21')](respondWithResult(_0x564dd0,null))[_0x4aef('0x40')](handleError(_0x564dd0,null));};exports[_0x4aef('0x20')]=function(_0x178388,_0x5b521e){return db[_0x4aef('0x2a')][_0x4aef('0x46')]({'where':{'id':_0x178388['params']['id']}})[_0x4aef('0x21')](handleEntityNotFound(_0x5b521e,null))[_0x4aef('0x21')](removeEntity(_0x5b521e,null))[_0x4aef('0x40')](handleError(_0x5b521e,null));};exports[_0x4aef('0x2b')]=function(_0x51a5d9,_0xa54321){return db[_0x4aef('0x2a')][_0x4aef('0x2b')]()[_0x4aef('0x21')](respondWithResult(_0xa54321,null))[_0x4aef('0x40')](handleError(_0xa54321,null));};exports[_0x4aef('0x4d')]=function(_0x177f2d,_0x3cff01,_0x284c03){return db[_0x4aef('0x4e')][_0x4aef('0x46')]({'where':{'id':_0x177f2d[_0x4aef('0x42')]['id']}})[_0x4aef('0x21')](handleEntityNotFound(_0x3cff01,null))[_0x4aef('0x21')](function(_0xaf25a2){if(_0xaf25a2){return _0xaf25a2[_0x4aef('0x4d')](_0x177f2d[_0x4aef('0x4c')]['ids'],_['omit'](_0x177f2d[_0x4aef('0x4c')],['ids','id'])||{});}})[_0x4aef('0x21')](respondWithResult(_0x3cff01,null))['catch'](handleError(_0x3cff01,null));};exports['getContacts']=function(_0x15d458,_0x497783,_0x47d4c7){var _0x20df30={};var _0x36bdfc={};var _0x4b0e49;var _0x1f2c4c;return db[_0x4aef('0x2a')][_0x4aef('0x4f')]({'where':{'id':_0x15d458[_0x4aef('0x42')]['id']}})[_0x4aef('0x21')](handleEntityNotFound(_0x497783,null))[_0x4aef('0x21')](function(_0x4a98ff){if(_0x4a98ff){_0x4b0e49=_0x4a98ff;_0x36bdfc['model']=_[_0x4aef('0x2d')](db[_0x4aef('0x4e')][_0x4aef('0x43')]);_0x36bdfc[_0x4aef('0x2f')]=_['keys'](_0x15d458[_0x4aef('0x2f')]);_0x36bdfc[_0x4aef('0x37')]=_[_0x4aef('0x2e')](_0x36bdfc['model'],_0x36bdfc[_0x4aef('0x2f')]);_0x20df30[_0x4aef('0x31')]=_[_0x4aef('0x2e')](_0x36bdfc[_0x4aef('0x2c')],qs[_0x4aef('0x30')](_0x15d458[_0x4aef('0x2f')][_0x4aef('0x30')]));_0x20df30[_0x4aef('0x31')]=_0x20df30['attributes'][_0x4aef('0x44')]?_0x20df30['attributes']:_0x36bdfc[_0x4aef('0x2c')];_0x20df30[_0x4aef('0x34')]=qs['sort'](_0x15d458[_0x4aef('0x2f')][_0x4aef('0x35')]);_0x20df30['where']=qs[_0x4aef('0x37')](_['pick'](_0x15d458['query'],_0x36bdfc['filters']));if(_0x15d458[_0x4aef('0x2f')]['filter']){_0x20df30[_0x4aef('0x36')]=_[_0x4aef('0x3a')](_0x20df30[_0x4aef('0x36')],{'$or':_[_0x4aef('0x3b')](_0x20df30[_0x4aef('0x31')],function(_0x5bcb7e){var _0x4a4349={};_0x4a4349[_0x5bcb7e]={'$like':'%'+_0x15d458[_0x4aef('0x2f')]['filter']+'%'};return _0x4a4349;})});}_0x20df30=_[_0x4aef('0x3a')]({},_0x20df30,_0x15d458[_0x4aef('0x3c')]);return _0x4b0e49[_0x4aef('0x50')](_0x20df30);}})[_0x4aef('0x21')](function(_0x27e273){if(_0x27e273){_0x1f2c4c=_0x27e273[_0x4aef('0x44')];if(!_0x15d458[_0x4aef('0x2f')][_0x4aef('0x32')](_0x4aef('0x33'))){_0x20df30[_0x4aef('0x1b')]=qs[_0x4aef('0x1b')](_0x15d458[_0x4aef('0x2f')][_0x4aef('0x1b')]);_0x20df30['offset']=qs['offset'](_0x15d458['query'][_0x4aef('0x1a')]);}return _0x4b0e49['getContacts'](_0x20df30);}})[_0x4aef('0x21')](function(_0x489296){if(_0x489296){return _0x489296?{'count':_0x1f2c4c,'rows':_0x489296}:null;}})[_0x4aef('0x21')](respondWithResult(_0x497783,null))[_0x4aef('0x40')](handleError(_0x497783,null));}; \ No newline at end of file +var _0x1974=['reject','save','update','destroy','then','get','sendStatus','name','index','describe','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','merge','map','filter','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','pick','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x37a6fb,_0x5a6cf9){var _0x4980f9=function(_0x3b3951){while(--_0x3b3951){_0x37a6fb['push'](_0x37a6fb['shift']());}};_0x4980f9(++_0x5a6cf9);}(_0x1974,0xe4));var _0x4197=function(_0x2cde44,_0x522a1e){_0x2cde44=_0x2cde44-0x0;var _0x4ece2e=_0x1974[_0x2cde44];return _0x4ece2e;};'use strict';var pdf=require(_0x4197('0x0'));var emlformat=require(_0x4197('0x1'));var rimraf=require(_0x4197('0x2'));var zipdir=require(_0x4197('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4197('0x4'));var BPromise=require(_0x4197('0x5'));var Mustache=require('mustache');var util=require(_0x4197('0x6'));var path=require(_0x4197('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4197('0x8'));var fs=require('fs');var _=require(_0x4197('0x9'));var squel=require('squel');var crypto=require(_0x4197('0xa'));var jsforce=require(_0x4197('0xb'));var deskjs=require(_0x4197('0xc'));var toCsv=require(_0x4197('0xd'));var querystring=require(_0x4197('0xe'));var Papa=require('papaparse');var Redis=require(_0x4197('0xf'));var authService=require(_0x4197('0x10'));var qs=require(_0x4197('0x11'));var as=require(_0x4197('0x12'));var hardwareService=require(_0x4197('0x13'));var logger=require(_0x4197('0x14'))(_0x4197('0x15'));var utils=require('../../config/utils');var config=require(_0x4197('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4197('0x17'))['db'];function respondWithStatusCode(_0x35796b,_0x1670ae){_0x1670ae=_0x1670ae||0xcc;return function(_0x20ba35){if(_0x20ba35){return _0x35796b['sendStatus'](_0x1670ae);}return _0x35796b[_0x4197('0x18')](_0x1670ae)[_0x4197('0x19')]();};}function respondWithResult(_0x3581c5,_0x2d871a){_0x2d871a=_0x2d871a||0xc8;return function(_0x1d14ba){if(_0x1d14ba){return _0x3581c5[_0x4197('0x18')](_0x2d871a)[_0x4197('0x1a')](_0x1d14ba);}};}function respondWithFilteredResult(_0x1728f5,_0x4d9a44){return function(_0x567135){if(_0x567135){var _0x278c1d=_0x567135[_0x4197('0x1b')],_0x177ec5=_0x4d9a44[_0x4197('0x1c')],_0x2cdc24=_0x4d9a44[_0x4197('0x1c')]+_0x4d9a44[_0x4197('0x1d')],_0x3cb377;if(_0x2cdc24>=_0x278c1d){_0x2cdc24=_0x278c1d;_0x3cb377=0xc8;}else{_0x3cb377=0xce;}_0x1728f5[_0x4197('0x18')](_0x3cb377);return _0x1728f5[_0x4197('0x1e')](_0x4197('0x1f'),_0x177ec5+'-'+_0x2cdc24+'/'+_0x278c1d)[_0x4197('0x1a')](_0x567135);}return null;};}function patchUpdates(_0x4c11c1){return function(_0x5f1c24){try{jsonpatch[_0x4197('0x20')](_0x5f1c24,_0x4c11c1,!![]);}catch(_0x44bf7b){return BPromise[_0x4197('0x21')](_0x44bf7b);}return _0x5f1c24[_0x4197('0x22')]();};}function saveUpdates(_0x5ee45d,_0x2ae73e){return function(_0x49c148){if(_0x49c148){return _0x49c148[_0x4197('0x23')](_0x5ee45d)['then'](function(_0x313072){return _0x313072;});}return null;};}function removeEntity(_0x8997fa,_0x1d1dd4){return function(_0x2ed0be){if(_0x2ed0be){return _0x2ed0be[_0x4197('0x24')]()[_0x4197('0x25')](function(){var _0x2459bd=_0x2ed0be[_0x4197('0x26')]({'plain':!![]});var _0x58e8da='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x58e8da,'resourceId':_0x2459bd['id']}})[_0x4197('0x25')](function(){return _0x2ed0be;});})[_0x4197('0x25')](function(){_0x8997fa[_0x4197('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f4e8,_0x528dac){return function(_0x4ea3fb){if(!_0x4ea3fb){_0x43f4e8[_0x4197('0x27')](0x194);}return _0x4ea3fb;};}function handleError(_0x14fea7,_0x98d033){_0x98d033=_0x98d033||0x1f4;return function(_0x46c7da){logger['error'](_0x46c7da['stack']);if(_0x46c7da[_0x4197('0x28')]){delete _0x46c7da[_0x4197('0x28')];}_0x14fea7['status'](_0x98d033)['send'](_0x46c7da);};}exports[_0x4197('0x29')]=function(_0x247af4,_0x3c75da){var _0x9e9a68={},_0x316322={},_0x26c3c6={'count':0x0,'rows':[]};return db['CmCompany'][_0x4197('0x2a')]()['then'](function(_0x288426){_0x316322[_0x4197('0x2b')]=_['keys'](_0x288426);_0x316322[_0x4197('0x2c')]=_[_0x4197('0x2d')](_0x247af4[_0x4197('0x2c')]);_0x316322[_0x4197('0x2e')]=_['intersection'](_0x316322[_0x4197('0x2b')],_0x316322[_0x4197('0x2c')]);_0x9e9a68[_0x4197('0x2f')]=_[_0x4197('0x30')](_0x316322[_0x4197('0x2b')],qs[_0x4197('0x31')](_0x247af4['query']['fields']));_0x9e9a68[_0x4197('0x2f')]=_0x9e9a68[_0x4197('0x2f')]['length']?_0x9e9a68[_0x4197('0x2f')]:_0x316322[_0x4197('0x2b')];if(!_0x247af4['query']['hasOwnProperty'](_0x4197('0x32'))){_0x9e9a68['limit']=qs['limit'](_0x247af4['query'][_0x4197('0x1d')]);_0x9e9a68[_0x4197('0x1c')]=qs['offset'](_0x247af4['query'][_0x4197('0x1c')]);}_0x9e9a68[_0x4197('0x33')]=qs[_0x4197('0x34')](_0x247af4[_0x4197('0x2c')][_0x4197('0x34')]);_0x9e9a68[_0x4197('0x35')]=qs[_0x4197('0x2e')](_['pick'](_0x247af4['query'],_0x316322['filters']),_0x288426);if(_0x247af4[_0x4197('0x2c')]['filter']){_0x9e9a68[_0x4197('0x35')]=_[_0x4197('0x36')](_0x9e9a68[_0x4197('0x35')],{'$or':_[_0x4197('0x37')](_0x9e9a68['attributes'],function(_0x4f9148){var _0x2196e8={};_0x2196e8[_0x4f9148]={'$like':'%'+_0x247af4[_0x4197('0x2c')][_0x4197('0x38')]+'%'};return _0x2196e8;})});}_0x9e9a68=_[_0x4197('0x36')]({},_0x9e9a68,_0x247af4[_0x4197('0x39')]);var _0x1f8210={'where':_0x9e9a68['where']};return db[_0x4197('0x3a')][_0x4197('0x1b')](_0x1f8210)['then'](function(_0x5d216b){_0x26c3c6[_0x4197('0x1b')]=_0x5d216b;if(_0x247af4['query'][_0x4197('0x3b')]){_0x9e9a68[_0x4197('0x3c')]=[{'all':!![]}];}return db[_0x4197('0x3a')][_0x4197('0x3d')](_0x9e9a68);})[_0x4197('0x25')](function(_0x26699c){_0x26c3c6[_0x4197('0x3e')]=_0x26699c;return _0x26c3c6;})['then'](respondWithFilteredResult(_0x3c75da,_0x9e9a68))[_0x4197('0x3f')](handleError(_0x3c75da,null));})[_0x4197('0x3f')](handleError(_0x3c75da,null));};exports[_0x4197('0x40')]=function(_0x60fbd6,_0x1beb66){var _0x3732d6={'raw':![],'where':{'id':_0x60fbd6[_0x4197('0x41')]['id']}},_0x3bfc37={};_0x3bfc37[_0x4197('0x2b')]=_['keys'](db['CmCompany'][_0x4197('0x42')]);_0x3bfc37['query']=_[_0x4197('0x2d')](_0x60fbd6['query']);_0x3bfc37[_0x4197('0x2e')]=_[_0x4197('0x30')](_0x3bfc37[_0x4197('0x2b')],_0x3bfc37[_0x4197('0x2c')]);_0x3732d6[_0x4197('0x2f')]=_[_0x4197('0x30')](_0x3bfc37[_0x4197('0x2b')],qs['fields'](_0x60fbd6[_0x4197('0x2c')][_0x4197('0x31')]));_0x3732d6['attributes']=_0x3732d6[_0x4197('0x2f')][_0x4197('0x43')]?_0x3732d6['attributes']:_0x3bfc37['model'];if(_0x60fbd6[_0x4197('0x2c')][_0x4197('0x3b')]){_0x3732d6[_0x4197('0x3c')]=[{'all':!![]}];}_0x3732d6=_[_0x4197('0x36')]({},_0x3732d6,_0x60fbd6[_0x4197('0x39')]);return db[_0x4197('0x3a')][_0x4197('0x44')](_0x3732d6)['then'](handleEntityNotFound(_0x1beb66,null))[_0x4197('0x25')](respondWithResult(_0x1beb66,null))[_0x4197('0x3f')](handleError(_0x1beb66,null));};exports[_0x4197('0x45')]=function(_0x28c09d,_0x59bc18){return db[_0x4197('0x3a')][_0x4197('0x45')](_0x28c09d[_0x4197('0x46')],{})[_0x4197('0x25')](function(_0x22c8fe){var _0x387d9e=_0x28c09d[_0x4197('0x47')][_0x4197('0x26')]({'plain':!![]});if(!_0x387d9e)throw new Error(_0x4197('0x48'));if(_0x387d9e[_0x4197('0x49')]===_0x4197('0x47')){var _0x40634e=_0x22c8fe['get']({'plain':!![]});var _0x1f4c93=_0x4197('0x4a');return db[_0x4197('0x4b')][_0x4197('0x44')]({'where':{'name':_0x1f4c93,'userProfileId':_0x387d9e['userProfileId']},'raw':!![]})[_0x4197('0x25')](function(_0x17b403){if(_0x17b403&&_0x17b403['autoAssociation']===0x0){return db[_0x4197('0x4c')]['create']({'name':_0x40634e[_0x4197('0x28')],'resourceId':_0x40634e['id'],'type':_0x17b403['name'],'sectionId':_0x17b403['id']},{})[_0x4197('0x25')](function(){return _0x22c8fe;});}else{return _0x22c8fe;}})[_0x4197('0x3f')](function(_0xfe2bcb){logger[_0x4197('0x4d')](_0x4197('0x4e'),_0xfe2bcb);throw _0xfe2bcb;});}return _0x22c8fe;})[_0x4197('0x25')](respondWithResult(_0x59bc18,0xc9))[_0x4197('0x3f')](handleError(_0x59bc18,null));};exports[_0x4197('0x23')]=function(_0x49e988,_0x34347e){if(_0x49e988['body']['id']){delete _0x49e988[_0x4197('0x46')]['id'];}return db[_0x4197('0x3a')][_0x4197('0x44')]({'where':{'id':_0x49e988[_0x4197('0x41')]['id']}})[_0x4197('0x25')](handleEntityNotFound(_0x34347e,null))[_0x4197('0x25')](saveUpdates(_0x49e988['body'],null))[_0x4197('0x25')](respondWithResult(_0x34347e,null))[_0x4197('0x3f')](handleError(_0x34347e,null));};exports[_0x4197('0x24')]=function(_0x5a8892,_0x24d8d2){return db[_0x4197('0x3a')][_0x4197('0x44')]({'where':{'id':_0x5a8892[_0x4197('0x41')]['id']}})[_0x4197('0x25')](handleEntityNotFound(_0x24d8d2,null))[_0x4197('0x25')](removeEntity(_0x24d8d2,null))[_0x4197('0x3f')](handleError(_0x24d8d2,null));};exports[_0x4197('0x2a')]=function(_0x891497,_0x6ca20a){return db[_0x4197('0x3a')][_0x4197('0x2a')]()[_0x4197('0x25')](respondWithResult(_0x6ca20a,null))[_0x4197('0x3f')](handleError(_0x6ca20a,null));};exports[_0x4197('0x4f')]=function(_0x5e642f,_0x5a8cad,_0xb76a2){return db[_0x4197('0x50')][_0x4197('0x44')]({'where':{'id':_0x5e642f[_0x4197('0x41')]['id']}})[_0x4197('0x25')](handleEntityNotFound(_0x5a8cad,null))[_0x4197('0x25')](function(_0x5c20c4){if(_0x5c20c4){return _0x5c20c4[_0x4197('0x4f')](_0x5e642f[_0x4197('0x46')][_0x4197('0x51')],_[_0x4197('0x52')](_0x5e642f['body'],[_0x4197('0x51'),'id'])||{});}})[_0x4197('0x25')](respondWithResult(_0x5a8cad,null))[_0x4197('0x3f')](handleError(_0x5a8cad,null));};exports[_0x4197('0x53')]=function(_0x29bbc7,_0x2e6800,_0x2ca889){var _0x4f9789={};var _0x4c617c={};var _0x30e96c;var _0x1d92d5;return db[_0x4197('0x3a')][_0x4197('0x54')]({'where':{'id':_0x29bbc7['params']['id']}})['then'](handleEntityNotFound(_0x2e6800,null))[_0x4197('0x25')](function(_0x10c958){if(_0x10c958){_0x30e96c=_0x10c958;_0x4c617c[_0x4197('0x2b')]=_[_0x4197('0x2d')](db[_0x4197('0x50')][_0x4197('0x42')]);_0x4c617c[_0x4197('0x2c')]=_[_0x4197('0x2d')](_0x29bbc7[_0x4197('0x2c')]);_0x4c617c[_0x4197('0x2e')]=_[_0x4197('0x30')](_0x4c617c[_0x4197('0x2b')],_0x4c617c[_0x4197('0x2c')]);_0x4f9789[_0x4197('0x2f')]=_['intersection'](_0x4c617c[_0x4197('0x2b')],qs[_0x4197('0x31')](_0x29bbc7[_0x4197('0x2c')][_0x4197('0x31')]));_0x4f9789[_0x4197('0x2f')]=_0x4f9789[_0x4197('0x2f')]['length']?_0x4f9789[_0x4197('0x2f')]:_0x4c617c[_0x4197('0x2b')];_0x4f9789[_0x4197('0x33')]=qs[_0x4197('0x34')](_0x29bbc7[_0x4197('0x2c')][_0x4197('0x34')]);_0x4f9789[_0x4197('0x35')]=qs[_0x4197('0x2e')](_[_0x4197('0x55')](_0x29bbc7[_0x4197('0x2c')],_0x4c617c[_0x4197('0x2e')]));if(_0x29bbc7[_0x4197('0x2c')][_0x4197('0x38')]){_0x4f9789['where']=_[_0x4197('0x36')](_0x4f9789[_0x4197('0x35')],{'$or':_['map'](_0x4f9789[_0x4197('0x2f')],function(_0x20faf2){var _0x326b11={};_0x326b11[_0x20faf2]={'$like':'%'+_0x29bbc7[_0x4197('0x2c')][_0x4197('0x38')]+'%'};return _0x326b11;})});}_0x4f9789=_[_0x4197('0x36')]({},_0x4f9789,_0x29bbc7[_0x4197('0x39')]);return _0x30e96c[_0x4197('0x53')](_0x4f9789);}})[_0x4197('0x25')](function(_0x13b294){if(_0x13b294){_0x1d92d5=_0x13b294['length'];if(!_0x29bbc7['query'][_0x4197('0x56')]('nolimit')){_0x4f9789[_0x4197('0x1d')]=qs[_0x4197('0x1d')](_0x29bbc7[_0x4197('0x2c')][_0x4197('0x1d')]);_0x4f9789['offset']=qs[_0x4197('0x1c')](_0x29bbc7['query']['offset']);}return _0x30e96c[_0x4197('0x53')](_0x4f9789);}})[_0x4197('0x25')](function(_0x22599f){if(_0x22599f){return _0x22599f?{'count':_0x1d92d5,'rows':_0x22599f}:null;}})[_0x4197('0x25')](respondWithResult(_0x2e6800,null))[_0x4197('0x3f')](handleError(_0x2e6800,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 392027f..ccc581b 100644 --- a/server/api/cmCompany/cmCompany.model.js +++ b/server/api/cmCompany/cmCompany.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x815b=['./cmCompany.attributes','exports','define','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x815b,0xb4));var _0xb815=function(_0x456f71,_0x439d09){_0x456f71=_0x456f71-0x0;var _0x460ab1=_0x815b[_0x456f71];return _0x460ab1;};'use strict';var _=require(_0xb815('0x0'));var util=require(_0xb815('0x1'));var logger=require(_0xb815('0x2'))(_0xb815('0x3'));var moment=require(_0xb815('0x4'));var BPromise=require('bluebird');var rp=require(_0xb815('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb815('0x6'));var attributes=require(_0xb815('0x7'));module[_0xb815('0x8')]=function(_0x5a5c18,_0x466899){return _0x5a5c18[_0xb815('0x9')]('CmCompany',attributes,{'tableName':_0xb815('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79d3=['CmCompany','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x51606d,_0x51af29){var _0x1c66be=function(_0x3f1611){while(--_0x3f1611){_0x51606d['push'](_0x51606d['shift']());}};_0x1c66be(++_0x51af29);}(_0x79d3,0x15f));var _0x379d=function(_0x3768f3,_0x4a40f1){_0x3768f3=_0x3768f3-0x0;var _0x526a13=_0x79d3[_0x3768f3];return _0x526a13;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require(_0x379d('0x1'))('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x4'));var rimraf=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var attributes=require(_0x379d('0x7'));module[_0x379d('0x8')]=function(_0x2078a6,_0x2a1b43){return _0x2078a6['define'](_0x379d('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 9eee908..e78a836 100644 --- a/server/api/cmCompany/cmCompany.rpc.js +++ b/server/api/cmCompany/cmCompany.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8cf=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x1cceaa,_0x1877aa){var _0x4218d9=function(_0x253c45){while(--_0x253c45){_0x1cceaa['push'](_0x1cceaa['shift']());}};_0x4218d9(++_0x1877aa);}(_0xd8cf,0x134));var _0xfd8c=function(_0x2cea1f,_0x41a4dd){_0x2cea1f=_0x2cea1f-0x0;var _0x5adc49=_0xd8cf[_0x2cea1f];return _0x5adc49;};'use strict';var _=require(_0xfd8c('0x0'));var util=require(_0xfd8c('0x1'));var moment=require(_0xfd8c('0x2'));var BPromise=require(_0xfd8c('0x3'));var rs=require(_0xfd8c('0x4'));var fs=require('fs');var Redis=require(_0xfd8c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd8c('0x6'));var logger=require('../../config/logger')(_0xfd8c('0x7'));var config=require(_0xfd8c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfd8c('0x9')][_0xfd8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x295acf,_0x18f599,_0x52ac5b){return new BPromise(function(_0x183b9c,_0x5ee30d){return client['request'](_0x295acf,_0x52ac5b)[_0xfd8c('0xb')](function(_0x340236){logger[_0xfd8c('0xc')](_0xfd8c('0xd'),_0x18f599,_0xfd8c('0xe'));logger[_0xfd8c('0xf')](_0xfd8c('0x10'),_0x18f599,_0xfd8c('0xe'),JSON[_0xfd8c('0x11')](_0x340236));if(_0x340236['error']){if(_0x340236[_0xfd8c('0x12')][_0xfd8c('0x13')]===0x1f4){logger['error'](_0xfd8c('0xd'),_0x18f599,_0x340236[_0xfd8c('0x12')][_0xfd8c('0x14')]);return _0x5ee30d(_0x340236[_0xfd8c('0x12')][_0xfd8c('0x14')]);}logger['error'](_0xfd8c('0xd'),_0x18f599,_0x340236[_0xfd8c('0x12')][_0xfd8c('0x14')]);return _0x183b9c(_0x340236[_0xfd8c('0x12')][_0xfd8c('0x14')]);}else{logger['info'](_0xfd8c('0xd'),_0x18f599,_0xfd8c('0xe'));_0x183b9c(_0x340236['result'][_0xfd8c('0x14')]);}})[_0xfd8c('0x15')](function(_0x3f9eb9){logger[_0xfd8c('0x12')](_0xfd8c('0xd'),_0x18f599,_0x3f9eb9);_0x5ee30d(_0x3f9eb9);});});} \ No newline at end of file +var _0x4684=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x16fca4,_0x259c71){var _0x2fdb39=function(_0x2bc10f){while(--_0x2bc10f){_0x16fca4['push'](_0x16fca4['shift']());}};_0x2fdb39(++_0x259c71);}(_0x4684,0x11d));var _0x4468=function(_0x261b97,_0x50c866){_0x261b97=_0x261b97-0x0;var _0x4f423f=_0x4684[_0x261b97];return _0x4f423f;};'use strict';var _=require(_0x4468('0x0'));var util=require(_0x4468('0x1'));var moment=require(_0x4468('0x2'));var BPromise=require(_0x4468('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4468('0x4'));var db=require(_0x4468('0x5'))['db'];var utils=require(_0x4468('0x6'));var logger=require(_0x4468('0x7'))(_0x4468('0x8'));var config=require(_0x4468('0x9'));var jayson=require(_0x4468('0xa'));var client=jayson[_0x4468('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fbab6,_0x239f55,_0x4ebe78){return new BPromise(function(_0x20a078,_0x47e6d4){return client[_0x4468('0xc')](_0x1fbab6,_0x4ebe78)[_0x4468('0xd')](function(_0x90200d){logger[_0x4468('0xe')](_0x4468('0xf'),_0x239f55,_0x4468('0x10'));logger[_0x4468('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x239f55,_0x4468('0x10'),JSON[_0x4468('0x12')](_0x90200d));if(_0x90200d[_0x4468('0x13')]){if(_0x90200d['error'][_0x4468('0x14')]===0x1f4){logger[_0x4468('0x13')](_0x4468('0xf'),_0x239f55,_0x90200d[_0x4468('0x13')][_0x4468('0x15')]);return _0x47e6d4(_0x90200d[_0x4468('0x13')]['message']);}logger[_0x4468('0x13')](_0x4468('0xf'),_0x239f55,_0x90200d['error'][_0x4468('0x15')]);return _0x20a078(_0x90200d[_0x4468('0x13')][_0x4468('0x15')]);}else{logger[_0x4468('0xe')](_0x4468('0xf'),_0x239f55,_0x4468('0x10'));_0x20a078(_0x90200d['result'][_0x4468('0x15')]);}})[_0x4468('0x16')](function(_0x5177c7){logger[_0x4468('0x13')]('CmCompany,\x20%s,\x20%s',_0x239f55,_0x5177c7);_0x47e6d4(_0x5177c7);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 1a66395..3ffde6f 100644 --- a/server/api/cmCompany/index.js +++ b/server/api/cmCompany/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4888=['show','/:id/contacts','getContacts','post','create','addContacts','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x4888,0x198));var _0x8488=function(_0x4bdad2,_0x3bb56b){_0x4bdad2=_0x4bdad2-0x0;var _0x249aa7=_0x4888[_0x4bdad2];return _0x249aa7;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var auth=require(_0x8488('0x5'));var interaction=require(_0x8488('0x6'));var config=require('../../config/environment');var controller=require(_0x8488('0x7'));router[_0x8488('0x8')]('/',auth[_0x8488('0x9')](),controller[_0x8488('0xa')]);router[_0x8488('0x8')](_0x8488('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x8488('0x9')](),controller[_0x8488('0xc')]);router['get'](_0x8488('0xd'),auth[_0x8488('0x9')](),controller[_0x8488('0xe')]);router[_0x8488('0xf')]('/',auth['isAuthenticated'](),controller[_0x8488('0x10')]);router[_0x8488('0xf')](_0x8488('0xd'),auth[_0x8488('0x9')](),controller[_0x8488('0x11')]);router['put'](_0x8488('0x12'),auth[_0x8488('0x9')](),controller['update']);router['delete'](_0x8488('0x12'),auth['isAuthenticated'](),controller[_0x8488('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc2c7=['../../config/environment','isAuthenticated','index','get','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x527a53,_0x3265d6){var _0x2332f5=function(_0x3b2d90){while(--_0x3b2d90){_0x527a53['push'](_0x527a53['shift']());}};_0x2332f5(++_0x3265d6);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1440a1,_0x419177){_0x1440a1=_0x1440a1-0x0;var _0x5d4c5a=_0xc2c7[_0x1440a1];return _0x5d4c5a;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var auth=require(_0x7c2c('0x5'));var interaction=require(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x9')]);router[_0x7c2c('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7c2c('0xa')](_0x7c2c('0xb'),auth[_0x7c2c('0x8')](),controller[_0x7c2c('0xc')]);router[_0x7c2c('0xa')]('/:id/contacts',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0xd')]);router[_0x7c2c('0xe')]('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0xe')](_0x7c2c('0x10'),auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x12')](_0x7c2c('0xb'),auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x14')](_0x7c2c('0xb'),auth[_0x7c2c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6a03911..f96244e 100644 --- a/server/api/cmContact/cmContact.attributes.js +++ b/server/api/cmContact/cmContact.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c31=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','STRING'];(function(_0xef5510,_0x39e7e5){var _0xdf550a=function(_0x57533b){while(--_0x57533b){_0xef5510['push'](_0xef5510['shift']());}};_0xdf550a(++_0x39e7e5);}(_0x4c31,0xdd));var _0x14c3=function(_0x218c1a,_0x476458){_0x218c1a=_0x218c1a-0x0;var _0x40e14c=_0x4c31[_0x218c1a];return _0x40e14c;};'use strict';var _=require(_0x14c3('0x0'));var Sequelize=require(_0x14c3('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x14c3('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x14c3('0x2')]},'street':{'type':Sequelize[_0x14c3('0x2')]},'postalCode':{'type':Sequelize[_0x14c3('0x2')]},'city':{'type':Sequelize[_0x14c3('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x14c3('0x2')]},'description':{'type':Sequelize[_0x14c3('0x3')]},'phone':{'type':Sequelize[_0x14c3('0x2')]},'mobile':{'type':Sequelize[_0x14c3('0x2')]},'fax':{'type':Sequelize[_0x14c3('0x2')]},'email':{'type':Sequelize[_0x14c3('0x2')]},'url':{'type':Sequelize[_0x14c3('0x2')]},'facebook':{'type':Sequelize[_0x14c3('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x14c3('0x2')]},'skype':{'type':Sequelize[_0x14c3('0x2')]},'teams':{'type':Sequelize[_0x14c3('0x2')]},'viber':{'type':Sequelize[_0x14c3('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x14c3('0x2')]},'UserId':{'type':Sequelize[_0x14c3('0x4')]},'priority':{'type':Sequelize[_0x14c3('0x4')](0x2)[_0x14c3('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x14c3('0x6')],'defaultValue':Sequelize[_0x14c3('0x7')]}}; \ No newline at end of file +var _0x4f5e=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x4f5e,0xc0));var _0xe4f5=function(_0x572d14,_0x18c54f){_0x572d14=_0x572d14-0x0;var _0x23bc6f=_0x4f5e[_0x572d14];return _0x23bc6f;};'use strict';var _=require(_0xe4f5('0x0'));var Sequelize=require(_0xe4f5('0x1'));module[_0xe4f5('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe4f5('0x3')]},'street':{'type':Sequelize[_0xe4f5('0x3')]},'postalCode':{'type':Sequelize[_0xe4f5('0x3')]},'city':{'type':Sequelize[_0xe4f5('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xe4f5('0x3')]},'description':{'type':Sequelize[_0xe4f5('0x4')]},'phone':{'type':Sequelize[_0xe4f5('0x3')]},'mobile':{'type':Sequelize[_0xe4f5('0x3')]},'fax':{'type':Sequelize[_0xe4f5('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xe4f5('0x3')]},'facebook':{'type':Sequelize[_0xe4f5('0x3')]},'fb_data':{'type':Sequelize[_0xe4f5('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xe4f5('0x3')]},'teams':{'type':Sequelize[_0xe4f5('0x3')]},'viber':{'type':Sequelize[_0xe4f5('0x3')]},'line':{'type':Sequelize[_0xe4f5('0x3')]},'wechat':{'type':Sequelize[_0xe4f5('0x3')]},'telegram':{'type':Sequelize[_0xe4f5('0x3')]},'UserId':{'type':Sequelize[_0xe4f5('0x5')]},'priority':{'type':Sequelize[_0xe4f5('0x5')](0x2)[_0xe4f5('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe4f5('0x7')],'defaultValue':Sequelize[_0xe4f5('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1c4196c..de35bcd 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7764=['expr','search','parseSearch','sqlOperator','conditions','Tag','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','datetime','castTo','DATE','buildExpression','text','start','map','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','isArray','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','QueryTypes','SELECT','clone','c.id','DESC','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','CmContact','c.firstName','c.lastName','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','Tags','TagIds','rows','catch','find','params','columnName','displayName','findAll','alias','custom','values','body','get','mergeWith','tags','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','join','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','$and','omit','format','cf_%d','pickBy','table','setFields','id\x20=\x20?','toParam','phone','CmHopper','getTags','rawAttributes','intersection','pick','options','nolimit','setTags','ids','ContactId','includeAll','include','CmHopperHistory','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','meta','import','binding','firstName','child_process','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','index','describe','length','keys','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','fieldType','type','model','query','filters','attributes','fields','hasOwnProperty','order','sort','field','color','from','tools_tags','select','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','where'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x7764,0xa4));var _0x4776=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x7764[_0xaf29da];return _0x295c51;};'use strict';var pdf=require(_0x4776('0x0'));var emlformat=require(_0x4776('0x1'));var rimraf=require(_0x4776('0x2'));var zipdir=require(_0x4776('0x3'));var jsonpatch=require(_0x4776('0x4'));var rp=require(_0x4776('0x5'));var moment=require(_0x4776('0x6'));var BPromise=require(_0x4776('0x7'));var Mustache=require(_0x4776('0x8'));var util=require(_0x4776('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x4776('0xa'));var ejs=require(_0x4776('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4776('0xc'));var crypto=require(_0x4776('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4776('0xa'));var querystring=require('querystring');var Papa=require(_0x4776('0xe'));var Redis=require(_0x4776('0xf'));var authService=require(_0x4776('0x10'));var qs=require(_0x4776('0x11'));var as=require(_0x4776('0x12'));var hardwareService=require(_0x4776('0x13'));var logger=require(_0x4776('0x14'))(_0x4776('0x15'));var utils=require(_0x4776('0x16'));var config=require(_0x4776('0x17'));var licenseUtil=require(_0x4776('0x18'));var db=require(_0x4776('0x19'))['db'];config[_0x4776('0x1a')]=_[_0x4776('0x1b')](config[_0x4776('0x1a')],{'host':_0x4776('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4776('0x1d'))[_0x4776('0x1e')](socket);function respondWithStatusCode(_0x193b42,_0x179273){_0x179273=_0x179273||0xcc;return function(_0x3d0815){if(_0x3d0815){return _0x193b42[_0x4776('0x1f')](_0x179273);}return _0x193b42[_0x4776('0x20')](_0x179273)[_0x4776('0x21')]();};}function respondWithResult(_0x2256c9,_0x1eb5b5){_0x1eb5b5=_0x1eb5b5||0xc8;return function(_0x5d7953){if(_0x5d7953){return _0x2256c9[_0x4776('0x20')](_0x1eb5b5)['json'](_0x5d7953);}};}function respondWithFilteredResult(_0x164474,_0x41b06a){return function(_0x2366da){if(_0x2366da){var _0xed81b5=_0x2366da[_0x4776('0x22')],_0xb5c938=_0x41b06a['offset'],_0x4b5f50=_0x41b06a[_0x4776('0x23')]+_0x41b06a[_0x4776('0x24')],_0x1f6bb8;if(_0x4b5f50>=_0xed81b5){_0x4b5f50=_0xed81b5;_0x1f6bb8=0xc8;}else{_0x1f6bb8=0xce;}_0x164474[_0x4776('0x20')](_0x1f6bb8);return _0x164474[_0x4776('0x25')]('Content-Range',_0xb5c938+'-'+_0x4b5f50+'/'+_0xed81b5)[_0x4776('0x26')](_0x2366da);}return null;};}function patchUpdates(_0x2462e2){return function(_0x40e7b9){try{jsonpatch[_0x4776('0x27')](_0x40e7b9,_0x2462e2,!![]);}catch(_0x5db620){return BPromise[_0x4776('0x28')](_0x5db620);}return _0x40e7b9[_0x4776('0x29')]();};}function saveUpdates(_0x32bd33,_0x5e50b6){return function(_0x13f2a8){if(_0x13f2a8){return _0x13f2a8[_0x4776('0x2a')](_0x32bd33)[_0x4776('0x2b')](function(_0x54f3de){return _0x54f3de;});}return null;};}function removeEntity(_0x4e0dd1,_0x5a8f1f){return function(_0x36fa28){if(_0x36fa28){return _0x36fa28[_0x4776('0x2c')]()[_0x4776('0x2b')](function(){_0x4e0dd1[_0x4776('0x20')](0xcc)[_0x4776('0x21')]();});}};}function handleEntityNotFound(_0x20e06a,_0x43b7e3){return function(_0x5e1dc2){if(!_0x5e1dc2){_0x20e06a[_0x4776('0x1f')](0x194);}return _0x5e1dc2;};}function handleError(_0x1de3d1,_0x5e4ac0){_0x5e4ac0=_0x5e4ac0||0x1f4;return function(_0x30e734){logger[_0x4776('0x2d')](_0x30e734['stack']);if(_0x30e734[_0x4776('0x2e')]){delete _0x30e734[_0x4776('0x2e')];}_0x1de3d1[_0x4776('0x20')](_0x5e4ac0)[_0x4776('0x2f')](_0x30e734);};}exports[_0x4776('0x30')]=function(_0x4f57f7,_0x4bfd4b){var _0x3e65e1={},_0x3e7bd4={},_0x2e8f13={'count':0x0,'rows':[]};return db['CmContact'][_0x4776('0x31')]()['then'](function(_0x4002a2){var _0x5128fe=[];for(var _0x281cfd=0x0;_0x281cfd0x1){_0x27ce4d['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4776('0x6d')](_0x166151),null);}else{if(qs[_0x4776('0x6e')](_0x166151)){_0x27ce4d['or'](_0x4776('0x6f'),_0x166151+'%');_0x27ce4d['or']('c.phone\x20LIKE\x20?',_0x166151+'%');_0x27ce4d['or'](_0x4776('0x70'),_0x166151+'%');_0x27ce4d['or'](_0x4776('0x71'),_0x166151+'%');}else if(qs['isEmail'](_0x166151)){_0x27ce4d['or']('c.email\x20LIKE\x20?',_0x166151+'%');}else{_0x27ce4d['or'](_0x4776('0x72'),'%'+_0x166151+'%');_0x27ce4d['or']('c.lastName\x20LIKE\x20?','%'+_0x166151+'%');_0x27ce4d['or'](_0x4776('0x73'),'%'+_0x166151+'%');}}}}_0x3b86a8[_0x4776('0x4e')](_0x27ce4d);_0x3b86a8['group']('c.id');var _0x12f832={'type':db['Sequelize'][_0x4776('0x74')][_0x4776('0x75')],'raw':!![]};var _0x21483a=_0x3b86a8[_0x4776('0x76')]()[_0x4776('0x45')](_0x4776('0x77'));if(_0x3e65e1[_0x4776('0x43')]){_0x3e65e1[_0x4776('0x43')]['forEach'](function(_0x1af914){_0x3b86a8['order']('c.'+_0x1af914[0x0],_0x1af914[0x1]===_0x4776('0x78')?![]:!![]);});}if(!_[_0x4776('0x66')](_0x1a07fe)){_0x3b86a8['having'](_0x5b7b52);_0x21483a[_0x4776('0x4e')](_0x4776('0x79'),_0x1a07fe);}BPromise[_0x4776('0x7a')]()['then'](function(){if(!_0x45cb3d)return;if(_0x4f57f7[_0x4776('0x7b')][_0x4776('0x7c')]!==_0x4776('0x7d'))return;if(!_[_0x4776('0x7e')](_0x45cb3d[_0x4776('0x53')],[_0x4776('0x45'),'User'])){return _0x4f57f7[_0x4776('0x7b')][_0x4776('0x7f')]({'attributes':['id'],'raw':!![]})[_0x4776('0x2b')](function(_0x2d44a9){if(_['isEmpty'](_0x2d44a9)){_0x21483a[_0x4776('0x4e')](_0x4776('0x80'));_0x3b86a8['where'](_0x4776('0x80'));}else{_0x21483a[_0x4776('0x4e')]('c.ListId\x20IN\x20?',_[_0x4776('0x62')](_0x2d44a9,'id'));_0x3b86a8[_0x4776('0x4e')](_0x4776('0x68'),_[_0x4776('0x62')](_0x2d44a9,'id'));}});}})[_0x4776('0x2b')](function(){if(_0x4f57f7[_0x4776('0x7b')][_0x4776('0x7c')]===_0x4776('0x7d')&&!_0x45cb3d&&!_0x4f57f7['query'][_0x4776('0x67')])return[];return db[_0x4776('0x81')]['query'](_0x21483a[_0x4776('0x82')](),_0x12f832);})[_0x4776('0x2b')](function(_0x232911){_0x2e8f13[_0x4776('0x22')]=_0x232911[_0x4776('0x32')];if(_0x2e8f13[_0x4776('0x22')]===0x0)return[];return db[_0x4776('0x81')][_0x4776('0x3e')](_0x452e28[_0x4776('0x82')](),_0x12f832)[_0x4776('0x2b')](function(_0x2dbcdc){_0x941fb2=_[_0x4776('0x83')](_0x2dbcdc,'id');_0x12f832=_[_0x4776('0x84')](_0x12f832,{'model':db[_0x4776('0x85')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f57f7[_0x4776('0x3e')][_0x4776('0x41')]){_0x3e65e1[_0x4776('0x40')][_0x4776('0x57')](function(_0x56dba0){_0x3b86a8[_0x4776('0x45')]('c.'+_0x56dba0);});}else{_0x3b86a8[_0x4776('0x45')](_0x4776('0x77'));_0x3b86a8[_0x4776('0x45')](_0x4776('0x86'));_0x3b86a8[_0x4776('0x45')](_0x4776('0x87'));_0x3b86a8[_0x4776('0x45')]('c.phone');_0x3b86a8[_0x4776('0x45')](_0x4776('0x88'));_0x3b86a8[_0x4776('0x45')](_0x4776('0x89'));_0x3b86a8[_0x4776('0x45')](_0x4776('0x8a'));_0x3b86a8[_0x4776('0x45')](_0x4776('0x8b'));_0x3b86a8['field'](_0x4776('0x8c'));_0x3b86a8[_0x4776('0x45')](_0x4776('0x8d'));_0x3b86a8['field'](_0x4776('0x8e'));_0x3b86a8[_0x4776('0x45')](_0x4776('0x8f'),'TagIds');}if(_0x3e65e1[_0x4776('0x24')])_0x3b86a8[_0x4776('0x24')](_0x3e65e1[_0x4776('0x24')]);if(_0x3e65e1[_0x4776('0x23')])_0x3b86a8[_0x4776('0x23')](_0x3e65e1[_0x4776('0x23')]);return db['sequelize']['query'](_0x3b86a8[_0x4776('0x82')](),_0x12f832);});})[_0x4776('0x2b')](function(_0x2c138f){_0x2c138f['forEach'](function(_0x5cbac1){if(_0x5cbac1['TagIds']){_0x5cbac1[_0x4776('0x90')]=[];_0x5cbac1[_0x4776('0x91')][_0x4776('0x56')](',')[_0x4776('0x57')](function(_0x5df406){_0x5cbac1['Tags'][_0x4776('0x35')](_0x941fb2[_0x5df406]);});}delete _0x5cbac1[_0x4776('0x91')];});_0x2e8f13[_0x4776('0x92')]=_0x2c138f;return _0x2e8f13;})[_0x4776('0x2b')](respondWithFilteredResult(_0x4bfd4b,_0x3e65e1));})[_0x4776('0x93')](handleError(_0x4bfd4b,null));};exports['destroy']=function(_0x3ef532,_0x38bd39){return db[_0x4776('0x85')][_0x4776('0x94')]({'where':{'id':_0x3ef532[_0x4776('0x95')]['id']}})[_0x4776('0x2b')](handleEntityNotFound(_0x38bd39,null))['then'](removeEntity(_0x38bd39,null))[_0x4776('0x93')](handleError(_0x38bd39,null));};exports['describe']=function(_0x494866,_0x37e4a5){return db[_0x4776('0x85')][_0x4776('0x31')]()[_0x4776('0x2b')](function(_0x3cc71d){delete _0x3cc71d['tags'];for(var _0x4b3af1=0x0;_0x4b3af1=_0x2de22b){_0x2f74df=_0x2de22b;_0xb17d74=0xc8;}else{_0xb17d74=0xce;}_0x369ec5['status'](_0xb17d74);return _0x369ec5[_0xa661('0x25')]('Content-Range',_0x4359b2+'-'+_0x2f74df+'/'+_0x2de22b)[_0xa661('0x22')](_0x5d419e);}return null;};}function patchUpdates(_0x12bf4d){return function(_0x44f439){try{jsonpatch[_0xa661('0x26')](_0x44f439,_0x12bf4d,!![]);}catch(_0x5e444f){return BPromise[_0xa661('0x27')](_0x5e444f);}return _0x44f439[_0xa661('0x28')]();};}function saveUpdates(_0x4cae6a,_0x2890a5){return function(_0x385346){if(_0x385346){return _0x385346['update'](_0x4cae6a)[_0xa661('0x29')](function(_0x4b06bf){return _0x4b06bf;});}return null;};}function removeEntity(_0x51b69a,_0x39bc60){return function(_0x362454){if(_0x362454){return _0x362454[_0xa661('0x2a')]()['then'](function(){_0x51b69a[_0xa661('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x389015,_0x11d7dc){return function(_0x3715a9){if(!_0x3715a9){_0x389015[_0xa661('0x1f')](0x194);}return _0x3715a9;};}function handleError(_0x954273,_0x31ee05){_0x31ee05=_0x31ee05||0x1f4;return function(_0x33d5af){logger[_0xa661('0x2b')](_0x33d5af['stack']);if(_0x33d5af[_0xa661('0x2c')]){delete _0x33d5af[_0xa661('0x2c')];}_0x954273[_0xa661('0x20')](_0x31ee05)[_0xa661('0x2d')](_0x33d5af);};}exports['index']=function(_0x2e61ba,_0x3f9d0b){var _0x436713={},_0x1733f5={},_0x86105a={'count':0x0,'rows':[]};return db['CmContact'][_0xa661('0x2e')]()[_0xa661('0x29')](function(_0x45a27f){var _0x33bf85=[];for(var _0xdb0cbc=0x0;_0xdb0cbc0x1){_0x4c9a1f['or'](_0xa661('0x6d'),qs[_0xa661('0x6e')](_0xa5ff5b),null);}else{if(qs[_0xa661('0x6f')](_0xa5ff5b)){_0x4c9a1f['or']('c.id\x20LIKE\x20?',_0xa5ff5b+'%');_0x4c9a1f['or']('c.phone\x20LIKE\x20?',_0xa5ff5b+'%');_0x4c9a1f['or'](_0xa661('0x70'),_0xa5ff5b+'%');_0x4c9a1f['or']('c.fax\x20LIKE\x20?',_0xa5ff5b+'%');}else if(qs[_0xa661('0x71')](_0xa5ff5b)){_0x4c9a1f['or'](_0xa661('0x72'),_0xa5ff5b+'%');}else{_0x4c9a1f['or'](_0xa661('0x73'),'%'+_0xa5ff5b+'%');_0x4c9a1f['or'](_0xa661('0x74'),'%'+_0xa5ff5b+'%');_0x4c9a1f['or'](_0xa661('0x72'),'%'+_0xa5ff5b+'%');}}}}_0x354fad[_0xa661('0x3f')](_0x4c9a1f);_0x354fad[_0xa661('0x75')]('c.id');var _0x504191={'type':db[_0xa661('0x76')][_0xa661('0x77')]['SELECT'],'raw':!![]};var _0x3f0140=_0x354fad[_0xa661('0x78')]()[_0xa661('0x42')](_0xa661('0x79'));if(_0x436713[_0xa661('0x7a')]){_0x436713[_0xa661('0x7a')][_0xa661('0x54')](function(_0x4f29c6){_0x354fad[_0xa661('0x7a')]('c.'+_0x4f29c6[0x0],_0x4f29c6[0x1]===_0xa661('0x7b')?![]:!![]);});}if(!_[_0xa661('0x63')](_0x5145c0)){_0x354fad[_0xa661('0x7c')](_0x2bedab);_0x3f0140[_0xa661('0x3f')](_0xa661('0x7d'),_0x5145c0);}BPromise[_0xa661('0x7e')]()[_0xa661('0x29')](function(){if(!_0x44843e)return;if(_0x2e61ba[_0xa661('0x7f')]['role']!=='agent')return;if(!_[_0xa661('0x80')](_0x44843e[_0xa661('0x4f')],[_0xa661('0x42'),_0xa661('0x57')])){return _0x2e61ba['user'][_0xa661('0x81')]({'attributes':['id'],'raw':!![]})[_0xa661('0x29')](function(_0x54bba5){if(_[_0xa661('0x63')](_0x54bba5)){_0x3f0140[_0xa661('0x3f')](_0xa661('0x82'));_0x354fad[_0xa661('0x3f')](_0xa661('0x82'));}else{_0x3f0140[_0xa661('0x3f')](_0xa661('0x65'),_[_0xa661('0x53')](_0x54bba5,'id'));_0x354fad['where'](_0xa661('0x65'),_['map'](_0x54bba5,'id'));}});}})[_0xa661('0x29')](function(){if(_0x2e61ba[_0xa661('0x7f')][_0xa661('0x83')]===_0xa661('0x84')&&!_0x44843e&&!_0x2e61ba[_0xa661('0x39')][_0xa661('0x64')])return[];return db[_0xa661('0x85')][_0xa661('0x39')](_0x3f0140[_0xa661('0x86')](),_0x504191);})[_0xa661('0x29')](function(_0x490e0c){_0x86105a['count']=_0x490e0c['length'];if(_0x86105a['count']===0x0)return[];return db[_0xa661('0x85')][_0xa661('0x39')](_0x5ce6de[_0xa661('0x86')](),_0x504191)[_0xa661('0x29')](function(_0x2ad8c9){_0xd41142=_['keyBy'](_0x2ad8c9,'id');_0x504191=_[_0xa661('0x87')](_0x504191,{'model':db[_0xa661('0x88')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e61ba[_0xa661('0x39')]['fields']){_0x436713[_0xa661('0x3d')]['forEach'](function(_0x33dd5a){_0x354fad[_0xa661('0x42')]('c.'+_0x33dd5a);});}else{_0x354fad[_0xa661('0x42')](_0xa661('0x79'));_0x354fad[_0xa661('0x42')]('c.firstName');_0x354fad['field'](_0xa661('0x89'));_0x354fad[_0xa661('0x42')]('c.phone');_0x354fad[_0xa661('0x42')]('c.mobile');_0x354fad[_0xa661('0x42')](_0xa661('0x8a'));_0x354fad[_0xa661('0x42')](_0xa661('0x8b'));_0x354fad[_0xa661('0x42')](_0xa661('0x8c'));_0x354fad[_0xa661('0x42')](_0xa661('0x8d'));_0x354fad['field'](_0xa661('0x8e'));_0x354fad[_0xa661('0x42')](_0xa661('0x8f'));_0x354fad[_0xa661('0x42')](_0xa661('0x90'),_0xa661('0x91'));}if(_0x436713['limit'])_0x354fad[_0xa661('0x24')](_0x436713[_0xa661('0x24')]);if(_0x436713[_0xa661('0x23')])_0x354fad[_0xa661('0x23')](_0x436713[_0xa661('0x23')]);return db[_0xa661('0x85')][_0xa661('0x39')](_0x354fad['toString'](),_0x504191);});})[_0xa661('0x29')](function(_0x50a1fb){_0x50a1fb['forEach'](function(_0x12bb38){if(_0x12bb38['TagIds']){_0x12bb38[_0xa661('0x92')]=[];_0x12bb38['TagIds']['split'](',')[_0xa661('0x54')](function(_0x1bac44){_0x12bb38[_0xa661('0x92')][_0xa661('0x31')](_0xd41142[_0x1bac44]);});}delete _0x12bb38[_0xa661('0x91')];});_0x86105a[_0xa661('0x93')]=_0x50a1fb;return _0x86105a;})[_0xa661('0x29')](respondWithFilteredResult(_0x3f9d0b,_0x436713));})[_0xa661('0x94')](handleError(_0x3f9d0b,null));};exports[_0xa661('0x2a')]=function(_0x5b35c1,_0x4d251a){return db[_0xa661('0x88')][_0xa661('0x50')]({'where':{'id':_0x5b35c1[_0xa661('0x95')]['id']}})[_0xa661('0x29')](handleEntityNotFound(_0x4d251a,null))['then'](removeEntity(_0x4d251a,null))['catch'](handleError(_0x4d251a,null));};exports['describe']=function(_0x17d260,_0x292536){return db[_0xa661('0x88')][_0xa661('0x2e')]()['then'](function(_0x28b0ee){delete _0x28b0ee[_0xa661('0x96')];for(var _0x1dc4c8=0x0;_0x1dc4c8{}\s\\|]/g,'-');_0x456051(null,util[_0x1bd5('0x1d')](_0x1bd5('0x1e'),path[_0x1bd5('0x1f')](_0x2a746d[_0x1bd5('0x1b')],path[_0x1bd5('0x20')](_0x2a746d[_0x1bd5('0x1b')])),Date['now'](),path[_0x1bd5('0x20')](_0x2a746d['originalname'])));}})});router[_0x1bd5('0x13')](_0x1bd5('0x21'),upload[_0x1bd5('0x22')]('file'),controller[_0x1bd5('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ed551,_0x30676d,_0x3dba4f){_0x3dba4f(null,path[_0x1bd5('0x18')](config['root'],_0x1bd5('0x1a')));},'filename':function(_0x69bb17,_0x20245c,_0x3b1090){_0x20245c['originalname']=_0x20245c[_0x1bd5('0x1b')][_0x1bd5('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b1090(null,util[_0x1bd5('0x1d')](_0x1bd5('0x1e'),path[_0x1bd5('0x1f')](_0x20245c[_0x1bd5('0x1b')],path['extname'](_0x20245c[_0x1bd5('0x1b')])),Date[_0x1bd5('0x24')](),path[_0x1bd5('0x20')](_0x20245c['originalname'])));}})});router[_0x1bd5('0x13')](_0x1bd5('0x25'),upload[_0x1bd5('0x22')](_0x1bd5('0x26')),controller[_0x1bd5('0x27')]);router[_0x1bd5('0x13')]('/upload/:id',auth['isAuthenticated'](),controller[_0x1bd5('0x28')]);router[_0x1bd5('0x29')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x2a')]);router[_0x1bd5('0x2b')](_0x1bd5('0xa'),auth['isAuthenticated'](),controller[_0x1bd5('0x2c')]);module[_0x1bd5('0x2d')]=router; \ No newline at end of file +var _0x7fbe=['/create_many','diskStorage','root','originalname','replace','%s-%s%s','basename','now','/csv','uploadCsv','join','server/files/tmp','format','extname','/upload','file','upload','import','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/merge','post','create'];(function(_0x4d90b6,_0x4632eb){var _0xfbac6e=function(_0x313527){while(--_0x313527){_0x4d90b6['push'](_0x4d90b6['shift']());}};_0xfbac6e(++_0x4632eb);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5b06fb,_0x1190f4){_0x5b06fb=_0x5b06fb-0x0;var _0x53a53a=_0x7fbe[_0x5b06fb];return _0x53a53a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['describe']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['get']('/:id/tags',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0x8')](_0xe7fb('0xf'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x8')](_0xe7fb('0x11'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x8')](_0xe7fb('0x13'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x8')]('/:id/jscripty_sessions',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x15')]);router['post'](_0xe7fb('0x16'),auth[_0xe7fb('0x9')](),controller['merge']);router[_0xe7fb('0x17')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x18')]);router[_0xe7fb('0x17')](_0xe7fb('0x19'),auth[_0xe7fb('0x9')](),controller['bulkCreate']);router[_0xe7fb('0x17')]('/:id/tags',auth[_0xe7fb('0x9')](),controller['setTags']);var upload=multer({'storage':multer[_0xe7fb('0x1a')]({'destination':function(_0x4708f7,_0x3f96a7,_0x182269){_0x182269(null,path['join'](config[_0xe7fb('0x1b')],'server/files/tmp'));},'filename':function(_0x11cae0,_0x51f01f,_0x15f7a4){_0x51f01f['originalname']=_0x51f01f[_0xe7fb('0x1c')][_0xe7fb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x15f7a4(null,util['format'](_0xe7fb('0x1e'),path[_0xe7fb('0x1f')](_0x51f01f[_0xe7fb('0x1c')],path['extname'](_0x51f01f[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path['extname'](_0x51f01f['originalname'])));}})});router['post'](_0xe7fb('0x21'),upload['single']('file'),controller[_0xe7fb('0x22')]);var upload=multer({'storage':multer[_0xe7fb('0x1a')]({'destination':function(_0x2996ae,_0x4f6c73,_0x6c930){_0x6c930(null,path[_0xe7fb('0x23')](config[_0xe7fb('0x1b')],_0xe7fb('0x24')));},'filename':function(_0x392d75,_0x16237a,_0x380130){_0x16237a['originalname']=_0x16237a['originalname'][_0xe7fb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x380130(null,util[_0xe7fb('0x25')](_0xe7fb('0x1e'),path['basename'](_0x16237a[_0xe7fb('0x1c')],path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])));}})});router[_0xe7fb('0x17')](_0xe7fb('0x27'),upload['single'](_0xe7fb('0x28')),controller[_0xe7fb('0x29')]);router[_0xe7fb('0x17')]('/upload/:id',auth['isAuthenticated'](),controller[_0xe7fb('0x2a')]);router['put'](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2b')]);router[_0xe7fb('0x2c')]('/:id',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2d')]);module[_0xe7fb('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 87df655..50c4eca 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe574=['sequelize','INTEGER','STRING','PHONE'];(function(_0x49a59d,_0x1a85fc){var _0x659d=function(_0x2f62fb){while(--_0x2f62fb){_0x49a59d['push'](_0x49a59d['shift']());}};_0x659d(++_0x1a85fc);}(_0xe574,0x100));var _0x4e57=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe574[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x4e57('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x4e57('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4e57('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':_0x4e57('0x3')},'OrderBy':{'type':Sequelize[_0x4e57('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xd072=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x4bbce6,_0x554194){var _0x33ab0a=function(_0x8f9f9c){while(--_0x8f9f9c){_0x4bbce6['push'](_0x4bbce6['shift']());}};_0x33ab0a(++_0x554194);}(_0xd072,0x132));var _0x2d07=function(_0x1105d9,_0x142fa5){_0x1105d9=_0x1105d9-0x0;var _0x896c61=_0xd072[_0x1105d9];return _0x896c61;};'use strict';var Sequelize=require(_0x2d07('0x0'));module[_0x2d07('0x1')]={'CmContactId':{'type':Sequelize[_0x2d07('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2d07('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x2d07('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2d07('0x3')],'defaultValue':_0x2d07('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 9d5e39e..130ce2f 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6851=['merge','options','CmContactHasItem','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','UserProfileSection','autoAssociation','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','reject','save','update','destroy','get','CmContactHasItems','UserProfileResource','then','error','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6851,0x1df));var _0x1685=function(_0x16bf2b,_0xb91a0){_0x16bf2b=_0x16bf2b-0x0;var _0x289e95=_0x6851[_0x16bf2b];return _0x289e95;};'use strict';var pdf=require(_0x1685('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1685('0x1'));var zipdir=require(_0x1685('0x2'));var jsonpatch=require(_0x1685('0x3'));var rp=require(_0x1685('0x4'));var moment=require(_0x1685('0x5'));var BPromise=require(_0x1685('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1685('0x7'));var sox=require(_0x1685('0x8'));var csv=require('to-csv');var ejs=require(_0x1685('0x9'));var fs=require('fs');var _=require(_0x1685('0xa'));var squel=require(_0x1685('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1685('0xc'));var toCsv=require(_0x1685('0xd'));var querystring=require(_0x1685('0xe'));var Papa=require(_0x1685('0xf'));var Redis=require(_0x1685('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1685('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1685('0x12'))(_0x1685('0x13'));var utils=require(_0x1685('0x14'));var config=require(_0x1685('0x15'));var licenseUtil=require(_0x1685('0x16'));var db=require(_0x1685('0x17'))['db'];function respondWithStatusCode(_0x54709b,_0x2174b2){_0x2174b2=_0x2174b2||0xcc;return function(_0x266999){if(_0x266999){return _0x54709b[_0x1685('0x18')](_0x2174b2);}return _0x54709b[_0x1685('0x19')](_0x2174b2)[_0x1685('0x1a')]();};}function respondWithResult(_0x325109,_0x17a205){_0x17a205=_0x17a205||0xc8;return function(_0x1dd776){if(_0x1dd776){return _0x325109[_0x1685('0x19')](_0x17a205)[_0x1685('0x1b')](_0x1dd776);}};}function respondWithFilteredResult(_0x25485f,_0x3d351f){return function(_0x211c47){if(_0x211c47){var _0x5aa83b=_0x211c47['count'],_0x502490=_0x3d351f['offset'],_0x39834e=_0x3d351f['offset']+_0x3d351f[_0x1685('0x1c')],_0x17b3c2;if(_0x39834e>=_0x5aa83b){_0x39834e=_0x5aa83b;_0x17b3c2=0xc8;}else{_0x17b3c2=0xce;}_0x25485f[_0x1685('0x19')](_0x17b3c2);return _0x25485f[_0x1685('0x1d')]('Content-Range',_0x502490+'-'+_0x39834e+'/'+_0x5aa83b)[_0x1685('0x1b')](_0x211c47);}return null;};}function patchUpdates(_0x5f27c4){return function(_0xa60757){try{jsonpatch['apply'](_0xa60757,_0x5f27c4,!![]);}catch(_0x51c5e2){return BPromise[_0x1685('0x1e')](_0x51c5e2);}return _0xa60757[_0x1685('0x1f')]();};}function saveUpdates(_0x374a22,_0x12e409){return function(_0x4392f7){if(_0x4392f7){return _0x4392f7[_0x1685('0x20')](_0x374a22)['then'](function(_0x1f901e){return _0x1f901e;});}return null;};}function removeEntity(_0x3da9dd,_0x59629f){return function(_0x5dd81a){if(_0x5dd81a){return _0x5dd81a[_0x1685('0x21')]()['then'](function(){var _0xde32a5=_0x5dd81a[_0x1685('0x22')]({'plain':!![]});var _0x19ee5b=_0x1685('0x23');return db[_0x1685('0x24')][_0x1685('0x21')]({'where':{'type':_0x19ee5b,'resourceId':_0xde32a5['id']}})[_0x1685('0x25')](function(){return _0x5dd81a;});})['then'](function(){_0x3da9dd[_0x1685('0x19')](0xcc)[_0x1685('0x1a')]();});}};}function handleEntityNotFound(_0x511471,_0x1f7840){return function(_0x26d306){if(!_0x26d306){_0x511471[_0x1685('0x18')](0x194);}return _0x26d306;};}function handleError(_0x4392e0,_0x486744){_0x486744=_0x486744||0x1f4;return function(_0x5cb036){logger[_0x1685('0x26')](_0x5cb036[_0x1685('0x27')]);if(_0x5cb036[_0x1685('0x28')]){delete _0x5cb036[_0x1685('0x28')];}_0x4392e0[_0x1685('0x19')](_0x486744)[_0x1685('0x29')](_0x5cb036);};}exports['index']=function(_0x3b8b96,_0x47f118){var _0x11d983={},_0x254310={},_0x5aca77={'count':0x0,'rows':[]};var _0x46080b=_[_0x1685('0x2a')](db['CmContactHasItem']['rawAttributes'],function(_0x2b5959){return{'name':_0x2b5959[_0x1685('0x2b')],'type':_0x2b5959[_0x1685('0x2c')]['key']};});_0x254310[_0x1685('0x2d')]=_[_0x1685('0x2a')](_0x46080b,_0x1685('0x28'));_0x254310[_0x1685('0x2e')]=_[_0x1685('0x2f')](_0x3b8b96[_0x1685('0x2e')]);_0x254310[_0x1685('0x30')]=_[_0x1685('0x31')](_0x254310[_0x1685('0x2d')],_0x254310['query']);_0x11d983[_0x1685('0x32')]=_[_0x1685('0x31')](_0x254310['model'],qs['fields'](_0x3b8b96[_0x1685('0x2e')][_0x1685('0x33')]));_0x11d983[_0x1685('0x32')]=_0x11d983['attributes'][_0x1685('0x34')]?_0x11d983['attributes']:_0x254310[_0x1685('0x2d')];if(!_0x3b8b96['query']['hasOwnProperty'](_0x1685('0x35'))){_0x11d983[_0x1685('0x1c')]=qs[_0x1685('0x1c')](_0x3b8b96[_0x1685('0x2e')][_0x1685('0x1c')]);_0x11d983['offset']=qs[_0x1685('0x36')](_0x3b8b96[_0x1685('0x2e')]['offset']);}_0x11d983[_0x1685('0x37')]=qs[_0x1685('0x38')](_0x3b8b96[_0x1685('0x2e')][_0x1685('0x38')]);_0x11d983[_0x1685('0x39')]=qs['filters'](_[_0x1685('0x3a')](_0x3b8b96[_0x1685('0x2e')],_0x254310['filters']),_0x46080b);if(_0x3b8b96['query']['filter']){_0x11d983[_0x1685('0x39')]=_['merge'](_0x11d983[_0x1685('0x39')],{'$or':_[_0x1685('0x2a')](_0x46080b,function(_0x4ddb94){if(_0x4ddb94[_0x1685('0x2c')]!=='VIRTUAL'){var _0x1a7e4d={};_0x1a7e4d[_0x4ddb94[_0x1685('0x28')]]={'$like':'%'+_0x3b8b96[_0x1685('0x2e')][_0x1685('0x3b')]+'%'};return _0x1a7e4d;}})});}_0x11d983=_[_0x1685('0x3c')]({},_0x11d983,_0x3b8b96[_0x1685('0x3d')]);var _0x1dd979={'where':_0x11d983[_0x1685('0x39')]};return db[_0x1685('0x3e')]['count'](_0x1dd979)['then'](function(_0x29fcf0){_0x5aca77[_0x1685('0x3f')]=_0x29fcf0;if(_0x3b8b96['query'][_0x1685('0x40')]){_0x11d983[_0x1685('0x41')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x1685('0x42')](_0x11d983);})[_0x1685('0x25')](function(_0x4b7041){_0x5aca77[_0x1685('0x43')]=_0x4b7041;return _0x5aca77;})[_0x1685('0x25')](respondWithFilteredResult(_0x47f118,_0x11d983))[_0x1685('0x44')](handleError(_0x47f118,null));};exports[_0x1685('0x45')]=function(_0x16cc7a,_0xbef681){var _0x3919f0={'raw':!![],'where':{'id':_0x16cc7a[_0x1685('0x46')]['id']}},_0x421783={};_0x421783[_0x1685('0x2d')]=_[_0x1685('0x2f')](db[_0x1685('0x3e')]['rawAttributes']);_0x421783[_0x1685('0x2e')]=_[_0x1685('0x2f')](_0x16cc7a[_0x1685('0x2e')]);_0x421783[_0x1685('0x30')]=_[_0x1685('0x31')](_0x421783['model'],_0x421783[_0x1685('0x2e')]);_0x3919f0[_0x1685('0x32')]=_['intersection'](_0x421783[_0x1685('0x2d')],qs[_0x1685('0x33')](_0x16cc7a[_0x1685('0x2e')][_0x1685('0x33')]));_0x3919f0[_0x1685('0x32')]=_0x3919f0[_0x1685('0x32')][_0x1685('0x34')]?_0x3919f0[_0x1685('0x32')]:_0x421783['model'];if(_0x16cc7a['query'][_0x1685('0x40')]){_0x3919f0[_0x1685('0x41')]=[{'all':!![]}];}_0x3919f0=_['merge']({},_0x3919f0,_0x16cc7a[_0x1685('0x3d')]);return db[_0x1685('0x3e')][_0x1685('0x47')](_0x3919f0)[_0x1685('0x25')](handleEntityNotFound(_0xbef681,null))[_0x1685('0x25')](respondWithResult(_0xbef681,null))[_0x1685('0x44')](handleError(_0xbef681,null));};exports[_0x1685('0x48')]=function(_0x5d9907,_0x4f4198){return db[_0x1685('0x3e')][_0x1685('0x48')](_0x5d9907[_0x1685('0x49')],{})[_0x1685('0x25')](function(_0x3d12e0){var _0x5a4dda=_0x5d9907[_0x1685('0x4a')][_0x1685('0x22')]({'plain':!![]});if(!_0x5a4dda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a4dda['role']==='user'){var _0x4f1938=_0x3d12e0[_0x1685('0x22')]({'plain':!![]});var _0x2bfbc2=_0x1685('0x23');return db[_0x1685('0x4b')][_0x1685('0x47')]({'where':{'name':_0x2bfbc2,'userProfileId':_0x5a4dda['userProfileId']},'raw':!![]})[_0x1685('0x25')](function(_0x314ebd){if(_0x314ebd&&_0x314ebd[_0x1685('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f1938[_0x1685('0x28')],'resourceId':_0x4f1938['id'],'type':_0x314ebd[_0x1685('0x28')],'sectionId':_0x314ebd['id']},{})['then'](function(){return _0x3d12e0;});}else{return _0x3d12e0;}})[_0x1685('0x44')](function(_0xdf7add){logger[_0x1685('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdf7add);throw _0xdf7add;});}return _0x3d12e0;})[_0x1685('0x25')](respondWithResult(_0x4f4198,0xc9))[_0x1685('0x44')](handleError(_0x4f4198,null));};exports['update']=function(_0x264340,_0xad3c1e){if(_0x264340[_0x1685('0x49')]['id']){delete _0x264340[_0x1685('0x49')]['id'];}return db[_0x1685('0x3e')][_0x1685('0x47')]({'where':{'id':_0x264340[_0x1685('0x46')]['id']}})[_0x1685('0x25')](handleEntityNotFound(_0xad3c1e,null))['then'](saveUpdates(_0x264340[_0x1685('0x49')],null))[_0x1685('0x25')](respondWithResult(_0xad3c1e,null))[_0x1685('0x44')](handleError(_0xad3c1e,null));};exports[_0x1685('0x21')]=function(_0x5cdbb1,_0x87eae){return db[_0x1685('0x3e')][_0x1685('0x47')]({'where':{'id':_0x5cdbb1[_0x1685('0x46')]['id']}})[_0x1685('0x25')](handleEntityNotFound(_0x87eae,null))[_0x1685('0x25')](removeEntity(_0x87eae,null))[_0x1685('0x44')](handleError(_0x87eae,null));}; \ No newline at end of file +var _0xfead=['UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','count','limit','set','reject','save','update','then','destroy','get','CmContactHasItems'];(function(_0xef5648,_0x12fe60){var _0x5b808a=function(_0x5a0f89){while(--_0x5a0f89){_0xef5648['push'](_0xef5648['shift']());}};_0x5b808a(++_0x12fe60);}(_0xfead,0x152));var _0xdfea=function(_0x1689f7,_0x16c276){_0x1689f7=_0x1689f7-0x0;var _0x2059af=_0xfead[_0x1689f7];return _0x2059af;};'use strict';var pdf=require(_0xdfea('0x0'));var emlformat=require(_0xdfea('0x1'));var rimraf=require(_0xdfea('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfea('0x3'));var rp=require('request-promise');var moment=require(_0xdfea('0x4'));var BPromise=require(_0xdfea('0x5'));var Mustache=require(_0xdfea('0x6'));var util=require('util');var path=require(_0xdfea('0x7'));var sox=require('sox');var csv=require(_0xdfea('0x8'));var ejs=require(_0xdfea('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdfea('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdfea('0xb'));var toCsv=require(_0xdfea('0x8'));var querystring=require(_0xdfea('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdfea('0xd'));var qs=require(_0xdfea('0xe'));var as=require(_0xdfea('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfea('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdfea('0x11'));var db=require(_0xdfea('0x12'))['db'];function respondWithStatusCode(_0x1fcecd,_0x335aa2){_0x335aa2=_0x335aa2||0xcc;return function(_0x395c0e){if(_0x395c0e){return _0x1fcecd['sendStatus'](_0x335aa2);}return _0x1fcecd[_0xdfea('0x13')](_0x335aa2)[_0xdfea('0x14')]();};}function respondWithResult(_0x480f44,_0x534f73){_0x534f73=_0x534f73||0xc8;return function(_0x3e4fd3){if(_0x3e4fd3){return _0x480f44[_0xdfea('0x13')](_0x534f73)[_0xdfea('0x15')](_0x3e4fd3);}};}function respondWithFilteredResult(_0x1279fc,_0x1b01a2){return function(_0x5ce6b1){if(_0x5ce6b1){var _0x1f4755=_0x5ce6b1[_0xdfea('0x16')],_0x167b5d=_0x1b01a2['offset'],_0x3d605e=_0x1b01a2['offset']+_0x1b01a2[_0xdfea('0x17')],_0x31a7ab;if(_0x3d605e>=_0x1f4755){_0x3d605e=_0x1f4755;_0x31a7ab=0xc8;}else{_0x31a7ab=0xce;}_0x1279fc['status'](_0x31a7ab);return _0x1279fc[_0xdfea('0x18')]('Content-Range',_0x167b5d+'-'+_0x3d605e+'/'+_0x1f4755)[_0xdfea('0x15')](_0x5ce6b1);}return null;};}function patchUpdates(_0x2a2a76){return function(_0x2a1f23){try{jsonpatch['apply'](_0x2a1f23,_0x2a2a76,!![]);}catch(_0xeb3b83){return BPromise[_0xdfea('0x19')](_0xeb3b83);}return _0x2a1f23[_0xdfea('0x1a')]();};}function saveUpdates(_0x47a34d,_0x40e1e8){return function(_0x37a60c){if(_0x37a60c){return _0x37a60c[_0xdfea('0x1b')](_0x47a34d)[_0xdfea('0x1c')](function(_0xff3862){return _0xff3862;});}return null;};}function removeEntity(_0xc1ab75,_0x54812f){return function(_0x281060){if(_0x281060){return _0x281060[_0xdfea('0x1d')]()[_0xdfea('0x1c')](function(){var _0x203a01=_0x281060[_0xdfea('0x1e')]({'plain':!![]});var _0x2edc0f=_0xdfea('0x1f');return db[_0xdfea('0x20')]['destroy']({'where':{'type':_0x2edc0f,'resourceId':_0x203a01['id']}})[_0xdfea('0x1c')](function(){return _0x281060;});})[_0xdfea('0x1c')](function(){_0xc1ab75[_0xdfea('0x13')](0xcc)[_0xdfea('0x14')]();});}};}function handleEntityNotFound(_0x25ac4e,_0x279eea){return function(_0x287bab){if(!_0x287bab){_0x25ac4e['sendStatus'](0x194);}return _0x287bab;};}function handleError(_0x2e0d98,_0xae6e98){_0xae6e98=_0xae6e98||0x1f4;return function(_0x25923e){logger[_0xdfea('0x21')](_0x25923e[_0xdfea('0x22')]);if(_0x25923e[_0xdfea('0x23')]){delete _0x25923e[_0xdfea('0x23')];}_0x2e0d98[_0xdfea('0x13')](_0xae6e98)[_0xdfea('0x24')](_0x25923e);};}exports[_0xdfea('0x25')]=function(_0x53922c,_0x58b501){var _0x2a6fee={},_0x127473={},_0x578f1b={'count':0x0,'rows':[]};var _0x4b105e=_[_0xdfea('0x26')](db[_0xdfea('0x27')][_0xdfea('0x28')],function(_0x3651a1){return{'name':_0x3651a1[_0xdfea('0x29')],'type':_0x3651a1[_0xdfea('0x2a')][_0xdfea('0x2b')]};});_0x127473[_0xdfea('0x2c')]=_[_0xdfea('0x26')](_0x4b105e,_0xdfea('0x23'));_0x127473[_0xdfea('0x2d')]=_[_0xdfea('0x2e')](_0x53922c[_0xdfea('0x2d')]);_0x127473[_0xdfea('0x2f')]=_[_0xdfea('0x30')](_0x127473['model'],_0x127473[_0xdfea('0x2d')]);_0x2a6fee['attributes']=_[_0xdfea('0x30')](_0x127473[_0xdfea('0x2c')],qs[_0xdfea('0x31')](_0x53922c[_0xdfea('0x2d')][_0xdfea('0x31')]));_0x2a6fee[_0xdfea('0x32')]=_0x2a6fee[_0xdfea('0x32')][_0xdfea('0x33')]?_0x2a6fee[_0xdfea('0x32')]:_0x127473[_0xdfea('0x2c')];if(!_0x53922c['query'][_0xdfea('0x34')]('nolimit')){_0x2a6fee['limit']=qs[_0xdfea('0x17')](_0x53922c[_0xdfea('0x2d')]['limit']);_0x2a6fee[_0xdfea('0x35')]=qs['offset'](_0x53922c[_0xdfea('0x2d')][_0xdfea('0x35')]);}_0x2a6fee['order']=qs[_0xdfea('0x36')](_0x53922c[_0xdfea('0x2d')][_0xdfea('0x36')]);_0x2a6fee[_0xdfea('0x37')]=qs[_0xdfea('0x2f')](_[_0xdfea('0x38')](_0x53922c[_0xdfea('0x2d')],_0x127473[_0xdfea('0x2f')]),_0x4b105e);if(_0x53922c['query'][_0xdfea('0x39')]){_0x2a6fee[_0xdfea('0x37')]=_[_0xdfea('0x3a')](_0x2a6fee[_0xdfea('0x37')],{'$or':_[_0xdfea('0x26')](_0x4b105e,function(_0x584cdc){if(_0x584cdc['type']!==_0xdfea('0x3b')){var _0xe5c53d={};_0xe5c53d[_0x584cdc[_0xdfea('0x23')]]={'$like':'%'+_0x53922c['query'][_0xdfea('0x39')]+'%'};return _0xe5c53d;}})});}_0x2a6fee=_[_0xdfea('0x3a')]({},_0x2a6fee,_0x53922c['options']);var _0x34fac3={'where':_0x2a6fee[_0xdfea('0x37')]};return db[_0xdfea('0x27')][_0xdfea('0x16')](_0x34fac3)[_0xdfea('0x1c')](function(_0x266b76){_0x578f1b[_0xdfea('0x16')]=_0x266b76;if(_0x53922c['query'][_0xdfea('0x3c')]){_0x2a6fee[_0xdfea('0x3d')]=[{'all':!![]}];}return db[_0xdfea('0x27')][_0xdfea('0x3e')](_0x2a6fee);})['then'](function(_0x13305c){_0x578f1b[_0xdfea('0x3f')]=_0x13305c;return _0x578f1b;})[_0xdfea('0x1c')](respondWithFilteredResult(_0x58b501,_0x2a6fee))[_0xdfea('0x40')](handleError(_0x58b501,null));};exports['show']=function(_0x1e3572,_0x3acfc4){var _0x4e8498={'raw':!![],'where':{'id':_0x1e3572['params']['id']}},_0x443ca9={};_0x443ca9[_0xdfea('0x2c')]=_[_0xdfea('0x2e')](db[_0xdfea('0x27')][_0xdfea('0x28')]);_0x443ca9[_0xdfea('0x2d')]=_[_0xdfea('0x2e')](_0x1e3572[_0xdfea('0x2d')]);_0x443ca9[_0xdfea('0x2f')]=_['intersection'](_0x443ca9[_0xdfea('0x2c')],_0x443ca9['query']);_0x4e8498['attributes']=_[_0xdfea('0x30')](_0x443ca9[_0xdfea('0x2c')],qs[_0xdfea('0x31')](_0x1e3572[_0xdfea('0x2d')][_0xdfea('0x31')]));_0x4e8498[_0xdfea('0x32')]=_0x4e8498[_0xdfea('0x32')][_0xdfea('0x33')]?_0x4e8498[_0xdfea('0x32')]:_0x443ca9[_0xdfea('0x2c')];if(_0x1e3572[_0xdfea('0x2d')][_0xdfea('0x3c')]){_0x4e8498[_0xdfea('0x3d')]=[{'all':!![]}];}_0x4e8498=_['merge']({},_0x4e8498,_0x1e3572[_0xdfea('0x41')]);return db[_0xdfea('0x27')][_0xdfea('0x42')](_0x4e8498)['then'](handleEntityNotFound(_0x3acfc4,null))[_0xdfea('0x1c')](respondWithResult(_0x3acfc4,null))['catch'](handleError(_0x3acfc4,null));};exports[_0xdfea('0x43')]=function(_0x372f6c,_0x80ba85){return db[_0xdfea('0x27')]['create'](_0x372f6c[_0xdfea('0x44')],{})[_0xdfea('0x1c')](function(_0x55b71c){var _0x18d502=_0x372f6c[_0xdfea('0x45')]['get']({'plain':!![]});if(!_0x18d502)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18d502['role']===_0xdfea('0x45')){var _0x3a7e10=_0x55b71c[_0xdfea('0x1e')]({'plain':!![]});var _0xfc838a=_0xdfea('0x1f');return db[_0xdfea('0x46')][_0xdfea('0x42')]({'where':{'name':_0xfc838a,'userProfileId':_0x18d502[_0xdfea('0x47')]},'raw':!![]})[_0xdfea('0x1c')](function(_0x1517bc){if(_0x1517bc&&_0x1517bc[_0xdfea('0x48')]===0x0){return db[_0xdfea('0x20')]['create']({'name':_0x3a7e10['name'],'resourceId':_0x3a7e10['id'],'type':_0x1517bc[_0xdfea('0x23')],'sectionId':_0x1517bc['id']},{})[_0xdfea('0x1c')](function(){return _0x55b71c;});}else{return _0x55b71c;}})['catch'](function(_0x3180e4){logger[_0xdfea('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3180e4);throw _0x3180e4;});}return _0x55b71c;})[_0xdfea('0x1c')](respondWithResult(_0x80ba85,0xc9))[_0xdfea('0x40')](handleError(_0x80ba85,null));};exports[_0xdfea('0x1b')]=function(_0xe9fd94,_0x32bfae){if(_0xe9fd94[_0xdfea('0x44')]['id']){delete _0xe9fd94[_0xdfea('0x44')]['id'];}return db[_0xdfea('0x27')][_0xdfea('0x42')]({'where':{'id':_0xe9fd94[_0xdfea('0x49')]['id']}})[_0xdfea('0x1c')](handleEntityNotFound(_0x32bfae,null))['then'](saveUpdates(_0xe9fd94[_0xdfea('0x44')],null))[_0xdfea('0x1c')](respondWithResult(_0x32bfae,null))['catch'](handleError(_0x32bfae,null));};exports[_0xdfea('0x1d')]=function(_0x44e763,_0x19c86c){return db['CmContactHasItem'][_0xdfea('0x42')]({'where':{'id':_0x44e763[_0xdfea('0x49')]['id']}})[_0xdfea('0x1c')](handleEntityNotFound(_0x19c86c,null))[_0xdfea('0x1c')](removeEntity(_0x19c86c,null))[_0xdfea('0x40')](handleError(_0x19c86c,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 0283c09..4816b0c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e24=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash'];(function(_0xc7c2a0,_0x38dabd){var _0x43a122=function(_0x4ebd80){while(--_0x4ebd80){_0xc7c2a0['push'](_0xc7c2a0['shift']());}};_0x43a122(++_0x38dabd);}(_0x3e24,0x167));var _0x43e2=function(_0x10e325,_0x444af7){_0x10e325=_0x10e325-0x0;var _0x300f2c=_0x3e24[_0x10e325];return _0x300f2c;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var logger=require(_0x43e2('0x2'))(_0x43e2('0x3'));var moment=require(_0x43e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43e2('0x5'));var fs=require('fs');var path=require(_0x43e2('0x6'));var rimraf=require('rimraf');var config=require(_0x43e2('0x7'));var attributes=require(_0x43e2('0x8'));module[_0x43e2('0x9')]=function(_0x28b144,_0x43b5a7){return _0x28b144[_0x43e2('0xa')](_0x43e2('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','lodash','util','api','moment','bluebird','path'];(function(_0x5b1e8d,_0x4eaca){var _0x3ce7a4=function(_0x20eb53){while(--_0x20eb53){_0x5b1e8d['push'](_0x5b1e8d['shift']());}};_0x3ce7a4(++_0x4eaca);}(_0xeff8,0x186));var _0x8eff=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xeff8[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 216cc12..b61b6fe 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65b4=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x97db86,_0x38778d){var _0xee4c35=function(_0x1e6ffc){while(--_0x1e6ffc){_0x97db86['push'](_0x97db86['shift']());}};_0xee4c35(++_0x38778d);}(_0x65b4,0x96));var _0x465b=function(_0x483872,_0x2528e9){_0x483872=_0x483872-0x0;var _0x389c08=_0x65b4[_0x483872];return _0x389c08;};'use strict';var _=require(_0x465b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x465b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x465b('0x2'));var db=require(_0x465b('0x3'))['db'];var utils=require(_0x465b('0x4'));var logger=require(_0x465b('0x5'))('rpc');var config=require(_0x465b('0x6'));var jayson=require(_0x465b('0x7'));var client=jayson[_0x465b('0x8')][_0x465b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d3796,_0x3a8273,_0x4f258c){return new BPromise(function(_0x351ee3,_0x3d7d58){return client[_0x465b('0xa')](_0x5d3796,_0x4f258c)[_0x465b('0xb')](function(_0x3bbb67){logger[_0x465b('0xc')](_0x465b('0xd'),_0x3a8273,'request\x20sent');logger[_0x465b('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x3a8273,'request\x20sent',JSON[_0x465b('0xf')](_0x3bbb67));if(_0x3bbb67[_0x465b('0x10')]){if(_0x3bbb67[_0x465b('0x10')][_0x465b('0x11')]===0x1f4){logger['error'](_0x465b('0xd'),_0x3a8273,_0x3bbb67[_0x465b('0x10')]['message']);return _0x3d7d58(_0x3bbb67[_0x465b('0x10')][_0x465b('0x12')]);}logger[_0x465b('0x10')](_0x465b('0xd'),_0x3a8273,_0x3bbb67[_0x465b('0x10')]['message']);return _0x351ee3(_0x3bbb67[_0x465b('0x10')][_0x465b('0x12')]);}else{logger[_0x465b('0xc')](_0x465b('0xd'),_0x3a8273,_0x465b('0x13'));_0x351ee3(_0x3bbb67[_0x465b('0x14')][_0x465b('0x12')]);}})[_0x465b('0x15')](function(_0x2bf90a){logger[_0x465b('0x10')](_0x465b('0xd'),_0x3a8273,_0x2bf90a);_0x3d7d58(_0x2bf90a);});});} \ No newline at end of file +var _0x11c3=['code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3827b0,_0x16cacf){var _0x241e2a=function(_0x258f6e){while(--_0x258f6e){_0x3827b0['push'](_0x3827b0['shift']());}};_0x241e2a(++_0x16cacf);}(_0x11c3,0x179));var _0x311c=function(_0xc48818,_0x53aa65){_0xc48818=_0xc48818-0x0;var _0x44953f=_0x11c3[_0xc48818];return _0x44953f;};'use strict';var _=require(_0x311c('0x0'));var util=require('util');var moment=require(_0x311c('0x1'));var BPromise=require(_0x311c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x311c('0x3'));var db=require(_0x311c('0x4'))['db'];var utils=require(_0x311c('0x5'));var logger=require(_0x311c('0x6'))(_0x311c('0x7'));var config=require('../../config/environment');var jayson=require(_0x311c('0x8'));var client=jayson[_0x311c('0x9')][_0x311c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1472d5,_0x12d1d9,_0x1e67a4){return new BPromise(function(_0xee6b8d,_0x3634aa){return client['request'](_0x1472d5,_0x1e67a4)[_0x311c('0xb')](function(_0x5c9f1c){logger[_0x311c('0xc')](_0x311c('0xd'),_0x12d1d9,_0x311c('0xe'));logger[_0x311c('0xf')](_0x311c('0x10'),_0x12d1d9,_0x311c('0xe'),JSON[_0x311c('0x11')](_0x5c9f1c));if(_0x5c9f1c['error']){if(_0x5c9f1c[_0x311c('0x12')][_0x311c('0x13')]===0x1f4){logger[_0x311c('0x12')](_0x311c('0xd'),_0x12d1d9,_0x5c9f1c[_0x311c('0x12')][_0x311c('0x14')]);return _0x3634aa(_0x5c9f1c[_0x311c('0x12')][_0x311c('0x14')]);}logger[_0x311c('0x12')](_0x311c('0xd'),_0x12d1d9,_0x5c9f1c[_0x311c('0x12')][_0x311c('0x14')]);return _0xee6b8d(_0x5c9f1c[_0x311c('0x12')][_0x311c('0x14')]);}else{logger[_0x311c('0xc')](_0x311c('0xd'),_0x12d1d9,_0x311c('0xe'));_0xee6b8d(_0x5c9f1c[_0x311c('0x15')]['message']);}})['catch'](function(_0x4eb95f){logger[_0x311c('0x12')](_0x311c('0xd'),_0x12d1d9,_0x4eb95f);_0x3634aa(_0x4eb95f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 9415c5c..ed17452 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ca2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x25e761,_0xe5c435){var _0x2740af=function(_0x30a342){while(--_0x30a342){_0x25e761['push'](_0x25e761['shift']());}};_0x2740af(++_0xe5c435);}(_0x9ca2,0x109));var _0x29ca=function(_0x4cd89e,_0x1718eb){_0x4cd89e=_0x4cd89e-0x0;var _0x43723b=_0x9ca2[_0x4cd89e];return _0x43723b;};'use strict';var multer=require(_0x29ca('0x0'));var util=require('util');var path=require(_0x29ca('0x1'));var timeout=require(_0x29ca('0x2'));var express=require(_0x29ca('0x3'));var router=express[_0x29ca('0x4')]();var auth=require(_0x29ca('0x5'));var interaction=require(_0x29ca('0x6'));var config=require(_0x29ca('0x7'));var controller=require(_0x29ca('0x8'));router['get']('/',auth[_0x29ca('0x9')](),controller[_0x29ca('0xa')]);router[_0x29ca('0xb')](_0x29ca('0xc'),auth[_0x29ca('0x9')](),controller[_0x29ca('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x29ca('0xe')]);router['put'](_0x29ca('0xc'),auth[_0x29ca('0x9')](),controller[_0x29ca('0xf')]);router[_0x29ca('0x10')](_0x29ca('0xc'),auth[_0x29ca('0x9')](),controller[_0x29ca('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5e06=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmContactHasItem.controller','get'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5e06,0xbd));var _0x65e0=function(_0x1ffc11,_0x2423d4){_0x1ffc11=_0x1ffc11-0x0;var _0x1f781a=_0x5e06[_0x1ffc11];return _0x1f781a;};'use strict';var multer=require(_0x65e0('0x0'));var util=require(_0x65e0('0x1'));var path=require(_0x65e0('0x2'));var timeout=require(_0x65e0('0x3'));var express=require(_0x65e0('0x4'));var router=express[_0x65e0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x65e0('0x6'));var controller=require(_0x65e0('0x7'));router[_0x65e0('0x8')]('/',auth[_0x65e0('0x9')](),controller['index']);router['get'](_0x65e0('0xa'),auth['isAuthenticated'](),controller[_0x65e0('0xb')]);router[_0x65e0('0xc')]('/',auth[_0x65e0('0x9')](),controller[_0x65e0('0xd')]);router[_0x65e0('0xe')](_0x65e0('0xa'),auth[_0x65e0('0x9')](),controller[_0x65e0('0xf')]);router['delete'](_0x65e0('0xa'),auth['isAuthenticated'](),controller[_0x65e0('0x10')]);module[_0x65e0('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 7daa3d5..0dbef74 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd16d=['INTEGER','exports'];(function(_0x4a16aa,_0x46f661){var _0x4e9af4=function(_0x1e7660){while(--_0x1e7660){_0x4a16aa['push'](_0x4a16aa['shift']());}};_0x4e9af4(++_0x46f661);}(_0xd16d,0x123));var _0xdd16=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd16d[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require('sequelize');module[_0xdd16('0x0')]={'CmContactId':{'type':Sequelize[_0xdd16('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xba9e=['STRING','sequelize','exports','INTEGER'];(function(_0x1ca543,_0x7d11e6){var _0x304668=function(_0x202264){while(--_0x202264){_0x1ca543['push'](_0x1ca543['shift']());}};_0x304668(++_0x7d11e6);}(_0xba9e,0xf5));var _0xeba9=function(_0x30ceaa,_0x2fe315){_0x30ceaa=_0x30ceaa-0x0;var _0x47850f=_0xba9e[_0x30ceaa];return _0x47850f;};'use strict';var Sequelize=require(_0xeba9('0x0'));module[_0xeba9('0x1')]={'CmContactId':{'type':Sequelize[_0xeba9('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xeba9('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 365d1c7..b1a8a19 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4cb=['where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasPhones','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','reject','save','then','destroy','get','UserProfileResource','error','name','index','map','CmContactHasPhone','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','sort'];(function(_0x101f13,_0x506bf0){var _0xf4a101=function(_0x25fe45){while(--_0x25fe45){_0x101f13['push'](_0x101f13['shift']());}};_0xf4a101(++_0x506bf0);}(_0xc4cb,0x10b));var _0xbc4c=function(_0x52bdfe,_0x5282ec){_0x52bdfe=_0x52bdfe-0x0;var _0x5c6df7=_0xc4cb[_0x52bdfe];return _0x5c6df7;};'use strict';var pdf=require(_0xbc4c('0x0'));var emlformat=require(_0xbc4c('0x1'));var rimraf=require(_0xbc4c('0x2'));var zipdir=require(_0xbc4c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc4c('0x4'));var moment=require(_0xbc4c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbc4c('0x6'));var util=require(_0xbc4c('0x7'));var path=require('path');var sox=require(_0xbc4c('0x8'));var csv=require(_0xbc4c('0x9'));var ejs=require(_0xbc4c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbc4c('0xb'));var crypto=require(_0xbc4c('0xc'));var jsforce=require(_0xbc4c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbc4c('0x9'));var querystring=require(_0xbc4c('0xe'));var Papa=require('papaparse');var Redis=require(_0xbc4c('0xf'));var authService=require(_0xbc4c('0x10'));var qs=require(_0xbc4c('0x11'));var as=require(_0xbc4c('0x12'));var hardwareService=require(_0xbc4c('0x13'));var logger=require('../../config/logger')(_0xbc4c('0x14'));var utils=require(_0xbc4c('0x15'));var config=require(_0xbc4c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc4c('0x17'))['db'];function respondWithStatusCode(_0xd4c86f,_0x12ad1c){_0x12ad1c=_0x12ad1c||0xcc;return function(_0x219dc0){if(_0x219dc0){return _0xd4c86f[_0xbc4c('0x18')](_0x12ad1c);}return _0xd4c86f[_0xbc4c('0x19')](_0x12ad1c)['end']();};}function respondWithResult(_0x4bcb65,_0x2f185c){_0x2f185c=_0x2f185c||0xc8;return function(_0x4eb142){if(_0x4eb142){return _0x4bcb65[_0xbc4c('0x19')](_0x2f185c)[_0xbc4c('0x1a')](_0x4eb142);}};}function respondWithFilteredResult(_0x3a25b0,_0x2c204b){return function(_0x50333d){if(_0x50333d){var _0x49e112=_0x50333d['count'],_0xd92c11=_0x2c204b[_0xbc4c('0x1b')],_0x3a339b=_0x2c204b['offset']+_0x2c204b[_0xbc4c('0x1c')],_0xfaf41d;if(_0x3a339b>=_0x49e112){_0x3a339b=_0x49e112;_0xfaf41d=0xc8;}else{_0xfaf41d=0xce;}_0x3a25b0[_0xbc4c('0x19')](_0xfaf41d);return _0x3a25b0[_0xbc4c('0x1d')]('Content-Range',_0xd92c11+'-'+_0x3a339b+'/'+_0x49e112)[_0xbc4c('0x1a')](_0x50333d);}return null;};}function patchUpdates(_0x1a6fd7){return function(_0xa505c7){try{jsonpatch['apply'](_0xa505c7,_0x1a6fd7,!![]);}catch(_0x4d2455){return BPromise[_0xbc4c('0x1e')](_0x4d2455);}return _0xa505c7[_0xbc4c('0x1f')]();};}function saveUpdates(_0x110192,_0x165903){return function(_0x2a52b3){if(_0x2a52b3){return _0x2a52b3['update'](_0x110192)[_0xbc4c('0x20')](function(_0x2f7c87){return _0x2f7c87;});}return null;};}function removeEntity(_0x3db678,_0x2c9419){return function(_0x52c4a7){if(_0x52c4a7){return _0x52c4a7[_0xbc4c('0x21')]()[_0xbc4c('0x20')](function(){var _0x309dd9=_0x52c4a7[_0xbc4c('0x22')]({'plain':!![]});var _0x1641d3='CmContactHasPhones';return db[_0xbc4c('0x23')][_0xbc4c('0x21')]({'where':{'type':_0x1641d3,'resourceId':_0x309dd9['id']}})[_0xbc4c('0x20')](function(){return _0x52c4a7;});})[_0xbc4c('0x20')](function(){_0x3db678[_0xbc4c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x591ebf,_0x3ae2ec){return function(_0x4312fd){if(!_0x4312fd){_0x591ebf[_0xbc4c('0x18')](0x194);}return _0x4312fd;};}function handleError(_0x7b087b,_0x4745b9){_0x4745b9=_0x4745b9||0x1f4;return function(_0x32ecd6){logger[_0xbc4c('0x24')](_0x32ecd6['stack']);if(_0x32ecd6['name']){delete _0x32ecd6[_0xbc4c('0x25')];}_0x7b087b[_0xbc4c('0x19')](_0x4745b9)['send'](_0x32ecd6);};}exports[_0xbc4c('0x26')]=function(_0x1a86c1,_0x385056){var _0x243510={},_0x4e1234={},_0x2b3941={'count':0x0,'rows':[]};var _0x322093=_[_0xbc4c('0x27')](db[_0xbc4c('0x28')][_0xbc4c('0x29')],function(_0x49de64){return{'name':_0x49de64[_0xbc4c('0x2a')],'type':_0x49de64[_0xbc4c('0x2b')][_0xbc4c('0x2c')]};});_0x4e1234['model']=_[_0xbc4c('0x27')](_0x322093,_0xbc4c('0x25'));_0x4e1234[_0xbc4c('0x2d')]=_['keys'](_0x1a86c1[_0xbc4c('0x2d')]);_0x4e1234[_0xbc4c('0x2e')]=_[_0xbc4c('0x2f')](_0x4e1234[_0xbc4c('0x30')],_0x4e1234[_0xbc4c('0x2d')]);_0x243510[_0xbc4c('0x31')]=_[_0xbc4c('0x2f')](_0x4e1234[_0xbc4c('0x30')],qs['fields'](_0x1a86c1['query']['fields']));_0x243510[_0xbc4c('0x31')]=_0x243510[_0xbc4c('0x31')][_0xbc4c('0x32')]?_0x243510[_0xbc4c('0x31')]:_0x4e1234[_0xbc4c('0x30')];if(!_0x1a86c1[_0xbc4c('0x2d')][_0xbc4c('0x33')]('nolimit')){_0x243510['limit']=qs[_0xbc4c('0x1c')](_0x1a86c1[_0xbc4c('0x2d')][_0xbc4c('0x1c')]);_0x243510[_0xbc4c('0x1b')]=qs[_0xbc4c('0x1b')](_0x1a86c1[_0xbc4c('0x2d')][_0xbc4c('0x1b')]);}_0x243510['order']=qs[_0xbc4c('0x34')](_0x1a86c1[_0xbc4c('0x2d')][_0xbc4c('0x34')]);_0x243510[_0xbc4c('0x35')]=qs[_0xbc4c('0x2e')](_[_0xbc4c('0x36')](_0x1a86c1[_0xbc4c('0x2d')],_0x4e1234[_0xbc4c('0x2e')]),_0x322093);if(_0x1a86c1[_0xbc4c('0x2d')][_0xbc4c('0x37')]){_0x243510[_0xbc4c('0x35')]=_[_0xbc4c('0x38')](_0x243510[_0xbc4c('0x35')],{'$or':_['map'](_0x322093,function(_0x359aef){if(_0x359aef['type']!==_0xbc4c('0x39')){var _0x3365ea={};_0x3365ea[_0x359aef[_0xbc4c('0x25')]]={'$like':'%'+_0x1a86c1['query'][_0xbc4c('0x37')]+'%'};return _0x3365ea;}})});}_0x243510=_[_0xbc4c('0x38')]({},_0x243510,_0x1a86c1[_0xbc4c('0x3a')]);var _0x15b788={'where':_0x243510[_0xbc4c('0x35')]};return db[_0xbc4c('0x28')]['count'](_0x15b788)[_0xbc4c('0x20')](function(_0x378987){_0x2b3941[_0xbc4c('0x3b')]=_0x378987;if(_0x1a86c1['query'][_0xbc4c('0x3c')]){_0x243510['include']=[{'all':!![]}];}return db['CmContactHasPhone'][_0xbc4c('0x3d')](_0x243510);})['then'](function(_0x5eabc8){_0x2b3941[_0xbc4c('0x3e')]=_0x5eabc8;return _0x2b3941;})[_0xbc4c('0x20')](respondWithFilteredResult(_0x385056,_0x243510))[_0xbc4c('0x3f')](handleError(_0x385056,null));};exports[_0xbc4c('0x40')]=function(_0x3f5534,_0xdde14b){var _0x20d26e={'raw':!![],'where':{'id':_0x3f5534[_0xbc4c('0x41')]['id']}},_0x230cfa={};_0x230cfa[_0xbc4c('0x30')]=_[_0xbc4c('0x42')](db[_0xbc4c('0x28')][_0xbc4c('0x29')]);_0x230cfa[_0xbc4c('0x2d')]=_['keys'](_0x3f5534[_0xbc4c('0x2d')]);_0x230cfa['filters']=_[_0xbc4c('0x2f')](_0x230cfa['model'],_0x230cfa[_0xbc4c('0x2d')]);_0x20d26e['attributes']=_['intersection'](_0x230cfa[_0xbc4c('0x30')],qs[_0xbc4c('0x43')](_0x3f5534[_0xbc4c('0x2d')]['fields']));_0x20d26e[_0xbc4c('0x31')]=_0x20d26e[_0xbc4c('0x31')][_0xbc4c('0x32')]?_0x20d26e[_0xbc4c('0x31')]:_0x230cfa[_0xbc4c('0x30')];if(_0x3f5534[_0xbc4c('0x2d')]['includeAll']){_0x20d26e[_0xbc4c('0x44')]=[{'all':!![]}];}_0x20d26e=_['merge']({},_0x20d26e,_0x3f5534[_0xbc4c('0x3a')]);return db['CmContactHasPhone'][_0xbc4c('0x45')](_0x20d26e)[_0xbc4c('0x20')](handleEntityNotFound(_0xdde14b,null))[_0xbc4c('0x20')](respondWithResult(_0xdde14b,null))[_0xbc4c('0x3f')](handleError(_0xdde14b,null));};exports[_0xbc4c('0x46')]=function(_0x4ecbbc,_0x2d449c){return db['CmContactHasPhone'][_0xbc4c('0x46')](_0x4ecbbc[_0xbc4c('0x47')],{})[_0xbc4c('0x20')](function(_0x534ac9){var _0x10d33a=_0x4ecbbc[_0xbc4c('0x48')][_0xbc4c('0x22')]({'plain':!![]});if(!_0x10d33a)throw new Error(_0xbc4c('0x49'));if(_0x10d33a[_0xbc4c('0x4a')]===_0xbc4c('0x48')){var _0x153d90=_0x534ac9[_0xbc4c('0x22')]({'plain':!![]});var _0x682aa9=_0xbc4c('0x4b');return db[_0xbc4c('0x4c')][_0xbc4c('0x45')]({'where':{'name':_0x682aa9,'userProfileId':_0x10d33a[_0xbc4c('0x4d')]},'raw':!![]})[_0xbc4c('0x20')](function(_0x99a83e){if(_0x99a83e&&_0x99a83e[_0xbc4c('0x4e')]===0x0){return db['UserProfileResource'][_0xbc4c('0x46')]({'name':_0x153d90[_0xbc4c('0x25')],'resourceId':_0x153d90['id'],'type':_0x99a83e[_0xbc4c('0x25')],'sectionId':_0x99a83e['id']},{})[_0xbc4c('0x20')](function(){return _0x534ac9;});}else{return _0x534ac9;}})[_0xbc4c('0x3f')](function(_0xe0da1a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe0da1a);throw _0xe0da1a;});}return _0x534ac9;})['then'](respondWithResult(_0x2d449c,0xc9))[_0xbc4c('0x3f')](handleError(_0x2d449c,null));};exports[_0xbc4c('0x4f')]=function(_0x1afee8,_0x4e14a7){if(_0x1afee8[_0xbc4c('0x47')]['id']){delete _0x1afee8['body']['id'];}return db['CmContactHasPhone'][_0xbc4c('0x45')]({'where':{'id':_0x1afee8[_0xbc4c('0x41')]['id']}})[_0xbc4c('0x20')](handleEntityNotFound(_0x4e14a7,null))[_0xbc4c('0x20')](saveUpdates(_0x1afee8[_0xbc4c('0x47')],null))[_0xbc4c('0x20')](respondWithResult(_0x4e14a7,null))[_0xbc4c('0x3f')](handleError(_0x4e14a7,null));};exports[_0xbc4c('0x21')]=function(_0x4d9c03,_0x5935c5){return db['CmContactHasPhone']['find']({'where':{'id':_0x4d9c03[_0xbc4c('0x41')]['id']}})[_0xbc4c('0x20')](handleEntityNotFound(_0x5935c5,null))[_0xbc4c('0x20')](removeEntity(_0x5935c5,null))[_0xbc4c('0x3f')](handleError(_0x5935c5,null));}; \ No newline at end of file +var _0x6381=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','CmContactHasPhone','include','rows','show','params','rawAttributes','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasPhones','UserProfileResource','error','stack','name','send','index','map','fieldName'];(function(_0x2394bd,_0x46fef1){var _0x5c1a48=function(_0x4ae5a4){while(--_0x4ae5a4){_0x2394bd['push'](_0x2394bd['shift']());}};_0x5c1a48(++_0x46fef1);}(_0x6381,0xcc));var _0x1638=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6381[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1638('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1638('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1638('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1638('0x3'));var path=require(_0x1638('0x4'));var sox=require(_0x1638('0x5'));var csv=require(_0x1638('0x6'));var ejs=require(_0x1638('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1638('0x8'));var crypto=require(_0x1638('0x9'));var jsforce=require(_0x1638('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1638('0x6'));var querystring=require(_0x1638('0xb'));var Papa=require(_0x1638('0xc'));var Redis=require('ioredis');var authService=require(_0x1638('0xd'));var qs=require(_0x1638('0xe'));var as=require(_0x1638('0xf'));var hardwareService=require(_0x1638('0x10'));var logger=require(_0x1638('0x11'))(_0x1638('0x12'));var utils=require(_0x1638('0x13'));var config=require(_0x1638('0x14'));var licenseUtil=require(_0x1638('0x15'));var db=require(_0x1638('0x16'))['db'];function respondWithStatusCode(_0x1246f1,_0x5e4549){_0x5e4549=_0x5e4549||0xcc;return function(_0x453c37){if(_0x453c37){return _0x1246f1[_0x1638('0x17')](_0x5e4549);}return _0x1246f1['status'](_0x5e4549)[_0x1638('0x18')]();};}function respondWithResult(_0x32dd13,_0x45dfaa){_0x45dfaa=_0x45dfaa||0xc8;return function(_0x3128a8){if(_0x3128a8){return _0x32dd13[_0x1638('0x19')](_0x45dfaa)[_0x1638('0x1a')](_0x3128a8);}};}function respondWithFilteredResult(_0x489ac3,_0x1eba1e){return function(_0x29ee7d){if(_0x29ee7d){var _0x26c68f=_0x29ee7d[_0x1638('0x1b')],_0x33b238=_0x1eba1e['offset'],_0x56e662=_0x1eba1e['offset']+_0x1eba1e['limit'],_0x47c79c;if(_0x56e662>=_0x26c68f){_0x56e662=_0x26c68f;_0x47c79c=0xc8;}else{_0x47c79c=0xce;}_0x489ac3[_0x1638('0x19')](_0x47c79c);return _0x489ac3[_0x1638('0x1c')](_0x1638('0x1d'),_0x33b238+'-'+_0x56e662+'/'+_0x26c68f)['json'](_0x29ee7d);}return null;};}function patchUpdates(_0x37e74c){return function(_0x288367){try{jsonpatch[_0x1638('0x1e')](_0x288367,_0x37e74c,!![]);}catch(_0x5d24dd){return BPromise[_0x1638('0x1f')](_0x5d24dd);}return _0x288367[_0x1638('0x20')]();};}function saveUpdates(_0xf85dc6,_0x369f08){return function(_0x2c13e0){if(_0x2c13e0){return _0x2c13e0[_0x1638('0x21')](_0xf85dc6)[_0x1638('0x22')](function(_0xf12a2f){return _0xf12a2f;});}return null;};}function removeEntity(_0xdd0df,_0x3cff9a){return function(_0x1f69c7){if(_0x1f69c7){return _0x1f69c7[_0x1638('0x23')]()[_0x1638('0x22')](function(){var _0x2c275c=_0x1f69c7['get']({'plain':!![]});var _0x5909e8=_0x1638('0x24');return db[_0x1638('0x25')][_0x1638('0x23')]({'where':{'type':_0x5909e8,'resourceId':_0x2c275c['id']}})[_0x1638('0x22')](function(){return _0x1f69c7;});})['then'](function(){_0xdd0df[_0x1638('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a0a9,_0x5695fc){return function(_0x567d92){if(!_0x567d92){_0x59a0a9[_0x1638('0x17')](0x194);}return _0x567d92;};}function handleError(_0x5ca3f3,_0x2e9b08){_0x2e9b08=_0x2e9b08||0x1f4;return function(_0x5c4dce){logger[_0x1638('0x26')](_0x5c4dce[_0x1638('0x27')]);if(_0x5c4dce[_0x1638('0x28')]){delete _0x5c4dce['name'];}_0x5ca3f3[_0x1638('0x19')](_0x2e9b08)[_0x1638('0x29')](_0x5c4dce);};}exports[_0x1638('0x2a')]=function(_0x5ade6b,_0x24a903){var _0x475ade={},_0x5d020d={},_0x11c38f={'count':0x0,'rows':[]};var _0x19d7ef=_[_0x1638('0x2b')](db['CmContactHasPhone']['rawAttributes'],function(_0x14f648){return{'name':_0x14f648[_0x1638('0x2c')],'type':_0x14f648[_0x1638('0x2d')][_0x1638('0x2e')]};});_0x5d020d[_0x1638('0x2f')]=_[_0x1638('0x2b')](_0x19d7ef,'name');_0x5d020d[_0x1638('0x30')]=_[_0x1638('0x31')](_0x5ade6b['query']);_0x5d020d[_0x1638('0x32')]=_[_0x1638('0x33')](_0x5d020d['model'],_0x5d020d[_0x1638('0x30')]);_0x475ade[_0x1638('0x34')]=_['intersection'](_0x5d020d[_0x1638('0x2f')],qs[_0x1638('0x35')](_0x5ade6b[_0x1638('0x30')][_0x1638('0x35')]));_0x475ade[_0x1638('0x34')]=_0x475ade['attributes']['length']?_0x475ade['attributes']:_0x5d020d[_0x1638('0x2f')];if(!_0x5ade6b['query'][_0x1638('0x36')](_0x1638('0x37'))){_0x475ade[_0x1638('0x38')]=qs[_0x1638('0x38')](_0x5ade6b[_0x1638('0x30')][_0x1638('0x38')]);_0x475ade['offset']=qs[_0x1638('0x39')](_0x5ade6b[_0x1638('0x30')][_0x1638('0x39')]);}_0x475ade[_0x1638('0x3a')]=qs[_0x1638('0x3b')](_0x5ade6b[_0x1638('0x30')][_0x1638('0x3b')]);_0x475ade[_0x1638('0x3c')]=qs[_0x1638('0x32')](_[_0x1638('0x3d')](_0x5ade6b[_0x1638('0x30')],_0x5d020d['filters']),_0x19d7ef);if(_0x5ade6b[_0x1638('0x30')][_0x1638('0x3e')]){_0x475ade['where']=_[_0x1638('0x3f')](_0x475ade[_0x1638('0x3c')],{'$or':_['map'](_0x19d7ef,function(_0x1928e4){if(_0x1928e4[_0x1638('0x2d')]!=='VIRTUAL'){var _0x27f254={};_0x27f254[_0x1928e4[_0x1638('0x28')]]={'$like':'%'+_0x5ade6b[_0x1638('0x30')]['filter']+'%'};return _0x27f254;}})});}_0x475ade=_['merge']({},_0x475ade,_0x5ade6b['options']);var _0x6edc69={'where':_0x475ade[_0x1638('0x3c')]};return db[_0x1638('0x40')]['count'](_0x6edc69)[_0x1638('0x22')](function(_0x4379dc){_0x11c38f[_0x1638('0x1b')]=_0x4379dc;if(_0x5ade6b['query']['includeAll']){_0x475ade[_0x1638('0x41')]=[{'all':!![]}];}return db[_0x1638('0x40')]['findAll'](_0x475ade);})[_0x1638('0x22')](function(_0x4d0c5c){_0x11c38f[_0x1638('0x42')]=_0x4d0c5c;return _0x11c38f;})[_0x1638('0x22')](respondWithFilteredResult(_0x24a903,_0x475ade))['catch'](handleError(_0x24a903,null));};exports[_0x1638('0x43')]=function(_0x1dc0b2,_0x503f14){var _0x58d24d={'raw':!![],'where':{'id':_0x1dc0b2[_0x1638('0x44')]['id']}},_0x11a7dc={};_0x11a7dc[_0x1638('0x2f')]=_[_0x1638('0x31')](db[_0x1638('0x40')][_0x1638('0x45')]);_0x11a7dc[_0x1638('0x30')]=_[_0x1638('0x31')](_0x1dc0b2[_0x1638('0x30')]);_0x11a7dc[_0x1638('0x32')]=_['intersection'](_0x11a7dc[_0x1638('0x2f')],_0x11a7dc[_0x1638('0x30')]);_0x58d24d[_0x1638('0x34')]=_[_0x1638('0x33')](_0x11a7dc[_0x1638('0x2f')],qs['fields'](_0x1dc0b2[_0x1638('0x30')][_0x1638('0x35')]));_0x58d24d[_0x1638('0x34')]=_0x58d24d[_0x1638('0x34')][_0x1638('0x46')]?_0x58d24d['attributes']:_0x11a7dc[_0x1638('0x2f')];if(_0x1dc0b2[_0x1638('0x30')][_0x1638('0x47')]){_0x58d24d[_0x1638('0x41')]=[{'all':!![]}];}_0x58d24d=_[_0x1638('0x3f')]({},_0x58d24d,_0x1dc0b2['options']);return db[_0x1638('0x40')][_0x1638('0x48')](_0x58d24d)[_0x1638('0x22')](handleEntityNotFound(_0x503f14,null))['then'](respondWithResult(_0x503f14,null))['catch'](handleError(_0x503f14,null));};exports[_0x1638('0x49')]=function(_0x51daad,_0x2219e2){return db['CmContactHasPhone'][_0x1638('0x49')](_0x51daad[_0x1638('0x4a')],{})[_0x1638('0x22')](function(_0x207be4){var _0xc1d9a3=_0x51daad[_0x1638('0x4b')][_0x1638('0x4c')]({'plain':!![]});if(!_0xc1d9a3)throw new Error(_0x1638('0x4d'));if(_0xc1d9a3[_0x1638('0x4e')]===_0x1638('0x4b')){var _0x449d9b=_0x207be4[_0x1638('0x4c')]({'plain':!![]});var _0x294932='CmContactHasPhones';return db[_0x1638('0x4f')][_0x1638('0x48')]({'where':{'name':_0x294932,'userProfileId':_0xc1d9a3['userProfileId']},'raw':!![]})['then'](function(_0x344919){if(_0x344919&&_0x344919[_0x1638('0x50')]===0x0){return db[_0x1638('0x25')][_0x1638('0x49')]({'name':_0x449d9b[_0x1638('0x28')],'resourceId':_0x449d9b['id'],'type':_0x344919[_0x1638('0x28')],'sectionId':_0x344919['id']},{})[_0x1638('0x22')](function(){return _0x207be4;});}else{return _0x207be4;}})[_0x1638('0x51')](function(_0x62d98d){logger['error'](_0x1638('0x52'),_0x62d98d);throw _0x62d98d;});}return _0x207be4;})['then'](respondWithResult(_0x2219e2,0xc9))[_0x1638('0x51')](handleError(_0x2219e2,null));};exports[_0x1638('0x21')]=function(_0x269730,_0x15c921){if(_0x269730[_0x1638('0x4a')]['id']){delete _0x269730['body']['id'];}return db[_0x1638('0x40')][_0x1638('0x48')]({'where':{'id':_0x269730[_0x1638('0x44')]['id']}})[_0x1638('0x22')](handleEntityNotFound(_0x15c921,null))[_0x1638('0x22')](saveUpdates(_0x269730['body'],null))[_0x1638('0x22')](respondWithResult(_0x15c921,null))[_0x1638('0x51')](handleError(_0x15c921,null));};exports[_0x1638('0x23')]=function(_0x52b172,_0x35fa31){return db['CmContactHasPhone'][_0x1638('0x48')]({'where':{'id':_0x52b172[_0x1638('0x44')]['id']}})['then'](handleEntityNotFound(_0x35fa31,null))[_0x1638('0x22')](removeEntity(_0x35fa31,null))[_0x1638('0x51')](handleError(_0x35fa31,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index feca35b..679a121 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5787=['path','rimraf','./cmContactHasPhone.attributes','exports','define','cm_contact_has_phones','lodash','util','api','moment'];(function(_0x26a0fd,_0x1a9315){var _0x8f9a20=function(_0x57d79f){while(--_0x57d79f){_0x26a0fd['push'](_0x26a0fd['shift']());}};_0x8f9a20(++_0x1a9315);}(_0x5787,0x9c));var _0x7578=function(_0xc056af,_0x20f7af){_0xc056af=_0xc056af-0x0;var _0x1ea72b=_0x5787[_0xc056af];return _0x1ea72b;};'use strict';var _=require(_0x7578('0x0'));var util=require(_0x7578('0x1'));var logger=require('../../config/logger')(_0x7578('0x2'));var moment=require(_0x7578('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7578('0x4'));var rimraf=require(_0x7578('0x5'));var config=require('../../config/environment');var attributes=require(_0x7578('0x6'));module[_0x7578('0x7')]=function(_0x126775,_0x114b1a){return _0x126775[_0x7578('0x8')]('CmContactHasPhone',attributes,{'tableName':_0x7578('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb205=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','cm_contact_has_phones'];(function(_0x10f846,_0x445c1b){var _0x118ce5=function(_0x505c7c){while(--_0x505c7c){_0x10f846['push'](_0x10f846['shift']());}};_0x118ce5(++_0x445c1b);}(_0xb205,0xcc));var _0x5b20=function(_0x555435,_0xce8d7d){_0x555435=_0x555435-0x0;var _0x48ebd0=_0xb205[_0x555435];return _0x48ebd0;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var logger=require(_0x5b20('0x2'))(_0x5b20('0x3'));var moment=require(_0x5b20('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b20('0x5'));var fs=require('fs');var path=require(_0x5b20('0x6'));var rimraf=require(_0x5b20('0x7'));var config=require(_0x5b20('0x8'));var attributes=require(_0x5b20('0x9'));module[_0x5b20('0xa')]=function(_0x287ac7,_0x51dc6e){return _0x287ac7['define']('CmContactHasPhone',attributes,{'tableName':_0x5b20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index 8fd626f..f2a6258 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8491=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x44c531,_0x156ecc){var _0x5ace97=function(_0x20c50c){while(--_0x20c50c){_0x44c531['push'](_0x44c531['shift']());}};_0x5ace97(++_0x156ecc);}(_0x8491,0xc5));var _0x1849=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x8491[_0x39d544];return _0x5a5ff2;};'use strict';var _=require('lodash');var util=require(_0x1849('0x0'));var moment=require(_0x1849('0x1'));var BPromise=require(_0x1849('0x2'));var rs=require(_0x1849('0x3'));var fs=require('fs');var Redis=require(_0x1849('0x4'));var db=require(_0x1849('0x5'))['db'];var utils=require(_0x1849('0x6'));var logger=require(_0x1849('0x7'))(_0x1849('0x8'));var config=require('../../config/environment');var jayson=require(_0x1849('0x9'));var client=jayson['client'][_0x1849('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x474b12,_0x23fe4d,_0x1e1f49){return new BPromise(function(_0x1c9d05,_0xa08afe){return client[_0x1849('0xb')](_0x474b12,_0x1e1f49)[_0x1849('0xc')](function(_0x359234){logger[_0x1849('0xd')](_0x1849('0xe'),_0x23fe4d,_0x1849('0xf'));logger['debug'](_0x1849('0x10'),_0x23fe4d,_0x1849('0xf'),JSON[_0x1849('0x11')](_0x359234));if(_0x359234[_0x1849('0x12')]){if(_0x359234[_0x1849('0x12')]['code']===0x1f4){logger[_0x1849('0x12')](_0x1849('0xe'),_0x23fe4d,_0x359234[_0x1849('0x12')]['message']);return _0xa08afe(_0x359234[_0x1849('0x12')][_0x1849('0x13')]);}logger[_0x1849('0x12')](_0x1849('0xe'),_0x23fe4d,_0x359234[_0x1849('0x12')][_0x1849('0x13')]);return _0x1c9d05(_0x359234['error'][_0x1849('0x13')]);}else{logger[_0x1849('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x23fe4d,_0x1849('0xf'));_0x1c9d05(_0x359234[_0x1849('0x14')]['message']);}})[_0x1849('0x15')](function(_0x535172){logger[_0x1849('0x12')](_0x1849('0xe'),_0x23fe4d,_0x535172);_0xa08afe(_0x535172);});});} \ No newline at end of file +var _0xc84c=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc84c,0x12f));var _0xcc84=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xc84c[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0xcc84('0x0'));var util=require(_0xcc84('0x1'));var moment=require(_0xcc84('0x2'));var BPromise=require(_0xcc84('0x3'));var rs=require(_0xcc84('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc84('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc84('0x6'))(_0xcc84('0x7'));var config=require(_0xcc84('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30030b,_0x54fc2b,_0x8daa1f){return new BPromise(function(_0x2635c4,_0x45c5cc){return client[_0xcc84('0xa')](_0x30030b,_0x8daa1f)[_0xcc84('0xb')](function(_0x58e08f){logger['info'](_0xcc84('0xc'),_0x54fc2b,_0xcc84('0xd'));logger[_0xcc84('0xe')](_0xcc84('0xf'),_0x54fc2b,_0xcc84('0xd'),JSON[_0xcc84('0x10')](_0x58e08f));if(_0x58e08f[_0xcc84('0x11')]){if(_0x58e08f[_0xcc84('0x11')]['code']===0x1f4){logger[_0xcc84('0x11')]('CmContactHasPhone,\x20%s,\x20%s',_0x54fc2b,_0x58e08f[_0xcc84('0x11')][_0xcc84('0x12')]);return _0x45c5cc(_0x58e08f[_0xcc84('0x11')]['message']);}logger[_0xcc84('0x11')]('CmContactHasPhone,\x20%s,\x20%s',_0x54fc2b,_0x58e08f['error']['message']);return _0x2635c4(_0x58e08f['error'][_0xcc84('0x12')]);}else{logger[_0xcc84('0x13')](_0xcc84('0xc'),_0x54fc2b,_0xcc84('0xd'));_0x2635c4(_0x58e08f[_0xcc84('0x14')][_0xcc84('0x12')]);}})[_0xcc84('0x15')](function(_0x334ec8){logger[_0xcc84('0x11')](_0xcc84('0xc'),_0x54fc2b,_0x334ec8);_0x45c5cc(_0x334ec8);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 67bee64..e00da70 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc822=['./cmContactHasPhone.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5eb6d6,_0x1ba078){var _0x1a623a=function(_0x56af9a){while(--_0x56af9a){_0x5eb6d6['push'](_0x5eb6d6['shift']());}};_0x1a623a(++_0x1ba078);}(_0xc822,0x12c));var _0x2c82=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xc822[_0x117f4c];return _0x2b24e9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2c82('0x0'));var express=require(_0x2c82('0x1'));var router=express[_0x2c82('0x2')]();var auth=require(_0x2c82('0x3'));var interaction=require(_0x2c82('0x4'));var config=require(_0x2c82('0x5'));var controller=require(_0x2c82('0x6'));router['get']('/',auth[_0x2c82('0x7')](),controller[_0x2c82('0x8')]);router[_0x2c82('0x9')](_0x2c82('0xa'),auth[_0x2c82('0x7')](),controller[_0x2c82('0xb')]);router[_0x2c82('0xc')]('/',auth['isAuthenticated'](),controller[_0x2c82('0xd')]);router[_0x2c82('0xe')](_0x2c82('0xa'),auth['isAuthenticated'](),controller[_0x2c82('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2c82('0x10')]);module[_0x2c82('0x11')]=router; \ No newline at end of file +var _0xcd91=['index','/:id','show','post','create','put','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcd91,0x139));var _0x1cd9=function(_0x39dd57,_0x4ef720){_0x39dd57=_0x39dd57-0x0;var _0x25171a=_0xcd91[_0x39dd57];return _0x25171a;};'use strict';var multer=require('multer');var util=require(_0x1cd9('0x0'));var path=require(_0x1cd9('0x1'));var timeout=require(_0x1cd9('0x2'));var express=require(_0x1cd9('0x3'));var router=express[_0x1cd9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cd9('0x5'));var config=require(_0x1cd9('0x6'));var controller=require(_0x1cd9('0x7'));router[_0x1cd9('0x8')]('/',auth[_0x1cd9('0x9')](),controller[_0x1cd9('0xa')]);router[_0x1cd9('0x8')](_0x1cd9('0xb'),auth[_0x1cd9('0x9')](),controller[_0x1cd9('0xc')]);router[_0x1cd9('0xd')]('/',auth['isAuthenticated'](),controller[_0x1cd9('0xe')]);router[_0x1cd9('0xf')](_0x1cd9('0xb'),auth[_0x1cd9('0x9')](),controller['update']);router['delete'](_0x1cd9('0xb'),auth[_0x1cd9('0x9')](),controller[_0x1cd9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 5a7d865..f8195fa 100644 --- a/server/api/cmCustomField/cmCustomField.attributes.js +++ b/server/api/cmCustomField/cmCustomField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31af=['alias','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue','STRING','setDataValue'];(function(_0x467a5e,_0x41e636){var _0x56cb05=function(_0x19eaa1){while(--_0x19eaa1){_0x467a5e['push'](_0x467a5e['shift']());}};_0x56cb05(++_0x41e636);}(_0x31af,0xde));var _0xf31a=function(_0x244d13,_0x491499){_0x244d13=_0x244d13-0x0;var _0x1e2559=_0x31af[_0x244d13];return _0x1e2559;};'use strict';var Sequelize=require(_0xf31a('0x0'));var _=require(_0xf31a('0x1'));module[_0xf31a('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5f5639){return this[_0xf31a('0x3')]('alias');}},'alias':{'type':Sequelize[_0xf31a('0x4')],'allowNull':![],'set':function(_0x1853d7){this[_0xf31a('0x5')](_0xf31a('0x6'),_0x1853d7?_0x1853d7:this['getDataValue'](_0xf31a('0x7')));}},'type':{'type':Sequelize[_0xf31a('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xf31a('0x8')](_0xf31a('0x9')),'get':function(){if(this['getDataValue'](_0xf31a('0xa'))===_0xf31a('0xb')){return JSON[_0xf31a('0xc')](this[_0xf31a('0x3')]('values'));}else{return this[_0xf31a('0x3')](_0xf31a('0xd'));}},'set':function(_0xcff55c){if(Array[_0xf31a('0xe')](_0xcff55c)){this[_0xf31a('0x5')]('values',JSON[_0xf31a('0xf')](_0xcff55c));}else{this[_0xf31a('0x5')](_0xf31a('0xd'),_0xcff55c);}}},'required':{'type':Sequelize[_0xf31a('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf31a('0x11')](_0xf31a('0x12'))}}; \ No newline at end of file +var _0xa41a=['values','isArray','ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','type','parse'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa41a,0x6b));var _0xaa41=function(_0x33c2b8,_0x2645ea){_0x33c2b8=_0x33c2b8-0x0;var _0x4ccb39=_0xa41a[_0x33c2b8];return _0x4ccb39;};'use strict';var Sequelize=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));module['exports']={'name':{'type':Sequelize[_0xaa41('0x2')],'get':function(_0x2a96ba){return this[_0xaa41('0x3')](_0xaa41('0x4'));}},'alias':{'type':Sequelize[_0xaa41('0x5')],'allowNull':![],'set':function(_0x3168be){this[_0xaa41('0x6')](_0xaa41('0x4'),_0x3168be?_0x3168be:this['getDataValue'](_0xaa41('0x7')));}},'type':{'type':Sequelize[_0xaa41('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xaa41('0x3')](_0xaa41('0x8'))==='select'){return JSON[_0xaa41('0x9')](this[_0xaa41('0x3')](_0xaa41('0xa')));}else{return this[_0xaa41('0x3')](_0xaa41('0xa'));}},'set':function(_0x38d930){if(Array[_0xaa41('0xb')](_0x38d930)){this[_0xaa41('0x6')](_0xaa41('0xa'),JSON['stringify'](_0x38d930));}else{this[_0xaa41('0x6')](_0xaa41('0xa'),_0x38d930);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xaa41('0xc')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 01a5987..9443007 100644 --- a/server/api/cmCustomField/cmCustomField.controller.js +++ b/server/api/cmCustomField/cmCustomField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14c7=['order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','body','create','sequelize','transaction','TEXT','number','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','CmCustomField','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x1e2a87,_0x534515){var _0xb88a8d=function(_0x7701f0){while(--_0x7701f0){_0x1e2a87['push'](_0x1e2a87['shift']());}};_0xb88a8d(++_0x534515);}(_0x14c7,0x1d0));var _0x714c=function(_0x291cd9,_0xb7af64){_0x291cd9=_0x291cd9-0x0;var _0x59ddcd=_0x14c7[_0x291cd9];return _0x59ddcd;};'use strict';var pdf=require(_0x714c('0x0'));var emlformat=require(_0x714c('0x1'));var rimraf=require(_0x714c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x714c('0x3'));var rp=require(_0x714c('0x4'));var moment=require('moment');var BPromise=require(_0x714c('0x5'));var Mustache=require(_0x714c('0x6'));var util=require(_0x714c('0x7'));var path=require(_0x714c('0x8'));var sox=require(_0x714c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x714c('0xa'));var crypto=require(_0x714c('0xb'));var jsforce=require(_0x714c('0xc'));var deskjs=require(_0x714c('0xd'));var toCsv=require(_0x714c('0xe'));var querystring=require(_0x714c('0xf'));var Papa=require(_0x714c('0x10'));var Redis=require(_0x714c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x714c('0x12'));var hardwareService=require(_0x714c('0x13'));var logger=require('../../config/logger')(_0x714c('0x14'));var utils=require(_0x714c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x714c('0x16'))['db'];function respondWithStatusCode(_0x211d92,_0x3298fa){_0x3298fa=_0x3298fa||0xcc;return function(_0x2d49f5){if(_0x2d49f5){return _0x211d92[_0x714c('0x17')](_0x3298fa);}return _0x211d92[_0x714c('0x18')](_0x3298fa)['end']();};}function respondWithResult(_0x3f8eff,_0x32e91f){_0x32e91f=_0x32e91f||0xc8;return function(_0x1b4efc){if(_0x1b4efc){return _0x3f8eff[_0x714c('0x18')](_0x32e91f)[_0x714c('0x19')](_0x1b4efc);}};}function respondWithFilteredResult(_0xb92767,_0x384f82){return function(_0x24ad8a){if(_0x24ad8a){var _0x40fe65=_0x24ad8a[_0x714c('0x1a')],_0xe6edaf=_0x384f82['offset'],_0x5adb06=_0x384f82[_0x714c('0x1b')]+_0x384f82[_0x714c('0x1c')],_0x59294b;if(_0x5adb06>=_0x40fe65){_0x5adb06=_0x40fe65;_0x59294b=0xc8;}else{_0x59294b=0xce;}_0xb92767[_0x714c('0x18')](_0x59294b);return _0xb92767[_0x714c('0x1d')](_0x714c('0x1e'),_0xe6edaf+'-'+_0x5adb06+'/'+_0x40fe65)[_0x714c('0x19')](_0x24ad8a);}return null;};}function patchUpdates(_0x239b39){return function(_0x4ffaf3){try{jsonpatch['apply'](_0x4ffaf3,_0x239b39,!![]);}catch(_0x7ca220){return BPromise[_0x714c('0x1f')](_0x7ca220);}return _0x4ffaf3['save']();};}function saveUpdates(_0x463a7b,_0x100a2f){return function(_0x371cbe){if(_0x371cbe){return _0x371cbe[_0x714c('0x20')](_0x463a7b)['then'](function(_0x1f7644){return _0x1f7644;});}return null;};}function removeEntity(_0x48e490,_0xd6f705){return function(_0x2077e6){if(_0x2077e6){return _0x2077e6[_0x714c('0x21')]()[_0x714c('0x22')](function(){_0x48e490[_0x714c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4df049,_0x4f525b){return function(_0x317e2e){if(!_0x317e2e){_0x4df049[_0x714c('0x17')](0x194);}return _0x317e2e;};}function handleError(_0x616dcf,_0x5b8d8d){_0x5b8d8d=_0x5b8d8d||0x1f4;return function(_0x1c2ce4){logger[_0x714c('0x23')](_0x1c2ce4[_0x714c('0x24')]);if(_0x1c2ce4['name']){delete _0x1c2ce4[_0x714c('0x25')];}_0x616dcf[_0x714c('0x18')](_0x5b8d8d)[_0x714c('0x26')](_0x1c2ce4);};}exports[_0x714c('0x27')]=function(_0x9c1b38,_0x2b8d43){var _0x1a3c6b={},_0x40bf4f={},_0x3fe06f={'count':0x0,'rows':[]};var _0x4a4569=_['map'](db[_0x714c('0x28')]['rawAttributes'],function(_0xefc51c){return{'name':_0xefc51c[_0x714c('0x29')],'type':_0xefc51c['type'][_0x714c('0x2a')]};});_0x40bf4f[_0x714c('0x2b')]=_['differenceBy'](_[_0x714c('0x2c')](_0x4a4569,'name'),[_0x714c('0x25')]);_0x40bf4f['query']=_[_0x714c('0x2d')](_0x9c1b38[_0x714c('0x2e')]);_0x40bf4f['filters']=_[_0x714c('0x2f')](_0x40bf4f[_0x714c('0x2b')],_0x40bf4f[_0x714c('0x2e')]);_0x1a3c6b[_0x714c('0x30')]=_[_0x714c('0x2f')](_0x40bf4f[_0x714c('0x2b')],qs[_0x714c('0x31')](_0x9c1b38['query'][_0x714c('0x31')]));_0x1a3c6b[_0x714c('0x30')]=_0x1a3c6b[_0x714c('0x30')]['length']?_0x1a3c6b[_0x714c('0x30')]:_0x40bf4f['model'];if(!_0x9c1b38[_0x714c('0x2e')][_0x714c('0x32')](_0x714c('0x33'))){_0x1a3c6b[_0x714c('0x1c')]=qs[_0x714c('0x1c')](_0x9c1b38[_0x714c('0x2e')][_0x714c('0x1c')]);_0x1a3c6b[_0x714c('0x1b')]=qs[_0x714c('0x1b')](_0x9c1b38[_0x714c('0x2e')]['offset']);}_0x1a3c6b[_0x714c('0x34')]=qs['sort'](_0x9c1b38['query'][_0x714c('0x35')]);_0x1a3c6b[_0x714c('0x36')]=qs[_0x714c('0x37')](_[_0x714c('0x38')](_0x9c1b38[_0x714c('0x2e')],_0x40bf4f[_0x714c('0x37')]),_0x4a4569);if(_0x9c1b38[_0x714c('0x2e')][_0x714c('0x39')]){_0x1a3c6b[_0x714c('0x36')]=_['merge'](_0x1a3c6b[_0x714c('0x36')],{'$or':_[_0x714c('0x2c')](_0x4a4569,function(_0x434e6e){if(_0x434e6e[_0x714c('0x3a')]!==_0x714c('0x3b')){var _0x1ee4b8={};_0x1ee4b8[_0x434e6e[_0x714c('0x25')]]={'$like':'%'+_0x9c1b38[_0x714c('0x2e')]['filter']+'%'};return _0x1ee4b8;}})});}_0x1a3c6b=_[_0x714c('0x3c')]({},_0x1a3c6b,_0x9c1b38[_0x714c('0x3d')]);var _0x579050={'where':_0x1a3c6b[_0x714c('0x36')]};return db[_0x714c('0x28')][_0x714c('0x1a')](_0x579050)[_0x714c('0x22')](function(_0x3d57fe){_0x3fe06f[_0x714c('0x1a')]=_0x3d57fe;if(_0x9c1b38[_0x714c('0x2e')][_0x714c('0x3e')]){_0x1a3c6b['include']=[{'all':!![]}];}return db[_0x714c('0x28')][_0x714c('0x3f')](_0x1a3c6b);})[_0x714c('0x22')](function(_0x3c5cfd){_0x3fe06f[_0x714c('0x40')]=_0x3c5cfd;return _0x3fe06f;})[_0x714c('0x22')](respondWithFilteredResult(_0x2b8d43,_0x1a3c6b))[_0x714c('0x41')](handleError(_0x2b8d43,null));};exports[_0x714c('0x42')]=function(_0x75d3f9,_0x568e3c){var _0x2954d4={'raw':!![],'where':{'id':_0x75d3f9[_0x714c('0x43')]['id']}},_0x3f29f4={};_0x3f29f4[_0x714c('0x2b')]=_[_0x714c('0x2d')](db[_0x714c('0x28')]['rawAttributes']);_0x3f29f4['query']=_[_0x714c('0x2d')](_0x75d3f9[_0x714c('0x2e')]);_0x3f29f4[_0x714c('0x37')]=_[_0x714c('0x2f')](_0x3f29f4[_0x714c('0x2b')],_0x3f29f4[_0x714c('0x2e')]);_0x2954d4[_0x714c('0x30')]=_[_0x714c('0x2f')](_0x3f29f4[_0x714c('0x2b')],qs[_0x714c('0x31')](_0x75d3f9['query'][_0x714c('0x31')]));_0x2954d4[_0x714c('0x30')]=_0x2954d4[_0x714c('0x30')][_0x714c('0x44')]?_0x2954d4[_0x714c('0x30')]:_0x3f29f4[_0x714c('0x2b')];if(_0x75d3f9[_0x714c('0x2e')][_0x714c('0x3e')]){_0x2954d4[_0x714c('0x45')]=[{'all':!![]}];}_0x2954d4=_[_0x714c('0x3c')]({},_0x2954d4,_0x75d3f9[_0x714c('0x3d')]);return db[_0x714c('0x28')][_0x714c('0x46')](_0x2954d4)[_0x714c('0x22')](handleEntityNotFound(_0x568e3c,null))[_0x714c('0x22')](respondWithResult(_0x568e3c,null))[_0x714c('0x41')](handleError(_0x568e3c,null));};exports[_0x714c('0x20')]=function(_0x3b6fbd,_0x3c0bd8){if(_0x3b6fbd['body']['id']){delete _0x3b6fbd[_0x714c('0x47')]['id'];}return db[_0x714c('0x28')][_0x714c('0x46')]({'where':{'id':_0x3b6fbd[_0x714c('0x43')]['id']}})[_0x714c('0x22')](handleEntityNotFound(_0x3c0bd8,null))[_0x714c('0x22')](saveUpdates(_0x3b6fbd['body'],null))['then'](respondWithResult(_0x3c0bd8,null))[_0x714c('0x41')](handleError(_0x3c0bd8,null));};exports['destroy']=function(_0x4e2cb2,_0x49f6d2){return db[_0x714c('0x28')]['find']({'where':{'id':_0x4e2cb2[_0x714c('0x43')]['id']}})[_0x714c('0x22')](handleEntityNotFound(_0x49f6d2,null))[_0x714c('0x22')](removeEntity(_0x49f6d2,null))['catch'](handleError(_0x49f6d2,null));};exports[_0x714c('0x48')]=function(_0x4394a3,_0x420404){var _0x541a97;return db[_0x714c('0x49')][_0x714c('0x4a')](function(_0x6c5275){return db['CmCustomField'][_0x714c('0x48')](_0x4394a3[_0x714c('0x47')],{'transaction':_0x6c5275})['then'](function(_0xccaa17){_0x541a97=_0xccaa17;var _0x3b5d93={'type':db['Sequelize'][_0x714c('0x4b')],'transaction':_0x6c5275};switch(_0x4394a3['body'][_0x714c('0x3a')]){case'text':_0x3b5d93[_0x714c('0x3a')]=db['Sequelize'][_0x714c('0x4b')];break;case _0x714c('0x4c'):_0x3b5d93[_0x714c('0x3a')]=db[_0x714c('0x4d')][_0x714c('0x4e')];break;case _0x714c('0x4f'):_0x3b5d93['type']=db['Sequelize'][_0x714c('0x50')];_0x3b5d93[_0x714c('0x51')]=![];break;default:}return db['sequelize'][_0x714c('0x52')]['addColumn'](_0x714c('0x53'),util[_0x714c('0x54')](_0x714c('0x55'),_0x541a97['id']),_0x3b5d93);})[_0x714c('0x22')](function(){return _0x541a97;});})['then'](respondWithResult(_0x420404,0xc9))['catch'](handleError(_0x420404,null));}; \ No newline at end of file +var _0xbbaf=['request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmCustomField','includeAll','findAll','rows','catch','show','params','keys','find','update','body','destroy','create','sequelize','transaction','Sequelize','TEXT','defaultValue','queryInterface','cm_contacts','format','cf_%d','html-pdf','eml-format','fast-json-patch'];(function(_0x2515a3,_0x356de5){var _0xe8bbb=function(_0x18876b){while(--_0x18876b){_0x2515a3['push'](_0x2515a3['shift']());}};_0xe8bbb(++_0x356de5);}(_0xbbaf,0x19c));var _0xfbba=function(_0x423160,_0x5bcb1){_0x423160=_0x423160-0x0;var _0x4683ce=_0xbbaf[_0x423160];return _0x4683ce;};'use strict';var pdf=require(_0xfbba('0x0'));var emlformat=require(_0xfbba('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfbba('0x2'));var rp=require(_0xfbba('0x3'));var moment=require(_0xfbba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfbba('0x5'));var util=require(_0xfbba('0x6'));var path=require('path');var sox=require(_0xfbba('0x7'));var csv=require(_0xfbba('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfbba('0x9'));var squel=require('squel');var crypto=require(_0xfbba('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfbba('0xb'));var toCsv=require(_0xfbba('0x8'));var querystring=require(_0xfbba('0xc'));var Papa=require(_0xfbba('0xd'));var Redis=require(_0xfbba('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfbba('0xf'));var as=require(_0xfbba('0x10'));var hardwareService=require(_0xfbba('0x11'));var logger=require(_0xfbba('0x12'))(_0xfbba('0x13'));var utils=require(_0xfbba('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfbba('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9901,_0x4129ee){_0x4129ee=_0x4129ee||0xcc;return function(_0x2759c1){if(_0x2759c1){return _0x3c9901[_0xfbba('0x16')](_0x4129ee);}return _0x3c9901['status'](_0x4129ee)[_0xfbba('0x17')]();};}function respondWithResult(_0x456075,_0x5a95d2){_0x5a95d2=_0x5a95d2||0xc8;return function(_0x549f07){if(_0x549f07){return _0x456075[_0xfbba('0x18')](_0x5a95d2)[_0xfbba('0x19')](_0x549f07);}};}function respondWithFilteredResult(_0x5626ab,_0x33967a){return function(_0x328c73){if(_0x328c73){var _0x2f0dc8=_0x328c73[_0xfbba('0x1a')],_0x5b8276=_0x33967a[_0xfbba('0x1b')],_0x3fea2a=_0x33967a['offset']+_0x33967a[_0xfbba('0x1c')],_0x53d5fa;if(_0x3fea2a>=_0x2f0dc8){_0x3fea2a=_0x2f0dc8;_0x53d5fa=0xc8;}else{_0x53d5fa=0xce;}_0x5626ab['status'](_0x53d5fa);return _0x5626ab[_0xfbba('0x1d')](_0xfbba('0x1e'),_0x5b8276+'-'+_0x3fea2a+'/'+_0x2f0dc8)[_0xfbba('0x19')](_0x328c73);}return null;};}function patchUpdates(_0x2c8c02){return function(_0x557470){try{jsonpatch[_0xfbba('0x1f')](_0x557470,_0x2c8c02,!![]);}catch(_0x13d41b){return BPromise[_0xfbba('0x20')](_0x13d41b);}return _0x557470[_0xfbba('0x21')]();};}function saveUpdates(_0x5d365a,_0x59aa94){return function(_0x1298b1){if(_0x1298b1){return _0x1298b1['update'](_0x5d365a)['then'](function(_0x1f05e3){return _0x1f05e3;});}return null;};}function removeEntity(_0x5a88a9,_0x259734){return function(_0x17d51e){if(_0x17d51e){return _0x17d51e['destroy']()[_0xfbba('0x22')](function(){_0x5a88a9[_0xfbba('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42dec6,_0x202a1c){return function(_0x1f14fe){if(!_0x1f14fe){_0x42dec6[_0xfbba('0x16')](0x194);}return _0x1f14fe;};}function handleError(_0x42201b,_0x1c5fe2){_0x1c5fe2=_0x1c5fe2||0x1f4;return function(_0x5b31b8){logger[_0xfbba('0x23')](_0x5b31b8['stack']);if(_0x5b31b8[_0xfbba('0x24')]){delete _0x5b31b8[_0xfbba('0x24')];}_0x42201b[_0xfbba('0x18')](_0x1c5fe2)[_0xfbba('0x25')](_0x5b31b8);};}exports[_0xfbba('0x26')]=function(_0x40ad6e,_0x1d6e3b){var _0x524e69={},_0x24e6fd={},_0x4c8ee7={'count':0x0,'rows':[]};var _0x31a46e=_[_0xfbba('0x27')](db['CmCustomField'][_0xfbba('0x28')],function(_0x408577){return{'name':_0x408577[_0xfbba('0x29')],'type':_0x408577[_0xfbba('0x2a')][_0xfbba('0x2b')]};});_0x24e6fd[_0xfbba('0x2c')]=_[_0xfbba('0x2d')](_[_0xfbba('0x27')](_0x31a46e,_0xfbba('0x24')),['name']);_0x24e6fd[_0xfbba('0x2e')]=_['keys'](_0x40ad6e['query']);_0x24e6fd[_0xfbba('0x2f')]=_['intersection'](_0x24e6fd[_0xfbba('0x2c')],_0x24e6fd['query']);_0x524e69['attributes']=_[_0xfbba('0x30')](_0x24e6fd[_0xfbba('0x2c')],qs[_0xfbba('0x31')](_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x31')]));_0x524e69[_0xfbba('0x32')]=_0x524e69[_0xfbba('0x32')][_0xfbba('0x33')]?_0x524e69[_0xfbba('0x32')]:_0x24e6fd[_0xfbba('0x2c')];if(!_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x34')](_0xfbba('0x35'))){_0x524e69[_0xfbba('0x1c')]=qs[_0xfbba('0x1c')](_0x40ad6e['query'][_0xfbba('0x1c')]);_0x524e69[_0xfbba('0x1b')]=qs['offset'](_0x40ad6e['query'][_0xfbba('0x1b')]);}_0x524e69['order']=qs['sort'](_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x36')]);_0x524e69[_0xfbba('0x37')]=qs[_0xfbba('0x2f')](_[_0xfbba('0x38')](_0x40ad6e['query'],_0x24e6fd['filters']),_0x31a46e);if(_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x39')]){_0x524e69['where']=_[_0xfbba('0x3a')](_0x524e69['where'],{'$or':_[_0xfbba('0x27')](_0x31a46e,function(_0x4f8b24){if(_0x4f8b24[_0xfbba('0x2a')]!==_0xfbba('0x3b')){var _0x178cf1={};_0x178cf1[_0x4f8b24['name']]={'$like':'%'+_0x40ad6e[_0xfbba('0x2e')]['filter']+'%'};return _0x178cf1;}})});}_0x524e69=_[_0xfbba('0x3a')]({},_0x524e69,_0x40ad6e[_0xfbba('0x3c')]);var _0x55ef08={'where':_0x524e69[_0xfbba('0x37')]};return db[_0xfbba('0x3d')][_0xfbba('0x1a')](_0x55ef08)[_0xfbba('0x22')](function(_0x326e88){_0x4c8ee7[_0xfbba('0x1a')]=_0x326e88;if(_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x3e')]){_0x524e69['include']=[{'all':!![]}];}return db[_0xfbba('0x3d')][_0xfbba('0x3f')](_0x524e69);})[_0xfbba('0x22')](function(_0x244706){_0x4c8ee7[_0xfbba('0x40')]=_0x244706;return _0x4c8ee7;})[_0xfbba('0x22')](respondWithFilteredResult(_0x1d6e3b,_0x524e69))[_0xfbba('0x41')](handleError(_0x1d6e3b,null));};exports[_0xfbba('0x42')]=function(_0x350b89,_0x1b747d){var _0x2d57ec={'raw':!![],'where':{'id':_0x350b89[_0xfbba('0x43')]['id']}},_0x159bec={};_0x159bec[_0xfbba('0x2c')]=_[_0xfbba('0x44')](db[_0xfbba('0x3d')]['rawAttributes']);_0x159bec[_0xfbba('0x2e')]=_[_0xfbba('0x44')](_0x350b89[_0xfbba('0x2e')]);_0x159bec[_0xfbba('0x2f')]=_[_0xfbba('0x30')](_0x159bec[_0xfbba('0x2c')],_0x159bec[_0xfbba('0x2e')]);_0x2d57ec[_0xfbba('0x32')]=_['intersection'](_0x159bec[_0xfbba('0x2c')],qs[_0xfbba('0x31')](_0x350b89[_0xfbba('0x2e')][_0xfbba('0x31')]));_0x2d57ec['attributes']=_0x2d57ec[_0xfbba('0x32')][_0xfbba('0x33')]?_0x2d57ec[_0xfbba('0x32')]:_0x159bec[_0xfbba('0x2c')];if(_0x350b89[_0xfbba('0x2e')]['includeAll']){_0x2d57ec['include']=[{'all':!![]}];}_0x2d57ec=_['merge']({},_0x2d57ec,_0x350b89[_0xfbba('0x3c')]);return db['CmCustomField'][_0xfbba('0x45')](_0x2d57ec)[_0xfbba('0x22')](handleEntityNotFound(_0x1b747d,null))[_0xfbba('0x22')](respondWithResult(_0x1b747d,null))[_0xfbba('0x41')](handleError(_0x1b747d,null));};exports[_0xfbba('0x46')]=function(_0x424ea1,_0x2100a7){if(_0x424ea1[_0xfbba('0x47')]['id']){delete _0x424ea1[_0xfbba('0x47')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x424ea1[_0xfbba('0x43')]['id']}})['then'](handleEntityNotFound(_0x2100a7,null))['then'](saveUpdates(_0x424ea1['body'],null))[_0xfbba('0x22')](respondWithResult(_0x2100a7,null))[_0xfbba('0x41')](handleError(_0x2100a7,null));};exports[_0xfbba('0x48')]=function(_0x4bc325,_0x43ad38){return db[_0xfbba('0x3d')]['find']({'where':{'id':_0x4bc325[_0xfbba('0x43')]['id']}})[_0xfbba('0x22')](handleEntityNotFound(_0x43ad38,null))[_0xfbba('0x22')](removeEntity(_0x43ad38,null))['catch'](handleError(_0x43ad38,null));};exports[_0xfbba('0x49')]=function(_0x4b9b54,_0x43e83a){var _0x190a08;return db[_0xfbba('0x4a')][_0xfbba('0x4b')](function(_0x4a8d1f){return db[_0xfbba('0x3d')][_0xfbba('0x49')](_0x4b9b54[_0xfbba('0x47')],{'transaction':_0x4a8d1f})['then'](function(_0x489a0d){_0x190a08=_0x489a0d;var _0x141863={'type':db[_0xfbba('0x4c')][_0xfbba('0x4d')],'transaction':_0x4a8d1f};switch(_0x4b9b54[_0xfbba('0x47')]['type']){case'text':_0x141863['type']=db[_0xfbba('0x4c')]['TEXT'];break;case'number':_0x141863[_0xfbba('0x2a')]=db[_0xfbba('0x4c')]['INTEGER'];break;case'switch':_0x141863[_0xfbba('0x2a')]=db[_0xfbba('0x4c')]['BOOLEAN'];_0x141863[_0xfbba('0x4e')]=![];break;default:}return db[_0xfbba('0x4a')][_0xfbba('0x4f')]['addColumn'](_0xfbba('0x50'),util[_0xfbba('0x51')](_0xfbba('0x52'),_0x190a08['id']),_0x141863);})[_0xfbba('0x22')](function(){return _0x190a08;});})['then'](respondWithResult(_0x43e83a,0xc9))['catch'](handleError(_0x43e83a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 816d968..8081b04 100644 --- a/server/api/cmCustomField/cmCustomField.model.js +++ b/server/api/cmCustomField/cmCustomField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49c1=['../../config/environment','./cmCustomField.attributes','exports','CmCustomField','lodash','api','moment','bluebird','path','rimraf'];(function(_0x90e575,_0x48c2ec){var _0x1aae60=function(_0x4e40cf){while(--_0x4e40cf){_0x90e575['push'](_0x90e575['shift']());}};_0x1aae60(++_0x48c2ec);}(_0x49c1,0x16c));var _0x149c=function(_0x3d2e55,_0x50722d){_0x3d2e55=_0x3d2e55-0x0;var _0x2f60c7=_0x49c1[_0x3d2e55];return _0x2f60c7;};'use strict';var _=require(_0x149c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x149c('0x1'));var moment=require(_0x149c('0x2'));var BPromise=require(_0x149c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x149c('0x4'));var rimraf=require(_0x149c('0x5'));var config=require(_0x149c('0x6'));var attributes=require(_0x149c('0x7'));module[_0x149c('0x8')]=function(_0x1e0630,_0x2ab65d){return _0x1e0630['define'](_0x149c('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe75a=['api','moment','request-promise','path','rimraf','define','CmCustomField','util','../../config/logger'];(function(_0x46c11a,_0x4ad31f){var _0x314398=function(_0x51acde){while(--_0x51acde){_0x46c11a['push'](_0x46c11a['shift']());}};_0x314398(++_0x4ad31f);}(_0xe75a,0x115));var _0xae75=function(_0x12efa0,_0x579590){_0x12efa0=_0x12efa0-0x0;var _0x158c02=_0xe75a[_0x12efa0];return _0x158c02;};'use strict';var _=require('lodash');var util=require(_0xae75('0x0'));var logger=require(_0xae75('0x1'))(_0xae75('0x2'));var moment=require(_0xae75('0x3'));var BPromise=require('bluebird');var rp=require(_0xae75('0x4'));var fs=require('fs');var path=require(_0xae75('0x5'));var rimraf=require(_0xae75('0x6'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x3e7f3d,_0x25bd3f){return _0x3e7f3d[_0xae75('0x7')](_0xae75('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index e0c65e3..88ddaca 100644 --- a/server/api/cmCustomField/cmCustomField.rpc.js +++ b/server/api/cmCustomField/cmCustomField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a9a=['CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x5d50d7,_0x339501){var _0x4acb68=function(_0x6bd7a8){while(--_0x6bd7a8){_0x5d50d7['push'](_0x5d50d7['shift']());}};_0x4acb68(++_0x339501);}(_0x0a9a,0x183));var _0xa0a9=function(_0x3cee3b,_0x4ae05a){_0x3cee3b=_0x3cee3b-0x0;var _0xc96e26=_0x0a9a[_0x3cee3b];return _0xc96e26;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1cc3ce,_0x43791e){var _0x4ac6ac=function(_0x15d789){while(--_0x15d789){_0x1cc3ce['push'](_0x1cc3ce['shift']());}};_0x4ac6ac(++_0x43791e);}(_0xe14d,0x1ee));var _0xde14=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xe14d[_0x373dee];return _0x46798f;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('CmCustomField,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index f9b456c..ea290c8 100644 --- a/server/api/cmCustomField/index.js +++ b/server/api/cmCustomField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0936=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','create','put','update','delete'];(function(_0x36585d,_0x24d96e){var _0x450532=function(_0x16908e){while(--_0x16908e){_0x36585d['push'](_0x36585d['shift']());}};_0x450532(++_0x24d96e);}(_0x0936,0xde));var _0x6093=function(_0x425549,_0x28fdba){_0x425549=_0x425549-0x0;var _0x52c0f1=_0x0936[_0x425549];return _0x52c0f1;};'use strict';var multer=require(_0x6093('0x0'));var util=require(_0x6093('0x1'));var path=require(_0x6093('0x2'));var timeout=require(_0x6093('0x3'));var express=require(_0x6093('0x4'));var router=express[_0x6093('0x5')]();var auth=require(_0x6093('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6093('0x7'));router[_0x6093('0x8')]('/',auth[_0x6093('0x9')](),controller[_0x6093('0xa')]);router[_0x6093('0x8')](_0x6093('0xb'),auth[_0x6093('0x9')](),controller['show']);router['post']('/',auth[_0x6093('0x9')](),controller[_0x6093('0xc')]);router[_0x6093('0xd')](_0x6093('0xb'),auth[_0x6093('0x9')](),controller[_0x6093('0xe')]);router[_0x6093('0xf')](_0x6093('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6093('0x10')]=router; \ No newline at end of file +var _0x1794=['Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x532693,_0x3a46c9){var _0x57299c=function(_0x504240){while(--_0x504240){_0x532693['push'](_0x532693['shift']());}};_0x57299c(++_0x3a46c9);}(_0x1794,0x165));var _0x4179=function(_0x251bb9,_0x13345c){_0x251bb9=_0x251bb9-0x0;var _0x31dd3f=_0x1794[_0x251bb9];return _0x31dd3f;};'use strict';var multer=require(_0x4179('0x0'));var util=require(_0x4179('0x1'));var path=require('path');var timeout=require(_0x4179('0x2'));var express=require(_0x4179('0x3'));var router=express[_0x4179('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4179('0x5'));var config=require(_0x4179('0x6'));var controller=require(_0x4179('0x7'));router[_0x4179('0x8')]('/',auth[_0x4179('0x9')](),controller[_0x4179('0xa')]);router['get'](_0x4179('0xb'),auth[_0x4179('0x9')](),controller[_0x4179('0xc')]);router[_0x4179('0xd')]('/',auth['isAuthenticated'](),controller[_0x4179('0xe')]);router['put'](_0x4179('0xb'),auth[_0x4179('0x9')](),controller[_0x4179('0xf')]);router[_0x4179('0x10')](_0x4179('0xb'),auth['isAuthenticated'](),controller[_0x4179('0x11')]);module[_0x4179('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6de9b98..db80486 100644 --- a/server/api/cmHopper/cmHopper.attributes.js +++ b/server/api/cmHopper/cmHopper.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x277c=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x277c,0x153));var _0xc277=function(_0x1be979,_0x57c9b7){_0x1be979=_0x1be979-0x0;var _0x100bae=_0x277c[_0x1be979];return _0x100bae;};'use strict';var moment=require(_0xc277('0x0'));var Sequelize=require('sequelize');module[_0xc277('0x1')]={'phone':{'type':Sequelize[_0xc277('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc277('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc277('0x4')],'defaultValue':moment()[_0xc277('0x5')](_0xc277('0x6'))},'countbusyretry':{'type':Sequelize[_0xc277('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc277('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc277('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xc277('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc277('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc277('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xc277('0x7')],'unique':_0xc277('0x8')},'UserId':{'type':Sequelize[_0xc277('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xc277('0x7')],'unique':_0xc277('0x8')},'CampaignId':{'type':Sequelize[_0xc277('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc277('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc277('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc277('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c5a=['format','INTEGER','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3471c5,_0x51fc11){_0x3471c5=_0x3471c5-0x0;var _0x417ed5=_0x9c5a[_0x3471c5];return _0x417ed5;};'use strict';var moment=require(_0xa9c5('0x0'));var Sequelize=require(_0xa9c5('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa9c5('0x4')],'defaultValue':moment()[_0xa9c5('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa9c5('0x4')]},'priority':{'type':Sequelize[_0xa9c5('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa9c5('0x6')],'unique':_0xa9c5('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa9c5('0x7')},'UserId':{'type':Sequelize[_0xa9c5('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa9c5('0x7')},'CampaignId':{'type':Sequelize[_0xa9c5('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 83edf09..96faba8 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf82=['isEmpty','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','Contact','CmCompany','Company','CmList','List','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','CmHopper','rawAttributes','type','key','query','keys','filters','intersection','model','concat','$and','$or','$gt','$gte','$lt','$lte','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','update','describe','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','sequelize','transaction','direction','prev'];(function(_0x44bf06,_0x438393){var _0x36585f=function(_0x5b054d){while(--_0x5b054d){_0x44bf06['push'](_0x44bf06['shift']());}};_0x36585f(++_0x438393);}(_0xbf82,0x1cb));var _0x2bf8=function(_0x511721,_0x8d7cc9){_0x511721=_0x511721-0x0;var _0x1443a9=_0xbf82[_0x511721];return _0x1443a9;};'use strict';var pdf=require(_0x2bf8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2bf8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2bf8('0x2'));var rp=require(_0x2bf8('0x3'));var moment=require(_0x2bf8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2bf8('0x5'));var path=require(_0x2bf8('0x6'));var sox=require(_0x2bf8('0x7'));var csv=require(_0x2bf8('0x8'));var ejs=require(_0x2bf8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2bf8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2bf8('0xb'));var toCsv=require(_0x2bf8('0x8'));var querystring=require(_0x2bf8('0xc'));var Papa=require('papaparse');var Redis=require(_0x2bf8('0xd'));var authService=require(_0x2bf8('0xe'));var qs=require(_0x2bf8('0xf'));var as=require(_0x2bf8('0x10'));var hardwareService=require(_0x2bf8('0x11'));var logger=require(_0x2bf8('0x12'))(_0x2bf8('0x13'));var utils=require(_0x2bf8('0x14'));var config=require(_0x2bf8('0x15'));var licenseUtil=require(_0x2bf8('0x16'));var db=require(_0x2bf8('0x17'))['db'];function respondWithStatusCode(_0x4f7e24,_0x2898a6){_0x2898a6=_0x2898a6||0xcc;return function(_0x5c02da){if(_0x5c02da){return _0x4f7e24[_0x2bf8('0x18')](_0x2898a6);}return _0x4f7e24['status'](_0x2898a6)['end']();};}function respondWithResult(_0x29aa8e,_0x16631e){_0x16631e=_0x16631e||0xc8;return function(_0xcfe46c){if(_0xcfe46c){return _0x29aa8e[_0x2bf8('0x19')](_0x16631e)[_0x2bf8('0x1a')](_0xcfe46c);}};}function respondWithFilteredResult(_0x4d0e33,_0x5302cd){return function(_0x169260){if(_0x169260){var _0x3816ac=_0x169260[_0x2bf8('0x1b')],_0x405e72=_0x5302cd[_0x2bf8('0x1c')],_0x5427c5=_0x5302cd[_0x2bf8('0x1c')]+_0x5302cd['limit'],_0x15c040;if(_0x5427c5>=_0x3816ac){_0x5427c5=_0x3816ac;_0x15c040=0xc8;}else{_0x15c040=0xce;}_0x4d0e33[_0x2bf8('0x19')](_0x15c040);return _0x4d0e33[_0x2bf8('0x1d')](_0x2bf8('0x1e'),_0x405e72+'-'+_0x5427c5+'/'+_0x3816ac)[_0x2bf8('0x1a')](_0x169260);}return null;};}function patchUpdates(_0x1e92e7){return function(_0x511a8f){try{jsonpatch[_0x2bf8('0x1f')](_0x511a8f,_0x1e92e7,!![]);}catch(_0x2b8760){return BPromise[_0x2bf8('0x20')](_0x2b8760);}return _0x511a8f[_0x2bf8('0x21')]();};}function saveUpdates(_0x174c59,_0x42f58a){return function(_0x4ea3ae){if(_0x4ea3ae){return _0x4ea3ae['update'](_0x174c59)[_0x2bf8('0x22')](function(_0x425031){return _0x425031;});}return null;};}function removeEntity(_0x2ad5bf,_0x1490cd){return function(_0x19baa7){if(_0x19baa7){return _0x19baa7[_0x2bf8('0x23')]()[_0x2bf8('0x22')](function(){_0x2ad5bf['status'](0xcc)[_0x2bf8('0x24')]();});}};}function handleEntityNotFound(_0x3991db,_0xe96c7){return function(_0x2d4dd7){if(!_0x2d4dd7){_0x3991db['sendStatus'](0x194);}return _0x2d4dd7;};}function handleError(_0x1a6a20,_0x3f1b2a){_0x3f1b2a=_0x3f1b2a||0x1f4;return function(_0x73d18e){logger[_0x2bf8('0x25')](_0x73d18e['stack']);if(_0x73d18e['name']){delete _0x73d18e[_0x2bf8('0x26')];}_0x1a6a20[_0x2bf8('0x19')](_0x3f1b2a)[_0x2bf8('0x27')](_0x73d18e);};}exports[_0x2bf8('0x28')]=function(_0x342942,_0xcdd84d){var _0x2ea1d6={},_0xb02fa3={},_0x4cc13d={'count':0x0,'rows':[]};var _0x117821=_[_0x2bf8('0x29')](db[_0x2bf8('0x2a')][_0x2bf8('0x2b')],function(_0x5b5b50){return{'name':_0x5b5b50['fieldName'],'type':_0x5b5b50[_0x2bf8('0x2c')][_0x2bf8('0x2d')]};});_0xb02fa3['model']=_[_0x2bf8('0x29')](_0x117821,_0x2bf8('0x26'));_0xb02fa3[_0x2bf8('0x2e')]=_[_0x2bf8('0x2f')](_0x342942[_0x2bf8('0x2e')]);_0xb02fa3[_0x2bf8('0x30')]=_[_0x2bf8('0x31')](_0xb02fa3[_0x2bf8('0x32')],_0xb02fa3['query']);_0xb02fa3[_0x2bf8('0x30')]=_[_0x2bf8('0x33')](_0xb02fa3[_0x2bf8('0x30')],[_0x2bf8('0x34'),_0x2bf8('0x35'),_0x2bf8('0x36'),_0x2bf8('0x37'),_0x2bf8('0x38'),_0x2bf8('0x39'),'$ne','$eq',_0x2bf8('0x3a'),'$between',_0x2bf8('0x3b'),_0x2bf8('0x3c'),_0x2bf8('0x3d'),_0x2bf8('0x3e'),_0x2bf8('0x3f'),_0x2bf8('0x40'),_0x2bf8('0x41'),_0x2bf8('0x3e'),_0x2bf8('0x42'),_0x2bf8('0x43'),_0x2bf8('0x44'),'$any']);_0x2ea1d6[_0x2bf8('0x45')]=_[_0x2bf8('0x31')](_0xb02fa3[_0x2bf8('0x32')],qs['fields'](_0x342942[_0x2bf8('0x2e')][_0x2bf8('0x46')]));_0x2ea1d6[_0x2bf8('0x45')]=_0x2ea1d6[_0x2bf8('0x45')][_0x2bf8('0x47')]?_0x2ea1d6['attributes']:_0xb02fa3[_0x2bf8('0x32')];if(!_0x342942[_0x2bf8('0x2e')][_0x2bf8('0x48')](_0x2bf8('0x49'))){_0x2ea1d6[_0x2bf8('0x4a')]=qs['limit'](_0x342942[_0x2bf8('0x2e')][_0x2bf8('0x4a')]);_0x2ea1d6[_0x2bf8('0x1c')]=qs[_0x2bf8('0x1c')](_0x342942['query'][_0x2bf8('0x1c')]);}_0x2ea1d6[_0x2bf8('0x4b')]=qs[_0x2bf8('0x4c')](_0x342942[_0x2bf8('0x2e')][_0x2bf8('0x4c')]);_0x2ea1d6['where']=qs[_0x2bf8('0x30')](_['pick'](_0x342942[_0x2bf8('0x2e')],_0xb02fa3[_0x2bf8('0x30')]),_0x117821);if(_0x342942[_0x2bf8('0x2e')]['filter']){_0x2ea1d6[_0x2bf8('0x4d')]=_['merge'](_0x2ea1d6[_0x2bf8('0x4d')],{'$or':_[_0x2bf8('0x29')](_0x117821,function(_0xbeaf1e){if(_0xbeaf1e[_0x2bf8('0x2c')]!==_0x2bf8('0x4e')){var _0x5b6a75={};_0x5b6a75[_0xbeaf1e[_0x2bf8('0x26')]]={'$like':'%'+_0x342942[_0x2bf8('0x2e')][_0x2bf8('0x4f')]+'%'};return _0x5b6a75;}})});}_0x2ea1d6=_[_0x2bf8('0x50')]({},_0x2ea1d6,_0x342942[_0x2bf8('0x51')]);var _0x13dc5a={'where':_0x2ea1d6[_0x2bf8('0x4d')]};return db[_0x2bf8('0x2a')]['count'](_0x13dc5a)[_0x2bf8('0x22')](function(_0x93c7b0){_0x4cc13d[_0x2bf8('0x1b')]=_0x93c7b0;if(_0x342942[_0x2bf8('0x2e')][_0x2bf8('0x52')]){_0x2ea1d6[_0x2bf8('0x53')]=[{'all':!![]}];}return db[_0x2bf8('0x2a')][_0x2bf8('0x54')](_0x2ea1d6);})[_0x2bf8('0x22')](function(_0x75ec7){_0x4cc13d[_0x2bf8('0x55')]=_0x75ec7;return _0x4cc13d;})[_0x2bf8('0x22')](respondWithFilteredResult(_0xcdd84d,_0x2ea1d6))[_0x2bf8('0x56')](handleError(_0xcdd84d,null));};exports[_0x2bf8('0x57')]=function(_0x202e41,_0xc5675e){var _0x34bc4a={'raw':!![],'where':{'id':_0x202e41[_0x2bf8('0x58')]['id']}},_0x5ba47f={};_0x5ba47f[_0x2bf8('0x32')]=_[_0x2bf8('0x2f')](db[_0x2bf8('0x2a')][_0x2bf8('0x2b')]);_0x5ba47f[_0x2bf8('0x2e')]=_['keys'](_0x202e41['query']);_0x5ba47f['filters']=_['intersection'](_0x5ba47f[_0x2bf8('0x32')],_0x5ba47f[_0x2bf8('0x2e')]);_0x34bc4a[_0x2bf8('0x45')]=_['intersection'](_0x5ba47f[_0x2bf8('0x32')],qs[_0x2bf8('0x46')](_0x202e41['query'][_0x2bf8('0x46')]));_0x34bc4a[_0x2bf8('0x45')]=_0x34bc4a[_0x2bf8('0x45')][_0x2bf8('0x47')]?_0x34bc4a['attributes']:_0x5ba47f[_0x2bf8('0x32')];if(_0x202e41['query'][_0x2bf8('0x52')]){_0x34bc4a['include']=[{'all':!![]}];}_0x34bc4a=_[_0x2bf8('0x50')]({},_0x34bc4a,_0x202e41[_0x2bf8('0x51')]);return db[_0x2bf8('0x2a')][_0x2bf8('0x59')](_0x34bc4a)[_0x2bf8('0x22')](handleEntityNotFound(_0xc5675e,null))[_0x2bf8('0x22')](respondWithResult(_0xc5675e,null))[_0x2bf8('0x56')](handleError(_0xc5675e,null));};exports['create']=function(_0x362f32,_0x3989c9){return db[_0x2bf8('0x2a')]['create'](_0x362f32[_0x2bf8('0x5a')],{})[_0x2bf8('0x22')](respondWithResult(_0x3989c9,0xc9))[_0x2bf8('0x56')](handleError(_0x3989c9,null));};exports[_0x2bf8('0x5b')]=function(_0x12e615,_0x3d29cb){if(_0x12e615[_0x2bf8('0x5a')]['id']){delete _0x12e615['body']['id'];}return db['CmHopper'][_0x2bf8('0x59')]({'where':{'id':_0x12e615[_0x2bf8('0x58')]['id']}})[_0x2bf8('0x22')](handleEntityNotFound(_0x3d29cb,null))[_0x2bf8('0x22')](saveUpdates(_0x12e615['body'],null))['then'](respondWithResult(_0x3d29cb,null))[_0x2bf8('0x56')](handleError(_0x3d29cb,null));};exports[_0x2bf8('0x5c')]=function(_0x8c1500,_0x439bb8){return db['CmHopper'][_0x2bf8('0x5c')]()[_0x2bf8('0x22')](respondWithResult(_0x439bb8,null))[_0x2bf8('0x56')](handleError(_0x439bb8,null));};exports['destroy']=function(_0x2a3668,_0xe8fe31){var _0x1829f7;return db[_0x2bf8('0x2a')][_0x2bf8('0x59')]({'where':{'id':_0x2a3668['params']['id']}})[_0x2bf8('0x22')](handleEntityNotFound(_0xe8fe31,null))[_0x2bf8('0x22')](function(_0x40a4e1){if(_0x40a4e1){return _0x40a4e1[_0x2bf8('0x23')]()[_0x2bf8('0x22')](function(_0x1e58ab){return _0x1e58ab;});}})[_0x2bf8('0x22')](function(_0x2010bc){_0x1829f7=_0x2010bc;if(_0x2010bc){if(_0x2010bc['VoiceQueueId']||_0x2010bc[_0x2bf8('0x5d')]){return db[_0x2010bc[_0x2bf8('0x5e')]?_0x2bf8('0x5f'):_0x2bf8('0x60')][_0x2bf8('0x59')]({'where':{'id':_0x2010bc[_0x2bf8('0x5e')]?_0x2010bc[_0x2bf8('0x5e')]:_0x2010bc['CampaignId']},'attributes':['id',_0x2bf8('0x26')],'raw':!![]});}}})['then'](function(_0x36ac54){var _0xfcb446={};if(_0x36ac54){_['merge'](_0xfcb446,_[_0x2bf8('0x61')](_0x1829f7[_0x2bf8('0x62')],[_0x2bf8('0x63'),'updatedAt','id']));_0xfcb446['state']=0x15;_0xfcb446['statedesc']=_0x2bf8('0x64');_0xfcb446['campaign']=_0x36ac54[_0x2bf8('0x26')];_0xfcb446[_0x2bf8('0x65')]=_0x2a3668[_0x2bf8('0x66')]['name'];_0xfcb446[_0x2bf8('0x67')]=_0x2a3668[_0x2bf8('0x66')]['id'];_0xfcb446[_0x2bf8('0x64')]=!![];_0xfcb446[_0x2bf8('0x68')]=moment()[_0x2bf8('0x69')](_0x2bf8('0x6a'));_0xfcb446[_0x2bf8('0x6b')]=_0x1829f7['phone'];_0xfcb446[_0x2bf8('0x6c')]=_0x1829f7[_0x2bf8('0x5e')]?_0x2bf8('0x6d'):'ivr';return db[_0x2bf8('0x6e')][_0x2bf8('0x59')]({'where':{'id':_0xfcb446['ContactId']},'attributes':['firstName',_0x2bf8('0x6f')]})['then'](function(_0x380367){if(!_['isNil'](_0xe8fe31)&&!_[_0x2bf8('0x70')](_0x380367[_0x2bf8('0x71')])){_0xfcb446['calleridname']=_0x380367[_0x2bf8('0x71')];if(!_[_0x2bf8('0x70')](_0x380367['lastName'])){_0xfcb446[_0x2bf8('0x72')]+='\x20'+_0x380367[_0x2bf8('0x6f')];}}})[_0x2bf8('0x73')](function(){return db[_0x2bf8('0x74')]['create'](_0xfcb446);});}})[_0x2bf8('0x22')](function(){return _0xe8fe31[_0x2bf8('0x19')](0xcc)['end']();})[_0x2bf8('0x56')](handleError(_0xe8fe31,null));};exports[_0x2bf8('0x75')]=function(_0x2b8c29,_0x40ee63,_0x1d204b){var _0x418fec=[];return db['CmContact'][_0x2bf8('0x5c')]()[_0x2bf8('0x22')](function(_0x109398){_0x418fec=_[_0x2bf8('0x2f')](_0x109398);return _0x2b8c29[_0x2bf8('0x66')][_0x2bf8('0x76')]({'where':{'type':_0x2bf8('0x77'),'dialActive':!![],'dialMethod':_0x2bf8('0x78')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x2bf8('0x22')](function(_0x1f9f55){if(_0x1f9f55&&_0x1f9f55['length']){return db[_0x2bf8('0x79')][_0x2bf8('0x7a')](function(_0x5e25bf){var _0x2f2484={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x2bf8('0x6a'))},'VoiceQueueId':{'$in':_['map'](_0x1f9f55,'id')},'$or':[{'UserId':null},{'UserId':_0x2b8c29[_0x2bf8('0x66')]['id']}]};var _0x2d0a82=[];if(_0x2b8c29['body'][_0x2bf8('0x7b')]&&_0x2b8c29[_0x2bf8('0x5a')][_0x2bf8('0x7b')]===_0x2bf8('0x7c')){if(!_[_0x2bf8('0x7d')](_0x2b8c29[_0x2bf8('0x5a')][_0x2bf8('0x7e')])){_0x2f2484['id']={'$in':_0x2b8c29[_0x2bf8('0x5a')][_0x2bf8('0x7e')]};}_0x2d0a82=[['priority',_0x2bf8('0x7f')],[_0x2bf8('0x80'),_0x1f9f55[0x0][_0x2bf8('0x81')]===_0x2bf8('0x7f')?_0x2bf8('0x82'):'ASC'],db[_0x2bf8('0x79')][_0x2bf8('0x83')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x2bf8('0x82')]];}else{if(!_[_0x2bf8('0x7d')](_0x2b8c29[_0x2bf8('0x5a')][_0x2bf8('0x7e')])){_0x2f2484['id']={'$notIn':_0x2b8c29[_0x2bf8('0x5a')]['hopperIds']};}_0x2d0a82=[[_0x2bf8('0x84'),_0x2bf8('0x82')],[_0x2bf8('0x80'),_0x1f9f55[0x0][_0x2bf8('0x81')]],db[_0x2bf8('0x79')][_0x2bf8('0x83')](_0x2bf8('0x85')),['id','ASC']];}return db[_0x2bf8('0x2a')]['findOne']({'attributes':['id',_0x2bf8('0x86')],'where':_0x2f2484,'order':_0x2d0a82,'transaction':_0x5e25bf,'lock':_0x5e25bf[_0x2bf8('0x87')]['UPDATE'],'include':[{'model':db[_0x2bf8('0x6e')],'as':_0x2bf8('0x88'),'attributes':_0x418fec,'include':[{'model':db[_0x2bf8('0x89')],'as':_0x2bf8('0x8a'),'attributes':['id',_0x2bf8('0x26')]}]},{'model':db[_0x2bf8('0x8b')],'as':_0x2bf8('0x8c'),'attributes':['id',_0x2bf8('0x26')]},{'model':db[_0x2bf8('0x5f')],'as':'Queue','attributes':['id',_0x2bf8('0x26'),_0x2bf8('0x8d')]}]})[_0x2bf8('0x22')](function(_0x38ae30){if(_0x38ae30){return _0x38ae30[_0x2bf8('0x5b')]({'UserId':_0x2b8c29[_0x2bf8('0x66')]['id']},{'transaction':_0x5e25bf});}});});}})['then'](handleEntityNotFound(_0x40ee63,null))[_0x2bf8('0x22')](respondWithResult(_0x40ee63,null))[_0x2bf8('0x56')](handleError(_0x40ee63,null));};exports[_0x2bf8('0x8e')]=function(_0x43c43f,_0x3a1e15,_0x544533){return _0x43c43f[_0x2bf8('0x66')]['getVoiceQueues']({'where':{'type':_0x2bf8('0x77'),'dialActive':!![],'dialMethod':_0x2bf8('0x78')},'attributes':['id'],'raw':!![]})[_0x2bf8('0x22')](function(_0x427799){if(_0x427799&&_0x427799['length']){return db[_0x2bf8('0x2a')][_0x2bf8('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x2bf8('0x6a'))},'VoiceQueueId':{'$in':_['map'](_0x427799,'id')},'$or':[{'UserId':null},{'UserId':_0x43c43f['user']['id']}]}});}return 0x0;})['then'](function(_0x11547d){if(!_[_0x2bf8('0x70')](_0x11547d)&&_[_0x2bf8('0x8f')](_0x11547d)){return _0x3a1e15[_0x2bf8('0x19')](0xc8)['json']({'contacts':_0x11547d});}else{logger[_0x2bf8('0x25')](_0x2bf8('0x90'),_0x2bf8('0x8e'),0x194,_0x2bf8('0x91'));_0x3a1e15[_0x2bf8('0x18')](0x194);}})['catch'](handleError(_0x3a1e15,null));}; \ No newline at end of file +var _0xaa1b=['entity\x20not\x20found','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','intersection','filters','concat','$or','$gt','$gte','$lt','$ne','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','direction','isEmpty','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmList','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s'];(function(_0x121bfa,_0x1d1be0){var _0x28ae89=function(_0x1404f7){while(--_0x1404f7){_0x121bfa['push'](_0x121bfa['shift']());}};_0x28ae89(++_0x1d1be0);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xbaa1('0x0'));var emlformat=require(_0xbaa1('0x1'));var rimraf=require(_0xbaa1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbaa1('0x3'));var rp=require('request-promise');var moment=require(_0xbaa1('0x4'));var BPromise=require(_0xbaa1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbaa1('0x6'));var csv=require(_0xbaa1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbaa1('0x8'));var squel=require('squel');var crypto=require(_0xbaa1('0x9'));var jsforce=require(_0xbaa1('0xa'));var deskjs=require(_0xbaa1('0xb'));var toCsv=require(_0xbaa1('0x7'));var querystring=require(_0xbaa1('0xc'));var Papa=require(_0xbaa1('0xd'));var Redis=require('ioredis');var authService=require(_0xbaa1('0xe'));var qs=require(_0xbaa1('0xf'));var as=require(_0xbaa1('0x10'));var hardwareService=require(_0xbaa1('0x11'));var logger=require(_0xbaa1('0x12'))(_0xbaa1('0x13'));var utils=require(_0xbaa1('0x14'));var config=require(_0xbaa1('0x15'));var licenseUtil=require(_0xbaa1('0x16'));var db=require(_0xbaa1('0x17'))['db'];function respondWithStatusCode(_0x8ce72d,_0x1376c6){_0x1376c6=_0x1376c6||0xcc;return function(_0x5064a4){if(_0x5064a4){return _0x8ce72d['sendStatus'](_0x1376c6);}return _0x8ce72d['status'](_0x1376c6)['end']();};}function respondWithResult(_0x2184ab,_0x388cfd){_0x388cfd=_0x388cfd||0xc8;return function(_0x3bfbcc){if(_0x3bfbcc){return _0x2184ab[_0xbaa1('0x18')](_0x388cfd)[_0xbaa1('0x19')](_0x3bfbcc);}};}function respondWithFilteredResult(_0x2e7db5,_0x30f191){return function(_0xdbaa8b){if(_0xdbaa8b){var _0x35a3fd=_0xdbaa8b[_0xbaa1('0x1a')],_0x2a0c0b=_0x30f191[_0xbaa1('0x1b')],_0x37c862=_0x30f191[_0xbaa1('0x1b')]+_0x30f191[_0xbaa1('0x1c')],_0x42f360;if(_0x37c862>=_0x35a3fd){_0x37c862=_0x35a3fd;_0x42f360=0xc8;}else{_0x42f360=0xce;}_0x2e7db5[_0xbaa1('0x18')](_0x42f360);return _0x2e7db5[_0xbaa1('0x1d')](_0xbaa1('0x1e'),_0x2a0c0b+'-'+_0x37c862+'/'+_0x35a3fd)['json'](_0xdbaa8b);}return null;};}function patchUpdates(_0x10bfd3){return function(_0x3e3f4a){try{jsonpatch[_0xbaa1('0x1f')](_0x3e3f4a,_0x10bfd3,!![]);}catch(_0x2f18f7){return BPromise[_0xbaa1('0x20')](_0x2f18f7);}return _0x3e3f4a[_0xbaa1('0x21')]();};}function saveUpdates(_0x5c2115,_0x1c587c){return function(_0x451255){if(_0x451255){return _0x451255[_0xbaa1('0x22')](_0x5c2115)[_0xbaa1('0x23')](function(_0x3b2f53){return _0x3b2f53;});}return null;};}function removeEntity(_0x5a7d21,_0x4e4a0c){return function(_0x2b01ec){if(_0x2b01ec){return _0x2b01ec[_0xbaa1('0x24')]()[_0xbaa1('0x23')](function(){_0x5a7d21[_0xbaa1('0x18')](0xcc)[_0xbaa1('0x25')]();});}};}function handleEntityNotFound(_0x113bbd,_0x4806e7){return function(_0x243eeb){if(!_0x243eeb){_0x113bbd[_0xbaa1('0x26')](0x194);}return _0x243eeb;};}function handleError(_0x28e508,_0x353730){_0x353730=_0x353730||0x1f4;return function(_0x1204f4){logger[_0xbaa1('0x27')](_0x1204f4[_0xbaa1('0x28')]);if(_0x1204f4[_0xbaa1('0x29')]){delete _0x1204f4[_0xbaa1('0x29')];}_0x28e508['status'](_0x353730)[_0xbaa1('0x2a')](_0x1204f4);};}exports[_0xbaa1('0x2b')]=function(_0xd2cae3,_0x2913ae){var _0x109187={},_0x422925={},_0x594578={'count':0x0,'rows':[]};var _0x49803c=_[_0xbaa1('0x2c')](db[_0xbaa1('0x2d')][_0xbaa1('0x2e')],function(_0x48cbc0){return{'name':_0x48cbc0[_0xbaa1('0x2f')],'type':_0x48cbc0[_0xbaa1('0x30')]['key']};});_0x422925[_0xbaa1('0x31')]=_['map'](_0x49803c,_0xbaa1('0x29'));_0x422925[_0xbaa1('0x32')]=_[_0xbaa1('0x33')](_0xd2cae3['query']);_0x422925['filters']=_[_0xbaa1('0x34')](_0x422925[_0xbaa1('0x31')],_0x422925[_0xbaa1('0x32')]);_0x422925[_0xbaa1('0x35')]=_[_0xbaa1('0x36')](_0x422925[_0xbaa1('0x35')],['$and',_0xbaa1('0x37'),_0xbaa1('0x38'),_0xbaa1('0x39'),_0xbaa1('0x3a'),'$lte',_0xbaa1('0x3b'),'$eq',_0xbaa1('0x3c'),_0xbaa1('0x3d'),_0xbaa1('0x3e'),_0xbaa1('0x3f'),'$notIn',_0xbaa1('0x40'),_0xbaa1('0x41'),_0xbaa1('0x42'),'$notILike',_0xbaa1('0x40'),_0xbaa1('0x43'),'$contains',_0xbaa1('0x44'),_0xbaa1('0x45')]);_0x109187[_0xbaa1('0x46')]=_['intersection'](_0x422925[_0xbaa1('0x31')],qs['fields'](_0xd2cae3['query'][_0xbaa1('0x47')]));_0x109187['attributes']=_0x109187[_0xbaa1('0x46')][_0xbaa1('0x48')]?_0x109187[_0xbaa1('0x46')]:_0x422925['model'];if(!_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x49')]('nolimit')){_0x109187[_0xbaa1('0x1c')]=qs[_0xbaa1('0x1c')](_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x1c')]);_0x109187[_0xbaa1('0x1b')]=qs[_0xbaa1('0x1b')](_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x1b')]);}_0x109187['order']=qs[_0xbaa1('0x4a')](_0xd2cae3['query'][_0xbaa1('0x4a')]);_0x109187[_0xbaa1('0x4b')]=qs[_0xbaa1('0x35')](_['pick'](_0xd2cae3[_0xbaa1('0x32')],_0x422925['filters']),_0x49803c);if(_0xd2cae3['query'][_0xbaa1('0x4c')]){_0x109187[_0xbaa1('0x4b')]=_[_0xbaa1('0x4d')](_0x109187['where'],{'$or':_['map'](_0x49803c,function(_0x22f533){if(_0x22f533[_0xbaa1('0x30')]!==_0xbaa1('0x4e')){var _0x2443e3={};_0x2443e3[_0x22f533[_0xbaa1('0x29')]]={'$like':'%'+_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x4c')]+'%'};return _0x2443e3;}})});}_0x109187=_[_0xbaa1('0x4d')]({},_0x109187,_0xd2cae3[_0xbaa1('0x4f')]);var _0x36b72b={'where':_0x109187[_0xbaa1('0x4b')]};return db[_0xbaa1('0x2d')][_0xbaa1('0x1a')](_0x36b72b)[_0xbaa1('0x23')](function(_0x509e8f){_0x594578['count']=_0x509e8f;if(_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x50')]){_0x109187[_0xbaa1('0x51')]=[{'all':!![]}];}return db[_0xbaa1('0x2d')][_0xbaa1('0x52')](_0x109187);})[_0xbaa1('0x23')](function(_0x3a6ec7){_0x594578[_0xbaa1('0x53')]=_0x3a6ec7;return _0x594578;})['then'](respondWithFilteredResult(_0x2913ae,_0x109187))[_0xbaa1('0x54')](handleError(_0x2913ae,null));};exports[_0xbaa1('0x55')]=function(_0x2aae88,_0x2b4d2c){var _0x32e527={'raw':!![],'where':{'id':_0x2aae88['params']['id']}},_0x164244={};_0x164244['model']=_[_0xbaa1('0x33')](db['CmHopper'][_0xbaa1('0x2e')]);_0x164244[_0xbaa1('0x32')]=_[_0xbaa1('0x33')](_0x2aae88['query']);_0x164244[_0xbaa1('0x35')]=_[_0xbaa1('0x34')](_0x164244[_0xbaa1('0x31')],_0x164244[_0xbaa1('0x32')]);_0x32e527[_0xbaa1('0x46')]=_['intersection'](_0x164244['model'],qs[_0xbaa1('0x47')](_0x2aae88[_0xbaa1('0x32')][_0xbaa1('0x47')]));_0x32e527[_0xbaa1('0x46')]=_0x32e527[_0xbaa1('0x46')][_0xbaa1('0x48')]?_0x32e527[_0xbaa1('0x46')]:_0x164244[_0xbaa1('0x31')];if(_0x2aae88[_0xbaa1('0x32')][_0xbaa1('0x50')]){_0x32e527[_0xbaa1('0x51')]=[{'all':!![]}];}_0x32e527=_['merge']({},_0x32e527,_0x2aae88[_0xbaa1('0x4f')]);return db[_0xbaa1('0x2d')][_0xbaa1('0x56')](_0x32e527)[_0xbaa1('0x23')](handleEntityNotFound(_0x2b4d2c,null))[_0xbaa1('0x23')](respondWithResult(_0x2b4d2c,null))[_0xbaa1('0x54')](handleError(_0x2b4d2c,null));};exports[_0xbaa1('0x57')]=function(_0x5bdc78,_0x25ccab){return db[_0xbaa1('0x2d')]['create'](_0x5bdc78[_0xbaa1('0x58')],{})[_0xbaa1('0x23')](respondWithResult(_0x25ccab,0xc9))[_0xbaa1('0x54')](handleError(_0x25ccab,null));};exports[_0xbaa1('0x22')]=function(_0x4fd674,_0x3808e3){if(_0x4fd674['body']['id']){delete _0x4fd674[_0xbaa1('0x58')]['id'];}return db[_0xbaa1('0x2d')][_0xbaa1('0x56')]({'where':{'id':_0x4fd674[_0xbaa1('0x59')]['id']}})['then'](handleEntityNotFound(_0x3808e3,null))[_0xbaa1('0x23')](saveUpdates(_0x4fd674[_0xbaa1('0x58')],null))[_0xbaa1('0x23')](respondWithResult(_0x3808e3,null))[_0xbaa1('0x54')](handleError(_0x3808e3,null));};exports[_0xbaa1('0x5a')]=function(_0x3f1018,_0x33a918){return db[_0xbaa1('0x2d')]['describe']()[_0xbaa1('0x23')](respondWithResult(_0x33a918,null))[_0xbaa1('0x54')](handleError(_0x33a918,null));};exports[_0xbaa1('0x24')]=function(_0x475e3d,_0x28f7a1){var _0x254368;return db[_0xbaa1('0x2d')]['find']({'where':{'id':_0x475e3d['params']['id']}})[_0xbaa1('0x23')](handleEntityNotFound(_0x28f7a1,null))[_0xbaa1('0x23')](function(_0x4c6b79){if(_0x4c6b79){return _0x4c6b79[_0xbaa1('0x24')]()[_0xbaa1('0x23')](function(_0x3eca07){return _0x3eca07;});}})['then'](function(_0x207b6f){_0x254368=_0x207b6f;if(_0x207b6f){if(_0x207b6f[_0xbaa1('0x5b')]||_0x207b6f[_0xbaa1('0x5c')]){return db[_0x207b6f[_0xbaa1('0x5b')]?_0xbaa1('0x5d'):_0xbaa1('0x5e')]['find']({'where':{'id':_0x207b6f[_0xbaa1('0x5b')]?_0x207b6f[_0xbaa1('0x5b')]:_0x207b6f['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xbaa1('0x23')](function(_0x4973d4){var _0x2bb374={};if(_0x4973d4){_[_0xbaa1('0x4d')](_0x2bb374,_[_0xbaa1('0x5f')](_0x254368['dataValues'],[_0xbaa1('0x60'),_0xbaa1('0x61'),'id']));_0x2bb374[_0xbaa1('0x62')]=0x15;_0x2bb374[_0xbaa1('0x63')]='deleted';_0x2bb374[_0xbaa1('0x64')]=_0x4973d4[_0xbaa1('0x29')];_0x2bb374[_0xbaa1('0x65')]=_0x475e3d[_0xbaa1('0x66')][_0xbaa1('0x29')];_0x2bb374[_0xbaa1('0x67')]=_0x475e3d[_0xbaa1('0x66')]['id'];_0x2bb374[_0xbaa1('0x68')]=!![];_0x2bb374[_0xbaa1('0x69')]=moment()[_0xbaa1('0x6a')](_0xbaa1('0x6b'));_0x2bb374[_0xbaa1('0x6c')]=_0x254368[_0xbaa1('0x6d')];_0x2bb374['campaigntype']=_0x254368[_0xbaa1('0x5b')]?_0xbaa1('0x6e'):_0xbaa1('0x6f');return db['CmContact'][_0xbaa1('0x56')]({'where':{'id':_0x2bb374[_0xbaa1('0x70')]},'attributes':[_0xbaa1('0x71'),_0xbaa1('0x72')]})[_0xbaa1('0x23')](function(_0x3fb861){if(!_[_0xbaa1('0x73')](_0x28f7a1)&&!_[_0xbaa1('0x73')](_0x3fb861[_0xbaa1('0x71')])){_0x2bb374[_0xbaa1('0x74')]=_0x3fb861[_0xbaa1('0x71')];if(!_[_0xbaa1('0x73')](_0x3fb861[_0xbaa1('0x72')])){_0x2bb374['calleridname']+='\x20'+_0x3fb861['lastName'];}}})[_0xbaa1('0x75')](function(){return db[_0xbaa1('0x76')][_0xbaa1('0x57')](_0x2bb374);});}})[_0xbaa1('0x23')](function(){return _0x28f7a1[_0xbaa1('0x18')](0xcc)[_0xbaa1('0x25')]();})['catch'](handleError(_0x28f7a1,null));};exports[_0xbaa1('0x77')]=function(_0x402158,_0x5b2c22,_0x5b0d46){var _0x55475b=[];return db[_0xbaa1('0x78')]['describe']()[_0xbaa1('0x23')](function(_0x57d9ca){_0x55475b=_[_0xbaa1('0x33')](_0x57d9ca);return _0x402158[_0xbaa1('0x66')][_0xbaa1('0x79')]({'where':{'type':_0xbaa1('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xbaa1('0x7b')],'raw':!![]});})['then'](function(_0x3be487){if(_0x3be487&&_0x3be487[_0xbaa1('0x48')]){return db[_0xbaa1('0x7c')][_0xbaa1('0x7d')](function(_0xd6b380){var _0x134906={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbaa1('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x3be487,'id')},'$or':[{'UserId':null},{'UserId':_0x402158[_0xbaa1('0x66')]['id']}]};var _0xa9a5f4=[];if(_0x402158['body']['direction']&&_0x402158[_0xbaa1('0x58')][_0xbaa1('0x7e')]==='prev'){if(!_[_0xbaa1('0x7f')](_0x402158['body']['hopperIds'])){_0x134906['id']={'$in':_0x402158[_0xbaa1('0x58')][_0xbaa1('0x80')]};}_0xa9a5f4=[[_0xbaa1('0x81'),_0xbaa1('0x82')],['scheduledAt',_0x3be487[0x0]['dialOrderByScheduledAt']===_0xbaa1('0x82')?'DESC':_0xbaa1('0x82')],db[_0xbaa1('0x7c')]['literal'](_0xbaa1('0x83')),['id',_0xbaa1('0x84')]];}else{if(!_[_0xbaa1('0x7f')](_0x402158[_0xbaa1('0x58')][_0xbaa1('0x80')])){_0x134906['id']={'$notIn':_0x402158['body'][_0xbaa1('0x80')]};}_0xa9a5f4=[['priority',_0xbaa1('0x84')],[_0xbaa1('0x85'),_0x3be487[0x0][_0xbaa1('0x7b')]],db[_0xbaa1('0x7c')]['literal'](_0xbaa1('0x86')),['id',_0xbaa1('0x82')]];}return db[_0xbaa1('0x2d')]['findOne']({'attributes':['id',_0xbaa1('0x87')],'where':_0x134906,'order':_0xa9a5f4,'transaction':_0xd6b380,'lock':_0xd6b380[_0xbaa1('0x88')][_0xbaa1('0x89')],'include':[{'model':db[_0xbaa1('0x78')],'as':_0xbaa1('0x8a'),'attributes':_0x55475b,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xbaa1('0x29')]}]},{'model':db[_0xbaa1('0x8b')],'as':'List','attributes':['id',_0xbaa1('0x29')]},{'model':db[_0xbaa1('0x5d')],'as':'Queue','attributes':['id','name',_0xbaa1('0x8c')]}]})[_0xbaa1('0x23')](function(_0x4a706e){if(_0x4a706e){return _0x4a706e[_0xbaa1('0x22')]({'UserId':_0x402158[_0xbaa1('0x66')]['id']},{'transaction':_0xd6b380});}});});}})['then'](handleEntityNotFound(_0x5b2c22,null))['then'](respondWithResult(_0x5b2c22,null))[_0xbaa1('0x54')](handleError(_0x5b2c22,null));};exports[_0xbaa1('0x8d')]=function(_0x2d02f8,_0x306e66,_0xea66ab){return _0x2d02f8[_0xbaa1('0x66')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xbaa1('0x23')](function(_0x469184){if(_0x469184&&_0x469184[_0xbaa1('0x48')]){return db[_0xbaa1('0x2d')][_0xbaa1('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbaa1('0x6b'))},'VoiceQueueId':{'$in':_[_0xbaa1('0x2c')](_0x469184,'id')},'$or':[{'UserId':null},{'UserId':_0x2d02f8[_0xbaa1('0x66')]['id']}]}});}return 0x0;})[_0xbaa1('0x23')](function(_0x2212be){if(!_[_0xbaa1('0x73')](_0x2212be)&&_[_0xbaa1('0x8e')](_0x2212be)){return _0x306e66[_0xbaa1('0x18')](0xc8)['json']({'contacts':_0x2212be});}else{logger[_0xbaa1('0x27')](_0xbaa1('0x8f'),'getOpenContacts',0x194,_0xbaa1('0x90'));_0x306e66[_0xbaa1('0x26')](0x194);}})[_0xbaa1('0x54')](handleError(_0x306e66,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a84d7b6..33ec27c 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5f0=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','define','scheduledat','phone','priority'];(function(_0x156530,_0x214a43){var _0x3e6267=function(_0x4ee5a8){while(--_0x4ee5a8){_0x156530['push'](_0x156530['shift']());}};_0x3e6267(++_0x214a43);}(_0xe5f0,0x138));var _0x0e5f=function(_0x527f11,_0x263928){_0x527f11=_0x527f11-0x0;var _0x1653c7=_0xe5f0[_0x527f11];return _0x1653c7;};'use strict';var _=require(_0x0e5f('0x0'));var util=require(_0x0e5f('0x1'));var logger=require('../../config/logger')(_0x0e5f('0x2'));var moment=require(_0x0e5f('0x3'));var BPromise=require(_0x0e5f('0x4'));var rp=require(_0x0e5f('0x5'));var fs=require('fs');var path=require(_0x0e5f('0x6'));var rimraf=require(_0x0e5f('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x2b95de,_0x4472dd){return _0x2b95de[_0x0e5f('0x8')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x0e5f('0x9'),'fields':[_0x0e5f('0x9')]},{'name':_0x0e5f('0xa'),'fields':[_0x0e5f('0xa')]},{'name':_0x0e5f('0xb'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c38=['cm_hopper','scheduledat','phone','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3c38,0x81));var _0x83c3=function(_0x54c913,_0x3b9057){_0x54c913=_0x54c913-0x0;var _0x4fd1aa=_0x3c38[_0x54c913];return _0x4fd1aa;};'use strict';var _=require(_0x83c3('0x0'));var util=require(_0x83c3('0x1'));var logger=require(_0x83c3('0x2'))(_0x83c3('0x3'));var moment=require(_0x83c3('0x4'));var BPromise=require(_0x83c3('0x5'));var rp=require(_0x83c3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83c3('0x7'));var config=require(_0x83c3('0x8'));var attributes=require('./cmHopper.attributes');module[_0x83c3('0x9')]=function(_0x139138,_0x143f75){return _0x139138[_0x83c3('0xa')]('CmHopper',attributes,{'tableName':_0x83c3('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x83c3('0xc')]},{'name':_0x83c3('0xd'),'fields':[_0x83c3('0xd')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 614cee0..17ac05e 100644 --- a/server/api/cmHopper/cmHopper.rpc.js +++ b/server/api/cmHopper/cmHopper.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe43a=['keys','User','Agent','name','voicePause','length','includes','UserId','push','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','order','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','GetCmHopper','findAll','options','raw','where','limit','include','map','attributes','model','CmHopper','find','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','update','body','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xe43a,0xed));var _0xae43=function(_0x237371,_0xa3d6d5){_0x237371=_0x237371-0x0;var _0x214357=_0xe43a[_0x237371];return _0x214357;};'use strict';var _=require(_0xae43('0x0'));var util=require(_0xae43('0x1'));var moment=require(_0xae43('0x2'));var BPromise=require(_0xae43('0x3'));var rs=require(_0xae43('0x4'));var fs=require('fs');var Redis=require(_0xae43('0x5'));var db=require(_0xae43('0x6'))['db'];var utils=require(_0xae43('0x7'));var logger=require(_0xae43('0x8'))(_0xae43('0x9'));var config=require(_0xae43('0xa'));var jayson=require(_0xae43('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c0f98,_0x10bf4e,_0x46879e){return new BPromise(function(_0x507664,_0x19c298){return client[_0xae43('0xc')](_0x4c0f98,_0x46879e)[_0xae43('0xd')](function(_0x9a33ff){logger['info'](_0xae43('0xe'),_0x10bf4e,_0xae43('0xf'));logger[_0xae43('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x10bf4e,_0xae43('0xf'),JSON[_0xae43('0x11')](_0x9a33ff));if(_0x9a33ff['error']){if(_0x9a33ff['error'][_0xae43('0x12')]===0x1f4){logger[_0xae43('0x13')](_0xae43('0xe'),_0x10bf4e,_0x9a33ff[_0xae43('0x13')][_0xae43('0x14')]);return _0x19c298(_0x9a33ff[_0xae43('0x13')][_0xae43('0x14')]);}logger[_0xae43('0x13')]('CmHopper,\x20%s,\x20%s',_0x10bf4e,_0x9a33ff[_0xae43('0x13')][_0xae43('0x14')]);return _0x507664(_0x9a33ff[_0xae43('0x13')]['message']);}else{logger[_0xae43('0x15')](_0xae43('0xe'),_0x10bf4e,_0xae43('0xf'));_0x507664(_0x9a33ff[_0xae43('0x16')]['message']);}})[_0xae43('0x17')](function(_0x1d25b1){logger[_0xae43('0x13')](_0xae43('0xe'),_0x10bf4e,_0x1d25b1);_0x19c298(_0x1d25b1);});});}exports[_0xae43('0x18')]=function(_0x564623){var _0x39d825=this;return new Promise(function(_0x5919bd,_0x8aa5aa){return db['CmHopper'][_0xae43('0x19')]({'raw':_0x564623[_0xae43('0x1a')]?_0x564623[_0xae43('0x1a')][_0xae43('0x1b')]===undefined?!![]:![]:!![],'where':_0x564623[_0xae43('0x1a')]?_0x564623[_0xae43('0x1a')][_0xae43('0x1c')]||null:null,'attributes':_0x564623['options']?_0x564623[_0xae43('0x1a')]['attributes']||null:null,'limit':_0x564623[_0xae43('0x1a')]?_0x564623[_0xae43('0x1a')][_0xae43('0x1d')]||null:null,'include':_0x564623[_0xae43('0x1a')]?_0x564623[_0xae43('0x1a')][_0xae43('0x1e')]?_[_0xae43('0x1f')](_0x564623['options']['include'],function(_0x279a44){return{'model':db[_0x279a44['model']],'as':_0x279a44['as'],'attributes':_0x279a44[_0xae43('0x20')],'include':_0x279a44['include']?_[_0xae43('0x1f')](_0x279a44[_0xae43('0x1e')],function(_0x5a09d1){return{'model':db[_0x5a09d1[_0xae43('0x21')]],'as':_0x5a09d1['as'],'attributes':_0x5a09d1[_0xae43('0x20')],'include':_0x5a09d1[_0xae43('0x1e')]?_[_0xae43('0x1f')](_0x5a09d1[_0xae43('0x1e')],function(_0x18de28){return{'model':db[_0x18de28[_0xae43('0x21')]],'as':_0x18de28['as'],'attributes':_0x18de28[_0xae43('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e0f4b){logger['info']('GetCmHopper',_0x564623);logger[_0xae43('0x10')](_0xae43('0x18'),_0x564623,JSON[_0xae43('0x11')](_0x1e0f4b));_0x5919bd(_0x1e0f4b);})[_0xae43('0x17')](function(_0x593cab){logger['error'](_0xae43('0x18'),_0x593cab[_0xae43('0x14')],_0x564623);_0x8aa5aa(_0x39d825[_0xae43('0x13')](0x1f4,_0x593cab[_0xae43('0x14')]));});});};exports['ShowCmHopper']=function(_0x34502e){var _0x4fdd01=this;return new Promise(function(_0x15f01a,_0x263127){return db[_0xae43('0x22')][_0xae43('0x23')]({'raw':_0x34502e[_0xae43('0x1a')]?_0x34502e[_0xae43('0x1a')][_0xae43('0x1b')]===undefined?!![]:![]:!![],'where':_0x34502e[_0xae43('0x1a')]?_0x34502e[_0xae43('0x1a')]['where']||null:null,'attributes':_0x34502e[_0xae43('0x1a')]?_0x34502e[_0xae43('0x1a')]['attributes']||null:null,'include':_0x34502e[_0xae43('0x1a')]?_0x34502e['options'][_0xae43('0x1e')]?_[_0xae43('0x1f')](_0x34502e[_0xae43('0x1a')][_0xae43('0x1e')],function(_0x421849){return{'model':db[_0x421849[_0xae43('0x21')]],'as':_0x421849['as'],'attributes':_0x421849['attributes'],'include':_0x421849['include']?_[_0xae43('0x1f')](_0x421849[_0xae43('0x1e')],function(_0x5e917d){return{'model':db[_0x5e917d[_0xae43('0x21')]],'as':_0x5e917d['as'],'attributes':_0x5e917d['attributes'],'include':_0x5e917d['include']?_[_0xae43('0x1f')](_0x5e917d[_0xae43('0x1e')],function(_0x4ee40c){return{'model':db[_0x4ee40c[_0xae43('0x21')]],'as':_0x4ee40c['as'],'attributes':_0x4ee40c[_0xae43('0x20')]};}):[]};}):[]};}):[]:[]})[_0xae43('0xd')](function(_0x512d5e){logger[_0xae43('0x15')]('ShowCmHopper',_0x34502e);logger[_0xae43('0x10')](_0xae43('0x24'),_0x34502e,JSON[_0xae43('0x11')](_0x512d5e));_0x15f01a(_0x512d5e);})[_0xae43('0x17')](function(_0x3df4d3){logger[_0xae43('0x13')](_0xae43('0x24'),_0x3df4d3[_0xae43('0x14')],_0x34502e);_0x263127(_0x4fdd01[_0xae43('0x13')](0x1f4,_0x3df4d3['message']));});});};exports[_0xae43('0x25')]=function(_0x1a5475){var _0x6aa569=this;return new Promise(function(_0x19c2b1,_0x59b682){return db[_0xae43('0x22')][_0xae43('0x26')](_0x1a5475['body'],{'raw':_0x1a5475[_0xae43('0x1a')]?_0x1a5475[_0xae43('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2e9f32){logger['info']('CreateCmHopper',_0x1a5475);logger[_0xae43('0x10')]('CreateCmHopper',_0x1a5475,JSON['stringify'](_0x2e9f32));_0x19c2b1(_0x2e9f32);})[_0xae43('0x17')](function(_0x4cac32){logger[_0xae43('0x13')](_0xae43('0x25'),_0x4cac32[_0xae43('0x14')],_0x1a5475);_0x59b682(_0x6aa569[_0xae43('0x13')](0x1f4,_0x4cac32['message']));});});};exports[_0xae43('0x27')]=function(_0x2cc17f){var _0x10930c=this;return new Promise(function(_0x5500d9,_0x3662b7){return db[_0xae43('0x22')][_0xae43('0x28')](_0x2cc17f[_0xae43('0x29')],{'raw':_0x2cc17f[_0xae43('0x1a')]?_0x2cc17f[_0xae43('0x1a')][_0xae43('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cc17f[_0xae43('0x1a')]?_0x2cc17f[_0xae43('0x1a')][_0xae43('0x1c')]||null:null,'attributes':_0x2cc17f[_0xae43('0x1a')]?_0x2cc17f['options'][_0xae43('0x20')]||null:null,'limit':_0x2cc17f[_0xae43('0x1a')]?_0x2cc17f['options'][_0xae43('0x1d')]||null:null})[_0xae43('0xd')](function(_0x27b7f1){logger[_0xae43('0x15')]('UpdateCmHopper',_0x2cc17f);logger[_0xae43('0x10')]('UpdateCmHopper',_0x2cc17f,JSON[_0xae43('0x11')](_0x27b7f1));_0x5500d9(_0x27b7f1);})[_0xae43('0x17')](function(_0x35b942){logger['error']('UpdateCmHopper',_0x35b942[_0xae43('0x14')],_0x2cc17f);_0x3662b7(_0x10930c[_0xae43('0x13')](0x1f4,_0x35b942[_0xae43('0x14')]));});});};exports[_0xae43('0x2a')]=function(_0x4b8614){var _0x558e4a=this;return new Promise(function(_0x24ba16,_0x221048){return db[_0xae43('0x22')][_0xae43('0x2b')]({'where':_0x4b8614[_0xae43('0x1a')]?_0x4b8614[_0xae43('0x1a')][_0xae43('0x1c')]||null:null})[_0xae43('0xd')](function(_0x315b14){logger['info']('DestroyCmHopper',_0x4b8614);logger[_0xae43('0x10')](_0xae43('0x2a'),_0x4b8614,JSON[_0xae43('0x11')](_0x315b14));_0x24ba16(_0x315b14);})['catch'](function(_0x290145){logger[_0xae43('0x13')](_0xae43('0x2a'),_0x290145[_0xae43('0x14')],_0x4b8614);_0x221048(_0x558e4a[_0xae43('0x13')](0x1f4,_0x290145[_0xae43('0x14')]));});});};exports['GetContactDialer']=function(_0x54c505){var _0x8b16a0=this;return new Promise(function(_0x556e6e,_0x4f4a41){return db[_0xae43('0x2c')][_0xae43('0x2d')]()[_0xae43('0xd')](function(_0x2a36b1){return db[_0xae43('0x2e')][_0xae43('0x2f')](function(_0xa7fb42){return db['CmHopper']['findAll']({'where':_0x54c505['options']?_0x54c505[_0xae43('0x1a')][_0xae43('0x1c')]||null:null,'attributes':_0x54c505['options']?_0x54c505['options'][_0xae43('0x20')]||null:null,'limit':_0x54c505[_0xae43('0x1a')]?_0x54c505[_0xae43('0x1a')][_0xae43('0x1d')]||null:null,'order':_0x54c505[_0xae43('0x1a')]?_0x54c505['options']['order']||null:null,'transaction':_0xa7fb42,'lock':_0xa7fb42[_0xae43('0x30')][_0xae43('0x31')],'include':[{'model':db['CmContact'],'as':_0xae43('0x32'),'attributes':_[_0xae43('0x33')](_0x2a36b1)},{'model':db[_0xae43('0x34')],'as':_0xae43('0x35'),'attributes':['id',_0xae43('0x36'),_0xae43('0x37')]}]})[_0xae43('0xd')](function(_0x5395f2){var _0x5689b0=[];var _0x1bf836=[];for(var _0x457f3e=0x0;_0x457f3e<_0x5395f2[_0xae43('0x38')];_0x457f3e+=0x1){if(!_0x1bf836[_0xae43('0x39')](_0x5395f2[_0x457f3e][_0xae43('0x3a')])){_0x1bf836[_0xae43('0x3b')](_0x5395f2[_0x457f3e]['UserId']);_0x5689b0[_0xae43('0x3b')](_0x5395f2[_0x457f3e]['update'](_0x54c505[_0xae43('0x29')],{'transaction':_0xa7fb42}));}}return BPromise['all'](_0x5689b0);});})[_0xae43('0xd')](function(_0x542aa3){logger['info'](_0xae43('0x3c'),_0x54c505);logger[_0xae43('0x10')](_0xae43('0x3c'),_0x54c505,JSON[_0xae43('0x11')](_0x542aa3));_0x556e6e(_0x542aa3);})[_0xae43('0x17')](function(_0x2d587e){logger['error']('GetContactDialer',_0x2d587e[_0xae43('0x14')],_0x54c505);_0x4f4a41(_0x8b16a0[_0xae43('0x13')](0x1f4,_0x2d587e[_0xae43('0x14')]));});});});};exports[_0xae43('0x3d')]=function(_0x33c2da){var _0x4671aa=this;return new Promise(function(_0x56b172,_0x1f8794){return db[_0xae43('0x2e')][_0xae43('0x2f')](function(_0x11236e){return db[_0xae43('0x3e')][_0xae43('0x26')](_0x33c2da[_0xae43('0x29')],{'raw':_0x33c2da['options']?_0x33c2da[_0xae43('0x1a')][_0xae43('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x11236e})[_0xae43('0xd')](function(){return db[_0xae43('0x22')][_0xae43('0x2b')]({'where':_0x33c2da[_0xae43('0x1a')]?_0x33c2da[_0xae43('0x1a')][_0xae43('0x1c')]||null:null,'transaction':_0x11236e});});})[_0xae43('0xd')](function(_0x9c5d95){logger['info'](_0xae43('0x3d'),_0x33c2da);logger[_0xae43('0x10')](_0xae43('0x3d'),_0x33c2da,JSON[_0xae43('0x11')](_0x9c5d95));_0x56b172(_0x9c5d95);})['catch'](function(_0x37d8e4){logger[_0xae43('0x13')](_0xae43('0x3d'),_0x37d8e4['message'],_0x33c2da);_0x1f8794(_0x4671aa[_0xae43('0x13')](0x1f4,_0x37d8e4[_0xae43('0x14')]));});});};exports[_0xae43('0x3f')]=function(_0xdb8037){var _0x43fd74=this;return new Promise(function(_0x4db471,_0x3eecc5){return db[_0xae43('0x22')]['findAll']({'raw':_0xdb8037[_0xae43('0x1a')]?_0xdb8037[_0xae43('0x1a')][_0xae43('0x1b')]===undefined?!![]:![]:!![],'where':_0xdb8037[_0xae43('0x1a')]?_0xdb8037[_0xae43('0x1a')][_0xae43('0x1c')]||null:null,'attributes':[[db[_0xae43('0x2e')]['fn']('COUNT',db[_0xae43('0x2e')]['fn']('IF',db[_0xae43('0x2e')]['literal'](_0xae43('0x40')+util['format']('\x22%s\x22',moment()[_0xae43('0x41')](_0xae43('0x42')))+_0xae43('0x43')))),_0xae43('0x44')]]})[_0xae43('0xd')](function(_0xc48731){logger[_0xae43('0x15')](_0xae43('0x3f'),_0xdb8037);logger[_0xae43('0x10')](_0xae43('0x3f'),_0xdb8037,JSON['stringify'](_0xc48731));_0x4db471(_0xc48731);})['catch'](function(_0x23a57f){logger[_0xae43('0x13')](_0xae43('0x3f'),_0x23a57f[_0xae43('0x14')],_0xdb8037);_0x3eecc5(_0x43fd74['error'](0x1f4,_0x23a57f[_0xae43('0x14')]));});});};exports['GetContactRecallMe']=function(_0x58af3e){var _0x412ab1=this;return new Promise(function(_0x1fb2b5,_0x9baa1d){return db['CmContact'][_0xae43('0x2d')]()['then'](function(_0x4fe237){return db[_0xae43('0x2e')][_0xae43('0x2f')](function(_0x590b2e){return db[_0xae43('0x22')][_0xae43('0x19')]({'where':_0x58af3e[_0xae43('0x1a')]?_0x58af3e[_0xae43('0x1a')][_0xae43('0x1c')]||null:null,'attributes':_0x58af3e[_0xae43('0x1a')]?_0x58af3e[_0xae43('0x1a')]['attributes']||null:null,'limit':0x1,'order':_0x58af3e[_0xae43('0x1a')]?_0x58af3e[_0xae43('0x1a')][_0xae43('0x45')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x590b2e,'lock':_0x590b2e['LOCK'][_0xae43('0x31')],'include':_0x58af3e[_0xae43('0x1a')]?_0x58af3e[_0xae43('0x1a')][_0xae43('0x1e')]?_[_0xae43('0x1f')](_0x58af3e[_0xae43('0x1a')][_0xae43('0x1e')],function(_0x3b7cf1){return{'model':db[_0x3b7cf1[_0xae43('0x21')]],'as':_0x3b7cf1['as'],'attributes':_0x3b7cf1[_0xae43('0x20')],'include':_0x3b7cf1['include']?_[_0xae43('0x1f')](_0x3b7cf1['include'],function(_0x1cd359){return{'model':db[_0x1cd359[_0xae43('0x21')]],'as':_0x1cd359['as'],'attributes':_0x1cd359['attributes'],'include':_0x1cd359[_0xae43('0x1e')]?_['map'](_0x1cd359['include'],function(_0x4bd326){return{'model':db[_0x4bd326['model']],'as':_0x4bd326['as'],'attributes':_0x4bd326['attributes']};}):[]};}):[]};}):[]:[]})[_0xae43('0xd')](function(_0x5a0498){var _0xa57e68=[];for(var _0x56a99d=0x0;_0x56a99d<_0x5a0498[_0xae43('0x38')];_0x56a99d+=0x1){_0xa57e68['push'](_0x5a0498[_0x56a99d][_0xae43('0x28')](_0x58af3e[_0xae43('0x29')],{'transaction':_0x590b2e}));}return BPromise['all'](_0xa57e68);});})[_0xae43('0xd')](function(_0x5db0e5){logger[_0xae43('0x15')](_0xae43('0x46'),_0x58af3e);logger[_0xae43('0x10')]('GetContactRecallMe',_0x58af3e,JSON['stringify'](_0x5db0e5));_0x1fb2b5(_0x5db0e5);})[_0xae43('0x17')](function(_0x205036){logger[_0xae43('0x13')]('GetContactRecallMe',_0x205036[_0xae43('0x14')],_0x58af3e);_0x9baa1d(_0x412ab1['error'](0x1f4,_0x205036[_0xae43('0x14')]));});});});};exports[_0xae43('0x47')]=function(_0xa0a26a){var _0x13c0f8=this;return new Promise(function(_0x361510,_0x28f688){db[_0xae43('0x2c')][_0xae43('0x2d')]()[_0xae43('0xd')](function(_0x52f124){return db['CmHopper'][_0xae43('0x19')]({'raw':_0xa0a26a[_0xae43('0x1a')]?_0xa0a26a[_0xae43('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xa0a26a[_0xae43('0x1a')]?_0xa0a26a[_0xae43('0x1a')][_0xae43('0x1c')]||null:null,'attributes':_0xa0a26a['options']?_0xa0a26a['options'][_0xae43('0x20')]||null:null,'limit':_0xa0a26a[_0xae43('0x1a')]?_0xa0a26a[_0xae43('0x1a')]['limit']||null:null,'include':_0xa0a26a[_0xae43('0x1a')]?_0xa0a26a[_0xae43('0x1a')][_0xae43('0x1e')]?_[_0xae43('0x1f')](_0xa0a26a['options']['include'],function(_0x5857a9){return{'model':db[_0x5857a9[_0xae43('0x21')]],'as':_0x5857a9['as'],'attributes':_0x5857a9['as']===_0xae43('0x32')?_['keys'](_0x52f124):_0x5857a9[_0xae43('0x20')],'include':_0x5857a9['include']?_[_0xae43('0x1f')](_0x5857a9[_0xae43('0x1e')],function(_0xee4d){return{'model':db[_0xee4d[_0xae43('0x21')]],'as':_0xee4d['as'],'attributes':_0xee4d[_0xae43('0x20')],'include':_0xee4d[_0xae43('0x1e')]?_[_0xae43('0x1f')](_0xee4d['include'],function(_0x29b696){return{'model':db[_0x29b696[_0xae43('0x21')]],'as':_0x29b696['as'],'attributes':_0x29b696[_0xae43('0x20')]};}):[]};}):[]};}):[]:[]})[_0xae43('0xd')](function(_0x262e34){logger[_0xae43('0x15')](_0xae43('0x18'),_0xa0a26a);logger['debug']('GetCmHopper',_0xa0a26a,JSON[_0xae43('0x11')](_0x262e34));_0x361510(_0x262e34);})[_0xae43('0x17')](function(_0xfc2fd0){logger[_0xae43('0x13')]('GetCmHopper',_0xfc2fd0['message'],_0xa0a26a);_0x28f688(_0x13c0f8[_0xae43('0x13')](0x1f4,_0xfc2fd0['message']));});});});}; \ No newline at end of file +var _0xabad=['CmContact','describe','transaction','LOCK','UPDATE','Contact','Agent','name','length','includes','UserId','push','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','order','all','GetContactRecallMe','GetCmHopperPreview','limit','keys','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','findAll','options','raw','where','attributes','include','map','model','catch','ShowCmHopper','CmHopper','CreateCmHopper','UpdateCmHopper','update','body','DestroyCmHopper','destroy','GetContactDialer'];(function(_0x477f8b,_0x4863d2){var _0x16e662=function(_0x595180){while(--_0x595180){_0x477f8b['push'](_0x477f8b['shift']());}};_0x16e662(++_0x4863d2);}(_0xabad,0xab));var _0xdaba=function(_0x53a0ce,_0x5eaa86){_0x53a0ce=_0x53a0ce-0x0;var _0x491112=_0xabad[_0x53a0ce];return _0x491112;};'use strict';var _=require(_0xdaba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdaba('0x1'));var rs=require(_0xdaba('0x2'));var fs=require('fs');var Redis=require(_0xdaba('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdaba('0x4'))(_0xdaba('0x5'));var config=require(_0xdaba('0x6'));var jayson=require(_0xdaba('0x7'));var client=jayson[_0xdaba('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8a5dc3,_0x458fe2,_0x110aed){return new BPromise(function(_0x3bcdfd,_0x5cb3d8){return client[_0xdaba('0x9')](_0x8a5dc3,_0x110aed)[_0xdaba('0xa')](function(_0x5018f6){logger[_0xdaba('0xb')](_0xdaba('0xc'),_0x458fe2,'request\x20sent');logger[_0xdaba('0xd')](_0xdaba('0xe'),_0x458fe2,'request\x20sent',JSON[_0xdaba('0xf')](_0x5018f6));if(_0x5018f6[_0xdaba('0x10')]){if(_0x5018f6[_0xdaba('0x10')][_0xdaba('0x11')]===0x1f4){logger['error'](_0xdaba('0xc'),_0x458fe2,_0x5018f6[_0xdaba('0x10')][_0xdaba('0x12')]);return _0x5cb3d8(_0x5018f6['error'][_0xdaba('0x12')]);}logger[_0xdaba('0x10')]('CmHopper,\x20%s,\x20%s',_0x458fe2,_0x5018f6['error']['message']);return _0x3bcdfd(_0x5018f6[_0xdaba('0x10')][_0xdaba('0x12')]);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x458fe2,'request\x20sent');_0x3bcdfd(_0x5018f6[_0xdaba('0x13')][_0xdaba('0x12')]);}})['catch'](function(_0x21d46f){logger[_0xdaba('0x10')](_0xdaba('0xc'),_0x458fe2,_0x21d46f);_0x5cb3d8(_0x21d46f);});});}exports[_0xdaba('0x14')]=function(_0x5b16ba){var _0x36ef05=this;return new Promise(function(_0x985296,_0x2b8270){return db['CmHopper'][_0xdaba('0x15')]({'raw':_0x5b16ba[_0xdaba('0x16')]?_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x17')]===undefined?!![]:![]:!![],'where':_0x5b16ba['options']?_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x18')]||null:null,'attributes':_0x5b16ba[_0xdaba('0x16')]?_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'limit':_0x5b16ba[_0xdaba('0x16')]?_0x5b16ba[_0xdaba('0x16')]['limit']||null:null,'include':_0x5b16ba[_0xdaba('0x16')]?_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x1a')]?_['map'](_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x1a')],function(_0x4966c3){return{'model':db[_0x4966c3['model']],'as':_0x4966c3['as'],'attributes':_0x4966c3[_0xdaba('0x19')],'include':_0x4966c3[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x4966c3[_0xdaba('0x1a')],function(_0x471094){return{'model':db[_0x471094['model']],'as':_0x471094['as'],'attributes':_0x471094['attributes'],'include':_0x471094[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x471094['include'],function(_0x80b66a){return{'model':db[_0x80b66a[_0xdaba('0x1c')]],'as':_0x80b66a['as'],'attributes':_0x80b66a[_0xdaba('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdaba('0xa')](function(_0x3262fb){logger[_0xdaba('0xb')](_0xdaba('0x14'),_0x5b16ba);logger[_0xdaba('0xd')]('GetCmHopper',_0x5b16ba,JSON['stringify'](_0x3262fb));_0x985296(_0x3262fb);})[_0xdaba('0x1d')](function(_0x1e6d66){logger[_0xdaba('0x10')]('GetCmHopper',_0x1e6d66['message'],_0x5b16ba);_0x2b8270(_0x36ef05[_0xdaba('0x10')](0x1f4,_0x1e6d66[_0xdaba('0x12')]));});});};exports[_0xdaba('0x1e')]=function(_0x4f9044){var _0x23d869=this;return new Promise(function(_0x59923e,_0x443219){return db[_0xdaba('0x1f')]['find']({'raw':_0x4f9044['options']?_0x4f9044['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f9044['options']?_0x4f9044[_0xdaba('0x16')][_0xdaba('0x18')]||null:null,'attributes':_0x4f9044[_0xdaba('0x16')]?_0x4f9044[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'include':_0x4f9044[_0xdaba('0x16')]?_0x4f9044[_0xdaba('0x16')]['include']?_[_0xdaba('0x1b')](_0x4f9044[_0xdaba('0x16')][_0xdaba('0x1a')],function(_0x175a34){return{'model':db[_0x175a34['model']],'as':_0x175a34['as'],'attributes':_0x175a34[_0xdaba('0x19')],'include':_0x175a34[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x175a34[_0xdaba('0x1a')],function(_0x4798ce){return{'model':db[_0x4798ce[_0xdaba('0x1c')]],'as':_0x4798ce['as'],'attributes':_0x4798ce[_0xdaba('0x19')],'include':_0x4798ce[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x4798ce[_0xdaba('0x1a')],function(_0x4bee37){return{'model':db[_0x4bee37['model']],'as':_0x4bee37['as'],'attributes':_0x4bee37[_0xdaba('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdaba('0xa')](function(_0x2f69bf){logger[_0xdaba('0xb')](_0xdaba('0x1e'),_0x4f9044);logger[_0xdaba('0xd')](_0xdaba('0x1e'),_0x4f9044,JSON[_0xdaba('0xf')](_0x2f69bf));_0x59923e(_0x2f69bf);})[_0xdaba('0x1d')](function(_0x1d87e9){logger['error']('ShowCmHopper',_0x1d87e9[_0xdaba('0x12')],_0x4f9044);_0x443219(_0x23d869[_0xdaba('0x10')](0x1f4,_0x1d87e9[_0xdaba('0x12')]));});});};exports['CreateCmHopper']=function(_0x5131b0){var _0x2ab67f=this;return new Promise(function(_0x109d4d,_0x4e18da){return db[_0xdaba('0x1f')]['create'](_0x5131b0['body'],{'raw':_0x5131b0[_0xdaba('0x16')]?_0x5131b0[_0xdaba('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x556d71){logger[_0xdaba('0xb')](_0xdaba('0x20'),_0x5131b0);logger[_0xdaba('0xd')]('CreateCmHopper',_0x5131b0,JSON[_0xdaba('0xf')](_0x556d71));_0x109d4d(_0x556d71);})[_0xdaba('0x1d')](function(_0x478c24){logger['error'](_0xdaba('0x20'),_0x478c24[_0xdaba('0x12')],_0x5131b0);_0x4e18da(_0x2ab67f[_0xdaba('0x10')](0x1f4,_0x478c24['message']));});});};exports[_0xdaba('0x21')]=function(_0x569607){var _0x2d2333=this;return new Promise(function(_0x17536b,_0x475845){return db[_0xdaba('0x1f')][_0xdaba('0x22')](_0x569607[_0xdaba('0x23')],{'raw':_0x569607[_0xdaba('0x16')]?_0x569607[_0xdaba('0x16')][_0xdaba('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x569607[_0xdaba('0x16')]?_0x569607[_0xdaba('0x16')]['where']||null:null,'attributes':_0x569607['options']?_0x569607[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'limit':_0x569607['options']?_0x569607[_0xdaba('0x16')]['limit']||null:null})[_0xdaba('0xa')](function(_0x45de3e){logger[_0xdaba('0xb')](_0xdaba('0x21'),_0x569607);logger['debug'](_0xdaba('0x21'),_0x569607,JSON['stringify'](_0x45de3e));_0x17536b(_0x45de3e);})['catch'](function(_0x656a95){logger[_0xdaba('0x10')](_0xdaba('0x21'),_0x656a95[_0xdaba('0x12')],_0x569607);_0x475845(_0x2d2333[_0xdaba('0x10')](0x1f4,_0x656a95['message']));});});};exports[_0xdaba('0x24')]=function(_0x2fdc54){var _0x7a24d=this;return new Promise(function(_0x4160ba,_0x3875f6){return db['CmHopper'][_0xdaba('0x25')]({'where':_0x2fdc54[_0xdaba('0x16')]?_0x2fdc54[_0xdaba('0x16')][_0xdaba('0x18')]||null:null})[_0xdaba('0xa')](function(_0x4058f1){logger[_0xdaba('0xb')](_0xdaba('0x24'),_0x2fdc54);logger['debug']('DestroyCmHopper',_0x2fdc54,JSON[_0xdaba('0xf')](_0x4058f1));_0x4160ba(_0x4058f1);})['catch'](function(_0x298d7b){logger['error'](_0xdaba('0x24'),_0x298d7b[_0xdaba('0x12')],_0x2fdc54);_0x3875f6(_0x7a24d[_0xdaba('0x10')](0x1f4,_0x298d7b[_0xdaba('0x12')]));});});};exports[_0xdaba('0x26')]=function(_0xc4e976){var _0x2e0c6c=this;return new Promise(function(_0x2cb462,_0x2e18d1){return db[_0xdaba('0x27')][_0xdaba('0x28')]()[_0xdaba('0xa')](function(_0x2ec0c){return db['sequelize'][_0xdaba('0x29')](function(_0x2d1894){return db[_0xdaba('0x1f')][_0xdaba('0x15')]({'where':_0xc4e976[_0xdaba('0x16')]?_0xc4e976['options'][_0xdaba('0x18')]||null:null,'attributes':_0xc4e976[_0xdaba('0x16')]?_0xc4e976['options'][_0xdaba('0x19')]||null:null,'limit':_0xc4e976['options']?_0xc4e976[_0xdaba('0x16')]['limit']||null:null,'order':_0xc4e976['options']?_0xc4e976['options']['order']||null:null,'transaction':_0x2d1894,'lock':_0x2d1894[_0xdaba('0x2a')][_0xdaba('0x2b')],'include':[{'model':db[_0xdaba('0x27')],'as':_0xdaba('0x2c'),'attributes':_['keys'](_0x2ec0c)},{'model':db['User'],'as':_0xdaba('0x2d'),'attributes':['id',_0xdaba('0x2e'),'voicePause']}]})[_0xdaba('0xa')](function(_0x5adf77){var _0x5f1ea5=[];var _0xa0b07a=[];for(var _0x296816=0x0;_0x296816<_0x5adf77[_0xdaba('0x2f')];_0x296816+=0x1){if(!_0xa0b07a[_0xdaba('0x30')](_0x5adf77[_0x296816][_0xdaba('0x31')])){_0xa0b07a[_0xdaba('0x32')](_0x5adf77[_0x296816][_0xdaba('0x31')]);_0x5f1ea5['push'](_0x5adf77[_0x296816][_0xdaba('0x22')](_0xc4e976[_0xdaba('0x23')],{'transaction':_0x2d1894}));}}return BPromise['all'](_0x5f1ea5);});})['then'](function(_0x58e1b2){logger[_0xdaba('0xb')]('GetContactDialer',_0xc4e976);logger[_0xdaba('0xd')](_0xdaba('0x26'),_0xc4e976,JSON[_0xdaba('0xf')](_0x58e1b2));_0x2cb462(_0x58e1b2);})[_0xdaba('0x1d')](function(_0x14a196){logger[_0xdaba('0x10')]('GetContactDialer',_0x14a196[_0xdaba('0x12')],_0xc4e976);_0x2e18d1(_0x2e0c6c[_0xdaba('0x10')](0x1f4,_0x14a196[_0xdaba('0x12')]));});});});};exports[_0xdaba('0x33')]=function(_0x1b21fa){var _0x5082ad=this;return new Promise(function(_0x1ef787,_0x71ffee){return db['sequelize']['transaction'](function(_0x5dfe69){return db[_0xdaba('0x34')][_0xdaba('0x35')](_0x1b21fa['body'],{'raw':_0x1b21fa['options']?_0x1b21fa[_0xdaba('0x16')]['raw']===undefined?!![]:![]:!![],'transaction':_0x5dfe69})[_0xdaba('0xa')](function(){return db[_0xdaba('0x1f')][_0xdaba('0x25')]({'where':_0x1b21fa['options']?_0x1b21fa[_0xdaba('0x16')]['where']||null:null,'transaction':_0x5dfe69});});})['then'](function(_0x1cd52b){logger[_0xdaba('0xb')](_0xdaba('0x33'),_0x1b21fa);logger[_0xdaba('0xd')](_0xdaba('0x33'),_0x1b21fa,JSON[_0xdaba('0xf')](_0x1cd52b));_0x1ef787(_0x1cd52b);})[_0xdaba('0x1d')](function(_0x1053cb){logger[_0xdaba('0x10')]('MoveContactManagedDialer',_0x1053cb[_0xdaba('0x12')],_0x1b21fa);_0x71ffee(_0x5082ad[_0xdaba('0x10')](0x1f4,_0x1053cb[_0xdaba('0x12')]));});});};exports[_0xdaba('0x36')]=function(_0x311df5){var _0x3afe19=this;return new Promise(function(_0x2d88a3,_0x1ba224){return db['CmHopper']['findAll']({'raw':_0x311df5[_0xdaba('0x16')]?_0x311df5['options']['raw']===undefined?!![]:![]:!![],'where':_0x311df5[_0xdaba('0x16')]?_0x311df5[_0xdaba('0x16')][_0xdaba('0x18')]||null:null,'attributes':[[db[_0xdaba('0x37')]['fn'](_0xdaba('0x38'),db[_0xdaba('0x37')]['fn']('IF',db[_0xdaba('0x37')][_0xdaba('0x39')](_0xdaba('0x3a')+util[_0xdaba('0x3b')](_0xdaba('0x3c'),moment()[_0xdaba('0x3b')](_0xdaba('0x3d')))+_0xdaba('0x3e')))),_0xdaba('0x3f')]]})[_0xdaba('0xa')](function(_0x2692ff){logger[_0xdaba('0xb')](_0xdaba('0x36'),_0x311df5);logger[_0xdaba('0xd')](_0xdaba('0x36'),_0x311df5,JSON['stringify'](_0x2692ff));_0x2d88a3(_0x2692ff);})[_0xdaba('0x1d')](function(_0x433e3a){logger['error']('CountReScheduled',_0x433e3a[_0xdaba('0x12')],_0x311df5);_0x1ba224(_0x3afe19[_0xdaba('0x10')](0x1f4,_0x433e3a['message']));});});};exports['GetContactRecallMe']=function(_0x10a4d2){var _0x1a76e7=this;return new Promise(function(_0x4694d4,_0x4732f1){return db[_0xdaba('0x27')][_0xdaba('0x28')]()['then'](function(_0x5702ec){return db[_0xdaba('0x37')][_0xdaba('0x29')](function(_0x3029bd){return db[_0xdaba('0x1f')][_0xdaba('0x15')]({'where':_0x10a4d2[_0xdaba('0x16')]?_0x10a4d2[_0xdaba('0x16')][_0xdaba('0x18')]||null:null,'attributes':_0x10a4d2[_0xdaba('0x16')]?_0x10a4d2[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'limit':0x1,'order':_0x10a4d2[_0xdaba('0x16')]?_0x10a4d2['options'][_0xdaba('0x40')]||null:null,'group':db[_0xdaba('0x1f')][_0xdaba('0x31')],'transaction':_0x3029bd,'lock':_0x3029bd['LOCK'][_0xdaba('0x2b')],'include':_0x10a4d2[_0xdaba('0x16')]?_0x10a4d2['options'][_0xdaba('0x1a')]?_['map'](_0x10a4d2[_0xdaba('0x16')][_0xdaba('0x1a')],function(_0x4cae6b){return{'model':db[_0x4cae6b[_0xdaba('0x1c')]],'as':_0x4cae6b['as'],'attributes':_0x4cae6b['attributes'],'include':_0x4cae6b[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x4cae6b[_0xdaba('0x1a')],function(_0x261364){return{'model':db[_0x261364[_0xdaba('0x1c')]],'as':_0x261364['as'],'attributes':_0x261364[_0xdaba('0x19')],'include':_0x261364[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x261364[_0xdaba('0x1a')],function(_0x410d84){return{'model':db[_0x410d84['model']],'as':_0x410d84['as'],'attributes':_0x410d84[_0xdaba('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdaba('0xa')](function(_0x9117cb){var _0x1fa479=[];for(var _0x1c4f3e=0x0;_0x1c4f3e<_0x9117cb[_0xdaba('0x2f')];_0x1c4f3e+=0x1){_0x1fa479[_0xdaba('0x32')](_0x9117cb[_0x1c4f3e]['update'](_0x10a4d2[_0xdaba('0x23')],{'transaction':_0x3029bd}));}return BPromise[_0xdaba('0x41')](_0x1fa479);});})['then'](function(_0x2aab5f){logger['info'](_0xdaba('0x42'),_0x10a4d2);logger[_0xdaba('0xd')](_0xdaba('0x42'),_0x10a4d2,JSON[_0xdaba('0xf')](_0x2aab5f));_0x4694d4(_0x2aab5f);})[_0xdaba('0x1d')](function(_0x493017){logger['error'](_0xdaba('0x42'),_0x493017[_0xdaba('0x12')],_0x10a4d2);_0x4732f1(_0x1a76e7['error'](0x1f4,_0x493017[_0xdaba('0x12')]));});});});};exports[_0xdaba('0x43')]=function(_0x2f5eea){var _0x2973cc=this;return new Promise(function(_0x226b5e,_0x392e33){db[_0xdaba('0x27')]['describe']()['then'](function(_0x3bf6c5){return db[_0xdaba('0x1f')][_0xdaba('0x15')]({'raw':_0x2f5eea[_0xdaba('0x16')]?_0x2f5eea[_0xdaba('0x16')][_0xdaba('0x17')]===undefined?!![]:![]:!![],'where':_0x2f5eea['options']?_0x2f5eea[_0xdaba('0x16')]['where']||null:null,'attributes':_0x2f5eea['options']?_0x2f5eea[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'limit':_0x2f5eea[_0xdaba('0x16')]?_0x2f5eea['options'][_0xdaba('0x44')]||null:null,'include':_0x2f5eea[_0xdaba('0x16')]?_0x2f5eea[_0xdaba('0x16')][_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x2f5eea[_0xdaba('0x16')][_0xdaba('0x1a')],function(_0x260769){return{'model':db[_0x260769['model']],'as':_0x260769['as'],'attributes':_0x260769['as']===_0xdaba('0x2c')?_[_0xdaba('0x45')](_0x3bf6c5):_0x260769[_0xdaba('0x19')],'include':_0x260769[_0xdaba('0x1a')]?_['map'](_0x260769[_0xdaba('0x1a')],function(_0x91ba66){return{'model':db[_0x91ba66[_0xdaba('0x1c')]],'as':_0x91ba66['as'],'attributes':_0x91ba66[_0xdaba('0x19')],'include':_0x91ba66[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x91ba66[_0xdaba('0x1a')],function(_0x7b588f){return{'model':db[_0x7b588f[_0xdaba('0x1c')]],'as':_0x7b588f['as'],'attributes':_0x7b588f[_0xdaba('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdaba('0xa')](function(_0x1156b2){logger['info'](_0xdaba('0x14'),_0x2f5eea);logger[_0xdaba('0xd')](_0xdaba('0x14'),_0x2f5eea,JSON[_0xdaba('0xf')](_0x1156b2));_0x226b5e(_0x1156b2);})[_0xdaba('0x1d')](function(_0x5743ad){logger[_0xdaba('0x10')](_0xdaba('0x14'),_0x5743ad['message'],_0x2f5eea);_0x392e33(_0x2973cc[_0xdaba('0x10')](0x1f4,_0x5743ad[_0xdaba('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index bfe2632..734184c 100644 --- a/server/api/cmHopper/index.js +++ b/server/api/cmHopper/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c6b=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','/:id','show','post','create','put'];(function(_0x2e1738,_0x50954e){var _0x6950b=function(_0x50e660){while(--_0x50e660){_0x2e1738['push'](_0x2e1738['shift']());}};_0x6950b(++_0x50954e);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x397975,_0x16cab2){_0x397975=_0x397975-0x0;var _0x1fdbaf=_0x0c6b[_0x397975];return _0x1fdbaf;};'use strict';var multer=require(_0xb0c6('0x0'));var util=require('util');var path=require(_0xb0c6('0x1'));var timeout=require(_0xb0c6('0x2'));var express=require(_0xb0c6('0x3'));var router=express[_0xb0c6('0x4')]();var auth=require(_0xb0c6('0x5'));var interaction=require(_0xb0c6('0x6'));var config=require(_0xb0c6('0x7'));var controller=require(_0xb0c6('0x8'));router[_0xb0c6('0x9')]('/',auth[_0xb0c6('0xa')](),controller[_0xb0c6('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb0c6('0x9')](_0xb0c6('0xc'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xb0c6('0x9')](_0xb0c6('0xd'),auth[_0xb0c6('0xa')](),controller[_0xb0c6('0xe')]);router[_0xb0c6('0xf')]('/',auth[_0xb0c6('0xa')](),controller[_0xb0c6('0x10')]);router[_0xb0c6('0xf')]('/preview',auth[_0xb0c6('0xa')](),controller['getPreview']);router[_0xb0c6('0x11')](_0xb0c6('0xd'),auth[_0xb0c6('0xa')](),controller['update']);router[_0xb0c6('0x12')](_0xb0c6('0xd'),auth[_0xb0c6('0xa')](),controller[_0xb0c6('0x13')]);module[_0xb0c6('0x14')]=router; \ No newline at end of file +var _0xf7d9=['../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/:id','post','create','/preview','getPreview','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf7d9,0x122));var _0x9f7d=function(_0x56cc0b,_0x335f0b){_0x56cc0b=_0x56cc0b-0x0;var _0x428427=_0xf7d9[_0x56cc0b];return _0x428427;};'use strict';var multer=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var path=require(_0x9f7d('0x2'));var timeout=require(_0x9f7d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9f7d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9f7d('0x5'));var controller=require(_0x9f7d('0x6'));router[_0x9f7d('0x7')]('/',auth[_0x9f7d('0x8')](),controller[_0x9f7d('0x9')]);router['get']('/describe',auth[_0x9f7d('0x8')](),controller[_0x9f7d('0xa')]);router[_0x9f7d('0x7')](_0x9f7d('0xb'),auth[_0x9f7d('0x8')](),controller[_0x9f7d('0xc')]);router['get'](_0x9f7d('0xd'),auth[_0x9f7d('0x8')](),controller['show']);router[_0x9f7d('0xe')]('/',auth[_0x9f7d('0x8')](),controller[_0x9f7d('0xf')]);router['post'](_0x9f7d('0x10'),auth[_0x9f7d('0x8')](),controller[_0x9f7d('0x11')]);router[_0x9f7d('0x12')](_0x9f7d('0xd'),auth[_0x9f7d('0x8')](),controller['update']);router[_0x9f7d('0x13')](_0x9f7d('0xd'),auth[_0x9f7d('0x8')](),controller[_0x9f7d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 110dca6..7861b72 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd609=['sequelize','exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x591e11,_0x363e09){var _0x23a0a=function(_0x43734d){while(--_0x43734d){_0x591e11['push'](_0x591e11['shift']());}};_0x23a0a(++_0x363e09);}(_0xd609,0x16b));var _0x9d60=function(_0x28d916,_0x1c6c25){_0x28d916=_0x28d916-0x0;var _0x1e7af9=_0xd609[_0x28d916];return _0x1e7af9;};'use strict';var moment=require(_0x9d60('0x0'));var Sequelize=require(_0x9d60('0x1'));module[_0x9d60('0x2')]={'CmHopperId':{'type':Sequelize[_0x9d60('0x3')]},'phone':{'type':Sequelize[_0x9d60('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9d60('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x9d60('0x5')](_0x9d60('0x6'))},'countbusyretry':{'type':Sequelize[_0x9d60('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9d60('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9d60('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9d60('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9d60('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9d60('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9d60('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf3b6=['INTEGER','format','exports'];(function(_0x22356e,_0x526698){var _0x59461e=function(_0x4ceb27){while(--_0x4ceb27){_0x22356e['push'](_0x22356e['shift']());}};_0x59461e(++_0x526698);}(_0xf3b6,0x143));var _0x6f3b=function(_0x144bcc,_0x55c75d){_0x144bcc=_0x144bcc-0x0;var _0x56774d=_0xf3b6[_0x144bcc];return _0x56774d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x6f3b('0x0')]={'CmHopperId':{'type':Sequelize[_0x6f3b('0x1')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x6f3b('0x2')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index d65146a..997078d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf55=['offset','limit','set','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','index','CmHopperAdditionalPhone','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','count','include','findAll','rows','catch','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5c70d0,_0xfeac42){var _0x484491=function(_0x533149){while(--_0x533149){_0x5c70d0['push'](_0x5c70d0['shift']());}};_0x484491(++_0xfeac42);}(_0xdf55,0x83));var _0x5df5=function(_0x364e2b,_0x30b028){_0x364e2b=_0x364e2b-0x0;var _0x943fef=_0xdf55[_0x364e2b];return _0x943fef;};'use strict';var pdf=require(_0x5df5('0x0'));var emlformat=require(_0x5df5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5df5('0x2'));var jsonpatch=require(_0x5df5('0x3'));var rp=require('request-promise');var moment=require(_0x5df5('0x4'));var BPromise=require(_0x5df5('0x5'));var Mustache=require(_0x5df5('0x6'));var util=require('util');var path=require(_0x5df5('0x7'));var sox=require(_0x5df5('0x8'));var csv=require(_0x5df5('0x9'));var ejs=require(_0x5df5('0xa'));var fs=require('fs');var _=require(_0x5df5('0xb'));var squel=require(_0x5df5('0xc'));var crypto=require(_0x5df5('0xd'));var jsforce=require(_0x5df5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5df5('0x9'));var querystring=require(_0x5df5('0xf'));var Papa=require(_0x5df5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5df5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5df5('0x12'));var logger=require(_0x5df5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5df5('0x14'));var licenseUtil=require(_0x5df5('0x15'));var db=require(_0x5df5('0x16'))['db'];function respondWithStatusCode(_0x4c3d6f,_0xe8bcd8){_0xe8bcd8=_0xe8bcd8||0xcc;return function(_0xb4a4fe){if(_0xb4a4fe){return _0x4c3d6f[_0x5df5('0x17')](_0xe8bcd8);}return _0x4c3d6f[_0x5df5('0x18')](_0xe8bcd8)[_0x5df5('0x19')]();};}function respondWithResult(_0x956317,_0x555d3f){_0x555d3f=_0x555d3f||0xc8;return function(_0x30fd32){if(_0x30fd32){return _0x956317['status'](_0x555d3f)[_0x5df5('0x1a')](_0x30fd32);}};}function respondWithFilteredResult(_0x33f818,_0x5b0ad9){return function(_0x3657c8){if(_0x3657c8){var _0x282d53=_0x3657c8['count'],_0x4e74c4=_0x5b0ad9[_0x5df5('0x1b')],_0x27b3fb=_0x5b0ad9[_0x5df5('0x1b')]+_0x5b0ad9[_0x5df5('0x1c')],_0x457205;if(_0x27b3fb>=_0x282d53){_0x27b3fb=_0x282d53;_0x457205=0xc8;}else{_0x457205=0xce;}_0x33f818[_0x5df5('0x18')](_0x457205);return _0x33f818[_0x5df5('0x1d')]('Content-Range',_0x4e74c4+'-'+_0x27b3fb+'/'+_0x282d53)['json'](_0x3657c8);}return null;};}function patchUpdates(_0x48c824){return function(_0x5d8dfd){try{jsonpatch[_0x5df5('0x1e')](_0x5d8dfd,_0x48c824,!![]);}catch(_0x40a8f5){return BPromise[_0x5df5('0x1f')](_0x40a8f5);}return _0x5d8dfd[_0x5df5('0x20')]();};}function saveUpdates(_0x1deae7,_0x4b4b57){return function(_0x1d6474){if(_0x1d6474){return _0x1d6474[_0x5df5('0x21')](_0x1deae7)[_0x5df5('0x22')](function(_0x34af1d){return _0x34af1d;});}return null;};}function removeEntity(_0x28efc8,_0x382999){return function(_0x59ff67){if(_0x59ff67){return _0x59ff67[_0x5df5('0x23')]()[_0x5df5('0x22')](function(){var _0x8742a7=_0x59ff67[_0x5df5('0x24')]({'plain':!![]});var _0x5ca542=_0x5df5('0x25');return db[_0x5df5('0x26')][_0x5df5('0x23')]({'where':{'type':_0x5ca542,'resourceId':_0x8742a7['id']}})['then'](function(){return _0x59ff67;});})['then'](function(){_0x28efc8['status'](0xcc)[_0x5df5('0x19')]();});}};}function handleEntityNotFound(_0x3ff82e,_0x4292a0){return function(_0xa7f4b3){if(!_0xa7f4b3){_0x3ff82e[_0x5df5('0x17')](0x194);}return _0xa7f4b3;};}function handleError(_0x1fd83c,_0x210d20){_0x210d20=_0x210d20||0x1f4;return function(_0x28723e){logger['error'](_0x28723e[_0x5df5('0x27')]);if(_0x28723e['name']){delete _0x28723e[_0x5df5('0x28')];}_0x1fd83c[_0x5df5('0x18')](_0x210d20)['send'](_0x28723e);};}exports[_0x5df5('0x29')]=function(_0x4945c6,_0xd2b213){var _0x4cccf1={},_0x2e1885={},_0x4afe36={'count':0x0,'rows':[]};var _0x309506=_['map'](db[_0x5df5('0x2a')][_0x5df5('0x2b')],function(_0x4784ca){return{'name':_0x4784ca['fieldName'],'type':_0x4784ca[_0x5df5('0x2c')][_0x5df5('0x2d')]};});_0x2e1885[_0x5df5('0x2e')]=_[_0x5df5('0x2f')](_0x309506,_0x5df5('0x28'));_0x2e1885[_0x5df5('0x30')]=_[_0x5df5('0x31')](_0x4945c6['query']);_0x2e1885['filters']=_[_0x5df5('0x32')](_0x2e1885[_0x5df5('0x2e')],_0x2e1885[_0x5df5('0x30')]);_0x4cccf1[_0x5df5('0x33')]=_[_0x5df5('0x32')](_0x2e1885[_0x5df5('0x2e')],qs['fields'](_0x4945c6[_0x5df5('0x30')][_0x5df5('0x34')]));_0x4cccf1[_0x5df5('0x33')]=_0x4cccf1[_0x5df5('0x33')]['length']?_0x4cccf1[_0x5df5('0x33')]:_0x2e1885['model'];if(!_0x4945c6[_0x5df5('0x30')][_0x5df5('0x35')]('nolimit')){_0x4cccf1[_0x5df5('0x1c')]=qs['limit'](_0x4945c6[_0x5df5('0x30')][_0x5df5('0x1c')]);_0x4cccf1[_0x5df5('0x1b')]=qs[_0x5df5('0x1b')](_0x4945c6['query'][_0x5df5('0x1b')]);}_0x4cccf1[_0x5df5('0x36')]=qs[_0x5df5('0x37')](_0x4945c6[_0x5df5('0x30')]['sort']);_0x4cccf1[_0x5df5('0x38')]=qs[_0x5df5('0x39')](_[_0x5df5('0x3a')](_0x4945c6[_0x5df5('0x30')],_0x2e1885[_0x5df5('0x39')]),_0x309506);if(_0x4945c6[_0x5df5('0x30')][_0x5df5('0x3b')]){_0x4cccf1['where']=_[_0x5df5('0x3c')](_0x4cccf1[_0x5df5('0x38')],{'$or':_['map'](_0x309506,function(_0x690134){if(_0x690134[_0x5df5('0x2c')]!=='VIRTUAL'){var _0x2c1bbc={};_0x2c1bbc[_0x690134[_0x5df5('0x28')]]={'$like':'%'+_0x4945c6[_0x5df5('0x30')][_0x5df5('0x3b')]+'%'};return _0x2c1bbc;}})});}_0x4cccf1=_[_0x5df5('0x3c')]({},_0x4cccf1,_0x4945c6[_0x5df5('0x3d')]);var _0x36d75d={'where':_0x4cccf1[_0x5df5('0x38')]};return db['CmHopperAdditionalPhone']['count'](_0x36d75d)[_0x5df5('0x22')](function(_0x5b06f4){_0x4afe36[_0x5df5('0x3e')]=_0x5b06f4;if(_0x4945c6[_0x5df5('0x30')]['includeAll']){_0x4cccf1[_0x5df5('0x3f')]=[{'all':!![]}];}return db[_0x5df5('0x2a')][_0x5df5('0x40')](_0x4cccf1);})[_0x5df5('0x22')](function(_0x2cb16f){_0x4afe36[_0x5df5('0x41')]=_0x2cb16f;return _0x4afe36;})[_0x5df5('0x22')](respondWithFilteredResult(_0xd2b213,_0x4cccf1))[_0x5df5('0x42')](handleError(_0xd2b213,null));};exports['show']=function(_0x42b562,_0x4a4057){var _0xb7dc25={'raw':!![],'where':{'id':_0x42b562[_0x5df5('0x43')]['id']}},_0x3360e5={};_0x3360e5[_0x5df5('0x2e')]=_[_0x5df5('0x31')](db['CmHopperAdditionalPhone'][_0x5df5('0x2b')]);_0x3360e5[_0x5df5('0x30')]=_[_0x5df5('0x31')](_0x42b562['query']);_0x3360e5[_0x5df5('0x39')]=_[_0x5df5('0x32')](_0x3360e5['model'],_0x3360e5[_0x5df5('0x30')]);_0xb7dc25[_0x5df5('0x33')]=_[_0x5df5('0x32')](_0x3360e5[_0x5df5('0x2e')],qs['fields'](_0x42b562[_0x5df5('0x30')][_0x5df5('0x34')]));_0xb7dc25['attributes']=_0xb7dc25[_0x5df5('0x33')][_0x5df5('0x44')]?_0xb7dc25[_0x5df5('0x33')]:_0x3360e5['model'];if(_0x42b562[_0x5df5('0x30')][_0x5df5('0x45')]){_0xb7dc25[_0x5df5('0x3f')]=[{'all':!![]}];}_0xb7dc25=_[_0x5df5('0x3c')]({},_0xb7dc25,_0x42b562['options']);return db[_0x5df5('0x2a')][_0x5df5('0x46')](_0xb7dc25)[_0x5df5('0x22')](handleEntityNotFound(_0x4a4057,null))[_0x5df5('0x22')](respondWithResult(_0x4a4057,null))[_0x5df5('0x42')](handleError(_0x4a4057,null));};exports['create']=function(_0x5c3dc0,_0x9e2e75){return db['CmHopperAdditionalPhone'][_0x5df5('0x47')](_0x5c3dc0[_0x5df5('0x48')],{})[_0x5df5('0x22')](function(_0x28108e){var _0x48462e=_0x5c3dc0[_0x5df5('0x49')][_0x5df5('0x24')]({'plain':!![]});if(!_0x48462e)throw new Error(_0x5df5('0x4a'));if(_0x48462e[_0x5df5('0x4b')]===_0x5df5('0x49')){var _0x2a25fe=_0x28108e['get']({'plain':!![]});var _0x1bf1e2='CmHopperAdditionalPhones';return db[_0x5df5('0x4c')][_0x5df5('0x46')]({'where':{'name':_0x1bf1e2,'userProfileId':_0x48462e[_0x5df5('0x4d')]},'raw':!![]})['then'](function(_0x8622f4){if(_0x8622f4&&_0x8622f4['autoAssociation']===0x0){return db[_0x5df5('0x26')]['create']({'name':_0x2a25fe[_0x5df5('0x28')],'resourceId':_0x2a25fe['id'],'type':_0x8622f4[_0x5df5('0x28')],'sectionId':_0x8622f4['id']},{})[_0x5df5('0x22')](function(){return _0x28108e;});}else{return _0x28108e;}})['catch'](function(_0x3d92a3){logger[_0x5df5('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d92a3);throw _0x3d92a3;});}return _0x28108e;})[_0x5df5('0x22')](respondWithResult(_0x9e2e75,0xc9))[_0x5df5('0x42')](handleError(_0x9e2e75,null));};exports[_0x5df5('0x21')]=function(_0x9cb30e,_0x20f5e1){if(_0x9cb30e[_0x5df5('0x48')]['id']){delete _0x9cb30e[_0x5df5('0x48')]['id'];}return db['CmHopperAdditionalPhone'][_0x5df5('0x46')]({'where':{'id':_0x9cb30e['params']['id']}})[_0x5df5('0x22')](handleEntityNotFound(_0x20f5e1,null))[_0x5df5('0x22')](saveUpdates(_0x9cb30e[_0x5df5('0x48')],null))[_0x5df5('0x22')](respondWithResult(_0x20f5e1,null))[_0x5df5('0x42')](handleError(_0x20f5e1,null));};exports[_0x5df5('0x23')]=function(_0x306bc8,_0x23e5ca){return db['CmHopperAdditionalPhone'][_0x5df5('0x46')]({'where':{'id':_0x306bc8[_0x5df5('0x43')]['id']}})[_0x5df5('0x22')](handleEntityNotFound(_0x23e5ca,null))[_0x5df5('0x22')](removeEntity(_0x23e5ca,null))[_0x5df5('0x42')](handleError(_0x23e5ca,null));}; \ No newline at end of file +var _0xc051=['hasOwnProperty','nolimit','sort','pick','filter','where','options','includeAll','include','catch','keys','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','get','UserProfileResource','destroy','error','name','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x17e00c,_0xae93a){var _0x175f73=function(_0x57e8e9){while(--_0x57e8e9){_0x17e00c['push'](_0x17e00c['shift']());}};_0x175f73(++_0xae93a);}(_0xc051,0xb5));var _0x1c05=function(_0x3871d6,_0x552214){_0x3871d6=_0x3871d6-0x0;var _0xcaab5=_0xc051[_0x3871d6];return _0xcaab5;};'use strict';var pdf=require(_0x1c05('0x0'));var emlformat=require(_0x1c05('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c05('0x2'));var rp=require(_0x1c05('0x3'));var moment=require(_0x1c05('0x4'));var BPromise=require(_0x1c05('0x5'));var Mustache=require('mustache');var util=require(_0x1c05('0x6'));var path=require(_0x1c05('0x7'));var sox=require(_0x1c05('0x8'));var csv=require(_0x1c05('0x9'));var ejs=require(_0x1c05('0xa'));var fs=require('fs');var _=require(_0x1c05('0xb'));var squel=require(_0x1c05('0xc'));var crypto=require(_0x1c05('0xd'));var jsforce=require(_0x1c05('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1c05('0x9'));var querystring=require(_0x1c05('0xf'));var Papa=require(_0x1c05('0x10'));var Redis=require(_0x1c05('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1c05('0x12'));var as=require(_0x1c05('0x13'));var hardwareService=require(_0x1c05('0x14'));var logger=require(_0x1c05('0x15'))('api');var utils=require(_0x1c05('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1c05('0x17'));var db=require(_0x1c05('0x18'))['db'];function respondWithStatusCode(_0x188301,_0x32cbf0){_0x32cbf0=_0x32cbf0||0xcc;return function(_0x4474ef){if(_0x4474ef){return _0x188301[_0x1c05('0x19')](_0x32cbf0);}return _0x188301[_0x1c05('0x1a')](_0x32cbf0)[_0x1c05('0x1b')]();};}function respondWithResult(_0x4de1c8,_0x2ba5a2){_0x2ba5a2=_0x2ba5a2||0xc8;return function(_0x2bffb8){if(_0x2bffb8){return _0x4de1c8[_0x1c05('0x1a')](_0x2ba5a2)['json'](_0x2bffb8);}};}function respondWithFilteredResult(_0x8fe340,_0x175166){return function(_0x26a61e){if(_0x26a61e){var _0x568633=_0x26a61e[_0x1c05('0x1c')],_0x1e713f=_0x175166[_0x1c05('0x1d')],_0x49b538=_0x175166[_0x1c05('0x1d')]+_0x175166[_0x1c05('0x1e')],_0x2ad711;if(_0x49b538>=_0x568633){_0x49b538=_0x568633;_0x2ad711=0xc8;}else{_0x2ad711=0xce;}_0x8fe340['status'](_0x2ad711);return _0x8fe340[_0x1c05('0x1f')](_0x1c05('0x20'),_0x1e713f+'-'+_0x49b538+'/'+_0x568633)[_0x1c05('0x21')](_0x26a61e);}return null;};}function patchUpdates(_0x4d0680){return function(_0x2e177c){try{jsonpatch[_0x1c05('0x22')](_0x2e177c,_0x4d0680,!![]);}catch(_0x3176c0){return BPromise['reject'](_0x3176c0);}return _0x2e177c[_0x1c05('0x23')]();};}function saveUpdates(_0x32cce1,_0x4a4bff){return function(_0x5696ce){if(_0x5696ce){return _0x5696ce[_0x1c05('0x24')](_0x32cce1)['then'](function(_0x48400c){return _0x48400c;});}return null;};}function removeEntity(_0x549b51,_0x31beae){return function(_0xcce64e){if(_0xcce64e){return _0xcce64e['destroy']()[_0x1c05('0x25')](function(){var _0x357401=_0xcce64e[_0x1c05('0x26')]({'plain':!![]});var _0x2cf340='CmHopperAdditionalPhones';return db[_0x1c05('0x27')][_0x1c05('0x28')]({'where':{'type':_0x2cf340,'resourceId':_0x357401['id']}})[_0x1c05('0x25')](function(){return _0xcce64e;});})[_0x1c05('0x25')](function(){_0x549b51[_0x1c05('0x1a')](0xcc)[_0x1c05('0x1b')]();});}};}function handleEntityNotFound(_0x56c701,_0xa841fb){return function(_0x1dd767){if(!_0x1dd767){_0x56c701[_0x1c05('0x19')](0x194);}return _0x1dd767;};}function handleError(_0x334a42,_0xbcd61a){_0xbcd61a=_0xbcd61a||0x1f4;return function(_0x127190){logger[_0x1c05('0x29')](_0x127190['stack']);if(_0x127190[_0x1c05('0x2a')]){delete _0x127190[_0x1c05('0x2a')];}_0x334a42[_0x1c05('0x1a')](_0xbcd61a)['send'](_0x127190);};}exports['index']=function(_0x21594d,_0x1d548e){var _0x1ca0de={},_0x404b36={},_0x2a9c74={'count':0x0,'rows':[]};var _0x438f4d=_[_0x1c05('0x2b')](db[_0x1c05('0x2c')][_0x1c05('0x2d')],function(_0x3a9abb){return{'name':_0x3a9abb[_0x1c05('0x2e')],'type':_0x3a9abb[_0x1c05('0x2f')][_0x1c05('0x30')]};});_0x404b36[_0x1c05('0x31')]=_['map'](_0x438f4d,_0x1c05('0x2a'));_0x404b36['query']=_['keys'](_0x21594d[_0x1c05('0x32')]);_0x404b36[_0x1c05('0x33')]=_[_0x1c05('0x34')](_0x404b36[_0x1c05('0x31')],_0x404b36['query']);_0x1ca0de[_0x1c05('0x35')]=_['intersection'](_0x404b36[_0x1c05('0x31')],qs['fields'](_0x21594d[_0x1c05('0x32')][_0x1c05('0x36')]));_0x1ca0de[_0x1c05('0x35')]=_0x1ca0de[_0x1c05('0x35')][_0x1c05('0x37')]?_0x1ca0de[_0x1c05('0x35')]:_0x404b36[_0x1c05('0x31')];if(!_0x21594d[_0x1c05('0x32')][_0x1c05('0x38')](_0x1c05('0x39'))){_0x1ca0de[_0x1c05('0x1e')]=qs[_0x1c05('0x1e')](_0x21594d[_0x1c05('0x32')][_0x1c05('0x1e')]);_0x1ca0de[_0x1c05('0x1d')]=qs[_0x1c05('0x1d')](_0x21594d[_0x1c05('0x32')][_0x1c05('0x1d')]);}_0x1ca0de['order']=qs[_0x1c05('0x3a')](_0x21594d[_0x1c05('0x32')]['sort']);_0x1ca0de['where']=qs[_0x1c05('0x33')](_[_0x1c05('0x3b')](_0x21594d[_0x1c05('0x32')],_0x404b36['filters']),_0x438f4d);if(_0x21594d[_0x1c05('0x32')][_0x1c05('0x3c')]){_0x1ca0de[_0x1c05('0x3d')]=_['merge'](_0x1ca0de[_0x1c05('0x3d')],{'$or':_[_0x1c05('0x2b')](_0x438f4d,function(_0x2079cc){if(_0x2079cc['type']!=='VIRTUAL'){var _0x515b3d={};_0x515b3d[_0x2079cc['name']]={'$like':'%'+_0x21594d[_0x1c05('0x32')]['filter']+'%'};return _0x515b3d;}})});}_0x1ca0de=_['merge']({},_0x1ca0de,_0x21594d[_0x1c05('0x3e')]);var _0x35de2a={'where':_0x1ca0de[_0x1c05('0x3d')]};return db['CmHopperAdditionalPhone'][_0x1c05('0x1c')](_0x35de2a)[_0x1c05('0x25')](function(_0x2b0605){_0x2a9c74[_0x1c05('0x1c')]=_0x2b0605;if(_0x21594d[_0x1c05('0x32')][_0x1c05('0x3f')]){_0x1ca0de[_0x1c05('0x40')]=[{'all':!![]}];}return db[_0x1c05('0x2c')]['findAll'](_0x1ca0de);})[_0x1c05('0x25')](function(_0x223a30){_0x2a9c74['rows']=_0x223a30;return _0x2a9c74;})[_0x1c05('0x25')](respondWithFilteredResult(_0x1d548e,_0x1ca0de))[_0x1c05('0x41')](handleError(_0x1d548e,null));};exports['show']=function(_0x28ae69,_0x12bc9f){var _0x315604={'raw':!![],'where':{'id':_0x28ae69['params']['id']}},_0x32b117={};_0x32b117[_0x1c05('0x31')]=_['keys'](db['CmHopperAdditionalPhone'][_0x1c05('0x2d')]);_0x32b117[_0x1c05('0x32')]=_[_0x1c05('0x42')](_0x28ae69['query']);_0x32b117[_0x1c05('0x33')]=_['intersection'](_0x32b117[_0x1c05('0x31')],_0x32b117['query']);_0x315604[_0x1c05('0x35')]=_[_0x1c05('0x34')](_0x32b117['model'],qs[_0x1c05('0x36')](_0x28ae69[_0x1c05('0x32')][_0x1c05('0x36')]));_0x315604[_0x1c05('0x35')]=_0x315604[_0x1c05('0x35')][_0x1c05('0x37')]?_0x315604[_0x1c05('0x35')]:_0x32b117[_0x1c05('0x31')];if(_0x28ae69[_0x1c05('0x32')]['includeAll']){_0x315604[_0x1c05('0x40')]=[{'all':!![]}];}_0x315604=_[_0x1c05('0x43')]({},_0x315604,_0x28ae69[_0x1c05('0x3e')]);return db['CmHopperAdditionalPhone'][_0x1c05('0x44')](_0x315604)[_0x1c05('0x25')](handleEntityNotFound(_0x12bc9f,null))[_0x1c05('0x25')](respondWithResult(_0x12bc9f,null))[_0x1c05('0x41')](handleError(_0x12bc9f,null));};exports[_0x1c05('0x45')]=function(_0x2158d7,_0xfa3a5e){return db[_0x1c05('0x2c')][_0x1c05('0x45')](_0x2158d7[_0x1c05('0x46')],{})[_0x1c05('0x25')](function(_0x4dc4fb){var _0x3626c4=_0x2158d7['user'][_0x1c05('0x26')]({'plain':!![]});if(!_0x3626c4)throw new Error(_0x1c05('0x47'));if(_0x3626c4[_0x1c05('0x48')]==='user'){var _0x10f511=_0x4dc4fb['get']({'plain':!![]});var _0x1df18b=_0x1c05('0x49');return db[_0x1c05('0x4a')][_0x1c05('0x44')]({'where':{'name':_0x1df18b,'userProfileId':_0x3626c4[_0x1c05('0x4b')]},'raw':!![]})[_0x1c05('0x25')](function(_0x3be46e){if(_0x3be46e&&_0x3be46e[_0x1c05('0x4c')]===0x0){return db[_0x1c05('0x27')]['create']({'name':_0x10f511[_0x1c05('0x2a')],'resourceId':_0x10f511['id'],'type':_0x3be46e[_0x1c05('0x2a')],'sectionId':_0x3be46e['id']},{})[_0x1c05('0x25')](function(){return _0x4dc4fb;});}else{return _0x4dc4fb;}})[_0x1c05('0x41')](function(_0x164328){logger[_0x1c05('0x29')](_0x1c05('0x4d'),_0x164328);throw _0x164328;});}return _0x4dc4fb;})[_0x1c05('0x25')](respondWithResult(_0xfa3a5e,0xc9))[_0x1c05('0x41')](handleError(_0xfa3a5e,null));};exports[_0x1c05('0x24')]=function(_0x204d09,_0x23422c){if(_0x204d09[_0x1c05('0x46')]['id']){delete _0x204d09[_0x1c05('0x46')]['id'];}return db[_0x1c05('0x2c')][_0x1c05('0x44')]({'where':{'id':_0x204d09[_0x1c05('0x4e')]['id']}})['then'](handleEntityNotFound(_0x23422c,null))[_0x1c05('0x25')](saveUpdates(_0x204d09['body'],null))[_0x1c05('0x25')](respondWithResult(_0x23422c,null))[_0x1c05('0x41')](handleError(_0x23422c,null));};exports['destroy']=function(_0x4077d9,_0x45de8a){return db[_0x1c05('0x2c')][_0x1c05('0x44')]({'where':{'id':_0x4077d9[_0x1c05('0x4e')]['id']}})['then'](handleEntityNotFound(_0x45de8a,null))[_0x1c05('0x25')](removeEntity(_0x45de8a,null))['catch'](handleError(_0x45de8a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 85cacc3..00c52dc 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9080=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','cm_hopper_additional_phones'];(function(_0x21bad5,_0x23a39d){var _0x235106=function(_0x281b1f){while(--_0x281b1f){_0x21bad5['push'](_0x21bad5['shift']());}};_0x235106(++_0x23a39d);}(_0x9080,0x120));var _0x0908=function(_0xc1db1a,_0x3afe5a){_0xc1db1a=_0xc1db1a-0x0;var _0x18f2a1=_0x9080[_0xc1db1a];return _0x18f2a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0908('0x0'))('api');var moment=require(_0x0908('0x1'));var BPromise=require(_0x0908('0x2'));var rp=require(_0x0908('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0908('0x4'));var config=require(_0x0908('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x0908('0x6')]=function(_0x3add9a,_0x162cc7){return _0x3add9a['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x0908('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f5f=['exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x83221c,_0x3975ef){var _0x2fa1fc=function(_0x26d691){while(--_0x26d691){_0x83221c['push'](_0x83221c['shift']());}};_0x2fa1fc(++_0x3975ef);}(_0x1f5f,0x194));var _0xf1f5=function(_0x3312ed,_0x3a7734){_0x3312ed=_0x3312ed-0x0;var _0x1844b5=_0x1f5f[_0x3312ed];return _0x1844b5;};'use strict';var _=require('lodash');var util=require(_0xf1f5('0x0'));var logger=require(_0xf1f5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf1f5('0x2'));var fs=require('fs');var path=require(_0xf1f5('0x3'));var rimraf=require(_0xf1f5('0x4'));var config=require(_0xf1f5('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xf1f5('0x6')]=function(_0x3f8157,_0x699611){return _0x3f8157[_0xf1f5('0x7')](_0xf1f5('0x8'),attributes,{'tableName':_0xf1f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index ecd43c5..95e0298 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9aed=['CmHopper','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','entity','dialGlobalMaxRetry','countmachineretry','countagentrejectretry','ContactId','ListId','duration','waitTime','add','scheduledat','minutes','phone','countnosuchnumberretry','createdAt','updatedAt','isNil','hopperToAdd','additionalToHop','sequelize','update','IncrementPreviewCounters','field','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones'];(function(_0x3238bd,_0x579faa){var _0x3a6e6f=function(_0x20e84e){while(--_0x20e84e){_0x3238bd['push'](_0x3238bd['shift']());}};_0x3a6e6f(++_0x579faa);}(_0x9aed,0x99));var _0xd9ae=function(_0x413935,_0x4c8d15){_0x413935=_0x413935-0x0;var _0x13b8d0=_0x9aed[_0x413935];return _0x13b8d0;};'use strict';var _=require(_0xd9ae('0x0'));var util=require('util');var moment=require(_0xd9ae('0x1'));var BPromise=require('bluebird');var rs=require(_0xd9ae('0x2'));var fs=require('fs');var Redis=require(_0xd9ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd9ae('0x4'))(_0xd9ae('0x5'));var config=require(_0xd9ae('0x6'));var jayson=require(_0xd9ae('0x7'));var client=jayson[_0xd9ae('0x8')][_0xd9ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x398186,_0x22b14e,_0x5e96b5){return new BPromise(function(_0x56f596,_0x400488){return client[_0xd9ae('0xa')](_0x398186,_0x5e96b5)[_0xd9ae('0xb')](function(_0x2db4f3){logger[_0xd9ae('0xc')](_0xd9ae('0xd'),_0x22b14e,_0xd9ae('0xe'));logger[_0xd9ae('0xf')](_0xd9ae('0x10'),_0x22b14e,_0xd9ae('0xe'),JSON[_0xd9ae('0x11')](_0x2db4f3));if(_0x2db4f3[_0xd9ae('0x12')]){if(_0x2db4f3[_0xd9ae('0x12')][_0xd9ae('0x13')]===0x1f4){logger[_0xd9ae('0x12')](_0xd9ae('0xd'),_0x22b14e,_0x2db4f3[_0xd9ae('0x12')][_0xd9ae('0x14')]);return _0x400488(_0x2db4f3[_0xd9ae('0x12')][_0xd9ae('0x14')]);}logger[_0xd9ae('0x12')](_0xd9ae('0xd'),_0x22b14e,_0x2db4f3['error'][_0xd9ae('0x14')]);return _0x56f596(_0x2db4f3['error'][_0xd9ae('0x14')]);}else{logger[_0xd9ae('0xc')](_0xd9ae('0xd'),_0x22b14e,_0xd9ae('0xe'));_0x56f596(_0x2db4f3[_0xd9ae('0x15')]['message']);}})[_0xd9ae('0x16')](function(_0x30ad08){logger[_0xd9ae('0x12')](_0xd9ae('0xd'),_0x22b14e,_0x30ad08);_0x400488(_0x30ad08);});});}exports[_0xd9ae('0x17')]=function(_0x3fc73c){var _0x8c34e0=this;return new Promise(function(_0x3c92ee,_0x5563fc){return db[_0xd9ae('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x3fc73c['body']['ContactId'],'ListId':_0x3fc73c[_0xd9ae('0x19')]['ListId'],'VoiceQueueId':_0x3fc73c[_0xd9ae('0x19')]['VoiceQueueId']===undefined?null:_0x3fc73c[_0xd9ae('0x19')][_0xd9ae('0x1a')],'CampaignId':_0x3fc73c[_0xd9ae('0x19')][_0xd9ae('0x1b')]===undefined?null:_0x3fc73c[_0xd9ae('0x19')][_0xd9ae('0x1b')]}})[_0xd9ae('0xb')](function(_0xe1d24b){if(_0xe1d24b!=null){return db[_0xd9ae('0x1c')][_0xd9ae('0x1d')]({'raw':!![],'where':{'CmHopperId':_0xe1d24b['id'],'OrderBy':{'$gt':_0xe1d24b[_0xd9ae('0x1e')]}},'order':[[_0xd9ae('0x1e'),_0xd9ae('0x1f')]]})[_0xd9ae('0xb')](function(_0x155264){var _0x24556a=0x0;if(_0x155264){if(_0x155264[_0xd9ae('0x20')]+_0x155264[_0xd9ae('0x21')]+_0x155264[_0xd9ae('0x22')]+_0x155264['countnosuchnumberretry']+_0x155264[_0xd9ae('0x23')]+_0x155264[_0xd9ae('0x24')]+_0x155264['countmachineretry']+_0x155264['countagentrejectretry']<_0x3fc73c[_0xd9ae('0x25')][_0xd9ae('0x26')])_0x24556a=0x1;_0x3c92ee({'additional':_0x24556a});}else{return db[_0xd9ae('0x1c')][_0xd9ae('0x1d')]({'raw':!![],'where':{'CmHopperId':_0xe1d24b['id']},'order':[[_0xd9ae('0x1e'),_0xd9ae('0x1f')]]})[_0xd9ae('0xb')](function(_0x5ca039){var _0x58470e=0x0;if(_0x5ca039){if(_0x5ca039[_0xd9ae('0x20')]+_0x5ca039[_0xd9ae('0x21')]+_0x5ca039[_0xd9ae('0x22')]+_0x5ca039['countnosuchnumberretry']+_0x5ca039[_0xd9ae('0x23')]+_0x5ca039[_0xd9ae('0x24')]+_0x5ca039[_0xd9ae('0x27')]+_0x5ca039[_0xd9ae('0x28')]<_0x3fc73c[_0xd9ae('0x25')]['dialGlobalMaxRetry'])_0x58470e=0x1;_0x3c92ee({'additional':_0x58470e});}else{_0x3c92ee({'additional':0x0});}})[_0xd9ae('0x16')](function(_0x21ef3d){logger[_0xd9ae('0x12')](_0xd9ae('0x17'),_0x21ef3d[_0xd9ae('0x14')],_0x3fc73c);_0x5563fc(_0x8c34e0[_0xd9ae('0x12')](0x1f4,_0x21ef3d[_0xd9ae('0x14')]));});}})[_0xd9ae('0x16')](function(_0x13148e){logger[_0xd9ae('0x12')](_0xd9ae('0x17'),_0x13148e['message'],_0x3fc73c);_0x5563fc(_0x8c34e0[_0xd9ae('0x12')](0x1f4,_0x13148e[_0xd9ae('0x14')]));});}else _0x3c92ee({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x2367e8){var _0x3f3cad=this;return new Promise(function(_0x5ad1a7,_0x2d66ff){return db[_0xd9ae('0x18')][_0xd9ae('0x1d')]({'raw':!![],'where':{'ContactId':_0x2367e8['body'][_0xd9ae('0x29')],'ListId':_0x2367e8[_0xd9ae('0x19')][_0xd9ae('0x2a')],'VoiceQueueId':_0x2367e8[_0xd9ae('0x19')][_0xd9ae('0x1a')]===undefined?null:_0x2367e8[_0xd9ae('0x19')][_0xd9ae('0x1a')],'CampaignId':_0x2367e8['body']['CampaignId']===undefined?null:_0x2367e8[_0xd9ae('0x19')][_0xd9ae('0x1b')]}})[_0xd9ae('0xb')](function(_0x15b272){if(_0x15b272!=null){return db[_0xd9ae('0x1c')][_0xd9ae('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x15b272['id'],'OrderBy':{'$gt':_0x15b272['OrderBy']}},'order':[['OrderBy',_0xd9ae('0x1f')]]})[_0xd9ae('0xb')](function(_0x400db8){if(_0x400db8)return activateAdditionalPhone(_0x15b272,_0x2367e8[_0xd9ae('0x19')],_0x400db8,_0x2367e8[_0xd9ae('0x2b')],_0x2367e8[_0xd9ae('0x2c')])[_0xd9ae('0xb')](function(_0x1ee057){_0x5ad1a7(_0x1ee057);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x15b272['id']},'order':[[_0xd9ae('0x1e'),_0xd9ae('0x1f')]]})[_0xd9ae('0xb')](function(_0x5508d4){if(_0x5508d4)return activateAdditionalPhone(_0x15b272,_0x2367e8[_0xd9ae('0x19')],_0x5508d4,_0x2367e8[_0xd9ae('0x2b')],_0x2367e8[_0xd9ae('0x2c')])[_0xd9ae('0xb')](function(_0x301270){_0x5ad1a7(_0x301270);});else{_0x5ad1a7({'id':_0x15b272['id'],'phone':''});}})[_0xd9ae('0x16')](function(_0x1ab963){logger[_0xd9ae('0x12')](_0xd9ae('0x17'),_0x1ab963[_0xd9ae('0x14')],_0x2367e8);_0x2d66ff(_0x3f3cad[_0xd9ae('0x12')](0x1f4,_0x1ab963[_0xd9ae('0x14')]));});}})[_0xd9ae('0x16')](function(_0x10be2e){logger['error'](_0xd9ae('0x17'),_0x10be2e['message'],_0x2367e8);_0x2d66ff(_0x3f3cad['error'](0x1f4,_0x10be2e['message']));});}else _0x5ad1a7(0x1);});});};function activateAdditionalPhone(_0x26ce31,_0x5cf2e0,_0x38eb05,_0x44416b,_0xf40ae5){return new Promise(function(_0x4e6e51,_0xba6342){logger[_0xd9ae('0xc')](_0xd9ae('0x17'),_0x38eb05);var _0x2e34f4;if(moment()>moment(_0x38eb05['scheduledat'])){_0x2e34f4=moment()[_0xd9ae('0x2d')](_0xf40ae5||0x3,'minutes');}else{if(_0x38eb05[_0xd9ae('0x1e')]==0x0){_0x2e34f4=moment(_0x38eb05[_0xd9ae('0x2e')]);}else{_0x2e34f4=moment()[_0xd9ae('0x2d')](_0xf40ae5||0x3,_0xd9ae('0x2f'));}}var _0x5dbe46={'phone':_0x26ce31[_0xd9ae('0x30')],'active':0x0,'OrderBy':_['isNil'](_0x26ce31[_0xd9ae('0x1e')])?0x0:_0x26ce31['OrderBy'],'scheduledat':moment()[_0xd9ae('0x2d')](_0x44416b||0x1,_0xd9ae('0x2f')),'countbusyretry':_0x5cf2e0['countbusyretry'],'countcongestionretry':_0x5cf2e0[_0xd9ae('0x21')],'countnoanswerretry':_0x5cf2e0[_0xd9ae('0x22')],'countnosuchnumberretry':_0x5cf2e0[_0xd9ae('0x31')],'countdropretry':_0x5cf2e0[_0xd9ae('0x23')],'countabandonedretry':_0x5cf2e0['countabandonedretry'],'countmachineretry':_0x5cf2e0[_0xd9ae('0x27')],'countagentrejectretry':_0x5cf2e0['countagentrejectretry'],'createdAt':_0x5cf2e0[_0xd9ae('0x32')],'updatedAt':_0x5cf2e0[_0xd9ae('0x33')]};var _0xa64170={'CmHopperId':_0x26ce31['id'],'phone':_0x38eb05['phone'],'active':0x0,'OrderBy':_[_0xd9ae('0x34')](_0x38eb05[_0xd9ae('0x1e')])?0x0:_0x38eb05['OrderBy'],'scheduledat':_0x2e34f4,'countbusyretry':_0x38eb05[_0xd9ae('0x20')],'countcongestionretry':_0x38eb05[_0xd9ae('0x21')],'countnoanswerretry':_0x38eb05[_0xd9ae('0x22')],'countnosuchnumberretry':_0x5cf2e0[_0xd9ae('0x31')],'countdropretry':_0x5cf2e0[_0xd9ae('0x23')],'countabandonedretry':_0x5cf2e0[_0xd9ae('0x24')],'countmachineretry':_0x5cf2e0[_0xd9ae('0x27')],'countagentrejectretry':_0x5cf2e0[_0xd9ae('0x28')],'createdAt':_0x38eb05[_0xd9ae('0x32')],'updatedAt':_0x38eb05['updatedAt']};logger[_0xd9ae('0xc')](_0xd9ae('0x35'),_0x5dbe46);logger[_0xd9ae('0xc')](_0xd9ae('0x36'),_0xa64170);return db[_0xd9ae('0x37')]['transaction'](function(_0xd736f2){return db[_0xd9ae('0x1c')][_0xd9ae('0x38')](_0x5dbe46,{'where':{'id':_0x38eb05['id']}},{'transaction':_0xd736f2})[_0xd9ae('0xb')](function(){return db['CmHopper'][_0xd9ae('0x38')](_0xa64170,{'where':{'id':_0x26ce31['id']}},{'transaction':_0xd736f2});});})['then'](function(_0x56b034){_0x4e6e51({'id':_0x26ce31['id'],'phone':_0x38eb05[_0xd9ae('0x30')]});})[_0xd9ae('0x16')](function(_0xd4eb3d){logger[_0xd9ae('0x12')](_0xd9ae('0x17'),_0xd4eb3d[_0xd9ae('0x14')],req);_0xba6342(_this[_0xd9ae('0x12')](0x1f4,_0xd4eb3d[_0xd9ae('0x14')]));});});}exports[_0xd9ae('0x39')]=function(_0x56d201){var _0x501d00=this;return new Promise(function(_0x5c2dff,_0x5a9286){return db['CmHopper'][_0xd9ae('0x38')](_0x56d201[_0xd9ae('0x19')][_0xd9ae('0x3a')],{'where':{'id':_0x56d201[_0xd9ae('0x19')]['id']}})[_0xd9ae('0xb')](function(_0x13c9ff){_0x5c2dff(_0x13c9ff);})['catch'](function(_0xa1252e){logger[_0xd9ae('0x12')]('IncrementPreviewCounters',_0xa1252e[_0xd9ae('0x14')],_0x56d201);_0x5a9286(_0x501d00[_0xd9ae('0x12')](0x1f4,_0xa1252e['message']));});});}; \ No newline at end of file +var _0xe3d9=['phone','countbusyretry','countcongestionretry','createdAt','updatedAt','isNil','countnosuchnumberretry','additionalToHop','sequelize','update','IncrementPreviewCounters','field','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','ListId','duration','waitTime','scheduledat','add','minutes'];(function(_0x135fe1,_0x36f285){var _0x29624d=function(_0x1ad7a4){while(--_0x1ad7a4){_0x135fe1['push'](_0x135fe1['shift']());}};_0x29624d(++_0x36f285);}(_0xe3d9,0x7e));var _0x9e3d=function(_0x208a7c,_0x266eda){_0x208a7c=_0x208a7c-0x0;var _0x2744e3=_0xe3d9[_0x208a7c];return _0x2744e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9e3d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e3d('0x1'));var db=require(_0x9e3d('0x2'))['db'];var utils=require(_0x9e3d('0x3'));var logger=require(_0x9e3d('0x4'))(_0x9e3d('0x5'));var config=require(_0x9e3d('0x6'));var jayson=require(_0x9e3d('0x7'));var client=jayson[_0x9e3d('0x8')][_0x9e3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b6ace,_0x4c9713,_0x42783c){return new BPromise(function(_0x38704c,_0x46cad1){return client[_0x9e3d('0xa')](_0x2b6ace,_0x42783c)[_0x9e3d('0xb')](function(_0x56ea3e){logger['info'](_0x9e3d('0xc'),_0x4c9713,_0x9e3d('0xd'));logger[_0x9e3d('0xe')](_0x9e3d('0xf'),_0x4c9713,_0x9e3d('0xd'),JSON['stringify'](_0x56ea3e));if(_0x56ea3e[_0x9e3d('0x10')]){if(_0x56ea3e[_0x9e3d('0x10')]['code']===0x1f4){logger['error'](_0x9e3d('0xc'),_0x4c9713,_0x56ea3e[_0x9e3d('0x10')][_0x9e3d('0x11')]);return _0x46cad1(_0x56ea3e['error'][_0x9e3d('0x11')]);}logger[_0x9e3d('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4c9713,_0x56ea3e[_0x9e3d('0x10')][_0x9e3d('0x11')]);return _0x38704c(_0x56ea3e[_0x9e3d('0x10')][_0x9e3d('0x11')]);}else{logger[_0x9e3d('0x12')](_0x9e3d('0xc'),_0x4c9713,_0x9e3d('0xd'));_0x38704c(_0x56ea3e[_0x9e3d('0x13')]['message']);}})[_0x9e3d('0x14')](function(_0x1a1870){logger[_0x9e3d('0x10')](_0x9e3d('0xc'),_0x4c9713,_0x1a1870);_0x46cad1(_0x1a1870);});});}exports[_0x9e3d('0x15')]=function(_0x1e4f6e){var _0x493f66=this;return new Promise(function(_0x287319,_0x5b5761){return db[_0x9e3d('0x16')][_0x9e3d('0x17')]({'raw':!![],'where':{'ContactId':_0x1e4f6e['body'][_0x9e3d('0x18')],'ListId':_0x1e4f6e[_0x9e3d('0x19')]['ListId'],'VoiceQueueId':_0x1e4f6e['body'][_0x9e3d('0x1a')]===undefined?null:_0x1e4f6e[_0x9e3d('0x19')][_0x9e3d('0x1a')],'CampaignId':_0x1e4f6e[_0x9e3d('0x19')]['CampaignId']===undefined?null:_0x1e4f6e[_0x9e3d('0x19')][_0x9e3d('0x1b')]}})[_0x9e3d('0xb')](function(_0x173751){if(_0x173751!=null){return db[_0x9e3d('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x173751['id'],'OrderBy':{'$gt':_0x173751['OrderBy']}},'order':[[_0x9e3d('0x1d'),_0x9e3d('0x1e')]]})[_0x9e3d('0xb')](function(_0x4fef6c){var _0x534827=0x0;if(_0x4fef6c){if(_0x4fef6c['countbusyretry']+_0x4fef6c['countcongestionretry']+_0x4fef6c[_0x9e3d('0x1f')]+_0x4fef6c['countnosuchnumberretry']+_0x4fef6c[_0x9e3d('0x20')]+_0x4fef6c[_0x9e3d('0x21')]+_0x4fef6c[_0x9e3d('0x22')]+_0x4fef6c[_0x9e3d('0x23')]<_0x1e4f6e[_0x9e3d('0x24')]['dialGlobalMaxRetry'])_0x534827=0x1;_0x287319({'additional':_0x534827});}else{return db[_0x9e3d('0x1c')][_0x9e3d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x173751['id']},'order':[[_0x9e3d('0x1d'),'ASC']]})[_0x9e3d('0xb')](function(_0x5afbed){var _0x162046=0x0;if(_0x5afbed){if(_0x5afbed['countbusyretry']+_0x5afbed['countcongestionretry']+_0x5afbed['countnoanswerretry']+_0x5afbed['countnosuchnumberretry']+_0x5afbed['countdropretry']+_0x5afbed['countabandonedretry']+_0x5afbed[_0x9e3d('0x22')]+_0x5afbed[_0x9e3d('0x23')]<_0x1e4f6e[_0x9e3d('0x24')][_0x9e3d('0x25')])_0x162046=0x1;_0x287319({'additional':_0x162046});}else{_0x287319({'additional':0x0});}})[_0x9e3d('0x14')](function(_0x924625){logger[_0x9e3d('0x10')](_0x9e3d('0x15'),_0x924625[_0x9e3d('0x11')],_0x1e4f6e);_0x5b5761(_0x493f66[_0x9e3d('0x10')](0x1f4,_0x924625[_0x9e3d('0x11')]));});}})[_0x9e3d('0x14')](function(_0x3aacd5){logger[_0x9e3d('0x10')](_0x9e3d('0x15'),_0x3aacd5['message'],_0x1e4f6e);_0x5b5761(_0x493f66[_0x9e3d('0x10')](0x1f4,_0x3aacd5[_0x9e3d('0x11')]));});}else _0x287319({'additional':0x0});});});};exports[_0x9e3d('0x26')]=function(_0xfecdd0){var _0x1569c2=this;return new Promise(function(_0x357d5d,_0x3e9dd2){return db[_0x9e3d('0x16')][_0x9e3d('0x17')]({'raw':!![],'where':{'ContactId':_0xfecdd0['body'][_0x9e3d('0x18')],'ListId':_0xfecdd0['body'][_0x9e3d('0x27')],'VoiceQueueId':_0xfecdd0[_0x9e3d('0x19')][_0x9e3d('0x1a')]===undefined?null:_0xfecdd0[_0x9e3d('0x19')][_0x9e3d('0x1a')],'CampaignId':_0xfecdd0[_0x9e3d('0x19')][_0x9e3d('0x1b')]===undefined?null:_0xfecdd0[_0x9e3d('0x19')]['CampaignId']}})[_0x9e3d('0xb')](function(_0x5c02d6){if(_0x5c02d6!=null){return db[_0x9e3d('0x1c')][_0x9e3d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5c02d6['id'],'OrderBy':{'$gt':_0x5c02d6[_0x9e3d('0x1d')]}},'order':[['OrderBy','ASC']]})[_0x9e3d('0xb')](function(_0x211129){if(_0x211129)return activateAdditionalPhone(_0x5c02d6,_0xfecdd0['body'],_0x211129,_0xfecdd0[_0x9e3d('0x28')],_0xfecdd0[_0x9e3d('0x29')])[_0x9e3d('0xb')](function(_0x2e4339){_0x357d5d(_0x2e4339);});else{return db[_0x9e3d('0x1c')][_0x9e3d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5c02d6['id']},'order':[[_0x9e3d('0x1d'),_0x9e3d('0x1e')]]})[_0x9e3d('0xb')](function(_0x47605a){if(_0x47605a)return activateAdditionalPhone(_0x5c02d6,_0xfecdd0[_0x9e3d('0x19')],_0x47605a,_0xfecdd0[_0x9e3d('0x28')],_0xfecdd0[_0x9e3d('0x29')])['then'](function(_0x137e7b){_0x357d5d(_0x137e7b);});else{_0x357d5d({'id':_0x5c02d6['id'],'phone':''});}})[_0x9e3d('0x14')](function(_0x587beb){logger[_0x9e3d('0x10')]('VerifyAdditionalPhones',_0x587beb[_0x9e3d('0x11')],_0xfecdd0);_0x3e9dd2(_0x1569c2[_0x9e3d('0x10')](0x1f4,_0x587beb[_0x9e3d('0x11')]));});}})[_0x9e3d('0x14')](function(_0x3bbca2){logger[_0x9e3d('0x10')](_0x9e3d('0x15'),_0x3bbca2['message'],_0xfecdd0);_0x3e9dd2(_0x1569c2[_0x9e3d('0x10')](0x1f4,_0x3bbca2[_0x9e3d('0x11')]));});}else _0x357d5d(0x1);});});};function activateAdditionalPhone(_0x496d7f,_0x45da29,_0x2ebef8,_0x1590a6,_0x1df9e6){return new Promise(function(_0x1daf91,_0xf6234c){logger[_0x9e3d('0x12')](_0x9e3d('0x15'),_0x2ebef8);var _0x40412e;if(moment()>moment(_0x2ebef8[_0x9e3d('0x2a')])){_0x40412e=moment()[_0x9e3d('0x2b')](_0x1df9e6||0x3,_0x9e3d('0x2c'));}else{if(_0x2ebef8[_0x9e3d('0x1d')]==0x0){_0x40412e=moment(_0x2ebef8[_0x9e3d('0x2a')]);}else{_0x40412e=moment()[_0x9e3d('0x2b')](_0x1df9e6||0x3,_0x9e3d('0x2c'));}}var _0x4fd0db={'phone':_0x496d7f[_0x9e3d('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x496d7f[_0x9e3d('0x1d')])?0x0:_0x496d7f['OrderBy'],'scheduledat':moment()[_0x9e3d('0x2b')](_0x1590a6||0x1,_0x9e3d('0x2c')),'countbusyretry':_0x45da29[_0x9e3d('0x2e')],'countcongestionretry':_0x45da29[_0x9e3d('0x2f')],'countnoanswerretry':_0x45da29[_0x9e3d('0x1f')],'countnosuchnumberretry':_0x45da29['countnosuchnumberretry'],'countdropretry':_0x45da29[_0x9e3d('0x20')],'countabandonedretry':_0x45da29['countabandonedretry'],'countmachineretry':_0x45da29['countmachineretry'],'countagentrejectretry':_0x45da29['countagentrejectretry'],'createdAt':_0x45da29[_0x9e3d('0x30')],'updatedAt':_0x45da29[_0x9e3d('0x31')]};var _0x2db644={'CmHopperId':_0x496d7f['id'],'phone':_0x2ebef8[_0x9e3d('0x2d')],'active':0x0,'OrderBy':_[_0x9e3d('0x32')](_0x2ebef8[_0x9e3d('0x1d')])?0x0:_0x2ebef8[_0x9e3d('0x1d')],'scheduledat':_0x40412e,'countbusyretry':_0x2ebef8[_0x9e3d('0x2e')],'countcongestionretry':_0x2ebef8[_0x9e3d('0x2f')],'countnoanswerretry':_0x2ebef8[_0x9e3d('0x1f')],'countnosuchnumberretry':_0x45da29[_0x9e3d('0x33')],'countdropretry':_0x45da29[_0x9e3d('0x20')],'countabandonedretry':_0x45da29[_0x9e3d('0x21')],'countmachineretry':_0x45da29['countmachineretry'],'countagentrejectretry':_0x45da29['countagentrejectretry'],'createdAt':_0x2ebef8[_0x9e3d('0x30')],'updatedAt':_0x2ebef8['updatedAt']};logger['info']('hopperToAdd',_0x4fd0db);logger['info'](_0x9e3d('0x34'),_0x2db644);return db[_0x9e3d('0x35')]['transaction'](function(_0x5dc89d){return db[_0x9e3d('0x1c')][_0x9e3d('0x36')](_0x4fd0db,{'where':{'id':_0x2ebef8['id']}},{'transaction':_0x5dc89d})['then'](function(){return db[_0x9e3d('0x16')]['update'](_0x2db644,{'where':{'id':_0x496d7f['id']}},{'transaction':_0x5dc89d});});})['then'](function(_0x3b0a6c){_0x1daf91({'id':_0x496d7f['id'],'phone':_0x2ebef8[_0x9e3d('0x2d')]});})[_0x9e3d('0x14')](function(_0x40931f){logger['error'](_0x9e3d('0x15'),_0x40931f[_0x9e3d('0x11')],req);_0xf6234c(_this[_0x9e3d('0x10')](0x1f4,_0x40931f[_0x9e3d('0x11')]));});});}exports[_0x9e3d('0x37')]=function(_0x51bf36){var _0x5a1ff9=this;return new Promise(function(_0x2fd381,_0x233181){return db[_0x9e3d('0x16')]['update'](_0x51bf36[_0x9e3d('0x19')][_0x9e3d('0x38')],{'where':{'id':_0x51bf36[_0x9e3d('0x19')]['id']}})['then'](function(_0x1a4e97){_0x2fd381(_0x1a4e97);})['catch'](function(_0x300591){logger[_0x9e3d('0x10')](_0x9e3d('0x37'),_0x300591[_0x9e3d('0x11')],_0x51bf36);_0x233181(_0x5a1ff9[_0x9e3d('0x10')](0x1f4,_0x300591[_0x9e3d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b7dd76d..4d4def1 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5087=['destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x5465db,_0x4d5502){var _0x2f1917=function(_0xc46f34){while(--_0xc46f34){_0x5465db['push'](_0x5465db['shift']());}};_0x2f1917(++_0x4d5502);}(_0x5087,0xec));var _0x7508=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x5087[_0x4f08dd];return _0x3017ee;};'use strict';var multer=require(_0x7508('0x0'));var util=require(_0x7508('0x1'));var path=require(_0x7508('0x2'));var timeout=require(_0x7508('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7508('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7508('0x5'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x7508('0x6')]('/',auth[_0x7508('0x7')](),controller[_0x7508('0x8')]);router[_0x7508('0x6')]('/:id',auth[_0x7508('0x7')](),controller[_0x7508('0x9')]);router[_0x7508('0xa')]('/',auth['isAuthenticated'](),controller[_0x7508('0xb')]);router[_0x7508('0xc')](_0x7508('0xd'),auth[_0x7508('0x7')](),controller[_0x7508('0xe')]);router[_0x7508('0xf')](_0x7508('0xd'),auth[_0x7508('0x7')](),controller[_0x7508('0x10')]);module[_0x7508('0x11')]=router; \ No newline at end of file +var _0x523a=['connect-timeout','express','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','exports','util'];(function(_0x28acd0,_0x387a42){var _0x848823=function(_0x29a00d){while(--_0x29a00d){_0x28acd0['push'](_0x28acd0['shift']());}};_0x848823(++_0x387a42);}(_0x523a,0x1bf));var _0xa523=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x523a[_0xbeb808];return _0x5d6909;};'use strict';var multer=require('multer');var util=require(_0xa523('0x0'));var path=require('path');var timeout=require(_0xa523('0x1'));var express=require(_0xa523('0x2'));var router=express['Router']();var auth=require(_0xa523('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa523('0x4'));var controller=require(_0xa523('0x5'));router[_0xa523('0x6')]('/',auth['isAuthenticated'](),controller[_0xa523('0x7')]);router[_0xa523('0x6')](_0xa523('0x8'),auth[_0xa523('0x9')](),controller[_0xa523('0xa')]);router[_0xa523('0xb')]('/',auth[_0xa523('0x9')](),controller[_0xa523('0xc')]);router[_0xa523('0xd')](_0xa523('0x8'),auth[_0xa523('0x9')](),controller[_0xa523('0xe')]);router['delete'](_0xa523('0x8'),auth[_0xa523('0x9')](),controller['destroy']);module[_0xa523('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 638dd51..e99e7c2 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.attributes.js +++ b/server/api/cmHopperBlack/cmHopperBlack.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77c7=['sequelize','STRING','INTEGER','contactListQueue','moment'];(function(_0x1e8c4e,_0x4b6ba5){var _0x19088a=function(_0x33116a){while(--_0x33116a){_0x1e8c4e['push'](_0x1e8c4e['shift']());}};_0x19088a(++_0x4b6ba5);}(_0x77c7,0x77));var _0x777c=function(_0x47fb64,_0x44d899){_0x47fb64=_0x47fb64-0x0;var _0x500a42=_0x77c7[_0x47fb64];return _0x500a42;};'use strict';var moment=require(_0x777c('0x0'));var Sequelize=require(_0x777c('0x1'));module['exports']={'phone':{'type':Sequelize[_0x777c('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x777c('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x777c('0x3')],'unique':_0x777c('0x4')},'VoiceQueueId':{'type':Sequelize[_0x777c('0x3')],'unique':_0x777c('0x4')}}; \ No newline at end of file +var _0x3309=['INTEGER','contactListQueue','sequelize','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x3309,0x1e6));var _0x9330=function(_0x3a38f7,_0x2b700e){_0x3a38f7=_0x3a38f7-0x0;var _0x5a0eb3=_0x3309[_0x3a38f7];return _0x5a0eb3;};'use strict';var moment=require('moment');var Sequelize=require(_0x9330('0x0'));module[_0x9330('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9330('0x2')],'unique':_0x9330('0x3')},'ListId':{'type':Sequelize[_0x9330('0x2')],'unique':_0x9330('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9330('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0e4a76e..8c607d0 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefeb=['body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','type','VIRTUAL','filter','options','CmHopperBlack','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x52caa9,_0x464827){var _0x29eabd=function(_0x50af5a){while(--_0x50af5a){_0x52caa9['push'](_0x52caa9['shift']());}};_0x29eabd(++_0x464827);}(_0xefeb,0xe9));var _0xbefe=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xefeb[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0xbefe('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbefe('0x1'));var zipdir=require(_0xbefe('0x2'));var jsonpatch=require(_0xbefe('0x3'));var rp=require(_0xbefe('0x4'));var moment=require(_0xbefe('0x5'));var BPromise=require(_0xbefe('0x6'));var Mustache=require(_0xbefe('0x7'));var util=require(_0xbefe('0x8'));var path=require(_0xbefe('0x9'));var sox=require('sox');var csv=require(_0xbefe('0xa'));var ejs=require(_0xbefe('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbefe('0xc'));var crypto=require(_0xbefe('0xd'));var jsforce=require(_0xbefe('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbefe('0xa'));var querystring=require(_0xbefe('0xf'));var Papa=require(_0xbefe('0x10'));var Redis=require('ioredis');var authService=require(_0xbefe('0x11'));var qs=require(_0xbefe('0x12'));var as=require(_0xbefe('0x13'));var hardwareService=require(_0xbefe('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xbefe('0x15'));var config=require(_0xbefe('0x16'));var licenseUtil=require(_0xbefe('0x17'));var db=require(_0xbefe('0x18'))['db'];function respondWithStatusCode(_0x22e24e,_0x4d2757){_0x4d2757=_0x4d2757||0xcc;return function(_0x3b72bc){if(_0x3b72bc){return _0x22e24e[_0xbefe('0x19')](_0x4d2757);}return _0x22e24e[_0xbefe('0x1a')](_0x4d2757)[_0xbefe('0x1b')]();};}function respondWithResult(_0x558025,_0x3f3b7e){_0x3f3b7e=_0x3f3b7e||0xc8;return function(_0x123bd5){if(_0x123bd5){return _0x558025[_0xbefe('0x1a')](_0x3f3b7e)[_0xbefe('0x1c')](_0x123bd5);}};}function respondWithFilteredResult(_0x512839,_0x38b2c8){return function(_0x252447){if(_0x252447){var _0x2cccc9=_0x252447[_0xbefe('0x1d')],_0x49cac1=_0x38b2c8[_0xbefe('0x1e')],_0x39735a=_0x38b2c8[_0xbefe('0x1e')]+_0x38b2c8[_0xbefe('0x1f')],_0x9ebdf0;if(_0x39735a>=_0x2cccc9){_0x39735a=_0x2cccc9;_0x9ebdf0=0xc8;}else{_0x9ebdf0=0xce;}_0x512839[_0xbefe('0x1a')](_0x9ebdf0);return _0x512839[_0xbefe('0x20')]('Content-Range',_0x49cac1+'-'+_0x39735a+'/'+_0x2cccc9)['json'](_0x252447);}return null;};}function patchUpdates(_0xd09ed5){return function(_0x400aef){try{jsonpatch[_0xbefe('0x21')](_0x400aef,_0xd09ed5,!![]);}catch(_0x1e80a0){return BPromise[_0xbefe('0x22')](_0x1e80a0);}return _0x400aef[_0xbefe('0x23')]();};}function saveUpdates(_0xfb1ec8,_0x5bbec3){return function(_0x4bdb47){if(_0x4bdb47){return _0x4bdb47[_0xbefe('0x24')](_0xfb1ec8)[_0xbefe('0x25')](function(_0x119699){return _0x119699;});}return null;};}function removeEntity(_0xa7b0f4,_0x3c480d){return function(_0x1a5ea8){if(_0x1a5ea8){return _0x1a5ea8[_0xbefe('0x26')]()[_0xbefe('0x25')](function(){_0xa7b0f4[_0xbefe('0x1a')](0xcc)[_0xbefe('0x1b')]();});}};}function handleEntityNotFound(_0x1c242c,_0x40e241){return function(_0x36b369){if(!_0x36b369){_0x1c242c[_0xbefe('0x19')](0x194);}return _0x36b369;};}function handleError(_0x1b19dd,_0x36f79d){_0x36f79d=_0x36f79d||0x1f4;return function(_0x5606c9){logger['error'](_0x5606c9[_0xbefe('0x27')]);if(_0x5606c9[_0xbefe('0x28')]){delete _0x5606c9[_0xbefe('0x28')];}_0x1b19dd[_0xbefe('0x1a')](_0x36f79d)[_0xbefe('0x29')](_0x5606c9);};}exports[_0xbefe('0x2a')]=function(_0x216c56,_0x51b199){var _0x49f3eb={},_0x3bd21c={},_0x27aad3={'count':0x0,'rows':[]};var _0x7a55=_['map'](db['CmHopperBlack'][_0xbefe('0x2b')],function(_0x24e6ed){return{'name':_0x24e6ed[_0xbefe('0x2c')],'type':_0x24e6ed['type'][_0xbefe('0x2d')]};});_0x3bd21c[_0xbefe('0x2e')]=_[_0xbefe('0x2f')](_0x7a55,_0xbefe('0x28'));_0x3bd21c['query']=_['keys'](_0x216c56[_0xbefe('0x30')]);_0x3bd21c[_0xbefe('0x31')]=_[_0xbefe('0x32')](_0x3bd21c[_0xbefe('0x2e')],_0x3bd21c[_0xbefe('0x30')]);_0x49f3eb[_0xbefe('0x33')]=_[_0xbefe('0x32')](_0x3bd21c['model'],qs[_0xbefe('0x34')](_0x216c56[_0xbefe('0x30')][_0xbefe('0x34')]));_0x49f3eb[_0xbefe('0x33')]=_0x49f3eb[_0xbefe('0x33')][_0xbefe('0x35')]?_0x49f3eb[_0xbefe('0x33')]:_0x3bd21c[_0xbefe('0x2e')];if(!_0x216c56['query'][_0xbefe('0x36')](_0xbefe('0x37'))){_0x49f3eb[_0xbefe('0x1f')]=qs['limit'](_0x216c56[_0xbefe('0x30')][_0xbefe('0x1f')]);_0x49f3eb[_0xbefe('0x1e')]=qs['offset'](_0x216c56[_0xbefe('0x30')][_0xbefe('0x1e')]);}_0x49f3eb[_0xbefe('0x38')]=qs[_0xbefe('0x39')](_0x216c56[_0xbefe('0x30')]['sort']);_0x49f3eb['where']=qs[_0xbefe('0x31')](_[_0xbefe('0x3a')](_0x216c56[_0xbefe('0x30')],_0x3bd21c[_0xbefe('0x31')]),_0x7a55);if(_0x216c56[_0xbefe('0x30')]['filter']){_0x49f3eb['where']=_[_0xbefe('0x3b')](_0x49f3eb[_0xbefe('0x3c')],{'$or':_[_0xbefe('0x2f')](_0x7a55,function(_0x2ef396){if(_0x2ef396[_0xbefe('0x3d')]!==_0xbefe('0x3e')){var _0x1f6a9d={};_0x1f6a9d[_0x2ef396['name']]={'$like':'%'+_0x216c56[_0xbefe('0x30')][_0xbefe('0x3f')]+'%'};return _0x1f6a9d;}})});}_0x49f3eb=_['merge']({},_0x49f3eb,_0x216c56[_0xbefe('0x40')]);var _0x52a265={'where':_0x49f3eb[_0xbefe('0x3c')]};return db[_0xbefe('0x41')][_0xbefe('0x1d')](_0x52a265)['then'](function(_0x202b78){_0x27aad3[_0xbefe('0x1d')]=_0x202b78;if(_0x216c56[_0xbefe('0x30')][_0xbefe('0x42')]){_0x49f3eb[_0xbefe('0x43')]=[{'all':!![]}];}return db[_0xbefe('0x41')][_0xbefe('0x44')](_0x49f3eb);})['then'](function(_0x45e560){_0x27aad3[_0xbefe('0x45')]=_0x45e560;return _0x27aad3;})[_0xbefe('0x25')](respondWithFilteredResult(_0x51b199,_0x49f3eb))[_0xbefe('0x46')](handleError(_0x51b199,null));};exports[_0xbefe('0x47')]=function(_0x28c3b2,_0x1787f9){var _0x220a06={'raw':!![],'where':{'id':_0x28c3b2[_0xbefe('0x48')]['id']}},_0x40135d={};_0x40135d[_0xbefe('0x2e')]=_[_0xbefe('0x49')](db['CmHopperBlack'][_0xbefe('0x2b')]);_0x40135d[_0xbefe('0x30')]=_[_0xbefe('0x49')](_0x28c3b2[_0xbefe('0x30')]);_0x40135d[_0xbefe('0x31')]=_[_0xbefe('0x32')](_0x40135d[_0xbefe('0x2e')],_0x40135d[_0xbefe('0x30')]);_0x220a06[_0xbefe('0x33')]=_[_0xbefe('0x32')](_0x40135d['model'],qs[_0xbefe('0x34')](_0x28c3b2['query'][_0xbefe('0x34')]));_0x220a06[_0xbefe('0x33')]=_0x220a06[_0xbefe('0x33')][_0xbefe('0x35')]?_0x220a06[_0xbefe('0x33')]:_0x40135d[_0xbefe('0x2e')];if(_0x28c3b2['query']['includeAll']){_0x220a06[_0xbefe('0x43')]=[{'all':!![]}];}_0x220a06=_['merge']({},_0x220a06,_0x28c3b2[_0xbefe('0x40')]);return db[_0xbefe('0x41')][_0xbefe('0x4a')](_0x220a06)[_0xbefe('0x25')](handleEntityNotFound(_0x1787f9,null))[_0xbefe('0x25')](respondWithResult(_0x1787f9,null))[_0xbefe('0x46')](handleError(_0x1787f9,null));};exports[_0xbefe('0x24')]=function(_0xe385d2,_0x4e7009){if(_0xe385d2['body']['id']){delete _0xe385d2[_0xbefe('0x4b')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0xe385d2[_0xbefe('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e7009,null))[_0xbefe('0x25')](saveUpdates(_0xe385d2[_0xbefe('0x4b')],null))['then'](respondWithResult(_0x4e7009,null))['catch'](handleError(_0x4e7009,null));};exports[_0xbefe('0x26')]=function(_0x28b181,_0x538aff){return db[_0xbefe('0x41')][_0xbefe('0x4a')]({'where':{'id':_0x28b181['params']['id']}})[_0xbefe('0x25')](handleEntityNotFound(_0x538aff,null))[_0xbefe('0x25')](removeEntity(_0x538aff,null))['catch'](handleError(_0x538aff,null));};exports[_0xbefe('0x4c')]=function(_0x29f8d4,_0x2dc3a5){return db[_0xbefe('0x41')][_0xbefe('0x4c')]()[_0xbefe('0x25')](respondWithResult(_0x2dc3a5,null))[_0xbefe('0x46')](handleError(_0x2dc3a5,null));}; \ No newline at end of file +var _0xc814=['filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','CmHopperBlack','find','catch','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','apply','reject','update','then','error','stack','name','send','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc814,0xa4));var _0x4c81=function(_0x22cdea,_0x3defc0){_0x22cdea=_0x22cdea-0x0;var _0x4cde30=_0xc814[_0x22cdea];return _0x4cde30;};'use strict';var pdf=require(_0x4c81('0x0'));var emlformat=require(_0x4c81('0x1'));var rimraf=require(_0x4c81('0x2'));var zipdir=require(_0x4c81('0x3'));var jsonpatch=require(_0x4c81('0x4'));var rp=require('request-promise');var moment=require(_0x4c81('0x5'));var BPromise=require(_0x4c81('0x6'));var Mustache=require(_0x4c81('0x7'));var util=require(_0x4c81('0x8'));var path=require(_0x4c81('0x9'));var sox=require('sox');var csv=require(_0x4c81('0xa'));var ejs=require(_0x4c81('0xb'));var fs=require('fs');var _=require(_0x4c81('0xc'));var squel=require(_0x4c81('0xd'));var crypto=require(_0x4c81('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4c81('0xf'));var toCsv=require(_0x4c81('0xa'));var querystring=require(_0x4c81('0x10'));var Papa=require(_0x4c81('0x11'));var Redis=require(_0x4c81('0x12'));var authService=require(_0x4c81('0x13'));var qs=require(_0x4c81('0x14'));var as=require(_0x4c81('0x15'));var hardwareService=require(_0x4c81('0x16'));var logger=require(_0x4c81('0x17'))('api');var utils=require(_0x4c81('0x18'));var config=require(_0x4c81('0x19'));var licenseUtil=require(_0x4c81('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x429523,_0x6e6fde){_0x6e6fde=_0x6e6fde||0xcc;return function(_0x18b344){if(_0x18b344){return _0x429523[_0x4c81('0x1b')](_0x6e6fde);}return _0x429523[_0x4c81('0x1c')](_0x6e6fde)[_0x4c81('0x1d')]();};}function respondWithResult(_0xb83468,_0x36a5ca){_0x36a5ca=_0x36a5ca||0xc8;return function(_0x132b23){if(_0x132b23){return _0xb83468[_0x4c81('0x1c')](_0x36a5ca)[_0x4c81('0x1e')](_0x132b23);}};}function respondWithFilteredResult(_0x5ca51d,_0x527cb7){return function(_0x5dfb65){if(_0x5dfb65){var _0xd73b9e=_0x5dfb65['count'],_0xef89dc=_0x527cb7[_0x4c81('0x1f')],_0x323e92=_0x527cb7[_0x4c81('0x1f')]+_0x527cb7['limit'],_0x2f9259;if(_0x323e92>=_0xd73b9e){_0x323e92=_0xd73b9e;_0x2f9259=0xc8;}else{_0x2f9259=0xce;}_0x5ca51d['status'](_0x2f9259);return _0x5ca51d['set']('Content-Range',_0xef89dc+'-'+_0x323e92+'/'+_0xd73b9e)[_0x4c81('0x1e')](_0x5dfb65);}return null;};}function patchUpdates(_0x247684){return function(_0x733611){try{jsonpatch[_0x4c81('0x20')](_0x733611,_0x247684,!![]);}catch(_0x5aa138){return BPromise[_0x4c81('0x21')](_0x5aa138);}return _0x733611['save']();};}function saveUpdates(_0x4aa890,_0x3efdbb){return function(_0x41e7eb){if(_0x41e7eb){return _0x41e7eb[_0x4c81('0x22')](_0x4aa890)[_0x4c81('0x23')](function(_0x39c5ee){return _0x39c5ee;});}return null;};}function removeEntity(_0x23a8b9,_0x3b7c62){return function(_0x2a81f3){if(_0x2a81f3){return _0x2a81f3['destroy']()[_0x4c81('0x23')](function(){_0x23a8b9[_0x4c81('0x1c')](0xcc)[_0x4c81('0x1d')]();});}};}function handleEntityNotFound(_0x3dd8d2,_0x52bc3f){return function(_0x4077a8){if(!_0x4077a8){_0x3dd8d2[_0x4c81('0x1b')](0x194);}return _0x4077a8;};}function handleError(_0x4380c3,_0x18429e){_0x18429e=_0x18429e||0x1f4;return function(_0x14e6ab){logger[_0x4c81('0x24')](_0x14e6ab[_0x4c81('0x25')]);if(_0x14e6ab[_0x4c81('0x26')]){delete _0x14e6ab[_0x4c81('0x26')];}_0x4380c3[_0x4c81('0x1c')](_0x18429e)[_0x4c81('0x27')](_0x14e6ab);};}exports['index']=function(_0x3fab7c,_0x55a7bd){var _0x131462={},_0x5a54bc={},_0x3912af={'count':0x0,'rows':[]};var _0x4027d4=_['map'](db['CmHopperBlack'][_0x4c81('0x28')],function(_0x409d0e){return{'name':_0x409d0e[_0x4c81('0x29')],'type':_0x409d0e['type'][_0x4c81('0x2a')]};});_0x5a54bc['model']=_[_0x4c81('0x2b')](_0x4027d4,_0x4c81('0x26'));_0x5a54bc[_0x4c81('0x2c')]=_[_0x4c81('0x2d')](_0x3fab7c['query']);_0x5a54bc[_0x4c81('0x2e')]=_[_0x4c81('0x2f')](_0x5a54bc['model'],_0x5a54bc['query']);_0x131462[_0x4c81('0x30')]=_['intersection'](_0x5a54bc[_0x4c81('0x31')],qs[_0x4c81('0x32')](_0x3fab7c['query']['fields']));_0x131462[_0x4c81('0x30')]=_0x131462[_0x4c81('0x30')][_0x4c81('0x33')]?_0x131462[_0x4c81('0x30')]:_0x5a54bc[_0x4c81('0x31')];if(!_0x3fab7c['query'][_0x4c81('0x34')](_0x4c81('0x35'))){_0x131462[_0x4c81('0x36')]=qs[_0x4c81('0x36')](_0x3fab7c[_0x4c81('0x2c')][_0x4c81('0x36')]);_0x131462['offset']=qs[_0x4c81('0x1f')](_0x3fab7c[_0x4c81('0x2c')][_0x4c81('0x1f')]);}_0x131462['order']=qs[_0x4c81('0x37')](_0x3fab7c['query'][_0x4c81('0x37')]);_0x131462[_0x4c81('0x38')]=qs[_0x4c81('0x2e')](_[_0x4c81('0x39')](_0x3fab7c[_0x4c81('0x2c')],_0x5a54bc[_0x4c81('0x2e')]),_0x4027d4);if(_0x3fab7c['query'][_0x4c81('0x3a')]){_0x131462['where']=_[_0x4c81('0x3b')](_0x131462[_0x4c81('0x38')],{'$or':_[_0x4c81('0x2b')](_0x4027d4,function(_0x5eb3dd){if(_0x5eb3dd['type']!==_0x4c81('0x3c')){var _0x35a950={};_0x35a950[_0x5eb3dd[_0x4c81('0x26')]]={'$like':'%'+_0x3fab7c[_0x4c81('0x2c')][_0x4c81('0x3a')]+'%'};return _0x35a950;}})});}_0x131462=_[_0x4c81('0x3b')]({},_0x131462,_0x3fab7c[_0x4c81('0x3d')]);var _0xb560c1={'where':_0x131462[_0x4c81('0x38')]};return db['CmHopperBlack'][_0x4c81('0x3e')](_0xb560c1)[_0x4c81('0x23')](function(_0x4a3fe8){_0x3912af[_0x4c81('0x3e')]=_0x4a3fe8;if(_0x3fab7c[_0x4c81('0x2c')][_0x4c81('0x3f')]){_0x131462[_0x4c81('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x4c81('0x41')](_0x131462);})[_0x4c81('0x23')](function(_0xa1e0cb){_0x3912af[_0x4c81('0x42')]=_0xa1e0cb;return _0x3912af;})[_0x4c81('0x23')](respondWithFilteredResult(_0x55a7bd,_0x131462))['catch'](handleError(_0x55a7bd,null));};exports[_0x4c81('0x43')]=function(_0x6805c8,_0x5e4098){var _0x2469c4={'raw':!![],'where':{'id':_0x6805c8[_0x4c81('0x44')]['id']}},_0x56963f={};_0x56963f[_0x4c81('0x31')]=_['keys'](db[_0x4c81('0x45')][_0x4c81('0x28')]);_0x56963f['query']=_[_0x4c81('0x2d')](_0x6805c8['query']);_0x56963f[_0x4c81('0x2e')]=_[_0x4c81('0x2f')](_0x56963f[_0x4c81('0x31')],_0x56963f[_0x4c81('0x2c')]);_0x2469c4['attributes']=_[_0x4c81('0x2f')](_0x56963f[_0x4c81('0x31')],qs[_0x4c81('0x32')](_0x6805c8['query'][_0x4c81('0x32')]));_0x2469c4[_0x4c81('0x30')]=_0x2469c4[_0x4c81('0x30')][_0x4c81('0x33')]?_0x2469c4['attributes']:_0x56963f[_0x4c81('0x31')];if(_0x6805c8[_0x4c81('0x2c')][_0x4c81('0x3f')]){_0x2469c4[_0x4c81('0x40')]=[{'all':!![]}];}_0x2469c4=_['merge']({},_0x2469c4,_0x6805c8['options']);return db[_0x4c81('0x45')][_0x4c81('0x46')](_0x2469c4)['then'](handleEntityNotFound(_0x5e4098,null))[_0x4c81('0x23')](respondWithResult(_0x5e4098,null))[_0x4c81('0x47')](handleError(_0x5e4098,null));};exports[_0x4c81('0x22')]=function(_0x37bc27,_0x585adb){if(_0x37bc27[_0x4c81('0x48')]['id']){delete _0x37bc27['body']['id'];}return db[_0x4c81('0x45')][_0x4c81('0x46')]({'where':{'id':_0x37bc27[_0x4c81('0x44')]['id']}})[_0x4c81('0x23')](handleEntityNotFound(_0x585adb,null))[_0x4c81('0x23')](saveUpdates(_0x37bc27['body'],null))['then'](respondWithResult(_0x585adb,null))['catch'](handleError(_0x585adb,null));};exports['destroy']=function(_0x57eed6,_0x4b5704){return db[_0x4c81('0x45')]['find']({'where':{'id':_0x57eed6[_0x4c81('0x44')]['id']}})[_0x4c81('0x23')](handleEntityNotFound(_0x4b5704,null))[_0x4c81('0x23')](removeEntity(_0x4b5704,null))[_0x4c81('0x47')](handleError(_0x4b5704,null));};exports[_0x4c81('0x49')]=function(_0x26b056,_0x2a173d){return db['CmHopperBlack'][_0x4c81('0x49')]()[_0x4c81('0x23')](respondWithResult(_0x2a173d,null))[_0x4c81('0x47')](handleError(_0x2a173d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6bda4b4..e901822 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.model.js +++ b/server/api/cmHopperBlack/cmHopperBlack.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7d7=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black'];(function(_0x24cdfe,_0x58a35a){var _0x4bd94f=function(_0x5c1a8d){while(--_0x5c1a8d){_0x24cdfe['push'](_0x24cdfe['shift']());}};_0x4bd94f(++_0x58a35a);}(_0xf7d7,0xb4));var _0x7f7d=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xf7d7[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x7f7d('0x0'));var util=require('util');var logger=require(_0x7f7d('0x1'))(_0x7f7d('0x2'));var moment=require(_0x7f7d('0x3'));var BPromise=require(_0x7f7d('0x4'));var rp=require(_0x7f7d('0x5'));var fs=require('fs');var path=require(_0x7f7d('0x6'));var rimraf=require('rimraf');var config=require(_0x7f7d('0x7'));var attributes=require(_0x7f7d('0x8'));module[_0x7f7d('0x9')]=function(_0x43c083,_0x29a55c){return _0x43c083[_0x7f7d('0xa')]('CmHopperBlack',attributes,{'tableName':_0x7f7d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c3f=['rimraf','../../config/environment','exports','define','CmHopperBlack','lodash','api','bluebird','request-promise'];(function(_0x18f5a7,_0x436f82){var _0x4d740c=function(_0x243c5c){while(--_0x243c5c){_0x18f5a7['push'](_0x18f5a7['shift']());}};_0x4d740c(++_0x436f82);}(_0x2c3f,0x113));var _0xf2c3=function(_0x20aaf3,_0x35d17b){_0x20aaf3=_0x20aaf3-0x0;var _0x3cc5c4=_0x2c3f[_0x20aaf3];return _0x3cc5c4;};'use strict';var _=require(_0xf2c3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf2c3('0x1'));var moment=require('moment');var BPromise=require(_0xf2c3('0x2'));var rp=require(_0xf2c3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2c3('0x4'));var config=require(_0xf2c3('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0xf2c3('0x6')]=function(_0x334787,_0xc90000){return _0x334787[_0xf2c3('0x7')](_0xf2c3('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 247d5f6..82417c9 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.rpc.js +++ b/server/api/cmHopperBlack/cmHopperBlack.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x458b=['message','request\x20sent','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','include','map','model','UpdateCmHopperBlack','CmHopperBlack','body','limit','info','DestroyCmHopperBlack','stringify','util','moment','bluebird','../../config/utils','rpc','jayson/promise','http','then','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','CmHopperBlack,\x20%s,\x20%s'];(function(_0x4eb7c6,_0x8a0a0b){var _0x236aab=function(_0x34a46a){while(--_0x34a46a){_0x4eb7c6['push'](_0x4eb7c6['shift']());}};_0x236aab(++_0x8a0a0b);}(_0x458b,0x98));var _0xb458=function(_0x5bb85c,_0x2a41da){_0x5bb85c=_0x5bb85c-0x0;var _0x180e0b=_0x458b[_0x5bb85c];return _0x180e0b;};'use strict';var _=require('lodash');var util=require(_0xb458('0x0'));var moment=require(_0xb458('0x1'));var BPromise=require(_0xb458('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb458('0x3'));var logger=require('../../config/logger')(_0xb458('0x4'));var config=require('../../config/environment');var jayson=require(_0xb458('0x5'));var client=jayson['client'][_0xb458('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1cb4c9,_0x594062,_0x39db19){return new BPromise(function(_0x584eb4,_0x19b90d){return client['request'](_0x1cb4c9,_0x39db19)[_0xb458('0x7')](function(_0x145d4d){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x594062,'request\x20sent');logger[_0xb458('0x8')](_0xb458('0x9'),_0x594062,'request\x20sent',JSON['stringify'](_0x145d4d));if(_0x145d4d['error']){if(_0x145d4d[_0xb458('0xa')][_0xb458('0xb')]===0x1f4){logger[_0xb458('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x594062,_0x145d4d[_0xb458('0xa')]['message']);return _0x19b90d(_0x145d4d['error']['message']);}logger[_0xb458('0xa')](_0xb458('0xc'),_0x594062,_0x145d4d[_0xb458('0xa')][_0xb458('0xd')]);return _0x584eb4(_0x145d4d[_0xb458('0xa')]['message']);}else{logger['info'](_0xb458('0xc'),_0x594062,_0xb458('0xe'));_0x584eb4(_0x145d4d[_0xb458('0xf')]['message']);}})[_0xb458('0x10')](function(_0x3611e8){logger[_0xb458('0xa')](_0xb458('0xc'),_0x594062,_0x3611e8);_0x19b90d(_0x3611e8);});});}exports[_0xb458('0x11')]=function(_0x3a9b19){var _0x5ca2b8=this;return new Promise(function(_0x154d31,_0x49590e){return db['CmHopperBlack'][_0xb458('0x12')]({'raw':_0x3a9b19[_0xb458('0x13')]?_0x3a9b19[_0xb458('0x13')][_0xb458('0x14')]===undefined?!![]:![]:!![],'where':_0x3a9b19[_0xb458('0x13')]?_0x3a9b19[_0xb458('0x13')][_0xb458('0x15')]||null:null,'attributes':_0x3a9b19[_0xb458('0x13')]?_0x3a9b19['options'][_0xb458('0x16')]||null:null,'limit':_0x3a9b19[_0xb458('0x13')]?_0x3a9b19['options']['limit']||null:null,'include':_0x3a9b19['options']?_0x3a9b19[_0xb458('0x13')][_0xb458('0x17')]?_[_0xb458('0x18')](_0x3a9b19[_0xb458('0x13')][_0xb458('0x17')],function(_0x3a6f56){return{'model':db[_0x3a6f56[_0xb458('0x19')]],'as':_0x3a6f56['as'],'attributes':_0x3a6f56[_0xb458('0x16')],'include':_0x3a6f56[_0xb458('0x17')]?_[_0xb458('0x18')](_0x3a6f56['include'],function(_0x196db4){return{'model':db[_0x196db4[_0xb458('0x19')]],'as':_0x196db4['as'],'attributes':_0x196db4[_0xb458('0x16')],'include':_0x196db4['include']?_[_0xb458('0x18')](_0x196db4['include'],function(_0x1644fb){return{'model':db[_0x1644fb[_0xb458('0x19')]],'as':_0x1644fb['as'],'attributes':_0x1644fb[_0xb458('0x16')]};}):[]};}):[]};}):[]:[]})[_0xb458('0x7')](function(_0x5f0d68){logger['info']('GetCmHopperBlack',_0x3a9b19);logger[_0xb458('0x8')]('GetCmHopperBlack',_0x3a9b19,JSON['stringify'](_0x5f0d68));_0x154d31(_0x5f0d68);})[_0xb458('0x10')](function(_0x35acb9){logger['error'](_0xb458('0x11'),_0x35acb9['message'],_0x3a9b19);_0x49590e(_0x5ca2b8['error'](0x1f4,_0x35acb9[_0xb458('0xd')]));});});};exports[_0xb458('0x1a')]=function(_0xa05ccf){var _0x4bc41e=this;return new Promise(function(_0x24efb8,_0x1864c4){return db[_0xb458('0x1b')]['update'](_0xa05ccf[_0xb458('0x1c')],{'raw':_0xa05ccf[_0xb458('0x13')]?_0xa05ccf[_0xb458('0x13')][_0xb458('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa05ccf[_0xb458('0x13')]?_0xa05ccf['options'][_0xb458('0x15')]||null:null,'attributes':_0xa05ccf[_0xb458('0x13')]?_0xa05ccf['options'][_0xb458('0x16')]||null:null,'limit':_0xa05ccf[_0xb458('0x13')]?_0xa05ccf[_0xb458('0x13')][_0xb458('0x1d')]||null:null})[_0xb458('0x7')](function(_0x464161){logger[_0xb458('0x1e')](_0xb458('0x1a'),_0xa05ccf);logger[_0xb458('0x8')](_0xb458('0x1a'),_0xa05ccf,JSON['stringify'](_0x464161));_0x24efb8(_0x464161);})[_0xb458('0x10')](function(_0x2c1313){logger['error']('UpdateCmHopperBlack',_0x2c1313[_0xb458('0xd')],_0xa05ccf);_0x1864c4(_0x4bc41e[_0xb458('0xa')](0x1f4,_0x2c1313[_0xb458('0xd')]));});});};exports['DestroyCmHopperBlack']=function(_0x2d4f91){var _0x361ff2=this;return new Promise(function(_0x546066,_0x2c5120){return db[_0xb458('0x1b')]['destroy']({'where':_0x2d4f91[_0xb458('0x13')]?_0x2d4f91[_0xb458('0x13')][_0xb458('0x15')]||null:null})['then'](function(_0x4c15d8){logger[_0xb458('0x1e')]('DestroyCmHopperBlack',_0x2d4f91);logger[_0xb458('0x8')](_0xb458('0x1f'),_0x2d4f91,JSON[_0xb458('0x20')](_0x4c15d8));_0x546066(_0x4c15d8);})[_0xb458('0x10')](function(_0x65fecc){logger['error'](_0xb458('0x1f'),_0x65fecc[_0xb458('0xd')],_0x2d4f91);_0x2c5120(_0x361ff2[_0xb458('0xa')](0x1f4,_0x65fecc[_0xb458('0xd')]));});});}; \ No newline at end of file +var _0x99e2=['result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','include','map','model','attributes','stringify','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x99e2,0xaa));var _0x299e=function(_0x1d54ca,_0x17e0c){_0x1d54ca=_0x1d54ca-0x0;var _0xaab15e=_0x99e2[_0x1d54ca];return _0xaab15e;};'use strict';var _=require(_0x299e('0x0'));var util=require(_0x299e('0x1'));var moment=require(_0x299e('0x2'));var BPromise=require(_0x299e('0x3'));var rs=require(_0x299e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x299e('0x5'));var logger=require(_0x299e('0x6'))(_0x299e('0x7'));var config=require('../../config/environment');var jayson=require(_0x299e('0x8'));var client=jayson['client'][_0x299e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48de19,_0x5ac98a,_0x26002e){return new BPromise(function(_0x4e41b7,_0x4bd94b){return client[_0x299e('0xa')](_0x48de19,_0x26002e)[_0x299e('0xb')](function(_0x417849){logger[_0x299e('0xc')](_0x299e('0xd'),_0x5ac98a,_0x299e('0xe'));logger[_0x299e('0xf')](_0x299e('0x10'),_0x5ac98a,'request\x20sent',JSON['stringify'](_0x417849));if(_0x417849[_0x299e('0x11')]){if(_0x417849[_0x299e('0x11')][_0x299e('0x12')]===0x1f4){logger['error'](_0x299e('0xd'),_0x5ac98a,_0x417849['error'][_0x299e('0x13')]);return _0x4bd94b(_0x417849[_0x299e('0x11')][_0x299e('0x13')]);}logger[_0x299e('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x5ac98a,_0x417849[_0x299e('0x11')]['message']);return _0x4e41b7(_0x417849[_0x299e('0x11')]['message']);}else{logger['info'](_0x299e('0xd'),_0x5ac98a,_0x299e('0xe'));_0x4e41b7(_0x417849[_0x299e('0x14')][_0x299e('0x13')]);}})[_0x299e('0x15')](function(_0x36b0b8){logger[_0x299e('0x11')](_0x299e('0xd'),_0x5ac98a,_0x36b0b8);_0x4bd94b(_0x36b0b8);});});}exports[_0x299e('0x16')]=function(_0x554f24){var _0x196f38=this;return new Promise(function(_0x14d50c,_0x1be86d){return db[_0x299e('0x17')][_0x299e('0x18')]({'raw':_0x554f24[_0x299e('0x19')]?_0x554f24['options'][_0x299e('0x1a')]===undefined?!![]:![]:!![],'where':_0x554f24[_0x299e('0x19')]?_0x554f24[_0x299e('0x19')][_0x299e('0x1b')]||null:null,'attributes':_0x554f24['options']?_0x554f24[_0x299e('0x19')]['attributes']||null:null,'limit':_0x554f24['options']?_0x554f24['options']['limit']||null:null,'include':_0x554f24['options']?_0x554f24[_0x299e('0x19')][_0x299e('0x1c')]?_[_0x299e('0x1d')](_0x554f24[_0x299e('0x19')][_0x299e('0x1c')],function(_0x46e25f){return{'model':db[_0x46e25f[_0x299e('0x1e')]],'as':_0x46e25f['as'],'attributes':_0x46e25f['attributes'],'include':_0x46e25f['include']?_['map'](_0x46e25f['include'],function(_0x53c958){return{'model':db[_0x53c958[_0x299e('0x1e')]],'as':_0x53c958['as'],'attributes':_0x53c958[_0x299e('0x1f')],'include':_0x53c958['include']?_[_0x299e('0x1d')](_0x53c958[_0x299e('0x1c')],function(_0x32643f){return{'model':db[_0x32643f[_0x299e('0x1e')]],'as':_0x32643f['as'],'attributes':_0x32643f[_0x299e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x299e('0xb')](function(_0x2a1387){logger[_0x299e('0xc')](_0x299e('0x16'),_0x554f24);logger['debug']('GetCmHopperBlack',_0x554f24,JSON[_0x299e('0x20')](_0x2a1387));_0x14d50c(_0x2a1387);})[_0x299e('0x15')](function(_0x434224){logger[_0x299e('0x11')](_0x299e('0x16'),_0x434224['message'],_0x554f24);_0x1be86d(_0x196f38[_0x299e('0x11')](0x1f4,_0x434224[_0x299e('0x13')]));});});};exports[_0x299e('0x21')]=function(_0x206d7c){var _0x49f75e=this;return new Promise(function(_0x3d7c01,_0x226be9){return db[_0x299e('0x17')][_0x299e('0x22')](_0x206d7c[_0x299e('0x23')],{'raw':_0x206d7c[_0x299e('0x19')]?_0x206d7c[_0x299e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x206d7c[_0x299e('0x19')]?_0x206d7c[_0x299e('0x19')][_0x299e('0x1b')]||null:null,'attributes':_0x206d7c[_0x299e('0x19')]?_0x206d7c[_0x299e('0x19')][_0x299e('0x1f')]||null:null,'limit':_0x206d7c[_0x299e('0x19')]?_0x206d7c['options'][_0x299e('0x24')]||null:null})[_0x299e('0xb')](function(_0x4bcb23){logger[_0x299e('0xc')](_0x299e('0x21'),_0x206d7c);logger[_0x299e('0xf')]('UpdateCmHopperBlack',_0x206d7c,JSON[_0x299e('0x20')](_0x4bcb23));_0x3d7c01(_0x4bcb23);})[_0x299e('0x15')](function(_0x3a45c1){logger[_0x299e('0x11')](_0x299e('0x21'),_0x3a45c1[_0x299e('0x13')],_0x206d7c);_0x226be9(_0x49f75e[_0x299e('0x11')](0x1f4,_0x3a45c1['message']));});});};exports[_0x299e('0x25')]=function(_0x54be86){var _0x4b3102=this;return new Promise(function(_0x40747a,_0x1307fc){return db[_0x299e('0x17')]['destroy']({'where':_0x54be86['options']?_0x54be86[_0x299e('0x19')][_0x299e('0x1b')]||null:null})[_0x299e('0xb')](function(_0xe55745){logger[_0x299e('0xc')]('DestroyCmHopperBlack',_0x54be86);logger[_0x299e('0xf')](_0x299e('0x25'),_0x54be86,JSON[_0x299e('0x20')](_0xe55745));_0x40747a(_0xe55745);})[_0x299e('0x15')](function(_0x18f698){logger[_0x299e('0x11')]('DestroyCmHopperBlack',_0x18f698[_0x299e('0x13')],_0x54be86);_0x1307fc(_0x4b3102[_0x299e('0x11')](0x1f4,_0x18f698[_0x299e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a61c1dc..c50f599 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81bd=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','show','put','/:id'];(function(_0x54a8ce,_0x58d6fa){var _0x1b26e3=function(_0x5e9b66){while(--_0x5e9b66){_0x54a8ce['push'](_0x54a8ce['shift']());}};_0x1b26e3(++_0x58d6fa);}(_0x81bd,0x7c));var _0xd81b=function(_0x4f67a2,_0x273325){_0x4f67a2=_0x4f67a2-0x0;var _0x42beb3=_0x81bd[_0x4f67a2];return _0x42beb3;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var auth=require(_0xd81b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd81b('0x7'));var controller=require(_0xd81b('0x8'));router[_0xd81b('0x9')]('/',auth['isAuthenticated'](),controller[_0xd81b('0xa')]);router[_0xd81b('0x9')](_0xd81b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd81b('0x9')]('/:id',auth[_0xd81b('0xc')](),controller[_0xd81b('0xd')]);router[_0xd81b('0xe')](_0xd81b('0xf'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x10')]);router[_0xd81b('0x11')](_0xd81b('0xf'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x12')]);module[_0xd81b('0x13')]=router; \ No newline at end of file +var _0xa8a8=['index','/describe','describe','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x116482,_0x35ddae){var _0x56db37=function(_0xc3685c){while(--_0xc3685c){_0x116482['push'](_0x116482['shift']());}};_0x56db37(++_0x35ddae);}(_0xa8a8,0xec));var _0x8a8a=function(_0x35efee,_0x4ff547){_0x35efee=_0x35efee-0x0;var _0x1e1ac9=_0xa8a8[_0x35efee];return _0x1e1ac9;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var auth=require(_0x8a8a('0x5'));var interaction=require(_0x8a8a('0x6'));var config=require(_0x8a8a('0x7'));var controller=require(_0x8a8a('0x8'));router[_0x8a8a('0x9')]('/',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xb')]);router[_0x8a8a('0x9')](_0x8a8a('0xc'),auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xd')]);router[_0x8a8a('0x9')](_0x8a8a('0xe'),auth[_0x8a8a('0xa')](),controller['show']);router['put'](_0x8a8a('0xe'),auth['isAuthenticated'](),controller[_0x8a8a('0xf')]);router[_0x8a8a('0x10')]('/:id',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0x11')]);module[_0x8a8a('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index be070ed..8ebb4e0 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.attributes.js +++ b/server/api/cmHopperFinal/cmHopperFinal.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x716a=['dispositionat','BOOLEAN','exports','INTEGER','STRING','DATE','endtime','setDataValue','diff'];(function(_0x518b8f,_0x476de4){var _0x51cece=function(_0x13e53e){while(--_0x13e53e){_0x518b8f['push'](_0x518b8f['shift']());}};_0x51cece(++_0x476de4);}(_0x716a,0x6e));var _0xa716=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x716a[_0x2ff238];return _0x204a56;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xa716('0x0')]={'state':{'type':Sequelize[_0xa716('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa716('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xa716('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa716('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa716('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa716('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xa716('0x2')]},'calleridnum':{'type':Sequelize[_0xa716('0x2')]},'calleridname':{'type':Sequelize[_0xa716('0x2')]},'starttime':{'type':Sequelize[_0xa716('0x3')]},'responsetime':{'type':Sequelize[_0xa716('0x3')]},'answertime':{'type':Sequelize[_0xa716('0x3')]},'droptime':{'type':Sequelize[_0xa716('0x3')]},'endtime':{'type':Sequelize[_0xa716('0x3')]},'ringtime':{'type':Sequelize[_0xa716('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa716('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa716('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa716('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa716('0x2')]},'campaign':{'type':Sequelize[_0xa716('0x2')]},'campaigntype':{'type':Sequelize[_0xa716('0x2')]},'membername':{'type':Sequelize[_0xa716('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa716('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa716('0x2')]},'dispositionat':{'type':Sequelize[_0xa716('0x3')],'set':function(_0x5e8926){var _0x3cea6d=this['getDataValue'](_0xa716('0x4'));if(_0x3cea6d&&_0x5e8926){this[_0xa716('0x5')]('followuptime',moment(_0x5e8926)[_0xa716('0x6')](moment(_0x3cea6d),'seconds'));}return this[_0xa716('0x5')](_0xa716('0x7'),_0x5e8926);}},'amd':{'type':Sequelize[_0xa716('0x8')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa716('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa716('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa716('0x3')]},'callback':{'type':Sequelize[_0xa716('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa716('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa716('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa716('0x3')]},'recallme':{'type':Sequelize[_0xa716('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa716('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa716('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa716('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa5fc=['diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x3b12b9,_0x2d99db){var _0x4f757a=function(_0x1ac62f){while(--_0x1ac62f){_0x3b12b9['push'](_0x3b12b9['shift']());}};_0x4f757a(++_0x2d99db);}(_0xa5fc,0x146));var _0xca5f=function(_0x443aa2,_0x5ab2e9){_0x443aa2=_0x443aa2-0x0;var _0x47700d=_0xa5fc[_0x443aa2];return _0x47700d;};'use strict';var Sequelize=require(_0xca5f('0x0'));var moment=require(_0xca5f('0x1'));module[_0xca5f('0x2')]={'state':{'type':Sequelize[_0xca5f('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xca5f('0x4')]},'scheduledat':{'type':Sequelize[_0xca5f('0x5')]},'countbusyretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xca5f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xca5f('0x4')]},'originatecalleridname':{'type':Sequelize[_0xca5f('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xca5f('0x5')]},'responsetime':{'type':Sequelize[_0xca5f('0x5')]},'answertime':{'type':Sequelize[_0xca5f('0x5')]},'droptime':{'type':Sequelize[_0xca5f('0x5')]},'endtime':{'type':Sequelize[_0xca5f('0x5')]},'ringtime':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xca5f('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xca5f('0x4')]},'membername':{'type':Sequelize[_0xca5f('0x4')]},'reason':{'type':Sequelize[_0xca5f('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xca5f('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5278ef){var _0x5e744d=this[_0xca5f('0x6')](_0xca5f('0x7'));if(_0x5e744d&&_0x5278ef){this[_0xca5f('0x8')](_0xca5f('0x9'),moment(_0x5278ef)[_0xca5f('0xa')](moment(_0x5e744d),_0xca5f('0xb')));}return this[_0xca5f('0x8')](_0xca5f('0xc'),_0x5278ef);}},'amd':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xca5f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xca5f('0x5')]},'deleted':{'type':Sequelize[_0xca5f('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xca5f('0x5')]},'recallme':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xca5f('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index daec237..feb633b 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24cd=['html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x2011\x20,\x201,\x20null','VoiceQueue','insert','into','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','checkContactHopper','CmHopper','findOne'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0x24cd,0x83));var _0xd24c=function(_0x2daf6b,_0x1952fd){_0x2daf6b=_0x2daf6b-0x0;var _0x39a0f7=_0x24cd[_0x2daf6b];return _0x39a0f7;};'use strict';var pdf=require(_0xd24c('0x0'));var emlformat=require(_0xd24c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd24c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd24c('0x3'));var moment=require(_0xd24c('0x4'));var BPromise=require(_0xd24c('0x5'));var Mustache=require('mustache');var util=require(_0xd24c('0x6'));var path=require(_0xd24c('0x7'));var sox=require('sox');var csv=require(_0xd24c('0x8'));var ejs=require(_0xd24c('0x9'));var fs=require('fs');var _=require(_0xd24c('0xa'));var squel=require(_0xd24c('0xb'));var crypto=require(_0xd24c('0xc'));var jsforce=require(_0xd24c('0xd'));var deskjs=require(_0xd24c('0xe'));var toCsv=require(_0xd24c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd24c('0xf'));var authService=require(_0xd24c('0x10'));var qs=require(_0xd24c('0x11'));var as=require(_0xd24c('0x12'));var hardwareService=require(_0xd24c('0x13'));var logger=require(_0xd24c('0x14'))(_0xd24c('0x15'));var utils=require(_0xd24c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd24c('0x17'));var db=require(_0xd24c('0x18'))['db'];function respondWithStatusCode(_0x55de4d,_0x3296ea){_0x3296ea=_0x3296ea||0xcc;return function(_0x3bed2){if(_0x3bed2){return _0x55de4d[_0xd24c('0x19')](_0x3296ea);}return _0x55de4d[_0xd24c('0x1a')](_0x3296ea)[_0xd24c('0x1b')]();};}function respondWithResult(_0x6a81d9,_0x2c29c6){_0x2c29c6=_0x2c29c6||0xc8;return function(_0x20b624){if(_0x20b624){return _0x6a81d9['status'](_0x2c29c6)[_0xd24c('0x1c')](_0x20b624);}};}function respondWithFilteredResult(_0xe096c,_0x528489){return function(_0x34aa92){if(_0x34aa92){var _0x3aa193=_0x34aa92['count'],_0x1a1111=_0x528489[_0xd24c('0x1d')],_0x3221a8=_0x528489[_0xd24c('0x1d')]+_0x528489[_0xd24c('0x1e')],_0x509992;if(_0x3221a8>=_0x3aa193){_0x3221a8=_0x3aa193;_0x509992=0xc8;}else{_0x509992=0xce;}_0xe096c['status'](_0x509992);return _0xe096c[_0xd24c('0x1f')](_0xd24c('0x20'),_0x1a1111+'-'+_0x3221a8+'/'+_0x3aa193)[_0xd24c('0x1c')](_0x34aa92);}return null;};}function patchUpdates(_0x62e228){return function(_0x478a0f){try{jsonpatch[_0xd24c('0x21')](_0x478a0f,_0x62e228,!![]);}catch(_0x56f8af){return BPromise[_0xd24c('0x22')](_0x56f8af);}return _0x478a0f[_0xd24c('0x23')]();};}function saveUpdates(_0x1b3a2f,_0x38c380){return function(_0x333416){if(_0x333416){return _0x333416[_0xd24c('0x24')](_0x1b3a2f)[_0xd24c('0x25')](function(_0x298d73){return _0x298d73;});}return null;};}function removeEntity(_0x17375b,_0x206ce7){return function(_0x48fffd){if(_0x48fffd){return _0x48fffd[_0xd24c('0x26')]()[_0xd24c('0x25')](function(){_0x17375b[_0xd24c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44471f,_0x2c3328){return function(_0x317eb0){if(!_0x317eb0){_0x44471f['sendStatus'](0x194);}return _0x317eb0;};}function handleError(_0x4539e7,_0x391cd5){_0x391cd5=_0x391cd5||0x1f4;return function(_0x848e0e){logger[_0xd24c('0x27')](_0x848e0e['stack']);if(_0x848e0e['name']){delete _0x848e0e[_0xd24c('0x28')];}_0x4539e7['status'](_0x391cd5)[_0xd24c('0x29')](_0x848e0e);};}exports[_0xd24c('0x2a')]=function(_0x325fcc,_0x4c0d99){var _0x4cb1b3={},_0x26fd85={},_0x14d44a={'count':0x0,'rows':[]};var _0x1a18b7=_[_0xd24c('0x2b')](db[_0xd24c('0x2c')][_0xd24c('0x2d')],function(_0x1be144){return{'name':_0x1be144[_0xd24c('0x2e')],'type':_0x1be144[_0xd24c('0x2f')][_0xd24c('0x30')]};});_0x26fd85[_0xd24c('0x31')]=_['map'](_0x1a18b7,_0xd24c('0x28'));_0x26fd85[_0xd24c('0x32')]=_[_0xd24c('0x33')](_0x325fcc[_0xd24c('0x32')]);_0x26fd85['filters']=_['intersection'](_0x26fd85[_0xd24c('0x31')],_0x26fd85[_0xd24c('0x32')]);_0x4cb1b3[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x26fd85['model'],qs[_0xd24c('0x36')](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x36')]));_0x4cb1b3[_0xd24c('0x34')]=_0x4cb1b3[_0xd24c('0x34')][_0xd24c('0x37')]?_0x4cb1b3[_0xd24c('0x34')]:_0x26fd85[_0xd24c('0x31')];if(!_0x325fcc[_0xd24c('0x32')]['hasOwnProperty'](_0xd24c('0x38'))){_0x4cb1b3['limit']=qs['limit'](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x1e')]);_0x4cb1b3[_0xd24c('0x1d')]=qs[_0xd24c('0x1d')](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x1d')]);}_0x4cb1b3[_0xd24c('0x39')]=qs['sort'](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x3a')]);_0x4cb1b3[_0xd24c('0x3b')]=qs[_0xd24c('0x3c')](_[_0xd24c('0x3d')](_0x325fcc[_0xd24c('0x32')],_0x26fd85['filters']),_0x1a18b7);if(_0x325fcc[_0xd24c('0x32')][_0xd24c('0x3e')]){_0x4cb1b3['where']=_[_0xd24c('0x3f')](_0x4cb1b3[_0xd24c('0x3b')],{'$or':_['map'](_0x1a18b7,function(_0x1e5718){if(_0x1e5718[_0xd24c('0x2f')]!=='VIRTUAL'){var _0x2e1cce={};_0x2e1cce[_0x1e5718[_0xd24c('0x28')]]={'$like':'%'+_0x325fcc[_0xd24c('0x32')][_0xd24c('0x3e')]+'%'};return _0x2e1cce;}})});}_0x4cb1b3=_['merge']({},_0x4cb1b3,_0x325fcc[_0xd24c('0x40')]);var _0x5c2a39={'where':_0x4cb1b3[_0xd24c('0x3b')]};return db['CmHopperFinal']['count'](_0x5c2a39)['then'](function(_0x4160fb){_0x14d44a['count']=_0x4160fb;if(_0x325fcc['query'][_0xd24c('0x41')]){_0x4cb1b3[_0xd24c('0x42')]=[{'all':!![]}];}return db[_0xd24c('0x2c')][_0xd24c('0x43')](_0x4cb1b3);})['then'](function(_0xe5fe3a){_0x14d44a['rows']=_0xe5fe3a;return _0x14d44a;})[_0xd24c('0x25')](respondWithFilteredResult(_0x4c0d99,_0x4cb1b3))[_0xd24c('0x44')](handleError(_0x4c0d99,null));};exports[_0xd24c('0x45')]=function(_0x181836,_0x27eefa){var _0x5ee293={'raw':!![],'where':{'id':_0x181836[_0xd24c('0x46')]['id']}},_0x17f070={};_0x17f070[_0xd24c('0x31')]=_[_0xd24c('0x33')](db['CmHopperFinal'][_0xd24c('0x2d')]);_0x17f070[_0xd24c('0x32')]=_['keys'](_0x181836[_0xd24c('0x32')]);_0x17f070[_0xd24c('0x3c')]=_['intersection'](_0x17f070[_0xd24c('0x31')],_0x17f070['query']);_0x5ee293[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x17f070[_0xd24c('0x31')],qs[_0xd24c('0x36')](_0x181836[_0xd24c('0x32')]['fields']));_0x5ee293[_0xd24c('0x34')]=_0x5ee293['attributes'][_0xd24c('0x37')]?_0x5ee293['attributes']:_0x17f070[_0xd24c('0x31')];if(_0x181836[_0xd24c('0x32')]['includeAll']){_0x5ee293[_0xd24c('0x42')]=[{'all':!![]}];}_0x5ee293=_[_0xd24c('0x3f')]({},_0x5ee293,_0x181836['options']);return db[_0xd24c('0x2c')]['find'](_0x5ee293)['then'](handleEntityNotFound(_0x27eefa,null))['then'](respondWithResult(_0x27eefa,null))[_0xd24c('0x44')](handleError(_0x27eefa,null));};exports[_0xd24c('0x47')]=function(_0x490957,_0x516734){return db[_0xd24c('0x2c')][_0xd24c('0x47')]()[_0xd24c('0x25')](respondWithResult(_0x516734,null))[_0xd24c('0x44')](handleError(_0x516734,null));};exports['update']=function(_0x2931b7,_0x186348){if(_0x2931b7['body'][_0xd24c('0x48')]){delete _0x2931b7[_0xd24c('0x49')][_0xd24c('0x48')];}return db['CmHopperFinal'][_0xd24c('0x4a')]({'where':{'uniqueid':_0x2931b7['params']['id']}})[_0xd24c('0x25')](handleEntityNotFound(_0x186348,null))[_0xd24c('0x25')](saveUpdates(_0x2931b7[_0xd24c('0x49')],null))[_0xd24c('0x25')](respondWithResult(_0x186348,null))['catch'](handleError(_0x186348,null));};exports[_0xd24c('0x4b')]=function(_0x153dc4,_0x2e2e0f,_0x1a4549){return db[_0xd24c('0x2c')][_0xd24c('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x153dc4[_0xd24c('0x46')]['id']},'attributes':[[db[_0xd24c('0x4c')]['fn'](_0xd24c('0x4d'),db[_0xd24c('0x4c')]['fn']('IF',db[_0xd24c('0x4c')]['literal'](_0xd24c('0x4e')))),_0xd24c('0x4f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x51')))),_0xd24c('0x52')],[db[_0xd24c('0x4c')]['fn'](_0xd24c('0x4d'),db[_0xd24c('0x4c')]['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x53')))),_0xd24c('0x54')],[db['sequelize']['fn'](_0xd24c('0x4d'),db[_0xd24c('0x4c')]['fn']('IF',db['sequelize'][_0xd24c('0x50')](_0xd24c('0x55')))),_0xd24c('0x56')],[db['sequelize']['fn']('COUNT',db[_0xd24c('0x4c')]['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x57')))),_0xd24c('0x58')],[db[_0xd24c('0x4c')]['fn'](_0xd24c('0x4d'),db[_0xd24c('0x4c')]['fn']('IF',db['sequelize'][_0xd24c('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xd24c('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x59')))),_0xd24c('0x5a')],[db['sequelize']['fn'](_0xd24c('0x4d'),db[_0xd24c('0x4c')]['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x5b')))),_0xd24c('0x5c')]]})[_0xd24c('0x25')](handleEntityNotFound(_0x2e2e0f,null))['then'](respondWithResult(_0x2e2e0f,null))['catch'](handleError(_0x2e2e0f,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x17c33e,_0xb0ca37,_0x42a917){return db[_0xd24c('0x2c')][_0xd24c('0x43')]({'raw':![],'where':{'CampaignId':_0x17c33e[_0xd24c('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0xd24c('0x4d'),db[_0xd24c('0x4c')]['fn']('IF',db['sequelize'][_0xd24c('0x50')](_0xd24c('0x4e')))),_0xd24c('0x4f')],[db[_0xd24c('0x4c')]['fn'](_0xd24c('0x4d'),db['sequelize']['fn']('IF',db['sequelize'][_0xd24c('0x50')](_0xd24c('0x51')))),'noAnswerContacts'],[db[_0xd24c('0x4c')]['fn'](_0xd24c('0x4d'),db['sequelize']['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x53')))),_0xd24c('0x54')],[db[_0xd24c('0x4c')]['fn'](_0xd24c('0x4d'),db[_0xd24c('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xd24c('0x56')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x57')))),'dropContacts'],[db[_0xd24c('0x4c')]['fn'](_0xd24c('0x4d'),db[_0xd24c('0x4c')]['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x5d')))),'abandonedContacts'],[db[_0xd24c('0x4c')]['fn'](_0xd24c('0x4d'),db['sequelize']['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x59')))),_0xd24c('0x5a')],[db[_0xd24c('0x4c')]['fn'](_0xd24c('0x4d'),db[_0xd24c('0x4c')]['fn']('IF',db[_0xd24c('0x4c')][_0xd24c('0x50')](_0xd24c('0x5b')))),'answeringMachine']]})[_0xd24c('0x25')](handleEntityNotFound(_0xb0ca37,null))[_0xd24c('0x25')](respondWithResult(_0xb0ca37,null))['catch'](handleError(_0xb0ca37,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x25dab8,_0x4bb4fa,_0xf29b61){return db[_0xd24c('0x5e')][_0xd24c('0x4a')]({'where':{'id':_0x25dab8[_0xd24c('0x46')]['id']}})[_0xd24c('0x25')](handleEntityNotFound(_0x4bb4fa,null))[_0xd24c('0x25')](function(_0x3a540e){var _0x404f29;if(_0x3a540e){_0x404f29=squel[_0xd24c('0x5f')]()[_0xd24c('0x60')]('cm_hopper')[_0xd24c('0x61')](['phone',_0xd24c('0x62'),_0xd24c('0x63'),_0xd24c('0x64'),_0xd24c('0x65'),_0xd24c('0x66'),_0xd24c('0x67')],squel[_0xd24c('0x68')]()['field'](_0xd24c('0x69'),_0xd24c('0x6a'))[_0xd24c('0x6b')](_0xd24c('0x6c'),_0xd24c('0x62'))[_0xd24c('0x6b')](_0xd24c('0x6d'),_0xd24c('0x63'))[_0xd24c('0x6b')]('ANY_VALUE(ListId)',_0xd24c('0x64'))['field'](_0xd24c('0x6e'),_0xd24c('0x65'))[_0xd24c('0x6b')](_0xd24c('0x6c'),_0xd24c('0x66'))[_0xd24c('0x6b')](_0xd24c('0x6c'),'updatedAt')[_0xd24c('0x6f')](_0xd24c('0x70'))[_0xd24c('0x3b')]('VoiceQueueId\x20=\x20?',_0x25dab8[_0xd24c('0x46')]['id'][_0xd24c('0x71')]())[_0xd24c('0x3b')](_0xd24c('0x72'),_0x25dab8[_0xd24c('0x49')][_0xd24c('0x73')][_0xd24c('0x71')]())[_0xd24c('0x3b')](_0xd24c('0x74'))[_0xd24c('0x3b')](_0xd24c('0x75'),squel[_0xd24c('0x68')]()[_0xd24c('0x6b')](_0xd24c('0x6a'))[_0xd24c('0x6f')](_0xd24c('0x76'))[_0xd24c('0x3b')](_0xd24c('0x77'),_0x25dab8['params']['id']['toString']()))[_0xd24c('0x3b')](_0xd24c('0x75'),squel[_0xd24c('0x68')]()[_0xd24c('0x6b')](_0xd24c('0x78'))[_0xd24c('0x6f')](_0xd24c('0x70'))[_0xd24c('0x3b')]('VoiceQueueId\x20=\x20?',_0x25dab8[_0xd24c('0x46')]['id']['toString']())['where']('state\x20=\x204'))[_0xd24c('0x79')](_0xd24c('0x63')))['toString']();return db['sequelize'][_0xd24c('0x32')](_0x404f29);}return[];})[_0xd24c('0x25')](respondWithResult(_0x4bb4fa,null))[_0xd24c('0x44')](handleError(_0x4bb4fa,null));};exports[_0xd24c('0x7a')]=function(_0x4d4015,_0x479ab4,_0x3dbcaa){return db['Campaign'][_0xd24c('0x4a')]({'where':{'id':_0x4d4015[_0xd24c('0x46')]['id']}})[_0xd24c('0x25')](handleEntityNotFound(_0x479ab4,null))[_0xd24c('0x25')](function(_0x42dab4){var _0x44a686;if(_0x42dab4){_0x44a686=squel[_0xd24c('0x5f')]()['into']('cm_hopper')['fromQuery']([_0xd24c('0x6a'),_0xd24c('0x62'),_0xd24c('0x63'),_0xd24c('0x64'),_0xd24c('0x7b'),_0xd24c('0x66'),'updatedAt'],squel[_0xd24c('0x68')]()[_0xd24c('0x6b')](_0xd24c('0x69'),_0xd24c('0x6a'))[_0xd24c('0x6b')](_0xd24c('0x6c'),_0xd24c('0x62'))[_0xd24c('0x6b')](_0xd24c('0x6d'),_0xd24c('0x63'))['field'](_0xd24c('0x7c'),'ListId')[_0xd24c('0x6b')](_0xd24c('0x7d'),_0xd24c('0x7b'))[_0xd24c('0x6b')]('NOW()',_0xd24c('0x66'))['field'](_0xd24c('0x6c'),_0xd24c('0x67'))[_0xd24c('0x6f')](_0xd24c('0x70'))[_0xd24c('0x3b')](_0xd24c('0x7e'),_0x4d4015[_0xd24c('0x46')]['id']['toString']())[_0xd24c('0x3b')](_0xd24c('0x72'),_0x4d4015[_0xd24c('0x49')][_0xd24c('0x73')][_0xd24c('0x71')]())[_0xd24c('0x3b')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xd24c('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0xd24c('0x6f')](_0xd24c('0x76'))[_0xd24c('0x3b')](_0xd24c('0x7e'),_0x4d4015[_0xd24c('0x46')]['id'][_0xd24c('0x71')]()))[_0xd24c('0x3b')](_0xd24c('0x75'),squel[_0xd24c('0x68')]()[_0xd24c('0x6b')](_0xd24c('0x78'))['from'](_0xd24c('0x70'))[_0xd24c('0x3b')](_0xd24c('0x7e'),_0x4d4015[_0xd24c('0x46')]['id'][_0xd24c('0x71')]())[_0xd24c('0x3b')](_0xd24c('0x7f')))[_0xd24c('0x79')](_0xd24c('0x63')))['toString']();return db[_0xd24c('0x4c')][_0xd24c('0x32')](_0x44a686);}return[];})[_0xd24c('0x25')](respondWithResult(_0x479ab4,null))[_0xd24c('0x44')](handleError(_0x479ab4,null));};exports[_0xd24c('0x80')]=function(_0x3384bb,_0x3f7104,_0x4f8c7f){return db[_0xd24c('0x81')][_0xd24c('0x82')]({'where':{'VoiceQueueId':_0x3384bb['body'][_0xd24c('0x65')],'CampaignId':_0x3384bb['body'][_0xd24c('0x7b')],'ContactId':_0x3384bb[_0xd24c('0x49')][_0xd24c('0x63')]}})['then'](handleEntityNotFound(_0x3f7104,null))['then'](function(_0x4f0344){if(_0x4f0344){return _0x4f0344;}return null;})[_0xd24c('0x25')](respondWithResult(_0x3f7104,null))['catch'](handleError(_0x3f7104,null));}; \ No newline at end of file +var _0x3667=['order','sort','where','filters','merge','VIRTUAL','filter','CmHopperFinal','includeAll','include','rows','catch','show','params','length','options','find','describe','update','body','uniqueid','findAll','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','ListId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','updatedAt','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','calleridnum','cm_hopper_final','group','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','state\x20=\x204','checkContactHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x4e24d9,_0x45a2f0){var _0x339180=function(_0x2e9da4){while(--_0x2e9da4){_0x4e24d9['push'](_0x4e24d9['shift']());}};_0x339180(++_0x45a2f0);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7366('0x0'));var emlformat=require(_0x7366('0x1'));var rimraf=require(_0x7366('0x2'));var zipdir=require(_0x7366('0x3'));var jsonpatch=require(_0x7366('0x4'));var rp=require('request-promise');var moment=require(_0x7366('0x5'));var BPromise=require(_0x7366('0x6'));var Mustache=require('mustache');var util=require(_0x7366('0x7'));var path=require(_0x7366('0x8'));var sox=require(_0x7366('0x9'));var csv=require(_0x7366('0xa'));var ejs=require(_0x7366('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7366('0xc'));var crypto=require(_0x7366('0xd'));var jsforce=require(_0x7366('0xe'));var deskjs=require(_0x7366('0xf'));var toCsv=require(_0x7366('0xa'));var querystring=require(_0x7366('0x10'));var Papa=require(_0x7366('0x11'));var Redis=require(_0x7366('0x12'));var authService=require(_0x7366('0x13'));var qs=require(_0x7366('0x14'));var as=require(_0x7366('0x15'));var hardwareService=require(_0x7366('0x16'));var logger=require(_0x7366('0x17'))(_0x7366('0x18'));var utils=require(_0x7366('0x19'));var config=require(_0x7366('0x1a'));var licenseUtil=require(_0x7366('0x1b'));var db=require(_0x7366('0x1c'))['db'];function respondWithStatusCode(_0xd5bac8,_0x3e3a73){_0x3e3a73=_0x3e3a73||0xcc;return function(_0x262659){if(_0x262659){return _0xd5bac8[_0x7366('0x1d')](_0x3e3a73);}return _0xd5bac8[_0x7366('0x1e')](_0x3e3a73)[_0x7366('0x1f')]();};}function respondWithResult(_0x308253,_0x27500c){_0x27500c=_0x27500c||0xc8;return function(_0x22562f){if(_0x22562f){return _0x308253[_0x7366('0x1e')](_0x27500c)['json'](_0x22562f);}};}function respondWithFilteredResult(_0x23e763,_0x308752){return function(_0x338719){if(_0x338719){var _0x2c0422=_0x338719[_0x7366('0x20')],_0xe2c87b=_0x308752[_0x7366('0x21')],_0x431c01=_0x308752[_0x7366('0x21')]+_0x308752[_0x7366('0x22')],_0x2bc2af;if(_0x431c01>=_0x2c0422){_0x431c01=_0x2c0422;_0x2bc2af=0xc8;}else{_0x2bc2af=0xce;}_0x23e763['status'](_0x2bc2af);return _0x23e763[_0x7366('0x23')]('Content-Range',_0xe2c87b+'-'+_0x431c01+'/'+_0x2c0422)[_0x7366('0x24')](_0x338719);}return null;};}function patchUpdates(_0x4acbd3){return function(_0x3f23cd){try{jsonpatch['apply'](_0x3f23cd,_0x4acbd3,!![]);}catch(_0x29f725){return BPromise[_0x7366('0x25')](_0x29f725);}return _0x3f23cd[_0x7366('0x26')]();};}function saveUpdates(_0x532ce2,_0x16e038){return function(_0x1946c6){if(_0x1946c6){return _0x1946c6['update'](_0x532ce2)[_0x7366('0x27')](function(_0x411dfe){return _0x411dfe;});}return null;};}function removeEntity(_0xaab659,_0x1a12d2){return function(_0x3c30a2){if(_0x3c30a2){return _0x3c30a2[_0x7366('0x28')]()[_0x7366('0x27')](function(){_0xaab659[_0x7366('0x1e')](0xcc)[_0x7366('0x1f')]();});}};}function handleEntityNotFound(_0x301220,_0x12aed6){return function(_0x1dc875){if(!_0x1dc875){_0x301220[_0x7366('0x1d')](0x194);}return _0x1dc875;};}function handleError(_0x563b22,_0xb63a21){_0xb63a21=_0xb63a21||0x1f4;return function(_0x4fe7cf){logger[_0x7366('0x29')](_0x4fe7cf['stack']);if(_0x4fe7cf['name']){delete _0x4fe7cf[_0x7366('0x2a')];}_0x563b22['status'](_0xb63a21)[_0x7366('0x2b')](_0x4fe7cf);};}exports['index']=function(_0x256633,_0x191177){var _0x5c37e2={},_0x6d196a={},_0x565aa7={'count':0x0,'rows':[]};var _0x31c642=_[_0x7366('0x2c')](db['CmHopperFinal'][_0x7366('0x2d')],function(_0x507baf){return{'name':_0x507baf[_0x7366('0x2e')],'type':_0x507baf[_0x7366('0x2f')][_0x7366('0x30')]};});_0x6d196a[_0x7366('0x31')]=_[_0x7366('0x2c')](_0x31c642,'name');_0x6d196a[_0x7366('0x32')]=_[_0x7366('0x33')](_0x256633['query']);_0x6d196a['filters']=_['intersection'](_0x6d196a['model'],_0x6d196a[_0x7366('0x32')]);_0x5c37e2[_0x7366('0x34')]=_[_0x7366('0x35')](_0x6d196a[_0x7366('0x31')],qs['fields'](_0x256633[_0x7366('0x32')][_0x7366('0x36')]));_0x5c37e2[_0x7366('0x34')]=_0x5c37e2[_0x7366('0x34')]['length']?_0x5c37e2[_0x7366('0x34')]:_0x6d196a[_0x7366('0x31')];if(!_0x256633['query'][_0x7366('0x37')](_0x7366('0x38'))){_0x5c37e2[_0x7366('0x22')]=qs[_0x7366('0x22')](_0x256633[_0x7366('0x32')][_0x7366('0x22')]);_0x5c37e2[_0x7366('0x21')]=qs[_0x7366('0x21')](_0x256633[_0x7366('0x32')]['offset']);}_0x5c37e2[_0x7366('0x39')]=qs[_0x7366('0x3a')](_0x256633['query'][_0x7366('0x3a')]);_0x5c37e2[_0x7366('0x3b')]=qs[_0x7366('0x3c')](_['pick'](_0x256633[_0x7366('0x32')],_0x6d196a['filters']),_0x31c642);if(_0x256633[_0x7366('0x32')]['filter']){_0x5c37e2['where']=_[_0x7366('0x3d')](_0x5c37e2['where'],{'$or':_[_0x7366('0x2c')](_0x31c642,function(_0x116081){if(_0x116081['type']!==_0x7366('0x3e')){var _0x533919={};_0x533919[_0x116081[_0x7366('0x2a')]]={'$like':'%'+_0x256633[_0x7366('0x32')][_0x7366('0x3f')]+'%'};return _0x533919;}})});}_0x5c37e2=_[_0x7366('0x3d')]({},_0x5c37e2,_0x256633['options']);var _0x8ed827={'where':_0x5c37e2[_0x7366('0x3b')]};return db[_0x7366('0x40')]['count'](_0x8ed827)[_0x7366('0x27')](function(_0x35ae13){_0x565aa7[_0x7366('0x20')]=_0x35ae13;if(_0x256633[_0x7366('0x32')][_0x7366('0x41')]){_0x5c37e2[_0x7366('0x42')]=[{'all':!![]}];}return db[_0x7366('0x40')]['findAll'](_0x5c37e2);})['then'](function(_0x35b274){_0x565aa7[_0x7366('0x43')]=_0x35b274;return _0x565aa7;})['then'](respondWithFilteredResult(_0x191177,_0x5c37e2))[_0x7366('0x44')](handleError(_0x191177,null));};exports[_0x7366('0x45')]=function(_0x550fe2,_0x432f79){var _0x54fca7={'raw':!![],'where':{'id':_0x550fe2[_0x7366('0x46')]['id']}},_0xafac5={};_0xafac5['model']=_['keys'](db[_0x7366('0x40')][_0x7366('0x2d')]);_0xafac5[_0x7366('0x32')]=_[_0x7366('0x33')](_0x550fe2['query']);_0xafac5[_0x7366('0x3c')]=_[_0x7366('0x35')](_0xafac5[_0x7366('0x31')],_0xafac5[_0x7366('0x32')]);_0x54fca7[_0x7366('0x34')]=_[_0x7366('0x35')](_0xafac5[_0x7366('0x31')],qs['fields'](_0x550fe2[_0x7366('0x32')][_0x7366('0x36')]));_0x54fca7[_0x7366('0x34')]=_0x54fca7['attributes'][_0x7366('0x47')]?_0x54fca7[_0x7366('0x34')]:_0xafac5['model'];if(_0x550fe2[_0x7366('0x32')][_0x7366('0x41')]){_0x54fca7[_0x7366('0x42')]=[{'all':!![]}];}_0x54fca7=_['merge']({},_0x54fca7,_0x550fe2[_0x7366('0x48')]);return db[_0x7366('0x40')][_0x7366('0x49')](_0x54fca7)['then'](handleEntityNotFound(_0x432f79,null))[_0x7366('0x27')](respondWithResult(_0x432f79,null))[_0x7366('0x44')](handleError(_0x432f79,null));};exports[_0x7366('0x4a')]=function(_0x4de2ce,_0xb32e28){return db[_0x7366('0x40')][_0x7366('0x4a')]()[_0x7366('0x27')](respondWithResult(_0xb32e28,null))['catch'](handleError(_0xb32e28,null));};exports[_0x7366('0x4b')]=function(_0x2d1c52,_0x6d46d2){if(_0x2d1c52[_0x7366('0x4c')][_0x7366('0x4d')]){delete _0x2d1c52[_0x7366('0x4c')][_0x7366('0x4d')];}return db[_0x7366('0x40')][_0x7366('0x49')]({'where':{'uniqueid':_0x2d1c52['params']['id']}})[_0x7366('0x27')](handleEntityNotFound(_0x6d46d2,null))[_0x7366('0x27')](saveUpdates(_0x2d1c52['body'],null))[_0x7366('0x27')](respondWithResult(_0x6d46d2,null))[_0x7366('0x44')](handleError(_0x6d46d2,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x2ea6ce,_0x579495,_0x3a16d6){return db[_0x7366('0x40')][_0x7366('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x2ea6ce[_0x7366('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x52')))),_0x7366('0x53')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x54')))),'noAnswerContacts'],[db[_0x7366('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x7366('0x55')],[db[_0x7366('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7366('0x50')]['literal'](_0x7366('0x56')))),_0x7366('0x57')],[db['sequelize']['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')]['literal'](_0x7366('0x58')))),_0x7366('0x59')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db['sequelize']['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x5a')))),_0x7366('0x5b')],[db[_0x7366('0x50')]['fn']('COUNT',db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x5c')))),'reCallContacts'],[db[_0x7366('0x50')]['fn']('COUNT',db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')]['literal'](_0x7366('0x5d')))),_0x7366('0x5e')]]})[_0x7366('0x27')](handleEntityNotFound(_0x579495,null))[_0x7366('0x27')](respondWithResult(_0x579495,null))['catch'](handleError(_0x579495,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x112c82,_0x574e1e,_0x432755){return db[_0x7366('0x40')][_0x7366('0x4e')]({'raw':![],'where':{'CampaignId':_0x112c82[_0x7366('0x46')]['id']},'attributes':[[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')]('`state`\x20=\x200,\x201,\x20null'))),_0x7366('0x53')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7366('0x50')]['literal'](_0x7366('0x54')))),'noAnswerContacts'],[db[_0x7366('0x50')]['fn']('COUNT',db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x7366('0x55')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db['sequelize'][_0x7366('0x51')](_0x7366('0x56')))),_0x7366('0x57')],[db['sequelize']['fn']('COUNT',db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7366('0x59')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x5a')))),_0x7366('0x5b')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db['sequelize'][_0x7366('0x51')](_0x7366('0x5c')))),'reCallContacts'],[db[_0x7366('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x5d')))),_0x7366('0x5e')]]})[_0x7366('0x27')](handleEntityNotFound(_0x574e1e,null))[_0x7366('0x27')](respondWithResult(_0x574e1e,null))['catch'](handleError(_0x574e1e,null));};exports[_0x7366('0x5f')]=function(_0x94b414,_0x305dff,_0x4f4fe1){return db[_0x7366('0x60')]['find']({'where':{'id':_0x94b414['params']['id']}})[_0x7366('0x27')](handleEntityNotFound(_0x305dff,null))['then'](function(_0x142cd7){var _0xa0ac25;if(_0x142cd7){_0xa0ac25=squel[_0x7366('0x61')]()[_0x7366('0x62')]('cm_hopper')['fromQuery']([_0x7366('0x63'),_0x7366('0x64'),_0x7366('0x65'),_0x7366('0x66'),'VoiceQueueId',_0x7366('0x67'),'updatedAt'],squel['select']()[_0x7366('0x68')](_0x7366('0x69'),'phone')[_0x7366('0x68')](_0x7366('0x6a'),'scheduledAt')[_0x7366('0x68')](_0x7366('0x6b'),_0x7366('0x65'))[_0x7366('0x68')](_0x7366('0x6c'),_0x7366('0x66'))[_0x7366('0x68')](_0x7366('0x6d'),_0x7366('0x6e'))[_0x7366('0x68')]('NOW()','createdAt')['field'](_0x7366('0x6a'),_0x7366('0x6f'))[_0x7366('0x70')]('cm_hopper_final')[_0x7366('0x3b')](_0x7366('0x71'),_0x94b414[_0x7366('0x46')]['id'][_0x7366('0x72')]())[_0x7366('0x3b')]('state\x20=\x20?',_0x94b414[_0x7366('0x4c')][_0x7366('0x73')]['toString']())[_0x7366('0x3b')](_0x7366('0x74'))[_0x7366('0x3b')](_0x7366('0x75'),squel[_0x7366('0x76')]()['field']('phone')[_0x7366('0x70')](_0x7366('0x77'))[_0x7366('0x3b')](_0x7366('0x71'),_0x94b414[_0x7366('0x46')]['id'][_0x7366('0x72')]()))[_0x7366('0x3b')](_0x7366('0x75'),squel[_0x7366('0x76')]()[_0x7366('0x68')](_0x7366('0x78'))[_0x7366('0x70')](_0x7366('0x79'))[_0x7366('0x3b')]('VoiceQueueId\x20=\x20?',_0x94b414[_0x7366('0x46')]['id']['toString']())[_0x7366('0x3b')]('state\x20=\x204'))[_0x7366('0x7a')]('ContactId'))[_0x7366('0x72')]();return db[_0x7366('0x50')]['query'](_0xa0ac25);}return[];})[_0x7366('0x27')](respondWithResult(_0x305dff,null))[_0x7366('0x44')](handleError(_0x305dff,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x4ea1e6,_0x394367,_0x1821e1){return db['Campaign'][_0x7366('0x49')]({'where':{'id':_0x4ea1e6['params']['id']}})[_0x7366('0x27')](handleEntityNotFound(_0x394367,null))['then'](function(_0x4788dd){var _0x45a50f;if(_0x4788dd){_0x45a50f=squel[_0x7366('0x61')]()[_0x7366('0x62')]('cm_hopper')[_0x7366('0x7b')]([_0x7366('0x63'),_0x7366('0x64'),'ContactId',_0x7366('0x66'),_0x7366('0x7c'),_0x7366('0x67'),_0x7366('0x6f')],squel[_0x7366('0x76')]()[_0x7366('0x68')]('ANY_VALUE(calleridnum)',_0x7366('0x63'))[_0x7366('0x68')](_0x7366('0x6a'),'scheduledAt')[_0x7366('0x68')]('ANY_VALUE(ContactId)',_0x7366('0x65'))[_0x7366('0x68')](_0x7366('0x6c'),_0x7366('0x66'))[_0x7366('0x68')](_0x7366('0x7d'),_0x7366('0x7c'))[_0x7366('0x68')](_0x7366('0x6a'),_0x7366('0x67'))[_0x7366('0x68')](_0x7366('0x6a'),_0x7366('0x6f'))['from'](_0x7366('0x79'))[_0x7366('0x3b')](_0x7366('0x7e'),_0x4ea1e6[_0x7366('0x46')]['id'][_0x7366('0x72')]())['where'](_0x7366('0x7f'),_0x4ea1e6[_0x7366('0x4c')]['state'][_0x7366('0x72')]())[_0x7366('0x3b')](_0x7366('0x74'))['where'](_0x7366('0x75'),squel['select']()['field']('phone')[_0x7366('0x70')](_0x7366('0x77'))[_0x7366('0x3b')](_0x7366('0x7e'),_0x4ea1e6[_0x7366('0x46')]['id'][_0x7366('0x72')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7366('0x76')]()[_0x7366('0x68')](_0x7366('0x78'))[_0x7366('0x70')]('cm_hopper_final')[_0x7366('0x3b')](_0x7366('0x7e'),_0x4ea1e6[_0x7366('0x46')]['id'][_0x7366('0x72')]())[_0x7366('0x3b')](_0x7366('0x80')))['group'](_0x7366('0x65')))[_0x7366('0x72')]();return db[_0x7366('0x50')][_0x7366('0x32')](_0x45a50f);}return[];})[_0x7366('0x27')](respondWithResult(_0x394367,null))[_0x7366('0x44')](handleError(_0x394367,null));};exports[_0x7366('0x81')]=function(_0x5ac943,_0x396c88,_0x9b7f5a){return db['CmHopper'][_0x7366('0x82')]({'where':{'VoiceQueueId':_0x5ac943[_0x7366('0x4c')][_0x7366('0x6e')],'CampaignId':_0x5ac943[_0x7366('0x4c')][_0x7366('0x7c')],'ContactId':_0x5ac943['body']['ContactId']}})['then'](handleEntityNotFound(_0x396c88,null))[_0x7366('0x27')](function(_0x17660e){if(_0x17660e){return _0x17660e;}return null;})[_0x7366('0x27')](respondWithResult(_0x396c88,null))[_0x7366('0x44')](handleError(_0x396c88,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ae25a52..bb68c60 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.model.js +++ b/server/api/cmHopperFinal/cmHopperFinal.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39b1=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x39b1,0x1cb));var _0x139b=function(_0x49fd8a,_0x5656b9){_0x49fd8a=_0x49fd8a-0x0;var _0x40d07a=_0x39b1[_0x49fd8a];return _0x40d07a;};'use strict';var _=require(_0x139b('0x0'));var util=require('util');var logger=require(_0x139b('0x1'))('api');var moment=require(_0x139b('0x2'));var BPromise=require(_0x139b('0x3'));var rp=require(_0x139b('0x4'));var fs=require('fs');var path=require(_0x139b('0x5'));var rimraf=require('rimraf');var config=require(_0x139b('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x139b('0x7')]=function(_0x49a946,_0x46dac3){return _0x49a946[_0x139b('0x8')](_0x139b('0x9'),attributes,{'tableName':_0x139b('0xa'),'paranoid':![],'indexes':[{'name':_0x139b('0xb'),'fields':[_0x139b('0xb')]},{'name':_0x139b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x16e9=['util','api','moment','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x23e267,_0x15a165){var _0x2ef1df=function(_0x354f0c){while(--_0x354f0c){_0x23e267['push'](_0x23e267['shift']());}};_0x2ef1df(++_0x15a165);}(_0x16e9,0x138));var _0x916e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x16e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x916e('0x0'));var logger=require('../../config/logger')(_0x916e('0x1'));var moment=require(_0x916e('0x2'));var BPromise=require(_0x916e('0x3'));var rp=require(_0x916e('0x4'));var fs=require('fs');var path=require(_0x916e('0x5'));var rimraf=require(_0x916e('0x6'));var config=require('../../config/environment');var attributes=require(_0x916e('0x7'));module['exports']=function(_0x113fb0,_0xbeaeb6){return _0x113fb0[_0x916e('0x8')](_0x916e('0x9'),attributes,{'tableName':_0x916e('0xa'),'paranoid':![],'indexes':[{'name':_0x916e('0xb'),'fields':[_0x916e('0xb')]},{'name':_0x916e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e4f1a8f..4c8e903 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8746=['body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','CmHopperFinal,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateCmHopperFinal','create'];(function(_0x34e72a,_0x2647dc){var _0x4d494a=function(_0x941f18){while(--_0x941f18){_0x34e72a['push'](_0x34e72a['shift']());}};_0x4d494a(++_0x2647dc);}(_0x8746,0x6c));var _0x6874=function(_0x551fdb,_0x4f24a9){_0x551fdb=_0x551fdb-0x0;var _0x54e6a2=_0x8746[_0x551fdb];return _0x54e6a2;};'use strict';var _=require('lodash');var util=require(_0x6874('0x0'));var moment=require(_0x6874('0x1'));var BPromise=require(_0x6874('0x2'));var rs=require(_0x6874('0x3'));var fs=require('fs');var Redis=require(_0x6874('0x4'));var db=require(_0x6874('0x5'))['db'];var utils=require(_0x6874('0x6'));var logger=require(_0x6874('0x7'))('rpc');var config=require(_0x6874('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6874('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12e3ff,_0x47e2b6,_0x30c679){return new BPromise(function(_0x2e5710,_0x2dc2a6){return client[_0x6874('0xa')](_0x12e3ff,_0x30c679)['then'](function(_0x2302f9){logger[_0x6874('0xb')](_0x6874('0xc'),_0x47e2b6,'request\x20sent');logger[_0x6874('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x47e2b6,_0x6874('0xe'),JSON[_0x6874('0xf')](_0x2302f9));if(_0x2302f9[_0x6874('0x10')]){if(_0x2302f9[_0x6874('0x10')][_0x6874('0x11')]===0x1f4){logger[_0x6874('0x10')](_0x6874('0xc'),_0x47e2b6,_0x2302f9[_0x6874('0x10')][_0x6874('0x12')]);return _0x2dc2a6(_0x2302f9[_0x6874('0x10')][_0x6874('0x12')]);}logger[_0x6874('0x10')](_0x6874('0xc'),_0x47e2b6,_0x2302f9[_0x6874('0x10')][_0x6874('0x12')]);return _0x2e5710(_0x2302f9[_0x6874('0x10')][_0x6874('0x12')]);}else{logger[_0x6874('0xb')](_0x6874('0xc'),_0x47e2b6,_0x6874('0xe'));_0x2e5710(_0x2302f9[_0x6874('0x13')]['message']);}})['catch'](function(_0x4b50b8){logger['error'](_0x6874('0xc'),_0x47e2b6,_0x4b50b8);_0x2dc2a6(_0x4b50b8);});});}exports[_0x6874('0x14')]=function(_0x26a603){var _0x2dc009=this;return new Promise(function(_0x5b0070,_0x536577){return db['CmHopperFinal'][_0x6874('0x15')](_0x26a603[_0x6874('0x16')],{'raw':_0x26a603[_0x6874('0x17')]?_0x26a603[_0x6874('0x17')][_0x6874('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x28ebbb){logger[_0x6874('0xb')](_0x6874('0x14'),_0x26a603);logger[_0x6874('0xd')]('CreateCmHopperFinal',_0x26a603,JSON[_0x6874('0xf')](_0x28ebbb));_0x5b0070(_0x28ebbb);})[_0x6874('0x19')](function(_0x2ab1b4){logger['error'](_0x6874('0x14'),_0x2ab1b4[_0x6874('0x12')],_0x26a603);_0x536577(_0x2dc009[_0x6874('0x10')](0x1f4,_0x2ab1b4[_0x6874('0x12')]));});});}; \ No newline at end of file +var _0x1df6=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperFinal','CmHopperFinal','create','body','raw','then'];(function(_0x582c8,_0x200fa9){var _0x15dc72=function(_0xa48543){while(--_0xa48543){_0x582c8['push'](_0x582c8['shift']());}};_0x15dc72(++_0x200fa9);}(_0x1df6,0x75));var _0x61df=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x1df6[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0x61df('0x0'));var moment=require(_0x61df('0x1'));var BPromise=require(_0x61df('0x2'));var rs=require(_0x61df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61df('0x4'))['db'];var utils=require(_0x61df('0x5'));var logger=require('../../config/logger')(_0x61df('0x6'));var config=require(_0x61df('0x7'));var jayson=require(_0x61df('0x8'));var client=jayson[_0x61df('0x9')][_0x61df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5484c8,_0x5a04ff,_0x37bfe3){return new BPromise(function(_0x103c32,_0x4d98ef){return client[_0x61df('0xb')](_0x5484c8,_0x37bfe3)['then'](function(_0x3109b5){logger[_0x61df('0xc')](_0x61df('0xd'),_0x5a04ff,_0x61df('0xe'));logger[_0x61df('0xf')](_0x61df('0x10'),_0x5a04ff,'request\x20sent',JSON[_0x61df('0x11')](_0x3109b5));if(_0x3109b5['error']){if(_0x3109b5[_0x61df('0x12')][_0x61df('0x13')]===0x1f4){logger[_0x61df('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x5a04ff,_0x3109b5[_0x61df('0x12')][_0x61df('0x14')]);return _0x4d98ef(_0x3109b5['error'][_0x61df('0x14')]);}logger[_0x61df('0x12')](_0x61df('0xd'),_0x5a04ff,_0x3109b5[_0x61df('0x12')][_0x61df('0x14')]);return _0x103c32(_0x3109b5[_0x61df('0x12')]['message']);}else{logger['info'](_0x61df('0xd'),_0x5a04ff,'request\x20sent');_0x103c32(_0x3109b5[_0x61df('0x15')][_0x61df('0x14')]);}})['catch'](function(_0x52406a){logger[_0x61df('0x12')](_0x61df('0xd'),_0x5a04ff,_0x52406a);_0x4d98ef(_0x52406a);});});}exports[_0x61df('0x16')]=function(_0x8d47f0){var _0x962f4=this;return new Promise(function(_0x5b073d,_0x39cb94){return db[_0x61df('0x17')][_0x61df('0x18')](_0x8d47f0[_0x61df('0x19')],{'raw':_0x8d47f0['options']?_0x8d47f0['options'][_0x61df('0x1a')]===undefined?!![]:![]:!![]})[_0x61df('0x1b')](function(_0x1c4d11){logger[_0x61df('0xc')](_0x61df('0x16'),_0x8d47f0);logger['debug']('CreateCmHopperFinal',_0x8d47f0,JSON['stringify'](_0x1c4d11));_0x5b073d(_0x1c4d11);})[_0x61df('0x1c')](function(_0x50e08c){logger['error'](_0x61df('0x16'),_0x50e08c[_0x61df('0x14')],_0x8d47f0);_0x39cb94(_0x962f4['error'](0x1f4,_0x50e08c['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 587732e..be97d0c 100644 --- a/server/api/cmHopperFinal/index.js +++ b/server/api/cmHopperFinal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4751=['../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','update','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x4751,0x13c));var _0x1475=function(_0x16036c,_0x435bfe){_0x16036c=_0x16036c-0x0;var _0x28c7fe=_0x4751[_0x16036c];return _0x28c7fe;};'use strict';var multer=require(_0x1475('0x0'));var util=require(_0x1475('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1475('0x2'));var router=express[_0x1475('0x3')]();var auth=require(_0x1475('0x4'));var interaction=require(_0x1475('0x5'));var config=require(_0x1475('0x6'));var controller=require(_0x1475('0x7'));router['get']('/',auth[_0x1475('0x8')](),controller['index']);router[_0x1475('0x9')](_0x1475('0xa'),auth[_0x1475('0x8')](),controller['describe']);router[_0x1475('0x9')](_0x1475('0xb'),auth[_0x1475('0x8')](),controller['show']);router['get'](_0x1475('0xc'),auth['isAuthenticated'](),controller[_0x1475('0xd')]);router[_0x1475('0x9')](_0x1475('0xe'),auth[_0x1475('0x8')](),controller[_0x1475('0xf')]);router[_0x1475('0x10')]('/voice/queue/moveContacts/:id',auth[_0x1475('0x8')](),controller[_0x1475('0x11')]);router[_0x1475('0x10')](_0x1475('0x12'),auth[_0x1475('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x1475('0x10')](_0x1475('0x13'),auth[_0x1475('0x8')](),controller[_0x1475('0x14')]);router['put']('/:id',auth[_0x1475('0x8')](),controller[_0x1475('0x15')]);module[_0x1475('0x16')]=router; \ No newline at end of file +var _0x664f=['/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','/describe','isAuthenticated','describe','get'];(function(_0x5a2920,_0x5635a0){var _0x3d07ca=function(_0x531892){while(--_0x531892){_0x5a2920['push'](_0x5a2920['shift']());}};_0x3d07ca(++_0x5635a0);}(_0x664f,0x184));var _0xf664=function(_0x558472,_0x27ffcf){_0x558472=_0x558472-0x0;var _0x37e917=_0x664f[_0x558472];return _0x37e917;};'use strict';var multer=require(_0xf664('0x0'));var util=require('util');var path=require(_0xf664('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf664('0x2')]();var auth=require(_0xf664('0x3'));var interaction=require(_0xf664('0x4'));var config=require(_0xf664('0x5'));var controller=require(_0xf664('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xf664('0x7')]);router['get'](_0xf664('0x8'),auth[_0xf664('0x9')](),controller[_0xf664('0xa')]);router[_0xf664('0xb')](_0xf664('0xc'),auth['isAuthenticated'](),controller[_0xf664('0xd')]);router[_0xf664('0xb')](_0xf664('0xe'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xf664('0xb')](_0xf664('0xf'),auth[_0xf664('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xf664('0x10')]('/voice/queue/moveContacts/:id',auth[_0xf664('0x9')](),controller[_0xf664('0x11')]);router[_0xf664('0x10')](_0xf664('0x12'),auth['isAuthenticated'](),controller[_0xf664('0x13')]);router[_0xf664('0x10')](_0xf664('0x14'),auth[_0xf664('0x9')](),controller[_0xf664('0x15')]);router[_0xf664('0x16')](_0xf664('0xc'),auth[_0xf664('0x9')](),controller[_0xf664('0x17')]);module[_0xf664('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 9d89351..9b02262 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.attributes.js +++ b/server/api/cmHopperHistory/cmHopperHistory.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8f5=['INTEGER','STRING','BOOLEAN','sequelize','exports','DATE'];(function(_0x5351b9,_0x30b650){var _0x28ebc9=function(_0x5c4447){while(--_0x5c4447){_0x5351b9['push'](_0x5351b9['shift']());}};_0x28ebc9(++_0x30b650);}(_0xc8f5,0x10b));var _0x5c8f=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0xc8f5[_0x27bcf5];return _0x4ce4cf;};'use strict';var Sequelize=require(_0x5c8f('0x0'));module[_0x5c8f('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5c8f('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5c8f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x5c8f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x5c8f('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5c8f('0x2')]},'responsetime':{'type':Sequelize[_0x5c8f('0x2')]},'answertime':{'type':Sequelize[_0x5c8f('0x2')]},'droptime':{'type':Sequelize[_0x5c8f('0x2')]},'endtime':{'type':Sequelize[_0x5c8f('0x2')]},'ringtime':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5c8f('0x4')]},'campaign':{'type':Sequelize[_0x5c8f('0x4')]},'campaigntype':{'type':Sequelize[_0x5c8f('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x5c8f('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5c8f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5c8f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5c8f('0x2')]},'edited':{'type':Sequelize[_0x5c8f('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5c8f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x53d0=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x4f0a65,_0x73359d){var _0x45d6dd=function(_0xab0cb6){while(--_0xab0cb6){_0x4f0a65['push'](_0x4f0a65['shift']());}};_0x45d6dd(++_0x73359d);}(_0x53d0,0x1b2));var _0x053d=function(_0x12530c,_0x55b2e0){_0x12530c=_0x12530c-0x0;var _0x3cfa3a=_0x53d0[_0x12530c];return _0x3cfa3a;};'use strict';var Sequelize=require(_0x053d('0x0'));module['exports']={'state':{'type':Sequelize[_0x053d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x053d('0x2')]},'scheduledat':{'type':Sequelize[_0x053d('0x3')]},'countbusyretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x053d('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x053d('0x2')]},'calleridnum':{'type':Sequelize[_0x053d('0x2')]},'calleridname':{'type':Sequelize[_0x053d('0x2')]},'starttime':{'type':Sequelize[_0x053d('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x053d('0x3')]},'endtime':{'type':Sequelize[_0x053d('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x053d('0x2')]},'campaign':{'type':Sequelize[_0x053d('0x2')]},'campaigntype':{'type':Sequelize[_0x053d('0x2')]},'membername':{'type':Sequelize[_0x053d('0x2')]},'reason':{'type':Sequelize[_0x053d('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x053d('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x053d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x053d('0x3')]},'recallme':{'type':Sequelize[_0x053d('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x053d('0x3')]},'edited':{'type':Sequelize[_0x053d('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 3069a81..74e3acb 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.controller.js +++ b/server/api/cmHopperHistory/cmHopperHistory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x457d=['limit','order','where','filter','merge','VIRTUAL','options','findAll','catch','show','rawAttributes','includeAll','find','create','body','describe','uniqueid','html-pdf','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','error','stack','name','send','CmHopperHistory','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x199289,_0x44bf81){var _0x58cf16=function(_0x235f4d){while(--_0x235f4d){_0x199289['push'](_0x199289['shift']());}};_0x58cf16(++_0x44bf81);}(_0x457d,0x183));var _0xd457=function(_0x9fd48d,_0x25881b){_0x9fd48d=_0x9fd48d-0x0;var _0x53435e=_0x457d[_0x9fd48d];return _0x53435e;};'use strict';var pdf=require(_0xd457('0x0'));var emlformat=require(_0xd457('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd457('0x2'));var rp=require('request-promise');var moment=require(_0xd457('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd457('0x4'));var util=require(_0xd457('0x5'));var path=require(_0xd457('0x6'));var sox=require(_0xd457('0x7'));var csv=require(_0xd457('0x8'));var ejs=require(_0xd457('0x9'));var fs=require('fs');var _=require(_0xd457('0xa'));var squel=require(_0xd457('0xb'));var crypto=require(_0xd457('0xc'));var jsforce=require(_0xd457('0xd'));var deskjs=require(_0xd457('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd457('0xf'));var Papa=require(_0xd457('0x10'));var Redis=require(_0xd457('0x11'));var authService=require(_0xd457('0x12'));var qs=require(_0xd457('0x13'));var as=require(_0xd457('0x14'));var hardwareService=require(_0xd457('0x15'));var logger=require(_0xd457('0x16'))(_0xd457('0x17'));var utils=require('../../config/utils');var config=require(_0xd457('0x18'));var licenseUtil=require(_0xd457('0x19'));var db=require(_0xd457('0x1a'))['db'];function respondWithStatusCode(_0x58742c,_0x2505b6){_0x2505b6=_0x2505b6||0xcc;return function(_0x58deb6){if(_0x58deb6){return _0x58742c[_0xd457('0x1b')](_0x2505b6);}return _0x58742c[_0xd457('0x1c')](_0x2505b6)[_0xd457('0x1d')]();};}function respondWithResult(_0x59525c,_0x254e95){_0x254e95=_0x254e95||0xc8;return function(_0x2a0d5f){if(_0x2a0d5f){return _0x59525c[_0xd457('0x1c')](_0x254e95)[_0xd457('0x1e')](_0x2a0d5f);}};}function respondWithFilteredResult(_0x411557,_0x11e429){return function(_0x558984){if(_0x558984){var _0x196b7b=_0x558984[_0xd457('0x1f')],_0x1d6e2c=_0x11e429[_0xd457('0x20')],_0x4c784c=_0x11e429[_0xd457('0x20')]+_0x11e429['limit'],_0x3c2181;if(_0x4c784c>=_0x196b7b){_0x4c784c=_0x196b7b;_0x3c2181=0xc8;}else{_0x3c2181=0xce;}_0x411557[_0xd457('0x1c')](_0x3c2181);return _0x411557[_0xd457('0x21')]('Content-Range',_0x1d6e2c+'-'+_0x4c784c+'/'+_0x196b7b)[_0xd457('0x1e')](_0x558984);}return null;};}function patchUpdates(_0x211f56){return function(_0x29362b){try{jsonpatch[_0xd457('0x22')](_0x29362b,_0x211f56,!![]);}catch(_0x215a84){return BPromise[_0xd457('0x23')](_0x215a84);}return _0x29362b[_0xd457('0x24')]();};}function saveUpdates(_0x36a0c9,_0x17cb38){return function(_0x3646ca){if(_0x3646ca){return _0x3646ca[_0xd457('0x25')](_0x36a0c9)[_0xd457('0x26')](function(_0x4466aa){return _0x4466aa;});}return null;};}function removeEntity(_0x40fd9c,_0x3aaaac){return function(_0x4669d5){if(_0x4669d5){return _0x4669d5['destroy']()[_0xd457('0x26')](function(){_0x40fd9c[_0xd457('0x1c')](0xcc)[_0xd457('0x1d')]();});}};}function handleEntityNotFound(_0x5c569f,_0x2cb359){return function(_0x4b3d23){if(!_0x4b3d23){_0x5c569f[_0xd457('0x1b')](0x194);}return _0x4b3d23;};}function handleError(_0x5defcd,_0x383560){_0x383560=_0x383560||0x1f4;return function(_0x134a95){logger[_0xd457('0x27')](_0x134a95[_0xd457('0x28')]);if(_0x134a95[_0xd457('0x29')]){delete _0x134a95['name'];}_0x5defcd[_0xd457('0x1c')](_0x383560)[_0xd457('0x2a')](_0x134a95);};}exports['index']=function(_0x23c777,_0x3fa634){var _0x179150={},_0x1c4159={},_0x3ae69a={'count':0x0,'rows':[]};var _0x2a1ce3=_['map'](db[_0xd457('0x2b')]['rawAttributes'],function(_0x5db44b){return{'name':_0x5db44b[_0xd457('0x2c')],'type':_0x5db44b[_0xd457('0x2d')]['key']};});_0x1c4159[_0xd457('0x2e')]=_[_0xd457('0x2f')](_0x2a1ce3,_0xd457('0x29'));_0x1c4159[_0xd457('0x30')]=_[_0xd457('0x31')](_0x23c777[_0xd457('0x30')]);_0x1c4159[_0xd457('0x32')]=_[_0xd457('0x33')](_0x1c4159[_0xd457('0x2e')],_0x1c4159['query']);_0x179150[_0xd457('0x34')]=_[_0xd457('0x33')](_0x1c4159['model'],qs[_0xd457('0x35')](_0x23c777[_0xd457('0x30')]['fields']));_0x179150[_0xd457('0x34')]=_0x179150[_0xd457('0x34')][_0xd457('0x36')]?_0x179150['attributes']:_0x1c4159[_0xd457('0x2e')];if(!_0x23c777[_0xd457('0x30')][_0xd457('0x37')](_0xd457('0x38'))){_0x179150[_0xd457('0x39')]=qs[_0xd457('0x39')](_0x23c777['query'][_0xd457('0x39')]);_0x179150[_0xd457('0x20')]=qs[_0xd457('0x20')](_0x23c777['query'][_0xd457('0x20')]);}_0x179150[_0xd457('0x3a')]=qs['sort'](_0x23c777['query']['sort']);_0x179150[_0xd457('0x3b')]=qs[_0xd457('0x32')](_['pick'](_0x23c777['query'],_0x1c4159[_0xd457('0x32')]),_0x2a1ce3);if(_0x23c777[_0xd457('0x30')][_0xd457('0x3c')]){_0x179150['where']=_[_0xd457('0x3d')](_0x179150[_0xd457('0x3b')],{'$or':_[_0xd457('0x2f')](_0x2a1ce3,function(_0x1911c7){if(_0x1911c7[_0xd457('0x2d')]!==_0xd457('0x3e')){var _0x8b7172={};_0x8b7172[_0x1911c7[_0xd457('0x29')]]={'$like':'%'+_0x23c777[_0xd457('0x30')]['filter']+'%'};return _0x8b7172;}})});}_0x179150=_[_0xd457('0x3d')]({},_0x179150,_0x23c777[_0xd457('0x3f')]);var _0x5d27e3={'where':_0x179150[_0xd457('0x3b')]};return db['CmHopperHistory'][_0xd457('0x1f')](_0x5d27e3)['then'](function(_0x45a234){_0x3ae69a['count']=_0x45a234;if(_0x23c777[_0xd457('0x30')]['includeAll']){_0x179150['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xd457('0x40')](_0x179150);})[_0xd457('0x26')](function(_0x312e78){_0x3ae69a['rows']=_0x312e78;return _0x3ae69a;})[_0xd457('0x26')](respondWithFilteredResult(_0x3fa634,_0x179150))[_0xd457('0x41')](handleError(_0x3fa634,null));};exports[_0xd457('0x42')]=function(_0x2dc293,_0x249f9e){var _0x582200={'raw':!![],'where':{'id':_0x2dc293['params']['id']}},_0x275217={};_0x275217[_0xd457('0x2e')]=_['keys'](db[_0xd457('0x2b')][_0xd457('0x43')]);_0x275217['query']=_[_0xd457('0x31')](_0x2dc293[_0xd457('0x30')]);_0x275217[_0xd457('0x32')]=_[_0xd457('0x33')](_0x275217[_0xd457('0x2e')],_0x275217[_0xd457('0x30')]);_0x582200[_0xd457('0x34')]=_[_0xd457('0x33')](_0x275217[_0xd457('0x2e')],qs[_0xd457('0x35')](_0x2dc293[_0xd457('0x30')][_0xd457('0x35')]));_0x582200[_0xd457('0x34')]=_0x582200[_0xd457('0x34')][_0xd457('0x36')]?_0x582200[_0xd457('0x34')]:_0x275217[_0xd457('0x2e')];if(_0x2dc293[_0xd457('0x30')][_0xd457('0x44')]){_0x582200['include']=[{'all':!![]}];}_0x582200=_[_0xd457('0x3d')]({},_0x582200,_0x2dc293[_0xd457('0x3f')]);return db['CmHopperHistory'][_0xd457('0x45')](_0x582200)[_0xd457('0x26')](handleEntityNotFound(_0x249f9e,null))['then'](respondWithResult(_0x249f9e,null))[_0xd457('0x41')](handleError(_0x249f9e,null));};exports[_0xd457('0x46')]=function(_0x459c05,_0x48a8a6){return db[_0xd457('0x2b')][_0xd457('0x46')](_0x459c05[_0xd457('0x47')],{})[_0xd457('0x26')](respondWithResult(_0x48a8a6,0xc9))[_0xd457('0x41')](handleError(_0x48a8a6,null));};exports[_0xd457('0x48')]=function(_0x3ae2ff,_0x3a05ff){return db[_0xd457('0x2b')][_0xd457('0x48')]()[_0xd457('0x26')](respondWithResult(_0x3a05ff,null))[_0xd457('0x41')](handleError(_0x3a05ff,null));};exports[_0xd457('0x25')]=function(_0x39ca36,_0x20a202){if(_0x39ca36[_0xd457('0x47')]['uniqueid']){delete _0x39ca36['body'][_0xd457('0x49')];}return db['CmHopperHistory'][_0xd457('0x45')]({'where':{'uniqueid':_0x39ca36['params']['id']}})['then'](handleEntityNotFound(_0x20a202,null))[_0xd457('0x26')](saveUpdates(_0x39ca36[_0xd457('0x47')],null))[_0xd457('0x26')](respondWithResult(_0x20a202,null))[_0xd457('0x41')](handleError(_0x20a202,null));}; \ No newline at end of file +var _0x04e4=['Content-Range','apply','save','update','then','destroy','name','send','index','fieldName','type','model','keys','filters','query','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','merge','map','VIRTUAL','CmHopperHistory','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0x04e4,0x15e));var _0x404e=function(_0x557383,_0x227505){_0x557383=_0x557383-0x0;var _0x4afb9c=_0x04e4[_0x557383];return _0x4afb9c;};'use strict';var pdf=require(_0x404e('0x0'));var emlformat=require(_0x404e('0x1'));var rimraf=require(_0x404e('0x2'));var zipdir=require(_0x404e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x404e('0x4'));var moment=require(_0x404e('0x5'));var BPromise=require(_0x404e('0x6'));var Mustache=require(_0x404e('0x7'));var util=require(_0x404e('0x8'));var path=require(_0x404e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x404e('0xa'));var fs=require('fs');var _=require(_0x404e('0xb'));var squel=require(_0x404e('0xc'));var crypto=require(_0x404e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x404e('0xe'));var querystring=require(_0x404e('0xf'));var Papa=require(_0x404e('0x10'));var Redis=require(_0x404e('0x11'));var authService=require(_0x404e('0x12'));var qs=require(_0x404e('0x13'));var as=require(_0x404e('0x14'));var hardwareService=require(_0x404e('0x15'));var logger=require(_0x404e('0x16'))(_0x404e('0x17'));var utils=require(_0x404e('0x18'));var config=require(_0x404e('0x19'));var licenseUtil=require(_0x404e('0x1a'));var db=require(_0x404e('0x1b'))['db'];function respondWithStatusCode(_0x3db641,_0x390b19){_0x390b19=_0x390b19||0xcc;return function(_0x1ae6e){if(_0x1ae6e){return _0x3db641[_0x404e('0x1c')](_0x390b19);}return _0x3db641[_0x404e('0x1d')](_0x390b19)[_0x404e('0x1e')]();};}function respondWithResult(_0x46f738,_0x22f862){_0x22f862=_0x22f862||0xc8;return function(_0xaef464){if(_0xaef464){return _0x46f738[_0x404e('0x1d')](_0x22f862)[_0x404e('0x1f')](_0xaef464);}};}function respondWithFilteredResult(_0x5db951,_0x206e9d){return function(_0x2cc382){if(_0x2cc382){var _0x2ac7ba=_0x2cc382[_0x404e('0x20')],_0x3ef532=_0x206e9d[_0x404e('0x21')],_0x5c17ec=_0x206e9d[_0x404e('0x21')]+_0x206e9d['limit'],_0x56d59b;if(_0x5c17ec>=_0x2ac7ba){_0x5c17ec=_0x2ac7ba;_0x56d59b=0xc8;}else{_0x56d59b=0xce;}_0x5db951[_0x404e('0x1d')](_0x56d59b);return _0x5db951[_0x404e('0x22')](_0x404e('0x23'),_0x3ef532+'-'+_0x5c17ec+'/'+_0x2ac7ba)[_0x404e('0x1f')](_0x2cc382);}return null;};}function patchUpdates(_0x288834){return function(_0x491198){try{jsonpatch[_0x404e('0x24')](_0x491198,_0x288834,!![]);}catch(_0x3bafe6){return BPromise['reject'](_0x3bafe6);}return _0x491198[_0x404e('0x25')]();};}function saveUpdates(_0x39ea01,_0x2f305e){return function(_0x53d18d){if(_0x53d18d){return _0x53d18d[_0x404e('0x26')](_0x39ea01)[_0x404e('0x27')](function(_0x131d39){return _0x131d39;});}return null;};}function removeEntity(_0x1e08d0,_0x1b1251){return function(_0x5e2efc){if(_0x5e2efc){return _0x5e2efc[_0x404e('0x28')]()[_0x404e('0x27')](function(){_0x1e08d0[_0x404e('0x1d')](0xcc)[_0x404e('0x1e')]();});}};}function handleEntityNotFound(_0x1041fe,_0x3c27c1){return function(_0x16bc4e){if(!_0x16bc4e){_0x1041fe['sendStatus'](0x194);}return _0x16bc4e;};}function handleError(_0x511f22,_0x3bc288){_0x3bc288=_0x3bc288||0x1f4;return function(_0x4bef94){logger['error'](_0x4bef94['stack']);if(_0x4bef94[_0x404e('0x29')]){delete _0x4bef94[_0x404e('0x29')];}_0x511f22[_0x404e('0x1d')](_0x3bc288)[_0x404e('0x2a')](_0x4bef94);};}exports[_0x404e('0x2b')]=function(_0x5e8ffd,_0x40034c){var _0x1e844a={},_0x2d76ca={},_0x3c1299={'count':0x0,'rows':[]};var _0x4a190c=_['map'](db['CmHopperHistory']['rawAttributes'],function(_0x50c9cd){return{'name':_0x50c9cd[_0x404e('0x2c')],'type':_0x50c9cd[_0x404e('0x2d')]['key']};});_0x2d76ca[_0x404e('0x2e')]=_['map'](_0x4a190c,'name');_0x2d76ca['query']=_[_0x404e('0x2f')](_0x5e8ffd['query']);_0x2d76ca[_0x404e('0x30')]=_['intersection'](_0x2d76ca[_0x404e('0x2e')],_0x2d76ca[_0x404e('0x31')]);_0x1e844a['attributes']=_[_0x404e('0x32')](_0x2d76ca['model'],qs[_0x404e('0x33')](_0x5e8ffd[_0x404e('0x31')][_0x404e('0x33')]));_0x1e844a[_0x404e('0x34')]=_0x1e844a[_0x404e('0x34')][_0x404e('0x35')]?_0x1e844a[_0x404e('0x34')]:_0x2d76ca[_0x404e('0x2e')];if(!_0x5e8ffd[_0x404e('0x31')]['hasOwnProperty'](_0x404e('0x36'))){_0x1e844a[_0x404e('0x37')]=qs[_0x404e('0x37')](_0x5e8ffd[_0x404e('0x31')]['limit']);_0x1e844a[_0x404e('0x21')]=qs[_0x404e('0x21')](_0x5e8ffd[_0x404e('0x31')][_0x404e('0x21')]);}_0x1e844a[_0x404e('0x38')]=qs[_0x404e('0x39')](_0x5e8ffd[_0x404e('0x31')][_0x404e('0x39')]);_0x1e844a['where']=qs[_0x404e('0x30')](_['pick'](_0x5e8ffd[_0x404e('0x31')],_0x2d76ca[_0x404e('0x30')]),_0x4a190c);if(_0x5e8ffd[_0x404e('0x31')][_0x404e('0x3a')]){_0x1e844a[_0x404e('0x3b')]=_[_0x404e('0x3c')](_0x1e844a[_0x404e('0x3b')],{'$or':_[_0x404e('0x3d')](_0x4a190c,function(_0x487ac7){if(_0x487ac7['type']!==_0x404e('0x3e')){var _0x3e979b={};_0x3e979b[_0x487ac7[_0x404e('0x29')]]={'$like':'%'+_0x5e8ffd['query'][_0x404e('0x3a')]+'%'};return _0x3e979b;}})});}_0x1e844a=_['merge']({},_0x1e844a,_0x5e8ffd['options']);var _0x4017eb={'where':_0x1e844a['where']};return db[_0x404e('0x3f')][_0x404e('0x20')](_0x4017eb)['then'](function(_0xd67aff){_0x3c1299[_0x404e('0x20')]=_0xd67aff;if(_0x5e8ffd['query'][_0x404e('0x40')]){_0x1e844a[_0x404e('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x404e('0x42')](_0x1e844a);})[_0x404e('0x27')](function(_0x5da543){_0x3c1299[_0x404e('0x43')]=_0x5da543;return _0x3c1299;})[_0x404e('0x27')](respondWithFilteredResult(_0x40034c,_0x1e844a))[_0x404e('0x44')](handleError(_0x40034c,null));};exports['show']=function(_0x1404a6,_0x4cd21a){var _0x55f19c={'raw':!![],'where':{'id':_0x1404a6[_0x404e('0x45')]['id']}},_0x3bf893={};_0x3bf893[_0x404e('0x2e')]=_[_0x404e('0x2f')](db[_0x404e('0x3f')][_0x404e('0x46')]);_0x3bf893[_0x404e('0x31')]=_[_0x404e('0x2f')](_0x1404a6[_0x404e('0x31')]);_0x3bf893[_0x404e('0x30')]=_[_0x404e('0x32')](_0x3bf893['model'],_0x3bf893[_0x404e('0x31')]);_0x55f19c[_0x404e('0x34')]=_[_0x404e('0x32')](_0x3bf893['model'],qs[_0x404e('0x33')](_0x1404a6[_0x404e('0x31')][_0x404e('0x33')]));_0x55f19c[_0x404e('0x34')]=_0x55f19c[_0x404e('0x34')]['length']?_0x55f19c[_0x404e('0x34')]:_0x3bf893[_0x404e('0x2e')];if(_0x1404a6[_0x404e('0x31')]['includeAll']){_0x55f19c[_0x404e('0x41')]=[{'all':!![]}];}_0x55f19c=_[_0x404e('0x3c')]({},_0x55f19c,_0x1404a6[_0x404e('0x47')]);return db[_0x404e('0x3f')][_0x404e('0x48')](_0x55f19c)[_0x404e('0x27')](handleEntityNotFound(_0x4cd21a,null))[_0x404e('0x27')](respondWithResult(_0x4cd21a,null))[_0x404e('0x44')](handleError(_0x4cd21a,null));};exports[_0x404e('0x49')]=function(_0x11253b,_0x51ce85){return db[_0x404e('0x3f')][_0x404e('0x49')](_0x11253b[_0x404e('0x4a')],{})[_0x404e('0x27')](respondWithResult(_0x51ce85,0xc9))['catch'](handleError(_0x51ce85,null));};exports[_0x404e('0x4b')]=function(_0x28dc38,_0x3a5a03){return db['CmHopperHistory'][_0x404e('0x4b')]()[_0x404e('0x27')](respondWithResult(_0x3a5a03,null))['catch'](handleError(_0x3a5a03,null));};exports[_0x404e('0x26')]=function(_0x428d9a,_0x39c976){if(_0x428d9a[_0x404e('0x4a')][_0x404e('0x4c')]){delete _0x428d9a[_0x404e('0x4a')][_0x404e('0x4c')];}return db[_0x404e('0x3f')]['find']({'where':{'uniqueid':_0x428d9a[_0x404e('0x45')]['id']}})['then'](handleEntityNotFound(_0x39c976,null))[_0x404e('0x27')](saveUpdates(_0x428d9a['body'],null))[_0x404e('0x27')](respondWithResult(_0x39c976,null))[_0x404e('0x44')](handleError(_0x39c976,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f3096d1..c106884 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.model.js +++ b/server/api/cmHopperHistory/cmHopperHistory.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x422c=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','bluebird','path'];(function(_0x526982,_0x41d59e){var _0x4d09b7=function(_0x2574ff){while(--_0x2574ff){_0x526982['push'](_0x526982['shift']());}};_0x4d09b7(++_0x41d59e);}(_0x422c,0x1cf));var _0xc422=function(_0x353c7f,_0x1d2111){_0x353c7f=_0x353c7f-0x0;var _0x5074c1=_0x422c[_0x353c7f];return _0x5074c1;};'use strict';var _=require('lodash');var util=require(_0xc422('0x0'));var logger=require(_0xc422('0x1'))(_0xc422('0x2'));var moment=require('moment');var BPromise=require(_0xc422('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc422('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc422('0x5'));module[_0xc422('0x6')]=function(_0x500e42,_0x34a619){return _0x500e42[_0xc422('0x7')](_0xc422('0x8'),attributes,{'tableName':_0xc422('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xc422('0xa')]},{'name':'uniqueid','fields':[_0xc422('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa835=['CmHopperHistory','uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x3cc82b,_0x259747){var _0x4d2e83=function(_0x485795){while(--_0x485795){_0x3cc82b['push'](_0x3cc82b['shift']());}};_0x4d2e83(++_0x259747);}(_0xa835,0x157));var _0x5a83=function(_0x427b3b,_0x4c82fb){_0x427b3b=_0x427b3b-0x0;var _0x54807b=_0xa835[_0x427b3b];return _0x54807b;};'use strict';var _=require('lodash');var util=require(_0x5a83('0x0'));var logger=require(_0x5a83('0x1'))(_0x5a83('0x2'));var moment=require(_0x5a83('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a83('0x4'));var rimraf=require(_0x5a83('0x5'));var config=require(_0x5a83('0x6'));var attributes=require(_0x5a83('0x7'));module[_0x5a83('0x8')]=function(_0xfd3ad9,_0x267285){return _0xfd3ad9['define'](_0x5a83('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x5a83('0xa'),'fields':[_0x5a83('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d8dba95..de29d8f 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.rpc.js +++ b/server/api/cmHopperHistory/cmHopperHistory.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b5e=['`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','catch','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','debug','GetCampaignHopperHistory','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateCmHopperHistory','CmHopperHistory','options','raw','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b5e,0x137));var _0xe2b5=function(_0x57ad68,_0x4a2577){_0x57ad68=_0x57ad68-0x0;var _0x1158dd=_0x2b5e[_0x57ad68];return _0x1158dd;};'use strict';var _=require(_0xe2b5('0x0'));var util=require(_0xe2b5('0x1'));var moment=require('moment');var BPromise=require(_0xe2b5('0x2'));var rs=require(_0xe2b5('0x3'));var fs=require('fs');var Redis=require(_0xe2b5('0x4'));var db=require(_0xe2b5('0x5'))['db'];var utils=require(_0xe2b5('0x6'));var logger=require(_0xe2b5('0x7'))(_0xe2b5('0x8'));var config=require(_0xe2b5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe2b5('0xa')][_0xe2b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52f95b,_0x4a0f80,_0x3d4636){return new BPromise(function(_0x1ae8e2,_0x45fc41){return client['request'](_0x52f95b,_0x3d4636)[_0xe2b5('0xc')](function(_0x364cab){logger[_0xe2b5('0xd')](_0xe2b5('0xe'),_0x4a0f80,_0xe2b5('0xf'));logger['debug'](_0xe2b5('0x10'),_0x4a0f80,'request\x20sent',JSON[_0xe2b5('0x11')](_0x364cab));if(_0x364cab[_0xe2b5('0x12')]){if(_0x364cab[_0xe2b5('0x12')]['code']===0x1f4){logger['error'](_0xe2b5('0xe'),_0x4a0f80,_0x364cab[_0xe2b5('0x12')][_0xe2b5('0x13')]);return _0x45fc41(_0x364cab[_0xe2b5('0x12')][_0xe2b5('0x13')]);}logger[_0xe2b5('0x12')](_0xe2b5('0xe'),_0x4a0f80,_0x364cab[_0xe2b5('0x12')][_0xe2b5('0x13')]);return _0x1ae8e2(_0x364cab[_0xe2b5('0x12')][_0xe2b5('0x13')]);}else{logger[_0xe2b5('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x4a0f80,_0xe2b5('0xf'));_0x1ae8e2(_0x364cab['result'][_0xe2b5('0x13')]);}})['catch'](function(_0x17c31d){logger[_0xe2b5('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x4a0f80,_0x17c31d);_0x45fc41(_0x17c31d);});});}exports[_0xe2b5('0x14')]=function(_0x3f9d90){var _0x134fd5=this;return new Promise(function(_0xdc9260,_0xca5ce7){return db[_0xe2b5('0x15')]['create'](_0x3f9d90['body'],{'raw':_0x3f9d90[_0xe2b5('0x16')]?_0x3f9d90[_0xe2b5('0x16')][_0xe2b5('0x17')]===undefined?!![]:![]:!![]})[_0xe2b5('0xc')](function(_0x31638a){logger[_0xe2b5('0xd')](_0xe2b5('0x14'),_0x3f9d90);logger['debug'](_0xe2b5('0x14'),_0x3f9d90,JSON[_0xe2b5('0x11')](_0x31638a));_0xdc9260(_0x31638a);})['catch'](function(_0xbbdbc9){logger['error'](_0xe2b5('0x14'),_0xbbdbc9['message'],_0x3f9d90);_0xca5ce7(_0x134fd5[_0xe2b5('0x12')](0x1f4,_0xbbdbc9[_0xe2b5('0x13')]));});});};exports['AvgHandleTime']=function(_0x38b59c){var _0x42fc86=this;return new Promise(function(_0x1f814b,_0x5d8dfe){return db[_0xe2b5('0x15')][_0xe2b5('0x18')]({'raw':_0x38b59c[_0xe2b5('0x16')]?_0x38b59c['options'][_0xe2b5('0x17')]===undefined?!![]:![]:!![],'where':_0x38b59c[_0xe2b5('0x16')]?_0x38b59c[_0xe2b5('0x16')][_0xe2b5('0x19')]||null:null,'attributes':[[db[_0xe2b5('0x1a')]['fn']('COUNT',db[_0xe2b5('0x1a')][_0xe2b5('0x1b')]('id')),_0xe2b5('0x1c')],[db['sequelize']['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xe2b5('0x1f')],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')]('`state`\x20=\x2010,\x201,\x20null'))),_0xe2b5('0x20')],[db[_0xe2b5('0x1a')]['fn']('COUNT',db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')](_0xe2b5('0x21')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xe2b5('0x1a')]['fn']('AVG',db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')]['literal'](_0xe2b5('0x22')))),_0xe2b5('0x23')],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x24'),db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')](_0xe2b5('0x25')))),_0xe2b5('0x26')]]})[_0xe2b5('0xc')](function(_0x3fdd66){logger[_0xe2b5('0xd')](_0xe2b5('0x27'),_0x38b59c);logger['debug'](_0xe2b5('0x27'),_0x38b59c,JSON[_0xe2b5('0x11')](_0x3fdd66));_0x1f814b(_0x3fdd66);})[_0xe2b5('0x28')](function(_0x3c24ce){logger[_0xe2b5('0x12')]('AvgHandleTime',_0x3c24ce[_0xe2b5('0x13')],_0x38b59c);_0x5d8dfe(_0x42fc86[_0xe2b5('0x12')](0x1f4,_0x3c24ce[_0xe2b5('0x13')]));});});};exports[_0xe2b5('0x29')]=function(_0x2e51bc){var _0xc5f449=this;return new Promise(function(_0x1125c0,_0x4d8612){return db[_0xe2b5('0x15')][_0xe2b5('0x18')]({'raw':_0x2e51bc[_0xe2b5('0x16')]?_0x2e51bc[_0xe2b5('0x16')][_0xe2b5('0x17')]===undefined?!![]:![]:!![],'where':_0x2e51bc[_0xe2b5('0x16')]?_0x2e51bc[_0xe2b5('0x16')]['where']||null:null,'attributes':[[_0xe2b5('0x2a'),_0xe2b5('0x2b')],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x1d'),db['sequelize']['fn']('IF',db[_0xe2b5('0x1a')]['literal'](_0xe2b5('0x2c')))),_0xe2b5('0x2d')],[db['sequelize']['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db['sequelize'][_0xe2b5('0x1e')](_0xe2b5('0x2e')))),_0xe2b5('0x2f')],[db['sequelize']['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xe2b5('0x30')],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')](_0xe2b5('0x31')))),_0xe2b5('0x32')],[db['sequelize']['fn']('COUNT',db[_0xe2b5('0x1a')]['fn']('IF',db['sequelize'][_0xe2b5('0x1e')](_0xe2b5('0x33')))),_0xe2b5('0x34')],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db['sequelize'][_0xe2b5('0x1e')](_0xe2b5('0x35')))),'outboundDropCallsDayTimeout'],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xe2b5('0x36')],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x1d'),db['sequelize']['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')]('`state`\x20=\x2012,\x201,\x20null'))),_0xe2b5('0x37')],[db['sequelize']['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db['sequelize'][_0xe2b5('0x1e')](_0xe2b5('0x38')))),_0xe2b5('0x39')],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')]('`state`\x20=\x2014,\x201,\x20null'))),_0xe2b5('0x3a')],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x1d'),db['sequelize']['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0xe2b5('0x3b')],[db['sequelize']['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')](_0xe2b5('0x3c')))),_0xe2b5('0x3d')],[db[_0xe2b5('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe2b5('0x1a')][_0xe2b5('0x1e')]('`state`\x20=\x2020,\x201,\x20null'))),_0xe2b5('0x3b')],[db[_0xe2b5('0x1a')]['fn']('COUNT',db[_0xe2b5('0x1a')]['fn']('IF',db['sequelize']['literal'](_0xe2b5('0x3e')))),_0xe2b5('0x3f')]],'group':['campaign']})['then'](function(_0x425d2b){logger['info'](_0xe2b5('0x29'),_0x2e51bc);logger[_0xe2b5('0x40')](_0xe2b5('0x29'),_0x2e51bc,JSON[_0xe2b5('0x11')](_0x425d2b));_0x1125c0(_0x425d2b);})[_0xe2b5('0x28')](function(_0x85f9c9){logger[_0xe2b5('0x12')](_0xe2b5('0x29'),_0x85f9c9[_0xe2b5('0x13')],_0x2e51bc);_0x4d8612(_0xc5f449['error'](0x1f4,_0x85f9c9[_0xe2b5('0x13')]));});});};exports[_0xe2b5('0x41')]=function(_0x497b2f){var _0x5edfd0=this;return new Promise(function(_0x3392d6,_0x18424c){return db[_0xe2b5('0x15')][_0xe2b5('0x18')]({'raw':_0x497b2f[_0xe2b5('0x16')]?_0x497b2f[_0xe2b5('0x16')][_0xe2b5('0x17')]===undefined?!![]:![]:!![],'where':_0x497b2f[_0xe2b5('0x16')]?_0x497b2f[_0xe2b5('0x16')]['where']||null:null,'attributes':[[_0xe2b5('0x2a'),_0xe2b5('0x2b')],[db['sequelize']['fn']('COUNT',db[_0xe2b5('0x1a')][_0xe2b5('0x1b')]('id')),_0xe2b5('0x42')],[db[_0xe2b5('0x1a')]['fn'](_0xe2b5('0x1d'),db[_0xe2b5('0x1a')]['fn']('IF',db['sequelize'][_0xe2b5('0x1e')](_0xe2b5('0x43')))),_0xe2b5('0x44')]],'group':[_0xe2b5('0x2a')]})[_0xe2b5('0xc')](function(_0x50ff35){logger['info'](_0xe2b5('0x41'),_0x497b2f);logger[_0xe2b5('0x40')](_0xe2b5('0x41'),_0x497b2f,JSON[_0xe2b5('0x11')](_0x50ff35));_0x3392d6(_0x50ff35);})['catch'](function(_0x17e4ec){logger[_0xe2b5('0x12')](_0xe2b5('0x41'),_0x17e4ec[_0xe2b5('0x13')],_0x497b2f);_0x18424c(_0x5edfd0[_0xe2b5('0x12')](0x1f4,_0x17e4ec[_0xe2b5('0x13')]));});});}; \ No newline at end of file +var _0xb1d3=['then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','COUNT','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','info','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3797aa,_0x47ebe1){var _0x261182=function(_0x1d5b05){while(--_0x1d5b05){_0x3797aa['push'](_0x3797aa['shift']());}};_0x261182(++_0x47ebe1);}(_0xb1d3,0xcc));var _0x3b1d=function(_0x3704a1,_0x309580){_0x3704a1=_0x3704a1-0x0;var _0x39ed5a=_0xb1d3[_0x3704a1];return _0x39ed5a;};'use strict';var _=require(_0x3b1d('0x0'));var util=require('util');var moment=require(_0x3b1d('0x1'));var BPromise=require(_0x3b1d('0x2'));var rs=require(_0x3b1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b1d('0x4'));var logger=require(_0x3b1d('0x5'))(_0x3b1d('0x6'));var config=require(_0x3b1d('0x7'));var jayson=require(_0x3b1d('0x8'));var client=jayson[_0x3b1d('0x9')][_0x3b1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea7f7,_0x2a4b19,_0xcdf9e9){return new BPromise(function(_0x34377a,_0x4d0c4a){return client[_0x3b1d('0xb')](_0x4ea7f7,_0xcdf9e9)[_0x3b1d('0xc')](function(_0x25130f){logger['info'](_0x3b1d('0xd'),_0x2a4b19,_0x3b1d('0xe'));logger[_0x3b1d('0xf')](_0x3b1d('0x10'),_0x2a4b19,_0x3b1d('0xe'),JSON[_0x3b1d('0x11')](_0x25130f));if(_0x25130f['error']){if(_0x25130f[_0x3b1d('0x12')]['code']===0x1f4){logger[_0x3b1d('0x12')](_0x3b1d('0xd'),_0x2a4b19,_0x25130f[_0x3b1d('0x12')][_0x3b1d('0x13')]);return _0x4d0c4a(_0x25130f[_0x3b1d('0x12')][_0x3b1d('0x13')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x2a4b19,_0x25130f[_0x3b1d('0x12')][_0x3b1d('0x13')]);return _0x34377a(_0x25130f[_0x3b1d('0x12')][_0x3b1d('0x13')]);}else{logger['info'](_0x3b1d('0xd'),_0x2a4b19,_0x3b1d('0xe'));_0x34377a(_0x25130f[_0x3b1d('0x14')][_0x3b1d('0x13')]);}})[_0x3b1d('0x15')](function(_0x11dd28){logger[_0x3b1d('0x12')](_0x3b1d('0xd'),_0x2a4b19,_0x11dd28);_0x4d0c4a(_0x11dd28);});});}exports[_0x3b1d('0x16')]=function(_0x4f6a3b){var _0x5a08b1=this;return new Promise(function(_0x16dee3,_0x38e594){return db[_0x3b1d('0x17')][_0x3b1d('0x18')](_0x4f6a3b[_0x3b1d('0x19')],{'raw':_0x4f6a3b['options']?_0x4f6a3b[_0x3b1d('0x1a')][_0x3b1d('0x1b')]===undefined?!![]:![]:!![]})[_0x3b1d('0xc')](function(_0x5d2855){logger['info']('CreateCmHopperHistory',_0x4f6a3b);logger[_0x3b1d('0xf')](_0x3b1d('0x16'),_0x4f6a3b,JSON['stringify'](_0x5d2855));_0x16dee3(_0x5d2855);})[_0x3b1d('0x15')](function(_0x269934){logger[_0x3b1d('0x12')](_0x3b1d('0x16'),_0x269934['message'],_0x4f6a3b);_0x38e594(_0x5a08b1[_0x3b1d('0x12')](0x1f4,_0x269934[_0x3b1d('0x13')]));});});};exports[_0x3b1d('0x1c')]=function(_0x3ff0b9){var _0x53d835=this;return new Promise(function(_0xd3dda4,_0x58fc15){return db[_0x3b1d('0x17')][_0x3b1d('0x1d')]({'raw':_0x3ff0b9['options']?_0x3ff0b9[_0x3b1d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3ff0b9[_0x3b1d('0x1a')]?_0x3ff0b9['options'][_0x3b1d('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['col']('id')),_0x3b1d('0x21')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db['sequelize'][_0x3b1d('0x22')](_0x3b1d('0x23')))),_0x3b1d('0x24')],[db['sequelize']['fn']('COUNT',db[_0x3b1d('0x20')]['fn']('IF',db['sequelize'][_0x3b1d('0x22')](_0x3b1d('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x26')))),_0x3b1d('0x27')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x28'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x29')))),_0x3b1d('0x2a')],[db['sequelize']['fn'](_0x3b1d('0x28'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x2b')))),_0x3b1d('0x2c')]]})['then'](function(_0x5814b3){logger[_0x3b1d('0x2d')](_0x3b1d('0x1c'),_0x3ff0b9);logger[_0x3b1d('0xf')](_0x3b1d('0x1c'),_0x3ff0b9,JSON[_0x3b1d('0x11')](_0x5814b3));_0xd3dda4(_0x5814b3);})[_0x3b1d('0x15')](function(_0x5dda57){logger['error']('AvgHandleTime',_0x5dda57['message'],_0x3ff0b9);_0x58fc15(_0x53d835[_0x3b1d('0x12')](0x1f4,_0x5dda57[_0x3b1d('0x13')]));});});};exports[_0x3b1d('0x2e')]=function(_0x2aa197){var _0x253428=this;return new Promise(function(_0xe3c8f7,_0x3a2406){return db[_0x3b1d('0x17')]['findAll']({'raw':_0x2aa197['options']?_0x2aa197['options']['raw']===undefined?!![]:![]:!![],'where':_0x2aa197['options']?_0x2aa197[_0x3b1d('0x1a')][_0x3b1d('0x1e')]||null:null,'attributes':[[_0x3b1d('0x2f'),'name'],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x30')))),_0x3b1d('0x31')],[db[_0x3b1d('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x32')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x23')))),'outboundAnswerCallsDay'],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db['sequelize']['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x33')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x3b1d('0x1f'),db['sequelize']['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')]('`state`\x20=\x208,\x201,\x20null'))),_0x3b1d('0x34')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db['sequelize'][_0x3b1d('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3b1d('0x35')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3b1d('0x36')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db['sequelize'][_0x3b1d('0x22')](_0x3b1d('0x37')))),_0x3b1d('0x38')],[db[_0x3b1d('0x20')]['fn']('COUNT',db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x39')))),_0x3b1d('0x3a')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0x3b1d('0x20')]['fn']('COUNT',db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x3c')))),_0x3b1d('0x3d')],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db['sequelize']['literal'](_0x3b1d('0x3e')))),_0x3b1d('0x3f')],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x40')))),_0x3b1d('0x3d')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db['sequelize']['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x41')))),_0x3b1d('0x42')]],'group':['campaign']})[_0x3b1d('0xc')](function(_0x522b39){logger['info']('GetVoiceQueueHopperHistory',_0x2aa197);logger['debug'](_0x3b1d('0x2e'),_0x2aa197,JSON[_0x3b1d('0x11')](_0x522b39));_0xe3c8f7(_0x522b39);})[_0x3b1d('0x15')](function(_0x2939fc){logger[_0x3b1d('0x12')](_0x3b1d('0x2e'),_0x2939fc['message'],_0x2aa197);_0x3a2406(_0x253428['error'](0x1f4,_0x2939fc[_0x3b1d('0x13')]));});});};exports[_0x3b1d('0x43')]=function(_0x25327b){var _0x268ee6=this;return new Promise(function(_0x288bf4,_0x218381){return db[_0x3b1d('0x17')][_0x3b1d('0x1d')]({'raw':_0x25327b[_0x3b1d('0x1a')]?_0x25327b[_0x3b1d('0x1a')][_0x3b1d('0x1b')]===undefined?!![]:![]:!![],'where':_0x25327b[_0x3b1d('0x1a')]?_0x25327b['options'][_0x3b1d('0x1e')]||null:null,'attributes':[[_0x3b1d('0x2f'),_0x3b1d('0x44')],[db[_0x3b1d('0x20')]['fn']('COUNT',db[_0x3b1d('0x20')][_0x3b1d('0x45')]('id')),_0x3b1d('0x46')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x3b1d('0x47')]],'group':[_0x3b1d('0x2f')]})[_0x3b1d('0xc')](function(_0x41be10){logger[_0x3b1d('0x2d')](_0x3b1d('0x43'),_0x25327b);logger['debug']('GetCampaignHopperHistory',_0x25327b,JSON[_0x3b1d('0x11')](_0x41be10));_0x288bf4(_0x41be10);})[_0x3b1d('0x15')](function(_0x3f1beb){logger[_0x3b1d('0x12')](_0x3b1d('0x43'),_0x3f1beb[_0x3b1d('0x13')],_0x25327b);_0x218381(_0x268ee6['error'](0x1f4,_0x3f1beb[_0x3b1d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index d34bb57..6316bab 100644 --- a/server/api/cmHopperHistory/index.js +++ b/server/api/cmHopperHistory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7580=['update','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x232eb4,_0x379f51){var _0x3d51a2=function(_0x27ae70){while(--_0x27ae70){_0x232eb4['push'](_0x232eb4['shift']());}};_0x3d51a2(++_0x379f51);}(_0x7580,0x14b));var _0x0758=function(_0x2d7551,_0x2780bc){_0x2d7551=_0x2d7551-0x0;var _0x485092=_0x7580[_0x2d7551];return _0x485092;};'use strict';var multer=require('multer');var util=require(_0x0758('0x0'));var path=require('path');var timeout=require(_0x0758('0x1'));var express=require('express');var router=express[_0x0758('0x2')]();var auth=require(_0x0758('0x3'));var interaction=require(_0x0758('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x0758('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0758('0x5')](_0x0758('0x6'),auth[_0x0758('0x7')](),controller[_0x0758('0x8')]);router[_0x0758('0x5')](_0x0758('0x9'),auth[_0x0758('0x7')](),controller[_0x0758('0xa')]);router[_0x0758('0xb')]('/',auth[_0x0758('0x7')](),controller[_0x0758('0xc')]);router[_0x0758('0xd')]('/:id',auth[_0x0758('0x7')](),controller[_0x0758('0xe')]);module['exports']=router; \ No newline at end of file +var _0x442b=['/describe','isAuthenticated','describe','/:id','show','post','create','update','exports','multer','path','express','Router','../../components/auth/service','./cmHopperHistory.controller','get','index'];(function(_0x21b4f4,_0x4ab686){var _0x97b9f1=function(_0x27225a){while(--_0x27225a){_0x21b4f4['push'](_0x21b4f4['shift']());}};_0x97b9f1(++_0x4ab686);}(_0x442b,0x6f));var _0xb442=function(_0xac989b,_0x1da105){_0xac989b=_0xac989b-0x0;var _0xabdd63=_0x442b[_0xac989b];return _0xabdd63;};'use strict';var multer=require(_0xb442('0x0'));var util=require('util');var path=require(_0xb442('0x1'));var timeout=require('connect-timeout');var express=require(_0xb442('0x2'));var router=express[_0xb442('0x3')]();var auth=require(_0xb442('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb442('0x5'));router[_0xb442('0x6')]('/',auth['isAuthenticated'](),controller[_0xb442('0x7')]);router['get'](_0xb442('0x8'),auth[_0xb442('0x9')](),controller[_0xb442('0xa')]);router['get'](_0xb442('0xb'),auth[_0xb442('0x9')](),controller[_0xb442('0xc')]);router[_0xb442('0xd')]('/',auth['isAuthenticated'](),controller[_0xb442('0xe')]);router['put'](_0xb442('0xb'),auth['isAuthenticated'](),controller[_0xb442('0xf')]);module[_0xb442('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 791f860..c3be19c 100644 --- a/server/api/cmList/cmList.attributes.js +++ b/server/api/cmList/cmList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0dfd=['STRING','sequelize','name'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x0dfd,0xa6));var _0xd0df=function(_0x348ec9,_0x4268c8){_0x348ec9=_0x348ec9-0x0;var _0x2b0c13=_0x0dfd[_0x348ec9];return _0x2b0c13;};'use strict';var Sequelize=require(_0xd0df('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd0df('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd0df('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf44=['sequelize','exports','STRING'];(function(_0x3a6eba,_0x7db8ac){var _0x531c0a=function(_0x349132){while(--_0x349132){_0x3a6eba['push'](_0x3a6eba['shift']());}};_0x531c0a(++_0x7db8ac);}(_0xcf44,0xba));var _0x4cf4=function(_0x52daca,_0x9a8d43){_0x52daca=_0x52daca-0x0;var _0x3abe0b=_0xcf44[_0x52daca];return _0x3abe0b;};'use strict';var Sequelize=require(_0x4cf4('0x0'));module[_0x4cf4('0x1')]={'name':{'type':Sequelize[_0x4cf4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4cf4('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 55db170..aa81dc9 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18a2=['order','sort','pick','filter','where','merge','type','options','CmList','includeAll','include','show','params','keys','rawAttributes','filters','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','describe','addDisposition','ListId','getDispositions','findOne','hasOwnProperty','nolimit','Disposition','removeDispositions','ids','addContacts','tags','join','isArray','push','each','CmContact','success','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','Content-type','download','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','defaultValue','cm_contacts','cf_%s','getCustomFields','findAndCountAll','omit','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','sendStatus','status','end','json','count','limit','set','Content-Range','reject','update','then','destroy','get','Lists','UserProfileResource','name','send','index','fieldName','key','model','map','query','intersection','fields','attributes','length','offset'];(function(_0xb1174e,_0x1e68a7){var _0x285bac=function(_0x32c505){while(--_0x32c505){_0xb1174e['push'](_0xb1174e['shift']());}};_0x285bac(++_0x1e68a7);}(_0x18a2,0x1ef));var _0x218a=function(_0x20ecb7,_0xa4853c){_0x20ecb7=_0x20ecb7-0x0;var _0x1ece1d=_0x18a2[_0x20ecb7];return _0x1ece1d;};'use strict';var pdf=require(_0x218a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x218a('0x1'));var jsonpatch=require(_0x218a('0x2'));var rp=require(_0x218a('0x3'));var moment=require(_0x218a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x218a('0x5'));var util=require(_0x218a('0x6'));var path=require(_0x218a('0x7'));var sox=require(_0x218a('0x8'));var csv=require(_0x218a('0x9'));var ejs=require(_0x218a('0xa'));var fs=require('fs');var _=require(_0x218a('0xb'));var squel=require(_0x218a('0xc'));var crypto=require(_0x218a('0xd'));var jsforce=require(_0x218a('0xe'));var deskjs=require(_0x218a('0xf'));var toCsv=require(_0x218a('0x9'));var querystring=require(_0x218a('0x10'));var Papa=require('papaparse');var Redis=require(_0x218a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x218a('0x12'));var as=require(_0x218a('0x13'));var hardwareService=require(_0x218a('0x14'));var logger=require(_0x218a('0x15'))('api');var utils=require(_0x218a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x218a('0x17'));var db=require(_0x218a('0x18'))['db'];config[_0x218a('0x19')]=_[_0x218a('0x1a')](config[_0x218a('0x19')],{'host':_0x218a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x218a('0x19')]));require(_0x218a('0x1c'))['register'](socket);function respondWithStatusCode(_0x237e1c,_0x1a106c){_0x1a106c=_0x1a106c||0xcc;return function(_0x334565){if(_0x334565){return _0x237e1c[_0x218a('0x1d')](_0x1a106c);}return _0x237e1c[_0x218a('0x1e')](_0x1a106c)[_0x218a('0x1f')]();};}function respondWithResult(_0x19e85f,_0x2fe335){_0x2fe335=_0x2fe335||0xc8;return function(_0x3f3ca9){if(_0x3f3ca9){return _0x19e85f['status'](_0x2fe335)[_0x218a('0x20')](_0x3f3ca9);}};}function respondWithFilteredResult(_0x2f87de,_0xd05de7){return function(_0x2ce1e2){if(_0x2ce1e2){var _0x1d404e=_0x2ce1e2[_0x218a('0x21')],_0x2b194c=_0xd05de7['offset'],_0x4227c5=_0xd05de7['offset']+_0xd05de7[_0x218a('0x22')],_0x17cf72;if(_0x4227c5>=_0x1d404e){_0x4227c5=_0x1d404e;_0x17cf72=0xc8;}else{_0x17cf72=0xce;}_0x2f87de[_0x218a('0x1e')](_0x17cf72);return _0x2f87de[_0x218a('0x23')](_0x218a('0x24'),_0x2b194c+'-'+_0x4227c5+'/'+_0x1d404e)[_0x218a('0x20')](_0x2ce1e2);}return null;};}function patchUpdates(_0x29938f){return function(_0x5601b0){try{jsonpatch['apply'](_0x5601b0,_0x29938f,!![]);}catch(_0x20adae){return BPromise[_0x218a('0x25')](_0x20adae);}return _0x5601b0['save']();};}function saveUpdates(_0x45efb1,_0x2abb28){return function(_0x1239ba){if(_0x1239ba){return _0x1239ba[_0x218a('0x26')](_0x45efb1)[_0x218a('0x27')](function(_0x2a8c2b){return _0x2a8c2b;});}return null;};}function removeEntity(_0x33a610,_0x220274){return function(_0x5b484a){if(_0x5b484a){return _0x5b484a[_0x218a('0x28')]()[_0x218a('0x27')](function(){var _0x951379=_0x5b484a[_0x218a('0x29')]({'plain':!![]});var _0x19ecc1=_0x218a('0x2a');return db[_0x218a('0x2b')][_0x218a('0x28')]({'where':{'type':_0x19ecc1,'resourceId':_0x951379['id']}})[_0x218a('0x27')](function(){return _0x5b484a;});})[_0x218a('0x27')](function(){_0x33a610[_0x218a('0x1e')](0xcc)[_0x218a('0x1f')]();});}};}function handleEntityNotFound(_0x3ec5db,_0xb7c847){return function(_0x1a3534){if(!_0x1a3534){_0x3ec5db[_0x218a('0x1d')](0x194);}return _0x1a3534;};}function handleError(_0x53a039,_0x599cd2){_0x599cd2=_0x599cd2||0x1f4;return function(_0x52c7b8){logger['error'](_0x52c7b8['stack']);if(_0x52c7b8['name']){delete _0x52c7b8[_0x218a('0x2c')];}_0x53a039[_0x218a('0x1e')](_0x599cd2)[_0x218a('0x2d')](_0x52c7b8);};}exports[_0x218a('0x2e')]=function(_0x5a7472,_0x2e8c15){var _0x3e1297={},_0x5708ac={},_0x4a5f84={'count':0x0,'rows':[]};var _0x32e143=_['map'](db['CmList']['rawAttributes'],function(_0x1d7f78){return{'name':_0x1d7f78[_0x218a('0x2f')],'type':_0x1d7f78['type'][_0x218a('0x30')]};});_0x5708ac[_0x218a('0x31')]=_[_0x218a('0x32')](_0x32e143,_0x218a('0x2c'));_0x5708ac[_0x218a('0x33')]=_['keys'](_0x5a7472[_0x218a('0x33')]);_0x5708ac['filters']=_[_0x218a('0x34')](_0x5708ac['model'],_0x5708ac[_0x218a('0x33')]);_0x3e1297['attributes']=_[_0x218a('0x34')](_0x5708ac[_0x218a('0x31')],qs[_0x218a('0x35')](_0x5a7472[_0x218a('0x33')][_0x218a('0x35')]));_0x3e1297[_0x218a('0x36')]=_0x3e1297[_0x218a('0x36')][_0x218a('0x37')]?_0x3e1297[_0x218a('0x36')]:_0x5708ac['model'];if(!_0x5a7472['query']['hasOwnProperty']('nolimit')){_0x3e1297['limit']=qs[_0x218a('0x22')](_0x5a7472[_0x218a('0x33')][_0x218a('0x22')]);_0x3e1297[_0x218a('0x38')]=qs['offset'](_0x5a7472[_0x218a('0x33')]['offset']);}_0x3e1297[_0x218a('0x39')]=qs[_0x218a('0x3a')](_0x5a7472['query']['sort']);_0x3e1297['where']=qs['filters'](_[_0x218a('0x3b')](_0x5a7472[_0x218a('0x33')],_0x5708ac['filters']),_0x32e143);if(_0x5a7472['query'][_0x218a('0x3c')]){_0x3e1297[_0x218a('0x3d')]=_[_0x218a('0x3e')](_0x3e1297[_0x218a('0x3d')],{'$or':_[_0x218a('0x32')](_0x32e143,function(_0x5284ce){if(_0x5284ce[_0x218a('0x3f')]!=='VIRTUAL'){var _0x9c63a={};_0x9c63a[_0x5284ce[_0x218a('0x2c')]]={'$like':'%'+_0x5a7472['query'][_0x218a('0x3c')]+'%'};return _0x9c63a;}})});}_0x3e1297=_[_0x218a('0x3e')]({},_0x3e1297,_0x5a7472[_0x218a('0x40')]);var _0x58d638={'where':_0x3e1297[_0x218a('0x3d')]};return db[_0x218a('0x41')][_0x218a('0x21')](_0x58d638)[_0x218a('0x27')](function(_0x578a15){_0x4a5f84[_0x218a('0x21')]=_0x578a15;if(_0x5a7472[_0x218a('0x33')][_0x218a('0x42')]){_0x3e1297[_0x218a('0x43')]=[{'all':!![]}];}return db[_0x218a('0x41')]['findAll'](_0x3e1297);})[_0x218a('0x27')](function(_0x24abf3){_0x4a5f84['rows']=_0x24abf3;return _0x4a5f84;})[_0x218a('0x27')](respondWithFilteredResult(_0x2e8c15,_0x3e1297))['catch'](handleError(_0x2e8c15,null));};exports[_0x218a('0x44')]=function(_0x1becac,_0x97cd06){var _0x5956db={'raw':![],'where':{'id':_0x1becac[_0x218a('0x45')]['id']}},_0x2f374a={};_0x2f374a[_0x218a('0x31')]=_[_0x218a('0x46')](db[_0x218a('0x41')][_0x218a('0x47')]);_0x2f374a['query']=_['keys'](_0x1becac[_0x218a('0x33')]);_0x2f374a[_0x218a('0x48')]=_[_0x218a('0x34')](_0x2f374a[_0x218a('0x31')],_0x2f374a[_0x218a('0x33')]);_0x5956db['attributes']=_[_0x218a('0x34')](_0x2f374a[_0x218a('0x31')],qs['fields'](_0x1becac[_0x218a('0x33')][_0x218a('0x35')]));_0x5956db[_0x218a('0x36')]=_0x5956db[_0x218a('0x36')]['length']?_0x5956db['attributes']:_0x2f374a[_0x218a('0x31')];if(_0x1becac[_0x218a('0x33')][_0x218a('0x42')]){_0x5956db['include']=[{'all':!![]}];}_0x5956db=_['merge']({},_0x5956db,_0x1becac[_0x218a('0x40')]);return db['CmList'][_0x218a('0x49')](_0x5956db)[_0x218a('0x27')](handleEntityNotFound(_0x97cd06,null))['then'](respondWithResult(_0x97cd06,null))[_0x218a('0x4a')](handleError(_0x97cd06,null));};exports[_0x218a('0x4b')]=function(_0x1e0f52,_0x508c14){return db['CmList']['create'](_0x1e0f52[_0x218a('0x4c')],{})[_0x218a('0x27')](function(_0x30b49b){var _0x3b4b73=_0x1e0f52['user'][_0x218a('0x29')]({'plain':!![]});if(!_0x3b4b73)throw new Error(_0x218a('0x4d'));if(_0x3b4b73[_0x218a('0x4e')]===_0x218a('0x4f')){var _0x4d58b5=_0x30b49b[_0x218a('0x29')]({'plain':!![]});var _0x13dede=_0x218a('0x2a');return db['UserProfileSection'][_0x218a('0x49')]({'where':{'name':_0x13dede,'userProfileId':_0x3b4b73[_0x218a('0x50')]},'raw':!![]})[_0x218a('0x27')](function(_0x5259ec){if(_0x5259ec&&_0x5259ec[_0x218a('0x51')]===0x0){return db[_0x218a('0x2b')]['create']({'name':_0x4d58b5[_0x218a('0x2c')],'resourceId':_0x4d58b5['id'],'type':_0x5259ec['name'],'sectionId':_0x5259ec['id']},{})[_0x218a('0x27')](function(){return _0x30b49b;});}else{return _0x30b49b;}})[_0x218a('0x4a')](function(_0x364207){logger[_0x218a('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x364207);throw _0x364207;});}return _0x30b49b;})[_0x218a('0x27')](respondWithResult(_0x508c14,0xc9))[_0x218a('0x4a')](handleError(_0x508c14,null));};exports[_0x218a('0x26')]=function(_0x1630eb,_0x2bd5f3){if(_0x1630eb['body']['id']){delete _0x1630eb[_0x218a('0x4c')]['id'];}return db[_0x218a('0x41')][_0x218a('0x49')]({'where':{'id':_0x1630eb[_0x218a('0x45')]['id']}})[_0x218a('0x27')](handleEntityNotFound(_0x2bd5f3,null))[_0x218a('0x27')](saveUpdates(_0x1630eb[_0x218a('0x4c')],null))[_0x218a('0x27')](respondWithResult(_0x2bd5f3,null))[_0x218a('0x4a')](handleError(_0x2bd5f3,null));};exports[_0x218a('0x28')]=function(_0x2e3e31,_0x403b5e){return db['CmList']['find']({'where':{'id':_0x2e3e31['params']['id']}})['then'](handleEntityNotFound(_0x403b5e,null))[_0x218a('0x27')](removeEntity(_0x403b5e,null))[_0x218a('0x4a')](handleError(_0x403b5e,null));};exports[_0x218a('0x53')]=function(_0x1e4d34,_0x3aab1f){return db['CmList']['describe']()[_0x218a('0x27')](respondWithResult(_0x3aab1f,null))[_0x218a('0x4a')](handleError(_0x3aab1f,null));};exports[_0x218a('0x54')]=function(_0x39ef10,_0x5039df,_0x5442bb){if(_0x39ef10[_0x218a('0x4c')]['id']){delete _0x39ef10['body']['id'];}return db[_0x218a('0x41')]['find']({'where':{'id':_0x39ef10[_0x218a('0x45')]['id']}})[_0x218a('0x27')](handleEntityNotFound(_0x5039df,null))[_0x218a('0x27')](function(_0x1b5a12){if(_0x1b5a12){_0x39ef10[_0x218a('0x4c')][_0x218a('0x55')]=_0x1b5a12['id'];return db['Disposition'][_0x218a('0x4b')](_0x39ef10[_0x218a('0x4c')]);}})[_0x218a('0x27')](respondWithResult(_0x5039df,null))['catch'](handleError(_0x5039df,null));};exports[_0x218a('0x56')]=function(_0x4123a9,_0x55b6cb,_0x4b8bf1){var _0xe8a868={'raw':![],'where':{}};var _0x122337={};var _0x47beaf={'count':0x0,'rows':[]};return db[_0x218a('0x41')][_0x218a('0x57')]({'where':{'id':_0x4123a9[_0x218a('0x45')]['id']}})[_0x218a('0x27')](handleEntityNotFound(_0x55b6cb,null))[_0x218a('0x27')](function(_0x245dbd){if(_0x245dbd){_0x122337[_0x218a('0x31')]=_['keys'](db['Disposition'][_0x218a('0x47')]);_0x122337[_0x218a('0x33')]=_[_0x218a('0x46')](_0x4123a9[_0x218a('0x33')]);_0x122337[_0x218a('0x48')]=_['intersection'](_0x122337[_0x218a('0x31')],_0x122337['query']);_0xe8a868[_0x218a('0x36')]=_['intersection'](_0x122337[_0x218a('0x31')],qs[_0x218a('0x35')](_0x4123a9[_0x218a('0x33')][_0x218a('0x35')]));_0xe8a868['attributes']=_0xe8a868[_0x218a('0x36')]['length']?_0xe8a868['attributes']:_0x122337[_0x218a('0x31')];if(!_0x4123a9[_0x218a('0x33')][_0x218a('0x58')](_0x218a('0x59'))){_0xe8a868['limit']=qs[_0x218a('0x22')](_0x4123a9[_0x218a('0x33')][_0x218a('0x22')]);_0xe8a868[_0x218a('0x38')]=qs['offset'](_0x4123a9[_0x218a('0x33')][_0x218a('0x38')]);}_0xe8a868['order']=qs['sort'](_0x4123a9[_0x218a('0x33')]['sort']);_0xe8a868[_0x218a('0x3d')]=qs[_0x218a('0x48')](_['pick'](_0x4123a9['query'],_0x122337[_0x218a('0x48')]));_0xe8a868[_0x218a('0x3d')]['ListId']=_0x245dbd['id'];if(_0x4123a9[_0x218a('0x33')][_0x218a('0x3c')]){_0xe8a868[_0x218a('0x3d')]=_[_0x218a('0x3e')](_0xe8a868[_0x218a('0x3d')],{'$or':_['map'](_0xe8a868['attributes'],function(_0x288876){var _0x33cbff={};_0x33cbff[_0x288876]={'$like':'%'+_0x4123a9[_0x218a('0x33')][_0x218a('0x3c')]+'%'};return _0x33cbff;})});}_0xe8a868=_[_0x218a('0x3e')]({},_0xe8a868,_0x4123a9[_0x218a('0x40')]);return db['Disposition'][_0x218a('0x21')]({'where':_0xe8a868['where']})[_0x218a('0x27')](function(_0x306492){_0x47beaf['count']=_0x306492;if(_0x4123a9['query'][_0x218a('0x42')]){_0xe8a868['include']=[{'all':!![]}];}return db[_0x218a('0x5a')]['findAll'](_0xe8a868);})[_0x218a('0x27')](function(_0x5d3b75){_0x47beaf['rows']=_0x5d3b75;return _0x47beaf;});}})[_0x218a('0x27')](respondWithFilteredResult(_0x55b6cb,_0xe8a868))[_0x218a('0x4a')](handleError(_0x55b6cb,null));};exports['removeDispositions']=function(_0x555b6e,_0xd93a04,_0x7023dc){return db[_0x218a('0x41')][_0x218a('0x49')]({'where':{'id':_0x555b6e[_0x218a('0x45')]['id']}})[_0x218a('0x27')](handleEntityNotFound(_0xd93a04,null))[_0x218a('0x27')](function(_0x16fc48){if(_0x16fc48){return _0x16fc48[_0x218a('0x5b')](_0x555b6e[_0x218a('0x33')][_0x218a('0x5c')]);}})['then'](respondWithStatusCode(_0xd93a04,null))[_0x218a('0x4a')](handleError(_0xd93a04,null));};exports[_0x218a('0x5d')]=function(_0x330fd7,_0x478dea,_0x4cfabc){return db[_0x218a('0x41')][_0x218a('0x49')]({'where':{'id':_0x330fd7['params']['id']}})[_0x218a('0x27')](handleEntityNotFound(_0x478dea,null))[_0x218a('0x27')](function(_0x497f08){if(_0x497f08){var _0x2ca87f=[];var _0x1006c0={'success':[],'errors':[]};return db['CmContact'][_0x218a('0x53')]()['then'](function(_0x524c19){if(_0x330fd7['body'][_0x218a('0x5e')]&&_['isArray'](_0x330fd7[_0x218a('0x4c')][_0x218a('0x5e')])){if(_0x330fd7[_0x218a('0x4c')][_0x218a('0x5e')][_0x218a('0x37')]){_0x330fd7[_0x218a('0x4c')]['tags']=_0x330fd7['body'][_0x218a('0x5e')][_0x218a('0x5f')](';')+';';}else{_0x330fd7[_0x218a('0x4c')][_0x218a('0x5e')]=null;}}else{_0x330fd7[_0x218a('0x4c')]['tags']=null;}if(_0x330fd7['body']&&_[_0x218a('0x60')](_0x330fd7['body'])){for(var _0x3e60d5=0x0;_0x3e60d5<_0x330fd7[_0x218a('0x4c')][_0x218a('0x37')];_0x3e60d5+=0x1){_0x330fd7[_0x218a('0x4c')][_0x3e60d5][_0x218a('0x55')]=_0x330fd7[_0x218a('0x45')]['id'];_0x2ca87f[_0x218a('0x61')](_0x330fd7[_0x218a('0x4c')][_0x3e60d5]);}return BPromise[_0x218a('0x62')](_0x2ca87f,function(_0x3be9bb){return db[_0x218a('0x63')][_0x218a('0x4b')](_['omit'](_0x3be9bb,[_0x218a('0x5c'),'id'])||{},{'fields':_[_0x218a('0x46')](_0x524c19),'raw':!![]})[_0x218a('0x27')](function(_0x45e98d){_0x1006c0[_0x218a('0x64')][_0x218a('0x61')](_0x45e98d['dataValues']);})[_0x218a('0x4a')](function(_0x291309){_0x1006c0[_0x218a('0x65')][_0x218a('0x61')]({'data':_0x3be9bb,'error':_0x291309['message']});});})['then'](function(_0x41b1f6){return _0x1006c0;})[_0x218a('0x4a')](function(_0x2ba360){return _0x2ba360;});}else{_0x478dea[_0x218a('0x1e')](0x190)[_0x218a('0x20')]({'message':_0x218a('0x66')});}});}})[_0x218a('0x27')](respondWithResult(_0x478dea,null))[_0x218a('0x4a')](handleError(_0x478dea,null));};exports[_0x218a('0x67')]=function(_0x4142fa,_0x9742c2,_0x475286){var _0x4efdcf;return db[_0x218a('0x41')][_0x218a('0x49')]({'where':{'id':_0x4142fa[_0x218a('0x45')]['id']},'include':[{'model':db[_0x218a('0x68')],'as':_0x218a('0x69')}]})[_0x218a('0x27')](handleEntityNotFound(_0x9742c2,null))[_0x218a('0x27')](function(_0x5701a5){if(_0x5701a5){_0x4efdcf=_0x5701a5;return db[_0x218a('0x63')][_0x218a('0x47')];}})[_0x218a('0x27')](function(_0x4f2816){if(_0x4f2816){var _0x16012a={};var _0x153868={};_0x153868[_0x218a('0x31')]=_[_0x218a('0x6a')](_[_0x218a('0x46')](_0x4f2816),_[_0x218a('0x32')](_0x4efdcf[_0x218a('0x69')],function(_0x4b1847){return util['format'](_0x218a('0x6b'),_0x4b1847['id']);}));_0x153868[_0x218a('0x33')]=_['keys'](_0x4142fa['query']);_0x153868['filters']=_['intersection'](_0x153868[_0x218a('0x31')],_0x153868[_0x218a('0x33')]);_0x16012a[_0x218a('0x36')]=_['intersection'](_0x153868[_0x218a('0x31')],qs['fields'](_0x4142fa[_0x218a('0x33')]['fields']));_0x16012a[_0x218a('0x36')]=_0x16012a[_0x218a('0x36')]['length']?_0x16012a[_0x218a('0x36')]:_0x153868[_0x218a('0x31')];if(!_0x4142fa[_0x218a('0x33')][_0x218a('0x58')]('nolimit')){_0x16012a['limit']=qs[_0x218a('0x22')](_0x4142fa[_0x218a('0x33')][_0x218a('0x22')]);_0x16012a[_0x218a('0x38')]=qs[_0x218a('0x38')](_0x4142fa[_0x218a('0x33')]['offset']);}_0x16012a[_0x218a('0x39')]=qs[_0x218a('0x3a')](_0x4142fa[_0x218a('0x33')][_0x218a('0x3a')]);_0x16012a[_0x218a('0x3d')]=qs['filters'](_[_0x218a('0x3b')](_0x4142fa[_0x218a('0x33')],_0x153868[_0x218a('0x48')]));_0x16012a[_0x218a('0x6c')]=!![];if(_0x4142fa[_0x218a('0x33')][_0x218a('0x3c')]){_0x16012a[_0x218a('0x3d')]=_[_0x218a('0x3e')](_0x16012a[_0x218a('0x3d')],{'$or':_[_0x218a('0x32')](_0x16012a[_0x218a('0x36')],function(_0x528908){var _0x566b65={};_0x566b65[_0x528908]={'$like':'%'+_0x4142fa[_0x218a('0x33')]['filter']+'%'};return _0x566b65;})});}_0x16012a=_[_0x218a('0x3e')]({},_0x16012a,_0x4142fa['options']);return _0x4efdcf[_0x218a('0x67')](_0x16012a);}})['then'](respondWithResult(_0x9742c2,null))[_0x218a('0x4a')](handleError(_0x9742c2,null));};exports[_0x218a('0x6d')]=function(_0x347eed,_0xa652ee,_0x218726){var _0x1fdd00;return db[_0x218a('0x41')][_0x218a('0x49')]({'where':{'id':_0x347eed[_0x218a('0x45')]['id']},'include':[{'model':db[_0x218a('0x68')],'as':_0x218a('0x69')}]})[_0x218a('0x27')](handleEntityNotFound(_0xa652ee,null))[_0x218a('0x27')](function(_0x34c07f){if(_0x34c07f){_0x1fdd00=_0x34c07f;return db['CmContact'][_0x218a('0x47')];}})[_0x218a('0x27')](function(_0x3f8501){if(_0x3f8501){var _0x54e572={};var _0x5a757f={};_0x5a757f['model']=_[_0x218a('0x6a')](_[_0x218a('0x46')](_0x3f8501),_[_0x218a('0x32')](_0x1fdd00['CustomFields'],function(_0x5b56a1){return util[_0x218a('0x6e')](_0x218a('0x6b'),_0x5b56a1['id']);}));_0x5a757f['query']=_[_0x218a('0x46')](_0x347eed[_0x218a('0x33')]);_0x5a757f['filters']=_[_0x218a('0x34')](_0x5a757f[_0x218a('0x31')],_0x5a757f[_0x218a('0x33')]);_0x54e572['attributes']=_[_0x218a('0x34')](_0x5a757f[_0x218a('0x31')],qs[_0x218a('0x35')](_0x347eed['query']['fields']));_0x54e572['attributes']=_0x54e572['attributes'][_0x218a('0x37')]?_0x54e572[_0x218a('0x36')]:_0x5a757f[_0x218a('0x31')];if(!_0x347eed[_0x218a('0x33')][_0x218a('0x58')]('nolimit')){_0x54e572['limit']=qs[_0x218a('0x22')](_0x347eed[_0x218a('0x33')][_0x218a('0x22')]);_0x54e572[_0x218a('0x38')]=qs[_0x218a('0x38')](_0x347eed[_0x218a('0x33')]['offset']);}_0x54e572[_0x218a('0x39')]=qs[_0x218a('0x3a')](_0x347eed[_0x218a('0x33')]['sort']);_0x54e572[_0x218a('0x3d')]=qs[_0x218a('0x48')](_[_0x218a('0x3b')](_0x347eed[_0x218a('0x33')],_0x5a757f[_0x218a('0x48')]));_0x54e572[_0x218a('0x6c')]=!![];if(_0x347eed['query'][_0x218a('0x3c')]){_0x54e572[_0x218a('0x3d')]=_[_0x218a('0x3e')](_0x54e572[_0x218a('0x3d')],{'$or':_[_0x218a('0x32')](_0x54e572[_0x218a('0x36')],function(_0x61f8c9){var _0x1eae5b={};_0x1eae5b[_0x61f8c9]={'$like':'%'+_0x347eed[_0x218a('0x33')]['filter']+'%'};return _0x1eae5b;})});}_0x54e572=_['merge']({},_0x54e572,_0x347eed['options']);return _0x1fdd00[_0x218a('0x67')](_0x54e572);}})['then'](function(_0x245cff){if(!_[_0x218a('0x6f')](_0x245cff)){var _0x53ddbe=toCsv(_0x245cff);var _0x5ab6ba=Date[_0x218a('0x70')]();fs[_0x218a('0x71')](util[_0x218a('0x6e')](_0x218a('0x72'),_0x1fdd00['id'],_0x5ab6ba),_0x53ddbe);_0xa652ee['setHeader'](_0x218a('0x73'),'attachment;\x20filename='+util[_0x218a('0x6e')](_0x218a('0x74'),_0x1fdd00['id'],_0x5ab6ba));_0xa652ee['setHeader'](_0x218a('0x75'),'text/csv');return _0xa652ee[_0x218a('0x76')](util[_0x218a('0x6e')](_0x218a('0x72'),_0x1fdd00['id'],_0x5ab6ba));}else{return _0xa652ee[_0x218a('0x1d')](0xcc);}})[_0x218a('0x4a')](handleError(_0xa652ee,null));};exports['addCustomField']=function(_0x46d3ad,_0xc703ce,_0x24139f){var _0xad7867;delete _0x46d3ad[_0x218a('0x4c')]['id'];return db[_0x218a('0x41')][_0x218a('0x57')]({'where':{'id':_0x46d3ad[_0x218a('0x45')]['id']}})[_0x218a('0x27')](handleEntityNotFound(_0xc703ce,null))['then'](function(_0x4fbd15){if(_0x4fbd15){return db[_0x218a('0x77')][_0x218a('0x78')](function(_0x32dcb2){return db[_0x218a('0x68')][_0x218a('0x4b')](_0x46d3ad[_0x218a('0x4c')],{'transaction':_0x32dcb2})[_0x218a('0x27')](function(_0x462638){_0xad7867=_0x462638;return _0x4fbd15['addCustomFields'](_0x462638,{'transaction':_0x32dcb2});})[_0x218a('0x27')](function(){var _0x1c8063={'type':db[_0x218a('0x79')][_0x218a('0x7a')],'transaction':_0x32dcb2};switch(_0x46d3ad[_0x218a('0x4c')][_0x218a('0x3f')]){case _0x218a('0x7b'):_0x1c8063[_0x218a('0x3f')]=db[_0x218a('0x79')][_0x218a('0x7a')];break;case'number':_0x1c8063['type']=db['Sequelize'][_0x218a('0x7c')];break;case _0x218a('0x7d'):_0x1c8063['type']=db[_0x218a('0x79')]['BOOLEAN'];_0x1c8063[_0x218a('0x7e')]=![];break;default:}return db[_0x218a('0x77')]['queryInterface']['addColumn'](_0x218a('0x7f'),util[_0x218a('0x6e')](_0x218a('0x80'),_0xad7867['id']),_0x1c8063);})[_0x218a('0x27')](function(){return _0xad7867;});});}})[_0x218a('0x27')](respondWithResult(_0xc703ce,null))['catch'](handleError(_0xc703ce,null));};exports[_0x218a('0x81')]=function(_0x1b1cf4,_0x5562e6,_0x22d931){var _0x17a0a7={};var _0x41a647={};var _0x452efa;var _0x4f7b92;return db['CmList'][_0x218a('0x57')]({'where':{'id':_0x1b1cf4[_0x218a('0x45')]['id']}})[_0x218a('0x27')](handleEntityNotFound(_0x5562e6,null))[_0x218a('0x27')](function(_0x1911fb){if(_0x1911fb){_0x452efa=_0x1911fb;_0x41a647[_0x218a('0x31')]=_['keys'](db['CmCustomField'][_0x218a('0x47')]);_0x41a647[_0x218a('0x33')]=_[_0x218a('0x46')](_0x1b1cf4[_0x218a('0x33')]);_0x41a647[_0x218a('0x48')]=_[_0x218a('0x34')](_0x41a647[_0x218a('0x31')],_0x41a647[_0x218a('0x33')]);_0x17a0a7['attributes']=_[_0x218a('0x34')](_0x41a647['model'],qs['fields'](_0x1b1cf4[_0x218a('0x33')][_0x218a('0x35')]));_0x17a0a7[_0x218a('0x36')]=_0x17a0a7['attributes']['length']?_0x17a0a7[_0x218a('0x36')]:_0x41a647[_0x218a('0x31')];_0x17a0a7[_0x218a('0x39')]=qs[_0x218a('0x3a')](_0x1b1cf4[_0x218a('0x33')]['sort']);_0x17a0a7[_0x218a('0x3d')]=qs['filters'](_[_0x218a('0x3b')](_0x1b1cf4['query'],_0x41a647[_0x218a('0x48')]));_0x17a0a7['where']=_['merge'](_0x17a0a7['where'],{'$or':[{'ListId':_0x1911fb['id']},{'ListId':null}]});if(_0x1b1cf4[_0x218a('0x33')][_0x218a('0x3c')]){_0x17a0a7[_0x218a('0x3d')]=_['merge'](_0x17a0a7['where'],{'$or':_[_0x218a('0x32')](_0x17a0a7['attributes'],function(_0x2eb172){var _0x1ce544={};_0x1ce544[_0x2eb172]={'$like':'%'+_0x1b1cf4['query'][_0x218a('0x3c')]+'%'};return _0x1ce544;})});}_0x17a0a7=_[_0x218a('0x3e')]({},_0x17a0a7,_0x1b1cf4['options']);return db[_0x218a('0x68')][_0x218a('0x82')](_0x17a0a7);}})[_0x218a('0x27')](respondWithResult(_0x5562e6,null))[_0x218a('0x4a')](handleError(_0x5562e6,null));};exports['addAgents']=function(_0x30eed3,_0x55d943,_0x842445){return db['CmList'][_0x218a('0x49')]({'where':{'id':_0x30eed3[_0x218a('0x45')]['id']}})[_0x218a('0x27')](handleEntityNotFound(_0x55d943,null))[_0x218a('0x27')](function(_0x5cb154){if(_0x5cb154){return _0x5cb154['addAgents'](_0x30eed3['body'][_0x218a('0x5c')],_[_0x218a('0x83')](_0x30eed3['body'],[_0x218a('0x5c'),'id'])||{})[_0x218a('0x84')](function(_0x1d65e3){for(var _0x4a6f98=0x0;_0x4a6f98<_0x30eed3[_0x218a('0x4c')][_0x218a('0x5c')]['length'];_0x4a6f98+=0x1){socket[_0x218a('0x85')]('userCmList:save',{'UserId':_0x30eed3[_0x218a('0x4c')][_0x218a('0x5c')][_0x4a6f98],'CmListId':_0x30eed3[_0x218a('0x45')]['id']});}return _0x1d65e3;});}})[_0x218a('0x27')](respondWithResult(_0x55d943,null))[_0x218a('0x4a')](handleError(_0x55d943,null));};exports[_0x218a('0x86')]=function(_0x4b419d,_0x2754f7,_0x59a412){return db[_0x218a('0x41')][_0x218a('0x49')]({'where':{'id':_0x4b419d[_0x218a('0x45')]['id']}})[_0x218a('0x27')](handleEntityNotFound(_0x2754f7,null))[_0x218a('0x27')](function(_0x44ecce){if(_0x44ecce){return _0x44ecce['removeAgents'](_0x4b419d[_0x218a('0x33')][_0x218a('0x5c')])[_0x218a('0x27')](function(){if(_[_0x218a('0x60')](_0x4b419d[_0x218a('0x33')][_0x218a('0x5c')])){for(var _0x2d189=0x0;_0x2d189<_0x4b419d['query'][_0x218a('0x5c')]['length'];_0x2d189+=0x1){socket['emit'](_0x218a('0x87'),{'UserId':Number(_0x4b419d['query'][_0x218a('0x5c')][_0x2d189]),'CmListId':Number(_0x4b419d[_0x218a('0x45')]['id'])});}}else{socket[_0x218a('0x85')](_0x218a('0x87'),{'UserId':Number(_0x4b419d[_0x218a('0x33')][_0x218a('0x5c')]),'CmListId':Number(_0x4b419d[_0x218a('0x45')]['id'])});}});}})[_0x218a('0x27')](respondWithStatusCode(_0x2754f7,null))[_0x218a('0x4a')](handleError(_0x2754f7,null));};exports[_0x218a('0x88')]=function(_0x3ecc77,_0x4ad610,_0xa726d4){var _0x24b997={};var _0x3ec1b3={};var _0x27420c;var _0x14c265;return db['CmList']['findOne']({'where':{'id':_0x3ecc77[_0x218a('0x45')]['id']}})[_0x218a('0x27')](handleEntityNotFound(_0x4ad610,null))[_0x218a('0x27')](function(_0x4e0c1b){if(_0x4e0c1b){_0x27420c=_0x4e0c1b;_0x3ec1b3[_0x218a('0x31')]=_[_0x218a('0x46')](db[_0x218a('0x89')][_0x218a('0x47')]);_0x3ec1b3['query']=_[_0x218a('0x46')](_0x3ecc77[_0x218a('0x33')]);_0x3ec1b3[_0x218a('0x48')]=_['intersection'](_0x3ec1b3[_0x218a('0x31')],_0x3ec1b3[_0x218a('0x33')]);_0x24b997[_0x218a('0x36')]=_['intersection'](_0x3ec1b3[_0x218a('0x31')],qs[_0x218a('0x35')](_0x3ecc77['query'][_0x218a('0x35')]));_0x24b997[_0x218a('0x36')]=_0x24b997['attributes'][_0x218a('0x37')]?_0x24b997[_0x218a('0x36')]:_0x3ec1b3[_0x218a('0x31')];_0x24b997[_0x218a('0x39')]=qs[_0x218a('0x3a')](_0x3ecc77[_0x218a('0x33')][_0x218a('0x3a')]);_0x24b997[_0x218a('0x3d')]=qs[_0x218a('0x48')](_['pick'](_0x3ecc77['query'],_0x3ec1b3['filters']));if(_0x3ecc77[_0x218a('0x33')]['filter']){_0x24b997[_0x218a('0x3d')]=_[_0x218a('0x3e')](_0x24b997[_0x218a('0x3d')],{'$or':_[_0x218a('0x32')](_0x24b997[_0x218a('0x36')],function(_0x41e789){var _0x4f6177={};_0x4f6177[_0x41e789]={'$like':'%'+_0x3ecc77[_0x218a('0x33')][_0x218a('0x3c')]+'%'};return _0x4f6177;})});}_0x24b997=_[_0x218a('0x3e')]({},_0x24b997,_0x3ecc77[_0x218a('0x40')]);return _0x27420c[_0x218a('0x88')](_0x24b997);}})[_0x218a('0x27')](function(_0x416f2e){if(_0x416f2e){_0x14c265=_0x416f2e[_0x218a('0x37')];if(!_0x3ecc77[_0x218a('0x33')][_0x218a('0x58')]('nolimit')){_0x24b997[_0x218a('0x22')]=qs[_0x218a('0x22')](_0x3ecc77[_0x218a('0x33')][_0x218a('0x22')]);_0x24b997[_0x218a('0x38')]=qs[_0x218a('0x38')](_0x3ecc77[_0x218a('0x33')][_0x218a('0x38')]);}return _0x27420c['getAgents'](_0x24b997);}})[_0x218a('0x27')](function(_0x2e526f){if(_0x2e526f){return _0x2e526f?{'count':_0x14c265,'rows':_0x2e526f}:null;}})[_0x218a('0x27')](respondWithResult(_0x4ad610,null))[_0x218a('0x4a')](handleError(_0x4ad610,null));}; \ No newline at end of file +var _0x3f20=['./cmList.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','Lists','UserProfileResource','name','send','index','map','CmList','fieldName','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','user','role','get','userProfileId','autoAssociation','error','find','describe','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x4e073b,_0x3bba61){var _0x33dfe1=function(_0x5c9628){while(--_0x5c9628){_0x4e073b['push'](_0x4e073b['shift']());}};_0x33dfe1(++_0x3bba61);}(_0x3f20,0x102));var _0x03f2=function(_0x1bea85,_0x491bc3){_0x1bea85=_0x1bea85-0x0;var _0xe0a6c4=_0x3f20[_0x1bea85];return _0xe0a6c4;};'use strict';var pdf=require(_0x03f2('0x0'));var emlformat=require(_0x03f2('0x1'));var rimraf=require(_0x03f2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03f2('0x3'));var rp=require(_0x03f2('0x4'));var moment=require(_0x03f2('0x5'));var BPromise=require(_0x03f2('0x6'));var Mustache=require(_0x03f2('0x7'));var util=require(_0x03f2('0x8'));var path=require('path');var sox=require(_0x03f2('0x9'));var csv=require(_0x03f2('0xa'));var ejs=require(_0x03f2('0xb'));var fs=require('fs');var _=require(_0x03f2('0xc'));var squel=require(_0x03f2('0xd'));var crypto=require('crypto');var jsforce=require(_0x03f2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x03f2('0xa'));var querystring=require(_0x03f2('0xf'));var Papa=require(_0x03f2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x03f2('0x11'));var as=require(_0x03f2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03f2('0x13'))(_0x03f2('0x14'));var utils=require('../../config/utils');var config=require(_0x03f2('0x15'));var licenseUtil=require(_0x03f2('0x16'));var db=require(_0x03f2('0x17'))['db'];config[_0x03f2('0x18')]=_[_0x03f2('0x19')](config[_0x03f2('0x18')],{'host':_0x03f2('0x1a'),'port':0x18eb});var socket=require(_0x03f2('0x1b'))(new Redis(config[_0x03f2('0x18')]));require(_0x03f2('0x1c'))[_0x03f2('0x1d')](socket);function respondWithStatusCode(_0x3e35a0,_0x54588c){_0x54588c=_0x54588c||0xcc;return function(_0x33d7e3){if(_0x33d7e3){return _0x3e35a0[_0x03f2('0x1e')](_0x54588c);}return _0x3e35a0['status'](_0x54588c)[_0x03f2('0x1f')]();};}function respondWithResult(_0x42fbf5,_0xdd5789){_0xdd5789=_0xdd5789||0xc8;return function(_0x3a3206){if(_0x3a3206){return _0x42fbf5[_0x03f2('0x20')](_0xdd5789)[_0x03f2('0x21')](_0x3a3206);}};}function respondWithFilteredResult(_0x5ca41a,_0x4f5843){return function(_0x2a0e25){if(_0x2a0e25){var _0x521435=_0x2a0e25[_0x03f2('0x22')],_0x26bf5c=_0x4f5843[_0x03f2('0x23')],_0x21abec=_0x4f5843[_0x03f2('0x23')]+_0x4f5843['limit'],_0x246f98;if(_0x21abec>=_0x521435){_0x21abec=_0x521435;_0x246f98=0xc8;}else{_0x246f98=0xce;}_0x5ca41a[_0x03f2('0x20')](_0x246f98);return _0x5ca41a[_0x03f2('0x24')](_0x03f2('0x25'),_0x26bf5c+'-'+_0x21abec+'/'+_0x521435)[_0x03f2('0x21')](_0x2a0e25);}return null;};}function patchUpdates(_0x46a28d){return function(_0x22f4ae){try{jsonpatch['apply'](_0x22f4ae,_0x46a28d,!![]);}catch(_0x5ace09){return BPromise[_0x03f2('0x26')](_0x5ace09);}return _0x22f4ae[_0x03f2('0x27')]();};}function saveUpdates(_0x56b777,_0x5bf0dc){return function(_0x401a4d){if(_0x401a4d){return _0x401a4d[_0x03f2('0x28')](_0x56b777)[_0x03f2('0x29')](function(_0x3fe27b){return _0x3fe27b;});}return null;};}function removeEntity(_0x4cadc7,_0x249dc5){return function(_0x4f5d15){if(_0x4f5d15){return _0x4f5d15[_0x03f2('0x2a')]()[_0x03f2('0x29')](function(){var _0x44ec31=_0x4f5d15['get']({'plain':!![]});var _0x5f599a=_0x03f2('0x2b');return db[_0x03f2('0x2c')][_0x03f2('0x2a')]({'where':{'type':_0x5f599a,'resourceId':_0x44ec31['id']}})[_0x03f2('0x29')](function(){return _0x4f5d15;});})['then'](function(){_0x4cadc7[_0x03f2('0x20')](0xcc)[_0x03f2('0x1f')]();});}};}function handleEntityNotFound(_0x4006e2,_0x597318){return function(_0x34ed53){if(!_0x34ed53){_0x4006e2[_0x03f2('0x1e')](0x194);}return _0x34ed53;};}function handleError(_0x2683ac,_0xcbdca3){_0xcbdca3=_0xcbdca3||0x1f4;return function(_0x53e9ee){logger['error'](_0x53e9ee['stack']);if(_0x53e9ee['name']){delete _0x53e9ee[_0x03f2('0x2d')];}_0x2683ac[_0x03f2('0x20')](_0xcbdca3)[_0x03f2('0x2e')](_0x53e9ee);};}exports[_0x03f2('0x2f')]=function(_0xe4ce58,_0x13627e){var _0x56f452={},_0x33c951={},_0x4a0306={'count':0x0,'rows':[]};var _0x1a689b=_[_0x03f2('0x30')](db[_0x03f2('0x31')]['rawAttributes'],function(_0x427c13){return{'name':_0x427c13[_0x03f2('0x32')],'type':_0x427c13['type'][_0x03f2('0x33')]};});_0x33c951['model']=_[_0x03f2('0x30')](_0x1a689b,_0x03f2('0x2d'));_0x33c951['query']=_[_0x03f2('0x34')](_0xe4ce58[_0x03f2('0x35')]);_0x33c951['filters']=_[_0x03f2('0x36')](_0x33c951[_0x03f2('0x37')],_0x33c951[_0x03f2('0x35')]);_0x56f452['attributes']=_[_0x03f2('0x36')](_0x33c951[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x38')]));_0x56f452['attributes']=_0x56f452[_0x03f2('0x39')][_0x03f2('0x3a')]?_0x56f452[_0x03f2('0x39')]:_0x33c951[_0x03f2('0x37')];if(!_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x3b')](_0x03f2('0x3c'))){_0x56f452[_0x03f2('0x3d')]=qs[_0x03f2('0x3d')](_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x3d')]);_0x56f452['offset']=qs[_0x03f2('0x23')](_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x23')]);}_0x56f452[_0x03f2('0x3e')]=qs[_0x03f2('0x3f')](_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x3f')]);_0x56f452[_0x03f2('0x40')]=qs[_0x03f2('0x41')](_[_0x03f2('0x42')](_0xe4ce58[_0x03f2('0x35')],_0x33c951['filters']),_0x1a689b);if(_0xe4ce58['query'][_0x03f2('0x43')]){_0x56f452[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x56f452[_0x03f2('0x40')],{'$or':_[_0x03f2('0x30')](_0x1a689b,function(_0x31cc8a){if(_0x31cc8a[_0x03f2('0x45')]!=='VIRTUAL'){var _0x4145e9={};_0x4145e9[_0x31cc8a[_0x03f2('0x2d')]]={'$like':'%'+_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x43')]+'%'};return _0x4145e9;}})});}_0x56f452=_[_0x03f2('0x44')]({},_0x56f452,_0xe4ce58[_0x03f2('0x46')]);var _0x34e4ad={'where':_0x56f452[_0x03f2('0x40')]};return db[_0x03f2('0x31')][_0x03f2('0x22')](_0x34e4ad)[_0x03f2('0x29')](function(_0x24c8df){_0x4a0306[_0x03f2('0x22')]=_0x24c8df;if(_0xe4ce58[_0x03f2('0x35')]['includeAll']){_0x56f452[_0x03f2('0x47')]=[{'all':!![]}];}return db[_0x03f2('0x31')][_0x03f2('0x48')](_0x56f452);})['then'](function(_0x2573f1){_0x4a0306[_0x03f2('0x49')]=_0x2573f1;return _0x4a0306;})['then'](respondWithFilteredResult(_0x13627e,_0x56f452))[_0x03f2('0x4a')](handleError(_0x13627e,null));};exports[_0x03f2('0x4b')]=function(_0x519683,_0x4d91f5){var _0x33b698={'raw':![],'where':{'id':_0x519683[_0x03f2('0x4c')]['id']}},_0xc82696={};_0xc82696['model']=_[_0x03f2('0x34')](db[_0x03f2('0x31')][_0x03f2('0x4d')]);_0xc82696[_0x03f2('0x35')]=_[_0x03f2('0x34')](_0x519683[_0x03f2('0x35')]);_0xc82696[_0x03f2('0x41')]=_[_0x03f2('0x36')](_0xc82696['model'],_0xc82696[_0x03f2('0x35')]);_0x33b698[_0x03f2('0x39')]=_['intersection'](_0xc82696[_0x03f2('0x37')],qs['fields'](_0x519683[_0x03f2('0x35')][_0x03f2('0x38')]));_0x33b698[_0x03f2('0x39')]=_0x33b698[_0x03f2('0x39')][_0x03f2('0x3a')]?_0x33b698['attributes']:_0xc82696[_0x03f2('0x37')];if(_0x519683[_0x03f2('0x35')][_0x03f2('0x4e')]){_0x33b698[_0x03f2('0x47')]=[{'all':!![]}];}_0x33b698=_['merge']({},_0x33b698,_0x519683['options']);return db['CmList']['find'](_0x33b698)['then'](handleEntityNotFound(_0x4d91f5,null))[_0x03f2('0x29')](respondWithResult(_0x4d91f5,null))[_0x03f2('0x4a')](handleError(_0x4d91f5,null));};exports['create']=function(_0x396a5c,_0x24c54f){return db[_0x03f2('0x31')][_0x03f2('0x4f')](_0x396a5c[_0x03f2('0x50')],{})[_0x03f2('0x29')](function(_0x5ef86a){var _0xab64eb=_0x396a5c[_0x03f2('0x51')]['get']({'plain':!![]});if(!_0xab64eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xab64eb[_0x03f2('0x52')]==='user'){var _0x59f621=_0x5ef86a[_0x03f2('0x53')]({'plain':!![]});var _0x1bfb22='Lists';return db['UserProfileSection']['find']({'where':{'name':_0x1bfb22,'userProfileId':_0xab64eb[_0x03f2('0x54')]},'raw':!![]})[_0x03f2('0x29')](function(_0x34cc6f){if(_0x34cc6f&&_0x34cc6f[_0x03f2('0x55')]===0x0){return db[_0x03f2('0x2c')][_0x03f2('0x4f')]({'name':_0x59f621['name'],'resourceId':_0x59f621['id'],'type':_0x34cc6f[_0x03f2('0x2d')],'sectionId':_0x34cc6f['id']},{})[_0x03f2('0x29')](function(){return _0x5ef86a;});}else{return _0x5ef86a;}})[_0x03f2('0x4a')](function(_0x2b96f4){logger[_0x03f2('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b96f4);throw _0x2b96f4;});}return _0x5ef86a;})['then'](respondWithResult(_0x24c54f,0xc9))[_0x03f2('0x4a')](handleError(_0x24c54f,null));};exports[_0x03f2('0x28')]=function(_0x282b89,_0x25b12e){if(_0x282b89[_0x03f2('0x50')]['id']){delete _0x282b89[_0x03f2('0x50')]['id'];}return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x282b89[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x25b12e,null))[_0x03f2('0x29')](saveUpdates(_0x282b89[_0x03f2('0x50')],null))[_0x03f2('0x29')](respondWithResult(_0x25b12e,null))['catch'](handleError(_0x25b12e,null));};exports[_0x03f2('0x2a')]=function(_0x41b3e4,_0x2f339d){return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x41b3e4[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x2f339d,null))[_0x03f2('0x29')](removeEntity(_0x2f339d,null))[_0x03f2('0x4a')](handleError(_0x2f339d,null));};exports['describe']=function(_0x42f1eb,_0x1d77b5){return db[_0x03f2('0x31')][_0x03f2('0x58')]()['then'](respondWithResult(_0x1d77b5,null))[_0x03f2('0x4a')](handleError(_0x1d77b5,null));};exports['addDisposition']=function(_0x1cbaaa,_0x3d5a28,_0x387b1d){if(_0x1cbaaa[_0x03f2('0x50')]['id']){delete _0x1cbaaa[_0x03f2('0x50')]['id'];}return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x1cbaaa[_0x03f2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d5a28,null))[_0x03f2('0x29')](function(_0x123a04){if(_0x123a04){_0x1cbaaa['body'][_0x03f2('0x59')]=_0x123a04['id'];return db['Disposition'][_0x03f2('0x4f')](_0x1cbaaa['body']);}})[_0x03f2('0x29')](respondWithResult(_0x3d5a28,null))[_0x03f2('0x4a')](handleError(_0x3d5a28,null));};exports[_0x03f2('0x5a')]=function(_0x398a5a,_0x34c774,_0x2e19fe){var _0x166389={'raw':![],'where':{}};var _0x4f8d0b={};var _0x51bc7c={'count':0x0,'rows':[]};return db[_0x03f2('0x31')][_0x03f2('0x5b')]({'where':{'id':_0x398a5a[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x34c774,null))[_0x03f2('0x29')](function(_0x18b824){if(_0x18b824){_0x4f8d0b[_0x03f2('0x37')]=_[_0x03f2('0x34')](db['Disposition'][_0x03f2('0x4d')]);_0x4f8d0b[_0x03f2('0x35')]=_['keys'](_0x398a5a[_0x03f2('0x35')]);_0x4f8d0b[_0x03f2('0x41')]=_['intersection'](_0x4f8d0b[_0x03f2('0x37')],_0x4f8d0b['query']);_0x166389[_0x03f2('0x39')]=_[_0x03f2('0x36')](_0x4f8d0b[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0x398a5a['query']['fields']));_0x166389[_0x03f2('0x39')]=_0x166389[_0x03f2('0x39')]['length']?_0x166389[_0x03f2('0x39')]:_0x4f8d0b[_0x03f2('0x37')];if(!_0x398a5a[_0x03f2('0x35')][_0x03f2('0x3b')]('nolimit')){_0x166389['limit']=qs['limit'](_0x398a5a[_0x03f2('0x35')]['limit']);_0x166389['offset']=qs['offset'](_0x398a5a['query'][_0x03f2('0x23')]);}_0x166389['order']=qs[_0x03f2('0x3f')](_0x398a5a[_0x03f2('0x35')][_0x03f2('0x3f')]);_0x166389[_0x03f2('0x40')]=qs[_0x03f2('0x41')](_[_0x03f2('0x42')](_0x398a5a[_0x03f2('0x35')],_0x4f8d0b[_0x03f2('0x41')]));_0x166389[_0x03f2('0x40')]['ListId']=_0x18b824['id'];if(_0x398a5a[_0x03f2('0x35')][_0x03f2('0x43')]){_0x166389['where']=_['merge'](_0x166389['where'],{'$or':_[_0x03f2('0x30')](_0x166389[_0x03f2('0x39')],function(_0x132071){var _0x2576d8={};_0x2576d8[_0x132071]={'$like':'%'+_0x398a5a[_0x03f2('0x35')][_0x03f2('0x43')]+'%'};return _0x2576d8;})});}_0x166389=_[_0x03f2('0x44')]({},_0x166389,_0x398a5a['options']);return db[_0x03f2('0x5c')][_0x03f2('0x22')]({'where':_0x166389[_0x03f2('0x40')]})[_0x03f2('0x29')](function(_0x341c0e){_0x51bc7c[_0x03f2('0x22')]=_0x341c0e;if(_0x398a5a[_0x03f2('0x35')]['includeAll']){_0x166389['include']=[{'all':!![]}];}return db[_0x03f2('0x5c')][_0x03f2('0x48')](_0x166389);})['then'](function(_0x439238){_0x51bc7c[_0x03f2('0x49')]=_0x439238;return _0x51bc7c;});}})[_0x03f2('0x29')](respondWithFilteredResult(_0x34c774,_0x166389))[_0x03f2('0x4a')](handleError(_0x34c774,null));};exports[_0x03f2('0x5d')]=function(_0x35613b,_0x18ea22,_0x525ab3){return db[_0x03f2('0x31')]['find']({'where':{'id':_0x35613b[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x18ea22,null))[_0x03f2('0x29')](function(_0x2b4464){if(_0x2b4464){return _0x2b4464['removeDispositions'](_0x35613b['query'][_0x03f2('0x5e')]);}})[_0x03f2('0x29')](respondWithStatusCode(_0x18ea22,null))[_0x03f2('0x4a')](handleError(_0x18ea22,null));};exports[_0x03f2('0x5f')]=function(_0x1ae4bc,_0x126ef9,_0x5d60c6){return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x1ae4bc['params']['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x126ef9,null))[_0x03f2('0x29')](function(_0x499728){if(_0x499728){var _0x4ecded=[];var _0x27e56c={'success':[],'errors':[]};return db[_0x03f2('0x60')][_0x03f2('0x58')]()[_0x03f2('0x29')](function(_0x1b80e8){if(_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')]&&_['isArray'](_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')])){if(_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')][_0x03f2('0x3a')]){_0x1ae4bc['body'][_0x03f2('0x61')]=_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')]['join'](';')+';';}else{_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')]=null;}}else{_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')]=null;}if(_0x1ae4bc[_0x03f2('0x50')]&&_[_0x03f2('0x62')](_0x1ae4bc[_0x03f2('0x50')])){for(var _0x205eda=0x0;_0x205eda<_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x3a')];_0x205eda+=0x1){_0x1ae4bc[_0x03f2('0x50')][_0x205eda][_0x03f2('0x59')]=_0x1ae4bc[_0x03f2('0x4c')]['id'];_0x4ecded[_0x03f2('0x63')](_0x1ae4bc[_0x03f2('0x50')][_0x205eda]);}return BPromise[_0x03f2('0x64')](_0x4ecded,function(_0x43a232){return db[_0x03f2('0x60')][_0x03f2('0x4f')](_['omit'](_0x43a232,[_0x03f2('0x5e'),'id'])||{},{'fields':_['keys'](_0x1b80e8),'raw':!![]})['then'](function(_0x478dc0){_0x27e56c['success'][_0x03f2('0x63')](_0x478dc0[_0x03f2('0x65')]);})[_0x03f2('0x4a')](function(_0x4a57db){_0x27e56c['errors'][_0x03f2('0x63')]({'data':_0x43a232,'error':_0x4a57db['message']});});})[_0x03f2('0x29')](function(_0x4d403f){return _0x27e56c;})[_0x03f2('0x4a')](function(_0x57f623){return _0x57f623;});}else{_0x126ef9[_0x03f2('0x20')](0x190)['json']({'message':_0x03f2('0x66')});}});}})['then'](respondWithResult(_0x126ef9,null))['catch'](handleError(_0x126ef9,null));};exports[_0x03f2('0x67')]=function(_0x523d45,_0x557316,_0x1f4a6b){var _0x1a23cf;return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x523d45['params']['id']},'include':[{'model':db[_0x03f2('0x68')],'as':_0x03f2('0x69')}]})[_0x03f2('0x29')](handleEntityNotFound(_0x557316,null))[_0x03f2('0x29')](function(_0x520c15){if(_0x520c15){_0x1a23cf=_0x520c15;return db[_0x03f2('0x60')]['rawAttributes'];}})[_0x03f2('0x29')](function(_0x3382be){if(_0x3382be){var _0x3134fb={};var _0x413047={};_0x413047[_0x03f2('0x37')]=_[_0x03f2('0x6a')](_[_0x03f2('0x34')](_0x3382be),_[_0x03f2('0x30')](_0x1a23cf[_0x03f2('0x69')],function(_0x2453dc){return util[_0x03f2('0x6b')](_0x03f2('0x6c'),_0x2453dc['id']);}));_0x413047[_0x03f2('0x35')]=_[_0x03f2('0x34')](_0x523d45[_0x03f2('0x35')]);_0x413047[_0x03f2('0x41')]=_[_0x03f2('0x36')](_0x413047['model'],_0x413047[_0x03f2('0x35')]);_0x3134fb[_0x03f2('0x39')]=_[_0x03f2('0x36')](_0x413047[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0x523d45[_0x03f2('0x35')][_0x03f2('0x38')]));_0x3134fb[_0x03f2('0x39')]=_0x3134fb['attributes'][_0x03f2('0x3a')]?_0x3134fb[_0x03f2('0x39')]:_0x413047[_0x03f2('0x37')];if(!_0x523d45[_0x03f2('0x35')][_0x03f2('0x3b')](_0x03f2('0x3c'))){_0x3134fb[_0x03f2('0x3d')]=qs[_0x03f2('0x3d')](_0x523d45[_0x03f2('0x35')]['limit']);_0x3134fb[_0x03f2('0x23')]=qs[_0x03f2('0x23')](_0x523d45[_0x03f2('0x35')]['offset']);}_0x3134fb[_0x03f2('0x3e')]=qs['sort'](_0x523d45['query'][_0x03f2('0x3f')]);_0x3134fb[_0x03f2('0x40')]=qs['filters'](_[_0x03f2('0x42')](_0x523d45[_0x03f2('0x35')],_0x413047['filters']));_0x3134fb[_0x03f2('0x6d')]=!![];if(_0x523d45[_0x03f2('0x35')]['filter']){_0x3134fb[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x3134fb[_0x03f2('0x40')],{'$or':_['map'](_0x3134fb[_0x03f2('0x39')],function(_0x4f846a){var _0x141877={};_0x141877[_0x4f846a]={'$like':'%'+_0x523d45[_0x03f2('0x35')]['filter']+'%'};return _0x141877;})});}_0x3134fb=_[_0x03f2('0x44')]({},_0x3134fb,_0x523d45[_0x03f2('0x46')]);return _0x1a23cf[_0x03f2('0x67')](_0x3134fb);}})[_0x03f2('0x29')](respondWithResult(_0x557316,null))[_0x03f2('0x4a')](handleError(_0x557316,null));};exports[_0x03f2('0x6e')]=function(_0x79b814,_0xdd0caa,_0x5602b0){var _0x47cec0;return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x79b814[_0x03f2('0x4c')]['id']},'include':[{'model':db[_0x03f2('0x68')],'as':'CustomFields'}]})[_0x03f2('0x29')](handleEntityNotFound(_0xdd0caa,null))[_0x03f2('0x29')](function(_0x31bde7){if(_0x31bde7){_0x47cec0=_0x31bde7;return db['CmContact'][_0x03f2('0x4d')];}})[_0x03f2('0x29')](function(_0xe0cbf){if(_0xe0cbf){var _0x4b0675={};var _0x3d514a={};_0x3d514a['model']=_['concat'](_[_0x03f2('0x34')](_0xe0cbf),_['map'](_0x47cec0[_0x03f2('0x69')],function(_0x58fe36){return util[_0x03f2('0x6b')](_0x03f2('0x6c'),_0x58fe36['id']);}));_0x3d514a['query']=_[_0x03f2('0x34')](_0x79b814[_0x03f2('0x35')]);_0x3d514a[_0x03f2('0x41')]=_['intersection'](_0x3d514a[_0x03f2('0x37')],_0x3d514a[_0x03f2('0x35')]);_0x4b0675[_0x03f2('0x39')]=_[_0x03f2('0x36')](_0x3d514a[_0x03f2('0x37')],qs['fields'](_0x79b814[_0x03f2('0x35')][_0x03f2('0x38')]));_0x4b0675[_0x03f2('0x39')]=_0x4b0675[_0x03f2('0x39')]['length']?_0x4b0675[_0x03f2('0x39')]:_0x3d514a['model'];if(!_0x79b814[_0x03f2('0x35')][_0x03f2('0x3b')]('nolimit')){_0x4b0675[_0x03f2('0x3d')]=qs[_0x03f2('0x3d')](_0x79b814[_0x03f2('0x35')][_0x03f2('0x3d')]);_0x4b0675[_0x03f2('0x23')]=qs['offset'](_0x79b814[_0x03f2('0x35')][_0x03f2('0x23')]);}_0x4b0675[_0x03f2('0x3e')]=qs['sort'](_0x79b814[_0x03f2('0x35')][_0x03f2('0x3f')]);_0x4b0675[_0x03f2('0x40')]=qs[_0x03f2('0x41')](_[_0x03f2('0x42')](_0x79b814['query'],_0x3d514a[_0x03f2('0x41')]));_0x4b0675['raw']=!![];if(_0x79b814[_0x03f2('0x35')][_0x03f2('0x43')]){_0x4b0675[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x4b0675['where'],{'$or':_[_0x03f2('0x30')](_0x4b0675[_0x03f2('0x39')],function(_0xad0eae){var _0x4ea681={};_0x4ea681[_0xad0eae]={'$like':'%'+_0x79b814[_0x03f2('0x35')]['filter']+'%'};return _0x4ea681;})});}_0x4b0675=_[_0x03f2('0x44')]({},_0x4b0675,_0x79b814[_0x03f2('0x46')]);return _0x47cec0[_0x03f2('0x67')](_0x4b0675);}})[_0x03f2('0x29')](function(_0xfa23e9){if(!_[_0x03f2('0x6f')](_0xfa23e9)){var _0x432bba=toCsv(_0xfa23e9);var _0x1a744f=Date[_0x03f2('0x70')]();fs[_0x03f2('0x71')](util['format'](_0x03f2('0x72'),_0x47cec0['id'],_0x1a744f),_0x432bba);_0xdd0caa[_0x03f2('0x73')]('Content-disposition',_0x03f2('0x74')+util[_0x03f2('0x6b')](_0x03f2('0x75'),_0x47cec0['id'],_0x1a744f));_0xdd0caa[_0x03f2('0x73')](_0x03f2('0x76'),_0x03f2('0x77'));return _0xdd0caa[_0x03f2('0x78')](util['format']('/tmp/list_%d_%s.csv',_0x47cec0['id'],_0x1a744f));}else{return _0xdd0caa[_0x03f2('0x1e')](0xcc);}})['catch'](handleError(_0xdd0caa,null));};exports[_0x03f2('0x79')]=function(_0x2ed243,_0x7b1dd5,_0x3f08ee){var _0x31e66a;delete _0x2ed243[_0x03f2('0x50')]['id'];return db[_0x03f2('0x31')]['findOne']({'where':{'id':_0x2ed243[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x7b1dd5,null))[_0x03f2('0x29')](function(_0x10b436){if(_0x10b436){return db[_0x03f2('0x7a')]['transaction'](function(_0x3e7ff5){return db[_0x03f2('0x68')]['create'](_0x2ed243[_0x03f2('0x50')],{'transaction':_0x3e7ff5})['then'](function(_0xaee921){_0x31e66a=_0xaee921;return _0x10b436['addCustomFields'](_0xaee921,{'transaction':_0x3e7ff5});})[_0x03f2('0x29')](function(){var _0x4ef507={'type':db[_0x03f2('0x7b')][_0x03f2('0x7c')],'transaction':_0x3e7ff5};switch(_0x2ed243[_0x03f2('0x50')][_0x03f2('0x45')]){case _0x03f2('0x7d'):_0x4ef507[_0x03f2('0x45')]=db['Sequelize'][_0x03f2('0x7c')];break;case _0x03f2('0x7e'):_0x4ef507[_0x03f2('0x45')]=db[_0x03f2('0x7b')][_0x03f2('0x7f')];break;case'switch':_0x4ef507[_0x03f2('0x45')]=db[_0x03f2('0x7b')][_0x03f2('0x80')];_0x4ef507[_0x03f2('0x81')]=![];break;default:}return db[_0x03f2('0x7a')][_0x03f2('0x82')]['addColumn'](_0x03f2('0x83'),util[_0x03f2('0x6b')](_0x03f2('0x84'),_0x31e66a['id']),_0x4ef507);})['then'](function(){return _0x31e66a;});});}})[_0x03f2('0x29')](respondWithResult(_0x7b1dd5,null))[_0x03f2('0x4a')](handleError(_0x7b1dd5,null));};exports[_0x03f2('0x85')]=function(_0x553bc0,_0x22782e,_0x2fa7ec){var _0x3b3abb={};var _0x4e5796={};var _0x3bed94;var _0x564028;return db[_0x03f2('0x31')]['findOne']({'where':{'id':_0x553bc0[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x22782e,null))[_0x03f2('0x29')](function(_0x493cb2){if(_0x493cb2){_0x3bed94=_0x493cb2;_0x4e5796[_0x03f2('0x37')]=_['keys'](db[_0x03f2('0x68')]['rawAttributes']);_0x4e5796[_0x03f2('0x35')]=_['keys'](_0x553bc0[_0x03f2('0x35')]);_0x4e5796[_0x03f2('0x41')]=_[_0x03f2('0x36')](_0x4e5796['model'],_0x4e5796['query']);_0x3b3abb['attributes']=_[_0x03f2('0x36')](_0x4e5796[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0x553bc0['query'][_0x03f2('0x38')]));_0x3b3abb[_0x03f2('0x39')]=_0x3b3abb['attributes'][_0x03f2('0x3a')]?_0x3b3abb['attributes']:_0x4e5796[_0x03f2('0x37')];_0x3b3abb[_0x03f2('0x3e')]=qs[_0x03f2('0x3f')](_0x553bc0[_0x03f2('0x35')][_0x03f2('0x3f')]);_0x3b3abb[_0x03f2('0x40')]=qs[_0x03f2('0x41')](_['pick'](_0x553bc0['query'],_0x4e5796[_0x03f2('0x41')]));_0x3b3abb[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x3b3abb[_0x03f2('0x40')],{'$or':[{'ListId':_0x493cb2['id']},{'ListId':null}]});if(_0x553bc0[_0x03f2('0x35')][_0x03f2('0x43')]){_0x3b3abb[_0x03f2('0x40')]=_['merge'](_0x3b3abb[_0x03f2('0x40')],{'$or':_[_0x03f2('0x30')](_0x3b3abb['attributes'],function(_0x16853d){var _0xc05d7f={};_0xc05d7f[_0x16853d]={'$like':'%'+_0x553bc0[_0x03f2('0x35')]['filter']+'%'};return _0xc05d7f;})});}_0x3b3abb=_[_0x03f2('0x44')]({},_0x3b3abb,_0x553bc0[_0x03f2('0x46')]);return db[_0x03f2('0x68')][_0x03f2('0x86')](_0x3b3abb);}})[_0x03f2('0x29')](respondWithResult(_0x22782e,null))[_0x03f2('0x4a')](handleError(_0x22782e,null));};exports[_0x03f2('0x87')]=function(_0x214acd,_0x3b30d3,_0x5e0cc3){return db[_0x03f2('0x31')]['find']({'where':{'id':_0x214acd['params']['id']}})['then'](handleEntityNotFound(_0x3b30d3,null))['then'](function(_0x33cc2a){if(_0x33cc2a){return _0x33cc2a[_0x03f2('0x87')](_0x214acd[_0x03f2('0x50')][_0x03f2('0x5e')],_[_0x03f2('0x88')](_0x214acd['body'],[_0x03f2('0x5e'),'id'])||{})[_0x03f2('0x89')](function(_0x4dfacd){for(var _0x3d481e=0x0;_0x3d481e<_0x214acd['body'][_0x03f2('0x5e')][_0x03f2('0x3a')];_0x3d481e+=0x1){socket['emit']('userCmList:save',{'UserId':_0x214acd[_0x03f2('0x50')]['ids'][_0x3d481e],'CmListId':_0x214acd[_0x03f2('0x4c')]['id']});}return _0x4dfacd;});}})['then'](respondWithResult(_0x3b30d3,null))[_0x03f2('0x4a')](handleError(_0x3b30d3,null));};exports['removeAgents']=function(_0x5517fa,_0x26e224,_0x5258fa){return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x5517fa['params']['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x26e224,null))[_0x03f2('0x29')](function(_0x2efa2b){if(_0x2efa2b){return _0x2efa2b[_0x03f2('0x8a')](_0x5517fa[_0x03f2('0x35')][_0x03f2('0x5e')])[_0x03f2('0x29')](function(){if(_['isArray'](_0x5517fa['query'][_0x03f2('0x5e')])){for(var _0x122a77=0x0;_0x122a77<_0x5517fa[_0x03f2('0x35')][_0x03f2('0x5e')][_0x03f2('0x3a')];_0x122a77+=0x1){socket[_0x03f2('0x8b')](_0x03f2('0x8c'),{'UserId':Number(_0x5517fa[_0x03f2('0x35')]['ids'][_0x122a77]),'CmListId':Number(_0x5517fa[_0x03f2('0x4c')]['id'])});}}else{socket['emit'](_0x03f2('0x8c'),{'UserId':Number(_0x5517fa[_0x03f2('0x35')][_0x03f2('0x5e')]),'CmListId':Number(_0x5517fa['params']['id'])});}});}})[_0x03f2('0x29')](respondWithStatusCode(_0x26e224,null))[_0x03f2('0x4a')](handleError(_0x26e224,null));};exports[_0x03f2('0x8d')]=function(_0x1c0d1f,_0x5755ee,_0x5c0e65){var _0x1f2add={};var _0x1e45c5={};var _0x31cabb;var _0x336b2c;return db[_0x03f2('0x31')][_0x03f2('0x5b')]({'where':{'id':_0x1c0d1f[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x5755ee,null))[_0x03f2('0x29')](function(_0x517c60){if(_0x517c60){_0x31cabb=_0x517c60;_0x1e45c5['model']=_[_0x03f2('0x34')](db[_0x03f2('0x8e')]['rawAttributes']);_0x1e45c5[_0x03f2('0x35')]=_[_0x03f2('0x34')](_0x1c0d1f[_0x03f2('0x35')]);_0x1e45c5[_0x03f2('0x41')]=_['intersection'](_0x1e45c5[_0x03f2('0x37')],_0x1e45c5[_0x03f2('0x35')]);_0x1f2add[_0x03f2('0x39')]=_[_0x03f2('0x36')](_0x1e45c5[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0x1c0d1f[_0x03f2('0x35')][_0x03f2('0x38')]));_0x1f2add[_0x03f2('0x39')]=_0x1f2add[_0x03f2('0x39')][_0x03f2('0x3a')]?_0x1f2add['attributes']:_0x1e45c5[_0x03f2('0x37')];_0x1f2add[_0x03f2('0x3e')]=qs[_0x03f2('0x3f')](_0x1c0d1f[_0x03f2('0x35')]['sort']);_0x1f2add[_0x03f2('0x40')]=qs['filters'](_[_0x03f2('0x42')](_0x1c0d1f[_0x03f2('0x35')],_0x1e45c5['filters']));if(_0x1c0d1f[_0x03f2('0x35')][_0x03f2('0x43')]){_0x1f2add[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x1f2add[_0x03f2('0x40')],{'$or':_[_0x03f2('0x30')](_0x1f2add[_0x03f2('0x39')],function(_0x1206fb){var _0x22d10f={};_0x22d10f[_0x1206fb]={'$like':'%'+_0x1c0d1f[_0x03f2('0x35')]['filter']+'%'};return _0x22d10f;})});}_0x1f2add=_['merge']({},_0x1f2add,_0x1c0d1f[_0x03f2('0x46')]);return _0x31cabb[_0x03f2('0x8d')](_0x1f2add);}})[_0x03f2('0x29')](function(_0x43dbc0){if(_0x43dbc0){_0x336b2c=_0x43dbc0['length'];if(!_0x1c0d1f[_0x03f2('0x35')][_0x03f2('0x3b')]('nolimit')){_0x1f2add['limit']=qs[_0x03f2('0x3d')](_0x1c0d1f['query'][_0x03f2('0x3d')]);_0x1f2add[_0x03f2('0x23')]=qs['offset'](_0x1c0d1f[_0x03f2('0x35')][_0x03f2('0x23')]);}return _0x31cabb[_0x03f2('0x8d')](_0x1f2add);}})[_0x03f2('0x29')](function(_0x1c42e8){if(_0x1c42e8){return _0x1c42e8?{'count':_0x336b2c,'rows':_0x1c42e8}:null;}})[_0x03f2('0x29')](respondWithResult(_0x5755ee,null))[_0x03f2('0x4a')](handleError(_0x5755ee,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6e2c4be..4413600 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dd3=['hook','exports','../../mysqldb','CmList','save','update','remove','emit'];(function(_0x32243f,_0x3cb76f){var _0x3e1ad5=function(_0x48e701){while(--_0x48e701){_0x32243f['push'](_0x32243f['shift']());}};_0x3e1ad5(++_0x3cb76f);}(_0x7dd3,0x1c2));var _0x37dd=function(_0x2a4c3a,_0x338cb0){_0x2a4c3a=_0x2a4c3a-0x0;var _0x2f41cb=_0x7dd3[_0x2a4c3a];return _0x2f41cb;};'use strict';var EventEmitter=require('events');var CmList=require(_0x37dd('0x0'))['db'][_0x37dd('0x1')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x37dd('0x2'),'afterUpdate':_0x37dd('0x3'),'afterDestroy':_0x37dd('0x4')};function emitEvent(_0x7d8115){return function(_0x42efec,_0xa00ff0,_0x5f7166){CmListEvents[_0x37dd('0x5')](_0x7d8115+':'+_0x42efec['id'],_0x42efec);CmListEvents[_0x37dd('0x5')](_0x7d8115,_0x42efec);_0x5f7166(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x37dd('0x6')](e,emitEvent(event));}}module[_0x37dd('0x7')]=CmListEvents; \ No newline at end of file +var _0x6ece=['../../mysqldb','CmList','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x15c37c,_0x4f7106){var _0x1d7463=function(_0x5c4030){while(--_0x5c4030){_0x15c37c['push'](_0x15c37c['shift']());}};_0x1d7463(++_0x4f7106);}(_0x6ece,0xd7));var _0xe6ec=function(_0x14276d,_0x20cc7a){_0x14276d=_0x14276d-0x0;var _0x114714=_0x6ece[_0x14276d];return _0x114714;};'use strict';var EventEmitter=require(_0xe6ec('0x0'));var CmList=require(_0xe6ec('0x1'))['db'][_0xe6ec('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xe6ec('0x3')](0x0);var events={'afterCreate':_0xe6ec('0x4'),'afterUpdate':'update','afterDestroy':_0xe6ec('0x5')};function emitEvent(_0x931a69){return function(_0x271110,_0x593a74,_0x4c1e97){CmListEvents[_0xe6ec('0x6')](_0x931a69+':'+_0x271110['id'],_0x271110);CmListEvents['emit'](_0x931a69,_0x271110);_0x4c1e97(null);};}for(var e in events){if(events[_0xe6ec('0x7')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xe6ec('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b48a1d5..66e5353 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c37=['CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define'];(function(_0x14c981,_0x54d5d5){var _0x139fdb=function(_0x512159){while(--_0x512159){_0x14c981['push'](_0x14c981['shift']());}};_0x139fdb(++_0x54d5d5);}(_0x8c37,0x188));var _0x78c3=function(_0x3697f9,_0x11db5c){_0x3697f9=_0x3697f9-0x0;var _0xe96ea2=_0x8c37[_0x3697f9];return _0xe96ea2;};'use strict';var _=require(_0x78c3('0x0'));var util=require(_0x78c3('0x1'));var logger=require(_0x78c3('0x2'))('api');var moment=require(_0x78c3('0x3'));var BPromise=require(_0x78c3('0x4'));var rp=require(_0x78c3('0x5'));var fs=require('fs');var path=require(_0x78c3('0x6'));var rimraf=require(_0x78c3('0x7'));var config=require(_0x78c3('0x8'));var attributes=require(_0x78c3('0x9'));module['exports']=function(_0x5d13bd,_0x2d095f){return _0x5d13bd[_0x78c3('0xa')](_0x78c3('0xb'),attributes,{'tableName':_0x78c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9d6=['exports','define','CmList','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2d7c6e,_0x199af9){var _0x4186b3=function(_0x420862){while(--_0x420862){_0x2d7c6e['push'](_0x2d7c6e['shift']());}};_0x4186b3(++_0x199af9);}(_0xe9d6,0x1cb));var _0x6e9d=function(_0x547402,_0x83073c){_0x547402=_0x547402-0x0;var _0x3d35e9=_0xe9d6[_0x547402];return _0x3d35e9;};'use strict';var _=require(_0x6e9d('0x0'));var util=require(_0x6e9d('0x1'));var logger=require(_0x6e9d('0x2'))(_0x6e9d('0x3'));var moment=require(_0x6e9d('0x4'));var BPromise=require(_0x6e9d('0x5'));var rp=require(_0x6e9d('0x6'));var fs=require('fs');var path=require(_0x6e9d('0x7'));var rimraf=require(_0x6e9d('0x8'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0x6e9d('0x9')]=function(_0x28ce6d,_0x220b41){return _0x28ce6d[_0x6e9d('0xa')](_0x6e9d('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 4c4baad..b6ded7a 100644 --- a/server/api/cmList/cmList.rpc.js +++ b/server/api/cmList/cmList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4196=['info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x46163b,_0x3721ea){var _0x1b8d9c=function(_0x1275f1){while(--_0x1275f1){_0x46163b['push'](_0x46163b['shift']());}};_0x1b8d9c(++_0x3721ea);}(_0x4196,0x1a2));var _0x6419=function(_0x22fa49,_0x251216){_0x22fa49=_0x22fa49-0x0;var _0xbda729=_0x4196[_0x22fa49];return _0xbda729;};'use strict';var _=require(_0x6419('0x0'));var util=require('util');var moment=require(_0x6419('0x1'));var BPromise=require(_0x6419('0x2'));var rs=require(_0x6419('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6419('0x4'))['db'];var utils=require(_0x6419('0x5'));var logger=require('../../config/logger')(_0x6419('0x6'));var config=require(_0x6419('0x7'));var jayson=require(_0x6419('0x8'));var client=jayson[_0x6419('0x9')][_0x6419('0xa')]({'port':0x232a});config[_0x6419('0xb')]=_[_0x6419('0xc')](config[_0x6419('0xb')],{'host':_0x6419('0xd'),'port':0x18eb});var socket=require(_0x6419('0xe'))(new Redis(config['redis']));require(_0x6419('0xf'))[_0x6419('0x10')](socket);function respondWithRpcPromise(_0x5a9d54,_0xb2ddcf,_0x3646eb){return new BPromise(function(_0x4f1e5f,_0x578719){return client[_0x6419('0x11')](_0x5a9d54,_0x3646eb)['then'](function(_0x3f4ef9){logger['info'](_0x6419('0x12'),_0xb2ddcf,_0x6419('0x13'));logger['debug'](_0x6419('0x14'),_0xb2ddcf,_0x6419('0x13'),JSON['stringify'](_0x3f4ef9));if(_0x3f4ef9[_0x6419('0x15')]){if(_0x3f4ef9[_0x6419('0x15')][_0x6419('0x16')]===0x1f4){logger[_0x6419('0x15')](_0x6419('0x12'),_0xb2ddcf,_0x3f4ef9[_0x6419('0x15')][_0x6419('0x17')]);return _0x578719(_0x3f4ef9[_0x6419('0x15')][_0x6419('0x17')]);}logger[_0x6419('0x15')]('CmList,\x20%s,\x20%s',_0xb2ddcf,_0x3f4ef9[_0x6419('0x15')]['message']);return _0x4f1e5f(_0x3f4ef9['error'][_0x6419('0x17')]);}else{logger[_0x6419('0x18')](_0x6419('0x12'),_0xb2ddcf,'request\x20sent');_0x4f1e5f(_0x3f4ef9[_0x6419('0x19')][_0x6419('0x17')]);}})['catch'](function(_0x495d3d){logger[_0x6419('0x15')](_0x6419('0x12'),_0xb2ddcf,_0x495d3d);_0x578719(_0x495d3d);});});} \ No newline at end of file +var _0xe775=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x55784c,_0xe48041){var _0x55cb34=function(_0x4723ce){while(--_0x4723ce){_0x55784c['push'](_0x55784c['shift']());}};_0x55cb34(++_0xe48041);}(_0xe775,0x1c3));var _0x5e77=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0xe775[_0x104e21];return _0x605b37;};'use strict';var _=require(_0x5e77('0x0'));var util=require(_0x5e77('0x1'));var moment=require('moment');var BPromise=require(_0x5e77('0x2'));var rs=require(_0x5e77('0x3'));var fs=require('fs');var Redis=require(_0x5e77('0x4'));var db=require(_0x5e77('0x5'))['db'];var utils=require(_0x5e77('0x6'));var logger=require(_0x5e77('0x7'))(_0x5e77('0x8'));var config=require(_0x5e77('0x9'));var jayson=require(_0x5e77('0xa'));var client=jayson[_0x5e77('0xb')][_0x5e77('0xc')]({'port':0x232a});config[_0x5e77('0xd')]=_[_0x5e77('0xe')](config[_0x5e77('0xd')],{'host':_0x5e77('0xf'),'port':0x18eb});var socket=require(_0x5e77('0x10'))(new Redis(config[_0x5e77('0xd')]));require(_0x5e77('0x11'))['register'](socket);function respondWithRpcPromise(_0xd947b3,_0x57b938,_0x27bec1){return new BPromise(function(_0xbadee9,_0x474c51){return client[_0x5e77('0x12')](_0xd947b3,_0x27bec1)[_0x5e77('0x13')](function(_0xd7b90){logger[_0x5e77('0x14')](_0x5e77('0x15'),_0x57b938,_0x5e77('0x16'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x57b938,'request\x20sent',JSON['stringify'](_0xd7b90));if(_0xd7b90['error']){if(_0xd7b90[_0x5e77('0x17')][_0x5e77('0x18')]===0x1f4){logger[_0x5e77('0x17')](_0x5e77('0x15'),_0x57b938,_0xd7b90[_0x5e77('0x17')][_0x5e77('0x19')]);return _0x474c51(_0xd7b90[_0x5e77('0x17')][_0x5e77('0x19')]);}logger['error'](_0x5e77('0x15'),_0x57b938,_0xd7b90[_0x5e77('0x17')][_0x5e77('0x19')]);return _0xbadee9(_0xd7b90[_0x5e77('0x17')]['message']);}else{logger[_0x5e77('0x14')](_0x5e77('0x15'),_0x57b938,_0x5e77('0x16'));_0xbadee9(_0xd7b90[_0x5e77('0x1a')][_0x5e77('0x19')]);}})[_0x5e77('0x1b')](function(_0x18d632){logger[_0x5e77('0x17')](_0x5e77('0x15'),_0x57b938,_0x18d632);_0x474c51(_0x18d632);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f928663..41c1773 100644 --- a/server/api/cmList/cmList.socket.js +++ b/server/api/cmList/cmList.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37c5=['remove','update','emit','removeListener','cmList:','save'];(function(_0xa34fca,_0x2a1aa0){var _0x291ec1=function(_0x590b9a){while(--_0x590b9a){_0xa34fca['push'](_0xa34fca['shift']());}};_0x291ec1(++_0x2a1aa0);}(_0x37c5,0xa7));var _0x537c=function(_0xb1933f,_0x403f7f){_0xb1933f=_0xb1933f-0x0;var _0x405a93=_0x37c5[_0xb1933f];return _0x405a93;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x537c('0x0'),_0x537c('0x1'),_0x537c('0x2')];function createListener(_0x11f076,_0x1c5b5f){return function(_0x183b59){_0x1c5b5f[_0x537c('0x3')](_0x11f076,_0x183b59);};}function removeListener(_0x42bd15,_0x2c0854){return function(){CmListEvents[_0x537c('0x4')](_0x42bd15,_0x2c0854);};}exports['register']=function(_0x42c86a){for(var _0x1156f4=0x0,_0x336920=events['length'];_0x1156f4<_0x336920;_0x1156f4++){var _0x36bf4a=events[_0x1156f4];var _0x67f986=createListener(_0x537c('0x5')+_0x36bf4a,_0x42c86a);CmListEvents['on'](_0x36bf4a,_0x67f986);}}; \ No newline at end of file +var _0x9206=['save','remove','update','length','./cmList.events'];(function(_0x565053,_0x4bdd98){var _0x181c41=function(_0x176d8b){while(--_0x176d8b){_0x565053['push'](_0x565053['shift']());}};_0x181c41(++_0x4bdd98);}(_0x9206,0x176));var _0x6920=function(_0x4a0657,_0x14abfd){_0x4a0657=_0x4a0657-0x0;var _0x385e03=_0x9206[_0x4a0657];return _0x385e03;};'use strict';var CmListEvents=require(_0x6920('0x0'));var events=[_0x6920('0x1'),_0x6920('0x2'),_0x6920('0x3')];function createListener(_0x18c93a,_0x319cce){return function(_0x4bc24b){_0x319cce['emit'](_0x18c93a,_0x4bc24b);};}function removeListener(_0x1770ce,_0x3c84f7){return function(){CmListEvents['removeListener'](_0x1770ce,_0x3c84f7);};}exports['register']=function(_0x41c8c4){for(var _0x4d67d7=0x0,_0x21fb21=events[_0x6920('0x4')];_0x4d67d7<_0x21fb21;_0x4d67d7++){var _0x2aad51=events[_0x4d67d7];var _0xef5d38=createListener('cmList:'+_0x2aad51,_0x41c8c4);CmListEvents['on'](_0x2aad51,_0xef5d38);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9a17cad..e96157e 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 73b9e84..ccf9996 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x13da4d,_0x9ae321){var _0x36bd9d=function(_0x1c9af0){while(--_0x1c9af0){_0x13da4d['push'](_0x13da4d['shift']());}};_0x36bd9d(++_0x9ae321);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x19e975,_0x2ecafb){var _0x3c145f=function(_0x11241c){while(--_0x11241c){_0x19e975['push'](_0x19e975['shift']());}};_0x3c145f(++_0x2ecafb);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 771d3cd..3d981e3 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5cc=['fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','Content-Range','apply','save','update','then','error','name','send','body','Condition','find','params','destroy','catch','html-pdf','eml-format'];(function(_0x4d2111,_0x24c83d){var _0x5f00a0=function(_0x589036){while(--_0x589036){_0x4d2111['push'](_0x4d2111['shift']());}};_0x5f00a0(++_0x24c83d);}(_0xb5cc,0x108));var _0xcb5c=function(_0x591099,_0xaedaf9){_0x591099=_0x591099-0x0;var _0x1bb665=_0xb5cc[_0x591099];return _0x1bb665;};'use strict';var pdf=require(_0xcb5c('0x0'));var emlformat=require(_0xcb5c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcb5c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcb5c('0x3'));var Mustache=require(_0xcb5c('0x4'));var util=require(_0xcb5c('0x5'));var path=require(_0xcb5c('0x6'));var sox=require(_0xcb5c('0x7'));var csv=require(_0xcb5c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcb5c('0x9'));var squel=require(_0xcb5c('0xa'));var crypto=require(_0xcb5c('0xb'));var jsforce=require(_0xcb5c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb5c('0x8'));var querystring=require(_0xcb5c('0xd'));var Papa=require('papaparse');var Redis=require(_0xcb5c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb5c('0xf'));var hardwareService=require(_0xcb5c('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xcb5c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xcb5c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c36fd,_0x108873){_0x108873=_0x108873||0xcc;return function(_0x351c4c){if(_0x351c4c){return _0x5c36fd[_0xcb5c('0x13')](_0x108873);}return _0x5c36fd[_0xcb5c('0x14')](_0x108873)[_0xcb5c('0x15')]();};}function respondWithResult(_0x3526b4,_0x3e044f){_0x3e044f=_0x3e044f||0xc8;return function(_0x4bbc10){if(_0x4bbc10){return _0x3526b4[_0xcb5c('0x14')](_0x3e044f)[_0xcb5c('0x16')](_0x4bbc10);}};}function respondWithFilteredResult(_0xfe92c7,_0xb52d9d){return function(_0x58274f){if(_0x58274f){var _0x38824d=_0x58274f['count'],_0x4ed6b4=_0xb52d9d['offset'],_0x4eb80a=_0xb52d9d['offset']+_0xb52d9d[_0xcb5c('0x17')],_0x517aff;if(_0x4eb80a>=_0x38824d){_0x4eb80a=_0x38824d;_0x517aff=0xc8;}else{_0x517aff=0xce;}_0xfe92c7[_0xcb5c('0x14')](_0x517aff);return _0xfe92c7['set'](_0xcb5c('0x18'),_0x4ed6b4+'-'+_0x4eb80a+'/'+_0x38824d)[_0xcb5c('0x16')](_0x58274f);}return null;};}function patchUpdates(_0x2547f4){return function(_0x15780a){try{jsonpatch[_0xcb5c('0x19')](_0x15780a,_0x2547f4,!![]);}catch(_0x552e11){return BPromise['reject'](_0x552e11);}return _0x15780a[_0xcb5c('0x1a')]();};}function saveUpdates(_0x7b57dc,_0x4672ec){return function(_0x2091f8){if(_0x2091f8){return _0x2091f8[_0xcb5c('0x1b')](_0x7b57dc)[_0xcb5c('0x1c')](function(_0x666efb){return _0x666efb;});}return null;};}function removeEntity(_0x52493b,_0x10dde3){return function(_0x5b0874){if(_0x5b0874){return _0x5b0874['destroy']()[_0xcb5c('0x1c')](function(){_0x52493b[_0xcb5c('0x14')](0xcc)[_0xcb5c('0x15')]();});}};}function handleEntityNotFound(_0x57c67c,_0x4a45ec){return function(_0x544d95){if(!_0x544d95){_0x57c67c[_0xcb5c('0x13')](0x194);}return _0x544d95;};}function handleError(_0xe953a7,_0x2e0147){_0x2e0147=_0x2e0147||0x1f4;return function(_0x2094f6){logger[_0xcb5c('0x1d')](_0x2094f6['stack']);if(_0x2094f6[_0xcb5c('0x1e')]){delete _0x2094f6[_0xcb5c('0x1e')];}_0xe953a7[_0xcb5c('0x14')](_0x2e0147)[_0xcb5c('0x1f')](_0x2094f6);};}exports[_0xcb5c('0x1b')]=function(_0x289ae5,_0xab8249){if(_0x289ae5[_0xcb5c('0x20')]['id']){delete _0x289ae5[_0xcb5c('0x20')]['id'];}return db[_0xcb5c('0x21')][_0xcb5c('0x22')]({'where':{'id':_0x289ae5[_0xcb5c('0x23')]['id']}})[_0xcb5c('0x1c')](handleEntityNotFound(_0xab8249,null))[_0xcb5c('0x1c')](saveUpdates(_0x289ae5['body'],null))[_0xcb5c('0x1c')](respondWithResult(_0xab8249,null))['catch'](handleError(_0xab8249,null));};exports[_0xcb5c('0x24')]=function(_0x231b1a,_0x8104f1){return db[_0xcb5c('0x21')][_0xcb5c('0x22')]({'where':{'id':_0x231b1a[_0xcb5c('0x23')]['id']}})[_0xcb5c('0x1c')](handleEntityNotFound(_0x8104f1,null))[_0xcb5c('0x1c')](removeEntity(_0x8104f1,null))[_0xcb5c('0x25')](handleError(_0x8104f1,null));}; \ No newline at end of file +var _0xfbc3=['util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','reject','save','error','stack','name','update','body','then','catch','destroy','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1cd6ed,_0x432b14){var _0xc7859e=function(_0x28ee65){while(--_0x28ee65){_0x1cd6ed['push'](_0x1cd6ed['shift']());}};_0xc7859e(++_0x432b14);}(_0xfbc3,0x1f1));var _0x3fbc=function(_0x77f62c,_0x2eebaa){_0x77f62c=_0x77f62c-0x0;var _0x590e50=_0xfbc3[_0x77f62c];return _0x590e50;};'use strict';var pdf=require(_0x3fbc('0x0'));var emlformat=require(_0x3fbc('0x1'));var rimraf=require(_0x3fbc('0x2'));var zipdir=require(_0x3fbc('0x3'));var jsonpatch=require(_0x3fbc('0x4'));var rp=require(_0x3fbc('0x5'));var moment=require(_0x3fbc('0x6'));var BPromise=require(_0x3fbc('0x7'));var Mustache=require(_0x3fbc('0x8'));var util=require(_0x3fbc('0x9'));var path=require(_0x3fbc('0xa'));var sox=require(_0x3fbc('0xb'));var csv=require(_0x3fbc('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fbc('0xd'));var squel=require(_0x3fbc('0xe'));var crypto=require('crypto');var jsforce=require(_0x3fbc('0xf'));var deskjs=require(_0x3fbc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3fbc('0x11'));var Papa=require(_0x3fbc('0x12'));var Redis=require(_0x3fbc('0x13'));var authService=require(_0x3fbc('0x14'));var qs=require(_0x3fbc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3fbc('0x16'));var logger=require('../../config/logger')(_0x3fbc('0x17'));var utils=require(_0x3fbc('0x18'));var config=require(_0x3fbc('0x19'));var licenseUtil=require(_0x3fbc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dd24,_0x1273fe){_0x1273fe=_0x1273fe||0xcc;return function(_0x6dada4){if(_0x6dada4){return _0x21dd24[_0x3fbc('0x1b')](_0x1273fe);}return _0x21dd24[_0x3fbc('0x1c')](_0x1273fe)[_0x3fbc('0x1d')]();};}function respondWithResult(_0x455694,_0x298779){_0x298779=_0x298779||0xc8;return function(_0x42bfc4){if(_0x42bfc4){return _0x455694[_0x3fbc('0x1c')](_0x298779)[_0x3fbc('0x1e')](_0x42bfc4);}};}function respondWithFilteredResult(_0x56f8c9,_0x18b177){return function(_0x57d703){if(_0x57d703){var _0x31a0a1=_0x57d703[_0x3fbc('0x1f')],_0x4cdb3d=_0x18b177[_0x3fbc('0x20')],_0x45a86f=_0x18b177[_0x3fbc('0x20')]+_0x18b177[_0x3fbc('0x21')],_0x4f1e2d;if(_0x45a86f>=_0x31a0a1){_0x45a86f=_0x31a0a1;_0x4f1e2d=0xc8;}else{_0x4f1e2d=0xce;}_0x56f8c9[_0x3fbc('0x1c')](_0x4f1e2d);return _0x56f8c9['set']('Content-Range',_0x4cdb3d+'-'+_0x45a86f+'/'+_0x31a0a1)[_0x3fbc('0x1e')](_0x57d703);}return null;};}function patchUpdates(_0x17d382){return function(_0x4f6868){try{jsonpatch['apply'](_0x4f6868,_0x17d382,!![]);}catch(_0x1c2ea8){return BPromise[_0x3fbc('0x22')](_0x1c2ea8);}return _0x4f6868[_0x3fbc('0x23')]();};}function saveUpdates(_0x1ffa41,_0x93981f){return function(_0x267a31){if(_0x267a31){return _0x267a31['update'](_0x1ffa41)['then'](function(_0x2b49e4){return _0x2b49e4;});}return null;};}function removeEntity(_0x590009,_0x16c61c){return function(_0x331c95){if(_0x331c95){return _0x331c95['destroy']()['then'](function(){_0x590009[_0x3fbc('0x1c')](0xcc)[_0x3fbc('0x1d')]();});}};}function handleEntityNotFound(_0x83b98f,_0x39590d){return function(_0x32de22){if(!_0x32de22){_0x83b98f['sendStatus'](0x194);}return _0x32de22;};}function handleError(_0x25dd72,_0x333da2){_0x333da2=_0x333da2||0x1f4;return function(_0x56a35d){logger[_0x3fbc('0x24')](_0x56a35d[_0x3fbc('0x25')]);if(_0x56a35d[_0x3fbc('0x26')]){delete _0x56a35d[_0x3fbc('0x26')];}_0x25dd72[_0x3fbc('0x1c')](_0x333da2)['send'](_0x56a35d);};}exports[_0x3fbc('0x27')]=function(_0x561428,_0x2509ce){if(_0x561428[_0x3fbc('0x28')]['id']){delete _0x561428[_0x3fbc('0x28')]['id'];}return db['Condition']['find']({'where':{'id':_0x561428['params']['id']}})[_0x3fbc('0x29')](handleEntityNotFound(_0x2509ce,null))[_0x3fbc('0x29')](saveUpdates(_0x561428[_0x3fbc('0x28')],null))[_0x3fbc('0x29')](respondWithResult(_0x2509ce,null))[_0x3fbc('0x2a')](handleError(_0x2509ce,null));};exports[_0x3fbc('0x2b')]=function(_0x42db8e,_0x1aee3b){return db['Condition'][_0x3fbc('0x2c')]({'where':{'id':_0x42db8e[_0x3fbc('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1aee3b,null))['then'](removeEntity(_0x1aee3b,null))[_0x3fbc('0x2a')](handleError(_0x1aee3b,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0c5bb76..746da5b 100644 --- a/server/api/condition/condition.model.js +++ b/server/api/condition/condition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6203=['exports','define','Condition','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5429ff,_0x3cf146){var _0x3e2c9c=function(_0x4981c3){while(--_0x4981c3){_0x5429ff['push'](_0x5429ff['shift']());}};_0x3e2c9c(++_0x3cf146);}(_0x6203,0x1ae));var _0x3620=function(_0x2a630e,_0x27fd46){_0x2a630e=_0x2a630e-0x0;var _0x35b803=_0x6203[_0x2a630e];return _0x35b803;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3620('0x0'));var rp=require(_0x3620('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3620('0x2'));var config=require(_0x3620('0x3'));var attributes=require('./condition.attributes');module[_0x3620('0x4')]=function(_0x2ed6bf,_0x4c827e){return _0x2ed6bf[_0x3620('0x5')](_0x3620('0x6'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8369=['util','moment','../../config/environment','define','Condition','tools_conditions','lodash'];(function(_0x46c346,_0x5a0277){var _0x519b32=function(_0x4308ce){while(--_0x4308ce){_0x46c346['push'](_0x46c346['shift']());}};_0x519b32(++_0x5a0277);}(_0x8369,0x1b1));var _0x9836=function(_0x3c41b0,_0x1d7f00){_0x3c41b0=_0x3c41b0-0x0;var _0xd3fea2=_0x8369[_0x3c41b0];return _0xd3fea2;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9836('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9836('0x3'));var attributes=require('./condition.attributes');module['exports']=function(_0x2c3475,_0x5b73cd){return _0x2c3475[_0x9836('0x4')](_0x9836('0x5'),attributes,{'tableName':_0x9836('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 8f10d3b..fa92572 100644 --- a/server/api/condition/condition.rpc.js +++ b/server/api/condition/condition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x381e=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x381e,0x165));var _0xe381=function(_0x36d0e3,_0x532a98){_0x36d0e3=_0x36d0e3-0x0;var _0x5e1471=_0x381e[_0x36d0e3];return _0x5e1471;};'use strict';var _=require('lodash');var util=require(_0xe381('0x0'));var moment=require(_0xe381('0x1'));var BPromise=require(_0xe381('0x2'));var rs=require(_0xe381('0x3'));var fs=require('fs');var Redis=require(_0xe381('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe381('0x5'));var logger=require(_0xe381('0x6'))('rpc');var config=require(_0xe381('0x7'));var jayson=require(_0xe381('0x8'));var client=jayson[_0xe381('0x9')][_0xe381('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d98dd,_0x5b977c,_0x3f7554){return new BPromise(function(_0x477d29,_0x3c7969){return client[_0xe381('0xb')](_0x4d98dd,_0x3f7554)['then'](function(_0xa12b18){logger[_0xe381('0xc')](_0xe381('0xd'),_0x5b977c,'request\x20sent');logger['debug'](_0xe381('0xe'),_0x5b977c,_0xe381('0xf'),JSON['stringify'](_0xa12b18));if(_0xa12b18[_0xe381('0x10')]){if(_0xa12b18[_0xe381('0x10')][_0xe381('0x11')]===0x1f4){logger['error'](_0xe381('0xd'),_0x5b977c,_0xa12b18['error'][_0xe381('0x12')]);return _0x3c7969(_0xa12b18[_0xe381('0x10')][_0xe381('0x12')]);}logger[_0xe381('0x10')](_0xe381('0xd'),_0x5b977c,_0xa12b18[_0xe381('0x10')][_0xe381('0x12')]);return _0x477d29(_0xa12b18[_0xe381('0x10')][_0xe381('0x12')]);}else{logger[_0xe381('0xc')]('Condition,\x20%s,\x20%s',_0x5b977c,'request\x20sent');_0x477d29(_0xa12b18[_0xe381('0x13')]['message']);}})[_0xe381('0x14')](function(_0x33e272){logger[_0xe381('0x10')](_0xe381('0xd'),_0x5b977c,_0x33e272);_0x3c7969(_0x33e272);});});} \ No newline at end of file +var _0xa502=['info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','ioredis','../../config/utils','rpc','jayson/promise','http','request','then'];(function(_0x362fb0,_0x2806de){var _0x220474=function(_0x32412f){while(--_0x32412f){_0x362fb0['push'](_0x362fb0['shift']());}};_0x220474(++_0x2806de);}(_0xa502,0x186));var _0x2a50=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa502[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x2a50('0x0'));var moment=require('moment');var BPromise=require(_0x2a50('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a50('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a50('0x3'));var logger=require('../../config/logger')(_0x2a50('0x4'));var config=require('../../config/environment');var jayson=require(_0x2a50('0x5'));var client=jayson['client'][_0x2a50('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5b8da8,_0x4f41ee,_0x5e075a){return new BPromise(function(_0x579b74,_0xed8fd4){return client[_0x2a50('0x7')](_0x5b8da8,_0x5e075a)[_0x2a50('0x8')](function(_0x5e5caf){logger[_0x2a50('0x9')](_0x2a50('0xa'),_0x4f41ee,_0x2a50('0xb'));logger[_0x2a50('0xc')](_0x2a50('0xd'),_0x4f41ee,_0x2a50('0xb'),JSON[_0x2a50('0xe')](_0x5e5caf));if(_0x5e5caf[_0x2a50('0xf')]){if(_0x5e5caf[_0x2a50('0xf')][_0x2a50('0x10')]===0x1f4){logger[_0x2a50('0xf')](_0x2a50('0xa'),_0x4f41ee,_0x5e5caf[_0x2a50('0xf')][_0x2a50('0x11')]);return _0xed8fd4(_0x5e5caf[_0x2a50('0xf')][_0x2a50('0x11')]);}logger[_0x2a50('0xf')](_0x2a50('0xa'),_0x4f41ee,_0x5e5caf[_0x2a50('0xf')][_0x2a50('0x11')]);return _0x579b74(_0x5e5caf['error']['message']);}else{logger[_0x2a50('0x9')]('Condition,\x20%s,\x20%s',_0x4f41ee,'request\x20sent');_0x579b74(_0x5e5caf[_0x2a50('0x12')][_0x2a50('0x11')]);}})['catch'](function(_0xff7e96){logger[_0x2a50('0xf')](_0x2a50('0xa'),_0x4f41ee,_0xff7e96);_0xed8fd4(_0xff7e96);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2899af7..6b6eb5a 100644 --- a/server/api/condition/index.js +++ b/server/api/condition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4366=['../../components/interaction/service','../../config/environment','put','/:id','update','isAuthenticated','exports','util','connect-timeout','Router'];(function(_0x125627,_0xeb054d){var _0x209280=function(_0x43c937){while(--_0x43c937){_0x125627['push'](_0x125627['shift']());}};_0x209280(++_0xeb054d);}(_0x4366,0xbb));var _0x6436=function(_0x1c49fe,_0x1b476f){_0x1c49fe=_0x1c49fe-0x0;var _0x4a9ac1=_0x4366[_0x1c49fe];return _0x4a9ac1;};'use strict';var multer=require('multer');var util=require(_0x6436('0x0'));var path=require('path');var timeout=require(_0x6436('0x1'));var express=require('express');var router=express[_0x6436('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x6436('0x3'));var config=require(_0x6436('0x4'));var controller=require('./condition.controller');router[_0x6436('0x5')](_0x6436('0x6'),auth['isAuthenticated'](),controller[_0x6436('0x7')]);router['delete']('/:id',auth[_0x6436('0x8')](),controller['destroy']);module[_0x6436('0x9')]=router; \ No newline at end of file +var _0xc1bd=['../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','multer','connect-timeout','express'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xc1bd,0x18d));var _0xdc1b=function(_0x4e752e,_0x479543){_0x4e752e=_0x4e752e-0x0;var _0x2392b0=_0xc1bd[_0x4e752e];return _0x2392b0;};'use strict';var multer=require(_0xdc1b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdc1b('0x1'));var express=require(_0xdc1b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdc1b('0x3'));var config=require(_0xdc1b('0x4'));var controller=require(_0xdc1b('0x5'));router[_0xdc1b('0x6')]('/:id',auth[_0xdc1b('0x7')](),controller[_0xdc1b('0x8')]);router[_0xdc1b('0x9')]('/:id',auth[_0xdc1b('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c453797..5dfe167 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce9b=['STRING','name','INTEGER','sequelize','exports'];(function(_0x1d1918,_0x9b060b){var _0x40242b=function(_0x357e6d){while(--_0x357e6d){_0x1d1918['push'](_0x1d1918['shift']());}};_0x40242b(++_0x9b060b);}(_0xce9b,0xc6));var _0xbce9=function(_0x32335d,_0x354c2c){_0x32335d=_0x32335d-0x0;var _0x25ae3d=_0xce9b[_0x32335d];return _0x25ae3d;};'use strict';var Sequelize=require(_0xbce9('0x0'));module[_0xbce9('0x1')]={'name':{'type':Sequelize[_0xbce9('0x2')],'allowNull':![],'unique':_0xbce9('0x3')},'OrderBy':{'type':Sequelize[_0xbce9('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xbce9('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0b78=['INTEGER','sequelize','exports','name'];(function(_0x5aecc9,_0x357513){var _0x5013b3=function(_0x54bcf6){while(--_0x54bcf6){_0x5aecc9['push'](_0x5aecc9['shift']());}};_0x5013b3(++_0x357513);}(_0x0b78,0x1ad));var _0x80b7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0b78[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x80b7('0x0'));module[_0x80b7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x80b7('0x2')},'OrderBy':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 8cec005..94b6323 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x103f=['../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','error','stack','name','send','index','map','ContactItemType','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x103f,0x13e));var _0xf103=function(_0x24077c,_0x50b7ef){_0x24077c=_0x24077c-0x0;var _0x3cfe17=_0x103f[_0x24077c];return _0x3cfe17;};'use strict';var pdf=require(_0xf103('0x0'));var emlformat=require(_0xf103('0x1'));var rimraf=require(_0xf103('0x2'));var zipdir=require(_0xf103('0x3'));var jsonpatch=require(_0xf103('0x4'));var rp=require(_0xf103('0x5'));var moment=require(_0xf103('0x6'));var BPromise=require(_0xf103('0x7'));var Mustache=require(_0xf103('0x8'));var util=require(_0xf103('0x9'));var path=require('path');var sox=require(_0xf103('0xa'));var csv=require(_0xf103('0xb'));var ejs=require(_0xf103('0xc'));var fs=require('fs');var _=require(_0xf103('0xd'));var squel=require(_0xf103('0xe'));var crypto=require(_0xf103('0xf'));var jsforce=require(_0xf103('0x10'));var deskjs=require(_0xf103('0x11'));var toCsv=require(_0xf103('0xb'));var querystring=require(_0xf103('0x12'));var Papa=require(_0xf103('0x13'));var Redis=require(_0xf103('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf103('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf103('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xf103('0x17'));var config=require(_0xf103('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf103('0x19'))['db'];function respondWithStatusCode(_0x568960,_0x5735d1){_0x5735d1=_0x5735d1||0xcc;return function(_0x4e7ec5){if(_0x4e7ec5){return _0x568960[_0xf103('0x1a')](_0x5735d1);}return _0x568960['status'](_0x5735d1)[_0xf103('0x1b')]();};}function respondWithResult(_0x1e8765,_0x55ec64){_0x55ec64=_0x55ec64||0xc8;return function(_0x189a41){if(_0x189a41){return _0x1e8765[_0xf103('0x1c')](_0x55ec64)['json'](_0x189a41);}};}function respondWithFilteredResult(_0x1de2a8,_0x299ddf){return function(_0x5bf405){if(_0x5bf405){var _0x13be78=_0x5bf405[_0xf103('0x1d')],_0x49d07f=_0x299ddf[_0xf103('0x1e')],_0x4a1a87=_0x299ddf[_0xf103('0x1e')]+_0x299ddf[_0xf103('0x1f')],_0x1900fc;if(_0x4a1a87>=_0x13be78){_0x4a1a87=_0x13be78;_0x1900fc=0xc8;}else{_0x1900fc=0xce;}_0x1de2a8[_0xf103('0x1c')](_0x1900fc);return _0x1de2a8['set'](_0xf103('0x20'),_0x49d07f+'-'+_0x4a1a87+'/'+_0x13be78)[_0xf103('0x21')](_0x5bf405);}return null;};}function patchUpdates(_0x567e48){return function(_0x21ea69){try{jsonpatch[_0xf103('0x22')](_0x21ea69,_0x567e48,!![]);}catch(_0x280aeb){return BPromise[_0xf103('0x23')](_0x280aeb);}return _0x21ea69[_0xf103('0x24')]();};}function saveUpdates(_0x5d28e9,_0x32aaa5){return function(_0x34a95f){if(_0x34a95f){return _0x34a95f[_0xf103('0x25')](_0x5d28e9)[_0xf103('0x26')](function(_0x3fd57d){return _0x3fd57d;});}return null;};}function removeEntity(_0x319c49,_0x3607ce){return function(_0x111e83){if(_0x111e83){return _0x111e83['destroy']()[_0xf103('0x26')](function(){var _0x4fab08=_0x111e83[_0xf103('0x27')]({'plain':!![]});var _0x4d1752=_0xf103('0x28');return db[_0xf103('0x29')][_0xf103('0x2a')]({'where':{'type':_0x4d1752,'resourceId':_0x4fab08['id']}})[_0xf103('0x26')](function(){return _0x111e83;});})[_0xf103('0x26')](function(){_0x319c49[_0xf103('0x1c')](0xcc)[_0xf103('0x1b')]();});}};}function handleEntityNotFound(_0x259797,_0x4f24bd){return function(_0x2c415a){if(!_0x2c415a){_0x259797['sendStatus'](0x194);}return _0x2c415a;};}function handleError(_0x259fdc,_0x512585){_0x512585=_0x512585||0x1f4;return function(_0x4423a4){logger[_0xf103('0x2b')](_0x4423a4[_0xf103('0x2c')]);if(_0x4423a4[_0xf103('0x2d')]){delete _0x4423a4['name'];}_0x259fdc[_0xf103('0x1c')](_0x512585)[_0xf103('0x2e')](_0x4423a4);};}exports[_0xf103('0x2f')]=function(_0x5a1f81,_0x4adf44){var _0x1b0a13={},_0x7ee263={},_0x543c76={'count':0x0,'rows':[]};var _0x23681a=_[_0xf103('0x30')](db[_0xf103('0x31')][_0xf103('0x32')],function(_0x5becbe){return{'name':_0x5becbe['fieldName'],'type':_0x5becbe['type']['key']};});_0x7ee263[_0xf103('0x33')]=_['map'](_0x23681a,_0xf103('0x2d'));_0x7ee263[_0xf103('0x34')]=_[_0xf103('0x35')](_0x5a1f81['query']);_0x7ee263['filters']=_[_0xf103('0x36')](_0x7ee263[_0xf103('0x33')],_0x7ee263['query']);_0x1b0a13[_0xf103('0x37')]=_[_0xf103('0x36')](_0x7ee263[_0xf103('0x33')],qs[_0xf103('0x38')](_0x5a1f81[_0xf103('0x34')][_0xf103('0x38')]));_0x1b0a13[_0xf103('0x37')]=_0x1b0a13[_0xf103('0x37')][_0xf103('0x39')]?_0x1b0a13[_0xf103('0x37')]:_0x7ee263[_0xf103('0x33')];if(!_0x5a1f81[_0xf103('0x34')][_0xf103('0x3a')](_0xf103('0x3b'))){_0x1b0a13[_0xf103('0x1f')]=qs[_0xf103('0x1f')](_0x5a1f81[_0xf103('0x34')]['limit']);_0x1b0a13[_0xf103('0x1e')]=qs[_0xf103('0x1e')](_0x5a1f81[_0xf103('0x34')]['offset']);}_0x1b0a13[_0xf103('0x3c')]=qs['sort'](_0x5a1f81['query'][_0xf103('0x3d')]);_0x1b0a13[_0xf103('0x3e')]=qs[_0xf103('0x3f')](_[_0xf103('0x40')](_0x5a1f81[_0xf103('0x34')],_0x7ee263[_0xf103('0x3f')]),_0x23681a);if(_0x5a1f81[_0xf103('0x34')][_0xf103('0x41')]){_0x1b0a13[_0xf103('0x3e')]=_['merge'](_0x1b0a13[_0xf103('0x3e')],{'$or':_[_0xf103('0x30')](_0x23681a,function(_0x474854){if(_0x474854['type']!==_0xf103('0x42')){var _0x1a30a5={};_0x1a30a5[_0x474854[_0xf103('0x2d')]]={'$like':'%'+_0x5a1f81['query'][_0xf103('0x41')]+'%'};return _0x1a30a5;}})});}_0x1b0a13=_[_0xf103('0x43')]({},_0x1b0a13,_0x5a1f81[_0xf103('0x44')]);var _0x113013={'where':_0x1b0a13[_0xf103('0x3e')]};return db['ContactItemType']['count'](_0x113013)[_0xf103('0x26')](function(_0x19df20){_0x543c76[_0xf103('0x1d')]=_0x19df20;if(_0x5a1f81[_0xf103('0x34')][_0xf103('0x45')]){_0x1b0a13[_0xf103('0x46')]=[{'all':!![]}];}return db[_0xf103('0x31')][_0xf103('0x47')](_0x1b0a13);})[_0xf103('0x26')](function(_0x3de900){_0x543c76[_0xf103('0x48')]=_0x3de900;return _0x543c76;})[_0xf103('0x26')](respondWithFilteredResult(_0x4adf44,_0x1b0a13))[_0xf103('0x49')](handleError(_0x4adf44,null));};exports[_0xf103('0x4a')]=function(_0x434a3a,_0x16ed02){var _0x319aae={'raw':!![],'where':{'id':_0x434a3a['params']['id']}},_0x52238e={};_0x52238e[_0xf103('0x33')]=_[_0xf103('0x35')](db['ContactItemType'][_0xf103('0x32')]);_0x52238e[_0xf103('0x34')]=_[_0xf103('0x35')](_0x434a3a[_0xf103('0x34')]);_0x52238e[_0xf103('0x3f')]=_['intersection'](_0x52238e[_0xf103('0x33')],_0x52238e[_0xf103('0x34')]);_0x319aae['attributes']=_[_0xf103('0x36')](_0x52238e[_0xf103('0x33')],qs[_0xf103('0x38')](_0x434a3a[_0xf103('0x34')][_0xf103('0x38')]));_0x319aae['attributes']=_0x319aae['attributes']['length']?_0x319aae['attributes']:_0x52238e[_0xf103('0x33')];if(_0x434a3a[_0xf103('0x34')][_0xf103('0x45')]){_0x319aae[_0xf103('0x46')]=[{'all':!![]}];}_0x319aae=_[_0xf103('0x43')]({},_0x319aae,_0x434a3a[_0xf103('0x44')]);return db[_0xf103('0x31')][_0xf103('0x4b')](_0x319aae)[_0xf103('0x26')](handleEntityNotFound(_0x16ed02,null))[_0xf103('0x26')](respondWithResult(_0x16ed02,null))[_0xf103('0x49')](handleError(_0x16ed02,null));};exports[_0xf103('0x4c')]=function(_0x1e8121,_0x494372){return db[_0xf103('0x31')][_0xf103('0x4c')](_0x1e8121['body'],{})[_0xf103('0x26')](function(_0x5209ac){var _0x382217=_0x1e8121[_0xf103('0x4d')][_0xf103('0x27')]({'plain':!![]});if(!_0x382217)throw new Error(_0xf103('0x4e'));if(_0x382217[_0xf103('0x4f')]==='user'){var _0xc0f6b6=_0x5209ac['get']({'plain':!![]});var _0x341f55=_0xf103('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x341f55,'userProfileId':_0x382217[_0xf103('0x50')]},'raw':!![]})[_0xf103('0x26')](function(_0x3ed7c2){if(_0x3ed7c2&&_0x3ed7c2[_0xf103('0x51')]===0x0){return db[_0xf103('0x29')]['create']({'name':_0xc0f6b6[_0xf103('0x2d')],'resourceId':_0xc0f6b6['id'],'type':_0x3ed7c2[_0xf103('0x2d')],'sectionId':_0x3ed7c2['id']},{})['then'](function(){return _0x5209ac;});}else{return _0x5209ac;}})[_0xf103('0x49')](function(_0x2a0e12){logger[_0xf103('0x2b')](_0xf103('0x52'),_0x2a0e12);throw _0x2a0e12;});}return _0x5209ac;})[_0xf103('0x26')](respondWithResult(_0x494372,0xc9))['catch'](handleError(_0x494372,null));};exports[_0xf103('0x25')]=function(_0xa1de13,_0x2eae0c){if(_0xa1de13[_0xf103('0x53')]['id']){delete _0xa1de13[_0xf103('0x53')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0xa1de13[_0xf103('0x54')]['id']}})[_0xf103('0x26')](handleEntityNotFound(_0x2eae0c,null))[_0xf103('0x26')](saveUpdates(_0xa1de13[_0xf103('0x53')],null))[_0xf103('0x26')](respondWithResult(_0x2eae0c,null))[_0xf103('0x49')](handleError(_0x2eae0c,null));};exports['destroy']=function(_0x5b3403,_0xc73f35){return db[_0xf103('0x31')][_0xf103('0x4b')]({'where':{'id':_0x5b3403[_0xf103('0x54')]['id']}})[_0xf103('0x26')](handleEntityNotFound(_0xc73f35,null))[_0xf103('0x26')](removeEntity(_0xc73f35,null))[_0xf103('0x49')](handleError(_0xc73f35,null));}; \ No newline at end of file +var _0xb96d=['error','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','keys','query','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ContactItemType','findAll','rows','show','params','filters','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation'];(function(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_0xb96d,0x9e));var _0xdb96=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xb96d[_0x2ec2bf];return _0x2c279c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdb96('0x0'));var rimraf=require(_0xdb96('0x1'));var zipdir=require(_0xdb96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb96('0x3'));var moment=require(_0xdb96('0x4'));var BPromise=require(_0xdb96('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb96('0x6'));var sox=require(_0xdb96('0x7'));var csv=require(_0xdb96('0x8'));var ejs=require(_0xdb96('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdb96('0xa'));var crypto=require(_0xdb96('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdb96('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdb96('0xd'));var Papa=require(_0xdb96('0xe'));var Redis=require('ioredis');var authService=require(_0xdb96('0xf'));var qs=require(_0xdb96('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb96('0x11'));var logger=require(_0xdb96('0x12'))(_0xdb96('0x13'));var utils=require(_0xdb96('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdb96('0x15'));var db=require(_0xdb96('0x16'))['db'];function respondWithStatusCode(_0x33e478,_0x5a004c){_0x5a004c=_0x5a004c||0xcc;return function(_0x3afec0){if(_0x3afec0){return _0x33e478[_0xdb96('0x17')](_0x5a004c);}return _0x33e478[_0xdb96('0x18')](_0x5a004c)[_0xdb96('0x19')]();};}function respondWithResult(_0x359970,_0xf88086){_0xf88086=_0xf88086||0xc8;return function(_0x2b3c32){if(_0x2b3c32){return _0x359970[_0xdb96('0x18')](_0xf88086)[_0xdb96('0x1a')](_0x2b3c32);}};}function respondWithFilteredResult(_0x745780,_0xb95f96){return function(_0x94bbc3){if(_0x94bbc3){var _0x190b52=_0x94bbc3[_0xdb96('0x1b')],_0x596673=_0xb95f96[_0xdb96('0x1c')],_0x3a94da=_0xb95f96['offset']+_0xb95f96[_0xdb96('0x1d')],_0x2a766e;if(_0x3a94da>=_0x190b52){_0x3a94da=_0x190b52;_0x2a766e=0xc8;}else{_0x2a766e=0xce;}_0x745780[_0xdb96('0x18')](_0x2a766e);return _0x745780[_0xdb96('0x1e')]('Content-Range',_0x596673+'-'+_0x3a94da+'/'+_0x190b52)['json'](_0x94bbc3);}return null;};}function patchUpdates(_0x16f863){return function(_0x51ab35){try{jsonpatch['apply'](_0x51ab35,_0x16f863,!![]);}catch(_0x2013e4){return BPromise[_0xdb96('0x1f')](_0x2013e4);}return _0x51ab35[_0xdb96('0x20')]();};}function saveUpdates(_0x11b7bd,_0x518a91){return function(_0x6c3170){if(_0x6c3170){return _0x6c3170['update'](_0x11b7bd)[_0xdb96('0x21')](function(_0x467a5d){return _0x467a5d;});}return null;};}function removeEntity(_0x4ddf48,_0x111673){return function(_0x29f0d4){if(_0x29f0d4){return _0x29f0d4[_0xdb96('0x22')]()[_0xdb96('0x21')](function(){var _0x1a5b88=_0x29f0d4[_0xdb96('0x23')]({'plain':!![]});var _0x25834a='ContactItemTypes';return db[_0xdb96('0x24')][_0xdb96('0x22')]({'where':{'type':_0x25834a,'resourceId':_0x1a5b88['id']}})[_0xdb96('0x21')](function(){return _0x29f0d4;});})['then'](function(){_0x4ddf48[_0xdb96('0x18')](0xcc)[_0xdb96('0x19')]();});}};}function handleEntityNotFound(_0x169425,_0x41eb65){return function(_0x2663c4){if(!_0x2663c4){_0x169425[_0xdb96('0x17')](0x194);}return _0x2663c4;};}function handleError(_0x1ef903,_0x42365){_0x42365=_0x42365||0x1f4;return function(_0xfa9833){logger['error'](_0xfa9833[_0xdb96('0x25')]);if(_0xfa9833[_0xdb96('0x26')]){delete _0xfa9833['name'];}_0x1ef903[_0xdb96('0x18')](_0x42365)[_0xdb96('0x27')](_0xfa9833);};}exports['index']=function(_0x32eabc,_0x118a43){var _0x33e7bb={},_0x1317b8={},_0x346ce2={'count':0x0,'rows':[]};var _0xb54f12=_[_0xdb96('0x28')](db['ContactItemType'][_0xdb96('0x29')],function(_0xe1f111){return{'name':_0xe1f111[_0xdb96('0x2a')],'type':_0xe1f111[_0xdb96('0x2b')]['key']};});_0x1317b8['model']=_[_0xdb96('0x28')](_0xb54f12,_0xdb96('0x26'));_0x1317b8['query']=_[_0xdb96('0x2c')](_0x32eabc['query']);_0x1317b8['filters']=_['intersection'](_0x1317b8['model'],_0x1317b8[_0xdb96('0x2d')]);_0x33e7bb['attributes']=_['intersection'](_0x1317b8[_0xdb96('0x2e')],qs[_0xdb96('0x2f')](_0x32eabc[_0xdb96('0x2d')][_0xdb96('0x2f')]));_0x33e7bb['attributes']=_0x33e7bb[_0xdb96('0x30')][_0xdb96('0x31')]?_0x33e7bb[_0xdb96('0x30')]:_0x1317b8[_0xdb96('0x2e')];if(!_0x32eabc[_0xdb96('0x2d')]['hasOwnProperty'](_0xdb96('0x32'))){_0x33e7bb[_0xdb96('0x1d')]=qs[_0xdb96('0x1d')](_0x32eabc[_0xdb96('0x2d')][_0xdb96('0x1d')]);_0x33e7bb[_0xdb96('0x1c')]=qs[_0xdb96('0x1c')](_0x32eabc['query']['offset']);}_0x33e7bb['order']=qs[_0xdb96('0x33')](_0x32eabc[_0xdb96('0x2d')][_0xdb96('0x33')]);_0x33e7bb[_0xdb96('0x34')]=qs['filters'](_[_0xdb96('0x35')](_0x32eabc['query'],_0x1317b8['filters']),_0xb54f12);if(_0x32eabc[_0xdb96('0x2d')][_0xdb96('0x36')]){_0x33e7bb[_0xdb96('0x34')]=_[_0xdb96('0x37')](_0x33e7bb['where'],{'$or':_[_0xdb96('0x28')](_0xb54f12,function(_0xa69018){if(_0xa69018[_0xdb96('0x2b')]!==_0xdb96('0x38')){var _0x1b18b5={};_0x1b18b5[_0xa69018['name']]={'$like':'%'+_0x32eabc[_0xdb96('0x2d')]['filter']+'%'};return _0x1b18b5;}})});}_0x33e7bb=_[_0xdb96('0x37')]({},_0x33e7bb,_0x32eabc[_0xdb96('0x39')]);var _0x34c9c3={'where':_0x33e7bb[_0xdb96('0x34')]};return db[_0xdb96('0x3a')]['count'](_0x34c9c3)[_0xdb96('0x21')](function(_0x4da5b2){_0x346ce2[_0xdb96('0x1b')]=_0x4da5b2;if(_0x32eabc[_0xdb96('0x2d')]['includeAll']){_0x33e7bb['include']=[{'all':!![]}];}return db[_0xdb96('0x3a')][_0xdb96('0x3b')](_0x33e7bb);})[_0xdb96('0x21')](function(_0x4501f1){_0x346ce2[_0xdb96('0x3c')]=_0x4501f1;return _0x346ce2;})[_0xdb96('0x21')](respondWithFilteredResult(_0x118a43,_0x33e7bb))['catch'](handleError(_0x118a43,null));};exports[_0xdb96('0x3d')]=function(_0x5266d5,_0x2a93ca){var _0x58635d={'raw':!![],'where':{'id':_0x5266d5[_0xdb96('0x3e')]['id']}},_0x5466e1={};_0x5466e1['model']=_['keys'](db['ContactItemType']['rawAttributes']);_0x5466e1[_0xdb96('0x2d')]=_[_0xdb96('0x2c')](_0x5266d5['query']);_0x5466e1[_0xdb96('0x3f')]=_[_0xdb96('0x40')](_0x5466e1[_0xdb96('0x2e')],_0x5466e1['query']);_0x58635d[_0xdb96('0x30')]=_[_0xdb96('0x40')](_0x5466e1['model'],qs[_0xdb96('0x2f')](_0x5266d5[_0xdb96('0x2d')][_0xdb96('0x2f')]));_0x58635d['attributes']=_0x58635d[_0xdb96('0x30')][_0xdb96('0x31')]?_0x58635d[_0xdb96('0x30')]:_0x5466e1['model'];if(_0x5266d5[_0xdb96('0x2d')]['includeAll']){_0x58635d[_0xdb96('0x41')]=[{'all':!![]}];}_0x58635d=_[_0xdb96('0x37')]({},_0x58635d,_0x5266d5[_0xdb96('0x39')]);return db['ContactItemType'][_0xdb96('0x42')](_0x58635d)['then'](handleEntityNotFound(_0x2a93ca,null))[_0xdb96('0x21')](respondWithResult(_0x2a93ca,null))['catch'](handleError(_0x2a93ca,null));};exports['create']=function(_0x593dfe,_0x327a92){return db[_0xdb96('0x3a')][_0xdb96('0x43')](_0x593dfe[_0xdb96('0x44')],{})[_0xdb96('0x21')](function(_0xf90551){var _0xb6725c=_0x593dfe[_0xdb96('0x45')][_0xdb96('0x23')]({'plain':!![]});if(!_0xb6725c)throw new Error(_0xdb96('0x46'));if(_0xb6725c[_0xdb96('0x47')]==='user'){var _0x3be97e=_0xf90551[_0xdb96('0x23')]({'plain':!![]});var _0x175688=_0xdb96('0x48');return db[_0xdb96('0x49')][_0xdb96('0x42')]({'where':{'name':_0x175688,'userProfileId':_0xb6725c[_0xdb96('0x4a')]},'raw':!![]})['then'](function(_0x550f43){if(_0x550f43&&_0x550f43[_0xdb96('0x4b')]===0x0){return db[_0xdb96('0x24')][_0xdb96('0x43')]({'name':_0x3be97e[_0xdb96('0x26')],'resourceId':_0x3be97e['id'],'type':_0x550f43[_0xdb96('0x26')],'sectionId':_0x550f43['id']},{})[_0xdb96('0x21')](function(){return _0xf90551;});}else{return _0xf90551;}})['catch'](function(_0x1e49dd){logger[_0xdb96('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e49dd);throw _0x1e49dd;});}return _0xf90551;})[_0xdb96('0x21')](respondWithResult(_0x327a92,0xc9))['catch'](handleError(_0x327a92,null));};exports['update']=function(_0x53a951,_0x348d89){if(_0x53a951['body']['id']){delete _0x53a951[_0xdb96('0x44')]['id'];}return db['ContactItemType'][_0xdb96('0x42')]({'where':{'id':_0x53a951[_0xdb96('0x3e')]['id']}})[_0xdb96('0x21')](handleEntityNotFound(_0x348d89,null))[_0xdb96('0x21')](saveUpdates(_0x53a951[_0xdb96('0x44')],null))[_0xdb96('0x21')](respondWithResult(_0x348d89,null))[_0xdb96('0x4d')](handleError(_0x348d89,null));};exports[_0xdb96('0x22')]=function(_0x14b38d,_0x5181c9){return db[_0xdb96('0x3a')][_0xdb96('0x42')]({'where':{'id':_0x14b38d[_0xdb96('0x3e')]['id']}})[_0xdb96('0x21')](handleEntityNotFound(_0x5181c9,null))[_0xdb96('0x21')](removeEntity(_0x5181c9,null))[_0xdb96('0x4d')](handleError(_0x5181c9,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 1318f9f..63ce18c 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd05=['../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','moment','bluebird','request-promise','path'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xcd05,0x163));var _0x5cd0=function(_0x4d521e,_0x58ba39){_0x4d521e=_0x4d521e-0x0;var _0x3beb42=_0xcd05[_0x4d521e];return _0x3beb42;};'use strict';var _=require(_0x5cd0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5cd0('0x1'));var BPromise=require(_0x5cd0('0x2'));var rp=require(_0x5cd0('0x3'));var fs=require('fs');var path=require(_0x5cd0('0x4'));var rimraf=require('rimraf');var config=require(_0x5cd0('0x5'));var attributes=require(_0x5cd0('0x6'));module['exports']=function(_0x47c141,_0x4eea17){return _0x47c141[_0x5cd0('0x7')](_0x5cd0('0x8'),attributes,{'tableName':_0x5cd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x322e76,_0x1dc92b){var _0xd8144f=function(_0x55a8ff){while(--_0x55a8ff){_0x322e76['push'](_0x322e76['shift']());}};_0xd8144f(++_0x1dc92b);}(_0xb138,0x1dd));var _0x8b13=function(_0x353751,_0x24d599){_0x353751=_0x353751-0x0;var _0x316f24=_0xb138[_0x353751];return _0x316f24;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index e7d6ffc..7d49029 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe87e=['code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','error'];(function(_0x4ede04,_0x58132b){var _0x49ccfc=function(_0x51a704){while(--_0x51a704){_0x4ede04['push'](_0x4ede04['shift']());}};_0x49ccfc(++_0x58132b);}(_0xe87e,0x17d));var _0xee87=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xe87e[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xee87('0x0'));var util=require(_0xee87('0x1'));var moment=require(_0xee87('0x2'));var BPromise=require(_0xee87('0x3'));var rs=require(_0xee87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee87('0x5'))['db'];var utils=require(_0xee87('0x6'));var logger=require(_0xee87('0x7'))(_0xee87('0x8'));var config=require(_0xee87('0x9'));var jayson=require(_0xee87('0xa'));var client=jayson[_0xee87('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x589c36,_0x2bde4c,_0x2ee165){return new BPromise(function(_0x2fda67,_0x71d659){return client[_0xee87('0xc')](_0x589c36,_0x2ee165)['then'](function(_0x2ed8e9){logger[_0xee87('0xd')](_0xee87('0xe'),_0x2bde4c,_0xee87('0xf'));logger['debug'](_0xee87('0x10'),_0x2bde4c,_0xee87('0xf'),JSON['stringify'](_0x2ed8e9));if(_0x2ed8e9[_0xee87('0x11')]){if(_0x2ed8e9[_0xee87('0x11')][_0xee87('0x12')]===0x1f4){logger[_0xee87('0x11')](_0xee87('0xe'),_0x2bde4c,_0x2ed8e9[_0xee87('0x11')][_0xee87('0x13')]);return _0x71d659(_0x2ed8e9[_0xee87('0x11')]['message']);}logger[_0xee87('0x11')](_0xee87('0xe'),_0x2bde4c,_0x2ed8e9['error']['message']);return _0x2fda67(_0x2ed8e9[_0xee87('0x11')][_0xee87('0x13')]);}else{logger['info'](_0xee87('0xe'),_0x2bde4c,_0xee87('0xf'));_0x2fda67(_0x2ed8e9[_0xee87('0x14')][_0xee87('0x13')]);}})['catch'](function(_0x290968){logger['error'](_0xee87('0xe'),_0x2bde4c,_0x290968);_0x71d659(_0x290968);});});} \ No newline at end of file +var _0xd737=['lodash','moment','randomstring','ioredis','../../mysqldb','rpc','client','http','request','info','ContactItemType,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd737,0x85));var _0x7d73=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xd737[_0x503950];return _0x1657a9;};'use strict';var _=require(_0x7d73('0x0'));var util=require('util');var moment=require(_0x7d73('0x1'));var BPromise=require('bluebird');var rs=require(_0x7d73('0x2'));var fs=require('fs');var Redis=require(_0x7d73('0x3'));var db=require(_0x7d73('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d73('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d73('0x6')][_0x7d73('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x70a9f1,_0x1bd2f4,_0x10dec9){return new BPromise(function(_0x4552e3,_0x3e100b){return client[_0x7d73('0x8')](_0x70a9f1,_0x10dec9)['then'](function(_0x57fbe4){logger[_0x7d73('0x9')](_0x7d73('0xa'),_0x1bd2f4,'request\x20sent');logger[_0x7d73('0xb')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1bd2f4,_0x7d73('0xc'),JSON[_0x7d73('0xd')](_0x57fbe4));if(_0x57fbe4[_0x7d73('0xe')]){if(_0x57fbe4['error'][_0x7d73('0xf')]===0x1f4){logger[_0x7d73('0xe')]('ContactItemType,\x20%s,\x20%s',_0x1bd2f4,_0x57fbe4[_0x7d73('0xe')][_0x7d73('0x10')]);return _0x3e100b(_0x57fbe4[_0x7d73('0xe')][_0x7d73('0x10')]);}logger['error'](_0x7d73('0xa'),_0x1bd2f4,_0x57fbe4['error']['message']);return _0x4552e3(_0x57fbe4[_0x7d73('0xe')][_0x7d73('0x10')]);}else{logger[_0x7d73('0x9')]('ContactItemType,\x20%s,\x20%s',_0x1bd2f4,_0x7d73('0xc'));_0x4552e3(_0x57fbe4[_0x7d73('0x11')][_0x7d73('0x10')]);}})[_0x7d73('0x12')](function(_0x113598){logger[_0x7d73('0xe')](_0x7d73('0xa'),_0x1bd2f4,_0x113598);_0x3e100b(_0x113598);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index bb2d0d9..64ecf81 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e70=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x580889,_0x331503){var _0x1d802e=function(_0x336bbb){while(--_0x336bbb){_0x580889['push'](_0x580889['shift']());}};_0x1d802e(++_0x331503);}(_0x2e70,0x77));var _0x02e7=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x2e70[_0x424a9a];return _0xa7831c;};'use strict';var multer=require(_0x02e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x02e7('0x1'));var express=require('express');var router=express[_0x02e7('0x2')]();var auth=require(_0x02e7('0x3'));var interaction=require(_0x02e7('0x4'));var config=require(_0x02e7('0x5'));var controller=require('./contactItemType.controller');router[_0x02e7('0x6')]('/',auth[_0x02e7('0x7')](),controller[_0x02e7('0x8')]);router[_0x02e7('0x6')](_0x02e7('0x9'),auth[_0x02e7('0x7')](),controller[_0x02e7('0xa')]);router[_0x02e7('0xb')]('/',auth[_0x02e7('0x7')](),controller[_0x02e7('0xc')]);router[_0x02e7('0xd')](_0x02e7('0x9'),auth[_0x02e7('0x7')](),controller[_0x02e7('0xe')]);router[_0x02e7('0xf')]('/:id',auth[_0x02e7('0x7')](),controller[_0x02e7('0x10')]);module[_0x02e7('0x11')]=router; \ No newline at end of file +var _0x277b=['express','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x277b,0x1a6));var _0xb277=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x277b[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xb277('0x0'));var util=require(_0xb277('0x1'));var path=require('path');var timeout=require(_0xb277('0x2'));var express=require(_0xb277('0x3'));var router=express['Router']();var auth=require(_0xb277('0x4'));var interaction=require(_0xb277('0x5'));var config=require('../../config/environment');var controller=require(_0xb277('0x6'));router[_0xb277('0x7')]('/',auth[_0xb277('0x8')](),controller['index']);router[_0xb277('0x7')](_0xb277('0x9'),auth[_0xb277('0x8')](),controller[_0xb277('0xa')]);router[_0xb277('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb277('0xc')](_0xb277('0x9'),auth[_0xb277('0x8')](),controller[_0xb277('0xd')]);router[_0xb277('0xe')](_0xb277('0x9'),auth[_0xb277('0x8')](),controller[_0xb277('0xf')]);module[_0xb277('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 3b3f6b0..771d634 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa5d=['sequelize','STRING'];(function(_0x175d1e,_0x48ad7e){var _0x10aefc=function(_0x508d26){while(--_0x508d26){_0x175d1e['push'](_0x175d1e['shift']());}};_0x10aefc(++_0x48ad7e);}(_0xfa5d,0x19e));var _0xdfa5=function(_0x21b207,_0x207d6e){_0x21b207=_0x21b207-0x0;var _0x5b9f9a=_0xfa5d[_0x21b207];return _0x5b9f9a;};'use strict';var Sequelize=require(_0xdfa5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xdfa5('0x1')]}}; \ No newline at end of file +var _0xd4f4=['sequelize','name','STRING'];(function(_0x2c0319,_0x615db7){var _0x568847=function(_0x5c6c72){while(--_0x5c6c72){_0x2c0319['push'](_0x2c0319['shift']());}};_0x568847(++_0x615db7);}(_0xd4f4,0x1bc));var _0x4d4f=function(_0x437860,_0x1989c7){_0x437860=_0x437860-0x0;var _0x59509f=_0xd4f4[_0x437860];return _0x59509f;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4d4f('0x1')},'description':{'type':Sequelize[_0x4d4f('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 75c843f..aecec75 100644 --- a/server/api/dashboard/dashboard.controller.js +++ b/server/api/dashboard/dashboard.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf63f=['rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','find','catch','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrMetric','total','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','sort','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','json','count','offset','limit','set','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','index','map','Dashboard'];(function(_0x378ebf,_0x245764){var _0x268d1e=function(_0x38e7d4){while(--_0x38e7d4){_0x378ebf['push'](_0x378ebf['shift']());}};_0x268d1e(++_0x245764);}(_0xf63f,0x1c3));var _0xff63=function(_0x4aaa3c,_0x2cb6fc){_0x4aaa3c=_0x4aaa3c-0x0;var _0x15e2f8=_0xf63f[_0x4aaa3c];return _0x15e2f8;};'use strict';var pdf=require(_0xff63('0x0'));var emlformat=require(_0xff63('0x1'));var rimraf=require(_0xff63('0x2'));var zipdir=require(_0xff63('0x3'));var jsonpatch=require(_0xff63('0x4'));var rp=require(_0xff63('0x5'));var moment=require(_0xff63('0x6'));var BPromise=require(_0xff63('0x7'));var Mustache=require(_0xff63('0x8'));var util=require('util');var path=require(_0xff63('0x9'));var sox=require(_0xff63('0xa'));var csv=require(_0xff63('0xb'));var ejs=require(_0xff63('0xc'));var fs=require('fs');var _=require(_0xff63('0xd'));var squel=require(_0xff63('0xe'));var crypto=require(_0xff63('0xf'));var jsforce=require(_0xff63('0x10'));var deskjs=require(_0xff63('0x11'));var toCsv=require(_0xff63('0xb'));var querystring=require('querystring');var Papa=require(_0xff63('0x12'));var Redis=require('ioredis');var authService=require(_0xff63('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xff63('0x14'));var hardwareService=require(_0xff63('0x15'));var logger=require(_0xff63('0x16'))(_0xff63('0x17'));var utils=require('../../config/utils');var config=require(_0xff63('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xff63('0x19'))['db'];config[_0xff63('0x1a')]=_[_0xff63('0x1b')](config['redis'],{'host':_0xff63('0x1c'),'port':0x18eb});var socket=require(_0xff63('0x1d'))(new Redis(config[_0xff63('0x1a')]));require(_0xff63('0x1e'))[_0xff63('0x1f')](socket);function respondWithStatusCode(_0x40c84f,_0x7ed4bc){_0x7ed4bc=_0x7ed4bc||0xcc;return function(_0x87cb4c){if(_0x87cb4c){return _0x40c84f['sendStatus'](_0x7ed4bc);}return _0x40c84f[_0xff63('0x20')](_0x7ed4bc)['end']();};}function respondWithResult(_0x591d61,_0x2db62f){_0x2db62f=_0x2db62f||0xc8;return function(_0x2ca4d4){if(_0x2ca4d4){return _0x591d61[_0xff63('0x20')](_0x2db62f)[_0xff63('0x21')](_0x2ca4d4);}};}function respondWithFilteredResult(_0x17d0be,_0x14ffee){return function(_0x185588){if(_0x185588){var _0xa568ea=_0x185588[_0xff63('0x22')],_0x107183=_0x14ffee[_0xff63('0x23')],_0x338142=_0x14ffee[_0xff63('0x23')]+_0x14ffee[_0xff63('0x24')],_0x47627d;if(_0x338142>=_0xa568ea){_0x338142=_0xa568ea;_0x47627d=0xc8;}else{_0x47627d=0xce;}_0x17d0be[_0xff63('0x20')](_0x47627d);return _0x17d0be[_0xff63('0x25')]('Content-Range',_0x107183+'-'+_0x338142+'/'+_0xa568ea)[_0xff63('0x21')](_0x185588);}return null;};}function patchUpdates(_0xb74cf){return function(_0x5115c3){try{jsonpatch['apply'](_0x5115c3,_0xb74cf,!![]);}catch(_0x317e48){return BPromise[_0xff63('0x26')](_0x317e48);}return _0x5115c3[_0xff63('0x27')]();};}function saveUpdates(_0x64e676,_0x3d9d2e){return function(_0x27e1b8){if(_0x27e1b8){return _0x27e1b8['update'](_0x64e676)[_0xff63('0x28')](function(_0x12dd0d){return _0x12dd0d;});}return null;};}function removeEntity(_0x1b14ef,_0x5f33f6){return function(_0x555318){if(_0x555318){return _0x555318[_0xff63('0x29')]()[_0xff63('0x28')](function(){var _0x1d6153=_0x555318[_0xff63('0x2a')]({'plain':!![]});var _0x4ef498=_0xff63('0x2b');return db[_0xff63('0x2c')][_0xff63('0x29')]({'where':{'type':_0x4ef498,'resourceId':_0x1d6153['id']}})['then'](function(){return _0x555318;});})[_0xff63('0x28')](function(){_0x1b14ef[_0xff63('0x20')](0xcc)[_0xff63('0x2d')]();});}};}function handleEntityNotFound(_0x54f221,_0x4cd3b7){return function(_0x4576b3){if(!_0x4576b3){_0x54f221['sendStatus'](0x194);}return _0x4576b3;};}function handleError(_0x4dd64b,_0x5cb5ff){_0x5cb5ff=_0x5cb5ff||0x1f4;return function(_0x5f1f64){logger[_0xff63('0x2e')](_0x5f1f64[_0xff63('0x2f')]);if(_0x5f1f64[_0xff63('0x30')]){delete _0x5f1f64[_0xff63('0x30')];}_0x4dd64b[_0xff63('0x20')](_0x5cb5ff)[_0xff63('0x31')](_0x5f1f64);};}exports[_0xff63('0x32')]=function(_0x20772f,_0x371204){var _0x56d720={},_0xaab339={},_0x563cf1={'count':0x0,'rows':[]};var _0x2cf7f7=_[_0xff63('0x33')](db[_0xff63('0x34')][_0xff63('0x35')],function(_0x1ec59f){return{'name':_0x1ec59f[_0xff63('0x36')],'type':_0x1ec59f['type'][_0xff63('0x37')]};});_0xaab339['model']=_['map'](_0x2cf7f7,'name');_0xaab339[_0xff63('0x38')]=_[_0xff63('0x39')](_0x20772f[_0xff63('0x38')]);_0xaab339[_0xff63('0x3a')]=_['intersection'](_0xaab339[_0xff63('0x3b')],_0xaab339[_0xff63('0x38')]);_0x56d720['attributes']=_[_0xff63('0x3c')](_0xaab339[_0xff63('0x3b')],qs[_0xff63('0x3d')](_0x20772f[_0xff63('0x38')][_0xff63('0x3d')]));_0x56d720[_0xff63('0x3e')]=_0x56d720[_0xff63('0x3e')][_0xff63('0x3f')]?_0x56d720['attributes']:_0xaab339[_0xff63('0x3b')];if(!_0x20772f['query'][_0xff63('0x40')](_0xff63('0x41'))){_0x56d720[_0xff63('0x24')]=qs[_0xff63('0x24')](_0x20772f['query'][_0xff63('0x24')]);_0x56d720[_0xff63('0x23')]=qs[_0xff63('0x23')](_0x20772f[_0xff63('0x38')][_0xff63('0x23')]);}_0x56d720[_0xff63('0x42')]=qs['sort'](_0x20772f[_0xff63('0x38')]['sort']);_0x56d720[_0xff63('0x43')]=qs['filters'](_[_0xff63('0x44')](_0x20772f[_0xff63('0x38')],_0xaab339['filters']),_0x2cf7f7);if(_0x20772f['query'][_0xff63('0x45')]){_0x56d720['where']=_[_0xff63('0x46')](_0x56d720[_0xff63('0x43')],{'$or':_[_0xff63('0x33')](_0x2cf7f7,function(_0x1d1271){if(_0x1d1271[_0xff63('0x47')]!==_0xff63('0x48')){var _0x3acbe2={};_0x3acbe2[_0x1d1271[_0xff63('0x30')]]={'$like':'%'+_0x20772f['query'][_0xff63('0x45')]+'%'};return _0x3acbe2;}})});}_0x56d720=_[_0xff63('0x46')]({},_0x56d720,_0x20772f[_0xff63('0x49')]);var _0x1dd082={'where':_0x56d720[_0xff63('0x43')]};return db[_0xff63('0x34')][_0xff63('0x22')](_0x1dd082)['then'](function(_0x28a67f){_0x563cf1[_0xff63('0x22')]=_0x28a67f;if(_0x20772f['query']['includeAll']){_0x56d720[_0xff63('0x4a')]=[{'all':!![]}];}return db[_0xff63('0x34')][_0xff63('0x4b')](_0x56d720);})['then'](function(_0x23d7a7){_0x563cf1[_0xff63('0x4c')]=_0x23d7a7;return _0x563cf1;})[_0xff63('0x28')](respondWithFilteredResult(_0x371204,_0x56d720))['catch'](handleError(_0x371204,null));};exports['show']=function(_0x209a76,_0x13b4a3){var _0x42d0f0={'raw':![],'where':{'id':_0x209a76[_0xff63('0x4d')]['id']}},_0x5860da={};_0x5860da[_0xff63('0x3b')]=_[_0xff63('0x39')](db[_0xff63('0x34')]['rawAttributes']);_0x5860da[_0xff63('0x38')]=_[_0xff63('0x39')](_0x209a76[_0xff63('0x38')]);_0x5860da['filters']=_['intersection'](_0x5860da['model'],_0x5860da[_0xff63('0x38')]);_0x42d0f0[_0xff63('0x3e')]=_[_0xff63('0x3c')](_0x5860da[_0xff63('0x3b')],qs['fields'](_0x209a76[_0xff63('0x38')][_0xff63('0x3d')]));_0x42d0f0['attributes']=_0x42d0f0[_0xff63('0x3e')][_0xff63('0x3f')]?_0x42d0f0[_0xff63('0x3e')]:_0x5860da[_0xff63('0x3b')];if(_0x209a76['query']['includeAll']){_0x42d0f0['include']=[{'all':!![]}];}_0x42d0f0=_[_0xff63('0x46')]({},_0x42d0f0,_0x209a76[_0xff63('0x49')]);return db['Dashboard'][_0xff63('0x4e')](_0x42d0f0)[_0xff63('0x28')](handleEntityNotFound(_0x13b4a3,null))[_0xff63('0x28')](respondWithResult(_0x13b4a3,null))[_0xff63('0x4f')](handleError(_0x13b4a3,null));};exports['create']=function(_0xf587d3,_0x177ccb){return db[_0xff63('0x34')][_0xff63('0x50')](_0xf587d3[_0xff63('0x51')],{})[_0xff63('0x28')](function(_0x5e8166){var _0x2f9727=_0xf587d3[_0xff63('0x52')]['get']({'plain':!![]});if(!_0x2f9727)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f9727[_0xff63('0x53')]==='user'){var _0x583e2f=_0x5e8166[_0xff63('0x2a')]({'plain':!![]});var _0x447d4e='CustomDashboards';return db[_0xff63('0x54')][_0xff63('0x4e')]({'where':{'name':_0x447d4e,'userProfileId':_0x2f9727['userProfileId']},'raw':!![]})[_0xff63('0x28')](function(_0x3e49ec){if(_0x3e49ec&&_0x3e49ec[_0xff63('0x55')]===0x0){return db[_0xff63('0x2c')][_0xff63('0x50')]({'name':_0x583e2f['name'],'resourceId':_0x583e2f['id'],'type':_0x3e49ec[_0xff63('0x30')],'sectionId':_0x3e49ec['id']},{})[_0xff63('0x28')](function(){return _0x5e8166;});}else{return _0x5e8166;}})[_0xff63('0x4f')](function(_0x1e88e9){logger[_0xff63('0x2e')](_0xff63('0x56'),_0x1e88e9);throw _0x1e88e9;});}return _0x5e8166;})[_0xff63('0x28')](respondWithResult(_0x177ccb,0xc9))[_0xff63('0x4f')](handleError(_0x177ccb,null));};exports[_0xff63('0x57')]=function(_0x1b5042,_0x38d5bc){var _0x4cf3ee={'where':{'id':_0x1b5042['params']['id']}},_0x347f36={};_0x347f36['model']=_[_0xff63('0x39')](db['Dashboard'][_0xff63('0x35')]);_0x4cf3ee[_0xff63('0x3e')]=_[_0xff63('0x3c')](_0x347f36[_0xff63('0x3b')],qs[_0xff63('0x3d')](_0x1b5042[_0xff63('0x38')][_0xff63('0x3d')]));_0x4cf3ee['attributes']=_0x4cf3ee['attributes'][_0xff63('0x3f')]?_0x4cf3ee[_0xff63('0x3e')]:_0x347f36[_0xff63('0x3b')];if(_0x1b5042[_0xff63('0x38')][_0xff63('0x58')]){_0x4cf3ee[_0xff63('0x4a')]=[{'all':!![]}];}_0x4cf3ee=_[_0xff63('0x46')]({},_0x4cf3ee,_0x1b5042[_0xff63('0x49')]);return db[_0xff63('0x34')][_0xff63('0x4e')](_0x4cf3ee)[_0xff63('0x28')](handleEntityNotFound(_0x38d5bc,null))['then'](function(_0x35f31f){if(_0x35f31f){var _0x58d90e=_0x35f31f[_0xff63('0x2a')]({'plain':!![]});_0x58d90e=qs[_0xff63('0x59')](_0x58d90e,['id',_0xff63('0x5a'),_0xff63('0x5b')]);_0x1b5042['body']=_['omit'](_0x1b5042['body'],['id',_0xff63('0x5a'),_0xff63('0x5b')]);return db[_0xff63('0x34')]['create'](_[_0xff63('0x46')](_0x58d90e,_0x1b5042[_0xff63('0x51')]),{'include':_0x1b5042[_0xff63('0x38')][_0xff63('0x58')]?[{'all':!![]}]:undefined})[_0xff63('0x28')](function(_0x55fc31){var _0x34b0e9=_0x1b5042[_0xff63('0x52')][_0xff63('0x2a')]({'plain':!![]});if(!_0x34b0e9)throw new Error(_0xff63('0x5c'));if(_0x34b0e9[_0xff63('0x53')]===_0xff63('0x52')){var _0x14bf78=_0x55fc31['get']({'plain':!![]});var _0x59b255='CustomDashboards';return db[_0xff63('0x54')][_0xff63('0x4e')]({'where':{'name':_0x59b255,'userProfileId':_0x34b0e9[_0xff63('0x5d')]},'raw':!![]})[_0xff63('0x28')](function(_0x12378d){if(_0x12378d&&_0x12378d[_0xff63('0x55')]===0x0){return db[_0xff63('0x2c')][_0xff63('0x50')]({'name':_0x14bf78[_0xff63('0x30')],'resourceId':_0x14bf78['id'],'type':_0x12378d['name'],'sectionId':_0x12378d['id']},{})[_0xff63('0x28')](function(){return _0x55fc31;});}else{return _0x55fc31;}})[_0xff63('0x4f')](function(_0x46bcfa){logger[_0xff63('0x2e')](_0xff63('0x56'),_0x46bcfa);throw _0x46bcfa;});}return _0x55fc31;});}})[_0xff63('0x28')](respondWithResult(_0x38d5bc,0xc9))[_0xff63('0x4f')](handleError(_0x38d5bc,null));};exports[_0xff63('0x5e')]=function(_0x14dc34,_0x3f7e8b){if(_0x14dc34[_0xff63('0x51')]['id']){delete _0x14dc34[_0xff63('0x51')]['id'];}return db[_0xff63('0x34')]['find']({'where':{'id':_0x14dc34[_0xff63('0x4d')]['id']}})[_0xff63('0x28')](handleEntityNotFound(_0x3f7e8b,null))[_0xff63('0x28')](saveUpdates(_0x14dc34[_0xff63('0x51')],null))[_0xff63('0x28')](respondWithResult(_0x3f7e8b,null))['catch'](handleError(_0x3f7e8b,null));};exports[_0xff63('0x29')]=function(_0x550a44,_0x24c2d1){return db[_0xff63('0x34')][_0xff63('0x4e')]({'where':{'id':_0x550a44[_0xff63('0x4d')]['id']}})[_0xff63('0x28')](handleEntityNotFound(_0x24c2d1,null))[_0xff63('0x28')](removeEntity(_0x24c2d1,null))[_0xff63('0x4f')](handleError(_0x24c2d1,null));};function widgetAttributes(_0x35477b){try{switch(_0x35477b[_0xff63('0x47')]){case _0xff63('0x5f'):return[{'name':'attrUrl','value':_0x35477b[_0xff63('0x60')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x0]?_0x35477b[_0xff63('0x61')][0x0][_0xff63('0x62')]:undefined)||_0xff63('0x63')}];case _0xff63('0x64'):return[{'name':'attrPath','value':_0x35477b[_0xff63('0x65')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x0]?_0x35477b[_0xff63('0x61')][0x0]['value']:undefined)||''}];case _0xff63('0x66'):return[{'name':_0xff63('0x67'),'value':_0x35477b[_0xff63('0x67')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x0]?_0x35477b[_0xff63('0x61')][0x0][_0xff63('0x62')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x35477b[_0xff63('0x68')]||(_0x35477b['attrs']&&_0x35477b[_0xff63('0x61')][0x1]?_0x35477b[_0xff63('0x61')][0x1][_0xff63('0x62')]:undefined)||_0xff63('0x69')},{'name':'attrFontSize','value':_0x35477b['attrFontSize']||(_0x35477b[_0xff63('0x61')]&&_0x35477b['attrs'][0x2]?_0x35477b[_0xff63('0x61')][0x2][_0xff63('0x62')]:undefined)||0xc}];case'counter':return[{'name':_0xff63('0x6a'),'value':_0x35477b[_0xff63('0x6a')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x0]?_0x35477b[_0xff63('0x61')][0x0][_0xff63('0x62')]:undefined)||_0xff63('0x6b')},{'name':_0xff63('0x6c'),'value':_0x35477b[_0xff63('0x6c')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x1]?_0x35477b[_0xff63('0x61')][0x1][_0xff63('0x62')]:undefined)||[]},{'name':_0xff63('0x6d'),'value':_0x35477b[_0xff63('0x6d')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x2]?_0x35477b['attrs'][0x2][_0xff63('0x62')]:undefined)||0x14}];case _0xff63('0x6e'):case'pie-chart':return[{'name':_0xff63('0x6f'),'value':_0x35477b['attrSerie1']||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x0]?_0x35477b[_0xff63('0x61')][0x0][_0xff63('0x62')]:undefined)||_0xff63('0x6b')},{'name':_0xff63('0x70'),'value':_0x35477b[_0xff63('0x70')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b['attrs'][0x1]?_0x35477b[_0xff63('0x61')][0x1]['value']:undefined)||null},{'name':_0xff63('0x71'),'value':_0x35477b[_0xff63('0x71')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x2]?_0x35477b[_0xff63('0x61')][0x2][_0xff63('0x62')]:undefined)||null},{'name':_0xff63('0x6c'),'value':_0x35477b['attrVoiceQueues']||(_0x35477b[_0xff63('0x61')]&&_0x35477b['attrs'][0x3]?_0x35477b[_0xff63('0x61')][0x3][_0xff63('0x62')]:undefined)||[]}];case _0xff63('0x72'):return[{'name':_0xff63('0x73'),'type':_0x35477b[_0xff63('0x74')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x0]?_0x35477b[_0xff63('0x61')][0x0]['type']:undefined)||null,'value':_0x35477b[_0xff63('0x73')]||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x0]?_0x35477b['attrs'][0x0][_0xff63('0x62')]:undefined)||null},{'name':_0xff63('0x75'),'value':_0x35477b['attrRefresh']||(_0x35477b[_0xff63('0x61')]&&_0x35477b[_0xff63('0x61')][0x1]?_0x35477b[_0xff63('0x61')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2ca75a){logger[_0xff63('0x2e')](_0xff63('0x76'),JSON[_0xff63('0x77')](_0x2ca75a));return[];}}exports[_0xff63('0x78')]=function(_0x18550e,_0x2f57d1,_0x39f757){if(_0x18550e['body']['id']){delete _0x18550e[_0xff63('0x51')]['id'];}return db[_0xff63('0x34')][_0xff63('0x4e')]({'where':{'id':_0x18550e[_0xff63('0x4d')]['id']}})[_0xff63('0x28')](handleEntityNotFound(_0x2f57d1,null))[_0xff63('0x28')](function(_0x1a466d){if(_0x1a466d){_0x18550e['body'][_0xff63('0x79')]=_0x1a466d['id'];_0x18550e[_0xff63('0x51')]['attrs']=widgetAttributes(_0x18550e['body']);return db[_0xff63('0x7a')][_0xff63('0x50')](_0x18550e[_0xff63('0x51')]);}})['then'](respondWithResult(_0x2f57d1,null))['catch'](handleError(_0x2f57d1,null));};exports[_0xff63('0x7b')]=function(_0x30197d,_0x58f356,_0x5065c8){var _0x3e1213={};var _0x1cc0e2={};var _0x1bd954;var _0x528c17;return db[_0xff63('0x34')][_0xff63('0x7c')]({'where':{'id':_0x30197d[_0xff63('0x4d')]['id']}})[_0xff63('0x28')](handleEntityNotFound(_0x58f356,null))['then'](function(_0x4b81a8){if(_0x4b81a8){_0x1bd954=_0x4b81a8;_0x1cc0e2[_0xff63('0x3b')]=_[_0xff63('0x39')](db[_0xff63('0x7a')]['rawAttributes']);_0x1cc0e2['query']=_[_0xff63('0x39')](_0x30197d['query']);_0x1cc0e2[_0xff63('0x3a')]=_[_0xff63('0x3c')](_0x1cc0e2['model'],_0x1cc0e2[_0xff63('0x38')]);_0x3e1213[_0xff63('0x3e')]=_[_0xff63('0x3c')](_0x1cc0e2['model'],qs[_0xff63('0x3d')](_0x30197d['query'][_0xff63('0x3d')]));_0x3e1213[_0xff63('0x3e')]=_0x3e1213[_0xff63('0x3e')][_0xff63('0x3f')]?_0x3e1213[_0xff63('0x3e')]:_0x1cc0e2[_0xff63('0x3b')];_0x3e1213[_0xff63('0x42')]=qs['sort'](_0x30197d['query'][_0xff63('0x7d')]);_0x3e1213[_0xff63('0x43')]=qs[_0xff63('0x3a')](_[_0xff63('0x44')](_0x30197d[_0xff63('0x38')],_0x1cc0e2[_0xff63('0x3a')]));if(_0x30197d['query'][_0xff63('0x45')]){_0x3e1213[_0xff63('0x43')]=_['merge'](_0x3e1213[_0xff63('0x43')],{'$or':_['map'](_0x3e1213[_0xff63('0x3e')],function(_0x51623a){var _0x49f3f4={};_0x49f3f4[_0x51623a]={'$like':'%'+_0x30197d[_0xff63('0x38')][_0xff63('0x45')]+'%'};return _0x49f3f4;})});}_0x3e1213=_[_0xff63('0x46')]({},_0x3e1213,_0x30197d[_0xff63('0x49')]);return _0x1bd954[_0xff63('0x7b')](_0x3e1213);}})[_0xff63('0x28')](function(_0x49a6ec){if(_0x49a6ec){_0x528c17=_0x49a6ec[_0xff63('0x3f')];if(!_0x30197d[_0xff63('0x38')][_0xff63('0x40')](_0xff63('0x41'))){_0x3e1213[_0xff63('0x24')]=qs[_0xff63('0x24')](_0x30197d[_0xff63('0x38')]['limit']);_0x3e1213[_0xff63('0x23')]=qs['offset'](_0x30197d['query'][_0xff63('0x23')]);}return _0x1bd954['getItems'](_0x3e1213);}})['then'](function(_0x5a1225){if(_0x5a1225){return _0x5a1225?{'count':_0x528c17,'rows':_0x5a1225}:null;}})[_0xff63('0x28')](respondWithResult(_0x58f356,null))['catch'](handleError(_0x58f356,null));}; \ No newline at end of file +var _0x684f=['attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','hasOwnProperty','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','CustomDashboards','error','stack','name','send','map','fieldName','type','key','query','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','Dashboard','includeAll','findAll','catch','show','params','keys','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','counter','total','attrVoiceQueues','attrFontSize','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport'];(function(_0x5e2862,_0x4760eb){var _0x8dcad4=function(_0x205ddf){while(--_0x205ddf){_0x5e2862['push'](_0x5e2862['shift']());}};_0x8dcad4(++_0x4760eb);}(_0x684f,0x7f));var _0xf684=function(_0x15da7c,_0x44b14f){_0x15da7c=_0x15da7c-0x0;var _0x4e0563=_0x684f[_0x15da7c];return _0x4e0563;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf684('0x0'));var rimraf=require(_0xf684('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf684('0x2'));var moment=require('moment');var BPromise=require(_0xf684('0x3'));var Mustache=require(_0xf684('0x4'));var util=require(_0xf684('0x5'));var path=require(_0xf684('0x6'));var sox=require(_0xf684('0x7'));var csv=require(_0xf684('0x8'));var ejs=require(_0xf684('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf684('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf684('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf684('0xc'));var Papa=require('papaparse');var Redis=require(_0xf684('0xd'));var authService=require(_0xf684('0xe'));var qs=require(_0xf684('0xf'));var as=require(_0xf684('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf684('0x11'))(_0xf684('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf684('0x13'));var db=require(_0xf684('0x14'))['db'];config['redis']=_[_0xf684('0x15')](config[_0xf684('0x16')],{'host':_0xf684('0x17'),'port':0x18eb});var socket=require(_0xf684('0x18'))(new Redis(config[_0xf684('0x16')]));require(_0xf684('0x19'))['register'](socket);function respondWithStatusCode(_0xd94a1f,_0x35b6d1){_0x35b6d1=_0x35b6d1||0xcc;return function(_0x145d34){if(_0x145d34){return _0xd94a1f[_0xf684('0x1a')](_0x35b6d1);}return _0xd94a1f['status'](_0x35b6d1)[_0xf684('0x1b')]();};}function respondWithResult(_0x28b350,_0x46b4de){_0x46b4de=_0x46b4de||0xc8;return function(_0x4122d1){if(_0x4122d1){return _0x28b350[_0xf684('0x1c')](_0x46b4de)[_0xf684('0x1d')](_0x4122d1);}};}function respondWithFilteredResult(_0x2f1c6f,_0x62f815){return function(_0x2125b9){if(_0x2125b9){var _0x2d21a7=_0x2125b9[_0xf684('0x1e')],_0x2b403e=_0x62f815[_0xf684('0x1f')],_0x12edff=_0x62f815['offset']+_0x62f815[_0xf684('0x20')],_0x34bee5;if(_0x12edff>=_0x2d21a7){_0x12edff=_0x2d21a7;_0x34bee5=0xc8;}else{_0x34bee5=0xce;}_0x2f1c6f['status'](_0x34bee5);return _0x2f1c6f[_0xf684('0x21')](_0xf684('0x22'),_0x2b403e+'-'+_0x12edff+'/'+_0x2d21a7)['json'](_0x2125b9);}return null;};}function patchUpdates(_0x72f0cd){return function(_0x5872ab){try{jsonpatch['apply'](_0x5872ab,_0x72f0cd,!![]);}catch(_0xc664f0){return BPromise['reject'](_0xc664f0);}return _0x5872ab[_0xf684('0x23')]();};}function saveUpdates(_0x4b4d3e,_0x5f38dd){return function(_0x24aef5){if(_0x24aef5){return _0x24aef5[_0xf684('0x24')](_0x4b4d3e)['then'](function(_0x5dd4f8){return _0x5dd4f8;});}return null;};}function removeEntity(_0x41c2a5,_0x20205a){return function(_0x2e27cb){if(_0x2e27cb){return _0x2e27cb[_0xf684('0x25')]()[_0xf684('0x26')](function(){var _0x3c51fc=_0x2e27cb['get']({'plain':!![]});var _0x3f9102=_0xf684('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x3f9102,'resourceId':_0x3c51fc['id']}})[_0xf684('0x26')](function(){return _0x2e27cb;});})[_0xf684('0x26')](function(){_0x41c2a5[_0xf684('0x1c')](0xcc)[_0xf684('0x1b')]();});}};}function handleEntityNotFound(_0x38beac,_0x919007){return function(_0x489114){if(!_0x489114){_0x38beac[_0xf684('0x1a')](0x194);}return _0x489114;};}function handleError(_0x1e4a5f,_0xa6f8e2){_0xa6f8e2=_0xa6f8e2||0x1f4;return function(_0x25dbc9){logger[_0xf684('0x28')](_0x25dbc9[_0xf684('0x29')]);if(_0x25dbc9[_0xf684('0x2a')]){delete _0x25dbc9[_0xf684('0x2a')];}_0x1e4a5f[_0xf684('0x1c')](_0xa6f8e2)[_0xf684('0x2b')](_0x25dbc9);};}exports['index']=function(_0x3f1b62,_0x5ed612){var _0x3a8a28={},_0x2ebe79={},_0x43a785={'count':0x0,'rows':[]};var _0x2aa022=_[_0xf684('0x2c')](db['Dashboard']['rawAttributes'],function(_0x3bf487){return{'name':_0x3bf487[_0xf684('0x2d')],'type':_0x3bf487[_0xf684('0x2e')][_0xf684('0x2f')]};});_0x2ebe79['model']=_['map'](_0x2aa022,'name');_0x2ebe79[_0xf684('0x30')]=_['keys'](_0x3f1b62[_0xf684('0x30')]);_0x2ebe79['filters']=_[_0xf684('0x31')](_0x2ebe79[_0xf684('0x32')],_0x2ebe79['query']);_0x3a8a28['attributes']=_['intersection'](_0x2ebe79[_0xf684('0x32')],qs[_0xf684('0x33')](_0x3f1b62[_0xf684('0x30')][_0xf684('0x33')]));_0x3a8a28['attributes']=_0x3a8a28[_0xf684('0x34')]['length']?_0x3a8a28[_0xf684('0x34')]:_0x2ebe79[_0xf684('0x32')];if(!_0x3f1b62['query']['hasOwnProperty'](_0xf684('0x35'))){_0x3a8a28[_0xf684('0x20')]=qs['limit'](_0x3f1b62[_0xf684('0x30')][_0xf684('0x20')]);_0x3a8a28[_0xf684('0x1f')]=qs[_0xf684('0x1f')](_0x3f1b62[_0xf684('0x30')][_0xf684('0x1f')]);}_0x3a8a28[_0xf684('0x36')]=qs[_0xf684('0x37')](_0x3f1b62[_0xf684('0x30')][_0xf684('0x37')]);_0x3a8a28[_0xf684('0x38')]=qs['filters'](_[_0xf684('0x39')](_0x3f1b62[_0xf684('0x30')],_0x2ebe79[_0xf684('0x3a')]),_0x2aa022);if(_0x3f1b62[_0xf684('0x30')]['filter']){_0x3a8a28[_0xf684('0x38')]=_[_0xf684('0x3b')](_0x3a8a28[_0xf684('0x38')],{'$or':_[_0xf684('0x2c')](_0x2aa022,function(_0xc508bb){if(_0xc508bb['type']!==_0xf684('0x3c')){var _0x4f8b5b={};_0x4f8b5b[_0xc508bb[_0xf684('0x2a')]]={'$like':'%'+_0x3f1b62[_0xf684('0x30')][_0xf684('0x3d')]+'%'};return _0x4f8b5b;}})});}_0x3a8a28=_[_0xf684('0x3b')]({},_0x3a8a28,_0x3f1b62[_0xf684('0x3e')]);var _0x3a1912={'where':_0x3a8a28[_0xf684('0x38')]};return db[_0xf684('0x3f')]['count'](_0x3a1912)[_0xf684('0x26')](function(_0x57556b){_0x43a785[_0xf684('0x1e')]=_0x57556b;if(_0x3f1b62[_0xf684('0x30')][_0xf684('0x40')]){_0x3a8a28['include']=[{'all':!![]}];}return db[_0xf684('0x3f')][_0xf684('0x41')](_0x3a8a28);})['then'](function(_0x3c5611){_0x43a785['rows']=_0x3c5611;return _0x43a785;})[_0xf684('0x26')](respondWithFilteredResult(_0x5ed612,_0x3a8a28))[_0xf684('0x42')](handleError(_0x5ed612,null));};exports[_0xf684('0x43')]=function(_0x5cfafa,_0x49ff34){var _0x780163={'raw':![],'where':{'id':_0x5cfafa[_0xf684('0x44')]['id']}},_0x3c8a70={};_0x3c8a70[_0xf684('0x32')]=_[_0xf684('0x45')](db[_0xf684('0x3f')][_0xf684('0x46')]);_0x3c8a70[_0xf684('0x30')]=_[_0xf684('0x45')](_0x5cfafa['query']);_0x3c8a70['filters']=_[_0xf684('0x31')](_0x3c8a70['model'],_0x3c8a70[_0xf684('0x30')]);_0x780163['attributes']=_['intersection'](_0x3c8a70[_0xf684('0x32')],qs[_0xf684('0x33')](_0x5cfafa[_0xf684('0x30')]['fields']));_0x780163[_0xf684('0x34')]=_0x780163[_0xf684('0x34')]['length']?_0x780163[_0xf684('0x34')]:_0x3c8a70[_0xf684('0x32')];if(_0x5cfafa[_0xf684('0x30')][_0xf684('0x40')]){_0x780163[_0xf684('0x47')]=[{'all':!![]}];}_0x780163=_['merge']({},_0x780163,_0x5cfafa['options']);return db[_0xf684('0x3f')][_0xf684('0x48')](_0x780163)['then'](handleEntityNotFound(_0x49ff34,null))['then'](respondWithResult(_0x49ff34,null))[_0xf684('0x42')](handleError(_0x49ff34,null));};exports[_0xf684('0x49')]=function(_0x44ba89,_0x421c26){return db['Dashboard'][_0xf684('0x49')](_0x44ba89[_0xf684('0x4a')],{})['then'](function(_0x1d643a){var _0x1422bc=_0x44ba89['user'][_0xf684('0x4b')]({'plain':!![]});if(!_0x1422bc)throw new Error(_0xf684('0x4c'));if(_0x1422bc[_0xf684('0x4d')]===_0xf684('0x4e')){var _0x43ebdf=_0x1d643a['get']({'plain':!![]});var _0x2e854e=_0xf684('0x27');return db[_0xf684('0x4f')]['find']({'where':{'name':_0x2e854e,'userProfileId':_0x1422bc[_0xf684('0x50')]},'raw':!![]})[_0xf684('0x26')](function(_0x454089){if(_0x454089&&_0x454089[_0xf684('0x51')]===0x0){return db[_0xf684('0x52')]['create']({'name':_0x43ebdf[_0xf684('0x2a')],'resourceId':_0x43ebdf['id'],'type':_0x454089[_0xf684('0x2a')],'sectionId':_0x454089['id']},{})[_0xf684('0x26')](function(){return _0x1d643a;});}else{return _0x1d643a;}})[_0xf684('0x42')](function(_0x18ccf2){logger[_0xf684('0x28')](_0xf684('0x53'),_0x18ccf2);throw _0x18ccf2;});}return _0x1d643a;})[_0xf684('0x26')](respondWithResult(_0x421c26,0xc9))['catch'](handleError(_0x421c26,null));};exports[_0xf684('0x54')]=function(_0x327767,_0x533d18){var _0x13e66c={'where':{'id':_0x327767['params']['id']}},_0xc1dd6e={};_0xc1dd6e[_0xf684('0x32')]=_['keys'](db[_0xf684('0x3f')]['rawAttributes']);_0x13e66c[_0xf684('0x34')]=_[_0xf684('0x31')](_0xc1dd6e[_0xf684('0x32')],qs['fields'](_0x327767[_0xf684('0x30')]['fields']));_0x13e66c[_0xf684('0x34')]=_0x13e66c[_0xf684('0x34')][_0xf684('0x55')]?_0x13e66c['attributes']:_0xc1dd6e['model'];if(_0x327767[_0xf684('0x30')][_0xf684('0x40')]){_0x13e66c['include']=[{'all':!![]}];}_0x13e66c=_[_0xf684('0x3b')]({},_0x13e66c,_0x327767['options']);return db[_0xf684('0x3f')][_0xf684('0x48')](_0x13e66c)[_0xf684('0x26')](handleEntityNotFound(_0x533d18,null))['then'](function(_0x1a4ce4){if(_0x1a4ce4){var _0x303265=_0x1a4ce4[_0xf684('0x4b')]({'plain':!![]});_0x303265=qs[_0xf684('0x56')](_0x303265,['id',_0xf684('0x57'),_0xf684('0x58')]);_0x327767['body']=_[_0xf684('0x56')](_0x327767[_0xf684('0x4a')],['id',_0xf684('0x57'),_0xf684('0x58')]);return db[_0xf684('0x3f')]['create'](_[_0xf684('0x3b')](_0x303265,_0x327767['body']),{'include':_0x327767[_0xf684('0x30')][_0xf684('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0xd3305b){var _0x33ec13=_0x327767[_0xf684('0x4e')][_0xf684('0x4b')]({'plain':!![]});if(!_0x33ec13)throw new Error(_0xf684('0x4c'));if(_0x33ec13[_0xf684('0x4d')]==='user'){var _0x39d3a3=_0xd3305b[_0xf684('0x4b')]({'plain':!![]});var _0x39cdd1=_0xf684('0x27');return db['UserProfileSection'][_0xf684('0x48')]({'where':{'name':_0x39cdd1,'userProfileId':_0x33ec13[_0xf684('0x50')]},'raw':!![]})[_0xf684('0x26')](function(_0x20af61){if(_0x20af61&&_0x20af61[_0xf684('0x51')]===0x0){return db[_0xf684('0x52')][_0xf684('0x49')]({'name':_0x39d3a3[_0xf684('0x2a')],'resourceId':_0x39d3a3['id'],'type':_0x20af61[_0xf684('0x2a')],'sectionId':_0x20af61['id']},{})['then'](function(){return _0xd3305b;});}else{return _0xd3305b;}})[_0xf684('0x42')](function(_0x5a84ff){logger[_0xf684('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a84ff);throw _0x5a84ff;});}return _0xd3305b;});}})[_0xf684('0x26')](respondWithResult(_0x533d18,0xc9))[_0xf684('0x42')](handleError(_0x533d18,null));};exports['update']=function(_0x1d8265,_0x117588){if(_0x1d8265[_0xf684('0x4a')]['id']){delete _0x1d8265[_0xf684('0x4a')]['id'];}return db[_0xf684('0x3f')]['find']({'where':{'id':_0x1d8265[_0xf684('0x44')]['id']}})[_0xf684('0x26')](handleEntityNotFound(_0x117588,null))[_0xf684('0x26')](saveUpdates(_0x1d8265[_0xf684('0x4a')],null))[_0xf684('0x26')](respondWithResult(_0x117588,null))[_0xf684('0x42')](handleError(_0x117588,null));};exports[_0xf684('0x25')]=function(_0xa4671f,_0xfa4fbb){return db[_0xf684('0x3f')]['find']({'where':{'id':_0xa4671f[_0xf684('0x44')]['id']}})[_0xf684('0x26')](handleEntityNotFound(_0xfa4fbb,null))['then'](removeEntity(_0xfa4fbb,null))['catch'](handleError(_0xfa4fbb,null));};function widgetAttributes(_0x300a45){try{switch(_0x300a45['type']){case _0xf684('0x59'):return[{'name':_0xf684('0x5a'),'value':_0x300a45[_0xf684('0x5a')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45['attrs'][0x0][_0xf684('0x5c')]:undefined)||_0xf684('0x5d')}];case _0xf684('0x5e'):return[{'name':'attrPath','value':_0x300a45[_0xf684('0x5f')]||(_0x300a45['attrs']&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0]['value']:undefined)||''}];case _0xf684('0x60'):return[{'name':'attrHourFormat','value':_0x300a45[_0xf684('0x61')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0][_0xf684('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0xf684('0x62'),'value':_0x300a45[_0xf684('0x62')]||(_0x300a45['attrs']&&_0x300a45[_0xf684('0x5b')][0x1]?_0x300a45[_0xf684('0x5b')][0x1]['value']:undefined)||_0xf684('0x63')},{'name':'attrFontSize','value':_0x300a45['attrFontSize']||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x2]?_0x300a45['attrs'][0x2][_0xf684('0x5c')]:undefined)||0xc}];case _0xf684('0x64'):return[{'name':'attrMetric','value':_0x300a45['attrMetric']||(_0x300a45['attrs']&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0]['value']:undefined)||_0xf684('0x65')},{'name':_0xf684('0x66'),'value':_0x300a45['attrVoiceQueues']||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x1]?_0x300a45[_0xf684('0x5b')][0x1][_0xf684('0x5c')]:undefined)||[]},{'name':_0xf684('0x67'),'value':_0x300a45[_0xf684('0x67')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x2]?_0x300a45[_0xf684('0x5b')][0x2][_0xf684('0x5c')]:undefined)||0x14}];case'multibar-chart':case _0xf684('0x68'):return[{'name':_0xf684('0x69'),'value':_0x300a45[_0xf684('0x69')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0]['value']:undefined)||_0xf684('0x65')},{'name':'attrSerie2','value':_0x300a45[_0xf684('0x6a')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x1]?_0x300a45['attrs'][0x1][_0xf684('0x5c')]:undefined)||null},{'name':_0xf684('0x6b'),'value':_0x300a45['attrSerie3']||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x2]?_0x300a45[_0xf684('0x5b')][0x2]['value']:undefined)||null},{'name':_0xf684('0x66'),'value':_0x300a45[_0xf684('0x66')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x3]?_0x300a45['attrs'][0x3][_0xf684('0x5c')]:undefined)||[]}];case _0xf684('0x6c'):return[{'name':'attrReport','type':_0x300a45[_0xf684('0x6d')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0]['type']:undefined)||null,'value':_0x300a45[_0xf684('0x6e')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45['attrs'][0x0]?_0x300a45[_0xf684('0x5b')][0x0][_0xf684('0x5c')]:undefined)||null},{'name':_0xf684('0x6f'),'value':_0x300a45[_0xf684('0x6f')]||(_0x300a45['attrs']&&_0x300a45[_0xf684('0x5b')][0x1]?_0x300a45['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1f10ea){logger[_0xf684('0x28')](_0xf684('0x70'),JSON[_0xf684('0x71')](_0x1f10ea));return[];}}exports[_0xf684('0x72')]=function(_0x28f54c,_0x42e495,_0x425278){if(_0x28f54c['body']['id']){delete _0x28f54c[_0xf684('0x4a')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x28f54c['params']['id']}})[_0xf684('0x26')](handleEntityNotFound(_0x42e495,null))['then'](function(_0x1d5cf8){if(_0x1d5cf8){_0x28f54c[_0xf684('0x4a')][_0xf684('0x73')]=_0x1d5cf8['id'];_0x28f54c[_0xf684('0x4a')][_0xf684('0x5b')]=widgetAttributes(_0x28f54c['body']);return db[_0xf684('0x74')][_0xf684('0x49')](_0x28f54c['body']);}})[_0xf684('0x26')](respondWithResult(_0x42e495,null))[_0xf684('0x42')](handleError(_0x42e495,null));};exports['getItems']=function(_0x40818b,_0x4f7a37,_0x538bfa){var _0x2196c5={};var _0x3e24f4={};var _0x2114f4;var _0x1f31ce;return db['Dashboard']['findOne']({'where':{'id':_0x40818b[_0xf684('0x44')]['id']}})[_0xf684('0x26')](handleEntityNotFound(_0x4f7a37,null))[_0xf684('0x26')](function(_0x29f7ee){if(_0x29f7ee){_0x2114f4=_0x29f7ee;_0x3e24f4[_0xf684('0x32')]=_[_0xf684('0x45')](db[_0xf684('0x74')][_0xf684('0x46')]);_0x3e24f4[_0xf684('0x30')]=_[_0xf684('0x45')](_0x40818b['query']);_0x3e24f4[_0xf684('0x3a')]=_[_0xf684('0x31')](_0x3e24f4[_0xf684('0x32')],_0x3e24f4['query']);_0x2196c5['attributes']=_[_0xf684('0x31')](_0x3e24f4[_0xf684('0x32')],qs[_0xf684('0x33')](_0x40818b['query']['fields']));_0x2196c5[_0xf684('0x34')]=_0x2196c5[_0xf684('0x34')][_0xf684('0x55')]?_0x2196c5[_0xf684('0x34')]:_0x3e24f4[_0xf684('0x32')];_0x2196c5[_0xf684('0x36')]=qs[_0xf684('0x37')](_0x40818b[_0xf684('0x30')]['sort']);_0x2196c5['where']=qs[_0xf684('0x3a')](_[_0xf684('0x39')](_0x40818b['query'],_0x3e24f4[_0xf684('0x3a')]));if(_0x40818b[_0xf684('0x30')][_0xf684('0x3d')]){_0x2196c5[_0xf684('0x38')]=_[_0xf684('0x3b')](_0x2196c5[_0xf684('0x38')],{'$or':_[_0xf684('0x2c')](_0x2196c5[_0xf684('0x34')],function(_0x1088ef){var _0x4aad5c={};_0x4aad5c[_0x1088ef]={'$like':'%'+_0x40818b['query'][_0xf684('0x3d')]+'%'};return _0x4aad5c;})});}_0x2196c5=_['merge']({},_0x2196c5,_0x40818b[_0xf684('0x3e')]);return _0x2114f4[_0xf684('0x75')](_0x2196c5);}})[_0xf684('0x26')](function(_0x47db72){if(_0x47db72){_0x1f31ce=_0x47db72[_0xf684('0x55')];if(!_0x40818b['query'][_0xf684('0x76')](_0xf684('0x35'))){_0x2196c5[_0xf684('0x20')]=qs[_0xf684('0x20')](_0x40818b[_0xf684('0x30')]['limit']);_0x2196c5['offset']=qs['offset'](_0x40818b['query'][_0xf684('0x1f')]);}return _0x2114f4[_0xf684('0x75')](_0x2196c5);}})[_0xf684('0x26')](function(_0xfb398c){if(_0xfb398c){return _0xfb398c?{'count':_0x1f31ce,'rows':_0xfb398c}:null;}})[_0xf684('0x26')](respondWithResult(_0x4f7a37,null))['catch'](handleError(_0x4f7a37,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8ac5b31..2ae1496 100644 --- a/server/api/dashboard/dashboard.events.js +++ b/server/api/dashboard/dashboard.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b8c=['Dashboard','setMaxListeners','update','emit','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b8c,0x1c7));var _0xc5b8=function(_0x76fea7,_0x164167){_0x76fea7=_0x76fea7-0x0;var _0x3183c0=_0x5b8c[_0x76fea7];return _0x3183c0;};'use strict';var EventEmitter=require(_0xc5b8('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xc5b8('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc5b8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc5b8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x30a4cf){return function(_0x20ceae,_0x5580cc,_0x1628a5){DashboardEvents[_0xc5b8('0x4')](_0x30a4cf+':'+_0x20ceae['id'],_0x20ceae);DashboardEvents[_0xc5b8('0x4')](_0x30a4cf,_0x20ceae);_0x1628a5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xc5b8('0x5')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x6ccb=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x1a5d7c,_0x4dadb8){var _0x565525=function(_0x186608){while(--_0x186608){_0x1a5d7c['push'](_0x1a5d7c['shift']());}};_0x565525(++_0x4dadb8);}(_0x6ccb,0xad));var _0xb6cc=function(_0x24af60,_0x438265){_0x24af60=_0x24af60-0x0;var _0x24ccff=_0x6ccb[_0x24af60];return _0x24ccff;};'use strict';var EventEmitter=require(_0xb6cc('0x0'));var Dashboard=require(_0xb6cc('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6cc('0x2'),'afterUpdate':_0xb6cc('0x3'),'afterDestroy':_0xb6cc('0x4')};function emitEvent(_0x15fc61){return function(_0x48665f,_0x468091,_0x28e5e4){DashboardEvents[_0xb6cc('0x5')](_0x15fc61+':'+_0x48665f['id'],_0x48665f);DashboardEvents['emit'](_0x15fc61,_0x48665f);_0x28e5e4(null);};}for(var e in events){if(events[_0xb6cc('0x6')](e)){var event=events[e];Dashboard[_0xb6cc('0x7')](e,emitEvent(event));}}module[_0xb6cc('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index dad72df..afebbc1 100644 --- a/server/api/dashboard/dashboard.model.js +++ b/server/api/dashboard/dashboard.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18b5=['util','bluebird','path','rimraf','./dashboard.attributes','exports','define'];(function(_0x223dbb,_0xb44f28){var _0x8f9c8b=function(_0x5d1cbe){while(--_0x5d1cbe){_0x223dbb['push'](_0x223dbb['shift']());}};_0x8f9c8b(++_0xb44f28);}(_0x18b5,0xa1));var _0x518b=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x18b5[_0x1e2321];return _0x1d346d;};'use strict';var _=require('lodash');var util=require(_0x518b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x518b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x518b('0x2'));var rimraf=require(_0x518b('0x3'));var config=require('../../config/environment');var attributes=require(_0x518b('0x4'));module[_0x518b('0x5')]=function(_0x5e3dea,_0x49818b){return _0x5e3dea[_0x518b('0x6')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf136=['bluebird','request-promise','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x515e9f,_0xff9586){var _0x19cbf0=function(_0xa2ae5c){while(--_0xa2ae5c){_0x515e9f['push'](_0x515e9f['shift']());}};_0x19cbf0(++_0xff9586);}(_0xf136,0x1d0));var _0x6f13=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf136[_0x22b68a];return _0x1ac67a;};'use strict';var _=require(_0x6f13('0x0'));var util=require(_0x6f13('0x1'));var logger=require(_0x6f13('0x2'))(_0x6f13('0x3'));var moment=require('moment');var BPromise=require(_0x6f13('0x4'));var rp=require(_0x6f13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f13('0x6'));var config=require('../../config/environment');var attributes=require(_0x6f13('0x7'));module[_0x6f13('0x8')]=function(_0x3c19b3,_0x49ff51){return _0x3c19b3[_0x6f13('0x9')](_0x6f13('0xa'),attributes,{'tableName':_0x6f13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index fcbbb79..0fcf0a2 100644 --- a/server/api/dashboard/dashboard.rpc.js +++ b/server/api/dashboard/dashboard.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca1d=['error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x39b867,_0x38496e){var _0x4152ad=function(_0x13202d){while(--_0x13202d){_0x39b867['push'](_0x39b867['shift']());}};_0x4152ad(++_0x38496e);}(_0xca1d,0x74));var _0xdca1=function(_0x596231,_0x2ba875){_0x596231=_0x596231-0x0;var _0xa9835e=_0xca1d[_0x596231];return _0xa9835e;};'use strict';var _=require(_0xdca1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdca1('0x1'));var rs=require(_0xdca1('0x2'));var fs=require('fs');var Redis=require(_0xdca1('0x3'));var db=require(_0xdca1('0x4'))['db'];var utils=require(_0xdca1('0x5'));var logger=require(_0xdca1('0x6'))(_0xdca1('0x7'));var config=require(_0xdca1('0x8'));var jayson=require(_0xdca1('0x9'));var client=jayson[_0xdca1('0xa')]['http']({'port':0x232a});config[_0xdca1('0xb')]=_['defaults'](config[_0xdca1('0xb')],{'host':_0xdca1('0xc'),'port':0x18eb});var socket=require(_0xdca1('0xd'))(new Redis(config[_0xdca1('0xb')]));require(_0xdca1('0xe'))[_0xdca1('0xf')](socket);function respondWithRpcPromise(_0x2e11dd,_0x24424e,_0x1d984f){return new BPromise(function(_0x4e8c0a,_0x3ec965){return client[_0xdca1('0x10')](_0x2e11dd,_0x1d984f)[_0xdca1('0x11')](function(_0x86f05d){logger[_0xdca1('0x12')](_0xdca1('0x13'),_0x24424e,'request\x20sent');logger[_0xdca1('0x14')](_0xdca1('0x15'),_0x24424e,_0xdca1('0x16'),JSON[_0xdca1('0x17')](_0x86f05d));if(_0x86f05d[_0xdca1('0x18')]){if(_0x86f05d[_0xdca1('0x18')]['code']===0x1f4){logger[_0xdca1('0x18')]('Dashboard,\x20%s,\x20%s',_0x24424e,_0x86f05d[_0xdca1('0x18')][_0xdca1('0x19')]);return _0x3ec965(_0x86f05d['error']['message']);}logger[_0xdca1('0x18')](_0xdca1('0x13'),_0x24424e,_0x86f05d[_0xdca1('0x18')]['message']);return _0x4e8c0a(_0x86f05d[_0xdca1('0x18')]['message']);}else{logger[_0xdca1('0x12')]('Dashboard,\x20%s,\x20%s',_0x24424e,_0xdca1('0x16'));_0x4e8c0a(_0x86f05d[_0xdca1('0x1a')][_0xdca1('0x19')]);}})[_0xdca1('0x1b')](function(_0x531c7f){logger[_0xdca1('0x18')](_0xdca1('0x13'),_0x24424e,_0x531c7f);_0x3ec965(_0x531c7f);});});} \ No newline at end of file +var _0xdc6c=['Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x3e4cbc,_0xa57b87){var _0x5e7ad6=function(_0x44e4a2){while(--_0x44e4a2){_0x3e4cbc['push'](_0x3e4cbc['shift']());}};_0x5e7ad6(++_0xa57b87);}(_0xdc6c,0x157));var _0xcdc6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdc6c[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xcdc6('0x0'));var moment=require(_0xcdc6('0x1'));var BPromise=require(_0xcdc6('0x2'));var rs=require(_0xcdc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdc6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdc6('0x5'))(_0xcdc6('0x6'));var config=require(_0xcdc6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcdc6('0x8')]({'port':0x232a});config[_0xcdc6('0x9')]=_[_0xcdc6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcdc6('0xb'))(new Redis(config['redis']));require('./dashboard.socket')[_0xcdc6('0xc')](socket);function respondWithRpcPromise(_0x3cf515,_0x9a4140,_0x5b59f6){return new BPromise(function(_0x8e4f7e,_0x29ffd4){return client[_0xcdc6('0xd')](_0x3cf515,_0x5b59f6)[_0xcdc6('0xe')](function(_0x58da10){logger[_0xcdc6('0xf')](_0xcdc6('0x10'),_0x9a4140,'request\x20sent');logger['debug'](_0xcdc6('0x11'),_0x9a4140,_0xcdc6('0x12'),JSON['stringify'](_0x58da10));if(_0x58da10['error']){if(_0x58da10[_0xcdc6('0x13')][_0xcdc6('0x14')]===0x1f4){logger[_0xcdc6('0x13')](_0xcdc6('0x10'),_0x9a4140,_0x58da10[_0xcdc6('0x13')]['message']);return _0x29ffd4(_0x58da10[_0xcdc6('0x13')]['message']);}logger[_0xcdc6('0x13')](_0xcdc6('0x10'),_0x9a4140,_0x58da10[_0xcdc6('0x13')]['message']);return _0x8e4f7e(_0x58da10[_0xcdc6('0x13')][_0xcdc6('0x15')]);}else{logger['info'](_0xcdc6('0x10'),_0x9a4140,_0xcdc6('0x12'));_0x8e4f7e(_0x58da10[_0xcdc6('0x16')][_0xcdc6('0x15')]);}})[_0xcdc6('0x17')](function(_0x32e607){logger['error']('Dashboard,\x20%s,\x20%s',_0x9a4140,_0x32e607);_0x29ffd4(_0x32e607);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8c4506c..97a6776 100644 --- a/server/api/dashboard/dashboard.socket.js +++ b/server/api/dashboard/dashboard.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9904=['save','remove','update','register','length','dashboard:','./dashboard.events'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x9904,0x13a));var _0x4990=function(_0x1bcf5b,_0xd5637f){_0x1bcf5b=_0x1bcf5b-0x0;var _0x352544=_0x9904[_0x1bcf5b];return _0x352544;};'use strict';var DashboardEvents=require(_0x4990('0x0'));var events=[_0x4990('0x1'),_0x4990('0x2'),_0x4990('0x3')];function createListener(_0x1218b7,_0x2abfab){return function(_0x18e3d4){_0x2abfab['emit'](_0x1218b7,_0x18e3d4);};}function removeListener(_0x56e00d,_0x21b12e){return function(){DashboardEvents['removeListener'](_0x56e00d,_0x21b12e);};}exports[_0x4990('0x4')]=function(_0x157a45){for(var _0xce92f7=0x0,_0x2eb092=events[_0x4990('0x5')];_0xce92f7<_0x2eb092;_0xce92f7++){var _0x216097=events[_0xce92f7];var _0x46fcc9=createListener(_0x4990('0x6')+_0x216097,_0x157a45);DashboardEvents['on'](_0x216097,_0x46fcc9);}}; \ No newline at end of file +var _0x64c4=['./dashboard.events','save','remove','update','emit','removeListener','register','length','dashboard:'];(function(_0x290a92,_0x389e67){var _0xe81d11=function(_0x2739c6){while(--_0x2739c6){_0x290a92['push'](_0x290a92['shift']());}};_0xe81d11(++_0x389e67);}(_0x64c4,0x1ef));var _0x464c=function(_0x519ba,_0x50baa4){_0x519ba=_0x519ba-0x0;var _0x2687ff=_0x64c4[_0x519ba];return _0x2687ff;};'use strict';var DashboardEvents=require(_0x464c('0x0'));var events=[_0x464c('0x1'),_0x464c('0x2'),_0x464c('0x3')];function createListener(_0x448bd0,_0x1d4ac5){return function(_0x3c8e4d){_0x1d4ac5[_0x464c('0x4')](_0x448bd0,_0x3c8e4d);};}function removeListener(_0x2689dc,_0x2c5c3f){return function(){DashboardEvents[_0x464c('0x5')](_0x2689dc,_0x2c5c3f);};}exports[_0x464c('0x6')]=function(_0x464d19){for(var _0x318ddc=0x0,_0x8eaec6=events[_0x464c('0x7')];_0x318ddc<_0x8eaec6;_0x318ddc++){var _0x527eb4=events[_0x318ddc];var _0x1112dc=createListener(_0x464c('0x8')+_0x527eb4,_0x464d19);DashboardEvents['on'](_0x527eb4,_0x1112dc);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 35cef99..eb1a59d 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x19ada0,_0x2a218a){var _0x2edc59=function(_0x31c7de){while(--_0x31c7de){_0x19ada0['push'](_0x19ada0['shift']());}};_0x2edc59(++_0x2a218a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x525bcf,_0x428c0c){var _0x4c3486=function(_0xf87f2){while(--_0xf87f2){_0x525bcf['push'](_0x525bcf['shift']());}};_0x4c3486(++_0x428c0c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8064e6c..0e709c3 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6f7=['squel','lodash','STRING','TEXT','parse','attrs','setDataValue','INTEGER','#ffffff','sequelize'];(function(_0x107959,_0x5d56ab){var _0x551aa4=function(_0x32861f){while(--_0x32861f){_0x107959['push'](_0x107959['shift']());}};_0x551aa4(++_0x5d56ab);}(_0xc6f7,0x15d));var _0x7c6f=function(_0x2c9635,_0x5e29b2){_0x2c9635=_0x2c9635-0x0;var _0x416b7f=_0xc6f7[_0x2c9635];return _0x416b7f;};'use strict';var Sequelize=require(_0x7c6f('0x0'));var squel=require(_0x7c6f('0x1'));var _=require(_0x7c6f('0x2'));module['exports']={'title':{'type':Sequelize[_0x7c6f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7c6f('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7c6f('0x4')]('long'),'get':function(){try{return JSON[_0x7c6f('0x5')](this['getDataValue'](_0x7c6f('0x6')));}catch(_0x37cbac){return[];}},'set':function(_0x3f4c35){try{this[_0x7c6f('0x7')](_0x7c6f('0x6'),JSON['stringify'](_0x3f4c35));}catch(_0x316f4f){this['setDataValue']('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x7c6f('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7c6f('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7c6f('0x8')]},'col':{'type':Sequelize[_0x7c6f('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7c6f('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7c6f('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7c6f('0x3')]}}; \ No newline at end of file +var _0xdf2a=['setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','getDataValue','attrs'];(function(_0x69eeaa,_0x495ec4){var _0xbf9605=function(_0x5464c8){while(--_0x5464c8){_0x69eeaa['push'](_0x69eeaa['shift']());}};_0xbf9605(++_0x495ec4);}(_0xdf2a,0x83));var _0xadf2=function(_0x1b2812,_0x4e1c67){_0x1b2812=_0x1b2812-0x0;var _0x5df4f0=_0xdf2a[_0x1b2812];return _0x5df4f0;};'use strict';var Sequelize=require(_0xadf2('0x0'));var squel=require(_0xadf2('0x1'));var _=require(_0xadf2('0x2'));module[_0xadf2('0x3')]={'title':{'type':Sequelize[_0xadf2('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xadf2('0x5')](_0xadf2('0x6')),'get':function(){try{return JSON['parse'](this[_0xadf2('0x7')](_0xadf2('0x8')));}catch(_0xd4fa1e){return[];}},'set':function(_0x58150b){try{this[_0xadf2('0x9')](_0xadf2('0x8'),JSON[_0xadf2('0xa')](_0x58150b));}catch(_0x4bbca3){this[_0xadf2('0x9')](_0xadf2('0x8'),JSON[_0xadf2('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0xadf2('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xadf2('0xb')]},'col':{'type':Sequelize[_0xadf2('0xb')]},'background':{'type':Sequelize[_0xadf2('0x4')],'allowNull':![],'defaultValue':_0xadf2('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xadf2('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 38ac433..4d0f94f 100644 --- a/server/api/dashboardItem/dashboardItem.controller.js +++ b/server/api/dashboardItem/dashboardItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d4a=['attrMetric','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','reportType','type','attrReport','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','show','params','model','keys','DashboardItem','query','filters','intersection','fields','attributes','length','include','merge','find','catch','iframe','attrUrl','attrs','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','counter'];(function(_0xd27f6e,_0x499513){var _0x5b9e3c=function(_0x80e5fd){while(--_0x80e5fd){_0xd27f6e['push'](_0xd27f6e['shift']());}};_0x5b9e3c(++_0x499513);}(_0x1d4a,0x10e));var _0xa1d4=function(_0x4cbccf,_0x239158){_0x4cbccf=_0x4cbccf-0x0;var _0x366ed5=_0x1d4a[_0x4cbccf];return _0x366ed5;};'use strict';var pdf=require(_0xa1d4('0x0'));var emlformat=require(_0xa1d4('0x1'));var rimraf=require(_0xa1d4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1d4('0x3'));var rp=require('request-promise');var moment=require(_0xa1d4('0x4'));var BPromise=require(_0xa1d4('0x5'));var Mustache=require(_0xa1d4('0x6'));var util=require(_0xa1d4('0x7'));var path=require(_0xa1d4('0x8'));var sox=require(_0xa1d4('0x9'));var csv=require('to-csv');var ejs=require(_0xa1d4('0xa'));var fs=require('fs');var _=require(_0xa1d4('0xb'));var squel=require(_0xa1d4('0xc'));var crypto=require('crypto');var jsforce=require(_0xa1d4('0xd'));var deskjs=require(_0xa1d4('0xe'));var toCsv=require(_0xa1d4('0xf'));var querystring=require('querystring');var Papa=require(_0xa1d4('0x10'));var Redis=require('ioredis');var authService=require(_0xa1d4('0x11'));var qs=require(_0xa1d4('0x12'));var as=require(_0xa1d4('0x13'));var hardwareService=require(_0xa1d4('0x14'));var logger=require(_0xa1d4('0x15'))(_0xa1d4('0x16'));var utils=require('../../config/utils');var config=require(_0xa1d4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1d4('0x18'))['db'];config[_0xa1d4('0x19')]=_['defaults'](config[_0xa1d4('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1d4('0x1a'))(new Redis(config[_0xa1d4('0x19')]));require(_0xa1d4('0x1b'))['register'](socket);function respondWithStatusCode(_0x443cee,_0x4e43bc){_0x4e43bc=_0x4e43bc||0xcc;return function(_0x110481){if(_0x110481){return _0x443cee[_0xa1d4('0x1c')](_0x4e43bc);}return _0x443cee[_0xa1d4('0x1d')](_0x4e43bc)[_0xa1d4('0x1e')]();};}function respondWithResult(_0x1ec801,_0x3db001){_0x3db001=_0x3db001||0xc8;return function(_0x22cfe1){if(_0x22cfe1){return _0x1ec801[_0xa1d4('0x1d')](_0x3db001)['json'](_0x22cfe1);}};}function respondWithFilteredResult(_0x318a78,_0x36a6a8){return function(_0xe0b012){if(_0xe0b012){var _0x119803=_0xe0b012[_0xa1d4('0x1f')],_0x3a6d84=_0x36a6a8[_0xa1d4('0x20')],_0x101b0d=_0x36a6a8[_0xa1d4('0x20')]+_0x36a6a8[_0xa1d4('0x21')],_0x241d14;if(_0x101b0d>=_0x119803){_0x101b0d=_0x119803;_0x241d14=0xc8;}else{_0x241d14=0xce;}_0x318a78['status'](_0x241d14);return _0x318a78[_0xa1d4('0x22')](_0xa1d4('0x23'),_0x3a6d84+'-'+_0x101b0d+'/'+_0x119803)[_0xa1d4('0x24')](_0xe0b012);}return null;};}function patchUpdates(_0x4d33d8){return function(_0x3409ed){try{jsonpatch['apply'](_0x3409ed,_0x4d33d8,!![]);}catch(_0x110b6b){return BPromise[_0xa1d4('0x25')](_0x110b6b);}return _0x3409ed[_0xa1d4('0x26')]();};}function saveUpdates(_0x3696e1,_0x141799){return function(_0x5204ee){if(_0x5204ee){return _0x5204ee[_0xa1d4('0x27')](_0x3696e1)[_0xa1d4('0x28')](function(_0x3f7de2){return _0x3f7de2;});}return null;};}function removeEntity(_0x5d176e,_0x27e5e7){return function(_0x143ea7){if(_0x143ea7){return _0x143ea7[_0xa1d4('0x29')]()['then'](function(){_0x5d176e[_0xa1d4('0x1d')](0xcc)[_0xa1d4('0x1e')]();});}};}function handleEntityNotFound(_0x1e3ab4,_0x3dde58){return function(_0x766e65){if(!_0x766e65){_0x1e3ab4[_0xa1d4('0x1c')](0x194);}return _0x766e65;};}function handleError(_0x252522,_0x128be6){_0x128be6=_0x128be6||0x1f4;return function(_0x4a36af){logger[_0xa1d4('0x2a')](_0x4a36af['stack']);if(_0x4a36af[_0xa1d4('0x2b')]){delete _0x4a36af['name'];}_0x252522[_0xa1d4('0x1d')](_0x128be6)[_0xa1d4('0x2c')](_0x4a36af);};}exports[_0xa1d4('0x2d')]=function(_0x4f09cb,_0x34934e){var _0x5bf247={'raw':![],'where':{'id':_0x4f09cb[_0xa1d4('0x2e')]['id']}},_0x1c5201={};_0x1c5201[_0xa1d4('0x2f')]=_[_0xa1d4('0x30')](db[_0xa1d4('0x31')]['rawAttributes']);_0x1c5201[_0xa1d4('0x32')]=_['keys'](_0x4f09cb[_0xa1d4('0x32')]);_0x1c5201[_0xa1d4('0x33')]=_[_0xa1d4('0x34')](_0x1c5201[_0xa1d4('0x2f')],_0x1c5201['query']);_0x5bf247['attributes']=_[_0xa1d4('0x34')](_0x1c5201[_0xa1d4('0x2f')],qs[_0xa1d4('0x35')](_0x4f09cb['query'][_0xa1d4('0x35')]));_0x5bf247[_0xa1d4('0x36')]=_0x5bf247[_0xa1d4('0x36')][_0xa1d4('0x37')]?_0x5bf247['attributes']:_0x1c5201[_0xa1d4('0x2f')];if(_0x4f09cb[_0xa1d4('0x32')]['includeAll']){_0x5bf247[_0xa1d4('0x38')]=[{'all':!![]}];}_0x5bf247=_[_0xa1d4('0x39')]({},_0x5bf247,_0x4f09cb['options']);return db[_0xa1d4('0x31')][_0xa1d4('0x3a')](_0x5bf247)[_0xa1d4('0x28')](handleEntityNotFound(_0x34934e,null))[_0xa1d4('0x28')](respondWithResult(_0x34934e,null))[_0xa1d4('0x3b')](handleError(_0x34934e,null));};exports['destroy']=function(_0x2ef796,_0x274027){return db['DashboardItem'][_0xa1d4('0x3a')]({'where':{'id':_0x2ef796[_0xa1d4('0x2e')]['id']}})[_0xa1d4('0x28')](handleEntityNotFound(_0x274027,null))[_0xa1d4('0x28')](removeEntity(_0x274027,null))['catch'](handleError(_0x274027,null));};function widgetAttributes(_0x4f8196){try{switch(_0x4f8196['type']){case _0xa1d4('0x3c'):return[{'name':_0xa1d4('0x3d'),'value':_0x4f8196['attrUrl']||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196['attrs'][0x0]?_0x4f8196[_0xa1d4('0x3e')][0x0]['value']:undefined)||'https://'}];case _0xa1d4('0x3f'):return[{'name':_0xa1d4('0x40'),'value':_0x4f8196[_0xa1d4('0x40')]||(_0x4f8196['attrs']&&_0x4f8196['attrs'][0x0]?_0x4f8196[_0xa1d4('0x3e')][0x0][_0xa1d4('0x41')]:undefined)||''}];case'clock':return[{'name':_0xa1d4('0x42'),'value':_0x4f8196[_0xa1d4('0x42')]||(_0x4f8196['attrs']&&_0x4f8196[_0xa1d4('0x3e')][0x0]?_0x4f8196[_0xa1d4('0x3e')][0x0][_0xa1d4('0x41')]:undefined)||_0xa1d4('0x43')},{'name':_0xa1d4('0x44'),'value':_0x4f8196[_0xa1d4('0x44')]||(_0x4f8196['attrs']&&_0x4f8196[_0xa1d4('0x3e')][0x1]?_0x4f8196[_0xa1d4('0x3e')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x4f8196['attrFontSize']||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196['attrs'][0x2]?_0x4f8196[_0xa1d4('0x3e')][0x2]['value']:undefined)||0xc}];case _0xa1d4('0x45'):return[{'name':_0xa1d4('0x46'),'value':_0x4f8196[_0xa1d4('0x46')]||(_0x4f8196['attrs']&&_0x4f8196[_0xa1d4('0x3e')][0x0]?_0x4f8196[_0xa1d4('0x3e')][0x0][_0xa1d4('0x41')]:undefined)||'total'},{'name':_0xa1d4('0x47'),'value':_0x4f8196['attrVoiceQueues']||(_0x4f8196['attrs']&&_0x4f8196[_0xa1d4('0x3e')][0x1]?_0x4f8196[_0xa1d4('0x3e')][0x1][_0xa1d4('0x41')]:undefined)||[]},{'name':_0xa1d4('0x48'),'value':_0x4f8196[_0xa1d4('0x48')]||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196[_0xa1d4('0x3e')][0x2]?_0x4f8196[_0xa1d4('0x3e')][0x2][_0xa1d4('0x41')]:undefined)||0x14}];case _0xa1d4('0x49'):case'pie-chart':return[{'name':_0xa1d4('0x4a'),'value':_0x4f8196['attrSerie1']||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196[_0xa1d4('0x3e')][0x0]?_0x4f8196[_0xa1d4('0x3e')][0x0][_0xa1d4('0x41')]:undefined)||_0xa1d4('0x4b')},{'name':_0xa1d4('0x4c'),'value':_0x4f8196['attrSerie2']||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196[_0xa1d4('0x3e')][0x1]?_0x4f8196[_0xa1d4('0x3e')][0x1][_0xa1d4('0x41')]:undefined)||null},{'name':_0xa1d4('0x4d'),'value':_0x4f8196['attrSerie3']||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196[_0xa1d4('0x3e')][0x2]?_0x4f8196['attrs'][0x2][_0xa1d4('0x41')]:undefined)||null},{'name':_0xa1d4('0x47'),'value':_0x4f8196['attrVoiceQueues']||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196[_0xa1d4('0x3e')][0x3]?_0x4f8196[_0xa1d4('0x3e')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x4f8196[_0xa1d4('0x4e')]||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196[_0xa1d4('0x3e')][0x0]?_0x4f8196[_0xa1d4('0x3e')][0x0][_0xa1d4('0x4f')]:undefined)||null,'value':_0x4f8196[_0xa1d4('0x50')]||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196['attrs'][0x0]?_0x4f8196[_0xa1d4('0x3e')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4f8196['attrRefresh']||(_0x4f8196[_0xa1d4('0x3e')]&&_0x4f8196['attrs'][0x1]?_0x4f8196[_0xa1d4('0x3e')][0x1][_0xa1d4('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x35b5e2){logger[_0xa1d4('0x2a')](_0xa1d4('0x51'),JSON[_0xa1d4('0x52')](_0x35b5e2));return[];}}exports[_0xa1d4('0x53')]=function(_0x30241d,_0x3e97c7){if(_0x30241d['body']){_0x30241d[_0xa1d4('0x54')][_0xa1d4('0x3e')]=widgetAttributes(_0x30241d['body']);}return db['DashboardItem']['create'](_0x30241d[_0xa1d4('0x54')],{})[_0xa1d4('0x28')](respondWithResult(_0x3e97c7,0xc9))[_0xa1d4('0x3b')](handleError(_0x3e97c7,null));};exports[_0xa1d4('0x27')]=function(_0x394b93,_0x4af07e){if(_0x394b93[_0xa1d4('0x54')]['id']){delete _0x394b93[_0xa1d4('0x54')]['id'];}_0x394b93[_0xa1d4('0x54')][_0xa1d4('0x3e')]=widgetAttributes(_0x394b93[_0xa1d4('0x54')]);return db[_0xa1d4('0x31')][_0xa1d4('0x3a')]({'where':{'id':_0x394b93[_0xa1d4('0x2e')]['id']}})[_0xa1d4('0x28')](handleEntityNotFound(_0x4af07e,null))[_0xa1d4('0x28')](saveUpdates(_0x394b93['body'],null))[_0xa1d4('0x28')](respondWithResult(_0x4af07e,null))[_0xa1d4('0x3b')](handleError(_0x4af07e,null));}; \ No newline at end of file +var _0x0e87=['then','destroy','end','error','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','model','length','merge','options','catch','find','type','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','value','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x31ecaf,_0x5a75fb){var _0x7a1567=function(_0x429ffe){while(--_0x429ffe){_0x31ecaf['push'](_0x31ecaf['shift']());}};_0x7a1567(++_0x5a75fb);}(_0x0e87,0x8d));var _0x70e8=function(_0x3c6708,_0x115bc4){_0x3c6708=_0x3c6708-0x0;var _0xd7c998=_0x0e87[_0x3c6708];return _0xd7c998;};'use strict';var pdf=require(_0x70e8('0x0'));var emlformat=require(_0x70e8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x70e8('0x2'));var jsonpatch=require(_0x70e8('0x3'));var rp=require('request-promise');var moment=require(_0x70e8('0x4'));var BPromise=require(_0x70e8('0x5'));var Mustache=require(_0x70e8('0x6'));var util=require(_0x70e8('0x7'));var path=require(_0x70e8('0x8'));var sox=require(_0x70e8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x70e8('0xa'));var squel=require(_0x70e8('0xb'));var crypto=require('crypto');var jsforce=require(_0x70e8('0xc'));var deskjs=require(_0x70e8('0xd'));var toCsv=require(_0x70e8('0xe'));var querystring=require(_0x70e8('0xf'));var Papa=require(_0x70e8('0x10'));var Redis=require(_0x70e8('0x11'));var authService=require(_0x70e8('0x12'));var qs=require(_0x70e8('0x13'));var as=require(_0x70e8('0x14'));var hardwareService=require(_0x70e8('0x15'));var logger=require(_0x70e8('0x16'))(_0x70e8('0x17'));var utils=require(_0x70e8('0x18'));var config=require(_0x70e8('0x19'));var licenseUtil=require(_0x70e8('0x1a'));var db=require(_0x70e8('0x1b'))['db'];config[_0x70e8('0x1c')]=_[_0x70e8('0x1d')](config['redis'],{'host':_0x70e8('0x1e'),'port':0x18eb});var socket=require(_0x70e8('0x1f'))(new Redis(config[_0x70e8('0x1c')]));require(_0x70e8('0x20'))['register'](socket);function respondWithStatusCode(_0x545a59,_0x1f52e1){_0x1f52e1=_0x1f52e1||0xcc;return function(_0x29d342){if(_0x29d342){return _0x545a59[_0x70e8('0x21')](_0x1f52e1);}return _0x545a59[_0x70e8('0x22')](_0x1f52e1)['end']();};}function respondWithResult(_0x2bd472,_0x1f55ad){_0x1f55ad=_0x1f55ad||0xc8;return function(_0x8c48){if(_0x8c48){return _0x2bd472[_0x70e8('0x22')](_0x1f55ad)[_0x70e8('0x23')](_0x8c48);}};}function respondWithFilteredResult(_0x407bab,_0x358eb8){return function(_0xf47cb9){if(_0xf47cb9){var _0x529c82=_0xf47cb9[_0x70e8('0x24')],_0x5ba6fe=_0x358eb8[_0x70e8('0x25')],_0x318fb4=_0x358eb8['offset']+_0x358eb8[_0x70e8('0x26')],_0x4be1c9;if(_0x318fb4>=_0x529c82){_0x318fb4=_0x529c82;_0x4be1c9=0xc8;}else{_0x4be1c9=0xce;}_0x407bab[_0x70e8('0x22')](_0x4be1c9);return _0x407bab[_0x70e8('0x27')](_0x70e8('0x28'),_0x5ba6fe+'-'+_0x318fb4+'/'+_0x529c82)[_0x70e8('0x23')](_0xf47cb9);}return null;};}function patchUpdates(_0x21b9b8){return function(_0x26d0f8){try{jsonpatch[_0x70e8('0x29')](_0x26d0f8,_0x21b9b8,!![]);}catch(_0x43b30){return BPromise[_0x70e8('0x2a')](_0x43b30);}return _0x26d0f8[_0x70e8('0x2b')]();};}function saveUpdates(_0x301011,_0x18428d){return function(_0x5d2d0b){if(_0x5d2d0b){return _0x5d2d0b[_0x70e8('0x2c')](_0x301011)[_0x70e8('0x2d')](function(_0x182896){return _0x182896;});}return null;};}function removeEntity(_0x298b97,_0x18e357){return function(_0x29c6a2){if(_0x29c6a2){return _0x29c6a2[_0x70e8('0x2e')]()[_0x70e8('0x2d')](function(){_0x298b97[_0x70e8('0x22')](0xcc)[_0x70e8('0x2f')]();});}};}function handleEntityNotFound(_0x5a515b,_0x19f56a){return function(_0x4b850a){if(!_0x4b850a){_0x5a515b['sendStatus'](0x194);}return _0x4b850a;};}function handleError(_0x18e2af,_0x96d76b){_0x96d76b=_0x96d76b||0x1f4;return function(_0x2ede28){logger[_0x70e8('0x30')](_0x2ede28[_0x70e8('0x31')]);if(_0x2ede28[_0x70e8('0x32')]){delete _0x2ede28[_0x70e8('0x32')];}_0x18e2af['status'](_0x96d76b)[_0x70e8('0x33')](_0x2ede28);};}exports[_0x70e8('0x34')]=function(_0x4e4d26,_0x2eb053){var _0x30ed2a={'raw':![],'where':{'id':_0x4e4d26['params']['id']}},_0x365465={};_0x365465['model']=_[_0x70e8('0x35')](db[_0x70e8('0x36')][_0x70e8('0x37')]);_0x365465[_0x70e8('0x38')]=_[_0x70e8('0x35')](_0x4e4d26[_0x70e8('0x38')]);_0x365465[_0x70e8('0x39')]=_[_0x70e8('0x3a')](_0x365465['model'],_0x365465[_0x70e8('0x38')]);_0x30ed2a[_0x70e8('0x3b')]=_['intersection'](_0x365465[_0x70e8('0x3c')],qs['fields'](_0x4e4d26[_0x70e8('0x38')]['fields']));_0x30ed2a[_0x70e8('0x3b')]=_0x30ed2a[_0x70e8('0x3b')][_0x70e8('0x3d')]?_0x30ed2a[_0x70e8('0x3b')]:_0x365465[_0x70e8('0x3c')];if(_0x4e4d26['query']['includeAll']){_0x30ed2a['include']=[{'all':!![]}];}_0x30ed2a=_[_0x70e8('0x3e')]({},_0x30ed2a,_0x4e4d26[_0x70e8('0x3f')]);return db[_0x70e8('0x36')]['find'](_0x30ed2a)['then'](handleEntityNotFound(_0x2eb053,null))['then'](respondWithResult(_0x2eb053,null))[_0x70e8('0x40')](handleError(_0x2eb053,null));};exports[_0x70e8('0x2e')]=function(_0x6ab7e9,_0x14f9c8){return db[_0x70e8('0x36')][_0x70e8('0x41')]({'where':{'id':_0x6ab7e9['params']['id']}})[_0x70e8('0x2d')](handleEntityNotFound(_0x14f9c8,null))[_0x70e8('0x2d')](removeEntity(_0x14f9c8,null))[_0x70e8('0x40')](handleError(_0x14f9c8,null));};function widgetAttributes(_0x54b589){try{switch(_0x54b589[_0x70e8('0x42')]){case'iframe':return[{'name':_0x70e8('0x43'),'value':_0x54b589[_0x70e8('0x43')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589['attrs'][0x0]['value']:undefined)||'https://'}];case _0x70e8('0x45'):return[{'name':'attrPath','value':_0x54b589[_0x70e8('0x46')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0]['value']:undefined)||''}];case _0x70e8('0x47'):return[{'name':_0x70e8('0x48'),'value':_0x54b589[_0x70e8('0x48')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0][_0x70e8('0x49')]:undefined)||'HH:mm:ss'},{'name':_0x70e8('0x4a'),'value':_0x54b589[_0x70e8('0x4a')]||(_0x54b589['attrs']&&_0x54b589[_0x70e8('0x44')][0x1]?_0x54b589[_0x70e8('0x44')][0x1][_0x70e8('0x49')]:undefined)||_0x70e8('0x4b')},{'name':_0x70e8('0x4c'),'value':_0x54b589[_0x70e8('0x4c')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x2]?_0x54b589[_0x70e8('0x44')][0x2][_0x70e8('0x49')]:undefined)||0xc}];case _0x70e8('0x4d'):return[{'name':_0x70e8('0x4e'),'value':_0x54b589[_0x70e8('0x4e')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589['attrs'][0x0]?_0x54b589[_0x70e8('0x44')][0x0]['value']:undefined)||_0x70e8('0x4f')},{'name':_0x70e8('0x50'),'value':_0x54b589[_0x70e8('0x50')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x1]?_0x54b589[_0x70e8('0x44')][0x1][_0x70e8('0x49')]:undefined)||[]},{'name':_0x70e8('0x4c'),'value':_0x54b589['attrFontSize']||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x2]?_0x54b589[_0x70e8('0x44')][0x2][_0x70e8('0x49')]:undefined)||0x14}];case'multibar-chart':case _0x70e8('0x51'):return[{'name':_0x70e8('0x52'),'value':_0x54b589[_0x70e8('0x52')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0][_0x70e8('0x49')]:undefined)||_0x70e8('0x4f')},{'name':_0x70e8('0x53'),'value':_0x54b589[_0x70e8('0x53')]||(_0x54b589['attrs']&&_0x54b589[_0x70e8('0x44')][0x1]?_0x54b589['attrs'][0x1][_0x70e8('0x49')]:undefined)||null},{'name':'attrSerie3','value':_0x54b589[_0x70e8('0x54')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x2]?_0x54b589[_0x70e8('0x44')][0x2]['value']:undefined)||null},{'name':_0x70e8('0x50'),'value':_0x54b589['attrVoiceQueues']||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x3]?_0x54b589[_0x70e8('0x44')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x54b589[_0x70e8('0x55')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0][_0x70e8('0x42')]:undefined)||null,'value':_0x54b589[_0x70e8('0x56')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0]['value']:undefined)||null},{'name':_0x70e8('0x57'),'value':_0x54b589['attrRefresh']||(_0x54b589['attrs']&&_0x54b589[_0x70e8('0x44')][0x1]?_0x54b589[_0x70e8('0x44')][0x1][_0x70e8('0x49')]:undefined)||0x0}];default:return[];}}catch(_0x55d482){logger[_0x70e8('0x30')](_0x70e8('0x58'),JSON[_0x70e8('0x59')](_0x55d482));return[];}}exports[_0x70e8('0x5a')]=function(_0x440d8b,_0xa151bd){if(_0x440d8b['body']){_0x440d8b['body'][_0x70e8('0x44')]=widgetAttributes(_0x440d8b['body']);}return db[_0x70e8('0x36')][_0x70e8('0x5a')](_0x440d8b[_0x70e8('0x5b')],{})[_0x70e8('0x2d')](respondWithResult(_0xa151bd,0xc9))[_0x70e8('0x40')](handleError(_0xa151bd,null));};exports[_0x70e8('0x2c')]=function(_0xeade6a,_0x4c50bd){if(_0xeade6a[_0x70e8('0x5b')]['id']){delete _0xeade6a[_0x70e8('0x5b')]['id'];}_0xeade6a['body']['attrs']=widgetAttributes(_0xeade6a['body']);return db[_0x70e8('0x36')][_0x70e8('0x41')]({'where':{'id':_0xeade6a[_0x70e8('0x5c')]['id']}})[_0x70e8('0x2d')](handleEntityNotFound(_0x4c50bd,null))['then'](saveUpdates(_0xeade6a['body'],null))[_0x70e8('0x2d')](respondWithResult(_0x4c50bd,null))[_0x70e8('0x40')](handleError(_0x4c50bd,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 94dea9d..6b6dd2a 100644 --- a/server/api/dashboardItem/dashboardItem.events.js +++ b/server/api/dashboardItem/dashboardItem.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e6a=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x50a1f6,_0x238fd8){var _0x84f8d4=function(_0x2d9586){while(--_0x2d9586){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x84f8d4(++_0x238fd8);}(_0x0e6a,0x100));var _0xa0e6=function(_0xf96956,_0x201650){_0xf96956=_0xf96956-0x0;var _0x314653=_0x0e6a[_0xf96956];return _0x314653;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xa0e6('0x0'))['db'][_0xa0e6('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa0e6('0x2')](0x0);var events={'afterCreate':_0xa0e6('0x3'),'afterUpdate':_0xa0e6('0x4'),'afterDestroy':_0xa0e6('0x5')};function emitEvent(_0x4b9ee9){return function(_0xcd5884,_0x19cadf,_0x3b4ce9){DashboardItemEvents[_0xa0e6('0x6')](_0x4b9ee9+':'+_0xcd5884['id'],_0xcd5884);DashboardItemEvents[_0xa0e6('0x6')](_0x4b9ee9,_0xcd5884);_0x3b4ce9(null);};}for(var e in events){if(events[_0xa0e6('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x2c7b=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x3ca273,_0x2e2a69){var _0x182fa0=function(_0x55fd1b){while(--_0x55fd1b){_0x3ca273['push'](_0x3ca273['shift']());}};_0x182fa0(++_0x2e2a69);}(_0x2c7b,0x1af));var _0xb2c7=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2c7b[_0x55f8b4];return _0x2475f9;};'use strict';var EventEmitter=require(_0xb2c7('0x0'));var DashboardItem=require(_0xb2c7('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb2c7('0x2')](0x0);var events={'afterCreate':_0xb2c7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x25acf7){return function(_0x3dfc62,_0x1febb1,_0x167e83){DashboardItemEvents[_0xb2c7('0x4')](_0x25acf7+':'+_0x3dfc62['id'],_0x3dfc62);DashboardItemEvents['emit'](_0x25acf7,_0x3dfc62);_0x167e83(null);};}for(var e in events){if(events[_0xb2c7('0x5')](e)){var event=events[e];DashboardItem[_0xb2c7('0x6')](e,emitEvent(event));}}module[_0xb2c7('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 816d732..fa40967 100644 --- a/server/api/dashboardItem/dashboardItem.model.js +++ b/server/api/dashboardItem/dashboardItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52f5=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','util','../../config/logger','api','moment','bluebird'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0x52f5,0x183));var _0x552f=function(_0x4a9a93,_0x4576b3){_0x4a9a93=_0x4a9a93-0x0;var _0x4a8bee=_0x52f5[_0x4a9a93];return _0x4a8bee;};'use strict';var _=require('lodash');var util=require(_0x552f('0x0'));var logger=require(_0x552f('0x1'))(_0x552f('0x2'));var moment=require(_0x552f('0x3'));var BPromise=require(_0x552f('0x4'));var rp=require(_0x552f('0x5'));var fs=require('fs');var path=require(_0x552f('0x6'));var rimraf=require(_0x552f('0x7'));var config=require(_0x552f('0x8'));var attributes=require(_0x552f('0x9'));module[_0x552f('0xa')]=function(_0x11ab10,_0x46839b){return _0x11ab10[_0x552f('0xb')](_0x552f('0xc'),attributes,{'tableName':_0x552f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0b6=['./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46f4aa,_0x3086e6){var _0x197c3a=function(_0x5cf206){while(--_0x5cf206){_0x46f4aa['push'](_0x46f4aa['shift']());}};_0x197c3a(++_0x3086e6);}(_0xb0b6,0x122));var _0x6b0b=function(_0x483005,_0x175491){_0x483005=_0x483005-0x0;var _0x4a082f=_0xb0b6[_0x483005];return _0x4a082f;};'use strict';var _=require(_0x6b0b('0x0'));var util=require(_0x6b0b('0x1'));var logger=require(_0x6b0b('0x2'))(_0x6b0b('0x3'));var moment=require('moment');var BPromise=require(_0x6b0b('0x4'));var rp=require(_0x6b0b('0x5'));var fs=require('fs');var path=require(_0x6b0b('0x6'));var rimraf=require(_0x6b0b('0x7'));var config=require(_0x6b0b('0x8'));var attributes=require(_0x6b0b('0x9'));module['exports']=function(_0x205fe8,_0x5cd8cc){return _0x205fe8[_0x6b0b('0xa')](_0x6b0b('0xb'),attributes,{'tableName':_0x6b0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 1b0f085..98fadde 100644 --- a/server/api/dashboardItem/dashboardItem.rpc.js +++ b/server/api/dashboardItem/dashboardItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fa5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','lodash'];(function(_0x2e2af5,_0x395389){var _0x2945ea=function(_0x403d7e){while(--_0x403d7e){_0x2e2af5['push'](_0x2e2af5['shift']());}};_0x2945ea(++_0x395389);}(_0x9fa5,0x1ec));var _0x59fa=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x9fa5[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x59fa('0x0'));var util=require(_0x59fa('0x1'));var moment=require(_0x59fa('0x2'));var BPromise=require(_0x59fa('0x3'));var rs=require(_0x59fa('0x4'));var fs=require('fs');var Redis=require(_0x59fa('0x5'));var db=require(_0x59fa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x59fa('0x7'))(_0x59fa('0x8'));var config=require(_0x59fa('0x9'));var jayson=require(_0x59fa('0xa'));var client=jayson[_0x59fa('0xb')][_0x59fa('0xc')]({'port':0x232a});config['redis']=_[_0x59fa('0xd')](config['redis'],{'host':_0x59fa('0xe'),'port':0x18eb});var socket=require(_0x59fa('0xf'))(new Redis(config[_0x59fa('0x10')]));require(_0x59fa('0x11'))[_0x59fa('0x12')](socket);function respondWithRpcPromise(_0x44bdc2,_0x111d8e,_0x22dbf5){return new BPromise(function(_0x4258da,_0x172783){return client[_0x59fa('0x13')](_0x44bdc2,_0x22dbf5)[_0x59fa('0x14')](function(_0x263f19){logger[_0x59fa('0x15')]('DashboardItem,\x20%s,\x20%s',_0x111d8e,_0x59fa('0x16'));logger['debug'](_0x59fa('0x17'),_0x111d8e,'request\x20sent',JSON[_0x59fa('0x18')](_0x263f19));if(_0x263f19[_0x59fa('0x19')]){if(_0x263f19[_0x59fa('0x19')][_0x59fa('0x1a')]===0x1f4){logger[_0x59fa('0x19')](_0x59fa('0x1b'),_0x111d8e,_0x263f19['error']['message']);return _0x172783(_0x263f19['error'][_0x59fa('0x1c')]);}logger[_0x59fa('0x19')](_0x59fa('0x1b'),_0x111d8e,_0x263f19[_0x59fa('0x19')]['message']);return _0x4258da(_0x263f19['error'][_0x59fa('0x1c')]);}else{logger[_0x59fa('0x15')](_0x59fa('0x1b'),_0x111d8e,_0x59fa('0x16'));_0x4258da(_0x263f19['result'][_0x59fa('0x1c')]);}})['catch'](function(_0x35fb7c){logger[_0x59fa('0x19')](_0x59fa('0x1b'),_0x111d8e,_0x35fb7c);_0x172783(_0x35fb7c);});});} \ No newline at end of file +var _0x5488=['stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x4503ef,_0x2189f0){var _0x11c4d6=function(_0x1387c9){while(--_0x1387c9){_0x4503ef['push'](_0x4503ef['shift']());}};_0x11c4d6(++_0x2189f0);}(_0x5488,0x163));var _0x8548=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x5488[_0xe719ec];return _0x4842a1;};'use strict';var _=require(_0x8548('0x0'));var util=require('util');var moment=require(_0x8548('0x1'));var BPromise=require(_0x8548('0x2'));var rs=require(_0x8548('0x3'));var fs=require('fs');var Redis=require(_0x8548('0x4'));var db=require(_0x8548('0x5'))['db'];var utils=require(_0x8548('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8548('0x7'));var jayson=require(_0x8548('0x8'));var client=jayson['client'][_0x8548('0x9')]({'port':0x232a});config[_0x8548('0xa')]=_[_0x8548('0xb')](config['redis'],{'host':_0x8548('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8548('0xa')]));require(_0x8548('0xd'))['register'](socket);function respondWithRpcPromise(_0x272d9b,_0x5a8b31,_0x23144d){return new BPromise(function(_0x1ff695,_0x5928fa){return client['request'](_0x272d9b,_0x23144d)[_0x8548('0xe')](function(_0x4c2f44){logger[_0x8548('0xf')](_0x8548('0x10'),_0x5a8b31,_0x8548('0x11'));logger[_0x8548('0x12')](_0x8548('0x13'),_0x5a8b31,_0x8548('0x11'),JSON[_0x8548('0x14')](_0x4c2f44));if(_0x4c2f44['error']){if(_0x4c2f44[_0x8548('0x15')]['code']===0x1f4){logger['error'](_0x8548('0x10'),_0x5a8b31,_0x4c2f44[_0x8548('0x15')]['message']);return _0x5928fa(_0x4c2f44[_0x8548('0x15')][_0x8548('0x16')]);}logger[_0x8548('0x15')](_0x8548('0x10'),_0x5a8b31,_0x4c2f44['error']['message']);return _0x1ff695(_0x4c2f44['error'][_0x8548('0x16')]);}else{logger['info'](_0x8548('0x10'),_0x5a8b31,'request\x20sent');_0x1ff695(_0x4c2f44[_0x8548('0x17')]['message']);}})[_0x8548('0x18')](function(_0x3b117d){logger[_0x8548('0x15')](_0x8548('0x10'),_0x5a8b31,_0x3b117d);_0x5928fa(_0x3b117d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 61f7619..c390146 100644 --- a/server/api/dashboardItem/dashboardItem.socket.js +++ b/server/api/dashboardItem/dashboardItem.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96b8=['remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x1adf84,_0x132335){var _0x13d54e=function(_0x561d79){while(--_0x561d79){_0x1adf84['push'](_0x1adf84['shift']());}};_0x13d54e(++_0x132335);}(_0x96b8,0x10e));var _0x896b=function(_0x2bd211,_0x522300){_0x2bd211=_0x2bd211-0x0;var _0x5b963e=_0x96b8[_0x2bd211];return _0x5b963e;};'use strict';var DashboardItemEvents=require(_0x896b('0x0'));var events=[_0x896b('0x1'),_0x896b('0x2'),_0x896b('0x3')];function createListener(_0x481a3f,_0x5746c2){return function(_0x2f3641){_0x5746c2[_0x896b('0x4')](_0x481a3f,_0x2f3641);};}function removeListener(_0x19271c,_0xe08392){return function(){DashboardItemEvents[_0x896b('0x5')](_0x19271c,_0xe08392);};}exports['register']=function(_0x5c4e2a){for(var _0x4cf484=0x0,_0x45800f=events[_0x896b('0x6')];_0x4cf484<_0x45800f;_0x4cf484++){var _0x4e1067=events[_0x4cf484];var _0x476fb3=createListener(_0x896b('0x7')+_0x4e1067,_0x5c4e2a);DashboardItemEvents['on'](_0x4e1067,_0x476fb3);}}; \ No newline at end of file +var _0x390f=['emit','removeListener','register','dashboardItem:','./dashboardItem.events','save','remove','update'];(function(_0x2530a3,_0x5717ff){var _0x92c944=function(_0x13414f){while(--_0x13414f){_0x2530a3['push'](_0x2530a3['shift']());}};_0x92c944(++_0x5717ff);}(_0x390f,0x104));var _0xf390=function(_0x1c5b1a,_0x3db3fe){_0x1c5b1a=_0x1c5b1a-0x0;var _0x351b48=_0x390f[_0x1c5b1a];return _0x351b48;};'use strict';var DashboardItemEvents=require(_0xf390('0x0'));var events=[_0xf390('0x1'),_0xf390('0x2'),_0xf390('0x3')];function createListener(_0x36b48a,_0x1445a0){return function(_0x3b761f){_0x1445a0[_0xf390('0x4')](_0x36b48a,_0x3b761f);};}function removeListener(_0x30582b,_0x1ed69b){return function(){DashboardItemEvents[_0xf390('0x5')](_0x30582b,_0x1ed69b);};}exports[_0xf390('0x6')]=function(_0x12d519){for(var _0x4e9d18=0x0,_0x1b4feb=events['length'];_0x4e9d18<_0x1b4feb;_0x4e9d18++){var _0x4929ad=events[_0x4e9d18];var _0x37b005=createListener(_0xf390('0x7')+_0x4929ad,_0x12d519);DashboardItemEvents['on'](_0x4929ad,_0x37b005);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 24e80dd..b1aceb4 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path'];(function(_0x2a5a27,_0x1854a6){var _0xea6787=function(_0xc459f){while(--_0xc459f){_0x2a5a27['push'](_0x2a5a27['shift']());}};_0xea6787(++_0x1854a6);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1af07b,_0x80ec6d){_0x1af07b=_0x1af07b-0x0;var _0x485aa6=_0x1cb9[_0x1af07b];return _0x485aa6;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var controller=require('./dashboardItem.controller');router[_0x91cb('0x7')](_0x91cb('0x8'),auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0xb')]('/',auth[_0x91cb('0x9')](),controller['create']);router[_0x91cb('0xc')]('/:id',auth[_0x91cb('0x9')](),controller['update']);router[_0x91cb('0xd')](_0x91cb('0x8'),auth[_0x91cb('0x9')](),controller[_0x91cb('0xe')]);module[_0x91cb('0xf')]=router; \ No newline at end of file +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x1becd7,_0x14d862){var _0x2205b5=function(_0x307898){while(--_0x307898){_0x1becd7['push'](_0x1becd7['shift']());}};_0x2205b5(++_0x14d862);}(_0x687b,0x14a));var _0xb687=function(_0x153c6c,_0x5aa22f){_0x153c6c=_0x153c6c-0x0;var _0x3c85d3=_0x687b[_0x153c6c];return _0x3c85d3;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0xc')]('/',auth[_0xb687('0xa')](),controller['create']);router[_0xb687('0xd')](_0xb687('0x9'),auth['isAuthenticated'](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f1bf2dd..3b40184 100644 --- a/server/api/disposition/disposition.attributes.js +++ b/server/api/disposition/disposition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5df1=['first','third','STRING','exports','ENUM'];(function(_0x4c9e5f,_0x535e7b){var _0x1d71bb=function(_0x571276){while(--_0x571276){_0x4c9e5f['push'](_0x4c9e5f['shift']());}};_0x1d71bb(++_0x535e7b);}(_0x5df1,0x13e));var _0x15df=function(_0x583dde,_0x57d234){_0x583dde=_0x583dde-0x0;var _0x1abc5c=_0x5df1[_0x583dde];return _0x1abc5c;};'use strict';var Sequelize=require('sequelize');module[_0x15df('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x15df('0x1')](_0x15df('0x2'),'second',_0x15df('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x15df('0x4')]}}; \ No newline at end of file +var _0xae4a=['exports','STRING','ENUM','first','third','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xae4a,0x1c1));var _0xaae4=function(_0x1207e8,_0x32702f){_0x1207e8=_0x1207e8-0x0;var _0x38f90c=_0xae4a[_0x1207e8];return _0x38f90c;};'use strict';var Sequelize=require(_0xaae4('0x0'));module[_0xaae4('0x1')]={'name':{'type':Sequelize[_0xaae4('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xaae4('0x3')](_0xaae4('0x4'),'second',_0xaae4('0x5')),'allowNull':![],'defaultValue':_0xaae4('0x4')},'description':{'type':Sequelize[_0xaae4('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 9b46d49..03e7707 100644 --- a/server/api/disposition/disposition.controller.js +++ b/server/api/disposition/disposition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ad7=['attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','include','rows','catch','show','params','keys','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x5e5630,_0x483721){var _0x429412=function(_0x3b0a8b){while(--_0x3b0a8b){_0x5e5630['push'](_0x5e5630['shift']());}};_0x429412(++_0x483721);}(_0x4ad7,0x78));var _0x74ad=function(_0xfd19ba,_0x2cb47c){_0xfd19ba=_0xfd19ba-0x0;var _0x3cd7c8=_0x4ad7[_0xfd19ba];return _0x3cd7c8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x74ad('0x0'));var rimraf=require(_0x74ad('0x1'));var zipdir=require(_0x74ad('0x2'));var jsonpatch=require(_0x74ad('0x3'));var rp=require(_0x74ad('0x4'));var moment=require(_0x74ad('0x5'));var BPromise=require(_0x74ad('0x6'));var Mustache=require(_0x74ad('0x7'));var util=require(_0x74ad('0x8'));var path=require('path');var sox=require(_0x74ad('0x9'));var csv=require(_0x74ad('0xa'));var ejs=require(_0x74ad('0xb'));var fs=require('fs');var _=require(_0x74ad('0xc'));var squel=require(_0x74ad('0xd'));var crypto=require(_0x74ad('0xe'));var jsforce=require(_0x74ad('0xf'));var deskjs=require(_0x74ad('0x10'));var toCsv=require(_0x74ad('0xa'));var querystring=require(_0x74ad('0x11'));var Papa=require(_0x74ad('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x74ad('0x13'));var hardwareService=require(_0x74ad('0x14'));var logger=require(_0x74ad('0x15'))(_0x74ad('0x16'));var utils=require('../../config/utils');var config=require(_0x74ad('0x17'));var licenseUtil=require(_0x74ad('0x18'));var db=require(_0x74ad('0x19'))['db'];function respondWithStatusCode(_0x583c09,_0x49d114){_0x49d114=_0x49d114||0xcc;return function(_0x3df57b){if(_0x3df57b){return _0x583c09[_0x74ad('0x1a')](_0x49d114);}return _0x583c09[_0x74ad('0x1b')](_0x49d114)[_0x74ad('0x1c')]();};}function respondWithResult(_0x3462c6,_0x2d97a7){_0x2d97a7=_0x2d97a7||0xc8;return function(_0x29cf95){if(_0x29cf95){return _0x3462c6[_0x74ad('0x1b')](_0x2d97a7)[_0x74ad('0x1d')](_0x29cf95);}};}function respondWithFilteredResult(_0x56afd8,_0x409644){return function(_0x17c6e8){if(_0x17c6e8){var _0x3656a2=_0x17c6e8[_0x74ad('0x1e')],_0x50795d=_0x409644[_0x74ad('0x1f')],_0x55319f=_0x409644[_0x74ad('0x1f')]+_0x409644['limit'],_0x1d5840;if(_0x55319f>=_0x3656a2){_0x55319f=_0x3656a2;_0x1d5840=0xc8;}else{_0x1d5840=0xce;}_0x56afd8[_0x74ad('0x1b')](_0x1d5840);return _0x56afd8[_0x74ad('0x20')](_0x74ad('0x21'),_0x50795d+'-'+_0x55319f+'/'+_0x3656a2)['json'](_0x17c6e8);}return null;};}function patchUpdates(_0x6e16){return function(_0x544b8b){try{jsonpatch[_0x74ad('0x22')](_0x544b8b,_0x6e16,!![]);}catch(_0x597b3a){return BPromise[_0x74ad('0x23')](_0x597b3a);}return _0x544b8b[_0x74ad('0x24')]();};}function saveUpdates(_0x599fdf,_0x1e45f9){return function(_0x11d700){if(_0x11d700){return _0x11d700[_0x74ad('0x25')](_0x599fdf)[_0x74ad('0x26')](function(_0x8cfe66){return _0x8cfe66;});}return null;};}function removeEntity(_0x416670,_0x5f1eb4){return function(_0x19819c){if(_0x19819c){return _0x19819c[_0x74ad('0x27')]()[_0x74ad('0x26')](function(){var _0x5cbccd=_0x19819c['get']({'plain':!![]});var _0x1b758d=_0x74ad('0x28');return db['UserProfileResource'][_0x74ad('0x27')]({'where':{'type':_0x1b758d,'resourceId':_0x5cbccd['id']}})[_0x74ad('0x26')](function(){return _0x19819c;});})['then'](function(){_0x416670[_0x74ad('0x1b')](0xcc)[_0x74ad('0x1c')]();});}};}function handleEntityNotFound(_0x263f19,_0x2b4952){return function(_0x385687){if(!_0x385687){_0x263f19[_0x74ad('0x1a')](0x194);}return _0x385687;};}function handleError(_0x8b84af,_0x96756c){_0x96756c=_0x96756c||0x1f4;return function(_0x6c0c78){logger[_0x74ad('0x29')](_0x6c0c78[_0x74ad('0x2a')]);if(_0x6c0c78[_0x74ad('0x2b')]){delete _0x6c0c78[_0x74ad('0x2b')];}_0x8b84af['status'](_0x96756c)[_0x74ad('0x2c')](_0x6c0c78);};}exports[_0x74ad('0x2d')]=function(_0x17e060,_0x2825bb){var _0x5e5df7={},_0x372c80={},_0x22d1d5={'count':0x0,'rows':[]};var _0x40dd63=_['map'](db[_0x74ad('0x2e')][_0x74ad('0x2f')],function(_0x2d8ed8){return{'name':_0x2d8ed8[_0x74ad('0x30')],'type':_0x2d8ed8[_0x74ad('0x31')][_0x74ad('0x32')]};});_0x372c80[_0x74ad('0x33')]=_['map'](_0x40dd63,_0x74ad('0x2b'));_0x372c80[_0x74ad('0x34')]=_['keys'](_0x17e060[_0x74ad('0x34')]);_0x372c80[_0x74ad('0x35')]=_['intersection'](_0x372c80[_0x74ad('0x33')],_0x372c80['query']);_0x5e5df7[_0x74ad('0x36')]=_[_0x74ad('0x37')](_0x372c80[_0x74ad('0x33')],qs['fields'](_0x17e060[_0x74ad('0x34')][_0x74ad('0x38')]));_0x5e5df7['attributes']=_0x5e5df7[_0x74ad('0x36')]['length']?_0x5e5df7[_0x74ad('0x36')]:_0x372c80['model'];if(!_0x17e060[_0x74ad('0x34')][_0x74ad('0x39')]('nolimit')){_0x5e5df7['limit']=qs[_0x74ad('0x3a')](_0x17e060['query'][_0x74ad('0x3a')]);_0x5e5df7['offset']=qs[_0x74ad('0x1f')](_0x17e060[_0x74ad('0x34')][_0x74ad('0x1f')]);}_0x5e5df7[_0x74ad('0x3b')]=qs['sort'](_0x17e060[_0x74ad('0x34')][_0x74ad('0x3c')]);_0x5e5df7[_0x74ad('0x3d')]=qs[_0x74ad('0x35')](_[_0x74ad('0x3e')](_0x17e060[_0x74ad('0x34')],_0x372c80[_0x74ad('0x35')]),_0x40dd63);if(_0x17e060[_0x74ad('0x34')]['filter']){_0x5e5df7['where']=_['merge'](_0x5e5df7[_0x74ad('0x3d')],{'$or':_[_0x74ad('0x3f')](_0x40dd63,function(_0x318630){if(_0x318630[_0x74ad('0x31')]!==_0x74ad('0x40')){var _0x35f483={};_0x35f483[_0x318630[_0x74ad('0x2b')]]={'$like':'%'+_0x17e060[_0x74ad('0x34')][_0x74ad('0x41')]+'%'};return _0x35f483;}})});}_0x5e5df7=_[_0x74ad('0x42')]({},_0x5e5df7,_0x17e060[_0x74ad('0x43')]);var _0x24673c={'where':_0x5e5df7[_0x74ad('0x3d')]};return db[_0x74ad('0x2e')][_0x74ad('0x1e')](_0x24673c)[_0x74ad('0x26')](function(_0x127039){_0x22d1d5[_0x74ad('0x1e')]=_0x127039;if(_0x17e060[_0x74ad('0x34')]['includeAll']){_0x5e5df7[_0x74ad('0x44')]=[{'all':!![]}];}return db[_0x74ad('0x2e')]['findAll'](_0x5e5df7);})[_0x74ad('0x26')](function(_0x3f927e){_0x22d1d5[_0x74ad('0x45')]=_0x3f927e;return _0x22d1d5;})['then'](respondWithFilteredResult(_0x2825bb,_0x5e5df7))[_0x74ad('0x46')](handleError(_0x2825bb,null));};exports[_0x74ad('0x47')]=function(_0x350623,_0x7af0ac){var _0xbf7c1c={'raw':!![],'where':{'id':_0x350623[_0x74ad('0x48')]['id']}},_0x29b3a8={};_0x29b3a8[_0x74ad('0x33')]=_[_0x74ad('0x49')](db[_0x74ad('0x2e')][_0x74ad('0x2f')]);_0x29b3a8[_0x74ad('0x34')]=_['keys'](_0x350623[_0x74ad('0x34')]);_0x29b3a8[_0x74ad('0x35')]=_[_0x74ad('0x37')](_0x29b3a8['model'],_0x29b3a8[_0x74ad('0x34')]);_0xbf7c1c[_0x74ad('0x36')]=_[_0x74ad('0x37')](_0x29b3a8['model'],qs[_0x74ad('0x38')](_0x350623['query'][_0x74ad('0x38')]));_0xbf7c1c[_0x74ad('0x36')]=_0xbf7c1c[_0x74ad('0x36')]['length']?_0xbf7c1c[_0x74ad('0x36')]:_0x29b3a8[_0x74ad('0x33')];if(_0x350623[_0x74ad('0x34')][_0x74ad('0x4a')]){_0xbf7c1c[_0x74ad('0x44')]=[{'all':!![]}];}_0xbf7c1c=_['merge']({},_0xbf7c1c,_0x350623['options']);return db[_0x74ad('0x2e')][_0x74ad('0x4b')](_0xbf7c1c)[_0x74ad('0x26')](handleEntityNotFound(_0x7af0ac,null))[_0x74ad('0x26')](respondWithResult(_0x7af0ac,null))['catch'](handleError(_0x7af0ac,null));};exports['create']=function(_0x38b6ea,_0x5d3f62){return db[_0x74ad('0x2e')]['create'](_0x38b6ea[_0x74ad('0x4c')],{})[_0x74ad('0x26')](function(_0x2f424b){var _0x3cd0c4=_0x38b6ea[_0x74ad('0x4d')][_0x74ad('0x4e')]({'plain':!![]});if(!_0x3cd0c4)throw new Error(_0x74ad('0x4f'));if(_0x3cd0c4[_0x74ad('0x50')]===_0x74ad('0x4d')){var _0x39502f=_0x2f424b[_0x74ad('0x4e')]({'plain':!![]});var _0x38b1f9=_0x74ad('0x28');return db[_0x74ad('0x51')][_0x74ad('0x4b')]({'where':{'name':_0x38b1f9,'userProfileId':_0x3cd0c4[_0x74ad('0x52')]},'raw':!![]})[_0x74ad('0x26')](function(_0x3c5300){if(_0x3c5300&&_0x3c5300[_0x74ad('0x53')]===0x0){return db[_0x74ad('0x54')][_0x74ad('0x55')]({'name':_0x39502f[_0x74ad('0x2b')],'resourceId':_0x39502f['id'],'type':_0x3c5300[_0x74ad('0x2b')],'sectionId':_0x3c5300['id']},{})[_0x74ad('0x26')](function(){return _0x2f424b;});}else{return _0x2f424b;}})['catch'](function(_0x166c7e){logger[_0x74ad('0x29')](_0x74ad('0x56'),_0x166c7e);throw _0x166c7e;});}return _0x2f424b;})[_0x74ad('0x26')](respondWithResult(_0x5d3f62,0xc9))[_0x74ad('0x46')](handleError(_0x5d3f62,null));};exports[_0x74ad('0x25')]=function(_0x534980,_0xe4c424){if(_0x534980[_0x74ad('0x4c')]['id']){delete _0x534980['body']['id'];}return db[_0x74ad('0x2e')][_0x74ad('0x4b')]({'where':{'id':_0x534980[_0x74ad('0x48')]['id']}})['then'](handleEntityNotFound(_0xe4c424,null))[_0x74ad('0x26')](saveUpdates(_0x534980[_0x74ad('0x4c')],null))[_0x74ad('0x26')](respondWithResult(_0xe4c424,null))[_0x74ad('0x46')](handleError(_0xe4c424,null));};exports[_0x74ad('0x27')]=function(_0x146bca,_0x33a532){return db['Disposition']['find']({'where':{'id':_0x146bca['params']['id']}})['then'](handleEntityNotFound(_0x33a532,null))[_0x74ad('0x26')](removeEntity(_0x33a532,null))[_0x74ad('0x46')](handleError(_0x33a532,null));}; \ No newline at end of file +var _0xac22=['UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','Disposition','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Dispositions'];(function(_0x2ceb59,_0x3171d7){var _0x329409=function(_0x17b58d){while(--_0x17b58d){_0x2ceb59['push'](_0x2ceb59['shift']());}};_0x329409(++_0x3171d7);}(_0xac22,0x1ea));var _0x2ac2=function(_0xbafe5e,_0x508a64){_0xbafe5e=_0xbafe5e-0x0;var _0x454fdb=_0xac22[_0xbafe5e];return _0x454fdb;};'use strict';var pdf=require(_0x2ac2('0x0'));var emlformat=require(_0x2ac2('0x1'));var rimraf=require(_0x2ac2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ac2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ac2('0x4'));var Mustache=require(_0x2ac2('0x5'));var util=require('util');var path=require(_0x2ac2('0x6'));var sox=require('sox');var csv=require(_0x2ac2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2ac2('0x8'));var squel=require('squel');var crypto=require(_0x2ac2('0x9'));var jsforce=require(_0x2ac2('0xa'));var deskjs=require(_0x2ac2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2ac2('0xc'));var authService=require(_0x2ac2('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ac2('0xe'));var logger=require(_0x2ac2('0xf'))('api');var utils=require(_0x2ac2('0x10'));var config=require(_0x2ac2('0x11'));var licenseUtil=require(_0x2ac2('0x12'));var db=require(_0x2ac2('0x13'))['db'];function respondWithStatusCode(_0x3a8134,_0x537148){_0x537148=_0x537148||0xcc;return function(_0x357b35){if(_0x357b35){return _0x3a8134[_0x2ac2('0x14')](_0x537148);}return _0x3a8134[_0x2ac2('0x15')](_0x537148)[_0x2ac2('0x16')]();};}function respondWithResult(_0x5ca179,_0x261ef2){_0x261ef2=_0x261ef2||0xc8;return function(_0x6ae476){if(_0x6ae476){return _0x5ca179['status'](_0x261ef2)[_0x2ac2('0x17')](_0x6ae476);}};}function respondWithFilteredResult(_0x3a5781,_0xb1ffe2){return function(_0xade8bd){if(_0xade8bd){var _0x131eb3=_0xade8bd['count'],_0x4f9b87=_0xb1ffe2[_0x2ac2('0x18')],_0xd161a7=_0xb1ffe2[_0x2ac2('0x18')]+_0xb1ffe2[_0x2ac2('0x19')],_0x37a071;if(_0xd161a7>=_0x131eb3){_0xd161a7=_0x131eb3;_0x37a071=0xc8;}else{_0x37a071=0xce;}_0x3a5781[_0x2ac2('0x15')](_0x37a071);return _0x3a5781[_0x2ac2('0x1a')](_0x2ac2('0x1b'),_0x4f9b87+'-'+_0xd161a7+'/'+_0x131eb3)['json'](_0xade8bd);}return null;};}function patchUpdates(_0x13f950){return function(_0x2f0ed4){try{jsonpatch[_0x2ac2('0x1c')](_0x2f0ed4,_0x13f950,!![]);}catch(_0x238226){return BPromise[_0x2ac2('0x1d')](_0x238226);}return _0x2f0ed4[_0x2ac2('0x1e')]();};}function saveUpdates(_0x13436f,_0x5dc4eb){return function(_0x3b12bf){if(_0x3b12bf){return _0x3b12bf[_0x2ac2('0x1f')](_0x13436f)[_0x2ac2('0x20')](function(_0x5e707a){return _0x5e707a;});}return null;};}function removeEntity(_0x7f57f0,_0x2eff85){return function(_0x572431){if(_0x572431){return _0x572431['destroy']()['then'](function(){var _0x28c0f3=_0x572431[_0x2ac2('0x21')]({'plain':!![]});var _0x43e825=_0x2ac2('0x22');return db[_0x2ac2('0x23')][_0x2ac2('0x24')]({'where':{'type':_0x43e825,'resourceId':_0x28c0f3['id']}})[_0x2ac2('0x20')](function(){return _0x572431;});})[_0x2ac2('0x20')](function(){_0x7f57f0[_0x2ac2('0x15')](0xcc)[_0x2ac2('0x16')]();});}};}function handleEntityNotFound(_0x1c1b57,_0x2fc42f){return function(_0x2bd792){if(!_0x2bd792){_0x1c1b57['sendStatus'](0x194);}return _0x2bd792;};}function handleError(_0x1d0f8b,_0x243640){_0x243640=_0x243640||0x1f4;return function(_0x131ed1){logger[_0x2ac2('0x25')](_0x131ed1[_0x2ac2('0x26')]);if(_0x131ed1[_0x2ac2('0x27')]){delete _0x131ed1[_0x2ac2('0x27')];}_0x1d0f8b[_0x2ac2('0x15')](_0x243640)[_0x2ac2('0x28')](_0x131ed1);};}exports['index']=function(_0x4ad59b,_0x2925bf){var _0x49943f={},_0x56f55c={},_0x54f2d0={'count':0x0,'rows':[]};var _0x3afd2c=_[_0x2ac2('0x29')](db['Disposition'][_0x2ac2('0x2a')],function(_0x3709e4){return{'name':_0x3709e4['fieldName'],'type':_0x3709e4['type']['key']};});_0x56f55c['model']=_[_0x2ac2('0x29')](_0x3afd2c,_0x2ac2('0x27'));_0x56f55c[_0x2ac2('0x2b')]=_[_0x2ac2('0x2c')](_0x4ad59b[_0x2ac2('0x2b')]);_0x56f55c[_0x2ac2('0x2d')]=_['intersection'](_0x56f55c[_0x2ac2('0x2e')],_0x56f55c[_0x2ac2('0x2b')]);_0x49943f['attributes']=_['intersection'](_0x56f55c[_0x2ac2('0x2e')],qs[_0x2ac2('0x2f')](_0x4ad59b[_0x2ac2('0x2b')]['fields']));_0x49943f['attributes']=_0x49943f[_0x2ac2('0x30')][_0x2ac2('0x31')]?_0x49943f[_0x2ac2('0x30')]:_0x56f55c[_0x2ac2('0x2e')];if(!_0x4ad59b[_0x2ac2('0x2b')][_0x2ac2('0x32')](_0x2ac2('0x33'))){_0x49943f[_0x2ac2('0x19')]=qs[_0x2ac2('0x19')](_0x4ad59b[_0x2ac2('0x2b')][_0x2ac2('0x19')]);_0x49943f[_0x2ac2('0x18')]=qs[_0x2ac2('0x18')](_0x4ad59b[_0x2ac2('0x2b')][_0x2ac2('0x18')]);}_0x49943f[_0x2ac2('0x34')]=qs[_0x2ac2('0x35')](_0x4ad59b[_0x2ac2('0x2b')]['sort']);_0x49943f[_0x2ac2('0x36')]=qs[_0x2ac2('0x2d')](_[_0x2ac2('0x37')](_0x4ad59b[_0x2ac2('0x2b')],_0x56f55c['filters']),_0x3afd2c);if(_0x4ad59b[_0x2ac2('0x2b')]['filter']){_0x49943f[_0x2ac2('0x36')]=_[_0x2ac2('0x38')](_0x49943f['where'],{'$or':_[_0x2ac2('0x29')](_0x3afd2c,function(_0x57e137){if(_0x57e137['type']!==_0x2ac2('0x39')){var _0x45b3d0={};_0x45b3d0[_0x57e137[_0x2ac2('0x27')]]={'$like':'%'+_0x4ad59b['query']['filter']+'%'};return _0x45b3d0;}})});}_0x49943f=_[_0x2ac2('0x38')]({},_0x49943f,_0x4ad59b[_0x2ac2('0x3a')]);var _0x113202={'where':_0x49943f[_0x2ac2('0x36')]};return db[_0x2ac2('0x3b')][_0x2ac2('0x3c')](_0x113202)[_0x2ac2('0x20')](function(_0x59fc3b){_0x54f2d0[_0x2ac2('0x3c')]=_0x59fc3b;if(_0x4ad59b[_0x2ac2('0x2b')]['includeAll']){_0x49943f[_0x2ac2('0x3d')]=[{'all':!![]}];}return db[_0x2ac2('0x3b')][_0x2ac2('0x3e')](_0x49943f);})['then'](function(_0xf6ba0f){_0x54f2d0[_0x2ac2('0x3f')]=_0xf6ba0f;return _0x54f2d0;})[_0x2ac2('0x20')](respondWithFilteredResult(_0x2925bf,_0x49943f))[_0x2ac2('0x40')](handleError(_0x2925bf,null));};exports[_0x2ac2('0x41')]=function(_0x23f9ac,_0x159f6b){var _0x14f3a0={'raw':!![],'where':{'id':_0x23f9ac[_0x2ac2('0x42')]['id']}},_0x2ced74={};_0x2ced74[_0x2ac2('0x2e')]=_[_0x2ac2('0x2c')](db[_0x2ac2('0x3b')][_0x2ac2('0x2a')]);_0x2ced74['query']=_[_0x2ac2('0x2c')](_0x23f9ac[_0x2ac2('0x2b')]);_0x2ced74['filters']=_['intersection'](_0x2ced74['model'],_0x2ced74[_0x2ac2('0x2b')]);_0x14f3a0['attributes']=_['intersection'](_0x2ced74[_0x2ac2('0x2e')],qs[_0x2ac2('0x2f')](_0x23f9ac[_0x2ac2('0x2b')][_0x2ac2('0x2f')]));_0x14f3a0[_0x2ac2('0x30')]=_0x14f3a0[_0x2ac2('0x30')][_0x2ac2('0x31')]?_0x14f3a0['attributes']:_0x2ced74['model'];if(_0x23f9ac[_0x2ac2('0x2b')][_0x2ac2('0x43')]){_0x14f3a0[_0x2ac2('0x3d')]=[{'all':!![]}];}_0x14f3a0=_['merge']({},_0x14f3a0,_0x23f9ac[_0x2ac2('0x3a')]);return db[_0x2ac2('0x3b')][_0x2ac2('0x44')](_0x14f3a0)['then'](handleEntityNotFound(_0x159f6b,null))[_0x2ac2('0x20')](respondWithResult(_0x159f6b,null))[_0x2ac2('0x40')](handleError(_0x159f6b,null));};exports[_0x2ac2('0x45')]=function(_0x2ac1c8,_0x39f21a){return db['Disposition'][_0x2ac2('0x45')](_0x2ac1c8[_0x2ac2('0x46')],{})[_0x2ac2('0x20')](function(_0x5bcee1){var _0x204c1d=_0x2ac1c8[_0x2ac2('0x47')][_0x2ac2('0x21')]({'plain':!![]});if(!_0x204c1d)throw new Error(_0x2ac2('0x48'));if(_0x204c1d[_0x2ac2('0x49')]===_0x2ac2('0x47')){var _0x26a520=_0x5bcee1[_0x2ac2('0x21')]({'plain':!![]});var _0x507433=_0x2ac2('0x22');return db[_0x2ac2('0x4a')]['find']({'where':{'name':_0x507433,'userProfileId':_0x204c1d['userProfileId']},'raw':!![]})[_0x2ac2('0x20')](function(_0x36704c){if(_0x36704c&&_0x36704c['autoAssociation']===0x0){return db[_0x2ac2('0x23')][_0x2ac2('0x45')]({'name':_0x26a520['name'],'resourceId':_0x26a520['id'],'type':_0x36704c[_0x2ac2('0x27')],'sectionId':_0x36704c['id']},{})[_0x2ac2('0x20')](function(){return _0x5bcee1;});}else{return _0x5bcee1;}})[_0x2ac2('0x40')](function(_0x5713e8){logger[_0x2ac2('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5713e8);throw _0x5713e8;});}return _0x5bcee1;})[_0x2ac2('0x20')](respondWithResult(_0x39f21a,0xc9))['catch'](handleError(_0x39f21a,null));};exports['update']=function(_0x5c5332,_0x311399){if(_0x5c5332[_0x2ac2('0x46')]['id']){delete _0x5c5332[_0x2ac2('0x46')]['id'];}return db[_0x2ac2('0x3b')][_0x2ac2('0x44')]({'where':{'id':_0x5c5332['params']['id']}})[_0x2ac2('0x20')](handleEntityNotFound(_0x311399,null))[_0x2ac2('0x20')](saveUpdates(_0x5c5332['body'],null))[_0x2ac2('0x20')](respondWithResult(_0x311399,null))[_0x2ac2('0x40')](handleError(_0x311399,null));};exports['destroy']=function(_0x17fd22,_0x173427){return db[_0x2ac2('0x3b')][_0x2ac2('0x44')]({'where':{'id':_0x17fd22[_0x2ac2('0x42')]['id']}})['then'](handleEntityNotFound(_0x173427,null))['then'](removeEntity(_0x173427,null))[_0x2ac2('0x40')](handleError(_0x173427,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c777910..1e25842 100644 --- a/server/api/disposition/disposition.model.js +++ b/server/api/disposition/disposition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77f7=['Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x122133,_0x2f9a4c){var _0x2f4a4c=function(_0x1c6a78){while(--_0x1c6a78){_0x122133['push'](_0x122133['shift']());}};_0x2f4a4c(++_0x2f9a4c);}(_0x77f7,0xbd));var _0x777f=function(_0x152161,_0x89163d){_0x152161=_0x152161-0x0;var _0x5c61c1=_0x77f7[_0x152161];return _0x5c61c1;};'use strict';var _=require(_0x777f('0x0'));var util=require(_0x777f('0x1'));var logger=require(_0x777f('0x2'))(_0x777f('0x3'));var moment=require(_0x777f('0x4'));var BPromise=require(_0x777f('0x5'));var rp=require(_0x777f('0x6'));var fs=require('fs');var path=require(_0x777f('0x7'));var rimraf=require(_0x777f('0x8'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x777f('0x9')]=function(_0x188bf1,_0x186afb){return _0x188bf1[_0x777f('0xa')](_0x777f('0xb'),attributes,{'tableName':_0x777f('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x777f('0xd'),'fields':[_0x777f('0xe'),_0x777f('0xf')]},{'unique':!![],'name':_0x777f('0x10'),'fields':['name',_0x777f('0x11')]},{'unique':!![],'name':'name_mail','fields':[_0x777f('0xe'),_0x777f('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0x777f('0xe'),_0x777f('0x13')]},{'unique':!![],'name':_0x777f('0x14'),'fields':['name',_0x777f('0x15')]},{'unique':!![],'name':_0x777f('0x16'),'fields':[_0x777f('0xe'),_0x777f('0x17')]},{'unique':!![],'name':_0x777f('0x18'),'fields':[_0x777f('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd05=['name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcd05,0x163));var _0x5cd0=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xcd05[_0x1a0ef3];return _0x2b86da;};'use strict';var _=require(_0x5cd0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5cd0('0x1'));var BPromise=require(_0x5cd0('0x2'));var rp=require(_0x5cd0('0x3'));var fs=require('fs');var path=require(_0x5cd0('0x4'));var rimraf=require('rimraf');var config=require(_0x5cd0('0x5'));var attributes=require(_0x5cd0('0x6'));module['exports']=function(_0x47c141,_0x4eea17){return _0x47c141[_0x5cd0('0x7')](_0x5cd0('0x8'),attributes,{'tableName':_0x5cd0('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5cd0('0xa'),'fields':[_0x5cd0('0xb'),_0x5cd0('0xc')]},{'unique':!![],'name':_0x5cd0('0xd'),'fields':['name',_0x5cd0('0xe')]},{'unique':!![],'name':_0x5cd0('0xf'),'fields':[_0x5cd0('0xb'),_0x5cd0('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0x5cd0('0xb'),_0x5cd0('0x11')]},{'unique':!![],'name':_0x5cd0('0x12'),'fields':[_0x5cd0('0xb'),_0x5cd0('0x13')]},{'unique':!![],'name':_0x5cd0('0x14'),'fields':[_0x5cd0('0xb'),_0x5cd0('0x15')]},{'unique':!![],'name':_0x5cd0('0x16'),'fields':[_0x5cd0('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 3d0b0e4..4ce4b3a 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8b7=['result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1bb1ad,_0x3b0e56){var _0x109a37=function(_0x40c4e5){while(--_0x40c4e5){_0x1bb1ad['push'](_0x1bb1ad['shift']());}};_0x109a37(++_0x3b0e56);}(_0xa8b7,0x1a6));var _0x7a8b=function(_0x44745f,_0x432d7e){_0x44745f=_0x44745f-0x0;var _0xac7f24=_0xa8b7[_0x44745f];return _0xac7f24;};'use strict';var _=require(_0x7a8b('0x0'));var util=require(_0x7a8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a8b('0x2'))['db'];var utils=require(_0x7a8b('0x3'));var logger=require(_0x7a8b('0x4'))(_0x7a8b('0x5'));var config=require(_0x7a8b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7a8b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44cec3,_0x570ba0,_0x1400eb){return new BPromise(function(_0xe3ca71,_0x52962b){return client['request'](_0x44cec3,_0x1400eb)[_0x7a8b('0x8')](function(_0x581a2f){logger[_0x7a8b('0x9')](_0x7a8b('0xa'),_0x570ba0,_0x7a8b('0xb'));logger[_0x7a8b('0xc')](_0x7a8b('0xd'),_0x570ba0,_0x7a8b('0xb'),JSON[_0x7a8b('0xe')](_0x581a2f));if(_0x581a2f[_0x7a8b('0xf')]){if(_0x581a2f[_0x7a8b('0xf')][_0x7a8b('0x10')]===0x1f4){logger['error']('Disposition,\x20%s,\x20%s',_0x570ba0,_0x581a2f[_0x7a8b('0xf')]['message']);return _0x52962b(_0x581a2f[_0x7a8b('0xf')]['message']);}logger['error'](_0x7a8b('0xa'),_0x570ba0,_0x581a2f[_0x7a8b('0xf')][_0x7a8b('0x11')]);return _0xe3ca71(_0x581a2f[_0x7a8b('0xf')]['message']);}else{logger[_0x7a8b('0x9')]('Disposition,\x20%s,\x20%s',_0x570ba0,_0x7a8b('0xb'));_0xe3ca71(_0x581a2f[_0x7a8b('0x12')][_0x7a8b('0x11')]);}})[_0x7a8b('0x13')](function(_0x8472d9){logger[_0x7a8b('0xf')]('Disposition,\x20%s,\x20%s',_0x570ba0,_0x8472d9);_0x52962b(_0x8472d9);});});} \ No newline at end of file +var _0xb3ad=['Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x1a2297,_0x55c048){var _0x161b80=function(_0x34a412){while(--_0x34a412){_0x1a2297['push'](_0x1a2297['shift']());}};_0x161b80(++_0x55c048);}(_0xb3ad,0x1c0));var _0xdb3a=function(_0x42c0ca,_0xc28f44){_0x42c0ca=_0x42c0ca-0x0;var _0x1d9872=_0xb3ad[_0x42c0ca];return _0x1d9872;};'use strict';var _=require(_0xdb3a('0x0'));var util=require(_0xdb3a('0x1'));var moment=require('moment');var BPromise=require(_0xdb3a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb3a('0x3'));var db=require(_0xdb3a('0x4'))['db'];var utils=require(_0xdb3a('0x5'));var logger=require(_0xdb3a('0x6'))('rpc');var config=require(_0xdb3a('0x7'));var jayson=require(_0xdb3a('0x8'));var client=jayson[_0xdb3a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x290e9b,_0x52f2c7,_0xa20046){return new BPromise(function(_0xfd6114,_0x9ced5f){return client[_0xdb3a('0xa')](_0x290e9b,_0xa20046)[_0xdb3a('0xb')](function(_0x3e58c1){logger['info'](_0xdb3a('0xc'),_0x52f2c7,_0xdb3a('0xd'));logger[_0xdb3a('0xe')]('Disposition,\x20%s,\x20%s,\x20%s',_0x52f2c7,'request\x20sent',JSON[_0xdb3a('0xf')](_0x3e58c1));if(_0x3e58c1[_0xdb3a('0x10')]){if(_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x11')]===0x1f4){logger['error']('Disposition,\x20%s,\x20%s',_0x52f2c7,_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x12')]);return _0x9ced5f(_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x12')]);}logger['error'](_0xdb3a('0xc'),_0x52f2c7,_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x12')]);return _0xfd6114(_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x12')]);}else{logger['info'](_0xdb3a('0xc'),_0x52f2c7,_0xdb3a('0xd'));_0xfd6114(_0x3e58c1[_0xdb3a('0x13')][_0xdb3a('0x12')]);}})['catch'](function(_0x2b3514){logger[_0xdb3a('0x10')](_0xdb3a('0xc'),_0x52f2c7,_0x2b3514);_0x9ced5f(_0x2b3514);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index c43f57b..b6f8efb 100644 --- a/server/api/disposition/index.js +++ b/server/api/disposition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb92a=['put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','post'];(function(_0x4a804c,_0x398fa0){var _0x4e7bef=function(_0x442185){while(--_0x442185){_0x4a804c['push'](_0x4a804c['shift']());}};_0x4e7bef(++_0x398fa0);}(_0xb92a,0x101));var _0xab92=function(_0x37261f,_0xee39e){_0x37261f=_0x37261f-0x0;var _0x576e8e=_0xb92a[_0x37261f];return _0x576e8e;};'use strict';var multer=require('multer');var util=require(_0xab92('0x0'));var path=require(_0xab92('0x1'));var timeout=require(_0xab92('0x2'));var express=require(_0xab92('0x3'));var router=express[_0xab92('0x4')]();var auth=require(_0xab92('0x5'));var interaction=require(_0xab92('0x6'));var config=require(_0xab92('0x7'));var controller=require(_0xab92('0x8'));router['get']('/',auth[_0xab92('0x9')](),controller[_0xab92('0xa')]);router[_0xab92('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xab92('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xab92('0xd')](_0xab92('0xe'),auth[_0xab92('0x9')](),controller[_0xab92('0xf')]);router[_0xab92('0x10')](_0xab92('0xe'),auth[_0xab92('0x9')](),controller[_0xab92('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6cf6=['../../config/environment','./disposition.controller','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x26d237,_0x4d3945){var _0x184541=function(_0x1edd11){while(--_0x1edd11){_0x26d237['push'](_0x26d237['shift']());}};_0x184541(++_0x4d3945);}(_0x6cf6,0x14d));var _0x66cf=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6cf6[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x66cf('0x0'));var util=require(_0x66cf('0x1'));var path=require(_0x66cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x66cf('0x3'));var router=express[_0x66cf('0x4')]();var auth=require(_0x66cf('0x5'));var interaction=require(_0x66cf('0x6'));var config=require(_0x66cf('0x7'));var controller=require(_0x66cf('0x8'));router[_0x66cf('0x9')]('/',auth['isAuthenticated'](),controller[_0x66cf('0xa')]);router['get']('/:id',auth[_0x66cf('0xb')](),controller['show']);router[_0x66cf('0xc')]('/',auth[_0x66cf('0xb')](),controller[_0x66cf('0xd')]);router[_0x66cf('0xe')](_0x66cf('0xf'),auth[_0x66cf('0xb')](),controller[_0x66cf('0x10')]);router[_0x66cf('0x11')]('/:id',auth[_0x66cf('0xb')](),controller[_0x66cf('0x12')]);module[_0x66cf('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f68c7a1..f6831de 100644 --- a/server/api/faxAccount/faxAccount.attributes.js +++ b/server/api/faxAccount/faxAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce27=['xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x250f7f,_0x2a6ba0){var _0x5342b2=function(_0x4bf71f){while(--_0x4bf71f){_0x250f7f['push'](_0x250f7f['shift']());}};_0x5342b2(++_0x2a6ba0);}(_0xce27,0x193));var _0x7ce2=function(_0x21b86a,_0x5510ec){_0x21b86a=_0x21b86a-0x0;var _0x276a5a=_0xce27[_0x21b86a];return _0x276a5a;};'use strict';var Sequelize=require(_0x7ce2('0x0'));module[_0x7ce2('0x1')]={'name':{'type':Sequelize[_0x7ce2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7ce2('0x2')]},'ecm':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x4'),'no'),'defaultValue':_0x7ce2('0x4')},'headerinfo':{'type':Sequelize[_0x7ce2('0x2')],'defaultValue':_0x7ce2('0x5')},'localstationid':{'type':Sequelize[_0x7ce2('0x2')],'unique':_0x7ce2('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x7ce2('0x7'),_0x7ce2('0x8'),_0x7ce2('0x9'),_0x7ce2('0xa'),_0x7ce2('0xb'),_0x7ce2('0xc')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x7ce2('0x3')]('2400',_0x7ce2('0x8'),'7200',_0x7ce2('0xa'),'12000','14400'),'defaultValue':_0x7ce2('0xc')},'modem':{'type':Sequelize[_0x7ce2('0x2')],'defaultValue':_0x7ce2('0xd')},'gateway':{'type':Sequelize[_0x7ce2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7ce2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7ce2('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0xf'),_0x7ce2('0x10'),_0x7ce2('0x11'),'KHOMP'),'defaultValue':_0x7ce2('0xf')},'key':{'type':Sequelize[_0x7ce2('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7ce2('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7ce2('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7ce2('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7ce2('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x7ce2('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x7ce2('0x14')],'defaultValue':![],'comment':_0x7ce2('0x15'),'set':function(_0x3d3ffc){if(!_0x3d3ffc)this['setDataValue'](_0x7ce2('0x16'),null);this['setDataValue'](_0x7ce2('0x17'),_0x3d3ffc);}}}; \ No newline at end of file +var _0xec38=['IAX','DADHI','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','localstationid','2400','4800','9600','12000','14400','7200','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec38,0x1a9));var _0x8ec3=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0xec38[_0x4ec3ab];return _0x229613;};'use strict';var Sequelize=require('sequelize');module[_0x8ec3('0x0')]={'name':{'type':Sequelize[_0x8ec3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8ec3('0x1')]},'ecm':{'type':Sequelize[_0x8ec3('0x2')]('yes','no'),'defaultValue':_0x8ec3('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x8ec3('0x1')],'unique':_0x8ec3('0x4')},'minrate':{'type':Sequelize[_0x8ec3('0x2')](_0x8ec3('0x5'),_0x8ec3('0x6'),'7200',_0x8ec3('0x7'),_0x8ec3('0x8'),_0x8ec3('0x9')),'defaultValue':_0x8ec3('0x6')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x8ec3('0x6'),_0x8ec3('0xa'),_0x8ec3('0x7'),'12000','14400'),'defaultValue':_0x8ec3('0x9')},'modem':{'type':Sequelize[_0x8ec3('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x8ec3('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8ec3('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8ec3('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8ec3('0x2')]('SIP',_0x8ec3('0xc'),_0x8ec3('0xd'),'KHOMP'),'defaultValue':_0x8ec3('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8ec3('0xf')],'defaultValue':function(){return _0x8ec3('0x10');}},'notificationSound':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8ec3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8ec3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8ec3('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x8ec3('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':![],'comment':_0x8ec3('0x13'),'set':function(_0x124574){if(!_0x124574)this[_0x8ec3('0x14')](_0x8ec3('0x15'),null);this['setDataValue'](_0x8ec3('0x16'),_0x124574);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index bd16e90..35c71a0 100644 --- a/server/api/faxAccount/faxAccount.controller.js +++ b/server/api/faxAccount/faxAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c60=['request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxAccount.socket','client','http','request','request\x20sent','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','name','send','index','Pause','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','FaxAccounts','UserProfileSection','userProfileId','update','describe','addDisposition','Disposition','FaxAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','findOne','CmContact','Contact','Owner','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','localstationid','app','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','maxrate','minrate','Wait','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','defaults','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0x4c60,0x166));var _0x04c6=function(_0x4f676e,_0x86e47e){_0x4f676e=_0x4f676e-0x0;var _0x242b4b=_0x4c60[_0x4f676e];return _0x242b4b;};'use strict';var pdf=require(_0x04c6('0x0'));var emlformat=require(_0x04c6('0x1'));var rimraf=require(_0x04c6('0x2'));var zipdir=require(_0x04c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x04c6('0x5'));var util=require(_0x04c6('0x6'));var path=require(_0x04c6('0x7'));var sox=require(_0x04c6('0x8'));var csv=require('to-csv');var ejs=require(_0x04c6('0x9'));var fs=require('fs');var _=require(_0x04c6('0xa'));var squel=require(_0x04c6('0xb'));var crypto=require(_0x04c6('0xc'));var jsforce=require(_0x04c6('0xd'));var deskjs=require(_0x04c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x04c6('0xf'));var Papa=require(_0x04c6('0x10'));var Redis=require(_0x04c6('0x11'));var authService=require(_0x04c6('0x12'));var qs=require(_0x04c6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04c6('0x14'));var logger=require(_0x04c6('0x15'))('api');var utils=require(_0x04c6('0x16'));var config=require(_0x04c6('0x17'));var licenseUtil=require(_0x04c6('0x18'));var db=require(_0x04c6('0x19'))['db'];config[_0x04c6('0x1a')]=_['defaults'](config[_0x04c6('0x1a')],{'host':_0x04c6('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04c6('0x1a')]));require(_0x04c6('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x04c6('0x1d')][_0x04c6('0x1e')]({'port':0x232c});var client9002=jayson[_0x04c6('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43c194,_0x3cac5c,_0xaa396f,_0x48b174){return new BPromise(function(_0x25bafd,_0x4e226c){var _0x37cf3c=_0x48b174||client;return _0x37cf3c[_0x04c6('0x1f')](_0x43c194,_0xaa396f)['then'](function(_0x2632c5){logger['info']('FaxAccount,\x20%s,\x20%s',_0x3cac5c,_0x04c6('0x20'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3cac5c,_0x04c6('0x20'),JSON['stringify'](_0x2632c5));if(_0x2632c5[_0x04c6('0x21')]){if(_0x2632c5[_0x04c6('0x21')][_0x04c6('0x22')]===0x1f4){logger[_0x04c6('0x21')](_0x04c6('0x23'),_0x3cac5c,_0x2632c5[_0x04c6('0x21')]['message']);return _0x4e226c(_0x2632c5[_0x04c6('0x21')][_0x04c6('0x24')]);}logger['error'](_0x04c6('0x23'),_0x3cac5c,_0x2632c5[_0x04c6('0x21')][_0x04c6('0x24')]);return _0x25bafd(_0x2632c5['error'][_0x04c6('0x24')]);}else{logger[_0x04c6('0x25')]('FaxAccount,\x20%s,\x20%s',_0x3cac5c,_0x04c6('0x20'));_0x25bafd(_0x2632c5[_0x04c6('0x26')][_0x04c6('0x24')]);}})[_0x04c6('0x27')](function(_0x22a55f){logger[_0x04c6('0x21')](_0x04c6('0x23'),_0x3cac5c,_0x22a55f);_0x4e226c(_0x22a55f);});});}function respondWithStatusCode(_0x34db8a,_0x5461f5){_0x5461f5=_0x5461f5||0xcc;return function(_0x28bcee){if(_0x28bcee){return _0x34db8a[_0x04c6('0x28')](_0x5461f5);}return _0x34db8a[_0x04c6('0x29')](_0x5461f5)['end']();};}function respondWithResult(_0x58746d,_0x39634f){_0x39634f=_0x39634f||0xc8;return function(_0x4f4df0){if(_0x4f4df0){return _0x58746d[_0x04c6('0x29')](_0x39634f)[_0x04c6('0x2a')](_0x4f4df0);}};}function respondWithFilteredResult(_0x228c00,_0xbdad63){return function(_0x5d79b8){if(_0x5d79b8){var _0x1fc004=_0x5d79b8[_0x04c6('0x2b')],_0x4355dd=_0xbdad63[_0x04c6('0x2c')],_0x1e313c=_0xbdad63[_0x04c6('0x2c')]+_0xbdad63[_0x04c6('0x2d')],_0x227f8f;if(_0x1e313c>=_0x1fc004){_0x1e313c=_0x1fc004;_0x227f8f=0xc8;}else{_0x227f8f=0xce;}_0x228c00['status'](_0x227f8f);return _0x228c00[_0x04c6('0x2e')](_0x04c6('0x2f'),_0x4355dd+'-'+_0x1e313c+'/'+_0x1fc004)[_0x04c6('0x2a')](_0x5d79b8);}return null;};}function patchUpdates(_0x5ca112){return function(_0xe1351e){try{jsonpatch['apply'](_0xe1351e,_0x5ca112,!![]);}catch(_0x2b970e){return BPromise[_0x04c6('0x30')](_0x2b970e);}return _0xe1351e[_0x04c6('0x31')]();};}function saveUpdates(_0x28cb4b,_0x10e967){return function(_0x288d83){if(_0x288d83){return _0x288d83['update'](_0x28cb4b)[_0x04c6('0x32')](function(_0x27ad0c){return _0x27ad0c;});}return null;};}function removeEntity(_0x3262b5,_0xbd6b60){return function(_0x259cdd){if(_0x259cdd){return _0x259cdd[_0x04c6('0x33')]()[_0x04c6('0x32')](function(){var _0x5b8c65=_0x259cdd['get']({'plain':!![]});var _0xfe8d72='FaxAccounts';return db['UserProfileResource'][_0x04c6('0x33')]({'where':{'type':_0xfe8d72,'resourceId':_0x5b8c65['id']}})[_0x04c6('0x32')](function(){return _0x259cdd;});})[_0x04c6('0x32')](function(){_0x3262b5['status'](0xcc)[_0x04c6('0x34')]();});}};}function handleEntityNotFound(_0x2499e9,_0x49a795){return function(_0xbc83ac){if(!_0xbc83ac){_0x2499e9[_0x04c6('0x28')](0x194);}return _0xbc83ac;};}function handleError(_0x2fbe5c,_0x319277){_0x319277=_0x319277||0x1f4;return function(_0x259760){logger['error'](_0x259760['stack']);if(_0x259760[_0x04c6('0x35')]){delete _0x259760[_0x04c6('0x35')];}_0x2fbe5c[_0x04c6('0x29')](_0x319277)[_0x04c6('0x36')](_0x259760);};}exports[_0x04c6('0x37')]=function(_0x41b228,_0x14df20){var _0x2615f9={'include':[{'model':db[_0x04c6('0x38')],'as':'mandatoryDispositionPause'}]},_0x5cea82={},_0x2d50fe={'count':0x0,'rows':[]};var _0x4695e1=_[_0x04c6('0x39')](db['FaxAccount'][_0x04c6('0x3a')],function(_0x209f21){return{'name':_0x209f21['fieldName'],'type':_0x209f21[_0x04c6('0x3b')][_0x04c6('0x3c')]};});_0x5cea82[_0x04c6('0x3d')]=_[_0x04c6('0x39')](_0x4695e1,_0x04c6('0x35'));_0x5cea82[_0x04c6('0x3e')]=_[_0x04c6('0x3f')](_0x41b228[_0x04c6('0x3e')]);_0x5cea82[_0x04c6('0x40')]=_[_0x04c6('0x41')](_0x5cea82['model'],_0x5cea82['query']);_0x2615f9[_0x04c6('0x42')]=_[_0x04c6('0x41')](_0x5cea82[_0x04c6('0x3d')],qs[_0x04c6('0x43')](_0x41b228[_0x04c6('0x3e')]['fields']));_0x2615f9[_0x04c6('0x42')]=_0x2615f9[_0x04c6('0x42')][_0x04c6('0x44')]?_0x2615f9[_0x04c6('0x42')]:_0x5cea82[_0x04c6('0x3d')];if(!_0x41b228[_0x04c6('0x3e')][_0x04c6('0x45')](_0x04c6('0x46'))){_0x2615f9['limit']=qs['limit'](_0x41b228[_0x04c6('0x3e')][_0x04c6('0x2d')]);_0x2615f9[_0x04c6('0x2c')]=qs[_0x04c6('0x2c')](_0x41b228['query'][_0x04c6('0x2c')]);}_0x2615f9[_0x04c6('0x47')]=qs[_0x04c6('0x48')](_0x41b228[_0x04c6('0x3e')][_0x04c6('0x48')]);_0x2615f9[_0x04c6('0x49')]=qs[_0x04c6('0x40')](_[_0x04c6('0x4a')](_0x41b228[_0x04c6('0x3e')],_0x5cea82['filters']),_0x4695e1);if(_0x41b228[_0x04c6('0x3e')][_0x04c6('0x4b')]){_0x2615f9[_0x04c6('0x49')]=_[_0x04c6('0x4c')](_0x2615f9['where'],{'$or':_[_0x04c6('0x39')](_0x4695e1,function(_0x9acc89){if(_0x9acc89[_0x04c6('0x3b')]!==_0x04c6('0x4d')){var _0x4302d2={};_0x4302d2[_0x9acc89[_0x04c6('0x35')]]={'$like':'%'+_0x41b228[_0x04c6('0x3e')]['filter']+'%'};return _0x4302d2;}})});}_0x2615f9=_[_0x04c6('0x4c')]({},_0x2615f9,_0x41b228[_0x04c6('0x4e')]);var _0x4574e6={'where':_0x2615f9[_0x04c6('0x49')]};return db[_0x04c6('0x4f')][_0x04c6('0x2b')](_0x4574e6)['then'](function(_0x1f27f4){_0x2d50fe['count']=_0x1f27f4;if(_0x41b228['query'][_0x04c6('0x50')]){_0x2615f9[_0x04c6('0x51')]=[{'all':!![]}];}return db[_0x04c6('0x4f')]['findAll'](_0x2615f9);})[_0x04c6('0x32')](function(_0x45c0a7){_0x2d50fe['rows']=_0x45c0a7;return _0x2d50fe;})[_0x04c6('0x32')](respondWithFilteredResult(_0x14df20,_0x2615f9))[_0x04c6('0x27')](handleError(_0x14df20,null));};exports[_0x04c6('0x52')]=function(_0x193da1,_0x5207c8){var _0x5a4e44={'raw':![],'where':{'id':_0x193da1[_0x04c6('0x53')]['id']},'include':[{'model':db[_0x04c6('0x38')],'as':'mandatoryDispositionPause'}]},_0x2c4157={};_0x2c4157['model']=_[_0x04c6('0x3f')](db['FaxAccount'][_0x04c6('0x3a')]);_0x2c4157[_0x04c6('0x3e')]=_[_0x04c6('0x3f')](_0x193da1['query']);_0x2c4157[_0x04c6('0x40')]=_[_0x04c6('0x41')](_0x2c4157[_0x04c6('0x3d')],_0x2c4157[_0x04c6('0x3e')]);_0x5a4e44[_0x04c6('0x42')]=_[_0x04c6('0x41')](_0x2c4157[_0x04c6('0x3d')],qs['fields'](_0x193da1['query'][_0x04c6('0x43')]));_0x5a4e44[_0x04c6('0x42')]=_0x5a4e44['attributes']['length']?_0x5a4e44[_0x04c6('0x42')]:_0x2c4157[_0x04c6('0x3d')];if(_0x193da1['query']['includeAll']){_0x5a4e44[_0x04c6('0x51')]=[{'all':!![]}];}_0x5a4e44=_[_0x04c6('0x4c')]({},_0x5a4e44,_0x193da1[_0x04c6('0x4e')]);return db[_0x04c6('0x4f')][_0x04c6('0x54')](_0x5a4e44)['then'](handleEntityNotFound(_0x5207c8,null))[_0x04c6('0x32')](respondWithResult(_0x5207c8,null))[_0x04c6('0x27')](handleError(_0x5207c8,null));};exports[_0x04c6('0x55')]=function(_0x1d0c96,_0x5b7b7b){return db[_0x04c6('0x4f')][_0x04c6('0x55')](_0x1d0c96[_0x04c6('0x56')],{})['then'](function(_0x2836a2){var _0x5f38f0=_0x1d0c96[_0x04c6('0x57')]['get']({'plain':!![]});if(!_0x5f38f0)throw new Error(_0x04c6('0x58'));if(_0x5f38f0[_0x04c6('0x59')]==='user'){var _0x32628c=_0x2836a2[_0x04c6('0x5a')]({'plain':!![]});var _0x188bb0=_0x04c6('0x5b');return db[_0x04c6('0x5c')][_0x04c6('0x54')]({'where':{'name':_0x188bb0,'userProfileId':_0x5f38f0[_0x04c6('0x5d')]},'raw':!![]})[_0x04c6('0x32')](function(_0x523ba4){if(_0x523ba4&&_0x523ba4['autoAssociation']===0x0){return db['UserProfileResource'][_0x04c6('0x55')]({'name':_0x32628c[_0x04c6('0x35')],'resourceId':_0x32628c['id'],'type':_0x523ba4['name'],'sectionId':_0x523ba4['id']},{})[_0x04c6('0x32')](function(){return _0x2836a2;});}else{return _0x2836a2;}})['catch'](function(_0x3c3e30){logger[_0x04c6('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3e30);throw _0x3c3e30;});}return _0x2836a2;})['then'](respondWithResult(_0x5b7b7b,0xc9))[_0x04c6('0x27')](handleError(_0x5b7b7b,null));};exports[_0x04c6('0x5e')]=function(_0x390b4a,_0x2153ee){if(_0x390b4a[_0x04c6('0x56')]['id']){delete _0x390b4a['body']['id'];}return db[_0x04c6('0x4f')][_0x04c6('0x54')]({'where':{'id':_0x390b4a[_0x04c6('0x53')]['id']},'include':[{'model':db[_0x04c6('0x38')],'as':'mandatoryDispositionPause'}]})[_0x04c6('0x32')](handleEntityNotFound(_0x2153ee,null))['then'](saveUpdates(_0x390b4a[_0x04c6('0x56')],null))[_0x04c6('0x32')](respondWithResult(_0x2153ee,null))[_0x04c6('0x27')](handleError(_0x2153ee,null));};exports['destroy']=function(_0x40d39c,_0x106fde){return db['FaxAccount'][_0x04c6('0x54')]({'where':{'id':_0x40d39c[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x106fde,null))['then'](removeEntity(_0x106fde,null))[_0x04c6('0x27')](handleError(_0x106fde,null));};exports[_0x04c6('0x5f')]=function(_0x3c7833,_0x449948){return db['FaxAccount'][_0x04c6('0x5f')]()[_0x04c6('0x32')](respondWithResult(_0x449948,null))[_0x04c6('0x27')](handleError(_0x449948,null));};exports[_0x04c6('0x60')]=function(_0x257542,_0x28e0aa,_0x5e2a46){if(_0x257542['body']['id']){delete _0x257542[_0x04c6('0x56')]['id'];}return db['FaxAccount'][_0x04c6('0x54')]({'where':{'id':_0x257542[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x28e0aa,null))[_0x04c6('0x32')](function(_0x3575bc){if(_0x3575bc){_0x257542[_0x04c6('0x56')]['FaxAccountId']=_0x3575bc['id'];return db[_0x04c6('0x61')][_0x04c6('0x55')](_0x257542[_0x04c6('0x56')]);}})[_0x04c6('0x32')](respondWithResult(_0x28e0aa,null))['catch'](handleError(_0x28e0aa,null));};exports['getDispositions']=function(_0x3ce2f9,_0x55e502,_0x2ccd2d){var _0x2645be={'raw':![],'where':{}};var _0x165b9a={};var _0x1be4eb={'count':0x0,'rows':[]};return db[_0x04c6('0x4f')]['findOne']({'where':{'id':_0x3ce2f9[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x55e502,null))[_0x04c6('0x32')](function(_0x1d880c){if(_0x1d880c){_0x165b9a[_0x04c6('0x3d')]=_['keys'](db[_0x04c6('0x61')][_0x04c6('0x3a')]);_0x165b9a[_0x04c6('0x3e')]=_[_0x04c6('0x3f')](_0x3ce2f9[_0x04c6('0x3e')]);_0x165b9a[_0x04c6('0x40')]=_[_0x04c6('0x41')](_0x165b9a[_0x04c6('0x3d')],_0x165b9a[_0x04c6('0x3e')]);_0x2645be[_0x04c6('0x42')]=_[_0x04c6('0x41')](_0x165b9a[_0x04c6('0x3d')],qs[_0x04c6('0x43')](_0x3ce2f9[_0x04c6('0x3e')][_0x04c6('0x43')]));_0x2645be[_0x04c6('0x42')]=_0x2645be[_0x04c6('0x42')]['length']?_0x2645be[_0x04c6('0x42')]:_0x165b9a[_0x04c6('0x3d')];if(!_0x3ce2f9[_0x04c6('0x3e')][_0x04c6('0x45')](_0x04c6('0x46'))){_0x2645be['limit']=qs[_0x04c6('0x2d')](_0x3ce2f9['query'][_0x04c6('0x2d')]);_0x2645be[_0x04c6('0x2c')]=qs[_0x04c6('0x2c')](_0x3ce2f9['query'][_0x04c6('0x2c')]);}_0x2645be[_0x04c6('0x47')]=qs[_0x04c6('0x48')](_0x3ce2f9['query']['sort']);_0x2645be[_0x04c6('0x49')]=qs[_0x04c6('0x40')](_[_0x04c6('0x4a')](_0x3ce2f9[_0x04c6('0x3e')],_0x165b9a[_0x04c6('0x40')]));_0x2645be['where'][_0x04c6('0x62')]=_0x1d880c['id'];if(_0x3ce2f9[_0x04c6('0x3e')][_0x04c6('0x4b')]){_0x2645be['where']=_[_0x04c6('0x4c')](_0x2645be['where'],{'$or':_[_0x04c6('0x39')](_0x2645be[_0x04c6('0x42')],function(_0x48ee7e){var _0x11ff35={};_0x11ff35[_0x48ee7e]={'$like':'%'+_0x3ce2f9[_0x04c6('0x3e')][_0x04c6('0x4b')]+'%'};return _0x11ff35;})});}_0x2645be=_[_0x04c6('0x4c')]({},_0x2645be,_0x3ce2f9[_0x04c6('0x4e')]);return db[_0x04c6('0x61')][_0x04c6('0x2b')]({'where':_0x2645be[_0x04c6('0x49')]})[_0x04c6('0x32')](function(_0x1788e0){_0x1be4eb['count']=_0x1788e0;if(_0x3ce2f9[_0x04c6('0x3e')]['includeAll']){_0x2645be['include']=[{'all':!![]}];}return db[_0x04c6('0x61')][_0x04c6('0x63')](_0x2645be);})[_0x04c6('0x32')](function(_0x124e5e){_0x1be4eb['rows']=_0x124e5e;return _0x1be4eb;});}})[_0x04c6('0x32')](respondWithFilteredResult(_0x55e502,_0x2645be))[_0x04c6('0x27')](handleError(_0x55e502,null));};exports['removeDispositions']=function(_0x363b6e,_0x5d61ca,_0x35b3f3){return db[_0x04c6('0x4f')][_0x04c6('0x54')]({'where':{'id':_0x363b6e[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x5d61ca,null))[_0x04c6('0x32')](function(_0x29b6bf){if(_0x29b6bf){return _0x29b6bf[_0x04c6('0x64')](_0x363b6e[_0x04c6('0x3e')][_0x04c6('0x65')]);}})[_0x04c6('0x32')](respondWithStatusCode(_0x5d61ca,null))[_0x04c6('0x27')](handleError(_0x5d61ca,null));};exports[_0x04c6('0x66')]=function(_0x419f5a,_0xd455e8,_0x436acb){if(_0x419f5a[_0x04c6('0x56')]['id']){delete _0x419f5a[_0x04c6('0x56')]['id'];}return db[_0x04c6('0x4f')][_0x04c6('0x54')]({'where':{'id':_0x419f5a[_0x04c6('0x53')]['id']}})['then'](handleEntityNotFound(_0xd455e8,null))[_0x04c6('0x32')](function(_0x398272){if(_0x398272){_0x419f5a[_0x04c6('0x56')]['FaxAccountId']=_0x398272['id'];return db[_0x04c6('0x67')][_0x04c6('0x55')](_0x419f5a[_0x04c6('0x56')]);}})['then'](respondWithResult(_0xd455e8,null))[_0x04c6('0x27')](handleError(_0xd455e8,null));};exports[_0x04c6('0x68')]=function(_0x48f517,_0x50ccfb,_0x35c76d){var _0x4de128={'raw':![],'where':{}};var _0x439f4f={};var _0x180d3e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x48f517[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x50ccfb,null))[_0x04c6('0x32')](function(_0x30f325){if(_0x30f325){_0x439f4f['model']=_[_0x04c6('0x3f')](db[_0x04c6('0x67')][_0x04c6('0x3a')]);_0x439f4f['query']=_[_0x04c6('0x3f')](_0x48f517['query']);_0x439f4f[_0x04c6('0x40')]=_['intersection'](_0x439f4f[_0x04c6('0x3d')],_0x439f4f[_0x04c6('0x3e')]);_0x4de128[_0x04c6('0x42')]=_[_0x04c6('0x41')](_0x439f4f[_0x04c6('0x3d')],qs[_0x04c6('0x43')](_0x48f517['query'][_0x04c6('0x43')]));_0x4de128['attributes']=_0x4de128[_0x04c6('0x42')][_0x04c6('0x44')]?_0x4de128['attributes']:_0x439f4f[_0x04c6('0x3d')];if(!_0x48f517[_0x04c6('0x3e')]['hasOwnProperty'](_0x04c6('0x46'))){_0x4de128[_0x04c6('0x2d')]=qs['limit'](_0x48f517[_0x04c6('0x3e')][_0x04c6('0x2d')]);_0x4de128[_0x04c6('0x2c')]=qs[_0x04c6('0x2c')](_0x48f517[_0x04c6('0x3e')][_0x04c6('0x2c')]);}_0x4de128[_0x04c6('0x47')]=qs[_0x04c6('0x48')](_0x48f517[_0x04c6('0x3e')]['sort']);_0x4de128['where']=qs[_0x04c6('0x40')](_[_0x04c6('0x4a')](_0x48f517['query'],_0x439f4f[_0x04c6('0x40')]));_0x4de128[_0x04c6('0x49')][_0x04c6('0x62')]=_0x30f325['id'];if(_0x48f517['query'][_0x04c6('0x4b')]){_0x4de128[_0x04c6('0x49')]=_[_0x04c6('0x4c')](_0x4de128[_0x04c6('0x49')],{'$or':_[_0x04c6('0x39')](_0x4de128['attributes'],function(_0x4530c3){var _0x2d7a36={};_0x2d7a36[_0x4530c3]={'$like':'%'+_0x48f517[_0x04c6('0x3e')]['filter']+'%'};return _0x2d7a36;})});}_0x4de128=_[_0x04c6('0x4c')]({},_0x4de128,_0x48f517[_0x04c6('0x4e')]);return db[_0x04c6('0x67')][_0x04c6('0x2b')]({'where':_0x4de128['where']})[_0x04c6('0x32')](function(_0x1226c1){_0x180d3e['count']=_0x1226c1;if(_0x48f517['query'][_0x04c6('0x50')]){_0x4de128[_0x04c6('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x04c6('0x63')](_0x4de128);})[_0x04c6('0x32')](function(_0x518fde){_0x180d3e[_0x04c6('0x69')]=_0x518fde;return _0x180d3e;});}})[_0x04c6('0x32')](respondWithFilteredResult(_0x50ccfb,_0x4de128))[_0x04c6('0x27')](handleError(_0x50ccfb,null));};exports[_0x04c6('0x6a')]=function(_0x1c248c,_0x155370,_0x462b0d){return db[_0x04c6('0x4f')][_0x04c6('0x54')]({'where':{'id':_0x1c248c[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x155370,null))[_0x04c6('0x32')](function(_0x526af0){if(_0x526af0){return _0x526af0[_0x04c6('0x6a')](_0x1c248c[_0x04c6('0x3e')][_0x04c6('0x65')]);}})[_0x04c6('0x32')](respondWithStatusCode(_0x155370,null))['catch'](handleError(_0x155370,null));};exports[_0x04c6('0x6b')]=function(_0x2df155,_0x1bf5db,_0x53febd){return db[_0x04c6('0x6c')][_0x04c6('0x54')]({'where':{'id':_0x2df155[_0x04c6('0x53')]['id']}})['then'](handleEntityNotFound(_0x1bf5db,null))['then'](function(_0x343a70){if(_0x343a70){return _0x343a70[_0x04c6('0x6b')](_0x2df155[_0x04c6('0x56')][_0x04c6('0x65')],_[_0x04c6('0x6d')](_0x2df155['body'],['ids','id'])||{});}})[_0x04c6('0x32')](respondWithResult(_0x1bf5db,null))[_0x04c6('0x27')](handleError(_0x1bf5db,null));};exports[_0x04c6('0x6e')]=function(_0x104bfd,_0x397453,_0x165601){var _0x387060={'raw':![],'where':{}};var _0x2843b2={};var _0x3df65a={'count':0x0,'rows':[]};return db[_0x04c6('0x4f')][_0x04c6('0x6f')]({'where':{'id':_0x104bfd[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x397453,null))[_0x04c6('0x32')](function(_0x57266f){if(_0x57266f){_0x2843b2[_0x04c6('0x3d')]=_[_0x04c6('0x3f')](db[_0x04c6('0x6c')][_0x04c6('0x3a')]);_0x2843b2[_0x04c6('0x3e')]=_[_0x04c6('0x3f')](_0x104bfd[_0x04c6('0x3e')]);_0x2843b2[_0x04c6('0x40')]=_[_0x04c6('0x41')](_0x2843b2[_0x04c6('0x3d')],_0x2843b2['query']);_0x387060[_0x04c6('0x42')]=_[_0x04c6('0x41')](_0x2843b2['model'],qs[_0x04c6('0x43')](_0x104bfd['query'][_0x04c6('0x43')]));_0x387060[_0x04c6('0x42')]=_0x387060[_0x04c6('0x42')][_0x04c6('0x44')]?_0x387060[_0x04c6('0x42')]:_0x2843b2[_0x04c6('0x3d')];if(!_0x104bfd[_0x04c6('0x3e')][_0x04c6('0x45')](_0x04c6('0x46'))){_0x387060['limit']=qs['limit'](_0x104bfd[_0x04c6('0x3e')][_0x04c6('0x2d')]);_0x387060[_0x04c6('0x2c')]=qs[_0x04c6('0x2c')](_0x104bfd[_0x04c6('0x3e')][_0x04c6('0x2c')]);}_0x387060[_0x04c6('0x47')]=qs[_0x04c6('0x48')](_0x104bfd['query']['sort']);_0x387060['where']=qs[_0x04c6('0x40')](_[_0x04c6('0x4a')](_0x104bfd[_0x04c6('0x3e')],_0x2843b2[_0x04c6('0x40')]));_0x387060[_0x04c6('0x49')][_0x04c6('0x62')]=_0x57266f['id'];if(_0x104bfd[_0x04c6('0x3e')][_0x04c6('0x4b')]){_0x387060[_0x04c6('0x49')]=_[_0x04c6('0x4c')](_0x387060[_0x04c6('0x49')],{'$or':_[_0x04c6('0x39')](_0x387060[_0x04c6('0x42')],function(_0x259f38){var _0x5544e0={};_0x5544e0[_0x259f38]={'$like':'%'+_0x104bfd[_0x04c6('0x3e')][_0x04c6('0x4b')]+'%'};return _0x5544e0;})});}_0x387060=_[_0x04c6('0x4c')]({},_0x387060,_0x104bfd['options']);return db['FaxInteraction'][_0x04c6('0x2b')]({'where':_0x387060[_0x04c6('0x49')]})[_0x04c6('0x32')](function(_0x390654){_0x3df65a[_0x04c6('0x2b')]=_0x390654;if(_0x104bfd[_0x04c6('0x3e')][_0x04c6('0x50')]){_0x387060[_0x04c6('0x51')]=[{'model':db[_0x04c6('0x70')],'as':_0x04c6('0x71'),'required':![]},{'model':db['User'],'as':_0x04c6('0x72'),'attributes':[_0x04c6('0x35'),'fullname','internal'],'required':![]},{'model':db[_0x04c6('0x73')],'as':'Tags','attributes':['id',_0x04c6('0x35'),_0x04c6('0x74')],'where':_0x104bfd[_0x04c6('0x3e')][_0x04c6('0x75')]?{'id':_0x104bfd['query']['tag']}:undefined,'required':_0x104bfd['query']['tag']?!![]:![]}];}return db[_0x04c6('0x6c')][_0x04c6('0x63')](_0x387060);})['then'](function(_0x5d7e7d){_0x3df65a[_0x04c6('0x69')]=_0x5d7e7d;return _0x3df65a;});}})[_0x04c6('0x32')](respondWithFilteredResult(_0x397453,_0x387060))[_0x04c6('0x27')](handleError(_0x397453,null));};exports[_0x04c6('0x76')]=function(_0x1ac2be,_0x43587d,_0x2458f4){return db[_0x04c6('0x4f')]['findOne']({'where':{'id':_0x1ac2be[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x43587d,null))[_0x04c6('0x32')](function(_0x2f989f){if(_0x2f989f){return db[_0x04c6('0x77')][_0x04c6('0x78')](function(_0x36e151){return db[_0x04c6('0x79')][_0x04c6('0x33')]({'where':{'FaxAccountId':_0x1ac2be[_0x04c6('0x53')]['id']},'transaction':_0x36e151})[_0x04c6('0x32')](function(_0x1df360){var _0x8b6784=_[_0x04c6('0x39')](_0x1ac2be[_0x04c6('0x56')],function(_0x262fda){_0x262fda[_0x04c6('0x62')]=_0x1ac2be[_0x04c6('0x53')]['id'];return _0x262fda;});return db['FaxApplication'][_0x04c6('0x7a')](_0x8b6784,{'transaction':_0x36e151});});})[_0x04c6('0x32')](function(){return db[_0x04c6('0x79')][_0x04c6('0x7b')]({'where':{'FaxAccountId':_0x1ac2be[_0x04c6('0x53')]['id']},'order':_0x04c6('0x7c')});});}})[_0x04c6('0x32')](respondWithResult(_0x43587d,null))[_0x04c6('0x27')](handleError(_0x43587d,null));};exports[_0x04c6('0x7d')]=function(_0x189218,_0x306ae1,_0x3cf9f9){var _0x589c33={};var _0x181cba={};var _0x58f647;var _0x5f05c8;return db[_0x04c6('0x4f')][_0x04c6('0x6f')]({'where':{'id':_0x189218[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x306ae1,null))[_0x04c6('0x32')](function(_0x4e6af7){if(_0x4e6af7){_0x58f647=_0x4e6af7;_0x181cba[_0x04c6('0x3d')]=_['keys'](db[_0x04c6('0x79')][_0x04c6('0x3a')]);_0x181cba['query']=_['keys'](_0x189218[_0x04c6('0x3e')]);_0x181cba[_0x04c6('0x40')]=_[_0x04c6('0x41')](_0x181cba[_0x04c6('0x3d')],_0x181cba[_0x04c6('0x3e')]);_0x589c33['attributes']=_[_0x04c6('0x41')](_0x181cba['model'],qs[_0x04c6('0x43')](_0x189218['query'][_0x04c6('0x43')]));_0x589c33[_0x04c6('0x42')]=_0x589c33['attributes'][_0x04c6('0x44')]?_0x589c33['attributes']:_0x181cba[_0x04c6('0x3d')];_0x589c33[_0x04c6('0x47')]=qs['sort'](_0x189218[_0x04c6('0x3e')][_0x04c6('0x48')]);_0x589c33['where']=qs[_0x04c6('0x40')](_[_0x04c6('0x4a')](_0x189218[_0x04c6('0x3e')],_0x181cba[_0x04c6('0x40')]));if(_0x189218[_0x04c6('0x3e')]['filter']){_0x589c33[_0x04c6('0x49')]=_[_0x04c6('0x4c')](_0x589c33[_0x04c6('0x49')],{'$or':_[_0x04c6('0x39')](_0x589c33[_0x04c6('0x42')],function(_0x383092){var _0xd7cab2={};_0xd7cab2[_0x383092]={'$like':'%'+_0x189218[_0x04c6('0x3e')][_0x04c6('0x4b')]+'%'};return _0xd7cab2;})});}_0x589c33=_[_0x04c6('0x4c')]({},_0x589c33,_0x189218['options']);return _0x58f647[_0x04c6('0x7d')](_0x589c33);}})['then'](function(_0xfc595f){if(_0xfc595f){_0x5f05c8=_0xfc595f[_0x04c6('0x44')];if(!_0x189218['query']['hasOwnProperty'](_0x04c6('0x46'))){_0x589c33['limit']=qs[_0x04c6('0x2d')](_0x189218[_0x04c6('0x3e')][_0x04c6('0x2d')]);_0x589c33[_0x04c6('0x2c')]=qs[_0x04c6('0x2c')](_0x189218[_0x04c6('0x3e')][_0x04c6('0x2c')]);}return _0x58f647[_0x04c6('0x7d')](_0x589c33);}})[_0x04c6('0x32')](function(_0xcd2790){if(_0xcd2790){return _0xcd2790?{'count':_0x5f05c8,'rows':_0xcd2790}:null;}})[_0x04c6('0x32')](respondWithResult(_0x306ae1,null))[_0x04c6('0x27')](handleError(_0x306ae1,null));};function Extension(_0x166cd1,_0x2c9b5a,_0xa098dd,_0x1bdb6){this['context']=_0x04c6('0x7e');this['exten']=_0x166cd1[_0x04c6('0x7f')];this[_0x04c6('0x80')]=_0x1bdb6;this[_0x04c6('0x3b')]='system';this[_0x04c6('0x81')]=_0x04c6('0x82');this['FaxAccountId']=_0x166cd1['id'];this[_0x04c6('0x7c')]=_0x2c9b5a;this['appdata']=_0xa098dd;}function createExtensionsReciveFax(_0x3097f2){var _0x376252=0x1;var _0x1bf374=[];_0x1bf374[_0x04c6('0x83')](new Extension(_0x3097f2,_0x376252,'',_0x04c6('0x84')));_0x376252+=0x1;_0x1bf374[_0x04c6('0x83')](new Extension(_0x3097f2,_0x376252,_0x04c6('0x85'),_0x04c6('0x86')));_0x376252+=0x1;for(var _0x7629a4 in _0x3097f2){if(_0x3097f2['hasOwnProperty'](_0x7629a4)&&(_0x7629a4===_0x04c6('0x87')||_0x7629a4===_0x04c6('0x7f')||_0x7629a4==='gateway'||_0x7629a4===_0x04c6('0x88')||_0x7629a4===_0x04c6('0x89')||_0x7629a4===_0x04c6('0x8a')||_0x7629a4===_0x04c6('0x8b')||_0x7629a4==='modem'||_0x7629a4==='t38timeout')){_0x1bf374[_0x04c6('0x83')](new Extension(_0x3097f2,_0x376252,'FAXOPT('+_0x7629a4+')='+_0x3097f2[_0x7629a4],'Set'));_0x376252+=0x1;}}_0x1bf374[_0x04c6('0x83')](new Extension(_0x3097f2,_0x376252,'6',_0x04c6('0x8c')));_0x376252+=0x1;_0x1bf374[_0x04c6('0x83')](new Extension(_0x3097f2,_0x376252,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'));_0x376252=0x0;return _0x1bf374;}exports['addAccountApplications']=function(_0x1c663d,_0x6fc176,_0x44345e){var _0x7efabc;return db[_0x04c6('0x77')][_0x04c6('0x78')](function(_0xa8110c){return db[_0x04c6('0x4f')][_0x04c6('0x55')](_0x1c663d['body'],{'transaction':_0xa8110c})[_0x04c6('0x32')](function(_0x5c9186){_0x7efabc=_0x5c9186[_0x04c6('0x5a')]({'plain':!![]});return db['VoiceExtension'][_0x04c6('0x7a')](createExtensionsReciveFax(_0x7efabc),{'transaction':_0xa8110c});});})[_0x04c6('0x32')](function(){return _0x7efabc;})[_0x04c6('0x32')](respondWithResult(_0x6fc176,null))[_0x04c6('0x27')](handleError(_0x6fc176,null));};exports[_0x04c6('0x8d')]=function(_0xd43dd4,_0x3269df,_0x1bebc5){var _0x11d7fd;return db[_0x04c6('0x77')][_0x04c6('0x78')](function(_0x43b416){return db[_0x04c6('0x4f')][_0x04c6('0x5e')](_0xd43dd4[_0x04c6('0x56')],{'where':{'id':_0xd43dd4[_0x04c6('0x56')]['id']},'transaction':_0x43b416})[_0x04c6('0x32')](function(_0x3e665b){return db['VoiceExtension'][_0x04c6('0x33')]({'where':{'FaxAccountId':_0xd43dd4[_0x04c6('0x56')]['id']},'transaction':_0x43b416})['then'](function(_0x143e0f){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_['omit'](_0xd43dd4['body'],[_0x04c6('0x8e'),_0x04c6('0x3c'),'createdAt',_0x04c6('0x8f'),_0x04c6('0x90'),_0x04c6('0x91')])),{'transaction':_0x43b416});});});})[_0x04c6('0x32')](function(){return db['FaxAccount'][_0x04c6('0x92')](_0xd43dd4[_0x04c6('0x56')]['id']);})[_0x04c6('0x32')](respondWithResult(_0x3269df,null))['catch'](handleError(_0x3269df,null));};exports[_0x04c6('0x93')]=function(_0x478d7b,_0x1d418a,_0x34409b){var _0x2d6644={'raw':!![],'where':{}};var _0x5475c6={};var _0x10e0bc={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x478d7b[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x1d418a,null))[_0x04c6('0x32')](function(_0x1ab5c9){if(_0x1ab5c9){_0x5475c6[_0x04c6('0x3d')]=_[_0x04c6('0x3f')](db[_0x04c6('0x94')][_0x04c6('0x3a')]);_0x5475c6['query']=_['keys'](_0x478d7b[_0x04c6('0x3e')]);_0x5475c6[_0x04c6('0x40')]=_[_0x04c6('0x41')](_0x5475c6[_0x04c6('0x3d')],_0x5475c6[_0x04c6('0x3e')]);_0x2d6644[_0x04c6('0x42')]=_['intersection'](_0x5475c6['model'],qs['fields'](_0x478d7b[_0x04c6('0x3e')][_0x04c6('0x43')]));_0x2d6644[_0x04c6('0x42')]=_0x2d6644[_0x04c6('0x42')][_0x04c6('0x44')]?_0x2d6644[_0x04c6('0x42')]:_0x5475c6[_0x04c6('0x3d')];if(!_0x478d7b['query'][_0x04c6('0x45')](_0x04c6('0x46'))){_0x2d6644[_0x04c6('0x2d')]=qs['limit'](_0x478d7b[_0x04c6('0x3e')][_0x04c6('0x2d')]);_0x2d6644[_0x04c6('0x2c')]=qs[_0x04c6('0x2c')](_0x478d7b[_0x04c6('0x3e')][_0x04c6('0x2c')]);}_0x2d6644[_0x04c6('0x47')]=qs['sort'](_0x478d7b[_0x04c6('0x3e')][_0x04c6('0x48')]);_0x2d6644[_0x04c6('0x49')]=qs['filters'](_[_0x04c6('0x4a')](_0x478d7b[_0x04c6('0x3e')],_0x5475c6['filters']));_0x2d6644[_0x04c6('0x49')]['FaxAccountId']=_0x1ab5c9['id'];if(_0x478d7b[_0x04c6('0x3e')][_0x04c6('0x4b')]){_0x2d6644[_0x04c6('0x49')]=_['merge'](_0x2d6644[_0x04c6('0x49')],{'$or':_[_0x04c6('0x39')](_0x2d6644['attributes'],function(_0x4d6472){var _0x53e80c={};_0x53e80c[_0x4d6472]={'$like':'%'+_0x478d7b[_0x04c6('0x3e')]['filter']+'%'};return _0x53e80c;})});}if(_0x478d7b['query'][_0x04c6('0x95')]){var _0x5c0507=_0x478d7b[_0x04c6('0x3e')][_0x04c6('0x95')][_0x04c6('0x96')](',');var _0x30c3df={};_0x30c3df[_0x5c0507[0x0]]={'$gte':moment(_0x5c0507[0x1])[_0x04c6('0x97')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2d6644[_0x04c6('0x49')]=_[_0x04c6('0x4c')](_0x2d6644[_0x04c6('0x49')],_0x30c3df);}_0x2d6644=_['merge']({},_0x2d6644,_0x478d7b[_0x04c6('0x4e')]);return db[_0x04c6('0x94')]['count']({'where':_0x2d6644['where']})['then'](function(_0x44d2ba){_0x10e0bc[_0x04c6('0x2b')]=_0x44d2ba;if(_0x478d7b[_0x04c6('0x3e')][_0x04c6('0x50')]){_0x2d6644['include']=[{'all':!![]}];}return db[_0x04c6('0x94')][_0x04c6('0x63')](_0x2d6644);})['then'](function(_0x488ed1){_0x10e0bc[_0x04c6('0x69')]=_0x488ed1;return _0x10e0bc;});}})[_0x04c6('0x32')](respondWithFilteredResult(_0x1d418a,_0x2d6644))[_0x04c6('0x27')](handleError(_0x1d418a,null));};exports[_0x04c6('0x36')]=function(_0x1fdda1,_0x43d4b1,_0x5a77ab){var _0x3800b2,_0x25d16c={},_0x54326f;if(_0x1fdda1[_0x04c6('0x56')]['to']){_0x54326f=_0x1fdda1[_0x04c6('0x56')]['to'][0x0];}return db['FaxAccount'][_0x04c6('0x54')]({'where':{'id':_0x1fdda1[_0x04c6('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x04c6('0x98'),'include':[{'model':db[_0x04c6('0x70')],'as':_0x04c6('0x99'),'where':{'fax':_0x54326f},'limit':0x1,'order':[[_0x04c6('0x8f'),_0x04c6('0x9a')]]}]}]})['then'](handleEntityNotFound(_0x43d4b1,null))[_0x04c6('0x32')](function(_0x21c8d4){_0x3800b2=_0x21c8d4;if(_0x1fdda1['body']['attachments']&&_0x1fdda1[_0x04c6('0x56')]['attachments'][_0x04c6('0x44')]){for(var _0x332dd6=0x0;_0x332dd6<_0x1fdda1[_0x04c6('0x56')]['attachments'][_0x04c6('0x44')];_0x332dd6+=0x1){_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][_0x332dd6]={'filename':_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][_0x332dd6][_0x04c6('0x35')],'id':_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][_0x332dd6]['id'],'path':path[_0x04c6('0x9c')](config[_0x04c6('0x9d')],_0x04c6('0x9e'),_0x1fdda1['body'][_0x04c6('0x9b')][_0x332dd6][_0x04c6('0x9f')])};}}return respondWithRpcPromise(_0x04c6('0xa0'),_0x04c6('0xa0'),{'FaxAccountId':_[_0x04c6('0xa1')](_0x1fdda1[_0x04c6('0x53')]['id'])?undefined:_0x1fdda1[_0x04c6('0x53')]['id'],'path':_[_0x04c6('0xa1')](_0x1fdda1['body'][_0x04c6('0x9b')][0x0][_0x04c6('0x7')])?undefined:_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][0x0][_0x04c6('0x7')],'fax':_['isNil'](_0x1fdda1[_0x04c6('0x56')]['to'][0x0])?undefined:_0x1fdda1[_0x04c6('0x56')]['to'][0x0]},client9002);})[_0x04c6('0x32')](function(){if(_0x3800b2){if(_[_0x04c6('0xa1')](_0x1fdda1[_0x04c6('0x56')][_0x04c6('0xa2')])){_0x1fdda1[_0x04c6('0x56')][_0x04c6('0xa2')]=util[_0x04c6('0x97')]('\x22%s\x22\x20<%s>',_0x3800b2[_0x04c6('0x35')],_0x3800b2[_0x04c6('0xa3')]);}if(_0x3800b2['List']){if(_0x3800b2['List'][_0x04c6('0x99')][_0x04c6('0x44')]){return _0x3800b2[_0x04c6('0x98')][_0x04c6('0x99')][0x0];}else{return db['CmContact'][_0x04c6('0x55')](_[_0x04c6('0xa4')](_0x1fdda1[_0x04c6('0x56')],{'firstName':_0x1fdda1[_0x04c6('0x56')]['to'][0x0],'phone':_0x1fdda1[_0x04c6('0x56')]['to'][0x0],'fax':_0x1fdda1[_0x04c6('0x56')]['to'][0x0],'ListId':_0x3800b2[_0x04c6('0x91')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x04c6('0x32')](function(_0xa7259f){if(_0xa7259f){return db[_0x04c6('0x6c')][_0x04c6('0x54')]({'where':{'ContactId':_0xa7259f['id'],'closed':![],'FaxAccountId':_0x3800b2['id']}})['then'](function(_0x94496f){if(_0x94496f){return[_0x94496f,![]];}return db[_0x04c6('0x6c')][_0x04c6('0x55')]({'UserId':_0x1fdda1[_0x04c6('0x57')]['id'],'ContactId':_0xa7259f['id'],'FaxAccountId':_0x3800b2['id'],'fax':_0x1fdda1['body']['to'][0x0],'firstMsgDirection':_0x04c6('0xa5'),'Messages':[_['merge'](_0x1fdda1[_0x04c6('0x56')],{'read':![],'body':_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][0x0][_0x04c6('0xa6')],'FaxAccountId':_0x3800b2['id'],'UserId':_0x1fdda1[_0x04c6('0x57')]['id'],'ContactId':_0xa7259f['id'],'AttachmentId':_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][0x0]['id']})]},{'include':[{'model':db[_0x04c6('0x94')],'as':'Messages'}]})[_0x04c6('0x32')](function(_0xf6026d){return[_0xf6026d,!![]];});});}else{throw new Error(_0x04c6('0xa7'));}})[_0x04c6('0xa8')](function(_0x7eff69,_0x3e3743){if(_0x3e3743){return _0x7eff69;}return db[_0x04c6('0x94')][_0x04c6('0x55')]({'direction':_0x04c6('0xa5'),'read':![],'body':_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][0x0][_0x04c6('0xa6')],'FaxAccountId':_0x3800b2['id'],'FaxInteractionId':_0x7eff69['id'],'UserId':_0x1fdda1[_0x04c6('0x57')]['id'],'ContactId':_0x7eff69[_0x04c6('0xa9')],'AttachmentId':_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][0x0]['id']})[_0x04c6('0x32')](function(_0xdf2e0f){_0x7eff69[_0x04c6('0xaa')]['Messages']=[];_0x7eff69[_0x04c6('0xaa')][_0x04c6('0xab')][_0x04c6('0x83')](_0xdf2e0f[_0x04c6('0xaa')]);return _0x7eff69;});})[_0x04c6('0x32')](function(_0x266dd6){respondWithRpcPromise(_0x04c6('0xac'),_0x04c6('0xac'),{'FaxAccountId':_[_0x04c6('0xa1')](_0x1fdda1[_0x04c6('0x53')]['id'])?undefined:_0x1fdda1[_0x04c6('0x53')]['id'],'path':_[_0x04c6('0xa1')](_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][0x0]['path'])?undefined:_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][0x0]['path'],'fax':_['isNil'](_0x1fdda1[_0x04c6('0x56')]['to'][0x0])?undefined:_0x1fdda1['body']['to'][0x0],'AttachmentId':_0x1fdda1[_0x04c6('0x56')][_0x04c6('0x9b')][0x0]['id']},client9002)['then'](function(_0x3e27af){logger['info'](_0x04c6('0xad'),_0x3e27af);})['catch'](function(_0x1c0f01){logger[_0x04c6('0x25')](_0x04c6('0xad'),_0x1c0f01);});return _0x266dd6;})[_0x04c6('0x32')](respondWithResult(_0x43d4b1,null))[_0x04c6('0x27')](handleError(_0x43d4b1,null));};exports[_0x04c6('0xae')]=function(_0x2f60b9,_0x20e702,_0x4b077a){return db['FaxAccount'][_0x04c6('0x54')]({'where':{'id':_0x2f60b9[_0x04c6('0x53')]['id']}})['then'](handleEntityNotFound(_0x20e702,null))['then'](function(_0x32bbdb){if(_0x32bbdb){return _0x32bbdb[_0x04c6('0xae')](_0x2f60b9['body'][_0x04c6('0x65')],_['omit'](_0x2f60b9['body'],[_0x04c6('0x65'),'id'])||{})[_0x04c6('0xa8')](function(_0x4b4acd){for(var _0x385d31=0x0;_0x385d31<_0x2f60b9[_0x04c6('0x56')][_0x04c6('0x65')][_0x04c6('0x44')];_0x385d31+=0x1){socket[_0x04c6('0xaf')]('userFaxAccount:save',{'UserId':_0x2f60b9[_0x04c6('0x56')][_0x04c6('0x65')][_0x385d31],'FaxAccountId':_0x2f60b9[_0x04c6('0x53')]['id']});}return _0x4b4acd;});}})['then'](respondWithResult(_0x20e702,null))['catch'](handleError(_0x20e702,null));};exports[_0x04c6('0xb0')]=function(_0x3fd6f9,_0x37281c,_0x41960d){return db['FaxAccount']['find']({'where':{'id':_0x3fd6f9[_0x04c6('0x53')]['id']}})[_0x04c6('0x32')](handleEntityNotFound(_0x37281c,null))[_0x04c6('0x32')](function(_0x5af843){if(_0x5af843){return _0x5af843[_0x04c6('0xb0')](_0x3fd6f9[_0x04c6('0x3e')][_0x04c6('0x65')])['then'](function(){if(_[_0x04c6('0xb1')](_0x3fd6f9[_0x04c6('0x3e')][_0x04c6('0x65')])){for(var _0x76608e=0x0;_0x76608e<_0x3fd6f9['query'][_0x04c6('0x65')][_0x04c6('0x44')];_0x76608e+=0x1){socket['emit'](_0x04c6('0xb2'),{'UserId':Number(_0x3fd6f9[_0x04c6('0x3e')]['ids'][_0x76608e]),'FaxAccountId':Number(_0x3fd6f9[_0x04c6('0x53')]['id'])});}}else{socket[_0x04c6('0xaf')]('userFaxAccount:remove',{'UserId':Number(_0x3fd6f9[_0x04c6('0x3e')][_0x04c6('0x65')]),'FaxAccountId':Number(_0x3fd6f9[_0x04c6('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x37281c,null))[_0x04c6('0x27')](handleError(_0x37281c,null));};exports[_0x04c6('0xb3')]=function(_0x2c3565,_0x3f62dc,_0x4b9df5){var _0x4eb798={};var _0x13baa1={};var _0x2cdb5b;var _0x5862e7;return db['FaxAccount']['findOne']({'where':{'id':_0x2c3565[_0x04c6('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f62dc,null))[_0x04c6('0x32')](function(_0x2af5d9){if(_0x2af5d9){_0x2cdb5b=_0x2af5d9;_0x13baa1['model']=_[_0x04c6('0x3f')](db[_0x04c6('0xb4')]['rawAttributes']);_0x13baa1[_0x04c6('0x3e')]=_[_0x04c6('0x3f')](_0x2c3565[_0x04c6('0x3e')]);_0x13baa1[_0x04c6('0x40')]=_[_0x04c6('0x41')](_0x13baa1[_0x04c6('0x3d')],_0x13baa1[_0x04c6('0x3e')]);_0x4eb798['attributes']=_[_0x04c6('0x41')](_0x13baa1[_0x04c6('0x3d')],qs[_0x04c6('0x43')](_0x2c3565[_0x04c6('0x3e')]['fields']));_0x4eb798[_0x04c6('0x42')]=_0x4eb798[_0x04c6('0x42')][_0x04c6('0x44')]?_0x4eb798[_0x04c6('0x42')]:_0x13baa1[_0x04c6('0x3d')];_0x4eb798[_0x04c6('0x47')]=qs[_0x04c6('0x48')](_0x2c3565[_0x04c6('0x3e')]['sort']);_0x4eb798[_0x04c6('0x49')]=qs[_0x04c6('0x40')](_['pick'](_0x2c3565[_0x04c6('0x3e')],_0x13baa1[_0x04c6('0x40')]));if(_0x2c3565[_0x04c6('0x3e')][_0x04c6('0x4b')]){_0x4eb798[_0x04c6('0x49')]=_['merge'](_0x4eb798[_0x04c6('0x49')],{'$or':_[_0x04c6('0x39')](_0x4eb798[_0x04c6('0x42')],function(_0xf03fa5){var _0x423360={};_0x423360[_0xf03fa5]={'$like':'%'+_0x2c3565['query']['filter']+'%'};return _0x423360;})});}_0x4eb798=_['merge']({},_0x4eb798,_0x2c3565['options']);return _0x2cdb5b[_0x04c6('0xb3')](_0x4eb798);}})[_0x04c6('0x32')](function(_0x24c564){if(_0x24c564){_0x5862e7=_0x24c564['length'];if(!_0x2c3565[_0x04c6('0x3e')][_0x04c6('0x45')]('nolimit')){_0x4eb798[_0x04c6('0x2d')]=qs[_0x04c6('0x2d')](_0x2c3565[_0x04c6('0x3e')][_0x04c6('0x2d')]);_0x4eb798[_0x04c6('0x2c')]=qs[_0x04c6('0x2c')](_0x2c3565[_0x04c6('0x3e')][_0x04c6('0x2c')]);}return _0x2cdb5b[_0x04c6('0xb3')](_0x4eb798);}})[_0x04c6('0x32')](function(_0x2b7662){if(_0x2b7662){return _0x2b7662?{'count':_0x5862e7,'rows':_0x2b7662}:null;}})['then'](respondWithResult(_0x3f62dc,null))[_0x04c6('0x27')](handleError(_0x3f62dc,null));}; \ No newline at end of file +var _0xe50a=['tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','FaxMessage','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','end','json','count','offset','limit','set','Content-Range','apply','reject','get','UserProfileResource','destroy','status','sendStatus','name','send','index','mandatoryDispositionPause','fieldName','type','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','options','FaxAccount','includeAll','include','findAll','catch','params','Pause','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','autoAssociation','update','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','order','pick','FaxAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe50a,0xf0));var _0xae50=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xe50a[_0x427352];return _0x23e0e6;};'use strict';var pdf=require(_0xae50('0x0'));var emlformat=require(_0xae50('0x1'));var rimraf=require(_0xae50('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae50('0x3'));var rp=require('request-promise');var moment=require(_0xae50('0x4'));var BPromise=require(_0xae50('0x5'));var Mustache=require('mustache');var util=require(_0xae50('0x6'));var path=require(_0xae50('0x7'));var sox=require(_0xae50('0x8'));var csv=require('to-csv');var ejs=require(_0xae50('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xae50('0xa'));var crypto=require('crypto');var jsforce=require(_0xae50('0xb'));var deskjs=require(_0xae50('0xc'));var toCsv=require(_0xae50('0xd'));var querystring=require(_0xae50('0xe'));var Papa=require(_0xae50('0xf'));var Redis=require(_0xae50('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xae50('0x11'));var as=require(_0xae50('0x12'));var hardwareService=require(_0xae50('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xae50('0x14'));var config=require(_0xae50('0x15'));var licenseUtil=require(_0xae50('0x16'));var db=require(_0xae50('0x17'))['db'];config['redis']=_[_0xae50('0x18')](config[_0xae50('0x19')],{'host':_0xae50('0x1a'),'port':0x18eb});var socket=require(_0xae50('0x1b'))(new Redis(config['redis']));require(_0xae50('0x1c'))[_0xae50('0x1d')](socket);var jayson=require(_0xae50('0x1e'));var client=jayson[_0xae50('0x1f')][_0xae50('0x20')]({'port':0x232c});var client9002=jayson[_0xae50('0x1f')][_0xae50('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x33ce9a,_0x5f5a35,_0x407353,_0xf2c5ac){return new BPromise(function(_0x852470,_0x25f42e){var _0x32eaa0=_0xf2c5ac||client;return _0x32eaa0['request'](_0x33ce9a,_0x407353)[_0xae50('0x21')](function(_0x28ed36){logger[_0xae50('0x22')]('FaxAccount,\x20%s,\x20%s',_0x5f5a35,_0xae50('0x23'));logger[_0xae50('0x24')](_0xae50('0x25'),_0x5f5a35,_0xae50('0x23'),JSON[_0xae50('0x26')](_0x28ed36));if(_0x28ed36[_0xae50('0x27')]){if(_0x28ed36[_0xae50('0x27')][_0xae50('0x28')]===0x1f4){logger[_0xae50('0x27')](_0xae50('0x29'),_0x5f5a35,_0x28ed36[_0xae50('0x27')][_0xae50('0x2a')]);return _0x25f42e(_0x28ed36[_0xae50('0x27')][_0xae50('0x2a')]);}logger[_0xae50('0x27')](_0xae50('0x29'),_0x5f5a35,_0x28ed36[_0xae50('0x27')][_0xae50('0x2a')]);return _0x852470(_0x28ed36[_0xae50('0x27')][_0xae50('0x2a')]);}else{logger[_0xae50('0x22')](_0xae50('0x29'),_0x5f5a35,_0xae50('0x23'));_0x852470(_0x28ed36[_0xae50('0x2b')]['message']);}})['catch'](function(_0x2930ac){logger[_0xae50('0x27')]('FaxAccount,\x20%s,\x20%s',_0x5f5a35,_0x2930ac);_0x25f42e(_0x2930ac);});});}function respondWithStatusCode(_0x24198c,_0x592d7f){_0x592d7f=_0x592d7f||0xcc;return function(_0x49a435){if(_0x49a435){return _0x24198c['sendStatus'](_0x592d7f);}return _0x24198c['status'](_0x592d7f)[_0xae50('0x2c')]();};}function respondWithResult(_0x246c6e,_0x2864e6){_0x2864e6=_0x2864e6||0xc8;return function(_0x140344){if(_0x140344){return _0x246c6e['status'](_0x2864e6)[_0xae50('0x2d')](_0x140344);}};}function respondWithFilteredResult(_0x34b600,_0x5b0ffd){return function(_0x1a9a82){if(_0x1a9a82){var _0xea9fa4=_0x1a9a82[_0xae50('0x2e')],_0x19f4f1=_0x5b0ffd[_0xae50('0x2f')],_0x53ff21=_0x5b0ffd[_0xae50('0x2f')]+_0x5b0ffd[_0xae50('0x30')],_0x2d519b;if(_0x53ff21>=_0xea9fa4){_0x53ff21=_0xea9fa4;_0x2d519b=0xc8;}else{_0x2d519b=0xce;}_0x34b600['status'](_0x2d519b);return _0x34b600[_0xae50('0x31')](_0xae50('0x32'),_0x19f4f1+'-'+_0x53ff21+'/'+_0xea9fa4)['json'](_0x1a9a82);}return null;};}function patchUpdates(_0x51521e){return function(_0x247d03){try{jsonpatch[_0xae50('0x33')](_0x247d03,_0x51521e,!![]);}catch(_0x5609b5){return BPromise[_0xae50('0x34')](_0x5609b5);}return _0x247d03['save']();};}function saveUpdates(_0xa6c4e6,_0x48b709){return function(_0x3cf52d){if(_0x3cf52d){return _0x3cf52d['update'](_0xa6c4e6)[_0xae50('0x21')](function(_0x4a7592){return _0x4a7592;});}return null;};}function removeEntity(_0x5cd4e1,_0x554056){return function(_0x2f5194){if(_0x2f5194){return _0x2f5194['destroy']()['then'](function(){var _0x1cc441=_0x2f5194[_0xae50('0x35')]({'plain':!![]});var _0x21c530='FaxAccounts';return db[_0xae50('0x36')][_0xae50('0x37')]({'where':{'type':_0x21c530,'resourceId':_0x1cc441['id']}})[_0xae50('0x21')](function(){return _0x2f5194;});})[_0xae50('0x21')](function(){_0x5cd4e1[_0xae50('0x38')](0xcc)[_0xae50('0x2c')]();});}};}function handleEntityNotFound(_0xb6662a,_0x4306cf){return function(_0x4a3f9f){if(!_0x4a3f9f){_0xb6662a[_0xae50('0x39')](0x194);}return _0x4a3f9f;};}function handleError(_0x52eb51,_0x744026){_0x744026=_0x744026||0x1f4;return function(_0x2d6f46){logger['error'](_0x2d6f46['stack']);if(_0x2d6f46['name']){delete _0x2d6f46[_0xae50('0x3a')];}_0x52eb51[_0xae50('0x38')](_0x744026)[_0xae50('0x3b')](_0x2d6f46);};}exports[_0xae50('0x3c')]=function(_0x5ad282,_0x1c473e){var _0x1c02a3={'include':[{'model':db['Pause'],'as':_0xae50('0x3d')}]},_0x471880={},_0x3bb7e5={'count':0x0,'rows':[]};var _0x307b5c=_['map'](db['FaxAccount']['rawAttributes'],function(_0x1d7e7f){return{'name':_0x1d7e7f[_0xae50('0x3e')],'type':_0x1d7e7f[_0xae50('0x3f')]['key']};});_0x471880[_0xae50('0x40')]=_[_0xae50('0x41')](_0x307b5c,_0xae50('0x3a'));_0x471880[_0xae50('0x42')]=_[_0xae50('0x43')](_0x5ad282[_0xae50('0x42')]);_0x471880[_0xae50('0x44')]=_[_0xae50('0x45')](_0x471880[_0xae50('0x40')],_0x471880['query']);_0x1c02a3['attributes']=_[_0xae50('0x45')](_0x471880['model'],qs['fields'](_0x5ad282['query']['fields']));_0x1c02a3[_0xae50('0x46')]=_0x1c02a3[_0xae50('0x46')]['length']?_0x1c02a3['attributes']:_0x471880['model'];if(!_0x5ad282[_0xae50('0x42')][_0xae50('0x47')](_0xae50('0x48'))){_0x1c02a3[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x5ad282['query'][_0xae50('0x30')]);_0x1c02a3[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x5ad282['query'][_0xae50('0x2f')]);}_0x1c02a3['order']=qs[_0xae50('0x49')](_0x5ad282[_0xae50('0x42')][_0xae50('0x49')]);_0x1c02a3[_0xae50('0x4a')]=qs[_0xae50('0x44')](_['pick'](_0x5ad282[_0xae50('0x42')],_0x471880[_0xae50('0x44')]),_0x307b5c);if(_0x5ad282[_0xae50('0x42')][_0xae50('0x4b')]){_0x1c02a3[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0x1c02a3['where'],{'$or':_['map'](_0x307b5c,function(_0xef9590){if(_0xef9590[_0xae50('0x3f')]!=='VIRTUAL'){var _0x51e428={};_0x51e428[_0xef9590[_0xae50('0x3a')]]={'$like':'%'+_0x5ad282['query'][_0xae50('0x4b')]+'%'};return _0x51e428;}})});}_0x1c02a3=_[_0xae50('0x4c')]({},_0x1c02a3,_0x5ad282[_0xae50('0x4d')]);var _0x2b96bd={'where':_0x1c02a3['where']};return db[_0xae50('0x4e')][_0xae50('0x2e')](_0x2b96bd)[_0xae50('0x21')](function(_0xd23c47){_0x3bb7e5['count']=_0xd23c47;if(_0x5ad282[_0xae50('0x42')][_0xae50('0x4f')]){_0x1c02a3[_0xae50('0x50')]=[{'all':!![]}];}return db[_0xae50('0x4e')][_0xae50('0x51')](_0x1c02a3);})[_0xae50('0x21')](function(_0x1445c7){_0x3bb7e5['rows']=_0x1445c7;return _0x3bb7e5;})[_0xae50('0x21')](respondWithFilteredResult(_0x1c473e,_0x1c02a3))[_0xae50('0x52')](handleError(_0x1c473e,null));};exports['show']=function(_0xe94fe4,_0x129c35){var _0x3dea71={'raw':![],'where':{'id':_0xe94fe4[_0xae50('0x53')]['id']},'include':[{'model':db[_0xae50('0x54')],'as':_0xae50('0x3d')}]},_0x3d7b25={};_0x3d7b25['model']=_[_0xae50('0x43')](db[_0xae50('0x4e')]['rawAttributes']);_0x3d7b25[_0xae50('0x42')]=_[_0xae50('0x43')](_0xe94fe4[_0xae50('0x42')]);_0x3d7b25[_0xae50('0x44')]=_[_0xae50('0x45')](_0x3d7b25[_0xae50('0x40')],_0x3d7b25['query']);_0x3dea71[_0xae50('0x46')]=_[_0xae50('0x45')](_0x3d7b25[_0xae50('0x40')],qs[_0xae50('0x55')](_0xe94fe4[_0xae50('0x42')][_0xae50('0x55')]));_0x3dea71[_0xae50('0x46')]=_0x3dea71['attributes'][_0xae50('0x56')]?_0x3dea71[_0xae50('0x46')]:_0x3d7b25[_0xae50('0x40')];if(_0xe94fe4['query'][_0xae50('0x4f')]){_0x3dea71[_0xae50('0x50')]=[{'all':!![]}];}_0x3dea71=_[_0xae50('0x4c')]({},_0x3dea71,_0xe94fe4[_0xae50('0x4d')]);return db[_0xae50('0x4e')][_0xae50('0x57')](_0x3dea71)[_0xae50('0x21')](handleEntityNotFound(_0x129c35,null))[_0xae50('0x21')](respondWithResult(_0x129c35,null))[_0xae50('0x52')](handleError(_0x129c35,null));};exports[_0xae50('0x58')]=function(_0x418088,_0x107c79){return db[_0xae50('0x4e')][_0xae50('0x58')](_0x418088[_0xae50('0x59')],{})['then'](function(_0x401a59){var _0x1e2a7e=_0x418088[_0xae50('0x5a')]['get']({'plain':!![]});if(!_0x1e2a7e)throw new Error(_0xae50('0x5b'));if(_0x1e2a7e[_0xae50('0x5c')]==='user'){var _0x445749=_0x401a59[_0xae50('0x35')]({'plain':!![]});var _0x3ef67e=_0xae50('0x5d');return db['UserProfileSection'][_0xae50('0x57')]({'where':{'name':_0x3ef67e,'userProfileId':_0x1e2a7e[_0xae50('0x5e')]},'raw':!![]})[_0xae50('0x21')](function(_0x1e5d43){if(_0x1e5d43&&_0x1e5d43[_0xae50('0x5f')]===0x0){return db[_0xae50('0x36')]['create']({'name':_0x445749[_0xae50('0x3a')],'resourceId':_0x445749['id'],'type':_0x1e5d43[_0xae50('0x3a')],'sectionId':_0x1e5d43['id']},{})[_0xae50('0x21')](function(){return _0x401a59;});}else{return _0x401a59;}})[_0xae50('0x52')](function(_0x4372fd){logger[_0xae50('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4372fd);throw _0x4372fd;});}return _0x401a59;})[_0xae50('0x21')](respondWithResult(_0x107c79,0xc9))[_0xae50('0x52')](handleError(_0x107c79,null));};exports[_0xae50('0x60')]=function(_0x4a65a7,_0x186abc){if(_0x4a65a7[_0xae50('0x59')]['id']){delete _0x4a65a7[_0xae50('0x59')]['id'];}return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x4a65a7[_0xae50('0x53')]['id']},'include':[{'model':db[_0xae50('0x54')],'as':_0xae50('0x3d')}]})['then'](handleEntityNotFound(_0x186abc,null))[_0xae50('0x21')](saveUpdates(_0x4a65a7['body'],null))[_0xae50('0x21')](respondWithResult(_0x186abc,null))['catch'](handleError(_0x186abc,null));};exports[_0xae50('0x37')]=function(_0x3cdff5,_0x404632){return db['FaxAccount'][_0xae50('0x57')]({'where':{'id':_0x3cdff5[_0xae50('0x53')]['id']}})['then'](handleEntityNotFound(_0x404632,null))[_0xae50('0x21')](removeEntity(_0x404632,null))['catch'](handleError(_0x404632,null));};exports['describe']=function(_0x3d0126,_0x21a863){return db[_0xae50('0x4e')][_0xae50('0x61')]()['then'](respondWithResult(_0x21a863,null))['catch'](handleError(_0x21a863,null));};exports[_0xae50('0x62')]=function(_0xe30929,_0x1e5b87,_0x2cccbb){if(_0xe30929[_0xae50('0x59')]['id']){delete _0xe30929[_0xae50('0x59')]['id'];}return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0xe30929[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x1e5b87,null))[_0xae50('0x21')](function(_0x191e27){if(_0x191e27){_0xe30929['body']['FaxAccountId']=_0x191e27['id'];return db[_0xae50('0x63')][_0xae50('0x58')](_0xe30929[_0xae50('0x59')]);}})[_0xae50('0x21')](respondWithResult(_0x1e5b87,null))[_0xae50('0x52')](handleError(_0x1e5b87,null));};exports[_0xae50('0x64')]=function(_0x1365bb,_0x35f226,_0x2fb9ca){var _0x154def={'raw':![],'where':{}};var _0xc143e8={};var _0x2e8152={'count':0x0,'rows':[]};return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x1365bb[_0xae50('0x53')]['id']}})['then'](handleEntityNotFound(_0x35f226,null))[_0xae50('0x21')](function(_0x26a4e9){if(_0x26a4e9){_0xc143e8[_0xae50('0x40')]=_[_0xae50('0x43')](db[_0xae50('0x63')][_0xae50('0x66')]);_0xc143e8['query']=_[_0xae50('0x43')](_0x1365bb[_0xae50('0x42')]);_0xc143e8['filters']=_['intersection'](_0xc143e8['model'],_0xc143e8[_0xae50('0x42')]);_0x154def['attributes']=_[_0xae50('0x45')](_0xc143e8[_0xae50('0x40')],qs['fields'](_0x1365bb[_0xae50('0x42')][_0xae50('0x55')]));_0x154def[_0xae50('0x46')]=_0x154def[_0xae50('0x46')][_0xae50('0x56')]?_0x154def[_0xae50('0x46')]:_0xc143e8[_0xae50('0x40')];if(!_0x1365bb[_0xae50('0x42')][_0xae50('0x47')]('nolimit')){_0x154def[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x1365bb[_0xae50('0x42')][_0xae50('0x30')]);_0x154def[_0xae50('0x2f')]=qs['offset'](_0x1365bb[_0xae50('0x42')][_0xae50('0x2f')]);}_0x154def[_0xae50('0x67')]=qs['sort'](_0x1365bb[_0xae50('0x42')][_0xae50('0x49')]);_0x154def['where']=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x1365bb['query'],_0xc143e8[_0xae50('0x44')]));_0x154def['where'][_0xae50('0x69')]=_0x26a4e9['id'];if(_0x1365bb[_0xae50('0x42')][_0xae50('0x4b')]){_0x154def[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0x154def[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x154def[_0xae50('0x46')],function(_0x1b1fb9){var _0x2ccef7={};_0x2ccef7[_0x1b1fb9]={'$like':'%'+_0x1365bb['query'][_0xae50('0x4b')]+'%'};return _0x2ccef7;})});}_0x154def=_[_0xae50('0x4c')]({},_0x154def,_0x1365bb[_0xae50('0x4d')]);return db[_0xae50('0x63')][_0xae50('0x2e')]({'where':_0x154def[_0xae50('0x4a')]})['then'](function(_0x5565a6){_0x2e8152[_0xae50('0x2e')]=_0x5565a6;if(_0x1365bb[_0xae50('0x42')]['includeAll']){_0x154def['include']=[{'all':!![]}];}return db[_0xae50('0x63')]['findAll'](_0x154def);})[_0xae50('0x21')](function(_0x367b06){_0x2e8152[_0xae50('0x6a')]=_0x367b06;return _0x2e8152;});}})[_0xae50('0x21')](respondWithFilteredResult(_0x35f226,_0x154def))['catch'](handleError(_0x35f226,null));};exports[_0xae50('0x6b')]=function(_0x47831d,_0x6918ac,_0x52ff42){return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x47831d[_0xae50('0x53')]['id']}})['then'](handleEntityNotFound(_0x6918ac,null))[_0xae50('0x21')](function(_0x53f18f){if(_0x53f18f){return _0x53f18f[_0xae50('0x6b')](_0x47831d[_0xae50('0x42')][_0xae50('0x6c')]);}})[_0xae50('0x21')](respondWithStatusCode(_0x6918ac,null))[_0xae50('0x52')](handleError(_0x6918ac,null));};exports[_0xae50('0x6d')]=function(_0x220c5b,_0x4c64f4,_0x4450fd){if(_0x220c5b[_0xae50('0x59')]['id']){delete _0x220c5b[_0xae50('0x59')]['id'];}return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x220c5b[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x4c64f4,null))[_0xae50('0x21')](function(_0x27ca41){if(_0x27ca41){_0x220c5b[_0xae50('0x59')][_0xae50('0x69')]=_0x27ca41['id'];return db[_0xae50('0x6e')][_0xae50('0x58')](_0x220c5b[_0xae50('0x59')]);}})['then'](respondWithResult(_0x4c64f4,null))[_0xae50('0x52')](handleError(_0x4c64f4,null));};exports[_0xae50('0x6f')]=function(_0x3f9a53,_0x26e176,_0x4d652c){var _0x199ec4={'raw':![],'where':{}};var _0xef0f30={};var _0x3b58f7={'count':0x0,'rows':[]};return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x3f9a53[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x26e176,null))['then'](function(_0x20af3f){if(_0x20af3f){_0xef0f30['model']=_[_0xae50('0x43')](db[_0xae50('0x6e')]['rawAttributes']);_0xef0f30['query']=_[_0xae50('0x43')](_0x3f9a53[_0xae50('0x42')]);_0xef0f30[_0xae50('0x44')]=_[_0xae50('0x45')](_0xef0f30[_0xae50('0x40')],_0xef0f30[_0xae50('0x42')]);_0x199ec4['attributes']=_[_0xae50('0x45')](_0xef0f30[_0xae50('0x40')],qs['fields'](_0x3f9a53['query']['fields']));_0x199ec4['attributes']=_0x199ec4['attributes'][_0xae50('0x56')]?_0x199ec4[_0xae50('0x46')]:_0xef0f30[_0xae50('0x40')];if(!_0x3f9a53[_0xae50('0x42')][_0xae50('0x47')](_0xae50('0x48'))){_0x199ec4[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x3f9a53[_0xae50('0x42')][_0xae50('0x30')]);_0x199ec4['offset']=qs[_0xae50('0x2f')](_0x3f9a53[_0xae50('0x42')][_0xae50('0x2f')]);}_0x199ec4[_0xae50('0x67')]=qs[_0xae50('0x49')](_0x3f9a53[_0xae50('0x42')][_0xae50('0x49')]);_0x199ec4[_0xae50('0x4a')]=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x3f9a53['query'],_0xef0f30[_0xae50('0x44')]));_0x199ec4[_0xae50('0x4a')][_0xae50('0x69')]=_0x20af3f['id'];if(_0x3f9a53[_0xae50('0x42')][_0xae50('0x4b')]){_0x199ec4[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0x199ec4[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x199ec4[_0xae50('0x46')],function(_0x5d6850){var _0x1fdd4f={};_0x1fdd4f[_0x5d6850]={'$like':'%'+_0x3f9a53['query']['filter']+'%'};return _0x1fdd4f;})});}_0x199ec4=_[_0xae50('0x4c')]({},_0x199ec4,_0x3f9a53['options']);return db[_0xae50('0x6e')][_0xae50('0x2e')]({'where':_0x199ec4[_0xae50('0x4a')]})[_0xae50('0x21')](function(_0x5d8501){_0x3b58f7[_0xae50('0x2e')]=_0x5d8501;if(_0x3f9a53[_0xae50('0x42')][_0xae50('0x4f')]){_0x199ec4['include']=[{'all':!![]}];}return db[_0xae50('0x6e')][_0xae50('0x51')](_0x199ec4);})[_0xae50('0x21')](function(_0x24b4d2){_0x3b58f7[_0xae50('0x6a')]=_0x24b4d2;return _0x3b58f7;});}})['then'](respondWithFilteredResult(_0x26e176,_0x199ec4))[_0xae50('0x52')](handleError(_0x26e176,null));};exports[_0xae50('0x70')]=function(_0x396475,_0x101c4b,_0x1c2bd5){return db[_0xae50('0x4e')]['find']({'where':{'id':_0x396475[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x101c4b,null))[_0xae50('0x21')](function(_0x5ae875){if(_0x5ae875){return _0x5ae875[_0xae50('0x70')](_0x396475[_0xae50('0x42')][_0xae50('0x6c')]);}})['then'](respondWithStatusCode(_0x101c4b,null))[_0xae50('0x52')](handleError(_0x101c4b,null));};exports[_0xae50('0x71')]=function(_0x54d50f,_0x1b6988,_0x4fde00){return db[_0xae50('0x72')][_0xae50('0x57')]({'where':{'id':_0x54d50f[_0xae50('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b6988,null))[_0xae50('0x21')](function(_0x56dfce){if(_0x56dfce){return _0x56dfce[_0xae50('0x71')](_0x54d50f[_0xae50('0x59')][_0xae50('0x6c')],_[_0xae50('0x73')](_0x54d50f[_0xae50('0x59')],[_0xae50('0x6c'),'id'])||{});}})[_0xae50('0x21')](respondWithResult(_0x1b6988,null))[_0xae50('0x52')](handleError(_0x1b6988,null));};exports[_0xae50('0x74')]=function(_0x37e0f4,_0x5c8ad6,_0x44dd17){var _0x32320b={'raw':![],'where':{}};var _0x394ef4={};var _0x2cadf1={'count':0x0,'rows':[]};return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x37e0f4[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x5c8ad6,null))[_0xae50('0x21')](function(_0x3d877c){if(_0x3d877c){_0x394ef4[_0xae50('0x40')]=_[_0xae50('0x43')](db[_0xae50('0x72')][_0xae50('0x66')]);_0x394ef4[_0xae50('0x42')]=_['keys'](_0x37e0f4[_0xae50('0x42')]);_0x394ef4['filters']=_[_0xae50('0x45')](_0x394ef4['model'],_0x394ef4[_0xae50('0x42')]);_0x32320b[_0xae50('0x46')]=_[_0xae50('0x45')](_0x394ef4[_0xae50('0x40')],qs[_0xae50('0x55')](_0x37e0f4[_0xae50('0x42')][_0xae50('0x55')]));_0x32320b[_0xae50('0x46')]=_0x32320b[_0xae50('0x46')][_0xae50('0x56')]?_0x32320b[_0xae50('0x46')]:_0x394ef4[_0xae50('0x40')];if(!_0x37e0f4[_0xae50('0x42')][_0xae50('0x47')]('nolimit')){_0x32320b[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x37e0f4[_0xae50('0x42')][_0xae50('0x30')]);_0x32320b[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x37e0f4[_0xae50('0x42')]['offset']);}_0x32320b['order']=qs[_0xae50('0x49')](_0x37e0f4[_0xae50('0x42')][_0xae50('0x49')]);_0x32320b[_0xae50('0x4a')]=qs[_0xae50('0x44')](_['pick'](_0x37e0f4['query'],_0x394ef4[_0xae50('0x44')]));_0x32320b[_0xae50('0x4a')][_0xae50('0x69')]=_0x3d877c['id'];if(_0x37e0f4[_0xae50('0x42')][_0xae50('0x4b')]){_0x32320b['where']=_[_0xae50('0x4c')](_0x32320b[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x32320b[_0xae50('0x46')],function(_0x41c21d){var _0x333490={};_0x333490[_0x41c21d]={'$like':'%'+_0x37e0f4['query'][_0xae50('0x4b')]+'%'};return _0x333490;})});}_0x32320b=_[_0xae50('0x4c')]({},_0x32320b,_0x37e0f4[_0xae50('0x4d')]);return db['FaxInteraction'][_0xae50('0x2e')]({'where':_0x32320b[_0xae50('0x4a')]})['then'](function(_0x5d02e6){_0x2cadf1[_0xae50('0x2e')]=_0x5d02e6;if(_0x37e0f4[_0xae50('0x42')][_0xae50('0x4f')]){_0x32320b[_0xae50('0x50')]=[{'model':db[_0xae50('0x75')],'as':'Contact','required':![]},{'model':db[_0xae50('0x76')],'as':_0xae50('0x77'),'attributes':['name',_0xae50('0x78'),_0xae50('0x79')],'required':![]},{'model':db[_0xae50('0x7a')],'as':_0xae50('0x7b'),'attributes':['id',_0xae50('0x3a'),_0xae50('0x7c')],'where':_0x37e0f4[_0xae50('0x42')][_0xae50('0x7d')]?{'id':_0x37e0f4['query'][_0xae50('0x7d')]}:undefined,'required':_0x37e0f4['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0xae50('0x51')](_0x32320b);})[_0xae50('0x21')](function(_0x5cf1aa){_0x2cadf1[_0xae50('0x6a')]=_0x5cf1aa;return _0x2cadf1;});}})[_0xae50('0x21')](respondWithFilteredResult(_0x5c8ad6,_0x32320b))['catch'](handleError(_0x5c8ad6,null));};exports['addApplications']=function(_0x465b08,_0x4969d9,_0x377cf0){return db[_0xae50('0x4e')]['findOne']({'where':{'id':_0x465b08['params']['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x4969d9,null))[_0xae50('0x21')](function(_0x851da2){if(_0x851da2){return db[_0xae50('0x7e')][_0xae50('0x7f')](function(_0x41d760){return db[_0xae50('0x80')][_0xae50('0x37')]({'where':{'FaxAccountId':_0x465b08['params']['id']},'transaction':_0x41d760})['then'](function(_0x2b660c){var _0x5b4f74=_[_0xae50('0x41')](_0x465b08['body'],function(_0x506303){_0x506303[_0xae50('0x69')]=_0x465b08[_0xae50('0x53')]['id'];return _0x506303;});return db[_0xae50('0x80')][_0xae50('0x81')](_0x5b4f74,{'transaction':_0x41d760});});})[_0xae50('0x21')](function(){return db[_0xae50('0x80')]['findAndCountAll']({'where':{'FaxAccountId':_0x465b08[_0xae50('0x53')]['id']},'order':_0xae50('0x82')});});}})['then'](respondWithResult(_0x4969d9,null))[_0xae50('0x52')](handleError(_0x4969d9,null));};exports[_0xae50('0x83')]=function(_0x201768,_0x1eacfd,_0x4250b8){var _0x4afcc9={};var _0x37546a={};var _0x405905;var _0x34367c;return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x201768[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x1eacfd,null))[_0xae50('0x21')](function(_0x2f9d56){if(_0x2f9d56){_0x405905=_0x2f9d56;_0x37546a[_0xae50('0x40')]=_['keys'](db['FaxApplication']['rawAttributes']);_0x37546a[_0xae50('0x42')]=_[_0xae50('0x43')](_0x201768[_0xae50('0x42')]);_0x37546a['filters']=_[_0xae50('0x45')](_0x37546a[_0xae50('0x40')],_0x37546a['query']);_0x4afcc9[_0xae50('0x46')]=_['intersection'](_0x37546a[_0xae50('0x40')],qs[_0xae50('0x55')](_0x201768['query'][_0xae50('0x55')]));_0x4afcc9[_0xae50('0x46')]=_0x4afcc9['attributes'][_0xae50('0x56')]?_0x4afcc9['attributes']:_0x37546a[_0xae50('0x40')];_0x4afcc9[_0xae50('0x67')]=qs[_0xae50('0x49')](_0x201768[_0xae50('0x42')][_0xae50('0x49')]);_0x4afcc9[_0xae50('0x4a')]=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x201768[_0xae50('0x42')],_0x37546a[_0xae50('0x44')]));if(_0x201768[_0xae50('0x42')][_0xae50('0x4b')]){_0x4afcc9[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0x4afcc9[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x4afcc9[_0xae50('0x46')],function(_0x3b83eb){var _0x3c4cba={};_0x3c4cba[_0x3b83eb]={'$like':'%'+_0x201768[_0xae50('0x42')][_0xae50('0x4b')]+'%'};return _0x3c4cba;})});}_0x4afcc9=_[_0xae50('0x4c')]({},_0x4afcc9,_0x201768[_0xae50('0x4d')]);return _0x405905['getApplications'](_0x4afcc9);}})['then'](function(_0x338080){if(_0x338080){_0x34367c=_0x338080[_0xae50('0x56')];if(!_0x201768[_0xae50('0x42')][_0xae50('0x47')](_0xae50('0x48'))){_0x4afcc9[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x201768[_0xae50('0x42')][_0xae50('0x30')]);_0x4afcc9[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x201768[_0xae50('0x42')][_0xae50('0x2f')]);}return _0x405905[_0xae50('0x83')](_0x4afcc9);}})['then'](function(_0x2f1e14){if(_0x2f1e14){return _0x2f1e14?{'count':_0x34367c,'rows':_0x2f1e14}:null;}})['then'](respondWithResult(_0x1eacfd,null))['catch'](handleError(_0x1eacfd,null));};function Extension(_0x5eda26,_0x40eae7,_0x20fb3c,_0xaa2ca0){this['context']=_0xae50('0x84');this[_0xae50('0x85')]=_0x5eda26['localstationid'];this[_0xae50('0x86')]=_0xaa2ca0;this[_0xae50('0x3f')]=_0xae50('0x87');this[_0xae50('0x88')]=_0xae50('0x89');this[_0xae50('0x69')]=_0x5eda26['id'];this[_0xae50('0x82')]=_0x40eae7;this[_0xae50('0x8a')]=_0x20fb3c;}function createExtensionsReciveFax(_0x4276c8){var _0x8801=0x1;var _0x2a6638=[];_0x2a6638[_0xae50('0x8b')](new Extension(_0x4276c8,_0x8801,'',_0xae50('0x8c')));_0x8801+=0x1;_0x2a6638[_0xae50('0x8b')](new Extension(_0x4276c8,_0x8801,_0xae50('0x8d'),_0xae50('0x8e')));_0x8801+=0x1;for(var _0x1271c1 in _0x4276c8){if(_0x4276c8[_0xae50('0x47')](_0x1271c1)&&(_0x1271c1===_0xae50('0x8f')||_0x1271c1===_0xae50('0x90')||_0x1271c1===_0xae50('0x91')||_0x1271c1===_0xae50('0x92')||_0x1271c1==='headerinfo'||_0x1271c1==='maxrate'||_0x1271c1===_0xae50('0x93')||_0x1271c1===_0xae50('0x94')||_0x1271c1===_0xae50('0x95'))){_0x2a6638['push'](new Extension(_0x4276c8,_0x8801,_0xae50('0x96')+_0x1271c1+')='+_0x4276c8[_0x1271c1],_0xae50('0x8e')));_0x8801+=0x1;}}_0x2a6638[_0xae50('0x8b')](new Extension(_0x4276c8,_0x8801,'6','Wait'));_0x8801+=0x1;_0x2a6638[_0xae50('0x8b')](new Extension(_0x4276c8,_0x8801,_0xae50('0x97'),_0xae50('0x98')));_0x8801=0x0;return _0x2a6638;}exports[_0xae50('0x99')]=function(_0x14f702,_0x425cd7,_0x3f0b9c){var _0x5c413d;return db[_0xae50('0x7e')][_0xae50('0x7f')](function(_0x51341a){return db[_0xae50('0x4e')][_0xae50('0x58')](_0x14f702['body'],{'transaction':_0x51341a})['then'](function(_0x129362){_0x5c413d=_0x129362[_0xae50('0x35')]({'plain':!![]});return db[_0xae50('0x9a')]['bulkCreate'](createExtensionsReciveFax(_0x5c413d),{'transaction':_0x51341a});});})[_0xae50('0x21')](function(){return _0x5c413d;})[_0xae50('0x21')](respondWithResult(_0x425cd7,null))[_0xae50('0x52')](handleError(_0x425cd7,null));};exports[_0xae50('0x9b')]=function(_0x38a3d0,_0x1a7994,_0x3accf5){var _0x49eaad;return db[_0xae50('0x7e')][_0xae50('0x7f')](function(_0x6991d9){return db[_0xae50('0x4e')]['update'](_0x38a3d0['body'],{'where':{'id':_0x38a3d0[_0xae50('0x59')]['id']},'transaction':_0x6991d9})[_0xae50('0x21')](function(_0x454df0){return db[_0xae50('0x9a')][_0xae50('0x37')]({'where':{'FaxAccountId':_0x38a3d0[_0xae50('0x59')]['id']},'transaction':_0x6991d9})[_0xae50('0x21')](function(_0xb54f97){return db['VoiceExtension'][_0xae50('0x81')](createExtensionsReciveFax(_[_0xae50('0x73')](_0x38a3d0[_0xae50('0x59')],[_0xae50('0x9c'),_0xae50('0x9d'),_0xae50('0x9e'),_0xae50('0x9f'),_0xae50('0xa0'),_0xae50('0xa1')])),{'transaction':_0x6991d9});});});})[_0xae50('0x21')](function(){return db['FaxAccount'][_0xae50('0xa2')](_0x38a3d0[_0xae50('0x59')]['id']);})[_0xae50('0x21')](respondWithResult(_0x1a7994,null))[_0xae50('0x52')](handleError(_0x1a7994,null));};exports[_0xae50('0xa3')]=function(_0x2aaad3,_0x34e66b,_0x21b653){var _0x215c59={'raw':!![],'where':{}};var _0x28fba5={};var _0x35cea3={'count':0x0,'rows':[]};return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x2aaad3[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x34e66b,null))[_0xae50('0x21')](function(_0x4b1d48){if(_0x4b1d48){_0x28fba5[_0xae50('0x40')]=_[_0xae50('0x43')](db['FaxMessage'][_0xae50('0x66')]);_0x28fba5[_0xae50('0x42')]=_[_0xae50('0x43')](_0x2aaad3[_0xae50('0x42')]);_0x28fba5[_0xae50('0x44')]=_[_0xae50('0x45')](_0x28fba5[_0xae50('0x40')],_0x28fba5[_0xae50('0x42')]);_0x215c59[_0xae50('0x46')]=_[_0xae50('0x45')](_0x28fba5[_0xae50('0x40')],qs[_0xae50('0x55')](_0x2aaad3[_0xae50('0x42')]['fields']));_0x215c59[_0xae50('0x46')]=_0x215c59[_0xae50('0x46')][_0xae50('0x56')]?_0x215c59['attributes']:_0x28fba5[_0xae50('0x40')];if(!_0x2aaad3[_0xae50('0x42')][_0xae50('0x47')]('nolimit')){_0x215c59['limit']=qs['limit'](_0x2aaad3['query'][_0xae50('0x30')]);_0x215c59[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x2aaad3[_0xae50('0x42')]['offset']);}_0x215c59[_0xae50('0x67')]=qs['sort'](_0x2aaad3['query'][_0xae50('0x49')]);_0x215c59['where']=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x2aaad3[_0xae50('0x42')],_0x28fba5[_0xae50('0x44')]));_0x215c59[_0xae50('0x4a')][_0xae50('0x69')]=_0x4b1d48['id'];if(_0x2aaad3[_0xae50('0x42')]['filter']){_0x215c59['where']=_[_0xae50('0x4c')](_0x215c59[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x215c59[_0xae50('0x46')],function(_0x151516){var _0x44d70a={};_0x44d70a[_0x151516]={'$like':'%'+_0x2aaad3[_0xae50('0x42')]['filter']+'%'};return _0x44d70a;})});}if(_0x2aaad3[_0xae50('0x42')][_0xae50('0xa4')]){var _0x2b9322=_0x2aaad3[_0xae50('0x42')][_0xae50('0xa4')][_0xae50('0xa5')](',');var _0x352676={};_0x352676[_0x2b9322[0x0]]={'$gte':moment(_0x2b9322[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x215c59['where']=_[_0xae50('0x4c')](_0x215c59[_0xae50('0x4a')],_0x352676);}_0x215c59=_['merge']({},_0x215c59,_0x2aaad3[_0xae50('0x4d')]);return db[_0xae50('0xa6')][_0xae50('0x2e')]({'where':_0x215c59['where']})[_0xae50('0x21')](function(_0x2479a8){_0x35cea3[_0xae50('0x2e')]=_0x2479a8;if(_0x2aaad3[_0xae50('0x42')][_0xae50('0x4f')]){_0x215c59['include']=[{'all':!![]}];}return db[_0xae50('0xa6')]['findAll'](_0x215c59);})[_0xae50('0x21')](function(_0xfc8ac6){_0x35cea3[_0xae50('0x6a')]=_0xfc8ac6;return _0x35cea3;});}})[_0xae50('0x21')](respondWithFilteredResult(_0x34e66b,_0x215c59))[_0xae50('0x52')](handleError(_0x34e66b,null));};exports[_0xae50('0x3b')]=function(_0x511a3a,_0x5a8c1d,_0x263fc3){var _0x100f0f,_0xa4a24e={},_0x51323a;if(_0x511a3a[_0xae50('0x59')]['to']){_0x51323a=_0x511a3a['body']['to'][0x0];}return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x511a3a['params']['id']},'include':[{'model':db[_0xae50('0xa7')],'as':_0xae50('0xa8'),'include':[{'model':db[_0xae50('0x75')],'as':_0xae50('0xa9'),'where':{'fax':_0x51323a},'limit':0x1,'order':[[_0xae50('0x9f'),'DESC']]}]}]})[_0xae50('0x21')](handleEntityNotFound(_0x5a8c1d,null))[_0xae50('0x21')](function(_0x4736a6){_0x100f0f=_0x4736a6;if(_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')]&&_0x511a3a[_0xae50('0x59')]['attachments'][_0xae50('0x56')]){for(var _0x593d20=0x0;_0x593d20<_0x511a3a['body'][_0xae50('0xaa')][_0xae50('0x56')];_0x593d20+=0x1){_0x511a3a[_0xae50('0x59')]['attachments'][_0x593d20]={'filename':_0x511a3a['body'][_0xae50('0xaa')][_0x593d20][_0xae50('0x3a')],'id':_0x511a3a['body'][_0xae50('0xaa')][_0x593d20]['id'],'path':path[_0xae50('0xab')](config[_0xae50('0xac')],_0xae50('0xad'),_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][_0x593d20][_0xae50('0xae')])};}}return respondWithRpcPromise('CheckAfterSend',_0xae50('0xaf'),{'FaxAccountId':_[_0xae50('0xb0')](_0x511a3a[_0xae50('0x53')]['id'])?undefined:_0x511a3a[_0xae50('0x53')]['id'],'path':_['isNil'](_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][0x0]['path'])?undefined:_0x511a3a['body']['attachments'][0x0][_0xae50('0x7')],'fax':_[_0xae50('0xb0')](_0x511a3a[_0xae50('0x59')]['to'][0x0])?undefined:_0x511a3a[_0xae50('0x59')]['to'][0x0]},client9002);})['then'](function(){if(_0x100f0f){if(_['isNil'](_0x511a3a[_0xae50('0x59')][_0xae50('0xb1')])){_0x511a3a[_0xae50('0x59')][_0xae50('0xb1')]=util[_0xae50('0xb2')](_0xae50('0xb3'),_0x100f0f[_0xae50('0x3a')],_0x100f0f[_0xae50('0xb4')]);}if(_0x100f0f[_0xae50('0xa8')]){if(_0x100f0f[_0xae50('0xa8')][_0xae50('0xa9')][_0xae50('0x56')]){return _0x100f0f[_0xae50('0xa8')][_0xae50('0xa9')][0x0];}else{return db['CmContact'][_0xae50('0x58')](_[_0xae50('0x18')](_0x511a3a[_0xae50('0x59')],{'firstName':_0x511a3a[_0xae50('0x59')]['to'][0x0],'phone':_0x511a3a[_0xae50('0x59')]['to'][0x0],'fax':_0x511a3a[_0xae50('0x59')]['to'][0x0],'ListId':_0x100f0f[_0xae50('0xa1')]}));}}else{throw new Error(_0xae50('0xb5'));}}else{throw new Error(_0xae50('0xb6'));}})[_0xae50('0x21')](function(_0x18889c){if(_0x18889c){return db[_0xae50('0x72')][_0xae50('0x57')]({'where':{'ContactId':_0x18889c['id'],'closed':![],'FaxAccountId':_0x100f0f['id']}})[_0xae50('0x21')](function(_0x16f9a9){if(_0x16f9a9){return[_0x16f9a9,![]];}return db[_0xae50('0x72')][_0xae50('0x58')]({'UserId':_0x511a3a['user']['id'],'ContactId':_0x18889c['id'],'FaxAccountId':_0x100f0f['id'],'fax':_0x511a3a[_0xae50('0x59')]['to'][0x0],'firstMsgDirection':_0xae50('0xb7'),'Messages':[_[_0xae50('0x4c')](_0x511a3a[_0xae50('0x59')],{'read':![],'body':_0x511a3a['body'][_0xae50('0xaa')][0x0]['filename'],'FaxAccountId':_0x100f0f['id'],'UserId':_0x511a3a[_0xae50('0x5a')]['id'],'ContactId':_0x18889c['id'],'AttachmentId':_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xae50('0xa6')],'as':_0xae50('0xb8')}]})[_0xae50('0x21')](function(_0x29f394){return[_0x29f394,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xae50('0xb9')](function(_0x1f2ddc,_0x42c7a0){if(_0x42c7a0){return _0x1f2ddc;}return db['FaxMessage'][_0xae50('0x58')]({'direction':_0xae50('0xb7'),'read':![],'body':_0x511a3a[_0xae50('0x59')]['attachments'][0x0][_0xae50('0xba')],'FaxAccountId':_0x100f0f['id'],'FaxInteractionId':_0x1f2ddc['id'],'UserId':_0x511a3a[_0xae50('0x5a')]['id'],'ContactId':_0x1f2ddc[_0xae50('0xbb')],'AttachmentId':_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][0x0]['id']})[_0xae50('0x21')](function(_0x490b6e){_0x1f2ddc[_0xae50('0xbc')][_0xae50('0xb8')]=[];_0x1f2ddc[_0xae50('0xbc')]['Messages'][_0xae50('0x8b')](_0x490b6e[_0xae50('0xbc')]);return _0x1f2ddc;});})[_0xae50('0x21')](function(_0x2ee420){respondWithRpcPromise('SendFax',_0xae50('0xbd'),{'FaxAccountId':_[_0xae50('0xb0')](_0x511a3a['params']['id'])?undefined:_0x511a3a['params']['id'],'path':_[_0xae50('0xb0')](_0x511a3a['body']['attachments'][0x0]['path'])?undefined:_0x511a3a[_0xae50('0x59')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x511a3a[_0xae50('0x59')]['to'][0x0])?undefined:_0x511a3a[_0xae50('0x59')]['to'][0x0],'AttachmentId':_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][0x0]['id']},client9002)['then'](function(_0x4808c1){logger[_0xae50('0x22')](_0xae50('0xbe'),_0x4808c1);})[_0xae50('0x52')](function(_0x409f23){logger['info']('SendFaxRpc,\x20%s',_0x409f23);});return _0x2ee420;})['then'](respondWithResult(_0x5a8c1d,null))[_0xae50('0x52')](handleError(_0x5a8c1d,null));};exports[_0xae50('0xbf')]=function(_0x31bce1,_0x187a86,_0x8a610e){return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x31bce1[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x187a86,null))[_0xae50('0x21')](function(_0xca17e4){if(_0xca17e4){return _0xca17e4[_0xae50('0xbf')](_0x31bce1[_0xae50('0x59')][_0xae50('0x6c')],_[_0xae50('0x73')](_0x31bce1[_0xae50('0x59')],[_0xae50('0x6c'),'id'])||{})[_0xae50('0xb9')](function(_0x3be331){for(var _0x4ac8b0=0x0;_0x4ac8b0<_0x31bce1['body'][_0xae50('0x6c')][_0xae50('0x56')];_0x4ac8b0+=0x1){socket[_0xae50('0xc0')](_0xae50('0xc1'),{'UserId':_0x31bce1[_0xae50('0x59')]['ids'][_0x4ac8b0],'FaxAccountId':_0x31bce1[_0xae50('0x53')]['id']});}return _0x3be331;});}})[_0xae50('0x21')](respondWithResult(_0x187a86,null))[_0xae50('0x52')](handleError(_0x187a86,null));};exports['removeAgents']=function(_0x4488ff,_0x2bb70c,_0xb4c946){return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x4488ff[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x2bb70c,null))[_0xae50('0x21')](function(_0x2f607f){if(_0x2f607f){return _0x2f607f[_0xae50('0xc2')](_0x4488ff[_0xae50('0x42')]['ids'])[_0xae50('0x21')](function(){if(_[_0xae50('0xc3')](_0x4488ff['query'][_0xae50('0x6c')])){for(var _0xbf7c4f=0x0;_0xbf7c4f<_0x4488ff[_0xae50('0x42')][_0xae50('0x6c')]['length'];_0xbf7c4f+=0x1){socket[_0xae50('0xc0')](_0xae50('0xc4'),{'UserId':Number(_0x4488ff['query'][_0xae50('0x6c')][_0xbf7c4f]),'FaxAccountId':Number(_0x4488ff['params']['id'])});}}else{socket[_0xae50('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x4488ff[_0xae50('0x42')]['ids']),'FaxAccountId':Number(_0x4488ff[_0xae50('0x53')]['id'])});}});}})[_0xae50('0x21')](respondWithStatusCode(_0x2bb70c,null))[_0xae50('0x52')](handleError(_0x2bb70c,null));};exports['getAgents']=function(_0x5acd8c,_0x563552,_0x28e4fc){var _0xb750b5={};var _0x2c3d5b={};var _0x4e2c57;var _0x44ce48;return db['FaxAccount']['findOne']({'where':{'id':_0x5acd8c[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x563552,null))['then'](function(_0x35ff4e){if(_0x35ff4e){_0x4e2c57=_0x35ff4e;_0x2c3d5b[_0xae50('0x40')]=_[_0xae50('0x43')](db['User'][_0xae50('0x66')]);_0x2c3d5b[_0xae50('0x42')]=_[_0xae50('0x43')](_0x5acd8c[_0xae50('0x42')]);_0x2c3d5b[_0xae50('0x44')]=_['intersection'](_0x2c3d5b[_0xae50('0x40')],_0x2c3d5b[_0xae50('0x42')]);_0xb750b5[_0xae50('0x46')]=_[_0xae50('0x45')](_0x2c3d5b[_0xae50('0x40')],qs['fields'](_0x5acd8c[_0xae50('0x42')][_0xae50('0x55')]));_0xb750b5[_0xae50('0x46')]=_0xb750b5[_0xae50('0x46')][_0xae50('0x56')]?_0xb750b5[_0xae50('0x46')]:_0x2c3d5b[_0xae50('0x40')];_0xb750b5['order']=qs[_0xae50('0x49')](_0x5acd8c[_0xae50('0x42')][_0xae50('0x49')]);_0xb750b5[_0xae50('0x4a')]=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x5acd8c[_0xae50('0x42')],_0x2c3d5b[_0xae50('0x44')]));if(_0x5acd8c[_0xae50('0x42')][_0xae50('0x4b')]){_0xb750b5[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0xb750b5[_0xae50('0x4a')],{'$or':_['map'](_0xb750b5['attributes'],function(_0x401ee3){var _0x3b7d73={};_0x3b7d73[_0x401ee3]={'$like':'%'+_0x5acd8c[_0xae50('0x42')][_0xae50('0x4b')]+'%'};return _0x3b7d73;})});}_0xb750b5=_[_0xae50('0x4c')]({},_0xb750b5,_0x5acd8c[_0xae50('0x4d')]);return _0x4e2c57[_0xae50('0xc5')](_0xb750b5);}})[_0xae50('0x21')](function(_0x32d716){if(_0x32d716){_0x44ce48=_0x32d716[_0xae50('0x56')];if(!_0x5acd8c[_0xae50('0x42')][_0xae50('0x47')](_0xae50('0x48'))){_0xb750b5['limit']=qs[_0xae50('0x30')](_0x5acd8c[_0xae50('0x42')][_0xae50('0x30')]);_0xb750b5[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x5acd8c['query'][_0xae50('0x2f')]);}return _0x4e2c57['getAgents'](_0xb750b5);}})[_0xae50('0x21')](function(_0x93a469){if(_0x93a469){return _0x93a469?{'count':_0x44ce48,'rows':_0x93a469}:null;}})[_0xae50('0x21')](respondWithResult(_0x563552,null))[_0xae50('0x52')](handleError(_0x563552,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f0dc743..4fb82e3 100644 --- a/server/api/faxAccount/faxAccount.events.js +++ b/server/api/faxAccount/faxAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe53a=['save','update','remove','emit','hasOwnProperty','events','FaxAccount','setMaxListeners'];(function(_0x4a8563,_0x5adb75){var _0x5a2da9=function(_0x38b64c){while(--_0x38b64c){_0x4a8563['push'](_0x4a8563['shift']());}};_0x5a2da9(++_0x5adb75);}(_0xe53a,0xfd));var _0xae53=function(_0x530950,_0xa9e990){_0x530950=_0x530950-0x0;var _0x48e4fb=_0xe53a[_0x530950];return _0x48e4fb;};'use strict';var EventEmitter=require(_0xae53('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xae53('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xae53('0x2')](0x0);var events={'afterCreate':_0xae53('0x3'),'afterUpdate':_0xae53('0x4'),'afterDestroy':_0xae53('0x5')};function emitEvent(_0x20ca38){return function(_0x4684a1,_0x41bef6,_0x12ca63){FaxAccountEvents['emit'](_0x20ca38+':'+_0x4684a1['id'],_0x4684a1);FaxAccountEvents[_0xae53('0x6')](_0x20ca38,_0x4684a1);_0x12ca63(null);};}for(var e in events){if(events[_0xae53('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x9da5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','FaxAccount'];(function(_0x391efe,_0x580daa){var _0x49f226=function(_0x5bec8f){while(--_0x5bec8f){_0x391efe['push'](_0x391efe['shift']());}};_0x49f226(++_0x580daa);}(_0x9da5,0x1de));var _0x59da=function(_0x1defb2,_0x429099){_0x1defb2=_0x1defb2-0x0;var _0xad8973=_0x9da5[_0x1defb2];return _0xad8973;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x59da('0x0'))['db'][_0x59da('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x59da('0x2')](0x0);var events={'afterCreate':_0x59da('0x3'),'afterUpdate':_0x59da('0x4'),'afterDestroy':_0x59da('0x5')};function emitEvent(_0x1236f2){return function(_0x13dced,_0x199306,_0x3c774a){FaxAccountEvents['emit'](_0x1236f2+':'+_0x13dced['id'],_0x13dced);FaxAccountEvents[_0x59da('0x6')](_0x1236f2,_0x13dced);_0x3c774a(null);};}for(var e in events){if(events[_0x59da('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 1dbfd27..857f6bc 100644 --- a/server/api/faxAccount/faxAccount.model.js +++ b/server/api/faxAccount/faxAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0f7=['fax_accounts','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x5e8b4d,_0x4e5ba1){var _0x5d0091=function(_0x53d632){while(--_0x53d632){_0x5e8b4d['push'](_0x5e8b4d['shift']());}};_0x5d0091(++_0x4e5ba1);}(_0xc0f7,0x121));var _0x7c0f=function(_0x735258,_0x13e16e){_0x735258=_0x735258-0x0;var _0x1604c6=_0xc0f7[_0x735258];return _0x1604c6;};'use strict';var _=require(_0x7c0f('0x0'));var util=require(_0x7c0f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7c0f('0x2'));var BPromise=require(_0x7c0f('0x3'));var rp=require(_0x7c0f('0x4'));var fs=require('fs');var path=require(_0x7c0f('0x5'));var rimraf=require('rimraf');var config=require(_0x7c0f('0x6'));var attributes=require(_0x7c0f('0x7'));module[_0x7c0f('0x8')]=function(_0x5e1f16,_0x2ac4e7){return _0x5e1f16[_0x7c0f('0x9')](_0x7c0f('0xa'),attributes,{'tableName':_0x7c0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cb2=['request-promise','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','lodash','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3cb2,0xf6));var _0x23cb=function(_0x577fa5,_0x1989b4){_0x577fa5=_0x577fa5-0x0;var _0x3c36be=_0x3cb2[_0x577fa5];return _0x3c36be;};'use strict';var _=require(_0x23cb('0x0'));var util=require('util');var logger=require(_0x23cb('0x1'))(_0x23cb('0x2'));var moment=require(_0x23cb('0x3'));var BPromise=require('bluebird');var rp=require(_0x23cb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23cb('0x5'));var config=require(_0x23cb('0x6'));var attributes=require(_0x23cb('0x7'));module['exports']=function(_0x2800ef,_0x24289e){return _0x2800ef[_0x23cb('0x8')](_0x23cb('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 4311d05..1444b25 100644 --- a/server/api/faxAccount/faxAccount.rpc.js +++ b/server/api/faxAccount/faxAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee44=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','DESC','FaxApplication','Applications','get','list','applications','priority','asc','Contacts','length','create','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','User','UserId','unshift','agent','name','startRouting','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','socket.io-emitter','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','include','model','attributes','map','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xee44,0x188));var _0x4ee4=function(_0x55368f,_0x35d25a){_0x55368f=_0x55368f-0x0;var _0xba4886=_0xee44[_0x55368f];return _0xba4886;};'use strict';var _=require(_0x4ee4('0x0'));var util=require(_0x4ee4('0x1'));var moment=require(_0x4ee4('0x2'));var BPromise=require(_0x4ee4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ee4('0x4'));var db=require(_0x4ee4('0x5'))['db'];var utils=require(_0x4ee4('0x6'));var logger=require('../../config/logger')(_0x4ee4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ee4('0x8')][_0x4ee4('0x9')]({'port':0x232c});config[_0x4ee4('0xa')]=_[_0x4ee4('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ee4('0xc'))(new Redis(config[_0x4ee4('0xa')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2871f6,_0x174ff0,_0x561c1c){return new BPromise(function(_0x3847bd,_0x141022){return client['request'](_0x2871f6,_0x561c1c)[_0x4ee4('0xd')](function(_0xa046f1){logger[_0x4ee4('0xe')](_0x4ee4('0xf'),_0x174ff0,_0x4ee4('0x10'));logger[_0x4ee4('0x11')](_0x4ee4('0x12'),_0x174ff0,_0x4ee4('0x10'),JSON[_0x4ee4('0x13')](_0xa046f1));if(_0xa046f1['error']){if(_0xa046f1[_0x4ee4('0x14')][_0x4ee4('0x15')]===0x1f4){logger['error'](_0x4ee4('0xf'),_0x174ff0,_0xa046f1[_0x4ee4('0x14')][_0x4ee4('0x16')]);return _0x141022(_0xa046f1[_0x4ee4('0x14')][_0x4ee4('0x16')]);}logger[_0x4ee4('0x14')](_0x4ee4('0xf'),_0x174ff0,_0xa046f1[_0x4ee4('0x14')][_0x4ee4('0x16')]);return _0x3847bd(_0xa046f1[_0x4ee4('0x14')][_0x4ee4('0x16')]);}else{logger[_0x4ee4('0xe')]('FaxAccount,\x20%s,\x20%s',_0x174ff0,_0x4ee4('0x10'));_0x3847bd(_0xa046f1[_0x4ee4('0x17')]['message']);}})[_0x4ee4('0x18')](function(_0x486cdc){logger[_0x4ee4('0x14')](_0x4ee4('0xf'),_0x174ff0,_0x486cdc);_0x141022(_0x486cdc);});});}exports[_0x4ee4('0x19')]=function(_0x119ecf){var _0x13991d=this;return new Promise(function(_0x1c1d77,_0x3d46f9){return db[_0x4ee4('0x1a')][_0x4ee4('0x1b')]({'raw':_0x119ecf['options']?_0x119ecf[_0x4ee4('0x1c')][_0x4ee4('0x1d')]===undefined?!![]:![]:!![],'where':_0x119ecf[_0x4ee4('0x1c')]?_0x119ecf[_0x4ee4('0x1c')][_0x4ee4('0x1e')]||null:null,'attributes':_0x119ecf[_0x4ee4('0x1c')]?_0x119ecf[_0x4ee4('0x1c')]['attributes']||null:null,'limit':_0x119ecf[_0x4ee4('0x1c')]?_0x119ecf['options'][_0x4ee4('0x1f')]||null:null,'include':_0x119ecf[_0x4ee4('0x1c')]?_0x119ecf[_0x4ee4('0x1c')][_0x4ee4('0x20')]?_['map'](_0x119ecf['options'][_0x4ee4('0x20')],function(_0xa69395){return{'model':db[_0xa69395[_0x4ee4('0x21')]],'as':_0xa69395['as'],'attributes':_0xa69395[_0x4ee4('0x22')],'include':_0xa69395[_0x4ee4('0x20')]?_[_0x4ee4('0x23')](_0xa69395[_0x4ee4('0x20')],function(_0x130cbc){return{'model':db[_0x130cbc[_0x4ee4('0x21')]],'as':_0x130cbc['as'],'attributes':_0x130cbc['attributes'],'include':_0x130cbc[_0x4ee4('0x20')]?_[_0x4ee4('0x23')](_0x130cbc[_0x4ee4('0x20')],function(_0x32fa0d){return{'model':db[_0x32fa0d[_0x4ee4('0x21')]],'as':_0x32fa0d['as'],'attributes':_0x32fa0d[_0x4ee4('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4ee4('0xd')](function(_0x3bf355){logger[_0x4ee4('0xe')](_0x4ee4('0x19'),_0x119ecf);logger[_0x4ee4('0x11')](_0x4ee4('0x19'),_0x119ecf,JSON[_0x4ee4('0x13')](_0x3bf355));_0x1c1d77(_0x3bf355);})['catch'](function(_0x1c8c1d){logger['error'](_0x4ee4('0x19'),_0x1c8c1d[_0x4ee4('0x16')],_0x119ecf);_0x3d46f9(_0x13991d[_0x4ee4('0x14')](0x1f4,_0x1c8c1d[_0x4ee4('0x16')]));});});};exports[_0x4ee4('0x24')]=function(_0x54d368,_0x3b681f,_0x587e76){var _0x33b0e6=this;return new Promise(function(_0x2ed850,_0x2551ae){var _0x560c52={'body':_0x54d368[_0x4ee4('0x25')],'channel':_0x4ee4('0x26')};var _0x36700b=[];var _0x20c0d8=[];var _0x2006ca={};return db[_0x4ee4('0x27')][_0x4ee4('0x28')]()[_0x4ee4('0xd')](function(_0x381089){if(!_0x381089){throw new db[(_0x4ee4('0x29'))][(_0x4ee4('0x2a'))](_0x4ee4('0x2b'));}_0x36700b=_[_0x4ee4('0x2c')](_['keys'](_0x381089),[_0x4ee4('0x2d'),'updatedAt']);_0x20c0d8=_['difference'](_['keys'](_0x381089),[_0x4ee4('0x2d'),_0x4ee4('0x2e'),_0x4ee4('0x2f'),_0x4ee4('0x30')]);if(_0x54d368[_0x4ee4('0x25')]['id']){delete _0x54d368['body']['id'];}if(_[_0x4ee4('0x31')](_0x54d368[_0x4ee4('0x25')][_0x4ee4('0x32')])){throw new db[(_0x4ee4('0x29'))]['ValidationError'](_0x4ee4('0x33'));}if(_[_0x4ee4('0x31')](_0x54d368[_0x4ee4('0x25')][_0x4ee4('0x25')])||_0x54d368['body'][_0x4ee4('0x25')]===''){throw new db['Sequelize']['ValidationError'](_0x4ee4('0x34'));}if(_['isNil'](_0x54d368['body'][_0x4ee4('0x35')])){throw new db[(_0x4ee4('0x29'))][(_0x4ee4('0x2a'))](_0x4ee4('0x36')+_0x20c0d8);}if(!_[_0x4ee4('0x37')](_0x20c0d8,_0x54d368['body']['mapKey'])){throw new db[(_0x4ee4('0x29'))][(_0x4ee4('0x2a'))](_0x4ee4('0x38')+_0x20c0d8);}_0x2006ca[_0x54d368[_0x4ee4('0x25')][_0x4ee4('0x35')]]=_0x54d368['body'][_0x4ee4('0x32')];})[_0x4ee4('0xd')](function(){return db['FaxAccount']['find']({'where':{'id':_0x54d368[_0x4ee4('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x4ee4('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2006ca,'limit':0x1,'order':[[_0x4ee4('0x2e'),_0x4ee4('0x3b')]]}]},{'model':db[_0x4ee4('0x3c')],'as':_0x4ee4('0x3d')}]});})['then'](function(_0x4c808a){if(_0x4c808a&&_0x4c808a['List']){var _0xccdf2c=_0x4c808a[_0x4ee4('0x3e')]({'plain':!![]});_0x560c52[_0x4ee4('0x39')]=_0xccdf2c;_0x560c52['applications']=_0xccdf2c[_0x4ee4('0x3d')];_0x560c52[_0x4ee4('0x3f')]=_0xccdf2c[_0x4ee4('0x3a')];_0x560c52[_0x4ee4('0x40')]=_['orderBy'](_0x560c52[_0x4ee4('0x40')],[_0x4ee4('0x41')],[_0x4ee4('0x42')]);if(_0x560c52[_0x4ee4('0x39')][_0x4ee4('0x3d')]){delete _0x560c52[_0x4ee4('0x39')][_0x4ee4('0x3d')];}if(_0x560c52[_0x4ee4('0x39')][_0x4ee4('0x3a')]&&_0x560c52[_0x4ee4('0x39')][_0x4ee4('0x3a')][_0x4ee4('0x43')][_0x4ee4('0x44')]){return _0x560c52[_0x4ee4('0x39')][_0x4ee4('0x3a')][_0x4ee4('0x43')][0x0];}var _0x3a004a=_[_0x4ee4('0xb')](_0x54d368[_0x4ee4('0x25')],{'firstName':_0x54d368[_0x4ee4('0x25')][_0x4ee4('0x32')],'ListId':_0xccdf2c['ListId']});_0x3a004a[_0x54d368[_0x4ee4('0x25')]['mapKey']]=_0x54d368[_0x4ee4('0x25')][_0x4ee4('0x32')];return db[_0x4ee4('0x27')][_0x4ee4('0x45')](_0x3a004a,{'fields':_0x36700b,'raw':!![]});}})['then'](function(_0x18da30){_0x560c52['contact']=_0x18da30;if(_0x18da30){var _0x410053={'ContactId':_0x18da30['id'],'FaxAccountId':_0x54d368[_0x4ee4('0x39')]['id'],'fax':_0x18da30[_0x4ee4('0x26')]};return db[_0x4ee4('0x46')][_0x4ee4('0x47')]({'where':{'ContactId':_0x18da30['id'],'closed':![],'FaxAccountId':_0x54d368[_0x4ee4('0x39')]['id']}})[_0x4ee4('0xd')](function(_0x5602c1){if(_0x5602c1){return[_0x5602c1,![]];}return db['FaxInteraction'][_0x4ee4('0x45')](_0x410053)[_0x4ee4('0xd')](function(_0x2c9e8b){return[_0x2c9e8b,!![]];});});}else{throw new Error(_0x4ee4('0x48'));}})[_0x4ee4('0x49')](function(_0xcb4789,_0x464065){var _0x21dd44=_0xcb4789[_0x4ee4('0x3e')]({'plain':!![]});if(_0x464065){if(_0x560c52[_0x4ee4('0x39')][_0x4ee4('0x4a')]){_0x560c52[_0x4ee4('0x40')]['push']({'id':0x0,'priority':_0x560c52[_0x4ee4('0x40')][_0x4ee4('0x44')]+0x1,'app':_0x4ee4('0x4b'),'appdata':_0x4ee4('0x4c'),'interval':'*,*,*,*'});}_0x21dd44[_0x4ee4('0x4d')]=!![];}else{_0x21dd44['created']=![];}_0x560c52[_0x4ee4('0x4e')]=_0x21dd44;return db[_0x4ee4('0x4f')][_0x4ee4('0x45')]({'body':_0x54d368[_0x4ee4('0x25')][_0x4ee4('0x25')],'FaxAccountId':_0x54d368['account']['id'],'FaxInteractionId':_0xcb4789['id'],'direction':'in','ContactId':_0xcb4789[_0x4ee4('0x50')],'AttachmentId':_0x54d368[_0x4ee4('0x25')][_0x4ee4('0x51')]});})[_0x4ee4('0xd')](function(_0x6aec87){_0x560c52[_0x4ee4('0x16')]=_0x6aec87;if(_0x560c52[_0x4ee4('0x4e')]['UserId']){return db[_0x4ee4('0x52')][_0x4ee4('0x47')]({'attributes':['id','name'],'where':{'id':_0x560c52[_0x4ee4('0x4e')][_0x4ee4('0x53')]}})[_0x4ee4('0xd')](function(_0x4b0df4){if(_0x4b0df4){_0x560c52[_0x4ee4('0x40')][_0x4ee4('0x54')]({'id':0x0,'priority':0x0,'app':_0x4ee4('0x55'),'appdata':_0x4b0df4[_0x4ee4('0x56')]+','+(_0x560c52[_0x4ee4('0x39')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x4ee4('0x57'),_0x560c52);});}return respondWithRpcPromise(_0x4ee4('0x58'),_0x4ee4('0x57'),_0x560c52);})[_0x4ee4('0xd')](function(_0x50ef7a){_0x2ed850(_0x50ef7a);})[_0x4ee4('0x18')](function(_0x920008){_0x2551ae(_0x33b0e6[_0x4ee4('0x14')](0x1f4,_0x920008['message']));});});}; \ No newline at end of file +var _0x163f=['localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxAccount','options','raw','where','limit','include','model','attributes','map','then','CmContact','describe','Sequelize','ValidationError','difference','createdAt','updatedAt','keys','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','DESC','FaxApplication','Applications','get','account','applications','list','orderBy','Contacts','defaults','fax','FaxInteraction','create','Contact\x20not\x20found','autoclose','unmanaged','created','interaction','FaxMessage','ContactId','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x295476,_0x2e3efc){var _0x28b71e=function(_0x51121c){while(--_0x51121c){_0x295476['push'](_0x295476['shift']());}};_0x28b71e(++_0x2e3efc);}(_0x163f,0xf3));var _0xf163=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x163f[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require(_0xf163('0x0'));var moment=require(_0xf163('0x1'));var BPromise=require(_0xf163('0x2'));var rs=require(_0xf163('0x3'));var fs=require('fs');var Redis=require(_0xf163('0x4'));var db=require(_0xf163('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf163('0x6'))(_0xf163('0x7'));var config=require('../../config/environment');var jayson=require(_0xf163('0x8'));var client=jayson[_0xf163('0x9')][_0xf163('0xa')]({'port':0x232c});config[_0xf163('0xb')]=_['defaults'](config[_0xf163('0xb')],{'host':_0xf163('0xc'),'port':0x18eb});var socket=require(_0xf163('0xd'))(new Redis(config['redis']));require(_0xf163('0xe'))[_0xf163('0xf')](socket);function respondWithRpcPromise(_0x103857,_0x367db8,_0x1b2372){return new BPromise(function(_0x58da5c,_0x37e566){return client[_0xf163('0x10')](_0x103857,_0x1b2372)['then'](function(_0x2adda8){logger[_0xf163('0x11')](_0xf163('0x12'),_0x367db8,_0xf163('0x13'));logger[_0xf163('0x14')](_0xf163('0x15'),_0x367db8,_0xf163('0x13'),JSON[_0xf163('0x16')](_0x2adda8));if(_0x2adda8['error']){if(_0x2adda8[_0xf163('0x17')][_0xf163('0x18')]===0x1f4){logger[_0xf163('0x17')]('FaxAccount,\x20%s,\x20%s',_0x367db8,_0x2adda8['error'][_0xf163('0x19')]);return _0x37e566(_0x2adda8[_0xf163('0x17')][_0xf163('0x19')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x367db8,_0x2adda8['error'][_0xf163('0x19')]);return _0x58da5c(_0x2adda8[_0xf163('0x17')][_0xf163('0x19')]);}else{logger[_0xf163('0x11')](_0xf163('0x12'),_0x367db8,_0xf163('0x13'));_0x58da5c(_0x2adda8['result'][_0xf163('0x19')]);}})[_0xf163('0x1a')](function(_0x24a121){logger[_0xf163('0x17')](_0xf163('0x12'),_0x367db8,_0x24a121);_0x37e566(_0x24a121);});});}exports[_0xf163('0x1b')]=function(_0x3675d5){var _0x3befa9=this;return new Promise(function(_0x52edfe,_0x401ca8){return db['FaxAccount']['findAll']({'raw':_0x3675d5['options']?_0x3675d5[_0xf163('0x1c')][_0xf163('0x1d')]===undefined?!![]:![]:!![],'where':_0x3675d5['options']?_0x3675d5[_0xf163('0x1c')][_0xf163('0x1e')]||null:null,'attributes':_0x3675d5[_0xf163('0x1c')]?_0x3675d5['options']['attributes']||null:null,'limit':_0x3675d5[_0xf163('0x1c')]?_0x3675d5[_0xf163('0x1c')][_0xf163('0x1f')]||null:null,'include':_0x3675d5[_0xf163('0x1c')]?_0x3675d5[_0xf163('0x1c')][_0xf163('0x20')]?_['map'](_0x3675d5[_0xf163('0x1c')][_0xf163('0x20')],function(_0x17503c){return{'model':db[_0x17503c[_0xf163('0x21')]],'as':_0x17503c['as'],'attributes':_0x17503c[_0xf163('0x22')],'include':_0x17503c[_0xf163('0x20')]?_[_0xf163('0x23')](_0x17503c[_0xf163('0x20')],function(_0x5a80ec){return{'model':db[_0x5a80ec[_0xf163('0x21')]],'as':_0x5a80ec['as'],'attributes':_0x5a80ec[_0xf163('0x22')],'include':_0x5a80ec[_0xf163('0x20')]?_[_0xf163('0x23')](_0x5a80ec['include'],function(_0x49fe60){return{'model':db[_0x49fe60[_0xf163('0x21')]],'as':_0x49fe60['as'],'attributes':_0x49fe60['attributes']};}):[]};}):[]};}):[]:[]})[_0xf163('0x24')](function(_0x520b7a){logger[_0xf163('0x11')]('GetFaxAccount',_0x3675d5);logger['debug']('GetFaxAccount',_0x3675d5,JSON[_0xf163('0x16')](_0x520b7a));_0x52edfe(_0x520b7a);})[_0xf163('0x1a')](function(_0x1cc7a3){logger[_0xf163('0x17')](_0xf163('0x1b'),_0x1cc7a3[_0xf163('0x19')],_0x3675d5);_0x401ca8(_0x3befa9[_0xf163('0x17')](0x1f4,_0x1cc7a3[_0xf163('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x196914,_0x1fd085,_0x2f36e0){var _0x14a97f=this;return new Promise(function(_0x28b0d6,_0x4e2283){var _0xecf459={'body':_0x196914['body'],'channel':'fax'};var _0x1c395f=[];var _0x5b3d22=[];var _0x28491a={};return db[_0xf163('0x25')][_0xf163('0x26')]()[_0xf163('0x24')](function(_0x4671e8){if(!_0x4671e8){throw new db[(_0xf163('0x27'))][(_0xf163('0x28'))]('no\x20available\x20attributes');}_0x1c395f=_[_0xf163('0x29')](_['keys'](_0x4671e8),[_0xf163('0x2a'),_0xf163('0x2b')]);_0x5b3d22=_[_0xf163('0x29')](_[_0xf163('0x2c')](_0x4671e8),['createdAt','updatedAt',_0xf163('0x2d'),_0xf163('0x2e')]);if(_0x196914[_0xf163('0x2f')]['id']){delete _0x196914[_0xf163('0x2f')]['id'];}if(_['isNil'](_0x196914['body'][_0xf163('0x30')])){throw new db[(_0xf163('0x27'))][(_0xf163('0x28'))](_0xf163('0x31'));}if(_[_0xf163('0x32')](_0x196914['body'][_0xf163('0x2f')])||_0x196914[_0xf163('0x2f')][_0xf163('0x2f')]===''){throw new db[(_0xf163('0x27'))]['ValidationError'](_0xf163('0x33'));}if(_['isNil'](_0x196914[_0xf163('0x2f')]['mapKey'])){throw new db[(_0xf163('0x27'))][(_0xf163('0x28'))](_0xf163('0x34')+_0x5b3d22);}if(!_['includes'](_0x5b3d22,_0x196914[_0xf163('0x2f')][_0xf163('0x35')])){throw new db['Sequelize'][(_0xf163('0x28'))](_0xf163('0x36')+_0x5b3d22);}_0x28491a[_0x196914[_0xf163('0x2f')][_0xf163('0x35')]]=_0x196914[_0xf163('0x2f')][_0xf163('0x30')];})[_0xf163('0x24')](function(){return db['FaxAccount'][_0xf163('0x37')]({'where':{'id':_0x196914['account']['id']},'include':[{'model':db[_0xf163('0x38')],'as':_0xf163('0x39'),'include':[{'model':db[_0xf163('0x25')],'as':'Contacts','where':_0x28491a,'limit':0x1,'order':[[_0xf163('0x2b'),_0xf163('0x3a')]]}]},{'model':db[_0xf163('0x3b')],'as':_0xf163('0x3c')}]});})[_0xf163('0x24')](function(_0x652d4d){if(_0x652d4d&&_0x652d4d[_0xf163('0x39')]){var _0x26fa8f=_0x652d4d[_0xf163('0x3d')]({'plain':!![]});_0xecf459[_0xf163('0x3e')]=_0x26fa8f;_0xecf459[_0xf163('0x3f')]=_0x26fa8f[_0xf163('0x3c')];_0xecf459[_0xf163('0x40')]=_0x26fa8f[_0xf163('0x39')];_0xecf459[_0xf163('0x3f')]=_[_0xf163('0x41')](_0xecf459[_0xf163('0x3f')],['priority'],['asc']);if(_0xecf459[_0xf163('0x3e')][_0xf163('0x3c')]){delete _0xecf459[_0xf163('0x3e')][_0xf163('0x3c')];}if(_0xecf459[_0xf163('0x3e')]['List']&&_0xecf459[_0xf163('0x3e')][_0xf163('0x39')][_0xf163('0x42')]['length']){return _0xecf459['account'][_0xf163('0x39')][_0xf163('0x42')][0x0];}var _0x2dd4d9=_[_0xf163('0x43')](_0x196914[_0xf163('0x2f')],{'firstName':_0x196914[_0xf163('0x2f')]['from'],'ListId':_0x26fa8f[_0xf163('0x2e')]});_0x2dd4d9[_0x196914[_0xf163('0x2f')][_0xf163('0x35')]]=_0x196914[_0xf163('0x2f')]['from'];return db[_0xf163('0x25')]['create'](_0x2dd4d9,{'fields':_0x1c395f,'raw':!![]});}})['then'](function(_0x4240cb){_0xecf459['contact']=_0x4240cb;if(_0x4240cb){var _0x3482e3={'ContactId':_0x4240cb['id'],'FaxAccountId':_0x196914[_0xf163('0x3e')]['id'],'fax':_0x4240cb[_0xf163('0x44')]};return db[_0xf163('0x45')]['find']({'where':{'ContactId':_0x4240cb['id'],'closed':![],'FaxAccountId':_0x196914[_0xf163('0x3e')]['id']}})[_0xf163('0x24')](function(_0x490a49){if(_0x490a49){return[_0x490a49,![]];}return db[_0xf163('0x45')][_0xf163('0x46')](_0x3482e3)[_0xf163('0x24')](function(_0x383af5){return[_0x383af5,!![]];});});}else{throw new Error(_0xf163('0x47'));}})['spread'](function(_0x5cc2fc,_0x5a790a){var _0x4c36e5=_0x5cc2fc['get']({'plain':!![]});if(_0x5a790a){if(_0xecf459[_0xf163('0x3e')][_0xf163('0x48')]){_0xecf459['applications']['push']({'id':0x0,'priority':_0xecf459[_0xf163('0x3f')]['length']+0x1,'app':'close','appdata':_0xf163('0x49'),'interval':'*,*,*,*'});}_0x4c36e5[_0xf163('0x4a')]=!![];}else{_0x4c36e5['created']=![];}_0xecf459[_0xf163('0x4b')]=_0x4c36e5;return db[_0xf163('0x4c')][_0xf163('0x46')]({'body':_0x196914[_0xf163('0x2f')]['body'],'FaxAccountId':_0x196914[_0xf163('0x3e')]['id'],'FaxInteractionId':_0x5cc2fc['id'],'direction':'in','ContactId':_0x5cc2fc[_0xf163('0x4d')],'AttachmentId':_0x196914['body']['AttachmentId']});})[_0xf163('0x24')](function(_0x368336){_0xecf459[_0xf163('0x19')]=_0x368336;if(_0xecf459['interaction'][_0xf163('0x4e')]){return db[_0xf163('0x4f')][_0xf163('0x37')]({'attributes':['id',_0xf163('0x50')],'where':{'id':_0xecf459[_0xf163('0x4b')][_0xf163('0x4e')]}})['then'](function(_0x144247){if(_0x144247){_0xecf459['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x144247[_0xf163('0x50')]+','+(_0xecf459['account'][_0xf163('0x51')]||0xa),'interval':_0xf163('0x52')});}return respondWithRpcPromise(_0xf163('0x53'),'startRouting',_0xecf459);});}return respondWithRpcPromise(_0xf163('0x53'),_0xf163('0x54'),_0xecf459);})['then'](function(_0x406b13){_0x28b0d6(_0x406b13);})['catch'](function(_0x293c72){_0x4e2283(_0x14a97f[_0xf163('0x17')](0x1f4,_0x293c72[_0xf163('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 5e79e1c..b392c5e 100644 --- a/server/api/faxAccount/faxAccount.socket.js +++ b/server/api/faxAccount/faxAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd046=['removeListener','faxAccount:','save','remove','update'];(function(_0x538ffd,_0x4a95bc){var _0x58c67c=function(_0x27cbf1){while(--_0x27cbf1){_0x538ffd['push'](_0x538ffd['shift']());}};_0x58c67c(++_0x4a95bc);}(_0xd046,0x129));var _0x6d04=function(_0x33f682,_0x52e2c2){_0x33f682=_0x33f682-0x0;var _0x21988e=_0xd046[_0x33f682];return _0x21988e;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6d04('0x0'),_0x6d04('0x1'),_0x6d04('0x2')];function createListener(_0x4b78e1,_0xedb518){return function(_0x55be3b){_0xedb518['emit'](_0x4b78e1,_0x55be3b);};}function removeListener(_0x33720a,_0x4d2121){return function(){FaxAccountEvents[_0x6d04('0x3')](_0x33720a,_0x4d2121);};}exports['register']=function(_0x4bacb1){for(var _0xf3b4e7=0x0,_0x1968c4=events['length'];_0xf3b4e7<_0x1968c4;_0xf3b4e7++){var _0x569c7b=events[_0xf3b4e7];var _0x2e2c01=createListener(_0x6d04('0x4')+_0x569c7b,_0x4bacb1);FaxAccountEvents['on'](_0x569c7b,_0x2e2c01);}}; \ No newline at end of file +var _0x68b3=['./faxAccount.events','save','remove','update','emit','register','length','faxAccount:'];(function(_0x2f4d82,_0x373756){var _0x42c438=function(_0xf08be4){while(--_0xf08be4){_0x2f4d82['push'](_0x2f4d82['shift']());}};_0x42c438(++_0x373756);}(_0x68b3,0x1d8));var _0x368b=function(_0x57ae5e,_0x38a856){_0x57ae5e=_0x57ae5e-0x0;var _0xbe1fb2=_0x68b3[_0x57ae5e];return _0xbe1fb2;};'use strict';var FaxAccountEvents=require(_0x368b('0x0'));var events=[_0x368b('0x1'),_0x368b('0x2'),_0x368b('0x3')];function createListener(_0x2d2762,_0x4a9da6){return function(_0x208c48){_0x4a9da6[_0x368b('0x4')](_0x2d2762,_0x208c48);};}function removeListener(_0xc40116,_0x404282){return function(){FaxAccountEvents['removeListener'](_0xc40116,_0x404282);};}exports[_0x368b('0x5')]=function(_0x41b15b){for(var _0x104dad=0x0,_0x23584a=events[_0x368b('0x6')];_0x104dad<_0x23584a;_0x104dad++){var _0x127c1e=events[_0x104dad];var _0x2dec1c=createListener(_0x368b('0x7')+_0x127c1e,_0x41b15b);FaxAccountEvents['on'](_0x127c1e,_0x2dec1c);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9340632..7f0e7e2 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf499=['/updateaccountapplications','/:id/send','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addAccountApplications'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xf499,0x162));var _0x9f49=function(_0x2447b0,_0x68333b){_0x2447b0=_0x2447b0-0x0;var _0x4c10b7=_0xf499[_0x2447b0];return _0x4c10b7;};'use strict';var multer=require(_0x9f49('0x0'));var util=require(_0x9f49('0x1'));var path=require(_0x9f49('0x2'));var timeout=require(_0x9f49('0x3'));var express=require(_0x9f49('0x4'));var router=express[_0x9f49('0x5')]();var auth=require(_0x9f49('0x6'));var interaction=require(_0x9f49('0x7'));var config=require(_0x9f49('0x8'));var controller=require(_0x9f49('0x9'));router[_0x9f49('0xa')]('/',auth[_0x9f49('0xb')](),controller[_0x9f49('0xc')]);router['get']('/describe',auth[_0x9f49('0xb')](),controller['describe']);router[_0x9f49('0xa')](_0x9f49('0xd'),auth[_0x9f49('0xb')](),controller[_0x9f49('0xe')]);router[_0x9f49('0xa')](_0x9f49('0xf'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x10')]);router[_0x9f49('0xa')](_0x9f49('0x11'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x12')]);router[_0x9f49('0xa')](_0x9f49('0x13'),auth['isAuthenticated'](),controller[_0x9f49('0x14')]);router[_0x9f49('0xa')](_0x9f49('0x15'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x16')]);router[_0x9f49('0xa')](_0x9f49('0x17'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x18')]);router['get'](_0x9f49('0x19'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x1a')]);router[_0x9f49('0x1b')]('/',auth[_0x9f49('0xb')](),controller[_0x9f49('0x1c')]);router[_0x9f49('0x1b')]('/:id/dispositions',auth[_0x9f49('0xb')](),controller[_0x9f49('0x1d')]);router[_0x9f49('0x1b')](_0x9f49('0x11'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x1e')]);router[_0x9f49('0x1b')](_0x9f49('0x13'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x1f')]);router[_0x9f49('0x1b')]('/:id/applications',auth[_0x9f49('0xb')](),controller['addApplications']);router[_0x9f49('0x1b')]('/addaccountapplications',auth[_0x9f49('0xb')](),controller[_0x9f49('0x20')]);router['post'](_0x9f49('0x21'),auth[_0x9f49('0xb')](),controller['updateAccountApplications']);router[_0x9f49('0x1b')](_0x9f49('0x22'),auth[_0x9f49('0xb')](),controller['send']);router[_0x9f49('0x1b')](_0x9f49('0x19'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x23')]);router[_0x9f49('0x24')](_0x9f49('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9f49('0x25')](_0x9f49('0xd'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x26')]);router['delete'](_0x9f49('0xf'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x27')]);router[_0x9f49('0x25')](_0x9f49('0x11'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x28')]);router[_0x9f49('0x25')](_0x9f49('0x19'),auth[_0x9f49('0xb')](),controller[_0x9f49('0x29')]);module[_0x9f49('0x2a')]=router; \ No newline at end of file +var _0x7f34=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','post','create','addDisposition','/:id/canned_answers','addAnswer','addAccountApplications','updateAccountApplications','/:id/send','/:id/users','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0x51c543,_0x2465cc){var _0x5e21e2=function(_0x580772){while(--_0x580772){_0x51c543['push'](_0x51c543['shift']());}};_0x5e21e2(++_0x2465cc);}(_0x7f34,0x1d4));var _0x47f3=function(_0x309e08,_0x1ab9a4){_0x309e08=_0x309e08-0x0;var _0x464775=_0x7f34[_0x309e08];return _0x464775;};'use strict';var multer=require('multer');var util=require(_0x47f3('0x0'));var path=require('path');var timeout=require(_0x47f3('0x1'));var express=require(_0x47f3('0x2'));var router=express[_0x47f3('0x3')]();var auth=require(_0x47f3('0x4'));var interaction=require(_0x47f3('0x5'));var config=require(_0x47f3('0x6'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0x47f3('0x7')](),controller[_0x47f3('0x8')]);router[_0x47f3('0x9')](_0x47f3('0xa'),auth[_0x47f3('0x7')](),controller[_0x47f3('0xb')]);router[_0x47f3('0x9')](_0x47f3('0xc'),auth[_0x47f3('0x7')](),controller['show']);router[_0x47f3('0x9')](_0x47f3('0xd'),auth[_0x47f3('0x7')](),controller[_0x47f3('0xe')]);router[_0x47f3('0x9')]('/:id/canned_answers',auth[_0x47f3('0x7')](),controller[_0x47f3('0xf')]);router['get'](_0x47f3('0x10'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x11')]);router[_0x47f3('0x9')](_0x47f3('0x12'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x13')]);router[_0x47f3('0x9')](_0x47f3('0x14'),auth['isAuthenticated'](),controller[_0x47f3('0x15')]);router[_0x47f3('0x9')]('/:id/users',auth[_0x47f3('0x7')](),controller['getAgents']);router[_0x47f3('0x16')]('/',auth[_0x47f3('0x7')](),controller[_0x47f3('0x17')]);router['post']('/:id/dispositions',auth[_0x47f3('0x7')](),controller[_0x47f3('0x18')]);router[_0x47f3('0x16')](_0x47f3('0x19'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x1a')]);router[_0x47f3('0x16')](_0x47f3('0x10'),auth[_0x47f3('0x7')](),controller['addInteraction']);router[_0x47f3('0x16')](_0x47f3('0x12'),auth[_0x47f3('0x7')](),controller['addApplications']);router['post']('/addaccountapplications',auth[_0x47f3('0x7')](),controller[_0x47f3('0x1b')]);router[_0x47f3('0x16')]('/updateaccountapplications',auth[_0x47f3('0x7')](),controller[_0x47f3('0x1c')]);router[_0x47f3('0x16')](_0x47f3('0x1d'),auth[_0x47f3('0x7')](),controller['send']);router['post'](_0x47f3('0x1e'),auth['isAuthenticated'](),controller['addAgents']);router[_0x47f3('0x1f')]('/:id',auth[_0x47f3('0x7')](),controller[_0x47f3('0x20')]);router['delete'](_0x47f3('0xc'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x21')]);router[_0x47f3('0x22')]('/:id/dispositions',auth[_0x47f3('0x7')](),controller[_0x47f3('0x23')]);router[_0x47f3('0x22')](_0x47f3('0x19'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x24')]);router[_0x47f3('0x22')](_0x47f3('0x1e'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x25')]);module[_0x47f3('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 658d19f..7ef9138 100644 --- a/server/api/faxApplication/faxApplication.attributes.js +++ b/server/api/faxApplication/faxApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x002d=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x57463b,_0x1f2ccb){var _0x1445cc=function(_0x46463a){while(--_0x46463a){_0x57463b['push'](_0x57463b['shift']());}};_0x1445cc(++_0x1f2ccb);}(_0x002d,0xca));var _0xd002=function(_0x10274a,_0x32232d){_0x10274a=_0x10274a-0x0;var _0x376ec2=_0x002d[_0x10274a];return _0x376ec2;};'use strict';var Sequelize=require(_0xd002('0x0'));module[_0xd002('0x1')]={'priority':{'type':Sequelize[_0xd002('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd002('0x3')]()},'description':{'type':Sequelize[_0xd002('0x4')]},'interval':{'type':Sequelize[_0xd002('0x4')],'defaultValue':_0xd002('0x5')}}; \ No newline at end of file +var _0x723c=['INTEGER','noop','STRING','*,*,*,*','exports'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x723c,0x1ad));var _0xc723=function(_0xff9b4b,_0x5943a0){_0xff9b4b=_0xff9b4b-0x0;var _0x253961=_0x723c[_0xff9b4b];return _0x253961;};'use strict';var Sequelize=require('sequelize');module[_0xc723('0x0')]={'priority':{'type':Sequelize[_0xc723('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc723('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc723('0x3')]},'interval':{'type':Sequelize[_0xc723('0x3')],'defaultValue':_0xc723('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a14afb1..7cb892a 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2de5=['sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','FaxApplication','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x284a0e,_0x33bd6e){var _0x538d05=function(_0x1dc414){while(--_0x1dc414){_0x284a0e['push'](_0x284a0e['shift']());}};_0x538d05(++_0x33bd6e);}(_0x2de5,0x14e));var _0x52de=function(_0x5f08a6,_0x400121){_0x5f08a6=_0x5f08a6-0x0;var _0x5d0641=_0x2de5[_0x5f08a6];return _0x5d0641;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x52de('0x0'));var rimraf=require(_0x52de('0x1'));var zipdir=require(_0x52de('0x2'));var jsonpatch=require(_0x52de('0x3'));var rp=require('request-promise');var moment=require(_0x52de('0x4'));var BPromise=require(_0x52de('0x5'));var Mustache=require(_0x52de('0x6'));var util=require(_0x52de('0x7'));var path=require(_0x52de('0x8'));var sox=require(_0x52de('0x9'));var csv=require('to-csv');var ejs=require(_0x52de('0xa'));var fs=require('fs');var _=require(_0x52de('0xb'));var squel=require(_0x52de('0xc'));var crypto=require(_0x52de('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x52de('0xe'));var querystring=require(_0x52de('0xf'));var Papa=require(_0x52de('0x10'));var Redis=require(_0x52de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x52de('0x12'));var as=require(_0x52de('0x13'));var hardwareService=require(_0x52de('0x14'));var logger=require(_0x52de('0x15'))('api');var utils=require(_0x52de('0x16'));var config=require(_0x52de('0x17'));var licenseUtil=require(_0x52de('0x18'));var db=require(_0x52de('0x19'))['db'];function respondWithStatusCode(_0x35b57b,_0x268156){_0x268156=_0x268156||0xcc;return function(_0x2d9e84){if(_0x2d9e84){return _0x35b57b[_0x52de('0x1a')](_0x268156);}return _0x35b57b['status'](_0x268156)[_0x52de('0x1b')]();};}function respondWithResult(_0x21127b,_0x5e7430){_0x5e7430=_0x5e7430||0xc8;return function(_0x352e1f){if(_0x352e1f){return _0x21127b[_0x52de('0x1c')](_0x5e7430)[_0x52de('0x1d')](_0x352e1f);}};}function respondWithFilteredResult(_0x36b29a,_0x3fbf16){return function(_0x4c8f42){if(_0x4c8f42){var _0x2bde02=_0x4c8f42['count'],_0x278430=_0x3fbf16[_0x52de('0x1e')],_0x1fa664=_0x3fbf16['offset']+_0x3fbf16[_0x52de('0x1f')],_0x205d2b;if(_0x1fa664>=_0x2bde02){_0x1fa664=_0x2bde02;_0x205d2b=0xc8;}else{_0x205d2b=0xce;}_0x36b29a[_0x52de('0x1c')](_0x205d2b);return _0x36b29a[_0x52de('0x20')](_0x52de('0x21'),_0x278430+'-'+_0x1fa664+'/'+_0x2bde02)[_0x52de('0x1d')](_0x4c8f42);}return null;};}function patchUpdates(_0x16bb6d){return function(_0x25c4f7){try{jsonpatch[_0x52de('0x22')](_0x25c4f7,_0x16bb6d,!![]);}catch(_0x2063e8){return BPromise[_0x52de('0x23')](_0x2063e8);}return _0x25c4f7[_0x52de('0x24')]();};}function saveUpdates(_0x4fc601,_0x110405){return function(_0x27747c){if(_0x27747c){return _0x27747c[_0x52de('0x25')](_0x4fc601)[_0x52de('0x26')](function(_0x27453b){return _0x27453b;});}return null;};}function removeEntity(_0x428be6,_0x184ae5){return function(_0x9d55b2){if(_0x9d55b2){return _0x9d55b2['destroy']()[_0x52de('0x26')](function(){_0x428be6[_0x52de('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x191586,_0x35003b){return function(_0x2593c7){if(!_0x2593c7){_0x191586['sendStatus'](0x194);}return _0x2593c7;};}function handleError(_0x27d22e,_0x3968ec){_0x3968ec=_0x3968ec||0x1f4;return function(_0x260d95){logger[_0x52de('0x27')](_0x260d95['stack']);if(_0x260d95['name']){delete _0x260d95[_0x52de('0x28')];}_0x27d22e['status'](_0x3968ec)[_0x52de('0x29')](_0x260d95);};}exports['index']=function(_0x6050e1,_0x2d976c){var _0x428f6c={},_0x40c8d3={},_0x67be79={'count':0x0,'rows':[]};var _0x55cf51=_['map'](db[_0x52de('0x2a')][_0x52de('0x2b')],function(_0x18000b){return{'name':_0x18000b[_0x52de('0x2c')],'type':_0x18000b['type']['key']};});_0x40c8d3[_0x52de('0x2d')]=_[_0x52de('0x2e')](_0x55cf51,'name');_0x40c8d3[_0x52de('0x2f')]=_['keys'](_0x6050e1[_0x52de('0x2f')]);_0x40c8d3[_0x52de('0x30')]=_[_0x52de('0x31')](_0x40c8d3[_0x52de('0x2d')],_0x40c8d3[_0x52de('0x2f')]);_0x428f6c['attributes']=_[_0x52de('0x31')](_0x40c8d3[_0x52de('0x2d')],qs[_0x52de('0x32')](_0x6050e1[_0x52de('0x2f')][_0x52de('0x32')]));_0x428f6c[_0x52de('0x33')]=_0x428f6c[_0x52de('0x33')][_0x52de('0x34')]?_0x428f6c['attributes']:_0x40c8d3['model'];if(!_0x6050e1[_0x52de('0x2f')]['hasOwnProperty'](_0x52de('0x35'))){_0x428f6c[_0x52de('0x1f')]=qs['limit'](_0x6050e1['query'][_0x52de('0x1f')]);_0x428f6c['offset']=qs[_0x52de('0x1e')](_0x6050e1[_0x52de('0x2f')][_0x52de('0x1e')]);}_0x428f6c['order']=qs[_0x52de('0x36')](_0x6050e1[_0x52de('0x2f')][_0x52de('0x36')]);_0x428f6c[_0x52de('0x37')]=qs[_0x52de('0x30')](_['pick'](_0x6050e1[_0x52de('0x2f')],_0x40c8d3[_0x52de('0x30')]),_0x55cf51);if(_0x6050e1[_0x52de('0x2f')][_0x52de('0x38')]){_0x428f6c[_0x52de('0x37')]=_[_0x52de('0x39')](_0x428f6c[_0x52de('0x37')],{'$or':_['map'](_0x55cf51,function(_0x22ed05){if(_0x22ed05['type']!=='VIRTUAL'){var _0x577497={};_0x577497[_0x22ed05[_0x52de('0x28')]]={'$like':'%'+_0x6050e1['query']['filter']+'%'};return _0x577497;}})});}_0x428f6c=_['merge']({},_0x428f6c,_0x6050e1[_0x52de('0x3a')]);var _0x3a6cea={'where':_0x428f6c[_0x52de('0x37')]};return db[_0x52de('0x2a')][_0x52de('0x3b')](_0x3a6cea)[_0x52de('0x26')](function(_0x2bac53){_0x67be79[_0x52de('0x3b')]=_0x2bac53;if(_0x6050e1['query'][_0x52de('0x3c')]){_0x428f6c[_0x52de('0x3d')]=[{'all':!![]}];}return db[_0x52de('0x2a')][_0x52de('0x3e')](_0x428f6c);})[_0x52de('0x26')](function(_0x2b7c39){_0x67be79[_0x52de('0x3f')]=_0x2b7c39;return _0x67be79;})[_0x52de('0x26')](respondWithFilteredResult(_0x2d976c,_0x428f6c))[_0x52de('0x40')](handleError(_0x2d976c,null));};exports[_0x52de('0x41')]=function(_0x32db20,_0x29e842){var _0x1b3661={'raw':!![],'where':{'id':_0x32db20[_0x52de('0x42')]['id']}},_0x5d1ee9={};_0x5d1ee9[_0x52de('0x2d')]=_[_0x52de('0x43')](db[_0x52de('0x2a')][_0x52de('0x2b')]);_0x5d1ee9[_0x52de('0x2f')]=_[_0x52de('0x43')](_0x32db20['query']);_0x5d1ee9[_0x52de('0x30')]=_['intersection'](_0x5d1ee9[_0x52de('0x2d')],_0x5d1ee9[_0x52de('0x2f')]);_0x1b3661['attributes']=_[_0x52de('0x31')](_0x5d1ee9[_0x52de('0x2d')],qs[_0x52de('0x32')](_0x32db20['query'][_0x52de('0x32')]));_0x1b3661[_0x52de('0x33')]=_0x1b3661[_0x52de('0x33')]['length']?_0x1b3661['attributes']:_0x5d1ee9[_0x52de('0x2d')];if(_0x32db20[_0x52de('0x2f')][_0x52de('0x3c')]){_0x1b3661[_0x52de('0x3d')]=[{'all':!![]}];}_0x1b3661=_[_0x52de('0x39')]({},_0x1b3661,_0x32db20[_0x52de('0x3a')]);return db[_0x52de('0x2a')][_0x52de('0x44')](_0x1b3661)['then'](handleEntityNotFound(_0x29e842,null))['then'](respondWithResult(_0x29e842,null))['catch'](handleError(_0x29e842,null));};exports[_0x52de('0x45')]=function(_0x13436c,_0x1a5d0c){return db[_0x52de('0x2a')]['create'](_0x13436c[_0x52de('0x46')],{})[_0x52de('0x26')](respondWithResult(_0x1a5d0c,0xc9))[_0x52de('0x40')](handleError(_0x1a5d0c,null));};exports[_0x52de('0x25')]=function(_0x5cddba,_0xef0140){if(_0x5cddba['body']['id']){delete _0x5cddba[_0x52de('0x46')]['id'];}return db[_0x52de('0x2a')][_0x52de('0x44')]({'where':{'id':_0x5cddba['params']['id']}})[_0x52de('0x26')](handleEntityNotFound(_0xef0140,null))['then'](saveUpdates(_0x5cddba[_0x52de('0x46')],null))[_0x52de('0x26')](respondWithResult(_0xef0140,null))[_0x52de('0x40')](handleError(_0xef0140,null));};exports[_0x52de('0x47')]=function(_0x558546,_0xd53bf){return db[_0x52de('0x2a')]['find']({'where':{'id':_0x558546['params']['id']}})[_0x52de('0x26')](handleEntityNotFound(_0xd53bf,null))[_0x52de('0x26')](removeEntity(_0xd53bf,null))[_0x52de('0x40')](handleError(_0xd53bf,null));}; \ No newline at end of file +var _0x6e72=['json','count','offset','set','reject','save','update','then','destroy','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x535cb7,_0x489364){var _0x56f3ee=function(_0xa320f8){while(--_0xa320f8){_0x535cb7['push'](_0x535cb7['shift']());}};_0x56f3ee(++_0x489364);}(_0x6e72,0x142));var _0x26e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e72[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x26e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x26e7('0x1'));var zipdir=require(_0x26e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26e7('0x3'));var moment=require(_0x26e7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x26e7('0x5'));var util=require(_0x26e7('0x6'));var path=require(_0x26e7('0x7'));var sox=require(_0x26e7('0x8'));var csv=require(_0x26e7('0x9'));var ejs=require(_0x26e7('0xa'));var fs=require('fs');var _=require(_0x26e7('0xb'));var squel=require('squel');var crypto=require(_0x26e7('0xc'));var jsforce=require(_0x26e7('0xd'));var deskjs=require(_0x26e7('0xe'));var toCsv=require(_0x26e7('0x9'));var querystring=require(_0x26e7('0xf'));var Papa=require(_0x26e7('0x10'));var Redis=require(_0x26e7('0x11'));var authService=require(_0x26e7('0x12'));var qs=require(_0x26e7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x26e7('0x14'));var utils=require(_0x26e7('0x15'));var config=require(_0x26e7('0x16'));var licenseUtil=require(_0x26e7('0x17'));var db=require(_0x26e7('0x18'))['db'];function respondWithStatusCode(_0x2b8055,_0x3fb212){_0x3fb212=_0x3fb212||0xcc;return function(_0x53f815){if(_0x53f815){return _0x2b8055[_0x26e7('0x19')](_0x3fb212);}return _0x2b8055[_0x26e7('0x1a')](_0x3fb212)[_0x26e7('0x1b')]();};}function respondWithResult(_0x3d4296,_0x18cf03){_0x18cf03=_0x18cf03||0xc8;return function(_0x586e4a){if(_0x586e4a){return _0x3d4296[_0x26e7('0x1a')](_0x18cf03)[_0x26e7('0x1c')](_0x586e4a);}};}function respondWithFilteredResult(_0x369edc,_0x20c3de){return function(_0x37067d){if(_0x37067d){var _0x202ad4=_0x37067d[_0x26e7('0x1d')],_0x2baf7b=_0x20c3de['offset'],_0x2d018e=_0x20c3de[_0x26e7('0x1e')]+_0x20c3de['limit'],_0x514eaf;if(_0x2d018e>=_0x202ad4){_0x2d018e=_0x202ad4;_0x514eaf=0xc8;}else{_0x514eaf=0xce;}_0x369edc[_0x26e7('0x1a')](_0x514eaf);return _0x369edc[_0x26e7('0x1f')]('Content-Range',_0x2baf7b+'-'+_0x2d018e+'/'+_0x202ad4)['json'](_0x37067d);}return null;};}function patchUpdates(_0x83b0b1){return function(_0x8a582e){try{jsonpatch['apply'](_0x8a582e,_0x83b0b1,!![]);}catch(_0x40e11f){return BPromise[_0x26e7('0x20')](_0x40e11f);}return _0x8a582e[_0x26e7('0x21')]();};}function saveUpdates(_0x1377d9,_0x4822cf){return function(_0x28be8c){if(_0x28be8c){return _0x28be8c[_0x26e7('0x22')](_0x1377d9)[_0x26e7('0x23')](function(_0x476157){return _0x476157;});}return null;};}function removeEntity(_0x2291d4,_0x10d502){return function(_0x14f57f){if(_0x14f57f){return _0x14f57f[_0x26e7('0x24')]()['then'](function(){_0x2291d4[_0x26e7('0x1a')](0xcc)[_0x26e7('0x1b')]();});}};}function handleEntityNotFound(_0x421504,_0x4a9470){return function(_0x57dafa){if(!_0x57dafa){_0x421504[_0x26e7('0x19')](0x194);}return _0x57dafa;};}function handleError(_0x38aa0,_0x3a8d9b){_0x3a8d9b=_0x3a8d9b||0x1f4;return function(_0x57bf67){logger['error'](_0x57bf67[_0x26e7('0x25')]);if(_0x57bf67['name']){delete _0x57bf67[_0x26e7('0x26')];}_0x38aa0[_0x26e7('0x1a')](_0x3a8d9b)[_0x26e7('0x27')](_0x57bf67);};}exports[_0x26e7('0x28')]=function(_0x2d3db3,_0x439376){var _0x3d7de5={},_0x2ec840={},_0x503f84={'count':0x0,'rows':[]};var _0xc1cef2=_[_0x26e7('0x29')](db[_0x26e7('0x2a')][_0x26e7('0x2b')],function(_0x40962d){return{'name':_0x40962d[_0x26e7('0x2c')],'type':_0x40962d[_0x26e7('0x2d')]['key']};});_0x2ec840[_0x26e7('0x2e')]=_[_0x26e7('0x29')](_0xc1cef2,_0x26e7('0x26'));_0x2ec840[_0x26e7('0x2f')]=_[_0x26e7('0x30')](_0x2d3db3[_0x26e7('0x2f')]);_0x2ec840[_0x26e7('0x31')]=_[_0x26e7('0x32')](_0x2ec840['model'],_0x2ec840[_0x26e7('0x2f')]);_0x3d7de5[_0x26e7('0x33')]=_[_0x26e7('0x32')](_0x2ec840[_0x26e7('0x2e')],qs[_0x26e7('0x34')](_0x2d3db3['query'][_0x26e7('0x34')]));_0x3d7de5[_0x26e7('0x33')]=_0x3d7de5[_0x26e7('0x33')][_0x26e7('0x35')]?_0x3d7de5[_0x26e7('0x33')]:_0x2ec840[_0x26e7('0x2e')];if(!_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x36')]('nolimit')){_0x3d7de5[_0x26e7('0x37')]=qs[_0x26e7('0x37')](_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x37')]);_0x3d7de5[_0x26e7('0x1e')]=qs[_0x26e7('0x1e')](_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x1e')]);}_0x3d7de5[_0x26e7('0x38')]=qs[_0x26e7('0x39')](_0x2d3db3['query'][_0x26e7('0x39')]);_0x3d7de5[_0x26e7('0x3a')]=qs[_0x26e7('0x31')](_['pick'](_0x2d3db3['query'],_0x2ec840[_0x26e7('0x31')]),_0xc1cef2);if(_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x3b')]){_0x3d7de5['where']=_[_0x26e7('0x3c')](_0x3d7de5[_0x26e7('0x3a')],{'$or':_[_0x26e7('0x29')](_0xc1cef2,function(_0x246699){if(_0x246699[_0x26e7('0x2d')]!==_0x26e7('0x3d')){var _0x1784fa={};_0x1784fa[_0x246699[_0x26e7('0x26')]]={'$like':'%'+_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x3b')]+'%'};return _0x1784fa;}})});}_0x3d7de5=_[_0x26e7('0x3c')]({},_0x3d7de5,_0x2d3db3[_0x26e7('0x3e')]);var _0x520672={'where':_0x3d7de5[_0x26e7('0x3a')]};return db[_0x26e7('0x2a')][_0x26e7('0x1d')](_0x520672)['then'](function(_0x5ccdde){_0x503f84[_0x26e7('0x1d')]=_0x5ccdde;if(_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x3f')]){_0x3d7de5[_0x26e7('0x40')]=[{'all':!![]}];}return db[_0x26e7('0x2a')]['findAll'](_0x3d7de5);})['then'](function(_0x498469){_0x503f84['rows']=_0x498469;return _0x503f84;})[_0x26e7('0x23')](respondWithFilteredResult(_0x439376,_0x3d7de5))[_0x26e7('0x41')](handleError(_0x439376,null));};exports['show']=function(_0x1c49b9,_0x42bad8){var _0x108eb5={'raw':!![],'where':{'id':_0x1c49b9[_0x26e7('0x42')]['id']}},_0x333913={};_0x333913[_0x26e7('0x2e')]=_[_0x26e7('0x30')](db[_0x26e7('0x2a')][_0x26e7('0x2b')]);_0x333913[_0x26e7('0x2f')]=_[_0x26e7('0x30')](_0x1c49b9[_0x26e7('0x2f')]);_0x333913[_0x26e7('0x31')]=_['intersection'](_0x333913[_0x26e7('0x2e')],_0x333913[_0x26e7('0x2f')]);_0x108eb5['attributes']=_[_0x26e7('0x32')](_0x333913[_0x26e7('0x2e')],qs[_0x26e7('0x34')](_0x1c49b9[_0x26e7('0x2f')]['fields']));_0x108eb5[_0x26e7('0x33')]=_0x108eb5['attributes'][_0x26e7('0x35')]?_0x108eb5[_0x26e7('0x33')]:_0x333913[_0x26e7('0x2e')];if(_0x1c49b9[_0x26e7('0x2f')][_0x26e7('0x3f')]){_0x108eb5[_0x26e7('0x40')]=[{'all':!![]}];}_0x108eb5=_['merge']({},_0x108eb5,_0x1c49b9[_0x26e7('0x3e')]);return db[_0x26e7('0x2a')][_0x26e7('0x43')](_0x108eb5)[_0x26e7('0x23')](handleEntityNotFound(_0x42bad8,null))['then'](respondWithResult(_0x42bad8,null))[_0x26e7('0x41')](handleError(_0x42bad8,null));};exports[_0x26e7('0x44')]=function(_0x4c3be9,_0x2f3598){return db[_0x26e7('0x2a')]['create'](_0x4c3be9[_0x26e7('0x45')],{})[_0x26e7('0x23')](respondWithResult(_0x2f3598,0xc9))['catch'](handleError(_0x2f3598,null));};exports['update']=function(_0x541c6b,_0x168808){if(_0x541c6b[_0x26e7('0x45')]['id']){delete _0x541c6b[_0x26e7('0x45')]['id'];}return db['FaxApplication'][_0x26e7('0x43')]({'where':{'id':_0x541c6b['params']['id']}})['then'](handleEntityNotFound(_0x168808,null))['then'](saveUpdates(_0x541c6b[_0x26e7('0x45')],null))[_0x26e7('0x23')](respondWithResult(_0x168808,null))['catch'](handleError(_0x168808,null));};exports['destroy']=function(_0x4fe0a0,_0x585731){return db[_0x26e7('0x2a')][_0x26e7('0x43')]({'where':{'id':_0x4fe0a0['params']['id']}})['then'](handleEntityNotFound(_0x585731,null))['then'](removeEntity(_0x585731,null))['catch'](handleError(_0x585731,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index fb89fed..f0767c5 100644 --- a/server/api/faxApplication/faxApplication.model.js +++ b/server/api/faxApplication/faxApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x940d=['../../config/environment','./faxApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x46cf66,_0x4b215b){var _0x543ee7=function(_0x19df73){while(--_0x19df73){_0x46cf66['push'](_0x46cf66['shift']());}};_0x543ee7(++_0x4b215b);}(_0x940d,0x162));var _0xd940=function(_0x146b5a,_0x3117a1){_0x146b5a=_0x146b5a-0x0;var _0x2d90c9=_0x940d[_0x146b5a];return _0x2d90c9;};'use strict';var _=require(_0xd940('0x0'));var util=require(_0xd940('0x1'));var logger=require(_0xd940('0x2'))('api');var moment=require(_0xd940('0x3'));var BPromise=require(_0xd940('0x4'));var rp=require(_0xd940('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd940('0x6'));var attributes=require(_0xd940('0x7'));module[_0xd940('0x8')]=function(_0x4ce92b,_0xa806c0){return _0x4ce92b[_0xd940('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd940('0xa'),'collate':_0xd940('0xb')});}; \ No newline at end of file +var _0x08d1=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x08d1,0x67));var _0x108d=function(_0x296466,_0x40144c){_0x296466=_0x296466-0x0;var _0x2aff3f=_0x08d1[_0x296466];return _0x2aff3f;};'use strict';var _=require(_0x108d('0x0'));var util=require(_0x108d('0x1'));var logger=require(_0x108d('0x2'))('api');var moment=require(_0x108d('0x3'));var BPromise=require(_0x108d('0x4'));var rp=require(_0x108d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x108d('0x6'));var config=require(_0x108d('0x7'));var attributes=require(_0x108d('0x8'));module[_0x108d('0x9')]=function(_0x57ec74,_0x10a296){return _0x57ec74[_0x108d('0xa')](_0x108d('0xb'),attributes,{'tableName':_0x108d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x108d('0xd'),'collate':_0x108d('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ea8e722..4639706 100644 --- a/server/api/faxApplication/faxApplication.rpc.js +++ b/server/api/faxApplication/faxApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4537=['limit','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateFaxApplication','update','options','raw','where'];(function(_0x164b96,_0x12f735){var _0x5489d9=function(_0x57ef88){while(--_0x57ef88){_0x164b96['push'](_0x164b96['shift']());}};_0x5489d9(++_0x12f735);}(_0x4537,0xd3));var _0x7453=function(_0xcf82b2,_0x49ab9a){_0xcf82b2=_0xcf82b2-0x0;var _0x4275e9=_0x4537[_0xcf82b2];return _0x4275e9;};'use strict';var _=require(_0x7453('0x0'));var util=require('util');var moment=require(_0x7453('0x1'));var BPromise=require(_0x7453('0x2'));var rs=require(_0x7453('0x3'));var fs=require('fs');var Redis=require(_0x7453('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7453('0x5'));var logger=require(_0x7453('0x6'))(_0x7453('0x7'));var config=require(_0x7453('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb6432d,_0x1c9a11,_0x26bcb7){return new BPromise(function(_0x1fe455,_0x4d5c16){return client[_0x7453('0x9')](_0xb6432d,_0x26bcb7)['then'](function(_0x166913){logger['info']('FaxApplication,\x20%s,\x20%s',_0x1c9a11,_0x7453('0xa'));logger['debug'](_0x7453('0xb'),_0x1c9a11,_0x7453('0xa'),JSON['stringify'](_0x166913));if(_0x166913[_0x7453('0xc')]){if(_0x166913[_0x7453('0xc')][_0x7453('0xd')]===0x1f4){logger[_0x7453('0xc')]('FaxApplication,\x20%s,\x20%s',_0x1c9a11,_0x166913['error'][_0x7453('0xe')]);return _0x4d5c16(_0x166913['error'][_0x7453('0xe')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x1c9a11,_0x166913[_0x7453('0xc')][_0x7453('0xe')]);return _0x1fe455(_0x166913['error'][_0x7453('0xe')]);}else{logger[_0x7453('0xf')]('FaxApplication,\x20%s,\x20%s',_0x1c9a11,_0x7453('0xa'));_0x1fe455(_0x166913[_0x7453('0x10')][_0x7453('0xe')]);}})[_0x7453('0x11')](function(_0x8de981){logger[_0x7453('0xc')]('FaxApplication,\x20%s,\x20%s',_0x1c9a11,_0x8de981);_0x4d5c16(_0x8de981);});});}exports[_0x7453('0x12')]=function(_0x113f40){var _0x18b570=this;return new Promise(function(_0x591296,_0x109440){return db['FaxApplication'][_0x7453('0x13')](_0x113f40['body'],{'raw':_0x113f40[_0x7453('0x14')]?_0x113f40[_0x7453('0x14')][_0x7453('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x113f40[_0x7453('0x14')]?_0x113f40['options'][_0x7453('0x16')]||null:null,'attributes':_0x113f40[_0x7453('0x14')]?_0x113f40['options']['attributes']||null:null,'limit':_0x113f40[_0x7453('0x14')]?_0x113f40[_0x7453('0x14')][_0x7453('0x17')]||null:null})[_0x7453('0x18')](function(_0x203e50){logger[_0x7453('0xf')]('UpdateFaxApplication',_0x113f40);logger[_0x7453('0x19')]('UpdateFaxApplication',_0x113f40,JSON['stringify'](_0x203e50));_0x591296(_0x203e50);})['catch'](function(_0x25c733){logger[_0x7453('0xc')]('UpdateFaxApplication',_0x25c733['message'],_0x113f40);_0x109440(_0x18b570['error'](0x1f4,_0x25c733['message']));});});}; \ No newline at end of file +var _0xd03c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','options','where','attributes','lodash'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xd03c,0x15b));var _0xcd03=function(_0x2242a4,_0x4a45cb){_0x2242a4=_0x2242a4-0x0;var _0x18f626=_0xd03c[_0x2242a4];return _0x18f626;};'use strict';var _=require(_0xcd03('0x0'));var util=require(_0xcd03('0x1'));var moment=require(_0xcd03('0x2'));var BPromise=require(_0xcd03('0x3'));var rs=require(_0xcd03('0x4'));var fs=require('fs');var Redis=require(_0xcd03('0x5'));var db=require(_0xcd03('0x6'))['db'];var utils=require(_0xcd03('0x7'));var logger=require('../../config/logger')(_0xcd03('0x8'));var config=require(_0xcd03('0x9'));var jayson=require(_0xcd03('0xa'));var client=jayson[_0xcd03('0xb')][_0xcd03('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x546deb,_0x4a99d6,_0xfc260f){return new BPromise(function(_0x2413fa,_0x2067d0){return client[_0xcd03('0xd')](_0x546deb,_0xfc260f)[_0xcd03('0xe')](function(_0x28bf0c){logger[_0xcd03('0xf')]('FaxApplication,\x20%s,\x20%s',_0x4a99d6,_0xcd03('0x10'));logger[_0xcd03('0x11')](_0xcd03('0x12'),_0x4a99d6,_0xcd03('0x10'),JSON['stringify'](_0x28bf0c));if(_0x28bf0c[_0xcd03('0x13')]){if(_0x28bf0c[_0xcd03('0x13')]['code']===0x1f4){logger[_0xcd03('0x13')](_0xcd03('0x14'),_0x4a99d6,_0x28bf0c['error'][_0xcd03('0x15')]);return _0x2067d0(_0x28bf0c[_0xcd03('0x13')][_0xcd03('0x15')]);}logger[_0xcd03('0x13')](_0xcd03('0x14'),_0x4a99d6,_0x28bf0c[_0xcd03('0x13')][_0xcd03('0x15')]);return _0x2413fa(_0x28bf0c[_0xcd03('0x13')][_0xcd03('0x15')]);}else{logger[_0xcd03('0xf')](_0xcd03('0x14'),_0x4a99d6,_0xcd03('0x10'));_0x2413fa(_0x28bf0c[_0xcd03('0x16')][_0xcd03('0x15')]);}})[_0xcd03('0x17')](function(_0x817953){logger[_0xcd03('0x13')](_0xcd03('0x14'),_0x4a99d6,_0x817953);_0x2067d0(_0x817953);});});}exports[_0xcd03('0x18')]=function(_0x1d21c9){var _0x581f12=this;return new Promise(function(_0x309b78,_0x1a9c18){return db[_0xcd03('0x19')]['update'](_0x1d21c9['body'],{'raw':_0x1d21c9[_0xcd03('0x1a')]?_0x1d21c9[_0xcd03('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d21c9[_0xcd03('0x1a')]?_0x1d21c9[_0xcd03('0x1a')][_0xcd03('0x1b')]||null:null,'attributes':_0x1d21c9[_0xcd03('0x1a')]?_0x1d21c9[_0xcd03('0x1a')][_0xcd03('0x1c')]||null:null,'limit':_0x1d21c9[_0xcd03('0x1a')]?_0x1d21c9[_0xcd03('0x1a')]['limit']||null:null})[_0xcd03('0xe')](function(_0x461509){logger[_0xcd03('0xf')](_0xcd03('0x18'),_0x1d21c9);logger[_0xcd03('0x11')](_0xcd03('0x18'),_0x1d21c9,JSON['stringify'](_0x461509));_0x309b78(_0x461509);})[_0xcd03('0x17')](function(_0x5176b3){logger[_0xcd03('0x13')](_0xcd03('0x18'),_0x5176b3[_0xcd03('0x15')],_0x1d21c9);_0x1a9c18(_0x581f12['error'](0x1f4,_0x5176b3[_0xcd03('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e333785..d3d9d94 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x326f,0xd1));var _0xf326=function(_0x11aa5c,_0x463342){_0x11aa5c=_0x11aa5c-0x0;var _0x16b7e4=_0x326f[_0x11aa5c];return _0x16b7e4;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x227102,_0xf07c04){var _0x1d89ed=function(_0x2a709a){while(--_0x2a709a){_0x227102['push'](_0x227102['shift']());}};_0x1d89ed(++_0xf07c04);}(_0x2eb2,0x19f));var _0x22eb=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x2eb2[_0x56482c];return _0x5aae7a;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller['update']);router[_0x22eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 53622a1..5543cdb 100644 --- a/server/api/faxInteraction/faxInteraction.attributes.js +++ b/server/api/faxInteraction/faxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4853=['exports','DATE','STRING','ENUM','out'];(function(_0x139a4e,_0x4e8f30){var _0x2c1ed6=function(_0x2f6419){while(--_0x2f6419){_0x139a4e['push'](_0x139a4e['shift']());}};_0x2c1ed6(++_0x4e8f30);}(_0x4853,0x11d));var _0x3485=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4853[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x3485('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3485('0x1')]},'disposition':{'type':Sequelize[_0x3485('0x2')]},'secondDisposition':{'type':Sequelize[_0x3485('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3485('0x2')]},'note':{'type':Sequelize[_0x3485('0x2')]},'read1stAt':{'type':Sequelize[_0x3485('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3485('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x3485('0x3')]('in',_0x3485('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x383d=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x470ed4,_0x1bd1ce){var _0x4b681e=function(_0x8a5b6f){while(--_0x8a5b6f){_0x470ed4['push'](_0x470ed4['shift']());}};_0x4b681e(++_0x1bd1ce);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xd383('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd383('0x1')]},'disposition':{'type':Sequelize[_0xd383('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd383('0x2')]},'note':{'type':Sequelize[_0xd383('0x2')]},'read1stAt':{'type':Sequelize[_0xd383('0x1')]},'fax':{'type':Sequelize[_0xd383('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd383('0x3')]('in',_0xd383('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xd383('0x3')]('in',_0xd383('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index cc1b8c6..b0a3032 100644 --- a/server/api/faxInteraction/faxInteraction.controller.js +++ b/server/api/faxInteraction/faxInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14d=['SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','groupBy','FaxInteractionId','rows','show','params','includeAll','include','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','emit','removeTags','unix','join','server','files','tmp','root','Attachment','Messages','get','basename','existsSync','pipe','createWriteStream','download','log','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','catch','index','FaxInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','order','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge'];(function(_0x324797,_0x114b66){var _0x4427be=function(_0x4617b6){while(--_0x4617b6){_0x324797['push'](_0x324797['shift']());}};_0x4427be(++_0x114b66);}(_0xe14d,0x1ee));var _0xde14=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xe14d[_0x173d7e];return _0x2220d6;};'use strict';var pdf=require(_0xde14('0x0'));var emlformat=require(_0xde14('0x1'));var rimraf=require(_0xde14('0x2'));var zipdir=require(_0xde14('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde14('0x4'));var moment=require(_0xde14('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xde14('0x6'));var util=require(_0xde14('0x7'));var path=require(_0xde14('0x8'));var sox=require(_0xde14('0x9'));var csv=require(_0xde14('0xa'));var ejs=require(_0xde14('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0xa'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];config[_0xde14('0x1b')]=_[_0xde14('0x1c')](config[_0xde14('0x1b')],{'host':_0xde14('0x1d'),'port':0x18eb});var socket=require(_0xde14('0x1e'))(new Redis(config[_0xde14('0x1b')]));require(_0xde14('0x1f'))['register'](socket);function respondWithStatusCode(_0x584959,_0x23c878){_0x23c878=_0x23c878||0xcc;return function(_0x1db2f6){if(_0x1db2f6){return _0x584959[_0xde14('0x20')](_0x23c878);}return _0x584959['status'](_0x23c878)[_0xde14('0x21')]();};}function respondWithResult(_0x31adb3,_0x257390){_0x257390=_0x257390||0xc8;return function(_0x31902a){if(_0x31902a){return _0x31adb3[_0xde14('0x22')](_0x257390)[_0xde14('0x23')](_0x31902a);}};}function respondWithFilteredResult(_0x29e243,_0x6f6eea){return function(_0x3cc317){if(_0x3cc317){var _0x10c4ab=_0x3cc317[_0xde14('0x24')],_0x590a8b=_0x6f6eea[_0xde14('0x25')],_0x3f5fcf=_0x6f6eea['offset']+_0x6f6eea[_0xde14('0x26')],_0x3bfc59;if(_0x3f5fcf>=_0x10c4ab){_0x3f5fcf=_0x10c4ab;_0x3bfc59=0xc8;}else{_0x3bfc59=0xce;}_0x29e243['status'](_0x3bfc59);return _0x29e243[_0xde14('0x27')]('Content-Range',_0x590a8b+'-'+_0x3f5fcf+'/'+_0x10c4ab)[_0xde14('0x23')](_0x3cc317);}return null;};}function patchUpdates(_0x30fcf1){return function(_0x51ee8d){try{jsonpatch[_0xde14('0x28')](_0x51ee8d,_0x30fcf1,!![]);}catch(_0x39bdc5){return BPromise[_0xde14('0x29')](_0x39bdc5);}return _0x51ee8d[_0xde14('0x2a')]();};}function saveUpdates(_0x2dd9e7,_0xdd8d59){return function(_0x163b79){if(_0x163b79){return _0x163b79[_0xde14('0x2b')](_0x2dd9e7)[_0xde14('0x2c')](function(_0x8f8033){return _0x8f8033;});}return null;};}function removeEntity(_0x5ae4c1,_0x42dd4f){return function(_0x3ce77c){if(_0x3ce77c){return _0x3ce77c[_0xde14('0x2d')]()[_0xde14('0x2c')](function(){_0x5ae4c1[_0xde14('0x22')](0xcc)[_0xde14('0x21')]();});}};}function handleEntityNotFound(_0x310d75,_0x23c735){return function(_0x1618e1){if(!_0x1618e1){_0x310d75[_0xde14('0x20')](0x194);}return _0x1618e1;};}function handleError(_0x4eff65,_0x309922){_0x309922=_0x309922||0x1f4;return function(_0x1696ee){logger[_0xde14('0x2e')](_0x1696ee[_0xde14('0x2f')]);if(_0x1696ee['name']){delete _0x1696ee[_0xde14('0x30')];}_0x4eff65[_0xde14('0x22')](_0x309922)[_0xde14('0x31')](_0x1696ee);};}function getInteractionUsers(_0x553cab,_0x4655fb){return new BPromise(function(_0x582537,_0x2760f9){try{if(_0x4655fb[_0x553cab['id']]){_0x553cab[_0xde14('0x32')]=_[_0xde14('0x33')](_0x4655fb[_0x553cab['id']],function(_0x1e7906){return{'id':_0x1e7906['id'],'fullname':_0x1e7906[_0xde14('0x34')]};});}}catch(_0x237d3f){_0x2760f9(_0x237d3f);}_0x582537(_0x553cab);});}function getInteractionTags(_0xae9dca,_0x464666){return new BPromise(function(_0x4e7c5b,_0xbfc01b){try{if(_0xae9dca[_0xde14('0x35')]){_0xae9dca['Tags']=[];_0xae9dca[_0xde14('0x35')]['split'](',')[_0xde14('0x36')](function(_0x44e88a){_0xae9dca[_0xde14('0x37')][_0xde14('0x38')](_0x464666[_0x44e88a]);});}delete _0xae9dca[_0xde14('0x35')];}catch(_0x57fc47){_0xbfc01b(_0x57fc47);}_0x4e7c5b(_0xae9dca);});}function updateFaxInteraction(_0x26dfa9,_0x57b98b,_0x4d4295){return new BPromise(function(_0x280238,_0x3c943b){return getInteractionUsers(_0x26dfa9,_0x4d4295)[_0xde14('0x2c')](function(_0x319136){return getInteractionTags(_0x319136,_0x57b98b);})[_0xde14('0x2c')](function(_0xa41c1e){_0x280238(_0xa41c1e);})[_0xde14('0x39')](function(_0x32fe83){_0x3c943b(_0x32fe83);});});}exports[_0xde14('0x3a')]=function(_0x48d587,_0x50084f){var _0x1c7136={},_0x403007={},_0x20913d={'count':0x0,'rows':[]};var _0x38d21c=_[_0xde14('0x33')](db[_0xde14('0x3b')][_0xde14('0x3c')],function(_0x2b0bc4){return{'name':_0x2b0bc4[_0xde14('0x3d')],'type':_0x2b0bc4['type'][_0xde14('0x3e')]};});_0x403007['model']=_['map'](_0x38d21c,'name');_0x403007[_0xde14('0x3f')]=_[_0xde14('0x40')](_0x48d587[_0xde14('0x3f')]);_0x403007[_0xde14('0x41')]=_[_0xde14('0x42')](_0x403007[_0xde14('0x43')],_0x403007[_0xde14('0x3f')]);_0x1c7136[_0xde14('0x44')]=_['intersection'](_0x403007[_0xde14('0x43')],qs[_0xde14('0x45')](_0x48d587[_0xde14('0x3f')][_0xde14('0x45')]));_0x1c7136[_0xde14('0x44')]=_0x1c7136[_0xde14('0x44')][_0xde14('0x46')]?_0x1c7136[_0xde14('0x44')]:_0x403007['model'];if(!_0x48d587[_0xde14('0x3f')][_0xde14('0x47')](_0xde14('0x48'))){_0x1c7136[_0xde14('0x26')]=qs['limit'](_0x48d587['query'][_0xde14('0x26')]);_0x1c7136[_0xde14('0x25')]=qs[_0xde14('0x25')](_0x48d587[_0xde14('0x3f')][_0xde14('0x25')]);}_0x1c7136['order']=qs[_0xde14('0x49')](_0x48d587[_0xde14('0x3f')][_0xde14('0x49')]);_0x1c7136['where']=qs[_0xde14('0x41')](_['pick'](_0x48d587[_0xde14('0x3f')],_0x403007['filters']),_0x38d21c);var _0x102770=[];var _0x117c64=squel[_0xde14('0x4a')]()[_0xde14('0x4b')]('id')[_0xde14('0x4b')](_0xde14('0x30'))[_0xde14('0x4b')](_0xde14('0x4c'))['from'](_0xde14('0x4d'));var _0x5a4475=squel[_0xde14('0x4a')]()['field'](_0xde14('0x4e'))[_0xde14('0x4b')](_0xde14('0x4f'))[_0xde14('0x4b')](_0xde14('0x50'))[_0xde14('0x51')](_0xde14('0x52'),'ui')[_0xde14('0x53')]('users','u',_0xde14('0x54'));var _0xe3669c=squel[_0xde14('0x4a')]()[_0xde14('0x51')]('fax_interactions','i')[_0xde14('0x53')](_0xde14('0x55'),'c',_0xde14('0x56'))[_0xde14('0x53')](_0xde14('0x57'),'o',_0xde14('0x58'))['left_join'](_0xde14('0x59'),'a','a.id\x20=\x20i.FaxAccountId')[_0xde14('0x53')](_0xde14('0x5a'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xde14('0x53')](_0xde14('0x5b'),'it',_0xde14('0x5c'))[_0xde14('0x53')](_0xde14('0x4d'),'t',_0xde14('0x5d'));var _0x45fa7e=squel['expr']();var _0x32a57c=[];var _0x4ffc8c=squel[_0xde14('0x5e')]();var _0x6aa9ab;if(_0x48d587[_0xde14('0x3f')][_0xde14('0x5f')]){_0x6aa9ab=as[_0xde14('0x60')](_0x48d587[_0xde14('0x3f')][_0xde14('0x5f')]);var _0x1f7316=_0x6aa9ab[_0xde14('0x61')];for(var _0x14bf78=0x0;_0x14bf78<_0x6aa9ab['conditions'][_0xde14('0x46')];_0x14bf78++){var _0x1688c6=_0x6aa9ab[_0xde14('0x62')][_0x14bf78];var _0x38d50a='i';var _0x14b781=_['find'](_0x38d21c,[_0xde14('0x30'),_0x1688c6['field']]);if(!_0x14b781){switch(_0x1688c6[_0xde14('0x4b')]){case _0xde14('0x63'):if(_0x1688c6[_0xde14('0x64')]==0x1){_0xe3669c[_0xde14('0x65')]('`'+_0x1688c6[_0xde14('0x4b')]+'`\x20=\x200');}else{_0xe3669c['having']('`'+_0x1688c6[_0xde14('0x4b')]+'`\x20>\x200');}break;case _0xde14('0x66'):if(_0x1688c6[_0xde14('0x67')]===_0xde14('0x68')){if(_0x1688c6[_0xde14('0x64')][_0xde14('0x69')]('\x20')[_0xde14('0x46')]>0x1){_0x45fa7e[_0x1f7316](_0xde14('0x6a'),qs[_0xde14('0x6b')](_0x1688c6[_0xde14('0x64')]),null);}else{var _0x4ba257='%'+_0x1688c6[_0xde14('0x64')]+'%';_0x45fa7e[_0x1f7316](_0xde14('0x6c'),_0x4ba257,_0x4ba257,_0x4ba257);}}else{_0x14b781=_[_0xde14('0x6d')](_0x38d21c,[_0xde14('0x30'),_0xde14('0x6e')]);_0x1688c6['field']=_0xde14('0x6e');_0x1a0bb1=as['buildExpression'](_0x38d50a,_0x14b781[_0xde14('0x6f')],_0x1688c6);_0x45fa7e[_0x1f7316](_0x1a0bb1[_0xde14('0x70')],_0x1a0bb1[_0xde14('0x64')][_0xde14('0x71')],_0x1a0bb1[_0xde14('0x64')][_0xde14('0x21')]);}break;case _0xde14('0x72'):var _0x409a59=_0x1688c6['value']['split'](',')['map'](function(_0x475671){return Number(_0x475671);});_0x409a59['forEach'](function(_0x596cd3){_0x4ffc8c['or'](_0xde14('0x73'),'%,'+_0x596cd3+',%');});_0x32a57c=_[_0xde14('0x74')](_0x32a57c,_0x409a59);break;case _0xde14('0x75'):if(_0x1688c6[_0xde14('0x67')]===_0xde14('0x68')){_0x45fa7e[_0x1f7316](_0xde14('0x76'),'%'+_0x1688c6[_0xde14('0x64')]+'%',null);}else{_0x14b781=_[_0xde14('0x6d')](_0x38d21c,[_0xde14('0x30'),'UserId']);_0x1688c6[_0xde14('0x4b')]=_0xde14('0x77');_0x1a0bb1=as[_0xde14('0x78')](_0x38d50a,_0x14b781['type'],_0x1688c6);_0x45fa7e[_0x1f7316](_0x1a0bb1[_0xde14('0x70')],_0x1a0bb1['value'][_0xde14('0x71')],_0x1a0bb1[_0xde14('0x64')][_0xde14('0x21')]);}break;case _0xde14('0x79'):_0x1a0bb1=as[_0xde14('0x78')]('me',null,_0x1688c6);_0x45fa7e[_0x1f7316](_0x1a0bb1[_0xde14('0x70')],_0x1a0bb1[_0xde14('0x64')]['start'],_0x1a0bb1[_0xde14('0x64')][_0xde14('0x21')]);break;}}else{var _0x1a0bb1=as[_0xde14('0x78')](_0x38d50a,_0x14b781[_0xde14('0x6f')],_0x1688c6);_0x45fa7e[_0x1f7316](_0x1a0bb1[_0xde14('0x70')],_0x1a0bb1[_0xde14('0x64')]['start'],_0x1a0bb1['value'][_0xde14('0x21')]);}}}else{var _0x19a162=_(_0x48d587[_0xde14('0x3f')])['keys']()[_0xde14('0x33')](function(_0x2bfb4f){return _[_0xde14('0x7a')](_0x38d21c,[_0xde14('0x30'),_0x2bfb4f])?_0x2bfb4f:undefined;})['compact']()['value']();if(!_[_0xde14('0x7b')](_0x19a162)){_0x19a162[_0xde14('0x36')](function(_0x30f228){if(_0x30f228===_0xde14('0x7c')){_0xe3669c[_0xde14('0x7d')](_0xde14('0x7e'),[][_0xde14('0x7f')](_0x48d587[_0xde14('0x3f')][_0x30f228]));}else if(_0x30f228===_0xde14('0x80')){var _0x4657d1=JSON[_0xde14('0x81')](_0x48d587[_0xde14('0x3f')][_0x30f228])[_0xde14('0x82')];var _0x42329a=JSON[_0xde14('0x81')](_0x48d587[_0xde14('0x3f')][_0x30f228])[_0xde14('0x83')];_0xe3669c[_0xde14('0x7d')](_0xde14('0x84'),_0x4657d1,_0x42329a);}else{if(_0x48d587[_0xde14('0x3f')][_0x30f228]===_0xde14('0x85')){_0xe3669c[_0xde14('0x7d')]('i.'+_0x30f228+_0xde14('0x86'));}else{_0xe3669c['where']('i.'+_0x30f228+_0xde14('0x87'),_0x48d587['query'][_0x30f228]);}}});}if(_0x48d587[_0xde14('0x3f')]['read']){if(_0x48d587[_0xde14('0x3f')][_0xde14('0x88')]==0x1){_0xe3669c[_0xde14('0x65')]('`unreadMessages`\x20=\x200');}else{_0xe3669c['having'](_0xde14('0x89'));}}if(_0x48d587[_0xde14('0x3f')][_0xde14('0x8a')]){_0x32a57c=_[_0xde14('0x8b')](_0x48d587['query'][_0xde14('0x8a')])?_0x48d587[_0xde14('0x3f')][_0xde14('0x8a')]:new Array(_0x48d587['query']['tag']);_0x32a57c['forEach'](function(_0x58ccb4){_0x4ffc8c['or'](_0xde14('0x73'),'%,'+_0x58ccb4+',%');});}if(_0x48d587[_0xde14('0x3f')][_0xde14('0x8c')]){var _0x5b1a32=_0x48d587[_0xde14('0x3f')][_0xde14('0x8c')][_0xde14('0x8d')]('\x5c','\x5c\x5c')[_0xde14('0x8d')](/'/g,'\x27\x27');if(qs[_0xde14('0x8e')](_0x5b1a32)){_0x45fa7e['or'](_0xde14('0x8f'),_0x5b1a32+'%')['or']('i.fax\x20LIKE\x20?',_0x5b1a32+'%');}_0x45fa7e['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5b1a32+'%');}}_0xe3669c[_0xde14('0x7d')](_0x45fa7e);_0xe3669c[_0xde14('0x90')]('i.id');var _0x103766={'type':db[_0xde14('0x91')][_0xde14('0x92')][_0xde14('0x93')],'raw':!![]};var _0x32f022=_0xe3669c[_0xde14('0x94')]();_0x32f022[_0xde14('0x4b')]('i.id');_0x32f022['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x1c7136[_0xde14('0x95')]){_0x1c7136[_0xde14('0x95')]['forEach'](function(_0x5930fb){var _0x350aa8=_0x5930fb[0x0]===_0xde14('0x96')?_0x5930fb[0x0]:'i.'+_0x5930fb[0x0];_0xe3669c[_0xde14('0x95')](_0x350aa8,_0x5930fb[0x1]==='DESC'?![]:!![]);});}if(!_[_0xde14('0x7b')](_0x32a57c)){_0xe3669c[_0xde14('0x65')](_0x4ffc8c);_0x32f022['where'](_0xde14('0x97'),_0x32a57c);}BPromise[_0xde14('0x98')]()[_0xde14('0x2c')](function(){if(!_0x6aa9ab){if(_0x48d587[_0xde14('0x3f')]['FaxAccountId']||_0x48d587[_0xde14('0x3f')]['journey'])return;_0x32f022[_0xde14('0x7d')](_0xde14('0x99'));_0xe3669c[_0xde14('0x7d')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x48d587[_0xde14('0x9a')][_0xde14('0x9b')]!==_0xde14('0x9c'))return;return _0x48d587[_0xde14('0x9a')][_0xde14('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x53433d){if(_[_0xde14('0x7b')](_0x53433d)){_0x32f022[_0xde14('0x7d')](_0xde14('0x9e'));_0xe3669c['where'](_0xde14('0x9e'));}else{_0x32f022[_0xde14('0x7d')](_0xde14('0x7e'),_[_0xde14('0x33')](_0x53433d,'id'));_0xe3669c[_0xde14('0x7d')](_0xde14('0x7e'),_[_0xde14('0x33')](_0x53433d,'id'));}});})['then'](function(){if(_0x48d587[_0xde14('0x9a')][_0xde14('0x9b')]===_0xde14('0x9c')&&!_0x6aa9ab&&!_0x48d587[_0xde14('0x3f')][_0xde14('0x7c')])return[];return db[_0xde14('0x9f')][_0xde14('0x3f')](_0x32f022['toString'](),_0x103766);})[_0xde14('0x2c')](function(_0x1bdeae){_0x20913d['count']=_0x1bdeae[_0xde14('0x46')];if(_0x20913d['count']===0x0)return[];return db[_0xde14('0x9f')]['query'](_0x117c64[_0xde14('0xa0')](),_0x103766)[_0xde14('0x2c')](function(_0x2bc4fb){_0x102770=_[_0xde14('0xa1')](_0x2bc4fb,'id');_0x103766=_[_0xde14('0xa2')](_0x103766,{'model':db[_0xde14('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48d587['query'][_0xde14('0x45')]){_0x1c7136[_0xde14('0x44')][_0xde14('0x36')](function(_0x51c4b1){_0xe3669c[_0xde14('0x4b')]('i.'+_0x51c4b1);});}else{_0xe3669c[_0xde14('0x4b')](_0xde14('0xa3'),'unreadMessages');_0xe3669c[_0xde14('0x4b')](_0xde14('0xa4'),_0xde14('0xa5'));_0xe3669c['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0xe3669c['field'](_0xde14('0xa6'),_0xde14('0x96'));_0xe3669c['field'](_0xde14('0xa7'));_0xe3669c[_0xde14('0x4b')](_0xde14('0xa8'),_0xde14('0xa9'));_0xe3669c[_0xde14('0x4b')]('c.lastName',_0xde14('0xaa'));_0xe3669c[_0xde14('0x4b')](_0xde14('0xab'),_0xde14('0xac'));_0xe3669c[_0xde14('0x4b')](_0xde14('0xad'),_0xde14('0xae'));_0xe3669c[_0xde14('0x4b')]('c.mobile',_0xde14('0xaf'));_0xe3669c[_0xde14('0x4b')](_0xde14('0xb0'),_0xde14('0xb1'));_0xe3669c[_0xde14('0x4b')](_0xde14('0xb2'),_0xde14('0xb3'));_0xe3669c[_0xde14('0x4b')]('o.internal',_0xde14('0xb4'));_0xe3669c[_0xde14('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xde14('0x35'));}if(_0x1c7136[_0xde14('0x26')])_0xe3669c[_0xde14('0x26')](_0x1c7136[_0xde14('0x26')]);if(_0x1c7136[_0xde14('0x25')])_0xe3669c[_0xde14('0x25')](_0x1c7136[_0xde14('0x25')]);return db[_0xde14('0x9f')][_0xde14('0x3f')](_0xe3669c[_0xde14('0xa0')](),_0x103766);})[_0xde14('0x2c')](function(_0x27b9d9){_0x5a4475[_0xde14('0x7d')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x27b9d9,'id'));return db[_0xde14('0x9f')][_0xde14('0x3f')](_0x5a4475['toString'](),_0x103766)[_0xde14('0x2c')](function(_0x42d41f){var _0x33fd18=_[_0xde14('0xb5')](_0x42d41f,_0xde14('0xb6'));var _0x21e5ad=[];_0x27b9d9[_0xde14('0x36')](function(_0x3143c8){_0x21e5ad[_0xde14('0x38')](updateFaxInteraction(_0x3143c8,_0x102770,_0x33fd18));});return BPromise['all'](_0x21e5ad);});});})['then'](function(_0x324e4f){_0x20913d[_0xde14('0xb7')]=_0x324e4f;return _0x20913d;})['then'](respondWithFilteredResult(_0x50084f,_0x1c7136))[_0xde14('0x39')](handleError(_0x50084f,null));};exports[_0xde14('0xb8')]=function(_0x4eeb9d,_0x233116){var _0x39c243={'raw':![],'where':{'id':_0x4eeb9d[_0xde14('0xb9')]['id']}},_0x5dffdd={};_0x5dffdd['model']=_[_0xde14('0x40')](db[_0xde14('0x3b')][_0xde14('0x3c')]);_0x5dffdd[_0xde14('0x3f')]=_['keys'](_0x4eeb9d[_0xde14('0x3f')]);_0x5dffdd[_0xde14('0x41')]=_[_0xde14('0x42')](_0x5dffdd['model'],_0x5dffdd[_0xde14('0x3f')]);_0x39c243[_0xde14('0x44')]=_[_0xde14('0x42')](_0x5dffdd[_0xde14('0x43')],qs['fields'](_0x4eeb9d[_0xde14('0x3f')][_0xde14('0x45')]));_0x39c243['attributes']=_0x39c243[_0xde14('0x44')][_0xde14('0x46')]?_0x39c243[_0xde14('0x44')]:_0x5dffdd[_0xde14('0x43')];if(_0x4eeb9d[_0xde14('0x3f')][_0xde14('0xba')]){_0x39c243[_0xde14('0xbb')]=[{'all':!![]}];}_0x39c243=_[_0xde14('0xa2')]({},_0x39c243,_0x4eeb9d['options']);return db[_0xde14('0x3b')][_0xde14('0x6d')](_0x39c243)[_0xde14('0x2c')](handleEntityNotFound(_0x233116,null))[_0xde14('0x2c')](respondWithResult(_0x233116,null))['catch'](handleError(_0x233116,null));};exports['create']=function(_0x5717e0,_0x4e8a06){return db[_0xde14('0x3b')][_0xde14('0xbc')](_0x5717e0[_0xde14('0x79')],{})['then'](respondWithResult(_0x4e8a06,0xc9))['catch'](handleError(_0x4e8a06,null));};exports[_0xde14('0x2b')]=function(_0x4d519f,_0x560076){if(_0x4d519f['body']['id']){delete _0x4d519f['body']['id'];}return db[_0xde14('0x3b')]['find']({'where':{'id':_0x4d519f['params']['id']}})['then'](handleEntityNotFound(_0x560076,null))['then'](saveUpdates(_0x4d519f[_0xde14('0x79')],null))[_0xde14('0x2c')](respondWithResult(_0x560076,null))[_0xde14('0x39')](handleError(_0x560076,null));};exports[_0xde14('0x2d')]=function(_0x3a2d9c,_0x35dcce){return db['FaxInteraction'][_0xde14('0x6d')]({'where':{'id':_0x3a2d9c[_0xde14('0xb9')]['id']}})[_0xde14('0x2c')](handleEntityNotFound(_0x35dcce,null))[_0xde14('0x2c')](removeEntity(_0x35dcce,null))[_0xde14('0x39')](handleError(_0x35dcce,null));};exports[_0xde14('0xbd')]=function(_0x991f3d,_0x3a4f6d){return db[_0xde14('0x3b')][_0xde14('0xbd')]()[_0xde14('0x2c')](respondWithResult(_0x3a4f6d,null))[_0xde14('0x39')](handleError(_0x3a4f6d,null));};exports[_0xde14('0xbe')]=function(_0xf16def,_0x22ea84,_0x5b1473){return db[_0xde14('0xbf')][_0xde14('0x6d')]({'where':{'id':_0xf16def[_0xde14('0xb9')]['id']}})[_0xde14('0x2c')](handleEntityNotFound(_0x22ea84,null))[_0xde14('0x2c')](function(_0x25da1b){if(_0x25da1b){return _0x25da1b['addMessage'](_0xf16def[_0xde14('0x79')][_0xde14('0xc0')],_[_0xde14('0xc1')](_0xf16def[_0xde14('0x79')],['ids','id'])||{});}})['then'](respondWithResult(_0x22ea84,null))['catch'](handleError(_0x22ea84,null));};exports[_0xde14('0xc2')]=function(_0x9d563d,_0x375b05,_0x1cb7d2){var _0xd32b8e={'raw':![],'where':{}};var _0x37ad13={};var _0x14efc6={'count':0x0,'rows':[]};return db[_0xde14('0x3b')][_0xde14('0xc3')]({'where':{'id':_0x9d563d[_0xde14('0xb9')]['id']}})[_0xde14('0x2c')](handleEntityNotFound(_0x375b05,null))[_0xde14('0x2c')](function(_0x45d15a){if(_0x45d15a){_0x37ad13[_0xde14('0x43')]=_[_0xde14('0x40')](db[_0xde14('0xbf')][_0xde14('0x3c')]);_0x37ad13[_0xde14('0x3f')]=_['keys'](_0x9d563d[_0xde14('0x3f')]);_0x37ad13['filters']=_['intersection'](_0x37ad13['model'],_0x37ad13['query']);_0xd32b8e[_0xde14('0x44')]=_[_0xde14('0x42')](_0x37ad13['model'],qs[_0xde14('0x45')](_0x9d563d['query'][_0xde14('0x45')]));_0xd32b8e[_0xde14('0x44')]=_0xd32b8e['attributes'][_0xde14('0x46')]?_0xd32b8e[_0xde14('0x44')]:_0x37ad13[_0xde14('0x43')];if(!_0x9d563d[_0xde14('0x3f')][_0xde14('0x47')](_0xde14('0x48'))){_0xd32b8e[_0xde14('0x26')]=qs[_0xde14('0x26')](_0x9d563d[_0xde14('0x3f')][_0xde14('0x26')]);_0xd32b8e[_0xde14('0x25')]=qs[_0xde14('0x25')](_0x9d563d['query'][_0xde14('0x25')]);}_0xd32b8e['order']=qs[_0xde14('0x49')](_0x9d563d[_0xde14('0x3f')][_0xde14('0x49')]);_0xd32b8e['where']=qs[_0xde14('0x41')](_['pick'](_0x9d563d[_0xde14('0x3f')],_0x37ad13['filters']));_0xd32b8e[_0xde14('0x7d')][_0xde14('0xb6')]=_0x45d15a['id'];if(_0x9d563d[_0xde14('0x3f')]['filter']){_0xd32b8e['where']=_['merge'](_0xd32b8e[_0xde14('0x7d')],{'$or':_[_0xde14('0x33')](_0xd32b8e[_0xde14('0x44')],function(_0x29aed6){var _0x5952da={};_0x5952da[_0x29aed6]={'$like':'%'+_0x9d563d[_0xde14('0x3f')][_0xde14('0x8c')]+'%'};return _0x5952da;})});}if(_0x9d563d['query'][_0xde14('0x82')]){var _0x10698d=_0x9d563d[_0xde14('0x3f')][_0xde14('0x82')][_0xde14('0x69')](',');var _0x2535e3={};_0x2535e3[_0x10698d[0x0]]={'$gte':moment(_0x10698d[0x1])[_0xde14('0xc4')](_0xde14('0xc5'))};_0xd32b8e[_0xde14('0x7d')]=_[_0xde14('0xa2')](_0xd32b8e[_0xde14('0x7d')],_0x2535e3);}_0xd32b8e=_[_0xde14('0xa2')]({},_0xd32b8e,_0x9d563d['options']);return db[_0xde14('0xbf')]['count']({'where':_0xd32b8e[_0xde14('0x7d')]})[_0xde14('0x2c')](function(_0x58bfbc){_0x14efc6['count']=_0x58bfbc;if(_0x9d563d[_0xde14('0x3f')][_0xde14('0xba')]){_0xd32b8e[_0xde14('0xbb')]=[{'all':!![]}];}return db[_0xde14('0xbf')][_0xde14('0xc6')](_0xd32b8e);})[_0xde14('0x2c')](function(_0x16822b){_0x14efc6[_0xde14('0xb7')]=_0x16822b;return _0x14efc6;});}})['then'](respondWithFilteredResult(_0x375b05,_0xd32b8e))[_0xde14('0x39')](handleError(_0x375b05,null));};exports[_0xde14('0xc7')]=function(_0x287f22,_0x47333f,_0x13c0b1){return db['FaxInteraction'][_0xde14('0x6d')]({'where':{'id':_0x287f22[_0xde14('0xb9')]['id']}})[_0xde14('0x2c')](handleEntityNotFound(_0x47333f,null))[_0xde14('0x2c')](function(_0x2e4340){if(_0x2e4340){return _0x2e4340[_0xde14('0xc8')](_0x287f22[_0xde14('0x79')][_0xde14('0xc0')],_[_0xde14('0xc1')](_0x287f22[_0xde14('0x79')],[_0xde14('0xc0'),'id'])||{})['spread'](function(){return db[_0xde14('0x72')][_0xde14('0xc6')]({'attributes':['id','name','color'],'where':{'id':_0x287f22[_0xde14('0x79')][_0xde14('0xc0')]}});})[_0xde14('0x2c')](function(_0x3b0aa6){socket[_0xde14('0xc9')]('faxInteractionTags:save',{'id':Number(_0x287f22[_0xde14('0xb9')]['id']),'tags':_0x3b0aa6||[]});return{'id':Number(_0x287f22[_0xde14('0xb9')]['id']),'tags':_0x3b0aa6||[]};});}})[_0xde14('0x2c')](respondWithResult(_0x47333f,null))[_0xde14('0x39')](handleError(_0x47333f,null));};exports[_0xde14('0xca')]=function(_0x21679a,_0x2e0fde,_0x2872a5){return db[_0xde14('0x3b')][_0xde14('0x6d')]({'where':{'id':_0x21679a[_0xde14('0xb9')]['id']}})[_0xde14('0x2c')](handleEntityNotFound(_0x2e0fde,null))[_0xde14('0x2c')](function(_0x3ad07f){if(_0x3ad07f){return _0x3ad07f[_0xde14('0xca')](_0x21679a[_0xde14('0x3f')][_0xde14('0xc0')]);}})[_0xde14('0x2c')](respondWithStatusCode(_0x2e0fde,null))['catch'](handleError(_0x2e0fde,null));};exports['download']=function(_0x3a880f,_0x3937b8){var _0x4ed696=moment()[_0xde14('0xcb')]()['toString']();var _0x593e49=path[_0xde14('0xcc')](config['root'],_0xde14('0xcd'),_0xde14('0xce'),_0xde14('0xcf'));var _0x40caec=path['join'](config[_0xde14('0xd0')],_0xde14('0xcd'),'files','attachments');var _0x4c697c=path[_0xde14('0xcc')](_0x593e49,_0x4ed696);var _0x4da460=util[_0xde14('0xc4')]('transcript-%d-%s.zip',_0x3a880f[_0xde14('0xb9')]['id'],_0x4ed696);var _0x1e3bd8=path['join'](_0x593e49,_0x4da460);var _0x42d67f=[];_0x42d67f['push']({'model':db[_0xde14('0xd1')],'as':'Attachment','raw':!![]});var _0x34dd17=[{'model':db[_0xde14('0xbf')],'as':_0xde14('0xd2'),'attributes':['id','body',_0xde14('0x80')],'include':_0x42d67f}];return db[_0xde14('0x3b')][_0xde14('0x6d')]({'where':{'id':_0x3a880f['params']['id']},'include':_0x34dd17})[_0xde14('0x2c')](handleEntityNotFound(_0x3937b8,null))['then'](function(_0xcb4fe6){if(_0xcb4fe6&&_0xcb4fe6[_0xde14('0xd2')]){var _0x4cca9d=_0xcb4fe6[_0xde14('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x4c697c);for(var _0x2f65fe=0x0;_0x2f65fe<_0x4cca9d[_0xde14('0xd2')][_0xde14('0x46')];_0x2f65fe++){var _0x356a6c=_0x4cca9d[_0xde14('0xd2')][_0x2f65fe][_0xde14('0xd1')];if(_0x356a6c){var _0x19a4cc=path[_0xde14('0xcc')](_0x40caec,_0x356a6c[_0xde14('0xd4')]);if(fs[_0xde14('0xd5')](_0x19a4cc)){fs['createReadStream'](_0x19a4cc)[_0xde14('0xd6')](fs[_0xde14('0xd7')](path[_0xde14('0xcc')](_0x4c697c,_0x356a6c[_0xde14('0xd4')])));}}}return BPromise[_0xde14('0x98')]()[_0xde14('0x2c')](function(){return new BPromise(function(_0x4b9969,_0x213972){zipdir(_0x4c697c,{'saveTo':_0x1e3bd8},function(_0x1201e0,_0x24d95d){if(_0x1201e0)return _0x213972(_0x1201e0);return _0x4b9969(_0x24d95d);});})[_0xde14('0x2c')](function(){return new BPromise(function(_0x5228b9,_0x1cf3d7){rimraf(_0x4c697c,function(_0x3fb69c){if(_0x3fb69c)_0x1cf3d7(_0x3fb69c);return _0x5228b9();});});})[_0xde14('0x2c')](function(){return _0x3937b8[_0xde14('0xd8')](_0x1e3bd8,_0x4da460,function(_0xb68808){if(_0xb68808){console[_0xde14('0xd9')](_0xde14('0xda'),_0xb68808);}else{fs['unlinkSync'](_0x1e3bd8);}});});});}else{return _0x3937b8['sendStatus'](0xc8);}})['catch'](handleError(_0x3937b8,null));}; \ No newline at end of file +var _0x668b=['parse','$gte','$lte','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','show','rawAttributes','options','create','body','params','addMessage','ids','getMessages','findOne','FaxMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','addTags','setTags','omit','spread','findAll','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','stack','name','Users','map','fullname','Tags','TagIds','split','forEach','push','index','FaxInteraction','key','model','keys','intersection','fields','query','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','from','tools_tags','select','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0x668b,0x140));var _0xb668=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0x668b[_0x21c6b8];return _0x39d474;};'use strict';var pdf=require(_0xb668('0x0'));var emlformat=require(_0xb668('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb668('0x2'));var jsonpatch=require(_0xb668('0x3'));var rp=require('request-promise');var moment=require(_0xb668('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb668('0x5'));var util=require(_0xb668('0x6'));var path=require(_0xb668('0x7'));var sox=require('sox');var csv=require(_0xb668('0x8'));var ejs=require(_0xb668('0x9'));var fs=require('fs');var _=require(_0xb668('0xa'));var squel=require(_0xb668('0xb'));var crypto=require(_0xb668('0xc'));var jsforce=require(_0xb668('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb668('0x8'));var querystring=require(_0xb668('0xe'));var Papa=require(_0xb668('0xf'));var Redis=require(_0xb668('0x10'));var authService=require(_0xb668('0x11'));var qs=require(_0xb668('0x12'));var as=require(_0xb668('0x13'));var hardwareService=require(_0xb668('0x14'));var logger=require('../../config/logger')(_0xb668('0x15'));var utils=require(_0xb668('0x16'));var config=require(_0xb668('0x17'));var licenseUtil=require(_0xb668('0x18'));var db=require(_0xb668('0x19'))['db'];config[_0xb668('0x1a')]=_[_0xb668('0x1b')](config[_0xb668('0x1a')],{'host':_0xb668('0x1c'),'port':0x18eb});var socket=require(_0xb668('0x1d'))(new Redis(config[_0xb668('0x1a')]));require(_0xb668('0x1e'))[_0xb668('0x1f')](socket);function respondWithStatusCode(_0xd0450f,_0x2ec706){_0x2ec706=_0x2ec706||0xcc;return function(_0x3b0c84){if(_0x3b0c84){return _0xd0450f[_0xb668('0x20')](_0x2ec706);}return _0xd0450f[_0xb668('0x21')](_0x2ec706)[_0xb668('0x22')]();};}function respondWithResult(_0x4a755b,_0xd3e39f){_0xd3e39f=_0xd3e39f||0xc8;return function(_0x27bbfa){if(_0x27bbfa){return _0x4a755b['status'](_0xd3e39f)[_0xb668('0x23')](_0x27bbfa);}};}function respondWithFilteredResult(_0x567ad7,_0x30742a){return function(_0x89fe72){if(_0x89fe72){var _0x5438ff=_0x89fe72[_0xb668('0x24')],_0x38595d=_0x30742a['offset'],_0x18e9c1=_0x30742a[_0xb668('0x25')]+_0x30742a[_0xb668('0x26')],_0x53ff78;if(_0x18e9c1>=_0x5438ff){_0x18e9c1=_0x5438ff;_0x53ff78=0xc8;}else{_0x53ff78=0xce;}_0x567ad7[_0xb668('0x21')](_0x53ff78);return _0x567ad7[_0xb668('0x27')]('Content-Range',_0x38595d+'-'+_0x18e9c1+'/'+_0x5438ff)[_0xb668('0x23')](_0x89fe72);}return null;};}function patchUpdates(_0xfe4595){return function(_0x25e5be){try{jsonpatch['apply'](_0x25e5be,_0xfe4595,!![]);}catch(_0x5a2f74){return BPromise[_0xb668('0x28')](_0x5a2f74);}return _0x25e5be[_0xb668('0x29')]();};}function saveUpdates(_0x517eee,_0x61de4a){return function(_0x4bf863){if(_0x4bf863){return _0x4bf863[_0xb668('0x2a')](_0x517eee)['then'](function(_0x3f4745){return _0x3f4745;});}return null;};}function removeEntity(_0x1e1c94,_0x3f84c7){return function(_0x3231b2){if(_0x3231b2){return _0x3231b2[_0xb668('0x2b')]()[_0xb668('0x2c')](function(){_0x1e1c94['status'](0xcc)[_0xb668('0x22')]();});}};}function handleEntityNotFound(_0x10d767,_0x2ab8c2){return function(_0x49abfd){if(!_0x49abfd){_0x10d767['sendStatus'](0x194);}return _0x49abfd;};}function handleError(_0xe62fce,_0x2a826d){_0x2a826d=_0x2a826d||0x1f4;return function(_0x30b965){logger['error'](_0x30b965[_0xb668('0x2d')]);if(_0x30b965[_0xb668('0x2e')]){delete _0x30b965[_0xb668('0x2e')];}_0xe62fce['status'](_0x2a826d)['send'](_0x30b965);};}function getInteractionUsers(_0x12919c,_0x2619a4){return new BPromise(function(_0x589c58,_0x2e5857){try{if(_0x2619a4[_0x12919c['id']]){_0x12919c[_0xb668('0x2f')]=_[_0xb668('0x30')](_0x2619a4[_0x12919c['id']],function(_0x19a1dc){return{'id':_0x19a1dc['id'],'fullname':_0x19a1dc[_0xb668('0x31')]};});}}catch(_0x5f36b5){_0x2e5857(_0x5f36b5);}_0x589c58(_0x12919c);});}function getInteractionTags(_0x138ee5,_0x3bd27c){return new BPromise(function(_0x5dfa2c,_0x28bcdd){try{if(_0x138ee5['TagIds']){_0x138ee5[_0xb668('0x32')]=[];_0x138ee5[_0xb668('0x33')][_0xb668('0x34')](',')[_0xb668('0x35')](function(_0x2e40dd){_0x138ee5[_0xb668('0x32')][_0xb668('0x36')](_0x3bd27c[_0x2e40dd]);});}delete _0x138ee5[_0xb668('0x33')];}catch(_0xadeb63){_0x28bcdd(_0xadeb63);}_0x5dfa2c(_0x138ee5);});}function updateFaxInteraction(_0x4ae272,_0x277f95,_0x13bc2b){return new BPromise(function(_0x1483ba,_0x4dd83e){return getInteractionUsers(_0x4ae272,_0x13bc2b)[_0xb668('0x2c')](function(_0x203ea0){return getInteractionTags(_0x203ea0,_0x277f95);})[_0xb668('0x2c')](function(_0x68d980){_0x1483ba(_0x68d980);})['catch'](function(_0xb989a3){_0x4dd83e(_0xb989a3);});});}exports[_0xb668('0x37')]=function(_0x3cb3a1,_0x2f6edb){var _0x34e0d6={},_0xe10c43={},_0x304311={'count':0x0,'rows':[]};var _0x5a9134=_[_0xb668('0x30')](db[_0xb668('0x38')]['rawAttributes'],function(_0xede795){return{'name':_0xede795['fieldName'],'type':_0xede795['type'][_0xb668('0x39')]};});_0xe10c43[_0xb668('0x3a')]=_['map'](_0x5a9134,_0xb668('0x2e'));_0xe10c43['query']=_[_0xb668('0x3b')](_0x3cb3a1['query']);_0xe10c43['filters']=_[_0xb668('0x3c')](_0xe10c43[_0xb668('0x3a')],_0xe10c43['query']);_0x34e0d6['attributes']=_[_0xb668('0x3c')](_0xe10c43[_0xb668('0x3a')],qs[_0xb668('0x3d')](_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x3d')]));_0x34e0d6['attributes']=_0x34e0d6['attributes'][_0xb668('0x3f')]?_0x34e0d6[_0xb668('0x40')]:_0xe10c43[_0xb668('0x3a')];if(!_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x41')](_0xb668('0x42'))){_0x34e0d6['limit']=qs['limit'](_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x26')]);_0x34e0d6[_0xb668('0x25')]=qs[_0xb668('0x25')](_0x3cb3a1[_0xb668('0x3e')]['offset']);}_0x34e0d6[_0xb668('0x43')]=qs[_0xb668('0x44')](_0x3cb3a1['query'][_0xb668('0x44')]);_0x34e0d6[_0xb668('0x45')]=qs[_0xb668('0x46')](_[_0xb668('0x47')](_0x3cb3a1['query'],_0xe10c43['filters']),_0x5a9134);var _0x4b7192=[];var _0x311c59=squel['select']()['field']('id')['field']('name')[_0xb668('0x48')]('color')[_0xb668('0x49')](_0xb668('0x4a'));var _0x30f4bb=squel[_0xb668('0x4b')]()[_0xb668('0x48')]('u.id')[_0xb668('0x48')](_0xb668('0x4c'))[_0xb668('0x48')](_0xb668('0x4d'))[_0xb668('0x49')](_0xb668('0x4e'),'ui')[_0xb668('0x4f')](_0xb668('0x50'),'u',_0xb668('0x51'));var _0x3c8a3e=squel[_0xb668('0x4b')]()['from'](_0xb668('0x52'),'i')[_0xb668('0x4f')](_0xb668('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xb668('0x50'),'o','o.id\x20=\x20i.UserId')[_0xb668('0x4f')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0xb668('0x54'),'me',_0xb668('0x55'))['left_join'](_0xb668('0x56'),'it',_0xb668('0x57'))[_0xb668('0x4f')](_0xb668('0x4a'),'t',_0xb668('0x58'));var _0x36926a=squel[_0xb668('0x59')]();var _0x6fb5f1=[];var _0x207eed=squel[_0xb668('0x59')]();var _0x4e0628;if(_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x5a')]){_0x4e0628=as[_0xb668('0x5b')](_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x5a')]);var _0x3da9ba=_0x4e0628[_0xb668('0x5c')];for(var _0x1bff79=0x0;_0x1bff79<_0x4e0628[_0xb668('0x5d')]['length'];_0x1bff79++){var _0x1c36df=_0x4e0628[_0xb668('0x5d')][_0x1bff79];var _0x2e906d='i';var _0x4c9eab=_['find'](_0x5a9134,[_0xb668('0x2e'),_0x1c36df[_0xb668('0x48')]]);if(!_0x4c9eab){switch(_0x1c36df[_0xb668('0x48')]){case'unreadMessages':if(_0x1c36df[_0xb668('0x5e')]==0x1){_0x3c8a3e['having']('`'+_0x1c36df['field']+_0xb668('0x5f'));}else{_0x3c8a3e[_0xb668('0x60')]('`'+_0x1c36df[_0xb668('0x48')]+_0xb668('0x61'));}break;case _0xb668('0x62'):if(_0x1c36df[_0xb668('0x63')]===_0xb668('0x64')){if(_0x1c36df[_0xb668('0x5e')][_0xb668('0x34')]('\x20')[_0xb668('0x3f')]>0x1){_0x36926a[_0x3da9ba](_0xb668('0x65'),qs[_0xb668('0x66')](_0x1c36df[_0xb668('0x5e')]),null);}else{var _0x41750e='%'+_0x1c36df[_0xb668('0x5e')]+'%';_0x36926a[_0x3da9ba](_0xb668('0x67'),_0x41750e,_0x41750e,_0x41750e);}}else{_0x4c9eab=_[_0xb668('0x68')](_0x5a9134,[_0xb668('0x2e'),_0xb668('0x69')]);_0x1c36df[_0xb668('0x48')]=_0xb668('0x69');_0x10e2bf=as[_0xb668('0x6a')](_0x2e906d,_0x4c9eab[_0xb668('0x6b')],_0x1c36df);_0x36926a[_0x3da9ba](_0x10e2bf[_0xb668('0x6c')],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x6d')],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x22')]);}break;case _0xb668('0x6e'):var _0x262976=_0x1c36df['value'][_0xb668('0x34')](',')[_0xb668('0x30')](function(_0x5ec04e){return Number(_0x5ec04e);});_0x262976[_0xb668('0x35')](function(_0x416d73){_0x207eed['or'](_0xb668('0x6f'),'%,'+_0x416d73+',%');});_0x6fb5f1=_[_0xb668('0x70')](_0x6fb5f1,_0x262976);break;case _0xb668('0x71'):if(_0x1c36df[_0xb668('0x63')]===_0xb668('0x64')){_0x36926a[_0x3da9ba](_0xb668('0x72'),'%'+_0x1c36df[_0xb668('0x5e')]+'%',null);}else{_0x4c9eab=_[_0xb668('0x68')](_0x5a9134,['name',_0xb668('0x73')]);_0x1c36df[_0xb668('0x48')]='UserId';_0x10e2bf=as[_0xb668('0x6a')](_0x2e906d,_0x4c9eab[_0xb668('0x6b')],_0x1c36df);_0x36926a[_0x3da9ba](_0x10e2bf['text'],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x6d')],_0x10e2bf['value'][_0xb668('0x22')]);}break;case'body':_0x10e2bf=as[_0xb668('0x6a')]('me',null,_0x1c36df);_0x36926a[_0x3da9ba](_0x10e2bf[_0xb668('0x6c')],_0x10e2bf['value'][_0xb668('0x6d')],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x22')]);break;}}else{var _0x10e2bf=as[_0xb668('0x6a')](_0x2e906d,_0x4c9eab[_0xb668('0x6b')],_0x1c36df);_0x36926a[_0x3da9ba](_0x10e2bf[_0xb668('0x6c')],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x6d')],_0x10e2bf['value'][_0xb668('0x22')]);}}}else{var _0x440d30=_(_0x3cb3a1[_0xb668('0x3e')])[_0xb668('0x3b')]()[_0xb668('0x30')](function(_0x51fcc6){return _[_0xb668('0x74')](_0x5a9134,[_0xb668('0x2e'),_0x51fcc6])?_0x51fcc6:undefined;})[_0xb668('0x75')]()['value']();if(!_[_0xb668('0x76')](_0x440d30)){_0x440d30[_0xb668('0x35')](function(_0x409c8b){if(_0x409c8b===_0xb668('0x77')){_0x3c8a3e['where'](_0xb668('0x78'),[][_0xb668('0x79')](_0x3cb3a1[_0xb668('0x3e')][_0x409c8b]));}else if(_0x409c8b==='createdAt'){var _0xfaafb5=JSON[_0xb668('0x7a')](_0x3cb3a1[_0xb668('0x3e')][_0x409c8b])[_0xb668('0x7b')];var _0x2bf503=JSON[_0xb668('0x7a')](_0x3cb3a1[_0xb668('0x3e')][_0x409c8b])[_0xb668('0x7c')];_0x3c8a3e[_0xb668('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xfaafb5,_0x2bf503);}else{if(_0x3cb3a1[_0xb668('0x3e')][_0x409c8b]==='null'){_0x3c8a3e[_0xb668('0x45')]('i.'+_0x409c8b+'\x20IS\x20NULL');}else{_0x3c8a3e[_0xb668('0x45')]('i.'+_0x409c8b+_0xb668('0x7d'),_0x3cb3a1[_0xb668('0x3e')][_0x409c8b]);}}});}if(_0x3cb3a1['query'][_0xb668('0x7e')]){if(_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x7e')]==0x1){_0x3c8a3e[_0xb668('0x60')](_0xb668('0x7f'));}else{_0x3c8a3e[_0xb668('0x60')](_0xb668('0x80'));}}if(_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x81')]){_0x6fb5f1=_[_0xb668('0x82')](_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x81')])?_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x81')]:new Array(_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x81')]);_0x6fb5f1[_0xb668('0x35')](function(_0x4260a9){_0x207eed['or'](_0xb668('0x6f'),'%,'+_0x4260a9+',%');});}if(_0x3cb3a1[_0xb668('0x3e')]['filter']){var _0x37a567=_0x3cb3a1[_0xb668('0x3e')]['filter'][_0xb668('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb668('0x84')](_0x37a567)){_0x36926a['or'](_0xb668('0x85'),_0x37a567+'%')['or']('i.fax\x20LIKE\x20?',_0x37a567+'%');}_0x36926a['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x37a567+'%');}}_0x3c8a3e[_0xb668('0x45')](_0x36926a);_0x3c8a3e[_0xb668('0x86')](_0xb668('0x87'));var _0x486fbd={'type':db[_0xb668('0x88')][_0xb668('0x89')][_0xb668('0x8a')],'raw':!![]};var _0x4f1712=_0x3c8a3e[_0xb668('0x8b')]();_0x4f1712[_0xb668('0x48')](_0xb668('0x87'));_0x4f1712[_0xb668('0x48')](_0xb668('0x8c'),_0xb668('0x8d'));if(_0x34e0d6[_0xb668('0x43')]){_0x34e0d6[_0xb668('0x43')][_0xb668('0x35')](function(_0x209184){var _0x2596d6=_0x209184[0x0]==='contactName'?_0x209184[0x0]:'i.'+_0x209184[0x0];_0x3c8a3e[_0xb668('0x43')](_0x2596d6,_0x209184[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x6fb5f1)){_0x3c8a3e[_0xb668('0x60')](_0x207eed);_0x4f1712[_0xb668('0x45')](_0xb668('0x8e'),_0x6fb5f1);}BPromise[_0xb668('0x8f')]()['then'](function(){if(!_0x4e0628){if(_0x3cb3a1[_0xb668('0x3e')]['FaxAccountId']||_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x90')])return;_0x4f1712[_0xb668('0x45')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3c8a3e[_0xb668('0x45')](_0xb668('0x91'));return;}if(_0x3cb3a1[_0xb668('0x92')]['role']!==_0xb668('0x93'))return;return _0x3cb3a1[_0xb668('0x92')][_0xb668('0x94')]({'attributes':['id'],'raw':!![]})[_0xb668('0x2c')](function(_0x57e479){if(_[_0xb668('0x76')](_0x57e479)){_0x4f1712[_0xb668('0x45')]('i.FaxAccountId\x20IS\x20NULL');_0x3c8a3e[_0xb668('0x45')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4f1712[_0xb668('0x45')](_0xb668('0x78'),_[_0xb668('0x30')](_0x57e479,'id'));_0x3c8a3e[_0xb668('0x45')](_0xb668('0x78'),_['map'](_0x57e479,'id'));}});})['then'](function(){if(_0x3cb3a1[_0xb668('0x92')][_0xb668('0x95')]===_0xb668('0x93')&&!_0x4e0628&&!_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x77')])return[];return db[_0xb668('0x96')][_0xb668('0x3e')](_0x4f1712[_0xb668('0x97')](),_0x486fbd);})[_0xb668('0x2c')](function(_0x2bcea0){_0x304311[_0xb668('0x24')]=_0x2bcea0['length'];if(_0x304311[_0xb668('0x24')]===0x0)return[];return db[_0xb668('0x96')]['query'](_0x311c59[_0xb668('0x97')](),_0x486fbd)[_0xb668('0x2c')](function(_0x1ddfd1){_0x4b7192=_[_0xb668('0x98')](_0x1ddfd1,'id');_0x486fbd=_[_0xb668('0x99')](_0x486fbd,{'model':db[_0xb668('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3cb3a1[_0xb668('0x3e')]['fields']){_0x34e0d6[_0xb668('0x40')]['forEach'](function(_0x2f599d){_0x3c8a3e[_0xb668('0x48')]('i.'+_0x2f599d);});}else{_0x3c8a3e[_0xb668('0x48')](_0xb668('0x8c'),_0xb668('0x8d'));_0x3c8a3e['field'](_0xb668('0x9a'),_0xb668('0x9b'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0x9c'),_0xb668('0x9d'));_0x3c8a3e[_0xb668('0x48')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb668('0x9e'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0x9f'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa0'),_0xb668('0xa1'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa2'),'Contact.lastName');_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa3'),_0xb668('0xa4'));_0x3c8a3e['field'](_0xb668('0xa5'),'Contact.phone');_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa6'),_0xb668('0xa7'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa8'),_0xb668('0xa9'));_0x3c8a3e[_0xb668('0x48')]('o.fullname','Owner.fullname');_0x3c8a3e[_0xb668('0x48')](_0xb668('0xaa'),_0xb668('0xab'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0xac'),_0xb668('0x33'));}if(_0x34e0d6[_0xb668('0x26')])_0x3c8a3e[_0xb668('0x26')](_0x34e0d6[_0xb668('0x26')]);if(_0x34e0d6[_0xb668('0x25')])_0x3c8a3e[_0xb668('0x25')](_0x34e0d6[_0xb668('0x25')]);return db[_0xb668('0x96')]['query'](_0x3c8a3e[_0xb668('0x97')](),_0x486fbd);})[_0xb668('0x2c')](function(_0x318c4e){_0x30f4bb[_0xb668('0x45')](_0xb668('0xad'),_[_0xb668('0x30')](_0x318c4e,'id'));return db[_0xb668('0x96')][_0xb668('0x3e')](_0x30f4bb['toString'](),_0x486fbd)[_0xb668('0x2c')](function(_0x4c36e5){var _0x52fc01=_[_0xb668('0xae')](_0x4c36e5,_0xb668('0xaf'));var _0x48f897=[];_0x318c4e[_0xb668('0x35')](function(_0x5e05de){_0x48f897[_0xb668('0x36')](updateFaxInteraction(_0x5e05de,_0x4b7192,_0x52fc01));});return BPromise[_0xb668('0xb0')](_0x48f897);});});})[_0xb668('0x2c')](function(_0x4e061e){_0x304311[_0xb668('0xb1')]=_0x4e061e;return _0x304311;})[_0xb668('0x2c')](respondWithFilteredResult(_0x2f6edb,_0x34e0d6))[_0xb668('0xb2')](handleError(_0x2f6edb,null));};exports[_0xb668('0xb3')]=function(_0x57eb41,_0x4c49ee){var _0x1b8d19={'raw':![],'where':{'id':_0x57eb41['params']['id']}},_0xd14e7f={};_0xd14e7f[_0xb668('0x3a')]=_['keys'](db[_0xb668('0x38')][_0xb668('0xb4')]);_0xd14e7f[_0xb668('0x3e')]=_[_0xb668('0x3b')](_0x57eb41['query']);_0xd14e7f['filters']=_[_0xb668('0x3c')](_0xd14e7f[_0xb668('0x3a')],_0xd14e7f[_0xb668('0x3e')]);_0x1b8d19['attributes']=_[_0xb668('0x3c')](_0xd14e7f[_0xb668('0x3a')],qs[_0xb668('0x3d')](_0x57eb41['query'][_0xb668('0x3d')]));_0x1b8d19['attributes']=_0x1b8d19[_0xb668('0x40')][_0xb668('0x3f')]?_0x1b8d19[_0xb668('0x40')]:_0xd14e7f[_0xb668('0x3a')];if(_0x57eb41[_0xb668('0x3e')]['includeAll']){_0x1b8d19['include']=[{'all':!![]}];}_0x1b8d19=_[_0xb668('0x99')]({},_0x1b8d19,_0x57eb41[_0xb668('0xb5')]);return db[_0xb668('0x38')][_0xb668('0x68')](_0x1b8d19)['then'](handleEntityNotFound(_0x4c49ee,null))['then'](respondWithResult(_0x4c49ee,null))[_0xb668('0xb2')](handleError(_0x4c49ee,null));};exports[_0xb668('0xb6')]=function(_0x4e6d34,_0x229583){return db[_0xb668('0x38')][_0xb668('0xb6')](_0x4e6d34[_0xb668('0xb7')],{})[_0xb668('0x2c')](respondWithResult(_0x229583,0xc9))[_0xb668('0xb2')](handleError(_0x229583,null));};exports[_0xb668('0x2a')]=function(_0x11c949,_0x206546){if(_0x11c949[_0xb668('0xb7')]['id']){delete _0x11c949['body']['id'];}return db[_0xb668('0x38')][_0xb668('0x68')]({'where':{'id':_0x11c949[_0xb668('0xb8')]['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x206546,null))[_0xb668('0x2c')](saveUpdates(_0x11c949[_0xb668('0xb7')],null))[_0xb668('0x2c')](respondWithResult(_0x206546,null))[_0xb668('0xb2')](handleError(_0x206546,null));};exports[_0xb668('0x2b')]=function(_0x1bbbad,_0x54eef6){return db[_0xb668('0x38')][_0xb668('0x68')]({'where':{'id':_0x1bbbad['params']['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x54eef6,null))[_0xb668('0x2c')](removeEntity(_0x54eef6,null))[_0xb668('0xb2')](handleError(_0x54eef6,null));};exports['describe']=function(_0x1fa9f1,_0x30dbdb){return db['FaxInteraction']['describe']()[_0xb668('0x2c')](respondWithResult(_0x30dbdb,null))[_0xb668('0xb2')](handleError(_0x30dbdb,null));};exports['addMessage']=function(_0x254f3b,_0x5507f9,_0x1a05b8){return db['FaxMessage'][_0xb668('0x68')]({'where':{'id':_0x254f3b[_0xb668('0xb8')]['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x5507f9,null))[_0xb668('0x2c')](function(_0x47bf24){if(_0x47bf24){return _0x47bf24[_0xb668('0xb9')](_0x254f3b[_0xb668('0xb7')][_0xb668('0xba')],_['omit'](_0x254f3b['body'],[_0xb668('0xba'),'id'])||{});}})[_0xb668('0x2c')](respondWithResult(_0x5507f9,null))[_0xb668('0xb2')](handleError(_0x5507f9,null));};exports[_0xb668('0xbb')]=function(_0x4cb72d,_0xbfd89d,_0x2b9b93){var _0xaa6842={'raw':![],'where':{}};var _0x578d8c={};var _0x28692b={'count':0x0,'rows':[]};return db[_0xb668('0x38')][_0xb668('0xbc')]({'where':{'id':_0x4cb72d['params']['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0xbfd89d,null))[_0xb668('0x2c')](function(_0x3c39dc){if(_0x3c39dc){_0x578d8c[_0xb668('0x3a')]=_[_0xb668('0x3b')](db[_0xb668('0xbd')][_0xb668('0xb4')]);_0x578d8c[_0xb668('0x3e')]=_[_0xb668('0x3b')](_0x4cb72d['query']);_0x578d8c[_0xb668('0x46')]=_['intersection'](_0x578d8c[_0xb668('0x3a')],_0x578d8c['query']);_0xaa6842[_0xb668('0x40')]=_[_0xb668('0x3c')](_0x578d8c[_0xb668('0x3a')],qs[_0xb668('0x3d')](_0x4cb72d[_0xb668('0x3e')][_0xb668('0x3d')]));_0xaa6842[_0xb668('0x40')]=_0xaa6842[_0xb668('0x40')][_0xb668('0x3f')]?_0xaa6842['attributes']:_0x578d8c[_0xb668('0x3a')];if(!_0x4cb72d[_0xb668('0x3e')]['hasOwnProperty'](_0xb668('0x42'))){_0xaa6842['limit']=qs[_0xb668('0x26')](_0x4cb72d[_0xb668('0x3e')][_0xb668('0x26')]);_0xaa6842['offset']=qs[_0xb668('0x25')](_0x4cb72d[_0xb668('0x3e')][_0xb668('0x25')]);}_0xaa6842['order']=qs['sort'](_0x4cb72d[_0xb668('0x3e')][_0xb668('0x44')]);_0xaa6842[_0xb668('0x45')]=qs[_0xb668('0x46')](_[_0xb668('0x47')](_0x4cb72d[_0xb668('0x3e')],_0x578d8c[_0xb668('0x46')]));_0xaa6842[_0xb668('0x45')]['FaxInteractionId']=_0x3c39dc['id'];if(_0x4cb72d[_0xb668('0x3e')][_0xb668('0xbe')]){_0xaa6842[_0xb668('0x45')]=_[_0xb668('0x99')](_0xaa6842['where'],{'$or':_['map'](_0xaa6842[_0xb668('0x40')],function(_0xfa552c){var _0x2b100f={};_0x2b100f[_0xfa552c]={'$like':'%'+_0x4cb72d['query'][_0xb668('0xbe')]+'%'};return _0x2b100f;})});}if(_0x4cb72d[_0xb668('0x3e')][_0xb668('0x7b')]){var _0x5dc0fc=_0x4cb72d[_0xb668('0x3e')][_0xb668('0x7b')][_0xb668('0x34')](',');var _0x1fc825={};_0x1fc825[_0x5dc0fc[0x0]]={'$gte':moment(_0x5dc0fc[0x1])[_0xb668('0xbf')](_0xb668('0xc0'))};_0xaa6842[_0xb668('0x45')]=_[_0xb668('0x99')](_0xaa6842[_0xb668('0x45')],_0x1fc825);}_0xaa6842=_[_0xb668('0x99')]({},_0xaa6842,_0x4cb72d[_0xb668('0xb5')]);return db[_0xb668('0xbd')][_0xb668('0x24')]({'where':_0xaa6842[_0xb668('0x45')]})[_0xb668('0x2c')](function(_0x3ad326){_0x28692b[_0xb668('0x24')]=_0x3ad326;if(_0x4cb72d[_0xb668('0x3e')][_0xb668('0xc1')]){_0xaa6842[_0xb668('0xc2')]=[{'all':!![]}];}return db[_0xb668('0xbd')]['findAll'](_0xaa6842);})['then'](function(_0x5bc068){_0x28692b[_0xb668('0xb1')]=_0x5bc068;return _0x28692b;});}})[_0xb668('0x2c')](respondWithFilteredResult(_0xbfd89d,_0xaa6842))[_0xb668('0xb2')](handleError(_0xbfd89d,null));};exports[_0xb668('0xc3')]=function(_0x19b6bf,_0x56f9dc,_0x300c2d){return db[_0xb668('0x38')][_0xb668('0x68')]({'where':{'id':_0x19b6bf[_0xb668('0xb8')]['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x56f9dc,null))[_0xb668('0x2c')](function(_0x36bd15){if(_0x36bd15){return _0x36bd15[_0xb668('0xc4')](_0x19b6bf[_0xb668('0xb7')][_0xb668('0xba')],_[_0xb668('0xc5')](_0x19b6bf[_0xb668('0xb7')],[_0xb668('0xba'),'id'])||{})[_0xb668('0xc6')](function(){return db['Tag'][_0xb668('0xc7')]({'attributes':['id',_0xb668('0x2e'),'color'],'where':{'id':_0x19b6bf[_0xb668('0xb7')]['ids']}});})[_0xb668('0x2c')](function(_0x575f0b){socket[_0xb668('0xc8')](_0xb668('0xc9'),{'id':Number(_0x19b6bf[_0xb668('0xb8')]['id']),'tags':_0x575f0b||[]});return{'id':Number(_0x19b6bf[_0xb668('0xb8')]['id']),'tags':_0x575f0b||[]};});}})[_0xb668('0x2c')](respondWithResult(_0x56f9dc,null))[_0xb668('0xb2')](handleError(_0x56f9dc,null));};exports[_0xb668('0xca')]=function(_0x304e6c,_0x5a4fb7,_0x26ccbb){return db['FaxInteraction'][_0xb668('0x68')]({'where':{'id':_0x304e6c[_0xb668('0xb8')]['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x5a4fb7,null))[_0xb668('0x2c')](function(_0x42a8c7){if(_0x42a8c7){return _0x42a8c7[_0xb668('0xca')](_0x304e6c['query'][_0xb668('0xba')]);}})['then'](respondWithStatusCode(_0x5a4fb7,null))[_0xb668('0xb2')](handleError(_0x5a4fb7,null));};exports[_0xb668('0xcb')]=function(_0x3a0ffe,_0x103031){var _0x11bcde=moment()[_0xb668('0xcc')]()['toString']();var _0x3dc283=path[_0xb668('0xcd')](config[_0xb668('0xce')],_0xb668('0xcf'),_0xb668('0xd0'),'tmp');var _0x32b1f8=path[_0xb668('0xcd')](config['root'],_0xb668('0xcf'),_0xb668('0xd0'),_0xb668('0xd1'));var _0x80faf3=path[_0xb668('0xcd')](_0x3dc283,_0x11bcde);var _0xf0c5d8=util[_0xb668('0xbf')](_0xb668('0xd2'),_0x3a0ffe[_0xb668('0xb8')]['id'],_0x11bcde);var _0x1ee2c4=path[_0xb668('0xcd')](_0x3dc283,_0xf0c5d8);var _0x36727=[];_0x36727[_0xb668('0x36')]({'model':db[_0xb668('0xd3')],'as':_0xb668('0xd3'),'raw':!![]});var _0x1a63f6=[{'model':db[_0xb668('0xbd')],'as':_0xb668('0xd4'),'attributes':['id',_0xb668('0xb7'),'createdAt'],'include':_0x36727}];return db[_0xb668('0x38')][_0xb668('0x68')]({'where':{'id':_0x3a0ffe[_0xb668('0xb8')]['id']},'include':_0x1a63f6})['then'](handleEntityNotFound(_0x103031,null))[_0xb668('0x2c')](function(_0x1e45e1){if(_0x1e45e1&&_0x1e45e1['Messages']){var _0x5f4484=_0x1e45e1[_0xb668('0xd5')]({'plain':!![]});fs['mkdirSync'](_0x80faf3);for(var _0x569d78=0x0;_0x569d78<_0x5f4484[_0xb668('0xd4')][_0xb668('0x3f')];_0x569d78++){var _0x33c1a5=_0x5f4484[_0xb668('0xd4')][_0x569d78][_0xb668('0xd3')];if(_0x33c1a5){var _0xab7055=path[_0xb668('0xcd')](_0x32b1f8,_0x33c1a5[_0xb668('0xd6')]);if(fs[_0xb668('0xd7')](_0xab7055)){fs[_0xb668('0xd8')](_0xab7055)[_0xb668('0xd9')](fs[_0xb668('0xda')](path[_0xb668('0xcd')](_0x80faf3,_0x33c1a5[_0xb668('0xd6')])));}}}return BPromise[_0xb668('0x8f')]()[_0xb668('0x2c')](function(){return new BPromise(function(_0xea4b26,_0x2f9cfa){zipdir(_0x80faf3,{'saveTo':_0x1ee2c4},function(_0x6993f9,_0x5f31be){if(_0x6993f9)return _0x2f9cfa(_0x6993f9);return _0xea4b26(_0x5f31be);});})[_0xb668('0x2c')](function(){return new BPromise(function(_0x4ff2e4,_0x3d6b97){rimraf(_0x80faf3,function(_0x70e3f2){if(_0x70e3f2)_0x3d6b97(_0x70e3f2);return _0x4ff2e4();});});})[_0xb668('0x2c')](function(){return _0x103031[_0xb668('0xcb')](_0x1ee2c4,_0xf0c5d8,function(_0x39bbe6){if(_0x39bbe6){console[_0xb668('0xdb')](_0xb668('0xdc'),_0x39bbe6);}else{fs['unlinkSync'](_0x1ee2c4);}});});});}else{return _0x103031['sendStatus'](0xc8);}})[_0xb668('0xb2')](handleError(_0x103031,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3cac733..9bfc91d 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0xe7302f,_0x3819c1){var _0x46d963=function(_0x2dc965){while(--_0x2dc965){_0xe7302f['push'](_0xe7302f['shift']());}};_0x46d963(++_0x3819c1);}(_0x326f,0xd1));var _0xf326=function(_0xc491df,_0x137a3d){_0xc491df=_0xc491df-0x0;var _0x1ddf3b=_0x326f[_0xc491df];return _0x1ddf3b;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x582f9a,_0x4c8826){var _0x29e66b=function(_0x494b24){while(--_0x494b24){_0x582f9a['push'](_0x582f9a['shift']());}};_0x29e66b(++_0x4c8826);}(_0x7a54,0x106));var _0x47a5=function(_0x2855ab,_0x40ca01){_0x2855ab=_0x2855ab-0x0;var _0x349d96=_0x7a54[_0x2855ab];return _0x349d96;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 9ffb23d..f46904e 100644 --- a/server/api/faxInteraction/faxInteraction.model.js +++ b/server/api/faxInteraction/faxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f6=['./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x32f6,0x74));var _0x632f=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x32f6[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x632f('0x0'));var util=require(_0x632f('0x1'));var logger=require(_0x632f('0x2'))(_0x632f('0x3'));var moment=require(_0x632f('0x4'));var BPromise=require(_0x632f('0x5'));var rp=require(_0x632f('0x6'));var fs=require('fs');var path=require(_0x632f('0x7'));var rimraf=require(_0x632f('0x8'));var config=require(_0x632f('0x9'));var attributes=require(_0x632f('0xa'));module[_0x632f('0xb')]=function(_0x289a1c,_0x2ca2c6){return _0x289a1c[_0x632f('0xc')](_0x632f('0xd'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d8d09,_0x5efe78,_0x3aaf7c){if(_0x2d8d09[_0x632f('0xe')](_0x632f('0xf'))){_0x2d8d09[_0x632f('0x10')]=moment()['format'](_0x632f('0x11'));}_0x3aaf7c(null,_0x2d8d09);}}});}; \ No newline at end of file +var _0x6e3f=['exports','define','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxInteraction.attributes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6e3f,0x124));var _0xf6e3=function(_0x986968,_0xa04b6d){_0x986968=_0x986968-0x0;var _0x9cd33c=_0x6e3f[_0x986968];return _0x9cd33c;};'use strict';var _=require('lodash');var util=require(_0xf6e3('0x0'));var logger=require(_0xf6e3('0x1'))(_0xf6e3('0x2'));var moment=require(_0xf6e3('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6e3('0x4'));var fs=require('fs');var path=require(_0xf6e3('0x5'));var rimraf=require('rimraf');var config=require(_0xf6e3('0x6'));var attributes=require(_0xf6e3('0x7'));module[_0xf6e3('0x8')]=function(_0x1f866a,_0x5d8582){return _0x1f866a[_0xf6e3('0x9')]('FaxInteraction',attributes,{'tableName':_0xf6e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31cb8a,_0x182386,_0x17665a){if(_0x31cb8a[_0xf6e3('0xb')](_0xf6e3('0xc'))){_0x31cb8a['closedAt']=moment()[_0xf6e3('0xd')](_0xf6e3('0xe'));}_0x17665a(null,_0x31cb8a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a7ab068..6806040 100644 --- a/server/api/faxInteraction/faxInteraction.rpc.js +++ b/server/api/faxInteraction/faxInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe121=['message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','stringify','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe121,0x139));var _0x1e12=function(_0x1da5dd,_0x3f4347){_0x1da5dd=_0x1da5dd-0x0;var _0x5c98ed=_0xe121[_0x1da5dd];return _0x5c98ed;};'use strict';var _=require('lodash');var util=require(_0x1e12('0x0'));var moment=require(_0x1e12('0x1'));var BPromise=require(_0x1e12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e12('0x3'))['db'];var utils=require(_0x1e12('0x4'));var logger=require(_0x1e12('0x5'))(_0x1e12('0x6'));var config=require(_0x1e12('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1e12('0x8')][_0x1e12('0x9')]({'port':0x232a});config[_0x1e12('0xa')]=_[_0x1e12('0xb')](config[_0x1e12('0xa')],{'host':_0x1e12('0xc'),'port':0x18eb});var socket=require(_0x1e12('0xd'))(new Redis(config[_0x1e12('0xa')]));require(_0x1e12('0xe'))[_0x1e12('0xf')](socket);function respondWithRpcPromise(_0x1c9b01,_0x3af73d,_0x2473cc){return new BPromise(function(_0xa0c6c4,_0x4acfa2){return client['request'](_0x1c9b01,_0x2473cc)[_0x1e12('0x10')](function(_0x48b429){logger[_0x1e12('0x11')](_0x1e12('0x12'),_0x3af73d,_0x1e12('0x13'));logger[_0x1e12('0x14')](_0x1e12('0x15'),_0x3af73d,_0x1e12('0x13'),JSON['stringify'](_0x48b429));if(_0x48b429[_0x1e12('0x16')]){if(_0x48b429['error']['code']===0x1f4){logger[_0x1e12('0x16')](_0x1e12('0x12'),_0x3af73d,_0x48b429[_0x1e12('0x16')]['message']);return _0x4acfa2(_0x48b429[_0x1e12('0x16')][_0x1e12('0x17')]);}logger[_0x1e12('0x16')](_0x1e12('0x12'),_0x3af73d,_0x48b429[_0x1e12('0x16')]['message']);return _0xa0c6c4(_0x48b429[_0x1e12('0x16')][_0x1e12('0x17')]);}else{logger['info'](_0x1e12('0x12'),_0x3af73d,_0x1e12('0x13'));_0xa0c6c4(_0x48b429['result'][_0x1e12('0x17')]);}})[_0x1e12('0x18')](function(_0x39298e){logger[_0x1e12('0x16')](_0x1e12('0x12'),_0x3af73d,_0x39298e);_0x4acfa2(_0x39298e);});});}exports[_0x1e12('0x19')]=function(_0x3d55f0){var _0x109865=this;return new Promise(function(_0x5d0119,_0xe3dfbb){return db[_0x1e12('0x1a')][_0x1e12('0x1b')](_0x3d55f0[_0x1e12('0x1c')],{'raw':_0x3d55f0[_0x1e12('0x1d')]?_0x3d55f0[_0x1e12('0x1d')][_0x1e12('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d55f0['options']?_0x3d55f0['options'][_0x1e12('0x1f')]||null:null,'attributes':_0x3d55f0[_0x1e12('0x1d')]?_0x3d55f0[_0x1e12('0x1d')][_0x1e12('0x20')]||null:null,'limit':_0x3d55f0['options']?_0x3d55f0[_0x1e12('0x1d')][_0x1e12('0x21')]||null:null})[_0x1e12('0x10')](function(_0x5e521b){logger[_0x1e12('0x11')](_0x1e12('0x19'),_0x3d55f0);logger['debug'](_0x1e12('0x19'),_0x3d55f0,JSON['stringify'](_0x5e521b));_0x5d0119(_0x5e521b);})[_0x1e12('0x18')](function(_0x5aefd8){logger[_0x1e12('0x16')]('UpdateFaxInteraction',_0x5aefd8['message'],_0x3d55f0);_0xe3dfbb(_0x109865[_0x1e12('0x16')](0x1f4,_0x5aefd8[_0x1e12('0x17')]));});});};exports[_0x1e12('0x22')]=function(_0x1759b8){return new Promise(function(_0x45c2fe,_0x26c7f4){return db[_0x1e12('0x1a')][_0x1e12('0x23')]({'where':_0x1759b8[_0x1e12('0x1d')]?_0x1759b8['options'][_0x1e12('0x1f')]||null:null})[_0x1e12('0x10')](function(_0x4e592d){if(_0x4e592d){return _0x4e592d[_0x1e12('0x24')](_0x1759b8[_0x1e12('0x1c')]['ids'],_[_0x1e12('0x25')](_0x1759b8[_0x1e12('0x1c')],[_0x1e12('0x26'),'id'])||{});}})[_0x1e12('0x27')](function(_0x802e2b){logger[_0x1e12('0x11')](_0x1e12('0x28'),_0x1759b8);logger[_0x1e12('0x14')](_0x1e12('0x28'),_0x1759b8,JSON[_0x1e12('0x29')](_0x802e2b));_0x45c2fe(_0x802e2b);})[_0x1e12('0x18')](function(_0x364394){logger[_0x1e12('0x16')](_0x1e12('0x28'),_0x364394['message'],_0x1759b8);_0x26c7f4(_this['error'](0x1f4,_0x364394[_0x1e12('0x17')]));});});}; \ No newline at end of file +var _0xd503=['client','redis','defaults','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x353c53,_0x2102c0){var _0x2c55da=function(_0x3fe2d5){while(--_0x3fe2d5){_0x353c53['push'](_0x353c53['shift']());}};_0x2c55da(++_0x2102c0);}(_0xd503,0x1c3));var _0x3d50=function(_0x5534ab,_0x3a0b77){_0x5534ab=_0x5534ab-0x0;var _0x3887cc=_0xd503[_0x5534ab];return _0x3887cc;};'use strict';var _=require(_0x3d50('0x0'));var util=require(_0x3d50('0x1'));var moment=require(_0x3d50('0x2'));var BPromise=require(_0x3d50('0x3'));var rs=require(_0x3d50('0x4'));var fs=require('fs');var Redis=require(_0x3d50('0x5'));var db=require(_0x3d50('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d50('0x7'))(_0x3d50('0x8'));var config=require(_0x3d50('0x9'));var jayson=require(_0x3d50('0xa'));var client=jayson[_0x3d50('0xb')]['http']({'port':0x232a});config[_0x3d50('0xc')]=_[_0x3d50('0xd')](config[_0x3d50('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d50('0xe'))(new Redis(config[_0x3d50('0xc')]));require('./faxInteraction.socket')[_0x3d50('0xf')](socket);function respondWithRpcPromise(_0x1e7135,_0x32b9af,_0x45901e){return new BPromise(function(_0x3fbd21,_0x5e9be5){return client['request'](_0x1e7135,_0x45901e)[_0x3d50('0x10')](function(_0x5364bb){logger[_0x3d50('0x11')](_0x3d50('0x12'),_0x32b9af,'request\x20sent');logger[_0x3d50('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x32b9af,_0x3d50('0x14'),JSON['stringify'](_0x5364bb));if(_0x5364bb[_0x3d50('0x15')]){if(_0x5364bb[_0x3d50('0x15')]['code']===0x1f4){logger[_0x3d50('0x15')](_0x3d50('0x12'),_0x32b9af,_0x5364bb[_0x3d50('0x15')]['message']);return _0x5e9be5(_0x5364bb[_0x3d50('0x15')][_0x3d50('0x16')]);}logger[_0x3d50('0x15')](_0x3d50('0x12'),_0x32b9af,_0x5364bb[_0x3d50('0x15')]['message']);return _0x3fbd21(_0x5364bb[_0x3d50('0x15')]['message']);}else{logger[_0x3d50('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x32b9af,_0x3d50('0x14'));_0x3fbd21(_0x5364bb[_0x3d50('0x17')][_0x3d50('0x16')]);}})[_0x3d50('0x18')](function(_0x4d4945){logger[_0x3d50('0x15')](_0x3d50('0x12'),_0x32b9af,_0x4d4945);_0x5e9be5(_0x4d4945);});});}exports['UpdateFaxInteraction']=function(_0x2aa474){var _0x14fff3=this;return new Promise(function(_0x135f27,_0x580af7){return db[_0x3d50('0x19')][_0x3d50('0x1a')](_0x2aa474[_0x3d50('0x1b')],{'raw':_0x2aa474[_0x3d50('0x1c')]?_0x2aa474[_0x3d50('0x1c')][_0x3d50('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aa474[_0x3d50('0x1c')]?_0x2aa474[_0x3d50('0x1c')][_0x3d50('0x1e')]||null:null,'attributes':_0x2aa474[_0x3d50('0x1c')]?_0x2aa474['options'][_0x3d50('0x1f')]||null:null,'limit':_0x2aa474[_0x3d50('0x1c')]?_0x2aa474[_0x3d50('0x1c')][_0x3d50('0x20')]||null:null})[_0x3d50('0x10')](function(_0x14b839){logger[_0x3d50('0x11')](_0x3d50('0x21'),_0x2aa474);logger[_0x3d50('0x13')](_0x3d50('0x21'),_0x2aa474,JSON[_0x3d50('0x22')](_0x14b839));_0x135f27(_0x14b839);})['catch'](function(_0x30185e){logger[_0x3d50('0x15')](_0x3d50('0x21'),_0x30185e[_0x3d50('0x16')],_0x2aa474);_0x580af7(_0x14fff3[_0x3d50('0x15')](0x1f4,_0x30185e['message']));});});};exports[_0x3d50('0x23')]=function(_0x36a79e){return new Promise(function(_0xa85443,_0x3fbd53){return db[_0x3d50('0x19')][_0x3d50('0x24')]({'where':_0x36a79e[_0x3d50('0x1c')]?_0x36a79e[_0x3d50('0x1c')][_0x3d50('0x1e')]||null:null})[_0x3d50('0x10')](function(_0x5a59a0){if(_0x5a59a0){return _0x5a59a0[_0x3d50('0x25')](_0x36a79e[_0x3d50('0x1b')]['ids'],_[_0x3d50('0x26')](_0x36a79e[_0x3d50('0x1b')],[_0x3d50('0x27'),'id'])||{});}})[_0x3d50('0x28')](function(_0x466740){logger[_0x3d50('0x11')](_0x3d50('0x29'),_0x36a79e);logger[_0x3d50('0x13')]('AddTags',_0x36a79e,JSON['stringify'](_0x466740));_0xa85443(_0x466740);})[_0x3d50('0x18')](function(_0x39051e){logger[_0x3d50('0x15')](_0x3d50('0x29'),_0x39051e[_0x3d50('0x16')],_0x36a79e);_0x3fbd53(_this[_0x3d50('0x15')](0x1f4,_0x39051e[_0x3d50('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e1fcb86..4a99291 100644 --- a/server/api/faxInteraction/faxInteraction.socket.js +++ b/server/api/faxInteraction/faxInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8091=['register','faxInteraction:','./faxInteraction.events','save','update','removeListener'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0x8091,0x8c));var _0x1809=function(_0x4e1719,_0x2d563b){_0x4e1719=_0x4e1719-0x0;var _0x35b26a=_0x8091[_0x4e1719];return _0x35b26a;};'use strict';var FaxInteractionEvents=require(_0x1809('0x0'));var events=[_0x1809('0x1'),'remove',_0x1809('0x2')];function createListener(_0x289aae,_0xc86ad6){return function(_0x3a3024){_0xc86ad6['emit'](_0x289aae,_0x3a3024);};}function removeListener(_0x52283a,_0x8942da){return function(){FaxInteractionEvents[_0x1809('0x3')](_0x52283a,_0x8942da);};}exports[_0x1809('0x4')]=function(_0x553494){for(var _0x2cda73=0x0,_0x4d648d=events['length'];_0x2cda73<_0x4d648d;_0x2cda73++){var _0x1831ad=events[_0x2cda73];var _0x2b8246=createListener(_0x1809('0x5')+_0x1831ad,_0x553494);FaxInteractionEvents['on'](_0x1831ad,_0x2b8246);}}; \ No newline at end of file +var _0x11ed=['emit','register','faxInteraction:','./faxInteraction.events','remove','update'];(function(_0x52fe1a,_0x52928b){var _0x4aff8b=function(_0x572ca8){while(--_0x572ca8){_0x52fe1a['push'](_0x52fe1a['shift']());}};_0x4aff8b(++_0x52928b);}(_0x11ed,0x99));var _0xd11e=function(_0x31ef2c,_0x554acc){_0x31ef2c=_0x31ef2c-0x0;var _0x49253a=_0x11ed[_0x31ef2c];return _0x49253a;};'use strict';var FaxInteractionEvents=require(_0xd11e('0x0'));var events=['save',_0xd11e('0x1'),_0xd11e('0x2')];function createListener(_0x5d8f1a,_0x3dcd8b){return function(_0x3da071){_0x3dcd8b[_0xd11e('0x3')](_0x5d8f1a,_0x3da071);};}function removeListener(_0x1a9f26,_0x13be90){return function(){FaxInteractionEvents['removeListener'](_0x1a9f26,_0x13be90);};}exports[_0xd11e('0x4')]=function(_0x148099){for(var _0x488bfc=0x0,_0x1d897f=events['length'];_0x488bfc<_0x1d897f;_0x488bfc++){var _0x25c8b5=events[_0x488bfc];var _0x3c92c6=createListener(_0xd11e('0x5')+_0x25c8b5,_0x148099);FaxInteractionEvents['on'](_0x25c8b5,_0x3c92c6);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2523a91..159a95e 100644 --- a/server/api/faxInteraction/index.js +++ b/server/api/faxInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['update','delete','fax','removeTags','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update'];(function(_0x1aea25,_0x1e7104){var _0xe700d5=function(_0x1e75bf){while(--_0x1e75bf){_0x1aea25['push'](_0x1aea25['shift']());}};_0xe700d5(++_0x1e7104);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0xcb91[_0x58db4e];return _0x40139a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./faxInteraction.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id',auth[_0x1cb9('0x7')](),controller['show']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x6')](_0x1cb9('0xc'),auth['isAuthenticated'](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0xe')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x1cb9('0xe')](_0x1cb9('0x10'),auth[_0x1cb9('0x7')](),interaction[_0x1cb9('0x11')]('fax',_0x1cb9('0x12')),controller[_0x1cb9('0x13')]);router[_0x1cb9('0x14')](_0x1cb9('0x15'),auth[_0x1cb9('0x7')](),interaction['tracked']('fax',_0x1cb9('0x16')),controller[_0x1cb9('0x17')]);router[_0x1cb9('0x18')](_0x1cb9('0x15'),auth[_0x1cb9('0x7')](),interaction[_0x1cb9('0x11')](_0x1cb9('0x19'),'faxinteraction:destroy'),controller['destroy']);router[_0x1cb9('0x18')](_0x1cb9('0x10'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x1a')]);module[_0x1cb9('0x1b')]=router; \ No newline at end of file +var _0xb688=['delete','faxinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','addTags','put','fax','update'];(function(_0x31880d,_0x4f0ff3){var _0x423823=function(_0x57cc92){while(--_0x57cc92){_0x31880d['push'](_0x31880d['shift']());}};_0x423823(++_0x4f0ff3);}(_0xb688,0xcf));var _0x8b68=function(_0x3707fb,_0x377dfb){_0x3707fb=_0x3707fb-0x0;var _0x4ad1f0=_0xb688[_0x3707fb];return _0x4ad1f0;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')]('/',auth[_0x8b68('0x9')](),controller['index']);router[_0x8b68('0x8')]('/describe',auth[_0x8b68('0x9')](),controller[_0x8b68('0xa')]);router[_0x8b68('0x8')](_0x8b68('0xb'),auth[_0x8b68('0x9')](),controller[_0x8b68('0xc')]);router[_0x8b68('0x8')](_0x8b68('0xd'),auth[_0x8b68('0x9')](),controller[_0x8b68('0xe')]);router[_0x8b68('0x8')](_0x8b68('0xf'),auth[_0x8b68('0x9')](),controller['download']);router[_0x8b68('0x10')]('/',auth[_0x8b68('0x9')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x10')](_0x8b68('0xd'),auth[_0x8b68('0x9')](),controller[_0x8b68('0x12')]);router[_0x8b68('0x10')](_0x8b68('0x13'),auth['isAuthenticated'](),interaction[_0x8b68('0x14')]('fax','faxinteraction:addtags'),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')](_0x8b68('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x8b68('0x17'),'faxinteraction:update'),controller[_0x8b68('0x18')]);router[_0x8b68('0x19')](_0x8b68('0xb'),auth[_0x8b68('0x9')](),interaction['tracked'](_0x8b68('0x17'),_0x8b68('0x1a')),controller['destroy']);router[_0x8b68('0x19')](_0x8b68('0x13'),auth[_0x8b68('0x9')](),controller[_0x8b68('0x1b')]);module[_0x8b68('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 75e55c7..6e3c10e 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12f9=['DATE','sequelize','ENUM','out','TEXT'];(function(_0x16855f,_0x30b435){var _0xc2859b=function(_0x51b900){while(--_0x51b900){_0x16855f['push'](_0x16855f['shift']());}};_0xc2859b(++_0x30b435);}(_0x12f9,0x173));var _0x912f=function(_0x5792be,_0x5d9e0d){_0x5792be=_0x5792be-0x0;var _0x3a534d=_0x12f9[_0x5792be];return _0x3a534d;};'use strict';var Sequelize=require(_0x912f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x912f('0x1')]('in',_0x912f('0x2')),'defaultValue':_0x912f('0x2'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x912f('0x3')],'defaultValue':null},'readAt':{'type':Sequelize[_0x912f('0x4')]}}; \ No newline at end of file +var _0x3760=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x3760,0x1a9));var _0x0376=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x3760[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0x0376('0x0'));module[_0x0376('0x1')]={'body':{'type':Sequelize[_0x0376('0x2')](_0x0376('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0376('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0376('0x5')]('in',_0x0376('0x6')),'defaultValue':_0x0376('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0376('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0376('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 4cf24d5..6f038ed 100644 --- a/server/api/faxMessage/faxMessage.controller.js +++ b/server/api/faxMessage/faxMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d05=['attributes','fields','length','limit','sort','where','pick','merge','VIRTUAL','filter','FaxMessage','findAll','rows','show','params','keys','options','find','body','describe','../../config/logger','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','FaxInteractionId','isNil','read1stAt','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','fax','agent','FaxInteraction','RejectMessage','rejectMessage','rejectmessage','create','CmContact','findOne','ContactId','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','Attachment','basename','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','./faxMessage.socket','jayson/promise','client','http','request','then','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','fieldName','type','key','model','query','filters','intersection'];(function(_0x5d2e2e,_0x58089d){var _0x3ddf1d=function(_0x52fa96){while(--_0x52fa96){_0x5d2e2e['push'](_0x5d2e2e['shift']());}};_0x3ddf1d(++_0x58089d);}(_0x9d05,0x1cd));var _0x59d0=function(_0x179ddd,_0x2eb19c){_0x179ddd=_0x179ddd-0x0;var _0x3d51bb=_0x9d05[_0x179ddd];return _0x3d51bb;};'use strict';var pdf=require(_0x59d0('0x0'));var emlformat=require(_0x59d0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x59d0('0x2'));var jsonpatch=require(_0x59d0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x59d0('0x4'));var Mustache=require(_0x59d0('0x5'));var util=require('util');var path=require(_0x59d0('0x6'));var sox=require(_0x59d0('0x7'));var csv=require(_0x59d0('0x8'));var ejs=require(_0x59d0('0x9'));var fs=require('fs');var _=require(_0x59d0('0xa'));var squel=require(_0x59d0('0xb'));var crypto=require(_0x59d0('0xc'));var jsforce=require(_0x59d0('0xd'));var deskjs=require(_0x59d0('0xe'));var toCsv=require(_0x59d0('0x8'));var querystring=require(_0x59d0('0xf'));var Papa=require('papaparse');var Redis=require(_0x59d0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x59d0('0x11'));var as=require(_0x59d0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x59d0('0x13'));var config=require(_0x59d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x59d0('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x59d0('0x16'))(new Redis(config[_0x59d0('0x17')]));require(_0x59d0('0x18'))['register'](socket);var jayson=require(_0x59d0('0x19'));var client=jayson[_0x59d0('0x1a')][_0x59d0('0x1b')]({'port':0x232c});var client9002=jayson[_0x59d0('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4501c6,_0x4a70f3,_0x44f5ec,_0x1ec971){return new BPromise(function(_0x22da71,_0x19af4b){var _0x3d44c8=_0x1ec971||client;return _0x3d44c8[_0x59d0('0x1c')](_0x4501c6,_0x44f5ec)[_0x59d0('0x1d')](function(_0x59316e){logger['info']('FaxMessage,\x20%s,\x20%s',_0x4a70f3,_0x59d0('0x1e'));logger['debug'](_0x59d0('0x1f'),_0x4a70f3,'request\x20sent',JSON[_0x59d0('0x20')](_0x59316e));if(_0x59316e[_0x59d0('0x21')]){if(_0x59316e['error'][_0x59d0('0x22')]===0x1f4){logger['error'](_0x59d0('0x23'),_0x4a70f3,_0x59316e[_0x59d0('0x21')][_0x59d0('0x24')]);return _0x19af4b(_0x59316e[_0x59d0('0x21')][_0x59d0('0x24')]);}logger[_0x59d0('0x21')](_0x59d0('0x23'),_0x4a70f3,_0x59316e[_0x59d0('0x21')][_0x59d0('0x24')]);return _0x22da71(_0x59316e['error'][_0x59d0('0x24')]);}else{logger['info'](_0x59d0('0x23'),_0x4a70f3,'request\x20sent');_0x22da71(_0x59316e[_0x59d0('0x25')][_0x59d0('0x24')]);}})[_0x59d0('0x26')](function(_0x3116da){logger[_0x59d0('0x21')](_0x59d0('0x23'),_0x4a70f3,_0x3116da);_0x19af4b(_0x3116da);});});}function respondWithStatusCode(_0x284fda,_0x15b1db){_0x15b1db=_0x15b1db||0xcc;return function(_0x3f2734){if(_0x3f2734){return _0x284fda[_0x59d0('0x27')](_0x15b1db);}return _0x284fda[_0x59d0('0x28')](_0x15b1db)[_0x59d0('0x29')]();};}function respondWithResult(_0x4f9a51,_0x5de670){_0x5de670=_0x5de670||0xc8;return function(_0x588d67){if(_0x588d67){return _0x4f9a51['status'](_0x5de670)[_0x59d0('0x2a')](_0x588d67);}};}function respondWithFilteredResult(_0x5442a9,_0x10f626){return function(_0x16ac91){if(_0x16ac91){var _0x5a25e4=_0x16ac91[_0x59d0('0x2b')],_0x1233a7=_0x10f626[_0x59d0('0x2c')],_0x1ad213=_0x10f626[_0x59d0('0x2c')]+_0x10f626['limit'],_0x5b4661;if(_0x1ad213>=_0x5a25e4){_0x1ad213=_0x5a25e4;_0x5b4661=0xc8;}else{_0x5b4661=0xce;}_0x5442a9[_0x59d0('0x28')](_0x5b4661);return _0x5442a9[_0x59d0('0x2d')](_0x59d0('0x2e'),_0x1233a7+'-'+_0x1ad213+'/'+_0x5a25e4)[_0x59d0('0x2a')](_0x16ac91);}return null;};}function patchUpdates(_0x4af5af){return function(_0x3d2b8a){try{jsonpatch[_0x59d0('0x2f')](_0x3d2b8a,_0x4af5af,!![]);}catch(_0x434898){return BPromise[_0x59d0('0x30')](_0x434898);}return _0x3d2b8a[_0x59d0('0x31')]();};}function saveUpdates(_0x5d09d7,_0x22555b){return function(_0x143b0a){if(_0x143b0a){return _0x143b0a[_0x59d0('0x32')](_0x5d09d7)[_0x59d0('0x1d')](function(_0x2586e1){return _0x2586e1;});}return null;};}function removeEntity(_0x46050f,_0x31f2e3){return function(_0x18f3e6){if(_0x18f3e6){return _0x18f3e6[_0x59d0('0x33')]()[_0x59d0('0x1d')](function(){_0x46050f['status'](0xcc)[_0x59d0('0x29')]();});}};}function handleEntityNotFound(_0x24e835,_0x2eb904){return function(_0xa0474f){if(!_0xa0474f){_0x24e835['sendStatus'](0x194);}return _0xa0474f;};}function handleError(_0x4988be,_0x339df8){_0x339df8=_0x339df8||0x1f4;return function(_0x1f4dd4){logger[_0x59d0('0x21')](_0x1f4dd4[_0x59d0('0x34')]);if(_0x1f4dd4['name']){delete _0x1f4dd4[_0x59d0('0x35')];}_0x4988be[_0x59d0('0x28')](_0x339df8)[_0x59d0('0x36')](_0x1f4dd4);};}exports['index']=function(_0x15e5cf,_0x35c4d7){var _0x1cb190={},_0x453565={},_0x4ce6d1={'count':0x0,'rows':[]};var _0x394911=_[_0x59d0('0x37')](db['FaxMessage']['rawAttributes'],function(_0x3c3392){return{'name':_0x3c3392[_0x59d0('0x38')],'type':_0x3c3392[_0x59d0('0x39')][_0x59d0('0x3a')]};});_0x453565[_0x59d0('0x3b')]=_[_0x59d0('0x37')](_0x394911,_0x59d0('0x35'));_0x453565[_0x59d0('0x3c')]=_['keys'](_0x15e5cf[_0x59d0('0x3c')]);_0x453565[_0x59d0('0x3d')]=_[_0x59d0('0x3e')](_0x453565[_0x59d0('0x3b')],_0x453565[_0x59d0('0x3c')]);_0x1cb190[_0x59d0('0x3f')]=_[_0x59d0('0x3e')](_0x453565[_0x59d0('0x3b')],qs[_0x59d0('0x40')](_0x15e5cf[_0x59d0('0x3c')][_0x59d0('0x40')]));_0x1cb190[_0x59d0('0x3f')]=_0x1cb190[_0x59d0('0x3f')][_0x59d0('0x41')]?_0x1cb190[_0x59d0('0x3f')]:_0x453565[_0x59d0('0x3b')];if(!_0x15e5cf['query']['hasOwnProperty']('nolimit')){_0x1cb190[_0x59d0('0x42')]=qs['limit'](_0x15e5cf[_0x59d0('0x3c')][_0x59d0('0x42')]);_0x1cb190[_0x59d0('0x2c')]=qs['offset'](_0x15e5cf[_0x59d0('0x3c')][_0x59d0('0x2c')]);}_0x1cb190['order']=qs[_0x59d0('0x43')](_0x15e5cf[_0x59d0('0x3c')]['sort']);_0x1cb190[_0x59d0('0x44')]=qs[_0x59d0('0x3d')](_[_0x59d0('0x45')](_0x15e5cf[_0x59d0('0x3c')],_0x453565[_0x59d0('0x3d')]),_0x394911);if(_0x15e5cf[_0x59d0('0x3c')]['filter']){_0x1cb190['where']=_[_0x59d0('0x46')](_0x1cb190[_0x59d0('0x44')],{'$or':_['map'](_0x394911,function(_0x2a8656){if(_0x2a8656[_0x59d0('0x39')]!==_0x59d0('0x47')){var _0x2f27c6={};_0x2f27c6[_0x2a8656[_0x59d0('0x35')]]={'$like':'%'+_0x15e5cf[_0x59d0('0x3c')][_0x59d0('0x48')]+'%'};return _0x2f27c6;}})});}_0x1cb190=_[_0x59d0('0x46')]({},_0x1cb190,_0x15e5cf['options']);var _0x56d2e7={'where':_0x1cb190[_0x59d0('0x44')]};return db[_0x59d0('0x49')]['count'](_0x56d2e7)[_0x59d0('0x1d')](function(_0x58193a){_0x4ce6d1[_0x59d0('0x2b')]=_0x58193a;if(_0x15e5cf[_0x59d0('0x3c')]['includeAll']){_0x1cb190['include']=[{'all':!![]}];}return db[_0x59d0('0x49')][_0x59d0('0x4a')](_0x1cb190);})[_0x59d0('0x1d')](function(_0x15573c){_0x4ce6d1[_0x59d0('0x4b')]=_0x15573c;return _0x4ce6d1;})[_0x59d0('0x1d')](respondWithFilteredResult(_0x35c4d7,_0x1cb190))[_0x59d0('0x26')](handleError(_0x35c4d7,null));};exports[_0x59d0('0x4c')]=function(_0x42b12c,_0x5d77c2){var _0x3d12c8={'raw':!![],'where':{'id':_0x42b12c[_0x59d0('0x4d')]['id']}},_0x4bc6bb={};_0x4bc6bb[_0x59d0('0x3b')]=_[_0x59d0('0x4e')](db[_0x59d0('0x49')]['rawAttributes']);_0x4bc6bb[_0x59d0('0x3c')]=_['keys'](_0x42b12c['query']);_0x4bc6bb[_0x59d0('0x3d')]=_[_0x59d0('0x3e')](_0x4bc6bb[_0x59d0('0x3b')],_0x4bc6bb[_0x59d0('0x3c')]);_0x3d12c8[_0x59d0('0x3f')]=_[_0x59d0('0x3e')](_0x4bc6bb['model'],qs[_0x59d0('0x40')](_0x42b12c[_0x59d0('0x3c')]['fields']));_0x3d12c8[_0x59d0('0x3f')]=_0x3d12c8[_0x59d0('0x3f')]['length']?_0x3d12c8['attributes']:_0x4bc6bb[_0x59d0('0x3b')];if(_0x42b12c[_0x59d0('0x3c')]['includeAll']){_0x3d12c8['include']=[{'all':!![]}];}_0x3d12c8=_[_0x59d0('0x46')]({},_0x3d12c8,_0x42b12c[_0x59d0('0x4f')]);return db['FaxMessage'][_0x59d0('0x50')](_0x3d12c8)[_0x59d0('0x1d')](handleEntityNotFound(_0x5d77c2,null))[_0x59d0('0x1d')](respondWithResult(_0x5d77c2,null))[_0x59d0('0x26')](handleError(_0x5d77c2,null));};exports[_0x59d0('0x32')]=function(_0x5f4981,_0xd0222d){if(_0x5f4981['body']['id']){delete _0x5f4981['body']['id'];}return db[_0x59d0('0x49')][_0x59d0('0x50')]({'where':{'id':_0x5f4981[_0x59d0('0x4d')]['id']}})[_0x59d0('0x1d')](handleEntityNotFound(_0xd0222d,null))[_0x59d0('0x1d')](saveUpdates(_0x5f4981[_0x59d0('0x51')],null))[_0x59d0('0x1d')](respondWithResult(_0xd0222d,null))[_0x59d0('0x26')](handleError(_0xd0222d,null));};exports[_0x59d0('0x33')]=function(_0x41efd4,_0x221101){return db['FaxMessage'][_0x59d0('0x50')]({'where':{'id':_0x41efd4['params']['id']}})[_0x59d0('0x1d')](handleEntityNotFound(_0x221101,null))[_0x59d0('0x1d')](removeEntity(_0x221101,null))[_0x59d0('0x26')](handleError(_0x221101,null));};exports[_0x59d0('0x52')]=function(_0x67097e,_0x5e410c){return db[_0x59d0('0x49')]['describe']()[_0x59d0('0x1d')](respondWithResult(_0x5e410c,null))[_0x59d0('0x26')](handleError(_0x5e410c,null));};var interaction_log=require(_0x59d0('0x53'))(_0x59d0('0x54'));exports[_0x59d0('0x55')]=function(_0x20a105,_0x27849a,_0x2bac1b){var _0x3e8cb2={'channel':'fax'};if(_0x20a105['body']['id']){delete _0x20a105['body']['id'];}_0x20a105[_0x59d0('0x51')][_0x59d0('0x56')]=!![];_0x20a105['body'][_0x59d0('0x57')]=moment()[_0x59d0('0x58')](_0x59d0('0x59'));_0x20a105['body'][_0x59d0('0x5a')]=_0x20a105[_0x59d0('0x51')]['UserId']||_0x20a105[_0x59d0('0x5b')]['id'];return db[_0x59d0('0x49')][_0x59d0('0x50')]({'where':{'id':_0x20a105['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x59d0('0x5c')}]})[_0x59d0('0x1d')](handleEntityNotFound(_0x27849a,null))[_0x59d0('0x1d')](saveUpdates(_0x20a105[_0x59d0('0x51')],null))[_0x59d0('0x1d')](function(_0x3abf79){if(_0x3abf79){_0x3e8cb2[_0x59d0('0x24')]=_0x3abf79[_0x59d0('0x5d')]({'plain':!![]});return db['FaxInteraction'][_0x59d0('0x50')]({'where':{'id':_0x3abf79[_0x59d0('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x27849a,null))[_0x59d0('0x1d')](function(_0x37256d){if(_0x37256d){return _0x37256d[_0x59d0('0x32')]({'UserId':_0x20a105[_0x59d0('0x51')]['UserId'],'read1stAt':_[_0x59d0('0x5f')](_0x37256d[_0x59d0('0x60')])?moment()[_0x59d0('0x58')](_0x59d0('0x59')):undefined});}return null;})['then'](function(_0x567ed4){if(_0x567ed4){_0x3e8cb2[_0x59d0('0x61')]=_0x567ed4['get']({'plain':!![]});interaction_log[_0x59d0('0x62')](_0x59d0('0x63'),_0x20a105['user']['id'],_0x20a105[_0x59d0('0x5b')]['name'],_0x20a105[_0x59d0('0x5b')][_0x59d0('0x64')],_0x3e8cb2[_0x59d0('0x61')]['id'],_0x20a105[_0x59d0('0x51')]?JSON[_0x59d0('0x20')](_0x20a105[_0x59d0('0x51')]):_0x59d0('0x65'));return respondWithRpcPromise(_0x59d0('0x66'),_0x59d0('0x67'),_0x3e8cb2);}return null;})[_0x59d0('0x1d')](function(_0x3e34a5){if(_0x3e34a5){if(_0x20a105[_0x59d0('0x51')][_0x59d0('0x68')]){_0x3e8cb2[_0x59d0('0x24')][_0x59d0('0x69')]=util[_0x59d0('0x58')](_0x59d0('0x6a'),_0x20a105[_0x59d0('0x5b')][_0x59d0('0x35')]);_0x3e8cb2[_0x59d0('0x24')]['channel']=_0x3e8cb2[_0x59d0('0x6b')];_0x3e8cb2[_0x59d0('0x24')][_0x59d0('0x6c')]=_0x59d0('0x55');return respondWithRpcPromise(_0x59d0('0x6d'),_0x59d0('0x6d'),{'event':'acceptmessage','message':_0x3e8cb2[_0x59d0('0x24')]},client9002)[_0x59d0('0x1d')](function(){return _0x3e8cb2;});}return _0x3e8cb2;}return null;})[_0x59d0('0x1d')](respondWithResult(_0x27849a,null))[_0x59d0('0x26')](handleError(_0x27849a,null));};var interaction_log=require('../../config/logger')(_0x59d0('0x54'));exports[_0x59d0('0x30')]=function(_0x23e67f,_0x5638c3,_0x45cc02){var _0xef1535={'agent':{},'channel':_0x59d0('0x6e')};if(_0x23e67f[_0x59d0('0x51')]['id']){delete _0x23e67f[_0x59d0('0x51')]['id'];}_0x23e67f[_0x59d0('0x51')][_0x59d0('0x5a')]=_0x23e67f[_0x59d0('0x51')][_0x59d0('0x5a')]||_0x23e67f[_0x59d0('0x5b')]['id'];_0xef1535[_0x59d0('0x6f')]['id']=_0x23e67f[_0x59d0('0x51')][_0x59d0('0x5a')];return db[_0x59d0('0x49')][_0x59d0('0x50')]({'where':{'id':_0x23e67f['params']['id'],'UserId':null}})[_0x59d0('0x1d')](handleEntityNotFound(_0x5638c3,null))[_0x59d0('0x1d')](function(_0x3dbfa7){if(_0x3dbfa7){_0xef1535[_0x59d0('0x24')]=_0x3dbfa7[_0x59d0('0x5d')]({'plain':!![]});return db[_0x59d0('0x70')][_0x59d0('0x50')]({'where':{'id':_0x3dbfa7['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5638c3,null))[_0x59d0('0x1d')](function(_0x4cdd51){if(_0x4cdd51){_0xef1535['interaction']=_0x4cdd51['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23e67f[_0x59d0('0x5b')]['id'],_0x23e67f['user'][_0x59d0('0x35')],_0x23e67f[_0x59d0('0x5b')][_0x59d0('0x64')],_0xef1535[_0x59d0('0x61')]['id'],_0x23e67f[_0x59d0('0x51')]?JSON[_0x59d0('0x20')](_0x23e67f[_0x59d0('0x51')]):'null');return respondWithRpcPromise(_0x59d0('0x71'),_0x59d0('0x72'),_0xef1535);}return null;})[_0x59d0('0x1d')](function(_0xbf9c3a){if(_0xbf9c3a){_0xbf9c3a[_0x59d0('0x24')][_0x59d0('0x69')]=util[_0x59d0('0x58')](_0x59d0('0x6a'),_0x23e67f[_0x59d0('0x5b')]['name']);_0xbf9c3a[_0x59d0('0x24')][_0x59d0('0x6b')]=_0xef1535[_0x59d0('0x6b')];_0xbf9c3a[_0x59d0('0x24')][_0x59d0('0x6c')]=_0x59d0('0x30');respondWithRpcPromise(_0x59d0('0x6d'),_0x59d0('0x6d'),{'event':_0x59d0('0x73'),'message':_0xbf9c3a['message']},client9002);return _0xef1535;}return null;})[_0x59d0('0x1d')](respondWithResult(_0x5638c3,null))[_0x59d0('0x26')](handleError(_0x5638c3,null));};exports[_0x59d0('0x74')]=function(_0x786cef,_0x43720c){var _0xe482cd;return db[_0x59d0('0x49')][_0x59d0('0x74')](_0x786cef['body'],{})[_0x59d0('0x1d')](function(_0x4f3ea2){_0xe482cd=_0x4f3ea2;return db[_0x59d0('0x75')][_0x59d0('0x76')]({'where':{'id':_0xe482cd[_0x59d0('0x77')]}});})[_0x59d0('0x1d')](function(_0x7f7a71){if(_[_0x59d0('0x5f')](_0x7f7a71)){return;}else{_0xe482cd[_0x59d0('0x6e')]=_0x7f7a71[_0x59d0('0x6e')];return db['Attachment'][_0x59d0('0x76')]({'where':{'id':_0xe482cd[_0x59d0('0x78')]}});}})[_0x59d0('0x1d')](function(_0x2a15c8){return respondWithRpcPromise('SendFax',_0x59d0('0x79'),{'FaxAccountId':_[_0x59d0('0x5f')](_0x786cef[_0x59d0('0x51')])?undefined:_0x786cef[_0x59d0('0x51')]['FaxAccountId'],'path':_[_0x59d0('0x5f')](_0x2a15c8)?undefined:util[_0x59d0('0x58')](_0x59d0('0x7a'),_0x2a15c8['basename']),'fax':_[_0x59d0('0x5f')](_0xe482cd[_0x59d0('0x6e')])?undefined:_0xe482cd['fax'],'AttachmentId':_0xe482cd[_0x59d0('0x78')]},client9002);})[_0x59d0('0x1d')](respondWithResult(_0x43720c,0xc9))['catch'](handleError(_0x43720c,null));};exports[_0x59d0('0x7b')]=function(_0x34f7fe,_0xe13a9f){var _0x4f624a=path[_0x59d0('0x7c')](config[_0x59d0('0x7d')],_0x59d0('0x7e'),_0x59d0('0x7f'),_0x59d0('0x80'));return db['FaxMessage'][_0x59d0('0x50')]({'where':{'id':_0x34f7fe[_0x59d0('0x4d')]['id']},'include':[{'model':db[_0x59d0('0x81')],'as':'Attachment'}]})[_0x59d0('0x1d')](handleEntityNotFound(_0xe13a9f,null))[_0x59d0('0x1d')](function(_0x35817b){if(_0x35817b){return _0xe13a9f[_0x59d0('0x7b')](path['join'](_0x4f624a,_0x35817b[_0x59d0('0x81')][_0x59d0('0x82')]));}})['catch'](handleError(_0xe13a9f,null));}; \ No newline at end of file +var _0x8b9d=['jayson/promise','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','sendStatus','stack','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','update','body','destroy','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectmessage','create','ContactId','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','root','files','Attachment','join','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxMessage.socket'];(function(_0x2adae8,_0x317544){var _0x352c88=function(_0x379022){while(--_0x379022){_0x2adae8['push'](_0x2adae8['shift']());}};_0x352c88(++_0x317544);}(_0x8b9d,0x6a));var _0xd8b9=function(_0x1d8a06,_0x3c3804){_0x1d8a06=_0x1d8a06-0x0;var _0x28fa68=_0x8b9d[_0x1d8a06];return _0x28fa68;};'use strict';var pdf=require(_0xd8b9('0x0'));var emlformat=require(_0xd8b9('0x1'));var rimraf=require(_0xd8b9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd8b9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8b9('0x4'));var util=require(_0xd8b9('0x5'));var path=require(_0xd8b9('0x6'));var sox=require(_0xd8b9('0x7'));var csv=require(_0xd8b9('0x8'));var ejs=require(_0xd8b9('0x9'));var fs=require('fs');var _=require(_0xd8b9('0xa'));var squel=require('squel');var crypto=require(_0xd8b9('0xb'));var jsforce=require(_0xd8b9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd8b9('0x8'));var querystring=require(_0xd8b9('0xd'));var Papa=require('papaparse');var Redis=require(_0xd8b9('0xe'));var authService=require(_0xd8b9('0xf'));var qs=require(_0xd8b9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8b9('0x11'));var logger=require('../../config/logger')(_0xd8b9('0x12'));var utils=require(_0xd8b9('0x13'));var config=require(_0xd8b9('0x14'));var licenseUtil=require(_0xd8b9('0x15'));var db=require('../../mysqldb')['db'];config[_0xd8b9('0x16')]=_[_0xd8b9('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd8b9('0x18'))(new Redis(config[_0xd8b9('0x16')]));require(_0xd8b9('0x19'))['register'](socket);var jayson=require(_0xd8b9('0x1a'));var client=jayson[_0xd8b9('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xd8b9('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e610a,_0x1ea3d6,_0x5d1c56,_0x70d87c){return new BPromise(function(_0x15cf6f,_0x337212){var _0x11e549=_0x70d87c||client;return _0x11e549[_0xd8b9('0x1c')](_0x1e610a,_0x5d1c56)[_0xd8b9('0x1d')](function(_0x47e51e){logger[_0xd8b9('0x1e')](_0xd8b9('0x1f'),_0x1ea3d6,_0xd8b9('0x20'));logger['debug'](_0xd8b9('0x21'),_0x1ea3d6,_0xd8b9('0x20'),JSON[_0xd8b9('0x22')](_0x47e51e));if(_0x47e51e[_0xd8b9('0x23')]){if(_0x47e51e['error'][_0xd8b9('0x24')]===0x1f4){logger[_0xd8b9('0x23')]('FaxMessage,\x20%s,\x20%s',_0x1ea3d6,_0x47e51e[_0xd8b9('0x23')]['message']);return _0x337212(_0x47e51e[_0xd8b9('0x23')]['message']);}logger[_0xd8b9('0x23')](_0xd8b9('0x1f'),_0x1ea3d6,_0x47e51e[_0xd8b9('0x23')][_0xd8b9('0x25')]);return _0x15cf6f(_0x47e51e['error'][_0xd8b9('0x25')]);}else{logger[_0xd8b9('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x1ea3d6,'request\x20sent');_0x15cf6f(_0x47e51e[_0xd8b9('0x26')]['message']);}})[_0xd8b9('0x27')](function(_0x2e537a){logger[_0xd8b9('0x23')](_0xd8b9('0x1f'),_0x1ea3d6,_0x2e537a);_0x337212(_0x2e537a);});});}function respondWithStatusCode(_0x31bcdb,_0x1aaa93){_0x1aaa93=_0x1aaa93||0xcc;return function(_0x2222b8){if(_0x2222b8){return _0x31bcdb['sendStatus'](_0x1aaa93);}return _0x31bcdb[_0xd8b9('0x28')](_0x1aaa93)[_0xd8b9('0x29')]();};}function respondWithResult(_0x5c9c12,_0x555f65){_0x555f65=_0x555f65||0xc8;return function(_0x257266){if(_0x257266){return _0x5c9c12[_0xd8b9('0x28')](_0x555f65)[_0xd8b9('0x2a')](_0x257266);}};}function respondWithFilteredResult(_0x5a20da,_0x10d6fd){return function(_0x134d1f){if(_0x134d1f){var _0x25ef8e=_0x134d1f[_0xd8b9('0x2b')],_0x4715b5=_0x10d6fd['offset'],_0x99563f=_0x10d6fd[_0xd8b9('0x2c')]+_0x10d6fd[_0xd8b9('0x2d')],_0x4afc30;if(_0x99563f>=_0x25ef8e){_0x99563f=_0x25ef8e;_0x4afc30=0xc8;}else{_0x4afc30=0xce;}_0x5a20da[_0xd8b9('0x28')](_0x4afc30);return _0x5a20da[_0xd8b9('0x2e')](_0xd8b9('0x2f'),_0x4715b5+'-'+_0x99563f+'/'+_0x25ef8e)['json'](_0x134d1f);}return null;};}function patchUpdates(_0x3e6304){return function(_0x56b858){try{jsonpatch[_0xd8b9('0x30')](_0x56b858,_0x3e6304,!![]);}catch(_0x38781a){return BPromise[_0xd8b9('0x31')](_0x38781a);}return _0x56b858['save']();};}function saveUpdates(_0x234bf0,_0x893951){return function(_0x1bd77b){if(_0x1bd77b){return _0x1bd77b['update'](_0x234bf0)[_0xd8b9('0x1d')](function(_0x231f38){return _0x231f38;});}return null;};}function removeEntity(_0x32f07f,_0x1603bf){return function(_0x31194d){if(_0x31194d){return _0x31194d['destroy']()[_0xd8b9('0x1d')](function(){_0x32f07f[_0xd8b9('0x28')](0xcc)[_0xd8b9('0x29')]();});}};}function handleEntityNotFound(_0x13bca2,_0x4e6b7a){return function(_0x496089){if(!_0x496089){_0x13bca2[_0xd8b9('0x32')](0x194);}return _0x496089;};}function handleError(_0x208f4c,_0x18606f){_0x18606f=_0x18606f||0x1f4;return function(_0x1872df){logger[_0xd8b9('0x23')](_0x1872df[_0xd8b9('0x33')]);if(_0x1872df['name']){delete _0x1872df['name'];}_0x208f4c[_0xd8b9('0x28')](_0x18606f)[_0xd8b9('0x34')](_0x1872df);};}exports[_0xd8b9('0x35')]=function(_0xbfe419,_0x728af0){var _0x357f36={},_0x68576e={},_0x2a0110={'count':0x0,'rows':[]};var _0x3b9388=_[_0xd8b9('0x36')](db[_0xd8b9('0x37')][_0xd8b9('0x38')],function(_0x439e53){return{'name':_0x439e53[_0xd8b9('0x39')],'type':_0x439e53[_0xd8b9('0x3a')][_0xd8b9('0x3b')]};});_0x68576e[_0xd8b9('0x3c')]=_[_0xd8b9('0x36')](_0x3b9388,_0xd8b9('0x3d'));_0x68576e['query']=_[_0xd8b9('0x3e')](_0xbfe419[_0xd8b9('0x3f')]);_0x68576e[_0xd8b9('0x40')]=_['intersection'](_0x68576e[_0xd8b9('0x3c')],_0x68576e[_0xd8b9('0x3f')]);_0x357f36[_0xd8b9('0x41')]=_[_0xd8b9('0x42')](_0x68576e[_0xd8b9('0x3c')],qs['fields'](_0xbfe419[_0xd8b9('0x3f')][_0xd8b9('0x43')]));_0x357f36['attributes']=_0x357f36[_0xd8b9('0x41')][_0xd8b9('0x44')]?_0x357f36['attributes']:_0x68576e[_0xd8b9('0x3c')];if(!_0xbfe419['query'][_0xd8b9('0x45')](_0xd8b9('0x46'))){_0x357f36[_0xd8b9('0x2d')]=qs[_0xd8b9('0x2d')](_0xbfe419[_0xd8b9('0x3f')][_0xd8b9('0x2d')]);_0x357f36[_0xd8b9('0x2c')]=qs[_0xd8b9('0x2c')](_0xbfe419['query'][_0xd8b9('0x2c')]);}_0x357f36['order']=qs[_0xd8b9('0x47')](_0xbfe419[_0xd8b9('0x3f')][_0xd8b9('0x47')]);_0x357f36[_0xd8b9('0x48')]=qs[_0xd8b9('0x40')](_[_0xd8b9('0x49')](_0xbfe419[_0xd8b9('0x3f')],_0x68576e[_0xd8b9('0x40')]),_0x3b9388);if(_0xbfe419['query'][_0xd8b9('0x4a')]){_0x357f36[_0xd8b9('0x48')]=_[_0xd8b9('0x4b')](_0x357f36[_0xd8b9('0x48')],{'$or':_[_0xd8b9('0x36')](_0x3b9388,function(_0x40fdd9){if(_0x40fdd9['type']!==_0xd8b9('0x4c')){var _0x1ba4b4={};_0x1ba4b4[_0x40fdd9['name']]={'$like':'%'+_0xbfe419['query']['filter']+'%'};return _0x1ba4b4;}})});}_0x357f36=_[_0xd8b9('0x4b')]({},_0x357f36,_0xbfe419[_0xd8b9('0x4d')]);var _0x2c6a4c={'where':_0x357f36[_0xd8b9('0x48')]};return db['FaxMessage'][_0xd8b9('0x2b')](_0x2c6a4c)[_0xd8b9('0x1d')](function(_0x25bc23){_0x2a0110[_0xd8b9('0x2b')]=_0x25bc23;if(_0xbfe419['query'][_0xd8b9('0x4e')]){_0x357f36[_0xd8b9('0x4f')]=[{'all':!![]}];}return db[_0xd8b9('0x37')][_0xd8b9('0x50')](_0x357f36);})[_0xd8b9('0x1d')](function(_0x42a1ab){_0x2a0110[_0xd8b9('0x51')]=_0x42a1ab;return _0x2a0110;})[_0xd8b9('0x1d')](respondWithFilteredResult(_0x728af0,_0x357f36))[_0xd8b9('0x27')](handleError(_0x728af0,null));};exports['show']=function(_0x42cff0,_0x2fcefd){var _0x4d1290={'raw':!![],'where':{'id':_0x42cff0[_0xd8b9('0x52')]['id']}},_0x5f508f={};_0x5f508f[_0xd8b9('0x3c')]=_[_0xd8b9('0x3e')](db[_0xd8b9('0x37')][_0xd8b9('0x38')]);_0x5f508f[_0xd8b9('0x3f')]=_['keys'](_0x42cff0[_0xd8b9('0x3f')]);_0x5f508f[_0xd8b9('0x40')]=_[_0xd8b9('0x42')](_0x5f508f[_0xd8b9('0x3c')],_0x5f508f['query']);_0x4d1290[_0xd8b9('0x41')]=_[_0xd8b9('0x42')](_0x5f508f[_0xd8b9('0x3c')],qs[_0xd8b9('0x43')](_0x42cff0[_0xd8b9('0x3f')][_0xd8b9('0x43')]));_0x4d1290[_0xd8b9('0x41')]=_0x4d1290[_0xd8b9('0x41')]['length']?_0x4d1290[_0xd8b9('0x41')]:_0x5f508f['model'];if(_0x42cff0['query'][_0xd8b9('0x4e')]){_0x4d1290[_0xd8b9('0x4f')]=[{'all':!![]}];}_0x4d1290=_[_0xd8b9('0x4b')]({},_0x4d1290,_0x42cff0['options']);return db[_0xd8b9('0x37')][_0xd8b9('0x53')](_0x4d1290)[_0xd8b9('0x1d')](handleEntityNotFound(_0x2fcefd,null))[_0xd8b9('0x1d')](respondWithResult(_0x2fcefd,null))[_0xd8b9('0x27')](handleError(_0x2fcefd,null));};exports[_0xd8b9('0x54')]=function(_0x59f769,_0x38125f){if(_0x59f769[_0xd8b9('0x55')]['id']){delete _0x59f769[_0xd8b9('0x55')]['id'];}return db[_0xd8b9('0x37')][_0xd8b9('0x53')]({'where':{'id':_0x59f769[_0xd8b9('0x52')]['id']}})['then'](handleEntityNotFound(_0x38125f,null))[_0xd8b9('0x1d')](saveUpdates(_0x59f769['body'],null))[_0xd8b9('0x1d')](respondWithResult(_0x38125f,null))['catch'](handleError(_0x38125f,null));};exports[_0xd8b9('0x56')]=function(_0x19f956,_0x287a26){return db[_0xd8b9('0x37')][_0xd8b9('0x53')]({'where':{'id':_0x19f956['params']['id']}})[_0xd8b9('0x1d')](handleEntityNotFound(_0x287a26,null))[_0xd8b9('0x1d')](removeEntity(_0x287a26,null))['catch'](handleError(_0x287a26,null));};exports[_0xd8b9('0x57')]=function(_0x431076,_0x39d0ea){return db[_0xd8b9('0x37')][_0xd8b9('0x57')]()['then'](respondWithResult(_0x39d0ea,null))['catch'](handleError(_0x39d0ea,null));};var interaction_log=require('../../config/logger')(_0xd8b9('0x58'));exports[_0xd8b9('0x59')]=function(_0x59b020,_0xbc48e4,_0x2e6d7a){var _0x387a7e={'channel':_0xd8b9('0x5a')};if(_0x59b020['body']['id']){delete _0x59b020['body']['id'];}_0x59b020[_0xd8b9('0x55')][_0xd8b9('0x5b')]=!![];_0x59b020[_0xd8b9('0x55')][_0xd8b9('0x5c')]=moment()[_0xd8b9('0x5d')](_0xd8b9('0x5e'));_0x59b020[_0xd8b9('0x55')]['UserId']=_0x59b020[_0xd8b9('0x55')][_0xd8b9('0x5f')]||_0x59b020[_0xd8b9('0x60')]['id'];return db[_0xd8b9('0x37')]['find']({'where':{'id':_0x59b020[_0xd8b9('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xd8b9('0x61')],'as':_0xd8b9('0x62')}]})[_0xd8b9('0x1d')](handleEntityNotFound(_0xbc48e4,null))[_0xd8b9('0x1d')](saveUpdates(_0x59b020[_0xd8b9('0x55')],null))[_0xd8b9('0x1d')](function(_0x4c8f37){if(_0x4c8f37){_0x387a7e[_0xd8b9('0x25')]=_0x4c8f37['get']({'plain':!![]});return db[_0xd8b9('0x63')][_0xd8b9('0x53')]({'where':{'id':_0x4c8f37[_0xd8b9('0x64')]}});}return null;})['then'](handleEntityNotFound(_0xbc48e4,null))[_0xd8b9('0x1d')](function(_0x170ec1){if(_0x170ec1){return _0x170ec1['update']({'UserId':_0x59b020['body']['UserId'],'read1stAt':_[_0xd8b9('0x65')](_0x170ec1[_0xd8b9('0x66')])?moment()[_0xd8b9('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd8b9('0x1d')](function(_0x58005d){if(_0x58005d){_0x387a7e[_0xd8b9('0x67')]=_0x58005d[_0xd8b9('0x68')]({'plain':!![]});interaction_log[_0xd8b9('0x1e')](_0xd8b9('0x69'),_0x59b020[_0xd8b9('0x60')]['id'],_0x59b020[_0xd8b9('0x60')]['name'],_0x59b020[_0xd8b9('0x60')]['role'],_0x387a7e[_0xd8b9('0x67')]['id'],_0x59b020[_0xd8b9('0x55')]?JSON[_0xd8b9('0x22')](_0x59b020[_0xd8b9('0x55')]):_0xd8b9('0x6a'));return respondWithRpcPromise(_0xd8b9('0x6b'),'acceptMessage',_0x387a7e);}return null;})['then'](function(_0x4345e6){if(_0x4345e6){if(_0x59b020[_0xd8b9('0x55')][_0xd8b9('0x6c')]){_0x387a7e['message'][_0xd8b9('0x6d')]=util[_0xd8b9('0x5d')](_0xd8b9('0x6e'),_0x59b020[_0xd8b9('0x60')][_0xd8b9('0x3d')]);_0x387a7e['message'][_0xd8b9('0x6f')]=_0x387a7e[_0xd8b9('0x6f')];_0x387a7e[_0xd8b9('0x25')][_0xd8b9('0x70')]=_0xd8b9('0x59');return respondWithRpcPromise(_0xd8b9('0x71'),_0xd8b9('0x71'),{'event':_0xd8b9('0x72'),'message':_0x387a7e[_0xd8b9('0x25')]},client9002)[_0xd8b9('0x1d')](function(){return _0x387a7e;});}return _0x387a7e;}return null;})[_0xd8b9('0x1d')](respondWithResult(_0xbc48e4,null))[_0xd8b9('0x27')](handleError(_0xbc48e4,null));};var interaction_log=require(_0xd8b9('0x73'))(_0xd8b9('0x58'));exports[_0xd8b9('0x31')]=function(_0x15ac81,_0x60dd2e,_0x230d9f){var _0x1fed05={'agent':{},'channel':_0xd8b9('0x5a')};if(_0x15ac81['body']['id']){delete _0x15ac81[_0xd8b9('0x55')]['id'];}_0x15ac81[_0xd8b9('0x55')]['UserId']=_0x15ac81[_0xd8b9('0x55')][_0xd8b9('0x5f')]||_0x15ac81[_0xd8b9('0x60')]['id'];_0x1fed05[_0xd8b9('0x74')]['id']=_0x15ac81[_0xd8b9('0x55')][_0xd8b9('0x5f')];return db['FaxMessage']['find']({'where':{'id':_0x15ac81[_0xd8b9('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x60dd2e,null))[_0xd8b9('0x1d')](function(_0x109c74){if(_0x109c74){_0x1fed05[_0xd8b9('0x25')]=_0x109c74[_0xd8b9('0x68')]({'plain':!![]});return db[_0xd8b9('0x63')]['find']({'where':{'id':_0x109c74[_0xd8b9('0x64')]}});}return null;})[_0xd8b9('0x1d')](handleEntityNotFound(_0x60dd2e,null))[_0xd8b9('0x1d')](function(_0x57c2cc){if(_0x57c2cc){_0x1fed05[_0xd8b9('0x67')]=_0x57c2cc[_0xd8b9('0x68')]({'plain':!![]});interaction_log[_0xd8b9('0x1e')](_0xd8b9('0x75'),_0x15ac81[_0xd8b9('0x60')]['id'],_0x15ac81['user']['name'],_0x15ac81[_0xd8b9('0x60')][_0xd8b9('0x76')],_0x1fed05[_0xd8b9('0x67')]['id'],_0x15ac81[_0xd8b9('0x55')]?JSON['stringify'](_0x15ac81[_0xd8b9('0x55')]):_0xd8b9('0x6a'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1fed05);}return null;})['then'](function(_0x2b2921){if(_0x2b2921){_0x2b2921['message'][_0xd8b9('0x6d')]=util[_0xd8b9('0x5d')](_0xd8b9('0x6e'),_0x15ac81[_0xd8b9('0x60')][_0xd8b9('0x3d')]);_0x2b2921[_0xd8b9('0x25')][_0xd8b9('0x6f')]=_0x1fed05['channel'];_0x2b2921['message'][_0xd8b9('0x70')]=_0xd8b9('0x31');respondWithRpcPromise(_0xd8b9('0x71'),_0xd8b9('0x71'),{'event':_0xd8b9('0x77'),'message':_0x2b2921[_0xd8b9('0x25')]},client9002);return _0x1fed05;}return null;})[_0xd8b9('0x1d')](respondWithResult(_0x60dd2e,null))[_0xd8b9('0x27')](handleError(_0x60dd2e,null));};exports['create']=function(_0x43e84a,_0x564caf){var _0x38e977;return db[_0xd8b9('0x37')][_0xd8b9('0x78')](_0x43e84a[_0xd8b9('0x55')],{})[_0xd8b9('0x1d')](function(_0x4b9644){_0x38e977=_0x4b9644;return db[_0xd8b9('0x61')]['findOne']({'where':{'id':_0x38e977[_0xd8b9('0x79')]}});})[_0xd8b9('0x1d')](function(_0x30d45b){if(_['isNil'](_0x30d45b)){return;}else{_0x38e977['fax']=_0x30d45b[_0xd8b9('0x5a')];return db['Attachment'][_0xd8b9('0x7a')]({'where':{'id':_0x38e977[_0xd8b9('0x7b')]}});}})[_0xd8b9('0x1d')](function(_0x2598ae){return respondWithRpcPromise('SendFax',_0xd8b9('0x7c'),{'FaxAccountId':_[_0xd8b9('0x65')](_0x43e84a[_0xd8b9('0x55')])?undefined:_0x43e84a[_0xd8b9('0x55')]['FaxAccountId'],'path':_[_0xd8b9('0x65')](_0x2598ae)?undefined:util[_0xd8b9('0x5d')](_0xd8b9('0x7d'),_0x2598ae[_0xd8b9('0x7e')]),'fax':_[_0xd8b9('0x65')](_0x38e977[_0xd8b9('0x5a')])?undefined:_0x38e977['fax'],'AttachmentId':_0x38e977[_0xd8b9('0x7b')]},client9002);})[_0xd8b9('0x1d')](respondWithResult(_0x564caf,0xc9))[_0xd8b9('0x27')](handleError(_0x564caf,null));};exports[_0xd8b9('0x7f')]=function(_0x239f12,_0x1e79c4){var _0xfdcdda=path['join'](config[_0xd8b9('0x80')],'server',_0xd8b9('0x81'),'attachments');return db[_0xd8b9('0x37')][_0xd8b9('0x53')]({'where':{'id':_0x239f12[_0xd8b9('0x52')]['id']},'include':[{'model':db[_0xd8b9('0x82')],'as':_0xd8b9('0x82')}]})[_0xd8b9('0x1d')](handleEntityNotFound(_0x1e79c4,null))[_0xd8b9('0x1d')](function(_0x5f10a1){if(_0x5f10a1){return _0x1e79c4[_0xd8b9('0x7f')](path[_0xd8b9('0x83')](_0xfdcdda,_0x5f10a1[_0xd8b9('0x82')][_0xd8b9('0x7e')]));}})[_0xd8b9('0x27')](handleError(_0x1e79c4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 650905b..6804528 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x34e8,0x12c));var _0x834e=function(_0x3aee0a,_0x4f9fea){_0x3aee0a=_0x3aee0a-0x0;var _0x495408=_0x34e8[_0x3aee0a];return _0x495408;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x55ca,0x126));var _0xa55c=function(_0x5cb367,_0x27ec9d){_0x5cb367=_0x5cb367-0x0;var _0x279365=_0x55ca[_0x5cb367];return _0x279365;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e3fce85..3b45973 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bc4=['secret','isNil','FaxInteractionId','then','update','createdAt','catch','error','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','body','models','get','direction','toLowerCase','out'];(function(_0x5b427e,_0x14f60d){var _0x431730=function(_0x4887c9){while(--_0x4887c9){_0x5b427e['push'](_0x5b427e['shift']());}};_0x431730(++_0x14f60d);}(_0x3bc4,0x10c));var _0x43bc=function(_0x45b100,_0x29a4b1){_0x45b100=_0x45b100-0x0;var _0x1b41f8=_0x3bc4[_0x45b100];return _0x1b41f8;};'use strict';var _=require(_0x43bc('0x0'));var util=require(_0x43bc('0x1'));var logger=require(_0x43bc('0x2'))(_0x43bc('0x3'));var moment=require(_0x43bc('0x4'));var BPromise=require(_0x43bc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43bc('0x6'));var rimraf=require(_0x43bc('0x7'));var config=require(_0x43bc('0x8'));var attributes=require(_0x43bc('0x9'));module['exports']=function(_0x5dd604,_0x5a9474){return _0x5dd604[_0x43bc('0xa')]('FaxMessage',attributes,{'tableName':_0x43bc('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x43bc('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x229ace,_0x396731,_0x2a2621){var _0x546cfb=_0x5dd604[_0x43bc('0xd')];var _0x3f3ef8=_0x229ace[_0x43bc('0xe')]({'plain':!![]});if(_0x3f3ef8[_0x43bc('0xf')][_0x43bc('0x10')]()==='in'||_0x3f3ef8[_0x43bc('0xf')][_0x43bc('0x10')]()===_0x43bc('0x11')&&!_0x3f3ef8[_0x43bc('0x12')]&&!_[_0x43bc('0x13')](_0x3f3ef8['UserId'])){_0x546cfb['FaxInteraction']['findOne']({'where':{'id':_0x3f3ef8[_0x43bc('0x14')]}})[_0x43bc('0x15')](function(_0x4c0edd){if(_0x4c0edd){_0x4c0edd[_0x43bc('0x16')]({'lastMsgAt':_0x3f3ef8[_0x43bc('0x17')],'lastMsgDirection':_0x3f3ef8[_0x43bc('0xf')][_0x43bc('0x10')]()});}})[_0x43bc('0x18')](function(_0x572b44){console[_0x43bc('0x19')](_0x572b44);});}_0x2a2621();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x17ca=['fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x6c58d2,_0x128b1f){var _0x541c56=function(_0x2cf1d3){while(--_0x2cf1d3){_0x6c58d2['push'](_0x6c58d2['shift']());}};_0x541c56(++_0x128b1f);}(_0x17ca,0x14a));var _0xa17c=function(_0x534555,_0x212763){_0x534555=_0x534555-0x0;var _0xbb8a35=_0x17ca[_0x534555];return _0xbb8a35;};'use strict';var _=require(_0xa17c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa17c('0x1'));var moment=require(_0xa17c('0x2'));var BPromise=require(_0xa17c('0x3'));var rp=require(_0xa17c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa17c('0x5'));var config=require('../../config/environment');var attributes=require(_0xa17c('0x6'));module[_0xa17c('0x7')]=function(_0x5840dd,_0x51f82d){return _0x5840dd[_0xa17c('0x8')](_0xa17c('0x9'),attributes,{'tableName':_0xa17c('0xa'),'paranoid':![],'indexes':[{'name':_0xa17c('0xb'),'fields':[_0xa17c('0xc')],'type':_0xa17c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f85c8,_0x439cfb,_0x5019f3){var _0x441f43=_0x5840dd[_0xa17c('0xe')];var _0x4de602=_0x3f85c8[_0xa17c('0xf')]({'plain':!![]});if(_0x4de602[_0xa17c('0x10')][_0xa17c('0x11')]()==='in'||_0x4de602[_0xa17c('0x10')]['toLowerCase']()===_0xa17c('0x12')&&!_0x4de602[_0xa17c('0x13')]&&!_[_0xa17c('0x14')](_0x4de602[_0xa17c('0x15')])){_0x441f43[_0xa17c('0x16')]['findOne']({'where':{'id':_0x4de602[_0xa17c('0x17')]}})[_0xa17c('0x18')](function(_0x488a84){if(_0x488a84){_0x488a84[_0xa17c('0x19')]({'lastMsgAt':_0x4de602[_0xa17c('0x1a')],'lastMsgDirection':_0x4de602[_0xa17c('0x10')][_0xa17c('0x11')]()});}})[_0xa17c('0x1b')](function(_0x528233){console[_0xa17c('0x1c')](_0x528233);});}_0x5019f3();}},'charset':_0xa17c('0x1d'),'collate':_0xa17c('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 96fbb86..309882f 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x872f=['then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateFaxMessage','FaxMessage','create','body','raw','UpdateFaxMessage','options','where','attributes','limit','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x872f,0x1e9));var _0xf872=function(_0x4d4e7c,_0x1a8689){_0x4d4e7c=_0x4d4e7c-0x0;var _0x408125=_0x872f[_0x4d4e7c];return _0x408125;};'use strict';var _=require(_0xf872('0x0'));var util=require('util');var moment=require(_0xf872('0x1'));var BPromise=require(_0xf872('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf872('0x3'));var db=require(_0xf872('0x4'))['db'];var utils=require(_0xf872('0x5'));var logger=require(_0xf872('0x6'))(_0xf872('0x7'));var config=require('../../config/environment');var jayson=require(_0xf872('0x8'));var client=jayson[_0xf872('0x9')][_0xf872('0xa')]({'port':0x232a});config[_0xf872('0xb')]=_[_0xf872('0xc')](config[_0xf872('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf872('0xd'))(new Redis(config[_0xf872('0xb')]));require(_0xf872('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f0515,_0x203df7,_0x18a309){return new BPromise(function(_0x284bf1,_0x1dcd3d){return client['request'](_0x3f0515,_0x18a309)[_0xf872('0xf')](function(_0x27e641){logger['info'](_0xf872('0x10'),_0x203df7,_0xf872('0x11'));logger[_0xf872('0x12')](_0xf872('0x13'),_0x203df7,_0xf872('0x11'),JSON['stringify'](_0x27e641));if(_0x27e641[_0xf872('0x14')]){if(_0x27e641[_0xf872('0x14')][_0xf872('0x15')]===0x1f4){logger[_0xf872('0x14')](_0xf872('0x10'),_0x203df7,_0x27e641[_0xf872('0x14')]['message']);return _0x1dcd3d(_0x27e641[_0xf872('0x14')]['message']);}logger[_0xf872('0x14')](_0xf872('0x10'),_0x203df7,_0x27e641['error'][_0xf872('0x16')]);return _0x284bf1(_0x27e641[_0xf872('0x14')][_0xf872('0x16')]);}else{logger[_0xf872('0x17')](_0xf872('0x10'),_0x203df7,'request\x20sent');_0x284bf1(_0x27e641['result']['message']);}})[_0xf872('0x18')](function(_0xfec43c){logger['error']('FaxMessage,\x20%s,\x20%s',_0x203df7,_0xfec43c);_0x1dcd3d(_0xfec43c);});});}exports[_0xf872('0x19')]=function(_0x497408){var _0x1c377c=this;return new Promise(function(_0x52333d,_0x20c6cd){return db[_0xf872('0x1a')][_0xf872('0x1b')](_0x497408[_0xf872('0x1c')],{'raw':_0x497408['options']?_0x497408['options'][_0xf872('0x1d')]===undefined?!![]:![]:!![]})[_0xf872('0xf')](function(_0x35cc08){logger[_0xf872('0x17')]('CreateFaxMessage',_0x497408);logger['debug'](_0xf872('0x19'),_0x497408,JSON['stringify'](_0x35cc08));_0x52333d(_0x35cc08);})[_0xf872('0x18')](function(_0x1a7e1d){logger[_0xf872('0x14')](_0xf872('0x19'),_0x1a7e1d['message'],_0x497408);_0x20c6cd(_0x1c377c[_0xf872('0x14')](0x1f4,_0x1a7e1d[_0xf872('0x16')]));});});};exports[_0xf872('0x1e')]=function(_0x368eed){var _0x28d57c=this;return new Promise(function(_0xe0aa27,_0x5628a6){return db[_0xf872('0x1a')]['update'](_0x368eed[_0xf872('0x1c')],{'raw':_0x368eed[_0xf872('0x1f')]?_0x368eed[_0xf872('0x1f')][_0xf872('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x368eed[_0xf872('0x1f')]?_0x368eed[_0xf872('0x1f')][_0xf872('0x20')]||null:null,'attributes':_0x368eed['options']?_0x368eed[_0xf872('0x1f')][_0xf872('0x21')]||null:null,'limit':_0x368eed[_0xf872('0x1f')]?_0x368eed[_0xf872('0x1f')][_0xf872('0x22')]||null:null})[_0xf872('0xf')](function(_0x23136c){logger[_0xf872('0x17')](_0xf872('0x1e'),_0x368eed);logger[_0xf872('0x12')](_0xf872('0x1e'),_0x368eed,JSON[_0xf872('0x23')](_0x23136c));_0xe0aa27(_0x23136c);})[_0xf872('0x18')](function(_0x56d96a){logger[_0xf872('0x14')]('UpdateFaxMessage',_0x56d96a[_0xf872('0x16')],_0x368eed);_0x5628a6(_0x28d57c[_0xf872('0x14')](0x1f4,_0x56d96a[_0xf872('0x16')]));});});}; \ No newline at end of file +var _0x07a7=['http','redis','defaults','localhost','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','stringify','UpdateFaxMessage','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x457993,_0x162e4f){var _0x207dc7=function(_0x37fd7d){while(--_0x37fd7d){_0x457993['push'](_0x457993['shift']());}};_0x207dc7(++_0x162e4f);}(_0x07a7,0x1b2));var _0x707a=function(_0x5575ec,_0x16fc90){_0x5575ec=_0x5575ec-0x0;var _0x248352=_0x07a7[_0x5575ec];return _0x248352;};'use strict';var _=require(_0x707a('0x0'));var util=require(_0x707a('0x1'));var moment=require(_0x707a('0x2'));var BPromise=require('bluebird');var rs=require(_0x707a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x707a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x707a('0x5'))(_0x707a('0x6'));var config=require(_0x707a('0x7'));var jayson=require(_0x707a('0x8'));var client=jayson[_0x707a('0x9')][_0x707a('0xa')]({'port':0x232a});config[_0x707a('0xb')]=_[_0x707a('0xc')](config[_0x707a('0xb')],{'host':_0x707a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x707a('0xb')]));require(_0x707a('0xe'))[_0x707a('0xf')](socket);function respondWithRpcPromise(_0x2679da,_0x4f9650,_0x29feb4){return new BPromise(function(_0x5e5249,_0x2664d7){return client[_0x707a('0x10')](_0x2679da,_0x29feb4)['then'](function(_0x1dd9f7){logger[_0x707a('0x11')](_0x707a('0x12'),_0x4f9650,_0x707a('0x13'));logger[_0x707a('0x14')](_0x707a('0x15'),_0x4f9650,_0x707a('0x13'),JSON['stringify'](_0x1dd9f7));if(_0x1dd9f7[_0x707a('0x16')]){if(_0x1dd9f7[_0x707a('0x16')][_0x707a('0x17')]===0x1f4){logger[_0x707a('0x16')]('FaxMessage,\x20%s,\x20%s',_0x4f9650,_0x1dd9f7[_0x707a('0x16')][_0x707a('0x18')]);return _0x2664d7(_0x1dd9f7['error']['message']);}logger[_0x707a('0x16')](_0x707a('0x12'),_0x4f9650,_0x1dd9f7[_0x707a('0x16')][_0x707a('0x18')]);return _0x5e5249(_0x1dd9f7[_0x707a('0x16')][_0x707a('0x18')]);}else{logger[_0x707a('0x11')]('FaxMessage,\x20%s,\x20%s',_0x4f9650,_0x707a('0x13'));_0x5e5249(_0x1dd9f7[_0x707a('0x19')][_0x707a('0x18')]);}})[_0x707a('0x1a')](function(_0x5cb1ad){logger[_0x707a('0x16')](_0x707a('0x12'),_0x4f9650,_0x5cb1ad);_0x2664d7(_0x5cb1ad);});});}exports['CreateFaxMessage']=function(_0x190bbd){var _0x2756c8=this;return new Promise(function(_0x44be2c,_0x3de2f6){return db[_0x707a('0x1b')][_0x707a('0x1c')](_0x190bbd[_0x707a('0x1d')],{'raw':_0x190bbd[_0x707a('0x1e')]?_0x190bbd['options'][_0x707a('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x549f4d){logger[_0x707a('0x11')](_0x707a('0x20'),_0x190bbd);logger['debug'](_0x707a('0x20'),_0x190bbd,JSON[_0x707a('0x21')](_0x549f4d));_0x44be2c(_0x549f4d);})[_0x707a('0x1a')](function(_0x3b9020){logger[_0x707a('0x16')](_0x707a('0x20'),_0x3b9020[_0x707a('0x18')],_0x190bbd);_0x3de2f6(_0x2756c8[_0x707a('0x16')](0x1f4,_0x3b9020[_0x707a('0x18')]));});});};exports[_0x707a('0x22')]=function(_0x18ac3e){var _0x32d032=this;return new Promise(function(_0x48245b,_0x4c1f75){return db[_0x707a('0x1b')]['update'](_0x18ac3e[_0x707a('0x1d')],{'raw':_0x18ac3e['options']?_0x18ac3e[_0x707a('0x1e')][_0x707a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ac3e['options']?_0x18ac3e[_0x707a('0x1e')]['where']||null:null,'attributes':_0x18ac3e['options']?_0x18ac3e[_0x707a('0x1e')][_0x707a('0x23')]||null:null,'limit':_0x18ac3e[_0x707a('0x1e')]?_0x18ac3e[_0x707a('0x1e')][_0x707a('0x24')]||null:null})['then'](function(_0x293851){logger[_0x707a('0x11')](_0x707a('0x22'),_0x18ac3e);logger[_0x707a('0x14')]('UpdateFaxMessage',_0x18ac3e,JSON[_0x707a('0x21')](_0x293851));_0x48245b(_0x293851);})[_0x707a('0x1a')](function(_0x50bb17){logger[_0x707a('0x16')](_0x707a('0x22'),_0x50bb17[_0x707a('0x18')],_0x18ac3e);_0x4c1f75(_0x32d032[_0x707a('0x16')](0x1f4,_0x50bb17[_0x707a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 1074a75..ef1de51 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 953f803..dcb14b9 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fda=['util','express','Router','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','exports','multer'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x3fda,0x11d));var _0xa3fd=function(_0x2a8970,_0x47e59d){_0x2a8970=_0x2a8970-0x0;var _0xb50eb8=_0x3fda[_0x2a8970];return _0xb50eb8;};'use strict';var multer=require(_0xa3fd('0x0'));var util=require(_0xa3fd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa3fd('0x2'));var router=express[_0xa3fd('0x3')]();var auth=require(_0xa3fd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa3fd('0x5'));var controller=require(_0xa3fd('0x6'));router[_0xa3fd('0x7')]('/',auth[_0xa3fd('0x8')](),controller[_0xa3fd('0x9')]);router[_0xa3fd('0x7')](_0xa3fd('0xa'),auth[_0xa3fd('0x8')](),controller[_0xa3fd('0xb')]);router[_0xa3fd('0x7')](_0xa3fd('0xc'),auth[_0xa3fd('0x8')](),controller[_0xa3fd('0xd')]);router['get']('/:id/download',auth[_0xa3fd('0x8')](),controller['download']);router[_0xa3fd('0xe')]('/',auth[_0xa3fd('0x8')](),interaction[_0xa3fd('0xf')](_0xa3fd('0x10'),_0xa3fd('0x11')),controller[_0xa3fd('0x12')]);router[_0xa3fd('0x13')](_0xa3fd('0xc'),auth['isAuthenticated'](),controller[_0xa3fd('0x14')]);router[_0xa3fd('0x13')](_0xa3fd('0x15'),auth['isAuthenticated'](),controller[_0xa3fd('0x16')]);router[_0xa3fd('0x13')](_0xa3fd('0x17'),auth[_0xa3fd('0x8')](),controller[_0xa3fd('0x18')]);router['delete'](_0xa3fd('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa3fd('0x19')]=router; \ No newline at end of file +var _0xd5e4=['update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','put'];(function(_0x2c2a81,_0x1d63e5){var _0x4e337c=function(_0x58495d){while(--_0x58495d){_0x2c2a81['push'](_0x2c2a81['shift']());}};_0x4e337c(++_0x1d63e5);}(_0xd5e4,0x8e));var _0x4d5e=function(_0x5480d5,_0x446a24){_0x5480d5=_0x5480d5-0x0;var _0x297386=_0xd5e4[_0x5480d5];return _0x297386;};'use strict';var multer=require(_0x4d5e('0x0'));var util=require(_0x4d5e('0x1'));var path=require('path');var timeout=require(_0x4d5e('0x2'));var express=require(_0x4d5e('0x3'));var router=express[_0x4d5e('0x4')]();var auth=require(_0x4d5e('0x5'));var interaction=require(_0x4d5e('0x6'));var config=require('../../config/environment');var controller=require(_0x4d5e('0x7'));router[_0x4d5e('0x8')]('/',auth[_0x4d5e('0x9')](),controller[_0x4d5e('0xa')]);router['get'](_0x4d5e('0xb'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0xc')]);router['get'](_0x4d5e('0xd'),auth['isAuthenticated'](),controller[_0x4d5e('0xe')]);router['get'](_0x4d5e('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x4d5e('0x10')]('/',auth['isAuthenticated'](),interaction[_0x4d5e('0x11')](_0x4d5e('0x12'),'faxmessage:create'),controller['create']);router[_0x4d5e('0x13')](_0x4d5e('0xd'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0x14')]);router['put'](_0x4d5e('0x15'),auth[_0x4d5e('0x9')](),controller['accept']);router['put'](_0x4d5e('0x16'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0x17')]);router[_0x4d5e('0x18')](_0x4d5e('0xd'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0x19')]);module[_0x4d5e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 11163c0..9c1519b 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6412=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x6412,0xad));var _0x2641=function(_0xe03d92,_0x24502f){_0xe03d92=_0xe03d92-0x0;var _0x536b2a=_0x6412[_0xe03d92];return _0x536b2a;};'use strict';var Sequelize=require(_0x2641('0x0'));module[_0x2641('0x1')]={'name':{'type':Sequelize[_0x2641('0x2')],'unique':_0x2641('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2641('0x2')]},'timeout':{'type':Sequelize[_0x2641('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2641('0x5')](_0x2641('0x6'),'beepall',_0x2641('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2641('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x43b7=['ENUM','roundrobin','sequelize','name','INTEGER'];(function(_0x54e26b,_0x18219e){var _0x2a82f5=function(_0x3023ac){while(--_0x3023ac){_0x54e26b['push'](_0x54e26b['shift']());}};_0x2a82f5(++_0x18219e);}(_0x43b7,0x183));var _0x743b=function(_0x4f6ffd,_0x366959){_0x4f6ffd=_0x4f6ffd-0x0;var _0xbaca20=_0x43b7[_0x4f6ffd];return _0xbaca20;};'use strict';var Sequelize=require(_0x743b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x743b('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x743b('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x743b('0x3')]('rrmemory','beepall',_0x743b('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x743b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index e59aeec..e067e93 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fc5=['clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','forEach','userFaxQueue:remove','addAgents','spread','removeAgents','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','map','FaxQueue','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','rows','catch','show','params','includeAll','include','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','UserFaxQueue','User','UserId','agent','faxPause','createdAt','format','%s/%s','updatedAt','Team','rawAttributes','getTeams','addTeams','ids','findAll','Agents','online','flatMap','sequelize','findOrCreate','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?'];(function(_0x17fc85,_0x37cb47){var _0x253a1f=function(_0x2c1658){while(--_0x2c1658){_0x17fc85['push'](_0x17fc85['shift']());}};_0x253a1f(++_0x37cb47);}(_0x1fc5,0x98));var _0x51fc=function(_0x36d9ef,_0x5a11ca){_0x36d9ef=_0x36d9ef-0x0;var _0x462c80=_0x1fc5[_0x36d9ef];return _0x462c80;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x51fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51fc('0x1'));var jsonpatch=require(_0x51fc('0x2'));var rp=require(_0x51fc('0x3'));var moment=require(_0x51fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x51fc('0x5'));var util=require('util');var path=require('path');var sox=require(_0x51fc('0x6'));var csv=require(_0x51fc('0x7'));var ejs=require(_0x51fc('0x8'));var fs=require('fs');var _=require(_0x51fc('0x9'));var squel=require('squel');var crypto=require(_0x51fc('0xa'));var jsforce=require(_0x51fc('0xb'));var deskjs=require(_0x51fc('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51fc('0xd'));var Redis=require(_0x51fc('0xe'));var authService=require(_0x51fc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x51fc('0x10'));var hardwareService=require(_0x51fc('0x11'));var logger=require(_0x51fc('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x51fc('0x13'));var licenseUtil=require(_0x51fc('0x14'));var db=require('../../mysqldb')['db'];config[_0x51fc('0x15')]=_[_0x51fc('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51fc('0x15')]));require(_0x51fc('0x17'))[_0x51fc('0x18')](socket);function respondWithStatusCode(_0x5ee840,_0x5c2a03){_0x5c2a03=_0x5c2a03||0xcc;return function(_0x19abba){if(_0x19abba){return _0x5ee840[_0x51fc('0x19')](_0x5c2a03);}return _0x5ee840[_0x51fc('0x1a')](_0x5c2a03)[_0x51fc('0x1b')]();};}function respondWithResult(_0x860131,_0x49db62){_0x49db62=_0x49db62||0xc8;return function(_0x20e4b5){if(_0x20e4b5){return _0x860131[_0x51fc('0x1a')](_0x49db62)[_0x51fc('0x1c')](_0x20e4b5);}};}function respondWithFilteredResult(_0x4596a2,_0x345edf){return function(_0x116b46){if(_0x116b46){var _0x50620e=_0x116b46[_0x51fc('0x1d')],_0x220fa0=_0x345edf['offset'],_0x1b6dce=_0x345edf[_0x51fc('0x1e')]+_0x345edf[_0x51fc('0x1f')],_0x5bbf09;if(_0x1b6dce>=_0x50620e){_0x1b6dce=_0x50620e;_0x5bbf09=0xc8;}else{_0x5bbf09=0xce;}_0x4596a2[_0x51fc('0x1a')](_0x5bbf09);return _0x4596a2[_0x51fc('0x20')]('Content-Range',_0x220fa0+'-'+_0x1b6dce+'/'+_0x50620e)[_0x51fc('0x1c')](_0x116b46);}return null;};}function patchUpdates(_0x579022){return function(_0x524600){try{jsonpatch[_0x51fc('0x21')](_0x524600,_0x579022,!![]);}catch(_0x2dc6a2){return BPromise[_0x51fc('0x22')](_0x2dc6a2);}return _0x524600[_0x51fc('0x23')]();};}function saveUpdates(_0x173c49,_0x4c9cf9){return function(_0x1ffbb5){if(_0x1ffbb5){return _0x1ffbb5[_0x51fc('0x24')](_0x173c49)[_0x51fc('0x25')](function(_0x1ea435){return _0x1ea435;});}return null;};}function removeEntity(_0x452193,_0x489f90){return function(_0x203ddf){if(_0x203ddf){return _0x203ddf[_0x51fc('0x26')]()['then'](function(){var _0x1cbff6=_0x203ddf[_0x51fc('0x27')]({'plain':!![]});var _0x3caf4a=_0x51fc('0x28');return db[_0x51fc('0x29')][_0x51fc('0x26')]({'where':{'type':_0x3caf4a,'resourceId':_0x1cbff6['id']}})['then'](function(){return _0x203ddf;});})[_0x51fc('0x25')](function(){_0x452193[_0x51fc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a0647,_0x3baf4d){return function(_0x36bedd){if(!_0x36bedd){_0x1a0647[_0x51fc('0x19')](0x194);}return _0x36bedd;};}function handleError(_0x1d6fa4,_0x211116){_0x211116=_0x211116||0x1f4;return function(_0xb3492){logger[_0x51fc('0x2a')](_0xb3492[_0x51fc('0x2b')]);if(_0xb3492['name']){delete _0xb3492[_0x51fc('0x2c')];}_0x1d6fa4[_0x51fc('0x1a')](_0x211116)['send'](_0xb3492);};}exports[_0x51fc('0x2d')]=function(_0x25df7a,_0x18aaaa){var _0x2f8fb3={},_0x10c3d5={},_0x1323c5={'count':0x0,'rows':[]};var _0x184996=_[_0x51fc('0x2e')](db[_0x51fc('0x2f')]['rawAttributes'],function(_0x435ab9){return{'name':_0x435ab9['fieldName'],'type':_0x435ab9[_0x51fc('0x30')]['key']};});_0x10c3d5['model']=_[_0x51fc('0x2e')](_0x184996,_0x51fc('0x2c'));_0x10c3d5[_0x51fc('0x31')]=_[_0x51fc('0x32')](_0x25df7a[_0x51fc('0x31')]);_0x10c3d5[_0x51fc('0x33')]=_[_0x51fc('0x34')](_0x10c3d5['model'],_0x10c3d5['query']);_0x2f8fb3[_0x51fc('0x35')]=_[_0x51fc('0x34')](_0x10c3d5[_0x51fc('0x36')],qs[_0x51fc('0x37')](_0x25df7a[_0x51fc('0x31')][_0x51fc('0x37')]));_0x2f8fb3[_0x51fc('0x35')]=_0x2f8fb3[_0x51fc('0x35')][_0x51fc('0x38')]?_0x2f8fb3[_0x51fc('0x35')]:_0x10c3d5['model'];if(!_0x25df7a[_0x51fc('0x31')][_0x51fc('0x39')](_0x51fc('0x3a'))){_0x2f8fb3[_0x51fc('0x1f')]=qs[_0x51fc('0x1f')](_0x25df7a[_0x51fc('0x31')]['limit']);_0x2f8fb3[_0x51fc('0x1e')]=qs[_0x51fc('0x1e')](_0x25df7a[_0x51fc('0x31')][_0x51fc('0x1e')]);}_0x2f8fb3[_0x51fc('0x3b')]=qs[_0x51fc('0x3c')](_0x25df7a[_0x51fc('0x31')][_0x51fc('0x3c')]);_0x2f8fb3[_0x51fc('0x3d')]=qs[_0x51fc('0x33')](_[_0x51fc('0x3e')](_0x25df7a[_0x51fc('0x31')],_0x10c3d5[_0x51fc('0x33')]),_0x184996);if(_0x25df7a['query']['filter']){_0x2f8fb3[_0x51fc('0x3d')]=_['merge'](_0x2f8fb3['where'],{'$or':_['map'](_0x184996,function(_0x5dbb93){if(_0x5dbb93[_0x51fc('0x30')]!==_0x51fc('0x3f')){var _0xf69d36={};_0xf69d36[_0x5dbb93['name']]={'$like':'%'+_0x25df7a[_0x51fc('0x31')][_0x51fc('0x40')]+'%'};return _0xf69d36;}})});}_0x2f8fb3=_[_0x51fc('0x41')]({},_0x2f8fb3,_0x25df7a[_0x51fc('0x42')]);var _0x2b1b95={'where':_0x2f8fb3[_0x51fc('0x3d')]};return db[_0x51fc('0x2f')][_0x51fc('0x1d')](_0x2b1b95)[_0x51fc('0x25')](function(_0x266bd1){_0x1323c5[_0x51fc('0x1d')]=_0x266bd1;if(_0x25df7a[_0x51fc('0x31')]['includeAll']){_0x2f8fb3['include']=[{'all':!![]}];}return db[_0x51fc('0x2f')]['findAll'](_0x2f8fb3);})[_0x51fc('0x25')](function(_0x3f832b){_0x1323c5[_0x51fc('0x43')]=_0x3f832b;return _0x1323c5;})[_0x51fc('0x25')](respondWithFilteredResult(_0x18aaaa,_0x2f8fb3))[_0x51fc('0x44')](handleError(_0x18aaaa,null));};exports[_0x51fc('0x45')]=function(_0x242fbc,_0x569d7a){var _0x452faa={'raw':!![],'where':{'id':_0x242fbc[_0x51fc('0x46')]['id']}},_0x5abbc5={};_0x5abbc5[_0x51fc('0x36')]=_[_0x51fc('0x32')](db[_0x51fc('0x2f')]['rawAttributes']);_0x5abbc5[_0x51fc('0x31')]=_[_0x51fc('0x32')](_0x242fbc['query']);_0x5abbc5[_0x51fc('0x33')]=_[_0x51fc('0x34')](_0x5abbc5[_0x51fc('0x36')],_0x5abbc5[_0x51fc('0x31')]);_0x452faa[_0x51fc('0x35')]=_[_0x51fc('0x34')](_0x5abbc5[_0x51fc('0x36')],qs['fields'](_0x242fbc[_0x51fc('0x31')][_0x51fc('0x37')]));_0x452faa[_0x51fc('0x35')]=_0x452faa[_0x51fc('0x35')][_0x51fc('0x38')]?_0x452faa[_0x51fc('0x35')]:_0x5abbc5[_0x51fc('0x36')];if(_0x242fbc['query'][_0x51fc('0x47')]){_0x452faa[_0x51fc('0x48')]=[{'all':!![]}];}_0x452faa=_[_0x51fc('0x41')]({},_0x452faa,_0x242fbc[_0x51fc('0x42')]);return db[_0x51fc('0x2f')][_0x51fc('0x49')](_0x452faa)[_0x51fc('0x25')](handleEntityNotFound(_0x569d7a,null))[_0x51fc('0x25')](respondWithResult(_0x569d7a,null))['catch'](handleError(_0x569d7a,null));};exports['create']=function(_0x2e6bab,_0x2f0419){return db['FaxQueue']['create'](_0x2e6bab['body'],{})['then'](function(_0xdcb8a){var _0x462d44=_0x2e6bab['user'][_0x51fc('0x27')]({'plain':!![]});if(!_0x462d44)throw new Error(_0x51fc('0x4a'));if(_0x462d44['role']==='user'){var _0x1ca83e=_0xdcb8a[_0x51fc('0x27')]({'plain':!![]});var _0x253205='FaxQueues';return db[_0x51fc('0x4b')][_0x51fc('0x49')]({'where':{'name':_0x253205,'userProfileId':_0x462d44[_0x51fc('0x4c')]},'raw':!![]})[_0x51fc('0x25')](function(_0x53f456){if(_0x53f456&&_0x53f456['autoAssociation']===0x0){return db['UserProfileResource'][_0x51fc('0x4d')]({'name':_0x1ca83e[_0x51fc('0x2c')],'resourceId':_0x1ca83e['id'],'type':_0x53f456[_0x51fc('0x2c')],'sectionId':_0x53f456['id']},{})[_0x51fc('0x25')](function(){return _0xdcb8a;});}else{return _0xdcb8a;}})[_0x51fc('0x44')](function(_0xa1fa2d){logger[_0x51fc('0x2a')](_0x51fc('0x4e'),_0xa1fa2d);throw _0xa1fa2d;});}return _0xdcb8a;})['then'](respondWithResult(_0x2f0419,0xc9))[_0x51fc('0x44')](handleError(_0x2f0419,null));};exports[_0x51fc('0x24')]=function(_0x5ef9be,_0x4d466c){if(_0x5ef9be[_0x51fc('0x4f')]['id']){delete _0x5ef9be[_0x51fc('0x4f')]['id'];}return db[_0x51fc('0x2f')][_0x51fc('0x49')]({'where':{'id':_0x5ef9be[_0x51fc('0x46')]['id']}})[_0x51fc('0x25')](handleEntityNotFound(_0x4d466c,null))[_0x51fc('0x25')](saveUpdates(_0x5ef9be[_0x51fc('0x4f')],null))['then'](respondWithResult(_0x4d466c,null))[_0x51fc('0x44')](handleError(_0x4d466c,null));};exports['destroy']=function(_0x252761,_0x5805bc){return db['FaxQueue'][_0x51fc('0x49')]({'where':{'id':_0x252761[_0x51fc('0x46')]['id']}})[_0x51fc('0x25')](handleEntityNotFound(_0x5805bc,null))[_0x51fc('0x25')](removeEntity(_0x5805bc,null))[_0x51fc('0x44')](handleError(_0x5805bc,null));};exports['describe']=function(_0x10aa73,_0x573b92){return db[_0x51fc('0x2f')]['describe']()[_0x51fc('0x25')](respondWithResult(_0x573b92,null))[_0x51fc('0x44')](handleError(_0x573b92,null));};exports['getMembers']=function(_0x14ad69,_0x3bc980,_0x20a4d4){var _0x59faf4={'raw':!![],'where':{}},_0x4cbb3b={},_0x223b9b;return db[_0x51fc('0x2f')][_0x51fc('0x50')]({'where':{'id':_0x14ad69['params']['id']}})[_0x51fc('0x25')](handleEntityNotFound(_0x3bc980,null))[_0x51fc('0x25')](function(_0x1d2012){if(_0x1d2012){_0x223b9b=_0x1d2012['get']({'plain':!![]});_0x4cbb3b[_0x51fc('0x36')]=_[_0x51fc('0x32')](db['UserFaxQueue']['rawAttributes']);_0x4cbb3b[_0x51fc('0x31')]=_[_0x51fc('0x32')](_0x14ad69[_0x51fc('0x31')]);_0x4cbb3b[_0x51fc('0x33')]=_[_0x51fc('0x34')](_0x4cbb3b[_0x51fc('0x36')],_0x4cbb3b['query']);_0x59faf4[_0x51fc('0x35')]=_[_0x51fc('0x34')](_0x4cbb3b['model'],qs[_0x51fc('0x37')](_0x14ad69[_0x51fc('0x31')]['fields']));_0x59faf4[_0x51fc('0x35')]=_0x59faf4[_0x51fc('0x35')]['length']?_0x59faf4['attributes']:_0x4cbb3b[_0x51fc('0x36')];if(!_0x14ad69['query'][_0x51fc('0x39')](_0x51fc('0x3a'))){_0x59faf4['limit']=qs['limit'](_0x14ad69[_0x51fc('0x31')][_0x51fc('0x1f')]);_0x59faf4[_0x51fc('0x1e')]=qs[_0x51fc('0x1e')](_0x14ad69[_0x51fc('0x31')][_0x51fc('0x1e')]);}_0x59faf4[_0x51fc('0x3b')]=qs['sort'](_0x14ad69['query'][_0x51fc('0x3c')]);_0x59faf4[_0x51fc('0x3d')]=qs[_0x51fc('0x33')](_[_0x51fc('0x3e')](_0x14ad69[_0x51fc('0x31')],_0x4cbb3b['filters']));_0x59faf4[_0x51fc('0x3d')]['FaxQueueId']=_0x1d2012['id'];if(_0x14ad69[_0x51fc('0x31')]['filter']){_0x59faf4[_0x51fc('0x3d')]=_[_0x51fc('0x41')](_0x59faf4[_0x51fc('0x3d')],{'$or':_[_0x51fc('0x2e')](_0x59faf4[_0x51fc('0x35')],function(_0x1a84e6){var _0x218dac={};_0x218dac[_0x1a84e6]={'$like':'%'+_0x14ad69[_0x51fc('0x31')][_0x51fc('0x40')]+'%'};return _0x218dac;})});}_0x59faf4=_['merge']({},_0x59faf4,_0x14ad69[_0x51fc('0x42')]);return db[_0x51fc('0x51')]['findAll'](_0x59faf4);}})[_0x51fc('0x25')](function(_0x17e39b){if(_0x17e39b){return db[_0x51fc('0x52')]['findAndCountAll']({'where':{'id':_[_0x51fc('0x2e')](_0x17e39b,_0x51fc('0x53')),'role':_0x51fc('0x54')},'attributes':['id',_0x51fc('0x2c'),_0x51fc('0x55'),'updatedAt',_0x51fc('0x56')]});}})['then'](function(_0x497992){if(_0x497992){return{'count':_0x497992[_0x51fc('0x1d')],'rows':_[_0x51fc('0x2e')](_0x497992[_0x51fc('0x43')],function(_0x464232){return{'membername':_0x464232[_0x51fc('0x2c')],'UserId':_0x464232['id'],'queue_name':_0x223b9b[_0x51fc('0x2c')],'FaxQueueId':_0x223b9b['id'],'interface':util[_0x51fc('0x57')](_0x51fc('0x58'),'SIP',_0x464232[_0x51fc('0x2c')]),'penalty':0x0,'paused':_0x464232[_0x51fc('0x55')],'createdAt':_0x464232['createdAt'],'updatedAt':_0x464232[_0x51fc('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3bc980,_0x59faf4))['catch'](handleError(_0x3bc980,null));};exports['getTeams']=function(_0x109bd1,_0x49d9ea,_0xc9903c){var _0x285ae1={};var _0x300c46={};var _0x3ee4f4;var _0x47a732;return db[_0x51fc('0x2f')][_0x51fc('0x50')]({'where':{'id':_0x109bd1[_0x51fc('0x46')]['id']}})[_0x51fc('0x25')](handleEntityNotFound(_0x49d9ea,null))[_0x51fc('0x25')](function(_0x50427e){if(_0x50427e){_0x3ee4f4=_0x50427e;_0x300c46[_0x51fc('0x36')]=_[_0x51fc('0x32')](db[_0x51fc('0x5a')][_0x51fc('0x5b')]);_0x300c46[_0x51fc('0x31')]=_['keys'](_0x109bd1[_0x51fc('0x31')]);_0x300c46[_0x51fc('0x33')]=_['intersection'](_0x300c46[_0x51fc('0x36')],_0x300c46[_0x51fc('0x31')]);_0x285ae1[_0x51fc('0x35')]=_[_0x51fc('0x34')](_0x300c46[_0x51fc('0x36')],qs['fields'](_0x109bd1[_0x51fc('0x31')]['fields']));_0x285ae1[_0x51fc('0x35')]=_0x285ae1[_0x51fc('0x35')]['length']?_0x285ae1[_0x51fc('0x35')]:_0x300c46[_0x51fc('0x36')];_0x285ae1['order']=qs['sort'](_0x109bd1[_0x51fc('0x31')][_0x51fc('0x3c')]);_0x285ae1[_0x51fc('0x3d')]=qs[_0x51fc('0x33')](_[_0x51fc('0x3e')](_0x109bd1['query'],_0x300c46['filters']));if(_0x109bd1['query'][_0x51fc('0x40')]){_0x285ae1[_0x51fc('0x3d')]=_[_0x51fc('0x41')](_0x285ae1['where'],{'$or':_[_0x51fc('0x2e')](_0x285ae1[_0x51fc('0x35')],function(_0x4f82c9){var _0x5ad178={};_0x5ad178[_0x4f82c9]={'$like':'%'+_0x109bd1[_0x51fc('0x31')][_0x51fc('0x40')]+'%'};return _0x5ad178;})});}_0x285ae1=_[_0x51fc('0x41')]({},_0x285ae1,_0x109bd1['options']);return _0x3ee4f4['getTeams'](_0x285ae1);}})[_0x51fc('0x25')](function(_0x405ed5){if(_0x405ed5){_0x47a732=_0x405ed5['length'];if(!_0x109bd1[_0x51fc('0x31')][_0x51fc('0x39')](_0x51fc('0x3a'))){_0x285ae1[_0x51fc('0x1f')]=qs[_0x51fc('0x1f')](_0x109bd1[_0x51fc('0x31')][_0x51fc('0x1f')]);_0x285ae1[_0x51fc('0x1e')]=qs[_0x51fc('0x1e')](_0x109bd1['query']['offset']);}return _0x3ee4f4[_0x51fc('0x5c')](_0x285ae1);}})[_0x51fc('0x25')](function(_0x44da88){if(_0x44da88){return _0x44da88?{'count':_0x47a732,'rows':_0x44da88}:null;}})['then'](respondWithResult(_0x49d9ea,null))[_0x51fc('0x44')](handleError(_0x49d9ea,null));};exports[_0x51fc('0x5d')]=function(_0x362d36,_0x426ac7,_0x5248c6){var _0x55a0f8=_0x362d36[_0x51fc('0x4f')][_0x51fc('0x5e')];return db[_0x51fc('0x5a')][_0x51fc('0x5f')]({'where':{'id':_0x55a0f8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x51fc('0x60'),'attributes':['id',_0x51fc('0x2c'),_0x51fc('0x61'),'voicePause','interface'],'raw':!![]}]})[_0x51fc('0x25')](function(_0x1e22c5){if(_0x1e22c5){var _0x1706f0=_[_0x51fc('0x62')](_0x1e22c5,function(_0x4911f2){var _0x23850a=_0x4911f2[_0x51fc('0x27')]({'plain':!![]});return _0x23850a[_0x51fc('0x60')];});return db['FaxQueue'][_0x51fc('0x49')]({'where':{'id':_0x362d36['params']['id']}})[_0x51fc('0x25')](function(_0x17fa13){return db[_0x51fc('0x63')]['transaction'](function(_0x50629a){return _0x17fa13['addTeams'](_0x55a0f8,{'transaction':_0x50629a})[_0x51fc('0x25')](function(){return BPromise['each'](_0x1706f0,function(_0x356083){return db['UserFaxQueue'][_0x51fc('0x64')]({'where':{'UserId':_0x356083['id'],'FaxQueueId':_0x362d36['params']['id']},'transaction':_0x50629a});});})[_0x51fc('0x25')](function(){_0x1706f0['forEach'](function(_0x489f46){socket[_0x51fc('0x65')](_0x51fc('0x66'),{'UserId':_0x489f46['id'],'FaxQueueId':_0x17fa13['id']});});});});});}})['then'](respondWithStatusCode(_0x426ac7,null))[_0x51fc('0x44')](handleError(_0x426ac7,null));};exports[_0x51fc('0x67')]=function(_0xa32294,_0x1eb9fb,_0x4ea029){return db['Team'][_0x51fc('0x5f')]({'where':{'id':_0xa32294[_0x51fc('0x31')][_0x51fc('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x51fc('0x52')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1eb9fb,null))[_0x51fc('0x25')](function(_0x47876a){var _0x3629d9=_['map'](_0x47876a,'id');var _0xe25844=[];var _0x1d43fa=[];var _0x1a36d5=squel['select']();_0x1a36d5[_0x51fc('0x68')](_0x51fc('0x69'))[_0x51fc('0x6a')](_0x51fc('0x6b'),'tq')[_0x51fc('0x6c')](_0x51fc('0x6d'),'ut',_0x51fc('0x6e'))[_0x51fc('0x3d')](_0x51fc('0x6f'),_0xa32294[_0x51fc('0x46')]['id']);for(var _0xa84dcc=0x0;_0xa84dcc<_0x47876a[_0x51fc('0x38')];_0xa84dcc+=0x1){let _0x11979f=_0x47876a[_0xa84dcc];for(var _0x3127fa=0x0;_0x3127fa<_0x11979f[_0x51fc('0x60')][_0x51fc('0x38')];_0x3127fa+=0x1){let _0x4fc52d=_0x11979f[_0x51fc('0x60')][_0x3127fa];var _0x28127d=_0x1a36d5[_0x51fc('0x70')]();_0x28127d[_0x51fc('0x3d')](_0x51fc('0x71'),_0x4fc52d['id']);_0x1d43fa[_0x51fc('0x72')](db[_0x51fc('0x63')][_0x51fc('0x31')](_0x28127d[_0x51fc('0x73')](),{'type':db['sequelize'][_0x51fc('0x74')][_0x51fc('0x75')]})[_0x51fc('0x25')](function(_0x231c69){if(_0x231c69[_0x51fc('0x38')]===0x1){return _0x4fc52d['id'];}else{var _0x30957d=_[_0x51fc('0x76')](_[_0x51fc('0x2e')](_0x231c69,_0x51fc('0x77')),function(_0x2247d5){return _[_0x51fc('0x78')](_0x3629d9,_0x2247d5);});if(_0x30957d){return _0x4fc52d['id'];}}}));}}return BPromise[_0x51fc('0x79')](_0x1d43fa)[_0x51fc('0x25')](function(_0x277813){_0xe25844=_(_0xe25844)[_0x51fc('0x7a')](_0x277813)[_0x51fc('0x7b')]()[_0x51fc('0x7c')]();return db[_0x51fc('0x2f')][_0x51fc('0x49')]({'where':{'id':_0xa32294[_0x51fc('0x46')]['id']}})[_0x51fc('0x25')](function(_0xe164a2){return db[_0x51fc('0x63')][_0x51fc('0x7d')](function(_0x5423e7){return _0xe164a2['removeTeams'](_0xa32294[_0x51fc('0x31')][_0x51fc('0x5e')],{'transaction':_0x5423e7})[_0x51fc('0x25')](function(){if(!_['isEmpty'](_0xe25844)){return _0xe164a2['removeAgents'](_0xe25844,{'transaction':_0x5423e7});}})['then'](function(){_0xe25844[_0x51fc('0x7e')](function(_0x2a8024){socket[_0x51fc('0x65')](_0x51fc('0x7f'),{'UserId':_0x2a8024,'FaxQueueId':_0xe164a2['id']});});});});});});})['then'](respondWithStatusCode(_0x1eb9fb,null))[_0x51fc('0x44')](handleError(_0x1eb9fb,null));};exports['addAgents']=function(_0x4b1fb6,_0x25b3d9,_0x3125a8){return db[_0x51fc('0x2f')][_0x51fc('0x49')]({'where':{'id':_0x4b1fb6[_0x51fc('0x46')]['id']}})[_0x51fc('0x25')](handleEntityNotFound(_0x25b3d9,null))[_0x51fc('0x25')](function(_0x9feeab){if(_0x9feeab){return _0x9feeab[_0x51fc('0x80')](_0x4b1fb6['body']['ids'],_['omit'](_0x4b1fb6['body'],[_0x51fc('0x5e'),'id'])||{})[_0x51fc('0x81')](function(_0x4a4f82){for(var _0x8c033c=0x0;_0x8c033c<_0x4b1fb6[_0x51fc('0x4f')][_0x51fc('0x5e')][_0x51fc('0x38')];_0x8c033c+=0x1){socket[_0x51fc('0x65')](_0x51fc('0x66'),{'UserId':_0x4b1fb6[_0x51fc('0x4f')][_0x51fc('0x5e')][_0x8c033c],'FaxQueueId':_0x4b1fb6[_0x51fc('0x46')]['id']});}return _0x4a4f82;});}})[_0x51fc('0x25')](respondWithResult(_0x25b3d9,null))[_0x51fc('0x44')](handleError(_0x25b3d9,null));};exports['removeAgents']=function(_0x154cf3,_0x196816,_0x364670){return db[_0x51fc('0x2f')][_0x51fc('0x49')]({'where':{'id':_0x154cf3[_0x51fc('0x46')]['id']}})['then'](handleEntityNotFound(_0x196816,null))[_0x51fc('0x25')](function(_0x24c9da){if(_0x24c9da){return _0x24c9da[_0x51fc('0x82')](_0x154cf3['query']['ids'])[_0x51fc('0x25')](function(){if(_['isArray'](_0x154cf3[_0x51fc('0x31')][_0x51fc('0x5e')])){for(var _0x5adc50=0x0;_0x5adc50<_0x154cf3[_0x51fc('0x31')][_0x51fc('0x5e')][_0x51fc('0x38')];_0x5adc50+=0x1){socket[_0x51fc('0x65')]('userFaxQueue:remove',{'UserId':Number(_0x154cf3[_0x51fc('0x31')][_0x51fc('0x5e')][_0x5adc50]),'FaxQueueId':Number(_0x154cf3['params']['id'])});}}else{socket[_0x51fc('0x65')](_0x51fc('0x7f'),{'UserId':Number(_0x154cf3[_0x51fc('0x31')][_0x51fc('0x5e')]),'FaxQueueId':Number(_0x154cf3[_0x51fc('0x46')]['id'])});}});}})[_0x51fc('0x25')](respondWithStatusCode(_0x196816,null))[_0x51fc('0x44')](handleError(_0x196816,null));};exports[_0x51fc('0x83')]=function(_0x417858,_0x2df10a,_0x53c496){var _0x215157={};var _0x332c89={};var _0x2a28e7;var _0x2ebb00;return db['FaxQueue'][_0x51fc('0x50')]({'where':{'id':_0x417858[_0x51fc('0x46')]['id']}})[_0x51fc('0x25')](handleEntityNotFound(_0x2df10a,null))[_0x51fc('0x25')](function(_0x89ded2){if(_0x89ded2){_0x2a28e7=_0x89ded2;_0x332c89[_0x51fc('0x36')]=_['keys'](db[_0x51fc('0x52')][_0x51fc('0x5b')]);_0x332c89['query']=_[_0x51fc('0x32')](_0x417858[_0x51fc('0x31')]);_0x332c89['filters']=_['intersection'](_0x332c89['model'],_0x332c89[_0x51fc('0x31')]);_0x215157[_0x51fc('0x35')]=_[_0x51fc('0x34')](_0x332c89[_0x51fc('0x36')],qs['fields'](_0x417858[_0x51fc('0x31')][_0x51fc('0x37')]));_0x215157['attributes']=_0x215157['attributes'][_0x51fc('0x38')]?_0x215157[_0x51fc('0x35')]:_0x332c89[_0x51fc('0x36')];_0x215157[_0x51fc('0x3b')]=qs[_0x51fc('0x3c')](_0x417858[_0x51fc('0x31')][_0x51fc('0x3c')]);_0x215157['where']=qs[_0x51fc('0x33')](_[_0x51fc('0x3e')](_0x417858[_0x51fc('0x31')],_0x332c89['filters']));if(_0x417858[_0x51fc('0x31')][_0x51fc('0x40')]){_0x215157['where']=_['merge'](_0x215157['where'],{'$or':_['map'](_0x215157[_0x51fc('0x35')],function(_0x2a3817){var _0x284a23={};_0x284a23[_0x2a3817]={'$like':'%'+_0x417858[_0x51fc('0x31')]['filter']+'%'};return _0x284a23;})});}_0x215157=_['merge']({},_0x215157,_0x417858[_0x51fc('0x42')]);return _0x2a28e7['getAgents'](_0x215157);}})[_0x51fc('0x25')](function(_0x3ed22a){if(_0x3ed22a){_0x2ebb00=_0x3ed22a[_0x51fc('0x38')];if(!_0x417858[_0x51fc('0x31')]['hasOwnProperty'](_0x51fc('0x3a'))){_0x215157[_0x51fc('0x1f')]=qs['limit'](_0x417858[_0x51fc('0x31')][_0x51fc('0x1f')]);_0x215157[_0x51fc('0x1e')]=qs['offset'](_0x417858[_0x51fc('0x31')][_0x51fc('0x1e')]);}return _0x2a28e7[_0x51fc('0x83')](_0x215157);}})[_0x51fc('0x25')](function(_0x53cefa){if(_0x53cefa){return _0x53cefa?{'count':_0x2ebb00,'rows':_0x53cefa}:null;}})[_0x51fc('0x25')](respondWithResult(_0x2df10a,null))[_0x51fc('0x44')](handleError(_0x2df10a,null));}; \ No newline at end of file +var _0xa244=['index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxQueue','include','findAll','rows','catch','show','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserFaxQueue','rawAttributes','FaxQueueId','User','findAndCountAll','UserId','faxPause','format','%s/%s','SIP','createdAt','updatedAt','Team','getTeams','addTeams','ids','voicePause','interface','flatMap','Agents','transaction','each','emit','userFaxQueue:save','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','isArray','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','error','name','send'];(function(_0x3d0e9f,_0x3a30cd){var _0x500132=function(_0xb38c4a){while(--_0xb38c4a){_0x3d0e9f['push'](_0x3d0e9f['shift']());}};_0x500132(++_0x3a30cd);}(_0xa244,0xf1));var _0x4a24=function(_0x1fe14f,_0x36745d){_0x1fe14f=_0x1fe14f-0x0;var _0x4c4904=_0xa244[_0x1fe14f];return _0x4c4904;};'use strict';var pdf=require(_0x4a24('0x0'));var emlformat=require(_0x4a24('0x1'));var rimraf=require(_0x4a24('0x2'));var zipdir=require(_0x4a24('0x3'));var jsonpatch=require(_0x4a24('0x4'));var rp=require(_0x4a24('0x5'));var moment=require(_0x4a24('0x6'));var BPromise=require(_0x4a24('0x7'));var Mustache=require(_0x4a24('0x8'));var util=require('util');var path=require('path');var sox=require(_0x4a24('0x9'));var csv=require('to-csv');var ejs=require(_0x4a24('0xa'));var fs=require('fs');var _=require(_0x4a24('0xb'));var squel=require('squel');var crypto=require(_0x4a24('0xc'));var jsforce=require(_0x4a24('0xd'));var deskjs=require(_0x4a24('0xe'));var toCsv=require(_0x4a24('0xf'));var querystring=require(_0x4a24('0x10'));var Papa=require(_0x4a24('0x11'));var Redis=require(_0x4a24('0x12'));var authService=require(_0x4a24('0x13'));var qs=require(_0x4a24('0x14'));var as=require(_0x4a24('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a24('0x16'))(_0x4a24('0x17'));var utils=require(_0x4a24('0x18'));var config=require(_0x4a24('0x19'));var licenseUtil=require(_0x4a24('0x1a'));var db=require(_0x4a24('0x1b'))['db'];config[_0x4a24('0x1c')]=_[_0x4a24('0x1d')](config[_0x4a24('0x1c')],{'host':_0x4a24('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0x4a24('0x1f')](socket);function respondWithStatusCode(_0x562145,_0x5a9250){_0x5a9250=_0x5a9250||0xcc;return function(_0x4bcf17){if(_0x4bcf17){return _0x562145[_0x4a24('0x20')](_0x5a9250);}return _0x562145[_0x4a24('0x21')](_0x5a9250)[_0x4a24('0x22')]();};}function respondWithResult(_0x123b66,_0x130622){_0x130622=_0x130622||0xc8;return function(_0x452ba9){if(_0x452ba9){return _0x123b66['status'](_0x130622)['json'](_0x452ba9);}};}function respondWithFilteredResult(_0x139a21,_0x1a4825){return function(_0x4a1fa8){if(_0x4a1fa8){var _0x310557=_0x4a1fa8[_0x4a24('0x23')],_0x51271b=_0x1a4825[_0x4a24('0x24')],_0x4dafdb=_0x1a4825[_0x4a24('0x24')]+_0x1a4825[_0x4a24('0x25')],_0x15768c;if(_0x4dafdb>=_0x310557){_0x4dafdb=_0x310557;_0x15768c=0xc8;}else{_0x15768c=0xce;}_0x139a21[_0x4a24('0x21')](_0x15768c);return _0x139a21[_0x4a24('0x26')](_0x4a24('0x27'),_0x51271b+'-'+_0x4dafdb+'/'+_0x310557)[_0x4a24('0x28')](_0x4a1fa8);}return null;};}function patchUpdates(_0x377801){return function(_0x1d4661){try{jsonpatch['apply'](_0x1d4661,_0x377801,!![]);}catch(_0x163b97){return BPromise[_0x4a24('0x29')](_0x163b97);}return _0x1d4661[_0x4a24('0x2a')]();};}function saveUpdates(_0x116458,_0x2ce0b8){return function(_0x221e22){if(_0x221e22){return _0x221e22[_0x4a24('0x2b')](_0x116458)[_0x4a24('0x2c')](function(_0x5efde5){return _0x5efde5;});}return null;};}function removeEntity(_0x5f5477,_0x3fbd5d){return function(_0x38edaf){if(_0x38edaf){return _0x38edaf[_0x4a24('0x2d')]()[_0x4a24('0x2c')](function(){var _0xcbe500=_0x38edaf[_0x4a24('0x2e')]({'plain':!![]});var _0x29bc71='FaxQueues';return db[_0x4a24('0x2f')][_0x4a24('0x2d')]({'where':{'type':_0x29bc71,'resourceId':_0xcbe500['id']}})[_0x4a24('0x2c')](function(){return _0x38edaf;});})[_0x4a24('0x2c')](function(){_0x5f5477[_0x4a24('0x21')](0xcc)[_0x4a24('0x22')]();});}};}function handleEntityNotFound(_0x204a90,_0x521969){return function(_0x2f7847){if(!_0x2f7847){_0x204a90[_0x4a24('0x20')](0x194);}return _0x2f7847;};}function handleError(_0xed3c45,_0x595438){_0x595438=_0x595438||0x1f4;return function(_0x678475){logger[_0x4a24('0x30')](_0x678475['stack']);if(_0x678475[_0x4a24('0x31')]){delete _0x678475[_0x4a24('0x31')];}_0xed3c45[_0x4a24('0x21')](_0x595438)[_0x4a24('0x32')](_0x678475);};}exports[_0x4a24('0x33')]=function(_0x21e37a,_0x5ab1ed){var _0xb80f4f={},_0x32b537={},_0x9125e4={'count':0x0,'rows':[]};var _0x56e625=_[_0x4a24('0x34')](db['FaxQueue']['rawAttributes'],function(_0x2a52ba){return{'name':_0x2a52ba[_0x4a24('0x35')],'type':_0x2a52ba[_0x4a24('0x36')][_0x4a24('0x37')]};});_0x32b537[_0x4a24('0x38')]=_[_0x4a24('0x34')](_0x56e625,_0x4a24('0x31'));_0x32b537[_0x4a24('0x39')]=_['keys'](_0x21e37a[_0x4a24('0x39')]);_0x32b537['filters']=_[_0x4a24('0x3a')](_0x32b537['model'],_0x32b537[_0x4a24('0x39')]);_0xb80f4f[_0x4a24('0x3b')]=_[_0x4a24('0x3a')](_0x32b537[_0x4a24('0x38')],qs[_0x4a24('0x3c')](_0x21e37a[_0x4a24('0x39')][_0x4a24('0x3c')]));_0xb80f4f['attributes']=_0xb80f4f[_0x4a24('0x3b')][_0x4a24('0x3d')]?_0xb80f4f[_0x4a24('0x3b')]:_0x32b537[_0x4a24('0x38')];if(!_0x21e37a[_0x4a24('0x39')][_0x4a24('0x3e')](_0x4a24('0x3f'))){_0xb80f4f['limit']=qs['limit'](_0x21e37a[_0x4a24('0x39')]['limit']);_0xb80f4f[_0x4a24('0x24')]=qs[_0x4a24('0x24')](_0x21e37a[_0x4a24('0x39')]['offset']);}_0xb80f4f[_0x4a24('0x40')]=qs[_0x4a24('0x41')](_0x21e37a[_0x4a24('0x39')][_0x4a24('0x41')]);_0xb80f4f[_0x4a24('0x42')]=qs[_0x4a24('0x43')](_[_0x4a24('0x44')](_0x21e37a[_0x4a24('0x39')],_0x32b537['filters']),_0x56e625);if(_0x21e37a['query'][_0x4a24('0x45')]){_0xb80f4f[_0x4a24('0x42')]=_[_0x4a24('0x46')](_0xb80f4f['where'],{'$or':_[_0x4a24('0x34')](_0x56e625,function(_0x4019df){if(_0x4019df[_0x4a24('0x36')]!==_0x4a24('0x47')){var _0x1bbb6b={};_0x1bbb6b[_0x4019df['name']]={'$like':'%'+_0x21e37a[_0x4a24('0x39')][_0x4a24('0x45')]+'%'};return _0x1bbb6b;}})});}_0xb80f4f=_[_0x4a24('0x46')]({},_0xb80f4f,_0x21e37a[_0x4a24('0x48')]);var _0x49344b={'where':_0xb80f4f[_0x4a24('0x42')]};return db[_0x4a24('0x49')][_0x4a24('0x23')](_0x49344b)['then'](function(_0x5226e4){_0x9125e4[_0x4a24('0x23')]=_0x5226e4;if(_0x21e37a['query']['includeAll']){_0xb80f4f[_0x4a24('0x4a')]=[{'all':!![]}];}return db[_0x4a24('0x49')][_0x4a24('0x4b')](_0xb80f4f);})[_0x4a24('0x2c')](function(_0xe04232){_0x9125e4[_0x4a24('0x4c')]=_0xe04232;return _0x9125e4;})[_0x4a24('0x2c')](respondWithFilteredResult(_0x5ab1ed,_0xb80f4f))[_0x4a24('0x4d')](handleError(_0x5ab1ed,null));};exports[_0x4a24('0x4e')]=function(_0x19894c,_0xa255b9){var _0x1f42b1={'raw':!![],'where':{'id':_0x19894c[_0x4a24('0x4f')]['id']}},_0x320273={};_0x320273[_0x4a24('0x38')]=_[_0x4a24('0x50')](db['FaxQueue']['rawAttributes']);_0x320273[_0x4a24('0x39')]=_[_0x4a24('0x50')](_0x19894c['query']);_0x320273[_0x4a24('0x43')]=_[_0x4a24('0x3a')](_0x320273[_0x4a24('0x38')],_0x320273[_0x4a24('0x39')]);_0x1f42b1[_0x4a24('0x3b')]=_[_0x4a24('0x3a')](_0x320273['model'],qs[_0x4a24('0x3c')](_0x19894c[_0x4a24('0x39')][_0x4a24('0x3c')]));_0x1f42b1[_0x4a24('0x3b')]=_0x1f42b1[_0x4a24('0x3b')]['length']?_0x1f42b1['attributes']:_0x320273[_0x4a24('0x38')];if(_0x19894c[_0x4a24('0x39')][_0x4a24('0x51')]){_0x1f42b1[_0x4a24('0x4a')]=[{'all':!![]}];}_0x1f42b1=_[_0x4a24('0x46')]({},_0x1f42b1,_0x19894c['options']);return db[_0x4a24('0x49')][_0x4a24('0x52')](_0x1f42b1)[_0x4a24('0x2c')](handleEntityNotFound(_0xa255b9,null))[_0x4a24('0x2c')](respondWithResult(_0xa255b9,null))['catch'](handleError(_0xa255b9,null));};exports['create']=function(_0x393d08,_0x202400){return db[_0x4a24('0x49')][_0x4a24('0x53')](_0x393d08['body'],{})[_0x4a24('0x2c')](function(_0x59328f){var _0x492dbf=_0x393d08[_0x4a24('0x54')][_0x4a24('0x2e')]({'plain':!![]});if(!_0x492dbf)throw new Error(_0x4a24('0x55'));if(_0x492dbf[_0x4a24('0x56')]==='user'){var _0x1c8bba=_0x59328f[_0x4a24('0x2e')]({'plain':!![]});var _0x33289e=_0x4a24('0x57');return db[_0x4a24('0x58')]['find']({'where':{'name':_0x33289e,'userProfileId':_0x492dbf['userProfileId']},'raw':!![]})['then'](function(_0x2a9e56){if(_0x2a9e56&&_0x2a9e56[_0x4a24('0x59')]===0x0){return db[_0x4a24('0x2f')][_0x4a24('0x53')]({'name':_0x1c8bba['name'],'resourceId':_0x1c8bba['id'],'type':_0x2a9e56[_0x4a24('0x31')],'sectionId':_0x2a9e56['id']},{})[_0x4a24('0x2c')](function(){return _0x59328f;});}else{return _0x59328f;}})[_0x4a24('0x4d')](function(_0x18f795){logger[_0x4a24('0x30')](_0x4a24('0x5a'),_0x18f795);throw _0x18f795;});}return _0x59328f;})[_0x4a24('0x2c')](respondWithResult(_0x202400,0xc9))['catch'](handleError(_0x202400,null));};exports[_0x4a24('0x2b')]=function(_0x5465ce,_0x27f1a9){if(_0x5465ce[_0x4a24('0x5b')]['id']){delete _0x5465ce[_0x4a24('0x5b')]['id'];}return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x5465ce['params']['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x27f1a9,null))[_0x4a24('0x2c')](saveUpdates(_0x5465ce[_0x4a24('0x5b')],null))['then'](respondWithResult(_0x27f1a9,null))[_0x4a24('0x4d')](handleError(_0x27f1a9,null));};exports[_0x4a24('0x2d')]=function(_0x11a26c,_0x3cda12){return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x11a26c[_0x4a24('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3cda12,null))[_0x4a24('0x2c')](removeEntity(_0x3cda12,null))[_0x4a24('0x4d')](handleError(_0x3cda12,null));};exports['describe']=function(_0x18ad42,_0x46ca4f){return db[_0x4a24('0x49')][_0x4a24('0x5c')]()[_0x4a24('0x2c')](respondWithResult(_0x46ca4f,null))[_0x4a24('0x4d')](handleError(_0x46ca4f,null));};exports['getMembers']=function(_0x25c3df,_0xbcbab9,_0x16aaf0){var _0x110484={'raw':!![],'where':{}},_0x2abe28={},_0x1d5b70;return db['FaxQueue'][_0x4a24('0x5d')]({'where':{'id':_0x25c3df['params']['id']}})['then'](handleEntityNotFound(_0xbcbab9,null))[_0x4a24('0x2c')](function(_0x25329a){if(_0x25329a){_0x1d5b70=_0x25329a[_0x4a24('0x2e')]({'plain':!![]});_0x2abe28[_0x4a24('0x38')]=_[_0x4a24('0x50')](db[_0x4a24('0x5e')][_0x4a24('0x5f')]);_0x2abe28[_0x4a24('0x39')]=_[_0x4a24('0x50')](_0x25c3df[_0x4a24('0x39')]);_0x2abe28[_0x4a24('0x43')]=_['intersection'](_0x2abe28[_0x4a24('0x38')],_0x2abe28[_0x4a24('0x39')]);_0x110484['attributes']=_['intersection'](_0x2abe28[_0x4a24('0x38')],qs[_0x4a24('0x3c')](_0x25c3df[_0x4a24('0x39')]['fields']));_0x110484[_0x4a24('0x3b')]=_0x110484[_0x4a24('0x3b')][_0x4a24('0x3d')]?_0x110484[_0x4a24('0x3b')]:_0x2abe28['model'];if(!_0x25c3df[_0x4a24('0x39')][_0x4a24('0x3e')](_0x4a24('0x3f'))){_0x110484[_0x4a24('0x25')]=qs[_0x4a24('0x25')](_0x25c3df[_0x4a24('0x39')]['limit']);_0x110484[_0x4a24('0x24')]=qs[_0x4a24('0x24')](_0x25c3df[_0x4a24('0x39')]['offset']);}_0x110484[_0x4a24('0x40')]=qs[_0x4a24('0x41')](_0x25c3df[_0x4a24('0x39')][_0x4a24('0x41')]);_0x110484['where']=qs[_0x4a24('0x43')](_['pick'](_0x25c3df[_0x4a24('0x39')],_0x2abe28[_0x4a24('0x43')]));_0x110484[_0x4a24('0x42')][_0x4a24('0x60')]=_0x25329a['id'];if(_0x25c3df[_0x4a24('0x39')]['filter']){_0x110484[_0x4a24('0x42')]=_[_0x4a24('0x46')](_0x110484[_0x4a24('0x42')],{'$or':_[_0x4a24('0x34')](_0x110484[_0x4a24('0x3b')],function(_0x400630){var _0x2ea5c3={};_0x2ea5c3[_0x400630]={'$like':'%'+_0x25c3df[_0x4a24('0x39')][_0x4a24('0x45')]+'%'};return _0x2ea5c3;})});}_0x110484=_[_0x4a24('0x46')]({},_0x110484,_0x25c3df[_0x4a24('0x48')]);return db['UserFaxQueue'][_0x4a24('0x4b')](_0x110484);}})[_0x4a24('0x2c')](function(_0x7030b3){if(_0x7030b3){return db[_0x4a24('0x61')][_0x4a24('0x62')]({'where':{'id':_[_0x4a24('0x34')](_0x7030b3,_0x4a24('0x63')),'role':'agent'},'attributes':['id',_0x4a24('0x31'),_0x4a24('0x64'),'updatedAt','createdAt']});}})[_0x4a24('0x2c')](function(_0x27c703){if(_0x27c703){return{'count':_0x27c703['count'],'rows':_[_0x4a24('0x34')](_0x27c703[_0x4a24('0x4c')],function(_0x29d2ed){return{'membername':_0x29d2ed[_0x4a24('0x31')],'UserId':_0x29d2ed['id'],'queue_name':_0x1d5b70[_0x4a24('0x31')],'FaxQueueId':_0x1d5b70['id'],'interface':util[_0x4a24('0x65')](_0x4a24('0x66'),_0x4a24('0x67'),_0x29d2ed[_0x4a24('0x31')]),'penalty':0x0,'paused':_0x29d2ed['faxPause'],'createdAt':_0x29d2ed[_0x4a24('0x68')],'updatedAt':_0x29d2ed[_0x4a24('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xbcbab9,_0x110484))[_0x4a24('0x4d')](handleError(_0xbcbab9,null));};exports['getTeams']=function(_0x58bb03,_0x4a8275,_0x3324e4){var _0x425957={};var _0x1012fa={};var _0x2dd83d;var _0x1e0b6c;return db[_0x4a24('0x49')]['findOne']({'where':{'id':_0x58bb03[_0x4a24('0x4f')]['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x4a8275,null))[_0x4a24('0x2c')](function(_0x5557cf){if(_0x5557cf){_0x2dd83d=_0x5557cf;_0x1012fa[_0x4a24('0x38')]=_[_0x4a24('0x50')](db[_0x4a24('0x6a')][_0x4a24('0x5f')]);_0x1012fa[_0x4a24('0x39')]=_[_0x4a24('0x50')](_0x58bb03['query']);_0x1012fa[_0x4a24('0x43')]=_['intersection'](_0x1012fa[_0x4a24('0x38')],_0x1012fa['query']);_0x425957['attributes']=_[_0x4a24('0x3a')](_0x1012fa[_0x4a24('0x38')],qs[_0x4a24('0x3c')](_0x58bb03[_0x4a24('0x39')][_0x4a24('0x3c')]));_0x425957['attributes']=_0x425957[_0x4a24('0x3b')][_0x4a24('0x3d')]?_0x425957[_0x4a24('0x3b')]:_0x1012fa[_0x4a24('0x38')];_0x425957[_0x4a24('0x40')]=qs[_0x4a24('0x41')](_0x58bb03[_0x4a24('0x39')][_0x4a24('0x41')]);_0x425957[_0x4a24('0x42')]=qs[_0x4a24('0x43')](_[_0x4a24('0x44')](_0x58bb03[_0x4a24('0x39')],_0x1012fa['filters']));if(_0x58bb03[_0x4a24('0x39')][_0x4a24('0x45')]){_0x425957['where']=_['merge'](_0x425957[_0x4a24('0x42')],{'$or':_[_0x4a24('0x34')](_0x425957[_0x4a24('0x3b')],function(_0x5a9228){var _0x277829={};_0x277829[_0x5a9228]={'$like':'%'+_0x58bb03[_0x4a24('0x39')][_0x4a24('0x45')]+'%'};return _0x277829;})});}_0x425957=_[_0x4a24('0x46')]({},_0x425957,_0x58bb03[_0x4a24('0x48')]);return _0x2dd83d[_0x4a24('0x6b')](_0x425957);}})[_0x4a24('0x2c')](function(_0x1d9725){if(_0x1d9725){_0x1e0b6c=_0x1d9725[_0x4a24('0x3d')];if(!_0x58bb03[_0x4a24('0x39')]['hasOwnProperty'](_0x4a24('0x3f'))){_0x425957[_0x4a24('0x25')]=qs[_0x4a24('0x25')](_0x58bb03[_0x4a24('0x39')][_0x4a24('0x25')]);_0x425957['offset']=qs[_0x4a24('0x24')](_0x58bb03[_0x4a24('0x39')][_0x4a24('0x24')]);}return _0x2dd83d['getTeams'](_0x425957);}})[_0x4a24('0x2c')](function(_0x1a52fb){if(_0x1a52fb){return _0x1a52fb?{'count':_0x1e0b6c,'rows':_0x1a52fb}:null;}})['then'](respondWithResult(_0x4a8275,null))[_0x4a24('0x4d')](handleError(_0x4a8275,null));};exports[_0x4a24('0x6c')]=function(_0x1a4e99,_0x12e03b,_0x410173){var _0xef19ec=_0x1a4e99[_0x4a24('0x5b')][_0x4a24('0x6d')];return db['Team'][_0x4a24('0x4b')]({'where':{'id':_0xef19ec},'attributes':['id'],'include':[{'model':db[_0x4a24('0x61')],'as':'Agents','attributes':['id',_0x4a24('0x31'),'online',_0x4a24('0x6e'),_0x4a24('0x6f')],'raw':!![]}]})[_0x4a24('0x2c')](function(_0x11e21c){if(_0x11e21c){var _0x2ec058=_[_0x4a24('0x70')](_0x11e21c,function(_0xf7f7f4){var _0x453e7a=_0xf7f7f4[_0x4a24('0x2e')]({'plain':!![]});return _0x453e7a[_0x4a24('0x71')];});return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x1a4e99['params']['id']}})['then'](function(_0x144656){return db['sequelize'][_0x4a24('0x72')](function(_0x12fc8e){return _0x144656[_0x4a24('0x6c')](_0xef19ec,{'transaction':_0x12fc8e})[_0x4a24('0x2c')](function(){return BPromise[_0x4a24('0x73')](_0x2ec058,function(_0x2b521d){return db[_0x4a24('0x5e')]['findOrCreate']({'where':{'UserId':_0x2b521d['id'],'FaxQueueId':_0x1a4e99[_0x4a24('0x4f')]['id']},'transaction':_0x12fc8e});});})[_0x4a24('0x2c')](function(){_0x2ec058['forEach'](function(_0x29a008){socket[_0x4a24('0x74')](_0x4a24('0x75'),{'UserId':_0x29a008['id'],'FaxQueueId':_0x144656['id']});});});});});}})[_0x4a24('0x2c')](respondWithStatusCode(_0x12e03b,null))[_0x4a24('0x4d')](handleError(_0x12e03b,null));};exports['removeTeams']=function(_0x162b46,_0x5d687c,_0x3df962){return db[_0x4a24('0x6a')][_0x4a24('0x4b')]({'where':{'id':_0x162b46[_0x4a24('0x39')][_0x4a24('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x4a24('0x61')],'as':_0x4a24('0x71'),'attributes':['id'],'raw':!![]}]})[_0x4a24('0x2c')](handleEntityNotFound(_0x5d687c,null))[_0x4a24('0x2c')](function(_0x78f8d9){var _0x6b13c2=_[_0x4a24('0x34')](_0x78f8d9,'id');var _0x1609ae=[];var _0x4a2931=[];var _0xe6387a=squel[_0x4a24('0x76')]();_0xe6387a[_0x4a24('0x77')]('tq.TeamId')[_0x4a24('0x78')](_0x4a24('0x79'),'tq')[_0x4a24('0x7a')](_0x4a24('0x7b'),'ut',_0x4a24('0x7c'))[_0x4a24('0x42')](_0x4a24('0x7d'),_0x162b46[_0x4a24('0x4f')]['id']);for(var _0x333631=0x0;_0x333631<_0x78f8d9['length'];_0x333631+=0x1){let _0x472086=_0x78f8d9[_0x333631];for(var _0x196c03=0x0;_0x196c03<_0x472086[_0x4a24('0x71')]['length'];_0x196c03+=0x1){let _0x3caac7=_0x472086['Agents'][_0x196c03];var _0x59b470=_0xe6387a[_0x4a24('0x7e')]();_0x59b470[_0x4a24('0x42')](_0x4a24('0x7f'),_0x3caac7['id']);_0x4a2931[_0x4a24('0x80')](db[_0x4a24('0x81')][_0x4a24('0x39')](_0x59b470[_0x4a24('0x82')](),{'type':db['sequelize']['QueryTypes'][_0x4a24('0x83')]})[_0x4a24('0x2c')](function(_0x489910){if(_0x489910[_0x4a24('0x3d')]===0x1){return _0x3caac7['id'];}else{var _0x51c436=_['every'](_[_0x4a24('0x34')](_0x489910,_0x4a24('0x84')),function(_0x2efab1){return _[_0x4a24('0x85')](_0x6b13c2,_0x2efab1);});if(_0x51c436){return _0x3caac7['id'];}}}));}}return BPromise[_0x4a24('0x86')](_0x4a2931)['then'](function(_0x385961){_0x1609ae=_(_0x1609ae)[_0x4a24('0x87')](_0x385961)[_0x4a24('0x88')]()[_0x4a24('0x89')]();return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x162b46[_0x4a24('0x4f')]['id']}})[_0x4a24('0x2c')](function(_0x4456c8){return db['sequelize']['transaction'](function(_0x52ef0b){return _0x4456c8[_0x4a24('0x8a')](_0x162b46[_0x4a24('0x39')][_0x4a24('0x6d')],{'transaction':_0x52ef0b})[_0x4a24('0x2c')](function(){if(!_[_0x4a24('0x8b')](_0x1609ae)){return _0x4456c8[_0x4a24('0x8c')](_0x1609ae,{'transaction':_0x52ef0b});}})[_0x4a24('0x2c')](function(){_0x1609ae[_0x4a24('0x8d')](function(_0x585602){socket[_0x4a24('0x74')]('userFaxQueue:remove',{'UserId':_0x585602,'FaxQueueId':_0x4456c8['id']});});});});});});})[_0x4a24('0x2c')](respondWithStatusCode(_0x5d687c,null))[_0x4a24('0x4d')](handleError(_0x5d687c,null));};exports[_0x4a24('0x8e')]=function(_0x960f73,_0x148625,_0xc9b317){return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x960f73[_0x4a24('0x4f')]['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x148625,null))[_0x4a24('0x2c')](function(_0x42b6d4){if(_0x42b6d4){return _0x42b6d4[_0x4a24('0x8e')](_0x960f73[_0x4a24('0x5b')][_0x4a24('0x6d')],_['omit'](_0x960f73[_0x4a24('0x5b')],[_0x4a24('0x6d'),'id'])||{})['spread'](function(_0x5b9834){for(var _0xc2c140=0x0;_0xc2c140<_0x960f73[_0x4a24('0x5b')][_0x4a24('0x6d')][_0x4a24('0x3d')];_0xc2c140+=0x1){socket['emit'](_0x4a24('0x75'),{'UserId':_0x960f73['body']['ids'][_0xc2c140],'FaxQueueId':_0x960f73[_0x4a24('0x4f')]['id']});}return _0x5b9834;});}})[_0x4a24('0x2c')](respondWithResult(_0x148625,null))[_0x4a24('0x4d')](handleError(_0x148625,null));};exports[_0x4a24('0x8c')]=function(_0x2f5a31,_0x7a60b0,_0x26ba7d){return db[_0x4a24('0x49')]['find']({'where':{'id':_0x2f5a31[_0x4a24('0x4f')]['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x7a60b0,null))[_0x4a24('0x2c')](function(_0x34c0a8){if(_0x34c0a8){return _0x34c0a8[_0x4a24('0x8c')](_0x2f5a31['query'][_0x4a24('0x6d')])[_0x4a24('0x2c')](function(){if(_[_0x4a24('0x8f')](_0x2f5a31[_0x4a24('0x39')][_0x4a24('0x6d')])){for(var _0x4907a7=0x0;_0x4907a7<_0x2f5a31[_0x4a24('0x39')]['ids'][_0x4a24('0x3d')];_0x4907a7+=0x1){socket[_0x4a24('0x74')]('userFaxQueue:remove',{'UserId':Number(_0x2f5a31[_0x4a24('0x39')][_0x4a24('0x6d')][_0x4907a7]),'FaxQueueId':Number(_0x2f5a31[_0x4a24('0x4f')]['id'])});}}else{socket[_0x4a24('0x74')](_0x4a24('0x90'),{'UserId':Number(_0x2f5a31[_0x4a24('0x39')][_0x4a24('0x6d')]),'FaxQueueId':Number(_0x2f5a31[_0x4a24('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x7a60b0,null))[_0x4a24('0x4d')](handleError(_0x7a60b0,null));};exports[_0x4a24('0x91')]=function(_0x372aec,_0x4d7bd2,_0x58ae85){var _0x5813f8={};var _0x4afabf={};var _0x47abc8;var _0x250b1a;return db[_0x4a24('0x49')][_0x4a24('0x5d')]({'where':{'id':_0x372aec['params']['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x4d7bd2,null))[_0x4a24('0x2c')](function(_0x32ad5f){if(_0x32ad5f){_0x47abc8=_0x32ad5f;_0x4afabf[_0x4a24('0x38')]=_['keys'](db['User'][_0x4a24('0x5f')]);_0x4afabf['query']=_[_0x4a24('0x50')](_0x372aec[_0x4a24('0x39')]);_0x4afabf[_0x4a24('0x43')]=_['intersection'](_0x4afabf[_0x4a24('0x38')],_0x4afabf[_0x4a24('0x39')]);_0x5813f8[_0x4a24('0x3b')]=_[_0x4a24('0x3a')](_0x4afabf[_0x4a24('0x38')],qs[_0x4a24('0x3c')](_0x372aec[_0x4a24('0x39')][_0x4a24('0x3c')]));_0x5813f8[_0x4a24('0x3b')]=_0x5813f8[_0x4a24('0x3b')]['length']?_0x5813f8[_0x4a24('0x3b')]:_0x4afabf['model'];_0x5813f8[_0x4a24('0x40')]=qs[_0x4a24('0x41')](_0x372aec[_0x4a24('0x39')][_0x4a24('0x41')]);_0x5813f8[_0x4a24('0x42')]=qs[_0x4a24('0x43')](_[_0x4a24('0x44')](_0x372aec['query'],_0x4afabf[_0x4a24('0x43')]));if(_0x372aec[_0x4a24('0x39')][_0x4a24('0x45')]){_0x5813f8[_0x4a24('0x42')]=_[_0x4a24('0x46')](_0x5813f8[_0x4a24('0x42')],{'$or':_[_0x4a24('0x34')](_0x5813f8[_0x4a24('0x3b')],function(_0x305afb){var _0x48d0a4={};_0x48d0a4[_0x305afb]={'$like':'%'+_0x372aec['query'][_0x4a24('0x45')]+'%'};return _0x48d0a4;})});}_0x5813f8=_[_0x4a24('0x46')]({},_0x5813f8,_0x372aec[_0x4a24('0x48')]);return _0x47abc8['getAgents'](_0x5813f8);}})[_0x4a24('0x2c')](function(_0x490a28){if(_0x490a28){_0x250b1a=_0x490a28['length'];if(!_0x372aec['query'][_0x4a24('0x3e')](_0x4a24('0x3f'))){_0x5813f8[_0x4a24('0x25')]=qs[_0x4a24('0x25')](_0x372aec[_0x4a24('0x39')][_0x4a24('0x25')]);_0x5813f8['offset']=qs['offset'](_0x372aec[_0x4a24('0x39')][_0x4a24('0x24')]);}return _0x47abc8['getAgents'](_0x5813f8);}})[_0x4a24('0x2c')](function(_0x437646){if(_0x437646){return _0x437646?{'count':_0x250b1a,'rows':_0x437646}:null;}})['then'](respondWithResult(_0x4d7bd2,null))[_0x4a24('0x4d')](handleError(_0x4d7bd2,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 00aa85a..59948cd 100644 --- a/server/api/faxQueue/faxQueue.events.js +++ b/server/api/faxQueue/faxQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56cc=['update','remove','emit','hook','exports','../../mysqldb','FaxQueue'];(function(_0x38c2a3,_0x55a392){var _0xd7ac3d=function(_0x392f41){while(--_0x392f41){_0x38c2a3['push'](_0x38c2a3['shift']());}};_0xd7ac3d(++_0x55a392);}(_0x56cc,0xa6));var _0xc56c=function(_0x26de78,_0x1c8d08){_0x26de78=_0x26de78-0x0;var _0x1b6fee=_0x56cc[_0x26de78];return _0x1b6fee;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xc56c('0x0'))['db'][_0xc56c('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc56c('0x2'),'afterDestroy':_0xc56c('0x3')};function emitEvent(_0x5575cc){return function(_0x1e4edc,_0x2d43d0,_0x594ffd){FaxQueueEvents[_0xc56c('0x4')](_0x5575cc+':'+_0x1e4edc['id'],_0x1e4edc);FaxQueueEvents[_0xc56c('0x4')](_0x5575cc,_0x1e4edc);_0x594ffd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xc56c('0x5')](e,emitEvent(event));}}module[_0xc56c('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0xd399=['save','update','remove','emit','hook','exports','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0xd399,0x1a4));var _0x9d39=function(_0x3e16bb,_0x11045c){_0x3e16bb=_0x3e16bb-0x0;var _0x19d8db=_0xd399[_0x3e16bb];return _0x19d8db;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x9d39('0x0'))['db'][_0x9d39('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9d39('0x2')](0x0);var events={'afterCreate':_0x9d39('0x3'),'afterUpdate':_0x9d39('0x4'),'afterDestroy':_0x9d39('0x5')};function emitEvent(_0x1cda69){return function(_0x27e5bc,_0x5ab51a,_0x5454cf){FaxQueueEvents[_0x9d39('0x6')](_0x1cda69+':'+_0x27e5bc['id'],_0x27e5bc);FaxQueueEvents[_0x9d39('0x6')](_0x1cda69,_0x27e5bc);_0x5454cf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x9d39('0x7')](e,emitEvent(event));}}module[_0x9d39('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 8f7c492..5629648 100644 --- a/server/api/faxQueue/faxQueue.model.js +++ b/server/api/faxQueue/faxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f16=['rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0xe10ccd,_0x57b23a){var _0x13e5aa=function(_0x3c97b5){while(--_0x3c97b5){_0xe10ccd['push'](_0xe10ccd['shift']());}};_0x13e5aa(++_0x57b23a);}(_0x0f16,0x1db));var _0x60f1=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0f16[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x60f1('0x0'));var util=require(_0x60f1('0x1'));var logger=require(_0x60f1('0x2'))('api');var moment=require(_0x60f1('0x3'));var BPromise=require(_0x60f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x60f1('0x5'));var config=require(_0x60f1('0x6'));var attributes=require(_0x60f1('0x7'));module[_0x60f1('0x8')]=function(_0x539df3,_0x42f977){return _0x539df3['define'](_0x60f1('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdeee=['fax_queues','util','../../config/logger','api','bluebird','request-promise','exports','define','FaxQueue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdeee,0xeb));var _0xedee=function(_0x2c54d3,_0x1bf001){_0x2c54d3=_0x2c54d3-0x0;var _0x5d62c8=_0xdeee[_0x2c54d3];return _0x5d62c8;};'use strict';var _=require('lodash');var util=require(_0xedee('0x0'));var logger=require(_0xedee('0x1'))(_0xedee('0x2'));var moment=require('moment');var BPromise=require(_0xedee('0x3'));var rp=require(_0xedee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xedee('0x5')]=function(_0xec8ee0,_0x569234){return _0xec8ee0[_0xedee('0x6')](_0xedee('0x7'),attributes,{'tableName':_0xedee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 097af2b..4a4a7e9 100644 --- a/server/api/faxQueue/faxQueue.rpc.js +++ b/server/api/faxQueue/faxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf12d=['model','debug','FaxQueue','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','options','raw','where','attributes','limit','include','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf12d,0x79));var _0xdf12=function(_0x5103f4,_0x751234){_0x5103f4=_0x5103f4-0x0;var _0x47cd0f=_0xf12d[_0x5103f4];return _0x47cd0f;};'use strict';var _=require(_0xdf12('0x0'));var util=require(_0xdf12('0x1'));var moment=require(_0xdf12('0x2'));var BPromise=require(_0xdf12('0x3'));var rs=require(_0xdf12('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf12('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf12('0x6'));var config=require(_0xdf12('0x7'));var jayson=require(_0xdf12('0x8'));var client=jayson[_0xdf12('0x9')]['http']({'port':0x232a});config[_0xdf12('0xa')]=_[_0xdf12('0xb')](config[_0xdf12('0xa')],{'host':_0xdf12('0xc'),'port':0x18eb});var socket=require(_0xdf12('0xd'))(new Redis(config[_0xdf12('0xa')]));require(_0xdf12('0xe'))[_0xdf12('0xf')](socket);function respondWithRpcPromise(_0x175d72,_0x30a2ba,_0x463f5a){return new BPromise(function(_0x2fc24a,_0x2b88eb){return client['request'](_0x175d72,_0x463f5a)[_0xdf12('0x10')](function(_0x57e16e){logger[_0xdf12('0x11')](_0xdf12('0x12'),_0x30a2ba,_0xdf12('0x13'));logger['debug'](_0xdf12('0x14'),_0x30a2ba,_0xdf12('0x13'),JSON[_0xdf12('0x15')](_0x57e16e));if(_0x57e16e['error']){if(_0x57e16e[_0xdf12('0x16')][_0xdf12('0x17')]===0x1f4){logger[_0xdf12('0x16')](_0xdf12('0x12'),_0x30a2ba,_0x57e16e['error'][_0xdf12('0x18')]);return _0x2b88eb(_0x57e16e['error']['message']);}logger[_0xdf12('0x16')](_0xdf12('0x12'),_0x30a2ba,_0x57e16e['error'][_0xdf12('0x18')]);return _0x2fc24a(_0x57e16e['error'][_0xdf12('0x18')]);}else{logger[_0xdf12('0x11')]('FaxQueue,\x20%s,\x20%s',_0x30a2ba,_0xdf12('0x13'));_0x2fc24a(_0x57e16e[_0xdf12('0x19')]['message']);}})[_0xdf12('0x1a')](function(_0x3a4e97){logger[_0xdf12('0x16')]('FaxQueue,\x20%s,\x20%s',_0x30a2ba,_0x3a4e97);_0x2b88eb(_0x3a4e97);});});}exports[_0xdf12('0x1b')]=function(_0x39c5cd){var _0x113930=this;return new Promise(function(_0x263418,_0x30695a){return db['FaxQueue']['findAll']({'raw':_0x39c5cd[_0xdf12('0x1c')]?_0x39c5cd['options'][_0xdf12('0x1d')]===undefined?!![]:![]:!![],'where':_0x39c5cd[_0xdf12('0x1c')]?_0x39c5cd['options'][_0xdf12('0x1e')]||null:null,'attributes':_0x39c5cd[_0xdf12('0x1c')]?_0x39c5cd['options'][_0xdf12('0x1f')]||null:null,'limit':_0x39c5cd[_0xdf12('0x1c')]?_0x39c5cd[_0xdf12('0x1c')][_0xdf12('0x20')]||null:null,'include':_0x39c5cd[_0xdf12('0x1c')]?_0x39c5cd[_0xdf12('0x1c')][_0xdf12('0x21')]?_[_0xdf12('0x22')](_0x39c5cd[_0xdf12('0x1c')][_0xdf12('0x21')],function(_0x57951e){return{'model':db[_0x57951e[_0xdf12('0x23')]],'as':_0x57951e['as'],'attributes':_0x57951e[_0xdf12('0x1f')],'include':_0x57951e[_0xdf12('0x21')]?_['map'](_0x57951e[_0xdf12('0x21')],function(_0x32adf5){return{'model':db[_0x32adf5[_0xdf12('0x23')]],'as':_0x32adf5['as'],'attributes':_0x32adf5['attributes'],'include':_0x32adf5[_0xdf12('0x21')]?_[_0xdf12('0x22')](_0x32adf5[_0xdf12('0x21')],function(_0x8ae96f){return{'model':db[_0x8ae96f[_0xdf12('0x23')]],'as':_0x8ae96f['as'],'attributes':_0x8ae96f[_0xdf12('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdf12('0x10')](function(_0x2dcb22){logger['info']('GetFaxQueue',_0x39c5cd);logger[_0xdf12('0x24')](_0xdf12('0x1b'),_0x39c5cd,JSON['stringify'](_0x2dcb22));_0x263418(_0x2dcb22);})[_0xdf12('0x1a')](function(_0x3c2dc4){logger[_0xdf12('0x16')]('GetFaxQueue',_0x3c2dc4[_0xdf12('0x18')],_0x39c5cd);_0x30695a(_0x113930[_0xdf12('0x16')](0x1f4,_0x3c2dc4['message']));});});};exports['ShowFaxQueue']=function(_0x16b938){var _0x18a83e=this;return new Promise(function(_0x2b5a67,_0x44b6fa){return db[_0xdf12('0x25')]['find']({'raw':_0x16b938['options']?_0x16b938[_0xdf12('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x16b938[_0xdf12('0x1c')]?_0x16b938['options'][_0xdf12('0x1e')]||null:null,'attributes':_0x16b938[_0xdf12('0x1c')]?_0x16b938[_0xdf12('0x1c')][_0xdf12('0x1f')]||null:null,'include':_0x16b938[_0xdf12('0x1c')]?_0x16b938[_0xdf12('0x1c')][_0xdf12('0x21')]?_['map'](_0x16b938[_0xdf12('0x1c')][_0xdf12('0x21')],function(_0x2d6ded){return{'model':db[_0x2d6ded['model']],'as':_0x2d6ded['as'],'attributes':_0x2d6ded[_0xdf12('0x1f')],'include':_0x2d6ded[_0xdf12('0x21')]?_['map'](_0x2d6ded[_0xdf12('0x21')],function(_0x47aa46){return{'model':db[_0x47aa46['model']],'as':_0x47aa46['as'],'attributes':_0x47aa46[_0xdf12('0x1f')],'include':_0x47aa46['include']?_['map'](_0x47aa46['include'],function(_0x5ec7f9){return{'model':db[_0x5ec7f9[_0xdf12('0x23')]],'as':_0x5ec7f9['as'],'attributes':_0x5ec7f9[_0xdf12('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x132725){logger['info']('ShowFaxQueue',_0x16b938);logger[_0xdf12('0x24')](_0xdf12('0x26'),_0x16b938,JSON[_0xdf12('0x15')](_0x132725));_0x2b5a67(_0x132725);})['catch'](function(_0x27fb89){logger[_0xdf12('0x16')](_0xdf12('0x26'),_0x27fb89[_0xdf12('0x18')],_0x16b938);_0x44b6fa(_0x18a83e['error'](0x1f4,_0x27fb89[_0xdf12('0x18')]));});});}; \ No newline at end of file +var _0x343b=['FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','include','map','model','attributes','info','find','raw','ShowFaxQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','register','then'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x343b,0x1ae));var _0xb343=function(_0x45f0b3,_0x20e607){_0x45f0b3=_0x45f0b3-0x0;var _0x1ab605=_0x343b[_0x45f0b3];return _0x1ab605;};'use strict';var _=require('lodash');var util=require(_0xb343('0x0'));var moment=require(_0xb343('0x1'));var BPromise=require(_0xb343('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb343('0x3'));var db=require(_0xb343('0x4'))['db'];var utils=require(_0xb343('0x5'));var logger=require(_0xb343('0x6'))(_0xb343('0x7'));var config=require(_0xb343('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb343('0x9')]['http']({'port':0x232a});config[_0xb343('0xa')]=_[_0xb343('0xb')](config[_0xb343('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0xb343('0xc')](socket);function respondWithRpcPromise(_0x5a5b0f,_0x2b9ac7,_0xdbbf6b){return new BPromise(function(_0x158e15,_0x3a8b66){return client['request'](_0x5a5b0f,_0xdbbf6b)[_0xb343('0xd')](function(_0x3fd3d1){logger['info'](_0xb343('0xe'),_0x2b9ac7,_0xb343('0xf'));logger[_0xb343('0x10')](_0xb343('0x11'),_0x2b9ac7,_0xb343('0xf'),JSON[_0xb343('0x12')](_0x3fd3d1));if(_0x3fd3d1['error']){if(_0x3fd3d1[_0xb343('0x13')]['code']===0x1f4){logger['error'](_0xb343('0xe'),_0x2b9ac7,_0x3fd3d1[_0xb343('0x13')][_0xb343('0x14')]);return _0x3a8b66(_0x3fd3d1[_0xb343('0x13')][_0xb343('0x14')]);}logger[_0xb343('0x13')](_0xb343('0xe'),_0x2b9ac7,_0x3fd3d1[_0xb343('0x13')]['message']);return _0x158e15(_0x3fd3d1[_0xb343('0x13')][_0xb343('0x14')]);}else{logger['info'](_0xb343('0xe'),_0x2b9ac7,_0xb343('0xf'));_0x158e15(_0x3fd3d1[_0xb343('0x15')][_0xb343('0x14')]);}})[_0xb343('0x16')](function(_0x4b5839){logger['error'](_0xb343('0xe'),_0x2b9ac7,_0x4b5839);_0x3a8b66(_0x4b5839);});});}exports[_0xb343('0x17')]=function(_0x2b0c47){var _0x561e86=this;return new Promise(function(_0x4fba58,_0x3d2cfe){return db[_0xb343('0x18')][_0xb343('0x19')]({'raw':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47[_0xb343('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47['options'][_0xb343('0x1b')]||null:null,'attributes':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47[_0xb343('0x1a')]['attributes']||null:null,'limit':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47[_0xb343('0x1a')][_0xb343('0x1c')]||null:null,'include':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47[_0xb343('0x1a')][_0xb343('0x1d')]?_[_0xb343('0x1e')](_0x2b0c47[_0xb343('0x1a')][_0xb343('0x1d')],function(_0x4f9853){return{'model':db[_0x4f9853[_0xb343('0x1f')]],'as':_0x4f9853['as'],'attributes':_0x4f9853[_0xb343('0x20')],'include':_0x4f9853['include']?_[_0xb343('0x1e')](_0x4f9853['include'],function(_0x76fefa){return{'model':db[_0x76fefa[_0xb343('0x1f')]],'as':_0x76fefa['as'],'attributes':_0x76fefa['attributes'],'include':_0x76fefa[_0xb343('0x1d')]?_[_0xb343('0x1e')](_0x76fefa['include'],function(_0x555753){return{'model':db[_0x555753[_0xb343('0x1f')]],'as':_0x555753['as'],'attributes':_0x555753[_0xb343('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5780a5){logger[_0xb343('0x21')](_0xb343('0x17'),_0x2b0c47);logger['debug']('GetFaxQueue',_0x2b0c47,JSON[_0xb343('0x12')](_0x5780a5));_0x4fba58(_0x5780a5);})[_0xb343('0x16')](function(_0x4affb7){logger['error']('GetFaxQueue',_0x4affb7[_0xb343('0x14')],_0x2b0c47);_0x3d2cfe(_0x561e86['error'](0x1f4,_0x4affb7[_0xb343('0x14')]));});});};exports['ShowFaxQueue']=function(_0x16dd2e){var _0x5d0ca6=this;return new Promise(function(_0x47638d,_0x42ae47){return db[_0xb343('0x18')][_0xb343('0x22')]({'raw':_0x16dd2e[_0xb343('0x1a')]?_0x16dd2e[_0xb343('0x1a')][_0xb343('0x23')]===undefined?!![]:![]:!![],'where':_0x16dd2e['options']?_0x16dd2e[_0xb343('0x1a')][_0xb343('0x1b')]||null:null,'attributes':_0x16dd2e['options']?_0x16dd2e['options']['attributes']||null:null,'include':_0x16dd2e['options']?_0x16dd2e['options'][_0xb343('0x1d')]?_[_0xb343('0x1e')](_0x16dd2e[_0xb343('0x1a')][_0xb343('0x1d')],function(_0x48e94f){return{'model':db[_0x48e94f[_0xb343('0x1f')]],'as':_0x48e94f['as'],'attributes':_0x48e94f[_0xb343('0x20')],'include':_0x48e94f[_0xb343('0x1d')]?_['map'](_0x48e94f[_0xb343('0x1d')],function(_0x210894){return{'model':db[_0x210894[_0xb343('0x1f')]],'as':_0x210894['as'],'attributes':_0x210894['attributes'],'include':_0x210894[_0xb343('0x1d')]?_[_0xb343('0x1e')](_0x210894['include'],function(_0x3494ee){return{'model':db[_0x3494ee[_0xb343('0x1f')]],'as':_0x3494ee['as'],'attributes':_0x3494ee['attributes']};}):[]};}):[]};}):[]:[]})[_0xb343('0xd')](function(_0x439910){logger[_0xb343('0x21')](_0xb343('0x24'),_0x16dd2e);logger['debug'](_0xb343('0x24'),_0x16dd2e,JSON[_0xb343('0x12')](_0x439910));_0x47638d(_0x439910);})[_0xb343('0x16')](function(_0x22606d){logger[_0xb343('0x13')](_0xb343('0x24'),_0x22606d['message'],_0x16dd2e);_0x42ae47(_0x5d0ca6[_0xb343('0x13')](0x1f4,_0x22606d[_0xb343('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ead3ea2..61c2b22 100644 --- a/server/api/faxQueue/faxQueue.socket.js +++ b/server/api/faxQueue/faxQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e5d=['update','emit','removeListener','length','./faxQueue.events','remove'];(function(_0x436136,_0x1c027a){var _0x245bf9=function(_0x3ae747){while(--_0x3ae747){_0x436136['push'](_0x436136['shift']());}};_0x245bf9(++_0x1c027a);}(_0x7e5d,0x1ae));var _0xd7e5=function(_0x11950b,_0x2ad2e5){_0x11950b=_0x11950b-0x0;var _0x3e4e5f=_0x7e5d[_0x11950b];return _0x3e4e5f;};'use strict';var FaxQueueEvents=require(_0xd7e5('0x0'));var events=['save',_0xd7e5('0x1'),_0xd7e5('0x2')];function createListener(_0x45bc1f,_0x2820f1){return function(_0x3556ea){_0x2820f1[_0xd7e5('0x3')](_0x45bc1f,_0x3556ea);};}function removeListener(_0x3d127d,_0x4594d7){return function(){FaxQueueEvents[_0xd7e5('0x4')](_0x3d127d,_0x4594d7);};}exports['register']=function(_0x820994){for(var _0x54fb16=0x0,_0x51ba3b=events[_0xd7e5('0x5')];_0x54fb16<_0x51ba3b;_0x54fb16++){var _0x36448e=events[_0x54fb16];var _0x4d7918=createListener('faxQueue:'+_0x36448e,_0x820994);FaxQueueEvents['on'](_0x36448e,_0x4d7918);}}; \ No newline at end of file +var _0xc6b4=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x1b616e,_0x213f14){var _0x3dc67f=function(_0x437a98){while(--_0x437a98){_0x1b616e['push'](_0x1b616e['shift']());}};_0x3dc67f(++_0x213f14);}(_0xc6b4,0x6b));var _0x4c6b=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0xc6b4[_0x229128];return _0x1875b9;};'use strict';var FaxQueueEvents=require(_0x4c6b('0x0'));var events=[_0x4c6b('0x1'),_0x4c6b('0x2'),_0x4c6b('0x3')];function createListener(_0x2f5165,_0x1fdf96){return function(_0x5a671e){_0x1fdf96[_0x4c6b('0x4')](_0x2f5165,_0x5a671e);};}function removeListener(_0x14f257,_0x5d7060){return function(){FaxQueueEvents[_0x4c6b('0x5')](_0x14f257,_0x5d7060);};}exports[_0x4c6b('0x6')]=function(_0x15ad08){for(var _0x5bd660=0x0,_0x37a1c4=events[_0x4c6b('0x7')];_0x5bd660<_0x37a1c4;_0x5bd660++){var _0x220834=events[_0x5bd660];var _0x5b7309=createListener(_0x4c6b('0x8')+_0x220834,_0x15ad08);FaxQueueEvents['on'](_0x220834,_0x5b7309);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 23fcfa6..cb9065f 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1ccb5d,_0x341da9){_0x1ccb5d=_0x1ccb5d-0x0;var _0x1fe071=_0x0b0e[_0x1ccb5d];return _0x1fe071;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4fa4fd,_0x4c656b){_0x4fa4fd=_0x4fa4fd-0x0;var _0x3c50d0=_0x0b0e[_0x4fa4fd];return _0x3c50d0;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a0dc132..a101915 100644 --- a/server/api/faxQueueReport/faxQueueReport.attributes.js +++ b/server/api/faxQueueReport/faxQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae73=['DATE','sequelize','exports','STRING'];(function(_0x49c7ef,_0x3adcf){var _0x28d29c=function(_0x1c7424){while(--_0x1c7424){_0x49c7ef['push'](_0x49c7ef['shift']());}};_0x28d29c(++_0x3adcf);}(_0xae73,0x119));var _0x3ae7=function(_0x14bbf3,_0xca820f){_0x14bbf3=_0x14bbf3-0x0;var _0x1b280c=_0xae73[_0x14bbf3];return _0x1b280c;};'use strict';var moment=require('moment');var Sequelize=require(_0x3ae7('0x0'));module[_0x3ae7('0x1')]={'uniqueid':{'type':Sequelize[_0x3ae7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3ae7('0x2')]},'joinAt':{'type':Sequelize[_0x3ae7('0x3')]},'leaveAt':{'type':Sequelize[_0x3ae7('0x3')]},'acceptAt':{'type':Sequelize[_0x3ae7('0x3')]},'exitAt':{'type':Sequelize[_0x3ae7('0x3')]},'reason':{'type':Sequelize[_0x3ae7('0x2')]}}; \ No newline at end of file +var _0x6182=['moment','sequelize','exports','STRING','DATE'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6182,0x1bd));var _0x2618=function(_0x4cd697,_0x4fc09f){_0x4cd697=_0x4cd697-0x0;var _0x414475=_0x6182[_0x4cd697];return _0x414475;};'use strict';var moment=require(_0x2618('0x0'));var Sequelize=require(_0x2618('0x1'));module[_0x2618('0x2')]={'uniqueid':{'type':Sequelize[_0x2618('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2618('0x3')]},'joinAt':{'type':Sequelize[_0x2618('0x4')]},'leaveAt':{'type':Sequelize[_0x2618('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2618('0x4')]},'reason':{'type':Sequelize[_0x2618('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 6637b6f..bd5dbbc 100644 --- a/server/api/faxQueueReport/faxQueueReport.controller.js +++ b/server/api/faxQueueReport/faxQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37be=['../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','then','end','stack','send','index','map','FaxQueueReport','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','update','find','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x4d27f4,_0x3334a1){var _0x4dffbc=function(_0xe93e8c){while(--_0xe93e8c){_0x4d27f4['push'](_0x4d27f4['shift']());}};_0x4dffbc(++_0x3334a1);}(_0x37be,0x1e1));var _0xe37b=function(_0x87ea37,_0x37a408){_0x87ea37=_0x87ea37-0x0;var _0x597e5f=_0x37be[_0x87ea37];return _0x597e5f;};'use strict';var pdf=require(_0xe37b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe37b('0x1'));var zipdir=require(_0xe37b('0x2'));var jsonpatch=require(_0xe37b('0x3'));var rp=require(_0xe37b('0x4'));var moment=require(_0xe37b('0x5'));var BPromise=require(_0xe37b('0x6'));var Mustache=require(_0xe37b('0x7'));var util=require(_0xe37b('0x8'));var path=require(_0xe37b('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe37b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe37b('0xb'));var crypto=require(_0xe37b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe37b('0xd'));var toCsv=require(_0xe37b('0xe'));var querystring=require(_0xe37b('0xf'));var Papa=require(_0xe37b('0x10'));var Redis=require(_0xe37b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe37b('0x12'));var as=require(_0xe37b('0x13'));var hardwareService=require(_0xe37b('0x14'));var logger=require('../../config/logger')(_0xe37b('0x15'));var utils=require('../../config/utils');var config=require(_0xe37b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe37b('0x17'))['db'];function respondWithStatusCode(_0x153bc2,_0x23d96c){_0x23d96c=_0x23d96c||0xcc;return function(_0x4fbe42){if(_0x4fbe42){return _0x153bc2[_0xe37b('0x18')](_0x23d96c);}return _0x153bc2['status'](_0x23d96c)['end']();};}function respondWithResult(_0x1f9249,_0xee6add){_0xee6add=_0xee6add||0xc8;return function(_0xf4a401){if(_0xf4a401){return _0x1f9249[_0xe37b('0x19')](_0xee6add)[_0xe37b('0x1a')](_0xf4a401);}};}function respondWithFilteredResult(_0x292c67,_0x22238d){return function(_0x3010bc){if(_0x3010bc){var _0x1bce1c=_0x3010bc[_0xe37b('0x1b')],_0x1cb13e=_0x22238d[_0xe37b('0x1c')],_0x2a7af4=_0x22238d['offset']+_0x22238d[_0xe37b('0x1d')],_0x532e96;if(_0x2a7af4>=_0x1bce1c){_0x2a7af4=_0x1bce1c;_0x532e96=0xc8;}else{_0x532e96=0xce;}_0x292c67[_0xe37b('0x19')](_0x532e96);return _0x292c67['set']('Content-Range',_0x1cb13e+'-'+_0x2a7af4+'/'+_0x1bce1c)[_0xe37b('0x1a')](_0x3010bc);}return null;};}function patchUpdates(_0x154460){return function(_0x3ff9d2){try{jsonpatch[_0xe37b('0x1e')](_0x3ff9d2,_0x154460,!![]);}catch(_0x307caa){return BPromise[_0xe37b('0x1f')](_0x307caa);}return _0x3ff9d2[_0xe37b('0x20')]();};}function saveUpdates(_0x95760e,_0x438e29){return function(_0x4d6861){if(_0x4d6861){return _0x4d6861['update'](_0x95760e)[_0xe37b('0x21')](function(_0x3d4a34){return _0x3d4a34;});}return null;};}function removeEntity(_0x3f8ae5,_0x16e515){return function(_0x47dca3){if(_0x47dca3){return _0x47dca3['destroy']()[_0xe37b('0x21')](function(){_0x3f8ae5[_0xe37b('0x19')](0xcc)[_0xe37b('0x22')]();});}};}function handleEntityNotFound(_0x271159,_0x428bf4){return function(_0x459de7){if(!_0x459de7){_0x271159[_0xe37b('0x18')](0x194);}return _0x459de7;};}function handleError(_0x455ab1,_0x696519){_0x696519=_0x696519||0x1f4;return function(_0x66151a){logger['error'](_0x66151a[_0xe37b('0x23')]);if(_0x66151a['name']){delete _0x66151a['name'];}_0x455ab1[_0xe37b('0x19')](_0x696519)[_0xe37b('0x24')](_0x66151a);};}exports[_0xe37b('0x25')]=function(_0x383528,_0x1506f5){var _0x364a02={},_0x240790={},_0x2c101e={'count':0x0,'rows':[]};var _0x253e93=_[_0xe37b('0x26')](db[_0xe37b('0x27')]['rawAttributes'],function(_0x4ece17){return{'name':_0x4ece17[_0xe37b('0x28')],'type':_0x4ece17[_0xe37b('0x29')][_0xe37b('0x2a')]};});_0x240790[_0xe37b('0x2b')]=_[_0xe37b('0x26')](_0x253e93,_0xe37b('0x2c'));_0x240790[_0xe37b('0x2d')]=_[_0xe37b('0x2e')](_0x383528[_0xe37b('0x2d')]);_0x240790[_0xe37b('0x2f')]=_[_0xe37b('0x30')](_0x240790[_0xe37b('0x2b')],_0x240790[_0xe37b('0x2d')]);_0x364a02[_0xe37b('0x31')]=_[_0xe37b('0x30')](_0x240790[_0xe37b('0x2b')],qs[_0xe37b('0x32')](_0x383528[_0xe37b('0x2d')]['fields']));_0x364a02[_0xe37b('0x31')]=_0x364a02[_0xe37b('0x31')][_0xe37b('0x33')]?_0x364a02[_0xe37b('0x31')]:_0x240790[_0xe37b('0x2b')];if(!_0x383528[_0xe37b('0x2d')][_0xe37b('0x34')]('nolimit')){_0x364a02[_0xe37b('0x1d')]=qs['limit'](_0x383528[_0xe37b('0x2d')][_0xe37b('0x1d')]);_0x364a02[_0xe37b('0x1c')]=qs['offset'](_0x383528[_0xe37b('0x2d')][_0xe37b('0x1c')]);}_0x364a02['order']=qs[_0xe37b('0x35')](_0x383528['query'][_0xe37b('0x35')]);_0x364a02[_0xe37b('0x36')]=qs[_0xe37b('0x2f')](_['pick'](_0x383528[_0xe37b('0x2d')],_0x240790[_0xe37b('0x2f')]),_0x253e93);if(_0x383528[_0xe37b('0x2d')][_0xe37b('0x37')]){_0x364a02[_0xe37b('0x36')]=_[_0xe37b('0x38')](_0x364a02['where'],{'$or':_['map'](_0x253e93,function(_0x29cebb){if(_0x29cebb[_0xe37b('0x29')]!==_0xe37b('0x39')){var _0x1098e3={};_0x1098e3[_0x29cebb['name']]={'$like':'%'+_0x383528[_0xe37b('0x2d')][_0xe37b('0x37')]+'%'};return _0x1098e3;}})});}_0x364a02=_[_0xe37b('0x38')]({},_0x364a02,_0x383528[_0xe37b('0x3a')]);var _0x306f86={'where':_0x364a02[_0xe37b('0x36')]};return db['FaxQueueReport'][_0xe37b('0x1b')](_0x306f86)[_0xe37b('0x21')](function(_0x1a8403){_0x2c101e[_0xe37b('0x1b')]=_0x1a8403;if(_0x383528[_0xe37b('0x2d')][_0xe37b('0x3b')]){_0x364a02['include']=[{'all':!![]}];}return db[_0xe37b('0x27')]['findAll'](_0x364a02);})[_0xe37b('0x21')](function(_0x489251){_0x2c101e[_0xe37b('0x3c')]=_0x489251;return _0x2c101e;})['then'](respondWithFilteredResult(_0x1506f5,_0x364a02))[_0xe37b('0x3d')](handleError(_0x1506f5,null));};exports[_0xe37b('0x3e')]=function(_0x24a87a,_0x5a5957){var _0x44eebd={'raw':!![],'where':{'id':_0x24a87a[_0xe37b('0x3f')]['id']}},_0x5beed3={};_0x5beed3[_0xe37b('0x2b')]=_['keys'](db['FaxQueueReport'][_0xe37b('0x40')]);_0x5beed3[_0xe37b('0x2d')]=_[_0xe37b('0x2e')](_0x24a87a[_0xe37b('0x2d')]);_0x5beed3[_0xe37b('0x2f')]=_['intersection'](_0x5beed3['model'],_0x5beed3['query']);_0x44eebd[_0xe37b('0x31')]=_[_0xe37b('0x30')](_0x5beed3[_0xe37b('0x2b')],qs['fields'](_0x24a87a[_0xe37b('0x2d')][_0xe37b('0x32')]));_0x44eebd[_0xe37b('0x31')]=_0x44eebd[_0xe37b('0x31')][_0xe37b('0x33')]?_0x44eebd[_0xe37b('0x31')]:_0x5beed3[_0xe37b('0x2b')];if(_0x24a87a[_0xe37b('0x2d')][_0xe37b('0x3b')]){_0x44eebd[_0xe37b('0x41')]=[{'all':!![]}];}_0x44eebd=_[_0xe37b('0x38')]({},_0x44eebd,_0x24a87a['options']);return db[_0xe37b('0x27')]['find'](_0x44eebd)[_0xe37b('0x21')](handleEntityNotFound(_0x5a5957,null))[_0xe37b('0x21')](respondWithResult(_0x5a5957,null))[_0xe37b('0x3d')](handleError(_0x5a5957,null));};exports['create']=function(_0x1f989c,_0x1011a0){return db[_0xe37b('0x27')][_0xe37b('0x42')](_0x1f989c[_0xe37b('0x43')],{})[_0xe37b('0x21')](respondWithResult(_0x1011a0,0xc9))[_0xe37b('0x3d')](handleError(_0x1011a0,null));};exports[_0xe37b('0x44')]=function(_0x17cdc5,_0x154b0d){if(_0x17cdc5[_0xe37b('0x43')]['id']){delete _0x17cdc5[_0xe37b('0x43')]['id'];}return db['FaxQueueReport'][_0xe37b('0x45')]({'where':{'id':_0x17cdc5[_0xe37b('0x3f')]['id']}})[_0xe37b('0x21')](handleEntityNotFound(_0x154b0d,null))[_0xe37b('0x21')](saveUpdates(_0x17cdc5[_0xe37b('0x43')],null))['then'](respondWithResult(_0x154b0d,null))[_0xe37b('0x3d')](handleError(_0x154b0d,null));};exports[_0xe37b('0x46')]=function(_0x22fcea,_0xf6b39f){return db[_0xe37b('0x27')][_0xe37b('0x45')]({'where':{'id':_0x22fcea[_0xe37b('0x3f')]['id']}})[_0xe37b('0x21')](handleEntityNotFound(_0xf6b39f,null))['then'](removeEntity(_0xf6b39f,null))[_0xe37b('0x3d')](handleError(_0xf6b39f,null));};exports[_0xe37b('0x47')]=function(_0x466272,_0x3f8478){return db[_0xe37b('0x27')]['describe']()[_0xe37b('0x21')](respondWithResult(_0x3f8478,null))[_0xe37b('0x3d')](handleError(_0x3f8478,null));}; \ No newline at end of file +var _0x727a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x529156,_0x175c52){var _0x515f46=function(_0x39c0ab){while(--_0x39c0ab){_0x529156['push'](_0x529156['shift']());}};_0x515f46(++_0x175c52);}(_0x727a,0x173));var _0xa727=function(_0x557081,_0x5e7589){_0x557081=_0x557081-0x0;var _0x373575=_0x727a[_0x557081];return _0x373575;};'use strict';var pdf=require(_0xa727('0x0'));var emlformat=require(_0xa727('0x1'));var rimraf=require(_0xa727('0x2'));var zipdir=require(_0xa727('0x3'));var jsonpatch=require(_0xa727('0x4'));var rp=require(_0xa727('0x5'));var moment=require(_0xa727('0x6'));var BPromise=require(_0xa727('0x7'));var Mustache=require(_0xa727('0x8'));var util=require('util');var path=require(_0xa727('0x9'));var sox=require(_0xa727('0xa'));var csv=require(_0xa727('0xb'));var ejs=require(_0xa727('0xc'));var fs=require('fs');var _=require(_0xa727('0xd'));var squel=require(_0xa727('0xe'));var crypto=require(_0xa727('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa727('0x10'));var toCsv=require(_0xa727('0xb'));var querystring=require(_0xa727('0x11'));var Papa=require(_0xa727('0x12'));var Redis=require(_0xa727('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa727('0x14'));var as=require(_0xa727('0x15'));var hardwareService=require(_0xa727('0x16'));var logger=require(_0xa727('0x17'))('api');var utils=require(_0xa727('0x18'));var config=require(_0xa727('0x19'));var licenseUtil=require(_0xa727('0x1a'));var db=require(_0xa727('0x1b'))['db'];function respondWithStatusCode(_0x168a71,_0x3b9319){_0x3b9319=_0x3b9319||0xcc;return function(_0x248148){if(_0x248148){return _0x168a71[_0xa727('0x1c')](_0x3b9319);}return _0x168a71[_0xa727('0x1d')](_0x3b9319)['end']();};}function respondWithResult(_0x502935,_0x59e7f6){_0x59e7f6=_0x59e7f6||0xc8;return function(_0x3c5362){if(_0x3c5362){return _0x502935[_0xa727('0x1d')](_0x59e7f6)['json'](_0x3c5362);}};}function respondWithFilteredResult(_0x46e13e,_0x113f12){return function(_0x5f2ede){if(_0x5f2ede){var _0x51ac86=_0x5f2ede[_0xa727('0x1e')],_0x1d1500=_0x113f12[_0xa727('0x1f')],_0x3d271c=_0x113f12[_0xa727('0x1f')]+_0x113f12[_0xa727('0x20')],_0x5bec7;if(_0x3d271c>=_0x51ac86){_0x3d271c=_0x51ac86;_0x5bec7=0xc8;}else{_0x5bec7=0xce;}_0x46e13e[_0xa727('0x1d')](_0x5bec7);return _0x46e13e[_0xa727('0x21')](_0xa727('0x22'),_0x1d1500+'-'+_0x3d271c+'/'+_0x51ac86)[_0xa727('0x23')](_0x5f2ede);}return null;};}function patchUpdates(_0x98cac7){return function(_0x4f3c84){try{jsonpatch[_0xa727('0x24')](_0x4f3c84,_0x98cac7,!![]);}catch(_0x2e6d68){return BPromise[_0xa727('0x25')](_0x2e6d68);}return _0x4f3c84[_0xa727('0x26')]();};}function saveUpdates(_0x348d0c,_0x196d52){return function(_0x11c27b){if(_0x11c27b){return _0x11c27b['update'](_0x348d0c)[_0xa727('0x27')](function(_0x5ca56a){return _0x5ca56a;});}return null;};}function removeEntity(_0x20f214,_0x18153f){return function(_0x285995){if(_0x285995){return _0x285995[_0xa727('0x28')]()[_0xa727('0x27')](function(){_0x20f214[_0xa727('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4632a3,_0x5e693a){return function(_0x2d46f5){if(!_0x2d46f5){_0x4632a3['sendStatus'](0x194);}return _0x2d46f5;};}function handleError(_0x5d244b,_0x16cfaf){_0x16cfaf=_0x16cfaf||0x1f4;return function(_0x43a26c){logger[_0xa727('0x29')](_0x43a26c['stack']);if(_0x43a26c[_0xa727('0x2a')]){delete _0x43a26c[_0xa727('0x2a')];}_0x5d244b[_0xa727('0x1d')](_0x16cfaf)[_0xa727('0x2b')](_0x43a26c);};}exports['index']=function(_0x334433,_0x4b2ccb){var _0xa37456={},_0x5cb7b1={},_0x342fa0={'count':0x0,'rows':[]};var _0x4ceda4=_[_0xa727('0x2c')](db[_0xa727('0x2d')][_0xa727('0x2e')],function(_0x3fd7fb){return{'name':_0x3fd7fb[_0xa727('0x2f')],'type':_0x3fd7fb['type'][_0xa727('0x30')]};});_0x5cb7b1[_0xa727('0x31')]=_['map'](_0x4ceda4,_0xa727('0x2a'));_0x5cb7b1[_0xa727('0x32')]=_['keys'](_0x334433[_0xa727('0x32')]);_0x5cb7b1['filters']=_[_0xa727('0x33')](_0x5cb7b1[_0xa727('0x31')],_0x5cb7b1[_0xa727('0x32')]);_0xa37456['attributes']=_[_0xa727('0x33')](_0x5cb7b1['model'],qs[_0xa727('0x34')](_0x334433['query'][_0xa727('0x34')]));_0xa37456[_0xa727('0x35')]=_0xa37456[_0xa727('0x35')][_0xa727('0x36')]?_0xa37456[_0xa727('0x35')]:_0x5cb7b1[_0xa727('0x31')];if(!_0x334433['query'][_0xa727('0x37')](_0xa727('0x38'))){_0xa37456[_0xa727('0x20')]=qs[_0xa727('0x20')](_0x334433[_0xa727('0x32')][_0xa727('0x20')]);_0xa37456[_0xa727('0x1f')]=qs['offset'](_0x334433['query']['offset']);}_0xa37456[_0xa727('0x39')]=qs[_0xa727('0x3a')](_0x334433[_0xa727('0x32')][_0xa727('0x3a')]);_0xa37456[_0xa727('0x3b')]=qs[_0xa727('0x3c')](_['pick'](_0x334433['query'],_0x5cb7b1['filters']),_0x4ceda4);if(_0x334433[_0xa727('0x32')][_0xa727('0x3d')]){_0xa37456['where']=_[_0xa727('0x3e')](_0xa37456[_0xa727('0x3b')],{'$or':_[_0xa727('0x2c')](_0x4ceda4,function(_0x2dc37a){if(_0x2dc37a[_0xa727('0x3f')]!==_0xa727('0x40')){var _0x4487a5={};_0x4487a5[_0x2dc37a['name']]={'$like':'%'+_0x334433[_0xa727('0x32')][_0xa727('0x3d')]+'%'};return _0x4487a5;}})});}_0xa37456=_[_0xa727('0x3e')]({},_0xa37456,_0x334433[_0xa727('0x41')]);var _0x101f2a={'where':_0xa37456[_0xa727('0x3b')]};return db['FaxQueueReport'][_0xa727('0x1e')](_0x101f2a)[_0xa727('0x27')](function(_0x9de4a0){_0x342fa0[_0xa727('0x1e')]=_0x9de4a0;if(_0x334433['query'][_0xa727('0x42')]){_0xa37456[_0xa727('0x43')]=[{'all':!![]}];}return db[_0xa727('0x2d')][_0xa727('0x44')](_0xa37456);})[_0xa727('0x27')](function(_0x54ca2f){_0x342fa0[_0xa727('0x45')]=_0x54ca2f;return _0x342fa0;})['then'](respondWithFilteredResult(_0x4b2ccb,_0xa37456))[_0xa727('0x46')](handleError(_0x4b2ccb,null));};exports[_0xa727('0x47')]=function(_0x1fccb,_0x43b62b){var _0x2ba9a4={'raw':!![],'where':{'id':_0x1fccb[_0xa727('0x48')]['id']}},_0x2c7883={};_0x2c7883['model']=_[_0xa727('0x49')](db[_0xa727('0x2d')][_0xa727('0x2e')]);_0x2c7883[_0xa727('0x32')]=_[_0xa727('0x49')](_0x1fccb['query']);_0x2c7883[_0xa727('0x3c')]=_[_0xa727('0x33')](_0x2c7883['model'],_0x2c7883[_0xa727('0x32')]);_0x2ba9a4[_0xa727('0x35')]=_[_0xa727('0x33')](_0x2c7883[_0xa727('0x31')],qs['fields'](_0x1fccb['query'][_0xa727('0x34')]));_0x2ba9a4['attributes']=_0x2ba9a4[_0xa727('0x35')][_0xa727('0x36')]?_0x2ba9a4[_0xa727('0x35')]:_0x2c7883[_0xa727('0x31')];if(_0x1fccb[_0xa727('0x32')][_0xa727('0x42')]){_0x2ba9a4[_0xa727('0x43')]=[{'all':!![]}];}_0x2ba9a4=_[_0xa727('0x3e')]({},_0x2ba9a4,_0x1fccb[_0xa727('0x41')]);return db[_0xa727('0x2d')][_0xa727('0x4a')](_0x2ba9a4)[_0xa727('0x27')](handleEntityNotFound(_0x43b62b,null))[_0xa727('0x27')](respondWithResult(_0x43b62b,null))[_0xa727('0x46')](handleError(_0x43b62b,null));};exports[_0xa727('0x4b')]=function(_0x37a316,_0x5ba71b){return db[_0xa727('0x2d')]['create'](_0x37a316[_0xa727('0x4c')],{})[_0xa727('0x27')](respondWithResult(_0x5ba71b,0xc9))[_0xa727('0x46')](handleError(_0x5ba71b,null));};exports[_0xa727('0x4d')]=function(_0x414163,_0x49e0eb){if(_0x414163[_0xa727('0x4c')]['id']){delete _0x414163[_0xa727('0x4c')]['id'];}return db[_0xa727('0x2d')][_0xa727('0x4a')]({'where':{'id':_0x414163[_0xa727('0x48')]['id']}})[_0xa727('0x27')](handleEntityNotFound(_0x49e0eb,null))[_0xa727('0x27')](saveUpdates(_0x414163[_0xa727('0x4c')],null))[_0xa727('0x27')](respondWithResult(_0x49e0eb,null))[_0xa727('0x46')](handleError(_0x49e0eb,null));};exports[_0xa727('0x28')]=function(_0x5d331d,_0x475fa8){return db[_0xa727('0x2d')][_0xa727('0x4a')]({'where':{'id':_0x5d331d[_0xa727('0x48')]['id']}})[_0xa727('0x27')](handleEntityNotFound(_0x475fa8,null))[_0xa727('0x27')](removeEntity(_0x475fa8,null))[_0xa727('0x46')](handleError(_0x475fa8,null));};exports[_0xa727('0x4e')]=function(_0x44b673,_0x3f5414){return db[_0xa727('0x2d')][_0xa727('0x4e')]()['then'](respondWithResult(_0x3f5414,null))[_0xa727('0x46')](handleError(_0x3f5414,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a8f5fbb..d9fbdd5 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4888=['../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2555d4,_0xc3bcf4){var _0x474a3d=function(_0xed3e38){while(--_0xed3e38){_0x2555d4['push'](_0x2555d4['shift']());}};_0x474a3d(++_0xc3bcf4);}(_0x4888,0x1a7));var _0x8488=function(_0x6edc85,_0x2c7710){_0x6edc85=_0x6edc85-0x0;var _0x4631a9=_0x4888[_0x6edc85];return _0x4631a9;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var logger=require('../../config/logger')(_0x8488('0x1'));var moment=require('moment');var BPromise=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var fs=require('fs');var path=require(_0x8488('0x4'));var rimraf=require(_0x8488('0x5'));var config=require(_0x8488('0x6'));var attributes=require(_0x8488('0x7'));module[_0x8488('0x8')]=function(_0x2eeb18,_0x5233db){return _0x2eeb18[_0x8488('0x9')](_0x8488('0xa'),attributes,{'tableName':_0x8488('0xb'),'paranoid':![],'indexes':[{'name':_0x8488('0xc'),'fields':[_0x8488('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x74a1=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x74a1,0xc6));var _0x174a=function(_0x1e5c8d,_0x1bd355){_0x1e5c8d=_0x1e5c8d-0x0;var _0x17f720=_0x74a1[_0x1e5c8d];return _0x17f720;};'use strict';var _=require('lodash');var util=require(_0x174a('0x0'));var logger=require(_0x174a('0x1'))(_0x174a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x174a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x174a('0x4'));var config=require(_0x174a('0x5'));var attributes=require('./faxQueueReport.attributes');module[_0x174a('0x6')]=function(_0x5887b2,_0x2ad3d1){return _0x5887b2[_0x174a('0x7')](_0x174a('0x8'),attributes,{'tableName':_0x174a('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x174a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index bddf654..38b0449 100644 --- a/server/api/faxQueueReport/faxQueueReport.rpc.js +++ b/server/api/faxQueueReport/faxQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7a0=['update','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport'];(function(_0x61683d,_0xe7e2d5){var _0xfed21e=function(_0x1f7b9d){while(--_0x1f7b9d){_0x61683d['push'](_0x61683d['shift']());}};_0xfed21e(++_0xe7e2d5);}(_0xd7a0,0xe9));var _0x0d7a=function(_0x504ebd,_0x1e9ffe){_0x504ebd=_0x504ebd-0x0;var _0x1df5f9=_0xd7a0[_0x504ebd];return _0x1df5f9;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var moment=require(_0x0d7a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d7a('0x3'));var db=require(_0x0d7a('0x4'))['db'];var utils=require(_0x0d7a('0x5'));var logger=require(_0x0d7a('0x6'))(_0x0d7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d7a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52eeac,_0x5da492,_0x5c951c){return new BPromise(function(_0x7a7ea8,_0x318344){return client['request'](_0x52eeac,_0x5c951c)[_0x0d7a('0x9')](function(_0x297ebf){logger['info'](_0x0d7a('0xa'),_0x5da492,_0x0d7a('0xb'));logger[_0x0d7a('0xc')](_0x0d7a('0xd'),_0x5da492,_0x0d7a('0xb'),JSON[_0x0d7a('0xe')](_0x297ebf));if(_0x297ebf['error']){if(_0x297ebf[_0x0d7a('0xf')][_0x0d7a('0x10')]===0x1f4){logger[_0x0d7a('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x5da492,_0x297ebf[_0x0d7a('0xf')][_0x0d7a('0x11')]);return _0x318344(_0x297ebf[_0x0d7a('0xf')][_0x0d7a('0x11')]);}logger[_0x0d7a('0xf')](_0x0d7a('0xa'),_0x5da492,_0x297ebf[_0x0d7a('0xf')][_0x0d7a('0x11')]);return _0x7a7ea8(_0x297ebf['error'][_0x0d7a('0x11')]);}else{logger[_0x0d7a('0x12')](_0x0d7a('0xa'),_0x5da492,_0x0d7a('0xb'));_0x7a7ea8(_0x297ebf[_0x0d7a('0x13')][_0x0d7a('0x11')]);}})[_0x0d7a('0x14')](function(_0x5b9ea2){logger[_0x0d7a('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x5da492,_0x5b9ea2);_0x318344(_0x5b9ea2);});});}exports[_0x0d7a('0x15')]=function(_0x3fc006){var _0x23efd=this;return new Promise(function(_0x215690,_0x211e59){return db[_0x0d7a('0x16')][_0x0d7a('0x17')](_0x3fc006[_0x0d7a('0x18')],{'raw':_0x3fc006[_0x0d7a('0x19')]?_0x3fc006[_0x0d7a('0x19')][_0x0d7a('0x1a')]===undefined?!![]:![]:!![]})[_0x0d7a('0x9')](function(_0x55798c){logger[_0x0d7a('0x12')]('CreateFaxQueueReport',_0x3fc006);logger[_0x0d7a('0xc')](_0x0d7a('0x15'),_0x3fc006,JSON['stringify'](_0x55798c));_0x215690(_0x55798c);})['catch'](function(_0xf7bbb4){logger[_0x0d7a('0xf')](_0x0d7a('0x15'),_0xf7bbb4[_0x0d7a('0x11')],_0x3fc006);_0x211e59(_0x23efd[_0x0d7a('0xf')](0x1f4,_0xf7bbb4[_0x0d7a('0x11')]));});});};exports[_0x0d7a('0x1b')]=function(_0x44dbda){var _0x5f01c3=this;return new Promise(function(_0x452e2c,_0x2aa935){return db[_0x0d7a('0x16')][_0x0d7a('0x1c')](_0x44dbda['body'],{'raw':_0x44dbda[_0x0d7a('0x19')]?_0x44dbda[_0x0d7a('0x19')][_0x0d7a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44dbda[_0x0d7a('0x19')]?_0x44dbda[_0x0d7a('0x19')]['where']||null:null,'attributes':_0x44dbda['options']?_0x44dbda['options']['attributes']||null:null,'limit':_0x44dbda[_0x0d7a('0x19')]?_0x44dbda[_0x0d7a('0x19')]['limit']||null:null})[_0x0d7a('0x9')](function(_0x3c4b8c){logger['info'](_0x0d7a('0x1b'),_0x44dbda);logger[_0x0d7a('0xc')](_0x0d7a('0x1b'),_0x44dbda,JSON[_0x0d7a('0xe')](_0x3c4b8c));_0x452e2c(_0x3c4b8c);})[_0x0d7a('0x14')](function(_0x95371d){logger[_0x0d7a('0xf')](_0x0d7a('0x1b'),_0x95371d[_0x0d7a('0x11')],_0x44dbda);_0x2aa935(_0x5f01c3[_0x0d7a('0xf')](0x1f4,_0x95371d[_0x0d7a('0x11')]));});});}; \ No newline at end of file +var _0x1047=['result','catch','FaxQueueReport','create','options','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','raw','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message'];(function(_0x9a4503,_0x31ea1d){var _0x354f11=function(_0x502393){while(--_0x502393){_0x9a4503['push'](_0x9a4503['shift']());}};_0x354f11(++_0x31ea1d);}(_0x1047,0xf4));var _0x7104=function(_0x24cab6,_0xd43e28){_0x24cab6=_0x24cab6-0x0;var _0x25d6b6=_0x1047[_0x24cab6];return _0x25d6b6;};'use strict';var _=require(_0x7104('0x0'));var util=require(_0x7104('0x1'));var moment=require('moment');var BPromise=require(_0x7104('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7104('0x3'));var db=require(_0x7104('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7104('0x5'))('rpc');var config=require(_0x7104('0x6'));var jayson=require(_0x7104('0x7'));var client=jayson['client'][_0x7104('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d639f,_0x440077,_0x1ba0c){return new BPromise(function(_0x3b38cd,_0x33c437){return client[_0x7104('0x9')](_0x2d639f,_0x1ba0c)[_0x7104('0xa')](function(_0x288ac3){logger[_0x7104('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x440077,_0x7104('0xc'));logger[_0x7104('0xd')](_0x7104('0xe'),_0x440077,'request\x20sent',JSON[_0x7104('0xf')](_0x288ac3));if(_0x288ac3[_0x7104('0x10')]){if(_0x288ac3[_0x7104('0x10')][_0x7104('0x11')]===0x1f4){logger[_0x7104('0x10')](_0x7104('0x12'),_0x440077,_0x288ac3[_0x7104('0x10')]['message']);return _0x33c437(_0x288ac3[_0x7104('0x10')][_0x7104('0x13')]);}logger['error'](_0x7104('0x12'),_0x440077,_0x288ac3[_0x7104('0x10')][_0x7104('0x13')]);return _0x3b38cd(_0x288ac3[_0x7104('0x10')][_0x7104('0x13')]);}else{logger[_0x7104('0xb')](_0x7104('0x12'),_0x440077,_0x7104('0xc'));_0x3b38cd(_0x288ac3[_0x7104('0x14')][_0x7104('0x13')]);}})[_0x7104('0x15')](function(_0x456311){logger['error'](_0x7104('0x12'),_0x440077,_0x456311);_0x33c437(_0x456311);});});}exports['CreateFaxQueueReport']=function(_0x70ca9e){var _0x1420c3=this;return new Promise(function(_0x3c2c78,_0x453873){return db[_0x7104('0x16')][_0x7104('0x17')](_0x70ca9e['body'],{'raw':_0x70ca9e['options']?_0x70ca9e[_0x7104('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3069ae){logger['info'](_0x7104('0x19'),_0x70ca9e);logger[_0x7104('0xd')]('CreateFaxQueueReport',_0x70ca9e,JSON[_0x7104('0xf')](_0x3069ae));_0x3c2c78(_0x3069ae);})[_0x7104('0x15')](function(_0x2f75e4){logger['error'](_0x7104('0x19'),_0x2f75e4[_0x7104('0x13')],_0x70ca9e);_0x453873(_0x1420c3[_0x7104('0x10')](0x1f4,_0x2f75e4[_0x7104('0x13')]));});});};exports[_0x7104('0x1a')]=function(_0x8d6e8a){var _0x1cdc8a=this;return new Promise(function(_0x4f05d5,_0xe54376){return db[_0x7104('0x16')][_0x7104('0x1b')](_0x8d6e8a[_0x7104('0x1c')],{'raw':_0x8d6e8a['options']?_0x8d6e8a[_0x7104('0x18')][_0x7104('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d6e8a['options']?_0x8d6e8a[_0x7104('0x18')][_0x7104('0x1e')]||null:null,'attributes':_0x8d6e8a[_0x7104('0x18')]?_0x8d6e8a[_0x7104('0x18')][_0x7104('0x1f')]||null:null,'limit':_0x8d6e8a[_0x7104('0x18')]?_0x8d6e8a[_0x7104('0x18')][_0x7104('0x20')]||null:null})[_0x7104('0xa')](function(_0x9c8069){logger[_0x7104('0xb')](_0x7104('0x1a'),_0x8d6e8a);logger['debug'](_0x7104('0x1a'),_0x8d6e8a,JSON['stringify'](_0x9c8069));_0x4f05d5(_0x9c8069);})[_0x7104('0x15')](function(_0x47bdc1){logger['error'](_0x7104('0x1a'),_0x47bdc1[_0x7104('0x13')],_0x8d6e8a);_0xe54376(_0x1cdc8a['error'](0x1f4,_0x47bdc1[_0x7104('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e68927f..0427887 100644 --- a/server/api/faxQueueReport/index.js +++ b/server/api/faxQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc72e=['create','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','describe','get','show','post'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc72e,0x8c));var _0xec72=function(_0x38567b,_0x32ba4e){_0x38567b=_0x38567b-0x0;var _0x2ebec5=_0xc72e[_0x38567b];return _0x2ebec5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xec72('0x0'));var express=require(_0xec72('0x1'));var router=express[_0xec72('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xec72('0x3'));var config=require(_0xec72('0x4'));var controller=require(_0xec72('0x5'));router['get']('/',auth[_0xec72('0x6')](),controller[_0xec72('0x7')]);router['get']('/describe',auth[_0xec72('0x6')](),controller[_0xec72('0x8')]);router[_0xec72('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xec72('0xa')]);router[_0xec72('0xb')]('/',auth['isAuthenticated'](),controller[_0xec72('0xc')]);router[_0xec72('0xd')](_0xec72('0xe'),auth[_0xec72('0x6')](),controller[_0xec72('0xf')]);router[_0xec72('0x10')](_0xec72('0xe'),auth['isAuthenticated'](),controller[_0xec72('0x11')]);module[_0xec72('0x12')]=router; \ No newline at end of file +var _0xefc2=['/:id','post','create','put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1361e2,_0x2cbfc0){var _0x17161e=function(_0x1681ca){while(--_0x1681ca){_0x1361e2['push'](_0x1361e2['shift']());}};_0x17161e(++_0x2cbfc0);}(_0xefc2,0x1b6));var _0x2efc=function(_0x6fd45a,_0x1d9c70){_0x6fd45a=_0x6fd45a-0x0;var _0x368a9e=_0xefc2[_0x6fd45a];return _0x368a9e;};'use strict';var multer=require(_0x2efc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2efc('0x1'));var express=require(_0x2efc('0x2'));var router=express[_0x2efc('0x3')]();var auth=require(_0x2efc('0x4'));var interaction=require(_0x2efc('0x5'));var config=require('../../config/environment');var controller=require(_0x2efc('0x6'));router[_0x2efc('0x7')]('/',auth[_0x2efc('0x8')](),controller[_0x2efc('0x9')]);router[_0x2efc('0x7')](_0x2efc('0xa'),auth[_0x2efc('0x8')](),controller[_0x2efc('0xb')]);router[_0x2efc('0x7')](_0x2efc('0xc'),auth[_0x2efc('0x8')](),controller['show']);router[_0x2efc('0xd')]('/',auth[_0x2efc('0x8')](),controller[_0x2efc('0xe')]);router[_0x2efc('0xf')](_0x2efc('0xc'),auth[_0x2efc('0x8')](),controller[_0x2efc('0x10')]);router['delete'](_0x2efc('0xc'),auth[_0x2efc('0x8')](),controller['destroy']);module[_0x2efc('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index ab1d651..7482e19 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1943=['queue','NOW','moment','sequelize','exports','STRING','agent'];(function(_0x2606bd,_0x3148ea){var _0x1b6f75=function(_0x23f433){while(--_0x23f433){_0x2606bd['push'](_0x2606bd['shift']());}};_0x1b6f75(++_0x3148ea);}(_0x1943,0xe2));var _0x3194=function(_0x4e3246,_0x244bd3){_0x4e3246=_0x4e3246-0x0;var _0x3f680b=_0x1943[_0x4e3246];return _0x3f680b;};'use strict';var moment=require(_0x3194('0x0'));var Sequelize=require(_0x3194('0x1'));module[_0x3194('0x2')]={'uniqueid':{'type':Sequelize[_0x3194('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x3194('0x4'),'queue'),'allowNull':![],'defaultValue':_0x3194('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x3194('0x6')]}}; \ No newline at end of file +var _0x228c=['sequelize','exports','STRING','ENUM','account','agent','queue','NOW','moment'];(function(_0x1c7d3a,_0x526b24){var _0x42a22d=function(_0x137fd4){while(--_0x137fd4){_0x1c7d3a['push'](_0x1c7d3a['shift']());}};_0x42a22d(++_0x526b24);}(_0x228c,0x1ca));var _0xc228=function(_0x1a9ef2,_0x3dbfc6){_0x1a9ef2=_0x1a9ef2-0x0;var _0x13cd36=_0x228c[_0x1a9ef2];return _0x13cd36;};'use strict';var moment=require(_0xc228('0x0'));var Sequelize=require(_0xc228('0x1'));module[_0xc228('0x2')]={'uniqueid':{'type':Sequelize[_0xc228('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc228('0x4')](_0xc228('0x5'),_0xc228('0x6'),_0xc228('0x7')),'allowNull':![],'defaultValue':_0xc228('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xc228('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d1478d2..d7fdb08 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9b1=['sort','pick','merge','where','VIRTUAL','filter','FaxTransferReport','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order'];(function(_0x10bd9f,_0x389b65){var _0x41d194=function(_0x1e5ebb){while(--_0x1e5ebb){_0x10bd9f['push'](_0x10bd9f['shift']());}};_0x41d194(++_0x389b65);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1a9b('0x0'));var zipdir=require(_0x1a9b('0x1'));var jsonpatch=require(_0x1a9b('0x2'));var rp=require(_0x1a9b('0x3'));var moment=require(_0x1a9b('0x4'));var BPromise=require(_0x1a9b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1a9b('0x6'));var csv=require(_0x1a9b('0x7'));var ejs=require(_0x1a9b('0x8'));var fs=require('fs');var _=require(_0x1a9b('0x9'));var squel=require(_0x1a9b('0xa'));var crypto=require(_0x1a9b('0xb'));var jsforce=require(_0x1a9b('0xc'));var deskjs=require(_0x1a9b('0xd'));var toCsv=require(_0x1a9b('0x7'));var querystring=require(_0x1a9b('0xe'));var Papa=require(_0x1a9b('0xf'));var Redis=require(_0x1a9b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a9b('0x11'));var hardwareService=require(_0x1a9b('0x12'));var logger=require(_0x1a9b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a9b('0x14'));var db=require(_0x1a9b('0x15'))['db'];function respondWithStatusCode(_0x2c75cf,_0x11bf7e){_0x11bf7e=_0x11bf7e||0xcc;return function(_0x2c3170){if(_0x2c3170){return _0x2c75cf[_0x1a9b('0x16')](_0x11bf7e);}return _0x2c75cf['status'](_0x11bf7e)[_0x1a9b('0x17')]();};}function respondWithResult(_0x34f082,_0x245883){_0x245883=_0x245883||0xc8;return function(_0x53c725){if(_0x53c725){return _0x34f082[_0x1a9b('0x18')](_0x245883)[_0x1a9b('0x19')](_0x53c725);}};}function respondWithFilteredResult(_0x55a00d,_0x2a7d72){return function(_0x57ca87){if(_0x57ca87){var _0x439acd=_0x57ca87[_0x1a9b('0x1a')],_0x34b776=_0x2a7d72[_0x1a9b('0x1b')],_0xa77d19=_0x2a7d72[_0x1a9b('0x1b')]+_0x2a7d72[_0x1a9b('0x1c')],_0x3903b7;if(_0xa77d19>=_0x439acd){_0xa77d19=_0x439acd;_0x3903b7=0xc8;}else{_0x3903b7=0xce;}_0x55a00d[_0x1a9b('0x18')](_0x3903b7);return _0x55a00d[_0x1a9b('0x1d')]('Content-Range',_0x34b776+'-'+_0xa77d19+'/'+_0x439acd)[_0x1a9b('0x19')](_0x57ca87);}return null;};}function patchUpdates(_0x25212f){return function(_0x3df7d2){try{jsonpatch[_0x1a9b('0x1e')](_0x3df7d2,_0x25212f,!![]);}catch(_0x5687fc){return BPromise[_0x1a9b('0x1f')](_0x5687fc);}return _0x3df7d2[_0x1a9b('0x20')]();};}function saveUpdates(_0x4b3cd3,_0x23e327){return function(_0x3e6980){if(_0x3e6980){return _0x3e6980[_0x1a9b('0x21')](_0x4b3cd3)[_0x1a9b('0x22')](function(_0x1b451f){return _0x1b451f;});}return null;};}function removeEntity(_0x590568,_0x189e78){return function(_0x17b1dd){if(_0x17b1dd){return _0x17b1dd[_0x1a9b('0x23')]()[_0x1a9b('0x22')](function(){_0x590568[_0x1a9b('0x18')](0xcc)[_0x1a9b('0x17')]();});}};}function handleEntityNotFound(_0x28f937,_0x488a33){return function(_0xabfc95){if(!_0xabfc95){_0x28f937['sendStatus'](0x194);}return _0xabfc95;};}function handleError(_0x7dd56c,_0x1429b0){_0x1429b0=_0x1429b0||0x1f4;return function(_0xad6541){logger['error'](_0xad6541[_0x1a9b('0x24')]);if(_0xad6541[_0x1a9b('0x25')]){delete _0xad6541[_0x1a9b('0x25')];}_0x7dd56c[_0x1a9b('0x18')](_0x1429b0)[_0x1a9b('0x26')](_0xad6541);};}exports[_0x1a9b('0x27')]=function(_0x49d440,_0x3f7807){var _0x129488={},_0x566fb4={},_0x165fc0={'count':0x0,'rows':[]};var _0xbc54e3=_['map'](db['FaxTransferReport'][_0x1a9b('0x28')],function(_0x1d981e){return{'name':_0x1d981e['fieldName'],'type':_0x1d981e[_0x1a9b('0x29')][_0x1a9b('0x2a')]};});_0x566fb4[_0x1a9b('0x2b')]=_[_0x1a9b('0x2c')](_0xbc54e3,_0x1a9b('0x25'));_0x566fb4[_0x1a9b('0x2d')]=_[_0x1a9b('0x2e')](_0x49d440['query']);_0x566fb4[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x566fb4[_0x1a9b('0x2b')],_0x566fb4[_0x1a9b('0x2d')]);_0x129488[_0x1a9b('0x31')]=_[_0x1a9b('0x30')](_0x566fb4[_0x1a9b('0x2b')],qs[_0x1a9b('0x32')](_0x49d440[_0x1a9b('0x2d')][_0x1a9b('0x32')]));_0x129488[_0x1a9b('0x31')]=_0x129488['attributes']['length']?_0x129488[_0x1a9b('0x31')]:_0x566fb4[_0x1a9b('0x2b')];if(!_0x49d440[_0x1a9b('0x2d')]['hasOwnProperty'](_0x1a9b('0x33'))){_0x129488['limit']=qs[_0x1a9b('0x1c')](_0x49d440['query'][_0x1a9b('0x1c')]);_0x129488[_0x1a9b('0x1b')]=qs['offset'](_0x49d440[_0x1a9b('0x2d')]['offset']);}_0x129488[_0x1a9b('0x34')]=qs[_0x1a9b('0x35')](_0x49d440[_0x1a9b('0x2d')][_0x1a9b('0x35')]);_0x129488['where']=qs[_0x1a9b('0x2f')](_[_0x1a9b('0x36')](_0x49d440[_0x1a9b('0x2d')],_0x566fb4['filters']),_0xbc54e3);if(_0x49d440[_0x1a9b('0x2d')]['filter']){_0x129488['where']=_[_0x1a9b('0x37')](_0x129488[_0x1a9b('0x38')],{'$or':_[_0x1a9b('0x2c')](_0xbc54e3,function(_0x42f540){if(_0x42f540[_0x1a9b('0x29')]!==_0x1a9b('0x39')){var _0x360ccf={};_0x360ccf[_0x42f540['name']]={'$like':'%'+_0x49d440[_0x1a9b('0x2d')][_0x1a9b('0x3a')]+'%'};return _0x360ccf;}})});}_0x129488=_[_0x1a9b('0x37')]({},_0x129488,_0x49d440['options']);var _0x466827={'where':_0x129488[_0x1a9b('0x38')]};return db[_0x1a9b('0x3b')][_0x1a9b('0x1a')](_0x466827)['then'](function(_0x58d5b6){_0x165fc0[_0x1a9b('0x1a')]=_0x58d5b6;if(_0x49d440[_0x1a9b('0x2d')][_0x1a9b('0x3c')]){_0x129488['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x1a9b('0x3d')](_0x129488);})[_0x1a9b('0x22')](function(_0x264f2c){_0x165fc0[_0x1a9b('0x3e')]=_0x264f2c;return _0x165fc0;})[_0x1a9b('0x22')](respondWithFilteredResult(_0x3f7807,_0x129488))[_0x1a9b('0x3f')](handleError(_0x3f7807,null));};exports[_0x1a9b('0x40')]=function(_0x4f3991,_0x313921){var _0x3b6f9e={'raw':!![],'where':{'id':_0x4f3991[_0x1a9b('0x41')]['id']}},_0x366788={};_0x366788[_0x1a9b('0x2b')]=_[_0x1a9b('0x2e')](db[_0x1a9b('0x3b')][_0x1a9b('0x28')]);_0x366788[_0x1a9b('0x2d')]=_[_0x1a9b('0x2e')](_0x4f3991[_0x1a9b('0x2d')]);_0x366788[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x366788[_0x1a9b('0x2b')],_0x366788[_0x1a9b('0x2d')]);_0x3b6f9e[_0x1a9b('0x31')]=_['intersection'](_0x366788[_0x1a9b('0x2b')],qs[_0x1a9b('0x32')](_0x4f3991['query'][_0x1a9b('0x32')]));_0x3b6f9e['attributes']=_0x3b6f9e['attributes'][_0x1a9b('0x42')]?_0x3b6f9e[_0x1a9b('0x31')]:_0x366788[_0x1a9b('0x2b')];if(_0x4f3991[_0x1a9b('0x2d')][_0x1a9b('0x3c')]){_0x3b6f9e[_0x1a9b('0x43')]=[{'all':!![]}];}_0x3b6f9e=_[_0x1a9b('0x37')]({},_0x3b6f9e,_0x4f3991['options']);return db[_0x1a9b('0x3b')][_0x1a9b('0x44')](_0x3b6f9e)[_0x1a9b('0x22')](handleEntityNotFound(_0x313921,null))[_0x1a9b('0x22')](respondWithResult(_0x313921,null))['catch'](handleError(_0x313921,null));};exports[_0x1a9b('0x45')]=function(_0x43d00a,_0x1bb0d3){return db[_0x1a9b('0x3b')]['create'](_0x43d00a[_0x1a9b('0x46')],{})[_0x1a9b('0x22')](respondWithResult(_0x1bb0d3,0xc9))[_0x1a9b('0x3f')](handleError(_0x1bb0d3,null));};exports[_0x1a9b('0x21')]=function(_0x38c609,_0x4f3f11){if(_0x38c609['body']['id']){delete _0x38c609[_0x1a9b('0x46')]['id'];}return db[_0x1a9b('0x3b')]['find']({'where':{'id':_0x38c609['params']['id']}})[_0x1a9b('0x22')](handleEntityNotFound(_0x4f3f11,null))[_0x1a9b('0x22')](saveUpdates(_0x38c609[_0x1a9b('0x46')],null))['then'](respondWithResult(_0x4f3f11,null))[_0x1a9b('0x3f')](handleError(_0x4f3f11,null));};exports[_0x1a9b('0x23')]=function(_0x437ec9,_0x6484dc){return db[_0x1a9b('0x3b')][_0x1a9b('0x44')]({'where':{'id':_0x437ec9[_0x1a9b('0x41')]['id']}})['then'](handleEntityNotFound(_0x6484dc,null))['then'](removeEntity(_0x6484dc,null))['catch'](handleError(_0x6484dc,null));};exports[_0x1a9b('0x47')]=function(_0x2d513c,_0x3a9d4a){return db[_0x1a9b('0x3b')][_0x1a9b('0x47')]()['then'](respondWithResult(_0x3a9d4a,null))[_0x1a9b('0x3f')](handleError(_0x3a9d4a,null));}; \ No newline at end of file +var _0xfd8f=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','FaxTransferReport','rawAttributes'];(function(_0x3da9ad,_0x19e536){var _0x1ffef0=function(_0xbc785b){while(--_0xbc785b){_0x3da9ad['push'](_0x3da9ad['shift']());}};_0x1ffef0(++_0x19e536);}(_0xfd8f,0xae));var _0xffd8=function(_0x5bae60,_0x46f6f3){_0x5bae60=_0x5bae60-0x0;var _0x2cd1a1=_0xfd8f[_0x5bae60];return _0x2cd1a1;};'use strict';var pdf=require(_0xffd8('0x0'));var emlformat=require(_0xffd8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xffd8('0x2'));var jsonpatch=require(_0xffd8('0x3'));var rp=require(_0xffd8('0x4'));var moment=require(_0xffd8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xffd8('0x6'));var util=require(_0xffd8('0x7'));var path=require('path');var sox=require(_0xffd8('0x8'));var csv=require(_0xffd8('0x9'));var ejs=require(_0xffd8('0xa'));var fs=require('fs');var _=require(_0xffd8('0xb'));var squel=require(_0xffd8('0xc'));var crypto=require(_0xffd8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xffd8('0xe'));var toCsv=require(_0xffd8('0x9'));var querystring=require(_0xffd8('0xf'));var Papa=require(_0xffd8('0x10'));var Redis=require('ioredis');var authService=require(_0xffd8('0x11'));var qs=require(_0xffd8('0x12'));var as=require(_0xffd8('0x13'));var hardwareService=require(_0xffd8('0x14'));var logger=require(_0xffd8('0x15'))(_0xffd8('0x16'));var utils=require(_0xffd8('0x17'));var config=require(_0xffd8('0x18'));var licenseUtil=require(_0xffd8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4999b6,_0x478cd3){_0x478cd3=_0x478cd3||0xcc;return function(_0x250b2f){if(_0x250b2f){return _0x4999b6[_0xffd8('0x1a')](_0x478cd3);}return _0x4999b6[_0xffd8('0x1b')](_0x478cd3)[_0xffd8('0x1c')]();};}function respondWithResult(_0x7910b7,_0x52844a){_0x52844a=_0x52844a||0xc8;return function(_0x36f48a){if(_0x36f48a){return _0x7910b7[_0xffd8('0x1b')](_0x52844a)[_0xffd8('0x1d')](_0x36f48a);}};}function respondWithFilteredResult(_0x31739f,_0x18bdd5){return function(_0x4eb27f){if(_0x4eb27f){var _0x6ef93e=_0x4eb27f[_0xffd8('0x1e')],_0x31bc46=_0x18bdd5[_0xffd8('0x1f')],_0x4fc61a=_0x18bdd5[_0xffd8('0x1f')]+_0x18bdd5[_0xffd8('0x20')],_0x86251f;if(_0x4fc61a>=_0x6ef93e){_0x4fc61a=_0x6ef93e;_0x86251f=0xc8;}else{_0x86251f=0xce;}_0x31739f[_0xffd8('0x1b')](_0x86251f);return _0x31739f['set'](_0xffd8('0x21'),_0x31bc46+'-'+_0x4fc61a+'/'+_0x6ef93e)[_0xffd8('0x1d')](_0x4eb27f);}return null;};}function patchUpdates(_0x2ec434){return function(_0x547ce7){try{jsonpatch['apply'](_0x547ce7,_0x2ec434,!![]);}catch(_0x3bcef5){return BPromise[_0xffd8('0x22')](_0x3bcef5);}return _0x547ce7[_0xffd8('0x23')]();};}function saveUpdates(_0x5a9211,_0x4ca566){return function(_0x5bb0bc){if(_0x5bb0bc){return _0x5bb0bc[_0xffd8('0x24')](_0x5a9211)[_0xffd8('0x25')](function(_0x180baf){return _0x180baf;});}return null;};}function removeEntity(_0x22c368,_0x5536a1){return function(_0xac3157){if(_0xac3157){return _0xac3157[_0xffd8('0x26')]()[_0xffd8('0x25')](function(){_0x22c368[_0xffd8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46bf81,_0x11ad69){return function(_0x2bea03){if(!_0x2bea03){_0x46bf81['sendStatus'](0x194);}return _0x2bea03;};}function handleError(_0x3fe4b3,_0x46de7d){_0x46de7d=_0x46de7d||0x1f4;return function(_0x4c3e3c){logger[_0xffd8('0x27')](_0x4c3e3c[_0xffd8('0x28')]);if(_0x4c3e3c['name']){delete _0x4c3e3c[_0xffd8('0x29')];}_0x3fe4b3[_0xffd8('0x1b')](_0x46de7d)['send'](_0x4c3e3c);};}exports[_0xffd8('0x2a')]=function(_0x57ba67,_0x45c5fe){var _0x288269={},_0x345bc7={},_0x41520a={'count':0x0,'rows':[]};var _0x3d5d35=_['map'](db[_0xffd8('0x2b')][_0xffd8('0x2c')],function(_0x2c1571){return{'name':_0x2c1571['fieldName'],'type':_0x2c1571['type']['key']};});_0x345bc7[_0xffd8('0x2d')]=_[_0xffd8('0x2e')](_0x3d5d35,_0xffd8('0x29'));_0x345bc7[_0xffd8('0x2f')]=_[_0xffd8('0x30')](_0x57ba67[_0xffd8('0x2f')]);_0x345bc7[_0xffd8('0x31')]=_[_0xffd8('0x32')](_0x345bc7['model'],_0x345bc7[_0xffd8('0x2f')]);_0x288269[_0xffd8('0x33')]=_[_0xffd8('0x32')](_0x345bc7['model'],qs[_0xffd8('0x34')](_0x57ba67[_0xffd8('0x2f')]['fields']));_0x288269[_0xffd8('0x33')]=_0x288269['attributes'][_0xffd8('0x35')]?_0x288269[_0xffd8('0x33')]:_0x345bc7[_0xffd8('0x2d')];if(!_0x57ba67[_0xffd8('0x2f')][_0xffd8('0x36')]('nolimit')){_0x288269[_0xffd8('0x20')]=qs[_0xffd8('0x20')](_0x57ba67[_0xffd8('0x2f')][_0xffd8('0x20')]);_0x288269[_0xffd8('0x1f')]=qs[_0xffd8('0x1f')](_0x57ba67['query']['offset']);}_0x288269[_0xffd8('0x37')]=qs[_0xffd8('0x38')](_0x57ba67[_0xffd8('0x2f')]['sort']);_0x288269[_0xffd8('0x39')]=qs[_0xffd8('0x31')](_['pick'](_0x57ba67[_0xffd8('0x2f')],_0x345bc7[_0xffd8('0x31')]),_0x3d5d35);if(_0x57ba67[_0xffd8('0x2f')][_0xffd8('0x3a')]){_0x288269[_0xffd8('0x39')]=_[_0xffd8('0x3b')](_0x288269[_0xffd8('0x39')],{'$or':_[_0xffd8('0x2e')](_0x3d5d35,function(_0x3c6b7f){if(_0x3c6b7f[_0xffd8('0x3c')]!==_0xffd8('0x3d')){var _0x281dad={};_0x281dad[_0x3c6b7f['name']]={'$like':'%'+_0x57ba67['query'][_0xffd8('0x3a')]+'%'};return _0x281dad;}})});}_0x288269=_['merge']({},_0x288269,_0x57ba67[_0xffd8('0x3e')]);var _0x26f59c={'where':_0x288269[_0xffd8('0x39')]};return db[_0xffd8('0x2b')]['count'](_0x26f59c)[_0xffd8('0x25')](function(_0x5c8801){_0x41520a['count']=_0x5c8801;if(_0x57ba67['query'][_0xffd8('0x3f')]){_0x288269['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xffd8('0x40')](_0x288269);})[_0xffd8('0x25')](function(_0x2363b4){_0x41520a['rows']=_0x2363b4;return _0x41520a;})[_0xffd8('0x25')](respondWithFilteredResult(_0x45c5fe,_0x288269))[_0xffd8('0x41')](handleError(_0x45c5fe,null));};exports[_0xffd8('0x42')]=function(_0x2e1866,_0x4386f8){var _0x357542={'raw':!![],'where':{'id':_0x2e1866[_0xffd8('0x43')]['id']}},_0x427bb8={};_0x427bb8['model']=_[_0xffd8('0x30')](db[_0xffd8('0x2b')][_0xffd8('0x2c')]);_0x427bb8[_0xffd8('0x2f')]=_['keys'](_0x2e1866[_0xffd8('0x2f')]);_0x427bb8[_0xffd8('0x31')]=_['intersection'](_0x427bb8[_0xffd8('0x2d')],_0x427bb8[_0xffd8('0x2f')]);_0x357542[_0xffd8('0x33')]=_[_0xffd8('0x32')](_0x427bb8[_0xffd8('0x2d')],qs[_0xffd8('0x34')](_0x2e1866['query']['fields']));_0x357542[_0xffd8('0x33')]=_0x357542[_0xffd8('0x33')][_0xffd8('0x35')]?_0x357542[_0xffd8('0x33')]:_0x427bb8[_0xffd8('0x2d')];if(_0x2e1866['query'][_0xffd8('0x3f')]){_0x357542[_0xffd8('0x44')]=[{'all':!![]}];}_0x357542=_[_0xffd8('0x3b')]({},_0x357542,_0x2e1866[_0xffd8('0x3e')]);return db[_0xffd8('0x2b')][_0xffd8('0x45')](_0x357542)[_0xffd8('0x25')](handleEntityNotFound(_0x4386f8,null))[_0xffd8('0x25')](respondWithResult(_0x4386f8,null))[_0xffd8('0x41')](handleError(_0x4386f8,null));};exports[_0xffd8('0x46')]=function(_0xceb389,_0x14d666){return db[_0xffd8('0x2b')][_0xffd8('0x46')](_0xceb389[_0xffd8('0x47')],{})[_0xffd8('0x25')](respondWithResult(_0x14d666,0xc9))[_0xffd8('0x41')](handleError(_0x14d666,null));};exports[_0xffd8('0x24')]=function(_0x50933c,_0x1d1537){if(_0x50933c['body']['id']){delete _0x50933c[_0xffd8('0x47')]['id'];}return db[_0xffd8('0x2b')][_0xffd8('0x45')]({'where':{'id':_0x50933c[_0xffd8('0x43')]['id']}})[_0xffd8('0x25')](handleEntityNotFound(_0x1d1537,null))[_0xffd8('0x25')](saveUpdates(_0x50933c['body'],null))[_0xffd8('0x25')](respondWithResult(_0x1d1537,null))['catch'](handleError(_0x1d1537,null));};exports['destroy']=function(_0xca05c3,_0x2feed7){return db[_0xffd8('0x2b')][_0xffd8('0x45')]({'where':{'id':_0xca05c3[_0xffd8('0x43')]['id']}})[_0xffd8('0x25')](handleEntityNotFound(_0x2feed7,null))['then'](removeEntity(_0x2feed7,null))[_0xffd8('0x41')](handleError(_0x2feed7,null));};exports[_0xffd8('0x48')]=function(_0x5a867d,_0xbcf6c){return db[_0xffd8('0x2b')][_0xffd8('0x48')]()['then'](respondWithResult(_0xbcf6c,null))[_0xffd8('0x41')](handleError(_0xbcf6c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 6b415f4..934f4b0 100644 --- a/server/api/faxTransferReport/faxTransferReport.model.js +++ b/server/api/faxTransferReport/faxTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9772=['moment','bluebird','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x5746ba,_0x5657ba){var _0x21cbfc=function(_0x38734b){while(--_0x38734b){_0x5746ba['push'](_0x5746ba['shift']());}};_0x21cbfc(++_0x5657ba);}(_0x9772,0xe7));var _0x2977=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x9772[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x2977('0x0'));var util=require('util');var logger=require(_0x2977('0x1'))(_0x2977('0x2'));var moment=require(_0x2977('0x3'));var BPromise=require(_0x2977('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2977('0x5'));var rimraf=require('rimraf');var config=require(_0x2977('0x6'));var attributes=require(_0x2977('0x7'));module[_0x2977('0x8')]=function(_0x342cb3,_0x168829){return _0x342cb3[_0x2977('0x9')](_0x2977('0xa'),attributes,{'tableName':_0x2977('0xb'),'paranoid':![],'indexes':[{'name':_0x2977('0xc'),'fields':[_0x2977('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x4d12c0,_0x19f3af){var _0x216508=function(_0xbb45a){while(--_0xbb45a){_0x4d12c0['push'](_0x4d12c0['shift']());}};_0x216508(++_0x19f3af);}(_0x7a2d,0x142));var _0xd7a2=function(_0x3e5501,_0x456563){_0x3e5501=_0x3e5501-0x0;var _0x51c573=_0x7a2d[_0x3e5501];return _0x51c573;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var logger=require(_0xd7a2('0x2'))(_0xd7a2('0x3'));var moment=require(_0xd7a2('0x4'));var BPromise=require(_0xd7a2('0x5'));var rp=require(_0xd7a2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd7a2('0x7'));var attributes=require(_0xd7a2('0x8'));module[_0xd7a2('0x9')]=function(_0x13b19d,_0x4f0c6b){return _0x13b19d[_0xd7a2('0xa')](_0xd7a2('0xb'),attributes,{'tableName':_0xd7a2('0xc'),'paranoid':![],'indexes':[{'name':_0xd7a2('0xd'),'fields':[_0xd7a2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 6ceef5e..64eb714 100644 --- a/server/api/faxTransferReport/faxTransferReport.rpc.js +++ b/server/api/faxTransferReport/faxTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11c6=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5aef81,_0x3ffc89){var _0x395296=function(_0x119d2e){while(--_0x119d2e){_0x5aef81['push'](_0x5aef81['shift']());}};_0x395296(++_0x3ffc89);}(_0x11c6,0x18f));var _0x611c=function(_0x2369aa,_0x49de68){_0x2369aa=_0x2369aa-0x0;var _0x17ecf3=_0x11c6[_0x2369aa];return _0x17ecf3;};'use strict';var _=require(_0x611c('0x0'));var util=require(_0x611c('0x1'));var moment=require(_0x611c('0x2'));var BPromise=require(_0x611c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x611c('0x4'));var db=require(_0x611c('0x5'))['db'];var utils=require(_0x611c('0x6'));var logger=require(_0x611c('0x7'))(_0x611c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x611c('0x9')][_0x611c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x317064,_0x24a4b8,_0x4fd5bf){return new BPromise(function(_0x594d19,_0x32cc33){return client['request'](_0x317064,_0x4fd5bf)[_0x611c('0xb')](function(_0x3a3193){logger[_0x611c('0xc')](_0x611c('0xd'),_0x24a4b8,_0x611c('0xe'));logger[_0x611c('0xf')](_0x611c('0x10'),_0x24a4b8,_0x611c('0xe'),JSON[_0x611c('0x11')](_0x3a3193));if(_0x3a3193[_0x611c('0x12')]){if(_0x3a3193[_0x611c('0x12')][_0x611c('0x13')]===0x1f4){logger['error'](_0x611c('0xd'),_0x24a4b8,_0x3a3193['error'][_0x611c('0x14')]);return _0x32cc33(_0x3a3193['error'][_0x611c('0x14')]);}logger[_0x611c('0x12')](_0x611c('0xd'),_0x24a4b8,_0x3a3193[_0x611c('0x12')][_0x611c('0x14')]);return _0x594d19(_0x3a3193[_0x611c('0x12')][_0x611c('0x14')]);}else{logger[_0x611c('0xc')](_0x611c('0xd'),_0x24a4b8,'request\x20sent');_0x594d19(_0x3a3193[_0x611c('0x15')][_0x611c('0x14')]);}})[_0x611c('0x16')](function(_0x280625){logger['error'](_0x611c('0xd'),_0x24a4b8,_0x280625);_0x32cc33(_0x280625);});});} \ No newline at end of file +var _0xb53c=['client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0xb53c,0x141));var _0xcb53=function(_0x1213cf,_0x1ad683){_0x1213cf=_0x1213cf-0x0;var _0x2f77c3=_0xb53c[_0x1213cf];return _0x2f77c3;};'use strict';var _=require(_0xcb53('0x0'));var util=require(_0xcb53('0x1'));var moment=require('moment');var BPromise=require(_0xcb53('0x2'));var rs=require(_0xcb53('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb53('0x4'))['db'];var utils=require(_0xcb53('0x5'));var logger=require(_0xcb53('0x6'))(_0xcb53('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb53('0x8'));var client=jayson[_0xcb53('0x9')][_0xcb53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c88ea,_0x220cfa,_0x2afb96){return new BPromise(function(_0x589856,_0x4d83c3){return client['request'](_0x1c88ea,_0x2afb96)[_0xcb53('0xb')](function(_0x286128){logger[_0xcb53('0xc')](_0xcb53('0xd'),_0x220cfa,_0xcb53('0xe'));logger['debug'](_0xcb53('0xf'),_0x220cfa,_0xcb53('0xe'),JSON[_0xcb53('0x10')](_0x286128));if(_0x286128[_0xcb53('0x11')]){if(_0x286128[_0xcb53('0x11')][_0xcb53('0x12')]===0x1f4){logger[_0xcb53('0x11')](_0xcb53('0xd'),_0x220cfa,_0x286128[_0xcb53('0x11')][_0xcb53('0x13')]);return _0x4d83c3(_0x286128[_0xcb53('0x11')][_0xcb53('0x13')]);}logger[_0xcb53('0x11')](_0xcb53('0xd'),_0x220cfa,_0x286128['error'][_0xcb53('0x13')]);return _0x589856(_0x286128['error'][_0xcb53('0x13')]);}else{logger[_0xcb53('0xc')](_0xcb53('0xd'),_0x220cfa,_0xcb53('0xe'));_0x589856(_0x286128[_0xcb53('0x14')]['message']);}})[_0xcb53('0x15')](function(_0x5c4ba7){logger[_0xcb53('0x11')](_0xcb53('0xd'),_0x220cfa,_0x5c4ba7);_0x4d83c3(_0x5c4ba7);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index c92e014..2fb5163 100644 --- a/server/api/faxTransferReport/index.js +++ b/server/api/faxTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c9c=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1c9c,0xc1));var _0xc1c9=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x1c9c[_0x46b22a];return _0x44c2e8;};'use strict';var multer=require(_0xc1c9('0x0'));var util=require(_0xc1c9('0x1'));var path=require(_0xc1c9('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1c9('0x3'));var router=express[_0xc1c9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc1c9('0x5'));var config=require(_0xc1c9('0x6'));var controller=require(_0xc1c9('0x7'));router[_0xc1c9('0x8')]('/',auth['isAuthenticated'](),controller[_0xc1c9('0x9')]);router[_0xc1c9('0x8')]('/describe',auth[_0xc1c9('0xa')](),controller[_0xc1c9('0xb')]);router['get'](_0xc1c9('0xc'),auth['isAuthenticated'](),controller[_0xc1c9('0xd')]);router[_0xc1c9('0xe')]('/',auth['isAuthenticated'](),controller[_0xc1c9('0xf')]);router[_0xc1c9('0x10')](_0xc1c9('0xc'),auth['isAuthenticated'](),controller[_0xc1c9('0x11')]);router[_0xc1c9('0x12')](_0xc1c9('0xc'),auth[_0xc1c9('0xa')](),controller[_0xc1c9('0x13')]);module[_0xc1c9('0x14')]=router; \ No newline at end of file +var _0xb729=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','util'];(function(_0x225815,_0x5db310){var _0x47a32e=function(_0xafe283){while(--_0xafe283){_0x225815['push'](_0x225815['shift']());}};_0x47a32e(++_0x5db310);}(_0xb729,0x12b));var _0x9b72=function(_0x4b8b74,_0x1e5dc3){_0x4b8b74=_0x4b8b74-0x0;var _0x12e5b0=_0xb729[_0x4b8b74];return _0x12e5b0;};'use strict';var multer=require('multer');var util=require(_0x9b72('0x0'));var path=require(_0x9b72('0x1'));var timeout=require(_0x9b72('0x2'));var express=require(_0x9b72('0x3'));var router=express[_0x9b72('0x4')]();var auth=require(_0x9b72('0x5'));var interaction=require(_0x9b72('0x6'));var config=require('../../config/environment');var controller=require(_0x9b72('0x7'));router[_0x9b72('0x8')]('/',auth[_0x9b72('0x9')](),controller[_0x9b72('0xa')]);router[_0x9b72('0x8')](_0x9b72('0xb'),auth[_0x9b72('0x9')](),controller[_0x9b72('0xc')]);router[_0x9b72('0x8')](_0x9b72('0xd'),auth[_0x9b72('0x9')](),controller[_0x9b72('0xe')]);router[_0x9b72('0xf')]('/',auth[_0x9b72('0x9')](),controller[_0x9b72('0x10')]);router[_0x9b72('0x11')](_0x9b72('0xd'),auth['isAuthenticated'](),controller[_0x9b72('0x12')]);router['delete'](_0x9b72('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x9b72('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0cdef68..d3e1d96 100644 --- a/server/api/intDeskAccount/index.js +++ b/server/api/intDeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe315=['update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x9148ba,_0x2cb1b5){var _0x355e3b=function(_0x134846){while(--_0x134846){_0x9148ba['push'](_0x9148ba['shift']());}};_0x355e3b(++_0x2cb1b5);}(_0xe315,0x81));var _0x5e31=function(_0x5bc7ec,_0x410eca){_0x5bc7ec=_0x5bc7ec-0x0;var _0x4f5380=_0xe315[_0x5bc7ec];return _0x4f5380;};'use strict';var multer=require(_0x5e31('0x0'));var util=require(_0x5e31('0x1'));var path=require('path');var timeout=require(_0x5e31('0x2'));var express=require(_0x5e31('0x3'));var router=express[_0x5e31('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5e31('0x5'));var config=require('../../config/environment');var controller=require(_0x5e31('0x6'));router[_0x5e31('0x7')]('/',auth[_0x5e31('0x8')](),controller[_0x5e31('0x9')]);router[_0x5e31('0x7')](_0x5e31('0xa'),auth[_0x5e31('0x8')](),controller[_0x5e31('0xb')]);router['get']('/:id/configurations',auth[_0x5e31('0x8')](),controller[_0x5e31('0xc')]);router[_0x5e31('0x7')]('/:id/fields',auth[_0x5e31('0x8')](),controller[_0x5e31('0xd')]);router[_0x5e31('0xe')]('/',auth['isAuthenticated'](),controller[_0x5e31('0xf')]);router['post'](_0x5e31('0x10'),auth['isAuthenticated'](),controller[_0x5e31('0x11')]);router['put'](_0x5e31('0xa'),auth[_0x5e31('0x8')](),controller[_0x5e31('0x12')]);router[_0x5e31('0x13')](_0x5e31('0xa'),auth[_0x5e31('0x8')](),controller[_0x5e31('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd6f5=['/:id','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','index','get','show','/:id/fields','post','create','/:id/configurations','addConfiguration','put'];(function(_0x54be1a,_0x3bb687){var _0x4a7b5f=function(_0xf8903d){while(--_0xf8903d){_0x54be1a['push'](_0x54be1a['shift']());}};_0x4a7b5f(++_0x3bb687);}(_0xd6f5,0x1cb));var _0x5d6f=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xd6f5[_0x117f4c];return _0x2b24e9;};'use strict';var multer=require('multer');var util=require(_0x5d6f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5d6f('0x1'));var router=express[_0x5d6f('0x2')]();var auth=require(_0x5d6f('0x3'));var interaction=require(_0x5d6f('0x4'));var config=require('../../config/environment');var controller=require(_0x5d6f('0x5'));router['get']('/',auth[_0x5d6f('0x6')](),controller[_0x5d6f('0x7')]);router[_0x5d6f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5d6f('0x9')]);router[_0x5d6f('0x8')]('/:id/configurations',auth[_0x5d6f('0x6')](),controller['getConfigurations']);router['get'](_0x5d6f('0xa'),auth[_0x5d6f('0x6')](),controller['getFields']);router[_0x5d6f('0xb')]('/',auth[_0x5d6f('0x6')](),controller[_0x5d6f('0xc')]);router[_0x5d6f('0xb')](_0x5d6f('0xd'),auth[_0x5d6f('0x6')](),controller[_0x5d6f('0xe')]);router[_0x5d6f('0xf')](_0x5d6f('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x5d6f('0x11')](_0x5d6f('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x5d6f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8198275..c00e8ff 100644 --- a/server/api/intDeskAccount/intDeskAccount.attributes.js +++ b/server/api/intDeskAccount/intDeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfece=['newTab','sequelize','exports','STRING','basic','ENUM','integrationTab'];(function(_0x51b2f7,_0x303ad2){var _0x556d95=function(_0x43bbdb){while(--_0x43bbdb){_0x51b2f7['push'](_0x51b2f7['shift']());}};_0x556d95(++_0x303ad2);}(_0xfece,0x19e));var _0xefec=function(_0x5a97b8,_0x33ed78){_0x5a97b8=_0x5a97b8-0x0;var _0x11e028=_0xfece[_0x5a97b8];return _0x11e028;};'use strict';var Sequelize=require(_0xefec('0x0'));module[_0xefec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xefec('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0xefec('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xefec('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xefec('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xefec('0x4')](_0xefec('0x5'),_0xefec('0x6')),'defaultValue':_0xefec('0x5')}}; \ No newline at end of file +var _0xb4e2=['sequelize','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x38d975,_0x1ade49){var _0x10d6c5=function(_0x5637c0){while(--_0x5637c0){_0x38d975['push'](_0x38d975['shift']());}};_0x10d6c5(++_0x1ade49);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0xc6863c,_0x5b704f){_0xc6863c=_0xc6863c-0x0;var _0x3ac6f5=_0xb4e2[_0xc6863c];return _0x3ac6f5;};'use strict';var Sequelize=require(_0x2b4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2b4e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x2b4e('0x2')),'defaultValue':_0x2b4e('0x2')},'password':{'type':Sequelize[_0x2b4e('0x1')]},'consumerKey':{'type':Sequelize[_0x2b4e('0x1')]},'consumerSecret':{'type':Sequelize[_0x2b4e('0x1')]},'token':{'type':Sequelize[_0x2b4e('0x1')]},'tokenSecret':{'type':Sequelize[_0x2b4e('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2b4e('0x3')](_0x2b4e('0x4'),_0x2b4e('0x5')),'defaultValue':_0x2b4e('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 8645971..4424f9c 100644 --- a/server/api/intDeskAccount/intDeskAccount.controller.js +++ b/server/api/intDeskAccount/intDeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1737=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','end','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','DeskAccount','rows','show','include','options','find','create','update','body','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Descriptions','getDescriptions','channel','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','format','application/json','basic','headers','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x323fbe,_0x49950e){var _0xf491ed=function(_0x3a6169){while(--_0x3a6169){_0x323fbe['push'](_0x323fbe['shift']());}};_0xf491ed(++_0x49950e);}(_0x1737,0x1d5));var _0x7173=function(_0x405aff,_0x4f078f){_0x405aff=_0x405aff-0x0;var _0x47abb7=_0x1737[_0x405aff];return _0x47abb7;};'use strict';var pdf=require(_0x7173('0x0'));var emlformat=require(_0x7173('0x1'));var rimraf=require(_0x7173('0x2'));var zipdir=require(_0x7173('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7173('0x4'));var moment=require(_0x7173('0x5'));var BPromise=require(_0x7173('0x6'));var Mustache=require(_0x7173('0x7'));var util=require(_0x7173('0x8'));var path=require(_0x7173('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7173('0xa'));var fs=require('fs');var _=require(_0x7173('0xb'));var squel=require(_0x7173('0xc'));var crypto=require(_0x7173('0xd'));var jsforce=require(_0x7173('0xe'));var deskjs=require(_0x7173('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7173('0x10'));var Papa=require('papaparse');var Redis=require(_0x7173('0x11'));var authService=require(_0x7173('0x12'));var qs=require(_0x7173('0x13'));var as=require(_0x7173('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7173('0x15'))(_0x7173('0x16'));var utils=require(_0x7173('0x17'));var config=require(_0x7173('0x18'));var licenseUtil=require(_0x7173('0x19'));var db=require(_0x7173('0x1a'))['db'];var integrations=require(_0x7173('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x7173('0x1c')][_0x7173('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2b1e4e,_0x24b183,_0x3dfae1,_0x93afdd){return new BPromise(function(_0x465c17,_0x1c5d35){var _0x1d23a4=_0x93afdd||client;return _0x1d23a4['request'](_0x2b1e4e,_0x3dfae1)['then'](function(_0x24315b){logger[_0x7173('0x1e')](_0x7173('0x1f'),_0x24b183,_0x7173('0x20'));logger['debug'](_0x7173('0x21'),_0x24b183,'request\x20sent',JSON[_0x7173('0x22')](_0x24315b));if(_0x24315b[_0x7173('0x23')]){if(_0x24315b[_0x7173('0x23')]['code']===0x1f4){logger[_0x7173('0x23')]('DeskAccount,\x20%s,\x20%s',_0x24b183,_0x24315b[_0x7173('0x23')][_0x7173('0x24')]);return _0x1c5d35(_0x24315b['error'][_0x7173('0x24')]);}logger[_0x7173('0x23')](_0x7173('0x1f'),_0x24b183,_0x24315b['error']['message']);return _0x465c17(_0x24315b[_0x7173('0x23')][_0x7173('0x24')]);}else{logger['info'](_0x7173('0x1f'),_0x24b183,_0x7173('0x20'));_0x465c17(_0x24315b[_0x7173('0x25')][_0x7173('0x24')]);}})[_0x7173('0x26')](function(_0x33f5c2){logger['error'](_0x7173('0x1f'),_0x24b183,_0x33f5c2);_0x1c5d35(_0x33f5c2);});});}function respondWithStatusCode(_0x2c84ee,_0x2d4a49){_0x2d4a49=_0x2d4a49||0xcc;return function(_0x3a465f){if(_0x3a465f){return _0x2c84ee[_0x7173('0x27')](_0x2d4a49);}return _0x2c84ee['status'](_0x2d4a49)['end']();};}function respondWithResult(_0x5cf054,_0x2606c9){_0x2606c9=_0x2606c9||0xc8;return function(_0x394b7d){if(_0x394b7d){return _0x5cf054[_0x7173('0x28')](_0x2606c9)['json'](_0x394b7d);}};}function respondWithFilteredResult(_0x295376,_0x43b2a2){return function(_0x4de541){if(_0x4de541){var _0x1a1a48=_0x4de541[_0x7173('0x29')],_0x476724=_0x43b2a2[_0x7173('0x2a')],_0x497ce0=_0x43b2a2['offset']+_0x43b2a2[_0x7173('0x2b')],_0x40179d;if(_0x497ce0>=_0x1a1a48){_0x497ce0=_0x1a1a48;_0x40179d=0xc8;}else{_0x40179d=0xce;}_0x295376['status'](_0x40179d);return _0x295376[_0x7173('0x2c')](_0x7173('0x2d'),_0x476724+'-'+_0x497ce0+'/'+_0x1a1a48)[_0x7173('0x2e')](_0x4de541);}return null;};}function patchUpdates(_0x237893){return function(_0xb60f0a){try{jsonpatch[_0x7173('0x2f')](_0xb60f0a,_0x237893,!![]);}catch(_0x533171){return BPromise[_0x7173('0x30')](_0x533171);}return _0xb60f0a[_0x7173('0x31')]();};}function saveUpdates(_0x494b0f,_0x2cad24){return function(_0x3facfb){if(_0x3facfb){return _0x3facfb['update'](_0x494b0f)['then'](function(_0x5a5617){return _0x5a5617;});}return null;};}function removeEntity(_0x3f7cd4,_0x4b5d62){return function(_0x5ce260){if(_0x5ce260){return _0x5ce260[_0x7173('0x32')]()[_0x7173('0x33')](function(){_0x3f7cd4[_0x7173('0x28')](0xcc)[_0x7173('0x34')]();});}};}function handleEntityNotFound(_0x7a262b,_0x2f4d9e){return function(_0x163098){if(!_0x163098){_0x7a262b[_0x7173('0x27')](0x194);}return _0x163098;};}function handleError(_0x1b2bd4,_0x6b1244){_0x6b1244=_0x6b1244||0x1f4;return function(_0x2099e0){logger['error'](_0x2099e0['stack']);if(_0x2099e0[_0x7173('0x35')]){delete _0x2099e0[_0x7173('0x35')];}_0x1b2bd4[_0x7173('0x28')](_0x6b1244)[_0x7173('0x36')](_0x2099e0);};}exports[_0x7173('0x37')]=function(_0x1e51d5,_0x102667){var _0x396e49={},_0x2ae004={},_0x1376d5={'count':0x0,'rows':[]};var _0x1ad3e6=_[_0x7173('0x38')](db['DeskAccount'][_0x7173('0x39')],function(_0x435529){return{'name':_0x435529[_0x7173('0x3a')],'type':_0x435529[_0x7173('0x3b')][_0x7173('0x3c')]};});_0x2ae004[_0x7173('0x3d')]=_[_0x7173('0x38')](_0x1ad3e6,_0x7173('0x35'));_0x2ae004['query']=_[_0x7173('0x3e')](_0x1e51d5[_0x7173('0x3f')]);_0x2ae004[_0x7173('0x40')]=_['intersection'](_0x2ae004[_0x7173('0x3d')],_0x2ae004[_0x7173('0x3f')]);_0x396e49['attributes']=_[_0x7173('0x41')](_0x2ae004['model'],qs['fields'](_0x1e51d5['query'][_0x7173('0x42')]));_0x396e49[_0x7173('0x43')]=_0x396e49[_0x7173('0x43')][_0x7173('0x44')]?_0x396e49[_0x7173('0x43')]:_0x2ae004[_0x7173('0x3d')];if(!_0x1e51d5['query'][_0x7173('0x45')]('nolimit')){_0x396e49[_0x7173('0x2b')]=qs[_0x7173('0x2b')](_0x1e51d5['query'][_0x7173('0x2b')]);_0x396e49[_0x7173('0x2a')]=qs[_0x7173('0x2a')](_0x1e51d5[_0x7173('0x3f')][_0x7173('0x2a')]);}_0x396e49['order']=qs[_0x7173('0x46')](_0x1e51d5['query'][_0x7173('0x46')]);_0x396e49[_0x7173('0x47')]=qs['filters'](_[_0x7173('0x48')](_0x1e51d5[_0x7173('0x3f')],_0x2ae004[_0x7173('0x40')]),_0x1ad3e6);if(_0x1e51d5['query'][_0x7173('0x49')]){_0x396e49[_0x7173('0x47')]=_['merge'](_0x396e49[_0x7173('0x47')],{'$or':_['map'](_0x1ad3e6,function(_0x2c0004){if(_0x2c0004['type']!==_0x7173('0x4a')){var _0x427416={};_0x427416[_0x2c0004['name']]={'$like':'%'+_0x1e51d5['query'][_0x7173('0x49')]+'%'};return _0x427416;}})});}_0x396e49=_[_0x7173('0x4b')]({},_0x396e49,_0x1e51d5['options']);var _0x518fcf={'where':_0x396e49[_0x7173('0x47')]};return db[_0x7173('0x4c')]['count'](_0x518fcf)[_0x7173('0x33')](function(_0x5457c8){_0x1376d5[_0x7173('0x29')]=_0x5457c8;if(_0x1e51d5['query']['includeAll']){_0x396e49['include']=[{'all':!![]}];}return db[_0x7173('0x4c')]['findAll'](_0x396e49);})['then'](function(_0x28218d){_0x1376d5[_0x7173('0x4d')]=_0x28218d;return _0x1376d5;})[_0x7173('0x33')](respondWithFilteredResult(_0x102667,_0x396e49))[_0x7173('0x26')](handleError(_0x102667,null));};exports[_0x7173('0x4e')]=function(_0x43034c,_0x5c75ce){var _0x3d45d2={'raw':![],'where':{'id':_0x43034c['params']['id']}},_0x43d00e={};_0x43d00e['model']=_[_0x7173('0x3e')](db[_0x7173('0x4c')][_0x7173('0x39')]);_0x43d00e[_0x7173('0x3f')]=_['keys'](_0x43034c['query']);_0x43d00e[_0x7173('0x40')]=_['intersection'](_0x43d00e['model'],_0x43d00e[_0x7173('0x3f')]);_0x3d45d2[_0x7173('0x43')]=_[_0x7173('0x41')](_0x43d00e[_0x7173('0x3d')],qs['fields'](_0x43034c[_0x7173('0x3f')][_0x7173('0x42')]));_0x3d45d2['attributes']=_0x3d45d2[_0x7173('0x43')]['length']?_0x3d45d2[_0x7173('0x43')]:_0x43d00e[_0x7173('0x3d')];if(_0x43034c[_0x7173('0x3f')]['includeAll']){_0x3d45d2[_0x7173('0x4f')]=[{'all':!![]}];}_0x3d45d2=_[_0x7173('0x4b')]({},_0x3d45d2,_0x43034c[_0x7173('0x50')]);return db['DeskAccount'][_0x7173('0x51')](_0x3d45d2)['then'](handleEntityNotFound(_0x5c75ce,null))['then'](respondWithResult(_0x5c75ce,null))[_0x7173('0x26')](handleError(_0x5c75ce,null));};exports[_0x7173('0x52')]=function(_0x3f9f1f,_0x2de6c3){return db[_0x7173('0x4c')][_0x7173('0x52')](_0x3f9f1f['body'],{})[_0x7173('0x33')](respondWithResult(_0x2de6c3,0xc9))[_0x7173('0x26')](handleError(_0x2de6c3,null));};exports[_0x7173('0x53')]=function(_0x27f393,_0x25619f){if(_0x27f393[_0x7173('0x54')]['id']){delete _0x27f393['body']['id'];}return db[_0x7173('0x4c')]['find']({'where':{'id':_0x27f393[_0x7173('0x55')]['id']}})[_0x7173('0x33')](handleEntityNotFound(_0x25619f,null))[_0x7173('0x33')](saveUpdates(_0x27f393[_0x7173('0x54')],null))['then'](respondWithResult(_0x25619f,null))[_0x7173('0x26')](handleError(_0x25619f,null));};exports['destroy']=function(_0x38cd09,_0x1e95c9){return db['DeskAccount'][_0x7173('0x51')]({'where':{'id':_0x38cd09[_0x7173('0x55')]['id']}})['then'](handleEntityNotFound(_0x1e95c9,null))[_0x7173('0x33')](removeEntity(_0x1e95c9,null))[_0x7173('0x26')](handleError(_0x1e95c9,null));};exports[_0x7173('0x56')]=function(_0x2334f5,_0x1ca8fa,_0x5e86e7){var _0x46a5af={};var _0x44402c={};var _0x2d5f7b;var _0x7da72e;return db['DeskAccount'][_0x7173('0x57')]({'where':{'id':_0x2334f5[_0x7173('0x55')]['id']}})[_0x7173('0x33')](handleEntityNotFound(_0x1ca8fa,null))['then'](function(_0xd0fcfd){if(_0xd0fcfd){_0x2d5f7b=_0xd0fcfd;_0x44402c['model']=_[_0x7173('0x3e')](db['DeskConfiguration'][_0x7173('0x39')]);_0x44402c['query']=_[_0x7173('0x3e')](_0x2334f5[_0x7173('0x3f')]);_0x44402c[_0x7173('0x40')]=_[_0x7173('0x41')](_0x44402c[_0x7173('0x3d')],_0x44402c[_0x7173('0x3f')]);_0x46a5af[_0x7173('0x43')]=_[_0x7173('0x41')](_0x44402c['model'],qs['fields'](_0x2334f5[_0x7173('0x3f')][_0x7173('0x42')]));_0x46a5af[_0x7173('0x43')]=_0x46a5af[_0x7173('0x43')]['length']?_0x46a5af[_0x7173('0x43')]:_0x44402c[_0x7173('0x3d')];_0x46a5af['order']=qs[_0x7173('0x46')](_0x2334f5[_0x7173('0x3f')]['sort']);_0x46a5af[_0x7173('0x47')]=qs[_0x7173('0x40')](_[_0x7173('0x48')](_0x2334f5[_0x7173('0x3f')],_0x44402c['filters']));if(_0x2334f5[_0x7173('0x3f')][_0x7173('0x49')]){_0x46a5af['where']=_[_0x7173('0x4b')](_0x46a5af[_0x7173('0x47')],{'$or':_['map'](_0x46a5af[_0x7173('0x43')],function(_0xaeba3c){var _0x518fc9={};_0x518fc9[_0xaeba3c]={'$like':'%'+_0x2334f5[_0x7173('0x3f')]['filter']+'%'};return _0x518fc9;})});}_0x46a5af=_['merge']({},_0x46a5af,_0x2334f5[_0x7173('0x50')]);return _0x2d5f7b[_0x7173('0x56')](_0x46a5af);}})['then'](function(_0x4e61e5){if(_0x4e61e5){_0x7da72e=_0x4e61e5[_0x7173('0x44')];if(!_0x2334f5[_0x7173('0x3f')][_0x7173('0x45')](_0x7173('0x58'))){_0x46a5af[_0x7173('0x2b')]=qs[_0x7173('0x2b')](_0x2334f5[_0x7173('0x3f')][_0x7173('0x2b')]);_0x46a5af['offset']=qs[_0x7173('0x2a')](_0x2334f5[_0x7173('0x3f')][_0x7173('0x2a')]);}return _0x2d5f7b[_0x7173('0x56')](_0x46a5af);}})[_0x7173('0x33')](function(_0x280d2e){if(_0x280d2e){return _0x280d2e?{'count':_0x7da72e,'rows':_0x280d2e}:null;}})[_0x7173('0x33')](respondWithResult(_0x1ca8fa,null))[_0x7173('0x26')](handleError(_0x1ca8fa,null));};exports[_0x7173('0x59')]=function(_0x11ab70,_0x57a55f,_0x2d07d2){if(_0x11ab70[_0x7173('0x54')]['id']){delete _0x11ab70[_0x7173('0x54')]['id'];}return db['DeskAccount'][_0x7173('0x57')]({'where':{'id':_0x11ab70[_0x7173('0x55')]['id']}})[_0x7173('0x33')](handleEntityNotFound(_0x57a55f,null))['then'](function(_0x12589c){if(_0x12589c){_0x11ab70[_0x7173('0x54')][_0x7173('0x5a')]=_0x12589c['id'];_0x11ab70[_0x7173('0x54')]['Subjects']=integrations['getSubjects'](_0x11ab70[_0x7173('0x54')]['channel'],_0x11ab70[_0x7173('0x54')][_0x7173('0x3b')]);_0x11ab70[_0x7173('0x54')][_0x7173('0x5b')]=integrations[_0x7173('0x5c')](_0x11ab70[_0x7173('0x54')][_0x7173('0x5d')],_0x11ab70[_0x7173('0x54')]['type']);return db[_0x7173('0x5e')]['create'](_0x11ab70[_0x7173('0x54')],{'include':[{'model':db[_0x7173('0x5f')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x7173('0x5b')}]});}return null;})[_0x7173('0x33')](respondWithResult(_0x57a55f,null))[_0x7173('0x26')](handleError(_0x57a55f,null));};exports[_0x7173('0x60')]=function(_0x3b5dac,_0x462a80,_0x2aa347){var _0x35e2ca=[{'name':'priority','label':_0x7173('0x61'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1d50dd='';return db[_0x7173('0x4c')][_0x7173('0x57')]({'where':{'id':_0x3b5dac[_0x7173('0x55')]['id']},'attributes':['id',_0x7173('0x62'),_0x7173('0x63'),_0x7173('0x64'),_0x7173('0x65'),_0x7173('0x66'),'consumerSecret',_0x7173('0x67'),_0x7173('0x68')]})[_0x7173('0x33')](handleEntityNotFound(_0x462a80,null))[_0x7173('0x33')](function(_0x241f2b){if(_0x241f2b){_0x1d50dd=_0x241f2b[_0x7173('0x62')];var _0x1bb769=_0x1d50dd[_0x7173('0x69')](-0x1);if(_0x1bb769==='/'){_0x1d50dd=_0x1d50dd['substring'](0x0,_0x1d50dd['lastIndexOf'](_0x1bb769));}var _0x4d676c={'method':'GET','uri':util[_0x7173('0x6a')]('%s/custom_fields',_0x1d50dd),'headers':{'Content-Type':_0x7173('0x6b'),'Accept':_0x7173('0x6b')},'json':!![]};if(_0x241f2b['authType']===_0x7173('0x6c')){_0x4d676c[_0x7173('0x6d')]['Authorization']=util[_0x7173('0x6a')](_0x7173('0x6e'),new Buffer(util[_0x7173('0x6a')](_0x7173('0x6f'),_0x241f2b['username'],_0x241f2b[_0x7173('0x65')]))[_0x7173('0x70')](_0x7173('0x71')));}return rp(_0x4d676c)[_0x7173('0x33')](function(_0x5f5bc2){return _0x35e2ca[_0x7173('0x72')](_['map'](_0x5f5bc2[_0x7173('0x73')][_0x7173('0x74')],function(_0x344118){return{'id':_0x344118['name'],'name':_0x344118[_0x7173('0x35')],'type':_0x344118[_0x7173('0x3b')],'active':_0x344118[_0x7173('0x75')],'label':_0x344118[_0x7173('0x76')],'custom':!![]};}));});}})[_0x7173('0x33')](function(_0x212dee){return{'count':_0x212dee['length'],'rows':_0x212dee};})[_0x7173('0x33')](respondWithResult(_0x462a80,null))[_0x7173('0x26')](function(_0x47c6dc){var _0x43d131=_0x3b5dac[_0x7173('0x3f')][_0x7173('0x77')]?0x1f4:_0x47c6dc['statusCode']||0x1f4;logger[_0x7173('0x23')](_0x7173('0x78'),_0x7173('0x60'),_0x43d131,JSON['stringify'](_0x47c6dc));delete _0x47c6dc[_0x7173('0x35')];if(_0x43d131===0x191){_0x43d131=0x190;}_0x462a80['status'](_0x43d131)['send'](_0x3b5dac[_0x7173('0x3f')]['test']?{'message':_0x7173('0x79'),'statusCode':_0x47c6dc[_0x7173('0x7a')]}:_0x47c6dc);});}; \ No newline at end of file +var _0x78a7=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','jayson/promise','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','DeskAccount','include','findAll','rows','show','length','includeAll','find','catch','create','body','params','findOne','DeskConfiguration','sort','pick','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','label','test','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','moment','bluebird'];(function(_0x1151ec,_0x4576b9){var _0xce4b78=function(_0x9d4742){while(--_0x9d4742){_0x1151ec['push'](_0x1151ec['shift']());}};_0xce4b78(++_0x4576b9);}(_0x78a7,0xeb));var _0x778a=function(_0x401f2e,_0x119d0d){_0x401f2e=_0x401f2e-0x0;var _0x4ef876=_0x78a7[_0x401f2e];return _0x4ef876;};'use strict';var pdf=require(_0x778a('0x0'));var emlformat=require(_0x778a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x778a('0x2'));var rp=require('request-promise');var moment=require(_0x778a('0x3'));var BPromise=require(_0x778a('0x4'));var Mustache=require('mustache');var util=require(_0x778a('0x5'));var path=require(_0x778a('0x6'));var sox=require(_0x778a('0x7'));var csv=require(_0x778a('0x8'));var ejs=require(_0x778a('0x9'));var fs=require('fs');var _=require(_0x778a('0xa'));var squel=require(_0x778a('0xb'));var crypto=require('crypto');var jsforce=require(_0x778a('0xc'));var deskjs=require(_0x778a('0xd'));var toCsv=require(_0x778a('0x8'));var querystring=require(_0x778a('0xe'));var Papa=require(_0x778a('0xf'));var Redis=require('ioredis');var authService=require(_0x778a('0x10'));var qs=require(_0x778a('0x11'));var as=require(_0x778a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x778a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x778a('0x14'));var licenseUtil=require(_0x778a('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x778a('0x16'));var client=jayson['client'][_0x778a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3d8e3f,_0x5e9dba,_0x5c91bf,_0x43f776){return new BPromise(function(_0x174ad5,_0x487ceb){var _0x58f521=_0x43f776||client;return _0x58f521[_0x778a('0x18')](_0x3d8e3f,_0x5c91bf)['then'](function(_0xee831){logger['info'](_0x778a('0x19'),_0x5e9dba,_0x778a('0x1a'));logger[_0x778a('0x1b')](_0x778a('0x1c'),_0x5e9dba,_0x778a('0x1a'),JSON[_0x778a('0x1d')](_0xee831));if(_0xee831[_0x778a('0x1e')]){if(_0xee831['error']['code']===0x1f4){logger[_0x778a('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x5e9dba,_0xee831[_0x778a('0x1e')]['message']);return _0x487ceb(_0xee831[_0x778a('0x1e')][_0x778a('0x1f')]);}logger['error'](_0x778a('0x19'),_0x5e9dba,_0xee831['error'][_0x778a('0x1f')]);return _0x174ad5(_0xee831['error']['message']);}else{logger[_0x778a('0x20')]('DeskAccount,\x20%s,\x20%s',_0x5e9dba,'request\x20sent');_0x174ad5(_0xee831[_0x778a('0x21')][_0x778a('0x1f')]);}})['catch'](function(_0x5d1d4d){logger[_0x778a('0x1e')](_0x778a('0x19'),_0x5e9dba,_0x5d1d4d);_0x487ceb(_0x5d1d4d);});});}function respondWithStatusCode(_0x3d40c4,_0x3a19f3){_0x3a19f3=_0x3a19f3||0xcc;return function(_0x5b4c4a){if(_0x5b4c4a){return _0x3d40c4[_0x778a('0x22')](_0x3a19f3);}return _0x3d40c4[_0x778a('0x23')](_0x3a19f3)[_0x778a('0x24')]();};}function respondWithResult(_0xb142cf,_0x22aa47){_0x22aa47=_0x22aa47||0xc8;return function(_0xa8729a){if(_0xa8729a){return _0xb142cf[_0x778a('0x23')](_0x22aa47)[_0x778a('0x25')](_0xa8729a);}};}function respondWithFilteredResult(_0x4f58b1,_0xcaf66){return function(_0x1787ab){if(_0x1787ab){var _0x52b959=_0x1787ab[_0x778a('0x26')],_0x10e870=_0xcaf66[_0x778a('0x27')],_0x14fc91=_0xcaf66[_0x778a('0x27')]+_0xcaf66[_0x778a('0x28')],_0x5e2ff9;if(_0x14fc91>=_0x52b959){_0x14fc91=_0x52b959;_0x5e2ff9=0xc8;}else{_0x5e2ff9=0xce;}_0x4f58b1['status'](_0x5e2ff9);return _0x4f58b1['set'](_0x778a('0x29'),_0x10e870+'-'+_0x14fc91+'/'+_0x52b959)[_0x778a('0x25')](_0x1787ab);}return null;};}function patchUpdates(_0x3298b5){return function(_0x1440dd){try{jsonpatch[_0x778a('0x2a')](_0x1440dd,_0x3298b5,!![]);}catch(_0x91fee){return BPromise[_0x778a('0x2b')](_0x91fee);}return _0x1440dd['save']();};}function saveUpdates(_0x2c4a10,_0x4d18d9){return function(_0x2b85b0){if(_0x2b85b0){return _0x2b85b0[_0x778a('0x2c')](_0x2c4a10)[_0x778a('0x2d')](function(_0x4a933d){return _0x4a933d;});}return null;};}function removeEntity(_0x3f9b5c,_0x2f5cb0){return function(_0x244cbe){if(_0x244cbe){return _0x244cbe[_0x778a('0x2e')]()[_0x778a('0x2d')](function(){_0x3f9b5c[_0x778a('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28fedc,_0xd06661){return function(_0x2c86f8){if(!_0x2c86f8){_0x28fedc[_0x778a('0x22')](0x194);}return _0x2c86f8;};}function handleError(_0x309573,_0x380618){_0x380618=_0x380618||0x1f4;return function(_0x1d2043){logger[_0x778a('0x1e')](_0x1d2043[_0x778a('0x2f')]);if(_0x1d2043[_0x778a('0x30')]){delete _0x1d2043['name'];}_0x309573[_0x778a('0x23')](_0x380618)['send'](_0x1d2043);};}exports[_0x778a('0x31')]=function(_0x5b003b,_0x190468){var _0x2b8060={},_0x21b24d={},_0x4c4734={'count':0x0,'rows':[]};var _0x383f89=_[_0x778a('0x32')](db['DeskAccount'][_0x778a('0x33')],function(_0x24f908){return{'name':_0x24f908[_0x778a('0x34')],'type':_0x24f908[_0x778a('0x35')][_0x778a('0x36')]};});_0x21b24d[_0x778a('0x37')]=_['map'](_0x383f89,'name');_0x21b24d[_0x778a('0x38')]=_[_0x778a('0x39')](_0x5b003b[_0x778a('0x38')]);_0x21b24d['filters']=_[_0x778a('0x3a')](_0x21b24d[_0x778a('0x37')],_0x21b24d[_0x778a('0x38')]);_0x2b8060[_0x778a('0x3b')]=_[_0x778a('0x3a')](_0x21b24d[_0x778a('0x37')],qs[_0x778a('0x3c')](_0x5b003b[_0x778a('0x38')][_0x778a('0x3c')]));_0x2b8060[_0x778a('0x3b')]=_0x2b8060[_0x778a('0x3b')]['length']?_0x2b8060[_0x778a('0x3b')]:_0x21b24d[_0x778a('0x37')];if(!_0x5b003b['query'][_0x778a('0x3d')](_0x778a('0x3e'))){_0x2b8060[_0x778a('0x28')]=qs[_0x778a('0x28')](_0x5b003b['query'][_0x778a('0x28')]);_0x2b8060[_0x778a('0x27')]=qs[_0x778a('0x27')](_0x5b003b['query'][_0x778a('0x27')]);}_0x2b8060[_0x778a('0x3f')]=qs['sort'](_0x5b003b[_0x778a('0x38')]['sort']);_0x2b8060[_0x778a('0x40')]=qs[_0x778a('0x41')](_['pick'](_0x5b003b['query'],_0x21b24d[_0x778a('0x41')]),_0x383f89);if(_0x5b003b[_0x778a('0x38')][_0x778a('0x42')]){_0x2b8060[_0x778a('0x40')]=_[_0x778a('0x43')](_0x2b8060[_0x778a('0x40')],{'$or':_[_0x778a('0x32')](_0x383f89,function(_0xd38b49){if(_0xd38b49[_0x778a('0x35')]!==_0x778a('0x44')){var _0x582add={};_0x582add[_0xd38b49[_0x778a('0x30')]]={'$like':'%'+_0x5b003b[_0x778a('0x38')]['filter']+'%'};return _0x582add;}})});}_0x2b8060=_[_0x778a('0x43')]({},_0x2b8060,_0x5b003b[_0x778a('0x45')]);var _0x3ff305={'where':_0x2b8060[_0x778a('0x40')]};return db[_0x778a('0x46')][_0x778a('0x26')](_0x3ff305)['then'](function(_0x5de680){_0x4c4734[_0x778a('0x26')]=_0x5de680;if(_0x5b003b[_0x778a('0x38')]['includeAll']){_0x2b8060[_0x778a('0x47')]=[{'all':!![]}];}return db[_0x778a('0x46')][_0x778a('0x48')](_0x2b8060);})[_0x778a('0x2d')](function(_0x1fc241){_0x4c4734[_0x778a('0x49')]=_0x1fc241;return _0x4c4734;})[_0x778a('0x2d')](respondWithFilteredResult(_0x190468,_0x2b8060))['catch'](handleError(_0x190468,null));};exports[_0x778a('0x4a')]=function(_0xcb560b,_0x32cef3){var _0x2aa54b={'raw':![],'where':{'id':_0xcb560b['params']['id']}},_0x46172b={};_0x46172b[_0x778a('0x37')]=_['keys'](db[_0x778a('0x46')][_0x778a('0x33')]);_0x46172b[_0x778a('0x38')]=_[_0x778a('0x39')](_0xcb560b[_0x778a('0x38')]);_0x46172b['filters']=_[_0x778a('0x3a')](_0x46172b[_0x778a('0x37')],_0x46172b[_0x778a('0x38')]);_0x2aa54b['attributes']=_[_0x778a('0x3a')](_0x46172b[_0x778a('0x37')],qs[_0x778a('0x3c')](_0xcb560b[_0x778a('0x38')][_0x778a('0x3c')]));_0x2aa54b['attributes']=_0x2aa54b[_0x778a('0x3b')][_0x778a('0x4b')]?_0x2aa54b['attributes']:_0x46172b[_0x778a('0x37')];if(_0xcb560b['query'][_0x778a('0x4c')]){_0x2aa54b[_0x778a('0x47')]=[{'all':!![]}];}_0x2aa54b=_[_0x778a('0x43')]({},_0x2aa54b,_0xcb560b[_0x778a('0x45')]);return db[_0x778a('0x46')][_0x778a('0x4d')](_0x2aa54b)[_0x778a('0x2d')](handleEntityNotFound(_0x32cef3,null))['then'](respondWithResult(_0x32cef3,null))[_0x778a('0x4e')](handleError(_0x32cef3,null));};exports[_0x778a('0x4f')]=function(_0x51e47b,_0x37c433){return db[_0x778a('0x46')]['create'](_0x51e47b['body'],{})[_0x778a('0x2d')](respondWithResult(_0x37c433,0xc9))['catch'](handleError(_0x37c433,null));};exports[_0x778a('0x2c')]=function(_0x2bc41c,_0x4c2048){if(_0x2bc41c[_0x778a('0x50')]['id']){delete _0x2bc41c[_0x778a('0x50')]['id'];}return db[_0x778a('0x46')][_0x778a('0x4d')]({'where':{'id':_0x2bc41c[_0x778a('0x51')]['id']}})[_0x778a('0x2d')](handleEntityNotFound(_0x4c2048,null))[_0x778a('0x2d')](saveUpdates(_0x2bc41c[_0x778a('0x50')],null))[_0x778a('0x2d')](respondWithResult(_0x4c2048,null))[_0x778a('0x4e')](handleError(_0x4c2048,null));};exports[_0x778a('0x2e')]=function(_0x3b615a,_0x566a26){return db[_0x778a('0x46')][_0x778a('0x4d')]({'where':{'id':_0x3b615a[_0x778a('0x51')]['id']}})['then'](handleEntityNotFound(_0x566a26,null))[_0x778a('0x2d')](removeEntity(_0x566a26,null))[_0x778a('0x4e')](handleError(_0x566a26,null));};exports['getConfigurations']=function(_0x13a90b,_0x313d94,_0x30fb73){var _0x18935d={};var _0x40c077={};var _0x47d66e;var _0x3a7811;return db[_0x778a('0x46')][_0x778a('0x52')]({'where':{'id':_0x13a90b[_0x778a('0x51')]['id']}})[_0x778a('0x2d')](handleEntityNotFound(_0x313d94,null))['then'](function(_0x3c2612){if(_0x3c2612){_0x47d66e=_0x3c2612;_0x40c077['model']=_[_0x778a('0x39')](db[_0x778a('0x53')][_0x778a('0x33')]);_0x40c077[_0x778a('0x38')]=_[_0x778a('0x39')](_0x13a90b[_0x778a('0x38')]);_0x40c077['filters']=_['intersection'](_0x40c077[_0x778a('0x37')],_0x40c077[_0x778a('0x38')]);_0x18935d[_0x778a('0x3b')]=_['intersection'](_0x40c077[_0x778a('0x37')],qs[_0x778a('0x3c')](_0x13a90b[_0x778a('0x38')][_0x778a('0x3c')]));_0x18935d[_0x778a('0x3b')]=_0x18935d[_0x778a('0x3b')][_0x778a('0x4b')]?_0x18935d['attributes']:_0x40c077[_0x778a('0x37')];_0x18935d[_0x778a('0x3f')]=qs[_0x778a('0x54')](_0x13a90b[_0x778a('0x38')][_0x778a('0x54')]);_0x18935d[_0x778a('0x40')]=qs[_0x778a('0x41')](_[_0x778a('0x55')](_0x13a90b[_0x778a('0x38')],_0x40c077['filters']));if(_0x13a90b[_0x778a('0x38')]['filter']){_0x18935d['where']=_[_0x778a('0x43')](_0x18935d['where'],{'$or':_[_0x778a('0x32')](_0x18935d[_0x778a('0x3b')],function(_0x5a4501){var _0x35b9ca={};_0x35b9ca[_0x5a4501]={'$like':'%'+_0x13a90b[_0x778a('0x38')][_0x778a('0x42')]+'%'};return _0x35b9ca;})});}_0x18935d=_[_0x778a('0x43')]({},_0x18935d,_0x13a90b[_0x778a('0x45')]);return _0x47d66e[_0x778a('0x56')](_0x18935d);}})[_0x778a('0x2d')](function(_0x1888ca){if(_0x1888ca){_0x3a7811=_0x1888ca[_0x778a('0x4b')];if(!_0x13a90b[_0x778a('0x38')][_0x778a('0x3d')](_0x778a('0x3e'))){_0x18935d[_0x778a('0x28')]=qs[_0x778a('0x28')](_0x13a90b['query']['limit']);_0x18935d[_0x778a('0x27')]=qs[_0x778a('0x27')](_0x13a90b['query'][_0x778a('0x27')]);}return _0x47d66e['getConfigurations'](_0x18935d);}})[_0x778a('0x2d')](function(_0x5de60f){if(_0x5de60f){return _0x5de60f?{'count':_0x3a7811,'rows':_0x5de60f}:null;}})[_0x778a('0x2d')](respondWithResult(_0x313d94,null))[_0x778a('0x4e')](handleError(_0x313d94,null));};exports[_0x778a('0x57')]=function(_0x139c39,_0x30dbee,_0x1edde6){if(_0x139c39[_0x778a('0x50')]['id']){delete _0x139c39['body']['id'];}return db[_0x778a('0x46')]['findOne']({'where':{'id':_0x139c39[_0x778a('0x51')]['id']}})[_0x778a('0x2d')](handleEntityNotFound(_0x30dbee,null))[_0x778a('0x2d')](function(_0x7305ca){if(_0x7305ca){_0x139c39[_0x778a('0x50')][_0x778a('0x58')]=_0x7305ca['id'];_0x139c39[_0x778a('0x50')][_0x778a('0x59')]=integrations['getSubjects'](_0x139c39['body'][_0x778a('0x5a')],_0x139c39[_0x778a('0x50')][_0x778a('0x35')]);_0x139c39[_0x778a('0x50')][_0x778a('0x5b')]=integrations[_0x778a('0x5c')](_0x139c39['body'][_0x778a('0x5a')],_0x139c39[_0x778a('0x50')][_0x778a('0x35')]);return db[_0x778a('0x53')][_0x778a('0x4f')](_0x139c39['body'],{'include':[{'model':db[_0x778a('0x5d')],'as':'Subjects'},{'model':db[_0x778a('0x5d')],'as':_0x778a('0x5b')}]});}return null;})[_0x778a('0x2d')](respondWithResult(_0x30dbee,null))[_0x778a('0x4e')](handleError(_0x30dbee,null));};exports['getFields']=function(_0x5ac95a,_0x5ca8e0,_0x5c5e8c){var _0x3a55ec=[{'name':_0x778a('0x5e'),'label':_0x778a('0x5e'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x44d18c='';return db[_0x778a('0x46')][_0x778a('0x52')]({'where':{'id':_0x5ac95a[_0x778a('0x51')]['id']},'attributes':['id',_0x778a('0x5f'),_0x778a('0x60'),'username',_0x778a('0x61'),_0x778a('0x62'),_0x778a('0x63'),_0x778a('0x64'),_0x778a('0x65')]})[_0x778a('0x2d')](handleEntityNotFound(_0x5ca8e0,null))[_0x778a('0x2d')](function(_0x2c84ce){if(_0x2c84ce){_0x44d18c=_0x2c84ce[_0x778a('0x5f')];var _0x166349=_0x44d18c['slice'](-0x1);if(_0x166349==='/'){_0x44d18c=_0x44d18c[_0x778a('0x66')](0x0,_0x44d18c['lastIndexOf'](_0x166349));}var _0x5335e8={'method':_0x778a('0x67'),'uri':util[_0x778a('0x68')](_0x778a('0x69'),_0x44d18c),'headers':{'Content-Type':'application/json','Accept':_0x778a('0x6a')},'json':!![]};if(_0x2c84ce[_0x778a('0x60')]===_0x778a('0x6b')){_0x5335e8[_0x778a('0x6c')][_0x778a('0x6d')]=util[_0x778a('0x68')](_0x778a('0x6e'),new Buffer(util[_0x778a('0x68')]('%s:%s',_0x2c84ce['username'],_0x2c84ce[_0x778a('0x61')]))[_0x778a('0x6f')](_0x778a('0x70')));}return rp(_0x5335e8)[_0x778a('0x2d')](function(_0x1de108){return _0x3a55ec[_0x778a('0x71')](_['map'](_0x1de108[_0x778a('0x72')]['entries'],function(_0x3e5f55){return{'id':_0x3e5f55[_0x778a('0x30')],'name':_0x3e5f55['name'],'type':_0x3e5f55[_0x778a('0x35')],'active':_0x3e5f55['active'],'label':_0x3e5f55[_0x778a('0x73')],'custom':!![]};}));});}})['then'](function(_0x14ee3c){return{'count':_0x14ee3c[_0x778a('0x4b')],'rows':_0x14ee3c};})['then'](respondWithResult(_0x5ca8e0,null))[_0x778a('0x4e')](function(_0x1f91d1){var _0x3df57d=_0x5ac95a[_0x778a('0x38')][_0x778a('0x74')]?0x1f4:_0x1f91d1[_0x778a('0x75')]||0x1f4;logger[_0x778a('0x1e')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3df57d,JSON[_0x778a('0x1d')](_0x1f91d1));delete _0x1f91d1['name'];if(_0x3df57d===0x191){_0x3df57d=0x190;}_0x5ca8e0[_0x778a('0x23')](_0x3df57d)[_0x778a('0x76')](_0x5ac95a[_0x778a('0x38')][_0x778a('0x74')]?{'message':_0x778a('0x77'),'statusCode':_0x1f91d1[_0x778a('0x75')]}:_0x1f91d1);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d23b3b7..9cb5da3 100644 --- a/server/api/intDeskAccount/intDeskAccount.model.js +++ b/server/api/intDeskAccount/intDeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f9d=['path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x430f70,_0x4f6959){var _0x201f7c=function(_0x3b8755){while(--_0x3b8755){_0x430f70['push'](_0x430f70['shift']());}};_0x201f7c(++_0x4f6959);}(_0x3f9d,0xe8));var _0xd3f9=function(_0x1d3b9d,_0xdd459c){_0x1d3b9d=_0x1d3b9d-0x0;var _0x5caef6=_0x3f9d[_0x1d3b9d];return _0x5caef6;};'use strict';var _=require(_0xd3f9('0x0'));var util=require('util');var logger=require(_0xd3f9('0x1'))(_0xd3f9('0x2'));var moment=require(_0xd3f9('0x3'));var BPromise=require(_0xd3f9('0x4'));var rp=require(_0xd3f9('0x5'));var fs=require('fs');var path=require(_0xd3f9('0x6'));var rimraf=require(_0xd3f9('0x7'));var config=require(_0xd3f9('0x8'));var attributes=require(_0xd3f9('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xd3f9('0xa')]=function(_0x3f8211,_0x80f907){return _0x3f8211[_0xd3f9('0xb')](_0xd3f9('0xc'),attributes,{'tableName':_0xd3f9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c56=['../../config/logger','moment','bluebird','path','define','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x1505cb,_0x48a459){var _0x26d02a=function(_0x11f2d0){while(--_0x11f2d0){_0x1505cb['push'](_0x1505cb['shift']());}};_0x26d02a(++_0x48a459);}(_0x9c56,0x193));var _0x69c5=function(_0x1fb625,_0xb025a8){_0x1fb625=_0x1fb625-0x0;var _0xe462cf=_0x9c56[_0x1fb625];return _0xe462cf;};'use strict';var _=require(_0x69c5('0x0'));var util=require(_0x69c5('0x1'));var logger=require(_0x69c5('0x2'))('api');var moment=require(_0x69c5('0x3'));var BPromise=require(_0x69c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69c5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x9565d7,_0xdee36e){return _0x9565d7[_0x69c5('0x6')](_0x69c5('0x7'),attributes,{'tableName':_0x69c5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 3be83ad..239c01a 100644 --- a/server/api/intDeskAccount/intDeskAccount.rpc.js +++ b/server/api/intDeskAccount/intDeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9141=['include','model','map','ShowDeskAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit'];(function(_0x5dc22f,_0x359956){var _0x5cabf5=function(_0x391b49){while(--_0x391b49){_0x5dc22f['push'](_0x5dc22f['shift']());}};_0x5cabf5(++_0x359956);}(_0x9141,0xf4));var _0x1914=function(_0x424aeb,_0x1e683b){_0x424aeb=_0x424aeb-0x0;var _0x27762e=_0x9141[_0x424aeb];return _0x27762e;};'use strict';var _=require(_0x1914('0x0'));var util=require('util');var moment=require(_0x1914('0x1'));var BPromise=require(_0x1914('0x2'));var rs=require(_0x1914('0x3'));var fs=require('fs');var Redis=require(_0x1914('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1914('0x5'));var logger=require('../../config/logger')(_0x1914('0x6'));var config=require(_0x1914('0x7'));var jayson=require(_0x1914('0x8'));var client=jayson['client'][_0x1914('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x457dbc,_0x149218,_0x2711cf){return new BPromise(function(_0x4a9c64,_0x4329ce){return client[_0x1914('0xa')](_0x457dbc,_0x2711cf)[_0x1914('0xb')](function(_0x5833e6){logger[_0x1914('0xc')](_0x1914('0xd'),_0x149218,_0x1914('0xe'));logger[_0x1914('0xf')](_0x1914('0x10'),_0x149218,'request\x20sent',JSON['stringify'](_0x5833e6));if(_0x5833e6[_0x1914('0x11')]){if(_0x5833e6[_0x1914('0x11')][_0x1914('0x12')]===0x1f4){logger[_0x1914('0x11')]('DeskAccount,\x20%s,\x20%s',_0x149218,_0x5833e6[_0x1914('0x11')]['message']);return _0x4329ce(_0x5833e6[_0x1914('0x11')]['message']);}logger[_0x1914('0x11')]('DeskAccount,\x20%s,\x20%s',_0x149218,_0x5833e6[_0x1914('0x11')][_0x1914('0x13')]);return _0x4a9c64(_0x5833e6[_0x1914('0x11')][_0x1914('0x13')]);}else{logger[_0x1914('0xc')](_0x1914('0xd'),_0x149218,'request\x20sent');_0x4a9c64(_0x5833e6['result'][_0x1914('0x13')]);}})[_0x1914('0x14')](function(_0x1cff34){logger['error'](_0x1914('0xd'),_0x149218,_0x1cff34);_0x4329ce(_0x1cff34);});});}exports[_0x1914('0x15')]=function(_0x549645){var _0x3e403b=this;return new Promise(function(_0x23b946,_0x82a157){return db[_0x1914('0x16')][_0x1914('0x17')]({'raw':_0x549645[_0x1914('0x18')]?_0x549645['options'][_0x1914('0x19')]===undefined?!![]:![]:!![],'where':_0x549645[_0x1914('0x18')]?_0x549645[_0x1914('0x18')]['where']||null:null,'attributes':_0x549645[_0x1914('0x18')]?_0x549645['options'][_0x1914('0x1a')]||null:null,'limit':_0x549645[_0x1914('0x18')]?_0x549645[_0x1914('0x18')][_0x1914('0x1b')]||null:null,'include':_0x549645[_0x1914('0x18')]?_0x549645[_0x1914('0x18')][_0x1914('0x1c')]?_['map'](_0x549645['options'][_0x1914('0x1c')],function(_0x112b23){return{'model':db[_0x112b23[_0x1914('0x1d')]],'as':_0x112b23['as'],'attributes':_0x112b23[_0x1914('0x1a')],'include':_0x112b23[_0x1914('0x1c')]?_['map'](_0x112b23[_0x1914('0x1c')],function(_0x5189bb){return{'model':db[_0x5189bb[_0x1914('0x1d')]],'as':_0x5189bb['as'],'attributes':_0x5189bb[_0x1914('0x1a')],'include':_0x5189bb['include']?_[_0x1914('0x1e')](_0x5189bb['include'],function(_0x246209){return{'model':db[_0x246209[_0x1914('0x1d')]],'as':_0x246209['as'],'attributes':_0x246209[_0x1914('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c369b){logger[_0x1914('0xc')]('GetDeskAccount',_0x549645);logger[_0x1914('0xf')](_0x1914('0x15'),_0x549645,JSON['stringify'](_0x1c369b));_0x23b946(_0x1c369b);})[_0x1914('0x14')](function(_0x3db095){logger[_0x1914('0x11')]('GetDeskAccount',_0x3db095[_0x1914('0x13')],_0x549645);_0x82a157(_0x3e403b[_0x1914('0x11')](0x1f4,_0x3db095[_0x1914('0x13')]));});});};exports[_0x1914('0x1f')]=function(_0x1955b7){var _0x2f256b=this;return new Promise(function(_0x4ad631,_0x156c5f){return db[_0x1914('0x16')][_0x1914('0x20')]({'raw':_0x1955b7[_0x1914('0x18')]?_0x1955b7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1955b7['options']?_0x1955b7[_0x1914('0x18')][_0x1914('0x21')]||null:null,'attributes':_0x1955b7[_0x1914('0x18')]?_0x1955b7['options'][_0x1914('0x1a')]||null:null,'include':_0x1955b7[_0x1914('0x18')]?_0x1955b7[_0x1914('0x18')][_0x1914('0x1c')]?_[_0x1914('0x1e')](_0x1955b7[_0x1914('0x18')][_0x1914('0x1c')],function(_0x346c33){return{'model':db[_0x346c33[_0x1914('0x1d')]],'as':_0x346c33['as'],'attributes':_0x346c33[_0x1914('0x1a')],'include':_0x346c33[_0x1914('0x1c')]?_[_0x1914('0x1e')](_0x346c33[_0x1914('0x1c')],function(_0x1b314e){return{'model':db[_0x1b314e[_0x1914('0x1d')]],'as':_0x1b314e['as'],'attributes':_0x1b314e[_0x1914('0x1a')],'include':_0x1b314e['include']?_[_0x1914('0x1e')](_0x1b314e['include'],function(_0x12b4c2){return{'model':db[_0x12b4c2[_0x1914('0x1d')]],'as':_0x12b4c2['as'],'attributes':_0x12b4c2[_0x1914('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1914('0xb')](function(_0x231ad8){logger[_0x1914('0xc')](_0x1914('0x1f'),_0x1955b7);logger[_0x1914('0xf')](_0x1914('0x1f'),_0x1955b7,JSON['stringify'](_0x231ad8));_0x4ad631(_0x231ad8);})['catch'](function(_0x22278f){logger[_0x1914('0x11')](_0x1914('0x1f'),_0x22278f[_0x1914('0x13')],_0x1955b7);_0x156c5f(_0x2f256b[_0x1914('0x11')](0x1f4,_0x22278f[_0x1914('0x13')]));});});}; \ No newline at end of file +var _0x3571=['message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount','DeskAccount','find','ShowDeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x80582a,_0x31d6f0){var _0x1a6e2d=function(_0x264f10){while(--_0x264f10){_0x80582a['push'](_0x80582a['shift']());}};_0x1a6e2d(++_0x31d6f0);}(_0x3571,0x166));var _0x1357=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x3571[_0x2125f0];return _0x12d6eb;};'use strict';var _=require('lodash');var util=require(_0x1357('0x0'));var moment=require(_0x1357('0x1'));var BPromise=require(_0x1357('0x2'));var rs=require(_0x1357('0x3'));var fs=require('fs');var Redis=require(_0x1357('0x4'));var db=require(_0x1357('0x5'))['db'];var utils=require(_0x1357('0x6'));var logger=require(_0x1357('0x7'))(_0x1357('0x8'));var config=require(_0x1357('0x9'));var jayson=require(_0x1357('0xa'));var client=jayson[_0x1357('0xb')][_0x1357('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32af90,_0x56642e,_0x3c936d){return new BPromise(function(_0x5ce27e,_0x2acf1a){return client['request'](_0x32af90,_0x3c936d)[_0x1357('0xd')](function(_0x4ac306){logger[_0x1357('0xe')](_0x1357('0xf'),_0x56642e,_0x1357('0x10'));logger[_0x1357('0x11')](_0x1357('0x12'),_0x56642e,_0x1357('0x10'),JSON[_0x1357('0x13')](_0x4ac306));if(_0x4ac306[_0x1357('0x14')]){if(_0x4ac306[_0x1357('0x14')][_0x1357('0x15')]===0x1f4){logger[_0x1357('0x14')]('DeskAccount,\x20%s,\x20%s',_0x56642e,_0x4ac306[_0x1357('0x14')][_0x1357('0x16')]);return _0x2acf1a(_0x4ac306[_0x1357('0x14')][_0x1357('0x16')]);}logger[_0x1357('0x14')](_0x1357('0xf'),_0x56642e,_0x4ac306['error']['message']);return _0x5ce27e(_0x4ac306[_0x1357('0x14')][_0x1357('0x16')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x56642e,'request\x20sent');_0x5ce27e(_0x4ac306[_0x1357('0x17')][_0x1357('0x16')]);}})[_0x1357('0x18')](function(_0x4ce237){logger['error'](_0x1357('0xf'),_0x56642e,_0x4ce237);_0x2acf1a(_0x4ce237);});});}exports['GetDeskAccount']=function(_0x32b683){var _0x5426be=this;return new Promise(function(_0xcfccc8,_0x2df9cf){return db['DeskAccount'][_0x1357('0x19')]({'raw':_0x32b683[_0x1357('0x1a')]?_0x32b683[_0x1357('0x1a')][_0x1357('0x1b')]===undefined?!![]:![]:!![],'where':_0x32b683[_0x1357('0x1a')]?_0x32b683[_0x1357('0x1a')][_0x1357('0x1c')]||null:null,'attributes':_0x32b683['options']?_0x32b683[_0x1357('0x1a')][_0x1357('0x1d')]||null:null,'limit':_0x32b683[_0x1357('0x1a')]?_0x32b683['options'][_0x1357('0x1e')]||null:null,'include':_0x32b683[_0x1357('0x1a')]?_0x32b683[_0x1357('0x1a')][_0x1357('0x1f')]?_[_0x1357('0x20')](_0x32b683[_0x1357('0x1a')][_0x1357('0x1f')],function(_0x5b4105){return{'model':db[_0x5b4105[_0x1357('0x21')]],'as':_0x5b4105['as'],'attributes':_0x5b4105[_0x1357('0x1d')],'include':_0x5b4105[_0x1357('0x1f')]?_[_0x1357('0x20')](_0x5b4105[_0x1357('0x1f')],function(_0x463bb7){return{'model':db[_0x463bb7['model']],'as':_0x463bb7['as'],'attributes':_0x463bb7[_0x1357('0x1d')],'include':_0x463bb7[_0x1357('0x1f')]?_[_0x1357('0x20')](_0x463bb7[_0x1357('0x1f')],function(_0x33a2c7){return{'model':db[_0x33a2c7[_0x1357('0x21')]],'as':_0x33a2c7['as'],'attributes':_0x33a2c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1357('0xd')](function(_0x58fa28){logger[_0x1357('0xe')](_0x1357('0x22'),_0x32b683);logger[_0x1357('0x11')]('GetDeskAccount',_0x32b683,JSON[_0x1357('0x13')](_0x58fa28));_0xcfccc8(_0x58fa28);})[_0x1357('0x18')](function(_0x2ebb49){logger[_0x1357('0x14')]('GetDeskAccount',_0x2ebb49[_0x1357('0x16')],_0x32b683);_0x2df9cf(_0x5426be[_0x1357('0x14')](0x1f4,_0x2ebb49['message']));});});};exports['ShowDeskAccount']=function(_0x2d14a9){var _0x2adacd=this;return new Promise(function(_0x5cbc63,_0x5ace50){return db[_0x1357('0x23')][_0x1357('0x24')]({'raw':_0x2d14a9[_0x1357('0x1a')]?_0x2d14a9[_0x1357('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2d14a9['options']?_0x2d14a9[_0x1357('0x1a')][_0x1357('0x1c')]||null:null,'attributes':_0x2d14a9[_0x1357('0x1a')]?_0x2d14a9['options'][_0x1357('0x1d')]||null:null,'include':_0x2d14a9['options']?_0x2d14a9['options'][_0x1357('0x1f')]?_[_0x1357('0x20')](_0x2d14a9[_0x1357('0x1a')][_0x1357('0x1f')],function(_0x53c2a6){return{'model':db[_0x53c2a6[_0x1357('0x21')]],'as':_0x53c2a6['as'],'attributes':_0x53c2a6[_0x1357('0x1d')],'include':_0x53c2a6[_0x1357('0x1f')]?_[_0x1357('0x20')](_0x53c2a6[_0x1357('0x1f')],function(_0x39568d){return{'model':db[_0x39568d['model']],'as':_0x39568d['as'],'attributes':_0x39568d[_0x1357('0x1d')],'include':_0x39568d[_0x1357('0x1f')]?_[_0x1357('0x20')](_0x39568d[_0x1357('0x1f')],function(_0x4bfdbf){return{'model':db[_0x4bfdbf['model']],'as':_0x4bfdbf['as'],'attributes':_0x4bfdbf[_0x1357('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b3663){logger[_0x1357('0xe')](_0x1357('0x25'),_0x2d14a9);logger[_0x1357('0x11')]('ShowDeskAccount',_0x2d14a9,JSON[_0x1357('0x13')](_0x3b3663));_0x5cbc63(_0x3b3663);})[_0x1357('0x18')](function(_0x6ed4e7){logger[_0x1357('0x14')]('ShowDeskAccount',_0x6ed4e7['message'],_0x2d14a9);_0x5ace50(_0x2adacd['error'](0x1f4,_0x6ed4e7[_0x1357('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 7aa599d..49f00ba 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a03=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','setTags','put','/:id','update','delete'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x4a03,0x16e));var _0x34a0=function(_0x259496,_0x5f0a32){_0x259496=_0x259496-0x0;var _0x1fd048=_0x4a03[_0x259496];return _0x1fd048;};'use strict';var multer=require('multer');var util=require(_0x34a0('0x0'));var path=require(_0x34a0('0x1'));var timeout=require(_0x34a0('0x2'));var express=require('express');var router=express[_0x34a0('0x3')]();var auth=require(_0x34a0('0x4'));var interaction=require(_0x34a0('0x5'));var config=require('../../config/environment');var controller=require(_0x34a0('0x6'));router[_0x34a0('0x7')]('/',auth['isAuthenticated'](),controller[_0x34a0('0x8')]);router[_0x34a0('0x7')]('/:id',auth[_0x34a0('0x9')](),controller[_0x34a0('0xa')]);router['get'](_0x34a0('0xb'),auth[_0x34a0('0x9')](),controller[_0x34a0('0xc')]);router[_0x34a0('0x7')](_0x34a0('0xd'),auth['isAuthenticated'](),controller[_0x34a0('0xe')]);router[_0x34a0('0x7')](_0x34a0('0xf'),auth[_0x34a0('0x9')](),controller[_0x34a0('0x10')]);router[_0x34a0('0x7')](_0x34a0('0x11'),auth[_0x34a0('0x9')](),controller['getTags']);router['post']('/',auth[_0x34a0('0x9')](),controller[_0x34a0('0x12')]);router['post'](_0x34a0('0x11'),auth[_0x34a0('0x9')](),controller[_0x34a0('0x13')]);router[_0x34a0('0x14')](_0x34a0('0x15'),auth[_0x34a0('0x9')](),controller[_0x34a0('0x16')]);router[_0x34a0('0x17')](_0x34a0('0x15'),auth[_0x34a0('0x9')](),controller[_0x34a0('0x18')]);module[_0x34a0('0x19')]=router; \ No newline at end of file +var _0x2178=['post','setTags','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags'];(function(_0x16572e,_0x28c78f){var _0x4df768=function(_0x5affcf){while(--_0x5affcf){_0x16572e['push'](_0x16572e['shift']());}};_0x4df768(++_0x28c78f);}(_0x2178,0x1b0));var _0x8217=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0x2178[_0x4322c6];return _0x4e7537;};'use strict';var multer=require(_0x8217('0x0'));var util=require('util');var path=require(_0x8217('0x1'));var timeout=require(_0x8217('0x2'));var express=require(_0x8217('0x3'));var router=express['Router']();var auth=require(_0x8217('0x4'));var interaction=require(_0x8217('0x5'));var config=require('../../config/environment');var controller=require(_0x8217('0x6'));router[_0x8217('0x7')]('/',auth[_0x8217('0x8')](),controller[_0x8217('0x9')]);router[_0x8217('0x7')](_0x8217('0xa'),auth[_0x8217('0x8')](),controller[_0x8217('0xb')]);router[_0x8217('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8217('0xc')]);router[_0x8217('0x7')](_0x8217('0xd'),auth['isAuthenticated'](),controller[_0x8217('0xe')]);router['get']('/:id/descriptions',auth[_0x8217('0x8')](),controller[_0x8217('0xf')]);router[_0x8217('0x7')](_0x8217('0x10'),auth[_0x8217('0x8')](),controller[_0x8217('0x11')]);router[_0x8217('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8217('0x10'),auth[_0x8217('0x8')](),controller[_0x8217('0x13')]);router[_0x8217('0x14')]('/:id',auth[_0x8217('0x8')](),controller[_0x8217('0x15')]);router[_0x8217('0x16')]('/:id',auth[_0x8217('0x8')](),controller[_0x8217('0x17')]);module[_0x8217('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index dc947e2..7f01dc3 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3975=['STRING','sequelize'];(function(_0x25c54e,_0xca92fe){var _0x280015=function(_0x27491d){while(--_0x27491d){_0x25c54e['push'](_0x25c54e['shift']());}};_0x280015(++_0xca92fe);}(_0x3975,0x67));var _0x5397=function(_0x3cfa0f,_0x5c68f0){_0x3cfa0f=_0x3cfa0f-0x0;var _0x422c1f=_0x3975[_0x3cfa0f];return _0x422c1f;};'use strict';var Sequelize=require(_0x5397('0x0'));module['exports']={'name':{'type':Sequelize[_0x5397('0x1')]},'description':{'type':Sequelize[_0x5397('0x1')]}}; \ No newline at end of file +var _0x3841=['STRING','exports'];(function(_0x3b2955,_0x4d761b){var _0xab1186=function(_0x1dbb6d){while(--_0x1dbb6d){_0x3b2955['push'](_0x3b2955['shift']());}};_0xab1186(++_0x4d761b);}(_0x3841,0x1c3));var _0x1384=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0x3841[_0x390733];return _0x33beb9;};'use strict';var Sequelize=require('sequelize');module[_0x1384('0x0')]={'name':{'type':Sequelize[_0x1384('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4ac7f7c..a38f409 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc153=['options','includeAll','findAll','rows','catch','show','params','find','create','body','getFields','DeskField','findOne','pick','getSubjects','getDescriptions','Tag','setTags','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc153,0xcc));var _0x3c15=function(_0x23d0eb,_0x5c64d7){_0x23d0eb=_0x23d0eb-0x0;var _0x5ebcaf=_0xc153[_0x23d0eb];return _0x5ebcaf;};'use strict';var pdf=require(_0x3c15('0x0'));var emlformat=require(_0x3c15('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3c15('0x2'));var jsonpatch=require(_0x3c15('0x3'));var rp=require(_0x3c15('0x4'));var moment=require(_0x3c15('0x5'));var BPromise=require(_0x3c15('0x6'));var Mustache=require(_0x3c15('0x7'));var util=require('util');var path=require(_0x3c15('0x8'));var sox=require(_0x3c15('0x9'));var csv=require(_0x3c15('0xa'));var ejs=require(_0x3c15('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c15('0xc'));var crypto=require(_0x3c15('0xd'));var jsforce=require(_0x3c15('0xe'));var deskjs=require(_0x3c15('0xf'));var toCsv=require(_0x3c15('0xa'));var querystring=require(_0x3c15('0x10'));var Papa=require(_0x3c15('0x11'));var Redis=require('ioredis');var authService=require(_0x3c15('0x12'));var qs=require(_0x3c15('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c15('0x14'));var logger=require('../../config/logger')(_0x3c15('0x15'));var utils=require('../../config/utils');var config=require(_0x3c15('0x16'));var licenseUtil=require(_0x3c15('0x17'));var db=require(_0x3c15('0x18'))['db'];var jayson=require(_0x3c15('0x19'));var client=jayson[_0x3c15('0x1a')][_0x3c15('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x51d22d,_0x1c36e1,_0x2f0ace,_0x1bf030){return new BPromise(function(_0x426e75,_0x16f97a){var _0x34e8e5=_0x1bf030||client;return _0x34e8e5['request'](_0x51d22d,_0x2f0ace)['then'](function(_0x352d12){logger[_0x3c15('0x1c')](_0x3c15('0x1d'),_0x1c36e1,_0x3c15('0x1e'));logger[_0x3c15('0x1f')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1c36e1,_0x3c15('0x1e'),JSON[_0x3c15('0x20')](_0x352d12));if(_0x352d12[_0x3c15('0x21')]){if(_0x352d12[_0x3c15('0x21')]['code']===0x1f4){logger['error'](_0x3c15('0x1d'),_0x1c36e1,_0x352d12[_0x3c15('0x21')][_0x3c15('0x22')]);return _0x16f97a(_0x352d12[_0x3c15('0x21')][_0x3c15('0x22')]);}logger[_0x3c15('0x21')](_0x3c15('0x1d'),_0x1c36e1,_0x352d12[_0x3c15('0x21')]['message']);return _0x426e75(_0x352d12[_0x3c15('0x21')][_0x3c15('0x22')]);}else{logger[_0x3c15('0x1c')](_0x3c15('0x1d'),_0x1c36e1,_0x3c15('0x1e'));_0x426e75(_0x352d12[_0x3c15('0x23')][_0x3c15('0x22')]);}})['catch'](function(_0x401152){logger[_0x3c15('0x21')](_0x3c15('0x1d'),_0x1c36e1,_0x401152);_0x16f97a(_0x401152);});});}function respondWithStatusCode(_0x1f8216,_0x2b6f30){_0x2b6f30=_0x2b6f30||0xcc;return function(_0x2555bd){if(_0x2555bd){return _0x1f8216[_0x3c15('0x24')](_0x2b6f30);}return _0x1f8216[_0x3c15('0x25')](_0x2b6f30)['end']();};}function respondWithResult(_0x5e83ae,_0x3306d8){_0x3306d8=_0x3306d8||0xc8;return function(_0x12196c){if(_0x12196c){return _0x5e83ae[_0x3c15('0x25')](_0x3306d8)['json'](_0x12196c);}};}function respondWithFilteredResult(_0x2a162a,_0x3340d7){return function(_0x5e06f8){if(_0x5e06f8){var _0x8afba3=_0x5e06f8[_0x3c15('0x26')],_0x5a8b1f=_0x3340d7['offset'],_0x26a390=_0x3340d7[_0x3c15('0x27')]+_0x3340d7[_0x3c15('0x28')],_0x3c1aa4;if(_0x26a390>=_0x8afba3){_0x26a390=_0x8afba3;_0x3c1aa4=0xc8;}else{_0x3c1aa4=0xce;}_0x2a162a[_0x3c15('0x25')](_0x3c1aa4);return _0x2a162a[_0x3c15('0x29')](_0x3c15('0x2a'),_0x5a8b1f+'-'+_0x26a390+'/'+_0x8afba3)[_0x3c15('0x2b')](_0x5e06f8);}return null;};}function patchUpdates(_0x351ba2){return function(_0x3f6a8d){try{jsonpatch['apply'](_0x3f6a8d,_0x351ba2,!![]);}catch(_0x32f88b){return BPromise[_0x3c15('0x2c')](_0x32f88b);}return _0x3f6a8d[_0x3c15('0x2d')]();};}function saveUpdates(_0x2d63c7,_0x2c86d9){return function(_0x5a81e9){if(_0x5a81e9){return _0x5a81e9[_0x3c15('0x2e')](_0x2d63c7)[_0x3c15('0x2f')](function(_0xc5db5f){return _0xc5db5f;});}return null;};}function removeEntity(_0x431ff8,_0x3462ac){return function(_0x380d75){if(_0x380d75){return _0x380d75[_0x3c15('0x30')]()['then'](function(){_0x431ff8['status'](0xcc)[_0x3c15('0x31')]();});}};}function handleEntityNotFound(_0x30c100,_0x214f19){return function(_0x2284be){if(!_0x2284be){_0x30c100[_0x3c15('0x24')](0x194);}return _0x2284be;};}function handleError(_0x161b5d,_0x3b4c12){_0x3b4c12=_0x3b4c12||0x1f4;return function(_0x336643){logger[_0x3c15('0x21')](_0x336643[_0x3c15('0x32')]);if(_0x336643[_0x3c15('0x33')]){delete _0x336643[_0x3c15('0x33')];}_0x161b5d[_0x3c15('0x25')](_0x3b4c12)['send'](_0x336643);};}exports[_0x3c15('0x34')]=function(_0x5c0a57,_0x5e6043){var _0x5141cf={},_0x39cbab={},_0x30291a={'count':0x0,'rows':[]};var _0x37a340=_['map'](db[_0x3c15('0x35')][_0x3c15('0x36')],function(_0x1f64f1){return{'name':_0x1f64f1[_0x3c15('0x37')],'type':_0x1f64f1[_0x3c15('0x38')][_0x3c15('0x39')]};});_0x39cbab[_0x3c15('0x3a')]=_[_0x3c15('0x3b')](_0x37a340,_0x3c15('0x33'));_0x39cbab['query']=_[_0x3c15('0x3c')](_0x5c0a57[_0x3c15('0x3d')]);_0x39cbab[_0x3c15('0x3e')]=_['intersection'](_0x39cbab[_0x3c15('0x3a')],_0x39cbab[_0x3c15('0x3d')]);_0x5141cf['attributes']=_[_0x3c15('0x3f')](_0x39cbab[_0x3c15('0x3a')],qs[_0x3c15('0x40')](_0x5c0a57[_0x3c15('0x3d')][_0x3c15('0x40')]));_0x5141cf['attributes']=_0x5141cf[_0x3c15('0x41')][_0x3c15('0x42')]?_0x5141cf[_0x3c15('0x41')]:_0x39cbab[_0x3c15('0x3a')];if(!_0x5c0a57[_0x3c15('0x3d')][_0x3c15('0x43')](_0x3c15('0x44'))){_0x5141cf[_0x3c15('0x28')]=qs[_0x3c15('0x28')](_0x5c0a57[_0x3c15('0x3d')][_0x3c15('0x28')]);_0x5141cf['offset']=qs[_0x3c15('0x27')](_0x5c0a57[_0x3c15('0x3d')]['offset']);}_0x5141cf[_0x3c15('0x45')]=qs[_0x3c15('0x46')](_0x5c0a57[_0x3c15('0x3d')][_0x3c15('0x46')]);_0x5141cf['where']=qs[_0x3c15('0x3e')](_['pick'](_0x5c0a57[_0x3c15('0x3d')],_0x39cbab['filters']),_0x37a340);if(_0x5c0a57[_0x3c15('0x3d')]['filter']){_0x5141cf[_0x3c15('0x47')]=_[_0x3c15('0x48')](_0x5141cf[_0x3c15('0x47')],{'$or':_[_0x3c15('0x3b')](_0x37a340,function(_0x24bf34){if(_0x24bf34[_0x3c15('0x38')]!==_0x3c15('0x49')){var _0x52f1f7={};_0x52f1f7[_0x24bf34[_0x3c15('0x33')]]={'$like':'%'+_0x5c0a57['query'][_0x3c15('0x4a')]+'%'};return _0x52f1f7;}})});}_0x5141cf=_[_0x3c15('0x48')]({},_0x5141cf,_0x5c0a57[_0x3c15('0x4b')]);var _0x38c2ab={'where':_0x5141cf[_0x3c15('0x47')]};return db[_0x3c15('0x35')][_0x3c15('0x26')](_0x38c2ab)[_0x3c15('0x2f')](function(_0x4aa39e){_0x30291a[_0x3c15('0x26')]=_0x4aa39e;if(_0x5c0a57[_0x3c15('0x3d')][_0x3c15('0x4c')]){_0x5141cf['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x3c15('0x4d')](_0x5141cf);})[_0x3c15('0x2f')](function(_0x2e7a3f){_0x30291a[_0x3c15('0x4e')]=_0x2e7a3f;return _0x30291a;})[_0x3c15('0x2f')](respondWithFilteredResult(_0x5e6043,_0x5141cf))[_0x3c15('0x4f')](handleError(_0x5e6043,null));};exports[_0x3c15('0x50')]=function(_0x3a7e40,_0x34156f){var _0x1432cb={'raw':![],'where':{'id':_0x3a7e40[_0x3c15('0x51')]['id']}},_0x286083={};_0x286083['model']=_[_0x3c15('0x3c')](db['DeskConfiguration'][_0x3c15('0x36')]);_0x286083['query']=_[_0x3c15('0x3c')](_0x3a7e40[_0x3c15('0x3d')]);_0x286083[_0x3c15('0x3e')]=_['intersection'](_0x286083[_0x3c15('0x3a')],_0x286083[_0x3c15('0x3d')]);_0x1432cb['attributes']=_[_0x3c15('0x3f')](_0x286083[_0x3c15('0x3a')],qs[_0x3c15('0x40')](_0x3a7e40[_0x3c15('0x3d')][_0x3c15('0x40')]));_0x1432cb[_0x3c15('0x41')]=_0x1432cb['attributes'][_0x3c15('0x42')]?_0x1432cb[_0x3c15('0x41')]:_0x286083[_0x3c15('0x3a')];if(_0x3a7e40[_0x3c15('0x3d')][_0x3c15('0x4c')]){_0x1432cb['include']=[{'all':!![]}];}_0x1432cb=_[_0x3c15('0x48')]({},_0x1432cb,_0x3a7e40[_0x3c15('0x4b')]);return db[_0x3c15('0x35')][_0x3c15('0x52')](_0x1432cb)[_0x3c15('0x2f')](handleEntityNotFound(_0x34156f,null))[_0x3c15('0x2f')](respondWithResult(_0x34156f,null))['catch'](handleError(_0x34156f,null));};exports[_0x3c15('0x53')]=function(_0x525d25,_0x438c62){return db[_0x3c15('0x35')][_0x3c15('0x53')](_0x525d25['body'],{})[_0x3c15('0x2f')](respondWithResult(_0x438c62,0xc9))['catch'](handleError(_0x438c62,null));};exports[_0x3c15('0x2e')]=function(_0x5adea1,_0xa9f539){if(_0x5adea1[_0x3c15('0x54')]['id']){delete _0x5adea1[_0x3c15('0x54')]['id'];}return db[_0x3c15('0x35')][_0x3c15('0x52')]({'where':{'id':_0x5adea1[_0x3c15('0x51')]['id']}})['then'](handleEntityNotFound(_0xa9f539,null))[_0x3c15('0x2f')](saveUpdates(_0x5adea1['body'],null))['then'](respondWithResult(_0xa9f539,null))[_0x3c15('0x4f')](handleError(_0xa9f539,null));};exports[_0x3c15('0x30')]=function(_0xdfb936,_0x173fee){return db[_0x3c15('0x35')][_0x3c15('0x52')]({'where':{'id':_0xdfb936[_0x3c15('0x51')]['id']}})[_0x3c15('0x2f')](handleEntityNotFound(_0x173fee,null))[_0x3c15('0x2f')](removeEntity(_0x173fee,null))[_0x3c15('0x4f')](handleError(_0x173fee,null));};exports[_0x3c15('0x55')]=function(_0xa5d223,_0x2f200a,_0x204519){var _0x3f2f1d={};var _0x11e66c={};var _0xedf839;var _0x980ab;return db['DeskConfiguration']['findOne']({'where':{'id':_0xa5d223[_0x3c15('0x51')]['id']}})[_0x3c15('0x2f')](handleEntityNotFound(_0x2f200a,null))[_0x3c15('0x2f')](function(_0x38a5b7){if(_0x38a5b7){_0xedf839=_0x38a5b7;_0x11e66c['model']=_[_0x3c15('0x3c')](db[_0x3c15('0x56')][_0x3c15('0x36')]);_0x11e66c[_0x3c15('0x3d')]=_[_0x3c15('0x3c')](_0xa5d223[_0x3c15('0x3d')]);_0x11e66c[_0x3c15('0x3e')]=_[_0x3c15('0x3f')](_0x11e66c[_0x3c15('0x3a')],_0x11e66c[_0x3c15('0x3d')]);_0x3f2f1d[_0x3c15('0x41')]=_[_0x3c15('0x3f')](_0x11e66c[_0x3c15('0x3a')],qs[_0x3c15('0x40')](_0xa5d223[_0x3c15('0x3d')][_0x3c15('0x40')]));_0x3f2f1d['attributes']=_0x3f2f1d['attributes']['length']?_0x3f2f1d['attributes']:_0x11e66c[_0x3c15('0x3a')];_0x3f2f1d[_0x3c15('0x45')]=qs[_0x3c15('0x46')](_0xa5d223['query'][_0x3c15('0x46')]);_0x3f2f1d[_0x3c15('0x47')]=qs[_0x3c15('0x3e')](_['pick'](_0xa5d223['query'],_0x11e66c[_0x3c15('0x3e')]));if(_0xa5d223[_0x3c15('0x3d')]['filter']){_0x3f2f1d[_0x3c15('0x47')]=_[_0x3c15('0x48')](_0x3f2f1d[_0x3c15('0x47')],{'$or':_['map'](_0x3f2f1d[_0x3c15('0x41')],function(_0x12e993){var _0x26d558={};_0x26d558[_0x12e993]={'$like':'%'+_0xa5d223[_0x3c15('0x3d')][_0x3c15('0x4a')]+'%'};return _0x26d558;})});}_0x3f2f1d=_[_0x3c15('0x48')]({},_0x3f2f1d,_0xa5d223[_0x3c15('0x4b')]);return _0xedf839[_0x3c15('0x55')](_0x3f2f1d);}})['then'](function(_0x423a51){if(_0x423a51){_0x980ab=_0x423a51[_0x3c15('0x42')];if(!_0xa5d223[_0x3c15('0x3d')]['hasOwnProperty'](_0x3c15('0x44'))){_0x3f2f1d['limit']=qs['limit'](_0xa5d223[_0x3c15('0x3d')][_0x3c15('0x28')]);_0x3f2f1d[_0x3c15('0x27')]=qs[_0x3c15('0x27')](_0xa5d223[_0x3c15('0x3d')][_0x3c15('0x27')]);}return _0xedf839[_0x3c15('0x55')](_0x3f2f1d);}})['then'](function(_0x408da9){if(_0x408da9){return _0x408da9?{'count':_0x980ab,'rows':_0x408da9}:null;}})[_0x3c15('0x2f')](respondWithResult(_0x2f200a,null))[_0x3c15('0x4f')](handleError(_0x2f200a,null));};exports['getSubjects']=function(_0x4797ac,_0x3c39f6,_0x25b3ec){var _0x3f5ecf={};var _0x39e6dc={};var _0x196f4a;var _0x2cff60;return db['DeskConfiguration'][_0x3c15('0x57')]({'where':{'id':_0x4797ac[_0x3c15('0x51')]['id']}})[_0x3c15('0x2f')](handleEntityNotFound(_0x3c39f6,null))['then'](function(_0x134dc6){if(_0x134dc6){_0x196f4a=_0x134dc6;_0x39e6dc[_0x3c15('0x3a')]=_['keys'](db[_0x3c15('0x56')][_0x3c15('0x36')]);_0x39e6dc[_0x3c15('0x3d')]=_['keys'](_0x4797ac[_0x3c15('0x3d')]);_0x39e6dc['filters']=_[_0x3c15('0x3f')](_0x39e6dc[_0x3c15('0x3a')],_0x39e6dc[_0x3c15('0x3d')]);_0x3f5ecf[_0x3c15('0x41')]=_[_0x3c15('0x3f')](_0x39e6dc[_0x3c15('0x3a')],qs[_0x3c15('0x40')](_0x4797ac['query']['fields']));_0x3f5ecf[_0x3c15('0x41')]=_0x3f5ecf[_0x3c15('0x41')]['length']?_0x3f5ecf['attributes']:_0x39e6dc[_0x3c15('0x3a')];_0x3f5ecf[_0x3c15('0x45')]=qs[_0x3c15('0x46')](_0x4797ac['query'][_0x3c15('0x46')]);_0x3f5ecf[_0x3c15('0x47')]=qs[_0x3c15('0x3e')](_[_0x3c15('0x58')](_0x4797ac[_0x3c15('0x3d')],_0x39e6dc[_0x3c15('0x3e')]));if(_0x4797ac[_0x3c15('0x3d')][_0x3c15('0x4a')]){_0x3f5ecf[_0x3c15('0x47')]=_['merge'](_0x3f5ecf['where'],{'$or':_[_0x3c15('0x3b')](_0x3f5ecf[_0x3c15('0x41')],function(_0x1150fc){var _0x352147={};_0x352147[_0x1150fc]={'$like':'%'+_0x4797ac[_0x3c15('0x3d')][_0x3c15('0x4a')]+'%'};return _0x352147;})});}_0x3f5ecf=_['merge']({},_0x3f5ecf,_0x4797ac[_0x3c15('0x4b')]);return _0x196f4a['getSubjects'](_0x3f5ecf);}})[_0x3c15('0x2f')](function(_0x366df0){if(_0x366df0){_0x2cff60=_0x366df0[_0x3c15('0x42')];if(!_0x4797ac[_0x3c15('0x3d')][_0x3c15('0x43')](_0x3c15('0x44'))){_0x3f5ecf['limit']=qs['limit'](_0x4797ac[_0x3c15('0x3d')][_0x3c15('0x28')]);_0x3f5ecf[_0x3c15('0x27')]=qs[_0x3c15('0x27')](_0x4797ac['query'][_0x3c15('0x27')]);}return _0x196f4a[_0x3c15('0x59')](_0x3f5ecf);}})[_0x3c15('0x2f')](function(_0x402a9d){if(_0x402a9d){return _0x402a9d?{'count':_0x2cff60,'rows':_0x402a9d}:null;}})[_0x3c15('0x2f')](respondWithResult(_0x3c39f6,null))['catch'](handleError(_0x3c39f6,null));};exports[_0x3c15('0x5a')]=function(_0x5c4b08,_0x5399d6,_0x20a3b0){var _0x144e41={};var _0x4fc9d7={};var _0x1c0f6f;var _0x3a1e35;return db[_0x3c15('0x35')][_0x3c15('0x57')]({'where':{'id':_0x5c4b08['params']['id']}})[_0x3c15('0x2f')](handleEntityNotFound(_0x5399d6,null))[_0x3c15('0x2f')](function(_0x205b2c){if(_0x205b2c){_0x1c0f6f=_0x205b2c;_0x4fc9d7[_0x3c15('0x3a')]=_[_0x3c15('0x3c')](db[_0x3c15('0x56')]['rawAttributes']);_0x4fc9d7['query']=_[_0x3c15('0x3c')](_0x5c4b08[_0x3c15('0x3d')]);_0x4fc9d7[_0x3c15('0x3e')]=_[_0x3c15('0x3f')](_0x4fc9d7[_0x3c15('0x3a')],_0x4fc9d7[_0x3c15('0x3d')]);_0x144e41['attributes']=_[_0x3c15('0x3f')](_0x4fc9d7[_0x3c15('0x3a')],qs[_0x3c15('0x40')](_0x5c4b08[_0x3c15('0x3d')]['fields']));_0x144e41[_0x3c15('0x41')]=_0x144e41[_0x3c15('0x41')][_0x3c15('0x42')]?_0x144e41[_0x3c15('0x41')]:_0x4fc9d7[_0x3c15('0x3a')];_0x144e41['order']=qs[_0x3c15('0x46')](_0x5c4b08['query']['sort']);_0x144e41['where']=qs[_0x3c15('0x3e')](_[_0x3c15('0x58')](_0x5c4b08[_0x3c15('0x3d')],_0x4fc9d7[_0x3c15('0x3e')]));if(_0x5c4b08[_0x3c15('0x3d')][_0x3c15('0x4a')]){_0x144e41['where']=_[_0x3c15('0x48')](_0x144e41[_0x3c15('0x47')],{'$or':_['map'](_0x144e41[_0x3c15('0x41')],function(_0x4b56a6){var _0x559b21={};_0x559b21[_0x4b56a6]={'$like':'%'+_0x5c4b08[_0x3c15('0x3d')]['filter']+'%'};return _0x559b21;})});}_0x144e41=_[_0x3c15('0x48')]({},_0x144e41,_0x5c4b08[_0x3c15('0x4b')]);return _0x1c0f6f['getDescriptions'](_0x144e41);}})[_0x3c15('0x2f')](function(_0x59c187){if(_0x59c187){_0x3a1e35=_0x59c187['length'];if(!_0x5c4b08[_0x3c15('0x3d')][_0x3c15('0x43')](_0x3c15('0x44'))){_0x144e41[_0x3c15('0x28')]=qs[_0x3c15('0x28')](_0x5c4b08[_0x3c15('0x3d')][_0x3c15('0x28')]);_0x144e41[_0x3c15('0x27')]=qs[_0x3c15('0x27')](_0x5c4b08[_0x3c15('0x3d')][_0x3c15('0x27')]);}return _0x1c0f6f['getDescriptions'](_0x144e41);}})[_0x3c15('0x2f')](function(_0x23f6c6){if(_0x23f6c6){return _0x23f6c6?{'count':_0x3a1e35,'rows':_0x23f6c6}:null;}})[_0x3c15('0x2f')](respondWithResult(_0x5399d6,null))[_0x3c15('0x4f')](handleError(_0x5399d6,null));};exports['getTags']=function(_0x150022,_0x425b93,_0x2b1063){var _0x5dfb44={};var _0x415fd5={};var _0x4d44b0;var _0x383073;return db[_0x3c15('0x35')][_0x3c15('0x57')]({'where':{'id':_0x150022[_0x3c15('0x51')]['id']}})[_0x3c15('0x2f')](handleEntityNotFound(_0x425b93,null))[_0x3c15('0x2f')](function(_0x2a2882){if(_0x2a2882){_0x4d44b0=_0x2a2882;_0x415fd5[_0x3c15('0x3a')]=_['keys'](db[_0x3c15('0x5b')]['rawAttributes']);_0x415fd5[_0x3c15('0x3d')]=_[_0x3c15('0x3c')](_0x150022[_0x3c15('0x3d')]);_0x415fd5['filters']=_[_0x3c15('0x3f')](_0x415fd5[_0x3c15('0x3a')],_0x415fd5[_0x3c15('0x3d')]);_0x5dfb44[_0x3c15('0x41')]=_[_0x3c15('0x3f')](_0x415fd5[_0x3c15('0x3a')],qs[_0x3c15('0x40')](_0x150022[_0x3c15('0x3d')][_0x3c15('0x40')]));_0x5dfb44[_0x3c15('0x41')]=_0x5dfb44[_0x3c15('0x41')][_0x3c15('0x42')]?_0x5dfb44[_0x3c15('0x41')]:_0x415fd5[_0x3c15('0x3a')];_0x5dfb44[_0x3c15('0x45')]=qs[_0x3c15('0x46')](_0x150022['query'][_0x3c15('0x46')]);_0x5dfb44['where']=qs['filters'](_[_0x3c15('0x58')](_0x150022['query'],_0x415fd5[_0x3c15('0x3e')]));if(_0x150022[_0x3c15('0x3d')][_0x3c15('0x4a')]){_0x5dfb44[_0x3c15('0x47')]=_[_0x3c15('0x48')](_0x5dfb44[_0x3c15('0x47')],{'$or':_[_0x3c15('0x3b')](_0x5dfb44[_0x3c15('0x41')],function(_0x2eb8d4){var _0x3d92de={};_0x3d92de[_0x2eb8d4]={'$like':'%'+_0x150022[_0x3c15('0x3d')][_0x3c15('0x4a')]+'%'};return _0x3d92de;})});}_0x5dfb44=_[_0x3c15('0x48')]({},_0x5dfb44,_0x150022[_0x3c15('0x4b')]);return _0x4d44b0['getTags'](_0x5dfb44);}})[_0x3c15('0x2f')](function(_0x35ac42){if(_0x35ac42){_0x383073=_0x35ac42[_0x3c15('0x42')];if(!_0x150022['query'][_0x3c15('0x43')]('nolimit')){_0x5dfb44['limit']=qs[_0x3c15('0x28')](_0x150022[_0x3c15('0x3d')][_0x3c15('0x28')]);_0x5dfb44['offset']=qs['offset'](_0x150022[_0x3c15('0x3d')]['offset']);}return _0x4d44b0['getTags'](_0x5dfb44);}})[_0x3c15('0x2f')](function(_0x1ad8df){if(_0x1ad8df){return _0x1ad8df?{'count':_0x383073,'rows':_0x1ad8df}:null;}})[_0x3c15('0x2f')](respondWithResult(_0x425b93,null))[_0x3c15('0x4f')](handleError(_0x425b93,null));};exports['setTags']=function(_0x4a1263,_0x501a85,_0x57a248){if(_0x4a1263[_0x3c15('0x54')]['id']){delete _0x4a1263[_0x3c15('0x54')]['id'];}return db['DeskConfiguration'][_0x3c15('0x57')]({'where':{'id':_0x4a1263[_0x3c15('0x51')]['id']}})[_0x3c15('0x2f')](handleEntityNotFound(_0x501a85,null))[_0x3c15('0x2f')](function(_0x4f3158){if(_0x4f3158){return _0x4f3158[_0x3c15('0x5c')](_0x4a1263[_0x3c15('0x54')]['ids']||[]);}return null;})[_0x3c15('0x2f')](respondWithResult(_0x501a85,null))['catch'](handleError(_0x501a85,null));}; \ No newline at end of file +var _0x2795=['stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','send','DeskConfiguration','type','key','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','fields','include','find','create','body','findOne','DeskField','order','pick','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x229f8d,_0x48402c){var _0x3e193c=function(_0x58009d){while(--_0x58009d){_0x229f8d['push'](_0x229f8d['shift']());}};_0x3e193c(++_0x48402c);}(_0x2795,0x9e));var _0x5279=function(_0x1ade95,_0x544ab7){_0x1ade95=_0x1ade95-0x0;var _0x11beb1=_0x2795[_0x1ade95];return _0x11beb1;};'use strict';var pdf=require(_0x5279('0x0'));var emlformat=require(_0x5279('0x1'));var rimraf=require(_0x5279('0x2'));var zipdir=require(_0x5279('0x3'));var jsonpatch=require(_0x5279('0x4'));var rp=require(_0x5279('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5279('0x6'));var util=require('util');var path=require(_0x5279('0x7'));var sox=require(_0x5279('0x8'));var csv=require(_0x5279('0x9'));var ejs=require(_0x5279('0xa'));var fs=require('fs');var _=require(_0x5279('0xb'));var squel=require('squel');var crypto=require(_0x5279('0xc'));var jsforce=require(_0x5279('0xd'));var deskjs=require(_0x5279('0xe'));var toCsv=require(_0x5279('0x9'));var querystring=require('querystring');var Papa=require(_0x5279('0xf'));var Redis=require(_0x5279('0x10'));var authService=require(_0x5279('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5279('0x12'));var hardwareService=require(_0x5279('0x13'));var logger=require(_0x5279('0x14'))(_0x5279('0x15'));var utils=require('../../config/utils');var config=require(_0x5279('0x16'));var licenseUtil=require(_0x5279('0x17'));var db=require(_0x5279('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7feb3b,_0x3eb9b5,_0x1d09d5,_0x4431c5){return new BPromise(function(_0x1a7d63,_0x522651){var _0x4ab9fd=_0x4431c5||client;return _0x4ab9fd[_0x5279('0x19')](_0x7feb3b,_0x1d09d5)['then'](function(_0x1a45b5){logger[_0x5279('0x1a')](_0x5279('0x1b'),_0x3eb9b5,_0x5279('0x1c'));logger[_0x5279('0x1d')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3eb9b5,'request\x20sent',JSON[_0x5279('0x1e')](_0x1a45b5));if(_0x1a45b5[_0x5279('0x1f')]){if(_0x1a45b5['error'][_0x5279('0x20')]===0x1f4){logger[_0x5279('0x1f')](_0x5279('0x1b'),_0x3eb9b5,_0x1a45b5[_0x5279('0x1f')][_0x5279('0x21')]);return _0x522651(_0x1a45b5['error'][_0x5279('0x21')]);}logger[_0x5279('0x1f')](_0x5279('0x1b'),_0x3eb9b5,_0x1a45b5[_0x5279('0x1f')][_0x5279('0x21')]);return _0x1a7d63(_0x1a45b5[_0x5279('0x1f')][_0x5279('0x21')]);}else{logger[_0x5279('0x1a')](_0x5279('0x1b'),_0x3eb9b5,_0x5279('0x1c'));_0x1a7d63(_0x1a45b5[_0x5279('0x22')][_0x5279('0x21')]);}})[_0x5279('0x23')](function(_0x3f60a5){logger[_0x5279('0x1f')](_0x5279('0x1b'),_0x3eb9b5,_0x3f60a5);_0x522651(_0x3f60a5);});});}function respondWithStatusCode(_0x11cdc4,_0x21708c){_0x21708c=_0x21708c||0xcc;return function(_0x368b4c){if(_0x368b4c){return _0x11cdc4[_0x5279('0x24')](_0x21708c);}return _0x11cdc4[_0x5279('0x25')](_0x21708c)[_0x5279('0x26')]();};}function respondWithResult(_0x41f732,_0x4b2f15){_0x4b2f15=_0x4b2f15||0xc8;return function(_0x3e775c){if(_0x3e775c){return _0x41f732[_0x5279('0x25')](_0x4b2f15)[_0x5279('0x27')](_0x3e775c);}};}function respondWithFilteredResult(_0x5e346b,_0x1944d8){return function(_0x3954b1){if(_0x3954b1){var _0xb8f929=_0x3954b1['count'],_0x4e677a=_0x1944d8[_0x5279('0x28')],_0x4bf6d2=_0x1944d8[_0x5279('0x28')]+_0x1944d8[_0x5279('0x29')],_0x451ef6;if(_0x4bf6d2>=_0xb8f929){_0x4bf6d2=_0xb8f929;_0x451ef6=0xc8;}else{_0x451ef6=0xce;}_0x5e346b[_0x5279('0x25')](_0x451ef6);return _0x5e346b[_0x5279('0x2a')](_0x5279('0x2b'),_0x4e677a+'-'+_0x4bf6d2+'/'+_0xb8f929)['json'](_0x3954b1);}return null;};}function patchUpdates(_0x5476a9){return function(_0x5585cb){try{jsonpatch['apply'](_0x5585cb,_0x5476a9,!![]);}catch(_0x3815c2){return BPromise[_0x5279('0x2c')](_0x3815c2);}return _0x5585cb[_0x5279('0x2d')]();};}function saveUpdates(_0x2a69ac,_0x4ec76b){return function(_0x1d78f1){if(_0x1d78f1){return _0x1d78f1[_0x5279('0x2e')](_0x2a69ac)['then'](function(_0x5ce97a){return _0x5ce97a;});}return null;};}function removeEntity(_0x5be7e6,_0x251147){return function(_0xd4c570){if(_0xd4c570){return _0xd4c570[_0x5279('0x2f')]()[_0x5279('0x30')](function(){_0x5be7e6[_0x5279('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3175a8,_0x5c659a){return function(_0x1b94fa){if(!_0x1b94fa){_0x3175a8[_0x5279('0x24')](0x194);}return _0x1b94fa;};}function handleError(_0x17ef4b,_0x221f2c){_0x221f2c=_0x221f2c||0x1f4;return function(_0x1b57bd){logger[_0x5279('0x1f')](_0x1b57bd[_0x5279('0x31')]);if(_0x1b57bd[_0x5279('0x32')]){delete _0x1b57bd[_0x5279('0x32')];}_0x17ef4b['status'](_0x221f2c)[_0x5279('0x33')](_0x1b57bd);};}exports['index']=function(_0x24d515,_0x31ad0a){var _0x1b0c36={},_0x4a1042={},_0x1905ab={'count':0x0,'rows':[]};var _0x1f68c3=_['map'](db[_0x5279('0x34')]['rawAttributes'],function(_0x58d977){return{'name':_0x58d977['fieldName'],'type':_0x58d977[_0x5279('0x35')][_0x5279('0x36')]};});_0x4a1042['model']=_[_0x5279('0x37')](_0x1f68c3,_0x5279('0x32'));_0x4a1042[_0x5279('0x38')]=_[_0x5279('0x39')](_0x24d515['query']);_0x4a1042[_0x5279('0x3a')]=_['intersection'](_0x4a1042[_0x5279('0x3b')],_0x4a1042[_0x5279('0x38')]);_0x1b0c36[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0x4a1042['model'],qs['fields'](_0x24d515[_0x5279('0x38')]['fields']));_0x1b0c36[_0x5279('0x3c')]=_0x1b0c36[_0x5279('0x3c')][_0x5279('0x3e')]?_0x1b0c36['attributes']:_0x4a1042[_0x5279('0x3b')];if(!_0x24d515[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x1b0c36[_0x5279('0x29')]=qs[_0x5279('0x29')](_0x24d515[_0x5279('0x38')][_0x5279('0x29')]);_0x1b0c36[_0x5279('0x28')]=qs[_0x5279('0x28')](_0x24d515[_0x5279('0x38')]['offset']);}_0x1b0c36['order']=qs[_0x5279('0x41')](_0x24d515[_0x5279('0x38')][_0x5279('0x41')]);_0x1b0c36['where']=qs[_0x5279('0x3a')](_['pick'](_0x24d515[_0x5279('0x38')],_0x4a1042[_0x5279('0x3a')]),_0x1f68c3);if(_0x24d515[_0x5279('0x38')][_0x5279('0x42')]){_0x1b0c36[_0x5279('0x43')]=_[_0x5279('0x44')](_0x1b0c36[_0x5279('0x43')],{'$or':_[_0x5279('0x37')](_0x1f68c3,function(_0x3ccd72){if(_0x3ccd72[_0x5279('0x35')]!==_0x5279('0x45')){var _0x26c983={};_0x26c983[_0x3ccd72['name']]={'$like':'%'+_0x24d515[_0x5279('0x38')][_0x5279('0x42')]+'%'};return _0x26c983;}})});}_0x1b0c36=_[_0x5279('0x44')]({},_0x1b0c36,_0x24d515[_0x5279('0x46')]);var _0xa2273={'where':_0x1b0c36[_0x5279('0x43')]};return db[_0x5279('0x34')][_0x5279('0x47')](_0xa2273)['then'](function(_0x2cfccc){_0x1905ab[_0x5279('0x47')]=_0x2cfccc;if(_0x24d515[_0x5279('0x38')][_0x5279('0x48')]){_0x1b0c36['include']=[{'all':!![]}];}return db[_0x5279('0x34')][_0x5279('0x49')](_0x1b0c36);})[_0x5279('0x30')](function(_0x46d492){_0x1905ab[_0x5279('0x4a')]=_0x46d492;return _0x1905ab;})['then'](respondWithFilteredResult(_0x31ad0a,_0x1b0c36))['catch'](handleError(_0x31ad0a,null));};exports[_0x5279('0x4b')]=function(_0x4a3ab7,_0x47c320){var _0x48b935={'raw':![],'where':{'id':_0x4a3ab7[_0x5279('0x4c')]['id']}},_0x8ba31c={};_0x8ba31c[_0x5279('0x3b')]=_[_0x5279('0x39')](db[_0x5279('0x34')][_0x5279('0x4d')]);_0x8ba31c[_0x5279('0x38')]=_['keys'](_0x4a3ab7[_0x5279('0x38')]);_0x8ba31c[_0x5279('0x3a')]=_['intersection'](_0x8ba31c[_0x5279('0x3b')],_0x8ba31c[_0x5279('0x38')]);_0x48b935[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0x8ba31c[_0x5279('0x3b')],qs['fields'](_0x4a3ab7['query'][_0x5279('0x4e')]));_0x48b935[_0x5279('0x3c')]=_0x48b935[_0x5279('0x3c')]['length']?_0x48b935[_0x5279('0x3c')]:_0x8ba31c[_0x5279('0x3b')];if(_0x4a3ab7[_0x5279('0x38')]['includeAll']){_0x48b935[_0x5279('0x4f')]=[{'all':!![]}];}_0x48b935=_[_0x5279('0x44')]({},_0x48b935,_0x4a3ab7['options']);return db['DeskConfiguration'][_0x5279('0x50')](_0x48b935)[_0x5279('0x30')](handleEntityNotFound(_0x47c320,null))[_0x5279('0x30')](respondWithResult(_0x47c320,null))['catch'](handleError(_0x47c320,null));};exports[_0x5279('0x51')]=function(_0x58f988,_0xe53bcb){return db[_0x5279('0x34')]['create'](_0x58f988[_0x5279('0x52')],{})[_0x5279('0x30')](respondWithResult(_0xe53bcb,0xc9))['catch'](handleError(_0xe53bcb,null));};exports['update']=function(_0x38c2c4,_0x548983){if(_0x38c2c4[_0x5279('0x52')]['id']){delete _0x38c2c4['body']['id'];}return db[_0x5279('0x34')][_0x5279('0x50')]({'where':{'id':_0x38c2c4[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x548983,null))[_0x5279('0x30')](saveUpdates(_0x38c2c4['body'],null))[_0x5279('0x30')](respondWithResult(_0x548983,null))[_0x5279('0x23')](handleError(_0x548983,null));};exports[_0x5279('0x2f')]=function(_0x285bfa,_0x1056e){return db[_0x5279('0x34')]['find']({'where':{'id':_0x285bfa[_0x5279('0x4c')]['id']}})[_0x5279('0x30')](handleEntityNotFound(_0x1056e,null))[_0x5279('0x30')](removeEntity(_0x1056e,null))[_0x5279('0x23')](handleError(_0x1056e,null));};exports['getFields']=function(_0x533fa6,_0x59c1b7,_0x5db099){var _0x14fcb7={};var _0x38c5d1={};var _0x9cf5a;var _0x299ab0;return db['DeskConfiguration'][_0x5279('0x53')]({'where':{'id':_0x533fa6[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x59c1b7,null))[_0x5279('0x30')](function(_0xf26e73){if(_0xf26e73){_0x9cf5a=_0xf26e73;_0x38c5d1[_0x5279('0x3b')]=_[_0x5279('0x39')](db[_0x5279('0x54')][_0x5279('0x4d')]);_0x38c5d1[_0x5279('0x38')]=_[_0x5279('0x39')](_0x533fa6[_0x5279('0x38')]);_0x38c5d1[_0x5279('0x3a')]=_['intersection'](_0x38c5d1['model'],_0x38c5d1[_0x5279('0x38')]);_0x14fcb7[_0x5279('0x3c')]=_['intersection'](_0x38c5d1[_0x5279('0x3b')],qs['fields'](_0x533fa6[_0x5279('0x38')]['fields']));_0x14fcb7[_0x5279('0x3c')]=_0x14fcb7[_0x5279('0x3c')]['length']?_0x14fcb7[_0x5279('0x3c')]:_0x38c5d1[_0x5279('0x3b')];_0x14fcb7[_0x5279('0x55')]=qs['sort'](_0x533fa6[_0x5279('0x38')][_0x5279('0x41')]);_0x14fcb7[_0x5279('0x43')]=qs['filters'](_[_0x5279('0x56')](_0x533fa6[_0x5279('0x38')],_0x38c5d1[_0x5279('0x3a')]));if(_0x533fa6['query'][_0x5279('0x42')]){_0x14fcb7[_0x5279('0x43')]=_['merge'](_0x14fcb7[_0x5279('0x43')],{'$or':_['map'](_0x14fcb7[_0x5279('0x3c')],function(_0xffa628){var _0x3955b8={};_0x3955b8[_0xffa628]={'$like':'%'+_0x533fa6[_0x5279('0x38')][_0x5279('0x42')]+'%'};return _0x3955b8;})});}_0x14fcb7=_[_0x5279('0x44')]({},_0x14fcb7,_0x533fa6['options']);return _0x9cf5a['getFields'](_0x14fcb7);}})['then'](function(_0x13af9f){if(_0x13af9f){_0x299ab0=_0x13af9f[_0x5279('0x3e')];if(!_0x533fa6[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x14fcb7[_0x5279('0x29')]=qs['limit'](_0x533fa6['query'][_0x5279('0x29')]);_0x14fcb7['offset']=qs[_0x5279('0x28')](_0x533fa6[_0x5279('0x38')]['offset']);}return _0x9cf5a[_0x5279('0x57')](_0x14fcb7);}})[_0x5279('0x30')](function(_0x1fb0b3){if(_0x1fb0b3){return _0x1fb0b3?{'count':_0x299ab0,'rows':_0x1fb0b3}:null;}})[_0x5279('0x30')](respondWithResult(_0x59c1b7,null))['catch'](handleError(_0x59c1b7,null));};exports['getSubjects']=function(_0x38a917,_0x12d5bd,_0x3f379b){var _0x523648={};var _0xb586d0={};var _0x40c35f;var _0x1bfe03;return db['DeskConfiguration'][_0x5279('0x53')]({'where':{'id':_0x38a917[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12d5bd,null))[_0x5279('0x30')](function(_0x3e40e7){if(_0x3e40e7){_0x40c35f=_0x3e40e7;_0xb586d0['model']=_[_0x5279('0x39')](db[_0x5279('0x54')][_0x5279('0x4d')]);_0xb586d0['query']=_[_0x5279('0x39')](_0x38a917[_0x5279('0x38')]);_0xb586d0[_0x5279('0x3a')]=_['intersection'](_0xb586d0[_0x5279('0x3b')],_0xb586d0['query']);_0x523648[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0xb586d0['model'],qs[_0x5279('0x4e')](_0x38a917[_0x5279('0x38')][_0x5279('0x4e')]));_0x523648[_0x5279('0x3c')]=_0x523648[_0x5279('0x3c')][_0x5279('0x3e')]?_0x523648['attributes']:_0xb586d0[_0x5279('0x3b')];_0x523648[_0x5279('0x55')]=qs[_0x5279('0x41')](_0x38a917[_0x5279('0x38')][_0x5279('0x41')]);_0x523648[_0x5279('0x43')]=qs[_0x5279('0x3a')](_[_0x5279('0x56')](_0x38a917['query'],_0xb586d0[_0x5279('0x3a')]));if(_0x38a917['query'][_0x5279('0x42')]){_0x523648['where']=_[_0x5279('0x44')](_0x523648[_0x5279('0x43')],{'$or':_[_0x5279('0x37')](_0x523648[_0x5279('0x3c')],function(_0x1d7f95){var _0x3af716={};_0x3af716[_0x1d7f95]={'$like':'%'+_0x38a917[_0x5279('0x38')][_0x5279('0x42')]+'%'};return _0x3af716;})});}_0x523648=_[_0x5279('0x44')]({},_0x523648,_0x38a917[_0x5279('0x46')]);return _0x40c35f[_0x5279('0x58')](_0x523648);}})[_0x5279('0x30')](function(_0x146dae){if(_0x146dae){_0x1bfe03=_0x146dae['length'];if(!_0x38a917[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x523648[_0x5279('0x29')]=qs['limit'](_0x38a917[_0x5279('0x38')][_0x5279('0x29')]);_0x523648[_0x5279('0x28')]=qs[_0x5279('0x28')](_0x38a917[_0x5279('0x38')]['offset']);}return _0x40c35f[_0x5279('0x58')](_0x523648);}})[_0x5279('0x30')](function(_0x3d7621){if(_0x3d7621){return _0x3d7621?{'count':_0x1bfe03,'rows':_0x3d7621}:null;}})['then'](respondWithResult(_0x12d5bd,null))[_0x5279('0x23')](handleError(_0x12d5bd,null));};exports[_0x5279('0x59')]=function(_0x10310c,_0x54e286,_0x2a81b9){var _0x438790={};var _0x496dd9={};var _0x134e2d;var _0x5a5025;return db[_0x5279('0x34')][_0x5279('0x53')]({'where':{'id':_0x10310c[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x54e286,null))[_0x5279('0x30')](function(_0x2c7e9e){if(_0x2c7e9e){_0x134e2d=_0x2c7e9e;_0x496dd9[_0x5279('0x3b')]=_[_0x5279('0x39')](db[_0x5279('0x54')][_0x5279('0x4d')]);_0x496dd9[_0x5279('0x38')]=_[_0x5279('0x39')](_0x10310c[_0x5279('0x38')]);_0x496dd9[_0x5279('0x3a')]=_['intersection'](_0x496dd9['model'],_0x496dd9[_0x5279('0x38')]);_0x438790[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0x496dd9[_0x5279('0x3b')],qs[_0x5279('0x4e')](_0x10310c[_0x5279('0x38')][_0x5279('0x4e')]));_0x438790['attributes']=_0x438790[_0x5279('0x3c')][_0x5279('0x3e')]?_0x438790[_0x5279('0x3c')]:_0x496dd9[_0x5279('0x3b')];_0x438790['order']=qs[_0x5279('0x41')](_0x10310c[_0x5279('0x38')][_0x5279('0x41')]);_0x438790[_0x5279('0x43')]=qs[_0x5279('0x3a')](_[_0x5279('0x56')](_0x10310c['query'],_0x496dd9[_0x5279('0x3a')]));if(_0x10310c[_0x5279('0x38')][_0x5279('0x42')]){_0x438790[_0x5279('0x43')]=_['merge'](_0x438790[_0x5279('0x43')],{'$or':_[_0x5279('0x37')](_0x438790[_0x5279('0x3c')],function(_0x3b3df4){var _0x5eb23a={};_0x5eb23a[_0x3b3df4]={'$like':'%'+_0x10310c['query'][_0x5279('0x42')]+'%'};return _0x5eb23a;})});}_0x438790=_[_0x5279('0x44')]({},_0x438790,_0x10310c[_0x5279('0x46')]);return _0x134e2d[_0x5279('0x59')](_0x438790);}})[_0x5279('0x30')](function(_0x3f059b){if(_0x3f059b){_0x5a5025=_0x3f059b['length'];if(!_0x10310c[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x438790['limit']=qs[_0x5279('0x29')](_0x10310c[_0x5279('0x38')][_0x5279('0x29')]);_0x438790['offset']=qs[_0x5279('0x28')](_0x10310c['query'][_0x5279('0x28')]);}return _0x134e2d['getDescriptions'](_0x438790);}})[_0x5279('0x30')](function(_0x1ba197){if(_0x1ba197){return _0x1ba197?{'count':_0x5a5025,'rows':_0x1ba197}:null;}})[_0x5279('0x30')](respondWithResult(_0x54e286,null))[_0x5279('0x23')](handleError(_0x54e286,null));};exports[_0x5279('0x5a')]=function(_0x5d2738,_0x287afd,_0x4f50b2){var _0x413c3d={};var _0xf16bbc={};var _0x26ac27;var _0x1868b3;return db[_0x5279('0x34')][_0x5279('0x53')]({'where':{'id':_0x5d2738['params']['id']}})['then'](handleEntityNotFound(_0x287afd,null))[_0x5279('0x30')](function(_0x3147ee){if(_0x3147ee){_0x26ac27=_0x3147ee;_0xf16bbc[_0x5279('0x3b')]=_['keys'](db[_0x5279('0x5b')][_0x5279('0x4d')]);_0xf16bbc[_0x5279('0x38')]=_[_0x5279('0x39')](_0x5d2738[_0x5279('0x38')]);_0xf16bbc[_0x5279('0x3a')]=_[_0x5279('0x3d')](_0xf16bbc['model'],_0xf16bbc[_0x5279('0x38')]);_0x413c3d[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0xf16bbc[_0x5279('0x3b')],qs[_0x5279('0x4e')](_0x5d2738['query'][_0x5279('0x4e')]));_0x413c3d[_0x5279('0x3c')]=_0x413c3d[_0x5279('0x3c')]['length']?_0x413c3d[_0x5279('0x3c')]:_0xf16bbc[_0x5279('0x3b')];_0x413c3d[_0x5279('0x55')]=qs['sort'](_0x5d2738[_0x5279('0x38')][_0x5279('0x41')]);_0x413c3d[_0x5279('0x43')]=qs[_0x5279('0x3a')](_[_0x5279('0x56')](_0x5d2738[_0x5279('0x38')],_0xf16bbc[_0x5279('0x3a')]));if(_0x5d2738[_0x5279('0x38')][_0x5279('0x42')]){_0x413c3d['where']=_['merge'](_0x413c3d[_0x5279('0x43')],{'$or':_[_0x5279('0x37')](_0x413c3d[_0x5279('0x3c')],function(_0x195f5a){var _0x501c1e={};_0x501c1e[_0x195f5a]={'$like':'%'+_0x5d2738[_0x5279('0x38')][_0x5279('0x42')]+'%'};return _0x501c1e;})});}_0x413c3d=_['merge']({},_0x413c3d,_0x5d2738[_0x5279('0x46')]);return _0x26ac27[_0x5279('0x5a')](_0x413c3d);}})[_0x5279('0x30')](function(_0x1f52b7){if(_0x1f52b7){_0x1868b3=_0x1f52b7[_0x5279('0x3e')];if(!_0x5d2738[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x413c3d[_0x5279('0x29')]=qs[_0x5279('0x29')](_0x5d2738[_0x5279('0x38')][_0x5279('0x29')]);_0x413c3d[_0x5279('0x28')]=qs[_0x5279('0x28')](_0x5d2738[_0x5279('0x38')][_0x5279('0x28')]);}return _0x26ac27['getTags'](_0x413c3d);}})[_0x5279('0x30')](function(_0x36cd03){if(_0x36cd03){return _0x36cd03?{'count':_0x1868b3,'rows':_0x36cd03}:null;}})[_0x5279('0x30')](respondWithResult(_0x287afd,null))[_0x5279('0x23')](handleError(_0x287afd,null));};exports[_0x5279('0x5c')]=function(_0x98d960,_0x4c3183,_0xa48ec9){if(_0x98d960[_0x5279('0x52')]['id']){delete _0x98d960[_0x5279('0x52')]['id'];}return db[_0x5279('0x34')][_0x5279('0x53')]({'where':{'id':_0x98d960[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c3183,null))[_0x5279('0x30')](function(_0x3f577d){if(_0x3f577d){return _0x3f577d[_0x5279('0x5c')](_0x98d960[_0x5279('0x52')][_0x5279('0x5d')]||[]);}return null;})['then'](respondWithResult(_0x4c3183,null))['catch'](handleError(_0x4c3183,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 787218a..507aefb 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.model.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cd6=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash'];(function(_0x26059c,_0x23f7d5){var _0xe0fa28=function(_0x455e47){while(--_0x455e47){_0x26059c['push'](_0x26059c['shift']());}};_0xe0fa28(++_0x23f7d5);}(_0x6cd6,0xd0));var _0x66cd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6cd6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x66cd('0x0'));var util=require('util');var logger=require(_0x66cd('0x1'))('api');var moment=require(_0x66cd('0x2'));var BPromise=require(_0x66cd('0x3'));var rp=require(_0x66cd('0x4'));var fs=require('fs');var path=require(_0x66cd('0x5'));var rimraf=require('rimraf');var config=require(_0x66cd('0x6'));var attributes=require(_0x66cd('0x7'));module[_0x66cd('0x8')]=function(_0x2e51df,_0x97a4cc){return _0x2e51df[_0x66cd('0x9')]('DeskConfiguration',attributes,{'tableName':_0x66cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb59d=['../../config/environment','./intDeskConfiguration.attributes','define','int_desk_configurations','lodash','api','bluebird','request-promise','path'];(function(_0x178f49,_0xd00f3a){var _0x5b3774=function(_0x7a08df){while(--_0x7a08df){_0x178f49['push'](_0x178f49['shift']());}};_0x5b3774(++_0xd00f3a);}(_0xb59d,0xf7));var _0xdb59=function(_0x3bf5e0,_0xaabb7e){_0x3bf5e0=_0x3bf5e0-0x0;var _0x172a49=_0xb59d[_0x3bf5e0];return _0x172a49;};'use strict';var _=require(_0xdb59('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb59('0x1'));var moment=require('moment');var BPromise=require(_0xdb59('0x2'));var rp=require(_0xdb59('0x3'));var fs=require('fs');var path=require(_0xdb59('0x4'));var rimraf=require('rimraf');var config=require(_0xdb59('0x5'));var attributes=require(_0xdb59('0x6'));module['exports']=function(_0x12ca70,_0x4692f0){return _0x12ca70[_0xdb59('0x7')]('DeskConfiguration',attributes,{'tableName':_0xdb59('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index b11078a..11eb0bc 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x720c=['request','info','request\x20sent','debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x229dfa,_0x311b70){var _0x103c0e=function(_0x5bd66a){while(--_0x5bd66a){_0x229dfa['push'](_0x229dfa['shift']());}};_0x103c0e(++_0x311b70);}(_0x720c,0x154));var _0xc720=function(_0x2eee1b,_0x1c0f50){_0x2eee1b=_0x2eee1b-0x0;var _0x3ba425=_0x720c[_0x2eee1b];return _0x3ba425;};'use strict';var _=require(_0xc720('0x0'));var util=require('util');var moment=require(_0xc720('0x1'));var BPromise=require(_0xc720('0x2'));var rs=require(_0xc720('0x3'));var fs=require('fs');var Redis=require(_0xc720('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc720('0x5'));var logger=require(_0xc720('0x6'))(_0xc720('0x7'));var config=require(_0xc720('0x8'));var jayson=require(_0xc720('0x9'));var client=jayson[_0xc720('0xa')][_0xc720('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bc8b0,_0x20d21c,_0x8a01fc){return new BPromise(function(_0x10a2c8,_0x1a2a00){return client[_0xc720('0xc')](_0x5bc8b0,_0x8a01fc)['then'](function(_0x539493){logger[_0xc720('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x20d21c,_0xc720('0xe'));logger[_0xc720('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x20d21c,_0xc720('0xe'),JSON[_0xc720('0x10')](_0x539493));if(_0x539493[_0xc720('0x11')]){if(_0x539493[_0xc720('0x11')][_0xc720('0x12')]===0x1f4){logger['error'](_0xc720('0x13'),_0x20d21c,_0x539493[_0xc720('0x11')][_0xc720('0x14')]);return _0x1a2a00(_0x539493[_0xc720('0x11')]['message']);}logger[_0xc720('0x11')](_0xc720('0x13'),_0x20d21c,_0x539493[_0xc720('0x11')]['message']);return _0x10a2c8(_0x539493[_0xc720('0x11')][_0xc720('0x14')]);}else{logger[_0xc720('0xd')](_0xc720('0x13'),_0x20d21c,_0xc720('0xe'));_0x10a2c8(_0x539493['result']['message']);}})[_0xc720('0x15')](function(_0x583e07){logger[_0xc720('0x11')](_0xc720('0x13'),_0x20d21c,_0x583e07);_0x1a2a00(_0x583e07);});});} \ No newline at end of file +var _0x23a8=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x32577b,_0x549bd7){var _0x358c74=function(_0xdb7346){while(--_0xdb7346){_0x32577b['push'](_0x32577b['shift']());}};_0x358c74(++_0x549bd7);}(_0x23a8,0x172));var _0x823a=function(_0xaeefa0,_0x4c9543){_0xaeefa0=_0xaeefa0-0x0;var _0x1f5c8f=_0x23a8[_0xaeefa0];return _0x1f5c8f;};'use strict';var _=require('lodash');var util=require(_0x823a('0x0'));var moment=require('moment');var BPromise=require(_0x823a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x823a('0x2'));var db=require(_0x823a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x823a('0x4'))('rpc');var config=require(_0x823a('0x5'));var jayson=require(_0x823a('0x6'));var client=jayson[_0x823a('0x7')][_0x823a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5dca10,_0x472eb5,_0x3f35db){return new BPromise(function(_0x59866f,_0x42c0f2){return client[_0x823a('0x9')](_0x5dca10,_0x3f35db)['then'](function(_0x43ab90){logger[_0x823a('0xa')](_0x823a('0xb'),_0x472eb5,_0x823a('0xc'));logger['debug'](_0x823a('0xd'),_0x472eb5,_0x823a('0xc'),JSON[_0x823a('0xe')](_0x43ab90));if(_0x43ab90[_0x823a('0xf')]){if(_0x43ab90[_0x823a('0xf')][_0x823a('0x10')]===0x1f4){logger[_0x823a('0xf')](_0x823a('0xb'),_0x472eb5,_0x43ab90['error'][_0x823a('0x11')]);return _0x42c0f2(_0x43ab90['error'][_0x823a('0x11')]);}logger[_0x823a('0xf')](_0x823a('0xb'),_0x472eb5,_0x43ab90['error']['message']);return _0x59866f(_0x43ab90[_0x823a('0xf')][_0x823a('0x11')]);}else{logger[_0x823a('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x472eb5,'request\x20sent');_0x59866f(_0x43ab90['result'][_0x823a('0x11')]);}})[_0x823a('0x12')](function(_0x41f41d){logger[_0x823a('0xf')](_0x823a('0xb'),_0x472eb5,_0x41f41d);_0x42c0f2(_0x41f41d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6038e97..4c010b7 100644 --- a/server/api/intDeskField/index.js +++ b/server/api/intDeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb009=['get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','./intDeskField.controller'];(function(_0x51c4e9,_0x585e89){var _0x1e5ff7=function(_0x206e99){while(--_0x206e99){_0x51c4e9['push'](_0x51c4e9['shift']());}};_0x1e5ff7(++_0x585e89);}(_0xb009,0x82));var _0x9b00=function(_0x307c57,_0x2ff9e5){_0x307c57=_0x307c57-0x0;var _0x232faa=_0xb009[_0x307c57];return _0x232faa;};'use strict';var multer=require(_0x9b00('0x0'));var util=require(_0x9b00('0x1'));var path=require(_0x9b00('0x2'));var timeout=require(_0x9b00('0x3'));var express=require('express');var router=express[_0x9b00('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9b00('0x5'));router[_0x9b00('0x6')]('/',auth[_0x9b00('0x7')](),controller[_0x9b00('0x8')]);router[_0x9b00('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x9b00('0x9')]);router[_0x9b00('0xa')]('/',auth[_0x9b00('0x7')](),controller[_0x9b00('0xb')]);router[_0x9b00('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9b00('0xd')](_0x9b00('0xe'),auth[_0x9b00('0x7')](),controller[_0x9b00('0xf')]);module[_0x9b00('0x10')]=router; \ No newline at end of file +var _0x4b31=['/:id','post','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated'];(function(_0x44511a,_0xda471b){var _0x49b274=function(_0x1e344b){while(--_0x1e344b){_0x44511a['push'](_0x44511a['shift']());}};_0x49b274(++_0xda471b);}(_0x4b31,0x1b9));var _0x14b3=function(_0x4beb42,_0x3066df){_0x4beb42=_0x4beb42-0x0;var _0x198c48=_0x4b31[_0x4beb42];return _0x198c48;};'use strict';var multer=require(_0x14b3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x14b3('0x1'));var express=require(_0x14b3('0x2'));var router=express[_0x14b3('0x3')]();var auth=require(_0x14b3('0x4'));var interaction=require(_0x14b3('0x5'));var config=require(_0x14b3('0x6'));var controller=require(_0x14b3('0x7'));router['get']('/',auth[_0x14b3('0x8')](),controller['index']);router['get'](_0x14b3('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x14b3('0xa')]('/',auth[_0x14b3('0x8')](),controller['create']);router[_0x14b3('0xb')](_0x14b3('0x9'),auth['isAuthenticated'](),controller[_0x14b3('0xc')]);router[_0x14b3('0xd')](_0x14b3('0x9'),auth['isAuthenticated'](),controller[_0x14b3('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 39cc474..0c79349 100644 --- a/server/api/intDeskField/intDeskField.attributes.js +++ b/server/api/intDeskField/intDeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f5c=['customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x3cb17b,_0x204400){var _0x32c681=function(_0x1ccb39){while(--_0x1ccb39){_0x3cb17b['push'](_0x3cb17b['shift']());}};_0x32c681(++_0x204400);}(_0x3f5c,0x174));var _0xc3f5=function(_0xd2c30f,_0x58e5d7){_0xd2c30f=_0xd2c30f-0x0;var _0x5cf708=_0x3f5c[_0xd2c30f];return _0x5cf708;};'use strict';var Sequelize=require('sequelize');module[_0xc3f5('0x0')]={'type':{'type':Sequelize[_0xc3f5('0x1')](_0xc3f5('0x2'),_0xc3f5('0x3'),_0xc3f5('0x4'),_0xc3f5('0x5')),'defaultValue':_0xc3f5('0x2')},'content':{'type':Sequelize[_0xc3f5('0x6')]},'key':{'type':Sequelize[_0xc3f5('0x6')]},'keyType':{'type':Sequelize[_0xc3f5('0x1')]('string',_0xc3f5('0x3'),_0xc3f5('0x4'))},'keyContent':{'type':Sequelize[_0xc3f5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc3f5('0x6')]},'customField':{'type':Sequelize[_0xc3f5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc3f5('0x6')]}}; \ No newline at end of file +var _0x6448=['ENUM','string','variable','customVariable','STRING','exports'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0x6448,0x113));var _0x8644=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6448[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8644('0x0')]={'type':{'type':Sequelize[_0x8644('0x1')](_0x8644('0x2'),_0x8644('0x3'),_0x8644('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8644('0x1')](_0x8644('0x2'),_0x8644('0x3'),_0x8644('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8644('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8644('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 42d888b..08e6c21 100644 --- a/server/api/intDeskField/intDeskField.controller.js +++ b/server/api/intDeskField/intDeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b5a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','save','update','then','destroy','stack','map','DeskField','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','filter','options','include','findAll','rows','catch','show','params','keys','length','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x2b5a,0x77));var _0xa2b5=function(_0x242788,_0x24969a){_0x242788=_0x242788-0x0;var _0x5b73a7=_0x2b5a[_0x242788];return _0x5b73a7;};'use strict';var pdf=require(_0xa2b5('0x0'));var emlformat=require(_0xa2b5('0x1'));var rimraf=require(_0xa2b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa2b5('0x3'));var rp=require(_0xa2b5('0x4'));var moment=require(_0xa2b5('0x5'));var BPromise=require(_0xa2b5('0x6'));var Mustache=require('mustache');var util=require(_0xa2b5('0x7'));var path=require(_0xa2b5('0x8'));var sox=require(_0xa2b5('0x9'));var csv=require(_0xa2b5('0xa'));var ejs=require(_0xa2b5('0xb'));var fs=require('fs');var _=require(_0xa2b5('0xc'));var squel=require(_0xa2b5('0xd'));var crypto=require(_0xa2b5('0xe'));var jsforce=require(_0xa2b5('0xf'));var deskjs=require(_0xa2b5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa2b5('0x11'));var Papa=require('papaparse');var Redis=require(_0xa2b5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa2b5('0x13'));var as=require(_0xa2b5('0x14'));var hardwareService=require(_0xa2b5('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa2b5('0x16'));var config=require(_0xa2b5('0x17'));var licenseUtil=require(_0xa2b5('0x18'));var db=require(_0xa2b5('0x19'))['db'];function respondWithStatusCode(_0x149e37,_0x357c0b){_0x357c0b=_0x357c0b||0xcc;return function(_0x9c0e7c){if(_0x9c0e7c){return _0x149e37[_0xa2b5('0x1a')](_0x357c0b);}return _0x149e37['status'](_0x357c0b)[_0xa2b5('0x1b')]();};}function respondWithResult(_0x3d90a7,_0x53910d){_0x53910d=_0x53910d||0xc8;return function(_0x93719c){if(_0x93719c){return _0x3d90a7['status'](_0x53910d)[_0xa2b5('0x1c')](_0x93719c);}};}function respondWithFilteredResult(_0x59b08d,_0x17509f){return function(_0x24be7e){if(_0x24be7e){var _0x536d09=_0x24be7e[_0xa2b5('0x1d')],_0x518fa2=_0x17509f[_0xa2b5('0x1e')],_0x411d24=_0x17509f[_0xa2b5('0x1e')]+_0x17509f[_0xa2b5('0x1f')],_0x559b82;if(_0x411d24>=_0x536d09){_0x411d24=_0x536d09;_0x559b82=0xc8;}else{_0x559b82=0xce;}_0x59b08d[_0xa2b5('0x20')](_0x559b82);return _0x59b08d[_0xa2b5('0x21')]('Content-Range',_0x518fa2+'-'+_0x411d24+'/'+_0x536d09)[_0xa2b5('0x1c')](_0x24be7e);}return null;};}function patchUpdates(_0x13419f){return function(_0x1dca38){try{jsonpatch[_0xa2b5('0x22')](_0x1dca38,_0x13419f,!![]);}catch(_0x167b0a){return BPromise['reject'](_0x167b0a);}return _0x1dca38[_0xa2b5('0x23')]();};}function saveUpdates(_0x179e2d,_0x138191){return function(_0x213867){if(_0x213867){return _0x213867[_0xa2b5('0x24')](_0x179e2d)[_0xa2b5('0x25')](function(_0x2bb67f){return _0x2bb67f;});}return null;};}function removeEntity(_0x279fcf,_0x4046e8){return function(_0x279522){if(_0x279522){return _0x279522[_0xa2b5('0x26')]()['then'](function(){_0x279fcf[_0xa2b5('0x20')](0xcc)[_0xa2b5('0x1b')]();});}};}function handleEntityNotFound(_0x5d855f,_0x354a0a){return function(_0x499a27){if(!_0x499a27){_0x5d855f[_0xa2b5('0x1a')](0x194);}return _0x499a27;};}function handleError(_0x2fb0cf,_0x560425){_0x560425=_0x560425||0x1f4;return function(_0x5aabba){logger['error'](_0x5aabba[_0xa2b5('0x27')]);if(_0x5aabba['name']){delete _0x5aabba['name'];}_0x2fb0cf['status'](_0x560425)['send'](_0x5aabba);};}exports['index']=function(_0x16ee27,_0x2e0a2f){var _0x37851a={},_0x313483={},_0x163a62={'count':0x0,'rows':[]};var _0x457699=_[_0xa2b5('0x28')](db[_0xa2b5('0x29')][_0xa2b5('0x2a')],function(_0x678561){return{'name':_0x678561[_0xa2b5('0x2b')],'type':_0x678561[_0xa2b5('0x2c')]['key']};});_0x313483[_0xa2b5('0x2d')]=_[_0xa2b5('0x28')](_0x457699,_0xa2b5('0x2e'));_0x313483[_0xa2b5('0x2f')]=_['keys'](_0x16ee27[_0xa2b5('0x2f')]);_0x313483[_0xa2b5('0x30')]=_[_0xa2b5('0x31')](_0x313483[_0xa2b5('0x2d')],_0x313483[_0xa2b5('0x2f')]);_0x37851a[_0xa2b5('0x32')]=_['intersection'](_0x313483['model'],qs[_0xa2b5('0x33')](_0x16ee27[_0xa2b5('0x2f')][_0xa2b5('0x33')]));_0x37851a[_0xa2b5('0x32')]=_0x37851a['attributes']['length']?_0x37851a[_0xa2b5('0x32')]:_0x313483[_0xa2b5('0x2d')];if(!_0x16ee27[_0xa2b5('0x2f')][_0xa2b5('0x34')]('nolimit')){_0x37851a[_0xa2b5('0x1f')]=qs[_0xa2b5('0x1f')](_0x16ee27[_0xa2b5('0x2f')][_0xa2b5('0x1f')]);_0x37851a[_0xa2b5('0x1e')]=qs['offset'](_0x16ee27[_0xa2b5('0x2f')][_0xa2b5('0x1e')]);}_0x37851a[_0xa2b5('0x35')]=qs[_0xa2b5('0x36')](_0x16ee27[_0xa2b5('0x2f')][_0xa2b5('0x36')]);_0x37851a['where']=qs['filters'](_[_0xa2b5('0x37')](_0x16ee27[_0xa2b5('0x2f')],_0x313483['filters']),_0x457699);if(_0x16ee27[_0xa2b5('0x2f')]['filter']){_0x37851a[_0xa2b5('0x38')]=_[_0xa2b5('0x39')](_0x37851a[_0xa2b5('0x38')],{'$or':_[_0xa2b5('0x28')](_0x457699,function(_0x5f1e0b){if(_0x5f1e0b['type']!=='VIRTUAL'){var _0x28b661={};_0x28b661[_0x5f1e0b[_0xa2b5('0x2e')]]={'$like':'%'+_0x16ee27[_0xa2b5('0x2f')][_0xa2b5('0x3a')]+'%'};return _0x28b661;}})});}_0x37851a=_[_0xa2b5('0x39')]({},_0x37851a,_0x16ee27[_0xa2b5('0x3b')]);var _0x185077={'where':_0x37851a[_0xa2b5('0x38')]};return db['DeskField'][_0xa2b5('0x1d')](_0x185077)[_0xa2b5('0x25')](function(_0x2b44fc){_0x163a62['count']=_0x2b44fc;if(_0x16ee27[_0xa2b5('0x2f')]['includeAll']){_0x37851a[_0xa2b5('0x3c')]=[{'all':!![]}];}return db[_0xa2b5('0x29')][_0xa2b5('0x3d')](_0x37851a);})[_0xa2b5('0x25')](function(_0x4acccd){_0x163a62[_0xa2b5('0x3e')]=_0x4acccd;return _0x163a62;})[_0xa2b5('0x25')](respondWithFilteredResult(_0x2e0a2f,_0x37851a))[_0xa2b5('0x3f')](handleError(_0x2e0a2f,null));};exports[_0xa2b5('0x40')]=function(_0x3a6863,_0x294433){var _0x32b7bb={'raw':!![],'where':{'id':_0x3a6863[_0xa2b5('0x41')]['id']}},_0x3d7cd9={};_0x3d7cd9[_0xa2b5('0x2d')]=_['keys'](db[_0xa2b5('0x29')][_0xa2b5('0x2a')]);_0x3d7cd9['query']=_[_0xa2b5('0x42')](_0x3a6863[_0xa2b5('0x2f')]);_0x3d7cd9['filters']=_['intersection'](_0x3d7cd9[_0xa2b5('0x2d')],_0x3d7cd9['query']);_0x32b7bb[_0xa2b5('0x32')]=_[_0xa2b5('0x31')](_0x3d7cd9['model'],qs['fields'](_0x3a6863[_0xa2b5('0x2f')][_0xa2b5('0x33')]));_0x32b7bb[_0xa2b5('0x32')]=_0x32b7bb[_0xa2b5('0x32')][_0xa2b5('0x43')]?_0x32b7bb[_0xa2b5('0x32')]:_0x3d7cd9[_0xa2b5('0x2d')];if(_0x3a6863[_0xa2b5('0x2f')]['includeAll']){_0x32b7bb[_0xa2b5('0x3c')]=[{'all':!![]}];}_0x32b7bb=_[_0xa2b5('0x39')]({},_0x32b7bb,_0x3a6863[_0xa2b5('0x3b')]);return db['DeskField'][_0xa2b5('0x44')](_0x32b7bb)[_0xa2b5('0x25')](handleEntityNotFound(_0x294433,null))[_0xa2b5('0x25')](respondWithResult(_0x294433,null))[_0xa2b5('0x3f')](handleError(_0x294433,null));};exports[_0xa2b5('0x45')]=function(_0x8ebf0c,_0x314a8d){return db[_0xa2b5('0x29')][_0xa2b5('0x45')](_0x8ebf0c[_0xa2b5('0x46')],{})[_0xa2b5('0x25')](respondWithResult(_0x314a8d,0xc9))[_0xa2b5('0x3f')](handleError(_0x314a8d,null));};exports[_0xa2b5('0x24')]=function(_0x490685,_0x37d91d){if(_0x490685[_0xa2b5('0x46')]['id']){delete _0x490685[_0xa2b5('0x46')]['id'];}return db[_0xa2b5('0x29')][_0xa2b5('0x44')]({'where':{'id':_0x490685[_0xa2b5('0x41')]['id']}})['then'](handleEntityNotFound(_0x37d91d,null))['then'](saveUpdates(_0x490685['body'],null))['then'](respondWithResult(_0x37d91d,null))[_0xa2b5('0x3f')](handleError(_0x37d91d,null));};exports[_0xa2b5('0x26')]=function(_0x5a3c0b,_0x57dfc5){return db[_0xa2b5('0x29')][_0xa2b5('0x44')]({'where':{'id':_0x5a3c0b[_0xa2b5('0x41')]['id']}})[_0xa2b5('0x25')](handleEntityNotFound(_0x57dfc5,null))[_0xa2b5('0x25')](removeEntity(_0x57dfc5,null))[_0xa2b5('0x3f')](handleError(_0x57dfc5,null));}; \ No newline at end of file +var _0x8ac8=['eml-format','rimraf','fast-json-patch','moment','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','json','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','DeskField','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','html-pdf'];(function(_0x5c8cc1,_0x76afd2){var _0x56ef17=function(_0x538d31){while(--_0x538d31){_0x5c8cc1['push'](_0x5c8cc1['shift']());}};_0x56ef17(++_0x76afd2);}(_0x8ac8,0x1c1));var _0x88ac=function(_0x3093dc,_0x285119){_0x3093dc=_0x3093dc-0x0;var _0x3bedcc=_0x8ac8[_0x3093dc];return _0x3bedcc;};'use strict';var pdf=require(_0x88ac('0x0'));var emlformat=require(_0x88ac('0x1'));var rimraf=require(_0x88ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88ac('0x3'));var rp=require('request-promise');var moment=require(_0x88ac('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x88ac('0x5'));var path=require(_0x88ac('0x6'));var sox=require(_0x88ac('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x88ac('0x8'));var squel=require(_0x88ac('0x9'));var crypto=require(_0x88ac('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x88ac('0xb'));var toCsv=require('to-csv');var querystring=require(_0x88ac('0xc'));var Papa=require(_0x88ac('0xd'));var Redis=require(_0x88ac('0xe'));var authService=require(_0x88ac('0xf'));var qs=require(_0x88ac('0x10'));var as=require(_0x88ac('0x11'));var hardwareService=require(_0x88ac('0x12'));var logger=require(_0x88ac('0x13'))(_0x88ac('0x14'));var utils=require(_0x88ac('0x15'));var config=require(_0x88ac('0x16'));var licenseUtil=require(_0x88ac('0x17'));var db=require(_0x88ac('0x18'))['db'];function respondWithStatusCode(_0x37f291,_0x219576){_0x219576=_0x219576||0xcc;return function(_0x52aedd){if(_0x52aedd){return _0x37f291[_0x88ac('0x19')](_0x219576);}return _0x37f291[_0x88ac('0x1a')](_0x219576)['end']();};}function respondWithResult(_0x4b3fc5,_0x5d38d1){_0x5d38d1=_0x5d38d1||0xc8;return function(_0x3ec8e2){if(_0x3ec8e2){return _0x4b3fc5[_0x88ac('0x1a')](_0x5d38d1)['json'](_0x3ec8e2);}};}function respondWithFilteredResult(_0x55bdf8,_0x2594ac){return function(_0x511a75){if(_0x511a75){var _0x498db9=_0x511a75['count'],_0x45eb14=_0x2594ac[_0x88ac('0x1b')],_0xdfaf17=_0x2594ac[_0x88ac('0x1b')]+_0x2594ac[_0x88ac('0x1c')],_0x108d09;if(_0xdfaf17>=_0x498db9){_0xdfaf17=_0x498db9;_0x108d09=0xc8;}else{_0x108d09=0xce;}_0x55bdf8[_0x88ac('0x1a')](_0x108d09);return _0x55bdf8[_0x88ac('0x1d')]('Content-Range',_0x45eb14+'-'+_0xdfaf17+'/'+_0x498db9)[_0x88ac('0x1e')](_0x511a75);}return null;};}function patchUpdates(_0x12dcd4){return function(_0x246cce){try{jsonpatch[_0x88ac('0x1f')](_0x246cce,_0x12dcd4,!![]);}catch(_0x535e18){return BPromise[_0x88ac('0x20')](_0x535e18);}return _0x246cce['save']();};}function saveUpdates(_0x234c15,_0xa95eb2){return function(_0x5ccd08){if(_0x5ccd08){return _0x5ccd08[_0x88ac('0x21')](_0x234c15)['then'](function(_0x3e28e6){return _0x3e28e6;});}return null;};}function removeEntity(_0x392732,_0x86db9){return function(_0x122ca2){if(_0x122ca2){return _0x122ca2[_0x88ac('0x22')]()[_0x88ac('0x23')](function(){_0x392732[_0x88ac('0x1a')](0xcc)[_0x88ac('0x24')]();});}};}function handleEntityNotFound(_0x2c06f5,_0x5ed0){return function(_0x296e85){if(!_0x296e85){_0x2c06f5['sendStatus'](0x194);}return _0x296e85;};}function handleError(_0x4d4975,_0x5d0d65){_0x5d0d65=_0x5d0d65||0x1f4;return function(_0x3d4782){logger[_0x88ac('0x25')](_0x3d4782[_0x88ac('0x26')]);if(_0x3d4782[_0x88ac('0x27')]){delete _0x3d4782[_0x88ac('0x27')];}_0x4d4975['status'](_0x5d0d65)[_0x88ac('0x28')](_0x3d4782);};}exports[_0x88ac('0x29')]=function(_0x2cff9f,_0x4a780a){var _0x1ef8c7={},_0x1e29b6={},_0x223edf={'count':0x0,'rows':[]};var _0x523206=_[_0x88ac('0x2a')](db['DeskField']['rawAttributes'],function(_0x10d06f){return{'name':_0x10d06f[_0x88ac('0x2b')],'type':_0x10d06f[_0x88ac('0x2c')][_0x88ac('0x2d')]};});_0x1e29b6[_0x88ac('0x2e')]=_['map'](_0x523206,_0x88ac('0x27'));_0x1e29b6['query']=_[_0x88ac('0x2f')](_0x2cff9f[_0x88ac('0x30')]);_0x1e29b6['filters']=_['intersection'](_0x1e29b6[_0x88ac('0x2e')],_0x1e29b6['query']);_0x1ef8c7[_0x88ac('0x31')]=_[_0x88ac('0x32')](_0x1e29b6[_0x88ac('0x2e')],qs[_0x88ac('0x33')](_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x33')]));_0x1ef8c7[_0x88ac('0x31')]=_0x1ef8c7[_0x88ac('0x31')][_0x88ac('0x34')]?_0x1ef8c7[_0x88ac('0x31')]:_0x1e29b6[_0x88ac('0x2e')];if(!_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x35')](_0x88ac('0x36'))){_0x1ef8c7[_0x88ac('0x1c')]=qs[_0x88ac('0x1c')](_0x2cff9f[_0x88ac('0x30')]['limit']);_0x1ef8c7[_0x88ac('0x1b')]=qs[_0x88ac('0x1b')](_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x1b')]);}_0x1ef8c7[_0x88ac('0x37')]=qs[_0x88ac('0x38')](_0x2cff9f['query']['sort']);_0x1ef8c7[_0x88ac('0x39')]=qs[_0x88ac('0x3a')](_[_0x88ac('0x3b')](_0x2cff9f[_0x88ac('0x30')],_0x1e29b6[_0x88ac('0x3a')]),_0x523206);if(_0x2cff9f['query'][_0x88ac('0x3c')]){_0x1ef8c7['where']=_[_0x88ac('0x3d')](_0x1ef8c7[_0x88ac('0x39')],{'$or':_[_0x88ac('0x2a')](_0x523206,function(_0x57b1dc){if(_0x57b1dc[_0x88ac('0x2c')]!=='VIRTUAL'){var _0x1e2618={};_0x1e2618[_0x57b1dc[_0x88ac('0x27')]]={'$like':'%'+_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x3c')]+'%'};return _0x1e2618;}})});}_0x1ef8c7=_[_0x88ac('0x3d')]({},_0x1ef8c7,_0x2cff9f[_0x88ac('0x3e')]);var _0x4252c2={'where':_0x1ef8c7[_0x88ac('0x39')]};return db[_0x88ac('0x3f')]['count'](_0x4252c2)['then'](function(_0x3b7145){_0x223edf['count']=_0x3b7145;if(_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x40')]){_0x1ef8c7[_0x88ac('0x41')]=[{'all':!![]}];}return db[_0x88ac('0x3f')][_0x88ac('0x42')](_0x1ef8c7);})[_0x88ac('0x23')](function(_0x7ef731){_0x223edf[_0x88ac('0x43')]=_0x7ef731;return _0x223edf;})[_0x88ac('0x23')](respondWithFilteredResult(_0x4a780a,_0x1ef8c7))['catch'](handleError(_0x4a780a,null));};exports[_0x88ac('0x44')]=function(_0x13a3cc,_0x5ef988){var _0xeb268a={'raw':!![],'where':{'id':_0x13a3cc[_0x88ac('0x45')]['id']}},_0x22768b={};_0x22768b['model']=_[_0x88ac('0x2f')](db['DeskField'][_0x88ac('0x46')]);_0x22768b[_0x88ac('0x30')]=_[_0x88ac('0x2f')](_0x13a3cc[_0x88ac('0x30')]);_0x22768b['filters']=_['intersection'](_0x22768b['model'],_0x22768b[_0x88ac('0x30')]);_0xeb268a['attributes']=_['intersection'](_0x22768b['model'],qs['fields'](_0x13a3cc[_0x88ac('0x30')][_0x88ac('0x33')]));_0xeb268a[_0x88ac('0x31')]=_0xeb268a[_0x88ac('0x31')][_0x88ac('0x34')]?_0xeb268a[_0x88ac('0x31')]:_0x22768b[_0x88ac('0x2e')];if(_0x13a3cc[_0x88ac('0x30')]['includeAll']){_0xeb268a['include']=[{'all':!![]}];}_0xeb268a=_[_0x88ac('0x3d')]({},_0xeb268a,_0x13a3cc['options']);return db['DeskField'][_0x88ac('0x47')](_0xeb268a)[_0x88ac('0x23')](handleEntityNotFound(_0x5ef988,null))[_0x88ac('0x23')](respondWithResult(_0x5ef988,null))['catch'](handleError(_0x5ef988,null));};exports[_0x88ac('0x48')]=function(_0x2c66ac,_0xc57a4d){return db['DeskField'][_0x88ac('0x48')](_0x2c66ac[_0x88ac('0x49')],{})[_0x88ac('0x23')](respondWithResult(_0xc57a4d,0xc9))[_0x88ac('0x4a')](handleError(_0xc57a4d,null));};exports['update']=function(_0x5acedd,_0xdf5704){if(_0x5acedd[_0x88ac('0x49')]['id']){delete _0x5acedd[_0x88ac('0x49')]['id'];}return db[_0x88ac('0x3f')]['find']({'where':{'id':_0x5acedd[_0x88ac('0x45')]['id']}})[_0x88ac('0x23')](handleEntityNotFound(_0xdf5704,null))['then'](saveUpdates(_0x5acedd[_0x88ac('0x49')],null))[_0x88ac('0x23')](respondWithResult(_0xdf5704,null))[_0x88ac('0x4a')](handleError(_0xdf5704,null));};exports[_0x88ac('0x22')]=function(_0x1d9f5,_0x23fdd2){return db[_0x88ac('0x3f')][_0x88ac('0x47')]({'where':{'id':_0x1d9f5[_0x88ac('0x45')]['id']}})[_0x88ac('0x23')](handleEntityNotFound(_0x23fdd2,null))[_0x88ac('0x23')](removeEntity(_0x23fdd2,null))[_0x88ac('0x4a')](handleError(_0x23fdd2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ee45d1c..ff2dfb6 100644 --- a/server/api/intDeskField/intDeskField.model.js +++ b/server/api/intDeskField/intDeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e00=['DeskField','desk_unique_index','idField','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define'];(function(_0x34afbe,_0x40ae1f){var _0x1235da=function(_0x32ce6e){while(--_0x32ce6e){_0x34afbe['push'](_0x34afbe['shift']());}};_0x1235da(++_0x40ae1f);}(_0x9e00,0xcf));var _0x09e0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9e00[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x09e0('0x0'));var util=require(_0x09e0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09e0('0x2'));var BPromise=require('bluebird');var rp=require(_0x09e0('0x3'));var fs=require('fs');var path=require(_0x09e0('0x4'));var rimraf=require(_0x09e0('0x5'));var config=require(_0x09e0('0x6'));var attributes=require(_0x09e0('0x7'));module['exports']=function(_0x1fcacd,_0x218e01){return _0x1fcacd[_0x09e0('0x8')](_0x09e0('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x09e0('0xa'),'fields':[_0x09e0('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0517=['int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','DeskField'];(function(_0x1e05bc,_0x27eae6){var _0x153f32=function(_0x11627f){while(--_0x11627f){_0x1e05bc['push'](_0x1e05bc['shift']());}};_0x153f32(++_0x27eae6);}(_0x0517,0x17b));var _0x7051=function(_0x49f383,_0x9d5e9e){_0x49f383=_0x49f383-0x0;var _0x319941=_0x0517[_0x49f383];return _0x319941;};'use strict';var _=require(_0x7051('0x0'));var util=require('util');var logger=require(_0x7051('0x1'))(_0x7051('0x2'));var moment=require(_0x7051('0x3'));var BPromise=require(_0x7051('0x4'));var rp=require(_0x7051('0x5'));var fs=require('fs');var path=require(_0x7051('0x6'));var rimraf=require(_0x7051('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x7051('0x8')]=function(_0x14f334,_0x5d5b60){return _0x14f334[_0x7051('0x9')](_0x7051('0xa'),attributes,{'tableName':_0x7051('0xb'),'paranoid':![],'indexes':[{'name':_0x7051('0xc'),'fields':[_0x7051('0xd'),_0x7051('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index bc5ada0..f897e49 100644 --- a/server/api/intDeskField/intDeskField.rpc.js +++ b/server/api/intDeskField/intDeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bef=['moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x7bef,0x9f));var _0xf7be=function(_0x2fe959,_0x351d77){_0x2fe959=_0x2fe959-0x0;var _0x2f6ace=_0x7bef[_0x2fe959];return _0x2f6ace;};'use strict';var _=require('lodash');var util=require(_0xf7be('0x0'));var moment=require(_0xf7be('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7be('0x2'));var db=require(_0xf7be('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf7be('0x4'))('rpc');var config=require(_0xf7be('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf7be('0x6')][_0xf7be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ddc69,_0x3b01fc,_0xe60724){return new BPromise(function(_0x2359e7,_0x1764fa){return client[_0xf7be('0x8')](_0x4ddc69,_0xe60724)[_0xf7be('0x9')](function(_0x49951f){logger[_0xf7be('0xa')](_0xf7be('0xb'),_0x3b01fc,_0xf7be('0xc'));logger[_0xf7be('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x3b01fc,'request\x20sent',JSON[_0xf7be('0xe')](_0x49951f));if(_0x49951f[_0xf7be('0xf')]){if(_0x49951f[_0xf7be('0xf')][_0xf7be('0x10')]===0x1f4){logger['error'](_0xf7be('0xb'),_0x3b01fc,_0x49951f[_0xf7be('0xf')]['message']);return _0x1764fa(_0x49951f[_0xf7be('0xf')][_0xf7be('0x11')]);}logger[_0xf7be('0xf')](_0xf7be('0xb'),_0x3b01fc,_0x49951f[_0xf7be('0xf')]['message']);return _0x2359e7(_0x49951f[_0xf7be('0xf')][_0xf7be('0x11')]);}else{logger[_0xf7be('0xa')]('DeskField,\x20%s,\x20%s',_0x3b01fc,_0xf7be('0xc'));_0x2359e7(_0x49951f[_0xf7be('0x12')][_0xf7be('0x11')]);}})[_0xf7be('0x13')](function(_0x484b99){logger[_0xf7be('0xf')](_0xf7be('0xb'),_0x3b01fc,_0x484b99);_0x1764fa(_0x484b99);});});} \ No newline at end of file +var _0x2b27=['request','then','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x3b2196,_0x3476bf){var _0x54ab19=function(_0x34be56){while(--_0x34be56){_0x3b2196['push'](_0x3b2196['shift']());}};_0x54ab19(++_0x3476bf);}(_0x2b27,0x160));var _0x72b2=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x2b27[_0x57fa7e];return _0x320671;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x72b2('0x0'));var BPromise=require(_0x72b2('0x1'));var rs=require(_0x72b2('0x2'));var fs=require('fs');var Redis=require(_0x72b2('0x3'));var db=require(_0x72b2('0x4'))['db'];var utils=require(_0x72b2('0x5'));var logger=require('../../config/logger')(_0x72b2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x72b2('0x7')][_0x72b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x564238,_0x476d9d,_0x4fd264){return new BPromise(function(_0x482885,_0x5c85a8){return client[_0x72b2('0x9')](_0x564238,_0x4fd264)[_0x72b2('0xa')](function(_0x23dc06){logger['info'](_0x72b2('0xb'),_0x476d9d,_0x72b2('0xc'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x476d9d,_0x72b2('0xc'),JSON[_0x72b2('0xd')](_0x23dc06));if(_0x23dc06[_0x72b2('0xe')]){if(_0x23dc06[_0x72b2('0xe')]['code']===0x1f4){logger[_0x72b2('0xe')](_0x72b2('0xb'),_0x476d9d,_0x23dc06[_0x72b2('0xe')]['message']);return _0x5c85a8(_0x23dc06[_0x72b2('0xe')]['message']);}logger['error']('DeskField,\x20%s,\x20%s',_0x476d9d,_0x23dc06[_0x72b2('0xe')][_0x72b2('0xf')]);return _0x482885(_0x23dc06[_0x72b2('0xe')][_0x72b2('0xf')]);}else{logger[_0x72b2('0x10')]('DeskField,\x20%s,\x20%s',_0x476d9d,_0x72b2('0xc'));_0x482885(_0x23dc06[_0x72b2('0x11')][_0x72b2('0xf')]);}})[_0x72b2('0x12')](function(_0x174d08){logger[_0x72b2('0xe')]('DeskField,\x20%s,\x20%s',_0x476d9d,_0x174d08);_0x5c85a8(_0x174d08);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 7228b70..8330019 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['getFields','post','create','/:id/configurations','put','/:id','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0x5eb8[_0x1e91eb];return _0x2af75a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var auth=require(_0x85eb('0x4'));var interaction=require(_0x85eb('0x5'));var config=require(_0x85eb('0x6'));var controller=require(_0x85eb('0x7'));router[_0x85eb('0x8')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xa')]);router[_0x85eb('0x8')]('/:id',auth[_0x85eb('0x9')](),controller[_0x85eb('0xb')]);router[_0x85eb('0x8')]('/:id/configurations',auth[_0x85eb('0x9')](),controller['getConfigurations']);router[_0x85eb('0x8')](_0x85eb('0xc'),auth[_0x85eb('0x9')](),controller[_0x85eb('0xd')]);router[_0x85eb('0xe')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xf')]);router['post'](_0x85eb('0x10'),auth[_0x85eb('0x9')](),controller['addConfiguration']);router[_0x85eb('0x11')](_0x85eb('0x12'),auth[_0x85eb('0x9')](),controller[_0x85eb('0x13')]);router['delete']('/:id',auth[_0x85eb('0x9')](),controller['destroy']);module[_0x85eb('0x14')]=router; \ No newline at end of file +var _0x5eb8=['getFields','post','create','/:id/configurations','put','/:id','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0x5eb8,0xb0));var _0x85eb=function(_0x597c16,_0x2292fe){_0x597c16=_0x597c16-0x0;var _0x30cc2c=_0x5eb8[_0x597c16];return _0x30cc2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var auth=require(_0x85eb('0x4'));var interaction=require(_0x85eb('0x5'));var config=require(_0x85eb('0x6'));var controller=require(_0x85eb('0x7'));router[_0x85eb('0x8')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xa')]);router[_0x85eb('0x8')]('/:id',auth[_0x85eb('0x9')](),controller[_0x85eb('0xb')]);router[_0x85eb('0x8')]('/:id/configurations',auth[_0x85eb('0x9')](),controller['getConfigurations']);router[_0x85eb('0x8')](_0x85eb('0xc'),auth[_0x85eb('0x9')](),controller[_0x85eb('0xd')]);router[_0x85eb('0xe')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xf')]);router['post'](_0x85eb('0x10'),auth[_0x85eb('0x9')](),controller['addConfiguration']);router[_0x85eb('0x11')](_0x85eb('0x12'),auth[_0x85eb('0x9')](),controller[_0x85eb('0x13')]);router['delete']('/:id',auth[_0x85eb('0x9')](),controller['destroy']);module[_0x85eb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f53d19e..b04e9a3 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.attributes.js +++ b/server/api/intDynamics365Account/intDynamics365Account.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f4d=['exports','STRING','sequelize'];(function(_0x480183,_0x31ba63){var _0x1bc033=function(_0x218da5){while(--_0x218da5){_0x480183['push'](_0x480183['shift']());}};_0x1bc033(++_0x31ba63);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0x9f4d[_0x9d639c];return _0x1671de;};'use strict';var Sequelize=require(_0xd9f4('0x0'));module[_0xd9f4('0x1')]={'name':{'type':Sequelize[_0xd9f4('0x2')]},'username':{'type':Sequelize[_0xd9f4('0x2')]},'password':{'type':Sequelize[_0xd9f4('0x2')]},'remoteUri':{'type':Sequelize[_0xd9f4('0x2')]},'tenantId':{'type':Sequelize[_0xd9f4('0x2')]},'clientId':{'type':Sequelize[_0xd9f4('0x2')]},'clientSecret':{'type':Sequelize[_0xd9f4('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd9f4('0x2')]}}; \ No newline at end of file +var _0x2beb=['sequelize','STRING'];(function(_0x2dced0,_0x34fd18){var _0x2a9f2f=function(_0x430f72){while(--_0x430f72){_0x2dced0['push'](_0x2dced0['shift']());}};_0x2a9f2f(++_0x34fd18);}(_0x2beb,0x1be));var _0xb2be=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2beb[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xb2be('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2be('0x1')]},'username':{'type':Sequelize[_0xb2be('0x1')]},'password':{'type':Sequelize[_0xb2be('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xb2be('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb2be('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb2be('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 7aa76ef..98c2964 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.controller.js +++ b/server/api/intDynamics365Account/intDynamics365Account.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1623=['Content-Range','apply','reject','save','update','stack','name','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','intersection','includeAll','find','create','body','params','getConfigurations','Dynamics365Configuration','pick','hasOwnProperty','addConfiguration','findOne','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','phonecall_activity_parties','accountidyominame','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','clientSecret','access_token','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','includes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','Options','UserLocalizedLabel','Label','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','OptionSet','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set'];(function(_0x2c34c1,_0x3f9aa7){var _0x587ccc=function(_0x24bb12){while(--_0x24bb12){_0x2c34c1['push'](_0x2c34c1['shift']());}};_0x587ccc(++_0x3f9aa7);}(_0x1623,0xab));var _0x3162=function(_0x1f963d,_0x349bcc){_0x1f963d=_0x1f963d-0x0;var _0x56ae22=_0x1623[_0x1f963d];return _0x56ae22;};'use strict';var pdf=require(_0x3162('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3162('0x1'));var jsonpatch=require(_0x3162('0x2'));var rp=require(_0x3162('0x3'));var moment=require(_0x3162('0x4'));var BPromise=require(_0x3162('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3162('0x6'));var sox=require('sox');var csv=require(_0x3162('0x7'));var ejs=require(_0x3162('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0x7'));var querystring=require(_0x3162('0xd'));var Papa=require(_0x3162('0xe'));var Redis=require(_0x3162('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x10'));var hardwareService=require(_0x3162('0x11'));var logger=require(_0x3162('0x12'))(_0x3162('0x13'));var utils=require(_0x3162('0x14'));var config=require(_0x3162('0x15'));var licenseUtil=require(_0x3162('0x16'));var db=require(_0x3162('0x17'))['db'];var integrations=require(_0x3162('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b9faf,_0x143c5a,_0x49d1ad,_0x4a393a){return new BPromise(function(_0x198764,_0x2bb738){var _0x1eea65=_0x4a393a||client;return _0x1eea65['request'](_0x3b9faf,_0x49d1ad)[_0x3162('0x1a')](function(_0x3d0bea){logger[_0x3162('0x1b')]('Dynamics365Account,\x20%s,\x20%s',_0x143c5a,_0x3162('0x1c'));logger[_0x3162('0x1d')](_0x3162('0x1e'),_0x143c5a,_0x3162('0x1c'),JSON[_0x3162('0x1f')](_0x3d0bea));if(_0x3d0bea[_0x3162('0x20')]){if(_0x3d0bea[_0x3162('0x20')]['code']===0x1f4){logger[_0x3162('0x20')](_0x3162('0x21'),_0x143c5a,_0x3d0bea[_0x3162('0x20')][_0x3162('0x22')]);return _0x2bb738(_0x3d0bea['error'][_0x3162('0x22')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x143c5a,_0x3d0bea[_0x3162('0x20')][_0x3162('0x22')]);return _0x198764(_0x3d0bea[_0x3162('0x20')]['message']);}else{logger['info'](_0x3162('0x21'),_0x143c5a,_0x3162('0x1c'));_0x198764(_0x3d0bea[_0x3162('0x23')][_0x3162('0x22')]);}})[_0x3162('0x24')](function(_0x14cbba){logger[_0x3162('0x20')](_0x3162('0x21'),_0x143c5a,_0x14cbba);_0x2bb738(_0x14cbba);});});}function respondWithStatusCode(_0x5a4994,_0xd283d6){_0xd283d6=_0xd283d6||0xcc;return function(_0x2433f8){if(_0x2433f8){return _0x5a4994[_0x3162('0x25')](_0xd283d6);}return _0x5a4994[_0x3162('0x26')](_0xd283d6)[_0x3162('0x27')]();};}function respondWithResult(_0x3c543e,_0x30552f){_0x30552f=_0x30552f||0xc8;return function(_0x5f8f7){if(_0x5f8f7){return _0x3c543e[_0x3162('0x26')](_0x30552f)[_0x3162('0x28')](_0x5f8f7);}};}function respondWithFilteredResult(_0x8fa09f,_0x2f62d7){return function(_0x1c03a4){if(_0x1c03a4){var _0x48de45=_0x1c03a4[_0x3162('0x29')],_0x4025c3=_0x2f62d7[_0x3162('0x2a')],_0x552469=_0x2f62d7['offset']+_0x2f62d7['limit'],_0x37acdd;if(_0x552469>=_0x48de45){_0x552469=_0x48de45;_0x37acdd=0xc8;}else{_0x37acdd=0xce;}_0x8fa09f[_0x3162('0x26')](_0x37acdd);return _0x8fa09f[_0x3162('0x2b')](_0x3162('0x2c'),_0x4025c3+'-'+_0x552469+'/'+_0x48de45)[_0x3162('0x28')](_0x1c03a4);}return null;};}function patchUpdates(_0x2f88ec){return function(_0x5c2d28){try{jsonpatch[_0x3162('0x2d')](_0x5c2d28,_0x2f88ec,!![]);}catch(_0x4e3cc2){return BPromise[_0x3162('0x2e')](_0x4e3cc2);}return _0x5c2d28[_0x3162('0x2f')]();};}function saveUpdates(_0x41e933,_0x221b38){return function(_0x118dab){if(_0x118dab){return _0x118dab[_0x3162('0x30')](_0x41e933)[_0x3162('0x1a')](function(_0x1fd3f3){return _0x1fd3f3;});}return null;};}function removeEntity(_0x549ffe,_0x5aca2d){return function(_0x2a44c0){if(_0x2a44c0){return _0x2a44c0['destroy']()[_0x3162('0x1a')](function(){_0x549ffe[_0x3162('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7efb,_0x39bba5){return function(_0x5dea33){if(!_0x5dea33){_0x5b7efb[_0x3162('0x25')](0x194);}return _0x5dea33;};}function handleError(_0x47241c,_0x1de909){_0x1de909=_0x1de909||0x1f4;return function(_0x551442){logger['error'](_0x551442[_0x3162('0x31')]);if(_0x551442[_0x3162('0x32')]){delete _0x551442['name'];}_0x47241c[_0x3162('0x26')](_0x1de909)['send'](_0x551442);};}exports[_0x3162('0x33')]=function(_0x12953b,_0x339be2){var _0x137e9b={},_0x435aed={},_0x3b6c91={'count':0x0,'rows':[]};var _0x30bb26=_[_0x3162('0x34')](db[_0x3162('0x35')][_0x3162('0x36')],function(_0x3fc06f){return{'name':_0x3fc06f['fieldName'],'type':_0x3fc06f[_0x3162('0x37')][_0x3162('0x38')]};});_0x435aed[_0x3162('0x39')]=_['map'](_0x30bb26,'name');_0x435aed[_0x3162('0x3a')]=_[_0x3162('0x3b')](_0x12953b[_0x3162('0x3a')]);_0x435aed[_0x3162('0x3c')]=_['intersection'](_0x435aed[_0x3162('0x39')],_0x435aed['query']);_0x137e9b['attributes']=_['intersection'](_0x435aed[_0x3162('0x39')],qs[_0x3162('0x3d')](_0x12953b[_0x3162('0x3a')]['fields']));_0x137e9b[_0x3162('0x3e')]=_0x137e9b[_0x3162('0x3e')][_0x3162('0x3f')]?_0x137e9b[_0x3162('0x3e')]:_0x435aed[_0x3162('0x39')];if(!_0x12953b['query']['hasOwnProperty'](_0x3162('0x40'))){_0x137e9b[_0x3162('0x41')]=qs['limit'](_0x12953b['query'][_0x3162('0x41')]);_0x137e9b[_0x3162('0x2a')]=qs[_0x3162('0x2a')](_0x12953b['query'][_0x3162('0x2a')]);}_0x137e9b[_0x3162('0x42')]=qs[_0x3162('0x43')](_0x12953b[_0x3162('0x3a')]['sort']);_0x137e9b[_0x3162('0x44')]=qs[_0x3162('0x3c')](_['pick'](_0x12953b[_0x3162('0x3a')],_0x435aed[_0x3162('0x3c')]),_0x30bb26);if(_0x12953b['query'][_0x3162('0x45')]){_0x137e9b[_0x3162('0x44')]=_['merge'](_0x137e9b[_0x3162('0x44')],{'$or':_['map'](_0x30bb26,function(_0x4146f1){if(_0x4146f1[_0x3162('0x37')]!==_0x3162('0x46')){var _0x262f9d={};_0x262f9d[_0x4146f1[_0x3162('0x32')]]={'$like':'%'+_0x12953b[_0x3162('0x3a')]['filter']+'%'};return _0x262f9d;}})});}_0x137e9b=_[_0x3162('0x47')]({},_0x137e9b,_0x12953b[_0x3162('0x48')]);var _0x31c04={'where':_0x137e9b['where']};return db[_0x3162('0x35')][_0x3162('0x29')](_0x31c04)['then'](function(_0x1f99d6){_0x3b6c91['count']=_0x1f99d6;if(_0x12953b['query']['includeAll']){_0x137e9b[_0x3162('0x49')]=[{'all':!![]}];}return db[_0x3162('0x35')][_0x3162('0x4a')](_0x137e9b);})[_0x3162('0x1a')](function(_0x1cfde8){_0x3b6c91[_0x3162('0x4b')]=_0x1cfde8;return _0x3b6c91;})[_0x3162('0x1a')](respondWithFilteredResult(_0x339be2,_0x137e9b))[_0x3162('0x24')](handleError(_0x339be2,null));};exports[_0x3162('0x4c')]=function(_0x28865c,_0x1c81b5){var _0x3a167f={'raw':![],'where':{'id':_0x28865c['params']['id']}},_0x209383={};_0x209383[_0x3162('0x39')]=_['keys'](db['Dynamics365Account'][_0x3162('0x36')]);_0x209383[_0x3162('0x3a')]=_[_0x3162('0x3b')](_0x28865c[_0x3162('0x3a')]);_0x209383['filters']=_[_0x3162('0x4d')](_0x209383['model'],_0x209383[_0x3162('0x3a')]);_0x3a167f[_0x3162('0x3e')]=_['intersection'](_0x209383[_0x3162('0x39')],qs['fields'](_0x28865c['query'][_0x3162('0x3d')]));_0x3a167f[_0x3162('0x3e')]=_0x3a167f[_0x3162('0x3e')][_0x3162('0x3f')]?_0x3a167f[_0x3162('0x3e')]:_0x209383[_0x3162('0x39')];if(_0x28865c[_0x3162('0x3a')][_0x3162('0x4e')]){_0x3a167f['include']=[{'all':!![]}];}_0x3a167f=_['merge']({},_0x3a167f,_0x28865c['options']);return db[_0x3162('0x35')][_0x3162('0x4f')](_0x3a167f)[_0x3162('0x1a')](handleEntityNotFound(_0x1c81b5,null))[_0x3162('0x1a')](respondWithResult(_0x1c81b5,null))[_0x3162('0x24')](handleError(_0x1c81b5,null));};exports[_0x3162('0x50')]=function(_0x1af653,_0x4f46f3){return db[_0x3162('0x35')]['create'](_0x1af653[_0x3162('0x51')],{})['then'](respondWithResult(_0x4f46f3,0xc9))[_0x3162('0x24')](handleError(_0x4f46f3,null));};exports['update']=function(_0x1a7165,_0xd6b792){if(_0x1a7165['body']['id']){delete _0x1a7165['body']['id'];}return db[_0x3162('0x35')][_0x3162('0x4f')]({'where':{'id':_0x1a7165['params']['id']}})[_0x3162('0x1a')](handleEntityNotFound(_0xd6b792,null))[_0x3162('0x1a')](saveUpdates(_0x1a7165[_0x3162('0x51')],null))[_0x3162('0x1a')](respondWithResult(_0xd6b792,null))[_0x3162('0x24')](handleError(_0xd6b792,null));};exports['destroy']=function(_0x35483f,_0x3d5cd8){return db['Dynamics365Account']['find']({'where':{'id':_0x35483f[_0x3162('0x52')]['id']}})[_0x3162('0x1a')](handleEntityNotFound(_0x3d5cd8,null))[_0x3162('0x1a')](removeEntity(_0x3d5cd8,null))['catch'](handleError(_0x3d5cd8,null));};exports[_0x3162('0x53')]=function(_0x4a2ff8,_0xca72d0,_0x32c999){var _0x5c948d={};var _0x434cb2={};var _0x286aad;var _0x5262b6;return db[_0x3162('0x35')]['findOne']({'where':{'id':_0x4a2ff8[_0x3162('0x52')]['id']}})[_0x3162('0x1a')](handleEntityNotFound(_0xca72d0,null))[_0x3162('0x1a')](function(_0x53ad9b){if(_0x53ad9b){_0x286aad=_0x53ad9b;_0x434cb2[_0x3162('0x39')]=_[_0x3162('0x3b')](db[_0x3162('0x54')][_0x3162('0x36')]);_0x434cb2[_0x3162('0x3a')]=_[_0x3162('0x3b')](_0x4a2ff8['query']);_0x434cb2['filters']=_['intersection'](_0x434cb2[_0x3162('0x39')],_0x434cb2['query']);_0x5c948d[_0x3162('0x3e')]=_[_0x3162('0x4d')](_0x434cb2[_0x3162('0x39')],qs[_0x3162('0x3d')](_0x4a2ff8[_0x3162('0x3a')]['fields']));_0x5c948d['attributes']=_0x5c948d[_0x3162('0x3e')][_0x3162('0x3f')]?_0x5c948d['attributes']:_0x434cb2[_0x3162('0x39')];_0x5c948d[_0x3162('0x42')]=qs[_0x3162('0x43')](_0x4a2ff8[_0x3162('0x3a')][_0x3162('0x43')]);_0x5c948d['where']=qs[_0x3162('0x3c')](_[_0x3162('0x55')](_0x4a2ff8[_0x3162('0x3a')],_0x434cb2[_0x3162('0x3c')]));if(_0x4a2ff8[_0x3162('0x3a')]['filter']){_0x5c948d[_0x3162('0x44')]=_[_0x3162('0x47')](_0x5c948d[_0x3162('0x44')],{'$or':_[_0x3162('0x34')](_0x5c948d['attributes'],function(_0x134a99){var _0x141ab9={};_0x141ab9[_0x134a99]={'$like':'%'+_0x4a2ff8[_0x3162('0x3a')][_0x3162('0x45')]+'%'};return _0x141ab9;})});}_0x5c948d=_[_0x3162('0x47')]({},_0x5c948d,_0x4a2ff8[_0x3162('0x48')]);return _0x286aad[_0x3162('0x53')](_0x5c948d);}})[_0x3162('0x1a')](function(_0x456006){if(_0x456006){_0x5262b6=_0x456006[_0x3162('0x3f')];if(!_0x4a2ff8['query'][_0x3162('0x56')](_0x3162('0x40'))){_0x5c948d['limit']=qs[_0x3162('0x41')](_0x4a2ff8['query'][_0x3162('0x41')]);_0x5c948d[_0x3162('0x2a')]=qs[_0x3162('0x2a')](_0x4a2ff8[_0x3162('0x3a')][_0x3162('0x2a')]);}return _0x286aad[_0x3162('0x53')](_0x5c948d);}})['then'](function(_0x41b773){if(_0x41b773){return _0x41b773?{'count':_0x5262b6,'rows':_0x41b773}:null;}})[_0x3162('0x1a')](respondWithResult(_0xca72d0,null))[_0x3162('0x24')](handleError(_0xca72d0,null));};exports[_0x3162('0x57')]=function(_0x3147a8,_0x148d28,_0x509c99){if(_0x3147a8[_0x3162('0x51')]['id']){delete _0x3147a8[_0x3162('0x51')]['id'];}return db[_0x3162('0x35')][_0x3162('0x58')]({'where':{'id':_0x3147a8[_0x3162('0x52')]['id']}})[_0x3162('0x1a')](handleEntityNotFound(_0x148d28,null))[_0x3162('0x1a')](function(_0x502120){if(_0x502120){_0x3147a8['body']['AccountId']=_0x502120['id'];_0x3147a8[_0x3162('0x51')][_0x3162('0x59')]=integrations['getSubjects'](_0x3147a8[_0x3162('0x51')][_0x3162('0x5a')],_0x3147a8[_0x3162('0x51')][_0x3162('0x37')]);_0x3147a8['body'][_0x3162('0x5b')]=integrations[_0x3162('0x5c')](_0x3147a8['body'][_0x3162('0x5a')],_0x3147a8['body'][_0x3162('0x37')]);return db['Dynamics365Configuration'][_0x3162('0x50')](_0x3147a8['body'],{'include':[{'model':db[_0x3162('0x5d')],'as':_0x3162('0x59')},{'model':db[_0x3162('0x5d')],'as':_0x3162('0x5b')}]});}return null;})[_0x3162('0x1a')](respondWithResult(_0x148d28,null))[_0x3162('0x24')](handleError(_0x148d28,null));};exports['getFields']=function(_0x346eb1,_0x63f6c2,_0x40110d){var _0x4b3971=_0x346eb1[_0x3162('0x3a')][_0x3162('0x5e')];var _0x2d2f69=_0x4b3971===_0x3162('0x5f')?_0x3162('0x60'):'PhoneCall';var _0x228cb3='';var _0x126af5='';var _0x502ec1='';var _0x5c3304='';var _0x262e82='';var _0x1015ca='';var _0x54735c='';var _0x81909b='';var _0xede1c1=[_0x3162('0x61'),_0x3162('0x62'),_0x3162('0x63'),_0x3162('0x64'),_0x3162('0x65'),_0x3162('0x66'),_0x3162('0x67'),'regardingobjectid','directioncode',_0x3162('0x68')];var _0x24605f=['accountidname',_0x3162('0x69'),'actualserviceunits','billedserviceunits','contactidname',_0x3162('0x6a'),'contractdetailidname',_0x3162('0x6b'),_0x3162('0x6c'),_0x3162('0x6d'),_0x3162('0x6e'),_0x3162('0x6f'),_0x3162('0x70'),_0x3162('0x71'),_0x3162('0x72'),_0x3162('0x73'),_0x3162('0x74'),_0x3162('0x75'),'emailaddress',_0x3162('0x76'),_0x3162('0x77'),_0x3162('0x78'),_0x3162('0x79'),_0x3162('0x7a'),_0x3162('0x7b'),_0x3162('0x7c'),_0x3162('0x7d'),_0x3162('0x7e'),_0x3162('0x7f'),_0x3162('0x80'),_0x3162('0x81'),'modifiedbyexternalpartyname',_0x3162('0x82'),_0x3162('0x83'),_0x3162('0x84'),'modifiedon',_0x3162('0x85'),'modifiedonbehalfbyyominame',_0x3162('0x86'),_0x3162('0x87'),'numberofchildincidents','onholdtime',_0x3162('0x88'),_0x3162('0x89'),'owneridtype',_0x3162('0x8a'),'parentcaseidname',_0x3162('0x8b'),_0x3162('0x8c'),_0x3162('0x8d'),_0x3162('0x8e'),_0x3162('0x8f'),_0x3162('0x90'),_0x3162('0x91'),_0x3162('0x92'),_0x3162('0x93'),'responsiblecontactidyominame',_0x3162('0x94'),'slainvokedidname',_0x3162('0x95'),_0x3162('0x96'),'statecode',_0x3162('0x97'),_0x3162('0x98'),_0x3162('0x99'),_0x3162('0x9a'),_0x3162('0x9b'),_0x3162('0x9c'),_0x3162('0x9d'),'versionnumber'];var _0x40859e=_0xede1c1[_0x3162('0x9e')](_0x24605f);return db[_0x3162('0x35')]['findOne']({'where':{'id':_0x346eb1[_0x3162('0x52')]['id']},'attributes':['id',_0x3162('0x9f'),_0x3162('0xa0'),_0x3162('0xa1'),_0x3162('0xa2'),_0x3162('0xa3'),'clientSecret']})[_0x3162('0x1a')](handleEntityNotFound(_0x63f6c2,null))[_0x3162('0x1a')](function(_0x3ac0ef){if(_0x3ac0ef){_0x81909b=_0x3ac0ef[_0x3162('0xa1')];var _0x40ae99=_0x81909b['slice'](-0x1);if(_0x40ae99==='/'){_0x81909b=_0x81909b[_0x3162('0xa4')](0x0,_0x81909b['lastIndexOf'](_0x40ae99));}_0x54735c=util[_0x3162('0xa5')](_0x3162('0xa6'),_0x81909b);var _0x5015ee={'method':_0x3162('0xa7'),'uri':_0x3162('0xa8')+_0x3ac0ef[_0x3162('0xa2')]+'/oauth2/token','form':{'client_id':_0x3ac0ef[_0x3162('0xa3')],'resource':_0x81909b,'username':_0x3ac0ef['username'],'password':_0x3ac0ef['password'],'grant_type':_0x3162('0xa0'),'client_secret':_0x3ac0ef[_0x3162('0xa9')]},'json':!![]};return rp(_0x5015ee);}})[_0x3162('0x1a')](function(_0x34fe8f){_0x1015ca=_0x34fe8f[_0x3162('0xaa')];var _0x34c426={'method':_0x3162('0xab'),'uri':encodeURI(_0x54735c+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2d2f69+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1015ca,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x34c426);})[_0x3162('0x1a')](function(_0x10cc38){var _0x50c0ed=_0x10cc38['value'][0x0];var _0x118d5e=_0x50c0ed['MetadataId'];var _0xd803e={'method':_0x3162('0xab'),'uri':_0x54735c+_0x3162('0xac')+_0x118d5e+_0x3162('0xad'),'headers':{'Authorization':'Bearer\x20'+_0x1015ca,'If-None-Match':null,'OData-Version':_0x3162('0xae')},'json':!![]};return rp(_0xd803e);})[_0x3162('0x1a')](function(_0x2800f9){_0x228cb3=_0x2800f9;_0x126af5=_0x228cb3['Attributes'];_0x126af5=_[_0x3162('0xaf')](_0x126af5,function(_0x5c952c){return!_0x40859e[_0x3162('0xb0')](_0x5c952c['LogicalName']);});var _0x4468d3=[];var _0x3d414f=[];_0x126af5[_0x3162('0xb1')](function(_0x591bb7){if(_0x591bb7[_0x3162('0xb2')]){var _0x23c591=_0x591bb7[_0x3162('0xb2')][_0x3162('0xa4')](_0x591bb7['@odata.type'][_0x3162('0xb3')]('.')+0x1);if(_0x23c591===_0x3162('0xb4')){_0x4468d3['push'](getSelectList(_0x54735c,_0x4b3971,_0x3d414f,_0x228cb3[_0x3162('0xb5')],_0x591bb7[_0x3162('0xb5')],_0x1015ca));}}});return Promise[_0x3162('0xb6')](_0x4468d3);})[_0x3162('0x1a')](function(_0xdccc1a){_0x502ec1=_0xdccc1a[0x0];var _0x197427=[];var _0x114720=[];_0x126af5[_0x3162('0xb1')](function(_0x474537){if(!_[_0x3162('0xb7')](_0x474537['@odata.type'])){var _0x82f3d1=_0x474537[_0x3162('0xb2')][_0x3162('0xa4')](_0x474537[_0x3162('0xb2')][_0x3162('0xb3')]('.')+0x1);if(_0x82f3d1===_0x3162('0xb8')){_0x197427[_0x3162('0xb9')](getBooleanList(_0x54735c,_0x4b3971,_0x114720,_0x228cb3[_0x3162('0xb5')],_0x474537['MetadataId'],_0x1015ca));}}});return Promise[_0x3162('0xb6')](_0x197427);})[_0x3162('0x1a')](function(_0x5a03ee){_0x5c3304=_0x5a03ee[0x0];var _0x109544=[];var _0x5d65e7=[];_0x126af5[_0x3162('0xb1')](function(_0x249cb5){if(_0x249cb5[_0x3162('0xb2')]){var _0x54305b=_0x249cb5[_0x3162('0xb2')][_0x3162('0xa4')](_0x249cb5['@odata.type'][_0x3162('0xb3')]('.')+0x1);if(_0x54305b===_0x3162('0xba')||_0x54305b===_0x3162('0xbb')||_0x54305b==='BigIntAttributeMetadata'||_0x54305b==='IntegerAttributeMetadata'||_0x54305b===_0x3162('0xbc')||_0x54305b===_0x3162('0xbd')||_0x54305b==='StatusAttributeMetadata'||_0x54305b===_0x3162('0xbe')||_0x54305b===_0x3162('0xbf')||_0x54305b===_0x3162('0xc0')){_0x109544[_0x3162('0xb9')](getInputList(_0x54735c,_0x4b3971,_0x54305b,_0x5d65e7,_0x228cb3[_0x3162('0xb5')],_0x249cb5[_0x3162('0xb5')],_0x1015ca));}}});return Promise[_0x3162('0xb6')](_0x109544);})[_0x3162('0x1a')](function(_0x2632bd){_0x262e82=_0x2632bd[0x0];var _0x4d0d46=_0x502ec1[_0x3162('0x9e')](_0x5c3304)[_0x3162('0x9e')](_0x262e82);var _0x53f5d7={'count':_0x4d0d46[_0x3162('0x3f')],'rows':_0x4d0d46};return _0x53f5d7;})[_0x3162('0x1a')](respondWithResult(_0x63f6c2,null))[_0x3162('0x24')](function(_0x21a870){var _0x334634=_0x346eb1[_0x3162('0x3a')][_0x3162('0xc1')]?0x1f4:_0x21a870[_0x3162('0xc2')]||0x1f4;logger[_0x3162('0x20')](_0x21a870[_0x3162('0x31')]);delete _0x21a870[_0x3162('0x32')];if(_0x334634===0x191){_0x334634=0x190;}_0x63f6c2[_0x3162('0x26')](_0x334634)[_0x3162('0xc3')](_0x346eb1['query'][_0x3162('0xc1')]?{'message':_0x3162('0xc4'),'statusCode':_0x21a870['statusCode']}:_0x21a870);});};function getSelectList(_0x4601cc,_0x4ee00c,_0x37aadb,_0xb437cf,_0x21b04a,_0x46c675){var _0x48f3cb={'method':_0x3162('0xab'),'uri':_0x4601cc+_0x3162('0xac')+_0xb437cf+_0x3162('0xc5')+_0x21b04a+_0x3162('0xc6')+_0x3162('0xc7'),'headers':{'Authorization':_0x3162('0xc8')+_0x46c675,'If-None-Match':null,'OData-Version':_0x3162('0xae')},'json':!![]};return rp(_0x48f3cb)[_0x3162('0x1a')](function(_0x3152c9){var _0x185974=[];var _0x448ea9=_0x3152c9['OptionSet'][_0x3162('0xc9')];_0x448ea9[_0x3162('0xb1')](function(_0x16a9a6){_0x185974[_0x3162('0xb9')]({'name':_0x16a9a6['Label'][_0x3162('0xca')][_0x3162('0xcb')],'value':String(_0x16a9a6[_0x3162('0xcc')])});});var _0x5ab418={'id':_0x4ee00c+'_'+_0x3152c9[_0x3162('0xcd')],'name':_0x3152c9[_0x3162('0xce')]['UserLocalizedLabel'][_0x3162('0xcb')],'custom':![],'options':_0x185974};_0x37aadb[_0x3162('0xb9')](_0x5ab418);return _0x37aadb;});}function getBooleanList(_0x562335,_0xae1ca4,_0x2f1e5a,_0x23f473,_0x3f35d5,_0x5917d1){var _0x2d756e={'method':_0x3162('0xab'),'uri':_0x562335+_0x3162('0xac')+_0x23f473+')/Attributes('+_0x3f35d5+_0x3162('0xcf'),'headers':{'Authorization':_0x3162('0xc8')+_0x5917d1,'If-None-Match':null,'OData-Version':_0x3162('0xae')},'json':!![]};return rp(_0x2d756e)[_0x3162('0x1a')](function(_0x132dad){var _0x226fbb=[];_0x226fbb[_0x3162('0xb9')]({'name':_0x132dad['OptionSet'][_0x3162('0xd0')][_0x3162('0xcb')][_0x3162('0xca')]['Label'],'value':_0x3162('0xd1')},{'name':_0x132dad[_0x3162('0xd2')][_0x3162('0xd3')]['Label'][_0x3162('0xca')][_0x3162('0xcb')],'value':_0x3162('0xd4')});var _0x1c0509={'id':_0xae1ca4+'_'+_0x132dad[_0x3162('0xcd')],'name':_0x132dad[_0x3162('0xce')][_0x3162('0xca')][_0x3162('0xcb')],'custom':![],'options':_0x226fbb};_0x2f1e5a[_0x3162('0xb9')](_0x1c0509);return _0x2f1e5a;});}function getInputList(_0x2f1bc1,_0x42c65a,_0x32d406,_0x4201fc,_0x153f96,_0x12af5d,_0x2b1c74){var _0xe21720={'method':_0x3162('0xab'),'uri':_0x2f1bc1+_0x3162('0xac')+_0x153f96+_0x3162('0xc5')+_0x12af5d+_0x3162('0xd5')+_0x32d406+_0x3162('0xd6'),'headers':{'Authorization':'Bearer\x20'+_0x2b1c74,'If-None-Match':null,'OData-Version':_0x3162('0xae')},'json':!![]};return rp(_0xe21720)[_0x3162('0x1a')](function(_0x4ba147){var _0x40f4b5={'id':_0x42c65a+'_'+_0x4ba147[_0x3162('0xcd')],'name':_0x4ba147[_0x3162('0xce')][_0x3162('0xca')]?_0x4ba147[_0x3162('0xce')][_0x3162('0xca')]['Label']:_0x4ba147[_0x3162('0xcd')],'custom':![],'options':[]};_0x4201fc[_0x3162('0xb9')](_0x40f4b5);return _0x4201fc;});} \ No newline at end of file +var _0xeda8=['username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','Bearer\x20','4.0','value','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','concat','test','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','DisplayName','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','set','apply','end','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','options','create','body','update','find','params','destroy','getConfigurations','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','getFields','ticketType','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','slainvokedidname','slaname','statecode','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','versionnumber','findOne'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xeda8,0x104));var _0x8eda=function(_0x33f598,_0x5335b2){_0x33f598=_0x33f598-0x0;var _0x312618=_0xeda8[_0x33f598];return _0x312618;};'use strict';var pdf=require(_0x8eda('0x0'));var emlformat=require(_0x8eda('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8eda('0x2'));var jsonpatch=require(_0x8eda('0x3'));var rp=require(_0x8eda('0x4'));var moment=require(_0x8eda('0x5'));var BPromise=require(_0x8eda('0x6'));var Mustache=require(_0x8eda('0x7'));var util=require(_0x8eda('0x8'));var path=require(_0x8eda('0x9'));var sox=require(_0x8eda('0xa'));var csv=require(_0x8eda('0xb'));var ejs=require(_0x8eda('0xc'));var fs=require('fs');var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];var integrations=require(_0x8eda('0x18'));var jayson=require(_0x8eda('0x19'));var client=jayson[_0x8eda('0x1a')][_0x8eda('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x24ea76,_0x57957c,_0x500bd4,_0xe04d90){return new BPromise(function(_0x223dcf,_0x4fa040){var _0x106a04=_0xe04d90||client;return _0x106a04[_0x8eda('0x1c')](_0x24ea76,_0x500bd4)[_0x8eda('0x1d')](function(_0x56ff8a){logger[_0x8eda('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x57957c,_0x8eda('0x1f'));logger['debug'](_0x8eda('0x20'),_0x57957c,'request\x20sent',JSON[_0x8eda('0x21')](_0x56ff8a));if(_0x56ff8a[_0x8eda('0x22')]){if(_0x56ff8a['error']['code']===0x1f4){logger[_0x8eda('0x22')](_0x8eda('0x23'),_0x57957c,_0x56ff8a[_0x8eda('0x22')][_0x8eda('0x24')]);return _0x4fa040(_0x56ff8a[_0x8eda('0x22')][_0x8eda('0x24')]);}logger[_0x8eda('0x22')](_0x8eda('0x23'),_0x57957c,_0x56ff8a[_0x8eda('0x22')][_0x8eda('0x24')]);return _0x223dcf(_0x56ff8a[_0x8eda('0x22')]['message']);}else{logger[_0x8eda('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x57957c,_0x8eda('0x1f'));_0x223dcf(_0x56ff8a['result'][_0x8eda('0x24')]);}})[_0x8eda('0x25')](function(_0x4f3e0a){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x57957c,_0x4f3e0a);_0x4fa040(_0x4f3e0a);});});}function respondWithStatusCode(_0x2a4c99,_0x17cae8){_0x17cae8=_0x17cae8||0xcc;return function(_0x5be84f){if(_0x5be84f){return _0x2a4c99[_0x8eda('0x26')](_0x17cae8);}return _0x2a4c99[_0x8eda('0x27')](_0x17cae8)['end']();};}function respondWithResult(_0x25e955,_0xfa57ca){_0xfa57ca=_0xfa57ca||0xc8;return function(_0x24b1e1){if(_0x24b1e1){return _0x25e955[_0x8eda('0x27')](_0xfa57ca)[_0x8eda('0x28')](_0x24b1e1);}};}function respondWithFilteredResult(_0x5c8488,_0x41b5a9){return function(_0x5a8bed){if(_0x5a8bed){var _0x35310c=_0x5a8bed[_0x8eda('0x29')],_0x2e8b2b=_0x41b5a9[_0x8eda('0x2a')],_0x8337b4=_0x41b5a9[_0x8eda('0x2a')]+_0x41b5a9['limit'],_0x567f69;if(_0x8337b4>=_0x35310c){_0x8337b4=_0x35310c;_0x567f69=0xc8;}else{_0x567f69=0xce;}_0x5c8488[_0x8eda('0x27')](_0x567f69);return _0x5c8488[_0x8eda('0x2b')]('Content-Range',_0x2e8b2b+'-'+_0x8337b4+'/'+_0x35310c)[_0x8eda('0x28')](_0x5a8bed);}return null;};}function patchUpdates(_0x29e6f4){return function(_0x373ff6){try{jsonpatch[_0x8eda('0x2c')](_0x373ff6,_0x29e6f4,!![]);}catch(_0x53274e){return BPromise['reject'](_0x53274e);}return _0x373ff6['save']();};}function saveUpdates(_0x2611c6,_0x1c1cda){return function(_0x1ed3d3){if(_0x1ed3d3){return _0x1ed3d3['update'](_0x2611c6)['then'](function(_0x5b45c1){return _0x5b45c1;});}return null;};}function removeEntity(_0x244da0,_0x48d52d){return function(_0x31aaaf){if(_0x31aaaf){return _0x31aaaf['destroy']()['then'](function(){_0x244da0['status'](0xcc)[_0x8eda('0x2d')]();});}};}function handleEntityNotFound(_0x3e1431,_0x142f67){return function(_0x2a3cdc){if(!_0x2a3cdc){_0x3e1431[_0x8eda('0x26')](0x194);}return _0x2a3cdc;};}function handleError(_0x32fb2d,_0x38d663){_0x38d663=_0x38d663||0x1f4;return function(_0x2d4f9f){logger[_0x8eda('0x22')](_0x2d4f9f[_0x8eda('0x2e')]);if(_0x2d4f9f[_0x8eda('0x2f')]){delete _0x2d4f9f[_0x8eda('0x2f')];}_0x32fb2d[_0x8eda('0x27')](_0x38d663)[_0x8eda('0x30')](_0x2d4f9f);};}exports['index']=function(_0x986dbe,_0x2ed279){var _0x1af2af={},_0x4e3b81={},_0x5061a3={'count':0x0,'rows':[]};var _0x41c873=_[_0x8eda('0x31')](db[_0x8eda('0x32')][_0x8eda('0x33')],function(_0x5709a2){return{'name':_0x5709a2[_0x8eda('0x34')],'type':_0x5709a2[_0x8eda('0x35')][_0x8eda('0x36')]};});_0x4e3b81[_0x8eda('0x37')]=_[_0x8eda('0x31')](_0x41c873,_0x8eda('0x2f'));_0x4e3b81['query']=_[_0x8eda('0x38')](_0x986dbe[_0x8eda('0x39')]);_0x4e3b81[_0x8eda('0x3a')]=_[_0x8eda('0x3b')](_0x4e3b81[_0x8eda('0x37')],_0x4e3b81[_0x8eda('0x39')]);_0x1af2af['attributes']=_[_0x8eda('0x3b')](_0x4e3b81[_0x8eda('0x37')],qs[_0x8eda('0x3c')](_0x986dbe[_0x8eda('0x39')][_0x8eda('0x3c')]));_0x1af2af['attributes']=_0x1af2af[_0x8eda('0x3d')][_0x8eda('0x3e')]?_0x1af2af[_0x8eda('0x3d')]:_0x4e3b81['model'];if(!_0x986dbe[_0x8eda('0x39')]['hasOwnProperty'](_0x8eda('0x3f'))){_0x1af2af[_0x8eda('0x40')]=qs[_0x8eda('0x40')](_0x986dbe[_0x8eda('0x39')][_0x8eda('0x40')]);_0x1af2af['offset']=qs['offset'](_0x986dbe[_0x8eda('0x39')][_0x8eda('0x2a')]);}_0x1af2af[_0x8eda('0x41')]=qs[_0x8eda('0x42')](_0x986dbe[_0x8eda('0x39')][_0x8eda('0x42')]);_0x1af2af[_0x8eda('0x43')]=qs[_0x8eda('0x3a')](_[_0x8eda('0x44')](_0x986dbe[_0x8eda('0x39')],_0x4e3b81[_0x8eda('0x3a')]),_0x41c873);if(_0x986dbe[_0x8eda('0x39')][_0x8eda('0x45')]){_0x1af2af[_0x8eda('0x43')]=_[_0x8eda('0x46')](_0x1af2af[_0x8eda('0x43')],{'$or':_[_0x8eda('0x31')](_0x41c873,function(_0x106232){if(_0x106232[_0x8eda('0x35')]!=='VIRTUAL'){var _0x3711f8={};_0x3711f8[_0x106232[_0x8eda('0x2f')]]={'$like':'%'+_0x986dbe['query'][_0x8eda('0x45')]+'%'};return _0x3711f8;}})});}_0x1af2af=_[_0x8eda('0x46')]({},_0x1af2af,_0x986dbe['options']);var _0x289688={'where':_0x1af2af[_0x8eda('0x43')]};return db['Dynamics365Account'][_0x8eda('0x29')](_0x289688)[_0x8eda('0x1d')](function(_0x2a3546){_0x5061a3['count']=_0x2a3546;if(_0x986dbe[_0x8eda('0x39')][_0x8eda('0x47')]){_0x1af2af[_0x8eda('0x48')]=[{'all':!![]}];}return db[_0x8eda('0x32')][_0x8eda('0x49')](_0x1af2af);})[_0x8eda('0x1d')](function(_0x2ce641){_0x5061a3['rows']=_0x2ce641;return _0x5061a3;})[_0x8eda('0x1d')](respondWithFilteredResult(_0x2ed279,_0x1af2af))['catch'](handleError(_0x2ed279,null));};exports[_0x8eda('0x4a')]=function(_0x52b026,_0x1a64e8){var _0x4d9d76={'raw':![],'where':{'id':_0x52b026['params']['id']}},_0x4607c4={};_0x4607c4[_0x8eda('0x37')]=_[_0x8eda('0x38')](db[_0x8eda('0x32')][_0x8eda('0x33')]);_0x4607c4[_0x8eda('0x39')]=_[_0x8eda('0x38')](_0x52b026[_0x8eda('0x39')]);_0x4607c4[_0x8eda('0x3a')]=_[_0x8eda('0x3b')](_0x4607c4[_0x8eda('0x37')],_0x4607c4[_0x8eda('0x39')]);_0x4d9d76[_0x8eda('0x3d')]=_['intersection'](_0x4607c4[_0x8eda('0x37')],qs[_0x8eda('0x3c')](_0x52b026[_0x8eda('0x39')][_0x8eda('0x3c')]));_0x4d9d76[_0x8eda('0x3d')]=_0x4d9d76[_0x8eda('0x3d')][_0x8eda('0x3e')]?_0x4d9d76[_0x8eda('0x3d')]:_0x4607c4[_0x8eda('0x37')];if(_0x52b026[_0x8eda('0x39')][_0x8eda('0x47')]){_0x4d9d76[_0x8eda('0x48')]=[{'all':!![]}];}_0x4d9d76=_[_0x8eda('0x46')]({},_0x4d9d76,_0x52b026[_0x8eda('0x4b')]);return db[_0x8eda('0x32')]['find'](_0x4d9d76)[_0x8eda('0x1d')](handleEntityNotFound(_0x1a64e8,null))[_0x8eda('0x1d')](respondWithResult(_0x1a64e8,null))[_0x8eda('0x25')](handleError(_0x1a64e8,null));};exports[_0x8eda('0x4c')]=function(_0x1a6bde,_0x8a172a){return db['Dynamics365Account'][_0x8eda('0x4c')](_0x1a6bde[_0x8eda('0x4d')],{})[_0x8eda('0x1d')](respondWithResult(_0x8a172a,0xc9))['catch'](handleError(_0x8a172a,null));};exports[_0x8eda('0x4e')]=function(_0x4d4e78,_0x3d16b4){if(_0x4d4e78[_0x8eda('0x4d')]['id']){delete _0x4d4e78[_0x8eda('0x4d')]['id'];}return db['Dynamics365Account'][_0x8eda('0x4f')]({'where':{'id':_0x4d4e78[_0x8eda('0x50')]['id']}})[_0x8eda('0x1d')](handleEntityNotFound(_0x3d16b4,null))['then'](saveUpdates(_0x4d4e78[_0x8eda('0x4d')],null))[_0x8eda('0x1d')](respondWithResult(_0x3d16b4,null))[_0x8eda('0x25')](handleError(_0x3d16b4,null));};exports[_0x8eda('0x51')]=function(_0xc7bc6a,_0x26aa9b){return db[_0x8eda('0x32')][_0x8eda('0x4f')]({'where':{'id':_0xc7bc6a[_0x8eda('0x50')]['id']}})[_0x8eda('0x1d')](handleEntityNotFound(_0x26aa9b,null))['then'](removeEntity(_0x26aa9b,null))[_0x8eda('0x25')](handleError(_0x26aa9b,null));};exports[_0x8eda('0x52')]=function(_0x4c137a,_0x709b8,_0x54df94){var _0x5f51fc={};var _0x4a3e61={};var _0x4a26af;var _0x4b24e1;return db[_0x8eda('0x32')]['findOne']({'where':{'id':_0x4c137a[_0x8eda('0x50')]['id']}})[_0x8eda('0x1d')](handleEntityNotFound(_0x709b8,null))[_0x8eda('0x1d')](function(_0x3298fa){if(_0x3298fa){_0x4a26af=_0x3298fa;_0x4a3e61[_0x8eda('0x37')]=_[_0x8eda('0x38')](db[_0x8eda('0x53')]['rawAttributes']);_0x4a3e61[_0x8eda('0x39')]=_['keys'](_0x4c137a[_0x8eda('0x39')]);_0x4a3e61['filters']=_[_0x8eda('0x3b')](_0x4a3e61['model'],_0x4a3e61[_0x8eda('0x39')]);_0x5f51fc[_0x8eda('0x3d')]=_[_0x8eda('0x3b')](_0x4a3e61['model'],qs['fields'](_0x4c137a['query'][_0x8eda('0x3c')]));_0x5f51fc[_0x8eda('0x3d')]=_0x5f51fc['attributes'][_0x8eda('0x3e')]?_0x5f51fc['attributes']:_0x4a3e61['model'];_0x5f51fc[_0x8eda('0x41')]=qs[_0x8eda('0x42')](_0x4c137a[_0x8eda('0x39')][_0x8eda('0x42')]);_0x5f51fc['where']=qs['filters'](_[_0x8eda('0x44')](_0x4c137a[_0x8eda('0x39')],_0x4a3e61[_0x8eda('0x3a')]));if(_0x4c137a[_0x8eda('0x39')]['filter']){_0x5f51fc[_0x8eda('0x43')]=_['merge'](_0x5f51fc[_0x8eda('0x43')],{'$or':_['map'](_0x5f51fc[_0x8eda('0x3d')],function(_0x585cf2){var _0x437d35={};_0x437d35[_0x585cf2]={'$like':'%'+_0x4c137a[_0x8eda('0x39')][_0x8eda('0x45')]+'%'};return _0x437d35;})});}_0x5f51fc=_[_0x8eda('0x46')]({},_0x5f51fc,_0x4c137a[_0x8eda('0x4b')]);return _0x4a26af[_0x8eda('0x52')](_0x5f51fc);}})[_0x8eda('0x1d')](function(_0x1dfb4f){if(_0x1dfb4f){_0x4b24e1=_0x1dfb4f[_0x8eda('0x3e')];if(!_0x4c137a['query']['hasOwnProperty'](_0x8eda('0x3f'))){_0x5f51fc['limit']=qs[_0x8eda('0x40')](_0x4c137a[_0x8eda('0x39')][_0x8eda('0x40')]);_0x5f51fc[_0x8eda('0x2a')]=qs[_0x8eda('0x2a')](_0x4c137a['query']['offset']);}return _0x4a26af[_0x8eda('0x52')](_0x5f51fc);}})[_0x8eda('0x1d')](function(_0x423df5){if(_0x423df5){return _0x423df5?{'count':_0x4b24e1,'rows':_0x423df5}:null;}})[_0x8eda('0x1d')](respondWithResult(_0x709b8,null))[_0x8eda('0x25')](handleError(_0x709b8,null));};exports[_0x8eda('0x54')]=function(_0x10cda2,_0x55ead4,_0x283dca){if(_0x10cda2[_0x8eda('0x4d')]['id']){delete _0x10cda2['body']['id'];}return db[_0x8eda('0x32')]['findOne']({'where':{'id':_0x10cda2['params']['id']}})['then'](handleEntityNotFound(_0x55ead4,null))['then'](function(_0x1e6e86){if(_0x1e6e86){_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x55')]=_0x1e6e86['id'];_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x56')]=integrations[_0x8eda('0x57')](_0x10cda2['body'][_0x8eda('0x58')],_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x35')]);_0x10cda2[_0x8eda('0x4d')]['Descriptions']=integrations[_0x8eda('0x59')](_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x58')],_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x35')]);return db[_0x8eda('0x53')]['create'](_0x10cda2[_0x8eda('0x4d')],{'include':[{'model':db[_0x8eda('0x5a')],'as':_0x8eda('0x56')},{'model':db[_0x8eda('0x5a')],'as':_0x8eda('0x5b')}]});}return null;})[_0x8eda('0x1d')](respondWithResult(_0x55ead4,null))[_0x8eda('0x25')](handleError(_0x55ead4,null));};exports[_0x8eda('0x5c')]=function(_0x3119bc,_0x168e6c,_0x2bdceb){var _0xd84c42=_0x3119bc[_0x8eda('0x39')][_0x8eda('0x5d')];var _0x53d7da=_0xd84c42==='incident'?_0x8eda('0x5e'):_0x8eda('0x5f');var _0x1b43c0='';var _0x32db8b='';var _0x57e032='';var _0x23d64f='';var _0x306a0a='';var _0x5de432='';var _0x162c2f='';var _0x5f0d26='';var _0x415813=[_0x8eda('0x60'),_0x8eda('0x61'),'customerid',_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x64'),'phonenumber',_0x8eda('0x65'),_0x8eda('0x66'),_0x8eda('0x67')];var _0x2f30af=['accountidname','accountidyominame',_0x8eda('0x68'),_0x8eda('0x69'),_0x8eda('0x6a'),_0x8eda('0x6b'),'contractdetailidname',_0x8eda('0x6c'),_0x8eda('0x6d'),_0x8eda('0x6e'),_0x8eda('0x6f'),_0x8eda('0x70'),'createdon',_0x8eda('0x71'),_0x8eda('0x72'),_0x8eda('0x73'),'customeridtype','customeridyominame','emailaddress',_0x8eda('0x74'),_0x8eda('0x75'),_0x8eda('0x76'),_0x8eda('0x77'),_0x8eda('0x78'),_0x8eda('0x79'),_0x8eda('0x7a'),_0x8eda('0x7b'),'influencescore',_0x8eda('0x7c'),_0x8eda('0x7d'),_0x8eda('0x7e'),'modifiedbyexternalpartyname',_0x8eda('0x7f'),_0x8eda('0x80'),_0x8eda('0x81'),_0x8eda('0x82'),_0x8eda('0x83'),_0x8eda('0x84'),_0x8eda('0x85'),_0x8eda('0x86'),_0x8eda('0x87'),_0x8eda('0x88'),_0x8eda('0x89'),'owneridname',_0x8eda('0x8a'),_0x8eda('0x8b'),_0x8eda('0x8c'),_0x8eda('0x8d'),_0x8eda('0x8e'),_0x8eda('0x8f'),_0x8eda('0x90'),_0x8eda('0x91'),_0x8eda('0x92'),_0x8eda('0x93'),_0x8eda('0x94'),'responsiblecontactidname','responsiblecontactidyominame','sentimentvalue',_0x8eda('0x95'),_0x8eda('0x96'),'socialprofileidname',_0x8eda('0x97'),_0x8eda('0x98'),_0x8eda('0x99'),'ticketnumber',_0x8eda('0x9a'),'transactioncurrencyidname',_0x8eda('0x9b'),'utcconversiontimezonecode',_0x8eda('0x9c')];var _0x2f8b54=_0x415813['concat'](_0x2f30af);return db[_0x8eda('0x32')][_0x8eda('0x9d')]({'where':{'id':_0x3119bc[_0x8eda('0x50')]['id']},'attributes':['id',_0x8eda('0x9e'),_0x8eda('0x9f'),_0x8eda('0xa0'),_0x8eda('0xa1'),_0x8eda('0xa2'),_0x8eda('0xa3')]})[_0x8eda('0x1d')](handleEntityNotFound(_0x168e6c,null))['then'](function(_0x5e7f48){if(_0x5e7f48){_0x5f0d26=_0x5e7f48['remoteUri'];var _0x5b64c8=_0x5f0d26[_0x8eda('0xa4')](-0x1);if(_0x5b64c8==='/'){_0x5f0d26=_0x5f0d26[_0x8eda('0xa5')](0x0,_0x5f0d26[_0x8eda('0xa6')](_0x5b64c8));}_0x162c2f=util['format'](_0x8eda('0xa7'),_0x5f0d26);var _0x344150={'method':_0x8eda('0xa8'),'uri':_0x8eda('0xa9')+_0x5e7f48[_0x8eda('0xa1')]+_0x8eda('0xaa'),'form':{'client_id':_0x5e7f48[_0x8eda('0xa2')],'resource':_0x5f0d26,'username':_0x5e7f48[_0x8eda('0x9e')],'password':_0x5e7f48['password'],'grant_type':'password','client_secret':_0x5e7f48[_0x8eda('0xa3')]},'json':!![]};return rp(_0x344150);}})[_0x8eda('0x1d')](function(_0x570cd6){_0x5de432=_0x570cd6[_0x8eda('0xab')];var _0x27b68d={'method':_0x8eda('0xac'),'uri':encodeURI(_0x162c2f+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x53d7da+'\x27'),'headers':{'Authorization':_0x8eda('0xad')+_0x5de432,'If-None-Match':null,'OData-Version':_0x8eda('0xae')},'json':!![]};return rp(_0x27b68d);})[_0x8eda('0x1d')](function(_0x1838b1){var _0x1edd9f=_0x1838b1[_0x8eda('0xaf')][0x0];var _0x2480b2=_0x1edd9f['MetadataId'];var _0x11f9e4={'method':_0x8eda('0xac'),'uri':_0x162c2f+'EntityDefinitions('+_0x2480b2+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x5de432,'If-None-Match':null,'OData-Version':_0x8eda('0xae')},'json':!![]};return rp(_0x11f9e4);})[_0x8eda('0x1d')](function(_0x3a6a49){_0x1b43c0=_0x3a6a49;_0x32db8b=_0x1b43c0[_0x8eda('0xb0')];_0x32db8b=_[_0x8eda('0xb1')](_0x32db8b,function(_0x1ebc2b){return!_0x2f8b54[_0x8eda('0xb2')](_0x1ebc2b[_0x8eda('0xb3')]);});var _0x143d8d=[];var _0x1a3993=[];_0x32db8b[_0x8eda('0xb4')](function(_0x3ebd70){if(_0x3ebd70[_0x8eda('0xb5')]){var _0x3a386e=_0x3ebd70['@odata.type'][_0x8eda('0xa5')](_0x3ebd70[_0x8eda('0xb5')][_0x8eda('0xa6')]('.')+0x1);if(_0x3a386e===_0x8eda('0xb6')){_0x143d8d['push'](getSelectList(_0x162c2f,_0xd84c42,_0x1a3993,_0x1b43c0[_0x8eda('0xb7')],_0x3ebd70[_0x8eda('0xb7')],_0x5de432));}}});return Promise[_0x8eda('0xb8')](_0x143d8d);})[_0x8eda('0x1d')](function(_0x4732be){_0x57e032=_0x4732be[0x0];var _0x59690b=[];var _0x447936=[];_0x32db8b[_0x8eda('0xb4')](function(_0x45c8d1){if(!_[_0x8eda('0xb9')](_0x45c8d1['@odata.type'])){var _0x5069ff=_0x45c8d1[_0x8eda('0xb5')][_0x8eda('0xa5')](_0x45c8d1[_0x8eda('0xb5')][_0x8eda('0xa6')]('.')+0x1);if(_0x5069ff==='BooleanAttributeMetadata'){_0x59690b[_0x8eda('0xba')](getBooleanList(_0x162c2f,_0xd84c42,_0x447936,_0x1b43c0[_0x8eda('0xb7')],_0x45c8d1[_0x8eda('0xb7')],_0x5de432));}}});return Promise[_0x8eda('0xb8')](_0x59690b);})[_0x8eda('0x1d')](function(_0x3c26ba){_0x23d64f=_0x3c26ba[0x0];var _0x9edfd9=[];var _0x302329=[];_0x32db8b['forEach'](function(_0x25920d){if(_0x25920d[_0x8eda('0xb5')]){var _0x1e8ac4=_0x25920d[_0x8eda('0xb5')][_0x8eda('0xa5')](_0x25920d[_0x8eda('0xb5')][_0x8eda('0xa6')]('.')+0x1);if(_0x1e8ac4===_0x8eda('0xbb')||_0x1e8ac4===_0x8eda('0xbc')||_0x1e8ac4===_0x8eda('0xbd')||_0x1e8ac4==='IntegerAttributeMetadata'||_0x1e8ac4===_0x8eda('0xbe')||_0x1e8ac4===_0x8eda('0xbf')||_0x1e8ac4===_0x8eda('0xc0')||_0x1e8ac4==='EntityNameAttributeMetadata'||_0x1e8ac4===_0x8eda('0xc1')||_0x1e8ac4==='DecimalAttributeMetadata'){_0x9edfd9['push'](getInputList(_0x162c2f,_0xd84c42,_0x1e8ac4,_0x302329,_0x1b43c0['MetadataId'],_0x25920d[_0x8eda('0xb7')],_0x5de432));}}});return Promise[_0x8eda('0xb8')](_0x9edfd9);})['then'](function(_0x3923a5){_0x306a0a=_0x3923a5[0x0];var _0x2f19f9=_0x57e032['concat'](_0x23d64f)[_0x8eda('0xc2')](_0x306a0a);var _0x16860f={'count':_0x2f19f9['length'],'rows':_0x2f19f9};return _0x16860f;})['then'](respondWithResult(_0x168e6c,null))[_0x8eda('0x25')](function(_0x56279b){var _0x4e9522=_0x3119bc[_0x8eda('0x39')][_0x8eda('0xc3')]?0x1f4:_0x56279b['statusCode']||0x1f4;logger[_0x8eda('0x22')](_0x56279b[_0x8eda('0x2e')]);delete _0x56279b[_0x8eda('0x2f')];if(_0x4e9522===0x191){_0x4e9522=0x190;}_0x168e6c['status'](_0x4e9522)['send'](_0x3119bc[_0x8eda('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x56279b['statusCode']}:_0x56279b);});};function getSelectList(_0x35ece0,_0x5872c0,_0x7c3b4d,_0x465543,_0x44072b,_0x14ad01){var _0x2cfbd3={'method':_0x8eda('0xac'),'uri':_0x35ece0+_0x8eda('0xc4')+_0x465543+_0x8eda('0xc5')+_0x44072b+_0x8eda('0xc6')+_0x8eda('0xc7'),'headers':{'Authorization':'Bearer\x20'+_0x14ad01,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2cfbd3)[_0x8eda('0x1d')](function(_0x5dbfe4){var _0x2c3a82=[];var _0xa32ffb=_0x5dbfe4[_0x8eda('0xc8')][_0x8eda('0xc9')];_0xa32ffb[_0x8eda('0xb4')](function(_0x183bf7){_0x2c3a82[_0x8eda('0xba')]({'name':_0x183bf7['Label'][_0x8eda('0xca')][_0x8eda('0xcb')],'value':String(_0x183bf7['Value'])});});var _0xae066e={'id':_0x5872c0+'_'+_0x5dbfe4[_0x8eda('0xb3')],'name':_0x5dbfe4[_0x8eda('0xcc')][_0x8eda('0xca')][_0x8eda('0xcb')],'custom':![],'options':_0x2c3a82};_0x7c3b4d['push'](_0xae066e);return _0x7c3b4d;});}function getBooleanList(_0x1aa058,_0x4997aa,_0x38c2ab,_0x236587,_0x58f1be,_0x4f26fc){var _0x1078c1={'method':_0x8eda('0xac'),'uri':_0x1aa058+_0x8eda('0xc4')+_0x236587+_0x8eda('0xc5')+_0x58f1be+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x4f26fc,'If-None-Match':null,'OData-Version':_0x8eda('0xae')},'json':!![]};return rp(_0x1078c1)[_0x8eda('0x1d')](function(_0x260c57){var _0x12b779=[];_0x12b779[_0x8eda('0xba')]({'name':_0x260c57[_0x8eda('0xc8')][_0x8eda('0xcd')]['Label']['UserLocalizedLabel'][_0x8eda('0xcb')],'value':'true'},{'name':_0x260c57['OptionSet'][_0x8eda('0xce')][_0x8eda('0xcb')][_0x8eda('0xca')][_0x8eda('0xcb')],'value':'false'});var _0xeb7a8d={'id':_0x4997aa+'_'+_0x260c57[_0x8eda('0xb3')],'name':_0x260c57[_0x8eda('0xcc')][_0x8eda('0xca')][_0x8eda('0xcb')],'custom':![],'options':_0x12b779};_0x38c2ab[_0x8eda('0xba')](_0xeb7a8d);return _0x38c2ab;});}function getInputList(_0x1514ee,_0xa74ba2,_0x1db309,_0x165d3b,_0x34986c,_0x235000,_0x2b4b2c){var _0x629d00={'method':_0x8eda('0xac'),'uri':_0x1514ee+_0x8eda('0xc4')+_0x34986c+_0x8eda('0xc5')+_0x235000+_0x8eda('0xcf')+_0x1db309+_0x8eda('0xd0'),'headers':{'Authorization':'Bearer\x20'+_0x2b4b2c,'If-None-Match':null,'OData-Version':_0x8eda('0xae')},'json':!![]};return rp(_0x629d00)['then'](function(_0x28b300){var _0x3222fd={'id':_0xa74ba2+'_'+_0x28b300[_0x8eda('0xb3')],'name':_0x28b300[_0x8eda('0xcc')][_0x8eda('0xca')]?_0x28b300[_0x8eda('0xcc')][_0x8eda('0xca')]['Label']:_0x28b300[_0x8eda('0xb3')],'custom':![],'options':[]};_0x165d3b[_0x8eda('0xba')](_0x3222fd);return _0x165d3b;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 93845e2..eacf641 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9793=['Dynamics365Account','util','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x5f3a14,_0x5a904d){var _0x1edbd6=function(_0x9ea1f4){while(--_0x9ea1f4){_0x5f3a14['push'](_0x5f3a14['shift']());}};_0x1edbd6(++_0x5a904d);}(_0x9793,0x133));var _0x3979=function(_0x419d48,_0x1a3672){_0x419d48=_0x419d48-0x0;var _0x41b11a=_0x9793[_0x419d48];return _0x41b11a;};'use strict';var _=require('lodash');var util=require(_0x3979('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3979('0x1'));var rp=require(_0x3979('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3979('0x3'));var config=require(_0x3979('0x4'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x3979('0x5'));module[_0x3979('0x6')]=function(_0x324d6f,_0x24006f){return _0x324d6f[_0x3979('0x7')](_0x3979('0x8'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x697a=['util','api','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash'];(function(_0x34d14b,_0x27ab8a){var _0x1a010c=function(_0x436233){while(--_0x436233){_0x34d14b['push'](_0x34d14b['shift']());}};_0x1a010c(++_0x27ab8a);}(_0x697a,0x13e));var _0xa697=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x697a[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xa697('0x0'));var util=require(_0xa697('0x1'));var logger=require('../../config/logger')(_0xa697('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa697('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa697('0x4'));var config=require(_0xa697('0x5'));var attributes=require(_0xa697('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xa697('0x7')]=function(_0x429c84,_0x457da9){return _0x429c84[_0xa697('0x8')](_0xa697('0x9'),attributes,{'tableName':_0xa697('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index fbe7916..3a30639 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.rpc.js +++ b/server/api/intDynamics365Account/intDynamics365Account.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13fe=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','catch','GetDynamics365Account','ShowDynamics365Account','find','lodash','util','moment'];(function(_0x529709,_0x2dc916){var _0x18feee=function(_0x573ea2){while(--_0x573ea2){_0x529709['push'](_0x529709['shift']());}};_0x18feee(++_0x2dc916);}(_0x13fe,0x138));var _0xe13f=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x13fe[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xe13f('0x0'));var util=require(_0xe13f('0x1'));var moment=require(_0xe13f('0x2'));var BPromise=require(_0xe13f('0x3'));var rs=require(_0xe13f('0x4'));var fs=require('fs');var Redis=require(_0xe13f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe13f('0x6'));var logger=require(_0xe13f('0x7'))(_0xe13f('0x8'));var config=require(_0xe13f('0x9'));var jayson=require(_0xe13f('0xa'));var client=jayson[_0xe13f('0xb')][_0xe13f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x594e3b,_0x5c9bee,_0x1b237d){return new BPromise(function(_0x39a413,_0x4e209c){return client['request'](_0x594e3b,_0x1b237d)[_0xe13f('0xd')](function(_0x470c1e){logger['info'](_0xe13f('0xe'),_0x5c9bee,_0xe13f('0xf'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5c9bee,_0xe13f('0xf'),JSON[_0xe13f('0x10')](_0x470c1e));if(_0x470c1e['error']){if(_0x470c1e['error'][_0xe13f('0x11')]===0x1f4){logger[_0xe13f('0x12')](_0xe13f('0xe'),_0x5c9bee,_0x470c1e[_0xe13f('0x12')][_0xe13f('0x13')]);return _0x4e209c(_0x470c1e['error'][_0xe13f('0x13')]);}logger[_0xe13f('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x5c9bee,_0x470c1e[_0xe13f('0x12')][_0xe13f('0x13')]);return _0x39a413(_0x470c1e['error'][_0xe13f('0x13')]);}else{logger[_0xe13f('0x14')](_0xe13f('0xe'),_0x5c9bee,_0xe13f('0xf'));_0x39a413(_0x470c1e[_0xe13f('0x15')][_0xe13f('0x13')]);}})['catch'](function(_0x1ae44a){logger['error'](_0xe13f('0xe'),_0x5c9bee,_0x1ae44a);_0x4e209c(_0x1ae44a);});});}exports['GetDynamics365Account']=function(_0x28770d){var _0x5b01d7=this;return new Promise(function(_0x39852b,_0x3f4c0b){return db[_0xe13f('0x16')][_0xe13f('0x17')]({'raw':_0x28770d[_0xe13f('0x18')]?_0x28770d[_0xe13f('0x18')][_0xe13f('0x19')]===undefined?!![]:![]:!![],'where':_0x28770d[_0xe13f('0x18')]?_0x28770d['options']['where']||null:null,'attributes':_0x28770d[_0xe13f('0x18')]?_0x28770d[_0xe13f('0x18')][_0xe13f('0x1a')]||null:null,'limit':_0x28770d[_0xe13f('0x18')]?_0x28770d[_0xe13f('0x18')][_0xe13f('0x1b')]||null:null,'include':_0x28770d[_0xe13f('0x18')]?_0x28770d['options'][_0xe13f('0x1c')]?_[_0xe13f('0x1d')](_0x28770d[_0xe13f('0x18')][_0xe13f('0x1c')],function(_0x415adf){return{'model':db[_0x415adf[_0xe13f('0x1e')]],'as':_0x415adf['as'],'attributes':_0x415adf['attributes'],'include':_0x415adf[_0xe13f('0x1c')]?_[_0xe13f('0x1d')](_0x415adf[_0xe13f('0x1c')],function(_0x37eff0){return{'model':db[_0x37eff0['model']],'as':_0x37eff0['as'],'attributes':_0x37eff0[_0xe13f('0x1a')],'include':_0x37eff0[_0xe13f('0x1c')]?_['map'](_0x37eff0['include'],function(_0x35d1f0){return{'model':db[_0x35d1f0[_0xe13f('0x1e')]],'as':_0x35d1f0['as'],'attributes':_0x35d1f0[_0xe13f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe13f('0xd')](function(_0x213480){logger[_0xe13f('0x14')]('GetDynamics365Account',_0x28770d);logger['debug']('GetDynamics365Account',_0x28770d,JSON[_0xe13f('0x10')](_0x213480));_0x39852b(_0x213480);})[_0xe13f('0x1f')](function(_0x1bf59c){logger[_0xe13f('0x12')](_0xe13f('0x20'),_0x1bf59c[_0xe13f('0x13')],_0x28770d);_0x3f4c0b(_0x5b01d7[_0xe13f('0x12')](0x1f4,_0x1bf59c[_0xe13f('0x13')]));});});};exports[_0xe13f('0x21')]=function(_0x156cbd){var _0x33a373=this;return new Promise(function(_0x58abe7,_0x3f9cf9){return db[_0xe13f('0x16')][_0xe13f('0x22')]({'raw':_0x156cbd['options']?_0x156cbd['options'][_0xe13f('0x19')]===undefined?!![]:![]:!![],'where':_0x156cbd[_0xe13f('0x18')]?_0x156cbd['options']['where']||null:null,'attributes':_0x156cbd[_0xe13f('0x18')]?_0x156cbd[_0xe13f('0x18')][_0xe13f('0x1a')]||null:null,'include':_0x156cbd['options']?_0x156cbd[_0xe13f('0x18')][_0xe13f('0x1c')]?_[_0xe13f('0x1d')](_0x156cbd[_0xe13f('0x18')][_0xe13f('0x1c')],function(_0x434dcb){return{'model':db[_0x434dcb[_0xe13f('0x1e')]],'as':_0x434dcb['as'],'attributes':_0x434dcb[_0xe13f('0x1a')],'include':_0x434dcb['include']?_['map'](_0x434dcb[_0xe13f('0x1c')],function(_0x1d696c){return{'model':db[_0x1d696c['model']],'as':_0x1d696c['as'],'attributes':_0x1d696c[_0xe13f('0x1a')],'include':_0x1d696c[_0xe13f('0x1c')]?_[_0xe13f('0x1d')](_0x1d696c[_0xe13f('0x1c')],function(_0x265561){return{'model':db[_0x265561[_0xe13f('0x1e')]],'as':_0x265561['as'],'attributes':_0x265561[_0xe13f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d7075){logger[_0xe13f('0x14')](_0xe13f('0x21'),_0x156cbd);logger['debug']('ShowDynamics365Account',_0x156cbd,JSON['stringify'](_0x5d7075));_0x58abe7(_0x5d7075);})[_0xe13f('0x1f')](function(_0x2647e0){logger[_0xe13f('0x12')](_0xe13f('0x21'),_0x2647e0[_0xe13f('0x13')],_0x156cbd);_0x3f9cf9(_0x33a373['error'](0x1f4,_0x2647e0[_0xe13f('0x13')]));});});}; \ No newline at end of file +var _0x9c48=['http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','limit','include','model','attributes','map','GetDynamics365Account','ShowDynamics365Account','Dynamics365Account','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x3b7820,_0x3aade4){var _0x4dc4a2=function(_0x5e08e4){while(--_0x5e08e4){_0x3b7820['push'](_0x3b7820['shift']());}};_0x4dc4a2(++_0x3aade4);}(_0x9c48,0xa1));var _0x89c4=function(_0xc9619c,_0x448ed3){_0xc9619c=_0xc9619c-0x0;var _0x3058aa=_0x9c48[_0xc9619c];return _0x3058aa;};'use strict';var _=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var moment=require(_0x89c4('0x2'));var BPromise=require('bluebird');var rs=require(_0x89c4('0x3'));var fs=require('fs');var Redis=require(_0x89c4('0x4'));var db=require(_0x89c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x89c4('0x6'));var config=require(_0x89c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x89c4('0x8')][_0x89c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d0303,_0x213a86,_0x30cdf1){return new BPromise(function(_0x7faf5,_0x26ab92){return client[_0x89c4('0xa')](_0x1d0303,_0x30cdf1)[_0x89c4('0xb')](function(_0xad4f2c){logger[_0x89c4('0xc')](_0x89c4('0xd'),_0x213a86,_0x89c4('0xe'));logger[_0x89c4('0xf')](_0x89c4('0x10'),_0x213a86,_0x89c4('0xe'),JSON[_0x89c4('0x11')](_0xad4f2c));if(_0xad4f2c[_0x89c4('0x12')]){if(_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x13')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x213a86,_0xad4f2c['error'][_0x89c4('0x14')]);return _0x26ab92(_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x14')]);}logger[_0x89c4('0x12')](_0x89c4('0xd'),_0x213a86,_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x14')]);return _0x7faf5(_0xad4f2c['error'][_0x89c4('0x14')]);}else{logger[_0x89c4('0xc')](_0x89c4('0xd'),_0x213a86,_0x89c4('0xe'));_0x7faf5(_0xad4f2c['result'][_0x89c4('0x14')]);}})[_0x89c4('0x15')](function(_0xae1ed7){logger['error'](_0x89c4('0xd'),_0x213a86,_0xae1ed7);_0x26ab92(_0xae1ed7);});});}exports['GetDynamics365Account']=function(_0x29342c){var _0x477a19=this;return new Promise(function(_0x574f49,_0x456cf2){return db['Dynamics365Account']['findAll']({'raw':_0x29342c[_0x89c4('0x16')]?_0x29342c[_0x89c4('0x16')][_0x89c4('0x17')]===undefined?!![]:![]:!![],'where':_0x29342c['options']?_0x29342c[_0x89c4('0x16')]['where']||null:null,'attributes':_0x29342c[_0x89c4('0x16')]?_0x29342c[_0x89c4('0x16')]['attributes']||null:null,'limit':_0x29342c[_0x89c4('0x16')]?_0x29342c[_0x89c4('0x16')][_0x89c4('0x18')]||null:null,'include':_0x29342c[_0x89c4('0x16')]?_0x29342c[_0x89c4('0x16')][_0x89c4('0x19')]?_['map'](_0x29342c[_0x89c4('0x16')][_0x89c4('0x19')],function(_0x59e8ee){return{'model':db[_0x59e8ee[_0x89c4('0x1a')]],'as':_0x59e8ee['as'],'attributes':_0x59e8ee[_0x89c4('0x1b')],'include':_0x59e8ee[_0x89c4('0x19')]?_[_0x89c4('0x1c')](_0x59e8ee[_0x89c4('0x19')],function(_0xa739bd){return{'model':db[_0xa739bd['model']],'as':_0xa739bd['as'],'attributes':_0xa739bd[_0x89c4('0x1b')],'include':_0xa739bd[_0x89c4('0x19')]?_[_0x89c4('0x1c')](_0xa739bd[_0x89c4('0x19')],function(_0x17c9f9){return{'model':db[_0x17c9f9[_0x89c4('0x1a')]],'as':_0x17c9f9['as'],'attributes':_0x17c9f9[_0x89c4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x89c4('0xb')](function(_0x256b9f){logger[_0x89c4('0xc')](_0x89c4('0x1d'),_0x29342c);logger[_0x89c4('0xf')](_0x89c4('0x1d'),_0x29342c,JSON[_0x89c4('0x11')](_0x256b9f));_0x574f49(_0x256b9f);})['catch'](function(_0x5e9b35){logger[_0x89c4('0x12')]('GetDynamics365Account',_0x5e9b35[_0x89c4('0x14')],_0x29342c);_0x456cf2(_0x477a19[_0x89c4('0x12')](0x1f4,_0x5e9b35[_0x89c4('0x14')]));});});};exports[_0x89c4('0x1e')]=function(_0x2c732a){var _0x24f61e=this;return new Promise(function(_0x35c1fb,_0x107222){return db[_0x89c4('0x1f')][_0x89c4('0x20')]({'raw':_0x2c732a[_0x89c4('0x16')]?_0x2c732a['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c732a['options']?_0x2c732a[_0x89c4('0x16')][_0x89c4('0x21')]||null:null,'attributes':_0x2c732a[_0x89c4('0x16')]?_0x2c732a[_0x89c4('0x16')][_0x89c4('0x1b')]||null:null,'include':_0x2c732a[_0x89c4('0x16')]?_0x2c732a[_0x89c4('0x16')][_0x89c4('0x19')]?_[_0x89c4('0x1c')](_0x2c732a[_0x89c4('0x16')][_0x89c4('0x19')],function(_0x7ed242){return{'model':db[_0x7ed242['model']],'as':_0x7ed242['as'],'attributes':_0x7ed242[_0x89c4('0x1b')],'include':_0x7ed242['include']?_['map'](_0x7ed242[_0x89c4('0x19')],function(_0x2f92b0){return{'model':db[_0x2f92b0[_0x89c4('0x1a')]],'as':_0x2f92b0['as'],'attributes':_0x2f92b0[_0x89c4('0x1b')],'include':_0x2f92b0[_0x89c4('0x19')]?_['map'](_0x2f92b0[_0x89c4('0x19')],function(_0x140680){return{'model':db[_0x140680[_0x89c4('0x1a')]],'as':_0x140680['as'],'attributes':_0x140680['attributes']};}):[]};}):[]};}):[]:[]})[_0x89c4('0xb')](function(_0x483239){logger[_0x89c4('0xc')](_0x89c4('0x1e'),_0x2c732a);logger[_0x89c4('0xf')](_0x89c4('0x1e'),_0x2c732a,JSON[_0x89c4('0x11')](_0x483239));_0x35c1fb(_0x483239);})[_0x89c4('0x15')](function(_0x941071){logger[_0x89c4('0x12')](_0x89c4('0x1e'),_0x941071[_0x89c4('0x14')],_0x2c732a);_0x107222(_0x24f61e[_0x89c4('0x12')](0x1f4,_0x941071[_0x89c4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 56a6bef..2b2cefc 100644 --- a/server/api/intDynamics365Configuration/index.js +++ b/server/api/intDynamics365Configuration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd512=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getDescriptions','post','create','put','update','delete','/:id','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd512,0x171));var _0x2d51=function(_0x50c1c1,_0x4d5063){_0x50c1c1=_0x50c1c1-0x0;var _0xba0564=_0xd512[_0x50c1c1];return _0xba0564;};'use strict';var multer=require(_0x2d51('0x0'));var util=require('util');var path=require(_0x2d51('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d51('0x2'));var router=express[_0x2d51('0x3')]();var auth=require(_0x2d51('0x4'));var interaction=require(_0x2d51('0x5'));var config=require(_0x2d51('0x6'));var controller=require(_0x2d51('0x7'));router[_0x2d51('0x8')]('/',auth[_0x2d51('0x9')](),controller[_0x2d51('0xa')]);router[_0x2d51('0x8')]('/:id',auth[_0x2d51('0x9')](),controller[_0x2d51('0xb')]);router[_0x2d51('0x8')](_0x2d51('0xc'),auth[_0x2d51('0x9')](),controller[_0x2d51('0xd')]);router[_0x2d51('0x8')]('/:id/subjects',auth[_0x2d51('0x9')](),controller['getSubjects']);router[_0x2d51('0x8')]('/:id/descriptions',auth[_0x2d51('0x9')](),controller[_0x2d51('0xe')]);router[_0x2d51('0xf')]('/',auth['isAuthenticated'](),controller[_0x2d51('0x10')]);router[_0x2d51('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2d51('0x12')]);router[_0x2d51('0x13')](_0x2d51('0x14'),auth[_0x2d51('0x9')](),controller[_0x2d51('0x15')]);module[_0x2d51('0x16')]=router; \ No newline at end of file +var _0x0dcb=['get','/:id','show','getFields','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x42fddb,_0x43d777){var _0x357157=function(_0x468368){while(--_0x468368){_0x42fddb['push'](_0x42fddb['shift']());}};_0x357157(++_0x43d777);}(_0x0dcb,0x142));var _0xb0dc=function(_0x535d70,_0x3f1899){_0x535d70=_0x535d70-0x0;var _0x115779=_0x0dcb[_0x535d70];return _0x115779;};'use strict';var multer=require(_0xb0dc('0x0'));var util=require(_0xb0dc('0x1'));var path=require(_0xb0dc('0x2'));var timeout=require(_0xb0dc('0x3'));var express=require(_0xb0dc('0x4'));var router=express['Router']();var auth=require(_0xb0dc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb0dc('0x6'));var controller=require(_0xb0dc('0x7'));router[_0xb0dc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb0dc('0x8')](_0xb0dc('0x9'),auth['isAuthenticated'](),controller[_0xb0dc('0xa')]);router[_0xb0dc('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb0dc('0xb')]);router[_0xb0dc('0x8')]('/:id/subjects',auth[_0xb0dc('0xc')](),controller[_0xb0dc('0xd')]);router[_0xb0dc('0x8')](_0xb0dc('0xe'),auth['isAuthenticated'](),controller[_0xb0dc('0xf')]);router[_0xb0dc('0x10')]('/',auth[_0xb0dc('0xc')](),controller[_0xb0dc('0x11')]);router['put'](_0xb0dc('0x9'),auth[_0xb0dc('0xc')](),controller[_0xb0dc('0x12')]);router[_0xb0dc('0x13')]('/:id',auth[_0xb0dc('0xc')](),controller[_0xb0dc('0x14')]);module[_0xb0dc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 120d160..ec3f430 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x142e=['incident','exports','STRING','ENUM','phonecall'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x142e,0xa1));var _0xe142=function(_0x9cb296,_0xae59af){_0x9cb296=_0x9cb296-0x0;var _0x464bc6=_0x142e[_0x9cb296];return _0x464bc6;};'use strict';var Sequelize=require('sequelize');module[_0xe142('0x0')]={'name':{'type':Sequelize[_0xe142('0x1')]},'description':{'type':Sequelize[_0xe142('0x1')]},'ticketType':{'type':Sequelize[_0xe142('0x2')]('incident',_0xe142('0x3')),'defaultValue':_0xe142('0x4')}}; \ No newline at end of file +var _0xbcce=['phonecall','incident','sequelize','exports','STRING','ENUM'];(function(_0x50c70f,_0x1f70b1){var _0x1ffd85=function(_0x2f564a){while(--_0x2f564a){_0x50c70f['push'](_0x50c70f['shift']());}};_0x1ffd85(++_0x1f70b1);}(_0xbcce,0x1ee));var _0xebcc=function(_0x39ae02,_0x5ad02f){_0x39ae02=_0x39ae02-0x0;var _0x218278=_0xbcce[_0x39ae02];return _0x218278;};'use strict';var Sequelize=require(_0xebcc('0x0'));module[_0xebcc('0x1')]={'name':{'type':Sequelize[_0xebcc('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xebcc('0x3')]('incident',_0xebcc('0x4')),'defaultValue':_0xebcc('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4078805..4f42498 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x041f=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','destroy','end','stack','name','send','map','Dynamics365Configuration','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','where','merge','type','VIRTUAL','filter','includeAll','findAll','show','rawAttributes','keys','options','find','create','body','update','params','getFields','findOne','sort','pick','Dynamics365Field','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x041f,0x9a));var _0xf041=function(_0x9935d7,_0x3e4dbf){_0x9935d7=_0x9935d7-0x0;var _0x1339a6=_0x041f[_0x9935d7];return _0x1339a6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf041('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf041('0x1'));var rp=require(_0xf041('0x2'));var moment=require(_0xf041('0x3'));var BPromise=require(_0xf041('0x4'));var Mustache=require(_0xf041('0x5'));var util=require(_0xf041('0x6'));var path=require(_0xf041('0x7'));var sox=require(_0xf041('0x8'));var csv=require(_0xf041('0x9'));var ejs=require(_0xf041('0xa'));var fs=require('fs');var _=require(_0xf041('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf041('0xc'));var toCsv=require(_0xf041('0x9'));var querystring=require(_0xf041('0xd'));var Papa=require(_0xf041('0xe'));var Redis=require(_0xf041('0xf'));var authService=require(_0xf041('0x10'));var qs=require(_0xf041('0x11'));var as=require(_0xf041('0x12'));var hardwareService=require(_0xf041('0x13'));var logger=require('../../config/logger')(_0xf041('0x14'));var utils=require(_0xf041('0x15'));var config=require(_0xf041('0x16'));var licenseUtil=require(_0xf041('0x17'));var db=require(_0xf041('0x18'))['db'];var jayson=require(_0xf041('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c9880,_0x55ad29,_0x2a9ccf,_0x281902){return new BPromise(function(_0x1839ab,_0x5c41ee){var _0x1f8bd7=_0x281902||client;return _0x1f8bd7[_0xf041('0x1a')](_0x4c9880,_0x2a9ccf)[_0xf041('0x1b')](function(_0x45541f){logger['info'](_0xf041('0x1c'),_0x55ad29,_0xf041('0x1d'));logger['debug'](_0xf041('0x1e'),_0x55ad29,_0xf041('0x1d'),JSON[_0xf041('0x1f')](_0x45541f));if(_0x45541f['error']){if(_0x45541f[_0xf041('0x20')][_0xf041('0x21')]===0x1f4){logger[_0xf041('0x20')]('Dynamics365Configuration,\x20%s,\x20%s',_0x55ad29,_0x45541f[_0xf041('0x20')][_0xf041('0x22')]);return _0x5c41ee(_0x45541f[_0xf041('0x20')]['message']);}logger[_0xf041('0x20')](_0xf041('0x1c'),_0x55ad29,_0x45541f[_0xf041('0x20')][_0xf041('0x22')]);return _0x1839ab(_0x45541f[_0xf041('0x20')][_0xf041('0x22')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x55ad29,'request\x20sent');_0x1839ab(_0x45541f['result'][_0xf041('0x22')]);}})[_0xf041('0x23')](function(_0x2296b3){logger['error'](_0xf041('0x1c'),_0x55ad29,_0x2296b3);_0x5c41ee(_0x2296b3);});});}function respondWithStatusCode(_0x3a52d0,_0x323482){_0x323482=_0x323482||0xcc;return function(_0x50bd76){if(_0x50bd76){return _0x3a52d0[_0xf041('0x24')](_0x323482);}return _0x3a52d0['status'](_0x323482)['end']();};}function respondWithResult(_0x827594,_0x1ce70a){_0x1ce70a=_0x1ce70a||0xc8;return function(_0x16249d){if(_0x16249d){return _0x827594[_0xf041('0x25')](_0x1ce70a)['json'](_0x16249d);}};}function respondWithFilteredResult(_0x478fc1,_0x57fdbd){return function(_0x3fa542){if(_0x3fa542){var _0x3792eb=_0x3fa542[_0xf041('0x26')],_0xeb5ac2=_0x57fdbd[_0xf041('0x27')],_0x1e463f=_0x57fdbd[_0xf041('0x27')]+_0x57fdbd['limit'],_0x1dc08c;if(_0x1e463f>=_0x3792eb){_0x1e463f=_0x3792eb;_0x1dc08c=0xc8;}else{_0x1dc08c=0xce;}_0x478fc1[_0xf041('0x25')](_0x1dc08c);return _0x478fc1[_0xf041('0x28')](_0xf041('0x29'),_0xeb5ac2+'-'+_0x1e463f+'/'+_0x3792eb)[_0xf041('0x2a')](_0x3fa542);}return null;};}function patchUpdates(_0x442380){return function(_0x39b414){try{jsonpatch[_0xf041('0x2b')](_0x39b414,_0x442380,!![]);}catch(_0x35273f){return BPromise['reject'](_0x35273f);}return _0x39b414['save']();};}function saveUpdates(_0x59f1cc,_0x32457d){return function(_0x2d1704){if(_0x2d1704){return _0x2d1704['update'](_0x59f1cc)[_0xf041('0x1b')](function(_0x279c1a){return _0x279c1a;});}return null;};}function removeEntity(_0x243cf9,_0x3d6e6f){return function(_0x16c5eb){if(_0x16c5eb){return _0x16c5eb[_0xf041('0x2c')]()[_0xf041('0x1b')](function(){_0x243cf9[_0xf041('0x25')](0xcc)[_0xf041('0x2d')]();});}};}function handleEntityNotFound(_0x5de07e,_0x135de1){return function(_0x5a6a46){if(!_0x5a6a46){_0x5de07e[_0xf041('0x24')](0x194);}return _0x5a6a46;};}function handleError(_0x410c37,_0x3bb4e6){_0x3bb4e6=_0x3bb4e6||0x1f4;return function(_0x72cb2c){logger[_0xf041('0x20')](_0x72cb2c[_0xf041('0x2e')]);if(_0x72cb2c[_0xf041('0x2f')]){delete _0x72cb2c[_0xf041('0x2f')];}_0x410c37[_0xf041('0x25')](_0x3bb4e6)[_0xf041('0x30')](_0x72cb2c);};}exports['index']=function(_0x192d25,_0xc87d55){var _0x3ed4e8={},_0x22c524={},_0x294de8={'count':0x0,'rows':[]};var _0x3fd91d=_[_0xf041('0x31')](db[_0xf041('0x32')]['rawAttributes'],function(_0x46ad27){return{'name':_0x46ad27['fieldName'],'type':_0x46ad27['type'][_0xf041('0x33')]};});_0x22c524['model']=_[_0xf041('0x31')](_0x3fd91d,'name');_0x22c524[_0xf041('0x34')]=_['keys'](_0x192d25[_0xf041('0x34')]);_0x22c524[_0xf041('0x35')]=_[_0xf041('0x36')](_0x22c524['model'],_0x22c524['query']);_0x3ed4e8[_0xf041('0x37')]=_[_0xf041('0x36')](_0x22c524[_0xf041('0x38')],qs[_0xf041('0x39')](_0x192d25[_0xf041('0x34')][_0xf041('0x39')]));_0x3ed4e8[_0xf041('0x37')]=_0x3ed4e8[_0xf041('0x37')][_0xf041('0x3a')]?_0x3ed4e8[_0xf041('0x37')]:_0x22c524[_0xf041('0x38')];if(!_0x192d25['query'][_0xf041('0x3b')](_0xf041('0x3c'))){_0x3ed4e8[_0xf041('0x3d')]=qs['limit'](_0x192d25[_0xf041('0x34')][_0xf041('0x3d')]);_0x3ed4e8['offset']=qs[_0xf041('0x27')](_0x192d25[_0xf041('0x34')][_0xf041('0x27')]);}_0x3ed4e8[_0xf041('0x3e')]=qs['sort'](_0x192d25[_0xf041('0x34')]['sort']);_0x3ed4e8['where']=qs[_0xf041('0x35')](_['pick'](_0x192d25[_0xf041('0x34')],_0x22c524[_0xf041('0x35')]),_0x3fd91d);if(_0x192d25['query']['filter']){_0x3ed4e8[_0xf041('0x3f')]=_[_0xf041('0x40')](_0x3ed4e8[_0xf041('0x3f')],{'$or':_['map'](_0x3fd91d,function(_0x224093){if(_0x224093[_0xf041('0x41')]!==_0xf041('0x42')){var _0x2c5e6={};_0x2c5e6[_0x224093['name']]={'$like':'%'+_0x192d25[_0xf041('0x34')][_0xf041('0x43')]+'%'};return _0x2c5e6;}})});}_0x3ed4e8=_[_0xf041('0x40')]({},_0x3ed4e8,_0x192d25['options']);var _0x2d9580={'where':_0x3ed4e8[_0xf041('0x3f')]};return db[_0xf041('0x32')]['count'](_0x2d9580)[_0xf041('0x1b')](function(_0x246f84){_0x294de8[_0xf041('0x26')]=_0x246f84;if(_0x192d25[_0xf041('0x34')][_0xf041('0x44')]){_0x3ed4e8['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xf041('0x45')](_0x3ed4e8);})['then'](function(_0x337b72){_0x294de8['rows']=_0x337b72;return _0x294de8;})[_0xf041('0x1b')](respondWithFilteredResult(_0xc87d55,_0x3ed4e8))[_0xf041('0x23')](handleError(_0xc87d55,null));};exports[_0xf041('0x46')]=function(_0x4f8f9b,_0x5cef78){var _0xbde710={'raw':![],'where':{'id':_0x4f8f9b['params']['id']}},_0xb3ccd1={};_0xb3ccd1[_0xf041('0x38')]=_['keys'](db[_0xf041('0x32')][_0xf041('0x47')]);_0xb3ccd1['query']=_[_0xf041('0x48')](_0x4f8f9b[_0xf041('0x34')]);_0xb3ccd1['filters']=_[_0xf041('0x36')](_0xb3ccd1[_0xf041('0x38')],_0xb3ccd1[_0xf041('0x34')]);_0xbde710[_0xf041('0x37')]=_[_0xf041('0x36')](_0xb3ccd1['model'],qs[_0xf041('0x39')](_0x4f8f9b[_0xf041('0x34')][_0xf041('0x39')]));_0xbde710[_0xf041('0x37')]=_0xbde710[_0xf041('0x37')][_0xf041('0x3a')]?_0xbde710[_0xf041('0x37')]:_0xb3ccd1['model'];if(_0x4f8f9b['query'][_0xf041('0x44')]){_0xbde710['include']=[{'all':!![]}];}_0xbde710=_['merge']({},_0xbde710,_0x4f8f9b[_0xf041('0x49')]);return db['Dynamics365Configuration'][_0xf041('0x4a')](_0xbde710)[_0xf041('0x1b')](handleEntityNotFound(_0x5cef78,null))[_0xf041('0x1b')](respondWithResult(_0x5cef78,null))[_0xf041('0x23')](handleError(_0x5cef78,null));};exports[_0xf041('0x4b')]=function(_0x3f47eb,_0x374dac){return db[_0xf041('0x32')][_0xf041('0x4b')](_0x3f47eb[_0xf041('0x4c')],{})['then'](respondWithResult(_0x374dac,0xc9))[_0xf041('0x23')](handleError(_0x374dac,null));};exports[_0xf041('0x4d')]=function(_0x52b346,_0x376d7e){if(_0x52b346[_0xf041('0x4c')]['id']){delete _0x52b346['body']['id'];}return db['Dynamics365Configuration'][_0xf041('0x4a')]({'where':{'id':_0x52b346[_0xf041('0x4e')]['id']}})[_0xf041('0x1b')](handleEntityNotFound(_0x376d7e,null))[_0xf041('0x1b')](saveUpdates(_0x52b346['body'],null))[_0xf041('0x1b')](respondWithResult(_0x376d7e,null))['catch'](handleError(_0x376d7e,null));};exports[_0xf041('0x2c')]=function(_0x2f7447,_0x333c75){return db[_0xf041('0x32')]['find']({'where':{'id':_0x2f7447[_0xf041('0x4e')]['id']}})[_0xf041('0x1b')](handleEntityNotFound(_0x333c75,null))['then'](removeEntity(_0x333c75,null))[_0xf041('0x23')](handleError(_0x333c75,null));};exports[_0xf041('0x4f')]=function(_0x2c8369,_0x4bf3e5,_0x3bcbb4){var _0x5037df={};var _0x17d780={};var _0x1569e1;var _0x5663ae;return db[_0xf041('0x32')][_0xf041('0x50')]({'where':{'id':_0x2c8369['params']['id']}})[_0xf041('0x1b')](handleEntityNotFound(_0x4bf3e5,null))[_0xf041('0x1b')](function(_0xb49579){if(_0xb49579){_0x1569e1=_0xb49579;_0x17d780[_0xf041('0x38')]=_[_0xf041('0x48')](db['Dynamics365Field'][_0xf041('0x47')]);_0x17d780['query']=_[_0xf041('0x48')](_0x2c8369[_0xf041('0x34')]);_0x17d780[_0xf041('0x35')]=_[_0xf041('0x36')](_0x17d780['model'],_0x17d780[_0xf041('0x34')]);_0x5037df[_0xf041('0x37')]=_[_0xf041('0x36')](_0x17d780[_0xf041('0x38')],qs[_0xf041('0x39')](_0x2c8369[_0xf041('0x34')][_0xf041('0x39')]));_0x5037df[_0xf041('0x37')]=_0x5037df[_0xf041('0x37')][_0xf041('0x3a')]?_0x5037df['attributes']:_0x17d780['model'];_0x5037df['order']=qs[_0xf041('0x51')](_0x2c8369['query']['sort']);_0x5037df['where']=qs['filters'](_[_0xf041('0x52')](_0x2c8369['query'],_0x17d780[_0xf041('0x35')]));if(_0x2c8369['query'][_0xf041('0x43')]){_0x5037df[_0xf041('0x3f')]=_[_0xf041('0x40')](_0x5037df[_0xf041('0x3f')],{'$or':_['map'](_0x5037df[_0xf041('0x37')],function(_0x2e586c){var _0x43487d={};_0x43487d[_0x2e586c]={'$like':'%'+_0x2c8369[_0xf041('0x34')]['filter']+'%'};return _0x43487d;})});}_0x5037df=_[_0xf041('0x40')]({},_0x5037df,_0x2c8369[_0xf041('0x49')]);return _0x1569e1[_0xf041('0x4f')](_0x5037df);}})[_0xf041('0x1b')](function(_0x85fa69){if(_0x85fa69){_0x5663ae=_0x85fa69[_0xf041('0x3a')];if(!_0x2c8369[_0xf041('0x34')][_0xf041('0x3b')]('nolimit')){_0x5037df[_0xf041('0x3d')]=qs[_0xf041('0x3d')](_0x2c8369[_0xf041('0x34')][_0xf041('0x3d')]);_0x5037df[_0xf041('0x27')]=qs[_0xf041('0x27')](_0x2c8369[_0xf041('0x34')]['offset']);}return _0x1569e1['getFields'](_0x5037df);}})[_0xf041('0x1b')](function(_0x17f962){if(_0x17f962){return _0x17f962?{'count':_0x5663ae,'rows':_0x17f962}:null;}})[_0xf041('0x1b')](respondWithResult(_0x4bf3e5,null))[_0xf041('0x23')](handleError(_0x4bf3e5,null));};exports['getSubjects']=function(_0x2c77ae,_0x3c767d,_0x98858e){var _0x136fa7={};var _0x21144d={};var _0x389369;var _0x384908;return db[_0xf041('0x32')][_0xf041('0x50')]({'where':{'id':_0x2c77ae[_0xf041('0x4e')]['id']}})[_0xf041('0x1b')](handleEntityNotFound(_0x3c767d,null))[_0xf041('0x1b')](function(_0x27d1fa){if(_0x27d1fa){_0x389369=_0x27d1fa;_0x21144d[_0xf041('0x38')]=_['keys'](db[_0xf041('0x53')][_0xf041('0x47')]);_0x21144d[_0xf041('0x34')]=_[_0xf041('0x48')](_0x2c77ae[_0xf041('0x34')]);_0x21144d['filters']=_[_0xf041('0x36')](_0x21144d[_0xf041('0x38')],_0x21144d['query']);_0x136fa7[_0xf041('0x37')]=_[_0xf041('0x36')](_0x21144d[_0xf041('0x38')],qs[_0xf041('0x39')](_0x2c77ae['query']['fields']));_0x136fa7['attributes']=_0x136fa7[_0xf041('0x37')][_0xf041('0x3a')]?_0x136fa7[_0xf041('0x37')]:_0x21144d[_0xf041('0x38')];_0x136fa7[_0xf041('0x3e')]=qs[_0xf041('0x51')](_0x2c77ae[_0xf041('0x34')][_0xf041('0x51')]);_0x136fa7[_0xf041('0x3f')]=qs[_0xf041('0x35')](_['pick'](_0x2c77ae[_0xf041('0x34')],_0x21144d['filters']));if(_0x2c77ae[_0xf041('0x34')][_0xf041('0x43')]){_0x136fa7[_0xf041('0x3f')]=_[_0xf041('0x40')](_0x136fa7[_0xf041('0x3f')],{'$or':_['map'](_0x136fa7[_0xf041('0x37')],function(_0x34244c){var _0x453d43={};_0x453d43[_0x34244c]={'$like':'%'+_0x2c77ae[_0xf041('0x34')][_0xf041('0x43')]+'%'};return _0x453d43;})});}_0x136fa7=_[_0xf041('0x40')]({},_0x136fa7,_0x2c77ae['options']);return _0x389369[_0xf041('0x54')](_0x136fa7);}})[_0xf041('0x1b')](function(_0x64e25c){if(_0x64e25c){_0x384908=_0x64e25c[_0xf041('0x3a')];if(!_0x2c77ae[_0xf041('0x34')]['hasOwnProperty']('nolimit')){_0x136fa7[_0xf041('0x3d')]=qs['limit'](_0x2c77ae[_0xf041('0x34')][_0xf041('0x3d')]);_0x136fa7['offset']=qs[_0xf041('0x27')](_0x2c77ae[_0xf041('0x34')][_0xf041('0x27')]);}return _0x389369[_0xf041('0x54')](_0x136fa7);}})[_0xf041('0x1b')](function(_0x2d9b47){if(_0x2d9b47){return _0x2d9b47?{'count':_0x384908,'rows':_0x2d9b47}:null;}})['then'](respondWithResult(_0x3c767d,null))['catch'](handleError(_0x3c767d,null));};exports[_0xf041('0x55')]=function(_0x4fb15d,_0x467102,_0x351a1a){var _0x2da69c={};var _0x56afcc={};var _0x29dfd7;var _0x328e97;return db[_0xf041('0x32')][_0xf041('0x50')]({'where':{'id':_0x4fb15d[_0xf041('0x4e')]['id']}})[_0xf041('0x1b')](handleEntityNotFound(_0x467102,null))[_0xf041('0x1b')](function(_0x48449f){if(_0x48449f){_0x29dfd7=_0x48449f;_0x56afcc['model']=_[_0xf041('0x48')](db['Dynamics365Field'][_0xf041('0x47')]);_0x56afcc['query']=_[_0xf041('0x48')](_0x4fb15d['query']);_0x56afcc[_0xf041('0x35')]=_[_0xf041('0x36')](_0x56afcc[_0xf041('0x38')],_0x56afcc[_0xf041('0x34')]);_0x2da69c['attributes']=_[_0xf041('0x36')](_0x56afcc['model'],qs[_0xf041('0x39')](_0x4fb15d[_0xf041('0x34')][_0xf041('0x39')]));_0x2da69c[_0xf041('0x37')]=_0x2da69c[_0xf041('0x37')][_0xf041('0x3a')]?_0x2da69c[_0xf041('0x37')]:_0x56afcc['model'];_0x2da69c['order']=qs['sort'](_0x4fb15d[_0xf041('0x34')][_0xf041('0x51')]);_0x2da69c[_0xf041('0x3f')]=qs[_0xf041('0x35')](_[_0xf041('0x52')](_0x4fb15d['query'],_0x56afcc[_0xf041('0x35')]));if(_0x4fb15d[_0xf041('0x34')][_0xf041('0x43')]){_0x2da69c[_0xf041('0x3f')]=_[_0xf041('0x40')](_0x2da69c['where'],{'$or':_['map'](_0x2da69c['attributes'],function(_0x1c05ba){var _0x2d223d={};_0x2d223d[_0x1c05ba]={'$like':'%'+_0x4fb15d[_0xf041('0x34')][_0xf041('0x43')]+'%'};return _0x2d223d;})});}_0x2da69c=_[_0xf041('0x40')]({},_0x2da69c,_0x4fb15d[_0xf041('0x49')]);return _0x29dfd7[_0xf041('0x55')](_0x2da69c);}})[_0xf041('0x1b')](function(_0xed97d8){if(_0xed97d8){_0x328e97=_0xed97d8[_0xf041('0x3a')];if(!_0x4fb15d[_0xf041('0x34')]['hasOwnProperty']('nolimit')){_0x2da69c[_0xf041('0x3d')]=qs[_0xf041('0x3d')](_0x4fb15d[_0xf041('0x34')][_0xf041('0x3d')]);_0x2da69c[_0xf041('0x27')]=qs[_0xf041('0x27')](_0x4fb15d[_0xf041('0x34')]['offset']);}return _0x29dfd7[_0xf041('0x55')](_0x2da69c);}})[_0xf041('0x1b')](function(_0x404f1b){if(_0x404f1b){return _0x404f1b?{'count':_0x328e97,'rows':_0x404f1b}:null;}})['then'](respondWithResult(_0x467102,null))[_0xf041('0x23')](handleError(_0x467102,null));}; \ No newline at end of file +var _0x2faf=['find','create','body','getFields','findOne','pick','options','getSubjects','Dynamics365Field','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','count','offset','set','Content-Range','save','update','destroy','then','sendStatus','stack','name','send','index','fieldName','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','Dynamics365Configuration','rows','params','rawAttributes','length'];(function(_0x301dbb,_0x45dcec){var _0x1d7567=function(_0x158510){while(--_0x158510){_0x301dbb['push'](_0x301dbb['shift']());}};_0x1d7567(++_0x45dcec);}(_0x2faf,0x16a));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xf2fa('0x0'));var emlformat=require(_0xf2fa('0x1'));var rimraf=require(_0xf2fa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2fa('0x3'));var rp=require(_0xf2fa('0x4'));var moment=require(_0xf2fa('0x5'));var BPromise=require(_0xf2fa('0x6'));var Mustache=require(_0xf2fa('0x7'));var util=require(_0xf2fa('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf2fa('0x9'));var ejs=require(_0xf2fa('0xa'));var fs=require('fs');var _=require(_0xf2fa('0xb'));var squel=require(_0xf2fa('0xc'));var crypto=require(_0xf2fa('0xd'));var jsforce=require(_0xf2fa('0xe'));var deskjs=require(_0xf2fa('0xf'));var toCsv=require(_0xf2fa('0x9'));var querystring=require(_0xf2fa('0x10'));var Papa=require(_0xf2fa('0x11'));var Redis=require('ioredis');var authService=require(_0xf2fa('0x12'));var qs=require(_0xf2fa('0x13'));var as=require(_0xf2fa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf2fa('0x15'));var utils=require(_0xf2fa('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf2fa('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf2fa('0x18'));var client=jayson[_0xf2fa('0x19')][_0xf2fa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x59fd5f,_0x5d0f04,_0x2e017f,_0xd1e5e2){return new BPromise(function(_0x2edc95,_0x305cd7){var _0x57f790=_0xd1e5e2||client;return _0x57f790[_0xf2fa('0x1b')](_0x59fd5f,_0x2e017f)['then'](function(_0x5da111){logger['info'](_0xf2fa('0x1c'),_0x5d0f04,_0xf2fa('0x1d'));logger[_0xf2fa('0x1e')](_0xf2fa('0x1f'),_0x5d0f04,_0xf2fa('0x1d'),JSON[_0xf2fa('0x20')](_0x5da111));if(_0x5da111['error']){if(_0x5da111[_0xf2fa('0x21')]['code']===0x1f4){logger[_0xf2fa('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5d0f04,_0x5da111[_0xf2fa('0x21')]['message']);return _0x305cd7(_0x5da111[_0xf2fa('0x21')][_0xf2fa('0x22')]);}logger[_0xf2fa('0x21')](_0xf2fa('0x1c'),_0x5d0f04,_0x5da111['error'][_0xf2fa('0x22')]);return _0x2edc95(_0x5da111[_0xf2fa('0x21')][_0xf2fa('0x22')]);}else{logger[_0xf2fa('0x23')](_0xf2fa('0x1c'),_0x5d0f04,_0xf2fa('0x1d'));_0x2edc95(_0x5da111[_0xf2fa('0x24')][_0xf2fa('0x22')]);}})[_0xf2fa('0x25')](function(_0x46fa70){logger[_0xf2fa('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5d0f04,_0x46fa70);_0x305cd7(_0x46fa70);});});}function respondWithStatusCode(_0x2cbb33,_0x337065){_0x337065=_0x337065||0xcc;return function(_0x36f8b9){if(_0x36f8b9){return _0x2cbb33['sendStatus'](_0x337065);}return _0x2cbb33[_0xf2fa('0x26')](_0x337065)[_0xf2fa('0x27')]();};}function respondWithResult(_0x4a88a7,_0x149ed2){_0x149ed2=_0x149ed2||0xc8;return function(_0x45999a){if(_0x45999a){return _0x4a88a7[_0xf2fa('0x26')](_0x149ed2)[_0xf2fa('0x28')](_0x45999a);}};}function respondWithFilteredResult(_0x1efcbb,_0x591df1){return function(_0xdc8f86){if(_0xdc8f86){var _0x741392=_0xdc8f86[_0xf2fa('0x29')],_0x33b0ad=_0x591df1['offset'],_0x555e0f=_0x591df1[_0xf2fa('0x2a')]+_0x591df1['limit'],_0x994f05;if(_0x555e0f>=_0x741392){_0x555e0f=_0x741392;_0x994f05=0xc8;}else{_0x994f05=0xce;}_0x1efcbb[_0xf2fa('0x26')](_0x994f05);return _0x1efcbb[_0xf2fa('0x2b')](_0xf2fa('0x2c'),_0x33b0ad+'-'+_0x555e0f+'/'+_0x741392)['json'](_0xdc8f86);}return null;};}function patchUpdates(_0x178716){return function(_0x332c5b){try{jsonpatch['apply'](_0x332c5b,_0x178716,!![]);}catch(_0x45115f){return BPromise['reject'](_0x45115f);}return _0x332c5b[_0xf2fa('0x2d')]();};}function saveUpdates(_0x157399,_0x30c7f0){return function(_0x30732a){if(_0x30732a){return _0x30732a[_0xf2fa('0x2e')](_0x157399)['then'](function(_0x15d67e){return _0x15d67e;});}return null;};}function removeEntity(_0x2df034,_0x178726){return function(_0x97ba52){if(_0x97ba52){return _0x97ba52[_0xf2fa('0x2f')]()[_0xf2fa('0x30')](function(){_0x2df034[_0xf2fa('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x457e15,_0x44bef5){return function(_0x11727d){if(!_0x11727d){_0x457e15[_0xf2fa('0x31')](0x194);}return _0x11727d;};}function handleError(_0x4caac1,_0x2b8ddc){_0x2b8ddc=_0x2b8ddc||0x1f4;return function(_0x769361){logger[_0xf2fa('0x21')](_0x769361[_0xf2fa('0x32')]);if(_0x769361[_0xf2fa('0x33')]){delete _0x769361[_0xf2fa('0x33')];}_0x4caac1[_0xf2fa('0x26')](_0x2b8ddc)[_0xf2fa('0x34')](_0x769361);};}exports[_0xf2fa('0x35')]=function(_0x5337bb,_0x428b0a){var _0x35bbdc={},_0x51c98c={},_0x32e5b2={'count':0x0,'rows':[]};var _0x49cce7=_['map'](db['Dynamics365Configuration']['rawAttributes'],function(_0xd1129a){return{'name':_0xd1129a[_0xf2fa('0x36')],'type':_0xd1129a['type']['key']};});_0x51c98c['model']=_[_0xf2fa('0x37')](_0x49cce7,_0xf2fa('0x33'));_0x51c98c[_0xf2fa('0x38')]=_[_0xf2fa('0x39')](_0x5337bb[_0xf2fa('0x38')]);_0x51c98c[_0xf2fa('0x3a')]=_[_0xf2fa('0x3b')](_0x51c98c[_0xf2fa('0x3c')],_0x51c98c['query']);_0x35bbdc[_0xf2fa('0x3d')]=_['intersection'](_0x51c98c[_0xf2fa('0x3c')],qs[_0xf2fa('0x3e')](_0x5337bb[_0xf2fa('0x38')][_0xf2fa('0x3e')]));_0x35bbdc['attributes']=_0x35bbdc[_0xf2fa('0x3d')]['length']?_0x35bbdc[_0xf2fa('0x3d')]:_0x51c98c[_0xf2fa('0x3c')];if(!_0x5337bb['query'][_0xf2fa('0x3f')](_0xf2fa('0x40'))){_0x35bbdc['limit']=qs[_0xf2fa('0x41')](_0x5337bb[_0xf2fa('0x38')]['limit']);_0x35bbdc[_0xf2fa('0x2a')]=qs[_0xf2fa('0x2a')](_0x5337bb['query'][_0xf2fa('0x2a')]);}_0x35bbdc[_0xf2fa('0x42')]=qs['sort'](_0x5337bb[_0xf2fa('0x38')][_0xf2fa('0x43')]);_0x35bbdc[_0xf2fa('0x44')]=qs[_0xf2fa('0x3a')](_['pick'](_0x5337bb[_0xf2fa('0x38')],_0x51c98c['filters']),_0x49cce7);if(_0x5337bb[_0xf2fa('0x38')][_0xf2fa('0x45')]){_0x35bbdc[_0xf2fa('0x44')]=_[_0xf2fa('0x46')](_0x35bbdc[_0xf2fa('0x44')],{'$or':_[_0xf2fa('0x37')](_0x49cce7,function(_0x358b85){if(_0x358b85[_0xf2fa('0x47')]!==_0xf2fa('0x48')){var _0x5157f5={};_0x5157f5[_0x358b85[_0xf2fa('0x33')]]={'$like':'%'+_0x5337bb['query']['filter']+'%'};return _0x5157f5;}})});}_0x35bbdc=_['merge']({},_0x35bbdc,_0x5337bb['options']);var _0x391ca2={'where':_0x35bbdc[_0xf2fa('0x44')]};return db[_0xf2fa('0x49')]['count'](_0x391ca2)[_0xf2fa('0x30')](function(_0x2abd01){_0x32e5b2[_0xf2fa('0x29')]=_0x2abd01;if(_0x5337bb[_0xf2fa('0x38')]['includeAll']){_0x35bbdc['include']=[{'all':!![]}];}return db[_0xf2fa('0x49')]['findAll'](_0x35bbdc);})['then'](function(_0x3d0eac){_0x32e5b2[_0xf2fa('0x4a')]=_0x3d0eac;return _0x32e5b2;})[_0xf2fa('0x30')](respondWithFilteredResult(_0x428b0a,_0x35bbdc))[_0xf2fa('0x25')](handleError(_0x428b0a,null));};exports['show']=function(_0x47eea9,_0x5e544c){var _0xa77ac5={'raw':![],'where':{'id':_0x47eea9[_0xf2fa('0x4b')]['id']}},_0xae0487={};_0xae0487[_0xf2fa('0x3c')]=_[_0xf2fa('0x39')](db['Dynamics365Configuration'][_0xf2fa('0x4c')]);_0xae0487[_0xf2fa('0x38')]=_['keys'](_0x47eea9['query']);_0xae0487[_0xf2fa('0x3a')]=_[_0xf2fa('0x3b')](_0xae0487[_0xf2fa('0x3c')],_0xae0487['query']);_0xa77ac5['attributes']=_[_0xf2fa('0x3b')](_0xae0487['model'],qs[_0xf2fa('0x3e')](_0x47eea9[_0xf2fa('0x38')][_0xf2fa('0x3e')]));_0xa77ac5['attributes']=_0xa77ac5[_0xf2fa('0x3d')][_0xf2fa('0x4d')]?_0xa77ac5[_0xf2fa('0x3d')]:_0xae0487[_0xf2fa('0x3c')];if(_0x47eea9['query']['includeAll']){_0xa77ac5['include']=[{'all':!![]}];}_0xa77ac5=_[_0xf2fa('0x46')]({},_0xa77ac5,_0x47eea9['options']);return db[_0xf2fa('0x49')][_0xf2fa('0x4e')](_0xa77ac5)['then'](handleEntityNotFound(_0x5e544c,null))[_0xf2fa('0x30')](respondWithResult(_0x5e544c,null))[_0xf2fa('0x25')](handleError(_0x5e544c,null));};exports[_0xf2fa('0x4f')]=function(_0x56c8ac,_0x5c65e0){return db['Dynamics365Configuration'][_0xf2fa('0x4f')](_0x56c8ac[_0xf2fa('0x50')],{})[_0xf2fa('0x30')](respondWithResult(_0x5c65e0,0xc9))['catch'](handleError(_0x5c65e0,null));};exports[_0xf2fa('0x2e')]=function(_0x5b176b,_0x21c775){if(_0x5b176b[_0xf2fa('0x50')]['id']){delete _0x5b176b[_0xf2fa('0x50')]['id'];}return db['Dynamics365Configuration'][_0xf2fa('0x4e')]({'where':{'id':_0x5b176b['params']['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x21c775,null))['then'](saveUpdates(_0x5b176b['body'],null))['then'](respondWithResult(_0x21c775,null))[_0xf2fa('0x25')](handleError(_0x21c775,null));};exports[_0xf2fa('0x2f')]=function(_0x2d6d6,_0x436f82){return db[_0xf2fa('0x49')][_0xf2fa('0x4e')]({'where':{'id':_0x2d6d6[_0xf2fa('0x4b')]['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x436f82,null))['then'](removeEntity(_0x436f82,null))[_0xf2fa('0x25')](handleError(_0x436f82,null));};exports[_0xf2fa('0x51')]=function(_0x2fe5eb,_0x4e8d99,_0x4f6d9b){var _0x3bc634={};var _0x468a75={};var _0x11de54;var _0x1e7992;return db[_0xf2fa('0x49')][_0xf2fa('0x52')]({'where':{'id':_0x2fe5eb[_0xf2fa('0x4b')]['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x4e8d99,null))[_0xf2fa('0x30')](function(_0x2cb0c3){if(_0x2cb0c3){_0x11de54=_0x2cb0c3;_0x468a75['model']=_['keys'](db['Dynamics365Field'][_0xf2fa('0x4c')]);_0x468a75[_0xf2fa('0x38')]=_[_0xf2fa('0x39')](_0x2fe5eb[_0xf2fa('0x38')]);_0x468a75[_0xf2fa('0x3a')]=_[_0xf2fa('0x3b')](_0x468a75[_0xf2fa('0x3c')],_0x468a75[_0xf2fa('0x38')]);_0x3bc634[_0xf2fa('0x3d')]=_['intersection'](_0x468a75['model'],qs[_0xf2fa('0x3e')](_0x2fe5eb[_0xf2fa('0x38')][_0xf2fa('0x3e')]));_0x3bc634[_0xf2fa('0x3d')]=_0x3bc634[_0xf2fa('0x3d')][_0xf2fa('0x4d')]?_0x3bc634[_0xf2fa('0x3d')]:_0x468a75[_0xf2fa('0x3c')];_0x3bc634[_0xf2fa('0x42')]=qs['sort'](_0x2fe5eb[_0xf2fa('0x38')]['sort']);_0x3bc634[_0xf2fa('0x44')]=qs[_0xf2fa('0x3a')](_[_0xf2fa('0x53')](_0x2fe5eb[_0xf2fa('0x38')],_0x468a75[_0xf2fa('0x3a')]));if(_0x2fe5eb[_0xf2fa('0x38')][_0xf2fa('0x45')]){_0x3bc634[_0xf2fa('0x44')]=_[_0xf2fa('0x46')](_0x3bc634[_0xf2fa('0x44')],{'$or':_['map'](_0x3bc634['attributes'],function(_0x10c54c){var _0x44add6={};_0x44add6[_0x10c54c]={'$like':'%'+_0x2fe5eb['query']['filter']+'%'};return _0x44add6;})});}_0x3bc634=_['merge']({},_0x3bc634,_0x2fe5eb[_0xf2fa('0x54')]);return _0x11de54[_0xf2fa('0x51')](_0x3bc634);}})[_0xf2fa('0x30')](function(_0x40e923){if(_0x40e923){_0x1e7992=_0x40e923[_0xf2fa('0x4d')];if(!_0x2fe5eb[_0xf2fa('0x38')]['hasOwnProperty'](_0xf2fa('0x40'))){_0x3bc634[_0xf2fa('0x41')]=qs['limit'](_0x2fe5eb[_0xf2fa('0x38')]['limit']);_0x3bc634[_0xf2fa('0x2a')]=qs[_0xf2fa('0x2a')](_0x2fe5eb['query'][_0xf2fa('0x2a')]);}return _0x11de54[_0xf2fa('0x51')](_0x3bc634);}})['then'](function(_0x1d921a){if(_0x1d921a){return _0x1d921a?{'count':_0x1e7992,'rows':_0x1d921a}:null;}})[_0xf2fa('0x30')](respondWithResult(_0x4e8d99,null))[_0xf2fa('0x25')](handleError(_0x4e8d99,null));};exports[_0xf2fa('0x55')]=function(_0x2f0f59,_0x4349d8,_0x51377a){var _0xfb8e1d={};var _0x5390ee={};var _0xc6642b;var _0x2ca85c;return db[_0xf2fa('0x49')][_0xf2fa('0x52')]({'where':{'id':_0x2f0f59[_0xf2fa('0x4b')]['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x4349d8,null))[_0xf2fa('0x30')](function(_0x4933c8){if(_0x4933c8){_0xc6642b=_0x4933c8;_0x5390ee['model']=_['keys'](db[_0xf2fa('0x56')]['rawAttributes']);_0x5390ee[_0xf2fa('0x38')]=_['keys'](_0x2f0f59['query']);_0x5390ee['filters']=_[_0xf2fa('0x3b')](_0x5390ee[_0xf2fa('0x3c')],_0x5390ee[_0xf2fa('0x38')]);_0xfb8e1d['attributes']=_[_0xf2fa('0x3b')](_0x5390ee[_0xf2fa('0x3c')],qs['fields'](_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x3e')]));_0xfb8e1d[_0xf2fa('0x3d')]=_0xfb8e1d[_0xf2fa('0x3d')][_0xf2fa('0x4d')]?_0xfb8e1d[_0xf2fa('0x3d')]:_0x5390ee[_0xf2fa('0x3c')];_0xfb8e1d['order']=qs[_0xf2fa('0x43')](_0x2f0f59['query'][_0xf2fa('0x43')]);_0xfb8e1d['where']=qs['filters'](_[_0xf2fa('0x53')](_0x2f0f59[_0xf2fa('0x38')],_0x5390ee[_0xf2fa('0x3a')]));if(_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x45')]){_0xfb8e1d[_0xf2fa('0x44')]=_[_0xf2fa('0x46')](_0xfb8e1d[_0xf2fa('0x44')],{'$or':_[_0xf2fa('0x37')](_0xfb8e1d[_0xf2fa('0x3d')],function(_0x14dfad){var _0x3c62b7={};_0x3c62b7[_0x14dfad]={'$like':'%'+_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x45')]+'%'};return _0x3c62b7;})});}_0xfb8e1d=_[_0xf2fa('0x46')]({},_0xfb8e1d,_0x2f0f59[_0xf2fa('0x54')]);return _0xc6642b['getSubjects'](_0xfb8e1d);}})[_0xf2fa('0x30')](function(_0x533c46){if(_0x533c46){_0x2ca85c=_0x533c46['length'];if(!_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x3f')](_0xf2fa('0x40'))){_0xfb8e1d[_0xf2fa('0x41')]=qs['limit'](_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x41')]);_0xfb8e1d['offset']=qs[_0xf2fa('0x2a')](_0x2f0f59['query'][_0xf2fa('0x2a')]);}return _0xc6642b[_0xf2fa('0x55')](_0xfb8e1d);}})[_0xf2fa('0x30')](function(_0x20f79f){if(_0x20f79f){return _0x20f79f?{'count':_0x2ca85c,'rows':_0x20f79f}:null;}})['then'](respondWithResult(_0x4349d8,null))[_0xf2fa('0x25')](handleError(_0x4349d8,null));};exports[_0xf2fa('0x57')]=function(_0x3db2a9,_0x5adebd,_0x3be0a3){var _0x1f4281={};var _0x171ce9={};var _0x17d6a5;var _0x24fc23;return db[_0xf2fa('0x49')]['findOne']({'where':{'id':_0x3db2a9[_0xf2fa('0x4b')]['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x5adebd,null))[_0xf2fa('0x30')](function(_0x51c426){if(_0x51c426){_0x17d6a5=_0x51c426;_0x171ce9[_0xf2fa('0x3c')]=_[_0xf2fa('0x39')](db[_0xf2fa('0x56')][_0xf2fa('0x4c')]);_0x171ce9[_0xf2fa('0x38')]=_['keys'](_0x3db2a9['query']);_0x171ce9[_0xf2fa('0x3a')]=_[_0xf2fa('0x3b')](_0x171ce9['model'],_0x171ce9[_0xf2fa('0x38')]);_0x1f4281[_0xf2fa('0x3d')]=_[_0xf2fa('0x3b')](_0x171ce9[_0xf2fa('0x3c')],qs['fields'](_0x3db2a9['query'][_0xf2fa('0x3e')]));_0x1f4281[_0xf2fa('0x3d')]=_0x1f4281[_0xf2fa('0x3d')]['length']?_0x1f4281[_0xf2fa('0x3d')]:_0x171ce9[_0xf2fa('0x3c')];_0x1f4281[_0xf2fa('0x42')]=qs[_0xf2fa('0x43')](_0x3db2a9[_0xf2fa('0x38')]['sort']);_0x1f4281[_0xf2fa('0x44')]=qs[_0xf2fa('0x3a')](_[_0xf2fa('0x53')](_0x3db2a9[_0xf2fa('0x38')],_0x171ce9[_0xf2fa('0x3a')]));if(_0x3db2a9[_0xf2fa('0x38')]['filter']){_0x1f4281[_0xf2fa('0x44')]=_[_0xf2fa('0x46')](_0x1f4281[_0xf2fa('0x44')],{'$or':_[_0xf2fa('0x37')](_0x1f4281['attributes'],function(_0x32db25){var _0x1afa30={};_0x1afa30[_0x32db25]={'$like':'%'+_0x3db2a9['query'][_0xf2fa('0x45')]+'%'};return _0x1afa30;})});}_0x1f4281=_['merge']({},_0x1f4281,_0x3db2a9['options']);return _0x17d6a5['getDescriptions'](_0x1f4281);}})[_0xf2fa('0x30')](function(_0x595b68){if(_0x595b68){_0x24fc23=_0x595b68[_0xf2fa('0x4d')];if(!_0x3db2a9[_0xf2fa('0x38')][_0xf2fa('0x3f')](_0xf2fa('0x40'))){_0x1f4281['limit']=qs[_0xf2fa('0x41')](_0x3db2a9[_0xf2fa('0x38')][_0xf2fa('0x41')]);_0x1f4281[_0xf2fa('0x2a')]=qs['offset'](_0x3db2a9[_0xf2fa('0x38')]['offset']);}return _0x17d6a5[_0xf2fa('0x57')](_0x1f4281);}})[_0xf2fa('0x30')](function(_0x113c32){if(_0x113c32){return _0x113c32?{'count':_0x24fc23,'rows':_0x113c32}:null;}})[_0xf2fa('0x30')](respondWithResult(_0x5adebd,null))[_0xf2fa('0x25')](handleError(_0x5adebd,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 30651b3..f7db8f9 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe01b=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4a4a43,_0x115ccf){var _0x5893a6=function(_0x14c914){while(--_0x14c914){_0x4a4a43['push'](_0x4a4a43['shift']());}};_0x5893a6(++_0x115ccf);}(_0xe01b,0x7a));var _0xbe01=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0xe01b[_0x2d2ca2];return _0x48489d;};'use strict';var _=require(_0xbe01('0x0'));var util=require(_0xbe01('0x1'));var logger=require(_0xbe01('0x2'))(_0xbe01('0x3'));var moment=require('moment');var BPromise=require(_0xbe01('0x4'));var rp=require(_0xbe01('0x5'));var fs=require('fs');var path=require(_0xbe01('0x6'));var rimraf=require(_0xbe01('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x1d6b7f,_0x2a70dd){return _0x1d6b7f['define'](_0xbe01('0x8'),attributes,{'tableName':_0xbe01('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa03=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0xfa03,0x1aa));var _0x3fa0=function(_0x877a3d,_0x1202cb){_0x877a3d=_0x877a3d-0x0;var _0xe57699=_0xfa03[_0x877a3d];return _0xe57699;};'use strict';var _=require(_0x3fa0('0x0'));var util=require(_0x3fa0('0x1'));var logger=require(_0x3fa0('0x2'))(_0x3fa0('0x3'));var moment=require(_0x3fa0('0x4'));var BPromise=require(_0x3fa0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3fa0('0x6'));var config=require(_0x3fa0('0x7'));var attributes=require(_0x3fa0('0x8'));module[_0x3fa0('0x9')]=function(_0x40d71e,_0x5077c5){return _0x40d71e[_0x3fa0('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0x3fa0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 6b4677f..68be7ef 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72bf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x129a9a,_0x42d62f){var _0x3a1ac2=function(_0x1a9600){while(--_0x1a9600){_0x129a9a['push'](_0x129a9a['shift']());}};_0x3a1ac2(++_0x42d62f);}(_0x72bf,0x139));var _0xf72b=function(_0xb4e843,_0x2b7cef){_0xb4e843=_0xb4e843-0x0;var _0x1c2346=_0x72bf[_0xb4e843];return _0x1c2346;};'use strict';var _=require(_0xf72b('0x0'));var util=require(_0xf72b('0x1'));var moment=require(_0xf72b('0x2'));var BPromise=require(_0xf72b('0x3'));var rs=require(_0xf72b('0x4'));var fs=require('fs');var Redis=require(_0xf72b('0x5'));var db=require(_0xf72b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf72b('0x7'))('rpc');var config=require(_0xf72b('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5251e7,_0x4edaec,_0x58980e){return new BPromise(function(_0x5d0d9d,_0x1fe157){return client[_0xf72b('0x9')](_0x5251e7,_0x58980e)[_0xf72b('0xa')](function(_0x120834){logger[_0xf72b('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4edaec,_0xf72b('0xc'));logger['debug'](_0xf72b('0xd'),_0x4edaec,_0xf72b('0xc'),JSON[_0xf72b('0xe')](_0x120834));if(_0x120834['error']){if(_0x120834[_0xf72b('0xf')][_0xf72b('0x10')]===0x1f4){logger[_0xf72b('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4edaec,_0x120834[_0xf72b('0xf')][_0xf72b('0x11')]);return _0x1fe157(_0x120834['error'][_0xf72b('0x11')]);}logger[_0xf72b('0xf')](_0xf72b('0x12'),_0x4edaec,_0x120834['error'][_0xf72b('0x11')]);return _0x5d0d9d(_0x120834[_0xf72b('0xf')][_0xf72b('0x11')]);}else{logger[_0xf72b('0xb')](_0xf72b('0x12'),_0x4edaec,_0xf72b('0xc'));_0x5d0d9d(_0x120834[_0xf72b('0x13')][_0xf72b('0x11')]);}})[_0xf72b('0x14')](function(_0x4e9b48){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4edaec,_0x4e9b48);_0x1fe157(_0x4e9b48);});});} \ No newline at end of file +var _0x0880=['message','info','result','catch','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xf37f2,_0x4cef7c){var _0x1dbff0=function(_0x129f93){while(--_0x129f93){_0xf37f2['push'](_0xf37f2['shift']());}};_0x1dbff0(++_0x4cef7c);}(_0x0880,0xf4));var _0x0088=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x0880[_0x330414];return _0x99dbff;};'use strict';var _=require(_0x0088('0x0'));var util=require(_0x0088('0x1'));var moment=require(_0x0088('0x2'));var BPromise=require(_0x0088('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0088('0x4'))(_0x0088('0x5'));var config=require(_0x0088('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0088('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a5457,_0x106d18,_0x32ad43){return new BPromise(function(_0x11ca9d,_0x58603b){return client[_0x0088('0x8')](_0x5a5457,_0x32ad43)[_0x0088('0x9')](function(_0x1100ec){logger['info'](_0x0088('0xa'),_0x106d18,_0x0088('0xb'));logger[_0x0088('0xc')](_0x0088('0xd'),_0x106d18,_0x0088('0xb'),JSON[_0x0088('0xe')](_0x1100ec));if(_0x1100ec[_0x0088('0xf')]){if(_0x1100ec[_0x0088('0xf')]['code']===0x1f4){logger[_0x0088('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x106d18,_0x1100ec[_0x0088('0xf')][_0x0088('0x10')]);return _0x58603b(_0x1100ec[_0x0088('0xf')][_0x0088('0x10')]);}logger[_0x0088('0xf')](_0x0088('0xa'),_0x106d18,_0x1100ec[_0x0088('0xf')][_0x0088('0x10')]);return _0x11ca9d(_0x1100ec[_0x0088('0xf')][_0x0088('0x10')]);}else{logger[_0x0088('0x11')](_0x0088('0xa'),_0x106d18,_0x0088('0xb'));_0x11ca9d(_0x1100ec[_0x0088('0x12')][_0x0088('0x10')]);}})[_0x0088('0x13')](function(_0x5076db){logger[_0x0088('0xf')](_0x0088('0xa'),_0x106d18,_0x5076db);_0x58603b(_0x5076db);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index daac432..e247df5 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cc7=['../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','post','put','destroy','exports','multer','util','path','../../components/auth/service'];(function(_0x5aebf4,_0x4785c1){var _0x12cc54=function(_0x21a1a6){while(--_0x21a1a6){_0x5aebf4['push'](_0x5aebf4['shift']());}};_0x12cc54(++_0x4785c1);}(_0x1cc7,0x15a));var _0x71cc=function(_0x34d882,_0x16620d){_0x34d882=_0x34d882-0x0;var _0x7b279=_0x1cc7[_0x34d882];return _0x7b279;};'use strict';var multer=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var path=require(_0x71cc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x71cc('0x3'));var interaction=require(_0x71cc('0x4'));var config=require(_0x71cc('0x5'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x71cc('0x6')]);router['get'](_0x71cc('0x7'),auth[_0x71cc('0x8')](),controller[_0x71cc('0x9')]);router[_0x71cc('0xa')]('/',auth[_0x71cc('0x8')](),controller['create']);router[_0x71cc('0xb')](_0x71cc('0x7'),auth[_0x71cc('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x71cc('0xc')]);module[_0x71cc('0xd')]=router; \ No newline at end of file +var _0xb43b=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x31049e,_0x4b2b6c){var _0x48941a=function(_0x5700d6){while(--_0x5700d6){_0x31049e['push'](_0x31049e['shift']());}};_0x48941a(++_0x4b2b6c);}(_0xb43b,0xbf));var _0xbb43=function(_0x1010ef,_0x99d47c){_0x1010ef=_0x1010ef-0x0;var _0x2cbbc8=_0xb43b[_0x1010ef];return _0x2cbbc8;};'use strict';var multer=require(_0xbb43('0x0'));var util=require('util');var path=require(_0xbb43('0x1'));var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router[_0xbb43('0x9')]('/',auth[_0xbb43('0xa')](),controller[_0xbb43('0xb')]);router['get'](_0xbb43('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbb43('0xd')]('/',auth[_0xbb43('0xa')](),controller[_0xbb43('0xe')]);router[_0xbb43('0xf')](_0xbb43('0xc'),auth['isAuthenticated'](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),controller['destroy']);module[_0xbb43('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 74957b4..890728b 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.attributes.js +++ b/server/api/intDynamics365Field/intDynamics365Field.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4413=['variable','keyValue','STRING','customVariable','BOOLEAN','exports','ENUM','string'];(function(_0x532774,_0x49bbdd){var _0x577930=function(_0x2ff1b3){while(--_0x2ff1b3){_0x532774['push'](_0x532774['shift']());}};_0x577930(++_0x49bbdd);}(_0x4413,0x1b5));var _0x3441=function(_0x5d1ead,_0x1b448e){_0x5d1ead=_0x5d1ead-0x0;var _0x562eee=_0x4413[_0x5d1ead];return _0x562eee;};'use strict';var Sequelize=require('sequelize');module[_0x3441('0x0')]={'type':{'type':Sequelize[_0x3441('0x1')](_0x3441('0x2'),_0x3441('0x3'),'customVariable',_0x3441('0x4')),'defaultValue':_0x3441('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3441('0x5')]},'keyType':{'type':Sequelize[_0x3441('0x1')](_0x3441('0x2'),_0x3441('0x3'),_0x3441('0x6'))},'keyContent':{'type':Sequelize[_0x3441('0x5')]},'idField':{'type':Sequelize[_0x3441('0x5')]},'nameField':{'type':Sequelize[_0x3441('0x5')]},'customField':{'type':Sequelize[_0x3441('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3441('0x5')]}}; \ No newline at end of file +var _0x88f5=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x23212c,_0x471b91){var _0xbe8955=function(_0x51724c){while(--_0x51724c){_0x23212c['push'](_0x23212c['shift']());}};_0xbe8955(++_0x471b91);}(_0x88f5,0x79));var _0x588f=function(_0x174cd5,_0xf19a51){_0x174cd5=_0x174cd5-0x0;var _0x3e3cf8=_0x88f5[_0x174cd5];return _0x3e3cf8;};'use strict';var Sequelize=require(_0x588f('0x0'));module[_0x588f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x588f('0x2'),_0x588f('0x3'),_0x588f('0x4')),'defaultValue':_0x588f('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x588f('0x6')]},'keyType':{'type':Sequelize[_0x588f('0x7')](_0x588f('0x5'),_0x588f('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x588f('0x6')]},'idField':{'type':Sequelize[_0x588f('0x6')]},'nameField':{'type':Sequelize[_0x588f('0x6')]},'customField':{'type':Sequelize[_0x588f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x588f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c74a997..3ed8abc 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.controller.js +++ b/server/api/intDynamics365Field/intDynamics365Field.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32ef=['filter','options','Dynamics365Field','includeAll','include','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL'];(function(_0x3a4dd6,_0x53a178){var _0x6ac094=function(_0xb9dbf9){while(--_0xb9dbf9){_0x3a4dd6['push'](_0x3a4dd6['shift']());}};_0x6ac094(++_0x53a178);}(_0x32ef,0xf9));var _0xf32e=function(_0x23ac2b,_0x5d8e8a){_0x23ac2b=_0x23ac2b-0x0;var _0x230682=_0x32ef[_0x23ac2b];return _0x230682;};'use strict';var pdf=require(_0xf32e('0x0'));var emlformat=require(_0xf32e('0x1'));var rimraf=require(_0xf32e('0x2'));var zipdir=require(_0xf32e('0x3'));var jsonpatch=require(_0xf32e('0x4'));var rp=require(_0xf32e('0x5'));var moment=require('moment');var BPromise=require(_0xf32e('0x6'));var Mustache=require(_0xf32e('0x7'));var util=require('util');var path=require(_0xf32e('0x8'));var sox=require(_0xf32e('0x9'));var csv=require(_0xf32e('0xa'));var ejs=require(_0xf32e('0xb'));var fs=require('fs');var _=require(_0xf32e('0xc'));var squel=require(_0xf32e('0xd'));var crypto=require('crypto');var jsforce=require(_0xf32e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf32e('0xa'));var querystring=require(_0xf32e('0xf'));var Papa=require(_0xf32e('0x10'));var Redis=require(_0xf32e('0x11'));var authService=require(_0xf32e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf32e('0x13'));var hardwareService=require(_0xf32e('0x14'));var logger=require(_0xf32e('0x15'))(_0xf32e('0x16'));var utils=require(_0xf32e('0x17'));var config=require(_0xf32e('0x18'));var licenseUtil=require(_0xf32e('0x19'));var db=require(_0xf32e('0x1a'))['db'];function respondWithStatusCode(_0x319616,_0x1c1f52){_0x1c1f52=_0x1c1f52||0xcc;return function(_0xf7dc32){if(_0xf7dc32){return _0x319616['sendStatus'](_0x1c1f52);}return _0x319616[_0xf32e('0x1b')](_0x1c1f52)[_0xf32e('0x1c')]();};}function respondWithResult(_0x543072,_0x336e26){_0x336e26=_0x336e26||0xc8;return function(_0x35988d){if(_0x35988d){return _0x543072[_0xf32e('0x1b')](_0x336e26)['json'](_0x35988d);}};}function respondWithFilteredResult(_0xe324ad,_0x299efa){return function(_0x1dd008){if(_0x1dd008){var _0x400d25=_0x1dd008[_0xf32e('0x1d')],_0x43eedf=_0x299efa[_0xf32e('0x1e')],_0x417def=_0x299efa['offset']+_0x299efa[_0xf32e('0x1f')],_0x6a0231;if(_0x417def>=_0x400d25){_0x417def=_0x400d25;_0x6a0231=0xc8;}else{_0x6a0231=0xce;}_0xe324ad[_0xf32e('0x1b')](_0x6a0231);return _0xe324ad[_0xf32e('0x20')](_0xf32e('0x21'),_0x43eedf+'-'+_0x417def+'/'+_0x400d25)[_0xf32e('0x22')](_0x1dd008);}return null;};}function patchUpdates(_0x1f7a5e){return function(_0x2f909b){try{jsonpatch[_0xf32e('0x23')](_0x2f909b,_0x1f7a5e,!![]);}catch(_0xdd701b){return BPromise[_0xf32e('0x24')](_0xdd701b);}return _0x2f909b[_0xf32e('0x25')]();};}function saveUpdates(_0x1b169e,_0x3202e1){return function(_0x3c0d43){if(_0x3c0d43){return _0x3c0d43[_0xf32e('0x26')](_0x1b169e)['then'](function(_0x23552d){return _0x23552d;});}return null;};}function removeEntity(_0x57a8cb,_0x27b92c){return function(_0x2aaabf){if(_0x2aaabf){return _0x2aaabf[_0xf32e('0x27')]()[_0xf32e('0x28')](function(){_0x57a8cb[_0xf32e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227405,_0x4407f8){return function(_0x13d87a){if(!_0x13d87a){_0x227405[_0xf32e('0x29')](0x194);}return _0x13d87a;};}function handleError(_0x5e62eb,_0x173b77){_0x173b77=_0x173b77||0x1f4;return function(_0x1eb413){logger[_0xf32e('0x2a')](_0x1eb413[_0xf32e('0x2b')]);if(_0x1eb413[_0xf32e('0x2c')]){delete _0x1eb413[_0xf32e('0x2c')];}_0x5e62eb[_0xf32e('0x1b')](_0x173b77)[_0xf32e('0x2d')](_0x1eb413);};}exports[_0xf32e('0x2e')]=function(_0x29be62,_0x488489){var _0x3e6e6f={},_0x88eaa5={},_0x3b906c={'count':0x0,'rows':[]};var _0x4a873c=_[_0xf32e('0x2f')](db['Dynamics365Field'][_0xf32e('0x30')],function(_0x5c8779){return{'name':_0x5c8779[_0xf32e('0x31')],'type':_0x5c8779[_0xf32e('0x32')][_0xf32e('0x33')]};});_0x88eaa5[_0xf32e('0x34')]=_[_0xf32e('0x2f')](_0x4a873c,'name');_0x88eaa5[_0xf32e('0x35')]=_[_0xf32e('0x36')](_0x29be62[_0xf32e('0x35')]);_0x88eaa5['filters']=_[_0xf32e('0x37')](_0x88eaa5[_0xf32e('0x34')],_0x88eaa5[_0xf32e('0x35')]);_0x3e6e6f[_0xf32e('0x38')]=_[_0xf32e('0x37')](_0x88eaa5[_0xf32e('0x34')],qs[_0xf32e('0x39')](_0x29be62[_0xf32e('0x35')][_0xf32e('0x39')]));_0x3e6e6f[_0xf32e('0x38')]=_0x3e6e6f[_0xf32e('0x38')][_0xf32e('0x3a')]?_0x3e6e6f[_0xf32e('0x38')]:_0x88eaa5['model'];if(!_0x29be62[_0xf32e('0x35')]['hasOwnProperty'](_0xf32e('0x3b'))){_0x3e6e6f['limit']=qs['limit'](_0x29be62[_0xf32e('0x35')][_0xf32e('0x1f')]);_0x3e6e6f[_0xf32e('0x1e')]=qs[_0xf32e('0x1e')](_0x29be62[_0xf32e('0x35')]['offset']);}_0x3e6e6f[_0xf32e('0x3c')]=qs[_0xf32e('0x3d')](_0x29be62[_0xf32e('0x35')][_0xf32e('0x3d')]);_0x3e6e6f['where']=qs[_0xf32e('0x3e')](_[_0xf32e('0x3f')](_0x29be62[_0xf32e('0x35')],_0x88eaa5[_0xf32e('0x3e')]),_0x4a873c);if(_0x29be62[_0xf32e('0x35')]['filter']){_0x3e6e6f[_0xf32e('0x40')]=_[_0xf32e('0x41')](_0x3e6e6f[_0xf32e('0x40')],{'$or':_['map'](_0x4a873c,function(_0x1723e8){if(_0x1723e8['type']!==_0xf32e('0x42')){var _0x113b11={};_0x113b11[_0x1723e8[_0xf32e('0x2c')]]={'$like':'%'+_0x29be62['query'][_0xf32e('0x43')]+'%'};return _0x113b11;}})});}_0x3e6e6f=_[_0xf32e('0x41')]({},_0x3e6e6f,_0x29be62[_0xf32e('0x44')]);var _0x4a623={'where':_0x3e6e6f[_0xf32e('0x40')]};return db[_0xf32e('0x45')]['count'](_0x4a623)[_0xf32e('0x28')](function(_0x26ef18){_0x3b906c[_0xf32e('0x1d')]=_0x26ef18;if(_0x29be62[_0xf32e('0x35')][_0xf32e('0x46')]){_0x3e6e6f[_0xf32e('0x47')]=[{'all':!![]}];}return db[_0xf32e('0x45')]['findAll'](_0x3e6e6f);})[_0xf32e('0x28')](function(_0x160a30){_0x3b906c[_0xf32e('0x48')]=_0x160a30;return _0x3b906c;})[_0xf32e('0x28')](respondWithFilteredResult(_0x488489,_0x3e6e6f))[_0xf32e('0x49')](handleError(_0x488489,null));};exports[_0xf32e('0x4a')]=function(_0xb9d562,_0x546b80){var _0x1b38d7={'raw':!![],'where':{'id':_0xb9d562[_0xf32e('0x4b')]['id']}},_0x43882c={};_0x43882c[_0xf32e('0x34')]=_[_0xf32e('0x36')](db[_0xf32e('0x45')][_0xf32e('0x30')]);_0x43882c[_0xf32e('0x35')]=_[_0xf32e('0x36')](_0xb9d562[_0xf32e('0x35')]);_0x43882c['filters']=_[_0xf32e('0x37')](_0x43882c[_0xf32e('0x34')],_0x43882c[_0xf32e('0x35')]);_0x1b38d7[_0xf32e('0x38')]=_[_0xf32e('0x37')](_0x43882c[_0xf32e('0x34')],qs['fields'](_0xb9d562[_0xf32e('0x35')][_0xf32e('0x39')]));_0x1b38d7[_0xf32e('0x38')]=_0x1b38d7[_0xf32e('0x38')][_0xf32e('0x3a')]?_0x1b38d7['attributes']:_0x43882c[_0xf32e('0x34')];if(_0xb9d562['query'][_0xf32e('0x46')]){_0x1b38d7[_0xf32e('0x47')]=[{'all':!![]}];}_0x1b38d7=_['merge']({},_0x1b38d7,_0xb9d562[_0xf32e('0x44')]);return db['Dynamics365Field']['find'](_0x1b38d7)['then'](handleEntityNotFound(_0x546b80,null))[_0xf32e('0x28')](respondWithResult(_0x546b80,null))[_0xf32e('0x49')](handleError(_0x546b80,null));};exports[_0xf32e('0x4c')]=function(_0x6d2b3b,_0x36b74d){return db[_0xf32e('0x45')][_0xf32e('0x4c')](_0x6d2b3b[_0xf32e('0x4d')],{})[_0xf32e('0x28')](respondWithResult(_0x36b74d,0xc9))[_0xf32e('0x49')](handleError(_0x36b74d,null));};exports[_0xf32e('0x26')]=function(_0x1e81c4,_0x1f6758){if(_0x1e81c4[_0xf32e('0x4d')]['id']){delete _0x1e81c4['body']['id'];}return db[_0xf32e('0x45')][_0xf32e('0x4e')]({'where':{'id':_0x1e81c4[_0xf32e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1f6758,null))['then'](saveUpdates(_0x1e81c4['body'],null))[_0xf32e('0x28')](respondWithResult(_0x1f6758,null))[_0xf32e('0x49')](handleError(_0x1f6758,null));};exports['destroy']=function(_0x436b8a,_0x16a69b){return db['Dynamics365Field'][_0xf32e('0x4e')]({'where':{'id':_0x436b8a[_0xf32e('0x4b')]['id']}})[_0xf32e('0x28')](handleEntityNotFound(_0x16a69b,null))[_0xf32e('0x28')](removeEntity(_0x16a69b,null))[_0xf32e('0x49')](handleError(_0x16a69b,null));}; \ No newline at end of file +var _0x34e7=['Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','length','options','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','json','count','offset','limit','set'];(function(_0x1c76af,_0x196cda){var _0x4d2b7a=function(_0x1de888){while(--_0x1de888){_0x1c76af['push'](_0x1c76af['shift']());}};_0x4d2b7a(++_0x196cda);}(_0x34e7,0x161));var _0x734e=function(_0x5a3ec5,_0x71ae0f){_0x5a3ec5=_0x5a3ec5-0x0;var _0x5749de=_0x34e7[_0x5a3ec5];return _0x5749de;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x734e('0x0'));var rimraf=require(_0x734e('0x1'));var zipdir=require(_0x734e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x734e('0x3'));var moment=require('moment');var BPromise=require(_0x734e('0x4'));var Mustache=require(_0x734e('0x5'));var util=require(_0x734e('0x6'));var path=require(_0x734e('0x7'));var sox=require(_0x734e('0x8'));var csv=require(_0x734e('0x9'));var ejs=require(_0x734e('0xa'));var fs=require('fs');var _=require(_0x734e('0xb'));var squel=require(_0x734e('0xc'));var crypto=require(_0x734e('0xd'));var jsforce=require(_0x734e('0xe'));var deskjs=require(_0x734e('0xf'));var toCsv=require(_0x734e('0x9'));var querystring=require(_0x734e('0x10'));var Papa=require(_0x734e('0x11'));var Redis=require(_0x734e('0x12'));var authService=require(_0x734e('0x13'));var qs=require(_0x734e('0x14'));var as=require(_0x734e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x734e('0x16'))(_0x734e('0x17'));var utils=require(_0x734e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x734e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c0ff7,_0x4700b9){_0x4700b9=_0x4700b9||0xcc;return function(_0x334867){if(_0x334867){return _0x3c0ff7['sendStatus'](_0x4700b9);}return _0x3c0ff7[_0x734e('0x1a')](_0x4700b9)['end']();};}function respondWithResult(_0x642aa0,_0x3d039a){_0x3d039a=_0x3d039a||0xc8;return function(_0x54466e){if(_0x54466e){return _0x642aa0['status'](_0x3d039a)[_0x734e('0x1b')](_0x54466e);}};}function respondWithFilteredResult(_0x39145b,_0x267985){return function(_0x6cd0d7){if(_0x6cd0d7){var _0x292783=_0x6cd0d7[_0x734e('0x1c')],_0x2399af=_0x267985[_0x734e('0x1d')],_0x54c0a7=_0x267985[_0x734e('0x1d')]+_0x267985[_0x734e('0x1e')],_0xbf4c2b;if(_0x54c0a7>=_0x292783){_0x54c0a7=_0x292783;_0xbf4c2b=0xc8;}else{_0xbf4c2b=0xce;}_0x39145b['status'](_0xbf4c2b);return _0x39145b[_0x734e('0x1f')](_0x734e('0x20'),_0x2399af+'-'+_0x54c0a7+'/'+_0x292783)[_0x734e('0x1b')](_0x6cd0d7);}return null;};}function patchUpdates(_0x15fc99){return function(_0x40dcc7){try{jsonpatch[_0x734e('0x21')](_0x40dcc7,_0x15fc99,!![]);}catch(_0x47b41f){return BPromise[_0x734e('0x22')](_0x47b41f);}return _0x40dcc7['save']();};}function saveUpdates(_0x53da84,_0x30dad4){return function(_0x1d2794){if(_0x1d2794){return _0x1d2794[_0x734e('0x23')](_0x53da84)[_0x734e('0x24')](function(_0x496460){return _0x496460;});}return null;};}function removeEntity(_0x54db2c,_0x45fe35){return function(_0x2291a5){if(_0x2291a5){return _0x2291a5[_0x734e('0x25')]()[_0x734e('0x24')](function(){_0x54db2c[_0x734e('0x1a')](0xcc)[_0x734e('0x26')]();});}};}function handleEntityNotFound(_0x3a903c,_0x5b045){return function(_0x4ec0e7){if(!_0x4ec0e7){_0x3a903c[_0x734e('0x27')](0x194);}return _0x4ec0e7;};}function handleError(_0x35433d,_0x1e9fb1){_0x1e9fb1=_0x1e9fb1||0x1f4;return function(_0x5a39a7){logger[_0x734e('0x28')](_0x5a39a7[_0x734e('0x29')]);if(_0x5a39a7[_0x734e('0x2a')]){delete _0x5a39a7[_0x734e('0x2a')];}_0x35433d[_0x734e('0x1a')](_0x1e9fb1)[_0x734e('0x2b')](_0x5a39a7);};}exports[_0x734e('0x2c')]=function(_0x3562f7,_0x31831b){var _0x1340e0={},_0x41483e={},_0x546d30={'count':0x0,'rows':[]};var _0x526443=_['map'](db[_0x734e('0x2d')][_0x734e('0x2e')],function(_0x13305d){return{'name':_0x13305d[_0x734e('0x2f')],'type':_0x13305d[_0x734e('0x30')][_0x734e('0x31')]};});_0x41483e[_0x734e('0x32')]=_['map'](_0x526443,'name');_0x41483e['query']=_[_0x734e('0x33')](_0x3562f7[_0x734e('0x34')]);_0x41483e[_0x734e('0x35')]=_[_0x734e('0x36')](_0x41483e['model'],_0x41483e[_0x734e('0x34')]);_0x1340e0[_0x734e('0x37')]=_[_0x734e('0x36')](_0x41483e['model'],qs[_0x734e('0x38')](_0x3562f7[_0x734e('0x34')]['fields']));_0x1340e0['attributes']=_0x1340e0[_0x734e('0x37')]['length']?_0x1340e0[_0x734e('0x37')]:_0x41483e['model'];if(!_0x3562f7[_0x734e('0x34')][_0x734e('0x39')](_0x734e('0x3a'))){_0x1340e0[_0x734e('0x1e')]=qs[_0x734e('0x1e')](_0x3562f7[_0x734e('0x34')][_0x734e('0x1e')]);_0x1340e0[_0x734e('0x1d')]=qs[_0x734e('0x1d')](_0x3562f7[_0x734e('0x34')][_0x734e('0x1d')]);}_0x1340e0[_0x734e('0x3b')]=qs[_0x734e('0x3c')](_0x3562f7[_0x734e('0x34')][_0x734e('0x3c')]);_0x1340e0[_0x734e('0x3d')]=qs['filters'](_[_0x734e('0x3e')](_0x3562f7[_0x734e('0x34')],_0x41483e[_0x734e('0x35')]),_0x526443);if(_0x3562f7[_0x734e('0x34')][_0x734e('0x3f')]){_0x1340e0[_0x734e('0x3d')]=_[_0x734e('0x40')](_0x1340e0[_0x734e('0x3d')],{'$or':_[_0x734e('0x41')](_0x526443,function(_0x3d2bfb){if(_0x3d2bfb[_0x734e('0x30')]!==_0x734e('0x42')){var _0x3b9f1f={};_0x3b9f1f[_0x3d2bfb[_0x734e('0x2a')]]={'$like':'%'+_0x3562f7[_0x734e('0x34')][_0x734e('0x3f')]+'%'};return _0x3b9f1f;}})});}_0x1340e0=_[_0x734e('0x40')]({},_0x1340e0,_0x3562f7['options']);var _0x577e3d={'where':_0x1340e0['where']};return db[_0x734e('0x2d')][_0x734e('0x1c')](_0x577e3d)[_0x734e('0x24')](function(_0x7ef959){_0x546d30[_0x734e('0x1c')]=_0x7ef959;if(_0x3562f7[_0x734e('0x34')][_0x734e('0x43')]){_0x1340e0[_0x734e('0x44')]=[{'all':!![]}];}return db[_0x734e('0x2d')][_0x734e('0x45')](_0x1340e0);})[_0x734e('0x24')](function(_0xd4367c){_0x546d30[_0x734e('0x46')]=_0xd4367c;return _0x546d30;})[_0x734e('0x24')](respondWithFilteredResult(_0x31831b,_0x1340e0))[_0x734e('0x47')](handleError(_0x31831b,null));};exports['show']=function(_0x213590,_0x793d58){var _0x37e43b={'raw':!![],'where':{'id':_0x213590['params']['id']}},_0x1e21ee={};_0x1e21ee[_0x734e('0x32')]=_[_0x734e('0x33')](db[_0x734e('0x2d')][_0x734e('0x2e')]);_0x1e21ee[_0x734e('0x34')]=_[_0x734e('0x33')](_0x213590[_0x734e('0x34')]);_0x1e21ee[_0x734e('0x35')]=_[_0x734e('0x36')](_0x1e21ee['model'],_0x1e21ee[_0x734e('0x34')]);_0x37e43b[_0x734e('0x37')]=_[_0x734e('0x36')](_0x1e21ee[_0x734e('0x32')],qs[_0x734e('0x38')](_0x213590[_0x734e('0x34')]['fields']));_0x37e43b['attributes']=_0x37e43b[_0x734e('0x37')][_0x734e('0x48')]?_0x37e43b[_0x734e('0x37')]:_0x1e21ee[_0x734e('0x32')];if(_0x213590[_0x734e('0x34')][_0x734e('0x43')]){_0x37e43b[_0x734e('0x44')]=[{'all':!![]}];}_0x37e43b=_['merge']({},_0x37e43b,_0x213590[_0x734e('0x49')]);return db[_0x734e('0x2d')]['find'](_0x37e43b)['then'](handleEntityNotFound(_0x793d58,null))['then'](respondWithResult(_0x793d58,null))[_0x734e('0x47')](handleError(_0x793d58,null));};exports['create']=function(_0x591d7b,_0x63725c){return db['Dynamics365Field'][_0x734e('0x4a')](_0x591d7b[_0x734e('0x4b')],{})[_0x734e('0x24')](respondWithResult(_0x63725c,0xc9))[_0x734e('0x47')](handleError(_0x63725c,null));};exports[_0x734e('0x23')]=function(_0x48b298,_0x2615c9){if(_0x48b298[_0x734e('0x4b')]['id']){delete _0x48b298[_0x734e('0x4b')]['id'];}return db[_0x734e('0x2d')]['find']({'where':{'id':_0x48b298[_0x734e('0x4c')]['id']}})[_0x734e('0x24')](handleEntityNotFound(_0x2615c9,null))[_0x734e('0x24')](saveUpdates(_0x48b298[_0x734e('0x4b')],null))['then'](respondWithResult(_0x2615c9,null))['catch'](handleError(_0x2615c9,null));};exports[_0x734e('0x25')]=function(_0x55b250,_0x163921){return db[_0x734e('0x2d')]['find']({'where':{'id':_0x55b250[_0x734e('0x4c')]['id']}})[_0x734e('0x24')](handleEntityNotFound(_0x163921,null))[_0x734e('0x24')](removeEntity(_0x163921,null))[_0x734e('0x47')](handleError(_0x163921,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2eccace..fa4df26 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.model.js +++ b/server/api/intDynamics365Field/intDynamics365Field.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5963=['./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5963,0x157));var _0x3596=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5963[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3596('0x0'));var util=require(_0x3596('0x1'));var logger=require(_0x3596('0x2'))(_0x3596('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3596('0x4'));var attributes=require(_0x3596('0x5'));module[_0x3596('0x6')]=function(_0x4eb7f7,_0xf82779){return _0x4eb7f7['define'](_0x3596('0x7'),attributes,{'tableName':_0x3596('0x8'),'paranoid':![],'indexes':[{'name':_0x3596('0x9'),'fields':[_0x3596('0xa'),_0x3596('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2af0=['exports','define','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x46c95d,_0x56ad25){var _0x4211f4=function(_0x180210){while(--_0x180210){_0x46c95d['push'](_0x46c95d['shift']());}};_0x4211f4(++_0x56ad25);}(_0x2af0,0xe1));var _0x02af=function(_0x65bf20,_0xa669ce){_0x65bf20=_0x65bf20-0x0;var _0x43cfb1=_0x2af0[_0x65bf20];return _0x43cfb1;};'use strict';var _=require(_0x02af('0x0'));var util=require(_0x02af('0x1'));var logger=require(_0x02af('0x2'))('api');var moment=require(_0x02af('0x3'));var BPromise=require(_0x02af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x02af('0x5')]=function(_0x49b68a,_0x585e05){return _0x49b68a[_0x02af('0x6')]('Dynamics365Field',attributes,{'tableName':_0x02af('0x7'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x02af('0x8'),_0x02af('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index ed19ad9..f393a94 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f7a=['../../config/environment','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','rpc'];(function(_0xd04958,_0x433bd9){var _0x44048e=function(_0x2de80c){while(--_0x2de80c){_0xd04958['push'](_0xd04958['shift']());}};_0x44048e(++_0x433bd9);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x9f7a[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var moment=require(_0xa9f7('0x2'));var BPromise=require(_0xa9f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9f7('0x5'));var config=require(_0xa9f7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5497c8,_0x48e791,_0x5bf7ca){return new BPromise(function(_0x21010f,_0x58a3f3){return client[_0xa9f7('0x8')](_0x5497c8,_0x5bf7ca)[_0xa9f7('0x9')](function(_0x287478){logger['info'](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));logger['debug'](_0xa9f7('0xc'),_0x48e791,_0xa9f7('0xb'),JSON[_0xa9f7('0xd')](_0x287478));if(_0x287478[_0xa9f7('0xe')]){if(_0x287478[_0xa9f7('0xe')][_0xa9f7('0xf')]===0x1f4){logger[_0xa9f7('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x48e791,_0x287478[_0xa9f7('0xe')]['message']);return _0x58a3f3(_0x287478[_0xa9f7('0xe')][_0xa9f7('0x10')]);}logger[_0xa9f7('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x48e791,_0x287478['error'][_0xa9f7('0x10')]);return _0x21010f(_0x287478['error']['message']);}else{logger[_0xa9f7('0x11')](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));_0x21010f(_0x287478['result'][_0xa9f7('0x10')]);}})[_0xa9f7('0x12')](function(_0x2aeadd){logger['error'](_0xa9f7('0xa'),_0x48e791,_0x2aeadd);_0x58a3f3(_0x2aeadd);});});} \ No newline at end of file +var _0xd9eb=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x58d72c,_0x4bf853){var _0x501b9e=function(_0x499c12){while(--_0x499c12){_0x58d72c['push'](_0x58d72c['shift']());}};_0x501b9e(++_0x4bf853);}(_0xd9eb,0xca));var _0xbd9e=function(_0x5bb0ba,_0x3a1803){_0x5bb0ba=_0x5bb0ba-0x0;var _0x551a4e=_0xd9eb[_0x5bb0ba];return _0x551a4e;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var moment=require(_0xbd9e('0x2'));var BPromise=require(_0xbd9e('0x3'));var rs=require(_0xbd9e('0x4'));var fs=require('fs');var Redis=require(_0xbd9e('0x5'));var db=require(_0xbd9e('0x6'))['db'];var utils=require(_0xbd9e('0x7'));var logger=require(_0xbd9e('0x8'))(_0xbd9e('0x9'));var config=require(_0xbd9e('0xa'));var jayson=require(_0xbd9e('0xb'));var client=jayson[_0xbd9e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26408d,_0x37d9a1,_0x293a79){return new BPromise(function(_0x2dbf84,_0x20cddf){return client[_0xbd9e('0xd')](_0x26408d,_0x293a79)[_0xbd9e('0xe')](function(_0x82e476){logger[_0xbd9e('0xf')](_0xbd9e('0x10'),_0x37d9a1,_0xbd9e('0x11'));logger[_0xbd9e('0x12')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x37d9a1,_0xbd9e('0x11'),JSON[_0xbd9e('0x13')](_0x82e476));if(_0x82e476['error']){if(_0x82e476[_0xbd9e('0x14')]['code']===0x1f4){logger[_0xbd9e('0x14')](_0xbd9e('0x10'),_0x37d9a1,_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);return _0x20cddf(_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);}logger[_0xbd9e('0x14')](_0xbd9e('0x10'),_0x37d9a1,_0x82e476['error'][_0xbd9e('0x15')]);return _0x2dbf84(_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);}else{logger[_0xbd9e('0xf')](_0xbd9e('0x10'),_0x37d9a1,_0xbd9e('0x11'));_0x2dbf84(_0x82e476[_0xbd9e('0x16')][_0xbd9e('0x15')]);}})[_0xbd9e('0x17')](function(_0x42e634){logger[_0xbd9e('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x37d9a1,_0x42e634);_0x20cddf(_0x42e634);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a163bbc..5b36319 100644 --- a/server/api/intFreshdeskAccount/index.js +++ b/server/api/intFreshdeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a4c=['../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x14e759,_0x361daf){var _0x1d7e8b=function(_0x79654d){while(--_0x79654d){_0x14e759['push'](_0x14e759['shift']());}};_0x1d7e8b(++_0x361daf);}(_0x2a4c,0x199));var _0xc2a4=function(_0x2c9885,_0x5536cb){_0x2c9885=_0x2c9885-0x0;var _0x5f3133=_0x2a4c[_0x2c9885];return _0x5f3133;};'use strict';var multer=require(_0xc2a4('0x0'));var util=require('util');var path=require(_0xc2a4('0x1'));var timeout=require(_0xc2a4('0x2'));var express=require(_0xc2a4('0x3'));var router=express[_0xc2a4('0x4')]();var auth=require(_0xc2a4('0x5'));var interaction=require(_0xc2a4('0x6'));var config=require(_0xc2a4('0x7'));var controller=require(_0xc2a4('0x8'));router[_0xc2a4('0x9')]('/',auth[_0xc2a4('0xa')](),controller[_0xc2a4('0xb')]);router[_0xc2a4('0x9')](_0xc2a4('0xc'),auth['isAuthenticated'](),controller[_0xc2a4('0xd')]);router['get'](_0xc2a4('0xe'),auth['isAuthenticated'](),controller[_0xc2a4('0xf')]);router[_0xc2a4('0x9')](_0xc2a4('0x10'),auth[_0xc2a4('0xa')](),controller[_0xc2a4('0x11')]);router[_0xc2a4('0x12')]('/',auth[_0xc2a4('0xa')](),controller[_0xc2a4('0x13')]);router[_0xc2a4('0x12')](_0xc2a4('0xe'),auth['isAuthenticated'](),controller[_0xc2a4('0x14')]);router[_0xc2a4('0x15')](_0xc2a4('0xc'),auth['isAuthenticated'](),controller[_0xc2a4('0x16')]);router[_0xc2a4('0x17')](_0xc2a4('0xc'),auth['isAuthenticated'](),controller[_0xc2a4('0x18')]);module[_0xc2a4('0x19')]=router; \ No newline at end of file +var _0x1c13=['getFields','post','/:id','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intFreshdeskAccount.controller','isAuthenticated','show','/:id/configurations','getConfigurations','get'];(function(_0x5b8a99,_0x2e0c12){var _0x31fa01=function(_0x21396c){while(--_0x21396c){_0x5b8a99['push'](_0x5b8a99['shift']());}};_0x31fa01(++_0x2e0c12);}(_0x1c13,0x9e));var _0x31c1=function(_0x1b1999,_0x393b2b){_0x1b1999=_0x1b1999-0x0;var _0x1c1ae5=_0x1c13[_0x1b1999];return _0x1c1ae5;};'use strict';var multer=require(_0x31c1('0x0'));var util=require(_0x31c1('0x1'));var path=require(_0x31c1('0x2'));var timeout=require(_0x31c1('0x3'));var express=require('express');var router=express[_0x31c1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x31c1('0x5'));var config=require('../../config/environment');var controller=require(_0x31c1('0x6'));router['get']('/',auth[_0x31c1('0x7')](),controller['index']);router['get']('/:id',auth[_0x31c1('0x7')](),controller[_0x31c1('0x8')]);router['get'](_0x31c1('0x9'),auth['isAuthenticated'](),controller[_0x31c1('0xa')]);router[_0x31c1('0xb')]('/:id/fields',auth[_0x31c1('0x7')](),controller[_0x31c1('0xc')]);router[_0x31c1('0xd')]('/',auth[_0x31c1('0x7')](),controller['create']);router[_0x31c1('0xd')](_0x31c1('0x9'),auth[_0x31c1('0x7')](),controller['addConfiguration']);router['put'](_0x31c1('0xe'),auth['isAuthenticated'](),controller[_0x31c1('0xf')]);router['delete']('/:id',auth[_0x31c1('0x7')](),controller['destroy']);module[_0x31c1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7c979f6..822c8a3 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fc1=['exports','STRING','username','remoteUri','sequelize'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x2fc1,0x176));var _0x12fc=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2fc1[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x12fc('0x0'));module[_0x12fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x12fc('0x2')]},'username':{'type':Sequelize[_0x12fc('0x2')],'unique':_0x12fc('0x3')},'apiKey':{'type':Sequelize[_0x12fc('0x2')]},'remoteUri':{'type':Sequelize[_0x12fc('0x2')],'unique':_0x12fc('0x4')},'serverUrl':{'type':Sequelize[_0x12fc('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x786e=['STRING','username','sequelize','exports'];(function(_0x36e915,_0x41e5da){var _0x19fc7b=function(_0x4c0e34){while(--_0x4c0e34){_0x36e915['push'](_0x36e915['shift']());}};_0x19fc7b(++_0x41e5da);}(_0x786e,0x1b2));var _0xe786=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x786e[_0x93942f];return _0x23fcd8;};'use strict';var Sequelize=require(_0xe786('0x0'));module[_0xe786('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe786('0x2')]},'username':{'type':Sequelize[_0xe786('0x2')],'unique':_0xe786('0x3')},'apiKey':{'type':Sequelize[_0xe786('0x2')]},'remoteUri':{'type':Sequelize[_0xe786('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe786('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index ea29a56..7e5a328 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa679=['sendStatus','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','intersection','length','catch','create','body','find','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject','priority','source','ticket_type','group','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','FreshdeskAccount,\x20%s,\x20%s','status','json','count','offset','limit','set','apply','reject','save','update','destroy','end'];(function(_0x51a970,_0xcd4a22){var _0xdd4315=function(_0x222142){while(--_0x222142){_0x51a970['push'](_0x51a970['shift']());}};_0xdd4315(++_0xcd4a22);}(_0xa679,0x13b));var _0x9a67=function(_0x153a9d,_0x1fb089){_0x153a9d=_0x153a9d-0x0;var _0x591a59=_0xa679[_0x153a9d];return _0x591a59;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a67('0x0'));var rimraf=require(_0x9a67('0x1'));var zipdir=require(_0x9a67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a67('0x3'));var moment=require(_0x9a67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9a67('0x5'));var util=require(_0x9a67('0x6'));var path=require(_0x9a67('0x7'));var sox=require(_0x9a67('0x8'));var csv=require('to-csv');var ejs=require(_0x9a67('0x9'));var fs=require('fs');var _=require(_0x9a67('0xa'));var squel=require(_0x9a67('0xb'));var crypto=require(_0x9a67('0xc'));var jsforce=require(_0x9a67('0xd'));var deskjs=require(_0x9a67('0xe'));var toCsv=require(_0x9a67('0xf'));var querystring=require(_0x9a67('0x10'));var Papa=require(_0x9a67('0x11'));var Redis=require(_0x9a67('0x12'));var authService=require(_0x9a67('0x13'));var qs=require(_0x9a67('0x14'));var as=require(_0x9a67('0x15'));var hardwareService=require(_0x9a67('0x16'));var logger=require('../../config/logger')(_0x9a67('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9a67('0x18'));var db=require(_0x9a67('0x19'))['db'];var integrations=require(_0x9a67('0x1a'));var jayson=require(_0x9a67('0x1b'));var client=jayson['client'][_0x9a67('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x59ab2c,_0x323752,_0x2df063,_0x38850a){return new BPromise(function(_0x480d0c,_0x9b5b0){var _0x159d30=_0x38850a||client;return _0x159d30[_0x9a67('0x1d')](_0x59ab2c,_0x2df063)[_0x9a67('0x1e')](function(_0x399866){logger[_0x9a67('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0x323752,_0x9a67('0x20'));logger[_0x9a67('0x21')](_0x9a67('0x22'),_0x323752,'request\x20sent',JSON['stringify'](_0x399866));if(_0x399866[_0x9a67('0x23')]){if(_0x399866['error'][_0x9a67('0x24')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x323752,_0x399866[_0x9a67('0x23')][_0x9a67('0x25')]);return _0x9b5b0(_0x399866[_0x9a67('0x23')][_0x9a67('0x25')]);}logger[_0x9a67('0x23')](_0x9a67('0x26'),_0x323752,_0x399866['error'][_0x9a67('0x25')]);return _0x480d0c(_0x399866[_0x9a67('0x23')][_0x9a67('0x25')]);}else{logger[_0x9a67('0x1f')](_0x9a67('0x26'),_0x323752,_0x9a67('0x20'));_0x480d0c(_0x399866['result']['message']);}})['catch'](function(_0x31fd89){logger[_0x9a67('0x23')](_0x9a67('0x26'),_0x323752,_0x31fd89);_0x9b5b0(_0x31fd89);});});}function respondWithStatusCode(_0x50e036,_0x1e46ce){_0x1e46ce=_0x1e46ce||0xcc;return function(_0x55a371){if(_0x55a371){return _0x50e036['sendStatus'](_0x1e46ce);}return _0x50e036[_0x9a67('0x27')](_0x1e46ce)['end']();};}function respondWithResult(_0x2c8723,_0x597845){_0x597845=_0x597845||0xc8;return function(_0x122e4a){if(_0x122e4a){return _0x2c8723[_0x9a67('0x27')](_0x597845)[_0x9a67('0x28')](_0x122e4a);}};}function respondWithFilteredResult(_0x50cf71,_0x515069){return function(_0x4ac232){if(_0x4ac232){var _0x292c0a=_0x4ac232[_0x9a67('0x29')],_0x50d8a8=_0x515069[_0x9a67('0x2a')],_0x285c3f=_0x515069[_0x9a67('0x2a')]+_0x515069[_0x9a67('0x2b')],_0x774e0d;if(_0x285c3f>=_0x292c0a){_0x285c3f=_0x292c0a;_0x774e0d=0xc8;}else{_0x774e0d=0xce;}_0x50cf71[_0x9a67('0x27')](_0x774e0d);return _0x50cf71[_0x9a67('0x2c')]('Content-Range',_0x50d8a8+'-'+_0x285c3f+'/'+_0x292c0a)[_0x9a67('0x28')](_0x4ac232);}return null;};}function patchUpdates(_0x45e016){return function(_0x3ddbbd){try{jsonpatch[_0x9a67('0x2d')](_0x3ddbbd,_0x45e016,!![]);}catch(_0x10f640){return BPromise[_0x9a67('0x2e')](_0x10f640);}return _0x3ddbbd[_0x9a67('0x2f')]();};}function saveUpdates(_0x426569,_0x40d37e){return function(_0x9928a2){if(_0x9928a2){return _0x9928a2[_0x9a67('0x30')](_0x426569)[_0x9a67('0x1e')](function(_0x5c8b8d){return _0x5c8b8d;});}return null;};}function removeEntity(_0x190182,_0x4c51c5){return function(_0x2958c9){if(_0x2958c9){return _0x2958c9[_0x9a67('0x31')]()[_0x9a67('0x1e')](function(){_0x190182['status'](0xcc)[_0x9a67('0x32')]();});}};}function handleEntityNotFound(_0x1c3437,_0x192e92){return function(_0x1b51ca){if(!_0x1b51ca){_0x1c3437[_0x9a67('0x33')](0x194);}return _0x1b51ca;};}function handleError(_0x5e58d1,_0xa6c129){_0xa6c129=_0xa6c129||0x1f4;return function(_0x4da197){logger[_0x9a67('0x23')](_0x4da197['stack']);if(_0x4da197[_0x9a67('0x34')]){delete _0x4da197['name'];}_0x5e58d1[_0x9a67('0x27')](_0xa6c129)[_0x9a67('0x35')](_0x4da197);};}exports[_0x9a67('0x36')]=function(_0x4c37b6,_0x3f148b){var _0x4be1cb={},_0x3d3463={},_0x338fdf={'count':0x0,'rows':[]};var _0x3e1f0c=_[_0x9a67('0x37')](db[_0x9a67('0x38')][_0x9a67('0x39')],function(_0x4da527){return{'name':_0x4da527[_0x9a67('0x3a')],'type':_0x4da527[_0x9a67('0x3b')]['key']};});_0x3d3463[_0x9a67('0x3c')]=_[_0x9a67('0x37')](_0x3e1f0c,_0x9a67('0x34'));_0x3d3463['query']=_[_0x9a67('0x3d')](_0x4c37b6[_0x9a67('0x3e')]);_0x3d3463[_0x9a67('0x3f')]=_['intersection'](_0x3d3463[_0x9a67('0x3c')],_0x3d3463[_0x9a67('0x3e')]);_0x4be1cb[_0x9a67('0x40')]=_['intersection'](_0x3d3463[_0x9a67('0x3c')],qs[_0x9a67('0x41')](_0x4c37b6[_0x9a67('0x3e')][_0x9a67('0x41')]));_0x4be1cb[_0x9a67('0x40')]=_0x4be1cb[_0x9a67('0x40')]['length']?_0x4be1cb[_0x9a67('0x40')]:_0x3d3463['model'];if(!_0x4c37b6[_0x9a67('0x3e')]['hasOwnProperty'](_0x9a67('0x42'))){_0x4be1cb[_0x9a67('0x2b')]=qs['limit'](_0x4c37b6[_0x9a67('0x3e')]['limit']);_0x4be1cb['offset']=qs[_0x9a67('0x2a')](_0x4c37b6[_0x9a67('0x3e')][_0x9a67('0x2a')]);}_0x4be1cb[_0x9a67('0x43')]=qs['sort'](_0x4c37b6[_0x9a67('0x3e')][_0x9a67('0x44')]);_0x4be1cb[_0x9a67('0x45')]=qs['filters'](_[_0x9a67('0x46')](_0x4c37b6[_0x9a67('0x3e')],_0x3d3463[_0x9a67('0x3f')]),_0x3e1f0c);if(_0x4c37b6['query'][_0x9a67('0x47')]){_0x4be1cb[_0x9a67('0x45')]=_[_0x9a67('0x48')](_0x4be1cb[_0x9a67('0x45')],{'$or':_[_0x9a67('0x37')](_0x3e1f0c,function(_0x35d5d8){if(_0x35d5d8['type']!==_0x9a67('0x49')){var _0x3aabbf={};_0x3aabbf[_0x35d5d8[_0x9a67('0x34')]]={'$like':'%'+_0x4c37b6[_0x9a67('0x3e')][_0x9a67('0x47')]+'%'};return _0x3aabbf;}})});}_0x4be1cb=_[_0x9a67('0x48')]({},_0x4be1cb,_0x4c37b6[_0x9a67('0x4a')]);var _0x3fe8ed={'where':_0x4be1cb[_0x9a67('0x45')]};return db[_0x9a67('0x38')]['count'](_0x3fe8ed)['then'](function(_0x753915){_0x338fdf[_0x9a67('0x29')]=_0x753915;if(_0x4c37b6[_0x9a67('0x3e')][_0x9a67('0x4b')]){_0x4be1cb[_0x9a67('0x4c')]=[{'all':!![]}];}return db[_0x9a67('0x38')]['findAll'](_0x4be1cb);})[_0x9a67('0x1e')](function(_0x20821e){_0x338fdf[_0x9a67('0x4d')]=_0x20821e;return _0x338fdf;})[_0x9a67('0x1e')](respondWithFilteredResult(_0x3f148b,_0x4be1cb))['catch'](handleError(_0x3f148b,null));};exports['show']=function(_0x105111,_0x4b6774){var _0x3c98ee={'raw':![],'where':{'id':_0x105111[_0x9a67('0x4e')]['id']}},_0x498cd7={};_0x498cd7['model']=_['keys'](db[_0x9a67('0x38')][_0x9a67('0x39')]);_0x498cd7['query']=_[_0x9a67('0x3d')](_0x105111[_0x9a67('0x3e')]);_0x498cd7[_0x9a67('0x3f')]=_['intersection'](_0x498cd7[_0x9a67('0x3c')],_0x498cd7[_0x9a67('0x3e')]);_0x3c98ee[_0x9a67('0x40')]=_[_0x9a67('0x4f')](_0x498cd7[_0x9a67('0x3c')],qs[_0x9a67('0x41')](_0x105111[_0x9a67('0x3e')]['fields']));_0x3c98ee['attributes']=_0x3c98ee[_0x9a67('0x40')][_0x9a67('0x50')]?_0x3c98ee[_0x9a67('0x40')]:_0x498cd7[_0x9a67('0x3c')];if(_0x105111['query']['includeAll']){_0x3c98ee['include']=[{'all':!![]}];}_0x3c98ee=_[_0x9a67('0x48')]({},_0x3c98ee,_0x105111['options']);return db[_0x9a67('0x38')]['find'](_0x3c98ee)['then'](handleEntityNotFound(_0x4b6774,null))[_0x9a67('0x1e')](respondWithResult(_0x4b6774,null))[_0x9a67('0x51')](handleError(_0x4b6774,null));};exports['create']=function(_0x327905,_0x44bb7b){return db[_0x9a67('0x38')][_0x9a67('0x52')](_0x327905[_0x9a67('0x53')],{})[_0x9a67('0x1e')](respondWithResult(_0x44bb7b,0xc9))[_0x9a67('0x51')](handleError(_0x44bb7b,null));};exports[_0x9a67('0x30')]=function(_0x3b094e,_0x2c8c7d){if(_0x3b094e[_0x9a67('0x53')]['id']){delete _0x3b094e[_0x9a67('0x53')]['id'];}return db[_0x9a67('0x38')][_0x9a67('0x54')]({'where':{'id':_0x3b094e['params']['id']}})[_0x9a67('0x1e')](handleEntityNotFound(_0x2c8c7d,null))[_0x9a67('0x1e')](saveUpdates(_0x3b094e[_0x9a67('0x53')],null))['then'](respondWithResult(_0x2c8c7d,null))[_0x9a67('0x51')](handleError(_0x2c8c7d,null));};exports['destroy']=function(_0x14c10b,_0x105ef3){return db[_0x9a67('0x38')][_0x9a67('0x54')]({'where':{'id':_0x14c10b[_0x9a67('0x4e')]['id']}})[_0x9a67('0x1e')](handleEntityNotFound(_0x105ef3,null))['then'](removeEntity(_0x105ef3,null))['catch'](handleError(_0x105ef3,null));};exports[_0x9a67('0x55')]=function(_0x565ee0,_0x10dbd3,_0x2cd6bf){var _0x107a50={};var _0x16651f={};var _0x374ed0;var _0x2c3ff3;return db[_0x9a67('0x38')]['findOne']({'where':{'id':_0x565ee0[_0x9a67('0x4e')]['id']}})[_0x9a67('0x1e')](handleEntityNotFound(_0x10dbd3,null))['then'](function(_0x333c7b){if(_0x333c7b){_0x374ed0=_0x333c7b;_0x16651f[_0x9a67('0x3c')]=_[_0x9a67('0x3d')](db[_0x9a67('0x56')][_0x9a67('0x39')]);_0x16651f[_0x9a67('0x3e')]=_[_0x9a67('0x3d')](_0x565ee0['query']);_0x16651f[_0x9a67('0x3f')]=_[_0x9a67('0x4f')](_0x16651f[_0x9a67('0x3c')],_0x16651f['query']);_0x107a50[_0x9a67('0x40')]=_['intersection'](_0x16651f['model'],qs[_0x9a67('0x41')](_0x565ee0[_0x9a67('0x3e')][_0x9a67('0x41')]));_0x107a50['attributes']=_0x107a50[_0x9a67('0x40')]['length']?_0x107a50[_0x9a67('0x40')]:_0x16651f['model'];_0x107a50[_0x9a67('0x43')]=qs[_0x9a67('0x44')](_0x565ee0[_0x9a67('0x3e')][_0x9a67('0x44')]);_0x107a50['where']=qs[_0x9a67('0x3f')](_[_0x9a67('0x46')](_0x565ee0['query'],_0x16651f['filters']));if(_0x565ee0['query'][_0x9a67('0x47')]){_0x107a50[_0x9a67('0x45')]=_[_0x9a67('0x48')](_0x107a50[_0x9a67('0x45')],{'$or':_['map'](_0x107a50[_0x9a67('0x40')],function(_0x4667a3){var _0x3d8c69={};_0x3d8c69[_0x4667a3]={'$like':'%'+_0x565ee0[_0x9a67('0x3e')][_0x9a67('0x47')]+'%'};return _0x3d8c69;})});}_0x107a50=_[_0x9a67('0x48')]({},_0x107a50,_0x565ee0[_0x9a67('0x4a')]);return _0x374ed0['getConfigurations'](_0x107a50);}})[_0x9a67('0x1e')](function(_0xdd1c45){if(_0xdd1c45){_0x2c3ff3=_0xdd1c45['length'];if(!_0x565ee0['query']['hasOwnProperty'](_0x9a67('0x42'))){_0x107a50[_0x9a67('0x2b')]=qs[_0x9a67('0x2b')](_0x565ee0[_0x9a67('0x3e')][_0x9a67('0x2b')]);_0x107a50[_0x9a67('0x2a')]=qs['offset'](_0x565ee0['query']['offset']);}return _0x374ed0['getConfigurations'](_0x107a50);}})[_0x9a67('0x1e')](function(_0x50b64b){if(_0x50b64b){return _0x50b64b?{'count':_0x2c3ff3,'rows':_0x50b64b}:null;}})['then'](respondWithResult(_0x10dbd3,null))[_0x9a67('0x51')](handleError(_0x10dbd3,null));};exports[_0x9a67('0x57')]=function(_0x3ae73f,_0x519721,_0x374823){if(_0x3ae73f[_0x9a67('0x53')]['id']){delete _0x3ae73f[_0x9a67('0x53')]['id'];}return db['FreshdeskAccount'][_0x9a67('0x58')]({'where':{'id':_0x3ae73f['params']['id']}})['then'](handleEntityNotFound(_0x519721,null))[_0x9a67('0x1e')](function(_0x26164c){if(_0x26164c){_0x3ae73f[_0x9a67('0x53')]['AccountId']=_0x26164c['id'];_0x3ae73f[_0x9a67('0x53')][_0x9a67('0x59')]=integrations['getSubjects'](_0x3ae73f[_0x9a67('0x53')][_0x9a67('0x5a')],_0x3ae73f[_0x9a67('0x53')][_0x9a67('0x3b')]);_0x3ae73f['body'][_0x9a67('0x5b')]=integrations[_0x9a67('0x5c')](_0x3ae73f[_0x9a67('0x53')][_0x9a67('0x5a')],_0x3ae73f[_0x9a67('0x53')][_0x9a67('0x3b')]);return db['FreshdeskConfiguration'][_0x9a67('0x52')](_0x3ae73f[_0x9a67('0x53')],{'include':[{'model':db[_0x9a67('0x5d')],'as':_0x9a67('0x59')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x9a67('0x1e')](respondWithResult(_0x519721,null))[_0x9a67('0x51')](handleError(_0x519721,null));};exports[_0x9a67('0x5e')]=function(_0x5592e4,_0x5c4f4a,_0x1681d9){var _0x47591d='';return db['FreshdeskAccount'][_0x9a67('0x58')]({'where':{'id':_0x5592e4[_0x9a67('0x4e')]['id']},'attributes':['id','remoteUri',_0x9a67('0x5f')]})[_0x9a67('0x1e')](handleEntityNotFound(_0x5c4f4a,null))[_0x9a67('0x1e')](function(_0x3613a2){if(_0x3613a2){_0x47591d=_0x3613a2[_0x9a67('0x60')];var _0x21aa18=_0x47591d[_0x9a67('0x61')](-0x1);if(_0x21aa18==='/'){_0x47591d=_0x47591d[_0x9a67('0x62')](0x0,_0x47591d[_0x9a67('0x63')](_0x21aa18));}return rp({'method':'GET','uri':util[_0x9a67('0x64')](_0x9a67('0x65'),_0x47591d,_0x9a67('0x66')),'headers':{'Authorization':util['format'](_0x9a67('0x67'),new Buffer(util[_0x9a67('0x64')](_0x9a67('0x68'),_0x3613a2[_0x9a67('0x5f')]))['toString']('base64'))},'json':!![]});}})[_0x9a67('0x1e')](function(_0x1b2f47){if(_0x1b2f47){var _0x2c8440=[_0x9a67('0x69'),_0x9a67('0x6a'),'agent','description',_0x9a67('0x27'),_0x9a67('0x6b'),'group',_0x9a67('0x6c'),_0x9a67('0x6d'),_0x9a67('0x6e'),'company'];_[_0x9a67('0x6f')](_0x1b2f47,function(_0x1a95d4){return _0x2c8440[_0x9a67('0x70')](_0x1a95d4['name'])||!_0x1a95d4[_0x9a67('0x71')]&&_0x1a95d4[_0x9a67('0x3b')]!=='custom_text'&&_0x1a95d4[_0x9a67('0x3b')]!==_0x9a67('0x72');});return{'count':_0x1b2f47[_0x9a67('0x50')],'rows':_[_0x9a67('0x37')](_0x1b2f47,function(_0xaf6e31){return{'id':_0xaf6e31[_0x9a67('0x34')],'name':_0xaf6e31[_0x9a67('0x73')],'custom':!_0xaf6e31[_0x9a67('0x71')],'options':_0xaf6e31[_0x9a67('0x74')]?_[_0x9a67('0x37')](_0xaf6e31['choices'],function(_0x3d05ae){return{'name':_[_0x9a67('0x75')](_0x3d05ae),'value':_0x3d05ae};}):[]};})};}})['then'](respondWithResult(_0x5c4f4a,null))[_0x9a67('0x51')](function(_0x2a411f){var _0x3677db=_0x5592e4[_0x9a67('0x3e')]['test']?0x1f4:_0x2a411f[_0x9a67('0x76')]||0x1f4;logger['error'](_0x9a67('0x77'),'getFields',_0x3677db,JSON[_0x9a67('0x78')](_0x2a411f));delete _0x2a411f[_0x9a67('0x34')];if(_0x3677db===0x191){_0x3677db=0x190;}_0x5c4f4a['status'](_0x3677db)[_0x9a67('0x35')](_0x5592e4[_0x9a67('0x3e')][_0x9a67('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x2a411f[_0x9a67('0x76')]}:_0x2a411f);});}; \ No newline at end of file +var _0x8a79=['stack','name','send','map','FreshdeskAccount','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','params','rawAttributes','intersection','options','find','create','body','update','getConfigurations','pick','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','%s:X','requester','subject','agent','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save'];(function(_0x1292fb,_0x4cd09a){var _0x2544ae=function(_0xb8443a){while(--_0xb8443a){_0x1292fb['push'](_0x1292fb['shift']());}};_0x2544ae(++_0x4cd09a);}(_0x8a79,0x1b3));var _0x98a7=function(_0x1616f8,_0x5798ae){_0x1616f8=_0x1616f8-0x0;var _0x5c7b3d=_0x8a79[_0x1616f8];return _0x5c7b3d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x98a7('0x0'));var rimraf=require(_0x98a7('0x1'));var zipdir=require(_0x98a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98a7('0x3'));var moment=require(_0x98a7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x98a7('0x5'));var util=require(_0x98a7('0x6'));var path=require('path');var sox=require(_0x98a7('0x7'));var csv=require(_0x98a7('0x8'));var ejs=require(_0x98a7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98a7('0xa'));var deskjs=require(_0x98a7('0xb'));var toCsv=require(_0x98a7('0x8'));var querystring=require(_0x98a7('0xc'));var Papa=require(_0x98a7('0xd'));var Redis=require('ioredis');var authService=require(_0x98a7('0xe'));var qs=require(_0x98a7('0xf'));var as=require(_0x98a7('0x10'));var hardwareService=require(_0x98a7('0x11'));var logger=require(_0x98a7('0x12'))('api');var utils=require(_0x98a7('0x13'));var config=require(_0x98a7('0x14'));var licenseUtil=require(_0x98a7('0x15'));var db=require(_0x98a7('0x16'))['db'];var integrations=require(_0x98a7('0x17'));var jayson=require(_0x98a7('0x18'));var client=jayson['client'][_0x98a7('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x7b8da8,_0x54c19a,_0x4fff98,_0x7cc49a){return new BPromise(function(_0x3d4a4d,_0x38ca68){var _0x574e73=_0x7cc49a||client;return _0x574e73[_0x98a7('0x1a')](_0x7b8da8,_0x4fff98)[_0x98a7('0x1b')](function(_0x48cad6){logger[_0x98a7('0x1c')](_0x98a7('0x1d'),_0x54c19a,'request\x20sent');logger[_0x98a7('0x1e')](_0x98a7('0x1f'),_0x54c19a,_0x98a7('0x20'),JSON[_0x98a7('0x21')](_0x48cad6));if(_0x48cad6[_0x98a7('0x22')]){if(_0x48cad6[_0x98a7('0x22')][_0x98a7('0x23')]===0x1f4){logger['error'](_0x98a7('0x1d'),_0x54c19a,_0x48cad6[_0x98a7('0x22')][_0x98a7('0x24')]);return _0x38ca68(_0x48cad6[_0x98a7('0x22')][_0x98a7('0x24')]);}logger[_0x98a7('0x22')](_0x98a7('0x1d'),_0x54c19a,_0x48cad6['error'][_0x98a7('0x24')]);return _0x3d4a4d(_0x48cad6[_0x98a7('0x22')][_0x98a7('0x24')]);}else{logger[_0x98a7('0x1c')](_0x98a7('0x1d'),_0x54c19a,'request\x20sent');_0x3d4a4d(_0x48cad6['result'][_0x98a7('0x24')]);}})[_0x98a7('0x25')](function(_0x29edc8){logger['error'](_0x98a7('0x1d'),_0x54c19a,_0x29edc8);_0x38ca68(_0x29edc8);});});}function respondWithStatusCode(_0x16a33a,_0x45d40a){_0x45d40a=_0x45d40a||0xcc;return function(_0x47c5ca){if(_0x47c5ca){return _0x16a33a[_0x98a7('0x26')](_0x45d40a);}return _0x16a33a['status'](_0x45d40a)[_0x98a7('0x27')]();};}function respondWithResult(_0x27bf18,_0x5e91f3){_0x5e91f3=_0x5e91f3||0xc8;return function(_0xc345f9){if(_0xc345f9){return _0x27bf18['status'](_0x5e91f3)[_0x98a7('0x28')](_0xc345f9);}};}function respondWithFilteredResult(_0xe80755,_0x3ff3e6){return function(_0x534fba){if(_0x534fba){var _0x119e9a=_0x534fba['count'],_0x21fd81=_0x3ff3e6[_0x98a7('0x29')],_0x4e8d0d=_0x3ff3e6[_0x98a7('0x29')]+_0x3ff3e6[_0x98a7('0x2a')],_0x40c155;if(_0x4e8d0d>=_0x119e9a){_0x4e8d0d=_0x119e9a;_0x40c155=0xc8;}else{_0x40c155=0xce;}_0xe80755[_0x98a7('0x2b')](_0x40c155);return _0xe80755[_0x98a7('0x2c')](_0x98a7('0x2d'),_0x21fd81+'-'+_0x4e8d0d+'/'+_0x119e9a)[_0x98a7('0x28')](_0x534fba);}return null;};}function patchUpdates(_0x4fb61d){return function(_0x4ff627){try{jsonpatch[_0x98a7('0x2e')](_0x4ff627,_0x4fb61d,!![]);}catch(_0x3c9503){return BPromise[_0x98a7('0x2f')](_0x3c9503);}return _0x4ff627[_0x98a7('0x30')]();};}function saveUpdates(_0x1b7d02,_0x1ee99a){return function(_0x236c54){if(_0x236c54){return _0x236c54['update'](_0x1b7d02)[_0x98a7('0x1b')](function(_0x151d1c){return _0x151d1c;});}return null;};}function removeEntity(_0x572882,_0x43fa92){return function(_0x47ee13){if(_0x47ee13){return _0x47ee13['destroy']()[_0x98a7('0x1b')](function(){_0x572882['status'](0xcc)[_0x98a7('0x27')]();});}};}function handleEntityNotFound(_0x17967d,_0x1ea114){return function(_0x18697){if(!_0x18697){_0x17967d[_0x98a7('0x26')](0x194);}return _0x18697;};}function handleError(_0x691733,_0xae0afa){_0xae0afa=_0xae0afa||0x1f4;return function(_0x26e6c6){logger[_0x98a7('0x22')](_0x26e6c6[_0x98a7('0x31')]);if(_0x26e6c6[_0x98a7('0x32')]){delete _0x26e6c6[_0x98a7('0x32')];}_0x691733[_0x98a7('0x2b')](_0xae0afa)[_0x98a7('0x33')](_0x26e6c6);};}exports['index']=function(_0x1f1b7d,_0x1c977f){var _0x30cb72={},_0x45d67a={},_0x38d26a={'count':0x0,'rows':[]};var _0x42e0ba=_[_0x98a7('0x34')](db[_0x98a7('0x35')]['rawAttributes'],function(_0x53025d){return{'name':_0x53025d[_0x98a7('0x36')],'type':_0x53025d[_0x98a7('0x37')][_0x98a7('0x38')]};});_0x45d67a[_0x98a7('0x39')]=_[_0x98a7('0x34')](_0x42e0ba,_0x98a7('0x32'));_0x45d67a[_0x98a7('0x3a')]=_[_0x98a7('0x3b')](_0x1f1b7d[_0x98a7('0x3a')]);_0x45d67a['filters']=_['intersection'](_0x45d67a['model'],_0x45d67a[_0x98a7('0x3a')]);_0x30cb72[_0x98a7('0x3c')]=_['intersection'](_0x45d67a[_0x98a7('0x39')],qs[_0x98a7('0x3d')](_0x1f1b7d[_0x98a7('0x3a')]['fields']));_0x30cb72['attributes']=_0x30cb72[_0x98a7('0x3c')][_0x98a7('0x3e')]?_0x30cb72[_0x98a7('0x3c')]:_0x45d67a[_0x98a7('0x39')];if(!_0x1f1b7d['query'][_0x98a7('0x3f')](_0x98a7('0x40'))){_0x30cb72[_0x98a7('0x2a')]=qs[_0x98a7('0x2a')](_0x1f1b7d[_0x98a7('0x3a')][_0x98a7('0x2a')]);_0x30cb72[_0x98a7('0x29')]=qs[_0x98a7('0x29')](_0x1f1b7d['query'][_0x98a7('0x29')]);}_0x30cb72[_0x98a7('0x41')]=qs[_0x98a7('0x42')](_0x1f1b7d[_0x98a7('0x3a')][_0x98a7('0x42')]);_0x30cb72[_0x98a7('0x43')]=qs[_0x98a7('0x44')](_['pick'](_0x1f1b7d['query'],_0x45d67a[_0x98a7('0x44')]),_0x42e0ba);if(_0x1f1b7d[_0x98a7('0x3a')]['filter']){_0x30cb72['where']=_[_0x98a7('0x45')](_0x30cb72[_0x98a7('0x43')],{'$or':_[_0x98a7('0x34')](_0x42e0ba,function(_0x32c8a7){if(_0x32c8a7[_0x98a7('0x37')]!==_0x98a7('0x46')){var _0x10f272={};_0x10f272[_0x32c8a7[_0x98a7('0x32')]]={'$like':'%'+_0x1f1b7d['query'][_0x98a7('0x47')]+'%'};return _0x10f272;}})});}_0x30cb72=_[_0x98a7('0x45')]({},_0x30cb72,_0x1f1b7d['options']);var _0x51f9a6={'where':_0x30cb72[_0x98a7('0x43')]};return db[_0x98a7('0x35')][_0x98a7('0x48')](_0x51f9a6)[_0x98a7('0x1b')](function(_0x3f29d5){_0x38d26a[_0x98a7('0x48')]=_0x3f29d5;if(_0x1f1b7d[_0x98a7('0x3a')][_0x98a7('0x49')]){_0x30cb72[_0x98a7('0x4a')]=[{'all':!![]}];}return db[_0x98a7('0x35')][_0x98a7('0x4b')](_0x30cb72);})[_0x98a7('0x1b')](function(_0x21c0f6){_0x38d26a[_0x98a7('0x4c')]=_0x21c0f6;return _0x38d26a;})[_0x98a7('0x1b')](respondWithFilteredResult(_0x1c977f,_0x30cb72))[_0x98a7('0x25')](handleError(_0x1c977f,null));};exports['show']=function(_0x48b3ee,_0xde3b53){var _0x530fc9={'raw':![],'where':{'id':_0x48b3ee[_0x98a7('0x4d')]['id']}},_0x26d017={};_0x26d017[_0x98a7('0x39')]=_[_0x98a7('0x3b')](db[_0x98a7('0x35')][_0x98a7('0x4e')]);_0x26d017['query']=_['keys'](_0x48b3ee[_0x98a7('0x3a')]);_0x26d017[_0x98a7('0x44')]=_[_0x98a7('0x4f')](_0x26d017[_0x98a7('0x39')],_0x26d017[_0x98a7('0x3a')]);_0x530fc9['attributes']=_['intersection'](_0x26d017[_0x98a7('0x39')],qs[_0x98a7('0x3d')](_0x48b3ee[_0x98a7('0x3a')][_0x98a7('0x3d')]));_0x530fc9[_0x98a7('0x3c')]=_0x530fc9[_0x98a7('0x3c')][_0x98a7('0x3e')]?_0x530fc9['attributes']:_0x26d017[_0x98a7('0x39')];if(_0x48b3ee[_0x98a7('0x3a')][_0x98a7('0x49')]){_0x530fc9[_0x98a7('0x4a')]=[{'all':!![]}];}_0x530fc9=_['merge']({},_0x530fc9,_0x48b3ee[_0x98a7('0x50')]);return db[_0x98a7('0x35')][_0x98a7('0x51')](_0x530fc9)[_0x98a7('0x1b')](handleEntityNotFound(_0xde3b53,null))[_0x98a7('0x1b')](respondWithResult(_0xde3b53,null))[_0x98a7('0x25')](handleError(_0xde3b53,null));};exports[_0x98a7('0x52')]=function(_0x11cccb,_0x21985c){return db[_0x98a7('0x35')][_0x98a7('0x52')](_0x11cccb[_0x98a7('0x53')],{})['then'](respondWithResult(_0x21985c,0xc9))[_0x98a7('0x25')](handleError(_0x21985c,null));};exports[_0x98a7('0x54')]=function(_0x8103bd,_0x5581e6){if(_0x8103bd[_0x98a7('0x53')]['id']){delete _0x8103bd[_0x98a7('0x53')]['id'];}return db[_0x98a7('0x35')][_0x98a7('0x51')]({'where':{'id':_0x8103bd['params']['id']}})[_0x98a7('0x1b')](handleEntityNotFound(_0x5581e6,null))[_0x98a7('0x1b')](saveUpdates(_0x8103bd[_0x98a7('0x53')],null))[_0x98a7('0x1b')](respondWithResult(_0x5581e6,null))[_0x98a7('0x25')](handleError(_0x5581e6,null));};exports['destroy']=function(_0x5aec16,_0x39ad13){return db['FreshdeskAccount'][_0x98a7('0x51')]({'where':{'id':_0x5aec16[_0x98a7('0x4d')]['id']}})[_0x98a7('0x1b')](handleEntityNotFound(_0x39ad13,null))[_0x98a7('0x1b')](removeEntity(_0x39ad13,null))[_0x98a7('0x25')](handleError(_0x39ad13,null));};exports[_0x98a7('0x55')]=function(_0x221731,_0x3ff3e3,_0x13a9c6){var _0x4f39d3={};var _0x17e867={};var _0x5064d9;var _0xbc3410;return db[_0x98a7('0x35')]['findOne']({'where':{'id':_0x221731['params']['id']}})[_0x98a7('0x1b')](handleEntityNotFound(_0x3ff3e3,null))[_0x98a7('0x1b')](function(_0x260445){if(_0x260445){_0x5064d9=_0x260445;_0x17e867['model']=_['keys'](db['FreshdeskConfiguration'][_0x98a7('0x4e')]);_0x17e867[_0x98a7('0x3a')]=_['keys'](_0x221731[_0x98a7('0x3a')]);_0x17e867[_0x98a7('0x44')]=_[_0x98a7('0x4f')](_0x17e867[_0x98a7('0x39')],_0x17e867[_0x98a7('0x3a')]);_0x4f39d3[_0x98a7('0x3c')]=_['intersection'](_0x17e867[_0x98a7('0x39')],qs['fields'](_0x221731[_0x98a7('0x3a')][_0x98a7('0x3d')]));_0x4f39d3[_0x98a7('0x3c')]=_0x4f39d3[_0x98a7('0x3c')][_0x98a7('0x3e')]?_0x4f39d3[_0x98a7('0x3c')]:_0x17e867['model'];_0x4f39d3[_0x98a7('0x41')]=qs['sort'](_0x221731[_0x98a7('0x3a')][_0x98a7('0x42')]);_0x4f39d3[_0x98a7('0x43')]=qs['filters'](_[_0x98a7('0x56')](_0x221731[_0x98a7('0x3a')],_0x17e867[_0x98a7('0x44')]));if(_0x221731['query'][_0x98a7('0x47')]){_0x4f39d3[_0x98a7('0x43')]=_[_0x98a7('0x45')](_0x4f39d3[_0x98a7('0x43')],{'$or':_[_0x98a7('0x34')](_0x4f39d3[_0x98a7('0x3c')],function(_0x29c87b){var _0x39658b={};_0x39658b[_0x29c87b]={'$like':'%'+_0x221731[_0x98a7('0x3a')][_0x98a7('0x47')]+'%'};return _0x39658b;})});}_0x4f39d3=_[_0x98a7('0x45')]({},_0x4f39d3,_0x221731[_0x98a7('0x50')]);return _0x5064d9[_0x98a7('0x55')](_0x4f39d3);}})[_0x98a7('0x1b')](function(_0x524659){if(_0x524659){_0xbc3410=_0x524659[_0x98a7('0x3e')];if(!_0x221731['query'][_0x98a7('0x3f')](_0x98a7('0x40'))){_0x4f39d3['limit']=qs[_0x98a7('0x2a')](_0x221731[_0x98a7('0x3a')][_0x98a7('0x2a')]);_0x4f39d3['offset']=qs[_0x98a7('0x29')](_0x221731[_0x98a7('0x3a')][_0x98a7('0x29')]);}return _0x5064d9['getConfigurations'](_0x4f39d3);}})[_0x98a7('0x1b')](function(_0x44c199){if(_0x44c199){return _0x44c199?{'count':_0xbc3410,'rows':_0x44c199}:null;}})[_0x98a7('0x1b')](respondWithResult(_0x3ff3e3,null))[_0x98a7('0x25')](handleError(_0x3ff3e3,null));};exports[_0x98a7('0x57')]=function(_0x5854d4,_0x49b1a5,_0x3c9e69){if(_0x5854d4[_0x98a7('0x53')]['id']){delete _0x5854d4[_0x98a7('0x53')]['id'];}return db[_0x98a7('0x35')][_0x98a7('0x58')]({'where':{'id':_0x5854d4[_0x98a7('0x4d')]['id']}})[_0x98a7('0x1b')](handleEntityNotFound(_0x49b1a5,null))['then'](function(_0x5e0f3d){if(_0x5e0f3d){_0x5854d4[_0x98a7('0x53')]['AccountId']=_0x5e0f3d['id'];_0x5854d4[_0x98a7('0x53')][_0x98a7('0x59')]=integrations[_0x98a7('0x5a')](_0x5854d4[_0x98a7('0x53')]['channel'],_0x5854d4[_0x98a7('0x53')][_0x98a7('0x37')]);_0x5854d4[_0x98a7('0x53')][_0x98a7('0x5b')]=integrations[_0x98a7('0x5c')](_0x5854d4[_0x98a7('0x53')]['channel'],_0x5854d4[_0x98a7('0x53')][_0x98a7('0x37')]);return db[_0x98a7('0x5d')]['create'](_0x5854d4[_0x98a7('0x53')],{'include':[{'model':db[_0x98a7('0x5e')],'as':_0x98a7('0x59')},{'model':db[_0x98a7('0x5e')],'as':_0x98a7('0x5b')}]});}return null;})[_0x98a7('0x1b')](respondWithResult(_0x49b1a5,null))[_0x98a7('0x25')](handleError(_0x49b1a5,null));};exports['getFields']=function(_0x9efac5,_0x35ba6c,_0x4f4c11){var _0x46faae='';return db[_0x98a7('0x35')]['findOne']({'where':{'id':_0x9efac5[_0x98a7('0x4d')]['id']},'attributes':['id',_0x98a7('0x5f'),_0x98a7('0x60')]})[_0x98a7('0x1b')](handleEntityNotFound(_0x35ba6c,null))[_0x98a7('0x1b')](function(_0x11aa51){if(_0x11aa51){_0x46faae=_0x11aa51[_0x98a7('0x5f')];var _0x52dccd=_0x46faae[_0x98a7('0x61')](-0x1);if(_0x52dccd==='/'){_0x46faae=_0x46faae['substring'](0x0,_0x46faae[_0x98a7('0x62')](_0x52dccd));}return rp({'method':_0x98a7('0x63'),'uri':util[_0x98a7('0x64')](_0x98a7('0x65'),_0x46faae,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x98a7('0x64')]('Basic\x20%s',new Buffer(util['format'](_0x98a7('0x66'),_0x11aa51[_0x98a7('0x60')]))['toString']('base64'))},'json':!![]});}})[_0x98a7('0x1b')](function(_0x4cbfaa){if(_0x4cbfaa){var _0x2bc5e9=[_0x98a7('0x67'),_0x98a7('0x68'),_0x98a7('0x69'),'description','status',_0x98a7('0x6a'),_0x98a7('0x6b'),_0x98a7('0x6c'),_0x98a7('0x6d'),_0x98a7('0x6b'),'company'];_[_0x98a7('0x6e')](_0x4cbfaa,function(_0x2599b9){return _0x2bc5e9[_0x98a7('0x6f')](_0x2599b9[_0x98a7('0x32')])||!_0x2599b9[_0x98a7('0x70')]&&_0x2599b9['type']!==_0x98a7('0x71')&&_0x2599b9['type']!==_0x98a7('0x72');});return{'count':_0x4cbfaa[_0x98a7('0x3e')],'rows':_[_0x98a7('0x34')](_0x4cbfaa,function(_0x4deef4){return{'id':_0x4deef4[_0x98a7('0x32')],'name':_0x4deef4['label'],'custom':!_0x4deef4[_0x98a7('0x70')],'options':_0x4deef4['choices']?_[_0x98a7('0x34')](_0x4deef4['choices'],function(_0x46b9eb){return{'name':_[_0x98a7('0x73')](_0x46b9eb),'value':_0x46b9eb};}):[]};})};}})[_0x98a7('0x1b')](respondWithResult(_0x35ba6c,null))[_0x98a7('0x25')](function(_0x46b2cb){var _0x2d223b=_0x9efac5[_0x98a7('0x3a')][_0x98a7('0x74')]?0x1f4:_0x46b2cb[_0x98a7('0x75')]||0x1f4;logger[_0x98a7('0x22')](_0x98a7('0x76'),_0x98a7('0x77'),_0x2d223b,JSON[_0x98a7('0x21')](_0x46b2cb));delete _0x46b2cb['name'];if(_0x2d223b===0x191){_0x2d223b=0x190;}_0x35ba6c[_0x98a7('0x2b')](_0x2d223b)['send'](_0x9efac5[_0x98a7('0x3a')]['test']?{'message':_0x98a7('0x78'),'statusCode':_0x46b2cb[_0x98a7('0x75')]}:_0x46b2cb);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 916044b..339f834 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c88=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5c88,0x1db));var _0x85c8=function(_0x55146d,_0x3ef63b){_0x55146d=_0x55146d-0x0;var _0x55140b=_0x5c88[_0x55146d];return _0x55140b;};'use strict';var _=require(_0x85c8('0x0'));var util=require(_0x85c8('0x1'));var logger=require(_0x85c8('0x2'))(_0x85c8('0x3'));var moment=require(_0x85c8('0x4'));var BPromise=require(_0x85c8('0x5'));var rp=require(_0x85c8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85c8('0x7'));var config=require(_0x85c8('0x8'));var attributes=require(_0x85c8('0x9'));var integrations=require(_0x85c8('0xa'));module[_0x85c8('0xb')]=function(_0x15d4e4,_0x4635d4){return _0x15d4e4['define'](_0x85c8('0xc'),attributes,{'tableName':_0x85c8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99d4=['path','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x40a77d,_0x53f474){var _0x3173c0=function(_0x39de4d){while(--_0x39de4d){_0x40a77d['push'](_0x40a77d['shift']());}};_0x3173c0(++_0x53f474);}(_0x99d4,0xa3));var _0x499d=function(_0x3803cb,_0x2c7aea){_0x3803cb=_0x3803cb-0x0;var _0x53a15d=_0x99d4[_0x3803cb];return _0x53a15d;};'use strict';var _=require(_0x499d('0x0'));var util=require(_0x499d('0x1'));var logger=require(_0x499d('0x2'))(_0x499d('0x3'));var moment=require('moment');var BPromise=require(_0x499d('0x4'));var rp=require(_0x499d('0x5'));var fs=require('fs');var path=require(_0x499d('0x6'));var rimraf=require('rimraf');var config=require(_0x499d('0x7'));var attributes=require(_0x499d('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x499d('0x9')]=function(_0x51a3ac,_0x34092b){return _0x51a3ac[_0x499d('0xa')](_0x499d('0xb'),attributes,{'tableName':_0x499d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 4e3ffa2..8ddaf5c 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecbc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','FreshdeskAccount','find','ShowFreshdeskAccount','lodash','moment','bluebird'];(function(_0x4729f1,_0x3b9d0f){var _0x269311=function(_0x2eb2a4){while(--_0x2eb2a4){_0x4729f1['push'](_0x4729f1['shift']());}};_0x269311(++_0x3b9d0f);}(_0xecbc,0x138));var _0xcecb=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xecbc[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xcecb('0x0'));var util=require('util');var moment=require(_0xcecb('0x1'));var BPromise=require(_0xcecb('0x2'));var rs=require(_0xcecb('0x3'));var fs=require('fs');var Redis=require(_0xcecb('0x4'));var db=require(_0xcecb('0x5'))['db'];var utils=require(_0xcecb('0x6'));var logger=require(_0xcecb('0x7'))(_0xcecb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xcecb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd0fb56,_0x497e3f,_0x11040e){return new BPromise(function(_0x2931f8,_0x278123){return client[_0xcecb('0xa')](_0xd0fb56,_0x11040e)[_0xcecb('0xb')](function(_0x44e2b3){logger[_0xcecb('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x497e3f,_0xcecb('0xd'));logger[_0xcecb('0xe')](_0xcecb('0xf'),_0x497e3f,_0xcecb('0xd'),JSON[_0xcecb('0x10')](_0x44e2b3));if(_0x44e2b3['error']){if(_0x44e2b3[_0xcecb('0x11')][_0xcecb('0x12')]===0x1f4){logger['error'](_0xcecb('0x13'),_0x497e3f,_0x44e2b3['error'][_0xcecb('0x14')]);return _0x278123(_0x44e2b3[_0xcecb('0x11')]['message']);}logger[_0xcecb('0x11')](_0xcecb('0x13'),_0x497e3f,_0x44e2b3['error'][_0xcecb('0x14')]);return _0x2931f8(_0x44e2b3[_0xcecb('0x11')]['message']);}else{logger[_0xcecb('0xc')](_0xcecb('0x13'),_0x497e3f,_0xcecb('0xd'));_0x2931f8(_0x44e2b3['result'][_0xcecb('0x14')]);}})[_0xcecb('0x15')](function(_0x10872c){logger[_0xcecb('0x11')](_0xcecb('0x13'),_0x497e3f,_0x10872c);_0x278123(_0x10872c);});});}exports[_0xcecb('0x16')]=function(_0x4f20c4){var _0x490433=this;return new Promise(function(_0x38b761,_0x31c885){return db['FreshdeskAccount'][_0xcecb('0x17')]({'raw':_0x4f20c4[_0xcecb('0x18')]?_0x4f20c4['options'][_0xcecb('0x19')]===undefined?!![]:![]:!![],'where':_0x4f20c4['options']?_0x4f20c4[_0xcecb('0x18')][_0xcecb('0x1a')]||null:null,'attributes':_0x4f20c4[_0xcecb('0x18')]?_0x4f20c4['options'][_0xcecb('0x1b')]||null:null,'limit':_0x4f20c4[_0xcecb('0x18')]?_0x4f20c4['options'][_0xcecb('0x1c')]||null:null,'include':_0x4f20c4['options']?_0x4f20c4[_0xcecb('0x18')][_0xcecb('0x1d')]?_[_0xcecb('0x1e')](_0x4f20c4[_0xcecb('0x18')][_0xcecb('0x1d')],function(_0x11edba){return{'model':db[_0x11edba[_0xcecb('0x1f')]],'as':_0x11edba['as'],'attributes':_0x11edba['attributes'],'include':_0x11edba['include']?_['map'](_0x11edba[_0xcecb('0x1d')],function(_0x516397){return{'model':db[_0x516397['model']],'as':_0x516397['as'],'attributes':_0x516397[_0xcecb('0x1b')],'include':_0x516397[_0xcecb('0x1d')]?_[_0xcecb('0x1e')](_0x516397['include'],function(_0x3f0360){return{'model':db[_0x3f0360[_0xcecb('0x1f')]],'as':_0x3f0360['as'],'attributes':_0x3f0360[_0xcecb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcecb('0xb')](function(_0x379155){logger[_0xcecb('0xc')](_0xcecb('0x16'),_0x4f20c4);logger['debug'](_0xcecb('0x16'),_0x4f20c4,JSON[_0xcecb('0x10')](_0x379155));_0x38b761(_0x379155);})[_0xcecb('0x15')](function(_0x4547b6){logger[_0xcecb('0x11')]('GetFreshdeskAccount',_0x4547b6[_0xcecb('0x14')],_0x4f20c4);_0x31c885(_0x490433[_0xcecb('0x11')](0x1f4,_0x4547b6['message']));});});};exports['ShowFreshdeskAccount']=function(_0x398878){var _0x29ae41=this;return new Promise(function(_0x17a5bc,_0x5bd89d){return db[_0xcecb('0x20')][_0xcecb('0x21')]({'raw':_0x398878[_0xcecb('0x18')]?_0x398878[_0xcecb('0x18')][_0xcecb('0x19')]===undefined?!![]:![]:!![],'where':_0x398878['options']?_0x398878[_0xcecb('0x18')][_0xcecb('0x1a')]||null:null,'attributes':_0x398878['options']?_0x398878['options'][_0xcecb('0x1b')]||null:null,'include':_0x398878['options']?_0x398878['options'][_0xcecb('0x1d')]?_['map'](_0x398878['options'][_0xcecb('0x1d')],function(_0x1c0922){return{'model':db[_0x1c0922['model']],'as':_0x1c0922['as'],'attributes':_0x1c0922[_0xcecb('0x1b')],'include':_0x1c0922[_0xcecb('0x1d')]?_[_0xcecb('0x1e')](_0x1c0922[_0xcecb('0x1d')],function(_0x24e83c){return{'model':db[_0x24e83c[_0xcecb('0x1f')]],'as':_0x24e83c['as'],'attributes':_0x24e83c[_0xcecb('0x1b')],'include':_0x24e83c[_0xcecb('0x1d')]?_[_0xcecb('0x1e')](_0x24e83c[_0xcecb('0x1d')],function(_0x54c7c5){return{'model':db[_0x54c7c5[_0xcecb('0x1f')]],'as':_0x54c7c5['as'],'attributes':_0x54c7c5['attributes']};}):[]};}):[]};}):[]:[]})[_0xcecb('0xb')](function(_0x5d53a2){logger[_0xcecb('0xc')](_0xcecb('0x22'),_0x398878);logger[_0xcecb('0xe')](_0xcecb('0x22'),_0x398878,JSON[_0xcecb('0x10')](_0x5d53a2));_0x17a5bc(_0x5d53a2);})[_0xcecb('0x15')](function(_0x337204){logger['error']('ShowFreshdeskAccount',_0x337204[_0xcecb('0x14')],_0x398878);_0x5bd89d(_0x29ae41[_0xcecb('0x11')](0x1f4,_0x337204[_0xcecb('0x14')]));});});}; \ No newline at end of file +var _0x5a92=['stringify','error','code','message','GetFreshdeskAccount','findAll','options','raw','attributes','limit','map','include','model','catch','ShowFreshdeskAccount','find','where','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x58c8fd,_0x2d395e){var _0x548eef=function(_0x2b1129){while(--_0x2b1129){_0x58c8fd['push'](_0x58c8fd['shift']());}};_0x548eef(++_0x2d395e);}(_0x5a92,0x74));var _0x25a9=function(_0x5e546c,_0x141d38){_0x5e546c=_0x5e546c-0x0;var _0x5b116f=_0x5a92[_0x5e546c];return _0x5b116f;};'use strict';var _=require(_0x25a9('0x0'));var util=require(_0x25a9('0x1'));var moment=require(_0x25a9('0x2'));var BPromise=require('bluebird');var rs=require(_0x25a9('0x3'));var fs=require('fs');var Redis=require(_0x25a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25a9('0x5'));var logger=require('../../config/logger')(_0x25a9('0x6'));var config=require(_0x25a9('0x7'));var jayson=require(_0x25a9('0x8'));var client=jayson[_0x25a9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47c810,_0x278624,_0x5cdef9){return new BPromise(function(_0x494bd0,_0x538811){return client[_0x25a9('0xa')](_0x47c810,_0x5cdef9)[_0x25a9('0xb')](function(_0x2ce6b4){logger[_0x25a9('0xc')](_0x25a9('0xd'),_0x278624,_0x25a9('0xe'));logger[_0x25a9('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x278624,'request\x20sent',JSON[_0x25a9('0x10')](_0x2ce6b4));if(_0x2ce6b4['error']){if(_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x12')]===0x1f4){logger[_0x25a9('0x11')](_0x25a9('0xd'),_0x278624,_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x13')]);return _0x538811(_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x13')]);}logger[_0x25a9('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x278624,_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x13')]);return _0x494bd0(_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x13')]);}else{logger['info'](_0x25a9('0xd'),_0x278624,_0x25a9('0xe'));_0x494bd0(_0x2ce6b4['result']['message']);}})['catch'](function(_0x1ba2e6){logger[_0x25a9('0x11')](_0x25a9('0xd'),_0x278624,_0x1ba2e6);_0x538811(_0x1ba2e6);});});}exports[_0x25a9('0x14')]=function(_0x8f17c7){var _0x175c89=this;return new Promise(function(_0x2ac16c,_0x5090c6){return db['FreshdeskAccount'][_0x25a9('0x15')]({'raw':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7['options'][_0x25a9('0x17')]===undefined?!![]:![]:!![],'where':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7['options']['where']||null:null,'attributes':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7['options'][_0x25a9('0x18')]||null:null,'limit':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7[_0x25a9('0x16')][_0x25a9('0x19')]||null:null,'include':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7['options']['include']?_[_0x25a9('0x1a')](_0x8f17c7['options'][_0x25a9('0x1b')],function(_0x4b49d8){return{'model':db[_0x4b49d8[_0x25a9('0x1c')]],'as':_0x4b49d8['as'],'attributes':_0x4b49d8['attributes'],'include':_0x4b49d8[_0x25a9('0x1b')]?_['map'](_0x4b49d8[_0x25a9('0x1b')],function(_0x5a7b92){return{'model':db[_0x5a7b92[_0x25a9('0x1c')]],'as':_0x5a7b92['as'],'attributes':_0x5a7b92['attributes'],'include':_0x5a7b92[_0x25a9('0x1b')]?_[_0x25a9('0x1a')](_0x5a7b92[_0x25a9('0x1b')],function(_0x4208d4){return{'model':db[_0x4208d4[_0x25a9('0x1c')]],'as':_0x4208d4['as'],'attributes':_0x4208d4[_0x25a9('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fdfd1){logger[_0x25a9('0xc')](_0x25a9('0x14'),_0x8f17c7);logger['debug'](_0x25a9('0x14'),_0x8f17c7,JSON[_0x25a9('0x10')](_0x4fdfd1));_0x2ac16c(_0x4fdfd1);})[_0x25a9('0x1d')](function(_0x581cc6){logger[_0x25a9('0x11')]('GetFreshdeskAccount',_0x581cc6[_0x25a9('0x13')],_0x8f17c7);_0x5090c6(_0x175c89[_0x25a9('0x11')](0x1f4,_0x581cc6[_0x25a9('0x13')]));});});};exports[_0x25a9('0x1e')]=function(_0x417a83){var _0x5bbda0=this;return new Promise(function(_0x5ba896,_0x37f03e){return db['FreshdeskAccount'][_0x25a9('0x1f')]({'raw':_0x417a83[_0x25a9('0x16')]?_0x417a83[_0x25a9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x417a83[_0x25a9('0x16')]?_0x417a83['options'][_0x25a9('0x20')]||null:null,'attributes':_0x417a83[_0x25a9('0x16')]?_0x417a83[_0x25a9('0x16')][_0x25a9('0x18')]||null:null,'include':_0x417a83[_0x25a9('0x16')]?_0x417a83[_0x25a9('0x16')][_0x25a9('0x1b')]?_[_0x25a9('0x1a')](_0x417a83['options'][_0x25a9('0x1b')],function(_0x26bf87){return{'model':db[_0x26bf87[_0x25a9('0x1c')]],'as':_0x26bf87['as'],'attributes':_0x26bf87['attributes'],'include':_0x26bf87[_0x25a9('0x1b')]?_[_0x25a9('0x1a')](_0x26bf87[_0x25a9('0x1b')],function(_0x3aac19){return{'model':db[_0x3aac19[_0x25a9('0x1c')]],'as':_0x3aac19['as'],'attributes':_0x3aac19[_0x25a9('0x18')],'include':_0x3aac19[_0x25a9('0x1b')]?_['map'](_0x3aac19[_0x25a9('0x1b')],function(_0x44dd05){return{'model':db[_0x44dd05[_0x25a9('0x1c')]],'as':_0x44dd05['as'],'attributes':_0x44dd05[_0x25a9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x25a9('0xb')](function(_0x26b41c){logger['info']('ShowFreshdeskAccount',_0x417a83);logger[_0x25a9('0xf')](_0x25a9('0x1e'),_0x417a83,JSON['stringify'](_0x26b41c));_0x5ba896(_0x26b41c);})[_0x25a9('0x1d')](function(_0x406337){logger['error'](_0x25a9('0x1e'),_0x406337['message'],_0x417a83);_0x37f03e(_0x5bbda0[_0x25a9('0x11')](0x1f4,_0x406337['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 25a47b6..46d1981 100644 --- a/server/api/intFreshdeskConfiguration/index.js +++ b/server/api/intFreshdeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe790=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x24c3fc,_0x20342d){var _0x435c87=function(_0x35b575){while(--_0x35b575){_0x24c3fc['push'](_0x24c3fc['shift']());}};_0x435c87(++_0x20342d);}(_0xe790,0x1ec));var _0x0e79=function(_0x17f091,_0x58fc06){_0x17f091=_0x17f091-0x0;var _0x2ce0f8=_0xe790[_0x17f091];return _0x2ce0f8;};'use strict';var multer=require(_0x0e79('0x0'));var util=require(_0x0e79('0x1'));var path=require(_0x0e79('0x2'));var timeout=require(_0x0e79('0x3'));var express=require(_0x0e79('0x4'));var router=express[_0x0e79('0x5')]();var auth=require(_0x0e79('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0e79('0x7'));var controller=require(_0x0e79('0x8'));router[_0x0e79('0x9')]('/',auth[_0x0e79('0xa')](),controller[_0x0e79('0xb')]);router[_0x0e79('0x9')]('/:id',auth[_0x0e79('0xa')](),controller[_0x0e79('0xc')]);router[_0x0e79('0x9')]('/:id/fields',auth[_0x0e79('0xa')](),controller[_0x0e79('0xd')]);router['get'](_0x0e79('0xe'),auth[_0x0e79('0xa')](),controller[_0x0e79('0xf')]);router['get']('/:id/descriptions',auth[_0x0e79('0xa')](),controller['getDescriptions']);router['get'](_0x0e79('0x10'),auth[_0x0e79('0xa')](),controller['getTags']);router[_0x0e79('0x11')]('/',auth['isAuthenticated'](),controller[_0x0e79('0x12')]);router[_0x0e79('0x11')](_0x0e79('0x10'),auth['isAuthenticated'](),controller[_0x0e79('0x13')]);router[_0x0e79('0x14')](_0x0e79('0x15'),auth[_0x0e79('0xa')](),controller[_0x0e79('0x16')]);router[_0x0e79('0x17')](_0x0e79('0x15'),auth[_0x0e79('0xa')](),controller[_0x0e79('0x18')]);module[_0x0e79('0x19')]=router; \ No newline at end of file +var _0x7cdc=['../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','util','path','express','../../components/auth/service'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0x7cdc,0x1b1));var _0xc7cd=function(_0x3d26bc,_0x484d05){_0x3d26bc=_0x3d26bc-0x0;var _0x1cf90d=_0x7cdc[_0x3d26bc];return _0x1cf90d;};'use strict';var multer=require('multer');var util=require(_0xc7cd('0x0'));var path=require(_0xc7cd('0x1'));var timeout=require('connect-timeout');var express=require(_0xc7cd('0x2'));var router=express['Router']();var auth=require(_0xc7cd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc7cd('0x4'));var controller=require(_0xc7cd('0x5'));router[_0xc7cd('0x6')]('/',auth[_0xc7cd('0x7')](),controller['index']);router[_0xc7cd('0x6')](_0xc7cd('0x8'),auth['isAuthenticated'](),controller[_0xc7cd('0x9')]);router[_0xc7cd('0x6')](_0xc7cd('0xa'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xc7cd('0xb'),auth['isAuthenticated'](),controller[_0xc7cd('0xc')]);router[_0xc7cd('0x6')]('/:id/descriptions',auth[_0xc7cd('0x7')](),controller[_0xc7cd('0xd')]);router['get'](_0xc7cd('0xe'),auth['isAuthenticated'](),controller[_0xc7cd('0xf')]);router[_0xc7cd('0x10')]('/',auth[_0xc7cd('0x7')](),controller[_0xc7cd('0x11')]);router[_0xc7cd('0x10')](_0xc7cd('0xe'),auth[_0xc7cd('0x7')](),controller[_0xc7cd('0x12')]);router[_0xc7cd('0x13')]('/:id',auth[_0xc7cd('0x7')](),controller[_0xc7cd('0x14')]);router[_0xc7cd('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc7cd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index f4b952f..3e28a40 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17bb=['exports','STRING','sequelize'];(function(_0x4617ac,_0x4fa5d2){var _0x53f4a9=function(_0x2eb6a8){while(--_0x2eb6a8){_0x4617ac['push'](_0x4617ac['shift']());}};_0x53f4a9(++_0x4fa5d2);}(_0x17bb,0x119));var _0xb17b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x17bb[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xb17b('0x0'));module[_0xb17b('0x1')]={'name':{'type':Sequelize[_0xb17b('0x2')]},'description':{'type':Sequelize[_0xb17b('0x2')]}}; \ No newline at end of file +var _0xb14e=['STRING','exports'];(function(_0x51b549,_0x5b5c6c){var _0x4941ce=function(_0x1506a1){while(--_0x1506a1){_0x51b549['push'](_0x51b549['shift']());}};_0x4941ce(++_0x5b5c6c);}(_0xb14e,0x79));var _0xeb14=function(_0x253df0,_0x170d58){_0x253df0=_0x253df0-0x0;var _0xdb46dc=_0xb14e[_0x253df0];return _0xdb46dc;};'use strict';var Sequelize=require('sequelize');module[_0xeb14('0x0')]={'name':{'type':Sequelize[_0xeb14('0x1')]},'description':{'type':Sequelize[_0xeb14('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 03d9629..3d126c2 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x711c=['then','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','findAll','rows','length','find','create','body','params','getFields','findOne','FreshdeskField','order','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','count','offset','set','json','apply','reject','save','update'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x711c,0x8e));var _0xc711=function(_0xa26931,_0x43aab4){_0xa26931=_0xa26931-0x0;var _0x4696ee=_0x711c[_0xa26931];return _0x4696ee;};'use strict';var pdf=require(_0xc711('0x0'));var emlformat=require(_0xc711('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc711('0x2'));var jsonpatch=require(_0xc711('0x3'));var rp=require(_0xc711('0x4'));var moment=require('moment');var BPromise=require(_0xc711('0x5'));var Mustache=require(_0xc711('0x6'));var util=require(_0xc711('0x7'));var path=require('path');var sox=require(_0xc711('0x8'));var csv=require(_0xc711('0x9'));var ejs=require(_0xc711('0xa'));var fs=require('fs');var _=require(_0xc711('0xb'));var squel=require(_0xc711('0xc'));var crypto=require(_0xc711('0xd'));var jsforce=require(_0xc711('0xe'));var deskjs=require(_0xc711('0xf'));var toCsv=require(_0xc711('0x9'));var querystring=require(_0xc711('0x10'));var Papa=require(_0xc711('0x11'));var Redis=require(_0xc711('0x12'));var authService=require(_0xc711('0x13'));var qs=require(_0xc711('0x14'));var as=require(_0xc711('0x15'));var hardwareService=require(_0xc711('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc711('0x17'));var config=require(_0xc711('0x18'));var licenseUtil=require(_0xc711('0x19'));var db=require(_0xc711('0x1a'))['db'];var jayson=require(_0xc711('0x1b'));var client=jayson['client'][_0xc711('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1f722a,_0x434674,_0x40dc0e,_0x4aa46f){return new BPromise(function(_0x1029c2,_0x59c791){var _0x341e2d=_0x4aa46f||client;return _0x341e2d[_0xc711('0x1d')](_0x1f722a,_0x40dc0e)['then'](function(_0x309112){logger[_0xc711('0x1e')](_0xc711('0x1f'),_0x434674,_0xc711('0x20'));logger[_0xc711('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x434674,_0xc711('0x20'),JSON[_0xc711('0x22')](_0x309112));if(_0x309112[_0xc711('0x23')]){if(_0x309112[_0xc711('0x23')][_0xc711('0x24')]===0x1f4){logger[_0xc711('0x23')](_0xc711('0x1f'),_0x434674,_0x309112[_0xc711('0x23')][_0xc711('0x25')]);return _0x59c791(_0x309112[_0xc711('0x23')][_0xc711('0x25')]);}logger['error'](_0xc711('0x1f'),_0x434674,_0x309112[_0xc711('0x23')][_0xc711('0x25')]);return _0x1029c2(_0x309112[_0xc711('0x23')]['message']);}else{logger[_0xc711('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x434674,'request\x20sent');_0x1029c2(_0x309112['result'][_0xc711('0x25')]);}})[_0xc711('0x26')](function(_0x344c37){logger[_0xc711('0x23')](_0xc711('0x1f'),_0x434674,_0x344c37);_0x59c791(_0x344c37);});});}function respondWithStatusCode(_0x188409,_0x2e020c){_0x2e020c=_0x2e020c||0xcc;return function(_0x559ec9){if(_0x559ec9){return _0x188409[_0xc711('0x27')](_0x2e020c);}return _0x188409[_0xc711('0x28')](_0x2e020c)[_0xc711('0x29')]();};}function respondWithResult(_0x416b92,_0x165de4){_0x165de4=_0x165de4||0xc8;return function(_0x431870){if(_0x431870){return _0x416b92[_0xc711('0x28')](_0x165de4)['json'](_0x431870);}};}function respondWithFilteredResult(_0x2167b0,_0x4f2dab){return function(_0x106f79){if(_0x106f79){var _0x2fea40=_0x106f79[_0xc711('0x2a')],_0x310f41=_0x4f2dab[_0xc711('0x2b')],_0x2e764d=_0x4f2dab[_0xc711('0x2b')]+_0x4f2dab['limit'],_0xcd900f;if(_0x2e764d>=_0x2fea40){_0x2e764d=_0x2fea40;_0xcd900f=0xc8;}else{_0xcd900f=0xce;}_0x2167b0[_0xc711('0x28')](_0xcd900f);return _0x2167b0[_0xc711('0x2c')]('Content-Range',_0x310f41+'-'+_0x2e764d+'/'+_0x2fea40)[_0xc711('0x2d')](_0x106f79);}return null;};}function patchUpdates(_0x48fd2f){return function(_0x9e1544){try{jsonpatch[_0xc711('0x2e')](_0x9e1544,_0x48fd2f,!![]);}catch(_0x284603){return BPromise[_0xc711('0x2f')](_0x284603);}return _0x9e1544[_0xc711('0x30')]();};}function saveUpdates(_0x5558ea,_0x1816a5){return function(_0x235391){if(_0x235391){return _0x235391[_0xc711('0x31')](_0x5558ea)[_0xc711('0x32')](function(_0xfd2b3c){return _0xfd2b3c;});}return null;};}function removeEntity(_0x32f645,_0x5e8f75){return function(_0x56b91d){if(_0x56b91d){return _0x56b91d[_0xc711('0x33')]()[_0xc711('0x32')](function(){_0x32f645['status'](0xcc)[_0xc711('0x29')]();});}};}function handleEntityNotFound(_0x299951,_0x751e91){return function(_0x2d169b){if(!_0x2d169b){_0x299951['sendStatus'](0x194);}return _0x2d169b;};}function handleError(_0x3c43ba,_0x2b8cf7){_0x2b8cf7=_0x2b8cf7||0x1f4;return function(_0x57cc25){logger[_0xc711('0x23')](_0x57cc25[_0xc711('0x34')]);if(_0x57cc25[_0xc711('0x35')]){delete _0x57cc25[_0xc711('0x35')];}_0x3c43ba[_0xc711('0x28')](_0x2b8cf7)['send'](_0x57cc25);};}exports[_0xc711('0x36')]=function(_0x4ae72a,_0x24ca37){var _0x33eada={},_0x414163={},_0x1f4dcb={'count':0x0,'rows':[]};var _0x3f5fcf=_[_0xc711('0x37')](db['FreshdeskConfiguration'][_0xc711('0x38')],function(_0x3cb75e){return{'name':_0x3cb75e['fieldName'],'type':_0x3cb75e[_0xc711('0x39')][_0xc711('0x3a')]};});_0x414163[_0xc711('0x3b')]=_[_0xc711('0x37')](_0x3f5fcf,_0xc711('0x35'));_0x414163[_0xc711('0x3c')]=_[_0xc711('0x3d')](_0x4ae72a[_0xc711('0x3c')]);_0x414163[_0xc711('0x3e')]=_[_0xc711('0x3f')](_0x414163[_0xc711('0x3b')],_0x414163[_0xc711('0x3c')]);_0x33eada['attributes']=_['intersection'](_0x414163['model'],qs[_0xc711('0x40')](_0x4ae72a[_0xc711('0x3c')][_0xc711('0x40')]));_0x33eada[_0xc711('0x41')]=_0x33eada[_0xc711('0x41')]['length']?_0x33eada[_0xc711('0x41')]:_0x414163[_0xc711('0x3b')];if(!_0x4ae72a[_0xc711('0x3c')][_0xc711('0x42')]('nolimit')){_0x33eada[_0xc711('0x43')]=qs[_0xc711('0x43')](_0x4ae72a[_0xc711('0x3c')]['limit']);_0x33eada[_0xc711('0x2b')]=qs[_0xc711('0x2b')](_0x4ae72a[_0xc711('0x3c')][_0xc711('0x2b')]);}_0x33eada['order']=qs[_0xc711('0x44')](_0x4ae72a[_0xc711('0x3c')]['sort']);_0x33eada[_0xc711('0x45')]=qs['filters'](_[_0xc711('0x46')](_0x4ae72a[_0xc711('0x3c')],_0x414163['filters']),_0x3f5fcf);if(_0x4ae72a[_0xc711('0x3c')][_0xc711('0x47')]){_0x33eada['where']=_[_0xc711('0x48')](_0x33eada[_0xc711('0x45')],{'$or':_[_0xc711('0x37')](_0x3f5fcf,function(_0x3b4402){if(_0x3b4402[_0xc711('0x39')]!==_0xc711('0x49')){var _0x4ae772={};_0x4ae772[_0x3b4402['name']]={'$like':'%'+_0x4ae72a['query'][_0xc711('0x47')]+'%'};return _0x4ae772;}})});}_0x33eada=_[_0xc711('0x48')]({},_0x33eada,_0x4ae72a[_0xc711('0x4a')]);var _0x2ca773={'where':_0x33eada[_0xc711('0x45')]};return db['FreshdeskConfiguration']['count'](_0x2ca773)[_0xc711('0x32')](function(_0xb2407e){_0x1f4dcb[_0xc711('0x2a')]=_0xb2407e;if(_0x4ae72a[_0xc711('0x3c')][_0xc711('0x4b')]){_0x33eada[_0xc711('0x4c')]=[{'all':!![]}];}return db[_0xc711('0x4d')][_0xc711('0x4e')](_0x33eada);})[_0xc711('0x32')](function(_0x49587b){_0x1f4dcb[_0xc711('0x4f')]=_0x49587b;return _0x1f4dcb;})[_0xc711('0x32')](respondWithFilteredResult(_0x24ca37,_0x33eada))[_0xc711('0x26')](handleError(_0x24ca37,null));};exports['show']=function(_0x162ce8,_0x591a47){var _0x3ccf00={'raw':![],'where':{'id':_0x162ce8['params']['id']}},_0x5150f0={};_0x5150f0[_0xc711('0x3b')]=_[_0xc711('0x3d')](db[_0xc711('0x4d')][_0xc711('0x38')]);_0x5150f0['query']=_['keys'](_0x162ce8['query']);_0x5150f0[_0xc711('0x3e')]=_[_0xc711('0x3f')](_0x5150f0[_0xc711('0x3b')],_0x5150f0[_0xc711('0x3c')]);_0x3ccf00[_0xc711('0x41')]=_[_0xc711('0x3f')](_0x5150f0[_0xc711('0x3b')],qs[_0xc711('0x40')](_0x162ce8[_0xc711('0x3c')][_0xc711('0x40')]));_0x3ccf00[_0xc711('0x41')]=_0x3ccf00[_0xc711('0x41')][_0xc711('0x50')]?_0x3ccf00[_0xc711('0x41')]:_0x5150f0[_0xc711('0x3b')];if(_0x162ce8[_0xc711('0x3c')][_0xc711('0x4b')]){_0x3ccf00[_0xc711('0x4c')]=[{'all':!![]}];}_0x3ccf00=_[_0xc711('0x48')]({},_0x3ccf00,_0x162ce8['options']);return db[_0xc711('0x4d')][_0xc711('0x51')](_0x3ccf00)['then'](handleEntityNotFound(_0x591a47,null))[_0xc711('0x32')](respondWithResult(_0x591a47,null))[_0xc711('0x26')](handleError(_0x591a47,null));};exports[_0xc711('0x52')]=function(_0x1a1fc2,_0x259d4d){return db[_0xc711('0x4d')]['create'](_0x1a1fc2[_0xc711('0x53')],{})[_0xc711('0x32')](respondWithResult(_0x259d4d,0xc9))[_0xc711('0x26')](handleError(_0x259d4d,null));};exports[_0xc711('0x31')]=function(_0x397053,_0x5cbfc6){if(_0x397053[_0xc711('0x53')]['id']){delete _0x397053[_0xc711('0x53')]['id'];}return db[_0xc711('0x4d')][_0xc711('0x51')]({'where':{'id':_0x397053[_0xc711('0x54')]['id']}})[_0xc711('0x32')](handleEntityNotFound(_0x5cbfc6,null))[_0xc711('0x32')](saveUpdates(_0x397053[_0xc711('0x53')],null))[_0xc711('0x32')](respondWithResult(_0x5cbfc6,null))[_0xc711('0x26')](handleError(_0x5cbfc6,null));};exports[_0xc711('0x33')]=function(_0x1ce869,_0x4b9beb){return db[_0xc711('0x4d')][_0xc711('0x51')]({'where':{'id':_0x1ce869['params']['id']}})[_0xc711('0x32')](handleEntityNotFound(_0x4b9beb,null))['then'](removeEntity(_0x4b9beb,null))['catch'](handleError(_0x4b9beb,null));};exports[_0xc711('0x55')]=function(_0x32b6e2,_0x14cb80,_0xb2adbf){var _0x107556={};var _0x1023be={};var _0x20cef4;var _0x124cfa;return db[_0xc711('0x4d')][_0xc711('0x56')]({'where':{'id':_0x32b6e2[_0xc711('0x54')]['id']}})['then'](handleEntityNotFound(_0x14cb80,null))['then'](function(_0x321dea){if(_0x321dea){_0x20cef4=_0x321dea;_0x1023be['model']=_[_0xc711('0x3d')](db[_0xc711('0x57')][_0xc711('0x38')]);_0x1023be[_0xc711('0x3c')]=_[_0xc711('0x3d')](_0x32b6e2[_0xc711('0x3c')]);_0x1023be[_0xc711('0x3e')]=_[_0xc711('0x3f')](_0x1023be[_0xc711('0x3b')],_0x1023be[_0xc711('0x3c')]);_0x107556['attributes']=_['intersection'](_0x1023be[_0xc711('0x3b')],qs['fields'](_0x32b6e2[_0xc711('0x3c')][_0xc711('0x40')]));_0x107556[_0xc711('0x41')]=_0x107556['attributes']['length']?_0x107556[_0xc711('0x41')]:_0x1023be[_0xc711('0x3b')];_0x107556[_0xc711('0x58')]=qs[_0xc711('0x44')](_0x32b6e2['query'][_0xc711('0x44')]);_0x107556[_0xc711('0x45')]=qs['filters'](_['pick'](_0x32b6e2[_0xc711('0x3c')],_0x1023be[_0xc711('0x3e')]));if(_0x32b6e2[_0xc711('0x3c')][_0xc711('0x47')]){_0x107556[_0xc711('0x45')]=_[_0xc711('0x48')](_0x107556['where'],{'$or':_[_0xc711('0x37')](_0x107556[_0xc711('0x41')],function(_0x599408){var _0x109945={};_0x109945[_0x599408]={'$like':'%'+_0x32b6e2[_0xc711('0x3c')][_0xc711('0x47')]+'%'};return _0x109945;})});}_0x107556=_[_0xc711('0x48')]({},_0x107556,_0x32b6e2[_0xc711('0x4a')]);return _0x20cef4['getFields'](_0x107556);}})[_0xc711('0x32')](function(_0x317a2f){if(_0x317a2f){_0x124cfa=_0x317a2f[_0xc711('0x50')];if(!_0x32b6e2[_0xc711('0x3c')]['hasOwnProperty'](_0xc711('0x59'))){_0x107556['limit']=qs[_0xc711('0x43')](_0x32b6e2[_0xc711('0x3c')][_0xc711('0x43')]);_0x107556[_0xc711('0x2b')]=qs[_0xc711('0x2b')](_0x32b6e2['query'][_0xc711('0x2b')]);}return _0x20cef4[_0xc711('0x55')](_0x107556);}})[_0xc711('0x32')](function(_0x567627){if(_0x567627){return _0x567627?{'count':_0x124cfa,'rows':_0x567627}:null;}})[_0xc711('0x32')](respondWithResult(_0x14cb80,null))[_0xc711('0x26')](handleError(_0x14cb80,null));};exports[_0xc711('0x5a')]=function(_0x176fc6,_0x134f34,_0x3b78fd){var _0x2c7549={};var _0x4ac72a={};var _0x455f15;var _0x3179cc;return db[_0xc711('0x4d')][_0xc711('0x56')]({'where':{'id':_0x176fc6['params']['id']}})[_0xc711('0x32')](handleEntityNotFound(_0x134f34,null))[_0xc711('0x32')](function(_0x2e3f75){if(_0x2e3f75){_0x455f15=_0x2e3f75;_0x4ac72a[_0xc711('0x3b')]=_[_0xc711('0x3d')](db['FreshdeskField'][_0xc711('0x38')]);_0x4ac72a[_0xc711('0x3c')]=_[_0xc711('0x3d')](_0x176fc6['query']);_0x4ac72a[_0xc711('0x3e')]=_[_0xc711('0x3f')](_0x4ac72a[_0xc711('0x3b')],_0x4ac72a[_0xc711('0x3c')]);_0x2c7549['attributes']=_[_0xc711('0x3f')](_0x4ac72a[_0xc711('0x3b')],qs[_0xc711('0x40')](_0x176fc6[_0xc711('0x3c')][_0xc711('0x40')]));_0x2c7549[_0xc711('0x41')]=_0x2c7549[_0xc711('0x41')][_0xc711('0x50')]?_0x2c7549[_0xc711('0x41')]:_0x4ac72a[_0xc711('0x3b')];_0x2c7549['order']=qs[_0xc711('0x44')](_0x176fc6[_0xc711('0x3c')][_0xc711('0x44')]);_0x2c7549[_0xc711('0x45')]=qs[_0xc711('0x3e')](_[_0xc711('0x46')](_0x176fc6['query'],_0x4ac72a['filters']));if(_0x176fc6['query'][_0xc711('0x47')]){_0x2c7549['where']=_[_0xc711('0x48')](_0x2c7549['where'],{'$or':_[_0xc711('0x37')](_0x2c7549['attributes'],function(_0x4d266b){var _0x4b5f29={};_0x4b5f29[_0x4d266b]={'$like':'%'+_0x176fc6[_0xc711('0x3c')][_0xc711('0x47')]+'%'};return _0x4b5f29;})});}_0x2c7549=_[_0xc711('0x48')]({},_0x2c7549,_0x176fc6[_0xc711('0x4a')]);return _0x455f15[_0xc711('0x5a')](_0x2c7549);}})[_0xc711('0x32')](function(_0x18485c){if(_0x18485c){_0x3179cc=_0x18485c[_0xc711('0x50')];if(!_0x176fc6[_0xc711('0x3c')]['hasOwnProperty'](_0xc711('0x59'))){_0x2c7549[_0xc711('0x43')]=qs[_0xc711('0x43')](_0x176fc6[_0xc711('0x3c')][_0xc711('0x43')]);_0x2c7549[_0xc711('0x2b')]=qs[_0xc711('0x2b')](_0x176fc6[_0xc711('0x3c')][_0xc711('0x2b')]);}return _0x455f15['getSubjects'](_0x2c7549);}})[_0xc711('0x32')](function(_0x1e270e){if(_0x1e270e){return _0x1e270e?{'count':_0x3179cc,'rows':_0x1e270e}:null;}})[_0xc711('0x32')](respondWithResult(_0x134f34,null))[_0xc711('0x26')](handleError(_0x134f34,null));};exports[_0xc711('0x5b')]=function(_0x430dde,_0x33832e,_0x524764){var _0x48fb8f={};var _0x1a6efb={};var _0x122f60;var _0xbfba8d;return db[_0xc711('0x4d')][_0xc711('0x56')]({'where':{'id':_0x430dde[_0xc711('0x54')]['id']}})[_0xc711('0x32')](handleEntityNotFound(_0x33832e,null))[_0xc711('0x32')](function(_0x146e58){if(_0x146e58){_0x122f60=_0x146e58;_0x1a6efb['model']=_[_0xc711('0x3d')](db[_0xc711('0x57')]['rawAttributes']);_0x1a6efb[_0xc711('0x3c')]=_[_0xc711('0x3d')](_0x430dde[_0xc711('0x3c')]);_0x1a6efb[_0xc711('0x3e')]=_[_0xc711('0x3f')](_0x1a6efb[_0xc711('0x3b')],_0x1a6efb[_0xc711('0x3c')]);_0x48fb8f[_0xc711('0x41')]=_[_0xc711('0x3f')](_0x1a6efb[_0xc711('0x3b')],qs[_0xc711('0x40')](_0x430dde[_0xc711('0x3c')][_0xc711('0x40')]));_0x48fb8f['attributes']=_0x48fb8f[_0xc711('0x41')][_0xc711('0x50')]?_0x48fb8f['attributes']:_0x1a6efb[_0xc711('0x3b')];_0x48fb8f[_0xc711('0x58')]=qs[_0xc711('0x44')](_0x430dde[_0xc711('0x3c')][_0xc711('0x44')]);_0x48fb8f[_0xc711('0x45')]=qs[_0xc711('0x3e')](_[_0xc711('0x46')](_0x430dde[_0xc711('0x3c')],_0x1a6efb[_0xc711('0x3e')]));if(_0x430dde[_0xc711('0x3c')][_0xc711('0x47')]){_0x48fb8f[_0xc711('0x45')]=_[_0xc711('0x48')](_0x48fb8f['where'],{'$or':_[_0xc711('0x37')](_0x48fb8f[_0xc711('0x41')],function(_0x25851c){var _0x54c97c={};_0x54c97c[_0x25851c]={'$like':'%'+_0x430dde[_0xc711('0x3c')][_0xc711('0x47')]+'%'};return _0x54c97c;})});}_0x48fb8f=_['merge']({},_0x48fb8f,_0x430dde[_0xc711('0x4a')]);return _0x122f60[_0xc711('0x5b')](_0x48fb8f);}})[_0xc711('0x32')](function(_0x3361d0){if(_0x3361d0){_0xbfba8d=_0x3361d0[_0xc711('0x50')];if(!_0x430dde[_0xc711('0x3c')][_0xc711('0x42')](_0xc711('0x59'))){_0x48fb8f[_0xc711('0x43')]=qs[_0xc711('0x43')](_0x430dde['query'][_0xc711('0x43')]);_0x48fb8f[_0xc711('0x2b')]=qs[_0xc711('0x2b')](_0x430dde[_0xc711('0x3c')][_0xc711('0x2b')]);}return _0x122f60[_0xc711('0x5b')](_0x48fb8f);}})[_0xc711('0x32')](function(_0xce16c5){if(_0xce16c5){return _0xce16c5?{'count':_0xbfba8d,'rows':_0xce16c5}:null;}})[_0xc711('0x32')](respondWithResult(_0x33832e,null))[_0xc711('0x26')](handleError(_0x33832e,null));};exports[_0xc711('0x5c')]=function(_0x156d38,_0x52f7ae,_0x7ecd22){var _0x2f1fc3={};var _0x395c82={};var _0x144ac6;var _0x5d4127;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x156d38[_0xc711('0x54')]['id']}})[_0xc711('0x32')](handleEntityNotFound(_0x52f7ae,null))['then'](function(_0x19e434){if(_0x19e434){_0x144ac6=_0x19e434;_0x395c82[_0xc711('0x3b')]=_[_0xc711('0x3d')](db[_0xc711('0x5d')]['rawAttributes']);_0x395c82[_0xc711('0x3c')]=_[_0xc711('0x3d')](_0x156d38[_0xc711('0x3c')]);_0x395c82['filters']=_['intersection'](_0x395c82['model'],_0x395c82['query']);_0x2f1fc3[_0xc711('0x41')]=_[_0xc711('0x3f')](_0x395c82[_0xc711('0x3b')],qs[_0xc711('0x40')](_0x156d38['query'][_0xc711('0x40')]));_0x2f1fc3[_0xc711('0x41')]=_0x2f1fc3[_0xc711('0x41')][_0xc711('0x50')]?_0x2f1fc3[_0xc711('0x41')]:_0x395c82[_0xc711('0x3b')];_0x2f1fc3[_0xc711('0x58')]=qs['sort'](_0x156d38[_0xc711('0x3c')][_0xc711('0x44')]);_0x2f1fc3[_0xc711('0x45')]=qs[_0xc711('0x3e')](_['pick'](_0x156d38[_0xc711('0x3c')],_0x395c82[_0xc711('0x3e')]));if(_0x156d38[_0xc711('0x3c')][_0xc711('0x47')]){_0x2f1fc3[_0xc711('0x45')]=_[_0xc711('0x48')](_0x2f1fc3['where'],{'$or':_[_0xc711('0x37')](_0x2f1fc3[_0xc711('0x41')],function(_0x1e7672){var _0x36b589={};_0x36b589[_0x1e7672]={'$like':'%'+_0x156d38['query'][_0xc711('0x47')]+'%'};return _0x36b589;})});}_0x2f1fc3=_[_0xc711('0x48')]({},_0x2f1fc3,_0x156d38['options']);return _0x144ac6[_0xc711('0x5c')](_0x2f1fc3);}})['then'](function(_0x2d60f3){if(_0x2d60f3){_0x5d4127=_0x2d60f3[_0xc711('0x50')];if(!_0x156d38['query'][_0xc711('0x42')](_0xc711('0x59'))){_0x2f1fc3[_0xc711('0x43')]=qs['limit'](_0x156d38[_0xc711('0x3c')]['limit']);_0x2f1fc3[_0xc711('0x2b')]=qs[_0xc711('0x2b')](_0x156d38[_0xc711('0x3c')]['offset']);}return _0x144ac6[_0xc711('0x5c')](_0x2f1fc3);}})[_0xc711('0x32')](function(_0x4f7b34){if(_0x4f7b34){return _0x4f7b34?{'count':_0x5d4127,'rows':_0x4f7b34}:null;}})['then'](respondWithResult(_0x52f7ae,null))['catch'](handleError(_0x52f7ae,null));};exports['setTags']=function(_0x25f763,_0x1def2b,_0x15c3b8){if(_0x25f763[_0xc711('0x53')]['id']){delete _0x25f763[_0xc711('0x53')]['id'];}return db[_0xc711('0x4d')][_0xc711('0x56')]({'where':{'id':_0x25f763[_0xc711('0x54')]['id']}})['then'](handleEntityNotFound(_0x1def2b,null))[_0xc711('0x32')](function(_0x162bbc){if(_0x162bbc){return _0x162bbc[_0xc711('0x5e')](_0x25f763['body'][_0xc711('0x5f')]||[]);}return null;})[_0xc711('0x32')](respondWithResult(_0x1def2b,null))[_0xc711('0x26')](handleError(_0x1def2b,null));}; \ No newline at end of file +var _0x88ef=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','getFields','FreshdeskField','order','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','FreshdeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x369289,_0xb779d8){var _0x1c8ba4=function(_0x28cc27){while(--_0x28cc27){_0x369289['push'](_0x369289['shift']());}};_0x1c8ba4(++_0xb779d8);}(_0x88ef,0x139));var _0xf88e=function(_0x3648ed,_0x3158db){_0x3648ed=_0x3648ed-0x0;var _0xfffa30=_0x88ef[_0x3648ed];return _0xfffa30;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf88e('0x0'));var rimraf=require(_0xf88e('0x1'));var zipdir=require(_0xf88e('0x2'));var jsonpatch=require(_0xf88e('0x3'));var rp=require(_0xf88e('0x4'));var moment=require(_0xf88e('0x5'));var BPromise=require(_0xf88e('0x6'));var Mustache=require(_0xf88e('0x7'));var util=require(_0xf88e('0x8'));var path=require(_0xf88e('0x9'));var sox=require(_0xf88e('0xa'));var csv=require('to-csv');var ejs=require(_0xf88e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf88e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf88e('0xd'));var deskjs=require(_0xf88e('0xe'));var toCsv=require(_0xf88e('0xf'));var querystring=require(_0xf88e('0x10'));var Papa=require(_0xf88e('0x11'));var Redis=require(_0xf88e('0x12'));var authService=require(_0xf88e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf88e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf88e('0x15'));var utils=require(_0xf88e('0x16'));var config=require(_0xf88e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf88e('0x18'))['db'];var jayson=require(_0xf88e('0x19'));var client=jayson[_0xf88e('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53881e,_0x24176c,_0x198460,_0x4f4c62){return new BPromise(function(_0x5c75c7,_0x338ed7){var _0x151770=_0x4f4c62||client;return _0x151770[_0xf88e('0x1b')](_0x53881e,_0x198460)['then'](function(_0x2f5835){logger[_0xf88e('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24176c,_0xf88e('0x1d'));logger[_0xf88e('0x1e')](_0xf88e('0x1f'),_0x24176c,_0xf88e('0x1d'),JSON[_0xf88e('0x20')](_0x2f5835));if(_0x2f5835[_0xf88e('0x21')]){if(_0x2f5835[_0xf88e('0x21')][_0xf88e('0x22')]===0x1f4){logger[_0xf88e('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24176c,_0x2f5835[_0xf88e('0x21')][_0xf88e('0x23')]);return _0x338ed7(_0x2f5835[_0xf88e('0x21')][_0xf88e('0x23')]);}logger[_0xf88e('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24176c,_0x2f5835['error'][_0xf88e('0x23')]);return _0x5c75c7(_0x2f5835[_0xf88e('0x21')][_0xf88e('0x23')]);}else{logger[_0xf88e('0x1c')](_0xf88e('0x24'),_0x24176c,_0xf88e('0x1d'));_0x5c75c7(_0x2f5835[_0xf88e('0x25')][_0xf88e('0x23')]);}})[_0xf88e('0x26')](function(_0x2f35eb){logger[_0xf88e('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24176c,_0x2f35eb);_0x338ed7(_0x2f35eb);});});}function respondWithStatusCode(_0x373ce9,_0xad8f20){_0xad8f20=_0xad8f20||0xcc;return function(_0x292cf1){if(_0x292cf1){return _0x373ce9['sendStatus'](_0xad8f20);}return _0x373ce9[_0xf88e('0x27')](_0xad8f20)[_0xf88e('0x28')]();};}function respondWithResult(_0x590a7d,_0x6029b6){_0x6029b6=_0x6029b6||0xc8;return function(_0x3753fc){if(_0x3753fc){return _0x590a7d[_0xf88e('0x27')](_0x6029b6)['json'](_0x3753fc);}};}function respondWithFilteredResult(_0x320361,_0x54891b){return function(_0x15dae5){if(_0x15dae5){var _0x25830f=_0x15dae5[_0xf88e('0x29')],_0x15e4f6=_0x54891b[_0xf88e('0x2a')],_0x2d6863=_0x54891b['offset']+_0x54891b[_0xf88e('0x2b')],_0x43c50d;if(_0x2d6863>=_0x25830f){_0x2d6863=_0x25830f;_0x43c50d=0xc8;}else{_0x43c50d=0xce;}_0x320361[_0xf88e('0x27')](_0x43c50d);return _0x320361[_0xf88e('0x2c')](_0xf88e('0x2d'),_0x15e4f6+'-'+_0x2d6863+'/'+_0x25830f)[_0xf88e('0x2e')](_0x15dae5);}return null;};}function patchUpdates(_0x15d97e){return function(_0x1da9d3){try{jsonpatch[_0xf88e('0x2f')](_0x1da9d3,_0x15d97e,!![]);}catch(_0x50e64c){return BPromise[_0xf88e('0x30')](_0x50e64c);}return _0x1da9d3[_0xf88e('0x31')]();};}function saveUpdates(_0x4da930,_0xe13451){return function(_0x22c42b){if(_0x22c42b){return _0x22c42b[_0xf88e('0x32')](_0x4da930)[_0xf88e('0x33')](function(_0x1193b0){return _0x1193b0;});}return null;};}function removeEntity(_0x4710b7,_0x357d50){return function(_0x4a9754){if(_0x4a9754){return _0x4a9754[_0xf88e('0x34')]()['then'](function(){_0x4710b7[_0xf88e('0x27')](0xcc)[_0xf88e('0x28')]();});}};}function handleEntityNotFound(_0x220292,_0x354855){return function(_0x213b1c){if(!_0x213b1c){_0x220292[_0xf88e('0x35')](0x194);}return _0x213b1c;};}function handleError(_0x208268,_0xdc6362){_0xdc6362=_0xdc6362||0x1f4;return function(_0x55e7ab){logger[_0xf88e('0x21')](_0x55e7ab[_0xf88e('0x36')]);if(_0x55e7ab[_0xf88e('0x37')]){delete _0x55e7ab[_0xf88e('0x37')];}_0x208268['status'](_0xdc6362)['send'](_0x55e7ab);};}exports[_0xf88e('0x38')]=function(_0x5e2a3a,_0x2a3ef9){var _0x240172={},_0x3ee50e={},_0x5daaf2={'count':0x0,'rows':[]};var _0x172d8e=_['map'](db[_0xf88e('0x39')][_0xf88e('0x3a')],function(_0x216ab5){return{'name':_0x216ab5['fieldName'],'type':_0x216ab5[_0xf88e('0x3b')][_0xf88e('0x3c')]};});_0x3ee50e[_0xf88e('0x3d')]=_[_0xf88e('0x3e')](_0x172d8e,_0xf88e('0x37'));_0x3ee50e[_0xf88e('0x3f')]=_[_0xf88e('0x40')](_0x5e2a3a[_0xf88e('0x3f')]);_0x3ee50e[_0xf88e('0x41')]=_['intersection'](_0x3ee50e['model'],_0x3ee50e[_0xf88e('0x3f')]);_0x240172[_0xf88e('0x42')]=_[_0xf88e('0x43')](_0x3ee50e[_0xf88e('0x3d')],qs[_0xf88e('0x44')](_0x5e2a3a['query']['fields']));_0x240172[_0xf88e('0x42')]=_0x240172['attributes'][_0xf88e('0x45')]?_0x240172[_0xf88e('0x42')]:_0x3ee50e[_0xf88e('0x3d')];if(!_0x5e2a3a[_0xf88e('0x3f')][_0xf88e('0x46')](_0xf88e('0x47'))){_0x240172[_0xf88e('0x2b')]=qs[_0xf88e('0x2b')](_0x5e2a3a[_0xf88e('0x3f')][_0xf88e('0x2b')]);_0x240172[_0xf88e('0x2a')]=qs['offset'](_0x5e2a3a[_0xf88e('0x3f')]['offset']);}_0x240172['order']=qs['sort'](_0x5e2a3a[_0xf88e('0x3f')][_0xf88e('0x48')]);_0x240172[_0xf88e('0x49')]=qs[_0xf88e('0x41')](_[_0xf88e('0x4a')](_0x5e2a3a[_0xf88e('0x3f')],_0x3ee50e[_0xf88e('0x41')]),_0x172d8e);if(_0x5e2a3a['query'][_0xf88e('0x4b')]){_0x240172[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0x240172['where'],{'$or':_[_0xf88e('0x3e')](_0x172d8e,function(_0x2b6225){if(_0x2b6225[_0xf88e('0x3b')]!==_0xf88e('0x4d')){var _0x132eb3={};_0x132eb3[_0x2b6225[_0xf88e('0x37')]]={'$like':'%'+_0x5e2a3a['query'][_0xf88e('0x4b')]+'%'};return _0x132eb3;}})});}_0x240172=_[_0xf88e('0x4c')]({},_0x240172,_0x5e2a3a[_0xf88e('0x4e')]);var _0xad7a9e={'where':_0x240172[_0xf88e('0x49')]};return db[_0xf88e('0x39')]['count'](_0xad7a9e)['then'](function(_0x35683b){_0x5daaf2[_0xf88e('0x29')]=_0x35683b;if(_0x5e2a3a[_0xf88e('0x3f')][_0xf88e('0x4f')]){_0x240172[_0xf88e('0x50')]=[{'all':!![]}];}return db[_0xf88e('0x39')][_0xf88e('0x51')](_0x240172);})['then'](function(_0x407f59){_0x5daaf2[_0xf88e('0x52')]=_0x407f59;return _0x5daaf2;})[_0xf88e('0x33')](respondWithFilteredResult(_0x2a3ef9,_0x240172))['catch'](handleError(_0x2a3ef9,null));};exports['show']=function(_0x5b8642,_0x43e5cf){var _0x10b1eb={'raw':![],'where':{'id':_0x5b8642[_0xf88e('0x53')]['id']}},_0x4e0e3c={};_0x4e0e3c[_0xf88e('0x3d')]=_['keys'](db[_0xf88e('0x39')]['rawAttributes']);_0x4e0e3c[_0xf88e('0x3f')]=_[_0xf88e('0x40')](_0x5b8642['query']);_0x4e0e3c[_0xf88e('0x41')]=_[_0xf88e('0x43')](_0x4e0e3c[_0xf88e('0x3d')],_0x4e0e3c['query']);_0x10b1eb[_0xf88e('0x42')]=_[_0xf88e('0x43')](_0x4e0e3c[_0xf88e('0x3d')],qs[_0xf88e('0x44')](_0x5b8642[_0xf88e('0x3f')][_0xf88e('0x44')]));_0x10b1eb[_0xf88e('0x42')]=_0x10b1eb[_0xf88e('0x42')]['length']?_0x10b1eb[_0xf88e('0x42')]:_0x4e0e3c['model'];if(_0x5b8642[_0xf88e('0x3f')][_0xf88e('0x4f')]){_0x10b1eb[_0xf88e('0x50')]=[{'all':!![]}];}_0x10b1eb=_[_0xf88e('0x4c')]({},_0x10b1eb,_0x5b8642[_0xf88e('0x4e')]);return db[_0xf88e('0x39')][_0xf88e('0x54')](_0x10b1eb)[_0xf88e('0x33')](handleEntityNotFound(_0x43e5cf,null))[_0xf88e('0x33')](respondWithResult(_0x43e5cf,null))[_0xf88e('0x26')](handleError(_0x43e5cf,null));};exports[_0xf88e('0x55')]=function(_0x2e61a7,_0x2e155a){return db['FreshdeskConfiguration'][_0xf88e('0x55')](_0x2e61a7[_0xf88e('0x56')],{})['then'](respondWithResult(_0x2e155a,0xc9))[_0xf88e('0x26')](handleError(_0x2e155a,null));};exports[_0xf88e('0x32')]=function(_0x5b53ef,_0x4261a7){if(_0x5b53ef[_0xf88e('0x56')]['id']){delete _0x5b53ef[_0xf88e('0x56')]['id'];}return db[_0xf88e('0x39')][_0xf88e('0x54')]({'where':{'id':_0x5b53ef['params']['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0x4261a7,null))[_0xf88e('0x33')](saveUpdates(_0x5b53ef[_0xf88e('0x56')],null))[_0xf88e('0x33')](respondWithResult(_0x4261a7,null))['catch'](handleError(_0x4261a7,null));};exports[_0xf88e('0x34')]=function(_0x44a349,_0x4d18fa){return db[_0xf88e('0x39')][_0xf88e('0x54')]({'where':{'id':_0x44a349['params']['id']}})['then'](handleEntityNotFound(_0x4d18fa,null))[_0xf88e('0x33')](removeEntity(_0x4d18fa,null))[_0xf88e('0x26')](handleError(_0x4d18fa,null));};exports[_0xf88e('0x57')]=function(_0x2955b7,_0x215015,_0xcfe5e3){var _0x1db0ce={};var _0x2c2cc7={};var _0x153052;var _0x452089;return db[_0xf88e('0x39')]['findOne']({'where':{'id':_0x2955b7[_0xf88e('0x53')]['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0x215015,null))[_0xf88e('0x33')](function(_0x3fc33b){if(_0x3fc33b){_0x153052=_0x3fc33b;_0x2c2cc7['model']=_[_0xf88e('0x40')](db[_0xf88e('0x58')][_0xf88e('0x3a')]);_0x2c2cc7['query']=_[_0xf88e('0x40')](_0x2955b7['query']);_0x2c2cc7[_0xf88e('0x41')]=_['intersection'](_0x2c2cc7[_0xf88e('0x3d')],_0x2c2cc7[_0xf88e('0x3f')]);_0x1db0ce['attributes']=_[_0xf88e('0x43')](_0x2c2cc7['model'],qs[_0xf88e('0x44')](_0x2955b7[_0xf88e('0x3f')][_0xf88e('0x44')]));_0x1db0ce[_0xf88e('0x42')]=_0x1db0ce[_0xf88e('0x42')][_0xf88e('0x45')]?_0x1db0ce['attributes']:_0x2c2cc7[_0xf88e('0x3d')];_0x1db0ce[_0xf88e('0x59')]=qs[_0xf88e('0x48')](_0x2955b7[_0xf88e('0x3f')][_0xf88e('0x48')]);_0x1db0ce['where']=qs[_0xf88e('0x41')](_[_0xf88e('0x4a')](_0x2955b7[_0xf88e('0x3f')],_0x2c2cc7[_0xf88e('0x41')]));if(_0x2955b7[_0xf88e('0x3f')][_0xf88e('0x4b')]){_0x1db0ce[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0x1db0ce['where'],{'$or':_[_0xf88e('0x3e')](_0x1db0ce['attributes'],function(_0x12db13){var _0x45d03d={};_0x45d03d[_0x12db13]={'$like':'%'+_0x2955b7[_0xf88e('0x3f')]['filter']+'%'};return _0x45d03d;})});}_0x1db0ce=_[_0xf88e('0x4c')]({},_0x1db0ce,_0x2955b7['options']);return _0x153052['getFields'](_0x1db0ce);}})['then'](function(_0x11b695){if(_0x11b695){_0x452089=_0x11b695['length'];if(!_0x2955b7[_0xf88e('0x3f')]['hasOwnProperty'](_0xf88e('0x47'))){_0x1db0ce[_0xf88e('0x2b')]=qs[_0xf88e('0x2b')](_0x2955b7[_0xf88e('0x3f')][_0xf88e('0x2b')]);_0x1db0ce[_0xf88e('0x2a')]=qs[_0xf88e('0x2a')](_0x2955b7['query']['offset']);}return _0x153052[_0xf88e('0x57')](_0x1db0ce);}})[_0xf88e('0x33')](function(_0x1a3f23){if(_0x1a3f23){return _0x1a3f23?{'count':_0x452089,'rows':_0x1a3f23}:null;}})['then'](respondWithResult(_0x215015,null))[_0xf88e('0x26')](handleError(_0x215015,null));};exports['getSubjects']=function(_0x1cecc7,_0x1f5879,_0x46d39c){var _0x5ad521={};var _0x3c708d={};var _0x455ad7;var _0x10b6eb;return db[_0xf88e('0x39')][_0xf88e('0x5a')]({'where':{'id':_0x1cecc7[_0xf88e('0x53')]['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0x1f5879,null))['then'](function(_0x11f6a8){if(_0x11f6a8){_0x455ad7=_0x11f6a8;_0x3c708d[_0xf88e('0x3d')]=_[_0xf88e('0x40')](db[_0xf88e('0x58')][_0xf88e('0x3a')]);_0x3c708d[_0xf88e('0x3f')]=_[_0xf88e('0x40')](_0x1cecc7[_0xf88e('0x3f')]);_0x3c708d[_0xf88e('0x41')]=_[_0xf88e('0x43')](_0x3c708d['model'],_0x3c708d[_0xf88e('0x3f')]);_0x5ad521['attributes']=_[_0xf88e('0x43')](_0x3c708d[_0xf88e('0x3d')],qs[_0xf88e('0x44')](_0x1cecc7['query'][_0xf88e('0x44')]));_0x5ad521[_0xf88e('0x42')]=_0x5ad521[_0xf88e('0x42')][_0xf88e('0x45')]?_0x5ad521[_0xf88e('0x42')]:_0x3c708d[_0xf88e('0x3d')];_0x5ad521[_0xf88e('0x59')]=qs[_0xf88e('0x48')](_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x48')]);_0x5ad521[_0xf88e('0x49')]=qs[_0xf88e('0x41')](_['pick'](_0x1cecc7[_0xf88e('0x3f')],_0x3c708d[_0xf88e('0x41')]));if(_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x4b')]){_0x5ad521[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0x5ad521[_0xf88e('0x49')],{'$or':_['map'](_0x5ad521[_0xf88e('0x42')],function(_0x3f81fb){var _0x1661a0={};_0x1661a0[_0x3f81fb]={'$like':'%'+_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x4b')]+'%'};return _0x1661a0;})});}_0x5ad521=_[_0xf88e('0x4c')]({},_0x5ad521,_0x1cecc7[_0xf88e('0x4e')]);return _0x455ad7[_0xf88e('0x5b')](_0x5ad521);}})[_0xf88e('0x33')](function(_0x4aa728){if(_0x4aa728){_0x10b6eb=_0x4aa728[_0xf88e('0x45')];if(!_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x46')](_0xf88e('0x47'))){_0x5ad521[_0xf88e('0x2b')]=qs[_0xf88e('0x2b')](_0x1cecc7['query']['limit']);_0x5ad521[_0xf88e('0x2a')]=qs[_0xf88e('0x2a')](_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x2a')]);}return _0x455ad7[_0xf88e('0x5b')](_0x5ad521);}})[_0xf88e('0x33')](function(_0x4b6d24){if(_0x4b6d24){return _0x4b6d24?{'count':_0x10b6eb,'rows':_0x4b6d24}:null;}})[_0xf88e('0x33')](respondWithResult(_0x1f5879,null))[_0xf88e('0x26')](handleError(_0x1f5879,null));};exports[_0xf88e('0x5c')]=function(_0x162026,_0xc8aa3d,_0x5d3b17){var _0x546a59={};var _0x1c475b={};var _0x6938a4;var _0xfd8941;return db[_0xf88e('0x39')][_0xf88e('0x5a')]({'where':{'id':_0x162026[_0xf88e('0x53')]['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0xc8aa3d,null))[_0xf88e('0x33')](function(_0x55d16c){if(_0x55d16c){_0x6938a4=_0x55d16c;_0x1c475b[_0xf88e('0x3d')]=_[_0xf88e('0x40')](db[_0xf88e('0x58')]['rawAttributes']);_0x1c475b['query']=_[_0xf88e('0x40')](_0x162026['query']);_0x1c475b['filters']=_[_0xf88e('0x43')](_0x1c475b[_0xf88e('0x3d')],_0x1c475b[_0xf88e('0x3f')]);_0x546a59[_0xf88e('0x42')]=_[_0xf88e('0x43')](_0x1c475b[_0xf88e('0x3d')],qs['fields'](_0x162026['query'][_0xf88e('0x44')]));_0x546a59[_0xf88e('0x42')]=_0x546a59['attributes'][_0xf88e('0x45')]?_0x546a59[_0xf88e('0x42')]:_0x1c475b['model'];_0x546a59[_0xf88e('0x59')]=qs['sort'](_0x162026['query']['sort']);_0x546a59[_0xf88e('0x49')]=qs[_0xf88e('0x41')](_[_0xf88e('0x4a')](_0x162026['query'],_0x1c475b['filters']));if(_0x162026[_0xf88e('0x3f')][_0xf88e('0x4b')]){_0x546a59[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0x546a59[_0xf88e('0x49')],{'$or':_[_0xf88e('0x3e')](_0x546a59[_0xf88e('0x42')],function(_0x41d6f9){var _0x16d85a={};_0x16d85a[_0x41d6f9]={'$like':'%'+_0x162026[_0xf88e('0x3f')][_0xf88e('0x4b')]+'%'};return _0x16d85a;})});}_0x546a59=_[_0xf88e('0x4c')]({},_0x546a59,_0x162026[_0xf88e('0x4e')]);return _0x6938a4['getDescriptions'](_0x546a59);}})[_0xf88e('0x33')](function(_0x2a4c83){if(_0x2a4c83){_0xfd8941=_0x2a4c83[_0xf88e('0x45')];if(!_0x162026['query'][_0xf88e('0x46')](_0xf88e('0x47'))){_0x546a59[_0xf88e('0x2b')]=qs[_0xf88e('0x2b')](_0x162026[_0xf88e('0x3f')]['limit']);_0x546a59[_0xf88e('0x2a')]=qs[_0xf88e('0x2a')](_0x162026[_0xf88e('0x3f')][_0xf88e('0x2a')]);}return _0x6938a4[_0xf88e('0x5c')](_0x546a59);}})[_0xf88e('0x33')](function(_0x5eaf0f){if(_0x5eaf0f){return _0x5eaf0f?{'count':_0xfd8941,'rows':_0x5eaf0f}:null;}})[_0xf88e('0x33')](respondWithResult(_0xc8aa3d,null))[_0xf88e('0x26')](handleError(_0xc8aa3d,null));};exports[_0xf88e('0x5d')]=function(_0x3f38a3,_0x3c7879,_0x1bee3f){var _0xb2f674={};var _0x119ca2={};var _0x462c02;var _0x324901;return db['FreshdeskConfiguration'][_0xf88e('0x5a')]({'where':{'id':_0x3f38a3[_0xf88e('0x53')]['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0x3c7879,null))[_0xf88e('0x33')](function(_0x416128){if(_0x416128){_0x462c02=_0x416128;_0x119ca2[_0xf88e('0x3d')]=_['keys'](db[_0xf88e('0x5e')][_0xf88e('0x3a')]);_0x119ca2[_0xf88e('0x3f')]=_[_0xf88e('0x40')](_0x3f38a3['query']);_0x119ca2[_0xf88e('0x41')]=_[_0xf88e('0x43')](_0x119ca2[_0xf88e('0x3d')],_0x119ca2[_0xf88e('0x3f')]);_0xb2f674[_0xf88e('0x42')]=_['intersection'](_0x119ca2[_0xf88e('0x3d')],qs[_0xf88e('0x44')](_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x44')]));_0xb2f674['attributes']=_0xb2f674[_0xf88e('0x42')][_0xf88e('0x45')]?_0xb2f674[_0xf88e('0x42')]:_0x119ca2[_0xf88e('0x3d')];_0xb2f674[_0xf88e('0x59')]=qs[_0xf88e('0x48')](_0x3f38a3[_0xf88e('0x3f')]['sort']);_0xb2f674[_0xf88e('0x49')]=qs[_0xf88e('0x41')](_['pick'](_0x3f38a3[_0xf88e('0x3f')],_0x119ca2[_0xf88e('0x41')]));if(_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x4b')]){_0xb2f674[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0xb2f674[_0xf88e('0x49')],{'$or':_[_0xf88e('0x3e')](_0xb2f674[_0xf88e('0x42')],function(_0x2f7426){var _0x499714={};_0x499714[_0x2f7426]={'$like':'%'+_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x4b')]+'%'};return _0x499714;})});}_0xb2f674=_['merge']({},_0xb2f674,_0x3f38a3[_0xf88e('0x4e')]);return _0x462c02['getTags'](_0xb2f674);}})['then'](function(_0x5f5d93){if(_0x5f5d93){_0x324901=_0x5f5d93[_0xf88e('0x45')];if(!_0x3f38a3['query']['hasOwnProperty']('nolimit')){_0xb2f674[_0xf88e('0x2b')]=qs['limit'](_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x2b')]);_0xb2f674[_0xf88e('0x2a')]=qs[_0xf88e('0x2a')](_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x2a')]);}return _0x462c02['getTags'](_0xb2f674);}})[_0xf88e('0x33')](function(_0x440e78){if(_0x440e78){return _0x440e78?{'count':_0x324901,'rows':_0x440e78}:null;}})[_0xf88e('0x33')](respondWithResult(_0x3c7879,null))[_0xf88e('0x26')](handleError(_0x3c7879,null));};exports[_0xf88e('0x5f')]=function(_0x476978,_0x3d2671,_0x1de208){if(_0x476978['body']['id']){delete _0x476978[_0xf88e('0x56')]['id'];}return db[_0xf88e('0x39')][_0xf88e('0x5a')]({'where':{'id':_0x476978[_0xf88e('0x53')]['id']}})['then'](handleEntityNotFound(_0x3d2671,null))[_0xf88e('0x33')](function(_0x506721){if(_0x506721){return _0x506721[_0xf88e('0x5f')](_0x476978[_0xf88e('0x56')][_0xf88e('0x60')]||[]);}return null;})[_0xf88e('0x33')](respondWithResult(_0x3d2671,null))[_0xf88e('0x26')](handleError(_0x3d2671,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index d2007d7..df15d17 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x293d=['define','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x293d,0x12d));var _0xd293=function(_0x1ed6e8,_0x3c204b){_0x1ed6e8=_0x1ed6e8-0x0;var _0xa2e43d=_0x293d[_0x1ed6e8];return _0xa2e43d;};'use strict';var _=require(_0xd293('0x0'));var util=require(_0xd293('0x1'));var logger=require(_0xd293('0x2'))(_0xd293('0x3'));var moment=require('moment');var BPromise=require(_0xd293('0x4'));var rp=require(_0xd293('0x5'));var fs=require('fs');var path=require(_0xd293('0x6'));var rimraf=require(_0xd293('0x7'));var config=require(_0xd293('0x8'));var attributes=require(_0xd293('0x9'));module[_0xd293('0xa')]=function(_0x4f31d5,_0x157c32){return _0x4f31d5[_0xd293('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0xd293('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc68=['exports','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x58ae9f,_0xcaa7d7){var _0x4c966d=function(_0x401fbe){while(--_0x401fbe){_0x58ae9f['push'](_0x58ae9f['shift']());}};_0x4c966d(++_0xcaa7d7);}(_0xcc68,0xda));var _0x8cc6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcc68[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x8cc6('0x0'));var util=require(_0x8cc6('0x1'));var logger=require(_0x8cc6('0x2'))(_0x8cc6('0x3'));var moment=require(_0x8cc6('0x4'));var BPromise=require(_0x8cc6('0x5'));var rp=require(_0x8cc6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cc6('0x7'));var config=require(_0x8cc6('0x8'));var attributes=require(_0x8cc6('0x9'));module[_0x8cc6('0xa')]=function(_0x155d79,_0x20e227){return _0x155d79['define'](_0x8cc6('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 23af7a3..355e826 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0387=['jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x19f9e7,_0x43ce72){var _0x4ecc57=function(_0x487052){while(--_0x487052){_0x19f9e7['push'](_0x19f9e7['shift']());}};_0x4ecc57(++_0x43ce72);}(_0x0387,0x161));var _0x7038=function(_0x263cf7,_0xfda441){_0x263cf7=_0x263cf7-0x0;var _0x24ca20=_0x0387[_0x263cf7];return _0x24ca20;};'use strict';var _=require(_0x7038('0x0'));var util=require(_0x7038('0x1'));var moment=require('moment');var BPromise=require(_0x7038('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7038('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7038('0x4'));var logger=require(_0x7038('0x5'))(_0x7038('0x6'));var config=require('../../config/environment');var jayson=require(_0x7038('0x7'));var client=jayson['client'][_0x7038('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26ea2c,_0x335223,_0x251f98){return new BPromise(function(_0x12c43c,_0x467bc7){return client[_0x7038('0x9')](_0x26ea2c,_0x251f98)[_0x7038('0xa')](function(_0x294da3){logger[_0x7038('0xb')](_0x7038('0xc'),_0x335223,_0x7038('0xd'));logger['debug'](_0x7038('0xe'),_0x335223,_0x7038('0xd'),JSON['stringify'](_0x294da3));if(_0x294da3['error']){if(_0x294da3[_0x7038('0xf')]['code']===0x1f4){logger['error'](_0x7038('0xc'),_0x335223,_0x294da3[_0x7038('0xf')]['message']);return _0x467bc7(_0x294da3[_0x7038('0xf')][_0x7038('0x10')]);}logger[_0x7038('0xf')](_0x7038('0xc'),_0x335223,_0x294da3['error']['message']);return _0x12c43c(_0x294da3[_0x7038('0xf')][_0x7038('0x10')]);}else{logger[_0x7038('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x335223,_0x7038('0xd'));_0x12c43c(_0x294da3['result']['message']);}})[_0x7038('0x11')](function(_0x7c8ecf){logger[_0x7038('0xf')](_0x7038('0xc'),_0x335223,_0x7c8ecf);_0x467bc7(_0x7c8ecf);});});} \ No newline at end of file +var _0xd851=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x514b13,_0x453510){var _0x51b897=function(_0x168f29){while(--_0x168f29){_0x514b13['push'](_0x514b13['shift']());}};_0x51b897(++_0x453510);}(_0xd851,0x1c6));var _0x1d85=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0xd851[_0x9fb081];return _0x43f8b0;};'use strict';var _=require('lodash');var util=require(_0x1d85('0x0'));var moment=require(_0x1d85('0x1'));var BPromise=require(_0x1d85('0x2'));var rs=require(_0x1d85('0x3'));var fs=require('fs');var Redis=require(_0x1d85('0x4'));var db=require(_0x1d85('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1d85('0x6'));var jayson=require(_0x1d85('0x7'));var client=jayson[_0x1d85('0x8')][_0x1d85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32404d,_0x24b045,_0x31ab0f){return new BPromise(function(_0xa038bc,_0x2c069f){return client['request'](_0x32404d,_0x31ab0f)[_0x1d85('0xa')](function(_0x50f906){logger[_0x1d85('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24b045,_0x1d85('0xc'));logger[_0x1d85('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x24b045,'request\x20sent',JSON['stringify'](_0x50f906));if(_0x50f906[_0x1d85('0xe')]){if(_0x50f906[_0x1d85('0xe')][_0x1d85('0xf')]===0x1f4){logger['error'](_0x1d85('0x10'),_0x24b045,_0x50f906['error'][_0x1d85('0x11')]);return _0x2c069f(_0x50f906['error'][_0x1d85('0x11')]);}logger[_0x1d85('0xe')](_0x1d85('0x10'),_0x24b045,_0x50f906[_0x1d85('0xe')][_0x1d85('0x11')]);return _0xa038bc(_0x50f906[_0x1d85('0xe')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x24b045,_0x1d85('0xc'));_0xa038bc(_0x50f906['result'][_0x1d85('0x11')]);}})[_0x1d85('0x12')](function(_0x39badb){logger[_0x1d85('0xe')](_0x1d85('0x10'),_0x24b045,_0x39badb);_0x2c069f(_0x39badb);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 50c6076..2d11069 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x5d1953,_0x4a1cb6){var _0x531559=function(_0x1f993a){while(--_0x1f993a){_0x5d1953['push'](_0x5d1953['shift']());}};_0x531559(++_0x4a1cb6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xedd9,0xfc));var _0x9edd=function(_0x5285de,_0x554a15){_0x5285de=_0x5285de-0x0;var _0x55691e=_0xedd9[_0x5285de];return _0x55691e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1a6d624..87883c1 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.attributes.js +++ b/server/api/intFreshdeskField/intFreshdeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71c8=['BOOLEAN','sequelize','exports','ENUM','customVariable','string','STRING','variable'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x71c8,0x149));var _0x871c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x71c8[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x871c('0x0'));module[_0x871c('0x1')]={'type':{'type':Sequelize[_0x871c('0x2')]('string','variable',_0x871c('0x3'),'keyValue'),'defaultValue':_0x871c('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x871c('0x5')]},'keyType':{'type':Sequelize[_0x871c('0x2')](_0x871c('0x4'),_0x871c('0x6'),_0x871c('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x871c('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x871c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x871c('0x5')]}}; \ No newline at end of file +var _0x5bb7=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x2fe785,_0x4cf563){var _0x2ef0f6=function(_0x5b1549){while(--_0x5b1549){_0x2fe785['push'](_0x2fe785['shift']());}};_0x2ef0f6(++_0x4cf563);}(_0x5bb7,0x1ee));var _0x75bb=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x5bb7[_0x68ee8b];return _0x5148f7;};'use strict';var Sequelize=require(_0x75bb('0x0'));module[_0x75bb('0x1')]={'type':{'type':Sequelize[_0x75bb('0x2')](_0x75bb('0x3'),_0x75bb('0x4'),_0x75bb('0x5'),_0x75bb('0x6')),'defaultValue':_0x75bb('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x75bb('0x7')]},'keyType':{'type':Sequelize[_0x75bb('0x2')](_0x75bb('0x3'),_0x75bb('0x4'),_0x75bb('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x75bb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e637af2..606375d 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.controller.js +++ b/server/api/intFreshdeskField/intFreshdeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9cf=['destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','FreshdeskField','includeAll','include','rows','catch','keys','fields','options','find','create','body','params'];(function(_0x550e46,_0x5481a5){var _0x1cd58f=function(_0x21f42d){while(--_0x21f42d){_0x550e46['push'](_0x550e46['shift']());}};_0x1cd58f(++_0x5481a5);}(_0xb9cf,0x93));var _0xfb9c=function(_0x88daf1,_0x4fcbb9){_0x88daf1=_0x88daf1-0x0;var _0x2f49ab=_0xb9cf[_0x88daf1];return _0x2f49ab;};'use strict';var pdf=require(_0xfb9c('0x0'));var emlformat=require(_0xfb9c('0x1'));var rimraf=require(_0xfb9c('0x2'));var zipdir=require(_0xfb9c('0x3'));var jsonpatch=require(_0xfb9c('0x4'));var rp=require('request-promise');var moment=require(_0xfb9c('0x5'));var BPromise=require(_0xfb9c('0x6'));var Mustache=require(_0xfb9c('0x7'));var util=require(_0xfb9c('0x8'));var path=require(_0xfb9c('0x9'));var sox=require(_0xfb9c('0xa'));var csv=require(_0xfb9c('0xb'));var ejs=require(_0xfb9c('0xc'));var fs=require('fs');var _=require(_0xfb9c('0xd'));var squel=require(_0xfb9c('0xe'));var crypto=require(_0xfb9c('0xf'));var jsforce=require(_0xfb9c('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfb9c('0x11'));var Redis=require(_0xfb9c('0x12'));var authService=require(_0xfb9c('0x13'));var qs=require(_0xfb9c('0x14'));var as=require(_0xfb9c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb9c('0x16'))(_0xfb9c('0x17'));var utils=require(_0xfb9c('0x18'));var config=require(_0xfb9c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557421,_0x5931c3){_0x5931c3=_0x5931c3||0xcc;return function(_0x198a8f){if(_0x198a8f){return _0x557421[_0xfb9c('0x1a')](_0x5931c3);}return _0x557421[_0xfb9c('0x1b')](_0x5931c3)[_0xfb9c('0x1c')]();};}function respondWithResult(_0x388117,_0x5a25ee){_0x5a25ee=_0x5a25ee||0xc8;return function(_0x3fd190){if(_0x3fd190){return _0x388117[_0xfb9c('0x1b')](_0x5a25ee)[_0xfb9c('0x1d')](_0x3fd190);}};}function respondWithFilteredResult(_0x54b2ab,_0x555d90){return function(_0x1cf169){if(_0x1cf169){var _0x544c58=_0x1cf169[_0xfb9c('0x1e')],_0x473c3d=_0x555d90[_0xfb9c('0x1f')],_0x4b562e=_0x555d90[_0xfb9c('0x1f')]+_0x555d90[_0xfb9c('0x20')],_0x2abc99;if(_0x4b562e>=_0x544c58){_0x4b562e=_0x544c58;_0x2abc99=0xc8;}else{_0x2abc99=0xce;}_0x54b2ab[_0xfb9c('0x1b')](_0x2abc99);return _0x54b2ab[_0xfb9c('0x21')](_0xfb9c('0x22'),_0x473c3d+'-'+_0x4b562e+'/'+_0x544c58)['json'](_0x1cf169);}return null;};}function patchUpdates(_0x327c74){return function(_0xfad674){try{jsonpatch['apply'](_0xfad674,_0x327c74,!![]);}catch(_0x2d15ef){return BPromise['reject'](_0x2d15ef);}return _0xfad674['save']();};}function saveUpdates(_0x40457d,_0x2e32f2){return function(_0xb45e4){if(_0xb45e4){return _0xb45e4[_0xfb9c('0x23')](_0x40457d)[_0xfb9c('0x24')](function(_0x1a5090){return _0x1a5090;});}return null;};}function removeEntity(_0x2c21f8,_0x59bc9b){return function(_0x40ba37){if(_0x40ba37){return _0x40ba37['destroy']()[_0xfb9c('0x24')](function(){_0x2c21f8[_0xfb9c('0x1b')](0xcc)[_0xfb9c('0x1c')]();});}};}function handleEntityNotFound(_0x2266e5,_0xfaeb34){return function(_0x375fea){if(!_0x375fea){_0x2266e5[_0xfb9c('0x1a')](0x194);}return _0x375fea;};}function handleError(_0x1f9b24,_0x3be4b0){_0x3be4b0=_0x3be4b0||0x1f4;return function(_0x7ceaa5){logger[_0xfb9c('0x25')](_0x7ceaa5['stack']);if(_0x7ceaa5['name']){delete _0x7ceaa5[_0xfb9c('0x26')];}_0x1f9b24['status'](_0x3be4b0)[_0xfb9c('0x27')](_0x7ceaa5);};}exports[_0xfb9c('0x28')]=function(_0x224990,_0x4badc7){var _0x5ea1f0={},_0x517fc6={},_0x5abac9={'count':0x0,'rows':[]};var _0x16ff3a=_[_0xfb9c('0x29')](db['FreshdeskField'][_0xfb9c('0x2a')],function(_0x3b7188){return{'name':_0x3b7188[_0xfb9c('0x2b')],'type':_0x3b7188[_0xfb9c('0x2c')][_0xfb9c('0x2d')]};});_0x517fc6[_0xfb9c('0x2e')]=_[_0xfb9c('0x29')](_0x16ff3a,_0xfb9c('0x26'));_0x517fc6[_0xfb9c('0x2f')]=_['keys'](_0x224990[_0xfb9c('0x2f')]);_0x517fc6['filters']=_[_0xfb9c('0x30')](_0x517fc6[_0xfb9c('0x2e')],_0x517fc6[_0xfb9c('0x2f')]);_0x5ea1f0[_0xfb9c('0x31')]=_[_0xfb9c('0x30')](_0x517fc6['model'],qs['fields'](_0x224990[_0xfb9c('0x2f')]['fields']));_0x5ea1f0[_0xfb9c('0x31')]=_0x5ea1f0[_0xfb9c('0x31')][_0xfb9c('0x32')]?_0x5ea1f0['attributes']:_0x517fc6[_0xfb9c('0x2e')];if(!_0x224990[_0xfb9c('0x2f')][_0xfb9c('0x33')](_0xfb9c('0x34'))){_0x5ea1f0[_0xfb9c('0x20')]=qs[_0xfb9c('0x20')](_0x224990[_0xfb9c('0x2f')]['limit']);_0x5ea1f0[_0xfb9c('0x1f')]=qs[_0xfb9c('0x1f')](_0x224990[_0xfb9c('0x2f')]['offset']);}_0x5ea1f0['order']=qs['sort'](_0x224990[_0xfb9c('0x2f')][_0xfb9c('0x35')]);_0x5ea1f0[_0xfb9c('0x36')]=qs[_0xfb9c('0x37')](_[_0xfb9c('0x38')](_0x224990[_0xfb9c('0x2f')],_0x517fc6[_0xfb9c('0x37')]),_0x16ff3a);if(_0x224990['query']['filter']){_0x5ea1f0[_0xfb9c('0x36')]=_['merge'](_0x5ea1f0[_0xfb9c('0x36')],{'$or':_[_0xfb9c('0x29')](_0x16ff3a,function(_0x45f8ad){if(_0x45f8ad[_0xfb9c('0x2c')]!==_0xfb9c('0x39')){var _0x14279c={};_0x14279c[_0x45f8ad[_0xfb9c('0x26')]]={'$like':'%'+_0x224990['query'][_0xfb9c('0x3a')]+'%'};return _0x14279c;}})});}_0x5ea1f0=_[_0xfb9c('0x3b')]({},_0x5ea1f0,_0x224990['options']);var _0x1ae28a={'where':_0x5ea1f0[_0xfb9c('0x36')]};return db[_0xfb9c('0x3c')]['count'](_0x1ae28a)[_0xfb9c('0x24')](function(_0x3308f8){_0x5abac9[_0xfb9c('0x1e')]=_0x3308f8;if(_0x224990[_0xfb9c('0x2f')][_0xfb9c('0x3d')]){_0x5ea1f0[_0xfb9c('0x3e')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x5ea1f0);})[_0xfb9c('0x24')](function(_0x24a926){_0x5abac9[_0xfb9c('0x3f')]=_0x24a926;return _0x5abac9;})[_0xfb9c('0x24')](respondWithFilteredResult(_0x4badc7,_0x5ea1f0))[_0xfb9c('0x40')](handleError(_0x4badc7,null));};exports['show']=function(_0xb1487d,_0x7ab9c5){var _0x403447={'raw':!![],'where':{'id':_0xb1487d['params']['id']}},_0xf66999={};_0xf66999[_0xfb9c('0x2e')]=_[_0xfb9c('0x41')](db[_0xfb9c('0x3c')]['rawAttributes']);_0xf66999[_0xfb9c('0x2f')]=_['keys'](_0xb1487d[_0xfb9c('0x2f')]);_0xf66999['filters']=_[_0xfb9c('0x30')](_0xf66999[_0xfb9c('0x2e')],_0xf66999[_0xfb9c('0x2f')]);_0x403447[_0xfb9c('0x31')]=_[_0xfb9c('0x30')](_0xf66999[_0xfb9c('0x2e')],qs[_0xfb9c('0x42')](_0xb1487d[_0xfb9c('0x2f')][_0xfb9c('0x42')]));_0x403447[_0xfb9c('0x31')]=_0x403447['attributes'][_0xfb9c('0x32')]?_0x403447[_0xfb9c('0x31')]:_0xf66999[_0xfb9c('0x2e')];if(_0xb1487d['query'][_0xfb9c('0x3d')]){_0x403447[_0xfb9c('0x3e')]=[{'all':!![]}];}_0x403447=_[_0xfb9c('0x3b')]({},_0x403447,_0xb1487d[_0xfb9c('0x43')]);return db['FreshdeskField'][_0xfb9c('0x44')](_0x403447)[_0xfb9c('0x24')](handleEntityNotFound(_0x7ab9c5,null))[_0xfb9c('0x24')](respondWithResult(_0x7ab9c5,null))['catch'](handleError(_0x7ab9c5,null));};exports[_0xfb9c('0x45')]=function(_0x1ba81f,_0x24980e){return db['FreshdeskField']['create'](_0x1ba81f[_0xfb9c('0x46')],{})[_0xfb9c('0x24')](respondWithResult(_0x24980e,0xc9))[_0xfb9c('0x40')](handleError(_0x24980e,null));};exports[_0xfb9c('0x23')]=function(_0x531fb0,_0x5a8a73){if(_0x531fb0[_0xfb9c('0x46')]['id']){delete _0x531fb0[_0xfb9c('0x46')]['id'];}return db[_0xfb9c('0x3c')][_0xfb9c('0x44')]({'where':{'id':_0x531fb0[_0xfb9c('0x47')]['id']}})['then'](handleEntityNotFound(_0x5a8a73,null))[_0xfb9c('0x24')](saveUpdates(_0x531fb0[_0xfb9c('0x46')],null))[_0xfb9c('0x24')](respondWithResult(_0x5a8a73,null))[_0xfb9c('0x40')](handleError(_0x5a8a73,null));};exports[_0xfb9c('0x48')]=function(_0x4a3ced,_0x4f445e){return db[_0xfb9c('0x3c')]['find']({'where':{'id':_0x4a3ced[_0xfb9c('0x47')]['id']}})[_0xfb9c('0x24')](handleEntityNotFound(_0x4f445e,null))[_0xfb9c('0x24')](removeEntity(_0x4f445e,null))[_0xfb9c('0x40')](handleError(_0x4f445e,null));}; \ No newline at end of file +var _0x2e35=['end','error','stack','name','send','index','FreshdeskField','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','update','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2e35,0x101));var _0x52e3=function(_0x4d9f2b,_0x240213){_0x4d9f2b=_0x4d9f2b-0x0;var _0x24261f=_0x2e35[_0x4d9f2b];return _0x24261f;};'use strict';var pdf=require(_0x52e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x52e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52e3('0x2'));var rp=require(_0x52e3('0x3'));var moment=require(_0x52e3('0x4'));var BPromise=require(_0x52e3('0x5'));var Mustache=require('mustache');var util=require(_0x52e3('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x52e3('0x7'));var fs=require('fs');var _=require(_0x52e3('0x8'));var squel=require(_0x52e3('0x9'));var crypto=require(_0x52e3('0xa'));var jsforce=require(_0x52e3('0xb'));var deskjs=require(_0x52e3('0xc'));var toCsv=require(_0x52e3('0xd'));var querystring=require(_0x52e3('0xe'));var Papa=require('papaparse');var Redis=require(_0x52e3('0xf'));var authService=require(_0x52e3('0x10'));var qs=require(_0x52e3('0x11'));var as=require(_0x52e3('0x12'));var hardwareService=require(_0x52e3('0x13'));var logger=require(_0x52e3('0x14'))(_0x52e3('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x52e3('0x16'))['db'];function respondWithStatusCode(_0x16f46e,_0x353753){_0x353753=_0x353753||0xcc;return function(_0x5d1d5b){if(_0x5d1d5b){return _0x16f46e[_0x52e3('0x17')](_0x353753);}return _0x16f46e[_0x52e3('0x18')](_0x353753)['end']();};}function respondWithResult(_0x411cbd,_0x18f267){_0x18f267=_0x18f267||0xc8;return function(_0x50f418){if(_0x50f418){return _0x411cbd[_0x52e3('0x18')](_0x18f267)[_0x52e3('0x19')](_0x50f418);}};}function respondWithFilteredResult(_0x1629d7,_0x2db102){return function(_0x17f4a1){if(_0x17f4a1){var _0x3cf4f0=_0x17f4a1[_0x52e3('0x1a')],_0x13b320=_0x2db102['offset'],_0x3f753e=_0x2db102[_0x52e3('0x1b')]+_0x2db102[_0x52e3('0x1c')],_0x453b02;if(_0x3f753e>=_0x3cf4f0){_0x3f753e=_0x3cf4f0;_0x453b02=0xc8;}else{_0x453b02=0xce;}_0x1629d7[_0x52e3('0x18')](_0x453b02);return _0x1629d7[_0x52e3('0x1d')](_0x52e3('0x1e'),_0x13b320+'-'+_0x3f753e+'/'+_0x3cf4f0)[_0x52e3('0x19')](_0x17f4a1);}return null;};}function patchUpdates(_0x33eba3){return function(_0x3001dd){try{jsonpatch[_0x52e3('0x1f')](_0x3001dd,_0x33eba3,!![]);}catch(_0x1d15b3){return BPromise[_0x52e3('0x20')](_0x1d15b3);}return _0x3001dd['save']();};}function saveUpdates(_0x36ba74,_0x3b4aec){return function(_0x592941){if(_0x592941){return _0x592941['update'](_0x36ba74)[_0x52e3('0x21')](function(_0x3c0757){return _0x3c0757;});}return null;};}function removeEntity(_0x2fbaf7,_0x323d46){return function(_0x246343){if(_0x246343){return _0x246343[_0x52e3('0x22')]()[_0x52e3('0x21')](function(){_0x2fbaf7[_0x52e3('0x18')](0xcc)[_0x52e3('0x23')]();});}};}function handleEntityNotFound(_0x2ecbfe,_0x37ac72){return function(_0x3f5021){if(!_0x3f5021){_0x2ecbfe[_0x52e3('0x17')](0x194);}return _0x3f5021;};}function handleError(_0x3cd251,_0x101b54){_0x101b54=_0x101b54||0x1f4;return function(_0x51c5c3){logger[_0x52e3('0x24')](_0x51c5c3[_0x52e3('0x25')]);if(_0x51c5c3['name']){delete _0x51c5c3[_0x52e3('0x26')];}_0x3cd251[_0x52e3('0x18')](_0x101b54)[_0x52e3('0x27')](_0x51c5c3);};}exports[_0x52e3('0x28')]=function(_0x1fdc89,_0x2e07ef){var _0x2618ed={},_0x4b2b8a={},_0x3ca54f={'count':0x0,'rows':[]};var _0x31275a=_['map'](db[_0x52e3('0x29')]['rawAttributes'],function(_0x299c52){return{'name':_0x299c52[_0x52e3('0x2a')],'type':_0x299c52[_0x52e3('0x2b')]['key']};});_0x4b2b8a[_0x52e3('0x2c')]=_[_0x52e3('0x2d')](_0x31275a,_0x52e3('0x26'));_0x4b2b8a[_0x52e3('0x2e')]=_[_0x52e3('0x2f')](_0x1fdc89[_0x52e3('0x2e')]);_0x4b2b8a['filters']=_[_0x52e3('0x30')](_0x4b2b8a['model'],_0x4b2b8a[_0x52e3('0x2e')]);_0x2618ed[_0x52e3('0x31')]=_[_0x52e3('0x30')](_0x4b2b8a['model'],qs[_0x52e3('0x32')](_0x1fdc89['query'][_0x52e3('0x32')]));_0x2618ed[_0x52e3('0x31')]=_0x2618ed[_0x52e3('0x31')][_0x52e3('0x33')]?_0x2618ed[_0x52e3('0x31')]:_0x4b2b8a[_0x52e3('0x2c')];if(!_0x1fdc89['query'][_0x52e3('0x34')](_0x52e3('0x35'))){_0x2618ed[_0x52e3('0x1c')]=qs['limit'](_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x1c')]);_0x2618ed[_0x52e3('0x1b')]=qs['offset'](_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x1b')]);}_0x2618ed[_0x52e3('0x36')]=qs['sort'](_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x37')]);_0x2618ed[_0x52e3('0x38')]=qs[_0x52e3('0x39')](_['pick'](_0x1fdc89[_0x52e3('0x2e')],_0x4b2b8a['filters']),_0x31275a);if(_0x1fdc89[_0x52e3('0x2e')]['filter']){_0x2618ed['where']=_['merge'](_0x2618ed[_0x52e3('0x38')],{'$or':_['map'](_0x31275a,function(_0x249471){if(_0x249471[_0x52e3('0x2b')]!==_0x52e3('0x3a')){var _0x1f7a8a={};_0x1f7a8a[_0x249471[_0x52e3('0x26')]]={'$like':'%'+_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x3b')]+'%'};return _0x1f7a8a;}})});}_0x2618ed=_[_0x52e3('0x3c')]({},_0x2618ed,_0x1fdc89['options']);var _0x22de67={'where':_0x2618ed[_0x52e3('0x38')]};return db[_0x52e3('0x29')][_0x52e3('0x1a')](_0x22de67)['then'](function(_0x26b588){_0x3ca54f[_0x52e3('0x1a')]=_0x26b588;if(_0x1fdc89['query'][_0x52e3('0x3d')]){_0x2618ed['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x52e3('0x3e')](_0x2618ed);})['then'](function(_0x4de06f){_0x3ca54f[_0x52e3('0x3f')]=_0x4de06f;return _0x3ca54f;})[_0x52e3('0x21')](respondWithFilteredResult(_0x2e07ef,_0x2618ed))[_0x52e3('0x40')](handleError(_0x2e07ef,null));};exports[_0x52e3('0x41')]=function(_0x5a097c,_0x5792c7){var _0x1977a1={'raw':!![],'where':{'id':_0x5a097c['params']['id']}},_0x19b077={};_0x19b077[_0x52e3('0x2c')]=_[_0x52e3('0x2f')](db[_0x52e3('0x29')][_0x52e3('0x42')]);_0x19b077['query']=_[_0x52e3('0x2f')](_0x5a097c[_0x52e3('0x2e')]);_0x19b077[_0x52e3('0x39')]=_[_0x52e3('0x30')](_0x19b077[_0x52e3('0x2c')],_0x19b077[_0x52e3('0x2e')]);_0x1977a1[_0x52e3('0x31')]=_['intersection'](_0x19b077[_0x52e3('0x2c')],qs['fields'](_0x5a097c['query'][_0x52e3('0x32')]));_0x1977a1['attributes']=_0x1977a1['attributes'][_0x52e3('0x33')]?_0x1977a1[_0x52e3('0x31')]:_0x19b077['model'];if(_0x5a097c[_0x52e3('0x2e')][_0x52e3('0x3d')]){_0x1977a1[_0x52e3('0x43')]=[{'all':!![]}];}_0x1977a1=_['merge']({},_0x1977a1,_0x5a097c['options']);return db[_0x52e3('0x29')][_0x52e3('0x44')](_0x1977a1)[_0x52e3('0x21')](handleEntityNotFound(_0x5792c7,null))[_0x52e3('0x21')](respondWithResult(_0x5792c7,null))[_0x52e3('0x40')](handleError(_0x5792c7,null));};exports[_0x52e3('0x45')]=function(_0x3e591f,_0x2c6618){return db[_0x52e3('0x29')][_0x52e3('0x45')](_0x3e591f[_0x52e3('0x46')],{})[_0x52e3('0x21')](respondWithResult(_0x2c6618,0xc9))['catch'](handleError(_0x2c6618,null));};exports[_0x52e3('0x47')]=function(_0x4af63e,_0x3cf60b){if(_0x4af63e[_0x52e3('0x46')]['id']){delete _0x4af63e[_0x52e3('0x46')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x4af63e[_0x52e3('0x48')]['id']}})[_0x52e3('0x21')](handleEntityNotFound(_0x3cf60b,null))[_0x52e3('0x21')](saveUpdates(_0x4af63e[_0x52e3('0x46')],null))[_0x52e3('0x21')](respondWithResult(_0x3cf60b,null))['catch'](handleError(_0x3cf60b,null));};exports[_0x52e3('0x22')]=function(_0x4f8349,_0x4f0953){return db[_0x52e3('0x29')][_0x52e3('0x44')]({'where':{'id':_0x4f8349[_0x52e3('0x48')]['id']}})[_0x52e3('0x21')](handleEntityNotFound(_0x4f0953,null))[_0x52e3('0x21')](removeEntity(_0x4f0953,null))[_0x52e3('0x40')](handleError(_0x4f0953,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f80ef76..b575e9f 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.model.js +++ b/server/api/intFreshdeskField/intFreshdeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03f8=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','FieldId','lodash'];(function(_0x157e07,_0x41633a){var _0x4d50f5=function(_0xde7967){while(--_0xde7967){_0x157e07['push'](_0x157e07['shift']());}};_0x4d50f5(++_0x41633a);}(_0x03f8,0x1b9));var _0x803f=function(_0x42b072,_0xbb8f2e){_0x42b072=_0x42b072-0x0;var _0x2d0954=_0x03f8[_0x42b072];return _0x2d0954;};'use strict';var _=require(_0x803f('0x0'));var util=require(_0x803f('0x1'));var logger=require(_0x803f('0x2'))('api');var moment=require(_0x803f('0x3'));var BPromise=require('bluebird');var rp=require(_0x803f('0x4'));var fs=require('fs');var path=require(_0x803f('0x5'));var rimraf=require(_0x803f('0x6'));var config=require(_0x803f('0x7'));var attributes=require(_0x803f('0x8'));module[_0x803f('0x9')]=function(_0x5576c7,_0x2d281d){return _0x5576c7[_0x803f('0xa')]('FreshdeskField',attributes,{'tableName':_0x803f('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x803f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9006=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash'];(function(_0x516a5f,_0x1366b1){var _0x2cf601=function(_0x593866){while(--_0x593866){_0x516a5f['push'](_0x516a5f['shift']());}};_0x2cf601(++_0x1366b1);}(_0x9006,0xa7));var _0x6900=function(_0x1c664c,_0x1e303a){_0x1c664c=_0x1c664c-0x0;var _0x3dc08c=_0x9006[_0x1c664c];return _0x3dc08c;};'use strict';var _=require(_0x6900('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6900('0x1'));var moment=require(_0x6900('0x2'));var BPromise=require(_0x6900('0x3'));var rp=require(_0x6900('0x4'));var fs=require('fs');var path=require(_0x6900('0x5'));var rimraf=require(_0x6900('0x6'));var config=require(_0x6900('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x6900('0x8')]=function(_0xfb9f76,_0x6b9b20){return _0xfb9f76[_0x6900('0x9')](_0x6900('0xa'),attributes,{'tableName':_0x6900('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x6900('0xc'),_0x6900('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 00dff36..0e2d277 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x22b95a,_0x124122){var _0x377acc=function(_0x147b54){while(--_0x147b54){_0x22b95a['push'](_0x22b95a['shift']());}};_0x377acc(++_0x124122);}(_0xb10b,0x12a));var _0xbb10=function(_0x53f715,_0x52587b){_0x53f715=_0x53f715-0x0;var _0x16c757=_0xb10b[_0x53f715];return _0x16c757;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x1db9fd,_0x31b4e7){_0x1db9fd=_0x1db9fd-0x0;var _0x4f4023=_0x7a54[_0x1db9fd];return _0x4f4023;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index fd95206..44d9d48 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7be7=['addConfiguration','put','update','delete','destroy','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0x7be7,0xb9));var _0x77be=function(_0x5753f7,_0x4a27bb){_0x5753f7=_0x5753f7-0x0;var _0x5201ef=_0x7be7[_0x5753f7];return _0x5201ef;};'use strict';var multer=require(_0x77be('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x77be('0x1'));var express=require('express');var router=express[_0x77be('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x77be('0x3'));var config=require(_0x77be('0x4'));var controller=require(_0x77be('0x5'));router[_0x77be('0x6')]('/',auth[_0x77be('0x7')](),controller['index']);router['get'](_0x77be('0x8'),auth[_0x77be('0x7')](),controller[_0x77be('0x9')]);router[_0x77be('0x6')]('/:id/configurations',auth[_0x77be('0x7')](),controller[_0x77be('0xa')]);router['get'](_0x77be('0xb'),auth[_0x77be('0x7')](),controller['getFields']);router[_0x77be('0xc')]('/',auth['isAuthenticated'](),controller[_0x77be('0xd')]);router[_0x77be('0xc')](_0x77be('0xe'),auth[_0x77be('0x7')](),controller[_0x77be('0xf')]);router[_0x77be('0x10')](_0x77be('0x8'),auth['isAuthenticated'](),controller[_0x77be('0x11')]);router[_0x77be('0x12')](_0x77be('0x8'),auth['isAuthenticated'](),controller[_0x77be('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd92d=['post','create','addConfiguration','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields'];(function(_0x19194a,_0x52e468){var _0x156499=function(_0x2f4c27){while(--_0x2f4c27){_0x19194a['push'](_0x19194a['shift']());}};_0x156499(++_0x52e468);}(_0xd92d,0x1e6));var _0xdd92=function(_0x5eca9f,_0x1d15d3){_0x5eca9f=_0x5eca9f-0x0;var _0x53a05c=_0xd92d[_0x5eca9f];return _0x53a05c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd92('0x0'));var timeout=require('connect-timeout');var express=require(_0xdd92('0x1'));var router=express[_0xdd92('0x2')]();var auth=require(_0xdd92('0x3'));var interaction=require(_0xdd92('0x4'));var config=require(_0xdd92('0x5'));var controller=require(_0xdd92('0x6'));router[_0xdd92('0x7')]('/',auth[_0xdd92('0x8')](),controller[_0xdd92('0x9')]);router['get'](_0xdd92('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xdd92('0x7')](_0xdd92('0xb'),auth[_0xdd92('0x8')](),controller[_0xdd92('0xc')]);router[_0xdd92('0x7')]('/:id/fields',auth[_0xdd92('0x8')](),controller[_0xdd92('0xd')]);router[_0xdd92('0xe')]('/',auth[_0xdd92('0x8')](),controller[_0xdd92('0xf')]);router[_0xdd92('0xe')]('/:id/configurations',auth[_0xdd92('0x8')](),controller[_0xdd92('0x10')]);router['put']('/:id',auth[_0xdd92('0x8')](),controller['update']);router[_0xdd92('0x11')](_0xdd92('0xa'),auth[_0xdd92('0x8')](),controller[_0xdd92('0x12')]);module[_0xdd92('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 433508d..dce631f 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ef5=['STRING','username','remoteUri','sequelize','exports'];(function(_0x5318a2,_0x353e17){var _0x93f881=function(_0x3e5302){while(--_0x3e5302){_0x5318a2['push'](_0x5318a2['shift']());}};_0x93f881(++_0x353e17);}(_0x0ef5,0x116));var _0x50ef=function(_0x4c7644,_0x5f321a){_0x4c7644=_0x4c7644-0x0;var _0x3ffdc5=_0x0ef5[_0x4c7644];return _0x3ffdc5;};'use strict';var Sequelize=require(_0x50ef('0x0'));module[_0x50ef('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x50ef('0x2')]},'username':{'type':Sequelize[_0x50ef('0x2')],'unique':_0x50ef('0x3')},'apiKey':{'type':Sequelize[_0x50ef('0x2')]},'remoteUri':{'type':Sequelize[_0x50ef('0x2')],'unique':_0x50ef('0x4')},'serverUrl':{'type':Sequelize[_0x50ef('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x77d1=['STRING','username','remoteUri','exports'];(function(_0x21be5f,_0x29b732){var _0x3d0828=function(_0x1541e5){while(--_0x1541e5){_0x21be5f['push'](_0x21be5f['shift']());}};_0x3d0828(++_0x29b732);}(_0x77d1,0x11b));var _0x177d=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x77d1[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require('sequelize');module[_0x177d('0x0')]={'name':{'type':Sequelize[_0x177d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x177d('0x1')],'unique':_0x177d('0x2')},'apiKey':{'type':Sequelize[_0x177d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x177d('0x3')},'serverUrl':{'type':Sequelize[_0x177d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 23c5d6f..62d8d89 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0565=['getConfigurations','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','findOne','username','remoteUri','apiKey','slice','substring','lastIndexOf','/api/selector/owners','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','client','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','count','offset','Content-Range','apply','save','update','destroy','end','stack','name','send','index','FreshsalesAccount','fieldName','type','key','map','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','params','rawAttributes','includeAll','find','catch','create','body'];(function(_0x26734d,_0xe1c4af){var _0x212072=function(_0x44530b){while(--_0x44530b){_0x26734d['push'](_0x26734d['shift']());}};_0x212072(++_0xe1c4af);}(_0x0565,0xf2));var _0x5056=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x0565[_0x819464];return _0x49dcc0;};'use strict';var pdf=require(_0x5056('0x0'));var emlformat=require(_0x5056('0x1'));var rimraf=require(_0x5056('0x2'));var zipdir=require(_0x5056('0x3'));var jsonpatch=require(_0x5056('0x4'));var rp=require(_0x5056('0x5'));var moment=require(_0x5056('0x6'));var BPromise=require(_0x5056('0x7'));var Mustache=require(_0x5056('0x8'));var util=require(_0x5056('0x9'));var path=require('path');var sox=require(_0x5056('0xa'));var csv=require(_0x5056('0xb'));var ejs=require(_0x5056('0xc'));var fs=require('fs');var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xb'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x5056('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e523b,_0x26edc1,_0x7af76b,_0x543cee){return new BPromise(function(_0x1e8b64,_0x29d05f){var _0x15f52d=_0x543cee||client;return _0x15f52d[_0x5056('0x1a')](_0x3e523b,_0x7af76b)[_0x5056('0x1b')](function(_0x6a044a){logger['info'](_0x5056('0x1c'),_0x26edc1,'request\x20sent');logger[_0x5056('0x1d')](_0x5056('0x1e'),_0x26edc1,_0x5056('0x1f'),JSON[_0x5056('0x20')](_0x6a044a));if(_0x6a044a[_0x5056('0x21')]){if(_0x6a044a['error'][_0x5056('0x22')]===0x1f4){logger[_0x5056('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x26edc1,_0x6a044a['error'][_0x5056('0x23')]);return _0x29d05f(_0x6a044a[_0x5056('0x21')][_0x5056('0x23')]);}logger[_0x5056('0x21')](_0x5056('0x1c'),_0x26edc1,_0x6a044a[_0x5056('0x21')][_0x5056('0x23')]);return _0x1e8b64(_0x6a044a['error'][_0x5056('0x23')]);}else{logger[_0x5056('0x24')]('FreshsalesAccount,\x20%s,\x20%s',_0x26edc1,_0x5056('0x1f'));_0x1e8b64(_0x6a044a[_0x5056('0x25')][_0x5056('0x23')]);}})['catch'](function(_0x39e03a){logger[_0x5056('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x26edc1,_0x39e03a);_0x29d05f(_0x39e03a);});});}function respondWithStatusCode(_0x4a64be,_0x29e166){_0x29e166=_0x29e166||0xcc;return function(_0x2f36a3){if(_0x2f36a3){return _0x4a64be[_0x5056('0x26')](_0x29e166);}return _0x4a64be[_0x5056('0x27')](_0x29e166)['end']();};}function respondWithResult(_0x267048,_0x25409f){_0x25409f=_0x25409f||0xc8;return function(_0x5d1656){if(_0x5d1656){return _0x267048[_0x5056('0x27')](_0x25409f)['json'](_0x5d1656);}};}function respondWithFilteredResult(_0x15f03f,_0x39d539){return function(_0x1106e5){if(_0x1106e5){var _0x2b8fab=_0x1106e5[_0x5056('0x28')],_0x45f600=_0x39d539[_0x5056('0x29')],_0x50f2a8=_0x39d539[_0x5056('0x29')]+_0x39d539['limit'],_0x18b7cf;if(_0x50f2a8>=_0x2b8fab){_0x50f2a8=_0x2b8fab;_0x18b7cf=0xc8;}else{_0x18b7cf=0xce;}_0x15f03f[_0x5056('0x27')](_0x18b7cf);return _0x15f03f['set'](_0x5056('0x2a'),_0x45f600+'-'+_0x50f2a8+'/'+_0x2b8fab)['json'](_0x1106e5);}return null;};}function patchUpdates(_0x56ccba){return function(_0x4bbf33){try{jsonpatch[_0x5056('0x2b')](_0x4bbf33,_0x56ccba,!![]);}catch(_0x252f75){return BPromise['reject'](_0x252f75);}return _0x4bbf33[_0x5056('0x2c')]();};}function saveUpdates(_0x2c5728,_0x9e2986){return function(_0x168fe6){if(_0x168fe6){return _0x168fe6[_0x5056('0x2d')](_0x2c5728)[_0x5056('0x1b')](function(_0x173fac){return _0x173fac;});}return null;};}function removeEntity(_0x3f292e,_0xd1aa24){return function(_0x2f66d3){if(_0x2f66d3){return _0x2f66d3[_0x5056('0x2e')]()['then'](function(){_0x3f292e['status'](0xcc)[_0x5056('0x2f')]();});}};}function handleEntityNotFound(_0x2d57d4,_0x5c2913){return function(_0x11146f){if(!_0x11146f){_0x2d57d4[_0x5056('0x26')](0x194);}return _0x11146f;};}function handleError(_0x54cf9c,_0x31cacb){_0x31cacb=_0x31cacb||0x1f4;return function(_0x378b33){logger[_0x5056('0x21')](_0x378b33[_0x5056('0x30')]);if(_0x378b33[_0x5056('0x31')]){delete _0x378b33[_0x5056('0x31')];}_0x54cf9c[_0x5056('0x27')](_0x31cacb)[_0x5056('0x32')](_0x378b33);};}exports[_0x5056('0x33')]=function(_0x2fee6e,_0x199129){var _0x3e025f={},_0x442867={},_0x3d7d78={'count':0x0,'rows':[]};var _0xb4d135=_['map'](db[_0x5056('0x34')]['rawAttributes'],function(_0xc49a60){return{'name':_0xc49a60[_0x5056('0x35')],'type':_0xc49a60[_0x5056('0x36')][_0x5056('0x37')]};});_0x442867['model']=_[_0x5056('0x38')](_0xb4d135,_0x5056('0x31'));_0x442867['query']=_[_0x5056('0x39')](_0x2fee6e['query']);_0x442867[_0x5056('0x3a')]=_[_0x5056('0x3b')](_0x442867[_0x5056('0x3c')],_0x442867['query']);_0x3e025f[_0x5056('0x3d')]=_[_0x5056('0x3b')](_0x442867[_0x5056('0x3c')],qs[_0x5056('0x3e')](_0x2fee6e[_0x5056('0x3f')][_0x5056('0x3e')]));_0x3e025f[_0x5056('0x3d')]=_0x3e025f[_0x5056('0x3d')][_0x5056('0x40')]?_0x3e025f[_0x5056('0x3d')]:_0x442867[_0x5056('0x3c')];if(!_0x2fee6e[_0x5056('0x3f')][_0x5056('0x41')](_0x5056('0x42'))){_0x3e025f[_0x5056('0x43')]=qs[_0x5056('0x43')](_0x2fee6e['query']['limit']);_0x3e025f[_0x5056('0x29')]=qs[_0x5056('0x29')](_0x2fee6e[_0x5056('0x3f')][_0x5056('0x29')]);}_0x3e025f[_0x5056('0x44')]=qs[_0x5056('0x45')](_0x2fee6e[_0x5056('0x3f')][_0x5056('0x45')]);_0x3e025f['where']=qs['filters'](_[_0x5056('0x46')](_0x2fee6e[_0x5056('0x3f')],_0x442867[_0x5056('0x3a')]),_0xb4d135);if(_0x2fee6e['query'][_0x5056('0x47')]){_0x3e025f['where']=_[_0x5056('0x48')](_0x3e025f[_0x5056('0x49')],{'$or':_[_0x5056('0x38')](_0xb4d135,function(_0x305a7c){if(_0x305a7c[_0x5056('0x36')]!==_0x5056('0x4a')){var _0x47ad61={};_0x47ad61[_0x305a7c[_0x5056('0x31')]]={'$like':'%'+_0x2fee6e[_0x5056('0x3f')][_0x5056('0x47')]+'%'};return _0x47ad61;}})});}_0x3e025f=_['merge']({},_0x3e025f,_0x2fee6e['options']);var _0x4e1b73={'where':_0x3e025f['where']};return db[_0x5056('0x34')][_0x5056('0x28')](_0x4e1b73)[_0x5056('0x1b')](function(_0xf34372){_0x3d7d78[_0x5056('0x28')]=_0xf34372;if(_0x2fee6e['query']['includeAll']){_0x3e025f[_0x5056('0x4b')]=[{'all':!![]}];}return db[_0x5056('0x34')][_0x5056('0x4c')](_0x3e025f);})[_0x5056('0x1b')](function(_0x4376eb){_0x3d7d78[_0x5056('0x4d')]=_0x4376eb;return _0x3d7d78;})[_0x5056('0x1b')](respondWithFilteredResult(_0x199129,_0x3e025f))['catch'](handleError(_0x199129,null));};exports['show']=function(_0x14e3f5,_0x3c2988){var _0x5a2f73={'raw':![],'where':{'id':_0x14e3f5[_0x5056('0x4e')]['id']}},_0x21ee40={};_0x21ee40['model']=_['keys'](db[_0x5056('0x34')][_0x5056('0x4f')]);_0x21ee40['query']=_['keys'](_0x14e3f5[_0x5056('0x3f')]);_0x21ee40[_0x5056('0x3a')]=_['intersection'](_0x21ee40['model'],_0x21ee40[_0x5056('0x3f')]);_0x5a2f73[_0x5056('0x3d')]=_[_0x5056('0x3b')](_0x21ee40[_0x5056('0x3c')],qs[_0x5056('0x3e')](_0x14e3f5[_0x5056('0x3f')][_0x5056('0x3e')]));_0x5a2f73[_0x5056('0x3d')]=_0x5a2f73[_0x5056('0x3d')][_0x5056('0x40')]?_0x5a2f73[_0x5056('0x3d')]:_0x21ee40[_0x5056('0x3c')];if(_0x14e3f5[_0x5056('0x3f')][_0x5056('0x50')]){_0x5a2f73[_0x5056('0x4b')]=[{'all':!![]}];}_0x5a2f73=_['merge']({},_0x5a2f73,_0x14e3f5['options']);return db[_0x5056('0x34')][_0x5056('0x51')](_0x5a2f73)[_0x5056('0x1b')](handleEntityNotFound(_0x3c2988,null))[_0x5056('0x1b')](respondWithResult(_0x3c2988,null))[_0x5056('0x52')](handleError(_0x3c2988,null));};exports[_0x5056('0x53')]=function(_0x517ba7,_0x37a592){return db[_0x5056('0x34')][_0x5056('0x53')](_0x517ba7[_0x5056('0x54')],{})[_0x5056('0x1b')](respondWithResult(_0x37a592,0xc9))[_0x5056('0x52')](handleError(_0x37a592,null));};exports[_0x5056('0x2d')]=function(_0x1b60f7,_0x3a0959){if(_0x1b60f7[_0x5056('0x54')]['id']){delete _0x1b60f7[_0x5056('0x54')]['id'];}return db[_0x5056('0x34')][_0x5056('0x51')]({'where':{'id':_0x1b60f7['params']['id']}})[_0x5056('0x1b')](handleEntityNotFound(_0x3a0959,null))[_0x5056('0x1b')](saveUpdates(_0x1b60f7[_0x5056('0x54')],null))['then'](respondWithResult(_0x3a0959,null))[_0x5056('0x52')](handleError(_0x3a0959,null));};exports[_0x5056('0x2e')]=function(_0x13e2c2,_0x3d79d3){return db['FreshsalesAccount']['find']({'where':{'id':_0x13e2c2['params']['id']}})[_0x5056('0x1b')](handleEntityNotFound(_0x3d79d3,null))['then'](removeEntity(_0x3d79d3,null))[_0x5056('0x52')](handleError(_0x3d79d3,null));};exports[_0x5056('0x55')]=function(_0x19e272,_0x352cd8,_0x20ea8b){var _0x19371d={};var _0x5330b4={};var _0x48568b;var _0x25da13;return db[_0x5056('0x34')]['findOne']({'where':{'id':_0x19e272[_0x5056('0x4e')]['id']}})[_0x5056('0x1b')](handleEntityNotFound(_0x352cd8,null))[_0x5056('0x1b')](function(_0x318ed6){if(_0x318ed6){_0x48568b=_0x318ed6;_0x5330b4[_0x5056('0x3c')]=_['keys'](db[_0x5056('0x56')][_0x5056('0x4f')]);_0x5330b4['query']=_[_0x5056('0x39')](_0x19e272[_0x5056('0x3f')]);_0x5330b4[_0x5056('0x3a')]=_[_0x5056('0x3b')](_0x5330b4[_0x5056('0x3c')],_0x5330b4[_0x5056('0x3f')]);_0x19371d[_0x5056('0x3d')]=_[_0x5056('0x3b')](_0x5330b4[_0x5056('0x3c')],qs[_0x5056('0x3e')](_0x19e272[_0x5056('0x3f')][_0x5056('0x3e')]));_0x19371d[_0x5056('0x3d')]=_0x19371d['attributes'][_0x5056('0x40')]?_0x19371d[_0x5056('0x3d')]:_0x5330b4[_0x5056('0x3c')];_0x19371d[_0x5056('0x44')]=qs[_0x5056('0x45')](_0x19e272[_0x5056('0x3f')]['sort']);_0x19371d[_0x5056('0x49')]=qs['filters'](_[_0x5056('0x46')](_0x19e272[_0x5056('0x3f')],_0x5330b4['filters']));if(_0x19e272['query'][_0x5056('0x47')]){_0x19371d[_0x5056('0x49')]=_[_0x5056('0x48')](_0x19371d[_0x5056('0x49')],{'$or':_['map'](_0x19371d['attributes'],function(_0x25fe6f){var _0x3e2b93={};_0x3e2b93[_0x25fe6f]={'$like':'%'+_0x19e272[_0x5056('0x3f')]['filter']+'%'};return _0x3e2b93;})});}_0x19371d=_[_0x5056('0x48')]({},_0x19371d,_0x19e272['options']);return _0x48568b[_0x5056('0x55')](_0x19371d);}})[_0x5056('0x1b')](function(_0x2dd7fa){if(_0x2dd7fa){_0x25da13=_0x2dd7fa['length'];if(!_0x19e272[_0x5056('0x3f')][_0x5056('0x41')](_0x5056('0x42'))){_0x19371d[_0x5056('0x43')]=qs[_0x5056('0x43')](_0x19e272[_0x5056('0x3f')][_0x5056('0x43')]);_0x19371d['offset']=qs[_0x5056('0x29')](_0x19e272[_0x5056('0x3f')][_0x5056('0x29')]);}return _0x48568b['getConfigurations'](_0x19371d);}})[_0x5056('0x1b')](function(_0x4ea1c5){if(_0x4ea1c5){return _0x4ea1c5?{'count':_0x25da13,'rows':_0x4ea1c5}:null;}})[_0x5056('0x1b')](respondWithResult(_0x352cd8,null))[_0x5056('0x52')](handleError(_0x352cd8,null));};exports[_0x5056('0x57')]=function(_0x45eac9,_0x5639a1,_0x2a856c){if(_0x45eac9[_0x5056('0x54')]['id']){delete _0x45eac9['body']['id'];}return db[_0x5056('0x34')]['findOne']({'where':{'id':_0x45eac9['params']['id']}})[_0x5056('0x1b')](handleEntityNotFound(_0x5639a1,null))[_0x5056('0x1b')](function(_0x1ca623){if(_0x1ca623){_0x45eac9[_0x5056('0x54')][_0x5056('0x58')]=_0x1ca623['id'];_0x45eac9[_0x5056('0x54')][_0x5056('0x59')]=integrations[_0x5056('0x5a')](_0x45eac9[_0x5056('0x54')][_0x5056('0x5b')],_0x45eac9[_0x5056('0x54')][_0x5056('0x36')]);_0x45eac9['body'][_0x5056('0x5c')]=integrations['getDescriptions'](_0x45eac9[_0x5056('0x54')][_0x5056('0x5b')],_0x45eac9['body'][_0x5056('0x36')]);return db[_0x5056('0x56')][_0x5056('0x53')](_0x45eac9[_0x5056('0x54')],{'include':[{'model':db[_0x5056('0x5d')],'as':_0x5056('0x59')},{'model':db[_0x5056('0x5d')],'as':_0x5056('0x5c')}]});}return null;})['then'](respondWithResult(_0x5639a1,null))[_0x5056('0x52')](handleError(_0x5639a1,null));};exports[_0x5056('0x5e')]=function(_0x32d5f1,_0x23cf3d,_0x108b1e){var _0x4e6045='';var _0x3bf1ae='';return db['FreshsalesAccount'][_0x5056('0x5f')]({'where':{'id':_0x32d5f1[_0x5056('0x4e')]['id']},'attributes':['id',_0x5056('0x60'),_0x5056('0x61'),_0x5056('0x62')]})[_0x5056('0x1b')](handleEntityNotFound(_0x23cf3d,null))[_0x5056('0x1b')](function(_0x5f41de){if(_0x5f41de){_0x3bf1ae=_0x5f41de[_0x5056('0x60')];_0x4e6045=_0x5f41de[_0x5056('0x61')];var _0x2d5b59=_0x5f41de[_0x5056('0x61')][_0x5056('0x63')](-0x1);if(_0x2d5b59==='/'){_0x4e6045=_0x4e6045[_0x5056('0x64')](0x0,_0x4e6045[_0x5056('0x65')](_0x2d5b59));}return rp({'method':'GET','uri':util['format']('%s%s',_0x4e6045,_0x5056('0x66')),'headers':{'Authorization':'Token\x20token='+_0x5f41de[_0x5056('0x62')]},'json':!![]});}})[_0x5056('0x1b')](function(_0x41d04f){if(_0x41d04f){var _0x54658f=_0x41d04f[_0x5056('0x67')];var _0x5f20c4=![];var _0x895e06=null;for(_0x895e06=0x0;_0x895e06<_0x54658f[_0x5056('0x40')];_0x895e06++){if(_0x54658f[_0x895e06][_0x5056('0x68')]===_0x3bf1ae){_0x5f20c4=!![];}}if(_0x5f20c4){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x5056('0x1b')](respondWithResult(_0x23cf3d,null))['catch'](function(_0x54b0ba){var _0x2ed978=_0x32d5f1[_0x5056('0x3f')]['test']?0x1f4:_0x54b0ba[_0x5056('0x69')]||0x1f4;logger['error'](_0x5056('0x6a'),_0x5056('0x5e'),_0x2ed978,JSON[_0x5056('0x20')](_0x54b0ba));delete _0x54b0ba[_0x5056('0x31')];if(_0x2ed978===0x191){_0x2ed978=0x190;}_0x23cf3d[_0x5056('0x27')](_0x2ed978)[_0x5056('0x32')](_0x32d5f1['query'][_0x5056('0x6b')]?{'message':_0x5056('0x6c'),'statusCode':_0x54b0ba[_0x5056('0x69')]}:_0x54b0ba);});}; \ No newline at end of file +var _0x91a7=['Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','save','update','then','destroy','sendStatus','stack','name','send','map','FreshsalesAccount','rawAttributes','type','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','keys','length','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration'];(function(_0x566f95,_0x554d39){var _0x3e1bb4=function(_0x400eab){while(--_0x400eab){_0x566f95['push'](_0x566f95['shift']());}};_0x3e1bb4(++_0x554d39);}(_0x91a7,0xe7));var _0x791a=function(_0x20a746,_0x5c788c){_0x20a746=_0x20a746-0x0;var _0x5c260f=_0x91a7[_0x20a746];return _0x5c260f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var licenseUtil=require(_0x791a('0x15'));var db=require(_0x791a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x791a('0x17')][_0x791a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4c56f0,_0x346c44,_0x3a2ec6,_0x5d5b11){return new BPromise(function(_0x2887f0,_0x31b86d){var _0x2ef5c5=_0x5d5b11||client;return _0x2ef5c5[_0x791a('0x19')](_0x4c56f0,_0x3a2ec6)['then'](function(_0x2ce2e0){logger['info'](_0x791a('0x1a'),_0x346c44,_0x791a('0x1b'));logger['debug'](_0x791a('0x1c'),_0x346c44,'request\x20sent',JSON[_0x791a('0x1d')](_0x2ce2e0));if(_0x2ce2e0['error']){if(_0x2ce2e0['error']['code']===0x1f4){logger[_0x791a('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x346c44,_0x2ce2e0['error'][_0x791a('0x1f')]);return _0x31b86d(_0x2ce2e0[_0x791a('0x1e')][_0x791a('0x1f')]);}logger[_0x791a('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x346c44,_0x2ce2e0[_0x791a('0x1e')][_0x791a('0x1f')]);return _0x2887f0(_0x2ce2e0[_0x791a('0x1e')][_0x791a('0x1f')]);}else{logger['info'](_0x791a('0x1a'),_0x346c44,_0x791a('0x1b'));_0x2887f0(_0x2ce2e0[_0x791a('0x20')][_0x791a('0x1f')]);}})[_0x791a('0x21')](function(_0x1091af){logger[_0x791a('0x1e')](_0x791a('0x1a'),_0x346c44,_0x1091af);_0x31b86d(_0x1091af);});});}function respondWithStatusCode(_0x323c6a,_0xe8e452){_0xe8e452=_0xe8e452||0xcc;return function(_0x137992){if(_0x137992){return _0x323c6a['sendStatus'](_0xe8e452);}return _0x323c6a[_0x791a('0x22')](_0xe8e452)[_0x791a('0x23')]();};}function respondWithResult(_0x380329,_0x2966b8){_0x2966b8=_0x2966b8||0xc8;return function(_0x4d748a){if(_0x4d748a){return _0x380329[_0x791a('0x22')](_0x2966b8)[_0x791a('0x24')](_0x4d748a);}};}function respondWithFilteredResult(_0x51dcca,_0xdfa84f){return function(_0x1785f5){if(_0x1785f5){var _0x16dbaf=_0x1785f5[_0x791a('0x25')],_0x4c1626=_0xdfa84f[_0x791a('0x26')],_0x29194d=_0xdfa84f[_0x791a('0x26')]+_0xdfa84f[_0x791a('0x27')],_0x2b3327;if(_0x29194d>=_0x16dbaf){_0x29194d=_0x16dbaf;_0x2b3327=0xc8;}else{_0x2b3327=0xce;}_0x51dcca[_0x791a('0x22')](_0x2b3327);return _0x51dcca[_0x791a('0x28')]('Content-Range',_0x4c1626+'-'+_0x29194d+'/'+_0x16dbaf)[_0x791a('0x24')](_0x1785f5);}return null;};}function patchUpdates(_0x9e9332){return function(_0x1b10a7){try{jsonpatch['apply'](_0x1b10a7,_0x9e9332,!![]);}catch(_0x1cdda9){return BPromise['reject'](_0x1cdda9);}return _0x1b10a7[_0x791a('0x29')]();};}function saveUpdates(_0x2e4ec8,_0xcde862){return function(_0xe72e0c){if(_0xe72e0c){return _0xe72e0c[_0x791a('0x2a')](_0x2e4ec8)[_0x791a('0x2b')](function(_0x15ff6e){return _0x15ff6e;});}return null;};}function removeEntity(_0x4f5506,_0x3662c6){return function(_0x401069){if(_0x401069){return _0x401069[_0x791a('0x2c')]()[_0x791a('0x2b')](function(){_0x4f5506[_0x791a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d650,_0x8e7002){return function(_0x423a1e){if(!_0x423a1e){_0x42d650[_0x791a('0x2d')](0x194);}return _0x423a1e;};}function handleError(_0xb6e59b,_0x4ef825){_0x4ef825=_0x4ef825||0x1f4;return function(_0x305836){logger[_0x791a('0x1e')](_0x305836[_0x791a('0x2e')]);if(_0x305836[_0x791a('0x2f')]){delete _0x305836[_0x791a('0x2f')];}_0xb6e59b['status'](_0x4ef825)[_0x791a('0x30')](_0x305836);};}exports['index']=function(_0x1cf048,_0x4cd047){var _0x5edb88={},_0x425675={},_0x404530={'count':0x0,'rows':[]};var _0x75458d=_[_0x791a('0x31')](db[_0x791a('0x32')][_0x791a('0x33')],function(_0x29762d){return{'name':_0x29762d['fieldName'],'type':_0x29762d[_0x791a('0x34')]['key']};});_0x425675[_0x791a('0x35')]=_['map'](_0x75458d,_0x791a('0x2f'));_0x425675[_0x791a('0x36')]=_['keys'](_0x1cf048[_0x791a('0x36')]);_0x425675[_0x791a('0x37')]=_['intersection'](_0x425675[_0x791a('0x35')],_0x425675[_0x791a('0x36')]);_0x5edb88[_0x791a('0x38')]=_[_0x791a('0x39')](_0x425675[_0x791a('0x35')],qs[_0x791a('0x3a')](_0x1cf048[_0x791a('0x36')][_0x791a('0x3a')]));_0x5edb88[_0x791a('0x38')]=_0x5edb88[_0x791a('0x38')]['length']?_0x5edb88[_0x791a('0x38')]:_0x425675[_0x791a('0x35')];if(!_0x1cf048[_0x791a('0x36')]['hasOwnProperty'](_0x791a('0x3b'))){_0x5edb88['limit']=qs['limit'](_0x1cf048['query'][_0x791a('0x27')]);_0x5edb88[_0x791a('0x26')]=qs['offset'](_0x1cf048[_0x791a('0x36')][_0x791a('0x26')]);}_0x5edb88[_0x791a('0x3c')]=qs[_0x791a('0x3d')](_0x1cf048['query']['sort']);_0x5edb88['where']=qs[_0x791a('0x37')](_[_0x791a('0x3e')](_0x1cf048['query'],_0x425675[_0x791a('0x37')]),_0x75458d);if(_0x1cf048[_0x791a('0x36')][_0x791a('0x3f')]){_0x5edb88[_0x791a('0x40')]=_['merge'](_0x5edb88[_0x791a('0x40')],{'$or':_['map'](_0x75458d,function(_0x3682db){if(_0x3682db[_0x791a('0x34')]!==_0x791a('0x41')){var _0xfa245e={};_0xfa245e[_0x3682db[_0x791a('0x2f')]]={'$like':'%'+_0x1cf048['query'][_0x791a('0x3f')]+'%'};return _0xfa245e;}})});}_0x5edb88=_[_0x791a('0x42')]({},_0x5edb88,_0x1cf048[_0x791a('0x43')]);var _0x1a5cac={'where':_0x5edb88[_0x791a('0x40')]};return db['FreshsalesAccount'][_0x791a('0x25')](_0x1a5cac)[_0x791a('0x2b')](function(_0x4e379e){_0x404530['count']=_0x4e379e;if(_0x1cf048[_0x791a('0x36')][_0x791a('0x44')]){_0x5edb88[_0x791a('0x45')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x5edb88);})[_0x791a('0x2b')](function(_0x378cc2){_0x404530['rows']=_0x378cc2;return _0x404530;})[_0x791a('0x2b')](respondWithFilteredResult(_0x4cd047,_0x5edb88))[_0x791a('0x21')](handleError(_0x4cd047,null));};exports[_0x791a('0x46')]=function(_0x549980,_0x5a30a6){var _0x2446fb={'raw':![],'where':{'id':_0x549980[_0x791a('0x47')]['id']}},_0x17acda={};_0x17acda[_0x791a('0x35')]=_['keys'](db[_0x791a('0x32')][_0x791a('0x33')]);_0x17acda[_0x791a('0x36')]=_[_0x791a('0x48')](_0x549980['query']);_0x17acda[_0x791a('0x37')]=_[_0x791a('0x39')](_0x17acda[_0x791a('0x35')],_0x17acda[_0x791a('0x36')]);_0x2446fb[_0x791a('0x38')]=_[_0x791a('0x39')](_0x17acda[_0x791a('0x35')],qs['fields'](_0x549980[_0x791a('0x36')][_0x791a('0x3a')]));_0x2446fb['attributes']=_0x2446fb[_0x791a('0x38')][_0x791a('0x49')]?_0x2446fb['attributes']:_0x17acda[_0x791a('0x35')];if(_0x549980[_0x791a('0x36')][_0x791a('0x44')]){_0x2446fb[_0x791a('0x45')]=[{'all':!![]}];}_0x2446fb=_[_0x791a('0x42')]({},_0x2446fb,_0x549980['options']);return db['FreshsalesAccount']['find'](_0x2446fb)[_0x791a('0x2b')](handleEntityNotFound(_0x5a30a6,null))['then'](respondWithResult(_0x5a30a6,null))['catch'](handleError(_0x5a30a6,null));};exports[_0x791a('0x4a')]=function(_0x548a4b,_0x3e0b17){return db[_0x791a('0x32')]['create'](_0x548a4b['body'],{})[_0x791a('0x2b')](respondWithResult(_0x3e0b17,0xc9))['catch'](handleError(_0x3e0b17,null));};exports[_0x791a('0x2a')]=function(_0x4294fb,_0x383031){if(_0x4294fb['body']['id']){delete _0x4294fb[_0x791a('0x4b')]['id'];}return db[_0x791a('0x32')]['find']({'where':{'id':_0x4294fb[_0x791a('0x47')]['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x383031,null))[_0x791a('0x2b')](saveUpdates(_0x4294fb[_0x791a('0x4b')],null))[_0x791a('0x2b')](respondWithResult(_0x383031,null))[_0x791a('0x21')](handleError(_0x383031,null));};exports['destroy']=function(_0x4dfe1e,_0x35ccdf){return db['FreshsalesAccount'][_0x791a('0x4c')]({'where':{'id':_0x4dfe1e[_0x791a('0x47')]['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x35ccdf,null))[_0x791a('0x2b')](removeEntity(_0x35ccdf,null))[_0x791a('0x21')](handleError(_0x35ccdf,null));};exports[_0x791a('0x4d')]=function(_0x353170,_0x5a215d,_0x1ac6e1){var _0x4691d9={};var _0xc34c5b={};var _0x1a4376;var _0x2d671f;return db[_0x791a('0x32')][_0x791a('0x4e')]({'where':{'id':_0x353170['params']['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x5a215d,null))['then'](function(_0x4c4fc5){if(_0x4c4fc5){_0x1a4376=_0x4c4fc5;_0xc34c5b[_0x791a('0x35')]=_[_0x791a('0x48')](db[_0x791a('0x4f')][_0x791a('0x33')]);_0xc34c5b[_0x791a('0x36')]=_[_0x791a('0x48')](_0x353170[_0x791a('0x36')]);_0xc34c5b[_0x791a('0x37')]=_[_0x791a('0x39')](_0xc34c5b[_0x791a('0x35')],_0xc34c5b[_0x791a('0x36')]);_0x4691d9[_0x791a('0x38')]=_[_0x791a('0x39')](_0xc34c5b[_0x791a('0x35')],qs[_0x791a('0x3a')](_0x353170[_0x791a('0x36')][_0x791a('0x3a')]));_0x4691d9[_0x791a('0x38')]=_0x4691d9[_0x791a('0x38')][_0x791a('0x49')]?_0x4691d9['attributes']:_0xc34c5b[_0x791a('0x35')];_0x4691d9[_0x791a('0x3c')]=qs[_0x791a('0x3d')](_0x353170[_0x791a('0x36')][_0x791a('0x3d')]);_0x4691d9['where']=qs[_0x791a('0x37')](_[_0x791a('0x3e')](_0x353170[_0x791a('0x36')],_0xc34c5b[_0x791a('0x37')]));if(_0x353170['query'][_0x791a('0x3f')]){_0x4691d9['where']=_['merge'](_0x4691d9['where'],{'$or':_['map'](_0x4691d9[_0x791a('0x38')],function(_0x40207b){var _0x11c11f={};_0x11c11f[_0x40207b]={'$like':'%'+_0x353170[_0x791a('0x36')][_0x791a('0x3f')]+'%'};return _0x11c11f;})});}_0x4691d9=_[_0x791a('0x42')]({},_0x4691d9,_0x353170[_0x791a('0x43')]);return _0x1a4376['getConfigurations'](_0x4691d9);}})['then'](function(_0x3b22e2){if(_0x3b22e2){_0x2d671f=_0x3b22e2[_0x791a('0x49')];if(!_0x353170['query']['hasOwnProperty'](_0x791a('0x3b'))){_0x4691d9[_0x791a('0x27')]=qs['limit'](_0x353170[_0x791a('0x36')][_0x791a('0x27')]);_0x4691d9[_0x791a('0x26')]=qs[_0x791a('0x26')](_0x353170['query']['offset']);}return _0x1a4376[_0x791a('0x4d')](_0x4691d9);}})[_0x791a('0x2b')](function(_0x566f0a){if(_0x566f0a){return _0x566f0a?{'count':_0x2d671f,'rows':_0x566f0a}:null;}})[_0x791a('0x2b')](respondWithResult(_0x5a215d,null))[_0x791a('0x21')](handleError(_0x5a215d,null));};exports[_0x791a('0x50')]=function(_0x3838c4,_0x565c83,_0x24efc2){if(_0x3838c4[_0x791a('0x4b')]['id']){delete _0x3838c4[_0x791a('0x4b')]['id'];}return db[_0x791a('0x32')][_0x791a('0x4e')]({'where':{'id':_0x3838c4[_0x791a('0x47')]['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x565c83,null))[_0x791a('0x2b')](function(_0x5567d3){if(_0x5567d3){_0x3838c4['body']['AccountId']=_0x5567d3['id'];_0x3838c4[_0x791a('0x4b')][_0x791a('0x51')]=integrations[_0x791a('0x52')](_0x3838c4[_0x791a('0x4b')][_0x791a('0x53')],_0x3838c4[_0x791a('0x4b')][_0x791a('0x34')]);_0x3838c4[_0x791a('0x4b')][_0x791a('0x54')]=integrations[_0x791a('0x55')](_0x3838c4['body'][_0x791a('0x53')],_0x3838c4[_0x791a('0x4b')]['type']);return db[_0x791a('0x4f')][_0x791a('0x4a')](_0x3838c4['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x791a('0x51')},{'model':db[_0x791a('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x565c83,null))[_0x791a('0x21')](handleError(_0x565c83,null));};exports[_0x791a('0x57')]=function(_0x46737e,_0x5da9b8,_0x1b23a1){var _0x4b27a7='';var _0x438b1d='';return db[_0x791a('0x32')][_0x791a('0x4e')]({'where':{'id':_0x46737e[_0x791a('0x47')]['id']},'attributes':['id',_0x791a('0x58'),_0x791a('0x59'),'apiKey']})[_0x791a('0x2b')](handleEntityNotFound(_0x5da9b8,null))[_0x791a('0x2b')](function(_0x41d1a5){if(_0x41d1a5){_0x438b1d=_0x41d1a5[_0x791a('0x58')];_0x4b27a7=_0x41d1a5[_0x791a('0x59')];var _0x3133fd=_0x41d1a5[_0x791a('0x59')][_0x791a('0x5a')](-0x1);if(_0x3133fd==='/'){_0x4b27a7=_0x4b27a7[_0x791a('0x5b')](0x0,_0x4b27a7[_0x791a('0x5c')](_0x3133fd));}return rp({'method':_0x791a('0x5d'),'uri':util[_0x791a('0x5e')](_0x791a('0x5f'),_0x4b27a7,_0x791a('0x60')),'headers':{'Authorization':_0x791a('0x61')+_0x41d1a5[_0x791a('0x62')]},'json':!![]});}})[_0x791a('0x2b')](function(_0x424970){if(_0x424970){var _0x5347e5=_0x424970[_0x791a('0x63')];var _0xbd35f8=![];var _0x3126f1=null;for(_0x3126f1=0x0;_0x3126f1<_0x5347e5[_0x791a('0x49')];_0x3126f1++){if(_0x5347e5[_0x3126f1][_0x791a('0x64')]===_0x438b1d){_0xbd35f8=!![];}}if(_0xbd35f8){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x791a('0x2b')](respondWithResult(_0x5da9b8,null))['catch'](function(_0x467d65){var _0x48b8dc=_0x46737e[_0x791a('0x36')][_0x791a('0x65')]?0x1f4:_0x467d65['statusCode']||0x1f4;logger[_0x791a('0x1e')](_0x791a('0x66'),_0x791a('0x57'),_0x48b8dc,JSON['stringify'](_0x467d65));delete _0x467d65[_0x791a('0x2f')];if(_0x48b8dc===0x191){_0x48b8dc=0x190;}_0x5da9b8['status'](_0x48b8dc)[_0x791a('0x30')](_0x46737e['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x467d65[_0x791a('0x67')]}:_0x467d65);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 72cfcba..ee46bbb 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7079=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_freshsales_accounts','lodash','../../config/logger'];(function(_0x264532,_0xc84798){var _0x4e51c1=function(_0x5bbd2b){while(--_0x5bbd2b){_0x264532['push'](_0x264532['shift']());}};_0x4e51c1(++_0xc84798);}(_0x7079,0x14e));var _0x9707=function(_0x5bc5cd,_0x1b9740){_0x5bc5cd=_0x5bc5cd-0x0;var _0x2acb6a=_0x7079[_0x5bc5cd];return _0x2acb6a;};'use strict';var _=require(_0x9707('0x0'));var util=require('util');var logger=require(_0x9707('0x1'))(_0x9707('0x2'));var moment=require(_0x9707('0x3'));var BPromise=require(_0x9707('0x4'));var rp=require(_0x9707('0x5'));var fs=require('fs');var path=require(_0x9707('0x6'));var rimraf=require(_0x9707('0x7'));var config=require(_0x9707('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x9707('0x9'));module[_0x9707('0xa')]=function(_0x4878e9,_0x3d26f2){return _0x4878e9['define']('FreshsalesAccount',attributes,{'tableName':_0x9707('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7008=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7008,0x185));var _0x8700=function(_0x25c94e,_0x43c132){_0x25c94e=_0x25c94e-0x0;var _0x343ca1=_0x7008[_0x25c94e];return _0x343ca1;};'use strict';var _=require(_0x8700('0x0'));var util=require(_0x8700('0x1'));var logger=require(_0x8700('0x2'))(_0x8700('0x3'));var moment=require('moment');var BPromise=require(_0x8700('0x4'));var rp=require(_0x8700('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8700('0x6'));var config=require(_0x8700('0x7'));var attributes=require(_0x8700('0x8'));var integrations=require(_0x8700('0x9'));module[_0x8700('0xa')]=function(_0xf9a514,_0x9ed4c0){return _0xf9a514['define'](_0x8700('0xb'),attributes,{'tableName':_0x8700('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 35f19e7..083d2c4 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc648=['../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','FreshsalesAccount','raw','where','options','attributes','include','model','map','GetFreshsalesAccount','catch','ShowFreshsalesAccount','find','util','moment','bluebird','randomstring','ioredis'];(function(_0xb94420,_0x3b5d22){var _0x4e9ab0=function(_0x59b137){while(--_0x59b137){_0xb94420['push'](_0xb94420['shift']());}};_0x4e9ab0(++_0x3b5d22);}(_0xc648,0x171));var _0x8c64=function(_0x152fe5,_0x441ea9){_0x152fe5=_0x152fe5-0x0;var _0x3b7713=_0xc648[_0x152fe5];return _0x3b7713;};'use strict';var _=require('lodash');var util=require(_0x8c64('0x0'));var moment=require(_0x8c64('0x1'));var BPromise=require(_0x8c64('0x2'));var rs=require(_0x8c64('0x3'));var fs=require('fs');var Redis=require(_0x8c64('0x4'));var db=require(_0x8c64('0x5'))['db'];var utils=require(_0x8c64('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8c64('0x7'));var client=jayson[_0x8c64('0x8')][_0x8c64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be93f,_0x507d58,_0x39644b){return new BPromise(function(_0x3a0a91,_0x2483a5){return client[_0x8c64('0xa')](_0x1be93f,_0x39644b)[_0x8c64('0xb')](function(_0x5e78c4){logger[_0x8c64('0xc')](_0x8c64('0xd'),_0x507d58,'request\x20sent');logger[_0x8c64('0xe')](_0x8c64('0xf'),_0x507d58,_0x8c64('0x10'),JSON[_0x8c64('0x11')](_0x5e78c4));if(_0x5e78c4[_0x8c64('0x12')]){if(_0x5e78c4[_0x8c64('0x12')][_0x8c64('0x13')]===0x1f4){logger[_0x8c64('0x12')](_0x8c64('0xd'),_0x507d58,_0x5e78c4[_0x8c64('0x12')]['message']);return _0x2483a5(_0x5e78c4[_0x8c64('0x12')][_0x8c64('0x14')]);}logger[_0x8c64('0x12')](_0x8c64('0xd'),_0x507d58,_0x5e78c4[_0x8c64('0x12')][_0x8c64('0x14')]);return _0x3a0a91(_0x5e78c4[_0x8c64('0x12')]['message']);}else{logger[_0x8c64('0xc')](_0x8c64('0xd'),_0x507d58,'request\x20sent');_0x3a0a91(_0x5e78c4[_0x8c64('0x15')][_0x8c64('0x14')]);}})['catch'](function(_0x2c3739){logger[_0x8c64('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x507d58,_0x2c3739);_0x2483a5(_0x2c3739);});});}exports['GetFreshsalesAccount']=function(_0x20931c){var _0x1ac646=this;return new Promise(function(_0x4be59b,_0x33179c){return db[_0x8c64('0x16')]['findAll']({'raw':_0x20931c['options']?_0x20931c['options'][_0x8c64('0x17')]===undefined?!![]:![]:!![],'where':_0x20931c['options']?_0x20931c['options'][_0x8c64('0x18')]||null:null,'attributes':_0x20931c[_0x8c64('0x19')]?_0x20931c[_0x8c64('0x19')][_0x8c64('0x1a')]||null:null,'limit':_0x20931c[_0x8c64('0x19')]?_0x20931c[_0x8c64('0x19')]['limit']||null:null,'include':_0x20931c[_0x8c64('0x19')]?_0x20931c['options'][_0x8c64('0x1b')]?_['map'](_0x20931c[_0x8c64('0x19')][_0x8c64('0x1b')],function(_0x4b2f7b){return{'model':db[_0x4b2f7b[_0x8c64('0x1c')]],'as':_0x4b2f7b['as'],'attributes':_0x4b2f7b[_0x8c64('0x1a')],'include':_0x4b2f7b[_0x8c64('0x1b')]?_['map'](_0x4b2f7b[_0x8c64('0x1b')],function(_0x4ddd8f){return{'model':db[_0x4ddd8f[_0x8c64('0x1c')]],'as':_0x4ddd8f['as'],'attributes':_0x4ddd8f[_0x8c64('0x1a')],'include':_0x4ddd8f[_0x8c64('0x1b')]?_[_0x8c64('0x1d')](_0x4ddd8f[_0x8c64('0x1b')],function(_0x56e847){return{'model':db[_0x56e847[_0x8c64('0x1c')]],'as':_0x56e847['as'],'attributes':_0x56e847['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3649f9){logger['info'](_0x8c64('0x1e'),_0x20931c);logger[_0x8c64('0xe')](_0x8c64('0x1e'),_0x20931c,JSON['stringify'](_0x3649f9));_0x4be59b(_0x3649f9);})[_0x8c64('0x1f')](function(_0x2d7548){logger[_0x8c64('0x12')](_0x8c64('0x1e'),_0x2d7548[_0x8c64('0x14')],_0x20931c);_0x33179c(_0x1ac646[_0x8c64('0x12')](0x1f4,_0x2d7548[_0x8c64('0x14')]));});});};exports[_0x8c64('0x20')]=function(_0x55ff15){var _0x4f86cd=this;return new Promise(function(_0x5b2e57,_0x187113){return db[_0x8c64('0x16')][_0x8c64('0x21')]({'raw':_0x55ff15[_0x8c64('0x19')]?_0x55ff15['options'][_0x8c64('0x17')]===undefined?!![]:![]:!![],'where':_0x55ff15[_0x8c64('0x19')]?_0x55ff15['options'][_0x8c64('0x18')]||null:null,'attributes':_0x55ff15['options']?_0x55ff15['options'][_0x8c64('0x1a')]||null:null,'include':_0x55ff15[_0x8c64('0x19')]?_0x55ff15['options']['include']?_['map'](_0x55ff15[_0x8c64('0x19')][_0x8c64('0x1b')],function(_0x150bd4){return{'model':db[_0x150bd4[_0x8c64('0x1c')]],'as':_0x150bd4['as'],'attributes':_0x150bd4[_0x8c64('0x1a')],'include':_0x150bd4[_0x8c64('0x1b')]?_[_0x8c64('0x1d')](_0x150bd4[_0x8c64('0x1b')],function(_0x44e919){return{'model':db[_0x44e919['model']],'as':_0x44e919['as'],'attributes':_0x44e919[_0x8c64('0x1a')],'include':_0x44e919[_0x8c64('0x1b')]?_[_0x8c64('0x1d')](_0x44e919['include'],function(_0x3f635d){return{'model':db[_0x3f635d[_0x8c64('0x1c')]],'as':_0x3f635d['as'],'attributes':_0x3f635d[_0x8c64('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21f9be){logger[_0x8c64('0xc')](_0x8c64('0x20'),_0x55ff15);logger[_0x8c64('0xe')](_0x8c64('0x20'),_0x55ff15,JSON[_0x8c64('0x11')](_0x21f9be));_0x5b2e57(_0x21f9be);})[_0x8c64('0x1f')](function(_0x2d1811){logger[_0x8c64('0x12')](_0x8c64('0x20'),_0x2d1811[_0x8c64('0x14')],_0x55ff15);_0x187113(_0x4f86cd[_0x8c64('0x12')](0x1f4,_0x2d1811[_0x8c64('0x14')]));});});}; \ No newline at end of file +var _0x2faf=['jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','model','map','attributes','catch','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3d9565,_0x5db973){var _0x546f66=function(_0x137352){while(--_0x137352){_0x3d9565['push'](_0x3d9565['shift']());}};_0x546f66(++_0x5db973);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var moment=require(_0xf2fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2fa('0x3'));var fs=require('fs');var Redis=require(_0xf2fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2fa('0x5'));var logger=require(_0xf2fa('0x6'))(_0xf2fa('0x7'));var config=require(_0xf2fa('0x8'));var jayson=require(_0xf2fa('0x9'));var client=jayson[_0xf2fa('0xa')][_0xf2fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c7035,_0x2fcd02,_0x3287ac){return new BPromise(function(_0x28ca24,_0x19ce5a){return client['request'](_0x4c7035,_0x3287ac)[_0xf2fa('0xc')](function(_0x530819){logger[_0xf2fa('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x2fcd02,_0xf2fa('0xe'));logger[_0xf2fa('0xf')](_0xf2fa('0x10'),_0x2fcd02,_0xf2fa('0xe'),JSON[_0xf2fa('0x11')](_0x530819));if(_0x530819[_0xf2fa('0x12')]){if(_0x530819[_0xf2fa('0x12')][_0xf2fa('0x13')]===0x1f4){logger[_0xf2fa('0x12')](_0xf2fa('0x14'),_0x2fcd02,_0x530819['error'][_0xf2fa('0x15')]);return _0x19ce5a(_0x530819[_0xf2fa('0x12')][_0xf2fa('0x15')]);}logger[_0xf2fa('0x12')](_0xf2fa('0x14'),_0x2fcd02,_0x530819[_0xf2fa('0x12')][_0xf2fa('0x15')]);return _0x28ca24(_0x530819[_0xf2fa('0x12')]['message']);}else{logger[_0xf2fa('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x2fcd02,_0xf2fa('0xe'));_0x28ca24(_0x530819[_0xf2fa('0x16')]['message']);}})['catch'](function(_0x1db062){logger[_0xf2fa('0x12')](_0xf2fa('0x14'),_0x2fcd02,_0x1db062);_0x19ce5a(_0x1db062);});});}exports[_0xf2fa('0x17')]=function(_0x2b8f69){var _0x2d0d36=this;return new Promise(function(_0x551b3d,_0x41e4f3){return db[_0xf2fa('0x18')][_0xf2fa('0x19')]({'raw':_0x2b8f69['options']?_0x2b8f69[_0xf2fa('0x1a')][_0xf2fa('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b8f69[_0xf2fa('0x1a')]?_0x2b8f69[_0xf2fa('0x1a')][_0xf2fa('0x1c')]||null:null,'attributes':_0x2b8f69['options']?_0x2b8f69['options']['attributes']||null:null,'limit':_0x2b8f69[_0xf2fa('0x1a')]?_0x2b8f69['options'][_0xf2fa('0x1d')]||null:null,'include':_0x2b8f69[_0xf2fa('0x1a')]?_0x2b8f69['options']['include']?_['map'](_0x2b8f69[_0xf2fa('0x1a')][_0xf2fa('0x1e')],function(_0x2b753e){return{'model':db[_0x2b753e[_0xf2fa('0x1f')]],'as':_0x2b753e['as'],'attributes':_0x2b753e['attributes'],'include':_0x2b753e['include']?_[_0xf2fa('0x20')](_0x2b753e['include'],function(_0x557631){return{'model':db[_0x557631['model']],'as':_0x557631['as'],'attributes':_0x557631[_0xf2fa('0x21')],'include':_0x557631['include']?_['map'](_0x557631[_0xf2fa('0x1e')],function(_0x5553fa){return{'model':db[_0x5553fa[_0xf2fa('0x1f')]],'as':_0x5553fa['as'],'attributes':_0x5553fa[_0xf2fa('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf2fa('0xc')](function(_0x47d295){logger['info'](_0xf2fa('0x17'),_0x2b8f69);logger['debug'](_0xf2fa('0x17'),_0x2b8f69,JSON[_0xf2fa('0x11')](_0x47d295));_0x551b3d(_0x47d295);})[_0xf2fa('0x22')](function(_0x3e631d){logger['error'](_0xf2fa('0x17'),_0x3e631d[_0xf2fa('0x15')],_0x2b8f69);_0x41e4f3(_0x2d0d36[_0xf2fa('0x12')](0x1f4,_0x3e631d['message']));});});};exports[_0xf2fa('0x23')]=function(_0x44075f){var _0x3b29ee=this;return new Promise(function(_0x41b057,_0x3a8c3a){return db[_0xf2fa('0x18')][_0xf2fa('0x24')]({'raw':_0x44075f[_0xf2fa('0x1a')]?_0x44075f[_0xf2fa('0x1a')][_0xf2fa('0x1b')]===undefined?!![]:![]:!![],'where':_0x44075f['options']?_0x44075f['options'][_0xf2fa('0x1c')]||null:null,'attributes':_0x44075f[_0xf2fa('0x1a')]?_0x44075f[_0xf2fa('0x1a')][_0xf2fa('0x21')]||null:null,'include':_0x44075f[_0xf2fa('0x1a')]?_0x44075f['options']['include']?_[_0xf2fa('0x20')](_0x44075f[_0xf2fa('0x1a')][_0xf2fa('0x1e')],function(_0x167b91){return{'model':db[_0x167b91[_0xf2fa('0x1f')]],'as':_0x167b91['as'],'attributes':_0x167b91[_0xf2fa('0x21')],'include':_0x167b91['include']?_[_0xf2fa('0x20')](_0x167b91['include'],function(_0x8bb016){return{'model':db[_0x8bb016[_0xf2fa('0x1f')]],'as':_0x8bb016['as'],'attributes':_0x8bb016[_0xf2fa('0x21')],'include':_0x8bb016[_0xf2fa('0x1e')]?_[_0xf2fa('0x20')](_0x8bb016[_0xf2fa('0x1e')],function(_0x26033e){return{'model':db[_0x26033e[_0xf2fa('0x1f')]],'as':_0x26033e['as'],'attributes':_0x26033e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf2fa('0xc')](function(_0x4b9c33){logger[_0xf2fa('0xd')](_0xf2fa('0x23'),_0x44075f);logger[_0xf2fa('0xf')]('ShowFreshsalesAccount',_0x44075f,JSON['stringify'](_0x4b9c33));_0x41b057(_0x4b9c33);})[_0xf2fa('0x22')](function(_0x58277e){logger[_0xf2fa('0x12')](_0xf2fa('0x23'),_0x58277e[_0xf2fa('0x15')],_0x44075f);_0x3a8c3a(_0x3b29ee[_0xf2fa('0x12')](0x1f4,_0x58277e[_0xf2fa('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7a58837..d8d3e9d 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9abd=['getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/subjects'];(function(_0x1bda6c,_0x5440b1){var _0x501a86=function(_0x1de54c){while(--_0x1de54c){_0x1bda6c['push'](_0x1bda6c['shift']());}};_0x501a86(++_0x5440b1);}(_0x9abd,0x12a));var _0xd9ab=function(_0x2034c3,_0x5a7952){_0x2034c3=_0x2034c3-0x0;var _0x2669f8=_0x9abd[_0x2034c3];return _0x2669f8;};'use strict';var multer=require(_0xd9ab('0x0'));var util=require(_0xd9ab('0x1'));var path=require(_0xd9ab('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ab('0x3'));var router=express[_0xd9ab('0x4')]();var auth=require(_0xd9ab('0x5'));var interaction=require(_0xd9ab('0x6'));var config=require(_0xd9ab('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xd9ab('0x8')](),controller[_0xd9ab('0x9')]);router[_0xd9ab('0xa')](_0xd9ab('0xb'),auth['isAuthenticated'](),controller[_0xd9ab('0xc')]);router['get'](_0xd9ab('0xd'),auth['isAuthenticated'](),controller[_0xd9ab('0xe')]);router[_0xd9ab('0xa')](_0xd9ab('0xf'),auth[_0xd9ab('0x8')](),controller['getDescriptions']);router[_0xd9ab('0xa')](_0xd9ab('0x10'),auth['isAuthenticated'](),controller[_0xd9ab('0x11')]);router[_0xd9ab('0x12')]('/',auth['isAuthenticated'](),controller[_0xd9ab('0x13')]);router['put'](_0xd9ab('0xb'),auth[_0xd9ab('0x8')](),controller[_0xd9ab('0x14')]);router[_0xd9ab('0x15')](_0xd9ab('0xb'),auth[_0xd9ab('0x8')](),controller[_0xd9ab('0x16')]);module[_0xd9ab('0x17')]=router; \ No newline at end of file +var _0xf554=['get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','post','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x24f8ea,_0x582561){var _0x387c81=function(_0x4fbe56){while(--_0x4fbe56){_0x24f8ea['push'](_0x24f8ea['shift']());}};_0x387c81(++_0x582561);}(_0xf554,0xa1));var _0x4f55=function(_0x5c4673,_0x3362df){_0x5c4673=_0x5c4673-0x0;var _0x2ecba4=_0xf554[_0x5c4673];return _0x2ecba4;};'use strict';var multer=require(_0x4f55('0x0'));var util=require(_0x4f55('0x1'));var path=require(_0x4f55('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f55('0x3'));var router=express[_0x4f55('0x4')]();var auth=require(_0x4f55('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4f55('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x4f55('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f55('0x8')]);router[_0x4f55('0x7')](_0x4f55('0x9'),auth[_0x4f55('0xa')](),controller[_0x4f55('0xb')]);router['get'](_0x4f55('0xc'),auth[_0x4f55('0xa')](),controller[_0x4f55('0xd')]);router[_0x4f55('0x7')](_0x4f55('0xe'),auth[_0x4f55('0xa')](),controller['getDescriptions']);router[_0x4f55('0x7')](_0x4f55('0xf'),auth[_0x4f55('0xa')](),controller['getFields']);router[_0x4f55('0x10')]('/',auth[_0x4f55('0xa')](),controller['create']);router['put'](_0x4f55('0x9'),auth[_0x4f55('0xa')](),controller[_0x4f55('0x11')]);router[_0x4f55('0x12')]('/:id',auth[_0x4f55('0xa')](),controller[_0x4f55('0x13')]);module[_0x4f55('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 8da7428..fbae5aa 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9be2=['STRING','sequelize'];(function(_0x59726f,_0x12ca2b){var _0x261676=function(_0x48bc57){while(--_0x48bc57){_0x59726f['push'](_0x59726f['shift']());}};_0x261676(++_0x12ca2b);}(_0x9be2,0x14f));var _0x29be=function(_0x1e4515,_0x2780e0){_0x1e4515=_0x1e4515-0x0;var _0x2dbe20=_0x9be2[_0x1e4515];return _0x2dbe20;};'use strict';var Sequelize=require(_0x29be('0x0'));module['exports']={'name':{'type':Sequelize[_0x29be('0x1')]},'description':{'type':Sequelize[_0x29be('0x1')]}}; \ No newline at end of file +var _0x3667=['STRING'];(function(_0x28d8c6,_0x1e55d2){var _0x3353ad=function(_0x3b05e0){while(--_0x3b05e0){_0x28d8c6['push'](_0x28d8c6['shift']());}};_0x3353ad(++_0x1e55d2);}(_0x3667,0xf4));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7366('0x0')]},'description':{'type':Sequelize[_0x7366('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1012c42..a42b665 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','params','includeAll','find','catch','update','body','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','end','status','json','count','offset','set','Content-Range','apply','save','then','destroy','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key'];(function(_0x17174c,_0x266797){var _0x38125a=function(_0x551221){while(--_0x551221){_0x17174c['push'](_0x17174c['shift']());}};_0x38125a(++_0x266797);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x7fbe[_0x4e5552];return _0x60a338;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];var jayson=require(_0xe7fb('0x1b'));var client=jayson[_0xe7fb('0x1c')][_0xe7fb('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x45fe75,_0x7fe4d3,_0x598729,_0x278b75){return new BPromise(function(_0x2225e5,_0x5573ab){var _0x30015a=_0x278b75||client;return _0x30015a[_0xe7fb('0x1e')](_0x45fe75,_0x598729)['then'](function(_0xa76acf){logger['info'](_0xe7fb('0x1f'),_0x7fe4d3,_0xe7fb('0x20'));logger[_0xe7fb('0x21')](_0xe7fb('0x22'),_0x7fe4d3,'request\x20sent',JSON[_0xe7fb('0x23')](_0xa76acf));if(_0xa76acf['error']){if(_0xa76acf[_0xe7fb('0x24')]['code']===0x1f4){logger[_0xe7fb('0x24')](_0xe7fb('0x1f'),_0x7fe4d3,_0xa76acf[_0xe7fb('0x24')][_0xe7fb('0x25')]);return _0x5573ab(_0xa76acf['error'][_0xe7fb('0x25')]);}logger['error'](_0xe7fb('0x1f'),_0x7fe4d3,_0xa76acf['error'][_0xe7fb('0x25')]);return _0x2225e5(_0xa76acf['error'][_0xe7fb('0x25')]);}else{logger[_0xe7fb('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7fe4d3,_0xe7fb('0x20'));_0x2225e5(_0xa76acf[_0xe7fb('0x27')][_0xe7fb('0x25')]);}})['catch'](function(_0x469d50){logger[_0xe7fb('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7fe4d3,_0x469d50);_0x5573ab(_0x469d50);});});}function respondWithStatusCode(_0x5bea27,_0x52f08b){_0x52f08b=_0x52f08b||0xcc;return function(_0x35e4db){if(_0x35e4db){return _0x5bea27['sendStatus'](_0x52f08b);}return _0x5bea27['status'](_0x52f08b)[_0xe7fb('0x28')]();};}function respondWithResult(_0x32e8b2,_0x2996ae){_0x2996ae=_0x2996ae||0xc8;return function(_0x4f6c73){if(_0x4f6c73){return _0x32e8b2[_0xe7fb('0x29')](_0x2996ae)[_0xe7fb('0x2a')](_0x4f6c73);}};}function respondWithFilteredResult(_0x390f32,_0x1ceed8){return function(_0x392d75){if(_0x392d75){var _0x16237a=_0x392d75[_0xe7fb('0x2b')],_0x380130=_0x1ceed8[_0xe7fb('0x2c')],_0x59e015=_0x1ceed8[_0xe7fb('0x2c')]+_0x1ceed8['limit'],_0x5df9f2;if(_0x59e015>=_0x16237a){_0x59e015=_0x16237a;_0x5df9f2=0xc8;}else{_0x5df9f2=0xce;}_0x390f32[_0xe7fb('0x29')](_0x5df9f2);return _0x390f32[_0xe7fb('0x2d')](_0xe7fb('0x2e'),_0x380130+'-'+_0x59e015+'/'+_0x16237a)[_0xe7fb('0x2a')](_0x392d75);}return null;};}function patchUpdates(_0x219554){return function(_0x1256d4){try{jsonpatch[_0xe7fb('0x2f')](_0x1256d4,_0x219554,!![]);}catch(_0x3dd0be){return BPromise['reject'](_0x3dd0be);}return _0x1256d4[_0xe7fb('0x30')]();};}function saveUpdates(_0x1742f3,_0x29d1ca){return function(_0x547a04){if(_0x547a04){return _0x547a04['update'](_0x1742f3)[_0xe7fb('0x31')](function(_0x4a9fea){return _0x4a9fea;});}return null;};}function removeEntity(_0xac56b4,_0x2f8774){return function(_0xe49053){if(_0xe49053){return _0xe49053[_0xe7fb('0x32')]()['then'](function(){_0xac56b4[_0xe7fb('0x29')](0xcc)[_0xe7fb('0x28')]();});}};}function handleEntityNotFound(_0x18ed83,_0x2f8818){return function(_0x2d650d){if(!_0x2d650d){_0x18ed83['sendStatus'](0x194);}return _0x2d650d;};}function handleError(_0x256694,_0x121d19){_0x121d19=_0x121d19||0x1f4;return function(_0x209eaa){logger[_0xe7fb('0x24')](_0x209eaa[_0xe7fb('0x33')]);if(_0x209eaa[_0xe7fb('0x34')]){delete _0x209eaa[_0xe7fb('0x34')];}_0x256694[_0xe7fb('0x29')](_0x121d19)[_0xe7fb('0x35')](_0x209eaa);};}exports['index']=function(_0x44d8cf,_0x29ef52){var _0x2593e3={},_0x56e17b={},_0x1de75a={'count':0x0,'rows':[]};var _0x3502dc=_[_0xe7fb('0x36')](db[_0xe7fb('0x37')][_0xe7fb('0x38')],function(_0x35b828){return{'name':_0x35b828[_0xe7fb('0x39')],'type':_0x35b828[_0xe7fb('0x3a')][_0xe7fb('0x3b')]};});_0x56e17b[_0xe7fb('0x3c')]=_[_0xe7fb('0x36')](_0x3502dc,_0xe7fb('0x34'));_0x56e17b[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x44d8cf[_0xe7fb('0x3d')]);_0x56e17b[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x56e17b[_0xe7fb('0x3c')],_0x56e17b[_0xe7fb('0x3d')]);_0x2593e3['attributes']=_[_0xe7fb('0x40')](_0x56e17b[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x44d8cf[_0xe7fb('0x3d')]['fields']));_0x2593e3[_0xe7fb('0x42')]=_0x2593e3[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x2593e3[_0xe7fb('0x42')]:_0x56e17b['model'];if(!_0x44d8cf[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x2593e3[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x44d8cf[_0xe7fb('0x3d')]['limit']);_0x2593e3[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x44d8cf[_0xe7fb('0x3d')]['offset']);}_0x2593e3[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x44d8cf['query']['sort']);_0x2593e3['where']=qs['filters'](_['pick'](_0x44d8cf[_0xe7fb('0x3d')],_0x56e17b[_0xe7fb('0x3f')]),_0x3502dc);if(_0x44d8cf[_0xe7fb('0x3d')]['filter']){_0x2593e3[_0xe7fb('0x49')]=_['merge'](_0x2593e3[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x3502dc,function(_0x4d29d3){if(_0x4d29d3[_0xe7fb('0x3a')]!==_0xe7fb('0x4a')){var _0x240efa={};_0x240efa[_0x4d29d3[_0xe7fb('0x34')]]={'$like':'%'+_0x44d8cf['query'][_0xe7fb('0x4b')]+'%'};return _0x240efa;}})});}_0x2593e3=_[_0xe7fb('0x4c')]({},_0x2593e3,_0x44d8cf[_0xe7fb('0x4d')]);var _0x56a84f={'where':_0x2593e3[_0xe7fb('0x49')]};return db[_0xe7fb('0x37')][_0xe7fb('0x2b')](_0x56a84f)[_0xe7fb('0x31')](function(_0xc07c40){_0x1de75a['count']=_0xc07c40;if(_0x44d8cf[_0xe7fb('0x3d')]['includeAll']){_0x2593e3[_0xe7fb('0x4e')]=[{'all':!![]}];}return db[_0xe7fb('0x37')][_0xe7fb('0x4f')](_0x2593e3);})[_0xe7fb('0x31')](function(_0x15cec3){_0x1de75a['rows']=_0x15cec3;return _0x1de75a;})[_0xe7fb('0x31')](respondWithFilteredResult(_0x29ef52,_0x2593e3))['catch'](handleError(_0x29ef52,null));};exports['show']=function(_0x12c828,_0x3d740f){var _0x16327f={'raw':![],'where':{'id':_0x12c828[_0xe7fb('0x50')]['id']}},_0x589555={};_0x589555[_0xe7fb('0x3c')]=_['keys'](db['FreshsalesConfiguration'][_0xe7fb('0x38')]);_0x589555[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x12c828[_0xe7fb('0x3d')]);_0x589555[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x589555[_0xe7fb('0x3c')],_0x589555[_0xe7fb('0x3d')]);_0x16327f['attributes']=_[_0xe7fb('0x40')](_0x589555['model'],qs[_0xe7fb('0x41')](_0x12c828[_0xe7fb('0x3d')]['fields']));_0x16327f[_0xe7fb('0x42')]=_0x16327f['attributes'][_0xe7fb('0x43')]?_0x16327f['attributes']:_0x589555[_0xe7fb('0x3c')];if(_0x12c828['query'][_0xe7fb('0x51')]){_0x16327f['include']=[{'all':!![]}];}_0x16327f=_[_0xe7fb('0x4c')]({},_0x16327f,_0x12c828[_0xe7fb('0x4d')]);return db[_0xe7fb('0x37')][_0xe7fb('0x52')](_0x16327f)[_0xe7fb('0x31')](handleEntityNotFound(_0x3d740f,null))[_0xe7fb('0x31')](respondWithResult(_0x3d740f,null))[_0xe7fb('0x53')](handleError(_0x3d740f,null));};exports['create']=function(_0x5d20dc,_0x20aa55){return db['FreshsalesConfiguration']['create'](_0x5d20dc['body'],{})['then'](respondWithResult(_0x20aa55,0xc9))['catch'](handleError(_0x20aa55,null));};exports[_0xe7fb('0x54')]=function(_0x34dd69,_0xd2fd76){if(_0x34dd69[_0xe7fb('0x55')]['id']){delete _0x34dd69['body']['id'];}return db[_0xe7fb('0x37')][_0xe7fb('0x52')]({'where':{'id':_0x34dd69[_0xe7fb('0x50')]['id']}})['then'](handleEntityNotFound(_0xd2fd76,null))['then'](saveUpdates(_0x34dd69[_0xe7fb('0x55')],null))[_0xe7fb('0x31')](respondWithResult(_0xd2fd76,null))[_0xe7fb('0x53')](handleError(_0xd2fd76,null));};exports['destroy']=function(_0x27f860,_0x3d946b){return db[_0xe7fb('0x37')][_0xe7fb('0x52')]({'where':{'id':_0x27f860['params']['id']}})['then'](handleEntityNotFound(_0x3d946b,null))[_0xe7fb('0x31')](removeEntity(_0x3d946b,null))[_0xe7fb('0x53')](handleError(_0x3d946b,null));};exports[_0xe7fb('0x56')]=function(_0x2f61b1,_0x3b0147,_0x5dd7c8){var _0x9c45a={};var _0x349a2a={};var _0x23755b;var _0x590d7a;return db['FreshsalesConfiguration'][_0xe7fb('0x57')]({'where':{'id':_0x2f61b1[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x3b0147,null))[_0xe7fb('0x31')](function(_0x40f546){if(_0x40f546){_0x23755b=_0x40f546;_0x349a2a[_0xe7fb('0x3c')]=_['keys'](db[_0xe7fb('0x58')][_0xe7fb('0x38')]);_0x349a2a[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x2f61b1[_0xe7fb('0x3d')]);_0x349a2a[_0xe7fb('0x3f')]=_['intersection'](_0x349a2a[_0xe7fb('0x3c')],_0x349a2a['query']);_0x9c45a[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x349a2a[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x2f61b1['query']['fields']));_0x9c45a[_0xe7fb('0x42')]=_0x9c45a[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x9c45a[_0xe7fb('0x42')]:_0x349a2a[_0xe7fb('0x3c')];_0x9c45a['order']=qs[_0xe7fb('0x48')](_0x2f61b1['query'][_0xe7fb('0x48')]);_0x9c45a['where']=qs['filters'](_[_0xe7fb('0x59')](_0x2f61b1[_0xe7fb('0x3d')],_0x349a2a[_0xe7fb('0x3f')]));if(_0x2f61b1['query'][_0xe7fb('0x4b')]){_0x9c45a[_0xe7fb('0x49')]=_[_0xe7fb('0x4c')](_0x9c45a[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x9c45a['attributes'],function(_0x404498){var _0x3c153a={};_0x3c153a[_0x404498]={'$like':'%'+_0x2f61b1['query'][_0xe7fb('0x4b')]+'%'};return _0x3c153a;})});}_0x9c45a=_[_0xe7fb('0x4c')]({},_0x9c45a,_0x2f61b1['options']);return _0x23755b[_0xe7fb('0x56')](_0x9c45a);}})['then'](function(_0x2705ef){if(_0x2705ef){_0x590d7a=_0x2705ef[_0xe7fb('0x43')];if(!_0x2f61b1[_0xe7fb('0x3d')]['hasOwnProperty'](_0xe7fb('0x45'))){_0x9c45a[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x2f61b1[_0xe7fb('0x3d')][_0xe7fb('0x46')]);_0x9c45a[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x2f61b1[_0xe7fb('0x3d')]['offset']);}return _0x23755b['getSubjects'](_0x9c45a);}})[_0xe7fb('0x31')](function(_0x3a674e){if(_0x3a674e){return _0x3a674e?{'count':_0x590d7a,'rows':_0x3a674e}:null;}})[_0xe7fb('0x31')](respondWithResult(_0x3b0147,null))['catch'](handleError(_0x3b0147,null));};exports['getDescriptions']=function(_0x1ac1fd,_0x2b071c,_0xad7c53){var _0x1df857={};var _0x2d558c={};var _0x336fd3;var _0x188e57;return db[_0xe7fb('0x37')][_0xe7fb('0x57')]({'where':{'id':_0x1ac1fd[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x2b071c,null))[_0xe7fb('0x31')](function(_0x12b91f){if(_0x12b91f){_0x336fd3=_0x12b91f;_0x2d558c['model']=_['keys'](db[_0xe7fb('0x58')][_0xe7fb('0x38')]);_0x2d558c[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x1ac1fd[_0xe7fb('0x3d')]);_0x2d558c['filters']=_[_0xe7fb('0x40')](_0x2d558c[_0xe7fb('0x3c')],_0x2d558c[_0xe7fb('0x3d')]);_0x1df857[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x2d558c[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x41')]));_0x1df857['attributes']=_0x1df857[_0xe7fb('0x42')]['length']?_0x1df857[_0xe7fb('0x42')]:_0x2d558c[_0xe7fb('0x3c')];_0x1df857[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x1ac1fd[_0xe7fb('0x3d')]['sort']);_0x1df857[_0xe7fb('0x49')]=qs[_0xe7fb('0x3f')](_[_0xe7fb('0x59')](_0x1ac1fd[_0xe7fb('0x3d')],_0x2d558c[_0xe7fb('0x3f')]));if(_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x4b')]){_0x1df857[_0xe7fb('0x49')]=_[_0xe7fb('0x4c')](_0x1df857[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x1df857[_0xe7fb('0x42')],function(_0x3a68c0){var _0x300a7c={};_0x300a7c[_0x3a68c0]={'$like':'%'+_0x1ac1fd['query']['filter']+'%'};return _0x300a7c;})});}_0x1df857=_['merge']({},_0x1df857,_0x1ac1fd[_0xe7fb('0x4d')]);return _0x336fd3[_0xe7fb('0x5a')](_0x1df857);}})[_0xe7fb('0x31')](function(_0x2789f0){if(_0x2789f0){_0x188e57=_0x2789f0['length'];if(!_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x1df857[_0xe7fb('0x46')]=qs['limit'](_0x1ac1fd[_0xe7fb('0x3d')]['limit']);_0x1df857[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x2c')]);}return _0x336fd3[_0xe7fb('0x5a')](_0x1df857);}})['then'](function(_0x3ffd6c){if(_0x3ffd6c){return _0x3ffd6c?{'count':_0x188e57,'rows':_0x3ffd6c}:null;}})['then'](respondWithResult(_0x2b071c,null))[_0xe7fb('0x53')](handleError(_0x2b071c,null));};exports['getFields']=function(_0x2aeeed,_0x38f52c,_0x4c37cd){var _0x2b6d69={};var _0x31642f={};var _0xb19e94;var _0x4181fd;return db['FreshsalesConfiguration'][_0xe7fb('0x57')]({'where':{'id':_0x2aeeed[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x38f52c,null))['then'](function(_0x11d5b6){if(_0x11d5b6){_0xb19e94=_0x11d5b6;_0x31642f['model']=_['keys'](db['FreshsalesField'][_0xe7fb('0x38')]);_0x31642f[_0xe7fb('0x3d')]=_['keys'](_0x2aeeed[_0xe7fb('0x3d')]);_0x31642f[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x31642f[_0xe7fb('0x3c')],_0x31642f[_0xe7fb('0x3d')]);_0x2b6d69[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x31642f[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x41')]));_0x2b6d69[_0xe7fb('0x42')]=_0x2b6d69[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x2b6d69[_0xe7fb('0x42')]:_0x31642f[_0xe7fb('0x3c')];_0x2b6d69[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x48')]);_0x2b6d69['where']=qs[_0xe7fb('0x3f')](_[_0xe7fb('0x59')](_0x2aeeed[_0xe7fb('0x3d')],_0x31642f[_0xe7fb('0x3f')]));if(_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x4b')]){_0x2b6d69[_0xe7fb('0x49')]=_['merge'](_0x2b6d69['where'],{'$or':_[_0xe7fb('0x36')](_0x2b6d69['attributes'],function(_0x2f486){var _0x496205={};_0x496205[_0x2f486]={'$like':'%'+_0x2aeeed['query'][_0xe7fb('0x4b')]+'%'};return _0x496205;})});}_0x2b6d69=_[_0xe7fb('0x4c')]({},_0x2b6d69,_0x2aeeed[_0xe7fb('0x4d')]);return _0xb19e94[_0xe7fb('0x5b')](_0x2b6d69);}})[_0xe7fb('0x31')](function(_0x38cc9e){if(_0x38cc9e){_0x4181fd=_0x38cc9e['length'];if(!_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x2b6d69[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x2aeeed[_0xe7fb('0x3d')]['limit']);_0x2b6d69['offset']=qs['offset'](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x2c')]);}return _0xb19e94[_0xe7fb('0x5b')](_0x2b6d69);}})['then'](function(_0xfa895b){if(_0xfa895b){return _0xfa895b?{'count':_0x4181fd,'rows':_0xfa895b}:null;}})['then'](respondWithResult(_0x38f52c,null))[_0xe7fb('0x53')](handleError(_0x38f52c,null));}; \ No newline at end of file +var _0x5fab=['FreshsalesField','length','hasOwnProperty','getSubjects','getDescriptions','nolimit','getFields','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','FreshsalesConfiguration','rawAttributes','type','key','model','map','attributes','intersection','fields','query','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fab,0x177));var _0xb5fa=function(_0x852450,_0xd2456e){_0x852450=_0x852450-0x0;var _0x329404=_0x5fab[_0x852450];return _0x329404;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb5fa('0x1a')][_0xb5fa('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x56e8b0,_0x116849,_0x577af0,_0x265992){return new BPromise(function(_0x3fc372,_0x40c914){var _0xca8d82=_0x265992||client;return _0xca8d82[_0xb5fa('0x1c')](_0x56e8b0,_0x577af0)['then'](function(_0x567f31){logger[_0xb5fa('0x1d')](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));logger[_0xb5fa('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x116849,'request\x20sent',JSON[_0xb5fa('0x21')](_0x567f31));if(_0x567f31[_0xb5fa('0x22')]){if(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x23')]===0x1f4){logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);return _0x40c914(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);}logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31['error'][_0xb5fa('0x24')]);return _0x3fc372(_0x567f31['error'][_0xb5fa('0x24')]);}else{logger['info'](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));_0x3fc372(_0x567f31['result'][_0xb5fa('0x24')]);}})[_0xb5fa('0x25')](function(_0x283a56){logger['error'](_0xb5fa('0x1e'),_0x116849,_0x283a56);_0x40c914(_0x283a56);});});}function respondWithStatusCode(_0xec108f,_0x444237){_0x444237=_0x444237||0xcc;return function(_0x542348){if(_0x542348){return _0xec108f[_0xb5fa('0x26')](_0x444237);}return _0xec108f['status'](_0x444237)[_0xb5fa('0x27')]();};}function respondWithResult(_0x264591,_0x11053a){_0x11053a=_0x11053a||0xc8;return function(_0x543edf){if(_0x543edf){return _0x264591[_0xb5fa('0x28')](_0x11053a)[_0xb5fa('0x29')](_0x543edf);}};}function respondWithFilteredResult(_0x6a455c,_0x20d649){return function(_0x568870){if(_0x568870){var _0x4ec294=_0x568870[_0xb5fa('0x2a')],_0x5bdf11=_0x20d649[_0xb5fa('0x2b')],_0x5a1c39=_0x20d649[_0xb5fa('0x2b')]+_0x20d649[_0xb5fa('0x2c')],_0x28a350;if(_0x5a1c39>=_0x4ec294){_0x5a1c39=_0x4ec294;_0x28a350=0xc8;}else{_0x28a350=0xce;}_0x6a455c[_0xb5fa('0x28')](_0x28a350);return _0x6a455c[_0xb5fa('0x2d')](_0xb5fa('0x2e'),_0x5bdf11+'-'+_0x5a1c39+'/'+_0x4ec294)[_0xb5fa('0x29')](_0x568870);}return null;};}function patchUpdates(_0x2a5690){return function(_0x142bfa){try{jsonpatch[_0xb5fa('0x2f')](_0x142bfa,_0x2a5690,!![]);}catch(_0xab5427){return BPromise[_0xb5fa('0x30')](_0xab5427);}return _0x142bfa[_0xb5fa('0x31')]();};}function saveUpdates(_0x116773,_0x5a0152){return function(_0x3fd1fb){if(_0x3fd1fb){return _0x3fd1fb[_0xb5fa('0x32')](_0x116773)[_0xb5fa('0x33')](function(_0x291938){return _0x291938;});}return null;};}function removeEntity(_0x370d95,_0x10fb43){return function(_0x25fc7c){if(_0x25fc7c){return _0x25fc7c['destroy']()[_0xb5fa('0x33')](function(){_0x370d95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x558708,_0x1e6ba0){return function(_0x502d57){if(!_0x502d57){_0x558708[_0xb5fa('0x26')](0x194);}return _0x502d57;};}function handleError(_0x5876f1,_0x5518b1){_0x5518b1=_0x5518b1||0x1f4;return function(_0x1847bc){logger[_0xb5fa('0x22')](_0x1847bc['stack']);if(_0x1847bc['name']){delete _0x1847bc[_0xb5fa('0x34')];}_0x5876f1[_0xb5fa('0x28')](_0x5518b1)[_0xb5fa('0x35')](_0x1847bc);};}exports['index']=function(_0xc9adee,_0xc28a80){var _0x4a7137={},_0x18398f={},_0x2056de={'count':0x0,'rows':[]};var _0x204d6b=_['map'](db[_0xb5fa('0x36')][_0xb5fa('0x37')],function(_0x24ef11){return{'name':_0x24ef11['fieldName'],'type':_0x24ef11[_0xb5fa('0x38')][_0xb5fa('0x39')]};});_0x18398f[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x204d6b,'name');_0x18398f['query']=_['keys'](_0xc9adee['query']);_0x18398f['filters']=_['intersection'](_0x18398f[_0xb5fa('0x3a')],_0x18398f['query']);_0x4a7137[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x18398f[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x4a7137['attributes']=_0x4a7137['attributes']['length']?_0x4a7137[_0xb5fa('0x3c')]:_0x18398f['model'];if(!_0xc9adee[_0xb5fa('0x3f')]['hasOwnProperty']('nolimit')){_0x4a7137[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x4a7137[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}_0x4a7137[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0xc9adee['query'][_0xb5fa('0x41')]);_0x4a7137['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0xc9adee[_0xb5fa('0x3f')],_0x18398f[_0xb5fa('0x42')]),_0x204d6b);if(_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x4a7137[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x4a7137['where'],{'$or':_[_0xb5fa('0x3b')](_0x204d6b,function(_0xc03e44){if(_0xc03e44['type']!==_0xb5fa('0x47')){var _0x5a6ae3={};_0x5a6ae3[_0xc03e44[_0xb5fa('0x34')]]={'$like':'%'+_0xc9adee[_0xb5fa('0x3f')]['filter']+'%'};return _0x5a6ae3;}})});}_0x4a7137=_['merge']({},_0x4a7137,_0xc9adee[_0xb5fa('0x48')]);var _0xe86e11={'where':_0x4a7137[_0xb5fa('0x45')]};return db[_0xb5fa('0x36')][_0xb5fa('0x2a')](_0xe86e11)[_0xb5fa('0x33')](function(_0x10f354){_0x2056de[_0xb5fa('0x2a')]=_0x10f354;if(_0xc9adee['query'][_0xb5fa('0x49')]){_0x4a7137[_0xb5fa('0x4a')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xb5fa('0x4b')](_0x4a7137);})[_0xb5fa('0x33')](function(_0x247999){_0x2056de[_0xb5fa('0x4c')]=_0x247999;return _0x2056de;})[_0xb5fa('0x33')](respondWithFilteredResult(_0xc28a80,_0x4a7137))[_0xb5fa('0x25')](handleError(_0xc28a80,null));};exports[_0xb5fa('0x4d')]=function(_0x33eb2c,_0x20f5f5){var _0x464e36={'raw':![],'where':{'id':_0x33eb2c[_0xb5fa('0x4e')]['id']}},_0xfe091={};_0xfe091[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x36')][_0xb5fa('0x37')]);_0xfe091['query']=_['keys'](_0x33eb2c[_0xb5fa('0x3f')]);_0xfe091['filters']=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],_0xfe091['query']);_0x464e36[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x33eb2c[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x464e36['attributes']=_0x464e36[_0xb5fa('0x3c')]['length']?_0x464e36[_0xb5fa('0x3c')]:_0xfe091[_0xb5fa('0x3a')];if(_0x33eb2c[_0xb5fa('0x3f')]['includeAll']){_0x464e36[_0xb5fa('0x4a')]=[{'all':!![]}];}_0x464e36=_[_0xb5fa('0x46')]({},_0x464e36,_0x33eb2c['options']);return db['FreshsalesConfiguration'][_0xb5fa('0x50')](_0x464e36)[_0xb5fa('0x33')](handleEntityNotFound(_0x20f5f5,null))[_0xb5fa('0x33')](respondWithResult(_0x20f5f5,null))[_0xb5fa('0x25')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x51')]=function(_0x7775b4,_0x31c91f){return db[_0xb5fa('0x36')][_0xb5fa('0x51')](_0x7775b4[_0xb5fa('0x52')],{})[_0xb5fa('0x33')](respondWithResult(_0x31c91f,0xc9))[_0xb5fa('0x25')](handleError(_0x31c91f,null));};exports[_0xb5fa('0x32')]=function(_0x2799e7,_0x23f235){if(_0x2799e7[_0xb5fa('0x52')]['id']){delete _0x2799e7[_0xb5fa('0x52')]['id'];}return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x2799e7[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x23f235,null))[_0xb5fa('0x33')](saveUpdates(_0x2799e7[_0xb5fa('0x52')],null))[_0xb5fa('0x33')](respondWithResult(_0x23f235,null))[_0xb5fa('0x25')](handleError(_0x23f235,null));};exports[_0xb5fa('0x53')]=function(_0x24117e,_0x1cb39e){return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x24117e['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1cb39e,null))[_0xb5fa('0x33')](removeEntity(_0x1cb39e,null))[_0xb5fa('0x25')](handleError(_0x1cb39e,null));};exports['getSubjects']=function(_0x441c41,_0x367f7a,_0x1572fb){var _0x2e855c={};var _0x31ab22={};var _0x9d12f1;var _0x2e7286;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x441c41[_0xb5fa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x367f7a,null))[_0xb5fa('0x33')](function(_0x26bc03){if(_0x26bc03){_0x9d12f1=_0x26bc03;_0x31ab22['model']=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x31ab22[_0xb5fa('0x3f')]=_[_0xb5fa('0x4f')](_0x441c41[_0xb5fa('0x3f')]);_0x31ab22[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],_0x31ab22[_0xb5fa('0x3f')]);_0x2e855c[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x2e855c[_0xb5fa('0x3c')]=_0x2e855c[_0xb5fa('0x3c')][_0xb5fa('0x56')]?_0x2e855c[_0xb5fa('0x3c')]:_0x31ab22[_0xb5fa('0x3a')];_0x2e855c[_0xb5fa('0x40')]=qs['sort'](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x41')]);_0x2e855c[_0xb5fa('0x45')]=qs['filters'](_[_0xb5fa('0x43')](_0x441c41[_0xb5fa('0x3f')],_0x31ab22['filters']));if(_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x2e855c[_0xb5fa('0x45')]=_['merge'](_0x2e855c['where'],{'$or':_[_0xb5fa('0x3b')](_0x2e855c[_0xb5fa('0x3c')],function(_0x432f04){var _0x57d8b7={};_0x57d8b7[_0x432f04]={'$like':'%'+_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x57d8b7;})});}_0x2e855c=_[_0xb5fa('0x46')]({},_0x2e855c,_0x441c41[_0xb5fa('0x48')]);return _0x9d12f1['getSubjects'](_0x2e855c);}})['then'](function(_0x5cec07){if(_0x5cec07){_0x2e7286=_0x5cec07[_0xb5fa('0x56')];if(!_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x57')]('nolimit')){_0x2e855c[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x2e855c[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x9d12f1[_0xb5fa('0x58')](_0x2e855c);}})[_0xb5fa('0x33')](function(_0x3a1db9){if(_0x3a1db9){return _0x3a1db9?{'count':_0x2e7286,'rows':_0x3a1db9}:null;}})[_0xb5fa('0x33')](respondWithResult(_0x367f7a,null))[_0xb5fa('0x25')](handleError(_0x367f7a,null));};exports[_0xb5fa('0x59')]=function(_0x41127a,_0x5eeaa1,_0xf173e4){var _0x5a6f74={};var _0x47193c={};var _0x209213;var _0x37975d;return db[_0xb5fa('0x36')][_0xb5fa('0x54')]({'where':{'id':_0x41127a['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x5eeaa1,null))['then'](function(_0x77a831){if(_0x77a831){_0x209213=_0x77a831;_0x47193c[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')]['rawAttributes']);_0x47193c['query']=_['keys'](_0x41127a[_0xb5fa('0x3f')]);_0x47193c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x47193c[_0xb5fa('0x3a')],_0x47193c[_0xb5fa('0x3f')]);_0x5a6f74[_0xb5fa('0x3c')]=_['intersection'](_0x47193c[_0xb5fa('0x3a')],qs['fields'](_0x41127a['query'][_0xb5fa('0x3e')]));_0x5a6f74['attributes']=_0x5a6f74['attributes']['length']?_0x5a6f74[_0xb5fa('0x3c')]:_0x47193c['model'];_0x5a6f74[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0x41127a[_0xb5fa('0x3f')]['sort']);_0x5a6f74['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0x41127a['query'],_0x47193c[_0xb5fa('0x42')]));if(_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x5a6f74[_0xb5fa('0x45')]=_['merge'](_0x5a6f74[_0xb5fa('0x45')],{'$or':_[_0xb5fa('0x3b')](_0x5a6f74[_0xb5fa('0x3c')],function(_0x180e63){var _0x1c0f49={};_0x1c0f49[_0x180e63]={'$like':'%'+_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x1c0f49;})});}_0x5a6f74=_['merge']({},_0x5a6f74,_0x41127a[_0xb5fa('0x48')]);return _0x209213['getDescriptions'](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x45790c){if(_0x45790c){_0x37975d=_0x45790c['length'];if(!_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x5a6f74[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x5a6f74[_0xb5fa('0x2b')]=qs['offset'](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x209213[_0xb5fa('0x59')](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x53095e){if(_0x53095e){return _0x53095e?{'count':_0x37975d,'rows':_0x53095e}:null;}})['then'](respondWithResult(_0x5eeaa1,null))['catch'](handleError(_0x5eeaa1,null));};exports['getFields']=function(_0x1c60bd,_0x1e607b,_0xff504d){var _0x188e66={};var _0x599a7c={};var _0x551822;var _0x148cb4;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x1c60bd[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1e607b,null))[_0xb5fa('0x33')](function(_0x577aef){if(_0x577aef){_0x551822=_0x577aef;_0x599a7c[_0xb5fa('0x3a')]=_['keys'](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x599a7c['query']=_['keys'](_0x1c60bd[_0xb5fa('0x3f')]);_0x599a7c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],_0x599a7c[_0xb5fa('0x3f')]);_0x188e66[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x188e66[_0xb5fa('0x3c')]=_0x188e66[_0xb5fa('0x3c')]['length']?_0x188e66['attributes']:_0x599a7c[_0xb5fa('0x3a')];_0x188e66['order']=qs[_0xb5fa('0x41')](_0x1c60bd[_0xb5fa('0x3f')]['sort']);_0x188e66[_0xb5fa('0x45')]=qs[_0xb5fa('0x42')](_['pick'](_0x1c60bd[_0xb5fa('0x3f')],_0x599a7c[_0xb5fa('0x42')]));if(_0x1c60bd['query'][_0xb5fa('0x44')]){_0x188e66[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x188e66['where'],{'$or':_['map'](_0x188e66[_0xb5fa('0x3c')],function(_0x1a24a2){var _0x3b5e1d={};_0x3b5e1d[_0x1a24a2]={'$like':'%'+_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x3b5e1d;})});}_0x188e66=_[_0xb5fa('0x46')]({},_0x188e66,_0x1c60bd[_0xb5fa('0x48')]);return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x1a4465){if(_0x1a4465){_0x148cb4=_0x1a4465['length'];if(!_0x1c60bd['query'][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x188e66[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x1c60bd['query'][_0xb5fa('0x2c')]);_0x188e66[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x1c60bd['query'][_0xb5fa('0x2b')]);}return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x301d14){if(_0x301d14){return _0x301d14?{'count':_0x148cb4,'rows':_0x301d14}:null;}})['then'](respondWithResult(_0x1e607b,null))[_0xb5fa('0x25')](handleError(_0x1e607b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 5be2d4a..596d088 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7229=['api','moment','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','lodash','util','../../config/logger'];(function(_0x20f033,_0x448d79){var _0x17396e=function(_0x4b5ade){while(--_0x4b5ade){_0x20f033['push'](_0x20f033['shift']());}};_0x17396e(++_0x448d79);}(_0x7229,0x76));var _0x9722=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x7229[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x9722('0x0'));var util=require(_0x9722('0x1'));var logger=require(_0x9722('0x2'))(_0x9722('0x3'));var moment=require(_0x9722('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9722('0x5'));var rimraf=require(_0x9722('0x6'));var config=require(_0x9722('0x7'));var attributes=require(_0x9722('0x8'));module[_0x9722('0x9')]=function(_0x43e0ed,_0x2689b3){return _0x43e0ed['define'](_0x9722('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x403a=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','api','bluebird','path'];(function(_0x454714,_0x43b9fd){var _0x750b9c=function(_0x29601f){while(--_0x29601f){_0x454714['push'](_0x454714['shift']());}};_0x750b9c(++_0x43b9fd);}(_0x403a,0x19e));var _0xa403=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x403a[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xa403('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa403('0x1'));var moment=require('moment');var BPromise=require(_0xa403('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa403('0x3'));var rimraf=require(_0xa403('0x4'));var config=require(_0xa403('0x5'));var attributes=require(_0xa403('0x6'));module[_0xa403('0x7')]=function(_0x4666b3,_0x1b1c9f){return _0x4666b3[_0xa403('0x8')](_0xa403('0x9'),attributes,{'tableName':_0xa403('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 50bdb91..ec651de 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5706=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x34d88f,_0x3c914b){var _0x15baff=function(_0x49cbc4){while(--_0x49cbc4){_0x34d88f['push'](_0x34d88f['shift']());}};_0x15baff(++_0x3c914b);}(_0x5706,0xb0));var _0x6570=function(_0x5157e6,_0x4f2b70){_0x5157e6=_0x5157e6-0x0;var _0x44c3c2=_0x5706[_0x5157e6];return _0x44c3c2;};'use strict';var _=require(_0x6570('0x0'));var util=require(_0x6570('0x1'));var moment=require(_0x6570('0x2'));var BPromise=require('bluebird');var rs=require(_0x6570('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6570('0x4'))['db'];var utils=require(_0x6570('0x5'));var logger=require(_0x6570('0x6'))(_0x6570('0x7'));var config=require(_0x6570('0x8'));var jayson=require(_0x6570('0x9'));var client=jayson[_0x6570('0xa')][_0x6570('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x140ee2,_0x1fab62,_0x528392){return new BPromise(function(_0x594eef,_0x2310ad){return client[_0x6570('0xc')](_0x140ee2,_0x528392)[_0x6570('0xd')](function(_0x312455){logger[_0x6570('0xe')](_0x6570('0xf'),_0x1fab62,'request\x20sent');logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x1fab62,_0x6570('0x10'),JSON[_0x6570('0x11')](_0x312455));if(_0x312455[_0x6570('0x12')]){if(_0x312455[_0x6570('0x12')][_0x6570('0x13')]===0x1f4){logger[_0x6570('0x12')](_0x6570('0xf'),_0x1fab62,_0x312455[_0x6570('0x12')][_0x6570('0x14')]);return _0x2310ad(_0x312455['error'][_0x6570('0x14')]);}logger[_0x6570('0x12')](_0x6570('0xf'),_0x1fab62,_0x312455[_0x6570('0x12')][_0x6570('0x14')]);return _0x594eef(_0x312455[_0x6570('0x12')][_0x6570('0x14')]);}else{logger[_0x6570('0xe')](_0x6570('0xf'),_0x1fab62,_0x6570('0x10'));_0x594eef(_0x312455[_0x6570('0x15')][_0x6570('0x14')]);}})['catch'](function(_0x393fc8){logger['error'](_0x6570('0xf'),_0x1fab62,_0x393fc8);_0x2310ad(_0x393fc8);});});} \ No newline at end of file +var _0xac4a=['FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x20d771,_0x39a667){_0x20d771=_0x20d771-0x0;var _0x16f6c1=_0xac4a[_0x20d771];return _0x16f6c1;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index caddf3f..9fa8aa5 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46b6=['create','put','/:id','update','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','show','post'];(function(_0x35e4dc,_0x1ff938){var _0x52777b=function(_0x58f415){while(--_0x58f415){_0x35e4dc['push'](_0x35e4dc['shift']());}};_0x52777b(++_0x1ff938);}(_0x46b6,0x1f2));var _0x646b=function(_0x15a20b,_0x4e9d78){_0x15a20b=_0x15a20b-0x0;var _0x3f8471=_0x46b6[_0x15a20b];return _0x3f8471;};'use strict';var multer=require(_0x646b('0x0'));var util=require(_0x646b('0x1'));var path=require(_0x646b('0x2'));var timeout=require(_0x646b('0x3'));var express=require(_0x646b('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x646b('0x5'));var config=require('../../config/environment');var controller=require(_0x646b('0x6'));router[_0x646b('0x7')]('/',auth[_0x646b('0x8')](),controller[_0x646b('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x646b('0xa')]);router[_0x646b('0xb')]('/',auth[_0x646b('0x8')](),controller[_0x646b('0xc')]);router[_0x646b('0xd')](_0x646b('0xe'),auth[_0x646b('0x8')](),controller[_0x646b('0xf')]);router['delete']('/:id',auth[_0x646b('0x8')](),controller['destroy']);module[_0x646b('0x10')]=router; \ No newline at end of file +var _0x1009=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id'];(function(_0x4dedc3,_0x4f4966){var _0x1d08f4=function(_0x299d40){while(--_0x299d40){_0x4dedc3['push'](_0x4dedc3['shift']());}};_0x1d08f4(++_0x4f4966);}(_0x1009,0x1eb));var _0x9100=function(_0x8af03b,_0x32c5ce){_0x8af03b=_0x8af03b-0x0;var _0x2e5d4c=_0x1009[_0x8af03b];return _0x2e5d4c;};'use strict';var multer=require(_0x9100('0x0'));var util=require(_0x9100('0x1'));var path=require(_0x9100('0x2'));var timeout=require(_0x9100('0x3'));var express=require(_0x9100('0x4'));var router=express[_0x9100('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9100('0x6'));var config=require(_0x9100('0x7'));var controller=require(_0x9100('0x8'));router['get']('/',auth[_0x9100('0x9')](),controller[_0x9100('0xa')]);router[_0x9100('0xb')](_0x9100('0xc'),auth[_0x9100('0x9')](),controller[_0x9100('0xd')]);router[_0x9100('0xe')]('/',auth[_0x9100('0x9')](),controller[_0x9100('0xf')]);router[_0x9100('0x10')](_0x9100('0xc'),auth['isAuthenticated'](),controller[_0x9100('0x11')]);router[_0x9100('0x12')](_0x9100('0xc'),auth[_0x9100('0x9')](),controller[_0x9100('0x13')]);module[_0x9100('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index cd4008a..ad8cc81 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9ee=['variable','customVariable','keyValue','string','STRING','sequelize','exports','ENUM'];(function(_0x59b56b,_0x2ab31f){var _0x166e03=function(_0x33551e){while(--_0x33551e){_0x59b56b['push'](_0x59b56b['shift']());}};_0x166e03(++_0x2ab31f);}(_0xb9ee,0x12d));var _0xeb9e=function(_0x272fed,_0x243d67){_0x272fed=_0x272fed-0x0;var _0x2f7ead=_0xb9ee[_0x272fed];return _0x2f7ead;};'use strict';var Sequelize=require(_0xeb9e('0x0'));module[_0xeb9e('0x1')]={'type':{'type':Sequelize[_0xeb9e('0x2')]('string',_0xeb9e('0x3'),_0xeb9e('0x4'),_0xeb9e('0x5')),'defaultValue':_0xeb9e('0x6')},'content':{'type':Sequelize[_0xeb9e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xeb9e('0x2')](_0xeb9e('0x6'),_0xeb9e('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xeb9e('0x7')]},'idField':{'type':Sequelize[_0xeb9e('0x7')]},'nameField':{'type':Sequelize[_0xeb9e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeb9e('0x7')]}}; \ No newline at end of file +var _0x36f1=['sequelize','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x2c682c,_0x2c7805){var _0x3726bf=function(_0x48058c){while(--_0x48058c){_0x2c682c['push'](_0x2c682c['shift']());}};_0x3726bf(++_0x2c7805);}(_0x36f1,0xb0));var _0x136f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x36f1[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x136f('0x0'));module['exports']={'type':{'type':Sequelize[_0x136f('0x1')]('string',_0x136f('0x2'),_0x136f('0x3'),_0x136f('0x4')),'defaultValue':_0x136f('0x5')},'content':{'type':Sequelize[_0x136f('0x6')]},'key':{'type':Sequelize[_0x136f('0x6')]},'keyType':{'type':Sequelize[_0x136f('0x1')](_0x136f('0x5'),_0x136f('0x2'),_0x136f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x136f('0x6')]},'nameField':{'type':Sequelize[_0x136f('0x6')]},'customField':{'type':Sequelize[_0x136f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 072e43b..7baef21 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79e0=['json','reject','save','update','then','error','stack','name','index','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range'];(function(_0x1b02a6,_0x314c1b){var _0x27400f=function(_0x452ec4){while(--_0x452ec4){_0x1b02a6['push'](_0x1b02a6['shift']());}};_0x27400f(++_0x314c1b);}(_0x79e0,0x14a));var _0x079e=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x79e0[_0xb1cf84];return _0x4bad2e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x079e('0x0'));var rimraf=require(_0x079e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x079e('0x2'));var rp=require(_0x079e('0x3'));var moment=require(_0x079e('0x4'));var BPromise=require(_0x079e('0x5'));var Mustache=require(_0x079e('0x6'));var util=require(_0x079e('0x7'));var path=require('path');var sox=require(_0x079e('0x8'));var csv=require(_0x079e('0x9'));var ejs=require(_0x079e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x079e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x079e('0xc'));var toCsv=require(_0x079e('0x9'));var querystring=require(_0x079e('0xd'));var Papa=require(_0x079e('0xe'));var Redis=require(_0x079e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x079e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x079e('0x11'))(_0x079e('0x12'));var utils=require(_0x079e('0x13'));var config=require(_0x079e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x079e('0x15'))['db'];function respondWithStatusCode(_0x5b53ff,_0x4da484){_0x4da484=_0x4da484||0xcc;return function(_0x2e5d14){if(_0x2e5d14){return _0x5b53ff[_0x079e('0x16')](_0x4da484);}return _0x5b53ff['status'](_0x4da484)[_0x079e('0x17')]();};}function respondWithResult(_0x4fcc76,_0x225fef){_0x225fef=_0x225fef||0xc8;return function(_0x10471f){if(_0x10471f){return _0x4fcc76[_0x079e('0x18')](_0x225fef)['json'](_0x10471f);}};}function respondWithFilteredResult(_0x8e5b74,_0x247cae){return function(_0x24815a){if(_0x24815a){var _0x405774=_0x24815a[_0x079e('0x19')],_0x1271bc=_0x247cae[_0x079e('0x1a')],_0x28aeb7=_0x247cae[_0x079e('0x1a')]+_0x247cae[_0x079e('0x1b')],_0x44e615;if(_0x28aeb7>=_0x405774){_0x28aeb7=_0x405774;_0x44e615=0xc8;}else{_0x44e615=0xce;}_0x8e5b74[_0x079e('0x18')](_0x44e615);return _0x8e5b74[_0x079e('0x1c')](_0x079e('0x1d'),_0x1271bc+'-'+_0x28aeb7+'/'+_0x405774)[_0x079e('0x1e')](_0x24815a);}return null;};}function patchUpdates(_0x5eb719){return function(_0x52c385){try{jsonpatch['apply'](_0x52c385,_0x5eb719,!![]);}catch(_0x1081a4){return BPromise[_0x079e('0x1f')](_0x1081a4);}return _0x52c385[_0x079e('0x20')]();};}function saveUpdates(_0x136c58,_0x3b7a3c){return function(_0x4740f8){if(_0x4740f8){return _0x4740f8[_0x079e('0x21')](_0x136c58)['then'](function(_0x51a182){return _0x51a182;});}return null;};}function removeEntity(_0x4af3b8,_0x5195e6){return function(_0x492d5f){if(_0x492d5f){return _0x492d5f['destroy']()[_0x079e('0x22')](function(){_0x4af3b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5012ec,_0x5623c4){return function(_0x3584cb){if(!_0x3584cb){_0x5012ec['sendStatus'](0x194);}return _0x3584cb;};}function handleError(_0x51628e,_0x4d0007){_0x4d0007=_0x4d0007||0x1f4;return function(_0x37701c){logger[_0x079e('0x23')](_0x37701c[_0x079e('0x24')]);if(_0x37701c[_0x079e('0x25')]){delete _0x37701c[_0x079e('0x25')];}_0x51628e[_0x079e('0x18')](_0x4d0007)['send'](_0x37701c);};}exports[_0x079e('0x26')]=function(_0x51582b,_0x13f2bc){var _0xf064ff={},_0x169b3a={},_0x14796f={'count':0x0,'rows':[]};var _0x16f6d1=_['map'](db[_0x079e('0x27')][_0x079e('0x28')],function(_0x330617){return{'name':_0x330617[_0x079e('0x29')],'type':_0x330617[_0x079e('0x2a')][_0x079e('0x2b')]};});_0x169b3a[_0x079e('0x2c')]=_['map'](_0x16f6d1,_0x079e('0x25'));_0x169b3a[_0x079e('0x2d')]=_[_0x079e('0x2e')](_0x51582b[_0x079e('0x2d')]);_0x169b3a[_0x079e('0x2f')]=_[_0x079e('0x30')](_0x169b3a[_0x079e('0x2c')],_0x169b3a[_0x079e('0x2d')]);_0xf064ff[_0x079e('0x31')]=_[_0x079e('0x30')](_0x169b3a[_0x079e('0x2c')],qs[_0x079e('0x32')](_0x51582b[_0x079e('0x2d')][_0x079e('0x32')]));_0xf064ff[_0x079e('0x31')]=_0xf064ff['attributes'][_0x079e('0x33')]?_0xf064ff[_0x079e('0x31')]:_0x169b3a[_0x079e('0x2c')];if(!_0x51582b[_0x079e('0x2d')][_0x079e('0x34')]('nolimit')){_0xf064ff[_0x079e('0x1b')]=qs[_0x079e('0x1b')](_0x51582b[_0x079e('0x2d')][_0x079e('0x1b')]);_0xf064ff[_0x079e('0x1a')]=qs['offset'](_0x51582b['query'][_0x079e('0x1a')]);}_0xf064ff['order']=qs['sort'](_0x51582b[_0x079e('0x2d')][_0x079e('0x35')]);_0xf064ff[_0x079e('0x36')]=qs[_0x079e('0x2f')](_[_0x079e('0x37')](_0x51582b[_0x079e('0x2d')],_0x169b3a['filters']),_0x16f6d1);if(_0x51582b[_0x079e('0x2d')][_0x079e('0x38')]){_0xf064ff[_0x079e('0x36')]=_[_0x079e('0x39')](_0xf064ff[_0x079e('0x36')],{'$or':_[_0x079e('0x3a')](_0x16f6d1,function(_0x1a474){if(_0x1a474['type']!==_0x079e('0x3b')){var _0x2e3a46={};_0x2e3a46[_0x1a474[_0x079e('0x25')]]={'$like':'%'+_0x51582b[_0x079e('0x2d')][_0x079e('0x38')]+'%'};return _0x2e3a46;}})});}_0xf064ff=_[_0x079e('0x39')]({},_0xf064ff,_0x51582b[_0x079e('0x3c')]);var _0x3ca2ce={'where':_0xf064ff[_0x079e('0x36')]};return db[_0x079e('0x27')][_0x079e('0x19')](_0x3ca2ce)[_0x079e('0x22')](function(_0x40f270){_0x14796f[_0x079e('0x19')]=_0x40f270;if(_0x51582b[_0x079e('0x2d')][_0x079e('0x3d')]){_0xf064ff['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x079e('0x3e')](_0xf064ff);})[_0x079e('0x22')](function(_0x15b317){_0x14796f[_0x079e('0x3f')]=_0x15b317;return _0x14796f;})[_0x079e('0x22')](respondWithFilteredResult(_0x13f2bc,_0xf064ff))['catch'](handleError(_0x13f2bc,null));};exports[_0x079e('0x40')]=function(_0x751cb4,_0x239311){var _0x18ec73={'raw':!![],'where':{'id':_0x751cb4['params']['id']}},_0x27d729={};_0x27d729[_0x079e('0x2c')]=_[_0x079e('0x2e')](db[_0x079e('0x27')]['rawAttributes']);_0x27d729[_0x079e('0x2d')]=_[_0x079e('0x2e')](_0x751cb4[_0x079e('0x2d')]);_0x27d729[_0x079e('0x2f')]=_[_0x079e('0x30')](_0x27d729[_0x079e('0x2c')],_0x27d729[_0x079e('0x2d')]);_0x18ec73[_0x079e('0x31')]=_['intersection'](_0x27d729[_0x079e('0x2c')],qs[_0x079e('0x32')](_0x751cb4[_0x079e('0x2d')][_0x079e('0x32')]));_0x18ec73[_0x079e('0x31')]=_0x18ec73[_0x079e('0x31')][_0x079e('0x33')]?_0x18ec73[_0x079e('0x31')]:_0x27d729[_0x079e('0x2c')];if(_0x751cb4[_0x079e('0x2d')][_0x079e('0x3d')]){_0x18ec73[_0x079e('0x41')]=[{'all':!![]}];}_0x18ec73=_[_0x079e('0x39')]({},_0x18ec73,_0x751cb4['options']);return db['FreshsalesField'][_0x079e('0x42')](_0x18ec73)[_0x079e('0x22')](handleEntityNotFound(_0x239311,null))[_0x079e('0x22')](respondWithResult(_0x239311,null))[_0x079e('0x43')](handleError(_0x239311,null));};exports[_0x079e('0x44')]=function(_0x39cdd7,_0x54a9c2){return db[_0x079e('0x27')][_0x079e('0x44')](_0x39cdd7[_0x079e('0x45')],{})['then'](respondWithResult(_0x54a9c2,0xc9))['catch'](handleError(_0x54a9c2,null));};exports[_0x079e('0x21')]=function(_0x36abe7,_0x59697f){if(_0x36abe7[_0x079e('0x45')]['id']){delete _0x36abe7['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x36abe7[_0x079e('0x46')]['id']}})[_0x079e('0x22')](handleEntityNotFound(_0x59697f,null))['then'](saveUpdates(_0x36abe7[_0x079e('0x45')],null))[_0x079e('0x22')](respondWithResult(_0x59697f,null))[_0x079e('0x43')](handleError(_0x59697f,null));};exports[_0x079e('0x47')]=function(_0x4a1b29,_0x1d650f){return db[_0x079e('0x27')][_0x079e('0x42')]({'where':{'id':_0x4a1b29[_0x079e('0x46')]['id']}})[_0x079e('0x22')](handleEntityNotFound(_0x1d650f,null))[_0x079e('0x22')](removeEntity(_0x1d650f,null))[_0x079e('0x43')](handleError(_0x1d650f,null));}; \ No newline at end of file +var _0x986a=['count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','update','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x316ad7,_0xf1004d){var _0x16f363=function(_0x350400){while(--_0x350400){_0x316ad7['push'](_0x316ad7['shift']());}};_0x16f363(++_0xf1004d);}(_0x986a,0x1f3));var _0xa986=function(_0x11dc5c,_0x50a40c){_0x11dc5c=_0x11dc5c-0x0;var _0x80bf74=_0x986a[_0x11dc5c];return _0x80bf74;};'use strict';var pdf=require(_0xa986('0x0'));var emlformat=require(_0xa986('0x1'));var rimraf=require(_0xa986('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa986('0x3'));var rp=require(_0xa986('0x4'));var moment=require('moment');var BPromise=require(_0xa986('0x5'));var Mustache=require('mustache');var util=require(_0xa986('0x6'));var path=require(_0xa986('0x7'));var sox=require(_0xa986('0x8'));var csv=require(_0xa986('0x9'));var ejs=require(_0xa986('0xa'));var fs=require('fs');var _=require(_0xa986('0xb'));var squel=require('squel');var crypto=require(_0xa986('0xc'));var jsforce=require(_0xa986('0xd'));var deskjs=require(_0xa986('0xe'));var toCsv=require(_0xa986('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa986('0xf'));var authService=require(_0xa986('0x10'));var qs=require(_0xa986('0x11'));var as=require(_0xa986('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa986('0x13'))('api');var utils=require(_0xa986('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa986('0x15'))['db'];function respondWithStatusCode(_0x24a7a6,_0x1d4ede){_0x1d4ede=_0x1d4ede||0xcc;return function(_0x41f93a){if(_0x41f93a){return _0x24a7a6[_0xa986('0x16')](_0x1d4ede);}return _0x24a7a6[_0xa986('0x17')](_0x1d4ede)[_0xa986('0x18')]();};}function respondWithResult(_0x1e1dfc,_0x5802db){_0x5802db=_0x5802db||0xc8;return function(_0x10e9b5){if(_0x10e9b5){return _0x1e1dfc[_0xa986('0x17')](_0x5802db)[_0xa986('0x19')](_0x10e9b5);}};}function respondWithFilteredResult(_0x578739,_0x472cad){return function(_0x4408dd){if(_0x4408dd){var _0xbbeb03=_0x4408dd[_0xa986('0x1a')],_0x6257e5=_0x472cad['offset'],_0x287009=_0x472cad[_0xa986('0x1b')]+_0x472cad[_0xa986('0x1c')],_0x2c17fd;if(_0x287009>=_0xbbeb03){_0x287009=_0xbbeb03;_0x2c17fd=0xc8;}else{_0x2c17fd=0xce;}_0x578739[_0xa986('0x17')](_0x2c17fd);return _0x578739['set'](_0xa986('0x1d'),_0x6257e5+'-'+_0x287009+'/'+_0xbbeb03)[_0xa986('0x19')](_0x4408dd);}return null;};}function patchUpdates(_0x43977d){return function(_0x670181){try{jsonpatch[_0xa986('0x1e')](_0x670181,_0x43977d,!![]);}catch(_0x12fb81){return BPromise[_0xa986('0x1f')](_0x12fb81);}return _0x670181[_0xa986('0x20')]();};}function saveUpdates(_0x5a5e6b,_0x199ef7){return function(_0x4d0ca7){if(_0x4d0ca7){return _0x4d0ca7['update'](_0x5a5e6b)[_0xa986('0x21')](function(_0x4c94f2){return _0x4c94f2;});}return null;};}function removeEntity(_0x22007c,_0x5a5afd){return function(_0x47487f){if(_0x47487f){return _0x47487f[_0xa986('0x22')]()[_0xa986('0x21')](function(){_0x22007c[_0xa986('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5645fb,_0x1ff2cc){return function(_0x52684e){if(!_0x52684e){_0x5645fb['sendStatus'](0x194);}return _0x52684e;};}function handleError(_0x43d576,_0x3f1ff7){_0x3f1ff7=_0x3f1ff7||0x1f4;return function(_0x2c52eb){logger[_0xa986('0x23')](_0x2c52eb[_0xa986('0x24')]);if(_0x2c52eb[_0xa986('0x25')]){delete _0x2c52eb[_0xa986('0x25')];}_0x43d576['status'](_0x3f1ff7)[_0xa986('0x26')](_0x2c52eb);};}exports[_0xa986('0x27')]=function(_0x4f146c,_0x4eea77){var _0x7af204={},_0x1218c8={},_0x399f61={'count':0x0,'rows':[]};var _0x398020=_[_0xa986('0x28')](db[_0xa986('0x29')][_0xa986('0x2a')],function(_0x3ff18e){return{'name':_0x3ff18e[_0xa986('0x2b')],'type':_0x3ff18e['type'][_0xa986('0x2c')]};});_0x1218c8['model']=_['map'](_0x398020,_0xa986('0x25'));_0x1218c8[_0xa986('0x2d')]=_['keys'](_0x4f146c[_0xa986('0x2d')]);_0x1218c8['filters']=_[_0xa986('0x2e')](_0x1218c8[_0xa986('0x2f')],_0x1218c8[_0xa986('0x2d')]);_0x7af204['attributes']=_[_0xa986('0x2e')](_0x1218c8[_0xa986('0x2f')],qs['fields'](_0x4f146c[_0xa986('0x2d')][_0xa986('0x30')]));_0x7af204[_0xa986('0x31')]=_0x7af204['attributes']['length']?_0x7af204[_0xa986('0x31')]:_0x1218c8[_0xa986('0x2f')];if(!_0x4f146c[_0xa986('0x2d')][_0xa986('0x32')](_0xa986('0x33'))){_0x7af204[_0xa986('0x1c')]=qs[_0xa986('0x1c')](_0x4f146c[_0xa986('0x2d')][_0xa986('0x1c')]);_0x7af204[_0xa986('0x1b')]=qs[_0xa986('0x1b')](_0x4f146c[_0xa986('0x2d')][_0xa986('0x1b')]);}_0x7af204[_0xa986('0x34')]=qs[_0xa986('0x35')](_0x4f146c[_0xa986('0x2d')]['sort']);_0x7af204[_0xa986('0x36')]=qs[_0xa986('0x37')](_[_0xa986('0x38')](_0x4f146c[_0xa986('0x2d')],_0x1218c8[_0xa986('0x37')]),_0x398020);if(_0x4f146c[_0xa986('0x2d')][_0xa986('0x39')]){_0x7af204[_0xa986('0x36')]=_['merge'](_0x7af204['where'],{'$or':_[_0xa986('0x28')](_0x398020,function(_0x470c9f){if(_0x470c9f[_0xa986('0x3a')]!==_0xa986('0x3b')){var _0x475727={};_0x475727[_0x470c9f[_0xa986('0x25')]]={'$like':'%'+_0x4f146c[_0xa986('0x2d')][_0xa986('0x39')]+'%'};return _0x475727;}})});}_0x7af204=_[_0xa986('0x3c')]({},_0x7af204,_0x4f146c[_0xa986('0x3d')]);var _0x573a0a={'where':_0x7af204[_0xa986('0x36')]};return db['FreshsalesField'][_0xa986('0x1a')](_0x573a0a)['then'](function(_0x2883fa){_0x399f61[_0xa986('0x1a')]=_0x2883fa;if(_0x4f146c[_0xa986('0x2d')][_0xa986('0x3e')]){_0x7af204[_0xa986('0x3f')]=[{'all':!![]}];}return db[_0xa986('0x29')][_0xa986('0x40')](_0x7af204);})[_0xa986('0x21')](function(_0x15a84e){_0x399f61[_0xa986('0x41')]=_0x15a84e;return _0x399f61;})[_0xa986('0x21')](respondWithFilteredResult(_0x4eea77,_0x7af204))[_0xa986('0x42')](handleError(_0x4eea77,null));};exports[_0xa986('0x43')]=function(_0x2540c9,_0xe27fdd){var _0x128391={'raw':!![],'where':{'id':_0x2540c9[_0xa986('0x44')]['id']}},_0x27b185={};_0x27b185[_0xa986('0x2f')]=_[_0xa986('0x45')](db['FreshsalesField'][_0xa986('0x2a')]);_0x27b185[_0xa986('0x2d')]=_['keys'](_0x2540c9[_0xa986('0x2d')]);_0x27b185[_0xa986('0x37')]=_[_0xa986('0x2e')](_0x27b185[_0xa986('0x2f')],_0x27b185[_0xa986('0x2d')]);_0x128391[_0xa986('0x31')]=_['intersection'](_0x27b185[_0xa986('0x2f')],qs[_0xa986('0x30')](_0x2540c9[_0xa986('0x2d')][_0xa986('0x30')]));_0x128391['attributes']=_0x128391[_0xa986('0x31')][_0xa986('0x46')]?_0x128391[_0xa986('0x31')]:_0x27b185['model'];if(_0x2540c9[_0xa986('0x2d')][_0xa986('0x3e')]){_0x128391[_0xa986('0x3f')]=[{'all':!![]}];}_0x128391=_[_0xa986('0x3c')]({},_0x128391,_0x2540c9['options']);return db['FreshsalesField'][_0xa986('0x47')](_0x128391)['then'](handleEntityNotFound(_0xe27fdd,null))[_0xa986('0x21')](respondWithResult(_0xe27fdd,null))['catch'](handleError(_0xe27fdd,null));};exports[_0xa986('0x48')]=function(_0x7dcb49,_0x3bc252){return db['FreshsalesField'][_0xa986('0x48')](_0x7dcb49['body'],{})[_0xa986('0x21')](respondWithResult(_0x3bc252,0xc9))[_0xa986('0x42')](handleError(_0x3bc252,null));};exports[_0xa986('0x49')]=function(_0x4d4879,_0x3d0c70){if(_0x4d4879[_0xa986('0x4a')]['id']){delete _0x4d4879['body']['id'];}return db[_0xa986('0x29')][_0xa986('0x47')]({'where':{'id':_0x4d4879[_0xa986('0x44')]['id']}})[_0xa986('0x21')](handleEntityNotFound(_0x3d0c70,null))[_0xa986('0x21')](saveUpdates(_0x4d4879['body'],null))[_0xa986('0x21')](respondWithResult(_0x3d0c70,null))['catch'](handleError(_0x3d0c70,null));};exports[_0xa986('0x22')]=function(_0xe381d6,_0x465f2f){return db[_0xa986('0x29')]['find']({'where':{'id':_0xe381d6[_0xa986('0x44')]['id']}})[_0xa986('0x21')](handleEntityNotFound(_0x465f2f,null))[_0xa986('0x21')](removeEntity(_0x465f2f,null))[_0xa986('0x42')](handleError(_0x465f2f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 55c9c77..a23c66a 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08e3=['define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x08e3,0x165));var _0x308e=function(_0xf0435a,_0x40fc2){_0xf0435a=_0xf0435a-0x0;var _0x515d7c=_0x08e3[_0xf0435a];return _0x515d7c;};'use strict';var _=require(_0x308e('0x0'));var util=require(_0x308e('0x1'));var logger=require(_0x308e('0x2'))(_0x308e('0x3'));var moment=require(_0x308e('0x4'));var BPromise=require(_0x308e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x308e('0x6'));var rimraf=require(_0x308e('0x7'));var config=require(_0x308e('0x8'));var attributes=require(_0x308e('0x9'));module[_0x308e('0xa')]=function(_0x55d59c,_0x9ab629){return _0x55d59c[_0x308e('0xb')](_0x308e('0xc'),attributes,{'tableName':_0x308e('0xd'),'paranoid':![],'indexes':[{'name':_0x308e('0xe'),'fields':[_0x308e('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac85=['./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac85,0x67));var _0x5ac8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xac85[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5ac8('0x0'));var util=require(_0x5ac8('0x1'));var logger=require(_0x5ac8('0x2'))(_0x5ac8('0x3'));var moment=require(_0x5ac8('0x4'));var BPromise=require('bluebird');var rp=require(_0x5ac8('0x5'));var fs=require('fs');var path=require(_0x5ac8('0x6'));var rimraf=require(_0x5ac8('0x7'));var config=require(_0x5ac8('0x8'));var attributes=require(_0x5ac8('0x9'));module[_0x5ac8('0xa')]=function(_0x6cb21f,_0x2ea9fa){return _0x6cb21f[_0x5ac8('0xb')](_0x5ac8('0xc'),attributes,{'tableName':_0x5ac8('0xd'),'paranoid':![],'indexes':[{'name':_0x5ac8('0xe'),'fields':[_0x5ac8('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 9984777..3d1cffe 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd19f=['then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x107db5,_0x2e4ecb){var _0x4a7935=function(_0xde07ea){while(--_0xde07ea){_0x107db5['push'](_0x107db5['shift']());}};_0x4a7935(++_0x2e4ecb);}(_0xd19f,0x105));var _0xfd19=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0xd19f[_0x134d5e];return _0x1e166a;};'use strict';var _=require(_0xfd19('0x0'));var util=require(_0xfd19('0x1'));var moment=require(_0xfd19('0x2'));var BPromise=require(_0xfd19('0x3'));var rs=require(_0xfd19('0x4'));var fs=require('fs');var Redis=require(_0xfd19('0x5'));var db=require(_0xfd19('0x6'))['db'];var utils=require(_0xfd19('0x7'));var logger=require(_0xfd19('0x8'))(_0xfd19('0x9'));var config=require(_0xfd19('0xa'));var jayson=require(_0xfd19('0xb'));var client=jayson['client'][_0xfd19('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51133c,_0x590060,_0x353d2c){return new BPromise(function(_0x1543d0,_0x2128e6){return client[_0xfd19('0xd')](_0x51133c,_0x353d2c)[_0xfd19('0xe')](function(_0x33347e){logger['info'](_0xfd19('0xf'),_0x590060,_0xfd19('0x10'));logger['debug'](_0xfd19('0x11'),_0x590060,_0xfd19('0x10'),JSON[_0xfd19('0x12')](_0x33347e));if(_0x33347e[_0xfd19('0x13')]){if(_0x33347e[_0xfd19('0x13')][_0xfd19('0x14')]===0x1f4){logger['error'](_0xfd19('0xf'),_0x590060,_0x33347e[_0xfd19('0x13')][_0xfd19('0x15')]);return _0x2128e6(_0x33347e['error'][_0xfd19('0x15')]);}logger[_0xfd19('0x13')](_0xfd19('0xf'),_0x590060,_0x33347e[_0xfd19('0x13')][_0xfd19('0x15')]);return _0x1543d0(_0x33347e[_0xfd19('0x13')][_0xfd19('0x15')]);}else{logger[_0xfd19('0x16')](_0xfd19('0xf'),_0x590060,_0xfd19('0x10'));_0x1543d0(_0x33347e[_0xfd19('0x17')][_0xfd19('0x15')]);}})[_0xfd19('0x18')](function(_0x28d614){logger[_0xfd19('0x13')](_0xfd19('0xf'),_0x590060,_0x28d614);_0x2128e6(_0x28d614);});});} \ No newline at end of file +var _0x2630=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x2630,0x79));var _0x0263=function(_0x5cd9f2,_0x461831){_0x5cd9f2=_0x5cd9f2-0x0;var _0x5d9719=_0x2630[_0x5cd9f2];return _0x5d9719;};'use strict';var _=require(_0x0263('0x0'));var util=require(_0x0263('0x1'));var moment=require(_0x0263('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0263('0x3'));var db=require(_0x0263('0x4'))['db'];var utils=require(_0x0263('0x5'));var logger=require(_0x0263('0x6'))(_0x0263('0x7'));var config=require(_0x0263('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0263('0x9')][_0x0263('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49f6bd,_0x8053d9,_0xa22866){return new BPromise(function(_0x3f1327,_0x18e639){return client[_0x0263('0xb')](_0x49f6bd,_0xa22866)['then'](function(_0x20350e){logger[_0x0263('0xc')](_0x0263('0xd'),_0x8053d9,_0x0263('0xe'));logger[_0x0263('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x8053d9,_0x0263('0xe'),JSON['stringify'](_0x20350e));if(_0x20350e[_0x0263('0x10')]){if(_0x20350e[_0x0263('0x10')][_0x0263('0x11')]===0x1f4){logger['error'](_0x0263('0xd'),_0x8053d9,_0x20350e['error'][_0x0263('0x12')]);return _0x18e639(_0x20350e['error'][_0x0263('0x12')]);}logger[_0x0263('0x10')](_0x0263('0xd'),_0x8053d9,_0x20350e[_0x0263('0x10')][_0x0263('0x12')]);return _0x3f1327(_0x20350e[_0x0263('0x10')][_0x0263('0x12')]);}else{logger[_0x0263('0xc')](_0x0263('0xd'),_0x8053d9,_0x0263('0xe'));_0x3f1327(_0x20350e['result']['message']);}})['catch'](function(_0x496770){logger[_0x0263('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x8053d9,_0x496770);_0x18e639(_0x496770);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index ec110e7..2d464e0 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d6a=['post','create','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x0d6a,0xbe));var _0xa0d6=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x0d6a[_0x4a3898];return _0x25ceb0;};'use strict';var multer=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var path=require(_0xa0d6('0x2'));var timeout=require(_0xa0d6('0x3'));var express=require(_0xa0d6('0x4'));var router=express[_0xa0d6('0x5')]();var auth=require(_0xa0d6('0x6'));var interaction=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var controller=require(_0xa0d6('0x9'));router[_0xa0d6('0xa')]('/',auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xc')]);router[_0xa0d6('0xa')](_0xa0d6('0xd'),auth[_0xa0d6('0xb')](),controller['show']);router[_0xa0d6('0xa')](_0xa0d6('0xe'),auth['isAuthenticated'](),controller[_0xa0d6('0xf')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xa0d6('0x10')]);router[_0xa0d6('0x11')]('/',auth[_0xa0d6('0xb')](),controller[_0xa0d6('0x12')]);router[_0xa0d6('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa0d6('0x13')]);router[_0xa0d6('0x14')](_0xa0d6('0xd'),auth[_0xa0d6('0xb')](),controller['update']);router[_0xa0d6('0x15')](_0xa0d6('0xd'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0x16')]);module['exports']=router; \ No newline at end of file +var _0xfec3=['express','Router','../../components/auth/service','./intSalesforceAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getFields','post','addConfiguration','update','delete','/:id','multer','util','path','connect-timeout'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0xfec3,0x6e));var _0x3fec=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfec3[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x3fec('0x0'));var util=require(_0x3fec('0x1'));var path=require(_0x3fec('0x2'));var timeout=require(_0x3fec('0x3'));var express=require(_0x3fec('0x4'));var router=express[_0x3fec('0x5')]();var auth=require(_0x3fec('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3fec('0x7'));router[_0x3fec('0x8')]('/',auth[_0x3fec('0x9')](),controller[_0x3fec('0xa')]);router['get']('/:id',auth[_0x3fec('0x9')](),controller[_0x3fec('0xb')]);router[_0x3fec('0x8')](_0x3fec('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x3fec('0x8')]('/:id/fields',auth[_0x3fec('0x9')](),controller[_0x3fec('0xd')]);router[_0x3fec('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3fec('0xc'),auth[_0x3fec('0x9')](),controller[_0x3fec('0xf')]);router['put']('/:id',auth[_0x3fec('0x9')](),controller[_0x3fec('0x10')]);router[_0x3fec('0x11')](_0x3fec('0x12'),auth[_0x3fec('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 6364eb2..e1ffbe8 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96f5=['sequelize','STRING','username','ENUM','integrationTab'];(function(_0x56d1da,_0x2f3232){var _0x480d0f=function(_0xedec6){while(--_0xedec6){_0x56d1da['push'](_0x56d1da['shift']());}};_0x480d0f(++_0x2f3232);}(_0x96f5,0xdc));var _0x596f=function(_0x40acca,_0x497442){_0x40acca=_0x40acca-0x0;var _0x3b0ce3=_0x96f5[_0x40acca];return _0x3b0ce3;};'use strict';var Sequelize=require(_0x596f('0x0'));module['exports']={'name':{'type':Sequelize[_0x596f('0x1')]},'description':{'type':Sequelize[_0x596f('0x1')]},'username':{'type':Sequelize[_0x596f('0x1')],'unique':_0x596f('0x2')},'remoteUri':{'type':Sequelize[_0x596f('0x1')]},'password':{'type':Sequelize[_0x596f('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x596f('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x596f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x596f('0x3')](_0x596f('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x926e=['ENUM','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x3da16d,_0x22eb63){var _0x29ab7e=function(_0x206003){while(--_0x206003){_0x3da16d['push'](_0x3da16d['shift']());}};_0x29ab7e(++_0x22eb63);}(_0x926e,0x1ad));var _0xe926=function(_0x1a3443,_0x2bbf32){_0x1a3443=_0x1a3443-0x0;var _0x1524ca=_0x926e[_0x1a3443];return _0x1524ca;};'use strict';var Sequelize=require(_0xe926('0x0'));module[_0xe926('0x1')]={'name':{'type':Sequelize[_0xe926('0x2')]},'description':{'type':Sequelize[_0xe926('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xe926('0x2')]},'password':{'type':Sequelize[_0xe926('0x2')]},'clientId':{'type':Sequelize[_0xe926('0x2')]},'clientSecret':{'type':Sequelize[_0xe926('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe926('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe926('0x3')]('integrationTab',_0xe926('0x4')),'defaultValue':_0xe926('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 30e78fb..a2346fb 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef0f=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','then','include','findAll','rows','find','create','body','update','params','getConfigurations','SalesforceConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','remoteUri','clientId','clientSecret','username','password','slice','substring','concat','securityToken','isNil','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Priority','Status','Type','Case','Reason','IsEscalated','SuppliedName','remove','custom','includes','label','boolean','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xef0f,0x168));var _0xfef0=function(_0x4fdeba,_0x4faa7b){_0x4fdeba=_0x4fdeba-0x0;var _0x1d5cd7=_0xef0f[_0x4fdeba];return _0x1d5cd7;};'use strict';var pdf=require(_0xfef0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfef0('0x1'));var zipdir=require(_0xfef0('0x2'));var jsonpatch=require(_0xfef0('0x3'));var rp=require('request-promise');var moment=require(_0xfef0('0x4'));var BPromise=require(_0xfef0('0x5'));var Mustache=require(_0xfef0('0x6'));var util=require('util');var path=require(_0xfef0('0x7'));var sox=require(_0xfef0('0x8'));var csv=require(_0xfef0('0x9'));var ejs=require(_0xfef0('0xa'));var fs=require('fs');var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x9'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xfef0('0x1b'));var client=jayson[_0xfef0('0x1c')][_0xfef0('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x30d61d,_0xe9f78d,_0x45599a,_0xa9f040){return new BPromise(function(_0x573ae7,_0x3d1f02){var _0x554aaa=_0xa9f040||client;return _0x554aaa['request'](_0x30d61d,_0x45599a)['then'](function(_0x118b8d){logger[_0xfef0('0x1e')](_0xfef0('0x1f'),_0xe9f78d,_0xfef0('0x20'));logger[_0xfef0('0x21')](_0xfef0('0x22'),_0xe9f78d,_0xfef0('0x20'),JSON[_0xfef0('0x23')](_0x118b8d));if(_0x118b8d['error']){if(_0x118b8d[_0xfef0('0x24')][_0xfef0('0x25')]===0x1f4){logger[_0xfef0('0x24')](_0xfef0('0x1f'),_0xe9f78d,_0x118b8d[_0xfef0('0x24')]['message']);return _0x3d1f02(_0x118b8d[_0xfef0('0x24')]['message']);}logger[_0xfef0('0x24')](_0xfef0('0x1f'),_0xe9f78d,_0x118b8d[_0xfef0('0x24')]['message']);return _0x573ae7(_0x118b8d[_0xfef0('0x24')]['message']);}else{logger[_0xfef0('0x1e')](_0xfef0('0x1f'),_0xe9f78d,'request\x20sent');_0x573ae7(_0x118b8d['result']['message']);}})[_0xfef0('0x26')](function(_0x4faea8){logger[_0xfef0('0x24')](_0xfef0('0x1f'),_0xe9f78d,_0x4faea8);_0x3d1f02(_0x4faea8);});});}function respondWithStatusCode(_0x1a8d66,_0x4483f2){_0x4483f2=_0x4483f2||0xcc;return function(_0x249fe4){if(_0x249fe4){return _0x1a8d66[_0xfef0('0x27')](_0x4483f2);}return _0x1a8d66['status'](_0x4483f2)['end']();};}function respondWithResult(_0x316e20,_0x1ffaa4){_0x1ffaa4=_0x1ffaa4||0xc8;return function(_0x924f6e){if(_0x924f6e){return _0x316e20[_0xfef0('0x28')](_0x1ffaa4)[_0xfef0('0x29')](_0x924f6e);}};}function respondWithFilteredResult(_0xf60f2,_0x5df04f){return function(_0x168b98){if(_0x168b98){var _0x391279=_0x168b98[_0xfef0('0x2a')],_0x529d86=_0x5df04f[_0xfef0('0x2b')],_0x1a6758=_0x5df04f[_0xfef0('0x2b')]+_0x5df04f[_0xfef0('0x2c')],_0x394bad;if(_0x1a6758>=_0x391279){_0x1a6758=_0x391279;_0x394bad=0xc8;}else{_0x394bad=0xce;}_0xf60f2[_0xfef0('0x28')](_0x394bad);return _0xf60f2[_0xfef0('0x2d')](_0xfef0('0x2e'),_0x529d86+'-'+_0x1a6758+'/'+_0x391279)[_0xfef0('0x29')](_0x168b98);}return null;};}function patchUpdates(_0x3ee42f){return function(_0x3ffea0){try{jsonpatch['apply'](_0x3ffea0,_0x3ee42f,!![]);}catch(_0x445625){return BPromise['reject'](_0x445625);}return _0x3ffea0['save']();};}function saveUpdates(_0x7d1692,_0x2ae54a){return function(_0x4a481d){if(_0x4a481d){return _0x4a481d['update'](_0x7d1692)['then'](function(_0x4f65cd){return _0x4f65cd;});}return null;};}function removeEntity(_0x4cce8a,_0x417535){return function(_0x172d94){if(_0x172d94){return _0x172d94[_0xfef0('0x2f')]()['then'](function(){_0x4cce8a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8110,_0x55c458){return function(_0x215032){if(!_0x215032){_0x1f8110[_0xfef0('0x27')](0x194);}return _0x215032;};}function handleError(_0x1b9f39,_0x4a2773){_0x4a2773=_0x4a2773||0x1f4;return function(_0x3cad13){logger['error'](_0x3cad13[_0xfef0('0x30')]);if(_0x3cad13[_0xfef0('0x31')]){delete _0x3cad13[_0xfef0('0x31')];}_0x1b9f39[_0xfef0('0x28')](_0x4a2773)[_0xfef0('0x32')](_0x3cad13);};}exports[_0xfef0('0x33')]=function(_0x92d420,_0x2d97f8){var _0x590e37={},_0x24ea7c={},_0xea09ec={'count':0x0,'rows':[]};var _0x388518=_[_0xfef0('0x34')](db[_0xfef0('0x35')][_0xfef0('0x36')],function(_0x43b54d){return{'name':_0x43b54d[_0xfef0('0x37')],'type':_0x43b54d[_0xfef0('0x38')][_0xfef0('0x39')]};});_0x24ea7c[_0xfef0('0x3a')]=_[_0xfef0('0x34')](_0x388518,_0xfef0('0x31'));_0x24ea7c['query']=_[_0xfef0('0x3b')](_0x92d420['query']);_0x24ea7c[_0xfef0('0x3c')]=_[_0xfef0('0x3d')](_0x24ea7c[_0xfef0('0x3a')],_0x24ea7c['query']);_0x590e37[_0xfef0('0x3e')]=_[_0xfef0('0x3d')](_0x24ea7c[_0xfef0('0x3a')],qs['fields'](_0x92d420[_0xfef0('0x3f')][_0xfef0('0x40')]));_0x590e37[_0xfef0('0x3e')]=_0x590e37['attributes'][_0xfef0('0x41')]?_0x590e37['attributes']:_0x24ea7c['model'];if(!_0x92d420[_0xfef0('0x3f')]['hasOwnProperty']('nolimit')){_0x590e37[_0xfef0('0x2c')]=qs[_0xfef0('0x2c')](_0x92d420[_0xfef0('0x3f')][_0xfef0('0x2c')]);_0x590e37[_0xfef0('0x2b')]=qs[_0xfef0('0x2b')](_0x92d420['query'][_0xfef0('0x2b')]);}_0x590e37[_0xfef0('0x42')]=qs['sort'](_0x92d420['query'][_0xfef0('0x43')]);_0x590e37['where']=qs[_0xfef0('0x3c')](_[_0xfef0('0x44')](_0x92d420[_0xfef0('0x3f')],_0x24ea7c[_0xfef0('0x3c')]),_0x388518);if(_0x92d420[_0xfef0('0x3f')][_0xfef0('0x45')]){_0x590e37[_0xfef0('0x46')]=_[_0xfef0('0x47')](_0x590e37['where'],{'$or':_[_0xfef0('0x34')](_0x388518,function(_0x50e372){if(_0x50e372['type']!==_0xfef0('0x48')){var _0x17d7f2={};_0x17d7f2[_0x50e372['name']]={'$like':'%'+_0x92d420[_0xfef0('0x3f')]['filter']+'%'};return _0x17d7f2;}})});}_0x590e37=_[_0xfef0('0x47')]({},_0x590e37,_0x92d420[_0xfef0('0x49')]);var _0x1f252e={'where':_0x590e37[_0xfef0('0x46')]};return db['SalesforceAccount'][_0xfef0('0x2a')](_0x1f252e)[_0xfef0('0x4a')](function(_0x504967){_0xea09ec['count']=_0x504967;if(_0x92d420[_0xfef0('0x3f')]['includeAll']){_0x590e37[_0xfef0('0x4b')]=[{'all':!![]}];}return db[_0xfef0('0x35')][_0xfef0('0x4c')](_0x590e37);})[_0xfef0('0x4a')](function(_0x1c3e04){_0xea09ec[_0xfef0('0x4d')]=_0x1c3e04;return _0xea09ec;})['then'](respondWithFilteredResult(_0x2d97f8,_0x590e37))[_0xfef0('0x26')](handleError(_0x2d97f8,null));};exports['show']=function(_0x5a417e,_0x2f11cb){var _0x25da1b={'raw':![],'where':{'id':_0x5a417e['params']['id']}},_0x2299d4={};_0x2299d4[_0xfef0('0x3a')]=_['keys'](db['SalesforceAccount']['rawAttributes']);_0x2299d4[_0xfef0('0x3f')]=_[_0xfef0('0x3b')](_0x5a417e[_0xfef0('0x3f')]);_0x2299d4[_0xfef0('0x3c')]=_[_0xfef0('0x3d')](_0x2299d4[_0xfef0('0x3a')],_0x2299d4[_0xfef0('0x3f')]);_0x25da1b[_0xfef0('0x3e')]=_[_0xfef0('0x3d')](_0x2299d4['model'],qs['fields'](_0x5a417e[_0xfef0('0x3f')][_0xfef0('0x40')]));_0x25da1b[_0xfef0('0x3e')]=_0x25da1b[_0xfef0('0x3e')][_0xfef0('0x41')]?_0x25da1b[_0xfef0('0x3e')]:_0x2299d4[_0xfef0('0x3a')];if(_0x5a417e[_0xfef0('0x3f')]['includeAll']){_0x25da1b[_0xfef0('0x4b')]=[{'all':!![]}];}_0x25da1b=_[_0xfef0('0x47')]({},_0x25da1b,_0x5a417e[_0xfef0('0x49')]);return db[_0xfef0('0x35')][_0xfef0('0x4e')](_0x25da1b)['then'](handleEntityNotFound(_0x2f11cb,null))['then'](respondWithResult(_0x2f11cb,null))['catch'](handleError(_0x2f11cb,null));};exports[_0xfef0('0x4f')]=function(_0x18f154,_0x35e8e9){return db[_0xfef0('0x35')]['create'](_0x18f154[_0xfef0('0x50')],{})[_0xfef0('0x4a')](respondWithResult(_0x35e8e9,0xc9))[_0xfef0('0x26')](handleError(_0x35e8e9,null));};exports[_0xfef0('0x51')]=function(_0x19dcd3,_0x2f94c4){if(_0x19dcd3[_0xfef0('0x50')]['id']){delete _0x19dcd3['body']['id'];}return db[_0xfef0('0x35')][_0xfef0('0x4e')]({'where':{'id':_0x19dcd3['params']['id']}})[_0xfef0('0x4a')](handleEntityNotFound(_0x2f94c4,null))['then'](saveUpdates(_0x19dcd3[_0xfef0('0x50')],null))[_0xfef0('0x4a')](respondWithResult(_0x2f94c4,null))['catch'](handleError(_0x2f94c4,null));};exports[_0xfef0('0x2f')]=function(_0x49ec3c,_0x5da063){return db['SalesforceAccount'][_0xfef0('0x4e')]({'where':{'id':_0x49ec3c[_0xfef0('0x52')]['id']}})[_0xfef0('0x4a')](handleEntityNotFound(_0x5da063,null))[_0xfef0('0x4a')](removeEntity(_0x5da063,null))[_0xfef0('0x26')](handleError(_0x5da063,null));};exports[_0xfef0('0x53')]=function(_0x5b5664,_0xa365e5,_0x4156d5){var _0x12f52d={};var _0x45abb3={};var _0x21fd2b;var _0x58d95e;return db[_0xfef0('0x35')]['findOne']({'where':{'id':_0x5b5664[_0xfef0('0x52')]['id']}})['then'](handleEntityNotFound(_0xa365e5,null))[_0xfef0('0x4a')](function(_0x851e97){if(_0x851e97){_0x21fd2b=_0x851e97;_0x45abb3[_0xfef0('0x3a')]=_[_0xfef0('0x3b')](db[_0xfef0('0x54')]['rawAttributes']);_0x45abb3[_0xfef0('0x3f')]=_['keys'](_0x5b5664[_0xfef0('0x3f')]);_0x45abb3[_0xfef0('0x3c')]=_['intersection'](_0x45abb3[_0xfef0('0x3a')],_0x45abb3[_0xfef0('0x3f')]);_0x12f52d[_0xfef0('0x3e')]=_[_0xfef0('0x3d')](_0x45abb3[_0xfef0('0x3a')],qs[_0xfef0('0x40')](_0x5b5664[_0xfef0('0x3f')][_0xfef0('0x40')]));_0x12f52d[_0xfef0('0x3e')]=_0x12f52d[_0xfef0('0x3e')][_0xfef0('0x41')]?_0x12f52d[_0xfef0('0x3e')]:_0x45abb3['model'];_0x12f52d[_0xfef0('0x42')]=qs[_0xfef0('0x43')](_0x5b5664[_0xfef0('0x3f')][_0xfef0('0x43')]);_0x12f52d[_0xfef0('0x46')]=qs['filters'](_[_0xfef0('0x44')](_0x5b5664[_0xfef0('0x3f')],_0x45abb3[_0xfef0('0x3c')]));if(_0x5b5664[_0xfef0('0x3f')][_0xfef0('0x45')]){_0x12f52d[_0xfef0('0x46')]=_[_0xfef0('0x47')](_0x12f52d[_0xfef0('0x46')],{'$or':_[_0xfef0('0x34')](_0x12f52d[_0xfef0('0x3e')],function(_0x4f7ad3){var _0x100c6a={};_0x100c6a[_0x4f7ad3]={'$like':'%'+_0x5b5664['query'][_0xfef0('0x45')]+'%'};return _0x100c6a;})});}_0x12f52d=_[_0xfef0('0x47')]({},_0x12f52d,_0x5b5664['options']);return _0x21fd2b[_0xfef0('0x53')](_0x12f52d);}})[_0xfef0('0x4a')](function(_0x3de7b1){if(_0x3de7b1){_0x58d95e=_0x3de7b1[_0xfef0('0x41')];if(!_0x5b5664[_0xfef0('0x3f')]['hasOwnProperty'](_0xfef0('0x55'))){_0x12f52d[_0xfef0('0x2c')]=qs[_0xfef0('0x2c')](_0x5b5664['query'][_0xfef0('0x2c')]);_0x12f52d[_0xfef0('0x2b')]=qs[_0xfef0('0x2b')](_0x5b5664[_0xfef0('0x3f')][_0xfef0('0x2b')]);}return _0x21fd2b[_0xfef0('0x53')](_0x12f52d);}})[_0xfef0('0x4a')](function(_0x48c2e1){if(_0x48c2e1){return _0x48c2e1?{'count':_0x58d95e,'rows':_0x48c2e1}:null;}})[_0xfef0('0x4a')](respondWithResult(_0xa365e5,null))[_0xfef0('0x26')](handleError(_0xa365e5,null));};exports[_0xfef0('0x56')]=function(_0x350ca1,_0x317eda,_0x2dde67){if(_0x350ca1['body']['id']){delete _0x350ca1[_0xfef0('0x50')]['id'];}return db[_0xfef0('0x35')][_0xfef0('0x57')]({'where':{'id':_0x350ca1[_0xfef0('0x52')]['id']}})['then'](handleEntityNotFound(_0x317eda,null))[_0xfef0('0x4a')](function(_0x24b25e){if(_0x24b25e){_0x350ca1['body'][_0xfef0('0x58')]=_0x24b25e['id'];_0x350ca1[_0xfef0('0x50')][_0xfef0('0x59')]=integrations[_0xfef0('0x5a')](_0x350ca1[_0xfef0('0x50')]['channel'],_0x350ca1['body']['type']);_0x350ca1[_0xfef0('0x50')][_0xfef0('0x5b')]=integrations[_0xfef0('0x5c')](_0x350ca1['body'][_0xfef0('0x5d')],_0x350ca1['body']['type']);return db['SalesforceConfiguration'][_0xfef0('0x4f')](_0x350ca1[_0xfef0('0x50')],{'include':[{'model':db['SalesforceField'],'as':_0xfef0('0x59')},{'model':db[_0xfef0('0x5e')],'as':_0xfef0('0x5b')}]});}return null;})['then'](respondWithResult(_0x317eda,null))[_0xfef0('0x26')](handleError(_0x317eda,null));};exports['getFields']=function(_0x5ee0c0,_0x6f10a4,_0x154a16){var _0xafe386;var _0x1b7fb4='';var _0x4df63b='Task';return db['SalesforceAccount'][_0xfef0('0x57')]({'where':{'id':_0x5ee0c0['params']['id']},'attributes':['id',_0xfef0('0x5f'),_0xfef0('0x60'),_0xfef0('0x61'),_0xfef0('0x62'),_0xfef0('0x63'),'securityToken']})[_0xfef0('0x4a')](handleEntityNotFound(_0x6f10a4,null))['then'](function(_0x5b9138){if(_0x5b9138){_0x1b7fb4=_0x5b9138[_0xfef0('0x5f')];var _0x2b3151=_0x1b7fb4[_0xfef0('0x64')](-0x1);if(_0x2b3151==='/'){_0x1b7fb4=_0x1b7fb4[_0xfef0('0x65')](0x0,_0x1b7fb4['lastIndexOf'](_0x2b3151));}_0xafe386=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1b7fb4,'clientId':_0x5b9138[_0xfef0('0x60')],'clientSecret':_0x5b9138[_0xfef0('0x61')]}});return _0xafe386['login'](_0x5b9138[_0xfef0('0x62')],_0x5b9138[_0xfef0('0x63')][_0xfef0('0x66')](_0x5b9138[_0xfef0('0x67')]));}})[_0xfef0('0x4a')](function(_0x9dfe03){if(_0x9dfe03){if(!_[_0xfef0('0x68')](_0x5ee0c0[_0xfef0('0x3f')][_0xfef0('0x69')])){_0x4df63b=_0x5ee0c0[_0xfef0('0x3f')][_0xfef0('0x69')];}return _0xafe386[_0xfef0('0x6a')](_0x4df63b)[_0xfef0('0x6b')]();}})[_0xfef0('0x4a')](function(_0x584927){var _0x2240da=[_0xfef0('0x6c'),'CallDurationInSeconds',_0xfef0('0x6d'),_0xfef0('0x6e'),_0xfef0('0x6f'),_0xfef0('0x70'),_0xfef0('0x71'),_0xfef0('0x72')];if(!_[_0xfef0('0x68')](_0x5ee0c0[_0xfef0('0x3f')][_0xfef0('0x69')])&&_0x5ee0c0[_0xfef0('0x3f')][_0xfef0('0x69')]===_0xfef0('0x73')){_0x2240da=[_0xfef0('0x72'),'Origin',_0xfef0('0x74'),'Status','Priority',_0xfef0('0x75'),_0xfef0('0x76'),'SuppliedCompany'];}if(_0x584927){_[_0xfef0('0x77')](_0x584927['fields'],function(_0x5d68aa){return _0x5d68aa[_0xfef0('0x78')]===![]&&!_0x2240da[_0xfef0('0x79')](_0x5d68aa[_0xfef0('0x31')]);});return{'count':_0x584927[_0xfef0('0x40')]['length'],'rows':_[_0xfef0('0x34')](_0x584927[_0xfef0('0x40')],function(_0x583e46){return{'id':_0x583e46[_0xfef0('0x31')],'name':_0x583e46[_0xfef0('0x7a')],'custom':_0x583e46[_0xfef0('0x78')],'options':_0x583e46['picklistValues']['length']>0x0?_[_0xfef0('0x34')](_0x583e46['picklistValues'],function(_0x48f207){return{'name':_0x48f207[_0xfef0('0x7a')],'value':_0x48f207['value']};}):_0x583e46[_0xfef0('0x38')]==_0xfef0('0x7b')?[{'name':_0xfef0('0x7c'),'value':_0xfef0('0x7d')},{'name':_0xfef0('0x7e'),'value':_0xfef0('0x7f')}]:[]};})};}})[_0xfef0('0x4a')](respondWithResult(_0x6f10a4,null))[_0xfef0('0x26')](function(_0x187238){var _0x40c633=_0x5ee0c0['query'][_0xfef0('0x80')]?0x1f4:_0x187238['statusCode']||0x1f4;logger['error'](_0xfef0('0x81'),'getFields',_0x40c633,JSON[_0xfef0('0x23')](_0x187238));delete _0x187238[_0xfef0('0x31')];if(_0x40c633===0x191){_0x40c633=0x190;}_0x6f10a4[_0xfef0('0x28')](_0x40c633)[_0xfef0('0x32')](_0x5ee0c0[_0xfef0('0x3f')][_0xfef0('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0x187238[_0xfef0('0x82')]}:_0x187238);});}; \ No newline at end of file +var _0x1eba=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientSecret','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallType','IsArchived','Status','Type','Case','Origin','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','custom','label','picklistValues','value','boolean','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x36795f,_0x5c7f59){var _0xb73584=function(_0x3ecc97){while(--_0x3ecc97){_0x36795f['push'](_0x36795f['shift']());}};_0xb73584(++_0x5c7f59);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x1eba[_0x11e05d];return _0x335588;};'use strict';var pdf=require(_0xa1eb('0x0'));var emlformat=require(_0xa1eb('0x1'));var rimraf=require(_0xa1eb('0x2'));var zipdir=require(_0xa1eb('0x3'));var jsonpatch=require(_0xa1eb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1eb('0x5'));var Mustache=require(_0xa1eb('0x6'));var util=require(_0xa1eb('0x7'));var path=require(_0xa1eb('0x8'));var sox=require(_0xa1eb('0x9'));var csv=require(_0xa1eb('0xa'));var ejs=require(_0xa1eb('0xb'));var fs=require('fs');var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];var integrations=require(_0xa1eb('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xa1eb('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e65dc,_0x35a353,_0x4c7983,_0x25d058){return new BPromise(function(_0x2178e2,_0x14e048){var _0x2877cb=_0x25d058||client;return _0x2877cb[_0xa1eb('0x1b')](_0x4e65dc,_0x4c7983)[_0xa1eb('0x1c')](function(_0x1c858c){logger[_0xa1eb('0x1d')](_0xa1eb('0x1e'),_0x35a353,'request\x20sent');logger[_0xa1eb('0x1f')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x35a353,_0xa1eb('0x20'),JSON[_0xa1eb('0x21')](_0x1c858c));if(_0x1c858c[_0xa1eb('0x22')]){if(_0x1c858c[_0xa1eb('0x22')]['code']===0x1f4){logger[_0xa1eb('0x22')](_0xa1eb('0x1e'),_0x35a353,_0x1c858c[_0xa1eb('0x22')][_0xa1eb('0x23')]);return _0x14e048(_0x1c858c[_0xa1eb('0x22')][_0xa1eb('0x23')]);}logger[_0xa1eb('0x22')](_0xa1eb('0x1e'),_0x35a353,_0x1c858c['error'][_0xa1eb('0x23')]);return _0x2178e2(_0x1c858c['error'][_0xa1eb('0x23')]);}else{logger[_0xa1eb('0x1d')](_0xa1eb('0x1e'),_0x35a353,_0xa1eb('0x20'));_0x2178e2(_0x1c858c['result']['message']);}})[_0xa1eb('0x24')](function(_0xc64cb9){logger['error'](_0xa1eb('0x1e'),_0x35a353,_0xc64cb9);_0x14e048(_0xc64cb9);});});}function respondWithStatusCode(_0x250728,_0x258d3a){_0x258d3a=_0x258d3a||0xcc;return function(_0xa6b20c){if(_0xa6b20c){return _0x250728[_0xa1eb('0x25')](_0x258d3a);}return _0x250728[_0xa1eb('0x26')](_0x258d3a)[_0xa1eb('0x27')]();};}function respondWithResult(_0x364b1c,_0xd7bb88){_0xd7bb88=_0xd7bb88||0xc8;return function(_0x352796){if(_0x352796){return _0x364b1c[_0xa1eb('0x26')](_0xd7bb88)[_0xa1eb('0x28')](_0x352796);}};}function respondWithFilteredResult(_0x57d089,_0x7c617e){return function(_0xbd5517){if(_0xbd5517){var _0x491f37=_0xbd5517[_0xa1eb('0x29')],_0x2680c0=_0x7c617e['offset'],_0x4e2aa7=_0x7c617e[_0xa1eb('0x2a')]+_0x7c617e[_0xa1eb('0x2b')],_0x3aae71;if(_0x4e2aa7>=_0x491f37){_0x4e2aa7=_0x491f37;_0x3aae71=0xc8;}else{_0x3aae71=0xce;}_0x57d089[_0xa1eb('0x26')](_0x3aae71);return _0x57d089['set'](_0xa1eb('0x2c'),_0x2680c0+'-'+_0x4e2aa7+'/'+_0x491f37)[_0xa1eb('0x28')](_0xbd5517);}return null;};}function patchUpdates(_0x55f5cc){return function(_0x273a42){try{jsonpatch[_0xa1eb('0x2d')](_0x273a42,_0x55f5cc,!![]);}catch(_0x401510){return BPromise[_0xa1eb('0x2e')](_0x401510);}return _0x273a42[_0xa1eb('0x2f')]();};}function saveUpdates(_0x52f9c7,_0x9d49d8){return function(_0x316b02){if(_0x316b02){return _0x316b02[_0xa1eb('0x30')](_0x52f9c7)[_0xa1eb('0x1c')](function(_0x383e26){return _0x383e26;});}return null;};}function removeEntity(_0xcd9efd,_0x1d5b64){return function(_0xcfda64){if(_0xcfda64){return _0xcfda64[_0xa1eb('0x31')]()[_0xa1eb('0x1c')](function(){_0xcd9efd[_0xa1eb('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x563b11,_0x126d50){return function(_0xb267e0){if(!_0xb267e0){_0x563b11[_0xa1eb('0x25')](0x194);}return _0xb267e0;};}function handleError(_0x36cc2a,_0x2b345a){_0x2b345a=_0x2b345a||0x1f4;return function(_0x58d336){logger['error'](_0x58d336[_0xa1eb('0x32')]);if(_0x58d336[_0xa1eb('0x33')]){delete _0x58d336['name'];}_0x36cc2a['status'](_0x2b345a)[_0xa1eb('0x34')](_0x58d336);};}exports['index']=function(_0x1f33dc,_0x534fe4){var _0x47737d={},_0x3ad54b={},_0x229931={'count':0x0,'rows':[]};var _0x57355f=_[_0xa1eb('0x35')](db[_0xa1eb('0x36')][_0xa1eb('0x37')],function(_0x481405){return{'name':_0x481405[_0xa1eb('0x38')],'type':_0x481405[_0xa1eb('0x39')][_0xa1eb('0x3a')]};});_0x3ad54b[_0xa1eb('0x3b')]=_[_0xa1eb('0x35')](_0x57355f,'name');_0x3ad54b[_0xa1eb('0x3c')]=_[_0xa1eb('0x3d')](_0x1f33dc[_0xa1eb('0x3c')]);_0x3ad54b[_0xa1eb('0x3e')]=_[_0xa1eb('0x3f')](_0x3ad54b[_0xa1eb('0x3b')],_0x3ad54b[_0xa1eb('0x3c')]);_0x47737d[_0xa1eb('0x40')]=_['intersection'](_0x3ad54b[_0xa1eb('0x3b')],qs[_0xa1eb('0x41')](_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x41')]));_0x47737d[_0xa1eb('0x40')]=_0x47737d['attributes'][_0xa1eb('0x42')]?_0x47737d[_0xa1eb('0x40')]:_0x3ad54b[_0xa1eb('0x3b')];if(!_0x1f33dc['query'][_0xa1eb('0x43')](_0xa1eb('0x44'))){_0x47737d[_0xa1eb('0x2b')]=qs[_0xa1eb('0x2b')](_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x2b')]);_0x47737d[_0xa1eb('0x2a')]=qs['offset'](_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x2a')]);}_0x47737d['order']=qs[_0xa1eb('0x45')](_0x1f33dc['query'][_0xa1eb('0x45')]);_0x47737d[_0xa1eb('0x46')]=qs[_0xa1eb('0x3e')](_[_0xa1eb('0x47')](_0x1f33dc[_0xa1eb('0x3c')],_0x3ad54b[_0xa1eb('0x3e')]),_0x57355f);if(_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x48')]){_0x47737d[_0xa1eb('0x46')]=_[_0xa1eb('0x49')](_0x47737d[_0xa1eb('0x46')],{'$or':_[_0xa1eb('0x35')](_0x57355f,function(_0x459a02){if(_0x459a02[_0xa1eb('0x39')]!==_0xa1eb('0x4a')){var _0x2ee961={};_0x2ee961[_0x459a02['name']]={'$like':'%'+_0x1f33dc[_0xa1eb('0x3c')]['filter']+'%'};return _0x2ee961;}})});}_0x47737d=_[_0xa1eb('0x49')]({},_0x47737d,_0x1f33dc[_0xa1eb('0x4b')]);var _0x54a29f={'where':_0x47737d['where']};return db[_0xa1eb('0x36')][_0xa1eb('0x29')](_0x54a29f)[_0xa1eb('0x1c')](function(_0x55c770){_0x229931[_0xa1eb('0x29')]=_0x55c770;if(_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x4c')]){_0x47737d[_0xa1eb('0x4d')]=[{'all':!![]}];}return db[_0xa1eb('0x36')][_0xa1eb('0x4e')](_0x47737d);})[_0xa1eb('0x1c')](function(_0x3f66a9){_0x229931[_0xa1eb('0x4f')]=_0x3f66a9;return _0x229931;})[_0xa1eb('0x1c')](respondWithFilteredResult(_0x534fe4,_0x47737d))[_0xa1eb('0x24')](handleError(_0x534fe4,null));};exports[_0xa1eb('0x50')]=function(_0x39d3c6,_0x10e15a){var _0x50df09={'raw':![],'where':{'id':_0x39d3c6[_0xa1eb('0x51')]['id']}},_0x41b65a={};_0x41b65a[_0xa1eb('0x3b')]=_[_0xa1eb('0x3d')](db[_0xa1eb('0x36')][_0xa1eb('0x37')]);_0x41b65a[_0xa1eb('0x3c')]=_['keys'](_0x39d3c6[_0xa1eb('0x3c')]);_0x41b65a[_0xa1eb('0x3e')]=_[_0xa1eb('0x3f')](_0x41b65a[_0xa1eb('0x3b')],_0x41b65a[_0xa1eb('0x3c')]);_0x50df09[_0xa1eb('0x40')]=_[_0xa1eb('0x3f')](_0x41b65a[_0xa1eb('0x3b')],qs[_0xa1eb('0x41')](_0x39d3c6['query'][_0xa1eb('0x41')]));_0x50df09['attributes']=_0x50df09[_0xa1eb('0x40')]['length']?_0x50df09[_0xa1eb('0x40')]:_0x41b65a[_0xa1eb('0x3b')];if(_0x39d3c6[_0xa1eb('0x3c')]['includeAll']){_0x50df09[_0xa1eb('0x4d')]=[{'all':!![]}];}_0x50df09=_[_0xa1eb('0x49')]({},_0x50df09,_0x39d3c6['options']);return db[_0xa1eb('0x36')][_0xa1eb('0x52')](_0x50df09)[_0xa1eb('0x1c')](handleEntityNotFound(_0x10e15a,null))[_0xa1eb('0x1c')](respondWithResult(_0x10e15a,null))[_0xa1eb('0x24')](handleError(_0x10e15a,null));};exports[_0xa1eb('0x53')]=function(_0x305202,_0x247b08){return db[_0xa1eb('0x36')][_0xa1eb('0x53')](_0x305202[_0xa1eb('0x54')],{})[_0xa1eb('0x1c')](respondWithResult(_0x247b08,0xc9))[_0xa1eb('0x24')](handleError(_0x247b08,null));};exports[_0xa1eb('0x30')]=function(_0x40f119,_0x2ba6c0){if(_0x40f119[_0xa1eb('0x54')]['id']){delete _0x40f119['body']['id'];}return db[_0xa1eb('0x36')][_0xa1eb('0x52')]({'where':{'id':_0x40f119[_0xa1eb('0x51')]['id']}})[_0xa1eb('0x1c')](handleEntityNotFound(_0x2ba6c0,null))[_0xa1eb('0x1c')](saveUpdates(_0x40f119[_0xa1eb('0x54')],null))['then'](respondWithResult(_0x2ba6c0,null))[_0xa1eb('0x24')](handleError(_0x2ba6c0,null));};exports[_0xa1eb('0x31')]=function(_0x217ecb,_0xf9d185){return db[_0xa1eb('0x36')][_0xa1eb('0x52')]({'where':{'id':_0x217ecb[_0xa1eb('0x51')]['id']}})['then'](handleEntityNotFound(_0xf9d185,null))[_0xa1eb('0x1c')](removeEntity(_0xf9d185,null))[_0xa1eb('0x24')](handleError(_0xf9d185,null));};exports[_0xa1eb('0x55')]=function(_0x1c8fd0,_0x4c30ad,_0x5af1e6){var _0x58ca4e={};var _0x5673fa={};var _0x1b3c33;var _0x1e1e5d;return db['SalesforceAccount'][_0xa1eb('0x56')]({'where':{'id':_0x1c8fd0[_0xa1eb('0x51')]['id']}})[_0xa1eb('0x1c')](handleEntityNotFound(_0x4c30ad,null))[_0xa1eb('0x1c')](function(_0x4edf8e){if(_0x4edf8e){_0x1b3c33=_0x4edf8e;_0x5673fa['model']=_[_0xa1eb('0x3d')](db[_0xa1eb('0x57')][_0xa1eb('0x37')]);_0x5673fa[_0xa1eb('0x3c')]=_[_0xa1eb('0x3d')](_0x1c8fd0[_0xa1eb('0x3c')]);_0x5673fa['filters']=_['intersection'](_0x5673fa[_0xa1eb('0x3b')],_0x5673fa['query']);_0x58ca4e[_0xa1eb('0x40')]=_['intersection'](_0x5673fa[_0xa1eb('0x3b')],qs[_0xa1eb('0x41')](_0x1c8fd0['query'][_0xa1eb('0x41')]));_0x58ca4e[_0xa1eb('0x40')]=_0x58ca4e['attributes'][_0xa1eb('0x42')]?_0x58ca4e[_0xa1eb('0x40')]:_0x5673fa[_0xa1eb('0x3b')];_0x58ca4e['order']=qs[_0xa1eb('0x45')](_0x1c8fd0[_0xa1eb('0x3c')]['sort']);_0x58ca4e[_0xa1eb('0x46')]=qs[_0xa1eb('0x3e')](_[_0xa1eb('0x47')](_0x1c8fd0['query'],_0x5673fa[_0xa1eb('0x3e')]));if(_0x1c8fd0['query'][_0xa1eb('0x48')]){_0x58ca4e[_0xa1eb('0x46')]=_[_0xa1eb('0x49')](_0x58ca4e[_0xa1eb('0x46')],{'$or':_[_0xa1eb('0x35')](_0x58ca4e['attributes'],function(_0x2aba03){var _0x401800={};_0x401800[_0x2aba03]={'$like':'%'+_0x1c8fd0[_0xa1eb('0x3c')]['filter']+'%'};return _0x401800;})});}_0x58ca4e=_[_0xa1eb('0x49')]({},_0x58ca4e,_0x1c8fd0['options']);return _0x1b3c33['getConfigurations'](_0x58ca4e);}})['then'](function(_0x555ded){if(_0x555ded){_0x1e1e5d=_0x555ded[_0xa1eb('0x42')];if(!_0x1c8fd0[_0xa1eb('0x3c')][_0xa1eb('0x43')](_0xa1eb('0x44'))){_0x58ca4e[_0xa1eb('0x2b')]=qs[_0xa1eb('0x2b')](_0x1c8fd0[_0xa1eb('0x3c')][_0xa1eb('0x2b')]);_0x58ca4e[_0xa1eb('0x2a')]=qs[_0xa1eb('0x2a')](_0x1c8fd0['query'][_0xa1eb('0x2a')]);}return _0x1b3c33[_0xa1eb('0x55')](_0x58ca4e);}})[_0xa1eb('0x1c')](function(_0x1f9418){if(_0x1f9418){return _0x1f9418?{'count':_0x1e1e5d,'rows':_0x1f9418}:null;}})[_0xa1eb('0x1c')](respondWithResult(_0x4c30ad,null))[_0xa1eb('0x24')](handleError(_0x4c30ad,null));};exports['addConfiguration']=function(_0x113a3a,_0x2b6996,_0x16c5a3){if(_0x113a3a['body']['id']){delete _0x113a3a[_0xa1eb('0x54')]['id'];}return db[_0xa1eb('0x36')][_0xa1eb('0x56')]({'where':{'id':_0x113a3a[_0xa1eb('0x51')]['id']}})[_0xa1eb('0x1c')](handleEntityNotFound(_0x2b6996,null))['then'](function(_0x2eca4e){if(_0x2eca4e){_0x113a3a['body'][_0xa1eb('0x58')]=_0x2eca4e['id'];_0x113a3a['body'][_0xa1eb('0x59')]=integrations[_0xa1eb('0x5a')](_0x113a3a[_0xa1eb('0x54')][_0xa1eb('0x5b')],_0x113a3a['body'][_0xa1eb('0x39')]);_0x113a3a[_0xa1eb('0x54')][_0xa1eb('0x5c')]=integrations[_0xa1eb('0x5d')](_0x113a3a['body'][_0xa1eb('0x5b')],_0x113a3a[_0xa1eb('0x54')][_0xa1eb('0x39')]);return db[_0xa1eb('0x57')][_0xa1eb('0x53')](_0x113a3a[_0xa1eb('0x54')],{'include':[{'model':db[_0xa1eb('0x5e')],'as':_0xa1eb('0x59')},{'model':db[_0xa1eb('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2b6996,null))['catch'](handleError(_0x2b6996,null));};exports[_0xa1eb('0x5f')]=function(_0x5b7785,_0xa5810,_0x3ec094){var _0x492325;var _0x52522a='';var _0xdcaac3=_0xa1eb('0x60');return db[_0xa1eb('0x36')][_0xa1eb('0x56')]({'where':{'id':_0x5b7785[_0xa1eb('0x51')]['id']},'attributes':['id','remoteUri','clientId',_0xa1eb('0x61'),_0xa1eb('0x62'),_0xa1eb('0x63'),_0xa1eb('0x64')]})['then'](handleEntityNotFound(_0xa5810,null))[_0xa1eb('0x1c')](function(_0x28b3de){if(_0x28b3de){_0x52522a=_0x28b3de[_0xa1eb('0x65')];var _0x4050d6=_0x52522a[_0xa1eb('0x66')](-0x1);if(_0x4050d6==='/'){_0x52522a=_0x52522a[_0xa1eb('0x67')](0x0,_0x52522a[_0xa1eb('0x68')](_0x4050d6));}_0x492325=new jsforce[(_0xa1eb('0x69'))]({'oauth2':{'loginUrl':_0x52522a,'clientId':_0x28b3de[_0xa1eb('0x6a')],'clientSecret':_0x28b3de[_0xa1eb('0x61')]}});return _0x492325[_0xa1eb('0x6b')](_0x28b3de['username'],_0x28b3de[_0xa1eb('0x63')][_0xa1eb('0x6c')](_0x28b3de[_0xa1eb('0x64')]));}})[_0xa1eb('0x1c')](function(_0x3fe7ef){if(_0x3fe7ef){if(!_[_0xa1eb('0x6d')](_0x5b7785['query'][_0xa1eb('0x6e')])){_0xdcaac3=_0x5b7785[_0xa1eb('0x3c')][_0xa1eb('0x6e')];}return _0x492325[_0xa1eb('0x6f')](_0xdcaac3)['describe']();}})['then'](function(_0xff1843){var _0x5e0cd5=[_0xa1eb('0x70'),_0xa1eb('0x71'),'CallObject',_0xa1eb('0x72'),_0xa1eb('0x73'),'Priority',_0xa1eb('0x74'),_0xa1eb('0x75')];if(!_[_0xa1eb('0x6d')](_0x5b7785[_0xa1eb('0x3c')][_0xa1eb('0x6e')])&&_0x5b7785[_0xa1eb('0x3c')][_0xa1eb('0x6e')]===_0xa1eb('0x76')){_0x5e0cd5=[_0xa1eb('0x75'),_0xa1eb('0x77'),_0xa1eb('0x78'),'Status',_0xa1eb('0x79'),_0xa1eb('0x7a'),_0xa1eb('0x7b'),_0xa1eb('0x7c')];}if(_0xff1843){_['remove'](_0xff1843[_0xa1eb('0x41')],function(_0x2ff08e){return _0x2ff08e[_0xa1eb('0x7d')]===![]&&!_0x5e0cd5['includes'](_0x2ff08e[_0xa1eb('0x33')]);});return{'count':_0xff1843[_0xa1eb('0x41')][_0xa1eb('0x42')],'rows':_['map'](_0xff1843[_0xa1eb('0x41')],function(_0x4fb7a7){return{'id':_0x4fb7a7[_0xa1eb('0x33')],'name':_0x4fb7a7[_0xa1eb('0x7e')],'custom':_0x4fb7a7[_0xa1eb('0x7d')],'options':_0x4fb7a7[_0xa1eb('0x7f')][_0xa1eb('0x42')]>0x0?_[_0xa1eb('0x35')](_0x4fb7a7[_0xa1eb('0x7f')],function(_0xc16d28){return{'name':_0xc16d28['label'],'value':_0xc16d28[_0xa1eb('0x80')]};}):_0x4fb7a7[_0xa1eb('0x39')]==_0xa1eb('0x81')?[{'name':_0xa1eb('0x82'),'value':_0xa1eb('0x83')},{'name':'False','value':_0xa1eb('0x84')}]:[]};})};}})[_0xa1eb('0x1c')](respondWithResult(_0xa5810,null))['catch'](function(_0x1e7ce7){var _0x4be2e5=_0x5b7785['query'][_0xa1eb('0x85')]?0x1f4:_0x1e7ce7[_0xa1eb('0x86')]||0x1f4;logger['error'](_0xa1eb('0x87'),_0xa1eb('0x5f'),_0x4be2e5,JSON['stringify'](_0x1e7ce7));delete _0x1e7ce7[_0xa1eb('0x33')];if(_0x4be2e5===0x191){_0x4be2e5=0x190;}_0xa5810[_0xa1eb('0x26')](_0x4be2e5)['send'](_0x5b7785['query'][_0xa1eb('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x1e7ce7[_0xa1eb('0x86')]}:_0x1e7ce7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index e7c345e..f835fe2 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.model.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e7=['SalesforceAccount','int_salesforce_accounts','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','exports','define'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xa9e7,0x86));var _0x7a9e=function(_0x36acb2,_0x12faaa){_0x36acb2=_0x36acb2-0x0;var _0x581204=_0xa9e7[_0x36acb2];return _0x581204;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7a9e('0x0'))(_0x7a9e('0x1'));var moment=require(_0x7a9e('0x2'));var BPromise=require(_0x7a9e('0x3'));var rp=require(_0x7a9e('0x4'));var fs=require('fs');var path=require(_0x7a9e('0x5'));var rimraf=require('rimraf');var config=require(_0x7a9e('0x6'));var attributes=require(_0x7a9e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x7a9e('0x8')]=function(_0x3f2862,_0x5e2a16){return _0x3f2862[_0x7a9e('0x9')](_0x7a9e('0xa'),attributes,{'tableName':_0x7a9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81f5=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x75f769,_0x17887a){var _0x26eb07=function(_0x1d6173){while(--_0x1d6173){_0x75f769['push'](_0x75f769['shift']());}};_0x26eb07(++_0x17887a);}(_0x81f5,0x11d));var _0x581f=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x81f5[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x581f('0x0'));var util=require(_0x581f('0x1'));var logger=require(_0x581f('0x2'))('api');var moment=require(_0x581f('0x3'));var BPromise=require(_0x581f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x581f('0x5'));var config=require(_0x581f('0x6'));var attributes=require(_0x581f('0x7'));var integrations=require(_0x581f('0x8'));module[_0x581f('0x9')]=function(_0x42649c,_0x453cb4){return _0x42649c[_0x581f('0xa')](_0x581f('0xb'),attributes,{'tableName':_0x581f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 5b0b5b2..582d7bf 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a9a=['catch','where','ShowSalesforceAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','include','map','model','debug'];(function(_0x4c7384,_0x4c4fc3){var _0xa29fd2=function(_0x20b58e){while(--_0x20b58e){_0x4c7384['push'](_0x4c7384['shift']());}};_0xa29fd2(++_0x4c4fc3);}(_0x0a9a,0x183));var _0xa0a9=function(_0x47051e,_0x3a3ffe){_0x47051e=_0x47051e-0x0;var _0x581058=_0x0a9a[_0x47051e];return _0x581058;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});}exports[_0xa0a9('0x13')]=function(_0x568409){var _0x320735=this;return new Promise(function(_0x126401,_0x33eb8f){return db[_0xa0a9('0x14')][_0xa0a9('0x15')]({'raw':_0x568409[_0xa0a9('0x16')]?_0x568409['options'][_0xa0a9('0x17')]===undefined?!![]:![]:!![],'where':_0x568409[_0xa0a9('0x16')]?_0x568409['options']['where']||null:null,'attributes':_0x568409[_0xa0a9('0x16')]?_0x568409[_0xa0a9('0x16')][_0xa0a9('0x18')]||null:null,'limit':_0x568409['options']?_0x568409[_0xa0a9('0x16')]['limit']||null:null,'include':_0x568409[_0xa0a9('0x16')]?_0x568409['options'][_0xa0a9('0x19')]?_[_0xa0a9('0x1a')](_0x568409[_0xa0a9('0x16')][_0xa0a9('0x19')],function(_0x4938da){return{'model':db[_0x4938da[_0xa0a9('0x1b')]],'as':_0x4938da['as'],'attributes':_0x4938da['attributes'],'include':_0x4938da[_0xa0a9('0x19')]?_[_0xa0a9('0x1a')](_0x4938da[_0xa0a9('0x19')],function(_0x252a14){return{'model':db[_0x252a14['model']],'as':_0x252a14['as'],'attributes':_0x252a14[_0xa0a9('0x18')],'include':_0x252a14[_0xa0a9('0x19')]?_[_0xa0a9('0x1a')](_0x252a14[_0xa0a9('0x19')],function(_0x526dd1){return{'model':db[_0x526dd1[_0xa0a9('0x1b')]],'as':_0x526dd1['as'],'attributes':_0x526dd1[_0xa0a9('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa0a9('0xb')](function(_0x5c446e){logger['info'](_0xa0a9('0x13'),_0x568409);logger[_0xa0a9('0x1c')](_0xa0a9('0x13'),_0x568409,JSON[_0xa0a9('0xe')](_0x5c446e));_0x126401(_0x5c446e);})[_0xa0a9('0x1d')](function(_0xe218ff){logger[_0xa0a9('0xf')](_0xa0a9('0x13'),_0xe218ff[_0xa0a9('0x10')],_0x568409);_0x33eb8f(_0x320735[_0xa0a9('0xf')](0x1f4,_0xe218ff[_0xa0a9('0x10')]));});});};exports['ShowSalesforceAccount']=function(_0x1f6178){var _0x1957bf=this;return new Promise(function(_0x4fc94a,_0x2f21ea){return db[_0xa0a9('0x14')]['find']({'raw':_0x1f6178['options']?_0x1f6178[_0xa0a9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1f6178['options']?_0x1f6178[_0xa0a9('0x16')][_0xa0a9('0x1e')]||null:null,'attributes':_0x1f6178[_0xa0a9('0x16')]?_0x1f6178[_0xa0a9('0x16')][_0xa0a9('0x18')]||null:null,'include':_0x1f6178[_0xa0a9('0x16')]?_0x1f6178[_0xa0a9('0x16')]['include']?_[_0xa0a9('0x1a')](_0x1f6178[_0xa0a9('0x16')]['include'],function(_0x46ef2b){return{'model':db[_0x46ef2b[_0xa0a9('0x1b')]],'as':_0x46ef2b['as'],'attributes':_0x46ef2b[_0xa0a9('0x18')],'include':_0x46ef2b['include']?_['map'](_0x46ef2b[_0xa0a9('0x19')],function(_0x210ddb){return{'model':db[_0x210ddb[_0xa0a9('0x1b')]],'as':_0x210ddb['as'],'attributes':_0x210ddb[_0xa0a9('0x18')],'include':_0x210ddb['include']?_[_0xa0a9('0x1a')](_0x210ddb[_0xa0a9('0x19')],function(_0x459485){return{'model':db[_0x459485['model']],'as':_0x459485['as'],'attributes':_0x459485[_0xa0a9('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa0a9('0xb')](function(_0x4e121e){logger['info'](_0xa0a9('0x1f'),_0x1f6178);logger[_0xa0a9('0x1c')](_0xa0a9('0x1f'),_0x1f6178,JSON[_0xa0a9('0xe')](_0x4e121e));_0x4fc94a(_0x4e121e);})[_0xa0a9('0x1d')](function(_0x1d6bae){logger[_0xa0a9('0xf')](_0xa0a9('0x1f'),_0x1d6bae[_0xa0a9('0x10')],_0x1f6178);_0x2f21ea(_0x1957bf[_0xa0a9('0xf')](0x1f4,_0x1d6bae[_0xa0a9('0x10')]));});});}; \ No newline at end of file +var _0x5ff3=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','limit','include','map','model','ShowSalesforceAccount','raw','util','bluebird','ioredis'];(function(_0x3ad9e3,_0xe2eb88){var _0x1ece84=function(_0x3853a9){while(--_0x3853a9){_0x3ad9e3['push'](_0x3ad9e3['shift']());}};_0x1ece84(++_0xe2eb88);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3cb170,_0x3089d3){_0x3cb170=_0x3cb170-0x0;var _0x183504=_0x5ff3[_0x3cb170];return _0x183504;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});}exports[_0x35ff('0x15')]=function(_0x16c803){var _0x186f6a=this;return new Promise(function(_0x5f470e,_0x2404e5){return db[_0x35ff('0x16')][_0x35ff('0x17')]({'raw':_0x16c803[_0x35ff('0x18')]?_0x16c803['options']['raw']===undefined?!![]:![]:!![],'where':_0x16c803[_0x35ff('0x18')]?_0x16c803[_0x35ff('0x18')]['where']||null:null,'attributes':_0x16c803[_0x35ff('0x18')]?_0x16c803[_0x35ff('0x18')][_0x35ff('0x19')]||null:null,'limit':_0x16c803[_0x35ff('0x18')]?_0x16c803['options'][_0x35ff('0x1a')]||null:null,'include':_0x16c803['options']?_0x16c803[_0x35ff('0x18')][_0x35ff('0x1b')]?_[_0x35ff('0x1c')](_0x16c803[_0x35ff('0x18')][_0x35ff('0x1b')],function(_0x2b3782){return{'model':db[_0x2b3782[_0x35ff('0x1d')]],'as':_0x2b3782['as'],'attributes':_0x2b3782['attributes'],'include':_0x2b3782[_0x35ff('0x1b')]?_[_0x35ff('0x1c')](_0x2b3782['include'],function(_0x426e4e){return{'model':db[_0x426e4e['model']],'as':_0x426e4e['as'],'attributes':_0x426e4e['attributes'],'include':_0x426e4e[_0x35ff('0x1b')]?_[_0x35ff('0x1c')](_0x426e4e[_0x35ff('0x1b')],function(_0x11a5eb){return{'model':db[_0x11a5eb[_0x35ff('0x1d')]],'as':_0x11a5eb['as'],'attributes':_0x11a5eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x35ff('0xb')](function(_0x412873){logger[_0x35ff('0xc')]('GetSalesforceAccount',_0x16c803);logger[_0x35ff('0xe')](_0x35ff('0x15'),_0x16c803,JSON[_0x35ff('0xf')](_0x412873));_0x5f470e(_0x412873);})[_0x35ff('0x14')](function(_0x47fcb5){logger[_0x35ff('0x10')](_0x35ff('0x15'),_0x47fcb5[_0x35ff('0x12')],_0x16c803);_0x2404e5(_0x186f6a[_0x35ff('0x10')](0x1f4,_0x47fcb5['message']));});});};exports[_0x35ff('0x1e')]=function(_0x57339d){var _0x1cb370=this;return new Promise(function(_0x257501,_0x2bc118){return db[_0x35ff('0x16')]['find']({'raw':_0x57339d[_0x35ff('0x18')]?_0x57339d['options'][_0x35ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x57339d[_0x35ff('0x18')]?_0x57339d['options']['where']||null:null,'attributes':_0x57339d[_0x35ff('0x18')]?_0x57339d[_0x35ff('0x18')]['attributes']||null:null,'include':_0x57339d[_0x35ff('0x18')]?_0x57339d[_0x35ff('0x18')]['include']?_[_0x35ff('0x1c')](_0x57339d[_0x35ff('0x18')][_0x35ff('0x1b')],function(_0x2727c3){return{'model':db[_0x2727c3[_0x35ff('0x1d')]],'as':_0x2727c3['as'],'attributes':_0x2727c3[_0x35ff('0x19')],'include':_0x2727c3[_0x35ff('0x1b')]?_[_0x35ff('0x1c')](_0x2727c3[_0x35ff('0x1b')],function(_0x1a5c81){return{'model':db[_0x1a5c81[_0x35ff('0x1d')]],'as':_0x1a5c81['as'],'attributes':_0x1a5c81[_0x35ff('0x19')],'include':_0x1a5c81[_0x35ff('0x1b')]?_['map'](_0x1a5c81[_0x35ff('0x1b')],function(_0x5c5dcb){return{'model':db[_0x5c5dcb[_0x35ff('0x1d')]],'as':_0x5c5dcb['as'],'attributes':_0x5c5dcb[_0x35ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0x35ff('0xb')](function(_0x11115d){logger[_0x35ff('0xc')]('ShowSalesforceAccount',_0x57339d);logger[_0x35ff('0xe')](_0x35ff('0x1e'),_0x57339d,JSON[_0x35ff('0xf')](_0x11115d));_0x257501(_0x11115d);})[_0x35ff('0x14')](function(_0x324f6c){logger['error'](_0x35ff('0x1e'),_0x324f6c[_0x35ff('0x12')],_0x57339d);_0x2bc118(_0x1cb370[_0x35ff('0x10')](0x1f4,_0x324f6c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9451314..c3f6b0e 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac8b=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','exports'];(function(_0x515106,_0x543bc2){var _0x5247f4=function(_0x16fef1){while(--_0x16fef1){_0x515106['push'](_0x515106['shift']());}};_0x5247f4(++_0x543bc2);}(_0xac8b,0xfd));var _0xbac8=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xac8b[_0x42f009];return _0x22a1e0;};'use strict';var multer=require(_0xbac8('0x0'));var util=require(_0xbac8('0x1'));var path=require('path');var timeout=require(_0xbac8('0x2'));var express=require(_0xbac8('0x3'));var router=express[_0xbac8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbac8('0x5'));var config=require(_0xbac8('0x6'));var controller=require(_0xbac8('0x7'));router[_0xbac8('0x8')]('/',auth[_0xbac8('0x9')](),controller[_0xbac8('0xa')]);router[_0xbac8('0x8')](_0xbac8('0xb'),auth['isAuthenticated'](),controller[_0xbac8('0xc')]);router[_0xbac8('0x8')](_0xbac8('0xd'),auth[_0xbac8('0x9')](),controller[_0xbac8('0xe')]);router[_0xbac8('0x8')](_0xbac8('0xf'),auth[_0xbac8('0x9')](),controller[_0xbac8('0x10')]);router['get']('/:id/descriptions',auth[_0xbac8('0x9')](),controller[_0xbac8('0x11')]);router[_0xbac8('0x12')]('/',auth[_0xbac8('0x9')](),controller[_0xbac8('0x13')]);router['put'](_0xbac8('0xb'),auth[_0xbac8('0x9')](),controller[_0xbac8('0x14')]);router[_0xbac8('0x15')](_0xbac8('0xb'),auth[_0xbac8('0x9')](),controller['destroy']);module[_0xbac8('0x16')]=router; \ No newline at end of file +var _0xde38=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions','getDescriptions','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde38,0x7b));var _0x8de3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde38[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8de3('0x0'));var util=require('util');var path=require(_0x8de3('0x1'));var timeout=require(_0x8de3('0x2'));var express=require(_0x8de3('0x3'));var router=express[_0x8de3('0x4')]();var auth=require(_0x8de3('0x5'));var interaction=require(_0x8de3('0x6'));var config=require(_0x8de3('0x7'));var controller=require(_0x8de3('0x8'));router[_0x8de3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8de3('0x9')](_0x8de3('0xa'),auth[_0x8de3('0xb')](),controller[_0x8de3('0xc')]);router['get']('/:id/fields',auth[_0x8de3('0xb')](),controller['getFields']);router[_0x8de3('0x9')](_0x8de3('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8de3('0x9')](_0x8de3('0xe'),auth[_0x8de3('0xb')](),controller[_0x8de3('0xf')]);router['post']('/',auth[_0x8de3('0xb')](),controller['create']);router['put'](_0x8de3('0xa'),auth[_0x8de3('0xb')](),controller[_0x8de3('0x10')]);router[_0x8de3('0x11')](_0x8de3('0xa'),auth['isAuthenticated'](),controller[_0x8de3('0x12')]);module[_0x8de3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 7ae419a..0eb841b 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb65e=['contact','lead','nothing','STRING','ENUM','Task','Case','contact_lead'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xb65e,0xe3));var _0xeb65=function(_0x7bd8e6,_0x31443f){_0x7bd8e6=_0x7bd8e6-0x0;var _0x68e861=_0xb65e[_0x7bd8e6];return _0x68e861;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xeb65('0x0')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xeb65('0x1')](_0xeb65('0x2'),_0xeb65('0x3')),'defaultValue':_0xeb65('0x2')},'moduleSearch':{'type':Sequelize[_0xeb65('0x1')](_0xeb65('0x4'),_0xeb65('0x5'),_0xeb65('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0xeb65('0x7'),_0xeb65('0x5'),_0xeb65('0x6')),'defaultValue':_0xeb65('0x6')}}; \ No newline at end of file +var _0xdd06=['contact_lead','contact','nothing','lead','exports','STRING','ENUM','Task','Case'];(function(_0x3ffb01,_0x3aff18){var _0x30db9f=function(_0x308a6b){while(--_0x308a6b){_0x3ffb01['push'](_0x3ffb01['shift']());}};_0x30db9f(++_0x3aff18);}(_0xdd06,0x163));var _0x6dd0=function(_0x29d9d5,_0x5a1bd8){_0x29d9d5=_0x29d9d5-0x0;var _0x1be395=_0xdd06[_0x29d9d5];return _0x1be395;};'use strict';var Sequelize=require('sequelize');module[_0x6dd0('0x0')]={'name':{'type':Sequelize[_0x6dd0('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x6dd0('0x2')](_0x6dd0('0x3'),_0x6dd0('0x4')),'defaultValue':_0x6dd0('0x3')},'moduleSearch':{'type':Sequelize[_0x6dd0('0x2')](_0x6dd0('0x5'),_0x6dd0('0x6'),'lead'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x6dd0('0x2')](_0x6dd0('0x7'),_0x6dd0('0x6'),'lead'),'defaultValue':_0x6dd0('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 59d2560..235874f 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x507e=['order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','SalesforceConfiguration','find','body','params','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','end','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x2ed5fb,_0x5bbc2d){var _0x57ca04=function(_0x416fbb){while(--_0x416fbb){_0x2ed5fb['push'](_0x2ed5fb['shift']());}};_0x57ca04(++_0x5bbc2d);}(_0x507e,0x1bc));var _0xe507=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x507e[_0x1265ed];return _0x5ac459;};'use strict';var pdf=require(_0xe507('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe507('0x1'));var zipdir=require(_0xe507('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe507('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe507('0x4'));var util=require(_0xe507('0x5'));var path=require(_0xe507('0x6'));var sox=require('sox');var csv=require(_0xe507('0x7'));var ejs=require(_0xe507('0x8'));var fs=require('fs');var _=require(_0xe507('0x9'));var squel=require('squel');var crypto=require(_0xe507('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe507('0xb'));var toCsv=require(_0xe507('0x7'));var querystring=require(_0xe507('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe507('0xd'));var as=require(_0xe507('0xe'));var hardwareService=require(_0xe507('0xf'));var logger=require('../../config/logger')(_0xe507('0x10'));var utils=require(_0xe507('0x11'));var config=require(_0xe507('0x12'));var licenseUtil=require(_0xe507('0x13'));var db=require(_0xe507('0x14'))['db'];var jayson=require(_0xe507('0x15'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ef1af,_0x2fb609,_0x52fc28,_0x4122c5){return new BPromise(function(_0x4d0fea,_0x17d8ce){var _0x4ab879=_0x4122c5||client;return _0x4ab879[_0xe507('0x16')](_0x1ef1af,_0x52fc28)[_0xe507('0x17')](function(_0x4d0d75){logger[_0xe507('0x18')](_0xe507('0x19'),_0x2fb609,_0xe507('0x1a'));logger[_0xe507('0x1b')](_0xe507('0x1c'),_0x2fb609,_0xe507('0x1a'),JSON[_0xe507('0x1d')](_0x4d0d75));if(_0x4d0d75['error']){if(_0x4d0d75['error'][_0xe507('0x1e')]===0x1f4){logger[_0xe507('0x1f')](_0xe507('0x19'),_0x2fb609,_0x4d0d75[_0xe507('0x1f')][_0xe507('0x20')]);return _0x17d8ce(_0x4d0d75['error']['message']);}logger[_0xe507('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2fb609,_0x4d0d75[_0xe507('0x1f')][_0xe507('0x20')]);return _0x4d0fea(_0x4d0d75[_0xe507('0x1f')][_0xe507('0x20')]);}else{logger[_0xe507('0x18')](_0xe507('0x19'),_0x2fb609,_0xe507('0x1a'));_0x4d0fea(_0x4d0d75['result'][_0xe507('0x20')]);}})['catch'](function(_0x20d427){logger[_0xe507('0x1f')](_0xe507('0x19'),_0x2fb609,_0x20d427);_0x17d8ce(_0x20d427);});});}function respondWithStatusCode(_0x35d116,_0x4e931f){_0x4e931f=_0x4e931f||0xcc;return function(_0x51f62e){if(_0x51f62e){return _0x35d116[_0xe507('0x21')](_0x4e931f);}return _0x35d116[_0xe507('0x22')](_0x4e931f)['end']();};}function respondWithResult(_0x4fcde5,_0x430ac7){_0x430ac7=_0x430ac7||0xc8;return function(_0x5a4e06){if(_0x5a4e06){return _0x4fcde5[_0xe507('0x22')](_0x430ac7)[_0xe507('0x23')](_0x5a4e06);}};}function respondWithFilteredResult(_0x1a7ed1,_0x3e6d64){return function(_0x495471){if(_0x495471){var _0x1a6458=_0x495471[_0xe507('0x24')],_0x2be395=_0x3e6d64['offset'],_0x1fe284=_0x3e6d64[_0xe507('0x25')]+_0x3e6d64[_0xe507('0x26')],_0x107db6;if(_0x1fe284>=_0x1a6458){_0x1fe284=_0x1a6458;_0x107db6=0xc8;}else{_0x107db6=0xce;}_0x1a7ed1[_0xe507('0x22')](_0x107db6);return _0x1a7ed1['set'](_0xe507('0x27'),_0x2be395+'-'+_0x1fe284+'/'+_0x1a6458)[_0xe507('0x23')](_0x495471);}return null;};}function patchUpdates(_0x518f47){return function(_0x12771a){try{jsonpatch[_0xe507('0x28')](_0x12771a,_0x518f47,!![]);}catch(_0x465971){return BPromise['reject'](_0x465971);}return _0x12771a[_0xe507('0x29')]();};}function saveUpdates(_0x15e76f,_0xdaa86e){return function(_0x2626c7){if(_0x2626c7){return _0x2626c7[_0xe507('0x2a')](_0x15e76f)[_0xe507('0x17')](function(_0x5403c5){return _0x5403c5;});}return null;};}function removeEntity(_0x10726b,_0x56144b){return function(_0x56c2bb){if(_0x56c2bb){return _0x56c2bb['destroy']()[_0xe507('0x17')](function(){_0x10726b[_0xe507('0x22')](0xcc)[_0xe507('0x2b')]();});}};}function handleEntityNotFound(_0x496078,_0x75f117){return function(_0x520d7c){if(!_0x520d7c){_0x496078[_0xe507('0x21')](0x194);}return _0x520d7c;};}function handleError(_0x493094,_0x39faf0){_0x39faf0=_0x39faf0||0x1f4;return function(_0x55ba54){logger['error'](_0x55ba54[_0xe507('0x2c')]);if(_0x55ba54[_0xe507('0x2d')]){delete _0x55ba54[_0xe507('0x2d')];}_0x493094[_0xe507('0x22')](_0x39faf0)['send'](_0x55ba54);};}exports[_0xe507('0x2e')]=function(_0x58cacf,_0x3b7754){var _0x18a616={},_0x43b5c3={},_0x3d50d6={'count':0x0,'rows':[]};var _0x4a7637=_[_0xe507('0x2f')](db['SalesforceConfiguration'][_0xe507('0x30')],function(_0x25b40f){return{'name':_0x25b40f[_0xe507('0x31')],'type':_0x25b40f['type']['key']};});_0x43b5c3[_0xe507('0x32')]=_[_0xe507('0x2f')](_0x4a7637,'name');_0x43b5c3[_0xe507('0x33')]=_[_0xe507('0x34')](_0x58cacf[_0xe507('0x33')]);_0x43b5c3[_0xe507('0x35')]=_[_0xe507('0x36')](_0x43b5c3[_0xe507('0x32')],_0x43b5c3[_0xe507('0x33')]);_0x18a616['attributes']=_[_0xe507('0x36')](_0x43b5c3[_0xe507('0x32')],qs['fields'](_0x58cacf[_0xe507('0x33')][_0xe507('0x37')]));_0x18a616[_0xe507('0x38')]=_0x18a616[_0xe507('0x38')][_0xe507('0x39')]?_0x18a616[_0xe507('0x38')]:_0x43b5c3['model'];if(!_0x58cacf[_0xe507('0x33')][_0xe507('0x3a')](_0xe507('0x3b'))){_0x18a616['limit']=qs['limit'](_0x58cacf[_0xe507('0x33')][_0xe507('0x26')]);_0x18a616['offset']=qs[_0xe507('0x25')](_0x58cacf[_0xe507('0x33')][_0xe507('0x25')]);}_0x18a616[_0xe507('0x3c')]=qs[_0xe507('0x3d')](_0x58cacf[_0xe507('0x33')][_0xe507('0x3d')]);_0x18a616[_0xe507('0x3e')]=qs['filters'](_[_0xe507('0x3f')](_0x58cacf[_0xe507('0x33')],_0x43b5c3[_0xe507('0x35')]),_0x4a7637);if(_0x58cacf['query']['filter']){_0x18a616[_0xe507('0x3e')]=_[_0xe507('0x40')](_0x18a616[_0xe507('0x3e')],{'$or':_[_0xe507('0x2f')](_0x4a7637,function(_0x3b3005){if(_0x3b3005[_0xe507('0x41')]!==_0xe507('0x42')){var _0x548efd={};_0x548efd[_0x3b3005[_0xe507('0x2d')]]={'$like':'%'+_0x58cacf[_0xe507('0x33')][_0xe507('0x43')]+'%'};return _0x548efd;}})});}_0x18a616=_[_0xe507('0x40')]({},_0x18a616,_0x58cacf[_0xe507('0x44')]);var _0x1a136e={'where':_0x18a616['where']};return db['SalesforceConfiguration'][_0xe507('0x24')](_0x1a136e)['then'](function(_0x4816f5){_0x3d50d6[_0xe507('0x24')]=_0x4816f5;if(_0x58cacf[_0xe507('0x33')][_0xe507('0x45')]){_0x18a616[_0xe507('0x46')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xe507('0x47')](_0x18a616);})[_0xe507('0x17')](function(_0x35851a){_0x3d50d6[_0xe507('0x48')]=_0x35851a;return _0x3d50d6;})[_0xe507('0x17')](respondWithFilteredResult(_0x3b7754,_0x18a616))[_0xe507('0x49')](handleError(_0x3b7754,null));};exports['show']=function(_0x1a98d6,_0x4edbec){var _0x2b424c={'raw':![],'where':{'id':_0x1a98d6['params']['id']}},_0x248ca5={};_0x248ca5['model']=_['keys'](db[_0xe507('0x4a')][_0xe507('0x30')]);_0x248ca5[_0xe507('0x33')]=_['keys'](_0x1a98d6[_0xe507('0x33')]);_0x248ca5[_0xe507('0x35')]=_[_0xe507('0x36')](_0x248ca5[_0xe507('0x32')],_0x248ca5['query']);_0x2b424c[_0xe507('0x38')]=_[_0xe507('0x36')](_0x248ca5[_0xe507('0x32')],qs['fields'](_0x1a98d6['query']['fields']));_0x2b424c[_0xe507('0x38')]=_0x2b424c[_0xe507('0x38')][_0xe507('0x39')]?_0x2b424c[_0xe507('0x38')]:_0x248ca5[_0xe507('0x32')];if(_0x1a98d6[_0xe507('0x33')][_0xe507('0x45')]){_0x2b424c[_0xe507('0x46')]=[{'all':!![]}];}_0x2b424c=_[_0xe507('0x40')]({},_0x2b424c,_0x1a98d6[_0xe507('0x44')]);return db[_0xe507('0x4a')][_0xe507('0x4b')](_0x2b424c)[_0xe507('0x17')](handleEntityNotFound(_0x4edbec,null))[_0xe507('0x17')](respondWithResult(_0x4edbec,null))[_0xe507('0x49')](handleError(_0x4edbec,null));};exports['create']=function(_0x248cbe,_0x629a68){return db[_0xe507('0x4a')]['create'](_0x248cbe['body'],{})[_0xe507('0x17')](respondWithResult(_0x629a68,0xc9))[_0xe507('0x49')](handleError(_0x629a68,null));};exports[_0xe507('0x2a')]=function(_0x50e69a,_0x2e5764){if(_0x50e69a[_0xe507('0x4c')]['id']){delete _0x50e69a[_0xe507('0x4c')]['id'];}return db[_0xe507('0x4a')][_0xe507('0x4b')]({'where':{'id':_0x50e69a[_0xe507('0x4d')]['id']}})[_0xe507('0x17')](handleEntityNotFound(_0x2e5764,null))['then'](saveUpdates(_0x50e69a[_0xe507('0x4c')],null))[_0xe507('0x17')](respondWithResult(_0x2e5764,null))['catch'](handleError(_0x2e5764,null));};exports[_0xe507('0x4e')]=function(_0x32c969,_0x5f4a01){return db[_0xe507('0x4a')][_0xe507('0x4b')]({'where':{'id':_0x32c969[_0xe507('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f4a01,null))[_0xe507('0x17')](removeEntity(_0x5f4a01,null))['catch'](handleError(_0x5f4a01,null));};exports[_0xe507('0x4f')]=function(_0x13f6b1,_0x2d1e31,_0x509806){var _0x12623a={};var _0x22bc26={};var _0x4c5703;var _0x67cd56;return db[_0xe507('0x4a')][_0xe507('0x50')]({'where':{'id':_0x13f6b1[_0xe507('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2d1e31,null))[_0xe507('0x17')](function(_0x3a9d24){if(_0x3a9d24){_0x4c5703=_0x3a9d24;_0x22bc26['model']=_[_0xe507('0x34')](db[_0xe507('0x51')][_0xe507('0x30')]);_0x22bc26[_0xe507('0x33')]=_[_0xe507('0x34')](_0x13f6b1['query']);_0x22bc26['filters']=_['intersection'](_0x22bc26[_0xe507('0x32')],_0x22bc26[_0xe507('0x33')]);_0x12623a[_0xe507('0x38')]=_['intersection'](_0x22bc26[_0xe507('0x32')],qs[_0xe507('0x37')](_0x13f6b1[_0xe507('0x33')][_0xe507('0x37')]));_0x12623a[_0xe507('0x38')]=_0x12623a[_0xe507('0x38')][_0xe507('0x39')]?_0x12623a['attributes']:_0x22bc26[_0xe507('0x32')];_0x12623a['order']=qs[_0xe507('0x3d')](_0x13f6b1[_0xe507('0x33')][_0xe507('0x3d')]);_0x12623a[_0xe507('0x3e')]=qs[_0xe507('0x35')](_[_0xe507('0x3f')](_0x13f6b1[_0xe507('0x33')],_0x22bc26[_0xe507('0x35')]));if(_0x13f6b1[_0xe507('0x33')][_0xe507('0x43')]){_0x12623a[_0xe507('0x3e')]=_[_0xe507('0x40')](_0x12623a['where'],{'$or':_['map'](_0x12623a[_0xe507('0x38')],function(_0x36b864){var _0x24e5b4={};_0x24e5b4[_0x36b864]={'$like':'%'+_0x13f6b1[_0xe507('0x33')][_0xe507('0x43')]+'%'};return _0x24e5b4;})});}_0x12623a=_[_0xe507('0x40')]({},_0x12623a,_0x13f6b1[_0xe507('0x44')]);return _0x4c5703['getFields'](_0x12623a);}})[_0xe507('0x17')](function(_0xc44f4c){if(_0xc44f4c){_0x67cd56=_0xc44f4c['length'];if(!_0x13f6b1[_0xe507('0x33')][_0xe507('0x3a')](_0xe507('0x3b'))){_0x12623a['limit']=qs['limit'](_0x13f6b1[_0xe507('0x33')][_0xe507('0x26')]);_0x12623a[_0xe507('0x25')]=qs['offset'](_0x13f6b1[_0xe507('0x33')][_0xe507('0x25')]);}return _0x4c5703[_0xe507('0x4f')](_0x12623a);}})[_0xe507('0x17')](function(_0x3acac7){if(_0x3acac7){return _0x3acac7?{'count':_0x67cd56,'rows':_0x3acac7}:null;}})['then'](respondWithResult(_0x2d1e31,null))[_0xe507('0x49')](handleError(_0x2d1e31,null));};exports['getSubjects']=function(_0x2a802a,_0x40d283,_0x52e2be){var _0x379406={};var _0x353743={};var _0x2678e9;var _0x45c960;return db[_0xe507('0x4a')][_0xe507('0x50')]({'where':{'id':_0x2a802a[_0xe507('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40d283,null))[_0xe507('0x17')](function(_0x2033e0){if(_0x2033e0){_0x2678e9=_0x2033e0;_0x353743['model']=_[_0xe507('0x34')](db[_0xe507('0x51')]['rawAttributes']);_0x353743['query']=_[_0xe507('0x34')](_0x2a802a[_0xe507('0x33')]);_0x353743[_0xe507('0x35')]=_[_0xe507('0x36')](_0x353743[_0xe507('0x32')],_0x353743[_0xe507('0x33')]);_0x379406[_0xe507('0x38')]=_[_0xe507('0x36')](_0x353743[_0xe507('0x32')],qs[_0xe507('0x37')](_0x2a802a[_0xe507('0x33')][_0xe507('0x37')]));_0x379406['attributes']=_0x379406[_0xe507('0x38')][_0xe507('0x39')]?_0x379406['attributes']:_0x353743[_0xe507('0x32')];_0x379406[_0xe507('0x3c')]=qs[_0xe507('0x3d')](_0x2a802a[_0xe507('0x33')][_0xe507('0x3d')]);_0x379406[_0xe507('0x3e')]=qs['filters'](_[_0xe507('0x3f')](_0x2a802a['query'],_0x353743[_0xe507('0x35')]));if(_0x2a802a['query']['filter']){_0x379406['where']=_[_0xe507('0x40')](_0x379406[_0xe507('0x3e')],{'$or':_[_0xe507('0x2f')](_0x379406[_0xe507('0x38')],function(_0x2d891a){var _0x42e710={};_0x42e710[_0x2d891a]={'$like':'%'+_0x2a802a[_0xe507('0x33')][_0xe507('0x43')]+'%'};return _0x42e710;})});}_0x379406=_[_0xe507('0x40')]({},_0x379406,_0x2a802a[_0xe507('0x44')]);return _0x2678e9['getSubjects'](_0x379406);}})[_0xe507('0x17')](function(_0x3ed550){if(_0x3ed550){_0x45c960=_0x3ed550[_0xe507('0x39')];if(!_0x2a802a[_0xe507('0x33')]['hasOwnProperty'](_0xe507('0x3b'))){_0x379406[_0xe507('0x26')]=qs['limit'](_0x2a802a[_0xe507('0x33')][_0xe507('0x26')]);_0x379406[_0xe507('0x25')]=qs[_0xe507('0x25')](_0x2a802a[_0xe507('0x33')][_0xe507('0x25')]);}return _0x2678e9[_0xe507('0x52')](_0x379406);}})[_0xe507('0x17')](function(_0x3c0e71){if(_0x3c0e71){return _0x3c0e71?{'count':_0x45c960,'rows':_0x3c0e71}:null;}})[_0xe507('0x17')](respondWithResult(_0x40d283,null))[_0xe507('0x49')](handleError(_0x40d283,null));};exports['getDescriptions']=function(_0x95ace3,_0x577044,_0x569b54){var _0x4fb563={};var _0x3a3f8a={};var _0x16bebe;var _0x219353;return db['SalesforceConfiguration'][_0xe507('0x50')]({'where':{'id':_0x95ace3[_0xe507('0x4d')]['id']}})[_0xe507('0x17')](handleEntityNotFound(_0x577044,null))['then'](function(_0x50c7f9){if(_0x50c7f9){_0x16bebe=_0x50c7f9;_0x3a3f8a[_0xe507('0x32')]=_[_0xe507('0x34')](db['SalesforceField'][_0xe507('0x30')]);_0x3a3f8a[_0xe507('0x33')]=_[_0xe507('0x34')](_0x95ace3[_0xe507('0x33')]);_0x3a3f8a[_0xe507('0x35')]=_[_0xe507('0x36')](_0x3a3f8a[_0xe507('0x32')],_0x3a3f8a[_0xe507('0x33')]);_0x4fb563[_0xe507('0x38')]=_[_0xe507('0x36')](_0x3a3f8a['model'],qs[_0xe507('0x37')](_0x95ace3[_0xe507('0x33')][_0xe507('0x37')]));_0x4fb563['attributes']=_0x4fb563['attributes'][_0xe507('0x39')]?_0x4fb563[_0xe507('0x38')]:_0x3a3f8a[_0xe507('0x32')];_0x4fb563[_0xe507('0x3c')]=qs['sort'](_0x95ace3[_0xe507('0x33')]['sort']);_0x4fb563[_0xe507('0x3e')]=qs[_0xe507('0x35')](_[_0xe507('0x3f')](_0x95ace3[_0xe507('0x33')],_0x3a3f8a[_0xe507('0x35')]));if(_0x95ace3[_0xe507('0x33')][_0xe507('0x43')]){_0x4fb563['where']=_[_0xe507('0x40')](_0x4fb563[_0xe507('0x3e')],{'$or':_[_0xe507('0x2f')](_0x4fb563[_0xe507('0x38')],function(_0xf59177){var _0x335650={};_0x335650[_0xf59177]={'$like':'%'+_0x95ace3['query']['filter']+'%'};return _0x335650;})});}_0x4fb563=_['merge']({},_0x4fb563,_0x95ace3[_0xe507('0x44')]);return _0x16bebe['getDescriptions'](_0x4fb563);}})[_0xe507('0x17')](function(_0x6644b2){if(_0x6644b2){_0x219353=_0x6644b2[_0xe507('0x39')];if(!_0x95ace3[_0xe507('0x33')][_0xe507('0x3a')]('nolimit')){_0x4fb563[_0xe507('0x26')]=qs['limit'](_0x95ace3[_0xe507('0x33')]['limit']);_0x4fb563['offset']=qs[_0xe507('0x25')](_0x95ace3[_0xe507('0x33')][_0xe507('0x25')]);}return _0x16bebe[_0xe507('0x53')](_0x4fb563);}})[_0xe507('0x17')](function(_0x345854){if(_0x345854){return _0x345854?{'count':_0x219353,'rows':_0x345854}:null;}})['then'](respondWithResult(_0x577044,null))[_0xe507('0x49')](handleError(_0x577044,null));}; \ No newline at end of file +var _0x5ee4=['reject','save','update','destroy','stack','name','send','index','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','SalesforceConfiguration','find','body','findOne','SalesforceField','rawAttributes','order','sort','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x3cb9bc,_0x1c95f5){var _0x5d13ec=function(_0x12feae){while(--_0x12feae){_0x3cb9bc['push'](_0x3cb9bc['shift']());}};_0x5d13ec(++_0x1c95f5);}(_0x5ee4,0x1db));var _0x45ee=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5ee4[_0x178e48];return _0x440d7e;};'use strict';var pdf=require(_0x45ee('0x0'));var emlformat=require(_0x45ee('0x1'));var rimraf=require(_0x45ee('0x2'));var zipdir=require(_0x45ee('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45ee('0x4'));var moment=require(_0x45ee('0x5'));var BPromise=require(_0x45ee('0x6'));var Mustache=require(_0x45ee('0x7'));var util=require(_0x45ee('0x8'));var path=require(_0x45ee('0x9'));var sox=require('sox');var csv=require(_0x45ee('0xa'));var ejs=require(_0x45ee('0xb'));var fs=require('fs');var _=require(_0x45ee('0xc'));var squel=require(_0x45ee('0xd'));var crypto=require('crypto');var jsforce=require(_0x45ee('0xe'));var deskjs=require(_0x45ee('0xf'));var toCsv=require(_0x45ee('0xa'));var querystring=require(_0x45ee('0x10'));var Papa=require(_0x45ee('0x11'));var Redis=require(_0x45ee('0x12'));var authService=require(_0x45ee('0x13'));var qs=require(_0x45ee('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45ee('0x15'));var logger=require(_0x45ee('0x16'))(_0x45ee('0x17'));var utils=require(_0x45ee('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x45ee('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x45ee('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3ba17b,_0x1eac47,_0x16ef6c,_0x49978f){return new BPromise(function(_0xa81f40,_0xb4d9a2){var _0x4c76bd=_0x49978f||client;return _0x4c76bd[_0x45ee('0x1b')](_0x3ba17b,_0x16ef6c)[_0x45ee('0x1c')](function(_0x4d46ae){logger['info'](_0x45ee('0x1d'),_0x1eac47,_0x45ee('0x1e'));logger['debug'](_0x45ee('0x1f'),_0x1eac47,_0x45ee('0x1e'),JSON['stringify'](_0x4d46ae));if(_0x4d46ae[_0x45ee('0x20')]){if(_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x21')]===0x1f4){logger[_0x45ee('0x20')](_0x45ee('0x1d'),_0x1eac47,_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x22')]);return _0xb4d9a2(_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x22')]);}logger[_0x45ee('0x20')](_0x45ee('0x1d'),_0x1eac47,_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x22')]);return _0xa81f40(_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x22')]);}else{logger[_0x45ee('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1eac47,_0x45ee('0x1e'));_0xa81f40(_0x4d46ae['result'][_0x45ee('0x22')]);}})[_0x45ee('0x24')](function(_0xd40506){logger[_0x45ee('0x20')](_0x45ee('0x1d'),_0x1eac47,_0xd40506);_0xb4d9a2(_0xd40506);});});}function respondWithStatusCode(_0x5b9265,_0x1d4343){_0x1d4343=_0x1d4343||0xcc;return function(_0x1a2488){if(_0x1a2488){return _0x5b9265[_0x45ee('0x25')](_0x1d4343);}return _0x5b9265[_0x45ee('0x26')](_0x1d4343)[_0x45ee('0x27')]();};}function respondWithResult(_0x3e4cf3,_0x56dc66){_0x56dc66=_0x56dc66||0xc8;return function(_0xbc6e4e){if(_0xbc6e4e){return _0x3e4cf3[_0x45ee('0x26')](_0x56dc66)[_0x45ee('0x28')](_0xbc6e4e);}};}function respondWithFilteredResult(_0x330330,_0x55fbf4){return function(_0x3786a8){if(_0x3786a8){var _0x3126ba=_0x3786a8[_0x45ee('0x29')],_0x6a9efb=_0x55fbf4[_0x45ee('0x2a')],_0x548b61=_0x55fbf4[_0x45ee('0x2a')]+_0x55fbf4[_0x45ee('0x2b')],_0x120d7c;if(_0x548b61>=_0x3126ba){_0x548b61=_0x3126ba;_0x120d7c=0xc8;}else{_0x120d7c=0xce;}_0x330330[_0x45ee('0x26')](_0x120d7c);return _0x330330[_0x45ee('0x2c')](_0x45ee('0x2d'),_0x6a9efb+'-'+_0x548b61+'/'+_0x3126ba)[_0x45ee('0x28')](_0x3786a8);}return null;};}function patchUpdates(_0x307762){return function(_0x298c97){try{jsonpatch[_0x45ee('0x2e')](_0x298c97,_0x307762,!![]);}catch(_0x8e5b01){return BPromise[_0x45ee('0x2f')](_0x8e5b01);}return _0x298c97[_0x45ee('0x30')]();};}function saveUpdates(_0x348051,_0x36bdb7){return function(_0x37dceb){if(_0x37dceb){return _0x37dceb[_0x45ee('0x31')](_0x348051)[_0x45ee('0x1c')](function(_0x44c404){return _0x44c404;});}return null;};}function removeEntity(_0x2993d2,_0x2a5c00){return function(_0x4b347e){if(_0x4b347e){return _0x4b347e[_0x45ee('0x32')]()[_0x45ee('0x1c')](function(){_0x2993d2['status'](0xcc)[_0x45ee('0x27')]();});}};}function handleEntityNotFound(_0x5c6a7b,_0x5e27b8){return function(_0x25e3d7){if(!_0x25e3d7){_0x5c6a7b['sendStatus'](0x194);}return _0x25e3d7;};}function handleError(_0x1032f1,_0xb4230d){_0xb4230d=_0xb4230d||0x1f4;return function(_0x4ecba8){logger[_0x45ee('0x20')](_0x4ecba8[_0x45ee('0x33')]);if(_0x4ecba8['name']){delete _0x4ecba8[_0x45ee('0x34')];}_0x1032f1['status'](_0xb4230d)[_0x45ee('0x35')](_0x4ecba8);};}exports[_0x45ee('0x36')]=function(_0x45e618,_0x113fff){var _0x886ebe={},_0x146de4={},_0x11444b={'count':0x0,'rows':[]};var _0x2c8682=_[_0x45ee('0x37')](db['SalesforceConfiguration']['rawAttributes'],function(_0x2d95ea){return{'name':_0x2d95ea['fieldName'],'type':_0x2d95ea['type']['key']};});_0x146de4['model']=_[_0x45ee('0x37')](_0x2c8682,'name');_0x146de4[_0x45ee('0x38')]=_[_0x45ee('0x39')](_0x45e618[_0x45ee('0x38')]);_0x146de4[_0x45ee('0x3a')]=_[_0x45ee('0x3b')](_0x146de4[_0x45ee('0x3c')],_0x146de4[_0x45ee('0x38')]);_0x886ebe[_0x45ee('0x3d')]=_[_0x45ee('0x3b')](_0x146de4[_0x45ee('0x3c')],qs[_0x45ee('0x3e')](_0x45e618[_0x45ee('0x38')][_0x45ee('0x3e')]));_0x886ebe['attributes']=_0x886ebe[_0x45ee('0x3d')][_0x45ee('0x3f')]?_0x886ebe[_0x45ee('0x3d')]:_0x146de4['model'];if(!_0x45e618[_0x45ee('0x38')][_0x45ee('0x40')](_0x45ee('0x41'))){_0x886ebe[_0x45ee('0x2b')]=qs[_0x45ee('0x2b')](_0x45e618[_0x45ee('0x38')]['limit']);_0x886ebe[_0x45ee('0x2a')]=qs[_0x45ee('0x2a')](_0x45e618[_0x45ee('0x38')][_0x45ee('0x2a')]);}_0x886ebe['order']=qs['sort'](_0x45e618[_0x45ee('0x38')]['sort']);_0x886ebe[_0x45ee('0x42')]=qs[_0x45ee('0x3a')](_[_0x45ee('0x43')](_0x45e618[_0x45ee('0x38')],_0x146de4[_0x45ee('0x3a')]),_0x2c8682);if(_0x45e618['query'][_0x45ee('0x44')]){_0x886ebe[_0x45ee('0x42')]=_['merge'](_0x886ebe[_0x45ee('0x42')],{'$or':_[_0x45ee('0x37')](_0x2c8682,function(_0x4b4679){if(_0x4b4679['type']!=='VIRTUAL'){var _0x534031={};_0x534031[_0x4b4679[_0x45ee('0x34')]]={'$like':'%'+_0x45e618[_0x45ee('0x38')][_0x45ee('0x44')]+'%'};return _0x534031;}})});}_0x886ebe=_[_0x45ee('0x45')]({},_0x886ebe,_0x45e618[_0x45ee('0x46')]);var _0x2e238f={'where':_0x886ebe['where']};return db['SalesforceConfiguration'][_0x45ee('0x29')](_0x2e238f)['then'](function(_0xa57ee4){_0x11444b[_0x45ee('0x29')]=_0xa57ee4;if(_0x45e618[_0x45ee('0x38')][_0x45ee('0x47')]){_0x886ebe['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x45ee('0x48')](_0x886ebe);})[_0x45ee('0x1c')](function(_0x1b2daf){_0x11444b[_0x45ee('0x49')]=_0x1b2daf;return _0x11444b;})['then'](respondWithFilteredResult(_0x113fff,_0x886ebe))[_0x45ee('0x24')](handleError(_0x113fff,null));};exports[_0x45ee('0x4a')]=function(_0xd18d79,_0x391e43){var _0x249dfb={'raw':![],'where':{'id':_0xd18d79[_0x45ee('0x4b')]['id']}},_0x17afca={};_0x17afca[_0x45ee('0x3c')]=_[_0x45ee('0x39')](db[_0x45ee('0x4c')]['rawAttributes']);_0x17afca[_0x45ee('0x38')]=_['keys'](_0xd18d79[_0x45ee('0x38')]);_0x17afca[_0x45ee('0x3a')]=_[_0x45ee('0x3b')](_0x17afca[_0x45ee('0x3c')],_0x17afca[_0x45ee('0x38')]);_0x249dfb[_0x45ee('0x3d')]=_['intersection'](_0x17afca['model'],qs[_0x45ee('0x3e')](_0xd18d79['query'][_0x45ee('0x3e')]));_0x249dfb[_0x45ee('0x3d')]=_0x249dfb[_0x45ee('0x3d')][_0x45ee('0x3f')]?_0x249dfb[_0x45ee('0x3d')]:_0x17afca[_0x45ee('0x3c')];if(_0xd18d79['query'][_0x45ee('0x47')]){_0x249dfb['include']=[{'all':!![]}];}_0x249dfb=_['merge']({},_0x249dfb,_0xd18d79[_0x45ee('0x46')]);return db['SalesforceConfiguration'][_0x45ee('0x4d')](_0x249dfb)[_0x45ee('0x1c')](handleEntityNotFound(_0x391e43,null))[_0x45ee('0x1c')](respondWithResult(_0x391e43,null))[_0x45ee('0x24')](handleError(_0x391e43,null));};exports['create']=function(_0xb7e263,_0x135123){return db[_0x45ee('0x4c')]['create'](_0xb7e263['body'],{})[_0x45ee('0x1c')](respondWithResult(_0x135123,0xc9))['catch'](handleError(_0x135123,null));};exports[_0x45ee('0x31')]=function(_0x41fee8,_0x1b373c){if(_0x41fee8[_0x45ee('0x4e')]['id']){delete _0x41fee8[_0x45ee('0x4e')]['id'];}return db[_0x45ee('0x4c')][_0x45ee('0x4d')]({'where':{'id':_0x41fee8[_0x45ee('0x4b')]['id']}})[_0x45ee('0x1c')](handleEntityNotFound(_0x1b373c,null))[_0x45ee('0x1c')](saveUpdates(_0x41fee8[_0x45ee('0x4e')],null))[_0x45ee('0x1c')](respondWithResult(_0x1b373c,null))[_0x45ee('0x24')](handleError(_0x1b373c,null));};exports[_0x45ee('0x32')]=function(_0x1f5854,_0x2eeed8){return db['SalesforceConfiguration'][_0x45ee('0x4d')]({'where':{'id':_0x1f5854[_0x45ee('0x4b')]['id']}})[_0x45ee('0x1c')](handleEntityNotFound(_0x2eeed8,null))['then'](removeEntity(_0x2eeed8,null))['catch'](handleError(_0x2eeed8,null));};exports['getFields']=function(_0x2da4fb,_0x25d04d,_0x5ef2d9){var _0x20c19e={};var _0xbd4775={};var _0x2199fb;var _0x460906;return db[_0x45ee('0x4c')][_0x45ee('0x4f')]({'where':{'id':_0x2da4fb[_0x45ee('0x4b')]['id']}})[_0x45ee('0x1c')](handleEntityNotFound(_0x25d04d,null))['then'](function(_0x197e4e){if(_0x197e4e){_0x2199fb=_0x197e4e;_0xbd4775[_0x45ee('0x3c')]=_['keys'](db[_0x45ee('0x50')][_0x45ee('0x51')]);_0xbd4775[_0x45ee('0x38')]=_[_0x45ee('0x39')](_0x2da4fb['query']);_0xbd4775[_0x45ee('0x3a')]=_[_0x45ee('0x3b')](_0xbd4775[_0x45ee('0x3c')],_0xbd4775[_0x45ee('0x38')]);_0x20c19e['attributes']=_[_0x45ee('0x3b')](_0xbd4775[_0x45ee('0x3c')],qs[_0x45ee('0x3e')](_0x2da4fb[_0x45ee('0x38')]['fields']));_0x20c19e[_0x45ee('0x3d')]=_0x20c19e[_0x45ee('0x3d')][_0x45ee('0x3f')]?_0x20c19e[_0x45ee('0x3d')]:_0xbd4775[_0x45ee('0x3c')];_0x20c19e[_0x45ee('0x52')]=qs['sort'](_0x2da4fb[_0x45ee('0x38')][_0x45ee('0x53')]);_0x20c19e[_0x45ee('0x42')]=qs[_0x45ee('0x3a')](_['pick'](_0x2da4fb[_0x45ee('0x38')],_0xbd4775[_0x45ee('0x3a')]));if(_0x2da4fb['query'][_0x45ee('0x44')]){_0x20c19e[_0x45ee('0x42')]=_[_0x45ee('0x45')](_0x20c19e[_0x45ee('0x42')],{'$or':_[_0x45ee('0x37')](_0x20c19e['attributes'],function(_0x20f286){var _0x13246a={};_0x13246a[_0x20f286]={'$like':'%'+_0x2da4fb['query'][_0x45ee('0x44')]+'%'};return _0x13246a;})});}_0x20c19e=_[_0x45ee('0x45')]({},_0x20c19e,_0x2da4fb[_0x45ee('0x46')]);return _0x2199fb['getFields'](_0x20c19e);}})[_0x45ee('0x1c')](function(_0x23a879){if(_0x23a879){_0x460906=_0x23a879['length'];if(!_0x2da4fb[_0x45ee('0x38')][_0x45ee('0x40')](_0x45ee('0x41'))){_0x20c19e['limit']=qs[_0x45ee('0x2b')](_0x2da4fb[_0x45ee('0x38')][_0x45ee('0x2b')]);_0x20c19e[_0x45ee('0x2a')]=qs[_0x45ee('0x2a')](_0x2da4fb[_0x45ee('0x38')]['offset']);}return _0x2199fb[_0x45ee('0x54')](_0x20c19e);}})[_0x45ee('0x1c')](function(_0x4fcbe9){if(_0x4fcbe9){return _0x4fcbe9?{'count':_0x460906,'rows':_0x4fcbe9}:null;}})['then'](respondWithResult(_0x25d04d,null))[_0x45ee('0x24')](handleError(_0x25d04d,null));};exports['getSubjects']=function(_0x4bb725,_0x232434,_0x3f7b5d){var _0x27e49e={};var _0x58eaf3={};var _0x437110;var _0x33f4d4;return db[_0x45ee('0x4c')]['findOne']({'where':{'id':_0x4bb725['params']['id']}})['then'](handleEntityNotFound(_0x232434,null))[_0x45ee('0x1c')](function(_0x231f81){if(_0x231f81){_0x437110=_0x231f81;_0x58eaf3['model']=_[_0x45ee('0x39')](db[_0x45ee('0x50')][_0x45ee('0x51')]);_0x58eaf3[_0x45ee('0x38')]=_[_0x45ee('0x39')](_0x4bb725[_0x45ee('0x38')]);_0x58eaf3[_0x45ee('0x3a')]=_[_0x45ee('0x3b')](_0x58eaf3[_0x45ee('0x3c')],_0x58eaf3['query']);_0x27e49e[_0x45ee('0x3d')]=_[_0x45ee('0x3b')](_0x58eaf3[_0x45ee('0x3c')],qs[_0x45ee('0x3e')](_0x4bb725[_0x45ee('0x38')][_0x45ee('0x3e')]));_0x27e49e[_0x45ee('0x3d')]=_0x27e49e['attributes']['length']?_0x27e49e[_0x45ee('0x3d')]:_0x58eaf3[_0x45ee('0x3c')];_0x27e49e[_0x45ee('0x52')]=qs[_0x45ee('0x53')](_0x4bb725[_0x45ee('0x38')]['sort']);_0x27e49e[_0x45ee('0x42')]=qs[_0x45ee('0x3a')](_['pick'](_0x4bb725[_0x45ee('0x38')],_0x58eaf3[_0x45ee('0x3a')]));if(_0x4bb725[_0x45ee('0x38')][_0x45ee('0x44')]){_0x27e49e[_0x45ee('0x42')]=_[_0x45ee('0x45')](_0x27e49e[_0x45ee('0x42')],{'$or':_[_0x45ee('0x37')](_0x27e49e['attributes'],function(_0x5793a3){var _0x18aa31={};_0x18aa31[_0x5793a3]={'$like':'%'+_0x4bb725[_0x45ee('0x38')][_0x45ee('0x44')]+'%'};return _0x18aa31;})});}_0x27e49e=_[_0x45ee('0x45')]({},_0x27e49e,_0x4bb725['options']);return _0x437110['getSubjects'](_0x27e49e);}})['then'](function(_0x9c6a97){if(_0x9c6a97){_0x33f4d4=_0x9c6a97[_0x45ee('0x3f')];if(!_0x4bb725[_0x45ee('0x38')][_0x45ee('0x40')](_0x45ee('0x41'))){_0x27e49e[_0x45ee('0x2b')]=qs[_0x45ee('0x2b')](_0x4bb725[_0x45ee('0x38')][_0x45ee('0x2b')]);_0x27e49e[_0x45ee('0x2a')]=qs[_0x45ee('0x2a')](_0x4bb725[_0x45ee('0x38')][_0x45ee('0x2a')]);}return _0x437110[_0x45ee('0x55')](_0x27e49e);}})[_0x45ee('0x1c')](function(_0x2b3f3a){if(_0x2b3f3a){return _0x2b3f3a?{'count':_0x33f4d4,'rows':_0x2b3f3a}:null;}})[_0x45ee('0x1c')](respondWithResult(_0x232434,null))[_0x45ee('0x24')](handleError(_0x232434,null));};exports[_0x45ee('0x56')]=function(_0x3d181a,_0x528d29,_0x58eec6){var _0x5d3322={};var _0x486ef={};var _0x305d25;var _0x3f98df;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3d181a[_0x45ee('0x4b')]['id']}})[_0x45ee('0x1c')](handleEntityNotFound(_0x528d29,null))[_0x45ee('0x1c')](function(_0xb8a256){if(_0xb8a256){_0x305d25=_0xb8a256;_0x486ef[_0x45ee('0x3c')]=_[_0x45ee('0x39')](db[_0x45ee('0x50')][_0x45ee('0x51')]);_0x486ef['query']=_[_0x45ee('0x39')](_0x3d181a['query']);_0x486ef[_0x45ee('0x3a')]=_['intersection'](_0x486ef[_0x45ee('0x3c')],_0x486ef['query']);_0x5d3322[_0x45ee('0x3d')]=_[_0x45ee('0x3b')](_0x486ef[_0x45ee('0x3c')],qs[_0x45ee('0x3e')](_0x3d181a[_0x45ee('0x38')]['fields']));_0x5d3322[_0x45ee('0x3d')]=_0x5d3322[_0x45ee('0x3d')][_0x45ee('0x3f')]?_0x5d3322['attributes']:_0x486ef[_0x45ee('0x3c')];_0x5d3322[_0x45ee('0x52')]=qs[_0x45ee('0x53')](_0x3d181a[_0x45ee('0x38')][_0x45ee('0x53')]);_0x5d3322[_0x45ee('0x42')]=qs[_0x45ee('0x3a')](_['pick'](_0x3d181a['query'],_0x486ef[_0x45ee('0x3a')]));if(_0x3d181a[_0x45ee('0x38')][_0x45ee('0x44')]){_0x5d3322['where']=_['merge'](_0x5d3322[_0x45ee('0x42')],{'$or':_[_0x45ee('0x37')](_0x5d3322['attributes'],function(_0x3951de){var _0x431259={};_0x431259[_0x3951de]={'$like':'%'+_0x3d181a[_0x45ee('0x38')][_0x45ee('0x44')]+'%'};return _0x431259;})});}_0x5d3322=_[_0x45ee('0x45')]({},_0x5d3322,_0x3d181a['options']);return _0x305d25[_0x45ee('0x56')](_0x5d3322);}})[_0x45ee('0x1c')](function(_0xaec76c){if(_0xaec76c){_0x3f98df=_0xaec76c[_0x45ee('0x3f')];if(!_0x3d181a['query'][_0x45ee('0x40')]('nolimit')){_0x5d3322[_0x45ee('0x2b')]=qs[_0x45ee('0x2b')](_0x3d181a[_0x45ee('0x38')][_0x45ee('0x2b')]);_0x5d3322[_0x45ee('0x2a')]=qs[_0x45ee('0x2a')](_0x3d181a['query'][_0x45ee('0x2a')]);}return _0x305d25[_0x45ee('0x56')](_0x5d3322);}})[_0x45ee('0x1c')](function(_0x5772de){if(_0x5772de){return _0x5772de?{'count':_0x3f98df,'rows':_0x5772de}:null;}})[_0x45ee('0x1c')](respondWithResult(_0x528d29,null))['catch'](handleError(_0x528d29,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e3294ac..36706ca 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf92=['SalesforceConfiguration','int_salesforce_configurations','lodash','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x44bd0c,_0x2f6a6f){var _0x223b44=function(_0x23cfd0){while(--_0x23cfd0){_0x44bd0c['push'](_0x44bd0c['shift']());}};_0x223b44(++_0x2f6a6f);}(_0xcf92,0xba));var _0x2cf9=function(_0xf9d3a7,_0x300fe6){_0xf9d3a7=_0xf9d3a7-0x0;var _0x17bf5a=_0xcf92[_0xf9d3a7];return _0x17bf5a;};'use strict';var _=require(_0x2cf9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2cf9('0x1'));var moment=require(_0x2cf9('0x2'));var BPromise=require(_0x2cf9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2cf9('0x4'));var config=require(_0x2cf9('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x12116e,_0x18b656){return _0x12116e['define'](_0x2cf9('0x6'),attributes,{'tableName':_0x2cf9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2ac=['./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc2ac,0xe8));var _0xcc2a=function(_0x4b438a,_0x1a45dd){_0x4b438a=_0x4b438a-0x0;var _0x2704e1=_0xc2ac[_0x4b438a];return _0x2704e1;};'use strict';var _=require('lodash');var util=require(_0xcc2a('0x0'));var logger=require(_0xcc2a('0x1'))(_0xcc2a('0x2'));var moment=require(_0xcc2a('0x3'));var BPromise=require(_0xcc2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc2a('0x5'));var rimraf=require(_0xcc2a('0x6'));var config=require(_0xcc2a('0x7'));var attributes=require(_0xcc2a('0x8'));module['exports']=function(_0x27d301,_0x188a23){return _0x27d301[_0xcc2a('0x9')](_0xcc2a('0xa'),attributes,{'tableName':_0xcc2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index ba39894..75eb5c5 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c52=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x467b79,_0x4fd888){var _0x310131=function(_0x55255f){while(--_0x55255f){_0x467b79['push'](_0x467b79['shift']());}};_0x310131(++_0x4fd888);}(_0x6c52,0x1c7));var _0x26c5=function(_0x4c0620,_0x59846d){_0x4c0620=_0x4c0620-0x0;var _0x11d3c2=_0x6c52[_0x4c0620];return _0x11d3c2;};'use strict';var _=require(_0x26c5('0x0'));var util=require(_0x26c5('0x1'));var moment=require(_0x26c5('0x2'));var BPromise=require(_0x26c5('0x3'));var rs=require(_0x26c5('0x4'));var fs=require('fs');var Redis=require(_0x26c5('0x5'));var db=require(_0x26c5('0x6'))['db'];var utils=require(_0x26c5('0x7'));var logger=require(_0x26c5('0x8'))('rpc');var config=require(_0x26c5('0x9'));var jayson=require(_0x26c5('0xa'));var client=jayson[_0x26c5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44e826,_0x51fd17,_0x56ff9e){return new BPromise(function(_0x74249f,_0x41f753){return client[_0x26c5('0xc')](_0x44e826,_0x56ff9e)['then'](function(_0x87a5a5){logger[_0x26c5('0xd')](_0x26c5('0xe'),_0x51fd17,_0x26c5('0xf'));logger['debug'](_0x26c5('0x10'),_0x51fd17,_0x26c5('0xf'),JSON['stringify'](_0x87a5a5));if(_0x87a5a5[_0x26c5('0x11')]){if(_0x87a5a5['error'][_0x26c5('0x12')]===0x1f4){logger[_0x26c5('0x11')](_0x26c5('0xe'),_0x51fd17,_0x87a5a5[_0x26c5('0x11')][_0x26c5('0x13')]);return _0x41f753(_0x87a5a5['error']['message']);}logger[_0x26c5('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x51fd17,_0x87a5a5[_0x26c5('0x11')][_0x26c5('0x13')]);return _0x74249f(_0x87a5a5[_0x26c5('0x11')]['message']);}else{logger[_0x26c5('0xd')](_0x26c5('0xe'),_0x51fd17,'request\x20sent');_0x74249f(_0x87a5a5[_0x26c5('0x14')][_0x26c5('0x13')]);}})['catch'](function(_0x4b74fc){logger[_0x26c5('0x11')](_0x26c5('0xe'),_0x51fd17,_0x4b74fc);_0x41f753(_0x4b74fc);});});} \ No newline at end of file +var _0xb476=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x25c251,_0x1dfab3){var _0x39ab55=function(_0x5752e4){while(--_0x5752e4){_0x25c251['push'](_0x25c251['shift']());}};_0x39ab55(++_0x1dfab3);}(_0xb476,0x14f));var _0x6b47=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xb476[_0x303c30];return _0x43161b;};'use strict';var _=require(_0x6b47('0x0'));var util=require(_0x6b47('0x1'));var moment=require(_0x6b47('0x2'));var BPromise=require(_0x6b47('0x3'));var rs=require(_0x6b47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b47('0x5'))['db'];var utils=require(_0x6b47('0x6'));var logger=require('../../config/logger')(_0x6b47('0x7'));var config=require(_0x6b47('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6b47('0x9')][_0x6b47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1abad1,_0x47921b,_0x367e11){return new BPromise(function(_0x5566f0,_0x59a192){return client[_0x6b47('0xb')](_0x1abad1,_0x367e11)[_0x6b47('0xc')](function(_0x369b9e){logger[_0x6b47('0xd')](_0x6b47('0xe'),_0x47921b,_0x6b47('0xf'));logger[_0x6b47('0x10')](_0x6b47('0x11'),_0x47921b,'request\x20sent',JSON[_0x6b47('0x12')](_0x369b9e));if(_0x369b9e[_0x6b47('0x13')]){if(_0x369b9e['error'][_0x6b47('0x14')]===0x1f4){logger[_0x6b47('0x13')](_0x6b47('0xe'),_0x47921b,_0x369b9e['error'][_0x6b47('0x15')]);return _0x59a192(_0x369b9e['error']['message']);}logger[_0x6b47('0x13')](_0x6b47('0xe'),_0x47921b,_0x369b9e[_0x6b47('0x13')][_0x6b47('0x15')]);return _0x5566f0(_0x369b9e[_0x6b47('0x13')][_0x6b47('0x15')]);}else{logger[_0x6b47('0xd')](_0x6b47('0xe'),_0x47921b,'request\x20sent');_0x5566f0(_0x369b9e[_0x6b47('0x16')][_0x6b47('0x15')]);}})[_0x6b47('0x17')](function(_0x31c2df){logger[_0x6b47('0x13')](_0x6b47('0xe'),_0x47921b,_0x31c2df);_0x59a192(_0x31c2df);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index f5f6310..2f4ce42 100644 --- a/server/api/intSalesforceField/index.js +++ b/server/api/intSalesforceField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x687b,0x14a));var _0xb687=function(_0x2d7b03,_0x232c07){_0x2d7b03=_0x2d7b03-0x0;var _0x4b6eb8=_0x687b[_0x2d7b03];return _0x4b6eb8;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file +var _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x326f,0xd1));var _0xf326=function(_0x3bde9f,_0x504ef9){_0x3bde9f=_0x3bde9f-0x0;var _0xe539cd=_0x326f[_0x3bde9f];return _0xe539cd;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 61e2753..e574ee6 100644 --- a/server/api/intSalesforceField/intSalesforceField.attributes.js +++ b/server/api/intSalesforceField/intSalesforceField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a3d=['keyValue','string','STRING','variable','customVariable','sequelize','exports','ENUM'];(function(_0x371be9,_0x4f4f75){var _0x91dfd6=function(_0x148f7b){while(--_0x148f7b){_0x371be9['push'](_0x371be9['shift']());}};_0x91dfd6(++_0x4f4f75);}(_0x6a3d,0x75));var _0xd6a3=function(_0x373ba3,_0x265ccc){_0x373ba3=_0x373ba3-0x0;var _0x151f21=_0x6a3d[_0x373ba3];return _0x151f21;};'use strict';var Sequelize=require(_0xd6a3('0x0'));module[_0xd6a3('0x1')]={'type':{'type':Sequelize[_0xd6a3('0x2')]('string','variable','customVariable',_0xd6a3('0x3')),'defaultValue':_0xd6a3('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd6a3('0x5')]},'keyType':{'type':Sequelize[_0xd6a3('0x2')](_0xd6a3('0x4'),_0xd6a3('0x6'),_0xd6a3('0x7'))},'keyContent':{'type':Sequelize[_0xd6a3('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xd6a3('0x5')]}}; \ No newline at end of file +var _0xb2a1=['STRING','sequelize','ENUM','variable','keyValue','string','customVariable'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xb2a1,0x1cf));var _0x1b2a=function(_0x35e57e,_0x383e9b){_0x35e57e=_0x35e57e-0x0;var _0x2a6e43=_0xb2a1[_0x35e57e];return _0x2a6e43;};'use strict';var Sequelize=require(_0x1b2a('0x0'));module['exports']={'type':{'type':Sequelize[_0x1b2a('0x1')]('string',_0x1b2a('0x2'),'customVariable',_0x1b2a('0x3')),'defaultValue':_0x1b2a('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1b2a('0x1')](_0x1b2a('0x4'),_0x1b2a('0x2'),_0x1b2a('0x5'))},'keyContent':{'type':Sequelize[_0x1b2a('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 4f3ad4d..e09919d 100644 --- a/server/api/intSalesforceField/intSalesforceField.controller.js +++ b/server/api/intSalesforceField/intSalesforceField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ce7=['path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceField','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','eml-format','zip-dir','moment','mustache','util'];(function(_0xa7bb73,_0x3f946f){var _0x47acf4=function(_0x54a64b){while(--_0x54a64b){_0xa7bb73['push'](_0xa7bb73['shift']());}};_0x47acf4(++_0x3f946f);}(_0x7ce7,0x8d));var _0x77ce=function(_0x39cc1c,_0x12acfc){_0x39cc1c=_0x39cc1c-0x0;var _0x4f3be5=_0x7ce7[_0x39cc1c];return _0x4f3be5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x77ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x77ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77ce('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x77ce('0x3'));var util=require(_0x77ce('0x4'));var path=require(_0x77ce('0x5'));var sox=require(_0x77ce('0x6'));var csv=require(_0x77ce('0x7'));var ejs=require(_0x77ce('0x8'));var fs=require('fs');var _=require(_0x77ce('0x9'));var squel=require(_0x77ce('0xa'));var crypto=require('crypto');var jsforce=require(_0x77ce('0xb'));var deskjs=require(_0x77ce('0xc'));var toCsv=require(_0x77ce('0x7'));var querystring=require(_0x77ce('0xd'));var Papa=require(_0x77ce('0xe'));var Redis=require(_0x77ce('0xf'));var authService=require(_0x77ce('0x10'));var qs=require(_0x77ce('0x11'));var as=require(_0x77ce('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77ce('0x13'))(_0x77ce('0x14'));var utils=require(_0x77ce('0x15'));var config=require(_0x77ce('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x77ce('0x17'))['db'];function respondWithStatusCode(_0xb0dee9,_0x743278){_0x743278=_0x743278||0xcc;return function(_0x1c9b4c){if(_0x1c9b4c){return _0xb0dee9['sendStatus'](_0x743278);}return _0xb0dee9['status'](_0x743278)[_0x77ce('0x18')]();};}function respondWithResult(_0x4d67b0,_0x436e9c){_0x436e9c=_0x436e9c||0xc8;return function(_0x48cd08){if(_0x48cd08){return _0x4d67b0[_0x77ce('0x19')](_0x436e9c)['json'](_0x48cd08);}};}function respondWithFilteredResult(_0x326b80,_0xeead94){return function(_0x4e8ed0){if(_0x4e8ed0){var _0x54605b=_0x4e8ed0[_0x77ce('0x1a')],_0x3c753d=_0xeead94['offset'],_0x254cac=_0xeead94[_0x77ce('0x1b')]+_0xeead94[_0x77ce('0x1c')],_0x1244fa;if(_0x254cac>=_0x54605b){_0x254cac=_0x54605b;_0x1244fa=0xc8;}else{_0x1244fa=0xce;}_0x326b80[_0x77ce('0x19')](_0x1244fa);return _0x326b80[_0x77ce('0x1d')](_0x77ce('0x1e'),_0x3c753d+'-'+_0x254cac+'/'+_0x54605b)[_0x77ce('0x1f')](_0x4e8ed0);}return null;};}function patchUpdates(_0x359295){return function(_0x17f98d){try{jsonpatch[_0x77ce('0x20')](_0x17f98d,_0x359295,!![]);}catch(_0x33af92){return BPromise[_0x77ce('0x21')](_0x33af92);}return _0x17f98d[_0x77ce('0x22')]();};}function saveUpdates(_0x503965,_0x2df14a){return function(_0x388b5d){if(_0x388b5d){return _0x388b5d[_0x77ce('0x23')](_0x503965)[_0x77ce('0x24')](function(_0x121242){return _0x121242;});}return null;};}function removeEntity(_0x2aed98,_0x59efa9){return function(_0x15c6af){if(_0x15c6af){return _0x15c6af[_0x77ce('0x25')]()['then'](function(){_0x2aed98['status'](0xcc)[_0x77ce('0x18')]();});}};}function handleEntityNotFound(_0x42fa41,_0x28a2ca){return function(_0x35954d){if(!_0x35954d){_0x42fa41['sendStatus'](0x194);}return _0x35954d;};}function handleError(_0x3291a9,_0x3f41b3){_0x3f41b3=_0x3f41b3||0x1f4;return function(_0x2c2c2a){logger[_0x77ce('0x26')](_0x2c2c2a[_0x77ce('0x27')]);if(_0x2c2c2a[_0x77ce('0x28')]){delete _0x2c2c2a['name'];}_0x3291a9['status'](_0x3f41b3)[_0x77ce('0x29')](_0x2c2c2a);};}exports[_0x77ce('0x2a')]=function(_0x50876,_0x4b5d3e){var _0x5a086b={},_0x31a20c={},_0xc512d={'count':0x0,'rows':[]};var _0x27839b=_[_0x77ce('0x2b')](db[_0x77ce('0x2c')]['rawAttributes'],function(_0x405bcf){return{'name':_0x405bcf['fieldName'],'type':_0x405bcf[_0x77ce('0x2d')]['key']};});_0x31a20c[_0x77ce('0x2e')]=_[_0x77ce('0x2b')](_0x27839b,'name');_0x31a20c['query']=_[_0x77ce('0x2f')](_0x50876['query']);_0x31a20c[_0x77ce('0x30')]=_[_0x77ce('0x31')](_0x31a20c['model'],_0x31a20c[_0x77ce('0x32')]);_0x5a086b[_0x77ce('0x33')]=_[_0x77ce('0x31')](_0x31a20c['model'],qs['fields'](_0x50876[_0x77ce('0x32')][_0x77ce('0x34')]));_0x5a086b['attributes']=_0x5a086b[_0x77ce('0x33')][_0x77ce('0x35')]?_0x5a086b[_0x77ce('0x33')]:_0x31a20c[_0x77ce('0x2e')];if(!_0x50876['query'][_0x77ce('0x36')](_0x77ce('0x37'))){_0x5a086b[_0x77ce('0x1c')]=qs['limit'](_0x50876[_0x77ce('0x32')][_0x77ce('0x1c')]);_0x5a086b[_0x77ce('0x1b')]=qs[_0x77ce('0x1b')](_0x50876[_0x77ce('0x32')][_0x77ce('0x1b')]);}_0x5a086b[_0x77ce('0x38')]=qs['sort'](_0x50876[_0x77ce('0x32')][_0x77ce('0x39')]);_0x5a086b[_0x77ce('0x3a')]=qs['filters'](_[_0x77ce('0x3b')](_0x50876[_0x77ce('0x32')],_0x31a20c['filters']),_0x27839b);if(_0x50876[_0x77ce('0x32')][_0x77ce('0x3c')]){_0x5a086b[_0x77ce('0x3a')]=_['merge'](_0x5a086b[_0x77ce('0x3a')],{'$or':_[_0x77ce('0x2b')](_0x27839b,function(_0x652080){if(_0x652080['type']!=='VIRTUAL'){var _0x22f3e9={};_0x22f3e9[_0x652080['name']]={'$like':'%'+_0x50876[_0x77ce('0x32')][_0x77ce('0x3c')]+'%'};return _0x22f3e9;}})});}_0x5a086b=_[_0x77ce('0x3d')]({},_0x5a086b,_0x50876[_0x77ce('0x3e')]);var _0x413a50={'where':_0x5a086b['where']};return db[_0x77ce('0x2c')][_0x77ce('0x1a')](_0x413a50)['then'](function(_0x40782d){_0xc512d[_0x77ce('0x1a')]=_0x40782d;if(_0x50876['query'][_0x77ce('0x3f')]){_0x5a086b[_0x77ce('0x40')]=[{'all':!![]}];}return db[_0x77ce('0x2c')][_0x77ce('0x41')](_0x5a086b);})['then'](function(_0x550a61){_0xc512d[_0x77ce('0x42')]=_0x550a61;return _0xc512d;})[_0x77ce('0x24')](respondWithFilteredResult(_0x4b5d3e,_0x5a086b))[_0x77ce('0x43')](handleError(_0x4b5d3e,null));};exports['show']=function(_0x21e5db,_0x39beba){var _0x4a82eb={'raw':!![],'where':{'id':_0x21e5db[_0x77ce('0x44')]['id']}},_0x2a3d00={};_0x2a3d00[_0x77ce('0x2e')]=_[_0x77ce('0x2f')](db[_0x77ce('0x2c')][_0x77ce('0x45')]);_0x2a3d00[_0x77ce('0x32')]=_['keys'](_0x21e5db[_0x77ce('0x32')]);_0x2a3d00['filters']=_[_0x77ce('0x31')](_0x2a3d00['model'],_0x2a3d00['query']);_0x4a82eb['attributes']=_[_0x77ce('0x31')](_0x2a3d00[_0x77ce('0x2e')],qs['fields'](_0x21e5db[_0x77ce('0x32')][_0x77ce('0x34')]));_0x4a82eb['attributes']=_0x4a82eb[_0x77ce('0x33')][_0x77ce('0x35')]?_0x4a82eb[_0x77ce('0x33')]:_0x2a3d00[_0x77ce('0x2e')];if(_0x21e5db[_0x77ce('0x32')]['includeAll']){_0x4a82eb[_0x77ce('0x40')]=[{'all':!![]}];}_0x4a82eb=_[_0x77ce('0x3d')]({},_0x4a82eb,_0x21e5db[_0x77ce('0x3e')]);return db[_0x77ce('0x2c')][_0x77ce('0x46')](_0x4a82eb)[_0x77ce('0x24')](handleEntityNotFound(_0x39beba,null))[_0x77ce('0x24')](respondWithResult(_0x39beba,null))['catch'](handleError(_0x39beba,null));};exports[_0x77ce('0x47')]=function(_0x33272f,_0x81dd30){return db[_0x77ce('0x2c')][_0x77ce('0x47')](_0x33272f['body'],{})[_0x77ce('0x24')](respondWithResult(_0x81dd30,0xc9))[_0x77ce('0x43')](handleError(_0x81dd30,null));};exports[_0x77ce('0x23')]=function(_0x40f637,_0x3b1c3b){if(_0x40f637[_0x77ce('0x48')]['id']){delete _0x40f637[_0x77ce('0x48')]['id'];}return db[_0x77ce('0x2c')][_0x77ce('0x46')]({'where':{'id':_0x40f637[_0x77ce('0x44')]['id']}})[_0x77ce('0x24')](handleEntityNotFound(_0x3b1c3b,null))['then'](saveUpdates(_0x40f637[_0x77ce('0x48')],null))['then'](respondWithResult(_0x3b1c3b,null))['catch'](handleError(_0x3b1c3b,null));};exports[_0x77ce('0x25')]=function(_0x23d433,_0x1535db){return db[_0x77ce('0x2c')][_0x77ce('0x46')]({'where':{'id':_0x23d433[_0x77ce('0x44')]['id']}})[_0x77ce('0x24')](handleEntityNotFound(_0x1535db,null))[_0x77ce('0x24')](removeEntity(_0x1535db,null))[_0x77ce('0x43')](handleError(_0x1535db,null));}; \ No newline at end of file +var _0xdb00=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','index','SalesforceField','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','map','type','merge','options','where','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb00,0x15f));var _0x0db0=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0xdb00[_0x32f6b9];return _0x267d52;};'use strict';var pdf=require(_0x0db0('0x0'));var emlformat=require(_0x0db0('0x1'));var rimraf=require(_0x0db0('0x2'));var zipdir=require(_0x0db0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0db0('0x4'));var moment=require(_0x0db0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0db0('0x6'));var util=require(_0x0db0('0x7'));var path=require(_0x0db0('0x8'));var sox=require('sox');var csv=require(_0x0db0('0x9'));var ejs=require(_0x0db0('0xa'));var fs=require('fs');var _=require(_0x0db0('0xb'));var squel=require(_0x0db0('0xc'));var crypto=require('crypto');var jsforce=require(_0x0db0('0xd'));var deskjs=require(_0x0db0('0xe'));var toCsv=require(_0x0db0('0x9'));var querystring=require(_0x0db0('0xf'));var Papa=require(_0x0db0('0x10'));var Redis=require(_0x0db0('0x11'));var authService=require(_0x0db0('0x12'));var qs=require(_0x0db0('0x13'));var as=require(_0x0db0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0db0('0x15'))(_0x0db0('0x16'));var utils=require(_0x0db0('0x17'));var config=require(_0x0db0('0x18'));var licenseUtil=require(_0x0db0('0x19'));var db=require(_0x0db0('0x1a'))['db'];function respondWithStatusCode(_0x4fceb4,_0x576898){_0x576898=_0x576898||0xcc;return function(_0x49a0ec){if(_0x49a0ec){return _0x4fceb4[_0x0db0('0x1b')](_0x576898);}return _0x4fceb4[_0x0db0('0x1c')](_0x576898)[_0x0db0('0x1d')]();};}function respondWithResult(_0x534087,_0x5dbaae){_0x5dbaae=_0x5dbaae||0xc8;return function(_0x51a870){if(_0x51a870){return _0x534087['status'](_0x5dbaae)[_0x0db0('0x1e')](_0x51a870);}};}function respondWithFilteredResult(_0x57bfba,_0x4b0a60){return function(_0x1411f6){if(_0x1411f6){var _0x23dd7d=_0x1411f6[_0x0db0('0x1f')],_0x1733d9=_0x4b0a60['offset'],_0x5326d5=_0x4b0a60[_0x0db0('0x20')]+_0x4b0a60[_0x0db0('0x21')],_0x74cb58;if(_0x5326d5>=_0x23dd7d){_0x5326d5=_0x23dd7d;_0x74cb58=0xc8;}else{_0x74cb58=0xce;}_0x57bfba[_0x0db0('0x1c')](_0x74cb58);return _0x57bfba['set']('Content-Range',_0x1733d9+'-'+_0x5326d5+'/'+_0x23dd7d)[_0x0db0('0x1e')](_0x1411f6);}return null;};}function patchUpdates(_0x564ba4){return function(_0x20ea5b){try{jsonpatch[_0x0db0('0x22')](_0x20ea5b,_0x564ba4,!![]);}catch(_0x205f4c){return BPromise[_0x0db0('0x23')](_0x205f4c);}return _0x20ea5b[_0x0db0('0x24')]();};}function saveUpdates(_0x19d056,_0x5f2f49){return function(_0x117d6b){if(_0x117d6b){return _0x117d6b[_0x0db0('0x25')](_0x19d056)[_0x0db0('0x26')](function(_0x427fd9){return _0x427fd9;});}return null;};}function removeEntity(_0xc508ab,_0xba5e79){return function(_0x4f668b){if(_0x4f668b){return _0x4f668b[_0x0db0('0x27')]()[_0x0db0('0x26')](function(){_0xc508ab[_0x0db0('0x1c')](0xcc)[_0x0db0('0x1d')]();});}};}function handleEntityNotFound(_0x3d5f13,_0x14adfe){return function(_0x4c342c){if(!_0x4c342c){_0x3d5f13['sendStatus'](0x194);}return _0x4c342c;};}function handleError(_0x485c26,_0x3927f3){_0x3927f3=_0x3927f3||0x1f4;return function(_0x2d8cb3){logger['error'](_0x2d8cb3['stack']);if(_0x2d8cb3['name']){delete _0x2d8cb3['name'];}_0x485c26[_0x0db0('0x1c')](_0x3927f3)['send'](_0x2d8cb3);};}exports[_0x0db0('0x28')]=function(_0x33164d,_0x17f963){var _0xdea50d={},_0x1bf0c6={},_0x275b60={'count':0x0,'rows':[]};var _0x5dcf38=_['map'](db[_0x0db0('0x29')][_0x0db0('0x2a')],function(_0x5a7481){return{'name':_0x5a7481[_0x0db0('0x2b')],'type':_0x5a7481['type'][_0x0db0('0x2c')]};});_0x1bf0c6[_0x0db0('0x2d')]=_['map'](_0x5dcf38,_0x0db0('0x2e'));_0x1bf0c6[_0x0db0('0x2f')]=_[_0x0db0('0x30')](_0x33164d[_0x0db0('0x2f')]);_0x1bf0c6[_0x0db0('0x31')]=_[_0x0db0('0x32')](_0x1bf0c6[_0x0db0('0x2d')],_0x1bf0c6[_0x0db0('0x2f')]);_0xdea50d[_0x0db0('0x33')]=_[_0x0db0('0x32')](_0x1bf0c6[_0x0db0('0x2d')],qs[_0x0db0('0x34')](_0x33164d[_0x0db0('0x2f')][_0x0db0('0x34')]));_0xdea50d[_0x0db0('0x33')]=_0xdea50d[_0x0db0('0x33')]['length']?_0xdea50d[_0x0db0('0x33')]:_0x1bf0c6[_0x0db0('0x2d')];if(!_0x33164d[_0x0db0('0x2f')][_0x0db0('0x35')](_0x0db0('0x36'))){_0xdea50d['limit']=qs['limit'](_0x33164d[_0x0db0('0x2f')]['limit']);_0xdea50d['offset']=qs[_0x0db0('0x20')](_0x33164d[_0x0db0('0x2f')][_0x0db0('0x20')]);}_0xdea50d[_0x0db0('0x37')]=qs['sort'](_0x33164d[_0x0db0('0x2f')][_0x0db0('0x38')]);_0xdea50d['where']=qs[_0x0db0('0x31')](_[_0x0db0('0x39')](_0x33164d[_0x0db0('0x2f')],_0x1bf0c6[_0x0db0('0x31')]),_0x5dcf38);if(_0x33164d[_0x0db0('0x2f')][_0x0db0('0x3a')]){_0xdea50d['where']=_['merge'](_0xdea50d['where'],{'$or':_[_0x0db0('0x3b')](_0x5dcf38,function(_0xc03a1b){if(_0xc03a1b[_0x0db0('0x3c')]!=='VIRTUAL'){var _0x2c1f86={};_0x2c1f86[_0xc03a1b[_0x0db0('0x2e')]]={'$like':'%'+_0x33164d[_0x0db0('0x2f')]['filter']+'%'};return _0x2c1f86;}})});}_0xdea50d=_[_0x0db0('0x3d')]({},_0xdea50d,_0x33164d[_0x0db0('0x3e')]);var _0x503b83={'where':_0xdea50d[_0x0db0('0x3f')]};return db[_0x0db0('0x29')][_0x0db0('0x1f')](_0x503b83)[_0x0db0('0x26')](function(_0x5788d1){_0x275b60[_0x0db0('0x1f')]=_0x5788d1;if(_0x33164d['query'][_0x0db0('0x40')]){_0xdea50d[_0x0db0('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x0db0('0x42')](_0xdea50d);})[_0x0db0('0x26')](function(_0x3be188){_0x275b60[_0x0db0('0x43')]=_0x3be188;return _0x275b60;})[_0x0db0('0x26')](respondWithFilteredResult(_0x17f963,_0xdea50d))[_0x0db0('0x44')](handleError(_0x17f963,null));};exports[_0x0db0('0x45')]=function(_0x37feba,_0x4fa145){var _0xefb059={'raw':!![],'where':{'id':_0x37feba[_0x0db0('0x46')]['id']}},_0x5a8fd8={};_0x5a8fd8[_0x0db0('0x2d')]=_[_0x0db0('0x30')](db[_0x0db0('0x29')]['rawAttributes']);_0x5a8fd8[_0x0db0('0x2f')]=_[_0x0db0('0x30')](_0x37feba[_0x0db0('0x2f')]);_0x5a8fd8[_0x0db0('0x31')]=_['intersection'](_0x5a8fd8[_0x0db0('0x2d')],_0x5a8fd8[_0x0db0('0x2f')]);_0xefb059['attributes']=_[_0x0db0('0x32')](_0x5a8fd8[_0x0db0('0x2d')],qs['fields'](_0x37feba[_0x0db0('0x2f')][_0x0db0('0x34')]));_0xefb059[_0x0db0('0x33')]=_0xefb059[_0x0db0('0x33')][_0x0db0('0x47')]?_0xefb059[_0x0db0('0x33')]:_0x5a8fd8['model'];if(_0x37feba['query'][_0x0db0('0x40')]){_0xefb059[_0x0db0('0x41')]=[{'all':!![]}];}_0xefb059=_[_0x0db0('0x3d')]({},_0xefb059,_0x37feba['options']);return db[_0x0db0('0x29')][_0x0db0('0x48')](_0xefb059)[_0x0db0('0x26')](handleEntityNotFound(_0x4fa145,null))[_0x0db0('0x26')](respondWithResult(_0x4fa145,null))[_0x0db0('0x44')](handleError(_0x4fa145,null));};exports['create']=function(_0x35fc51,_0x4de530){return db[_0x0db0('0x29')][_0x0db0('0x49')](_0x35fc51[_0x0db0('0x4a')],{})[_0x0db0('0x26')](respondWithResult(_0x4de530,0xc9))[_0x0db0('0x44')](handleError(_0x4de530,null));};exports[_0x0db0('0x25')]=function(_0x8acf3f,_0x4e9152){if(_0x8acf3f[_0x0db0('0x4a')]['id']){delete _0x8acf3f['body']['id'];}return db[_0x0db0('0x29')]['find']({'where':{'id':_0x8acf3f[_0x0db0('0x46')]['id']}})[_0x0db0('0x26')](handleEntityNotFound(_0x4e9152,null))[_0x0db0('0x26')](saveUpdates(_0x8acf3f[_0x0db0('0x4a')],null))[_0x0db0('0x26')](respondWithResult(_0x4e9152,null))[_0x0db0('0x44')](handleError(_0x4e9152,null));};exports[_0x0db0('0x27')]=function(_0xf5e44e,_0x2adf32){return db[_0x0db0('0x29')][_0x0db0('0x48')]({'where':{'id':_0xf5e44e['params']['id']}})[_0x0db0('0x26')](handleEntityNotFound(_0x2adf32,null))[_0x0db0('0x26')](removeEntity(_0x2adf32,null))[_0x0db0('0x44')](handleError(_0x2adf32,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ebee8f8..f42e871 100644 --- a/server/api/intSalesforceField/intSalesforceField.model.js +++ b/server/api/intSalesforceField/intSalesforceField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3db=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xb3db,0x159));var _0xbb3d=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xb3db[_0x548200];return _0x1a6d74;};'use strict';var _=require('lodash');var util=require(_0xbb3d('0x0'));var logger=require(_0xbb3d('0x1'))(_0xbb3d('0x2'));var moment=require(_0xbb3d('0x3'));var BPromise=require(_0xbb3d('0x4'));var rp=require(_0xbb3d('0x5'));var fs=require('fs');var path=require(_0xbb3d('0x6'));var rimraf=require('rimraf');var config=require(_0xbb3d('0x7'));var attributes=require(_0xbb3d('0x8'));module[_0xbb3d('0x9')]=function(_0x3f8a59,_0x28ce2b){return _0x3f8a59[_0xbb3d('0xa')](_0xbb3d('0xb'),attributes,{'tableName':_0xbb3d('0xc'),'paranoid':![],'indexes':[{'name':_0xbb3d('0xd'),'fields':[_0xbb3d('0xe'),_0xbb3d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b41=['rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5bf034,_0xa7891b){var _0x232f13=function(_0x317bff){while(--_0x317bff){_0x5bf034['push'](_0x5bf034['shift']());}};_0x232f13(++_0xa7891b);}(_0x3b41,0x78));var _0x13b4=function(_0x2888ab,_0x4f8bd1){_0x2888ab=_0x2888ab-0x0;var _0x311ee5=_0x3b41[_0x2888ab];return _0x311ee5;};'use strict';var _=require(_0x13b4('0x0'));var util=require(_0x13b4('0x1'));var logger=require(_0x13b4('0x2'))(_0x13b4('0x3'));var moment=require('moment');var BPromise=require(_0x13b4('0x4'));var rp=require(_0x13b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13b4('0x6'));var config=require('../../config/environment');var attributes=require(_0x13b4('0x7'));module[_0x13b4('0x8')]=function(_0x3b9892,_0xf6d1f4){return _0x3b9892[_0x13b4('0x9')](_0x13b4('0xa'),attributes,{'tableName':_0x13b4('0xb'),'paranoid':![],'indexes':[{'name':_0x13b4('0xc'),'fields':[_0x13b4('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index f73d88e..fbe3070 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['rpc','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0xda3f,0xec));var _0xfda3=function(_0x1cacba,_0x19b163){_0x1cacba=_0x1cacba-0x0;var _0x4ebb16=_0xda3f[_0x1cacba];return _0x4ebb16;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('SalesforceField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x544091,_0x34053b){var _0x2cce91=function(_0x189144){while(--_0x189144){_0x544091['push'](_0x544091['shift']());}};_0x2cce91(++_0x34053b);}(_0x153f,0x15b));var _0xf153=function(_0x2e9631,_0x2ec0d1){_0x2e9631=_0x2e9631-0x0;var _0xbca589=_0x153f[_0x2e9631];return _0xbca589;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 99f6a92..0b49d1b 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x693a=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','show'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x693a,0x1ee));var _0xa693=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x693a[_0x479160];return _0x47ac6d;};'use strict';var multer=require(_0xa693('0x0'));var util=require(_0xa693('0x1'));var path=require('path');var timeout=require(_0xa693('0x2'));var express=require(_0xa693('0x3'));var router=express[_0xa693('0x4')]();var auth=require(_0xa693('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa693('0x6'));var controller=require(_0xa693('0x7'));router['get']('/',auth[_0xa693('0x8')](),controller['index']);router[_0xa693('0x9')](_0xa693('0xa'),auth[_0xa693('0x8')](),controller[_0xa693('0xb')]);router[_0xa693('0x9')](_0xa693('0xc'),auth[_0xa693('0x8')](),controller[_0xa693('0xd')]);router[_0xa693('0x9')](_0xa693('0xe'),auth[_0xa693('0x8')](),controller[_0xa693('0xf')]);router['post']('/',auth[_0xa693('0x8')](),controller[_0xa693('0x10')]);router[_0xa693('0x11')](_0xa693('0xc'),auth[_0xa693('0x8')](),controller[_0xa693('0x12')]);router[_0xa693('0x13')](_0xa693('0xa'),auth[_0xa693('0x8')](),controller['update']);router[_0xa693('0x14')](_0xa693('0xa'),auth[_0xa693('0x8')](),controller[_0xa693('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbe27=['getFields','post','addConfiguration','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','/:id/configurations','isAuthenticated','getConfigurations'];(function(_0x552ebb,_0x2c71ef){var _0x5a2928=function(_0x5bf49b){while(--_0x5bf49b){_0x552ebb['push'](_0x552ebb['shift']());}};_0x5a2928(++_0x2c71ef);}(_0xbe27,0x92));var _0x7be2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbe27[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x7be2('0x0'));var path=require(_0x7be2('0x1'));var timeout=require(_0x7be2('0x2'));var express=require(_0x7be2('0x3'));var router=express[_0x7be2('0x4')]();var auth=require(_0x7be2('0x5'));var interaction=require(_0x7be2('0x6'));var config=require(_0x7be2('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x7be2('0x8')]('/',auth['isAuthenticated'](),controller[_0x7be2('0x9')]);router[_0x7be2('0x8')](_0x7be2('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7be2('0x8')](_0x7be2('0xb'),auth[_0x7be2('0xc')](),controller[_0x7be2('0xd')]);router[_0x7be2('0x8')]('/:id/fields',auth[_0x7be2('0xc')](),controller[_0x7be2('0xe')]);router[_0x7be2('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7be2('0xf')](_0x7be2('0xb'),auth['isAuthenticated'](),controller[_0x7be2('0x10')]);router['put'](_0x7be2('0xa'),auth[_0x7be2('0xc')](),controller[_0x7be2('0x11')]);router[_0x7be2('0x12')](_0x7be2('0xa'),auth['isAuthenticated'](),controller[_0x7be2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index a52c6e2..b351ca4 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.attributes.js +++ b/server/api/intServicenowAccount/intServicenowAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a0d=['exports','STRING','username','remoteUri','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1a0d,0xf4));var _0xd1a0=function(_0x2d4120,_0x3d669d){_0x2d4120=_0x2d4120-0x0;var _0x511330=_0x1a0d[_0x2d4120];return _0x511330;};'use strict';var Sequelize=require(_0xd1a0('0x0'));module[_0xd1a0('0x1')]={'name':{'type':Sequelize[_0xd1a0('0x2')]},'description':{'type':Sequelize[_0xd1a0('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd1a0('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd1a0('0x2')]},'remoteUri':{'type':Sequelize[_0xd1a0('0x2')],'unique':_0xd1a0('0x4')},'serverUrl':{'type':Sequelize[_0xd1a0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0ae6=['username','sequelize','STRING'];(function(_0x345099,_0x5ee98e){var _0x3f516b=function(_0x1515fb){while(--_0x1515fb){_0x345099['push'](_0x345099['shift']());}};_0x3f516b(++_0x5ee98e);}(_0x0ae6,0x172));var _0x60ae=function(_0x1c6953,_0x410f21){_0x1c6953=_0x1c6953-0x0;var _0x1b754f=_0x0ae6[_0x1c6953];return _0x1b754f;};'use strict';var Sequelize=require(_0x60ae('0x0'));module['exports']={'name':{'type':Sequelize[_0x60ae('0x1')]},'description':{'type':Sequelize[_0x60ae('0x1')]},'username':{'type':Sequelize[_0x60ae('0x1')],'unique':_0x60ae('0x2')},'password':{'type':Sequelize[_0x60ae('0x1')]},'email':{'type':Sequelize[_0x60ae('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x60ae('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 44ec858..e7d95cf 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.controller.js +++ b/server/api/intServicenowAccount/intServicenowAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20d9=['include','findAll','show','params','find','create','body','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','work_notes_list','priority','sys_domain_path','time_worked','opened_at','group_list','work_end','reopened_time','caller_id','approval_set','subcategory','work_notes','correlation_display','delivery_task','work_start','assignment_group','description','follow_up','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','comments_and_work_notes','sys_mod_count','sys_tags','upon_approval','correlation_id','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','username','GET','log','includes','forEach','internalType','all','assign','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','concat','ServiceNow\x20error:\x20','test','send','Wrong\x20credentials','statusCode','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','count','offset','limit','set','json','apply','save','update','then','destroy','stack','name','index','map','ServicenowAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x2561eb,_0x34f7dd){var _0x1f3a94=function(_0x8277a5){while(--_0x8277a5){_0x2561eb['push'](_0x2561eb['shift']());}};_0x1f3a94(++_0x34f7dd);}(_0x20d9,0x1df));var _0x920d=function(_0x9afa59,_0x32876e){_0x9afa59=_0x9afa59-0x0;var _0xa9e570=_0x20d9[_0x9afa59];return _0xa9e570;};'use strict';var pdf=require(_0x920d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x920d('0x1'));var zipdir=require(_0x920d('0x2'));var jsonpatch=require(_0x920d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x920d('0x4'));var Mustache=require(_0x920d('0x5'));var util=require(_0x920d('0x6'));var path=require(_0x920d('0x7'));var sox=require(_0x920d('0x8'));var csv=require(_0x920d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x920d('0xa'));var squel=require(_0x920d('0xb'));var crypto=require(_0x920d('0xc'));var jsforce=require(_0x920d('0xd'));var deskjs=require(_0x920d('0xe'));var toCsv=require(_0x920d('0x9'));var querystring=require('querystring');var Papa=require(_0x920d('0xf'));var Redis=require(_0x920d('0x10'));var authService=require(_0x920d('0x11'));var qs=require(_0x920d('0x12'));var as=require(_0x920d('0x13'));var hardwareService=require(_0x920d('0x14'));var logger=require(_0x920d('0x15'))(_0x920d('0x16'));var utils=require(_0x920d('0x17'));var config=require(_0x920d('0x18'));var licenseUtil=require(_0x920d('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x920d('0x1a'));var jayson=require(_0x920d('0x1b'));var client=jayson[_0x920d('0x1c')][_0x920d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x46b01c,_0x5c10be,_0x2b7404,_0x36846e){return new BPromise(function(_0x11a92c,_0xdbd703){var _0x574777=_0x36846e||client;return _0x574777[_0x920d('0x1e')](_0x46b01c,_0x2b7404)['then'](function(_0x35270d){logger['info'](_0x920d('0x1f'),_0x5c10be,_0x920d('0x20'));logger[_0x920d('0x21')](_0x920d('0x22'),_0x5c10be,_0x920d('0x20'),JSON[_0x920d('0x23')](_0x35270d));if(_0x35270d[_0x920d('0x24')]){if(_0x35270d['error']['code']===0x1f4){logger[_0x920d('0x24')](_0x920d('0x1f'),_0x5c10be,_0x35270d[_0x920d('0x24')][_0x920d('0x25')]);return _0xdbd703(_0x35270d[_0x920d('0x24')][_0x920d('0x25')]);}logger[_0x920d('0x24')]('ServicenowAccount,\x20%s,\x20%s',_0x5c10be,_0x35270d[_0x920d('0x24')][_0x920d('0x25')]);return _0x11a92c(_0x35270d[_0x920d('0x24')][_0x920d('0x25')]);}else{logger['info'](_0x920d('0x1f'),_0x5c10be,_0x920d('0x20'));_0x11a92c(_0x35270d[_0x920d('0x26')][_0x920d('0x25')]);}})[_0x920d('0x27')](function(_0x29c71d){logger[_0x920d('0x24')](_0x920d('0x1f'),_0x5c10be,_0x29c71d);_0xdbd703(_0x29c71d);});});}function respondWithStatusCode(_0x3f22f5,_0x2d9bba){_0x2d9bba=_0x2d9bba||0xcc;return function(_0x5868c0){if(_0x5868c0){return _0x3f22f5[_0x920d('0x28')](_0x2d9bba);}return _0x3f22f5[_0x920d('0x29')](_0x2d9bba)['end']();};}function respondWithResult(_0x5405da,_0x1b6de5){_0x1b6de5=_0x1b6de5||0xc8;return function(_0x4988ef){if(_0x4988ef){return _0x5405da[_0x920d('0x29')](_0x1b6de5)['json'](_0x4988ef);}};}function respondWithFilteredResult(_0xd0d1be,_0x2db65a){return function(_0x1d6d28){if(_0x1d6d28){var _0x4577aa=_0x1d6d28[_0x920d('0x2a')],_0x61dfcb=_0x2db65a[_0x920d('0x2b')],_0x45e469=_0x2db65a[_0x920d('0x2b')]+_0x2db65a[_0x920d('0x2c')],_0x532a21;if(_0x45e469>=_0x4577aa){_0x45e469=_0x4577aa;_0x532a21=0xc8;}else{_0x532a21=0xce;}_0xd0d1be['status'](_0x532a21);return _0xd0d1be[_0x920d('0x2d')]('Content-Range',_0x61dfcb+'-'+_0x45e469+'/'+_0x4577aa)[_0x920d('0x2e')](_0x1d6d28);}return null;};}function patchUpdates(_0x3d89cb){return function(_0x257a40){try{jsonpatch[_0x920d('0x2f')](_0x257a40,_0x3d89cb,!![]);}catch(_0x5e8f91){return BPromise['reject'](_0x5e8f91);}return _0x257a40[_0x920d('0x30')]();};}function saveUpdates(_0xd50898,_0x48bf79){return function(_0x117dc6){if(_0x117dc6){return _0x117dc6[_0x920d('0x31')](_0xd50898)[_0x920d('0x32')](function(_0x5b85b0){return _0x5b85b0;});}return null;};}function removeEntity(_0x3c1378,_0x4fc72a){return function(_0x3e7f0d){if(_0x3e7f0d){return _0x3e7f0d[_0x920d('0x33')]()[_0x920d('0x32')](function(){_0x3c1378[_0x920d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7870dc,_0x246f8f){return function(_0x53c643){if(!_0x53c643){_0x7870dc[_0x920d('0x28')](0x194);}return _0x53c643;};}function handleError(_0x68451b,_0x122f20){_0x122f20=_0x122f20||0x1f4;return function(_0x2d0329){logger['error'](_0x2d0329[_0x920d('0x34')]);if(_0x2d0329[_0x920d('0x35')]){delete _0x2d0329[_0x920d('0x35')];}_0x68451b[_0x920d('0x29')](_0x122f20)['send'](_0x2d0329);};}exports[_0x920d('0x36')]=function(_0x4112b0,_0xc756f9){var _0x1e3e66={},_0x10cd94={},_0x256bea={'count':0x0,'rows':[]};var _0x5405e7=_[_0x920d('0x37')](db[_0x920d('0x38')][_0x920d('0x39')],function(_0x1bcddb){return{'name':_0x1bcddb['fieldName'],'type':_0x1bcddb['type'][_0x920d('0x3a')]};});_0x10cd94[_0x920d('0x3b')]=_['map'](_0x5405e7,_0x920d('0x35'));_0x10cd94[_0x920d('0x3c')]=_[_0x920d('0x3d')](_0x4112b0['query']);_0x10cd94[_0x920d('0x3e')]=_[_0x920d('0x3f')](_0x10cd94[_0x920d('0x3b')],_0x10cd94[_0x920d('0x3c')]);_0x1e3e66[_0x920d('0x40')]=_[_0x920d('0x3f')](_0x10cd94[_0x920d('0x3b')],qs['fields'](_0x4112b0[_0x920d('0x3c')][_0x920d('0x41')]));_0x1e3e66[_0x920d('0x40')]=_0x1e3e66[_0x920d('0x40')][_0x920d('0x42')]?_0x1e3e66[_0x920d('0x40')]:_0x10cd94[_0x920d('0x3b')];if(!_0x4112b0[_0x920d('0x3c')][_0x920d('0x43')](_0x920d('0x44'))){_0x1e3e66[_0x920d('0x2c')]=qs[_0x920d('0x2c')](_0x4112b0[_0x920d('0x3c')][_0x920d('0x2c')]);_0x1e3e66[_0x920d('0x2b')]=qs[_0x920d('0x2b')](_0x4112b0[_0x920d('0x3c')]['offset']);}_0x1e3e66[_0x920d('0x45')]=qs[_0x920d('0x46')](_0x4112b0[_0x920d('0x3c')][_0x920d('0x46')]);_0x1e3e66[_0x920d('0x47')]=qs[_0x920d('0x3e')](_[_0x920d('0x48')](_0x4112b0[_0x920d('0x3c')],_0x10cd94[_0x920d('0x3e')]),_0x5405e7);if(_0x4112b0['query'][_0x920d('0x49')]){_0x1e3e66[_0x920d('0x47')]=_[_0x920d('0x4a')](_0x1e3e66[_0x920d('0x47')],{'$or':_[_0x920d('0x37')](_0x5405e7,function(_0x3059ca){if(_0x3059ca[_0x920d('0x4b')]!==_0x920d('0x4c')){var _0x4686ec={};_0x4686ec[_0x3059ca[_0x920d('0x35')]]={'$like':'%'+_0x4112b0['query']['filter']+'%'};return _0x4686ec;}})});}_0x1e3e66=_[_0x920d('0x4a')]({},_0x1e3e66,_0x4112b0[_0x920d('0x4d')]);var _0x469624={'where':_0x1e3e66[_0x920d('0x47')]};return db[_0x920d('0x38')][_0x920d('0x2a')](_0x469624)[_0x920d('0x32')](function(_0x37287d){_0x256bea['count']=_0x37287d;if(_0x4112b0['query'][_0x920d('0x4e')]){_0x1e3e66[_0x920d('0x4f')]=[{'all':!![]}];}return db[_0x920d('0x38')][_0x920d('0x50')](_0x1e3e66);})[_0x920d('0x32')](function(_0x22dced){_0x256bea['rows']=_0x22dced;return _0x256bea;})['then'](respondWithFilteredResult(_0xc756f9,_0x1e3e66))[_0x920d('0x27')](handleError(_0xc756f9,null));};exports[_0x920d('0x51')]=function(_0x3be585,_0x34894d){var _0x5500d8={'raw':![],'where':{'id':_0x3be585[_0x920d('0x52')]['id']}},_0x528030={};_0x528030[_0x920d('0x3b')]=_[_0x920d('0x3d')](db[_0x920d('0x38')][_0x920d('0x39')]);_0x528030['query']=_[_0x920d('0x3d')](_0x3be585[_0x920d('0x3c')]);_0x528030['filters']=_[_0x920d('0x3f')](_0x528030[_0x920d('0x3b')],_0x528030[_0x920d('0x3c')]);_0x5500d8[_0x920d('0x40')]=_[_0x920d('0x3f')](_0x528030[_0x920d('0x3b')],qs[_0x920d('0x41')](_0x3be585[_0x920d('0x3c')][_0x920d('0x41')]));_0x5500d8[_0x920d('0x40')]=_0x5500d8[_0x920d('0x40')]['length']?_0x5500d8['attributes']:_0x528030['model'];if(_0x3be585[_0x920d('0x3c')][_0x920d('0x4e')]){_0x5500d8[_0x920d('0x4f')]=[{'all':!![]}];}_0x5500d8=_[_0x920d('0x4a')]({},_0x5500d8,_0x3be585[_0x920d('0x4d')]);return db[_0x920d('0x38')][_0x920d('0x53')](_0x5500d8)[_0x920d('0x32')](handleEntityNotFound(_0x34894d,null))[_0x920d('0x32')](respondWithResult(_0x34894d,null))[_0x920d('0x27')](handleError(_0x34894d,null));};exports[_0x920d('0x54')]=function(_0x5029c6,_0xf40e5b){return db[_0x920d('0x38')]['create'](_0x5029c6['body'],{})[_0x920d('0x32')](respondWithResult(_0xf40e5b,0xc9))[_0x920d('0x27')](handleError(_0xf40e5b,null));};exports['update']=function(_0x2c227d,_0x11dec0){if(_0x2c227d[_0x920d('0x55')]['id']){delete _0x2c227d[_0x920d('0x55')]['id'];}return db['ServicenowAccount'][_0x920d('0x53')]({'where':{'id':_0x2c227d[_0x920d('0x52')]['id']}})[_0x920d('0x32')](handleEntityNotFound(_0x11dec0,null))[_0x920d('0x32')](saveUpdates(_0x2c227d[_0x920d('0x55')],null))['then'](respondWithResult(_0x11dec0,null))[_0x920d('0x27')](handleError(_0x11dec0,null));};exports[_0x920d('0x33')]=function(_0x470e52,_0x16bba0){return db[_0x920d('0x38')][_0x920d('0x53')]({'where':{'id':_0x470e52[_0x920d('0x52')]['id']}})[_0x920d('0x32')](handleEntityNotFound(_0x16bba0,null))[_0x920d('0x32')](removeEntity(_0x16bba0,null))[_0x920d('0x27')](handleError(_0x16bba0,null));};exports[_0x920d('0x56')]=function(_0x4b079f,_0x4f8eb4,_0x1cf974){var _0x222235={};var _0x21ef93={};var _0x545305;var _0x36c857;return db['ServicenowAccount']['findOne']({'where':{'id':_0x4b079f['params']['id']}})['then'](handleEntityNotFound(_0x4f8eb4,null))[_0x920d('0x32')](function(_0x34083c){if(_0x34083c){_0x545305=_0x34083c;_0x21ef93[_0x920d('0x3b')]=_[_0x920d('0x3d')](db[_0x920d('0x57')][_0x920d('0x39')]);_0x21ef93[_0x920d('0x3c')]=_[_0x920d('0x3d')](_0x4b079f[_0x920d('0x3c')]);_0x21ef93['filters']=_[_0x920d('0x3f')](_0x21ef93['model'],_0x21ef93['query']);_0x222235[_0x920d('0x40')]=_[_0x920d('0x3f')](_0x21ef93['model'],qs[_0x920d('0x41')](_0x4b079f[_0x920d('0x3c')]['fields']));_0x222235[_0x920d('0x40')]=_0x222235[_0x920d('0x40')]['length']?_0x222235[_0x920d('0x40')]:_0x21ef93['model'];_0x222235['order']=qs[_0x920d('0x46')](_0x4b079f[_0x920d('0x3c')][_0x920d('0x46')]);_0x222235[_0x920d('0x47')]=qs[_0x920d('0x3e')](_['pick'](_0x4b079f[_0x920d('0x3c')],_0x21ef93[_0x920d('0x3e')]));if(_0x4b079f[_0x920d('0x3c')][_0x920d('0x49')]){_0x222235['where']=_[_0x920d('0x4a')](_0x222235['where'],{'$or':_[_0x920d('0x37')](_0x222235['attributes'],function(_0x3a9018){var _0x3e9d4a={};_0x3e9d4a[_0x3a9018]={'$like':'%'+_0x4b079f[_0x920d('0x3c')]['filter']+'%'};return _0x3e9d4a;})});}_0x222235=_[_0x920d('0x4a')]({},_0x222235,_0x4b079f['options']);return _0x545305[_0x920d('0x56')](_0x222235);}})[_0x920d('0x32')](function(_0x5cf36c){if(_0x5cf36c){_0x36c857=_0x5cf36c[_0x920d('0x42')];if(!_0x4b079f[_0x920d('0x3c')][_0x920d('0x43')](_0x920d('0x44'))){_0x222235[_0x920d('0x2c')]=qs['limit'](_0x4b079f[_0x920d('0x3c')][_0x920d('0x2c')]);_0x222235['offset']=qs[_0x920d('0x2b')](_0x4b079f['query'][_0x920d('0x2b')]);}return _0x545305[_0x920d('0x56')](_0x222235);}})['then'](function(_0x3f87da){if(_0x3f87da){return _0x3f87da?{'count':_0x36c857,'rows':_0x3f87da}:null;}})[_0x920d('0x32')](respondWithResult(_0x4f8eb4,null))['catch'](handleError(_0x4f8eb4,null));};exports[_0x920d('0x58')]=function(_0x3899ac,_0x4348bc,_0x55e803){if(_0x3899ac[_0x920d('0x55')]['id']){delete _0x3899ac[_0x920d('0x55')]['id'];}return db[_0x920d('0x38')][_0x920d('0x59')]({'where':{'id':_0x3899ac[_0x920d('0x52')]['id']}})[_0x920d('0x32')](handleEntityNotFound(_0x4348bc,null))[_0x920d('0x32')](function(_0x34a347){if(_0x34a347){_0x3899ac[_0x920d('0x55')][_0x920d('0x5a')]=_0x34a347['id'];_0x3899ac['body'][_0x920d('0x5b')]=integrations[_0x920d('0x5c')](_0x3899ac[_0x920d('0x55')][_0x920d('0x5d')],_0x3899ac[_0x920d('0x55')][_0x920d('0x4b')]);_0x3899ac[_0x920d('0x55')]['Descriptions']=integrations[_0x920d('0x5e')](_0x3899ac[_0x920d('0x55')][_0x920d('0x5d')],_0x3899ac[_0x920d('0x55')][_0x920d('0x4b')]);return db['ServicenowConfiguration'][_0x920d('0x54')](_0x3899ac[_0x920d('0x55')],{'include':[{'model':db['ServicenowField'],'as':_0x920d('0x5b')},{'model':db[_0x920d('0x5f')],'as':_0x920d('0x60')}]});}return null;})[_0x920d('0x32')](respondWithResult(_0x4348bc,null))['catch'](handleError(_0x4348bc,null));};exports[_0x920d('0x61')]=function(_0x285919,_0x5e13bc,_0x1bee2f){var _0x252897=[_0x920d('0x62'),_0x920d('0x63'),'knowledge','subcategory',_0x920d('0x64'),_0x920d('0x65'),_0x920d('0x66'),'severity',_0x920d('0x67')];var _0x18575c=[_0x920d('0x68'),_0x920d('0x62'),_0x920d('0x69'),_0x920d('0x6a'),_0x920d('0x6b'),_0x920d('0x6c'),_0x920d('0x6d'),_0x920d('0x63'),_0x920d('0x6e'),'number','resolved_by',_0x920d('0x6f'),_0x920d('0x70'),_0x920d('0x71'),'sys_created_on',_0x920d('0x72'),_0x920d('0x73'),_0x920d('0x74'),'knowledge',_0x920d('0x45'),_0x920d('0x75'),_0x920d('0x76'),'cmdb_ci',_0x920d('0x77'),_0x920d('0x78'),'active',_0x920d('0x79'),'business_service',_0x920d('0x7a'),_0x920d('0x7b'),'rfc',_0x920d('0x7c'),'expected_start',_0x920d('0x7d'),'business_duration',_0x920d('0x7e'),_0x920d('0x7f'),_0x920d('0x80'),'resolved_at',_0x920d('0x81'),_0x920d('0x82'),_0x920d('0x83'),_0x920d('0x84'),'short_description','close_code',_0x920d('0x85'),_0x920d('0x86'),_0x920d('0x87'),_0x920d('0x88'),'business_stc','additional_assignee_list',_0x920d('0x89'),'calendar_duration',_0x920d('0x65'),'sys_class_name','close_notes','closed_by',_0x920d('0x8a'),'parent_incident',_0x920d('0x8b'),_0x920d('0x8c'),_0x920d('0x8d'),_0x920d('0x66'),'urgency',_0x920d('0x8e'),_0x920d('0x8f'),_0x920d('0x90'),_0x920d('0x91'),_0x920d('0x92'),_0x920d('0x93'),_0x920d('0x94'),'sla_due','approval',_0x920d('0x95'),'due_date',_0x920d('0x96'),'reopen_count',_0x920d('0x97'),'escalation',_0x920d('0x98'),_0x920d('0x99'),'location',_0x920d('0x67')];var _0x55a62f='';var _0x61669e='';var _0x4f528f=[];var _0x220a5e='';var _0x2d28c9='';var _0xf99940=[];var _0x2be817='';var _0x585cdb='';var _0xe13e41={};var _0x578662='';return db[_0x920d('0x38')][_0x920d('0x59')]({'where':{'id':_0x285919['params']['id']},'attributes':['id','username',_0x920d('0x9a'),'email',_0x920d('0x9b'),_0x920d('0x9c')]})[_0x920d('0x32')](handleEntityNotFound(_0x5e13bc,null))[_0x920d('0x32')](function(_0x22c4cf){if(_0x22c4cf){_0x578662=_0x22c4cf['remoteUri'];var _0x56721c=_0x578662[_0x920d('0x9d')](-0x1);if(_0x56721c==='/'){_0x578662=_0x578662[_0x920d('0x9e')](0x0,_0x578662[_0x920d('0x9f')](_0x56721c));}_0x585cdb=util['format'](_0x920d('0xa0'),_0x578662);_0x2be817=util['format']('%s/api/now/table/',_0x578662);_0xe13e41={'user':_0x22c4cf[_0x920d('0xa1')],'pass':_0x22c4cf[_0x920d('0x9a')]};var _0x4c72dd={'method':_0x920d('0xa2'),'uri':_0x585cdb+'incident?sysparm_display_value=all','auth':_0xe13e41,'json':!![]};return rp(_0x4c72dd);}})['then'](function(_0x3f6999){if(_0x3f6999[_0x920d('0x26')][_0x920d('0x42')]>0x0){_0x55a62f=_0x3f6999[_0x920d('0x26')];}console[_0x920d('0xa3')]('incident\x20table\x20objects',_0x55a62f);_0xf99940=[];_0x61669e=Object['assign']([],_0x55a62f);_['remove'](_0x61669e,function(_0x2d7c8e){return!_0x252897[_0x920d('0xa4')](_0x2d7c8e[_0x920d('0x35')]);});_0x61669e[_0x920d('0xa5')](function(_0x5d496f){var _0x3a4dc2=createFieldObject(_0x2be817,_0xe13e41,_0x5d496f[_0x920d('0xa6')],_0x5d496f[_0x920d('0x35')],_0x5d496f['label'],![]);_0xf99940['push'](_0x3a4dc2);});return Promise[_0x920d('0xa7')](_0xf99940);})[_0x920d('0x32')](function(_0x25cb4c){_0x4f528f=_0x25cb4c;_0x220a5e=Object[_0x920d('0xa8')]([],_0x55a62f);console[_0x920d('0xa3')]('TCL:\x20_object',_0x55a62f);_[_0x920d('0xa9')](_0x220a5e,function(_0x197b83){return _0x18575c[_0x920d('0xa4')](_0x197b83['name']);});console[_0x920d('0xa3')](_0x920d('0xaa'),_0x220a5e);_0xf99940=[];_0x220a5e[_0x920d('0xa5')](function(_0x48c1bc){var _0x519b34=createFieldObject(_0x2be817,_0xe13e41,_0x48c1bc[_0x920d('0xa6')],_0x48c1bc['name'],_0x48c1bc[_0x920d('0xab')],!![]);_0xf99940[_0x920d('0xac')](_0x519b34);});return Promise[_0x920d('0xa7')](_0xf99940);})[_0x920d('0x32')](function(_0x23054f){_0x2d28c9=_0x23054f;var _0x3fa0fc=_0x4f528f[_0x920d('0xad')](_0x2d28c9);return{'count':_0x3fa0fc[_0x920d('0x42')],'rows':_0x3fa0fc};})[_0x920d('0x32')](respondWithResult(_0x5e13bc,null))[_0x920d('0x27')](function(_0x2f727c){console['log'](_0x920d('0xae')+_0x2f727c);var _0x571aea=_0x285919[_0x920d('0x3c')][_0x920d('0xaf')]?0x1f4:_0x2f727c['statusCode']||0x1f4;logger[_0x920d('0x24')](_0x2f727c[_0x920d('0x34')]);delete _0x2f727c[_0x920d('0x35')];if(_0x571aea===0x191){_0x571aea=0x190;}_0x5e13bc['status'](_0x571aea)[_0x920d('0xb0')](_0x285919[_0x920d('0x3c')]['test']?{'message':_0x920d('0xb1'),'statusCode':_0x2f727c[_0x920d('0xb2')]}:_0x2f727c);});};function createFieldObject(_0x1dd448,_0x5f4e8d,_0x2753f8,_0x4068fb,_0x35613b,_0xc118fc){return new Promise(function(_0x197387,_0x29a28d){var _0x3d2a06={'id':_0x4068fb,'name':_0x35613b,'custom':_0xc118fc};if(_0x2753f8===_0x920d('0xb3')){_0x3d2a06['options']=[{'name':'True','value':_0x920d('0xb4')},{'name':_0x920d('0xb5'),'value':_0x920d('0xb6')}];_0x197387(_0x3d2a06);}else{var _0xe35467={'method':_0x920d('0xa2'),'uri':_0x1dd448+_0x920d('0xb7')+_0x4068fb,'auth':_0x5f4e8d,'json':!![]};return rp(_0xe35467)[_0x920d('0x32')](function(_0x1c5fb1){var _0x32efd8=[];if(_0x1c5fb1[_0x920d('0x26')][_0x920d('0x42')]>0x0){_0x1c5fb1[_0x920d('0x26')][_0x920d('0xa5')](function(_0x2d6f5c){if(_0x2d6f5c[_0x920d('0xb8')]==='false'){var _0x435428={'name':_0x2d6f5c[_0x920d('0xab')],'value':_0x2d6f5c[_0x920d('0xb9')]};_0x32efd8[_0x920d('0xac')](_0x435428);}});}_0x3d2a06[_0x920d('0x4d')]=_0x32efd8;if(_0x3d2a06[_0x920d('0x4d')][_0x920d('0x42')]>0x0){_0x197387(_0x3d2a06);}else{if(_0xc118fc==![]){_0x197387();}else{_0x197387(_0x3d2a06);}}});}});} \ No newline at end of file +var _0x5470=['remove','forEach','internalType','label','push','all','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','False','false','inactive','value','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','getConfigurations','findOne','ServicenowConfiguration','sort','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','correlation_display','work_start','additional_assignee_list','description','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','email','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects'];(function(_0x358a07,_0x1770c6){var _0x307748=function(_0x13587c){while(--_0x13587c){_0x358a07['push'](_0x358a07['shift']());}};_0x307748(++_0x1770c6);}(_0x5470,0xda));var _0x0547=function(_0x290631,_0xe0a9ea){_0x290631=_0x290631-0x0;var _0x4c628f=_0x5470[_0x290631];return _0x4c628f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0547('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0547('0x1'));var jsonpatch=require(_0x0547('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0547('0x3'));var util=require(_0x0547('0x4'));var path=require(_0x0547('0x5'));var sox=require(_0x0547('0x6'));var csv=require(_0x0547('0x7'));var ejs=require(_0x0547('0x8'));var fs=require('fs');var _=require(_0x0547('0x9'));var squel=require('squel');var crypto=require(_0x0547('0xa'));var jsforce=require(_0x0547('0xb'));var deskjs=require(_0x0547('0xc'));var toCsv=require(_0x0547('0x7'));var querystring=require(_0x0547('0xd'));var Papa=require(_0x0547('0xe'));var Redis=require(_0x0547('0xf'));var authService=require(_0x0547('0x10'));var qs=require(_0x0547('0x11'));var as=require(_0x0547('0x12'));var hardwareService=require(_0x0547('0x13'));var logger=require(_0x0547('0x14'))('api');var utils=require(_0x0547('0x15'));var config=require(_0x0547('0x16'));var licenseUtil=require(_0x0547('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0547('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x0547('0x19')][_0x0547('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x51eeb3,_0x322532,_0x18a81a,_0x196f8f){return new BPromise(function(_0x27bd1d,_0x1a24f5){var _0x300a88=_0x196f8f||client;return _0x300a88[_0x0547('0x1b')](_0x51eeb3,_0x18a81a)[_0x0547('0x1c')](function(_0x4e74fc){logger[_0x0547('0x1d')](_0x0547('0x1e'),_0x322532,_0x0547('0x1f'));logger[_0x0547('0x20')](_0x0547('0x21'),_0x322532,_0x0547('0x1f'),JSON[_0x0547('0x22')](_0x4e74fc));if(_0x4e74fc[_0x0547('0x23')]){if(_0x4e74fc['error'][_0x0547('0x24')]===0x1f4){logger[_0x0547('0x23')](_0x0547('0x1e'),_0x322532,_0x4e74fc['error'][_0x0547('0x25')]);return _0x1a24f5(_0x4e74fc[_0x0547('0x23')][_0x0547('0x25')]);}logger['error'](_0x0547('0x1e'),_0x322532,_0x4e74fc[_0x0547('0x23')][_0x0547('0x25')]);return _0x27bd1d(_0x4e74fc['error'][_0x0547('0x25')]);}else{logger[_0x0547('0x1d')](_0x0547('0x1e'),_0x322532,'request\x20sent');_0x27bd1d(_0x4e74fc[_0x0547('0x26')][_0x0547('0x25')]);}})['catch'](function(_0x2c5652){logger[_0x0547('0x23')](_0x0547('0x1e'),_0x322532,_0x2c5652);_0x1a24f5(_0x2c5652);});});}function respondWithStatusCode(_0x3b963b,_0x20c89f){_0x20c89f=_0x20c89f||0xcc;return function(_0x3a39f8){if(_0x3a39f8){return _0x3b963b[_0x0547('0x27')](_0x20c89f);}return _0x3b963b[_0x0547('0x28')](_0x20c89f)[_0x0547('0x29')]();};}function respondWithResult(_0x1d1746,_0x3cae8b){_0x3cae8b=_0x3cae8b||0xc8;return function(_0x2621bc){if(_0x2621bc){return _0x1d1746[_0x0547('0x28')](_0x3cae8b)['json'](_0x2621bc);}};}function respondWithFilteredResult(_0x293a4a,_0x1d4c36){return function(_0x1b09b2){if(_0x1b09b2){var _0x7faddf=_0x1b09b2[_0x0547('0x2a')],_0x42b98d=_0x1d4c36[_0x0547('0x2b')],_0x14e9aa=_0x1d4c36[_0x0547('0x2b')]+_0x1d4c36[_0x0547('0x2c')],_0x1a105a;if(_0x14e9aa>=_0x7faddf){_0x14e9aa=_0x7faddf;_0x1a105a=0xc8;}else{_0x1a105a=0xce;}_0x293a4a['status'](_0x1a105a);return _0x293a4a[_0x0547('0x2d')](_0x0547('0x2e'),_0x42b98d+'-'+_0x14e9aa+'/'+_0x7faddf)['json'](_0x1b09b2);}return null;};}function patchUpdates(_0x1caca4){return function(_0x1987ac){try{jsonpatch[_0x0547('0x2f')](_0x1987ac,_0x1caca4,!![]);}catch(_0x320e69){return BPromise[_0x0547('0x30')](_0x320e69);}return _0x1987ac[_0x0547('0x31')]();};}function saveUpdates(_0x95d500,_0x5658fc){return function(_0x2d2ed9){if(_0x2d2ed9){return _0x2d2ed9[_0x0547('0x32')](_0x95d500)[_0x0547('0x1c')](function(_0x4982b8){return _0x4982b8;});}return null;};}function removeEntity(_0x4f283a,_0x59df1c){return function(_0x5b81c5){if(_0x5b81c5){return _0x5b81c5[_0x0547('0x33')]()[_0x0547('0x1c')](function(){_0x4f283a[_0x0547('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5202e9,_0x41580b){return function(_0x82288b){if(!_0x82288b){_0x5202e9[_0x0547('0x27')](0x194);}return _0x82288b;};}function handleError(_0xeba16c,_0x32e6b9){_0x32e6b9=_0x32e6b9||0x1f4;return function(_0x31c8f0){logger['error'](_0x31c8f0[_0x0547('0x34')]);if(_0x31c8f0[_0x0547('0x35')]){delete _0x31c8f0[_0x0547('0x35')];}_0xeba16c[_0x0547('0x28')](_0x32e6b9)['send'](_0x31c8f0);};}exports[_0x0547('0x36')]=function(_0x1c7780,_0x2f7343){var _0x246eda={},_0x573282={},_0x3265f8={'count':0x0,'rows':[]};var _0x2fadcf=_[_0x0547('0x37')](db[_0x0547('0x38')][_0x0547('0x39')],function(_0x6a5cf0){return{'name':_0x6a5cf0[_0x0547('0x3a')],'type':_0x6a5cf0['type'][_0x0547('0x3b')]};});_0x573282[_0x0547('0x3c')]=_['map'](_0x2fadcf,'name');_0x573282[_0x0547('0x3d')]=_[_0x0547('0x3e')](_0x1c7780[_0x0547('0x3d')]);_0x573282[_0x0547('0x3f')]=_[_0x0547('0x40')](_0x573282[_0x0547('0x3c')],_0x573282[_0x0547('0x3d')]);_0x246eda[_0x0547('0x41')]=_['intersection'](_0x573282[_0x0547('0x3c')],qs[_0x0547('0x42')](_0x1c7780['query'][_0x0547('0x42')]));_0x246eda['attributes']=_0x246eda[_0x0547('0x41')][_0x0547('0x43')]?_0x246eda['attributes']:_0x573282[_0x0547('0x3c')];if(!_0x1c7780[_0x0547('0x3d')][_0x0547('0x44')](_0x0547('0x45'))){_0x246eda[_0x0547('0x2c')]=qs[_0x0547('0x2c')](_0x1c7780[_0x0547('0x3d')]['limit']);_0x246eda[_0x0547('0x2b')]=qs[_0x0547('0x2b')](_0x1c7780['query'][_0x0547('0x2b')]);}_0x246eda[_0x0547('0x46')]=qs['sort'](_0x1c7780['query']['sort']);_0x246eda[_0x0547('0x47')]=qs['filters'](_['pick'](_0x1c7780[_0x0547('0x3d')],_0x573282[_0x0547('0x3f')]),_0x2fadcf);if(_0x1c7780[_0x0547('0x3d')]['filter']){_0x246eda[_0x0547('0x47')]=_['merge'](_0x246eda[_0x0547('0x47')],{'$or':_[_0x0547('0x37')](_0x2fadcf,function(_0x3f89d9){if(_0x3f89d9[_0x0547('0x48')]!==_0x0547('0x49')){var _0x4b4659={};_0x4b4659[_0x3f89d9[_0x0547('0x35')]]={'$like':'%'+_0x1c7780[_0x0547('0x3d')][_0x0547('0x4a')]+'%'};return _0x4b4659;}})});}_0x246eda=_['merge']({},_0x246eda,_0x1c7780[_0x0547('0x4b')]);var _0x1fa2bb={'where':_0x246eda[_0x0547('0x47')]};return db[_0x0547('0x38')][_0x0547('0x2a')](_0x1fa2bb)[_0x0547('0x1c')](function(_0x31a899){_0x3265f8['count']=_0x31a899;if(_0x1c7780[_0x0547('0x3d')]['includeAll']){_0x246eda[_0x0547('0x4c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x0547('0x4d')](_0x246eda);})[_0x0547('0x1c')](function(_0x386aea){_0x3265f8[_0x0547('0x4e')]=_0x386aea;return _0x3265f8;})[_0x0547('0x1c')](respondWithFilteredResult(_0x2f7343,_0x246eda))[_0x0547('0x4f')](handleError(_0x2f7343,null));};exports[_0x0547('0x50')]=function(_0x238651,_0x54cfcb){var _0x576c92={'raw':![],'where':{'id':_0x238651[_0x0547('0x51')]['id']}},_0x390fca={};_0x390fca[_0x0547('0x3c')]=_[_0x0547('0x3e')](db[_0x0547('0x38')][_0x0547('0x39')]);_0x390fca[_0x0547('0x3d')]=_[_0x0547('0x3e')](_0x238651[_0x0547('0x3d')]);_0x390fca[_0x0547('0x3f')]=_[_0x0547('0x40')](_0x390fca[_0x0547('0x3c')],_0x390fca[_0x0547('0x3d')]);_0x576c92[_0x0547('0x41')]=_[_0x0547('0x40')](_0x390fca[_0x0547('0x3c')],qs[_0x0547('0x42')](_0x238651['query'][_0x0547('0x42')]));_0x576c92[_0x0547('0x41')]=_0x576c92[_0x0547('0x41')]['length']?_0x576c92[_0x0547('0x41')]:_0x390fca[_0x0547('0x3c')];if(_0x238651['query'][_0x0547('0x52')]){_0x576c92[_0x0547('0x4c')]=[{'all':!![]}];}_0x576c92=_[_0x0547('0x53')]({},_0x576c92,_0x238651[_0x0547('0x4b')]);return db['ServicenowAccount'][_0x0547('0x54')](_0x576c92)[_0x0547('0x1c')](handleEntityNotFound(_0x54cfcb,null))[_0x0547('0x1c')](respondWithResult(_0x54cfcb,null))[_0x0547('0x4f')](handleError(_0x54cfcb,null));};exports[_0x0547('0x55')]=function(_0x56ba74,_0x1c4146){return db[_0x0547('0x38')][_0x0547('0x55')](_0x56ba74[_0x0547('0x56')],{})[_0x0547('0x1c')](respondWithResult(_0x1c4146,0xc9))[_0x0547('0x4f')](handleError(_0x1c4146,null));};exports[_0x0547('0x32')]=function(_0xc90837,_0x1db118){if(_0xc90837[_0x0547('0x56')]['id']){delete _0xc90837['body']['id'];}return db['ServicenowAccount'][_0x0547('0x54')]({'where':{'id':_0xc90837[_0x0547('0x51')]['id']}})[_0x0547('0x1c')](handleEntityNotFound(_0x1db118,null))[_0x0547('0x1c')](saveUpdates(_0xc90837[_0x0547('0x56')],null))['then'](respondWithResult(_0x1db118,null))[_0x0547('0x4f')](handleError(_0x1db118,null));};exports[_0x0547('0x33')]=function(_0x1281c9,_0x141560){return db[_0x0547('0x38')][_0x0547('0x54')]({'where':{'id':_0x1281c9[_0x0547('0x51')]['id']}})[_0x0547('0x1c')](handleEntityNotFound(_0x141560,null))['then'](removeEntity(_0x141560,null))[_0x0547('0x4f')](handleError(_0x141560,null));};exports[_0x0547('0x57')]=function(_0x25db6e,_0x2b76a6,_0x4d5d13){var _0x3cb917={};var _0xb2abbf={};var _0x22bab4;var _0x3fbb43;return db[_0x0547('0x38')][_0x0547('0x58')]({'where':{'id':_0x25db6e[_0x0547('0x51')]['id']}})[_0x0547('0x1c')](handleEntityNotFound(_0x2b76a6,null))[_0x0547('0x1c')](function(_0x460369){if(_0x460369){_0x22bab4=_0x460369;_0xb2abbf['model']=_[_0x0547('0x3e')](db[_0x0547('0x59')][_0x0547('0x39')]);_0xb2abbf[_0x0547('0x3d')]=_[_0x0547('0x3e')](_0x25db6e[_0x0547('0x3d')]);_0xb2abbf[_0x0547('0x3f')]=_[_0x0547('0x40')](_0xb2abbf['model'],_0xb2abbf[_0x0547('0x3d')]);_0x3cb917[_0x0547('0x41')]=_[_0x0547('0x40')](_0xb2abbf[_0x0547('0x3c')],qs[_0x0547('0x42')](_0x25db6e[_0x0547('0x3d')][_0x0547('0x42')]));_0x3cb917[_0x0547('0x41')]=_0x3cb917[_0x0547('0x41')]['length']?_0x3cb917[_0x0547('0x41')]:_0xb2abbf['model'];_0x3cb917['order']=qs[_0x0547('0x5a')](_0x25db6e[_0x0547('0x3d')][_0x0547('0x5a')]);_0x3cb917[_0x0547('0x47')]=qs[_0x0547('0x3f')](_['pick'](_0x25db6e[_0x0547('0x3d')],_0xb2abbf[_0x0547('0x3f')]));if(_0x25db6e['query'][_0x0547('0x4a')]){_0x3cb917[_0x0547('0x47')]=_[_0x0547('0x53')](_0x3cb917[_0x0547('0x47')],{'$or':_['map'](_0x3cb917[_0x0547('0x41')],function(_0x4d3482){var _0x56bc81={};_0x56bc81[_0x4d3482]={'$like':'%'+_0x25db6e[_0x0547('0x3d')]['filter']+'%'};return _0x56bc81;})});}_0x3cb917=_['merge']({},_0x3cb917,_0x25db6e[_0x0547('0x4b')]);return _0x22bab4[_0x0547('0x57')](_0x3cb917);}})[_0x0547('0x1c')](function(_0x377167){if(_0x377167){_0x3fbb43=_0x377167['length'];if(!_0x25db6e[_0x0547('0x3d')][_0x0547('0x44')](_0x0547('0x45'))){_0x3cb917[_0x0547('0x2c')]=qs[_0x0547('0x2c')](_0x25db6e[_0x0547('0x3d')]['limit']);_0x3cb917[_0x0547('0x2b')]=qs[_0x0547('0x2b')](_0x25db6e[_0x0547('0x3d')][_0x0547('0x2b')]);}return _0x22bab4[_0x0547('0x57')](_0x3cb917);}})[_0x0547('0x1c')](function(_0x586e85){if(_0x586e85){return _0x586e85?{'count':_0x3fbb43,'rows':_0x586e85}:null;}})[_0x0547('0x1c')](respondWithResult(_0x2b76a6,null))['catch'](handleError(_0x2b76a6,null));};exports['addConfiguration']=function(_0x19d371,_0x198503,_0x34da7f){if(_0x19d371['body']['id']){delete _0x19d371['body']['id'];}return db[_0x0547('0x38')][_0x0547('0x58')]({'where':{'id':_0x19d371['params']['id']}})[_0x0547('0x1c')](handleEntityNotFound(_0x198503,null))[_0x0547('0x1c')](function(_0x355e3d){if(_0x355e3d){_0x19d371[_0x0547('0x56')][_0x0547('0x5b')]=_0x355e3d['id'];_0x19d371['body'][_0x0547('0x5c')]=integrations[_0x0547('0x5d')](_0x19d371[_0x0547('0x56')]['channel'],_0x19d371[_0x0547('0x56')][_0x0547('0x48')]);_0x19d371['body'][_0x0547('0x5e')]=integrations[_0x0547('0x5f')](_0x19d371['body'][_0x0547('0x60')],_0x19d371[_0x0547('0x56')][_0x0547('0x48')]);return db[_0x0547('0x59')][_0x0547('0x55')](_0x19d371[_0x0547('0x56')],{'include':[{'model':db[_0x0547('0x61')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x0547('0x5e')}]});}return null;})['then'](respondWithResult(_0x198503,null))[_0x0547('0x4f')](handleError(_0x198503,null));};exports[_0x0547('0x62')]=function(_0x19d90f,_0x3dd9c1,_0x3ec857){var _0x4ad209=[_0x0547('0x63'),_0x0547('0x64'),_0x0547('0x65'),'subcategory',_0x0547('0x66'),_0x0547('0x67'),_0x0547('0x68'),_0x0547('0x69'),_0x0547('0x6a')];var _0x1895ca=[_0x0547('0x6b'),_0x0547('0x63'),_0x0547('0x6c'),_0x0547('0x6d'),_0x0547('0x6e'),_0x0547('0x6f'),_0x0547('0x70'),_0x0547('0x64'),_0x0547('0x71'),_0x0547('0x72'),_0x0547('0x73'),_0x0547('0x74'),_0x0547('0x75'),'user_input',_0x0547('0x76'),_0x0547('0x77'),_0x0547('0x78'),'sys_created_by',_0x0547('0x65'),'order',_0x0547('0x79'),_0x0547('0x7a'),_0x0547('0x7b'),_0x0547('0x7c'),_0x0547('0x7d'),_0x0547('0x7e'),_0x0547('0x7f'),_0x0547('0x80'),_0x0547('0x81'),'sys_domain_path',_0x0547('0x82'),_0x0547('0x83'),_0x0547('0x84'),_0x0547('0x85'),_0x0547('0x86'),_0x0547('0x87'),_0x0547('0x88'),_0x0547('0x89'),_0x0547('0x8a'),_0x0547('0x8b'),_0x0547('0x8c'),_0x0547('0x8d'),'work_notes',_0x0547('0x8e'),_0x0547('0x66'),_0x0547('0x8f'),'delivery_task',_0x0547('0x90'),'assignment_group','business_stc',_0x0547('0x91'),_0x0547('0x92'),'calendar_duration',_0x0547('0x67'),_0x0547('0x93'),'close_notes',_0x0547('0x94'),_0x0547('0x95'),_0x0547('0x96'),_0x0547('0x97'),_0x0547('0x98'),_0x0547('0x99'),_0x0547('0x68'),'urgency',_0x0547('0x9a'),_0x0547('0x9b'),_0x0547('0x9c'),'activity_due','assigned_to','severity','comments','sla_due',_0x0547('0x9d'),_0x0547('0x9e'),_0x0547('0x9f'),_0x0547('0xa0'),_0x0547('0xa1'),_0x0547('0xa2'),_0x0547('0xa3'),'upon_approval',_0x0547('0xa4'),_0x0547('0xa5'),_0x0547('0x6a')];var _0x4d996b='';var _0x144f47='';var _0x2cfa52=[];var _0x359564='';var _0x25cb86='';var _0x498704=[];var _0x21263e='';var _0x2e6960='';var _0x107705={};var _0x20019c='';return db[_0x0547('0x38')][_0x0547('0x58')]({'where':{'id':_0x19d90f[_0x0547('0x51')]['id']},'attributes':['id',_0x0547('0xa6'),_0x0547('0xa7'),_0x0547('0xa8'),_0x0547('0xa9'),'serverUrl']})[_0x0547('0x1c')](handleEntityNotFound(_0x3dd9c1,null))[_0x0547('0x1c')](function(_0x4f7ebc){if(_0x4f7ebc){_0x20019c=_0x4f7ebc['remoteUri'];var _0x57a072=_0x20019c[_0x0547('0xaa')](-0x1);if(_0x57a072==='/'){_0x20019c=_0x20019c['substring'](0x0,_0x20019c[_0x0547('0xab')](_0x57a072));}_0x2e6960=util['format'](_0x0547('0xac'),_0x20019c);_0x21263e=util['format'](_0x0547('0xad'),_0x20019c);_0x107705={'user':_0x4f7ebc[_0x0547('0xa6')],'pass':_0x4f7ebc['password']};var _0x24dd7d={'method':_0x0547('0xae'),'uri':_0x2e6960+_0x0547('0xaf'),'auth':_0x107705,'json':!![]};return rp(_0x24dd7d);}})[_0x0547('0x1c')](function(_0x15c9ae){if(_0x15c9ae['result'][_0x0547('0x43')]>0x0){_0x4d996b=_0x15c9ae[_0x0547('0x26')];}console[_0x0547('0xb0')](_0x0547('0xb1'),_0x4d996b);_0x498704=[];_0x144f47=Object['assign']([],_0x4d996b);_[_0x0547('0xb2')](_0x144f47,function(_0x412160){return!_0x4ad209['includes'](_0x412160['name']);});_0x144f47[_0x0547('0xb3')](function(_0x3b5978){var _0x5a2a13=createFieldObject(_0x21263e,_0x107705,_0x3b5978[_0x0547('0xb4')],_0x3b5978[_0x0547('0x35')],_0x3b5978[_0x0547('0xb5')],![]);_0x498704[_0x0547('0xb6')](_0x5a2a13);});return Promise[_0x0547('0xb7')](_0x498704);})[_0x0547('0x1c')](function(_0x12bf37){_0x2cfa52=_0x12bf37;_0x359564=Object['assign']([],_0x4d996b);console[_0x0547('0xb0')]('TCL:\x20_object',_0x4d996b);_[_0x0547('0xb2')](_0x359564,function(_0x4fd3fa){return _0x1895ca[_0x0547('0xb8')](_0x4fd3fa['name']);});console['log'](_0x0547('0xb9'),_0x359564);_0x498704=[];_0x359564[_0x0547('0xb3')](function(_0x24aaaa){var _0x2ec6ff=createFieldObject(_0x21263e,_0x107705,_0x24aaaa[_0x0547('0xb4')],_0x24aaaa[_0x0547('0x35')],_0x24aaaa[_0x0547('0xb5')],!![]);_0x498704[_0x0547('0xb6')](_0x2ec6ff);});return Promise['all'](_0x498704);})[_0x0547('0x1c')](function(_0x2eaf38){_0x25cb86=_0x2eaf38;var _0x2ae9d1=_0x2cfa52[_0x0547('0xba')](_0x25cb86);return{'count':_0x2ae9d1['length'],'rows':_0x2ae9d1};})[_0x0547('0x1c')](respondWithResult(_0x3dd9c1,null))[_0x0547('0x4f')](function(_0x463255){console['log'](_0x0547('0xbb')+_0x463255);var _0x4c7b55=_0x19d90f['query'][_0x0547('0xbc')]?0x1f4:_0x463255[_0x0547('0xbd')]||0x1f4;logger[_0x0547('0x23')](_0x463255[_0x0547('0x34')]);delete _0x463255[_0x0547('0x35')];if(_0x4c7b55===0x191){_0x4c7b55=0x190;}_0x3dd9c1[_0x0547('0x28')](_0x4c7b55)[_0x0547('0xbe')](_0x19d90f[_0x0547('0x3d')][_0x0547('0xbc')]?{'message':_0x0547('0xbf'),'statusCode':_0x463255[_0x0547('0xbd')]}:_0x463255);});};function createFieldObject(_0x3f0d1a,_0x4fed2c,_0x49439e,_0x2aa157,_0xe9c5c2,_0x302606){return new Promise(function(_0x2803c5,_0x7bd234){var _0x2956d7={'id':_0x2aa157,'name':_0xe9c5c2,'custom':_0x302606};if(_0x49439e===_0x0547('0xc0')){_0x2956d7[_0x0547('0x4b')]=[{'name':_0x0547('0xc1'),'value':'true'},{'name':_0x0547('0xc2'),'value':_0x0547('0xc3')}];_0x2803c5(_0x2956d7);}else{var _0xfa1cc9={'method':_0x0547('0xae'),'uri':_0x3f0d1a+'sys_choice?sysparm_query=name=incident^element='+_0x2aa157,'auth':_0x4fed2c,'json':!![]};return rp(_0xfa1cc9)[_0x0547('0x1c')](function(_0x7ca5c9){var _0x58d594=[];if(_0x7ca5c9['result'][_0x0547('0x43')]>0x0){_0x7ca5c9[_0x0547('0x26')][_0x0547('0xb3')](function(_0x4108f5){if(_0x4108f5[_0x0547('0xc4')]===_0x0547('0xc3')){var _0x4f1583={'name':_0x4108f5['label'],'value':_0x4108f5[_0x0547('0xc5')]};_0x58d594[_0x0547('0xb6')](_0x4f1583);}});}_0x2956d7[_0x0547('0x4b')]=_0x58d594;if(_0x2956d7[_0x0547('0x4b')]['length']>0x0){_0x2803c5(_0x2956d7);}else{if(_0x302606==![]){_0x2803c5();}else{_0x2803c5(_0x2956d7);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c205db9..9efe09e 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['exports','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x26c4ec,_0x4d0e06){var _0xb8ee93=function(_0x8103f7){while(--_0x8103f7){_0x26c4ec['push'](_0x26c4ec['shift']());}};_0xb8ee93(++_0x4d0e06);}(_0xa41a,0x6b));var _0xaa41=function(_0xb03e40,_0x11ea2a){_0xb03e40=_0xb03e40-0x0;var _0x22bf3d=_0xa41a[_0xb03e40];return _0x22bf3d;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xaa41('0xa')]=function(_0x1ec9d4,_0x54bc5a){return _0x1ec9d4['define'](_0xaa41('0xb'),attributes,{'tableName':_0xaa41('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24ca=['define','ServicenowAccount','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x264194,_0x48ee77){var _0x584be0=function(_0x4f9b57){while(--_0x4f9b57){_0x264194['push'](_0x264194['shift']());}};_0x584be0(++_0x48ee77);}(_0x24ca,0x1bc));var _0xa24c=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0x24ca[_0x31dde9];return _0x1fbf2d;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));var integrations=require(_0xa24c('0x9'));module[_0xa24c('0xa')]=function(_0x3c0aaa,_0x2dd348){return _0x3c0aaa[_0xa24c('0xb')](_0xa24c('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 439ce50..e5d614c 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.rpc.js +++ b/server/api/intServicenowAccount/intServicenowAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66a5=['map','model','attributes','then','catch','find','ShowServicenowAccount','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetServicenowAccount','findAll','options','raw','where','include'];(function(_0x1b8086,_0x4fb30c){var _0x4f2f11=function(_0x76a02f){while(--_0x76a02f){_0x1b8086['push'](_0x1b8086['shift']());}};_0x4f2f11(++_0x4fb30c);}(_0x66a5,0x1b8));var _0x566a=function(_0x2fb87e,_0x483324){_0x2fb87e=_0x2fb87e-0x0;var _0x5de4c1=_0x66a5[_0x2fb87e];return _0x5de4c1;};'use strict';var _=require(_0x566a('0x0'));var util=require(_0x566a('0x1'));var moment=require('moment');var BPromise=require(_0x566a('0x2'));var rs=require(_0x566a('0x3'));var fs=require('fs');var Redis=require(_0x566a('0x4'));var db=require(_0x566a('0x5'))['db'];var utils=require(_0x566a('0x6'));var logger=require(_0x566a('0x7'))(_0x566a('0x8'));var config=require(_0x566a('0x9'));var jayson=require(_0x566a('0xa'));var client=jayson['client'][_0x566a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49dad2,_0x57d315,_0x32a12f){return new BPromise(function(_0x4b5ee4,_0xf293c9){return client[_0x566a('0xc')](_0x49dad2,_0x32a12f)['then'](function(_0x46f203){logger[_0x566a('0xd')](_0x566a('0xe'),_0x57d315,'request\x20sent');logger[_0x566a('0xf')](_0x566a('0x10'),_0x57d315,_0x566a('0x11'),JSON['stringify'](_0x46f203));if(_0x46f203[_0x566a('0x12')]){if(_0x46f203[_0x566a('0x12')][_0x566a('0x13')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x57d315,_0x46f203[_0x566a('0x12')][_0x566a('0x14')]);return _0xf293c9(_0x46f203[_0x566a('0x12')][_0x566a('0x14')]);}logger['error'](_0x566a('0xe'),_0x57d315,_0x46f203[_0x566a('0x12')][_0x566a('0x14')]);return _0x4b5ee4(_0x46f203[_0x566a('0x12')][_0x566a('0x14')]);}else{logger['info'](_0x566a('0xe'),_0x57d315,_0x566a('0x11'));_0x4b5ee4(_0x46f203[_0x566a('0x15')][_0x566a('0x14')]);}})['catch'](function(_0x395521){logger[_0x566a('0x12')](_0x566a('0xe'),_0x57d315,_0x395521);_0xf293c9(_0x395521);});});}exports[_0x566a('0x16')]=function(_0x53aeaf){var _0x11bd34=this;return new Promise(function(_0x428f67,_0xd9ea28){return db['ServicenowAccount'][_0x566a('0x17')]({'raw':_0x53aeaf[_0x566a('0x18')]?_0x53aeaf[_0x566a('0x18')][_0x566a('0x19')]===undefined?!![]:![]:!![],'where':_0x53aeaf[_0x566a('0x18')]?_0x53aeaf[_0x566a('0x18')][_0x566a('0x1a')]||null:null,'attributes':_0x53aeaf[_0x566a('0x18')]?_0x53aeaf['options']['attributes']||null:null,'limit':_0x53aeaf[_0x566a('0x18')]?_0x53aeaf[_0x566a('0x18')]['limit']||null:null,'include':_0x53aeaf[_0x566a('0x18')]?_0x53aeaf[_0x566a('0x18')][_0x566a('0x1b')]?_[_0x566a('0x1c')](_0x53aeaf[_0x566a('0x18')][_0x566a('0x1b')],function(_0x849c5f){return{'model':db[_0x849c5f[_0x566a('0x1d')]],'as':_0x849c5f['as'],'attributes':_0x849c5f[_0x566a('0x1e')],'include':_0x849c5f[_0x566a('0x1b')]?_[_0x566a('0x1c')](_0x849c5f['include'],function(_0x1fc03c){return{'model':db[_0x1fc03c[_0x566a('0x1d')]],'as':_0x1fc03c['as'],'attributes':_0x1fc03c['attributes'],'include':_0x1fc03c[_0x566a('0x1b')]?_[_0x566a('0x1c')](_0x1fc03c['include'],function(_0x2f16f3){return{'model':db[_0x2f16f3[_0x566a('0x1d')]],'as':_0x2f16f3['as'],'attributes':_0x2f16f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x566a('0x1f')](function(_0x9fbad3){logger[_0x566a('0xd')]('GetServicenowAccount',_0x53aeaf);logger[_0x566a('0xf')](_0x566a('0x16'),_0x53aeaf,JSON['stringify'](_0x9fbad3));_0x428f67(_0x9fbad3);})[_0x566a('0x20')](function(_0x244aa3){logger[_0x566a('0x12')](_0x566a('0x16'),_0x244aa3[_0x566a('0x14')],_0x53aeaf);_0xd9ea28(_0x11bd34[_0x566a('0x12')](0x1f4,_0x244aa3[_0x566a('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x586b69){var _0x1be7d7=this;return new Promise(function(_0x58405c,_0x1251ab){return db['ServicenowAccount'][_0x566a('0x21')]({'raw':_0x586b69[_0x566a('0x18')]?_0x586b69['options'][_0x566a('0x19')]===undefined?!![]:![]:!![],'where':_0x586b69['options']?_0x586b69[_0x566a('0x18')]['where']||null:null,'attributes':_0x586b69[_0x566a('0x18')]?_0x586b69[_0x566a('0x18')][_0x566a('0x1e')]||null:null,'include':_0x586b69['options']?_0x586b69[_0x566a('0x18')][_0x566a('0x1b')]?_[_0x566a('0x1c')](_0x586b69['options'][_0x566a('0x1b')],function(_0x249adb){return{'model':db[_0x249adb[_0x566a('0x1d')]],'as':_0x249adb['as'],'attributes':_0x249adb[_0x566a('0x1e')],'include':_0x249adb[_0x566a('0x1b')]?_[_0x566a('0x1c')](_0x249adb[_0x566a('0x1b')],function(_0x79b69){return{'model':db[_0x79b69[_0x566a('0x1d')]],'as':_0x79b69['as'],'attributes':_0x79b69['attributes'],'include':_0x79b69[_0x566a('0x1b')]?_[_0x566a('0x1c')](_0x79b69[_0x566a('0x1b')],function(_0x3611ec){return{'model':db[_0x3611ec[_0x566a('0x1d')]],'as':_0x3611ec['as'],'attributes':_0x3611ec[_0x566a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x566a('0x1f')](function(_0x1058ba){logger[_0x566a('0xd')](_0x566a('0x22'),_0x586b69);logger['debug'](_0x566a('0x22'),_0x586b69,JSON[_0x566a('0x23')](_0x1058ba));_0x58405c(_0x1058ba);})[_0x566a('0x20')](function(_0x4222b0){logger[_0x566a('0x12')]('ShowServicenowAccount',_0x4222b0[_0x566a('0x14')],_0x586b69);_0x1251ab(_0x1be7d7[_0x566a('0x12')](0x1f4,_0x4222b0['message']));});});}; \ No newline at end of file +var _0x82e4=['GetServicenowAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowServicenowAccount','ServicenowAccount','find','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x12a721,_0x5239ae){var _0x8c0ae0=function(_0x1f102c){while(--_0x1f102c){_0x12a721['push'](_0x12a721['shift']());}};_0x8c0ae0(++_0x5239ae);}(_0x82e4,0x71));var _0x482e=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0x82e4[_0x553150];return _0x18193d;};'use strict';var _=require(_0x482e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x482e('0x1'))['db'];var utils=require(_0x482e('0x2'));var logger=require(_0x482e('0x3'))(_0x482e('0x4'));var config=require('../../config/environment');var jayson=require(_0x482e('0x5'));var client=jayson[_0x482e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43a17b,_0x15d834,_0x4a47d0){return new BPromise(function(_0x24746e,_0x5bd39d){return client[_0x482e('0x7')](_0x43a17b,_0x4a47d0)[_0x482e('0x8')](function(_0x21194f){logger[_0x482e('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x15d834,_0x482e('0xa'));logger[_0x482e('0xb')](_0x482e('0xc'),_0x15d834,_0x482e('0xa'),JSON['stringify'](_0x21194f));if(_0x21194f['error']){if(_0x21194f[_0x482e('0xd')][_0x482e('0xe')]===0x1f4){logger[_0x482e('0xd')](_0x482e('0xf'),_0x15d834,_0x21194f[_0x482e('0xd')][_0x482e('0x10')]);return _0x5bd39d(_0x21194f[_0x482e('0xd')][_0x482e('0x10')]);}logger[_0x482e('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x15d834,_0x21194f[_0x482e('0xd')][_0x482e('0x10')]);return _0x24746e(_0x21194f['error']['message']);}else{logger[_0x482e('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x15d834,_0x482e('0xa'));_0x24746e(_0x21194f[_0x482e('0x11')][_0x482e('0x10')]);}})[_0x482e('0x12')](function(_0x1ac075){logger['error'](_0x482e('0xf'),_0x15d834,_0x1ac075);_0x5bd39d(_0x1ac075);});});}exports[_0x482e('0x13')]=function(_0x5b4771){var _0x30a282=this;return new Promise(function(_0x22c197,_0x34302a){return db['ServicenowAccount'][_0x482e('0x14')]({'raw':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')][_0x482e('0x16')]===undefined?!![]:![]:!![],'where':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')][_0x482e('0x17')]||null:null,'attributes':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')]['attributes']||null:null,'limit':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')][_0x482e('0x18')]||null:null,'include':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')][_0x482e('0x19')]?_[_0x482e('0x1a')](_0x5b4771['options'][_0x482e('0x19')],function(_0x593ab5){return{'model':db[_0x593ab5['model']],'as':_0x593ab5['as'],'attributes':_0x593ab5['attributes'],'include':_0x593ab5['include']?_[_0x482e('0x1a')](_0x593ab5['include'],function(_0x2b9a31){return{'model':db[_0x2b9a31[_0x482e('0x1b')]],'as':_0x2b9a31['as'],'attributes':_0x2b9a31[_0x482e('0x1c')],'include':_0x2b9a31[_0x482e('0x19')]?_['map'](_0x2b9a31['include'],function(_0x5ddf07){return{'model':db[_0x5ddf07[_0x482e('0x1b')]],'as':_0x5ddf07['as'],'attributes':_0x5ddf07['attributes']};}):[]};}):[]};}):[]:[]})[_0x482e('0x8')](function(_0x5577d8){logger[_0x482e('0x9')](_0x482e('0x13'),_0x5b4771);logger['debug'](_0x482e('0x13'),_0x5b4771,JSON[_0x482e('0x1d')](_0x5577d8));_0x22c197(_0x5577d8);})[_0x482e('0x12')](function(_0x40deca){logger[_0x482e('0xd')](_0x482e('0x13'),_0x40deca[_0x482e('0x10')],_0x5b4771);_0x34302a(_0x30a282[_0x482e('0xd')](0x1f4,_0x40deca[_0x482e('0x10')]));});});};exports[_0x482e('0x1e')]=function(_0xc0f1d5){var _0x58437e=this;return new Promise(function(_0x4427a4,_0x13adcc){return db[_0x482e('0x1f')][_0x482e('0x20')]({'raw':_0xc0f1d5['options']?_0xc0f1d5['options'][_0x482e('0x16')]===undefined?!![]:![]:!![],'where':_0xc0f1d5['options']?_0xc0f1d5['options'][_0x482e('0x17')]||null:null,'attributes':_0xc0f1d5[_0x482e('0x15')]?_0xc0f1d5[_0x482e('0x15')][_0x482e('0x1c')]||null:null,'include':_0xc0f1d5[_0x482e('0x15')]?_0xc0f1d5['options'][_0x482e('0x19')]?_[_0x482e('0x1a')](_0xc0f1d5[_0x482e('0x15')][_0x482e('0x19')],function(_0x31b8b0){return{'model':db[_0x31b8b0[_0x482e('0x1b')]],'as':_0x31b8b0['as'],'attributes':_0x31b8b0[_0x482e('0x1c')],'include':_0x31b8b0[_0x482e('0x19')]?_['map'](_0x31b8b0[_0x482e('0x19')],function(_0x1cf96f){return{'model':db[_0x1cf96f[_0x482e('0x1b')]],'as':_0x1cf96f['as'],'attributes':_0x1cf96f[_0x482e('0x1c')],'include':_0x1cf96f[_0x482e('0x19')]?_[_0x482e('0x1a')](_0x1cf96f[_0x482e('0x19')],function(_0x9a1f50){return{'model':db[_0x9a1f50[_0x482e('0x1b')]],'as':_0x9a1f50['as'],'attributes':_0x9a1f50[_0x482e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40eff2){logger['info'](_0x482e('0x1e'),_0xc0f1d5);logger[_0x482e('0xb')](_0x482e('0x1e'),_0xc0f1d5,JSON[_0x482e('0x1d')](_0x40eff2));_0x4427a4(_0x40eff2);})[_0x482e('0x12')](function(_0x11e21c){logger['error'](_0x482e('0x1e'),_0x11e21c[_0x482e('0x10')],_0xc0f1d5);_0x13adcc(_0x58437e[_0x482e('0xd')](0x1f4,_0x11e21c[_0x482e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index dea4cb3..e6cd878 100644 --- a/server/api/intServicenowConfiguration/index.js +++ b/server/api/intServicenowConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53f4=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','get','isAuthenticated','show','/:id/fields','getFields','/:id/descriptions','post','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x47ef21,_0x20c976){var _0x2b64e3=function(_0x368440){while(--_0x368440){_0x47ef21['push'](_0x47ef21['shift']());}};_0x2b64e3(++_0x20c976);}(_0x53f4,0xec));var _0x453f=function(_0x14691b,_0x2420b7){_0x14691b=_0x14691b-0x0;var _0x1bda9c=_0x53f4[_0x14691b];return _0x1bda9c;};'use strict';var multer=require(_0x453f('0x0'));var util=require(_0x453f('0x1'));var path=require(_0x453f('0x2'));var timeout=require('connect-timeout');var express=require(_0x453f('0x3'));var router=express[_0x453f('0x4')]();var auth=require(_0x453f('0x5'));var interaction=require(_0x453f('0x6'));var config=require(_0x453f('0x7'));var controller=require(_0x453f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x453f('0x9')]);router[_0x453f('0xa')]('/:id',auth[_0x453f('0xb')](),controller[_0x453f('0xc')]);router[_0x453f('0xa')](_0x453f('0xd'),auth[_0x453f('0xb')](),controller[_0x453f('0xe')]);router[_0x453f('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x453f('0xa')](_0x453f('0xf'),auth[_0x453f('0xb')](),controller['getDescriptions']);router[_0x453f('0x10')]('/',auth[_0x453f('0xb')](),controller['create']);router[_0x453f('0x11')](_0x453f('0x12'),auth[_0x453f('0xb')](),controller['update']);router[_0x453f('0x13')](_0x453f('0x12'),auth[_0x453f('0xb')](),controller[_0x453f('0x14')]);module[_0x453f('0x15')]=router; \ No newline at end of file +var _0x5844=['../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x5844,0x1ef));var _0x4584=function(_0xfcd0ca,_0xe39162){_0xfcd0ca=_0xfcd0ca-0x0;var _0x4f83a3=_0x5844[_0xfcd0ca];return _0x4f83a3;};'use strict';var multer=require(_0x4584('0x0'));var util=require(_0x4584('0x1'));var path=require(_0x4584('0x2'));var timeout=require(_0x4584('0x3'));var express=require('express');var router=express[_0x4584('0x4')]();var auth=require(_0x4584('0x5'));var interaction=require(_0x4584('0x6'));var config=require('../../config/environment');var controller=require(_0x4584('0x7'));router[_0x4584('0x8')]('/',auth[_0x4584('0x9')](),controller[_0x4584('0xa')]);router[_0x4584('0x8')](_0x4584('0xb'),auth['isAuthenticated'](),controller[_0x4584('0xc')]);router[_0x4584('0x8')]('/:id/fields',auth[_0x4584('0x9')](),controller['getFields']);router['get'](_0x4584('0xd'),auth[_0x4584('0x9')](),controller[_0x4584('0xe')]);router['get'](_0x4584('0xf'),auth[_0x4584('0x9')](),controller[_0x4584('0x10')]);router['post']('/',auth[_0x4584('0x9')](),controller['create']);router[_0x4584('0x11')](_0x4584('0xb'),auth[_0x4584('0x9')](),controller[_0x4584('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4584('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 6af5f11..14519b0 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35f2=['sequelize','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x35f2,0x1d6));var _0x235f=function(_0x1578b9,_0x546403){_0x1578b9=_0x1578b9-0x0;var _0x4e5031=_0x35f2[_0x1578b9];return _0x4e5031;};'use strict';var Sequelize=require(_0x235f('0x0'));module['exports']={'name':{'type':Sequelize[_0x235f('0x1')]},'description':{'type':Sequelize[_0x235f('0x1')]}}; \ No newline at end of file +var _0x6021=['sequelize','STRING'];(function(_0x55291a,_0x814018){var _0x3c870c=function(_0x1fd787){while(--_0x1fd787){_0x55291a['push'](_0x55291a['shift']());}};_0x3c870c(++_0x814018);}(_0x6021,0x96));var _0x1602=function(_0x5e6377,_0x589bc4){_0x5e6377=_0x5e6377-0x0;var _0x5996c7=_0x6021[_0x5e6377];return _0x5996c7;};'use strict';var Sequelize=require(_0x1602('0x0'));module['exports']={'name':{'type':Sequelize[_0x1602('0x1')]},'description':{'type':Sequelize[_0x1602('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d199d8e..f0db136 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ddf=['filters','filter','merge','options','includeAll','include','findAll','rows','params','find','create','body','findOne','ServicenowField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x259487,_0x13109f){var _0x459448=function(_0x291bc1){while(--_0x291bc1){_0x259487['push'](_0x259487['shift']());}};_0x459448(++_0x13109f);}(_0x5ddf,0x125));var _0xf5dd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5ddf[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xf5dd('0x0'));var emlformat=require(_0xf5dd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf5dd('0x2'));var jsonpatch=require(_0xf5dd('0x3'));var rp=require(_0xf5dd('0x4'));var moment=require(_0xf5dd('0x5'));var BPromise=require(_0xf5dd('0x6'));var Mustache=require(_0xf5dd('0x7'));var util=require(_0xf5dd('0x8'));var path=require(_0xf5dd('0x9'));var sox=require(_0xf5dd('0xa'));var csv=require(_0xf5dd('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5dd('0xc'));var squel=require('squel');var crypto=require(_0xf5dd('0xd'));var jsforce=require(_0xf5dd('0xe'));var deskjs=require(_0xf5dd('0xf'));var toCsv=require(_0xf5dd('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf5dd('0x10'));var authService=require(_0xf5dd('0x11'));var qs=require(_0xf5dd('0x12'));var as=require(_0xf5dd('0x13'));var hardwareService=require(_0xf5dd('0x14'));var logger=require(_0xf5dd('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf5dd('0x16'));var licenseUtil=require(_0xf5dd('0x17'));var db=require(_0xf5dd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf5dd('0x19')][_0xf5dd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2a9a3c,_0x1c922e,_0x211979,_0x122083){return new BPromise(function(_0x4472ac,_0x31a073){var _0x49aa49=_0x122083||client;return _0x49aa49['request'](_0x2a9a3c,_0x211979)[_0xf5dd('0x1b')](function(_0x5f2b9f){logger[_0xf5dd('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1c922e,_0xf5dd('0x1d'));logger[_0xf5dd('0x1e')](_0xf5dd('0x1f'),_0x1c922e,_0xf5dd('0x1d'),JSON[_0xf5dd('0x20')](_0x5f2b9f));if(_0x5f2b9f[_0xf5dd('0x21')]){if(_0x5f2b9f[_0xf5dd('0x21')][_0xf5dd('0x22')]===0x1f4){logger[_0xf5dd('0x21')](_0xf5dd('0x23'),_0x1c922e,_0x5f2b9f[_0xf5dd('0x21')][_0xf5dd('0x24')]);return _0x31a073(_0x5f2b9f[_0xf5dd('0x21')][_0xf5dd('0x24')]);}logger[_0xf5dd('0x21')](_0xf5dd('0x23'),_0x1c922e,_0x5f2b9f[_0xf5dd('0x21')][_0xf5dd('0x24')]);return _0x4472ac(_0x5f2b9f[_0xf5dd('0x21')][_0xf5dd('0x24')]);}else{logger[_0xf5dd('0x1c')](_0xf5dd('0x23'),_0x1c922e,_0xf5dd('0x1d'));_0x4472ac(_0x5f2b9f[_0xf5dd('0x25')][_0xf5dd('0x24')]);}})[_0xf5dd('0x26')](function(_0x570a64){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1c922e,_0x570a64);_0x31a073(_0x570a64);});});}function respondWithStatusCode(_0x4116f0,_0x2f88df){_0x2f88df=_0x2f88df||0xcc;return function(_0x3f3d21){if(_0x3f3d21){return _0x4116f0[_0xf5dd('0x27')](_0x2f88df);}return _0x4116f0['status'](_0x2f88df)[_0xf5dd('0x28')]();};}function respondWithResult(_0x5dc025,_0x24d3c1){_0x24d3c1=_0x24d3c1||0xc8;return function(_0x567d8b){if(_0x567d8b){return _0x5dc025[_0xf5dd('0x29')](_0x24d3c1)[_0xf5dd('0x2a')](_0x567d8b);}};}function respondWithFilteredResult(_0x244e9c,_0x44eee9){return function(_0x4029f8){if(_0x4029f8){var _0x956113=_0x4029f8[_0xf5dd('0x2b')],_0xbfb5b5=_0x44eee9[_0xf5dd('0x2c')],_0x29cb13=_0x44eee9[_0xf5dd('0x2c')]+_0x44eee9[_0xf5dd('0x2d')],_0x2857d6;if(_0x29cb13>=_0x956113){_0x29cb13=_0x956113;_0x2857d6=0xc8;}else{_0x2857d6=0xce;}_0x244e9c[_0xf5dd('0x29')](_0x2857d6);return _0x244e9c['set'](_0xf5dd('0x2e'),_0xbfb5b5+'-'+_0x29cb13+'/'+_0x956113)[_0xf5dd('0x2a')](_0x4029f8);}return null;};}function patchUpdates(_0x21cff9){return function(_0xaed6c9){try{jsonpatch[_0xf5dd('0x2f')](_0xaed6c9,_0x21cff9,!![]);}catch(_0x4b9489){return BPromise[_0xf5dd('0x30')](_0x4b9489);}return _0xaed6c9[_0xf5dd('0x31')]();};}function saveUpdates(_0x3e32a1,_0x257df5){return function(_0x191d20){if(_0x191d20){return _0x191d20[_0xf5dd('0x32')](_0x3e32a1)[_0xf5dd('0x1b')](function(_0x52ce5d){return _0x52ce5d;});}return null;};}function removeEntity(_0x550db1,_0x5f16bc){return function(_0x30f2ca){if(_0x30f2ca){return _0x30f2ca[_0xf5dd('0x33')]()[_0xf5dd('0x1b')](function(){_0x550db1['status'](0xcc)[_0xf5dd('0x28')]();});}};}function handleEntityNotFound(_0xaa1b77,_0x25a9da){return function(_0x513d2e){if(!_0x513d2e){_0xaa1b77['sendStatus'](0x194);}return _0x513d2e;};}function handleError(_0x1eefca,_0x43b278){_0x43b278=_0x43b278||0x1f4;return function(_0x239660){logger['error'](_0x239660[_0xf5dd('0x34')]);if(_0x239660[_0xf5dd('0x35')]){delete _0x239660[_0xf5dd('0x35')];}_0x1eefca[_0xf5dd('0x29')](_0x43b278)[_0xf5dd('0x36')](_0x239660);};}exports[_0xf5dd('0x37')]=function(_0x161a4b,_0x1bf3a8){var _0x1a4eb5={},_0x5c9ff4={},_0x4f1d0e={'count':0x0,'rows':[]};var _0x32e767=_[_0xf5dd('0x38')](db[_0xf5dd('0x39')][_0xf5dd('0x3a')],function(_0x34f36b){return{'name':_0x34f36b[_0xf5dd('0x3b')],'type':_0x34f36b[_0xf5dd('0x3c')][_0xf5dd('0x3d')]};});_0x5c9ff4['model']=_[_0xf5dd('0x38')](_0x32e767,'name');_0x5c9ff4['query']=_[_0xf5dd('0x3e')](_0x161a4b[_0xf5dd('0x3f')]);_0x5c9ff4['filters']=_[_0xf5dd('0x40')](_0x5c9ff4[_0xf5dd('0x41')],_0x5c9ff4[_0xf5dd('0x3f')]);_0x1a4eb5[_0xf5dd('0x42')]=_[_0xf5dd('0x40')](_0x5c9ff4[_0xf5dd('0x41')],qs[_0xf5dd('0x43')](_0x161a4b[_0xf5dd('0x3f')][_0xf5dd('0x43')]));_0x1a4eb5[_0xf5dd('0x42')]=_0x1a4eb5[_0xf5dd('0x42')][_0xf5dd('0x44')]?_0x1a4eb5[_0xf5dd('0x42')]:_0x5c9ff4[_0xf5dd('0x41')];if(!_0x161a4b[_0xf5dd('0x3f')][_0xf5dd('0x45')](_0xf5dd('0x46'))){_0x1a4eb5[_0xf5dd('0x2d')]=qs[_0xf5dd('0x2d')](_0x161a4b['query']['limit']);_0x1a4eb5[_0xf5dd('0x2c')]=qs[_0xf5dd('0x2c')](_0x161a4b[_0xf5dd('0x3f')]['offset']);}_0x1a4eb5[_0xf5dd('0x47')]=qs[_0xf5dd('0x48')](_0x161a4b[_0xf5dd('0x3f')][_0xf5dd('0x48')]);_0x1a4eb5[_0xf5dd('0x49')]=qs['filters'](_[_0xf5dd('0x4a')](_0x161a4b[_0xf5dd('0x3f')],_0x5c9ff4[_0xf5dd('0x4b')]),_0x32e767);if(_0x161a4b[_0xf5dd('0x3f')][_0xf5dd('0x4c')]){_0x1a4eb5['where']=_[_0xf5dd('0x4d')](_0x1a4eb5['where'],{'$or':_[_0xf5dd('0x38')](_0x32e767,function(_0x5f3edc){if(_0x5f3edc[_0xf5dd('0x3c')]!=='VIRTUAL'){var _0x33da2e={};_0x33da2e[_0x5f3edc['name']]={'$like':'%'+_0x161a4b[_0xf5dd('0x3f')][_0xf5dd('0x4c')]+'%'};return _0x33da2e;}})});}_0x1a4eb5=_[_0xf5dd('0x4d')]({},_0x1a4eb5,_0x161a4b[_0xf5dd('0x4e')]);var _0xd6973b={'where':_0x1a4eb5[_0xf5dd('0x49')]};return db[_0xf5dd('0x39')]['count'](_0xd6973b)[_0xf5dd('0x1b')](function(_0x491751){_0x4f1d0e[_0xf5dd('0x2b')]=_0x491751;if(_0x161a4b[_0xf5dd('0x3f')][_0xf5dd('0x4f')]){_0x1a4eb5[_0xf5dd('0x50')]=[{'all':!![]}];}return db[_0xf5dd('0x39')][_0xf5dd('0x51')](_0x1a4eb5);})[_0xf5dd('0x1b')](function(_0x5c0686){_0x4f1d0e[_0xf5dd('0x52')]=_0x5c0686;return _0x4f1d0e;})[_0xf5dd('0x1b')](respondWithFilteredResult(_0x1bf3a8,_0x1a4eb5))['catch'](handleError(_0x1bf3a8,null));};exports['show']=function(_0x503228,_0x3a4ef9){var _0x8b04b7={'raw':![],'where':{'id':_0x503228[_0xf5dd('0x53')]['id']}},_0x7a9891={};_0x7a9891[_0xf5dd('0x41')]=_[_0xf5dd('0x3e')](db[_0xf5dd('0x39')][_0xf5dd('0x3a')]);_0x7a9891['query']=_[_0xf5dd('0x3e')](_0x503228[_0xf5dd('0x3f')]);_0x7a9891['filters']=_[_0xf5dd('0x40')](_0x7a9891['model'],_0x7a9891[_0xf5dd('0x3f')]);_0x8b04b7['attributes']=_['intersection'](_0x7a9891[_0xf5dd('0x41')],qs['fields'](_0x503228['query']['fields']));_0x8b04b7[_0xf5dd('0x42')]=_0x8b04b7['attributes']['length']?_0x8b04b7[_0xf5dd('0x42')]:_0x7a9891[_0xf5dd('0x41')];if(_0x503228[_0xf5dd('0x3f')][_0xf5dd('0x4f')]){_0x8b04b7[_0xf5dd('0x50')]=[{'all':!![]}];}_0x8b04b7=_[_0xf5dd('0x4d')]({},_0x8b04b7,_0x503228[_0xf5dd('0x4e')]);return db[_0xf5dd('0x39')][_0xf5dd('0x54')](_0x8b04b7)[_0xf5dd('0x1b')](handleEntityNotFound(_0x3a4ef9,null))[_0xf5dd('0x1b')](respondWithResult(_0x3a4ef9,null))[_0xf5dd('0x26')](handleError(_0x3a4ef9,null));};exports['create']=function(_0x496c82,_0x478fe7){return db['ServicenowConfiguration'][_0xf5dd('0x55')](_0x496c82[_0xf5dd('0x56')],{})[_0xf5dd('0x1b')](respondWithResult(_0x478fe7,0xc9))[_0xf5dd('0x26')](handleError(_0x478fe7,null));};exports[_0xf5dd('0x32')]=function(_0x4ede9e,_0x93c7b1){if(_0x4ede9e['body']['id']){delete _0x4ede9e['body']['id'];}return db[_0xf5dd('0x39')]['find']({'where':{'id':_0x4ede9e[_0xf5dd('0x53')]['id']}})[_0xf5dd('0x1b')](handleEntityNotFound(_0x93c7b1,null))[_0xf5dd('0x1b')](saveUpdates(_0x4ede9e[_0xf5dd('0x56')],null))['then'](respondWithResult(_0x93c7b1,null))[_0xf5dd('0x26')](handleError(_0x93c7b1,null));};exports[_0xf5dd('0x33')]=function(_0x293322,_0xa33473){return db[_0xf5dd('0x39')]['find']({'where':{'id':_0x293322[_0xf5dd('0x53')]['id']}})[_0xf5dd('0x1b')](handleEntityNotFound(_0xa33473,null))[_0xf5dd('0x1b')](removeEntity(_0xa33473,null))[_0xf5dd('0x26')](handleError(_0xa33473,null));};exports['getFields']=function(_0x2c31ae,_0x2fac16,_0x1f17de){var _0x199ab8={};var _0xca946f={};var _0x1d16ba;var _0x53bcc5;return db[_0xf5dd('0x39')][_0xf5dd('0x57')]({'where':{'id':_0x2c31ae[_0xf5dd('0x53')]['id']}})[_0xf5dd('0x1b')](handleEntityNotFound(_0x2fac16,null))[_0xf5dd('0x1b')](function(_0x4f28b0){if(_0x4f28b0){_0x1d16ba=_0x4f28b0;_0xca946f['model']=_[_0xf5dd('0x3e')](db[_0xf5dd('0x58')]['rawAttributes']);_0xca946f[_0xf5dd('0x3f')]=_[_0xf5dd('0x3e')](_0x2c31ae[_0xf5dd('0x3f')]);_0xca946f['filters']=_[_0xf5dd('0x40')](_0xca946f['model'],_0xca946f[_0xf5dd('0x3f')]);_0x199ab8[_0xf5dd('0x42')]=_[_0xf5dd('0x40')](_0xca946f[_0xf5dd('0x41')],qs[_0xf5dd('0x43')](_0x2c31ae[_0xf5dd('0x3f')][_0xf5dd('0x43')]));_0x199ab8[_0xf5dd('0x42')]=_0x199ab8['attributes'][_0xf5dd('0x44')]?_0x199ab8[_0xf5dd('0x42')]:_0xca946f['model'];_0x199ab8['order']=qs[_0xf5dd('0x48')](_0x2c31ae[_0xf5dd('0x3f')][_0xf5dd('0x48')]);_0x199ab8[_0xf5dd('0x49')]=qs[_0xf5dd('0x4b')](_[_0xf5dd('0x4a')](_0x2c31ae[_0xf5dd('0x3f')],_0xca946f[_0xf5dd('0x4b')]));if(_0x2c31ae[_0xf5dd('0x3f')]['filter']){_0x199ab8[_0xf5dd('0x49')]=_[_0xf5dd('0x4d')](_0x199ab8[_0xf5dd('0x49')],{'$or':_['map'](_0x199ab8[_0xf5dd('0x42')],function(_0x1c356a){var _0x4c89b0={};_0x4c89b0[_0x1c356a]={'$like':'%'+_0x2c31ae[_0xf5dd('0x3f')]['filter']+'%'};return _0x4c89b0;})});}_0x199ab8=_['merge']({},_0x199ab8,_0x2c31ae[_0xf5dd('0x4e')]);return _0x1d16ba[_0xf5dd('0x59')](_0x199ab8);}})[_0xf5dd('0x1b')](function(_0x3c491c){if(_0x3c491c){_0x53bcc5=_0x3c491c[_0xf5dd('0x44')];if(!_0x2c31ae['query']['hasOwnProperty'](_0xf5dd('0x46'))){_0x199ab8['limit']=qs['limit'](_0x2c31ae[_0xf5dd('0x3f')][_0xf5dd('0x2d')]);_0x199ab8[_0xf5dd('0x2c')]=qs[_0xf5dd('0x2c')](_0x2c31ae[_0xf5dd('0x3f')][_0xf5dd('0x2c')]);}return _0x1d16ba[_0xf5dd('0x59')](_0x199ab8);}})[_0xf5dd('0x1b')](function(_0x54cd58){if(_0x54cd58){return _0x54cd58?{'count':_0x53bcc5,'rows':_0x54cd58}:null;}})[_0xf5dd('0x1b')](respondWithResult(_0x2fac16,null))[_0xf5dd('0x26')](handleError(_0x2fac16,null));};exports['getSubjects']=function(_0x4a7af9,_0x4ab010,_0x2053f3){var _0x2fc82d={};var _0x3c2b8c={};var _0x46e039;var _0x192c22;return db[_0xf5dd('0x39')][_0xf5dd('0x57')]({'where':{'id':_0x4a7af9[_0xf5dd('0x53')]['id']}})[_0xf5dd('0x1b')](handleEntityNotFound(_0x4ab010,null))[_0xf5dd('0x1b')](function(_0x2d4c64){if(_0x2d4c64){_0x46e039=_0x2d4c64;_0x3c2b8c[_0xf5dd('0x41')]=_[_0xf5dd('0x3e')](db[_0xf5dd('0x58')]['rawAttributes']);_0x3c2b8c[_0xf5dd('0x3f')]=_[_0xf5dd('0x3e')](_0x4a7af9[_0xf5dd('0x3f')]);_0x3c2b8c['filters']=_['intersection'](_0x3c2b8c['model'],_0x3c2b8c[_0xf5dd('0x3f')]);_0x2fc82d['attributes']=_[_0xf5dd('0x40')](_0x3c2b8c[_0xf5dd('0x41')],qs[_0xf5dd('0x43')](_0x4a7af9[_0xf5dd('0x3f')][_0xf5dd('0x43')]));_0x2fc82d[_0xf5dd('0x42')]=_0x2fc82d[_0xf5dd('0x42')]['length']?_0x2fc82d['attributes']:_0x3c2b8c[_0xf5dd('0x41')];_0x2fc82d[_0xf5dd('0x47')]=qs['sort'](_0x4a7af9['query'][_0xf5dd('0x48')]);_0x2fc82d[_0xf5dd('0x49')]=qs['filters'](_['pick'](_0x4a7af9[_0xf5dd('0x3f')],_0x3c2b8c[_0xf5dd('0x4b')]));if(_0x4a7af9[_0xf5dd('0x3f')][_0xf5dd('0x4c')]){_0x2fc82d[_0xf5dd('0x49')]=_['merge'](_0x2fc82d[_0xf5dd('0x49')],{'$or':_[_0xf5dd('0x38')](_0x2fc82d['attributes'],function(_0x2201d7){var _0x33be68={};_0x33be68[_0x2201d7]={'$like':'%'+_0x4a7af9[_0xf5dd('0x3f')][_0xf5dd('0x4c')]+'%'};return _0x33be68;})});}_0x2fc82d=_[_0xf5dd('0x4d')]({},_0x2fc82d,_0x4a7af9[_0xf5dd('0x4e')]);return _0x46e039[_0xf5dd('0x5a')](_0x2fc82d);}})[_0xf5dd('0x1b')](function(_0x33f445){if(_0x33f445){_0x192c22=_0x33f445['length'];if(!_0x4a7af9[_0xf5dd('0x3f')][_0xf5dd('0x45')](_0xf5dd('0x46'))){_0x2fc82d[_0xf5dd('0x2d')]=qs[_0xf5dd('0x2d')](_0x4a7af9[_0xf5dd('0x3f')][_0xf5dd('0x2d')]);_0x2fc82d[_0xf5dd('0x2c')]=qs['offset'](_0x4a7af9[_0xf5dd('0x3f')]['offset']);}return _0x46e039[_0xf5dd('0x5a')](_0x2fc82d);}})[_0xf5dd('0x1b')](function(_0x859897){if(_0x859897){return _0x859897?{'count':_0x192c22,'rows':_0x859897}:null;}})['then'](respondWithResult(_0x4ab010,null))[_0xf5dd('0x26')](handleError(_0x4ab010,null));};exports[_0xf5dd('0x5b')]=function(_0xe46390,_0x86f80d,_0x4cd363){var _0x51d1fc={};var _0x36709d={};var _0x409020;var _0x5b9a5d;return db[_0xf5dd('0x39')][_0xf5dd('0x57')]({'where':{'id':_0xe46390[_0xf5dd('0x53')]['id']}})['then'](handleEntityNotFound(_0x86f80d,null))['then'](function(_0x577922){if(_0x577922){_0x409020=_0x577922;_0x36709d[_0xf5dd('0x41')]=_[_0xf5dd('0x3e')](db[_0xf5dd('0x58')][_0xf5dd('0x3a')]);_0x36709d[_0xf5dd('0x3f')]=_[_0xf5dd('0x3e')](_0xe46390['query']);_0x36709d[_0xf5dd('0x4b')]=_[_0xf5dd('0x40')](_0x36709d[_0xf5dd('0x41')],_0x36709d['query']);_0x51d1fc['attributes']=_[_0xf5dd('0x40')](_0x36709d[_0xf5dd('0x41')],qs[_0xf5dd('0x43')](_0xe46390[_0xf5dd('0x3f')][_0xf5dd('0x43')]));_0x51d1fc['attributes']=_0x51d1fc['attributes'][_0xf5dd('0x44')]?_0x51d1fc[_0xf5dd('0x42')]:_0x36709d[_0xf5dd('0x41')];_0x51d1fc[_0xf5dd('0x47')]=qs['sort'](_0xe46390[_0xf5dd('0x3f')][_0xf5dd('0x48')]);_0x51d1fc[_0xf5dd('0x49')]=qs[_0xf5dd('0x4b')](_['pick'](_0xe46390[_0xf5dd('0x3f')],_0x36709d[_0xf5dd('0x4b')]));if(_0xe46390[_0xf5dd('0x3f')]['filter']){_0x51d1fc[_0xf5dd('0x49')]=_[_0xf5dd('0x4d')](_0x51d1fc[_0xf5dd('0x49')],{'$or':_[_0xf5dd('0x38')](_0x51d1fc['attributes'],function(_0x5e2670){var _0x42bd4d={};_0x42bd4d[_0x5e2670]={'$like':'%'+_0xe46390[_0xf5dd('0x3f')][_0xf5dd('0x4c')]+'%'};return _0x42bd4d;})});}_0x51d1fc=_[_0xf5dd('0x4d')]({},_0x51d1fc,_0xe46390['options']);return _0x409020['getDescriptions'](_0x51d1fc);}})[_0xf5dd('0x1b')](function(_0x195090){if(_0x195090){_0x5b9a5d=_0x195090[_0xf5dd('0x44')];if(!_0xe46390[_0xf5dd('0x3f')]['hasOwnProperty'](_0xf5dd('0x46'))){_0x51d1fc['limit']=qs[_0xf5dd('0x2d')](_0xe46390[_0xf5dd('0x3f')][_0xf5dd('0x2d')]);_0x51d1fc[_0xf5dd('0x2c')]=qs[_0xf5dd('0x2c')](_0xe46390[_0xf5dd('0x3f')]['offset']);}return _0x409020[_0xf5dd('0x5b')](_0x51d1fc);}})[_0xf5dd('0x1b')](function(_0x3539f3){if(_0x3539f3){return _0x3539f3?{'count':_0x5b9a5d,'rows':_0x3539f3}:null;}})[_0xf5dd('0x1b')](respondWithResult(_0x86f80d,null))[_0xf5dd('0x26')](handleError(_0x86f80d,null));}; \ No newline at end of file +var _0x3677=['ServicenowField','pick','getFields','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','ServicenowConfiguration','count','includeAll','include','findAll','rows','show','params','keys','create','body','find','findOne'];(function(_0x4eff92,_0x142ec2){var _0x3952f5=function(_0x262231){while(--_0x262231){_0x4eff92['push'](_0x4eff92['shift']());}};_0x3952f5(++_0x142ec2);}(_0x3677,0x1d1));var _0x7367=function(_0x138d2c,_0x2abba6){_0x138d2c=_0x138d2c-0x0;var _0xacae0d=_0x3677[_0x138d2c];return _0xacae0d;};'use strict';var pdf=require(_0x7367('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7367('0x1'));var zipdir=require(_0x7367('0x2'));var jsonpatch=require(_0x7367('0x3'));var rp=require('request-promise');var moment=require(_0x7367('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7367('0x5'));var util=require(_0x7367('0x6'));var path=require(_0x7367('0x7'));var sox=require(_0x7367('0x8'));var csv=require(_0x7367('0x9'));var ejs=require(_0x7367('0xa'));var fs=require('fs');var _=require(_0x7367('0xb'));var squel=require('squel');var crypto=require(_0x7367('0xc'));var jsforce=require(_0x7367('0xd'));var deskjs=require(_0x7367('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7367('0xf'));var authService=require(_0x7367('0x10'));var qs=require(_0x7367('0x11'));var as=require(_0x7367('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7367('0x13'));var config=require(_0x7367('0x14'));var licenseUtil=require(_0x7367('0x15'));var db=require(_0x7367('0x16'))['db'];var jayson=require(_0x7367('0x17'));var client=jayson[_0x7367('0x18')][_0x7367('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1547f5,_0xa70329,_0x5183fc,_0x21a1e6){return new BPromise(function(_0x54e79e,_0x36092e){var _0x170704=_0x21a1e6||client;return _0x170704['request'](_0x1547f5,_0x5183fc)['then'](function(_0xf3e2e){logger[_0x7367('0x1a')](_0x7367('0x1b'),_0xa70329,_0x7367('0x1c'));logger[_0x7367('0x1d')](_0x7367('0x1e'),_0xa70329,_0x7367('0x1c'),JSON[_0x7367('0x1f')](_0xf3e2e));if(_0xf3e2e['error']){if(_0xf3e2e[_0x7367('0x20')][_0x7367('0x21')]===0x1f4){logger[_0x7367('0x20')](_0x7367('0x1b'),_0xa70329,_0xf3e2e[_0x7367('0x20')][_0x7367('0x22')]);return _0x36092e(_0xf3e2e[_0x7367('0x20')][_0x7367('0x22')]);}logger[_0x7367('0x20')](_0x7367('0x1b'),_0xa70329,_0xf3e2e['error'][_0x7367('0x22')]);return _0x54e79e(_0xf3e2e[_0x7367('0x20')][_0x7367('0x22')]);}else{logger[_0x7367('0x1a')](_0x7367('0x1b'),_0xa70329,_0x7367('0x1c'));_0x54e79e(_0xf3e2e[_0x7367('0x23')][_0x7367('0x22')]);}})[_0x7367('0x24')](function(_0x1245e3){logger['error'](_0x7367('0x1b'),_0xa70329,_0x1245e3);_0x36092e(_0x1245e3);});});}function respondWithStatusCode(_0x5a114b,_0x5d8b76){_0x5d8b76=_0x5d8b76||0xcc;return function(_0x3071df){if(_0x3071df){return _0x5a114b[_0x7367('0x25')](_0x5d8b76);}return _0x5a114b[_0x7367('0x26')](_0x5d8b76)[_0x7367('0x27')]();};}function respondWithResult(_0x211e24,_0x2c3341){_0x2c3341=_0x2c3341||0xc8;return function(_0x323df1){if(_0x323df1){return _0x211e24[_0x7367('0x26')](_0x2c3341)[_0x7367('0x28')](_0x323df1);}};}function respondWithFilteredResult(_0x2a9da5,_0x35e71a){return function(_0x100ba0){if(_0x100ba0){var _0x1d1c50=_0x100ba0['count'],_0x2e22f7=_0x35e71a[_0x7367('0x29')],_0x41c08d=_0x35e71a[_0x7367('0x29')]+_0x35e71a[_0x7367('0x2a')],_0x8a725f;if(_0x41c08d>=_0x1d1c50){_0x41c08d=_0x1d1c50;_0x8a725f=0xc8;}else{_0x8a725f=0xce;}_0x2a9da5[_0x7367('0x26')](_0x8a725f);return _0x2a9da5['set'](_0x7367('0x2b'),_0x2e22f7+'-'+_0x41c08d+'/'+_0x1d1c50)['json'](_0x100ba0);}return null;};}function patchUpdates(_0x484c68){return function(_0x3e367f){try{jsonpatch['apply'](_0x3e367f,_0x484c68,!![]);}catch(_0x22280e){return BPromise[_0x7367('0x2c')](_0x22280e);}return _0x3e367f[_0x7367('0x2d')]();};}function saveUpdates(_0x4eceda,_0x4ef9ee){return function(_0x35a72d){if(_0x35a72d){return _0x35a72d[_0x7367('0x2e')](_0x4eceda)['then'](function(_0xfc895){return _0xfc895;});}return null;};}function removeEntity(_0xfc22,_0x5acfc7){return function(_0x3e7f83){if(_0x3e7f83){return _0x3e7f83[_0x7367('0x2f')]()[_0x7367('0x30')](function(){_0xfc22[_0x7367('0x26')](0xcc)[_0x7367('0x27')]();});}};}function handleEntityNotFound(_0x4e197e,_0x2640b2){return function(_0x29350a){if(!_0x29350a){_0x4e197e[_0x7367('0x25')](0x194);}return _0x29350a;};}function handleError(_0x545d57,_0x5e8581){_0x5e8581=_0x5e8581||0x1f4;return function(_0x10c219){logger[_0x7367('0x20')](_0x10c219[_0x7367('0x31')]);if(_0x10c219['name']){delete _0x10c219[_0x7367('0x32')];}_0x545d57['status'](_0x5e8581)[_0x7367('0x33')](_0x10c219);};}exports[_0x7367('0x34')]=function(_0x4e4cb9,_0xd22ddc){var _0xcce7ca={},_0xb967bd={},_0x4b5120={'count':0x0,'rows':[]};var _0x4feb54=_['map'](db['ServicenowConfiguration'][_0x7367('0x35')],function(_0x2bfa6f){return{'name':_0x2bfa6f[_0x7367('0x36')],'type':_0x2bfa6f[_0x7367('0x37')][_0x7367('0x38')]};});_0xb967bd['model']=_[_0x7367('0x39')](_0x4feb54,_0x7367('0x32'));_0xb967bd[_0x7367('0x3a')]=_['keys'](_0x4e4cb9[_0x7367('0x3a')]);_0xb967bd[_0x7367('0x3b')]=_['intersection'](_0xb967bd['model'],_0xb967bd[_0x7367('0x3a')]);_0xcce7ca[_0x7367('0x3c')]=_[_0x7367('0x3d')](_0xb967bd[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x4e4cb9[_0x7367('0x3a')][_0x7367('0x3f')]));_0xcce7ca['attributes']=_0xcce7ca['attributes'][_0x7367('0x40')]?_0xcce7ca[_0x7367('0x3c')]:_0xb967bd[_0x7367('0x3e')];if(!_0x4e4cb9['query'][_0x7367('0x41')](_0x7367('0x42'))){_0xcce7ca['limit']=qs['limit'](_0x4e4cb9['query']['limit']);_0xcce7ca[_0x7367('0x29')]=qs['offset'](_0x4e4cb9['query']['offset']);}_0xcce7ca[_0x7367('0x43')]=qs[_0x7367('0x44')](_0x4e4cb9[_0x7367('0x3a')][_0x7367('0x44')]);_0xcce7ca['where']=qs[_0x7367('0x3b')](_['pick'](_0x4e4cb9[_0x7367('0x3a')],_0xb967bd[_0x7367('0x3b')]),_0x4feb54);if(_0x4e4cb9['query'][_0x7367('0x45')]){_0xcce7ca['where']=_[_0x7367('0x46')](_0xcce7ca[_0x7367('0x47')],{'$or':_['map'](_0x4feb54,function(_0x352514){if(_0x352514[_0x7367('0x37')]!==_0x7367('0x48')){var _0x4eb3e4={};_0x4eb3e4[_0x352514[_0x7367('0x32')]]={'$like':'%'+_0x4e4cb9[_0x7367('0x3a')][_0x7367('0x45')]+'%'};return _0x4eb3e4;}})});}_0xcce7ca=_[_0x7367('0x46')]({},_0xcce7ca,_0x4e4cb9[_0x7367('0x49')]);var _0x1ae5bd={'where':_0xcce7ca['where']};return db[_0x7367('0x4a')][_0x7367('0x4b')](_0x1ae5bd)[_0x7367('0x30')](function(_0x3aa651){_0x4b5120[_0x7367('0x4b')]=_0x3aa651;if(_0x4e4cb9[_0x7367('0x3a')][_0x7367('0x4c')]){_0xcce7ca[_0x7367('0x4d')]=[{'all':!![]}];}return db[_0x7367('0x4a')][_0x7367('0x4e')](_0xcce7ca);})[_0x7367('0x30')](function(_0x2cc095){_0x4b5120[_0x7367('0x4f')]=_0x2cc095;return _0x4b5120;})['then'](respondWithFilteredResult(_0xd22ddc,_0xcce7ca))['catch'](handleError(_0xd22ddc,null));};exports[_0x7367('0x50')]=function(_0x478bad,_0x115a2f){var _0x248f69={'raw':![],'where':{'id':_0x478bad[_0x7367('0x51')]['id']}},_0x2c315b={};_0x2c315b['model']=_[_0x7367('0x52')](db['ServicenowConfiguration'][_0x7367('0x35')]);_0x2c315b['query']=_[_0x7367('0x52')](_0x478bad[_0x7367('0x3a')]);_0x2c315b[_0x7367('0x3b')]=_[_0x7367('0x3d')](_0x2c315b[_0x7367('0x3e')],_0x2c315b[_0x7367('0x3a')]);_0x248f69[_0x7367('0x3c')]=_['intersection'](_0x2c315b[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x478bad['query'][_0x7367('0x3f')]));_0x248f69[_0x7367('0x3c')]=_0x248f69[_0x7367('0x3c')][_0x7367('0x40')]?_0x248f69['attributes']:_0x2c315b[_0x7367('0x3e')];if(_0x478bad['query'][_0x7367('0x4c')]){_0x248f69[_0x7367('0x4d')]=[{'all':!![]}];}_0x248f69=_[_0x7367('0x46')]({},_0x248f69,_0x478bad[_0x7367('0x49')]);return db[_0x7367('0x4a')]['find'](_0x248f69)[_0x7367('0x30')](handleEntityNotFound(_0x115a2f,null))['then'](respondWithResult(_0x115a2f,null))['catch'](handleError(_0x115a2f,null));};exports['create']=function(_0x54fc8c,_0x328c9f){return db['ServicenowConfiguration'][_0x7367('0x53')](_0x54fc8c['body'],{})[_0x7367('0x30')](respondWithResult(_0x328c9f,0xc9))[_0x7367('0x24')](handleError(_0x328c9f,null));};exports[_0x7367('0x2e')]=function(_0x24f4b4,_0x283efd){if(_0x24f4b4['body']['id']){delete _0x24f4b4[_0x7367('0x54')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x24f4b4['params']['id']}})[_0x7367('0x30')](handleEntityNotFound(_0x283efd,null))[_0x7367('0x30')](saveUpdates(_0x24f4b4[_0x7367('0x54')],null))[_0x7367('0x30')](respondWithResult(_0x283efd,null))['catch'](handleError(_0x283efd,null));};exports[_0x7367('0x2f')]=function(_0x2d80aa,_0x382b45){return db[_0x7367('0x4a')][_0x7367('0x55')]({'where':{'id':_0x2d80aa[_0x7367('0x51')]['id']}})['then'](handleEntityNotFound(_0x382b45,null))[_0x7367('0x30')](removeEntity(_0x382b45,null))['catch'](handleError(_0x382b45,null));};exports['getFields']=function(_0x4d3ee6,_0x1e890b,_0xd9208f){var _0x3e1910={};var _0xf8b435={};var _0x144fca;var _0x5e00e2;return db['ServicenowConfiguration'][_0x7367('0x56')]({'where':{'id':_0x4d3ee6[_0x7367('0x51')]['id']}})[_0x7367('0x30')](handleEntityNotFound(_0x1e890b,null))[_0x7367('0x30')](function(_0x40aa95){if(_0x40aa95){_0x144fca=_0x40aa95;_0xf8b435['model']=_[_0x7367('0x52')](db[_0x7367('0x57')]['rawAttributes']);_0xf8b435['query']=_[_0x7367('0x52')](_0x4d3ee6[_0x7367('0x3a')]);_0xf8b435[_0x7367('0x3b')]=_[_0x7367('0x3d')](_0xf8b435[_0x7367('0x3e')],_0xf8b435[_0x7367('0x3a')]);_0x3e1910[_0x7367('0x3c')]=_['intersection'](_0xf8b435[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x4d3ee6[_0x7367('0x3a')][_0x7367('0x3f')]));_0x3e1910[_0x7367('0x3c')]=_0x3e1910['attributes'][_0x7367('0x40')]?_0x3e1910[_0x7367('0x3c')]:_0xf8b435[_0x7367('0x3e')];_0x3e1910[_0x7367('0x43')]=qs['sort'](_0x4d3ee6[_0x7367('0x3a')]['sort']);_0x3e1910[_0x7367('0x47')]=qs[_0x7367('0x3b')](_[_0x7367('0x58')](_0x4d3ee6[_0x7367('0x3a')],_0xf8b435['filters']));if(_0x4d3ee6[_0x7367('0x3a')][_0x7367('0x45')]){_0x3e1910[_0x7367('0x47')]=_[_0x7367('0x46')](_0x3e1910['where'],{'$or':_[_0x7367('0x39')](_0x3e1910[_0x7367('0x3c')],function(_0x1313ad){var _0x232d99={};_0x232d99[_0x1313ad]={'$like':'%'+_0x4d3ee6[_0x7367('0x3a')][_0x7367('0x45')]+'%'};return _0x232d99;})});}_0x3e1910=_[_0x7367('0x46')]({},_0x3e1910,_0x4d3ee6[_0x7367('0x49')]);return _0x144fca[_0x7367('0x59')](_0x3e1910);}})['then'](function(_0x207282){if(_0x207282){_0x5e00e2=_0x207282[_0x7367('0x40')];if(!_0x4d3ee6[_0x7367('0x3a')]['hasOwnProperty'](_0x7367('0x42'))){_0x3e1910['limit']=qs[_0x7367('0x2a')](_0x4d3ee6[_0x7367('0x3a')]['limit']);_0x3e1910[_0x7367('0x29')]=qs[_0x7367('0x29')](_0x4d3ee6[_0x7367('0x3a')]['offset']);}return _0x144fca[_0x7367('0x59')](_0x3e1910);}})['then'](function(_0x5757b5){if(_0x5757b5){return _0x5757b5?{'count':_0x5e00e2,'rows':_0x5757b5}:null;}})[_0x7367('0x30')](respondWithResult(_0x1e890b,null))[_0x7367('0x24')](handleError(_0x1e890b,null));};exports[_0x7367('0x5a')]=function(_0x3eccfd,_0x54600,_0x52f355){var _0xbcef0c={};var _0x24df7b={};var _0x31499e;var _0x1f77d6;return db[_0x7367('0x4a')]['findOne']({'where':{'id':_0x3eccfd['params']['id']}})[_0x7367('0x30')](handleEntityNotFound(_0x54600,null))[_0x7367('0x30')](function(_0x53151b){if(_0x53151b){_0x31499e=_0x53151b;_0x24df7b['model']=_['keys'](db[_0x7367('0x57')][_0x7367('0x35')]);_0x24df7b[_0x7367('0x3a')]=_[_0x7367('0x52')](_0x3eccfd['query']);_0x24df7b[_0x7367('0x3b')]=_[_0x7367('0x3d')](_0x24df7b[_0x7367('0x3e')],_0x24df7b['query']);_0xbcef0c[_0x7367('0x3c')]=_[_0x7367('0x3d')](_0x24df7b[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x3eccfd[_0x7367('0x3a')][_0x7367('0x3f')]));_0xbcef0c[_0x7367('0x3c')]=_0xbcef0c[_0x7367('0x3c')]['length']?_0xbcef0c[_0x7367('0x3c')]:_0x24df7b[_0x7367('0x3e')];_0xbcef0c[_0x7367('0x43')]=qs[_0x7367('0x44')](_0x3eccfd[_0x7367('0x3a')][_0x7367('0x44')]);_0xbcef0c[_0x7367('0x47')]=qs['filters'](_[_0x7367('0x58')](_0x3eccfd['query'],_0x24df7b[_0x7367('0x3b')]));if(_0x3eccfd[_0x7367('0x3a')][_0x7367('0x45')]){_0xbcef0c[_0x7367('0x47')]=_[_0x7367('0x46')](_0xbcef0c[_0x7367('0x47')],{'$or':_[_0x7367('0x39')](_0xbcef0c['attributes'],function(_0x175628){var _0x3ff109={};_0x3ff109[_0x175628]={'$like':'%'+_0x3eccfd[_0x7367('0x3a')][_0x7367('0x45')]+'%'};return _0x3ff109;})});}_0xbcef0c=_[_0x7367('0x46')]({},_0xbcef0c,_0x3eccfd[_0x7367('0x49')]);return _0x31499e[_0x7367('0x5a')](_0xbcef0c);}})[_0x7367('0x30')](function(_0x518a09){if(_0x518a09){_0x1f77d6=_0x518a09[_0x7367('0x40')];if(!_0x3eccfd[_0x7367('0x3a')]['hasOwnProperty'](_0x7367('0x42'))){_0xbcef0c[_0x7367('0x2a')]=qs[_0x7367('0x2a')](_0x3eccfd['query'][_0x7367('0x2a')]);_0xbcef0c['offset']=qs[_0x7367('0x29')](_0x3eccfd['query'][_0x7367('0x29')]);}return _0x31499e[_0x7367('0x5a')](_0xbcef0c);}})[_0x7367('0x30')](function(_0xa27153){if(_0xa27153){return _0xa27153?{'count':_0x1f77d6,'rows':_0xa27153}:null;}})[_0x7367('0x30')](respondWithResult(_0x54600,null))[_0x7367('0x24')](handleError(_0x54600,null));};exports[_0x7367('0x5b')]=function(_0x2a3917,_0x4cc31,_0x547d85){var _0x5e31b2={};var _0x5dd5a8={};var _0x3ae4f5;var _0x403c10;return db[_0x7367('0x4a')]['findOne']({'where':{'id':_0x2a3917['params']['id']}})[_0x7367('0x30')](handleEntityNotFound(_0x4cc31,null))[_0x7367('0x30')](function(_0x59e4c9){if(_0x59e4c9){_0x3ae4f5=_0x59e4c9;_0x5dd5a8[_0x7367('0x3e')]=_['keys'](db[_0x7367('0x57')][_0x7367('0x35')]);_0x5dd5a8[_0x7367('0x3a')]=_[_0x7367('0x52')](_0x2a3917[_0x7367('0x3a')]);_0x5dd5a8[_0x7367('0x3b')]=_[_0x7367('0x3d')](_0x5dd5a8[_0x7367('0x3e')],_0x5dd5a8[_0x7367('0x3a')]);_0x5e31b2[_0x7367('0x3c')]=_[_0x7367('0x3d')](_0x5dd5a8[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x2a3917[_0x7367('0x3a')]['fields']));_0x5e31b2[_0x7367('0x3c')]=_0x5e31b2[_0x7367('0x3c')]['length']?_0x5e31b2['attributes']:_0x5dd5a8['model'];_0x5e31b2[_0x7367('0x43')]=qs[_0x7367('0x44')](_0x2a3917[_0x7367('0x3a')][_0x7367('0x44')]);_0x5e31b2[_0x7367('0x47')]=qs['filters'](_['pick'](_0x2a3917['query'],_0x5dd5a8[_0x7367('0x3b')]));if(_0x2a3917[_0x7367('0x3a')][_0x7367('0x45')]){_0x5e31b2['where']=_['merge'](_0x5e31b2[_0x7367('0x47')],{'$or':_[_0x7367('0x39')](_0x5e31b2[_0x7367('0x3c')],function(_0x34b885){var _0x3c18df={};_0x3c18df[_0x34b885]={'$like':'%'+_0x2a3917['query'][_0x7367('0x45')]+'%'};return _0x3c18df;})});}_0x5e31b2=_['merge']({},_0x5e31b2,_0x2a3917[_0x7367('0x49')]);return _0x3ae4f5[_0x7367('0x5b')](_0x5e31b2);}})[_0x7367('0x30')](function(_0x41dcf7){if(_0x41dcf7){_0x403c10=_0x41dcf7[_0x7367('0x40')];if(!_0x2a3917[_0x7367('0x3a')][_0x7367('0x41')](_0x7367('0x42'))){_0x5e31b2['limit']=qs['limit'](_0x2a3917[_0x7367('0x3a')][_0x7367('0x2a')]);_0x5e31b2[_0x7367('0x29')]=qs['offset'](_0x2a3917[_0x7367('0x3a')][_0x7367('0x29')]);}return _0x3ae4f5['getDescriptions'](_0x5e31b2);}})[_0x7367('0x30')](function(_0x38ec11){if(_0x38ec11){return _0x38ec11?{'count':_0x403c10,'rows':_0x38ec11}:null;}})[_0x7367('0x30')](respondWithResult(_0x4cc31,null))['catch'](handleError(_0x4cc31,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 239563c..c2c2544 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dd1=['rimraf','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5cd43b,_0x2052f7){var _0x5635a9=function(_0x111e4c){while(--_0x111e4c){_0x5cd43b['push'](_0x5cd43b['shift']());}};_0x5635a9(++_0x2052f7);}(_0x7dd1,0x12e));var _0x17dd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7dd1[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x17dd('0x0'));var logger=require(_0x17dd('0x1'))(_0x17dd('0x2'));var moment=require(_0x17dd('0x3'));var BPromise=require(_0x17dd('0x4'));var rp=require(_0x17dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17dd('0x6'));var config=require('../../config/environment');var attributes=require(_0x17dd('0x7'));module[_0x17dd('0x8')]=function(_0x28d1eb,_0x2a5fc3){return _0x28d1eb[_0x17dd('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x17dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76fb=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x76fb,0xcb));var _0xb76f=function(_0x3da1c1,_0x809b72){_0x3da1c1=_0x3da1c1-0x0;var _0x46083d=_0x76fb[_0x3da1c1];return _0x46083d;};'use strict';var _=require('lodash');var util=require(_0xb76f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb76f('0x1'));var BPromise=require(_0xb76f('0x2'));var rp=require(_0xb76f('0x3'));var fs=require('fs');var path=require(_0xb76f('0x4'));var rimraf=require(_0xb76f('0x5'));var config=require(_0xb76f('0x6'));var attributes=require(_0xb76f('0x7'));module[_0xb76f('0x8')]=function(_0x110dd9,_0x822d6b){return _0x110dd9['define'](_0xb76f('0x9'),attributes,{'tableName':_0xb76f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 5718f64..15a5abf 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeeee=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/environment','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x306d96,_0x46ac41){var _0xb02f66=function(_0x3b78f7){while(--_0x3b78f7){_0x306d96['push'](_0x306d96['shift']());}};_0xb02f66(++_0x46ac41);}(_0xeeee,0x156));var _0xeeee=function(_0x1defbd,_0x136e2a){_0x1defbd=_0x1defbd-0x0;var _0x7c3283=_0xeeee[_0x1defbd];return _0x7c3283;};'use strict';var _=require(_0xeeee('0x0'));var util=require('util');var moment=require(_0xeeee('0x1'));var BPromise=require(_0xeeee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeee('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xeeee('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xeeee('0x6')][_0xeeee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3db1c7,_0x666188,_0x42cd0f){return new BPromise(function(_0x24f600,_0x3bf842){return client[_0xeeee('0x8')](_0x3db1c7,_0x42cd0f)[_0xeeee('0x9')](function(_0x36a3c3){logger['info'](_0xeeee('0xa'),_0x666188,_0xeeee('0xb'));logger[_0xeeee('0xc')](_0xeeee('0xd'),_0x666188,_0xeeee('0xb'),JSON[_0xeeee('0xe')](_0x36a3c3));if(_0x36a3c3[_0xeeee('0xf')]){if(_0x36a3c3[_0xeeee('0xf')][_0xeeee('0x10')]===0x1f4){logger[_0xeeee('0xf')](_0xeeee('0xa'),_0x666188,_0x36a3c3[_0xeeee('0xf')][_0xeeee('0x11')]);return _0x3bf842(_0x36a3c3[_0xeeee('0xf')][_0xeeee('0x11')]);}logger['error'](_0xeeee('0xa'),_0x666188,_0x36a3c3[_0xeeee('0xf')][_0xeeee('0x11')]);return _0x24f600(_0x36a3c3[_0xeeee('0xf')]['message']);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x666188,_0xeeee('0xb'));_0x24f600(_0x36a3c3['result'][_0xeeee('0x11')]);}})[_0xeeee('0x12')](function(_0x5e0481){logger[_0xeeee('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x666188,_0x5e0481);_0x3bf842(_0x5e0481);});});} \ No newline at end of file +var _0x2127=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4d8de1,_0x1d1cd1){var _0x52d754=function(_0x2fb3a9){while(--_0x2fb3a9){_0x4d8de1['push'](_0x4d8de1['shift']());}};_0x52d754(++_0x1d1cd1);}(_0x2127,0xf1));var _0x7212=function(_0x3fdb26,_0x16e0ce){_0x3fdb26=_0x3fdb26-0x0;var _0x413bbb=_0x2127[_0x3fdb26];return _0x413bbb;};'use strict';var _=require(_0x7212('0x0'));var util=require(_0x7212('0x1'));var moment=require(_0x7212('0x2'));var BPromise=require(_0x7212('0x3'));var rs=require(_0x7212('0x4'));var fs=require('fs');var Redis=require(_0x7212('0x5'));var db=require(_0x7212('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7212('0x7'))('rpc');var config=require(_0x7212('0x8'));var jayson=require(_0x7212('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1760d4,_0x40f2ff,_0x423717){return new BPromise(function(_0x131a94,_0x221551){return client['request'](_0x1760d4,_0x423717)[_0x7212('0xa')](function(_0x14c367){logger['info'](_0x7212('0xb'),_0x40f2ff,_0x7212('0xc'));logger[_0x7212('0xd')](_0x7212('0xe'),_0x40f2ff,_0x7212('0xc'),JSON[_0x7212('0xf')](_0x14c367));if(_0x14c367[_0x7212('0x10')]){if(_0x14c367[_0x7212('0x10')][_0x7212('0x11')]===0x1f4){logger[_0x7212('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x40f2ff,_0x14c367[_0x7212('0x10')][_0x7212('0x12')]);return _0x221551(_0x14c367['error'][_0x7212('0x12')]);}logger[_0x7212('0x10')](_0x7212('0xb'),_0x40f2ff,_0x14c367[_0x7212('0x10')][_0x7212('0x12')]);return _0x131a94(_0x14c367[_0x7212('0x10')][_0x7212('0x12')]);}else{logger[_0x7212('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x40f2ff,_0x7212('0xc'));_0x131a94(_0x14c367[_0x7212('0x14')][_0x7212('0x12')]);}})[_0x7212('0x15')](function(_0x5b8c70){logger['error'](_0x7212('0xb'),_0x40f2ff,_0x5b8c70);_0x221551(_0x5b8c70);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 7606517..0f54792 100644 --- a/server/api/intServicenowField/index.js +++ b/server/api/intServicenowField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa503=['destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x2bd39f,_0x449167){var _0x5ee901=function(_0x37ebcb){while(--_0x37ebcb){_0x2bd39f['push'](_0x2bd39f['shift']());}};_0x5ee901(++_0x449167);}(_0xa503,0x80));var _0x3a50=function(_0x3371b5,_0x95af68){_0x3371b5=_0x3371b5-0x0;var _0x194dee=_0xa503[_0x3371b5];return _0x194dee;};'use strict';var multer=require('multer');var util=require(_0x3a50('0x0'));var path=require(_0x3a50('0x1'));var timeout=require(_0x3a50('0x2'));var express=require('express');var router=express[_0x3a50('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3a50('0x4'));var config=require(_0x3a50('0x5'));var controller=require(_0x3a50('0x6'));router[_0x3a50('0x7')]('/',auth[_0x3a50('0x8')](),controller['index']);router[_0x3a50('0x7')](_0x3a50('0x9'),auth['isAuthenticated'](),controller[_0x3a50('0xa')]);router[_0x3a50('0xb')]('/',auth['isAuthenticated'](),controller[_0x3a50('0xc')]);router[_0x3a50('0xd')]('/:id',auth[_0x3a50('0x8')](),controller[_0x3a50('0xe')]);router[_0x3a50('0xf')]('/:id',auth[_0x3a50('0x8')](),controller[_0x3a50('0x10')]);module[_0x3a50('0x11')]=router; \ No newline at end of file +var _0x6e0f=['isAuthenticated','show','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2350f0,_0x3f8391){var _0x3c24e0=function(_0x1ab696){while(--_0x1ab696){_0x2350f0['push'](_0x2350f0['shift']());}};_0x3c24e0(++_0x3f8391);}(_0x6e0f,0x14b));var _0xf6e0=function(_0x30ec0a,_0x390560){_0x30ec0a=_0x30ec0a-0x0;var _0x1c5562=_0x6e0f[_0x30ec0a];return _0x1c5562;};'use strict';var multer=require(_0xf6e0('0x0'));var util=require(_0xf6e0('0x1'));var path=require(_0xf6e0('0x2'));var timeout=require(_0xf6e0('0x3'));var express=require(_0xf6e0('0x4'));var router=express[_0xf6e0('0x5')]();var auth=require(_0xf6e0('0x6'));var interaction=require(_0xf6e0('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xf6e0('0x8')]('/',auth[_0xf6e0('0x9')](),controller['index']);router[_0xf6e0('0x8')]('/:id',auth[_0xf6e0('0x9')](),controller[_0xf6e0('0xa')]);router['post']('/',auth[_0xf6e0('0x9')](),controller[_0xf6e0('0xb')]);router[_0xf6e0('0xc')]('/:id',auth[_0xf6e0('0x9')](),controller[_0xf6e0('0xd')]);router['delete'](_0xf6e0('0xe'),auth[_0xf6e0('0x9')](),controller[_0xf6e0('0xf')]);module[_0xf6e0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 68f3464..ed08503 100644 --- a/server/api/intServicenowField/intServicenowField.attributes.js +++ b/server/api/intServicenowField/intServicenowField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7fd=['customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','string','STRING'];(function(_0x5f54d9,_0x145582){var _0x7e8e1a=function(_0x31335b){while(--_0x31335b){_0x5f54d9['push'](_0x5f54d9['shift']());}};_0x7e8e1a(++_0x145582);}(_0xf7fd,0xe2));var _0xdf7f=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xf7fd[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0xdf7f('0x0'));module['exports']={'type':{'type':Sequelize[_0xdf7f('0x1')]('string',_0xdf7f('0x2'),'customVariable',_0xdf7f('0x3')),'defaultValue':_0xdf7f('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdf7f('0x5')]},'keyType':{'type':Sequelize[_0xdf7f('0x1')](_0xdf7f('0x4'),_0xdf7f('0x2'),_0xdf7f('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdf7f('0x5')]},'nameField':{'type':Sequelize[_0xdf7f('0x5')]},'customField':{'type':Sequelize[_0xdf7f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf7f('0x5')]}}; \ No newline at end of file +var _0xb1db=['STRING','ENUM','string','variable','customVariable','keyValue'];(function(_0x346c21,_0xd1d703){var _0x5b591c=function(_0x609651){while(--_0x609651){_0x346c21['push'](_0x346c21['shift']());}};_0x5b591c(++_0xd1d703);}(_0xb1db,0x1be));var _0xbb1d=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0xb1db[_0x211bc3];return _0x34c9a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xbb1d('0x0'),_0xbb1d('0x1'),_0xbb1d('0x2'),_0xbb1d('0x3')),'defaultValue':_0xbb1d('0x0')},'content':{'type':Sequelize[_0xbb1d('0x4')]},'key':{'type':Sequelize[_0xbb1d('0x4')]},'keyType':{'type':Sequelize[_0xbb1d('0x5')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xbb1d('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbb1d('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb1d('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 3d69dda..4417634 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20df=['../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','end','stack','name','map','ServicenowField','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x45154c,_0x1eca31){var _0x2513bc=function(_0x35a79b){while(--_0x35a79b){_0x45154c['push'](_0x45154c['shift']());}};_0x2513bc(++_0x1eca31);}(_0x20df,0x7c));var _0xf20d=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x20df[_0x278e3c];return _0x3e2d9b;};'use strict';var pdf=require(_0xf20d('0x0'));var emlformat=require(_0xf20d('0x1'));var rimraf=require(_0xf20d('0x2'));var zipdir=require(_0xf20d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf20d('0x4'));var moment=require(_0xf20d('0x5'));var BPromise=require(_0xf20d('0x6'));var Mustache=require(_0xf20d('0x7'));var util=require(_0xf20d('0x8'));var path=require('path');var sox=require(_0xf20d('0x9'));var csv=require('to-csv');var ejs=require(_0xf20d('0xa'));var fs=require('fs');var _=require(_0xf20d('0xb'));var squel=require('squel');var crypto=require(_0xf20d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf20d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf20d('0xe'));var Papa=require(_0xf20d('0xf'));var Redis=require(_0xf20d('0x10'));var authService=require(_0xf20d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf20d('0x12'));var hardwareService=require(_0xf20d('0x13'));var logger=require(_0xf20d('0x14'))(_0xf20d('0x15'));var utils=require(_0xf20d('0x16'));var config=require(_0xf20d('0x17'));var licenseUtil=require(_0xf20d('0x18'));var db=require(_0xf20d('0x19'))['db'];function respondWithStatusCode(_0x5457a3,_0x2fa3f6){_0x2fa3f6=_0x2fa3f6||0xcc;return function(_0x5126e0){if(_0x5126e0){return _0x5457a3[_0xf20d('0x1a')](_0x2fa3f6);}return _0x5457a3[_0xf20d('0x1b')](_0x2fa3f6)['end']();};}function respondWithResult(_0x1dce9d,_0x2e3cf2){_0x2e3cf2=_0x2e3cf2||0xc8;return function(_0x41fc44){if(_0x41fc44){return _0x1dce9d[_0xf20d('0x1b')](_0x2e3cf2)[_0xf20d('0x1c')](_0x41fc44);}};}function respondWithFilteredResult(_0x5c2ff0,_0x5d4244){return function(_0x3a4563){if(_0x3a4563){var _0xcd434c=_0x3a4563[_0xf20d('0x1d')],_0x2b2d00=_0x5d4244['offset'],_0x1ce0c8=_0x5d4244[_0xf20d('0x1e')]+_0x5d4244['limit'],_0x53c164;if(_0x1ce0c8>=_0xcd434c){_0x1ce0c8=_0xcd434c;_0x53c164=0xc8;}else{_0x53c164=0xce;}_0x5c2ff0['status'](_0x53c164);return _0x5c2ff0[_0xf20d('0x1f')](_0xf20d('0x20'),_0x2b2d00+'-'+_0x1ce0c8+'/'+_0xcd434c)[_0xf20d('0x1c')](_0x3a4563);}return null;};}function patchUpdates(_0x40f578){return function(_0x2483c4){try{jsonpatch[_0xf20d('0x21')](_0x2483c4,_0x40f578,!![]);}catch(_0x4f15bc){return BPromise[_0xf20d('0x22')](_0x4f15bc);}return _0x2483c4['save']();};}function saveUpdates(_0x41b8c8,_0x500bc9){return function(_0x8c4687){if(_0x8c4687){return _0x8c4687[_0xf20d('0x23')](_0x41b8c8)['then'](function(_0x50c7fd){return _0x50c7fd;});}return null;};}function removeEntity(_0x3679cc,_0x1f9a62){return function(_0x37e292){if(_0x37e292){return _0x37e292['destroy']()['then'](function(){_0x3679cc[_0xf20d('0x1b')](0xcc)[_0xf20d('0x24')]();});}};}function handleEntityNotFound(_0x37b480,_0x419b19){return function(_0xc57064){if(!_0xc57064){_0x37b480[_0xf20d('0x1a')](0x194);}return _0xc57064;};}function handleError(_0x5a9385,_0xbccec1){_0xbccec1=_0xbccec1||0x1f4;return function(_0x486104){logger['error'](_0x486104[_0xf20d('0x25')]);if(_0x486104[_0xf20d('0x26')]){delete _0x486104[_0xf20d('0x26')];}_0x5a9385['status'](_0xbccec1)['send'](_0x486104);};}exports['index']=function(_0x41378f,_0x2784ec){var _0x2acb21={},_0x49ecbc={},_0x191c70={'count':0x0,'rows':[]};var _0x993a3b=_[_0xf20d('0x27')](db[_0xf20d('0x28')][_0xf20d('0x29')],function(_0x36e7a5){return{'name':_0x36e7a5[_0xf20d('0x2a')],'type':_0x36e7a5['type']['key']};});_0x49ecbc[_0xf20d('0x2b')]=_[_0xf20d('0x27')](_0x993a3b,'name');_0x49ecbc[_0xf20d('0x2c')]=_[_0xf20d('0x2d')](_0x41378f[_0xf20d('0x2c')]);_0x49ecbc[_0xf20d('0x2e')]=_[_0xf20d('0x2f')](_0x49ecbc['model'],_0x49ecbc['query']);_0x2acb21['attributes']=_[_0xf20d('0x2f')](_0x49ecbc['model'],qs[_0xf20d('0x30')](_0x41378f[_0xf20d('0x2c')][_0xf20d('0x30')]));_0x2acb21[_0xf20d('0x31')]=_0x2acb21['attributes'][_0xf20d('0x32')]?_0x2acb21[_0xf20d('0x31')]:_0x49ecbc[_0xf20d('0x2b')];if(!_0x41378f[_0xf20d('0x2c')][_0xf20d('0x33')](_0xf20d('0x34'))){_0x2acb21[_0xf20d('0x35')]=qs[_0xf20d('0x35')](_0x41378f[_0xf20d('0x2c')]['limit']);_0x2acb21[_0xf20d('0x1e')]=qs[_0xf20d('0x1e')](_0x41378f[_0xf20d('0x2c')][_0xf20d('0x1e')]);}_0x2acb21['order']=qs[_0xf20d('0x36')](_0x41378f[_0xf20d('0x2c')][_0xf20d('0x36')]);_0x2acb21[_0xf20d('0x37')]=qs[_0xf20d('0x2e')](_[_0xf20d('0x38')](_0x41378f[_0xf20d('0x2c')],_0x49ecbc[_0xf20d('0x2e')]),_0x993a3b);if(_0x41378f[_0xf20d('0x2c')][_0xf20d('0x39')]){_0x2acb21['where']=_[_0xf20d('0x3a')](_0x2acb21['where'],{'$or':_[_0xf20d('0x27')](_0x993a3b,function(_0x29517d){if(_0x29517d[_0xf20d('0x3b')]!==_0xf20d('0x3c')){var _0x3ef514={};_0x3ef514[_0x29517d[_0xf20d('0x26')]]={'$like':'%'+_0x41378f[_0xf20d('0x2c')]['filter']+'%'};return _0x3ef514;}})});}_0x2acb21=_['merge']({},_0x2acb21,_0x41378f[_0xf20d('0x3d')]);var _0x41b3bf={'where':_0x2acb21['where']};return db['ServicenowField'][_0xf20d('0x1d')](_0x41b3bf)[_0xf20d('0x3e')](function(_0x568d36){_0x191c70[_0xf20d('0x1d')]=_0x568d36;if(_0x41378f['query'][_0xf20d('0x3f')]){_0x2acb21[_0xf20d('0x40')]=[{'all':!![]}];}return db['ServicenowField'][_0xf20d('0x41')](_0x2acb21);})[_0xf20d('0x3e')](function(_0x3c19d3){_0x191c70[_0xf20d('0x42')]=_0x3c19d3;return _0x191c70;})[_0xf20d('0x3e')](respondWithFilteredResult(_0x2784ec,_0x2acb21))['catch'](handleError(_0x2784ec,null));};exports[_0xf20d('0x43')]=function(_0x582c00,_0x5761da){var _0x242609={'raw':!![],'where':{'id':_0x582c00[_0xf20d('0x44')]['id']}},_0x268873={};_0x268873[_0xf20d('0x2b')]=_[_0xf20d('0x2d')](db['ServicenowField'][_0xf20d('0x29')]);_0x268873['query']=_['keys'](_0x582c00[_0xf20d('0x2c')]);_0x268873[_0xf20d('0x2e')]=_[_0xf20d('0x2f')](_0x268873[_0xf20d('0x2b')],_0x268873[_0xf20d('0x2c')]);_0x242609[_0xf20d('0x31')]=_[_0xf20d('0x2f')](_0x268873[_0xf20d('0x2b')],qs[_0xf20d('0x30')](_0x582c00[_0xf20d('0x2c')][_0xf20d('0x30')]));_0x242609[_0xf20d('0x31')]=_0x242609['attributes']['length']?_0x242609[_0xf20d('0x31')]:_0x268873['model'];if(_0x582c00[_0xf20d('0x2c')][_0xf20d('0x3f')]){_0x242609[_0xf20d('0x40')]=[{'all':!![]}];}_0x242609=_[_0xf20d('0x3a')]({},_0x242609,_0x582c00[_0xf20d('0x3d')]);return db['ServicenowField'][_0xf20d('0x45')](_0x242609)[_0xf20d('0x3e')](handleEntityNotFound(_0x5761da,null))['then'](respondWithResult(_0x5761da,null))[_0xf20d('0x46')](handleError(_0x5761da,null));};exports[_0xf20d('0x47')]=function(_0x58578f,_0x24b6c7){return db[_0xf20d('0x28')][_0xf20d('0x47')](_0x58578f[_0xf20d('0x48')],{})[_0xf20d('0x3e')](respondWithResult(_0x24b6c7,0xc9))[_0xf20d('0x46')](handleError(_0x24b6c7,null));};exports[_0xf20d('0x23')]=function(_0x132b07,_0x18b531){if(_0x132b07[_0xf20d('0x48')]['id']){delete _0x132b07[_0xf20d('0x48')]['id'];}return db['ServicenowField'][_0xf20d('0x45')]({'where':{'id':_0x132b07['params']['id']}})['then'](handleEntityNotFound(_0x18b531,null))[_0xf20d('0x3e')](saveUpdates(_0x132b07['body'],null))[_0xf20d('0x3e')](respondWithResult(_0x18b531,null))['catch'](handleError(_0x18b531,null));};exports[_0xf20d('0x49')]=function(_0x2689d3,_0x5d6c41){return db[_0xf20d('0x28')][_0xf20d('0x45')]({'where':{'id':_0x2689d3[_0xf20d('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d6c41,null))['then'](removeEntity(_0x5d6c41,null))[_0xf20d('0x46')](handleError(_0x5d6c41,null));}; \ No newline at end of file +var _0x7044=['length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x24697b,_0x2eb072){var _0x585b99=function(_0x261980){while(--_0x261980){_0x24697b['push'](_0x24697b['shift']());}};_0x585b99(++_0x2eb072);}(_0x7044,0x147));var _0x4704=function(_0x3cb52a,_0x5a586d){_0x3cb52a=_0x3cb52a-0x0;var _0x4e6bab=_0x7044[_0x3cb52a];return _0x4e6bab;};'use strict';var pdf=require(_0x4704('0x0'));var emlformat=require(_0x4704('0x1'));var rimraf=require(_0x4704('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4704('0x3'));var rp=require(_0x4704('0x4'));var moment=require(_0x4704('0x5'));var BPromise=require(_0x4704('0x6'));var Mustache=require('mustache');var util=require(_0x4704('0x7'));var path=require('path');var sox=require(_0x4704('0x8'));var csv=require(_0x4704('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4704('0xa'));var crypto=require(_0x4704('0xb'));var jsforce=require(_0x4704('0xc'));var deskjs=require(_0x4704('0xd'));var toCsv=require(_0x4704('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4704('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4704('0xf'));var as=require(_0x4704('0x10'));var hardwareService=require(_0x4704('0x11'));var logger=require(_0x4704('0x12'))(_0x4704('0x13'));var utils=require('../../config/utils');var config=require(_0x4704('0x14'));var licenseUtil=require(_0x4704('0x15'));var db=require(_0x4704('0x16'))['db'];function respondWithStatusCode(_0x30f8e8,_0x39ee42){_0x39ee42=_0x39ee42||0xcc;return function(_0x268453){if(_0x268453){return _0x30f8e8['sendStatus'](_0x39ee42);}return _0x30f8e8[_0x4704('0x17')](_0x39ee42)[_0x4704('0x18')]();};}function respondWithResult(_0x290e8e,_0x2ae487){_0x2ae487=_0x2ae487||0xc8;return function(_0x246765){if(_0x246765){return _0x290e8e[_0x4704('0x17')](_0x2ae487)[_0x4704('0x19')](_0x246765);}};}function respondWithFilteredResult(_0x3acce4,_0x27c4b8){return function(_0x5d5f3b){if(_0x5d5f3b){var _0x51ea30=_0x5d5f3b[_0x4704('0x1a')],_0xda3cbb=_0x27c4b8[_0x4704('0x1b')],_0x3930c2=_0x27c4b8['offset']+_0x27c4b8[_0x4704('0x1c')],_0x324169;if(_0x3930c2>=_0x51ea30){_0x3930c2=_0x51ea30;_0x324169=0xc8;}else{_0x324169=0xce;}_0x3acce4[_0x4704('0x17')](_0x324169);return _0x3acce4[_0x4704('0x1d')](_0x4704('0x1e'),_0xda3cbb+'-'+_0x3930c2+'/'+_0x51ea30)[_0x4704('0x19')](_0x5d5f3b);}return null;};}function patchUpdates(_0x4aa6b5){return function(_0x14b553){try{jsonpatch['apply'](_0x14b553,_0x4aa6b5,!![]);}catch(_0x360fa2){return BPromise[_0x4704('0x1f')](_0x360fa2);}return _0x14b553[_0x4704('0x20')]();};}function saveUpdates(_0x91fc0f,_0x568704){return function(_0x67825b){if(_0x67825b){return _0x67825b['update'](_0x91fc0f)[_0x4704('0x21')](function(_0x5d102c){return _0x5d102c;});}return null;};}function removeEntity(_0x3e7d5b,_0x85ac91){return function(_0x18d3d6){if(_0x18d3d6){return _0x18d3d6[_0x4704('0x22')]()[_0x4704('0x21')](function(){_0x3e7d5b['status'](0xcc)[_0x4704('0x18')]();});}};}function handleEntityNotFound(_0x26d9b1,_0x48bbb1){return function(_0xe3cec7){if(!_0xe3cec7){_0x26d9b1[_0x4704('0x23')](0x194);}return _0xe3cec7;};}function handleError(_0x5caeba,_0x51be5f){_0x51be5f=_0x51be5f||0x1f4;return function(_0x1c3e2d){logger[_0x4704('0x24')](_0x1c3e2d[_0x4704('0x25')]);if(_0x1c3e2d[_0x4704('0x26')]){delete _0x1c3e2d[_0x4704('0x26')];}_0x5caeba['status'](_0x51be5f)[_0x4704('0x27')](_0x1c3e2d);};}exports[_0x4704('0x28')]=function(_0x4aae62,_0x349366){var _0x14435={},_0xb9f47e={},_0x34d080={'count':0x0,'rows':[]};var _0x125d9c=_[_0x4704('0x29')](db[_0x4704('0x2a')][_0x4704('0x2b')],function(_0x2d1177){return{'name':_0x2d1177[_0x4704('0x2c')],'type':_0x2d1177['type'][_0x4704('0x2d')]};});_0xb9f47e[_0x4704('0x2e')]=_[_0x4704('0x29')](_0x125d9c,'name');_0xb9f47e['query']=_[_0x4704('0x2f')](_0x4aae62[_0x4704('0x30')]);_0xb9f47e[_0x4704('0x31')]=_[_0x4704('0x32')](_0xb9f47e[_0x4704('0x2e')],_0xb9f47e[_0x4704('0x30')]);_0x14435[_0x4704('0x33')]=_[_0x4704('0x32')](_0xb9f47e['model'],qs[_0x4704('0x34')](_0x4aae62['query'][_0x4704('0x34')]));_0x14435[_0x4704('0x33')]=_0x14435[_0x4704('0x33')][_0x4704('0x35')]?_0x14435['attributes']:_0xb9f47e['model'];if(!_0x4aae62['query'][_0x4704('0x36')](_0x4704('0x37'))){_0x14435[_0x4704('0x1c')]=qs[_0x4704('0x1c')](_0x4aae62[_0x4704('0x30')][_0x4704('0x1c')]);_0x14435[_0x4704('0x1b')]=qs[_0x4704('0x1b')](_0x4aae62[_0x4704('0x30')][_0x4704('0x1b')]);}_0x14435[_0x4704('0x38')]=qs[_0x4704('0x39')](_0x4aae62[_0x4704('0x30')][_0x4704('0x39')]);_0x14435['where']=qs[_0x4704('0x31')](_[_0x4704('0x3a')](_0x4aae62[_0x4704('0x30')],_0xb9f47e[_0x4704('0x31')]),_0x125d9c);if(_0x4aae62[_0x4704('0x30')][_0x4704('0x3b')]){_0x14435['where']=_[_0x4704('0x3c')](_0x14435[_0x4704('0x3d')],{'$or':_[_0x4704('0x29')](_0x125d9c,function(_0x42fab9){if(_0x42fab9[_0x4704('0x3e')]!==_0x4704('0x3f')){var _0x2ff891={};_0x2ff891[_0x42fab9[_0x4704('0x26')]]={'$like':'%'+_0x4aae62[_0x4704('0x30')][_0x4704('0x3b')]+'%'};return _0x2ff891;}})});}_0x14435=_[_0x4704('0x3c')]({},_0x14435,_0x4aae62[_0x4704('0x40')]);var _0x321daf={'where':_0x14435[_0x4704('0x3d')]};return db['ServicenowField']['count'](_0x321daf)[_0x4704('0x21')](function(_0x580d10){_0x34d080[_0x4704('0x1a')]=_0x580d10;if(_0x4aae62[_0x4704('0x30')][_0x4704('0x41')]){_0x14435['include']=[{'all':!![]}];}return db[_0x4704('0x2a')][_0x4704('0x42')](_0x14435);})[_0x4704('0x21')](function(_0x1cd6a2){_0x34d080[_0x4704('0x43')]=_0x1cd6a2;return _0x34d080;})[_0x4704('0x21')](respondWithFilteredResult(_0x349366,_0x14435))['catch'](handleError(_0x349366,null));};exports[_0x4704('0x44')]=function(_0x521221,_0x253fce){var _0x59ce0d={'raw':!![],'where':{'id':_0x521221[_0x4704('0x45')]['id']}},_0x9022b8={};_0x9022b8['model']=_[_0x4704('0x2f')](db[_0x4704('0x2a')]['rawAttributes']);_0x9022b8['query']=_[_0x4704('0x2f')](_0x521221[_0x4704('0x30')]);_0x9022b8[_0x4704('0x31')]=_['intersection'](_0x9022b8[_0x4704('0x2e')],_0x9022b8[_0x4704('0x30')]);_0x59ce0d[_0x4704('0x33')]=_[_0x4704('0x32')](_0x9022b8[_0x4704('0x2e')],qs[_0x4704('0x34')](_0x521221[_0x4704('0x30')][_0x4704('0x34')]));_0x59ce0d[_0x4704('0x33')]=_0x59ce0d[_0x4704('0x33')]['length']?_0x59ce0d[_0x4704('0x33')]:_0x9022b8['model'];if(_0x521221[_0x4704('0x30')][_0x4704('0x41')]){_0x59ce0d[_0x4704('0x46')]=[{'all':!![]}];}_0x59ce0d=_[_0x4704('0x3c')]({},_0x59ce0d,_0x521221['options']);return db[_0x4704('0x2a')][_0x4704('0x47')](_0x59ce0d)['then'](handleEntityNotFound(_0x253fce,null))['then'](respondWithResult(_0x253fce,null))[_0x4704('0x48')](handleError(_0x253fce,null));};exports[_0x4704('0x49')]=function(_0x3d3f0f,_0x3fda88){return db[_0x4704('0x2a')][_0x4704('0x49')](_0x3d3f0f[_0x4704('0x4a')],{})[_0x4704('0x21')](respondWithResult(_0x3fda88,0xc9))['catch'](handleError(_0x3fda88,null));};exports[_0x4704('0x4b')]=function(_0x51db07,_0x13f372){if(_0x51db07[_0x4704('0x4a')]['id']){delete _0x51db07[_0x4704('0x4a')]['id'];}return db[_0x4704('0x2a')][_0x4704('0x47')]({'where':{'id':_0x51db07[_0x4704('0x45')]['id']}})[_0x4704('0x21')](handleEntityNotFound(_0x13f372,null))[_0x4704('0x21')](saveUpdates(_0x51db07[_0x4704('0x4a')],null))[_0x4704('0x21')](respondWithResult(_0x13f372,null))[_0x4704('0x48')](handleError(_0x13f372,null));};exports[_0x4704('0x22')]=function(_0x51cb60,_0x1c496c){return db[_0x4704('0x2a')][_0x4704('0x47')]({'where':{'id':_0x51cb60['params']['id']}})[_0x4704('0x21')](handleEntityNotFound(_0x1c496c,null))[_0x4704('0x21')](removeEntity(_0x1c496c,null))[_0x4704('0x48')](handleError(_0x1c496c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 025685e..2531c23 100644 --- a/server/api/intServicenowField/intServicenowField.model.js +++ b/server/api/intServicenowField/intServicenowField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2a2=['define','ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path','./intServicenowField.attributes'];(function(_0x4baacb,_0x490c83){var _0x42752a=function(_0x51c8f0){while(--_0x51c8f0){_0x4baacb['push'](_0x4baacb['shift']());}};_0x42752a(++_0x490c83);}(_0xf2a2,0x1d3));var _0x2f2a=function(_0xad57c9,_0x4472df){_0xad57c9=_0xad57c9-0x0;var _0x455ddc=_0xf2a2[_0xad57c9];return _0x455ddc;};'use strict';var _=require('lodash');var util=require(_0x2f2a('0x0'));var logger=require(_0x2f2a('0x1'))('api');var moment=require(_0x2f2a('0x2'));var BPromise=require(_0x2f2a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f2a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2f2a('0x5'));module['exports']=function(_0x10634f,_0x3410ec){return _0x10634f[_0x2f2a('0x6')](_0x2f2a('0x7'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x2f2a('0x8'),'fields':[_0x2f2a('0x9'),_0x2f2a('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31e7=['lodash','../../config/logger','api','moment','bluebird','rimraf','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','FieldId'];(function(_0x57e789,_0x53d74e){var _0x8783ca=function(_0x4e1945){while(--_0x4e1945){_0x57e789['push'](_0x57e789['shift']());}};_0x8783ca(++_0x53d74e);}(_0x31e7,0x108));var _0x731e=function(_0x5076e4,_0x5b4571){_0x5076e4=_0x5076e4-0x0;var _0x795e43=_0x31e7[_0x5076e4];return _0x795e43;};'use strict';var _=require(_0x731e('0x0'));var util=require('util');var logger=require(_0x731e('0x1'))(_0x731e('0x2'));var moment=require(_0x731e('0x3'));var BPromise=require(_0x731e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x731e('0x5'));var config=require('../../config/environment');var attributes=require(_0x731e('0x6'));module[_0x731e('0x7')]=function(_0x21922d,_0x586e9f){return _0x21922d['define'](_0x731e('0x8'),attributes,{'tableName':_0x731e('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x731e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index e1a1f66..e0f718b 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7589=['http','request','then','info','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x181707,_0x47d753){var _0x1d2b7a=function(_0x508991){while(--_0x508991){_0x181707['push'](_0x181707['shift']());}};_0x1d2b7a(++_0x47d753);}(_0x7589,0x14e));var _0x9758=function(_0x3ee742,_0xe9b0f9){_0x3ee742=_0x3ee742-0x0;var _0x246e90=_0x7589[_0x3ee742];return _0x246e90;};'use strict';var _=require(_0x9758('0x0'));var util=require(_0x9758('0x1'));var moment=require(_0x9758('0x2'));var BPromise=require(_0x9758('0x3'));var rs=require(_0x9758('0x4'));var fs=require('fs');var Redis=require(_0x9758('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9758('0x6'));var logger=require(_0x9758('0x7'))(_0x9758('0x8'));var config=require('../../config/environment');var jayson=require(_0x9758('0x9'));var client=jayson[_0x9758('0xa')][_0x9758('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x255df1,_0x156c01,_0x15ebda){return new BPromise(function(_0x403840,_0x23c1e4){return client[_0x9758('0xc')](_0x255df1,_0x15ebda)[_0x9758('0xd')](function(_0xb382ee){logger[_0x9758('0xe')](_0x9758('0xf'),_0x156c01,'request\x20sent');logger[_0x9758('0x10')](_0x9758('0x11'),_0x156c01,_0x9758('0x12'),JSON[_0x9758('0x13')](_0xb382ee));if(_0xb382ee['error']){if(_0xb382ee[_0x9758('0x14')]['code']===0x1f4){logger['error']('ServicenowField,\x20%s,\x20%s',_0x156c01,_0xb382ee['error'][_0x9758('0x15')]);return _0x23c1e4(_0xb382ee[_0x9758('0x14')][_0x9758('0x15')]);}logger['error'](_0x9758('0xf'),_0x156c01,_0xb382ee[_0x9758('0x14')]['message']);return _0x403840(_0xb382ee['error'][_0x9758('0x15')]);}else{logger[_0x9758('0xe')](_0x9758('0xf'),_0x156c01,_0x9758('0x12'));_0x403840(_0xb382ee[_0x9758('0x16')]['message']);}})['catch'](function(_0x31e217){logger['error'](_0x9758('0xf'),_0x156c01,_0x31e217);_0x23c1e4(_0x31e217);});});} \ No newline at end of file +var _0x8ae5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x2e6c8d,_0x17c7ef){var _0x259c0f=function(_0x97387a){while(--_0x97387a){_0x2e6c8d['push'](_0x2e6c8d['shift']());}};_0x259c0f(++_0x17c7ef);}(_0x8ae5,0x6a));var _0x58ae=function(_0x59e0a6,_0x48b55c){_0x59e0a6=_0x59e0a6-0x0;var _0xd6efff=_0x8ae5[_0x59e0a6];return _0xd6efff;};'use strict';var _=require(_0x58ae('0x0'));var util=require(_0x58ae('0x1'));var moment=require(_0x58ae('0x2'));var BPromise=require(_0x58ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58ae('0x4'));var db=require(_0x58ae('0x5'))['db'];var utils=require(_0x58ae('0x6'));var logger=require(_0x58ae('0x7'))(_0x58ae('0x8'));var config=require(_0x58ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58ae('0xa')][_0x58ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3434a6,_0x3bfde1,_0x27bb1c){return new BPromise(function(_0x259d6c,_0x2f26e3){return client[_0x58ae('0xc')](_0x3434a6,_0x27bb1c)[_0x58ae('0xd')](function(_0x1af2a1){logger['info']('ServicenowField,\x20%s,\x20%s',_0x3bfde1,_0x58ae('0xe'));logger[_0x58ae('0xf')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x3bfde1,_0x58ae('0xe'),JSON[_0x58ae('0x10')](_0x1af2a1));if(_0x1af2a1[_0x58ae('0x11')]){if(_0x1af2a1[_0x58ae('0x11')][_0x58ae('0x12')]===0x1f4){logger[_0x58ae('0x11')](_0x58ae('0x13'),_0x3bfde1,_0x1af2a1['error'][_0x58ae('0x14')]);return _0x2f26e3(_0x1af2a1[_0x58ae('0x11')]['message']);}logger[_0x58ae('0x11')](_0x58ae('0x13'),_0x3bfde1,_0x1af2a1[_0x58ae('0x11')][_0x58ae('0x14')]);return _0x259d6c(_0x1af2a1['error'][_0x58ae('0x14')]);}else{logger['info'](_0x58ae('0x13'),_0x3bfde1,_0x58ae('0xe'));_0x259d6c(_0x1af2a1['result'][_0x58ae('0x14')]);}})[_0x58ae('0x15')](function(_0x44b596){logger['error'](_0x58ae('0x13'),_0x3bfde1,_0x44b596);_0x2f26e3(_0x44b596);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7ce92f7..1a48915 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2917=['getConfigurations','/:id/fields','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x12a4e0,_0x2f2d61){var _0x3ef737=function(_0x578e6a){while(--_0x578e6a){_0x12a4e0['push'](_0x12a4e0['shift']());}};_0x3ef737(++_0x2f2d61);}(_0x2917,0x142));var _0x7291=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x2917[_0xe66cf2];return _0x2d84e7;};'use strict';var multer=require(_0x7291('0x0'));var util=require(_0x7291('0x1'));var path=require(_0x7291('0x2'));var timeout=require(_0x7291('0x3'));var express=require(_0x7291('0x4'));var router=express[_0x7291('0x5')]();var auth=require(_0x7291('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7291('0x7'));router[_0x7291('0x8')]('/',auth[_0x7291('0x9')](),controller[_0x7291('0xa')]);router[_0x7291('0x8')](_0x7291('0xb'),auth[_0x7291('0x9')](),controller[_0x7291('0xc')]);router[_0x7291('0x8')](_0x7291('0xd'),auth[_0x7291('0x9')](),controller[_0x7291('0xe')]);router[_0x7291('0x8')](_0x7291('0xf'),auth[_0x7291('0x9')](),controller['getFields']);router[_0x7291('0x10')]('/',auth[_0x7291('0x9')](),controller[_0x7291('0x11')]);router[_0x7291('0x10')](_0x7291('0xd'),auth[_0x7291('0x9')](),controller['addConfiguration']);router['put'](_0x7291('0xb'),auth[_0x7291('0x9')](),controller[_0x7291('0x12')]);router[_0x7291('0x13')](_0x7291('0xb'),auth[_0x7291('0x9')](),controller[_0x7291('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc0e6=['delete','destroy','exports','util','connect-timeout','express','Router','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x2e6776,_0x1ea7c7){var _0x3423bf=function(_0x4fe872){while(--_0x4fe872){_0x2e6776['push'](_0x2e6776['shift']());}};_0x3423bf(++_0x1ea7c7);}(_0xc0e6,0x1b8));var _0x6c0e=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xc0e6[_0x5ddaac];return _0x2a9c58;};'use strict';var multer=require('multer');var util=require(_0x6c0e('0x0'));var path=require('path');var timeout=require(_0x6c0e('0x1'));var express=require(_0x6c0e('0x2'));var router=express[_0x6c0e('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c0e('0x4'));var controller=require(_0x6c0e('0x5'));router[_0x6c0e('0x6')]('/',auth[_0x6c0e('0x7')](),controller[_0x6c0e('0x8')]);router[_0x6c0e('0x6')](_0x6c0e('0x9'),auth[_0x6c0e('0x7')](),controller[_0x6c0e('0xa')]);router[_0x6c0e('0x6')](_0x6c0e('0xb'),auth[_0x6c0e('0x7')](),controller[_0x6c0e('0xc')]);router[_0x6c0e('0x6')](_0x6c0e('0xd'),auth['isAuthenticated'](),controller[_0x6c0e('0xe')]);router[_0x6c0e('0xf')]('/',auth[_0x6c0e('0x7')](),controller['create']);router['post'](_0x6c0e('0xb'),auth[_0x6c0e('0x7')](),controller['addConfiguration']);router['put'](_0x6c0e('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x6c0e('0x10')](_0x6c0e('0x9'),auth[_0x6c0e('0x7')](),controller[_0x6c0e('0x11')]);module[_0x6c0e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e3b9dfa..b7eabe6 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa15c=['sequelize','exports','STRING','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa15c,0x1c2));var _0xca15=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xa15c[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xca15('0x0'));module[_0xca15('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xca15('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xca15('0x3')},'password':{'type':Sequelize[_0xca15('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xca15('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb94f=['STRING','username','exports'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0xb94f,0xce));var _0xfb94=function(_0x1d3892,_0x47d5fe){_0x1d3892=_0x1d3892-0x0;var _0x574ff2=_0xb94f[_0x1d3892];return _0x574ff2;};'use strict';var Sequelize=require('sequelize');module[_0xfb94('0x0')]={'name':{'type':Sequelize[_0xfb94('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfb94('0x1')],'unique':_0xfb94('0x2')},'password':{'type':Sequelize[_0xfb94('0x1')]},'remoteUri':{'type':Sequelize[_0xfb94('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xfb94('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 26aa270..449d8a8 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5630=['statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','count','offset','set','reject','save','update','destroy','stack','name','send','map','SugarcrmAccount','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','findOne','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test'];(function(_0x468ed9,_0x21de15){var _0x529c7c=function(_0x53c2d9){while(--_0x53c2d9){_0x468ed9['push'](_0x468ed9['shift']());}};_0x529c7c(++_0x21de15);}(_0x5630,0x83));var _0x0563=function(_0x2d9662,_0x2e7948){_0x2d9662=_0x2d9662-0x0;var _0x22c3ab=_0x5630[_0x2d9662];return _0x22c3ab;};'use strict';var pdf=require(_0x0563('0x0'));var emlformat=require(_0x0563('0x1'));var rimraf=require(_0x0563('0x2'));var zipdir=require(_0x0563('0x3'));var jsonpatch=require(_0x0563('0x4'));var rp=require(_0x0563('0x5'));var moment=require(_0x0563('0x6'));var BPromise=require(_0x0563('0x7'));var Mustache=require(_0x0563('0x8'));var util=require(_0x0563('0x9'));var path=require('path');var sox=require(_0x0563('0xa'));var csv=require('to-csv');var ejs=require(_0x0563('0xb'));var fs=require('fs');var _=require(_0x0563('0xc'));var squel=require('squel');var crypto=require(_0x0563('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0563('0xe'));var toCsv=require(_0x0563('0xf'));var querystring=require(_0x0563('0x10'));var Papa=require(_0x0563('0x11'));var Redis=require('ioredis');var authService=require(_0x0563('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0563('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0563('0x14'))(_0x0563('0x15'));var utils=require(_0x0563('0x16'));var config=require(_0x0563('0x17'));var licenseUtil=require(_0x0563('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0563('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x0563('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49836a,_0x255f67,_0x1575cc,_0xd756de){return new BPromise(function(_0x1d09f5,_0x224a89){var _0x3a543b=_0xd756de||client;return _0x3a543b[_0x0563('0x1b')](_0x49836a,_0x1575cc)[_0x0563('0x1c')](function(_0x5c9404){logger[_0x0563('0x1d')](_0x0563('0x1e'),_0x255f67,_0x0563('0x1f'));logger['debug'](_0x0563('0x20'),_0x255f67,_0x0563('0x1f'),JSON['stringify'](_0x5c9404));if(_0x5c9404[_0x0563('0x21')]){if(_0x5c9404[_0x0563('0x21')]['code']===0x1f4){logger[_0x0563('0x21')](_0x0563('0x1e'),_0x255f67,_0x5c9404['error']['message']);return _0x224a89(_0x5c9404[_0x0563('0x21')][_0x0563('0x22')]);}logger['error'](_0x0563('0x1e'),_0x255f67,_0x5c9404[_0x0563('0x21')][_0x0563('0x22')]);return _0x1d09f5(_0x5c9404[_0x0563('0x21')]['message']);}else{logger[_0x0563('0x1d')](_0x0563('0x1e'),_0x255f67,_0x0563('0x1f'));_0x1d09f5(_0x5c9404[_0x0563('0x23')]['message']);}})[_0x0563('0x24')](function(_0x347097){logger['error'](_0x0563('0x1e'),_0x255f67,_0x347097);_0x224a89(_0x347097);});});}function respondWithStatusCode(_0x29e896,_0x2f8fa2){_0x2f8fa2=_0x2f8fa2||0xcc;return function(_0x1710a8){if(_0x1710a8){return _0x29e896[_0x0563('0x25')](_0x2f8fa2);}return _0x29e896[_0x0563('0x26')](_0x2f8fa2)[_0x0563('0x27')]();};}function respondWithResult(_0x3c43ad,_0x5a159f){_0x5a159f=_0x5a159f||0xc8;return function(_0x22f10b){if(_0x22f10b){return _0x3c43ad['status'](_0x5a159f)[_0x0563('0x28')](_0x22f10b);}};}function respondWithFilteredResult(_0x2e925b,_0x4b1da6){return function(_0x17676c){if(_0x17676c){var _0x3e3faa=_0x17676c[_0x0563('0x29')],_0x2f764f=_0x4b1da6[_0x0563('0x2a')],_0x4391ea=_0x4b1da6[_0x0563('0x2a')]+_0x4b1da6['limit'],_0x5dca6f;if(_0x4391ea>=_0x3e3faa){_0x4391ea=_0x3e3faa;_0x5dca6f=0xc8;}else{_0x5dca6f=0xce;}_0x2e925b[_0x0563('0x26')](_0x5dca6f);return _0x2e925b[_0x0563('0x2b')]('Content-Range',_0x2f764f+'-'+_0x4391ea+'/'+_0x3e3faa)[_0x0563('0x28')](_0x17676c);}return null;};}function patchUpdates(_0x47b730){return function(_0x396cd2){try{jsonpatch['apply'](_0x396cd2,_0x47b730,!![]);}catch(_0x24672f){return BPromise[_0x0563('0x2c')](_0x24672f);}return _0x396cd2[_0x0563('0x2d')]();};}function saveUpdates(_0x2806ea,_0x269104){return function(_0x179fee){if(_0x179fee){return _0x179fee[_0x0563('0x2e')](_0x2806ea)[_0x0563('0x1c')](function(_0x338daf){return _0x338daf;});}return null;};}function removeEntity(_0x452acf,_0x5c6b8f){return function(_0x369551){if(_0x369551){return _0x369551[_0x0563('0x2f')]()[_0x0563('0x1c')](function(){_0x452acf[_0x0563('0x26')](0xcc)[_0x0563('0x27')]();});}};}function handleEntityNotFound(_0x1078fb,_0x5445bd){return function(_0x1d564b){if(!_0x1d564b){_0x1078fb['sendStatus'](0x194);}return _0x1d564b;};}function handleError(_0xc3defb,_0x2c9019){_0x2c9019=_0x2c9019||0x1f4;return function(_0x1c46d9){logger[_0x0563('0x21')](_0x1c46d9[_0x0563('0x30')]);if(_0x1c46d9['name']){delete _0x1c46d9[_0x0563('0x31')];}_0xc3defb[_0x0563('0x26')](_0x2c9019)[_0x0563('0x32')](_0x1c46d9);};}exports['index']=function(_0xac7cad,_0x24170f){var _0x350672={},_0x3332f9={},_0x59d4bc={'count':0x0,'rows':[]};var _0x3101e4=_[_0x0563('0x33')](db[_0x0563('0x34')][_0x0563('0x35')],function(_0x1bedd6){return{'name':_0x1bedd6['fieldName'],'type':_0x1bedd6[_0x0563('0x36')][_0x0563('0x37')]};});_0x3332f9[_0x0563('0x38')]=_[_0x0563('0x33')](_0x3101e4,_0x0563('0x31'));_0x3332f9['query']=_[_0x0563('0x39')](_0xac7cad['query']);_0x3332f9[_0x0563('0x3a')]=_[_0x0563('0x3b')](_0x3332f9[_0x0563('0x38')],_0x3332f9[_0x0563('0x3c')]);_0x350672[_0x0563('0x3d')]=_[_0x0563('0x3b')](_0x3332f9['model'],qs[_0x0563('0x3e')](_0xac7cad[_0x0563('0x3c')][_0x0563('0x3e')]));_0x350672[_0x0563('0x3d')]=_0x350672[_0x0563('0x3d')]['length']?_0x350672['attributes']:_0x3332f9[_0x0563('0x38')];if(!_0xac7cad[_0x0563('0x3c')]['hasOwnProperty']('nolimit')){_0x350672[_0x0563('0x3f')]=qs['limit'](_0xac7cad[_0x0563('0x3c')]['limit']);_0x350672[_0x0563('0x2a')]=qs[_0x0563('0x2a')](_0xac7cad['query'][_0x0563('0x2a')]);}_0x350672[_0x0563('0x40')]=qs[_0x0563('0x41')](_0xac7cad[_0x0563('0x3c')][_0x0563('0x41')]);_0x350672[_0x0563('0x42')]=qs[_0x0563('0x3a')](_[_0x0563('0x43')](_0xac7cad[_0x0563('0x3c')],_0x3332f9[_0x0563('0x3a')]),_0x3101e4);if(_0xac7cad[_0x0563('0x3c')][_0x0563('0x44')]){_0x350672['where']=_[_0x0563('0x45')](_0x350672[_0x0563('0x42')],{'$or':_['map'](_0x3101e4,function(_0x6d47e){if(_0x6d47e['type']!==_0x0563('0x46')){var _0x1c6197={};_0x1c6197[_0x6d47e[_0x0563('0x31')]]={'$like':'%'+_0xac7cad[_0x0563('0x3c')][_0x0563('0x44')]+'%'};return _0x1c6197;}})});}_0x350672=_[_0x0563('0x45')]({},_0x350672,_0xac7cad[_0x0563('0x47')]);var _0x449aaa={'where':_0x350672[_0x0563('0x42')]};return db['SugarcrmAccount'][_0x0563('0x29')](_0x449aaa)['then'](function(_0x28cb4b){_0x59d4bc[_0x0563('0x29')]=_0x28cb4b;if(_0xac7cad[_0x0563('0x3c')][_0x0563('0x48')]){_0x350672[_0x0563('0x49')]=[{'all':!![]}];}return db[_0x0563('0x34')][_0x0563('0x4a')](_0x350672);})[_0x0563('0x1c')](function(_0x11363a){_0x59d4bc[_0x0563('0x4b')]=_0x11363a;return _0x59d4bc;})[_0x0563('0x1c')](respondWithFilteredResult(_0x24170f,_0x350672))[_0x0563('0x24')](handleError(_0x24170f,null));};exports[_0x0563('0x4c')]=function(_0x182519,_0x2c45b4){var _0x1564a3={'raw':![],'where':{'id':_0x182519[_0x0563('0x4d')]['id']}},_0x2884e3={};_0x2884e3['model']=_[_0x0563('0x39')](db[_0x0563('0x34')][_0x0563('0x35')]);_0x2884e3[_0x0563('0x3c')]=_[_0x0563('0x39')](_0x182519['query']);_0x2884e3[_0x0563('0x3a')]=_[_0x0563('0x3b')](_0x2884e3['model'],_0x2884e3[_0x0563('0x3c')]);_0x1564a3[_0x0563('0x3d')]=_[_0x0563('0x3b')](_0x2884e3[_0x0563('0x38')],qs[_0x0563('0x3e')](_0x182519[_0x0563('0x3c')]['fields']));_0x1564a3[_0x0563('0x3d')]=_0x1564a3['attributes'][_0x0563('0x4e')]?_0x1564a3[_0x0563('0x3d')]:_0x2884e3[_0x0563('0x38')];if(_0x182519[_0x0563('0x3c')][_0x0563('0x48')]){_0x1564a3[_0x0563('0x49')]=[{'all':!![]}];}_0x1564a3=_['merge']({},_0x1564a3,_0x182519[_0x0563('0x47')]);return db[_0x0563('0x34')][_0x0563('0x4f')](_0x1564a3)[_0x0563('0x1c')](handleEntityNotFound(_0x2c45b4,null))[_0x0563('0x1c')](respondWithResult(_0x2c45b4,null))['catch'](handleError(_0x2c45b4,null));};exports[_0x0563('0x50')]=function(_0xb6812,_0x2375cb){return db['SugarcrmAccount'][_0x0563('0x50')](_0xb6812[_0x0563('0x51')],{})[_0x0563('0x1c')](respondWithResult(_0x2375cb,0xc9))[_0x0563('0x24')](handleError(_0x2375cb,null));};exports[_0x0563('0x2e')]=function(_0xd605e1,_0x36f275){if(_0xd605e1[_0x0563('0x51')]['id']){delete _0xd605e1['body']['id'];}return db[_0x0563('0x34')]['find']({'where':{'id':_0xd605e1[_0x0563('0x4d')]['id']}})[_0x0563('0x1c')](handleEntityNotFound(_0x36f275,null))[_0x0563('0x1c')](saveUpdates(_0xd605e1['body'],null))[_0x0563('0x1c')](respondWithResult(_0x36f275,null))[_0x0563('0x24')](handleError(_0x36f275,null));};exports[_0x0563('0x2f')]=function(_0x58ef1d,_0x305fa9){return db[_0x0563('0x34')]['find']({'where':{'id':_0x58ef1d[_0x0563('0x4d')]['id']}})[_0x0563('0x1c')](handleEntityNotFound(_0x305fa9,null))[_0x0563('0x1c')](removeEntity(_0x305fa9,null))[_0x0563('0x24')](handleError(_0x305fa9,null));};exports['getConfigurations']=function(_0x21b013,_0x7961ce,_0x42ae21){var _0x5a81f1={};var _0x33e4fb={};var _0x91c7d7;var _0x5ad5c0;return db[_0x0563('0x34')][_0x0563('0x52')]({'where':{'id':_0x21b013[_0x0563('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7961ce,null))['then'](function(_0x4b147b){if(_0x4b147b){_0x91c7d7=_0x4b147b;_0x33e4fb[_0x0563('0x38')]=_[_0x0563('0x39')](db['SugarcrmConfiguration'][_0x0563('0x35')]);_0x33e4fb[_0x0563('0x3c')]=_[_0x0563('0x39')](_0x21b013[_0x0563('0x3c')]);_0x33e4fb[_0x0563('0x3a')]=_['intersection'](_0x33e4fb[_0x0563('0x38')],_0x33e4fb[_0x0563('0x3c')]);_0x5a81f1[_0x0563('0x3d')]=_[_0x0563('0x3b')](_0x33e4fb[_0x0563('0x38')],qs[_0x0563('0x3e')](_0x21b013[_0x0563('0x3c')]['fields']));_0x5a81f1[_0x0563('0x3d')]=_0x5a81f1[_0x0563('0x3d')][_0x0563('0x4e')]?_0x5a81f1[_0x0563('0x3d')]:_0x33e4fb[_0x0563('0x38')];_0x5a81f1[_0x0563('0x40')]=qs[_0x0563('0x41')](_0x21b013[_0x0563('0x3c')][_0x0563('0x41')]);_0x5a81f1[_0x0563('0x42')]=qs[_0x0563('0x3a')](_['pick'](_0x21b013['query'],_0x33e4fb[_0x0563('0x3a')]));if(_0x21b013[_0x0563('0x3c')][_0x0563('0x44')]){_0x5a81f1[_0x0563('0x42')]=_[_0x0563('0x45')](_0x5a81f1['where'],{'$or':_[_0x0563('0x33')](_0x5a81f1['attributes'],function(_0x129ee4){var _0x3cd470={};_0x3cd470[_0x129ee4]={'$like':'%'+_0x21b013['query'][_0x0563('0x44')]+'%'};return _0x3cd470;})});}_0x5a81f1=_[_0x0563('0x45')]({},_0x5a81f1,_0x21b013[_0x0563('0x47')]);return _0x91c7d7['getConfigurations'](_0x5a81f1);}})['then'](function(_0x52ddcd){if(_0x52ddcd){_0x5ad5c0=_0x52ddcd[_0x0563('0x4e')];if(!_0x21b013[_0x0563('0x3c')][_0x0563('0x53')](_0x0563('0x54'))){_0x5a81f1[_0x0563('0x3f')]=qs[_0x0563('0x3f')](_0x21b013[_0x0563('0x3c')][_0x0563('0x3f')]);_0x5a81f1[_0x0563('0x2a')]=qs['offset'](_0x21b013['query'][_0x0563('0x2a')]);}return _0x91c7d7['getConfigurations'](_0x5a81f1);}})[_0x0563('0x1c')](function(_0x24428b){if(_0x24428b){return _0x24428b?{'count':_0x5ad5c0,'rows':_0x24428b}:null;}})[_0x0563('0x1c')](respondWithResult(_0x7961ce,null))[_0x0563('0x24')](handleError(_0x7961ce,null));};exports[_0x0563('0x55')]=function(_0x4453c5,_0x3fa960,_0x1fdfe2){if(_0x4453c5[_0x0563('0x51')]['id']){delete _0x4453c5[_0x0563('0x51')]['id'];}return db[_0x0563('0x34')]['findOne']({'where':{'id':_0x4453c5[_0x0563('0x4d')]['id']}})[_0x0563('0x1c')](handleEntityNotFound(_0x3fa960,null))['then'](function(_0x56115f){if(_0x56115f){_0x4453c5[_0x0563('0x51')][_0x0563('0x56')]=_0x56115f['id'];_0x4453c5[_0x0563('0x51')][_0x0563('0x57')]=integrations['getSubjects'](_0x4453c5[_0x0563('0x51')][_0x0563('0x58')],_0x4453c5['body'][_0x0563('0x36')]);_0x4453c5['body'][_0x0563('0x59')]=integrations[_0x0563('0x5a')](_0x4453c5['body'][_0x0563('0x58')],_0x4453c5['body']['type']);return db['SugarcrmConfiguration'][_0x0563('0x50')](_0x4453c5[_0x0563('0x51')],{'include':[{'model':db[_0x0563('0x5b')],'as':_0x0563('0x57')},{'model':db[_0x0563('0x5b')],'as':'Descriptions'}]});}return null;})[_0x0563('0x1c')](respondWithResult(_0x3fa960,null))[_0x0563('0x24')](handleError(_0x3fa960,null));};exports[_0x0563('0x5c')]=function(_0x4a0d6e,_0x5a5296,_0x5c1c0a){var _0x2ace7c='';var _0x26bc04=['id',_0x0563('0x31'),_0x0563('0x5d'),'created_by',_0x0563('0x5e'),_0x0563('0x5f'),_0x0563('0x60'),_0x0563('0x61'),'parent_id',_0x0563('0x62'),_0x0563('0x63'),_0x0563('0x64')];return db[_0x0563('0x34')][_0x0563('0x52')]({'where':{'id':_0x4a0d6e[_0x0563('0x4d')]['id']},'attributes':['id',_0x0563('0x65'),_0x0563('0x66'),'remoteUri']})[_0x0563('0x1c')](handleEntityNotFound(_0x5a5296,null))[_0x0563('0x1c')](function(_0x564878){if(_0x564878){_0x2ace7c=_0x564878['remoteUri'];var _0x4a72d9=_0x2ace7c['slice'](-0x1);if(_0x4a72d9==='/'){_0x2ace7c=_0x2ace7c[_0x0563('0x67')](0x0,_0x2ace7c[_0x0563('0x68')](_0x4a72d9));}return rp({'method':'POST','uri':util[_0x0563('0x69')](_0x0563('0x6a'),_0x2ace7c,_0x0563('0x6b')),'json':!![],'form':{'method':_0x0563('0x6c'),'input_type':_0x0563('0x6d'),'response_type':_0x0563('0x6d'),'rest_data':JSON[_0x0563('0x6e')]({'user_auth':{'user_name':_0x564878[_0x0563('0x65')],'password':_0x564878[_0x0563('0x66')],'encryption':_0x0563('0x6f')},'application':_0x0563('0x70')})}});}})[_0x0563('0x1c')](function(_0x257239){if(_0x257239&&_0x257239[_0x0563('0x31')]!==_0x0563('0x71')&&_0x257239[_0x0563('0x31')]!==_0x0563('0x72')){return rp({'method':_0x0563('0x73'),'uri':util['format']('%s%s',_0x2ace7c,_0x0563('0x6b')),'json':!![],'form':{'method':_0x0563('0x74'),'input_type':_0x0563('0x6d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x257239['id'],'module_name':_0x0563('0x75')})}})['then'](function(_0x100911){if(_0x100911){var _0x29376e=_[_0x0563('0x76')](_0x100911[_0x0563('0x77')]);_['remove'](_0x29376e,function(_0x1e854e){return _0x26bc04[_0x0563('0x78')](_0x1e854e[_0x0563('0x31')]);});return{'count':_0x29376e[_0x0563('0x4e')],'rows':_[_0x0563('0x33')](_0x29376e,function(_0x334f42){return{'id':_0x334f42[_0x0563('0x31')],'name':_0x334f42[_0x0563('0x79')],'custom':_[_0x0563('0x7a')](_0x334f42[_0x0563('0x31')],'_c')?!![]:![],'options':_0x334f42[_0x0563('0x47')]?_['map'](_[_0x0563('0x76')](_0x334f42[_0x0563('0x47')]),function(_0x549283){return{'name':_0x549283[_0x0563('0x7b')],'value':_0x549283[_0x0563('0x31')]};}):[]};})};}})[_0x0563('0x1c')](respondWithResult(_0x5a5296,null))[_0x0563('0x24')](function(_0x2d44e9){var _0x26f3ee=_0x4a0d6e[_0x0563('0x3c')][_0x0563('0x7c')]?0x1f4:_0x2d44e9[_0x0563('0x7d')]||0x1f4;logger[_0x0563('0x21')](_0x0563('0x7e'),'getFields',_0x26f3ee,JSON[_0x0563('0x6e')](_0x2d44e9));delete _0x2d44e9[_0x0563('0x31')];if(_0x26f3ee===0x191){_0x26f3ee=0x190;}_0x5a5296['status'](_0x26f3ee)['send'](_0x4a0d6e['query'][_0x0563('0x7c')]?{'message':_0x0563('0x7f'),'statusCode':_0x2d44e9['statusCode']}:_0x2d44e9);});}else{var _0x503321=0x1f4;_0x5a5296['status'](_0x503321)['send']({'message':_0x0563('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x76b1=['request','then','info','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','status','end','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','rawAttributes','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','where','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','login','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http'];(function(_0x448706,_0x13f057){var _0x1307ab=function(_0x4d2286){while(--_0x4d2286){_0x448706['push'](_0x448706['shift']());}};_0x1307ab(++_0x13f057);}(_0x76b1,0x15d));var _0x176b=function(_0x270295,_0x51db7c){_0x270295=_0x270295-0x0;var _0x44eae6=_0x76b1[_0x270295];return _0x44eae6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x176b('0x0'));var zipdir=require(_0x176b('0x1'));var jsonpatch=require(_0x176b('0x2'));var rp=require(_0x176b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x176b('0x4'));var util=require(_0x176b('0x5'));var path=require(_0x176b('0x6'));var sox=require('sox');var csv=require(_0x176b('0x7'));var ejs=require(_0x176b('0x8'));var fs=require('fs');var _=require(_0x176b('0x9'));var squel=require(_0x176b('0xa'));var crypto=require(_0x176b('0xb'));var jsforce=require(_0x176b('0xc'));var deskjs=require(_0x176b('0xd'));var toCsv=require(_0x176b('0x7'));var querystring=require(_0x176b('0xe'));var Papa=require(_0x176b('0xf'));var Redis=require(_0x176b('0x10'));var authService=require(_0x176b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x176b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x176b('0x13'))(_0x176b('0x14'));var utils=require(_0x176b('0x15'));var config=require(_0x176b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x176b('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x176b('0x18')][_0x176b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x46e218,_0x5221ff,_0x2fbe5d,_0xee6b58){return new BPromise(function(_0x12efdc,_0x974a7b){var _0xe93a77=_0xee6b58||client;return _0xe93a77[_0x176b('0x1a')](_0x46e218,_0x2fbe5d)[_0x176b('0x1b')](function(_0x2dac44){logger[_0x176b('0x1c')]('SugarcrmAccount,\x20%s,\x20%s',_0x5221ff,'request\x20sent');logger['debug'](_0x176b('0x1d'),_0x5221ff,'request\x20sent',JSON[_0x176b('0x1e')](_0x2dac44));if(_0x2dac44[_0x176b('0x1f')]){if(_0x2dac44[_0x176b('0x1f')]['code']===0x1f4){logger[_0x176b('0x1f')](_0x176b('0x20'),_0x5221ff,_0x2dac44[_0x176b('0x1f')][_0x176b('0x21')]);return _0x974a7b(_0x2dac44[_0x176b('0x1f')][_0x176b('0x21')]);}logger[_0x176b('0x1f')]('SugarcrmAccount,\x20%s,\x20%s',_0x5221ff,_0x2dac44[_0x176b('0x1f')][_0x176b('0x21')]);return _0x12efdc(_0x2dac44[_0x176b('0x1f')]['message']);}else{logger[_0x176b('0x1c')](_0x176b('0x20'),_0x5221ff,_0x176b('0x22'));_0x12efdc(_0x2dac44[_0x176b('0x23')][_0x176b('0x21')]);}})[_0x176b('0x24')](function(_0x2368b7){logger['error'](_0x176b('0x20'),_0x5221ff,_0x2368b7);_0x974a7b(_0x2368b7);});});}function respondWithStatusCode(_0x3d8e7a,_0x19e6da){_0x19e6da=_0x19e6da||0xcc;return function(_0x51b942){if(_0x51b942){return _0x3d8e7a['sendStatus'](_0x19e6da);}return _0x3d8e7a[_0x176b('0x25')](_0x19e6da)[_0x176b('0x26')]();};}function respondWithResult(_0x4b13fc,_0x28c671){_0x28c671=_0x28c671||0xc8;return function(_0x428158){if(_0x428158){return _0x4b13fc[_0x176b('0x25')](_0x28c671)['json'](_0x428158);}};}function respondWithFilteredResult(_0x521d7a,_0x2e8dfa){return function(_0x1cadd9){if(_0x1cadd9){var _0x12030b=_0x1cadd9['count'],_0x11e64f=_0x2e8dfa['offset'],_0x230d43=_0x2e8dfa[_0x176b('0x27')]+_0x2e8dfa[_0x176b('0x28')],_0x298491;if(_0x230d43>=_0x12030b){_0x230d43=_0x12030b;_0x298491=0xc8;}else{_0x298491=0xce;}_0x521d7a[_0x176b('0x25')](_0x298491);return _0x521d7a[_0x176b('0x29')](_0x176b('0x2a'),_0x11e64f+'-'+_0x230d43+'/'+_0x12030b)['json'](_0x1cadd9);}return null;};}function patchUpdates(_0x2d74da){return function(_0x3a9e3f){try{jsonpatch[_0x176b('0x2b')](_0x3a9e3f,_0x2d74da,!![]);}catch(_0xbef1cf){return BPromise['reject'](_0xbef1cf);}return _0x3a9e3f[_0x176b('0x2c')]();};}function saveUpdates(_0x42ada2,_0x442e9f){return function(_0x3b5ed9){if(_0x3b5ed9){return _0x3b5ed9[_0x176b('0x2d')](_0x42ada2)[_0x176b('0x1b')](function(_0x9f8456){return _0x9f8456;});}return null;};}function removeEntity(_0xd2baa3,_0x4ed74c){return function(_0x5232e0){if(_0x5232e0){return _0x5232e0[_0x176b('0x2e')]()[_0x176b('0x1b')](function(){_0xd2baa3[_0x176b('0x25')](0xcc)[_0x176b('0x26')]();});}};}function handleEntityNotFound(_0x10f384,_0x42b29c){return function(_0x3cbdb7){if(!_0x3cbdb7){_0x10f384['sendStatus'](0x194);}return _0x3cbdb7;};}function handleError(_0xc637ff,_0x16901d){_0x16901d=_0x16901d||0x1f4;return function(_0x2c2eed){logger[_0x176b('0x1f')](_0x2c2eed[_0x176b('0x2f')]);if(_0x2c2eed[_0x176b('0x30')]){delete _0x2c2eed[_0x176b('0x30')];}_0xc637ff[_0x176b('0x25')](_0x16901d)[_0x176b('0x31')](_0x2c2eed);};}exports[_0x176b('0x32')]=function(_0x1d13d4,_0x1647ef){var _0x1e54e2={},_0x25f02b={},_0x47782c={'count':0x0,'rows':[]};var _0x300c43=_[_0x176b('0x33')](db[_0x176b('0x34')]['rawAttributes'],function(_0xd4209a){return{'name':_0xd4209a[_0x176b('0x35')],'type':_0xd4209a[_0x176b('0x36')]['key']};});_0x25f02b[_0x176b('0x37')]=_['map'](_0x300c43,'name');_0x25f02b[_0x176b('0x38')]=_[_0x176b('0x39')](_0x1d13d4[_0x176b('0x38')]);_0x25f02b[_0x176b('0x3a')]=_[_0x176b('0x3b')](_0x25f02b['model'],_0x25f02b['query']);_0x1e54e2['attributes']=_[_0x176b('0x3b')](_0x25f02b[_0x176b('0x37')],qs[_0x176b('0x3c')](_0x1d13d4[_0x176b('0x38')]['fields']));_0x1e54e2[_0x176b('0x3d')]=_0x1e54e2[_0x176b('0x3d')][_0x176b('0x3e')]?_0x1e54e2[_0x176b('0x3d')]:_0x25f02b[_0x176b('0x37')];if(!_0x1d13d4[_0x176b('0x38')]['hasOwnProperty'](_0x176b('0x3f'))){_0x1e54e2[_0x176b('0x28')]=qs['limit'](_0x1d13d4[_0x176b('0x38')]['limit']);_0x1e54e2['offset']=qs[_0x176b('0x27')](_0x1d13d4[_0x176b('0x38')][_0x176b('0x27')]);}_0x1e54e2[_0x176b('0x40')]=qs[_0x176b('0x41')](_0x1d13d4[_0x176b('0x38')]['sort']);_0x1e54e2['where']=qs[_0x176b('0x3a')](_[_0x176b('0x42')](_0x1d13d4[_0x176b('0x38')],_0x25f02b[_0x176b('0x3a')]),_0x300c43);if(_0x1d13d4[_0x176b('0x38')][_0x176b('0x43')]){_0x1e54e2['where']=_[_0x176b('0x44')](_0x1e54e2['where'],{'$or':_[_0x176b('0x33')](_0x300c43,function(_0x621340){if(_0x621340[_0x176b('0x36')]!=='VIRTUAL'){var _0x3d68df={};_0x3d68df[_0x621340['name']]={'$like':'%'+_0x1d13d4[_0x176b('0x38')][_0x176b('0x43')]+'%'};return _0x3d68df;}})});}_0x1e54e2=_[_0x176b('0x44')]({},_0x1e54e2,_0x1d13d4[_0x176b('0x45')]);var _0x242f4a={'where':_0x1e54e2['where']};return db[_0x176b('0x34')][_0x176b('0x46')](_0x242f4a)[_0x176b('0x1b')](function(_0x2ad4b2){_0x47782c[_0x176b('0x46')]=_0x2ad4b2;if(_0x1d13d4[_0x176b('0x38')][_0x176b('0x47')]){_0x1e54e2['include']=[{'all':!![]}];}return db[_0x176b('0x34')][_0x176b('0x48')](_0x1e54e2);})[_0x176b('0x1b')](function(_0x44c83b){_0x47782c[_0x176b('0x49')]=_0x44c83b;return _0x47782c;})[_0x176b('0x1b')](respondWithFilteredResult(_0x1647ef,_0x1e54e2))[_0x176b('0x24')](handleError(_0x1647ef,null));};exports[_0x176b('0x4a')]=function(_0x48463f,_0x5ce0ce){var _0x25e086={'raw':![],'where':{'id':_0x48463f[_0x176b('0x4b')]['id']}},_0x7f21b6={};_0x7f21b6['model']=_[_0x176b('0x39')](db[_0x176b('0x34')][_0x176b('0x4c')]);_0x7f21b6[_0x176b('0x38')]=_[_0x176b('0x39')](_0x48463f[_0x176b('0x38')]);_0x7f21b6[_0x176b('0x3a')]=_['intersection'](_0x7f21b6[_0x176b('0x37')],_0x7f21b6[_0x176b('0x38')]);_0x25e086[_0x176b('0x3d')]=_['intersection'](_0x7f21b6[_0x176b('0x37')],qs[_0x176b('0x3c')](_0x48463f['query'][_0x176b('0x3c')]));_0x25e086['attributes']=_0x25e086[_0x176b('0x3d')][_0x176b('0x3e')]?_0x25e086[_0x176b('0x3d')]:_0x7f21b6[_0x176b('0x37')];if(_0x48463f[_0x176b('0x38')]['includeAll']){_0x25e086['include']=[{'all':!![]}];}_0x25e086=_['merge']({},_0x25e086,_0x48463f[_0x176b('0x45')]);return db[_0x176b('0x34')]['find'](_0x25e086)[_0x176b('0x1b')](handleEntityNotFound(_0x5ce0ce,null))[_0x176b('0x1b')](respondWithResult(_0x5ce0ce,null))[_0x176b('0x24')](handleError(_0x5ce0ce,null));};exports[_0x176b('0x4d')]=function(_0x30b863,_0x269567){return db[_0x176b('0x34')][_0x176b('0x4d')](_0x30b863[_0x176b('0x4e')],{})[_0x176b('0x1b')](respondWithResult(_0x269567,0xc9))['catch'](handleError(_0x269567,null));};exports[_0x176b('0x2d')]=function(_0x32ba5d,_0x394fc2){if(_0x32ba5d[_0x176b('0x4e')]['id']){delete _0x32ba5d['body']['id'];}return db[_0x176b('0x34')][_0x176b('0x4f')]({'where':{'id':_0x32ba5d[_0x176b('0x4b')]['id']}})[_0x176b('0x1b')](handleEntityNotFound(_0x394fc2,null))['then'](saveUpdates(_0x32ba5d[_0x176b('0x4e')],null))[_0x176b('0x1b')](respondWithResult(_0x394fc2,null))[_0x176b('0x24')](handleError(_0x394fc2,null));};exports[_0x176b('0x2e')]=function(_0x1d5716,_0x350f6b){return db[_0x176b('0x34')][_0x176b('0x4f')]({'where':{'id':_0x1d5716[_0x176b('0x4b')]['id']}})[_0x176b('0x1b')](handleEntityNotFound(_0x350f6b,null))[_0x176b('0x1b')](removeEntity(_0x350f6b,null))[_0x176b('0x24')](handleError(_0x350f6b,null));};exports[_0x176b('0x50')]=function(_0x480173,_0x1c3013,_0x3e4d6f){var _0x3f81d2={};var _0x4d2750={};var _0x4fed70;var _0x2b7cec;return db[_0x176b('0x34')][_0x176b('0x51')]({'where':{'id':_0x480173[_0x176b('0x4b')]['id']}})[_0x176b('0x1b')](handleEntityNotFound(_0x1c3013,null))[_0x176b('0x1b')](function(_0xdf7dab){if(_0xdf7dab){_0x4fed70=_0xdf7dab;_0x4d2750[_0x176b('0x37')]=_[_0x176b('0x39')](db[_0x176b('0x52')][_0x176b('0x4c')]);_0x4d2750[_0x176b('0x38')]=_[_0x176b('0x39')](_0x480173['query']);_0x4d2750[_0x176b('0x3a')]=_[_0x176b('0x3b')](_0x4d2750[_0x176b('0x37')],_0x4d2750[_0x176b('0x38')]);_0x3f81d2[_0x176b('0x3d')]=_[_0x176b('0x3b')](_0x4d2750[_0x176b('0x37')],qs[_0x176b('0x3c')](_0x480173[_0x176b('0x38')][_0x176b('0x3c')]));_0x3f81d2[_0x176b('0x3d')]=_0x3f81d2['attributes'][_0x176b('0x3e')]?_0x3f81d2[_0x176b('0x3d')]:_0x4d2750['model'];_0x3f81d2['order']=qs[_0x176b('0x41')](_0x480173[_0x176b('0x38')][_0x176b('0x41')]);_0x3f81d2[_0x176b('0x53')]=qs[_0x176b('0x3a')](_[_0x176b('0x42')](_0x480173[_0x176b('0x38')],_0x4d2750['filters']));if(_0x480173['query'][_0x176b('0x43')]){_0x3f81d2[_0x176b('0x53')]=_[_0x176b('0x44')](_0x3f81d2[_0x176b('0x53')],{'$or':_[_0x176b('0x33')](_0x3f81d2['attributes'],function(_0x4d4cc7){var _0xd2c73e={};_0xd2c73e[_0x4d4cc7]={'$like':'%'+_0x480173[_0x176b('0x38')][_0x176b('0x43')]+'%'};return _0xd2c73e;})});}_0x3f81d2=_[_0x176b('0x44')]({},_0x3f81d2,_0x480173[_0x176b('0x45')]);return _0x4fed70[_0x176b('0x50')](_0x3f81d2);}})['then'](function(_0x3e064c){if(_0x3e064c){_0x2b7cec=_0x3e064c[_0x176b('0x3e')];if(!_0x480173['query']['hasOwnProperty'](_0x176b('0x3f'))){_0x3f81d2[_0x176b('0x28')]=qs[_0x176b('0x28')](_0x480173['query'][_0x176b('0x28')]);_0x3f81d2[_0x176b('0x27')]=qs['offset'](_0x480173[_0x176b('0x38')][_0x176b('0x27')]);}return _0x4fed70['getConfigurations'](_0x3f81d2);}})[_0x176b('0x1b')](function(_0x3a5818){if(_0x3a5818){return _0x3a5818?{'count':_0x2b7cec,'rows':_0x3a5818}:null;}})[_0x176b('0x1b')](respondWithResult(_0x1c3013,null))[_0x176b('0x24')](handleError(_0x1c3013,null));};exports[_0x176b('0x54')]=function(_0x4b140f,_0x340c9d,_0x45f239){if(_0x4b140f['body']['id']){delete _0x4b140f[_0x176b('0x4e')]['id'];}return db[_0x176b('0x34')][_0x176b('0x51')]({'where':{'id':_0x4b140f['params']['id']}})['then'](handleEntityNotFound(_0x340c9d,null))[_0x176b('0x1b')](function(_0x380454){if(_0x380454){_0x4b140f[_0x176b('0x4e')]['AccountId']=_0x380454['id'];_0x4b140f['body'][_0x176b('0x55')]=integrations[_0x176b('0x56')](_0x4b140f[_0x176b('0x4e')][_0x176b('0x57')],_0x4b140f['body'][_0x176b('0x36')]);_0x4b140f[_0x176b('0x4e')][_0x176b('0x58')]=integrations[_0x176b('0x59')](_0x4b140f[_0x176b('0x4e')][_0x176b('0x57')],_0x4b140f[_0x176b('0x4e')][_0x176b('0x36')]);return db[_0x176b('0x52')][_0x176b('0x4d')](_0x4b140f[_0x176b('0x4e')],{'include':[{'model':db['SugarcrmField'],'as':_0x176b('0x55')},{'model':db[_0x176b('0x5a')],'as':'Descriptions'}]});}return null;})[_0x176b('0x1b')](respondWithResult(_0x340c9d,null))[_0x176b('0x24')](handleError(_0x340c9d,null));};exports['getFields']=function(_0xf8ce2a,_0xaee87f,_0x8350e8){var _0x19721b='';var _0x5133cc=['id',_0x176b('0x30'),'assigned_user_id',_0x176b('0x5b'),_0x176b('0x5c'),_0x176b('0x5d'),_0x176b('0x5e'),_0x176b('0x5f'),'parent_id',_0x176b('0x60'),_0x176b('0x61'),_0x176b('0x62')];return db[_0x176b('0x34')][_0x176b('0x51')]({'where':{'id':_0xf8ce2a[_0x176b('0x4b')]['id']},'attributes':['id',_0x176b('0x63'),_0x176b('0x64'),'remoteUri']})['then'](handleEntityNotFound(_0xaee87f,null))[_0x176b('0x1b')](function(_0x12f0cb){if(_0x12f0cb){_0x19721b=_0x12f0cb[_0x176b('0x65')];var _0x21687c=_0x19721b[_0x176b('0x66')](-0x1);if(_0x21687c==='/'){_0x19721b=_0x19721b['substring'](0x0,_0x19721b[_0x176b('0x67')](_0x21687c));}return rp({'method':_0x176b('0x68'),'uri':util[_0x176b('0x69')](_0x176b('0x6a'),_0x19721b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x176b('0x6b'),'input_type':_0x176b('0x6c'),'response_type':'JSON','rest_data':JSON[_0x176b('0x1e')]({'user_auth':{'user_name':_0x12f0cb[_0x176b('0x63')],'password':_0x12f0cb[_0x176b('0x64')],'encryption':_0x176b('0x6d')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x176b('0x1b')](function(_0x2aa77e){if(_0x2aa77e&&_0x2aa77e[_0x176b('0x30')]!==_0x176b('0x6e')&&_0x2aa77e['name']!==_0x176b('0x6f')){return rp({'method':_0x176b('0x68'),'uri':util[_0x176b('0x69')](_0x176b('0x6a'),_0x19721b,_0x176b('0x70')),'json':!![],'form':{'method':_0x176b('0x71'),'input_type':_0x176b('0x6c'),'response_type':_0x176b('0x6c'),'rest_data':JSON[_0x176b('0x1e')]({'session':_0x2aa77e['id'],'module_name':_0x176b('0x72')})}})[_0x176b('0x1b')](function(_0x572eb7){if(_0x572eb7){var _0x100e86=_['values'](_0x572eb7[_0x176b('0x73')]);_[_0x176b('0x74')](_0x100e86,function(_0x4c5827){return _0x5133cc[_0x176b('0x75')](_0x4c5827[_0x176b('0x30')]);});return{'count':_0x100e86[_0x176b('0x3e')],'rows':_['map'](_0x100e86,function(_0x1f8335){return{'id':_0x1f8335[_0x176b('0x30')],'name':_0x1f8335[_0x176b('0x76')],'custom':_[_0x176b('0x77')](_0x1f8335['name'],'_c')?!![]:![],'options':_0x1f8335[_0x176b('0x45')]?_[_0x176b('0x33')](_[_0x176b('0x78')](_0x1f8335['options']),function(_0x459471){return{'name':_0x459471['value'],'value':_0x459471[_0x176b('0x30')]};}):[]};})};}})[_0x176b('0x1b')](respondWithResult(_0xaee87f,null))[_0x176b('0x24')](function(_0x344016){var _0x6d0eba=_0xf8ce2a['query']['test']?0x1f4:_0x344016[_0x176b('0x79')]||0x1f4;logger[_0x176b('0x1f')](_0x176b('0x7a'),'getFields',_0x6d0eba,JSON[_0x176b('0x1e')](_0x344016));delete _0x344016['name'];if(_0x6d0eba===0x191){_0x6d0eba=0x190;}_0xaee87f[_0x176b('0x25')](_0x6d0eba)[_0x176b('0x31')](_0xf8ce2a[_0x176b('0x38')][_0x176b('0x7b')]?{'message':_0x176b('0x7c'),'statusCode':_0x344016[_0x176b('0x79')]}:_0x344016);});}else{var _0x587f67=0x1f4;_0xaee87f[_0x176b('0x25')](_0x587f67)[_0x176b('0x31')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 2159861..d83359d 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41ca=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x391e93,_0x51025c){var _0x55ee58=function(_0x130455){while(--_0x130455){_0x391e93['push'](_0x391e93['shift']());}};_0x55ee58(++_0x51025c);}(_0x41ca,0x15e));var _0xa41c=function(_0x587d9d,_0x5016c7){_0x587d9d=_0x587d9d-0x0;var _0x3777e0=_0x41ca[_0x587d9d];return _0x3777e0;};'use strict';var _=require('lodash');var util=require(_0xa41c('0x0'));var logger=require(_0xa41c('0x1'))(_0xa41c('0x2'));var moment=require(_0xa41c('0x3'));var BPromise=require(_0xa41c('0x4'));var rp=require(_0xa41c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa41c('0x6'));var config=require(_0xa41c('0x7'));var attributes=require(_0xa41c('0x8'));var integrations=require(_0xa41c('0x9'));module[_0xa41c('0xa')]=function(_0x55714c,_0x444d55){return _0x55714c[_0xa41c('0xb')](_0xa41c('0xc'),attributes,{'tableName':_0xa41c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb477=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','util'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xb477,0x8f));var _0x7b47=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xb477[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0x7b47('0x0'));var logger=require(_0x7b47('0x1'))(_0x7b47('0x2'));var moment=require('moment');var BPromise=require(_0x7b47('0x3'));var rp=require(_0x7b47('0x4'));var fs=require('fs');var path=require(_0x7b47('0x5'));var rimraf=require('rimraf');var config=require(_0x7b47('0x6'));var attributes=require(_0x7b47('0x7'));var integrations=require(_0x7b47('0x8'));module[_0x7b47('0x9')]=function(_0x45fb67,_0x48e1fc){return _0x45fb67[_0x7b47('0xa')](_0x7b47('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 4745f81..17d94a7 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9085=['map','include','model','attributes','ShowSugarcrmAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit'];(function(_0x1139be,_0x520a59){var _0x5c6e4c=function(_0x1eda84){while(--_0x1eda84){_0x1139be['push'](_0x1139be['shift']());}};_0x5c6e4c(++_0x520a59);}(_0x9085,0x1b2));var _0x5908=function(_0xe3f0b0,_0x43edc9){_0xe3f0b0=_0xe3f0b0-0x0;var _0x3a839e=_0x9085[_0xe3f0b0];return _0x3a839e;};'use strict';var _=require(_0x5908('0x0'));var util=require(_0x5908('0x1'));var moment=require(_0x5908('0x2'));var BPromise=require(_0x5908('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5908('0x4'))['db'];var utils=require(_0x5908('0x5'));var logger=require(_0x5908('0x6'))('rpc');var config=require(_0x5908('0x7'));var jayson=require(_0x5908('0x8'));var client=jayson['client'][_0x5908('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe080c7,_0xcdb379,_0x27b01d){return new BPromise(function(_0x5d6713,_0x534af4){return client[_0x5908('0xa')](_0xe080c7,_0x27b01d)[_0x5908('0xb')](function(_0x138d0e){logger[_0x5908('0xc')](_0x5908('0xd'),_0xcdb379,'request\x20sent');logger[_0x5908('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xcdb379,_0x5908('0xf'),JSON[_0x5908('0x10')](_0x138d0e));if(_0x138d0e[_0x5908('0x11')]){if(_0x138d0e[_0x5908('0x11')][_0x5908('0x12')]===0x1f4){logger['error'](_0x5908('0xd'),_0xcdb379,_0x138d0e[_0x5908('0x11')][_0x5908('0x13')]);return _0x534af4(_0x138d0e[_0x5908('0x11')][_0x5908('0x13')]);}logger[_0x5908('0x11')](_0x5908('0xd'),_0xcdb379,_0x138d0e[_0x5908('0x11')][_0x5908('0x13')]);return _0x5d6713(_0x138d0e[_0x5908('0x11')][_0x5908('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0xcdb379,_0x5908('0xf'));_0x5d6713(_0x138d0e['result'][_0x5908('0x13')]);}})[_0x5908('0x14')](function(_0xce66a0){logger[_0x5908('0x11')](_0x5908('0xd'),_0xcdb379,_0xce66a0);_0x534af4(_0xce66a0);});});}exports[_0x5908('0x15')]=function(_0x2a4ead){var _0x57d023=this;return new Promise(function(_0x2d0b87,_0x18cacd){return db[_0x5908('0x16')][_0x5908('0x17')]({'raw':_0x2a4ead[_0x5908('0x18')]?_0x2a4ead['options'][_0x5908('0x19')]===undefined?!![]:![]:!![],'where':_0x2a4ead[_0x5908('0x18')]?_0x2a4ead['options'][_0x5908('0x1a')]||null:null,'attributes':_0x2a4ead[_0x5908('0x18')]?_0x2a4ead[_0x5908('0x18')]['attributes']||null:null,'limit':_0x2a4ead['options']?_0x2a4ead[_0x5908('0x18')][_0x5908('0x1b')]||null:null,'include':_0x2a4ead[_0x5908('0x18')]?_0x2a4ead[_0x5908('0x18')]['include']?_[_0x5908('0x1c')](_0x2a4ead['options'][_0x5908('0x1d')],function(_0x593a39){return{'model':db[_0x593a39[_0x5908('0x1e')]],'as':_0x593a39['as'],'attributes':_0x593a39[_0x5908('0x1f')],'include':_0x593a39[_0x5908('0x1d')]?_['map'](_0x593a39[_0x5908('0x1d')],function(_0x2e2b0b){return{'model':db[_0x2e2b0b[_0x5908('0x1e')]],'as':_0x2e2b0b['as'],'attributes':_0x2e2b0b[_0x5908('0x1f')],'include':_0x2e2b0b['include']?_[_0x5908('0x1c')](_0x2e2b0b['include'],function(_0x4ce8e1){return{'model':db[_0x4ce8e1[_0x5908('0x1e')]],'as':_0x4ce8e1['as'],'attributes':_0x4ce8e1[_0x5908('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5908('0xb')](function(_0x11eef5){logger[_0x5908('0xc')](_0x5908('0x15'),_0x2a4ead);logger[_0x5908('0xe')](_0x5908('0x15'),_0x2a4ead,JSON['stringify'](_0x11eef5));_0x2d0b87(_0x11eef5);})['catch'](function(_0x1205a0){logger[_0x5908('0x11')](_0x5908('0x15'),_0x1205a0['message'],_0x2a4ead);_0x18cacd(_0x57d023[_0x5908('0x11')](0x1f4,_0x1205a0['message']));});});};exports['ShowSugarcrmAccount']=function(_0x29165d){var _0x2e50a3=this;return new Promise(function(_0xa85606,_0x45ff3b){return db[_0x5908('0x16')]['find']({'raw':_0x29165d[_0x5908('0x18')]?_0x29165d[_0x5908('0x18')][_0x5908('0x19')]===undefined?!![]:![]:!![],'where':_0x29165d[_0x5908('0x18')]?_0x29165d[_0x5908('0x18')][_0x5908('0x1a')]||null:null,'attributes':_0x29165d['options']?_0x29165d['options']['attributes']||null:null,'include':_0x29165d['options']?_0x29165d['options'][_0x5908('0x1d')]?_[_0x5908('0x1c')](_0x29165d[_0x5908('0x18')][_0x5908('0x1d')],function(_0x3f4045){return{'model':db[_0x3f4045[_0x5908('0x1e')]],'as':_0x3f4045['as'],'attributes':_0x3f4045['attributes'],'include':_0x3f4045['include']?_[_0x5908('0x1c')](_0x3f4045[_0x5908('0x1d')],function(_0x1a60b3){return{'model':db[_0x1a60b3[_0x5908('0x1e')]],'as':_0x1a60b3['as'],'attributes':_0x1a60b3['attributes'],'include':_0x1a60b3[_0x5908('0x1d')]?_[_0x5908('0x1c')](_0x1a60b3[_0x5908('0x1d')],function(_0x3c0cf4){return{'model':db[_0x3c0cf4[_0x5908('0x1e')]],'as':_0x3c0cf4['as'],'attributes':_0x3c0cf4[_0x5908('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc607a3){logger[_0x5908('0xc')](_0x5908('0x20'),_0x29165d);logger['debug'](_0x5908('0x20'),_0x29165d,JSON[_0x5908('0x10')](_0xc607a3));_0xa85606(_0xc607a3);})[_0x5908('0x14')](function(_0x457587){logger[_0x5908('0x11')]('ShowSugarcrmAccount',_0x457587[_0x5908('0x13')],_0x29165d);_0x45ff3b(_0x2e50a3[_0x5908('0x11')](0x1f4,_0x457587[_0x5908('0x13')]));});});}; \ No newline at end of file +var _0x4a45=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','limit','map','include','model','attributes','stringify','ShowSugarcrmAccount'];(function(_0x407557,_0x21df64){var _0x309528=function(_0xb414d3){while(--_0xb414d3){_0x407557['push'](_0x407557['shift']());}};_0x309528(++_0x21df64);}(_0x4a45,0x1f0));var _0x54a4=function(_0x4a0163,_0x285cae){_0x4a0163=_0x4a0163-0x0;var _0x4e8b03=_0x4a45[_0x4a0163];return _0x4e8b03;};'use strict';var _=require(_0x54a4('0x0'));var util=require(_0x54a4('0x1'));var moment=require(_0x54a4('0x2'));var BPromise=require(_0x54a4('0x3'));var rs=require(_0x54a4('0x4'));var fs=require('fs');var Redis=require(_0x54a4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x54a4('0x6'));var logger=require('../../config/logger')(_0x54a4('0x7'));var config=require('../../config/environment');var jayson=require(_0x54a4('0x8'));var client=jayson['client'][_0x54a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d05a5,_0x5bb10a,_0x1f0e2a){return new BPromise(function(_0x162614,_0x2418d8){return client['request'](_0x3d05a5,_0x1f0e2a)[_0x54a4('0xa')](function(_0x3c2f17){logger[_0x54a4('0xb')](_0x54a4('0xc'),_0x5bb10a,_0x54a4('0xd'));logger[_0x54a4('0xe')](_0x54a4('0xf'),_0x5bb10a,'request\x20sent',JSON['stringify'](_0x3c2f17));if(_0x3c2f17[_0x54a4('0x10')]){if(_0x3c2f17[_0x54a4('0x10')][_0x54a4('0x11')]===0x1f4){logger[_0x54a4('0x10')](_0x54a4('0xc'),_0x5bb10a,_0x3c2f17[_0x54a4('0x10')]['message']);return _0x2418d8(_0x3c2f17[_0x54a4('0x10')][_0x54a4('0x12')]);}logger[_0x54a4('0x10')](_0x54a4('0xc'),_0x5bb10a,_0x3c2f17[_0x54a4('0x10')]['message']);return _0x162614(_0x3c2f17[_0x54a4('0x10')][_0x54a4('0x12')]);}else{logger[_0x54a4('0xb')](_0x54a4('0xc'),_0x5bb10a,_0x54a4('0xd'));_0x162614(_0x3c2f17[_0x54a4('0x13')][_0x54a4('0x12')]);}})[_0x54a4('0x14')](function(_0x56dad1){logger[_0x54a4('0x10')](_0x54a4('0xc'),_0x5bb10a,_0x56dad1);_0x2418d8(_0x56dad1);});});}exports[_0x54a4('0x15')]=function(_0x5534df){var _0x15e2e3=this;return new Promise(function(_0xc3d8b,_0x4fa88d){return db[_0x54a4('0x16')]['findAll']({'raw':_0x5534df[_0x54a4('0x17')]?_0x5534df[_0x54a4('0x17')][_0x54a4('0x18')]===undefined?!![]:![]:!![],'where':_0x5534df[_0x54a4('0x17')]?_0x5534df[_0x54a4('0x17')]['where']||null:null,'attributes':_0x5534df[_0x54a4('0x17')]?_0x5534df[_0x54a4('0x17')]['attributes']||null:null,'limit':_0x5534df[_0x54a4('0x17')]?_0x5534df['options'][_0x54a4('0x19')]||null:null,'include':_0x5534df[_0x54a4('0x17')]?_0x5534df[_0x54a4('0x17')]['include']?_[_0x54a4('0x1a')](_0x5534df[_0x54a4('0x17')][_0x54a4('0x1b')],function(_0x1d8f30){return{'model':db[_0x1d8f30[_0x54a4('0x1c')]],'as':_0x1d8f30['as'],'attributes':_0x1d8f30[_0x54a4('0x1d')],'include':_0x1d8f30[_0x54a4('0x1b')]?_[_0x54a4('0x1a')](_0x1d8f30[_0x54a4('0x1b')],function(_0xcab016){return{'model':db[_0xcab016[_0x54a4('0x1c')]],'as':_0xcab016['as'],'attributes':_0xcab016[_0x54a4('0x1d')],'include':_0xcab016['include']?_[_0x54a4('0x1a')](_0xcab016[_0x54a4('0x1b')],function(_0x34b8a5){return{'model':db[_0x34b8a5['model']],'as':_0x34b8a5['as'],'attributes':_0x34b8a5['attributes']};}):[]};}):[]};}):[]:[]})[_0x54a4('0xa')](function(_0x4ac148){logger['info'](_0x54a4('0x15'),_0x5534df);logger[_0x54a4('0xe')](_0x54a4('0x15'),_0x5534df,JSON[_0x54a4('0x1e')](_0x4ac148));_0xc3d8b(_0x4ac148);})[_0x54a4('0x14')](function(_0x468974){logger[_0x54a4('0x10')](_0x54a4('0x15'),_0x468974[_0x54a4('0x12')],_0x5534df);_0x4fa88d(_0x15e2e3[_0x54a4('0x10')](0x1f4,_0x468974['message']));});});};exports[_0x54a4('0x1f')]=function(_0x5e2c01){var _0x324eba=this;return new Promise(function(_0x38558c,_0x4e0e78){return db[_0x54a4('0x16')][_0x54a4('0x20')]({'raw':_0x5e2c01[_0x54a4('0x17')]?_0x5e2c01['options'][_0x54a4('0x18')]===undefined?!![]:![]:!![],'where':_0x5e2c01[_0x54a4('0x17')]?_0x5e2c01[_0x54a4('0x17')]['where']||null:null,'attributes':_0x5e2c01[_0x54a4('0x17')]?_0x5e2c01[_0x54a4('0x17')][_0x54a4('0x1d')]||null:null,'include':_0x5e2c01[_0x54a4('0x17')]?_0x5e2c01[_0x54a4('0x17')][_0x54a4('0x1b')]?_['map'](_0x5e2c01[_0x54a4('0x17')][_0x54a4('0x1b')],function(_0x4705ed){return{'model':db[_0x4705ed[_0x54a4('0x1c')]],'as':_0x4705ed['as'],'attributes':_0x4705ed['attributes'],'include':_0x4705ed[_0x54a4('0x1b')]?_[_0x54a4('0x1a')](_0x4705ed[_0x54a4('0x1b')],function(_0x4eefed){return{'model':db[_0x4eefed['model']],'as':_0x4eefed['as'],'attributes':_0x4eefed[_0x54a4('0x1d')],'include':_0x4eefed[_0x54a4('0x1b')]?_['map'](_0x4eefed[_0x54a4('0x1b')],function(_0x4669f3){return{'model':db[_0x4669f3[_0x54a4('0x1c')]],'as':_0x4669f3['as'],'attributes':_0x4669f3[_0x54a4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x54a4('0xa')](function(_0x13fb3a){logger['info'](_0x54a4('0x1f'),_0x5e2c01);logger['debug'](_0x54a4('0x1f'),_0x5e2c01,JSON['stringify'](_0x13fb3a));_0x38558c(_0x13fb3a);})[_0x54a4('0x14')](function(_0x5acaa5){logger[_0x54a4('0x10')](_0x54a4('0x1f'),_0x5acaa5[_0x54a4('0x12')],_0x5e2c01);_0x4e0e78(_0x324eba[_0x54a4('0x10')](0x1f4,_0x5acaa5[_0x54a4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 00690e1..4a14d79 100644 --- a/server/api/intSugarcrmConfiguration/index.js +++ b/server/api/intSugarcrmConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b55=['index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x3b55,0x86));var _0x53b5=function(_0x35c97a,_0x513aba){_0x35c97a=_0x35c97a-0x0;var _0x388917=_0x3b55[_0x35c97a];return _0x388917;};'use strict';var multer=require('multer');var util=require(_0x53b5('0x0'));var path=require(_0x53b5('0x1'));var timeout=require(_0x53b5('0x2'));var express=require(_0x53b5('0x3'));var router=express[_0x53b5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x53b5('0x5'));var config=require(_0x53b5('0x6'));var controller=require(_0x53b5('0x7'));router[_0x53b5('0x8')]('/',auth[_0x53b5('0x9')](),controller[_0x53b5('0xa')]);router[_0x53b5('0x8')](_0x53b5('0xb'),auth['isAuthenticated'](),controller[_0x53b5('0xc')]);router[_0x53b5('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x53b5('0xd')]);router['get'](_0x53b5('0xe'),auth['isAuthenticated'](),controller[_0x53b5('0xf')]);router[_0x53b5('0x8')](_0x53b5('0x10'),auth['isAuthenticated'](),controller[_0x53b5('0x11')]);router[_0x53b5('0x12')]('/',auth[_0x53b5('0x9')](),controller[_0x53b5('0x13')]);router[_0x53b5('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x53b5('0x15')]);router['delete'](_0x53b5('0xb'),auth[_0x53b5('0x9')](),controller[_0x53b5('0x16')]);module[_0x53b5('0x17')]=router; \ No newline at end of file +var _0x6f5a=['index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0x6f5a,0x76));var _0xa6f5=function(_0x4fbbf6,_0x286b69){_0x4fbbf6=_0x4fbbf6-0x0;var _0x113411=_0x6f5a[_0x4fbbf6];return _0x113411;};'use strict';var multer=require('multer');var util=require(_0xa6f5('0x0'));var path=require(_0xa6f5('0x1'));var timeout=require(_0xa6f5('0x2'));var express=require('express');var router=express[_0xa6f5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa6f5('0x4'));var config=require(_0xa6f5('0x5'));var controller=require(_0xa6f5('0x6'));router[_0xa6f5('0x7')]('/',auth['isAuthenticated'](),controller[_0xa6f5('0x8')]);router[_0xa6f5('0x7')](_0xa6f5('0x9'),auth[_0xa6f5('0xa')](),controller[_0xa6f5('0xb')]);router['get'](_0xa6f5('0xc'),auth[_0xa6f5('0xa')](),controller[_0xa6f5('0xd')]);router[_0xa6f5('0x7')]('/:id/subjects',auth[_0xa6f5('0xa')](),controller[_0xa6f5('0xe')]);router['get'](_0xa6f5('0xf'),auth['isAuthenticated'](),controller[_0xa6f5('0x10')]);router[_0xa6f5('0x11')]('/',auth[_0xa6f5('0xa')](),controller['create']);router['put']('/:id',auth[_0xa6f5('0xa')](),controller['update']);router[_0xa6f5('0x12')](_0xa6f5('0x9'),auth[_0xa6f5('0xa')](),controller[_0xa6f5('0x13')]);module[_0xa6f5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 46e7042..d10e6ac 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50ae=['sequelize','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x50ae,0x1bc));var _0xe50a=function(_0x33817d,_0x47216d){_0x33817d=_0x33817d-0x0;var _0x5f3057=_0x50ae[_0x33817d];return _0x5f3057;};'use strict';var Sequelize=require(_0xe50a('0x0'));module['exports']={'name':{'type':Sequelize[_0xe50a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4ea5=['exports','STRING','sequelize'];(function(_0x450807,_0x366f79){var _0x248e14=function(_0x174f64){while(--_0x174f64){_0x450807['push'](_0x450807['shift']());}};_0x248e14(++_0x366f79);}(_0x4ea5,0x131));var _0x54ea=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0x4ea5[_0x5275b8];return _0x568a9b;};'use strict';var Sequelize=require(_0x54ea('0x0'));module[_0x54ea('0x1')]={'name':{'type':Sequelize[_0x54ea('0x2')]},'description':{'type':Sequelize[_0x54ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a8f1a10..8a12f89 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7300=['filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','params','options','find','create','body','getFields','findOne','SugarcrmField','order','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','offset','limit','Content-Range','json','apply','save','update','destroy','end','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7300,0x1ca));var _0x0730=function(_0x46fe45,_0x21de9b){_0x46fe45=_0x46fe45-0x0;var _0x40268b=_0x7300[_0x46fe45];return _0x40268b;};'use strict';var pdf=require(_0x0730('0x0'));var emlformat=require(_0x0730('0x1'));var rimraf=require(_0x0730('0x2'));var zipdir=require(_0x0730('0x3'));var jsonpatch=require(_0x0730('0x4'));var rp=require(_0x0730('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0730('0x6'));var util=require('util');var path=require(_0x0730('0x7'));var sox=require('sox');var csv=require(_0x0730('0x8'));var ejs=require(_0x0730('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0730('0xa'));var crypto=require(_0x0730('0xb'));var jsforce=require(_0x0730('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0730('0x8'));var querystring=require(_0x0730('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0730('0xe'));var as=require(_0x0730('0xf'));var hardwareService=require(_0x0730('0x10'));var logger=require(_0x0730('0x11'))('api');var utils=require(_0x0730('0x12'));var config=require(_0x0730('0x13'));var licenseUtil=require(_0x0730('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x0730('0x15')][_0x0730('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x25da07,_0x3842dc,_0x1f7d89,_0xbfb0d9){return new BPromise(function(_0x2f40ef,_0x4550a5){var _0x2000c9=_0xbfb0d9||client;return _0x2000c9['request'](_0x25da07,_0x1f7d89)[_0x0730('0x17')](function(_0x2e4bae){logger[_0x0730('0x18')](_0x0730('0x19'),_0x3842dc,_0x0730('0x1a'));logger[_0x0730('0x1b')](_0x0730('0x1c'),_0x3842dc,'request\x20sent',JSON[_0x0730('0x1d')](_0x2e4bae));if(_0x2e4bae[_0x0730('0x1e')]){if(_0x2e4bae[_0x0730('0x1e')]['code']===0x1f4){logger[_0x0730('0x1e')](_0x0730('0x19'),_0x3842dc,_0x2e4bae[_0x0730('0x1e')][_0x0730('0x1f')]);return _0x4550a5(_0x2e4bae['error']['message']);}logger[_0x0730('0x1e')](_0x0730('0x19'),_0x3842dc,_0x2e4bae[_0x0730('0x1e')][_0x0730('0x1f')]);return _0x2f40ef(_0x2e4bae[_0x0730('0x1e')][_0x0730('0x1f')]);}else{logger['info'](_0x0730('0x19'),_0x3842dc,_0x0730('0x1a'));_0x2f40ef(_0x2e4bae[_0x0730('0x20')][_0x0730('0x1f')]);}})[_0x0730('0x21')](function(_0x3a7bf5){logger['error'](_0x0730('0x19'),_0x3842dc,_0x3a7bf5);_0x4550a5(_0x3a7bf5);});});}function respondWithStatusCode(_0x1d0050,_0x1b2deb){_0x1b2deb=_0x1b2deb||0xcc;return function(_0x383e46){if(_0x383e46){return _0x1d0050['sendStatus'](_0x1b2deb);}return _0x1d0050[_0x0730('0x22')](_0x1b2deb)['end']();};}function respondWithResult(_0xcaac0e,_0x4ea2cd){_0x4ea2cd=_0x4ea2cd||0xc8;return function(_0x322bea){if(_0x322bea){return _0xcaac0e['status'](_0x4ea2cd)['json'](_0x322bea);}};}function respondWithFilteredResult(_0x32f59f,_0x49e9f7){return function(_0x146f7a){if(_0x146f7a){var _0x44ceaf=_0x146f7a['count'],_0x1ae4f5=_0x49e9f7[_0x0730('0x23')],_0x503325=_0x49e9f7['offset']+_0x49e9f7[_0x0730('0x24')],_0x2bcdfc;if(_0x503325>=_0x44ceaf){_0x503325=_0x44ceaf;_0x2bcdfc=0xc8;}else{_0x2bcdfc=0xce;}_0x32f59f[_0x0730('0x22')](_0x2bcdfc);return _0x32f59f['set'](_0x0730('0x25'),_0x1ae4f5+'-'+_0x503325+'/'+_0x44ceaf)[_0x0730('0x26')](_0x146f7a);}return null;};}function patchUpdates(_0x4c9a8f){return function(_0x21afa0){try{jsonpatch[_0x0730('0x27')](_0x21afa0,_0x4c9a8f,!![]);}catch(_0x5af9cf){return BPromise['reject'](_0x5af9cf);}return _0x21afa0[_0x0730('0x28')]();};}function saveUpdates(_0x49ed0f,_0x5d8f44){return function(_0x2c26f1){if(_0x2c26f1){return _0x2c26f1[_0x0730('0x29')](_0x49ed0f)['then'](function(_0x2b8fa6){return _0x2b8fa6;});}return null;};}function removeEntity(_0x1d3df6,_0x2eb445){return function(_0x196e4c){if(_0x196e4c){return _0x196e4c[_0x0730('0x2a')]()['then'](function(){_0x1d3df6[_0x0730('0x22')](0xcc)[_0x0730('0x2b')]();});}};}function handleEntityNotFound(_0x2512b3,_0x3cf5d7){return function(_0x612b0a){if(!_0x612b0a){_0x2512b3[_0x0730('0x2c')](0x194);}return _0x612b0a;};}function handleError(_0x3e5504,_0x3f5843){_0x3f5843=_0x3f5843||0x1f4;return function(_0x39ee3c){logger[_0x0730('0x1e')](_0x39ee3c[_0x0730('0x2d')]);if(_0x39ee3c[_0x0730('0x2e')]){delete _0x39ee3c[_0x0730('0x2e')];}_0x3e5504['status'](_0x3f5843)[_0x0730('0x2f')](_0x39ee3c);};}exports[_0x0730('0x30')]=function(_0x2686e9,_0x1747be){var _0x4c0653={},_0x413a41={},_0x5ca1ef={'count':0x0,'rows':[]};var _0x2f4d4b=_[_0x0730('0x31')](db[_0x0730('0x32')][_0x0730('0x33')],function(_0x5945d0){return{'name':_0x5945d0[_0x0730('0x34')],'type':_0x5945d0[_0x0730('0x35')][_0x0730('0x36')]};});_0x413a41[_0x0730('0x37')]=_[_0x0730('0x31')](_0x2f4d4b,_0x0730('0x2e'));_0x413a41[_0x0730('0x38')]=_[_0x0730('0x39')](_0x2686e9[_0x0730('0x38')]);_0x413a41[_0x0730('0x3a')]=_['intersection'](_0x413a41[_0x0730('0x37')],_0x413a41[_0x0730('0x38')]);_0x4c0653['attributes']=_[_0x0730('0x3b')](_0x413a41[_0x0730('0x37')],qs[_0x0730('0x3c')](_0x2686e9[_0x0730('0x38')][_0x0730('0x3c')]));_0x4c0653[_0x0730('0x3d')]=_0x4c0653[_0x0730('0x3d')][_0x0730('0x3e')]?_0x4c0653[_0x0730('0x3d')]:_0x413a41[_0x0730('0x37')];if(!_0x2686e9[_0x0730('0x38')][_0x0730('0x3f')]('nolimit')){_0x4c0653[_0x0730('0x24')]=qs[_0x0730('0x24')](_0x2686e9['query']['limit']);_0x4c0653[_0x0730('0x23')]=qs['offset'](_0x2686e9['query'][_0x0730('0x23')]);}_0x4c0653['order']=qs[_0x0730('0x40')](_0x2686e9[_0x0730('0x38')][_0x0730('0x40')]);_0x4c0653[_0x0730('0x41')]=qs['filters'](_[_0x0730('0x42')](_0x2686e9[_0x0730('0x38')],_0x413a41[_0x0730('0x3a')]),_0x2f4d4b);if(_0x2686e9[_0x0730('0x38')][_0x0730('0x43')]){_0x4c0653[_0x0730('0x41')]=_[_0x0730('0x44')](_0x4c0653[_0x0730('0x41')],{'$or':_[_0x0730('0x31')](_0x2f4d4b,function(_0x4644a8){if(_0x4644a8[_0x0730('0x35')]!=='VIRTUAL'){var _0x135a0={};_0x135a0[_0x4644a8[_0x0730('0x2e')]]={'$like':'%'+_0x2686e9[_0x0730('0x38')][_0x0730('0x43')]+'%'};return _0x135a0;}})});}_0x4c0653=_[_0x0730('0x44')]({},_0x4c0653,_0x2686e9['options']);var _0x36582c={'where':_0x4c0653['where']};return db[_0x0730('0x32')][_0x0730('0x45')](_0x36582c)[_0x0730('0x17')](function(_0x48b6c5){_0x5ca1ef['count']=_0x48b6c5;if(_0x2686e9['query'][_0x0730('0x46')]){_0x4c0653[_0x0730('0x47')]=[{'all':!![]}];}return db[_0x0730('0x32')][_0x0730('0x48')](_0x4c0653);})['then'](function(_0x2ef1cd){_0x5ca1ef[_0x0730('0x49')]=_0x2ef1cd;return _0x5ca1ef;})[_0x0730('0x17')](respondWithFilteredResult(_0x1747be,_0x4c0653))[_0x0730('0x21')](handleError(_0x1747be,null));};exports['show']=function(_0x266aac,_0x5aafe1){var _0x4266ac={'raw':![],'where':{'id':_0x266aac[_0x0730('0x4a')]['id']}},_0x5cbccb={};_0x5cbccb[_0x0730('0x37')]=_[_0x0730('0x39')](db[_0x0730('0x32')][_0x0730('0x33')]);_0x5cbccb[_0x0730('0x38')]=_['keys'](_0x266aac['query']);_0x5cbccb[_0x0730('0x3a')]=_[_0x0730('0x3b')](_0x5cbccb[_0x0730('0x37')],_0x5cbccb['query']);_0x4266ac[_0x0730('0x3d')]=_[_0x0730('0x3b')](_0x5cbccb['model'],qs[_0x0730('0x3c')](_0x266aac[_0x0730('0x38')][_0x0730('0x3c')]));_0x4266ac['attributes']=_0x4266ac[_0x0730('0x3d')][_0x0730('0x3e')]?_0x4266ac[_0x0730('0x3d')]:_0x5cbccb[_0x0730('0x37')];if(_0x266aac['query'][_0x0730('0x46')]){_0x4266ac['include']=[{'all':!![]}];}_0x4266ac=_[_0x0730('0x44')]({},_0x4266ac,_0x266aac[_0x0730('0x4b')]);return db[_0x0730('0x32')][_0x0730('0x4c')](_0x4266ac)[_0x0730('0x17')](handleEntityNotFound(_0x5aafe1,null))[_0x0730('0x17')](respondWithResult(_0x5aafe1,null))['catch'](handleError(_0x5aafe1,null));};exports[_0x0730('0x4d')]=function(_0x2d1b96,_0x4a184d){return db[_0x0730('0x32')][_0x0730('0x4d')](_0x2d1b96[_0x0730('0x4e')],{})[_0x0730('0x17')](respondWithResult(_0x4a184d,0xc9))[_0x0730('0x21')](handleError(_0x4a184d,null));};exports[_0x0730('0x29')]=function(_0x405e38,_0x13b938){if(_0x405e38[_0x0730('0x4e')]['id']){delete _0x405e38[_0x0730('0x4e')]['id'];}return db[_0x0730('0x32')][_0x0730('0x4c')]({'where':{'id':_0x405e38[_0x0730('0x4a')]['id']}})[_0x0730('0x17')](handleEntityNotFound(_0x13b938,null))[_0x0730('0x17')](saveUpdates(_0x405e38[_0x0730('0x4e')],null))[_0x0730('0x17')](respondWithResult(_0x13b938,null))[_0x0730('0x21')](handleError(_0x13b938,null));};exports[_0x0730('0x2a')]=function(_0x249dd5,_0x1cf979){return db[_0x0730('0x32')]['find']({'where':{'id':_0x249dd5[_0x0730('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1cf979,null))[_0x0730('0x17')](removeEntity(_0x1cf979,null))[_0x0730('0x21')](handleError(_0x1cf979,null));};exports[_0x0730('0x4f')]=function(_0x3c5cff,_0x2bd310,_0x143f04){var _0x556a4b={};var _0x52585d={};var _0x4c214c;var _0x281259;return db[_0x0730('0x32')][_0x0730('0x50')]({'where':{'id':_0x3c5cff[_0x0730('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2bd310,null))[_0x0730('0x17')](function(_0x4cabd2){if(_0x4cabd2){_0x4c214c=_0x4cabd2;_0x52585d['model']=_[_0x0730('0x39')](db[_0x0730('0x51')][_0x0730('0x33')]);_0x52585d[_0x0730('0x38')]=_[_0x0730('0x39')](_0x3c5cff[_0x0730('0x38')]);_0x52585d[_0x0730('0x3a')]=_['intersection'](_0x52585d[_0x0730('0x37')],_0x52585d[_0x0730('0x38')]);_0x556a4b['attributes']=_['intersection'](_0x52585d[_0x0730('0x37')],qs['fields'](_0x3c5cff[_0x0730('0x38')][_0x0730('0x3c')]));_0x556a4b[_0x0730('0x3d')]=_0x556a4b[_0x0730('0x3d')]['length']?_0x556a4b[_0x0730('0x3d')]:_0x52585d['model'];_0x556a4b[_0x0730('0x52')]=qs[_0x0730('0x40')](_0x3c5cff[_0x0730('0x38')][_0x0730('0x40')]);_0x556a4b[_0x0730('0x41')]=qs['filters'](_[_0x0730('0x42')](_0x3c5cff[_0x0730('0x38')],_0x52585d[_0x0730('0x3a')]));if(_0x3c5cff[_0x0730('0x38')][_0x0730('0x43')]){_0x556a4b[_0x0730('0x41')]=_[_0x0730('0x44')](_0x556a4b[_0x0730('0x41')],{'$or':_['map'](_0x556a4b[_0x0730('0x3d')],function(_0x591804){var _0x3a7f88={};_0x3a7f88[_0x591804]={'$like':'%'+_0x3c5cff[_0x0730('0x38')][_0x0730('0x43')]+'%'};return _0x3a7f88;})});}_0x556a4b=_[_0x0730('0x44')]({},_0x556a4b,_0x3c5cff[_0x0730('0x4b')]);return _0x4c214c[_0x0730('0x4f')](_0x556a4b);}})[_0x0730('0x17')](function(_0x2249ac){if(_0x2249ac){_0x281259=_0x2249ac['length'];if(!_0x3c5cff[_0x0730('0x38')][_0x0730('0x3f')](_0x0730('0x53'))){_0x556a4b[_0x0730('0x24')]=qs[_0x0730('0x24')](_0x3c5cff[_0x0730('0x38')][_0x0730('0x24')]);_0x556a4b[_0x0730('0x23')]=qs[_0x0730('0x23')](_0x3c5cff['query'][_0x0730('0x23')]);}return _0x4c214c[_0x0730('0x4f')](_0x556a4b);}})[_0x0730('0x17')](function(_0x2abfea){if(_0x2abfea){return _0x2abfea?{'count':_0x281259,'rows':_0x2abfea}:null;}})[_0x0730('0x17')](respondWithResult(_0x2bd310,null))['catch'](handleError(_0x2bd310,null));};exports['getSubjects']=function(_0x491849,_0x94bffd,_0xbbdd8d){var _0x171b73={};var _0x25118c={};var _0x32986a;var _0x202616;return db[_0x0730('0x32')][_0x0730('0x50')]({'where':{'id':_0x491849['params']['id']}})[_0x0730('0x17')](handleEntityNotFound(_0x94bffd,null))[_0x0730('0x17')](function(_0xbbc20f){if(_0xbbc20f){_0x32986a=_0xbbc20f;_0x25118c[_0x0730('0x37')]=_[_0x0730('0x39')](db[_0x0730('0x51')][_0x0730('0x33')]);_0x25118c[_0x0730('0x38')]=_['keys'](_0x491849[_0x0730('0x38')]);_0x25118c['filters']=_[_0x0730('0x3b')](_0x25118c[_0x0730('0x37')],_0x25118c[_0x0730('0x38')]);_0x171b73[_0x0730('0x3d')]=_[_0x0730('0x3b')](_0x25118c[_0x0730('0x37')],qs[_0x0730('0x3c')](_0x491849[_0x0730('0x38')][_0x0730('0x3c')]));_0x171b73[_0x0730('0x3d')]=_0x171b73[_0x0730('0x3d')][_0x0730('0x3e')]?_0x171b73[_0x0730('0x3d')]:_0x25118c['model'];_0x171b73['order']=qs[_0x0730('0x40')](_0x491849[_0x0730('0x38')][_0x0730('0x40')]);_0x171b73[_0x0730('0x41')]=qs[_0x0730('0x3a')](_[_0x0730('0x42')](_0x491849[_0x0730('0x38')],_0x25118c[_0x0730('0x3a')]));if(_0x491849['query'][_0x0730('0x43')]){_0x171b73[_0x0730('0x41')]=_['merge'](_0x171b73['where'],{'$or':_[_0x0730('0x31')](_0x171b73[_0x0730('0x3d')],function(_0x1c0b17){var _0x3a6f88={};_0x3a6f88[_0x1c0b17]={'$like':'%'+_0x491849[_0x0730('0x38')][_0x0730('0x43')]+'%'};return _0x3a6f88;})});}_0x171b73=_[_0x0730('0x44')]({},_0x171b73,_0x491849[_0x0730('0x4b')]);return _0x32986a[_0x0730('0x54')](_0x171b73);}})[_0x0730('0x17')](function(_0xe99241){if(_0xe99241){_0x202616=_0xe99241[_0x0730('0x3e')];if(!_0x491849[_0x0730('0x38')]['hasOwnProperty'](_0x0730('0x53'))){_0x171b73[_0x0730('0x24')]=qs[_0x0730('0x24')](_0x491849[_0x0730('0x38')][_0x0730('0x24')]);_0x171b73['offset']=qs[_0x0730('0x23')](_0x491849[_0x0730('0x38')][_0x0730('0x23')]);}return _0x32986a[_0x0730('0x54')](_0x171b73);}})[_0x0730('0x17')](function(_0x7e3382){if(_0x7e3382){return _0x7e3382?{'count':_0x202616,'rows':_0x7e3382}:null;}})['then'](respondWithResult(_0x94bffd,null))[_0x0730('0x21')](handleError(_0x94bffd,null));};exports[_0x0730('0x55')]=function(_0x3700ae,_0x5091ee,_0x295b67){var _0x38d2f6={};var _0x2a3102={};var _0x39ab89;var _0x307ee3;return db[_0x0730('0x32')][_0x0730('0x50')]({'where':{'id':_0x3700ae[_0x0730('0x4a')]['id']}})[_0x0730('0x17')](handleEntityNotFound(_0x5091ee,null))[_0x0730('0x17')](function(_0x51879a){if(_0x51879a){_0x39ab89=_0x51879a;_0x2a3102[_0x0730('0x37')]=_['keys'](db[_0x0730('0x51')][_0x0730('0x33')]);_0x2a3102[_0x0730('0x38')]=_[_0x0730('0x39')](_0x3700ae[_0x0730('0x38')]);_0x2a3102[_0x0730('0x3a')]=_[_0x0730('0x3b')](_0x2a3102[_0x0730('0x37')],_0x2a3102['query']);_0x38d2f6[_0x0730('0x3d')]=_['intersection'](_0x2a3102['model'],qs[_0x0730('0x3c')](_0x3700ae[_0x0730('0x38')]['fields']));_0x38d2f6['attributes']=_0x38d2f6['attributes'][_0x0730('0x3e')]?_0x38d2f6[_0x0730('0x3d')]:_0x2a3102[_0x0730('0x37')];_0x38d2f6[_0x0730('0x52')]=qs[_0x0730('0x40')](_0x3700ae['query'][_0x0730('0x40')]);_0x38d2f6[_0x0730('0x41')]=qs['filters'](_[_0x0730('0x42')](_0x3700ae[_0x0730('0x38')],_0x2a3102[_0x0730('0x3a')]));if(_0x3700ae[_0x0730('0x38')][_0x0730('0x43')]){_0x38d2f6[_0x0730('0x41')]=_[_0x0730('0x44')](_0x38d2f6[_0x0730('0x41')],{'$or':_[_0x0730('0x31')](_0x38d2f6[_0x0730('0x3d')],function(_0x4eb5b8){var _0x5748a2={};_0x5748a2[_0x4eb5b8]={'$like':'%'+_0x3700ae[_0x0730('0x38')][_0x0730('0x43')]+'%'};return _0x5748a2;})});}_0x38d2f6=_[_0x0730('0x44')]({},_0x38d2f6,_0x3700ae[_0x0730('0x4b')]);return _0x39ab89[_0x0730('0x55')](_0x38d2f6);}})[_0x0730('0x17')](function(_0x1ac94d){if(_0x1ac94d){_0x307ee3=_0x1ac94d[_0x0730('0x3e')];if(!_0x3700ae[_0x0730('0x38')][_0x0730('0x3f')](_0x0730('0x53'))){_0x38d2f6['limit']=qs[_0x0730('0x24')](_0x3700ae[_0x0730('0x38')][_0x0730('0x24')]);_0x38d2f6[_0x0730('0x23')]=qs[_0x0730('0x23')](_0x3700ae[_0x0730('0x38')][_0x0730('0x23')]);}return _0x39ab89[_0x0730('0x55')](_0x38d2f6);}})[_0x0730('0x17')](function(_0x54ff29){if(_0x54ff29){return _0x54ff29?{'count':_0x307ee3,'rows':_0x54ff29}:null;}})[_0x0730('0x17')](respondWithResult(_0x5091ee,null))[_0x0730('0x21')](handleError(_0x5091ee,null));}; \ No newline at end of file +var _0x3a2f=['crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','count','offset','set','Content-Range','apply','reject','save','update','end','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','intersection','include','find','create','body','params','destroy','getFields','findOne','order','getSubjects','SugarcrmField','length','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x2bc385,_0x1fbc61){var _0x20e2d0=function(_0x4ef4dd){while(--_0x4ef4dd){_0x2bc385['push'](_0x2bc385['shift']());}};_0x20e2d0(++_0x1fbc61);}(_0x3a2f,0x107));var _0xf3a2=function(_0x18b6c3,_0x39b3ea){_0x18b6c3=_0x18b6c3-0x0;var _0x223b0b=_0x3a2f[_0x18b6c3];return _0x223b0b;};'use strict';var pdf=require(_0xf3a2('0x0'));var emlformat=require(_0xf3a2('0x1'));var rimraf=require(_0xf3a2('0x2'));var zipdir=require(_0xf3a2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3a2('0x4'));var moment=require('moment');var BPromise=require(_0xf3a2('0x5'));var Mustache=require(_0xf3a2('0x6'));var util=require(_0xf3a2('0x7'));var path=require('path');var sox=require(_0xf3a2('0x8'));var csv=require(_0xf3a2('0x9'));var ejs=require(_0xf3a2('0xa'));var fs=require('fs');var _=require(_0xf3a2('0xb'));var squel=require(_0xf3a2('0xc'));var crypto=require(_0xf3a2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf3a2('0xe'));var toCsv=require(_0xf3a2('0x9'));var querystring=require(_0xf3a2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf3a2('0x10'));var qs=require(_0xf3a2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3a2('0x12'));var logger=require(_0xf3a2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf3a2('0x14'))['db'];var jayson=require(_0xf3a2('0x15'));var client=jayson[_0xf3a2('0x16')][_0xf3a2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xb22ddf,_0x4df179,_0x1a4588,_0x3ec4b7){return new BPromise(function(_0x2f7eb9,_0x5456ee){var _0x34c039=_0x3ec4b7||client;return _0x34c039[_0xf3a2('0x18')](_0xb22ddf,_0x1a4588)[_0xf3a2('0x19')](function(_0x11f80f){logger['info'](_0xf3a2('0x1a'),_0x4df179,_0xf3a2('0x1b'));logger[_0xf3a2('0x1c')](_0xf3a2('0x1d'),_0x4df179,'request\x20sent',JSON['stringify'](_0x11f80f));if(_0x11f80f['error']){if(_0x11f80f[_0xf3a2('0x1e')][_0xf3a2('0x1f')]===0x1f4){logger[_0xf3a2('0x1e')](_0xf3a2('0x1a'),_0x4df179,_0x11f80f[_0xf3a2('0x1e')][_0xf3a2('0x20')]);return _0x5456ee(_0x11f80f['error'][_0xf3a2('0x20')]);}logger[_0xf3a2('0x1e')](_0xf3a2('0x1a'),_0x4df179,_0x11f80f['error'][_0xf3a2('0x20')]);return _0x2f7eb9(_0x11f80f[_0xf3a2('0x1e')][_0xf3a2('0x20')]);}else{logger[_0xf3a2('0x21')](_0xf3a2('0x1a'),_0x4df179,_0xf3a2('0x1b'));_0x2f7eb9(_0x11f80f[_0xf3a2('0x22')][_0xf3a2('0x20')]);}})[_0xf3a2('0x23')](function(_0x172a4f){logger[_0xf3a2('0x1e')](_0xf3a2('0x1a'),_0x4df179,_0x172a4f);_0x5456ee(_0x172a4f);});});}function respondWithStatusCode(_0x2fc435,_0x8a4142){_0x8a4142=_0x8a4142||0xcc;return function(_0x4a3a65){if(_0x4a3a65){return _0x2fc435['sendStatus'](_0x8a4142);}return _0x2fc435[_0xf3a2('0x24')](_0x8a4142)['end']();};}function respondWithResult(_0x30c05b,_0x241d76){_0x241d76=_0x241d76||0xc8;return function(_0x396a68){if(_0x396a68){return _0x30c05b['status'](_0x241d76)[_0xf3a2('0x25')](_0x396a68);}};}function respondWithFilteredResult(_0x2f17a8,_0x1a4e10){return function(_0x5ec9e3){if(_0x5ec9e3){var _0x28c505=_0x5ec9e3[_0xf3a2('0x26')],_0x35a079=_0x1a4e10['offset'],_0x1f830b=_0x1a4e10[_0xf3a2('0x27')]+_0x1a4e10['limit'],_0x47d6cf;if(_0x1f830b>=_0x28c505){_0x1f830b=_0x28c505;_0x47d6cf=0xc8;}else{_0x47d6cf=0xce;}_0x2f17a8['status'](_0x47d6cf);return _0x2f17a8[_0xf3a2('0x28')](_0xf3a2('0x29'),_0x35a079+'-'+_0x1f830b+'/'+_0x28c505)[_0xf3a2('0x25')](_0x5ec9e3);}return null;};}function patchUpdates(_0x4c756c){return function(_0x5bbd36){try{jsonpatch[_0xf3a2('0x2a')](_0x5bbd36,_0x4c756c,!![]);}catch(_0x300ab9){return BPromise[_0xf3a2('0x2b')](_0x300ab9);}return _0x5bbd36[_0xf3a2('0x2c')]();};}function saveUpdates(_0x2dba33,_0x3cc7e4){return function(_0x2bd196){if(_0x2bd196){return _0x2bd196[_0xf3a2('0x2d')](_0x2dba33)[_0xf3a2('0x19')](function(_0x589d2b){return _0x589d2b;});}return null;};}function removeEntity(_0x5740d1,_0x4a8000){return function(_0x93575e){if(_0x93575e){return _0x93575e['destroy']()[_0xf3a2('0x19')](function(){_0x5740d1[_0xf3a2('0x24')](0xcc)[_0xf3a2('0x2e')]();});}};}function handleEntityNotFound(_0x394fa8,_0x29d330){return function(_0x768433){if(!_0x768433){_0x394fa8[_0xf3a2('0x2f')](0x194);}return _0x768433;};}function handleError(_0x58ee6e,_0x38489d){_0x38489d=_0x38489d||0x1f4;return function(_0x2494ff){logger[_0xf3a2('0x1e')](_0x2494ff[_0xf3a2('0x30')]);if(_0x2494ff[_0xf3a2('0x31')]){delete _0x2494ff[_0xf3a2('0x31')];}_0x58ee6e[_0xf3a2('0x24')](_0x38489d)[_0xf3a2('0x32')](_0x2494ff);};}exports[_0xf3a2('0x33')]=function(_0x509767,_0x5843d7){var _0x124fac={},_0x54c273={},_0x2fb494={'count':0x0,'rows':[]};var _0xebcba1=_[_0xf3a2('0x34')](db[_0xf3a2('0x35')][_0xf3a2('0x36')],function(_0x3508fe){return{'name':_0x3508fe[_0xf3a2('0x37')],'type':_0x3508fe[_0xf3a2('0x38')][_0xf3a2('0x39')]};});_0x54c273[_0xf3a2('0x3a')]=_['map'](_0xebcba1,'name');_0x54c273[_0xf3a2('0x3b')]=_[_0xf3a2('0x3c')](_0x509767[_0xf3a2('0x3b')]);_0x54c273[_0xf3a2('0x3d')]=_['intersection'](_0x54c273[_0xf3a2('0x3a')],_0x54c273[_0xf3a2('0x3b')]);_0x124fac[_0xf3a2('0x3e')]=_['intersection'](_0x54c273[_0xf3a2('0x3a')],qs[_0xf3a2('0x3f')](_0x509767['query']['fields']));_0x124fac[_0xf3a2('0x3e')]=_0x124fac[_0xf3a2('0x3e')]['length']?_0x124fac[_0xf3a2('0x3e')]:_0x54c273[_0xf3a2('0x3a')];if(!_0x509767['query'][_0xf3a2('0x40')](_0xf3a2('0x41'))){_0x124fac[_0xf3a2('0x42')]=qs[_0xf3a2('0x42')](_0x509767[_0xf3a2('0x3b')]['limit']);_0x124fac[_0xf3a2('0x27')]=qs[_0xf3a2('0x27')](_0x509767['query']['offset']);}_0x124fac['order']=qs[_0xf3a2('0x43')](_0x509767[_0xf3a2('0x3b')][_0xf3a2('0x43')]);_0x124fac['where']=qs[_0xf3a2('0x3d')](_[_0xf3a2('0x44')](_0x509767[_0xf3a2('0x3b')],_0x54c273[_0xf3a2('0x3d')]),_0xebcba1);if(_0x509767['query']['filter']){_0x124fac[_0xf3a2('0x45')]=_[_0xf3a2('0x46')](_0x124fac[_0xf3a2('0x45')],{'$or':_[_0xf3a2('0x34')](_0xebcba1,function(_0x3d769a){if(_0x3d769a[_0xf3a2('0x38')]!==_0xf3a2('0x47')){var _0x230b4a={};_0x230b4a[_0x3d769a['name']]={'$like':'%'+_0x509767[_0xf3a2('0x3b')][_0xf3a2('0x48')]+'%'};return _0x230b4a;}})});}_0x124fac=_['merge']({},_0x124fac,_0x509767[_0xf3a2('0x49')]);var _0x4424d3={'where':_0x124fac['where']};return db[_0xf3a2('0x35')]['count'](_0x4424d3)[_0xf3a2('0x19')](function(_0xe3814a){_0x2fb494['count']=_0xe3814a;if(_0x509767[_0xf3a2('0x3b')][_0xf3a2('0x4a')]){_0x124fac['include']=[{'all':!![]}];}return db[_0xf3a2('0x35')][_0xf3a2('0x4b')](_0x124fac);})['then'](function(_0x286347){_0x2fb494[_0xf3a2('0x4c')]=_0x286347;return _0x2fb494;})['then'](respondWithFilteredResult(_0x5843d7,_0x124fac))['catch'](handleError(_0x5843d7,null));};exports[_0xf3a2('0x4d')]=function(_0x394c99,_0x136c62){var _0xe8324e={'raw':![],'where':{'id':_0x394c99['params']['id']}},_0x1b835e={};_0x1b835e['model']=_[_0xf3a2('0x3c')](db[_0xf3a2('0x35')][_0xf3a2('0x36')]);_0x1b835e[_0xf3a2('0x3b')]=_[_0xf3a2('0x3c')](_0x394c99[_0xf3a2('0x3b')]);_0x1b835e[_0xf3a2('0x3d')]=_[_0xf3a2('0x4e')](_0x1b835e[_0xf3a2('0x3a')],_0x1b835e[_0xf3a2('0x3b')]);_0xe8324e[_0xf3a2('0x3e')]=_['intersection'](_0x1b835e[_0xf3a2('0x3a')],qs[_0xf3a2('0x3f')](_0x394c99['query'][_0xf3a2('0x3f')]));_0xe8324e[_0xf3a2('0x3e')]=_0xe8324e[_0xf3a2('0x3e')]['length']?_0xe8324e[_0xf3a2('0x3e')]:_0x1b835e['model'];if(_0x394c99[_0xf3a2('0x3b')]['includeAll']){_0xe8324e[_0xf3a2('0x4f')]=[{'all':!![]}];}_0xe8324e=_['merge']({},_0xe8324e,_0x394c99['options']);return db[_0xf3a2('0x35')][_0xf3a2('0x50')](_0xe8324e)[_0xf3a2('0x19')](handleEntityNotFound(_0x136c62,null))[_0xf3a2('0x19')](respondWithResult(_0x136c62,null))[_0xf3a2('0x23')](handleError(_0x136c62,null));};exports[_0xf3a2('0x51')]=function(_0x30cb3b,_0xa8da16){return db['SugarcrmConfiguration'][_0xf3a2('0x51')](_0x30cb3b[_0xf3a2('0x52')],{})[_0xf3a2('0x19')](respondWithResult(_0xa8da16,0xc9))[_0xf3a2('0x23')](handleError(_0xa8da16,null));};exports[_0xf3a2('0x2d')]=function(_0x57cfcc,_0x5c5ca1){if(_0x57cfcc[_0xf3a2('0x52')]['id']){delete _0x57cfcc[_0xf3a2('0x52')]['id'];}return db[_0xf3a2('0x35')]['find']({'where':{'id':_0x57cfcc[_0xf3a2('0x53')]['id']}})[_0xf3a2('0x19')](handleEntityNotFound(_0x5c5ca1,null))[_0xf3a2('0x19')](saveUpdates(_0x57cfcc[_0xf3a2('0x52')],null))[_0xf3a2('0x19')](respondWithResult(_0x5c5ca1,null))['catch'](handleError(_0x5c5ca1,null));};exports[_0xf3a2('0x54')]=function(_0x32e176,_0x12d854){return db[_0xf3a2('0x35')][_0xf3a2('0x50')]({'where':{'id':_0x32e176['params']['id']}})['then'](handleEntityNotFound(_0x12d854,null))[_0xf3a2('0x19')](removeEntity(_0x12d854,null))[_0xf3a2('0x23')](handleError(_0x12d854,null));};exports[_0xf3a2('0x55')]=function(_0x106892,_0x57b5f4,_0x321e75){var _0x31219f={};var _0x5ba44c={};var _0x3f6482;var _0x4da6dd;return db[_0xf3a2('0x35')][_0xf3a2('0x56')]({'where':{'id':_0x106892['params']['id']}})[_0xf3a2('0x19')](handleEntityNotFound(_0x57b5f4,null))[_0xf3a2('0x19')](function(_0x4051a4){if(_0x4051a4){_0x3f6482=_0x4051a4;_0x5ba44c['model']=_[_0xf3a2('0x3c')](db['SugarcrmField'][_0xf3a2('0x36')]);_0x5ba44c[_0xf3a2('0x3b')]=_['keys'](_0x106892[_0xf3a2('0x3b')]);_0x5ba44c[_0xf3a2('0x3d')]=_[_0xf3a2('0x4e')](_0x5ba44c[_0xf3a2('0x3a')],_0x5ba44c[_0xf3a2('0x3b')]);_0x31219f[_0xf3a2('0x3e')]=_[_0xf3a2('0x4e')](_0x5ba44c[_0xf3a2('0x3a')],qs[_0xf3a2('0x3f')](_0x106892['query'][_0xf3a2('0x3f')]));_0x31219f[_0xf3a2('0x3e')]=_0x31219f[_0xf3a2('0x3e')]['length']?_0x31219f[_0xf3a2('0x3e')]:_0x5ba44c[_0xf3a2('0x3a')];_0x31219f[_0xf3a2('0x57')]=qs[_0xf3a2('0x43')](_0x106892[_0xf3a2('0x3b')][_0xf3a2('0x43')]);_0x31219f[_0xf3a2('0x45')]=qs[_0xf3a2('0x3d')](_[_0xf3a2('0x44')](_0x106892[_0xf3a2('0x3b')],_0x5ba44c[_0xf3a2('0x3d')]));if(_0x106892[_0xf3a2('0x3b')][_0xf3a2('0x48')]){_0x31219f['where']=_['merge'](_0x31219f[_0xf3a2('0x45')],{'$or':_['map'](_0x31219f['attributes'],function(_0x178963){var _0x1a8191={};_0x1a8191[_0x178963]={'$like':'%'+_0x106892['query'][_0xf3a2('0x48')]+'%'};return _0x1a8191;})});}_0x31219f=_[_0xf3a2('0x46')]({},_0x31219f,_0x106892[_0xf3a2('0x49')]);return _0x3f6482[_0xf3a2('0x55')](_0x31219f);}})[_0xf3a2('0x19')](function(_0x196e5f){if(_0x196e5f){_0x4da6dd=_0x196e5f['length'];if(!_0x106892['query'][_0xf3a2('0x40')](_0xf3a2('0x41'))){_0x31219f[_0xf3a2('0x42')]=qs[_0xf3a2('0x42')](_0x106892[_0xf3a2('0x3b')][_0xf3a2('0x42')]);_0x31219f[_0xf3a2('0x27')]=qs[_0xf3a2('0x27')](_0x106892[_0xf3a2('0x3b')][_0xf3a2('0x27')]);}return _0x3f6482[_0xf3a2('0x55')](_0x31219f);}})[_0xf3a2('0x19')](function(_0x23a0b9){if(_0x23a0b9){return _0x23a0b9?{'count':_0x4da6dd,'rows':_0x23a0b9}:null;}})[_0xf3a2('0x19')](respondWithResult(_0x57b5f4,null))[_0xf3a2('0x23')](handleError(_0x57b5f4,null));};exports[_0xf3a2('0x58')]=function(_0x14ff03,_0x2e86a4,_0x114d87){var _0x442ddd={};var _0x4e34c3={};var _0x539bb9;var _0x2ac453;return db[_0xf3a2('0x35')]['findOne']({'where':{'id':_0x14ff03[_0xf3a2('0x53')]['id']}})[_0xf3a2('0x19')](handleEntityNotFound(_0x2e86a4,null))[_0xf3a2('0x19')](function(_0x4f4aab){if(_0x4f4aab){_0x539bb9=_0x4f4aab;_0x4e34c3[_0xf3a2('0x3a')]=_[_0xf3a2('0x3c')](db[_0xf3a2('0x59')][_0xf3a2('0x36')]);_0x4e34c3['query']=_[_0xf3a2('0x3c')](_0x14ff03[_0xf3a2('0x3b')]);_0x4e34c3[_0xf3a2('0x3d')]=_[_0xf3a2('0x4e')](_0x4e34c3[_0xf3a2('0x3a')],_0x4e34c3[_0xf3a2('0x3b')]);_0x442ddd[_0xf3a2('0x3e')]=_[_0xf3a2('0x4e')](_0x4e34c3[_0xf3a2('0x3a')],qs['fields'](_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x3f')]));_0x442ddd[_0xf3a2('0x3e')]=_0x442ddd[_0xf3a2('0x3e')][_0xf3a2('0x5a')]?_0x442ddd[_0xf3a2('0x3e')]:_0x4e34c3['model'];_0x442ddd[_0xf3a2('0x57')]=qs[_0xf3a2('0x43')](_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x43')]);_0x442ddd['where']=qs[_0xf3a2('0x3d')](_['pick'](_0x14ff03[_0xf3a2('0x3b')],_0x4e34c3[_0xf3a2('0x3d')]));if(_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x48')]){_0x442ddd[_0xf3a2('0x45')]=_['merge'](_0x442ddd[_0xf3a2('0x45')],{'$or':_[_0xf3a2('0x34')](_0x442ddd[_0xf3a2('0x3e')],function(_0x4457a5){var _0x4ba022={};_0x4ba022[_0x4457a5]={'$like':'%'+_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x48')]+'%'};return _0x4ba022;})});}_0x442ddd=_[_0xf3a2('0x46')]({},_0x442ddd,_0x14ff03[_0xf3a2('0x49')]);return _0x539bb9[_0xf3a2('0x58')](_0x442ddd);}})['then'](function(_0x16eb12){if(_0x16eb12){_0x2ac453=_0x16eb12[_0xf3a2('0x5a')];if(!_0x14ff03[_0xf3a2('0x3b')]['hasOwnProperty'](_0xf3a2('0x41'))){_0x442ddd['limit']=qs[_0xf3a2('0x42')](_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x42')]);_0x442ddd[_0xf3a2('0x27')]=qs[_0xf3a2('0x27')](_0x14ff03['query'][_0xf3a2('0x27')]);}return _0x539bb9['getSubjects'](_0x442ddd);}})[_0xf3a2('0x19')](function(_0x299944){if(_0x299944){return _0x299944?{'count':_0x2ac453,'rows':_0x299944}:null;}})[_0xf3a2('0x19')](respondWithResult(_0x2e86a4,null))[_0xf3a2('0x23')](handleError(_0x2e86a4,null));};exports[_0xf3a2('0x5b')]=function(_0x14c9c7,_0x20ace3,_0x43376c){var _0x199acb={};var _0x112bb6={};var _0x47a7ae;var _0x3e74ba;return db[_0xf3a2('0x35')][_0xf3a2('0x56')]({'where':{'id':_0x14c9c7['params']['id']}})['then'](handleEntityNotFound(_0x20ace3,null))[_0xf3a2('0x19')](function(_0x266a8b){if(_0x266a8b){_0x47a7ae=_0x266a8b;_0x112bb6[_0xf3a2('0x3a')]=_['keys'](db[_0xf3a2('0x59')][_0xf3a2('0x36')]);_0x112bb6[_0xf3a2('0x3b')]=_[_0xf3a2('0x3c')](_0x14c9c7[_0xf3a2('0x3b')]);_0x112bb6[_0xf3a2('0x3d')]=_[_0xf3a2('0x4e')](_0x112bb6[_0xf3a2('0x3a')],_0x112bb6[_0xf3a2('0x3b')]);_0x199acb[_0xf3a2('0x3e')]=_[_0xf3a2('0x4e')](_0x112bb6[_0xf3a2('0x3a')],qs[_0xf3a2('0x3f')](_0x14c9c7[_0xf3a2('0x3b')]['fields']));_0x199acb['attributes']=_0x199acb[_0xf3a2('0x3e')][_0xf3a2('0x5a')]?_0x199acb[_0xf3a2('0x3e')]:_0x112bb6['model'];_0x199acb[_0xf3a2('0x57')]=qs[_0xf3a2('0x43')](_0x14c9c7[_0xf3a2('0x3b')][_0xf3a2('0x43')]);_0x199acb[_0xf3a2('0x45')]=qs[_0xf3a2('0x3d')](_[_0xf3a2('0x44')](_0x14c9c7[_0xf3a2('0x3b')],_0x112bb6[_0xf3a2('0x3d')]));if(_0x14c9c7[_0xf3a2('0x3b')]['filter']){_0x199acb[_0xf3a2('0x45')]=_['merge'](_0x199acb[_0xf3a2('0x45')],{'$or':_[_0xf3a2('0x34')](_0x199acb[_0xf3a2('0x3e')],function(_0x2015bc){var _0x409a8d={};_0x409a8d[_0x2015bc]={'$like':'%'+_0x14c9c7[_0xf3a2('0x3b')][_0xf3a2('0x48')]+'%'};return _0x409a8d;})});}_0x199acb=_[_0xf3a2('0x46')]({},_0x199acb,_0x14c9c7[_0xf3a2('0x49')]);return _0x47a7ae[_0xf3a2('0x5b')](_0x199acb);}})[_0xf3a2('0x19')](function(_0x47b651){if(_0x47b651){_0x3e74ba=_0x47b651['length'];if(!_0x14c9c7[_0xf3a2('0x3b')][_0xf3a2('0x40')](_0xf3a2('0x41'))){_0x199acb['limit']=qs[_0xf3a2('0x42')](_0x14c9c7['query']['limit']);_0x199acb[_0xf3a2('0x27')]=qs[_0xf3a2('0x27')](_0x14c9c7[_0xf3a2('0x3b')][_0xf3a2('0x27')]);}return _0x47a7ae[_0xf3a2('0x5b')](_0x199acb);}})[_0xf3a2('0x19')](function(_0x3ce64f){if(_0x3ce64f){return _0x3ce64f?{'count':_0x3e74ba,'rows':_0x3ce64f}:null;}})[_0xf3a2('0x19')](respondWithResult(_0x20ace3,null))['catch'](handleError(_0x20ace3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a1bf6cb..55460e9 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2e3=['moment','bluebird','request-promise','../../config/environment','./intSugarcrmConfiguration.attributes','exports','int_sugarcrm_configurations','lodash','util','api'];(function(_0x2d5ff6,_0x2a449a){var _0x17dfbb=function(_0x13d094){while(--_0x13d094){_0x2d5ff6['push'](_0x2d5ff6['shift']());}};_0x17dfbb(++_0x2a449a);}(_0xb2e3,0x16f));var _0x3b2e=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb2e3[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x3b2e('0x0'));var util=require(_0x3b2e('0x1'));var logger=require('../../config/logger')(_0x3b2e('0x2'));var moment=require(_0x3b2e('0x3'));var BPromise=require(_0x3b2e('0x4'));var rp=require(_0x3b2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b2e('0x6'));var attributes=require(_0x3b2e('0x7'));module[_0x3b2e('0x8')]=function(_0x4fc9ec,_0x425da3){return _0x4fc9ec['define']('SugarcrmConfiguration',attributes,{'tableName':_0x3b2e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa92b=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xa92b,0x66));var _0xba92=function(_0x2f037f,_0x2958c5){_0x2f037f=_0x2f037f-0x0;var _0x2d1573=_0xa92b[_0x2f037f];return _0x2d1573;};'use strict';var _=require(_0xba92('0x0'));var util=require(_0xba92('0x1'));var logger=require(_0xba92('0x2'))(_0xba92('0x3'));var moment=require(_0xba92('0x4'));var BPromise=require(_0xba92('0x5'));var rp=require(_0xba92('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba92('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xba92('0x8')]=function(_0x247fc6,_0x2197db){return _0x247fc6['define'](_0xba92('0x9'),attributes,{'tableName':_0xba92('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index a26a0a1..e416a71 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x592d=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','result','catch','lodash'];(function(_0x2bfc60,_0xa254ab){var _0x44ea2c=function(_0x57ca7a){while(--_0x57ca7a){_0x2bfc60['push'](_0x2bfc60['shift']());}};_0x44ea2c(++_0xa254ab);}(_0x592d,0x9f));var _0xd592=function(_0x245f9e,_0x5c77b6){_0x245f9e=_0x245f9e-0x0;var _0x3958da=_0x592d[_0x245f9e];return _0x3958da;};'use strict';var _=require(_0xd592('0x0'));var util=require('util');var moment=require(_0xd592('0x1'));var BPromise=require('bluebird');var rs=require(_0xd592('0x2'));var fs=require('fs');var Redis=require(_0xd592('0x3'));var db=require(_0xd592('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd592('0x5'))(_0xd592('0x6'));var config=require(_0xd592('0x7'));var jayson=require(_0xd592('0x8'));var client=jayson['client'][_0xd592('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a92f7,_0x516058,_0xe3d1ad){return new BPromise(function(_0x46056a,_0x4f70b7){return client['request'](_0x3a92f7,_0xe3d1ad)[_0xd592('0xa')](function(_0x4251c2){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x516058,_0xd592('0xb'));logger[_0xd592('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x516058,_0xd592('0xb'),JSON['stringify'](_0x4251c2));if(_0x4251c2[_0xd592('0xd')]){if(_0x4251c2[_0xd592('0xd')][_0xd592('0xe')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x516058,_0x4251c2[_0xd592('0xd')][_0xd592('0xf')]);return _0x4f70b7(_0x4251c2['error']['message']);}logger['error'](_0xd592('0x10'),_0x516058,_0x4251c2[_0xd592('0xd')]['message']);return _0x46056a(_0x4251c2[_0xd592('0xd')][_0xd592('0xf')]);}else{logger[_0xd592('0x11')](_0xd592('0x10'),_0x516058,'request\x20sent');_0x46056a(_0x4251c2[_0xd592('0x12')][_0xd592('0xf')]);}})[_0xd592('0x13')](function(_0x43a561){logger[_0xd592('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x516058,_0x43a561);_0x4f70b7(_0x43a561);});});} \ No newline at end of file +var _0xeb00=['client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xeb00,0x194));var _0x0eb0=function(_0x5ea3a3,_0x47e5f7){_0x5ea3a3=_0x5ea3a3-0x0;var _0x18837b=_0xeb00[_0x5ea3a3];return _0x18837b;};'use strict';var _=require('lodash');var util=require(_0x0eb0('0x0'));var moment=require(_0x0eb0('0x1'));var BPromise=require(_0x0eb0('0x2'));var rs=require(_0x0eb0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0eb0('0x4'))['db'];var utils=require(_0x0eb0('0x5'));var logger=require(_0x0eb0('0x6'))(_0x0eb0('0x7'));var config=require(_0x0eb0('0x8'));var jayson=require(_0x0eb0('0x9'));var client=jayson[_0x0eb0('0xa')][_0x0eb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55b551,_0x5c13e6,_0x4405f0){return new BPromise(function(_0x5f14d1,_0x5f57d8){return client['request'](_0x55b551,_0x4405f0)[_0x0eb0('0xc')](function(_0x30f900){logger[_0x0eb0('0xd')](_0x0eb0('0xe'),_0x5c13e6,_0x0eb0('0xf'));logger['debug'](_0x0eb0('0x10'),_0x5c13e6,_0x0eb0('0xf'),JSON[_0x0eb0('0x11')](_0x30f900));if(_0x30f900['error']){if(_0x30f900[_0x0eb0('0x12')][_0x0eb0('0x13')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5c13e6,_0x30f900[_0x0eb0('0x12')][_0x0eb0('0x14')]);return _0x5f57d8(_0x30f900[_0x0eb0('0x12')][_0x0eb0('0x14')]);}logger[_0x0eb0('0x12')](_0x0eb0('0xe'),_0x5c13e6,_0x30f900[_0x0eb0('0x12')]['message']);return _0x5f14d1(_0x30f900[_0x0eb0('0x12')][_0x0eb0('0x14')]);}else{logger[_0x0eb0('0xd')](_0x0eb0('0xe'),_0x5c13e6,_0x0eb0('0xf'));_0x5f14d1(_0x30f900[_0x0eb0('0x15')][_0x0eb0('0x14')]);}})[_0x0eb0('0x16')](function(_0x4c23c1){logger['error'](_0x0eb0('0xe'),_0x5c13e6,_0x4c23c1);_0x5f57d8(_0x4c23c1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index cefa6fb..34dbe88 100644 --- a/server/api/intSugarcrmField/index.js +++ b/server/api/intSugarcrmField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3948=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x3948,0x1eb));var _0x8394=function(_0x2dc47b,_0x1f7a0e){_0x2dc47b=_0x2dc47b-0x0;var _0x1b5c21=_0x3948[_0x2dc47b];return _0x1b5c21;};'use strict';var multer=require('multer');var util=require(_0x8394('0x0'));var path=require(_0x8394('0x1'));var timeout=require(_0x8394('0x2'));var express=require('express');var router=express[_0x8394('0x3')]();var auth=require(_0x8394('0x4'));var interaction=require(_0x8394('0x5'));var config=require(_0x8394('0x6'));var controller=require('./intSugarcrmField.controller');router[_0x8394('0x7')]('/',auth[_0x8394('0x8')](),controller[_0x8394('0x9')]);router[_0x8394('0x7')](_0x8394('0xa'),auth[_0x8394('0x8')](),controller['show']);router['post']('/',auth[_0x8394('0x8')](),controller[_0x8394('0xb')]);router[_0x8394('0xc')](_0x8394('0xa'),auth[_0x8394('0x8')](),controller[_0x8394('0xd')]);router[_0x8394('0xe')](_0x8394('0xa'),auth[_0x8394('0x8')](),controller['destroy']);module[_0x8394('0xf')]=router; \ No newline at end of file +var _0x3fae=['/:id','create','put','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0x3fae,0xf5));var _0xe3fa=function(_0x2163fb,_0x43a40f){_0x2163fb=_0x2163fb-0x0;var _0x3b1401=_0x3fae[_0x2163fb];return _0x3b1401;};'use strict';var multer=require(_0xe3fa('0x0'));var util=require(_0xe3fa('0x1'));var path=require(_0xe3fa('0x2'));var timeout=require('connect-timeout');var express=require(_0xe3fa('0x3'));var router=express[_0xe3fa('0x4')]();var auth=require(_0xe3fa('0x5'));var interaction=require(_0xe3fa('0x6'));var config=require(_0xe3fa('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xe3fa('0x8')]('/',auth[_0xe3fa('0x9')](),controller[_0xe3fa('0xa')]);router['get'](_0xe3fa('0xb'),auth[_0xe3fa('0x9')](),controller['show']);router['post']('/',auth[_0xe3fa('0x9')](),controller[_0xe3fa('0xc')]);router[_0xe3fa('0xd')](_0xe3fa('0xb'),auth[_0xe3fa('0x9')](),controller[_0xe3fa('0xe')]);router[_0xe3fa('0xf')](_0xe3fa('0xb'),auth[_0xe3fa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 94d38c3..c96b962 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.attributes.js +++ b/server/api/intSugarcrmField/intSugarcrmField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bda=['variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x4f9da9,_0x2624a0){var _0x3255ef=function(_0x32f213){while(--_0x32f213){_0x4f9da9['push'](_0x4f9da9['shift']());}};_0x3255ef(++_0x2624a0);}(_0x8bda,0x104));var _0xa8bd=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0x8bda[_0x9b3efc];return _0x200f05;};'use strict';var Sequelize=require(_0xa8bd('0x0'));module[_0xa8bd('0x1')]={'type':{'type':Sequelize[_0xa8bd('0x2')](_0xa8bd('0x3'),_0xa8bd('0x4'),_0xa8bd('0x5'),'keyValue'),'defaultValue':_0xa8bd('0x3')},'content':{'type':Sequelize[_0xa8bd('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa8bd('0x2')]('string',_0xa8bd('0x4'),_0xa8bd('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa8bd('0x6')]},'nameField':{'type':Sequelize[_0xa8bd('0x6')]},'customField':{'type':Sequelize[_0xa8bd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa8bd('0x6')]}}; \ No newline at end of file +var _0xa8eb=['ENUM','variable','customVariable','keyValue','STRING','string','sequelize'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xa8eb,0x179));var _0xba8e=function(_0x1eefb7,_0x42488c){_0x1eefb7=_0x1eefb7-0x0;var _0x29268f=_0xa8eb[_0x1eefb7];return _0x29268f;};'use strict';var Sequelize=require(_0xba8e('0x0'));module['exports']={'type':{'type':Sequelize[_0xba8e('0x1')]('string',_0xba8e('0x2'),_0xba8e('0x3'),_0xba8e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xba8e('0x5')]},'key':{'type':Sequelize[_0xba8e('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xba8e('0x6'),'variable',_0xba8e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xba8e('0x5')]},'nameField':{'type':Sequelize[_0xba8e('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3aff6aa..ca61943 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.controller.js +++ b/server/api/intSugarcrmField/intSugarcrmField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd51=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv'];(function(_0x12796f,_0x175bdf){var _0x4cdc21=function(_0x12f011){while(--_0x12f011){_0x12796f['push'](_0x12796f['shift']());}};_0x4cdc21(++_0x175bdf);}(_0xbd51,0x1a8));var _0x1bd5=function(_0xd7e769,_0x2bf167){_0xd7e769=_0xd7e769-0x0;var _0x81e6b7=_0xbd51[_0xd7e769];return _0x81e6b7;};'use strict';var pdf=require(_0x1bd5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1bd5('0x1'));var zipdir=require(_0x1bd5('0x2'));var jsonpatch=require(_0x1bd5('0x3'));var rp=require(_0x1bd5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1bd5('0x5'));var sox=require(_0x1bd5('0x6'));var csv=require(_0x1bd5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=_0xa63190[_0x1bd5('0x1a')],_0x2b2c57=_0x5072c2[_0x1bd5('0x1b')],_0x4793dd=_0x5072c2[_0x1bd5('0x1b')]+_0x5072c2[_0x1bd5('0x1c')],_0x43ea3e;if(_0x4793dd>=_0xc7277e){_0x4793dd=_0xc7277e;_0x43ea3e=0xc8;}else{_0x43ea3e=0xce;}_0x48d048['status'](_0x43ea3e);return _0x48d048['set'](_0x1bd5('0x1d'),_0x2b2c57+'-'+_0x4793dd+'/'+_0xc7277e)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x476bd1){return function(_0xb95d4e){try{jsonpatch[_0x1bd5('0x1e')](_0xb95d4e,_0x476bd1,!![]);}catch(_0x2ff39a){return BPromise[_0x1bd5('0x1f')](_0x2ff39a);}return _0xb95d4e[_0x1bd5('0x20')]();};}function saveUpdates(_0x456051,_0xb1ac1e){return function(_0x34bd6a){if(_0x34bd6a){return _0x34bd6a[_0x1bd5('0x21')](_0x456051)[_0x1bd5('0x22')](function(_0x7ff933){return _0x7ff933;});}return null;};}function removeEntity(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')]()['then'](function(){_0x253d79[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18fd18,_0x1e534e){return function(_0x3b6eb8){if(!_0x3b6eb8){_0x18fd18['sendStatus'](0x194);}return _0x3b6eb8;};}function handleError(_0x3f4156,_0x4fa37c){_0x4fa37c=_0x4fa37c||0x1f4;return function(_0x2ed551){logger[_0x1bd5('0x24')](_0x2ed551[_0x1bd5('0x25')]);if(_0x2ed551[_0x1bd5('0x26')]){delete _0x2ed551['name'];}_0x3f4156[_0x1bd5('0x18')](_0x4fa37c)[_0x1bd5('0x27')](_0x2ed551);};}exports[_0x1bd5('0x28')]=function(_0x3b1090,_0x4cebd0){var _0xdba332={},_0x24d4d9={},_0x3595e9={'count':0x0,'rows':[]};var _0x369b88=_[_0x1bd5('0x29')](db[_0x1bd5('0x2a')]['rawAttributes'],function(_0x289097){return{'name':_0x289097[_0x1bd5('0x2b')],'type':_0x289097[_0x1bd5('0x2c')]['key']};});_0x24d4d9[_0x1bd5('0x2d')]=_[_0x1bd5('0x29')](_0x369b88,_0x1bd5('0x26'));_0x24d4d9[_0x1bd5('0x2e')]=_[_0x1bd5('0x2f')](_0x3b1090[_0x1bd5('0x2e')]);_0x24d4d9['filters']=_['intersection'](_0x24d4d9[_0x1bd5('0x2d')],_0x24d4d9[_0x1bd5('0x2e')]);_0xdba332['attributes']=_[_0x1bd5('0x30')](_0x24d4d9[_0x1bd5('0x2d')],qs[_0x1bd5('0x31')](_0x3b1090[_0x1bd5('0x2e')]['fields']));_0xdba332[_0x1bd5('0x32')]=_0xdba332[_0x1bd5('0x32')][_0x1bd5('0x33')]?_0xdba332[_0x1bd5('0x32')]:_0x24d4d9[_0x1bd5('0x2d')];if(!_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x34')](_0x1bd5('0x35'))){_0xdba332['limit']=qs[_0x1bd5('0x1c')](_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x1c')]);_0xdba332[_0x1bd5('0x1b')]=qs[_0x1bd5('0x1b')](_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x1b')]);}_0xdba332['order']=qs[_0x1bd5('0x36')](_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x36')]);_0xdba332[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_[_0x1bd5('0x39')](_0x3b1090[_0x1bd5('0x2e')],_0x24d4d9['filters']),_0x369b88);if(_0x3b1090['query'][_0x1bd5('0x3a')]){_0xdba332[_0x1bd5('0x37')]=_[_0x1bd5('0x3b')](_0xdba332['where'],{'$or':_[_0x1bd5('0x29')](_0x369b88,function(_0x5af974){if(_0x5af974[_0x1bd5('0x2c')]!==_0x1bd5('0x3c')){var _0x3ee243={};_0x3ee243[_0x5af974[_0x1bd5('0x26')]]={'$like':'%'+_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x3a')]+'%'};return _0x3ee243;}})});}_0xdba332=_[_0x1bd5('0x3b')]({},_0xdba332,_0x3b1090[_0x1bd5('0x3d')]);var _0x4bbefc={'where':_0xdba332[_0x1bd5('0x37')]};return db[_0x1bd5('0x2a')]['count'](_0x4bbefc)[_0x1bd5('0x22')](function(_0x77ebcf){_0x3595e9[_0x1bd5('0x1a')]=_0x77ebcf;if(_0x3b1090['query'][_0x1bd5('0x3e')]){_0xdba332[_0x1bd5('0x3f')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')][_0x1bd5('0x40')](_0xdba332);})['then'](function(_0x305720){_0x3595e9[_0x1bd5('0x41')]=_0x305720;return _0x3595e9;})[_0x1bd5('0x22')](respondWithFilteredResult(_0x4cebd0,_0xdba332))[_0x1bd5('0x42')](handleError(_0x4cebd0,null));};exports['show']=function(_0x52cef9,_0x40eeff){var _0x35afc7={'raw':!![],'where':{'id':_0x52cef9['params']['id']}},_0x453544={};_0x453544[_0x1bd5('0x2d')]=_[_0x1bd5('0x2f')](db['SugarcrmField'][_0x1bd5('0x43')]);_0x453544['query']=_[_0x1bd5('0x2f')](_0x52cef9[_0x1bd5('0x2e')]);_0x453544['filters']=_[_0x1bd5('0x30')](_0x453544[_0x1bd5('0x2d')],_0x453544[_0x1bd5('0x2e')]);_0x35afc7[_0x1bd5('0x32')]=_[_0x1bd5('0x30')](_0x453544[_0x1bd5('0x2d')],qs[_0x1bd5('0x31')](_0x52cef9[_0x1bd5('0x2e')][_0x1bd5('0x31')]));_0x35afc7[_0x1bd5('0x32')]=_0x35afc7[_0x1bd5('0x32')][_0x1bd5('0x33')]?_0x35afc7['attributes']:_0x453544[_0x1bd5('0x2d')];if(_0x52cef9[_0x1bd5('0x2e')][_0x1bd5('0x3e')]){_0x35afc7['include']=[{'all':!![]}];}_0x35afc7=_[_0x1bd5('0x3b')]({},_0x35afc7,_0x52cef9[_0x1bd5('0x3d')]);return db['SugarcrmField'][_0x1bd5('0x44')](_0x35afc7)['then'](handleEntityNotFound(_0x40eeff,null))[_0x1bd5('0x22')](respondWithResult(_0x40eeff,null))['catch'](handleError(_0x40eeff,null));};exports[_0x1bd5('0x45')]=function(_0xdd6c1a,_0x4f0c20){return db[_0x1bd5('0x2a')]['create'](_0xdd6c1a[_0x1bd5('0x46')],{})[_0x1bd5('0x22')](respondWithResult(_0x4f0c20,0xc9))[_0x1bd5('0x42')](handleError(_0x4f0c20,null));};exports[_0x1bd5('0x21')]=function(_0x26f7d2,_0x2dc037){if(_0x26f7d2[_0x1bd5('0x46')]['id']){delete _0x26f7d2[_0x1bd5('0x46')]['id'];}return db['SugarcrmField'][_0x1bd5('0x44')]({'where':{'id':_0x26f7d2[_0x1bd5('0x47')]['id']}})[_0x1bd5('0x22')](handleEntityNotFound(_0x2dc037,null))[_0x1bd5('0x22')](saveUpdates(_0x26f7d2[_0x1bd5('0x46')],null))[_0x1bd5('0x22')](respondWithResult(_0x2dc037,null))['catch'](handleError(_0x2dc037,null));};exports[_0x1bd5('0x23')]=function(_0x121bfb,_0x3ae0d2){return db[_0x1bd5('0x2a')][_0x1bd5('0x44')]({'where':{'id':_0x121bfb[_0x1bd5('0x47')]['id']}})[_0x1bd5('0x22')](handleEntityNotFound(_0x3ae0d2,null))['then'](removeEntity(_0x3ae0d2,null))['catch'](handleError(_0x3ae0d2,null));}; \ No newline at end of file +var _0x98a8=['options','SugarcrmField','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge'];(function(_0x3c0ed7,_0x52c6ff){var _0x2973e6=function(_0xde1abf){while(--_0xde1abf){_0x3c0ed7['push'](_0x3c0ed7['shift']());}};_0x2973e6(++_0x52c6ff);}(_0x98a8,0x12c));var _0x898a=function(_0x2036c1,_0x88c68){_0x2036c1=_0x2036c1-0x0;var _0x5539ed=_0x98a8[_0x2036c1];return _0x5539ed;};'use strict';var pdf=require(_0x898a('0x0'));var emlformat=require(_0x898a('0x1'));var rimraf=require(_0x898a('0x2'));var zipdir=require(_0x898a('0x3'));var jsonpatch=require(_0x898a('0x4'));var rp=require(_0x898a('0x5'));var moment=require(_0x898a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x898a('0x7'));var util=require(_0x898a('0x8'));var path=require(_0x898a('0x9'));var sox=require(_0x898a('0xa'));var csv=require(_0x898a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xb'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=_0x53a4b8[_0x898a('0x1c')],_0x5c96a6=_0x47033c['offset'],_0x303321=_0x47033c[_0x898a('0x1d')]+_0x47033c[_0x898a('0x1e')],_0x4fb05b;if(_0x303321>=_0x3fec7a){_0x303321=_0x3fec7a;_0x4fb05b=0xc8;}else{_0x4fb05b=0xce;}_0x506023[_0x898a('0x1a')](_0x4fb05b);return _0x506023['set'](_0x898a('0x1f'),_0x5c96a6+'-'+_0x303321+'/'+_0x3fec7a)['json'](_0x53a4b8);}return null;};}function patchUpdates(_0x54c8f3){return function(_0x3f8af4){try{jsonpatch[_0x898a('0x20')](_0x3f8af4,_0x54c8f3,!![]);}catch(_0x58c3ab){return BPromise['reject'](_0x58c3ab);}return _0x3f8af4[_0x898a('0x21')]();};}function saveUpdates(_0x26449a,_0x38a8f0){return function(_0x2917ff){if(_0x2917ff){return _0x2917ff[_0x898a('0x22')](_0x26449a)[_0x898a('0x23')](function(_0x259541){return _0x259541;});}return null;};}function removeEntity(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x483212[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x4e254d,_0x274cdf){return function(_0x16c318){if(!_0x16c318){_0x4e254d[_0x898a('0x25')](0x194);}return _0x16c318;};}function handleError(_0x32eca5,_0x3901ab){_0x3901ab=_0x3901ab||0x1f4;return function(_0x1426e3){logger['error'](_0x1426e3[_0x898a('0x26')]);if(_0x1426e3['name']){delete _0x1426e3['name'];}_0x32eca5['status'](_0x3901ab)[_0x898a('0x27')](_0x1426e3);};}exports[_0x898a('0x28')]=function(_0x420b25,_0x40b3db){var _0x28ae6a={},_0x2efde2={},_0x398e98={'count':0x0,'rows':[]};var _0xac1fc4=_[_0x898a('0x29')](db['SugarcrmField']['rawAttributes'],function(_0x47f1ed){return{'name':_0x47f1ed[_0x898a('0x2a')],'type':_0x47f1ed[_0x898a('0x2b')][_0x898a('0x2c')]};});_0x2efde2[_0x898a('0x2d')]=_[_0x898a('0x29')](_0xac1fc4,_0x898a('0x2e'));_0x2efde2[_0x898a('0x2f')]=_[_0x898a('0x30')](_0x420b25[_0x898a('0x2f')]);_0x2efde2[_0x898a('0x31')]=_[_0x898a('0x32')](_0x2efde2[_0x898a('0x2d')],_0x2efde2['query']);_0x28ae6a[_0x898a('0x33')]=_[_0x898a('0x32')](_0x2efde2[_0x898a('0x2d')],qs[_0x898a('0x34')](_0x420b25[_0x898a('0x2f')]['fields']));_0x28ae6a['attributes']=_0x28ae6a[_0x898a('0x33')][_0x898a('0x35')]?_0x28ae6a[_0x898a('0x33')]:_0x2efde2['model'];if(!_0x420b25[_0x898a('0x2f')][_0x898a('0x36')](_0x898a('0x37'))){_0x28ae6a[_0x898a('0x1e')]=qs[_0x898a('0x1e')](_0x420b25[_0x898a('0x2f')][_0x898a('0x1e')]);_0x28ae6a[_0x898a('0x1d')]=qs['offset'](_0x420b25[_0x898a('0x2f')]['offset']);}_0x28ae6a['order']=qs[_0x898a('0x38')](_0x420b25['query'][_0x898a('0x38')]);_0x28ae6a['where']=qs[_0x898a('0x31')](_['pick'](_0x420b25[_0x898a('0x2f')],_0x2efde2[_0x898a('0x31')]),_0xac1fc4);if(_0x420b25[_0x898a('0x2f')]['filter']){_0x28ae6a['where']=_['merge'](_0x28ae6a[_0x898a('0x39')],{'$or':_[_0x898a('0x29')](_0xac1fc4,function(_0x5a228f){if(_0x5a228f[_0x898a('0x2b')]!==_0x898a('0x3a')){var _0xe84f7e={};_0xe84f7e[_0x5a228f[_0x898a('0x2e')]]={'$like':'%'+_0x420b25['query']['filter']+'%'};return _0xe84f7e;}})});}_0x28ae6a=_[_0x898a('0x3b')]({},_0x28ae6a,_0x420b25[_0x898a('0x3c')]);var _0x4d486b={'where':_0x28ae6a['where']};return db[_0x898a('0x3d')][_0x898a('0x1c')](_0x4d486b)[_0x898a('0x23')](function(_0xa45405){_0x398e98['count']=_0xa45405;if(_0x420b25[_0x898a('0x2f')][_0x898a('0x3e')]){_0x28ae6a['include']=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x28ae6a);})[_0x898a('0x23')](function(_0x477a9d){_0x398e98[_0x898a('0x3f')]=_0x477a9d;return _0x398e98;})[_0x898a('0x23')](respondWithFilteredResult(_0x40b3db,_0x28ae6a))[_0x898a('0x40')](handleError(_0x40b3db,null));};exports[_0x898a('0x41')]=function(_0x10daf6,_0x1432ec){var _0x3292c2={'raw':!![],'where':{'id':_0x10daf6[_0x898a('0x42')]['id']}},_0x235fcf={};_0x235fcf[_0x898a('0x2d')]=_[_0x898a('0x30')](db[_0x898a('0x3d')][_0x898a('0x43')]);_0x235fcf['query']=_[_0x898a('0x30')](_0x10daf6[_0x898a('0x2f')]);_0x235fcf[_0x898a('0x31')]=_['intersection'](_0x235fcf[_0x898a('0x2d')],_0x235fcf[_0x898a('0x2f')]);_0x3292c2[_0x898a('0x33')]=_[_0x898a('0x32')](_0x235fcf[_0x898a('0x2d')],qs[_0x898a('0x34')](_0x10daf6[_0x898a('0x2f')][_0x898a('0x34')]));_0x3292c2['attributes']=_0x3292c2[_0x898a('0x33')][_0x898a('0x35')]?_0x3292c2[_0x898a('0x33')]:_0x235fcf[_0x898a('0x2d')];if(_0x10daf6['query'][_0x898a('0x3e')]){_0x3292c2[_0x898a('0x44')]=[{'all':!![]}];}_0x3292c2=_['merge']({},_0x3292c2,_0x10daf6[_0x898a('0x3c')]);return db['SugarcrmField'][_0x898a('0x45')](_0x3292c2)['then'](handleEntityNotFound(_0x1432ec,null))['then'](respondWithResult(_0x1432ec,null))[_0x898a('0x40')](handleError(_0x1432ec,null));};exports['create']=function(_0x313fb4,_0x1edb26){return db['SugarcrmField'][_0x898a('0x46')](_0x313fb4[_0x898a('0x47')],{})['then'](respondWithResult(_0x1edb26,0xc9))[_0x898a('0x40')](handleError(_0x1edb26,null));};exports[_0x898a('0x22')]=function(_0x11a0a3,_0x118240){if(_0x11a0a3['body']['id']){delete _0x11a0a3[_0x898a('0x47')]['id'];}return db[_0x898a('0x3d')]['find']({'where':{'id':_0x11a0a3[_0x898a('0x42')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x118240,null))['then'](saveUpdates(_0x11a0a3[_0x898a('0x47')],null))['then'](respondWithResult(_0x118240,null))[_0x898a('0x40')](handleError(_0x118240,null));};exports[_0x898a('0x24')]=function(_0x32ccb9,_0x50f9e3){return db[_0x898a('0x3d')][_0x898a('0x45')]({'where':{'id':_0x32ccb9[_0x898a('0x42')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x50f9e3,null))['then'](removeEntity(_0x50f9e3,null))[_0x898a('0x40')](handleError(_0x50f9e3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7626045..611fefd 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.model.js +++ b/server/api/intSugarcrmField/intSugarcrmField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2725=['./intSugarcrmField.attributes','SugarcrmField','sugarcrm_unique_index','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ff270,_0x345891){var _0x24e355=function(_0x4605df){while(--_0x4605df){_0x2ff270['push'](_0x2ff270['shift']());}};_0x24e355(++_0x345891);}(_0x2725,0x19b));var _0x5272=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x2725[_0x1e17eb];return _0x4de4c7;};'use strict';var _=require(_0x5272('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5272('0x1'));var moment=require(_0x5272('0x2'));var BPromise=require(_0x5272('0x3'));var rp=require(_0x5272('0x4'));var fs=require('fs');var path=require(_0x5272('0x5'));var rimraf=require(_0x5272('0x6'));var config=require('../../config/environment');var attributes=require(_0x5272('0x7'));module['exports']=function(_0x530efa,_0x45c6bc){return _0x530efa['define'](_0x5272('0x8'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x5272('0x9'),'fields':['idField',_0x5272('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc39a=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x407465,_0x4d661f){var _0x4611d9=function(_0x30f80e){while(--_0x30f80e){_0x407465['push'](_0x407465['shift']());}};_0x4611d9(++_0x4d661f);}(_0xc39a,0x85));var _0xac39=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0xc39a[_0x1562a2];return _0x39a636;};'use strict';var _=require(_0xac39('0x0'));var util=require(_0xac39('0x1'));var logger=require(_0xac39('0x2'))(_0xac39('0x3'));var moment=require(_0xac39('0x4'));var BPromise=require(_0xac39('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac39('0x6'));var rimraf=require(_0xac39('0x7'));var config=require(_0xac39('0x8'));var attributes=require(_0xac39('0x9'));module[_0xac39('0xa')]=function(_0x10360c,_0x2e3b9f){return _0x10360c[_0xac39('0xb')](_0xac39('0xc'),attributes,{'tableName':_0xac39('0xd'),'paranoid':![],'indexes':[{'name':_0xac39('0xe'),'fields':['idField',_0xac39('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 71a5938..883b51b 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x4fc2,0x111));var _0x24fc=function(_0x306e30,_0x107fe3){_0x306e30=_0x306e30-0x0;var _0x247281=_0x4fc2[_0x306e30];return _0x247281;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4b17581..f56a95a 100644 --- a/server/api/intVtigerAccount/index.js +++ b/server/api/intVtigerAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73da=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','/:id','update','destroy'];(function(_0x199934,_0x1be304){var _0x28cb39=function(_0x2dd0ab){while(--_0x2dd0ab){_0x199934['push'](_0x199934['shift']());}};_0x28cb39(++_0x1be304);}(_0x73da,0x85));var _0xa73d=function(_0x3720f6,_0x4ab838){_0x3720f6=_0x3720f6-0x0;var _0x5a2527=_0x73da[_0x3720f6];return _0x5a2527;};'use strict';var multer=require(_0xa73d('0x0'));var util=require(_0xa73d('0x1'));var path=require(_0xa73d('0x2'));var timeout=require(_0xa73d('0x3'));var express=require(_0xa73d('0x4'));var router=express[_0xa73d('0x5')]();var auth=require(_0xa73d('0x6'));var interaction=require(_0xa73d('0x7'));var config=require(_0xa73d('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xa73d('0x9')]('/',auth[_0xa73d('0xa')](),controller['index']);router[_0xa73d('0x9')]('/:id',auth[_0xa73d('0xa')](),controller[_0xa73d('0xb')]);router['get'](_0xa73d('0xc'),auth[_0xa73d('0xa')](),controller[_0xa73d('0xd')]);router['get'](_0xa73d('0xe'),auth[_0xa73d('0xa')](),controller['getFields']);router[_0xa73d('0xf')]('/',auth['isAuthenticated'](),controller[_0xa73d('0x10')]);router['post'](_0xa73d('0xc'),auth[_0xa73d('0xa')](),controller['addConfiguration']);router[_0xa73d('0x11')](_0xa73d('0x12'),auth[_0xa73d('0xa')](),controller[_0xa73d('0x13')]);router['delete']('/:id',auth[_0xa73d('0xa')](),controller[_0xa73d('0x14')]);module[_0xa73d('0x15')]=router; \ No newline at end of file +var _0xb075=['getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations'];(function(_0x2bcaed,_0x49c3cd){var _0x26fab9=function(_0x53f134){while(--_0x53f134){_0x2bcaed['push'](_0x2bcaed['shift']());}};_0x26fab9(++_0x49c3cd);}(_0xb075,0x92));var _0x5b07=function(_0x13562f,_0x1e5376){_0x13562f=_0x13562f-0x0;var _0x2fb051=_0xb075[_0x13562f];return _0x2fb051;};'use strict';var multer=require(_0x5b07('0x0'));var util=require(_0x5b07('0x1'));var path=require(_0x5b07('0x2'));var timeout=require(_0x5b07('0x3'));var express=require(_0x5b07('0x4'));var router=express[_0x5b07('0x5')]();var auth=require(_0x5b07('0x6'));var interaction=require(_0x5b07('0x7'));var config=require(_0x5b07('0x8'));var controller=require(_0x5b07('0x9'));router['get']('/',auth[_0x5b07('0xa')](),controller[_0x5b07('0xb')]);router[_0x5b07('0xc')](_0x5b07('0xd'),auth[_0x5b07('0xa')](),controller['show']);router[_0x5b07('0xc')](_0x5b07('0xe'),auth[_0x5b07('0xa')](),controller[_0x5b07('0xf')]);router['get'](_0x5b07('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x5b07('0x11')]('/',auth['isAuthenticated'](),controller[_0x5b07('0x12')]);router['post'](_0x5b07('0xe'),auth[_0x5b07('0xa')](),controller[_0x5b07('0x13')]);router[_0x5b07('0x14')](_0x5b07('0xd'),auth[_0x5b07('0xa')](),controller[_0x5b07('0x15')]);router['delete'](_0x5b07('0xd'),auth[_0x5b07('0xa')](),controller[_0x5b07('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d0212af..3468844 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.attributes.js +++ b/server/api/intVtigerAccount/intVtigerAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc359=['sequelize','exports','STRING','HelpDesk'];(function(_0x220f8,_0x4e159e){var _0x5e678e=function(_0x504677){while(--_0x504677){_0x220f8['push'](_0x220f8['shift']());}};_0x5e678e(++_0x4e159e);}(_0xc359,0xa8));var _0x9c35=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0xc359[_0x4695ba];return _0x524b7d;};'use strict';var Sequelize=require(_0x9c35('0x0'));module[_0x9c35('0x1')]={'name':{'type':Sequelize[_0x9c35('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9c35('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9c35('0x2')],'allowNull':![],'defaultValue':_0x9c35('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9c35('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdcb8=['exports','STRING','HelpDesk'];(function(_0x4e8330,_0x430ee0){var _0x2f3774=function(_0x26d809){while(--_0x26d809){_0x4e8330['push'](_0x4e8330['shift']());}};_0x2f3774(++_0x430ee0);}(_0xdcb8,0x13b));var _0x8dcb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdcb8[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x8dcb('0x0')]={'name':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![],'defaultValue':_0x8dcb('0x2')},'remoteUri':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 5eb943f..8d94db0 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.controller.js +++ b/server/api/intVtigerAccount/intVtigerAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac0a=['GET','success','POST','login','token','describe','result','sessionName','autogenerated','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','limit','apply','save','update','stack','name','send','index','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','map','VIRTUAL','options','VtigerAccount','includeAll','rows','params','rawAttributes','include','merge','find','body','destroy','getConfigurations','VtigerConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','%s/webservice.php'];(function(_0x5df979,_0x208437){var _0x4c6e19=function(_0x4e384f){while(--_0x4e384f){_0x5df979['push'](_0x5df979['shift']());}};_0x4c6e19(++_0x208437);}(_0xac0a,0x11e));var _0xaac0=function(_0x5cb8f9,_0x5a6e61){_0x5cb8f9=_0x5cb8f9-0x0;var _0x31568d=_0xac0a[_0x5cb8f9];return _0x31568d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaac0('0x0'));var zipdir=require(_0xaac0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaac0('0x2'));var moment=require(_0xaac0('0x3'));var BPromise=require(_0xaac0('0x4'));var Mustache=require(_0xaac0('0x5'));var util=require(_0xaac0('0x6'));var path=require(_0xaac0('0x7'));var sox=require(_0xaac0('0x8'));var csv=require(_0xaac0('0x9'));var ejs=require(_0xaac0('0xa'));var fs=require('fs');var _=require(_0xaac0('0xb'));var squel=require(_0xaac0('0xc'));var crypto=require(_0xaac0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaac0('0xe'));var toCsv=require(_0xaac0('0x9'));var querystring=require('querystring');var Papa=require(_0xaac0('0xf'));var Redis=require(_0xaac0('0x10'));var authService=require(_0xaac0('0x11'));var qs=require(_0xaac0('0x12'));var as=require(_0xaac0('0x13'));var hardwareService=require(_0xaac0('0x14'));var logger=require(_0xaac0('0x15'))(_0xaac0('0x16'));var utils=require(_0xaac0('0x17'));var config=require(_0xaac0('0x18'));var licenseUtil=require(_0xaac0('0x19'));var db=require(_0xaac0('0x1a'))['db'];var integrations=require(_0xaac0('0x1b'));var jayson=require(_0xaac0('0x1c'));var client=jayson[_0xaac0('0x1d')][_0xaac0('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2fdd0a,_0x5b5fdc,_0x41a054,_0x259ce3){return new BPromise(function(_0x8f2200,_0x394af9){var _0x3bf7b2=_0x259ce3||client;return _0x3bf7b2[_0xaac0('0x1f')](_0x2fdd0a,_0x41a054)[_0xaac0('0x20')](function(_0x3182fe){logger[_0xaac0('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x5b5fdc,_0xaac0('0x22'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x5b5fdc,_0xaac0('0x22'),JSON[_0xaac0('0x23')](_0x3182fe));if(_0x3182fe['error']){if(_0x3182fe[_0xaac0('0x24')][_0xaac0('0x25')]===0x1f4){logger['error'](_0xaac0('0x26'),_0x5b5fdc,_0x3182fe[_0xaac0('0x24')][_0xaac0('0x27')]);return _0x394af9(_0x3182fe[_0xaac0('0x24')][_0xaac0('0x27')]);}logger[_0xaac0('0x24')]('VtigerAccount,\x20%s,\x20%s',_0x5b5fdc,_0x3182fe['error'][_0xaac0('0x27')]);return _0x8f2200(_0x3182fe[_0xaac0('0x24')]['message']);}else{logger['info'](_0xaac0('0x26'),_0x5b5fdc,_0xaac0('0x22'));_0x8f2200(_0x3182fe['result'][_0xaac0('0x27')]);}})[_0xaac0('0x28')](function(_0x3e967d){logger['error'](_0xaac0('0x26'),_0x5b5fdc,_0x3e967d);_0x394af9(_0x3e967d);});});}function respondWithStatusCode(_0x206fb4,_0x2269fd){_0x2269fd=_0x2269fd||0xcc;return function(_0x17d486){if(_0x17d486){return _0x206fb4[_0xaac0('0x29')](_0x2269fd);}return _0x206fb4[_0xaac0('0x2a')](_0x2269fd)[_0xaac0('0x2b')]();};}function respondWithResult(_0x50106e,_0xa05ba7){_0xa05ba7=_0xa05ba7||0xc8;return function(_0x37fa18){if(_0x37fa18){return _0x50106e[_0xaac0('0x2a')](_0xa05ba7)[_0xaac0('0x2c')](_0x37fa18);}};}function respondWithFilteredResult(_0x48a8b4,_0x2f626f){return function(_0x3cdbfe){if(_0x3cdbfe){var _0x15f0f4=_0x3cdbfe[_0xaac0('0x2d')],_0x4c473f=_0x2f626f['offset'],_0x5b9593=_0x2f626f['offset']+_0x2f626f[_0xaac0('0x2e')],_0x27a000;if(_0x5b9593>=_0x15f0f4){_0x5b9593=_0x15f0f4;_0x27a000=0xc8;}else{_0x27a000=0xce;}_0x48a8b4[_0xaac0('0x2a')](_0x27a000);return _0x48a8b4['set']('Content-Range',_0x4c473f+'-'+_0x5b9593+'/'+_0x15f0f4)[_0xaac0('0x2c')](_0x3cdbfe);}return null;};}function patchUpdates(_0x36018b){return function(_0x3558ee){try{jsonpatch[_0xaac0('0x2f')](_0x3558ee,_0x36018b,!![]);}catch(_0xb39532){return BPromise['reject'](_0xb39532);}return _0x3558ee[_0xaac0('0x30')]();};}function saveUpdates(_0xe2d7c1,_0x3bd25a){return function(_0x13032a){if(_0x13032a){return _0x13032a[_0xaac0('0x31')](_0xe2d7c1)['then'](function(_0x242fb4){return _0x242fb4;});}return null;};}function removeEntity(_0x5744f4,_0x452dc5){return function(_0x18b92f){if(_0x18b92f){return _0x18b92f['destroy']()[_0xaac0('0x20')](function(){_0x5744f4[_0xaac0('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24a034,_0x4d0eb7){return function(_0x1cdc62){if(!_0x1cdc62){_0x24a034['sendStatus'](0x194);}return _0x1cdc62;};}function handleError(_0x2317e0,_0x156ce4){_0x156ce4=_0x156ce4||0x1f4;return function(_0x22da9c){logger[_0xaac0('0x24')](_0x22da9c[_0xaac0('0x32')]);if(_0x22da9c[_0xaac0('0x33')]){delete _0x22da9c[_0xaac0('0x33')];}_0x2317e0[_0xaac0('0x2a')](_0x156ce4)[_0xaac0('0x34')](_0x22da9c);};}exports[_0xaac0('0x35')]=function(_0x30a33a,_0x490670){var _0xbff12b={},_0x38f383={},_0x36a9a8={'count':0x0,'rows':[]};var _0x2d0d7a=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x4f0345){return{'name':_0x4f0345[_0xaac0('0x36')],'type':_0x4f0345[_0xaac0('0x37')][_0xaac0('0x38')]};});_0x38f383['model']=_['map'](_0x2d0d7a,_0xaac0('0x33'));_0x38f383[_0xaac0('0x39')]=_[_0xaac0('0x3a')](_0x30a33a[_0xaac0('0x39')]);_0x38f383['filters']=_['intersection'](_0x38f383['model'],_0x38f383[_0xaac0('0x39')]);_0xbff12b[_0xaac0('0x3b')]=_[_0xaac0('0x3c')](_0x38f383[_0xaac0('0x3d')],qs[_0xaac0('0x3e')](_0x30a33a['query'][_0xaac0('0x3e')]));_0xbff12b[_0xaac0('0x3b')]=_0xbff12b[_0xaac0('0x3b')][_0xaac0('0x3f')]?_0xbff12b['attributes']:_0x38f383[_0xaac0('0x3d')];if(!_0x30a33a[_0xaac0('0x39')]['hasOwnProperty'](_0xaac0('0x40'))){_0xbff12b[_0xaac0('0x2e')]=qs[_0xaac0('0x2e')](_0x30a33a[_0xaac0('0x39')]['limit']);_0xbff12b['offset']=qs[_0xaac0('0x41')](_0x30a33a['query'][_0xaac0('0x41')]);}_0xbff12b[_0xaac0('0x42')]=qs[_0xaac0('0x43')](_0x30a33a[_0xaac0('0x39')][_0xaac0('0x43')]);_0xbff12b[_0xaac0('0x44')]=qs[_0xaac0('0x45')](_[_0xaac0('0x46')](_0x30a33a[_0xaac0('0x39')],_0x38f383[_0xaac0('0x45')]),_0x2d0d7a);if(_0x30a33a['query'][_0xaac0('0x47')]){_0xbff12b[_0xaac0('0x44')]=_['merge'](_0xbff12b[_0xaac0('0x44')],{'$or':_[_0xaac0('0x48')](_0x2d0d7a,function(_0x5c8ecb){if(_0x5c8ecb[_0xaac0('0x37')]!==_0xaac0('0x49')){var _0x227292={};_0x227292[_0x5c8ecb[_0xaac0('0x33')]]={'$like':'%'+_0x30a33a[_0xaac0('0x39')][_0xaac0('0x47')]+'%'};return _0x227292;}})});}_0xbff12b=_['merge']({},_0xbff12b,_0x30a33a[_0xaac0('0x4a')]);var _0x467407={'where':_0xbff12b[_0xaac0('0x44')]};return db[_0xaac0('0x4b')][_0xaac0('0x2d')](_0x467407)['then'](function(_0x181cb3){_0x36a9a8[_0xaac0('0x2d')]=_0x181cb3;if(_0x30a33a[_0xaac0('0x39')][_0xaac0('0x4c')]){_0xbff12b['include']=[{'all':!![]}];}return db[_0xaac0('0x4b')]['findAll'](_0xbff12b);})[_0xaac0('0x20')](function(_0x552f8d){_0x36a9a8[_0xaac0('0x4d')]=_0x552f8d;return _0x36a9a8;})[_0xaac0('0x20')](respondWithFilteredResult(_0x490670,_0xbff12b))[_0xaac0('0x28')](handleError(_0x490670,null));};exports['show']=function(_0x3cfd7a,_0x168978){var _0x2cb95e={'raw':![],'where':{'id':_0x3cfd7a[_0xaac0('0x4e')]['id']}},_0x26849c={};_0x26849c[_0xaac0('0x3d')]=_[_0xaac0('0x3a')](db[_0xaac0('0x4b')][_0xaac0('0x4f')]);_0x26849c['query']=_[_0xaac0('0x3a')](_0x3cfd7a[_0xaac0('0x39')]);_0x26849c[_0xaac0('0x45')]=_[_0xaac0('0x3c')](_0x26849c[_0xaac0('0x3d')],_0x26849c[_0xaac0('0x39')]);_0x2cb95e[_0xaac0('0x3b')]=_['intersection'](_0x26849c['model'],qs[_0xaac0('0x3e')](_0x3cfd7a['query'][_0xaac0('0x3e')]));_0x2cb95e[_0xaac0('0x3b')]=_0x2cb95e[_0xaac0('0x3b')][_0xaac0('0x3f')]?_0x2cb95e[_0xaac0('0x3b')]:_0x26849c[_0xaac0('0x3d')];if(_0x3cfd7a[_0xaac0('0x39')]['includeAll']){_0x2cb95e[_0xaac0('0x50')]=[{'all':!![]}];}_0x2cb95e=_[_0xaac0('0x51')]({},_0x2cb95e,_0x3cfd7a[_0xaac0('0x4a')]);return db[_0xaac0('0x4b')][_0xaac0('0x52')](_0x2cb95e)[_0xaac0('0x20')](handleEntityNotFound(_0x168978,null))[_0xaac0('0x20')](respondWithResult(_0x168978,null))[_0xaac0('0x28')](handleError(_0x168978,null));};exports['create']=function(_0x54fcfe,_0x1ecdb6){return db['VtigerAccount']['create'](_0x54fcfe[_0xaac0('0x53')],{})[_0xaac0('0x20')](respondWithResult(_0x1ecdb6,0xc9))[_0xaac0('0x28')](handleError(_0x1ecdb6,null));};exports['update']=function(_0x56f603,_0x4d546a){if(_0x56f603[_0xaac0('0x53')]['id']){delete _0x56f603[_0xaac0('0x53')]['id'];}return db[_0xaac0('0x4b')][_0xaac0('0x52')]({'where':{'id':_0x56f603[_0xaac0('0x4e')]['id']}})[_0xaac0('0x20')](handleEntityNotFound(_0x4d546a,null))[_0xaac0('0x20')](saveUpdates(_0x56f603['body'],null))[_0xaac0('0x20')](respondWithResult(_0x4d546a,null))[_0xaac0('0x28')](handleError(_0x4d546a,null));};exports[_0xaac0('0x54')]=function(_0x189b17,_0x304a92){return db['VtigerAccount'][_0xaac0('0x52')]({'where':{'id':_0x189b17[_0xaac0('0x4e')]['id']}})[_0xaac0('0x20')](handleEntityNotFound(_0x304a92,null))[_0xaac0('0x20')](removeEntity(_0x304a92,null))[_0xaac0('0x28')](handleError(_0x304a92,null));};exports[_0xaac0('0x55')]=function(_0x21802d,_0x5af115,_0x3d91b1){var _0x3f5f56={};var _0x1626ef={};var _0x3ed232;var _0x565a97;return db[_0xaac0('0x4b')]['findOne']({'where':{'id':_0x21802d[_0xaac0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5af115,null))[_0xaac0('0x20')](function(_0x30ddd5){if(_0x30ddd5){_0x3ed232=_0x30ddd5;_0x1626ef[_0xaac0('0x3d')]=_[_0xaac0('0x3a')](db[_0xaac0('0x56')]['rawAttributes']);_0x1626ef[_0xaac0('0x39')]=_[_0xaac0('0x3a')](_0x21802d[_0xaac0('0x39')]);_0x1626ef['filters']=_['intersection'](_0x1626ef[_0xaac0('0x3d')],_0x1626ef[_0xaac0('0x39')]);_0x3f5f56[_0xaac0('0x3b')]=_[_0xaac0('0x3c')](_0x1626ef[_0xaac0('0x3d')],qs[_0xaac0('0x3e')](_0x21802d['query'][_0xaac0('0x3e')]));_0x3f5f56[_0xaac0('0x3b')]=_0x3f5f56['attributes']['length']?_0x3f5f56['attributes']:_0x1626ef[_0xaac0('0x3d')];_0x3f5f56['order']=qs['sort'](_0x21802d[_0xaac0('0x39')][_0xaac0('0x43')]);_0x3f5f56[_0xaac0('0x44')]=qs['filters'](_[_0xaac0('0x46')](_0x21802d[_0xaac0('0x39')],_0x1626ef['filters']));if(_0x21802d[_0xaac0('0x39')]['filter']){_0x3f5f56[_0xaac0('0x44')]=_[_0xaac0('0x51')](_0x3f5f56[_0xaac0('0x44')],{'$or':_[_0xaac0('0x48')](_0x3f5f56['attributes'],function(_0x3761d5){var _0xb9eac={};_0xb9eac[_0x3761d5]={'$like':'%'+_0x21802d[_0xaac0('0x39')][_0xaac0('0x47')]+'%'};return _0xb9eac;})});}_0x3f5f56=_[_0xaac0('0x51')]({},_0x3f5f56,_0x21802d[_0xaac0('0x4a')]);return _0x3ed232[_0xaac0('0x55')](_0x3f5f56);}})[_0xaac0('0x20')](function(_0x42626d){if(_0x42626d){_0x565a97=_0x42626d[_0xaac0('0x3f')];if(!_0x21802d[_0xaac0('0x39')][_0xaac0('0x57')](_0xaac0('0x40'))){_0x3f5f56[_0xaac0('0x2e')]=qs[_0xaac0('0x2e')](_0x21802d[_0xaac0('0x39')][_0xaac0('0x2e')]);_0x3f5f56[_0xaac0('0x41')]=qs[_0xaac0('0x41')](_0x21802d[_0xaac0('0x39')][_0xaac0('0x41')]);}return _0x3ed232[_0xaac0('0x55')](_0x3f5f56);}})[_0xaac0('0x20')](function(_0x17899d){if(_0x17899d){return _0x17899d?{'count':_0x565a97,'rows':_0x17899d}:null;}})[_0xaac0('0x20')](respondWithResult(_0x5af115,null))[_0xaac0('0x28')](handleError(_0x5af115,null));};exports[_0xaac0('0x58')]=function(_0x410703,_0x2494e2,_0x5d5c43){if(_0x410703[_0xaac0('0x53')]['id']){delete _0x410703['body']['id'];}return db[_0xaac0('0x4b')][_0xaac0('0x59')]({'where':{'id':_0x410703[_0xaac0('0x4e')]['id']}})[_0xaac0('0x20')](handleEntityNotFound(_0x2494e2,null))[_0xaac0('0x20')](function(_0x92cdaf){if(_0x92cdaf){_0x410703[_0xaac0('0x53')][_0xaac0('0x5a')]=_0x92cdaf['id'];_0x410703[_0xaac0('0x53')][_0xaac0('0x5b')]=integrations[_0xaac0('0x5c')](_0x410703['body'][_0xaac0('0x5d')],_0x410703[_0xaac0('0x53')][_0xaac0('0x37')]);_0x410703[_0xaac0('0x53')][_0xaac0('0x5e')]=integrations[_0xaac0('0x5f')](_0x410703[_0xaac0('0x53')][_0xaac0('0x5d')],_0x410703[_0xaac0('0x53')][_0xaac0('0x37')]);return db[_0xaac0('0x56')][_0xaac0('0x60')](_0x410703[_0xaac0('0x53')],{'include':[{'model':db[_0xaac0('0x61')],'as':_0xaac0('0x5b')},{'model':db[_0xaac0('0x61')],'as':_0xaac0('0x5e')}]});}return null;})['then'](respondWithResult(_0x2494e2,null))['catch'](handleError(_0x2494e2,null));};var md5=require(_0xaac0('0x62'));exports[_0xaac0('0x63')]=function(_0x70e4ac,_0x2e0646,_0x198734){var _0x1d7192=null;var _0x54794e=null;var _0x5b4fe5=null;var _0x321b55=null;var _0xc1ea1f='';return db[_0xaac0('0x4b')][_0xaac0('0x59')]({'where':{'id':_0x70e4ac[_0xaac0('0x4e')]['id']},'attributes':['id','name','username',_0xaac0('0x64'),_0xaac0('0x65'),_0xaac0('0x66'),_0xaac0('0x67'),_0xaac0('0x68')]})[_0xaac0('0x20')](handleEntityNotFound(_0x2e0646,null))[_0xaac0('0x20')](function(_0xa926f1){if(_0xa926f1){_0x1d7192=_0xa926f1[_0xaac0('0x69')];_0x54794e=_0xa926f1[_0xaac0('0x68')];_0x5b4fe5=_0xa926f1[_0xaac0('0x65')];_0xc1ea1f=_0xa926f1['remoteUri'];var _0x5f32f6=_0xc1ea1f[_0xaac0('0x6a')](-0x1);if(_0x5f32f6==='/'){_0xc1ea1f=_0xc1ea1f[_0xaac0('0x6b')](0x0,_0xc1ea1f[_0xaac0('0x6c')](_0x5f32f6));}_0x321b55=util['format'](_0xaac0('0x6d'),_0xc1ea1f);var _0x3ed4b1={'method':_0xaac0('0x6e'),'uri':_0x321b55,'qs':{'operation':'getchallenge','username':_0xa926f1[_0xaac0('0x69')]},'json':!![]};return rp(_0x3ed4b1);}})[_0xaac0('0x20')](function(_0x1a9642){if(_0x1a9642[_0xaac0('0x6f')]){var _0x3eda4b={'method':_0xaac0('0x70'),'uri':_0x321b55,'form':{'operation':_0xaac0('0x71'),'username':_0x1d7192,'accessKey':md5(_0x1a9642['result'][_0xaac0('0x72')]+_0x54794e)},'json':!![]};return rp(_0x3eda4b);}})[_0xaac0('0x20')](function(_0x40ccea){if(_0x40ccea[_0xaac0('0x6f')]){var _0x5d73c5={'method':_0xaac0('0x6e'),'uri':_0x321b55,'qs':{'operation':_0xaac0('0x73'),'username':_0x1d7192,'sessionName':_0x40ccea[_0xaac0('0x74')][_0xaac0('0x75')],'elementType':_0x5b4fe5},'json':!![]};return rp(_0x5d73c5);}})[_0xaac0('0x20')](function(_0xa54db1){if(_0xa54db1['success']){var _0x513c52=[_0xaac0('0x76'),'reference','owner'];_[_0xaac0('0x77')](_0xa54db1[_0xaac0('0x74')]['fields'],function(_0x65603e){return _0x513c52[_0xaac0('0x78')](_0x65603e[_0xaac0('0x37')][_0xaac0('0x33')]);});_[_0xaac0('0x77')](_0xa54db1[_0xaac0('0x74')][_0xaac0('0x3e')],function(_0x5d6c89){return _0x5d6c89[_0xaac0('0x79')]===_0xaac0('0x7a');});return{'count':_0xa54db1[_0xaac0('0x74')]['fields'][_0xaac0('0x3f')],'rows':_[_0xaac0('0x48')](_0xa54db1[_0xaac0('0x74')]['fields'],function(_0x1c9c3f){return{'id':_0x1c9c3f[_0xaac0('0x33')],'name':_0x1c9c3f[_0xaac0('0x7b')],'custom':_[_0xaac0('0x7c')](_0x1c9c3f[_0xaac0('0x33')],_0xaac0('0x7d'))?!![]:![],'options':_0x1c9c3f[_0xaac0('0x37')][_0xaac0('0x33')]==='picklist'&&_0x1c9c3f['type'][_0xaac0('0x7e')][_0xaac0('0x3f')]>0x0?_[_0xaac0('0x48')](_0x1c9c3f[_0xaac0('0x37')][_0xaac0('0x7e')],function(_0x4d7201){return{'name':_0x4d7201['label'],'value':_0x4d7201[_0xaac0('0x7f')]};}):[]};})};}})['then'](respondWithResult(_0x2e0646,null))['catch'](function(_0x27436b){console['log'](_0xaac0('0x80')+_0x27436b);var _0x56b0b9=_0x70e4ac[_0xaac0('0x39')][_0xaac0('0x81')]?0x1f4:_0x27436b[_0xaac0('0x82')]||0x1f4;logger[_0xaac0('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x56b0b9,JSON[_0xaac0('0x23')](_0x27436b));delete _0x27436b[_0xaac0('0x33')];if(_0x56b0b9===0x191){_0x56b0b9=0x190;}_0x2e0646['status'](_0x56b0b9)[_0xaac0('0x34')](_0x70e4ac[_0xaac0('0x39')][_0xaac0('0x81')]?{'message':_0xaac0('0x83'),'statusCode':_0x27436b[_0xaac0('0x82')]}:_0x27436b);});}; \ No newline at end of file +var _0x4b1e=['remoteUri','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','reference','owner','remove','includes','false','startsWith','cf_','picklistValues','label','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','count','offset','status','apply','reject','save','update','then','stack','name','send','index','map','VtigerAccount','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description'];(function(_0x43c62f,_0x539ddf){var _0x50a638=function(_0x3117b2){while(--_0x3117b2){_0x43c62f['push'](_0x43c62f['shift']());}};_0x50a638(++_0x539ddf);}(_0x4b1e,0x11f));var _0xe4b1=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x4b1e[_0x1ac6ec];return _0x48a489;};'use strict';var pdf=require(_0xe4b1('0x0'));var emlformat=require(_0xe4b1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe4b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4b1('0x3'));var moment=require(_0xe4b1('0x4'));var BPromise=require(_0xe4b1('0x5'));var Mustache=require(_0xe4b1('0x6'));var util=require(_0xe4b1('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe4b1('0x8'));var deskjs=require(_0xe4b1('0x9'));var toCsv=require(_0xe4b1('0xa'));var querystring=require(_0xe4b1('0xb'));var Papa=require('papaparse');var Redis=require(_0xe4b1('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe4b1('0xd'));var as=require(_0xe4b1('0xe'));var hardwareService=require(_0xe4b1('0xf'));var logger=require(_0xe4b1('0x10'))(_0xe4b1('0x11'));var utils=require(_0xe4b1('0x12'));var config=require(_0xe4b1('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4b1('0x14'))['db'];var integrations=require(_0xe4b1('0x15'));var jayson=require(_0xe4b1('0x16'));var client=jayson[_0xe4b1('0x17')][_0xe4b1('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5cae14,_0x4ab998,_0xe2df3d,_0x4c199a){return new BPromise(function(_0x3f512a,_0x5cabe6){var _0x47398e=_0x4c199a||client;return _0x47398e[_0xe4b1('0x19')](_0x5cae14,_0xe2df3d)['then'](function(_0x440186){logger[_0xe4b1('0x1a')](_0xe4b1('0x1b'),_0x4ab998,_0xe4b1('0x1c'));logger[_0xe4b1('0x1d')](_0xe4b1('0x1e'),_0x4ab998,_0xe4b1('0x1c'),JSON[_0xe4b1('0x1f')](_0x440186));if(_0x440186['error']){if(_0x440186[_0xe4b1('0x20')][_0xe4b1('0x21')]===0x1f4){logger[_0xe4b1('0x20')](_0xe4b1('0x1b'),_0x4ab998,_0x440186[_0xe4b1('0x20')][_0xe4b1('0x22')]);return _0x5cabe6(_0x440186[_0xe4b1('0x20')][_0xe4b1('0x22')]);}logger['error'](_0xe4b1('0x1b'),_0x4ab998,_0x440186['error']['message']);return _0x3f512a(_0x440186[_0xe4b1('0x20')][_0xe4b1('0x22')]);}else{logger[_0xe4b1('0x1a')](_0xe4b1('0x1b'),_0x4ab998,_0xe4b1('0x1c'));_0x3f512a(_0x440186[_0xe4b1('0x23')][_0xe4b1('0x22')]);}})['catch'](function(_0x3c5e55){logger[_0xe4b1('0x20')](_0xe4b1('0x1b'),_0x4ab998,_0x3c5e55);_0x5cabe6(_0x3c5e55);});});}function respondWithStatusCode(_0x3da249,_0x5d1f07){_0x5d1f07=_0x5d1f07||0xcc;return function(_0x447a42){if(_0x447a42){return _0x3da249[_0xe4b1('0x24')](_0x5d1f07);}return _0x3da249['status'](_0x5d1f07)[_0xe4b1('0x25')]();};}function respondWithResult(_0x2bbee8,_0x1a83b8){_0x1a83b8=_0x1a83b8||0xc8;return function(_0x13e369){if(_0x13e369){return _0x2bbee8['status'](_0x1a83b8)['json'](_0x13e369);}};}function respondWithFilteredResult(_0x46f366,_0x279ca1){return function(_0x40a429){if(_0x40a429){var _0x40e1f7=_0x40a429[_0xe4b1('0x26')],_0x2f0e00=_0x279ca1[_0xe4b1('0x27')],_0x594d04=_0x279ca1[_0xe4b1('0x27')]+_0x279ca1['limit'],_0x957603;if(_0x594d04>=_0x40e1f7){_0x594d04=_0x40e1f7;_0x957603=0xc8;}else{_0x957603=0xce;}_0x46f366[_0xe4b1('0x28')](_0x957603);return _0x46f366['set']('Content-Range',_0x2f0e00+'-'+_0x594d04+'/'+_0x40e1f7)['json'](_0x40a429);}return null;};}function patchUpdates(_0x2f7d54){return function(_0xa357d7){try{jsonpatch[_0xe4b1('0x29')](_0xa357d7,_0x2f7d54,!![]);}catch(_0x4fb64b){return BPromise[_0xe4b1('0x2a')](_0x4fb64b);}return _0xa357d7[_0xe4b1('0x2b')]();};}function saveUpdates(_0x46a32d,_0xb0ba86){return function(_0x34e297){if(_0x34e297){return _0x34e297[_0xe4b1('0x2c')](_0x46a32d)[_0xe4b1('0x2d')](function(_0x2cc247){return _0x2cc247;});}return null;};}function removeEntity(_0x5e786a,_0x5c26ca){return function(_0x59f130){if(_0x59f130){return _0x59f130['destroy']()[_0xe4b1('0x2d')](function(){_0x5e786a[_0xe4b1('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74de16,_0x3eda85){return function(_0xc5b9ea){if(!_0xc5b9ea){_0x74de16[_0xe4b1('0x24')](0x194);}return _0xc5b9ea;};}function handleError(_0x653bd5,_0x5c0112){_0x5c0112=_0x5c0112||0x1f4;return function(_0x441d45){logger[_0xe4b1('0x20')](_0x441d45[_0xe4b1('0x2e')]);if(_0x441d45[_0xe4b1('0x2f')]){delete _0x441d45[_0xe4b1('0x2f')];}_0x653bd5[_0xe4b1('0x28')](_0x5c0112)[_0xe4b1('0x30')](_0x441d45);};}exports[_0xe4b1('0x31')]=function(_0xee58c3,_0x2711d5){var _0x2fdadc={},_0x34874a={},_0x29daa6={'count':0x0,'rows':[]};var _0x47111d=_[_0xe4b1('0x32')](db[_0xe4b1('0x33')]['rawAttributes'],function(_0xbdabc8){return{'name':_0xbdabc8['fieldName'],'type':_0xbdabc8[_0xe4b1('0x34')][_0xe4b1('0x35')]};});_0x34874a[_0xe4b1('0x36')]=_['map'](_0x47111d,'name');_0x34874a[_0xe4b1('0x37')]=_['keys'](_0xee58c3[_0xe4b1('0x37')]);_0x34874a[_0xe4b1('0x38')]=_[_0xe4b1('0x39')](_0x34874a[_0xe4b1('0x36')],_0x34874a[_0xe4b1('0x37')]);_0x2fdadc[_0xe4b1('0x3a')]=_['intersection'](_0x34874a[_0xe4b1('0x36')],qs[_0xe4b1('0x3b')](_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x3b')]));_0x2fdadc[_0xe4b1('0x3a')]=_0x2fdadc[_0xe4b1('0x3a')][_0xe4b1('0x3c')]?_0x2fdadc[_0xe4b1('0x3a')]:_0x34874a[_0xe4b1('0x36')];if(!_0xee58c3[_0xe4b1('0x37')]['hasOwnProperty'](_0xe4b1('0x3d'))){_0x2fdadc[_0xe4b1('0x3e')]=qs[_0xe4b1('0x3e')](_0xee58c3[_0xe4b1('0x37')]['limit']);_0x2fdadc['offset']=qs['offset'](_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x27')]);}_0x2fdadc['order']=qs['sort'](_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x3f')]);_0x2fdadc[_0xe4b1('0x40')]=qs[_0xe4b1('0x38')](_[_0xe4b1('0x41')](_0xee58c3[_0xe4b1('0x37')],_0x34874a[_0xe4b1('0x38')]),_0x47111d);if(_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x42')]){_0x2fdadc[_0xe4b1('0x40')]=_[_0xe4b1('0x43')](_0x2fdadc[_0xe4b1('0x40')],{'$or':_[_0xe4b1('0x32')](_0x47111d,function(_0x27e116){if(_0x27e116[_0xe4b1('0x34')]!==_0xe4b1('0x44')){var _0x4231eb={};_0x4231eb[_0x27e116[_0xe4b1('0x2f')]]={'$like':'%'+_0xee58c3['query'][_0xe4b1('0x42')]+'%'};return _0x4231eb;}})});}_0x2fdadc=_[_0xe4b1('0x43')]({},_0x2fdadc,_0xee58c3[_0xe4b1('0x45')]);var _0x3591b8={'where':_0x2fdadc[_0xe4b1('0x40')]};return db[_0xe4b1('0x33')][_0xe4b1('0x26')](_0x3591b8)['then'](function(_0x5d7975){_0x29daa6[_0xe4b1('0x26')]=_0x5d7975;if(_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x46')]){_0x2fdadc[_0xe4b1('0x47')]=[{'all':!![]}];}return db[_0xe4b1('0x33')]['findAll'](_0x2fdadc);})[_0xe4b1('0x2d')](function(_0x2de38f){_0x29daa6[_0xe4b1('0x48')]=_0x2de38f;return _0x29daa6;})['then'](respondWithFilteredResult(_0x2711d5,_0x2fdadc))[_0xe4b1('0x49')](handleError(_0x2711d5,null));};exports[_0xe4b1('0x4a')]=function(_0x1affec,_0x333453){var _0xefbb0f={'raw':![],'where':{'id':_0x1affec[_0xe4b1('0x4b')]['id']}},_0x40a08b={};_0x40a08b['model']=_[_0xe4b1('0x4c')](db[_0xe4b1('0x33')][_0xe4b1('0x4d')]);_0x40a08b[_0xe4b1('0x37')]=_['keys'](_0x1affec[_0xe4b1('0x37')]);_0x40a08b[_0xe4b1('0x38')]=_['intersection'](_0x40a08b[_0xe4b1('0x36')],_0x40a08b[_0xe4b1('0x37')]);_0xefbb0f[_0xe4b1('0x3a')]=_['intersection'](_0x40a08b[_0xe4b1('0x36')],qs[_0xe4b1('0x3b')](_0x1affec['query'][_0xe4b1('0x3b')]));_0xefbb0f['attributes']=_0xefbb0f[_0xe4b1('0x3a')]['length']?_0xefbb0f[_0xe4b1('0x3a')]:_0x40a08b[_0xe4b1('0x36')];if(_0x1affec[_0xe4b1('0x37')][_0xe4b1('0x46')]){_0xefbb0f[_0xe4b1('0x47')]=[{'all':!![]}];}_0xefbb0f=_[_0xe4b1('0x43')]({},_0xefbb0f,_0x1affec[_0xe4b1('0x45')]);return db[_0xe4b1('0x33')][_0xe4b1('0x4e')](_0xefbb0f)[_0xe4b1('0x2d')](handleEntityNotFound(_0x333453,null))[_0xe4b1('0x2d')](respondWithResult(_0x333453,null))[_0xe4b1('0x49')](handleError(_0x333453,null));};exports[_0xe4b1('0x4f')]=function(_0x4096ce,_0x5db998){return db[_0xe4b1('0x33')][_0xe4b1('0x4f')](_0x4096ce[_0xe4b1('0x50')],{})[_0xe4b1('0x2d')](respondWithResult(_0x5db998,0xc9))[_0xe4b1('0x49')](handleError(_0x5db998,null));};exports[_0xe4b1('0x2c')]=function(_0x11aa92,_0x211efd){if(_0x11aa92['body']['id']){delete _0x11aa92['body']['id'];}return db['VtigerAccount'][_0xe4b1('0x4e')]({'where':{'id':_0x11aa92['params']['id']}})[_0xe4b1('0x2d')](handleEntityNotFound(_0x211efd,null))[_0xe4b1('0x2d')](saveUpdates(_0x11aa92[_0xe4b1('0x50')],null))['then'](respondWithResult(_0x211efd,null))[_0xe4b1('0x49')](handleError(_0x211efd,null));};exports['destroy']=function(_0x2e1e21,_0x256a3d){return db[_0xe4b1('0x33')]['find']({'where':{'id':_0x2e1e21[_0xe4b1('0x4b')]['id']}})[_0xe4b1('0x2d')](handleEntityNotFound(_0x256a3d,null))['then'](removeEntity(_0x256a3d,null))[_0xe4b1('0x49')](handleError(_0x256a3d,null));};exports[_0xe4b1('0x51')]=function(_0xf1bb7b,_0x2e2b1e,_0x1ef3cc){var _0xccb282={};var _0x55a728={};var _0x168bc5;var _0x1a3e42;return db[_0xe4b1('0x33')][_0xe4b1('0x52')]({'where':{'id':_0xf1bb7b[_0xe4b1('0x4b')]['id']}})[_0xe4b1('0x2d')](handleEntityNotFound(_0x2e2b1e,null))[_0xe4b1('0x2d')](function(_0x405682){if(_0x405682){_0x168bc5=_0x405682;_0x55a728[_0xe4b1('0x36')]=_[_0xe4b1('0x4c')](db[_0xe4b1('0x53')][_0xe4b1('0x4d')]);_0x55a728[_0xe4b1('0x37')]=_[_0xe4b1('0x4c')](_0xf1bb7b[_0xe4b1('0x37')]);_0x55a728[_0xe4b1('0x38')]=_[_0xe4b1('0x39')](_0x55a728['model'],_0x55a728['query']);_0xccb282[_0xe4b1('0x3a')]=_[_0xe4b1('0x39')](_0x55a728[_0xe4b1('0x36')],qs[_0xe4b1('0x3b')](_0xf1bb7b[_0xe4b1('0x37')]['fields']));_0xccb282['attributes']=_0xccb282[_0xe4b1('0x3a')][_0xe4b1('0x3c')]?_0xccb282[_0xe4b1('0x3a')]:_0x55a728[_0xe4b1('0x36')];_0xccb282[_0xe4b1('0x54')]=qs['sort'](_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x3f')]);_0xccb282[_0xe4b1('0x40')]=qs[_0xe4b1('0x38')](_[_0xe4b1('0x41')](_0xf1bb7b[_0xe4b1('0x37')],_0x55a728['filters']));if(_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x42')]){_0xccb282['where']=_[_0xe4b1('0x43')](_0xccb282[_0xe4b1('0x40')],{'$or':_[_0xe4b1('0x32')](_0xccb282[_0xe4b1('0x3a')],function(_0x5cc0e6){var _0x4b3de7={};_0x4b3de7[_0x5cc0e6]={'$like':'%'+_0xf1bb7b['query'][_0xe4b1('0x42')]+'%'};return _0x4b3de7;})});}_0xccb282=_[_0xe4b1('0x43')]({},_0xccb282,_0xf1bb7b[_0xe4b1('0x45')]);return _0x168bc5[_0xe4b1('0x51')](_0xccb282);}})['then'](function(_0x4398d7){if(_0x4398d7){_0x1a3e42=_0x4398d7['length'];if(!_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x55')]('nolimit')){_0xccb282['limit']=qs[_0xe4b1('0x3e')](_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x3e')]);_0xccb282[_0xe4b1('0x27')]=qs[_0xe4b1('0x27')](_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x27')]);}return _0x168bc5[_0xe4b1('0x51')](_0xccb282);}})[_0xe4b1('0x2d')](function(_0x14b7a0){if(_0x14b7a0){return _0x14b7a0?{'count':_0x1a3e42,'rows':_0x14b7a0}:null;}})[_0xe4b1('0x2d')](respondWithResult(_0x2e2b1e,null))[_0xe4b1('0x49')](handleError(_0x2e2b1e,null));};exports[_0xe4b1('0x56')]=function(_0x5f17e9,_0x9dc12c,_0xc83d32){if(_0x5f17e9[_0xe4b1('0x50')]['id']){delete _0x5f17e9[_0xe4b1('0x50')]['id'];}return db[_0xe4b1('0x33')]['findOne']({'where':{'id':_0x5f17e9[_0xe4b1('0x4b')]['id']}})[_0xe4b1('0x2d')](handleEntityNotFound(_0x9dc12c,null))['then'](function(_0x14ec28){if(_0x14ec28){_0x5f17e9[_0xe4b1('0x50')]['AccountId']=_0x14ec28['id'];_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x57')]=integrations[_0xe4b1('0x58')](_0x5f17e9['body'][_0xe4b1('0x59')],_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x34')]);_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x5a')]=integrations[_0xe4b1('0x5b')](_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x59')],_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x34')]);return db[_0xe4b1('0x53')]['create'](_0x5f17e9['body'],{'include':[{'model':db[_0xe4b1('0x5c')],'as':_0xe4b1('0x57')},{'model':db[_0xe4b1('0x5c')],'as':_0xe4b1('0x5a')}]});}return null;})[_0xe4b1('0x2d')](respondWithResult(_0x9dc12c,null))[_0xe4b1('0x49')](handleError(_0x9dc12c,null));};var md5=require(_0xe4b1('0x5d'));exports[_0xe4b1('0x5e')]=function(_0x2cf974,_0x2c6496,_0x285d7a){var _0x381ac6=null;var _0x328db3=null;var _0x438dda=null;var _0x4fd06a=null;var _0x1ca35e='';return db[_0xe4b1('0x33')]['findOne']({'where':{'id':_0x2cf974[_0xe4b1('0x4b')]['id']},'attributes':['id',_0xe4b1('0x2f'),_0xe4b1('0x5f'),_0xe4b1('0x60'),'moduleName',_0xe4b1('0x61'),'serverUrl','accessKey']})['then'](handleEntityNotFound(_0x2c6496,null))[_0xe4b1('0x2d')](function(_0x365698){if(_0x365698){_0x381ac6=_0x365698[_0xe4b1('0x5f')];_0x328db3=_0x365698[_0xe4b1('0x62')];_0x438dda=_0x365698[_0xe4b1('0x63')];_0x1ca35e=_0x365698[_0xe4b1('0x61')];var _0x2251a3=_0x1ca35e[_0xe4b1('0x64')](-0x1);if(_0x2251a3==='/'){_0x1ca35e=_0x1ca35e[_0xe4b1('0x65')](0x0,_0x1ca35e[_0xe4b1('0x66')](_0x2251a3));}_0x4fd06a=util[_0xe4b1('0x67')](_0xe4b1('0x68'),_0x1ca35e);var _0x54ddf5={'method':_0xe4b1('0x69'),'uri':_0x4fd06a,'qs':{'operation':_0xe4b1('0x6a'),'username':_0x365698[_0xe4b1('0x5f')]},'json':!![]};return rp(_0x54ddf5);}})['then'](function(_0x5538a8){if(_0x5538a8[_0xe4b1('0x6b')]){var _0x1ced6b={'method':_0xe4b1('0x6c'),'uri':_0x4fd06a,'form':{'operation':_0xe4b1('0x6d'),'username':_0x381ac6,'accessKey':md5(_0x5538a8[_0xe4b1('0x23')][_0xe4b1('0x6e')]+_0x328db3)},'json':!![]};return rp(_0x1ced6b);}})[_0xe4b1('0x2d')](function(_0x2c670a){if(_0x2c670a['success']){var _0x2d0f3f={'method':_0xe4b1('0x69'),'uri':_0x4fd06a,'qs':{'operation':_0xe4b1('0x6f'),'username':_0x381ac6,'sessionName':_0x2c670a['result'][_0xe4b1('0x70')],'elementType':_0x438dda},'json':!![]};return rp(_0x2d0f3f);}})[_0xe4b1('0x2d')](function(_0x2b911a){if(_0x2b911a[_0xe4b1('0x6b')]){var _0xa82aa6=['autogenerated',_0xe4b1('0x71'),_0xe4b1('0x72')];_[_0xe4b1('0x73')](_0x2b911a[_0xe4b1('0x23')][_0xe4b1('0x3b')],function(_0xbeb077){return _0xa82aa6[_0xe4b1('0x74')](_0xbeb077[_0xe4b1('0x34')][_0xe4b1('0x2f')]);});_['remove'](_0x2b911a[_0xe4b1('0x23')][_0xe4b1('0x3b')],function(_0x5d6f8c){return _0x5d6f8c['editable']===_0xe4b1('0x75');});return{'count':_0x2b911a[_0xe4b1('0x23')][_0xe4b1('0x3b')][_0xe4b1('0x3c')],'rows':_['map'](_0x2b911a[_0xe4b1('0x23')][_0xe4b1('0x3b')],function(_0x117801){return{'id':_0x117801[_0xe4b1('0x2f')],'name':_0x117801['label'],'custom':_[_0xe4b1('0x76')](_0x117801[_0xe4b1('0x2f')],_0xe4b1('0x77'))?!![]:![],'options':_0x117801[_0xe4b1('0x34')][_0xe4b1('0x2f')]==='picklist'&&_0x117801['type'][_0xe4b1('0x78')][_0xe4b1('0x3c')]>0x0?_[_0xe4b1('0x32')](_0x117801['type'][_0xe4b1('0x78')],function(_0x4ce52a){return{'name':_0x4ce52a[_0xe4b1('0x79')],'value':_0x4ce52a[_0xe4b1('0x7a')]};}):[]};})};}})[_0xe4b1('0x2d')](respondWithResult(_0x2c6496,null))[_0xe4b1('0x49')](function(_0x7d51e2){console[_0xe4b1('0x7b')](_0xe4b1('0x7c')+_0x7d51e2);var _0x40b407=_0x2cf974[_0xe4b1('0x37')][_0xe4b1('0x7d')]?0x1f4:_0x7d51e2['statusCode']||0x1f4;logger[_0xe4b1('0x20')](_0xe4b1('0x7e'),'getFields',_0x40b407,JSON['stringify'](_0x7d51e2));delete _0x7d51e2[_0xe4b1('0x2f')];if(_0x40b407===0x191){_0x40b407=0x190;}_0x2c6496['status'](_0x40b407)[_0xe4b1('0x30')](_0x2cf974[_0xe4b1('0x37')]['test']?{'message':_0xe4b1('0x7f'),'statusCode':_0x7d51e2['statusCode']}:_0x7d51e2);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index db0825f..82a2bfa 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.model.js +++ b/server/api/intVtigerAccount/intVtigerAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4d8=['VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerAccount.attributes'];(function(_0x23651b,_0x5741ae){var _0xd5c714=function(_0x1d5b0d){while(--_0x1d5b0d){_0x23651b['push'](_0x23651b['shift']());}};_0xd5c714(++_0x5741ae);}(_0xe4d8,0x1ba));var _0x8e4d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe4d8[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x8e4d('0x0'));var util=require('util');var logger=require(_0x8e4d('0x1'))(_0x8e4d('0x2'));var moment=require(_0x8e4d('0x3'));var BPromise=require(_0x8e4d('0x4'));var rp=require(_0x8e4d('0x5'));var fs=require('fs');var path=require(_0x8e4d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8e4d('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x534c35,_0x6bb11b){return _0x534c35['define'](_0x8e4d('0x8'),attributes,{'tableName':_0x8e4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7697=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration'];(function(_0xec7fa,_0x3d0aa2){var _0x2586c4=function(_0x476f2c){while(--_0x476f2c){_0xec7fa['push'](_0xec7fa['shift']());}};_0x2586c4(++_0x3d0aa2);}(_0x7697,0x1a4));var _0x7769=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x7697[_0x4206f5];return _0xa29cf3;};'use strict';var _=require(_0x7769('0x0'));var util=require('util');var logger=require(_0x7769('0x1'))(_0x7769('0x2'));var moment=require(_0x7769('0x3'));var BPromise=require(_0x7769('0x4'));var rp=require(_0x7769('0x5'));var fs=require('fs');var path=require(_0x7769('0x6'));var rimraf=require('rimraf');var config=require(_0x7769('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x7769('0x8'));module[_0x7769('0x9')]=function(_0x5081d4,_0x5da26d){return _0x5081d4[_0x7769('0xa')](_0x7769('0xb'),attributes,{'tableName':_0x7769('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index d13f421..6c86fe6 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2d7=['GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','where','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xa2d7,0x1bc));var _0x7a2d=function(_0x3b48f1,_0x1d3584){_0x3b48f1=_0x3b48f1-0x0;var _0xf2711d=_0xa2d7[_0x3b48f1];return _0xf2711d;};'use strict';var _=require(_0x7a2d('0x0'));var util=require('util');var moment=require(_0x7a2d('0x1'));var BPromise=require(_0x7a2d('0x2'));var rs=require(_0x7a2d('0x3'));var fs=require('fs');var Redis=require(_0x7a2d('0x4'));var db=require(_0x7a2d('0x5'))['db'];var utils=require(_0x7a2d('0x6'));var logger=require(_0x7a2d('0x7'))(_0x7a2d('0x8'));var config=require(_0x7a2d('0x9'));var jayson=require(_0x7a2d('0xa'));var client=jayson[_0x7a2d('0xb')][_0x7a2d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x503f1a,_0x8234a9,_0x472ad0){return new BPromise(function(_0x34529b,_0x2e1a6c){return client['request'](_0x503f1a,_0x472ad0)[_0x7a2d('0xd')](function(_0x2a9483){logger[_0x7a2d('0xe')](_0x7a2d('0xf'),_0x8234a9,_0x7a2d('0x10'));logger[_0x7a2d('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x8234a9,_0x7a2d('0x10'),JSON[_0x7a2d('0x12')](_0x2a9483));if(_0x2a9483[_0x7a2d('0x13')]){if(_0x2a9483[_0x7a2d('0x13')][_0x7a2d('0x14')]===0x1f4){logger[_0x7a2d('0x13')](_0x7a2d('0xf'),_0x8234a9,_0x2a9483[_0x7a2d('0x13')]['message']);return _0x2e1a6c(_0x2a9483['error'][_0x7a2d('0x15')]);}logger[_0x7a2d('0x13')](_0x7a2d('0xf'),_0x8234a9,_0x2a9483[_0x7a2d('0x13')][_0x7a2d('0x15')]);return _0x34529b(_0x2a9483[_0x7a2d('0x13')][_0x7a2d('0x15')]);}else{logger['info'](_0x7a2d('0xf'),_0x8234a9,_0x7a2d('0x10'));_0x34529b(_0x2a9483[_0x7a2d('0x16')][_0x7a2d('0x15')]);}})[_0x7a2d('0x17')](function(_0x38813e){logger['error'](_0x7a2d('0xf'),_0x8234a9,_0x38813e);_0x2e1a6c(_0x38813e);});});}exports[_0x7a2d('0x18')]=function(_0x383e43){var _0x53ecb6=this;return new Promise(function(_0x5bf242,_0x3c5d67){return db[_0x7a2d('0x19')][_0x7a2d('0x1a')]({'raw':_0x383e43[_0x7a2d('0x1b')]?_0x383e43[_0x7a2d('0x1b')][_0x7a2d('0x1c')]===undefined?!![]:![]:!![],'where':_0x383e43[_0x7a2d('0x1b')]?_0x383e43[_0x7a2d('0x1b')]['where']||null:null,'attributes':_0x383e43['options']?_0x383e43[_0x7a2d('0x1b')][_0x7a2d('0x1d')]||null:null,'limit':_0x383e43['options']?_0x383e43['options'][_0x7a2d('0x1e')]||null:null,'include':_0x383e43[_0x7a2d('0x1b')]?_0x383e43[_0x7a2d('0x1b')][_0x7a2d('0x1f')]?_[_0x7a2d('0x20')](_0x383e43[_0x7a2d('0x1b')][_0x7a2d('0x1f')],function(_0x1489f2){return{'model':db[_0x1489f2[_0x7a2d('0x21')]],'as':_0x1489f2['as'],'attributes':_0x1489f2[_0x7a2d('0x1d')],'include':_0x1489f2[_0x7a2d('0x1f')]?_[_0x7a2d('0x20')](_0x1489f2['include'],function(_0x2f1a80){return{'model':db[_0x2f1a80[_0x7a2d('0x21')]],'as':_0x2f1a80['as'],'attributes':_0x2f1a80[_0x7a2d('0x1d')],'include':_0x2f1a80[_0x7a2d('0x1f')]?_['map'](_0x2f1a80[_0x7a2d('0x1f')],function(_0x16ec07){return{'model':db[_0x16ec07['model']],'as':_0x16ec07['as'],'attributes':_0x16ec07[_0x7a2d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cf1b7){logger[_0x7a2d('0xe')](_0x7a2d('0x18'),_0x383e43);logger['debug'](_0x7a2d('0x18'),_0x383e43,JSON[_0x7a2d('0x12')](_0x2cf1b7));_0x5bf242(_0x2cf1b7);})[_0x7a2d('0x17')](function(_0x4db356){logger['error'](_0x7a2d('0x18'),_0x4db356['message'],_0x383e43);_0x3c5d67(_0x53ecb6[_0x7a2d('0x13')](0x1f4,_0x4db356[_0x7a2d('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x1831a7){var _0x5200e5=this;return new Promise(function(_0x599599,_0x3440b4){return db[_0x7a2d('0x19')]['find']({'raw':_0x1831a7[_0x7a2d('0x1b')]?_0x1831a7[_0x7a2d('0x1b')][_0x7a2d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1831a7[_0x7a2d('0x1b')]?_0x1831a7[_0x7a2d('0x1b')][_0x7a2d('0x22')]||null:null,'attributes':_0x1831a7[_0x7a2d('0x1b')]?_0x1831a7[_0x7a2d('0x1b')][_0x7a2d('0x1d')]||null:null,'include':_0x1831a7['options']?_0x1831a7[_0x7a2d('0x1b')][_0x7a2d('0x1f')]?_[_0x7a2d('0x20')](_0x1831a7[_0x7a2d('0x1b')][_0x7a2d('0x1f')],function(_0x3a9fe0){return{'model':db[_0x3a9fe0['model']],'as':_0x3a9fe0['as'],'attributes':_0x3a9fe0[_0x7a2d('0x1d')],'include':_0x3a9fe0[_0x7a2d('0x1f')]?_[_0x7a2d('0x20')](_0x3a9fe0['include'],function(_0xa67c85){return{'model':db[_0xa67c85[_0x7a2d('0x21')]],'as':_0xa67c85['as'],'attributes':_0xa67c85[_0x7a2d('0x1d')],'include':_0xa67c85['include']?_[_0x7a2d('0x20')](_0xa67c85[_0x7a2d('0x1f')],function(_0x39dca0){return{'model':db[_0x39dca0[_0x7a2d('0x21')]],'as':_0x39dca0['as'],'attributes':_0x39dca0[_0x7a2d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x258a14){logger[_0x7a2d('0xe')](_0x7a2d('0x23'),_0x1831a7);logger[_0x7a2d('0x11')](_0x7a2d('0x23'),_0x1831a7,JSON[_0x7a2d('0x12')](_0x258a14));_0x599599(_0x258a14);})[_0x7a2d('0x17')](function(_0x1f6089){logger['error'](_0x7a2d('0x23'),_0x1f6089[_0x7a2d('0x15')],_0x1831a7);_0x3440b4(_0x5200e5[_0x7a2d('0x13')](0x1f4,_0x1f6089[_0x7a2d('0x15')]));});});}; \ No newline at end of file +var _0x1076=['GetVtigerAccount','VtigerAccount','options','where','attributes','limit','include','map','model','debug','ShowVtigerAccount','raw','info','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x1076,0x126));var _0x6107=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x1076[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x6107('0x0'));var moment=require(_0x6107('0x1'));var BPromise=require(_0x6107('0x2'));var rs=require(_0x6107('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6107('0x4'))['db'];var utils=require(_0x6107('0x5'));var logger=require(_0x6107('0x6'))('rpc');var config=require(_0x6107('0x7'));var jayson=require(_0x6107('0x8'));var client=jayson[_0x6107('0x9')][_0x6107('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x569b67,_0x24b6ff,_0x4676e1){return new BPromise(function(_0x5704eb,_0x5e493f){return client[_0x6107('0xb')](_0x569b67,_0x4676e1)[_0x6107('0xc')](function(_0x1ee71a){logger['info'](_0x6107('0xd'),_0x24b6ff,_0x6107('0xe'));logger['debug'](_0x6107('0xf'),_0x24b6ff,_0x6107('0xe'),JSON['stringify'](_0x1ee71a));if(_0x1ee71a[_0x6107('0x10')]){if(_0x1ee71a['error'][_0x6107('0x11')]===0x1f4){logger[_0x6107('0x10')](_0x6107('0xd'),_0x24b6ff,_0x1ee71a[_0x6107('0x10')][_0x6107('0x12')]);return _0x5e493f(_0x1ee71a[_0x6107('0x10')][_0x6107('0x12')]);}logger[_0x6107('0x10')](_0x6107('0xd'),_0x24b6ff,_0x1ee71a['error']['message']);return _0x5704eb(_0x1ee71a['error'][_0x6107('0x12')]);}else{logger['info'](_0x6107('0xd'),_0x24b6ff,_0x6107('0xe'));_0x5704eb(_0x1ee71a[_0x6107('0x13')][_0x6107('0x12')]);}})[_0x6107('0x14')](function(_0x23193c){logger['error'](_0x6107('0xd'),_0x24b6ff,_0x23193c);_0x5e493f(_0x23193c);});});}exports[_0x6107('0x15')]=function(_0x16998a){var _0x26ff06=this;return new Promise(function(_0x3bdff2,_0x389cd4){return db[_0x6107('0x16')]['findAll']({'raw':_0x16998a[_0x6107('0x17')]?_0x16998a[_0x6107('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x16998a['options']?_0x16998a['options'][_0x6107('0x18')]||null:null,'attributes':_0x16998a[_0x6107('0x17')]?_0x16998a[_0x6107('0x17')][_0x6107('0x19')]||null:null,'limit':_0x16998a['options']?_0x16998a[_0x6107('0x17')][_0x6107('0x1a')]||null:null,'include':_0x16998a['options']?_0x16998a[_0x6107('0x17')][_0x6107('0x1b')]?_[_0x6107('0x1c')](_0x16998a['options'][_0x6107('0x1b')],function(_0x52c39d){return{'model':db[_0x52c39d[_0x6107('0x1d')]],'as':_0x52c39d['as'],'attributes':_0x52c39d['attributes'],'include':_0x52c39d['include']?_[_0x6107('0x1c')](_0x52c39d[_0x6107('0x1b')],function(_0x185e0c){return{'model':db[_0x185e0c['model']],'as':_0x185e0c['as'],'attributes':_0x185e0c[_0x6107('0x19')],'include':_0x185e0c[_0x6107('0x1b')]?_['map'](_0x185e0c['include'],function(_0x126114){return{'model':db[_0x126114['model']],'as':_0x126114['as'],'attributes':_0x126114['attributes']};}):[]};}):[]};}):[]:[]})[_0x6107('0xc')](function(_0x5233a7){logger['info'](_0x6107('0x15'),_0x16998a);logger[_0x6107('0x1e')](_0x6107('0x15'),_0x16998a,JSON['stringify'](_0x5233a7));_0x3bdff2(_0x5233a7);})[_0x6107('0x14')](function(_0x263d1f){logger['error'](_0x6107('0x15'),_0x263d1f['message'],_0x16998a);_0x389cd4(_0x26ff06[_0x6107('0x10')](0x1f4,_0x263d1f[_0x6107('0x12')]));});});};exports[_0x6107('0x1f')]=function(_0x5f4e40){var _0x2e4e8e=this;return new Promise(function(_0x42d583,_0x93ad0b){return db[_0x6107('0x16')]['find']({'raw':_0x5f4e40[_0x6107('0x17')]?_0x5f4e40['options'][_0x6107('0x20')]===undefined?!![]:![]:!![],'where':_0x5f4e40[_0x6107('0x17')]?_0x5f4e40[_0x6107('0x17')][_0x6107('0x18')]||null:null,'attributes':_0x5f4e40['options']?_0x5f4e40[_0x6107('0x17')][_0x6107('0x19')]||null:null,'include':_0x5f4e40[_0x6107('0x17')]?_0x5f4e40[_0x6107('0x17')]['include']?_[_0x6107('0x1c')](_0x5f4e40['options'][_0x6107('0x1b')],function(_0x28e7a1){return{'model':db[_0x28e7a1[_0x6107('0x1d')]],'as':_0x28e7a1['as'],'attributes':_0x28e7a1['attributes'],'include':_0x28e7a1[_0x6107('0x1b')]?_[_0x6107('0x1c')](_0x28e7a1[_0x6107('0x1b')],function(_0x513bcf){return{'model':db[_0x513bcf['model']],'as':_0x513bcf['as'],'attributes':_0x513bcf[_0x6107('0x19')],'include':_0x513bcf['include']?_['map'](_0x513bcf[_0x6107('0x1b')],function(_0x37cf10){return{'model':db[_0x37cf10[_0x6107('0x1d')]],'as':_0x37cf10['as'],'attributes':_0x37cf10[_0x6107('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6107('0xc')](function(_0x21f906){logger[_0x6107('0x21')](_0x6107('0x1f'),_0x5f4e40);logger[_0x6107('0x1e')](_0x6107('0x1f'),_0x5f4e40,JSON[_0x6107('0x22')](_0x21f906));_0x42d583(_0x21f906);})['catch'](function(_0x203a90){logger['error']('ShowVtigerAccount',_0x203a90['message'],_0x5f4e40);_0x93ad0b(_0x2e4e8e[_0x6107('0x10')](0x1f4,_0x203a90[_0x6107('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index cc07b35..161f053 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x28b88e,_0x529990){var _0x526026=function(_0x10de34){while(--_0x10de34){_0x28b88e['push'](_0x28b88e['shift']());}};_0x526026(++_0x529990);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3810fd,_0x4a060d){_0x3810fd=_0x3810fd-0x0;var _0x399cca=_0x5f2f[_0x3810fd];return _0x399cca;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ac08f3f..58ab34c 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0578=['STRING'];(function(_0x15726e,_0x36ab1d){var _0x34df3d=function(_0x3bbf1f){while(--_0x3bbf1f){_0x15726e['push'](_0x15726e['shift']());}};_0x34df3d(++_0x36ab1d);}(_0x0578,0x181));var _0x8057=function(_0x193461,_0x42ce71){_0x193461=_0x193461-0x0;var _0x4c237c=_0x0578[_0x193461];return _0x4c237c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8057('0x0')]},'description':{'type':Sequelize[_0x8057('0x0')]}}; \ No newline at end of file +var _0x5b65=['exports','STRING','sequelize'];(function(_0x12f522,_0x1e9fb6){var _0x1e35d4=function(_0x3d854f){while(--_0x3d854f){_0x12f522['push'](_0x12f522['shift']());}};_0x1e35d4(++_0x1e9fb6);}(_0x5b65,0x161));var _0x55b6=function(_0x723d58,_0x34bdce){_0x723d58=_0x723d58-0x0;var _0x12b23d=_0x5b65[_0x723d58];return _0x12b23d;};'use strict';var Sequelize=require(_0x55b6('0x0'));module[_0x55b6('0x1')]={'name':{'type':Sequelize[_0x55b6('0x2')]},'description':{'type':Sequelize[_0x55b6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ef80323..eeda853 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x767d=['pick','filter','merge','VIRTUAL','count','include','rows','show','params','keys','rawAttributes','includeAll','options','find','create','body','update','getFields','order','hasOwnProperty','getSubjects','nolimit','getDescriptions','findOne','VtigerField','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','save','destroy','stack','send','index','map','VtigerConfiguration','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','sort','where'];(function(_0x38a39b,_0x3b3f09){var _0x57a85b=function(_0x4baa17){while(--_0x4baa17){_0x38a39b['push'](_0x38a39b['shift']());}};_0x57a85b(++_0x3b3f09);}(_0x767d,0x11b));var _0xd767=function(_0x45eb82,_0x52593a){_0x45eb82=_0x45eb82-0x0;var _0x145a1d=_0x767d[_0x45eb82];return _0x145a1d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd767('0x0'));var rp=require(_0xd767('0x1'));var moment=require(_0xd767('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd767('0x3'));var util=require(_0xd767('0x4'));var path=require(_0xd767('0x5'));var sox=require(_0xd767('0x6'));var csv=require(_0xd767('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd767('0x8'));var crypto=require(_0xd767('0x9'));var jsforce=require(_0xd767('0xa'));var deskjs=require(_0xd767('0xb'));var toCsv=require(_0xd767('0x7'));var querystring=require('querystring');var Papa=require(_0xd767('0xc'));var Redis=require(_0xd767('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd767('0xe'));var hardwareService=require(_0xd767('0xf'));var logger=require(_0xd767('0x10'))(_0xd767('0x11'));var utils=require(_0xd767('0x12'));var config=require(_0xd767('0x13'));var licenseUtil=require(_0xd767('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd767('0x15'));var client=jayson[_0xd767('0x16')][_0xd767('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x28fd62,_0x32d8f2,_0x4dd664,_0x16e990){return new BPromise(function(_0x45a827,_0x4dd48a){var _0x9f2552=_0x16e990||client;return _0x9f2552[_0xd767('0x18')](_0x28fd62,_0x4dd664)[_0xd767('0x19')](function(_0x245ad2){logger[_0xd767('0x1a')](_0xd767('0x1b'),_0x32d8f2,_0xd767('0x1c'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x32d8f2,_0xd767('0x1c'),JSON[_0xd767('0x1d')](_0x245ad2));if(_0x245ad2[_0xd767('0x1e')]){if(_0x245ad2['error'][_0xd767('0x1f')]===0x1f4){logger[_0xd767('0x1e')](_0xd767('0x1b'),_0x32d8f2,_0x245ad2['error']['message']);return _0x4dd48a(_0x245ad2[_0xd767('0x1e')][_0xd767('0x20')]);}logger[_0xd767('0x1e')](_0xd767('0x1b'),_0x32d8f2,_0x245ad2['error'][_0xd767('0x20')]);return _0x45a827(_0x245ad2[_0xd767('0x1e')][_0xd767('0x20')]);}else{logger[_0xd767('0x1a')](_0xd767('0x1b'),_0x32d8f2,_0xd767('0x1c'));_0x45a827(_0x245ad2['result']['message']);}})[_0xd767('0x21')](function(_0x461caf){logger[_0xd767('0x1e')](_0xd767('0x1b'),_0x32d8f2,_0x461caf);_0x4dd48a(_0x461caf);});});}function respondWithStatusCode(_0x1915ab,_0x3ec97d){_0x3ec97d=_0x3ec97d||0xcc;return function(_0x4b4e04){if(_0x4b4e04){return _0x1915ab[_0xd767('0x22')](_0x3ec97d);}return _0x1915ab[_0xd767('0x23')](_0x3ec97d)['end']();};}function respondWithResult(_0x2b8022,_0x585a82){_0x585a82=_0x585a82||0xc8;return function(_0x3abcd3){if(_0x3abcd3){return _0x2b8022['status'](_0x585a82)[_0xd767('0x24')](_0x3abcd3);}};}function respondWithFilteredResult(_0x4896de,_0xb3abc1){return function(_0x4abcf6){if(_0x4abcf6){var _0x4bacaf=_0x4abcf6['count'],_0x4e4eab=_0xb3abc1['offset'],_0x925b87=_0xb3abc1[_0xd767('0x25')]+_0xb3abc1[_0xd767('0x26')],_0x2ed8f2;if(_0x925b87>=_0x4bacaf){_0x925b87=_0x4bacaf;_0x2ed8f2=0xc8;}else{_0x2ed8f2=0xce;}_0x4896de[_0xd767('0x23')](_0x2ed8f2);return _0x4896de[_0xd767('0x27')](_0xd767('0x28'),_0x4e4eab+'-'+_0x925b87+'/'+_0x4bacaf)[_0xd767('0x24')](_0x4abcf6);}return null;};}function patchUpdates(_0x427bc2){return function(_0x53a5f3){try{jsonpatch['apply'](_0x53a5f3,_0x427bc2,!![]);}catch(_0xf470f1){return BPromise['reject'](_0xf470f1);}return _0x53a5f3[_0xd767('0x29')]();};}function saveUpdates(_0x28c071,_0x4f8cbd){return function(_0x20030a){if(_0x20030a){return _0x20030a['update'](_0x28c071)[_0xd767('0x19')](function(_0x1c23f8){return _0x1c23f8;});}return null;};}function removeEntity(_0x4a3e3f,_0x5284a2){return function(_0x3d1967){if(_0x3d1967){return _0x3d1967[_0xd767('0x2a')]()['then'](function(){_0x4a3e3f[_0xd767('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4acf16,_0x2c88a4){return function(_0x4a61bc){if(!_0x4a61bc){_0x4acf16['sendStatus'](0x194);}return _0x4a61bc;};}function handleError(_0x564204,_0x50df72){_0x50df72=_0x50df72||0x1f4;return function(_0x328959){logger[_0xd767('0x1e')](_0x328959[_0xd767('0x2b')]);if(_0x328959['name']){delete _0x328959['name'];}_0x564204['status'](_0x50df72)[_0xd767('0x2c')](_0x328959);};}exports[_0xd767('0x2d')]=function(_0x217106,_0x375400){var _0x134b7a={},_0x260be6={},_0x4accd5={'count':0x0,'rows':[]};var _0x323cce=_[_0xd767('0x2e')](db[_0xd767('0x2f')]['rawAttributes'],function(_0x6c2cfc){return{'name':_0x6c2cfc[_0xd767('0x30')],'type':_0x6c2cfc[_0xd767('0x31')][_0xd767('0x32')]};});_0x260be6[_0xd767('0x33')]=_[_0xd767('0x2e')](_0x323cce,_0xd767('0x34'));_0x260be6[_0xd767('0x35')]=_['keys'](_0x217106[_0xd767('0x35')]);_0x260be6[_0xd767('0x36')]=_['intersection'](_0x260be6['model'],_0x260be6[_0xd767('0x35')]);_0x134b7a[_0xd767('0x37')]=_[_0xd767('0x38')](_0x260be6[_0xd767('0x33')],qs[_0xd767('0x39')](_0x217106['query'][_0xd767('0x39')]));_0x134b7a[_0xd767('0x37')]=_0x134b7a[_0xd767('0x37')][_0xd767('0x3a')]?_0x134b7a['attributes']:_0x260be6[_0xd767('0x33')];if(!_0x217106[_0xd767('0x35')]['hasOwnProperty']('nolimit')){_0x134b7a[_0xd767('0x26')]=qs[_0xd767('0x26')](_0x217106[_0xd767('0x35')]['limit']);_0x134b7a[_0xd767('0x25')]=qs['offset'](_0x217106[_0xd767('0x35')]['offset']);}_0x134b7a['order']=qs[_0xd767('0x3b')](_0x217106[_0xd767('0x35')]['sort']);_0x134b7a[_0xd767('0x3c')]=qs['filters'](_[_0xd767('0x3d')](_0x217106[_0xd767('0x35')],_0x260be6['filters']),_0x323cce);if(_0x217106['query'][_0xd767('0x3e')]){_0x134b7a[_0xd767('0x3c')]=_[_0xd767('0x3f')](_0x134b7a[_0xd767('0x3c')],{'$or':_['map'](_0x323cce,function(_0x2de0ac){if(_0x2de0ac[_0xd767('0x31')]!==_0xd767('0x40')){var _0x55e395={};_0x55e395[_0x2de0ac[_0xd767('0x34')]]={'$like':'%'+_0x217106[_0xd767('0x35')][_0xd767('0x3e')]+'%'};return _0x55e395;}})});}_0x134b7a=_[_0xd767('0x3f')]({},_0x134b7a,_0x217106['options']);var _0x513c6e={'where':_0x134b7a['where']};return db['VtigerConfiguration'][_0xd767('0x41')](_0x513c6e)['then'](function(_0x181c1a){_0x4accd5[_0xd767('0x41')]=_0x181c1a;if(_0x217106[_0xd767('0x35')]['includeAll']){_0x134b7a[_0xd767('0x42')]=[{'all':!![]}];}return db[_0xd767('0x2f')]['findAll'](_0x134b7a);})[_0xd767('0x19')](function(_0x3a49a0){_0x4accd5[_0xd767('0x43')]=_0x3a49a0;return _0x4accd5;})[_0xd767('0x19')](respondWithFilteredResult(_0x375400,_0x134b7a))[_0xd767('0x21')](handleError(_0x375400,null));};exports[_0xd767('0x44')]=function(_0xc91ac8,_0x21cafc){var _0x38e9ee={'raw':![],'where':{'id':_0xc91ac8[_0xd767('0x45')]['id']}},_0x3d570e={};_0x3d570e['model']=_[_0xd767('0x46')](db[_0xd767('0x2f')][_0xd767('0x47')]);_0x3d570e[_0xd767('0x35')]=_[_0xd767('0x46')](_0xc91ac8[_0xd767('0x35')]);_0x3d570e[_0xd767('0x36')]=_['intersection'](_0x3d570e[_0xd767('0x33')],_0x3d570e[_0xd767('0x35')]);_0x38e9ee[_0xd767('0x37')]=_[_0xd767('0x38')](_0x3d570e[_0xd767('0x33')],qs['fields'](_0xc91ac8[_0xd767('0x35')][_0xd767('0x39')]));_0x38e9ee[_0xd767('0x37')]=_0x38e9ee[_0xd767('0x37')][_0xd767('0x3a')]?_0x38e9ee[_0xd767('0x37')]:_0x3d570e[_0xd767('0x33')];if(_0xc91ac8[_0xd767('0x35')][_0xd767('0x48')]){_0x38e9ee[_0xd767('0x42')]=[{'all':!![]}];}_0x38e9ee=_[_0xd767('0x3f')]({},_0x38e9ee,_0xc91ac8[_0xd767('0x49')]);return db[_0xd767('0x2f')][_0xd767('0x4a')](_0x38e9ee)[_0xd767('0x19')](handleEntityNotFound(_0x21cafc,null))[_0xd767('0x19')](respondWithResult(_0x21cafc,null))[_0xd767('0x21')](handleError(_0x21cafc,null));};exports[_0xd767('0x4b')]=function(_0x154c92,_0x36c197){return db[_0xd767('0x2f')][_0xd767('0x4b')](_0x154c92[_0xd767('0x4c')],{})['then'](respondWithResult(_0x36c197,0xc9))['catch'](handleError(_0x36c197,null));};exports[_0xd767('0x4d')]=function(_0x7d8b69,_0x4e70b6){if(_0x7d8b69[_0xd767('0x4c')]['id']){delete _0x7d8b69['body']['id'];}return db['VtigerConfiguration'][_0xd767('0x4a')]({'where':{'id':_0x7d8b69['params']['id']}})[_0xd767('0x19')](handleEntityNotFound(_0x4e70b6,null))[_0xd767('0x19')](saveUpdates(_0x7d8b69['body'],null))[_0xd767('0x19')](respondWithResult(_0x4e70b6,null))['catch'](handleError(_0x4e70b6,null));};exports['destroy']=function(_0x493911,_0x24f67b){return db['VtigerConfiguration'][_0xd767('0x4a')]({'where':{'id':_0x493911[_0xd767('0x45')]['id']}})[_0xd767('0x19')](handleEntityNotFound(_0x24f67b,null))[_0xd767('0x19')](removeEntity(_0x24f67b,null))[_0xd767('0x21')](handleError(_0x24f67b,null));};exports[_0xd767('0x4e')]=function(_0x439e5c,_0x1a2cab,_0xc9cdcd){var _0xd2bebe={};var _0x24a1fb={};var _0x3843d0;var _0x2e88fa;return db[_0xd767('0x2f')]['findOne']({'where':{'id':_0x439e5c[_0xd767('0x45')]['id']}})[_0xd767('0x19')](handleEntityNotFound(_0x1a2cab,null))[_0xd767('0x19')](function(_0x197cd4){if(_0x197cd4){_0x3843d0=_0x197cd4;_0x24a1fb[_0xd767('0x33')]=_[_0xd767('0x46')](db['VtigerField']['rawAttributes']);_0x24a1fb[_0xd767('0x35')]=_['keys'](_0x439e5c['query']);_0x24a1fb[_0xd767('0x36')]=_[_0xd767('0x38')](_0x24a1fb[_0xd767('0x33')],_0x24a1fb[_0xd767('0x35')]);_0xd2bebe[_0xd767('0x37')]=_[_0xd767('0x38')](_0x24a1fb[_0xd767('0x33')],qs[_0xd767('0x39')](_0x439e5c[_0xd767('0x35')]['fields']));_0xd2bebe[_0xd767('0x37')]=_0xd2bebe[_0xd767('0x37')][_0xd767('0x3a')]?_0xd2bebe[_0xd767('0x37')]:_0x24a1fb['model'];_0xd2bebe[_0xd767('0x4f')]=qs[_0xd767('0x3b')](_0x439e5c[_0xd767('0x35')][_0xd767('0x3b')]);_0xd2bebe['where']=qs[_0xd767('0x36')](_['pick'](_0x439e5c[_0xd767('0x35')],_0x24a1fb[_0xd767('0x36')]));if(_0x439e5c[_0xd767('0x35')][_0xd767('0x3e')]){_0xd2bebe[_0xd767('0x3c')]=_[_0xd767('0x3f')](_0xd2bebe[_0xd767('0x3c')],{'$or':_[_0xd767('0x2e')](_0xd2bebe[_0xd767('0x37')],function(_0x1c57ae){var _0x3c312b={};_0x3c312b[_0x1c57ae]={'$like':'%'+_0x439e5c[_0xd767('0x35')][_0xd767('0x3e')]+'%'};return _0x3c312b;})});}_0xd2bebe=_[_0xd767('0x3f')]({},_0xd2bebe,_0x439e5c[_0xd767('0x49')]);return _0x3843d0[_0xd767('0x4e')](_0xd2bebe);}})[_0xd767('0x19')](function(_0x57f5ec){if(_0x57f5ec){_0x2e88fa=_0x57f5ec[_0xd767('0x3a')];if(!_0x439e5c[_0xd767('0x35')][_0xd767('0x50')]('nolimit')){_0xd2bebe[_0xd767('0x26')]=qs['limit'](_0x439e5c[_0xd767('0x35')][_0xd767('0x26')]);_0xd2bebe[_0xd767('0x25')]=qs[_0xd767('0x25')](_0x439e5c[_0xd767('0x35')][_0xd767('0x25')]);}return _0x3843d0['getFields'](_0xd2bebe);}})['then'](function(_0x196409){if(_0x196409){return _0x196409?{'count':_0x2e88fa,'rows':_0x196409}:null;}})[_0xd767('0x19')](respondWithResult(_0x1a2cab,null))[_0xd767('0x21')](handleError(_0x1a2cab,null));};exports[_0xd767('0x51')]=function(_0x48e9b9,_0x5a510e,_0x130199){var _0x112b60={};var _0x5986fc={};var _0x87c38a;var _0x3f13c6;return db[_0xd767('0x2f')]['findOne']({'where':{'id':_0x48e9b9[_0xd767('0x45')]['id']}})[_0xd767('0x19')](handleEntityNotFound(_0x5a510e,null))[_0xd767('0x19')](function(_0x3c1e76){if(_0x3c1e76){_0x87c38a=_0x3c1e76;_0x5986fc[_0xd767('0x33')]=_['keys'](db['VtigerField'][_0xd767('0x47')]);_0x5986fc[_0xd767('0x35')]=_[_0xd767('0x46')](_0x48e9b9['query']);_0x5986fc[_0xd767('0x36')]=_[_0xd767('0x38')](_0x5986fc[_0xd767('0x33')],_0x5986fc['query']);_0x112b60['attributes']=_[_0xd767('0x38')](_0x5986fc[_0xd767('0x33')],qs[_0xd767('0x39')](_0x48e9b9[_0xd767('0x35')][_0xd767('0x39')]));_0x112b60[_0xd767('0x37')]=_0x112b60[_0xd767('0x37')][_0xd767('0x3a')]?_0x112b60['attributes']:_0x5986fc['model'];_0x112b60[_0xd767('0x4f')]=qs['sort'](_0x48e9b9[_0xd767('0x35')][_0xd767('0x3b')]);_0x112b60['where']=qs['filters'](_[_0xd767('0x3d')](_0x48e9b9[_0xd767('0x35')],_0x5986fc[_0xd767('0x36')]));if(_0x48e9b9[_0xd767('0x35')][_0xd767('0x3e')]){_0x112b60['where']=_[_0xd767('0x3f')](_0x112b60[_0xd767('0x3c')],{'$or':_[_0xd767('0x2e')](_0x112b60[_0xd767('0x37')],function(_0x3d42d0){var _0x223e96={};_0x223e96[_0x3d42d0]={'$like':'%'+_0x48e9b9[_0xd767('0x35')][_0xd767('0x3e')]+'%'};return _0x223e96;})});}_0x112b60=_[_0xd767('0x3f')]({},_0x112b60,_0x48e9b9[_0xd767('0x49')]);return _0x87c38a[_0xd767('0x51')](_0x112b60);}})['then'](function(_0x3ee21e){if(_0x3ee21e){_0x3f13c6=_0x3ee21e[_0xd767('0x3a')];if(!_0x48e9b9['query']['hasOwnProperty'](_0xd767('0x52'))){_0x112b60['limit']=qs['limit'](_0x48e9b9[_0xd767('0x35')][_0xd767('0x26')]);_0x112b60[_0xd767('0x25')]=qs[_0xd767('0x25')](_0x48e9b9[_0xd767('0x35')][_0xd767('0x25')]);}return _0x87c38a[_0xd767('0x51')](_0x112b60);}})[_0xd767('0x19')](function(_0x2209c6){if(_0x2209c6){return _0x2209c6?{'count':_0x3f13c6,'rows':_0x2209c6}:null;}})[_0xd767('0x19')](respondWithResult(_0x5a510e,null))[_0xd767('0x21')](handleError(_0x5a510e,null));};exports[_0xd767('0x53')]=function(_0x33cdc0,_0x2c8af8,_0x1e2f56){var _0xfbe1d6={};var _0x31f4b9={};var _0x57b7c7;var _0x266251;return db[_0xd767('0x2f')][_0xd767('0x54')]({'where':{'id':_0x33cdc0[_0xd767('0x45')]['id']}})[_0xd767('0x19')](handleEntityNotFound(_0x2c8af8,null))[_0xd767('0x19')](function(_0x3a2740){if(_0x3a2740){_0x57b7c7=_0x3a2740;_0x31f4b9[_0xd767('0x33')]=_[_0xd767('0x46')](db[_0xd767('0x55')][_0xd767('0x47')]);_0x31f4b9['query']=_['keys'](_0x33cdc0[_0xd767('0x35')]);_0x31f4b9[_0xd767('0x36')]=_['intersection'](_0x31f4b9[_0xd767('0x33')],_0x31f4b9[_0xd767('0x35')]);_0xfbe1d6[_0xd767('0x37')]=_['intersection'](_0x31f4b9['model'],qs['fields'](_0x33cdc0[_0xd767('0x35')]['fields']));_0xfbe1d6[_0xd767('0x37')]=_0xfbe1d6['attributes'][_0xd767('0x3a')]?_0xfbe1d6['attributes']:_0x31f4b9[_0xd767('0x33')];_0xfbe1d6[_0xd767('0x4f')]=qs[_0xd767('0x3b')](_0x33cdc0[_0xd767('0x35')][_0xd767('0x3b')]);_0xfbe1d6['where']=qs[_0xd767('0x36')](_[_0xd767('0x3d')](_0x33cdc0[_0xd767('0x35')],_0x31f4b9[_0xd767('0x36')]));if(_0x33cdc0[_0xd767('0x35')][_0xd767('0x3e')]){_0xfbe1d6[_0xd767('0x3c')]=_['merge'](_0xfbe1d6[_0xd767('0x3c')],{'$or':_[_0xd767('0x2e')](_0xfbe1d6[_0xd767('0x37')],function(_0x1e4b70){var _0x465bb8={};_0x465bb8[_0x1e4b70]={'$like':'%'+_0x33cdc0[_0xd767('0x35')][_0xd767('0x3e')]+'%'};return _0x465bb8;})});}_0xfbe1d6=_[_0xd767('0x3f')]({},_0xfbe1d6,_0x33cdc0[_0xd767('0x49')]);return _0x57b7c7[_0xd767('0x53')](_0xfbe1d6);}})[_0xd767('0x19')](function(_0xaf8b30){if(_0xaf8b30){_0x266251=_0xaf8b30['length'];if(!_0x33cdc0['query']['hasOwnProperty'](_0xd767('0x52'))){_0xfbe1d6[_0xd767('0x26')]=qs[_0xd767('0x26')](_0x33cdc0['query']['limit']);_0xfbe1d6[_0xd767('0x25')]=qs[_0xd767('0x25')](_0x33cdc0[_0xd767('0x35')][_0xd767('0x25')]);}return _0x57b7c7[_0xd767('0x53')](_0xfbe1d6);}})[_0xd767('0x19')](function(_0x2c7ec4){if(_0x2c7ec4){return _0x2c7ec4?{'count':_0x266251,'rows':_0x2c7ec4}:null;}})[_0xd767('0x19')](respondWithResult(_0x2c8af8,null))['catch'](handleError(_0x2c8af8,null));}; \ No newline at end of file +var _0x597b=['keys','options','create','body','update','find','params','getFields','findOne','pick','getSubjects','VtigerField','getDescriptions','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','client','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','then','destroy','name','index','VtigerConfiguration','rawAttributes','fieldName','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','type','filter','merge','includeAll','findAll','rows','show'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x597b,0x1bc));var _0xb597=function(_0xad7f50,_0x5ad905){_0xad7f50=_0xad7f50-0x0;var _0x2a7362=_0x597b[_0xad7f50];return _0x2a7362;};'use strict';var pdf=require(_0xb597('0x0'));var emlformat=require(_0xb597('0x1'));var rimraf=require(_0xb597('0x2'));var zipdir=require(_0xb597('0x3'));var jsonpatch=require(_0xb597('0x4'));var rp=require(_0xb597('0x5'));var moment=require(_0xb597('0x6'));var BPromise=require(_0xb597('0x7'));var Mustache=require(_0xb597('0x8'));var util=require(_0xb597('0x9'));var path=require(_0xb597('0xa'));var sox=require(_0xb597('0xb'));var csv=require('to-csv');var ejs=require(_0xb597('0xc'));var fs=require('fs');var _=require(_0xb597('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb597('0xe'));var deskjs=require(_0xb597('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb597('0x10'));var Papa=require(_0xb597('0x11'));var Redis=require(_0xb597('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb597('0x13'));var as=require(_0xb597('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb597('0x15'));var config=require(_0xb597('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb597('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb597('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x234008,_0x124dbb,_0x1f19b6,_0x1fa06f){return new BPromise(function(_0x561870,_0xa4315e){var _0x12f041=_0x1fa06f||client;return _0x12f041['request'](_0x234008,_0x1f19b6)['then'](function(_0x42f40a){logger['info'](_0xb597('0x19'),_0x124dbb,_0xb597('0x1a'));logger[_0xb597('0x1b')](_0xb597('0x1c'),_0x124dbb,_0xb597('0x1a'),JSON[_0xb597('0x1d')](_0x42f40a));if(_0x42f40a[_0xb597('0x1e')]){if(_0x42f40a[_0xb597('0x1e')][_0xb597('0x1f')]===0x1f4){logger['error'](_0xb597('0x19'),_0x124dbb,_0x42f40a['error'][_0xb597('0x20')]);return _0xa4315e(_0x42f40a[_0xb597('0x1e')]['message']);}logger['error'](_0xb597('0x19'),_0x124dbb,_0x42f40a[_0xb597('0x1e')][_0xb597('0x20')]);return _0x561870(_0x42f40a['error'][_0xb597('0x20')]);}else{logger[_0xb597('0x21')](_0xb597('0x19'),_0x124dbb,_0xb597('0x1a'));_0x561870(_0x42f40a[_0xb597('0x22')][_0xb597('0x20')]);}})[_0xb597('0x23')](function(_0x298db8){logger[_0xb597('0x1e')](_0xb597('0x19'),_0x124dbb,_0x298db8);_0xa4315e(_0x298db8);});});}function respondWithStatusCode(_0x1621db,_0x2d9ca6){_0x2d9ca6=_0x2d9ca6||0xcc;return function(_0x4efb4c){if(_0x4efb4c){return _0x1621db[_0xb597('0x24')](_0x2d9ca6);}return _0x1621db[_0xb597('0x25')](_0x2d9ca6)[_0xb597('0x26')]();};}function respondWithResult(_0x5c82ba,_0x4ccee8){_0x4ccee8=_0x4ccee8||0xc8;return function(_0xbb012a){if(_0xbb012a){return _0x5c82ba[_0xb597('0x25')](_0x4ccee8)[_0xb597('0x27')](_0xbb012a);}};}function respondWithFilteredResult(_0x1a9fdf,_0x4aaa91){return function(_0x4fccaf){if(_0x4fccaf){var _0x2b13db=_0x4fccaf[_0xb597('0x28')],_0x5b4504=_0x4aaa91['offset'],_0x6eaa63=_0x4aaa91[_0xb597('0x29')]+_0x4aaa91[_0xb597('0x2a')],_0x1dac95;if(_0x6eaa63>=_0x2b13db){_0x6eaa63=_0x2b13db;_0x1dac95=0xc8;}else{_0x1dac95=0xce;}_0x1a9fdf[_0xb597('0x25')](_0x1dac95);return _0x1a9fdf[_0xb597('0x2b')]('Content-Range',_0x5b4504+'-'+_0x6eaa63+'/'+_0x2b13db)['json'](_0x4fccaf);}return null;};}function patchUpdates(_0x4b3184){return function(_0x562c14){try{jsonpatch['apply'](_0x562c14,_0x4b3184,!![]);}catch(_0x1303d4){return BPromise[_0xb597('0x2c')](_0x1303d4);}return _0x562c14['save']();};}function saveUpdates(_0x20e591,_0x5b60e0){return function(_0x135f57){if(_0x135f57){return _0x135f57['update'](_0x20e591)[_0xb597('0x2d')](function(_0x45bd74){return _0x45bd74;});}return null;};}function removeEntity(_0x314699,_0x43ae72){return function(_0x1bb841){if(_0x1bb841){return _0x1bb841[_0xb597('0x2e')]()[_0xb597('0x2d')](function(){_0x314699[_0xb597('0x25')](0xcc)[_0xb597('0x26')]();});}};}function handleEntityNotFound(_0x4098ad,_0x559554){return function(_0x7daeac){if(!_0x7daeac){_0x4098ad[_0xb597('0x24')](0x194);}return _0x7daeac;};}function handleError(_0x44806a,_0x3d0eff){_0x3d0eff=_0x3d0eff||0x1f4;return function(_0x33735c){logger['error'](_0x33735c['stack']);if(_0x33735c[_0xb597('0x2f')]){delete _0x33735c[_0xb597('0x2f')];}_0x44806a[_0xb597('0x25')](_0x3d0eff)['send'](_0x33735c);};}exports[_0xb597('0x30')]=function(_0x18e7d2,_0xe20b0d){var _0x522126={},_0x44c28e={},_0x551d75={'count':0x0,'rows':[]};var _0x53b8a8=_['map'](db[_0xb597('0x31')][_0xb597('0x32')],function(_0x393059){return{'name':_0x393059[_0xb597('0x33')],'type':_0x393059['type'][_0xb597('0x34')]};});_0x44c28e['model']=_[_0xb597('0x35')](_0x53b8a8,'name');_0x44c28e[_0xb597('0x36')]=_['keys'](_0x18e7d2[_0xb597('0x36')]);_0x44c28e['filters']=_[_0xb597('0x37')](_0x44c28e[_0xb597('0x38')],_0x44c28e[_0xb597('0x36')]);_0x522126[_0xb597('0x39')]=_[_0xb597('0x37')](_0x44c28e['model'],qs[_0xb597('0x3a')](_0x18e7d2[_0xb597('0x36')][_0xb597('0x3a')]));_0x522126[_0xb597('0x39')]=_0x522126[_0xb597('0x39')][_0xb597('0x3b')]?_0x522126[_0xb597('0x39')]:_0x44c28e[_0xb597('0x38')];if(!_0x18e7d2[_0xb597('0x36')][_0xb597('0x3c')](_0xb597('0x3d'))){_0x522126[_0xb597('0x2a')]=qs[_0xb597('0x2a')](_0x18e7d2[_0xb597('0x36')][_0xb597('0x2a')]);_0x522126[_0xb597('0x29')]=qs['offset'](_0x18e7d2[_0xb597('0x36')][_0xb597('0x29')]);}_0x522126['order']=qs[_0xb597('0x3e')](_0x18e7d2[_0xb597('0x36')]['sort']);_0x522126[_0xb597('0x3f')]=qs[_0xb597('0x40')](_['pick'](_0x18e7d2[_0xb597('0x36')],_0x44c28e[_0xb597('0x40')]),_0x53b8a8);if(_0x18e7d2[_0xb597('0x36')]['filter']){_0x522126[_0xb597('0x3f')]=_['merge'](_0x522126[_0xb597('0x3f')],{'$or':_['map'](_0x53b8a8,function(_0x5dbe93){if(_0x5dbe93[_0xb597('0x41')]!=='VIRTUAL'){var _0x1e3683={};_0x1e3683[_0x5dbe93['name']]={'$like':'%'+_0x18e7d2[_0xb597('0x36')][_0xb597('0x42')]+'%'};return _0x1e3683;}})});}_0x522126=_[_0xb597('0x43')]({},_0x522126,_0x18e7d2['options']);var _0x3979f0={'where':_0x522126['where']};return db[_0xb597('0x31')][_0xb597('0x28')](_0x3979f0)[_0xb597('0x2d')](function(_0x182b59){_0x551d75['count']=_0x182b59;if(_0x18e7d2[_0xb597('0x36')][_0xb597('0x44')]){_0x522126['include']=[{'all':!![]}];}return db[_0xb597('0x31')][_0xb597('0x45')](_0x522126);})[_0xb597('0x2d')](function(_0x29958b){_0x551d75[_0xb597('0x46')]=_0x29958b;return _0x551d75;})[_0xb597('0x2d')](respondWithFilteredResult(_0xe20b0d,_0x522126))['catch'](handleError(_0xe20b0d,null));};exports[_0xb597('0x47')]=function(_0xff3a96,_0x20bfdb){var _0x367b38={'raw':![],'where':{'id':_0xff3a96['params']['id']}},_0x280c9f={};_0x280c9f[_0xb597('0x38')]=_[_0xb597('0x48')](db[_0xb597('0x31')][_0xb597('0x32')]);_0x280c9f[_0xb597('0x36')]=_[_0xb597('0x48')](_0xff3a96[_0xb597('0x36')]);_0x280c9f[_0xb597('0x40')]=_[_0xb597('0x37')](_0x280c9f[_0xb597('0x38')],_0x280c9f['query']);_0x367b38[_0xb597('0x39')]=_[_0xb597('0x37')](_0x280c9f[_0xb597('0x38')],qs[_0xb597('0x3a')](_0xff3a96[_0xb597('0x36')]['fields']));_0x367b38[_0xb597('0x39')]=_0x367b38['attributes']['length']?_0x367b38['attributes']:_0x280c9f[_0xb597('0x38')];if(_0xff3a96[_0xb597('0x36')][_0xb597('0x44')]){_0x367b38['include']=[{'all':!![]}];}_0x367b38=_['merge']({},_0x367b38,_0xff3a96[_0xb597('0x49')]);return db[_0xb597('0x31')]['find'](_0x367b38)[_0xb597('0x2d')](handleEntityNotFound(_0x20bfdb,null))['then'](respondWithResult(_0x20bfdb,null))[_0xb597('0x23')](handleError(_0x20bfdb,null));};exports[_0xb597('0x4a')]=function(_0x5526d8,_0x338eb6){return db[_0xb597('0x31')][_0xb597('0x4a')](_0x5526d8[_0xb597('0x4b')],{})[_0xb597('0x2d')](respondWithResult(_0x338eb6,0xc9))[_0xb597('0x23')](handleError(_0x338eb6,null));};exports[_0xb597('0x4c')]=function(_0x9dfd36,_0x42650b){if(_0x9dfd36[_0xb597('0x4b')]['id']){delete _0x9dfd36['body']['id'];}return db[_0xb597('0x31')][_0xb597('0x4d')]({'where':{'id':_0x9dfd36[_0xb597('0x4e')]['id']}})[_0xb597('0x2d')](handleEntityNotFound(_0x42650b,null))[_0xb597('0x2d')](saveUpdates(_0x9dfd36[_0xb597('0x4b')],null))[_0xb597('0x2d')](respondWithResult(_0x42650b,null))[_0xb597('0x23')](handleError(_0x42650b,null));};exports['destroy']=function(_0x5bb420,_0x36d953){return db['VtigerConfiguration'][_0xb597('0x4d')]({'where':{'id':_0x5bb420[_0xb597('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36d953,null))[_0xb597('0x2d')](removeEntity(_0x36d953,null))[_0xb597('0x23')](handleError(_0x36d953,null));};exports[_0xb597('0x4f')]=function(_0x13c82a,_0x18928d,_0x4eb17c){var _0x3ebbd9={};var _0x52d90b={};var _0x14c7cf;var _0x5ce138;return db['VtigerConfiguration'][_0xb597('0x50')]({'where':{'id':_0x13c82a['params']['id']}})[_0xb597('0x2d')](handleEntityNotFound(_0x18928d,null))['then'](function(_0x1bd29c){if(_0x1bd29c){_0x14c7cf=_0x1bd29c;_0x52d90b[_0xb597('0x38')]=_[_0xb597('0x48')](db['VtigerField'][_0xb597('0x32')]);_0x52d90b[_0xb597('0x36')]=_[_0xb597('0x48')](_0x13c82a['query']);_0x52d90b[_0xb597('0x40')]=_[_0xb597('0x37')](_0x52d90b[_0xb597('0x38')],_0x52d90b['query']);_0x3ebbd9[_0xb597('0x39')]=_['intersection'](_0x52d90b[_0xb597('0x38')],qs[_0xb597('0x3a')](_0x13c82a[_0xb597('0x36')][_0xb597('0x3a')]));_0x3ebbd9[_0xb597('0x39')]=_0x3ebbd9[_0xb597('0x39')][_0xb597('0x3b')]?_0x3ebbd9[_0xb597('0x39')]:_0x52d90b['model'];_0x3ebbd9['order']=qs[_0xb597('0x3e')](_0x13c82a[_0xb597('0x36')][_0xb597('0x3e')]);_0x3ebbd9['where']=qs['filters'](_[_0xb597('0x51')](_0x13c82a['query'],_0x52d90b[_0xb597('0x40')]));if(_0x13c82a[_0xb597('0x36')]['filter']){_0x3ebbd9['where']=_[_0xb597('0x43')](_0x3ebbd9[_0xb597('0x3f')],{'$or':_[_0xb597('0x35')](_0x3ebbd9[_0xb597('0x39')],function(_0x1ca6b2){var _0x44f2e9={};_0x44f2e9[_0x1ca6b2]={'$like':'%'+_0x13c82a[_0xb597('0x36')][_0xb597('0x42')]+'%'};return _0x44f2e9;})});}_0x3ebbd9=_[_0xb597('0x43')]({},_0x3ebbd9,_0x13c82a[_0xb597('0x49')]);return _0x14c7cf['getFields'](_0x3ebbd9);}})[_0xb597('0x2d')](function(_0x29ac25){if(_0x29ac25){_0x5ce138=_0x29ac25[_0xb597('0x3b')];if(!_0x13c82a[_0xb597('0x36')][_0xb597('0x3c')](_0xb597('0x3d'))){_0x3ebbd9[_0xb597('0x2a')]=qs[_0xb597('0x2a')](_0x13c82a['query']['limit']);_0x3ebbd9[_0xb597('0x29')]=qs[_0xb597('0x29')](_0x13c82a[_0xb597('0x36')]['offset']);}return _0x14c7cf[_0xb597('0x4f')](_0x3ebbd9);}})[_0xb597('0x2d')](function(_0x19e4ea){if(_0x19e4ea){return _0x19e4ea?{'count':_0x5ce138,'rows':_0x19e4ea}:null;}})[_0xb597('0x2d')](respondWithResult(_0x18928d,null))[_0xb597('0x23')](handleError(_0x18928d,null));};exports[_0xb597('0x52')]=function(_0x4d8277,_0x5da432,_0x52c516){var _0x1f2440={};var _0x43e5af={};var _0x5d531c;var _0x3f4318;return db[_0xb597('0x31')]['findOne']({'where':{'id':_0x4d8277['params']['id']}})[_0xb597('0x2d')](handleEntityNotFound(_0x5da432,null))['then'](function(_0x53cff9){if(_0x53cff9){_0x5d531c=_0x53cff9;_0x43e5af['model']=_[_0xb597('0x48')](db[_0xb597('0x53')][_0xb597('0x32')]);_0x43e5af['query']=_[_0xb597('0x48')](_0x4d8277[_0xb597('0x36')]);_0x43e5af['filters']=_[_0xb597('0x37')](_0x43e5af[_0xb597('0x38')],_0x43e5af['query']);_0x1f2440[_0xb597('0x39')]=_[_0xb597('0x37')](_0x43e5af[_0xb597('0x38')],qs[_0xb597('0x3a')](_0x4d8277[_0xb597('0x36')]['fields']));_0x1f2440['attributes']=_0x1f2440[_0xb597('0x39')]['length']?_0x1f2440[_0xb597('0x39')]:_0x43e5af[_0xb597('0x38')];_0x1f2440['order']=qs[_0xb597('0x3e')](_0x4d8277[_0xb597('0x36')][_0xb597('0x3e')]);_0x1f2440[_0xb597('0x3f')]=qs[_0xb597('0x40')](_[_0xb597('0x51')](_0x4d8277[_0xb597('0x36')],_0x43e5af[_0xb597('0x40')]));if(_0x4d8277[_0xb597('0x36')][_0xb597('0x42')]){_0x1f2440[_0xb597('0x3f')]=_[_0xb597('0x43')](_0x1f2440[_0xb597('0x3f')],{'$or':_['map'](_0x1f2440[_0xb597('0x39')],function(_0x24b07f){var _0x56b0c7={};_0x56b0c7[_0x24b07f]={'$like':'%'+_0x4d8277[_0xb597('0x36')][_0xb597('0x42')]+'%'};return _0x56b0c7;})});}_0x1f2440=_['merge']({},_0x1f2440,_0x4d8277[_0xb597('0x49')]);return _0x5d531c[_0xb597('0x52')](_0x1f2440);}})['then'](function(_0x471c9f){if(_0x471c9f){_0x3f4318=_0x471c9f[_0xb597('0x3b')];if(!_0x4d8277[_0xb597('0x36')][_0xb597('0x3c')]('nolimit')){_0x1f2440[_0xb597('0x2a')]=qs[_0xb597('0x2a')](_0x4d8277[_0xb597('0x36')][_0xb597('0x2a')]);_0x1f2440['offset']=qs[_0xb597('0x29')](_0x4d8277[_0xb597('0x36')][_0xb597('0x29')]);}return _0x5d531c[_0xb597('0x52')](_0x1f2440);}})[_0xb597('0x2d')](function(_0x1cb256){if(_0x1cb256){return _0x1cb256?{'count':_0x3f4318,'rows':_0x1cb256}:null;}})[_0xb597('0x2d')](respondWithResult(_0x5da432,null))[_0xb597('0x23')](handleError(_0x5da432,null));};exports[_0xb597('0x54')]=function(_0x651345,_0x505012,_0x588ae5){var _0x39c4e1={};var _0x2bdc77={};var _0x1510eb;var _0x227735;return db[_0xb597('0x31')][_0xb597('0x50')]({'where':{'id':_0x651345[_0xb597('0x4e')]['id']}})[_0xb597('0x2d')](handleEntityNotFound(_0x505012,null))[_0xb597('0x2d')](function(_0x3e7824){if(_0x3e7824){_0x1510eb=_0x3e7824;_0x2bdc77[_0xb597('0x38')]=_[_0xb597('0x48')](db[_0xb597('0x53')]['rawAttributes']);_0x2bdc77[_0xb597('0x36')]=_[_0xb597('0x48')](_0x651345[_0xb597('0x36')]);_0x2bdc77['filters']=_[_0xb597('0x37')](_0x2bdc77['model'],_0x2bdc77['query']);_0x39c4e1[_0xb597('0x39')]=_['intersection'](_0x2bdc77[_0xb597('0x38')],qs[_0xb597('0x3a')](_0x651345[_0xb597('0x36')]['fields']));_0x39c4e1['attributes']=_0x39c4e1[_0xb597('0x39')]['length']?_0x39c4e1[_0xb597('0x39')]:_0x2bdc77[_0xb597('0x38')];_0x39c4e1[_0xb597('0x55')]=qs[_0xb597('0x3e')](_0x651345[_0xb597('0x36')][_0xb597('0x3e')]);_0x39c4e1[_0xb597('0x3f')]=qs[_0xb597('0x40')](_['pick'](_0x651345[_0xb597('0x36')],_0x2bdc77['filters']));if(_0x651345[_0xb597('0x36')][_0xb597('0x42')]){_0x39c4e1[_0xb597('0x3f')]=_[_0xb597('0x43')](_0x39c4e1['where'],{'$or':_['map'](_0x39c4e1['attributes'],function(_0x417e24){var _0x4315f8={};_0x4315f8[_0x417e24]={'$like':'%'+_0x651345['query'][_0xb597('0x42')]+'%'};return _0x4315f8;})});}_0x39c4e1=_[_0xb597('0x43')]({},_0x39c4e1,_0x651345['options']);return _0x1510eb[_0xb597('0x54')](_0x39c4e1);}})[_0xb597('0x2d')](function(_0x2c15ad){if(_0x2c15ad){_0x227735=_0x2c15ad[_0xb597('0x3b')];if(!_0x651345[_0xb597('0x36')][_0xb597('0x3c')]('nolimit')){_0x39c4e1[_0xb597('0x2a')]=qs['limit'](_0x651345[_0xb597('0x36')][_0xb597('0x2a')]);_0x39c4e1[_0xb597('0x29')]=qs['offset'](_0x651345[_0xb597('0x36')][_0xb597('0x29')]);}return _0x1510eb[_0xb597('0x54')](_0x39c4e1);}})[_0xb597('0x2d')](function(_0x5ec45f){if(_0x5ec45f){return _0x5ec45f?{'count':_0x227735,'rows':_0x5ec45f}:null;}})[_0xb597('0x2d')](respondWithResult(_0x505012,null))[_0xb597('0x23')](handleError(_0x505012,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 572bd8c..04350e3 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff55=['lodash','util','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x1ad279,_0x42d157){var _0x272861=function(_0x3cb41f){while(--_0x3cb41f){_0x1ad279['push'](_0x1ad279['shift']());}};_0x272861(++_0x42d157);}(_0xff55,0xea));var _0x5ff5=function(_0x52a072,_0x55930b){_0x52a072=_0x52a072-0x0;var _0x201d25=_0xff55[_0x52a072];return _0x201d25;};'use strict';var _=require(_0x5ff5('0x0'));var util=require(_0x5ff5('0x1'));var logger=require('../../config/logger')(_0x5ff5('0x2'));var moment=require(_0x5ff5('0x3'));var BPromise=require('bluebird');var rp=require(_0x5ff5('0x4'));var fs=require('fs');var path=require(_0x5ff5('0x5'));var rimraf=require(_0x5ff5('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x5ff5('0x7')]=function(_0x3bebc2,_0x55b0c2){return _0x3bebc2[_0x5ff5('0x8')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9055=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x196ac3,_0x41875d){var _0x18ccf9=function(_0x40725f){while(--_0x40725f){_0x196ac3['push'](_0x196ac3['shift']());}};_0x18ccf9(++_0x41875d);}(_0x9055,0x7b));var _0x5905=function(_0x475fe2,_0x505f67){_0x475fe2=_0x475fe2-0x0;var _0x2d813f=_0x9055[_0x475fe2];return _0x2d813f;};'use strict';var _=require(_0x5905('0x0'));var util=require(_0x5905('0x1'));var logger=require(_0x5905('0x2'))(_0x5905('0x3'));var moment=require(_0x5905('0x4'));var BPromise=require(_0x5905('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5905('0x6'));var rimraf=require('rimraf');var config=require(_0x5905('0x7'));var attributes=require(_0x5905('0x8'));module[_0x5905('0x9')]=function(_0x22ae6b,_0x17ba75){return _0x22ae6b[_0x5905('0xa')](_0x5905('0xb'),attributes,{'tableName':_0x5905('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index cade43b..96a82a4 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6a4=['request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x4453bf,_0x19cd88){var _0x27c018=function(_0xac2aea){while(--_0xac2aea){_0x4453bf['push'](_0x4453bf['shift']());}};_0x27c018(++_0x19cd88);}(_0xd6a4,0x1bf));var _0x4d6a=function(_0x8a2966,_0x438fcb){_0x8a2966=_0x8a2966-0x0;var _0x40ae2b=_0xd6a4[_0x8a2966];return _0x40ae2b;};'use strict';var _=require(_0x4d6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d6a('0x1'));var fs=require('fs');var Redis=require(_0x4d6a('0x2'));var db=require(_0x4d6a('0x3'))['db'];var utils=require(_0x4d6a('0x4'));var logger=require(_0x4d6a('0x5'))('rpc');var config=require(_0x4d6a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4d6a('0x7')][_0x4d6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44811b,_0x50c1f6,_0x5f4f6d){return new BPromise(function(_0x473645,_0x361daa){return client[_0x4d6a('0x9')](_0x44811b,_0x5f4f6d)[_0x4d6a('0xa')](function(_0x5d7a22){logger['info'](_0x4d6a('0xb'),_0x50c1f6,_0x4d6a('0xc'));logger['debug'](_0x4d6a('0xd'),_0x50c1f6,_0x4d6a('0xc'),JSON['stringify'](_0x5d7a22));if(_0x5d7a22[_0x4d6a('0xe')]){if(_0x5d7a22[_0x4d6a('0xe')][_0x4d6a('0xf')]===0x1f4){logger[_0x4d6a('0xe')](_0x4d6a('0xb'),_0x50c1f6,_0x5d7a22[_0x4d6a('0xe')]['message']);return _0x361daa(_0x5d7a22[_0x4d6a('0xe')][_0x4d6a('0x10')]);}logger[_0x4d6a('0xe')](_0x4d6a('0xb'),_0x50c1f6,_0x5d7a22[_0x4d6a('0xe')][_0x4d6a('0x10')]);return _0x473645(_0x5d7a22['error'][_0x4d6a('0x10')]);}else{logger[_0x4d6a('0x11')](_0x4d6a('0xb'),_0x50c1f6,'request\x20sent');_0x473645(_0x5d7a22[_0x4d6a('0x12')][_0x4d6a('0x10')]);}})['catch'](function(_0x354d4c){logger[_0x4d6a('0xe')](_0x4d6a('0xb'),_0x50c1f6,_0x354d4c);_0x361daa(_0x354d4c);});});} \ No newline at end of file +var _0xff01=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x4607e1,_0x596f78){var _0x22f1b2=function(_0x122dcc){while(--_0x122dcc){_0x4607e1['push'](_0x4607e1['shift']());}};_0x22f1b2(++_0x596f78);}(_0xff01,0x12f));var _0x1ff0=function(_0x532b22,_0x176208){_0x532b22=_0x532b22-0x0;var _0x324fcd=_0xff01[_0x532b22];return _0x324fcd;};'use strict';var _=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var moment=require(_0x1ff0('0x2'));var BPromise=require(_0x1ff0('0x3'));var rs=require(_0x1ff0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1ff0('0x5'));var logger=require(_0x1ff0('0x6'))(_0x1ff0('0x7'));var config=require(_0x1ff0('0x8'));var jayson=require(_0x1ff0('0x9'));var client=jayson[_0x1ff0('0xa')][_0x1ff0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x235163,_0x372dc1,_0x2436e6){return new BPromise(function(_0x2a8c32,_0x530d85){return client[_0x1ff0('0xc')](_0x235163,_0x2436e6)[_0x1ff0('0xd')](function(_0x56d655){logger[_0x1ff0('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x372dc1,'request\x20sent');logger[_0x1ff0('0xf')](_0x1ff0('0x10'),_0x372dc1,_0x1ff0('0x11'),JSON[_0x1ff0('0x12')](_0x56d655));if(_0x56d655[_0x1ff0('0x13')]){if(_0x56d655['error'][_0x1ff0('0x14')]===0x1f4){logger[_0x1ff0('0x13')](_0x1ff0('0x15'),_0x372dc1,_0x56d655[_0x1ff0('0x13')][_0x1ff0('0x16')]);return _0x530d85(_0x56d655[_0x1ff0('0x13')]['message']);}logger[_0x1ff0('0x13')](_0x1ff0('0x15'),_0x372dc1,_0x56d655['error'][_0x1ff0('0x16')]);return _0x2a8c32(_0x56d655[_0x1ff0('0x13')]['message']);}else{logger[_0x1ff0('0xe')](_0x1ff0('0x15'),_0x372dc1,'request\x20sent');_0x2a8c32(_0x56d655[_0x1ff0('0x17')][_0x1ff0('0x16')]);}})[_0x1ff0('0x18')](function(_0x3c29f9){logger[_0x1ff0('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x372dc1,_0x3c29f9);_0x530d85(_0x3c29f9);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 2db913f..5ebbb12 100644 --- a/server/api/intVtigerField/index.js +++ b/server/api/intVtigerField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72d3=['../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5cff25,_0xab13e6){var _0x529c50=function(_0x36b37c){while(--_0x36b37c){_0x5cff25['push'](_0x5cff25['shift']());}};_0x529c50(++_0xab13e6);}(_0x72d3,0x192));var _0x372d=function(_0xbe294b,_0x1c884e){_0xbe294b=_0xbe294b-0x0;var _0x4fe650=_0x72d3[_0xbe294b];return _0x4fe650;};'use strict';var multer=require(_0x372d('0x0'));var util=require(_0x372d('0x1'));var path=require(_0x372d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x372d('0x3')]();var auth=require(_0x372d('0x4'));var interaction=require(_0x372d('0x5'));var config=require(_0x372d('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x372d('0x7')](),controller[_0x372d('0x8')]);router[_0x372d('0x9')]('/:id',auth[_0x372d('0x7')](),controller[_0x372d('0xa')]);router[_0x372d('0xb')]('/',auth[_0x372d('0x7')](),controller[_0x372d('0xc')]);router[_0x372d('0xd')](_0x372d('0xe'),auth[_0x372d('0x7')](),controller['update']);router[_0x372d('0xf')](_0x372d('0xe'),auth[_0x372d('0x7')](),controller[_0x372d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9f3b=['Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','exports','util','path','connect-timeout'];(function(_0x176462,_0x4f87c4){var _0x2dcd8a=function(_0x251c56){while(--_0x251c56){_0x176462['push'](_0x176462['shift']());}};_0x2dcd8a(++_0x4f87c4);}(_0x9f3b,0x184));var _0xb9f3=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x9f3b[_0x29a29f];return _0x443ea3;};'use strict';var multer=require('multer');var util=require(_0xb9f3('0x0'));var path=require(_0xb9f3('0x1'));var timeout=require(_0xb9f3('0x2'));var express=require('express');var router=express[_0xb9f3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9f3('0x4'));var config=require(_0xb9f3('0x5'));var controller=require(_0xb9f3('0x6'));router[_0xb9f3('0x7')]('/',auth['isAuthenticated'](),controller[_0xb9f3('0x8')]);router[_0xb9f3('0x7')](_0xb9f3('0x9'),auth['isAuthenticated'](),controller[_0xb9f3('0xa')]);router[_0xb9f3('0xb')]('/',auth[_0xb9f3('0xc')](),controller[_0xb9f3('0xd')]);router[_0xb9f3('0xe')](_0xb9f3('0x9'),auth[_0xb9f3('0xc')](),controller[_0xb9f3('0xf')]);router['delete'](_0xb9f3('0x9'),auth[_0xb9f3('0xc')](),controller['destroy']);module[_0xb9f3('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index d646dc2..5578bed 100644 --- a/server/api/intVtigerField/intVtigerField.attributes.js +++ b/server/api/intVtigerField/intVtigerField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98a8=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x9fa52,_0x5cfe72){var _0x494d55=function(_0x7a498c){while(--_0x7a498c){_0x9fa52['push'](_0x9fa52['shift']());}};_0x494d55(++_0x5cfe72);}(_0x98a8,0x12c));var _0x898a=function(_0x235675,_0x24a2a7){_0x235675=_0x235675-0x0;var _0x36fcea=_0x98a8[_0x235675];return _0x36fcea;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'type':{'type':Sequelize[_0x898a('0x2')](_0x898a('0x3'),_0x898a('0x4'),_0x898a('0x5'),_0x898a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x898a('0x7')]},'key':{'type':Sequelize[_0x898a('0x7')]},'keyType':{'type':Sequelize[_0x898a('0x2')](_0x898a('0x3'),_0x898a('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x898a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x898a('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x898a('0x7')]}}; \ No newline at end of file +var _0xf3cd=['customVariable','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0xf3cd[_0xb0b922];return _0x5dc41e;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'type':{'type':Sequelize[_0xdf3c('0x2')](_0xdf3c('0x3'),_0xdf3c('0x4'),_0xdf3c('0x5'),'keyValue'),'defaultValue':_0xdf3c('0x3')},'content':{'type':Sequelize[_0xdf3c('0x6')]},'key':{'type':Sequelize[_0xdf3c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xdf3c('0x3'),_0xdf3c('0x4'),_0xdf3c('0x5'))},'keyContent':{'type':Sequelize[_0xdf3c('0x6')]},'idField':{'type':Sequelize[_0xdf3c('0x6')]},'nameField':{'type':Sequelize[_0xdf3c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf3c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index cfaca07..775f857 100644 --- a/server/api/intVtigerField/intVtigerField.controller.js +++ b/server/api/intVtigerField/intVtigerField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d72=['model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','length','catch','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','VtigerField','rawAttributes','type','key','query','keys','intersection','attributes'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x2d72,0xa8));var _0x22d7=function(_0x2659bc,_0x52e4c2){_0x2659bc=_0x2659bc-0x0;var _0x55731b=_0x2d72[_0x2659bc];return _0x55731b;};'use strict';var pdf=require(_0x22d7('0x0'));var emlformat=require(_0x22d7('0x1'));var rimraf=require(_0x22d7('0x2'));var zipdir=require(_0x22d7('0x3'));var jsonpatch=require(_0x22d7('0x4'));var rp=require(_0x22d7('0x5'));var moment=require(_0x22d7('0x6'));var BPromise=require(_0x22d7('0x7'));var Mustache=require(_0x22d7('0x8'));var util=require(_0x22d7('0x9'));var path=require(_0x22d7('0xa'));var sox=require(_0x22d7('0xb'));var csv=require(_0x22d7('0xc'));var ejs=require(_0x22d7('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x22d7('0xe'));var crypto=require(_0x22d7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x22d7('0x10'));var toCsv=require(_0x22d7('0xc'));var querystring=require(_0x22d7('0x11'));var Papa=require(_0x22d7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x22d7('0x13'));var as=require(_0x22d7('0x14'));var hardwareService=require(_0x22d7('0x15'));var logger=require(_0x22d7('0x16'))(_0x22d7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x22d7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b725c,_0xec6659){_0xec6659=_0xec6659||0xcc;return function(_0x58bdca){if(_0x58bdca){return _0x3b725c[_0x22d7('0x19')](_0xec6659);}return _0x3b725c[_0x22d7('0x1a')](_0xec6659)[_0x22d7('0x1b')]();};}function respondWithResult(_0x3c443c,_0x1c5c19){_0x1c5c19=_0x1c5c19||0xc8;return function(_0x1b654c){if(_0x1b654c){return _0x3c443c[_0x22d7('0x1a')](_0x1c5c19)[_0x22d7('0x1c')](_0x1b654c);}};}function respondWithFilteredResult(_0x534223,_0x352a78){return function(_0x442ce4){if(_0x442ce4){var _0x3c5f4e=_0x442ce4[_0x22d7('0x1d')],_0x545bc8=_0x352a78[_0x22d7('0x1e')],_0x4d2210=_0x352a78[_0x22d7('0x1e')]+_0x352a78[_0x22d7('0x1f')],_0x52b21c;if(_0x4d2210>=_0x3c5f4e){_0x4d2210=_0x3c5f4e;_0x52b21c=0xc8;}else{_0x52b21c=0xce;}_0x534223[_0x22d7('0x1a')](_0x52b21c);return _0x534223['set'](_0x22d7('0x20'),_0x545bc8+'-'+_0x4d2210+'/'+_0x3c5f4e)[_0x22d7('0x1c')](_0x442ce4);}return null;};}function patchUpdates(_0x462526){return function(_0x5ac2f7){try{jsonpatch[_0x22d7('0x21')](_0x5ac2f7,_0x462526,!![]);}catch(_0x7f2905){return BPromise[_0x22d7('0x22')](_0x7f2905);}return _0x5ac2f7[_0x22d7('0x23')]();};}function saveUpdates(_0x6be49e,_0x577400){return function(_0x5e03d5){if(_0x5e03d5){return _0x5e03d5[_0x22d7('0x24')](_0x6be49e)[_0x22d7('0x25')](function(_0x21635e){return _0x21635e;});}return null;};}function removeEntity(_0x4172d3,_0x4f9bc7){return function(_0x3f0148){if(_0x3f0148){return _0x3f0148[_0x22d7('0x26')]()[_0x22d7('0x25')](function(){_0x4172d3['status'](0xcc)[_0x22d7('0x1b')]();});}};}function handleEntityNotFound(_0x523409,_0x219507){return function(_0xd275cb){if(!_0xd275cb){_0x523409[_0x22d7('0x19')](0x194);}return _0xd275cb;};}function handleError(_0x5db3aa,_0x183d73){_0x183d73=_0x183d73||0x1f4;return function(_0x5e4c87){logger['error'](_0x5e4c87[_0x22d7('0x27')]);if(_0x5e4c87[_0x22d7('0x28')]){delete _0x5e4c87[_0x22d7('0x28')];}_0x5db3aa[_0x22d7('0x1a')](_0x183d73)[_0x22d7('0x29')](_0x5e4c87);};}exports['index']=function(_0x7181dc,_0x603453){var _0xfbb9b={},_0xce7f15={},_0x45dc29={'count':0x0,'rows':[]};var _0x49199a=_[_0x22d7('0x2a')](db[_0x22d7('0x2b')][_0x22d7('0x2c')],function(_0x2c0b24){return{'name':_0x2c0b24['fieldName'],'type':_0x2c0b24[_0x22d7('0x2d')][_0x22d7('0x2e')]};});_0xce7f15['model']=_['map'](_0x49199a,'name');_0xce7f15[_0x22d7('0x2f')]=_[_0x22d7('0x30')](_0x7181dc[_0x22d7('0x2f')]);_0xce7f15['filters']=_[_0x22d7('0x31')](_0xce7f15['model'],_0xce7f15[_0x22d7('0x2f')]);_0xfbb9b[_0x22d7('0x32')]=_[_0x22d7('0x31')](_0xce7f15[_0x22d7('0x33')],qs[_0x22d7('0x34')](_0x7181dc[_0x22d7('0x2f')]['fields']));_0xfbb9b['attributes']=_0xfbb9b[_0x22d7('0x32')]['length']?_0xfbb9b[_0x22d7('0x32')]:_0xce7f15[_0x22d7('0x33')];if(!_0x7181dc[_0x22d7('0x2f')][_0x22d7('0x35')](_0x22d7('0x36'))){_0xfbb9b['limit']=qs['limit'](_0x7181dc[_0x22d7('0x2f')]['limit']);_0xfbb9b['offset']=qs[_0x22d7('0x1e')](_0x7181dc['query'][_0x22d7('0x1e')]);}_0xfbb9b[_0x22d7('0x37')]=qs[_0x22d7('0x38')](_0x7181dc['query'][_0x22d7('0x38')]);_0xfbb9b[_0x22d7('0x39')]=qs[_0x22d7('0x3a')](_[_0x22d7('0x3b')](_0x7181dc[_0x22d7('0x2f')],_0xce7f15[_0x22d7('0x3a')]),_0x49199a);if(_0x7181dc[_0x22d7('0x2f')][_0x22d7('0x3c')]){_0xfbb9b['where']=_['merge'](_0xfbb9b[_0x22d7('0x39')],{'$or':_[_0x22d7('0x2a')](_0x49199a,function(_0x3665f3){if(_0x3665f3[_0x22d7('0x2d')]!=='VIRTUAL'){var _0x33239e={};_0x33239e[_0x3665f3['name']]={'$like':'%'+_0x7181dc['query'][_0x22d7('0x3c')]+'%'};return _0x33239e;}})});}_0xfbb9b=_[_0x22d7('0x3d')]({},_0xfbb9b,_0x7181dc[_0x22d7('0x3e')]);var _0x431592={'where':_0xfbb9b[_0x22d7('0x39')]};return db[_0x22d7('0x2b')][_0x22d7('0x1d')](_0x431592)[_0x22d7('0x25')](function(_0x3bae35){_0x45dc29[_0x22d7('0x1d')]=_0x3bae35;if(_0x7181dc[_0x22d7('0x2f')][_0x22d7('0x3f')]){_0xfbb9b[_0x22d7('0x40')]=[{'all':!![]}];}return db['VtigerField'][_0x22d7('0x41')](_0xfbb9b);})[_0x22d7('0x25')](function(_0x1aa4d8){_0x45dc29[_0x22d7('0x42')]=_0x1aa4d8;return _0x45dc29;})[_0x22d7('0x25')](respondWithFilteredResult(_0x603453,_0xfbb9b))['catch'](handleError(_0x603453,null));};exports['show']=function(_0x44ff4e,_0x123af1){var _0x390415={'raw':!![],'where':{'id':_0x44ff4e['params']['id']}},_0xeb4b4f={};_0xeb4b4f['model']=_[_0x22d7('0x30')](db[_0x22d7('0x2b')]['rawAttributes']);_0xeb4b4f[_0x22d7('0x2f')]=_[_0x22d7('0x30')](_0x44ff4e[_0x22d7('0x2f')]);_0xeb4b4f[_0x22d7('0x3a')]=_[_0x22d7('0x31')](_0xeb4b4f['model'],_0xeb4b4f['query']);_0x390415['attributes']=_[_0x22d7('0x31')](_0xeb4b4f[_0x22d7('0x33')],qs[_0x22d7('0x34')](_0x44ff4e[_0x22d7('0x2f')][_0x22d7('0x34')]));_0x390415[_0x22d7('0x32')]=_0x390415[_0x22d7('0x32')][_0x22d7('0x43')]?_0x390415['attributes']:_0xeb4b4f[_0x22d7('0x33')];if(_0x44ff4e['query'][_0x22d7('0x3f')]){_0x390415[_0x22d7('0x40')]=[{'all':!![]}];}_0x390415=_[_0x22d7('0x3d')]({},_0x390415,_0x44ff4e[_0x22d7('0x3e')]);return db['VtigerField']['find'](_0x390415)[_0x22d7('0x25')](handleEntityNotFound(_0x123af1,null))[_0x22d7('0x25')](respondWithResult(_0x123af1,null))[_0x22d7('0x44')](handleError(_0x123af1,null));};exports[_0x22d7('0x45')]=function(_0x4daffd,_0x592a51){return db[_0x22d7('0x2b')]['create'](_0x4daffd[_0x22d7('0x46')],{})[_0x22d7('0x25')](respondWithResult(_0x592a51,0xc9))['catch'](handleError(_0x592a51,null));};exports[_0x22d7('0x24')]=function(_0x984198,_0xe1863a){if(_0x984198[_0x22d7('0x46')]['id']){delete _0x984198[_0x22d7('0x46')]['id'];}return db['VtigerField'][_0x22d7('0x47')]({'where':{'id':_0x984198[_0x22d7('0x48')]['id']}})[_0x22d7('0x25')](handleEntityNotFound(_0xe1863a,null))[_0x22d7('0x25')](saveUpdates(_0x984198[_0x22d7('0x46')],null))[_0x22d7('0x25')](respondWithResult(_0xe1863a,null))[_0x22d7('0x44')](handleError(_0xe1863a,null));};exports[_0x22d7('0x26')]=function(_0x497bd9,_0x28a92d){return db[_0x22d7('0x2b')]['find']({'where':{'id':_0x497bd9[_0x22d7('0x48')]['id']}})[_0x22d7('0x25')](handleEntityNotFound(_0x28a92d,null))[_0x22d7('0x25')](removeEntity(_0x28a92d,null))[_0x22d7('0x44')](handleError(_0x28a92d,null));}; \ No newline at end of file +var _0xd8fb=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3154a2,_0x313363){_0x3154a2=_0x3154a2-0x0;var _0x256db5=_0xd8fb[_0x3154a2];return _0x256db5;};'use strict';var pdf=require(_0xbd8f('0x0'));var emlformat=require(_0xbd8f('0x1'));var rimraf=require(_0xbd8f('0x2'));var zipdir=require(_0xbd8f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd8f('0x4'));var Mustache=require(_0xbd8f('0x5'));var util=require('util');var path=require(_0xbd8f('0x6'));var sox=require(_0xbd8f('0x7'));var csv=require('to-csv');var ejs=require(_0xbd8f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=_0x10d72e[_0xbd8f('0x18')],_0x174929=_0xa57e91[_0xbd8f('0x19')],_0x63db18=_0xa57e91['offset']+_0xa57e91[_0xbd8f('0x1a')],_0x5ebf8b;if(_0x63db18>=_0x4da96f){_0x63db18=_0x4da96f;_0x5ebf8b=0xc8;}else{_0x5ebf8b=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5ebf8b);return _0x829fb2['set']('Content-Range',_0x174929+'-'+_0x63db18+'/'+_0x4da96f)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0x5d2fdb){return function(_0x5705c5){try{jsonpatch[_0xbd8f('0x1b')](_0x5705c5,_0x5d2fdb,!![]);}catch(_0x4b5fac){return BPromise[_0xbd8f('0x1c')](_0x4b5fac);}return _0x5705c5[_0xbd8f('0x1d')]();};}function saveUpdates(_0xb47c8e,_0x897f25){return function(_0xdc11cc){if(_0xdc11cc){return _0xdc11cc[_0xbd8f('0x1e')](_0xb47c8e)[_0xbd8f('0x1f')](function(_0x90eff8){return _0x90eff8;});}return null;};}function removeEntity(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x20')]()[_0xbd8f('0x1f')](function(){_0x2fbe3b[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0xd11ae,_0x395b1b){return function(_0x4ba8db){if(!_0x4ba8db){_0xd11ae[_0xbd8f('0x14')](0x194);}return _0x4ba8db;};}function handleError(_0x9fa3b1,_0x1f9fcc){_0x1f9fcc=_0x1f9fcc||0x1f4;return function(_0x2f3df7){logger[_0xbd8f('0x21')](_0x2f3df7[_0xbd8f('0x22')]);if(_0x2f3df7[_0xbd8f('0x23')]){delete _0x2f3df7[_0xbd8f('0x23')];}_0x9fa3b1['status'](_0x1f9fcc)[_0xbd8f('0x24')](_0x2f3df7);};}exports[_0xbd8f('0x25')]=function(_0x5a3a8c,_0x339df7){var _0x557daa={},_0x41b2a6={},_0x30d62e={'count':0x0,'rows':[]};var _0x991401=_[_0xbd8f('0x26')](db[_0xbd8f('0x27')][_0xbd8f('0x28')],function(_0x4c4431){return{'name':_0x4c4431[_0xbd8f('0x29')],'type':_0x4c4431[_0xbd8f('0x2a')][_0xbd8f('0x2b')]};});_0x41b2a6[_0xbd8f('0x2c')]=_[_0xbd8f('0x26')](_0x991401,_0xbd8f('0x23'));_0x41b2a6[_0xbd8f('0x2d')]=_['keys'](_0x5a3a8c[_0xbd8f('0x2d')]);_0x41b2a6[_0xbd8f('0x2e')]=_[_0xbd8f('0x2f')](_0x41b2a6[_0xbd8f('0x2c')],_0x41b2a6['query']);_0x557daa['attributes']=_[_0xbd8f('0x2f')](_0x41b2a6[_0xbd8f('0x2c')],qs[_0xbd8f('0x30')](_0x5a3a8c[_0xbd8f('0x2d')]['fields']));_0x557daa[_0xbd8f('0x31')]=_0x557daa[_0xbd8f('0x31')][_0xbd8f('0x32')]?_0x557daa[_0xbd8f('0x31')]:_0x41b2a6[_0xbd8f('0x2c')];if(!_0x5a3a8c['query'][_0xbd8f('0x33')](_0xbd8f('0x34'))){_0x557daa[_0xbd8f('0x1a')]=qs[_0xbd8f('0x1a')](_0x5a3a8c[_0xbd8f('0x2d')]['limit']);_0x557daa[_0xbd8f('0x19')]=qs['offset'](_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x19')]);}_0x557daa[_0xbd8f('0x35')]=qs[_0xbd8f('0x36')](_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x36')]);_0x557daa['where']=qs['filters'](_['pick'](_0x5a3a8c[_0xbd8f('0x2d')],_0x41b2a6[_0xbd8f('0x2e')]),_0x991401);if(_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x37')]){_0x557daa[_0xbd8f('0x38')]=_[_0xbd8f('0x39')](_0x557daa[_0xbd8f('0x38')],{'$or':_[_0xbd8f('0x26')](_0x991401,function(_0x2d4882){if(_0x2d4882[_0xbd8f('0x2a')]!==_0xbd8f('0x3a')){var _0x339c70={};_0x339c70[_0x2d4882[_0xbd8f('0x23')]]={'$like':'%'+_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x37')]+'%'};return _0x339c70;}})});}_0x557daa=_['merge']({},_0x557daa,_0x5a3a8c[_0xbd8f('0x3b')]);var _0x4181e0={'where':_0x557daa['where']};return db[_0xbd8f('0x27')][_0xbd8f('0x18')](_0x4181e0)[_0xbd8f('0x1f')](function(_0x582bcf){_0x30d62e[_0xbd8f('0x18')]=_0x582bcf;if(_0x5a3a8c['query'][_0xbd8f('0x3c')]){_0x557daa[_0xbd8f('0x3d')]=[{'all':!![]}];}return db[_0xbd8f('0x27')]['findAll'](_0x557daa);})[_0xbd8f('0x1f')](function(_0x72fe99){_0x30d62e[_0xbd8f('0x3e')]=_0x72fe99;return _0x30d62e;})['then'](respondWithFilteredResult(_0x339df7,_0x557daa))[_0xbd8f('0x3f')](handleError(_0x339df7,null));};exports[_0xbd8f('0x40')]=function(_0x2c1397,_0x351027){var _0x280d95={'raw':!![],'where':{'id':_0x2c1397[_0xbd8f('0x41')]['id']}},_0x1db8c7={};_0x1db8c7[_0xbd8f('0x2c')]=_[_0xbd8f('0x42')](db['VtigerField']['rawAttributes']);_0x1db8c7[_0xbd8f('0x2d')]=_[_0xbd8f('0x42')](_0x2c1397[_0xbd8f('0x2d')]);_0x1db8c7[_0xbd8f('0x2e')]=_['intersection'](_0x1db8c7[_0xbd8f('0x2c')],_0x1db8c7[_0xbd8f('0x2d')]);_0x280d95[_0xbd8f('0x31')]=_[_0xbd8f('0x2f')](_0x1db8c7[_0xbd8f('0x2c')],qs['fields'](_0x2c1397['query'][_0xbd8f('0x30')]));_0x280d95['attributes']=_0x280d95[_0xbd8f('0x31')][_0xbd8f('0x32')]?_0x280d95[_0xbd8f('0x31')]:_0x1db8c7[_0xbd8f('0x2c')];if(_0x2c1397[_0xbd8f('0x2d')][_0xbd8f('0x3c')]){_0x280d95[_0xbd8f('0x3d')]=[{'all':!![]}];}_0x280d95=_[_0xbd8f('0x39')]({},_0x280d95,_0x2c1397['options']);return db[_0xbd8f('0x27')][_0xbd8f('0x43')](_0x280d95)[_0xbd8f('0x1f')](handleEntityNotFound(_0x351027,null))[_0xbd8f('0x1f')](respondWithResult(_0x351027,null))[_0xbd8f('0x3f')](handleError(_0x351027,null));};exports[_0xbd8f('0x44')]=function(_0x272f70,_0x3918a5){return db['VtigerField'][_0xbd8f('0x44')](_0x272f70[_0xbd8f('0x45')],{})[_0xbd8f('0x1f')](respondWithResult(_0x3918a5,0xc9))[_0xbd8f('0x3f')](handleError(_0x3918a5,null));};exports[_0xbd8f('0x1e')]=function(_0x1e40f2,_0x42bada){if(_0x1e40f2[_0xbd8f('0x45')]['id']){delete _0x1e40f2[_0xbd8f('0x45')]['id'];}return db[_0xbd8f('0x27')][_0xbd8f('0x43')]({'where':{'id':_0x1e40f2[_0xbd8f('0x41')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x42bada,null))[_0xbd8f('0x1f')](saveUpdates(_0x1e40f2[_0xbd8f('0x45')],null))[_0xbd8f('0x1f')](respondWithResult(_0x42bada,null))[_0xbd8f('0x3f')](handleError(_0x42bada,null));};exports[_0xbd8f('0x20')]=function(_0x2668a4,_0x4d32c4){return db[_0xbd8f('0x27')][_0xbd8f('0x43')]({'where':{'id':_0x2668a4[_0xbd8f('0x41')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x4d32c4,null))['then'](removeEntity(_0x4d32c4,null))[_0xbd8f('0x3f')](handleError(_0x4d32c4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 900b1ab..ea23ebf 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x5743ad,_0x5cdb73){var _0x3fa65e=function(_0x22c67e){while(--_0x22c67e){_0x5743ad['push'](_0x5743ad['shift']());}};_0x3fa65e(++_0x5cdb73);}(_0x7a54,0x106));var _0x47a5=function(_0x3cdba8,_0x253d17){_0x3cdba8=_0x3cdba8-0x0;var _0xec9795=_0x7a54[_0x3cdba8];return _0xec9795;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x42692b,_0xa0080d){var _0x3ea2d7=function(_0x4feb33){while(--_0x4feb33){_0x42692b['push'](_0x42692b['shift']());}};_0x3ea2d7(++_0xa0080d);}(_0x7a54,0x106));var _0x47a5=function(_0xa2b936,_0x5e73c0){_0xa2b936=_0xa2b936-0x0;var _0x32abd3=_0x7a54[_0xa2b936];return _0x32abd3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 6305257..b8cddc4 100644 --- a/server/api/intVtigerField/intVtigerField.rpc.js +++ b/server/api/intVtigerField/intVtigerField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a15=['code','error','message','VtigerField,\x20%s,\x20%s','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','http','request','then','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x5cdb52,_0x1fd5ce){var _0xafba1e=function(_0x4391ea){while(--_0x4391ea){_0x5cdb52['push'](_0x5cdb52['shift']());}};_0xafba1e(++_0x1fd5ce);}(_0x3a15,0xde));var _0x53a1=function(_0x8809b4,_0x3bdc8a){_0x8809b4=_0x8809b4-0x0;var _0xc33cb7=_0x3a15[_0x8809b4];return _0xc33cb7;};'use strict';var _=require(_0x53a1('0x0'));var util=require('util');var moment=require(_0x53a1('0x1'));var BPromise=require('bluebird');var rs=require(_0x53a1('0x2'));var fs=require('fs');var Redis=require(_0x53a1('0x3'));var db=require(_0x53a1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x53a1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x53a1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a0168,_0x457bf4,_0x2ec206){return new BPromise(function(_0x439447,_0x5252d4){return client[_0x53a1('0x7')](_0x5a0168,_0x2ec206)[_0x53a1('0x8')](function(_0x49e45a){logger['info']('VtigerField,\x20%s,\x20%s',_0x457bf4,_0x53a1('0x9'));logger[_0x53a1('0xa')](_0x53a1('0xb'),_0x457bf4,_0x53a1('0x9'),JSON['stringify'](_0x49e45a));if(_0x49e45a['error']){if(_0x49e45a['error'][_0x53a1('0xc')]===0x1f4){logger[_0x53a1('0xd')]('VtigerField,\x20%s,\x20%s',_0x457bf4,_0x49e45a[_0x53a1('0xd')][_0x53a1('0xe')]);return _0x5252d4(_0x49e45a[_0x53a1('0xd')]['message']);}logger[_0x53a1('0xd')](_0x53a1('0xf'),_0x457bf4,_0x49e45a[_0x53a1('0xd')][_0x53a1('0xe')]);return _0x439447(_0x49e45a[_0x53a1('0xd')][_0x53a1('0xe')]);}else{logger[_0x53a1('0x10')](_0x53a1('0xf'),_0x457bf4,_0x53a1('0x9'));_0x439447(_0x49e45a['result'][_0x53a1('0xe')]);}})[_0x53a1('0x11')](function(_0x1793e0){logger[_0x53a1('0xd')](_0x53a1('0xf'),_0x457bf4,_0x1793e0);_0x5252d4(_0x1793e0);});});} \ No newline at end of file +var _0x8322=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1132d1,_0x1a2f80){var _0x13b103=function(_0x743de8){while(--_0x743de8){_0x1132d1['push'](_0x1132d1['shift']());}};_0x13b103(++_0x1a2f80);}(_0x8322,0x186));var _0x2832=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0x8322[_0x1aab74];return _0x396af2;};'use strict';var _=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var moment=require(_0x2832('0x2'));var BPromise=require(_0x2832('0x3'));var rs=require(_0x2832('0x4'));var fs=require('fs');var Redis=require(_0x2832('0x5'));var db=require(_0x2832('0x6'))['db'];var utils=require(_0x2832('0x7'));var logger=require(_0x2832('0x8'))(_0x2832('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2832('0xa')][_0x2832('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xab2c39,_0x29a788,_0x1488df){return new BPromise(function(_0x4b0ca8,_0xb57a3c){return client[_0x2832('0xc')](_0xab2c39,_0x1488df)[_0x2832('0xd')](function(_0xb1f005){logger['info'](_0x2832('0xe'),_0x29a788,_0x2832('0xf'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'),JSON['stringify'](_0xb1f005));if(_0xb1f005['error']){if(_0xb1f005[_0x2832('0x10')][_0x2832('0x11')]===0x1f4){logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005['error'][_0x2832('0x12')]);return _0xb57a3c(_0xb1f005[_0x2832('0x10')]['message']);}logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);return _0x4b0ca8(_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);}else{logger[_0x2832('0x13')]('VtigerField,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'));_0x4b0ca8(_0xb1f005[_0x2832('0x14')]['message']);}})[_0x2832('0x15')](function(_0x56d1e6){logger[_0x2832('0x10')]('VtigerField,\x20%s,\x20%s',_0x29a788,_0x56d1e6);_0xb57a3c(_0x56d1e6);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 676ca85..56e0beb 100644 --- a/server/api/intZendeskAccount/index.js +++ b/server/api/intZendeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x190b=['getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations'];(function(_0x705355,_0x19eb11){var _0x191f41=function(_0x134c18){while(--_0x134c18){_0x705355['push'](_0x705355['shift']());}};_0x191f41(++_0x19eb11);}(_0x190b,0x1ab));var _0xb190=function(_0x4133ff,_0x5cbefb){_0x4133ff=_0x4133ff-0x0;var _0x52f5ce=_0x190b[_0x4133ff];return _0x52f5ce;};'use strict';var multer=require(_0xb190('0x0'));var util=require(_0xb190('0x1'));var path=require(_0xb190('0x2'));var timeout=require('connect-timeout');var express=require(_0xb190('0x3'));var router=express[_0xb190('0x4')]();var auth=require(_0xb190('0x5'));var interaction=require(_0xb190('0x6'));var config=require('../../config/environment');var controller=require(_0xb190('0x7'));router[_0xb190('0x8')]('/',auth[_0xb190('0x9')](),controller[_0xb190('0xa')]);router[_0xb190('0x8')](_0xb190('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb190('0x8')](_0xb190('0xc'),auth[_0xb190('0x9')](),controller[_0xb190('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xb190('0xe')]);router[_0xb190('0xf')]('/',auth[_0xb190('0x9')](),controller['create']);router[_0xb190('0xf')]('/:id/configurations',auth[_0xb190('0x9')](),controller[_0xb190('0x10')]);router[_0xb190('0x11')](_0xb190('0xb'),auth[_0xb190('0x9')](),controller[_0xb190('0x12')]);router[_0xb190('0x13')](_0xb190('0xb'),auth[_0xb190('0x9')](),controller[_0xb190('0x14')]);module[_0xb190('0x15')]=router; \ No newline at end of file +var _0xe650=['multer','util','path','express','Router','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x3b72e4,_0x405b78){var _0x204771=function(_0x434eb5){while(--_0x434eb5){_0x3b72e4['push'](_0x3b72e4['shift']());}};_0x204771(++_0x405b78);}(_0xe650,0xfd));var _0x0e65=function(_0x49fb1c,_0x113891){_0x49fb1c=_0x49fb1c-0x0;var _0x36cc02=_0xe650[_0x49fb1c];return _0x36cc02;};'use strict';var multer=require(_0x0e65('0x0'));var util=require(_0x0e65('0x1'));var path=require(_0x0e65('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e65('0x3'));var router=express[_0x0e65('0x4')]();var auth=require(_0x0e65('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0e65('0x6'));router[_0x0e65('0x7')]('/',auth[_0x0e65('0x8')](),controller[_0x0e65('0x9')]);router[_0x0e65('0x7')]('/:id',auth[_0x0e65('0x8')](),controller[_0x0e65('0xa')]);router[_0x0e65('0x7')](_0x0e65('0xb'),auth[_0x0e65('0x8')](),controller['getConfigurations']);router['get'](_0x0e65('0xc'),auth[_0x0e65('0x8')](),controller[_0x0e65('0xd')]);router[_0x0e65('0xe')]('/',auth[_0x0e65('0x8')](),controller[_0x0e65('0xf')]);router['post'](_0x0e65('0xb'),auth[_0x0e65('0x8')](),controller[_0x0e65('0x10')]);router[_0x0e65('0x11')](_0x0e65('0x12'),auth[_0x0e65('0x8')](),controller[_0x0e65('0x13')]);router[_0x0e65('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0e65('0x15')]);module[_0x0e65('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 01046cd..481049a 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.attributes.js +++ b/server/api/intZendeskAccount/intZendeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31a0=['remoteUri','ENUM','token','password','integrationTab','newTab','exports','STRING','username'];(function(_0x1de9c6,_0x115dec){var _0x1d0bf7=function(_0x551b2a){while(--_0x551b2a){_0x1de9c6['push'](_0x1de9c6['shift']());}};_0x1d0bf7(++_0x115dec);}(_0x31a0,0x1bf));var _0x031a=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x31a0[_0x4e7d25];return _0x526fe6;};'use strict';var Sequelize=require('sequelize');module[_0x031a('0x0')]={'name':{'type':Sequelize[_0x031a('0x1')]},'description':{'type':Sequelize[_0x031a('0x1')]},'username':{'type':Sequelize[_0x031a('0x1')],'unique':_0x031a('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x031a('0x1')]},'remoteUri':{'type':Sequelize[_0x031a('0x1')],'unique':_0x031a('0x3')},'authType':{'type':Sequelize[_0x031a('0x4')]('password',_0x031a('0x5')),'defaultValue':_0x031a('0x6')},'serverUrl':{'type':Sequelize[_0x031a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x031a('0x4')](_0x031a('0x7'),_0x031a('0x8')),'defaultValue':_0x031a('0x7')}}; \ No newline at end of file +var _0x3855=['STRING','username','remoteUri','ENUM','password','token','newTab','integrationTab','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3855,0x17a));var _0x5385=function(_0x4cace9,_0xba6744){_0x4cace9=_0x4cace9-0x0;var _0x2c2879=_0x3855[_0x4cace9];return _0x2c2879;};'use strict';var Sequelize=require(_0x5385('0x0'));module[_0x5385('0x1')]={'name':{'type':Sequelize[_0x5385('0x2')]},'description':{'type':Sequelize[_0x5385('0x2')]},'username':{'type':Sequelize[_0x5385('0x2')],'unique':_0x5385('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5385('0x2')],'unique':_0x5385('0x4')},'authType':{'type':Sequelize[_0x5385('0x5')](_0x5385('0x6'),_0x5385('0x7')),'defaultValue':_0x5385('0x6')},'serverUrl':{'type':Sequelize[_0x5385('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5385('0x5')]('integrationTab',_0x5385('0x8')),'defaultValue':_0x5385('0x9')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9e29aea..bb627b9 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x317b=['request\x20sent','result','catch','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','then','destroy','name','send','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','find','body','update','params','getConfigurations','findOne','ZendeskConfiguration','nolimit','AccountId','Subjects','getSubjects','Descriptions','channel','create','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','Basic\x20%s','toString','base64','headers','ValidationError','Unknown\x20authentication\x20type','subject','group','remove','includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x317b,0x1c7));var _0xb317=function(_0x15f5a2,_0x5222e0){_0x15f5a2=_0x15f5a2-0x0;var _0x2aa9b3=_0x317b[_0x15f5a2];return _0x2aa9b3;};'use strict';var pdf=require(_0xb317('0x0'));var emlformat=require(_0xb317('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb317('0x2'));var jsonpatch=require(_0xb317('0x3'));var rp=require('request-promise');var moment=require(_0xb317('0x4'));var BPromise=require(_0xb317('0x5'));var Mustache=require(_0xb317('0x6'));var util=require(_0xb317('0x7'));var path=require(_0xb317('0x8'));var sox=require(_0xb317('0x9'));var csv=require(_0xb317('0xa'));var ejs=require(_0xb317('0xb'));var fs=require('fs');var _=require(_0xb317('0xc'));var squel=require(_0xb317('0xd'));var crypto=require('crypto');var jsforce=require(_0xb317('0xe'));var deskjs=require(_0xb317('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb317('0x10'));var Papa=require(_0xb317('0x11'));var Redis=require(_0xb317('0x12'));var authService=require(_0xb317('0x13'));var qs=require(_0xb317('0x14'));var as=require(_0xb317('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb317('0x16'))(_0xb317('0x17'));var utils=require('../../config/utils');var config=require(_0xb317('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb317('0x19'))['db'];var integrations=require(_0xb317('0x1a'));var jayson=require(_0xb317('0x1b'));var client=jayson[_0xb317('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf88e1c,_0x4b2db9,_0x5562b0,_0x41f778){return new BPromise(function(_0x4c2585,_0x237b84){var _0x42a379=_0x41f778||client;return _0x42a379[_0xb317('0x1d')](_0xf88e1c,_0x5562b0)['then'](function(_0x4ade83){logger['info'](_0xb317('0x1e'),_0x4b2db9,'request\x20sent');logger[_0xb317('0x1f')](_0xb317('0x20'),_0x4b2db9,'request\x20sent',JSON[_0xb317('0x21')](_0x4ade83));if(_0x4ade83[_0xb317('0x22')]){if(_0x4ade83['error']['code']===0x1f4){logger[_0xb317('0x22')](_0xb317('0x1e'),_0x4b2db9,_0x4ade83[_0xb317('0x22')][_0xb317('0x23')]);return _0x237b84(_0x4ade83[_0xb317('0x22')]['message']);}logger[_0xb317('0x22')](_0xb317('0x1e'),_0x4b2db9,_0x4ade83[_0xb317('0x22')][_0xb317('0x23')]);return _0x4c2585(_0x4ade83[_0xb317('0x22')][_0xb317('0x23')]);}else{logger[_0xb317('0x24')](_0xb317('0x1e'),_0x4b2db9,_0xb317('0x25'));_0x4c2585(_0x4ade83[_0xb317('0x26')][_0xb317('0x23')]);}})[_0xb317('0x27')](function(_0xb22915){logger[_0xb317('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x4b2db9,_0xb22915);_0x237b84(_0xb22915);});});}function respondWithStatusCode(_0x42ef04,_0x55bf91){_0x55bf91=_0x55bf91||0xcc;return function(_0x16ef79){if(_0x16ef79){return _0x42ef04[_0xb317('0x28')](_0x55bf91);}return _0x42ef04[_0xb317('0x29')](_0x55bf91)[_0xb317('0x2a')]();};}function respondWithResult(_0x3bab40,_0x1e32d4){_0x1e32d4=_0x1e32d4||0xc8;return function(_0x109189){if(_0x109189){return _0x3bab40[_0xb317('0x29')](_0x1e32d4)['json'](_0x109189);}};}function respondWithFilteredResult(_0x209f13,_0x3079d9){return function(_0x32fedb){if(_0x32fedb){var _0x81db2f=_0x32fedb[_0xb317('0x2b')],_0x2960a8=_0x3079d9[_0xb317('0x2c')],_0x1254cb=_0x3079d9['offset']+_0x3079d9['limit'],_0x559717;if(_0x1254cb>=_0x81db2f){_0x1254cb=_0x81db2f;_0x559717=0xc8;}else{_0x559717=0xce;}_0x209f13[_0xb317('0x29')](_0x559717);return _0x209f13[_0xb317('0x2d')](_0xb317('0x2e'),_0x2960a8+'-'+_0x1254cb+'/'+_0x81db2f)['json'](_0x32fedb);}return null;};}function patchUpdates(_0x79fbfb){return function(_0xa35219){try{jsonpatch[_0xb317('0x2f')](_0xa35219,_0x79fbfb,!![]);}catch(_0x3a174f){return BPromise[_0xb317('0x30')](_0x3a174f);}return _0xa35219['save']();};}function saveUpdates(_0x39c2aa,_0x4bab2b){return function(_0x25f089){if(_0x25f089){return _0x25f089['update'](_0x39c2aa)[_0xb317('0x31')](function(_0x1ece9d){return _0x1ece9d;});}return null;};}function removeEntity(_0x32cc0e,_0x4a5857){return function(_0x2906e6){if(_0x2906e6){return _0x2906e6[_0xb317('0x32')]()[_0xb317('0x31')](function(){_0x32cc0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x283e89,_0x4cf98a){return function(_0x4c0bc5){if(!_0x4c0bc5){_0x283e89['sendStatus'](0x194);}return _0x4c0bc5;};}function handleError(_0xaaed53,_0x11ec74){_0x11ec74=_0x11ec74||0x1f4;return function(_0x3692cd){logger[_0xb317('0x22')](_0x3692cd['stack']);if(_0x3692cd[_0xb317('0x33')]){delete _0x3692cd[_0xb317('0x33')];}_0xaaed53[_0xb317('0x29')](_0x11ec74)[_0xb317('0x34')](_0x3692cd);};}exports['index']=function(_0x45911c,_0x567e05){var _0x17a734={},_0x50e30c={},_0x35cdff={'count':0x0,'rows':[]};var _0xfed857=_['map'](db[_0xb317('0x35')][_0xb317('0x36')],function(_0x3bdd06){return{'name':_0x3bdd06['fieldName'],'type':_0x3bdd06[_0xb317('0x37')][_0xb317('0x38')]};});_0x50e30c[_0xb317('0x39')]=_[_0xb317('0x3a')](_0xfed857,'name');_0x50e30c[_0xb317('0x3b')]=_[_0xb317('0x3c')](_0x45911c[_0xb317('0x3b')]);_0x50e30c[_0xb317('0x3d')]=_[_0xb317('0x3e')](_0x50e30c[_0xb317('0x39')],_0x50e30c[_0xb317('0x3b')]);_0x17a734['attributes']=_[_0xb317('0x3e')](_0x50e30c['model'],qs[_0xb317('0x3f')](_0x45911c[_0xb317('0x3b')][_0xb317('0x3f')]));_0x17a734['attributes']=_0x17a734[_0xb317('0x40')][_0xb317('0x41')]?_0x17a734[_0xb317('0x40')]:_0x50e30c[_0xb317('0x39')];if(!_0x45911c['query'][_0xb317('0x42')]('nolimit')){_0x17a734[_0xb317('0x43')]=qs['limit'](_0x45911c[_0xb317('0x3b')]['limit']);_0x17a734[_0xb317('0x2c')]=qs['offset'](_0x45911c[_0xb317('0x3b')][_0xb317('0x2c')]);}_0x17a734[_0xb317('0x44')]=qs['sort'](_0x45911c['query'][_0xb317('0x45')]);_0x17a734[_0xb317('0x46')]=qs['filters'](_[_0xb317('0x47')](_0x45911c[_0xb317('0x3b')],_0x50e30c[_0xb317('0x3d')]),_0xfed857);if(_0x45911c[_0xb317('0x3b')][_0xb317('0x48')]){_0x17a734['where']=_['merge'](_0x17a734[_0xb317('0x46')],{'$or':_['map'](_0xfed857,function(_0x2bcbab){if(_0x2bcbab[_0xb317('0x37')]!==_0xb317('0x49')){var _0x312b8d={};_0x312b8d[_0x2bcbab[_0xb317('0x33')]]={'$like':'%'+_0x45911c[_0xb317('0x3b')][_0xb317('0x48')]+'%'};return _0x312b8d;}})});}_0x17a734=_[_0xb317('0x4a')]({},_0x17a734,_0x45911c[_0xb317('0x4b')]);var _0x382996={'where':_0x17a734[_0xb317('0x46')]};return db[_0xb317('0x35')][_0xb317('0x2b')](_0x382996)['then'](function(_0xc0f44e){_0x35cdff['count']=_0xc0f44e;if(_0x45911c[_0xb317('0x3b')][_0xb317('0x4c')]){_0x17a734[_0xb317('0x4d')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x17a734);})[_0xb317('0x31')](function(_0x40f4d8){_0x35cdff[_0xb317('0x4e')]=_0x40f4d8;return _0x35cdff;})[_0xb317('0x31')](respondWithFilteredResult(_0x567e05,_0x17a734))[_0xb317('0x27')](handleError(_0x567e05,null));};exports['show']=function(_0x1b5afa,_0x3e127a){var _0x920cf6={'raw':![],'where':{'id':_0x1b5afa['params']['id']}},_0x18b955={};_0x18b955[_0xb317('0x39')]=_[_0xb317('0x3c')](db[_0xb317('0x35')][_0xb317('0x36')]);_0x18b955[_0xb317('0x3b')]=_[_0xb317('0x3c')](_0x1b5afa['query']);_0x18b955[_0xb317('0x3d')]=_[_0xb317('0x3e')](_0x18b955[_0xb317('0x39')],_0x18b955[_0xb317('0x3b')]);_0x920cf6[_0xb317('0x40')]=_[_0xb317('0x3e')](_0x18b955[_0xb317('0x39')],qs['fields'](_0x1b5afa[_0xb317('0x3b')][_0xb317('0x3f')]));_0x920cf6[_0xb317('0x40')]=_0x920cf6[_0xb317('0x40')][_0xb317('0x41')]?_0x920cf6[_0xb317('0x40')]:_0x18b955['model'];if(_0x1b5afa['query'][_0xb317('0x4c')]){_0x920cf6['include']=[{'all':!![]}];}_0x920cf6=_[_0xb317('0x4a')]({},_0x920cf6,_0x1b5afa[_0xb317('0x4b')]);return db[_0xb317('0x35')][_0xb317('0x4f')](_0x920cf6)['then'](handleEntityNotFound(_0x3e127a,null))[_0xb317('0x31')](respondWithResult(_0x3e127a,null))['catch'](handleError(_0x3e127a,null));};exports['create']=function(_0x595138,_0x455e84){return db['ZendeskAccount']['create'](_0x595138[_0xb317('0x50')],{})[_0xb317('0x31')](respondWithResult(_0x455e84,0xc9))[_0xb317('0x27')](handleError(_0x455e84,null));};exports[_0xb317('0x51')]=function(_0x16db1a,_0x2534f7){if(_0x16db1a[_0xb317('0x50')]['id']){delete _0x16db1a[_0xb317('0x50')]['id'];}return db[_0xb317('0x35')][_0xb317('0x4f')]({'where':{'id':_0x16db1a[_0xb317('0x52')]['id']}})[_0xb317('0x31')](handleEntityNotFound(_0x2534f7,null))[_0xb317('0x31')](saveUpdates(_0x16db1a[_0xb317('0x50')],null))['then'](respondWithResult(_0x2534f7,null))[_0xb317('0x27')](handleError(_0x2534f7,null));};exports[_0xb317('0x32')]=function(_0x22a599,_0xf93c2f){return db[_0xb317('0x35')][_0xb317('0x4f')]({'where':{'id':_0x22a599[_0xb317('0x52')]['id']}})['then'](handleEntityNotFound(_0xf93c2f,null))[_0xb317('0x31')](removeEntity(_0xf93c2f,null))[_0xb317('0x27')](handleError(_0xf93c2f,null));};exports[_0xb317('0x53')]=function(_0x4e5fd2,_0x2543b3,_0x242ee8){var _0x21838d={};var _0xa6af78={};var _0x46d62d;var _0x405e82;return db['ZendeskAccount'][_0xb317('0x54')]({'where':{'id':_0x4e5fd2[_0xb317('0x52')]['id']}})['then'](handleEntityNotFound(_0x2543b3,null))['then'](function(_0xf0fdc1){if(_0xf0fdc1){_0x46d62d=_0xf0fdc1;_0xa6af78[_0xb317('0x39')]=_[_0xb317('0x3c')](db[_0xb317('0x55')][_0xb317('0x36')]);_0xa6af78[_0xb317('0x3b')]=_[_0xb317('0x3c')](_0x4e5fd2[_0xb317('0x3b')]);_0xa6af78[_0xb317('0x3d')]=_[_0xb317('0x3e')](_0xa6af78[_0xb317('0x39')],_0xa6af78[_0xb317('0x3b')]);_0x21838d[_0xb317('0x40')]=_[_0xb317('0x3e')](_0xa6af78[_0xb317('0x39')],qs[_0xb317('0x3f')](_0x4e5fd2[_0xb317('0x3b')][_0xb317('0x3f')]));_0x21838d[_0xb317('0x40')]=_0x21838d[_0xb317('0x40')][_0xb317('0x41')]?_0x21838d['attributes']:_0xa6af78[_0xb317('0x39')];_0x21838d[_0xb317('0x44')]=qs[_0xb317('0x45')](_0x4e5fd2[_0xb317('0x3b')][_0xb317('0x45')]);_0x21838d[_0xb317('0x46')]=qs[_0xb317('0x3d')](_[_0xb317('0x47')](_0x4e5fd2[_0xb317('0x3b')],_0xa6af78['filters']));if(_0x4e5fd2[_0xb317('0x3b')]['filter']){_0x21838d[_0xb317('0x46')]=_[_0xb317('0x4a')](_0x21838d[_0xb317('0x46')],{'$or':_['map'](_0x21838d[_0xb317('0x40')],function(_0x20ee0c){var _0x405cff={};_0x405cff[_0x20ee0c]={'$like':'%'+_0x4e5fd2['query']['filter']+'%'};return _0x405cff;})});}_0x21838d=_['merge']({},_0x21838d,_0x4e5fd2[_0xb317('0x4b')]);return _0x46d62d['getConfigurations'](_0x21838d);}})['then'](function(_0x3c4771){if(_0x3c4771){_0x405e82=_0x3c4771[_0xb317('0x41')];if(!_0x4e5fd2['query'][_0xb317('0x42')](_0xb317('0x56'))){_0x21838d[_0xb317('0x43')]=qs[_0xb317('0x43')](_0x4e5fd2[_0xb317('0x3b')][_0xb317('0x43')]);_0x21838d['offset']=qs[_0xb317('0x2c')](_0x4e5fd2[_0xb317('0x3b')][_0xb317('0x2c')]);}return _0x46d62d['getConfigurations'](_0x21838d);}})[_0xb317('0x31')](function(_0x28962d){if(_0x28962d){return _0x28962d?{'count':_0x405e82,'rows':_0x28962d}:null;}})[_0xb317('0x31')](respondWithResult(_0x2543b3,null))[_0xb317('0x27')](handleError(_0x2543b3,null));};exports['addConfiguration']=function(_0x542c49,_0x5599c1,_0x4da015){if(_0x542c49['body']['id']){delete _0x542c49['body']['id'];}return db[_0xb317('0x35')]['findOne']({'where':{'id':_0x542c49[_0xb317('0x52')]['id']}})[_0xb317('0x31')](handleEntityNotFound(_0x5599c1,null))[_0xb317('0x31')](function(_0xbe4505){if(_0xbe4505){_0x542c49[_0xb317('0x50')][_0xb317('0x57')]=_0xbe4505['id'];_0x542c49['body'][_0xb317('0x58')]=integrations[_0xb317('0x59')](_0x542c49['body']['channel'],_0x542c49[_0xb317('0x50')][_0xb317('0x37')]);_0x542c49[_0xb317('0x50')][_0xb317('0x5a')]=integrations['getDescriptions'](_0x542c49[_0xb317('0x50')][_0xb317('0x5b')],_0x542c49[_0xb317('0x50')][_0xb317('0x37')]);return db[_0xb317('0x55')][_0xb317('0x5c')](_0x542c49[_0xb317('0x50')],{'include':[{'model':db['ZendeskField'],'as':_0xb317('0x58')},{'model':db[_0xb317('0x5d')],'as':'Descriptions'}]});}return null;})[_0xb317('0x31')](respondWithResult(_0x5599c1,null))[_0xb317('0x27')](handleError(_0x5599c1,null));};exports[_0xb317('0x5e')]=function(_0x34896d,_0x1dff3f,_0x1067ac){var _0x1ac78f='';return db[_0xb317('0x35')][_0xb317('0x54')]({'where':{'id':_0x34896d['params']['id']},'attributes':['id',_0xb317('0x5f'),_0xb317('0x60'),_0xb317('0x61'),_0xb317('0x62'),_0xb317('0x63')]})[_0xb317('0x31')](handleEntityNotFound(_0x1dff3f,null))[_0xb317('0x31')](function(_0x12ed10){if(_0x12ed10){_0x1ac78f=_0x12ed10[_0xb317('0x63')];var _0x2822e1=_0x1ac78f[_0xb317('0x64')](-0x1);if(_0x2822e1==='/'){_0x1ac78f=_0x1ac78f[_0xb317('0x65')](0x0,_0x1ac78f[_0xb317('0x66')](_0x2822e1));}var _0x1d4ee9={'method':_0xb317('0x67'),'uri':util[_0xb317('0x68')]('%s/%s',_0x1ac78f,_0xb317('0x69')),'json':!![]};switch(_0x12ed10[_0xb317('0x62')]){case _0xb317('0x60'):_0x1d4ee9['headers']={'Authorization':util['format'](_0xb317('0x6a'),new Buffer(util[_0xb317('0x68')]('%s:%s',_0x12ed10[_0xb317('0x5f')],_0x12ed10[_0xb317('0x60')]))[_0xb317('0x6b')](_0xb317('0x6c')))};break;case _0xb317('0x61'):_0x1d4ee9[_0xb317('0x6d')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x12ed10['username'],_0x12ed10['token']))[_0xb317('0x6b')](_0xb317('0x6c')))};break;default:throw new db['Sequelize'][(_0xb317('0x6e'))](_0xb317('0x6f'));}return rp(_0x1d4ee9);}})[_0xb317('0x31')](function(_0x105982){if(_0x105982){var _0x1d7dfc=[_0xb317('0x70'),'description',_0xb317('0x71'),'assignee'];_[_0xb317('0x72')](_0x105982['ticket_fields'],function(_0x219f8f){return _0x1d7dfc[_0xb317('0x73')](_0x219f8f[_0xb317('0x37')]);});return{'count':_0x105982['ticket_fields'][_0xb317('0x41')],'rows':_['map'](_0x105982['ticket_fields'],function(_0x4a430b){return{'id':_0x4a430b['id'],'name':_0x4a430b[_0xb317('0x74')]>0x7?_0x4a430b['title']:_0x4a430b[_0xb317('0x37')],'custom':_0x4a430b[_0xb317('0x74')]>0x7?!![]:![],'options':_0x4a430b[_0xb317('0x75')]?_0x4a430b[_0xb317('0x75')]:_0x4a430b[_0xb317('0x76')]?_0x4a430b[_0xb317('0x76')]:[]};})};}})['then'](respondWithResult(_0x1dff3f,null))[_0xb317('0x27')](function(_0x1ab96f){var _0xdc26bf=_0x34896d[_0xb317('0x3b')][_0xb317('0x77')]?0x1f4:_0x1ab96f['statusCode']||0x1f4;logger['error'](_0xb317('0x78'),_0xb317('0x5e'),_0xdc26bf,JSON[_0xb317('0x21')](_0x1ab96f));delete _0x1ab96f[_0xb317('0x33')];if(_0xdc26bf===0x191){_0xdc26bf=0x190;}_0x1dff3f[_0xb317('0x29')](_0xdc26bf)[_0xb317('0x34')](_0x34896d[_0xb317('0x3b')][_0xb317('0x77')]?{'message':_0xb317('0x79'),'statusCode':_0x1ab96f[_0xb317('0x7a')]}:_0x1ab96f);});}; \ No newline at end of file +var _0x98b8=['base64','Sequelize','Unknown\x20authentication\x20type','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','include','body','find','params','getConfigurations','findOne','pick','options','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','Basic\x20%s','toString'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x98b8,0x93));var _0x898b=function(_0x1d8d06,_0x1d8898){_0x1d8d06=_0x1d8d06-0x0;var _0x1a7237=_0x98b8[_0x1d8d06];return _0x1a7237;};'use strict';var pdf=require(_0x898b('0x0'));var emlformat=require(_0x898b('0x1'));var rimraf=require(_0x898b('0x2'));var zipdir=require(_0x898b('0x3'));var jsonpatch=require(_0x898b('0x4'));var rp=require(_0x898b('0x5'));var moment=require(_0x898b('0x6'));var BPromise=require(_0x898b('0x7'));var Mustache=require(_0x898b('0x8'));var util=require(_0x898b('0x9'));var path=require(_0x898b('0xa'));var sox=require(_0x898b('0xb'));var csv=require(_0x898b('0xc'));var ejs=require(_0x898b('0xd'));var fs=require('fs');var _=require(_0x898b('0xe'));var squel=require('squel');var crypto=require(_0x898b('0xf'));var jsforce=require(_0x898b('0x10'));var deskjs=require(_0x898b('0x11'));var toCsv=require(_0x898b('0xc'));var querystring=require(_0x898b('0x12'));var Papa=require(_0x898b('0x13'));var Redis=require(_0x898b('0x14'));var authService=require(_0x898b('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x898b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x898b('0x17'));var utils=require(_0x898b('0x18'));var config=require(_0x898b('0x19'));var licenseUtil=require(_0x898b('0x1a'));var db=require(_0x898b('0x1b'))['db'];var integrations=require(_0x898b('0x1c'));var jayson=require(_0x898b('0x1d'));var client=jayson[_0x898b('0x1e')][_0x898b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x405aa0,_0x20669c,_0x1fb398,_0x51b5a0){return new BPromise(function(_0x435cba,_0x561cac){var _0x2c2346=_0x51b5a0||client;return _0x2c2346['request'](_0x405aa0,_0x1fb398)['then'](function(_0x427cc4){logger[_0x898b('0x20')](_0x898b('0x21'),_0x20669c,_0x898b('0x22'));logger['debug'](_0x898b('0x23'),_0x20669c,'request\x20sent',JSON['stringify'](_0x427cc4));if(_0x427cc4[_0x898b('0x24')]){if(_0x427cc4[_0x898b('0x24')][_0x898b('0x25')]===0x1f4){logger['error'](_0x898b('0x21'),_0x20669c,_0x427cc4[_0x898b('0x24')][_0x898b('0x26')]);return _0x561cac(_0x427cc4[_0x898b('0x24')][_0x898b('0x26')]);}logger[_0x898b('0x24')](_0x898b('0x21'),_0x20669c,_0x427cc4[_0x898b('0x24')][_0x898b('0x26')]);return _0x435cba(_0x427cc4[_0x898b('0x24')]['message']);}else{logger['info'](_0x898b('0x21'),_0x20669c,_0x898b('0x22'));_0x435cba(_0x427cc4['result'][_0x898b('0x26')]);}})[_0x898b('0x27')](function(_0x43b3a3){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x20669c,_0x43b3a3);_0x561cac(_0x43b3a3);});});}function respondWithStatusCode(_0x66101f,_0x2bd250){_0x2bd250=_0x2bd250||0xcc;return function(_0x1a70a1){if(_0x1a70a1){return _0x66101f[_0x898b('0x28')](_0x2bd250);}return _0x66101f[_0x898b('0x29')](_0x2bd250)[_0x898b('0x2a')]();};}function respondWithResult(_0x11c558,_0x21785b){_0x21785b=_0x21785b||0xc8;return function(_0x284dfd){if(_0x284dfd){return _0x11c558[_0x898b('0x29')](_0x21785b)[_0x898b('0x2b')](_0x284dfd);}};}function respondWithFilteredResult(_0x3479e1,_0x163a6c){return function(_0x485460){if(_0x485460){var _0x5177c9=_0x485460[_0x898b('0x2c')],_0x12c7e6=_0x163a6c[_0x898b('0x2d')],_0xb5c11=_0x163a6c[_0x898b('0x2d')]+_0x163a6c[_0x898b('0x2e')],_0x177ee0;if(_0xb5c11>=_0x5177c9){_0xb5c11=_0x5177c9;_0x177ee0=0xc8;}else{_0x177ee0=0xce;}_0x3479e1[_0x898b('0x29')](_0x177ee0);return _0x3479e1[_0x898b('0x2f')](_0x898b('0x30'),_0x12c7e6+'-'+_0xb5c11+'/'+_0x5177c9)['json'](_0x485460);}return null;};}function patchUpdates(_0x4f1bb5){return function(_0x2bdf79){try{jsonpatch[_0x898b('0x31')](_0x2bdf79,_0x4f1bb5,!![]);}catch(_0x561125){return BPromise[_0x898b('0x32')](_0x561125);}return _0x2bdf79[_0x898b('0x33')]();};}function saveUpdates(_0x3b2114,_0x2ede2d){return function(_0x18563c){if(_0x18563c){return _0x18563c[_0x898b('0x34')](_0x3b2114)['then'](function(_0x19dedc){return _0x19dedc;});}return null;};}function removeEntity(_0x63f3ce,_0x52b32c){return function(_0x816333){if(_0x816333){return _0x816333['destroy']()[_0x898b('0x35')](function(){_0x63f3ce[_0x898b('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x312718,_0x4e472a){return function(_0x5f3dd5){if(!_0x5f3dd5){_0x312718[_0x898b('0x28')](0x194);}return _0x5f3dd5;};}function handleError(_0x3854dd,_0x43358d){_0x43358d=_0x43358d||0x1f4;return function(_0x3bde9a){logger[_0x898b('0x24')](_0x3bde9a[_0x898b('0x36')]);if(_0x3bde9a[_0x898b('0x37')]){delete _0x3bde9a[_0x898b('0x37')];}_0x3854dd[_0x898b('0x29')](_0x43358d)[_0x898b('0x38')](_0x3bde9a);};}exports[_0x898b('0x39')]=function(_0x177df7,_0x4ec638){var _0x5e6653={},_0x48e618={},_0x5e735d={'count':0x0,'rows':[]};var _0x393735=_[_0x898b('0x3a')](db[_0x898b('0x3b')]['rawAttributes'],function(_0x2c79f6){return{'name':_0x2c79f6[_0x898b('0x3c')],'type':_0x2c79f6[_0x898b('0x3d')][_0x898b('0x3e')]};});_0x48e618[_0x898b('0x3f')]=_['map'](_0x393735,_0x898b('0x37'));_0x48e618[_0x898b('0x40')]=_[_0x898b('0x41')](_0x177df7['query']);_0x48e618[_0x898b('0x42')]=_[_0x898b('0x43')](_0x48e618['model'],_0x48e618[_0x898b('0x40')]);_0x5e6653[_0x898b('0x44')]=_[_0x898b('0x43')](_0x48e618[_0x898b('0x3f')],qs['fields'](_0x177df7[_0x898b('0x40')][_0x898b('0x45')]));_0x5e6653[_0x898b('0x44')]=_0x5e6653[_0x898b('0x44')][_0x898b('0x46')]?_0x5e6653[_0x898b('0x44')]:_0x48e618[_0x898b('0x3f')];if(!_0x177df7[_0x898b('0x40')][_0x898b('0x47')](_0x898b('0x48'))){_0x5e6653['limit']=qs['limit'](_0x177df7[_0x898b('0x40')][_0x898b('0x2e')]);_0x5e6653[_0x898b('0x2d')]=qs[_0x898b('0x2d')](_0x177df7['query'][_0x898b('0x2d')]);}_0x5e6653[_0x898b('0x49')]=qs[_0x898b('0x4a')](_0x177df7[_0x898b('0x40')]['sort']);_0x5e6653[_0x898b('0x4b')]=qs[_0x898b('0x42')](_['pick'](_0x177df7[_0x898b('0x40')],_0x48e618[_0x898b('0x42')]),_0x393735);if(_0x177df7['query'][_0x898b('0x4c')]){_0x5e6653['where']=_[_0x898b('0x4d')](_0x5e6653['where'],{'$or':_[_0x898b('0x3a')](_0x393735,function(_0xd7f8fe){if(_0xd7f8fe[_0x898b('0x3d')]!==_0x898b('0x4e')){var _0x38da53={};_0x38da53[_0xd7f8fe['name']]={'$like':'%'+_0x177df7[_0x898b('0x40')][_0x898b('0x4c')]+'%'};return _0x38da53;}})});}_0x5e6653=_[_0x898b('0x4d')]({},_0x5e6653,_0x177df7['options']);var _0x2ad7ca={'where':_0x5e6653[_0x898b('0x4b')]};return db['ZendeskAccount'][_0x898b('0x2c')](_0x2ad7ca)[_0x898b('0x35')](function(_0x3aaf1a){_0x5e735d[_0x898b('0x2c')]=_0x3aaf1a;if(_0x177df7[_0x898b('0x40')][_0x898b('0x4f')]){_0x5e6653['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x898b('0x50')](_0x5e6653);})[_0x898b('0x35')](function(_0x4b077b){_0x5e735d[_0x898b('0x51')]=_0x4b077b;return _0x5e735d;})[_0x898b('0x35')](respondWithFilteredResult(_0x4ec638,_0x5e6653))[_0x898b('0x27')](handleError(_0x4ec638,null));};exports[_0x898b('0x52')]=function(_0x208be3,_0x463ec9){var _0x498240={'raw':![],'where':{'id':_0x208be3['params']['id']}},_0x4eab6a={};_0x4eab6a[_0x898b('0x3f')]=_[_0x898b('0x41')](db['ZendeskAccount'][_0x898b('0x53')]);_0x4eab6a[_0x898b('0x40')]=_[_0x898b('0x41')](_0x208be3[_0x898b('0x40')]);_0x4eab6a['filters']=_[_0x898b('0x43')](_0x4eab6a['model'],_0x4eab6a[_0x898b('0x40')]);_0x498240['attributes']=_[_0x898b('0x43')](_0x4eab6a[_0x898b('0x3f')],qs[_0x898b('0x45')](_0x208be3['query'][_0x898b('0x45')]));_0x498240[_0x898b('0x44')]=_0x498240[_0x898b('0x44')][_0x898b('0x46')]?_0x498240[_0x898b('0x44')]:_0x4eab6a['model'];if(_0x208be3['query'][_0x898b('0x4f')]){_0x498240[_0x898b('0x54')]=[{'all':!![]}];}_0x498240=_[_0x898b('0x4d')]({},_0x498240,_0x208be3['options']);return db[_0x898b('0x3b')]['find'](_0x498240)[_0x898b('0x35')](handleEntityNotFound(_0x463ec9,null))[_0x898b('0x35')](respondWithResult(_0x463ec9,null))['catch'](handleError(_0x463ec9,null));};exports['create']=function(_0xa15783,_0x18873f){return db[_0x898b('0x3b')]['create'](_0xa15783['body'],{})['then'](respondWithResult(_0x18873f,0xc9))[_0x898b('0x27')](handleError(_0x18873f,null));};exports[_0x898b('0x34')]=function(_0x2fe11f,_0x1fb84a){if(_0x2fe11f[_0x898b('0x55')]['id']){delete _0x2fe11f[_0x898b('0x55')]['id'];}return db['ZendeskAccount'][_0x898b('0x56')]({'where':{'id':_0x2fe11f[_0x898b('0x57')]['id']}})[_0x898b('0x35')](handleEntityNotFound(_0x1fb84a,null))[_0x898b('0x35')](saveUpdates(_0x2fe11f[_0x898b('0x55')],null))[_0x898b('0x35')](respondWithResult(_0x1fb84a,null))['catch'](handleError(_0x1fb84a,null));};exports['destroy']=function(_0x8592e6,_0x163f51){return db[_0x898b('0x3b')][_0x898b('0x56')]({'where':{'id':_0x8592e6[_0x898b('0x57')]['id']}})[_0x898b('0x35')](handleEntityNotFound(_0x163f51,null))['then'](removeEntity(_0x163f51,null))[_0x898b('0x27')](handleError(_0x163f51,null));};exports[_0x898b('0x58')]=function(_0x58ba5c,_0x175a76,_0x4aee80){var _0x1ca493={};var _0x29076c={};var _0xa8b62d;var _0x206fcf;return db[_0x898b('0x3b')][_0x898b('0x59')]({'where':{'id':_0x58ba5c[_0x898b('0x57')]['id']}})[_0x898b('0x35')](handleEntityNotFound(_0x175a76,null))['then'](function(_0x31aa89){if(_0x31aa89){_0xa8b62d=_0x31aa89;_0x29076c[_0x898b('0x3f')]=_[_0x898b('0x41')](db['ZendeskConfiguration'][_0x898b('0x53')]);_0x29076c[_0x898b('0x40')]=_[_0x898b('0x41')](_0x58ba5c[_0x898b('0x40')]);_0x29076c[_0x898b('0x42')]=_['intersection'](_0x29076c[_0x898b('0x3f')],_0x29076c[_0x898b('0x40')]);_0x1ca493[_0x898b('0x44')]=_[_0x898b('0x43')](_0x29076c['model'],qs['fields'](_0x58ba5c['query']['fields']));_0x1ca493[_0x898b('0x44')]=_0x1ca493[_0x898b('0x44')][_0x898b('0x46')]?_0x1ca493[_0x898b('0x44')]:_0x29076c[_0x898b('0x3f')];_0x1ca493[_0x898b('0x49')]=qs[_0x898b('0x4a')](_0x58ba5c[_0x898b('0x40')][_0x898b('0x4a')]);_0x1ca493[_0x898b('0x4b')]=qs[_0x898b('0x42')](_[_0x898b('0x5a')](_0x58ba5c[_0x898b('0x40')],_0x29076c[_0x898b('0x42')]));if(_0x58ba5c[_0x898b('0x40')]['filter']){_0x1ca493[_0x898b('0x4b')]=_['merge'](_0x1ca493['where'],{'$or':_[_0x898b('0x3a')](_0x1ca493[_0x898b('0x44')],function(_0xefac7a){var _0x9a1214={};_0x9a1214[_0xefac7a]={'$like':'%'+_0x58ba5c[_0x898b('0x40')][_0x898b('0x4c')]+'%'};return _0x9a1214;})});}_0x1ca493=_['merge']({},_0x1ca493,_0x58ba5c[_0x898b('0x5b')]);return _0xa8b62d['getConfigurations'](_0x1ca493);}})[_0x898b('0x35')](function(_0x30ba59){if(_0x30ba59){_0x206fcf=_0x30ba59['length'];if(!_0x58ba5c[_0x898b('0x40')][_0x898b('0x47')](_0x898b('0x48'))){_0x1ca493['limit']=qs[_0x898b('0x2e')](_0x58ba5c['query'][_0x898b('0x2e')]);_0x1ca493[_0x898b('0x2d')]=qs[_0x898b('0x2d')](_0x58ba5c[_0x898b('0x40')]['offset']);}return _0xa8b62d[_0x898b('0x58')](_0x1ca493);}})[_0x898b('0x35')](function(_0x13ffc2){if(_0x13ffc2){return _0x13ffc2?{'count':_0x206fcf,'rows':_0x13ffc2}:null;}})[_0x898b('0x35')](respondWithResult(_0x175a76,null))[_0x898b('0x27')](handleError(_0x175a76,null));};exports['addConfiguration']=function(_0x30e35c,_0xb4cb2a,_0x1232e1){if(_0x30e35c[_0x898b('0x55')]['id']){delete _0x30e35c['body']['id'];}return db[_0x898b('0x3b')][_0x898b('0x59')]({'where':{'id':_0x30e35c['params']['id']}})[_0x898b('0x35')](handleEntityNotFound(_0xb4cb2a,null))[_0x898b('0x35')](function(_0x1be43a){if(_0x1be43a){_0x30e35c[_0x898b('0x55')][_0x898b('0x5c')]=_0x1be43a['id'];_0x30e35c[_0x898b('0x55')][_0x898b('0x5d')]=integrations[_0x898b('0x5e')](_0x30e35c[_0x898b('0x55')][_0x898b('0x5f')],_0x30e35c[_0x898b('0x55')][_0x898b('0x3d')]);_0x30e35c[_0x898b('0x55')][_0x898b('0x60')]=integrations['getDescriptions'](_0x30e35c[_0x898b('0x55')][_0x898b('0x5f')],_0x30e35c['body'][_0x898b('0x3d')]);return db[_0x898b('0x61')]['create'](_0x30e35c[_0x898b('0x55')],{'include':[{'model':db[_0x898b('0x62')],'as':_0x898b('0x5d')},{'model':db[_0x898b('0x62')],'as':_0x898b('0x60')}]});}return null;})[_0x898b('0x35')](respondWithResult(_0xb4cb2a,null))[_0x898b('0x27')](handleError(_0xb4cb2a,null));};exports['getFields']=function(_0x4dc692,_0x58f94f,_0x3b1fd5){var _0x113648='';return db[_0x898b('0x3b')][_0x898b('0x59')]({'where':{'id':_0x4dc692[_0x898b('0x57')]['id']},'attributes':['id',_0x898b('0x63'),_0x898b('0x64'),_0x898b('0x65'),_0x898b('0x66'),_0x898b('0x67')]})[_0x898b('0x35')](handleEntityNotFound(_0x58f94f,null))[_0x898b('0x35')](function(_0x5c28f2){if(_0x5c28f2){_0x113648=_0x5c28f2['remoteUri'];var _0x5bb6c7=_0x113648[_0x898b('0x68')](-0x1);if(_0x5bb6c7==='/'){_0x113648=_0x113648[_0x898b('0x69')](0x0,_0x113648[_0x898b('0x6a')](_0x5bb6c7));}var _0x4b7633={'method':_0x898b('0x6b'),'uri':util[_0x898b('0x6c')](_0x898b('0x6d'),_0x113648,_0x898b('0x6e')),'json':!![]};switch(_0x5c28f2[_0x898b('0x66')]){case _0x898b('0x64'):_0x4b7633[_0x898b('0x6f')]={'Authorization':util[_0x898b('0x6c')]('Basic\x20%s',new Buffer(util['format'](_0x898b('0x70'),_0x5c28f2[_0x898b('0x63')],_0x5c28f2['password']))['toString']('base64'))};break;case'token':_0x4b7633[_0x898b('0x6f')]={'Authorization':util[_0x898b('0x6c')](_0x898b('0x71'),new Buffer(util['format']('%s/token:%s',_0x5c28f2[_0x898b('0x63')],_0x5c28f2[_0x898b('0x65')]))[_0x898b('0x72')](_0x898b('0x73')))};break;default:throw new db[(_0x898b('0x74'))]['ValidationError'](_0x898b('0x75'));}return rp(_0x4b7633);}})[_0x898b('0x35')](function(_0x2d9cc7){if(_0x2d9cc7){var _0x4805a9=['subject',_0x898b('0x76'),'group',_0x898b('0x77')];_[_0x898b('0x78')](_0x2d9cc7[_0x898b('0x6e')],function(_0x26d1bf){return _0x4805a9[_0x898b('0x79')](_0x26d1bf['type']);});return{'count':_0x2d9cc7[_0x898b('0x6e')][_0x898b('0x46')],'rows':_[_0x898b('0x3a')](_0x2d9cc7[_0x898b('0x6e')],function(_0x45f8bf){return{'id':_0x45f8bf['id'],'name':_0x45f8bf[_0x898b('0x7a')]>0x7?_0x45f8bf[_0x898b('0x7b')]:_0x45f8bf[_0x898b('0x3d')],'custom':_0x45f8bf[_0x898b('0x7a')]>0x7?!![]:![],'options':_0x45f8bf[_0x898b('0x7c')]?_0x45f8bf[_0x898b('0x7c')]:_0x45f8bf[_0x898b('0x7d')]?_0x45f8bf['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x58f94f,null))[_0x898b('0x27')](function(_0x40914b){var _0x4a4186=_0x4dc692['query']['test']?0x1f4:_0x40914b[_0x898b('0x7e')]||0x1f4;logger['error'](_0x898b('0x7f'),_0x898b('0x80'),_0x4a4186,JSON[_0x898b('0x81')](_0x40914b));delete _0x40914b[_0x898b('0x37')];if(_0x4a4186===0x191){_0x4a4186=0x190;}_0x58f94f[_0x898b('0x29')](_0x4a4186)[_0x898b('0x38')](_0x4dc692['query']['test']?{'message':_0x898b('0x82'),'statusCode':_0x40914b[_0x898b('0x7e')]}:_0x40914b);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c84721d..a6a9f7c 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.model.js +++ b/server/api/intZendeskAccount/intZendeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','define','ZendeskAccount','lodash','util'];(function(_0x2fc3c6,_0x5d6475){var _0x10f2ff=function(_0x3878d8){while(--_0x3878d8){_0x2fc3c6['push'](_0x2fc3c6['shift']());}};_0x10f2ff(++_0x5d6475);}(_0x4bbe,0x1de));var _0xe4bb=function(_0x4450d7,_0xd27f00){_0x4450d7=_0x4450d7-0x0;var _0x7de19e=_0x4bbe[_0x4450d7];return _0x7de19e;};'use strict';var _=require(_0xe4bb('0x0'));var util=require(_0xe4bb('0x1'));var logger=require(_0xe4bb('0x2'))(_0xe4bb('0x3'));var moment=require(_0xe4bb('0x4'));var BPromise=require(_0xe4bb('0x5'));var rp=require(_0xe4bb('0x6'));var fs=require('fs');var path=require(_0xe4bb('0x7'));var rimraf=require(_0xe4bb('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xe4bb('0x9'));module['exports']=function(_0x57d2f6,_0x256172){return _0x57d2f6[_0xe4bb('0xa')](_0xe4bb('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38ab=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','../../config/logger','api','moment','bluebird'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x38ab,0x6a));var _0xb38a=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x38ab[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb38a('0x0'))(_0xb38a('0x1'));var moment=require(_0xb38a('0x2'));var BPromise=require(_0xb38a('0x3'));var rp=require(_0xb38a('0x4'));var fs=require('fs');var path=require(_0xb38a('0x5'));var rimraf=require(_0xb38a('0x6'));var config=require(_0xb38a('0x7'));var attributes=require(_0xb38a('0x8'));var integrations=require(_0xb38a('0x9'));module[_0xb38a('0xa')]=function(_0x544f81,_0x2369dd){return _0x544f81['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index a304dfc..ef2a89f 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options'];(function(_0x428202,_0x40a85d){var _0x5ae0e5=function(_0xc403b1){while(--_0xc403b1){_0x428202['push'](_0x428202['shift']());}};_0x5ae0e5(++_0x40a85d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2a652c,_0x1facdb){var _0x52ea47=function(_0x56e5da){while(--_0x56e5da){_0x2a652c['push'](_0x2a652c['shift']());}};_0x52ea47(++_0x1facdb);}(_0x757a,0xde));var _0xa757=function(_0x43bc77,_0x3cb83f){_0x43bc77=_0x43bc77-0x0;var _0x2f4f9e=_0x757a[_0x43bc77];return _0x2f4f9e;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d648463..0437038 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6f8=['setTags','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post'];(function(_0x2473d3,_0x4dce19){var _0x38f588=function(_0x5b40eb){while(--_0x5b40eb){_0x2473d3['push'](_0x2473d3['shift']());}};_0x38f588(++_0x4dce19);}(_0xd6f8,0x14b));var _0x8d6f=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0xd6f8[_0x503cd5];return _0x1fdf1e;};'use strict';var multer=require('multer');var util=require(_0x8d6f('0x0'));var path=require(_0x8d6f('0x1'));var timeout=require(_0x8d6f('0x2'));var express=require(_0x8d6f('0x3'));var router=express[_0x8d6f('0x4')]();var auth=require(_0x8d6f('0x5'));var interaction=require(_0x8d6f('0x6'));var config=require(_0x8d6f('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x8d6f('0x8')]('/',auth[_0x8d6f('0x9')](),controller[_0x8d6f('0xa')]);router[_0x8d6f('0x8')]('/:id',auth[_0x8d6f('0x9')](),controller[_0x8d6f('0xb')]);router[_0x8d6f('0x8')]('/:id/fields',auth[_0x8d6f('0x9')](),controller['getFields']);router[_0x8d6f('0x8')](_0x8d6f('0xc'),auth[_0x8d6f('0x9')](),controller[_0x8d6f('0xd')]);router[_0x8d6f('0x8')](_0x8d6f('0xe'),auth['isAuthenticated'](),controller[_0x8d6f('0xf')]);router[_0x8d6f('0x8')](_0x8d6f('0x10'),auth[_0x8d6f('0x9')](),controller[_0x8d6f('0x11')]);router[_0x8d6f('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8d6f('0x12')]('/:id/tags',auth[_0x8d6f('0x9')](),controller[_0x8d6f('0x13')]);router['put'](_0x8d6f('0x14'),auth[_0x8d6f('0x9')](),controller[_0x8d6f('0x15')]);router[_0x8d6f('0x16')](_0x8d6f('0x14'),auth[_0x8d6f('0x9')](),controller[_0x8d6f('0x17')]);module[_0x8d6f('0x18')]=router; \ No newline at end of file +var _0x3cab=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3c3a86,_0x3deb37){var _0x4ff3e6=function(_0x59072c){while(--_0x59072c){_0x3c3a86['push'](_0x3c3a86['shift']());}};_0x4ff3e6(++_0x3deb37);}(_0x3cab,0x17a));var _0xb3ca=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x3cab[_0xc8db6b];return _0x12cb81;};'use strict';var multer=require(_0xb3ca('0x0'));var util=require('util');var path=require(_0xb3ca('0x1'));var timeout=require(_0xb3ca('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb3ca('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb3ca('0x4'));var controller=require(_0xb3ca('0x5'));router[_0xb3ca('0x6')]('/',auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x8')]);router['get'](_0xb3ca('0x9'),auth['isAuthenticated'](),controller[_0xb3ca('0xa')]);router[_0xb3ca('0x6')](_0xb3ca('0xb'),auth[_0xb3ca('0x7')](),controller[_0xb3ca('0xc')]);router[_0xb3ca('0x6')](_0xb3ca('0xd'),auth['isAuthenticated'](),controller[_0xb3ca('0xe')]);router['get'](_0xb3ca('0xf'),auth['isAuthenticated'](),controller[_0xb3ca('0x10')]);router[_0xb3ca('0x6')](_0xb3ca('0x11'),auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x12')]);router['post']('/',auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x13')]);router[_0xb3ca('0x14')]('/:id/tags',auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x15')]);router[_0xb3ca('0x16')](_0xb3ca('0x9'),auth[_0xb3ca('0x7')](),controller['update']);router[_0xb3ca('0x17')]('/:id',auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x18')]);module[_0xb3ca('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index dfbe179..a688135 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe998=['sequelize','STRING'];(function(_0x2aa527,_0x3647f5){var _0x5f4e50=function(_0x42b7f3){while(--_0x42b7f3){_0x2aa527['push'](_0x2aa527['shift']());}};_0x5f4e50(++_0x3647f5);}(_0xe998,0x1d4));var _0x8e99=function(_0x6b1f04,_0x267849){_0x6b1f04=_0x6b1f04-0x0;var _0x143cdc=_0xe998[_0x6b1f04];return _0x143cdc;};'use strict';var Sequelize=require(_0x8e99('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e99('0x1')]},'description':{'type':Sequelize[_0x8e99('0x1')]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 9850e15..f670ac9 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x803c=['fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','ZendeskConfiguration','include','findAll','rows','keys','options','find','create','update','params','body','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','destroy','name','send','index','rawAttributes','key','model','map','query','intersection','attributes'];(function(_0x4636a0,_0x3c1aed){var _0x5e3e48=function(_0x10cb15){while(--_0x10cb15){_0x4636a0['push'](_0x4636a0['shift']());}};_0x5e3e48(++_0x3c1aed);}(_0x803c,0x77));var _0xc803=function(_0x363024,_0x2b5ed7){_0x363024=_0x363024-0x0;var _0x1259c8=_0x803c[_0x363024];return _0x1259c8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc803('0x0'));var rimraf=require(_0xc803('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc803('0x2'));var rp=require(_0xc803('0x3'));var moment=require(_0xc803('0x4'));var BPromise=require(_0xc803('0x5'));var Mustache=require(_0xc803('0x6'));var util=require('util');var path=require(_0xc803('0x7'));var sox=require(_0xc803('0x8'));var csv=require(_0xc803('0x9'));var ejs=require(_0xc803('0xa'));var fs=require('fs');var _=require(_0xc803('0xb'));var squel=require('squel');var crypto=require(_0xc803('0xc'));var jsforce=require(_0xc803('0xd'));var deskjs=require(_0xc803('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc803('0xf'));var Papa=require('papaparse');var Redis=require(_0xc803('0x10'));var authService=require(_0xc803('0x11'));var qs=require(_0xc803('0x12'));var as=require(_0xc803('0x13'));var hardwareService=require(_0xc803('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc803('0x15'));var config=require(_0xc803('0x16'));var licenseUtil=require(_0xc803('0x17'));var db=require(_0xc803('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xc803('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x27f253,_0x10dc03,_0x48b6f2,_0x64899a){return new BPromise(function(_0x12aeae,_0x43e7aa){var _0x501835=_0x64899a||client;return _0x501835['request'](_0x27f253,_0x48b6f2)[_0xc803('0x1a')](function(_0x5a25e3){logger['info'](_0xc803('0x1b'),_0x10dc03,_0xc803('0x1c'));logger[_0xc803('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x10dc03,_0xc803('0x1c'),JSON[_0xc803('0x1e')](_0x5a25e3));if(_0x5a25e3[_0xc803('0x1f')]){if(_0x5a25e3['error'][_0xc803('0x20')]===0x1f4){logger[_0xc803('0x1f')](_0xc803('0x1b'),_0x10dc03,_0x5a25e3[_0xc803('0x1f')]['message']);return _0x43e7aa(_0x5a25e3[_0xc803('0x1f')][_0xc803('0x21')]);}logger[_0xc803('0x1f')](_0xc803('0x1b'),_0x10dc03,_0x5a25e3[_0xc803('0x1f')][_0xc803('0x21')]);return _0x12aeae(_0x5a25e3[_0xc803('0x1f')][_0xc803('0x21')]);}else{logger['info'](_0xc803('0x1b'),_0x10dc03,_0xc803('0x1c'));_0x12aeae(_0x5a25e3[_0xc803('0x22')][_0xc803('0x21')]);}})[_0xc803('0x23')](function(_0x4c54ac){logger[_0xc803('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x10dc03,_0x4c54ac);_0x43e7aa(_0x4c54ac);});});}function respondWithStatusCode(_0xdcd40d,_0x165ad3){_0x165ad3=_0x165ad3||0xcc;return function(_0x29cb54){if(_0x29cb54){return _0xdcd40d[_0xc803('0x24')](_0x165ad3);}return _0xdcd40d[_0xc803('0x25')](_0x165ad3)[_0xc803('0x26')]();};}function respondWithResult(_0x260f1a,_0x56db82){_0x56db82=_0x56db82||0xc8;return function(_0xa9f926){if(_0xa9f926){return _0x260f1a[_0xc803('0x25')](_0x56db82)[_0xc803('0x27')](_0xa9f926);}};}function respondWithFilteredResult(_0x520796,_0x1c6899){return function(_0x521c84){if(_0x521c84){var _0x40cdd0=_0x521c84[_0xc803('0x28')],_0x27a746=_0x1c6899[_0xc803('0x29')],_0x1ecf84=_0x1c6899[_0xc803('0x29')]+_0x1c6899[_0xc803('0x2a')],_0x27f3c5;if(_0x1ecf84>=_0x40cdd0){_0x1ecf84=_0x40cdd0;_0x27f3c5=0xc8;}else{_0x27f3c5=0xce;}_0x520796[_0xc803('0x25')](_0x27f3c5);return _0x520796[_0xc803('0x2b')]('Content-Range',_0x27a746+'-'+_0x1ecf84+'/'+_0x40cdd0)[_0xc803('0x27')](_0x521c84);}return null;};}function patchUpdates(_0x363725){return function(_0x398ec0){try{jsonpatch['apply'](_0x398ec0,_0x363725,!![]);}catch(_0x20f7e4){return BPromise[_0xc803('0x2c')](_0x20f7e4);}return _0x398ec0[_0xc803('0x2d')]();};}function saveUpdates(_0x54b850,_0x4080af){return function(_0x926124){if(_0x926124){return _0x926124['update'](_0x54b850)['then'](function(_0x11b9e9){return _0x11b9e9;});}return null;};}function removeEntity(_0x51d49a,_0x3a6274){return function(_0x2090c1){if(_0x2090c1){return _0x2090c1[_0xc803('0x2e')]()[_0xc803('0x1a')](function(){_0x51d49a['status'](0xcc)[_0xc803('0x26')]();});}};}function handleEntityNotFound(_0x30a0ee,_0x1e520e){return function(_0x26fb0b){if(!_0x26fb0b){_0x30a0ee['sendStatus'](0x194);}return _0x26fb0b;};}function handleError(_0x5b91ba,_0x453344){_0x453344=_0x453344||0x1f4;return function(_0x2835e3){logger[_0xc803('0x1f')](_0x2835e3['stack']);if(_0x2835e3['name']){delete _0x2835e3[_0xc803('0x2f')];}_0x5b91ba['status'](_0x453344)[_0xc803('0x30')](_0x2835e3);};}exports[_0xc803('0x31')]=function(_0x3e0ae7,_0x36330a){var _0x15557a={},_0x2f7e35={},_0x42eb8b={'count':0x0,'rows':[]};var _0x3f625b=_['map'](db['ZendeskConfiguration'][_0xc803('0x32')],function(_0x197f48){return{'name':_0x197f48['fieldName'],'type':_0x197f48['type'][_0xc803('0x33')]};});_0x2f7e35[_0xc803('0x34')]=_[_0xc803('0x35')](_0x3f625b,'name');_0x2f7e35[_0xc803('0x36')]=_['keys'](_0x3e0ae7[_0xc803('0x36')]);_0x2f7e35['filters']=_[_0xc803('0x37')](_0x2f7e35['model'],_0x2f7e35[_0xc803('0x36')]);_0x15557a[_0xc803('0x38')]=_['intersection'](_0x2f7e35[_0xc803('0x34')],qs[_0xc803('0x39')](_0x3e0ae7['query'][_0xc803('0x39')]));_0x15557a[_0xc803('0x38')]=_0x15557a[_0xc803('0x38')][_0xc803('0x3a')]?_0x15557a['attributes']:_0x2f7e35[_0xc803('0x34')];if(!_0x3e0ae7[_0xc803('0x36')][_0xc803('0x3b')]('nolimit')){_0x15557a['limit']=qs[_0xc803('0x2a')](_0x3e0ae7[_0xc803('0x36')][_0xc803('0x2a')]);_0x15557a['offset']=qs['offset'](_0x3e0ae7[_0xc803('0x36')][_0xc803('0x29')]);}_0x15557a[_0xc803('0x3c')]=qs['sort'](_0x3e0ae7[_0xc803('0x36')][_0xc803('0x3d')]);_0x15557a[_0xc803('0x3e')]=qs[_0xc803('0x3f')](_[_0xc803('0x40')](_0x3e0ae7['query'],_0x2f7e35[_0xc803('0x3f')]),_0x3f625b);if(_0x3e0ae7['query'][_0xc803('0x41')]){_0x15557a[_0xc803('0x3e')]=_[_0xc803('0x42')](_0x15557a['where'],{'$or':_[_0xc803('0x35')](_0x3f625b,function(_0x3cd0fc){if(_0x3cd0fc[_0xc803('0x43')]!=='VIRTUAL'){var _0x293245={};_0x293245[_0x3cd0fc['name']]={'$like':'%'+_0x3e0ae7['query'][_0xc803('0x41')]+'%'};return _0x293245;}})});}_0x15557a=_[_0xc803('0x42')]({},_0x15557a,_0x3e0ae7['options']);var _0x13c24a={'where':_0x15557a[_0xc803('0x3e')]};return db[_0xc803('0x44')][_0xc803('0x28')](_0x13c24a)['then'](function(_0x3a34b3){_0x42eb8b['count']=_0x3a34b3;if(_0x3e0ae7[_0xc803('0x36')]['includeAll']){_0x15557a[_0xc803('0x45')]=[{'all':!![]}];}return db[_0xc803('0x44')][_0xc803('0x46')](_0x15557a);})[_0xc803('0x1a')](function(_0x2f1f3e){_0x42eb8b[_0xc803('0x47')]=_0x2f1f3e;return _0x42eb8b;})[_0xc803('0x1a')](respondWithFilteredResult(_0x36330a,_0x15557a))[_0xc803('0x23')](handleError(_0x36330a,null));};exports['show']=function(_0x4df81a,_0x5c08cd){var _0x16b7fd={'raw':![],'where':{'id':_0x4df81a['params']['id']}},_0x4c6faa={};_0x4c6faa['model']=_['keys'](db['ZendeskConfiguration'][_0xc803('0x32')]);_0x4c6faa[_0xc803('0x36')]=_[_0xc803('0x48')](_0x4df81a['query']);_0x4c6faa[_0xc803('0x3f')]=_['intersection'](_0x4c6faa[_0xc803('0x34')],_0x4c6faa[_0xc803('0x36')]);_0x16b7fd[_0xc803('0x38')]=_[_0xc803('0x37')](_0x4c6faa[_0xc803('0x34')],qs[_0xc803('0x39')](_0x4df81a['query'][_0xc803('0x39')]));_0x16b7fd[_0xc803('0x38')]=_0x16b7fd['attributes'][_0xc803('0x3a')]?_0x16b7fd[_0xc803('0x38')]:_0x4c6faa['model'];if(_0x4df81a[_0xc803('0x36')]['includeAll']){_0x16b7fd[_0xc803('0x45')]=[{'all':!![]}];}_0x16b7fd=_[_0xc803('0x42')]({},_0x16b7fd,_0x4df81a[_0xc803('0x49')]);return db[_0xc803('0x44')][_0xc803('0x4a')](_0x16b7fd)[_0xc803('0x1a')](handleEntityNotFound(_0x5c08cd,null))['then'](respondWithResult(_0x5c08cd,null))[_0xc803('0x23')](handleError(_0x5c08cd,null));};exports[_0xc803('0x4b')]=function(_0x44658a,_0x253cb5){return db[_0xc803('0x44')]['create'](_0x44658a['body'],{})[_0xc803('0x1a')](respondWithResult(_0x253cb5,0xc9))['catch'](handleError(_0x253cb5,null));};exports[_0xc803('0x4c')]=function(_0x5178d9,_0x5dbbf4){if(_0x5178d9['body']['id']){delete _0x5178d9['body']['id'];}return db[_0xc803('0x44')][_0xc803('0x4a')]({'where':{'id':_0x5178d9[_0xc803('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5dbbf4,null))[_0xc803('0x1a')](saveUpdates(_0x5178d9[_0xc803('0x4e')],null))[_0xc803('0x1a')](respondWithResult(_0x5dbbf4,null))[_0xc803('0x23')](handleError(_0x5dbbf4,null));};exports['destroy']=function(_0xa226b6,_0x33d6b4){return db[_0xc803('0x44')][_0xc803('0x4a')]({'where':{'id':_0xa226b6[_0xc803('0x4d')]['id']}})[_0xc803('0x1a')](handleEntityNotFound(_0x33d6b4,null))[_0xc803('0x1a')](removeEntity(_0x33d6b4,null))[_0xc803('0x23')](handleError(_0x33d6b4,null));};exports[_0xc803('0x4f')]=function(_0x2634d4,_0x30b647,_0x2a15a1){var _0x541341={};var _0xd634dd={};var _0x254165;var _0x23f69a;return db['ZendeskConfiguration'][_0xc803('0x50')]({'where':{'id':_0x2634d4[_0xc803('0x4d')]['id']}})[_0xc803('0x1a')](handleEntityNotFound(_0x30b647,null))[_0xc803('0x1a')](function(_0x33c685){if(_0x33c685){_0x254165=_0x33c685;_0xd634dd[_0xc803('0x34')]=_[_0xc803('0x48')](db[_0xc803('0x51')][_0xc803('0x32')]);_0xd634dd['query']=_[_0xc803('0x48')](_0x2634d4[_0xc803('0x36')]);_0xd634dd[_0xc803('0x3f')]=_[_0xc803('0x37')](_0xd634dd[_0xc803('0x34')],_0xd634dd[_0xc803('0x36')]);_0x541341[_0xc803('0x38')]=_['intersection'](_0xd634dd[_0xc803('0x34')],qs[_0xc803('0x39')](_0x2634d4[_0xc803('0x36')][_0xc803('0x39')]));_0x541341[_0xc803('0x38')]=_0x541341[_0xc803('0x38')]['length']?_0x541341['attributes']:_0xd634dd[_0xc803('0x34')];_0x541341[_0xc803('0x3c')]=qs[_0xc803('0x3d')](_0x2634d4[_0xc803('0x36')]['sort']);_0x541341[_0xc803('0x3e')]=qs['filters'](_[_0xc803('0x40')](_0x2634d4[_0xc803('0x36')],_0xd634dd[_0xc803('0x3f')]));if(_0x2634d4[_0xc803('0x36')][_0xc803('0x41')]){_0x541341[_0xc803('0x3e')]=_[_0xc803('0x42')](_0x541341[_0xc803('0x3e')],{'$or':_[_0xc803('0x35')](_0x541341[_0xc803('0x38')],function(_0x126912){var _0x249deb={};_0x249deb[_0x126912]={'$like':'%'+_0x2634d4[_0xc803('0x36')][_0xc803('0x41')]+'%'};return _0x249deb;})});}_0x541341=_['merge']({},_0x541341,_0x2634d4['options']);return _0x254165['getFields'](_0x541341);}})[_0xc803('0x1a')](function(_0x112047){if(_0x112047){_0x23f69a=_0x112047[_0xc803('0x3a')];if(!_0x2634d4[_0xc803('0x36')][_0xc803('0x3b')](_0xc803('0x52'))){_0x541341['limit']=qs['limit'](_0x2634d4[_0xc803('0x36')]['limit']);_0x541341[_0xc803('0x29')]=qs[_0xc803('0x29')](_0x2634d4[_0xc803('0x36')][_0xc803('0x29')]);}return _0x254165[_0xc803('0x4f')](_0x541341);}})[_0xc803('0x1a')](function(_0x9fe003){if(_0x9fe003){return _0x9fe003?{'count':_0x23f69a,'rows':_0x9fe003}:null;}})[_0xc803('0x1a')](respondWithResult(_0x30b647,null))[_0xc803('0x23')](handleError(_0x30b647,null));};exports[_0xc803('0x53')]=function(_0xd767a,_0xd4522e,_0xc5774f){var _0x5b4f43={};var _0x23b826={};var _0x226a64;var _0x162d02;return db[_0xc803('0x44')][_0xc803('0x50')]({'where':{'id':_0xd767a['params']['id']}})[_0xc803('0x1a')](handleEntityNotFound(_0xd4522e,null))[_0xc803('0x1a')](function(_0x1e627f){if(_0x1e627f){_0x226a64=_0x1e627f;_0x23b826[_0xc803('0x34')]=_[_0xc803('0x48')](db[_0xc803('0x51')]['rawAttributes']);_0x23b826[_0xc803('0x36')]=_[_0xc803('0x48')](_0xd767a[_0xc803('0x36')]);_0x23b826[_0xc803('0x3f')]=_['intersection'](_0x23b826[_0xc803('0x34')],_0x23b826['query']);_0x5b4f43[_0xc803('0x38')]=_[_0xc803('0x37')](_0x23b826['model'],qs[_0xc803('0x39')](_0xd767a['query']['fields']));_0x5b4f43[_0xc803('0x38')]=_0x5b4f43[_0xc803('0x38')][_0xc803('0x3a')]?_0x5b4f43[_0xc803('0x38')]:_0x23b826[_0xc803('0x34')];_0x5b4f43[_0xc803('0x3c')]=qs[_0xc803('0x3d')](_0xd767a[_0xc803('0x36')][_0xc803('0x3d')]);_0x5b4f43[_0xc803('0x3e')]=qs[_0xc803('0x3f')](_['pick'](_0xd767a[_0xc803('0x36')],_0x23b826[_0xc803('0x3f')]));if(_0xd767a['query'][_0xc803('0x41')]){_0x5b4f43[_0xc803('0x3e')]=_['merge'](_0x5b4f43['where'],{'$or':_[_0xc803('0x35')](_0x5b4f43[_0xc803('0x38')],function(_0x4fd0ed){var _0x25e4e8={};_0x25e4e8[_0x4fd0ed]={'$like':'%'+_0xd767a[_0xc803('0x36')][_0xc803('0x41')]+'%'};return _0x25e4e8;})});}_0x5b4f43=_[_0xc803('0x42')]({},_0x5b4f43,_0xd767a[_0xc803('0x49')]);return _0x226a64['getSubjects'](_0x5b4f43);}})[_0xc803('0x1a')](function(_0x49a29a){if(_0x49a29a){_0x162d02=_0x49a29a[_0xc803('0x3a')];if(!_0xd767a['query'][_0xc803('0x3b')](_0xc803('0x52'))){_0x5b4f43[_0xc803('0x2a')]=qs[_0xc803('0x2a')](_0xd767a['query'][_0xc803('0x2a')]);_0x5b4f43[_0xc803('0x29')]=qs['offset'](_0xd767a[_0xc803('0x36')][_0xc803('0x29')]);}return _0x226a64['getSubjects'](_0x5b4f43);}})[_0xc803('0x1a')](function(_0x5701dd){if(_0x5701dd){return _0x5701dd?{'count':_0x162d02,'rows':_0x5701dd}:null;}})['then'](respondWithResult(_0xd4522e,null))[_0xc803('0x23')](handleError(_0xd4522e,null));};exports[_0xc803('0x54')]=function(_0x403f92,_0x40131c,_0x510415){var _0x309a16={};var _0x999e43={};var _0x4e46e5;var _0x5ab0b1;return db['ZendeskConfiguration'][_0xc803('0x50')]({'where':{'id':_0x403f92[_0xc803('0x4d')]['id']}})[_0xc803('0x1a')](handleEntityNotFound(_0x40131c,null))[_0xc803('0x1a')](function(_0x17f53a){if(_0x17f53a){_0x4e46e5=_0x17f53a;_0x999e43[_0xc803('0x34')]=_[_0xc803('0x48')](db[_0xc803('0x51')]['rawAttributes']);_0x999e43['query']=_[_0xc803('0x48')](_0x403f92[_0xc803('0x36')]);_0x999e43[_0xc803('0x3f')]=_['intersection'](_0x999e43[_0xc803('0x34')],_0x999e43['query']);_0x309a16[_0xc803('0x38')]=_[_0xc803('0x37')](_0x999e43[_0xc803('0x34')],qs['fields'](_0x403f92['query'][_0xc803('0x39')]));_0x309a16['attributes']=_0x309a16['attributes'][_0xc803('0x3a')]?_0x309a16[_0xc803('0x38')]:_0x999e43[_0xc803('0x34')];_0x309a16['order']=qs[_0xc803('0x3d')](_0x403f92[_0xc803('0x36')][_0xc803('0x3d')]);_0x309a16['where']=qs[_0xc803('0x3f')](_[_0xc803('0x40')](_0x403f92[_0xc803('0x36')],_0x999e43[_0xc803('0x3f')]));if(_0x403f92[_0xc803('0x36')]['filter']){_0x309a16[_0xc803('0x3e')]=_[_0xc803('0x42')](_0x309a16[_0xc803('0x3e')],{'$or':_[_0xc803('0x35')](_0x309a16[_0xc803('0x38')],function(_0x1bd3fa){var _0x3a2efb={};_0x3a2efb[_0x1bd3fa]={'$like':'%'+_0x403f92[_0xc803('0x36')][_0xc803('0x41')]+'%'};return _0x3a2efb;})});}_0x309a16=_[_0xc803('0x42')]({},_0x309a16,_0x403f92[_0xc803('0x49')]);return _0x4e46e5[_0xc803('0x54')](_0x309a16);}})['then'](function(_0x364290){if(_0x364290){_0x5ab0b1=_0x364290[_0xc803('0x3a')];if(!_0x403f92[_0xc803('0x36')][_0xc803('0x3b')](_0xc803('0x52'))){_0x309a16['limit']=qs[_0xc803('0x2a')](_0x403f92[_0xc803('0x36')][_0xc803('0x2a')]);_0x309a16[_0xc803('0x29')]=qs[_0xc803('0x29')](_0x403f92['query'][_0xc803('0x29')]);}return _0x4e46e5[_0xc803('0x54')](_0x309a16);}})[_0xc803('0x1a')](function(_0x31280f){if(_0x31280f){return _0x31280f?{'count':_0x5ab0b1,'rows':_0x31280f}:null;}})[_0xc803('0x1a')](respondWithResult(_0x40131c,null))[_0xc803('0x23')](handleError(_0x40131c,null));};exports[_0xc803('0x55')]=function(_0x142006,_0x4d27e7,_0x1cb04b){var _0x34f3b3={};var _0x220d9e={};var _0x40d75c;var _0x2b4bf7;return db[_0xc803('0x44')][_0xc803('0x50')]({'where':{'id':_0x142006[_0xc803('0x4d')]['id']}})[_0xc803('0x1a')](handleEntityNotFound(_0x4d27e7,null))['then'](function(_0xddf6bd){if(_0xddf6bd){_0x40d75c=_0xddf6bd;_0x220d9e[_0xc803('0x34')]=_[_0xc803('0x48')](db['Tag'][_0xc803('0x32')]);_0x220d9e[_0xc803('0x36')]=_['keys'](_0x142006[_0xc803('0x36')]);_0x220d9e[_0xc803('0x3f')]=_[_0xc803('0x37')](_0x220d9e['model'],_0x220d9e['query']);_0x34f3b3[_0xc803('0x38')]=_['intersection'](_0x220d9e[_0xc803('0x34')],qs[_0xc803('0x39')](_0x142006[_0xc803('0x36')][_0xc803('0x39')]));_0x34f3b3[_0xc803('0x38')]=_0x34f3b3[_0xc803('0x38')]['length']?_0x34f3b3[_0xc803('0x38')]:_0x220d9e[_0xc803('0x34')];_0x34f3b3[_0xc803('0x3c')]=qs[_0xc803('0x3d')](_0x142006[_0xc803('0x36')][_0xc803('0x3d')]);_0x34f3b3[_0xc803('0x3e')]=qs['filters'](_[_0xc803('0x40')](_0x142006[_0xc803('0x36')],_0x220d9e[_0xc803('0x3f')]));if(_0x142006[_0xc803('0x36')][_0xc803('0x41')]){_0x34f3b3[_0xc803('0x3e')]=_[_0xc803('0x42')](_0x34f3b3[_0xc803('0x3e')],{'$or':_[_0xc803('0x35')](_0x34f3b3[_0xc803('0x38')],function(_0x335e93){var _0x376c6f={};_0x376c6f[_0x335e93]={'$like':'%'+_0x142006['query'][_0xc803('0x41')]+'%'};return _0x376c6f;})});}_0x34f3b3=_[_0xc803('0x42')]({},_0x34f3b3,_0x142006[_0xc803('0x49')]);return _0x40d75c[_0xc803('0x55')](_0x34f3b3);}})[_0xc803('0x1a')](function(_0x40dea6){if(_0x40dea6){_0x2b4bf7=_0x40dea6['length'];if(!_0x142006[_0xc803('0x36')]['hasOwnProperty'](_0xc803('0x52'))){_0x34f3b3[_0xc803('0x2a')]=qs['limit'](_0x142006[_0xc803('0x36')][_0xc803('0x2a')]);_0x34f3b3[_0xc803('0x29')]=qs[_0xc803('0x29')](_0x142006[_0xc803('0x36')][_0xc803('0x29')]);}return _0x40d75c[_0xc803('0x55')](_0x34f3b3);}})[_0xc803('0x1a')](function(_0x4cf7c6){if(_0x4cf7c6){return _0x4cf7c6?{'count':_0x2b4bf7,'rows':_0x4cf7c6}:null;}})[_0xc803('0x1a')](respondWithResult(_0x4d27e7,null))[_0xc803('0x23')](handleError(_0x4d27e7,null));};exports[_0xc803('0x56')]=function(_0x22983b,_0x5c4cd8,_0x522264){if(_0x22983b[_0xc803('0x4e')]['id']){delete _0x22983b[_0xc803('0x4e')]['id'];}return db[_0xc803('0x44')][_0xc803('0x50')]({'where':{'id':_0x22983b[_0xc803('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c4cd8,null))[_0xc803('0x1a')](function(_0x58be1b){if(_0x58be1b){return _0x58be1b[_0xc803('0x56')](_0x22983b['body'][_0xc803('0x57')]||[]);}return null;})['then'](respondWithResult(_0x5c4cd8,null))[_0xc803('0x23')](handleError(_0x5c4cd8,null));}; \ No newline at end of file +var _0x3931=['name','send','index','ZendeskConfiguration','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','findAll','show','params','length','includeAll','include','options','find','create','body','destroy','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','Content-Range','apply','update','sendStatus','stack'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x3931,0x88));var _0x1393=function(_0x1b4b82,_0x9b65e4){_0x1b4b82=_0x1b4b82-0x0;var _0x219c1b=_0x3931[_0x1b4b82];return _0x219c1b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1393('0x0'));var rimraf=require(_0x1393('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1393('0x2'));var rp=require(_0x1393('0x3'));var moment=require('moment');var BPromise=require(_0x1393('0x4'));var Mustache=require(_0x1393('0x5'));var util=require(_0x1393('0x6'));var path=require(_0x1393('0x7'));var sox=require(_0x1393('0x8'));var csv=require(_0x1393('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1393('0xa'));var squel=require('squel');var crypto=require(_0x1393('0xb'));var jsforce=require(_0x1393('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1393('0xd'));var Papa=require(_0x1393('0xe'));var Redis=require(_0x1393('0xf'));var authService=require(_0x1393('0x10'));var qs=require(_0x1393('0x11'));var as=require(_0x1393('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1393('0x13'))('api');var utils=require(_0x1393('0x14'));var config=require(_0x1393('0x15'));var licenseUtil=require(_0x1393('0x16'));var db=require(_0x1393('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1393('0x18')][_0x1393('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x257b3b,_0x113c31,_0x553cd4,_0x1f718d){return new BPromise(function(_0xe0551e,_0x5387dd){var _0x28c7d5=_0x1f718d||client;return _0x28c7d5[_0x1393('0x1a')](_0x257b3b,_0x553cd4)[_0x1393('0x1b')](function(_0x3e34e8){logger['info'](_0x1393('0x1c'),_0x113c31,_0x1393('0x1d'));logger[_0x1393('0x1e')](_0x1393('0x1f'),_0x113c31,_0x1393('0x1d'),JSON[_0x1393('0x20')](_0x3e34e8));if(_0x3e34e8[_0x1393('0x21')]){if(_0x3e34e8[_0x1393('0x21')][_0x1393('0x22')]===0x1f4){logger['error'](_0x1393('0x1c'),_0x113c31,_0x3e34e8['error'][_0x1393('0x23')]);return _0x5387dd(_0x3e34e8[_0x1393('0x21')][_0x1393('0x23')]);}logger['error'](_0x1393('0x1c'),_0x113c31,_0x3e34e8[_0x1393('0x21')][_0x1393('0x23')]);return _0xe0551e(_0x3e34e8[_0x1393('0x21')][_0x1393('0x23')]);}else{logger['info'](_0x1393('0x1c'),_0x113c31,_0x1393('0x1d'));_0xe0551e(_0x3e34e8[_0x1393('0x24')][_0x1393('0x23')]);}})[_0x1393('0x25')](function(_0x5be826){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x113c31,_0x5be826);_0x5387dd(_0x5be826);});});}function respondWithStatusCode(_0x438a64,_0x3d3c37){_0x3d3c37=_0x3d3c37||0xcc;return function(_0x20b293){if(_0x20b293){return _0x438a64['sendStatus'](_0x3d3c37);}return _0x438a64['status'](_0x3d3c37)['end']();};}function respondWithResult(_0x5e629e,_0x182adc){_0x182adc=_0x182adc||0xc8;return function(_0x4e1953){if(_0x4e1953){return _0x5e629e[_0x1393('0x26')](_0x182adc)[_0x1393('0x27')](_0x4e1953);}};}function respondWithFilteredResult(_0x566a6b,_0x5abc95){return function(_0x388416){if(_0x388416){var _0x4d5630=_0x388416[_0x1393('0x28')],_0x1c80f5=_0x5abc95[_0x1393('0x29')],_0x4fc91c=_0x5abc95[_0x1393('0x29')]+_0x5abc95[_0x1393('0x2a')],_0x2b75fc;if(_0x4fc91c>=_0x4d5630){_0x4fc91c=_0x4d5630;_0x2b75fc=0xc8;}else{_0x2b75fc=0xce;}_0x566a6b[_0x1393('0x26')](_0x2b75fc);return _0x566a6b['set'](_0x1393('0x2b'),_0x1c80f5+'-'+_0x4fc91c+'/'+_0x4d5630)[_0x1393('0x27')](_0x388416);}return null;};}function patchUpdates(_0x4caa0b){return function(_0x279805){try{jsonpatch[_0x1393('0x2c')](_0x279805,_0x4caa0b,!![]);}catch(_0x3b45fb){return BPromise['reject'](_0x3b45fb);}return _0x279805['save']();};}function saveUpdates(_0x2c96d5,_0x107b4a){return function(_0x5f36a9){if(_0x5f36a9){return _0x5f36a9[_0x1393('0x2d')](_0x2c96d5)[_0x1393('0x1b')](function(_0x39da4f){return _0x39da4f;});}return null;};}function removeEntity(_0x18339e,_0x17c524){return function(_0x118668){if(_0x118668){return _0x118668['destroy']()[_0x1393('0x1b')](function(){_0x18339e[_0x1393('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4acb94,_0x1ac88b){return function(_0x2a0c2c){if(!_0x2a0c2c){_0x4acb94[_0x1393('0x2e')](0x194);}return _0x2a0c2c;};}function handleError(_0x448cf2,_0x27544e){_0x27544e=_0x27544e||0x1f4;return function(_0x3318a6){logger[_0x1393('0x21')](_0x3318a6[_0x1393('0x2f')]);if(_0x3318a6[_0x1393('0x30')]){delete _0x3318a6[_0x1393('0x30')];}_0x448cf2[_0x1393('0x26')](_0x27544e)[_0x1393('0x31')](_0x3318a6);};}exports[_0x1393('0x32')]=function(_0x4d36e9,_0xa9ec1f){var _0x2c5391={},_0x276637={},_0x320f74={'count':0x0,'rows':[]};var _0x6356fd=_['map'](db[_0x1393('0x33')][_0x1393('0x34')],function(_0x18ff76){return{'name':_0x18ff76['fieldName'],'type':_0x18ff76[_0x1393('0x35')][_0x1393('0x36')]};});_0x276637[_0x1393('0x37')]=_[_0x1393('0x38')](_0x6356fd,_0x1393('0x30'));_0x276637[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x4d36e9[_0x1393('0x39')]);_0x276637['filters']=_[_0x1393('0x3b')](_0x276637[_0x1393('0x37')],_0x276637['query']);_0x2c5391[_0x1393('0x3c')]=_[_0x1393('0x3b')](_0x276637[_0x1393('0x37')],qs[_0x1393('0x3d')](_0x4d36e9[_0x1393('0x39')][_0x1393('0x3d')]));_0x2c5391[_0x1393('0x3c')]=_0x2c5391[_0x1393('0x3c')]['length']?_0x2c5391[_0x1393('0x3c')]:_0x276637[_0x1393('0x37')];if(!_0x4d36e9[_0x1393('0x39')]['hasOwnProperty'](_0x1393('0x3e'))){_0x2c5391[_0x1393('0x2a')]=qs[_0x1393('0x2a')](_0x4d36e9[_0x1393('0x39')][_0x1393('0x2a')]);_0x2c5391[_0x1393('0x29')]=qs['offset'](_0x4d36e9['query'][_0x1393('0x29')]);}_0x2c5391[_0x1393('0x3f')]=qs['sort'](_0x4d36e9['query'][_0x1393('0x40')]);_0x2c5391[_0x1393('0x41')]=qs[_0x1393('0x42')](_[_0x1393('0x43')](_0x4d36e9[_0x1393('0x39')],_0x276637[_0x1393('0x42')]),_0x6356fd);if(_0x4d36e9[_0x1393('0x39')]['filter']){_0x2c5391[_0x1393('0x41')]=_[_0x1393('0x44')](_0x2c5391[_0x1393('0x41')],{'$or':_[_0x1393('0x38')](_0x6356fd,function(_0x1104ef){if(_0x1104ef[_0x1393('0x35')]!==_0x1393('0x45')){var _0x59c75f={};_0x59c75f[_0x1104ef[_0x1393('0x30')]]={'$like':'%'+_0x4d36e9[_0x1393('0x39')][_0x1393('0x46')]+'%'};return _0x59c75f;}})});}_0x2c5391=_[_0x1393('0x44')]({},_0x2c5391,_0x4d36e9['options']);var _0x10d1fa={'where':_0x2c5391[_0x1393('0x41')]};return db[_0x1393('0x33')][_0x1393('0x28')](_0x10d1fa)[_0x1393('0x1b')](function(_0x4952f5){_0x320f74[_0x1393('0x28')]=_0x4952f5;if(_0x4d36e9[_0x1393('0x39')]['includeAll']){_0x2c5391['include']=[{'all':!![]}];}return db[_0x1393('0x33')][_0x1393('0x47')](_0x2c5391);})[_0x1393('0x1b')](function(_0x3427ea){_0x320f74['rows']=_0x3427ea;return _0x320f74;})[_0x1393('0x1b')](respondWithFilteredResult(_0xa9ec1f,_0x2c5391))[_0x1393('0x25')](handleError(_0xa9ec1f,null));};exports[_0x1393('0x48')]=function(_0x235467,_0x51689c){var _0x37d7f3={'raw':![],'where':{'id':_0x235467[_0x1393('0x49')]['id']}},_0x58b6e4={};_0x58b6e4[_0x1393('0x37')]=_[_0x1393('0x3a')](db[_0x1393('0x33')][_0x1393('0x34')]);_0x58b6e4[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x235467[_0x1393('0x39')]);_0x58b6e4[_0x1393('0x42')]=_['intersection'](_0x58b6e4['model'],_0x58b6e4[_0x1393('0x39')]);_0x37d7f3[_0x1393('0x3c')]=_[_0x1393('0x3b')](_0x58b6e4[_0x1393('0x37')],qs[_0x1393('0x3d')](_0x235467[_0x1393('0x39')]['fields']));_0x37d7f3['attributes']=_0x37d7f3[_0x1393('0x3c')][_0x1393('0x4a')]?_0x37d7f3[_0x1393('0x3c')]:_0x58b6e4[_0x1393('0x37')];if(_0x235467[_0x1393('0x39')][_0x1393('0x4b')]){_0x37d7f3[_0x1393('0x4c')]=[{'all':!![]}];}_0x37d7f3=_[_0x1393('0x44')]({},_0x37d7f3,_0x235467[_0x1393('0x4d')]);return db['ZendeskConfiguration'][_0x1393('0x4e')](_0x37d7f3)[_0x1393('0x1b')](handleEntityNotFound(_0x51689c,null))['then'](respondWithResult(_0x51689c,null))[_0x1393('0x25')](handleError(_0x51689c,null));};exports[_0x1393('0x4f')]=function(_0x8420f2,_0x113e97){return db['ZendeskConfiguration'][_0x1393('0x4f')](_0x8420f2[_0x1393('0x50')],{})[_0x1393('0x1b')](respondWithResult(_0x113e97,0xc9))[_0x1393('0x25')](handleError(_0x113e97,null));};exports[_0x1393('0x2d')]=function(_0x42d9bf,_0x5a24ff){if(_0x42d9bf[_0x1393('0x50')]['id']){delete _0x42d9bf[_0x1393('0x50')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x42d9bf[_0x1393('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a24ff,null))['then'](saveUpdates(_0x42d9bf[_0x1393('0x50')],null))[_0x1393('0x1b')](respondWithResult(_0x5a24ff,null))[_0x1393('0x25')](handleError(_0x5a24ff,null));};exports[_0x1393('0x51')]=function(_0x3d56a1,_0x120729){return db[_0x1393('0x33')][_0x1393('0x4e')]({'where':{'id':_0x3d56a1['params']['id']}})[_0x1393('0x1b')](handleEntityNotFound(_0x120729,null))[_0x1393('0x1b')](removeEntity(_0x120729,null))[_0x1393('0x25')](handleError(_0x120729,null));};exports[_0x1393('0x52')]=function(_0x3068b1,_0x45cde4,_0x4543da){var _0x103273={};var _0x33252b={};var _0x4a7fcf;var _0x18734c;return db[_0x1393('0x33')][_0x1393('0x53')]({'where':{'id':_0x3068b1[_0x1393('0x49')]['id']}})[_0x1393('0x1b')](handleEntityNotFound(_0x45cde4,null))[_0x1393('0x1b')](function(_0x2f6707){if(_0x2f6707){_0x4a7fcf=_0x2f6707;_0x33252b[_0x1393('0x37')]=_[_0x1393('0x3a')](db[_0x1393('0x54')]['rawAttributes']);_0x33252b[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x3068b1['query']);_0x33252b[_0x1393('0x42')]=_['intersection'](_0x33252b[_0x1393('0x37')],_0x33252b[_0x1393('0x39')]);_0x103273['attributes']=_['intersection'](_0x33252b[_0x1393('0x37')],qs[_0x1393('0x3d')](_0x3068b1[_0x1393('0x39')][_0x1393('0x3d')]));_0x103273['attributes']=_0x103273[_0x1393('0x3c')][_0x1393('0x4a')]?_0x103273[_0x1393('0x3c')]:_0x33252b[_0x1393('0x37')];_0x103273[_0x1393('0x3f')]=qs[_0x1393('0x40')](_0x3068b1['query']['sort']);_0x103273['where']=qs[_0x1393('0x42')](_[_0x1393('0x43')](_0x3068b1[_0x1393('0x39')],_0x33252b[_0x1393('0x42')]));if(_0x3068b1[_0x1393('0x39')][_0x1393('0x46')]){_0x103273[_0x1393('0x41')]=_[_0x1393('0x44')](_0x103273['where'],{'$or':_[_0x1393('0x38')](_0x103273[_0x1393('0x3c')],function(_0x464c22){var _0x209c2d={};_0x209c2d[_0x464c22]={'$like':'%'+_0x3068b1[_0x1393('0x39')]['filter']+'%'};return _0x209c2d;})});}_0x103273=_[_0x1393('0x44')]({},_0x103273,_0x3068b1[_0x1393('0x4d')]);return _0x4a7fcf['getFields'](_0x103273);}})[_0x1393('0x1b')](function(_0x28f07d){if(_0x28f07d){_0x18734c=_0x28f07d['length'];if(!_0x3068b1[_0x1393('0x39')][_0x1393('0x55')]('nolimit')){_0x103273['limit']=qs[_0x1393('0x2a')](_0x3068b1[_0x1393('0x39')][_0x1393('0x2a')]);_0x103273['offset']=qs[_0x1393('0x29')](_0x3068b1['query'][_0x1393('0x29')]);}return _0x4a7fcf['getFields'](_0x103273);}})[_0x1393('0x1b')](function(_0x506c43){if(_0x506c43){return _0x506c43?{'count':_0x18734c,'rows':_0x506c43}:null;}})[_0x1393('0x1b')](respondWithResult(_0x45cde4,null))['catch'](handleError(_0x45cde4,null));};exports[_0x1393('0x56')]=function(_0x5510ac,_0x4d6438,_0x2ebed4){var _0x10c436={};var _0x480e71={};var _0x3ff5ac;var _0x366ef4;return db['ZendeskConfiguration'][_0x1393('0x53')]({'where':{'id':_0x5510ac[_0x1393('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d6438,null))[_0x1393('0x1b')](function(_0x4d809f){if(_0x4d809f){_0x3ff5ac=_0x4d809f;_0x480e71['model']=_[_0x1393('0x3a')](db[_0x1393('0x54')]['rawAttributes']);_0x480e71[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x5510ac[_0x1393('0x39')]);_0x480e71[_0x1393('0x42')]=_['intersection'](_0x480e71['model'],_0x480e71[_0x1393('0x39')]);_0x10c436['attributes']=_[_0x1393('0x3b')](_0x480e71['model'],qs['fields'](_0x5510ac['query']['fields']));_0x10c436[_0x1393('0x3c')]=_0x10c436[_0x1393('0x3c')][_0x1393('0x4a')]?_0x10c436[_0x1393('0x3c')]:_0x480e71[_0x1393('0x37')];_0x10c436[_0x1393('0x3f')]=qs[_0x1393('0x40')](_0x5510ac[_0x1393('0x39')][_0x1393('0x40')]);_0x10c436[_0x1393('0x41')]=qs[_0x1393('0x42')](_[_0x1393('0x43')](_0x5510ac[_0x1393('0x39')],_0x480e71[_0x1393('0x42')]));if(_0x5510ac[_0x1393('0x39')]['filter']){_0x10c436[_0x1393('0x41')]=_[_0x1393('0x44')](_0x10c436[_0x1393('0x41')],{'$or':_['map'](_0x10c436[_0x1393('0x3c')],function(_0x29ef8d){var _0x409b97={};_0x409b97[_0x29ef8d]={'$like':'%'+_0x5510ac[_0x1393('0x39')][_0x1393('0x46')]+'%'};return _0x409b97;})});}_0x10c436=_[_0x1393('0x44')]({},_0x10c436,_0x5510ac[_0x1393('0x4d')]);return _0x3ff5ac['getSubjects'](_0x10c436);}})[_0x1393('0x1b')](function(_0x372369){if(_0x372369){_0x366ef4=_0x372369['length'];if(!_0x5510ac['query']['hasOwnProperty'](_0x1393('0x3e'))){_0x10c436[_0x1393('0x2a')]=qs['limit'](_0x5510ac[_0x1393('0x39')]['limit']);_0x10c436[_0x1393('0x29')]=qs[_0x1393('0x29')](_0x5510ac[_0x1393('0x39')][_0x1393('0x29')]);}return _0x3ff5ac[_0x1393('0x56')](_0x10c436);}})[_0x1393('0x1b')](function(_0x449c51){if(_0x449c51){return _0x449c51?{'count':_0x366ef4,'rows':_0x449c51}:null;}})[_0x1393('0x1b')](respondWithResult(_0x4d6438,null))[_0x1393('0x25')](handleError(_0x4d6438,null));};exports['getDescriptions']=function(_0x415b32,_0x4d7cca,_0x302c8b){var _0xe01a60={};var _0x27adea={};var _0x1212b5;var _0x2a06e1;return db['ZendeskConfiguration'][_0x1393('0x53')]({'where':{'id':_0x415b32[_0x1393('0x49')]['id']}})[_0x1393('0x1b')](handleEntityNotFound(_0x4d7cca,null))[_0x1393('0x1b')](function(_0x51d5f4){if(_0x51d5f4){_0x1212b5=_0x51d5f4;_0x27adea[_0x1393('0x37')]=_[_0x1393('0x3a')](db[_0x1393('0x54')][_0x1393('0x34')]);_0x27adea[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x415b32[_0x1393('0x39')]);_0x27adea[_0x1393('0x42')]=_[_0x1393('0x3b')](_0x27adea[_0x1393('0x37')],_0x27adea[_0x1393('0x39')]);_0xe01a60[_0x1393('0x3c')]=_['intersection'](_0x27adea[_0x1393('0x37')],qs[_0x1393('0x3d')](_0x415b32['query']['fields']));_0xe01a60[_0x1393('0x3c')]=_0xe01a60['attributes'][_0x1393('0x4a')]?_0xe01a60[_0x1393('0x3c')]:_0x27adea['model'];_0xe01a60[_0x1393('0x3f')]=qs[_0x1393('0x40')](_0x415b32['query'][_0x1393('0x40')]);_0xe01a60[_0x1393('0x41')]=qs[_0x1393('0x42')](_[_0x1393('0x43')](_0x415b32[_0x1393('0x39')],_0x27adea['filters']));if(_0x415b32[_0x1393('0x39')][_0x1393('0x46')]){_0xe01a60[_0x1393('0x41')]=_['merge'](_0xe01a60[_0x1393('0x41')],{'$or':_[_0x1393('0x38')](_0xe01a60['attributes'],function(_0x4d3280){var _0x436542={};_0x436542[_0x4d3280]={'$like':'%'+_0x415b32[_0x1393('0x39')][_0x1393('0x46')]+'%'};return _0x436542;})});}_0xe01a60=_[_0x1393('0x44')]({},_0xe01a60,_0x415b32[_0x1393('0x4d')]);return _0x1212b5[_0x1393('0x57')](_0xe01a60);}})['then'](function(_0x1adbb9){if(_0x1adbb9){_0x2a06e1=_0x1adbb9[_0x1393('0x4a')];if(!_0x415b32[_0x1393('0x39')]['hasOwnProperty']('nolimit')){_0xe01a60['limit']=qs[_0x1393('0x2a')](_0x415b32['query'][_0x1393('0x2a')]);_0xe01a60[_0x1393('0x29')]=qs[_0x1393('0x29')](_0x415b32[_0x1393('0x39')][_0x1393('0x29')]);}return _0x1212b5[_0x1393('0x57')](_0xe01a60);}})[_0x1393('0x1b')](function(_0x56e6bd){if(_0x56e6bd){return _0x56e6bd?{'count':_0x2a06e1,'rows':_0x56e6bd}:null;}})['then'](respondWithResult(_0x4d7cca,null))[_0x1393('0x25')](handleError(_0x4d7cca,null));};exports[_0x1393('0x58')]=function(_0x295be1,_0x22e0a0,_0x39a2a2){var _0x56023d={};var _0x24d370={};var _0x1f7fa3;var _0x598a02;return db[_0x1393('0x33')][_0x1393('0x53')]({'where':{'id':_0x295be1[_0x1393('0x49')]['id']}})['then'](handleEntityNotFound(_0x22e0a0,null))[_0x1393('0x1b')](function(_0x2482b0){if(_0x2482b0){_0x1f7fa3=_0x2482b0;_0x24d370[_0x1393('0x37')]=_['keys'](db[_0x1393('0x59')][_0x1393('0x34')]);_0x24d370['query']=_[_0x1393('0x3a')](_0x295be1[_0x1393('0x39')]);_0x24d370[_0x1393('0x42')]=_[_0x1393('0x3b')](_0x24d370[_0x1393('0x37')],_0x24d370[_0x1393('0x39')]);_0x56023d['attributes']=_['intersection'](_0x24d370['model'],qs[_0x1393('0x3d')](_0x295be1[_0x1393('0x39')][_0x1393('0x3d')]));_0x56023d['attributes']=_0x56023d['attributes'][_0x1393('0x4a')]?_0x56023d[_0x1393('0x3c')]:_0x24d370[_0x1393('0x37')];_0x56023d[_0x1393('0x3f')]=qs['sort'](_0x295be1[_0x1393('0x39')][_0x1393('0x40')]);_0x56023d[_0x1393('0x41')]=qs['filters'](_[_0x1393('0x43')](_0x295be1[_0x1393('0x39')],_0x24d370['filters']));if(_0x295be1[_0x1393('0x39')][_0x1393('0x46')]){_0x56023d['where']=_['merge'](_0x56023d[_0x1393('0x41')],{'$or':_['map'](_0x56023d[_0x1393('0x3c')],function(_0xed6f09){var _0x4825fd={};_0x4825fd[_0xed6f09]={'$like':'%'+_0x295be1[_0x1393('0x39')]['filter']+'%'};return _0x4825fd;})});}_0x56023d=_['merge']({},_0x56023d,_0x295be1[_0x1393('0x4d')]);return _0x1f7fa3[_0x1393('0x58')](_0x56023d);}})['then'](function(_0x4b35ed){if(_0x4b35ed){_0x598a02=_0x4b35ed[_0x1393('0x4a')];if(!_0x295be1[_0x1393('0x39')][_0x1393('0x55')](_0x1393('0x3e'))){_0x56023d['limit']=qs[_0x1393('0x2a')](_0x295be1[_0x1393('0x39')]['limit']);_0x56023d[_0x1393('0x29')]=qs[_0x1393('0x29')](_0x295be1[_0x1393('0x39')]['offset']);}return _0x1f7fa3['getTags'](_0x56023d);}})[_0x1393('0x1b')](function(_0x5e2638){if(_0x5e2638){return _0x5e2638?{'count':_0x598a02,'rows':_0x5e2638}:null;}})[_0x1393('0x1b')](respondWithResult(_0x22e0a0,null))['catch'](handleError(_0x22e0a0,null));};exports[_0x1393('0x5a')]=function(_0x545220,_0x519c19,_0x33e58a){if(_0x545220['body']['id']){delete _0x545220['body']['id'];}return db[_0x1393('0x33')][_0x1393('0x53')]({'where':{'id':_0x545220[_0x1393('0x49')]['id']}})[_0x1393('0x1b')](handleEntityNotFound(_0x519c19,null))[_0x1393('0x1b')](function(_0x495e62){if(_0x495e62){return _0x495e62[_0x1393('0x5a')](_0x545220[_0x1393('0x50')][_0x1393('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x519c19,null))['catch'](handleError(_0x519c19,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ce525e1..7f7756d 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ab8=['api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger'];(function(_0x4123a7,_0x243d28){var _0x27f129=function(_0x25dd39){while(--_0x25dd39){_0x4123a7['push'](_0x4123a7['shift']());}};_0x27f129(++_0x243d28);}(_0x7ab8,0xda));var _0x87ab=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7ab8[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x87ab('0x0'));var util=require(_0x87ab('0x1'));var logger=require(_0x87ab('0x2'))(_0x87ab('0x3'));var moment=require(_0x87ab('0x4'));var BPromise=require(_0x87ab('0x5'));var rp=require(_0x87ab('0x6'));var fs=require('fs');var path=require(_0x87ab('0x7'));var rimraf=require(_0x87ab('0x8'));var config=require('../../config/environment');var attributes=require(_0x87ab('0x9'));module[_0x87ab('0xa')]=function(_0x1a5d91,_0x3a784e){return _0x1a5d91[_0x87ab('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0x87ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6344=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x44ae78,_0x30a80e){var _0x52906b=function(_0x26d2ab){while(--_0x26d2ab){_0x44ae78['push'](_0x44ae78['shift']());}};_0x52906b(++_0x30a80e);}(_0x6344,0x1b0));var _0x4634=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6344[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x4634('0x0'));var util=require('util');var logger=require(_0x4634('0x1'))(_0x4634('0x2'));var moment=require(_0x4634('0x3'));var BPromise=require(_0x4634('0x4'));var rp=require(_0x4634('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4634('0x6'));var config=require(_0x4634('0x7'));var attributes=require(_0x4634('0x8'));module[_0x4634('0x9')]=function(_0x27757e,_0x1a1a78){return _0x27757e['define'](_0x4634('0xa'),attributes,{'tableName':_0x4634('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 5596a6b..ed51306 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f1c=['stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x8f1c,0x1bd));var _0xc8f1=function(_0x306eac,_0x509b7f){_0x306eac=_0x306eac-0x0;var _0x45e58d=_0x8f1c[_0x306eac];return _0x45e58d;};'use strict';var _=require(_0xc8f1('0x0'));var util=require('util');var moment=require(_0xc8f1('0x1'));var BPromise=require(_0xc8f1('0x2'));var rs=require(_0xc8f1('0x3'));var fs=require('fs');var Redis=require(_0xc8f1('0x4'));var db=require(_0xc8f1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8f1('0x6'))(_0xc8f1('0x7'));var config=require(_0xc8f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc8f1('0x9')][_0xc8f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d67d9,_0x558b32,_0x3334dc){return new BPromise(function(_0x5d0da8,_0x3560d7){return client[_0xc8f1('0xb')](_0x5d67d9,_0x3334dc)[_0xc8f1('0xc')](function(_0x59ec78){logger[_0xc8f1('0xd')](_0xc8f1('0xe'),_0x558b32,_0xc8f1('0xf'));logger['debug'](_0xc8f1('0x10'),_0x558b32,_0xc8f1('0xf'),JSON[_0xc8f1('0x11')](_0x59ec78));if(_0x59ec78[_0xc8f1('0x12')]){if(_0x59ec78[_0xc8f1('0x12')]['code']===0x1f4){logger[_0xc8f1('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x558b32,_0x59ec78[_0xc8f1('0x12')][_0xc8f1('0x13')]);return _0x3560d7(_0x59ec78[_0xc8f1('0x12')][_0xc8f1('0x13')]);}logger[_0xc8f1('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x558b32,_0x59ec78[_0xc8f1('0x12')]['message']);return _0x5d0da8(_0x59ec78[_0xc8f1('0x12')][_0xc8f1('0x13')]);}else{logger[_0xc8f1('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x558b32,_0xc8f1('0xf'));_0x5d0da8(_0x59ec78['result'][_0xc8f1('0x13')]);}})[_0xc8f1('0x14')](function(_0x1c6670){logger[_0xc8f1('0x12')](_0xc8f1('0xe'),_0x558b32,_0x1c6670);_0x3560d7(_0x1c6670);});});} \ No newline at end of file +var _0x03af=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x89c8e9,_0x442d36){var _0x88cbf9=function(_0x4ef57d){while(--_0x4ef57d){_0x89c8e9['push'](_0x89c8e9['shift']());}};_0x88cbf9(++_0x442d36);}(_0x03af,0xc5));var _0xf03a=function(_0x4ddc25,_0x313973){_0x4ddc25=_0x4ddc25-0x0;var _0x3eeca0=_0x03af[_0x4ddc25];return _0x3eeca0;};'use strict';var _=require(_0xf03a('0x0'));var util=require(_0xf03a('0x1'));var moment=require('moment');var BPromise=require(_0xf03a('0x2'));var rs=require(_0xf03a('0x3'));var fs=require('fs');var Redis=require(_0xf03a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf03a('0x5'));var logger=require(_0xf03a('0x6'))(_0xf03a('0x7'));var config=require(_0xf03a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf03a('0x9')][_0xf03a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x208b8e,_0x48b6b6,_0x4e053a){return new BPromise(function(_0x57f95f,_0x8dcc3e){return client[_0xf03a('0xb')](_0x208b8e,_0x4e053a)[_0xf03a('0xc')](function(_0x269697){logger[_0xf03a('0xd')](_0xf03a('0xe'),_0x48b6b6,_0xf03a('0xf'));logger[_0xf03a('0x10')](_0xf03a('0x11'),_0x48b6b6,_0xf03a('0xf'),JSON['stringify'](_0x269697));if(_0x269697[_0xf03a('0x12')]){if(_0x269697[_0xf03a('0x12')]['code']===0x1f4){logger[_0xf03a('0x12')](_0xf03a('0xe'),_0x48b6b6,_0x269697[_0xf03a('0x12')][_0xf03a('0x13')]);return _0x8dcc3e(_0x269697['error'][_0xf03a('0x13')]);}logger[_0xf03a('0x12')](_0xf03a('0xe'),_0x48b6b6,_0x269697['error'][_0xf03a('0x13')]);return _0x57f95f(_0x269697[_0xf03a('0x12')][_0xf03a('0x13')]);}else{logger[_0xf03a('0xd')](_0xf03a('0xe'),_0x48b6b6,_0xf03a('0xf'));_0x57f95f(_0x269697[_0xf03a('0x14')][_0xf03a('0x13')]);}})[_0xf03a('0x15')](function(_0x27f26d){logger[_0xf03a('0x12')](_0xf03a('0xe'),_0x48b6b6,_0x27f26d);_0x8dcc3e(_0x27f26d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index d706a43..226dfba 100644 --- a/server/api/intZendeskField/index.js +++ b/server/api/intZendeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04c7=['put','update','destroy','multer','util','path','connect-timeout','express','Router','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x508375,_0x27e1b5){var _0x13cd52=function(_0x3f4635){while(--_0x3f4635){_0x508375['push'](_0x508375['shift']());}};_0x13cd52(++_0x27e1b5);}(_0x04c7,0x8b));var _0x704c=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x04c7[_0x2459fd];return _0x364cd2;};'use strict';var multer=require(_0x704c('0x0'));var util=require(_0x704c('0x1'));var path=require(_0x704c('0x2'));var timeout=require(_0x704c('0x3'));var express=require(_0x704c('0x4'));var router=express[_0x704c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x704c('0x6'));router[_0x704c('0x7')]('/',auth[_0x704c('0x8')](),controller[_0x704c('0x9')]);router[_0x704c('0x7')](_0x704c('0xa'),auth[_0x704c('0x8')](),controller[_0x704c('0xb')]);router[_0x704c('0xc')]('/',auth[_0x704c('0x8')](),controller[_0x704c('0xd')]);router[_0x704c('0xe')]('/:id',auth[_0x704c('0x8')](),controller[_0x704c('0xf')]);router['delete'](_0x704c('0xa'),auth[_0x704c('0x8')](),controller[_0x704c('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6649=['put','/:id','exports','multer','util','path','express','Router','../../components/interaction/service','isAuthenticated','index','show','post','create'];(function(_0x592e5d,_0x2a0038){var _0xe13b74=function(_0x292d7b){while(--_0x292d7b){_0x592e5d['push'](_0x592e5d['shift']());}};_0xe13b74(++_0x2a0038);}(_0x6649,0x73));var _0x9664=function(_0x383d3d,_0x3955f9){_0x383d3d=_0x383d3d-0x0;var _0x247aa0=_0x6649[_0x383d3d];return _0x247aa0;};'use strict';var multer=require(_0x9664('0x0'));var util=require(_0x9664('0x1'));var path=require(_0x9664('0x2'));var timeout=require('connect-timeout');var express=require(_0x9664('0x3'));var router=express[_0x9664('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9664('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x9664('0x6')](),controller[_0x9664('0x7')]);router['get']('/:id',auth[_0x9664('0x6')](),controller[_0x9664('0x8')]);router[_0x9664('0x9')]('/',auth['isAuthenticated'](),controller[_0x9664('0xa')]);router[_0x9664('0xb')](_0x9664('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9664('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9664('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 66c8e7e..bbdc538 100644 --- a/server/api/intZendeskField/intZendeskField.attributes.js +++ b/server/api/intZendeskField/intZendeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2bb=['ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x29c584,_0x1e09a8){var _0x427a21=function(_0x2a5b1c){while(--_0x2a5b1c){_0x29c584['push'](_0x29c584['shift']());}};_0x427a21(++_0x1e09a8);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x280ba7,_0x11f01a){_0x280ba7=_0x280ba7-0x0;var _0x113879=_0xd2bb[_0x280ba7];return _0x113879;};'use strict';var Sequelize=require('sequelize');module[_0xbd2b('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbd2b('0x1'),_0xbd2b('0x2'),_0xbd2b('0x3'),_0xbd2b('0x4')),'defaultValue':_0xbd2b('0x1')},'content':{'type':Sequelize[_0xbd2b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbd2b('0x6')](_0xbd2b('0x1'),_0xbd2b('0x2'),_0xbd2b('0x3'))},'keyContent':{'type':Sequelize[_0xbd2b('0x5')]},'idField':{'type':Sequelize[_0xbd2b('0x5')]},'nameField':{'type':Sequelize[_0xbd2b('0x5')]},'customField':{'type':Sequelize[_0xbd2b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd2b('0x5')]}}; \ No newline at end of file +var _0x6b6d=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6b6d,0xbd));var _0xd6b6=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x6b6d[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require(_0xd6b6('0x0'));module[_0xd6b6('0x1')]={'type':{'type':Sequelize[_0xd6b6('0x2')](_0xd6b6('0x3'),'variable',_0xd6b6('0x4'),_0xd6b6('0x5')),'defaultValue':_0xd6b6('0x3')},'content':{'type':Sequelize[_0xd6b6('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd6b6('0x2')](_0xd6b6('0x3'),_0xd6b6('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xd6b6('0x6')]},'idField':{'type':Sequelize[_0xd6b6('0x6')]},'nameField':{'type':Sequelize[_0xd6b6('0x6')]},'customField':{'type':Sequelize[_0xd6b6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd6b6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d1f8832..10f218c 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['map','ZendeskField','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index'];(function(_0x4abb06,_0x5adae8){var _0x5043a6=function(_0x387cf3){while(--_0x387cf3){_0x4abb06['push'](_0x4abb06['shift']());}};_0x5043a6(++_0x5adae8);}(_0x2ef3,0xba));var _0x32ef=function(_0x37d144,_0x17701a){_0x37d144=_0x37d144-0x0;var _0x25c239=_0x2ef3[_0x37d144];return _0x25c239;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x19')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x1a')](_0x4d8009)[_0x32ef('0x1b')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=_0x55bf0b['count'],_0x13db1a=_0x57aff1['offset'],_0x3950e6=_0x57aff1[_0x32ef('0x1c')]+_0x57aff1[_0x32ef('0x1d')],_0xb5aed2;if(_0x3950e6>=_0x531e30){_0x3950e6=_0x531e30;_0xb5aed2=0xc8;}else{_0xb5aed2=0xce;}_0x54c7f5[_0x32ef('0x1a')](_0xb5aed2);return _0x54c7f5['set'](_0x32ef('0x1e'),_0x13db1a+'-'+_0x3950e6+'/'+_0x531e30)[_0x32ef('0x1b')](_0x55bf0b);}return null;};}function patchUpdates(_0x4f4c98){return function(_0x304505){try{jsonpatch[_0x32ef('0x1f')](_0x304505,_0x4f4c98,!![]);}catch(_0x26aff3){return BPromise[_0x32ef('0x20')](_0x26aff3);}return _0x304505[_0x32ef('0x21')]();};}function saveUpdates(_0x3aec05,_0x4de441){return function(_0x3c5b78){if(_0x3c5b78){return _0x3c5b78['update'](_0x3aec05)[_0x32ef('0x22')](function(_0x3a20ca){return _0x3a20ca;});}return null;};}function removeEntity(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x23')]()['then'](function(){_0x49f2d8['status'](0xcc)[_0x32ef('0x24')]();});}};}function handleEntityNotFound(_0xb30fab,_0x225feb){return function(_0x478bef){if(!_0x478bef){_0xb30fab['sendStatus'](0x194);}return _0x478bef;};}function handleError(_0x19ea6,_0x4d584b){_0x4d584b=_0x4d584b||0x1f4;return function(_0x51a412){logger[_0x32ef('0x25')](_0x51a412[_0x32ef('0x26')]);if(_0x51a412[_0x32ef('0x27')]){delete _0x51a412[_0x32ef('0x27')];}_0x19ea6[_0x32ef('0x1a')](_0x4d584b)[_0x32ef('0x28')](_0x51a412);};}exports[_0x32ef('0x29')]=function(_0x38aed5,_0x338f19){var _0x2f52d7={},_0x1335e2={},_0xba4b3f={'count':0x0,'rows':[]};var _0x5a88a5=_[_0x32ef('0x2a')](db[_0x32ef('0x2b')]['rawAttributes'],function(_0x12de1a){return{'name':_0x12de1a[_0x32ef('0x2c')],'type':_0x12de1a[_0x32ef('0x2d')][_0x32ef('0x2e')]};});_0x1335e2['model']=_[_0x32ef('0x2a')](_0x5a88a5,_0x32ef('0x27'));_0x1335e2[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x38aed5[_0x32ef('0x2f')]);_0x1335e2[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x1335e2['model'],_0x1335e2[_0x32ef('0x2f')]);_0x2f52d7['attributes']=_[_0x32ef('0x32')](_0x1335e2[_0x32ef('0x33')],qs['fields'](_0x38aed5[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x2f52d7[_0x32ef('0x35')]=_0x2f52d7[_0x32ef('0x35')][_0x32ef('0x36')]?_0x2f52d7['attributes']:_0x1335e2['model'];if(!_0x38aed5[_0x32ef('0x2f')]['hasOwnProperty'](_0x32ef('0x37'))){_0x2f52d7[_0x32ef('0x1d')]=qs[_0x32ef('0x1d')](_0x38aed5[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x2f52d7[_0x32ef('0x1c')]=qs['offset'](_0x38aed5['query']['offset']);}_0x2f52d7[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x38aed5[_0x32ef('0x2f')]['sort']);_0x2f52d7['where']=qs[_0x32ef('0x31')](_[_0x32ef('0x3a')](_0x38aed5[_0x32ef('0x2f')],_0x1335e2['filters']),_0x5a88a5);if(_0x38aed5['query'][_0x32ef('0x3b')]){_0x2f52d7[_0x32ef('0x3c')]=_[_0x32ef('0x3d')](_0x2f52d7[_0x32ef('0x3c')],{'$or':_[_0x32ef('0x2a')](_0x5a88a5,function(_0x211c79){if(_0x211c79[_0x32ef('0x2d')]!==_0x32ef('0x3e')){var _0x7f2319={};_0x7f2319[_0x211c79['name']]={'$like':'%'+_0x38aed5[_0x32ef('0x2f')][_0x32ef('0x3b')]+'%'};return _0x7f2319;}})});}_0x2f52d7=_[_0x32ef('0x3d')]({},_0x2f52d7,_0x38aed5['options']);var _0x365125={'where':_0x2f52d7[_0x32ef('0x3c')]};return db[_0x32ef('0x2b')][_0x32ef('0x3f')](_0x365125)[_0x32ef('0x22')](function(_0x33a0fb){_0xba4b3f[_0x32ef('0x3f')]=_0x33a0fb;if(_0x38aed5[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x2f52d7[_0x32ef('0x41')]=[{'all':!![]}];}return db[_0x32ef('0x2b')][_0x32ef('0x42')](_0x2f52d7);})['then'](function(_0x3cac2e){_0xba4b3f[_0x32ef('0x43')]=_0x3cac2e;return _0xba4b3f;})[_0x32ef('0x22')](respondWithFilteredResult(_0x338f19,_0x2f52d7))[_0x32ef('0x44')](handleError(_0x338f19,null));};exports[_0x32ef('0x45')]=function(_0x2ca66b,_0x3c0e44){var _0x596d5a={'raw':!![],'where':{'id':_0x2ca66b[_0x32ef('0x46')]['id']}},_0x538758={};_0x538758[_0x32ef('0x33')]=_[_0x32ef('0x30')](db[_0x32ef('0x2b')]['rawAttributes']);_0x538758[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x2ca66b['query']);_0x538758[_0x32ef('0x31')]=_['intersection'](_0x538758[_0x32ef('0x33')],_0x538758[_0x32ef('0x2f')]);_0x596d5a[_0x32ef('0x35')]=_[_0x32ef('0x32')](_0x538758[_0x32ef('0x33')],qs[_0x32ef('0x34')](_0x2ca66b[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x596d5a[_0x32ef('0x35')]=_0x596d5a[_0x32ef('0x35')]['length']?_0x596d5a[_0x32ef('0x35')]:_0x538758['model'];if(_0x2ca66b[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x596d5a[_0x32ef('0x41')]=[{'all':!![]}];}_0x596d5a=_['merge']({},_0x596d5a,_0x2ca66b[_0x32ef('0x47')]);return db[_0x32ef('0x2b')][_0x32ef('0x48')](_0x596d5a)[_0x32ef('0x22')](handleEntityNotFound(_0x3c0e44,null))[_0x32ef('0x22')](respondWithResult(_0x3c0e44,null))[_0x32ef('0x44')](handleError(_0x3c0e44,null));};exports[_0x32ef('0x49')]=function(_0x47dbe1,_0x5cb6fc){return db[_0x32ef('0x2b')][_0x32ef('0x49')](_0x47dbe1[_0x32ef('0x4a')],{})[_0x32ef('0x22')](respondWithResult(_0x5cb6fc,0xc9))[_0x32ef('0x44')](handleError(_0x5cb6fc,null));};exports[_0x32ef('0x4b')]=function(_0x44ad11,_0x115fa3){if(_0x44ad11[_0x32ef('0x4a')]['id']){delete _0x44ad11[_0x32ef('0x4a')]['id'];}return db[_0x32ef('0x2b')][_0x32ef('0x48')]({'where':{'id':_0x44ad11[_0x32ef('0x46')]['id']}})['then'](handleEntityNotFound(_0x115fa3,null))[_0x32ef('0x22')](saveUpdates(_0x44ad11[_0x32ef('0x4a')],null))[_0x32ef('0x22')](respondWithResult(_0x115fa3,null))[_0x32ef('0x44')](handleError(_0x115fa3,null));};exports[_0x32ef('0x23')]=function(_0x4353f0,_0x278696){return db[_0x32ef('0x2b')][_0x32ef('0x48')]({'where':{'id':_0x4353f0[_0x32ef('0x46')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x278696,null))[_0x32ef('0x22')](removeEntity(_0x278696,null))[_0x32ef('0x44')](handleError(_0x278696,null));}; \ No newline at end of file +var _0x524e=['rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','ZendeskField','count','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send'];(function(_0x396734,_0x455c5b){var _0x661bd9=function(_0x3db41c){while(--_0x3db41c){_0x396734['push'](_0x396734['shift']());}};_0x661bd9(++_0x455c5b);}(_0x524e,0x15e));var _0xe524=function(_0x551808,_0x212062){_0x551808=_0x551808-0x0;var _0x2d59b4=_0x524e[_0x551808];return _0x2d59b4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var licenseUtil=require(_0xe524('0x1b'));var db=require(_0xe524('0x1c'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1d')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1e')](_0x4b0f51)[_0xe524('0x1f')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x20')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=_0x569660['count'],_0x109795=_0x48165e['offset'],_0x538754=_0x48165e['offset']+_0x48165e[_0xe524('0x21')],_0x29a031;if(_0x538754>=_0x488fce){_0x538754=_0x488fce;_0x29a031=0xc8;}else{_0x29a031=0xce;}_0x1b0af6['status'](_0x29a031);return _0x1b0af6[_0xe524('0x22')](_0xe524('0x23'),_0x109795+'-'+_0x538754+'/'+_0x488fce)[_0xe524('0x20')](_0x569660);}return null;};}function patchUpdates(_0x209d0b){return function(_0x5d7b17){try{jsonpatch[_0xe524('0x24')](_0x5d7b17,_0x209d0b,!![]);}catch(_0x3ccb3f){return BPromise['reject'](_0x3ccb3f);}return _0x5d7b17[_0xe524('0x25')]();};}function saveUpdates(_0x309f85,_0x43a4f9){return function(_0x1dcc0f){if(_0x1dcc0f){return _0x1dcc0f[_0xe524('0x26')](_0x309f85)[_0xe524('0x27')](function(_0xbf059b){return _0xbf059b;});}return null;};}function removeEntity(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x28')]()['then'](function(){_0x375219['status'](0xcc)[_0xe524('0x1f')]();});}};}function handleEntityNotFound(_0x23df5e,_0x1ad106){return function(_0x85fc51){if(!_0x85fc51){_0x23df5e['sendStatus'](0x194);}return _0x85fc51;};}function handleError(_0x158f07,_0x4a03bc){_0x4a03bc=_0x4a03bc||0x1f4;return function(_0x17e245){logger[_0xe524('0x29')](_0x17e245[_0xe524('0x2a')]);if(_0x17e245[_0xe524('0x2b')]){delete _0x17e245[_0xe524('0x2b')];}_0x158f07[_0xe524('0x1e')](_0x4a03bc)[_0xe524('0x2c')](_0x17e245);};}exports['index']=function(_0x58a896,_0x283f18){var _0x45abad={},_0x476572={},_0x109a96={'count':0x0,'rows':[]};var _0x359c8b=_['map'](db['ZendeskField'][_0xe524('0x2d')],function(_0x25e7a7){return{'name':_0x25e7a7[_0xe524('0x2e')],'type':_0x25e7a7[_0xe524('0x2f')][_0xe524('0x30')]};});_0x476572['model']=_[_0xe524('0x31')](_0x359c8b,_0xe524('0x2b'));_0x476572['query']=_['keys'](_0x58a896[_0xe524('0x32')]);_0x476572[_0xe524('0x33')]=_['intersection'](_0x476572[_0xe524('0x34')],_0x476572['query']);_0x45abad[_0xe524('0x35')]=_['intersection'](_0x476572[_0xe524('0x34')],qs[_0xe524('0x36')](_0x58a896[_0xe524('0x32')]['fields']));_0x45abad[_0xe524('0x35')]=_0x45abad['attributes'][_0xe524('0x37')]?_0x45abad[_0xe524('0x35')]:_0x476572[_0xe524('0x34')];if(!_0x58a896['query'][_0xe524('0x38')](_0xe524('0x39'))){_0x45abad['limit']=qs[_0xe524('0x21')](_0x58a896[_0xe524('0x32')][_0xe524('0x21')]);_0x45abad[_0xe524('0x3a')]=qs['offset'](_0x58a896[_0xe524('0x32')][_0xe524('0x3a')]);}_0x45abad[_0xe524('0x3b')]=qs[_0xe524('0x3c')](_0x58a896[_0xe524('0x32')][_0xe524('0x3c')]);_0x45abad[_0xe524('0x3d')]=qs[_0xe524('0x33')](_['pick'](_0x58a896[_0xe524('0x32')],_0x476572['filters']),_0x359c8b);if(_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]){_0x45abad['where']=_[_0xe524('0x3f')](_0x45abad['where'],{'$or':_[_0xe524('0x31')](_0x359c8b,function(_0x41af26){if(_0x41af26[_0xe524('0x2f')]!==_0xe524('0x40')){var _0x82a87b={};_0x82a87b[_0x41af26[_0xe524('0x2b')]]={'$like':'%'+_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]+'%'};return _0x82a87b;}})});}_0x45abad=_['merge']({},_0x45abad,_0x58a896[_0xe524('0x41')]);var _0x940c05={'where':_0x45abad[_0xe524('0x3d')]};return db[_0xe524('0x42')][_0xe524('0x43')](_0x940c05)[_0xe524('0x27')](function(_0x1d9648){_0x109a96[_0xe524('0x43')]=_0x1d9648;if(_0x58a896['query'][_0xe524('0x44')]){_0x45abad[_0xe524('0x45')]=[{'all':!![]}];}return db[_0xe524('0x42')]['findAll'](_0x45abad);})[_0xe524('0x27')](function(_0x5213ed){_0x109a96[_0xe524('0x46')]=_0x5213ed;return _0x109a96;})[_0xe524('0x27')](respondWithFilteredResult(_0x283f18,_0x45abad))[_0xe524('0x47')](handleError(_0x283f18,null));};exports[_0xe524('0x48')]=function(_0x27a9e5,_0x4746cd){var _0xbeb2a9={'raw':!![],'where':{'id':_0x27a9e5[_0xe524('0x49')]['id']}},_0x52cd0e={};_0x52cd0e[_0xe524('0x34')]=_[_0xe524('0x4a')](db[_0xe524('0x42')][_0xe524('0x2d')]);_0x52cd0e[_0xe524('0x32')]=_['keys'](_0x27a9e5[_0xe524('0x32')]);_0x52cd0e[_0xe524('0x33')]=_[_0xe524('0x4b')](_0x52cd0e['model'],_0x52cd0e[_0xe524('0x32')]);_0xbeb2a9['attributes']=_['intersection'](_0x52cd0e[_0xe524('0x34')],qs[_0xe524('0x36')](_0x27a9e5['query'][_0xe524('0x36')]));_0xbeb2a9[_0xe524('0x35')]=_0xbeb2a9[_0xe524('0x35')][_0xe524('0x37')]?_0xbeb2a9['attributes']:_0x52cd0e['model'];if(_0x27a9e5[_0xe524('0x32')][_0xe524('0x44')]){_0xbeb2a9['include']=[{'all':!![]}];}_0xbeb2a9=_[_0xe524('0x3f')]({},_0xbeb2a9,_0x27a9e5['options']);return db[_0xe524('0x42')][_0xe524('0x4c')](_0xbeb2a9)[_0xe524('0x27')](handleEntityNotFound(_0x4746cd,null))[_0xe524('0x27')](respondWithResult(_0x4746cd,null))[_0xe524('0x47')](handleError(_0x4746cd,null));};exports[_0xe524('0x4d')]=function(_0x305503,_0x22fb42){return db[_0xe524('0x42')][_0xe524('0x4d')](_0x305503[_0xe524('0x4e')],{})[_0xe524('0x27')](respondWithResult(_0x22fb42,0xc9))[_0xe524('0x47')](handleError(_0x22fb42,null));};exports[_0xe524('0x26')]=function(_0x37d44d,_0x4dff40){if(_0x37d44d[_0xe524('0x4e')]['id']){delete _0x37d44d['body']['id'];}return db['ZendeskField'][_0xe524('0x4c')]({'where':{'id':_0x37d44d['params']['id']}})[_0xe524('0x27')](handleEntityNotFound(_0x4dff40,null))[_0xe524('0x27')](saveUpdates(_0x37d44d['body'],null))[_0xe524('0x27')](respondWithResult(_0x4dff40,null))['catch'](handleError(_0x4dff40,null));};exports['destroy']=function(_0x2fa574,_0x1e5687){return db[_0xe524('0x42')]['find']({'where':{'id':_0x2fa574['params']['id']}})['then'](handleEntityNotFound(_0x1e5687,null))['then'](removeEntity(_0x1e5687,null))['catch'](handleError(_0x1e5687,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a01e7d9..cc50d0a 100644 --- a/server/api/intZendeskField/intZendeskField.model.js +++ b/server/api/intZendeskField/intZendeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb74d=['ZendeskField','zendesk_unique_index','idField','lodash','../../config/logger','moment','request-promise','path','rimraf','./intZendeskField.attributes','exports'];(function(_0x107d69,_0x32b198){var _0x4d9499=function(_0x31405b){while(--_0x31405b){_0x107d69['push'](_0x107d69['shift']());}};_0x4d9499(++_0x32b198);}(_0xb74d,0x16e));var _0xdb74=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0xb74d[_0x20d54d];return _0x516e8b;};'use strict';var _=require(_0xdb74('0x0'));var util=require('util');var logger=require(_0xdb74('0x1'))('api');var moment=require(_0xdb74('0x2'));var BPromise=require('bluebird');var rp=require(_0xdb74('0x3'));var fs=require('fs');var path=require(_0xdb74('0x4'));var rimraf=require(_0xdb74('0x5'));var config=require('../../config/environment');var attributes=require(_0xdb74('0x6'));module[_0xdb74('0x7')]=function(_0xd2d2f0,_0x4dbe91){return _0xd2d2f0['define'](_0xdb74('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xdb74('0x9'),'fields':[_0xdb74('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ebd=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x1ebd,0x64));var _0xd1eb=function(_0x17fd77,_0x23b9d5){_0x17fd77=_0x17fd77-0x0;var _0x134b8d=_0x1ebd[_0x17fd77];return _0x134b8d;};'use strict';var _=require(_0xd1eb('0x0'));var util=require(_0xd1eb('0x1'));var logger=require(_0xd1eb('0x2'))('api');var moment=require(_0xd1eb('0x3'));var BPromise=require(_0xd1eb('0x4'));var rp=require(_0xd1eb('0x5'));var fs=require('fs');var path=require(_0xd1eb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd1eb('0x7'));module[_0xd1eb('0x8')]=function(_0x536a93,_0x2f050e){return _0x536a93[_0xd1eb('0x9')](_0xd1eb('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xd1eb('0xb'),'fields':[_0xd1eb('0xc'),_0xd1eb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 15782e8..b11a1de 100644 --- a/server/api/intZendeskField/intZendeskField.rpc.js +++ b/server/api/intZendeskField/intZendeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa914=['then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http'];(function(_0x3774cc,_0x189941){var _0x5a0cc5=function(_0x4797b7){while(--_0x4797b7){_0x3774cc['push'](_0x3774cc['shift']());}};_0x5a0cc5(++_0x189941);}(_0xa914,0xf5));var _0x4a91=function(_0x9ea38c,_0x9d044c){_0x9ea38c=_0x9ea38c-0x0;var _0x2db088=_0xa914[_0x9ea38c];return _0x2db088;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4a91('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a91('0x1'));var db=require(_0x4a91('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4a91('0x3'));var jayson=require(_0x4a91('0x4'));var client=jayson[_0x4a91('0x5')][_0x4a91('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x33ae01,_0x1c9907,_0x3b0b91){return new BPromise(function(_0x44924c,_0x4bcb89){return client['request'](_0x33ae01,_0x3b0b91)[_0x4a91('0x7')](function(_0xffeca6){logger['info'](_0x4a91('0x8'),_0x1c9907,_0x4a91('0x9'));logger[_0x4a91('0xa')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x1c9907,_0x4a91('0x9'),JSON[_0x4a91('0xb')](_0xffeca6));if(_0xffeca6['error']){if(_0xffeca6[_0x4a91('0xc')][_0x4a91('0xd')]===0x1f4){logger[_0x4a91('0xc')](_0x4a91('0x8'),_0x1c9907,_0xffeca6[_0x4a91('0xc')][_0x4a91('0xe')]);return _0x4bcb89(_0xffeca6[_0x4a91('0xc')][_0x4a91('0xe')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x1c9907,_0xffeca6[_0x4a91('0xc')]['message']);return _0x44924c(_0xffeca6[_0x4a91('0xc')][_0x4a91('0xe')]);}else{logger[_0x4a91('0xf')](_0x4a91('0x8'),_0x1c9907,'request\x20sent');_0x44924c(_0xffeca6[_0x4a91('0x10')]['message']);}})[_0x4a91('0x11')](function(_0x3af91e){logger[_0x4a91('0xc')](_0x4a91('0x8'),_0x1c9907,_0x3af91e);_0x4bcb89(_0x3af91e);});});} \ No newline at end of file +var _0xdde7=['info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','request\x20sent','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x1c3454,_0x397e6a){var _0x10159f=function(_0x557aa3){while(--_0x557aa3){_0x1c3454['push'](_0x1c3454['shift']());}};_0x10159f(++_0x397e6a);}(_0xdde7,0xcf));var _0x7dde=function(_0x4a0c33,_0x5686bb){_0x4a0c33=_0x4a0c33-0x0;var _0x6488f9=_0xdde7[_0x4a0c33];return _0x6488f9;};'use strict';var _=require(_0x7dde('0x0'));var util=require(_0x7dde('0x1'));var moment=require(_0x7dde('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dde('0x3'));var fs=require('fs');var Redis=require(_0x7dde('0x4'));var db=require(_0x7dde('0x5'))['db'];var utils=require(_0x7dde('0x6'));var logger=require(_0x7dde('0x7'))(_0x7dde('0x8'));var config=require(_0x7dde('0x9'));var jayson=require(_0x7dde('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a3676,_0x2d8cc0,_0x2d798e){return new BPromise(function(_0xc14009,_0x2293d1){return client[_0x7dde('0xb')](_0x3a3676,_0x2d798e)[_0x7dde('0xc')](function(_0xdbce70){logger[_0x7dde('0xd')]('ZendeskField,\x20%s,\x20%s',_0x2d8cc0,'request\x20sent');logger[_0x7dde('0xe')](_0x7dde('0xf'),_0x2d8cc0,'request\x20sent',JSON[_0x7dde('0x10')](_0xdbce70));if(_0xdbce70[_0x7dde('0x11')]){if(_0xdbce70[_0x7dde('0x11')][_0x7dde('0x12')]===0x1f4){logger[_0x7dde('0x11')](_0x7dde('0x13'),_0x2d8cc0,_0xdbce70[_0x7dde('0x11')][_0x7dde('0x14')]);return _0x2293d1(_0xdbce70['error'][_0x7dde('0x14')]);}logger[_0x7dde('0x11')](_0x7dde('0x13'),_0x2d8cc0,_0xdbce70[_0x7dde('0x11')][_0x7dde('0x14')]);return _0xc14009(_0xdbce70[_0x7dde('0x11')][_0x7dde('0x14')]);}else{logger['info'](_0x7dde('0x13'),_0x2d8cc0,_0x7dde('0x15'));_0xc14009(_0xdbce70['result'][_0x7dde('0x14')]);}})['catch'](function(_0x31ac52){logger[_0x7dde('0x11')](_0x7dde('0x13'),_0x2d8cc0,_0x31ac52);_0x2293d1(_0x31ac52);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a8b956b..d073563 100644 --- a/server/api/intZohoAccount/index.js +++ b/server/api/intZohoAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0xd1c6ab,_0x5d1121){var _0x541657=function(_0x29ddfd){while(--_0x29ddfd){_0xd1c6ab['push'](_0xd1c6ab['shift']());}};_0x541657(++_0x5d1121);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x299a51,_0x5e1e3c){var _0x28afe4=function(_0x5e7194){while(--_0x5e7194){_0x299a51['push'](_0x299a51['shift']());}};_0x28afe4(++_0x5e1e3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 49bdd89..ab6f4d5 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9873=['STRING','sequelize'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9873,0x119));var _0x3987=function(_0x2454e9,_0x2ba847){_0x2454e9=_0x2454e9-0x0;var _0x1e01d1=_0x9873[_0x2454e9];return _0x1e01d1;};'use strict';var Sequelize=require(_0x3987('0x0'));module['exports']={'name':{'type':Sequelize[_0x3987('0x1')]},'description':{'type':Sequelize[_0x3987('0x1')]},'host':{'type':Sequelize[_0x3987('0x1')]},'zone':{'type':Sequelize[_0x3987('0x1')]},'clientId':{'type':Sequelize[_0x3987('0x1')]},'clientSecret':{'type':Sequelize[_0x3987('0x1')]},'serverUrl':{'type':Sequelize[_0x3987('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3987('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41e0=['sequelize','exports','STRING'];(function(_0x2eeec3,_0x53ce27){var _0x4a57bd=function(_0x14b222){while(--_0x14b222){_0x2eeec3['push'](_0x2eeec3['shift']());}};_0x4a57bd(++_0x53ce27);}(_0x41e0,0xe7));var _0x041e=function(_0x36bbbb,_0x3f6709){_0x36bbbb=_0x36bbbb-0x0;var _0x3ca0eb=_0x41e0[_0x36bbbb];return _0x3ca0eb;};'use strict';var Sequelize=require(_0x041e('0x0'));module[_0x041e('0x1')]={'name':{'type':Sequelize[_0x041e('0x2')]},'description':{'type':Sequelize[_0x041e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x041e('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x041e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x041e('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 2b9a829..c754bb8 100644 --- a/server/api/intZohoAccount/intZohoAccount.controller.js +++ b/server/api/intZohoAccount/intZohoAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa880=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','reject','save','destroy','stack','name','send','index','map','ZohoAccount','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','rawAttributes','create','body','update','find','params','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','type','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Description','WhoId','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa880,0x106));var _0x0a88=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0xa880[_0x4b6778];return _0x22dbb9;};'use strict';var pdf=require(_0x0a88('0x0'));var emlformat=require(_0x0a88('0x1'));var rimraf=require(_0x0a88('0x2'));var zipdir=require(_0x0a88('0x3'));var jsonpatch=require(_0x0a88('0x4'));var rp=require(_0x0a88('0x5'));var moment=require(_0x0a88('0x6'));var BPromise=require(_0x0a88('0x7'));var Mustache=require(_0x0a88('0x8'));var util=require(_0x0a88('0x9'));var path=require(_0x0a88('0xa'));var sox=require('sox');var csv=require(_0x0a88('0xb'));var ejs=require(_0x0a88('0xc'));var fs=require('fs');var _=require(_0x0a88('0xd'));var squel=require(_0x0a88('0xe'));var crypto=require('crypto');var jsforce=require(_0x0a88('0xf'));var deskjs=require(_0x0a88('0x10'));var toCsv=require(_0x0a88('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a88('0x11'));var qs=require(_0x0a88('0x12'));var as=require(_0x0a88('0x13'));var hardwareService=require(_0x0a88('0x14'));var logger=require(_0x0a88('0x15'))(_0x0a88('0x16'));var utils=require(_0x0a88('0x17'));var config=require(_0x0a88('0x18'));var licenseUtil=require(_0x0a88('0x19'));var db=require(_0x0a88('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0a88('0x1b'));var client=jayson[_0x0a88('0x1c')][_0x0a88('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x314148,_0x5d626c,_0x189880,_0x2f4e7f){return new BPromise(function(_0x27103d,_0x4de730){var _0x38194d=_0x2f4e7f||client;return _0x38194d[_0x0a88('0x1e')](_0x314148,_0x189880)[_0x0a88('0x1f')](function(_0x371834){logger[_0x0a88('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x5d626c,_0x0a88('0x21'));logger[_0x0a88('0x22')](_0x0a88('0x23'),_0x5d626c,'request\x20sent',JSON[_0x0a88('0x24')](_0x371834));if(_0x371834[_0x0a88('0x25')]){if(_0x371834[_0x0a88('0x25')]['code']===0x1f4){logger[_0x0a88('0x25')](_0x0a88('0x26'),_0x5d626c,_0x371834[_0x0a88('0x25')][_0x0a88('0x27')]);return _0x4de730(_0x371834[_0x0a88('0x25')]['message']);}logger[_0x0a88('0x25')](_0x0a88('0x26'),_0x5d626c,_0x371834[_0x0a88('0x25')][_0x0a88('0x27')]);return _0x27103d(_0x371834[_0x0a88('0x25')][_0x0a88('0x27')]);}else{logger[_0x0a88('0x20')](_0x0a88('0x26'),_0x5d626c,_0x0a88('0x21'));_0x27103d(_0x371834[_0x0a88('0x28')][_0x0a88('0x27')]);}})[_0x0a88('0x29')](function(_0xe59c31){logger['error'](_0x0a88('0x26'),_0x5d626c,_0xe59c31);_0x4de730(_0xe59c31);});});}function respondWithStatusCode(_0x3a296f,_0x514ef4){_0x514ef4=_0x514ef4||0xcc;return function(_0x423e28){if(_0x423e28){return _0x3a296f[_0x0a88('0x2a')](_0x514ef4);}return _0x3a296f[_0x0a88('0x2b')](_0x514ef4)[_0x0a88('0x2c')]();};}function respondWithResult(_0x2cd66d,_0x50f032){_0x50f032=_0x50f032||0xc8;return function(_0x47ec65){if(_0x47ec65){return _0x2cd66d[_0x0a88('0x2b')](_0x50f032)['json'](_0x47ec65);}};}function respondWithFilteredResult(_0x53af1a,_0x51e8ff){return function(_0x4cbb67){if(_0x4cbb67){var _0x5841de=_0x4cbb67[_0x0a88('0x2d')],_0x24ab6f=_0x51e8ff[_0x0a88('0x2e')],_0x330ed7=_0x51e8ff['offset']+_0x51e8ff[_0x0a88('0x2f')],_0x5cee64;if(_0x330ed7>=_0x5841de){_0x330ed7=_0x5841de;_0x5cee64=0xc8;}else{_0x5cee64=0xce;}_0x53af1a['status'](_0x5cee64);return _0x53af1a['set'](_0x0a88('0x30'),_0x24ab6f+'-'+_0x330ed7+'/'+_0x5841de)['json'](_0x4cbb67);}return null;};}function patchUpdates(_0x342713){return function(_0x55cb83){try{jsonpatch['apply'](_0x55cb83,_0x342713,!![]);}catch(_0x4248c5){return BPromise[_0x0a88('0x31')](_0x4248c5);}return _0x55cb83[_0x0a88('0x32')]();};}function saveUpdates(_0x6cdf8,_0x310844){return function(_0x41f517){if(_0x41f517){return _0x41f517['update'](_0x6cdf8)['then'](function(_0x122c8c){return _0x122c8c;});}return null;};}function removeEntity(_0x1254d0,_0x44e449){return function(_0x7baa58){if(_0x7baa58){return _0x7baa58[_0x0a88('0x33')]()[_0x0a88('0x1f')](function(){_0x1254d0[_0x0a88('0x2b')](0xcc)[_0x0a88('0x2c')]();});}};}function handleEntityNotFound(_0xb58519,_0x36f9a2){return function(_0x1dad4a){if(!_0x1dad4a){_0xb58519['sendStatus'](0x194);}return _0x1dad4a;};}function handleError(_0x58b48d,_0x5e41a9){_0x5e41a9=_0x5e41a9||0x1f4;return function(_0x1a24bc){logger[_0x0a88('0x25')](_0x1a24bc[_0x0a88('0x34')]);if(_0x1a24bc[_0x0a88('0x35')]){delete _0x1a24bc[_0x0a88('0x35')];}_0x58b48d[_0x0a88('0x2b')](_0x5e41a9)[_0x0a88('0x36')](_0x1a24bc);};}exports[_0x0a88('0x37')]=function(_0x36a94f,_0x165cec){var _0x57233a={},_0x1a922a={},_0xe5c29c={'count':0x0,'rows':[]};var _0x3f16c7=_[_0x0a88('0x38')](db[_0x0a88('0x39')]['rawAttributes'],function(_0x30f4af){return{'name':_0x30f4af[_0x0a88('0x3a')],'type':_0x30f4af['type'][_0x0a88('0x3b')]};});_0x1a922a['model']=_[_0x0a88('0x38')](_0x3f16c7,_0x0a88('0x35'));_0x1a922a[_0x0a88('0x3c')]=_[_0x0a88('0x3d')](_0x36a94f[_0x0a88('0x3c')]);_0x1a922a[_0x0a88('0x3e')]=_[_0x0a88('0x3f')](_0x1a922a[_0x0a88('0x40')],_0x1a922a['query']);_0x57233a[_0x0a88('0x41')]=_[_0x0a88('0x3f')](_0x1a922a[_0x0a88('0x40')],qs['fields'](_0x36a94f[_0x0a88('0x3c')][_0x0a88('0x42')]));_0x57233a[_0x0a88('0x41')]=_0x57233a[_0x0a88('0x41')][_0x0a88('0x43')]?_0x57233a[_0x0a88('0x41')]:_0x1a922a['model'];if(!_0x36a94f[_0x0a88('0x3c')]['hasOwnProperty'](_0x0a88('0x44'))){_0x57233a['limit']=qs[_0x0a88('0x2f')](_0x36a94f[_0x0a88('0x3c')][_0x0a88('0x2f')]);_0x57233a[_0x0a88('0x2e')]=qs[_0x0a88('0x2e')](_0x36a94f[_0x0a88('0x3c')][_0x0a88('0x2e')]);}_0x57233a[_0x0a88('0x45')]=qs[_0x0a88('0x46')](_0x36a94f[_0x0a88('0x3c')][_0x0a88('0x46')]);_0x57233a[_0x0a88('0x47')]=qs[_0x0a88('0x3e')](_[_0x0a88('0x48')](_0x36a94f[_0x0a88('0x3c')],_0x1a922a['filters']),_0x3f16c7);if(_0x36a94f[_0x0a88('0x3c')][_0x0a88('0x49')]){_0x57233a['where']=_[_0x0a88('0x4a')](_0x57233a[_0x0a88('0x47')],{'$or':_['map'](_0x3f16c7,function(_0x4da014){if(_0x4da014['type']!==_0x0a88('0x4b')){var _0x3c7a87={};_0x3c7a87[_0x4da014[_0x0a88('0x35')]]={'$like':'%'+_0x36a94f['query'][_0x0a88('0x49')]+'%'};return _0x3c7a87;}})});}_0x57233a=_[_0x0a88('0x4a')]({},_0x57233a,_0x36a94f[_0x0a88('0x4c')]);var _0x4dc160={'where':_0x57233a['where']};return db[_0x0a88('0x39')][_0x0a88('0x2d')](_0x4dc160)[_0x0a88('0x1f')](function(_0x2ecfbf){_0xe5c29c[_0x0a88('0x2d')]=_0x2ecfbf;if(_0x36a94f[_0x0a88('0x3c')][_0x0a88('0x4d')]){_0x57233a[_0x0a88('0x4e')]=[{'all':!![]}];}return db[_0x0a88('0x39')]['findAll'](_0x57233a);})[_0x0a88('0x1f')](function(_0x1a306d){_0xe5c29c[_0x0a88('0x4f')]=_0x1a306d;return _0xe5c29c;})[_0x0a88('0x1f')](respondWithFilteredResult(_0x165cec,_0x57233a))[_0x0a88('0x29')](handleError(_0x165cec,null));};exports['show']=function(_0x57ca02,_0x3a975f){var _0x3597b2={'raw':![],'where':{'id':_0x57ca02['params']['id']}},_0x43c062={};_0x43c062[_0x0a88('0x40')]=_[_0x0a88('0x3d')](db[_0x0a88('0x39')][_0x0a88('0x50')]);_0x43c062['query']=_[_0x0a88('0x3d')](_0x57ca02[_0x0a88('0x3c')]);_0x43c062[_0x0a88('0x3e')]=_[_0x0a88('0x3f')](_0x43c062['model'],_0x43c062[_0x0a88('0x3c')]);_0x3597b2['attributes']=_['intersection'](_0x43c062['model'],qs[_0x0a88('0x42')](_0x57ca02[_0x0a88('0x3c')][_0x0a88('0x42')]));_0x3597b2['attributes']=_0x3597b2['attributes'][_0x0a88('0x43')]?_0x3597b2[_0x0a88('0x41')]:_0x43c062[_0x0a88('0x40')];if(_0x57ca02[_0x0a88('0x3c')][_0x0a88('0x4d')]){_0x3597b2[_0x0a88('0x4e')]=[{'all':!![]}];}_0x3597b2=_[_0x0a88('0x4a')]({},_0x3597b2,_0x57ca02[_0x0a88('0x4c')]);return db[_0x0a88('0x39')]['find'](_0x3597b2)['then'](handleEntityNotFound(_0x3a975f,null))[_0x0a88('0x1f')](respondWithResult(_0x3a975f,null))[_0x0a88('0x29')](handleError(_0x3a975f,null));};exports['create']=function(_0x44a41f,_0x2f3b76){return db['ZohoAccount'][_0x0a88('0x51')](_0x44a41f[_0x0a88('0x52')],{})[_0x0a88('0x1f')](respondWithResult(_0x2f3b76,0xc9))[_0x0a88('0x29')](handleError(_0x2f3b76,null));};exports[_0x0a88('0x53')]=function(_0x2e90e5,_0x5276b6){if(_0x2e90e5[_0x0a88('0x52')]['id']){delete _0x2e90e5['body']['id'];}return db[_0x0a88('0x39')][_0x0a88('0x54')]({'where':{'id':_0x2e90e5['params']['id']}})[_0x0a88('0x1f')](handleEntityNotFound(_0x5276b6,null))['then'](saveUpdates(_0x2e90e5[_0x0a88('0x52')],null))[_0x0a88('0x1f')](respondWithResult(_0x5276b6,null))[_0x0a88('0x29')](handleError(_0x5276b6,null));};exports[_0x0a88('0x33')]=function(_0x52e97e,_0x524efc){return db[_0x0a88('0x39')][_0x0a88('0x54')]({'where':{'id':_0x52e97e[_0x0a88('0x55')]['id']}})[_0x0a88('0x1f')](handleEntityNotFound(_0x524efc,null))['then'](removeEntity(_0x524efc,null))['catch'](handleError(_0x524efc,null));};exports[_0x0a88('0x56')]=function(_0x5b3fec,_0x3c04ff,_0x364a00){var _0x1521d1={};var _0x5ed34e={};var _0x227c5d;var _0x2b72e3;return db[_0x0a88('0x39')][_0x0a88('0x57')]({'where':{'id':_0x5b3fec[_0x0a88('0x55')]['id']}})[_0x0a88('0x1f')](handleEntityNotFound(_0x3c04ff,null))[_0x0a88('0x1f')](function(_0x471448){if(_0x471448){_0x227c5d=_0x471448;_0x5ed34e[_0x0a88('0x40')]=_[_0x0a88('0x3d')](db[_0x0a88('0x58')][_0x0a88('0x50')]);_0x5ed34e['query']=_['keys'](_0x5b3fec[_0x0a88('0x3c')]);_0x5ed34e[_0x0a88('0x3e')]=_[_0x0a88('0x3f')](_0x5ed34e['model'],_0x5ed34e[_0x0a88('0x3c')]);_0x1521d1[_0x0a88('0x41')]=_[_0x0a88('0x3f')](_0x5ed34e['model'],qs[_0x0a88('0x42')](_0x5b3fec[_0x0a88('0x3c')][_0x0a88('0x42')]));_0x1521d1[_0x0a88('0x41')]=_0x1521d1[_0x0a88('0x41')][_0x0a88('0x43')]?_0x1521d1[_0x0a88('0x41')]:_0x5ed34e[_0x0a88('0x40')];_0x1521d1[_0x0a88('0x45')]=qs[_0x0a88('0x46')](_0x5b3fec[_0x0a88('0x3c')][_0x0a88('0x46')]);_0x1521d1['where']=qs[_0x0a88('0x3e')](_[_0x0a88('0x48')](_0x5b3fec['query'],_0x5ed34e[_0x0a88('0x3e')]));if(_0x5b3fec[_0x0a88('0x3c')][_0x0a88('0x49')]){_0x1521d1['where']=_['merge'](_0x1521d1[_0x0a88('0x47')],{'$or':_[_0x0a88('0x38')](_0x1521d1['attributes'],function(_0x3d49ea){var _0x13cd21={};_0x13cd21[_0x3d49ea]={'$like':'%'+_0x5b3fec['query'][_0x0a88('0x49')]+'%'};return _0x13cd21;})});}_0x1521d1=_['merge']({},_0x1521d1,_0x5b3fec[_0x0a88('0x4c')]);return _0x227c5d[_0x0a88('0x56')](_0x1521d1);}})[_0x0a88('0x1f')](function(_0x3a3c3d){if(_0x3a3c3d){_0x2b72e3=_0x3a3c3d[_0x0a88('0x43')];if(!_0x5b3fec[_0x0a88('0x3c')][_0x0a88('0x59')]('nolimit')){_0x1521d1[_0x0a88('0x2f')]=qs[_0x0a88('0x2f')](_0x5b3fec[_0x0a88('0x3c')][_0x0a88('0x2f')]);_0x1521d1[_0x0a88('0x2e')]=qs[_0x0a88('0x2e')](_0x5b3fec[_0x0a88('0x3c')][_0x0a88('0x2e')]);}return _0x227c5d[_0x0a88('0x56')](_0x1521d1);}})[_0x0a88('0x1f')](function(_0x561323){if(_0x561323){return _0x561323?{'count':_0x2b72e3,'rows':_0x561323}:null;}})[_0x0a88('0x1f')](respondWithResult(_0x3c04ff,null))[_0x0a88('0x29')](handleError(_0x3c04ff,null));};exports[_0x0a88('0x5a')]=function(_0x20f318,_0xabc6e5,_0x167775){if(_0x20f318[_0x0a88('0x52')]['id']){delete _0x20f318['body']['id'];}return db['ZohoAccount'][_0x0a88('0x57')]({'where':{'id':_0x20f318[_0x0a88('0x55')]['id']}})[_0x0a88('0x1f')](handleEntityNotFound(_0xabc6e5,null))[_0x0a88('0x1f')](function(_0x567a5a){if(_0x567a5a){_0x20f318[_0x0a88('0x52')]['AccountId']=_0x567a5a['id'];_0x20f318['body'][_0x0a88('0x5b')]=integrations[_0x0a88('0x5c')](_0x20f318['body'][_0x0a88('0x5d')],_0x20f318['body'][_0x0a88('0x5e')]);_0x20f318[_0x0a88('0x52')]['Descriptions']=integrations[_0x0a88('0x5f')](_0x20f318[_0x0a88('0x52')][_0x0a88('0x5d')],_0x20f318[_0x0a88('0x52')][_0x0a88('0x5e')]);return db['ZohoConfiguration'][_0x0a88('0x51')](_0x20f318['body'],{'include':[{'model':db[_0x0a88('0x60')],'as':'Subjects'},{'model':db[_0x0a88('0x60')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xabc6e5,null))[_0x0a88('0x29')](handleError(_0xabc6e5,null));};function getAccessToken(_0x58c5a4){return new Promise(function(_0x1c1f20,_0x2d7afb){var _0x2c6e1a;switch(_0x58c5a4[_0x0a88('0x61')]){case'US':_0x2c6e1a=_0x0a88('0x62');break;case'AU':_0x2c6e1a=_0x0a88('0x63');break;case'EU':_0x2c6e1a='https://accounts.zoho.eu';break;case'IN':_0x2c6e1a=_0x0a88('0x64');break;case'CN':_0x2c6e1a=_0x0a88('0x65');break;default:_0x2c6e1a=_0x0a88('0x66');break;}var _0x36ed79={'method':_0x0a88('0x67'),'uri':_0x2c6e1a+_0x0a88('0x68'),'qs':{'refresh_token':_0x58c5a4[_0x0a88('0x69')],'client_id':_0x58c5a4[_0x0a88('0x6a')],'client_secret':_0x58c5a4['clientSecret'],'grant_type':_0x0a88('0x6b')},'json':!![]};return rp(_0x36ed79)['then'](function(_0x4c856b){if(_0x4c856b[_0x0a88('0x6c')]){_0x1c1f20(_0x4c856b[_0x0a88('0x6c')]);}else{_0x2d7afb(_0x0a88('0x6d'));}})[_0x0a88('0x29')](function(_0x274f0a){_0x2d7afb(_0x274f0a);});});}exports[_0x0a88('0x6e')]=function(_0x5cd786,_0x78e8f5,_0x1c2f47){var _0x15daa9,_0x2b2347,_0x908148,_0x149b4f,_0x4d658b;return db['ZohoAccount'][_0x0a88('0x57')]({'where':{'id':_0x5cd786['params']['id']},'attributes':['id',_0x0a88('0x6f'),_0x0a88('0x61'),'clientId',_0x0a88('0x70'),_0x0a88('0x71'),_0x0a88('0x72'),_0x0a88('0x69')]})['then'](handleEntityNotFound(_0x78e8f5,null))[_0x0a88('0x1f')](function(_0x5478f7){_0x4d658b=_0x5478f7;_0x15daa9=_0x4d658b[_0x0a88('0x6f')];_0x2b2347=_0x15daa9===_0x0a88('0x73')?'eu':'com';_0x908148=_0x4d658b[_0x0a88('0x71')];var _0x245c78=_0x908148[_0x0a88('0x74')](-0x1);if(_0x245c78==='/'||_0x245c78==='\x5c'||_0x245c78===':'){_0x908148=_0x908148['substring'](0x0,_0x908148[_0x0a88('0x75')](_0x245c78));}if(!_0x4d658b[_0x0a88('0x69')]){throw new Error(_0x0a88('0x76'));}return getAccessToken(_0x4d658b);})[_0x0a88('0x1f')](function(_0x37463b){if(_0x37463b){return rp({'method':_0x0a88('0x77'),'uri':util[_0x0a88('0x78')](_0x0a88('0x79'),_0x2b2347),'qs':{'module':_0x0a88('0x7a')},'headers':{'Authorization':_0x0a88('0x7b')+_0x37463b},'json':!![]});}})[_0x0a88('0x1f')](function(_0x5548a2){if(_0x5548a2){if(_0x5548a2[_0x0a88('0x7c')]&&_0x5548a2[_0x0a88('0x7c')][_0x0a88('0x25')]){throw new Error(_0x5548a2['response'][_0x0a88('0x25')][_0x0a88('0x27')]);}var _0x59dab5=[];var _0x3e76d8=[];var _0x1c9dbf=['Owner','Subject',_0x0a88('0x7d'),_0x0a88('0x7e'),'Call_Duration',_0x0a88('0x7f'),'Call_Start_Time',_0x0a88('0x80')];_0x3e76d8=_[_0x0a88('0x81')](_0x5548a2[_0x0a88('0x42')],function(_0x223ec9){return _0x1c9dbf[_0x0a88('0x82')](_0x223ec9[_0x0a88('0x83')]);});for(var _0x48f512=0x0;_0x48f512<_0x3e76d8[_0x0a88('0x43')];_0x48f512++){if(_0x3e76d8[_0x48f512][_0x0a88('0x84')]===![]){_0x59dab5[_0x0a88('0x85')]({'id':_0x3e76d8[_0x48f512]['id'],'name':_0x3e76d8[_0x48f512][_0x0a88('0x86')],'custom':_0x3e76d8[_0x48f512]['custom_field'],'options':_0x3e76d8[_0x48f512][_0x0a88('0x87')]==='picklist'&&_0x3e76d8[_0x48f512][_0x0a88('0x88')]['length']>-0x1?_[_0x0a88('0x38')](_0x3e76d8[_0x48f512]['pick_list_values'],function(_0x17bacf){return{'name':_0x17bacf,'value':_0x17bacf};}):[]});}}return{'count':_0x59dab5[_0x0a88('0x43')],'rows':_0x59dab5};}else{return{'count':0x0,'rows':[]};}})[_0x0a88('0x1f')](respondWithResult(_0x78e8f5,null))['catch'](function(_0x1ed000){var _0xa2ef57=_0x5cd786[_0x0a88('0x3c')]['test']?0x1f4:_0x1ed000['statusCode']||0x1f4;logger['error'](_0x0a88('0x89'),_0x0a88('0x6e'),_0xa2ef57,JSON['stringify'](_0x1ed000));delete _0x1ed000['name'];if(_0xa2ef57===0x191){_0xa2ef57=0x190;}_0x78e8f5[_0x0a88('0x2b')](_0xa2ef57)[_0x0a88('0x36')](_0x5cd786[_0x0a88('0x3c')][_0x0a88('0x8a')]?{'message':_0x0a88('0x8b'),'statusCode':_0x1ed000[_0x0a88('0x8c')]}:_0x1ed000);});}; \ No newline at end of file +var _0xabad=['options','find','create','body','update','destroy','getConfigurations','findOne','pick','AccountId','getSubjects','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','set','json','apply','reject','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','VIRTUAL','where','ZohoAccount','include','findAll','rows','show','params','includeAll'];(function(_0x1c966f,_0x58fc8f){var _0x4661c6=function(_0x320167){while(--_0x320167){_0x1c966f['push'](_0x1c966f['shift']());}};_0x4661c6(++_0x58fc8f);}(_0xabad,0x150));var _0xdaba=function(_0x510cd9,_0x551300){_0x510cd9=_0x510cd9-0x0;var _0x2b1f61=_0xabad[_0x510cd9];return _0x2b1f61;};'use strict';var pdf=require(_0xdaba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdaba('0x1'));var zipdir=require(_0xdaba('0x2'));var jsonpatch=require(_0xdaba('0x3'));var rp=require('request-promise');var moment=require(_0xdaba('0x4'));var BPromise=require(_0xdaba('0x5'));var Mustache=require('mustache');var util=require(_0xdaba('0x6'));var path=require(_0xdaba('0x7'));var sox=require(_0xdaba('0x8'));var csv=require(_0xdaba('0x9'));var ejs=require(_0xdaba('0xa'));var fs=require('fs');var _=require(_0xdaba('0xb'));var squel=require(_0xdaba('0xc'));var crypto=require(_0xdaba('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdaba('0xe'));var toCsv=require(_0xdaba('0x9'));var querystring=require(_0xdaba('0xf'));var Papa=require(_0xdaba('0x10'));var Redis=require('ioredis');var authService=require(_0xdaba('0x11'));var qs=require(_0xdaba('0x12'));var as=require(_0xdaba('0x13'));var hardwareService=require(_0xdaba('0x14'));var logger=require(_0xdaba('0x15'))(_0xdaba('0x16'));var utils=require(_0xdaba('0x17'));var config=require(_0xdaba('0x18'));var licenseUtil=require(_0xdaba('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdaba('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0xdaba('0x1b')][_0xdaba('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x33f9a4,_0x3ba409,_0x24daca,_0x3b2d11){return new BPromise(function(_0x3b599b,_0x4e6e33){var _0x1b96e6=_0x3b2d11||client;return _0x1b96e6[_0xdaba('0x1d')](_0x33f9a4,_0x24daca)[_0xdaba('0x1e')](function(_0x57679f){logger[_0xdaba('0x1f')](_0xdaba('0x20'),_0x3ba409,_0xdaba('0x21'));logger['debug'](_0xdaba('0x22'),_0x3ba409,_0xdaba('0x21'),JSON[_0xdaba('0x23')](_0x57679f));if(_0x57679f[_0xdaba('0x24')]){if(_0x57679f[_0xdaba('0x24')]['code']===0x1f4){logger[_0xdaba('0x24')](_0xdaba('0x20'),_0x3ba409,_0x57679f[_0xdaba('0x24')]['message']);return _0x4e6e33(_0x57679f['error'][_0xdaba('0x25')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3ba409,_0x57679f[_0xdaba('0x24')][_0xdaba('0x25')]);return _0x3b599b(_0x57679f[_0xdaba('0x24')][_0xdaba('0x25')]);}else{logger['info'](_0xdaba('0x20'),_0x3ba409,_0xdaba('0x21'));_0x3b599b(_0x57679f[_0xdaba('0x26')]['message']);}})[_0xdaba('0x27')](function(_0x522258){logger[_0xdaba('0x24')](_0xdaba('0x20'),_0x3ba409,_0x522258);_0x4e6e33(_0x522258);});});}function respondWithStatusCode(_0x3f3dfb,_0x5735bf){_0x5735bf=_0x5735bf||0xcc;return function(_0x56b830){if(_0x56b830){return _0x3f3dfb[_0xdaba('0x28')](_0x5735bf);}return _0x3f3dfb[_0xdaba('0x29')](_0x5735bf)[_0xdaba('0x2a')]();};}function respondWithResult(_0x45db3b,_0x2c0eed){_0x2c0eed=_0x2c0eed||0xc8;return function(_0x1d599d){if(_0x1d599d){return _0x45db3b[_0xdaba('0x29')](_0x2c0eed)['json'](_0x1d599d);}};}function respondWithFilteredResult(_0xeadce6,_0x26bb7c){return function(_0x166a83){if(_0x166a83){var _0x3a2c48=_0x166a83[_0xdaba('0x2b')],_0x5c0f91=_0x26bb7c['offset'],_0x3ee19d=_0x26bb7c[_0xdaba('0x2c')]+_0x26bb7c['limit'],_0x752c66;if(_0x3ee19d>=_0x3a2c48){_0x3ee19d=_0x3a2c48;_0x752c66=0xc8;}else{_0x752c66=0xce;}_0xeadce6[_0xdaba('0x29')](_0x752c66);return _0xeadce6[_0xdaba('0x2d')]('Content-Range',_0x5c0f91+'-'+_0x3ee19d+'/'+_0x3a2c48)[_0xdaba('0x2e')](_0x166a83);}return null;};}function patchUpdates(_0x592521){return function(_0x3aa547){try{jsonpatch[_0xdaba('0x2f')](_0x3aa547,_0x592521,!![]);}catch(_0x1bf85e){return BPromise[_0xdaba('0x30')](_0x1bf85e);}return _0x3aa547['save']();};}function saveUpdates(_0x158dd8,_0x2602d4){return function(_0x453c09){if(_0x453c09){return _0x453c09['update'](_0x158dd8)[_0xdaba('0x1e')](function(_0x2619a8){return _0x2619a8;});}return null;};}function removeEntity(_0x466d7a,_0x12c5a3){return function(_0x331801){if(_0x331801){return _0x331801['destroy']()['then'](function(){_0x466d7a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4fe6,_0x3a9f95){return function(_0x3f1f09){if(!_0x3f1f09){_0x3c4fe6[_0xdaba('0x28')](0x194);}return _0x3f1f09;};}function handleError(_0x55256b,_0x282f5c){_0x282f5c=_0x282f5c||0x1f4;return function(_0x16e3ea){logger[_0xdaba('0x24')](_0x16e3ea[_0xdaba('0x31')]);if(_0x16e3ea['name']){delete _0x16e3ea[_0xdaba('0x32')];}_0x55256b[_0xdaba('0x29')](_0x282f5c)[_0xdaba('0x33')](_0x16e3ea);};}exports[_0xdaba('0x34')]=function(_0x196cb7,_0x5dceab){var _0x29a79c={},_0x2ed5f5={},_0x2fa4b5={'count':0x0,'rows':[]};var _0x559be8=_[_0xdaba('0x35')](db['ZohoAccount'][_0xdaba('0x36')],function(_0x470b14){return{'name':_0x470b14['fieldName'],'type':_0x470b14[_0xdaba('0x37')][_0xdaba('0x38')]};});_0x2ed5f5[_0xdaba('0x39')]=_[_0xdaba('0x35')](_0x559be8,_0xdaba('0x32'));_0x2ed5f5[_0xdaba('0x3a')]=_[_0xdaba('0x3b')](_0x196cb7[_0xdaba('0x3a')]);_0x2ed5f5[_0xdaba('0x3c')]=_[_0xdaba('0x3d')](_0x2ed5f5[_0xdaba('0x39')],_0x2ed5f5[_0xdaba('0x3a')]);_0x29a79c[_0xdaba('0x3e')]=_[_0xdaba('0x3d')](_0x2ed5f5['model'],qs[_0xdaba('0x3f')](_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x3f')]));_0x29a79c['attributes']=_0x29a79c[_0xdaba('0x3e')][_0xdaba('0x40')]?_0x29a79c['attributes']:_0x2ed5f5[_0xdaba('0x39')];if(!_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x41')](_0xdaba('0x42'))){_0x29a79c[_0xdaba('0x43')]=qs['limit'](_0x196cb7[_0xdaba('0x3a')]['limit']);_0x29a79c[_0xdaba('0x2c')]=qs['offset'](_0x196cb7[_0xdaba('0x3a')]['offset']);}_0x29a79c[_0xdaba('0x44')]=qs[_0xdaba('0x45')](_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x45')]);_0x29a79c['where']=qs['filters'](_['pick'](_0x196cb7[_0xdaba('0x3a')],_0x2ed5f5['filters']),_0x559be8);if(_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x46')]){_0x29a79c['where']=_[_0xdaba('0x47')](_0x29a79c['where'],{'$or':_[_0xdaba('0x35')](_0x559be8,function(_0x4065f5){if(_0x4065f5[_0xdaba('0x37')]!==_0xdaba('0x48')){var _0x5019a8={};_0x5019a8[_0x4065f5['name']]={'$like':'%'+_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x46')]+'%'};return _0x5019a8;}})});}_0x29a79c=_[_0xdaba('0x47')]({},_0x29a79c,_0x196cb7['options']);var _0x9c0de6={'where':_0x29a79c[_0xdaba('0x49')]};return db[_0xdaba('0x4a')][_0xdaba('0x2b')](_0x9c0de6)[_0xdaba('0x1e')](function(_0x357a96){_0x2fa4b5[_0xdaba('0x2b')]=_0x357a96;if(_0x196cb7[_0xdaba('0x3a')]['includeAll']){_0x29a79c[_0xdaba('0x4b')]=[{'all':!![]}];}return db['ZohoAccount'][_0xdaba('0x4c')](_0x29a79c);})[_0xdaba('0x1e')](function(_0x1c07f8){_0x2fa4b5[_0xdaba('0x4d')]=_0x1c07f8;return _0x2fa4b5;})[_0xdaba('0x1e')](respondWithFilteredResult(_0x5dceab,_0x29a79c))['catch'](handleError(_0x5dceab,null));};exports[_0xdaba('0x4e')]=function(_0x3e1167,_0x4e9633){var _0x1a04d8={'raw':![],'where':{'id':_0x3e1167[_0xdaba('0x4f')]['id']}},_0x2b2c3e={};_0x2b2c3e[_0xdaba('0x39')]=_['keys'](db[_0xdaba('0x4a')][_0xdaba('0x36')]);_0x2b2c3e[_0xdaba('0x3a')]=_[_0xdaba('0x3b')](_0x3e1167[_0xdaba('0x3a')]);_0x2b2c3e[_0xdaba('0x3c')]=_[_0xdaba('0x3d')](_0x2b2c3e[_0xdaba('0x39')],_0x2b2c3e[_0xdaba('0x3a')]);_0x1a04d8[_0xdaba('0x3e')]=_[_0xdaba('0x3d')](_0x2b2c3e['model'],qs[_0xdaba('0x3f')](_0x3e1167[_0xdaba('0x3a')][_0xdaba('0x3f')]));_0x1a04d8[_0xdaba('0x3e')]=_0x1a04d8[_0xdaba('0x3e')][_0xdaba('0x40')]?_0x1a04d8[_0xdaba('0x3e')]:_0x2b2c3e['model'];if(_0x3e1167[_0xdaba('0x3a')][_0xdaba('0x50')]){_0x1a04d8['include']=[{'all':!![]}];}_0x1a04d8=_[_0xdaba('0x47')]({},_0x1a04d8,_0x3e1167[_0xdaba('0x51')]);return db[_0xdaba('0x4a')][_0xdaba('0x52')](_0x1a04d8)['then'](handleEntityNotFound(_0x4e9633,null))[_0xdaba('0x1e')](respondWithResult(_0x4e9633,null))[_0xdaba('0x27')](handleError(_0x4e9633,null));};exports[_0xdaba('0x53')]=function(_0x3b0f56,_0x2ec0c0){return db[_0xdaba('0x4a')][_0xdaba('0x53')](_0x3b0f56[_0xdaba('0x54')],{})[_0xdaba('0x1e')](respondWithResult(_0x2ec0c0,0xc9))['catch'](handleError(_0x2ec0c0,null));};exports[_0xdaba('0x55')]=function(_0x4ac675,_0x48d9e7){if(_0x4ac675['body']['id']){delete _0x4ac675[_0xdaba('0x54')]['id'];}return db[_0xdaba('0x4a')][_0xdaba('0x52')]({'where':{'id':_0x4ac675[_0xdaba('0x4f')]['id']}})['then'](handleEntityNotFound(_0x48d9e7,null))[_0xdaba('0x1e')](saveUpdates(_0x4ac675[_0xdaba('0x54')],null))[_0xdaba('0x1e')](respondWithResult(_0x48d9e7,null))[_0xdaba('0x27')](handleError(_0x48d9e7,null));};exports[_0xdaba('0x56')]=function(_0x55e7e9,_0x4a07ef){return db[_0xdaba('0x4a')][_0xdaba('0x52')]({'where':{'id':_0x55e7e9['params']['id']}})[_0xdaba('0x1e')](handleEntityNotFound(_0x4a07ef,null))[_0xdaba('0x1e')](removeEntity(_0x4a07ef,null))[_0xdaba('0x27')](handleError(_0x4a07ef,null));};exports[_0xdaba('0x57')]=function(_0x32c6d0,_0x155553,_0x9d189){var _0x295aef={};var _0x21cf03={};var _0x19c06a;var _0x13ce1f;return db[_0xdaba('0x4a')][_0xdaba('0x58')]({'where':{'id':_0x32c6d0['params']['id']}})['then'](handleEntityNotFound(_0x155553,null))[_0xdaba('0x1e')](function(_0x49b41c){if(_0x49b41c){_0x19c06a=_0x49b41c;_0x21cf03['model']=_[_0xdaba('0x3b')](db['ZohoConfiguration']['rawAttributes']);_0x21cf03['query']=_[_0xdaba('0x3b')](_0x32c6d0[_0xdaba('0x3a')]);_0x21cf03[_0xdaba('0x3c')]=_[_0xdaba('0x3d')](_0x21cf03[_0xdaba('0x39')],_0x21cf03['query']);_0x295aef[_0xdaba('0x3e')]=_[_0xdaba('0x3d')](_0x21cf03[_0xdaba('0x39')],qs[_0xdaba('0x3f')](_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x3f')]));_0x295aef[_0xdaba('0x3e')]=_0x295aef['attributes']['length']?_0x295aef[_0xdaba('0x3e')]:_0x21cf03[_0xdaba('0x39')];_0x295aef[_0xdaba('0x44')]=qs[_0xdaba('0x45')](_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x45')]);_0x295aef[_0xdaba('0x49')]=qs[_0xdaba('0x3c')](_[_0xdaba('0x59')](_0x32c6d0['query'],_0x21cf03[_0xdaba('0x3c')]));if(_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x46')]){_0x295aef[_0xdaba('0x49')]=_[_0xdaba('0x47')](_0x295aef[_0xdaba('0x49')],{'$or':_['map'](_0x295aef[_0xdaba('0x3e')],function(_0x4f5421){var _0xc46744={};_0xc46744[_0x4f5421]={'$like':'%'+_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x46')]+'%'};return _0xc46744;})});}_0x295aef=_[_0xdaba('0x47')]({},_0x295aef,_0x32c6d0[_0xdaba('0x51')]);return _0x19c06a[_0xdaba('0x57')](_0x295aef);}})[_0xdaba('0x1e')](function(_0xad9773){if(_0xad9773){_0x13ce1f=_0xad9773[_0xdaba('0x40')];if(!_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x41')](_0xdaba('0x42'))){_0x295aef[_0xdaba('0x43')]=qs['limit'](_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x43')]);_0x295aef[_0xdaba('0x2c')]=qs[_0xdaba('0x2c')](_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x2c')]);}return _0x19c06a[_0xdaba('0x57')](_0x295aef);}})[_0xdaba('0x1e')](function(_0x5be517){if(_0x5be517){return _0x5be517?{'count':_0x13ce1f,'rows':_0x5be517}:null;}})[_0xdaba('0x1e')](respondWithResult(_0x155553,null))[_0xdaba('0x27')](handleError(_0x155553,null));};exports['addConfiguration']=function(_0x1aaf07,_0xaa1b95,_0x6b947f){if(_0x1aaf07['body']['id']){delete _0x1aaf07[_0xdaba('0x54')]['id'];}return db[_0xdaba('0x4a')][_0xdaba('0x58')]({'where':{'id':_0x1aaf07[_0xdaba('0x4f')]['id']}})[_0xdaba('0x1e')](handleEntityNotFound(_0xaa1b95,null))['then'](function(_0x156cbc){if(_0x156cbc){_0x1aaf07[_0xdaba('0x54')][_0xdaba('0x5a')]=_0x156cbc['id'];_0x1aaf07[_0xdaba('0x54')]['Subjects']=integrations[_0xdaba('0x5b')](_0x1aaf07['body']['channel'],_0x1aaf07[_0xdaba('0x54')]['type']);_0x1aaf07['body'][_0xdaba('0x5c')]=integrations[_0xdaba('0x5d')](_0x1aaf07[_0xdaba('0x54')]['channel'],_0x1aaf07[_0xdaba('0x54')][_0xdaba('0x37')]);return db[_0xdaba('0x5e')]['create'](_0x1aaf07[_0xdaba('0x54')],{'include':[{'model':db[_0xdaba('0x5f')],'as':_0xdaba('0x60')},{'model':db[_0xdaba('0x5f')],'as':_0xdaba('0x5c')}]});}return null;})[_0xdaba('0x1e')](respondWithResult(_0xaa1b95,null))[_0xdaba('0x27')](handleError(_0xaa1b95,null));};function getAccessToken(_0x420c36){return new Promise(function(_0x40a945,_0x12dc9e){var _0x3264da;switch(_0x420c36[_0xdaba('0x61')]){case'US':_0x3264da=_0xdaba('0x62');break;case'AU':_0x3264da='https://accounts.zoho.com.au';break;case'EU':_0x3264da=_0xdaba('0x63');break;case'IN':_0x3264da=_0xdaba('0x64');break;case'CN':_0x3264da=_0xdaba('0x65');break;default:_0x3264da=_0xdaba('0x63');break;}var _0x4a44b2={'method':_0xdaba('0x66'),'uri':_0x3264da+_0xdaba('0x67'),'qs':{'refresh_token':_0x420c36[_0xdaba('0x68')],'client_id':_0x420c36['clientId'],'client_secret':_0x420c36['clientSecret'],'grant_type':_0xdaba('0x69')},'json':!![]};return rp(_0x4a44b2)[_0xdaba('0x1e')](function(_0x547352){if(_0x547352[_0xdaba('0x6a')]){_0x40a945(_0x547352[_0xdaba('0x6a')]);}else{_0x12dc9e(_0xdaba('0x6b'));}})[_0xdaba('0x27')](function(_0x25f90a){_0x12dc9e(_0x25f90a);});});}exports[_0xdaba('0x6c')]=function(_0x1f6739,_0x21fb98,_0x565d1c){var _0x3305c3,_0x1a159e,_0x1df034,_0x11f799,_0x546312;return db[_0xdaba('0x4a')]['findOne']({'where':{'id':_0x1f6739[_0xdaba('0x4f')]['id']},'attributes':['id',_0xdaba('0x6d'),'zone','clientId',_0xdaba('0x6e'),_0xdaba('0x6f'),_0xdaba('0x70'),_0xdaba('0x68')]})[_0xdaba('0x1e')](handleEntityNotFound(_0x21fb98,null))[_0xdaba('0x1e')](function(_0x3e700c){_0x546312=_0x3e700c;_0x3305c3=_0x546312['host'];_0x1a159e=_0x3305c3==='zoho.eu'?'eu':_0xdaba('0x71');_0x1df034=_0x546312[_0xdaba('0x6f')];var _0x11ab6d=_0x1df034['slice'](-0x1);if(_0x11ab6d==='/'||_0x11ab6d==='\x5c'||_0x11ab6d===':'){_0x1df034=_0x1df034[_0xdaba('0x72')](0x0,_0x1df034[_0xdaba('0x73')](_0x11ab6d));}if(!_0x546312[_0xdaba('0x68')]){throw new Error(_0xdaba('0x74'));}return getAccessToken(_0x546312);})[_0xdaba('0x1e')](function(_0x420e7c){if(_0x420e7c){return rp({'method':_0xdaba('0x75'),'uri':util['format'](_0xdaba('0x76'),_0x1a159e),'qs':{'module':_0xdaba('0x77')},'headers':{'Authorization':_0xdaba('0x78')+_0x420e7c},'json':!![]});}})[_0xdaba('0x1e')](function(_0x454d04){if(_0x454d04){if(_0x454d04[_0xdaba('0x79')]&&_0x454d04[_0xdaba('0x79')][_0xdaba('0x24')]){throw new Error(_0x454d04['response']['error'][_0xdaba('0x25')]);}var _0x11d5ca=[];var _0x5d08fa=[];var _0x35decc=['Owner',_0xdaba('0x7a'),_0xdaba('0x7b'),_0xdaba('0x7c'),_0xdaba('0x7d'),'Call_Result',_0xdaba('0x7e'),_0xdaba('0x7f')];_0x5d08fa=_[_0xdaba('0x80')](_0x454d04[_0xdaba('0x3f')],function(_0x2ac64a){return _0x35decc[_0xdaba('0x81')](_0x2ac64a[_0xdaba('0x82')]);});for(var _0x4fecf8=0x0;_0x4fecf8<_0x5d08fa[_0xdaba('0x40')];_0x4fecf8++){if(_0x5d08fa[_0x4fecf8][_0xdaba('0x83')]===![]){_0x11d5ca[_0xdaba('0x84')]({'id':_0x5d08fa[_0x4fecf8]['id'],'name':_0x5d08fa[_0x4fecf8]['display_label'],'custom':_0x5d08fa[_0x4fecf8]['custom_field'],'options':_0x5d08fa[_0x4fecf8]['data_type']===_0xdaba('0x85')&&_0x5d08fa[_0x4fecf8]['pick_list_values'][_0xdaba('0x40')]>-0x1?_[_0xdaba('0x35')](_0x5d08fa[_0x4fecf8][_0xdaba('0x86')],function(_0x28a79b){return{'name':_0x28a79b,'value':_0x28a79b};}):[]});}}return{'count':_0x11d5ca['length'],'rows':_0x11d5ca};}else{return{'count':0x0,'rows':[]};}})[_0xdaba('0x1e')](respondWithResult(_0x21fb98,null))['catch'](function(_0x5f154d){var _0x252ab1=_0x1f6739['query'][_0xdaba('0x87')]?0x1f4:_0x5f154d[_0xdaba('0x88')]||0x1f4;logger[_0xdaba('0x24')](_0xdaba('0x89'),'getFields',_0x252ab1,JSON[_0xdaba('0x23')](_0x5f154d));delete _0x5f154d['name'];if(_0x252ab1===0x191){_0x252ab1=0x190;}_0x21fb98[_0xdaba('0x29')](_0x252ab1)[_0xdaba('0x33')](_0x1f6739[_0xdaba('0x3a')][_0xdaba('0x87')]?{'message':_0xdaba('0x8a'),'statusCode':_0x5f154d['statusCode']}:_0x5f154d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 87ed1d2..43024ff 100644 --- a/server/api/intZohoAccount/intZohoAccount.model.js +++ b/server/api/intZohoAccount/intZohoAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb394=['https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','inspect','catch','https://accounts.zoho.in','refreshToken','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0xb394,0x145));var _0x4b39=function(_0x38ce7b,_0xe8695){_0x38ce7b=_0x38ce7b-0x0;var _0x2dee5b=_0xb394[_0x38ce7b];return _0x2dee5b;};'use strict';var _=require(_0x4b39('0x0'));var util=require(_0x4b39('0x1'));var logger=require(_0x4b39('0x2'))(_0x4b39('0x3'));var moment=require(_0x4b39('0x4'));var BPromise=require(_0x4b39('0x5'));var rp=require(_0x4b39('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b39('0x7'));var config=require(_0x4b39('0x8'));var attributes=require(_0x4b39('0x9'));var integrations=require(_0x4b39('0xa'));module[_0x4b39('0xb')]=function(_0x4c710b,_0x554f07){return _0x4c710b[_0x4b39('0xc')](_0x4b39('0xd'),attributes,{'tableName':_0x4b39('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x16832e,_0x348329,_0x5b064d){if(_0x16832e[_0x4b39('0xf')](_0x4b39('0x10'))||_0x16832e['changed']('serverUrl')||_0x16832e[_0x4b39('0xf')](_0x4b39('0x11'))||_0x16832e[_0x4b39('0xf')](_0x4b39('0x12'))||_0x16832e[_0x4b39('0xf')](_0x4b39('0x13'))||_0x16832e[_0x4b39('0xf')](_0x4b39('0x14'))){var _0x579c23,_0x2c04cb;_0x579c23=_0x16832e[_0x4b39('0x15')];var _0x1a435b=_0x579c23[_0x4b39('0x16')](-0x1);if(_0x1a435b==='/'||_0x1a435b==='\x5c'||_0x1a435b===':'){_0x579c23=_0x579c23['substring'](0x0,_0x579c23[_0x4b39('0x17')](_0x1a435b));}switch(_0x16832e[_0x4b39('0x10')]){case'US':_0x2c04cb=_0x4b39('0x18');break;case'AU':_0x2c04cb=_0x4b39('0x19');break;case'IN':_0x2c04cb='https://accounts.zoho.in';break;case'CN':_0x2c04cb=_0x4b39('0x1a');break;default:_0x2c04cb=_0x4b39('0x1b');break;}var _0x4d28d9={'method':_0x4b39('0x1c'),'uri':_0x2c04cb+_0x4b39('0x1d'),'form':{'grant_type':_0x4b39('0x1e'),'client_id':_0x16832e[_0x4b39('0x11')],'client_secret':_0x16832e[_0x4b39('0x12')],'redirect_uri':_0x16832e['serverUrl'],'code':_0x16832e['code']},'headers':{'Content-Type':_0x4b39('0x1f')}};return rp(_0x4d28d9)[_0x4b39('0x20')](function(_0x426c99){var _0x212db0=JSON['parse'](_0x426c99);if(_0x212db0[_0x4b39('0x21')]){_0x16832e['refreshToken']=_0x212db0[_0x4b39('0x21')];logger[_0x4b39('0x22')](util['format'](_0x4b39('0x23'),_0x16832e[_0x4b39('0x24')],_0x16832e['id']));}else{logger['error'](util[_0x4b39('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x16832e['name'],_0x16832e['id']),util[_0x4b39('0x26')](_0x212db0,{'showHidden':![],'depth':null}));}return _0x5b064d(null,_0x348329);})[_0x4b39('0x27')](function(_0x521d4b){logger['error'](util[_0x4b39('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x16832e[_0x4b39('0x24')],_0x16832e['id']),util[_0x4b39('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b064d(_0x521d4b);});}else{return _0x5b064d(null,_0x348329);}},'beforeUpdate':function(_0x315718,_0x2e2b8f,_0x296c53){if(_0x315718[_0x4b39('0xf')]('zone')||_0x315718[_0x4b39('0xf')]('serverUrl')||_0x315718[_0x4b39('0xf')](_0x4b39('0x11'))||_0x315718[_0x4b39('0xf')](_0x4b39('0x12'))||_0x315718[_0x4b39('0xf')](_0x4b39('0x13'))||_0x315718[_0x4b39('0xf')](_0x4b39('0x14'))){var _0x59a3af,_0x3b9ac8;_0x59a3af=_0x315718[_0x4b39('0x15')];var _0x1bd06b=_0x59a3af['slice'](-0x1);if(_0x1bd06b==='/'||_0x1bd06b==='\x5c'||_0x1bd06b===':'){_0x59a3af=_0x59a3af['substring'](0x0,_0x59a3af[_0x4b39('0x17')](_0x1bd06b));}switch(_0x315718[_0x4b39('0x10')]){case'US':_0x3b9ac8=_0x4b39('0x18');break;case'AU':_0x3b9ac8='https://accounts.zoho.com.au';break;case'IN':_0x3b9ac8=_0x4b39('0x28');break;case'CN':_0x3b9ac8=_0x4b39('0x1a');break;default:_0x3b9ac8=_0x4b39('0x1b');break;}var _0x1c6fdc={'method':_0x4b39('0x1c'),'uri':_0x3b9ac8+_0x4b39('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x315718['clientId'],'client_secret':_0x315718[_0x4b39('0x12')],'redirect_uri':_0x315718['serverUrl'],'code':_0x315718[_0x4b39('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1c6fdc)[_0x4b39('0x20')](function(_0x11f671){var _0x41ae7f=JSON['parse'](_0x11f671);if(_0x41ae7f[_0x4b39('0x21')]){_0x315718[_0x4b39('0x29')]=_0x41ae7f['refresh_token'];logger['info'](util[_0x4b39('0x25')](_0x4b39('0x23'),_0x315718['name'],_0x315718['id']));}else{logger[_0x4b39('0x2a')](util[_0x4b39('0x25')](_0x4b39('0x2b'),_0x315718[_0x4b39('0x24')],_0x315718['id']),util[_0x4b39('0x26')](_0x41ae7f,{'showHidden':![],'depth':null}));}return _0x296c53(null,_0x2e2b8f);})[_0x4b39('0x27')](function(_0x399f45){logger[_0x4b39('0x2a')](util[_0x4b39('0x25')](_0x4b39('0x2b'),_0x315718[_0x4b39('0x24')],_0x315718['id']),util[_0x4b39('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x296c53(_0x399f45);});}else{return _0x296c53(null,_0x2e2b8f);}}}});}; \ No newline at end of file +var _0x358e=['/oauth/v2/token','then','parse','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','slice'];(function(_0x2b2f8e,_0x494521){var _0xd95772=function(_0xef5869){while(--_0xef5869){_0x2b2f8e['push'](_0x2b2f8e['shift']());}};_0xd95772(++_0x494521);}(_0x358e,0x1b1));var _0xe358=function(_0x59684c,_0x4f23bd){_0x59684c=_0x59684c-0x0;var _0x6e9beb=_0x358e[_0x59684c];return _0x6e9beb;};'use strict';var _=require('lodash');var util=require(_0xe358('0x0'));var logger=require(_0xe358('0x1'))('api');var moment=require(_0xe358('0x2'));var BPromise=require(_0xe358('0x3'));var rp=require(_0xe358('0x4'));var fs=require('fs');var path=require(_0xe358('0x5'));var rimraf=require(_0xe358('0x6'));var config=require(_0xe358('0x7'));var attributes=require(_0xe358('0x8'));var integrations=require(_0xe358('0x9'));module['exports']=function(_0x44efe2,_0x13ac97){return _0x44efe2[_0xe358('0xa')](_0xe358('0xb'),attributes,{'tableName':_0xe358('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1aa6bc,_0x2d9a0d,_0x3f51ba){if(_0x1aa6bc[_0xe358('0xd')](_0xe358('0xe'))||_0x1aa6bc[_0xe358('0xd')](_0xe358('0xf'))||_0x1aa6bc[_0xe358('0xd')](_0xe358('0x10'))||_0x1aa6bc['changed'](_0xe358('0x11'))||_0x1aa6bc[_0xe358('0xd')](_0xe358('0x12'))||_0x1aa6bc[_0xe358('0xd')]('host')){var _0x1787f8,_0x2386f5;_0x1787f8=_0x1aa6bc[_0xe358('0xf')];var _0x424765=_0x1787f8['slice'](-0x1);if(_0x424765==='/'||_0x424765==='\x5c'||_0x424765===':'){_0x1787f8=_0x1787f8[_0xe358('0x13')](0x0,_0x1787f8[_0xe358('0x14')](_0x424765));}switch(_0x1aa6bc[_0xe358('0xe')]){case'US':_0x2386f5=_0xe358('0x15');break;case'AU':_0x2386f5=_0xe358('0x16');break;case'IN':_0x2386f5=_0xe358('0x17');break;case'CN':_0x2386f5=_0xe358('0x18');break;default:_0x2386f5=_0xe358('0x19');break;}var _0x2014b4={'method':_0xe358('0x1a'),'uri':_0x2386f5+'/oauth/v2/token','form':{'grant_type':_0xe358('0x1b'),'client_id':_0x1aa6bc[_0xe358('0x10')],'client_secret':_0x1aa6bc[_0xe358('0x11')],'redirect_uri':_0x1aa6bc['serverUrl'],'code':_0x1aa6bc[_0xe358('0x12')]},'headers':{'Content-Type':_0xe358('0x1c')}};return rp(_0x2014b4)['then'](function(_0x1fa88e){var _0x2b51de=JSON['parse'](_0x1fa88e);if(_0x2b51de['refresh_token']){_0x1aa6bc[_0xe358('0x1d')]=_0x2b51de[_0xe358('0x1e')];logger[_0xe358('0x1f')](util[_0xe358('0x20')](_0xe358('0x21'),_0x1aa6bc[_0xe358('0x22')],_0x1aa6bc['id']));}else{logger[_0xe358('0x23')](util[_0xe358('0x20')](_0xe358('0x24'),_0x1aa6bc[_0xe358('0x22')],_0x1aa6bc['id']),util['inspect'](_0x2b51de,{'showHidden':![],'depth':null}));}return _0x3f51ba(null,_0x2d9a0d);})[_0xe358('0x25')](function(_0x2083d6){logger[_0xe358('0x23')](util[_0xe358('0x20')](_0xe358('0x24'),_0x1aa6bc[_0xe358('0x22')],_0x1aa6bc['id']),util[_0xe358('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x3f51ba(_0x2083d6);});}else{return _0x3f51ba(null,_0x2d9a0d);}},'beforeUpdate':function(_0x47f6d3,_0x5a4634,_0x4c3d7f){if(_0x47f6d3[_0xe358('0xd')](_0xe358('0xe'))||_0x47f6d3[_0xe358('0xd')](_0xe358('0xf'))||_0x47f6d3[_0xe358('0xd')](_0xe358('0x10'))||_0x47f6d3[_0xe358('0xd')](_0xe358('0x11'))||_0x47f6d3['changed'](_0xe358('0x12'))||_0x47f6d3[_0xe358('0xd')]('host')){var _0x227071,_0x30f054;_0x227071=_0x47f6d3[_0xe358('0xf')];var _0x17fc24=_0x227071[_0xe358('0x27')](-0x1);if(_0x17fc24==='/'||_0x17fc24==='\x5c'||_0x17fc24===':'){_0x227071=_0x227071['substring'](0x0,_0x227071[_0xe358('0x14')](_0x17fc24));}switch(_0x47f6d3[_0xe358('0xe')]){case'US':_0x30f054='https://accounts.zoho.com';break;case'AU':_0x30f054=_0xe358('0x16');break;case'IN':_0x30f054='https://accounts.zoho.in';break;case'CN':_0x30f054=_0xe358('0x18');break;default:_0x30f054=_0xe358('0x19');break;}var _0x397867={'method':_0xe358('0x1a'),'uri':_0x30f054+_0xe358('0x28'),'form':{'grant_type':'authorization_code','client_id':_0x47f6d3[_0xe358('0x10')],'client_secret':_0x47f6d3[_0xe358('0x11')],'redirect_uri':_0x47f6d3['serverUrl'],'code':_0x47f6d3['code']},'headers':{'Content-Type':_0xe358('0x1c')}};return rp(_0x397867)[_0xe358('0x29')](function(_0x4f38b2){var _0x5b73b3=JSON[_0xe358('0x2a')](_0x4f38b2);if(_0x5b73b3['refresh_token']){_0x47f6d3[_0xe358('0x1d')]=_0x5b73b3[_0xe358('0x1e')];logger[_0xe358('0x1f')](util[_0xe358('0x20')](_0xe358('0x21'),_0x47f6d3[_0xe358('0x22')],_0x47f6d3['id']));}else{logger[_0xe358('0x23')](util[_0xe358('0x20')](_0xe358('0x24'),_0x47f6d3[_0xe358('0x22')],_0x47f6d3['id']),util[_0xe358('0x26')](_0x5b73b3,{'showHidden':![],'depth':null}));}return _0x4c3d7f(null,_0x5a4634);})[_0xe358('0x25')](function(_0x24b091){logger[_0xe358('0x23')](util[_0xe358('0x20')](_0xe358('0x24'),_0x47f6d3['name'],_0x47f6d3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4c3d7f(_0x24b091);});}else{return _0x4c3d7f(null,_0x5a4634);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index abec6ad..0d5e63c 100644 --- a/server/api/intZohoAccount/intZohoAccount.rpc.js +++ b/server/api/intZohoAccount/intZohoAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d77=['include','then','stringify','ShowZohoAccount','find','where','info','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','map','model'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x6d77,0x13a));var _0x76d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6d77[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76d7('0x0'));var util=require(_0x76d7('0x1'));var moment=require(_0x76d7('0x2'));var BPromise=require(_0x76d7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76d7('0x5'));var logger=require(_0x76d7('0x6'))(_0x76d7('0x7'));var config=require(_0x76d7('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x327fbc,_0x562a37,_0x4a10e8){return new BPromise(function(_0x19a05b,_0x7c6716){return client['request'](_0x327fbc,_0x4a10e8)['then'](function(_0x11d311){logger['info'](_0x76d7('0x9'),_0x562a37,_0x76d7('0xa'));logger['debug'](_0x76d7('0xb'),_0x562a37,_0x76d7('0xa'),JSON['stringify'](_0x11d311));if(_0x11d311['error']){if(_0x11d311[_0x76d7('0xc')][_0x76d7('0xd')]===0x1f4){logger[_0x76d7('0xc')](_0x76d7('0x9'),_0x562a37,_0x11d311[_0x76d7('0xc')][_0x76d7('0xe')]);return _0x7c6716(_0x11d311[_0x76d7('0xc')]['message']);}logger['error'](_0x76d7('0x9'),_0x562a37,_0x11d311[_0x76d7('0xc')][_0x76d7('0xe')]);return _0x19a05b(_0x11d311[_0x76d7('0xc')][_0x76d7('0xe')]);}else{logger['info'](_0x76d7('0x9'),_0x562a37,'request\x20sent');_0x19a05b(_0x11d311[_0x76d7('0xf')]['message']);}})[_0x76d7('0x10')](function(_0x5814a5){logger[_0x76d7('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x562a37,_0x5814a5);_0x7c6716(_0x5814a5);});});}exports[_0x76d7('0x11')]=function(_0x2d7527){var _0x5d9faf=this;return new Promise(function(_0x155322,_0x34edc4){return db[_0x76d7('0x12')][_0x76d7('0x13')]({'raw':_0x2d7527['options']?_0x2d7527[_0x76d7('0x14')][_0x76d7('0x15')]===undefined?!![]:![]:!![],'where':_0x2d7527['options']?_0x2d7527['options']['where']||null:null,'attributes':_0x2d7527[_0x76d7('0x14')]?_0x2d7527[_0x76d7('0x14')][_0x76d7('0x16')]||null:null,'limit':_0x2d7527[_0x76d7('0x14')]?_0x2d7527[_0x76d7('0x14')][_0x76d7('0x17')]||null:null,'include':_0x2d7527['options']?_0x2d7527[_0x76d7('0x14')]['include']?_[_0x76d7('0x18')](_0x2d7527[_0x76d7('0x14')]['include'],function(_0x500521){return{'model':db[_0x500521[_0x76d7('0x19')]],'as':_0x500521['as'],'attributes':_0x500521[_0x76d7('0x16')],'include':_0x500521[_0x76d7('0x1a')]?_[_0x76d7('0x18')](_0x500521[_0x76d7('0x1a')],function(_0x2d5ecc){return{'model':db[_0x2d5ecc[_0x76d7('0x19')]],'as':_0x2d5ecc['as'],'attributes':_0x2d5ecc[_0x76d7('0x16')],'include':_0x2d5ecc[_0x76d7('0x1a')]?_[_0x76d7('0x18')](_0x2d5ecc[_0x76d7('0x1a')],function(_0x8149f4){return{'model':db[_0x8149f4[_0x76d7('0x19')]],'as':_0x8149f4['as'],'attributes':_0x8149f4[_0x76d7('0x16')]};}):[]};}):[]};}):[]:[]})[_0x76d7('0x1b')](function(_0x2e22d5){logger['info']('GetZohoAccount',_0x2d7527);logger['debug'](_0x76d7('0x11'),_0x2d7527,JSON[_0x76d7('0x1c')](_0x2e22d5));_0x155322(_0x2e22d5);})[_0x76d7('0x10')](function(_0xcc9d3e){logger['error'](_0x76d7('0x11'),_0xcc9d3e[_0x76d7('0xe')],_0x2d7527);_0x34edc4(_0x5d9faf['error'](0x1f4,_0xcc9d3e[_0x76d7('0xe')]));});});};exports[_0x76d7('0x1d')]=function(_0x187360){var _0xea025d=this;return new Promise(function(_0x32b002,_0x2f6f73){return db['ZohoAccount'][_0x76d7('0x1e')]({'raw':_0x187360[_0x76d7('0x14')]?_0x187360[_0x76d7('0x14')][_0x76d7('0x15')]===undefined?!![]:![]:!![],'where':_0x187360['options']?_0x187360[_0x76d7('0x14')][_0x76d7('0x1f')]||null:null,'attributes':_0x187360[_0x76d7('0x14')]?_0x187360[_0x76d7('0x14')][_0x76d7('0x16')]||null:null,'include':_0x187360[_0x76d7('0x14')]?_0x187360['options']['include']?_['map'](_0x187360[_0x76d7('0x14')][_0x76d7('0x1a')],function(_0x466773){return{'model':db[_0x466773[_0x76d7('0x19')]],'as':_0x466773['as'],'attributes':_0x466773['attributes'],'include':_0x466773['include']?_[_0x76d7('0x18')](_0x466773[_0x76d7('0x1a')],function(_0x9f068b){return{'model':db[_0x9f068b['model']],'as':_0x9f068b['as'],'attributes':_0x9f068b[_0x76d7('0x16')],'include':_0x9f068b['include']?_[_0x76d7('0x18')](_0x9f068b['include'],function(_0x58ed66){return{'model':db[_0x58ed66[_0x76d7('0x19')]],'as':_0x58ed66['as'],'attributes':_0x58ed66[_0x76d7('0x16')]};}):[]};}):[]};}):[]:[]})[_0x76d7('0x1b')](function(_0x14d6a9){logger[_0x76d7('0x20')](_0x76d7('0x1d'),_0x187360);logger[_0x76d7('0x21')](_0x76d7('0x1d'),_0x187360,JSON['stringify'](_0x14d6a9));_0x32b002(_0x14d6a9);})[_0x76d7('0x10')](function(_0x5cc45c){logger['error'](_0x76d7('0x1d'),_0x5cc45c[_0x76d7('0xe')],_0x187360);_0x2f6f73(_0xea025d['error'](0x1f4,_0x5cc45c[_0x76d7('0xe')]));});});}; \ No newline at end of file +var _0x551b=['then','GetZohoAccount','stringify','ShowZohoAccount','where','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ZohoAccount','options','raw','attributes','limit','include','model'];(function(_0xc27039,_0x2232e9){var _0x4f7c8c=function(_0x402f6b){while(--_0x402f6b){_0xc27039['push'](_0xc27039['shift']());}};_0x4f7c8c(++_0x2232e9);}(_0x551b,0x66));var _0xb551=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x551b[_0xfc0976];return _0x23579f;};'use strict';var _=require('lodash');var util=require(_0xb551('0x0'));var moment=require(_0xb551('0x1'));var BPromise=require(_0xb551('0x2'));var rs=require(_0xb551('0x3'));var fs=require('fs');var Redis=require(_0xb551('0x4'));var db=require(_0xb551('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb551('0x6'))(_0xb551('0x7'));var config=require(_0xb551('0x8'));var jayson=require(_0xb551('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x91740a,_0x4cbe9d,_0x58dca9){return new BPromise(function(_0x530a84,_0x5b3eee){return client['request'](_0x91740a,_0x58dca9)['then'](function(_0x339351){logger[_0xb551('0xa')](_0xb551('0xb'),_0x4cbe9d,'request\x20sent');logger[_0xb551('0xc')](_0xb551('0xd'),_0x4cbe9d,_0xb551('0xe'),JSON['stringify'](_0x339351));if(_0x339351['error']){if(_0x339351['error']['code']===0x1f4){logger[_0xb551('0xf')](_0xb551('0xb'),_0x4cbe9d,_0x339351[_0xb551('0xf')][_0xb551('0x10')]);return _0x5b3eee(_0x339351[_0xb551('0xf')][_0xb551('0x10')]);}logger[_0xb551('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4cbe9d,_0x339351['error']['message']);return _0x530a84(_0x339351['error']['message']);}else{logger[_0xb551('0xa')](_0xb551('0xb'),_0x4cbe9d,_0xb551('0xe'));_0x530a84(_0x339351[_0xb551('0x11')][_0xb551('0x10')]);}})[_0xb551('0x12')](function(_0x1fb143){logger[_0xb551('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4cbe9d,_0x1fb143);_0x5b3eee(_0x1fb143);});});}exports['GetZohoAccount']=function(_0x4fa188){var _0x5eda1f=this;return new Promise(function(_0x12ace6,_0x1dc01a){return db[_0xb551('0x13')]['findAll']({'raw':_0x4fa188[_0xb551('0x14')]?_0x4fa188[_0xb551('0x14')][_0xb551('0x15')]===undefined?!![]:![]:!![],'where':_0x4fa188[_0xb551('0x14')]?_0x4fa188[_0xb551('0x14')]['where']||null:null,'attributes':_0x4fa188['options']?_0x4fa188[_0xb551('0x14')][_0xb551('0x16')]||null:null,'limit':_0x4fa188[_0xb551('0x14')]?_0x4fa188[_0xb551('0x14')][_0xb551('0x17')]||null:null,'include':_0x4fa188['options']?_0x4fa188[_0xb551('0x14')]['include']?_['map'](_0x4fa188[_0xb551('0x14')][_0xb551('0x18')],function(_0x4ab1fa){return{'model':db[_0x4ab1fa['model']],'as':_0x4ab1fa['as'],'attributes':_0x4ab1fa[_0xb551('0x16')],'include':_0x4ab1fa['include']?_['map'](_0x4ab1fa[_0xb551('0x18')],function(_0x1cc958){return{'model':db[_0x1cc958[_0xb551('0x19')]],'as':_0x1cc958['as'],'attributes':_0x1cc958[_0xb551('0x16')],'include':_0x1cc958['include']?_['map'](_0x1cc958[_0xb551('0x18')],function(_0x363fe6){return{'model':db[_0x363fe6[_0xb551('0x19')]],'as':_0x363fe6['as'],'attributes':_0x363fe6[_0xb551('0x16')]};}):[]};}):[]};}):[]:[]})[_0xb551('0x1a')](function(_0x118938){logger[_0xb551('0xa')](_0xb551('0x1b'),_0x4fa188);logger['debug'](_0xb551('0x1b'),_0x4fa188,JSON[_0xb551('0x1c')](_0x118938));_0x12ace6(_0x118938);})[_0xb551('0x12')](function(_0x57f712){logger[_0xb551('0xf')](_0xb551('0x1b'),_0x57f712[_0xb551('0x10')],_0x4fa188);_0x1dc01a(_0x5eda1f[_0xb551('0xf')](0x1f4,_0x57f712[_0xb551('0x10')]));});});};exports[_0xb551('0x1d')]=function(_0x2bfb66){var _0x346cfe=this;return new Promise(function(_0x391626,_0x3cd7ab){return db['ZohoAccount']['find']({'raw':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66[_0xb551('0x14')][_0xb551('0x15')]===undefined?!![]:![]:!![],'where':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66['options'][_0xb551('0x1e')]||null:null,'attributes':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66['options'][_0xb551('0x16')]||null:null,'include':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66[_0xb551('0x14')][_0xb551('0x18')]?_[_0xb551('0x1f')](_0x2bfb66['options']['include'],function(_0x5b4fd3){return{'model':db[_0x5b4fd3['model']],'as':_0x5b4fd3['as'],'attributes':_0x5b4fd3[_0xb551('0x16')],'include':_0x5b4fd3[_0xb551('0x18')]?_['map'](_0x5b4fd3[_0xb551('0x18')],function(_0xbf975e){return{'model':db[_0xbf975e[_0xb551('0x19')]],'as':_0xbf975e['as'],'attributes':_0xbf975e[_0xb551('0x16')],'include':_0xbf975e[_0xb551('0x18')]?_[_0xb551('0x1f')](_0xbf975e[_0xb551('0x18')],function(_0x104380){return{'model':db[_0x104380[_0xb551('0x19')]],'as':_0x104380['as'],'attributes':_0x104380['attributes']};}):[]};}):[]};}):[]:[]})[_0xb551('0x1a')](function(_0x4b7e23){logger[_0xb551('0xa')]('ShowZohoAccount',_0x2bfb66);logger[_0xb551('0xc')](_0xb551('0x1d'),_0x2bfb66,JSON[_0xb551('0x1c')](_0x4b7e23));_0x391626(_0x4b7e23);})['catch'](function(_0x3acea5){logger[_0xb551('0xf')]('ShowZohoAccount',_0x3acea5[_0xb551('0x10')],_0x2bfb66);_0x3cd7ab(_0x346cfe['error'](0x1f4,_0x3acea5[_0xb551('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index cb05bee..8ad7a31 100644 --- a/server/api/intZohoConfiguration/index.js +++ b/server/api/intZohoConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc06d=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./intZohoConfiguration.controller','isAuthenticated','index','show','/:id/fields','getFields','get','/:id/subjects','getDescriptions','post','create','put','update','delete','/:id','destroy'];(function(_0x32ea9c,_0x41eab6){var _0x3a7760=function(_0x3b3025){while(--_0x3b3025){_0x32ea9c['push'](_0x32ea9c['shift']());}};_0x3a7760(++_0x41eab6);}(_0xc06d,0x15a));var _0xdc06=function(_0xd5d73f,_0x1fc3b3){_0xd5d73f=_0xd5d73f-0x0;var _0x30d128=_0xc06d[_0xd5d73f];return _0x30d128;};'use strict';var multer=require(_0xdc06('0x0'));var util=require(_0xdc06('0x1'));var path=require(_0xdc06('0x2'));var timeout=require(_0xdc06('0x3'));var express=require('express');var router=express[_0xdc06('0x4')]();var auth=require(_0xdc06('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdc06('0x6'));router['get']('/',auth[_0xdc06('0x7')](),controller[_0xdc06('0x8')]);router['get']('/:id',auth[_0xdc06('0x7')](),controller[_0xdc06('0x9')]);router['get'](_0xdc06('0xa'),auth[_0xdc06('0x7')](),controller[_0xdc06('0xb')]);router[_0xdc06('0xc')](_0xdc06('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xdc06('0xc')]('/:id/descriptions',auth[_0xdc06('0x7')](),controller[_0xdc06('0xe')]);router[_0xdc06('0xf')]('/',auth[_0xdc06('0x7')](),controller[_0xdc06('0x10')]);router[_0xdc06('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xdc06('0x12')]);router[_0xdc06('0x13')](_0xdc06('0x14'),auth['isAuthenticated'](),controller[_0xdc06('0x15')]);module[_0xdc06('0x16')]=router; \ No newline at end of file +var _0xa74f=['/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5ab684,_0x73e39a){var _0x3e0172=function(_0x32de79){while(--_0x32de79){_0x5ab684['push'](_0x5ab684['shift']());}};_0x3e0172(++_0x73e39a);}(_0xa74f,0x9a));var _0xfa74=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xa74f[_0x40be86];return _0xda3c3b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var auth=require(_0xfa74('0x2'));var interaction=require(_0xfa74('0x3'));var config=require(_0xfa74('0x4'));var controller=require('./intZohoConfiguration.controller');router[_0xfa74('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfa74('0x5')](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0x8')]);router[_0xfa74('0x5')](_0xfa74('0x9'),auth['isAuthenticated'](),controller[_0xfa74('0xa')]);router[_0xfa74('0x5')](_0xfa74('0xb'),auth[_0xfa74('0x7')](),controller['getSubjects']);router[_0xfa74('0x5')](_0xfa74('0xc'),auth['isAuthenticated'](),controller[_0xfa74('0xd')]);router[_0xfa74('0xe')]('/',auth[_0xfa74('0x7')](),controller[_0xfa74('0xf')]);router['put'](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0x10')]);router[_0xfa74('0x11')]('/:id',auth[_0xfa74('0x7')](),controller[_0xfa74('0x12')]);module[_0xfa74('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 7ac4fbd..8cefac7 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f97=['exports','STRING','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x7f97,0x16f));var _0x77f9=function(_0x11ac95,_0x3aff88){_0x11ac95=_0x11ac95-0x0;var _0x5710a7=_0x7f97[_0x11ac95];return _0x5710a7;};'use strict';var Sequelize=require(_0x77f9('0x0'));module[_0x77f9('0x1')]={'name':{'type':Sequelize[_0x77f9('0x2')]},'moduleCreate':{'type':Sequelize[_0x77f9('0x3')](_0x77f9('0x4'),_0x77f9('0x5'),_0x77f9('0x6')),'defaultValue':_0x77f9('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x77f9('0x5'),_0x77f9('0x4')),'defaultValue':_0x77f9('0x7')},'description':{'type':Sequelize[_0x77f9('0x2')]}}; \ No newline at end of file +var _0xcd93=['ENUM','lead','nothing','contact_lead','contact','sequelize','STRING'];(function(_0x3e363e,_0x1e90ce){var _0x42b492=function(_0x543efc){while(--_0x543efc){_0x3e363e['push'](_0x3e363e['shift']());}};_0x42b492(++_0x1e90ce);}(_0xcd93,0xde));var _0x3cd9=function(_0x4062a7,_0x2a62ae){_0x4062a7=_0x4062a7-0x0;var _0x17c1fe=_0xcd93[_0x4062a7];return _0x17c1fe;};'use strict';var Sequelize=require(_0x3cd9('0x0'));module['exports']={'name':{'type':Sequelize[_0x3cd9('0x1')]},'moduleCreate':{'type':Sequelize[_0x3cd9('0x2')](_0x3cd9('0x3'),'contact',_0x3cd9('0x4')),'defaultValue':_0x3cd9('0x3')},'moduleSearch':{'type':Sequelize[_0x3cd9('0x2')](_0x3cd9('0x5'),_0x3cd9('0x6'),_0x3cd9('0x3')),'defaultValue':_0x3cd9('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index f6a8362..de4f1ca 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 935b4d1..8e78ecd 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.model.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb524=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x206d1a,_0x597284){var _0x187e1c=function(_0x499f16){while(--_0x499f16){_0x206d1a['push'](_0x206d1a['shift']());}};_0x187e1c(++_0x597284);}(_0xb524,0x90));var _0x4b52=function(_0x5e434c,_0x5e54b8){_0x5e434c=_0x5e434c-0x0;var _0x586358=_0xb524[_0x5e434c];return _0x586358;};'use strict';var _=require(_0x4b52('0x0'));var util=require(_0x4b52('0x1'));var logger=require(_0x4b52('0x2'))(_0x4b52('0x3'));var moment=require(_0x4b52('0x4'));var BPromise=require(_0x4b52('0x5'));var rp=require(_0x4b52('0x6'));var fs=require('fs');var path=require(_0x4b52('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4b52('0x8'));module[_0x4b52('0x9')]=function(_0x1cc3f4,_0x5b462e){return _0x1cc3f4[_0x4b52('0xa')](_0x4b52('0xb'),attributes,{'tableName':_0x4b52('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b95=['path','rimraf','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment'];(function(_0x181642,_0x5004d2){var _0x301bd9=function(_0x211c34){while(--_0x211c34){_0x181642['push'](_0x181642['shift']());}};_0x301bd9(++_0x5004d2);}(_0x9b95,0x9e));var _0x59b9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9b95[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x59b9('0x0'));var util=require(_0x59b9('0x1'));var logger=require('../../config/logger')(_0x59b9('0x2'));var moment=require(_0x59b9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x59b9('0x4'));var rimraf=require(_0x59b9('0x5'));var config=require('../../config/environment');var attributes=require(_0x59b9('0x6'));module['exports']=function(_0x13130c,_0x338834){return _0x13130c['define'](_0x59b9('0x7'),attributes,{'tableName':_0x59b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index ebe5763..bf9eb6f 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbaa=['util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xfbaa,0x133));var _0xafba=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0xfbaa[_0x257b0e];return _0x27ac2a;};'use strict';var _=require(_0xafba('0x0'));var util=require(_0xafba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xafba('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafba('0x3'))['db'];var utils=require(_0xafba('0x4'));var logger=require(_0xafba('0x5'))('rpc');var config=require(_0xafba('0x6'));var jayson=require(_0xafba('0x7'));var client=jayson[_0xafba('0x8')][_0xafba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19ff16,_0x2e00cb,_0x5a0b09){return new BPromise(function(_0x440747,_0x4c6e0a){return client['request'](_0x19ff16,_0x5a0b09)[_0xafba('0xa')](function(_0x37928c){logger[_0xafba('0xb')](_0xafba('0xc'),_0x2e00cb,_0xafba('0xd'));logger[_0xafba('0xe')](_0xafba('0xf'),_0x2e00cb,_0xafba('0xd'),JSON[_0xafba('0x10')](_0x37928c));if(_0x37928c[_0xafba('0x11')]){if(_0x37928c[_0xafba('0x11')][_0xafba('0x12')]===0x1f4){logger[_0xafba('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x2e00cb,_0x37928c['error'][_0xafba('0x13')]);return _0x4c6e0a(_0x37928c['error'][_0xafba('0x13')]);}logger[_0xafba('0x11')](_0xafba('0xc'),_0x2e00cb,_0x37928c[_0xafba('0x11')]['message']);return _0x440747(_0x37928c['error']['message']);}else{logger[_0xafba('0xb')](_0xafba('0xc'),_0x2e00cb,'request\x20sent');_0x440747(_0x37928c[_0xafba('0x14')][_0xafba('0x13')]);}})[_0xafba('0x15')](function(_0x1633ec){logger[_0xafba('0x11')](_0xafba('0xc'),_0x2e00cb,_0x1633ec);_0x4c6e0a(_0x1633ec);});});} \ No newline at end of file +var _0x0e00=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/environment','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0e00,0x6d));var _0x00e0=function(_0x1d8012,_0x519ed3){_0x1d8012=_0x1d8012-0x0;var _0x29f754=_0x0e00[_0x1d8012];return _0x29f754;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x00e0('0x0'));var BPromise=require(_0x00e0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00e0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x00e0('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x00e0('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x00e0('0x5')][_0x00e0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x226676,_0x3e8a7e,_0x2b62ac){return new BPromise(function(_0x337402,_0x5583de){return client[_0x00e0('0x7')](_0x226676,_0x2b62ac)[_0x00e0('0x8')](function(_0x3a4fed){logger['info'](_0x00e0('0x9'),_0x3e8a7e,_0x00e0('0xa'));logger[_0x00e0('0xb')](_0x00e0('0xc'),_0x3e8a7e,'request\x20sent',JSON[_0x00e0('0xd')](_0x3a4fed));if(_0x3a4fed[_0x00e0('0xe')]){if(_0x3a4fed[_0x00e0('0xe')][_0x00e0('0xf')]===0x1f4){logger['error'](_0x00e0('0x9'),_0x3e8a7e,_0x3a4fed[_0x00e0('0xe')][_0x00e0('0x10')]);return _0x5583de(_0x3a4fed[_0x00e0('0xe')][_0x00e0('0x10')]);}logger[_0x00e0('0xe')](_0x00e0('0x9'),_0x3e8a7e,_0x3a4fed[_0x00e0('0xe')]['message']);return _0x337402(_0x3a4fed[_0x00e0('0xe')][_0x00e0('0x10')]);}else{logger[_0x00e0('0x11')](_0x00e0('0x9'),_0x3e8a7e,_0x00e0('0xa'));_0x337402(_0x3a4fed[_0x00e0('0x12')][_0x00e0('0x10')]);}})[_0x00e0('0x13')](function(_0x120b66){logger[_0x00e0('0xe')](_0x00e0('0x9'),_0x3e8a7e,_0x120b66);_0x5583de(_0x120b66);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 811fd68..66fb016 100644 --- a/server/api/intZohoField/index.js +++ b/server/api/intZohoField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01d9=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var auth=require(_0x901d('0x5'));var interaction=require(_0x901d('0x6'));var config=require(_0x901d('0x7'));var controller=require(_0x901d('0x8'));router[_0x901d('0x9')]('/',auth[_0x901d('0xa')](),controller['index']);router[_0x901d('0x9')](_0x901d('0xb'),auth[_0x901d('0xa')](),controller[_0x901d('0xc')]);router[_0x901d('0xd')]('/',auth[_0x901d('0xa')](),controller[_0x901d('0xe')]);router[_0x901d('0xf')](_0x901d('0xb'),auth[_0x901d('0xa')](),controller[_0x901d('0x10')]);router[_0x901d('0x11')](_0x901d('0xb'),auth['isAuthenticated'](),controller[_0x901d('0x12')]);module['exports']=router; \ No newline at end of file +var _0xfff0=['show','isAuthenticated','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','index','/:id'];(function(_0x4e4876,_0x10b99c){var _0x10fa1f=function(_0x18dd81){while(--_0x18dd81){_0x4e4876['push'](_0x4e4876['shift']());}};_0x10fa1f(++_0x10b99c);}(_0xfff0,0x139));var _0x0fff=function(_0x5300eb,_0x40a89b){_0x5300eb=_0x5300eb-0x0;var _0x3ee625=_0xfff0[_0x5300eb];return _0x3ee625;};'use strict';var multer=require('multer');var util=require(_0x0fff('0x0'));var path=require(_0x0fff('0x1'));var timeout=require(_0x0fff('0x2'));var express=require('express');var router=express[_0x0fff('0x3')]();var auth=require(_0x0fff('0x4'));var interaction=require(_0x0fff('0x5'));var config=require('../../config/environment');var controller=require(_0x0fff('0x6'));router[_0x0fff('0x7')]('/',auth['isAuthenticated'](),controller[_0x0fff('0x8')]);router[_0x0fff('0x7')](_0x0fff('0x9'),auth['isAuthenticated'](),controller[_0x0fff('0xa')]);router['post']('/',auth[_0x0fff('0xb')](),controller['create']);router[_0x0fff('0xc')](_0x0fff('0x9'),auth['isAuthenticated'](),controller[_0x0fff('0xd')]);router[_0x0fff('0xe')](_0x0fff('0x9'),auth[_0x0fff('0xb')](),controller[_0x0fff('0xf')]);module[_0x0fff('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 44de58d..1fc5a68 100644 --- a/server/api/intZohoField/intZohoField.attributes.js +++ b/server/api/intZohoField/intZohoField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f86=['BOOLEAN','exports','variable','customVariable','keyValue','string','STRING','ENUM'];(function(_0x4568a0,_0x1a0151){var _0x2477b4=function(_0x5db8d2){while(--_0x5db8d2){_0x4568a0['push'](_0x4568a0['shift']());}};_0x2477b4(++_0x1a0151);}(_0x5f86,0x81));var _0x65f8=function(_0x18c38f,_0x466055){_0x18c38f=_0x18c38f-0x0;var _0xfb7527=_0x5f86[_0x18c38f];return _0xfb7527;};'use strict';var Sequelize=require('sequelize');module[_0x65f8('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x65f8('0x1'),_0x65f8('0x2'),_0x65f8('0x3')),'defaultValue':_0x65f8('0x4')},'content':{'type':Sequelize[_0x65f8('0x5')]},'key':{'type':Sequelize[_0x65f8('0x5')]},'keyType':{'type':Sequelize[_0x65f8('0x6')](_0x65f8('0x4'),_0x65f8('0x1'),_0x65f8('0x2'))},'keyContent':{'type':Sequelize[_0x65f8('0x5')]},'idField':{'type':Sequelize[_0x65f8('0x5')]},'nameField':{'type':Sequelize[_0x65f8('0x5')]},'customField':{'type':Sequelize[_0x65f8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x65f8('0x5')]}}; \ No newline at end of file +var _0xdbd0=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x40c5e5,_0x1c24a2){var _0x527a78=function(_0x503fa9){while(--_0x503fa9){_0x40c5e5['push'](_0x40c5e5['shift']());}};_0x527a78(++_0x1c24a2);}(_0xdbd0,0x88));var _0x0dbd=function(_0x52b505,_0x365bab){_0x52b505=_0x52b505-0x0;var _0x19a38a=_0xdbd0[_0x52b505];return _0x19a38a;};'use strict';var Sequelize=require(_0x0dbd('0x0'));module[_0x0dbd('0x1')]={'type':{'type':Sequelize[_0x0dbd('0x2')](_0x0dbd('0x3'),_0x0dbd('0x4'),'customVariable',_0x0dbd('0x5')),'defaultValue':_0x0dbd('0x3')},'content':{'type':Sequelize[_0x0dbd('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0dbd('0x2')](_0x0dbd('0x3'),_0x0dbd('0x4'),_0x0dbd('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0dbd('0x6')]},'customField':{'type':Sequelize[_0x0dbd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0dbd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f5c7edf..44e488b 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac12=['offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','keys','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','sendStatus','status','end','json','count'];(function(_0x2da304,_0x1aed4b){var _0x1f0745=function(_0x5eb6d5){while(--_0x5eb6d5){_0x2da304['push'](_0x2da304['shift']());}};_0x1f0745(++_0x1aed4b);}(_0xac12,0x1e7));var _0x2ac1=function(_0x28e316,_0x3741b9){_0x28e316=_0x28e316-0x0;var _0x122d28=_0xac12[_0x28e316];return _0x122d28;};'use strict';var pdf=require(_0x2ac1('0x0'));var emlformat=require(_0x2ac1('0x1'));var rimraf=require(_0x2ac1('0x2'));var zipdir=require(_0x2ac1('0x3'));var jsonpatch=require(_0x2ac1('0x4'));var rp=require(_0x2ac1('0x5'));var moment=require(_0x2ac1('0x6'));var BPromise=require(_0x2ac1('0x7'));var Mustache=require(_0x2ac1('0x8'));var util=require(_0x2ac1('0x9'));var path=require(_0x2ac1('0xa'));var sox=require(_0x2ac1('0xb'));var csv=require(_0x2ac1('0xc'));var ejs=require(_0x2ac1('0xd'));var fs=require('fs');var _=require(_0x2ac1('0xe'));var squel=require(_0x2ac1('0xf'));var crypto=require(_0x2ac1('0x10'));var jsforce=require(_0x2ac1('0x11'));var deskjs=require(_0x2ac1('0x12'));var toCsv=require(_0x2ac1('0xc'));var querystring=require('querystring');var Papa=require(_0x2ac1('0x13'));var Redis=require(_0x2ac1('0x14'));var authService=require(_0x2ac1('0x15'));var qs=require(_0x2ac1('0x16'));var as=require(_0x2ac1('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ac1('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2ac1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f91e4,_0x5e9998){_0x5e9998=_0x5e9998||0xcc;return function(_0x2bda61){if(_0x2bda61){return _0x4f91e4[_0x2ac1('0x1a')](_0x5e9998);}return _0x4f91e4[_0x2ac1('0x1b')](_0x5e9998)[_0x2ac1('0x1c')]();};}function respondWithResult(_0x126cc1,_0x399dc6){_0x399dc6=_0x399dc6||0xc8;return function(_0x1b864f){if(_0x1b864f){return _0x126cc1[_0x2ac1('0x1b')](_0x399dc6)[_0x2ac1('0x1d')](_0x1b864f);}};}function respondWithFilteredResult(_0xfee1c9,_0x3b9e24){return function(_0x4f3a01){if(_0x4f3a01){var _0x1d6c25=_0x4f3a01[_0x2ac1('0x1e')],_0x908fd6=_0x3b9e24[_0x2ac1('0x1f')],_0x385690=_0x3b9e24[_0x2ac1('0x1f')]+_0x3b9e24[_0x2ac1('0x20')],_0x1d1302;if(_0x385690>=_0x1d6c25){_0x385690=_0x1d6c25;_0x1d1302=0xc8;}else{_0x1d1302=0xce;}_0xfee1c9[_0x2ac1('0x1b')](_0x1d1302);return _0xfee1c9[_0x2ac1('0x21')](_0x2ac1('0x22'),_0x908fd6+'-'+_0x385690+'/'+_0x1d6c25)[_0x2ac1('0x1d')](_0x4f3a01);}return null;};}function patchUpdates(_0x4eda01){return function(_0x32a27e){try{jsonpatch[_0x2ac1('0x23')](_0x32a27e,_0x4eda01,!![]);}catch(_0x453f8a){return BPromise['reject'](_0x453f8a);}return _0x32a27e[_0x2ac1('0x24')]();};}function saveUpdates(_0x3c0b19,_0x34b88e){return function(_0x2287e4){if(_0x2287e4){return _0x2287e4[_0x2ac1('0x25')](_0x3c0b19)[_0x2ac1('0x26')](function(_0xc4f315){return _0xc4f315;});}return null;};}function removeEntity(_0x498376,_0x4ecf6e){return function(_0x11fa47){if(_0x11fa47){return _0x11fa47[_0x2ac1('0x27')]()['then'](function(){_0x498376['status'](0xcc)[_0x2ac1('0x1c')]();});}};}function handleEntityNotFound(_0x2b4c93,_0xd6e41f){return function(_0x5e43f8){if(!_0x5e43f8){_0x2b4c93['sendStatus'](0x194);}return _0x5e43f8;};}function handleError(_0x593322,_0x2a5316){_0x2a5316=_0x2a5316||0x1f4;return function(_0x42ceb1){logger[_0x2ac1('0x28')](_0x42ceb1[_0x2ac1('0x29')]);if(_0x42ceb1[_0x2ac1('0x2a')]){delete _0x42ceb1[_0x2ac1('0x2a')];}_0x593322[_0x2ac1('0x1b')](_0x2a5316)[_0x2ac1('0x2b')](_0x42ceb1);};}exports[_0x2ac1('0x2c')]=function(_0x55e740,_0x3ffeb3){var _0x49f9f7={},_0x537158={},_0x5b58fd={'count':0x0,'rows':[]};var _0x23119e=_[_0x2ac1('0x2d')](db[_0x2ac1('0x2e')][_0x2ac1('0x2f')],function(_0x261330){return{'name':_0x261330['fieldName'],'type':_0x261330[_0x2ac1('0x30')]['key']};});_0x537158[_0x2ac1('0x31')]=_[_0x2ac1('0x2d')](_0x23119e,_0x2ac1('0x2a'));_0x537158['query']=_['keys'](_0x55e740[_0x2ac1('0x32')]);_0x537158[_0x2ac1('0x33')]=_[_0x2ac1('0x34')](_0x537158[_0x2ac1('0x31')],_0x537158['query']);_0x49f9f7[_0x2ac1('0x35')]=_['intersection'](_0x537158[_0x2ac1('0x31')],qs[_0x2ac1('0x36')](_0x55e740['query']['fields']));_0x49f9f7['attributes']=_0x49f9f7[_0x2ac1('0x35')]['length']?_0x49f9f7[_0x2ac1('0x35')]:_0x537158[_0x2ac1('0x31')];if(!_0x55e740['query'][_0x2ac1('0x37')](_0x2ac1('0x38'))){_0x49f9f7[_0x2ac1('0x20')]=qs['limit'](_0x55e740[_0x2ac1('0x32')][_0x2ac1('0x20')]);_0x49f9f7['offset']=qs[_0x2ac1('0x1f')](_0x55e740[_0x2ac1('0x32')][_0x2ac1('0x1f')]);}_0x49f9f7[_0x2ac1('0x39')]=qs[_0x2ac1('0x3a')](_0x55e740[_0x2ac1('0x32')]['sort']);_0x49f9f7[_0x2ac1('0x3b')]=qs[_0x2ac1('0x33')](_[_0x2ac1('0x3c')](_0x55e740[_0x2ac1('0x32')],_0x537158[_0x2ac1('0x33')]),_0x23119e);if(_0x55e740[_0x2ac1('0x32')][_0x2ac1('0x3d')]){_0x49f9f7[_0x2ac1('0x3b')]=_[_0x2ac1('0x3e')](_0x49f9f7[_0x2ac1('0x3b')],{'$or':_[_0x2ac1('0x2d')](_0x23119e,function(_0x57b2fe){if(_0x57b2fe['type']!==_0x2ac1('0x3f')){var _0x4a393f={};_0x4a393f[_0x57b2fe['name']]={'$like':'%'+_0x55e740[_0x2ac1('0x32')][_0x2ac1('0x3d')]+'%'};return _0x4a393f;}})});}_0x49f9f7=_[_0x2ac1('0x3e')]({},_0x49f9f7,_0x55e740[_0x2ac1('0x40')]);var _0x4affd2={'where':_0x49f9f7[_0x2ac1('0x3b')]};return db['ZohoField'][_0x2ac1('0x1e')](_0x4affd2)['then'](function(_0x34c9f4){_0x5b58fd['count']=_0x34c9f4;if(_0x55e740[_0x2ac1('0x32')]['includeAll']){_0x49f9f7[_0x2ac1('0x41')]=[{'all':!![]}];}return db[_0x2ac1('0x2e')]['findAll'](_0x49f9f7);})[_0x2ac1('0x26')](function(_0x24d321){_0x5b58fd[_0x2ac1('0x42')]=_0x24d321;return _0x5b58fd;})[_0x2ac1('0x26')](respondWithFilteredResult(_0x3ffeb3,_0x49f9f7))[_0x2ac1('0x43')](handleError(_0x3ffeb3,null));};exports['show']=function(_0x5983ea,_0x3bb60f){var _0x39eaac={'raw':!![],'where':{'id':_0x5983ea[_0x2ac1('0x44')]['id']}},_0xb48c8d={};_0xb48c8d[_0x2ac1('0x31')]=_[_0x2ac1('0x45')](db[_0x2ac1('0x2e')][_0x2ac1('0x2f')]);_0xb48c8d[_0x2ac1('0x32')]=_[_0x2ac1('0x45')](_0x5983ea[_0x2ac1('0x32')]);_0xb48c8d[_0x2ac1('0x33')]=_[_0x2ac1('0x34')](_0xb48c8d[_0x2ac1('0x31')],_0xb48c8d[_0x2ac1('0x32')]);_0x39eaac[_0x2ac1('0x35')]=_[_0x2ac1('0x34')](_0xb48c8d[_0x2ac1('0x31')],qs[_0x2ac1('0x36')](_0x5983ea[_0x2ac1('0x32')][_0x2ac1('0x36')]));_0x39eaac[_0x2ac1('0x35')]=_0x39eaac['attributes'][_0x2ac1('0x46')]?_0x39eaac[_0x2ac1('0x35')]:_0xb48c8d[_0x2ac1('0x31')];if(_0x5983ea[_0x2ac1('0x32')]['includeAll']){_0x39eaac[_0x2ac1('0x41')]=[{'all':!![]}];}_0x39eaac=_['merge']({},_0x39eaac,_0x5983ea['options']);return db[_0x2ac1('0x2e')][_0x2ac1('0x47')](_0x39eaac)[_0x2ac1('0x26')](handleEntityNotFound(_0x3bb60f,null))[_0x2ac1('0x26')](respondWithResult(_0x3bb60f,null))[_0x2ac1('0x43')](handleError(_0x3bb60f,null));};exports[_0x2ac1('0x48')]=function(_0x356616,_0x49eea4){return db[_0x2ac1('0x2e')][_0x2ac1('0x48')](_0x356616['body'],{})['then'](respondWithResult(_0x49eea4,0xc9))[_0x2ac1('0x43')](handleError(_0x49eea4,null));};exports[_0x2ac1('0x25')]=function(_0xadd6f1,_0x5c7e80){if(_0xadd6f1[_0x2ac1('0x49')]['id']){delete _0xadd6f1[_0x2ac1('0x49')]['id'];}return db[_0x2ac1('0x2e')]['find']({'where':{'id':_0xadd6f1[_0x2ac1('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c7e80,null))[_0x2ac1('0x26')](saveUpdates(_0xadd6f1[_0x2ac1('0x49')],null))[_0x2ac1('0x26')](respondWithResult(_0x5c7e80,null))['catch'](handleError(_0x5c7e80,null));};exports['destroy']=function(_0x3a9c26,_0x4808c7){return db[_0x2ac1('0x2e')]['find']({'where':{'id':_0x3a9c26[_0x2ac1('0x44')]['id']}})['then'](handleEntityNotFound(_0x4808c7,null))[_0x2ac1('0x26')](removeEntity(_0x4808c7,null))[_0x2ac1('0x43')](handleError(_0x4808c7,null));}; \ No newline at end of file +var _0xf4e7=['ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','end','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','moment','path','to-csv'];(function(_0x47d676,_0x47ad35){var _0x3bf7d3=function(_0x532122){while(--_0x532122){_0x47d676['push'](_0x47d676['shift']());}};_0x3bf7d3(++_0x47ad35);}(_0xf4e7,0x1e3));var _0x7f4e=function(_0x369811,_0x37e9df){_0x369811=_0x369811-0x0;var _0x1de129=_0xf4e7[_0x369811];return _0x1de129;};'use strict';var pdf=require(_0x7f4e('0x0'));var emlformat=require(_0x7f4e('0x1'));var rimraf=require(_0x7f4e('0x2'));var zipdir=require(_0x7f4e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7f4e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7f4e('0x5'));var sox=require('sox');var csv=require(_0x7f4e('0x6'));var ejs=require(_0x7f4e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f4e('0x8'));var crypto=require(_0x7f4e('0x9'));var jsforce=require(_0x7f4e('0xa'));var deskjs=require(_0x7f4e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7f4e('0xc'));var Papa=require(_0x7f4e('0xd'));var Redis=require(_0x7f4e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7f4e('0xf'));var as=require(_0x7f4e('0x10'));var hardwareService=require(_0x7f4e('0x11'));var logger=require('../../config/logger')(_0x7f4e('0x12'));var utils=require(_0x7f4e('0x13'));var config=require(_0x7f4e('0x14'));var licenseUtil=require(_0x7f4e('0x15'));var db=require(_0x7f4e('0x16'))['db'];function respondWithStatusCode(_0x517190,_0xaa320d){_0xaa320d=_0xaa320d||0xcc;return function(_0x3c3c31){if(_0x3c3c31){return _0x517190[_0x7f4e('0x17')](_0xaa320d);}return _0x517190[_0x7f4e('0x18')](_0xaa320d)['end']();};}function respondWithResult(_0x2269d2,_0x1ebf5e){_0x1ebf5e=_0x1ebf5e||0xc8;return function(_0x31b24a){if(_0x31b24a){return _0x2269d2[_0x7f4e('0x18')](_0x1ebf5e)[_0x7f4e('0x19')](_0x31b24a);}};}function respondWithFilteredResult(_0x3d0b25,_0x5c111c){return function(_0x3555ee){if(_0x3555ee){var _0x2e0ac7=_0x3555ee[_0x7f4e('0x1a')],_0x53b4f7=_0x5c111c[_0x7f4e('0x1b')],_0x3206bd=_0x5c111c[_0x7f4e('0x1b')]+_0x5c111c[_0x7f4e('0x1c')],_0x4f29c3;if(_0x3206bd>=_0x2e0ac7){_0x3206bd=_0x2e0ac7;_0x4f29c3=0xc8;}else{_0x4f29c3=0xce;}_0x3d0b25['status'](_0x4f29c3);return _0x3d0b25['set'](_0x7f4e('0x1d'),_0x53b4f7+'-'+_0x3206bd+'/'+_0x2e0ac7)[_0x7f4e('0x19')](_0x3555ee);}return null;};}function patchUpdates(_0x1c7d3c){return function(_0x55d5c9){try{jsonpatch[_0x7f4e('0x1e')](_0x55d5c9,_0x1c7d3c,!![]);}catch(_0x5ab7e5){return BPromise[_0x7f4e('0x1f')](_0x5ab7e5);}return _0x55d5c9['save']();};}function saveUpdates(_0x26d773,_0x3ad923){return function(_0x39de21){if(_0x39de21){return _0x39de21[_0x7f4e('0x20')](_0x26d773)[_0x7f4e('0x21')](function(_0x38fb33){return _0x38fb33;});}return null;};}function removeEntity(_0x58d2a7,_0x3e91c7){return function(_0x1ec922){if(_0x1ec922){return _0x1ec922['destroy']()[_0x7f4e('0x21')](function(){_0x58d2a7[_0x7f4e('0x18')](0xcc)[_0x7f4e('0x22')]();});}};}function handleEntityNotFound(_0x1ec5b7,_0x4db874){return function(_0x5a0354){if(!_0x5a0354){_0x1ec5b7['sendStatus'](0x194);}return _0x5a0354;};}function handleError(_0x8ddc76,_0x14abc3){_0x14abc3=_0x14abc3||0x1f4;return function(_0x3e8bc3){logger['error'](_0x3e8bc3[_0x7f4e('0x23')]);if(_0x3e8bc3[_0x7f4e('0x24')]){delete _0x3e8bc3[_0x7f4e('0x24')];}_0x8ddc76[_0x7f4e('0x18')](_0x14abc3)[_0x7f4e('0x25')](_0x3e8bc3);};}exports[_0x7f4e('0x26')]=function(_0xa65ac9,_0x6ad19d){var _0x51f4c1={},_0x3035f1={},_0x2d54d4={'count':0x0,'rows':[]};var _0x1a2016=_[_0x7f4e('0x27')](db[_0x7f4e('0x28')][_0x7f4e('0x29')],function(_0x39b6ed){return{'name':_0x39b6ed[_0x7f4e('0x2a')],'type':_0x39b6ed[_0x7f4e('0x2b')]['key']};});_0x3035f1[_0x7f4e('0x2c')]=_[_0x7f4e('0x27')](_0x1a2016,_0x7f4e('0x24'));_0x3035f1[_0x7f4e('0x2d')]=_[_0x7f4e('0x2e')](_0xa65ac9[_0x7f4e('0x2d')]);_0x3035f1[_0x7f4e('0x2f')]=_[_0x7f4e('0x30')](_0x3035f1[_0x7f4e('0x2c')],_0x3035f1[_0x7f4e('0x2d')]);_0x51f4c1[_0x7f4e('0x31')]=_['intersection'](_0x3035f1[_0x7f4e('0x2c')],qs['fields'](_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x32')]));_0x51f4c1[_0x7f4e('0x31')]=_0x51f4c1[_0x7f4e('0x31')][_0x7f4e('0x33')]?_0x51f4c1[_0x7f4e('0x31')]:_0x3035f1['model'];if(!_0xa65ac9[_0x7f4e('0x2d')]['hasOwnProperty']('nolimit')){_0x51f4c1[_0x7f4e('0x1c')]=qs['limit'](_0xa65ac9['query'][_0x7f4e('0x1c')]);_0x51f4c1[_0x7f4e('0x1b')]=qs[_0x7f4e('0x1b')](_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x1b')]);}_0x51f4c1['order']=qs[_0x7f4e('0x34')](_0xa65ac9[_0x7f4e('0x2d')]['sort']);_0x51f4c1[_0x7f4e('0x35')]=qs['filters'](_[_0x7f4e('0x36')](_0xa65ac9['query'],_0x3035f1['filters']),_0x1a2016);if(_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x37')]){_0x51f4c1[_0x7f4e('0x35')]=_[_0x7f4e('0x38')](_0x51f4c1[_0x7f4e('0x35')],{'$or':_[_0x7f4e('0x27')](_0x1a2016,function(_0x4e706e){if(_0x4e706e[_0x7f4e('0x2b')]!==_0x7f4e('0x39')){var _0x20e281={};_0x20e281[_0x4e706e[_0x7f4e('0x24')]]={'$like':'%'+_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x37')]+'%'};return _0x20e281;}})});}_0x51f4c1=_[_0x7f4e('0x38')]({},_0x51f4c1,_0xa65ac9[_0x7f4e('0x3a')]);var _0x172a9c={'where':_0x51f4c1[_0x7f4e('0x35')]};return db[_0x7f4e('0x28')]['count'](_0x172a9c)[_0x7f4e('0x21')](function(_0x512f5f){_0x2d54d4[_0x7f4e('0x1a')]=_0x512f5f;if(_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x3b')]){_0x51f4c1['include']=[{'all':!![]}];}return db[_0x7f4e('0x28')][_0x7f4e('0x3c')](_0x51f4c1);})[_0x7f4e('0x21')](function(_0x1db9a7){_0x2d54d4[_0x7f4e('0x3d')]=_0x1db9a7;return _0x2d54d4;})[_0x7f4e('0x21')](respondWithFilteredResult(_0x6ad19d,_0x51f4c1))[_0x7f4e('0x3e')](handleError(_0x6ad19d,null));};exports[_0x7f4e('0x3f')]=function(_0x4f3ffd,_0x30e33c){var _0x168a07={'raw':!![],'where':{'id':_0x4f3ffd[_0x7f4e('0x40')]['id']}},_0x347c70={};_0x347c70['model']=_[_0x7f4e('0x2e')](db[_0x7f4e('0x28')][_0x7f4e('0x29')]);_0x347c70['query']=_[_0x7f4e('0x2e')](_0x4f3ffd[_0x7f4e('0x2d')]);_0x347c70[_0x7f4e('0x2f')]=_[_0x7f4e('0x30')](_0x347c70[_0x7f4e('0x2c')],_0x347c70[_0x7f4e('0x2d')]);_0x168a07['attributes']=_[_0x7f4e('0x30')](_0x347c70['model'],qs[_0x7f4e('0x32')](_0x4f3ffd[_0x7f4e('0x2d')]['fields']));_0x168a07['attributes']=_0x168a07['attributes'][_0x7f4e('0x33')]?_0x168a07[_0x7f4e('0x31')]:_0x347c70[_0x7f4e('0x2c')];if(_0x4f3ffd[_0x7f4e('0x2d')][_0x7f4e('0x3b')]){_0x168a07[_0x7f4e('0x41')]=[{'all':!![]}];}_0x168a07=_[_0x7f4e('0x38')]({},_0x168a07,_0x4f3ffd[_0x7f4e('0x3a')]);return db[_0x7f4e('0x28')][_0x7f4e('0x42')](_0x168a07)[_0x7f4e('0x21')](handleEntityNotFound(_0x30e33c,null))[_0x7f4e('0x21')](respondWithResult(_0x30e33c,null))[_0x7f4e('0x3e')](handleError(_0x30e33c,null));};exports['create']=function(_0xc3e95b,_0x48a62f){return db[_0x7f4e('0x28')][_0x7f4e('0x43')](_0xc3e95b[_0x7f4e('0x44')],{})[_0x7f4e('0x21')](respondWithResult(_0x48a62f,0xc9))[_0x7f4e('0x3e')](handleError(_0x48a62f,null));};exports[_0x7f4e('0x20')]=function(_0x2a4be7,_0x2fc8a5){if(_0x2a4be7['body']['id']){delete _0x2a4be7['body']['id'];}return db['ZohoField']['find']({'where':{'id':_0x2a4be7[_0x7f4e('0x40')]['id']}})[_0x7f4e('0x21')](handleEntityNotFound(_0x2fc8a5,null))[_0x7f4e('0x21')](saveUpdates(_0x2a4be7[_0x7f4e('0x44')],null))[_0x7f4e('0x21')](respondWithResult(_0x2fc8a5,null))['catch'](handleError(_0x2fc8a5,null));};exports[_0x7f4e('0x45')]=function(_0x5c5c63,_0x59440c){return db[_0x7f4e('0x28')]['find']({'where':{'id':_0x5c5c63[_0x7f4e('0x40')]['id']}})['then'](handleEntityNotFound(_0x59440c,null))[_0x7f4e('0x21')](removeEntity(_0x59440c,null))[_0x7f4e('0x3e')](handleError(_0x59440c,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index ccd1bc1..a38a9ef 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd12=['moment','request-promise','path','rimraf','../../config/environment','exports','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x4d6f13,_0x45034a){var _0x2c67d8=function(_0x11092a){while(--_0x11092a){_0x4d6f13['push'](_0x4d6f13['shift']());}};_0x2c67d8(++_0x45034a);}(_0xdd12,0xe6));var _0x2dd1=function(_0x59772a,_0x3339dc){_0x59772a=_0x59772a-0x0;var _0x6f5f1b=_0xdd12[_0x59772a];return _0x6f5f1b;};'use strict';var _=require(_0x2dd1('0x0'));var util=require(_0x2dd1('0x1'));var logger=require(_0x2dd1('0x2'))(_0x2dd1('0x3'));var moment=require(_0x2dd1('0x4'));var BPromise=require('bluebird');var rp=require(_0x2dd1('0x5'));var fs=require('fs');var path=require(_0x2dd1('0x6'));var rimraf=require(_0x2dd1('0x7'));var config=require(_0x2dd1('0x8'));var attributes=require('./intZohoField.attributes');module[_0x2dd1('0x9')]=function(_0x2724cf,_0x162e47){return _0x2724cf['define']('ZohoField',attributes,{'tableName':_0x2dd1('0xa'),'paranoid':![],'indexes':[{'name':_0x2dd1('0xb'),'fields':[_0x2dd1('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe789=['exports','define','ZohoField','int_zoho_fields','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes'];(function(_0x57bbd6,_0x1a661d){var _0xff8ce0=function(_0x5dbd96){while(--_0x5dbd96){_0x57bbd6['push'](_0x57bbd6['shift']());}};_0xff8ce0(++_0x1a661d);}(_0xe789,0x147));var _0x9e78=function(_0x1a2e8e,_0x4da2a1){_0x1a2e8e=_0x1a2e8e-0x0;var _0x5a0a8c=_0xe789[_0x1a2e8e];return _0x5a0a8c;};'use strict';var _=require('lodash');var util=require(_0x9e78('0x0'));var logger=require(_0x9e78('0x1'))(_0x9e78('0x2'));var moment=require(_0x9e78('0x3'));var BPromise=require('bluebird');var rp=require(_0x9e78('0x4'));var fs=require('fs');var path=require(_0x9e78('0x5'));var rimraf=require(_0x9e78('0x6'));var config=require(_0x9e78('0x7'));var attributes=require(_0x9e78('0x8'));module[_0x9e78('0x9')]=function(_0x46701f,_0x4d0ea8){return _0x46701f[_0x9e78('0xa')](_0x9e78('0xb'),attributes,{'tableName':_0x9e78('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x9e78('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index ca137c2..3dcb552 100644 --- a/server/api/intZohoField/intZohoField.rpc.js +++ b/server/api/intZohoField/intZohoField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d0e=['info','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x50b43f,_0x369561){var _0x5981dc=function(_0x6d24ab){while(--_0x6d24ab){_0x50b43f['push'](_0x50b43f['shift']());}};_0x5981dc(++_0x369561);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x261c74,_0x524f95){_0x261c74=_0x261c74-0x0;var _0x15d23d=_0x8d0e[_0x261c74];return _0x15d23d;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('ZohoField,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('ZohoField,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});} \ No newline at end of file +var _0x7dfd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x116549,_0x210e8b){var _0x1321e5=function(_0x413542){while(--_0x413542){_0x116549['push'](_0x116549['shift']());}};_0x1321e5(++_0x210e8b);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){return client[_0xd7df('0xe')](_0x354ea7,_0x2c48a4)[_0xd7df('0xf')](function(_0x3dee59){logger['info'](_0xd7df('0x10'),_0x16e50,'request\x20sent');logger[_0xd7df('0x11')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x16e50,_0xd7df('0x12'),JSON[_0xd7df('0x13')](_0x3dee59));if(_0x3dee59[_0xd7df('0x14')]){if(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x15')]===0x1f4){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0xab6742(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0x5c220a(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}else{logger['info'](_0xd7df('0x10'),_0x16e50,_0xd7df('0x12'));_0x5c220a(_0x3dee59['result'][_0xd7df('0x16')]);}})[_0xd7df('0x17')](function(_0x5d3beb){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x5d3beb);_0xab6742(_0x5d3beb);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index fb026dc..3dabfea 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd428=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd428,0x8e));var _0x8d42=function(_0x46723a,_0x4ebe49){_0x46723a=_0x46723a-0x0;var _0x1d8846=_0xd428[_0x46723a];return _0x1d8846;};'use strict';var multer=require(_0x8d42('0x0'));var util=require('util');var path=require(_0x8d42('0x1'));var timeout=require('connect-timeout');var express=require(_0x8d42('0x2'));var router=express[_0x8d42('0x3')]();var auth=require(_0x8d42('0x4'));var interaction=require(_0x8d42('0x5'));var config=require(_0x8d42('0x6'));module[_0x8d42('0x7')]=router; \ No newline at end of file +var _0x5528=['express','Router','../../components/auth/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x4f81fb,_0x8fe9aa){var _0x35fded=function(_0x59aff8){while(--_0x59aff8){_0x4f81fb['push'](_0x4f81fb['shift']());}};_0x35fded(++_0x8fe9aa);}(_0x5528,0x8d));var _0x8552=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x5528[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x8552('0x0'));var util=require(_0x8552('0x1'));var path=require('path');var timeout=require(_0x8552('0x2'));var express=require(_0x8552('0x3'));var router=express[_0x8552('0x4')]();var auth=require(_0x8552('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8552('0x6'));module[_0x8552('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4efafd7..be68d4e 100644 --- a/server/api/integration/integration.attributes.js +++ b/server/api/integration/integration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0c3=['unique_name_and_version','STRING','app.js','BOOLEAN','state','exports'];(function(_0x5242c0,_0xdd5b40){var _0x195a40=function(_0x7878b6){while(--_0x7878b6){_0x5242c0['push'](_0x5242c0['shift']());}};_0x195a40(++_0xdd5b40);}(_0xd0c3,0x19d));var _0x3d0c=function(_0x2b5ad0,_0x3c1c04){_0x2b5ad0=_0x2b5ad0-0x0;var _0x3881d7=_0xd0c3[_0x2b5ad0];return _0x3881d7;};'use strict';var Sequelize=require('sequelize');module[_0x3d0c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3d0c('0x1')},'version':{'type':Sequelize[_0x3d0c('0x2')],'allowNull':![],'unique':_0x3d0c('0x1')},'main':{'type':Sequelize[_0x3d0c('0x2')],'defaultValue':_0x3d0c('0x3')},'filename':{'type':Sequelize[_0x3d0c('0x2')]},'path':{'type':Sequelize[_0x3d0c('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x3d0c('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x3d0c('0x2')]},'logo':{'type':Sequelize[_0x3d0c('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x3d0c('0x5')},'description':{'type':Sequelize[_0x3d0c('0x2')]},'title':{'type':Sequelize[_0x3d0c('0x2')]},'remoteUri':{'type':Sequelize[_0x3d0c('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x2d43=['state','STRING','unique_name_and_version','app.js','BOOLEAN'];(function(_0x2e785e,_0x232c0a){var _0x230f26=function(_0x55570a){while(--_0x55570a){_0x2e785e['push'](_0x2e785e['shift']());}};_0x230f26(++_0x232c0a);}(_0x2d43,0x1d2));var _0x32d4=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x2d43[_0x32f26d];return _0x5d9ddc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x32d4('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x32d4('0x0')],'allowNull':![],'unique':_0x32d4('0x1')},'main':{'type':Sequelize[_0x32d4('0x0')],'defaultValue':_0x32d4('0x2')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x32d4('0x0')]},'type':{'type':Sequelize[_0x32d4('0x0')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x32d4('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x32d4('0x0')]},'logo':{'type':Sequelize[_0x32d4('0x0')]},'state':{'type':Sequelize[_0x32d4('0x0')],'unique':_0x32d4('0x4')},'description':{'type':Sequelize[_0x32d4('0x0')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x32d4('0x0')]},'link':{'type':Sequelize[_0x32d4('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5fc6049..6f4dc4d 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e93=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','then','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','Integration','find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x207c99,_0x23f7f0){var _0x158b35=function(_0x3aff23){while(--_0x3aff23){_0x207c99['push'](_0x207c99['shift']());}};_0x158b35(++_0x23f7f0);}(_0x3e93,0x82));var _0x33e9=function(_0xf768fc,_0x7ef879){_0xf768fc=_0xf768fc-0x0;var _0x368281=_0x3e93[_0xf768fc];return _0x368281;};'use strict';var pdf=require(_0x33e9('0x0'));var emlformat=require(_0x33e9('0x1'));var rimraf=require(_0x33e9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33e9('0x3'));var rp=require(_0x33e9('0x4'));var moment=require(_0x33e9('0x5'));var BPromise=require(_0x33e9('0x6'));var Mustache=require(_0x33e9('0x7'));var util=require(_0x33e9('0x8'));var path=require('path');var sox=require(_0x33e9('0x9'));var csv=require(_0x33e9('0xa'));var ejs=require(_0x33e9('0xb'));var fs=require('fs');var _=require(_0x33e9('0xc'));var squel=require('squel');var crypto=require(_0x33e9('0xd'));var jsforce=require(_0x33e9('0xe'));var deskjs=require(_0x33e9('0xf'));var toCsv=require(_0x33e9('0xa'));var querystring=require(_0x33e9('0x10'));var Papa=require(_0x33e9('0x11'));var Redis=require('ioredis');var authService=require(_0x33e9('0x12'));var qs=require(_0x33e9('0x13'));var as=require(_0x33e9('0x14'));var hardwareService=require(_0x33e9('0x15'));var logger=require(_0x33e9('0x16'))('api');var utils=require(_0x33e9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x33e9('0x18'));var db=require(_0x33e9('0x19'))['db'];function respondWithStatusCode(_0xd1b1f1,_0x2cee09){_0x2cee09=_0x2cee09||0xcc;return function(_0xeb434f){if(_0xeb434f){return _0xd1b1f1[_0x33e9('0x1a')](_0x2cee09);}return _0xd1b1f1[_0x33e9('0x1b')](_0x2cee09)[_0x33e9('0x1c')]();};}function respondWithResult(_0x5d4830,_0x26cbbd){_0x26cbbd=_0x26cbbd||0xc8;return function(_0x1589d3){if(_0x1589d3){return _0x5d4830[_0x33e9('0x1b')](_0x26cbbd)[_0x33e9('0x1d')](_0x1589d3);}};}function respondWithFilteredResult(_0x590aee,_0x13c09b){return function(_0x1f6e98){if(_0x1f6e98){var _0x30f086=_0x1f6e98[_0x33e9('0x1e')],_0x344bff=_0x13c09b[_0x33e9('0x1f')],_0x2aeb95=_0x13c09b[_0x33e9('0x1f')]+_0x13c09b[_0x33e9('0x20')],_0x84e3fc;if(_0x2aeb95>=_0x30f086){_0x2aeb95=_0x30f086;_0x84e3fc=0xc8;}else{_0x84e3fc=0xce;}_0x590aee[_0x33e9('0x1b')](_0x84e3fc);return _0x590aee[_0x33e9('0x21')]('Content-Range',_0x344bff+'-'+_0x2aeb95+'/'+_0x30f086)[_0x33e9('0x1d')](_0x1f6e98);}return null;};}function patchUpdates(_0x4b7560){return function(_0x4826fa){try{jsonpatch[_0x33e9('0x22')](_0x4826fa,_0x4b7560,!![]);}catch(_0x579838){return BPromise['reject'](_0x579838);}return _0x4826fa['save']();};}function saveUpdates(_0x5a2805,_0x506c76){return function(_0x27b66d){if(_0x27b66d){return _0x27b66d['update'](_0x5a2805)[_0x33e9('0x23')](function(_0x48ca80){return _0x48ca80;});}return null;};}function removeEntity(_0x3319ee,_0x14aaf5){return function(_0x33b14f){if(_0x33b14f){return _0x33b14f['destroy']()[_0x33e9('0x23')](function(){_0x3319ee['status'](0xcc)[_0x33e9('0x1c')]();});}};}function handleEntityNotFound(_0x991c82,_0x512c84){return function(_0x186d2d){if(!_0x186d2d){_0x991c82[_0x33e9('0x1a')](0x194);}return _0x186d2d;};}function handleError(_0x2e2290,_0x1f9563){_0x1f9563=_0x1f9563||0x1f4;return function(_0x1a0ef6){logger[_0x33e9('0x24')](_0x1a0ef6[_0x33e9('0x25')]);if(_0x1a0ef6[_0x33e9('0x26')]){delete _0x1a0ef6[_0x33e9('0x26')];}_0x2e2290[_0x33e9('0x1b')](_0x1f9563)[_0x33e9('0x27')](_0x1a0ef6);};}exports[_0x33e9('0x28')]=function(_0xaada5b,_0x1dc0d4){var _0x572e5b={},_0x5cdbaf={},_0x565a07={'count':0x0,'rows':[]};var _0x17dc1e=_[_0x33e9('0x29')](db['Integration'][_0x33e9('0x2a')],function(_0x575baf){return{'name':_0x575baf['fieldName'],'type':_0x575baf[_0x33e9('0x2b')][_0x33e9('0x2c')]};});_0x5cdbaf[_0x33e9('0x2d')]=_['map'](_0x17dc1e,_0x33e9('0x26'));_0x5cdbaf['query']=_[_0x33e9('0x2e')](_0xaada5b[_0x33e9('0x2f')]);_0x5cdbaf['filters']=_[_0x33e9('0x30')](_0x5cdbaf[_0x33e9('0x2d')],_0x5cdbaf[_0x33e9('0x2f')]);_0x572e5b[_0x33e9('0x31')]=_[_0x33e9('0x30')](_0x5cdbaf[_0x33e9('0x2d')],qs[_0x33e9('0x32')](_0xaada5b[_0x33e9('0x2f')][_0x33e9('0x32')]));_0x572e5b[_0x33e9('0x31')]=_0x572e5b[_0x33e9('0x31')][_0x33e9('0x33')]?_0x572e5b[_0x33e9('0x31')]:_0x5cdbaf[_0x33e9('0x2d')];if(!_0xaada5b[_0x33e9('0x2f')][_0x33e9('0x34')](_0x33e9('0x35'))){_0x572e5b[_0x33e9('0x20')]=qs['limit'](_0xaada5b[_0x33e9('0x2f')]['limit']);_0x572e5b[_0x33e9('0x1f')]=qs[_0x33e9('0x1f')](_0xaada5b['query'][_0x33e9('0x1f')]);}_0x572e5b['order']=qs[_0x33e9('0x36')](_0xaada5b['query']['sort']);_0x572e5b[_0x33e9('0x37')]=qs['filters'](_[_0x33e9('0x38')](_0xaada5b['query'],_0x5cdbaf[_0x33e9('0x39')]),_0x17dc1e);if(_0xaada5b[_0x33e9('0x2f')][_0x33e9('0x3a')]){_0x572e5b[_0x33e9('0x37')]=_[_0x33e9('0x3b')](_0x572e5b[_0x33e9('0x37')],{'$or':_['map'](_0x17dc1e,function(_0x17d27d){if(_0x17d27d[_0x33e9('0x2b')]!=='VIRTUAL'){var _0xa91f0a={};_0xa91f0a[_0x17d27d['name']]={'$like':'%'+_0xaada5b[_0x33e9('0x2f')][_0x33e9('0x3a')]+'%'};return _0xa91f0a;}})});}_0x572e5b=_[_0x33e9('0x3b')]({},_0x572e5b,_0xaada5b[_0x33e9('0x3c')]);var _0x1ab9a6={'where':_0x572e5b[_0x33e9('0x37')]};return db['Integration']['count'](_0x1ab9a6)[_0x33e9('0x23')](function(_0x221c81){_0x565a07[_0x33e9('0x1e')]=_0x221c81;if(_0xaada5b[_0x33e9('0x2f')][_0x33e9('0x3d')]){_0x572e5b[_0x33e9('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x33e9('0x3f')](_0x572e5b);})['then'](function(_0x2f3c09){_0x565a07[_0x33e9('0x40')]=_0x2f3c09;return _0x565a07;})[_0x33e9('0x23')](respondWithFilteredResult(_0x1dc0d4,_0x572e5b))[_0x33e9('0x41')](handleError(_0x1dc0d4,null));};exports[_0x33e9('0x42')]=function(_0x4289a2,_0x1d3070){var _0x38565c={'raw':![],'where':{'id':_0x4289a2[_0x33e9('0x43')]['id']}},_0x557f2e={};_0x557f2e['model']=_[_0x33e9('0x2e')](db['Integration'][_0x33e9('0x2a')]);_0x557f2e[_0x33e9('0x2f')]=_[_0x33e9('0x2e')](_0x4289a2[_0x33e9('0x2f')]);_0x557f2e[_0x33e9('0x39')]=_[_0x33e9('0x30')](_0x557f2e[_0x33e9('0x2d')],_0x557f2e[_0x33e9('0x2f')]);_0x38565c[_0x33e9('0x31')]=_[_0x33e9('0x30')](_0x557f2e[_0x33e9('0x2d')],qs[_0x33e9('0x32')](_0x4289a2[_0x33e9('0x2f')]['fields']));_0x38565c[_0x33e9('0x31')]=_0x38565c[_0x33e9('0x31')][_0x33e9('0x33')]?_0x38565c[_0x33e9('0x31')]:_0x557f2e[_0x33e9('0x2d')];if(_0x4289a2[_0x33e9('0x2f')][_0x33e9('0x3d')]){_0x38565c[_0x33e9('0x3e')]=[{'all':!![]}];}_0x38565c=_['merge']({},_0x38565c,_0x4289a2[_0x33e9('0x3c')]);return db[_0x33e9('0x44')][_0x33e9('0x45')](_0x38565c)[_0x33e9('0x23')](handleEntityNotFound(_0x1d3070,null))[_0x33e9('0x23')](respondWithResult(_0x1d3070,null))[_0x33e9('0x41')](handleError(_0x1d3070,null));};exports[_0x33e9('0x46')]=function(_0x23e5ea,_0x321798){return db[_0x33e9('0x44')][_0x33e9('0x46')](_0x23e5ea[_0x33e9('0x47')],{})[_0x33e9('0x23')](respondWithResult(_0x321798,0xc9))[_0x33e9('0x41')](handleError(_0x321798,null));};exports['update']=function(_0x2e1ebd,_0xfccae9){if(_0x2e1ebd['body']['id']){delete _0x2e1ebd[_0x33e9('0x47')]['id'];}return db[_0x33e9('0x44')]['find']({'where':{'id':_0x2e1ebd[_0x33e9('0x43')]['id']}})[_0x33e9('0x23')](handleEntityNotFound(_0xfccae9,null))[_0x33e9('0x23')](saveUpdates(_0x2e1ebd[_0x33e9('0x47')],null))[_0x33e9('0x23')](respondWithResult(_0xfccae9,null))[_0x33e9('0x41')](handleError(_0xfccae9,null));};exports[_0x33e9('0x48')]=function(_0x4ae029,_0x52872a){return db[_0x33e9('0x44')][_0x33e9('0x45')]({'where':{'id':_0x4ae029[_0x33e9('0x43')]['id']}})['then'](handleEntityNotFound(_0x52872a,null))[_0x33e9('0x23')](removeEntity(_0x52872a,null))[_0x33e9('0x41')](handleError(_0x52872a,null));}; \ No newline at end of file +var _0x4e09=['attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','Integration','includeAll','include','findAll','catch','show','params','keys','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e09,0xa2));var _0x94e0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4e09[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x94e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94e0('0x2'));var rp=require(_0x94e0('0x3'));var moment=require(_0x94e0('0x4'));var BPromise=require(_0x94e0('0x5'));var Mustache=require(_0x94e0('0x6'));var util=require(_0x94e0('0x7'));var path=require(_0x94e0('0x8'));var sox=require(_0x94e0('0x9'));var csv=require(_0x94e0('0xa'));var ejs=require(_0x94e0('0xb'));var fs=require('fs');var _=require(_0x94e0('0xc'));var squel=require('squel');var crypto=require(_0x94e0('0xd'));var jsforce=require(_0x94e0('0xe'));var deskjs=require(_0x94e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x94e0('0x10'));var Papa=require(_0x94e0('0x11'));var Redis=require('ioredis');var authService=require(_0x94e0('0x12'));var qs=require(_0x94e0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x94e0('0x14'))(_0x94e0('0x15'));var utils=require(_0x94e0('0x16'));var config=require(_0x94e0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x94e0('0x18'))['db'];function respondWithStatusCode(_0x584f46,_0x314739){_0x314739=_0x314739||0xcc;return function(_0xec935e){if(_0xec935e){return _0x584f46[_0x94e0('0x19')](_0x314739);}return _0x584f46['status'](_0x314739)['end']();};}function respondWithResult(_0x147516,_0xf2675e){_0xf2675e=_0xf2675e||0xc8;return function(_0x3e7153){if(_0x3e7153){return _0x147516[_0x94e0('0x1a')](_0xf2675e)[_0x94e0('0x1b')](_0x3e7153);}};}function respondWithFilteredResult(_0x4ce86c,_0x29c0e5){return function(_0x4243fa){if(_0x4243fa){var _0x4192de=_0x4243fa[_0x94e0('0x1c')],_0x2c9eb1=_0x29c0e5[_0x94e0('0x1d')],_0x31101c=_0x29c0e5[_0x94e0('0x1d')]+_0x29c0e5[_0x94e0('0x1e')],_0x3480bb;if(_0x31101c>=_0x4192de){_0x31101c=_0x4192de;_0x3480bb=0xc8;}else{_0x3480bb=0xce;}_0x4ce86c[_0x94e0('0x1a')](_0x3480bb);return _0x4ce86c[_0x94e0('0x1f')](_0x94e0('0x20'),_0x2c9eb1+'-'+_0x31101c+'/'+_0x4192de)[_0x94e0('0x1b')](_0x4243fa);}return null;};}function patchUpdates(_0x47bedc){return function(_0x29465b){try{jsonpatch['apply'](_0x29465b,_0x47bedc,!![]);}catch(_0x227c3d){return BPromise[_0x94e0('0x21')](_0x227c3d);}return _0x29465b['save']();};}function saveUpdates(_0x44921d,_0x1d6e28){return function(_0x219469){if(_0x219469){return _0x219469[_0x94e0('0x22')](_0x44921d)['then'](function(_0x3e8be9){return _0x3e8be9;});}return null;};}function removeEntity(_0x240262,_0x3db0b4){return function(_0x915d42){if(_0x915d42){return _0x915d42[_0x94e0('0x23')]()[_0x94e0('0x24')](function(){_0x240262[_0x94e0('0x1a')](0xcc)[_0x94e0('0x25')]();});}};}function handleEntityNotFound(_0x40cf17,_0x3729ec){return function(_0x2c0b4c){if(!_0x2c0b4c){_0x40cf17[_0x94e0('0x19')](0x194);}return _0x2c0b4c;};}function handleError(_0x2aa2ae,_0x18f2e6){_0x18f2e6=_0x18f2e6||0x1f4;return function(_0x585eb6){logger['error'](_0x585eb6[_0x94e0('0x26')]);if(_0x585eb6[_0x94e0('0x27')]){delete _0x585eb6[_0x94e0('0x27')];}_0x2aa2ae[_0x94e0('0x1a')](_0x18f2e6)[_0x94e0('0x28')](_0x585eb6);};}exports[_0x94e0('0x29')]=function(_0x4135ad,_0x176a9e){var _0x14fd43={},_0x458eb3={},_0x27d4d7={'count':0x0,'rows':[]};var _0x3506df=_[_0x94e0('0x2a')](db['Integration'][_0x94e0('0x2b')],function(_0x331da1){return{'name':_0x331da1[_0x94e0('0x2c')],'type':_0x331da1[_0x94e0('0x2d')]['key']};});_0x458eb3[_0x94e0('0x2e')]=_['map'](_0x3506df,_0x94e0('0x27'));_0x458eb3['query']=_['keys'](_0x4135ad[_0x94e0('0x2f')]);_0x458eb3[_0x94e0('0x30')]=_[_0x94e0('0x31')](_0x458eb3[_0x94e0('0x2e')],_0x458eb3[_0x94e0('0x2f')]);_0x14fd43['attributes']=_[_0x94e0('0x31')](_0x458eb3['model'],qs['fields'](_0x4135ad['query'][_0x94e0('0x32')]));_0x14fd43['attributes']=_0x14fd43[_0x94e0('0x33')][_0x94e0('0x34')]?_0x14fd43[_0x94e0('0x33')]:_0x458eb3[_0x94e0('0x2e')];if(!_0x4135ad['query'][_0x94e0('0x35')]('nolimit')){_0x14fd43[_0x94e0('0x1e')]=qs[_0x94e0('0x1e')](_0x4135ad[_0x94e0('0x2f')][_0x94e0('0x1e')]);_0x14fd43[_0x94e0('0x1d')]=qs[_0x94e0('0x1d')](_0x4135ad['query']['offset']);}_0x14fd43[_0x94e0('0x36')]=qs['sort'](_0x4135ad[_0x94e0('0x2f')][_0x94e0('0x37')]);_0x14fd43[_0x94e0('0x38')]=qs[_0x94e0('0x30')](_['pick'](_0x4135ad['query'],_0x458eb3[_0x94e0('0x30')]),_0x3506df);if(_0x4135ad['query'][_0x94e0('0x39')]){_0x14fd43['where']=_[_0x94e0('0x3a')](_0x14fd43[_0x94e0('0x38')],{'$or':_[_0x94e0('0x2a')](_0x3506df,function(_0x30e43d){if(_0x30e43d[_0x94e0('0x2d')]!=='VIRTUAL'){var _0x55d337={};_0x55d337[_0x30e43d[_0x94e0('0x27')]]={'$like':'%'+_0x4135ad['query'][_0x94e0('0x39')]+'%'};return _0x55d337;}})});}_0x14fd43=_[_0x94e0('0x3a')]({},_0x14fd43,_0x4135ad[_0x94e0('0x3b')]);var _0x42726a={'where':_0x14fd43['where']};return db[_0x94e0('0x3c')]['count'](_0x42726a)[_0x94e0('0x24')](function(_0x299956){_0x27d4d7['count']=_0x299956;if(_0x4135ad[_0x94e0('0x2f')][_0x94e0('0x3d')]){_0x14fd43[_0x94e0('0x3e')]=[{'all':!![]}];}return db[_0x94e0('0x3c')][_0x94e0('0x3f')](_0x14fd43);})['then'](function(_0x1c33cf){_0x27d4d7['rows']=_0x1c33cf;return _0x27d4d7;})[_0x94e0('0x24')](respondWithFilteredResult(_0x176a9e,_0x14fd43))[_0x94e0('0x40')](handleError(_0x176a9e,null));};exports[_0x94e0('0x41')]=function(_0x4fa3e8,_0x81fbce){var _0x51b4b4={'raw':![],'where':{'id':_0x4fa3e8[_0x94e0('0x42')]['id']}},_0x50d004={};_0x50d004[_0x94e0('0x2e')]=_[_0x94e0('0x43')](db['Integration'][_0x94e0('0x2b')]);_0x50d004[_0x94e0('0x2f')]=_[_0x94e0('0x43')](_0x4fa3e8['query']);_0x50d004[_0x94e0('0x30')]=_['intersection'](_0x50d004[_0x94e0('0x2e')],_0x50d004['query']);_0x51b4b4['attributes']=_[_0x94e0('0x31')](_0x50d004[_0x94e0('0x2e')],qs[_0x94e0('0x32')](_0x4fa3e8[_0x94e0('0x2f')][_0x94e0('0x32')]));_0x51b4b4['attributes']=_0x51b4b4[_0x94e0('0x33')][_0x94e0('0x34')]?_0x51b4b4['attributes']:_0x50d004[_0x94e0('0x2e')];if(_0x4fa3e8['query'][_0x94e0('0x3d')]){_0x51b4b4[_0x94e0('0x3e')]=[{'all':!![]}];}_0x51b4b4=_['merge']({},_0x51b4b4,_0x4fa3e8[_0x94e0('0x3b')]);return db[_0x94e0('0x3c')][_0x94e0('0x44')](_0x51b4b4)[_0x94e0('0x24')](handleEntityNotFound(_0x81fbce,null))[_0x94e0('0x24')](respondWithResult(_0x81fbce,null))[_0x94e0('0x40')](handleError(_0x81fbce,null));};exports[_0x94e0('0x45')]=function(_0x271449,_0x42fcba){return db[_0x94e0('0x3c')][_0x94e0('0x45')](_0x271449['body'],{})['then'](respondWithResult(_0x42fcba,0xc9))['catch'](handleError(_0x42fcba,null));};exports[_0x94e0('0x22')]=function(_0x3dc6c8,_0x5839e1){if(_0x3dc6c8[_0x94e0('0x46')]['id']){delete _0x3dc6c8[_0x94e0('0x46')]['id'];}return db[_0x94e0('0x3c')]['find']({'where':{'id':_0x3dc6c8[_0x94e0('0x42')]['id']}})[_0x94e0('0x24')](handleEntityNotFound(_0x5839e1,null))['then'](saveUpdates(_0x3dc6c8[_0x94e0('0x46')],null))[_0x94e0('0x24')](respondWithResult(_0x5839e1,null))[_0x94e0('0x40')](handleError(_0x5839e1,null));};exports['destroy']=function(_0x458796,_0x5eeb92){return db[_0x94e0('0x3c')]['find']({'where':{'id':_0x458796[_0x94e0('0x42')]['id']}})[_0x94e0('0x24')](handleEntityNotFound(_0x5eeb92,null))['then'](removeEntity(_0x5eeb92,null))['catch'](handleError(_0x5eeb92,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6394ee2..b204058 100644 --- a/server/api/integration/integration.model.js +++ b/server/api/integration/integration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe4f=['request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','lodash','util','../../config/logger','api','bluebird'];(function(_0x2daf37,_0x53cae8){var _0x25c05f=function(_0x269a16){while(--_0x269a16){_0x2daf37['push'](_0x2daf37['shift']());}};_0x25c05f(++_0x53cae8);}(_0xbe4f,0xd7));var _0xfbe4=function(_0x400538,_0x35f197){_0x400538=_0x400538-0x0;var _0x4f1255=_0xbe4f[_0x400538];return _0x4f1255;};'use strict';var _=require(_0xfbe4('0x0'));var util=require(_0xfbe4('0x1'));var logger=require(_0xfbe4('0x2'))(_0xfbe4('0x3'));var moment=require('moment');var BPromise=require(_0xfbe4('0x4'));var rp=require(_0xfbe4('0x5'));var fs=require('fs');var path=require(_0xfbe4('0x6'));var rimraf=require(_0xfbe4('0x7'));var config=require(_0xfbe4('0x8'));var attributes=require(_0xfbe4('0x9'));module[_0xfbe4('0xa')]=function(_0x162d38,_0x604202){return _0x162d38['define']('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e08=['rimraf','./integration.attributes','exports','Integration','lodash','../../config/logger','request-promise','path'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x8e08,0x1ec));var _0x88e0=function(_0x188692,_0x23dd41){_0x188692=_0x188692-0x0;var _0x304c05=_0x8e08[_0x188692];return _0x304c05;};'use strict';var _=require(_0x88e0('0x0'));var util=require('util');var logger=require(_0x88e0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x88e0('0x2'));var fs=require('fs');var path=require(_0x88e0('0x3'));var rimraf=require(_0x88e0('0x4'));var config=require('../../config/environment');var attributes=require(_0x88e0('0x5'));module[_0x88e0('0x6')]=function(_0x42f1d5,_0x3cf559){return _0x42f1d5['define'](_0x88e0('0x7'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 35d2cc3..03286ea 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ef3=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','Integration,\x20%s,\x20%s','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1ef3,0x69));var _0x31ef=function(_0x3bd528,_0x1b3fcb){_0x3bd528=_0x3bd528-0x0;var _0x2b1d67=_0x1ef3[_0x3bd528];return _0x2b1d67;};'use strict';var _=require(_0x31ef('0x0'));var util=require(_0x31ef('0x1'));var moment=require('moment');var BPromise=require(_0x31ef('0x2'));var rs=require(_0x31ef('0x3'));var fs=require('fs');var Redis=require(_0x31ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x31ef('0x5'));var logger=require(_0x31ef('0x6'))('rpc');var config=require(_0x31ef('0x7'));var jayson=require(_0x31ef('0x8'));var client=jayson[_0x31ef('0x9')][_0x31ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x185f8c,_0x12be6a,_0x554347){return new BPromise(function(_0xf94594,_0x41c8bf){return client[_0x31ef('0xb')](_0x185f8c,_0x554347)[_0x31ef('0xc')](function(_0x526212){logger[_0x31ef('0xd')]('Integration,\x20%s,\x20%s',_0x12be6a,_0x31ef('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x12be6a,'request\x20sent',JSON[_0x31ef('0xf')](_0x526212));if(_0x526212[_0x31ef('0x10')]){if(_0x526212[_0x31ef('0x10')][_0x31ef('0x11')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x12be6a,_0x526212['error']['message']);return _0x41c8bf(_0x526212['error'][_0x31ef('0x12')]);}logger['error'](_0x31ef('0x13'),_0x12be6a,_0x526212[_0x31ef('0x10')]['message']);return _0xf94594(_0x526212[_0x31ef('0x10')][_0x31ef('0x12')]);}else{logger[_0x31ef('0xd')](_0x31ef('0x13'),_0x12be6a,_0x31ef('0xe'));_0xf94594(_0x526212[_0x31ef('0x14')]['message']);}})['catch'](function(_0x8910a9){logger['error'](_0x31ef('0x13'),_0x12be6a,_0x8910a9);_0x41c8bf(_0x8910a9);});});} \ No newline at end of file +var _0x17c4=['request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x501b67,_0x2c2917){var _0x436b9a=function(_0x4e71b4){while(--_0x4e71b4){_0x501b67['push'](_0x501b67['shift']());}};_0x436b9a(++_0x2c2917);}(_0x17c4,0x102));var _0x417c=function(_0x15070a,_0x522955){_0x15070a=_0x15070a-0x0;var _0x251d50=_0x17c4[_0x15070a];return _0x251d50;};'use strict';var _=require(_0x417c('0x0'));var util=require(_0x417c('0x1'));var moment=require(_0x417c('0x2'));var BPromise=require(_0x417c('0x3'));var rs=require(_0x417c('0x4'));var fs=require('fs');var Redis=require(_0x417c('0x5'));var db=require(_0x417c('0x6'))['db'];var utils=require(_0x417c('0x7'));var logger=require(_0x417c('0x8'))(_0x417c('0x9'));var config=require(_0x417c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x417c('0xb')][_0x417c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x340095,_0xc418d9,_0x1106df){return new BPromise(function(_0x4c6534,_0x5e75e6){return client[_0x417c('0xd')](_0x340095,_0x1106df)[_0x417c('0xe')](function(_0x36c36f){logger[_0x417c('0xf')](_0x417c('0x10'),_0xc418d9,'request\x20sent');logger[_0x417c('0x11')]('Integration,\x20%s,\x20%s,\x20%s',_0xc418d9,_0x417c('0x12'),JSON[_0x417c('0x13')](_0x36c36f));if(_0x36c36f[_0x417c('0x14')]){if(_0x36c36f[_0x417c('0x14')]['code']===0x1f4){logger['error'](_0x417c('0x10'),_0xc418d9,_0x36c36f['error']['message']);return _0x5e75e6(_0x36c36f['error'][_0x417c('0x15')]);}logger['error'](_0x417c('0x10'),_0xc418d9,_0x36c36f[_0x417c('0x14')]['message']);return _0x4c6534(_0x36c36f[_0x417c('0x14')][_0x417c('0x15')]);}else{logger[_0x417c('0xf')](_0x417c('0x10'),_0xc418d9,'request\x20sent');_0x4c6534(_0x36c36f['result'][_0x417c('0x15')]);}})[_0x417c('0x16')](function(_0x3f6058){logger['error'](_0x417c('0x10'),_0xc418d9,_0x3f6058);_0x5e75e6(_0x3f6058);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0b726f1..6b760be 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb269=['/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated'];(function(_0x2677fc,_0x4f3a54){var _0x185d7d=function(_0x1399a5){while(--_0x1399a5){_0x2677fc['push'](_0x2677fc['shift']());}};_0x185d7d(++_0x4f3a54);}(_0xb269,0x73));var _0x9b26=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb269[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x9b26('0x0'));var util=require(_0x9b26('0x1'));var path=require(_0x9b26('0x2'));var timeout=require(_0x9b26('0x3'));var express=require(_0x9b26('0x4'));var router=express[_0x9b26('0x5')]();var auth=require(_0x9b26('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9b26('0x7'));var controller=require('./integrationReport.controller');router[_0x9b26('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9b26('0x8')](_0x9b26('0x9'),auth[_0x9b26('0xa')](),controller['describe']);router[_0x9b26('0x8')](_0x9b26('0xb'),auth[_0x9b26('0xa')](),controller['show']);router[_0x9b26('0xc')]('/',auth['isAuthenticated'](),controller[_0x9b26('0xd')]);router[_0x9b26('0xe')](_0x9b26('0xb'),auth[_0x9b26('0xa')](),controller['update']);router[_0x9b26('0xf')]('/:id',auth[_0x9b26('0xa')](),controller[_0x9b26('0x10')]);module[_0x9b26('0x11')]=router; \ No newline at end of file +var _0x3451=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29d806,_0x171536){var _0x15ff58=function(_0x4dce37){while(--_0x4dce37){_0x29d806['push'](_0x29d806['shift']());}};_0x15ff58(++_0x171536);}(_0x3451,0x19a));var _0x1345=function(_0x5644a0,_0x1a9149){_0x5644a0=_0x5644a0-0x0;var _0x551843=_0x3451[_0x5644a0];return _0x551843;};'use strict';var multer=require(_0x1345('0x0'));var util=require(_0x1345('0x1'));var path=require('path');var timeout=require(_0x1345('0x2'));var express=require(_0x1345('0x3'));var router=express[_0x1345('0x4')]();var auth=require(_0x1345('0x5'));var interaction=require(_0x1345('0x6'));var config=require(_0x1345('0x7'));var controller=require(_0x1345('0x8'));router[_0x1345('0x9')]('/',auth[_0x1345('0xa')](),controller[_0x1345('0xb')]);router[_0x1345('0x9')](_0x1345('0xc'),auth['isAuthenticated'](),controller[_0x1345('0xd')]);router[_0x1345('0x9')]('/:id',auth[_0x1345('0xa')](),controller['show']);router['post']('/',auth[_0x1345('0xa')](),controller['create']);router[_0x1345('0xe')](_0x1345('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x1345('0x10')]('/:id',auth[_0x1345('0xa')](),controller[_0x1345('0x11')]);module[_0x1345('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index cf87c53..c0b7b8f 100644 --- a/server/api/integrationReport/integrationReport.attributes.js +++ b/server/api/integrationReport/integrationReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8c=['TEXT','ENUM','SENT','SENDING','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x5f4f5d,_0x483c91){var _0x366ed7=function(_0x4e8356){while(--_0x4e8356){_0x5f4f5d['push'](_0x5f4f5d['shift']());}};_0x366ed7(++_0x483c91);}(_0x8b8c,0x1a2));var _0xc8b8=function(_0x202e2b,_0x26630b){_0x202e2b=_0x202e2b-0x0;var _0x7f9889=_0x8b8c[_0x202e2b];return _0x7f9889;};'use strict';var Sequelize=require('sequelize');module[_0xc8b8('0x0')]={'integration':{'type':Sequelize[_0xc8b8('0x1')]},'eventChannel':{'type':Sequelize[_0xc8b8('0x1')]},'exitStatus':{'type':Sequelize[_0xc8b8('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xc8b8('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc8b8('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc8b8('0x1')]},'interface':{'type':Sequelize[_0xc8b8('0x1')]},'membername':{'type':Sequelize[_0xc8b8('0x1')]},'agentcalledAt':{'type':Sequelize[_0xc8b8('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc8b8('0x3')]},'holdtime':{'type':Sequelize[_0xc8b8('0x2')]},'agentcomplete':{'type':Sequelize[_0xc8b8('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc8b8('0x3')]},'talktime':{'type':Sequelize[_0xc8b8('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc8b8('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xc8b8('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xc8b8('0x1')]},'channel':{'type':Sequelize[_0xc8b8('0x1')]},'channelstate':{'type':Sequelize[_0xc8b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc8b8('0x1')]},'language':{'type':Sequelize[_0xc8b8('0x1')]},'accountcode':{'type':Sequelize[_0xc8b8('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc8b8('0x1')]},'priority':{'type':Sequelize[_0xc8b8('0x1')]},'destchannel':{'type':Sequelize[_0xc8b8('0x1')]},'destchannelstate':{'type':Sequelize[_0xc8b8('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc8b8('0x1')]},'destcalleridname':{'type':Sequelize[_0xc8b8('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xc8b8('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xc8b8('0x1')]},'destlanguage':{'type':Sequelize[_0xc8b8('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc8b8('0x1')]},'destexten':{'type':Sequelize[_0xc8b8('0x1')]},'destpriority':{'type':Sequelize[_0xc8b8('0x1')]},'destuniqueid':{'type':Sequelize[_0xc8b8('0x1')]},'messageId':{'type':Sequelize[_0xc8b8('0x1')]},'inReplyTo':{'type':Sequelize[_0xc8b8('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xc8b8('0x1')]},'to':{'type':Sequelize[_0xc8b8('0x1')]},'cc':{'type':Sequelize[_0xc8b8('0x1')]},'attachment':{'type':Sequelize[_0xc8b8('0x5')]},'html':{'type':Sequelize[_0xc8b8('0x5')]},'text':{'type':Sequelize[_0xc8b8('0x5')]},'status':{'type':Sequelize[_0xc8b8('0x6')](_0xc8b8('0x7'),_0xc8b8('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xc8b8('0x1')]},'appdata':{'type':Sequelize[_0xc8b8('0x1')]},'projectId':{'type':Sequelize[_0xc8b8('0x2')]}}; \ No newline at end of file +var _0xd290=['TEXT','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x4f79ca,_0x3f86b9){var _0x352e43=function(_0x526a7b){while(--_0x526a7b){_0x4f79ca['push'](_0x4f79ca['shift']());}};_0x352e43(++_0x3f86b9);}(_0xd290,0x126));var _0x0d29=function(_0x4ded9e,_0x40f5f1){_0x4ded9e=_0x4ded9e-0x0;var _0x5e06ae=_0xd290[_0x4ded9e];return _0x5e06ae;};'use strict';var Sequelize=require(_0x0d29('0x0'));module[_0x0d29('0x1')]={'integration':{'type':Sequelize[_0x0d29('0x2')]},'eventChannel':{'type':Sequelize[_0x0d29('0x2')]},'exitStatus':{'type':Sequelize[_0x0d29('0x2')]},'ticketId':{'type':Sequelize[_0x0d29('0x2')]},'integrationId':{'type':Sequelize[_0x0d29('0x3')]},'contacts':{'type':Sequelize[_0x0d29('0x2')]},'uniqueid':{'type':Sequelize[_0x0d29('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0d29('0x2')]},'queue':{'type':Sequelize[_0x0d29('0x2')]},'interface':{'type':Sequelize[_0x0d29('0x2')]},'membername':{'type':Sequelize[_0x0d29('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0d29('0x4')]},'agentconnectAt':{'type':Sequelize[_0x0d29('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0d29('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0d29('0x4')]},'talktime':{'type':Sequelize[_0x0d29('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0d29('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x0d29('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0d29('0x4')]},'agentdump':{'type':Sequelize[_0x0d29('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x0d29('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x0d29('0x3')]},'channelstatedesc':{'type':Sequelize[_0x0d29('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0d29('0x2')]},'connectedlinename':{'type':Sequelize[_0x0d29('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0d29('0x2')]},'exten':{'type':Sequelize[_0x0d29('0x2')]},'priority':{'type':Sequelize[_0x0d29('0x2')]},'destchannel':{'type':Sequelize[_0x0d29('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x0d29('0x2')]},'destcalleridname':{'type':Sequelize[_0x0d29('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x0d29('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x0d29('0x2')]},'destaccountcode':{'type':Sequelize[_0x0d29('0x2')]},'destcontext':{'type':Sequelize[_0x0d29('0x2')]},'destexten':{'type':Sequelize[_0x0d29('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x0d29('0x2')]},'messageId':{'type':Sequelize[_0x0d29('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x0d29('0x2')]},'from':{'type':Sequelize[_0x0d29('0x2')]},'to':{'type':Sequelize[_0x0d29('0x2')]},'cc':{'type':Sequelize[_0x0d29('0x2')]},'attachment':{'type':Sequelize[_0x0d29('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x0d29('0x7'),_0x0d29('0x8'),'RECEIVED',_0x0d29('0x9'))},'url':{'type':Sequelize[_0x0d29('0x2')]},'app':{'type':Sequelize[_0x0d29('0x2')]},'appdata':{'type':Sequelize[_0x0d29('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a8ca34f..ad22c9f 100644 --- a/server/api/integrationReport/integrationReport.controller.js +++ b/server/api/integrationReport/integrationReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb187=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x15ea02,_0x4fefa8){var _0x1c01d8=function(_0x401605){while(--_0x401605){_0x15ea02['push'](_0x15ea02['shift']());}};_0x1c01d8(++_0x4fefa8);}(_0xb187,0x113));var _0x7b18=function(_0x596c43,_0x28647a){_0x596c43=_0x596c43-0x0;var _0x4e1315=_0xb187[_0x596c43];return _0x4e1315;};'use strict';var pdf=require(_0x7b18('0x0'));var emlformat=require(_0x7b18('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7b18('0x2'));var jsonpatch=require(_0x7b18('0x3'));var rp=require(_0x7b18('0x4'));var moment=require('moment');var BPromise=require(_0x7b18('0x5'));var Mustache=require(_0x7b18('0x6'));var util=require(_0x7b18('0x7'));var path=require(_0x7b18('0x8'));var sox=require(_0x7b18('0x9'));var csv=require('to-csv');var ejs=require(_0x7b18('0xa'));var fs=require('fs');var _=require(_0x7b18('0xb'));var squel=require(_0x7b18('0xc'));var crypto=require('crypto');var jsforce=require(_0x7b18('0xd'));var deskjs=require(_0x7b18('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b18('0xf'));var Papa=require(_0x7b18('0x10'));var Redis=require(_0x7b18('0x11'));var authService=require(_0x7b18('0x12'));var qs=require(_0x7b18('0x13'));var as=require(_0x7b18('0x14'));var hardwareService=require(_0x7b18('0x15'));var logger=require(_0x7b18('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7b18('0x17'));var licenseUtil=require(_0x7b18('0x18'));var db=require(_0x7b18('0x19'))['db'];function respondWithStatusCode(_0x191476,_0x2ff2d8){_0x2ff2d8=_0x2ff2d8||0xcc;return function(_0xddee26){if(_0xddee26){return _0x191476[_0x7b18('0x1a')](_0x2ff2d8);}return _0x191476[_0x7b18('0x1b')](_0x2ff2d8)[_0x7b18('0x1c')]();};}function respondWithResult(_0x5ae9b0,_0x5bc5d9){_0x5bc5d9=_0x5bc5d9||0xc8;return function(_0x59dab3){if(_0x59dab3){return _0x5ae9b0[_0x7b18('0x1b')](_0x5bc5d9)[_0x7b18('0x1d')](_0x59dab3);}};}function respondWithFilteredResult(_0x466835,_0x4f2152){return function(_0x58928f){if(_0x58928f){var _0x1d565d=_0x58928f[_0x7b18('0x1e')],_0x5345de=_0x4f2152['offset'],_0x31ec8c=_0x4f2152[_0x7b18('0x1f')]+_0x4f2152[_0x7b18('0x20')],_0x541578;if(_0x31ec8c>=_0x1d565d){_0x31ec8c=_0x1d565d;_0x541578=0xc8;}else{_0x541578=0xce;}_0x466835[_0x7b18('0x1b')](_0x541578);return _0x466835[_0x7b18('0x21')]('Content-Range',_0x5345de+'-'+_0x31ec8c+'/'+_0x1d565d)['json'](_0x58928f);}return null;};}function patchUpdates(_0x54ac13){return function(_0x58bcb2){try{jsonpatch['apply'](_0x58bcb2,_0x54ac13,!![]);}catch(_0x239fab){return BPromise[_0x7b18('0x22')](_0x239fab);}return _0x58bcb2[_0x7b18('0x23')]();};}function saveUpdates(_0x535fd3,_0x1c0bff){return function(_0x42a6aa){if(_0x42a6aa){return _0x42a6aa[_0x7b18('0x24')](_0x535fd3)[_0x7b18('0x25')](function(_0x4d9a8d){return _0x4d9a8d;});}return null;};}function removeEntity(_0x27acd2,_0x4e7882){return function(_0x1f263c){if(_0x1f263c){return _0x1f263c[_0x7b18('0x26')]()['then'](function(){_0x27acd2[_0x7b18('0x1b')](0xcc)[_0x7b18('0x1c')]();});}};}function handleEntityNotFound(_0x3c9c7b,_0x175b48){return function(_0x2fc00b){if(!_0x2fc00b){_0x3c9c7b[_0x7b18('0x1a')](0x194);}return _0x2fc00b;};}function handleError(_0x41b8c8,_0x1ddc3a){_0x1ddc3a=_0x1ddc3a||0x1f4;return function(_0xf47a3d){logger[_0x7b18('0x27')](_0xf47a3d[_0x7b18('0x28')]);if(_0xf47a3d[_0x7b18('0x29')]){delete _0xf47a3d[_0x7b18('0x29')];}_0x41b8c8['status'](_0x1ddc3a)[_0x7b18('0x2a')](_0xf47a3d);};}exports[_0x7b18('0x2b')]=function(_0x1651cb,_0x13c61b){var _0x3454a6={},_0x1508a5={},_0x23aaca={'count':0x0,'rows':[]};var _0x1170a8=_[_0x7b18('0x2c')](db[_0x7b18('0x2d')][_0x7b18('0x2e')],function(_0xf35309){return{'name':_0xf35309[_0x7b18('0x2f')],'type':_0xf35309[_0x7b18('0x30')]['key']};});_0x1508a5[_0x7b18('0x31')]=_['map'](_0x1170a8,_0x7b18('0x29'));_0x1508a5['query']=_[_0x7b18('0x32')](_0x1651cb['query']);_0x1508a5[_0x7b18('0x33')]=_[_0x7b18('0x34')](_0x1508a5[_0x7b18('0x31')],_0x1508a5[_0x7b18('0x35')]);_0x3454a6[_0x7b18('0x36')]=_['intersection'](_0x1508a5[_0x7b18('0x31')],qs[_0x7b18('0x37')](_0x1651cb['query'][_0x7b18('0x37')]));_0x3454a6[_0x7b18('0x36')]=_0x3454a6[_0x7b18('0x36')][_0x7b18('0x38')]?_0x3454a6[_0x7b18('0x36')]:_0x1508a5[_0x7b18('0x31')];if(!_0x1651cb['query']['hasOwnProperty']('nolimit')){_0x3454a6[_0x7b18('0x20')]=qs[_0x7b18('0x20')](_0x1651cb[_0x7b18('0x35')][_0x7b18('0x20')]);_0x3454a6['offset']=qs[_0x7b18('0x1f')](_0x1651cb[_0x7b18('0x35')]['offset']);}_0x3454a6[_0x7b18('0x39')]=qs[_0x7b18('0x3a')](_0x1651cb[_0x7b18('0x35')][_0x7b18('0x3a')]);_0x3454a6[_0x7b18('0x3b')]=qs[_0x7b18('0x33')](_['pick'](_0x1651cb[_0x7b18('0x35')],_0x1508a5['filters']),_0x1170a8);if(_0x1651cb[_0x7b18('0x35')][_0x7b18('0x3c')]){_0x3454a6['where']=_[_0x7b18('0x3d')](_0x3454a6[_0x7b18('0x3b')],{'$or':_[_0x7b18('0x2c')](_0x1170a8,function(_0x5b555e){if(_0x5b555e[_0x7b18('0x30')]!==_0x7b18('0x3e')){var _0x459515={};_0x459515[_0x5b555e['name']]={'$like':'%'+_0x1651cb[_0x7b18('0x35')][_0x7b18('0x3c')]+'%'};return _0x459515;}})});}_0x3454a6=_[_0x7b18('0x3d')]({},_0x3454a6,_0x1651cb[_0x7b18('0x3f')]);var _0x431179={'where':_0x3454a6[_0x7b18('0x3b')]};return db[_0x7b18('0x2d')][_0x7b18('0x1e')](_0x431179)[_0x7b18('0x25')](function(_0x319861){_0x23aaca[_0x7b18('0x1e')]=_0x319861;if(_0x1651cb[_0x7b18('0x35')][_0x7b18('0x40')]){_0x3454a6['include']=[{'all':!![]}];}return db[_0x7b18('0x2d')][_0x7b18('0x41')](_0x3454a6);})[_0x7b18('0x25')](function(_0x3b9575){_0x23aaca['rows']=_0x3b9575;return _0x23aaca;})[_0x7b18('0x25')](respondWithFilteredResult(_0x13c61b,_0x3454a6))[_0x7b18('0x42')](handleError(_0x13c61b,null));};exports[_0x7b18('0x43')]=function(_0x3b7675,_0x243b8e){var _0x34d195={'raw':![],'where':{'id':_0x3b7675[_0x7b18('0x44')]['id']}},_0x145163={};_0x145163[_0x7b18('0x31')]=_[_0x7b18('0x32')](db[_0x7b18('0x2d')][_0x7b18('0x2e')]);_0x145163[_0x7b18('0x35')]=_[_0x7b18('0x32')](_0x3b7675[_0x7b18('0x35')]);_0x145163[_0x7b18('0x33')]=_['intersection'](_0x145163[_0x7b18('0x31')],_0x145163[_0x7b18('0x35')]);_0x34d195[_0x7b18('0x36')]=_[_0x7b18('0x34')](_0x145163['model'],qs[_0x7b18('0x37')](_0x3b7675[_0x7b18('0x35')][_0x7b18('0x37')]));_0x34d195[_0x7b18('0x36')]=_0x34d195[_0x7b18('0x36')][_0x7b18('0x38')]?_0x34d195['attributes']:_0x145163[_0x7b18('0x31')];if(_0x3b7675[_0x7b18('0x35')]['includeAll']){_0x34d195['include']=[{'all':!![]}];}_0x34d195=_['merge']({},_0x34d195,_0x3b7675['options']);return db[_0x7b18('0x2d')][_0x7b18('0x45')](_0x34d195)[_0x7b18('0x25')](handleEntityNotFound(_0x243b8e,null))[_0x7b18('0x25')](respondWithResult(_0x243b8e,null))[_0x7b18('0x42')](handleError(_0x243b8e,null));};exports[_0x7b18('0x46')]=function(_0x35acc7,_0x5687ab){return db[_0x7b18('0x2d')][_0x7b18('0x46')](_0x35acc7[_0x7b18('0x47')],{})[_0x7b18('0x25')](respondWithResult(_0x5687ab,0xc9))[_0x7b18('0x42')](handleError(_0x5687ab,null));};exports['update']=function(_0x5080f0,_0x493421){if(_0x5080f0[_0x7b18('0x47')]['id']){delete _0x5080f0[_0x7b18('0x47')]['id'];}return db[_0x7b18('0x2d')][_0x7b18('0x45')]({'where':{'id':_0x5080f0[_0x7b18('0x44')]['id']}})['then'](handleEntityNotFound(_0x493421,null))[_0x7b18('0x25')](saveUpdates(_0x5080f0['body'],null))[_0x7b18('0x25')](respondWithResult(_0x493421,null))[_0x7b18('0x42')](handleError(_0x493421,null));};exports[_0x7b18('0x26')]=function(_0x28bd9e,_0x3ad7b9){return db[_0x7b18('0x2d')][_0x7b18('0x45')]({'where':{'id':_0x28bd9e[_0x7b18('0x44')]['id']}})[_0x7b18('0x25')](handleEntityNotFound(_0x3ad7b9,null))[_0x7b18('0x25')](removeEntity(_0x3ad7b9,null))[_0x7b18('0x42')](handleError(_0x3ad7b9,null));};exports[_0x7b18('0x48')]=function(_0x2cd84b,_0x321d95){return db[_0x7b18('0x2d')][_0x7b18('0x48')]()[_0x7b18('0x25')](respondWithResult(_0x321d95,null))[_0x7b18('0x42')](handleError(_0x321d95,null));}; \ No newline at end of file +var _0xc908=['apply','update','then','destroy','sendStatus','error','name','send','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','map','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','Content-Range'];(function(_0x2bd364,_0x524650){var _0x34a685=function(_0xefe95c){while(--_0xefe95c){_0x2bd364['push'](_0x2bd364['shift']());}};_0x34a685(++_0x524650);}(_0xc908,0x110));var _0x8c90=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc908[_0x45d55e];return _0x29812a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8c90('0x0'));var zipdir=require(_0x8c90('0x1'));var jsonpatch=require(_0x8c90('0x2'));var rp=require(_0x8c90('0x3'));var moment=require(_0x8c90('0x4'));var BPromise=require(_0x8c90('0x5'));var Mustache=require(_0x8c90('0x6'));var util=require(_0x8c90('0x7'));var path=require(_0x8c90('0x8'));var sox=require(_0x8c90('0x9'));var csv=require(_0x8c90('0xa'));var ejs=require(_0x8c90('0xb'));var fs=require('fs');var _=require(_0x8c90('0xc'));var squel=require('squel');var crypto=require(_0x8c90('0xd'));var jsforce=require(_0x8c90('0xe'));var deskjs=require(_0x8c90('0xf'));var toCsv=require(_0x8c90('0xa'));var querystring=require(_0x8c90('0x10'));var Papa=require(_0x8c90('0x11'));var Redis=require(_0x8c90('0x12'));var authService=require(_0x8c90('0x13'));var qs=require(_0x8c90('0x14'));var as=require(_0x8c90('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c90('0x16'))(_0x8c90('0x17'));var utils=require(_0x8c90('0x18'));var config=require(_0x8c90('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c90('0x1a'))['db'];function respondWithStatusCode(_0x252392,_0x502042){_0x502042=_0x502042||0xcc;return function(_0x3c949e){if(_0x3c949e){return _0x252392['sendStatus'](_0x502042);}return _0x252392['status'](_0x502042)[_0x8c90('0x1b')]();};}function respondWithResult(_0x46373f,_0x4de54e){_0x4de54e=_0x4de54e||0xc8;return function(_0x42b7b0){if(_0x42b7b0){return _0x46373f[_0x8c90('0x1c')](_0x4de54e)[_0x8c90('0x1d')](_0x42b7b0);}};}function respondWithFilteredResult(_0x152ca1,_0x95c4b){return function(_0x2fd0ff){if(_0x2fd0ff){var _0x2f46fb=_0x2fd0ff['count'],_0x385a68=_0x95c4b[_0x8c90('0x1e')],_0x1558db=_0x95c4b['offset']+_0x95c4b['limit'],_0x58f5c0;if(_0x1558db>=_0x2f46fb){_0x1558db=_0x2f46fb;_0x58f5c0=0xc8;}else{_0x58f5c0=0xce;}_0x152ca1[_0x8c90('0x1c')](_0x58f5c0);return _0x152ca1['set'](_0x8c90('0x1f'),_0x385a68+'-'+_0x1558db+'/'+_0x2f46fb)[_0x8c90('0x1d')](_0x2fd0ff);}return null;};}function patchUpdates(_0x4b06c2){return function(_0x424655){try{jsonpatch[_0x8c90('0x20')](_0x424655,_0x4b06c2,!![]);}catch(_0x558930){return BPromise['reject'](_0x558930);}return _0x424655['save']();};}function saveUpdates(_0x179bb1,_0x55a2ed){return function(_0xbaa1ef){if(_0xbaa1ef){return _0xbaa1ef[_0x8c90('0x21')](_0x179bb1)[_0x8c90('0x22')](function(_0x2e724a){return _0x2e724a;});}return null;};}function removeEntity(_0x15ccc0,_0x2b9f7b){return function(_0x44742a){if(_0x44742a){return _0x44742a[_0x8c90('0x23')]()[_0x8c90('0x22')](function(){_0x15ccc0[_0x8c90('0x1c')](0xcc)[_0x8c90('0x1b')]();});}};}function handleEntityNotFound(_0x2851a1,_0x2e67a4){return function(_0x191817){if(!_0x191817){_0x2851a1[_0x8c90('0x24')](0x194);}return _0x191817;};}function handleError(_0x1d3842,_0x1fdbd9){_0x1fdbd9=_0x1fdbd9||0x1f4;return function(_0x30fcf2){logger[_0x8c90('0x25')](_0x30fcf2['stack']);if(_0x30fcf2['name']){delete _0x30fcf2[_0x8c90('0x26')];}_0x1d3842[_0x8c90('0x1c')](_0x1fdbd9)[_0x8c90('0x27')](_0x30fcf2);};}exports['index']=function(_0x2ee9e4,_0x2be256){var _0x4a5011={},_0x53dfa0={},_0x2ff0e7={'count':0x0,'rows':[]};var _0x211541=_['map'](db[_0x8c90('0x28')][_0x8c90('0x29')],function(_0x47e85f){return{'name':_0x47e85f[_0x8c90('0x2a')],'type':_0x47e85f['type'][_0x8c90('0x2b')]};});_0x53dfa0[_0x8c90('0x2c')]=_['map'](_0x211541,_0x8c90('0x26'));_0x53dfa0[_0x8c90('0x2d')]=_[_0x8c90('0x2e')](_0x2ee9e4[_0x8c90('0x2d')]);_0x53dfa0['filters']=_[_0x8c90('0x2f')](_0x53dfa0[_0x8c90('0x2c')],_0x53dfa0[_0x8c90('0x2d')]);_0x4a5011[_0x8c90('0x30')]=_[_0x8c90('0x2f')](_0x53dfa0[_0x8c90('0x2c')],qs[_0x8c90('0x31')](_0x2ee9e4['query'][_0x8c90('0x31')]));_0x4a5011[_0x8c90('0x30')]=_0x4a5011[_0x8c90('0x30')][_0x8c90('0x32')]?_0x4a5011[_0x8c90('0x30')]:_0x53dfa0[_0x8c90('0x2c')];if(!_0x2ee9e4[_0x8c90('0x2d')][_0x8c90('0x33')](_0x8c90('0x34'))){_0x4a5011['limit']=qs[_0x8c90('0x35')](_0x2ee9e4['query'][_0x8c90('0x35')]);_0x4a5011[_0x8c90('0x1e')]=qs[_0x8c90('0x1e')](_0x2ee9e4['query'][_0x8c90('0x1e')]);}_0x4a5011[_0x8c90('0x36')]=qs[_0x8c90('0x37')](_0x2ee9e4['query']['sort']);_0x4a5011['where']=qs[_0x8c90('0x38')](_[_0x8c90('0x39')](_0x2ee9e4[_0x8c90('0x2d')],_0x53dfa0[_0x8c90('0x38')]),_0x211541);if(_0x2ee9e4[_0x8c90('0x2d')][_0x8c90('0x3a')]){_0x4a5011[_0x8c90('0x3b')]=_[_0x8c90('0x3c')](_0x4a5011['where'],{'$or':_[_0x8c90('0x3d')](_0x211541,function(_0x2407e8){if(_0x2407e8[_0x8c90('0x3e')]!==_0x8c90('0x3f')){var _0x41de8e={};_0x41de8e[_0x2407e8[_0x8c90('0x26')]]={'$like':'%'+_0x2ee9e4['query'][_0x8c90('0x3a')]+'%'};return _0x41de8e;}})});}_0x4a5011=_[_0x8c90('0x3c')]({},_0x4a5011,_0x2ee9e4['options']);var _0x4eef68={'where':_0x4a5011[_0x8c90('0x3b')]};return db['IntegrationReport'][_0x8c90('0x40')](_0x4eef68)['then'](function(_0x4aa46a){_0x2ff0e7[_0x8c90('0x40')]=_0x4aa46a;if(_0x2ee9e4[_0x8c90('0x2d')][_0x8c90('0x41')]){_0x4a5011[_0x8c90('0x42')]=[{'all':!![]}];}return db[_0x8c90('0x28')][_0x8c90('0x43')](_0x4a5011);})[_0x8c90('0x22')](function(_0x4617f5){_0x2ff0e7[_0x8c90('0x44')]=_0x4617f5;return _0x2ff0e7;})['then'](respondWithFilteredResult(_0x2be256,_0x4a5011))[_0x8c90('0x45')](handleError(_0x2be256,null));};exports['show']=function(_0x4ab084,_0x7187a1){var _0x31803e={'raw':![],'where':{'id':_0x4ab084[_0x8c90('0x46')]['id']}},_0x4665db={};_0x4665db[_0x8c90('0x2c')]=_[_0x8c90('0x2e')](db[_0x8c90('0x28')]['rawAttributes']);_0x4665db[_0x8c90('0x2d')]=_[_0x8c90('0x2e')](_0x4ab084[_0x8c90('0x2d')]);_0x4665db['filters']=_[_0x8c90('0x2f')](_0x4665db[_0x8c90('0x2c')],_0x4665db[_0x8c90('0x2d')]);_0x31803e[_0x8c90('0x30')]=_[_0x8c90('0x2f')](_0x4665db[_0x8c90('0x2c')],qs['fields'](_0x4ab084[_0x8c90('0x2d')][_0x8c90('0x31')]));_0x31803e['attributes']=_0x31803e['attributes'][_0x8c90('0x32')]?_0x31803e[_0x8c90('0x30')]:_0x4665db[_0x8c90('0x2c')];if(_0x4ab084[_0x8c90('0x2d')]['includeAll']){_0x31803e[_0x8c90('0x42')]=[{'all':!![]}];}_0x31803e=_[_0x8c90('0x3c')]({},_0x31803e,_0x4ab084[_0x8c90('0x47')]);return db[_0x8c90('0x28')][_0x8c90('0x48')](_0x31803e)[_0x8c90('0x22')](handleEntityNotFound(_0x7187a1,null))[_0x8c90('0x22')](respondWithResult(_0x7187a1,null))[_0x8c90('0x45')](handleError(_0x7187a1,null));};exports[_0x8c90('0x49')]=function(_0x5c2f74,_0x39261d){return db[_0x8c90('0x28')]['create'](_0x5c2f74[_0x8c90('0x4a')],{})[_0x8c90('0x22')](respondWithResult(_0x39261d,0xc9))[_0x8c90('0x45')](handleError(_0x39261d,null));};exports[_0x8c90('0x21')]=function(_0x4a0b05,_0x1fc747){if(_0x4a0b05[_0x8c90('0x4a')]['id']){delete _0x4a0b05['body']['id'];}return db[_0x8c90('0x28')]['find']({'where':{'id':_0x4a0b05[_0x8c90('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fc747,null))[_0x8c90('0x22')](saveUpdates(_0x4a0b05[_0x8c90('0x4a')],null))[_0x8c90('0x22')](respondWithResult(_0x1fc747,null))[_0x8c90('0x45')](handleError(_0x1fc747,null));};exports['destroy']=function(_0x37c9ca,_0x1fb7e0){return db[_0x8c90('0x28')][_0x8c90('0x48')]({'where':{'id':_0x37c9ca['params']['id']}})[_0x8c90('0x22')](handleEntityNotFound(_0x1fb7e0,null))[_0x8c90('0x22')](removeEntity(_0x1fb7e0,null))[_0x8c90('0x45')](handleError(_0x1fb7e0,null));};exports[_0x8c90('0x4b')]=function(_0x5115ba,_0x379131){return db['IntegrationReport'][_0x8c90('0x4b')]()['then'](respondWithResult(_0x379131,null))[_0x8c90('0x45')](handleError(_0x379131,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 09b4362..972fd22 100644 --- a/server/api/integrationReport/integrationReport.model.js +++ b/server/api/integrationReport/integrationReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dc6=['exports','report_integration','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7dc6,0x1ba));var _0x67dc=function(_0x15dad4,_0xe0ec9a){_0x15dad4=_0x15dad4-0x0;var _0x4208e2=_0x7dc6[_0x15dad4];return _0x4208e2;};'use strict';var _=require(_0x67dc('0x0'));var util=require(_0x67dc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x67dc('0x2'));var BPromise=require(_0x67dc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67dc('0x4'));var rimraf=require(_0x67dc('0x5'));var config=require(_0x67dc('0x6'));var attributes=require(_0x67dc('0x7'));module[_0x67dc('0x8')]=function(_0x4e3cec,_0x4dfb46){return _0x4e3cec['define']('IntegrationReport',attributes,{'tableName':_0x67dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3af=['../../config/environment','./integrationReport.attributes','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','request-promise'];(function(_0xa53897,_0x5395d4){var _0xc16163=function(_0x33d297){while(--_0x33d297){_0xa53897['push'](_0xa53897['shift']());}};_0xc16163(++_0x5395d4);}(_0xd3af,0xc1));var _0xfd3a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd3af[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xfd3a('0x0'));var util=require('util');var logger=require(_0xfd3a('0x1'))(_0xfd3a('0x2'));var moment=require(_0xfd3a('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfd3a('0x5'));var attributes=require(_0xfd3a('0x6'));module['exports']=function(_0x23831b,_0x1dc3e0){return _0x23831b['define'](_0xfd3a('0x7'),attributes,{'tableName':_0xfd3a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 2fb7801..86ea337 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x133f69,_0x2d4632){var _0x3b67bb=function(_0x203583){while(--_0x203583){_0x133f69['push'](_0x133f69['shift']());}};_0x3b67bb(++_0x2d4632);}(_0x14a0,0x8e));var _0x014a=function(_0x1a595e,_0xf708a6){_0x1a595e=_0x1a595e-0x0;var _0xe069b5=_0x14a0[_0x1a595e];return _0xe069b5;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x5d87bb,_0x2a7167){var _0x3d9eee=function(_0x58393e){while(--_0x58393e){_0x5d87bb['push'](_0x5d87bb['shift']());}};_0x3d9eee(++_0x2a7167);}(_0x2032,0xd9));var _0x2203=function(_0x2410bc,_0x5d3649){_0x2410bc=_0x2410bc-0x0;var _0x3f5d6c=_0x2032[_0x2410bc];return _0x3f5d6c;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d95b972..17a3ecc 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5bae94,_0x5c0be1){var _0x40191b=function(_0x2cc9c6){while(--_0x2cc9c6){_0x5bae94['push'](_0x5bae94['shift']());}};_0x40191b(++_0x5c0be1);}(_0x34e8,0x12c));var _0x834e=function(_0x471195,_0x277901){_0x471195=_0x471195-0x0;var _0x370bfd=_0x34e8[_0x471195];return _0x370bfd;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x55ca,0x126));var _0xa55c=function(_0x4a30f1,_0x2e75a8){_0x4a30f1=_0x4a30f1-0x0;var _0x1e0a09=_0x55ca[_0x4a30f1];return _0x1e0a09;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 7a6dc0f..c1ba3d8 100644 --- a/server/api/interval/interval.attributes.js +++ b/server/api/interval/interval.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x121c=['STRING'];(function(_0x4eb97c,_0x26f7c4){var _0x9a7dbe=function(_0x14806e){while(--_0x14806e){_0x4eb97c['push'](_0x4eb97c['shift']());}};_0x9a7dbe(++_0x26f7c4);}(_0x121c,0x95));var _0xc121=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x121c[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc121('0x0')]},'description':{'type':Sequelize[_0xc121('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xf286=['STRING','sequelize','exports'];(function(_0x1dee1c,_0xa1cadb){var _0x16ac88=function(_0x46b1e2){while(--_0x46b1e2){_0x1dee1c['push'](_0x1dee1c['shift']());}};_0x16ac88(++_0xa1cadb);}(_0xf286,0x166));var _0x6f28=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xf286[_0x3f3f40];return _0x403b7a;};'use strict';var Sequelize=require(_0x6f28('0x0'));module[_0x6f28('0x1')]={'name':{'type':Sequelize[_0x6f28('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c707c62..6d92c6a 100644 --- a/server/api/interval/interval.controller.js +++ b/server/api/interval/interval.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa888=['getIntervals','addIntervals','sequelize','transaction','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','sort'];(function(_0x4136b7,_0x5afdab){var _0xc0373=function(_0x32ba5f){while(--_0x32ba5f){_0x4136b7['push'](_0x4136b7['shift']());}};_0xc0373(++_0x5afdab);}(_0xa888,0xc0));var _0x8a88=function(_0x1416ba,_0xd7bfec){_0x1416ba=_0x1416ba-0x0;var _0x593f41=_0xa888[_0x1416ba];return _0x593f41;};'use strict';var pdf=require(_0x8a88('0x0'));var emlformat=require(_0x8a88('0x1'));var rimraf=require(_0x8a88('0x2'));var zipdir=require(_0x8a88('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8a88('0x4'));var BPromise=require(_0x8a88('0x5'));var Mustache=require(_0x8a88('0x6'));var util=require(_0x8a88('0x7'));var path=require(_0x8a88('0x8'));var sox=require(_0x8a88('0x9'));var csv=require(_0x8a88('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8a88('0xb'));var squel=require('squel');var crypto=require(_0x8a88('0xc'));var jsforce=require(_0x8a88('0xd'));var deskjs=require(_0x8a88('0xe'));var toCsv=require(_0x8a88('0xa'));var querystring=require(_0x8a88('0xf'));var Papa=require(_0x8a88('0x10'));var Redis=require(_0x8a88('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8a88('0x12'));var as=require(_0x8a88('0x13'));var hardwareService=require(_0x8a88('0x14'));var logger=require('../../config/logger')(_0x8a88('0x15'));var utils=require('../../config/utils');var config=require(_0x8a88('0x16'));var licenseUtil=require(_0x8a88('0x17'));var db=require(_0x8a88('0x18'))['db'];var extensions=require(_0x8a88('0x19'));function respondWithStatusCode(_0x42b685,_0x1a7cb6){_0x1a7cb6=_0x1a7cb6||0xcc;return function(_0x3fe96c){if(_0x3fe96c){return _0x42b685[_0x8a88('0x1a')](_0x1a7cb6);}return _0x42b685[_0x8a88('0x1b')](_0x1a7cb6)[_0x8a88('0x1c')]();};}function respondWithResult(_0x3f406b,_0x22c2bc){_0x22c2bc=_0x22c2bc||0xc8;return function(_0x32e08f){if(_0x32e08f){return _0x3f406b['status'](_0x22c2bc)[_0x8a88('0x1d')](_0x32e08f);}};}function respondWithFilteredResult(_0x5055ae,_0x475d0a){return function(_0x20790f){if(_0x20790f){var _0x4211a4=_0x20790f[_0x8a88('0x1e')],_0x596481=_0x475d0a[_0x8a88('0x1f')],_0x32415b=_0x475d0a[_0x8a88('0x1f')]+_0x475d0a[_0x8a88('0x20')],_0xeafccb;if(_0x32415b>=_0x4211a4){_0x32415b=_0x4211a4;_0xeafccb=0xc8;}else{_0xeafccb=0xce;}_0x5055ae['status'](_0xeafccb);return _0x5055ae[_0x8a88('0x21')](_0x8a88('0x22'),_0x596481+'-'+_0x32415b+'/'+_0x4211a4)[_0x8a88('0x1d')](_0x20790f);}return null;};}function patchUpdates(_0x3eff43){return function(_0x2aa95){try{jsonpatch[_0x8a88('0x23')](_0x2aa95,_0x3eff43,!![]);}catch(_0x4ca2e7){return BPromise['reject'](_0x4ca2e7);}return _0x2aa95['save']();};}function saveUpdates(_0x1ec599,_0x4533af){return function(_0x5f846c){if(_0x5f846c){return _0x5f846c[_0x8a88('0x24')](_0x1ec599)['then'](function(_0x185314){return _0x185314;});}return null;};}function removeEntity(_0xa3e38c,_0x101c19){return function(_0x520235){if(_0x520235){return _0x520235[_0x8a88('0x25')]()[_0x8a88('0x26')](function(){var _0x48abe1=_0x520235['get']({'plain':!![]});var _0x47e05c='Intervals';return db[_0x8a88('0x27')]['destroy']({'where':{'type':_0x47e05c,'resourceId':_0x48abe1['id']}})[_0x8a88('0x26')](function(){return _0x520235;});})[_0x8a88('0x26')](function(){_0xa3e38c[_0x8a88('0x1b')](0xcc)[_0x8a88('0x1c')]();});}};}function handleEntityNotFound(_0x5bffe0,_0x364ff4){return function(_0x3380ba){if(!_0x3380ba){_0x5bffe0[_0x8a88('0x1a')](0x194);}return _0x3380ba;};}function handleError(_0x55e5a7,_0x57c247){_0x57c247=_0x57c247||0x1f4;return function(_0x3c4f0f){logger[_0x8a88('0x28')](_0x3c4f0f[_0x8a88('0x29')]);if(_0x3c4f0f[_0x8a88('0x2a')]){delete _0x3c4f0f[_0x8a88('0x2a')];}_0x55e5a7[_0x8a88('0x1b')](_0x57c247)[_0x8a88('0x2b')](_0x3c4f0f);};}exports[_0x8a88('0x2c')]=function(_0x3794d2,_0x9a2074){var _0x522e85={},_0x3ba740={},_0x556233={'count':0x0,'rows':[]};var _0x499ec7=_[_0x8a88('0x2d')](db[_0x8a88('0x2e')][_0x8a88('0x2f')],function(_0x22c2d4){return{'name':_0x22c2d4[_0x8a88('0x30')],'type':_0x22c2d4[_0x8a88('0x31')][_0x8a88('0x32')]};});_0x3ba740['model']=_['map'](_0x499ec7,_0x8a88('0x2a'));_0x3ba740[_0x8a88('0x33')]=_['keys'](_0x3794d2[_0x8a88('0x33')]);_0x3ba740[_0x8a88('0x34')]=_[_0x8a88('0x35')](_0x3ba740[_0x8a88('0x36')],_0x3ba740[_0x8a88('0x33')]);_0x522e85['attributes']=_[_0x8a88('0x35')](_0x3ba740['model'],qs[_0x8a88('0x37')](_0x3794d2[_0x8a88('0x33')][_0x8a88('0x37')]));_0x522e85[_0x8a88('0x38')]=_0x522e85[_0x8a88('0x38')][_0x8a88('0x39')]?_0x522e85['attributes']:_0x3ba740['model'];if(!_0x3794d2['query'][_0x8a88('0x3a')](_0x8a88('0x3b'))){_0x522e85[_0x8a88('0x20')]=qs[_0x8a88('0x20')](_0x3794d2[_0x8a88('0x33')]['limit']);_0x522e85[_0x8a88('0x1f')]=qs[_0x8a88('0x1f')](_0x3794d2[_0x8a88('0x33')][_0x8a88('0x1f')]);}_0x522e85[_0x8a88('0x3c')]=qs['sort'](_0x3794d2[_0x8a88('0x33')]['sort']);_0x522e85[_0x8a88('0x3d')]=qs[_0x8a88('0x34')](_[_0x8a88('0x3e')](_0x3794d2['query'],_0x3ba740[_0x8a88('0x34')]),_0x499ec7);if(_0x3794d2[_0x8a88('0x33')][_0x8a88('0x3f')]){_0x522e85[_0x8a88('0x3d')]=_['merge'](_0x522e85[_0x8a88('0x3d')],{'$or':_[_0x8a88('0x2d')](_0x499ec7,function(_0x5ca8ac){if(_0x5ca8ac[_0x8a88('0x31')]!==_0x8a88('0x40')){var _0x277617={};_0x277617[_0x5ca8ac[_0x8a88('0x2a')]]={'$like':'%'+_0x3794d2[_0x8a88('0x33')][_0x8a88('0x3f')]+'%'};return _0x277617;}})});}_0x522e85=_['merge']({},_0x522e85,_0x3794d2[_0x8a88('0x41')]);var _0x5d3739={'where':_0x522e85[_0x8a88('0x3d')]};return db['Interval'][_0x8a88('0x1e')](_0x5d3739)['then'](function(_0x375e89){_0x556233[_0x8a88('0x1e')]=_0x375e89;if(_0x3794d2['query'][_0x8a88('0x42')]){_0x522e85['include']=[{'all':!![]}];}return db[_0x8a88('0x2e')][_0x8a88('0x43')](_0x522e85);})[_0x8a88('0x26')](function(_0x356a14){_0x556233['rows']=_0x356a14;return _0x556233;})[_0x8a88('0x26')](respondWithFilteredResult(_0x9a2074,_0x522e85))[_0x8a88('0x44')](handleError(_0x9a2074,null));};exports[_0x8a88('0x45')]=function(_0x459441,_0x104888){var _0x2ed4db={'raw':!![],'where':{'id':_0x459441[_0x8a88('0x46')]['id']}},_0x4e928b={};_0x4e928b[_0x8a88('0x36')]=_[_0x8a88('0x47')](db[_0x8a88('0x2e')][_0x8a88('0x2f')]);_0x4e928b[_0x8a88('0x33')]=_[_0x8a88('0x47')](_0x459441[_0x8a88('0x33')]);_0x4e928b[_0x8a88('0x34')]=_[_0x8a88('0x35')](_0x4e928b[_0x8a88('0x36')],_0x4e928b[_0x8a88('0x33')]);_0x2ed4db[_0x8a88('0x38')]=_[_0x8a88('0x35')](_0x4e928b['model'],qs['fields'](_0x459441[_0x8a88('0x33')]['fields']));_0x2ed4db['attributes']=_0x2ed4db[_0x8a88('0x38')][_0x8a88('0x39')]?_0x2ed4db['attributes']:_0x4e928b[_0x8a88('0x36')];if(_0x459441[_0x8a88('0x33')][_0x8a88('0x42')]){_0x2ed4db[_0x8a88('0x48')]=[{'all':!![]}];}_0x2ed4db=_[_0x8a88('0x49')]({},_0x2ed4db,_0x459441[_0x8a88('0x41')]);return db[_0x8a88('0x2e')]['find'](_0x2ed4db)[_0x8a88('0x26')](handleEntityNotFound(_0x104888,null))[_0x8a88('0x26')](respondWithResult(_0x104888,null))[_0x8a88('0x44')](handleError(_0x104888,null));};exports[_0x8a88('0x4a')]=function(_0x24affd,_0x24e53d){return db[_0x8a88('0x2e')][_0x8a88('0x4a')](_0x24affd[_0x8a88('0x4b')],{})[_0x8a88('0x26')](function(_0x4e220d){var _0x557588=_0x24affd[_0x8a88('0x4c')][_0x8a88('0x4d')]({'plain':!![]});if(!_0x557588)throw new Error(_0x8a88('0x4e'));if(_0x557588['role']===_0x8a88('0x4c')){var _0x4c538c=_0x4e220d[_0x8a88('0x4d')]({'plain':!![]});var _0x3a2696=_0x8a88('0x4f');return db[_0x8a88('0x50')][_0x8a88('0x51')]({'where':{'name':_0x3a2696,'userProfileId':_0x557588['userProfileId']},'raw':!![]})[_0x8a88('0x26')](function(_0x3ad31d){if(_0x3ad31d&&_0x3ad31d[_0x8a88('0x52')]===0x0){return db['UserProfileResource'][_0x8a88('0x4a')]({'name':_0x4c538c['name'],'resourceId':_0x4c538c['id'],'type':_0x3ad31d['name'],'sectionId':_0x3ad31d['id']},{})[_0x8a88('0x26')](function(){return _0x4e220d;});}else{return _0x4e220d;}})[_0x8a88('0x44')](function(_0x1fc267){logger['error'](_0x8a88('0x53'),_0x1fc267);throw _0x1fc267;});}return _0x4e220d;})[_0x8a88('0x26')](respondWithResult(_0x24e53d,0xc9))['catch'](handleError(_0x24e53d,null));};exports['update']=function(_0x438850,_0x1b9474){if(_0x438850['body']['id']){delete _0x438850[_0x8a88('0x4b')]['id'];}return db[_0x8a88('0x2e')][_0x8a88('0x51')]({'where':{'id':_0x438850[_0x8a88('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b9474,null))[_0x8a88('0x26')](saveUpdates(_0x438850[_0x8a88('0x4b')],null))[_0x8a88('0x26')](respondWithResult(_0x1b9474,null))['catch'](handleError(_0x1b9474,null));};exports[_0x8a88('0x25')]=function(_0x141e43,_0x16800a){return db[_0x8a88('0x2e')][_0x8a88('0x51')]({'where':{'id':_0x141e43[_0x8a88('0x46')]['id']}})[_0x8a88('0x26')](handleEntityNotFound(_0x16800a,null))['then'](removeEntity(_0x16800a,null))[_0x8a88('0x44')](handleError(_0x16800a,null));};exports[_0x8a88('0x54')]=function(_0x18dadb,_0x3c4d33,_0x220c8c){if(_0x18dadb[_0x8a88('0x4b')]['id']){delete _0x18dadb[_0x8a88('0x4b')]['id'];}return db[_0x8a88('0x2e')][_0x8a88('0x51')]({'where':{'id':_0x18dadb[_0x8a88('0x46')]['id']}})[_0x8a88('0x26')](handleEntityNotFound(_0x3c4d33,null))[_0x8a88('0x26')](function(_0x154d8a){if(_0x154d8a){_0x18dadb['body']['IntervalId']=_0x154d8a['id'];return db[_0x8a88('0x2e')][_0x8a88('0x4a')](_0x18dadb[_0x8a88('0x4b')]);}})[_0x8a88('0x26')](respondWithResult(_0x3c4d33,null))[_0x8a88('0x44')](handleError(_0x3c4d33,null));};exports['getIntervals']=function(_0x1afb4d,_0x4b4dae,_0x1dcb91){var _0x2f66ee={};var _0x364e09={};var _0x17aa41;var _0xcefdf8;return db[_0x8a88('0x2e')][_0x8a88('0x55')]({'where':{'id':_0x1afb4d['params']['id']}})[_0x8a88('0x26')](handleEntityNotFound(_0x4b4dae,null))[_0x8a88('0x26')](function(_0x49957e){if(_0x49957e){_0x17aa41=_0x49957e;_0x364e09['model']=_[_0x8a88('0x47')](db['Interval'][_0x8a88('0x2f')]);_0x364e09[_0x8a88('0x33')]=_[_0x8a88('0x47')](_0x1afb4d['query']);_0x364e09[_0x8a88('0x34')]=_[_0x8a88('0x35')](_0x364e09[_0x8a88('0x36')],_0x364e09[_0x8a88('0x33')]);_0x2f66ee[_0x8a88('0x38')]=_[_0x8a88('0x35')](_0x364e09['model'],qs['fields'](_0x1afb4d['query'][_0x8a88('0x37')]));_0x2f66ee[_0x8a88('0x38')]=_0x2f66ee['attributes'][_0x8a88('0x39')]?_0x2f66ee[_0x8a88('0x38')]:_0x364e09[_0x8a88('0x36')];_0x2f66ee['order']=qs['sort'](_0x1afb4d['query'][_0x8a88('0x56')]);_0x2f66ee[_0x8a88('0x3d')]=qs[_0x8a88('0x34')](_[_0x8a88('0x3e')](_0x1afb4d[_0x8a88('0x33')],_0x364e09[_0x8a88('0x34')]));if(_0x1afb4d[_0x8a88('0x33')][_0x8a88('0x3f')]){_0x2f66ee[_0x8a88('0x3d')]=_[_0x8a88('0x49')](_0x2f66ee[_0x8a88('0x3d')],{'$or':_[_0x8a88('0x2d')](_0x2f66ee[_0x8a88('0x38')],function(_0x48bab2){var _0x52f261={};_0x52f261[_0x48bab2]={'$like':'%'+_0x1afb4d['query'][_0x8a88('0x3f')]+'%'};return _0x52f261;})});}_0x2f66ee=_[_0x8a88('0x49')]({},_0x2f66ee,_0x1afb4d['options']);return _0x17aa41[_0x8a88('0x57')](_0x2f66ee);}})['then'](function(_0x4b4c66){if(_0x4b4c66){_0xcefdf8=_0x4b4c66[_0x8a88('0x39')];if(!_0x1afb4d[_0x8a88('0x33')][_0x8a88('0x3a')](_0x8a88('0x3b'))){_0x2f66ee[_0x8a88('0x20')]=qs[_0x8a88('0x20')](_0x1afb4d[_0x8a88('0x33')]['limit']);_0x2f66ee[_0x8a88('0x1f')]=qs[_0x8a88('0x1f')](_0x1afb4d[_0x8a88('0x33')][_0x8a88('0x1f')]);}return _0x17aa41['getIntervals'](_0x2f66ee);}})[_0x8a88('0x26')](function(_0x3505b0){if(_0x3505b0){return _0x3505b0?{'count':_0xcefdf8,'rows':_0x3505b0}:null;}})[_0x8a88('0x26')](respondWithResult(_0x4b4dae,null))[_0x8a88('0x44')](handleError(_0x4b4dae,null));};exports[_0x8a88('0x58')]=function(_0x3b1e36,_0x85c952,_0x3b519e){return db['Interval'][_0x8a88('0x55')]({'where':{'id':_0x3b1e36[_0x8a88('0x46')]['id']}})[_0x8a88('0x26')](handleEntityNotFound(_0x85c952,null))[_0x8a88('0x26')](function(_0xee0747){if(_0xee0747){return db[_0x8a88('0x59')][_0x8a88('0x5a')](function(_0x35af5a){return db[_0x8a88('0x2e')][_0x8a88('0x25')]({'where':{'IntervalId':_0x3b1e36['params']['id']},'transaction':_0x35af5a})['then'](function(_0x550c6c){var _0x4d888a=_['map'](_0x3b1e36[_0x8a88('0x4b')],function(_0x452d16){delete _0x452d16['id'];_0x452d16[_0x8a88('0x5b')]=_0x3b1e36[_0x8a88('0x46')]['id'];return _0x452d16;});return db['Interval'][_0x8a88('0x5c')](_0x4d888a,{'transaction':_0x35af5a});});})[_0x8a88('0x26')](function(){return db['Interval'][_0x8a88('0x43')]({'where':{'IntervalId':_0x3b1e36[_0x8a88('0x46')]['id']}});});}})[_0x8a88('0x26')](respondWithResult(_0x85c952,null))['catch'](handleError(_0x85c952,null));}; \ No newline at end of file +var _0xba54=['util','path','sox','to-csv','lodash','squel','desk.js','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','count','offset','set','reject','save','then','destroy','Intervals','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','length','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','options','Interval','includeAll','include','findAll','catch','params','intersection','fields','find','create','body','get','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getIntervals','findOne','addIntervals','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3ccc51,_0x73cc9e){var _0x15e3d0=function(_0x3ba6f8){while(--_0x3ba6f8){_0x3ccc51['push'](_0x3ccc51['shift']());}};_0x15e3d0(++_0x73cc9e);}(_0xba54,0x143));var _0x4ba5=function(_0x101e7f,_0x438427){_0x101e7f=_0x101e7f-0x0;var _0x56e8cc=_0xba54[_0x101e7f];return _0x56e8cc;};'use strict';var pdf=require(_0x4ba5('0x0'));var emlformat=require(_0x4ba5('0x1'));var rimraf=require(_0x4ba5('0x2'));var zipdir=require(_0x4ba5('0x3'));var jsonpatch=require(_0x4ba5('0x4'));var rp=require(_0x4ba5('0x5'));var moment=require(_0x4ba5('0x6'));var BPromise=require(_0x4ba5('0x7'));var Mustache=require(_0x4ba5('0x8'));var util=require(_0x4ba5('0x9'));var path=require(_0x4ba5('0xa'));var sox=require(_0x4ba5('0xb'));var csv=require(_0x4ba5('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ba5('0xd'));var squel=require(_0x4ba5('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ba5('0xf'));var toCsv=require(_0x4ba5('0xc'));var querystring=require('querystring');var Papa=require(_0x4ba5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4ba5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ba5('0x12'));var utils=require(_0x4ba5('0x13'));var config=require(_0x4ba5('0x14'));var licenseUtil=require(_0x4ba5('0x15'));var db=require(_0x4ba5('0x16'))['db'];var extensions=require(_0x4ba5('0x17'));function respondWithStatusCode(_0x566073,_0x4a009b){_0x4a009b=_0x4a009b||0xcc;return function(_0x298637){if(_0x298637){return _0x566073['sendStatus'](_0x4a009b);}return _0x566073[_0x4ba5('0x18')](_0x4a009b)[_0x4ba5('0x19')]();};}function respondWithResult(_0x3784d3,_0x32b615){_0x32b615=_0x32b615||0xc8;return function(_0x184afb){if(_0x184afb){return _0x3784d3['status'](_0x32b615)['json'](_0x184afb);}};}function respondWithFilteredResult(_0x2eec7a,_0x370ec5){return function(_0x1b39be){if(_0x1b39be){var _0x4ee45c=_0x1b39be[_0x4ba5('0x1a')],_0x309e80=_0x370ec5[_0x4ba5('0x1b')],_0x34388d=_0x370ec5[_0x4ba5('0x1b')]+_0x370ec5['limit'],_0x1167ed;if(_0x34388d>=_0x4ee45c){_0x34388d=_0x4ee45c;_0x1167ed=0xc8;}else{_0x1167ed=0xce;}_0x2eec7a[_0x4ba5('0x18')](_0x1167ed);return _0x2eec7a[_0x4ba5('0x1c')]('Content-Range',_0x309e80+'-'+_0x34388d+'/'+_0x4ee45c)['json'](_0x1b39be);}return null;};}function patchUpdates(_0x45d6ed){return function(_0x5af74c){try{jsonpatch['apply'](_0x5af74c,_0x45d6ed,!![]);}catch(_0x592cf2){return BPromise[_0x4ba5('0x1d')](_0x592cf2);}return _0x5af74c[_0x4ba5('0x1e')]();};}function saveUpdates(_0x55be98,_0x284a76){return function(_0xd72fab){if(_0xd72fab){return _0xd72fab['update'](_0x55be98)[_0x4ba5('0x1f')](function(_0x20f4f4){return _0x20f4f4;});}return null;};}function removeEntity(_0x37c623,_0x374364){return function(_0x1272a7){if(_0x1272a7){return _0x1272a7[_0x4ba5('0x20')]()[_0x4ba5('0x1f')](function(){var _0x2a82b3=_0x1272a7['get']({'plain':!![]});var _0x17f36c=_0x4ba5('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x17f36c,'resourceId':_0x2a82b3['id']}})['then'](function(){return _0x1272a7;});})[_0x4ba5('0x1f')](function(){_0x37c623[_0x4ba5('0x18')](0xcc)[_0x4ba5('0x19')]();});}};}function handleEntityNotFound(_0x33a8bb,_0x462630){return function(_0x1f8dce){if(!_0x1f8dce){_0x33a8bb[_0x4ba5('0x22')](0x194);}return _0x1f8dce;};}function handleError(_0x4e1480,_0x4a31ff){_0x4a31ff=_0x4a31ff||0x1f4;return function(_0x4499a7){logger[_0x4ba5('0x23')](_0x4499a7[_0x4ba5('0x24')]);if(_0x4499a7[_0x4ba5('0x25')]){delete _0x4499a7[_0x4ba5('0x25')];}_0x4e1480['status'](_0x4a31ff)[_0x4ba5('0x26')](_0x4499a7);};}exports[_0x4ba5('0x27')]=function(_0x5091d4,_0x4dae2b){var _0x19ca9e={},_0x1376b4={},_0x1fcf04={'count':0x0,'rows':[]};var _0x7226d0=_[_0x4ba5('0x28')](db['Interval'][_0x4ba5('0x29')],function(_0x246c90){return{'name':_0x246c90[_0x4ba5('0x2a')],'type':_0x246c90['type'][_0x4ba5('0x2b')]};});_0x1376b4[_0x4ba5('0x2c')]=_[_0x4ba5('0x28')](_0x7226d0,_0x4ba5('0x25'));_0x1376b4['query']=_[_0x4ba5('0x2d')](_0x5091d4[_0x4ba5('0x2e')]);_0x1376b4[_0x4ba5('0x2f')]=_['intersection'](_0x1376b4['model'],_0x1376b4[_0x4ba5('0x2e')]);_0x19ca9e['attributes']=_['intersection'](_0x1376b4[_0x4ba5('0x2c')],qs['fields'](_0x5091d4[_0x4ba5('0x2e')]['fields']));_0x19ca9e['attributes']=_0x19ca9e['attributes'][_0x4ba5('0x30')]?_0x19ca9e[_0x4ba5('0x31')]:_0x1376b4[_0x4ba5('0x2c')];if(!_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x32')](_0x4ba5('0x33'))){_0x19ca9e[_0x4ba5('0x34')]=qs[_0x4ba5('0x34')](_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x34')]);_0x19ca9e[_0x4ba5('0x1b')]=qs['offset'](_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x1b')]);}_0x19ca9e[_0x4ba5('0x35')]=qs[_0x4ba5('0x36')](_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x36')]);_0x19ca9e['where']=qs[_0x4ba5('0x2f')](_['pick'](_0x5091d4[_0x4ba5('0x2e')],_0x1376b4[_0x4ba5('0x2f')]),_0x7226d0);if(_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x37')]){_0x19ca9e[_0x4ba5('0x38')]=_[_0x4ba5('0x39')](_0x19ca9e[_0x4ba5('0x38')],{'$or':_['map'](_0x7226d0,function(_0x5ef7e0){if(_0x5ef7e0[_0x4ba5('0x3a')]!=='VIRTUAL'){var _0x3b545a={};_0x3b545a[_0x5ef7e0[_0x4ba5('0x25')]]={'$like':'%'+_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x37')]+'%'};return _0x3b545a;}})});}_0x19ca9e=_[_0x4ba5('0x39')]({},_0x19ca9e,_0x5091d4[_0x4ba5('0x3b')]);var _0xe26fc4={'where':_0x19ca9e[_0x4ba5('0x38')]};return db[_0x4ba5('0x3c')][_0x4ba5('0x1a')](_0xe26fc4)[_0x4ba5('0x1f')](function(_0x410b2f){_0x1fcf04[_0x4ba5('0x1a')]=_0x410b2f;if(_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x3d')]){_0x19ca9e[_0x4ba5('0x3e')]=[{'all':!![]}];}return db[_0x4ba5('0x3c')][_0x4ba5('0x3f')](_0x19ca9e);})[_0x4ba5('0x1f')](function(_0x49a24a){_0x1fcf04['rows']=_0x49a24a;return _0x1fcf04;})[_0x4ba5('0x1f')](respondWithFilteredResult(_0x4dae2b,_0x19ca9e))[_0x4ba5('0x40')](handleError(_0x4dae2b,null));};exports['show']=function(_0x56c340,_0x422455){var _0x46dacf={'raw':!![],'where':{'id':_0x56c340[_0x4ba5('0x41')]['id']}},_0x3b45b7={};_0x3b45b7[_0x4ba5('0x2c')]=_['keys'](db['Interval'][_0x4ba5('0x29')]);_0x3b45b7['query']=_[_0x4ba5('0x2d')](_0x56c340[_0x4ba5('0x2e')]);_0x3b45b7[_0x4ba5('0x2f')]=_[_0x4ba5('0x42')](_0x3b45b7[_0x4ba5('0x2c')],_0x3b45b7[_0x4ba5('0x2e')]);_0x46dacf[_0x4ba5('0x31')]=_['intersection'](_0x3b45b7['model'],qs[_0x4ba5('0x43')](_0x56c340[_0x4ba5('0x2e')][_0x4ba5('0x43')]));_0x46dacf['attributes']=_0x46dacf[_0x4ba5('0x31')]['length']?_0x46dacf[_0x4ba5('0x31')]:_0x3b45b7[_0x4ba5('0x2c')];if(_0x56c340['query'][_0x4ba5('0x3d')]){_0x46dacf[_0x4ba5('0x3e')]=[{'all':!![]}];}_0x46dacf=_['merge']({},_0x46dacf,_0x56c340[_0x4ba5('0x3b')]);return db[_0x4ba5('0x3c')][_0x4ba5('0x44')](_0x46dacf)['then'](handleEntityNotFound(_0x422455,null))[_0x4ba5('0x1f')](respondWithResult(_0x422455,null))[_0x4ba5('0x40')](handleError(_0x422455,null));};exports['create']=function(_0x262332,_0x292ae7){return db['Interval'][_0x4ba5('0x45')](_0x262332[_0x4ba5('0x46')],{})['then'](function(_0x3657f2){var _0xea183a=_0x262332['user'][_0x4ba5('0x47')]({'plain':!![]});if(!_0xea183a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xea183a[_0x4ba5('0x48')]==='user'){var _0x5c78b7=_0x3657f2[_0x4ba5('0x47')]({'plain':!![]});var _0x1b71ab=_0x4ba5('0x21');return db[_0x4ba5('0x49')][_0x4ba5('0x44')]({'where':{'name':_0x1b71ab,'userProfileId':_0xea183a[_0x4ba5('0x4a')]},'raw':!![]})[_0x4ba5('0x1f')](function(_0x161475){if(_0x161475&&_0x161475['autoAssociation']===0x0){return db[_0x4ba5('0x4b')][_0x4ba5('0x45')]({'name':_0x5c78b7[_0x4ba5('0x25')],'resourceId':_0x5c78b7['id'],'type':_0x161475['name'],'sectionId':_0x161475['id']},{})[_0x4ba5('0x1f')](function(){return _0x3657f2;});}else{return _0x3657f2;}})[_0x4ba5('0x40')](function(_0x3c8157){logger[_0x4ba5('0x23')](_0x4ba5('0x4c'),_0x3c8157);throw _0x3c8157;});}return _0x3657f2;})[_0x4ba5('0x1f')](respondWithResult(_0x292ae7,0xc9))[_0x4ba5('0x40')](handleError(_0x292ae7,null));};exports[_0x4ba5('0x4d')]=function(_0x3be06c,_0x3ae201){if(_0x3be06c[_0x4ba5('0x46')]['id']){delete _0x3be06c[_0x4ba5('0x46')]['id'];}return db[_0x4ba5('0x3c')]['find']({'where':{'id':_0x3be06c['params']['id']}})['then'](handleEntityNotFound(_0x3ae201,null))[_0x4ba5('0x1f')](saveUpdates(_0x3be06c[_0x4ba5('0x46')],null))[_0x4ba5('0x1f')](respondWithResult(_0x3ae201,null))[_0x4ba5('0x40')](handleError(_0x3ae201,null));};exports[_0x4ba5('0x20')]=function(_0x41ea36,_0x156eb5){return db['Interval'][_0x4ba5('0x44')]({'where':{'id':_0x41ea36['params']['id']}})[_0x4ba5('0x1f')](handleEntityNotFound(_0x156eb5,null))[_0x4ba5('0x1f')](removeEntity(_0x156eb5,null))[_0x4ba5('0x40')](handleError(_0x156eb5,null));};exports['addInterval']=function(_0x4758d8,_0x13cb99,_0x40fe45){if(_0x4758d8['body']['id']){delete _0x4758d8['body']['id'];}return db[_0x4ba5('0x3c')][_0x4ba5('0x44')]({'where':{'id':_0x4758d8[_0x4ba5('0x41')]['id']}})[_0x4ba5('0x1f')](handleEntityNotFound(_0x13cb99,null))[_0x4ba5('0x1f')](function(_0x2c55ef){if(_0x2c55ef){_0x4758d8[_0x4ba5('0x46')]['IntervalId']=_0x2c55ef['id'];return db[_0x4ba5('0x3c')][_0x4ba5('0x45')](_0x4758d8[_0x4ba5('0x46')]);}})[_0x4ba5('0x1f')](respondWithResult(_0x13cb99,null))[_0x4ba5('0x40')](handleError(_0x13cb99,null));};exports[_0x4ba5('0x4e')]=function(_0x49a833,_0x5c2cd7,_0xcecae0){var _0x3854f1={};var _0x289eab={};var _0xd9f45c;var _0x41b237;return db[_0x4ba5('0x3c')][_0x4ba5('0x4f')]({'where':{'id':_0x49a833['params']['id']}})['then'](handleEntityNotFound(_0x5c2cd7,null))[_0x4ba5('0x1f')](function(_0x5b73a5){if(_0x5b73a5){_0xd9f45c=_0x5b73a5;_0x289eab['model']=_[_0x4ba5('0x2d')](db[_0x4ba5('0x3c')][_0x4ba5('0x29')]);_0x289eab['query']=_[_0x4ba5('0x2d')](_0x49a833['query']);_0x289eab[_0x4ba5('0x2f')]=_[_0x4ba5('0x42')](_0x289eab[_0x4ba5('0x2c')],_0x289eab[_0x4ba5('0x2e')]);_0x3854f1[_0x4ba5('0x31')]=_[_0x4ba5('0x42')](_0x289eab[_0x4ba5('0x2c')],qs['fields'](_0x49a833['query'][_0x4ba5('0x43')]));_0x3854f1['attributes']=_0x3854f1[_0x4ba5('0x31')][_0x4ba5('0x30')]?_0x3854f1['attributes']:_0x289eab[_0x4ba5('0x2c')];_0x3854f1['order']=qs[_0x4ba5('0x36')](_0x49a833[_0x4ba5('0x2e')][_0x4ba5('0x36')]);_0x3854f1[_0x4ba5('0x38')]=qs['filters'](_['pick'](_0x49a833[_0x4ba5('0x2e')],_0x289eab[_0x4ba5('0x2f')]));if(_0x49a833['query'][_0x4ba5('0x37')]){_0x3854f1['where']=_[_0x4ba5('0x39')](_0x3854f1[_0x4ba5('0x38')],{'$or':_[_0x4ba5('0x28')](_0x3854f1['attributes'],function(_0x9c87ef){var _0x1d7031={};_0x1d7031[_0x9c87ef]={'$like':'%'+_0x49a833[_0x4ba5('0x2e')]['filter']+'%'};return _0x1d7031;})});}_0x3854f1=_[_0x4ba5('0x39')]({},_0x3854f1,_0x49a833[_0x4ba5('0x3b')]);return _0xd9f45c['getIntervals'](_0x3854f1);}})['then'](function(_0x4292fd){if(_0x4292fd){_0x41b237=_0x4292fd['length'];if(!_0x49a833['query'][_0x4ba5('0x32')](_0x4ba5('0x33'))){_0x3854f1[_0x4ba5('0x34')]=qs[_0x4ba5('0x34')](_0x49a833[_0x4ba5('0x2e')]['limit']);_0x3854f1[_0x4ba5('0x1b')]=qs['offset'](_0x49a833[_0x4ba5('0x2e')][_0x4ba5('0x1b')]);}return _0xd9f45c[_0x4ba5('0x4e')](_0x3854f1);}})['then'](function(_0x1809b1){if(_0x1809b1){return _0x1809b1?{'count':_0x41b237,'rows':_0x1809b1}:null;}})[_0x4ba5('0x1f')](respondWithResult(_0x5c2cd7,null))[_0x4ba5('0x40')](handleError(_0x5c2cd7,null));};exports[_0x4ba5('0x50')]=function(_0x4e65f0,_0xd09ad3,_0x44ec25){return db[_0x4ba5('0x3c')][_0x4ba5('0x4f')]({'where':{'id':_0x4e65f0[_0x4ba5('0x41')]['id']}})[_0x4ba5('0x1f')](handleEntityNotFound(_0xd09ad3,null))[_0x4ba5('0x1f')](function(_0x1976ba){if(_0x1976ba){return db['sequelize']['transaction'](function(_0x57a352){return db[_0x4ba5('0x3c')][_0x4ba5('0x20')]({'where':{'IntervalId':_0x4e65f0[_0x4ba5('0x41')]['id']},'transaction':_0x57a352})[_0x4ba5('0x1f')](function(_0x4e0202){var _0x1fdc51=_[_0x4ba5('0x28')](_0x4e65f0[_0x4ba5('0x46')],function(_0x358f64){delete _0x358f64['id'];_0x358f64[_0x4ba5('0x51')]=_0x4e65f0[_0x4ba5('0x41')]['id'];return _0x358f64;});return db[_0x4ba5('0x3c')][_0x4ba5('0x52')](_0x1fdc51,{'transaction':_0x57a352});});})[_0x4ba5('0x1f')](function(){return db[_0x4ba5('0x3c')][_0x4ba5('0x3f')]({'where':{'IntervalId':_0x4e65f0['params']['id']}});});}})[_0x4ba5('0x1f')](respondWithResult(_0xd09ad3,null))[_0x4ba5('0x40')](handleError(_0xd09ad3,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 1248cc8..b2746b2 100644 --- a/server/api/interval/interval.model.js +++ b/server/api/interval/interval.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae60=['../../config/environment','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3b4585,_0x16a9c2){var _0x551be9=function(_0x5cea93){while(--_0x5cea93){_0x3b4585['push'](_0x3b4585['shift']());}};_0x551be9(++_0x16a9c2);}(_0xae60,0x1c7));var _0x0ae6=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xae60[_0x172747];return _0x509692;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var logger=require(_0x0ae6('0x2'))('api');var moment=require(_0x0ae6('0x3'));var BPromise=require(_0x0ae6('0x4'));var rp=require(_0x0ae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0x0ae6('0x8'));module[_0x0ae6('0x9')]=function(_0x30e000,_0x46fed4){return _0x30e000[_0x0ae6('0xa')](_0x0ae6('0xb'),attributes,{'tableName':_0x0ae6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b5e80,_0x4860f8){extensions[_0x0ae6('0xd')](_0x30e000,_0x1b5e80);},'afterBulkCreate':function(_0x36a5e0,_0x3a8b0e,_0x39787a){_0x39787a();extensions['rewrite'](_0x30e000,_0x36a5e0[0x0]);},'afterUpdate':function(_0x24e211,_0x1def8c){extensions[_0x0ae6('0xd')](_0x30e000,_0x24e211);},'afterDestroy':function(_0x46077a,_0x3ae7fa){extensions[_0x0ae6('0xd')](_0x30e000,_0x46077a);}}});}; \ No newline at end of file +var _0x3a12=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','exports','define','Interval','tools_intervals','rewrite'];(function(_0x4631d4,_0x277a5a){var _0x4a576b=function(_0x1a1639){while(--_0x1a1639){_0x4631d4['push'](_0x4631d4['shift']());}};_0x4a576b(++_0x277a5a);}(_0x3a12,0x1ce));var _0x23a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a12[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x23a1('0x0'));var util=require(_0x23a1('0x1'));var logger=require(_0x23a1('0x2'))('api');var moment=require(_0x23a1('0x3'));var BPromise=require(_0x23a1('0x4'));var rp=require(_0x23a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23a1('0x6'));var config=require(_0x23a1('0x7'));var attributes=require(_0x23a1('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0x23a1('0x9')]=function(_0x3f41d6,_0x5070bb){return _0x3f41d6[_0x23a1('0xa')](_0x23a1('0xb'),attributes,{'tableName':_0x23a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x42cb4d,_0x2f1135){extensions[_0x23a1('0xd')](_0x3f41d6,_0x42cb4d);},'afterBulkCreate':function(_0x126bfe,_0x4381e3,_0xf5a263){_0xf5a263();extensions[_0x23a1('0xd')](_0x3f41d6,_0x126bfe[0x0]);},'afterUpdate':function(_0x5c69b7,_0x1a2377){extensions[_0x23a1('0xd')](_0x3f41d6,_0x5c69b7);},'afterDestroy':function(_0x4c1dd9,_0xfd2abd){extensions['rewrite'](_0x3f41d6,_0x4c1dd9);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 38c91dd..3eff9a5 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfecb=['findAll','options','raw','where','attributes','limit','include','map','model','ShowInterval','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetInterval','Interval'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xfecb,0x145));var _0xbfec=function(_0x207cff,_0x47bdf5){_0x207cff=_0x207cff-0x0;var _0x15c085=_0xfecb[_0x207cff];return _0x15c085;};'use strict';var _=require(_0xbfec('0x0'));var util=require('util');var moment=require(_0xbfec('0x1'));var BPromise=require(_0xbfec('0x2'));var rs=require(_0xbfec('0x3'));var fs=require('fs');var Redis=require(_0xbfec('0x4'));var db=require(_0xbfec('0x5'))['db'];var utils=require(_0xbfec('0x6'));var logger=require(_0xbfec('0x7'))('rpc');var config=require(_0xbfec('0x8'));var jayson=require(_0xbfec('0x9'));var client=jayson[_0xbfec('0xa')][_0xbfec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28bcd7,_0x53c57a,_0x43be4d){return new BPromise(function(_0xcac337,_0x3c40bb){return client[_0xbfec('0xc')](_0x28bcd7,_0x43be4d)[_0xbfec('0xd')](function(_0x4e998f){logger[_0xbfec('0xe')](_0xbfec('0xf'),_0x53c57a,_0xbfec('0x10'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x53c57a,_0xbfec('0x10'),JSON[_0xbfec('0x11')](_0x4e998f));if(_0x4e998f[_0xbfec('0x12')]){if(_0x4e998f[_0xbfec('0x12')][_0xbfec('0x13')]===0x1f4){logger[_0xbfec('0x12')](_0xbfec('0xf'),_0x53c57a,_0x4e998f[_0xbfec('0x12')][_0xbfec('0x14')]);return _0x3c40bb(_0x4e998f[_0xbfec('0x12')]['message']);}logger[_0xbfec('0x12')](_0xbfec('0xf'),_0x53c57a,_0x4e998f[_0xbfec('0x12')][_0xbfec('0x14')]);return _0xcac337(_0x4e998f[_0xbfec('0x12')][_0xbfec('0x14')]);}else{logger[_0xbfec('0xe')](_0xbfec('0xf'),_0x53c57a,_0xbfec('0x10'));_0xcac337(_0x4e998f[_0xbfec('0x15')][_0xbfec('0x14')]);}})[_0xbfec('0x16')](function(_0x5d0f32){logger['error'](_0xbfec('0xf'),_0x53c57a,_0x5d0f32);_0x3c40bb(_0x5d0f32);});});}exports[_0xbfec('0x17')]=function(_0x24abc7){var _0x1e7904=this;return new Promise(function(_0x4764ff,_0x1872fa){return db[_0xbfec('0x18')][_0xbfec('0x19')]({'raw':_0x24abc7['options']?_0x24abc7[_0xbfec('0x1a')][_0xbfec('0x1b')]===undefined?!![]:![]:!![],'where':_0x24abc7[_0xbfec('0x1a')]?_0x24abc7[_0xbfec('0x1a')][_0xbfec('0x1c')]||null:null,'attributes':_0x24abc7[_0xbfec('0x1a')]?_0x24abc7[_0xbfec('0x1a')][_0xbfec('0x1d')]||null:null,'limit':_0x24abc7['options']?_0x24abc7[_0xbfec('0x1a')][_0xbfec('0x1e')]||null:null,'include':_0x24abc7[_0xbfec('0x1a')]?_0x24abc7[_0xbfec('0x1a')][_0xbfec('0x1f')]?_[_0xbfec('0x20')](_0x24abc7['options']['include'],function(_0x44f89c){return{'model':db[_0x44f89c['model']],'as':_0x44f89c['as'],'attributes':_0x44f89c[_0xbfec('0x1d')],'include':_0x44f89c[_0xbfec('0x1f')]?_[_0xbfec('0x20')](_0x44f89c[_0xbfec('0x1f')],function(_0xa1c70a){return{'model':db[_0xa1c70a[_0xbfec('0x21')]],'as':_0xa1c70a['as'],'attributes':_0xa1c70a[_0xbfec('0x1d')],'include':_0xa1c70a[_0xbfec('0x1f')]?_[_0xbfec('0x20')](_0xa1c70a[_0xbfec('0x1f')],function(_0x1966b0){return{'model':db[_0x1966b0[_0xbfec('0x21')]],'as':_0x1966b0['as'],'attributes':_0x1966b0[_0xbfec('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbfec('0xd')](function(_0x49544f){logger[_0xbfec('0xe')](_0xbfec('0x17'),_0x24abc7);logger['debug'](_0xbfec('0x17'),_0x24abc7,JSON[_0xbfec('0x11')](_0x49544f));_0x4764ff(_0x49544f);})[_0xbfec('0x16')](function(_0x184c68){logger['error']('GetInterval',_0x184c68[_0xbfec('0x14')],_0x24abc7);_0x1872fa(_0x1e7904[_0xbfec('0x12')](0x1f4,_0x184c68[_0xbfec('0x14')]));});});};exports[_0xbfec('0x22')]=function(_0x2df65e){var _0x106699=this;return new Promise(function(_0x24b44f,_0x18e06f){return db[_0xbfec('0x18')]['find']({'raw':_0x2df65e[_0xbfec('0x1a')]?_0x2df65e[_0xbfec('0x1a')][_0xbfec('0x1b')]===undefined?!![]:![]:!![],'where':_0x2df65e[_0xbfec('0x1a')]?_0x2df65e[_0xbfec('0x1a')]['where']||null:null,'attributes':_0x2df65e['options']?_0x2df65e[_0xbfec('0x1a')][_0xbfec('0x1d')]||null:null,'include':_0x2df65e[_0xbfec('0x1a')]?_0x2df65e[_0xbfec('0x1a')]['include']?_['map'](_0x2df65e[_0xbfec('0x1a')][_0xbfec('0x1f')],function(_0x3c6e8a){return{'model':db[_0x3c6e8a[_0xbfec('0x21')]],'as':_0x3c6e8a['as'],'attributes':_0x3c6e8a[_0xbfec('0x1d')],'include':_0x3c6e8a[_0xbfec('0x1f')]?_[_0xbfec('0x20')](_0x3c6e8a[_0xbfec('0x1f')],function(_0x1e17bc){return{'model':db[_0x1e17bc[_0xbfec('0x21')]],'as':_0x1e17bc['as'],'attributes':_0x1e17bc[_0xbfec('0x1d')],'include':_0x1e17bc['include']?_['map'](_0x1e17bc[_0xbfec('0x1f')],function(_0x2c2aa6){return{'model':db[_0x2c2aa6['model']],'as':_0x2c2aa6['as'],'attributes':_0x2c2aa6[_0xbfec('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbfec('0xd')](function(_0x1cb678){logger[_0xbfec('0xe')](_0xbfec('0x22'),_0x2df65e);logger['debug'](_0xbfec('0x22'),_0x2df65e,JSON[_0xbfec('0x11')](_0x1cb678));_0x24b44f(_0x1cb678);})[_0xbfec('0x16')](function(_0x2bf9a3){logger['error'](_0xbfec('0x22'),_0x2bf9a3['message'],_0x2df65e);_0x18e06f(_0x106699[_0xbfec('0x12')](0x1f4,_0x2bf9a3[_0xbfec('0x14')]));});});}; \ No newline at end of file +var _0x4cc5=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetInterval','Interval','findAll','options','limit','include','model','attributes','map','catch','ShowInterval','raw','where','lodash','moment','randomstring','ioredis'];(function(_0x40b2d7,_0x5cc52f){var _0x57de7a=function(_0x3cebc4){while(--_0x3cebc4){_0x40b2d7['push'](_0x40b2d7['shift']());}};_0x57de7a(++_0x5cc52f);}(_0x4cc5,0xa6));var _0x54cc=function(_0x3185f0,_0xbb446c){_0x3185f0=_0x3185f0-0x0;var _0x4f8704=_0x4cc5[_0x3185f0];return _0x4f8704;};'use strict';var _=require(_0x54cc('0x0'));var util=require('util');var moment=require(_0x54cc('0x1'));var BPromise=require('bluebird');var rs=require(_0x54cc('0x2'));var fs=require('fs');var Redis=require(_0x54cc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x54cc('0x4'));var logger=require(_0x54cc('0x5'))(_0x54cc('0x6'));var config=require(_0x54cc('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x54cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9f1af,_0x529032,_0x5ec096){return new BPromise(function(_0x30bdc0,_0x5e17e9){return client[_0x54cc('0x9')](_0x9f1af,_0x5ec096)[_0x54cc('0xa')](function(_0x4dbe91){logger[_0x54cc('0xb')](_0x54cc('0xc'),_0x529032,'request\x20sent');logger[_0x54cc('0xd')](_0x54cc('0xe'),_0x529032,_0x54cc('0xf'),JSON[_0x54cc('0x10')](_0x4dbe91));if(_0x4dbe91['error']){if(_0x4dbe91[_0x54cc('0x11')][_0x54cc('0x12')]===0x1f4){logger[_0x54cc('0x11')](_0x54cc('0xc'),_0x529032,_0x4dbe91['error'][_0x54cc('0x13')]);return _0x5e17e9(_0x4dbe91[_0x54cc('0x11')][_0x54cc('0x13')]);}logger[_0x54cc('0x11')](_0x54cc('0xc'),_0x529032,_0x4dbe91[_0x54cc('0x11')][_0x54cc('0x13')]);return _0x30bdc0(_0x4dbe91[_0x54cc('0x11')][_0x54cc('0x13')]);}else{logger[_0x54cc('0xb')](_0x54cc('0xc'),_0x529032,'request\x20sent');_0x30bdc0(_0x4dbe91[_0x54cc('0x14')][_0x54cc('0x13')]);}})['catch'](function(_0xb75453){logger['error'](_0x54cc('0xc'),_0x529032,_0xb75453);_0x5e17e9(_0xb75453);});});}exports[_0x54cc('0x15')]=function(_0x519a85){var _0x48cce4=this;return new Promise(function(_0x35c95c,_0x5ac6d1){return db[_0x54cc('0x16')][_0x54cc('0x17')]({'raw':_0x519a85[_0x54cc('0x18')]?_0x519a85[_0x54cc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x519a85[_0x54cc('0x18')]?_0x519a85[_0x54cc('0x18')]['where']||null:null,'attributes':_0x519a85['options']?_0x519a85['options']['attributes']||null:null,'limit':_0x519a85[_0x54cc('0x18')]?_0x519a85[_0x54cc('0x18')][_0x54cc('0x19')]||null:null,'include':_0x519a85[_0x54cc('0x18')]?_0x519a85[_0x54cc('0x18')][_0x54cc('0x1a')]?_['map'](_0x519a85[_0x54cc('0x18')]['include'],function(_0x161164){return{'model':db[_0x161164[_0x54cc('0x1b')]],'as':_0x161164['as'],'attributes':_0x161164[_0x54cc('0x1c')],'include':_0x161164[_0x54cc('0x1a')]?_[_0x54cc('0x1d')](_0x161164[_0x54cc('0x1a')],function(_0x47f8dd){return{'model':db[_0x47f8dd[_0x54cc('0x1b')]],'as':_0x47f8dd['as'],'attributes':_0x47f8dd[_0x54cc('0x1c')],'include':_0x47f8dd[_0x54cc('0x1a')]?_[_0x54cc('0x1d')](_0x47f8dd[_0x54cc('0x1a')],function(_0x46efc8){return{'model':db[_0x46efc8[_0x54cc('0x1b')]],'as':_0x46efc8['as'],'attributes':_0x46efc8[_0x54cc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x54cc('0xa')](function(_0x176a36){logger[_0x54cc('0xb')](_0x54cc('0x15'),_0x519a85);logger[_0x54cc('0xd')]('GetInterval',_0x519a85,JSON[_0x54cc('0x10')](_0x176a36));_0x35c95c(_0x176a36);})[_0x54cc('0x1e')](function(_0x16ff8d){logger[_0x54cc('0x11')](_0x54cc('0x15'),_0x16ff8d['message'],_0x519a85);_0x5ac6d1(_0x48cce4['error'](0x1f4,_0x16ff8d[_0x54cc('0x13')]));});});};exports[_0x54cc('0x1f')]=function(_0x5975eb){var _0x4728bd=this;return new Promise(function(_0x3bb491,_0x211562){return db[_0x54cc('0x16')]['find']({'raw':_0x5975eb[_0x54cc('0x18')]?_0x5975eb['options'][_0x54cc('0x20')]===undefined?!![]:![]:!![],'where':_0x5975eb[_0x54cc('0x18')]?_0x5975eb['options'][_0x54cc('0x21')]||null:null,'attributes':_0x5975eb[_0x54cc('0x18')]?_0x5975eb[_0x54cc('0x18')][_0x54cc('0x1c')]||null:null,'include':_0x5975eb[_0x54cc('0x18')]?_0x5975eb[_0x54cc('0x18')]['include']?_[_0x54cc('0x1d')](_0x5975eb['options'][_0x54cc('0x1a')],function(_0x500b54){return{'model':db[_0x500b54['model']],'as':_0x500b54['as'],'attributes':_0x500b54[_0x54cc('0x1c')],'include':_0x500b54['include']?_['map'](_0x500b54[_0x54cc('0x1a')],function(_0x410b9a){return{'model':db[_0x410b9a[_0x54cc('0x1b')]],'as':_0x410b9a['as'],'attributes':_0x410b9a['attributes'],'include':_0x410b9a['include']?_[_0x54cc('0x1d')](_0x410b9a[_0x54cc('0x1a')],function(_0x93797a){return{'model':db[_0x93797a['model']],'as':_0x93797a['as'],'attributes':_0x93797a[_0x54cc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x54cc('0xa')](function(_0x1ba8dd){logger[_0x54cc('0xb')](_0x54cc('0x1f'),_0x5975eb);logger['debug'](_0x54cc('0x1f'),_0x5975eb,JSON[_0x54cc('0x10')](_0x1ba8dd));_0x3bb491(_0x1ba8dd);})['catch'](function(_0x2f1f52){logger[_0x54cc('0x11')](_0x54cc('0x1f'),_0x2f1f52['message'],_0x5975eb);_0x211562(_0x4728bd[_0x54cc('0x11')](0x1f4,_0x2f1f52[_0x54cc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d46cc6b..30000e8 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed48=['isAuthenticated','send','exports','express','Router','./jira.controller','post'];(function(_0x3e4f32,_0x5db728){var _0x2c2359=function(_0x4722cf){while(--_0x4722cf){_0x3e4f32['push'](_0x3e4f32['shift']());}};_0x2c2359(++_0x5db728);}(_0xed48,0x176));var _0x8ed4=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xed48[_0x1e6659];return _0x4d16e4;};'use strict';var express=require(_0x8ed4('0x0'));var router=express[_0x8ed4('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x8ed4('0x2'));router[_0x8ed4('0x3')]('/',auth[_0x8ed4('0x4')](),controller[_0x8ed4('0x5')]);module[_0x8ed4('0x6')]=router; \ No newline at end of file +var _0xaa47=['express','../../components/auth/service','./jira.controller','post','isAuthenticated'];(function(_0x4bd2f7,_0x4e1416){var _0x45a91d=function(_0x3d33c8){while(--_0x3d33c8){_0x4bd2f7['push'](_0x4bd2f7['shift']());}};_0x45a91d(++_0x4e1416);}(_0xaa47,0x127));var _0x7aa4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xaa47[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7aa4('0x0'));var router=express['Router']();var auth=require(_0x7aa4('0x1'));var controller=require(_0x7aa4('0x2'));router[_0x7aa4('0x3')]('/',auth[_0x7aa4('0x4')](),controller['send']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 83274b1..1054e68 100644 --- a/server/api/jira/jira.controller.js +++ b/server/api/jira/jira.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecfb=['stringify','request','utf8','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','3eAmWpBVP0','MOTGUI','summary','Report','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','application/json','toString'];(function(_0x5f3a20,_0x10470d){var _0x59fc7c=function(_0x3cc287){while(--_0x3cc287){_0x5f3a20['push'](_0x5f3a20['shift']());}};_0x59fc7c(++_0x10470d);}(_0xecfb,0x140));var _0xbecf=function(_0x2ca4b9,_0x5c9dc2){_0x2ca4b9=_0x2ca4b9-0x0;var _0x418e60=_0xecfb[_0x2ca4b9];return _0x418e60;};'use strict';var BPromise=require(_0xbecf('0x0'));var https=require('https');var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0xbecf('0x1');function openIssue(_0x4d9e73,_0x4914da){var _0x6de441={'fields':{'project':{'key':_0x4d9e73['key']||_0xbecf('0x2')},'summary':(_0x4d9e73[_0xbecf('0x3')]||_0xbecf('0x4'))+'\x20from\x20'+_0x4d9e73['ip'],'description':_0x4d9e73['description']||JSON['stringify'](_0x4d9e73),'issuetype':{'name':_0x4d9e73[_0xbecf('0x5')]||_0xbecf('0x6')}}};_0x6de441[_0xbecf('0x7')][_0xbecf('0x8')]=_0x4d9e73[_0xbecf('0x9')];_0x6de441[_0xbecf('0x7')][_0xbecf('0xa')]=_0x4d9e73[_0xbecf('0xb')];_0x6de441['fields'][_0xbecf('0xc')]=_0x4d9e73[_0xbecf('0xd')];_0x6de441[_0xbecf('0x7')][_0xbecf('0xe')]=_0x4d9e73[_0xbecf('0xf')];_0x6de441['fields'][_0xbecf('0x10')]=_0x4d9e73[_0xbecf('0x11')];_0x6de441['fields']['customfield_10102']=_0x4d9e73['ip'];var _0x4cba1f={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xbecf('0x12'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xbecf('0x13')]('base64')}};var _0x293f5e=JSON[_0xbecf('0x14')](_0x6de441);var _0x2fbbda=https[_0xbecf('0x15')](_0x4cba1f,function(_0x415c08){_0x415c08['setEncoding'](_0xbecf('0x16'));var _0x410dc0='';_0x415c08['on']('data',function(_0x30a94e){_0x410dc0+=_0x30a94e;});_0x415c08['on'](_0xbecf('0x17'),function(){if(_0x4914da){return _0x4914da[_0xbecf('0x18')](_0x415c08[_0xbecf('0x19')])[_0xbecf('0x1a')](JSON[_0xbecf('0x1b')](_0x410dc0));}});});_0x2fbbda['on']('error',function(_0x3c4f1f){if(_0x4914da){return _0x4914da['status'](0x1f4)['json']({'errors':[{'message':_0xbecf('0x1c'),'type':'api.jira'}]});}});_0x2fbbda['write'](_0x293f5e);_0x2fbbda[_0xbecf('0x17')]();}exports['openIssue']=openIssue;exports['send']=function(_0x33165d,_0x7a8531){_0x33165d['body']['ip']=_0x33165d['headers'][_0xbecf('0x1d')]||_0x33165d[_0xbecf('0x1e')][_0xbecf('0x1f')]||_0x33165d[_0xbecf('0x20')]['remoteAddress']||_0x33165d[_0xbecf('0x1e')][_0xbecf('0x20')][_0xbecf('0x1f')];return openIssue(_0x33165d[_0xbecf('0x21')],_0x7a8531);}; \ No newline at end of file +var _0xfb32=['fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','request','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug'];(function(_0x36ae11,_0x162776){var _0x44ae0e=function(_0x235aaf){while(--_0x235aaf){_0x36ae11['push'](_0x36ae11['shift']());}};_0x44ae0e(++_0x162776);}(_0xfb32,0x154));var _0x2fb3=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0xfb32[_0x3005d5];return _0x547c7e;};'use strict';var BPromise=require(_0x2fb3('0x0'));var https=require(_0x2fb3('0x1'));var logger=require('../../config/logger')(_0x2fb3('0x2'));var USERNAME=_0x2fb3('0x3');var PASSWORD=_0x2fb3('0x4');function openIssue(_0x36aa04,_0x4ac79f){var _0x54e3ec={'fields':{'project':{'key':_0x36aa04['key']||_0x2fb3('0x5')},'summary':(_0x36aa04[_0x2fb3('0x6')]||'Report')+_0x2fb3('0x7')+_0x36aa04['ip'],'description':_0x36aa04[_0x2fb3('0x8')]||JSON[_0x2fb3('0x9')](_0x36aa04),'issuetype':{'name':_0x36aa04[_0x2fb3('0xa')]||_0x2fb3('0xb')}}};_0x54e3ec[_0x2fb3('0xc')][_0x2fb3('0xd')]=_0x36aa04[_0x2fb3('0xe')];_0x54e3ec[_0x2fb3('0xc')][_0x2fb3('0xf')]=_0x36aa04[_0x2fb3('0x10')];_0x54e3ec['fields']['customfield_11502']=_0x36aa04[_0x2fb3('0x11')];_0x54e3ec['fields'][_0x2fb3('0x12')]=_0x36aa04[_0x2fb3('0x13')];_0x54e3ec[_0x2fb3('0xc')]['customfield_11504']=_0x36aa04[_0x2fb3('0x14')];_0x54e3ec['fields'][_0x2fb3('0x15')]=_0x36aa04['ip'];var _0x2c9eff={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x2fb3('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x2fb3('0x17'),'Authorization':_0x2fb3('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x2fb3('0x19')]('base64')}};var _0x5d3b6a=JSON[_0x2fb3('0x9')](_0x54e3ec);var _0x59e771=https[_0x2fb3('0x1a')](_0x2c9eff,function(_0x587113){_0x587113['setEncoding'](_0x2fb3('0x1b'));var _0x27467c='';_0x587113['on']('data',function(_0x3f5f2b){_0x27467c+=_0x3f5f2b;});_0x587113['on'](_0x2fb3('0x1c'),function(){if(_0x4ac79f){return _0x4ac79f[_0x2fb3('0x1d')](_0x587113[_0x2fb3('0x1e')])[_0x2fb3('0x1f')](JSON[_0x2fb3('0x20')](_0x27467c));}});});_0x59e771['on'](_0x2fb3('0x21'),function(_0xbc34b6){if(_0x4ac79f){return _0x4ac79f[_0x2fb3('0x1d')](0x1f4)[_0x2fb3('0x1f')]({'errors':[{'message':_0x2fb3('0x22'),'type':_0x2fb3('0x23')}]});}});_0x59e771['write'](_0x5d3b6a);_0x59e771[_0x2fb3('0x1c')]();}exports[_0x2fb3('0x24')]=openIssue;exports[_0x2fb3('0x25')]=function(_0x100e7c,_0x3880c4){_0x100e7c[_0x2fb3('0x26')]['ip']=_0x100e7c[_0x2fb3('0x27')][_0x2fb3('0x28')]||_0x100e7c[_0x2fb3('0x29')]['remoteAddress']||_0x100e7c[_0x2fb3('0x2a')][_0x2fb3('0x2b')]||_0x100e7c['connection'][_0x2fb3('0x2a')][_0x2fb3('0x2b')];return openIssue(_0x100e7c[_0x2fb3('0x26')],_0x3880c4);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 26658de..46ca973 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa16f=['util','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','multer'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa16f,0x1c1));var _0xfa16=function(_0x2444c4,_0x44ca2b){_0x2444c4=_0x2444c4-0x0;var _0x20c6e4=_0xa16f[_0x2444c4];return _0x20c6e4;};'use strict';var multer=require(_0xfa16('0x0'));var util=require(_0xfa16('0x1'));var path=require('path');var timeout=require(_0xfa16('0x2'));var express=require('express');var router=express[_0xfa16('0x3')]();var auth=require(_0xfa16('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfa16('0x5'));var controller=require(_0xfa16('0x6'));router[_0xfa16('0x7')]('/',auth[_0xfa16('0x8')](),controller[_0xfa16('0x9')]);router[_0xfa16('0x7')](_0xfa16('0xa'),auth['isAuthenticated'](),controller[_0xfa16('0xb')]);router[_0xfa16('0x7')](_0xfa16('0xc'),auth[_0xfa16('0x8')](),controller['show']);router[_0xfa16('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa16('0xe')]);router['put'](_0xfa16('0xc'),auth[_0xfa16('0x8')](),controller['update']);router[_0xfa16('0xf')]('/:id',auth[_0xfa16('0x8')](),controller[_0xfa16('0x10')]);module[_0xfa16('0x11')]=router; \ No newline at end of file +var _0xb4fd=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','post','create','put','/:id','update'];(function(_0x85d56d,_0x37f5c1){var _0x51f613=function(_0x4927df){while(--_0x4927df){_0x85d56d['push'](_0x85d56d['shift']());}};_0x51f613(++_0x37f5c1);}(_0xb4fd,0x1bb));var _0xdb4f=function(_0x4e0fb5,_0x48f04d){_0x4e0fb5=_0x4e0fb5-0x0;var _0x192175=_0xb4fd[_0x4e0fb5];return _0x192175;};'use strict';var multer=require(_0xdb4f('0x0'));var util=require(_0xdb4f('0x1'));var path=require(_0xdb4f('0x2'));var timeout=require(_0xdb4f('0x3'));var express=require('express');var router=express[_0xdb4f('0x4')]();var auth=require(_0xdb4f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb4f('0x6'));var controller=require(_0xdb4f('0x7'));router['get']('/',auth[_0xdb4f('0x8')](),controller['index']);router[_0xdb4f('0x9')](_0xdb4f('0xa'),auth[_0xdb4f('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdb4f('0xb')]('/',auth[_0xdb4f('0x8')](),controller[_0xdb4f('0xc')]);router[_0xdb4f('0xd')](_0xdb4f('0xe'),auth[_0xdb4f('0x8')](),controller[_0xdb4f('0xf')]);router['delete'](_0xdb4f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xdb4f('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index ad3db5b..74ab23e 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42c6=['long','sequelize','exports','STRING','TEXT'];(function(_0x23d406,_0x2fcbdc){var _0x31d194=function(_0x55e509){while(--_0x55e509){_0x23d406['push'](_0x23d406['shift']());}};_0x31d194(++_0x2fcbdc);}(_0x42c6,0x14b));var _0x642c=function(_0x3b12b4,_0x5a5937){_0x3b12b4=_0x3b12b4-0x0;var _0x4f4055=_0x42c6[_0x3b12b4];return _0x4f4055;};'use strict';var Sequelize=require(_0x642c('0x0'));module[_0x642c('0x1')]={'question':{'type':Sequelize[_0x642c('0x2')]},'answer':{'type':Sequelize[_0x642c('0x3')](_0x642c('0x4'))},'membername':{'type':Sequelize[_0x642c('0x2')]},'projectname':{'type':Sequelize[_0x642c('0x2')]},'queue':{'type':Sequelize[_0x642c('0x2')]},'uniqueid':{'type':Sequelize[_0x642c('0x2')]},'calleridname':{'type':Sequelize[_0x642c('0x2')]},'calleridnum':{'type':Sequelize[_0x642c('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb053=['STRING','sequelize','TEXT','long'];(function(_0x6ec798,_0x2af2e){var _0x48c829=function(_0x4e0b14){while(--_0x4e0b14){_0x6ec798['push'](_0x6ec798['shift']());}};_0x48c829(++_0x2af2e);}(_0xb053,0x10d));var _0x3b05=function(_0xe9ae4d,_0x8e268e){_0xe9ae4d=_0xe9ae4d-0x0;var _0x3a11da=_0xb053[_0xe9ae4d];return _0x3a11da;};'use strict';var Sequelize=require(_0x3b05('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x3b05('0x1')](_0x3b05('0x2'))},'membername':{'type':Sequelize[_0x3b05('0x3')]},'projectname':{'type':Sequelize[_0x3b05('0x3')]},'queue':{'type':Sequelize[_0x3b05('0x3')]},'uniqueid':{'type':Sequelize[_0x3b05('0x3')]},'calleridname':{'type':Sequelize[_0x3b05('0x3')]},'calleridnum':{'type':Sequelize[_0x3b05('0x3')]},'questionId':{'type':Sequelize[_0x3b05('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 8303333..2bfe259 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb26=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','index','JscriptyAnswerReport'];(function(_0x5f4b36,_0x18cb34){var _0x4765ec=function(_0x2a6c85){while(--_0x2a6c85){_0x5f4b36['push'](_0x5f4b36['shift']());}};_0x4765ec(++_0x18cb34);}(_0xbb26,0x102));var _0x6bb2=function(_0x11ff2a,_0x1f29ff){_0x11ff2a=_0x11ff2a-0x0;var _0x21134e=_0xbb26[_0x11ff2a];return _0x21134e;};'use strict';var pdf=require(_0x6bb2('0x0'));var emlformat=require(_0x6bb2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6bb2('0x2'));var jsonpatch=require(_0x6bb2('0x3'));var rp=require(_0x6bb2('0x4'));var moment=require(_0x6bb2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6bb2('0x6'));var util=require(_0x6bb2('0x7'));var path=require(_0x6bb2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6bb2('0x9'));var fs=require('fs');var _=require(_0x6bb2('0xa'));var squel=require(_0x6bb2('0xb'));var crypto=require(_0x6bb2('0xc'));var jsforce=require(_0x6bb2('0xd'));var deskjs=require(_0x6bb2('0xe'));var toCsv=require(_0x6bb2('0xf'));var querystring=require('querystring');var Papa=require(_0x6bb2('0x10'));var Redis=require('ioredis');var authService=require(_0x6bb2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6bb2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bb2('0x13'))(_0x6bb2('0x14'));var utils=require(_0x6bb2('0x15'));var config=require(_0x6bb2('0x16'));var licenseUtil=require(_0x6bb2('0x17'));var db=require(_0x6bb2('0x18'))['db'];function respondWithStatusCode(_0xa6e219,_0xc2c34d){_0xc2c34d=_0xc2c34d||0xcc;return function(_0x12c0a4){if(_0x12c0a4){return _0xa6e219['sendStatus'](_0xc2c34d);}return _0xa6e219[_0x6bb2('0x19')](_0xc2c34d)[_0x6bb2('0x1a')]();};}function respondWithResult(_0x144e27,_0x29cc6b){_0x29cc6b=_0x29cc6b||0xc8;return function(_0x475853){if(_0x475853){return _0x144e27[_0x6bb2('0x19')](_0x29cc6b)[_0x6bb2('0x1b')](_0x475853);}};}function respondWithFilteredResult(_0x1807e8,_0x4fa536){return function(_0x181f44){if(_0x181f44){var _0x3ee89f=_0x181f44[_0x6bb2('0x1c')],_0x1d551b=_0x4fa536[_0x6bb2('0x1d')],_0xcd705e=_0x4fa536[_0x6bb2('0x1d')]+_0x4fa536[_0x6bb2('0x1e')],_0x20914f;if(_0xcd705e>=_0x3ee89f){_0xcd705e=_0x3ee89f;_0x20914f=0xc8;}else{_0x20914f=0xce;}_0x1807e8[_0x6bb2('0x19')](_0x20914f);return _0x1807e8[_0x6bb2('0x1f')]('Content-Range',_0x1d551b+'-'+_0xcd705e+'/'+_0x3ee89f)[_0x6bb2('0x1b')](_0x181f44);}return null;};}function patchUpdates(_0x4c4a8e){return function(_0x2a4a0f){try{jsonpatch[_0x6bb2('0x20')](_0x2a4a0f,_0x4c4a8e,!![]);}catch(_0x5eaa17){return BPromise[_0x6bb2('0x21')](_0x5eaa17);}return _0x2a4a0f[_0x6bb2('0x22')]();};}function saveUpdates(_0xb2d2ab,_0x4c8de5){return function(_0x4624e9){if(_0x4624e9){return _0x4624e9['update'](_0xb2d2ab)[_0x6bb2('0x23')](function(_0x42c438){return _0x42c438;});}return null;};}function removeEntity(_0x44e407,_0x47c857){return function(_0xed5e3e){if(_0xed5e3e){return _0xed5e3e[_0x6bb2('0x24')]()[_0x6bb2('0x23')](function(){_0x44e407[_0x6bb2('0x19')](0xcc)[_0x6bb2('0x1a')]();});}};}function handleEntityNotFound(_0x416792,_0x26a06f){return function(_0x33869b){if(!_0x33869b){_0x416792['sendStatus'](0x194);}return _0x33869b;};}function handleError(_0x210e78,_0x3028a9){_0x3028a9=_0x3028a9||0x1f4;return function(_0xe58d92){logger[_0x6bb2('0x25')](_0xe58d92[_0x6bb2('0x26')]);if(_0xe58d92['name']){delete _0xe58d92[_0x6bb2('0x27')];}_0x210e78[_0x6bb2('0x19')](_0x3028a9)['send'](_0xe58d92);};}exports[_0x6bb2('0x28')]=function(_0x4ef365,_0x5e22bd){var _0x819530={},_0x98e7a8={},_0x35a3e8={'count':0x0,'rows':[]};var _0x1731c2=_['map'](db[_0x6bb2('0x29')][_0x6bb2('0x2a')],function(_0x566fc1){return{'name':_0x566fc1[_0x6bb2('0x2b')],'type':_0x566fc1[_0x6bb2('0x2c')][_0x6bb2('0x2d')]};});_0x98e7a8[_0x6bb2('0x2e')]=_[_0x6bb2('0x2f')](_0x1731c2,'name');_0x98e7a8[_0x6bb2('0x30')]=_[_0x6bb2('0x31')](_0x4ef365[_0x6bb2('0x30')]);_0x98e7a8[_0x6bb2('0x32')]=_[_0x6bb2('0x33')](_0x98e7a8[_0x6bb2('0x2e')],_0x98e7a8[_0x6bb2('0x30')]);_0x819530[_0x6bb2('0x34')]=_['intersection'](_0x98e7a8[_0x6bb2('0x2e')],qs[_0x6bb2('0x35')](_0x4ef365['query'][_0x6bb2('0x35')]));_0x819530['attributes']=_0x819530[_0x6bb2('0x34')][_0x6bb2('0x36')]?_0x819530['attributes']:_0x98e7a8['model'];if(!_0x4ef365['query'][_0x6bb2('0x37')]('nolimit')){_0x819530[_0x6bb2('0x1e')]=qs[_0x6bb2('0x1e')](_0x4ef365['query'][_0x6bb2('0x1e')]);_0x819530[_0x6bb2('0x1d')]=qs['offset'](_0x4ef365[_0x6bb2('0x30')]['offset']);}_0x819530[_0x6bb2('0x38')]=qs[_0x6bb2('0x39')](_0x4ef365[_0x6bb2('0x30')][_0x6bb2('0x39')]);_0x819530[_0x6bb2('0x3a')]=qs['filters'](_[_0x6bb2('0x3b')](_0x4ef365[_0x6bb2('0x30')],_0x98e7a8[_0x6bb2('0x32')]),_0x1731c2);if(_0x4ef365[_0x6bb2('0x30')][_0x6bb2('0x3c')]){_0x819530['where']=_[_0x6bb2('0x3d')](_0x819530[_0x6bb2('0x3a')],{'$or':_['map'](_0x1731c2,function(_0x1bdc68){if(_0x1bdc68[_0x6bb2('0x2c')]!=='VIRTUAL'){var _0x5b50a0={};_0x5b50a0[_0x1bdc68['name']]={'$like':'%'+_0x4ef365[_0x6bb2('0x30')][_0x6bb2('0x3c')]+'%'};return _0x5b50a0;}})});}_0x819530=_[_0x6bb2('0x3d')]({},_0x819530,_0x4ef365[_0x6bb2('0x3e')]);var _0x44089c={'where':_0x819530[_0x6bb2('0x3a')]};return db['JscriptyAnswerReport']['count'](_0x44089c)[_0x6bb2('0x23')](function(_0x39d06e){_0x35a3e8[_0x6bb2('0x1c')]=_0x39d06e;if(_0x4ef365[_0x6bb2('0x30')][_0x6bb2('0x3f')]){_0x819530[_0x6bb2('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x6bb2('0x41')](_0x819530);})[_0x6bb2('0x23')](function(_0xd3ec7c){_0x35a3e8[_0x6bb2('0x42')]=_0xd3ec7c;return _0x35a3e8;})[_0x6bb2('0x23')](respondWithFilteredResult(_0x5e22bd,_0x819530))[_0x6bb2('0x43')](handleError(_0x5e22bd,null));};exports[_0x6bb2('0x44')]=function(_0x4a9192,_0x1b7229){var _0xa914e6={'raw':!![],'where':{'id':_0x4a9192[_0x6bb2('0x45')]['id']}},_0x4ec803={};_0x4ec803[_0x6bb2('0x2e')]=_[_0x6bb2('0x31')](db[_0x6bb2('0x29')][_0x6bb2('0x2a')]);_0x4ec803['query']=_[_0x6bb2('0x31')](_0x4a9192[_0x6bb2('0x30')]);_0x4ec803[_0x6bb2('0x32')]=_[_0x6bb2('0x33')](_0x4ec803[_0x6bb2('0x2e')],_0x4ec803[_0x6bb2('0x30')]);_0xa914e6[_0x6bb2('0x34')]=_['intersection'](_0x4ec803[_0x6bb2('0x2e')],qs[_0x6bb2('0x35')](_0x4a9192['query'][_0x6bb2('0x35')]));_0xa914e6[_0x6bb2('0x34')]=_0xa914e6[_0x6bb2('0x34')][_0x6bb2('0x36')]?_0xa914e6['attributes']:_0x4ec803[_0x6bb2('0x2e')];if(_0x4a9192[_0x6bb2('0x30')][_0x6bb2('0x3f')]){_0xa914e6[_0x6bb2('0x40')]=[{'all':!![]}];}_0xa914e6=_[_0x6bb2('0x3d')]({},_0xa914e6,_0x4a9192[_0x6bb2('0x3e')]);return db[_0x6bb2('0x29')][_0x6bb2('0x46')](_0xa914e6)[_0x6bb2('0x23')](handleEntityNotFound(_0x1b7229,null))['then'](respondWithResult(_0x1b7229,null))[_0x6bb2('0x43')](handleError(_0x1b7229,null));};exports['create']=function(_0x5e5cc0,_0x35a706){return db[_0x6bb2('0x29')][_0x6bb2('0x47')](_0x5e5cc0[_0x6bb2('0x48')],{})[_0x6bb2('0x23')](respondWithResult(_0x35a706,0xc9))[_0x6bb2('0x43')](handleError(_0x35a706,null));};exports[_0x6bb2('0x49')]=function(_0x24237e,_0x2504a6){if(_0x24237e[_0x6bb2('0x48')]['id']){delete _0x24237e[_0x6bb2('0x48')]['id'];}return db[_0x6bb2('0x29')][_0x6bb2('0x46')]({'where':{'id':_0x24237e[_0x6bb2('0x45')]['id']}})[_0x6bb2('0x23')](handleEntityNotFound(_0x2504a6,null))[_0x6bb2('0x23')](saveUpdates(_0x24237e[_0x6bb2('0x48')],null))['then'](respondWithResult(_0x2504a6,null))[_0x6bb2('0x43')](handleError(_0x2504a6,null));};exports[_0x6bb2('0x24')]=function(_0x587006,_0x359303){return db[_0x6bb2('0x29')]['find']({'where':{'id':_0x587006['params']['id']}})['then'](handleEntityNotFound(_0x359303,null))['then'](removeEntity(_0x359303,null))['catch'](handleError(_0x359303,null));};exports['describe']=function(_0x4f9df2,_0x5c71ef){return db[_0x6bb2('0x29')][_0x6bb2('0x4a')]()['then'](respondWithResult(_0x5c71ef,null))['catch'](handleError(_0x5c71ef,null));}; \ No newline at end of file +var _0x0a43=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','JscriptyAnswerReport','rows','catch','show','params','keys','intersection','fields','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x0a43,0x163));var _0x30a4=function(_0x4d0519,_0x321bb9){_0x4d0519=_0x4d0519-0x0;var _0x27e926=_0x0a43[_0x4d0519];return _0x27e926;};'use strict';var pdf=require(_0x30a4('0x0'));var emlformat=require(_0x30a4('0x1'));var rimraf=require(_0x30a4('0x2'));var zipdir=require(_0x30a4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30a4('0x4'));var moment=require(_0x30a4('0x5'));var BPromise=require(_0x30a4('0x6'));var Mustache=require(_0x30a4('0x7'));var util=require(_0x30a4('0x8'));var path=require(_0x30a4('0x9'));var sox=require('sox');var csv=require(_0x30a4('0xa'));var ejs=require(_0x30a4('0xb'));var fs=require('fs');var _=require(_0x30a4('0xc'));var squel=require(_0x30a4('0xd'));var crypto=require(_0x30a4('0xe'));var jsforce=require(_0x30a4('0xf'));var deskjs=require(_0x30a4('0x10'));var toCsv=require(_0x30a4('0xa'));var querystring=require(_0x30a4('0x11'));var Papa=require(_0x30a4('0x12'));var Redis=require('ioredis');var authService=require(_0x30a4('0x13'));var qs=require(_0x30a4('0x14'));var as=require(_0x30a4('0x15'));var hardwareService=require(_0x30a4('0x16'));var logger=require(_0x30a4('0x17'))(_0x30a4('0x18'));var utils=require(_0x30a4('0x19'));var config=require(_0x30a4('0x1a'));var licenseUtil=require(_0x30a4('0x1b'));var db=require(_0x30a4('0x1c'))['db'];function respondWithStatusCode(_0x37f4ae,_0x1e90c8){_0x1e90c8=_0x1e90c8||0xcc;return function(_0x6c0885){if(_0x6c0885){return _0x37f4ae[_0x30a4('0x1d')](_0x1e90c8);}return _0x37f4ae[_0x30a4('0x1e')](_0x1e90c8)[_0x30a4('0x1f')]();};}function respondWithResult(_0x6651ae,_0x4c03d7){_0x4c03d7=_0x4c03d7||0xc8;return function(_0x2c9a40){if(_0x2c9a40){return _0x6651ae['status'](_0x4c03d7)[_0x30a4('0x20')](_0x2c9a40);}};}function respondWithFilteredResult(_0x576715,_0x1bb9d8){return function(_0x2a678a){if(_0x2a678a){var _0x22aff6=_0x2a678a[_0x30a4('0x21')],_0x378863=_0x1bb9d8['offset'],_0x41c7df=_0x1bb9d8[_0x30a4('0x22')]+_0x1bb9d8[_0x30a4('0x23')],_0x3bea69;if(_0x41c7df>=_0x22aff6){_0x41c7df=_0x22aff6;_0x3bea69=0xc8;}else{_0x3bea69=0xce;}_0x576715['status'](_0x3bea69);return _0x576715[_0x30a4('0x24')]('Content-Range',_0x378863+'-'+_0x41c7df+'/'+_0x22aff6)[_0x30a4('0x20')](_0x2a678a);}return null;};}function patchUpdates(_0x5a6a67){return function(_0x4e5f3f){try{jsonpatch[_0x30a4('0x25')](_0x4e5f3f,_0x5a6a67,!![]);}catch(_0x30f7f1){return BPromise['reject'](_0x30f7f1);}return _0x4e5f3f[_0x30a4('0x26')]();};}function saveUpdates(_0x32fd84,_0x29f147){return function(_0x34df8e){if(_0x34df8e){return _0x34df8e[_0x30a4('0x27')](_0x32fd84)[_0x30a4('0x28')](function(_0x58753a){return _0x58753a;});}return null;};}function removeEntity(_0x2d1f0d,_0x2855f8){return function(_0x3d36a3){if(_0x3d36a3){return _0x3d36a3[_0x30a4('0x29')]()[_0x30a4('0x28')](function(){_0x2d1f0d[_0x30a4('0x1e')](0xcc)[_0x30a4('0x1f')]();});}};}function handleEntityNotFound(_0x20d1d6,_0x3dfcc6){return function(_0x46dc0e){if(!_0x46dc0e){_0x20d1d6[_0x30a4('0x1d')](0x194);}return _0x46dc0e;};}function handleError(_0x5405e6,_0x4de3d3){_0x4de3d3=_0x4de3d3||0x1f4;return function(_0x277561){logger[_0x30a4('0x2a')](_0x277561[_0x30a4('0x2b')]);if(_0x277561[_0x30a4('0x2c')]){delete _0x277561[_0x30a4('0x2c')];}_0x5405e6['status'](_0x4de3d3)[_0x30a4('0x2d')](_0x277561);};}exports[_0x30a4('0x2e')]=function(_0x1ffd3f,_0x59d21f){var _0x1757db={},_0x4bb300={},_0x58e7b5={'count':0x0,'rows':[]};var _0x517876=_[_0x30a4('0x2f')](db['JscriptyAnswerReport'][_0x30a4('0x30')],function(_0xb84145){return{'name':_0xb84145[_0x30a4('0x31')],'type':_0xb84145[_0x30a4('0x32')]['key']};});_0x4bb300[_0x30a4('0x33')]=_['map'](_0x517876,_0x30a4('0x2c'));_0x4bb300[_0x30a4('0x34')]=_['keys'](_0x1ffd3f[_0x30a4('0x34')]);_0x4bb300['filters']=_['intersection'](_0x4bb300[_0x30a4('0x33')],_0x4bb300['query']);_0x1757db[_0x30a4('0x35')]=_['intersection'](_0x4bb300[_0x30a4('0x33')],qs['fields'](_0x1ffd3f[_0x30a4('0x34')]['fields']));_0x1757db['attributes']=_0x1757db[_0x30a4('0x35')]['length']?_0x1757db[_0x30a4('0x35')]:_0x4bb300[_0x30a4('0x33')];if(!_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x36')](_0x30a4('0x37'))){_0x1757db[_0x30a4('0x23')]=qs[_0x30a4('0x23')](_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x23')]);_0x1757db[_0x30a4('0x22')]=qs[_0x30a4('0x22')](_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x22')]);}_0x1757db['order']=qs[_0x30a4('0x38')](_0x1ffd3f[_0x30a4('0x34')]['sort']);_0x1757db['where']=qs[_0x30a4('0x39')](_[_0x30a4('0x3a')](_0x1ffd3f[_0x30a4('0x34')],_0x4bb300[_0x30a4('0x39')]),_0x517876);if(_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x3b')]){_0x1757db[_0x30a4('0x3c')]=_[_0x30a4('0x3d')](_0x1757db['where'],{'$or':_[_0x30a4('0x2f')](_0x517876,function(_0x29af6e){if(_0x29af6e[_0x30a4('0x32')]!==_0x30a4('0x3e')){var _0x166477={};_0x166477[_0x29af6e['name']]={'$like':'%'+_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x3b')]+'%'};return _0x166477;}})});}_0x1757db=_[_0x30a4('0x3d')]({},_0x1757db,_0x1ffd3f['options']);var _0x5a4956={'where':_0x1757db[_0x30a4('0x3c')]};return db['JscriptyAnswerReport'][_0x30a4('0x21')](_0x5a4956)['then'](function(_0x336df6){_0x58e7b5[_0x30a4('0x21')]=_0x336df6;if(_0x1ffd3f[_0x30a4('0x34')]['includeAll']){_0x1757db[_0x30a4('0x3f')]=[{'all':!![]}];}return db[_0x30a4('0x40')]['findAll'](_0x1757db);})['then'](function(_0x59eec0){_0x58e7b5[_0x30a4('0x41')]=_0x59eec0;return _0x58e7b5;})[_0x30a4('0x28')](respondWithFilteredResult(_0x59d21f,_0x1757db))[_0x30a4('0x42')](handleError(_0x59d21f,null));};exports[_0x30a4('0x43')]=function(_0x314d1d,_0x4e0dc9){var _0x37998c={'raw':!![],'where':{'id':_0x314d1d[_0x30a4('0x44')]['id']}},_0xdaf14={};_0xdaf14[_0x30a4('0x33')]=_[_0x30a4('0x45')](db['JscriptyAnswerReport']['rawAttributes']);_0xdaf14[_0x30a4('0x34')]=_[_0x30a4('0x45')](_0x314d1d[_0x30a4('0x34')]);_0xdaf14[_0x30a4('0x39')]=_[_0x30a4('0x46')](_0xdaf14['model'],_0xdaf14['query']);_0x37998c[_0x30a4('0x35')]=_[_0x30a4('0x46')](_0xdaf14['model'],qs[_0x30a4('0x47')](_0x314d1d[_0x30a4('0x34')][_0x30a4('0x47')]));_0x37998c[_0x30a4('0x35')]=_0x37998c[_0x30a4('0x35')][_0x30a4('0x48')]?_0x37998c[_0x30a4('0x35')]:_0xdaf14['model'];if(_0x314d1d[_0x30a4('0x34')]['includeAll']){_0x37998c[_0x30a4('0x3f')]=[{'all':!![]}];}_0x37998c=_[_0x30a4('0x3d')]({},_0x37998c,_0x314d1d['options']);return db['JscriptyAnswerReport'][_0x30a4('0x49')](_0x37998c)['then'](handleEntityNotFound(_0x4e0dc9,null))['then'](respondWithResult(_0x4e0dc9,null))[_0x30a4('0x42')](handleError(_0x4e0dc9,null));};exports[_0x30a4('0x4a')]=function(_0x598175,_0xabfb){return db[_0x30a4('0x40')]['create'](_0x598175['body'],{})[_0x30a4('0x28')](respondWithResult(_0xabfb,0xc9))[_0x30a4('0x42')](handleError(_0xabfb,null));};exports[_0x30a4('0x27')]=function(_0x3c4662,_0x11b3c6){if(_0x3c4662['body']['id']){delete _0x3c4662[_0x30a4('0x4b')]['id'];}return db[_0x30a4('0x40')][_0x30a4('0x49')]({'where':{'id':_0x3c4662[_0x30a4('0x44')]['id']}})[_0x30a4('0x28')](handleEntityNotFound(_0x11b3c6,null))['then'](saveUpdates(_0x3c4662[_0x30a4('0x4b')],null))[_0x30a4('0x28')](respondWithResult(_0x11b3c6,null))['catch'](handleError(_0x11b3c6,null));};exports[_0x30a4('0x29')]=function(_0x403027,_0x29c115){return db[_0x30a4('0x40')]['find']({'where':{'id':_0x403027[_0x30a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x29c115,null))[_0x30a4('0x28')](removeEntity(_0x29c115,null))[_0x30a4('0x42')](handleError(_0x29c115,null));};exports['describe']=function(_0x36fdfb,_0x9139c9){return db[_0x30a4('0x40')]['describe']()[_0x30a4('0x28')](respondWithResult(_0x9139c9,null))[_0x30a4('0x42')](handleError(_0x9139c9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 128e32f..ad50668 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6f8=['request-promise','path','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment'];(function(_0x1adcc7,_0x361dac){var _0x5c22bb=function(_0x2997a0){while(--_0x2997a0){_0x1adcc7['push'](_0x1adcc7['shift']());}};_0x5c22bb(++_0x361dac);}(_0xa6f8,0x103));var _0x8a6f=function(_0x4c7d23,_0x1eed42){_0x4c7d23=_0x4c7d23-0x0;var _0x4bd04c=_0xa6f8[_0x4c7d23];return _0x4bd04c;};'use strict';var _=require(_0x8a6f('0x0'));var util=require(_0x8a6f('0x1'));var logger=require(_0x8a6f('0x2'))(_0x8a6f('0x3'));var moment=require(_0x8a6f('0x4'));var BPromise=require('bluebird');var rp=require(_0x8a6f('0x5'));var fs=require('fs');var path=require(_0x8a6f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a6f('0x7'));module[_0x8a6f('0x8')]=function(_0xf868,_0x470955){return _0xf868[_0x8a6f('0x9')](_0x8a6f('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab1a=['request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','bluebird'];(function(_0x14eac5,_0x5d7549){var _0x223eb6=function(_0x892d56){while(--_0x892d56){_0x14eac5['push'](_0x14eac5['shift']());}};_0x223eb6(++_0x5d7549);}(_0xab1a,0x1d0));var _0xaab1=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xab1a[_0x548200];return _0x1a6d74;};'use strict';var _=require('lodash');var util=require(_0xaab1('0x0'));var logger=require(_0xaab1('0x1'))(_0xaab1('0x2'));var moment=require('moment');var BPromise=require(_0xaab1('0x3'));var rp=require(_0xaab1('0x4'));var fs=require('fs');var path=require(_0xaab1('0x5'));var rimraf=require('rimraf');var config=require(_0xaab1('0x6'));var attributes=require(_0xaab1('0x7'));module[_0xaab1('0x8')]=function(_0xfb40a2,_0x2ee709){return _0xfb40a2[_0xaab1('0x9')](_0xaab1('0xa'),attributes,{'tableName':_0xaab1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index fd2cd95..f095dc0 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b92=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3b92,0x1ae));var _0x23b9=function(_0x30a3b1,_0x4efb8a){_0x30a3b1=_0x30a3b1-0x0;var _0x32051b=_0x3b92[_0x30a3b1];return _0x32051b;};'use strict';var _=require(_0x23b9('0x0'));var util=require(_0x23b9('0x1'));var moment=require(_0x23b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x23b9('0x3'));var fs=require('fs');var Redis=require(_0x23b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x23b9('0x5'));var logger=require(_0x23b9('0x6'))(_0x23b9('0x7'));var config=require(_0x23b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23b9('0x9')][_0x23b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x170750,_0x396827,_0x3e8197){return new BPromise(function(_0x33d1e2,_0x1b42bd){return client[_0x23b9('0xb')](_0x170750,_0x3e8197)[_0x23b9('0xc')](function(_0x5453bf){logger['info'](_0x23b9('0xd'),_0x396827,'request\x20sent');logger[_0x23b9('0xe')](_0x23b9('0xf'),_0x396827,_0x23b9('0x10'),JSON[_0x23b9('0x11')](_0x5453bf));if(_0x5453bf[_0x23b9('0x12')]){if(_0x5453bf[_0x23b9('0x12')][_0x23b9('0x13')]===0x1f4){logger['error'](_0x23b9('0xd'),_0x396827,_0x5453bf[_0x23b9('0x12')]['message']);return _0x1b42bd(_0x5453bf[_0x23b9('0x12')][_0x23b9('0x14')]);}logger[_0x23b9('0x12')](_0x23b9('0xd'),_0x396827,_0x5453bf[_0x23b9('0x12')][_0x23b9('0x14')]);return _0x33d1e2(_0x5453bf[_0x23b9('0x12')]['message']);}else{logger[_0x23b9('0x15')](_0x23b9('0xd'),_0x396827,'request\x20sent');_0x33d1e2(_0x5453bf[_0x23b9('0x16')][_0x23b9('0x14')]);}})[_0x23b9('0x17')](function(_0x51634a){logger[_0x23b9('0x12')](_0x23b9('0xd'),_0x396827,_0x51634a);_0x1b42bd(_0x51634a);});});} \ No newline at end of file +var _0x7a77=['client','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x7a77,0x157));var _0x77a7=function(_0x1454a5,_0x279153){_0x1454a5=_0x1454a5-0x0;var _0xc9b661=_0x7a77[_0x1454a5];return _0xc9b661;};'use strict';var _=require(_0x77a7('0x0'));var util=require('util');var moment=require(_0x77a7('0x1'));var BPromise=require(_0x77a7('0x2'));var rs=require(_0x77a7('0x3'));var fs=require('fs');var Redis=require(_0x77a7('0x4'));var db=require(_0x77a7('0x5'))['db'];var utils=require(_0x77a7('0x6'));var logger=require(_0x77a7('0x7'))('rpc');var config=require(_0x77a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1afd13,_0x140880,_0x12334f){return new BPromise(function(_0x560ea6,_0x413657){return client[_0x77a7('0xa')](_0x1afd13,_0x12334f)['then'](function(_0x2eb81b){logger[_0x77a7('0xb')](_0x77a7('0xc'),_0x140880,_0x77a7('0xd'));logger[_0x77a7('0xe')](_0x77a7('0xf'),_0x140880,'request\x20sent',JSON[_0x77a7('0x10')](_0x2eb81b));if(_0x2eb81b['error']){if(_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x12')]===0x1f4){logger[_0x77a7('0x11')](_0x77a7('0xc'),_0x140880,_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x13')]);return _0x413657(_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x13')]);}logger[_0x77a7('0x11')](_0x77a7('0xc'),_0x140880,_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x13')]);return _0x560ea6(_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x13')]);}else{logger[_0x77a7('0xb')](_0x77a7('0xc'),_0x140880,_0x77a7('0xd'));_0x560ea6(_0x2eb81b[_0x77a7('0x14')][_0x77a7('0x13')]);}})[_0x77a7('0x15')](function(_0x12f23e){logger[_0x77a7('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x140880,_0x12f23e);_0x413657(_0x12f23e);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5b5434d..c970ee0 100644 --- a/server/api/jscriptyProject/index.js +++ b/server/api/jscriptyProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa69=['/:id','update','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','/:id/clone','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfa69,0xac));var _0x9fa6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xfa69[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x9fa6('0x0'));var util=require('util');var path=require(_0x9fa6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9fa6('0x2')]();var auth=require(_0x9fa6('0x3'));var interaction=require(_0x9fa6('0x4'));var config=require(_0x9fa6('0x5'));var controller=require(_0x9fa6('0x6'));router[_0x9fa6('0x7')]('/',auth['isAuthenticated'](),controller[_0x9fa6('0x8')]);router['get']('/:id',auth[_0x9fa6('0x9')](),controller[_0x9fa6('0xa')]);router[_0x9fa6('0x7')](_0x9fa6('0xb'),auth[_0x9fa6('0x9')](),controller[_0x9fa6('0xc')]);router[_0x9fa6('0x7')](_0x9fa6('0xd'),auth[_0x9fa6('0x9')](),controller['getAnswers']);router[_0x9fa6('0x7')](_0x9fa6('0xe'),auth['isAuthenticated'](),timeout(_0x9fa6('0xf')),controller[_0x9fa6('0x10')]);router[_0x9fa6('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9fa6('0x11')](_0x9fa6('0x12'),auth[_0x9fa6('0x9')](),controller['clone']);router[_0x9fa6('0x13')](_0x9fa6('0x14'),auth[_0x9fa6('0x9')](),controller[_0x9fa6('0x15')]);router['delete'](_0x9fa6('0x14'),auth['isAuthenticated'](),controller[_0x9fa6('0x16')]);module[_0x9fa6('0x17')]=router; \ No newline at end of file +var _0xd6ba=['get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','multer','path','connect-timeout','express','Router','../../config/environment'];(function(_0x3aa5ef,_0x44d5aa){var _0x567c02=function(_0x396830){while(--_0x396830){_0x3aa5ef['push'](_0x3aa5ef['shift']());}};_0x567c02(++_0x44d5aa);}(_0xd6ba,0x1f2));var _0xad6b=function(_0x94dc02,_0x12ac8f){_0x94dc02=_0x94dc02-0x0;var _0x38c9ea=_0xd6ba[_0x94dc02];return _0x38c9ea;};'use strict';var multer=require(_0xad6b('0x0'));var util=require('util');var path=require(_0xad6b('0x1'));var timeout=require(_0xad6b('0x2'));var express=require(_0xad6b('0x3'));var router=express[_0xad6b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xad6b('0x5'));var controller=require('./jscriptyProject.controller');router[_0xad6b('0x6')]('/',auth['isAuthenticated'](),controller[_0xad6b('0x7')]);router[_0xad6b('0x6')](_0xad6b('0x8'),auth[_0xad6b('0x9')](),controller[_0xad6b('0xa')]);router[_0xad6b('0x6')](_0xad6b('0xb'),auth[_0xad6b('0x9')](),controller[_0xad6b('0xc')]);router[_0xad6b('0x6')](_0xad6b('0xd'),auth['isAuthenticated'](),controller[_0xad6b('0xe')]);router[_0xad6b('0x6')]('/:id/summary',auth[_0xad6b('0x9')](),timeout(_0xad6b('0xf')),controller[_0xad6b('0x10')]);router[_0xad6b('0x11')]('/',auth[_0xad6b('0x9')](),controller[_0xad6b('0x12')]);router[_0xad6b('0x11')](_0xad6b('0x13'),auth['isAuthenticated'](),controller[_0xad6b('0x14')]);router[_0xad6b('0x15')](_0xad6b('0x8'),auth[_0xad6b('0x9')](),controller[_0xad6b('0x16')]);router[_0xad6b('0x17')](_0xad6b('0x8'),auth[_0xad6b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f54e408..33cf28b 100644 --- a/server/api/jscriptyProject/jscriptyProject.attributes.js +++ b/server/api/jscriptyProject/jscriptyProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9684=['exports','STRING','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize','lodash','util'];(function(_0x45195c,_0x4cf76a){var _0x4f8a99=function(_0x5b6582){while(--_0x5b6582){_0x45195c['push'](_0x45195c['shift']());}};_0x4f8a99(++_0x4cf76a);}(_0x9684,0x75));var _0x4968=function(_0x58b670,_0x1d160d){_0x58b670=_0x58b670-0x0;var _0x5d731a=_0x9684[_0x58b670];return _0x5d731a;};'use strict';var Sequelize=require(_0x4968('0x0'));var _=require(_0x4968('0x1'));var util=require(_0x4968('0x2'));module[_0x4968('0x3')]={'name':{'type':Sequelize[_0x4968('0x4')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4968('0x5')](_0x4968('0x6')),'set':function(_0x131e9a){if(_[_0x4968('0x7')](_0x131e9a)){this[_0x4968('0x8')](_0x4968('0x9'),JSON['stringify'](_0x131e9a));}else if(_['isString'](_0x131e9a)){this['setDataValue'](_0x4968('0x9'),_0x131e9a);}else{this['setDataValue']('formData',util[_0x4968('0xa')](_0x4968('0xb'),this[_0x4968('0xc')](_0x4968('0xd'))||'',this[_0x4968('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4968('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x53a8=['stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x11361,_0xa95e07){var _0x376335=function(_0x18553f){while(--_0x18553f){_0x11361['push'](_0x11361['shift']());}};_0x376335(++_0xa95e07);}(_0x53a8,0x117));var _0x853a=function(_0x7714a4,_0x1c9595){_0x7714a4=_0x7714a4-0x0;var _0x532a5e=_0x53a8[_0x7714a4];return _0x532a5e;};'use strict';var Sequelize=require(_0x853a('0x0'));var _=require('lodash');var util=require(_0x853a('0x1'));module[_0x853a('0x2')]={'name':{'type':Sequelize[_0x853a('0x3')],'unique':_0x853a('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x853a('0x5')](_0x853a('0x6')),'set':function(_0x2edda2){if(_[_0x853a('0x7')](_0x2edda2)){this[_0x853a('0x8')](_0x853a('0x9'),JSON[_0x853a('0xa')](_0x2edda2));}else if(_[_0x853a('0xb')](_0x2edda2)){this[_0x853a('0x8')]('formData',_0x2edda2);}else{this[_0x853a('0x8')](_0x853a('0x9'),util[_0x853a('0xc')](_0x853a('0xd'),this[_0x853a('0xe')]('name')||'',this[_0x853a('0xe')](_0x853a('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x853a('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x853a('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 00b56e0..341681d 100644 --- a/server/api/jscriptyProject/jscriptyProject.controller.js +++ b/server/api/jscriptyProject/jscriptyProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf89a=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','then','destroy','Projects','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','JscriptyProject','count','include','rows','catch','show','length','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','body','createdAt','updatedAt','userProfileId','autoAssociation','getSessions','JscriptySessionReport','hasOwnProperty','ProjectId','findOne','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','JscriptyQuestionReport','findAll','-createdAt','question','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','jsforce','desk.js','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf89a,0x1b7));var _0xaf89=function(_0x1ec81c,_0x47fd0d){_0x1ec81c=_0x1ec81c-0x0;var _0x467cdb=_0xf89a[_0x1ec81c];return _0x467cdb;};'use strict';var pdf=require(_0xaf89('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaf89('0x1'));var zipdir=require(_0xaf89('0x2'));var jsonpatch=require(_0xaf89('0x3'));var rp=require('request-promise');var moment=require(_0xaf89('0x4'));var BPromise=require(_0xaf89('0x5'));var Mustache=require(_0xaf89('0x6'));var util=require(_0xaf89('0x7'));var path=require(_0xaf89('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf89('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaf89('0xa'));var deskjs=require(_0xaf89('0xb'));var toCsv=require(_0xaf89('0xc'));var querystring=require(_0xaf89('0xd'));var Papa=require(_0xaf89('0xe'));var Redis=require('ioredis');var authService=require(_0xaf89('0xf'));var qs=require(_0xaf89('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf89('0x11'))(_0xaf89('0x12'));var utils=require(_0xaf89('0x13'));var config=require(_0xaf89('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf89('0x15'))['db'];function respondWithStatusCode(_0x287b32,_0x4042db){_0x4042db=_0x4042db||0xcc;return function(_0x4c04c2){if(_0x4c04c2){return _0x287b32[_0xaf89('0x16')](_0x4042db);}return _0x287b32[_0xaf89('0x17')](_0x4042db)[_0xaf89('0x18')]();};}function respondWithResult(_0x22169e,_0x40fa5b){_0x40fa5b=_0x40fa5b||0xc8;return function(_0x2f825a){if(_0x2f825a){return _0x22169e[_0xaf89('0x17')](_0x40fa5b)['json'](_0x2f825a);}};}function respondWithFilteredResult(_0x1ca4dc,_0x2c4895){return function(_0x8ccf55){if(_0x8ccf55){var _0x40c396=_0x8ccf55['count'],_0x557899=_0x2c4895[_0xaf89('0x19')],_0x32077b=_0x2c4895[_0xaf89('0x19')]+_0x2c4895[_0xaf89('0x1a')],_0x1531fd;if(_0x32077b>=_0x40c396){_0x32077b=_0x40c396;_0x1531fd=0xc8;}else{_0x1531fd=0xce;}_0x1ca4dc[_0xaf89('0x17')](_0x1531fd);return _0x1ca4dc['set'](_0xaf89('0x1b'),_0x557899+'-'+_0x32077b+'/'+_0x40c396)[_0xaf89('0x1c')](_0x8ccf55);}return null;};}function patchUpdates(_0x2c3266){return function(_0x112208){try{jsonpatch[_0xaf89('0x1d')](_0x112208,_0x2c3266,!![]);}catch(_0x55925b){return BPromise[_0xaf89('0x1e')](_0x55925b);}return _0x112208[_0xaf89('0x1f')]();};}function saveUpdates(_0x43ad95,_0x1b3012){return function(_0x2d3319){if(_0x2d3319){return _0x2d3319['update'](_0x43ad95)[_0xaf89('0x20')](function(_0x13d935){return _0x13d935;});}return null;};}function removeEntity(_0x17625a,_0x5484ce){return function(_0x142fff){if(_0x142fff){return _0x142fff[_0xaf89('0x21')]()[_0xaf89('0x20')](function(){var _0x3daf80=_0x142fff['get']({'plain':!![]});var _0x387611=_0xaf89('0x22');return db[_0xaf89('0x23')][_0xaf89('0x21')]({'where':{'type':_0x387611,'resourceId':_0x3daf80['id']}})[_0xaf89('0x20')](function(){return _0x142fff;});})[_0xaf89('0x20')](function(){_0x17625a[_0xaf89('0x17')](0xcc)[_0xaf89('0x18')]();});}};}function handleEntityNotFound(_0x113fef,_0x31e980){return function(_0x19b2fa){if(!_0x19b2fa){_0x113fef[_0xaf89('0x16')](0x194);}return _0x19b2fa;};}function handleError(_0x2eda63,_0x499a67){_0x499a67=_0x499a67||0x1f4;return function(_0x5d7685){logger['error'](_0x5d7685[_0xaf89('0x24')]);if(_0x5d7685['name']){delete _0x5d7685[_0xaf89('0x25')];}_0x2eda63['status'](_0x499a67)[_0xaf89('0x26')](_0x5d7685);};}exports['index']=function(_0x47181e,_0x23c540){var _0x2c24b7={},_0xc5274b={},_0x24d6ae={'count':0x0,'rows':[]};var _0x375f2b=_[_0xaf89('0x27')](db['JscriptyProject'][_0xaf89('0x28')],function(_0x27b0e9){return{'name':_0x27b0e9[_0xaf89('0x29')],'type':_0x27b0e9['type'][_0xaf89('0x2a')]};});_0xc5274b[_0xaf89('0x2b')]=_[_0xaf89('0x27')](_0x375f2b,_0xaf89('0x25'));_0xc5274b['query']=_[_0xaf89('0x2c')](_0x47181e[_0xaf89('0x2d')]);_0xc5274b[_0xaf89('0x2e')]=_['intersection'](_0xc5274b[_0xaf89('0x2b')],_0xc5274b[_0xaf89('0x2d')]);_0x2c24b7[_0xaf89('0x2f')]=_[_0xaf89('0x30')](_0xc5274b[_0xaf89('0x2b')],qs[_0xaf89('0x31')](_0x47181e[_0xaf89('0x2d')]['fields']));_0x2c24b7[_0xaf89('0x2f')]=_0x2c24b7['attributes']['length']?_0x2c24b7[_0xaf89('0x2f')]:_0xc5274b['model'];if(!_0x47181e[_0xaf89('0x2d')]['hasOwnProperty'](_0xaf89('0x32'))){_0x2c24b7[_0xaf89('0x1a')]=qs[_0xaf89('0x1a')](_0x47181e[_0xaf89('0x2d')][_0xaf89('0x1a')]);_0x2c24b7['offset']=qs['offset'](_0x47181e['query'][_0xaf89('0x19')]);}_0x2c24b7[_0xaf89('0x33')]=qs[_0xaf89('0x34')](_0x47181e['query'][_0xaf89('0x34')]);_0x2c24b7['where']=qs[_0xaf89('0x2e')](_[_0xaf89('0x35')](_0x47181e[_0xaf89('0x2d')],_0xc5274b[_0xaf89('0x2e')]),_0x375f2b);if(_0x47181e[_0xaf89('0x2d')][_0xaf89('0x36')]){_0x2c24b7[_0xaf89('0x37')]=_[_0xaf89('0x38')](_0x2c24b7['where'],{'$or':_[_0xaf89('0x27')](_0x375f2b,function(_0x757fd7){if(_0x757fd7[_0xaf89('0x39')]!==_0xaf89('0x3a')){var _0x3f7309={};_0x3f7309[_0x757fd7[_0xaf89('0x25')]]={'$like':'%'+_0x47181e[_0xaf89('0x2d')][_0xaf89('0x36')]+'%'};return _0x3f7309;}})});}_0x2c24b7=_[_0xaf89('0x38')]({},_0x2c24b7,_0x47181e[_0xaf89('0x3b')]);var _0x540572={'where':_0x2c24b7['where']};return db[_0xaf89('0x3c')][_0xaf89('0x3d')](_0x540572)[_0xaf89('0x20')](function(_0x12d806){_0x24d6ae[_0xaf89('0x3d')]=_0x12d806;if(_0x47181e[_0xaf89('0x2d')]['includeAll']){_0x2c24b7[_0xaf89('0x3e')]=[{'all':!![]}];}return db[_0xaf89('0x3c')]['findAll'](_0x2c24b7);})['then'](function(_0x587bd0){_0x24d6ae[_0xaf89('0x3f')]=_0x587bd0;return _0x24d6ae;})['then'](respondWithFilteredResult(_0x23c540,_0x2c24b7))[_0xaf89('0x40')](handleError(_0x23c540,null));};exports[_0xaf89('0x41')]=function(_0x3419a8,_0x55faed){var _0x1f857f={'raw':![],'where':{'id':_0x3419a8['params']['id']}},_0x5b0c1a={};_0x5b0c1a['model']=_[_0xaf89('0x2c')](db[_0xaf89('0x3c')]['rawAttributes']);_0x5b0c1a[_0xaf89('0x2d')]=_[_0xaf89('0x2c')](_0x3419a8[_0xaf89('0x2d')]);_0x5b0c1a['filters']=_[_0xaf89('0x30')](_0x5b0c1a[_0xaf89('0x2b')],_0x5b0c1a[_0xaf89('0x2d')]);_0x1f857f[_0xaf89('0x2f')]=_['intersection'](_0x5b0c1a[_0xaf89('0x2b')],qs['fields'](_0x3419a8[_0xaf89('0x2d')]['fields']));_0x1f857f[_0xaf89('0x2f')]=_0x1f857f[_0xaf89('0x2f')][_0xaf89('0x42')]?_0x1f857f[_0xaf89('0x2f')]:_0x5b0c1a[_0xaf89('0x2b')];if(_0x3419a8[_0xaf89('0x2d')][_0xaf89('0x43')]){_0x1f857f['include']=[{'all':!![]}];}_0x1f857f=_['merge']({},_0x1f857f,_0x3419a8[_0xaf89('0x3b')]);return db[_0xaf89('0x3c')][_0xaf89('0x44')](_0x1f857f)[_0xaf89('0x20')](handleEntityNotFound(_0x55faed,null))[_0xaf89('0x20')](respondWithResult(_0x55faed,null))[_0xaf89('0x40')](handleError(_0x55faed,null));};exports[_0xaf89('0x45')]=function(_0x18ac8f,_0x5a9200){return db[_0xaf89('0x3c')][_0xaf89('0x45')](_0x18ac8f['body'],{})['then'](function(_0x4b5697){var _0x252064=_0x18ac8f['user'][_0xaf89('0x46')]({'plain':!![]});if(!_0x252064)throw new Error(_0xaf89('0x47'));if(_0x252064[_0xaf89('0x48')]===_0xaf89('0x49')){var _0x2b81b0=_0x4b5697['get']({'plain':!![]});var _0x2f27c7=_0xaf89('0x22');return db[_0xaf89('0x4a')]['find']({'where':{'name':_0x2f27c7,'userProfileId':_0x252064['userProfileId']},'raw':!![]})['then'](function(_0x2d56f5){if(_0x2d56f5&&_0x2d56f5['autoAssociation']===0x0){return db[_0xaf89('0x23')][_0xaf89('0x45')]({'name':_0x2b81b0['name'],'resourceId':_0x2b81b0['id'],'type':_0x2d56f5[_0xaf89('0x25')],'sectionId':_0x2d56f5['id']},{})[_0xaf89('0x20')](function(){return _0x4b5697;});}else{return _0x4b5697;}})[_0xaf89('0x40')](function(_0xd4a29a){logger[_0xaf89('0x4b')](_0xaf89('0x4c'),_0xd4a29a);throw _0xd4a29a;});}return _0x4b5697;})[_0xaf89('0x20')](respondWithResult(_0x5a9200,0xc9))[_0xaf89('0x40')](handleError(_0x5a9200,null));};exports[_0xaf89('0x4d')]=function(_0x5dae97,_0x3c4107){var _0x1e258a={'where':{'id':_0x5dae97[_0xaf89('0x4e')]['id']}},_0x4bad7b={};_0x4bad7b[_0xaf89('0x2b')]=_[_0xaf89('0x2c')](db[_0xaf89('0x3c')][_0xaf89('0x28')]);_0x1e258a['attributes']=_[_0xaf89('0x30')](_0x4bad7b[_0xaf89('0x2b')],qs[_0xaf89('0x31')](_0x5dae97['query'][_0xaf89('0x31')]));_0x1e258a[_0xaf89('0x2f')]=_0x1e258a[_0xaf89('0x2f')][_0xaf89('0x42')]?_0x1e258a[_0xaf89('0x2f')]:_0x4bad7b['model'];if(_0x5dae97[_0xaf89('0x2d')][_0xaf89('0x43')]){_0x1e258a[_0xaf89('0x3e')]=[{'all':!![]}];}_0x1e258a=_[_0xaf89('0x38')]({},_0x1e258a,_0x5dae97[_0xaf89('0x3b')]);return db[_0xaf89('0x3c')][_0xaf89('0x44')](_0x1e258a)['then'](handleEntityNotFound(_0x3c4107,null))['then'](function(_0x31b1ca){if(_0x31b1ca){var _0x487173=_0x31b1ca['get']({'plain':!![]});_0x487173=qs['omit'](_0x487173,['id','createdAt','updatedAt']);_0x5dae97[_0xaf89('0x4f')]=_['omit'](_0x5dae97[_0xaf89('0x4f')],['id',_0xaf89('0x50'),_0xaf89('0x51')]);return db[_0xaf89('0x3c')]['create'](_[_0xaf89('0x38')](_0x487173,_0x5dae97[_0xaf89('0x4f')]),{'include':_0x5dae97[_0xaf89('0x2d')][_0xaf89('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x2d928a){var _0x21b00e=_0x5dae97[_0xaf89('0x49')][_0xaf89('0x46')]({'plain':!![]});if(!_0x21b00e)throw new Error(_0xaf89('0x47'));if(_0x21b00e[_0xaf89('0x48')]===_0xaf89('0x49')){var _0x3c8d1d=_0x2d928a[_0xaf89('0x46')]({'plain':!![]});var _0x1be19a=_0xaf89('0x22');return db['UserProfileSection'][_0xaf89('0x44')]({'where':{'name':_0x1be19a,'userProfileId':_0x21b00e[_0xaf89('0x52')]},'raw':!![]})[_0xaf89('0x20')](function(_0x5ac352){if(_0x5ac352&&_0x5ac352[_0xaf89('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c8d1d[_0xaf89('0x25')],'resourceId':_0x3c8d1d['id'],'type':_0x5ac352['name'],'sectionId':_0x5ac352['id']},{})['then'](function(){return _0x2d928a;});}else{return _0x2d928a;}})[_0xaf89('0x40')](function(_0x3ad87a){logger[_0xaf89('0x4b')](_0xaf89('0x4c'),_0x3ad87a);throw _0x3ad87a;});}return _0x2d928a;});}})[_0xaf89('0x20')](respondWithResult(_0x3c4107,0xc9))[_0xaf89('0x40')](handleError(_0x3c4107,null));};exports['update']=function(_0x1103c4,_0x11bbde){if(_0x1103c4['body']['id']){delete _0x1103c4['body']['id'];}return db['JscriptyProject'][_0xaf89('0x44')]({'where':{'id':_0x1103c4['params']['id']}})[_0xaf89('0x20')](handleEntityNotFound(_0x11bbde,null))[_0xaf89('0x20')](saveUpdates(_0x1103c4[_0xaf89('0x4f')],null))[_0xaf89('0x20')](respondWithResult(_0x11bbde,null))['catch'](handleError(_0x11bbde,null));};exports['destroy']=function(_0x1bb481,_0x326ea3){return db['JscriptyProject'][_0xaf89('0x44')]({'where':{'id':_0x1bb481['params']['id']}})[_0xaf89('0x20')](handleEntityNotFound(_0x326ea3,null))[_0xaf89('0x20')](removeEntity(_0x326ea3,null))[_0xaf89('0x40')](handleError(_0x326ea3,null));};exports[_0xaf89('0x54')]=function(_0x2cb51b,_0x46bc27,_0x39522e){var _0x5ee368={'raw':!![],'where':{}};var _0x25b1da={};var _0x308d16={'count':0x0,'rows':[]};return db[_0xaf89('0x3c')]['findOne']({'where':{'id':_0x2cb51b[_0xaf89('0x4e')]['id']}})[_0xaf89('0x20')](handleEntityNotFound(_0x46bc27,null))[_0xaf89('0x20')](function(_0x2bd0d){if(_0x2bd0d){_0x25b1da[_0xaf89('0x2b')]=_[_0xaf89('0x2c')](db[_0xaf89('0x55')]['rawAttributes']);_0x25b1da['query']=_[_0xaf89('0x2c')](_0x2cb51b[_0xaf89('0x2d')]);_0x25b1da[_0xaf89('0x2e')]=_[_0xaf89('0x30')](_0x25b1da['model'],_0x25b1da[_0xaf89('0x2d')]);_0x5ee368['attributes']=_['intersection'](_0x25b1da[_0xaf89('0x2b')],qs[_0xaf89('0x31')](_0x2cb51b['query'][_0xaf89('0x31')]));_0x5ee368[_0xaf89('0x2f')]=_0x5ee368[_0xaf89('0x2f')][_0xaf89('0x42')]?_0x5ee368['attributes']:_0x25b1da['model'];if(!_0x2cb51b['query'][_0xaf89('0x56')]('nolimit')){_0x5ee368['limit']=qs[_0xaf89('0x1a')](_0x2cb51b['query']['limit']);_0x5ee368[_0xaf89('0x19')]=qs['offset'](_0x2cb51b[_0xaf89('0x2d')]['offset']);}_0x5ee368[_0xaf89('0x33')]=qs[_0xaf89('0x34')](_0x2cb51b[_0xaf89('0x2d')][_0xaf89('0x34')]);_0x5ee368[_0xaf89('0x37')]=qs[_0xaf89('0x2e')](_[_0xaf89('0x35')](_0x2cb51b[_0xaf89('0x2d')],_0x25b1da[_0xaf89('0x2e')]));_0x5ee368[_0xaf89('0x37')][_0xaf89('0x57')]=_0x2bd0d['id'];if(_0x2cb51b[_0xaf89('0x2d')]['filter']){_0x5ee368[_0xaf89('0x37')]=_[_0xaf89('0x38')](_0x5ee368['where'],{'$or':_['map'](_0x5ee368['attributes'],function(_0x489aad){var _0x2ffc60={};_0x2ffc60[_0x489aad]={'$like':'%'+_0x2cb51b[_0xaf89('0x2d')][_0xaf89('0x36')]+'%'};return _0x2ffc60;})});}_0x5ee368=_[_0xaf89('0x38')]({},_0x5ee368,_0x2cb51b[_0xaf89('0x3b')]);return db['JscriptySessionReport']['count']({'where':_0x5ee368[_0xaf89('0x37')]})['then'](function(_0x35413b){_0x308d16[_0xaf89('0x3d')]=_0x35413b;if(_0x2cb51b[_0xaf89('0x2d')][_0xaf89('0x43')]){_0x5ee368['include']=[{'all':!![]}];}return db[_0xaf89('0x55')]['findAll'](_0x5ee368);})[_0xaf89('0x20')](function(_0x10b1f1){_0x308d16[_0xaf89('0x3f')]=_0x10b1f1;return _0x308d16;});}})['then'](respondWithFilteredResult(_0x46bc27,_0x5ee368))[_0xaf89('0x40')](handleError(_0x46bc27,null));};exports['getAnswers']=function(_0x493e80,_0x116ced,_0x4f2379){var _0x5b548b={'raw':!![],'where':{}};var _0x9e3b7f={};var _0x955e45={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xaf89('0x58')]({'where':{'id':_0x493e80[_0xaf89('0x4e')]['id']}})[_0xaf89('0x20')](handleEntityNotFound(_0x116ced,null))[_0xaf89('0x20')](function(_0xcb9fe){if(_0xcb9fe){_0x9e3b7f[_0xaf89('0x2b')]=_['keys'](db[_0xaf89('0x59')]['rawAttributes']);_0x9e3b7f['query']=_['keys'](_0x493e80[_0xaf89('0x2d')]);_0x9e3b7f[_0xaf89('0x2e')]=_[_0xaf89('0x30')](_0x9e3b7f[_0xaf89('0x2b')],_0x9e3b7f['query']);_0x5b548b[_0xaf89('0x2f')]=_['intersection'](_0x9e3b7f[_0xaf89('0x2b')],qs['fields'](_0x493e80[_0xaf89('0x2d')][_0xaf89('0x31')]));_0x5b548b[_0xaf89('0x2f')]=_0x5b548b[_0xaf89('0x2f')]['length']?_0x5b548b[_0xaf89('0x2f')]:_0x9e3b7f[_0xaf89('0x2b')];if(!_0x493e80[_0xaf89('0x2d')][_0xaf89('0x56')]('nolimit')){_0x5b548b[_0xaf89('0x1a')]=qs[_0xaf89('0x1a')](_0x493e80[_0xaf89('0x2d')][_0xaf89('0x1a')]);_0x5b548b['offset']=qs['offset'](_0x493e80[_0xaf89('0x2d')][_0xaf89('0x19')]);}_0x5b548b[_0xaf89('0x33')]=qs[_0xaf89('0x34')](_0x493e80[_0xaf89('0x2d')]['sort']);_0x5b548b['where']=qs[_0xaf89('0x2e')](_[_0xaf89('0x35')](_0x493e80['query'],_0x9e3b7f[_0xaf89('0x2e')]));_0x5b548b[_0xaf89('0x37')][_0xaf89('0x57')]=_0xcb9fe['id'];if(_0x493e80[_0xaf89('0x2d')][_0xaf89('0x36')]){_0x5b548b[_0xaf89('0x37')]=_[_0xaf89('0x38')](_0x5b548b['where'],{'$or':_[_0xaf89('0x27')](_0x5b548b[_0xaf89('0x2f')],function(_0x504f2b){var _0xa60f5e={};_0xa60f5e[_0x504f2b]={'$like':'%'+_0x493e80[_0xaf89('0x2d')][_0xaf89('0x36')]+'%'};return _0xa60f5e;})});}_0x5b548b=_[_0xaf89('0x38')]({},_0x5b548b,_0x493e80['options']);return db[_0xaf89('0x59')][_0xaf89('0x3d')]({'where':_0x5b548b[_0xaf89('0x37')]})[_0xaf89('0x20')](function(_0x27b441){_0x955e45[_0xaf89('0x3d')]=_0x27b441;if(_0x493e80[_0xaf89('0x2d')][_0xaf89('0x43')]){_0x5b548b[_0xaf89('0x3e')]=[{'all':!![]}];}return db[_0xaf89('0x59')]['findAll'](_0x5b548b);})[_0xaf89('0x20')](function(_0x49c479){_0x955e45[_0xaf89('0x3f')]=_0x49c479;return _0x955e45;});}})[_0xaf89('0x20')](respondWithFilteredResult(_0x116ced,_0x5b548b))[_0xaf89('0x40')](handleError(_0x116ced,null));};function char(_0x37556d){return _0xaf89('0x5a')===typeof _0x37556d?String[_0xaf89('0x5b')][_0xaf89('0x1d')](null,arguments):_0x37556d;}function needsEncapsulation(_0x39df91){return!!_0x39df91&&(_0x39df91['toString']()[_0xaf89('0x5c')](char(0xd))>=0x0||_0x39df91[_0xaf89('0x5d')]()[_0xaf89('0x5c')](char(0xa))>=0x0||_0x39df91['toString']()[_0xaf89('0x5c')](char(0x2c))>=0x0||_0x39df91[_0xaf89('0x5d')]()[_0xaf89('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x17f3c4){var _0x327521=char(0x22),_0x4b37a6='\x5c'+char(0x22),_0x552f7a=_0x17f3c4[_0xaf89('0x5d')]()[_0xaf89('0x5e')](new RegExp(_0x327521,'g'),_0x4b37a6);return _0x327521+_0x552f7a+_0x327521;}exports[_0xaf89('0x5f')]=function(_0x490435,_0x3d77b9,_0x376ae9){var _0x2d79c9,_0x2c7bf1;var _0x3f82a7={'where':{'ProjectId':_0x490435[_0xaf89('0x4e')]['id']}};if(_0x490435[_0xaf89('0x2d')][_0xaf89('0x60')]){_0x3f82a7[_0xaf89('0x37')][_0xaf89('0x61')]=JSON['parse'](_0x490435[_0xaf89('0x2d')]['startTime']);}return db[_0xaf89('0x55')]['findAll'](_0x3f82a7)[_0xaf89('0x20')](handleEntityNotFound(_0x3d77b9,null))[_0xaf89('0x20')](function(_0x1cd2b4){if(_0x1cd2b4){_0x2d79c9=_0x1cd2b4;return db[_0xaf89('0x62')][_0xaf89('0x63')]({'where':{'SessionId':{'$in':_[_0xaf89('0x27')](_0x2d79c9,'id')},'ProjectId':_0x490435[_0xaf89('0x4e')]['id']},'order':_0xaf89('0x64')});}})[_0xaf89('0x20')](handleEntityNotFound(_0x3d77b9,null))[_0xaf89('0x20')](function(_0x27a43f){if(_0x27a43f){_0x2c7bf1=_0x27a43f;var _0x3ef5ea={};for(var _0x41be98=0x0,_0x57902b=_0x2c7bf1['length'];_0x41be98<_0x57902b;_0x41be98++){if(!_0x3ef5ea['hasOwnProperty'](_0x2c7bf1[_0x41be98]['questionId'])){_0x3ef5ea[_0x2c7bf1[_0x41be98]['questionId']]=needsEncapsulation(_0x2c7bf1[_0x41be98][_0xaf89('0x65')])?encapsulate(_0x2c7bf1[_0x41be98]['question']):_0x2c7bf1[_0x41be98]['question'];}}var _0x340743=[],_0x33f8b1={};for(var _0x28dc9e=0x0,_0x3cf0c7=_0x2d79c9[_0xaf89('0x42')];_0x28dc9e<_0x3cf0c7;_0x28dc9e++){_0x33f8b1={'ProjectId':_0x490435[_0xaf89('0x4e')]['id'],'SessionId':_0x2d79c9[_0x28dc9e]['id'],'StartTime':moment(_0x2d79c9[_0x28dc9e][_0xaf89('0x61')])['format'](_0xaf89('0x66'))};for(var _0x32cb74=0x0,_0x232905=_0x2c7bf1[_0xaf89('0x42')];_0x32cb74<_0x232905;_0x32cb74++){if(_0x2c7bf1[_0x32cb74]['SessionId']==_0x2d79c9[_0x28dc9e]['id']&&_0x3ef5ea[_0xaf89('0x56')](_0x2c7bf1[_0x32cb74]['questionId'])){_0x33f8b1[_0x3ef5ea[_0x2c7bf1[_0x32cb74]['questionId']]]=_0x2c7bf1[_0x32cb74]['answer'];}}for(var _0x46b6bd in _0x3ef5ea){if(!_0x33f8b1[_0xaf89('0x56')](_0x3ef5ea[_0x46b6bd])){_0x33f8b1[_0x3ef5ea[_0x46b6bd]]=null;}}_0x340743[_0xaf89('0x67')](_0x33f8b1);}return _0x340743;}})[_0xaf89('0x20')](function(_0xf8a62b){if(!_[_0xaf89('0x68')](_0xf8a62b)){var _0x2b4214=toCsv(_0xf8a62b);var _0x3a97ab=Date[_0xaf89('0x69')]();fs['writeFileSync'](util[_0xaf89('0x6a')](_0xaf89('0x6b'),_0x490435[_0xaf89('0x4e')]['id'],_0x3a97ab),_0x2b4214);_0x3d77b9[_0xaf89('0x6c')](_0xaf89('0x6d'),_0xaf89('0x6e')+util['format'](_0xaf89('0x6f'),_0x490435[_0xaf89('0x4e')]['id'],_0x3a97ab));_0x3d77b9[_0xaf89('0x6c')](_0xaf89('0x70'),'text/csv');return _0x3d77b9['download'](util[_0xaf89('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x490435[_0xaf89('0x4e')]['id'],_0x3a97ab));}else{return _0x3d77b9['sendStatus'](0xcc);}})[_0xaf89('0x40')](handleError(_0x3d77b9,null));}; \ No newline at end of file +var _0xdb76=['question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','status','update','then','Projects','UserProfileResource','destroy','stack','name','send','index','map','JscriptyProject','fieldName','key','keys','query','intersection','model','attributes','fields','length','nolimit','limit','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','error','params','omit','createdAt','updatedAt','body','JscriptySessionReport','rawAttributes','order','sort','pick','ProjectId','findOne','JscriptyAnswerReport','hasOwnProperty','fromCharCode','toString','indexOf','startTime','starttime','parse','-createdAt','questionId'];(function(_0x347ec9,_0x542714){var _0x131b5c=function(_0x22874c){while(--_0x22874c){_0x347ec9['push'](_0x347ec9['shift']());}};_0x131b5c(++_0x542714);}(_0xdb76,0x7c));var _0x6db7=function(_0x389d41,_0x2a0bb2){_0x389d41=_0x389d41-0x0;var _0x27c607=_0xdb76[_0x389d41];return _0x27c607;};'use strict';var pdf=require(_0x6db7('0x0'));var emlformat=require(_0x6db7('0x1'));var rimraf=require(_0x6db7('0x2'));var zipdir=require(_0x6db7('0x3'));var jsonpatch=require(_0x6db7('0x4'));var rp=require(_0x6db7('0x5'));var moment=require(_0x6db7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6db7('0x7'));var util=require(_0x6db7('0x8'));var path=require(_0x6db7('0x9'));var sox=require(_0x6db7('0xa'));var csv=require(_0x6db7('0xb'));var ejs=require(_0x6db7('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6db7('0xd'));var crypto=require(_0x6db7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6db7('0xb'));var querystring=require(_0x6db7('0xf'));var Papa=require(_0x6db7('0x10'));var Redis=require(_0x6db7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6db7('0x12'));var as=require(_0x6db7('0x13'));var hardwareService=require(_0x6db7('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6db7('0x15'));var config=require(_0x6db7('0x16'));var licenseUtil=require(_0x6db7('0x17'));var db=require(_0x6db7('0x18'))['db'];function respondWithStatusCode(_0x5ac03e,_0x55f48c){_0x55f48c=_0x55f48c||0xcc;return function(_0xc680de){if(_0xc680de){return _0x5ac03e['sendStatus'](_0x55f48c);}return _0x5ac03e['status'](_0x55f48c)[_0x6db7('0x19')]();};}function respondWithResult(_0x501af0,_0xdea08b){_0xdea08b=_0xdea08b||0xc8;return function(_0x36bc45){if(_0x36bc45){return _0x501af0['status'](_0xdea08b)[_0x6db7('0x1a')](_0x36bc45);}};}function respondWithFilteredResult(_0x575972,_0x4fb0dc){return function(_0xe353aa){if(_0xe353aa){var _0x5c12f1=_0xe353aa[_0x6db7('0x1b')],_0x127ba7=_0x4fb0dc[_0x6db7('0x1c')],_0x5ad9c8=_0x4fb0dc[_0x6db7('0x1c')]+_0x4fb0dc['limit'],_0x285394;if(_0x5ad9c8>=_0x5c12f1){_0x5ad9c8=_0x5c12f1;_0x285394=0xc8;}else{_0x285394=0xce;}_0x575972[_0x6db7('0x1d')](_0x285394);return _0x575972['set']('Content-Range',_0x127ba7+'-'+_0x5ad9c8+'/'+_0x5c12f1)[_0x6db7('0x1a')](_0xe353aa);}return null;};}function patchUpdates(_0x9c4369){return function(_0x23c451){try{jsonpatch['apply'](_0x23c451,_0x9c4369,!![]);}catch(_0x12f403){return BPromise['reject'](_0x12f403);}return _0x23c451['save']();};}function saveUpdates(_0xbc0de0,_0x573eb0){return function(_0x285a5d){if(_0x285a5d){return _0x285a5d[_0x6db7('0x1e')](_0xbc0de0)[_0x6db7('0x1f')](function(_0x532e22){return _0x532e22;});}return null;};}function removeEntity(_0x4143ed,_0x5548d2){return function(_0x173d95){if(_0x173d95){return _0x173d95['destroy']()[_0x6db7('0x1f')](function(){var _0x578455=_0x173d95['get']({'plain':!![]});var _0x4cda27=_0x6db7('0x20');return db[_0x6db7('0x21')][_0x6db7('0x22')]({'where':{'type':_0x4cda27,'resourceId':_0x578455['id']}})[_0x6db7('0x1f')](function(){return _0x173d95;});})['then'](function(){_0x4143ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4959df,_0x39896e){return function(_0x5ee952){if(!_0x5ee952){_0x4959df['sendStatus'](0x194);}return _0x5ee952;};}function handleError(_0x4a759a,_0x2ccbef){_0x2ccbef=_0x2ccbef||0x1f4;return function(_0xcf7dbe){logger['error'](_0xcf7dbe[_0x6db7('0x23')]);if(_0xcf7dbe[_0x6db7('0x24')]){delete _0xcf7dbe[_0x6db7('0x24')];}_0x4a759a[_0x6db7('0x1d')](_0x2ccbef)[_0x6db7('0x25')](_0xcf7dbe);};}exports[_0x6db7('0x26')]=function(_0x5ec6da,_0x4f8309){var _0xc3ad87={},_0x2f7131={},_0x1f32fb={'count':0x0,'rows':[]};var _0x94c124=_[_0x6db7('0x27')](db[_0x6db7('0x28')]['rawAttributes'],function(_0x27a16c){return{'name':_0x27a16c[_0x6db7('0x29')],'type':_0x27a16c['type'][_0x6db7('0x2a')]};});_0x2f7131['model']=_[_0x6db7('0x27')](_0x94c124,_0x6db7('0x24'));_0x2f7131['query']=_[_0x6db7('0x2b')](_0x5ec6da[_0x6db7('0x2c')]);_0x2f7131['filters']=_[_0x6db7('0x2d')](_0x2f7131[_0x6db7('0x2e')],_0x2f7131[_0x6db7('0x2c')]);_0xc3ad87[_0x6db7('0x2f')]=_['intersection'](_0x2f7131['model'],qs['fields'](_0x5ec6da['query'][_0x6db7('0x30')]));_0xc3ad87['attributes']=_0xc3ad87['attributes'][_0x6db7('0x31')]?_0xc3ad87[_0x6db7('0x2f')]:_0x2f7131['model'];if(!_0x5ec6da[_0x6db7('0x2c')]['hasOwnProperty'](_0x6db7('0x32'))){_0xc3ad87[_0x6db7('0x33')]=qs[_0x6db7('0x33')](_0x5ec6da[_0x6db7('0x2c')][_0x6db7('0x33')]);_0xc3ad87[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x5ec6da[_0x6db7('0x2c')][_0x6db7('0x1c')]);}_0xc3ad87['order']=qs['sort'](_0x5ec6da[_0x6db7('0x2c')]['sort']);_0xc3ad87[_0x6db7('0x34')]=qs['filters'](_['pick'](_0x5ec6da['query'],_0x2f7131[_0x6db7('0x35')]),_0x94c124);if(_0x5ec6da[_0x6db7('0x2c')][_0x6db7('0x36')]){_0xc3ad87[_0x6db7('0x34')]=_[_0x6db7('0x37')](_0xc3ad87[_0x6db7('0x34')],{'$or':_[_0x6db7('0x27')](_0x94c124,function(_0x39b24d){if(_0x39b24d[_0x6db7('0x38')]!==_0x6db7('0x39')){var _0x395fad={};_0x395fad[_0x39b24d[_0x6db7('0x24')]]={'$like':'%'+_0x5ec6da[_0x6db7('0x2c')][_0x6db7('0x36')]+'%'};return _0x395fad;}})});}_0xc3ad87=_[_0x6db7('0x37')]({},_0xc3ad87,_0x5ec6da[_0x6db7('0x3a')]);var _0x47f637={'where':_0xc3ad87[_0x6db7('0x34')]};return db[_0x6db7('0x28')][_0x6db7('0x1b')](_0x47f637)[_0x6db7('0x1f')](function(_0x3aacba){_0x1f32fb[_0x6db7('0x1b')]=_0x3aacba;if(_0x5ec6da[_0x6db7('0x2c')]['includeAll']){_0xc3ad87[_0x6db7('0x3b')]=[{'all':!![]}];}return db[_0x6db7('0x28')][_0x6db7('0x3c')](_0xc3ad87);})[_0x6db7('0x1f')](function(_0x2b5874){_0x1f32fb[_0x6db7('0x3d')]=_0x2b5874;return _0x1f32fb;})[_0x6db7('0x1f')](respondWithFilteredResult(_0x4f8309,_0xc3ad87))[_0x6db7('0x3e')](handleError(_0x4f8309,null));};exports[_0x6db7('0x3f')]=function(_0x480a51,_0x4c0a87){var _0x11b4a0={'raw':![],'where':{'id':_0x480a51['params']['id']}},_0x5d6947={};_0x5d6947[_0x6db7('0x2e')]=_[_0x6db7('0x2b')](db[_0x6db7('0x28')]['rawAttributes']);_0x5d6947[_0x6db7('0x2c')]=_[_0x6db7('0x2b')](_0x480a51['query']);_0x5d6947['filters']=_[_0x6db7('0x2d')](_0x5d6947['model'],_0x5d6947[_0x6db7('0x2c')]);_0x11b4a0[_0x6db7('0x2f')]=_['intersection'](_0x5d6947[_0x6db7('0x2e')],qs[_0x6db7('0x30')](_0x480a51['query'][_0x6db7('0x30')]));_0x11b4a0['attributes']=_0x11b4a0[_0x6db7('0x2f')]['length']?_0x11b4a0[_0x6db7('0x2f')]:_0x5d6947['model'];if(_0x480a51[_0x6db7('0x2c')][_0x6db7('0x40')]){_0x11b4a0[_0x6db7('0x3b')]=[{'all':!![]}];}_0x11b4a0=_['merge']({},_0x11b4a0,_0x480a51[_0x6db7('0x3a')]);return db[_0x6db7('0x28')]['find'](_0x11b4a0)['then'](handleEntityNotFound(_0x4c0a87,null))[_0x6db7('0x1f')](respondWithResult(_0x4c0a87,null))['catch'](handleError(_0x4c0a87,null));};exports[_0x6db7('0x41')]=function(_0x388f91,_0x1db6a7){return db[_0x6db7('0x28')][_0x6db7('0x41')](_0x388f91['body'],{})[_0x6db7('0x1f')](function(_0xf2ef69){var _0x120003=_0x388f91[_0x6db7('0x42')]['get']({'plain':!![]});if(!_0x120003)throw new Error(_0x6db7('0x43'));if(_0x120003[_0x6db7('0x44')]===_0x6db7('0x42')){var _0x41aa62=_0xf2ef69[_0x6db7('0x45')]({'plain':!![]});var _0x5a9fc6='Projects';return db['UserProfileSection'][_0x6db7('0x46')]({'where':{'name':_0x5a9fc6,'userProfileId':_0x120003[_0x6db7('0x47')]},'raw':!![]})[_0x6db7('0x1f')](function(_0x3a3d9f){if(_0x3a3d9f&&_0x3a3d9f[_0x6db7('0x48')]===0x0){return db[_0x6db7('0x21')][_0x6db7('0x41')]({'name':_0x41aa62[_0x6db7('0x24')],'resourceId':_0x41aa62['id'],'type':_0x3a3d9f['name'],'sectionId':_0x3a3d9f['id']},{})['then'](function(){return _0xf2ef69;});}else{return _0xf2ef69;}})[_0x6db7('0x3e')](function(_0x2648c9){logger[_0x6db7('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2648c9);throw _0x2648c9;});}return _0xf2ef69;})[_0x6db7('0x1f')](respondWithResult(_0x1db6a7,0xc9))[_0x6db7('0x3e')](handleError(_0x1db6a7,null));};exports['clone']=function(_0x4e11c7,_0x4d493d){var _0x106698={'where':{'id':_0x4e11c7[_0x6db7('0x4a')]['id']}},_0x4de5f8={};_0x4de5f8[_0x6db7('0x2e')]=_[_0x6db7('0x2b')](db[_0x6db7('0x28')]['rawAttributes']);_0x106698['attributes']=_[_0x6db7('0x2d')](_0x4de5f8[_0x6db7('0x2e')],qs['fields'](_0x4e11c7[_0x6db7('0x2c')][_0x6db7('0x30')]));_0x106698[_0x6db7('0x2f')]=_0x106698['attributes'][_0x6db7('0x31')]?_0x106698[_0x6db7('0x2f')]:_0x4de5f8['model'];if(_0x4e11c7[_0x6db7('0x2c')][_0x6db7('0x40')]){_0x106698[_0x6db7('0x3b')]=[{'all':!![]}];}_0x106698=_[_0x6db7('0x37')]({},_0x106698,_0x4e11c7[_0x6db7('0x3a')]);return db['JscriptyProject'][_0x6db7('0x46')](_0x106698)[_0x6db7('0x1f')](handleEntityNotFound(_0x4d493d,null))['then'](function(_0x3645fd){if(_0x3645fd){var _0x3a4dfc=_0x3645fd[_0x6db7('0x45')]({'plain':!![]});_0x3a4dfc=qs[_0x6db7('0x4b')](_0x3a4dfc,['id',_0x6db7('0x4c'),_0x6db7('0x4d')]);_0x4e11c7[_0x6db7('0x4e')]=_['omit'](_0x4e11c7['body'],['id',_0x6db7('0x4c'),_0x6db7('0x4d')]);return db[_0x6db7('0x28')][_0x6db7('0x41')](_[_0x6db7('0x37')](_0x3a4dfc,_0x4e11c7[_0x6db7('0x4e')]),{'include':_0x4e11c7['query'][_0x6db7('0x40')]?[{'all':!![]}]:undefined})[_0x6db7('0x1f')](function(_0xf21710){var _0x2c66ee=_0x4e11c7[_0x6db7('0x42')][_0x6db7('0x45')]({'plain':!![]});if(!_0x2c66ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c66ee['role']===_0x6db7('0x42')){var _0x3fdc25=_0xf21710[_0x6db7('0x45')]({'plain':!![]});var _0x363d05=_0x6db7('0x20');return db['UserProfileSection'][_0x6db7('0x46')]({'where':{'name':_0x363d05,'userProfileId':_0x2c66ee[_0x6db7('0x47')]},'raw':!![]})[_0x6db7('0x1f')](function(_0x183585){if(_0x183585&&_0x183585[_0x6db7('0x48')]===0x0){return db[_0x6db7('0x21')][_0x6db7('0x41')]({'name':_0x3fdc25[_0x6db7('0x24')],'resourceId':_0x3fdc25['id'],'type':_0x183585['name'],'sectionId':_0x183585['id']},{})[_0x6db7('0x1f')](function(){return _0xf21710;});}else{return _0xf21710;}})['catch'](function(_0x5a342e){logger[_0x6db7('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a342e);throw _0x5a342e;});}return _0xf21710;});}})[_0x6db7('0x1f')](respondWithResult(_0x4d493d,0xc9))[_0x6db7('0x3e')](handleError(_0x4d493d,null));};exports[_0x6db7('0x1e')]=function(_0x260693,_0x254ad0){if(_0x260693['body']['id']){delete _0x260693[_0x6db7('0x4e')]['id'];}return db['JscriptyProject'][_0x6db7('0x46')]({'where':{'id':_0x260693['params']['id']}})[_0x6db7('0x1f')](handleEntityNotFound(_0x254ad0,null))[_0x6db7('0x1f')](saveUpdates(_0x260693['body'],null))[_0x6db7('0x1f')](respondWithResult(_0x254ad0,null))[_0x6db7('0x3e')](handleError(_0x254ad0,null));};exports[_0x6db7('0x22')]=function(_0x3343f5,_0x32eefd){return db[_0x6db7('0x28')][_0x6db7('0x46')]({'where':{'id':_0x3343f5[_0x6db7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32eefd,null))['then'](removeEntity(_0x32eefd,null))['catch'](handleError(_0x32eefd,null));};exports['getSessions']=function(_0x479766,_0x2ca49c,_0x4aa2ab){var _0x5cbf75={'raw':!![],'where':{}};var _0x394a26={};var _0x9a2587={'count':0x0,'rows':[]};return db[_0x6db7('0x28')]['findOne']({'where':{'id':_0x479766['params']['id']}})[_0x6db7('0x1f')](handleEntityNotFound(_0x2ca49c,null))[_0x6db7('0x1f')](function(_0x6ce78f){if(_0x6ce78f){_0x394a26['model']=_[_0x6db7('0x2b')](db[_0x6db7('0x4f')][_0x6db7('0x50')]);_0x394a26[_0x6db7('0x2c')]=_[_0x6db7('0x2b')](_0x479766[_0x6db7('0x2c')]);_0x394a26[_0x6db7('0x35')]=_[_0x6db7('0x2d')](_0x394a26[_0x6db7('0x2e')],_0x394a26[_0x6db7('0x2c')]);_0x5cbf75[_0x6db7('0x2f')]=_['intersection'](_0x394a26[_0x6db7('0x2e')],qs['fields'](_0x479766[_0x6db7('0x2c')][_0x6db7('0x30')]));_0x5cbf75[_0x6db7('0x2f')]=_0x5cbf75[_0x6db7('0x2f')][_0x6db7('0x31')]?_0x5cbf75[_0x6db7('0x2f')]:_0x394a26[_0x6db7('0x2e')];if(!_0x479766[_0x6db7('0x2c')]['hasOwnProperty']('nolimit')){_0x5cbf75['limit']=qs[_0x6db7('0x33')](_0x479766[_0x6db7('0x2c')][_0x6db7('0x33')]);_0x5cbf75[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x479766[_0x6db7('0x2c')][_0x6db7('0x1c')]);}_0x5cbf75[_0x6db7('0x51')]=qs['sort'](_0x479766['query'][_0x6db7('0x52')]);_0x5cbf75['where']=qs[_0x6db7('0x35')](_[_0x6db7('0x53')](_0x479766[_0x6db7('0x2c')],_0x394a26[_0x6db7('0x35')]));_0x5cbf75[_0x6db7('0x34')][_0x6db7('0x54')]=_0x6ce78f['id'];if(_0x479766[_0x6db7('0x2c')]['filter']){_0x5cbf75[_0x6db7('0x34')]=_[_0x6db7('0x37')](_0x5cbf75['where'],{'$or':_[_0x6db7('0x27')](_0x5cbf75[_0x6db7('0x2f')],function(_0x1c3233){var _0x1b3bfa={};_0x1b3bfa[_0x1c3233]={'$like':'%'+_0x479766[_0x6db7('0x2c')]['filter']+'%'};return _0x1b3bfa;})});}_0x5cbf75=_[_0x6db7('0x37')]({},_0x5cbf75,_0x479766[_0x6db7('0x3a')]);return db[_0x6db7('0x4f')][_0x6db7('0x1b')]({'where':_0x5cbf75[_0x6db7('0x34')]})[_0x6db7('0x1f')](function(_0x2bda1d){_0x9a2587['count']=_0x2bda1d;if(_0x479766['query'][_0x6db7('0x40')]){_0x5cbf75[_0x6db7('0x3b')]=[{'all':!![]}];}return db[_0x6db7('0x4f')][_0x6db7('0x3c')](_0x5cbf75);})[_0x6db7('0x1f')](function(_0x41f55d){_0x9a2587[_0x6db7('0x3d')]=_0x41f55d;return _0x9a2587;});}})[_0x6db7('0x1f')](respondWithFilteredResult(_0x2ca49c,_0x5cbf75))[_0x6db7('0x3e')](handleError(_0x2ca49c,null));};exports['getAnswers']=function(_0x3d86aa,_0x99d6eb,_0x450335){var _0x1e95ff={'raw':!![],'where':{}};var _0x3d0ec4={};var _0x186ceb={'count':0x0,'rows':[]};return db[_0x6db7('0x28')][_0x6db7('0x55')]({'where':{'id':_0x3d86aa[_0x6db7('0x4a')]['id']}})[_0x6db7('0x1f')](handleEntityNotFound(_0x99d6eb,null))[_0x6db7('0x1f')](function(_0x521533){if(_0x521533){_0x3d0ec4[_0x6db7('0x2e')]=_['keys'](db[_0x6db7('0x56')][_0x6db7('0x50')]);_0x3d0ec4[_0x6db7('0x2c')]=_[_0x6db7('0x2b')](_0x3d86aa[_0x6db7('0x2c')]);_0x3d0ec4[_0x6db7('0x35')]=_['intersection'](_0x3d0ec4[_0x6db7('0x2e')],_0x3d0ec4[_0x6db7('0x2c')]);_0x1e95ff[_0x6db7('0x2f')]=_[_0x6db7('0x2d')](_0x3d0ec4[_0x6db7('0x2e')],qs[_0x6db7('0x30')](_0x3d86aa['query'][_0x6db7('0x30')]));_0x1e95ff[_0x6db7('0x2f')]=_0x1e95ff[_0x6db7('0x2f')][_0x6db7('0x31')]?_0x1e95ff[_0x6db7('0x2f')]:_0x3d0ec4[_0x6db7('0x2e')];if(!_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x57')](_0x6db7('0x32'))){_0x1e95ff[_0x6db7('0x33')]=qs[_0x6db7('0x33')](_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x33')]);_0x1e95ff[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x1c')]);}_0x1e95ff[_0x6db7('0x51')]=qs[_0x6db7('0x52')](_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x52')]);_0x1e95ff[_0x6db7('0x34')]=qs[_0x6db7('0x35')](_[_0x6db7('0x53')](_0x3d86aa[_0x6db7('0x2c')],_0x3d0ec4[_0x6db7('0x35')]));_0x1e95ff[_0x6db7('0x34')]['ProjectId']=_0x521533['id'];if(_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x36')]){_0x1e95ff[_0x6db7('0x34')]=_[_0x6db7('0x37')](_0x1e95ff['where'],{'$or':_['map'](_0x1e95ff['attributes'],function(_0x27a56c){var _0x598295={};_0x598295[_0x27a56c]={'$like':'%'+_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x36')]+'%'};return _0x598295;})});}_0x1e95ff=_[_0x6db7('0x37')]({},_0x1e95ff,_0x3d86aa[_0x6db7('0x3a')]);return db[_0x6db7('0x56')][_0x6db7('0x1b')]({'where':_0x1e95ff[_0x6db7('0x34')]})[_0x6db7('0x1f')](function(_0x493783){_0x186ceb[_0x6db7('0x1b')]=_0x493783;if(_0x3d86aa[_0x6db7('0x2c')]['includeAll']){_0x1e95ff[_0x6db7('0x3b')]=[{'all':!![]}];}return db[_0x6db7('0x56')][_0x6db7('0x3c')](_0x1e95ff);})[_0x6db7('0x1f')](function(_0x478b29){_0x186ceb[_0x6db7('0x3d')]=_0x478b29;return _0x186ceb;});}})[_0x6db7('0x1f')](respondWithFilteredResult(_0x99d6eb,_0x1e95ff))['catch'](handleError(_0x99d6eb,null));};function char(_0x2e74cd){return'number'===typeof _0x2e74cd?String[_0x6db7('0x58')]['apply'](null,arguments):_0x2e74cd;}function needsEncapsulation(_0x4c3a52){return!!_0x4c3a52&&(_0x4c3a52[_0x6db7('0x59')]()[_0x6db7('0x5a')](char(0xd))>=0x0||_0x4c3a52[_0x6db7('0x59')]()[_0x6db7('0x5a')](char(0xa))>=0x0||_0x4c3a52[_0x6db7('0x59')]()[_0x6db7('0x5a')](char(0x2c))>=0x0||_0x4c3a52[_0x6db7('0x59')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x43c06a){var _0x49374a=char(0x22),_0x3ce5e8='\x5c'+char(0x22),_0x2d4b55=_0x43c06a['toString']()['replace'](new RegExp(_0x49374a,'g'),_0x3ce5e8);return _0x49374a+_0x2d4b55+_0x49374a;}exports['getSummary']=function(_0x1f9fb1,_0x209de6,_0x1b8592){var _0x3f0629,_0x38a98e;var _0x194793={'where':{'ProjectId':_0x1f9fb1['params']['id']}};if(_0x1f9fb1[_0x6db7('0x2c')][_0x6db7('0x5b')]){_0x194793[_0x6db7('0x34')][_0x6db7('0x5c')]=JSON[_0x6db7('0x5d')](_0x1f9fb1[_0x6db7('0x2c')][_0x6db7('0x5b')]);}return db[_0x6db7('0x4f')][_0x6db7('0x3c')](_0x194793)['then'](handleEntityNotFound(_0x209de6,null))['then'](function(_0x4a0682){if(_0x4a0682){_0x3f0629=_0x4a0682;return db['JscriptyQuestionReport'][_0x6db7('0x3c')]({'where':{'SessionId':{'$in':_[_0x6db7('0x27')](_0x3f0629,'id')},'ProjectId':_0x1f9fb1[_0x6db7('0x4a')]['id']},'order':_0x6db7('0x5e')});}})['then'](handleEntityNotFound(_0x209de6,null))[_0x6db7('0x1f')](function(_0xd177d4){if(_0xd177d4){_0x38a98e=_0xd177d4;var _0x5e6ba0={};for(var _0x4c2d11=0x0,_0x391319=_0x38a98e[_0x6db7('0x31')];_0x4c2d11<_0x391319;_0x4c2d11++){if(!_0x5e6ba0['hasOwnProperty'](_0x38a98e[_0x4c2d11]['questionId'])){_0x5e6ba0[_0x38a98e[_0x4c2d11][_0x6db7('0x5f')]]=needsEncapsulation(_0x38a98e[_0x4c2d11][_0x6db7('0x60')])?encapsulate(_0x38a98e[_0x4c2d11][_0x6db7('0x60')]):_0x38a98e[_0x4c2d11]['question'];}}var _0x30cf97=[],_0x33c438={};for(var _0x263bd0=0x0,_0x37cdf1=_0x3f0629[_0x6db7('0x31')];_0x263bd0<_0x37cdf1;_0x263bd0++){_0x33c438={'ProjectId':_0x1f9fb1['params']['id'],'SessionId':_0x3f0629[_0x263bd0]['id'],'StartTime':moment(_0x3f0629[_0x263bd0][_0x6db7('0x5c')])[_0x6db7('0x61')](_0x6db7('0x62'))};for(var _0x368802=0x0,_0x291ca0=_0x38a98e['length'];_0x368802<_0x291ca0;_0x368802++){if(_0x38a98e[_0x368802]['SessionId']==_0x3f0629[_0x263bd0]['id']&&_0x5e6ba0[_0x6db7('0x57')](_0x38a98e[_0x368802][_0x6db7('0x5f')])){_0x33c438[_0x5e6ba0[_0x38a98e[_0x368802][_0x6db7('0x5f')]]]=_0x38a98e[_0x368802][_0x6db7('0x63')];}}for(var _0x3aa9a5 in _0x5e6ba0){if(!_0x33c438[_0x6db7('0x57')](_0x5e6ba0[_0x3aa9a5])){_0x33c438[_0x5e6ba0[_0x3aa9a5]]=null;}}_0x30cf97['push'](_0x33c438);}return _0x30cf97;}})['then'](function(_0xdd7150){if(!_[_0x6db7('0x64')](_0xdd7150)){var _0x281054=toCsv(_0xdd7150);var _0x4e9bae=Date[_0x6db7('0x65')]();fs[_0x6db7('0x66')](util[_0x6db7('0x61')](_0x6db7('0x67'),_0x1f9fb1[_0x6db7('0x4a')]['id'],_0x4e9bae),_0x281054);_0x209de6[_0x6db7('0x68')]('Content-disposition','attachment;\x20filename='+util['format'](_0x6db7('0x69'),_0x1f9fb1[_0x6db7('0x4a')]['id'],_0x4e9bae));_0x209de6['setHeader'](_0x6db7('0x6a'),_0x6db7('0x6b'));return _0x209de6[_0x6db7('0x6c')](util[_0x6db7('0x61')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1f9fb1[_0x6db7('0x4a')]['id'],_0x4e9bae));}else{return _0x209de6[_0x6db7('0x6d')](0xcc);}})[_0x6db7('0x3e')](handleError(_0x209de6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 30ad11c..0fa1e0d 100644 --- a/server/api/jscriptyProject/jscriptyProject.model.js +++ b/server/api/jscriptyProject/jscriptyProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd943=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','api','moment','bluebird','request-promise','path'];(function(_0x598901,_0x205f15){var _0x45acca=function(_0x4ab4d2){while(--_0x4ab4d2){_0x598901['push'](_0x598901['shift']());}};_0x45acca(++_0x205f15);}(_0xd943,0x162));var _0x3d94=function(_0x511ed0,_0x5a73be){_0x511ed0=_0x511ed0-0x0;var _0xb45422=_0xd943[_0x511ed0];return _0xb45422;};'use strict';var _=require(_0x3d94('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rp=require(_0x3d94('0x4'));var fs=require('fs');var path=require(_0x3d94('0x5'));var rimraf=require(_0x3d94('0x6'));var config=require(_0x3d94('0x7'));var attributes=require(_0x3d94('0x8'));module[_0x3d94('0x9')]=function(_0x361015,_0x110c93){return _0x361015[_0x3d94('0xa')]('JscriptyProject',attributes,{'tableName':_0x3d94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x494a=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','lodash','util','../../config/logger','api'];(function(_0x5dc854,_0x31f860){var _0x2e7283=function(_0x590e08){while(--_0x590e08){_0x5dc854['push'](_0x5dc854['shift']());}};_0x2e7283(++_0x31f860);}(_0x494a,0x11c));var _0xa494=function(_0x10165c,_0x5ad2b4){_0x10165c=_0x10165c-0x0;var _0x454073=_0x494a[_0x10165c];return _0x454073;};'use strict';var _=require(_0xa494('0x0'));var util=require(_0xa494('0x1'));var logger=require(_0xa494('0x2'))(_0xa494('0x3'));var moment=require(_0xa494('0x4'));var BPromise=require(_0xa494('0x5'));var rp=require(_0xa494('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa494('0x7'));var config=require(_0xa494('0x8'));var attributes=require(_0xa494('0x9'));module['exports']=function(_0x266133,_0x1a912e){return _0x266133[_0xa494('0xa')](_0xa494('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 7b2a209..47e82e9 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a6a=['client','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','JscriptyProject,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3f3641,_0x1f0692){var _0x50467e=function(_0x2dc2cb){while(--_0x2dc2cb){_0x3f3641['push'](_0x3f3641['shift']());}};_0x50467e(++_0x1f0692);}(_0x2a6a,0x171));var _0xa2a6=function(_0x129954,_0x17b156){_0x129954=_0x129954-0x0;var _0x2b40f2=_0x2a6a[_0x129954];return _0x2b40f2;};'use strict';var _=require(_0xa2a6('0x0'));var util=require(_0xa2a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa2a6('0x2'));var fs=require('fs');var Redis=require(_0xa2a6('0x3'));var db=require(_0xa2a6('0x4'))['db'];var utils=require(_0xa2a6('0x5'));var logger=require(_0xa2a6('0x6'))('rpc');var config=require(_0xa2a6('0x7'));var jayson=require(_0xa2a6('0x8'));var client=jayson[_0xa2a6('0x9')][_0xa2a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x585744,_0x208eca,_0xbec665){return new BPromise(function(_0xad67a6,_0x108ff4){return client[_0xa2a6('0xb')](_0x585744,_0xbec665)['then'](function(_0x2dab7c){logger[_0xa2a6('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x208eca,_0xa2a6('0xd'));logger[_0xa2a6('0xe')](_0xa2a6('0xf'),_0x208eca,_0xa2a6('0xd'),JSON['stringify'](_0x2dab7c));if(_0x2dab7c['error']){if(_0x2dab7c[_0xa2a6('0x10')][_0xa2a6('0x11')]===0x1f4){logger[_0xa2a6('0x10')](_0xa2a6('0x12'),_0x208eca,_0x2dab7c['error']['message']);return _0x108ff4(_0x2dab7c[_0xa2a6('0x10')][_0xa2a6('0x13')]);}logger[_0xa2a6('0x10')](_0xa2a6('0x12'),_0x208eca,_0x2dab7c[_0xa2a6('0x10')][_0xa2a6('0x13')]);return _0xad67a6(_0x2dab7c['error'][_0xa2a6('0x13')]);}else{logger[_0xa2a6('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x208eca,_0xa2a6('0xd'));_0xad67a6(_0x2dab7c['result'][_0xa2a6('0x13')]);}})[_0xa2a6('0x14')](function(_0x43bac8){logger[_0xa2a6('0x10')](_0xa2a6('0x12'),_0x208eca,_0x43bac8);_0x108ff4(_0x43bac8);});});} \ No newline at end of file +var _0xe1f9=['bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','lodash','util','moment'];(function(_0x2eaf76,_0x547b67){var _0x4ca66c=function(_0x2745eb){while(--_0x2745eb){_0x2eaf76['push'](_0x2eaf76['shift']());}};_0x4ca66c(++_0x547b67);}(_0xe1f9,0x115));var _0x9e1f=function(_0x26d8cc,_0x6aafa2){_0x26d8cc=_0x26d8cc-0x0;var _0x15068e=_0xe1f9[_0x26d8cc];return _0x15068e;};'use strict';var _=require(_0x9e1f('0x0'));var util=require(_0x9e1f('0x1'));var moment=require(_0x9e1f('0x2'));var BPromise=require(_0x9e1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e1f('0x5'))('rpc');var config=require(_0x9e1f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9e1f('0x7')][_0x9e1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc3097c,_0x5ecc4a,_0xedef36){return new BPromise(function(_0x4941b1,_0x1ca4b1){return client[_0x9e1f('0x9')](_0xc3097c,_0xedef36)[_0x9e1f('0xa')](function(_0x182739){logger[_0x9e1f('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5ecc4a,'request\x20sent');logger[_0x9e1f('0xc')](_0x9e1f('0xd'),_0x5ecc4a,_0x9e1f('0xe'),JSON[_0x9e1f('0xf')](_0x182739));if(_0x182739[_0x9e1f('0x10')]){if(_0x182739[_0x9e1f('0x10')][_0x9e1f('0x11')]===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x5ecc4a,_0x182739[_0x9e1f('0x10')][_0x9e1f('0x12')]);return _0x1ca4b1(_0x182739[_0x9e1f('0x10')][_0x9e1f('0x12')]);}logger['error'](_0x9e1f('0x13'),_0x5ecc4a,_0x182739['error'][_0x9e1f('0x12')]);return _0x4941b1(_0x182739[_0x9e1f('0x10')][_0x9e1f('0x12')]);}else{logger[_0x9e1f('0xb')](_0x9e1f('0x13'),_0x5ecc4a,_0x9e1f('0xe'));_0x4941b1(_0x182739['result'][_0x9e1f('0x12')]);}})['catch'](function(_0x4119b0){logger['error'](_0x9e1f('0x13'),_0x5ecc4a,_0x4119b0);_0x1ca4b1(_0x4119b0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 66baccc..cfca9d0 100644 --- a/server/api/jscriptyQuestionReport/index.js +++ b/server/api/jscriptyQuestionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44d8=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','multer','util','path','express','Router','../../components/auth/service'];(function(_0x5df194,_0xcb58ae){var _0xc46fec=function(_0x366609){while(--_0x366609){_0x5df194['push'](_0x5df194['shift']());}};_0xc46fec(++_0xcb58ae);}(_0x44d8,0xe4));var _0x844d=function(_0x2e08b5,_0xf91160){_0x2e08b5=_0x2e08b5-0x0;var _0x2af72b=_0x44d8[_0x2e08b5];return _0x2af72b;};'use strict';var multer=require(_0x844d('0x0'));var util=require(_0x844d('0x1'));var path=require(_0x844d('0x2'));var timeout=require('connect-timeout');var express=require(_0x844d('0x3'));var router=express[_0x844d('0x4')]();var auth=require(_0x844d('0x5'));var interaction=require(_0x844d('0x6'));var config=require(_0x844d('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x844d('0x8')]('/',auth[_0x844d('0x9')](),controller[_0x844d('0xa')]);router[_0x844d('0x8')](_0x844d('0xb'),auth[_0x844d('0x9')](),controller[_0x844d('0xc')]);router[_0x844d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x844d('0xd')]);router[_0x844d('0xe')]('/',auth['isAuthenticated'](),controller[_0x844d('0xf')]);router['put'](_0x844d('0x10'),auth['isAuthenticated'](),controller[_0x844d('0x11')]);router['delete'](_0x844d('0x10'),auth[_0x844d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x898f=['destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','post','create','put','/:id','delete'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x898f,0x191));var _0xf898=function(_0x4f5075,_0x5e07dd){_0x4f5075=_0x4f5075-0x0;var _0x152cac=_0x898f[_0x4f5075];return _0x152cac;};'use strict';var multer=require(_0xf898('0x0'));var util=require(_0xf898('0x1'));var path=require(_0xf898('0x2'));var timeout=require('connect-timeout');var express=require(_0xf898('0x3'));var router=express[_0xf898('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf898('0x5'));var config=require(_0xf898('0x6'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0xf898('0x7')](),controller[_0xf898('0x8')]);router[_0xf898('0x9')]('/describe',auth[_0xf898('0x7')](),controller[_0xf898('0xa')]);router[_0xf898('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf898('0xb')]);router[_0xf898('0xc')]('/',auth[_0xf898('0x7')](),controller[_0xf898('0xd')]);router[_0xf898('0xe')](_0xf898('0xf'),auth[_0xf898('0x7')](),controller['update']);router[_0xf898('0x10')](_0xf898('0xf'),auth[_0xf898('0x7')](),controller[_0xf898('0x11')]);module[_0xf898('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9193953..190c7cd 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67e3=['sequelize','STRING','TEXT','long'];(function(_0x1ee548,_0x1f0329){var _0x555193=function(_0x4e1e82){while(--_0x4e1e82){_0x1ee548['push'](_0x1ee548['shift']());}};_0x555193(++_0x1f0329);}(_0x67e3,0x17c));var _0x367e=function(_0x42f875,_0x2b4361){_0x42f875=_0x42f875-0x0;var _0x4956ba=_0x67e3[_0x42f875];return _0x4956ba;};'use strict';var Sequelize=require(_0x367e('0x0'));module['exports']={'question':{'type':Sequelize[_0x367e('0x1')]},'answer':{'type':Sequelize[_0x367e('0x2')](_0x367e('0x3'))},'membername':{'type':Sequelize[_0x367e('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x367e('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x367e('0x1')]},'calleridnum':{'type':Sequelize[_0x367e('0x1')]},'questionId':{'type':Sequelize[_0x367e('0x1')]}}; \ No newline at end of file +var _0x8bcc=['exports','TEXT','STRING'];(function(_0x2d2d94,_0xe3689c){var _0x33204e=function(_0x54fba3){while(--_0x54fba3){_0x2d2d94['push'](_0x2d2d94['shift']());}};_0x33204e(++_0xe3689c);}(_0x8bcc,0x1a1));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc8bc('0x0')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xc8bc('0x1')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc8bc('0x2')]},'uniqueid':{'type':Sequelize[_0xc8bc('0x2')]},'calleridname':{'type':Sequelize[_0xc8bc('0x2')]},'calleridnum':{'type':Sequelize[_0xc8bc('0x2')]},'questionId':{'type':Sequelize[_0xc8bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 84db8ca..8c8638a 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2053=['save','update','destroy','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','then','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject'];(function(_0x389c4c,_0x5d7477){var _0x5bbdd3=function(_0x4bc28c){while(--_0x4bc28c){_0x389c4c['push'](_0x389c4c['shift']());}};_0x5bbdd3(++_0x5d7477);}(_0x2053,0x1e0));var _0x3205=function(_0x5580be,_0x17faa9){_0x5580be=_0x5580be-0x0;var _0x374328=_0x2053[_0x5580be];return _0x374328;};'use strict';var pdf=require(_0x3205('0x0'));var emlformat=require(_0x3205('0x1'));var rimraf=require(_0x3205('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3205('0x3'));var rp=require(_0x3205('0x4'));var moment=require(_0x3205('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3205('0x6'));var path=require(_0x3205('0x7'));var sox=require('sox');var csv=require(_0x3205('0x8'));var ejs=require(_0x3205('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3205('0xa'));var crypto=require('crypto');var jsforce=require(_0x3205('0xb'));var deskjs=require(_0x3205('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3205('0xd'));var Papa=require('papaparse');var Redis=require(_0x3205('0xe'));var authService=require(_0x3205('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3205('0x10'));var logger=require(_0x3205('0x11'))('api');var utils=require(_0x3205('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3205('0x13'));var db=require(_0x3205('0x14'))['db'];function respondWithStatusCode(_0x884c83,_0x1ceabb){_0x1ceabb=_0x1ceabb||0xcc;return function(_0x1a6867){if(_0x1a6867){return _0x884c83[_0x3205('0x15')](_0x1ceabb);}return _0x884c83[_0x3205('0x16')](_0x1ceabb)[_0x3205('0x17')]();};}function respondWithResult(_0x42d3d5,_0x3befd6){_0x3befd6=_0x3befd6||0xc8;return function(_0x51412d){if(_0x51412d){return _0x42d3d5[_0x3205('0x16')](_0x3befd6)[_0x3205('0x18')](_0x51412d);}};}function respondWithFilteredResult(_0xa8fc19,_0x42a8de){return function(_0x34c813){if(_0x34c813){var _0x4d8687=_0x34c813['count'],_0x5288cf=_0x42a8de['offset'],_0x51864a=_0x42a8de[_0x3205('0x19')]+_0x42a8de[_0x3205('0x1a')],_0xa012cb;if(_0x51864a>=_0x4d8687){_0x51864a=_0x4d8687;_0xa012cb=0xc8;}else{_0xa012cb=0xce;}_0xa8fc19[_0x3205('0x16')](_0xa012cb);return _0xa8fc19[_0x3205('0x1b')](_0x3205('0x1c'),_0x5288cf+'-'+_0x51864a+'/'+_0x4d8687)[_0x3205('0x18')](_0x34c813);}return null;};}function patchUpdates(_0x3a01c2){return function(_0x376668){try{jsonpatch[_0x3205('0x1d')](_0x376668,_0x3a01c2,!![]);}catch(_0x345218){return BPromise[_0x3205('0x1e')](_0x345218);}return _0x376668[_0x3205('0x1f')]();};}function saveUpdates(_0x5f011f,_0x9b55e8){return function(_0x39feb9){if(_0x39feb9){return _0x39feb9[_0x3205('0x20')](_0x5f011f)['then'](function(_0x48da5b){return _0x48da5b;});}return null;};}function removeEntity(_0x2546a8,_0x1cb1ac){return function(_0x565e3c){if(_0x565e3c){return _0x565e3c[_0x3205('0x21')]()['then'](function(){_0x2546a8[_0x3205('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2df954,_0x4d6b45){return function(_0x55bc69){if(!_0x55bc69){_0x2df954[_0x3205('0x15')](0x194);}return _0x55bc69;};}function handleError(_0x1a405d,_0x2e5851){_0x2e5851=_0x2e5851||0x1f4;return function(_0x317659){logger[_0x3205('0x22')](_0x317659['stack']);if(_0x317659['name']){delete _0x317659[_0x3205('0x23')];}_0x1a405d[_0x3205('0x16')](_0x2e5851)[_0x3205('0x24')](_0x317659);};}exports[_0x3205('0x25')]=function(_0x4a3027,_0x83176){var _0xe63287={},_0x3832f3={},_0x35c553={'count':0x0,'rows':[]};var _0x351cb4=_[_0x3205('0x26')](db[_0x3205('0x27')][_0x3205('0x28')],function(_0x26e567){return{'name':_0x26e567[_0x3205('0x29')],'type':_0x26e567[_0x3205('0x2a')][_0x3205('0x2b')]};});_0x3832f3['model']=_['map'](_0x351cb4,'name');_0x3832f3[_0x3205('0x2c')]=_[_0x3205('0x2d')](_0x4a3027[_0x3205('0x2c')]);_0x3832f3[_0x3205('0x2e')]=_[_0x3205('0x2f')](_0x3832f3[_0x3205('0x30')],_0x3832f3[_0x3205('0x2c')]);_0xe63287[_0x3205('0x31')]=_['intersection'](_0x3832f3[_0x3205('0x30')],qs['fields'](_0x4a3027[_0x3205('0x2c')][_0x3205('0x32')]));_0xe63287['attributes']=_0xe63287['attributes'][_0x3205('0x33')]?_0xe63287[_0x3205('0x31')]:_0x3832f3[_0x3205('0x30')];if(!_0x4a3027[_0x3205('0x2c')][_0x3205('0x34')](_0x3205('0x35'))){_0xe63287[_0x3205('0x1a')]=qs[_0x3205('0x1a')](_0x4a3027[_0x3205('0x2c')][_0x3205('0x1a')]);_0xe63287[_0x3205('0x19')]=qs['offset'](_0x4a3027[_0x3205('0x2c')][_0x3205('0x19')]);}_0xe63287[_0x3205('0x36')]=qs[_0x3205('0x37')](_0x4a3027['query'][_0x3205('0x37')]);_0xe63287[_0x3205('0x38')]=qs[_0x3205('0x2e')](_[_0x3205('0x39')](_0x4a3027[_0x3205('0x2c')],_0x3832f3[_0x3205('0x2e')]),_0x351cb4);if(_0x4a3027[_0x3205('0x2c')][_0x3205('0x3a')]){_0xe63287['where']=_['merge'](_0xe63287[_0x3205('0x38')],{'$or':_[_0x3205('0x26')](_0x351cb4,function(_0x5cef58){if(_0x5cef58[_0x3205('0x2a')]!==_0x3205('0x3b')){var _0x3fd84c={};_0x3fd84c[_0x5cef58[_0x3205('0x23')]]={'$like':'%'+_0x4a3027[_0x3205('0x2c')]['filter']+'%'};return _0x3fd84c;}})});}_0xe63287=_[_0x3205('0x3c')]({},_0xe63287,_0x4a3027[_0x3205('0x3d')]);var _0x3db5ba={'where':_0xe63287[_0x3205('0x38')]};return db['JscriptyQuestionReport'][_0x3205('0x3e')](_0x3db5ba)['then'](function(_0x1efcd6){_0x35c553[_0x3205('0x3e')]=_0x1efcd6;if(_0x4a3027[_0x3205('0x2c')][_0x3205('0x3f')]){_0xe63287['include']=[{'all':!![]}];}return db[_0x3205('0x27')]['findAll'](_0xe63287);})[_0x3205('0x40')](function(_0x1398ae){_0x35c553['rows']=_0x1398ae;return _0x35c553;})[_0x3205('0x40')](respondWithFilteredResult(_0x83176,_0xe63287))[_0x3205('0x41')](handleError(_0x83176,null));};exports[_0x3205('0x42')]=function(_0x412999,_0x87bcb9){var _0x174c02={'raw':!![],'where':{'id':_0x412999[_0x3205('0x43')]['id']}},_0x688bc1={};_0x688bc1[_0x3205('0x30')]=_['keys'](db[_0x3205('0x27')][_0x3205('0x28')]);_0x688bc1[_0x3205('0x2c')]=_[_0x3205('0x2d')](_0x412999[_0x3205('0x2c')]);_0x688bc1[_0x3205('0x2e')]=_[_0x3205('0x2f')](_0x688bc1[_0x3205('0x30')],_0x688bc1[_0x3205('0x2c')]);_0x174c02['attributes']=_[_0x3205('0x2f')](_0x688bc1[_0x3205('0x30')],qs['fields'](_0x412999['query'][_0x3205('0x32')]));_0x174c02[_0x3205('0x31')]=_0x174c02[_0x3205('0x31')]['length']?_0x174c02[_0x3205('0x31')]:_0x688bc1['model'];if(_0x412999[_0x3205('0x2c')][_0x3205('0x3f')]){_0x174c02[_0x3205('0x44')]=[{'all':!![]}];}_0x174c02=_['merge']({},_0x174c02,_0x412999[_0x3205('0x3d')]);return db[_0x3205('0x27')][_0x3205('0x45')](_0x174c02)[_0x3205('0x40')](handleEntityNotFound(_0x87bcb9,null))[_0x3205('0x40')](respondWithResult(_0x87bcb9,null))['catch'](handleError(_0x87bcb9,null));};exports['create']=function(_0x29109f,_0xba9e2a){return db[_0x3205('0x27')][_0x3205('0x46')](_0x29109f[_0x3205('0x47')],{})[_0x3205('0x40')](respondWithResult(_0xba9e2a,0xc9))['catch'](handleError(_0xba9e2a,null));};exports[_0x3205('0x20')]=function(_0x4771b7,_0x4f0ce2){if(_0x4771b7[_0x3205('0x47')]['id']){delete _0x4771b7[_0x3205('0x47')]['id'];}return db['JscriptyQuestionReport'][_0x3205('0x45')]({'where':{'id':_0x4771b7[_0x3205('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f0ce2,null))[_0x3205('0x40')](saveUpdates(_0x4771b7[_0x3205('0x47')],null))[_0x3205('0x40')](respondWithResult(_0x4f0ce2,null))[_0x3205('0x41')](handleError(_0x4f0ce2,null));};exports[_0x3205('0x21')]=function(_0x517674,_0x261a3b){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x517674[_0x3205('0x43')]['id']}})[_0x3205('0x40')](handleEntityNotFound(_0x261a3b,null))[_0x3205('0x40')](removeEntity(_0x261a3b,null))['catch'](handleError(_0x261a3b,null));};exports['describe']=function(_0x45747e,_0x23b74b){return db['JscriptyQuestionReport'][_0x3205('0x48')]()[_0x3205('0x40')](respondWithResult(_0x23b74b,null))[_0x3205('0x41')](handleError(_0x23b74b,null));}; \ No newline at end of file +var _0xca76=['fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','JscriptyQuestionReport','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes'];(function(_0x3a58ec,_0x4205bb){var _0x2e0660=function(_0x23d07c){while(--_0x23d07c){_0x3a58ec['push'](_0x3a58ec['shift']());}};_0x2e0660(++_0x4205bb);}(_0xca76,0x14b));var _0x6ca7=function(_0x41cd4f,_0x9f6b39){_0x41cd4f=_0x41cd4f-0x0;var _0x2274ce=_0xca76[_0x41cd4f];return _0x2274ce;};'use strict';var pdf=require(_0x6ca7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6ca7('0x1'));var zipdir=require(_0x6ca7('0x2'));var jsonpatch=require(_0x6ca7('0x3'));var rp=require(_0x6ca7('0x4'));var moment=require(_0x6ca7('0x5'));var BPromise=require(_0x6ca7('0x6'));var Mustache=require('mustache');var util=require(_0x6ca7('0x7'));var path=require(_0x6ca7('0x8'));var sox=require(_0x6ca7('0x9'));var csv=require(_0x6ca7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6ca7('0xb'));var jsforce=require(_0x6ca7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca7('0xa'));var querystring=require(_0x6ca7('0xd'));var Papa=require(_0x6ca7('0xe'));var Redis=require(_0x6ca7('0xf'));var authService=require(_0x6ca7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6ca7('0x11'));var hardwareService=require(_0x6ca7('0x12'));var logger=require(_0x6ca7('0x13'))(_0x6ca7('0x14'));var utils=require(_0x6ca7('0x15'));var config=require(_0x6ca7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1386bc,_0x413f1e){_0x413f1e=_0x413f1e||0xcc;return function(_0x19c07c){if(_0x19c07c){return _0x1386bc[_0x6ca7('0x17')](_0x413f1e);}return _0x1386bc[_0x6ca7('0x18')](_0x413f1e)[_0x6ca7('0x19')]();};}function respondWithResult(_0x54f0e1,_0x362902){_0x362902=_0x362902||0xc8;return function(_0x80b374){if(_0x80b374){return _0x54f0e1['status'](_0x362902)['json'](_0x80b374);}};}function respondWithFilteredResult(_0x350253,_0x3eae05){return function(_0x2eb092){if(_0x2eb092){var _0x4a4851=_0x2eb092[_0x6ca7('0x1a')],_0xc273e8=_0x3eae05[_0x6ca7('0x1b')],_0x6ff359=_0x3eae05[_0x6ca7('0x1b')]+_0x3eae05[_0x6ca7('0x1c')],_0x267404;if(_0x6ff359>=_0x4a4851){_0x6ff359=_0x4a4851;_0x267404=0xc8;}else{_0x267404=0xce;}_0x350253[_0x6ca7('0x18')](_0x267404);return _0x350253[_0x6ca7('0x1d')](_0x6ca7('0x1e'),_0xc273e8+'-'+_0x6ff359+'/'+_0x4a4851)[_0x6ca7('0x1f')](_0x2eb092);}return null;};}function patchUpdates(_0x2eb134){return function(_0x11d952){try{jsonpatch[_0x6ca7('0x20')](_0x11d952,_0x2eb134,!![]);}catch(_0xbd9c96){return BPromise[_0x6ca7('0x21')](_0xbd9c96);}return _0x11d952[_0x6ca7('0x22')]();};}function saveUpdates(_0x3961e1,_0x2c8f98){return function(_0x5e8e05){if(_0x5e8e05){return _0x5e8e05[_0x6ca7('0x23')](_0x3961e1)[_0x6ca7('0x24')](function(_0x2d40bd){return _0x2d40bd;});}return null;};}function removeEntity(_0x426e45,_0x5d1898){return function(_0x29c2a3){if(_0x29c2a3){return _0x29c2a3[_0x6ca7('0x25')]()[_0x6ca7('0x24')](function(){_0x426e45[_0x6ca7('0x18')](0xcc)[_0x6ca7('0x19')]();});}};}function handleEntityNotFound(_0x26faef,_0x312f17){return function(_0x1eaa97){if(!_0x1eaa97){_0x26faef[_0x6ca7('0x17')](0x194);}return _0x1eaa97;};}function handleError(_0x177796,_0x169cdc){_0x169cdc=_0x169cdc||0x1f4;return function(_0x40c8e6){logger[_0x6ca7('0x26')](_0x40c8e6['stack']);if(_0x40c8e6[_0x6ca7('0x27')]){delete _0x40c8e6[_0x6ca7('0x27')];}_0x177796[_0x6ca7('0x18')](_0x169cdc)[_0x6ca7('0x28')](_0x40c8e6);};}exports[_0x6ca7('0x29')]=function(_0x45b015,_0x5bb90e){var _0xf04efe={},_0x51f724={},_0x26c397={'count':0x0,'rows':[]};var _0x11b926=_[_0x6ca7('0x2a')](db['JscriptyQuestionReport'][_0x6ca7('0x2b')],function(_0x23450b){return{'name':_0x23450b[_0x6ca7('0x2c')],'type':_0x23450b['type'][_0x6ca7('0x2d')]};});_0x51f724[_0x6ca7('0x2e')]=_['map'](_0x11b926,_0x6ca7('0x27'));_0x51f724[_0x6ca7('0x2f')]=_[_0x6ca7('0x30')](_0x45b015[_0x6ca7('0x2f')]);_0x51f724[_0x6ca7('0x31')]=_['intersection'](_0x51f724['model'],_0x51f724[_0x6ca7('0x2f')]);_0xf04efe[_0x6ca7('0x32')]=_[_0x6ca7('0x33')](_0x51f724['model'],qs[_0x6ca7('0x34')](_0x45b015[_0x6ca7('0x2f')][_0x6ca7('0x34')]));_0xf04efe[_0x6ca7('0x32')]=_0xf04efe[_0x6ca7('0x32')][_0x6ca7('0x35')]?_0xf04efe[_0x6ca7('0x32')]:_0x51f724[_0x6ca7('0x2e')];if(!_0x45b015[_0x6ca7('0x2f')]['hasOwnProperty'](_0x6ca7('0x36'))){_0xf04efe[_0x6ca7('0x1c')]=qs[_0x6ca7('0x1c')](_0x45b015[_0x6ca7('0x2f')][_0x6ca7('0x1c')]);_0xf04efe[_0x6ca7('0x1b')]=qs['offset'](_0x45b015[_0x6ca7('0x2f')]['offset']);}_0xf04efe[_0x6ca7('0x37')]=qs[_0x6ca7('0x38')](_0x45b015[_0x6ca7('0x2f')]['sort']);_0xf04efe['where']=qs[_0x6ca7('0x31')](_[_0x6ca7('0x39')](_0x45b015[_0x6ca7('0x2f')],_0x51f724[_0x6ca7('0x31')]),_0x11b926);if(_0x45b015[_0x6ca7('0x2f')]['filter']){_0xf04efe[_0x6ca7('0x3a')]=_[_0x6ca7('0x3b')](_0xf04efe[_0x6ca7('0x3a')],{'$or':_[_0x6ca7('0x2a')](_0x11b926,function(_0x2e3f8b){if(_0x2e3f8b[_0x6ca7('0x3c')]!==_0x6ca7('0x3d')){var _0x4234d3={};_0x4234d3[_0x2e3f8b['name']]={'$like':'%'+_0x45b015[_0x6ca7('0x2f')]['filter']+'%'};return _0x4234d3;}})});}_0xf04efe=_[_0x6ca7('0x3b')]({},_0xf04efe,_0x45b015[_0x6ca7('0x3e')]);var _0x41fff1={'where':_0xf04efe[_0x6ca7('0x3a')]};return db[_0x6ca7('0x3f')][_0x6ca7('0x1a')](_0x41fff1)['then'](function(_0x559c13){_0x26c397[_0x6ca7('0x1a')]=_0x559c13;if(_0x45b015[_0x6ca7('0x2f')]['includeAll']){_0xf04efe[_0x6ca7('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6ca7('0x41')](_0xf04efe);})['then'](function(_0x18dfcf){_0x26c397[_0x6ca7('0x42')]=_0x18dfcf;return _0x26c397;})[_0x6ca7('0x24')](respondWithFilteredResult(_0x5bb90e,_0xf04efe))[_0x6ca7('0x43')](handleError(_0x5bb90e,null));};exports[_0x6ca7('0x44')]=function(_0x3dac56,_0x3c34a6){var _0x302c5f={'raw':!![],'where':{'id':_0x3dac56[_0x6ca7('0x45')]['id']}},_0x489692={};_0x489692[_0x6ca7('0x2e')]=_['keys'](db[_0x6ca7('0x3f')][_0x6ca7('0x2b')]);_0x489692[_0x6ca7('0x2f')]=_[_0x6ca7('0x30')](_0x3dac56[_0x6ca7('0x2f')]);_0x489692[_0x6ca7('0x31')]=_[_0x6ca7('0x33')](_0x489692[_0x6ca7('0x2e')],_0x489692[_0x6ca7('0x2f')]);_0x302c5f['attributes']=_['intersection'](_0x489692['model'],qs[_0x6ca7('0x34')](_0x3dac56['query'][_0x6ca7('0x34')]));_0x302c5f[_0x6ca7('0x32')]=_0x302c5f['attributes'][_0x6ca7('0x35')]?_0x302c5f[_0x6ca7('0x32')]:_0x489692[_0x6ca7('0x2e')];if(_0x3dac56['query'][_0x6ca7('0x46')]){_0x302c5f[_0x6ca7('0x40')]=[{'all':!![]}];}_0x302c5f=_[_0x6ca7('0x3b')]({},_0x302c5f,_0x3dac56['options']);return db[_0x6ca7('0x3f')]['find'](_0x302c5f)[_0x6ca7('0x24')](handleEntityNotFound(_0x3c34a6,null))[_0x6ca7('0x24')](respondWithResult(_0x3c34a6,null))[_0x6ca7('0x43')](handleError(_0x3c34a6,null));};exports['create']=function(_0x1d5cf2,_0x39573a){return db[_0x6ca7('0x3f')][_0x6ca7('0x47')](_0x1d5cf2[_0x6ca7('0x48')],{})['then'](respondWithResult(_0x39573a,0xc9))[_0x6ca7('0x43')](handleError(_0x39573a,null));};exports['update']=function(_0x41fee3,_0xb81e93){if(_0x41fee3[_0x6ca7('0x48')]['id']){delete _0x41fee3['body']['id'];}return db[_0x6ca7('0x3f')][_0x6ca7('0x49')]({'where':{'id':_0x41fee3['params']['id']}})[_0x6ca7('0x24')](handleEntityNotFound(_0xb81e93,null))[_0x6ca7('0x24')](saveUpdates(_0x41fee3[_0x6ca7('0x48')],null))[_0x6ca7('0x24')](respondWithResult(_0xb81e93,null))[_0x6ca7('0x43')](handleError(_0xb81e93,null));};exports[_0x6ca7('0x25')]=function(_0x532613,_0x1fd78a){return db[_0x6ca7('0x3f')]['find']({'where':{'id':_0x532613[_0x6ca7('0x45')]['id']}})[_0x6ca7('0x24')](handleEntityNotFound(_0x1fd78a,null))['then'](removeEntity(_0x1fd78a,null))[_0x6ca7('0x43')](handleError(_0x1fd78a,null));};exports['describe']=function(_0x5c479e,_0x2af6a3){return db[_0x6ca7('0x3f')][_0x6ca7('0x4a')]()[_0x6ca7('0x24')](respondWithResult(_0x2af6a3,null))['catch'](handleError(_0x2af6a3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index f2f8e51..9e9904e 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebda=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5e0866,_0x415f21){var _0x288734=function(_0x344505){while(--_0x344505){_0x5e0866['push'](_0x5e0866['shift']());}};_0x288734(++_0x415f21);}(_0xebda,0x1da));var _0xaebd=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xebda[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0xaebd('0x0'));var util=require(_0xaebd('0x1'));var logger=require(_0xaebd('0x2'))(_0xaebd('0x3'));var moment=require('moment');var BPromise=require(_0xaebd('0x4'));var rp=require(_0xaebd('0x5'));var fs=require('fs');var path=require(_0xaebd('0x6'));var rimraf=require('rimraf');var config=require(_0xaebd('0x7'));var attributes=require(_0xaebd('0x8'));module[_0xaebd('0x9')]=function(_0x256f34,_0x573f40){return _0x256f34[_0xaebd('0xa')](_0xaebd('0xb'),attributes,{'tableName':_0xaebd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23d2=['path','rimraf','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','util','api','moment','request-promise'];(function(_0x423165,_0x12d802){var _0x304f1a=function(_0x584fbd){while(--_0x584fbd){_0x423165['push'](_0x423165['shift']());}};_0x304f1a(++_0x12d802);}(_0x23d2,0x9c));var _0x223d=function(_0x1f5239,_0x405b72){_0x1f5239=_0x1f5239-0x0;var _0x141d4d=_0x23d2[_0x1f5239];return _0x141d4d;};'use strict';var _=require('lodash');var util=require(_0x223d('0x0'));var logger=require('../../config/logger')(_0x223d('0x1'));var moment=require(_0x223d('0x2'));var BPromise=require('bluebird');var rp=require(_0x223d('0x3'));var fs=require('fs');var path=require(_0x223d('0x4'));var rimraf=require(_0x223d('0x5'));var config=require('../../config/environment');var attributes=require(_0x223d('0x6'));module[_0x223d('0x7')]=function(_0x185b05,_0x28954a){return _0x185b05['define'](_0x223d('0x8'),attributes,{'tableName':_0x223d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index b9252b7..780cde3 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd61c=['rpc','../../config/environment','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x259f89,_0x12eb71){var _0x38eed0=function(_0x555483){while(--_0x555483){_0x259f89['push'](_0x259f89['shift']());}};_0x38eed0(++_0x12eb71);}(_0xd61c,0xb6));var _0xcd61=function(_0x5dbe97,_0x412255){_0x5dbe97=_0x5dbe97-0x0;var _0x24926c=_0xd61c[_0x5dbe97];return _0x24926c;};'use strict';var _=require(_0xcd61('0x0'));var util=require(_0xcd61('0x1'));var moment=require('moment');var BPromise=require(_0xcd61('0x2'));var rs=require(_0xcd61('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd61('0x4'))['db'];var utils=require(_0xcd61('0x5'));var logger=require(_0xcd61('0x6'))(_0xcd61('0x7'));var config=require(_0xcd61('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcd61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x152edc,_0x518047,_0x730d0c){return new BPromise(function(_0x5b5266,_0x2c5bee){return client[_0xcd61('0xa')](_0x152edc,_0x730d0c)['then'](function(_0x3d4dee){logger['info'](_0xcd61('0xb'),_0x518047,_0xcd61('0xc'));logger[_0xcd61('0xd')](_0xcd61('0xe'),_0x518047,_0xcd61('0xc'),JSON[_0xcd61('0xf')](_0x3d4dee));if(_0x3d4dee['error']){if(_0x3d4dee[_0xcd61('0x10')][_0xcd61('0x11')]===0x1f4){logger[_0xcd61('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x518047,_0x3d4dee[_0xcd61('0x10')]['message']);return _0x2c5bee(_0x3d4dee['error'][_0xcd61('0x12')]);}logger['error'](_0xcd61('0xb'),_0x518047,_0x3d4dee[_0xcd61('0x10')][_0xcd61('0x12')]);return _0x5b5266(_0x3d4dee[_0xcd61('0x10')][_0xcd61('0x12')]);}else{logger[_0xcd61('0x13')](_0xcd61('0xb'),_0x518047,_0xcd61('0xc'));_0x5b5266(_0x3d4dee['result'][_0xcd61('0x12')]);}})[_0xcd61('0x14')](function(_0x1c5d9d){logger[_0xcd61('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x518047,_0x1c5d9d);_0x2c5bee(_0x1c5d9d);});});} \ No newline at end of file +var _0x4ff9=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring'];(function(_0x482399,_0x54184a){var _0x3bdd94=function(_0x29e795){while(--_0x29e795){_0x482399['push'](_0x482399['shift']());}};_0x3bdd94(++_0x54184a);}(_0x4ff9,0xf8));var _0x94ff=function(_0x44a1fb,_0x1ddb08){_0x44a1fb=_0x44a1fb-0x0;var _0x2be797=_0x4ff9[_0x44a1fb];return _0x2be797;};'use strict';var _=require(_0x94ff('0x0'));var util=require(_0x94ff('0x1'));var moment=require('moment');var BPromise=require(_0x94ff('0x2'));var rs=require(_0x94ff('0x3'));var fs=require('fs');var Redis=require(_0x94ff('0x4'));var db=require(_0x94ff('0x5'))['db'];var utils=require(_0x94ff('0x6'));var logger=require('../../config/logger')(_0x94ff('0x7'));var config=require(_0x94ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x94ff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13ef83,_0x15f649,_0xc0c998){return new BPromise(function(_0x71e8e1,_0x27d2c1){return client[_0x94ff('0xa')](_0x13ef83,_0xc0c998)[_0x94ff('0xb')](function(_0x279c63){logger[_0x94ff('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x15f649,_0x94ff('0xd'));logger[_0x94ff('0xe')](_0x94ff('0xf'),_0x15f649,_0x94ff('0xd'),JSON[_0x94ff('0x10')](_0x279c63));if(_0x279c63[_0x94ff('0x11')]){if(_0x279c63[_0x94ff('0x11')][_0x94ff('0x12')]===0x1f4){logger['error'](_0x94ff('0x13'),_0x15f649,_0x279c63[_0x94ff('0x11')][_0x94ff('0x14')]);return _0x27d2c1(_0x279c63[_0x94ff('0x11')]['message']);}logger[_0x94ff('0x11')](_0x94ff('0x13'),_0x15f649,_0x279c63[_0x94ff('0x11')][_0x94ff('0x14')]);return _0x71e8e1(_0x279c63[_0x94ff('0x11')][_0x94ff('0x14')]);}else{logger[_0x94ff('0xc')](_0x94ff('0x13'),_0x15f649,'request\x20sent');_0x71e8e1(_0x279c63['result'][_0x94ff('0x14')]);}})['catch'](function(_0x3ae7b9){logger[_0x94ff('0x11')](_0x94ff('0x13'),_0x15f649,_0x3ae7b9);_0x27d2c1(_0x3ae7b9);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e80b55a..4b9a501 100644 --- a/server/api/jscriptySessionReport/index.js +++ b/server/api/jscriptySessionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getQuestions','post','create','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4fb,0x150));var _0xba4f=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xa4fb[_0x499210];return _0x2e153d;};'use strict';var multer=require(_0xba4f('0x0'));var util=require(_0xba4f('0x1'));var path=require(_0xba4f('0x2'));var timeout=require(_0xba4f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xba4f('0x4'));var interaction=require(_0xba4f('0x5'));var config=require(_0xba4f('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0xba4f('0x7')]('/',auth[_0xba4f('0x8')](),controller[_0xba4f('0x9')]);router[_0xba4f('0x7')](_0xba4f('0xa'),auth[_0xba4f('0x8')](),controller[_0xba4f('0xb')]);router[_0xba4f('0x7')](_0xba4f('0xc'),auth[_0xba4f('0x8')](),controller['show']);router[_0xba4f('0x7')]('/:id/questions',auth[_0xba4f('0x8')](),controller[_0xba4f('0xd')]);router[_0xba4f('0xe')]('/',auth[_0xba4f('0x8')](),controller[_0xba4f('0xf')]);router[_0xba4f('0x10')]('/:id',auth[_0xba4f('0x8')](),controller[_0xba4f('0x11')]);router[_0xba4f('0x12')](_0xba4f('0xc'),auth[_0xba4f('0x8')](),controller[_0xba4f('0x13')]);module[_0xba4f('0x14')]=router; \ No newline at end of file +var _0xcca7=['getQuestions','post','create','put','update','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions'];(function(_0x13c12b,_0x4baa0d){var _0x4fcf37=function(_0xcd644e){while(--_0xcd644e){_0x13c12b['push'](_0x13c12b['shift']());}};_0x4fcf37(++_0x4baa0d);}(_0xcca7,0x1aa));var _0x7cca=function(_0x8ad3d,_0x3d7f00){_0x8ad3d=_0x8ad3d-0x0;var _0x1505a5=_0xcca7[_0x8ad3d];return _0x1505a5;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7cca('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7cca('0x5'));var controller=require(_0x7cca('0x6'));router[_0x7cca('0x7')]('/',auth[_0x7cca('0x8')](),controller[_0x7cca('0x9')]);router[_0x7cca('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x7cca('0xa')]);router[_0x7cca('0x7')](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0xc')]);router[_0x7cca('0x7')](_0x7cca('0xd'),auth[_0x7cca('0x8')](),controller[_0x7cca('0xe')]);router[_0x7cca('0xf')]('/',auth['isAuthenticated'](),controller[_0x7cca('0x10')]);router[_0x7cca('0x11')](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0x12')]);router['delete'](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 24e7730..2f3235a 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae26=['DATE','STRING','moment','sequelize','exports','setDataValue','starttime','endtime','format'];(function(_0xe6f4ef,_0x4e34cc){var _0x4f3447=function(_0x1538ff){while(--_0x1538ff){_0xe6f4ef['push'](_0xe6f4ef['shift']());}};_0x4f3447(++_0x4e34cc);}(_0xae26,0xa4));var _0x6ae2=function(_0x3cc751,_0x38b8ff){_0x3cc751=_0x3cc751-0x0;var _0x3956a2=_0xae26[_0x3cc751];return _0x3956a2;};'use strict';var moment=require(_0x6ae2('0x0'));var Sequelize=require(_0x6ae2('0x1'));module[_0x6ae2('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x28ef54){this[_0x6ae2('0x3')](_0x6ae2('0x4'),_0x28ef54);this[_0x6ae2('0x3')](_0x6ae2('0x5'),moment()[_0x6ae2('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x6ae2('0x7')]},'membername':{'type':Sequelize[_0x6ae2('0x8')]},'projectname':{'type':Sequelize[_0x6ae2('0x8')]},'queue':{'type':Sequelize[_0x6ae2('0x8')]},'uniqueid':{'type':Sequelize[_0x6ae2('0x8')]},'calleridname':{'type':Sequelize[_0x6ae2('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0ab1=['sequelize','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x14ef80,_0x3589fd){var _0x8e82c5=function(_0x5934b9){while(--_0x5934b9){_0x14ef80['push'](_0x14ef80['shift']());}};_0x8e82c5(++_0x3589fd);}(_0x0ab1,0x128));var _0x10ab=function(_0x5119dd,_0x50bd16){_0x5119dd=_0x5119dd-0x0;var _0x3cae9f=_0x0ab1[_0x5119dd];return _0x3cae9f;};'use strict';var moment=require('moment');var Sequelize=require(_0x10ab('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x10ab('0x1')],'set':function(_0x40683a){this[_0x10ab('0x2')](_0x10ab('0x3'),_0x40683a);this[_0x10ab('0x2')]('endtime',moment()[_0x10ab('0x4')](_0x10ab('0x5')));}},'endtime':{'type':Sequelize[_0x10ab('0x1')]},'membername':{'type':Sequelize[_0x10ab('0x6')]},'projectname':{'type':Sequelize[_0x10ab('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x10ab('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x10ab('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 904255d..891845a 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','fields','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','intersection','SessionId','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x5c4886,_0x1d9665){var _0x4fe65a=function(_0x5ef1b9){while(--_0x5ef1b9){_0x5c4886['push'](_0x5c4886['shift']());}};_0x4fe65a(++_0x1d9665);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xcb91[_0x101e7b];return _0x4995c0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var licenseUtil=require(_0x1cb9('0x15'));var db=require(_0x1cb9('0x16'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x18')](_0x5e3c19)[_0x1cb9('0x19')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x18')](_0x56884d)[_0x1cb9('0x1a')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=_0x5806d8[_0x1cb9('0x1b')],_0xd446a3=_0x3e2d11[_0x1cb9('0x1c')],_0x3cc765=_0x3e2d11[_0x1cb9('0x1c')]+_0x3e2d11[_0x1cb9('0x1d')],_0x3904b7;if(_0x3cc765>=_0x5572cb){_0x3cc765=_0x5572cb;_0x3904b7=0xc8;}else{_0x3904b7=0xce;}_0x8dfa55['status'](_0x3904b7);return _0x8dfa55['set'](_0x1cb9('0x1e'),_0xd446a3+'-'+_0x3cc765+'/'+_0x5572cb)[_0x1cb9('0x1a')](_0x5806d8);}return null;};}function patchUpdates(_0x2b2669){return function(_0x31481a){try{jsonpatch[_0x1cb9('0x1f')](_0x31481a,_0x2b2669,!![]);}catch(_0x4014de){return BPromise[_0x1cb9('0x20')](_0x4014de);}return _0x31481a['save']();};}function saveUpdates(_0x559bcc,_0x1a5a72){return function(_0x5dbfae){if(_0x5dbfae){return _0x5dbfae[_0x1cb9('0x21')](_0x559bcc)[_0x1cb9('0x22')](function(_0x523b26){return _0x523b26;});}return null;};}function removeEntity(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x23')]()[_0x1cb9('0x22')](function(){_0x599275[_0x1cb9('0x18')](0xcc)[_0x1cb9('0x19')]();});}};}function handleEntityNotFound(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(!_0x6c6f61){_0x59ebea['sendStatus'](0x194);}return _0x6c6f61;};}function handleError(_0x10a419,_0x2b1275){_0x2b1275=_0x2b1275||0x1f4;return function(_0x69b4c8){logger[_0x1cb9('0x24')](_0x69b4c8[_0x1cb9('0x25')]);if(_0x69b4c8['name']){delete _0x69b4c8[_0x1cb9('0x26')];}_0x10a419[_0x1cb9('0x18')](_0x2b1275)['send'](_0x69b4c8);};}exports[_0x1cb9('0x27')]=function(_0x21effa,_0x41a9a0){var _0x1804fd={},_0x406821={},_0x21d6f5={'count':0x0,'rows':[]};var _0x2e28fe=_[_0x1cb9('0x28')](db[_0x1cb9('0x29')][_0x1cb9('0x2a')],function(_0x48888d){return{'name':_0x48888d[_0x1cb9('0x2b')],'type':_0x48888d['type'][_0x1cb9('0x2c')]};});_0x406821['model']=_[_0x1cb9('0x28')](_0x2e28fe,_0x1cb9('0x26'));_0x406821[_0x1cb9('0x2d')]=_[_0x1cb9('0x2e')](_0x21effa['query']);_0x406821[_0x1cb9('0x2f')]=_['intersection'](_0x406821[_0x1cb9('0x30')],_0x406821[_0x1cb9('0x2d')]);_0x1804fd[_0x1cb9('0x31')]=_['intersection'](_0x406821[_0x1cb9('0x30')],qs['fields'](_0x21effa[_0x1cb9('0x2d')]['fields']));_0x1804fd[_0x1cb9('0x31')]=_0x1804fd[_0x1cb9('0x31')][_0x1cb9('0x32')]?_0x1804fd[_0x1cb9('0x31')]:_0x406821['model'];if(!_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x33')](_0x1cb9('0x34'))){_0x1804fd[_0x1cb9('0x1d')]=qs[_0x1cb9('0x1d')](_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x1d')]);_0x1804fd[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x1c')]);}_0x1804fd[_0x1cb9('0x35')]=qs[_0x1cb9('0x36')](_0x21effa['query']['sort']);_0x1804fd[_0x1cb9('0x37')]=qs[_0x1cb9('0x2f')](_[_0x1cb9('0x38')](_0x21effa[_0x1cb9('0x2d')],_0x406821[_0x1cb9('0x2f')]),_0x2e28fe);if(_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x39')]){_0x1804fd[_0x1cb9('0x37')]=_['merge'](_0x1804fd[_0x1cb9('0x37')],{'$or':_[_0x1cb9('0x28')](_0x2e28fe,function(_0xefe136){if(_0xefe136['type']!==_0x1cb9('0x3a')){var _0x5c7cd0={};_0x5c7cd0[_0xefe136[_0x1cb9('0x26')]]={'$like':'%'+_0x21effa['query'][_0x1cb9('0x39')]+'%'};return _0x5c7cd0;}})});}_0x1804fd=_[_0x1cb9('0x3b')]({},_0x1804fd,_0x21effa[_0x1cb9('0x3c')]);var _0x2bcacd={'where':_0x1804fd[_0x1cb9('0x37')]};return db[_0x1cb9('0x29')][_0x1cb9('0x1b')](_0x2bcacd)['then'](function(_0x4ca19e){_0x21d6f5[_0x1cb9('0x1b')]=_0x4ca19e;if(_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x3d')]){_0x1804fd[_0x1cb9('0x3e')]=[{'all':!![]}];}return db[_0x1cb9('0x29')][_0x1cb9('0x3f')](_0x1804fd);})[_0x1cb9('0x22')](function(_0x4a670c){_0x21d6f5[_0x1cb9('0x40')]=_0x4a670c;return _0x21d6f5;})['then'](respondWithFilteredResult(_0x41a9a0,_0x1804fd))['catch'](handleError(_0x41a9a0,null));};exports['show']=function(_0x409c62,_0x397ff9){var _0x1bf51c={'raw':!![],'where':{'id':_0x409c62[_0x1cb9('0x41')]['id']}},_0x2e3cf3={};_0x2e3cf3['model']=_[_0x1cb9('0x2e')](db['JscriptySessionReport'][_0x1cb9('0x2a')]);_0x2e3cf3[_0x1cb9('0x2d')]=_[_0x1cb9('0x2e')](_0x409c62['query']);_0x2e3cf3[_0x1cb9('0x2f')]=_['intersection'](_0x2e3cf3[_0x1cb9('0x30')],_0x2e3cf3[_0x1cb9('0x2d')]);_0x1bf51c['attributes']=_['intersection'](_0x2e3cf3[_0x1cb9('0x30')],qs[_0x1cb9('0x42')](_0x409c62[_0x1cb9('0x2d')][_0x1cb9('0x42')]));_0x1bf51c[_0x1cb9('0x31')]=_0x1bf51c['attributes'][_0x1cb9('0x32')]?_0x1bf51c['attributes']:_0x2e3cf3['model'];if(_0x409c62['query'][_0x1cb9('0x3d')]){_0x1bf51c[_0x1cb9('0x3e')]=[{'all':!![]}];}_0x1bf51c=_[_0x1cb9('0x3b')]({},_0x1bf51c,_0x409c62[_0x1cb9('0x3c')]);return db[_0x1cb9('0x29')][_0x1cb9('0x43')](_0x1bf51c)[_0x1cb9('0x22')](handleEntityNotFound(_0x397ff9,null))[_0x1cb9('0x22')](respondWithResult(_0x397ff9,null))[_0x1cb9('0x44')](handleError(_0x397ff9,null));};exports[_0x1cb9('0x45')]=function(_0x3ea88c,_0x4ce899){return db[_0x1cb9('0x29')][_0x1cb9('0x45')](_0x3ea88c[_0x1cb9('0x46')],{})['then'](respondWithResult(_0x4ce899,0xc9))[_0x1cb9('0x44')](handleError(_0x4ce899,null));};exports[_0x1cb9('0x21')]=function(_0x3c6044,_0x2efdbb){if(_0x3c6044[_0x1cb9('0x46')]['id']){delete _0x3c6044['body']['id'];}return db[_0x1cb9('0x29')]['find']({'where':{'id':_0x3c6044[_0x1cb9('0x41')]['id']}})['then'](handleEntityNotFound(_0x2efdbb,null))[_0x1cb9('0x22')](saveUpdates(_0x3c6044[_0x1cb9('0x46')],null))[_0x1cb9('0x22')](respondWithResult(_0x2efdbb,null))[_0x1cb9('0x44')](handleError(_0x2efdbb,null));};exports['destroy']=function(_0x298475,_0x1149b9){return db[_0x1cb9('0x29')][_0x1cb9('0x43')]({'where':{'id':_0x298475[_0x1cb9('0x41')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x1149b9,null))[_0x1cb9('0x22')](removeEntity(_0x1149b9,null))[_0x1cb9('0x44')](handleError(_0x1149b9,null));};exports[_0x1cb9('0x47')]=function(_0x17f10e,_0x48dd4a){return db['JscriptySessionReport'][_0x1cb9('0x47')]()[_0x1cb9('0x22')](respondWithResult(_0x48dd4a,null))[_0x1cb9('0x44')](handleError(_0x48dd4a,null));};exports[_0x1cb9('0x48')]=function(_0x20b253,_0x2d076b,_0x367dd7){var _0x1c4ff6={'raw':!![],'where':{}};var _0x36c53a={};var _0x166ca2={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x1cb9('0x49')]({'where':{'id':_0x20b253['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2d076b,null))['then'](function(_0x135795){if(_0x135795){_0x36c53a['model']=_['keys'](db[_0x1cb9('0x4a')][_0x1cb9('0x2a')]);_0x36c53a[_0x1cb9('0x2d')]=_['keys'](_0x20b253[_0x1cb9('0x2d')]);_0x36c53a[_0x1cb9('0x2f')]=_['intersection'](_0x36c53a['model'],_0x36c53a[_0x1cb9('0x2d')]);_0x1c4ff6[_0x1cb9('0x31')]=_[_0x1cb9('0x4b')](_0x36c53a[_0x1cb9('0x30')],qs[_0x1cb9('0x42')](_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x42')]));_0x1c4ff6['attributes']=_0x1c4ff6[_0x1cb9('0x31')][_0x1cb9('0x32')]?_0x1c4ff6[_0x1cb9('0x31')]:_0x36c53a['model'];if(!_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x33')](_0x1cb9('0x34'))){_0x1c4ff6[_0x1cb9('0x1d')]=qs[_0x1cb9('0x1d')](_0x20b253[_0x1cb9('0x2d')]['limit']);_0x1c4ff6[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x1c')]);}_0x1c4ff6[_0x1cb9('0x35')]=qs[_0x1cb9('0x36')](_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x36')]);_0x1c4ff6[_0x1cb9('0x37')]=qs[_0x1cb9('0x2f')](_[_0x1cb9('0x38')](_0x20b253['query'],_0x36c53a[_0x1cb9('0x2f')]));_0x1c4ff6[_0x1cb9('0x37')][_0x1cb9('0x4c')]=_0x135795['id'];if(_0x20b253[_0x1cb9('0x2d')]['filter']){_0x1c4ff6['where']=_[_0x1cb9('0x3b')](_0x1c4ff6[_0x1cb9('0x37')],{'$or':_[_0x1cb9('0x28')](_0x1c4ff6[_0x1cb9('0x31')],function(_0x3c2f9c){var _0x75c734={};_0x75c734[_0x3c2f9c]={'$like':'%'+_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x39')]+'%'};return _0x75c734;})});}_0x1c4ff6=_['merge']({},_0x1c4ff6,_0x20b253['options']);return db[_0x1cb9('0x4a')]['count']({'where':_0x1c4ff6['where']})['then'](function(_0x580369){_0x166ca2['count']=_0x580369;if(_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x3d')]){_0x1c4ff6[_0x1cb9('0x3e')]=[{'all':!![]}];}return db[_0x1cb9('0x4a')][_0x1cb9('0x3f')](_0x1c4ff6);})[_0x1cb9('0x22')](function(_0x54f008){_0x166ca2[_0x1cb9('0x40')]=_0x54f008;return _0x166ca2;});}})[_0x1cb9('0x22')](respondWithFilteredResult(_0x2d076b,_0x1c4ff6))['catch'](handleError(_0x2d076b,null));}; \ No newline at end of file +var _0xa9e0=['mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','getQuestions','findOne','pick','JscriptyQuestionReport','html-pdf','eml-format','rimraf','request-promise','bluebird'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':!![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['JscriptySessionReport'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b){return db['JscriptySessionReport'][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports[_0x0a9e('0x46')]=function(_0x61bb17,_0x30decb,_0x2e5165){var _0x375c18={'raw':!![],'where':{}};var _0x5d38ae={};var _0x4b1b9f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0a9e('0x47')]({'where':{'id':_0x61bb17[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x30decb,null))['then'](function(_0x2b69d9){if(_0x2b69d9){_0x5d38ae[_0x0a9e('0x2a')]=_['keys'](db['JscriptyQuestionReport'][_0x0a9e('0x27')]);_0x5d38ae['query']=_[_0x0a9e('0x3f')](_0x61bb17['query']);_0x5d38ae[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5d38ae[_0x0a9e('0x2a')],_0x5d38ae['query']);_0x375c18[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5d38ae['model'],qs['fields'](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x375c18['attributes']=_0x375c18[_0x0a9e('0x2e')]['length']?_0x375c18[_0x0a9e('0x2e')]:_0x5d38ae['model'];if(!_0x61bb17[_0x0a9e('0x2b')]['hasOwnProperty']('nolimit')){_0x375c18['limit']=qs[_0x0a9e('0x1a')](_0x61bb17['query'][_0x0a9e('0x1a')]);_0x375c18[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}_0x375c18[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x61bb17[_0x0a9e('0x2b')]['sort']);_0x375c18[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x48')](_0x61bb17[_0x0a9e('0x2b')],_0x5d38ae[_0x0a9e('0x2c')]));_0x375c18[_0x0a9e('0x34')]['SessionId']=_0x2b69d9['id'];if(_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x375c18['where']=_[_0x0a9e('0x37')](_0x375c18['where'],{'$or':_[_0x0a9e('0x25')](_0x375c18['attributes'],function(_0x4b3c1a){var _0x5674ee={};_0x5674ee[_0x4b3c1a]={'$like':'%'+_0x61bb17[_0x0a9e('0x2b')]['filter']+'%'};return _0x5674ee;})});}_0x375c18=_[_0x0a9e('0x37')]({},_0x375c18,_0x61bb17[_0x0a9e('0x40')]);return db[_0x0a9e('0x49')][_0x0a9e('0x38')]({'where':_0x375c18[_0x0a9e('0x34')]})[_0x0a9e('0x22')](function(_0x49eed0){_0x4b1b9f[_0x0a9e('0x38')]=_0x49eed0;if(_0x61bb17['query'][_0x0a9e('0x39')]){_0x375c18[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x49')]['findAll'](_0x375c18);})[_0x0a9e('0x22')](function(_0x156f1c){_0x4b1b9f[_0x0a9e('0x3c')]=_0x156f1c;return _0x4b1b9f;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x30decb,_0x375c18))['catch'](handleError(_0x30decb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index aa08766..fcdf9f8 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x761d=['api','moment','bluebird','request-promise','path','rimraf','exports','report_jscripty_sessions','util','../../config/logger'];(function(_0x495394,_0x4e9ae5){var _0x320289=function(_0x32a95c){while(--_0x32a95c){_0x495394['push'](_0x495394['shift']());}};_0x320289(++_0x4e9ae5);}(_0x761d,0x148));var _0xd761=function(_0x1b6a72,_0x3f0ef2){_0x1b6a72=_0x1b6a72-0x0;var _0x293f67=_0x761d[_0x1b6a72];return _0x293f67;};'use strict';var _=require('lodash');var util=require(_0xd761('0x0'));var logger=require(_0xd761('0x1'))(_0xd761('0x2'));var moment=require(_0xd761('0x3'));var BPromise=require(_0xd761('0x4'));var rp=require(_0xd761('0x5'));var fs=require('fs');var path=require(_0xd761('0x6'));var rimraf=require(_0xd761('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0xd761('0x8')]=function(_0x430a5f,_0x5d8295){return _0x430a5f['define']('JscriptySessionReport',attributes,{'tableName':_0xd761('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb7b=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x5986f6,_0x503843){var _0x147203=function(_0x1cded5){while(--_0x1cded5){_0x5986f6['push'](_0x5986f6['shift']());}};_0x147203(++_0x503843);}(_0xfb7b,0x1a3));var _0xbfb7=function(_0x4849ad,_0x18d02b){_0x4849ad=_0x4849ad-0x0;var _0x2151ce=_0xfb7b[_0x4849ad];return _0x2151ce;};'use strict';var _=require(_0xbfb7('0x0'));var util=require('util');var logger=require(_0xbfb7('0x1'))(_0xbfb7('0x2'));var moment=require(_0xbfb7('0x3'));var BPromise=require('bluebird');var rp=require(_0xbfb7('0x4'));var fs=require('fs');var path=require(_0xbfb7('0x5'));var rimraf=require(_0xbfb7('0x6'));var config=require(_0xbfb7('0x7'));var attributes=require(_0xbfb7('0x8'));module[_0xbfb7('0x9')]=function(_0x2180cb,_0x12f986){return _0x2180cb[_0xbfb7('0xa')](_0xbfb7('0xb'),attributes,{'tableName':_0xbfb7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index a3aa583..f04c675 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x730a=['info','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x472c25,_0x28ca85){var _0x3396ef=function(_0x434ed9){while(--_0x434ed9){_0x472c25['push'](_0x472c25['shift']());}};_0x3396ef(++_0x28ca85);}(_0x730a,0x80));var _0xa730=function(_0x53e297,_0x53189b){_0x53e297=_0x53e297-0x0;var _0x4380ff=_0x730a[_0x53e297];return _0x4380ff;};'use strict';var _=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var moment=require(_0xa730('0x2'));var BPromise=require('bluebird');var rs=require(_0xa730('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa730('0x4'))['db'];var utils=require(_0xa730('0x5'));var logger=require(_0xa730('0x6'))(_0xa730('0x7'));var config=require(_0xa730('0x8'));var jayson=require(_0xa730('0x9'));var client=jayson[_0xa730('0xa')][_0xa730('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f30df,_0x4ded32,_0x2d3e19){return new BPromise(function(_0x3ad23d,_0xe776fb){return client[_0xa730('0xc')](_0x1f30df,_0x2d3e19)[_0xa730('0xd')](function(_0x2890d5){logger['info'](_0xa730('0xe'),_0x4ded32,'request\x20sent');logger['debug'](_0xa730('0xf'),_0x4ded32,_0xa730('0x10'),JSON['stringify'](_0x2890d5));if(_0x2890d5[_0xa730('0x11')]){if(_0x2890d5[_0xa730('0x11')]['code']===0x1f4){logger[_0xa730('0x11')](_0xa730('0xe'),_0x4ded32,_0x2890d5[_0xa730('0x11')]['message']);return _0xe776fb(_0x2890d5['error'][_0xa730('0x12')]);}logger[_0xa730('0x11')](_0xa730('0xe'),_0x4ded32,_0x2890d5['error']['message']);return _0x3ad23d(_0x2890d5[_0xa730('0x11')][_0xa730('0x12')]);}else{logger[_0xa730('0x13')](_0xa730('0xe'),_0x4ded32,_0xa730('0x10'));_0x3ad23d(_0x2890d5[_0xa730('0x14')][_0xa730('0x12')]);}})['catch'](function(_0x53fd11){logger[_0xa730('0x11')](_0xa730('0xe'),_0x4ded32,_0x53fd11);_0xe776fb(_0x53fd11);});});} \ No newline at end of file +var _0x9901=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x9901,0xcb));var _0x1990=function(_0x528b92,_0x2a3971){_0x528b92=_0x528b92-0x0;var _0x171eba=_0x9901[_0x528b92];return _0x171eba;};'use strict';var _=require('lodash');var util=require(_0x1990('0x0'));var moment=require(_0x1990('0x1'));var BPromise=require(_0x1990('0x2'));var rs=require(_0x1990('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1990('0x4'));var logger=require('../../config/logger')(_0x1990('0x5'));var config=require(_0x1990('0x6'));var jayson=require(_0x1990('0x7'));var client=jayson[_0x1990('0x8')][_0x1990('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547543,_0x3b260c,_0xfd9513){return new BPromise(function(_0x33f5f4,_0x3a464f){return client[_0x1990('0xa')](_0x547543,_0xfd9513)[_0x1990('0xb')](function(_0x19a686){logger[_0x1990('0xc')](_0x1990('0xd'),_0x3b260c,_0x1990('0xe'));logger[_0x1990('0xf')](_0x1990('0x10'),_0x3b260c,'request\x20sent',JSON[_0x1990('0x11')](_0x19a686));if(_0x19a686['error']){if(_0x19a686[_0x1990('0x12')][_0x1990('0x13')]===0x1f4){logger[_0x1990('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b260c,_0x19a686[_0x1990('0x12')][_0x1990('0x14')]);return _0x3a464f(_0x19a686[_0x1990('0x12')][_0x1990('0x14')]);}logger['error'](_0x1990('0xd'),_0x3b260c,_0x19a686[_0x1990('0x12')][_0x1990('0x14')]);return _0x33f5f4(_0x19a686['error']['message']);}else{logger[_0x1990('0xc')](_0x1990('0xd'),_0x3b260c,'request\x20sent');_0x33f5f4(_0x19a686[_0x1990('0x15')][_0x1990('0x14')]);}})[_0x1990('0x16')](function(_0x578e56){logger[_0x1990('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b260c,_0x578e56);_0x3a464f(_0x578e56);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 1934566..8c3c9bb 100644 --- a/server/api/license/index.js +++ b/server/api/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1d9=['get','index','put','/:id','isAuthenticated','update','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./license.controller'];(function(_0x32998f,_0x2dfc3a){var _0x33ddfc=function(_0x5e34b8){while(--_0x5e34b8){_0x32998f['push'](_0x32998f['shift']());}};_0x33ddfc(++_0x2dfc3a);}(_0xc1d9,0x18c));var _0x9c1d=function(_0x529f0d,_0x46b365){_0x529f0d=_0x529f0d-0x0;var _0x56684d=_0xc1d9[_0x529f0d];return _0x56684d;};'use strict';var multer=require(_0x9c1d('0x0'));var util=require(_0x9c1d('0x1'));var path=require('path');var timeout=require(_0x9c1d('0x2'));var express=require(_0x9c1d('0x3'));var router=express['Router']();var auth=require(_0x9c1d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c1d('0x5'));var controller=require(_0x9c1d('0x6'));router[_0x9c1d('0x7')]('/',controller[_0x9c1d('0x8')]);router[_0x9c1d('0x9')](_0x9c1d('0xa'),auth[_0x9c1d('0xb')](),controller[_0x9c1d('0xc')]);module['exports']=router; \ No newline at end of file +var _0xfb42=['../../components/interaction/service','./license.controller','index','put','/:id','exports','multer','express','Router','../../components/auth/service'];(function(_0x34cc0c,_0xd23b3c){var _0x3a363b=function(_0x8fb866){while(--_0x8fb866){_0x34cc0c['push'](_0x34cc0c['shift']());}};_0x3a363b(++_0xd23b3c);}(_0xfb42,0x132));var _0x2fb4=function(_0x13c69c,_0x3fce43){_0x13c69c=_0x13c69c-0x0;var _0x16e915=_0xfb42[_0x13c69c];return _0x16e915;};'use strict';var multer=require(_0x2fb4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2fb4('0x1'));var router=express[_0x2fb4('0x2')]();var auth=require(_0x2fb4('0x3'));var interaction=require(_0x2fb4('0x4'));var config=require('../../config/environment');var controller=require(_0x2fb4('0x5'));router['get']('/',controller[_0x2fb4('0x6')]);router[_0x2fb4('0x7')](_0x2fb4('0x8'),auth['isAuthenticated'](),controller['update']);module[_0x2fb4('0x9')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6e86469..1f4e19d 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba34=['STRING','sequelize','exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xba34,0x119));var _0x4ba3=function(_0x2c2f0d,_0x85690e){_0x2c2f0d=_0x2c2f0d-0x0;var _0x5e0706=_0xba34[_0x2c2f0d];return _0x5e0706;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'license':{'type':Sequelize[_0x4ba3('0x2')]},'data1':{'type':Sequelize[_0x4ba3('0x3')]},'data2':{'type':Sequelize[_0x4ba3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x326f=['STRING','INTEGER','sequelize'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x326f,0xd1));var _0xf326=function(_0x37eaee,_0x58be87){_0x37eaee=_0x37eaee-0x0;var _0x43bb67=_0x326f[_0x37eaee];return _0x43bb67;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xf326('0x1')]},'data2':{'type':Sequelize[_0xf326('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xf326('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 0feb1ca..e108719 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5024=['count','offset','limit','apply','then','destroy','error','stack','name','send','index','License','rawAttributes','query','filters','intersection','attributes','model','fields','length','merge','options','body','find','params','key','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x43f23a,_0x2f0920){var _0x480e13=function(_0x51d1cb){while(--_0x51d1cb){_0x43f23a['push'](_0x43f23a['shift']());}};_0x480e13(++_0x2f0920);}(_0x5024,0xf7));var _0x4502=function(_0xab204c,_0x4d4f34){_0xab204c=_0xab204c-0x0;var _0x5d19a8=_0x5024[_0xab204c];return _0x5d19a8;};'use strict';var pdf=require(_0x4502('0x0'));var emlformat=require(_0x4502('0x1'));var rimraf=require(_0x4502('0x2'));var zipdir=require(_0x4502('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4502('0x4'));var moment=require(_0x4502('0x5'));var BPromise=require(_0x4502('0x6'));var Mustache=require(_0x4502('0x7'));var util=require(_0x4502('0x8'));var path=require(_0x4502('0x9'));var sox=require(_0x4502('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4502('0xb'));var squel=require('squel');var crypto=require(_0x4502('0xc'));var jsforce=require(_0x4502('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4502('0xe'));var Papa=require(_0x4502('0xf'));var Redis=require('ioredis');var authService=require(_0x4502('0x10'));var qs=require(_0x4502('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4502('0x12'));var logger=require(_0x4502('0x13'))(_0x4502('0x14'));var utils=require(_0x4502('0x15'));var config=require(_0x4502('0x16'));var licenseUtil=require(_0x4502('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aa881,_0x565304){_0x565304=_0x565304||0xcc;return function(_0x24b998){if(_0x24b998){return _0x3aa881[_0x4502('0x18')](_0x565304);}return _0x3aa881['status'](_0x565304)[_0x4502('0x19')]();};}function respondWithResult(_0x1fd2f0,_0x1f0114){_0x1f0114=_0x1f0114||0xc8;return function(_0x40f629){if(_0x40f629){return _0x1fd2f0[_0x4502('0x1a')](_0x1f0114)[_0x4502('0x1b')](_0x40f629);}};}function respondWithFilteredResult(_0x4b52d9,_0x28383a){return function(_0x40d749){if(_0x40d749){var _0x555abe=_0x40d749[_0x4502('0x1c')],_0x5220fd=_0x28383a['offset'],_0x2d102a=_0x28383a[_0x4502('0x1d')]+_0x28383a[_0x4502('0x1e')],_0x33ab10;if(_0x2d102a>=_0x555abe){_0x2d102a=_0x555abe;_0x33ab10=0xc8;}else{_0x33ab10=0xce;}_0x4b52d9[_0x4502('0x1a')](_0x33ab10);return _0x4b52d9['set']('Content-Range',_0x5220fd+'-'+_0x2d102a+'/'+_0x555abe)[_0x4502('0x1b')](_0x40d749);}return null;};}function patchUpdates(_0x1e7c29){return function(_0x3153c7){try{jsonpatch[_0x4502('0x1f')](_0x3153c7,_0x1e7c29,!![]);}catch(_0x8ecd0b){return BPromise['reject'](_0x8ecd0b);}return _0x3153c7['save']();};}function saveUpdates(_0x80f964,_0x387cb0){return function(_0x59020f){if(_0x59020f){return _0x59020f['update'](_0x80f964)[_0x4502('0x20')](function(_0x5bd7b6){return _0x5bd7b6;});}return null;};}function removeEntity(_0x22f97d,_0x193e06){return function(_0x1592ed){if(_0x1592ed){return _0x1592ed[_0x4502('0x21')]()[_0x4502('0x20')](function(){_0x22f97d[_0x4502('0x1a')](0xcc)[_0x4502('0x19')]();});}};}function handleEntityNotFound(_0x1633fe,_0x167e17){return function(_0x2e23b7){if(!_0x2e23b7){_0x1633fe[_0x4502('0x18')](0x194);}return _0x2e23b7;};}function handleError(_0x4c6562,_0x2a76eb){_0x2a76eb=_0x2a76eb||0x1f4;return function(_0x3bc984){logger[_0x4502('0x22')](_0x3bc984[_0x4502('0x23')]);if(_0x3bc984[_0x4502('0x24')]){delete _0x3bc984[_0x4502('0x24')];}_0x4c6562[_0x4502('0x1a')](_0x2a76eb)[_0x4502('0x25')](_0x3bc984);};}var utilLicense=require(_0x4502('0x17'));exports[_0x4502('0x26')]=function(_0x26320e,_0x3ba780){var _0x3ee214={'raw':!![],'where':{'id':0x1}},_0x35606c={};_0x35606c['model']=_['keys'](db[_0x4502('0x27')][_0x4502('0x28')]);_0x35606c[_0x4502('0x29')]=_['keys'](_0x26320e[_0x4502('0x29')]);_0x35606c[_0x4502('0x2a')]=_[_0x4502('0x2b')](_0x35606c['model'],_0x35606c[_0x4502('0x29')]);_0x3ee214[_0x4502('0x2c')]=_[_0x4502('0x2b')](_0x35606c[_0x4502('0x2d')],qs[_0x4502('0x2e')](_0x26320e[_0x4502('0x29')][_0x4502('0x2e')]));_0x3ee214[_0x4502('0x2c')]=_0x3ee214[_0x4502('0x2c')][_0x4502('0x2f')]?_0x3ee214[_0x4502('0x2c')]:_0x35606c[_0x4502('0x2d')];_0x3ee214=_[_0x4502('0x30')]({},_0x3ee214,_0x26320e[_0x4502('0x31')]);return utilLicense['getLicense'](_0x3ee214)['then'](respondWithResult(_0x3ba780,null))['catch'](handleError(_0x3ba780,null));};exports['update']=function(_0x10827a,_0x8c9ef){if(_0x10827a[_0x4502('0x32')]['id']){delete _0x10827a[_0x4502('0x32')]['id'];}return db[_0x4502('0x27')][_0x4502('0x33')]({'where':{'id':_0x10827a[_0x4502('0x34')]['id']}})[_0x4502('0x20')](handleEntityNotFound(_0x8c9ef,null))[_0x4502('0x20')](function(_0x4c03ad){var _0x2b6dbe=_0x4c03ad['get']({'plain':!![]});return utilLicense['checkLicense'](_0x2b6dbe,_0x10827a[_0x4502('0x32')][_0x4502('0x35')]);})[_0x4502('0x20')](function(_0x4f0cd7){if(!_0x4f0cd7['demo']){return saveUpdates(_0x10827a['body'],null);}return _0x4f0cd7;})[_0x4502('0x20')](respondWithResult(_0x8c9ef,null))[_0x4502('0x36')](handleError(_0x8c9ef,null));}; \ No newline at end of file +var _0xf6d1=['apply','save','update','then','destroy','error','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','getLicense','catch','body','find','params','get','key','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6d1,0x99));var _0x1f6d=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xf6d1[_0x4e9628];return _0x27bc8c;};'use strict';var pdf=require(_0x1f6d('0x0'));var emlformat=require(_0x1f6d('0x1'));var rimraf=require(_0x1f6d('0x2'));var zipdir=require(_0x1f6d('0x3'));var jsonpatch=require(_0x1f6d('0x4'));var rp=require(_0x1f6d('0x5'));var moment=require(_0x1f6d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1f6d('0x7'));var util=require('util');var path=require(_0x1f6d('0x8'));var sox=require(_0x1f6d('0x9'));var csv=require(_0x1f6d('0xa'));var ejs=require(_0x1f6d('0xb'));var fs=require('fs');var _=require(_0x1f6d('0xc'));var squel=require(_0x1f6d('0xd'));var crypto=require(_0x1f6d('0xe'));var jsforce=require(_0x1f6d('0xf'));var deskjs=require(_0x1f6d('0x10'));var toCsv=require(_0x1f6d('0xa'));var querystring=require(_0x1f6d('0x11'));var Papa=require(_0x1f6d('0x12'));var Redis=require('ioredis');var authService=require(_0x1f6d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1f6d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f6d('0x15'))(_0x1f6d('0x16'));var utils=require(_0x1f6d('0x17'));var config=require(_0x1f6d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45826e,_0x10975c){_0x10975c=_0x10975c||0xcc;return function(_0x1017b4){if(_0x1017b4){return _0x45826e[_0x1f6d('0x19')](_0x10975c);}return _0x45826e[_0x1f6d('0x1a')](_0x10975c)[_0x1f6d('0x1b')]();};}function respondWithResult(_0x24d3d8,_0x3d88da){_0x3d88da=_0x3d88da||0xc8;return function(_0x35d9eb){if(_0x35d9eb){return _0x24d3d8[_0x1f6d('0x1a')](_0x3d88da)['json'](_0x35d9eb);}};}function respondWithFilteredResult(_0x33f334,_0x43d3b6){return function(_0x43e1bf){if(_0x43e1bf){var _0x4fe53a=_0x43e1bf[_0x1f6d('0x1c')],_0x2b867a=_0x43d3b6[_0x1f6d('0x1d')],_0x309aa9=_0x43d3b6[_0x1f6d('0x1d')]+_0x43d3b6[_0x1f6d('0x1e')],_0x58b375;if(_0x309aa9>=_0x4fe53a){_0x309aa9=_0x4fe53a;_0x58b375=0xc8;}else{_0x58b375=0xce;}_0x33f334[_0x1f6d('0x1a')](_0x58b375);return _0x33f334[_0x1f6d('0x1f')]('Content-Range',_0x2b867a+'-'+_0x309aa9+'/'+_0x4fe53a)[_0x1f6d('0x20')](_0x43e1bf);}return null;};}function patchUpdates(_0x5cf52e){return function(_0x2cd064){try{jsonpatch[_0x1f6d('0x21')](_0x2cd064,_0x5cf52e,!![]);}catch(_0x251a17){return BPromise['reject'](_0x251a17);}return _0x2cd064[_0x1f6d('0x22')]();};}function saveUpdates(_0x19e32a,_0x4a55ae){return function(_0x4f4de4){if(_0x4f4de4){return _0x4f4de4[_0x1f6d('0x23')](_0x19e32a)[_0x1f6d('0x24')](function(_0x1beca9){return _0x1beca9;});}return null;};}function removeEntity(_0x499257,_0xeeb6d7){return function(_0x564c36){if(_0x564c36){return _0x564c36[_0x1f6d('0x25')]()[_0x1f6d('0x24')](function(){_0x499257['status'](0xcc)[_0x1f6d('0x1b')]();});}};}function handleEntityNotFound(_0x1bce2a,_0x2696de){return function(_0x4ff7f9){if(!_0x4ff7f9){_0x1bce2a[_0x1f6d('0x19')](0x194);}return _0x4ff7f9;};}function handleError(_0x46b0a8,_0x24543f){_0x24543f=_0x24543f||0x1f4;return function(_0x2cce5e){logger[_0x1f6d('0x26')](_0x2cce5e['stack']);if(_0x2cce5e['name']){delete _0x2cce5e[_0x1f6d('0x27')];}_0x46b0a8[_0x1f6d('0x1a')](_0x24543f)[_0x1f6d('0x28')](_0x2cce5e);};}var utilLicense=require(_0x1f6d('0x29'));exports[_0x1f6d('0x2a')]=function(_0x4750d4,_0x180286){var _0x3718dc={'raw':!![],'where':{'id':0x1}},_0x31dca9={};_0x31dca9[_0x1f6d('0x2b')]=_[_0x1f6d('0x2c')](db[_0x1f6d('0x2d')][_0x1f6d('0x2e')]);_0x31dca9['query']=_[_0x1f6d('0x2c')](_0x4750d4[_0x1f6d('0x2f')]);_0x31dca9[_0x1f6d('0x30')]=_[_0x1f6d('0x31')](_0x31dca9[_0x1f6d('0x2b')],_0x31dca9[_0x1f6d('0x2f')]);_0x3718dc['attributes']=_[_0x1f6d('0x31')](_0x31dca9['model'],qs['fields'](_0x4750d4[_0x1f6d('0x2f')][_0x1f6d('0x32')]));_0x3718dc[_0x1f6d('0x33')]=_0x3718dc['attributes'][_0x1f6d('0x34')]?_0x3718dc['attributes']:_0x31dca9[_0x1f6d('0x2b')];_0x3718dc=_[_0x1f6d('0x35')]({},_0x3718dc,_0x4750d4['options']);return utilLicense[_0x1f6d('0x36')](_0x3718dc)['then'](respondWithResult(_0x180286,null))[_0x1f6d('0x37')](handleError(_0x180286,null));};exports[_0x1f6d('0x23')]=function(_0x3e490c,_0x3a3ecb){if(_0x3e490c[_0x1f6d('0x38')]['id']){delete _0x3e490c['body']['id'];}return db[_0x1f6d('0x2d')][_0x1f6d('0x39')]({'where':{'id':_0x3e490c[_0x1f6d('0x3a')]['id']}})[_0x1f6d('0x24')](handleEntityNotFound(_0x3a3ecb,null))[_0x1f6d('0x24')](function(_0xefcfa9){var _0x556714=_0xefcfa9[_0x1f6d('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x556714,_0x3e490c[_0x1f6d('0x38')][_0x1f6d('0x3c')]);})[_0x1f6d('0x24')](function(_0x28d899){if(!_0x28d899[_0x1f6d('0x3d')]){return saveUpdates(_0x3e490c[_0x1f6d('0x38')],null);}return _0x28d899;})['then'](respondWithResult(_0x3a3ecb,null))[_0x1f6d('0x37')](handleError(_0x3a3ecb,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index aea3f00..5654f99 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xace5=['License','license','util','../../config/logger','request-promise','rimraf','./license.attributes','exports','define'];(function(_0x1bccda,_0x1009e2){var _0x486285=function(_0x3a9e43){while(--_0x3a9e43){_0x1bccda['push'](_0x1bccda['shift']());}};_0x486285(++_0x1009e2);}(_0xace5,0x1df));var _0x5ace=function(_0x32ca95,_0x5f1de9){_0x32ca95=_0x32ca95-0x0;var _0x46cea6=_0xace5[_0x32ca95];return _0x46cea6;};'use strict';var _=require('lodash');var util=require(_0x5ace('0x0'));var logger=require(_0x5ace('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ace('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ace('0x3'));var config=require('../../config/environment');var attributes=require(_0x5ace('0x4'));module[_0x5ace('0x5')]=function(_0x12a832,_0x53ffe7){return _0x12a832[_0x5ace('0x6')](_0x5ace('0x7'),attributes,{'tableName':_0x5ace('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc70b=['define','License','license','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports'];(function(_0x192d7b,_0x538578){var _0x46d59f=function(_0x654622){while(--_0x654622){_0x192d7b['push'](_0x192d7b['shift']());}};_0x46d59f(++_0x538578);}(_0xc70b,0x13b));var _0xbc70=function(_0x181ec0,_0x550161){_0x181ec0=_0x181ec0-0x0;var _0x3b0b70=_0xc70b[_0x181ec0];return _0x3b0b70;};'use strict';var _=require(_0xbc70('0x0'));var util=require('util');var logger=require(_0xbc70('0x1'))('api');var moment=require(_0xbc70('0x2'));var BPromise=require(_0xbc70('0x3'));var rp=require(_0xbc70('0x4'));var fs=require('fs');var path=require(_0xbc70('0x5'));var rimraf=require(_0xbc70('0x6'));var config=require('../../config/environment');var attributes=require(_0xbc70('0x7'));module[_0xbc70('0x8')]=function(_0x3722cd,_0x3a29ec){return _0x3722cd[_0xbc70('0x9')](_0xbc70('0xa'),attributes,{'tableName':_0xbc70('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 72d98c2..fff4c22 100644 --- a/server/api/license/license.rpc.js +++ b/server/api/license/license.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe205=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xe205,0xa7));var _0x5e20=function(_0x383519,_0x199f38){_0x383519=_0x383519-0x0;var _0x4c5cc1=_0xe205[_0x383519];return _0x4c5cc1;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('License,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('License,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('License,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});} \ No newline at end of file +var _0xf9bc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','message','info','result','catch'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x2ae89f,_0x470a01){_0x2ae89f=_0x2ae89f-0x0;var _0x333ebc=_0xf9bc[_0x2ae89f];return _0x333ebc;};'use strict';var _=require('lodash');var util=require(_0xcf9b('0x0'));var moment=require(_0xcf9b('0x1'));var BPromise=require(_0xcf9b('0x2'));var rs=require(_0xcf9b('0x3'));var fs=require('fs');var Redis=require(_0xcf9b('0x4'));var db=require(_0xcf9b('0x5'))['db'];var utils=require(_0xcf9b('0x6'));var logger=require(_0xcf9b('0x7'))(_0xcf9b('0x8'));var config=require(_0xcf9b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcf9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ba407,_0xbf765c,_0x2493f0){return new BPromise(function(_0x1ec363,_0x2c0e77){return client[_0xcf9b('0xb')](_0x2ba407,_0x2493f0)[_0xcf9b('0xc')](function(_0x3447ef){logger['info'](_0xcf9b('0xd'),_0xbf765c,_0xcf9b('0xe'));logger['debug'](_0xcf9b('0xf'),_0xbf765c,'request\x20sent',JSON['stringify'](_0x3447ef));if(_0x3447ef['error']){if(_0x3447ef[_0xcf9b('0x10')]['code']===0x1f4){logger[_0xcf9b('0x10')](_0xcf9b('0xd'),_0xbf765c,_0x3447ef['error'][_0xcf9b('0x11')]);return _0x2c0e77(_0x3447ef[_0xcf9b('0x10')][_0xcf9b('0x11')]);}logger[_0xcf9b('0x10')](_0xcf9b('0xd'),_0xbf765c,_0x3447ef['error'][_0xcf9b('0x11')]);return _0x1ec363(_0x3447ef[_0xcf9b('0x10')][_0xcf9b('0x11')]);}else{logger[_0xcf9b('0x12')]('License,\x20%s,\x20%s',_0xbf765c,'request\x20sent');_0x1ec363(_0x3447ef[_0xcf9b('0x13')][_0xcf9b('0x11')]);}})[_0xcf9b('0x14')](function(_0x3276a8){logger[_0xcf9b('0x10')](_0xcf9b('0xd'),_0xbf765c,_0x3276a8);_0x2c0e77(_0x3276a8);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5c0ae88..2fb4d71 100644 --- a/server/api/mailAccount/index.js +++ b/server/api/mailAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bfc=['addAgents','put','delete','/:id/canned_answers','removeAnswers','removeSmtp','destroy','removeAgents','exports','util','path','connect-timeout','Router','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getImap','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send'];(function(_0x5e3fb7,_0x4f0c05){var _0x3c9228=function(_0x8636ae){while(--_0x8636ae){_0x5e3fb7['push'](_0x5e3fb7['shift']());}};_0x3c9228(++_0x4f0c05);}(_0x6bfc,0x159));var _0xc6bf=function(_0x214476,_0x17af21){_0x214476=_0x214476-0x0;var _0x5cf219=_0x6bfc[_0x214476];return _0x5cf219;};'use strict';var multer=require('multer');var util=require(_0xc6bf('0x0'));var path=require(_0xc6bf('0x1'));var timeout=require(_0xc6bf('0x2'));var express=require('express');var router=express[_0xc6bf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc6bf('0x4'));var config=require('../../config/environment');var controller=require(_0xc6bf('0x5'));router[_0xc6bf('0x6')]('/',auth[_0xc6bf('0x7')](),controller['index']);router[_0xc6bf('0x6')](_0xc6bf('0x8'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x9')]);router[_0xc6bf('0x6')](_0xc6bf('0xa'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0xb')]);router['get'](_0xc6bf('0xc'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0xd')]);router[_0xc6bf('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc6bf('0xe')]);router[_0xc6bf('0x6')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xc6bf('0xf')]);router[_0xc6bf('0x6')]('/:id/out_servers',auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x10')]);router[_0xc6bf('0x6')](_0xc6bf('0x11'),auth[_0xc6bf('0x7')](),controller['getInteractions']);router['get'](_0xc6bf('0x12'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x13')]);router[_0xc6bf('0x6')](_0xc6bf('0x14'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x15')]);router['get'](_0xc6bf('0x16'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0xc6bf('0x6')](_0xc6bf('0x17'),auth['isAuthenticated'](),controller[_0xc6bf('0x18')]);router[_0xc6bf('0x19')]('/:id/dispositions',auth[_0xc6bf('0x7')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x1a')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc6bf('0x1b')]);router[_0xc6bf('0x19')]('/:id/in_servers',auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x1c')]);router[_0xc6bf('0x19')](_0xc6bf('0x1d'),auth['isAuthenticated'](),controller[_0xc6bf('0x1e')]);router[_0xc6bf('0x19')](_0xc6bf('0x11'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x1f')]);router[_0xc6bf('0x19')](_0xc6bf('0x12'),auth[_0xc6bf('0x7')](),controller['addApplications']);router[_0xc6bf('0x19')](_0xc6bf('0x20'),auth[_0xc6bf('0x7')](),controller['send']);router[_0xc6bf('0x19')](_0xc6bf('0x17'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x21')]);router[_0xc6bf('0x22')](_0xc6bf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc6bf('0x23')]('/:id/dispositions',auth[_0xc6bf('0x7')](),controller['removeDispositions']);router['delete'](_0xc6bf('0x24'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x25')]);router[_0xc6bf('0x23')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router['delete'](_0xc6bf('0x1d'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x26')]);router[_0xc6bf('0x23')](_0xc6bf('0xa'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x27')]);router[_0xc6bf('0x23')](_0xc6bf('0x17'),auth[_0xc6bf('0x7')](),controller[_0xc6bf('0x28')]);module[_0xc6bf('0x29')]=router; \ No newline at end of file +var _0x3665=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','show','/:id/dispositions','getDispositions','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','/:id/canned_answers','addAnswer','post','/:id/in_servers','/:id/applications','addApplications','/:id/send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','destroy','/:id/users','removeAgents','exports','multer','util'];(function(_0x5e7a05,_0x19c092){var _0x3c4788=function(_0x669da2){while(--_0x669da2){_0x5e7a05['push'](_0x5e7a05['shift']());}};_0x3c4788(++_0x19c092);}(_0x3665,0x1d7));var _0x5366=function(_0x3405cb,_0x19ddc7){_0x3405cb=_0x3405cb-0x0;var _0x29810c=_0x3665[_0x3405cb];return _0x29810c;};'use strict';var multer=require(_0x5366('0x0'));var util=require(_0x5366('0x1'));var path=require(_0x5366('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5366('0x3')]();var auth=require(_0x5366('0x4'));var interaction=require(_0x5366('0x5'));var config=require(_0x5366('0x6'));var controller=require(_0x5366('0x7'));router[_0x5366('0x8')]('/',auth[_0x5366('0x9')](),controller[_0x5366('0xa')]);router[_0x5366('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5366('0x8')]('/:id',auth[_0x5366('0x9')](),controller[_0x5366('0xb')]);router[_0x5366('0x8')](_0x5366('0xc'),auth['isAuthenticated'](),controller[_0x5366('0xd')]);router[_0x5366('0x8')]('/:id/canned_answers',auth[_0x5366('0x9')](),controller['getAnswers']);router[_0x5366('0x8')]('/:id/in_servers',auth[_0x5366('0x9')](),controller[_0x5366('0xe')]);router['get'](_0x5366('0xf'),auth[_0x5366('0x9')](),controller[_0x5366('0x10')]);router[_0x5366('0x8')](_0x5366('0x11'),auth[_0x5366('0x9')](),controller[_0x5366('0x12')]);router['get']('/:id/applications',auth[_0x5366('0x9')](),controller[_0x5366('0x13')]);router['get'](_0x5366('0x14'),auth[_0x5366('0x9')](),controller[_0x5366('0x15')]);router['get']('/:id/verify',auth[_0x5366('0x9')](),controller[_0x5366('0x16')]);router[_0x5366('0x8')]('/:id/users',auth[_0x5366('0x9')](),controller[_0x5366('0x17')]);router['post'](_0x5366('0xc'),auth[_0x5366('0x9')](),controller['addDisposition']);router['post'](_0x5366('0x18'),auth[_0x5366('0x9')](),controller[_0x5366('0x19')]);router['post']('/',auth[_0x5366('0x9')](),controller['create']);router[_0x5366('0x1a')](_0x5366('0x1b'),auth[_0x5366('0x9')](),controller['addImap']);router['post'](_0x5366('0xf'),auth[_0x5366('0x9')](),controller['addSmtp']);router[_0x5366('0x1a')](_0x5366('0x11'),auth[_0x5366('0x9')](),controller['addInteraction']);router[_0x5366('0x1a')](_0x5366('0x1c'),auth['isAuthenticated'](),controller[_0x5366('0x1d')]);router[_0x5366('0x1a')](_0x5366('0x1e'),auth[_0x5366('0x9')](),controller['send']);router[_0x5366('0x1a')]('/:id/users',auth[_0x5366('0x9')](),controller[_0x5366('0x1f')]);router[_0x5366('0x20')](_0x5366('0x21'),auth[_0x5366('0x9')](),controller[_0x5366('0x22')]);router[_0x5366('0x23')](_0x5366('0xc'),auth[_0x5366('0x9')](),controller[_0x5366('0x24')]);router[_0x5366('0x23')](_0x5366('0x18'),auth[_0x5366('0x9')](),controller[_0x5366('0x25')]);router['delete'](_0x5366('0x1b'),auth[_0x5366('0x9')](),controller[_0x5366('0x26')]);router[_0x5366('0x23')](_0x5366('0xf'),auth[_0x5366('0x9')](),controller['removeSmtp']);router[_0x5366('0x23')](_0x5366('0x21'),auth[_0x5366('0x9')](),controller[_0x5366('0x27')]);router[_0x5366('0x23')](_0x5366('0x28'),auth[_0x5366('0x9')](),controller[_0x5366('0x29')]);module[_0x5366('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4e3864b..02f8902 100644 --- a/server/api/mailAccount/mailAccount.attributes.js +++ b/server/api/mailAccount/mailAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf988=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','BOOLEAN'];(function(_0x3f4234,_0x2466e9){var _0x3d659f=function(_0x288e91){while(--_0x288e91){_0x3f4234['push'](_0x3f4234['shift']());}};_0x3d659f(++_0x2466e9);}(_0xf988,0x1d1));var _0x8f98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf988[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x8f98('0x0'));module['exports']={'description':{'type':Sequelize[_0x8f98('0x1')]},'name':{'type':Sequelize[_0x8f98('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x8f98('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x8f98('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8f98('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x8f98('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8f98('0x1')],'allowNull':![],'defaultValue':_0x8f98('0x3')},'fontSize':{'type':Sequelize[_0x8f98('0x4')](0x2)[_0x8f98('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8f98('0x6')],'defaultValue':function(){return _0x8f98('0x7');}},'notificationSound':{'type':Sequelize[_0x8f98('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f98('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f98('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8f98('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8f98('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f98('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8f98('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8f98('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x8f98('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8f98('0x9'),'set':function(_0x2b54a1){if(!_0x2b54a1)this[_0x8f98('0xa')](_0x8f98('0xb'),null);this[_0x8f98('0xa')]('mandatoryDisposition',_0x2b54a1);}}}; \ No newline at end of file +var _0x0781=['STRING','BOOLEAN','TEXT','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0781,0x77));var _0x1078=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0781[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1078('0x0'));module[_0x1078('0x1')]={'description':{'type':Sequelize[_0x1078('0x2')]},'name':{'type':Sequelize[_0x1078('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1078('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1078('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1078('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x1078('0x4')]},'markAsUnread':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1078('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x1078('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1078('0x4')],'defaultValue':function(){return _0x1078('0x6');}},'notificationSound':{'type':Sequelize[_0x1078('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1078('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1078('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1078('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1078('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x1078('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x213607){if(!_0x213607)this[_0x1078('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x1078('0xa'),_0x213607);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 28eea31..144bfec 100644 --- a/server/api/mailAccount/mailAccount.controller.js +++ b/server/api/mailAccount/mailAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7249=['out','Interaction','MailMessage','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','reject','then','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','query','keys','attributes','length','model','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','findAll','rows','catch','show','params','MailServerOut','intersection','fields','find','body','update','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','filters','nolimit','pick','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','ListId','isNil','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','MailInteraction','omit','ids','getInteractions','CmContact','User','Owner','fullname','internal','Tag','color','tag','transaction','MailApplication','destroy','bulkCreate','findAndCountAll','getApplications','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','split','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','auth','secure','SendMail','List\x20not\x20found','messageId','subject','attach'];(function(_0x53f707,_0x51a2f7){var _0x10a9f5=function(_0x14b513){while(--_0x14b513){_0x53f707['push'](_0x53f707['shift']());}};_0x10a9f5(++_0x51a2f7);}(_0x7249,0xcf));var _0x9724=function(_0x53b072,_0x4884b8){_0x53b072=_0x53b072-0x0;var _0x210580=_0x7249[_0x53b072];return _0x210580;};'use strict';var pdf=require(_0x9724('0x0'));var emlformat=require(_0x9724('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9724('0x2'));var jsonpatch=require(_0x9724('0x3'));var rp=require(_0x9724('0x4'));var moment=require(_0x9724('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9724('0x6'));var util=require(_0x9724('0x7'));var path=require('path');var sox=require(_0x9724('0x8'));var csv=require(_0x9724('0x9'));var ejs=require(_0x9724('0xa'));var fs=require('fs');var _=require(_0x9724('0xb'));var squel=require(_0x9724('0xc'));var crypto=require(_0x9724('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9724('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9724('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9724('0x10'));var as=require(_0x9724('0x11'));var hardwareService=require(_0x9724('0x12'));var logger=require(_0x9724('0x13'))('api');var utils=require(_0x9724('0x14'));var config=require(_0x9724('0x15'));var licenseUtil=require(_0x9724('0x16'));var db=require(_0x9724('0x17'))['db'];config[_0x9724('0x18')]=_[_0x9724('0x19')](config[_0x9724('0x18')],{'host':_0x9724('0x1a'),'port':0x18eb});var socket=require(_0x9724('0x1b'))(new Redis(config[_0x9724('0x18')]));require(_0x9724('0x1c'))[_0x9724('0x1d')](socket);var jayson=require(_0x9724('0x1e'));var client=jayson[_0x9724('0x1f')][_0x9724('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x50fa1c,_0x5025d6,_0x40f469,_0x3a94e1){return new BPromise(function(_0x1c1166,_0x55be85){var _0x22d3ed=_0x3a94e1||client;return _0x22d3ed[_0x9724('0x21')](_0x50fa1c,_0x40f469)['then'](function(_0x1607a3){logger[_0x9724('0x22')]('MailAccount,\x20%s,\x20%s',_0x5025d6,_0x9724('0x23'));logger[_0x9724('0x24')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5025d6,_0x9724('0x23'),JSON[_0x9724('0x25')](_0x1607a3));if(_0x1607a3[_0x9724('0x26')]){if(_0x1607a3[_0x9724('0x26')][_0x9724('0x27')]===0x1f4){logger[_0x9724('0x26')](_0x9724('0x28'),_0x5025d6,_0x1607a3[_0x9724('0x26')][_0x9724('0x29')]);return _0x55be85(_0x1607a3[_0x9724('0x26')]['message']);}logger[_0x9724('0x26')]('MailAccount,\x20%s,\x20%s',_0x5025d6,_0x1607a3[_0x9724('0x26')][_0x9724('0x29')]);return _0x1c1166(_0x1607a3[_0x9724('0x26')][_0x9724('0x29')]);}else{logger['info'](_0x9724('0x28'),_0x5025d6,_0x9724('0x23'));_0x1c1166(_0x1607a3[_0x9724('0x2a')][_0x9724('0x29')]);}})['catch'](function(_0x365ba1){logger[_0x9724('0x26')](_0x9724('0x28'),_0x5025d6,_0x365ba1);_0x55be85(_0x365ba1);});});}function respondWithStatusCode(_0x4d16de,_0x570cbe){_0x570cbe=_0x570cbe||0xcc;return function(_0x218019){if(_0x218019){return _0x4d16de[_0x9724('0x2b')](_0x570cbe);}return _0x4d16de[_0x9724('0x2c')](_0x570cbe)[_0x9724('0x2d')]();};}function respondWithResult(_0x1f174f,_0xba3800){_0xba3800=_0xba3800||0xc8;return function(_0x2c81f5){if(_0x2c81f5){return _0x1f174f['status'](_0xba3800)[_0x9724('0x2e')](_0x2c81f5);}};}function respondWithFilteredResult(_0x8a73b7,_0x5421aa){return function(_0x477fe1){if(_0x477fe1){var _0x3b8748=_0x477fe1[_0x9724('0x2f')],_0x5bc0e3=_0x5421aa[_0x9724('0x30')],_0x26f1be=_0x5421aa[_0x9724('0x30')]+_0x5421aa[_0x9724('0x31')],_0x1bfb83;if(_0x26f1be>=_0x3b8748){_0x26f1be=_0x3b8748;_0x1bfb83=0xc8;}else{_0x1bfb83=0xce;}_0x8a73b7[_0x9724('0x2c')](_0x1bfb83);return _0x8a73b7[_0x9724('0x32')]('Content-Range',_0x5bc0e3+'-'+_0x26f1be+'/'+_0x3b8748)['json'](_0x477fe1);}return null;};}function patchUpdates(_0x2ee463){return function(_0x4ac121){try{jsonpatch['apply'](_0x4ac121,_0x2ee463,!![]);}catch(_0x518a5d){return BPromise[_0x9724('0x33')](_0x518a5d);}return _0x4ac121['save']();};}function saveUpdates(_0x314623,_0x44e0e3){return function(_0xf8be18){if(_0xf8be18){return _0xf8be18['update'](_0x314623)[_0x9724('0x34')](function(_0x4a722b){return _0x4a722b;});}return null;};}function removeEntity(_0x598486,_0x90bf41){return function(_0x2e6fa0){if(_0x2e6fa0){return _0x2e6fa0['destroy']()['then'](function(){var _0x3d0d2e=_0x2e6fa0[_0x9724('0x35')]({'plain':!![]});var _0x28271c=_0x9724('0x36');return db[_0x9724('0x37')]['destroy']({'where':{'type':_0x28271c,'resourceId':_0x3d0d2e['id']}})['then'](function(){return _0x2e6fa0;});})['then'](function(){_0x598486[_0x9724('0x2c')](0xcc)[_0x9724('0x2d')]();});}};}function handleEntityNotFound(_0xf4b573,_0x31d913){return function(_0x31c5a1){if(!_0x31c5a1){_0xf4b573[_0x9724('0x2b')](0x194);}return _0x31c5a1;};}function handleError(_0x4bd9e1,_0x278cdb){_0x278cdb=_0x278cdb||0x1f4;return function(_0x1465b9){logger['error'](_0x1465b9[_0x9724('0x38')]);if(_0x1465b9['name']){delete _0x1465b9[_0x9724('0x39')];}_0x4bd9e1[_0x9724('0x2c')](_0x278cdb)[_0x9724('0x3a')](_0x1465b9);};}exports[_0x9724('0x3b')]=function(_0x4a1554,_0x3c58ff){var _0x4cc678={'include':[{'model':db[_0x9724('0x3c')],'as':_0x9724('0x3d')},{'model':db['MailServerOut'],'as':_0x9724('0x3e')},{'model':db[_0x9724('0x3f')],'as':_0x9724('0x40')}]},_0x27a68c={},_0xee074d={'count':0x0,'rows':[]};var _0x23356e=_[_0x9724('0x41')](db['MailAccount'][_0x9724('0x42')],function(_0x5b7979){return{'name':_0x5b7979['fieldName'],'type':_0x5b7979[_0x9724('0x43')][_0x9724('0x44')]};});_0x27a68c['model']=_[_0x9724('0x41')](_0x23356e,'name');_0x27a68c[_0x9724('0x45')]=_[_0x9724('0x46')](_0x4a1554[_0x9724('0x45')]);_0x27a68c['filters']=_['intersection'](_0x27a68c['model'],_0x27a68c['query']);_0x4cc678[_0x9724('0x47')]=_['intersection'](_0x27a68c['model'],qs['fields'](_0x4a1554['query']['fields']));_0x4cc678[_0x9724('0x47')]=_0x4cc678['attributes'][_0x9724('0x48')]?_0x4cc678['attributes']:_0x27a68c[_0x9724('0x49')];if(!_0x4a1554['query'][_0x9724('0x4a')]('nolimit')){_0x4cc678[_0x9724('0x31')]=qs[_0x9724('0x31')](_0x4a1554['query'][_0x9724('0x31')]);_0x4cc678[_0x9724('0x30')]=qs[_0x9724('0x30')](_0x4a1554['query']['offset']);}_0x4cc678[_0x9724('0x4b')]=qs[_0x9724('0x4c')](_0x4a1554[_0x9724('0x45')][_0x9724('0x4c')]);_0x4cc678[_0x9724('0x4d')]=qs['filters'](_['pick'](_0x4a1554[_0x9724('0x45')],_0x27a68c['filters']),_0x23356e);if(_0x4a1554['query'][_0x9724('0x4e')]){_0x4cc678[_0x9724('0x4d')]=_[_0x9724('0x4f')](_0x4cc678[_0x9724('0x4d')],{'$or':_['map'](_0x23356e,function(_0x14b65b){if(_0x14b65b[_0x9724('0x43')]!==_0x9724('0x50')){var _0x364a93={};_0x364a93[_0x14b65b[_0x9724('0x39')]]={'$like':'%'+_0x4a1554['query']['filter']+'%'};return _0x364a93;}})});}_0x4cc678=_[_0x9724('0x4f')]({},_0x4cc678,_0x4a1554[_0x9724('0x51')]);var _0x28f33a={'where':_0x4cc678[_0x9724('0x4d')]};return db[_0x9724('0x52')][_0x9724('0x2f')](_0x28f33a)[_0x9724('0x34')](function(_0x5cb32b){_0xee074d['count']=_0x5cb32b;if(_0x4a1554['query'][_0x9724('0x53')]){_0x4cc678[_0x9724('0x54')]=[{'all':!![]}];}return db[_0x9724('0x52')][_0x9724('0x55')](_0x4cc678);})[_0x9724('0x34')](function(_0x37d556){_0xee074d[_0x9724('0x56')]=_0x37d556;return _0xee074d;})[_0x9724('0x34')](respondWithFilteredResult(_0x3c58ff,_0x4cc678))[_0x9724('0x57')](handleError(_0x3c58ff,null));};exports[_0x9724('0x58')]=function(_0x2217d0,_0xce087b){var _0x4c346e={'raw':![],'where':{'id':_0x2217d0[_0x9724('0x59')]['id']},'include':[{'model':db[_0x9724('0x3c')],'as':'Imap'},{'model':db[_0x9724('0x5a')],'as':_0x9724('0x3e')},{'model':db[_0x9724('0x3f')],'as':_0x9724('0x40')}]},_0x4c6105={};_0x4c6105[_0x9724('0x49')]=_[_0x9724('0x46')](db[_0x9724('0x52')]['rawAttributes']);_0x4c6105[_0x9724('0x45')]=_['keys'](_0x2217d0[_0x9724('0x45')]);_0x4c6105['filters']=_[_0x9724('0x5b')](_0x4c6105[_0x9724('0x49')],_0x4c6105[_0x9724('0x45')]);_0x4c346e[_0x9724('0x47')]=_['intersection'](_0x4c6105[_0x9724('0x49')],qs[_0x9724('0x5c')](_0x2217d0['query'][_0x9724('0x5c')]));_0x4c346e[_0x9724('0x47')]=_0x4c346e[_0x9724('0x47')][_0x9724('0x48')]?_0x4c346e[_0x9724('0x47')]:_0x4c6105[_0x9724('0x49')];if(_0x2217d0['query'][_0x9724('0x53')]){_0x4c346e[_0x9724('0x54')]=[{'all':!![]}];}_0x4c346e=_[_0x9724('0x4f')]({},_0x4c346e,_0x2217d0[_0x9724('0x51')]);return db['MailAccount'][_0x9724('0x5d')](_0x4c346e)[_0x9724('0x34')](handleEntityNotFound(_0xce087b,null))['then'](respondWithResult(_0xce087b,null))['catch'](handleError(_0xce087b,null));};exports['update']=function(_0x368c37,_0x3095d2){if(_0x368c37[_0x9724('0x5e')]['id']){delete _0x368c37['body']['id'];}return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x368c37[_0x9724('0x59')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9724('0x3d')},{'model':db[_0x9724('0x5a')],'as':_0x9724('0x3e')},{'model':db[_0x9724('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3095d2,null))[_0x9724('0x34')](saveUpdates(_0x368c37[_0x9724('0x5e')],null))[_0x9724('0x34')](function(_0x488156){if(_0x488156&&_0x368c37[_0x9724('0x5e')][_0x9724('0x3d')]){return db[_0x9724('0x3c')][_0x9724('0x5f')](_0x368c37[_0x9724('0x5e')][_0x9724('0x3d')],{'where':{'MailAccountId':_0x488156['id']}})[_0x9724('0x34')](function(){return _0x488156;});}return _0x488156;})['then'](function(_0x2d5e98){if(_0x2d5e98&&_0x368c37[_0x9724('0x5e')][_0x9724('0x3e')]){return db[_0x9724('0x5a')][_0x9724('0x5f')](_0x368c37['body']['Smtp'],{'where':{'MailAccountId':_0x2d5e98['id']}})[_0x9724('0x34')](function(){return _0x2d5e98;});}return _0x2d5e98;})[_0x9724('0x34')](respondWithResult(_0x3095d2,null))[_0x9724('0x57')](handleError(_0x3095d2,null));};exports['describe']=function(_0x3f6dcc,_0x2eb70f){return db[_0x9724('0x52')][_0x9724('0x60')]()[_0x9724('0x34')](respondWithResult(_0x2eb70f,null))[_0x9724('0x57')](handleError(_0x2eb70f,null));};exports[_0x9724('0x61')]=function(_0x261bd8,_0x376a0f,_0xf00e31){if(_0x261bd8[_0x9724('0x5e')]['id']){delete _0x261bd8['body']['id'];}return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x261bd8[_0x9724('0x59')]['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x376a0f,null))[_0x9724('0x34')](function(_0x5cc946){if(_0x5cc946){_0x261bd8[_0x9724('0x5e')][_0x9724('0x62')]=_0x5cc946['id'];return db[_0x9724('0x63')][_0x9724('0x64')](_0x261bd8[_0x9724('0x5e')]);}})[_0x9724('0x34')](respondWithResult(_0x376a0f,null))['catch'](handleError(_0x376a0f,null));};exports[_0x9724('0x65')]=function(_0x3cd03f,_0x51f154,_0x181250){var _0x2b5436={'raw':![],'where':{}};var _0x8c947b={};var _0x465e48={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3cd03f[_0x9724('0x59')]['id']}})['then'](handleEntityNotFound(_0x51f154,null))['then'](function(_0x4338ae){if(_0x4338ae){_0x8c947b[_0x9724('0x49')]=_[_0x9724('0x46')](db[_0x9724('0x63')][_0x9724('0x42')]);_0x8c947b[_0x9724('0x45')]=_['keys'](_0x3cd03f['query']);_0x8c947b[_0x9724('0x66')]=_[_0x9724('0x5b')](_0x8c947b['model'],_0x8c947b[_0x9724('0x45')]);_0x2b5436[_0x9724('0x47')]=_[_0x9724('0x5b')](_0x8c947b[_0x9724('0x49')],qs[_0x9724('0x5c')](_0x3cd03f[_0x9724('0x45')][_0x9724('0x5c')]));_0x2b5436[_0x9724('0x47')]=_0x2b5436[_0x9724('0x47')][_0x9724('0x48')]?_0x2b5436['attributes']:_0x8c947b['model'];if(!_0x3cd03f[_0x9724('0x45')][_0x9724('0x4a')](_0x9724('0x67'))){_0x2b5436[_0x9724('0x31')]=qs['limit'](_0x3cd03f[_0x9724('0x45')][_0x9724('0x31')]);_0x2b5436['offset']=qs['offset'](_0x3cd03f[_0x9724('0x45')]['offset']);}_0x2b5436[_0x9724('0x4b')]=qs[_0x9724('0x4c')](_0x3cd03f['query'][_0x9724('0x4c')]);_0x2b5436[_0x9724('0x4d')]=qs[_0x9724('0x66')](_[_0x9724('0x68')](_0x3cd03f[_0x9724('0x45')],_0x8c947b[_0x9724('0x66')]));_0x2b5436['where'][_0x9724('0x62')]=_0x4338ae['id'];if(_0x3cd03f[_0x9724('0x45')][_0x9724('0x4e')]){_0x2b5436['where']=_[_0x9724('0x4f')](_0x2b5436[_0x9724('0x4d')],{'$or':_[_0x9724('0x41')](_0x2b5436[_0x9724('0x47')],function(_0x52962d){var _0x3803d9={};_0x3803d9[_0x52962d]={'$like':'%'+_0x3cd03f[_0x9724('0x45')][_0x9724('0x4e')]+'%'};return _0x3803d9;})});}_0x2b5436=_[_0x9724('0x4f')]({},_0x2b5436,_0x3cd03f[_0x9724('0x51')]);return db['Disposition'][_0x9724('0x2f')]({'where':_0x2b5436[_0x9724('0x4d')]})[_0x9724('0x34')](function(_0x2ff9c8){_0x465e48['count']=_0x2ff9c8;if(_0x3cd03f[_0x9724('0x45')][_0x9724('0x53')]){_0x2b5436[_0x9724('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x9724('0x55')](_0x2b5436);})[_0x9724('0x34')](function(_0x139618){_0x465e48['rows']=_0x139618;return _0x465e48;});}})[_0x9724('0x34')](respondWithFilteredResult(_0x51f154,_0x2b5436))[_0x9724('0x57')](handleError(_0x51f154,null));};exports[_0x9724('0x69')]=function(_0x583f07,_0x40678d,_0x447e12){return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x583f07[_0x9724('0x59')]['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x40678d,null))[_0x9724('0x34')](function(_0x3ec754){if(_0x3ec754){return _0x3ec754[_0x9724('0x69')](_0x583f07['query']['ids']);}})['then'](respondWithStatusCode(_0x40678d,null))[_0x9724('0x57')](handleError(_0x40678d,null));};exports['addAnswer']=function(_0x43cace,_0x2e9da8,_0x6ad72a){if(_0x43cace['body']['id']){delete _0x43cace[_0x9724('0x5e')]['id'];}return db['MailAccount'][_0x9724('0x5d')]({'where':{'id':_0x43cace['params']['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x2e9da8,null))[_0x9724('0x34')](function(_0x5b7d43){if(_0x5b7d43){_0x43cace[_0x9724('0x5e')][_0x9724('0x62')]=_0x5b7d43['id'];return db[_0x9724('0x6a')][_0x9724('0x64')](_0x43cace[_0x9724('0x5e')]);}})[_0x9724('0x34')](respondWithResult(_0x2e9da8,null))[_0x9724('0x57')](handleError(_0x2e9da8,null));};exports[_0x9724('0x6b')]=function(_0xd52e2e,_0x408bf0,_0xebb37f){var _0x484abe={'raw':![],'where':{}};var _0x562b14={};var _0x122df3={'count':0x0,'rows':[]};return db[_0x9724('0x52')][_0x9724('0x6c')]({'where':{'id':_0xd52e2e['params']['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x408bf0,null))[_0x9724('0x34')](function(_0x30dc3b){if(_0x30dc3b){_0x562b14[_0x9724('0x49')]=_[_0x9724('0x46')](db[_0x9724('0x6a')][_0x9724('0x42')]);_0x562b14[_0x9724('0x45')]=_['keys'](_0xd52e2e['query']);_0x562b14['filters']=_[_0x9724('0x5b')](_0x562b14[_0x9724('0x49')],_0x562b14[_0x9724('0x45')]);_0x484abe[_0x9724('0x47')]=_[_0x9724('0x5b')](_0x562b14[_0x9724('0x49')],qs['fields'](_0xd52e2e[_0x9724('0x45')][_0x9724('0x5c')]));_0x484abe['attributes']=_0x484abe[_0x9724('0x47')][_0x9724('0x48')]?_0x484abe['attributes']:_0x562b14[_0x9724('0x49')];if(!_0xd52e2e[_0x9724('0x45')][_0x9724('0x4a')](_0x9724('0x67'))){_0x484abe['limit']=qs[_0x9724('0x31')](_0xd52e2e[_0x9724('0x45')]['limit']);_0x484abe[_0x9724('0x30')]=qs[_0x9724('0x30')](_0xd52e2e[_0x9724('0x45')][_0x9724('0x30')]);}_0x484abe[_0x9724('0x4b')]=qs['sort'](_0xd52e2e[_0x9724('0x45')]['sort']);_0x484abe[_0x9724('0x4d')]=qs[_0x9724('0x66')](_['pick'](_0xd52e2e[_0x9724('0x45')],_0x562b14['filters']));_0x484abe[_0x9724('0x4d')]['MailAccountId']=_0x30dc3b['id'];if(_0xd52e2e[_0x9724('0x45')][_0x9724('0x4e')]){_0x484abe[_0x9724('0x4d')]=_[_0x9724('0x4f')](_0x484abe['where'],{'$or':_[_0x9724('0x41')](_0x484abe[_0x9724('0x47')],function(_0x22a48b){var _0x3b3b28={};_0x3b3b28[_0x22a48b]={'$like':'%'+_0xd52e2e[_0x9724('0x45')][_0x9724('0x4e')]+'%'};return _0x3b3b28;})});}_0x484abe=_['merge']({},_0x484abe,_0xd52e2e[_0x9724('0x51')]);return db[_0x9724('0x6a')][_0x9724('0x2f')]({'where':_0x484abe[_0x9724('0x4d')]})[_0x9724('0x34')](function(_0x18b238){_0x122df3[_0x9724('0x2f')]=_0x18b238;if(_0xd52e2e[_0x9724('0x45')]['includeAll']){_0x484abe[_0x9724('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x484abe);})[_0x9724('0x34')](function(_0xd9bf7f){_0x122df3[_0x9724('0x56')]=_0xd9bf7f;return _0x122df3;});}})[_0x9724('0x34')](respondWithFilteredResult(_0x408bf0,_0x484abe))[_0x9724('0x57')](handleError(_0x408bf0,null));};exports[_0x9724('0x6d')]=function(_0x36271d,_0x3f7bdd,_0x1621f7){return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x36271d[_0x9724('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f7bdd,null))[_0x9724('0x34')](function(_0x1c18f0){if(_0x1c18f0){return _0x1c18f0['removeAnswers'](_0x36271d['query']['ids']);}})['then'](respondWithStatusCode(_0x3f7bdd,null))[_0x9724('0x57')](handleError(_0x3f7bdd,null));};exports[_0x9724('0x64')]=function(_0x5e0226,_0x2bd049){var _0x4f1fd6={'name':_0x5e0226[_0x9724('0x5e')]['name'],'key':_0x5e0226[_0x9724('0x5e')]['key'],'email':_0x5e0226[_0x9724('0x5e')]['email'],'ListId':_0x5e0226['body'][_0x9724('0x6e')],'active':!_[_0x9724('0x6f')](_0x5e0226['body']['active'])?_0x5e0226[_0x9724('0x5e')]['active']:!![],'description':_0x5e0226[_0x9724('0x5e')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x9724('0x6f')](_0x5e0226['body'][_0x9724('0x70')])){if(_0x5e0226[_0x9724('0x5e')][_0x9724('0x71')]){_0x4f1fd6[_0x9724('0x3d')][_0x9724('0x72')]=_0x4f1fd6[_0x9724('0x3e')][_0x9724('0x72')]=_0x5e0226[_0x9724('0x5e')][_0x9724('0x73')];_0x4f1fd6[_0x9724('0x3d')][_0x9724('0x74')]=_0x4f1fd6[_0x9724('0x3e')][_0x9724('0x75')]=_0x5e0226['body'][_0x9724('0x76')];}else{_0x4f1fd6[_0x9724('0x3d')][_0x9724('0x77')]=_0x4f1fd6[_0x9724('0x3e')]['authentication']=![];}_0x4f1fd6[_0x9724('0x3d')][_0x9724('0x78')]=_0x5e0226[_0x9724('0x5e')][_0x9724('0x3d')]['host'];_0x4f1fd6[_0x9724('0x3d')]['port']=_0x5e0226[_0x9724('0x5e')][_0x9724('0x3d')]['port'];_0x4f1fd6[_0x9724('0x3e')][_0x9724('0x78')]=_0x5e0226[_0x9724('0x5e')][_0x9724('0x3e')][_0x9724('0x78')];_0x4f1fd6[_0x9724('0x3e')][_0x9724('0x79')]=_0x5e0226[_0x9724('0x5e')]['Smtp']['port'];}else{_0x4f1fd6[_0x9724('0x3d')][_0x9724('0x7a')]=_0x4f1fd6[_0x9724('0x3e')][_0x9724('0x7a')]=_0x5e0226['body']['cservice'];_0x4f1fd6[_0x9724('0x3d')][_0x9724('0x72')]=_0x4f1fd6['Smtp'][_0x9724('0x72')]=_0x5e0226[_0x9724('0x5e')]['cuser'];_0x4f1fd6['Imap'][_0x9724('0x74')]=_0x4f1fd6[_0x9724('0x3e')][_0x9724('0x75')]=_0x5e0226[_0x9724('0x5e')][_0x9724('0x76')];}return db[_0x9724('0x52')][_0x9724('0x64')](_0x4f1fd6,{'include':[{'model':db[_0x9724('0x5a')],'as':'Smtp'},{'model':db[_0x9724('0x3c')],'as':'Imap'}]})[_0x9724('0x34')](function(_0x39b0fa){var _0x3068eb=_0x5e0226[_0x9724('0x72')][_0x9724('0x35')]({'plain':!![]});if(!_0x3068eb)throw new Error(_0x9724('0x7b'));if(_0x3068eb[_0x9724('0x7c')]===_0x9724('0x72')){var _0x312fb4=_0x39b0fa[_0x9724('0x35')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x9724('0x36'),'userProfileId':_0x3068eb[_0x9724('0x7d')]},'raw':!![]})[_0x9724('0x34')](function(_0x545e3d){if(_0x545e3d&&_0x545e3d[_0x9724('0x7e')]===0x0){return db[_0x9724('0x37')][_0x9724('0x64')]({'name':_0x312fb4[_0x9724('0x39')],'resourceId':_0x312fb4['id'],'type':_0x545e3d[_0x9724('0x39')],'sectionId':_0x545e3d['id']},{})[_0x9724('0x34')](function(){return _0x39b0fa;});}else{return _0x39b0fa;}})[_0x9724('0x57')](function(_0x30dd80){logger[_0x9724('0x26')](_0x9724('0x7f'),_0x30dd80);throw _0x30dd80;});}return _0x39b0fa;})[_0x9724('0x34')](respondWithResult(_0x2bd049,0xc9))['catch'](handleError(_0x2bd049,null));};exports[_0x9724('0x80')]=function(_0x1bab05,_0x3831bb,_0xb18e50){return db['MailAccount'][_0x9724('0x6c')]({'where':{'id':_0x1bab05[_0x9724('0x59')]['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x3831bb,null))[_0x9724('0x34')](function(_0x4e5df3){if(_0x4e5df3){return _0x4e5df3[_0x9724('0x80')]();}return null;})[_0x9724('0x34')](respondWithResult(_0x3831bb,null))[_0x9724('0x57')](handleError(_0x3831bb,null));};exports[_0x9724('0x81')]=function(_0x13d259,_0xf16831,_0x20245e){if(_0x13d259['body']['id']){delete _0x13d259[_0x9724('0x5e')]['id'];}return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x13d259[_0x9724('0x59')]['id']}})['then'](handleEntityNotFound(_0xf16831,null))[_0x9724('0x34')](function(_0x530ee3){if(_0x530ee3){_0x13d259[_0x9724('0x5e')][_0x9724('0x62')]=_0x530ee3['id'];return db[_0x9724('0x3c')][_0x9724('0x64')](_0x13d259[_0x9724('0x5e')]);}})[_0x9724('0x34')](respondWithResult(_0xf16831,null))[_0x9724('0x57')](handleError(_0xf16831,null));};exports['removeImap']=function(_0x4958d6,_0x314f9d,_0x18ed73){return db['MailAccount']['findOne']({'where':{'id':_0x4958d6['params']['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x314f9d,null))['then'](function(_0x2005a6){if(_0x2005a6){return _0x2005a6[_0x9724('0x82')](null);}return null;})[_0x9724('0x34')](respondWithStatusCode(_0x314f9d,null))['catch'](handleError(_0x314f9d,null));};exports['getSmtp']=function(_0x56d5dd,_0x689209,_0x3b2fdf){return db[_0x9724('0x52')][_0x9724('0x6c')]({'where':{'id':_0x56d5dd[_0x9724('0x59')]['id']}})['then'](handleEntityNotFound(_0x689209,null))[_0x9724('0x34')](function(_0x3d19aa){if(_0x3d19aa){return _0x3d19aa[_0x9724('0x83')]();}return null;})[_0x9724('0x34')](respondWithResult(_0x689209,null))['catch'](handleError(_0x689209,null));};exports['addSmtp']=function(_0x2a9ed3,_0x43185a,_0x291aad){if(_0x2a9ed3['body']['id']){delete _0x2a9ed3[_0x9724('0x5e')]['id'];}return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x2a9ed3[_0x9724('0x59')]['id']}})['then'](handleEntityNotFound(_0x43185a,null))['then'](function(_0x47e37e){if(_0x47e37e){_0x2a9ed3[_0x9724('0x5e')][_0x9724('0x62')]=_0x47e37e['id'];return db[_0x9724('0x5a')][_0x9724('0x64')](_0x2a9ed3[_0x9724('0x5e')]);}})[_0x9724('0x34')](respondWithResult(_0x43185a,null))[_0x9724('0x57')](handleError(_0x43185a,null));};exports[_0x9724('0x84')]=function(_0x3a904d,_0x2f13b9,_0x49615d){return db[_0x9724('0x52')]['findOne']({'where':{'id':_0x3a904d[_0x9724('0x59')]['id']}})['then'](handleEntityNotFound(_0x2f13b9,null))[_0x9724('0x34')](function(_0x3263d7){if(_0x3263d7){return _0x3263d7['setSmtp'](null);}return null;})[_0x9724('0x34')](respondWithStatusCode(_0x2f13b9,null))[_0x9724('0x57')](handleError(_0x2f13b9,null));};exports['addInteraction']=function(_0x486379,_0x105d40,_0x335546){return db[_0x9724('0x85')][_0x9724('0x5d')]({'where':{'id':_0x486379[_0x9724('0x59')]['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x105d40,null))[_0x9724('0x34')](function(_0x2b5c34){if(_0x2b5c34){return _0x2b5c34['addInteraction'](_0x486379['body']['ids'],_[_0x9724('0x86')](_0x486379[_0x9724('0x5e')],[_0x9724('0x87'),'id'])||{});}})[_0x9724('0x34')](respondWithResult(_0x105d40,null))[_0x9724('0x57')](handleError(_0x105d40,null));};exports[_0x9724('0x88')]=function(_0x2ae83e,_0x1fea52,_0x31a007){var _0x52b0a1={'raw':![],'where':{}};var _0x4336fc={};var _0x81296a={'count':0x0,'rows':[]};return db[_0x9724('0x52')][_0x9724('0x6c')]({'where':{'id':_0x2ae83e[_0x9724('0x59')]['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x1fea52,null))[_0x9724('0x34')](function(_0x52a40d){if(_0x52a40d){_0x4336fc[_0x9724('0x49')]=_[_0x9724('0x46')](db[_0x9724('0x85')][_0x9724('0x42')]);_0x4336fc['query']=_[_0x9724('0x46')](_0x2ae83e['query']);_0x4336fc[_0x9724('0x66')]=_[_0x9724('0x5b')](_0x4336fc[_0x9724('0x49')],_0x4336fc[_0x9724('0x45')]);_0x52b0a1['attributes']=_[_0x9724('0x5b')](_0x4336fc[_0x9724('0x49')],qs[_0x9724('0x5c')](_0x2ae83e['query'][_0x9724('0x5c')]));_0x52b0a1[_0x9724('0x47')]=_0x52b0a1[_0x9724('0x47')]['length']?_0x52b0a1['attributes']:_0x4336fc['model'];if(!_0x2ae83e[_0x9724('0x45')]['hasOwnProperty'](_0x9724('0x67'))){_0x52b0a1[_0x9724('0x31')]=qs['limit'](_0x2ae83e[_0x9724('0x45')]['limit']);_0x52b0a1['offset']=qs[_0x9724('0x30')](_0x2ae83e[_0x9724('0x45')][_0x9724('0x30')]);}_0x52b0a1[_0x9724('0x4b')]=qs[_0x9724('0x4c')](_0x2ae83e[_0x9724('0x45')][_0x9724('0x4c')]);_0x52b0a1[_0x9724('0x4d')]=qs['filters'](_[_0x9724('0x68')](_0x2ae83e['query'],_0x4336fc['filters']));_0x52b0a1['where']['MailAccountId']=_0x52a40d['id'];if(_0x2ae83e['query'][_0x9724('0x4e')]){_0x52b0a1[_0x9724('0x4d')]=_['merge'](_0x52b0a1['where'],{'$or':_['map'](_0x52b0a1[_0x9724('0x47')],function(_0x1e2ccf){var _0x3f1a3e={};_0x3f1a3e[_0x1e2ccf]={'$like':'%'+_0x2ae83e['query'][_0x9724('0x4e')]+'%'};return _0x3f1a3e;})});}_0x52b0a1=_['merge']({},_0x52b0a1,_0x2ae83e[_0x9724('0x51')]);return db['MailInteraction'][_0x9724('0x2f')]({'where':_0x52b0a1['where']})[_0x9724('0x34')](function(_0x2f2cc1){_0x81296a['count']=_0x2f2cc1;if(_0x2ae83e[_0x9724('0x45')]['includeAll']){_0x52b0a1['include']=[{'model':db[_0x9724('0x89')],'as':'Contact','required':![]},{'model':db[_0x9724('0x8a')],'as':_0x9724('0x8b'),'attributes':[_0x9724('0x39'),_0x9724('0x8c'),_0x9724('0x8d')],'required':![]},{'model':db[_0x9724('0x8e')],'as':'Tags','attributes':['id','name',_0x9724('0x8f')],'where':_0x2ae83e['query']['tag']?{'id':_0x2ae83e[_0x9724('0x45')][_0x9724('0x90')]}:undefined,'required':_0x2ae83e[_0x9724('0x45')]['tag']?!![]:![]}];}return db[_0x9724('0x85')][_0x9724('0x55')](_0x52b0a1);})['then'](function(_0x432df0){_0x81296a[_0x9724('0x56')]=_0x432df0;return _0x81296a;});}})[_0x9724('0x34')](respondWithFilteredResult(_0x1fea52,_0x52b0a1))[_0x9724('0x57')](handleError(_0x1fea52,null));};exports['addApplications']=function(_0x5a5f52,_0x5eef6,_0x25c523){return db[_0x9724('0x52')][_0x9724('0x6c')]({'where':{'id':_0x5a5f52['params']['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x5eef6,null))['then'](function(_0x29b976){if(_0x29b976){return db['sequelize'][_0x9724('0x91')](function(_0x23bc98){return db[_0x9724('0x92')][_0x9724('0x93')]({'where':{'MailAccountId':_0x5a5f52[_0x9724('0x59')]['id']},'transaction':_0x23bc98})['then'](function(_0x25f49c){var _0x175d43=_[_0x9724('0x41')](_0x5a5f52[_0x9724('0x5e')],function(_0x3a7c1b){_0x3a7c1b[_0x9724('0x62')]=_0x5a5f52[_0x9724('0x59')]['id'];return _0x3a7c1b;});return db['MailApplication'][_0x9724('0x94')](_0x175d43,{'transaction':_0x23bc98});});})[_0x9724('0x34')](function(){return db[_0x9724('0x92')][_0x9724('0x95')]({'where':{'MailAccountId':_0x5a5f52[_0x9724('0x59')]['id']},'order':'priority'});});}})[_0x9724('0x34')](respondWithResult(_0x5eef6,null))['catch'](handleError(_0x5eef6,null));};exports[_0x9724('0x96')]=function(_0x119cad,_0x1b80df,_0x1daf36){var _0x5e1983={};var _0x1fbaae={};var _0x523fd9;var _0x21a96f;return db['MailAccount'][_0x9724('0x6c')]({'where':{'id':_0x119cad['params']['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x1b80df,null))['then'](function(_0x30c8b7){if(_0x30c8b7){_0x523fd9=_0x30c8b7;_0x1fbaae[_0x9724('0x49')]=_['keys'](db[_0x9724('0x92')]['rawAttributes']);_0x1fbaae['query']=_[_0x9724('0x46')](_0x119cad[_0x9724('0x45')]);_0x1fbaae[_0x9724('0x66')]=_[_0x9724('0x5b')](_0x1fbaae['model'],_0x1fbaae[_0x9724('0x45')]);_0x5e1983[_0x9724('0x47')]=_[_0x9724('0x5b')](_0x1fbaae[_0x9724('0x49')],qs['fields'](_0x119cad[_0x9724('0x45')]['fields']));_0x5e1983[_0x9724('0x47')]=_0x5e1983['attributes'][_0x9724('0x48')]?_0x5e1983[_0x9724('0x47')]:_0x1fbaae['model'];_0x5e1983[_0x9724('0x4b')]=qs[_0x9724('0x4c')](_0x119cad[_0x9724('0x45')][_0x9724('0x4c')]);_0x5e1983['where']=qs['filters'](_[_0x9724('0x68')](_0x119cad['query'],_0x1fbaae[_0x9724('0x66')]));if(_0x119cad['query'][_0x9724('0x4e')]){_0x5e1983[_0x9724('0x4d')]=_['merge'](_0x5e1983[_0x9724('0x4d')],{'$or':_[_0x9724('0x41')](_0x5e1983[_0x9724('0x47')],function(_0x8a0137){var _0x47b25c={};_0x47b25c[_0x8a0137]={'$like':'%'+_0x119cad[_0x9724('0x45')]['filter']+'%'};return _0x47b25c;})});}_0x5e1983=_[_0x9724('0x4f')]({},_0x5e1983,_0x119cad[_0x9724('0x51')]);return _0x523fd9[_0x9724('0x96')](_0x5e1983);}})[_0x9724('0x34')](function(_0x4ac1c4){if(_0x4ac1c4){_0x21a96f=_0x4ac1c4[_0x9724('0x48')];if(!_0x119cad['query'][_0x9724('0x4a')](_0x9724('0x67'))){_0x5e1983[_0x9724('0x31')]=qs[_0x9724('0x31')](_0x119cad[_0x9724('0x45')][_0x9724('0x31')]);_0x5e1983['offset']=qs[_0x9724('0x30')](_0x119cad[_0x9724('0x45')][_0x9724('0x30')]);}return _0x523fd9[_0x9724('0x96')](_0x5e1983);}})[_0x9724('0x34')](function(_0x413981){if(_0x413981){return _0x413981?{'count':_0x21a96f,'rows':_0x413981}:null;}})[_0x9724('0x34')](respondWithResult(_0x1b80df,null))['catch'](handleError(_0x1b80df,null));};exports[_0x9724('0x97')]=function(_0x39e56f,_0x536b35,_0x14c228){var _0x20e961={'raw':!![],'where':{}};var _0x17d2ba={};var _0x4ce15d={'count':0x0,'rows':[]};return db[_0x9724('0x52')][_0x9724('0x6c')]({'where':{'id':_0x39e56f['params']['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x536b35,null))['then'](function(_0x2635f4){if(_0x2635f4){_0x17d2ba[_0x9724('0x49')]=_[_0x9724('0x46')](db['MailMessage']['rawAttributes']);_0x17d2ba['query']=_['keys'](_0x39e56f[_0x9724('0x45')]);_0x17d2ba[_0x9724('0x66')]=_[_0x9724('0x5b')](_0x17d2ba[_0x9724('0x49')],_0x17d2ba['query']);_0x20e961[_0x9724('0x47')]=_['intersection'](_0x17d2ba[_0x9724('0x49')],qs[_0x9724('0x5c')](_0x39e56f[_0x9724('0x45')][_0x9724('0x5c')]));_0x20e961['attributes']=_0x20e961[_0x9724('0x47')][_0x9724('0x48')]?_0x20e961[_0x9724('0x47')]:_0x17d2ba[_0x9724('0x49')];if(!_0x39e56f[_0x9724('0x45')][_0x9724('0x4a')](_0x9724('0x67'))){_0x20e961[_0x9724('0x31')]=qs[_0x9724('0x31')](_0x39e56f[_0x9724('0x45')][_0x9724('0x31')]);_0x20e961[_0x9724('0x30')]=qs[_0x9724('0x30')](_0x39e56f[_0x9724('0x45')][_0x9724('0x30')]);}_0x20e961['order']=qs[_0x9724('0x4c')](_0x39e56f[_0x9724('0x45')][_0x9724('0x4c')]);_0x20e961[_0x9724('0x4d')]=qs[_0x9724('0x66')](_[_0x9724('0x68')](_0x39e56f[_0x9724('0x45')],_0x17d2ba[_0x9724('0x66')]));_0x20e961[_0x9724('0x4d')][_0x9724('0x62')]=_0x2635f4['id'];if(_0x39e56f['query'][_0x9724('0x4e')]){_0x20e961[_0x9724('0x4d')]=_[_0x9724('0x4f')](_0x20e961[_0x9724('0x4d')],{'$or':_['map'](_0x20e961[_0x9724('0x47')],function(_0x2574b1){var _0x4ffd7f={};_0x4ffd7f[_0x2574b1]={'$like':'%'+_0x39e56f[_0x9724('0x45')][_0x9724('0x4e')]+'%'};return _0x4ffd7f;})});}if(_0x39e56f[_0x9724('0x45')][_0x9724('0x98')]){var _0x501992=_0x39e56f[_0x9724('0x45')]['$gte']['split'](',');var _0x34f9d3={};_0x34f9d3[_0x501992[0x0]]={'$gte':moment(_0x501992[0x1])[_0x9724('0x99')](_0x9724('0x9a'))};_0x20e961[_0x9724('0x4d')]=_[_0x9724('0x4f')](_0x20e961[_0x9724('0x4d')],_0x34f9d3);}_0x20e961=_['merge']({},_0x20e961,_0x39e56f['options']);return db['MailMessage'][_0x9724('0x2f')]({'where':_0x20e961['where']})[_0x9724('0x34')](function(_0x1aa050){_0x4ce15d[_0x9724('0x2f')]=_0x1aa050;if(_0x39e56f[_0x9724('0x45')][_0x9724('0x53')]){_0x20e961['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x20e961);})[_0x9724('0x34')](function(_0xbe4114){_0x4ce15d['rows']=_0xbe4114;return _0x4ce15d;});}})[_0x9724('0x34')](respondWithFilteredResult(_0x536b35,_0x20e961))[_0x9724('0x57')](handleError(_0x536b35,null));};exports[_0x9724('0x3a')]=function(_0x243935,_0x3c1ad9,_0x26ad3b){var _0x5eee0e,_0x10e2c9={},_0x34ddd3;if(_0x243935['body']['to']){_0x34ddd3=_0x243935['body']['to'][_0x9724('0x9b')](',')[0x0];}return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x243935[_0x9724('0x59')]['id']},'include':[{'model':db[_0x9724('0x9c')],'as':_0x9724('0x9d'),'include':[{'model':db['CmContact'],'as':_0x9724('0x9e'),'where':{'email':_0x34ddd3},'limit':0x1,'order':[[_0x9724('0x9f'),_0x9724('0xa0')]]}]},{'model':db[_0x9724('0x5a')],'as':_0x9724('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x3c1ad9,null))['then'](function(_0x33d20c){if(_0x33d20c){_0x5eee0e=_0x33d20c;if(_0x33d20c['Smtp']){if(_[_0x9724('0x6f')](_0x243935[_0x9724('0x5e')][_0x9724('0xa1')])){_0x243935[_0x9724('0x5e')][_0x9724('0xa1')]=util[_0x9724('0x99')](_0x9724('0xa2'),_0x33d20c[_0x9724('0x39')],_0x33d20c[_0x9724('0xa3')]||_0x33d20c[_0x9724('0x3e')]['user']);}if(_0x243935['body'][_0x9724('0xa4')]&&_0x243935[_0x9724('0x5e')][_0x9724('0xa4')]['length']){for(var _0x4a51e0=0x0;_0x4a51e0<_0x243935['body'][_0x9724('0xa4')][_0x9724('0x48')];_0x4a51e0+=0x1){_0x243935[_0x9724('0x5e')][_0x9724('0xa4')][_0x4a51e0]={'filename':_0x243935[_0x9724('0x5e')][_0x9724('0xa4')][_0x4a51e0][_0x9724('0x39')],'path':path[_0x9724('0xa5')](config[_0x9724('0xa6')],_0x9724('0xa7'),_0x243935[_0x9724('0x5e')][_0x9724('0xa4')][_0x4a51e0]['basename'])};}}var _0x4fe215={'tls':{'rejectUnauthorized':![]}};if(_[_0x9724('0x6f')](_0x33d20c[_0x9724('0x3e')][_0x9724('0x7a')])){if(_0x33d20c['Smtp'][_0x9724('0x77')]){_0x4fe215[_0x9724('0xa8')]={'user':_0x33d20c[_0x9724('0x3e')][_0x9724('0x72')],'pass':_0x33d20c[_0x9724('0x3e')]['pass']};}_0x4fe215['host']=_0x33d20c[_0x9724('0x3e')][_0x9724('0x78')];_0x4fe215['port']=_0x33d20c[_0x9724('0x3e')]['port'];_0x4fe215[_0x9724('0xa9')]=_0x33d20c['Smtp']['secure'];}else{_0x4fe215['service']=_0x33d20c[_0x9724('0x3e')][_0x9724('0x7a')];_0x4fe215[_0x9724('0xa8')]={'user':_0x33d20c[_0x9724('0x3e')]['user'],'pass':_0x33d20c[_0x9724('0x3e')][_0x9724('0x75')]};}return respondWithRpcPromise(_0x9724('0xaa'),'sendMail',{'account':_0x4fe215,'message':_0x243935[_0x9724('0x5e')]});}else{throw new Error(_0x9724('0xab'));}}})[_0x9724('0x34')](function(_0x1e2b57){if(_0x1e2b57){_0x10e2c9=_0x1e2b57;if(_0x5eee0e[_0x9724('0x9d')]){if(_0x5eee0e[_0x9724('0x9d')][_0x9724('0x9e')][_0x9724('0x48')]){return _0x5eee0e[_0x9724('0x9d')][_0x9724('0x9e')][0x0];}else{return db['CmContact'][_0x9724('0x64')](_['defaults'](_0x243935[_0x9724('0x5e')],{'firstName':_0x243935['body']['to'],'email':_0x243935[_0x9724('0x5e')]['to'],'phone':_0x243935[_0x9724('0x5e')]['to'],'ListId':_0x5eee0e[_0x9724('0x6e')]}));}}else{throw new Error(_0x9724('0xab'));}}})[_0x9724('0x34')](function(_0x1f7c15){if(_0x1f7c15){var _0x5d4726={'UserId':_0x243935[_0x9724('0x72')]['id'],'ContactId':_0x1f7c15['id'],'MailAccountId':_0x5eee0e['id'],'inReplyTo':_0x10e2c9[_0x9724('0xac')],'to':_0x243935[_0x9724('0x5e')][_0x9724('0xa1')],'cc':_0x243935[_0x9724('0x5e')]['cc'],'subject':_0x243935[_0x9724('0x5e')][_0x9724('0xad')],'attach':_0x243935['body'][_0x9724('0xae')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x9724('0x99')](_0x9724('0x9a')),'lastMsgDirection':_0x9724('0xaf'),'lastMsgBody':_0x243935[_0x9724('0x5e')][_0x9724('0x5e')],'Messages':[_[_0x9724('0x4f')](_0x243935['body'],{'messageId':_0x10e2c9[_0x9724('0xac')],'sentAt':moment()[_0x9724('0x99')](_0x9724('0x9a')),'read':!![],'MailAccountId':_0x5eee0e['id'],'UserId':_0x243935[_0x9724('0x72')]['id'],'ContactId':_0x1f7c15['id']})]};if(_0x243935['body'][_0x9724('0xb0')]){_0x5d4726=_['merge'](_0x5d4726,_0x243935[_0x9724('0x5e')][_0x9724('0xb0')]);}return db[_0x9724('0x85')][_0x9724('0x64')](_0x5d4726,{'include':[{'model':db[_0x9724('0xb1')],'as':_0x9724('0xb2')}]});}})['then'](respondWithResult(_0x3c1ad9,null))['catch'](handleError(_0x3c1ad9,null));};exports['verifySmtp']=function(_0x22bc68,_0x4cc1d7,_0x520e0f){return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x22bc68[_0x9724('0x59')]['id']},'include':[{'model':db[_0x9724('0x5a')],'as':_0x9724('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4cc1d7,null))[_0x9724('0x34')](function(_0x1a6c83){if(_0x1a6c83&&_0x1a6c83[_0x9724('0x3e')]){var _0x4b9969={'id':_0x1a6c83['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1a6c83[_0x9724('0x3e')][_0x9724('0x7a')]){_0x4b9969[_0x9724('0x7a')]=_0x1a6c83['Smtp'][_0x9724('0x7a')];}else{_0x4b9969[_0x9724('0x78')]=_0x1a6c83['Smtp']['host'];_0x4b9969[_0x9724('0x79')]=_0x1a6c83['Smtp'][_0x9724('0x79')];_0x4b9969['secure']=_0x1a6c83['Smtp']['secure'];}if(_0x1a6c83['Smtp']['authentication']){_0x4b9969[_0x9724('0xa8')]={'user':_0x1a6c83[_0x9724('0x3e')][_0x9724('0x72')],'pass':_0x1a6c83['Smtp'][_0x9724('0x75')]};}return respondWithRpcPromise(_0x9724('0xb3'),_0x9724('0xb4'),{'account':_0x4b9969});}})['then'](respondWithResult(_0x4cc1d7,null))[_0x9724('0x57')](handleError(_0x4cc1d7,null));};exports['destroy']=function(_0x1b4e50,_0x181e87){return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x1b4e50['params']['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x181e87,null))[_0x9724('0x34')](function(_0x8a5963){if(_0x8a5963&&_0x8a5963[_0x9724('0x7a')]){throw new db[(_0x9724('0xb5'))][(_0x9724('0xb6'))](_0x9724('0xb7'));}return _0x8a5963;})[_0x9724('0x34')](removeEntity(_0x181e87,null))['catch'](handleError(_0x181e87,null));};exports[_0x9724('0xb8')]=function(_0x5aed89,_0x4299d2,_0x45f6ca){return db['MailAccount'][_0x9724('0x5d')]({'where':{'id':_0x5aed89['params']['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x4299d2,null))['then'](function(_0x1c57b2){if(_0x1c57b2){return _0x1c57b2['addAgents'](_0x5aed89['body']['ids'],_[_0x9724('0x86')](_0x5aed89['body'],[_0x9724('0x87'),'id'])||{})['spread'](function(_0x2e93d2){for(var _0x4b7338=0x0;_0x4b7338<_0x5aed89[_0x9724('0x5e')][_0x9724('0x87')]['length'];_0x4b7338+=0x1){socket[_0x9724('0xb9')](_0x9724('0xba'),{'UserId':_0x5aed89[_0x9724('0x5e')][_0x9724('0x87')][_0x4b7338],'MailAccountId':_0x5aed89['params']['id']});}return _0x2e93d2;});}})[_0x9724('0x34')](respondWithResult(_0x4299d2,null))[_0x9724('0x57')](handleError(_0x4299d2,null));};exports[_0x9724('0xbb')]=function(_0x46700e,_0x46b3bd,_0x2ddd08){return db[_0x9724('0x52')][_0x9724('0x5d')]({'where':{'id':_0x46700e[_0x9724('0x59')]['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x46b3bd,null))[_0x9724('0x34')](function(_0x45352d){if(_0x45352d){return _0x45352d[_0x9724('0xbb')](_0x46700e[_0x9724('0x45')]['ids'])[_0x9724('0x34')](function(){if(_[_0x9724('0xbc')](_0x46700e[_0x9724('0x45')][_0x9724('0x87')])){for(var _0x8f0000=0x0;_0x8f0000<_0x46700e['query'][_0x9724('0x87')][_0x9724('0x48')];_0x8f0000+=0x1){socket[_0x9724('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x46700e[_0x9724('0x45')][_0x9724('0x87')][_0x8f0000]),'MailAccountId':Number(_0x46700e['params']['id'])});}}else{socket[_0x9724('0xb9')](_0x9724('0xbd'),{'UserId':Number(_0x46700e[_0x9724('0x45')][_0x9724('0x87')]),'MailAccountId':Number(_0x46700e['params']['id'])});}});}})[_0x9724('0x34')](respondWithStatusCode(_0x46b3bd,null))[_0x9724('0x57')](handleError(_0x46b3bd,null));};exports[_0x9724('0xbe')]=function(_0x411429,_0x403d96,_0x40f991){var _0x2f42cc={};var _0x243dd6={};var _0xa42d25;var _0x1fbf83;return db[_0x9724('0x52')]['findOne']({'where':{'id':_0x411429[_0x9724('0x59')]['id']}})[_0x9724('0x34')](handleEntityNotFound(_0x403d96,null))[_0x9724('0x34')](function(_0x2c46ba){if(_0x2c46ba){_0xa42d25=_0x2c46ba;_0x243dd6[_0x9724('0x49')]=_['keys'](db[_0x9724('0x8a')]['rawAttributes']);_0x243dd6[_0x9724('0x45')]=_['keys'](_0x411429['query']);_0x243dd6[_0x9724('0x66')]=_['intersection'](_0x243dd6[_0x9724('0x49')],_0x243dd6[_0x9724('0x45')]);_0x2f42cc[_0x9724('0x47')]=_['intersection'](_0x243dd6[_0x9724('0x49')],qs[_0x9724('0x5c')](_0x411429['query']['fields']));_0x2f42cc['attributes']=_0x2f42cc[_0x9724('0x47')][_0x9724('0x48')]?_0x2f42cc[_0x9724('0x47')]:_0x243dd6[_0x9724('0x49')];_0x2f42cc[_0x9724('0x4b')]=qs[_0x9724('0x4c')](_0x411429[_0x9724('0x45')][_0x9724('0x4c')]);_0x2f42cc[_0x9724('0x4d')]=qs[_0x9724('0x66')](_[_0x9724('0x68')](_0x411429[_0x9724('0x45')],_0x243dd6[_0x9724('0x66')]));if(_0x411429['query']['filter']){_0x2f42cc[_0x9724('0x4d')]=_[_0x9724('0x4f')](_0x2f42cc[_0x9724('0x4d')],{'$or':_[_0x9724('0x41')](_0x2f42cc[_0x9724('0x47')],function(_0x267f5d){var _0xd28e98={};_0xd28e98[_0x267f5d]={'$like':'%'+_0x411429[_0x9724('0x45')][_0x9724('0x4e')]+'%'};return _0xd28e98;})});}_0x2f42cc=_[_0x9724('0x4f')]({},_0x2f42cc,_0x411429[_0x9724('0x51')]);return _0xa42d25[_0x9724('0xbe')](_0x2f42cc);}})[_0x9724('0x34')](function(_0x5111e6){if(_0x5111e6){_0x1fbf83=_0x5111e6[_0x9724('0x48')];if(!_0x411429[_0x9724('0x45')][_0x9724('0x4a')](_0x9724('0x67'))){_0x2f42cc[_0x9724('0x31')]=qs['limit'](_0x411429[_0x9724('0x45')][_0x9724('0x31')]);_0x2f42cc[_0x9724('0x30')]=qs[_0x9724('0x30')](_0x411429[_0x9724('0x45')][_0x9724('0x30')]);}return _0xa42d25[_0x9724('0xbe')](_0x2f42cc);}})['then'](function(_0x3b5113){if(_0x3b5113){return _0x3b5113?{'count':_0x1fbf83,'rows':_0x3b5113}:null;}})[_0x9724('0x34')](respondWithResult(_0x403d96,null))[_0x9724('0x57')](handleError(_0x403d96,null));}; \ No newline at end of file +var _0x3a0f=['VIRTUAL','options','MailAccount','includeAll','findAll','rows','params','MailServerIn','MailServerOut','update','body','find','Smtp','describe','addDisposition','MailAccountId','Disposition','create','findOne','include','ids','addAnswer','CannedAnswer','removeAnswers','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','List','updatedAt','DESC','from','format','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','Contacts','defaults','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','./mailAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','destroy','MailAccounts','stack','name','index','Imap','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x147f18,_0x1854a5){var _0x5484af=function(_0x7a85a5){while(--_0x7a85a5){_0x147f18['push'](_0x147f18['shift']());}};_0x5484af(++_0x1854a5);}(_0x3a0f,0x136));var _0xf3a0=function(_0x1f2341,_0x2dae57){_0x1f2341=_0x1f2341-0x0;var _0x1db239=_0x3a0f[_0x1f2341];return _0x1db239;};'use strict';var pdf=require(_0xf3a0('0x0'));var emlformat=require(_0xf3a0('0x1'));var rimraf=require(_0xf3a0('0x2'));var zipdir=require(_0xf3a0('0x3'));var jsonpatch=require(_0xf3a0('0x4'));var rp=require(_0xf3a0('0x5'));var moment=require(_0xf3a0('0x6'));var BPromise=require(_0xf3a0('0x7'));var Mustache=require(_0xf3a0('0x8'));var util=require('util');var path=require(_0xf3a0('0x9'));var sox=require(_0xf3a0('0xa'));var csv=require('to-csv');var ejs=require(_0xf3a0('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf3a0('0xc'));var crypto=require(_0xf3a0('0xd'));var jsforce=require(_0xf3a0('0xe'));var deskjs=require(_0xf3a0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3a0('0x10'));var Papa=require(_0xf3a0('0x11'));var Redis=require('ioredis');var authService=require(_0xf3a0('0x12'));var qs=require(_0xf3a0('0x13'));var as=require(_0xf3a0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3a0('0x15'))(_0xf3a0('0x16'));var utils=require(_0xf3a0('0x17'));var config=require(_0xf3a0('0x18'));var licenseUtil=require(_0xf3a0('0x19'));var db=require('../../mysqldb')['db'];config[_0xf3a0('0x1a')]=_['defaults'](config[_0xf3a0('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3a0('0x1a')]));require(_0xf3a0('0x1b'))[_0xf3a0('0x1c')](socket);var jayson=require(_0xf3a0('0x1d'));var client=jayson[_0xf3a0('0x1e')][_0xf3a0('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x12fe4f,_0x19eab2,_0x1d9278,_0x104af5){return new BPromise(function(_0x58df4b,_0x128dca){var _0x20c511=_0x104af5||client;return _0x20c511[_0xf3a0('0x20')](_0x12fe4f,_0x1d9278)[_0xf3a0('0x21')](function(_0x4a5a55){logger['info']('MailAccount,\x20%s,\x20%s',_0x19eab2,_0xf3a0('0x22'));logger[_0xf3a0('0x23')](_0xf3a0('0x24'),_0x19eab2,_0xf3a0('0x22'),JSON['stringify'](_0x4a5a55));if(_0x4a5a55[_0xf3a0('0x25')]){if(_0x4a5a55[_0xf3a0('0x25')][_0xf3a0('0x26')]===0x1f4){logger[_0xf3a0('0x25')](_0xf3a0('0x27'),_0x19eab2,_0x4a5a55[_0xf3a0('0x25')][_0xf3a0('0x28')]);return _0x128dca(_0x4a5a55[_0xf3a0('0x25')][_0xf3a0('0x28')]);}logger['error'](_0xf3a0('0x27'),_0x19eab2,_0x4a5a55[_0xf3a0('0x25')]['message']);return _0x58df4b(_0x4a5a55['error'][_0xf3a0('0x28')]);}else{logger['info'](_0xf3a0('0x27'),_0x19eab2,_0xf3a0('0x22'));_0x58df4b(_0x4a5a55[_0xf3a0('0x29')][_0xf3a0('0x28')]);}})[_0xf3a0('0x2a')](function(_0x1599c7){logger['error'](_0xf3a0('0x27'),_0x19eab2,_0x1599c7);_0x128dca(_0x1599c7);});});}function respondWithStatusCode(_0x1492d1,_0x2de4b6){_0x2de4b6=_0x2de4b6||0xcc;return function(_0x548215){if(_0x548215){return _0x1492d1[_0xf3a0('0x2b')](_0x2de4b6);}return _0x1492d1[_0xf3a0('0x2c')](_0x2de4b6)[_0xf3a0('0x2d')]();};}function respondWithResult(_0x1fb0a6,_0x3445b9){_0x3445b9=_0x3445b9||0xc8;return function(_0x2336bf){if(_0x2336bf){return _0x1fb0a6['status'](_0x3445b9)[_0xf3a0('0x2e')](_0x2336bf);}};}function respondWithFilteredResult(_0x57ea05,_0x4603bd){return function(_0x3799fe){if(_0x3799fe){var _0x497a2b=_0x3799fe[_0xf3a0('0x2f')],_0x919c1c=_0x4603bd[_0xf3a0('0x30')],_0x323fbe=_0x4603bd[_0xf3a0('0x30')]+_0x4603bd[_0xf3a0('0x31')],_0x273c92;if(_0x323fbe>=_0x497a2b){_0x323fbe=_0x497a2b;_0x273c92=0xc8;}else{_0x273c92=0xce;}_0x57ea05[_0xf3a0('0x2c')](_0x273c92);return _0x57ea05[_0xf3a0('0x32')](_0xf3a0('0x33'),_0x919c1c+'-'+_0x323fbe+'/'+_0x497a2b)[_0xf3a0('0x2e')](_0x3799fe);}return null;};}function patchUpdates(_0xab966b){return function(_0x268b6f){try{jsonpatch[_0xf3a0('0x34')](_0x268b6f,_0xab966b,!![]);}catch(_0x48538f){return BPromise['reject'](_0x48538f);}return _0x268b6f['save']();};}function saveUpdates(_0x2d4dfa,_0x3b444b){return function(_0x289efb){if(_0x289efb){return _0x289efb['update'](_0x2d4dfa)[_0xf3a0('0x21')](function(_0x205861){return _0x205861;});}return null;};}function removeEntity(_0x3b20a1,_0x34765e){return function(_0xabd255){if(_0xabd255){return _0xabd255[_0xf3a0('0x35')]()[_0xf3a0('0x21')](function(){var _0x4cb452=_0xabd255['get']({'plain':!![]});var _0x2779a6=_0xf3a0('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x2779a6,'resourceId':_0x4cb452['id']}})[_0xf3a0('0x21')](function(){return _0xabd255;});})[_0xf3a0('0x21')](function(){_0x3b20a1[_0xf3a0('0x2c')](0xcc)[_0xf3a0('0x2d')]();});}};}function handleEntityNotFound(_0x2d0fbb,_0x516d2e){return function(_0x4d11ed){if(!_0x4d11ed){_0x2d0fbb[_0xf3a0('0x2b')](0x194);}return _0x4d11ed;};}function handleError(_0x45ac6a,_0x137057){_0x137057=_0x137057||0x1f4;return function(_0x48ba27){logger[_0xf3a0('0x25')](_0x48ba27[_0xf3a0('0x37')]);if(_0x48ba27[_0xf3a0('0x38')]){delete _0x48ba27[_0xf3a0('0x38')];}_0x45ac6a[_0xf3a0('0x2c')](_0x137057)['send'](_0x48ba27);};}exports[_0xf3a0('0x39')]=function(_0x21fa10,_0x317dee){var _0x56e504={'include':[{'model':db['MailServerIn'],'as':_0xf3a0('0x3a')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xf3a0('0x3b')],'as':_0xf3a0('0x3c')}]},_0x23a7d3={},_0x49cc93={'count':0x0,'rows':[]};var _0x4e09c8=_['map'](db['MailAccount'][_0xf3a0('0x3d')],function(_0x43f086){return{'name':_0x43f086[_0xf3a0('0x3e')],'type':_0x43f086[_0xf3a0('0x3f')][_0xf3a0('0x40')]};});_0x23a7d3[_0xf3a0('0x41')]=_[_0xf3a0('0x42')](_0x4e09c8,_0xf3a0('0x38'));_0x23a7d3[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x21fa10[_0xf3a0('0x43')]);_0x23a7d3[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x23a7d3['model'],_0x23a7d3[_0xf3a0('0x43')]);_0x56e504['attributes']=_[_0xf3a0('0x46')](_0x23a7d3[_0xf3a0('0x41')],qs[_0xf3a0('0x47')](_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0x56e504[_0xf3a0('0x48')]=_0x56e504[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0x56e504[_0xf3a0('0x48')]:_0x23a7d3[_0xf3a0('0x41')];if(!_0x21fa10['query'][_0xf3a0('0x4a')](_0xf3a0('0x4b'))){_0x56e504[_0xf3a0('0x31')]=qs['limit'](_0x21fa10[_0xf3a0('0x43')]['limit']);_0x56e504[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x30')]);}_0x56e504[_0xf3a0('0x4c')]=qs[_0xf3a0('0x4d')](_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x4d')]);_0x56e504[_0xf3a0('0x4e')]=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x21fa10[_0xf3a0('0x43')],_0x23a7d3[_0xf3a0('0x45')]),_0x4e09c8);if(_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0x56e504['where']=_[_0xf3a0('0x51')](_0x56e504[_0xf3a0('0x4e')],{'$or':_['map'](_0x4e09c8,function(_0x5c39d9){if(_0x5c39d9[_0xf3a0('0x3f')]!==_0xf3a0('0x52')){var _0x3945c4={};_0x3945c4[_0x5c39d9[_0xf3a0('0x38')]]={'$like':'%'+_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x50')]+'%'};return _0x3945c4;}})});}_0x56e504=_[_0xf3a0('0x51')]({},_0x56e504,_0x21fa10[_0xf3a0('0x53')]);var _0x49244e={'where':_0x56e504[_0xf3a0('0x4e')]};return db[_0xf3a0('0x54')][_0xf3a0('0x2f')](_0x49244e)[_0xf3a0('0x21')](function(_0x8dd7e0){_0x49cc93['count']=_0x8dd7e0;if(_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x55')]){_0x56e504['include']=[{'all':!![]}];}return db[_0xf3a0('0x54')][_0xf3a0('0x56')](_0x56e504);})['then'](function(_0x176732){_0x49cc93[_0xf3a0('0x57')]=_0x176732;return _0x49cc93;})[_0xf3a0('0x21')](respondWithFilteredResult(_0x317dee,_0x56e504))[_0xf3a0('0x2a')](handleError(_0x317dee,null));};exports['show']=function(_0x168ac3,_0x202042){var _0x1e64b2={'raw':![],'where':{'id':_0x168ac3[_0xf3a0('0x58')]['id']},'include':[{'model':db[_0xf3a0('0x59')],'as':_0xf3a0('0x3a')},{'model':db[_0xf3a0('0x5a')],'as':'Smtp'},{'model':db[_0xf3a0('0x3b')],'as':_0xf3a0('0x3c')}]},_0x32bd5a={};_0x32bd5a[_0xf3a0('0x41')]=_['keys'](db[_0xf3a0('0x54')][_0xf3a0('0x3d')]);_0x32bd5a[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x168ac3[_0xf3a0('0x43')]);_0x32bd5a[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x32bd5a[_0xf3a0('0x41')],_0x32bd5a[_0xf3a0('0x43')]);_0x1e64b2[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x32bd5a[_0xf3a0('0x41')],qs[_0xf3a0('0x47')](_0x168ac3[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0x1e64b2[_0xf3a0('0x48')]=_0x1e64b2['attributes'][_0xf3a0('0x49')]?_0x1e64b2[_0xf3a0('0x48')]:_0x32bd5a[_0xf3a0('0x41')];if(_0x168ac3[_0xf3a0('0x43')][_0xf3a0('0x55')]){_0x1e64b2['include']=[{'all':!![]}];}_0x1e64b2=_[_0xf3a0('0x51')]({},_0x1e64b2,_0x168ac3[_0xf3a0('0x53')]);return db[_0xf3a0('0x54')]['find'](_0x1e64b2)[_0xf3a0('0x21')](handleEntityNotFound(_0x202042,null))['then'](respondWithResult(_0x202042,null))[_0xf3a0('0x2a')](handleError(_0x202042,null));};exports[_0xf3a0('0x5b')]=function(_0x135482,_0xc2571d){if(_0x135482[_0xf3a0('0x5c')]['id']){delete _0x135482['body']['id'];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x135482[_0xf3a0('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xf3a0('0x3a')},{'model':db[_0xf3a0('0x5a')],'as':_0xf3a0('0x5e')},{'model':db[_0xf3a0('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xf3a0('0x21')](handleEntityNotFound(_0xc2571d,null))[_0xf3a0('0x21')](saveUpdates(_0x135482[_0xf3a0('0x5c')],null))['then'](function(_0x58079f){if(_0x58079f&&_0x135482[_0xf3a0('0x5c')]['Imap']){return db[_0xf3a0('0x59')][_0xf3a0('0x5b')](_0x135482[_0xf3a0('0x5c')][_0xf3a0('0x3a')],{'where':{'MailAccountId':_0x58079f['id']}})[_0xf3a0('0x21')](function(){return _0x58079f;});}return _0x58079f;})['then'](function(_0x2874a5){if(_0x2874a5&&_0x135482[_0xf3a0('0x5c')]['Smtp']){return db[_0xf3a0('0x5a')]['update'](_0x135482[_0xf3a0('0x5c')][_0xf3a0('0x5e')],{'where':{'MailAccountId':_0x2874a5['id']}})[_0xf3a0('0x21')](function(){return _0x2874a5;});}return _0x2874a5;})[_0xf3a0('0x21')](respondWithResult(_0xc2571d,null))[_0xf3a0('0x2a')](handleError(_0xc2571d,null));};exports[_0xf3a0('0x5f')]=function(_0x51b948,_0x5705e6){return db[_0xf3a0('0x54')]['describe']()[_0xf3a0('0x21')](respondWithResult(_0x5705e6,null))['catch'](handleError(_0x5705e6,null));};exports[_0xf3a0('0x60')]=function(_0x1230a7,_0x5ede7a,_0x457077){if(_0x1230a7[_0xf3a0('0x5c')]['id']){delete _0x1230a7[_0xf3a0('0x5c')]['id'];}return db[_0xf3a0('0x54')]['find']({'where':{'id':_0x1230a7[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x5ede7a,null))[_0xf3a0('0x21')](function(_0xc36c9b){if(_0xc36c9b){_0x1230a7[_0xf3a0('0x5c')][_0xf3a0('0x61')]=_0xc36c9b['id'];return db[_0xf3a0('0x62')][_0xf3a0('0x63')](_0x1230a7['body']);}})[_0xf3a0('0x21')](respondWithResult(_0x5ede7a,null))[_0xf3a0('0x2a')](handleError(_0x5ede7a,null));};exports['getDispositions']=function(_0x425e12,_0x45239b,_0x39dd50){var _0x45d52c={'raw':![],'where':{}};var _0x50974c={};var _0x1a038f={'count':0x0,'rows':[]};return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x425e12['params']['id']}})['then'](handleEntityNotFound(_0x45239b,null))[_0xf3a0('0x21')](function(_0x21bfd0){if(_0x21bfd0){_0x50974c[_0xf3a0('0x41')]=_['keys'](db['Disposition']['rawAttributes']);_0x50974c[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x425e12[_0xf3a0('0x43')]);_0x50974c[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x50974c[_0xf3a0('0x41')],_0x50974c[_0xf3a0('0x43')]);_0x45d52c['attributes']=_['intersection'](_0x50974c[_0xf3a0('0x41')],qs['fields'](_0x425e12['query'][_0xf3a0('0x47')]));_0x45d52c['attributes']=_0x45d52c[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0x45d52c['attributes']:_0x50974c[_0xf3a0('0x41')];if(!_0x425e12['query']['hasOwnProperty']('nolimit')){_0x45d52c['limit']=qs[_0xf3a0('0x31')](_0x425e12['query']['limit']);_0x45d52c[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x425e12[_0xf3a0('0x43')][_0xf3a0('0x30')]);}_0x45d52c['order']=qs['sort'](_0x425e12['query'][_0xf3a0('0x4d')]);_0x45d52c[_0xf3a0('0x4e')]=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x425e12['query'],_0x50974c[_0xf3a0('0x45')]));_0x45d52c[_0xf3a0('0x4e')][_0xf3a0('0x61')]=_0x21bfd0['id'];if(_0x425e12[_0xf3a0('0x43')]['filter']){_0x45d52c[_0xf3a0('0x4e')]=_[_0xf3a0('0x51')](_0x45d52c[_0xf3a0('0x4e')],{'$or':_[_0xf3a0('0x42')](_0x45d52c[_0xf3a0('0x48')],function(_0x5b149a){var _0x194821={};_0x194821[_0x5b149a]={'$like':'%'+_0x425e12[_0xf3a0('0x43')][_0xf3a0('0x50')]+'%'};return _0x194821;})});}_0x45d52c=_[_0xf3a0('0x51')]({},_0x45d52c,_0x425e12[_0xf3a0('0x53')]);return db['Disposition']['count']({'where':_0x45d52c[_0xf3a0('0x4e')]})[_0xf3a0('0x21')](function(_0x1fd374){_0x1a038f[_0xf3a0('0x2f')]=_0x1fd374;if(_0x425e12[_0xf3a0('0x43')]['includeAll']){_0x45d52c[_0xf3a0('0x65')]=[{'all':!![]}];}return db['Disposition'][_0xf3a0('0x56')](_0x45d52c);})['then'](function(_0xf637f8){_0x1a038f[_0xf3a0('0x57')]=_0xf637f8;return _0x1a038f;});}})[_0xf3a0('0x21')](respondWithFilteredResult(_0x45239b,_0x45d52c))['catch'](handleError(_0x45239b,null));};exports['removeDispositions']=function(_0x314a1d,_0x38ef76,_0x561196){return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x314a1d['params']['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x38ef76,null))[_0xf3a0('0x21')](function(_0xa1e046){if(_0xa1e046){return _0xa1e046['removeDispositions'](_0x314a1d[_0xf3a0('0x43')][_0xf3a0('0x66')]);}})[_0xf3a0('0x21')](respondWithStatusCode(_0x38ef76,null))[_0xf3a0('0x2a')](handleError(_0x38ef76,null));};exports[_0xf3a0('0x67')]=function(_0xa3cbd5,_0x423cb1,_0x5359d9){if(_0xa3cbd5['body']['id']){delete _0xa3cbd5[_0xf3a0('0x5c')]['id'];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0xa3cbd5[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x423cb1,null))['then'](function(_0x2bded9){if(_0x2bded9){_0xa3cbd5['body']['MailAccountId']=_0x2bded9['id'];return db['CannedAnswer']['create'](_0xa3cbd5[_0xf3a0('0x5c')]);}})[_0xf3a0('0x21')](respondWithResult(_0x423cb1,null))['catch'](handleError(_0x423cb1,null));};exports['getAnswers']=function(_0x1de256,_0x17cf66,_0x24331d){var _0x514391={'raw':![],'where':{}};var _0x350b06={};var _0x3a918b={'count':0x0,'rows':[]};return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x1de256[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x17cf66,null))[_0xf3a0('0x21')](function(_0x5e7353){if(_0x5e7353){_0x350b06[_0xf3a0('0x41')]=_[_0xf3a0('0x44')](db['CannedAnswer'][_0xf3a0('0x3d')]);_0x350b06[_0xf3a0('0x43')]=_['keys'](_0x1de256[_0xf3a0('0x43')]);_0x350b06[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x350b06[_0xf3a0('0x41')],_0x350b06['query']);_0x514391['attributes']=_[_0xf3a0('0x46')](_0x350b06[_0xf3a0('0x41')],qs[_0xf3a0('0x47')](_0x1de256[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0x514391[_0xf3a0('0x48')]=_0x514391[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0x514391[_0xf3a0('0x48')]:_0x350b06[_0xf3a0('0x41')];if(!_0x1de256[_0xf3a0('0x43')][_0xf3a0('0x4a')]('nolimit')){_0x514391[_0xf3a0('0x31')]=qs[_0xf3a0('0x31')](_0x1de256[_0xf3a0('0x43')]['limit']);_0x514391[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x1de256[_0xf3a0('0x43')][_0xf3a0('0x30')]);}_0x514391[_0xf3a0('0x4c')]=qs[_0xf3a0('0x4d')](_0x1de256[_0xf3a0('0x43')]['sort']);_0x514391['where']=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x1de256['query'],_0x350b06[_0xf3a0('0x45')]));_0x514391[_0xf3a0('0x4e')][_0xf3a0('0x61')]=_0x5e7353['id'];if(_0x1de256[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0x514391[_0xf3a0('0x4e')]=_[_0xf3a0('0x51')](_0x514391[_0xf3a0('0x4e')],{'$or':_['map'](_0x514391[_0xf3a0('0x48')],function(_0x1e1e1f){var _0x5a0e1f={};_0x5a0e1f[_0x1e1e1f]={'$like':'%'+_0x1de256['query'][_0xf3a0('0x50')]+'%'};return _0x5a0e1f;})});}_0x514391=_['merge']({},_0x514391,_0x1de256[_0xf3a0('0x53')]);return db[_0xf3a0('0x68')][_0xf3a0('0x2f')]({'where':_0x514391[_0xf3a0('0x4e')]})[_0xf3a0('0x21')](function(_0x366171){_0x3a918b[_0xf3a0('0x2f')]=_0x366171;if(_0x1de256[_0xf3a0('0x43')]['includeAll']){_0x514391[_0xf3a0('0x65')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf3a0('0x56')](_0x514391);})[_0xf3a0('0x21')](function(_0x58b62e){_0x3a918b['rows']=_0x58b62e;return _0x3a918b;});}})['then'](respondWithFilteredResult(_0x17cf66,_0x514391))[_0xf3a0('0x2a')](handleError(_0x17cf66,null));};exports[_0xf3a0('0x69')]=function(_0x53938a,_0x23904f,_0x3a0a9d){return db['MailAccount']['find']({'where':{'id':_0x53938a[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x23904f,null))[_0xf3a0('0x21')](function(_0x3737c8){if(_0x3737c8){return _0x3737c8[_0xf3a0('0x69')](_0x53938a[_0xf3a0('0x43')][_0xf3a0('0x66')]);}})[_0xf3a0('0x21')](respondWithStatusCode(_0x23904f,null))[_0xf3a0('0x2a')](handleError(_0x23904f,null));};exports[_0xf3a0('0x63')]=function(_0x230564,_0x60b337){var _0x162c1b={'name':_0x230564['body'][_0xf3a0('0x38')],'key':_0x230564[_0xf3a0('0x5c')]['key'],'email':_0x230564[_0xf3a0('0x5c')]['email'],'ListId':_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x6a')],'active':!_[_0xf3a0('0x6b')](_0x230564['body'][_0xf3a0('0x6c')])?_0x230564[_0xf3a0('0x5c')]['active']:!![],'description':_0x230564['body'][_0xf3a0('0x6d')]||null,'Imap':{},'Smtp':{}};if(_[_0xf3a0('0x6b')](_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x6e')])){if(_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x6f')]){_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x70')]=_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x70')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x71')];_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x72')]=_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x73')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x74')];}else{_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x75')]=_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x75')]=![];}_0x162c1b[_0xf3a0('0x3a')]['host']=_0x230564['body'][_0xf3a0('0x3a')][_0xf3a0('0x76')];_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x77')]=_0x230564[_0xf3a0('0x5c')]['Imap'][_0xf3a0('0x77')];_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x76')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x5e')][_0xf3a0('0x76')];_0x162c1b['Smtp'][_0xf3a0('0x77')]=_0x230564['body'][_0xf3a0('0x5e')][_0xf3a0('0x77')];}else{_0x162c1b[_0xf3a0('0x3a')]['service']=_0x162c1b['Smtp'][_0xf3a0('0x78')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x6e')];_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x70')]=_0x162c1b['Smtp'][_0xf3a0('0x70')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x71')];_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x72')]=_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x73')]=_0x230564['body'][_0xf3a0('0x74')];}return db['MailAccount'][_0xf3a0('0x63')](_0x162c1b,{'include':[{'model':db[_0xf3a0('0x5a')],'as':_0xf3a0('0x5e')},{'model':db[_0xf3a0('0x59')],'as':_0xf3a0('0x3a')}]})[_0xf3a0('0x21')](function(_0x5d36a4){var _0x491803=_0x230564[_0xf3a0('0x70')]['get']({'plain':!![]});if(!_0x491803)throw new Error(_0xf3a0('0x79'));if(_0x491803[_0xf3a0('0x7a')]===_0xf3a0('0x70')){var _0x97ce84=_0x5d36a4['get']({'plain':!![]});return db[_0xf3a0('0x7b')][_0xf3a0('0x5d')]({'where':{'name':_0xf3a0('0x36'),'userProfileId':_0x491803[_0xf3a0('0x7c')]},'raw':!![]})[_0xf3a0('0x21')](function(_0x5f1778){if(_0x5f1778&&_0x5f1778[_0xf3a0('0x7d')]===0x0){return db[_0xf3a0('0x7e')][_0xf3a0('0x63')]({'name':_0x97ce84['name'],'resourceId':_0x97ce84['id'],'type':_0x5f1778['name'],'sectionId':_0x5f1778['id']},{})[_0xf3a0('0x21')](function(){return _0x5d36a4;});}else{return _0x5d36a4;}})['catch'](function(_0x163b00){logger[_0xf3a0('0x25')](_0xf3a0('0x7f'),_0x163b00);throw _0x163b00;});}return _0x5d36a4;})[_0xf3a0('0x21')](respondWithResult(_0x60b337,0xc9))['catch'](handleError(_0x60b337,null));};exports[_0xf3a0('0x80')]=function(_0x312e8c,_0x340bb6,_0x9aa877){return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x312e8c[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x340bb6,null))[_0xf3a0('0x21')](function(_0x238059){if(_0x238059){return _0x238059['getImap']();}return null;})[_0xf3a0('0x21')](respondWithResult(_0x340bb6,null))[_0xf3a0('0x2a')](handleError(_0x340bb6,null));};exports[_0xf3a0('0x81')]=function(_0x47a948,_0x1e156c,_0x2c4a56){if(_0x47a948[_0xf3a0('0x5c')]['id']){delete _0x47a948[_0xf3a0('0x5c')]['id'];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x47a948[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x1e156c,null))[_0xf3a0('0x21')](function(_0x48ebe8){if(_0x48ebe8){_0x47a948['body']['MailAccountId']=_0x48ebe8['id'];return db[_0xf3a0('0x59')][_0xf3a0('0x63')](_0x47a948[_0xf3a0('0x5c')]);}})[_0xf3a0('0x21')](respondWithResult(_0x1e156c,null))[_0xf3a0('0x2a')](handleError(_0x1e156c,null));};exports[_0xf3a0('0x82')]=function(_0x4bcd45,_0x203e05,_0xc64fee){return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x4bcd45[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x203e05,null))[_0xf3a0('0x21')](function(_0x3c269a){if(_0x3c269a){return _0x3c269a[_0xf3a0('0x83')](null);}return null;})[_0xf3a0('0x21')](respondWithStatusCode(_0x203e05,null))[_0xf3a0('0x2a')](handleError(_0x203e05,null));};exports[_0xf3a0('0x84')]=function(_0x43d392,_0x27efa1,_0x270cb4){return db[_0xf3a0('0x54')]['findOne']({'where':{'id':_0x43d392[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x27efa1,null))[_0xf3a0('0x21')](function(_0x2b0521){if(_0x2b0521){return _0x2b0521[_0xf3a0('0x84')]();}return null;})['then'](respondWithResult(_0x27efa1,null))[_0xf3a0('0x2a')](handleError(_0x27efa1,null));};exports[_0xf3a0('0x85')]=function(_0x363de6,_0x48b1e8,_0x48c0b1){if(_0x363de6['body']['id']){delete _0x363de6[_0xf3a0('0x5c')]['id'];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x363de6[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x48b1e8,null))[_0xf3a0('0x21')](function(_0x4b6031){if(_0x4b6031){_0x363de6['body'][_0xf3a0('0x61')]=_0x4b6031['id'];return db[_0xf3a0('0x5a')][_0xf3a0('0x63')](_0x363de6['body']);}})[_0xf3a0('0x21')](respondWithResult(_0x48b1e8,null))['catch'](handleError(_0x48b1e8,null));};exports[_0xf3a0('0x86')]=function(_0x18e568,_0x40aeaa,_0x3f921d){return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x18e568[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x40aeaa,null))['then'](function(_0x302a0e){if(_0x302a0e){return _0x302a0e[_0xf3a0('0x87')](null);}return null;})[_0xf3a0('0x21')](respondWithStatusCode(_0x40aeaa,null))[_0xf3a0('0x2a')](handleError(_0x40aeaa,null));};exports[_0xf3a0('0x88')]=function(_0x454b92,_0x26fd22,_0x48fd5a){return db['MailInteraction'][_0xf3a0('0x5d')]({'where':{'id':_0x454b92[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x26fd22,null))['then'](function(_0x580b14){if(_0x580b14){return _0x580b14[_0xf3a0('0x88')](_0x454b92['body'][_0xf3a0('0x66')],_[_0xf3a0('0x89')](_0x454b92['body'],[_0xf3a0('0x66'),'id'])||{});}})['then'](respondWithResult(_0x26fd22,null))[_0xf3a0('0x2a')](handleError(_0x26fd22,null));};exports[_0xf3a0('0x8a')]=function(_0x4c175f,_0x4f7800,_0x3f958b){var _0xd477f4={'raw':![],'where':{}};var _0x5a9b83={};var _0x34c3e3={'count':0x0,'rows':[]};return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x4c175f[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x4f7800,null))[_0xf3a0('0x21')](function(_0x5973ca){if(_0x5973ca){_0x5a9b83[_0xf3a0('0x41')]=_[_0xf3a0('0x44')](db[_0xf3a0('0x8b')][_0xf3a0('0x3d')]);_0x5a9b83[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x4c175f['query']);_0x5a9b83[_0xf3a0('0x45')]=_['intersection'](_0x5a9b83[_0xf3a0('0x41')],_0x5a9b83[_0xf3a0('0x43')]);_0xd477f4[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x5a9b83[_0xf3a0('0x41')],qs[_0xf3a0('0x47')](_0x4c175f['query'][_0xf3a0('0x47')]));_0xd477f4['attributes']=_0xd477f4[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0xd477f4['attributes']:_0x5a9b83[_0xf3a0('0x41')];if(!_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x4a')](_0xf3a0('0x4b'))){_0xd477f4[_0xf3a0('0x31')]=qs[_0xf3a0('0x31')](_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x31')]);_0xd477f4[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x4c175f['query'][_0xf3a0('0x30')]);}_0xd477f4[_0xf3a0('0x4c')]=qs[_0xf3a0('0x4d')](_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x4d')]);_0xd477f4['where']=qs['filters'](_[_0xf3a0('0x4f')](_0x4c175f['query'],_0x5a9b83[_0xf3a0('0x45')]));_0xd477f4[_0xf3a0('0x4e')][_0xf3a0('0x61')]=_0x5973ca['id'];if(_0x4c175f['query'][_0xf3a0('0x50')]){_0xd477f4[_0xf3a0('0x4e')]=_['merge'](_0xd477f4[_0xf3a0('0x4e')],{'$or':_[_0xf3a0('0x42')](_0xd477f4['attributes'],function(_0x284b45){var _0x2b0a52={};_0x2b0a52[_0x284b45]={'$like':'%'+_0x4c175f[_0xf3a0('0x43')]['filter']+'%'};return _0x2b0a52;})});}_0xd477f4=_[_0xf3a0('0x51')]({},_0xd477f4,_0x4c175f[_0xf3a0('0x53')]);return db[_0xf3a0('0x8b')]['count']({'where':_0xd477f4[_0xf3a0('0x4e')]})[_0xf3a0('0x21')](function(_0x1b110a){_0x34c3e3['count']=_0x1b110a;if(_0x4c175f[_0xf3a0('0x43')]['includeAll']){_0xd477f4[_0xf3a0('0x65')]=[{'model':db[_0xf3a0('0x8c')],'as':'Contact','required':![]},{'model':db[_0xf3a0('0x8d')],'as':_0xf3a0('0x8e'),'attributes':[_0xf3a0('0x38'),_0xf3a0('0x8f'),_0xf3a0('0x90')],'required':![]},{'model':db[_0xf3a0('0x91')],'as':_0xf3a0('0x92'),'attributes':['id',_0xf3a0('0x38'),_0xf3a0('0x93')],'where':_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x94')]?{'id':_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x94')]}:undefined,'required':_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x94')]?!![]:![]}];}return db[_0xf3a0('0x8b')]['findAll'](_0xd477f4);})[_0xf3a0('0x21')](function(_0x502710){_0x34c3e3[_0xf3a0('0x57')]=_0x502710;return _0x34c3e3;});}})[_0xf3a0('0x21')](respondWithFilteredResult(_0x4f7800,_0xd477f4))[_0xf3a0('0x2a')](handleError(_0x4f7800,null));};exports['addApplications']=function(_0x3ce2be,_0x30811d,_0x2df320){return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x3ce2be['params']['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x30811d,null))['then'](function(_0x1b1c4c){if(_0x1b1c4c){return db[_0xf3a0('0x95')]['transaction'](function(_0x32d87f){return db[_0xf3a0('0x96')][_0xf3a0('0x35')]({'where':{'MailAccountId':_0x3ce2be[_0xf3a0('0x58')]['id']},'transaction':_0x32d87f})[_0xf3a0('0x21')](function(_0x4f917e){var _0x503106=_['map'](_0x3ce2be[_0xf3a0('0x5c')],function(_0x37d8b7){_0x37d8b7['MailAccountId']=_0x3ce2be[_0xf3a0('0x58')]['id'];return _0x37d8b7;});return db[_0xf3a0('0x96')][_0xf3a0('0x97')](_0x503106,{'transaction':_0x32d87f});});})[_0xf3a0('0x21')](function(){return db[_0xf3a0('0x96')][_0xf3a0('0x98')]({'where':{'MailAccountId':_0x3ce2be[_0xf3a0('0x58')]['id']},'order':_0xf3a0('0x99')});});}})[_0xf3a0('0x21')](respondWithResult(_0x30811d,null))[_0xf3a0('0x2a')](handleError(_0x30811d,null));};exports[_0xf3a0('0x9a')]=function(_0x1e8fd8,_0x1ad46a,_0xb06fc8){var _0x5cb624={};var _0x517c77={};var _0x28a4cb;var _0x3e5e31;return db['MailAccount'][_0xf3a0('0x64')]({'where':{'id':_0x1e8fd8[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x1ad46a,null))[_0xf3a0('0x21')](function(_0x32d997){if(_0x32d997){_0x28a4cb=_0x32d997;_0x517c77[_0xf3a0('0x41')]=_[_0xf3a0('0x44')](db['MailApplication'][_0xf3a0('0x3d')]);_0x517c77['query']=_[_0xf3a0('0x44')](_0x1e8fd8[_0xf3a0('0x43')]);_0x517c77[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x517c77['model'],_0x517c77[_0xf3a0('0x43')]);_0x5cb624[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x517c77[_0xf3a0('0x41')],qs['fields'](_0x1e8fd8[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0x5cb624[_0xf3a0('0x48')]=_0x5cb624[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0x5cb624['attributes']:_0x517c77[_0xf3a0('0x41')];_0x5cb624['order']=qs['sort'](_0x1e8fd8[_0xf3a0('0x43')]['sort']);_0x5cb624[_0xf3a0('0x4e')]=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x1e8fd8['query'],_0x517c77[_0xf3a0('0x45')]));if(_0x1e8fd8[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0x5cb624[_0xf3a0('0x4e')]=_[_0xf3a0('0x51')](_0x5cb624[_0xf3a0('0x4e')],{'$or':_['map'](_0x5cb624[_0xf3a0('0x48')],function(_0x128b44){var _0x29d3f7={};_0x29d3f7[_0x128b44]={'$like':'%'+_0x1e8fd8['query']['filter']+'%'};return _0x29d3f7;})});}_0x5cb624=_[_0xf3a0('0x51')]({},_0x5cb624,_0x1e8fd8[_0xf3a0('0x53')]);return _0x28a4cb[_0xf3a0('0x9a')](_0x5cb624);}})[_0xf3a0('0x21')](function(_0x3125c0){if(_0x3125c0){_0x3e5e31=_0x3125c0[_0xf3a0('0x49')];if(!_0x1e8fd8[_0xf3a0('0x43')][_0xf3a0('0x4a')](_0xf3a0('0x4b'))){_0x5cb624[_0xf3a0('0x31')]=qs[_0xf3a0('0x31')](_0x1e8fd8[_0xf3a0('0x43')][_0xf3a0('0x31')]);_0x5cb624[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x1e8fd8[_0xf3a0('0x43')]['offset']);}return _0x28a4cb[_0xf3a0('0x9a')](_0x5cb624);}})['then'](function(_0xa0dc60){if(_0xa0dc60){return _0xa0dc60?{'count':_0x3e5e31,'rows':_0xa0dc60}:null;}})[_0xf3a0('0x21')](respondWithResult(_0x1ad46a,null))[_0xf3a0('0x2a')](handleError(_0x1ad46a,null));};exports[_0xf3a0('0x9b')]=function(_0x3e5351,_0x169443,_0xa261c){var _0xb8023e={'raw':!![],'where':{}};var _0x3bd692={};var _0x598bae={'count':0x0,'rows':[]};return db['MailAccount'][_0xf3a0('0x64')]({'where':{'id':_0x3e5351[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x169443,null))['then'](function(_0x988cf6){if(_0x988cf6){_0x3bd692['model']=_[_0xf3a0('0x44')](db[_0xf3a0('0x9c')]['rawAttributes']);_0x3bd692['query']=_[_0xf3a0('0x44')](_0x3e5351[_0xf3a0('0x43')]);_0x3bd692[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x3bd692[_0xf3a0('0x41')],_0x3bd692[_0xf3a0('0x43')]);_0xb8023e[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x3bd692[_0xf3a0('0x41')],qs['fields'](_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0xb8023e[_0xf3a0('0x48')]=_0xb8023e[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0xb8023e[_0xf3a0('0x48')]:_0x3bd692[_0xf3a0('0x41')];if(!_0x3e5351[_0xf3a0('0x43')]['hasOwnProperty']('nolimit')){_0xb8023e['limit']=qs[_0xf3a0('0x31')](_0x3e5351['query']['limit']);_0xb8023e[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x30')]);}_0xb8023e['order']=qs[_0xf3a0('0x4d')](_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x4d')]);_0xb8023e[_0xf3a0('0x4e')]=qs['filters'](_['pick'](_0x3e5351['query'],_0x3bd692[_0xf3a0('0x45')]));_0xb8023e[_0xf3a0('0x4e')][_0xf3a0('0x61')]=_0x988cf6['id'];if(_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0xb8023e[_0xf3a0('0x4e')]=_[_0xf3a0('0x51')](_0xb8023e['where'],{'$or':_['map'](_0xb8023e[_0xf3a0('0x48')],function(_0x2dc6f1){var _0x3f5c6b={};_0x3f5c6b[_0x2dc6f1]={'$like':'%'+_0x3e5351[_0xf3a0('0x43')]['filter']+'%'};return _0x3f5c6b;})});}if(_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x9d')]){var _0x3bfce2=_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x9d')]['split'](',');var _0xda2fd7={};_0xda2fd7[_0x3bfce2[0x0]]={'$gte':moment(_0x3bfce2[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xb8023e[_0xf3a0('0x4e')]=_['merge'](_0xb8023e[_0xf3a0('0x4e')],_0xda2fd7);}_0xb8023e=_['merge']({},_0xb8023e,_0x3e5351[_0xf3a0('0x53')]);return db['MailMessage'][_0xf3a0('0x2f')]({'where':_0xb8023e[_0xf3a0('0x4e')]})['then'](function(_0x17585c){_0x598bae[_0xf3a0('0x2f')]=_0x17585c;if(_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x55')]){_0xb8023e[_0xf3a0('0x65')]=[{'all':!![]}];}return db[_0xf3a0('0x9c')][_0xf3a0('0x56')](_0xb8023e);})[_0xf3a0('0x21')](function(_0x5a1947){_0x598bae[_0xf3a0('0x57')]=_0x5a1947;return _0x598bae;});}})[_0xf3a0('0x21')](respondWithFilteredResult(_0x169443,_0xb8023e))[_0xf3a0('0x2a')](handleError(_0x169443,null));};exports['send']=function(_0xc98cd3,_0x39255f,_0x37f2da){var _0x2ca898,_0x48fe28={},_0x39277b;if(_0xc98cd3[_0xf3a0('0x5c')]['to']){_0x39277b=_0xc98cd3[_0xf3a0('0x5c')]['to'][_0xf3a0('0x9e')](',')[0x0];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0xc98cd3[_0xf3a0('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xf3a0('0x9f'),'include':[{'model':db[_0xf3a0('0x8c')],'as':'Contacts','where':{'email':_0x39277b},'limit':0x1,'order':[[_0xf3a0('0xa0'),_0xf3a0('0xa1')]]}]},{'model':db[_0xf3a0('0x5a')],'as':_0xf3a0('0x5e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x39255f,null))[_0xf3a0('0x21')](function(_0x33bae8){if(_0x33bae8){_0x2ca898=_0x33bae8;if(_0x33bae8[_0xf3a0('0x5e')]){if(_['isNil'](_0xc98cd3['body'][_0xf3a0('0xa2')])){_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa2')]=util[_0xf3a0('0xa3')](_0xf3a0('0xa4'),_0x33bae8[_0xf3a0('0x38')],_0x33bae8[_0xf3a0('0xa5')]||_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x70')]);}if(_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')]&&_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')][_0xf3a0('0x49')]){for(var _0x1df540=0x0;_0x1df540<_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')]['length'];_0x1df540+=0x1){_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')][_0x1df540]={'filename':_0xc98cd3[_0xf3a0('0x5c')]['attachments'][_0x1df540][_0xf3a0('0x38')],'path':path[_0xf3a0('0xa7')](config[_0xf3a0('0xa8')],_0xf3a0('0xa9'),_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')][_0x1df540][_0xf3a0('0xaa')])};}}var _0x4c1583={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x78')])){if(_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x75')]){_0x4c1583['auth']={'user':_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x70')],'pass':_0x33bae8['Smtp']['pass']};}_0x4c1583[_0xf3a0('0x76')]=_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x76')];_0x4c1583[_0xf3a0('0x77')]=_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x77')];_0x4c1583[_0xf3a0('0xab')]=_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0xab')];}else{_0x4c1583[_0xf3a0('0x78')]=_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x78')];_0x4c1583[_0xf3a0('0xac')]={'user':_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x70')],'pass':_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x73')]};}return respondWithRpcPromise(_0xf3a0('0xad'),_0xf3a0('0xae'),{'account':_0x4c1583,'message':_0xc98cd3[_0xf3a0('0x5c')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x36005b){if(_0x36005b){_0x48fe28=_0x36005b;if(_0x2ca898[_0xf3a0('0x9f')]){if(_0x2ca898[_0xf3a0('0x9f')][_0xf3a0('0xaf')]['length']){return _0x2ca898[_0xf3a0('0x9f')][_0xf3a0('0xaf')][0x0];}else{return db['CmContact'][_0xf3a0('0x63')](_[_0xf3a0('0xb0')](_0xc98cd3[_0xf3a0('0x5c')],{'firstName':_0xc98cd3[_0xf3a0('0x5c')]['to'],'email':_0xc98cd3['body']['to'],'phone':_0xc98cd3['body']['to'],'ListId':_0x2ca898[_0xf3a0('0x6a')]}));}}else{throw new Error(_0xf3a0('0xb1'));}}})['then'](function(_0x19646f){if(_0x19646f){var _0x480897={'UserId':_0xc98cd3['user']['id'],'ContactId':_0x19646f['id'],'MailAccountId':_0x2ca898['id'],'inReplyTo':_0x48fe28[_0xf3a0('0xb2')],'to':_0xc98cd3[_0xf3a0('0x5c')]['from'],'cc':_0xc98cd3[_0xf3a0('0x5c')]['cc'],'subject':_0xc98cd3['body'][_0xf3a0('0xb3')],'attach':_0xc98cd3['body'][_0xf3a0('0xb4')],'firstMsgDirection':_0xf3a0('0xb5'),'lastMsgAt':moment()[_0xf3a0('0xa3')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xf3a0('0xb5'),'lastMsgBody':_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0x5c')],'Messages':[_[_0xf3a0('0x51')](_0xc98cd3[_0xf3a0('0x5c')],{'messageId':_0x48fe28[_0xf3a0('0xb2')],'sentAt':moment()['format'](_0xf3a0('0xb6')),'read':!![],'MailAccountId':_0x2ca898['id'],'UserId':_0xc98cd3[_0xf3a0('0x70')]['id'],'ContactId':_0x19646f['id']})]};if(_0xc98cd3['body']['Interaction']){_0x480897=_[_0xf3a0('0x51')](_0x480897,_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xb7')]);}return db[_0xf3a0('0x8b')][_0xf3a0('0x63')](_0x480897,{'include':[{'model':db[_0xf3a0('0x9c')],'as':_0xf3a0('0xb8')}]});}})['then'](respondWithResult(_0x39255f,null))[_0xf3a0('0x2a')](handleError(_0x39255f,null));};exports['verifySmtp']=function(_0x5e8fc9,_0xe20207,_0x29c600){return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x5e8fc9['params']['id']},'include':[{'model':db[_0xf3a0('0x5a')],'as':'Smtp','raw':!![]}]})[_0xf3a0('0x21')](handleEntityNotFound(_0xe20207,null))[_0xf3a0('0x21')](function(_0x49ec7d){if(_0x49ec7d&&_0x49ec7d[_0xf3a0('0x5e')]){var _0x3dce91={'id':_0x49ec7d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x49ec7d['Smtp'][_0xf3a0('0x78')]){_0x3dce91['service']=_0x49ec7d['Smtp'][_0xf3a0('0x78')];}else{_0x3dce91['host']=_0x49ec7d[_0xf3a0('0x5e')][_0xf3a0('0x76')];_0x3dce91[_0xf3a0('0x77')]=_0x49ec7d['Smtp'][_0xf3a0('0x77')];_0x3dce91[_0xf3a0('0xab')]=_0x49ec7d[_0xf3a0('0x5e')][_0xf3a0('0xab')];}if(_0x49ec7d[_0xf3a0('0x5e')]['authentication']){_0x3dce91[_0xf3a0('0xac')]={'user':_0x49ec7d[_0xf3a0('0x5e')][_0xf3a0('0x70')],'pass':_0x49ec7d['Smtp'][_0xf3a0('0x73')]};}return respondWithRpcPromise(_0xf3a0('0xb9'),_0xf3a0('0xba'),{'account':_0x3dce91});}})[_0xf3a0('0x21')](respondWithResult(_0xe20207,null))['catch'](handleError(_0xe20207,null));};exports[_0xf3a0('0x35')]=function(_0x27f0ea,_0x5d21cf){return db[_0xf3a0('0x54')]['find']({'where':{'id':_0x27f0ea[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x5d21cf,null))[_0xf3a0('0x21')](function(_0x2d766c){if(_0x2d766c&&_0x2d766c['service']){throw new db[(_0xf3a0('0xbb'))][(_0xf3a0('0xbc'))](_0xf3a0('0xbd'));}return _0x2d766c;})['then'](removeEntity(_0x5d21cf,null))[_0xf3a0('0x2a')](handleError(_0x5d21cf,null));};exports['addAgents']=function(_0x1a35bb,_0x324afe,_0x599140){return db['MailAccount']['find']({'where':{'id':_0x1a35bb[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x324afe,null))[_0xf3a0('0x21')](function(_0x4536c7){if(_0x4536c7){return _0x4536c7['addAgents'](_0x1a35bb[_0xf3a0('0x5c')][_0xf3a0('0x66')],_[_0xf3a0('0x89')](_0x1a35bb[_0xf3a0('0x5c')],[_0xf3a0('0x66'),'id'])||{})[_0xf3a0('0xbe')](function(_0x32b49f){for(var _0x3f3c9e=0x0;_0x3f3c9e<_0x1a35bb[_0xf3a0('0x5c')][_0xf3a0('0x66')][_0xf3a0('0x49')];_0x3f3c9e+=0x1){socket[_0xf3a0('0xbf')](_0xf3a0('0xc0'),{'UserId':_0x1a35bb['body'][_0xf3a0('0x66')][_0x3f3c9e],'MailAccountId':_0x1a35bb[_0xf3a0('0x58')]['id']});}return _0x32b49f;});}})[_0xf3a0('0x21')](respondWithResult(_0x324afe,null))[_0xf3a0('0x2a')](handleError(_0x324afe,null));};exports[_0xf3a0('0xc1')]=function(_0x270656,_0x1bcc00,_0x431eee){return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x270656['params']['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x1bcc00,null))[_0xf3a0('0x21')](function(_0x5eb5ec){if(_0x5eb5ec){return _0x5eb5ec[_0xf3a0('0xc1')](_0x270656[_0xf3a0('0x43')][_0xf3a0('0x66')])[_0xf3a0('0x21')](function(){if(_[_0xf3a0('0xc2')](_0x270656[_0xf3a0('0x43')][_0xf3a0('0x66')])){for(var _0x1c9d57=0x0;_0x1c9d57<_0x270656[_0xf3a0('0x43')][_0xf3a0('0x66')][_0xf3a0('0x49')];_0x1c9d57+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x270656['query']['ids'][_0x1c9d57]),'MailAccountId':Number(_0x270656['params']['id'])});}}else{socket[_0xf3a0('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x270656[_0xf3a0('0x43')]['ids']),'MailAccountId':Number(_0x270656['params']['id'])});}});}})[_0xf3a0('0x21')](respondWithStatusCode(_0x1bcc00,null))[_0xf3a0('0x2a')](handleError(_0x1bcc00,null));};exports[_0xf3a0('0xc3')]=function(_0x2e245b,_0x2ca196,_0x3ec597){var _0x4d6487={};var _0x363abb={};var _0x345153;var _0x1be376;return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x2e245b['params']['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x2ca196,null))[_0xf3a0('0x21')](function(_0x3d172e){if(_0x3d172e){_0x345153=_0x3d172e;_0x363abb[_0xf3a0('0x41')]=_['keys'](db['User']['rawAttributes']);_0x363abb[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x2e245b[_0xf3a0('0x43')]);_0x363abb['filters']=_[_0xf3a0('0x46')](_0x363abb[_0xf3a0('0x41')],_0x363abb['query']);_0x4d6487[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x363abb['model'],qs[_0xf3a0('0x47')](_0x2e245b['query'][_0xf3a0('0x47')]));_0x4d6487['attributes']=_0x4d6487['attributes'][_0xf3a0('0x49')]?_0x4d6487[_0xf3a0('0x48')]:_0x363abb[_0xf3a0('0x41')];_0x4d6487[_0xf3a0('0x4c')]=qs[_0xf3a0('0x4d')](_0x2e245b[_0xf3a0('0x43')][_0xf3a0('0x4d')]);_0x4d6487['where']=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x2e245b[_0xf3a0('0x43')],_0x363abb['filters']));if(_0x2e245b[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0x4d6487['where']=_[_0xf3a0('0x51')](_0x4d6487[_0xf3a0('0x4e')],{'$or':_[_0xf3a0('0x42')](_0x4d6487['attributes'],function(_0x2094ce){var _0x301845={};_0x301845[_0x2094ce]={'$like':'%'+_0x2e245b[_0xf3a0('0x43')][_0xf3a0('0x50')]+'%'};return _0x301845;})});}_0x4d6487=_[_0xf3a0('0x51')]({},_0x4d6487,_0x2e245b[_0xf3a0('0x53')]);return _0x345153['getAgents'](_0x4d6487);}})['then'](function(_0x5905cd){if(_0x5905cd){_0x1be376=_0x5905cd[_0xf3a0('0x49')];if(!_0x2e245b[_0xf3a0('0x43')][_0xf3a0('0x4a')](_0xf3a0('0x4b'))){_0x4d6487[_0xf3a0('0x31')]=qs[_0xf3a0('0x31')](_0x2e245b[_0xf3a0('0x43')]['limit']);_0x4d6487[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x2e245b['query'][_0xf3a0('0x30')]);}return _0x345153['getAgents'](_0x4d6487);}})[_0xf3a0('0x21')](function(_0x273dcd){if(_0x273dcd){return _0x273dcd?{'count':_0x1be376,'rows':_0x273dcd}:null;}})['then'](respondWithResult(_0x2ca196,null))[_0xf3a0('0x2a')](handleError(_0x2ca196,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index d4f4f4d..d3c03f3 100644 --- a/server/api/mailAccount/mailAccount.events.js +++ b/server/api/mailAccount/mailAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8db3=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x3ae96c,_0x5f1e7e){var _0x1b0c90=function(_0x1ecc83){while(--_0x1ecc83){_0x3ae96c['push'](_0x3ae96c['shift']());}};_0x1b0c90(++_0x5f1e7e);}(_0x8db3,0x1bf));var _0x38db=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8db3[_0x465028];return _0xb783d4;};'use strict';var EventEmitter=require(_0x38db('0x0'));var MailAccount=require(_0x38db('0x1'))['db'][_0x38db('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x38db('0x3')](0x0);var events={'afterCreate':_0x38db('0x4'),'afterUpdate':_0x38db('0x5'),'afterDestroy':_0x38db('0x6')};function emitEvent(_0x5908d5){return function(_0x25d839,_0x486503,_0xa0f4){MailAccountEvents[_0x38db('0x7')](_0x5908d5+':'+_0x25d839['id'],_0x25d839);MailAccountEvents[_0x38db('0x7')](_0x5908d5,_0x25d839);_0xa0f4(null);};}for(var e in events){if(events[_0x38db('0x8')](e)){var event=events[e];MailAccount[_0x38db('0x9')](e,emitEvent(event));}}module[_0x38db('0xa')]=MailAccountEvents; \ No newline at end of file +var _0xb073=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0xb073,0x187));var _0x3b07=function(_0x4b31b2,_0x1d53b2){_0x4b31b2=_0x4b31b2-0x0;var _0x5722e9=_0xb073[_0x4b31b2];return _0x5722e9;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x3b07('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3b07('0x1')](0x0);var events={'afterCreate':_0x3b07('0x2'),'afterUpdate':_0x3b07('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d1733){return function(_0x3112da,_0x31e382,_0x48cf22){MailAccountEvents[_0x3b07('0x4')](_0x3d1733+':'+_0x3112da['id'],_0x3112da);MailAccountEvents[_0x3b07('0x4')](_0x3d1733,_0x3112da);_0x48cf22(null);};}for(var e in events){if(events[_0x3b07('0x5')](e)){var event=events[e];MailAccount[_0x3b07('0x6')](e,emitEvent(event));}}module[_0x3b07('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 0b2a57b..92f64d8 100644 --- a/server/api/mailAccount/mailAccount.model.js +++ b/server/api/mailAccount/mailAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2f5=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0xf2f5,0x179));var _0x5f2f=function(_0xa79a7e,_0x16027f){_0xa79a7e=_0xa79a7e-0x0;var _0x2c6019=_0xf2f5[_0xa79a7e];return _0x2c6019;};'use strict';var _=require(_0x5f2f('0x0'));var util=require('util');var logger=require(_0x5f2f('0x1'))('api');var moment=require(_0x5f2f('0x2'));var BPromise=require(_0x5f2f('0x3'));var rp=require(_0x5f2f('0x4'));var fs=require('fs');var path=require(_0x5f2f('0x5'));var rimraf=require(_0x5f2f('0x6'));var config=require(_0x5f2f('0x7'));var attributes=require(_0x5f2f('0x8'));module[_0x5f2f('0x9')]=function(_0x33f876,_0x17004e){return _0x33f876[_0x5f2f('0xa')](_0x5f2f('0xb'),attributes,{'tableName':_0x5f2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1917=['mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x1fbf00,_0x233988){var _0x442c92=function(_0x4756e){while(--_0x4756e){_0x1fbf00['push'](_0x1fbf00['shift']());}};_0x442c92(++_0x233988);}(_0x1917,0x9b));var _0x7191=function(_0x2565c3,_0x26f328){_0x2565c3=_0x2565c3-0x0;var _0x3547e6=_0x1917[_0x2565c3];return _0x3547e6;};'use strict';var _=require(_0x7191('0x0'));var util=require('util');var logger=require(_0x7191('0x1'))(_0x7191('0x2'));var moment=require(_0x7191('0x3'));var BPromise=require(_0x7191('0x4'));var rp=require(_0x7191('0x5'));var fs=require('fs');var path=require(_0x7191('0x6'));var rimraf=require(_0x7191('0x7'));var config=require(_0x7191('0x8'));var attributes=require(_0x7191('0x9'));module[_0x7191('0xa')]=function(_0x45ba3e,_0xb5f22f){return _0x45ba3e[_0x7191('0xb')](_0x7191('0xc'),attributes,{'tableName':_0x7191('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 001a7ea..cad11fa 100644 --- a/server/api/mailAccount/mailAccount.rpc.js +++ b/server/api/mailAccount/mailAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7b9=['model','map','GetMailAccount','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','updatedAt','DESC','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','priority','autoclose','push','close','*,*,*,*','Contacts','length','List\x20not\x20found','messageId','generate','subject','attach','format','MailInteraction','MailMessage','inReplyTo','create','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','Start','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','MailAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xe7b9,0x170));var _0x9e7b=function(_0x4978e1,_0x4f9d18){_0x4978e1=_0x4978e1-0x0;var _0x4f70e1=_0xe7b9[_0x4978e1];return _0x4f70e1;};'use strict';var _=require(_0x9e7b('0x0'));var util=require(_0x9e7b('0x1'));var moment=require(_0x9e7b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e7b('0x3'));var db=require(_0x9e7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e7b('0x5'));var config=require('../../config/environment');var jayson=require(_0x9e7b('0x6'));var client=jayson['client']['http']({'port':0x232c});config[_0x9e7b('0x7')]=_[_0x9e7b('0x8')](config[_0x9e7b('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e7b('0x9'))(new Redis(config[_0x9e7b('0x7')]));require(_0x9e7b('0xa'))[_0x9e7b('0xb')](socket);function respondWithRpcPromise(_0xc8bbba,_0x5cfbb5,_0x47b442){return new BPromise(function(_0x5a36ca,_0xe74d52){return client[_0x9e7b('0xc')](_0xc8bbba,_0x47b442)[_0x9e7b('0xd')](function(_0x30ee2a){logger[_0x9e7b('0xe')](_0x9e7b('0xf'),_0x5cfbb5,'request\x20sent');logger[_0x9e7b('0x10')](_0x9e7b('0x11'),_0x5cfbb5,_0x9e7b('0x12'),JSON[_0x9e7b('0x13')](_0x30ee2a));if(_0x30ee2a['error']){if(_0x30ee2a[_0x9e7b('0x14')]['code']===0x1f4){logger[_0x9e7b('0x14')](_0x9e7b('0xf'),_0x5cfbb5,_0x30ee2a['error']['message']);return _0xe74d52(_0x30ee2a[_0x9e7b('0x14')][_0x9e7b('0x15')]);}logger[_0x9e7b('0x14')]('MailAccount,\x20%s,\x20%s',_0x5cfbb5,_0x30ee2a[_0x9e7b('0x14')][_0x9e7b('0x15')]);return _0x5a36ca(_0x30ee2a[_0x9e7b('0x14')][_0x9e7b('0x15')]);}else{logger[_0x9e7b('0xe')](_0x9e7b('0xf'),_0x5cfbb5,'request\x20sent');_0x5a36ca(_0x30ee2a[_0x9e7b('0x16')][_0x9e7b('0x15')]);}})[_0x9e7b('0x17')](function(_0x451dff){logger[_0x9e7b('0x14')](_0x9e7b('0xf'),_0x5cfbb5,_0x451dff);_0xe74d52(_0x451dff);});});}exports['GetMailAccount']=function(_0x50913c){var _0x1d3c48=this;return new Promise(function(_0x2b4bf8,_0x5712c8){return db[_0x9e7b('0x18')][_0x9e7b('0x19')]({'raw':_0x50913c[_0x9e7b('0x1a')]?_0x50913c[_0x9e7b('0x1a')][_0x9e7b('0x1b')]===undefined?!![]:![]:!![],'where':_0x50913c[_0x9e7b('0x1a')]?_0x50913c[_0x9e7b('0x1a')][_0x9e7b('0x1c')]||null:null,'attributes':_0x50913c['options']?_0x50913c[_0x9e7b('0x1a')][_0x9e7b('0x1d')]||null:null,'limit':_0x50913c[_0x9e7b('0x1a')]?_0x50913c[_0x9e7b('0x1a')][_0x9e7b('0x1e')]||null:null,'include':_0x50913c[_0x9e7b('0x1a')]?_0x50913c[_0x9e7b('0x1a')]['include']?_['map'](_0x50913c[_0x9e7b('0x1a')][_0x9e7b('0x1f')],function(_0x38958a){return{'model':db[_0x38958a['model']],'as':_0x38958a['as'],'attributes':_0x38958a[_0x9e7b('0x1d')],'include':_0x38958a['include']?_['map'](_0x38958a[_0x9e7b('0x1f')],function(_0x17292c){return{'model':db[_0x17292c[_0x9e7b('0x20')]],'as':_0x17292c['as'],'attributes':_0x17292c[_0x9e7b('0x1d')],'include':_0x17292c[_0x9e7b('0x1f')]?_[_0x9e7b('0x21')](_0x17292c[_0x9e7b('0x1f')],function(_0x2d1ce2){return{'model':db[_0x2d1ce2[_0x9e7b('0x20')]],'as':_0x2d1ce2['as'],'attributes':_0x2d1ce2['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e7b('0xd')](function(_0x156dce){logger[_0x9e7b('0xe')](_0x9e7b('0x22'),_0x50913c);logger[_0x9e7b('0x10')](_0x9e7b('0x22'),_0x50913c,JSON['stringify'](_0x156dce));_0x2b4bf8(_0x156dce);})[_0x9e7b('0x17')](function(_0x55d7b1){logger[_0x9e7b('0x14')]('GetMailAccount',_0x55d7b1[_0x9e7b('0x15')],_0x50913c);_0x5712c8(_0x1d3c48[_0x9e7b('0x14')](0x1f4,_0x55d7b1['message']));});});};exports[_0x9e7b('0x23')]=function(_0x1b7494){var _0x5bce3d=this;return new Promise(function(_0x673839,_0x4d0bad){return db['MailAccount'][_0x9e7b('0x24')]({'raw':_0x1b7494[_0x9e7b('0x1a')]?_0x1b7494['options'][_0x9e7b('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b7494['options']?_0x1b7494['options'][_0x9e7b('0x1c')]||null:null,'attributes':_0x1b7494['options']?_0x1b7494[_0x9e7b('0x1a')][_0x9e7b('0x1d')]||null:null,'include':_0x1b7494[_0x9e7b('0x1a')]?_0x1b7494[_0x9e7b('0x1a')][_0x9e7b('0x1f')]?_[_0x9e7b('0x21')](_0x1b7494['options']['include'],function(_0x74e4f7){return{'model':db[_0x74e4f7[_0x9e7b('0x20')]],'as':_0x74e4f7['as'],'attributes':_0x74e4f7['attributes'],'include':_0x74e4f7[_0x9e7b('0x1f')]?_[_0x9e7b('0x21')](_0x74e4f7[_0x9e7b('0x1f')],function(_0x4dd5a7){return{'model':db[_0x4dd5a7[_0x9e7b('0x20')]],'as':_0x4dd5a7['as'],'attributes':_0x4dd5a7[_0x9e7b('0x1d')],'include':_0x4dd5a7[_0x9e7b('0x1f')]?_[_0x9e7b('0x21')](_0x4dd5a7[_0x9e7b('0x1f')],function(_0x444b9c){return{'model':db[_0x444b9c['model']],'as':_0x444b9c['as'],'attributes':_0x444b9c[_0x9e7b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9e7b('0xd')](function(_0x993c2){logger['info'](_0x9e7b('0x23'),_0x1b7494);logger['debug']('ShowMailAccount',_0x1b7494,JSON[_0x9e7b('0x13')](_0x993c2));_0x673839(_0x993c2);})[_0x9e7b('0x17')](function(_0x3ea977){logger[_0x9e7b('0x14')](_0x9e7b('0x23'),_0x3ea977[_0x9e7b('0x15')],_0x1b7494);_0x4d0bad(_0x5bce3d[_0x9e7b('0x14')](0x1f4,_0x3ea977[_0x9e7b('0x15')]));});});};exports[_0x9e7b('0x25')]=function(_0x48898f){var _0x5b6a45=this;return new Promise(function(_0x18a2d3,_0x4a263b){var _0x2768ac={'body':_0x48898f[_0x9e7b('0x26')],'channel':_0x9e7b('0x27')};var _0x30306e=_[_0x9e7b('0x28')](_[_0x9e7b('0x29')](db[_0x9e7b('0x2a')][_0x9e7b('0x2b')]),[_0x9e7b('0x2c'),'updatedAt',_0x9e7b('0x2d'),_0x9e7b('0x2e')]);var _0x23bb24=![];if(_0x48898f[_0x9e7b('0x26')]['id']){delete _0x48898f[_0x9e7b('0x26')]['id'];}if(_[_0x9e7b('0x2f')](_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x30')])){return _0x4a263b(_0x5b6a45[_0x9e7b('0x14')](0x1f4,_0x9e7b('0x31')));}if(_[_0x9e7b('0x2f')](_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x26')])||_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x26')]===''){return _0x4a263b(_0x5b6a45['error'](0x1f4,_0x9e7b('0x32')));}if(_[_0x9e7b('0x2f')](_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x33')])){return _0x4a263b(_0x5b6a45[_0x9e7b('0x14')](0x1f4,_0x9e7b('0x34')+_0x30306e));}if(!_[_0x9e7b('0x35')](_0x30306e,_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x33')])){return _0x4a263b(_0x5b6a45[_0x9e7b('0x14')](0x1f4,_0x9e7b('0x36')+_0x30306e));}var _0x179a0b={};_0x179a0b[_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x33')]]=_0x48898f['body'][_0x9e7b('0x30')];return db[_0x9e7b('0x18')][_0x9e7b('0x24')]({'where':{'id':_0x48898f[_0x9e7b('0x37')]['id']},'include':[{'model':db[_0x9e7b('0x38')],'as':_0x9e7b('0x39'),'include':[{'model':db[_0x9e7b('0x2a')],'as':'Contacts','where':_0x179a0b,'limit':0x1,'order':[[_0x9e7b('0x3a'),_0x9e7b('0x3b')]]}]},{'model':db['MailApplication'],'as':_0x9e7b('0x3c')},{'model':db[_0x9e7b('0x3d')],'as':_0x9e7b('0x3e')}]})[_0x9e7b('0xd')](function(_0x83ece7){if(_0x83ece7&&_0x83ece7[_0x9e7b('0x39')]){var _0x155158=_0x83ece7[_0x9e7b('0x3f')]({'plain':!![]});_0x2768ac[_0x9e7b('0x37')]=_[_0x9e7b('0x40')](_0x155158,[_0x9e7b('0x3c'),_0x9e7b('0x39')]);_0x2768ac[_0x9e7b('0x41')]=_0x155158[_0x9e7b('0x3c')];_0x2768ac[_0x9e7b('0x42')]=_0x155158[_0x9e7b('0x39')];_0x2768ac['applications']=_[_0x9e7b('0x43')](_0x2768ac['applications'],[_0x9e7b('0x44')],['asc']);if(_0x2768ac[_0x9e7b('0x37')]&&_0x2768ac[_0x9e7b('0x37')][_0x9e7b('0x45')]){_0x2768ac['applications'][_0x9e7b('0x46')]({'id':0x0,'priority':_0x2768ac[_0x9e7b('0x41')]['length']+0x1,'app':_0x9e7b('0x47'),'appdata':_0x9e7b('0x45'),'interval':_0x9e7b('0x48')});}if(_0x2768ac['account'][_0x9e7b('0x3c')]){delete _0x2768ac[_0x9e7b('0x37')][_0x9e7b('0x3c')];}if(_0x2768ac['account']['List']){delete _0x2768ac[_0x9e7b('0x37')]['List'];}if(_0x155158['List'][_0x9e7b('0x49')][_0x9e7b('0x4a')]){return _0x155158[_0x9e7b('0x39')][_0x9e7b('0x49')][0x0];}var _0x421694=_[_0x9e7b('0x8')](_0x48898f[_0x9e7b('0x26')],{'firstName':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x30')],'ListId':_0x155158['ListId']});_0x421694[_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x33')]]=_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x30')];return db['CmContact']['create'](_0x421694);}else{throw new Error(_0x9e7b('0x4b'));}})[_0x9e7b('0xd')](function(_0x7cc95f){_0x2768ac['contact']=_0x7cc95f;if(_0x7cc95f){if(!_0x48898f[_0x9e7b('0x26')]['message'][_0x9e7b('0x4c')]){_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')][_0x9e7b('0x4c')]=rs[_0x9e7b('0x4d')]()+'\x20'+_0x48898f[_0x9e7b('0x26')]['message']['from'];}var _0x47ae21={'ContactId':_0x7cc95f['id'],'MailAccountId':_0x48898f[_0x9e7b('0x37')]['id'],'inReplyTo':_0x48898f[_0x9e7b('0x26')]['message'][_0x9e7b('0x4c')],'to':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')][_0x9e7b('0x30')],'cc':_0x48898f[_0x9e7b('0x26')]['message']['cc'],'subject':_0x48898f['body'][_0x9e7b('0x15')][_0x9e7b('0x4e')],'attach':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')][_0x9e7b('0x4f')],'lastMsgAt':moment()[_0x9e7b('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x26')]};return db[_0x9e7b('0x51')][_0x9e7b('0x24')]({'where':{'closed':![],'MailAccountId':_0x48898f[_0x9e7b('0x37')]['id']},'include':[{'model':db[_0x9e7b('0x52')],'as':'Messages','attributes':[_0x9e7b('0x4c')],'where':{'messageId':_0x48898f[_0x9e7b('0x26')]['message'][_0x9e7b('0x53')]}}]})['then'](function(_0x201068){if(_0x201068){return[_0x201068,![]];}return db[_0x9e7b('0x51')][_0x9e7b('0x54')](_0x47ae21)[_0x9e7b('0xd')](function(_0x96dc3){return[_0x96dc3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9e7b('0x55')](function(_0x2e10b7,_0x5e4eb1){if(_0x2e10b7){_0x23bb24=_0x5e4eb1;if(!_0x5e4eb1){return _0x2e10b7['update']({'inReplyTo':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')][_0x9e7b('0x4c')],'to':_0x48898f['body'][_0x9e7b('0x15')][_0x9e7b('0x30')],'cc':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')]['cc'],'subject':_0x48898f['body'][_0x9e7b('0x15')][_0x9e7b('0x4e')],'attach':_0x2e10b7[_0x9e7b('0x4f')]?_0x2e10b7[_0x9e7b('0x4f')]:_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')][_0x9e7b('0x4f')],'substatus':null,'substatusAt':moment()[_0x9e7b('0x50')](_0x9e7b('0x56')),'lastMsgAt':moment()['format'](_0x9e7b('0x56')),'lastMsgDirection':'in','lastMsgBody':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x26')]});}else{return _0x2e10b7;}}})[_0x9e7b('0xd')](function(_0x39731c){_0x2768ac[_0x9e7b('0x57')]=_0x39731c[_0x9e7b('0x3f')]({'plain':!![]});_0x2768ac[_0x9e7b('0x57')][_0x9e7b('0x58')]=_0x23bb24;return db[_0x9e7b('0x52')][_0x9e7b('0x54')]({'body':_0x48898f['body'][_0x9e7b('0x26')],'MailAccountId':_0x48898f[_0x9e7b('0x37')]['id'],'MailInteractionId':_0x39731c['id'],'direction':'in','ContactId':_0x2768ac[_0x9e7b('0x59')]['id'],'messageId':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')][_0x9e7b('0x4c')],'from':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')]['from'],'to':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')]['to'],'cc':_0x48898f[_0x9e7b('0x26')]['message']['cc'],'subject':_0x48898f['body'][_0x9e7b('0x15')][_0x9e7b('0x4e')],'attach':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')][_0x9e7b('0x4f')],'Attachments':_0x48898f['body']['message'][_0x9e7b('0x5a')],'originTo':_0x48898f[_0x9e7b('0x26')]['message'][_0x9e7b('0x5b')],'originCc':_0x48898f['body'][_0x9e7b('0x15')][_0x9e7b('0x5c')],'bcc':_0x48898f[_0x9e7b('0x26')][_0x9e7b('0x15')][_0x9e7b('0x5d')]},{'include':[{'model':db[_0x9e7b('0x5e')],'as':_0x9e7b('0x5f')}]});})[_0x9e7b('0xd')](function(_0x4ffd53){_0x2768ac[_0x9e7b('0x15')]=_0x4ffd53;if(_0x2768ac['interaction'][_0x9e7b('0x60')]){return db[_0x9e7b('0x61')][_0x9e7b('0x24')]({'attributes':['id',_0x9e7b('0x62')],'where':{'id':_0x2768ac['interaction'][_0x9e7b('0x60')]}})[_0x9e7b('0xd')](function(_0x864a45){if(_0x864a45){_0x2768ac[_0x9e7b('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x864a45[_0x9e7b('0x62')]+','+(_0x2768ac['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9e7b('0x63'),'startRouting',_0x2768ac);});}return respondWithRpcPromise('Start','startRouting',_0x2768ac);})[_0x9e7b('0xd')](function(_0x454755){_0x18a2d3(_0x454755);})[_0x9e7b('0x17')](function(_0x3ad892){_0x4a263b(_0x5b6a45[_0x9e7b('0x14')](0x1f4,_0x3ad892[_0x9e7b('0x15')]));});});}; \ No newline at end of file +var _0x292b=['startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailAccount','findAll','options','raw','attributes','limit','include','map','model','MailAccount','find','ShowMailAccount','NotifyMailAccount','body','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','MailServerOut','Smtp','get','omit','Applications','applications','orderBy','asc','autoclose','push','length','*,*,*,*','Contacts','create','contact','messageId','generate','format','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','subject','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','originCc','bcc','Attachment','UserId','name','agent','Start'];(function(_0x1317a6,_0x2efc56){var _0x3694d0=function(_0x3c9112){while(--_0x3c9112){_0x1317a6['push'](_0x1317a6['shift']());}};_0x3694d0(++_0x2efc56);}(_0x292b,0x64));var _0xb292=function(_0x2c5d4d,_0x1d4d5e){_0x2c5d4d=_0x2c5d4d-0x0;var _0x14dfe0=_0x292b[_0x2c5d4d];return _0x14dfe0;};'use strict';var _=require(_0xb292('0x0'));var util=require(_0xb292('0x1'));var moment=require(_0xb292('0x2'));var BPromise=require(_0xb292('0x3'));var rs=require(_0xb292('0x4'));var fs=require('fs');var Redis=require(_0xb292('0x5'));var db=require(_0xb292('0x6'))['db'];var utils=require(_0xb292('0x7'));var logger=require(_0xb292('0x8'))(_0xb292('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb292('0xa')]({'port':0x232c});config[_0xb292('0xb')]=_[_0xb292('0xc')](config['redis'],{'host':_0xb292('0xd'),'port':0x18eb});var socket=require(_0xb292('0xe'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xb292('0xf')](socket);function respondWithRpcPromise(_0xa30857,_0x36be8a,_0x5b4b7a){return new BPromise(function(_0x36517c,_0x3e4ac2){return client[_0xb292('0x10')](_0xa30857,_0x5b4b7a)[_0xb292('0x11')](function(_0x537d8b){logger[_0xb292('0x12')](_0xb292('0x13'),_0x36be8a,_0xb292('0x14'));logger[_0xb292('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x36be8a,_0xb292('0x14'),JSON[_0xb292('0x16')](_0x537d8b));if(_0x537d8b['error']){if(_0x537d8b['error']['code']===0x1f4){logger[_0xb292('0x17')](_0xb292('0x13'),_0x36be8a,_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);return _0x3e4ac2(_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);}logger[_0xb292('0x17')]('MailAccount,\x20%s,\x20%s',_0x36be8a,_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);return _0x36517c(_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);}else{logger[_0xb292('0x12')](_0xb292('0x13'),_0x36be8a,'request\x20sent');_0x36517c(_0x537d8b[_0xb292('0x19')][_0xb292('0x18')]);}})[_0xb292('0x1a')](function(_0x3ad738){logger[_0xb292('0x17')](_0xb292('0x13'),_0x36be8a,_0x3ad738);_0x3e4ac2(_0x3ad738);});});}exports[_0xb292('0x1b')]=function(_0x50e400){var _0x3a56eb=this;return new Promise(function(_0x336785,_0x4437d6){return db['MailAccount'][_0xb292('0x1c')]({'raw':_0x50e400[_0xb292('0x1d')]?_0x50e400['options'][_0xb292('0x1e')]===undefined?!![]:![]:!![],'where':_0x50e400['options']?_0x50e400[_0xb292('0x1d')]['where']||null:null,'attributes':_0x50e400[_0xb292('0x1d')]?_0x50e400['options'][_0xb292('0x1f')]||null:null,'limit':_0x50e400['options']?_0x50e400[_0xb292('0x1d')][_0xb292('0x20')]||null:null,'include':_0x50e400[_0xb292('0x1d')]?_0x50e400[_0xb292('0x1d')][_0xb292('0x21')]?_[_0xb292('0x22')](_0x50e400['options']['include'],function(_0x5537ee){return{'model':db[_0x5537ee['model']],'as':_0x5537ee['as'],'attributes':_0x5537ee[_0xb292('0x1f')],'include':_0x5537ee[_0xb292('0x21')]?_[_0xb292('0x22')](_0x5537ee['include'],function(_0x4a1575){return{'model':db[_0x4a1575[_0xb292('0x23')]],'as':_0x4a1575['as'],'attributes':_0x4a1575[_0xb292('0x1f')],'include':_0x4a1575['include']?_['map'](_0x4a1575[_0xb292('0x21')],function(_0xde939c){return{'model':db[_0xde939c[_0xb292('0x23')]],'as':_0xde939c['as'],'attributes':_0xde939c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb292('0x11')](function(_0x5e5a29){logger[_0xb292('0x12')](_0xb292('0x1b'),_0x50e400);logger[_0xb292('0x15')](_0xb292('0x1b'),_0x50e400,JSON[_0xb292('0x16')](_0x5e5a29));_0x336785(_0x5e5a29);})[_0xb292('0x1a')](function(_0xe01a3b){logger['error'](_0xb292('0x1b'),_0xe01a3b[_0xb292('0x18')],_0x50e400);_0x4437d6(_0x3a56eb[_0xb292('0x17')](0x1f4,_0xe01a3b[_0xb292('0x18')]));});});};exports['ShowMailAccount']=function(_0x234fdc){var _0x110384=this;return new Promise(function(_0x444dc0,_0x33b8cf){return db[_0xb292('0x24')][_0xb292('0x25')]({'raw':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')][_0xb292('0x1e')]===undefined?!![]:![]:!![],'where':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')]['where']||null:null,'attributes':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')][_0xb292('0x1f')]||null:null,'include':_0x234fdc[_0xb292('0x1d')]?_0x234fdc['options']['include']?_[_0xb292('0x22')](_0x234fdc[_0xb292('0x1d')][_0xb292('0x21')],function(_0x7c58e3){return{'model':db[_0x7c58e3['model']],'as':_0x7c58e3['as'],'attributes':_0x7c58e3['attributes'],'include':_0x7c58e3[_0xb292('0x21')]?_[_0xb292('0x22')](_0x7c58e3[_0xb292('0x21')],function(_0xd1f9ae){return{'model':db[_0xd1f9ae[_0xb292('0x23')]],'as':_0xd1f9ae['as'],'attributes':_0xd1f9ae['attributes'],'include':_0xd1f9ae[_0xb292('0x21')]?_[_0xb292('0x22')](_0xd1f9ae[_0xb292('0x21')],function(_0x335d9c){return{'model':db[_0x335d9c[_0xb292('0x23')]],'as':_0x335d9c['as'],'attributes':_0x335d9c[_0xb292('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb292('0x11')](function(_0x1907e1){logger[_0xb292('0x12')](_0xb292('0x26'),_0x234fdc);logger[_0xb292('0x15')](_0xb292('0x26'),_0x234fdc,JSON[_0xb292('0x16')](_0x1907e1));_0x444dc0(_0x1907e1);})['catch'](function(_0x40d82c){logger[_0xb292('0x17')](_0xb292('0x26'),_0x40d82c[_0xb292('0x18')],_0x234fdc);_0x33b8cf(_0x110384[_0xb292('0x17')](0x1f4,_0x40d82c['message']));});});};exports[_0xb292('0x27')]=function(_0x4eb807){var _0x248bfb=this;return new Promise(function(_0x298cf3,_0x5ebccb){var _0x26c92b={'body':_0x4eb807[_0xb292('0x28')],'channel':'mail'};var _0x17e452=_[_0xb292('0x29')](_['keys'](db[_0xb292('0x2a')][_0xb292('0x2b')]),[_0xb292('0x2c'),_0xb292('0x2d'),_0xb292('0x2e'),_0xb292('0x2f')]);var _0x4e3431=![];if(_0x4eb807[_0xb292('0x28')]['id']){delete _0x4eb807[_0xb292('0x28')]['id'];}if(_['isNil'](_0x4eb807[_0xb292('0x28')][_0xb292('0x30')])){return _0x5ebccb(_0x248bfb['error'](0x1f4,_0xb292('0x31')));}if(_[_0xb292('0x32')](_0x4eb807[_0xb292('0x28')][_0xb292('0x28')])||_0x4eb807[_0xb292('0x28')][_0xb292('0x28')]===''){return _0x5ebccb(_0x248bfb['error'](0x1f4,_0xb292('0x33')));}if(_[_0xb292('0x32')](_0x4eb807[_0xb292('0x28')][_0xb292('0x34')])){return _0x5ebccb(_0x248bfb[_0xb292('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17e452));}if(!_[_0xb292('0x35')](_0x17e452,_0x4eb807[_0xb292('0x28')][_0xb292('0x34')])){return _0x5ebccb(_0x248bfb['error'](0x1f4,_0xb292('0x36')+_0x17e452));}var _0x373fff={};_0x373fff[_0x4eb807[_0xb292('0x28')][_0xb292('0x34')]]=_0x4eb807[_0xb292('0x28')][_0xb292('0x30')];return db[_0xb292('0x24')][_0xb292('0x25')]({'where':{'id':_0x4eb807[_0xb292('0x37')]['id']},'include':[{'model':db[_0xb292('0x38')],'as':_0xb292('0x39'),'include':[{'model':db[_0xb292('0x2a')],'as':'Contacts','where':_0x373fff,'limit':0x1,'order':[['updatedAt',_0xb292('0x3a')]]}]},{'model':db[_0xb292('0x3b')],'as':'Applications'},{'model':db[_0xb292('0x3c')],'as':_0xb292('0x3d')}]})[_0xb292('0x11')](function(_0x12f32f){if(_0x12f32f&&_0x12f32f[_0xb292('0x39')]){var _0x10bdd3=_0x12f32f[_0xb292('0x3e')]({'plain':!![]});_0x26c92b[_0xb292('0x37')]=_[_0xb292('0x3f')](_0x10bdd3,[_0xb292('0x40'),_0xb292('0x39')]);_0x26c92b['applications']=_0x10bdd3[_0xb292('0x40')];_0x26c92b['list']=_0x10bdd3['List'];_0x26c92b[_0xb292('0x41')]=_[_0xb292('0x42')](_0x26c92b['applications'],['priority'],[_0xb292('0x43')]);if(_0x26c92b['account']&&_0x26c92b[_0xb292('0x37')][_0xb292('0x44')]){_0x26c92b['applications'][_0xb292('0x45')]({'id':0x0,'priority':_0x26c92b[_0xb292('0x41')][_0xb292('0x46')]+0x1,'app':'close','appdata':_0xb292('0x44'),'interval':_0xb292('0x47')});}if(_0x26c92b[_0xb292('0x37')][_0xb292('0x40')]){delete _0x26c92b[_0xb292('0x37')][_0xb292('0x40')];}if(_0x26c92b[_0xb292('0x37')][_0xb292('0x39')]){delete _0x26c92b[_0xb292('0x37')][_0xb292('0x39')];}if(_0x10bdd3['List'][_0xb292('0x48')]['length']){return _0x10bdd3[_0xb292('0x39')][_0xb292('0x48')][0x0];}var _0x4bb50f=_[_0xb292('0xc')](_0x4eb807[_0xb292('0x28')],{'firstName':_0x4eb807[_0xb292('0x28')][_0xb292('0x30')],'ListId':_0x10bdd3[_0xb292('0x2f')]});_0x4bb50f[_0x4eb807[_0xb292('0x28')][_0xb292('0x34')]]=_0x4eb807[_0xb292('0x28')][_0xb292('0x30')];return db[_0xb292('0x2a')][_0xb292('0x49')](_0x4bb50f);}else{throw new Error('List\x20not\x20found');}})[_0xb292('0x11')](function(_0x3eaa51){_0x26c92b[_0xb292('0x4a')]=_0x3eaa51;if(_0x3eaa51){if(!_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x4b')]){_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x4b')]=rs[_0xb292('0x4c')]()+'\x20'+_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x30')];}var _0x2bd934={'ContactId':_0x3eaa51['id'],'MailAccountId':_0x4eb807['account']['id'],'inReplyTo':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x4b')],'to':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x30')],'cc':_0x4eb807[_0xb292('0x28')]['message']['cc'],'subject':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['subject'],'attach':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['attach'],'lastMsgAt':moment()[_0xb292('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x4eb807[_0xb292('0x28')]['body']};return db[_0xb292('0x4e')][_0xb292('0x25')]({'where':{'closed':![],'MailAccountId':_0x4eb807[_0xb292('0x37')]['id']},'include':[{'model':db[_0xb292('0x4f')],'as':_0xb292('0x50'),'attributes':['messageId'],'where':{'messageId':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x51')]}}]})['then'](function(_0x28edc0){if(_0x28edc0){return[_0x28edc0,![]];}return db['MailInteraction']['create'](_0x2bd934)['then'](function(_0x5c5f6d){return[_0x5c5f6d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb292('0x52')](function(_0x38eb01,_0x196e8c){if(_0x38eb01){_0x4e3431=_0x196e8c;if(!_0x196e8c){return _0x38eb01[_0xb292('0x53')]({'inReplyTo':_0x4eb807['body']['message'][_0xb292('0x4b')],'to':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x30')],'cc':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['cc'],'subject':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x54')],'attach':_0x38eb01[_0xb292('0x55')]?_0x38eb01['attach']:_0x4eb807['body'][_0xb292('0x18')][_0xb292('0x55')],'substatus':null,'substatusAt':moment()['format'](_0xb292('0x56')),'lastMsgAt':moment()[_0xb292('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x4eb807[_0xb292('0x28')][_0xb292('0x28')]});}else{return _0x38eb01;}}})[_0xb292('0x11')](function(_0x5e6620){_0x26c92b[_0xb292('0x57')]=_0x5e6620[_0xb292('0x3e')]({'plain':!![]});_0x26c92b[_0xb292('0x57')][_0xb292('0x58')]=_0x4e3431;return db['MailMessage'][_0xb292('0x49')]({'body':_0x4eb807['body'][_0xb292('0x28')],'MailAccountId':_0x4eb807['account']['id'],'MailInteractionId':_0x5e6620['id'],'direction':'in','ContactId':_0x26c92b[_0xb292('0x4a')]['id'],'messageId':_0x4eb807[_0xb292('0x28')]['message'][_0xb292('0x4b')],'from':_0x4eb807['body'][_0xb292('0x18')][_0xb292('0x30')],'to':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['to'],'cc':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['cc'],'subject':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x54')],'attach':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['attach'],'Attachments':_0x4eb807['body']['message'][_0xb292('0x59')],'originTo':_0x4eb807[_0xb292('0x28')]['message'][_0xb292('0x5a')],'originCc':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x5b')],'bcc':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x5c')]},{'include':[{'model':db[_0xb292('0x5d')],'as':'Attachments'}]});})['then'](function(_0x3e5e8f){_0x26c92b[_0xb292('0x18')]=_0x3e5e8f;if(_0x26c92b[_0xb292('0x57')][_0xb292('0x5e')]){return db['User'][_0xb292('0x25')]({'attributes':['id',_0xb292('0x5f')],'where':{'id':_0x26c92b[_0xb292('0x57')][_0xb292('0x5e')]}})[_0xb292('0x11')](function(_0x25a5f9){if(_0x25a5f9){_0x26c92b[_0xb292('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb292('0x60'),'appdata':_0x25a5f9[_0xb292('0x5f')]+','+(_0x26c92b[_0xb292('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0xb292('0x47')});}return respondWithRpcPromise(_0xb292('0x61'),_0xb292('0x62'),_0x26c92b);});}return respondWithRpcPromise(_0xb292('0x61'),_0xb292('0x62'),_0x26c92b);})[_0xb292('0x11')](function(_0x245d67){_0x298cf3(_0x245d67);})[_0xb292('0x1a')](function(_0xc32b0c){_0x5ebccb(_0x248bfb['error'](0x1f4,_0xc32b0c[_0xb292('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 81d9745..2c5f552 100644 --- a/server/api/mailAccount/mailAccount.socket.js +++ b/server/api/mailAccount/mailAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17c4=['save','remove','update','emit','removeListener','length','./mailAccount.events'];(function(_0x4eab42,_0x2f51f0){var _0x4e023a=function(_0x2e123f){while(--_0x2e123f){_0x4eab42['push'](_0x4eab42['shift']());}};_0x4e023a(++_0x2f51f0);}(_0x17c4,0x102));var _0x417c=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x17c4[_0x2d0d9f];return _0x30243d;};'use strict';var MailAccountEvents=require(_0x417c('0x0'));var events=[_0x417c('0x1'),_0x417c('0x2'),_0x417c('0x3')];function createListener(_0x2f1975,_0x2e9ccf){return function(_0x6579e5){_0x2e9ccf[_0x417c('0x4')](_0x2f1975,_0x6579e5);};}function removeListener(_0x212ac0,_0x413ee5){return function(){MailAccountEvents[_0x417c('0x5')](_0x212ac0,_0x413ee5);};}exports['register']=function(_0x24e681){for(var _0x117c5d=0x0,_0x340095=events[_0x417c('0x6')];_0x117c5d<_0x340095;_0x117c5d++){var _0x1106df=events[_0x117c5d];var _0x4c6534=createListener('mailAccount:'+_0x1106df,_0x24e681);MailAccountEvents['on'](_0x1106df,_0x4c6534);}}; \ No newline at end of file +var _0xecb2=['mailAccount:','./mailAccount.events','update','emit','removeListener','register','length'];(function(_0x1dcad2,_0x28e38d){var _0x577a0c=function(_0x36192c){while(--_0x36192c){_0x1dcad2['push'](_0x1dcad2['shift']());}};_0x577a0c(++_0x28e38d);}(_0xecb2,0xf6));var _0x2ecb=function(_0x5c92fb,_0x4e9d67){_0x5c92fb=_0x5c92fb-0x0;var _0x5d9534=_0xecb2[_0x5c92fb];return _0x5d9534;};'use strict';var MailAccountEvents=require(_0x2ecb('0x0'));var events=['save','remove',_0x2ecb('0x1')];function createListener(_0x548b3c,_0x59d894){return function(_0x1bb230){_0x59d894[_0x2ecb('0x2')](_0x548b3c,_0x1bb230);};}function removeListener(_0x393e7c,_0x2a4fe5){return function(){MailAccountEvents[_0x2ecb('0x3')](_0x393e7c,_0x2a4fe5);};}exports[_0x2ecb('0x4')]=function(_0x4c169f){for(var _0x51b28c=0x0,_0x49de99=events[_0x2ecb('0x5')];_0x51b28c<_0x49de99;_0x51b28c++){var _0x3df4a0=events[_0x51b28c];var _0x15a959=createListener(_0x2ecb('0x6')+_0x3df4a0,_0x4c169f);MailAccountEvents['on'](_0x3df4a0,_0x15a959);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 703cd7c..ec762aa 100644 --- a/server/api/mailApplication/index.js +++ b/server/api/mailApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c76=['Router','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1f6731,_0xae4ce){var _0x1c1686=function(_0x552b04){while(--_0x552b04){_0x1f6731['push'](_0x1f6731['shift']());}};_0x1c1686(++_0xae4ce);}(_0x6c76,0x184));var _0x66c7=function(_0x21291a,_0x48d2fb){_0x21291a=_0x21291a-0x0;var _0x508d6f=_0x6c76[_0x21291a];return _0x508d6f;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x66c7('0x5'));var controller=require(_0x66c7('0x6'));router['get'](_0x66c7('0x7'),auth[_0x66c7('0x8')](),controller['show']);router[_0x66c7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x66c7('0xa')]);router[_0x66c7('0xb')](_0x66c7('0x7'),auth['isAuthenticated'](),controller[_0x66c7('0xc')]);module[_0x66c7('0xd')]=router; \ No newline at end of file +var _0xb688=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','exports','util'];(function(_0x530a62,_0xc626e){var _0x3163b4=function(_0x24f8ee){while(--_0x24f8ee){_0x530a62['push'](_0x530a62['shift']());}};_0x3163b4(++_0xc626e);}(_0xb688,0xcf));var _0x8b68=function(_0xb5f7a,_0x4314af){_0xb5f7a=_0xb5f7a-0x0;var _0x1ee16b=_0xb688[_0xb5f7a];return _0x1ee16b;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')](_0x8b68('0x9'),auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['put'](_0x8b68('0x9'),auth[_0x8b68('0xb')](),controller[_0x8b68('0xc')]);router[_0x8b68('0xd')](_0x8b68('0x9'),auth[_0x8b68('0xb')](),controller[_0x8b68('0xe')]);module[_0x8b68('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 3a61e0c..494be6b 100644 --- a/server/api/mailApplication/mailApplication.attributes.js +++ b/server/api/mailApplication/mailApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x835d=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x26b4db,_0x92494c){var _0x57ae15=function(_0x58111e){while(--_0x58111e){_0x26b4db['push'](_0x26b4db['shift']());}};_0x57ae15(++_0x92494c);}(_0x835d,0x103));var _0xd835=function(_0x50ed7a,_0x45b3e6){_0x50ed7a=_0x50ed7a-0x0;var _0x4ac477=_0x835d[_0x50ed7a];return _0x4ac477;};'use strict';var Sequelize=require(_0xd835('0x0'));module[_0xd835('0x1')]={'priority':{'type':Sequelize[_0xd835('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd835('0x3')],'allowNull':![],'defaultValue':_0xd835('0x4')},'appdata':{'type':Sequelize[_0xd835('0x5')]()},'description':{'type':Sequelize[_0xd835('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8994=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2ce2b3,_0x272f46){var _0x2e9e2d=function(_0xa7ad76){while(--_0xa7ad76){_0x2ce2b3['push'](_0x2ce2b3['shift']());}};_0x2e9e2d(++_0x272f46);}(_0x8994,0x73));var _0x4899=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8994[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x4899('0x0'));module[_0x4899('0x1')]={'priority':{'type':Sequelize[_0x4899('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4899('0x3')],'allowNull':![],'defaultValue':_0x4899('0x4')},'appdata':{'type':Sequelize[_0x4899('0x5')]()},'description':{'type':Sequelize[_0x4899('0x3')]},'interval':{'type':Sequelize[_0x4899('0x3')],'defaultValue':_0x4899('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index bad8275..1608c76 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22cc=['limit','set','json','apply','update','then','status','error','stack','name','send','show','model','keys','MailApplication','rawAttributes','filters','query','attributes','intersection','fields','includeAll','include','merge','options','catch','body','find','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','count','offset'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x22cc,0x90));var _0xc22c=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0x22cc[_0x1b8b95];return _0x3657ae;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc22c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc22c('0x1'));var jsonpatch=require(_0xc22c('0x2'));var rp=require(_0xc22c('0x3'));var moment=require(_0xc22c('0x4'));var BPromise=require(_0xc22c('0x5'));var Mustache=require('mustache');var util=require(_0xc22c('0x6'));var path=require(_0xc22c('0x7'));var sox=require(_0xc22c('0x8'));var csv=require(_0xc22c('0x9'));var ejs=require(_0xc22c('0xa'));var fs=require('fs');var _=require(_0xc22c('0xb'));var squel=require('squel');var crypto=require(_0xc22c('0xc'));var jsforce=require(_0xc22c('0xd'));var deskjs=require(_0xc22c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc22c('0xf'));var Papa=require(_0xc22c('0x10'));var Redis=require('ioredis');var authService=require(_0xc22c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc22c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc22c('0x13'))(_0xc22c('0x14'));var utils=require(_0xc22c('0x15'));var config=require(_0xc22c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc22c('0x17'))['db'];function respondWithStatusCode(_0x3e2dac,_0x103159){_0x103159=_0x103159||0xcc;return function(_0xcf8392){if(_0xcf8392){return _0x3e2dac[_0xc22c('0x18')](_0x103159);}return _0x3e2dac['status'](_0x103159)['end']();};}function respondWithResult(_0x28bde5,_0x3093a9){_0x3093a9=_0x3093a9||0xc8;return function(_0x5030c8){if(_0x5030c8){return _0x28bde5['status'](_0x3093a9)['json'](_0x5030c8);}};}function respondWithFilteredResult(_0x10df37,_0x5bd7ed){return function(_0xee76f4){if(_0xee76f4){var _0x218874=_0xee76f4[_0xc22c('0x19')],_0x168bb3=_0x5bd7ed['offset'],_0x252e84=_0x5bd7ed[_0xc22c('0x1a')]+_0x5bd7ed[_0xc22c('0x1b')],_0x2b6a7f;if(_0x252e84>=_0x218874){_0x252e84=_0x218874;_0x2b6a7f=0xc8;}else{_0x2b6a7f=0xce;}_0x10df37['status'](_0x2b6a7f);return _0x10df37[_0xc22c('0x1c')]('Content-Range',_0x168bb3+'-'+_0x252e84+'/'+_0x218874)[_0xc22c('0x1d')](_0xee76f4);}return null;};}function patchUpdates(_0x43c904){return function(_0x5d4f26){try{jsonpatch[_0xc22c('0x1e')](_0x5d4f26,_0x43c904,!![]);}catch(_0x49e8f4){return BPromise['reject'](_0x49e8f4);}return _0x5d4f26['save']();};}function saveUpdates(_0xa50f35,_0x196794){return function(_0x395fb2){if(_0x395fb2){return _0x395fb2[_0xc22c('0x1f')](_0xa50f35)[_0xc22c('0x20')](function(_0x23e5cb){return _0x23e5cb;});}return null;};}function removeEntity(_0xe8c6e4,_0x5852c9){return function(_0xd9f80b){if(_0xd9f80b){return _0xd9f80b['destroy']()[_0xc22c('0x20')](function(){_0xe8c6e4[_0xc22c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x409c06,_0x3e45e8){return function(_0xcbec8c){if(!_0xcbec8c){_0x409c06['sendStatus'](0x194);}return _0xcbec8c;};}function handleError(_0x352e50,_0x462cb6){_0x462cb6=_0x462cb6||0x1f4;return function(_0x192c07){logger[_0xc22c('0x22')](_0x192c07[_0xc22c('0x23')]);if(_0x192c07[_0xc22c('0x24')]){delete _0x192c07[_0xc22c('0x24')];}_0x352e50[_0xc22c('0x21')](_0x462cb6)[_0xc22c('0x25')](_0x192c07);};}exports[_0xc22c('0x26')]=function(_0x2600dc,_0x4532a5){var _0x43302e={'raw':!![],'where':{'id':_0x2600dc['params']['id']}},_0x3164fd={};_0x3164fd[_0xc22c('0x27')]=_[_0xc22c('0x28')](db[_0xc22c('0x29')][_0xc22c('0x2a')]);_0x3164fd['query']=_['keys'](_0x2600dc['query']);_0x3164fd[_0xc22c('0x2b')]=_['intersection'](_0x3164fd[_0xc22c('0x27')],_0x3164fd[_0xc22c('0x2c')]);_0x43302e[_0xc22c('0x2d')]=_[_0xc22c('0x2e')](_0x3164fd[_0xc22c('0x27')],qs[_0xc22c('0x2f')](_0x2600dc['query'][_0xc22c('0x2f')]));_0x43302e[_0xc22c('0x2d')]=_0x43302e[_0xc22c('0x2d')]['length']?_0x43302e['attributes']:_0x3164fd[_0xc22c('0x27')];if(_0x2600dc[_0xc22c('0x2c')][_0xc22c('0x30')]){_0x43302e[_0xc22c('0x31')]=[{'all':!![]}];}_0x43302e=_[_0xc22c('0x32')]({},_0x43302e,_0x2600dc[_0xc22c('0x33')]);return db[_0xc22c('0x29')]['find'](_0x43302e)[_0xc22c('0x20')](handleEntityNotFound(_0x4532a5,null))['then'](respondWithResult(_0x4532a5,null))[_0xc22c('0x34')](handleError(_0x4532a5,null));};exports['update']=function(_0xadcd8f,_0x51db20){if(_0xadcd8f[_0xc22c('0x35')]['id']){delete _0xadcd8f[_0xc22c('0x35')]['id'];}return db[_0xc22c('0x29')][_0xc22c('0x36')]({'where':{'id':_0xadcd8f[_0xc22c('0x37')]['id']}})[_0xc22c('0x20')](handleEntityNotFound(_0x51db20,null))[_0xc22c('0x20')](saveUpdates(_0xadcd8f[_0xc22c('0x35')],null))[_0xc22c('0x20')](respondWithResult(_0x51db20,null))[_0xc22c('0x34')](handleError(_0x51db20,null));};exports[_0xc22c('0x38')]=function(_0x18eb81,_0x38cec7){return db[_0xc22c('0x29')][_0xc22c('0x36')]({'where':{'id':_0x18eb81['params']['id']}})[_0xc22c('0x20')](handleEntityNotFound(_0x38cec7,null))[_0xc22c('0x20')](removeEntity(_0x38cec7,null))[_0xc22c('0x34')](handleError(_0x38cec7,null));}; \ No newline at end of file +var _0xc991=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','html-pdf','eml-format'];(function(_0x58b549,_0x2640b3){var _0x56b383=function(_0x1eb438){while(--_0x1eb438){_0x58b549['push'](_0x58b549['shift']());}};_0x56b383(++_0x2640b3);}(_0xc991,0x13e));var _0x1c99=function(_0x47c7e2,_0x7a1685){_0x47c7e2=_0x47c7e2-0x0;var _0x52139f=_0xc991[_0x47c7e2];return _0x52139f;};'use strict';var pdf=require(_0x1c99('0x0'));var emlformat=require(_0x1c99('0x1'));var rimraf=require(_0x1c99('0x2'));var zipdir=require(_0x1c99('0x3'));var jsonpatch=require(_0x1c99('0x4'));var rp=require(_0x1c99('0x5'));var moment=require(_0x1c99('0x6'));var BPromise=require(_0x1c99('0x7'));var Mustache=require(_0x1c99('0x8'));var util=require('util');var path=require(_0x1c99('0x9'));var sox=require(_0x1c99('0xa'));var csv=require(_0x1c99('0xb'));var ejs=require(_0x1c99('0xc'));var fs=require('fs');var _=require(_0x1c99('0xd'));var squel=require(_0x1c99('0xe'));var crypto=require(_0x1c99('0xf'));var jsforce=require(_0x1c99('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1c99('0xb'));var querystring=require('querystring');var Papa=require(_0x1c99('0x11'));var Redis=require(_0x1c99('0x12'));var authService=require(_0x1c99('0x13'));var qs=require(_0x1c99('0x14'));var as=require(_0x1c99('0x15'));var hardwareService=require(_0x1c99('0x16'));var logger=require(_0x1c99('0x17'))(_0x1c99('0x18'));var utils=require(_0x1c99('0x19'));var config=require(_0x1c99('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c99('0x1b'))['db'];function respondWithStatusCode(_0x2cae03,_0x27bf4b){_0x27bf4b=_0x27bf4b||0xcc;return function(_0x5cd076){if(_0x5cd076){return _0x2cae03[_0x1c99('0x1c')](_0x27bf4b);}return _0x2cae03[_0x1c99('0x1d')](_0x27bf4b)[_0x1c99('0x1e')]();};}function respondWithResult(_0x332383,_0x395c39){_0x395c39=_0x395c39||0xc8;return function(_0xc45e08){if(_0xc45e08){return _0x332383[_0x1c99('0x1d')](_0x395c39)[_0x1c99('0x1f')](_0xc45e08);}};}function respondWithFilteredResult(_0x2a8a7f,_0x125b86){return function(_0x707cbc){if(_0x707cbc){var _0x41db00=_0x707cbc[_0x1c99('0x20')],_0x53fc83=_0x125b86[_0x1c99('0x21')],_0x24d179=_0x125b86['offset']+_0x125b86['limit'],_0x279667;if(_0x24d179>=_0x41db00){_0x24d179=_0x41db00;_0x279667=0xc8;}else{_0x279667=0xce;}_0x2a8a7f['status'](_0x279667);return _0x2a8a7f[_0x1c99('0x22')](_0x1c99('0x23'),_0x53fc83+'-'+_0x24d179+'/'+_0x41db00)['json'](_0x707cbc);}return null;};}function patchUpdates(_0x5028e4){return function(_0x25b1b9){try{jsonpatch[_0x1c99('0x24')](_0x25b1b9,_0x5028e4,!![]);}catch(_0x4443a8){return BPromise[_0x1c99('0x25')](_0x4443a8);}return _0x25b1b9[_0x1c99('0x26')]();};}function saveUpdates(_0x1ff9b7,_0x18246e){return function(_0x4d8428){if(_0x4d8428){return _0x4d8428[_0x1c99('0x27')](_0x1ff9b7)[_0x1c99('0x28')](function(_0x5a24eb){return _0x5a24eb;});}return null;};}function removeEntity(_0xe9e0c,_0x5a7944){return function(_0xeebdb1){if(_0xeebdb1){return _0xeebdb1[_0x1c99('0x29')]()[_0x1c99('0x28')](function(){_0xe9e0c['status'](0xcc)[_0x1c99('0x1e')]();});}};}function handleEntityNotFound(_0x4a8c8c,_0x3f1c1a){return function(_0x13a438){if(!_0x13a438){_0x4a8c8c[_0x1c99('0x1c')](0x194);}return _0x13a438;};}function handleError(_0x355b49,_0x376862){_0x376862=_0x376862||0x1f4;return function(_0x859184){logger[_0x1c99('0x2a')](_0x859184[_0x1c99('0x2b')]);if(_0x859184[_0x1c99('0x2c')]){delete _0x859184[_0x1c99('0x2c')];}_0x355b49[_0x1c99('0x1d')](_0x376862)[_0x1c99('0x2d')](_0x859184);};}exports[_0x1c99('0x2e')]=function(_0x16f59a,_0xf98a27){var _0x277ce8={'raw':!![],'where':{'id':_0x16f59a[_0x1c99('0x2f')]['id']}},_0x13b032={};_0x13b032[_0x1c99('0x30')]=_['keys'](db[_0x1c99('0x31')][_0x1c99('0x32')]);_0x13b032[_0x1c99('0x33')]=_[_0x1c99('0x34')](_0x16f59a[_0x1c99('0x33')]);_0x13b032['filters']=_['intersection'](_0x13b032[_0x1c99('0x30')],_0x13b032['query']);_0x277ce8[_0x1c99('0x35')]=_[_0x1c99('0x36')](_0x13b032[_0x1c99('0x30')],qs[_0x1c99('0x37')](_0x16f59a[_0x1c99('0x33')]['fields']));_0x277ce8[_0x1c99('0x35')]=_0x277ce8[_0x1c99('0x35')][_0x1c99('0x38')]?_0x277ce8[_0x1c99('0x35')]:_0x13b032[_0x1c99('0x30')];if(_0x16f59a[_0x1c99('0x33')][_0x1c99('0x39')]){_0x277ce8[_0x1c99('0x3a')]=[{'all':!![]}];}_0x277ce8=_[_0x1c99('0x3b')]({},_0x277ce8,_0x16f59a[_0x1c99('0x3c')]);return db[_0x1c99('0x31')][_0x1c99('0x3d')](_0x277ce8)[_0x1c99('0x28')](handleEntityNotFound(_0xf98a27,null))[_0x1c99('0x28')](respondWithResult(_0xf98a27,null))['catch'](handleError(_0xf98a27,null));};exports[_0x1c99('0x27')]=function(_0x492a18,_0x293676){if(_0x492a18['body']['id']){delete _0x492a18[_0x1c99('0x3e')]['id'];}return db[_0x1c99('0x31')][_0x1c99('0x3d')]({'where':{'id':_0x492a18['params']['id']}})[_0x1c99('0x28')](handleEntityNotFound(_0x293676,null))['then'](saveUpdates(_0x492a18[_0x1c99('0x3e')],null))[_0x1c99('0x28')](respondWithResult(_0x293676,null))[_0x1c99('0x3f')](handleError(_0x293676,null));};exports[_0x1c99('0x29')]=function(_0x149d03,_0x3ab230){return db['MailApplication'][_0x1c99('0x3d')]({'where':{'id':_0x149d03[_0x1c99('0x2f')]['id']}})[_0x1c99('0x28')](handleEntityNotFound(_0x3ab230,null))[_0x1c99('0x28')](removeEntity(_0x3ab230,null))[_0x1c99('0x3f')](handleError(_0x3ab230,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 161c57a..e96a016 100644 --- a/server/api/mailApplication/mailApplication.model.js +++ b/server/api/mailApplication/mailApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96f2=['rimraf','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x96f2,0xb0));var _0x296f=function(_0x21d5dd,_0x6eca75){_0x21d5dd=_0x21d5dd-0x0;var _0x54807e=_0x96f2[_0x21d5dd];return _0x54807e;};'use strict';var _=require(_0x296f('0x0'));var util=require('util');var logger=require(_0x296f('0x1'))(_0x296f('0x2'));var moment=require(_0x296f('0x3'));var BPromise=require('bluebird');var rp=require(_0x296f('0x4'));var fs=require('fs');var path=require(_0x296f('0x5'));var rimraf=require(_0x296f('0x6'));var config=require('../../config/environment');var attributes=require(_0x296f('0x7'));module[_0x296f('0x8')]=function(_0x4c3626,_0x4c55c7){return _0x4c3626[_0x296f('0x9')](_0x296f('0xa'),attributes,{'tableName':_0x296f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x296f('0xc'),'collate':_0x296f('0xd')});}; \ No newline at end of file +var _0x75b6=['MailApplication','utf8mb4','lodash','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x458f09,_0xf2ee90){var _0x1ca565=function(_0x8ec760){while(--_0x8ec760){_0x458f09['push'](_0x458f09['shift']());}};_0x1ca565(++_0xf2ee90);}(_0x75b6,0x1a4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x675b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x675b('0x1'));var moment=require(_0x675b('0x2'));var BPromise=require(_0x675b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x675b('0x4'));var rimraf=require(_0x675b('0x5'));var config=require(_0x675b('0x6'));var attributes=require('./mailApplication.attributes');module[_0x675b('0x7')]=function(_0x5332ee,_0x20b740){return _0x5332ee[_0x675b('0x8')](_0x675b('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x675b('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 4f91df5..8528aef 100644 --- a/server/api/mailApplication/mailApplication.rpc.js +++ b/server/api/mailApplication/mailApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5249=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1c18d7,_0x476a5d){var _0x991555=function(_0x3facab){while(--_0x3facab){_0x1c18d7['push'](_0x1c18d7['shift']());}};_0x991555(++_0x476a5d);}(_0x5249,0x18e));var _0x9524=function(_0x1f83b8,_0x46fdb0){_0x1f83b8=_0x1f83b8-0x0;var _0x16eec8=_0x5249[_0x1f83b8];return _0x16eec8;};'use strict';var _=require(_0x9524('0x0'));var util=require(_0x9524('0x1'));var moment=require('moment');var BPromise=require(_0x9524('0x2'));var rs=require(_0x9524('0x3'));var fs=require('fs');var Redis=require(_0x9524('0x4'));var db=require(_0x9524('0x5'))['db'];var utils=require(_0x9524('0x6'));var logger=require(_0x9524('0x7'))(_0x9524('0x8'));var config=require('../../config/environment');var jayson=require(_0x9524('0x9'));var client=jayson[_0x9524('0xa')][_0x9524('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38a040,_0x451ed4,_0x5b2b50){return new BPromise(function(_0x513a18,_0xd78e7e){return client[_0x9524('0xc')](_0x38a040,_0x5b2b50)['then'](function(_0xfec68){logger[_0x9524('0xd')](_0x9524('0xe'),_0x451ed4,_0x9524('0xf'));logger[_0x9524('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x451ed4,_0x9524('0xf'),JSON[_0x9524('0x11')](_0xfec68));if(_0xfec68['error']){if(_0xfec68[_0x9524('0x12')][_0x9524('0x13')]===0x1f4){logger[_0x9524('0x12')](_0x9524('0xe'),_0x451ed4,_0xfec68[_0x9524('0x12')][_0x9524('0x14')]);return _0xd78e7e(_0xfec68['error']['message']);}logger[_0x9524('0x12')](_0x9524('0xe'),_0x451ed4,_0xfec68[_0x9524('0x12')][_0x9524('0x14')]);return _0x513a18(_0xfec68[_0x9524('0x12')]['message']);}else{logger[_0x9524('0xd')](_0x9524('0xe'),_0x451ed4,_0x9524('0xf'));_0x513a18(_0xfec68['result'][_0x9524('0x14')]);}})[_0x9524('0x15')](function(_0x3a2607){logger[_0x9524('0x12')](_0x9524('0xe'),_0x451ed4,_0x3a2607);_0xd78e7e(_0x3a2607);});});}exports['UpdateMailApplication']=function(_0x2c4795){var _0x1e6c5e=this;return new Promise(function(_0x523c1f,_0x5c6f59){return db[_0x9524('0x16')][_0x9524('0x17')](_0x2c4795[_0x9524('0x18')],{'raw':_0x2c4795[_0x9524('0x19')]?_0x2c4795[_0x9524('0x19')][_0x9524('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c4795['options']?_0x2c4795[_0x9524('0x19')][_0x9524('0x1b')]||null:null,'attributes':_0x2c4795[_0x9524('0x19')]?_0x2c4795['options'][_0x9524('0x1c')]||null:null,'limit':_0x2c4795[_0x9524('0x19')]?_0x2c4795[_0x9524('0x19')][_0x9524('0x1d')]||null:null})['then'](function(_0x5d0564){logger[_0x9524('0xd')](_0x9524('0x1e'),_0x2c4795);logger['debug'](_0x9524('0x1e'),_0x2c4795,JSON['stringify'](_0x5d0564));_0x523c1f(_0x5d0564);})[_0x9524('0x15')](function(_0x56b314){logger[_0x9524('0x12')](_0x9524('0x1e'),_0x56b314['message'],_0x2c4795);_0x5c6f59(_0x1e6c5e[_0x9524('0x12')](0x1f4,_0x56b314[_0x9524('0x14')]));});});}; \ No newline at end of file +var _0xa7a6=['raw','where','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','MailApplication,\x20%s,\x20%s','catch','UpdateMailApplication','MailApplication','update','options'];(function(_0x37eb04,_0x2d568d){var _0x2df232=function(_0x33d5e3){while(--_0x33d5e3){_0x37eb04['push'](_0x37eb04['shift']());}};_0x2df232(++_0x2d568d);}(_0xa7a6,0xac));var _0x6a7a=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0xa7a6[_0x3239f5];return _0x3559c8;};'use strict';var _=require(_0x6a7a('0x0'));var util=require(_0x6a7a('0x1'));var moment=require(_0x6a7a('0x2'));var BPromise=require(_0x6a7a('0x3'));var rs=require(_0x6a7a('0x4'));var fs=require('fs');var Redis=require(_0x6a7a('0x5'));var db=require(_0x6a7a('0x6'))['db'];var utils=require(_0x6a7a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6a7a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6a7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x598c47,_0x1ddf47,_0x5b3a3e){return new BPromise(function(_0x42f40d,_0x551553){return client[_0x6a7a('0xa')](_0x598c47,_0x5b3a3e)['then'](function(_0x33bb8f){logger[_0x6a7a('0xb')]('MailApplication,\x20%s,\x20%s',_0x1ddf47,_0x6a7a('0xc'));logger[_0x6a7a('0xd')](_0x6a7a('0xe'),_0x1ddf47,_0x6a7a('0xc'),JSON[_0x6a7a('0xf')](_0x33bb8f));if(_0x33bb8f['error']){if(_0x33bb8f[_0x6a7a('0x10')]['code']===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x1ddf47,_0x33bb8f[_0x6a7a('0x10')][_0x6a7a('0x11')]);return _0x551553(_0x33bb8f[_0x6a7a('0x10')][_0x6a7a('0x11')]);}logger[_0x6a7a('0x10')](_0x6a7a('0x12'),_0x1ddf47,_0x33bb8f[_0x6a7a('0x10')]['message']);return _0x42f40d(_0x33bb8f[_0x6a7a('0x10')][_0x6a7a('0x11')]);}else{logger[_0x6a7a('0xb')](_0x6a7a('0x12'),_0x1ddf47,_0x6a7a('0xc'));_0x42f40d(_0x33bb8f['result'][_0x6a7a('0x11')]);}})[_0x6a7a('0x13')](function(_0x3e61da){logger[_0x6a7a('0x10')](_0x6a7a('0x12'),_0x1ddf47,_0x3e61da);_0x551553(_0x3e61da);});});}exports[_0x6a7a('0x14')]=function(_0x2ca5b6){var _0x32cb0e=this;return new Promise(function(_0x88add5,_0x3b9808){return db[_0x6a7a('0x15')][_0x6a7a('0x16')](_0x2ca5b6['body'],{'raw':_0x2ca5b6[_0x6a7a('0x17')]?_0x2ca5b6[_0x6a7a('0x17')][_0x6a7a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca5b6['options']?_0x2ca5b6[_0x6a7a('0x17')][_0x6a7a('0x19')]||null:null,'attributes':_0x2ca5b6['options']?_0x2ca5b6[_0x6a7a('0x17')][_0x6a7a('0x1a')]||null:null,'limit':_0x2ca5b6['options']?_0x2ca5b6[_0x6a7a('0x17')]['limit']||null:null})[_0x6a7a('0x1b')](function(_0xd7b87d){logger[_0x6a7a('0xb')]('UpdateMailApplication',_0x2ca5b6);logger[_0x6a7a('0xd')](_0x6a7a('0x14'),_0x2ca5b6,JSON[_0x6a7a('0xf')](_0xd7b87d));_0x88add5(_0xd7b87d);})[_0x6a7a('0x13')](function(_0xf458dc){logger[_0x6a7a('0x10')](_0x6a7a('0x14'),_0xf458dc['message'],_0x2ca5b6);_0x3b9808(_0x32cb0e[_0x6a7a('0x10')](0x1f4,_0xf458dc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 796daa0..6ec32e0 100644 --- a/server/api/mailInteraction/index.js +++ b/server/api/mailInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1fd=['mail','mailinteraction:addtags','addTags','delete','destroy','removeTags','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked'];(function(_0x1c3888,_0x3c9ea1){var _0x886214=function(_0x390777){while(--_0x390777){_0x1c3888['push'](_0x1c3888['shift']());}};_0x886214(++_0x3c9ea1);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x3439ef,_0x198707){_0x3439ef=_0x3439ef-0x0;var _0x3c7937=_0xa1fd[_0x3439ef];return _0x3c7937;};'use strict';var multer=require(_0xda1f('0x0'));var util=require(_0xda1f('0x1'));var path=require(_0xda1f('0x2'));var timeout=require(_0xda1f('0x3'));var express=require('express');var router=express[_0xda1f('0x4')]();var auth=require(_0xda1f('0x5'));var interaction=require(_0xda1f('0x6'));var config=require(_0xda1f('0x7'));var controller=require(_0xda1f('0x8'));router['get']('/',auth[_0xda1f('0x9')](),controller[_0xda1f('0xa')]);router[_0xda1f('0xb')]('/describe',auth[_0xda1f('0x9')](),controller[_0xda1f('0xc')]);router[_0xda1f('0xb')](_0xda1f('0xd'),auth[_0xda1f('0x9')](),controller[_0xda1f('0xe')]);router[_0xda1f('0xb')](_0xda1f('0xf'),auth[_0xda1f('0x9')](),controller['getMessages']);router[_0xda1f('0xb')](_0xda1f('0x10'),auth[_0xda1f('0x9')](),controller[_0xda1f('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xda1f('0x12')]);router[_0xda1f('0x13')](_0xda1f('0xf'),auth[_0xda1f('0x9')](),controller[_0xda1f('0x14')]);router['post'](_0xda1f('0x15'),auth[_0xda1f('0x9')](),interaction[_0xda1f('0x16')](_0xda1f('0x17'),_0xda1f('0x18')),controller[_0xda1f('0x19')]);router['put'](_0xda1f('0xd'),auth[_0xda1f('0x9')](),interaction[_0xda1f('0x16')](_0xda1f('0x17'),'mailinteraction:update'),controller['update']);router[_0xda1f('0x1a')]('/:id',auth[_0xda1f('0x9')](),interaction[_0xda1f('0x16')](_0xda1f('0x17'),'mailinteraction:destroy'),controller[_0xda1f('0x1b')]);router[_0xda1f('0x1a')]('/:id/tags',auth[_0xda1f('0x9')](),controller[_0xda1f('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xd51f=['express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','multer','util','connect-timeout'];(function(_0x100357,_0x5d551b){var _0x1939f2=function(_0x56f410){while(--_0x56f410){_0x100357['push'](_0x100357['shift']());}};_0x1939f2(++_0x5d551b);}(_0xd51f,0xf0));var _0xfd51=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd51f[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var path=require('path');var timeout=require(_0xfd51('0x2'));var express=require(_0xfd51('0x3'));var router=express['Router']();var auth=require(_0xfd51('0x4'));var interaction=require(_0xfd51('0x5'));var config=require('../../config/environment');var controller=require(_0xfd51('0x6'));router[_0xfd51('0x7')]('/',auth['isAuthenticated'](),controller[_0xfd51('0x8')]);router[_0xfd51('0x7')]('/describe',auth[_0xfd51('0x9')](),controller[_0xfd51('0xa')]);router[_0xfd51('0x7')](_0xfd51('0xb'),auth[_0xfd51('0x9')](),controller['show']);router[_0xfd51('0x7')](_0xfd51('0xc'),auth[_0xfd51('0x9')](),controller['getMessages']);router[_0xfd51('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xfd51('0xd')]);router[_0xfd51('0xe')]('/',auth[_0xfd51('0x9')](),controller['create']);router['post']('/:id/messages',auth[_0xfd51('0x9')](),controller[_0xfd51('0xf')]);router[_0xfd51('0xe')](_0xfd51('0x10'),auth[_0xfd51('0x9')](),interaction[_0xfd51('0x11')](_0xfd51('0x12'),'mailinteraction:addtags'),controller[_0xfd51('0x13')]);router[_0xfd51('0x14')](_0xfd51('0xb'),auth[_0xfd51('0x9')](),interaction[_0xfd51('0x11')](_0xfd51('0x12'),_0xfd51('0x15')),controller[_0xfd51('0x16')]);router['delete'](_0xfd51('0xb'),auth['isAuthenticated'](),interaction[_0xfd51('0x11')](_0xfd51('0x12'),_0xfd51('0x17')),controller[_0xfd51('0x18')]);router[_0xfd51('0x19')](_0xfd51('0x10'),auth[_0xfd51('0x9')](),controller[_0xfd51('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ac1f0f2..a5efcdb 100644 --- a/server/api/mailInteraction/mailInteraction.attributes.js +++ b/server/api/mailInteraction/mailInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3968=['STRING','TEXT','long','BOOLEAN','DATE','iconv'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x3968,0x71));var _0x8396=function(_0x2ffabd,_0x26f014){_0x2ffabd=_0x2ffabd-0x0;var _0x2fe535=_0x3968[_0x2ffabd];return _0x2fe535;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x8396('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8396('0x1')]},'thirdDisposition':{'type':Sequelize[_0x8396('0x1')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x8396('0x1')](0x1fe)},'to':{'type':Sequelize[_0x8396('0x1')]},'cc':{'type':Sequelize[_0x8396('0x2')](_0x8396('0x3'))},'subject':{'type':Sequelize[_0x8396('0x2')]()},'attach':{'type':Sequelize[_0x8396('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8396('0x5')]},'substatus':{'type':Sequelize[_0x8396('0x1')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8396('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x8396('0x2')](_0x8396('0x3'))},'lastMsgText':{'type':Sequelize[_0x8396('0x2')](_0x8396('0x3'))}}; \ No newline at end of file +var _0x6748=['out','long','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM'];(function(_0x3986a2,_0x481a07){var _0x4e183f=function(_0x11301e){while(--_0x11301e){_0x3986a2['push'](_0x3986a2['shift']());}};_0x4e183f(++_0x481a07);}(_0x6748,0xbf));var _0x8674=function(_0xfe9743,_0xa4e157){_0xfe9743=_0xfe9743-0x0;var _0x342d6e=_0x6748[_0xfe9743];return _0x342d6e;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x8674('0x0'));module[_0x8674('0x1')]={'closed':{'type':Sequelize[_0x8674('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8674('0x3')]},'disposition':{'type':Sequelize[_0x8674('0x4')]},'secondDisposition':{'type':Sequelize[_0x8674('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8674('0x4')]},'note':{'type':Sequelize[_0x8674('0x4')]},'inReplyTo':{'type':Sequelize[_0x8674('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8674('0x5')]('long')},'subject':{'type':Sequelize[_0x8674('0x5')]()},'attach':{'type':Sequelize[_0x8674('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8674('0x3')]},'substatus':{'type':Sequelize[_0x8674('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x8674('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8674('0x6')]('in',_0x8674('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8674('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8674('0x6')]('in',_0x8674('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x8674('0x8'))},'lastMsgText':{'type':Sequelize['TEXT'](_0x8674('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4359e29..6a009f3 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9b3=['it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','length','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','text','start','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','buildExpression','keys','isEmpty','MailAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','journey','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','MailInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','rows','show','params','options','create','body','describe','addMessage','MailMessage','omit','ids','pick','filter','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','root','server','tmp','join','format','transcript-%d-%s.zip','attachments','Attachment','Messages','bcc','subject','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','readFileSync','build','writeFileSync','message%d.eml','err','html-pdf','eml-format','rimraf','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','end','status','json','count','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','push','findOne','lastMsgBody','lastMsgText','trimStart','catch','index','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','select','field','color','from','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags'];(function(_0x18aef9,_0x53bd85){var _0x45d5ab=function(_0x25f5f8){while(--_0x25f5f8){_0x18aef9['push'](_0x18aef9['shift']());}};_0x45d5ab(++_0x53bd85);}(_0xb9b3,0x191));var _0x3b9b=function(_0x4b3fa1,_0x497557){_0x4b3fa1=_0x4b3fa1-0x0;var _0x3a9c0a=_0xb9b3[_0x4b3fa1];return _0x3a9c0a;};'use strict';var pdf=require(_0x3b9b('0x0'));var emlformat=require(_0x3b9b('0x1'));var rimraf=require(_0x3b9b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b9b('0x3'));var moment=require(_0x3b9b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3b9b('0x5'));var path=require(_0x3b9b('0x6'));var sox=require('sox');var csv=require(_0x3b9b('0x7'));var ejs=require(_0x3b9b('0x8'));var fs=require('fs');var _=require(_0x3b9b('0x9'));var squel=require(_0x3b9b('0xa'));var crypto=require(_0x3b9b('0xb'));var jsforce=require(_0x3b9b('0xc'));var deskjs=require(_0x3b9b('0xd'));var toCsv=require(_0x3b9b('0x7'));var querystring=require(_0x3b9b('0xe'));var Papa=require('papaparse');var htmlToText=require(_0x3b9b('0xf'));var Redis=require('ioredis');var authService=require(_0x3b9b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3b9b('0x11'));var hardwareService=require(_0x3b9b('0x12'));var logger=require(_0x3b9b('0x13'))(_0x3b9b('0x14'));var utils=require(_0x3b9b('0x15'));var config=require(_0x3b9b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b9b('0x17'))['db'];config[_0x3b9b('0x18')]=_[_0x3b9b('0x19')](config[_0x3b9b('0x18')],{'host':_0x3b9b('0x1a'),'port':0x18eb});var socket=require(_0x3b9b('0x1b'))(new Redis(config[_0x3b9b('0x18')]));require(_0x3b9b('0x1c'))[_0x3b9b('0x1d')](socket);function respondWithStatusCode(_0x43dd65,_0x5d61f6){_0x5d61f6=_0x5d61f6||0xcc;return function(_0x7fe185){if(_0x7fe185){return _0x43dd65['sendStatus'](_0x5d61f6);}return _0x43dd65['status'](_0x5d61f6)[_0x3b9b('0x1e')]();};}function respondWithResult(_0x3086d5,_0x554ba3){_0x554ba3=_0x554ba3||0xc8;return function(_0xc5a7c4){if(_0xc5a7c4){return _0x3086d5[_0x3b9b('0x1f')](_0x554ba3)[_0x3b9b('0x20')](_0xc5a7c4);}};}function respondWithFilteredResult(_0x447642,_0x53fcd0){return function(_0x307313){if(_0x307313){var _0x2aa667=_0x307313[_0x3b9b('0x21')],_0x15ee31=_0x53fcd0['offset'],_0x31a95a=_0x53fcd0[_0x3b9b('0x22')]+_0x53fcd0['limit'],_0x2775bf;if(_0x31a95a>=_0x2aa667){_0x31a95a=_0x2aa667;_0x2775bf=0xc8;}else{_0x2775bf=0xce;}_0x447642['status'](_0x2775bf);return _0x447642[_0x3b9b('0x23')](_0x3b9b('0x24'),_0x15ee31+'-'+_0x31a95a+'/'+_0x2aa667)['json'](_0x307313);}return null;};}function patchUpdates(_0x3c05c5){return function(_0x2ef902){try{jsonpatch['apply'](_0x2ef902,_0x3c05c5,!![]);}catch(_0x1b71d0){return BPromise[_0x3b9b('0x25')](_0x1b71d0);}return _0x2ef902[_0x3b9b('0x26')]();};}function saveUpdates(_0x3e9b67,_0x208f7b){return function(_0x439bdc){if(_0x439bdc){return _0x439bdc[_0x3b9b('0x27')](_0x3e9b67)['then'](function(_0x5bb76f){return _0x5bb76f;});}return null;};}function removeEntity(_0x4902aa,_0x316367){return function(_0x487ab2){if(_0x487ab2){return _0x487ab2[_0x3b9b('0x28')]()[_0x3b9b('0x29')](function(){_0x4902aa[_0x3b9b('0x1f')](0xcc)[_0x3b9b('0x1e')]();});}};}function handleEntityNotFound(_0x25c589,_0x43e800){return function(_0x45dcb1){if(!_0x45dcb1){_0x25c589[_0x3b9b('0x2a')](0x194);}return _0x45dcb1;};}function handleError(_0x3569b3,_0x2b3221){_0x2b3221=_0x2b3221||0x1f4;return function(_0x211a76){logger[_0x3b9b('0x2b')](_0x211a76[_0x3b9b('0x2c')]);if(_0x211a76[_0x3b9b('0x2d')]){delete _0x211a76[_0x3b9b('0x2d')];}_0x3569b3[_0x3b9b('0x1f')](_0x2b3221)[_0x3b9b('0x2e')](_0x211a76);};}function getInteractionUsers(_0x52e64c,_0x24e146){return new BPromise(function(_0x3223b2,_0x264c06){try{if(_0x24e146[_0x52e64c['id']]){_0x52e64c[_0x3b9b('0x2f')]=_[_0x3b9b('0x30')](_0x24e146[_0x52e64c['id']],function(_0x3537bc){return{'id':_0x3537bc['id'],'fullname':_0x3537bc[_0x3b9b('0x31')]};});}}catch(_0xfb7ea9){_0x264c06(_0xfb7ea9);}_0x3223b2(_0x52e64c);});}function getInteractionTags(_0x665a4a,_0x409a47){return new BPromise(function(_0x5db224,_0x5007d1){try{if(_0x665a4a[_0x3b9b('0x32')]){_0x665a4a[_0x3b9b('0x33')]=[];_0x665a4a[_0x3b9b('0x32')]['split'](',')['forEach'](function(_0x3cb5c3){_0x665a4a[_0x3b9b('0x33')][_0x3b9b('0x34')](_0x409a47[_0x3cb5c3]);});}delete _0x665a4a[_0x3b9b('0x32')];}catch(_0x389ca8){_0x5007d1(_0x389ca8);}_0x5db224(_0x665a4a);});}function getLastMessageText(_0x7c101c){return new BPromise(function(_0x2283c7,_0x1137f2){return db['MailInteraction'][_0x3b9b('0x35')]({'where':{'id':_0x7c101c['id']},'attributes':[_0x3b9b('0x36'),_0x3b9b('0x37')],'raw':!![]})[_0x3b9b('0x29')](function(_0x2bbea8){if(!_0x2bbea8['lastMsgText']){_0x7c101c['lastMsgText']=_[_0x3b9b('0x38')](htmlToText['fromString'](_0x2bbea8[_0x3b9b('0x36')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x7c101c[_0x3b9b('0x37')]=_0x2bbea8[_0x3b9b('0x37')];}_0x2283c7(_0x7c101c);})[_0x3b9b('0x39')](function(_0x2ad201){_0x1137f2(_0x2ad201);});});}function updateMailInteraction(_0x310bd5,_0x5c040a,_0x455a36,_0x3ab9a4){return new BPromise(function(_0x1e2875,_0xa7c97f){return getInteractionUsers(_0x310bd5,_0x455a36)[_0x3b9b('0x29')](function(_0x2c3c18){return getInteractionTags(_0x2c3c18,_0x5c040a);})[_0x3b9b('0x29')](function(_0x1330c6){if(_0x3ab9a4){_0x1e2875(getLastMessageText(_0x1330c6));}else{_0x1e2875(_0x1330c6);}})['catch'](function(_0x169716){_0xa7c97f(_0x169716);});});}exports[_0x3b9b('0x3a')]=function(_0x5661a8,_0x55cf92){var _0x53efd9={},_0x6cbeeb={},_0xa5708e={'count':0x0,'rows':[]};var _0x580115=_[_0x3b9b('0x30')](db['MailInteraction'][_0x3b9b('0x3b')],function(_0x328317){return{'name':_0x328317[_0x3b9b('0x3c')],'type':_0x328317[_0x3b9b('0x3d')]['key']};});_0x6cbeeb['model']=_[_0x3b9b('0x30')](_0x580115,'name');_0x6cbeeb[_0x3b9b('0x3e')]=_['keys'](_0x5661a8[_0x3b9b('0x3e')]);_0x6cbeeb[_0x3b9b('0x3f')]=_[_0x3b9b('0x40')](_0x6cbeeb['model'],_0x6cbeeb[_0x3b9b('0x3e')]);_0x53efd9['attributes']=_[_0x3b9b('0x40')](_0x6cbeeb[_0x3b9b('0x41')],qs['fields'](_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x42')]));_0x53efd9['attributes']=_0x53efd9[_0x3b9b('0x43')]['length']?_0x53efd9[_0x3b9b('0x43')]:_0x6cbeeb[_0x3b9b('0x41')];if(!_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x44')](_0x3b9b('0x45'))){_0x53efd9[_0x3b9b('0x46')]=qs['limit'](_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x46')]);_0x53efd9[_0x3b9b('0x22')]=qs['offset'](_0x5661a8['query']['offset']);}_0x53efd9['order']=qs[_0x3b9b('0x47')](_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x47')]);_0x53efd9[_0x3b9b('0x48')]=qs[_0x3b9b('0x3f')](_['pick'](_0x5661a8[_0x3b9b('0x3e')],_0x6cbeeb[_0x3b9b('0x3f')]),_0x580115);var _0x4d78fc=[];var _0x30aba8=squel[_0x3b9b('0x49')]()[_0x3b9b('0x4a')]('id')[_0x3b9b('0x4a')](_0x3b9b('0x2d'))[_0x3b9b('0x4a')](_0x3b9b('0x4b'))[_0x3b9b('0x4c')]('tools_tags');var _0x5960c2=squel[_0x3b9b('0x49')]()[_0x3b9b('0x4a')](_0x3b9b('0x4d'))[_0x3b9b('0x4a')]('u.fullname')[_0x3b9b('0x4a')](_0x3b9b('0x4e'))[_0x3b9b('0x4c')](_0x3b9b('0x4f'),'ui')[_0x3b9b('0x50')](_0x3b9b('0x51'),'u',_0x3b9b('0x52'));var _0x21cc8c=squel[_0x3b9b('0x49')]()[_0x3b9b('0x4c')]('mail_interactions','i')['left_join'](_0x3b9b('0x53'),'c',_0x3b9b('0x54'))[_0x3b9b('0x50')](_0x3b9b('0x51'),'o',_0x3b9b('0x55'))[_0x3b9b('0x50')](_0x3b9b('0x56'),'a',_0x3b9b('0x57'))['left_join'](_0x3b9b('0x58'),'me',_0x3b9b('0x59'))[_0x3b9b('0x50')](_0x3b9b('0x5a'),'it',_0x3b9b('0x5b'))[_0x3b9b('0x50')](_0x3b9b('0x5c'),'t',_0x3b9b('0x5d'));var _0x18418a=squel[_0x3b9b('0x5e')]();var _0x53513d=[];var _0x396ad8=squel[_0x3b9b('0x5e')]();var _0x268157;if(_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x5f')]){_0x268157=as[_0x3b9b('0x60')](_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x5f')]);var _0x4dd095=_0x268157['sqlOperator'];for(var _0x1d465f=0x0;_0x1d465f<_0x268157['conditions'][_0x3b9b('0x61')];_0x1d465f++){var _0x2c8c6e=_0x268157[_0x3b9b('0x62')][_0x1d465f];var _0x77e0c1='i';var _0x2e43a9=_[_0x3b9b('0x63')](_0x580115,[_0x3b9b('0x2d'),_0x2c8c6e[_0x3b9b('0x4a')]]);if(!_0x2e43a9){switch(_0x2c8c6e[_0x3b9b('0x4a')]){case _0x3b9b('0x64'):if(_0x2c8c6e[_0x3b9b('0x65')]==0x1){_0x21cc8c[_0x3b9b('0x66')]('`'+_0x2c8c6e[_0x3b9b('0x4a')]+'`\x20=\x200');}else{_0x21cc8c[_0x3b9b('0x66')]('`'+_0x2c8c6e[_0x3b9b('0x4a')]+_0x3b9b('0x67'));}break;case _0x3b9b('0x68'):if(_0x2c8c6e[_0x3b9b('0x69')]===_0x3b9b('0x6a')){if(_0x2c8c6e[_0x3b9b('0x65')]['split']('\x20')['length']>0x1){_0x18418a[_0x4dd095](_0x3b9b('0x6b'),qs[_0x3b9b('0x6c')](_0x2c8c6e[_0x3b9b('0x65')]),null);}else{var _0x308f4e='%'+_0x2c8c6e['value']+'%';_0x18418a[_0x4dd095]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x308f4e,_0x308f4e,_0x308f4e);}}else{_0x2e43a9=_['find'](_0x580115,['name','ContactId']);_0x2c8c6e[_0x3b9b('0x4a')]='ContactId';_0x236000=as['buildExpression'](_0x77e0c1,_0x2e43a9[_0x3b9b('0x3d')],_0x2c8c6e);_0x18418a[_0x4dd095](_0x236000[_0x3b9b('0x6d')],_0x236000[_0x3b9b('0x65')][_0x3b9b('0x6e')],_0x236000[_0x3b9b('0x65')][_0x3b9b('0x1e')]);}break;case _0x3b9b('0x6f'):var _0x37831b=_0x2c8c6e[_0x3b9b('0x65')][_0x3b9b('0x70')](',')[_0x3b9b('0x30')](function(_0x1f8461){return Number(_0x1f8461);});_0x37831b[_0x3b9b('0x71')](function(_0x4556f1){_0x396ad8['or'](_0x3b9b('0x72'),'%,'+_0x4556f1+',%');});_0x53513d=_[_0x3b9b('0x73')](_0x53513d,_0x37831b);break;case _0x3b9b('0x74'):if(_0x2c8c6e['operator']==='$substring'){_0x18418a[_0x4dd095](_0x3b9b('0x75'),'%'+_0x2c8c6e[_0x3b9b('0x65')]+'%',null);}else{_0x2e43a9=_[_0x3b9b('0x63')](_0x580115,['name',_0x3b9b('0x76')]);_0x2c8c6e['field']='UserId';_0x236000=as['buildExpression'](_0x77e0c1,_0x2e43a9[_0x3b9b('0x3d')],_0x2c8c6e);_0x18418a[_0x4dd095](_0x236000['text'],_0x236000[_0x3b9b('0x65')][_0x3b9b('0x6e')],_0x236000[_0x3b9b('0x65')][_0x3b9b('0x1e')]);}break;case _0x3b9b('0x77'):_0x236000=as[_0x3b9b('0x78')]('me',null,_0x2c8c6e);_0x18418a[_0x4dd095](_0x236000[_0x3b9b('0x6d')],_0x236000[_0x3b9b('0x65')][_0x3b9b('0x6e')],_0x236000['value'][_0x3b9b('0x1e')]);break;}}else{var _0x236000=as[_0x3b9b('0x78')](_0x77e0c1,_0x2e43a9['type'],_0x2c8c6e);_0x18418a[_0x4dd095](_0x236000[_0x3b9b('0x6d')],_0x236000[_0x3b9b('0x65')]['start'],_0x236000['value'][_0x3b9b('0x1e')]);}}}else{var _0x47a176=_(_0x5661a8[_0x3b9b('0x3e')])[_0x3b9b('0x79')]()[_0x3b9b('0x30')](function(_0x5424df){return _['some'](_0x580115,[_0x3b9b('0x2d'),_0x5424df])?_0x5424df:undefined;})['compact']()[_0x3b9b('0x65')]();if(!_[_0x3b9b('0x7a')](_0x47a176)){_0x47a176[_0x3b9b('0x71')](function(_0x16b0d3){if(_0x16b0d3===_0x3b9b('0x7b')){_0x21cc8c[_0x3b9b('0x48')]('i.MailAccountId\x20IN\x20?',[][_0x3b9b('0x7c')](_0x5661a8[_0x3b9b('0x3e')][_0x16b0d3]));}else if(_0x16b0d3===_0x3b9b('0x7d')){var _0x6bdbaa=JSON[_0x3b9b('0x7e')](_0x5661a8[_0x3b9b('0x3e')][_0x16b0d3])[_0x3b9b('0x7f')];var _0x2b9d5c=JSON[_0x3b9b('0x7e')](_0x5661a8['query'][_0x16b0d3])[_0x3b9b('0x80')];_0x21cc8c[_0x3b9b('0x48')](_0x3b9b('0x81'),_0x6bdbaa,_0x2b9d5c);}else{if(_0x5661a8['query'][_0x16b0d3]===_0x3b9b('0x82')){_0x21cc8c[_0x3b9b('0x48')]('i.'+_0x16b0d3+_0x3b9b('0x83'));}else{_0x21cc8c[_0x3b9b('0x48')]('i.'+_0x16b0d3+_0x3b9b('0x84'),_0x5661a8[_0x3b9b('0x3e')][_0x16b0d3]);}}});}if(_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x85')]){if(_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x85')]==0x1){_0x21cc8c[_0x3b9b('0x66')](_0x3b9b('0x86'));}else{_0x21cc8c[_0x3b9b('0x66')](_0x3b9b('0x87'));}}if(_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x88')]){_0x53513d=_[_0x3b9b('0x89')](_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x88')])?_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x88')]:new Array(_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x88')]);_0x53513d[_0x3b9b('0x71')](function(_0x452788){_0x396ad8['or'](_0x3b9b('0x72'),'%,'+_0x452788+',%');});}if(_0x5661a8[_0x3b9b('0x3e')]['filter']){var _0x4d5dbe=_0x5661a8[_0x3b9b('0x3e')]['filter'][_0x3b9b('0x8a')]('\x5c','\x5c\x5c')[_0x3b9b('0x8a')](/'/g,'\x27\x27');if(qs[_0x3b9b('0x8b')](_0x4d5dbe)){_0x18418a['or'](_0x3b9b('0x8c'),_0x4d5dbe+'%');}else if(qs[_0x3b9b('0x8d')](_0x4d5dbe)){_0x18418a['or'](_0x3b9b('0x8e'),_0x4d5dbe+'%');}else{_0x18418a['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b9b('0x6c')](_0x4d5dbe))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b9b('0x6c')](_0x4d5dbe));}}}_0x21cc8c[_0x3b9b('0x48')](_0x18418a);_0x21cc8c[_0x3b9b('0x8f')]('i.id');var _0x2d198a={'type':db['Sequelize']['QueryTypes'][_0x3b9b('0x90')],'raw':!![]};var _0x1a9c05=_0x21cc8c[_0x3b9b('0x91')]();_0x1a9c05[_0x3b9b('0x4a')]('i.id');_0x1a9c05['field'](_0x3b9b('0x92'),_0x3b9b('0x64'));if(_0x53efd9[_0x3b9b('0x93')]){_0x53efd9['order']['forEach'](function(_0x562faa){var _0xcab420=_0x562faa[0x0]===_0x3b9b('0x94')?_0x562faa[0x0]:'i.'+_0x562faa[0x0];_0x21cc8c['order'](_0xcab420,_0x562faa[0x1]===_0x3b9b('0x95')?![]:!![]);});}if(!_[_0x3b9b('0x7a')](_0x53513d)){_0x21cc8c[_0x3b9b('0x66')](_0x396ad8);_0x1a9c05['where'](_0x3b9b('0x96'),_0x53513d);}BPromise[_0x3b9b('0x97')]()[_0x3b9b('0x29')](function(){if(!_0x268157){if(_0x5661a8['query'][_0x3b9b('0x7b')]||_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x98')])return;_0x1a9c05[_0x3b9b('0x48')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x21cc8c['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5661a8[_0x3b9b('0x99')][_0x3b9b('0x9a')]!=='agent')return;return _0x5661a8['user'][_0x3b9b('0x9b')]({'attributes':['id'],'raw':!![]})[_0x3b9b('0x29')](function(_0x41c8ef){if(_[_0x3b9b('0x7a')](_0x41c8ef)){_0x1a9c05[_0x3b9b('0x48')]('i.MailAccountId\x20IS\x20NULL');_0x21cc8c[_0x3b9b('0x48')](_0x3b9b('0x9c'));}else{_0x1a9c05[_0x3b9b('0x48')](_0x3b9b('0x9d'),_[_0x3b9b('0x30')](_0x41c8ef,'id'));_0x21cc8c[_0x3b9b('0x48')](_0x3b9b('0x9d'),_['map'](_0x41c8ef,'id'));}});})[_0x3b9b('0x29')](function(){if(_0x5661a8[_0x3b9b('0x99')][_0x3b9b('0x9a')]===_0x3b9b('0x9e')&&!_0x268157&&!_0x5661a8[_0x3b9b('0x3e')][_0x3b9b('0x7b')])return[];return db['sequelize'][_0x3b9b('0x3e')](_0x1a9c05['toString'](),_0x2d198a);})['then'](function(_0x30c093){_0xa5708e['count']=_0x30c093[_0x3b9b('0x61')];if(_0xa5708e[_0x3b9b('0x21')]===0x0)return[];return db[_0x3b9b('0x9f')][_0x3b9b('0x3e')](_0x30aba8[_0x3b9b('0xa0')](),_0x2d198a)[_0x3b9b('0x29')](function(_0x543f4b){_0x4d78fc=_[_0x3b9b('0xa1')](_0x543f4b,'id');_0x2d198a=_[_0x3b9b('0xa2')](_0x2d198a,{'model':db[_0x3b9b('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5661a8['query'][_0x3b9b('0x42')]){_0x53efd9[_0x3b9b('0x43')]['forEach'](function(_0x10984f){_0x21cc8c[_0x3b9b('0x4a')]('i.'+_0x10984f);});}else{_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0x92'),_0x3b9b('0x64'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xa4'),_0x3b9b('0xa5'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xa6'),_0x3b9b('0xa7'));_0x21cc8c[_0x3b9b('0x4a')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3b9b('0x94'));_0x21cc8c['field'](_0x3b9b('0xa8'));_0x21cc8c[_0x3b9b('0x4a')]('i.createdAt');_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xa9'));_0x21cc8c['field'](_0x3b9b('0xaa'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xab'));_0x21cc8c['field'](_0x3b9b('0xac'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xad'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xae'));_0x21cc8c[_0x3b9b('0x4a')]('i.subject');_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xaf'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xb0'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xb1'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xb2'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xb3'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xb4'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xb5'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xb6'));_0x21cc8c[_0x3b9b('0x4a')]('c.firstName','Contact.firstName');_0x21cc8c[_0x3b9b('0x4a')]('c.lastName',_0x3b9b('0xb7'));_0x21cc8c['field'](_0x3b9b('0xb8'),_0x3b9b('0xb9'));_0x21cc8c['field'](_0x3b9b('0xba'),_0x3b9b('0xbb'));_0x21cc8c['field'](_0x3b9b('0xbc'),_0x3b9b('0xbd'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xbe'),'Contact.fax');_0x21cc8c['field'](_0x3b9b('0xbf'),_0x3b9b('0xc0'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xc1'),_0x3b9b('0xc2'));_0x21cc8c[_0x3b9b('0x4a')](_0x3b9b('0xc3'),_0x3b9b('0x32'));}if(_0x53efd9['limit'])_0x21cc8c[_0x3b9b('0x46')](_0x53efd9[_0x3b9b('0x46')]);if(_0x53efd9['offset'])_0x21cc8c[_0x3b9b('0x22')](_0x53efd9[_0x3b9b('0x22')]);return db[_0x3b9b('0x9f')]['query'](_0x21cc8c['toString'](),_0x2d198a);})[_0x3b9b('0x29')](function(_0x12fad5){_0x5960c2[_0x3b9b('0x48')](_0x3b9b('0xc4'),_['map'](_0x12fad5,'id'));return db[_0x3b9b('0x9f')]['query'](_0x5960c2[_0x3b9b('0xa0')](),_0x2d198a)[_0x3b9b('0x29')](function(_0x442ee5){var _0x4f6310=_[_0x3b9b('0xc5')](_0x442ee5,_0x3b9b('0xc6'));var _0x43accb=[];return db[_0x3b9b('0xc7')][_0x3b9b('0x35')]({'attributes':[_0x3b9b('0xc8')],'raw':!![]})[_0x3b9b('0x29')](function(_0x26bf77){var _0x457fc8=_0x26bf77[_0x3b9b('0xc8')];_0x12fad5[_0x3b9b('0x71')](function(_0x5639ad){_0x43accb[_0x3b9b('0x34')](updateMailInteraction(_0x5639ad,_0x4d78fc,_0x4f6310,_0x457fc8));});return BPromise['all'](_0x43accb);});});});})[_0x3b9b('0x29')](function(_0xfa3ec6){_0xa5708e[_0x3b9b('0xc9')]=_0xfa3ec6;return _0xa5708e;})['then'](respondWithFilteredResult(_0x55cf92,_0x53efd9))[_0x3b9b('0x39')](handleError(_0x55cf92,null));};exports[_0x3b9b('0xca')]=function(_0x3eec2e,_0x37cd33){var _0x5293d7={'raw':![],'where':{'id':_0x3eec2e[_0x3b9b('0xcb')]['id']}},_0x73d529={};_0x73d529[_0x3b9b('0x41')]=_[_0x3b9b('0x79')](db['MailInteraction'][_0x3b9b('0x3b')]);_0x73d529[_0x3b9b('0x3e')]=_['keys'](_0x3eec2e[_0x3b9b('0x3e')]);_0x73d529[_0x3b9b('0x3f')]=_[_0x3b9b('0x40')](_0x73d529[_0x3b9b('0x41')],_0x73d529[_0x3b9b('0x3e')]);_0x5293d7[_0x3b9b('0x43')]=_[_0x3b9b('0x40')](_0x73d529['model'],qs[_0x3b9b('0x42')](_0x3eec2e[_0x3b9b('0x3e')][_0x3b9b('0x42')]));_0x5293d7[_0x3b9b('0x43')]=_0x5293d7['attributes'][_0x3b9b('0x61')]?_0x5293d7[_0x3b9b('0x43')]:_0x73d529[_0x3b9b('0x41')];if(_0x3eec2e[_0x3b9b('0x3e')]['includeAll']){_0x5293d7['include']=[{'all':!![]}];}_0x5293d7=_[_0x3b9b('0xa2')]({},_0x5293d7,_0x3eec2e[_0x3b9b('0xcc')]);return db[_0x3b9b('0xa3')][_0x3b9b('0x63')](_0x5293d7)[_0x3b9b('0x29')](handleEntityNotFound(_0x37cd33,null))[_0x3b9b('0x29')](respondWithResult(_0x37cd33,null))[_0x3b9b('0x39')](handleError(_0x37cd33,null));};exports[_0x3b9b('0xcd')]=function(_0x1a01bf,_0x5c1645){return db[_0x3b9b('0xa3')][_0x3b9b('0xcd')](_0x1a01bf[_0x3b9b('0xce')],{})[_0x3b9b('0x29')](respondWithResult(_0x5c1645,0xc9))['catch'](handleError(_0x5c1645,null));};exports[_0x3b9b('0x27')]=function(_0x3b8d3c,_0x219182){if(_0x3b8d3c['body']['id']){delete _0x3b8d3c[_0x3b9b('0xce')]['id'];}return db['MailInteraction'][_0x3b9b('0x63')]({'where':{'id':_0x3b8d3c[_0x3b9b('0xcb')]['id']}})[_0x3b9b('0x29')](handleEntityNotFound(_0x219182,null))[_0x3b9b('0x29')](saveUpdates(_0x3b8d3c[_0x3b9b('0xce')],null))[_0x3b9b('0x29')](respondWithResult(_0x219182,null))['catch'](handleError(_0x219182,null));};exports[_0x3b9b('0x28')]=function(_0x97362a,_0x2db044){return db[_0x3b9b('0xa3')][_0x3b9b('0x63')]({'where':{'id':_0x97362a[_0x3b9b('0xcb')]['id']}})[_0x3b9b('0x29')](handleEntityNotFound(_0x2db044,null))[_0x3b9b('0x29')](removeEntity(_0x2db044,null))[_0x3b9b('0x39')](handleError(_0x2db044,null));};exports[_0x3b9b('0xcf')]=function(_0xf6333a,_0x3e32a7){return db[_0x3b9b('0xa3')][_0x3b9b('0xcf')]()[_0x3b9b('0x29')](respondWithResult(_0x3e32a7,null))[_0x3b9b('0x39')](handleError(_0x3e32a7,null));};exports[_0x3b9b('0xd0')]=function(_0x56aaba,_0x8246ff,_0x23d6c8){return db[_0x3b9b('0xd1')][_0x3b9b('0x63')]({'where':{'id':_0x56aaba[_0x3b9b('0xcb')]['id']}})['then'](handleEntityNotFound(_0x8246ff,null))[_0x3b9b('0x29')](function(_0x494c08){if(_0x494c08){return _0x494c08['addMessage'](_0x56aaba[_0x3b9b('0xce')]['ids'],_[_0x3b9b('0xd2')](_0x56aaba[_0x3b9b('0xce')],[_0x3b9b('0xd3'),'id'])||{});}})[_0x3b9b('0x29')](respondWithResult(_0x8246ff,null))[_0x3b9b('0x39')](handleError(_0x8246ff,null));};exports['getMessages']=function(_0x36ba6e,_0x568a88,_0x551630){var _0x5abcbc={'raw':![],'where':{}};var _0x53c03c={};var _0x582386={'count':0x0,'rows':[]};return db[_0x3b9b('0xa3')][_0x3b9b('0x35')]({'where':{'id':_0x36ba6e[_0x3b9b('0xcb')]['id']}})[_0x3b9b('0x29')](handleEntityNotFound(_0x568a88,null))['then'](function(_0x5556ca){if(_0x5556ca){_0x53c03c[_0x3b9b('0x41')]=_['keys'](db[_0x3b9b('0xd1')][_0x3b9b('0x3b')]);_0x53c03c[_0x3b9b('0x3e')]=_[_0x3b9b('0x79')](_0x36ba6e[_0x3b9b('0x3e')]);_0x53c03c[_0x3b9b('0x3f')]=_[_0x3b9b('0x40')](_0x53c03c[_0x3b9b('0x41')],_0x53c03c[_0x3b9b('0x3e')]);_0x5abcbc[_0x3b9b('0x43')]=_[_0x3b9b('0x40')](_0x53c03c[_0x3b9b('0x41')],qs['fields'](_0x36ba6e[_0x3b9b('0x3e')][_0x3b9b('0x42')]));_0x5abcbc[_0x3b9b('0x43')]=_0x5abcbc['attributes'][_0x3b9b('0x61')]?_0x5abcbc[_0x3b9b('0x43')]:_0x53c03c['model'];if(!_0x36ba6e[_0x3b9b('0x3e')][_0x3b9b('0x44')]('nolimit')){_0x5abcbc[_0x3b9b('0x46')]=qs[_0x3b9b('0x46')](_0x36ba6e[_0x3b9b('0x3e')][_0x3b9b('0x46')]);_0x5abcbc[_0x3b9b('0x22')]=qs[_0x3b9b('0x22')](_0x36ba6e[_0x3b9b('0x3e')][_0x3b9b('0x22')]);}_0x5abcbc[_0x3b9b('0x93')]=qs[_0x3b9b('0x47')](_0x36ba6e[_0x3b9b('0x3e')][_0x3b9b('0x47')]);_0x5abcbc[_0x3b9b('0x48')]=qs[_0x3b9b('0x3f')](_[_0x3b9b('0xd4')](_0x36ba6e['query'],_0x53c03c[_0x3b9b('0x3f')]));_0x5abcbc[_0x3b9b('0x48')]['MailInteractionId']=_0x5556ca['id'];if(_0x36ba6e[_0x3b9b('0x3e')]['filter']){_0x5abcbc[_0x3b9b('0x48')]=_[_0x3b9b('0xa2')](_0x5abcbc[_0x3b9b('0x48')],{'$or':_[_0x3b9b('0x30')](_0x5abcbc[_0x3b9b('0x43')],function(_0x342e3e){var _0x110b57={};_0x110b57[_0x342e3e]={'$like':'%'+_0x36ba6e[_0x3b9b('0x3e')][_0x3b9b('0xd5')]+'%'};return _0x110b57;})});}if(_0x36ba6e[_0x3b9b('0x3e')][_0x3b9b('0x7f')]){var _0x5aefe1=_0x36ba6e[_0x3b9b('0x3e')][_0x3b9b('0x7f')]['split'](',');var _0x5cf4dd={};_0x5cf4dd[_0x5aefe1[0x0]]={'$gte':moment(_0x5aefe1[0x1])['format'](_0x3b9b('0xd6'))};_0x5abcbc[_0x3b9b('0x48')]=_['merge'](_0x5abcbc[_0x3b9b('0x48')],_0x5cf4dd);}_0x5abcbc=_[_0x3b9b('0xa2')]({},_0x5abcbc,_0x36ba6e['options']);return db[_0x3b9b('0xd1')][_0x3b9b('0x21')]({'where':_0x5abcbc['where']})[_0x3b9b('0x29')](function(_0x14ef8d){_0x582386[_0x3b9b('0x21')]=_0x14ef8d;if(_0x36ba6e[_0x3b9b('0x3e')][_0x3b9b('0xd7')]){_0x5abcbc[_0x3b9b('0xd8')]=[{'all':!![]}];}return db[_0x3b9b('0xd1')][_0x3b9b('0xd9')](_0x5abcbc);})[_0x3b9b('0x29')](function(_0x185491){_0x582386['rows']=_0x185491;return _0x582386;});}})['then'](respondWithFilteredResult(_0x568a88,_0x5abcbc))[_0x3b9b('0x39')](handleError(_0x568a88,null));};exports['addTags']=function(_0x366ea8,_0x365db9,_0x1cc216){return db[_0x3b9b('0xa3')][_0x3b9b('0x63')]({'where':{'id':_0x366ea8[_0x3b9b('0xcb')]['id']}})[_0x3b9b('0x29')](handleEntityNotFound(_0x365db9,null))[_0x3b9b('0x29')](function(_0xddc554){if(_0xddc554){return _0xddc554[_0x3b9b('0xda')](_0x366ea8['body'][_0x3b9b('0xd3')],_[_0x3b9b('0xd2')](_0x366ea8[_0x3b9b('0xce')],[_0x3b9b('0xd3'),'id'])||{})[_0x3b9b('0xdb')](function(){return db[_0x3b9b('0x6f')][_0x3b9b('0xd9')]({'attributes':['id',_0x3b9b('0x2d'),_0x3b9b('0x4b')],'where':{'id':_0x366ea8[_0x3b9b('0xce')][_0x3b9b('0xd3')]}});})[_0x3b9b('0x29')](function(_0x5647e9){socket[_0x3b9b('0xdc')](_0x3b9b('0xdd'),{'id':Number(_0x366ea8[_0x3b9b('0xcb')]['id']),'tags':_0x5647e9||[]});return{'id':Number(_0x366ea8['params']['id']),'tags':_0x5647e9||[]};});}})[_0x3b9b('0x29')](respondWithResult(_0x365db9,null))[_0x3b9b('0x39')](handleError(_0x365db9,null));};exports['removeTags']=function(_0x59ffc0,_0x143f4c,_0x2006b6){return db['MailInteraction'][_0x3b9b('0x63')]({'where':{'id':_0x59ffc0[_0x3b9b('0xcb')]['id']}})[_0x3b9b('0x29')](handleEntityNotFound(_0x143f4c,null))[_0x3b9b('0x29')](function(_0x4827a8){if(_0x4827a8){return _0x4827a8[_0x3b9b('0xde')](_0x59ffc0[_0x3b9b('0x3e')][_0x3b9b('0xd3')]);}})[_0x3b9b('0x29')](respondWithStatusCode(_0x143f4c,null))['catch'](handleError(_0x143f4c,null));};exports[_0x3b9b('0xdf')]=function(_0x35ed1d,_0x204a34){var _0x5440bc=moment()[_0x3b9b('0xe0')]()[_0x3b9b('0xa0')]();var _0xf84c51=path['join'](config[_0x3b9b('0xe1')],_0x3b9b('0xe2'),'files',_0x3b9b('0xe3'));var _0x488e56=path[_0x3b9b('0xe4')](config['root'],'server','files','attachments');var _0x426cd5=path[_0x3b9b('0xe4')](_0xf84c51,_0x5440bc);var _0x5aebe4=util[_0x3b9b('0xe5')](_0x3b9b('0xe6'),_0x35ed1d['params']['id'],_0x5440bc);var _0x1241bb=path[_0x3b9b('0xe4')](_0xf84c51,_0x5aebe4);var _0x2dcd09=[];if(_0x35ed1d['query'][_0x3b9b('0xe7')]){_0x2dcd09[_0x3b9b('0x34')]({'model':db[_0x3b9b('0xe8')],'as':'Attachments','raw':!![]});}var _0x3f1d18=[{'model':db[_0x3b9b('0xd1')],'as':_0x3b9b('0xe9'),'attributes':['id',_0x3b9b('0xce'),_0x3b9b('0x4c'),'to','cc',_0x3b9b('0xea'),_0x3b9b('0xeb'),_0x3b9b('0x7d')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x2dcd09}];return db['MailInteraction'][_0x3b9b('0x63')]({'where':{'id':_0x35ed1d[_0x3b9b('0xcb')]['id']},'include':_0x3f1d18})[_0x3b9b('0x29')](handleEntityNotFound(_0x204a34,null))[_0x3b9b('0x29')](function(_0x41e4cb){if(_0x41e4cb&&_0x41e4cb[_0x3b9b('0xe9')]){var _0x5698b8=_0x41e4cb['get']({'plain':!![]});fs['mkdirSync'](_0x426cd5);return BPromise[_0x3b9b('0xec')](_0x5698b8[_0x3b9b('0xe9')],function(_0x58ca34,_0x248a0a){var _0x413462={'from':_0x58ca34[_0x3b9b('0x4c')],'to':_0x58ca34['to'],'subject':_0x58ca34[_0x3b9b('0xeb')],'html':_0x58ca34['body'],'headers':{'Date':moment(_0x58ca34[_0x3b9b('0x7d')])[_0x3b9b('0xe5')](_0x3b9b('0xed'))},'attachments':[]};if(_0x58ca34['cc']){_0x413462['headers']['Cc']=_0x58ca34['cc'];}if(_0x58ca34[_0x3b9b('0xea')]){_0x413462[_0x3b9b('0xee')][_0x3b9b('0xef')]=_0x58ca34[_0x3b9b('0xea')];}return new BPromise(function(_0x3eb340,_0x294058){if(_0x58ca34[_0x3b9b('0xf0')]){for(var _0x26253a=0x0;_0x26253a<_0x58ca34[_0x3b9b('0xf0')][_0x3b9b('0x61')];_0x26253a++){var _0x1a5f21=_0x58ca34[_0x3b9b('0xf0')][_0x26253a];var _0xae91a6=path[_0x3b9b('0xe4')](_0x488e56,_0x1a5f21['basename']);if(fs['existsSync'](_0xae91a6)){_0x413462[_0x3b9b('0xe7')][_0x3b9b('0x34')]({'name':_0x1a5f21[_0x3b9b('0x2d')],'contentType':_0x1a5f21['type'],'data':fs[_0x3b9b('0xf1')](_0xae91a6)});}}}emlformat[_0x3b9b('0xf2')](_0x413462,function(_0x3cbdc1,_0x14f251){if(_0x3cbdc1)return _0x294058(_0x3cbdc1);fs[_0x3b9b('0xf3')](path[_0x3b9b('0xe4')](_0x426cd5,util['format'](_0x3b9b('0xf4'),_0x248a0a)),_0x14f251);return _0x3eb340(_0x14f251);});});})[_0x3b9b('0x29')](function(){return new BPromise(function(_0x48dcfc,_0x2f83b7){zipdir(_0x426cd5,{'saveTo':_0x1241bb},function(_0x435848,_0x33d2e6){if(_0x435848)return _0x2f83b7(_0x435848);return _0x48dcfc(_0x33d2e6);});})[_0x3b9b('0x29')](function(){return new BPromise(function(_0x4c528a,_0x50f658){rimraf(_0x426cd5,function(_0x2bd94a){if(_0x2bd94a)_0x50f658(_0x2bd94a);return _0x4c528a();});});})['then'](function(){return _0x204a34['download'](_0x1241bb,_0x5aebe4,function(_0x4dfd86){if(_0x4dfd86){console['log'](_0x3b9b('0xf5'),_0x4dfd86);}else{fs['unlinkSync'](_0x1241bb);}});});});}else{return _0x204a34[_0x3b9b('0x2a')](0xc8);}})[_0x3b9b('0x39')](handleError(_0x204a34,null));}; \ No newline at end of file +var _0x1416=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','conditions','length','find','unreadMessages','`\x20>\x200','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','MailAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.substatus','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','params','includeAll','include','merge','options','create','body','describe','addMessage','omit','ids','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','findAll','addTags','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','get','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','writeFileSync','message%d.eml','log','unlinkSync','html-pdf','rimraf'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0x1416,0xec));var _0x6141=function(_0x40451c,_0x248652){_0x40451c=_0x40451c-0x0;var _0x2c11f4=_0x1416[_0x40451c];return _0x2c11f4;};'use strict';var pdf=require(_0x6141('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6141('0x1'));var zipdir=require(_0x6141('0x2'));var jsonpatch=require(_0x6141('0x3'));var rp=require(_0x6141('0x4'));var moment=require('moment');var BPromise=require(_0x6141('0x5'));var Mustache=require(_0x6141('0x6'));var util=require(_0x6141('0x7'));var path=require(_0x6141('0x8'));var sox=require(_0x6141('0x9'));var csv=require(_0x6141('0xa'));var ejs=require(_0x6141('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6141('0xc'));var crypto=require('crypto');var jsforce=require(_0x6141('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6141('0xa'));var querystring=require(_0x6141('0xe'));var Papa=require(_0x6141('0xf'));var htmlToText=require(_0x6141('0x10'));var Redis=require(_0x6141('0x11'));var authService=require(_0x6141('0x12'));var qs=require(_0x6141('0x13'));var as=require(_0x6141('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6141('0x15'));var utils=require('../../config/utils');var config=require(_0x6141('0x16'));var licenseUtil=require(_0x6141('0x17'));var db=require(_0x6141('0x18'))['db'];config[_0x6141('0x19')]=_[_0x6141('0x1a')](config[_0x6141('0x19')],{'host':_0x6141('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6141('0x19')]));require(_0x6141('0x1c'))[_0x6141('0x1d')](socket);function respondWithStatusCode(_0x201961,_0xa51354){_0xa51354=_0xa51354||0xcc;return function(_0x30d2e1){if(_0x30d2e1){return _0x201961[_0x6141('0x1e')](_0xa51354);}return _0x201961[_0x6141('0x1f')](_0xa51354)[_0x6141('0x20')]();};}function respondWithResult(_0x3f8c60,_0x5763dc){_0x5763dc=_0x5763dc||0xc8;return function(_0xe8af1b){if(_0xe8af1b){return _0x3f8c60[_0x6141('0x1f')](_0x5763dc)[_0x6141('0x21')](_0xe8af1b);}};}function respondWithFilteredResult(_0x55d124,_0x133d13){return function(_0x5e7dae){if(_0x5e7dae){var _0x3de180=_0x5e7dae[_0x6141('0x22')],_0x434e40=_0x133d13[_0x6141('0x23')],_0x2f50bb=_0x133d13['offset']+_0x133d13[_0x6141('0x24')],_0x509d2e;if(_0x2f50bb>=_0x3de180){_0x2f50bb=_0x3de180;_0x509d2e=0xc8;}else{_0x509d2e=0xce;}_0x55d124['status'](_0x509d2e);return _0x55d124[_0x6141('0x25')]('Content-Range',_0x434e40+'-'+_0x2f50bb+'/'+_0x3de180)['json'](_0x5e7dae);}return null;};}function patchUpdates(_0x2c92a8){return function(_0x378928){try{jsonpatch[_0x6141('0x26')](_0x378928,_0x2c92a8,!![]);}catch(_0x3f0b2f){return BPromise['reject'](_0x3f0b2f);}return _0x378928[_0x6141('0x27')]();};}function saveUpdates(_0x538006,_0x27db12){return function(_0x47d021){if(_0x47d021){return _0x47d021[_0x6141('0x28')](_0x538006)['then'](function(_0x3cee79){return _0x3cee79;});}return null;};}function removeEntity(_0x539001,_0x2181a0){return function(_0x437bc4){if(_0x437bc4){return _0x437bc4[_0x6141('0x29')]()[_0x6141('0x2a')](function(){_0x539001[_0x6141('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2aa9,_0x26e4ce){return function(_0x3db6ad){if(!_0x3db6ad){_0x5b2aa9[_0x6141('0x1e')](0x194);}return _0x3db6ad;};}function handleError(_0xd24387,_0x391f37){_0x391f37=_0x391f37||0x1f4;return function(_0xc0fd0c){logger[_0x6141('0x2b')](_0xc0fd0c[_0x6141('0x2c')]);if(_0xc0fd0c[_0x6141('0x2d')]){delete _0xc0fd0c[_0x6141('0x2d')];}_0xd24387[_0x6141('0x1f')](_0x391f37)[_0x6141('0x2e')](_0xc0fd0c);};}function getInteractionUsers(_0xa0bee6,_0x12ab77){return new BPromise(function(_0x525950,_0x16c019){try{if(_0x12ab77[_0xa0bee6['id']]){_0xa0bee6[_0x6141('0x2f')]=_[_0x6141('0x30')](_0x12ab77[_0xa0bee6['id']],function(_0x21a7f0){return{'id':_0x21a7f0['id'],'fullname':_0x21a7f0[_0x6141('0x31')]};});}}catch(_0x45f867){_0x16c019(_0x45f867);}_0x525950(_0xa0bee6);});}function getInteractionTags(_0x1705c7,_0x17b9ca){return new BPromise(function(_0x5dc0aa,_0x1b1c2f){try{if(_0x1705c7[_0x6141('0x32')]){_0x1705c7['Tags']=[];_0x1705c7[_0x6141('0x32')]['split'](',')[_0x6141('0x33')](function(_0x4dac7f){_0x1705c7[_0x6141('0x34')][_0x6141('0x35')](_0x17b9ca[_0x4dac7f]);});}delete _0x1705c7['TagIds'];}catch(_0x27fd99){_0x1b1c2f(_0x27fd99);}_0x5dc0aa(_0x1705c7);});}function getLastMessageText(_0x5884de){return new BPromise(function(_0x12801b,_0x3efb83){return db[_0x6141('0x36')][_0x6141('0x37')]({'where':{'id':_0x5884de['id']},'attributes':['lastMsgBody',_0x6141('0x38')],'raw':!![]})[_0x6141('0x2a')](function(_0x49f07d){if(!_0x49f07d[_0x6141('0x38')]){_0x5884de[_0x6141('0x38')]=_[_0x6141('0x39')](htmlToText[_0x6141('0x3a')](_0x49f07d[_0x6141('0x3b')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x5884de[_0x6141('0x38')]=_0x49f07d[_0x6141('0x38')];}_0x12801b(_0x5884de);})[_0x6141('0x3c')](function(_0x2b0d8e){_0x3efb83(_0x2b0d8e);});});}function updateMailInteraction(_0x26d945,_0x9a9008,_0xe2e97f,_0x3e946f){return new BPromise(function(_0x225e07,_0x2178df){return getInteractionUsers(_0x26d945,_0xe2e97f)['then'](function(_0x639b05){return getInteractionTags(_0x639b05,_0x9a9008);})['then'](function(_0x5873da){if(_0x3e946f){_0x225e07(getLastMessageText(_0x5873da));}else{_0x225e07(_0x5873da);}})['catch'](function(_0x12a045){_0x2178df(_0x12a045);});});}exports[_0x6141('0x3d')]=function(_0x5d4b63,_0x152f67){var _0xebd6ca={},_0xd537f9={},_0x599b38={'count':0x0,'rows':[]};var _0x355885=_[_0x6141('0x30')](db['MailInteraction'][_0x6141('0x3e')],function(_0x5abff0){return{'name':_0x5abff0[_0x6141('0x3f')],'type':_0x5abff0[_0x6141('0x40')]['key']};});_0xd537f9['model']=_[_0x6141('0x30')](_0x355885,'name');_0xd537f9['query']=_[_0x6141('0x41')](_0x5d4b63['query']);_0xd537f9[_0x6141('0x42')]=_[_0x6141('0x43')](_0xd537f9[_0x6141('0x44')],_0xd537f9['query']);_0xebd6ca[_0x6141('0x45')]=_[_0x6141('0x43')](_0xd537f9[_0x6141('0x44')],qs[_0x6141('0x46')](_0x5d4b63[_0x6141('0x47')]['fields']));_0xebd6ca['attributes']=_0xebd6ca[_0x6141('0x45')]['length']?_0xebd6ca['attributes']:_0xd537f9[_0x6141('0x44')];if(!_0x5d4b63['query'][_0x6141('0x48')](_0x6141('0x49'))){_0xebd6ca[_0x6141('0x24')]=qs[_0x6141('0x24')](_0x5d4b63[_0x6141('0x47')][_0x6141('0x24')]);_0xebd6ca[_0x6141('0x23')]=qs[_0x6141('0x23')](_0x5d4b63[_0x6141('0x47')]['offset']);}_0xebd6ca[_0x6141('0x4a')]=qs['sort'](_0x5d4b63[_0x6141('0x47')][_0x6141('0x4b')]);_0xebd6ca[_0x6141('0x4c')]=qs[_0x6141('0x42')](_['pick'](_0x5d4b63[_0x6141('0x47')],_0xd537f9[_0x6141('0x42')]),_0x355885);var _0x4a4462=[];var _0x278f7d=squel[_0x6141('0x4d')]()[_0x6141('0x4e')]('id')[_0x6141('0x4e')]('name')[_0x6141('0x4e')](_0x6141('0x4f'))[_0x6141('0x50')]('tools_tags');var _0x152f0f=squel[_0x6141('0x4d')]()[_0x6141('0x4e')](_0x6141('0x51'))['field'](_0x6141('0x52'))[_0x6141('0x4e')](_0x6141('0x53'))['from'](_0x6141('0x54'),'ui')[_0x6141('0x55')]('users','u',_0x6141('0x56'));var _0x58573a=squel[_0x6141('0x4d')]()[_0x6141('0x50')](_0x6141('0x57'),'i')[_0x6141('0x55')](_0x6141('0x58'),'c',_0x6141('0x59'))['left_join'](_0x6141('0x5a'),'o',_0x6141('0x5b'))[_0x6141('0x55')](_0x6141('0x5c'),'a','a.id\x20=\x20i.MailAccountId')[_0x6141('0x55')]('mail_messages','me',_0x6141('0x5d'))[_0x6141('0x55')](_0x6141('0x5e'),'it',_0x6141('0x5f'))[_0x6141('0x55')](_0x6141('0x60'),'t',_0x6141('0x61'));var _0x17a141=squel[_0x6141('0x62')]();var _0x474fd4=[];var _0x188889=squel[_0x6141('0x62')]();var _0x2ab0be;if(_0x5d4b63[_0x6141('0x47')][_0x6141('0x63')]){_0x2ab0be=as['parseSearch'](_0x5d4b63['query']['search']);var _0x15fe43=_0x2ab0be['sqlOperator'];for(var _0x525ddd=0x0;_0x525ddd<_0x2ab0be[_0x6141('0x64')][_0x6141('0x65')];_0x525ddd++){var _0x1009bc=_0x2ab0be[_0x6141('0x64')][_0x525ddd];var _0x5a87ff='i';var _0x1c9183=_[_0x6141('0x66')](_0x355885,['name',_0x1009bc['field']]);if(!_0x1c9183){switch(_0x1009bc[_0x6141('0x4e')]){case _0x6141('0x67'):if(_0x1009bc['value']==0x1){_0x58573a['having']('`'+_0x1009bc[_0x6141('0x4e')]+'`\x20=\x200');}else{_0x58573a['having']('`'+_0x1009bc[_0x6141('0x4e')]+_0x6141('0x68'));}break;case'Contact':if(_0x1009bc[_0x6141('0x69')]===_0x6141('0x6a')){if(_0x1009bc[_0x6141('0x6b')][_0x6141('0x6c')]('\x20')[_0x6141('0x65')]>0x1){_0x17a141[_0x15fe43](_0x6141('0x6d'),qs[_0x6141('0x6e')](_0x1009bc['value']),null);}else{var _0x3f8b21='%'+_0x1009bc[_0x6141('0x6b')]+'%';_0x17a141[_0x15fe43]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3f8b21,_0x3f8b21,_0x3f8b21);}}else{_0x1c9183=_[_0x6141('0x66')](_0x355885,[_0x6141('0x2d'),_0x6141('0x6f')]);_0x1009bc[_0x6141('0x4e')]=_0x6141('0x6f');_0x4a08fa=as[_0x6141('0x70')](_0x5a87ff,_0x1c9183['type'],_0x1009bc);_0x17a141[_0x15fe43](_0x4a08fa[_0x6141('0x71')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x72')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x20')]);}break;case _0x6141('0x73'):var _0x1be31a=_0x1009bc[_0x6141('0x6b')][_0x6141('0x6c')](',')[_0x6141('0x30')](function(_0x4773f2){return Number(_0x4773f2);});_0x1be31a['forEach'](function(_0x1e6ed7){_0x188889['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1e6ed7+',%');});_0x474fd4=_['union'](_0x474fd4,_0x1be31a);break;case _0x6141('0x74'):if(_0x1009bc[_0x6141('0x69')]===_0x6141('0x6a')){_0x17a141[_0x15fe43](_0x6141('0x75'),'%'+_0x1009bc['value']+'%',null);}else{_0x1c9183=_[_0x6141('0x66')](_0x355885,[_0x6141('0x2d'),_0x6141('0x76')]);_0x1009bc[_0x6141('0x4e')]='UserId';_0x4a08fa=as[_0x6141('0x70')](_0x5a87ff,_0x1c9183[_0x6141('0x40')],_0x1009bc);_0x17a141[_0x15fe43](_0x4a08fa['text'],_0x4a08fa['value'][_0x6141('0x72')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x20')]);}break;case'plainBody':_0x4a08fa=as[_0x6141('0x70')]('me',null,_0x1009bc);_0x17a141[_0x15fe43](_0x4a08fa[_0x6141('0x71')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x72')],_0x4a08fa['value']['end']);break;}}else{var _0x4a08fa=as[_0x6141('0x70')](_0x5a87ff,_0x1c9183[_0x6141('0x40')],_0x1009bc);_0x17a141[_0x15fe43](_0x4a08fa[_0x6141('0x71')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x72')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x20')]);}}}else{var _0x1535ae=_(_0x5d4b63[_0x6141('0x47')])[_0x6141('0x41')]()['map'](function(_0x403d64){return _[_0x6141('0x77')](_0x355885,[_0x6141('0x2d'),_0x403d64])?_0x403d64:undefined;})[_0x6141('0x78')]()[_0x6141('0x6b')]();if(!_[_0x6141('0x79')](_0x1535ae)){_0x1535ae[_0x6141('0x33')](function(_0x39cf73){if(_0x39cf73===_0x6141('0x7a')){_0x58573a[_0x6141('0x4c')]('i.MailAccountId\x20IN\x20?',[][_0x6141('0x7b')](_0x5d4b63[_0x6141('0x47')][_0x39cf73]));}else if(_0x39cf73===_0x6141('0x7c')){var _0x19305d=JSON[_0x6141('0x7d')](_0x5d4b63['query'][_0x39cf73])['$gte'];var _0xcdef30=JSON[_0x6141('0x7d')](_0x5d4b63[_0x6141('0x47')][_0x39cf73])[_0x6141('0x7e')];_0x58573a['where'](_0x6141('0x7f'),_0x19305d,_0xcdef30);}else{if(_0x5d4b63[_0x6141('0x47')][_0x39cf73]==='null'){_0x58573a[_0x6141('0x4c')]('i.'+_0x39cf73+_0x6141('0x80'));}else{_0x58573a[_0x6141('0x4c')]('i.'+_0x39cf73+_0x6141('0x81'),_0x5d4b63[_0x6141('0x47')][_0x39cf73]);}}});}if(_0x5d4b63[_0x6141('0x47')][_0x6141('0x82')]){if(_0x5d4b63[_0x6141('0x47')]['read']==0x1){_0x58573a[_0x6141('0x83')](_0x6141('0x84'));}else{_0x58573a['having']('`unreadMessages`\x20>\x200');}}if(_0x5d4b63['query'][_0x6141('0x85')]){_0x474fd4=_[_0x6141('0x86')](_0x5d4b63[_0x6141('0x47')][_0x6141('0x85')])?_0x5d4b63[_0x6141('0x47')][_0x6141('0x85')]:new Array(_0x5d4b63['query'][_0x6141('0x85')]);_0x474fd4[_0x6141('0x33')](function(_0x58a34e){_0x188889['or'](_0x6141('0x87'),'%,'+_0x58a34e+',%');});}if(_0x5d4b63[_0x6141('0x47')]['filter']){var _0x427bc7=_0x5d4b63[_0x6141('0x47')]['filter'][_0x6141('0x88')]('\x5c','\x5c\x5c')[_0x6141('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x427bc7)){_0x17a141['or'](_0x6141('0x89'),_0x427bc7+'%');}else if(qs[_0x6141('0x8a')](_0x427bc7)){_0x17a141['or'](_0x6141('0x8b'),_0x427bc7+'%');}else{_0x17a141['or'](_0x6141('0x8c'),qs['getFullTextValue'](_0x427bc7))['or'](_0x6141('0x8d'),qs[_0x6141('0x6e')](_0x427bc7));}}}_0x58573a[_0x6141('0x4c')](_0x17a141);_0x58573a[_0x6141('0x8e')](_0x6141('0x8f'));var _0x2e86d0={'type':db[_0x6141('0x90')][_0x6141('0x91')][_0x6141('0x92')],'raw':!![]};var _0xd374c3=_0x58573a[_0x6141('0x93')]();_0xd374c3[_0x6141('0x4e')](_0x6141('0x8f'));_0xd374c3[_0x6141('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6141('0x67'));if(_0xebd6ca[_0x6141('0x4a')]){_0xebd6ca[_0x6141('0x4a')]['forEach'](function(_0x2357bd){var _0x562fae=_0x2357bd[0x0]==='contactName'?_0x2357bd[0x0]:'i.'+_0x2357bd[0x0];_0x58573a[_0x6141('0x4a')](_0x562fae,_0x2357bd[0x1]===_0x6141('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x474fd4)){_0x58573a['having'](_0x188889);_0xd374c3['where'](_0x6141('0x95'),_0x474fd4);}BPromise[_0x6141('0x96')]()[_0x6141('0x2a')](function(){if(!_0x2ab0be){if(_0x5d4b63[_0x6141('0x47')][_0x6141('0x7a')]||_0x5d4b63['query'][_0x6141('0x97')])return;_0xd374c3[_0x6141('0x4c')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x58573a[_0x6141('0x4c')](_0x6141('0x98'));return;}if(_0x5d4b63['user'][_0x6141('0x99')]!==_0x6141('0x9a'))return;return _0x5d4b63['user'][_0x6141('0x9b')]({'attributes':['id'],'raw':!![]})[_0x6141('0x2a')](function(_0x23b824){if(_[_0x6141('0x79')](_0x23b824)){_0xd374c3[_0x6141('0x4c')]('i.MailAccountId\x20IS\x20NULL');_0x58573a[_0x6141('0x4c')](_0x6141('0x9c'));}else{_0xd374c3[_0x6141('0x4c')](_0x6141('0x9d'),_[_0x6141('0x30')](_0x23b824,'id'));_0x58573a[_0x6141('0x4c')](_0x6141('0x9d'),_[_0x6141('0x30')](_0x23b824,'id'));}});})[_0x6141('0x2a')](function(){if(_0x5d4b63['user']['role']===_0x6141('0x9a')&&!_0x2ab0be&&!_0x5d4b63[_0x6141('0x47')]['MailAccountId'])return[];return db[_0x6141('0x9e')]['query'](_0xd374c3['toString'](),_0x2e86d0);})[_0x6141('0x2a')](function(_0x56036f){_0x599b38[_0x6141('0x22')]=_0x56036f[_0x6141('0x65')];if(_0x599b38[_0x6141('0x22')]===0x0)return[];return db[_0x6141('0x9e')]['query'](_0x278f7d[_0x6141('0x9f')](),_0x2e86d0)['then'](function(_0x408789){_0x4a4462=_['keyBy'](_0x408789,'id');_0x2e86d0=_['merge'](_0x2e86d0,{'model':db[_0x6141('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d4b63['query']['fields']){_0xebd6ca[_0x6141('0x45')]['forEach'](function(_0x404e90){_0x58573a[_0x6141('0x4e')]('i.'+_0x404e90);});}else{_0x58573a[_0x6141('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6141('0x67'));_0x58573a[_0x6141('0x4e')](_0x6141('0xa0'),_0x6141('0xa1'));_0x58573a['field']('a.mandatoryDisposition',_0x6141('0xa2'));_0x58573a['field'](_0x6141('0xa3'),_0x6141('0xa4'));_0x58573a[_0x6141('0x4e')]('i.id');_0x58573a[_0x6141('0x4e')](_0x6141('0xa5'));_0x58573a['field'](_0x6141('0xa6'));_0x58573a[_0x6141('0x4e')]('i.closed');_0x58573a['field'](_0x6141('0xa7'));_0x58573a[_0x6141('0x4e')](_0x6141('0xa8'));_0x58573a[_0x6141('0x4e')](_0x6141('0xa9'));_0x58573a[_0x6141('0x4e')]('i.lastMsgDirection');_0x58573a[_0x6141('0x4e')](_0x6141('0xaa'));_0x58573a[_0x6141('0x4e')](_0x6141('0xab'));_0x58573a[_0x6141('0x4e')](_0x6141('0xac'));_0x58573a['field']('i.thirdDisposition');_0x58573a['field'](_0x6141('0xad'));_0x58573a[_0x6141('0x4e')]('i.to');_0x58573a[_0x6141('0x4e')]('i.ContactId');_0x58573a['field'](_0x6141('0xae'));_0x58573a[_0x6141('0x4e')](_0x6141('0xaf'));_0x58573a[_0x6141('0x4e')]('c.firstName',_0x6141('0xb0'));_0x58573a['field']('c.lastName',_0x6141('0xb1'));_0x58573a['field']('c.email',_0x6141('0xb2'));_0x58573a[_0x6141('0x4e')]('c.phone',_0x6141('0xb3'));_0x58573a[_0x6141('0x4e')](_0x6141('0xb4'),'Contact.mobile');_0x58573a[_0x6141('0x4e')]('c.fax',_0x6141('0xb5'));_0x58573a[_0x6141('0x4e')](_0x6141('0xb6'),_0x6141('0xb7'));_0x58573a[_0x6141('0x4e')](_0x6141('0xb8'),_0x6141('0xb9'));_0x58573a[_0x6141('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6141('0x32'));}if(_0xebd6ca[_0x6141('0x24')])_0x58573a[_0x6141('0x24')](_0xebd6ca[_0x6141('0x24')]);if(_0xebd6ca[_0x6141('0x23')])_0x58573a[_0x6141('0x23')](_0xebd6ca[_0x6141('0x23')]);return db[_0x6141('0x9e')][_0x6141('0x47')](_0x58573a['toString'](),_0x2e86d0);})['then'](function(_0xecde2){_0x152f0f[_0x6141('0x4c')]('ui.MailInteractionId\x20IN\x20?',_[_0x6141('0x30')](_0xecde2,'id'));return db['sequelize']['query'](_0x152f0f[_0x6141('0x9f')](),_0x2e86d0)[_0x6141('0x2a')](function(_0x5cc4f1){var _0x63e8ac=_[_0x6141('0xba')](_0x5cc4f1,_0x6141('0xbb'));var _0x3cb075=[];return db[_0x6141('0xbc')][_0x6141('0x37')]({'attributes':[_0x6141('0xbd')],'raw':!![]})[_0x6141('0x2a')](function(_0x153385){var _0x1eb671=_0x153385['enableEmailPreview'];_0xecde2['forEach'](function(_0x54b00c){_0x3cb075['push'](updateMailInteraction(_0x54b00c,_0x4a4462,_0x63e8ac,_0x1eb671));});return BPromise[_0x6141('0xbe')](_0x3cb075);});});});})[_0x6141('0x2a')](function(_0x21041d){_0x599b38[_0x6141('0xbf')]=_0x21041d;return _0x599b38;})[_0x6141('0x2a')](respondWithFilteredResult(_0x152f67,_0xebd6ca))[_0x6141('0x3c')](handleError(_0x152f67,null));};exports['show']=function(_0x4197bf,_0x117c9e){var _0x504ce6={'raw':![],'where':{'id':_0x4197bf[_0x6141('0xc0')]['id']}},_0x2513b2={};_0x2513b2['model']=_[_0x6141('0x41')](db[_0x6141('0x36')][_0x6141('0x3e')]);_0x2513b2[_0x6141('0x47')]=_[_0x6141('0x41')](_0x4197bf[_0x6141('0x47')]);_0x2513b2['filters']=_[_0x6141('0x43')](_0x2513b2['model'],_0x2513b2[_0x6141('0x47')]);_0x504ce6['attributes']=_[_0x6141('0x43')](_0x2513b2['model'],qs['fields'](_0x4197bf[_0x6141('0x47')][_0x6141('0x46')]));_0x504ce6[_0x6141('0x45')]=_0x504ce6[_0x6141('0x45')][_0x6141('0x65')]?_0x504ce6[_0x6141('0x45')]:_0x2513b2['model'];if(_0x4197bf['query'][_0x6141('0xc1')]){_0x504ce6[_0x6141('0xc2')]=[{'all':!![]}];}_0x504ce6=_[_0x6141('0xc3')]({},_0x504ce6,_0x4197bf[_0x6141('0xc4')]);return db[_0x6141('0x36')][_0x6141('0x66')](_0x504ce6)[_0x6141('0x2a')](handleEntityNotFound(_0x117c9e,null))['then'](respondWithResult(_0x117c9e,null))[_0x6141('0x3c')](handleError(_0x117c9e,null));};exports[_0x6141('0xc5')]=function(_0x3d28af,_0x215ab7){return db[_0x6141('0x36')]['create'](_0x3d28af['body'],{})['then'](respondWithResult(_0x215ab7,0xc9))[_0x6141('0x3c')](handleError(_0x215ab7,null));};exports[_0x6141('0x28')]=function(_0x833089,_0x44c48b){if(_0x833089[_0x6141('0xc6')]['id']){delete _0x833089['body']['id'];}return db[_0x6141('0x36')][_0x6141('0x66')]({'where':{'id':_0x833089['params']['id']}})['then'](handleEntityNotFound(_0x44c48b,null))[_0x6141('0x2a')](saveUpdates(_0x833089[_0x6141('0xc6')],null))[_0x6141('0x2a')](respondWithResult(_0x44c48b,null))[_0x6141('0x3c')](handleError(_0x44c48b,null));};exports['destroy']=function(_0x199882,_0x2600ac){return db['MailInteraction'][_0x6141('0x66')]({'where':{'id':_0x199882[_0x6141('0xc0')]['id']}})['then'](handleEntityNotFound(_0x2600ac,null))[_0x6141('0x2a')](removeEntity(_0x2600ac,null))['catch'](handleError(_0x2600ac,null));};exports[_0x6141('0xc7')]=function(_0x573167,_0x711cf2){return db[_0x6141('0x36')]['describe']()[_0x6141('0x2a')](respondWithResult(_0x711cf2,null))[_0x6141('0x3c')](handleError(_0x711cf2,null));};exports[_0x6141('0xc8')]=function(_0x239622,_0x3956d4,_0x5353ee){return db['MailMessage'][_0x6141('0x66')]({'where':{'id':_0x239622['params']['id']}})[_0x6141('0x2a')](handleEntityNotFound(_0x3956d4,null))[_0x6141('0x2a')](function(_0x3348bb){if(_0x3348bb){return _0x3348bb['addMessage'](_0x239622[_0x6141('0xc6')]['ids'],_[_0x6141('0xc9')](_0x239622[_0x6141('0xc6')],[_0x6141('0xca'),'id'])||{});}})[_0x6141('0x2a')](respondWithResult(_0x3956d4,null))[_0x6141('0x3c')](handleError(_0x3956d4,null));};exports['getMessages']=function(_0x1fb194,_0x33c30d,_0x22b6c3){var _0x5ae270={'raw':![],'where':{}};var _0x46d67b={};var _0x17b203={'count':0x0,'rows':[]};return db[_0x6141('0x36')][_0x6141('0x37')]({'where':{'id':_0x1fb194['params']['id']}})[_0x6141('0x2a')](handleEntityNotFound(_0x33c30d,null))[_0x6141('0x2a')](function(_0x2e176b){if(_0x2e176b){_0x46d67b[_0x6141('0x44')]=_['keys'](db['MailMessage']['rawAttributes']);_0x46d67b[_0x6141('0x47')]=_[_0x6141('0x41')](_0x1fb194[_0x6141('0x47')]);_0x46d67b[_0x6141('0x42')]=_[_0x6141('0x43')](_0x46d67b[_0x6141('0x44')],_0x46d67b[_0x6141('0x47')]);_0x5ae270['attributes']=_[_0x6141('0x43')](_0x46d67b['model'],qs[_0x6141('0x46')](_0x1fb194['query'][_0x6141('0x46')]));_0x5ae270[_0x6141('0x45')]=_0x5ae270[_0x6141('0x45')]['length']?_0x5ae270[_0x6141('0x45')]:_0x46d67b[_0x6141('0x44')];if(!_0x1fb194[_0x6141('0x47')][_0x6141('0x48')](_0x6141('0x49'))){_0x5ae270[_0x6141('0x24')]=qs['limit'](_0x1fb194[_0x6141('0x47')][_0x6141('0x24')]);_0x5ae270['offset']=qs[_0x6141('0x23')](_0x1fb194[_0x6141('0x47')][_0x6141('0x23')]);}_0x5ae270[_0x6141('0x4a')]=qs[_0x6141('0x4b')](_0x1fb194[_0x6141('0x47')][_0x6141('0x4b')]);_0x5ae270['where']=qs[_0x6141('0x42')](_[_0x6141('0xcb')](_0x1fb194[_0x6141('0x47')],_0x46d67b[_0x6141('0x42')]));_0x5ae270['where'][_0x6141('0xbb')]=_0x2e176b['id'];if(_0x1fb194[_0x6141('0x47')][_0x6141('0xcc')]){_0x5ae270['where']=_[_0x6141('0xc3')](_0x5ae270[_0x6141('0x4c')],{'$or':_['map'](_0x5ae270[_0x6141('0x45')],function(_0x3cd9cb){var _0x4f1d5f={};_0x4f1d5f[_0x3cd9cb]={'$like':'%'+_0x1fb194[_0x6141('0x47')]['filter']+'%'};return _0x4f1d5f;})});}if(_0x1fb194[_0x6141('0x47')]['$gte']){var _0x4f4dda=_0x1fb194[_0x6141('0x47')][_0x6141('0xcd')]['split'](',');var _0x60af8={};_0x60af8[_0x4f4dda[0x0]]={'$gte':moment(_0x4f4dda[0x1])[_0x6141('0xce')](_0x6141('0xcf'))};_0x5ae270[_0x6141('0x4c')]=_['merge'](_0x5ae270[_0x6141('0x4c')],_0x60af8);}_0x5ae270=_[_0x6141('0xc3')]({},_0x5ae270,_0x1fb194[_0x6141('0xc4')]);return db['MailMessage']['count']({'where':_0x5ae270[_0x6141('0x4c')]})[_0x6141('0x2a')](function(_0x22f651){_0x17b203[_0x6141('0x22')]=_0x22f651;if(_0x1fb194[_0x6141('0x47')]['includeAll']){_0x5ae270['include']=[{'all':!![]}];}return db[_0x6141('0xd0')][_0x6141('0xd1')](_0x5ae270);})[_0x6141('0x2a')](function(_0x2e52ff){_0x17b203[_0x6141('0xbf')]=_0x2e52ff;return _0x17b203;});}})['then'](respondWithFilteredResult(_0x33c30d,_0x5ae270))[_0x6141('0x3c')](handleError(_0x33c30d,null));};exports[_0x6141('0xd2')]=function(_0x19c957,_0x76f688,_0x10f58c){return db['MailInteraction']['find']({'where':{'id':_0x19c957['params']['id']}})[_0x6141('0x2a')](handleEntityNotFound(_0x76f688,null))[_0x6141('0x2a')](function(_0x40c724){if(_0x40c724){return _0x40c724['setTags'](_0x19c957['body'][_0x6141('0xca')],_[_0x6141('0xc9')](_0x19c957[_0x6141('0xc6')],['ids','id'])||{})['spread'](function(){return db[_0x6141('0x73')][_0x6141('0xd1')]({'attributes':['id',_0x6141('0x2d'),_0x6141('0x4f')],'where':{'id':_0x19c957[_0x6141('0xc6')][_0x6141('0xca')]}});})[_0x6141('0x2a')](function(_0x57004d){socket['emit'](_0x6141('0xd3'),{'id':Number(_0x19c957[_0x6141('0xc0')]['id']),'tags':_0x57004d||[]});return{'id':Number(_0x19c957['params']['id']),'tags':_0x57004d||[]};});}})[_0x6141('0x2a')](respondWithResult(_0x76f688,null))[_0x6141('0x3c')](handleError(_0x76f688,null));};exports[_0x6141('0xd4')]=function(_0x1c72a1,_0x267fdb,_0x1cc6b3){return db[_0x6141('0x36')][_0x6141('0x66')]({'where':{'id':_0x1c72a1[_0x6141('0xc0')]['id']}})[_0x6141('0x2a')](handleEntityNotFound(_0x267fdb,null))['then'](function(_0x23cd78){if(_0x23cd78){return _0x23cd78[_0x6141('0xd4')](_0x1c72a1[_0x6141('0x47')][_0x6141('0xca')]);}})[_0x6141('0x2a')](respondWithStatusCode(_0x267fdb,null))[_0x6141('0x3c')](handleError(_0x267fdb,null));};exports[_0x6141('0xd5')]=function(_0x18e49c,_0x501cbf){var _0x1bc10d=moment()[_0x6141('0xd6')]()[_0x6141('0x9f')]();var _0x4ad7d2=path[_0x6141('0xd7')](config[_0x6141('0xd8')],_0x6141('0xd9'),_0x6141('0xda'),_0x6141('0xdb'));var _0x3275b4=path['join'](config[_0x6141('0xd8')],'server',_0x6141('0xda'),'attachments');var _0x1c823c=path[_0x6141('0xd7')](_0x4ad7d2,_0x1bc10d);var _0xfcca6f=util[_0x6141('0xce')](_0x6141('0xdc'),_0x18e49c[_0x6141('0xc0')]['id'],_0x1bc10d);var _0x5416f4=path[_0x6141('0xd7')](_0x4ad7d2,_0xfcca6f);var _0x167b8e=[];if(_0x18e49c[_0x6141('0x47')][_0x6141('0xdd')]){_0x167b8e[_0x6141('0x35')]({'model':db[_0x6141('0xde')],'as':_0x6141('0xdf'),'raw':!![]});}var _0x2cb4cd=[{'model':db[_0x6141('0xd0')],'as':_0x6141('0xe0'),'attributes':['id','body',_0x6141('0x50'),'to','cc',_0x6141('0xe1'),'subject',_0x6141('0x7c')],'where':{'secret':![]},'order':qs[_0x6141('0x4b')]('id'),'include':_0x167b8e}];return db['MailInteraction']['find']({'where':{'id':_0x18e49c[_0x6141('0xc0')]['id']},'include':_0x2cb4cd})[_0x6141('0x2a')](handleEntityNotFound(_0x501cbf,null))['then'](function(_0x142246){if(_0x142246&&_0x142246[_0x6141('0xe0')]){var _0x336bf2=_0x142246[_0x6141('0xe2')]({'plain':!![]});fs['mkdirSync'](_0x1c823c);return BPromise[_0x6141('0xe3')](_0x336bf2[_0x6141('0xe0')],function(_0x512740,_0x564263){var _0x55a94b={'from':_0x512740[_0x6141('0x50')],'to':_0x512740['to'],'subject':_0x512740[_0x6141('0xe4')],'html':_0x512740[_0x6141('0xc6')],'headers':{'Date':moment(_0x512740[_0x6141('0x7c')])['format'](_0x6141('0xe5'))},'attachments':[]};if(_0x512740['cc']){_0x55a94b[_0x6141('0xe6')]['Cc']=_0x512740['cc'];}if(_0x512740[_0x6141('0xe1')]){_0x55a94b['headers']['Bcc']=_0x512740['bcc'];}return new BPromise(function(_0x45c9e0,_0x363ea4){if(_0x512740[_0x6141('0xdf')]){for(var _0x3b68aa=0x0;_0x3b68aa<_0x512740['Attachments'][_0x6141('0x65')];_0x3b68aa++){var _0x3a4527=_0x512740['Attachments'][_0x3b68aa];var _0x11081b=path[_0x6141('0xd7')](_0x3275b4,_0x3a4527[_0x6141('0xe7')]);if(fs[_0x6141('0xe8')](_0x11081b)){_0x55a94b[_0x6141('0xdd')][_0x6141('0x35')]({'name':_0x3a4527[_0x6141('0x2d')],'contentType':_0x3a4527[_0x6141('0x40')],'data':fs[_0x6141('0xe9')](_0x11081b)});}}}emlformat['build'](_0x55a94b,function(_0x3c7f32,_0x2ab710){if(_0x3c7f32)return _0x363ea4(_0x3c7f32);fs[_0x6141('0xea')](path['join'](_0x1c823c,util[_0x6141('0xce')](_0x6141('0xeb'),_0x564263)),_0x2ab710);return _0x45c9e0(_0x2ab710);});});})[_0x6141('0x2a')](function(){return new BPromise(function(_0xae30aa,_0x5d695f){zipdir(_0x1c823c,{'saveTo':_0x5416f4},function(_0x276b3e,_0x19d68f){if(_0x276b3e)return _0x5d695f(_0x276b3e);return _0xae30aa(_0x19d68f);});})[_0x6141('0x2a')](function(){return new BPromise(function(_0x440e34,_0x141fb7){rimraf(_0x1c823c,function(_0x23013e){if(_0x23013e)_0x141fb7(_0x23013e);return _0x440e34();});});})['then'](function(){return _0x501cbf['download'](_0x5416f4,_0xfcca6f,function(_0x37c97e){if(_0x37c97e){console[_0x6141('0xec')]('err',_0x37c97e);}else{fs[_0x6141('0xed')](_0x5416f4);}});});});}else{return _0x501cbf[_0x6141('0x1e')](0xc8);}})['catch'](handleError(_0x501cbf,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2507afc..8ac63e4 100644 --- a/server/api/mailInteraction/mailInteraction.events.js +++ b/server/api/mailInteraction/mailInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01de=['unreadMessages','emit','catch','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','update','getUsers','then','setDataValue','map','findAll'];(function(_0x5e32f3,_0x3386c1){var _0x4d4e03=function(_0xe86f5){while(--_0xe86f5){_0x5e32f3['push'](_0x5e32f3['shift']());}};_0x4d4e03(++_0x3386c1);}(_0x01de,0x9b));var _0xe01d=function(_0x326020,_0xb6af51){_0x326020=_0x326020-0x0;var _0x196663=_0x01de[_0x326020];return _0x196663;};'use strict';var EventEmitter=require(_0xe01d('0x0'));var MailInteraction=require(_0xe01d('0x1'))['db'][_0xe01d('0x2')];var MailMessage=require(_0xe01d('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe01d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe01d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x19c1f3){return function(_0x2a8dc8,_0x4dba87,_0x54be48){_0x2a8dc8[_0xe01d('0x5')]({'attributes':['id'],'raw':!![]})[_0xe01d('0x6')](function(_0x17ca78){_0x2a8dc8[_0xe01d('0x7')]('Users',_0x17ca78[_0xe01d('0x8')](function(_0x2ab92a){return{'id':_0x2ab92a['id']};}));return MailMessage[_0xe01d('0x9')]({'where':{'MailInteractionId':_0x2a8dc8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe01d('0x6')](function(_0x37a4f6){_0x2a8dc8[_0xe01d('0x7')](_0xe01d('0xa'),_0x37a4f6['length']);MailInteractionEvents[_0xe01d('0xb')](_0x19c1f3+':'+_0x2a8dc8['id'],_0x2a8dc8);MailInteractionEvents['emit'](_0x19c1f3,_0x2a8dc8);_0x54be48(null);})[_0xe01d('0xc')](_0x54be48(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xe01d('0xd')](e,emitEvent(event));}}module[_0xe01d('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xb471=['setMaxListeners','save','update','remove','getUsers','Users','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','MailInteraction','../../mysqldb','MailMessage'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0xb471,0x1ed));var _0x1b47=function(_0x1f3746,_0x46e39b){_0x1f3746=_0x1f3746-0x0;var _0x1d098d=_0xb471[_0x1f3746];return _0x1d098d;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x1b47('0x0')];var MailMessage=require(_0x1b47('0x1'))['db'][_0x1b47('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1b47('0x3')](0x0);var events={'afterCreate':_0x1b47('0x4'),'afterUpdate':_0x1b47('0x5'),'afterDestroy':_0x1b47('0x6')};function emitEvent(_0x5778b5){return function(_0x13292a,_0x5a1f66,_0x4bbe5b){_0x13292a[_0x1b47('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x208440){_0x13292a['setDataValue'](_0x1b47('0x8'),_0x208440['map'](function(_0x1c1c96){return{'id':_0x1c1c96['id']};}));return MailMessage[_0x1b47('0x9')]({'where':{'MailInteractionId':_0x13292a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1b47('0xa')](function(_0x5c1db2){_0x13292a['setDataValue'](_0x1b47('0xb'),_0x5c1db2['length']);MailInteractionEvents[_0x1b47('0xc')](_0x5778b5+':'+_0x13292a['id'],_0x13292a);MailInteractionEvents[_0x1b47('0xc')](_0x5778b5,_0x13292a);_0x4bbe5b(null);})[_0x1b47('0xd')](_0x4bbe5b(null));};}for(var e in events){if(events[_0x1b47('0xe')](e)){var event=events[e];MailInteraction[_0x1b47('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 95ed168..dbb69ff 100644 --- a/server/api/mailInteraction/mailInteraction.model.js +++ b/server/api/mailInteraction/mailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe58a=['closed','changed','closedAt','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x14f8bb,_0x8670d9){var _0x126431=function(_0x397be8){while(--_0x397be8){_0x14f8bb['push'](_0x14f8bb['shift']());}};_0x126431(++_0x8670d9);}(_0xe58a,0x9f));var _0xae58=function(_0x19b3a5,_0xeae7f9){_0x19b3a5=_0x19b3a5-0x0;var _0x3e81e8=_0xe58a[_0x19b3a5];return _0x3e81e8;};'use strict';var _=require(_0xae58('0x0'));var util=require(_0xae58('0x1'));var logger=require(_0xae58('0x2'))('api');var moment=require(_0xae58('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae58('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae58('0x5'));module['exports']=function(_0x198e0c,_0x29749a){return _0x198e0c[_0xae58('0x6')](_0xae58('0x7'),attributes,{'tableName':_0xae58('0x8'),'paranoid':![],'indexes':[{'name':_0xae58('0x9'),'fields':[_0xae58('0xa'),'to'],'type':_0xae58('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x315ea9,_0x21d6f1,_0x5de1fa){if(_0x315ea9[_0xae58('0xc')]){_0x315ea9[_0xae58('0xd')]=moment()[_0xae58('0xe')](_0xae58('0xf'));}if(_0x315ea9[_0xae58('0x10')]){_0x315ea9['closedAt']=moment()[_0xae58('0xe')](_0xae58('0xf'));}_0x5de1fa(null,_0x21d6f1);},'beforeUpdate':function(_0x4c92de,_0x105a8c,_0x574c0d){if(_0x4c92de[_0xae58('0x11')](_0xae58('0xc'))){_0x4c92de[_0xae58('0xd')]=_0x4c92de[_0xae58('0xc')]?moment()['format'](_0xae58('0xf')):null;}if(_0x4c92de['changed']('closed')){_0x4c92de[_0xae58('0x12')]=moment()[_0xae58('0xe')](_0xae58('0xf'));_0x4c92de[_0xae58('0xc')]=null;_0x4c92de['substatusAt']=null;}_0x574c0d(null,_0x4c92de);},'afterUpdate':function(_0x13f61e,_0x139d67,_0x261774){var _0x2b3d7b=_0x198e0c['models'];var _0x4dcadf=_0x13f61e[_0xae58('0x13')]({'plain':!![]});if(_0x4dcadf[_0xae58('0x10')]){return _0x2b3d7b[_0xae58('0x14')][_0xae58('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x4dcadf['id']}})[_0xae58('0x16')](function(){_0x261774();})['catch'](function(_0x16a9a2){_0x261774(_0x16a9a2);});}else{_0x261774();}}},'charset':_0xae58('0x17'),'collate':_0xae58('0x18')});}; \ No newline at end of file +var _0x325b=['subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x1c4669,_0x26d51f){var _0x16086c=function(_0x44b87d){while(--_0x44b87d){_0x1c4669['push'](_0x1c4669['shift']());}};_0x16086c(++_0x26d51f);}(_0x325b,0x8b));var _0xb325=function(_0x45b5a5,_0x3b6e10){_0x45b5a5=_0x45b5a5-0x0;var _0x2fb439=_0x325b[_0x45b5a5];return _0x2fb439;};'use strict';var _=require(_0xb325('0x0'));var util=require(_0xb325('0x1'));var logger=require(_0xb325('0x2'))('api');var moment=require(_0xb325('0x3'));var BPromise=require(_0xb325('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb325('0x5'));var config=require(_0xb325('0x6'));var attributes=require(_0xb325('0x7'));module['exports']=function(_0x4a1ea8,_0x33dcfc){return _0x4a1ea8['define'](_0xb325('0x8'),attributes,{'tableName':_0xb325('0x9'),'paranoid':![],'indexes':[{'name':_0xb325('0xa'),'fields':[_0xb325('0xb'),'to'],'type':_0xb325('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x28910a,_0xb008cb,_0x237201){if(_0x28910a[_0xb325('0xd')]){_0x28910a[_0xb325('0xe')]=moment()[_0xb325('0xf')](_0xb325('0x10'));}if(_0x28910a[_0xb325('0x11')]){_0x28910a[_0xb325('0x12')]=moment()['format'](_0xb325('0x10'));}_0x237201(null,_0xb008cb);},'beforeUpdate':function(_0xff2cc3,_0x3d0e2d,_0x1ee42f){if(_0xff2cc3['changed'](_0xb325('0xd'))){_0xff2cc3[_0xb325('0xe')]=_0xff2cc3['substatus']?moment()[_0xb325('0xf')](_0xb325('0x10')):null;}if(_0xff2cc3[_0xb325('0x13')](_0xb325('0x11'))){_0xff2cc3['closedAt']=moment()[_0xb325('0xf')](_0xb325('0x10'));_0xff2cc3[_0xb325('0xd')]=null;_0xff2cc3[_0xb325('0xe')]=null;}_0x1ee42f(null,_0xff2cc3);},'afterUpdate':function(_0x2d7398,_0x2e3b1d,_0x7106c7){var _0xa4e6c6=_0x4a1ea8['models'];var _0x318598=_0x2d7398['get']({'plain':!![]});if(_0x318598[_0xb325('0x11')]){return _0xa4e6c6[_0xb325('0x14')][_0xb325('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x318598['id']}})['then'](function(){_0x7106c7();})[_0xb325('0x16')](function(_0x3f1893){_0x7106c7(_0x3f1893);});}else{_0x7106c7();}}},'charset':_0xb325('0x17'),'collate':_0xb325('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 031c854..952a938 100644 --- a/server/api/mailInteraction/mailInteraction.rpc.js +++ b/server/api/mailInteraction/mailInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9434=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','MailInteraction','update','body','options','raw','where','attributes','UpdateMailInteraction','catch','AddTagsToMailInteraction','find','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9434,0x168));var _0x4943=function(_0x1ab561,_0x52af78){_0x1ab561=_0x1ab561-0x0;var _0x198b9a=_0x9434[_0x1ab561];return _0x198b9a;};'use strict';var _=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var moment=require(_0x4943('0x2'));var BPromise=require(_0x4943('0x3'));var rs=require(_0x4943('0x4'));var fs=require('fs');var Redis=require(_0x4943('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4943('0x6'));var logger=require(_0x4943('0x7'))('rpc');var config=require(_0x4943('0x8'));var jayson=require(_0x4943('0x9'));var client=jayson['client'][_0x4943('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4943('0xb')],{'host':_0x4943('0xc'),'port':0x18eb});var socket=require(_0x4943('0xd'))(new Redis(config[_0x4943('0xb')]));require(_0x4943('0xe'))['register'](socket);function respondWithRpcPromise(_0x51b504,_0x3057c4,_0x1bc269){return new BPromise(function(_0xf6d6c8,_0x519060){return client[_0x4943('0xf')](_0x51b504,_0x1bc269)[_0x4943('0x10')](function(_0x5a64a3){logger[_0x4943('0x11')]('MailInteraction,\x20%s,\x20%s',_0x3057c4,'request\x20sent');logger[_0x4943('0x12')](_0x4943('0x13'),_0x3057c4,_0x4943('0x14'),JSON[_0x4943('0x15')](_0x5a64a3));if(_0x5a64a3[_0x4943('0x16')]){if(_0x5a64a3[_0x4943('0x16')][_0x4943('0x17')]===0x1f4){logger['error'](_0x4943('0x18'),_0x3057c4,_0x5a64a3[_0x4943('0x16')][_0x4943('0x19')]);return _0x519060(_0x5a64a3[_0x4943('0x16')][_0x4943('0x19')]);}logger[_0x4943('0x16')]('MailInteraction,\x20%s,\x20%s',_0x3057c4,_0x5a64a3[_0x4943('0x16')][_0x4943('0x19')]);return _0xf6d6c8(_0x5a64a3[_0x4943('0x16')]['message']);}else{logger['info'](_0x4943('0x18'),_0x3057c4,'request\x20sent');_0xf6d6c8(_0x5a64a3[_0x4943('0x1a')][_0x4943('0x19')]);}})['catch'](function(_0x156c8c){logger[_0x4943('0x16')](_0x4943('0x18'),_0x3057c4,_0x156c8c);_0x519060(_0x156c8c);});});}exports['UpdateMailInteraction']=function(_0x44f439){var _0x542c28=this;return new Promise(function(_0x2833ed,_0x52fa3b){return db[_0x4943('0x1b')][_0x4943('0x1c')](_0x44f439[_0x4943('0x1d')],{'raw':_0x44f439[_0x4943('0x1e')]?_0x44f439['options'][_0x4943('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44f439[_0x4943('0x1e')]?_0x44f439[_0x4943('0x1e')][_0x4943('0x20')]||null:null,'attributes':_0x44f439[_0x4943('0x1e')]?_0x44f439[_0x4943('0x1e')][_0x4943('0x21')]||null:null,'limit':_0x44f439[_0x4943('0x1e')]?_0x44f439['options']['limit']||null:null})[_0x4943('0x10')](function(_0x127a53){logger[_0x4943('0x11')]('UpdateMailInteraction',_0x44f439);logger[_0x4943('0x12')](_0x4943('0x22'),_0x44f439,JSON['stringify'](_0x127a53));_0x2833ed(_0x127a53);})[_0x4943('0x23')](function(_0x1499c7){logger[_0x4943('0x16')](_0x4943('0x22'),_0x1499c7[_0x4943('0x19')],_0x44f439);_0x52fa3b(_0x542c28[_0x4943('0x16')](0x1f4,_0x1499c7[_0x4943('0x19')]));});});};exports[_0x4943('0x24')]=function(_0x3c1c15){return new Promise(function(_0x3443ca,_0x170e78){return db[_0x4943('0x1b')][_0x4943('0x25')]({'where':_0x3c1c15[_0x4943('0x1e')]?_0x3c1c15[_0x4943('0x1e')][_0x4943('0x20')]||null:null})[_0x4943('0x10')](function(_0x20c7b4){if(_0x20c7b4){return _0x20c7b4['addTags'](_0x3c1c15[_0x4943('0x1d')]['ids'],_[_0x4943('0x26')](_0x3c1c15[_0x4943('0x1d')],[_0x4943('0x27'),'id'])||{});}})[_0x4943('0x28')](function(_0x3b7788){logger[_0x4943('0x11')](_0x4943('0x29'),_0x3c1c15);logger[_0x4943('0x12')]('AddTags',_0x3c1c15,JSON[_0x4943('0x15')](_0x3b7788));_0x3443ca(_0x3b7788);})[_0x4943('0x23')](function(_0x52386d){logger[_0x4943('0x16')](_0x4943('0x29'),_0x52386d['message'],_0x3c1c15);_0x170e78(_this[_0x4943('0x16')](0x1f4,_0x52386d[_0x4943('0x19')]));});});}; \ No newline at end of file +var _0x2821=['limit','UpdateMailInteraction','catch','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','MailInteraction','update','body','options','raw','attributes'];(function(_0x58fb20,_0x1a9253){var _0x358267=function(_0x156a96){while(--_0x156a96){_0x58fb20['push'](_0x58fb20['shift']());}};_0x358267(++_0x1a9253);}(_0x2821,0x87));var _0x1282=function(_0x30b823,_0x19b1b2){_0x30b823=_0x30b823-0x0;var _0x4578f7=_0x2821[_0x30b823];return _0x4578f7;};'use strict';var _=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var moment=require(_0x1282('0x2'));var BPromise=require(_0x1282('0x3'));var rs=require(_0x1282('0x4'));var fs=require('fs');var Redis=require(_0x1282('0x5'));var db=require(_0x1282('0x6'))['db'];var utils=require(_0x1282('0x7'));var logger=require(_0x1282('0x8'))(_0x1282('0x9'));var config=require(_0x1282('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1282('0xb')][_0x1282('0xc')]({'port':0x232a});config[_0x1282('0xd')]=_[_0x1282('0xe')](config[_0x1282('0xd')],{'host':_0x1282('0xf'),'port':0x18eb});var socket=require(_0x1282('0x10'))(new Redis(config[_0x1282('0xd')]));require('./mailInteraction.socket')[_0x1282('0x11')](socket);function respondWithRpcPromise(_0x30df94,_0x3bda99,_0x2ad86c){return new BPromise(function(_0x30fe03,_0x5c29fe){return client[_0x1282('0x12')](_0x30df94,_0x2ad86c)[_0x1282('0x13')](function(_0x4db9f6){logger[_0x1282('0x14')](_0x1282('0x15'),_0x3bda99,'request\x20sent');logger[_0x1282('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3bda99,'request\x20sent',JSON[_0x1282('0x17')](_0x4db9f6));if(_0x4db9f6[_0x1282('0x18')]){if(_0x4db9f6[_0x1282('0x18')][_0x1282('0x19')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x3bda99,_0x4db9f6['error'][_0x1282('0x1a')]);return _0x5c29fe(_0x4db9f6[_0x1282('0x18')][_0x1282('0x1a')]);}logger[_0x1282('0x18')](_0x1282('0x15'),_0x3bda99,_0x4db9f6[_0x1282('0x18')][_0x1282('0x1a')]);return _0x30fe03(_0x4db9f6[_0x1282('0x18')]['message']);}else{logger[_0x1282('0x14')](_0x1282('0x15'),_0x3bda99,'request\x20sent');_0x30fe03(_0x4db9f6['result'][_0x1282('0x1a')]);}})['catch'](function(_0x41a7f6){logger[_0x1282('0x18')]('MailInteraction,\x20%s,\x20%s',_0x3bda99,_0x41a7f6);_0x5c29fe(_0x41a7f6);});});}exports['UpdateMailInteraction']=function(_0x5052fe){var _0x57b5d2=this;return new Promise(function(_0x424574,_0x2f4e4a){return db[_0x1282('0x1b')][_0x1282('0x1c')](_0x5052fe[_0x1282('0x1d')],{'raw':_0x5052fe[_0x1282('0x1e')]?_0x5052fe[_0x1282('0x1e')][_0x1282('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5052fe[_0x1282('0x1e')]?_0x5052fe[_0x1282('0x1e')]['where']||null:null,'attributes':_0x5052fe[_0x1282('0x1e')]?_0x5052fe['options'][_0x1282('0x20')]||null:null,'limit':_0x5052fe[_0x1282('0x1e')]?_0x5052fe[_0x1282('0x1e')][_0x1282('0x21')]||null:null})[_0x1282('0x13')](function(_0x59486f){logger[_0x1282('0x14')](_0x1282('0x22'),_0x5052fe);logger[_0x1282('0x16')](_0x1282('0x22'),_0x5052fe,JSON[_0x1282('0x17')](_0x59486f));_0x424574(_0x59486f);})[_0x1282('0x23')](function(_0x725029){logger[_0x1282('0x18')]('UpdateMailInteraction',_0x725029['message'],_0x5052fe);_0x2f4e4a(_0x57b5d2[_0x1282('0x18')](0x1f4,_0x725029[_0x1282('0x1a')]));});});};exports[_0x1282('0x24')]=function(_0x479b18){return new Promise(function(_0x1ba41d,_0x537130){return db[_0x1282('0x1b')]['find']({'where':_0x479b18['options']?_0x479b18['options']['where']||null:null})['then'](function(_0x5ec864){if(_0x5ec864){return _0x5ec864[_0x1282('0x25')](_0x479b18[_0x1282('0x1d')][_0x1282('0x26')],_[_0x1282('0x27')](_0x479b18[_0x1282('0x1d')],[_0x1282('0x26'),'id'])||{});}})[_0x1282('0x28')](function(_0x435fc0){logger[_0x1282('0x14')]('AddTags',_0x479b18);logger[_0x1282('0x16')](_0x1282('0x29'),_0x479b18,JSON[_0x1282('0x17')](_0x435fc0));_0x1ba41d(_0x435fc0);})[_0x1282('0x23')](function(_0x219b34){logger['error'](_0x1282('0x29'),_0x219b34[_0x1282('0x1a')],_0x479b18);_0x537130(_this['error'](0x1f4,_0x219b34['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b4b89e5..0bfb22c 100644 --- a/server/api/mailInteraction/mailInteraction.socket.js +++ b/server/api/mailInteraction/mailInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f98=['save','update','emit','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f98,0x92));var _0x89f9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9f98[_0x40a045];return _0x1a687c;};'use strict';var MailInteractionEvents=require(_0x89f9('0x0'));var events=[_0x89f9('0x1'),'remove',_0x89f9('0x2')];function createListener(_0x162d0,_0x362a9e){return function(_0x5dee8f){_0x362a9e[_0x89f9('0x3')](_0x162d0,_0x5dee8f);};}function removeListener(_0x667494,_0x160e2e){return function(){MailInteractionEvents['removeListener'](_0x667494,_0x160e2e);};}exports[_0x89f9('0x4')]=function(_0x523404){for(var _0x53a310=0x0,_0x1a6ea1=events[_0x89f9('0x5')];_0x53a310<_0x1a6ea1;_0x53a310++){var _0x1438ef=events[_0x53a310];var _0x1930bd=createListener(_0x89f9('0x6')+_0x1438ef,_0x523404);MailInteractionEvents['on'](_0x1438ef,_0x1930bd);}}; \ No newline at end of file +var _0xa384=['remove','update','emit','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa384,0x163));var _0x4a38=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xa384[_0x525c7b];return _0x27b33e;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x4a38('0x0'),_0x4a38('0x1')];function createListener(_0x52d163,_0x41512e){return function(_0x2a39b4){_0x41512e[_0x4a38('0x2')](_0x52d163,_0x2a39b4);};}function removeListener(_0x3b7ad2,_0x10ae54){return function(){MailInteractionEvents['removeListener'](_0x3b7ad2,_0x10ae54);};}exports[_0x4a38('0x3')]=function(_0x3556ea){for(var _0x492f28=0x0,_0x180349=events[_0x4a38('0x4')];_0x492f28<_0x180349;_0x492f28++){var _0x43b374=events[_0x492f28];var _0x184987=createListener('mailInteraction:'+_0x43b374,_0x3556ea);MailInteractionEvents['on'](_0x43b374,_0x184987);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ed7dee2..fe92830 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x520d91,_0x4bd5ab){var _0x1b4038=function(_0x4fb98f){while(--_0x4fb98f){_0x520d91['push'](_0x520d91['shift']());}};_0x1b4038(++_0x4bd5ab);}(_0x24ca,0x1bc));var _0xa24c=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x24ca[_0x41d02a];return _0x4c3983;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['get'](_0xa24c('0xf'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);router[_0xa24c('0x11')]('/',auth[_0xa24c('0x9')](),interaction[_0xa24c('0x12')](_0xa24c('0x13'),_0xa24c('0x14')),controller[_0xa24c('0x15')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x16')]);router[_0xa24c('0x17')]('/:id/accept',auth[_0xa24c('0x9')](),controller[_0xa24c('0x18')]);router[_0xa24c('0x17')](_0xa24c('0x19'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x1a')]);router[_0xa24c('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xa24c('0x1c')]);module[_0xa24c('0x1d')]=router; \ No newline at end of file +var _0x24ca=['../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5861bd,_0x123a92){var _0x281e3b=function(_0x543f09){while(--_0x543f09){_0x5861bd['push'](_0x5861bd['shift']());}};_0x281e3b(++_0x123a92);}(_0x24ca,0x1bc));var _0xa24c=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x24ca[_0x469a3c];return _0x968f4;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['get'](_0xa24c('0xf'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);router[_0xa24c('0x11')]('/',auth[_0xa24c('0x9')](),interaction[_0xa24c('0x12')](_0xa24c('0x13'),_0xa24c('0x14')),controller[_0xa24c('0x15')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x16')]);router[_0xa24c('0x17')]('/:id/accept',auth[_0xa24c('0x9')](),controller[_0xa24c('0x18')]);router[_0xa24c('0x17')](_0xa24c('0x19'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x1a')]);router[_0xa24c('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xa24c('0x1c')]);module[_0xa24c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 2d4c741..1709a80 100644 --- a/server/api/mailMessage/mailMessage.attributes.js +++ b/server/api/mailMessage/mailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80c4=['STRING','DATE','INTEGER','sequelize','exports','TEXT','long','medium','BOOLEAN','out'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x80c4,0xa3));var _0x480c=function(_0x4559bc,_0x5be15b){_0x4559bc=_0x4559bc-0x0;var _0x2df807=_0x80c4[_0x4559bc];return _0x2df807;};'use strict';var Sequelize=require(_0x480c('0x0'));var _=require('lodash');module[_0x480c('0x1')]={'body':{'type':Sequelize[_0x480c('0x2')](_0x480c('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x480c('0x2')](_0x480c('0x4'))},'read':{'type':Sequelize[_0x480c('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x480c('0x6')),'defaultValue':_0x480c('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x480c('0x7')](0x1fe)},'from':{'type':Sequelize[_0x480c('0x7')]},'to':{'type':Sequelize[_0x480c('0x2')](_0x480c('0x3'))},'cc':{'type':Sequelize[_0x480c('0x2')](_0x480c('0x3'))},'bcc':{'type':Sequelize[_0x480c('0x2')]('long')},'subject':{'type':Sequelize[_0x480c('0x2')]},'sentAt':{'type':Sequelize[_0x480c('0x8')]},'attach':{'type':Sequelize[_0x480c('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x480c('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x480c('0x8')]},'originTo':{'type':Sequelize[_0x480c('0x2')](_0x480c('0x3'))},'originCc':{'type':Sequelize[_0x480c('0x2')](_0x480c('0x3'))}}; \ No newline at end of file +var _0x97e6=['BOOLEAN','out','STRING','DATE','INTEGER','sequelize','exports','TEXT','long','medium'];(function(_0x45a855,_0x42ab85){var _0x337f0c=function(_0x426ff2){while(--_0x426ff2){_0x45a855['push'](_0x45a855['shift']());}};_0x337f0c(++_0x42ab85);}(_0x97e6,0x159));var _0x697e=function(_0x5e8c7c,_0x3429c6){_0x5e8c7c=_0x5e8c7c-0x0;var _0x48f7bd=_0x97e6[_0x5e8c7c];return _0x48f7bd;};'use strict';var Sequelize=require(_0x697e('0x0'));var _=require('lodash');module[_0x697e('0x1')]={'body':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x697e('0x4'))},'read':{'type':Sequelize[_0x697e('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x697e('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x697e('0x7')](0x1fe)},'from':{'type':Sequelize[_0x697e('0x7')]},'to':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3'))},'cc':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x697e('0x2')]},'sentAt':{'type':Sequelize[_0x697e('0x8')]},'attach':{'type':Sequelize[_0x697e('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x697e('0x8')]},'originTo':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3'))},'originCc':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1704305..8aca558 100644 --- a/server/api/mailMessage/mailMessage.controller.js +++ b/server/api/mailMessage/mailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5b0=['options','find','update','body','params','describe','direction','out','secret','split','findOne','CmList','CmContact','Contacts','updatedAt','isNil','Smtp','host','port','secure','authentication','auth','user','service','pass','attachments','join','root','server/files/attachments','basename','List','create','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','readAt','UserId','MailInteraction','MailInteractionId','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','createdAt','Attachment','subject','headers','Bcc','Attachments','existsSync','push','readFileSync','build','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','save','destroy','stack','name','map','MailMessage','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','pick','filter','merge','where','includeAll','include','findAll','rows','show','rawAttributes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa5b0,0x19b));var _0x0a5b=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xa5b0[_0x3f2a90];return _0xb46279;};'use strict';var pdf=require(_0x0a5b('0x0'));var emlformat=require(_0x0a5b('0x1'));var rimraf=require(_0x0a5b('0x2'));var zipdir=require(_0x0a5b('0x3'));var jsonpatch=require(_0x0a5b('0x4'));var rp=require(_0x0a5b('0x5'));var moment=require(_0x0a5b('0x6'));var BPromise=require(_0x0a5b('0x7'));var Mustache=require(_0x0a5b('0x8'));var util=require(_0x0a5b('0x9'));var path=require('path');var sox=require(_0x0a5b('0xa'));var csv=require(_0x0a5b('0xb'));var ejs=require(_0x0a5b('0xc'));var fs=require('fs');var _=require(_0x0a5b('0xd'));var squel=require(_0x0a5b('0xe'));var crypto=require('crypto');var jsforce=require(_0x0a5b('0xf'));var deskjs=require(_0x0a5b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a5b('0x11'));var authService=require(_0x0a5b('0x12'));var qs=require(_0x0a5b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a5b('0x14'))(_0x0a5b('0x15'));var utils=require(_0x0a5b('0x16'));var config=require(_0x0a5b('0x17'));var licenseUtil=require(_0x0a5b('0x18'));var db=require(_0x0a5b('0x19'))['db'];config['redis']=_[_0x0a5b('0x1a')](config[_0x0a5b('0x1b')],{'host':_0x0a5b('0x1c'),'port':0x18eb});var socket=require(_0x0a5b('0x1d'))(new Redis(config[_0x0a5b('0x1b')]));require(_0x0a5b('0x1e'))[_0x0a5b('0x1f')](socket);var jayson=require(_0x0a5b('0x20'));var client=jayson[_0x0a5b('0x21')]['http']({'port':0x232c});var client9003=jayson['client'][_0x0a5b('0x22')]({'port':0x232b});var client9002=jayson[_0x0a5b('0x21')][_0x0a5b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x20b14e,_0x3ceb12,_0x4e3f08,_0x2cfaec){return new BPromise(function(_0x1ed179,_0x1625ac){var _0x5541e8=_0x2cfaec||client;return _0x5541e8[_0x0a5b('0x23')](_0x20b14e,_0x4e3f08)[_0x0a5b('0x24')](function(_0x1bdb34){logger[_0x0a5b('0x25')](_0x0a5b('0x26'),_0x3ceb12,_0x0a5b('0x27'));logger[_0x0a5b('0x28')](_0x0a5b('0x29'),_0x3ceb12,_0x0a5b('0x27'),JSON[_0x0a5b('0x2a')](_0x1bdb34));if(_0x1bdb34['error']){if(_0x1bdb34[_0x0a5b('0x2b')][_0x0a5b('0x2c')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x3ceb12,_0x1bdb34[_0x0a5b('0x2b')][_0x0a5b('0x2d')]);return _0x1625ac(_0x1bdb34['error'][_0x0a5b('0x2d')]);}logger[_0x0a5b('0x2b')](_0x0a5b('0x26'),_0x3ceb12,_0x1bdb34[_0x0a5b('0x2b')][_0x0a5b('0x2d')]);return _0x1ed179(_0x1bdb34[_0x0a5b('0x2b')][_0x0a5b('0x2d')]);}else{logger['info'](_0x0a5b('0x26'),_0x3ceb12,_0x0a5b('0x27'));_0x1ed179(_0x1bdb34[_0x0a5b('0x2e')][_0x0a5b('0x2d')]);}})[_0x0a5b('0x2f')](function(_0x165065){logger[_0x0a5b('0x2b')](_0x0a5b('0x26'),_0x3ceb12,_0x165065);_0x1625ac(_0x165065);});});}function respondWithStatusCode(_0x3245b8,_0x51591d){_0x51591d=_0x51591d||0xcc;return function(_0x5b9a2b){if(_0x5b9a2b){return _0x3245b8[_0x0a5b('0x30')](_0x51591d);}return _0x3245b8[_0x0a5b('0x31')](_0x51591d)['end']();};}function respondWithResult(_0x5a9e4a,_0x41271b){_0x41271b=_0x41271b||0xc8;return function(_0x5f5d0a){if(_0x5f5d0a){return _0x5a9e4a[_0x0a5b('0x31')](_0x41271b)[_0x0a5b('0x32')](_0x5f5d0a);}};}function respondWithFilteredResult(_0x17fada,_0x39248e){return function(_0xee69d5){if(_0xee69d5){var _0x4aba6c=_0xee69d5[_0x0a5b('0x33')],_0x384234=_0x39248e[_0x0a5b('0x34')],_0x35784b=_0x39248e[_0x0a5b('0x34')]+_0x39248e['limit'],_0x517a3e;if(_0x35784b>=_0x4aba6c){_0x35784b=_0x4aba6c;_0x517a3e=0xc8;}else{_0x517a3e=0xce;}_0x17fada['status'](_0x517a3e);return _0x17fada[_0x0a5b('0x35')](_0x0a5b('0x36'),_0x384234+'-'+_0x35784b+'/'+_0x4aba6c)['json'](_0xee69d5);}return null;};}function patchUpdates(_0x3332e9){return function(_0x29c88b){try{jsonpatch['apply'](_0x29c88b,_0x3332e9,!![]);}catch(_0x3ccd16){return BPromise['reject'](_0x3ccd16);}return _0x29c88b[_0x0a5b('0x37')]();};}function saveUpdates(_0x13f59c,_0x33b2d5){return function(_0x1520e6){if(_0x1520e6){return _0x1520e6['update'](_0x13f59c)[_0x0a5b('0x24')](function(_0xee3f42){return _0xee3f42;});}return null;};}function removeEntity(_0x5cd964,_0x1fbe46){return function(_0x362736){if(_0x362736){return _0x362736[_0x0a5b('0x38')]()[_0x0a5b('0x24')](function(){_0x5cd964[_0x0a5b('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x376eb4,_0x66ecc){return function(_0x4e9e32){if(!_0x4e9e32){_0x376eb4[_0x0a5b('0x30')](0x194);}return _0x4e9e32;};}function handleError(_0x51f02b,_0x299d1a){_0x299d1a=_0x299d1a||0x1f4;return function(_0xb4a9b5){logger['error'](_0xb4a9b5[_0x0a5b('0x39')]);if(_0xb4a9b5[_0x0a5b('0x3a')]){delete _0xb4a9b5[_0x0a5b('0x3a')];}_0x51f02b['status'](_0x299d1a)['send'](_0xb4a9b5);};}exports['index']=function(_0x60aa61,_0x191824){var _0x4e7ef8={},_0x37fc6b={},_0x1da026={'count':0x0,'rows':[]};var _0x1adaeb=_[_0x0a5b('0x3b')](db[_0x0a5b('0x3c')]['rawAttributes'],function(_0x5bccac){return{'name':_0x5bccac['fieldName'],'type':_0x5bccac[_0x0a5b('0x3d')][_0x0a5b('0x3e')]};});_0x37fc6b[_0x0a5b('0x3f')]=_[_0x0a5b('0x3b')](_0x1adaeb,_0x0a5b('0x3a'));_0x37fc6b['query']=_[_0x0a5b('0x40')](_0x60aa61[_0x0a5b('0x41')]);_0x37fc6b[_0x0a5b('0x42')]=_[_0x0a5b('0x43')](_0x37fc6b[_0x0a5b('0x3f')],_0x37fc6b[_0x0a5b('0x41')]);_0x4e7ef8['attributes']=_['intersection'](_0x37fc6b[_0x0a5b('0x3f')],qs[_0x0a5b('0x44')](_0x60aa61['query']['fields']));_0x4e7ef8[_0x0a5b('0x45')]=_0x4e7ef8[_0x0a5b('0x45')][_0x0a5b('0x46')]?_0x4e7ef8['attributes']:_0x37fc6b[_0x0a5b('0x3f')];if(!_0x60aa61[_0x0a5b('0x41')]['hasOwnProperty'](_0x0a5b('0x47'))){_0x4e7ef8[_0x0a5b('0x48')]=qs[_0x0a5b('0x48')](_0x60aa61[_0x0a5b('0x41')][_0x0a5b('0x48')]);_0x4e7ef8[_0x0a5b('0x34')]=qs[_0x0a5b('0x34')](_0x60aa61['query'][_0x0a5b('0x34')]);}_0x4e7ef8['order']=qs[_0x0a5b('0x49')](_0x60aa61['query'][_0x0a5b('0x49')]);_0x4e7ef8['where']=qs['filters'](_[_0x0a5b('0x4a')](_0x60aa61[_0x0a5b('0x41')],_0x37fc6b[_0x0a5b('0x42')]),_0x1adaeb);if(_0x60aa61['query'][_0x0a5b('0x4b')]){_0x4e7ef8['where']=_[_0x0a5b('0x4c')](_0x4e7ef8[_0x0a5b('0x4d')],{'$or':_[_0x0a5b('0x3b')](_0x1adaeb,function(_0x12bd1e){if(_0x12bd1e[_0x0a5b('0x3d')]!=='VIRTUAL'){var _0x3f724b={};_0x3f724b[_0x12bd1e['name']]={'$like':'%'+_0x60aa61[_0x0a5b('0x41')][_0x0a5b('0x4b')]+'%'};return _0x3f724b;}})});}_0x4e7ef8=_[_0x0a5b('0x4c')]({},_0x4e7ef8,_0x60aa61['options']);var _0x356c99={'where':_0x4e7ef8[_0x0a5b('0x4d')]};return db[_0x0a5b('0x3c')][_0x0a5b('0x33')](_0x356c99)[_0x0a5b('0x24')](function(_0xd0aacb){_0x1da026['count']=_0xd0aacb;if(_0x60aa61[_0x0a5b('0x41')][_0x0a5b('0x4e')]){_0x4e7ef8[_0x0a5b('0x4f')]=[{'all':!![]}];}return db[_0x0a5b('0x3c')][_0x0a5b('0x50')](_0x4e7ef8);})[_0x0a5b('0x24')](function(_0x186dc8){_0x1da026[_0x0a5b('0x51')]=_0x186dc8;return _0x1da026;})[_0x0a5b('0x24')](respondWithFilteredResult(_0x191824,_0x4e7ef8))[_0x0a5b('0x2f')](handleError(_0x191824,null));};exports[_0x0a5b('0x52')]=function(_0x548d1f,_0x1f1e1a){var _0x3da399={'raw':!![],'where':{'id':_0x548d1f['params']['id']}},_0x27ef57={};_0x27ef57[_0x0a5b('0x3f')]=_['keys'](db[_0x0a5b('0x3c')][_0x0a5b('0x53')]);_0x27ef57['query']=_[_0x0a5b('0x40')](_0x548d1f[_0x0a5b('0x41')]);_0x27ef57[_0x0a5b('0x42')]=_['intersection'](_0x27ef57[_0x0a5b('0x3f')],_0x27ef57[_0x0a5b('0x41')]);_0x3da399[_0x0a5b('0x45')]=_[_0x0a5b('0x43')](_0x27ef57[_0x0a5b('0x3f')],qs[_0x0a5b('0x44')](_0x548d1f['query'][_0x0a5b('0x44')]));_0x3da399[_0x0a5b('0x45')]=_0x3da399['attributes']['length']?_0x3da399[_0x0a5b('0x45')]:_0x27ef57[_0x0a5b('0x3f')];if(_0x548d1f['query']['includeAll']){_0x3da399[_0x0a5b('0x4f')]=[{'all':!![]}];}_0x3da399=_[_0x0a5b('0x4c')]({},_0x3da399,_0x548d1f[_0x0a5b('0x54')]);return db[_0x0a5b('0x3c')][_0x0a5b('0x55')](_0x3da399)['then'](handleEntityNotFound(_0x1f1e1a,null))[_0x0a5b('0x24')](respondWithResult(_0x1f1e1a,null))[_0x0a5b('0x2f')](handleError(_0x1f1e1a,null));};exports[_0x0a5b('0x56')]=function(_0x2dbc40,_0x5006f6){if(_0x2dbc40[_0x0a5b('0x57')]['id']){delete _0x2dbc40[_0x0a5b('0x57')]['id'];}return db[_0x0a5b('0x3c')]['find']({'where':{'id':_0x2dbc40[_0x0a5b('0x58')]['id']}})[_0x0a5b('0x24')](handleEntityNotFound(_0x5006f6,null))['then'](saveUpdates(_0x2dbc40['body'],null))[_0x0a5b('0x24')](respondWithResult(_0x5006f6,null))[_0x0a5b('0x2f')](handleError(_0x5006f6,null));};exports[_0x0a5b('0x38')]=function(_0x59f965,_0x23526f){return db[_0x0a5b('0x3c')][_0x0a5b('0x55')]({'where':{'id':_0x59f965[_0x0a5b('0x58')]['id']}})[_0x0a5b('0x24')](handleEntityNotFound(_0x23526f,null))[_0x0a5b('0x24')](removeEntity(_0x23526f,null))[_0x0a5b('0x2f')](handleError(_0x23526f,null));};exports[_0x0a5b('0x59')]=function(_0x28358e,_0x160c17){return db[_0x0a5b('0x3c')][_0x0a5b('0x59')]()[_0x0a5b('0x24')](respondWithResult(_0x160c17,null))['catch'](handleError(_0x160c17,null));};exports['create']=function(_0x4121ae,_0x3ca971){return db['MailMessage']['create'](_0x4121ae['body'])[_0x0a5b('0x24')](function(_0x1abc81){if(_0x1abc81){if(_0x1abc81[_0x0a5b('0x5a')]===_0x0a5b('0x5b')&&!_0x1abc81[_0x0a5b('0x5c')]){var _0x44da09,_0x1b4ff7,_0x3bd96a;if(_0x4121ae[_0x0a5b('0x57')]['to']){_0x1b4ff7=_0x4121ae[_0x0a5b('0x57')]['to'][_0x0a5b('0x5d')](',')[0x0];}return db['MailAccount'][_0x0a5b('0x5e')]({'where':{'id':_0x1abc81['MailAccountId']},'include':[{'model':db[_0x0a5b('0x5f')],'as':'List','include':[{'model':db[_0x0a5b('0x60')],'as':_0x0a5b('0x61'),'where':{'email':_0x1b4ff7},'limit':0x1,'order':[[_0x0a5b('0x62'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x0a5b('0x24')](function(_0x143c1c){_0x44da09=_0x143c1c;if(_0x44da09&&_0x44da09['Smtp']){var _0x4af720={'tls':{'rejectUnauthorized':![]}};if(_[_0x0a5b('0x63')](_0x44da09[_0x0a5b('0x64')]['service'])){_0x4af720[_0x0a5b('0x65')]=_0x44da09[_0x0a5b('0x64')][_0x0a5b('0x65')];_0x4af720[_0x0a5b('0x66')]=_0x44da09['Smtp'][_0x0a5b('0x66')];_0x4af720[_0x0a5b('0x67')]=_0x44da09[_0x0a5b('0x64')][_0x0a5b('0x67')];if(_0x44da09[_0x0a5b('0x64')][_0x0a5b('0x68')]){_0x4af720[_0x0a5b('0x69')]={'user':_0x44da09[_0x0a5b('0x64')][_0x0a5b('0x6a')],'pass':_0x44da09[_0x0a5b('0x64')]['pass']};}}else{_0x4af720[_0x0a5b('0x6b')]=_0x44da09[_0x0a5b('0x64')][_0x0a5b('0x6b')];_0x4af720[_0x0a5b('0x69')]={'user':_0x44da09[_0x0a5b('0x64')]['user'],'pass':_0x44da09[_0x0a5b('0x64')][_0x0a5b('0x6c')]};_0x4af720[_0x0a5b('0x67')]=_0x44da09[_0x0a5b('0x64')][_0x0a5b('0x67')];}if(_0x4121ae[_0x0a5b('0x57')][_0x0a5b('0x6d')]&&_0x4121ae[_0x0a5b('0x57')][_0x0a5b('0x6d')]['length']){for(var _0x5a8a6e=0x0;_0x5a8a6e<_0x4121ae[_0x0a5b('0x57')][_0x0a5b('0x6d')][_0x0a5b('0x46')];_0x5a8a6e+=0x1){_0x4121ae[_0x0a5b('0x57')]['attachments'][_0x5a8a6e]={'filename':_0x4121ae[_0x0a5b('0x57')]['attachments'][_0x5a8a6e][_0x0a5b('0x3a')],'path':path[_0x0a5b('0x6e')](config[_0x0a5b('0x6f')],_0x0a5b('0x70'),_0x4121ae[_0x0a5b('0x57')]['attachments'][_0x5a8a6e][_0x0a5b('0x71')])};}}_0x3bd96a={'account':_0x4af720,'message':_0x4121ae[_0x0a5b('0x57')]};return;}})[_0x0a5b('0x24')](function(){if(_0x44da09[_0x0a5b('0x72')]){if(_0x44da09[_0x0a5b('0x72')][_0x0a5b('0x61')][_0x0a5b('0x46')]){return _0x44da09[_0x0a5b('0x72')][_0x0a5b('0x61')][0x0];}else{return db[_0x0a5b('0x60')][_0x0a5b('0x73')](_[_0x0a5b('0x1a')](_0x4121ae[_0x0a5b('0x57')],{'firstName':_0x4121ae['body']['to'],'email':_0x4121ae[_0x0a5b('0x57')]['to'],'phone':_0x4121ae[_0x0a5b('0x57')]['to'],'ListId':_0x44da09[_0x0a5b('0x74')]}));}}else{throw new Error(_0x0a5b('0x75'));}})['then'](function(){if(_0x3bd96a){return respondWithRpcPromise('SendMail',_0x0a5b('0x76'),_0x3bd96a,client9003)['then'](function(_0x4f0df6){return _0x1abc81[_0x0a5b('0x56')]({'read':!![],'messageId':_0x4f0df6['messageId'],'sentAt':moment()[_0x0a5b('0x77')](_0x0a5b('0x78'))});})[_0x0a5b('0x2f')](function(_0x363492){logger[_0x0a5b('0x2b')]('%s',JSON[_0x0a5b('0x2a')](_0x363492));return _0x1abc81;});}return _0x1abc81;});}return _0x1abc81;}})[_0x0a5b('0x24')](respondWithResult(_0x3ca971,0xc9))['catch'](handleError(_0x3ca971,null));};var interaction_log=require(_0x0a5b('0x14'))(_0x0a5b('0x79'));exports[_0x0a5b('0x7a')]=function(_0x47a00e,_0x5422fe,_0x131b4a){var _0x3ebb49={'channel':_0x0a5b('0x7b')};if(_0x47a00e[_0x0a5b('0x57')]['id']){delete _0x47a00e[_0x0a5b('0x57')]['id'];}_0x47a00e[_0x0a5b('0x57')]['read']=!![];_0x47a00e['body'][_0x0a5b('0x7c')]=moment()['format'](_0x0a5b('0x78'));_0x47a00e[_0x0a5b('0x57')][_0x0a5b('0x7d')]=_0x47a00e[_0x0a5b('0x57')][_0x0a5b('0x7d')]||_0x47a00e['user']['id'];return db['MailMessage'][_0x0a5b('0x55')]({'where':{'id':_0x47a00e['params']['id'],'UserId':null},'include':[{'model':db[_0x0a5b('0x60')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x5422fe,null))[_0x0a5b('0x24')](saveUpdates(_0x47a00e[_0x0a5b('0x57')],null))[_0x0a5b('0x24')](function(_0x384f42){if(_0x384f42){_0x3ebb49[_0x0a5b('0x2d')]=_0x384f42['get']({'plain':!![]});return db[_0x0a5b('0x7e')]['find']({'where':{'id':_0x384f42[_0x0a5b('0x7f')]}});}return null;})[_0x0a5b('0x24')](handleEntityNotFound(_0x5422fe,null))[_0x0a5b('0x24')](function(_0xf4aae2){if(_0xf4aae2){return _0xf4aae2['update']({'UserId':_0x47a00e[_0x0a5b('0x57')][_0x0a5b('0x7d')],'read1stAt':_[_0x0a5b('0x63')](_0xf4aae2['read1stAt'])?moment()[_0x0a5b('0x77')](_0x0a5b('0x78')):undefined});}return null;})[_0x0a5b('0x24')](function(_0x4209d1){if(_0x4209d1){_0x3ebb49['interaction']=_0x4209d1[_0x0a5b('0x80')]({'plain':!![]});interaction_log[_0x0a5b('0x25')](_0x0a5b('0x81'),_0x47a00e[_0x0a5b('0x6a')]['id'],_0x47a00e['user'][_0x0a5b('0x3a')],_0x47a00e[_0x0a5b('0x6a')][_0x0a5b('0x82')],_0x3ebb49[_0x0a5b('0x83')]['id'],_0x47a00e[_0x0a5b('0x57')]?JSON['stringify'](_0x47a00e[_0x0a5b('0x57')]):_0x0a5b('0x84'));return respondWithRpcPromise(_0x0a5b('0x85'),_0x0a5b('0x86'),_0x3ebb49);}return null;})['then'](function(_0x4cb1d9){if(_0x4cb1d9){if(_0x47a00e[_0x0a5b('0x57')][_0x0a5b('0x87')]){_0x3ebb49[_0x0a5b('0x2d')][_0x0a5b('0x88')]=util[_0x0a5b('0x77')](_0x0a5b('0x89'),_0x47a00e[_0x0a5b('0x6a')][_0x0a5b('0x3a')]);_0x3ebb49[_0x0a5b('0x2d')][_0x0a5b('0x8a')]=_0x3ebb49[_0x0a5b('0x8a')];_0x3ebb49['message'][_0x0a5b('0x8b')]=_0x0a5b('0x7a');return respondWithRpcPromise(_0x0a5b('0x8c'),_0x0a5b('0x8c'),{'event':_0x0a5b('0x8d'),'message':_0x3ebb49[_0x0a5b('0x2d')]},client9002)[_0x0a5b('0x24')](function(){return _0x3ebb49;});}return _0x3ebb49;}return null;})[_0x0a5b('0x24')](respondWithResult(_0x5422fe,null))[_0x0a5b('0x2f')](handleError(_0x5422fe,null));};var interaction_log=require(_0x0a5b('0x14'))('mail-interactions');exports[_0x0a5b('0x8e')]=function(_0xfd49ce,_0x3ae8ab,_0x3eb036){var _0x3a97ed={'agent':{},'channel':_0x0a5b('0x7b')};if(_0xfd49ce['body']['id']){delete _0xfd49ce[_0x0a5b('0x57')]['id'];}_0xfd49ce[_0x0a5b('0x57')][_0x0a5b('0x7d')]=_0xfd49ce['body'][_0x0a5b('0x7d')]||_0xfd49ce[_0x0a5b('0x6a')]['id'];_0x3a97ed[_0x0a5b('0x8f')]['id']=_0xfd49ce['body'][_0x0a5b('0x7d')];return db['MailMessage'][_0x0a5b('0x55')]({'where':{'id':_0xfd49ce[_0x0a5b('0x58')]['id'],'UserId':null}})[_0x0a5b('0x24')](handleEntityNotFound(_0x3ae8ab,null))[_0x0a5b('0x24')](function(_0x34011e){if(_0x34011e){_0x3a97ed['message']=_0x34011e['get']({'plain':!![]});return db[_0x0a5b('0x7e')][_0x0a5b('0x55')]({'where':{'id':_0x34011e[_0x0a5b('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x3ae8ab,null))[_0x0a5b('0x24')](function(_0x5cfc71){if(_0x5cfc71){_0x3a97ed[_0x0a5b('0x83')]=_0x5cfc71[_0x0a5b('0x80')]({'plain':!![]});interaction_log['info'](_0x0a5b('0x90'),_0xfd49ce[_0x0a5b('0x6a')]['id'],_0xfd49ce['user'][_0x0a5b('0x3a')],_0xfd49ce[_0x0a5b('0x6a')]['role'],_0x3a97ed['interaction']['id'],_0xfd49ce['body']?JSON[_0x0a5b('0x2a')](_0xfd49ce[_0x0a5b('0x57')]):_0x0a5b('0x84'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3a97ed);}return null;})[_0x0a5b('0x24')](function(_0x244ae7){if(_0x244ae7){_0x244ae7[_0x0a5b('0x2d')][_0x0a5b('0x88')]=util[_0x0a5b('0x77')]('SIP/%s',_0xfd49ce[_0x0a5b('0x6a')]['name']);_0x244ae7['message'][_0x0a5b('0x8a')]=_0x3a97ed[_0x0a5b('0x8a')];_0x244ae7[_0x0a5b('0x2d')][_0x0a5b('0x8b')]=_0x0a5b('0x8e');respondWithRpcPromise(_0x0a5b('0x8c'),_0x0a5b('0x8c'),{'event':_0x0a5b('0x91'),'message':_0x244ae7['message']},client9002);return _0x3a97ed;}return null;})['then'](respondWithResult(_0x3ae8ab,null))[_0x0a5b('0x2f')](handleError(_0x3ae8ab,null));};exports[_0x0a5b('0x92')]=function(_0x549fc8,_0x3c880e){var _0x1df74e=moment()[_0x0a5b('0x93')]()[_0x0a5b('0x94')]();var _0x1ffcc0=path['join'](config[_0x0a5b('0x6f')],_0x0a5b('0x95'),_0x0a5b('0x96'),_0x0a5b('0x97'));var _0x275313=path[_0x0a5b('0x6e')](config['root'],'server',_0x0a5b('0x96'),_0x0a5b('0x6d'));var _0x36284c=util[_0x0a5b('0x77')]('message-%s.eml',_0x1df74e);return db['MailMessage']['find']({'where':{'id':_0x549fc8[_0x0a5b('0x58')]['id']},'attributes':['id',_0x0a5b('0x57'),_0x0a5b('0x98'),'to','cc',_0x0a5b('0x99'),'subject',_0x0a5b('0x9a')],'include':_0x549fc8[_0x0a5b('0x41')][_0x0a5b('0x6d')]?[{'model':db[_0x0a5b('0x9b')],'as':'Attachments'}]:undefined})[_0x0a5b('0x24')](handleEntityNotFound(_0x3c880e,null))['then'](function(_0x30d71f){if(_0x30d71f){var _0x30cb37=_0x30d71f;var _0x49da28={'from':_0x30cb37['from'],'to':_0x30cb37['to'],'subject':_0x30cb37[_0x0a5b('0x9c')],'html':_0x30cb37[_0x0a5b('0x57')],'headers':{'Date':moment(_0x30cb37[_0x0a5b('0x9a')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x30d71f['cc']){_0x49da28['headers']['Cc']=_0x30d71f['cc'];}if(_0x30d71f['bcc']){_0x49da28[_0x0a5b('0x9d')][_0x0a5b('0x9e')]=_0x30d71f[_0x0a5b('0x99')];}return new BPromise(function(_0xf46b37,_0x16fe62){if(_0x30d71f[_0x0a5b('0x9f')]){for(var _0x5b12ef=0x0;_0x5b12ef<_0x30d71f[_0x0a5b('0x9f')][_0x0a5b('0x46')];_0x5b12ef++){var _0x5e7390=_0x30d71f[_0x0a5b('0x9f')][_0x5b12ef];var _0x14c8ef=path['join'](_0x275313,_0x5e7390[_0x0a5b('0x71')]);if(fs[_0x0a5b('0xa0')](_0x14c8ef)){_0x49da28['attachments'][_0x0a5b('0xa1')]({'name':_0x5e7390[_0x0a5b('0x3a')],'contentType':_0x5e7390[_0x0a5b('0x3d')],'data':fs[_0x0a5b('0xa2')](_0x14c8ef)});}}}emlformat[_0x0a5b('0xa3')](_0x49da28,function(_0x2a506c,_0x291e71){if(_0x2a506c)return _0x16fe62(_0x2a506c);fs['writeFileSync'](path[_0x0a5b('0x6e')](_0x1ffcc0,_0x36284c),_0x291e71);return _0xf46b37(_0x291e71);});});}})[_0x0a5b('0x24')](function(_0x5230e3){if(_0x5230e3){return _0x3c880e[_0x0a5b('0x92')](path[_0x0a5b('0x6e')](_0x1ffcc0,_0x36284c),_0x36284c,function(_0x581f75){if(_0x581f75){console['log']('err',_0x581f75);}else{fs[_0x0a5b('0xa4')](path[_0x0a5b('0x6e')](_0x1ffcc0,_0x36284c));}});}})[_0x0a5b('0x2f')](handleError(_0x3c880e,null));}; \ No newline at end of file +var _0xd1d0=['show','fields','includeAll','find','body','params','describe','create','out','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','Smtp','isNil','service','host','secure','authentication','user','pass','attachments','join','root','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','update','messageId','format','../../config/logger','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','MailInteraction','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','mail-interactions','agent','get','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','download','toString','server','files','from','bcc','subject','createdAt','headers','Bcc','Attachments','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','./mailMessage.socket','register','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','count','offset','set','json','apply','reject','save','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','MailMessage','include','rows','catch'];(function(_0x53e431,_0x33b486){var _0x5c4715=function(_0x386b2e){while(--_0x386b2e){_0x53e431['push'](_0x53e431['shift']());}};_0x5c4715(++_0x33b486);}(_0xd1d0,0x192));var _0x0d1d=function(_0x2eab77,_0x2ed339){_0x2eab77=_0x2eab77-0x0;var _0x163533=_0xd1d0[_0x2eab77];return _0x163533;};'use strict';var pdf=require(_0x0d1d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d1d('0x1'));var jsonpatch=require(_0x0d1d('0x2'));var rp=require(_0x0d1d('0x3'));var moment=require(_0x0d1d('0x4'));var BPromise=require(_0x0d1d('0x5'));var Mustache=require(_0x0d1d('0x6'));var util=require(_0x0d1d('0x7'));var path=require('path');var sox=require(_0x0d1d('0x8'));var csv=require(_0x0d1d('0x9'));var ejs=require(_0x0d1d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0d1d('0xb'));var crypto=require(_0x0d1d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0d1d('0xd'));var toCsv=require(_0x0d1d('0x9'));var querystring=require('querystring');var Papa=require(_0x0d1d('0xe'));var Redis=require(_0x0d1d('0xf'));var authService=require(_0x0d1d('0x10'));var qs=require(_0x0d1d('0x11'));var as=require(_0x0d1d('0x12'));var hardwareService=require(_0x0d1d('0x13'));var logger=require('../../config/logger')(_0x0d1d('0x14'));var utils=require('../../config/utils');var config=require(_0x0d1d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d1d('0x16'))['db'];config['redis']=_['defaults'](config[_0x0d1d('0x17')],{'host':_0x0d1d('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d1d('0x17')]));require(_0x0d1d('0x19'))[_0x0d1d('0x1a')](socket);var jayson=require(_0x0d1d('0x1b'));var client=jayson['client'][_0x0d1d('0x1c')]({'port':0x232c});var client9003=jayson[_0x0d1d('0x1d')][_0x0d1d('0x1c')]({'port':0x232b});var client9002=jayson[_0x0d1d('0x1d')][_0x0d1d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4af6fc,_0x2d5491,_0x20fed1,_0x48cc12){return new BPromise(function(_0x73cfff,_0x1e9b5c){var _0x49684c=_0x48cc12||client;return _0x49684c['request'](_0x4af6fc,_0x20fed1)[_0x0d1d('0x1e')](function(_0x7e728a){logger[_0x0d1d('0x1f')](_0x0d1d('0x20'),_0x2d5491,'request\x20sent');logger['debug'](_0x0d1d('0x21'),_0x2d5491,_0x0d1d('0x22'),JSON[_0x0d1d('0x23')](_0x7e728a));if(_0x7e728a['error']){if(_0x7e728a[_0x0d1d('0x24')]['code']===0x1f4){logger[_0x0d1d('0x24')](_0x0d1d('0x20'),_0x2d5491,_0x7e728a['error'][_0x0d1d('0x25')]);return _0x1e9b5c(_0x7e728a[_0x0d1d('0x24')][_0x0d1d('0x25')]);}logger[_0x0d1d('0x24')](_0x0d1d('0x20'),_0x2d5491,_0x7e728a[_0x0d1d('0x24')]['message']);return _0x73cfff(_0x7e728a[_0x0d1d('0x24')]['message']);}else{logger['info'](_0x0d1d('0x20'),_0x2d5491,_0x0d1d('0x22'));_0x73cfff(_0x7e728a[_0x0d1d('0x26')][_0x0d1d('0x25')]);}})['catch'](function(_0x26cda3){logger['error'](_0x0d1d('0x20'),_0x2d5491,_0x26cda3);_0x1e9b5c(_0x26cda3);});});}function respondWithStatusCode(_0x2a0d3a,_0x42893d){_0x42893d=_0x42893d||0xcc;return function(_0x1e2f1a){if(_0x1e2f1a){return _0x2a0d3a[_0x0d1d('0x27')](_0x42893d);}return _0x2a0d3a[_0x0d1d('0x28')](_0x42893d)['end']();};}function respondWithResult(_0x5b080,_0x325aae){_0x325aae=_0x325aae||0xc8;return function(_0xd77c4a){if(_0xd77c4a){return _0x5b080[_0x0d1d('0x28')](_0x325aae)['json'](_0xd77c4a);}};}function respondWithFilteredResult(_0x4a00f5,_0xb4f7f3){return function(_0x19729e){if(_0x19729e){var _0x3ceeb0=_0x19729e[_0x0d1d('0x29')],_0x8d94ab=_0xb4f7f3[_0x0d1d('0x2a')],_0x150131=_0xb4f7f3[_0x0d1d('0x2a')]+_0xb4f7f3['limit'],_0x42cbd5;if(_0x150131>=_0x3ceeb0){_0x150131=_0x3ceeb0;_0x42cbd5=0xc8;}else{_0x42cbd5=0xce;}_0x4a00f5['status'](_0x42cbd5);return _0x4a00f5[_0x0d1d('0x2b')]('Content-Range',_0x8d94ab+'-'+_0x150131+'/'+_0x3ceeb0)[_0x0d1d('0x2c')](_0x19729e);}return null;};}function patchUpdates(_0x216f87){return function(_0x49118c){try{jsonpatch[_0x0d1d('0x2d')](_0x49118c,_0x216f87,!![]);}catch(_0x47de16){return BPromise[_0x0d1d('0x2e')](_0x47de16);}return _0x49118c[_0x0d1d('0x2f')]();};}function saveUpdates(_0x552426,_0x291b9c){return function(_0x1a4ed2){if(_0x1a4ed2){return _0x1a4ed2['update'](_0x552426)[_0x0d1d('0x1e')](function(_0x286a72){return _0x286a72;});}return null;};}function removeEntity(_0x4f311f,_0x14749b){return function(_0x5db642){if(_0x5db642){return _0x5db642[_0x0d1d('0x30')]()[_0x0d1d('0x1e')](function(){_0x4f311f[_0x0d1d('0x28')](0xcc)[_0x0d1d('0x31')]();});}};}function handleEntityNotFound(_0x1074d6,_0x368756){return function(_0x221f3e){if(!_0x221f3e){_0x1074d6[_0x0d1d('0x27')](0x194);}return _0x221f3e;};}function handleError(_0x424c07,_0x15d362){_0x15d362=_0x15d362||0x1f4;return function(_0x490efb){logger[_0x0d1d('0x24')](_0x490efb['stack']);if(_0x490efb[_0x0d1d('0x32')]){delete _0x490efb[_0x0d1d('0x32')];}_0x424c07['status'](_0x15d362)[_0x0d1d('0x33')](_0x490efb);};}exports[_0x0d1d('0x34')]=function(_0x351c69,_0x239320){var _0x179995={},_0x726986={},_0x15819b={'count':0x0,'rows':[]};var _0x53e018=_[_0x0d1d('0x35')](db['MailMessage'][_0x0d1d('0x36')],function(_0x13b9b2){return{'name':_0x13b9b2[_0x0d1d('0x37')],'type':_0x13b9b2[_0x0d1d('0x38')][_0x0d1d('0x39')]};});_0x726986[_0x0d1d('0x3a')]=_['map'](_0x53e018,_0x0d1d('0x32'));_0x726986['query']=_[_0x0d1d('0x3b')](_0x351c69[_0x0d1d('0x3c')]);_0x726986[_0x0d1d('0x3d')]=_[_0x0d1d('0x3e')](_0x726986[_0x0d1d('0x3a')],_0x726986[_0x0d1d('0x3c')]);_0x179995[_0x0d1d('0x3f')]=_[_0x0d1d('0x3e')](_0x726986[_0x0d1d('0x3a')],qs['fields'](_0x351c69[_0x0d1d('0x3c')]['fields']));_0x179995['attributes']=_0x179995['attributes'][_0x0d1d('0x40')]?_0x179995[_0x0d1d('0x3f')]:_0x726986['model'];if(!_0x351c69[_0x0d1d('0x3c')]['hasOwnProperty'](_0x0d1d('0x41'))){_0x179995[_0x0d1d('0x42')]=qs[_0x0d1d('0x42')](_0x351c69[_0x0d1d('0x3c')][_0x0d1d('0x42')]);_0x179995[_0x0d1d('0x2a')]=qs[_0x0d1d('0x2a')](_0x351c69[_0x0d1d('0x3c')][_0x0d1d('0x2a')]);}_0x179995[_0x0d1d('0x43')]=qs['sort'](_0x351c69['query']['sort']);_0x179995[_0x0d1d('0x44')]=qs[_0x0d1d('0x3d')](_[_0x0d1d('0x45')](_0x351c69[_0x0d1d('0x3c')],_0x726986[_0x0d1d('0x3d')]),_0x53e018);if(_0x351c69['query'][_0x0d1d('0x46')]){_0x179995[_0x0d1d('0x44')]=_[_0x0d1d('0x47')](_0x179995[_0x0d1d('0x44')],{'$or':_[_0x0d1d('0x35')](_0x53e018,function(_0x125257){if(_0x125257[_0x0d1d('0x38')]!==_0x0d1d('0x48')){var _0x41ab78={};_0x41ab78[_0x125257[_0x0d1d('0x32')]]={'$like':'%'+_0x351c69['query'][_0x0d1d('0x46')]+'%'};return _0x41ab78;}})});}_0x179995=_[_0x0d1d('0x47')]({},_0x179995,_0x351c69[_0x0d1d('0x49')]);var _0x667f3e={'where':_0x179995[_0x0d1d('0x44')]};return db[_0x0d1d('0x4a')][_0x0d1d('0x29')](_0x667f3e)['then'](function(_0x230401){_0x15819b[_0x0d1d('0x29')]=_0x230401;if(_0x351c69['query']['includeAll']){_0x179995[_0x0d1d('0x4b')]=[{'all':!![]}];}return db[_0x0d1d('0x4a')]['findAll'](_0x179995);})[_0x0d1d('0x1e')](function(_0x4d531d){_0x15819b[_0x0d1d('0x4c')]=_0x4d531d;return _0x15819b;})[_0x0d1d('0x1e')](respondWithFilteredResult(_0x239320,_0x179995))[_0x0d1d('0x4d')](handleError(_0x239320,null));};exports[_0x0d1d('0x4e')]=function(_0x35c76d,_0x32e749){var _0x27a0d8={'raw':!![],'where':{'id':_0x35c76d['params']['id']}},_0x3d55e6={};_0x3d55e6[_0x0d1d('0x3a')]=_[_0x0d1d('0x3b')](db[_0x0d1d('0x4a')][_0x0d1d('0x36')]);_0x3d55e6[_0x0d1d('0x3c')]=_[_0x0d1d('0x3b')](_0x35c76d[_0x0d1d('0x3c')]);_0x3d55e6[_0x0d1d('0x3d')]=_[_0x0d1d('0x3e')](_0x3d55e6[_0x0d1d('0x3a')],_0x3d55e6[_0x0d1d('0x3c')]);_0x27a0d8[_0x0d1d('0x3f')]=_[_0x0d1d('0x3e')](_0x3d55e6[_0x0d1d('0x3a')],qs[_0x0d1d('0x4f')](_0x35c76d[_0x0d1d('0x3c')][_0x0d1d('0x4f')]));_0x27a0d8['attributes']=_0x27a0d8[_0x0d1d('0x3f')]['length']?_0x27a0d8['attributes']:_0x3d55e6[_0x0d1d('0x3a')];if(_0x35c76d[_0x0d1d('0x3c')][_0x0d1d('0x50')]){_0x27a0d8[_0x0d1d('0x4b')]=[{'all':!![]}];}_0x27a0d8=_['merge']({},_0x27a0d8,_0x35c76d[_0x0d1d('0x49')]);return db[_0x0d1d('0x4a')][_0x0d1d('0x51')](_0x27a0d8)[_0x0d1d('0x1e')](handleEntityNotFound(_0x32e749,null))[_0x0d1d('0x1e')](respondWithResult(_0x32e749,null))[_0x0d1d('0x4d')](handleError(_0x32e749,null));};exports['update']=function(_0x38c9d4,_0x14dc06){if(_0x38c9d4[_0x0d1d('0x52')]['id']){delete _0x38c9d4[_0x0d1d('0x52')]['id'];}return db[_0x0d1d('0x4a')][_0x0d1d('0x51')]({'where':{'id':_0x38c9d4['params']['id']}})[_0x0d1d('0x1e')](handleEntityNotFound(_0x14dc06,null))['then'](saveUpdates(_0x38c9d4[_0x0d1d('0x52')],null))[_0x0d1d('0x1e')](respondWithResult(_0x14dc06,null))['catch'](handleError(_0x14dc06,null));};exports[_0x0d1d('0x30')]=function(_0x1a4ba4,_0x3bcfeb){return db[_0x0d1d('0x4a')][_0x0d1d('0x51')]({'where':{'id':_0x1a4ba4[_0x0d1d('0x53')]['id']}})[_0x0d1d('0x1e')](handleEntityNotFound(_0x3bcfeb,null))[_0x0d1d('0x1e')](removeEntity(_0x3bcfeb,null))[_0x0d1d('0x4d')](handleError(_0x3bcfeb,null));};exports[_0x0d1d('0x54')]=function(_0x23ffd6,_0x52a8e7){return db[_0x0d1d('0x4a')]['describe']()[_0x0d1d('0x1e')](respondWithResult(_0x52a8e7,null))['catch'](handleError(_0x52a8e7,null));};exports['create']=function(_0x41851b,_0x187dee){return db[_0x0d1d('0x4a')][_0x0d1d('0x55')](_0x41851b['body'])[_0x0d1d('0x1e')](function(_0x364615){if(_0x364615){if(_0x364615['direction']===_0x0d1d('0x56')&&!_0x364615[_0x0d1d('0x57')]){var _0x2e8483,_0x35a3d4,_0x498fc4;if(_0x41851b[_0x0d1d('0x52')]['to']){_0x35a3d4=_0x41851b['body']['to']['split'](',')[0x0];}return db[_0x0d1d('0x58')][_0x0d1d('0x59')]({'where':{'id':_0x364615[_0x0d1d('0x5a')]},'include':[{'model':db[_0x0d1d('0x5b')],'as':_0x0d1d('0x5c'),'include':[{'model':db[_0x0d1d('0x5d')],'as':_0x0d1d('0x5e'),'where':{'email':_0x35a3d4},'limit':0x1,'order':[[_0x0d1d('0x5f'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x0d1d('0x60'),'raw':!![]}]})[_0x0d1d('0x1e')](function(_0x273cc3){_0x2e8483=_0x273cc3;if(_0x2e8483&&_0x2e8483['Smtp']){var _0x6087ea={'tls':{'rejectUnauthorized':![]}};if(_[_0x0d1d('0x61')](_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x62')])){_0x6087ea[_0x0d1d('0x63')]=_0x2e8483['Smtp'][_0x0d1d('0x63')];_0x6087ea['port']=_0x2e8483[_0x0d1d('0x60')]['port'];_0x6087ea[_0x0d1d('0x64')]=_0x2e8483['Smtp'][_0x0d1d('0x64')];if(_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x65')]){_0x6087ea['auth']={'user':_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x66')],'pass':_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x67')]};}}else{_0x6087ea[_0x0d1d('0x62')]=_0x2e8483[_0x0d1d('0x60')]['service'];_0x6087ea['auth']={'user':_0x2e8483['Smtp'][_0x0d1d('0x66')],'pass':_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x67')]};_0x6087ea[_0x0d1d('0x64')]=_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x64')];}if(_0x41851b[_0x0d1d('0x52')]['attachments']&&_0x41851b[_0x0d1d('0x52')]['attachments']['length']){for(var _0x382b17=0x0;_0x382b17<_0x41851b[_0x0d1d('0x52')][_0x0d1d('0x68')]['length'];_0x382b17+=0x1){_0x41851b[_0x0d1d('0x52')]['attachments'][_0x382b17]={'filename':_0x41851b[_0x0d1d('0x52')][_0x0d1d('0x68')][_0x382b17][_0x0d1d('0x32')],'path':path[_0x0d1d('0x69')](config[_0x0d1d('0x6a')],_0x0d1d('0x6b'),_0x41851b[_0x0d1d('0x52')][_0x0d1d('0x68')][_0x382b17][_0x0d1d('0x6c')])};}}_0x498fc4={'account':_0x6087ea,'message':_0x41851b[_0x0d1d('0x52')]};return;}})[_0x0d1d('0x1e')](function(){if(_0x2e8483[_0x0d1d('0x5c')]){if(_0x2e8483[_0x0d1d('0x5c')]['Contacts']['length']){return _0x2e8483[_0x0d1d('0x5c')]['Contacts'][0x0];}else{return db[_0x0d1d('0x5d')][_0x0d1d('0x55')](_[_0x0d1d('0x6d')](_0x41851b[_0x0d1d('0x52')],{'firstName':_0x41851b[_0x0d1d('0x52')]['to'],'email':_0x41851b[_0x0d1d('0x52')]['to'],'phone':_0x41851b[_0x0d1d('0x52')]['to'],'ListId':_0x2e8483[_0x0d1d('0x6e')]}));}}else{throw new Error(_0x0d1d('0x6f'));}})['then'](function(){if(_0x498fc4){return respondWithRpcPromise('SendMail','sendMail',_0x498fc4,client9003)[_0x0d1d('0x1e')](function(_0x169c41){return _0x364615[_0x0d1d('0x70')]({'read':!![],'messageId':_0x169c41[_0x0d1d('0x71')],'sentAt':moment()[_0x0d1d('0x72')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x0d1d('0x4d')](function(_0x4b48a9){logger['error']('%s',JSON['stringify'](_0x4b48a9));return _0x364615;});}return _0x364615;});}return _0x364615;}})[_0x0d1d('0x1e')](respondWithResult(_0x187dee,0xc9))[_0x0d1d('0x4d')](handleError(_0x187dee,null));};var interaction_log=require(_0x0d1d('0x73'))('mail-interactions');exports[_0x0d1d('0x74')]=function(_0x3de48f,_0x1287e5,_0x1a36a2){var _0x343f1d={'channel':_0x0d1d('0x75')};if(_0x3de48f[_0x0d1d('0x52')]['id']){delete _0x3de48f['body']['id'];}_0x3de48f[_0x0d1d('0x52')][_0x0d1d('0x76')]=!![];_0x3de48f[_0x0d1d('0x52')][_0x0d1d('0x77')]=moment()['format'](_0x0d1d('0x78'));_0x3de48f['body'][_0x0d1d('0x79')]=_0x3de48f[_0x0d1d('0x52')][_0x0d1d('0x79')]||_0x3de48f[_0x0d1d('0x66')]['id'];return db[_0x0d1d('0x4a')][_0x0d1d('0x51')]({'where':{'id':_0x3de48f[_0x0d1d('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x0d1d('0x7a')}]})[_0x0d1d('0x1e')](handleEntityNotFound(_0x1287e5,null))[_0x0d1d('0x1e')](saveUpdates(_0x3de48f[_0x0d1d('0x52')],null))['then'](function(_0x1386f2){if(_0x1386f2){_0x343f1d[_0x0d1d('0x25')]=_0x1386f2['get']({'plain':!![]});return db[_0x0d1d('0x7b')][_0x0d1d('0x51')]({'where':{'id':_0x1386f2['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1287e5,null))[_0x0d1d('0x1e')](function(_0x3e1e34){if(_0x3e1e34){return _0x3e1e34[_0x0d1d('0x70')]({'UserId':_0x3de48f[_0x0d1d('0x52')]['UserId'],'read1stAt':_['isNil'](_0x3e1e34['read1stAt'])?moment()[_0x0d1d('0x72')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0d1d('0x1e')](function(_0x50a16a){if(_0x50a16a){_0x343f1d[_0x0d1d('0x7c')]=_0x50a16a['get']({'plain':!![]});interaction_log['info'](_0x0d1d('0x7d'),_0x3de48f['user']['id'],_0x3de48f[_0x0d1d('0x66')][_0x0d1d('0x32')],_0x3de48f[_0x0d1d('0x66')][_0x0d1d('0x7e')],_0x343f1d[_0x0d1d('0x7c')]['id'],_0x3de48f['body']?JSON[_0x0d1d('0x23')](_0x3de48f[_0x0d1d('0x52')]):_0x0d1d('0x7f'));return respondWithRpcPromise(_0x0d1d('0x80'),'acceptMessage',_0x343f1d);}return null;})[_0x0d1d('0x1e')](function(_0x466d12){if(_0x466d12){if(_0x3de48f[_0x0d1d('0x52')][_0x0d1d('0x81')]){_0x343f1d['message'][_0x0d1d('0x82')]=util['format'](_0x0d1d('0x83'),_0x3de48f['user'][_0x0d1d('0x32')]);_0x343f1d['message'][_0x0d1d('0x84')]=_0x343f1d[_0x0d1d('0x84')];_0x343f1d[_0x0d1d('0x25')][_0x0d1d('0x85')]=_0x0d1d('0x74');return respondWithRpcPromise('EventManager',_0x0d1d('0x86'),{'event':'acceptmessage','message':_0x343f1d[_0x0d1d('0x25')]},client9002)[_0x0d1d('0x1e')](function(){return _0x343f1d;});}return _0x343f1d;}return null;})[_0x0d1d('0x1e')](respondWithResult(_0x1287e5,null))[_0x0d1d('0x4d')](handleError(_0x1287e5,null));};var interaction_log=require(_0x0d1d('0x73'))(_0x0d1d('0x87'));exports['reject']=function(_0x5dad52,_0x2226d2,_0x205e58){var _0x30a456={'agent':{},'channel':_0x0d1d('0x75')};if(_0x5dad52[_0x0d1d('0x52')]['id']){delete _0x5dad52[_0x0d1d('0x52')]['id'];}_0x5dad52[_0x0d1d('0x52')][_0x0d1d('0x79')]=_0x5dad52[_0x0d1d('0x52')][_0x0d1d('0x79')]||_0x5dad52[_0x0d1d('0x66')]['id'];_0x30a456[_0x0d1d('0x88')]['id']=_0x5dad52[_0x0d1d('0x52')][_0x0d1d('0x79')];return db[_0x0d1d('0x4a')][_0x0d1d('0x51')]({'where':{'id':_0x5dad52[_0x0d1d('0x53')]['id'],'UserId':null}})[_0x0d1d('0x1e')](handleEntityNotFound(_0x2226d2,null))[_0x0d1d('0x1e')](function(_0x5ce8ff){if(_0x5ce8ff){_0x30a456['message']=_0x5ce8ff[_0x0d1d('0x89')]({'plain':!![]});return db[_0x0d1d('0x7b')][_0x0d1d('0x51')]({'where':{'id':_0x5ce8ff[_0x0d1d('0x8a')]}});}return null;})[_0x0d1d('0x1e')](handleEntityNotFound(_0x2226d2,null))[_0x0d1d('0x1e')](function(_0x5586a4){if(_0x5586a4){_0x30a456[_0x0d1d('0x7c')]=_0x5586a4['get']({'plain':!![]});interaction_log[_0x0d1d('0x1f')](_0x0d1d('0x8b'),_0x5dad52['user']['id'],_0x5dad52['user'][_0x0d1d('0x32')],_0x5dad52[_0x0d1d('0x66')][_0x0d1d('0x7e')],_0x30a456[_0x0d1d('0x7c')]['id'],_0x5dad52[_0x0d1d('0x52')]?JSON[_0x0d1d('0x23')](_0x5dad52[_0x0d1d('0x52')]):_0x0d1d('0x7f'));return respondWithRpcPromise('RejectMessage',_0x0d1d('0x8c'),_0x30a456);}return null;})['then'](function(_0x30c87c){if(_0x30c87c){_0x30c87c[_0x0d1d('0x25')][_0x0d1d('0x82')]=util[_0x0d1d('0x72')](_0x0d1d('0x83'),_0x5dad52[_0x0d1d('0x66')][_0x0d1d('0x32')]);_0x30c87c['message'][_0x0d1d('0x84')]=_0x30a456['channel'];_0x30c87c[_0x0d1d('0x25')][_0x0d1d('0x85')]=_0x0d1d('0x2e');respondWithRpcPromise(_0x0d1d('0x86'),_0x0d1d('0x86'),{'event':_0x0d1d('0x8d'),'message':_0x30c87c[_0x0d1d('0x25')]},client9002);return _0x30a456;}return null;})[_0x0d1d('0x1e')](respondWithResult(_0x2226d2,null))[_0x0d1d('0x4d')](handleError(_0x2226d2,null));};exports[_0x0d1d('0x8e')]=function(_0x58d3e7,_0x317f25){var _0x53e1a4=moment()['unix']()[_0x0d1d('0x8f')]();var _0x2b9615=path[_0x0d1d('0x69')](config[_0x0d1d('0x6a')],_0x0d1d('0x90'),_0x0d1d('0x91'),'tmp');var _0x5624b1=path[_0x0d1d('0x69')](config['root'],_0x0d1d('0x90'),_0x0d1d('0x91'),_0x0d1d('0x68'));var _0x4ffc4e=util[_0x0d1d('0x72')]('message-%s.eml',_0x53e1a4);return db[_0x0d1d('0x4a')]['find']({'where':{'id':_0x58d3e7[_0x0d1d('0x53')]['id']},'attributes':['id',_0x0d1d('0x52'),_0x0d1d('0x92'),'to','cc',_0x0d1d('0x93'),_0x0d1d('0x94'),_0x0d1d('0x95')],'include':_0x58d3e7[_0x0d1d('0x3c')][_0x0d1d('0x68')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x0d1d('0x1e')](handleEntityNotFound(_0x317f25,null))[_0x0d1d('0x1e')](function(_0x133e6b){if(_0x133e6b){var _0x4d603e=_0x133e6b;var _0x381ebb={'from':_0x4d603e[_0x0d1d('0x92')],'to':_0x4d603e['to'],'subject':_0x4d603e[_0x0d1d('0x94')],'html':_0x4d603e['body'],'headers':{'Date':moment(_0x4d603e[_0x0d1d('0x95')])[_0x0d1d('0x72')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x133e6b['cc']){_0x381ebb[_0x0d1d('0x96')]['Cc']=_0x133e6b['cc'];}if(_0x133e6b[_0x0d1d('0x93')]){_0x381ebb[_0x0d1d('0x96')][_0x0d1d('0x97')]=_0x133e6b[_0x0d1d('0x93')];}return new BPromise(function(_0x42343a,_0x4bb0e3){if(_0x133e6b[_0x0d1d('0x98')]){for(var _0x59cc33=0x0;_0x59cc33<_0x133e6b[_0x0d1d('0x98')]['length'];_0x59cc33++){var _0x4078c8=_0x133e6b['Attachments'][_0x59cc33];var _0x2b5568=path['join'](_0x5624b1,_0x4078c8[_0x0d1d('0x6c')]);if(fs['existsSync'](_0x2b5568)){_0x381ebb['attachments'][_0x0d1d('0x99')]({'name':_0x4078c8[_0x0d1d('0x32')],'contentType':_0x4078c8[_0x0d1d('0x38')],'data':fs[_0x0d1d('0x9a')](_0x2b5568)});}}}emlformat[_0x0d1d('0x9b')](_0x381ebb,function(_0x45f3f3,_0x2a4a99){if(_0x45f3f3)return _0x4bb0e3(_0x45f3f3);fs[_0x0d1d('0x9c')](path[_0x0d1d('0x69')](_0x2b9615,_0x4ffc4e),_0x2a4a99);return _0x42343a(_0x2a4a99);});});}})['then'](function(_0x226d3e){if(_0x226d3e){return _0x317f25[_0x0d1d('0x8e')](path[_0x0d1d('0x69')](_0x2b9615,_0x4ffc4e),_0x4ffc4e,function(_0x19e908){if(_0x19e908){console[_0x0d1d('0x9d')](_0x0d1d('0x9e'),_0x19e908);}else{fs[_0x0d1d('0x9f')](path[_0x0d1d('0x69')](_0x2b9615,_0x4ffc4e));}});}})[_0x0d1d('0x4d')](handleError(_0x317f25,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index d75a92e..02a3d1f 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a0f=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2a03c5,_0x138e2a){var _0x24fdc7=function(_0x5b558d){while(--_0x5b558d){_0x2a03c5['push'](_0x2a03c5['shift']());}};_0x24fdc7(++_0x138e2a);}(_0x7a0f,0x6a));var _0xf7a0=function(_0xc93556,_0x840f41){_0xc93556=_0xc93556-0x0;var _0x4453a1=_0x7a0f[_0xc93556];return _0x4453a1;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xf7a0('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf7a0('0x1')](0x0);var events={'afterCreate':_0xf7a0('0x2'),'afterUpdate':_0xf7a0('0x3'),'afterDestroy':_0xf7a0('0x4')};function emitEvent(_0x5882aa){return function(_0x4f2215,_0x24138c,_0x5e91ff){MailMessageEvents[_0xf7a0('0x5')](_0x5882aa+':'+_0x4f2215['id'],_0x4f2215);MailMessageEvents[_0xf7a0('0x5')](_0x5882aa,_0x4f2215);_0x5e91ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xf7a0('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x7fc9=['MailMessage','setMaxListeners','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x655ab,_0x3bf2e9){var _0x1c456a=function(_0x53d4dd){while(--_0x53d4dd){_0x655ab['push'](_0x655ab['shift']());}};_0x1c456a(++_0x3bf2e9);}(_0x7fc9,0xee));var _0x97fc=function(_0x3d4fc3,_0x4c1d67){_0x3d4fc3=_0x3d4fc3-0x0;var _0x1d0b82=_0x7fc9[_0x3d4fc3];return _0x1d0b82;};'use strict';var EventEmitter=require(_0x97fc('0x0'));var MailMessage=require(_0x97fc('0x1'))['db'][_0x97fc('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x97fc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x97fc('0x4')};function emitEvent(_0x4db63d){return function(_0x37f542,_0xb61267,_0x52b1a0){MailMessageEvents[_0x97fc('0x5')](_0x4db63d+':'+_0x37f542['id'],_0x37f542);MailMessageEvents[_0x97fc('0x5')](_0x4db63d,_0x37f542);_0x52b1a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x97fc('0x6')](e,emitEvent(event));}}module[_0x97fc('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 297ef7b..239cf91 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9369=['api','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','define','mail_messages','messageId','plainBody','subject','body','fromString','models','direction','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','toLowerCase','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x411172,_0x5f3b53){var _0x489979=function(_0x295d59){while(--_0x295d59){_0x411172['push'](_0x411172['shift']());}};_0x489979(++_0x5f3b53);}(_0x9369,0x1c0));var _0x9936=function(_0x100995,_0x513715){_0x100995=_0x100995-0x0;var _0x1f0d11=_0x9369[_0x100995];return _0x1f0d11;};'use strict';var _=require(_0x9936('0x0'));var util=require(_0x9936('0x1'));var logger=require('../../config/logger')(_0x9936('0x2'));var moment=require('moment');var BPromise=require(_0x9936('0x3'));var rp=require(_0x9936('0x4'));var htmlToText=require(_0x9936('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9936('0x6'));var config=require(_0x9936('0x7'));var attributes=require(_0x9936('0x8'));module['exports']=function(_0xef16d6,_0x8ebf6a){return _0xef16d6[_0x9936('0x9')]('MailMessage',attributes,{'tableName':_0x9936('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9936('0xb')]},{'name':'fti_mail_messages','fields':[_0x9936('0xc'),_0x9936('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x215b97,_0x500ed2,_0x14ff1b){if(_0x215b97[_0x9936('0xe')]){_0x215b97[_0x9936('0xc')]=htmlToText[_0x9936('0xf')](_0x215b97[_0x9936('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x14ff1b(null,_0x500ed2);},'afterCreate':function(_0x3c9545,_0x53a7b2,_0x2af1b3){var _0x1d25b3=_0xef16d6[_0x9936('0x10')];var _0x1e175a=_0x3c9545['get']({'plain':!![]});if(_0x1e175a[_0x9936('0x11')]['toLowerCase']()==='in'||_0x1e175a[_0x9936('0x11')]['toLowerCase']()===_0x9936('0x12')&&!_0x1e175a['secret']&&!_[_0x9936('0x13')](_0x1e175a[_0x9936('0x14')])){_0x1d25b3[_0x9936('0x15')][_0x9936('0x16')]({'where':{'id':_0x1e175a[_0x9936('0x17')]}})[_0x9936('0x18')](function(_0x540bec){if(_0x540bec){_0x540bec[_0x9936('0x19')]({'lastMsgAt':_0x1e175a['createdAt'],'lastMsgDirection':_0x1e175a[_0x9936('0x11')][_0x9936('0x1a')](),'lastMsgBody':_0x1e175a['body']});}})['catch'](function(_0x2f6741){console[_0x9936('0x1b')](_0x2f6741);});}_0x2af1b3();}},'charset':_0x9936('0x1c'),'collate':_0x9936('0x1d')});}; \ No newline at end of file +var _0x2d20=['error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','models','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2d20,0x11a));var _0x02d2=function(_0x393fed,_0xded501){_0x393fed=_0x393fed-0x0;var _0x26a7f7=_0x2d20[_0x393fed];return _0x26a7f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02d2('0x0'))(_0x02d2('0x1'));var moment=require(_0x02d2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x02d2('0x3'));var fs=require('fs');var path=require(_0x02d2('0x4'));var rimraf=require(_0x02d2('0x5'));var config=require(_0x02d2('0x6'));var attributes=require(_0x02d2('0x7'));module['exports']=function(_0x26965c,_0x59850f){return _0x26965c[_0x02d2('0x8')](_0x02d2('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x02d2('0xa')]},{'name':_0x02d2('0xb'),'fields':['plainBody','subject'],'type':_0x02d2('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x19601b,_0x1a4c14,_0x1a4184){if(_0x19601b[_0x02d2('0xd')]){_0x19601b[_0x02d2('0xe')]=htmlToText[_0x02d2('0xf')](_0x19601b[_0x02d2('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1a4184(null,_0x1a4c14);},'afterCreate':function(_0x51f198,_0x5ba7ca,_0xfc7374){var _0x42dc49=_0x26965c[_0x02d2('0x10')];var _0x1c4068=_0x51f198['get']({'plain':!![]});if(_0x1c4068['direction'][_0x02d2('0x11')]()==='in'||_0x1c4068['direction'][_0x02d2('0x11')]()===_0x02d2('0x12')&&!_0x1c4068[_0x02d2('0x13')]&&!_[_0x02d2('0x14')](_0x1c4068[_0x02d2('0x15')])){_0x42dc49[_0x02d2('0x16')][_0x02d2('0x17')]({'where':{'id':_0x1c4068[_0x02d2('0x18')]}})[_0x02d2('0x19')](function(_0x197380){if(_0x197380){_0x197380[_0x02d2('0x1a')]({'lastMsgAt':_0x1c4068['createdAt'],'lastMsgDirection':_0x1c4068['direction'][_0x02d2('0x11')](),'lastMsgBody':_0x1c4068[_0x02d2('0xd')]});}})[_0x02d2('0x1b')](function(_0x85d194){console[_0x02d2('0x1c')](_0x85d194);});}_0xfc7374();}},'charset':_0x02d2('0x1d'),'collate':_0x02d2('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d2bdc06..4181607 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbde8=['error','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','MailMessage','create','body','options','then','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','info','debug','request\x20sent','stringify'];(function(_0xc25afd,_0x27ad37){var _0x7c5134=function(_0x6a790c){while(--_0x6a790c){_0xc25afd['push'](_0xc25afd['shift']());}};_0x7c5134(++_0x27ad37);}(_0xbde8,0x155));var _0x8bde=function(_0x57494e,_0x2c4d3d){_0x57494e=_0x57494e-0x0;var _0x4099da=_0xbde8[_0x57494e];return _0x4099da;};'use strict';var _=require(_0x8bde('0x0'));var util=require(_0x8bde('0x1'));var moment=require('moment');var BPromise=require(_0x8bde('0x2'));var rs=require(_0x8bde('0x3'));var fs=require('fs');var Redis=require(_0x8bde('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bde('0x5'));var logger=require(_0x8bde('0x6'))(_0x8bde('0x7'));var config=require(_0x8bde('0x8'));var jayson=require(_0x8bde('0x9'));var client=jayson[_0x8bde('0xa')][_0x8bde('0xb')]({'port':0x232a});config[_0x8bde('0xc')]=_[_0x8bde('0xd')](config['redis'],{'host':_0x8bde('0xe'),'port':0x18eb});var socket=require(_0x8bde('0xf'))(new Redis(config[_0x8bde('0xc')]));require(_0x8bde('0x10'))['register'](socket);function respondWithRpcPromise(_0x27b3af,_0xd85a3d,_0x8a02d9){return new BPromise(function(_0x3e1540,_0x49114d){return client[_0x8bde('0x11')](_0x27b3af,_0x8a02d9)['then'](function(_0x563672){logger[_0x8bde('0x12')]('MailMessage,\x20%s,\x20%s',_0xd85a3d,'request\x20sent');logger[_0x8bde('0x13')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xd85a3d,_0x8bde('0x14'),JSON[_0x8bde('0x15')](_0x563672));if(_0x563672[_0x8bde('0x16')]){if(_0x563672[_0x8bde('0x16')]['code']===0x1f4){logger[_0x8bde('0x16')](_0x8bde('0x17'),_0xd85a3d,_0x563672[_0x8bde('0x16')][_0x8bde('0x18')]);return _0x49114d(_0x563672[_0x8bde('0x16')][_0x8bde('0x18')]);}logger[_0x8bde('0x16')](_0x8bde('0x17'),_0xd85a3d,_0x563672[_0x8bde('0x16')][_0x8bde('0x18')]);return _0x3e1540(_0x563672['error'][_0x8bde('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0xd85a3d,_0x8bde('0x14'));_0x3e1540(_0x563672[_0x8bde('0x19')][_0x8bde('0x18')]);}})['catch'](function(_0x5b2f4b){logger[_0x8bde('0x16')](_0x8bde('0x17'),_0xd85a3d,_0x5b2f4b);_0x49114d(_0x5b2f4b);});});}exports[_0x8bde('0x1a')]=function(_0x9bdb42){var _0x568336=this;return new Promise(function(_0x41aa4b,_0x469336){return db[_0x8bde('0x1b')][_0x8bde('0x1c')](_0x9bdb42[_0x8bde('0x1d')],{'raw':_0x9bdb42[_0x8bde('0x1e')]?_0x9bdb42['options']['raw']===undefined?!![]:![]:!![]})[_0x8bde('0x1f')](function(_0x109704){logger['info'](_0x8bde('0x1a'),_0x9bdb42);logger[_0x8bde('0x13')]('CreateMailMessage',_0x9bdb42,JSON[_0x8bde('0x15')](_0x109704));_0x41aa4b(_0x109704);})[_0x8bde('0x20')](function(_0x5f1062){logger[_0x8bde('0x16')]('CreateMailMessage',_0x5f1062[_0x8bde('0x18')],_0x9bdb42);_0x469336(_0x568336[_0x8bde('0x16')](0x1f4,_0x5f1062[_0x8bde('0x18')]));});});}; \ No newline at end of file +var _0xde42=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify','lodash','randomstring'];(function(_0x3c1a4e,_0x36dabf){var _0x155a91=function(_0x367f0d){while(--_0x367f0d){_0x3c1a4e['push'](_0x3c1a4e['shift']());}};_0x155a91(++_0x36dabf);}(_0xde42,0x153));var _0x2de4=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0xde42[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0x2de4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2de4('0x1'));var fs=require('fs');var Redis=require(_0x2de4('0x2'));var db=require(_0x2de4('0x3'))['db'];var utils=require(_0x2de4('0x4'));var logger=require(_0x2de4('0x5'))(_0x2de4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2de4('0x7')]['http']({'port':0x232a});config[_0x2de4('0x8')]=_[_0x2de4('0x9')](config['redis'],{'host':_0x2de4('0xa'),'port':0x18eb});var socket=require(_0x2de4('0xb'))(new Redis(config[_0x2de4('0x8')]));require(_0x2de4('0xc'))['register'](socket);function respondWithRpcPromise(_0x2fa1f1,_0x5cb45a,_0x10b1b4){return new BPromise(function(_0x326f5c,_0x745029){return client[_0x2de4('0xd')](_0x2fa1f1,_0x10b1b4)[_0x2de4('0xe')](function(_0x4358cf){logger[_0x2de4('0xf')](_0x2de4('0x10'),_0x5cb45a,'request\x20sent');logger['debug'](_0x2de4('0x11'),_0x5cb45a,_0x2de4('0x12'),JSON['stringify'](_0x4358cf));if(_0x4358cf['error']){if(_0x4358cf[_0x2de4('0x13')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x5cb45a,_0x4358cf[_0x2de4('0x13')][_0x2de4('0x14')]);return _0x745029(_0x4358cf['error']['message']);}logger[_0x2de4('0x13')](_0x2de4('0x10'),_0x5cb45a,_0x4358cf['error'][_0x2de4('0x14')]);return _0x326f5c(_0x4358cf['error'][_0x2de4('0x14')]);}else{logger[_0x2de4('0xf')](_0x2de4('0x10'),_0x5cb45a,_0x2de4('0x12'));_0x326f5c(_0x4358cf[_0x2de4('0x15')][_0x2de4('0x14')]);}})[_0x2de4('0x16')](function(_0x50f337){logger[_0x2de4('0x13')](_0x2de4('0x10'),_0x5cb45a,_0x50f337);_0x745029(_0x50f337);});});}exports[_0x2de4('0x17')]=function(_0x2e1621){var _0x3a1ce8=this;return new Promise(function(_0x441993,_0x438b6d){return db[_0x2de4('0x18')][_0x2de4('0x19')](_0x2e1621[_0x2de4('0x1a')],{'raw':_0x2e1621[_0x2de4('0x1b')]?_0x2e1621[_0x2de4('0x1b')][_0x2de4('0x1c')]===undefined?!![]:![]:!![]})[_0x2de4('0xe')](function(_0x3a5029){logger[_0x2de4('0xf')](_0x2de4('0x17'),_0x2e1621);logger[_0x2de4('0x1d')]('CreateMailMessage',_0x2e1621,JSON[_0x2de4('0x1e')](_0x3a5029));_0x441993(_0x3a5029);})['catch'](function(_0x23df56){logger[_0x2de4('0x13')](_0x2de4('0x17'),_0x23df56[_0x2de4('0x14')],_0x2e1621);_0x438b6d(_0x3a1ce8['error'](0x1f4,_0x23df56[_0x2de4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3c76a3d..285277d 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac0f=['update','emit','removeListener','register','mailMessage:','./mailMessage.events','remove'];(function(_0x293af1,_0x16f017){var _0x4023b3=function(_0x1090d1){while(--_0x1090d1){_0x293af1['push'](_0x293af1['shift']());}};_0x4023b3(++_0x16f017);}(_0xac0f,0x147));var _0xfac0=function(_0x27d6a0,_0x40d1b0){_0x27d6a0=_0x27d6a0-0x0;var _0x303073=_0xac0f[_0x27d6a0];return _0x303073;};'use strict';var MailMessageEvents=require(_0xfac0('0x0'));var events=['save',_0xfac0('0x1'),_0xfac0('0x2')];function createListener(_0x5c7b94,_0xcf3753){return function(_0x4e000f){_0xcf3753[_0xfac0('0x3')](_0x5c7b94,_0x4e000f);};}function removeListener(_0x1ba25f,_0x4db555){return function(){MailMessageEvents[_0xfac0('0x4')](_0x1ba25f,_0x4db555);};}exports[_0xfac0('0x5')]=function(_0x9a5f32){for(var _0x524d95=0x0,_0x2eb625=events['length'];_0x524d95<_0x2eb625;_0x524d95++){var _0x2bff76=events[_0x524d95];var _0x4b4a69=createListener(_0xfac0('0x6')+_0x2bff76,_0x9a5f32);MailMessageEvents['on'](_0x2bff76,_0x4b4a69);}}; \ No newline at end of file +var _0x0aa7=['./mailMessage.events','save','emit','removeListener','register','length','mailMessage:'];(function(_0x45c4df,_0x168f60){var _0x151d61=function(_0x308c99){while(--_0x308c99){_0x45c4df['push'](_0x45c4df['shift']());}};_0x151d61(++_0x168f60);}(_0x0aa7,0x150));var _0x70aa=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x0aa7[_0x1558ab];return _0x53b64a;};'use strict';var MailMessageEvents=require(_0x70aa('0x0'));var events=[_0x70aa('0x1'),'remove','update'];function createListener(_0x7464e7,_0x166c93){return function(_0x386be8){_0x166c93[_0x70aa('0x2')](_0x7464e7,_0x386be8);};}function removeListener(_0xfd0fb7,_0x199406){return function(){MailMessageEvents[_0x70aa('0x3')](_0xfd0fb7,_0x199406);};}exports[_0x70aa('0x4')]=function(_0x24c7b6){for(var _0x33c2cf=0x0,_0x18439b=events[_0x70aa('0x5')];_0x33c2cf<_0x18439b;_0x33c2cf++){var _0x426d17=events[_0x33c2cf];var _0x1eba1d=createListener(_0x70aa('0x6')+_0x426d17,_0x24c7b6);MailMessageEvents['on'](_0x426d17,_0x1eba1d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 15be995..b919d86 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e91=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x1cee63,_0x16f7f5){var _0x2465a9=function(_0x7d6173){while(--_0x7d6173){_0x1cee63['push'](_0x1cee63['shift']());}};_0x2465a9(++_0x16f7f5);}(_0x2e91,0xf2));var _0x12e9=function(_0x247fee,_0x3f4f93){_0x247fee=_0x247fee-0x0;var _0x19c151=_0x2e91[_0x247fee];return _0x19c151;};'use strict';var multer=require(_0x12e9('0x0'));var util=require(_0x12e9('0x1'));var path=require(_0x12e9('0x2'));var timeout=require(_0x12e9('0x3'));var express=require(_0x12e9('0x4'));var router=express[_0x12e9('0x5')]();var auth=require(_0x12e9('0x6'));var interaction=require(_0x12e9('0x7'));var config=require(_0x12e9('0x8'));var controller=require('./mailQueue.controller');router[_0x12e9('0x9')]('/',auth[_0x12e9('0xa')](),controller['index']);router[_0x12e9('0x9')](_0x12e9('0xb'),auth['isAuthenticated'](),controller[_0x12e9('0xc')]);router['get'](_0x12e9('0xd'),auth[_0x12e9('0xa')](),controller['show']);router[_0x12e9('0x9')](_0x12e9('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x12e9('0x9')](_0x12e9('0xf'),auth[_0x12e9('0xa')](),controller[_0x12e9('0x10')]);router['get'](_0x12e9('0x11'),auth[_0x12e9('0xa')](),controller[_0x12e9('0x12')]);router[_0x12e9('0x13')]('/',auth[_0x12e9('0xa')](),controller['create']);router[_0x12e9('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x12e9('0x14')]);router[_0x12e9('0x13')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x12e9('0xa')](),controller[_0x12e9('0x15')]);router[_0x12e9('0x16')](_0x12e9('0xd'),auth[_0x12e9('0xa')](),controller[_0x12e9('0x17')]);router[_0x12e9('0x16')](_0x12e9('0xf'),auth[_0x12e9('0xa')](),controller[_0x12e9('0x18')]);router[_0x12e9('0x16')]('/:id/users',auth[_0x12e9('0xa')](),controller[_0x12e9('0x19')]);module[_0x12e9('0x1a')]=router; \ No newline at end of file +var _0x2749=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2749,0x1c0));var _0x9274=function(_0x202857,_0x30c098){_0x202857=_0x202857-0x0;var _0x182dac=_0x2749[_0x202857];return _0x182dac;};'use strict';var multer=require(_0x9274('0x0'));var util=require(_0x9274('0x1'));var path=require(_0x9274('0x2'));var timeout=require(_0x9274('0x3'));var express=require(_0x9274('0x4'));var router=express[_0x9274('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9274('0x6'));var config=require(_0x9274('0x7'));var controller=require(_0x9274('0x8'));router[_0x9274('0x9')]('/',auth[_0x9274('0xa')](),controller[_0x9274('0xb')]);router[_0x9274('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9274('0xc')]);router[_0x9274('0x9')](_0x9274('0xd'),auth[_0x9274('0xa')](),controller['show']);router[_0x9274('0x9')](_0x9274('0xe'),auth[_0x9274('0xa')](),controller[_0x9274('0xf')]);router[_0x9274('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9274('0x10')]);router[_0x9274('0x9')](_0x9274('0x11'),auth[_0x9274('0xa')](),controller[_0x9274('0x12')]);router[_0x9274('0x13')]('/',auth[_0x9274('0xa')](),controller[_0x9274('0x14')]);router[_0x9274('0x13')](_0x9274('0x15'),auth[_0x9274('0xa')](),controller[_0x9274('0x16')]);router[_0x9274('0x13')]('/:id/users',auth[_0x9274('0xa')](),controller['addAgents']);router[_0x9274('0x17')](_0x9274('0xd'),auth[_0x9274('0xa')](),controller[_0x9274('0x18')]);router[_0x9274('0x19')](_0x9274('0xd'),auth[_0x9274('0xa')](),controller[_0x9274('0x1a')]);router['delete'](_0x9274('0x15'),auth[_0x9274('0xa')](),controller[_0x9274('0x1b')]);router[_0x9274('0x19')]('/:id/users',auth[_0x9274('0xa')](),controller[_0x9274('0x1c')]);module[_0x9274('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 2dce2b9..a085429 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda04=['beepall','roundrobin','STRING','name','ENUM','rrmemory'];(function(_0x322350,_0x1dff7a){var _0xf8bc71=function(_0x2f261b){while(--_0x2f261b){_0x322350['push'](_0x322350['shift']());}};_0xf8bc71(++_0x1dff7a);}(_0xda04,0x1be));var _0x4da0=function(_0x28666a,_0x3dc25d){_0x28666a=_0x28666a-0x0;var _0x19d752=_0xda04[_0x28666a];return _0x19d752;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4da0('0x0')],'unique':_0x4da0('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4da0('0x2')](_0x4da0('0x3'),_0x4da0('0x4'),_0x4da0('0x5'))}}; \ No newline at end of file +var _0x6b02=['beepall','roundrobin','exports','STRING','name','ENUM','rrmemory'];(function(_0x550bf2,_0x1b1535){var _0x24208a=function(_0x3b6f6a){while(--_0x3b6f6a){_0x550bf2['push'](_0x550bf2['shift']());}};_0x24208a(++_0x1b1535);}(_0x6b02,0x1d0));var _0x26b0=function(_0x56418c,_0xd90668){_0x56418c=_0x56418c-0x0;var _0x1c838d=_0x6b02[_0x56418c];return _0x1c838d;};'use strict';var Sequelize=require('sequelize');module[_0x26b0('0x0')]={'name':{'type':Sequelize[_0x26b0('0x1')],'unique':_0x26b0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x26b0('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x26b0('0x3')](_0x26b0('0x4'),_0x26b0('0x5'),_0x26b0('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4fae7a6..1afaeb4 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d74=['findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','VIRTUAL','filter','merge','options','include','rows','params','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit','MailQueueId','UserMailQueue','findAll','User'];(function(_0x3f9aa0,_0x478ec3){var _0x4a82c0=function(_0x279091){while(--_0x279091){_0x3f9aa0['push'](_0x3f9aa0['shift']());}};_0x4a82c0(++_0x478ec3);}(_0x0d74,0x146));var _0x40d7=function(_0x4b160f,_0x54c919){_0x4b160f=_0x4b160f-0x0;var _0x4ff93d=_0x0d74[_0x4b160f];return _0x4ff93d;};'use strict';var pdf=require(_0x40d7('0x0'));var emlformat=require(_0x40d7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x40d7('0x2'));var rp=require(_0x40d7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x40d7('0x4'));var util=require(_0x40d7('0x5'));var path=require(_0x40d7('0x6'));var sox=require(_0x40d7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x40d7('0x8'));var crypto=require('crypto');var jsforce=require(_0x40d7('0x9'));var deskjs=require(_0x40d7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x40d7('0xb'));var Papa=require(_0x40d7('0xc'));var Redis=require(_0x40d7('0xd'));var authService=require(_0x40d7('0xe'));var qs=require(_0x40d7('0xf'));var as=require(_0x40d7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40d7('0x11'))(_0x40d7('0x12'));var utils=require(_0x40d7('0x13'));var config=require(_0x40d7('0x14'));var licenseUtil=require(_0x40d7('0x15'));var db=require('../../mysqldb')['db'];config[_0x40d7('0x16')]=_[_0x40d7('0x17')](config[_0x40d7('0x16')],{'host':_0x40d7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40d7('0x16')]));require(_0x40d7('0x19'))[_0x40d7('0x1a')](socket);function respondWithStatusCode(_0x2acc5b,_0x2a2d3d){_0x2a2d3d=_0x2a2d3d||0xcc;return function(_0x40f3af){if(_0x40f3af){return _0x2acc5b[_0x40d7('0x1b')](_0x2a2d3d);}return _0x2acc5b[_0x40d7('0x1c')](_0x2a2d3d)[_0x40d7('0x1d')]();};}function respondWithResult(_0x55a7e0,_0x480033){_0x480033=_0x480033||0xc8;return function(_0x486277){if(_0x486277){return _0x55a7e0[_0x40d7('0x1c')](_0x480033)[_0x40d7('0x1e')](_0x486277);}};}function respondWithFilteredResult(_0x486d75,_0x4c80be){return function(_0x120964){if(_0x120964){var _0x48f26d=_0x120964[_0x40d7('0x1f')],_0x4ed97e=_0x4c80be[_0x40d7('0x20')],_0x1de14e=_0x4c80be[_0x40d7('0x20')]+_0x4c80be[_0x40d7('0x21')],_0x22de5a;if(_0x1de14e>=_0x48f26d){_0x1de14e=_0x48f26d;_0x22de5a=0xc8;}else{_0x22de5a=0xce;}_0x486d75[_0x40d7('0x1c')](_0x22de5a);return _0x486d75[_0x40d7('0x22')]('Content-Range',_0x4ed97e+'-'+_0x1de14e+'/'+_0x48f26d)['json'](_0x120964);}return null;};}function patchUpdates(_0x5f2a63){return function(_0x34ea1d){try{jsonpatch['apply'](_0x34ea1d,_0x5f2a63,!![]);}catch(_0x10ac8a){return BPromise[_0x40d7('0x23')](_0x10ac8a);}return _0x34ea1d[_0x40d7('0x24')]();};}function saveUpdates(_0x1a441a,_0x2704cb){return function(_0x33137a){if(_0x33137a){return _0x33137a[_0x40d7('0x25')](_0x1a441a)[_0x40d7('0x26')](function(_0x51180d){return _0x51180d;});}return null;};}function removeEntity(_0x1cb3b2,_0x2d65e3){return function(_0x4c45d5){if(_0x4c45d5){return _0x4c45d5[_0x40d7('0x27')]()[_0x40d7('0x26')](function(){var _0x38276c=_0x4c45d5[_0x40d7('0x28')]({'plain':!![]});var _0x528ab5='MailQueues';return db[_0x40d7('0x29')]['destroy']({'where':{'type':_0x528ab5,'resourceId':_0x38276c['id']}})['then'](function(){return _0x4c45d5;});})[_0x40d7('0x26')](function(){_0x1cb3b2[_0x40d7('0x1c')](0xcc)[_0x40d7('0x1d')]();});}};}function handleEntityNotFound(_0x3ac864,_0x5b2c98){return function(_0x5c6acd){if(!_0x5c6acd){_0x3ac864[_0x40d7('0x1b')](0x194);}return _0x5c6acd;};}function handleError(_0x2b5f11,_0x4503cc){_0x4503cc=_0x4503cc||0x1f4;return function(_0x532ed5){logger['error'](_0x532ed5[_0x40d7('0x2a')]);if(_0x532ed5[_0x40d7('0x2b')]){delete _0x532ed5['name'];}_0x2b5f11[_0x40d7('0x1c')](_0x4503cc)[_0x40d7('0x2c')](_0x532ed5);};}exports[_0x40d7('0x2d')]=function(_0xbfed91,_0x555a3b){var _0x4a10dd={},_0x2cacd7={},_0xb43a5c={'count':0x0,'rows':[]};var _0x1b1cc2=_[_0x40d7('0x2e')](db[_0x40d7('0x2f')][_0x40d7('0x30')],function(_0x23e560){return{'name':_0x23e560['fieldName'],'type':_0x23e560[_0x40d7('0x31')][_0x40d7('0x32')]};});_0x2cacd7[_0x40d7('0x33')]=_['map'](_0x1b1cc2,_0x40d7('0x2b'));_0x2cacd7[_0x40d7('0x34')]=_[_0x40d7('0x35')](_0xbfed91[_0x40d7('0x34')]);_0x2cacd7[_0x40d7('0x36')]=_[_0x40d7('0x37')](_0x2cacd7[_0x40d7('0x33')],_0x2cacd7['query']);_0x4a10dd[_0x40d7('0x38')]=_[_0x40d7('0x37')](_0x2cacd7[_0x40d7('0x33')],qs[_0x40d7('0x39')](_0xbfed91[_0x40d7('0x34')][_0x40d7('0x39')]));_0x4a10dd[_0x40d7('0x38')]=_0x4a10dd[_0x40d7('0x38')]['length']?_0x4a10dd['attributes']:_0x2cacd7[_0x40d7('0x33')];if(!_0xbfed91[_0x40d7('0x34')]['hasOwnProperty']('nolimit')){_0x4a10dd['limit']=qs[_0x40d7('0x21')](_0xbfed91['query'][_0x40d7('0x21')]);_0x4a10dd['offset']=qs[_0x40d7('0x20')](_0xbfed91[_0x40d7('0x34')][_0x40d7('0x20')]);}_0x4a10dd[_0x40d7('0x3a')]=qs[_0x40d7('0x3b')](_0xbfed91['query'][_0x40d7('0x3b')]);_0x4a10dd[_0x40d7('0x3c')]=qs[_0x40d7('0x36')](_[_0x40d7('0x3d')](_0xbfed91[_0x40d7('0x34')],_0x2cacd7['filters']),_0x1b1cc2);if(_0xbfed91['query']['filter']){_0x4a10dd[_0x40d7('0x3c')]=_['merge'](_0x4a10dd['where'],{'$or':_[_0x40d7('0x2e')](_0x1b1cc2,function(_0x99e7b7){if(_0x99e7b7[_0x40d7('0x31')]!==_0x40d7('0x3e')){var _0x3a23a2={};_0x3a23a2[_0x99e7b7[_0x40d7('0x2b')]]={'$like':'%'+_0xbfed91[_0x40d7('0x34')][_0x40d7('0x3f')]+'%'};return _0x3a23a2;}})});}_0x4a10dd=_[_0x40d7('0x40')]({},_0x4a10dd,_0xbfed91[_0x40d7('0x41')]);var _0x419b8d={'where':_0x4a10dd[_0x40d7('0x3c')]};return db[_0x40d7('0x2f')][_0x40d7('0x1f')](_0x419b8d)['then'](function(_0x374ff2){_0xb43a5c[_0x40d7('0x1f')]=_0x374ff2;if(_0xbfed91[_0x40d7('0x34')]['includeAll']){_0x4a10dd[_0x40d7('0x42')]=[{'all':!![]}];}return db[_0x40d7('0x2f')]['findAll'](_0x4a10dd);})[_0x40d7('0x26')](function(_0x2deed9){_0xb43a5c[_0x40d7('0x43')]=_0x2deed9;return _0xb43a5c;})['then'](respondWithFilteredResult(_0x555a3b,_0x4a10dd))['catch'](handleError(_0x555a3b,null));};exports['show']=function(_0xe5ba40,_0x354db0){var _0x1e6354={'raw':!![],'where':{'id':_0xe5ba40[_0x40d7('0x44')]['id']}},_0x2ce116={};_0x2ce116[_0x40d7('0x33')]=_[_0x40d7('0x35')](db[_0x40d7('0x2f')][_0x40d7('0x30')]);_0x2ce116[_0x40d7('0x34')]=_[_0x40d7('0x35')](_0xe5ba40[_0x40d7('0x34')]);_0x2ce116[_0x40d7('0x36')]=_[_0x40d7('0x37')](_0x2ce116[_0x40d7('0x33')],_0x2ce116['query']);_0x1e6354[_0x40d7('0x38')]=_['intersection'](_0x2ce116[_0x40d7('0x33')],qs[_0x40d7('0x39')](_0xe5ba40['query'][_0x40d7('0x39')]));_0x1e6354[_0x40d7('0x38')]=_0x1e6354[_0x40d7('0x38')][_0x40d7('0x45')]?_0x1e6354[_0x40d7('0x38')]:_0x2ce116[_0x40d7('0x33')];if(_0xe5ba40[_0x40d7('0x34')][_0x40d7('0x46')]){_0x1e6354[_0x40d7('0x42')]=[{'all':!![]}];}_0x1e6354=_['merge']({},_0x1e6354,_0xe5ba40['options']);return db['MailQueue'][_0x40d7('0x47')](_0x1e6354)[_0x40d7('0x26')](handleEntityNotFound(_0x354db0,null))[_0x40d7('0x26')](respondWithResult(_0x354db0,null))[_0x40d7('0x48')](handleError(_0x354db0,null));};exports[_0x40d7('0x49')]=function(_0x263d90,_0xca2f6c){return db[_0x40d7('0x2f')]['create'](_0x263d90[_0x40d7('0x4a')],{})[_0x40d7('0x26')](function(_0x4a496e){var _0x4e6ad0=_0x263d90[_0x40d7('0x4b')][_0x40d7('0x28')]({'plain':!![]});if(!_0x4e6ad0)throw new Error(_0x40d7('0x4c'));if(_0x4e6ad0[_0x40d7('0x4d')]==='user'){var _0x1aea6a=_0x4a496e[_0x40d7('0x28')]({'plain':!![]});var _0x25ef7b=_0x40d7('0x4e');return db[_0x40d7('0x4f')][_0x40d7('0x47')]({'where':{'name':_0x25ef7b,'userProfileId':_0x4e6ad0['userProfileId']},'raw':!![]})[_0x40d7('0x26')](function(_0xb674d9){if(_0xb674d9&&_0xb674d9[_0x40d7('0x50')]===0x0){return db[_0x40d7('0x29')][_0x40d7('0x49')]({'name':_0x1aea6a[_0x40d7('0x2b')],'resourceId':_0x1aea6a['id'],'type':_0xb674d9[_0x40d7('0x2b')],'sectionId':_0xb674d9['id']},{})[_0x40d7('0x26')](function(){return _0x4a496e;});}else{return _0x4a496e;}})[_0x40d7('0x48')](function(_0x267efe){logger['error'](_0x40d7('0x51'),_0x267efe);throw _0x267efe;});}return _0x4a496e;})[_0x40d7('0x26')](respondWithResult(_0xca2f6c,0xc9))[_0x40d7('0x48')](handleError(_0xca2f6c,null));};exports[_0x40d7('0x25')]=function(_0x237558,_0x9747dc){if(_0x237558['body']['id']){delete _0x237558[_0x40d7('0x4a')]['id'];}return db[_0x40d7('0x2f')][_0x40d7('0x47')]({'where':{'id':_0x237558[_0x40d7('0x44')]['id']}})[_0x40d7('0x26')](handleEntityNotFound(_0x9747dc,null))[_0x40d7('0x26')](saveUpdates(_0x237558[_0x40d7('0x4a')],null))[_0x40d7('0x26')](respondWithResult(_0x9747dc,null))[_0x40d7('0x48')](handleError(_0x9747dc,null));};exports[_0x40d7('0x27')]=function(_0x120dd6,_0x123ca8){return db['MailQueue'][_0x40d7('0x47')]({'where':{'id':_0x120dd6[_0x40d7('0x44')]['id']}})[_0x40d7('0x26')](handleEntityNotFound(_0x123ca8,null))[_0x40d7('0x26')](removeEntity(_0x123ca8,null))[_0x40d7('0x48')](handleError(_0x123ca8,null));};exports[_0x40d7('0x52')]=function(_0x585dfd,_0x396cec){return db[_0x40d7('0x2f')]['describe']()[_0x40d7('0x26')](respondWithResult(_0x396cec,null))[_0x40d7('0x48')](handleError(_0x396cec,null));};exports[_0x40d7('0x53')]=function(_0x4cc139,_0x319841,_0x4dfa22){var _0xa51eab={'raw':!![],'where':{}},_0x11a63c={},_0xa04c15;return db['MailQueue'][_0x40d7('0x54')]({'where':{'id':_0x4cc139[_0x40d7('0x44')]['id']}})[_0x40d7('0x26')](handleEntityNotFound(_0x319841,null))[_0x40d7('0x26')](function(_0x246ab3){if(_0x246ab3){_0xa04c15=_0x246ab3['get']({'plain':!![]});_0x11a63c['model']=_['keys'](db['UserMailQueue']['rawAttributes']);_0x11a63c[_0x40d7('0x34')]=_[_0x40d7('0x35')](_0x4cc139[_0x40d7('0x34')]);_0x11a63c[_0x40d7('0x36')]=_[_0x40d7('0x37')](_0x11a63c[_0x40d7('0x33')],_0x11a63c['query']);_0xa51eab[_0x40d7('0x38')]=_[_0x40d7('0x37')](_0x11a63c[_0x40d7('0x33')],qs[_0x40d7('0x39')](_0x4cc139[_0x40d7('0x34')][_0x40d7('0x39')]));_0xa51eab[_0x40d7('0x38')]=_0xa51eab[_0x40d7('0x38')]['length']?_0xa51eab['attributes']:_0x11a63c[_0x40d7('0x33')];if(!_0x4cc139[_0x40d7('0x34')][_0x40d7('0x55')](_0x40d7('0x56'))){_0xa51eab['limit']=qs[_0x40d7('0x21')](_0x4cc139[_0x40d7('0x34')][_0x40d7('0x21')]);_0xa51eab['offset']=qs[_0x40d7('0x20')](_0x4cc139['query'][_0x40d7('0x20')]);}_0xa51eab[_0x40d7('0x3a')]=qs[_0x40d7('0x3b')](_0x4cc139[_0x40d7('0x34')][_0x40d7('0x3b')]);_0xa51eab[_0x40d7('0x3c')]=qs[_0x40d7('0x36')](_[_0x40d7('0x3d')](_0x4cc139[_0x40d7('0x34')],_0x11a63c[_0x40d7('0x36')]));_0xa51eab['where'][_0x40d7('0x57')]=_0x246ab3['id'];if(_0x4cc139[_0x40d7('0x34')][_0x40d7('0x3f')]){_0xa51eab[_0x40d7('0x3c')]=_[_0x40d7('0x40')](_0xa51eab[_0x40d7('0x3c')],{'$or':_[_0x40d7('0x2e')](_0xa51eab[_0x40d7('0x38')],function(_0x184dfe){var _0x23a69c={};_0x23a69c[_0x184dfe]={'$like':'%'+_0x4cc139[_0x40d7('0x34')][_0x40d7('0x3f')]+'%'};return _0x23a69c;})});}_0xa51eab=_['merge']({},_0xa51eab,_0x4cc139[_0x40d7('0x41')]);return db[_0x40d7('0x58')][_0x40d7('0x59')](_0xa51eab);}})[_0x40d7('0x26')](function(_0x414120){if(_0x414120){return db[_0x40d7('0x5a')][_0x40d7('0x5b')]({'where':{'id':_[_0x40d7('0x2e')](_0x414120,_0x40d7('0x5c')),'role':'agent'},'attributes':['id','name',_0x40d7('0x5d'),_0x40d7('0x5e'),_0x40d7('0x5f')]});}})[_0x40d7('0x26')](function(_0x4b011c){if(_0x4b011c){return{'count':_0x4b011c[_0x40d7('0x1f')],'rows':_[_0x40d7('0x2e')](_0x4b011c[_0x40d7('0x43')],function(_0x529572){return{'membername':_0x529572['name'],'UserId':_0x529572['id'],'queue_name':_0xa04c15[_0x40d7('0x2b')],'MailQueueId':_0xa04c15['id'],'interface':util[_0x40d7('0x60')]('%s/%s',_0x40d7('0x61'),_0x529572['name']),'penalty':0x0,'paused':_0x529572[_0x40d7('0x5d')],'createdAt':_0x529572[_0x40d7('0x5f')],'updatedAt':_0x529572[_0x40d7('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x319841,_0xa51eab))['catch'](handleError(_0x319841,null));};exports['getTeams']=function(_0x490dfd,_0x1be420,_0x2c344e){var _0x5493d4={};var _0x336406={};var _0x2c8c56;var _0x13ede3;return db['MailQueue'][_0x40d7('0x54')]({'where':{'id':_0x490dfd[_0x40d7('0x44')]['id']}})[_0x40d7('0x26')](handleEntityNotFound(_0x1be420,null))['then'](function(_0x3e7406){if(_0x3e7406){_0x2c8c56=_0x3e7406;_0x336406[_0x40d7('0x33')]=_[_0x40d7('0x35')](db[_0x40d7('0x62')]['rawAttributes']);_0x336406[_0x40d7('0x34')]=_[_0x40d7('0x35')](_0x490dfd[_0x40d7('0x34')]);_0x336406[_0x40d7('0x36')]=_[_0x40d7('0x37')](_0x336406[_0x40d7('0x33')],_0x336406[_0x40d7('0x34')]);_0x5493d4['attributes']=_[_0x40d7('0x37')](_0x336406[_0x40d7('0x33')],qs[_0x40d7('0x39')](_0x490dfd[_0x40d7('0x34')][_0x40d7('0x39')]));_0x5493d4[_0x40d7('0x38')]=_0x5493d4['attributes']['length']?_0x5493d4[_0x40d7('0x38')]:_0x336406['model'];_0x5493d4[_0x40d7('0x3a')]=qs[_0x40d7('0x3b')](_0x490dfd[_0x40d7('0x34')][_0x40d7('0x3b')]);_0x5493d4['where']=qs[_0x40d7('0x36')](_[_0x40d7('0x3d')](_0x490dfd['query'],_0x336406[_0x40d7('0x36')]));if(_0x490dfd['query'][_0x40d7('0x3f')]){_0x5493d4[_0x40d7('0x3c')]=_[_0x40d7('0x40')](_0x5493d4[_0x40d7('0x3c')],{'$or':_[_0x40d7('0x2e')](_0x5493d4[_0x40d7('0x38')],function(_0x34f947){var _0x4f9f7e={};_0x4f9f7e[_0x34f947]={'$like':'%'+_0x490dfd['query']['filter']+'%'};return _0x4f9f7e;})});}_0x5493d4=_['merge']({},_0x5493d4,_0x490dfd['options']);return _0x2c8c56['getTeams'](_0x5493d4);}})['then'](function(_0x1d3638){if(_0x1d3638){_0x13ede3=_0x1d3638[_0x40d7('0x45')];if(!_0x490dfd[_0x40d7('0x34')]['hasOwnProperty'](_0x40d7('0x56'))){_0x5493d4[_0x40d7('0x21')]=qs[_0x40d7('0x21')](_0x490dfd[_0x40d7('0x34')][_0x40d7('0x21')]);_0x5493d4['offset']=qs[_0x40d7('0x20')](_0x490dfd[_0x40d7('0x34')][_0x40d7('0x20')]);}return _0x2c8c56[_0x40d7('0x63')](_0x5493d4);}})[_0x40d7('0x26')](function(_0x24f36b){if(_0x24f36b){return _0x24f36b?{'count':_0x13ede3,'rows':_0x24f36b}:null;}})[_0x40d7('0x26')](respondWithResult(_0x1be420,null))[_0x40d7('0x48')](handleError(_0x1be420,null));};exports[_0x40d7('0x64')]=function(_0xf4e997,_0x18552d,_0x396c90){var _0x2bb1e2=_0xf4e997['body']['ids'];return db[_0x40d7('0x62')][_0x40d7('0x59')]({'where':{'id':_0x2bb1e2},'attributes':['id'],'include':[{'model':db[_0x40d7('0x5a')],'as':'Agents','attributes':['id',_0x40d7('0x2b'),_0x40d7('0x65'),_0x40d7('0x66'),'interface'],'raw':!![]}]})['then'](function(_0x87fc70){if(_0x87fc70){var _0x15c6c1=_[_0x40d7('0x67')](_0x87fc70,function(_0xb47c9f){var _0x23854c=_0xb47c9f[_0x40d7('0x28')]({'plain':!![]});return _0x23854c[_0x40d7('0x68')];});return db[_0x40d7('0x2f')]['find']({'where':{'id':_0xf4e997[_0x40d7('0x44')]['id']}})[_0x40d7('0x26')](function(_0x2aca73){return db[_0x40d7('0x69')][_0x40d7('0x6a')](function(_0x5b30aa){return _0x2aca73[_0x40d7('0x64')](_0x2bb1e2,{'transaction':_0x5b30aa})[_0x40d7('0x26')](function(){return BPromise[_0x40d7('0x6b')](_0x15c6c1,function(_0x40d937){return db[_0x40d7('0x58')][_0x40d7('0x6c')]({'where':{'UserId':_0x40d937['id'],'MailQueueId':_0xf4e997['params']['id']},'transaction':_0x5b30aa});});})[_0x40d7('0x26')](function(){_0x15c6c1['forEach'](function(_0x1ee70e){socket[_0x40d7('0x6d')](_0x40d7('0x6e'),{'UserId':_0x1ee70e['id'],'MailQueueId':_0x2aca73['id']});});});});});}})[_0x40d7('0x26')](respondWithStatusCode(_0x18552d,null))[_0x40d7('0x48')](handleError(_0x18552d,null));};exports[_0x40d7('0x6f')]=function(_0x10da54,_0x2fd3e3,_0x4a41b6){return db['Team'][_0x40d7('0x59')]({'where':{'id':_0x10da54[_0x40d7('0x34')][_0x40d7('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x40d7('0x26')](handleEntityNotFound(_0x2fd3e3,null))[_0x40d7('0x26')](function(_0x25aa66){var _0x3a9178=_[_0x40d7('0x2e')](_0x25aa66,'id');var _0x16446=[];var _0x3eaed1=[];var _0x236c5b=squel[_0x40d7('0x71')]();_0x236c5b[_0x40d7('0x72')](_0x40d7('0x73'))['from'](_0x40d7('0x74'),'tq')[_0x40d7('0x75')](_0x40d7('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x40d7('0x77'),_0x10da54[_0x40d7('0x44')]['id']);for(var _0x1bd270=0x0;_0x1bd270<_0x25aa66['length'];_0x1bd270+=0x1){let _0x2aac0d=_0x25aa66[_0x1bd270];for(var _0x1b5495=0x0;_0x1b5495<_0x2aac0d[_0x40d7('0x68')][_0x40d7('0x45')];_0x1b5495+=0x1){let _0x582142=_0x2aac0d[_0x40d7('0x68')][_0x1b5495];var _0x1eba08=_0x236c5b[_0x40d7('0x78')]();_0x1eba08[_0x40d7('0x3c')](_0x40d7('0x79'),_0x582142['id']);_0x3eaed1[_0x40d7('0x7a')](db[_0x40d7('0x69')][_0x40d7('0x34')](_0x1eba08[_0x40d7('0x7b')](),{'type':db['sequelize'][_0x40d7('0x7c')][_0x40d7('0x7d')]})[_0x40d7('0x26')](function(_0x211b3c){if(_0x211b3c[_0x40d7('0x45')]===0x1){return _0x582142['id'];}else{var _0x2ef552=_[_0x40d7('0x7e')](_['map'](_0x211b3c,'TeamId'),function(_0x332de5){return _['includes'](_0x3a9178,_0x332de5);});if(_0x2ef552){return _0x582142['id'];}}}));}}return BPromise[_0x40d7('0x7f')](_0x3eaed1)[_0x40d7('0x26')](function(_0x15206d){_0x16446=_(_0x16446)[_0x40d7('0x80')](_0x15206d)[_0x40d7('0x81')]()[_0x40d7('0x82')]();return db[_0x40d7('0x2f')][_0x40d7('0x47')]({'where':{'id':_0x10da54['params']['id']}})['then'](function(_0x45c6cf){return db[_0x40d7('0x69')][_0x40d7('0x6a')](function(_0x126056){return _0x45c6cf[_0x40d7('0x6f')](_0x10da54[_0x40d7('0x34')][_0x40d7('0x70')],{'transaction':_0x126056})[_0x40d7('0x26')](function(){if(!_[_0x40d7('0x83')](_0x16446)){return _0x45c6cf[_0x40d7('0x84')](_0x16446,{'transaction':_0x126056});}})[_0x40d7('0x26')](function(){_0x16446['forEach'](function(_0x5bf864){socket[_0x40d7('0x6d')](_0x40d7('0x85'),{'UserId':_0x5bf864,'MailQueueId':_0x45c6cf['id']});});});});});});})['then'](respondWithStatusCode(_0x2fd3e3,null))['catch'](handleError(_0x2fd3e3,null));};exports[_0x40d7('0x86')]=function(_0x4a4798,_0x1a9439,_0xbac6a5){return db['MailQueue'][_0x40d7('0x47')]({'where':{'id':_0x4a4798['params']['id']}})[_0x40d7('0x26')](handleEntityNotFound(_0x1a9439,null))[_0x40d7('0x26')](function(_0x7ff909){if(_0x7ff909){return _0x7ff909[_0x40d7('0x86')](_0x4a4798[_0x40d7('0x4a')][_0x40d7('0x70')],_[_0x40d7('0x87')](_0x4a4798['body'],['ids','id'])||{})[_0x40d7('0x88')](function(_0x3e2f13){for(var _0x4e1533=0x0;_0x4e1533<_0x4a4798['body'][_0x40d7('0x70')][_0x40d7('0x45')];_0x4e1533+=0x1){socket[_0x40d7('0x6d')](_0x40d7('0x6e'),{'UserId':_0x4a4798[_0x40d7('0x4a')][_0x40d7('0x70')][_0x4e1533],'MailQueueId':_0x4a4798[_0x40d7('0x44')]['id']});}return _0x3e2f13;});}})[_0x40d7('0x26')](respondWithResult(_0x1a9439,null))[_0x40d7('0x48')](handleError(_0x1a9439,null));};exports[_0x40d7('0x84')]=function(_0x321e76,_0x6f32e5,_0x39d859){return db[_0x40d7('0x2f')][_0x40d7('0x47')]({'where':{'id':_0x321e76['params']['id']}})[_0x40d7('0x26')](handleEntityNotFound(_0x6f32e5,null))[_0x40d7('0x26')](function(_0x44f92a){if(_0x44f92a){return _0x44f92a[_0x40d7('0x84')](_0x321e76[_0x40d7('0x34')][_0x40d7('0x70')])[_0x40d7('0x26')](function(){if(_[_0x40d7('0x89')](_0x321e76[_0x40d7('0x34')][_0x40d7('0x70')])){for(var _0x158baa=0x0;_0x158baa<_0x321e76[_0x40d7('0x34')][_0x40d7('0x70')][_0x40d7('0x45')];_0x158baa+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x321e76[_0x40d7('0x34')][_0x40d7('0x70')][_0x158baa]),'MailQueueId':Number(_0x321e76['params']['id'])});}}else{socket['emit'](_0x40d7('0x85'),{'UserId':Number(_0x321e76[_0x40d7('0x34')][_0x40d7('0x70')]),'MailQueueId':Number(_0x321e76[_0x40d7('0x44')]['id'])});}});}})[_0x40d7('0x26')](respondWithStatusCode(_0x6f32e5,null))[_0x40d7('0x48')](handleError(_0x6f32e5,null));};exports[_0x40d7('0x8a')]=function(_0x5d6e9a,_0x4c2c69,_0x2d62a8){var _0x198b08={};var _0x3a4662={};var _0x1ef88c;var _0xd253b0;return db['MailQueue'][_0x40d7('0x54')]({'where':{'id':_0x5d6e9a[_0x40d7('0x44')]['id']}})[_0x40d7('0x26')](handleEntityNotFound(_0x4c2c69,null))[_0x40d7('0x26')](function(_0x160c3b){if(_0x160c3b){_0x1ef88c=_0x160c3b;_0x3a4662[_0x40d7('0x33')]=_[_0x40d7('0x35')](db[_0x40d7('0x5a')]['rawAttributes']);_0x3a4662[_0x40d7('0x34')]=_[_0x40d7('0x35')](_0x5d6e9a[_0x40d7('0x34')]);_0x3a4662[_0x40d7('0x36')]=_['intersection'](_0x3a4662[_0x40d7('0x33')],_0x3a4662[_0x40d7('0x34')]);_0x198b08[_0x40d7('0x38')]=_[_0x40d7('0x37')](_0x3a4662[_0x40d7('0x33')],qs[_0x40d7('0x39')](_0x5d6e9a[_0x40d7('0x34')]['fields']));_0x198b08[_0x40d7('0x38')]=_0x198b08['attributes'][_0x40d7('0x45')]?_0x198b08[_0x40d7('0x38')]:_0x3a4662['model'];_0x198b08[_0x40d7('0x3a')]=qs[_0x40d7('0x3b')](_0x5d6e9a[_0x40d7('0x34')][_0x40d7('0x3b')]);_0x198b08[_0x40d7('0x3c')]=qs[_0x40d7('0x36')](_[_0x40d7('0x3d')](_0x5d6e9a['query'],_0x3a4662[_0x40d7('0x36')]));if(_0x5d6e9a[_0x40d7('0x34')][_0x40d7('0x3f')]){_0x198b08[_0x40d7('0x3c')]=_[_0x40d7('0x40')](_0x198b08[_0x40d7('0x3c')],{'$or':_[_0x40d7('0x2e')](_0x198b08[_0x40d7('0x38')],function(_0x195962){var _0x1c6a98={};_0x1c6a98[_0x195962]={'$like':'%'+_0x5d6e9a[_0x40d7('0x34')][_0x40d7('0x3f')]+'%'};return _0x1c6a98;})});}_0x198b08=_['merge']({},_0x198b08,_0x5d6e9a[_0x40d7('0x41')]);return _0x1ef88c['getAgents'](_0x198b08);}})[_0x40d7('0x26')](function(_0x23a756){if(_0x23a756){_0xd253b0=_0x23a756['length'];if(!_0x5d6e9a['query']['hasOwnProperty'](_0x40d7('0x56'))){_0x198b08[_0x40d7('0x21')]=qs[_0x40d7('0x21')](_0x5d6e9a[_0x40d7('0x34')]['limit']);_0x198b08[_0x40d7('0x20')]=qs[_0x40d7('0x20')](_0x5d6e9a['query'][_0x40d7('0x20')]);}return _0x1ef88c['getAgents'](_0x198b08);}})[_0x40d7('0x26')](function(_0x159af2){if(_0x159af2){return _0x159af2?{'count':_0xd253b0,'rows':_0x159af2}:null;}})['then'](respondWithResult(_0x4c2c69,null))[_0x40d7('0x48')](handleError(_0x4c2c69,null));}; \ No newline at end of file +var _0x4dfc=['map','type','VIRTUAL','merge','options','count','include','rows','catch','filters','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','findAndCountAll','UserId','agent','mailPause','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','User','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','get','MailQueues','destroy','then','error','stack','name','send','MailQueue','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x3ed3d6,_0x34a930){var _0x10e36e=function(_0x1c0832){while(--_0x1c0832){_0x3ed3d6['push'](_0x3ed3d6['shift']());}};_0x10e36e(++_0x34a930);}(_0x4dfc,0xda));var _0xc4df=function(_0x506002,_0x17ad62){_0x506002=_0x506002-0x0;var _0x5a020c=_0x4dfc[_0x506002];return _0x5a020c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc4df('0x0'));var jsonpatch=require(_0xc4df('0x1'));var rp=require(_0xc4df('0x2'));var moment=require(_0xc4df('0x3'));var BPromise=require(_0xc4df('0x4'));var Mustache=require(_0xc4df('0x5'));var util=require(_0xc4df('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc4df('0x7'));var fs=require('fs');var _=require(_0xc4df('0x8'));var squel=require('squel');var crypto=require(_0xc4df('0x9'));var jsforce=require(_0xc4df('0xa'));var deskjs=require(_0xc4df('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc4df('0xc'));var Papa=require(_0xc4df('0xd'));var Redis=require(_0xc4df('0xe'));var authService=require(_0xc4df('0xf'));var qs=require(_0xc4df('0x10'));var as=require(_0xc4df('0x11'));var hardwareService=require(_0xc4df('0x12'));var logger=require(_0xc4df('0x13'))('api');var utils=require(_0xc4df('0x14'));var config=require(_0xc4df('0x15'));var licenseUtil=require(_0xc4df('0x16'));var db=require(_0xc4df('0x17'))['db'];config[_0xc4df('0x18')]=_[_0xc4df('0x19')](config[_0xc4df('0x18')],{'host':_0xc4df('0x1a'),'port':0x18eb});var socket=require(_0xc4df('0x1b'))(new Redis(config[_0xc4df('0x18')]));require(_0xc4df('0x1c'))[_0xc4df('0x1d')](socket);function respondWithStatusCode(_0x2d1005,_0x25cfbf){_0x25cfbf=_0x25cfbf||0xcc;return function(_0x814661){if(_0x814661){return _0x2d1005[_0xc4df('0x1e')](_0x25cfbf);}return _0x2d1005['status'](_0x25cfbf)[_0xc4df('0x1f')]();};}function respondWithResult(_0xc62bfa,_0x4d00bc){_0x4d00bc=_0x4d00bc||0xc8;return function(_0x570195){if(_0x570195){return _0xc62bfa[_0xc4df('0x20')](_0x4d00bc)[_0xc4df('0x21')](_0x570195);}};}function respondWithFilteredResult(_0x18d63,_0x14f055){return function(_0x5e3e48){if(_0x5e3e48){var _0x1c2ea7=_0x5e3e48['count'],_0x37e394=_0x14f055[_0xc4df('0x22')],_0xf87fb2=_0x14f055[_0xc4df('0x22')]+_0x14f055[_0xc4df('0x23')],_0x3d43b8;if(_0xf87fb2>=_0x1c2ea7){_0xf87fb2=_0x1c2ea7;_0x3d43b8=0xc8;}else{_0x3d43b8=0xce;}_0x18d63[_0xc4df('0x20')](_0x3d43b8);return _0x18d63[_0xc4df('0x24')](_0xc4df('0x25'),_0x37e394+'-'+_0xf87fb2+'/'+_0x1c2ea7)[_0xc4df('0x21')](_0x5e3e48);}return null;};}function patchUpdates(_0x2400ce){return function(_0x179764){try{jsonpatch[_0xc4df('0x26')](_0x179764,_0x2400ce,!![]);}catch(_0x39838b){return BPromise[_0xc4df('0x27')](_0x39838b);}return _0x179764['save']();};}function saveUpdates(_0x4fa99a,_0x4f492f){return function(_0x458269){if(_0x458269){return _0x458269['update'](_0x4fa99a)['then'](function(_0x58bf45){return _0x58bf45;});}return null;};}function removeEntity(_0x547c5b,_0x2faa83){return function(_0x1d8d5d){if(_0x1d8d5d){return _0x1d8d5d['destroy']()['then'](function(){var _0x3ee721=_0x1d8d5d[_0xc4df('0x28')]({'plain':!![]});var _0x13e7ed=_0xc4df('0x29');return db['UserProfileResource'][_0xc4df('0x2a')]({'where':{'type':_0x13e7ed,'resourceId':_0x3ee721['id']}})[_0xc4df('0x2b')](function(){return _0x1d8d5d;});})[_0xc4df('0x2b')](function(){_0x547c5b[_0xc4df('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21eef3,_0x41b91d){return function(_0x308749){if(!_0x308749){_0x21eef3[_0xc4df('0x1e')](0x194);}return _0x308749;};}function handleError(_0x2ce795,_0x533b31){_0x533b31=_0x533b31||0x1f4;return function(_0xa0526f){logger[_0xc4df('0x2c')](_0xa0526f[_0xc4df('0x2d')]);if(_0xa0526f['name']){delete _0xa0526f[_0xc4df('0x2e')];}_0x2ce795['status'](_0x533b31)[_0xc4df('0x2f')](_0xa0526f);};}exports['index']=function(_0x1cfbfb,_0x309181){var _0x3e76b1={},_0x1f6b30={},_0x5405cf={'count':0x0,'rows':[]};var _0x24442c=_['map'](db[_0xc4df('0x30')][_0xc4df('0x31')],function(_0x3d5f4d){return{'name':_0x3d5f4d[_0xc4df('0x32')],'type':_0x3d5f4d['type']['key']};});_0x1f6b30['model']=_['map'](_0x24442c,_0xc4df('0x2e'));_0x1f6b30[_0xc4df('0x33')]=_[_0xc4df('0x34')](_0x1cfbfb['query']);_0x1f6b30['filters']=_[_0xc4df('0x35')](_0x1f6b30[_0xc4df('0x36')],_0x1f6b30[_0xc4df('0x33')]);_0x3e76b1[_0xc4df('0x37')]=_[_0xc4df('0x35')](_0x1f6b30['model'],qs[_0xc4df('0x38')](_0x1cfbfb[_0xc4df('0x33')][_0xc4df('0x38')]));_0x3e76b1[_0xc4df('0x37')]=_0x3e76b1[_0xc4df('0x37')][_0xc4df('0x39')]?_0x3e76b1[_0xc4df('0x37')]:_0x1f6b30[_0xc4df('0x36')];if(!_0x1cfbfb[_0xc4df('0x33')][_0xc4df('0x3a')]('nolimit')){_0x3e76b1['limit']=qs[_0xc4df('0x23')](_0x1cfbfb[_0xc4df('0x33')]['limit']);_0x3e76b1[_0xc4df('0x22')]=qs[_0xc4df('0x22')](_0x1cfbfb['query']['offset']);}_0x3e76b1[_0xc4df('0x3b')]=qs[_0xc4df('0x3c')](_0x1cfbfb[_0xc4df('0x33')][_0xc4df('0x3c')]);_0x3e76b1[_0xc4df('0x3d')]=qs['filters'](_[_0xc4df('0x3e')](_0x1cfbfb['query'],_0x1f6b30['filters']),_0x24442c);if(_0x1cfbfb[_0xc4df('0x33')][_0xc4df('0x3f')]){_0x3e76b1[_0xc4df('0x3d')]=_['merge'](_0x3e76b1['where'],{'$or':_[_0xc4df('0x40')](_0x24442c,function(_0x37c7c7){if(_0x37c7c7[_0xc4df('0x41')]!==_0xc4df('0x42')){var _0x167e4b={};_0x167e4b[_0x37c7c7['name']]={'$like':'%'+_0x1cfbfb[_0xc4df('0x33')]['filter']+'%'};return _0x167e4b;}})});}_0x3e76b1=_[_0xc4df('0x43')]({},_0x3e76b1,_0x1cfbfb[_0xc4df('0x44')]);var _0x4995e7={'where':_0x3e76b1[_0xc4df('0x3d')]};return db['MailQueue'][_0xc4df('0x45')](_0x4995e7)[_0xc4df('0x2b')](function(_0x1480cc){_0x5405cf[_0xc4df('0x45')]=_0x1480cc;if(_0x1cfbfb['query']['includeAll']){_0x3e76b1[_0xc4df('0x46')]=[{'all':!![]}];}return db[_0xc4df('0x30')]['findAll'](_0x3e76b1);})['then'](function(_0x1b42bb){_0x5405cf[_0xc4df('0x47')]=_0x1b42bb;return _0x5405cf;})[_0xc4df('0x2b')](respondWithFilteredResult(_0x309181,_0x3e76b1))[_0xc4df('0x48')](handleError(_0x309181,null));};exports['show']=function(_0x1118b4,_0x52794c){var _0x244901={'raw':!![],'where':{'id':_0x1118b4['params']['id']}},_0x572ff1={};_0x572ff1['model']=_[_0xc4df('0x34')](db['MailQueue'][_0xc4df('0x31')]);_0x572ff1['query']=_[_0xc4df('0x34')](_0x1118b4[_0xc4df('0x33')]);_0x572ff1[_0xc4df('0x49')]=_['intersection'](_0x572ff1[_0xc4df('0x36')],_0x572ff1[_0xc4df('0x33')]);_0x244901['attributes']=_[_0xc4df('0x35')](_0x572ff1[_0xc4df('0x36')],qs['fields'](_0x1118b4[_0xc4df('0x33')]['fields']));_0x244901['attributes']=_0x244901[_0xc4df('0x37')][_0xc4df('0x39')]?_0x244901[_0xc4df('0x37')]:_0x572ff1['model'];if(_0x1118b4['query']['includeAll']){_0x244901[_0xc4df('0x46')]=[{'all':!![]}];}_0x244901=_[_0xc4df('0x43')]({},_0x244901,_0x1118b4['options']);return db['MailQueue'][_0xc4df('0x4a')](_0x244901)[_0xc4df('0x2b')](handleEntityNotFound(_0x52794c,null))[_0xc4df('0x2b')](respondWithResult(_0x52794c,null))[_0xc4df('0x48')](handleError(_0x52794c,null));};exports[_0xc4df('0x4b')]=function(_0x575e4c,_0x1f5faf){return db['MailQueue'][_0xc4df('0x4b')](_0x575e4c[_0xc4df('0x4c')],{})[_0xc4df('0x2b')](function(_0x1117aa){var _0x5a902f=_0x575e4c['user'][_0xc4df('0x28')]({'plain':!![]});if(!_0x5a902f)throw new Error(_0xc4df('0x4d'));if(_0x5a902f[_0xc4df('0x4e')]===_0xc4df('0x4f')){var _0x2dc0fc=_0x1117aa[_0xc4df('0x28')]({'plain':!![]});var _0x20a5d9=_0xc4df('0x29');return db[_0xc4df('0x50')]['find']({'where':{'name':_0x20a5d9,'userProfileId':_0x5a902f[_0xc4df('0x51')]},'raw':!![]})[_0xc4df('0x2b')](function(_0x4d3c86){if(_0x4d3c86&&_0x4d3c86[_0xc4df('0x52')]===0x0){return db[_0xc4df('0x53')][_0xc4df('0x4b')]({'name':_0x2dc0fc[_0xc4df('0x2e')],'resourceId':_0x2dc0fc['id'],'type':_0x4d3c86[_0xc4df('0x2e')],'sectionId':_0x4d3c86['id']},{})[_0xc4df('0x2b')](function(){return _0x1117aa;});}else{return _0x1117aa;}})[_0xc4df('0x48')](function(_0x5a3150){logger[_0xc4df('0x2c')](_0xc4df('0x54'),_0x5a3150);throw _0x5a3150;});}return _0x1117aa;})[_0xc4df('0x2b')](respondWithResult(_0x1f5faf,0xc9))['catch'](handleError(_0x1f5faf,null));};exports[_0xc4df('0x55')]=function(_0xc42652,_0x42b2eb){if(_0xc42652[_0xc4df('0x4c')]['id']){delete _0xc42652['body']['id'];}return db['MailQueue'][_0xc4df('0x4a')]({'where':{'id':_0xc42652[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x42b2eb,null))['then'](saveUpdates(_0xc42652[_0xc4df('0x4c')],null))[_0xc4df('0x2b')](respondWithResult(_0x42b2eb,null))[_0xc4df('0x48')](handleError(_0x42b2eb,null));};exports[_0xc4df('0x2a')]=function(_0x526d47,_0x2bf34f){return db['MailQueue'][_0xc4df('0x4a')]({'where':{'id':_0x526d47[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x2bf34f,null))[_0xc4df('0x2b')](removeEntity(_0x2bf34f,null))[_0xc4df('0x48')](handleError(_0x2bf34f,null));};exports[_0xc4df('0x57')]=function(_0x14494c,_0x5b8ce3){return db['MailQueue'][_0xc4df('0x57')]()[_0xc4df('0x2b')](respondWithResult(_0x5b8ce3,null))['catch'](handleError(_0x5b8ce3,null));};exports[_0xc4df('0x58')]=function(_0x4ee438,_0x566f20,_0x5b0258){var _0x4c5ac0={'raw':!![],'where':{}},_0x31d0e7={},_0x295e0f;return db[_0xc4df('0x30')][_0xc4df('0x59')]({'where':{'id':_0x4ee438[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x566f20,null))[_0xc4df('0x2b')](function(_0x1ef0a4){if(_0x1ef0a4){_0x295e0f=_0x1ef0a4[_0xc4df('0x28')]({'plain':!![]});_0x31d0e7[_0xc4df('0x36')]=_[_0xc4df('0x34')](db[_0xc4df('0x5a')][_0xc4df('0x31')]);_0x31d0e7[_0xc4df('0x33')]=_[_0xc4df('0x34')](_0x4ee438['query']);_0x31d0e7[_0xc4df('0x49')]=_[_0xc4df('0x35')](_0x31d0e7[_0xc4df('0x36')],_0x31d0e7[_0xc4df('0x33')]);_0x4c5ac0[_0xc4df('0x37')]=_[_0xc4df('0x35')](_0x31d0e7[_0xc4df('0x36')],qs['fields'](_0x4ee438[_0xc4df('0x33')][_0xc4df('0x38')]));_0x4c5ac0[_0xc4df('0x37')]=_0x4c5ac0[_0xc4df('0x37')][_0xc4df('0x39')]?_0x4c5ac0[_0xc4df('0x37')]:_0x31d0e7['model'];if(!_0x4ee438[_0xc4df('0x33')][_0xc4df('0x3a')](_0xc4df('0x5b'))){_0x4c5ac0[_0xc4df('0x23')]=qs[_0xc4df('0x23')](_0x4ee438[_0xc4df('0x33')][_0xc4df('0x23')]);_0x4c5ac0[_0xc4df('0x22')]=qs[_0xc4df('0x22')](_0x4ee438['query'][_0xc4df('0x22')]);}_0x4c5ac0[_0xc4df('0x3b')]=qs[_0xc4df('0x3c')](_0x4ee438[_0xc4df('0x33')][_0xc4df('0x3c')]);_0x4c5ac0['where']=qs[_0xc4df('0x49')](_[_0xc4df('0x3e')](_0x4ee438[_0xc4df('0x33')],_0x31d0e7[_0xc4df('0x49')]));_0x4c5ac0[_0xc4df('0x3d')][_0xc4df('0x5c')]=_0x1ef0a4['id'];if(_0x4ee438[_0xc4df('0x33')]['filter']){_0x4c5ac0[_0xc4df('0x3d')]=_[_0xc4df('0x43')](_0x4c5ac0[_0xc4df('0x3d')],{'$or':_[_0xc4df('0x40')](_0x4c5ac0[_0xc4df('0x37')],function(_0x4f898b){var _0x225f25={};_0x225f25[_0x4f898b]={'$like':'%'+_0x4ee438[_0xc4df('0x33')][_0xc4df('0x3f')]+'%'};return _0x225f25;})});}_0x4c5ac0=_['merge']({},_0x4c5ac0,_0x4ee438['options']);return db[_0xc4df('0x5a')]['findAll'](_0x4c5ac0);}})[_0xc4df('0x2b')](function(_0x1a28c7){if(_0x1a28c7){return db['User'][_0xc4df('0x5d')]({'where':{'id':_[_0xc4df('0x40')](_0x1a28c7,_0xc4df('0x5e')),'role':_0xc4df('0x5f')},'attributes':['id',_0xc4df('0x2e'),_0xc4df('0x60'),'updatedAt',_0xc4df('0x61')]});}})[_0xc4df('0x2b')](function(_0x52c59f){if(_0x52c59f){return{'count':_0x52c59f[_0xc4df('0x45')],'rows':_[_0xc4df('0x40')](_0x52c59f[_0xc4df('0x47')],function(_0x3ae897){return{'membername':_0x3ae897[_0xc4df('0x2e')],'UserId':_0x3ae897['id'],'queue_name':_0x295e0f[_0xc4df('0x2e')],'MailQueueId':_0x295e0f['id'],'interface':util['format'](_0xc4df('0x62'),_0xc4df('0x63'),_0x3ae897['name']),'penalty':0x0,'paused':_0x3ae897[_0xc4df('0x60')],'createdAt':_0x3ae897[_0xc4df('0x61')],'updatedAt':_0x3ae897['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc4df('0x2b')](respondWithFilteredResult(_0x566f20,_0x4c5ac0))[_0xc4df('0x48')](handleError(_0x566f20,null));};exports[_0xc4df('0x64')]=function(_0x99eba4,_0x4a128a,_0x28577a){var _0x5673ab={};var _0x5b2f9b={};var _0x8dcaca;var _0x4afb94;return db[_0xc4df('0x30')][_0xc4df('0x59')]({'where':{'id':_0x99eba4[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x4a128a,null))[_0xc4df('0x2b')](function(_0x5c8733){if(_0x5c8733){_0x8dcaca=_0x5c8733;_0x5b2f9b['model']=_[_0xc4df('0x34')](db[_0xc4df('0x65')][_0xc4df('0x31')]);_0x5b2f9b[_0xc4df('0x33')]=_[_0xc4df('0x34')](_0x99eba4[_0xc4df('0x33')]);_0x5b2f9b[_0xc4df('0x49')]=_['intersection'](_0x5b2f9b[_0xc4df('0x36')],_0x5b2f9b[_0xc4df('0x33')]);_0x5673ab[_0xc4df('0x37')]=_[_0xc4df('0x35')](_0x5b2f9b['model'],qs['fields'](_0x99eba4[_0xc4df('0x33')][_0xc4df('0x38')]));_0x5673ab[_0xc4df('0x37')]=_0x5673ab['attributes'][_0xc4df('0x39')]?_0x5673ab[_0xc4df('0x37')]:_0x5b2f9b['model'];_0x5673ab[_0xc4df('0x3b')]=qs[_0xc4df('0x3c')](_0x99eba4[_0xc4df('0x33')]['sort']);_0x5673ab[_0xc4df('0x3d')]=qs[_0xc4df('0x49')](_['pick'](_0x99eba4[_0xc4df('0x33')],_0x5b2f9b[_0xc4df('0x49')]));if(_0x99eba4[_0xc4df('0x33')][_0xc4df('0x3f')]){_0x5673ab['where']=_[_0xc4df('0x43')](_0x5673ab['where'],{'$or':_[_0xc4df('0x40')](_0x5673ab[_0xc4df('0x37')],function(_0x3b0946){var _0x7e4fe2={};_0x7e4fe2[_0x3b0946]={'$like':'%'+_0x99eba4[_0xc4df('0x33')][_0xc4df('0x3f')]+'%'};return _0x7e4fe2;})});}_0x5673ab=_['merge']({},_0x5673ab,_0x99eba4[_0xc4df('0x44')]);return _0x8dcaca[_0xc4df('0x64')](_0x5673ab);}})[_0xc4df('0x2b')](function(_0x192993){if(_0x192993){_0x4afb94=_0x192993[_0xc4df('0x39')];if(!_0x99eba4[_0xc4df('0x33')][_0xc4df('0x3a')]('nolimit')){_0x5673ab[_0xc4df('0x23')]=qs[_0xc4df('0x23')](_0x99eba4[_0xc4df('0x33')][_0xc4df('0x23')]);_0x5673ab[_0xc4df('0x22')]=qs['offset'](_0x99eba4[_0xc4df('0x33')][_0xc4df('0x22')]);}return _0x8dcaca[_0xc4df('0x64')](_0x5673ab);}})[_0xc4df('0x2b')](function(_0x4c72b4){if(_0x4c72b4){return _0x4c72b4?{'count':_0x4afb94,'rows':_0x4c72b4}:null;}})[_0xc4df('0x2b')](respondWithResult(_0x4a128a,null))[_0xc4df('0x48')](handleError(_0x4a128a,null));};exports[_0xc4df('0x66')]=function(_0x4fba4b,_0x20dda6,_0x3998f3){var _0x5a700d=_0x4fba4b[_0xc4df('0x4c')][_0xc4df('0x67')];return db[_0xc4df('0x65')]['findAll']({'where':{'id':_0x5a700d},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc4df('0x68'),'attributes':['id',_0xc4df('0x2e'),_0xc4df('0x69'),'voicePause','interface'],'raw':!![]}]})[_0xc4df('0x2b')](function(_0x5c5746){if(_0x5c5746){var _0x52ebc5=_[_0xc4df('0x6a')](_0x5c5746,function(_0x327358){var _0x33e8f2=_0x327358[_0xc4df('0x28')]({'plain':!![]});return _0x33e8f2[_0xc4df('0x68')];});return db[_0xc4df('0x30')]['find']({'where':{'id':_0x4fba4b[_0xc4df('0x56')]['id']}})['then'](function(_0x7420b8){return db[_0xc4df('0x6b')][_0xc4df('0x6c')](function(_0x163e6f){return _0x7420b8[_0xc4df('0x66')](_0x5a700d,{'transaction':_0x163e6f})[_0xc4df('0x2b')](function(){return BPromise[_0xc4df('0x6d')](_0x52ebc5,function(_0x34c905){return db[_0xc4df('0x5a')][_0xc4df('0x6e')]({'where':{'UserId':_0x34c905['id'],'MailQueueId':_0x4fba4b[_0xc4df('0x56')]['id']},'transaction':_0x163e6f});});})['then'](function(){_0x52ebc5[_0xc4df('0x6f')](function(_0x4b6932){socket[_0xc4df('0x70')](_0xc4df('0x71'),{'UserId':_0x4b6932['id'],'MailQueueId':_0x7420b8['id']});});});});});}})['then'](respondWithStatusCode(_0x20dda6,null))['catch'](handleError(_0x20dda6,null));};exports[_0xc4df('0x72')]=function(_0x578195,_0x5016d2,_0x437c21){return db[_0xc4df('0x65')]['findAll']({'where':{'id':_0x578195['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xc4df('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc4df('0x2b')](handleEntityNotFound(_0x5016d2,null))[_0xc4df('0x2b')](function(_0xc76173){var _0x36b950=_[_0xc4df('0x40')](_0xc76173,'id');var _0x1bda8b=[];var _0x49fc82=[];var _0x5a5008=squel['select']();_0x5a5008[_0xc4df('0x74')](_0xc4df('0x75'))[_0xc4df('0x76')](_0xc4df('0x77'),'tq')[_0xc4df('0x78')](_0xc4df('0x79'),'ut',_0xc4df('0x7a'))[_0xc4df('0x3d')](_0xc4df('0x7b'),_0x578195[_0xc4df('0x56')]['id']);for(var _0x5f0144=0x0;_0x5f0144<_0xc76173['length'];_0x5f0144+=0x1){let _0x50bddd=_0xc76173[_0x5f0144];for(var _0x1bef4d=0x0;_0x1bef4d<_0x50bddd[_0xc4df('0x68')][_0xc4df('0x39')];_0x1bef4d+=0x1){let _0x1bc29c=_0x50bddd[_0xc4df('0x68')][_0x1bef4d];var _0x268bbb=_0x5a5008[_0xc4df('0x7c')]();_0x268bbb[_0xc4df('0x3d')](_0xc4df('0x7d'),_0x1bc29c['id']);_0x49fc82['push'](db[_0xc4df('0x6b')][_0xc4df('0x33')](_0x268bbb[_0xc4df('0x7e')](),{'type':db[_0xc4df('0x6b')][_0xc4df('0x7f')]['SELECT']})[_0xc4df('0x2b')](function(_0x2f5aab){if(_0x2f5aab['length']===0x1){return _0x1bc29c['id'];}else{var _0x94b2e7=_[_0xc4df('0x80')](_[_0xc4df('0x40')](_0x2f5aab,_0xc4df('0x81')),function(_0x2b5447){return _[_0xc4df('0x82')](_0x36b950,_0x2b5447);});if(_0x94b2e7){return _0x1bc29c['id'];}}}));}}return BPromise[_0xc4df('0x83')](_0x49fc82)['then'](function(_0x3ba929){_0x1bda8b=_(_0x1bda8b)[_0xc4df('0x84')](_0x3ba929)[_0xc4df('0x85')]()['value']();return db['MailQueue'][_0xc4df('0x4a')]({'where':{'id':_0x578195[_0xc4df('0x56')]['id']}})['then'](function(_0x1c1128){return db['sequelize'][_0xc4df('0x6c')](function(_0x570de0){return _0x1c1128[_0xc4df('0x72')](_0x578195[_0xc4df('0x33')][_0xc4df('0x67')],{'transaction':_0x570de0})[_0xc4df('0x2b')](function(){if(!_[_0xc4df('0x86')](_0x1bda8b)){return _0x1c1128[_0xc4df('0x87')](_0x1bda8b,{'transaction':_0x570de0});}})[_0xc4df('0x2b')](function(){_0x1bda8b['forEach'](function(_0xde4809){socket['emit'](_0xc4df('0x88'),{'UserId':_0xde4809,'MailQueueId':_0x1c1128['id']});});});});});});})[_0xc4df('0x2b')](respondWithStatusCode(_0x5016d2,null))[_0xc4df('0x48')](handleError(_0x5016d2,null));};exports[_0xc4df('0x89')]=function(_0x5c950e,_0x137eee,_0x41d050){return db[_0xc4df('0x30')]['find']({'where':{'id':_0x5c950e[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x137eee,null))[_0xc4df('0x2b')](function(_0x3b9345){if(_0x3b9345){return _0x3b9345[_0xc4df('0x89')](_0x5c950e['body']['ids'],_[_0xc4df('0x8a')](_0x5c950e['body'],['ids','id'])||{})[_0xc4df('0x8b')](function(_0x2d45d6){for(var _0x314e30=0x0;_0x314e30<_0x5c950e[_0xc4df('0x4c')][_0xc4df('0x67')]['length'];_0x314e30+=0x1){socket[_0xc4df('0x70')]('userMailQueue:save',{'UserId':_0x5c950e['body']['ids'][_0x314e30],'MailQueueId':_0x5c950e[_0xc4df('0x56')]['id']});}return _0x2d45d6;});}})[_0xc4df('0x2b')](respondWithResult(_0x137eee,null))[_0xc4df('0x48')](handleError(_0x137eee,null));};exports[_0xc4df('0x87')]=function(_0x293559,_0x450261,_0xeaabbd){return db[_0xc4df('0x30')]['find']({'where':{'id':_0x293559['params']['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x450261,null))[_0xc4df('0x2b')](function(_0x1d7ae3){if(_0x1d7ae3){return _0x1d7ae3[_0xc4df('0x87')](_0x293559[_0xc4df('0x33')]['ids'])[_0xc4df('0x2b')](function(){if(_['isArray'](_0x293559[_0xc4df('0x33')]['ids'])){for(var _0x55d604=0x0;_0x55d604<_0x293559[_0xc4df('0x33')][_0xc4df('0x67')][_0xc4df('0x39')];_0x55d604+=0x1){socket['emit'](_0xc4df('0x88'),{'UserId':Number(_0x293559['query'][_0xc4df('0x67')][_0x55d604]),'MailQueueId':Number(_0x293559[_0xc4df('0x56')]['id'])});}}else{socket[_0xc4df('0x70')](_0xc4df('0x88'),{'UserId':Number(_0x293559[_0xc4df('0x33')][_0xc4df('0x67')]),'MailQueueId':Number(_0x293559[_0xc4df('0x56')]['id'])});}});}})[_0xc4df('0x2b')](respondWithStatusCode(_0x450261,null))[_0xc4df('0x48')](handleError(_0x450261,null));};exports[_0xc4df('0x8c')]=function(_0xd52151,_0x379dde,_0x143345){var _0xccf6cc={};var _0x86fe66={};var _0x32644b;var _0x492ba6;return db[_0xc4df('0x30')][_0xc4df('0x59')]({'where':{'id':_0xd52151[_0xc4df('0x56')]['id']}})['then'](handleEntityNotFound(_0x379dde,null))[_0xc4df('0x2b')](function(_0x567634){if(_0x567634){_0x32644b=_0x567634;_0x86fe66[_0xc4df('0x36')]=_[_0xc4df('0x34')](db[_0xc4df('0x73')][_0xc4df('0x31')]);_0x86fe66[_0xc4df('0x33')]=_[_0xc4df('0x34')](_0xd52151[_0xc4df('0x33')]);_0x86fe66[_0xc4df('0x49')]=_[_0xc4df('0x35')](_0x86fe66[_0xc4df('0x36')],_0x86fe66[_0xc4df('0x33')]);_0xccf6cc[_0xc4df('0x37')]=_[_0xc4df('0x35')](_0x86fe66[_0xc4df('0x36')],qs[_0xc4df('0x38')](_0xd52151[_0xc4df('0x33')]['fields']));_0xccf6cc[_0xc4df('0x37')]=_0xccf6cc['attributes']['length']?_0xccf6cc[_0xc4df('0x37')]:_0x86fe66['model'];_0xccf6cc[_0xc4df('0x3b')]=qs['sort'](_0xd52151[_0xc4df('0x33')]['sort']);_0xccf6cc[_0xc4df('0x3d')]=qs['filters'](_[_0xc4df('0x3e')](_0xd52151[_0xc4df('0x33')],_0x86fe66['filters']));if(_0xd52151[_0xc4df('0x33')]['filter']){_0xccf6cc['where']=_[_0xc4df('0x43')](_0xccf6cc[_0xc4df('0x3d')],{'$or':_[_0xc4df('0x40')](_0xccf6cc[_0xc4df('0x37')],function(_0x5165bb){var _0x2a1dc9={};_0x2a1dc9[_0x5165bb]={'$like':'%'+_0xd52151[_0xc4df('0x33')][_0xc4df('0x3f')]+'%'};return _0x2a1dc9;})});}_0xccf6cc=_[_0xc4df('0x43')]({},_0xccf6cc,_0xd52151[_0xc4df('0x44')]);return _0x32644b['getAgents'](_0xccf6cc);}})['then'](function(_0x54aca4){if(_0x54aca4){_0x492ba6=_0x54aca4[_0xc4df('0x39')];if(!_0xd52151[_0xc4df('0x33')][_0xc4df('0x3a')](_0xc4df('0x5b'))){_0xccf6cc[_0xc4df('0x23')]=qs[_0xc4df('0x23')](_0xd52151[_0xc4df('0x33')][_0xc4df('0x23')]);_0xccf6cc[_0xc4df('0x22')]=qs[_0xc4df('0x22')](_0xd52151[_0xc4df('0x33')]['offset']);}return _0x32644b[_0xc4df('0x8c')](_0xccf6cc);}})['then'](function(_0x55f662){if(_0x55f662){return _0x55f662?{'count':_0x492ba6,'rows':_0x55f662}:null;}})[_0xc4df('0x2b')](respondWithResult(_0x379dde,null))[_0xc4df('0x48')](handleError(_0x379dde,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index d670284..5acc9c8 100644 --- a/server/api/mailQueue/mailQueue.events.js +++ b/server/api/mailQueue/mailQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca1c=['update','remove','emit','hook','exports','../../mysqldb','MailQueue','save'];(function(_0x851fae,_0x5efd08){var _0x12dcff=function(_0x4c3728){while(--_0x4c3728){_0x851fae['push'](_0x851fae['shift']());}};_0x12dcff(++_0x5efd08);}(_0xca1c,0x95));var _0xcca1=function(_0x677dad,_0x17693c){_0x677dad=_0x677dad-0x0;var _0x27f247=_0xca1c[_0x677dad];return _0x27f247;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xcca1('0x0'))['db'][_0xcca1('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcca1('0x2'),'afterUpdate':_0xcca1('0x3'),'afterDestroy':_0xcca1('0x4')};function emitEvent(_0x4af821){return function(_0x5b187f,_0x35a896,_0x56848e){MailQueueEvents[_0xcca1('0x5')](_0x4af821+':'+_0x5b187f['id'],_0x5b187f);MailQueueEvents[_0xcca1('0x5')](_0x4af821,_0x5b187f);_0x56848e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xcca1('0x6')](e,emitEvent(event));}}module[_0xcca1('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x967c=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2bbdf3,_0x4764d3){var _0x1e324d=function(_0x42dfd7){while(--_0x42dfd7){_0x2bbdf3['push'](_0x2bbdf3['shift']());}};_0x1e324d(++_0x4764d3);}(_0x967c,0x14a));var _0xc967=function(_0x1d6ccd,_0x3e316c){_0x1d6ccd=_0x1d6ccd-0x0;var _0x1ba76c=_0x967c[_0x1d6ccd];return _0x1ba76c;};'use strict';var EventEmitter=require(_0xc967('0x0'));var MailQueue=require(_0xc967('0x1'))['db'][_0xc967('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc967('0x3')](0x0);var events={'afterCreate':_0xc967('0x4'),'afterUpdate':_0xc967('0x5'),'afterDestroy':_0xc967('0x6')};function emitEvent(_0x3fb3fe){return function(_0x425c42,_0x28f890,_0x44d440){MailQueueEvents[_0xc967('0x7')](_0x3fb3fe+':'+_0x425c42['id'],_0x425c42);MailQueueEvents['emit'](_0x3fb3fe,_0x425c42);_0x44d440(null);};}for(var e in events){if(events[_0xc967('0x8')](e)){var event=events[e];MailQueue[_0xc967('0x9')](e,emitEvent(event));}}module[_0xc967('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 670b74c..36fae3a 100644 --- a/server/api/mailQueue/mailQueue.model.js +++ b/server/api/mailQueue/mailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e20=['../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x3c2b2b,_0x5250d9){var _0x1484f5=function(_0x6c9957){while(--_0x6c9957){_0x3c2b2b['push'](_0x3c2b2b['shift']());}};_0x1484f5(++_0x5250d9);}(_0x5e20,0xb5));var _0x05e2=function(_0x1857f8,_0x128422){_0x1857f8=_0x1857f8-0x0;var _0x1643af=_0x5e20[_0x1857f8];return _0x1643af;};'use strict';var _=require(_0x05e2('0x0'));var util=require('util');var logger=require(_0x05e2('0x1'))(_0x05e2('0x2'));var moment=require(_0x05e2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x05e2('0x4'));var rimraf=require(_0x05e2('0x5'));var config=require(_0x05e2('0x6'));var attributes=require(_0x05e2('0x7'));module[_0x05e2('0x8')]=function(_0x1a600f,_0x3304f2){return _0x1a600f['define'](_0x05e2('0x9'),attributes,{'tableName':_0x05e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a96=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','../../config/logger','api','moment','bluebird'];(function(_0x96cefd,_0x25cb5d){var _0x4310c1=function(_0x4e9c5f){while(--_0x4e9c5f){_0x96cefd['push'](_0x96cefd['shift']());}};_0x4310c1(++_0x25cb5d);}(_0x0a96,0x141));var _0x60a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a96[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60a9('0x0'))(_0x60a9('0x1'));var moment=require(_0x60a9('0x2'));var BPromise=require(_0x60a9('0x3'));var rp=require(_0x60a9('0x4'));var fs=require('fs');var path=require(_0x60a9('0x5'));var rimraf=require(_0x60a9('0x6'));var config=require(_0x60a9('0x7'));var attributes=require(_0x60a9('0x8'));module[_0x60a9('0x9')]=function(_0x4eeb2c,_0x1fc1ff){return _0x4eeb2c[_0x60a9('0xa')](_0x60a9('0xb'),attributes,{'tableName':_0x60a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index e65c5b3..63ac381 100644 --- a/server/api/mailQueue/mailQueue.rpc.js +++ b/server/api/mailQueue/mailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8815=['ShowMailQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueue,\x20%s,\x20%s','result','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetMailQueue','catch'];(function(_0xbb2fe7,_0x18adc1){var _0x3c714f=function(_0x8672f5){while(--_0x8672f5){_0xbb2fe7['push'](_0xbb2fe7['shift']());}};_0x3c714f(++_0x18adc1);}(_0x8815,0x191));var _0x5881=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0x8815[_0x589f71];return _0x5763bd;};'use strict';var _=require('lodash');var util=require(_0x5881('0x0'));var moment=require('moment');var BPromise=require(_0x5881('0x1'));var rs=require(_0x5881('0x2'));var fs=require('fs');var Redis=require(_0x5881('0x3'));var db=require(_0x5881('0x4'))['db'];var utils=require(_0x5881('0x5'));var logger=require(_0x5881('0x6'))('rpc');var config=require(_0x5881('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5881('0x8')][_0x5881('0x9')]({'port':0x232a});config['redis']=_[_0x5881('0xa')](config[_0x5881('0xb')],{'host':_0x5881('0xc'),'port':0x18eb});var socket=require(_0x5881('0xd'))(new Redis(config['redis']));require(_0x5881('0xe'))['register'](socket);function respondWithRpcPromise(_0x5aa31a,_0x7d8a62,_0x132749){return new BPromise(function(_0x2a45fe,_0x159222){return client[_0x5881('0xf')](_0x5aa31a,_0x132749)[_0x5881('0x10')](function(_0x477e3f){logger[_0x5881('0x11')]('MailQueue,\x20%s,\x20%s',_0x7d8a62,_0x5881('0x12'));logger[_0x5881('0x13')](_0x5881('0x14'),_0x7d8a62,_0x5881('0x12'),JSON[_0x5881('0x15')](_0x477e3f));if(_0x477e3f[_0x5881('0x16')]){if(_0x477e3f[_0x5881('0x16')][_0x5881('0x17')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x7d8a62,_0x477e3f[_0x5881('0x16')][_0x5881('0x18')]);return _0x159222(_0x477e3f[_0x5881('0x16')][_0x5881('0x18')]);}logger[_0x5881('0x16')](_0x5881('0x19'),_0x7d8a62,_0x477e3f[_0x5881('0x16')][_0x5881('0x18')]);return _0x2a45fe(_0x477e3f[_0x5881('0x16')][_0x5881('0x18')]);}else{logger[_0x5881('0x11')](_0x5881('0x19'),_0x7d8a62,_0x5881('0x12'));_0x2a45fe(_0x477e3f[_0x5881('0x1a')][_0x5881('0x18')]);}})['catch'](function(_0x231ba1){logger[_0x5881('0x16')]('MailQueue,\x20%s,\x20%s',_0x7d8a62,_0x231ba1);_0x159222(_0x231ba1);});});}exports['GetMailQueue']=function(_0x40d4a2){var _0x5da60d=this;return new Promise(function(_0x1015f6,_0x511164){return db[_0x5881('0x1b')][_0x5881('0x1c')]({'raw':_0x40d4a2['options']?_0x40d4a2[_0x5881('0x1d')][_0x5881('0x1e')]===undefined?!![]:![]:!![],'where':_0x40d4a2[_0x5881('0x1d')]?_0x40d4a2['options'][_0x5881('0x1f')]||null:null,'attributes':_0x40d4a2[_0x5881('0x1d')]?_0x40d4a2[_0x5881('0x1d')][_0x5881('0x20')]||null:null,'limit':_0x40d4a2[_0x5881('0x1d')]?_0x40d4a2['options'][_0x5881('0x21')]||null:null,'include':_0x40d4a2[_0x5881('0x1d')]?_0x40d4a2[_0x5881('0x1d')][_0x5881('0x22')]?_[_0x5881('0x23')](_0x40d4a2[_0x5881('0x1d')][_0x5881('0x22')],function(_0x3fdd97){return{'model':db[_0x3fdd97[_0x5881('0x24')]],'as':_0x3fdd97['as'],'attributes':_0x3fdd97[_0x5881('0x20')],'include':_0x3fdd97[_0x5881('0x22')]?_['map'](_0x3fdd97['include'],function(_0x1e6405){return{'model':db[_0x1e6405['model']],'as':_0x1e6405['as'],'attributes':_0x1e6405[_0x5881('0x20')],'include':_0x1e6405['include']?_[_0x5881('0x23')](_0x1e6405[_0x5881('0x22')],function(_0x3a60d2){return{'model':db[_0x3a60d2[_0x5881('0x24')]],'as':_0x3a60d2['as'],'attributes':_0x3a60d2[_0x5881('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5881('0x10')](function(_0x2988eb){logger['info']('GetMailQueue',_0x40d4a2);logger['debug'](_0x5881('0x25'),_0x40d4a2,JSON[_0x5881('0x15')](_0x2988eb));_0x1015f6(_0x2988eb);})[_0x5881('0x26')](function(_0x35611d){logger[_0x5881('0x16')](_0x5881('0x25'),_0x35611d[_0x5881('0x18')],_0x40d4a2);_0x511164(_0x5da60d[_0x5881('0x16')](0x1f4,_0x35611d[_0x5881('0x18')]));});});};exports[_0x5881('0x27')]=function(_0x15f532){var _0x6336f=this;return new Promise(function(_0x371e01,_0x2c6631){return db['MailQueue']['find']({'raw':_0x15f532[_0x5881('0x1d')]?_0x15f532['options']['raw']===undefined?!![]:![]:!![],'where':_0x15f532['options']?_0x15f532[_0x5881('0x1d')]['where']||null:null,'attributes':_0x15f532['options']?_0x15f532['options'][_0x5881('0x20')]||null:null,'include':_0x15f532['options']?_0x15f532[_0x5881('0x1d')]['include']?_[_0x5881('0x23')](_0x15f532['options'][_0x5881('0x22')],function(_0x8865c2){return{'model':db[_0x8865c2[_0x5881('0x24')]],'as':_0x8865c2['as'],'attributes':_0x8865c2[_0x5881('0x20')],'include':_0x8865c2[_0x5881('0x22')]?_['map'](_0x8865c2[_0x5881('0x22')],function(_0x25672f){return{'model':db[_0x25672f[_0x5881('0x24')]],'as':_0x25672f['as'],'attributes':_0x25672f[_0x5881('0x20')],'include':_0x25672f[_0x5881('0x22')]?_[_0x5881('0x23')](_0x25672f[_0x5881('0x22')],function(_0xde22e0){return{'model':db[_0xde22e0[_0x5881('0x24')]],'as':_0xde22e0['as'],'attributes':_0xde22e0[_0x5881('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5881('0x10')](function(_0x5a56fc){logger['info'](_0x5881('0x27'),_0x15f532);logger[_0x5881('0x13')](_0x5881('0x27'),_0x15f532,JSON['stringify'](_0x5a56fc));_0x371e01(_0x5a56fc);})[_0x5881('0x26')](function(_0x5a5373){logger[_0x5881('0x16')](_0x5881('0x27'),_0x5a5373[_0x5881('0x18')],_0x15f532);_0x2c6631(_0x6336f[_0x5881('0x16')](0x1f4,_0x5a5373['message']));});});}; \ No newline at end of file +var _0xc4dd=['MailQueue,\x20%s,\x20%s','message','catch','MailQueue','options','raw','where','attributes','limit','include','map','model','GetMailQueue','stringify','ShowMailQueue','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','request','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x54aac5,_0x1118b3){var _0x443bcc=function(_0x4e8e4e){while(--_0x4e8e4e){_0x54aac5['push'](_0x54aac5['shift']());}};_0x443bcc(++_0x1118b3);}(_0xc4dd,0x1cd));var _0xdc4d=function(_0x2efb63,_0x3e1acd){_0x2efb63=_0x2efb63-0x0;var _0x557c62=_0xc4dd[_0x2efb63];return _0x557c62;};'use strict';var _=require('lodash');var util=require(_0xdc4d('0x0'));var moment=require(_0xdc4d('0x1'));var BPromise=require(_0xdc4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc4d('0x3'));var db=require(_0xdc4d('0x4'))['db'];var utils=require(_0xdc4d('0x5'));var logger=require(_0xdc4d('0x6'))(_0xdc4d('0x7'));var config=require(_0xdc4d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc4d('0x9')]({'port':0x232a});config[_0xdc4d('0xa')]=_[_0xdc4d('0xb')](config[_0xdc4d('0xa')],{'host':_0xdc4d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4100d8,_0x52ba9c,_0x593129){return new BPromise(function(_0x481975,_0x4ebf12){return client[_0xdc4d('0xd')](_0x4100d8,_0x593129)['then'](function(_0x21aba1){logger[_0xdc4d('0xe')]('MailQueue,\x20%s,\x20%s',_0x52ba9c,'request\x20sent');logger[_0xdc4d('0xf')](_0xdc4d('0x10'),_0x52ba9c,_0xdc4d('0x11'),JSON['stringify'](_0x21aba1));if(_0x21aba1['error']){if(_0x21aba1[_0xdc4d('0x12')][_0xdc4d('0x13')]===0x1f4){logger[_0xdc4d('0x12')](_0xdc4d('0x14'),_0x52ba9c,_0x21aba1[_0xdc4d('0x12')][_0xdc4d('0x15')]);return _0x4ebf12(_0x21aba1[_0xdc4d('0x12')]['message']);}logger[_0xdc4d('0x12')]('MailQueue,\x20%s,\x20%s',_0x52ba9c,_0x21aba1[_0xdc4d('0x12')]['message']);return _0x481975(_0x21aba1['error'][_0xdc4d('0x15')]);}else{logger['info'](_0xdc4d('0x14'),_0x52ba9c,_0xdc4d('0x11'));_0x481975(_0x21aba1['result'][_0xdc4d('0x15')]);}})[_0xdc4d('0x16')](function(_0x2d0117){logger['error']('MailQueue,\x20%s,\x20%s',_0x52ba9c,_0x2d0117);_0x4ebf12(_0x2d0117);});});}exports['GetMailQueue']=function(_0x5ddf4a){var _0x28823c=this;return new Promise(function(_0x23c03d,_0x3c388a){return db[_0xdc4d('0x17')]['findAll']({'raw':_0x5ddf4a[_0xdc4d('0x18')]?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x19')]===undefined?!![]:![]:!![],'where':_0x5ddf4a['options']?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x1a')]||null:null,'attributes':_0x5ddf4a[_0xdc4d('0x18')]?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x1b')]||null:null,'limit':_0x5ddf4a[_0xdc4d('0x18')]?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x1c')]||null:null,'include':_0x5ddf4a['options']?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x1d')]?_[_0xdc4d('0x1e')](_0x5ddf4a[_0xdc4d('0x18')]['include'],function(_0x1a8985){return{'model':db[_0x1a8985[_0xdc4d('0x1f')]],'as':_0x1a8985['as'],'attributes':_0x1a8985[_0xdc4d('0x1b')],'include':_0x1a8985[_0xdc4d('0x1d')]?_[_0xdc4d('0x1e')](_0x1a8985[_0xdc4d('0x1d')],function(_0x2291ed){return{'model':db[_0x2291ed[_0xdc4d('0x1f')]],'as':_0x2291ed['as'],'attributes':_0x2291ed['attributes'],'include':_0x2291ed['include']?_['map'](_0x2291ed[_0xdc4d('0x1d')],function(_0x49c4b3){return{'model':db[_0x49c4b3[_0xdc4d('0x1f')]],'as':_0x49c4b3['as'],'attributes':_0x49c4b3[_0xdc4d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26af9f){logger['info'](_0xdc4d('0x20'),_0x5ddf4a);logger[_0xdc4d('0xf')]('GetMailQueue',_0x5ddf4a,JSON[_0xdc4d('0x21')](_0x26af9f));_0x23c03d(_0x26af9f);})[_0xdc4d('0x16')](function(_0x1b42ba){logger[_0xdc4d('0x12')](_0xdc4d('0x20'),_0x1b42ba['message'],_0x5ddf4a);_0x3c388a(_0x28823c[_0xdc4d('0x12')](0x1f4,_0x1b42ba['message']));});});};exports[_0xdc4d('0x22')]=function(_0x49f312){var _0x35cab0=this;return new Promise(function(_0x3bb473,_0x48c7b0){return db['MailQueue'][_0xdc4d('0x23')]({'raw':_0x49f312[_0xdc4d('0x18')]?_0x49f312['options'][_0xdc4d('0x19')]===undefined?!![]:![]:!![],'where':_0x49f312[_0xdc4d('0x18')]?_0x49f312['options'][_0xdc4d('0x1a')]||null:null,'attributes':_0x49f312[_0xdc4d('0x18')]?_0x49f312[_0xdc4d('0x18')][_0xdc4d('0x1b')]||null:null,'include':_0x49f312[_0xdc4d('0x18')]?_0x49f312[_0xdc4d('0x18')][_0xdc4d('0x1d')]?_['map'](_0x49f312['options'][_0xdc4d('0x1d')],function(_0xf9c6c3){return{'model':db[_0xf9c6c3[_0xdc4d('0x1f')]],'as':_0xf9c6c3['as'],'attributes':_0xf9c6c3[_0xdc4d('0x1b')],'include':_0xf9c6c3[_0xdc4d('0x1d')]?_[_0xdc4d('0x1e')](_0xf9c6c3[_0xdc4d('0x1d')],function(_0x23aa1b){return{'model':db[_0x23aa1b[_0xdc4d('0x1f')]],'as':_0x23aa1b['as'],'attributes':_0x23aa1b['attributes'],'include':_0x23aa1b[_0xdc4d('0x1d')]?_[_0xdc4d('0x1e')](_0x23aa1b[_0xdc4d('0x1d')],function(_0x2b74c5){return{'model':db[_0x2b74c5['model']],'as':_0x2b74c5['as'],'attributes':_0x2b74c5['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc4d('0x24')](function(_0x5532a6){logger[_0xdc4d('0xe')](_0xdc4d('0x22'),_0x49f312);logger[_0xdc4d('0xf')](_0xdc4d('0x22'),_0x49f312,JSON[_0xdc4d('0x21')](_0x5532a6));_0x3bb473(_0x5532a6);})[_0xdc4d('0x16')](function(_0x40f88b){logger[_0xdc4d('0x12')](_0xdc4d('0x22'),_0x40f88b[_0xdc4d('0x15')],_0x49f312);_0x48c7b0(_0x35cab0['error'](0x1f4,_0x40f88b[_0xdc4d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c0a9be9..0a05f61 100644 --- a/server/api/mailQueue/mailQueue.socket.js +++ b/server/api/mailQueue/mailQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1468=['emit','removeListener','register','./mailQueue.events','update'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1468,0xbc));var _0x8146=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x1468[_0x18ab2a];return _0x16dcee;};'use strict';var MailQueueEvents=require(_0x8146('0x0'));var events=['save','remove',_0x8146('0x1')];function createListener(_0x5d69db,_0x18d291){return function(_0x393328){_0x18d291[_0x8146('0x2')](_0x5d69db,_0x393328);};}function removeListener(_0x45aa3d,_0x44627e){return function(){MailQueueEvents[_0x8146('0x3')](_0x45aa3d,_0x44627e);};}exports[_0x8146('0x4')]=function(_0x44cf84){for(var _0x49d669=0x0,_0x1f58e6=events['length'];_0x49d669<_0x1f58e6;_0x49d669++){var _0x3d734b=events[_0x49d669];var _0x450a9a=createListener('mailQueue:'+_0x3d734b,_0x44cf84);MailQueueEvents['on'](_0x3d734b,_0x450a9a);}}; \ No newline at end of file +var _0x1185=['save','remove','update','emit','removeListener','register','./mailQueue.events'];(function(_0x42bad2,_0x3e870b){var _0x49ef6c=function(_0x2e336a){while(--_0x2e336a){_0x42bad2['push'](_0x42bad2['shift']());}};_0x49ef6c(++_0x3e870b);}(_0x1185,0x11e));var _0x5118=function(_0x375e02,_0x218683){_0x375e02=_0x375e02-0x0;var _0x53ae3d=_0x1185[_0x375e02];return _0x53ae3d;};'use strict';var MailQueueEvents=require(_0x5118('0x0'));var events=[_0x5118('0x1'),_0x5118('0x2'),_0x5118('0x3')];function createListener(_0x4e8731,_0x229a84){return function(_0x453c1d){_0x229a84[_0x5118('0x4')](_0x4e8731,_0x453c1d);};}function removeListener(_0x223185,_0x151186){return function(){MailQueueEvents[_0x5118('0x5')](_0x223185,_0x151186);};}exports[_0x5118('0x6')]=function(_0xd86ba3){for(var _0x591789=0x0,_0x7a8d48=events['length'];_0x591789<_0x7a8d48;_0x591789++){var _0xdbc58e=events[_0x591789];var _0xd04988=createListener('mailQueue:'+_0xdbc58e,_0xd86ba3);MailQueueEvents['on'](_0xdbc58e,_0xd04988);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index eb5105f..0545bf7 100644 --- a/server/api/mailQueueReport/index.js +++ b/server/api/mailQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe886=['./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe886,0x1db));var _0x6e88=function(_0x12b7e3,_0x3bab06){_0x12b7e3=_0x12b7e3-0x0;var _0x131288=_0xe886[_0x12b7e3];return _0x131288;};'use strict';var multer=require(_0x6e88('0x0'));var util=require(_0x6e88('0x1'));var path=require(_0x6e88('0x2'));var timeout=require(_0x6e88('0x3'));var express=require('express');var router=express[_0x6e88('0x4')]();var auth=require(_0x6e88('0x5'));var interaction=require(_0x6e88('0x6'));var config=require(_0x6e88('0x7'));var controller=require(_0x6e88('0x8'));router['get']('/',auth[_0x6e88('0x9')](),controller[_0x6e88('0xa')]);router[_0x6e88('0xb')](_0x6e88('0xc'),auth['isAuthenticated'](),controller[_0x6e88('0xd')]);router[_0x6e88('0xb')](_0x6e88('0xe'),auth[_0x6e88('0x9')](),controller[_0x6e88('0xf')]);router[_0x6e88('0x10')]('/',auth[_0x6e88('0x9')](),controller[_0x6e88('0x11')]);router[_0x6e88('0x12')](_0x6e88('0xe'),auth[_0x6e88('0x9')](),controller[_0x6e88('0x13')]);router['delete'](_0x6e88('0xe'),auth[_0x6e88('0x9')](),controller['destroy']);module[_0x6e88('0x14')]=router; \ No newline at end of file +var _0xcc11=['../../config/environment','./mailQueueReport.controller','get','describe','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x53d18b,_0x1ccaf9){var _0x58f31e=function(_0x4b2733){while(--_0x4b2733){_0x53d18b['push'](_0x53d18b['shift']());}};_0x58f31e(++_0x1ccaf9);}(_0xcc11,0x162));var _0x1cc1=function(_0x5de97d,_0x1141ee){_0x5de97d=_0x5de97d-0x0;var _0x2da950=_0xcc11[_0x5de97d];return _0x2da950;};'use strict';var multer=require(_0x1cc1('0x0'));var util=require('util');var path=require(_0x1cc1('0x1'));var timeout=require('connect-timeout');var express=require(_0x1cc1('0x2'));var router=express[_0x1cc1('0x3')]();var auth=require(_0x1cc1('0x4'));var interaction=require(_0x1cc1('0x5'));var config=require(_0x1cc1('0x6'));var controller=require(_0x1cc1('0x7'));router[_0x1cc1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1cc1('0x9')]);router['get'](_0x1cc1('0xa'),auth[_0x1cc1('0xb')](),controller[_0x1cc1('0xc')]);router[_0x1cc1('0xd')]('/',auth[_0x1cc1('0xb')](),controller[_0x1cc1('0xe')]);router[_0x1cc1('0xf')](_0x1cc1('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1cc1('0x10')](_0x1cc1('0xa'),auth[_0x1cc1('0xb')](),controller['destroy']);module[_0x1cc1('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index e7b8677..d6eba7e 100644 --- a/server/api/mailQueueReport/mailQueueReport.attributes.js +++ b/server/api/mailQueueReport/mailQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a4f=['moment','exports','DATE'];(function(_0x4abc7b,_0x1cffa5){var _0x1980ce=function(_0x55cbac){while(--_0x55cbac){_0x4abc7b['push'](_0x4abc7b['shift']());}};_0x1980ce(++_0x1cffa5);}(_0x2a4f,0x1d7));var _0xf2a4=function(_0x5c62fb,_0x4f913b){_0x5c62fb=_0x5c62fb-0x0;var _0x4a8f34=_0x2a4f[_0x5c62fb];return _0x4a8f34;};'use strict';var moment=require(_0xf2a4('0x0'));var Sequelize=require('sequelize');module[_0xf2a4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf2a4('0x2')]},'leaveAt':{'type':Sequelize[_0xf2a4('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc1e=['sequelize','STRING','DATE','moment'];(function(_0x47fd17,_0x4f7037){var _0x353a4b=function(_0x16badc){while(--_0x16badc){_0x47fd17['push'](_0x47fd17['shift']());}};_0x353a4b(++_0x4f7037);}(_0xdc1e,0x1a3));var _0xedc1=function(_0x5230f1,_0x3e7346){_0x5230f1=_0x5230f1-0x0;var _0x1c0a48=_0xdc1e[_0x5230f1];return _0x1c0a48;};'use strict';var moment=require(_0xedc1('0x0'));var Sequelize=require(_0xedc1('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xedc1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xedc1('0x2')]},'joinAt':{'type':Sequelize[_0xedc1('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xedc1('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xedc1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7f37fa6..a224ab2 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d6f=['filter','options','count','includeAll','include','MailQueueReport','findAll','rows','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','pick','merge','VIRTUAL'];(function(_0x372129,_0x539547){var _0x2385b4=function(_0x17969f){while(--_0x17969f){_0x372129['push'](_0x372129['shift']());}};_0x2385b4(++_0x539547);}(_0x5d6f,0xa5));var _0xf5d6=function(_0x48bc52,_0x4634f8){_0x48bc52=_0x48bc52-0x0;var _0x6f578f=_0x5d6f[_0x48bc52];return _0x6f578f;};'use strict';var pdf=require(_0xf5d6('0x0'));var emlformat=require(_0xf5d6('0x1'));var rimraf=require(_0xf5d6('0x2'));var zipdir=require(_0xf5d6('0x3'));var jsonpatch=require(_0xf5d6('0x4'));var rp=require(_0xf5d6('0x5'));var moment=require(_0xf5d6('0x6'));var BPromise=require(_0xf5d6('0x7'));var Mustache=require(_0xf5d6('0x8'));var util=require('util');var path=require('path');var sox=require(_0xf5d6('0x9'));var csv=require(_0xf5d6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5d6('0xb'));var squel=require(_0xf5d6('0xc'));var crypto=require(_0xf5d6('0xd'));var jsforce=require(_0xf5d6('0xe'));var deskjs=require(_0xf5d6('0xf'));var toCsv=require(_0xf5d6('0xa'));var querystring=require('querystring');var Papa=require(_0xf5d6('0x10'));var Redis=require(_0xf5d6('0x11'));var authService=require(_0xf5d6('0x12'));var qs=require(_0xf5d6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5d6('0x14'));var logger=require(_0xf5d6('0x15'))('api');var utils=require(_0xf5d6('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf5d6('0x17'))['db'];function respondWithStatusCode(_0x13ab2c,_0x144403){_0x144403=_0x144403||0xcc;return function(_0xb139a1){if(_0xb139a1){return _0x13ab2c['sendStatus'](_0x144403);}return _0x13ab2c[_0xf5d6('0x18')](_0x144403)[_0xf5d6('0x19')]();};}function respondWithResult(_0x5bc629,_0x5c323d){_0x5c323d=_0x5c323d||0xc8;return function(_0x55d4c4){if(_0x55d4c4){return _0x5bc629['status'](_0x5c323d)[_0xf5d6('0x1a')](_0x55d4c4);}};}function respondWithFilteredResult(_0x2fcca9,_0xc9c1f4){return function(_0x14bc15){if(_0x14bc15){var _0x593d38=_0x14bc15['count'],_0x4e3780=_0xc9c1f4[_0xf5d6('0x1b')],_0xcf4d73=_0xc9c1f4[_0xf5d6('0x1b')]+_0xc9c1f4['limit'],_0x814f7e;if(_0xcf4d73>=_0x593d38){_0xcf4d73=_0x593d38;_0x814f7e=0xc8;}else{_0x814f7e=0xce;}_0x2fcca9[_0xf5d6('0x18')](_0x814f7e);return _0x2fcca9[_0xf5d6('0x1c')](_0xf5d6('0x1d'),_0x4e3780+'-'+_0xcf4d73+'/'+_0x593d38)[_0xf5d6('0x1a')](_0x14bc15);}return null;};}function patchUpdates(_0x9a33b6){return function(_0x7f6960){try{jsonpatch[_0xf5d6('0x1e')](_0x7f6960,_0x9a33b6,!![]);}catch(_0x1c6f57){return BPromise['reject'](_0x1c6f57);}return _0x7f6960[_0xf5d6('0x1f')]();};}function saveUpdates(_0x30259f,_0x5d43b2){return function(_0x149d27){if(_0x149d27){return _0x149d27[_0xf5d6('0x20')](_0x30259f)[_0xf5d6('0x21')](function(_0x5968d5){return _0x5968d5;});}return null;};}function removeEntity(_0x424340,_0x47b3cf){return function(_0x188bab){if(_0x188bab){return _0x188bab[_0xf5d6('0x22')]()[_0xf5d6('0x21')](function(){_0x424340[_0xf5d6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28caef,_0x2bbced){return function(_0x1d313c){if(!_0x1d313c){_0x28caef[_0xf5d6('0x23')](0x194);}return _0x1d313c;};}function handleError(_0x23e6dd,_0x1bb0c5){_0x1bb0c5=_0x1bb0c5||0x1f4;return function(_0x248d6d){logger['error'](_0x248d6d[_0xf5d6('0x24')]);if(_0x248d6d[_0xf5d6('0x25')]){delete _0x248d6d[_0xf5d6('0x25')];}_0x23e6dd[_0xf5d6('0x18')](_0x1bb0c5)[_0xf5d6('0x26')](_0x248d6d);};}exports['index']=function(_0x28b28a,_0x5f34f8){var _0x3b5252={},_0x104bc6={},_0x35e827={'count':0x0,'rows':[]};var _0x5a5f38=_[_0xf5d6('0x27')](db['MailQueueReport'][_0xf5d6('0x28')],function(_0x268406){return{'name':_0x268406[_0xf5d6('0x29')],'type':_0x268406[_0xf5d6('0x2a')][_0xf5d6('0x2b')]};});_0x104bc6['model']=_['map'](_0x5a5f38,_0xf5d6('0x25'));_0x104bc6[_0xf5d6('0x2c')]=_['keys'](_0x28b28a[_0xf5d6('0x2c')]);_0x104bc6[_0xf5d6('0x2d')]=_[_0xf5d6('0x2e')](_0x104bc6[_0xf5d6('0x2f')],_0x104bc6[_0xf5d6('0x2c')]);_0x3b5252[_0xf5d6('0x30')]=_[_0xf5d6('0x2e')](_0x104bc6[_0xf5d6('0x2f')],qs[_0xf5d6('0x31')](_0x28b28a[_0xf5d6('0x2c')]['fields']));_0x3b5252[_0xf5d6('0x30')]=_0x3b5252[_0xf5d6('0x30')]['length']?_0x3b5252[_0xf5d6('0x30')]:_0x104bc6[_0xf5d6('0x2f')];if(!_0x28b28a[_0xf5d6('0x2c')]['hasOwnProperty'](_0xf5d6('0x32'))){_0x3b5252[_0xf5d6('0x33')]=qs[_0xf5d6('0x33')](_0x28b28a['query'][_0xf5d6('0x33')]);_0x3b5252[_0xf5d6('0x1b')]=qs['offset'](_0x28b28a['query'][_0xf5d6('0x1b')]);}_0x3b5252[_0xf5d6('0x34')]=qs[_0xf5d6('0x35')](_0x28b28a['query'][_0xf5d6('0x35')]);_0x3b5252['where']=qs[_0xf5d6('0x2d')](_[_0xf5d6('0x36')](_0x28b28a['query'],_0x104bc6[_0xf5d6('0x2d')]),_0x5a5f38);if(_0x28b28a['query']['filter']){_0x3b5252['where']=_[_0xf5d6('0x37')](_0x3b5252['where'],{'$or':_['map'](_0x5a5f38,function(_0x53ee62){if(_0x53ee62[_0xf5d6('0x2a')]!==_0xf5d6('0x38')){var _0x7f531f={};_0x7f531f[_0x53ee62['name']]={'$like':'%'+_0x28b28a['query'][_0xf5d6('0x39')]+'%'};return _0x7f531f;}})});}_0x3b5252=_[_0xf5d6('0x37')]({},_0x3b5252,_0x28b28a[_0xf5d6('0x3a')]);var _0x1b41a3={'where':_0x3b5252['where']};return db['MailQueueReport'][_0xf5d6('0x3b')](_0x1b41a3)[_0xf5d6('0x21')](function(_0x2a8c21){_0x35e827[_0xf5d6('0x3b')]=_0x2a8c21;if(_0x28b28a[_0xf5d6('0x2c')][_0xf5d6('0x3c')]){_0x3b5252[_0xf5d6('0x3d')]=[{'all':!![]}];}return db[_0xf5d6('0x3e')][_0xf5d6('0x3f')](_0x3b5252);})[_0xf5d6('0x21')](function(_0x2222ff){_0x35e827[_0xf5d6('0x40')]=_0x2222ff;return _0x35e827;})['then'](respondWithFilteredResult(_0x5f34f8,_0x3b5252))[_0xf5d6('0x41')](handleError(_0x5f34f8,null));};exports[_0xf5d6('0x42')]=function(_0xdae7ee,_0x2e272a){var _0x263b17={'raw':!![],'where':{'id':_0xdae7ee[_0xf5d6('0x43')]['id']}},_0x1a4a17={};_0x1a4a17[_0xf5d6('0x2f')]=_['keys'](db['MailQueueReport']['rawAttributes']);_0x1a4a17[_0xf5d6('0x2c')]=_[_0xf5d6('0x44')](_0xdae7ee['query']);_0x1a4a17[_0xf5d6('0x2d')]=_[_0xf5d6('0x2e')](_0x1a4a17[_0xf5d6('0x2f')],_0x1a4a17[_0xf5d6('0x2c')]);_0x263b17[_0xf5d6('0x30')]=_[_0xf5d6('0x2e')](_0x1a4a17['model'],qs[_0xf5d6('0x31')](_0xdae7ee[_0xf5d6('0x2c')][_0xf5d6('0x31')]));_0x263b17[_0xf5d6('0x30')]=_0x263b17[_0xf5d6('0x30')][_0xf5d6('0x45')]?_0x263b17['attributes']:_0x1a4a17[_0xf5d6('0x2f')];if(_0xdae7ee[_0xf5d6('0x2c')][_0xf5d6('0x3c')]){_0x263b17[_0xf5d6('0x3d')]=[{'all':!![]}];}_0x263b17=_[_0xf5d6('0x37')]({},_0x263b17,_0xdae7ee[_0xf5d6('0x3a')]);return db[_0xf5d6('0x3e')][_0xf5d6('0x46')](_0x263b17)[_0xf5d6('0x21')](handleEntityNotFound(_0x2e272a,null))['then'](respondWithResult(_0x2e272a,null))['catch'](handleError(_0x2e272a,null));};exports[_0xf5d6('0x47')]=function(_0x2b6ae4,_0xfdef44){return db[_0xf5d6('0x3e')][_0xf5d6('0x47')](_0x2b6ae4['body'],{})[_0xf5d6('0x21')](respondWithResult(_0xfdef44,0xc9))[_0xf5d6('0x41')](handleError(_0xfdef44,null));};exports['update']=function(_0x138af3,_0x55e463){if(_0x138af3[_0xf5d6('0x48')]['id']){delete _0x138af3[_0xf5d6('0x48')]['id'];}return db[_0xf5d6('0x3e')][_0xf5d6('0x46')]({'where':{'id':_0x138af3[_0xf5d6('0x43')]['id']}})[_0xf5d6('0x21')](handleEntityNotFound(_0x55e463,null))[_0xf5d6('0x21')](saveUpdates(_0x138af3[_0xf5d6('0x48')],null))[_0xf5d6('0x21')](respondWithResult(_0x55e463,null))['catch'](handleError(_0x55e463,null));};exports[_0xf5d6('0x22')]=function(_0x5b315d,_0x563767){return db[_0xf5d6('0x3e')][_0xf5d6('0x46')]({'where':{'id':_0x5b315d['params']['id']}})[_0xf5d6('0x21')](handleEntityNotFound(_0x563767,null))[_0xf5d6('0x21')](removeEntity(_0x563767,null))[_0xf5d6('0x41')](handleError(_0x563767,null));};exports[_0xf5d6('0x49')]=function(_0x2e21c1,_0x44d6b3){return db['MailQueueReport'][_0xf5d6('0x49')]()['then'](respondWithResult(_0x44d6b3,null))[_0xf5d6('0x41')](handleError(_0x44d6b3,null));}; \ No newline at end of file +var _0x2cc7=['status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','map','rawAttributes','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','MailQueueReport','includeAll','include','findAll','rows','fields','options','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x3aa138,_0x3a919c){var _0x4b2974=function(_0x35c1de){while(--_0x35c1de){_0x3aa138['push'](_0x3aa138['shift']());}};_0x4b2974(++_0x3a919c);}(_0x2cc7,0x7a));var _0x72cc=function(_0x43195c,_0x174aff){_0x43195c=_0x43195c-0x0;var _0x532de1=_0x2cc7[_0x43195c];return _0x532de1;};'use strict';var pdf=require(_0x72cc('0x0'));var emlformat=require(_0x72cc('0x1'));var rimraf=require(_0x72cc('0x2'));var zipdir=require(_0x72cc('0x3'));var jsonpatch=require(_0x72cc('0x4'));var rp=require(_0x72cc('0x5'));var moment=require(_0x72cc('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x72cc('0x7'));var path=require(_0x72cc('0x8'));var sox=require(_0x72cc('0x9'));var csv=require(_0x72cc('0xa'));var ejs=require(_0x72cc('0xb'));var fs=require('fs');var _=require(_0x72cc('0xc'));var squel=require(_0x72cc('0xd'));var crypto=require(_0x72cc('0xe'));var jsforce=require(_0x72cc('0xf'));var deskjs=require(_0x72cc('0x10'));var toCsv=require(_0x72cc('0xa'));var querystring=require(_0x72cc('0x11'));var Papa=require(_0x72cc('0x12'));var Redis=require('ioredis');var authService=require(_0x72cc('0x13'));var qs=require(_0x72cc('0x14'));var as=require(_0x72cc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72cc('0x16'))('api');var utils=require(_0x72cc('0x17'));var config=require(_0x72cc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x72cc('0x19'))['db'];function respondWithStatusCode(_0x5957ba,_0x14c98b){_0x14c98b=_0x14c98b||0xcc;return function(_0x1f00a5){if(_0x1f00a5){return _0x5957ba[_0x72cc('0x1a')](_0x14c98b);}return _0x5957ba['status'](_0x14c98b)[_0x72cc('0x1b')]();};}function respondWithResult(_0x26250a,_0x584f5c){_0x584f5c=_0x584f5c||0xc8;return function(_0x503e56){if(_0x503e56){return _0x26250a[_0x72cc('0x1c')](_0x584f5c)['json'](_0x503e56);}};}function respondWithFilteredResult(_0x581b90,_0x5d036f){return function(_0x40cc15){if(_0x40cc15){var _0x29ba14=_0x40cc15[_0x72cc('0x1d')],_0x198694=_0x5d036f[_0x72cc('0x1e')],_0x35f189=_0x5d036f[_0x72cc('0x1e')]+_0x5d036f[_0x72cc('0x1f')],_0x7efc1e;if(_0x35f189>=_0x29ba14){_0x35f189=_0x29ba14;_0x7efc1e=0xc8;}else{_0x7efc1e=0xce;}_0x581b90['status'](_0x7efc1e);return _0x581b90['set'](_0x72cc('0x20'),_0x198694+'-'+_0x35f189+'/'+_0x29ba14)[_0x72cc('0x21')](_0x40cc15);}return null;};}function patchUpdates(_0x3a2b5b){return function(_0x5f0da9){try{jsonpatch[_0x72cc('0x22')](_0x5f0da9,_0x3a2b5b,!![]);}catch(_0x4ae1ab){return BPromise[_0x72cc('0x23')](_0x4ae1ab);}return _0x5f0da9[_0x72cc('0x24')]();};}function saveUpdates(_0xab1563,_0x3c9350){return function(_0xb46012){if(_0xb46012){return _0xb46012[_0x72cc('0x25')](_0xab1563)[_0x72cc('0x26')](function(_0x28ed2b){return _0x28ed2b;});}return null;};}function removeEntity(_0x210cd7,_0x432638){return function(_0x5d6716){if(_0x5d6716){return _0x5d6716[_0x72cc('0x27')]()[_0x72cc('0x26')](function(){_0x210cd7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5edd81,_0x5c2f03){return function(_0x32b922){if(!_0x32b922){_0x5edd81[_0x72cc('0x1a')](0x194);}return _0x32b922;};}function handleError(_0xf1de6c,_0x5a16bc){_0x5a16bc=_0x5a16bc||0x1f4;return function(_0x59f91a){logger['error'](_0x59f91a[_0x72cc('0x28')]);if(_0x59f91a[_0x72cc('0x29')]){delete _0x59f91a[_0x72cc('0x29')];}_0xf1de6c[_0x72cc('0x1c')](_0x5a16bc)['send'](_0x59f91a);};}exports['index']=function(_0x292b54,_0x50ed67){var _0x487ce3={},_0x36478f={},_0x18e890={'count':0x0,'rows':[]};var _0x46ef0d=_[_0x72cc('0x2a')](db['MailQueueReport'][_0x72cc('0x2b')],function(_0x292cea){return{'name':_0x292cea['fieldName'],'type':_0x292cea['type'][_0x72cc('0x2c')]};});_0x36478f['model']=_[_0x72cc('0x2a')](_0x46ef0d,_0x72cc('0x29'));_0x36478f[_0x72cc('0x2d')]=_[_0x72cc('0x2e')](_0x292b54[_0x72cc('0x2d')]);_0x36478f[_0x72cc('0x2f')]=_['intersection'](_0x36478f[_0x72cc('0x30')],_0x36478f['query']);_0x487ce3[_0x72cc('0x31')]=_[_0x72cc('0x32')](_0x36478f['model'],qs['fields'](_0x292b54[_0x72cc('0x2d')]['fields']));_0x487ce3[_0x72cc('0x31')]=_0x487ce3[_0x72cc('0x31')][_0x72cc('0x33')]?_0x487ce3['attributes']:_0x36478f[_0x72cc('0x30')];if(!_0x292b54[_0x72cc('0x2d')][_0x72cc('0x34')](_0x72cc('0x35'))){_0x487ce3[_0x72cc('0x1f')]=qs['limit'](_0x292b54[_0x72cc('0x2d')][_0x72cc('0x1f')]);_0x487ce3[_0x72cc('0x1e')]=qs[_0x72cc('0x1e')](_0x292b54[_0x72cc('0x2d')]['offset']);}_0x487ce3[_0x72cc('0x36')]=qs['sort'](_0x292b54[_0x72cc('0x2d')][_0x72cc('0x37')]);_0x487ce3[_0x72cc('0x38')]=qs[_0x72cc('0x2f')](_[_0x72cc('0x39')](_0x292b54['query'],_0x36478f['filters']),_0x46ef0d);if(_0x292b54['query'][_0x72cc('0x3a')]){_0x487ce3['where']=_['merge'](_0x487ce3[_0x72cc('0x38')],{'$or':_[_0x72cc('0x2a')](_0x46ef0d,function(_0x22be09){if(_0x22be09[_0x72cc('0x3b')]!==_0x72cc('0x3c')){var _0x13e230={};_0x13e230[_0x22be09[_0x72cc('0x29')]]={'$like':'%'+_0x292b54['query']['filter']+'%'};return _0x13e230;}})});}_0x487ce3=_[_0x72cc('0x3d')]({},_0x487ce3,_0x292b54['options']);var _0x555385={'where':_0x487ce3['where']};return db[_0x72cc('0x3e')][_0x72cc('0x1d')](_0x555385)[_0x72cc('0x26')](function(_0x12cf85){_0x18e890[_0x72cc('0x1d')]=_0x12cf85;if(_0x292b54['query'][_0x72cc('0x3f')]){_0x487ce3[_0x72cc('0x40')]=[{'all':!![]}];}return db[_0x72cc('0x3e')][_0x72cc('0x41')](_0x487ce3);})[_0x72cc('0x26')](function(_0x231d89){_0x18e890[_0x72cc('0x42')]=_0x231d89;return _0x18e890;})['then'](respondWithFilteredResult(_0x50ed67,_0x487ce3))['catch'](handleError(_0x50ed67,null));};exports['show']=function(_0x450c17,_0x40009d){var _0x353bc9={'raw':!![],'where':{'id':_0x450c17['params']['id']}},_0x295e63={};_0x295e63[_0x72cc('0x30')]=_['keys'](db[_0x72cc('0x3e')][_0x72cc('0x2b')]);_0x295e63[_0x72cc('0x2d')]=_[_0x72cc('0x2e')](_0x450c17[_0x72cc('0x2d')]);_0x295e63[_0x72cc('0x2f')]=_[_0x72cc('0x32')](_0x295e63[_0x72cc('0x30')],_0x295e63[_0x72cc('0x2d')]);_0x353bc9[_0x72cc('0x31')]=_['intersection'](_0x295e63['model'],qs[_0x72cc('0x43')](_0x450c17['query']['fields']));_0x353bc9[_0x72cc('0x31')]=_0x353bc9['attributes'][_0x72cc('0x33')]?_0x353bc9[_0x72cc('0x31')]:_0x295e63['model'];if(_0x450c17[_0x72cc('0x2d')][_0x72cc('0x3f')]){_0x353bc9[_0x72cc('0x40')]=[{'all':!![]}];}_0x353bc9=_[_0x72cc('0x3d')]({},_0x353bc9,_0x450c17[_0x72cc('0x44')]);return db[_0x72cc('0x3e')][_0x72cc('0x45')](_0x353bc9)[_0x72cc('0x26')](handleEntityNotFound(_0x40009d,null))[_0x72cc('0x26')](respondWithResult(_0x40009d,null))[_0x72cc('0x46')](handleError(_0x40009d,null));};exports['create']=function(_0x52bd16,_0x18f228){return db[_0x72cc('0x3e')][_0x72cc('0x47')](_0x52bd16[_0x72cc('0x48')],{})[_0x72cc('0x26')](respondWithResult(_0x18f228,0xc9))[_0x72cc('0x46')](handleError(_0x18f228,null));};exports[_0x72cc('0x25')]=function(_0x50e7ae,_0x9fcb5f){if(_0x50e7ae['body']['id']){delete _0x50e7ae[_0x72cc('0x48')]['id'];}return db[_0x72cc('0x3e')][_0x72cc('0x45')]({'where':{'id':_0x50e7ae[_0x72cc('0x49')]['id']}})[_0x72cc('0x26')](handleEntityNotFound(_0x9fcb5f,null))['then'](saveUpdates(_0x50e7ae[_0x72cc('0x48')],null))[_0x72cc('0x26')](respondWithResult(_0x9fcb5f,null))[_0x72cc('0x46')](handleError(_0x9fcb5f,null));};exports[_0x72cc('0x27')]=function(_0x16efd2,_0x52152a){return db[_0x72cc('0x3e')]['find']({'where':{'id':_0x16efd2[_0x72cc('0x49')]['id']}})['then'](handleEntityNotFound(_0x52152a,null))[_0x72cc('0x26')](removeEntity(_0x52152a,null))[_0x72cc('0x46')](handleError(_0x52152a,null));};exports[_0x72cc('0x4a')]=function(_0x33a52e,_0x1bd78b){return db['MailQueueReport'][_0x72cc('0x4a')]()['then'](respondWithResult(_0x1bd78b,null))[_0x72cc('0x46')](handleError(_0x1bd78b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f0655d2..d14e148 100644 --- a/server/api/mailQueueReport/mailQueueReport.model.js +++ b/server/api/mailQueueReport/mailQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c25=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c25,0x10e));var _0x57c2=function(_0x401612,_0x4b93f4){_0x401612=_0x401612-0x0;var _0x2e373a=_0x7c25[_0x401612];return _0x2e373a;};'use strict';var _=require('lodash');var util=require(_0x57c2('0x0'));var logger=require(_0x57c2('0x1'))(_0x57c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57c2('0x3'));var config=require(_0x57c2('0x4'));var attributes=require(_0x57c2('0x5'));module[_0x57c2('0x6')]=function(_0x2d2bcb,_0x97c33){return _0x2d2bcb[_0x57c2('0x7')](_0x57c2('0x8'),attributes,{'tableName':_0x57c2('0x9'),'paranoid':![],'indexes':[{'name':_0x57c2('0xa'),'fields':[_0x57c2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac22=['request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x279ab5,_0x35ab64){var _0x3d5a72=function(_0x48f8c5){while(--_0x48f8c5){_0x279ab5['push'](_0x279ab5['shift']());}};_0x3d5a72(++_0x35ab64);}(_0xac22,0x172));var _0x2ac2=function(_0x4fbf6f,_0x3aa1db){_0x4fbf6f=_0x4fbf6f-0x0;var _0x1730e9=_0xac22[_0x4fbf6f];return _0x1730e9;};'use strict';var _=require(_0x2ac2('0x0'));var util=require(_0x2ac2('0x1'));var logger=require(_0x2ac2('0x2'))(_0x2ac2('0x3'));var moment=require('moment');var BPromise=require(_0x2ac2('0x4'));var rp=require(_0x2ac2('0x5'));var fs=require('fs');var path=require(_0x2ac2('0x6'));var rimraf=require(_0x2ac2('0x7'));var config=require(_0x2ac2('0x8'));var attributes=require(_0x2ac2('0x9'));module[_0x2ac2('0xa')]=function(_0x57c3c3,_0x385015){return _0x57c3c3[_0x2ac2('0xb')](_0x2ac2('0xc'),attributes,{'tableName':_0x2ac2('0xd'),'paranoid':![],'indexes':[{'name':_0x2ac2('0xe'),'fields':[_0x2ac2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index c4591c7..bd74df1 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffed=['attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','result','MailQueueReport','create','body','options','raw','debug','CreateMailQueueReport','catch','UpdateMailQueueReport','update','where'];(function(_0xd421d7,_0x59635e){var _0x4a8eb4=function(_0x74aa1a){while(--_0x74aa1a){_0xd421d7['push'](_0xd421d7['shift']());}};_0x4a8eb4(++_0x59635e);}(_0xffed,0x18e));var _0xdffe=function(_0x240dad,_0xc1e10d){_0x240dad=_0x240dad-0x0;var _0x457e45=_0xffed[_0x240dad];return _0x457e45;};'use strict';var _=require('lodash');var util=require(_0xdffe('0x0'));var moment=require(_0xdffe('0x1'));var BPromise=require(_0xdffe('0x2'));var rs=require(_0xdffe('0x3'));var fs=require('fs');var Redis=require(_0xdffe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdffe('0x5'));var logger=require(_0xdffe('0x6'))(_0xdffe('0x7'));var config=require(_0xdffe('0x8'));var jayson=require(_0xdffe('0x9'));var client=jayson[_0xdffe('0xa')][_0xdffe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e92e1,_0x664f4f,_0x1cf431){return new BPromise(function(_0x1402a2,_0x4a7e9c){return client[_0xdffe('0xc')](_0x3e92e1,_0x1cf431)[_0xdffe('0xd')](function(_0x268998){logger[_0xdffe('0xe')]('MailQueueReport,\x20%s,\x20%s',_0x664f4f,_0xdffe('0xf'));logger['debug'](_0xdffe('0x10'),_0x664f4f,_0xdffe('0xf'),JSON[_0xdffe('0x11')](_0x268998));if(_0x268998[_0xdffe('0x12')]){if(_0x268998['error'][_0xdffe('0x13')]===0x1f4){logger[_0xdffe('0x12')](_0xdffe('0x14'),_0x664f4f,_0x268998['error'][_0xdffe('0x15')]);return _0x4a7e9c(_0x268998[_0xdffe('0x12')][_0xdffe('0x15')]);}logger[_0xdffe('0x12')](_0xdffe('0x14'),_0x664f4f,_0x268998[_0xdffe('0x12')][_0xdffe('0x15')]);return _0x1402a2(_0x268998[_0xdffe('0x12')][_0xdffe('0x15')]);}else{logger[_0xdffe('0xe')](_0xdffe('0x14'),_0x664f4f,_0xdffe('0xf'));_0x1402a2(_0x268998[_0xdffe('0x16')]['message']);}})['catch'](function(_0x5a61fe){logger[_0xdffe('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x664f4f,_0x5a61fe);_0x4a7e9c(_0x5a61fe);});});}exports['CreateMailQueueReport']=function(_0x34c698){var _0x58fc07=this;return new Promise(function(_0xe77d44,_0x56640e){return db[_0xdffe('0x17')][_0xdffe('0x18')](_0x34c698[_0xdffe('0x19')],{'raw':_0x34c698[_0xdffe('0x1a')]?_0x34c698[_0xdffe('0x1a')][_0xdffe('0x1b')]===undefined?!![]:![]:!![]})[_0xdffe('0xd')](function(_0xbe4870){logger[_0xdffe('0xe')]('CreateMailQueueReport',_0x34c698);logger[_0xdffe('0x1c')](_0xdffe('0x1d'),_0x34c698,JSON['stringify'](_0xbe4870));_0xe77d44(_0xbe4870);})[_0xdffe('0x1e')](function(_0x517ca0){logger[_0xdffe('0x12')](_0xdffe('0x1d'),_0x517ca0['message'],_0x34c698);_0x56640e(_0x58fc07[_0xdffe('0x12')](0x1f4,_0x517ca0[_0xdffe('0x15')]));});});};exports[_0xdffe('0x1f')]=function(_0x1035b0){var _0x22f7d9=this;return new Promise(function(_0x5cabd8,_0x26c3e5){return db['MailQueueReport'][_0xdffe('0x20')](_0x1035b0['body'],{'raw':_0x1035b0[_0xdffe('0x1a')]?_0x1035b0[_0xdffe('0x1a')][_0xdffe('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1035b0[_0xdffe('0x1a')]?_0x1035b0[_0xdffe('0x1a')][_0xdffe('0x21')]||null:null,'attributes':_0x1035b0[_0xdffe('0x1a')]?_0x1035b0[_0xdffe('0x1a')][_0xdffe('0x22')]||null:null,'limit':_0x1035b0[_0xdffe('0x1a')]?_0x1035b0[_0xdffe('0x1a')][_0xdffe('0x23')]||null:null})[_0xdffe('0xd')](function(_0x22ecaa){logger[_0xdffe('0xe')](_0xdffe('0x1f'),_0x1035b0);logger['debug'](_0xdffe('0x1f'),_0x1035b0,JSON[_0xdffe('0x11')](_0x22ecaa));_0x5cabd8(_0x22ecaa);})[_0xdffe('0x1e')](function(_0x41f177){logger['error'](_0xdffe('0x1f'),_0x41f177['message'],_0x1035b0);_0x26c3e5(_0x22f7d9[_0xdffe('0x12')](0x1f4,_0x41f177[_0xdffe('0x15')]));});});}; \ No newline at end of file +var _0x998d=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','MailQueueReport,\x20%s,\x20%s','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','util','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x998d,0x17e));var _0xd998=function(_0x4b07c0,_0x34e33a){_0x4b07c0=_0x4b07c0-0x0;var _0x2cdec3=_0x998d[_0x4b07c0];return _0x2cdec3;};'use strict';var _=require('lodash');var util=require(_0xd998('0x0'));var moment=require(_0xd998('0x1'));var BPromise=require(_0xd998('0x2'));var rs=require(_0xd998('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd998('0x4'))['db'];var utils=require(_0xd998('0x5'));var logger=require('../../config/logger')(_0xd998('0x6'));var config=require(_0xd998('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd998('0x8')][_0xd998('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x125e7b,_0x5dc5bb,_0x3b580a){return new BPromise(function(_0x3e8f11,_0x103ed7){return client[_0xd998('0xa')](_0x125e7b,_0x3b580a)[_0xd998('0xb')](function(_0x580de9){logger[_0xd998('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x5dc5bb,_0xd998('0xd'));logger[_0xd998('0xe')](_0xd998('0xf'),_0x5dc5bb,'request\x20sent',JSON[_0xd998('0x10')](_0x580de9));if(_0x580de9['error']){if(_0x580de9[_0xd998('0x11')]['code']===0x1f4){logger['error'](_0xd998('0x12'),_0x5dc5bb,_0x580de9[_0xd998('0x11')][_0xd998('0x13')]);return _0x103ed7(_0x580de9[_0xd998('0x11')][_0xd998('0x13')]);}logger[_0xd998('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x5dc5bb,_0x580de9['error'][_0xd998('0x13')]);return _0x3e8f11(_0x580de9[_0xd998('0x11')][_0xd998('0x13')]);}else{logger[_0xd998('0xc')](_0xd998('0x12'),_0x5dc5bb,'request\x20sent');_0x3e8f11(_0x580de9[_0xd998('0x14')][_0xd998('0x13')]);}})[_0xd998('0x15')](function(_0x1ba777){logger['error'](_0xd998('0x12'),_0x5dc5bb,_0x1ba777);_0x103ed7(_0x1ba777);});});}exports[_0xd998('0x16')]=function(_0x4564d1){var _0x303805=this;return new Promise(function(_0x34ad36,_0x330f97){return db[_0xd998('0x17')][_0xd998('0x18')](_0x4564d1[_0xd998('0x19')],{'raw':_0x4564d1['options']?_0x4564d1[_0xd998('0x1a')][_0xd998('0x1b')]===undefined?!![]:![]:!![]})[_0xd998('0xb')](function(_0x5c3fce){logger[_0xd998('0xc')](_0xd998('0x16'),_0x4564d1);logger['debug'](_0xd998('0x16'),_0x4564d1,JSON[_0xd998('0x10')](_0x5c3fce));_0x34ad36(_0x5c3fce);})[_0xd998('0x15')](function(_0x377f80){logger[_0xd998('0x11')]('CreateMailQueueReport',_0x377f80[_0xd998('0x13')],_0x4564d1);_0x330f97(_0x303805[_0xd998('0x11')](0x1f4,_0x377f80[_0xd998('0x13')]));});});};exports[_0xd998('0x1c')]=function(_0x2296aa){var _0x442418=this;return new Promise(function(_0x944080,_0x309671){return db[_0xd998('0x17')][_0xd998('0x1d')](_0x2296aa[_0xd998('0x19')],{'raw':_0x2296aa['options']?_0x2296aa['options'][_0xd998('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2296aa['options']?_0x2296aa[_0xd998('0x1a')]['where']||null:null,'attributes':_0x2296aa[_0xd998('0x1a')]?_0x2296aa[_0xd998('0x1a')][_0xd998('0x1e')]||null:null,'limit':_0x2296aa['options']?_0x2296aa[_0xd998('0x1a')][_0xd998('0x1f')]||null:null})[_0xd998('0xb')](function(_0xa2bc56){logger[_0xd998('0xc')](_0xd998('0x1c'),_0x2296aa);logger[_0xd998('0xe')]('UpdateMailQueueReport',_0x2296aa,JSON[_0xd998('0x10')](_0xa2bc56));_0x944080(_0xa2bc56);})[_0xd998('0x15')](function(_0x342175){logger[_0xd998('0x11')]('UpdateMailQueueReport',_0x342175[_0xd998('0x13')],_0x2296aa);_0x309671(_0x442418['error'](0x1f4,_0x342175[_0xd998('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e4890ad..fae37c5 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa19d=['connect-timeout','express','Router','multer','util','path'];(function(_0x1341a6,_0x23816a){var _0x37658e=function(_0xbe0a4d){while(--_0xbe0a4d){_0x1341a6['push'](_0x1341a6['shift']());}};_0x37658e(++_0x23816a);}(_0xa19d,0x19b));var _0xda19=function(_0x57e024,_0x19f926){_0x57e024=_0x57e024-0x0;var _0x468abb=_0xa19d[_0x57e024];return _0x468abb;};'use strict';var multer=require(_0xda19('0x0'));var util=require(_0xda19('0x1'));var path=require(_0xda19('0x2'));var timeout=require(_0xda19('0x3'));var express=require(_0xda19('0x4'));var router=express[_0xda19('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x7ab6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x101a1d,_0x3c1a33){var _0x5f5ef5=function(_0x402d83){while(--_0x402d83){_0x101a1d['push'](_0x101a1d['shift']());}};_0x5f5ef5(++_0x3c1a33);}(_0x7ab6,0x19b));var _0x67ab=function(_0x47852a,_0x50e312){_0x47852a=_0x47852a-0x0;var _0x28ccde=_0x7ab6[_0x47852a];return _0x28ccde;};'use strict';var multer=require(_0x67ab('0x0'));var util=require(_0x67ab('0x1'));var path=require('path');var timeout=require(_0x67ab('0x2'));var express=require(_0x67ab('0x3'));var router=express[_0x67ab('0x4')]();var auth=require(_0x67ab('0x5'));var interaction=require(_0x67ab('0x6'));var config=require(_0x67ab('0x7'));module[_0x67ab('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 175c96c..006e48d 100644 --- a/server/api/mailServerIn/mailServerIn.attributes.js +++ b/server/api/mailServerIn/mailServerIn.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe927=['STRING','INTEGER','sequelize','exports'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xe927,0xc6));var _0x7e92=function(_0x42c069,_0xdfa0f9){_0x42c069=_0x42c069-0x0;var _0x4f0740=_0xe927[_0x42c069];return _0x4f0740;};'use strict';var Sequelize=require(_0x7e92('0x0'));module[_0x7e92('0x1')]={'description':{'type':Sequelize[_0x7e92('0x2')]},'host':{'type':Sequelize[_0x7e92('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x7e92('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x7e92('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7e92('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7e92('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x7e92('0x2')]}}; \ No newline at end of file +var _0xccfc=['username','INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x13727d,_0x4df1bc){var _0x9c69a4=function(_0x4bb2c4){while(--_0x4bb2c4){_0x13727d['push'](_0x13727d['shift']());}};_0x9c69a4(++_0x4df1bc);}(_0xccfc,0x1b5));var _0xcccf=function(_0x41432a,_0x2b6d31){_0x41432a=_0x41432a-0x0;var _0x39366b=_0xccfc[_0x41432a];return _0x39366b;};'use strict';var Sequelize=require(_0xcccf('0x0'));module['exports']={'description':{'type':Sequelize[_0xcccf('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xcccf('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xcccf('0x3')},'password':{'type':Sequelize[_0xcccf('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xcccf('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xcccf('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xcccf('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xcccf('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c0a283e..f569ec3 100644 --- a/server/api/mailServerIn/mailServerIn.model.js +++ b/server/api/mailServerIn/mailServerIn.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6fa=['lodash','api','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x20f206,_0x2fab09){var _0xeaa894=function(_0x502abb){while(--_0x502abb){_0x20f206['push'](_0x20f206['shift']());}};_0xeaa894(++_0x2fab09);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xb6fa[_0x352e09];return _0x1b7094;};'use strict';var _=require(_0xab6f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xab6f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xab6f('0x2'));var fs=require('fs');var path=require(_0xab6f('0x3'));var rimraf=require('rimraf');var config=require(_0xab6f('0x4'));var attributes=require(_0xab6f('0x5'));module[_0xab6f('0x6')]=function(_0x2d9d01,_0x156df7){return _0x2d9d01[_0xab6f('0x7')](_0xab6f('0x8'),attributes,{'tableName':_0xab6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6582=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','define','MailServerIn','mail_servers_in'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6582,0x108));var _0x2658=function(_0x291c1b,_0x5216a6){_0x291c1b=_0x291c1b-0x0;var _0x2109c9=_0x6582[_0x291c1b];return _0x2109c9;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var logger=require(_0x2658('0x2'))(_0x2658('0x3'));var moment=require(_0x2658('0x4'));var BPromise=require('bluebird');var rp=require(_0x2658('0x5'));var fs=require('fs');var path=require(_0x2658('0x6'));var rimraf=require(_0x2658('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x2ef520,_0x1702bd){return _0x2ef520[_0x2658('0x8')](_0x2658('0x9'),attributes,{'tableName':_0x2658('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 9e141f5..8bf52c6 100644 --- a/server/api/mailServerIn/mailServerIn.rpc.js +++ b/server/api/mailServerIn/mailServerIn.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e0d=['model','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetMailServerIn','findAll','raw','options','attributes','include','map'];(function(_0x19d43d,_0x1889d5){var _0x4ec828=function(_0x17c928){while(--_0x17c928){_0x19d43d['push'](_0x19d43d['shift']());}};_0x4ec828(++_0x1889d5);}(_0x9e0d,0x12e));var _0xd9e0=function(_0x25839d,_0x5374e2){_0x25839d=_0x25839d-0x0;var _0x117354=_0x9e0d[_0x25839d];return _0x117354;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var moment=require('moment');var BPromise=require(_0xd9e0('0x2'));var rs=require(_0xd9e0('0x3'));var fs=require('fs');var Redis=require(_0xd9e0('0x4'));var db=require(_0xd9e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9e0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd9e0('0x7')][_0xd9e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c6805,_0x19f497,_0x3944ca){return new BPromise(function(_0x5c3e7a,_0x2adc8a){return client[_0xd9e0('0x9')](_0x3c6805,_0x3944ca)['then'](function(_0x16308f){logger[_0xd9e0('0xa')](_0xd9e0('0xb'),_0x19f497,'request\x20sent');logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x19f497,'request\x20sent',JSON[_0xd9e0('0xe')](_0x16308f));if(_0x16308f['error']){if(_0x16308f[_0xd9e0('0xf')][_0xd9e0('0x10')]===0x1f4){logger[_0xd9e0('0xf')](_0xd9e0('0xb'),_0x19f497,_0x16308f['error']['message']);return _0x2adc8a(_0x16308f[_0xd9e0('0xf')][_0xd9e0('0x11')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x19f497,_0x16308f['error'][_0xd9e0('0x11')]);return _0x5c3e7a(_0x16308f[_0xd9e0('0xf')][_0xd9e0('0x11')]);}else{logger[_0xd9e0('0xa')](_0xd9e0('0xb'),_0x19f497,_0xd9e0('0x12'));_0x5c3e7a(_0x16308f[_0xd9e0('0x13')][_0xd9e0('0x11')]);}})[_0xd9e0('0x14')](function(_0x37348a){logger[_0xd9e0('0xf')](_0xd9e0('0xb'),_0x19f497,_0x37348a);_0x2adc8a(_0x37348a);});});}exports[_0xd9e0('0x15')]=function(_0x3c7769){var _0x291576=this;return new Promise(function(_0x135d11,_0x134013){return db['MailServerIn'][_0xd9e0('0x16')]({'raw':_0x3c7769['options']?_0x3c7769['options'][_0xd9e0('0x17')]===undefined?!![]:![]:!![],'where':_0x3c7769['options']?_0x3c7769[_0xd9e0('0x18')]['where']||null:null,'attributes':_0x3c7769[_0xd9e0('0x18')]?_0x3c7769['options'][_0xd9e0('0x19')]||null:null,'limit':_0x3c7769[_0xd9e0('0x18')]?_0x3c7769[_0xd9e0('0x18')]['limit']||null:null,'include':_0x3c7769[_0xd9e0('0x18')]?_0x3c7769[_0xd9e0('0x18')][_0xd9e0('0x1a')]?_[_0xd9e0('0x1b')](_0x3c7769[_0xd9e0('0x18')][_0xd9e0('0x1a')],function(_0x4f738f){return{'model':db[_0x4f738f['model']],'as':_0x4f738f['as'],'attributes':_0x4f738f[_0xd9e0('0x19')],'include':_0x4f738f[_0xd9e0('0x1a')]?_[_0xd9e0('0x1b')](_0x4f738f['include'],function(_0xf29e7f){return{'model':db[_0xf29e7f[_0xd9e0('0x1c')]],'as':_0xf29e7f['as'],'attributes':_0xf29e7f[_0xd9e0('0x19')],'include':_0xf29e7f[_0xd9e0('0x1a')]?_[_0xd9e0('0x1b')](_0xf29e7f[_0xd9e0('0x1a')],function(_0x1e7057){return{'model':db[_0x1e7057[_0xd9e0('0x1c')]],'as':_0x1e7057['as'],'attributes':_0x1e7057[_0xd9e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd9e0('0x1d')](function(_0x48013b){logger['info'](_0xd9e0('0x15'),_0x3c7769);logger['debug'](_0xd9e0('0x15'),_0x3c7769,JSON[_0xd9e0('0xe')](_0x48013b));_0x135d11(_0x48013b);})['catch'](function(_0x116548){logger[_0xd9e0('0xf')]('GetMailServerIn',_0x116548[_0xd9e0('0x11')],_0x3c7769);_0x134013(_0x291576['error'](0x1f4,_0x116548['message']));});});}; \ No newline at end of file +var _0xbe41=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','MailServerIn','findAll','options','raw','attributes','limit','map','model','include','then','GetMailServerIn','catch','lodash'];(function(_0x180b71,_0x59ccec){var _0x57c42c=function(_0x3b7a44){while(--_0x3b7a44){_0x180b71['push'](_0x180b71['shift']());}};_0x57c42c(++_0x59ccec);}(_0xbe41,0xa4));var _0x1be4=function(_0x3781d3,_0x22ec38){_0x3781d3=_0x3781d3-0x0;var _0x1b4f55=_0xbe41[_0x3781d3];return _0x1b4f55;};'use strict';var _=require(_0x1be4('0x0'));var util=require('util');var moment=require(_0x1be4('0x1'));var BPromise=require(_0x1be4('0x2'));var rs=require(_0x1be4('0x3'));var fs=require('fs');var Redis=require(_0x1be4('0x4'));var db=require(_0x1be4('0x5'))['db'];var utils=require(_0x1be4('0x6'));var logger=require(_0x1be4('0x7'))(_0x1be4('0x8'));var config=require(_0x1be4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1be4('0xa')][_0x1be4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x161b13,_0x1d24ee,_0x2e2943){return new BPromise(function(_0x5e3299,_0x2f93d5){return client['request'](_0x161b13,_0x2e2943)['then'](function(_0x210cc6){logger[_0x1be4('0xc')](_0x1be4('0xd'),_0x1d24ee,_0x1be4('0xe'));logger[_0x1be4('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1d24ee,_0x1be4('0xe'),JSON[_0x1be4('0x10')](_0x210cc6));if(_0x210cc6['error']){if(_0x210cc6['error'][_0x1be4('0x11')]===0x1f4){logger[_0x1be4('0x12')]('MailServerIn,\x20%s,\x20%s',_0x1d24ee,_0x210cc6[_0x1be4('0x12')]['message']);return _0x2f93d5(_0x210cc6[_0x1be4('0x12')]['message']);}logger[_0x1be4('0x12')]('MailServerIn,\x20%s,\x20%s',_0x1d24ee,_0x210cc6[_0x1be4('0x12')][_0x1be4('0x13')]);return _0x5e3299(_0x210cc6[_0x1be4('0x12')]['message']);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x1d24ee,'request\x20sent');_0x5e3299(_0x210cc6[_0x1be4('0x14')]['message']);}})['catch'](function(_0x4f30c3){logger['error'](_0x1be4('0xd'),_0x1d24ee,_0x4f30c3);_0x2f93d5(_0x4f30c3);});});}exports['GetMailServerIn']=function(_0x25e510){var _0x2e60b8=this;return new Promise(function(_0x55f8c1,_0x527667){return db[_0x1be4('0x15')][_0x1be4('0x16')]({'raw':_0x25e510[_0x1be4('0x17')]?_0x25e510[_0x1be4('0x17')][_0x1be4('0x18')]===undefined?!![]:![]:!![],'where':_0x25e510['options']?_0x25e510['options']['where']||null:null,'attributes':_0x25e510[_0x1be4('0x17')]?_0x25e510[_0x1be4('0x17')][_0x1be4('0x19')]||null:null,'limit':_0x25e510['options']?_0x25e510['options'][_0x1be4('0x1a')]||null:null,'include':_0x25e510[_0x1be4('0x17')]?_0x25e510['options']['include']?_[_0x1be4('0x1b')](_0x25e510[_0x1be4('0x17')]['include'],function(_0x255710){return{'model':db[_0x255710[_0x1be4('0x1c')]],'as':_0x255710['as'],'attributes':_0x255710['attributes'],'include':_0x255710[_0x1be4('0x1d')]?_['map'](_0x255710['include'],function(_0x51f724){return{'model':db[_0x51f724['model']],'as':_0x51f724['as'],'attributes':_0x51f724['attributes'],'include':_0x51f724[_0x1be4('0x1d')]?_[_0x1be4('0x1b')](_0x51f724['include'],function(_0x468fac){return{'model':db[_0x468fac[_0x1be4('0x1c')]],'as':_0x468fac['as'],'attributes':_0x468fac[_0x1be4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1be4('0x1e')](function(_0x2ba85d){logger[_0x1be4('0xc')](_0x1be4('0x1f'),_0x25e510);logger[_0x1be4('0xf')]('GetMailServerIn',_0x25e510,JSON['stringify'](_0x2ba85d));_0x55f8c1(_0x2ba85d);})[_0x1be4('0x20')](function(_0x48c7f8){logger['error'](_0x1be4('0x1f'),_0x48c7f8[_0x1be4('0x13')],_0x25e510);_0x527667(_0x2e60b8[_0x1be4('0x12')](0x1f4,_0x48c7f8[_0x1be4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 20e3390..745447a 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe907=['isAuthenticated','index','show','post','create','/:id','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x1f6e37,_0x560390){var _0x3d17ad=function(_0x23a623){while(--_0x23a623){_0x1f6e37['push'](_0x1f6e37['shift']());}};_0x3d17ad(++_0x560390);}(_0xe907,0x80));var _0x7e90=function(_0x4329ac,_0x11ae2d){_0x4329ac=_0x4329ac-0x0;var _0x10cc20=_0xe907[_0x4329ac];return _0x10cc20;};'use strict';var multer=require('multer');var util=require(_0x7e90('0x0'));var path=require(_0x7e90('0x1'));var timeout=require(_0x7e90('0x2'));var express=require('express');var router=express[_0x7e90('0x3')]();var auth=require(_0x7e90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7e90('0x5'));var controller=require(_0x7e90('0x6'));router[_0x7e90('0x7')]('/',auth[_0x7e90('0x8')](),controller[_0x7e90('0x9')]);router[_0x7e90('0x7')]('/:id',auth[_0x7e90('0x8')](),controller[_0x7e90('0xa')]);router[_0x7e90('0xb')]('/',auth[_0x7e90('0x8')](),controller[_0x7e90('0xc')]);router['put'](_0x7e90('0xd'),auth[_0x7e90('0x8')](),controller[_0x7e90('0xe')]);router['delete'](_0x7e90('0xd'),auth[_0x7e90('0x8')](),controller[_0x7e90('0xf')]);module[_0x7e90('0x10')]=router; \ No newline at end of file +var _0x151a=['post','update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','isAuthenticated','show'];(function(_0x29c7a6,_0x1dc288){var _0x1da2a5=function(_0x38b861){while(--_0x38b861){_0x29c7a6['push'](_0x29c7a6['shift']());}};_0x1da2a5(++_0x1dc288);}(_0x151a,0x1b5));var _0xa151=function(_0x1829fd,_0x33b470){_0x1829fd=_0x1829fd-0x0;var _0x177d22=_0x151a[_0x1829fd];return _0x177d22;};'use strict';var multer=require('multer');var util=require(_0xa151('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa151('0x1')]();var auth=require(_0xa151('0x2'));var interaction=require(_0xa151('0x3'));var config=require(_0xa151('0x4'));var controller=require(_0xa151('0x5'));router[_0xa151('0x6')]('/',auth['isAuthenticated'](),controller[_0xa151('0x7')]);router['get'](_0xa151('0x8'),auth[_0xa151('0x9')](),controller[_0xa151('0xa')]);router[_0xa151('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa151('0x8'),auth[_0xa151('0x9')](),controller[_0xa151('0xc')]);router[_0xa151('0xd')](_0xa151('0x8'),auth[_0xa151('0x9')](),controller[_0xa151('0xe')]);module[_0xa151('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 11bcf7d..02017c7 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb8b=['exports','STRING','INTEGER','BOOLEAN'];(function(_0xd12dc8,_0x172a58){var _0x5f06c1=function(_0x76b33d){while(--_0x76b33d){_0xd12dc8['push'](_0xd12dc8['shift']());}};_0x5f06c1(++_0x172a58);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x55dea,_0x1110e7){_0x55dea=_0x55dea-0x0;var _0x4ff0b3=_0xdb8b[_0x55dea];return _0x4ff0b3;};'use strict';var Sequelize=require('sequelize');module[_0xbdb8('0x0')]={'description':{'type':Sequelize[_0xbdb8('0x1')]},'host':{'type':Sequelize[_0xbdb8('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xbdb8('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xbdb8('0x1')]},'authentication':{'type':Sequelize[_0xbdb8('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd916=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x5eb02f,_0xb6c40d){var _0x5db2e7=function(_0x59c2f7){while(--_0x59c2f7){_0x5eb02f['push'](_0x5eb02f['shift']());}};_0x5db2e7(++_0xb6c40d);}(_0xd916,0x18a));var _0x6d91=function(_0xbaf699,_0x4aa945){_0xbaf699=_0xbaf699-0x0;var _0x55a131=_0xd916[_0xbaf699];return _0x55a131;};'use strict';var Sequelize=require(_0x6d91('0x0'));module[_0x6d91('0x1')]={'description':{'type':Sequelize[_0x6d91('0x2')]},'host':{'type':Sequelize[_0x6d91('0x2')]},'user':{'type':Sequelize[_0x6d91('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6d91('0x3')]},'secure':{'type':Sequelize[_0x6d91('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e74aee1..58d6605 100644 --- a/server/api/mailServerOut/mailServerOut.controller.js +++ b/server/api/mailServerOut/mailServerOut.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xccec=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','save','update','then','sendStatus','error','stack','name','index','map','MailServerOut','fieldName','type','key','model','keys','intersection','fields','attributes','length','query','sort','where','filters','pick','filter','merge','options','findAll','catch','show','params','includeAll','include','find','create','body','destroy','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x487939,_0x3d173a){var _0x31e946=function(_0xf0f59a){while(--_0xf0f59a){_0x487939['push'](_0x487939['shift']());}};_0x31e946(++_0x3d173a);}(_0xccec,0xb4));var _0xccce=function(_0x5d8d18,_0x341ad4){_0x5d8d18=_0x5d8d18-0x0;var _0x12cbb5=_0xccec[_0x5d8d18];return _0x12cbb5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xccce('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xccce('0x1'));var moment=require(_0xccce('0x2'));var BPromise=require(_0xccce('0x3'));var Mustache=require(_0xccce('0x4'));var util=require(_0xccce('0x5'));var path=require(_0xccce('0x6'));var sox=require('sox');var csv=require(_0xccce('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xccce('0x8'));var squel=require(_0xccce('0x9'));var crypto=require(_0xccce('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xccce('0xb'));var toCsv=require(_0xccce('0x7'));var querystring=require(_0xccce('0xc'));var Papa=require(_0xccce('0xd'));var Redis=require(_0xccce('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xccce('0xf'));var as=require(_0xccce('0x10'));var hardwareService=require(_0xccce('0x11'));var logger=require(_0xccce('0x12'))('api');var utils=require(_0xccce('0x13'));var config=require(_0xccce('0x14'));var licenseUtil=require(_0xccce('0x15'));var db=require(_0xccce('0x16'))['db'];function respondWithStatusCode(_0x35383f,_0x665a34){_0x665a34=_0x665a34||0xcc;return function(_0x203a12){if(_0x203a12){return _0x35383f['sendStatus'](_0x665a34);}return _0x35383f['status'](_0x665a34)[_0xccce('0x17')]();};}function respondWithResult(_0x140c27,_0x66a3d5){_0x66a3d5=_0x66a3d5||0xc8;return function(_0x58aa18){if(_0x58aa18){return _0x140c27[_0xccce('0x18')](_0x66a3d5)[_0xccce('0x19')](_0x58aa18);}};}function respondWithFilteredResult(_0x121a40,_0x4c7b1a){return function(_0xe1eb0e){if(_0xe1eb0e){var _0x43c5d8=_0xe1eb0e[_0xccce('0x1a')],_0x8c8dcf=_0x4c7b1a[_0xccce('0x1b')],_0x2648d8=_0x4c7b1a['offset']+_0x4c7b1a[_0xccce('0x1c')],_0x782256;if(_0x2648d8>=_0x43c5d8){_0x2648d8=_0x43c5d8;_0x782256=0xc8;}else{_0x782256=0xce;}_0x121a40['status'](_0x782256);return _0x121a40['set']('Content-Range',_0x8c8dcf+'-'+_0x2648d8+'/'+_0x43c5d8)[_0xccce('0x19')](_0xe1eb0e);}return null;};}function patchUpdates(_0x14e60b){return function(_0x58ed79){try{jsonpatch['apply'](_0x58ed79,_0x14e60b,!![]);}catch(_0x4d9931){return BPromise['reject'](_0x4d9931);}return _0x58ed79[_0xccce('0x1d')]();};}function saveUpdates(_0x54f6a8,_0x40e6a3){return function(_0x3b38e8){if(_0x3b38e8){return _0x3b38e8[_0xccce('0x1e')](_0x54f6a8)[_0xccce('0x1f')](function(_0x281ada){return _0x281ada;});}return null;};}function removeEntity(_0x125889,_0x354096){return function(_0x4fad01){if(_0x4fad01){return _0x4fad01['destroy']()[_0xccce('0x1f')](function(){_0x125889[_0xccce('0x18')](0xcc)[_0xccce('0x17')]();});}};}function handleEntityNotFound(_0x1cd36f,_0x40ee43){return function(_0x193536){if(!_0x193536){_0x1cd36f[_0xccce('0x20')](0x194);}return _0x193536;};}function handleError(_0x18650b,_0x31c539){_0x31c539=_0x31c539||0x1f4;return function(_0x469790){logger[_0xccce('0x21')](_0x469790[_0xccce('0x22')]);if(_0x469790[_0xccce('0x23')]){delete _0x469790[_0xccce('0x23')];}_0x18650b['status'](_0x31c539)['send'](_0x469790);};}exports[_0xccce('0x24')]=function(_0x1803d2,_0x5d0a9b){var _0x393572={},_0xcd71d3={},_0x579bfb={'count':0x0,'rows':[]};var _0xcad77b=_[_0xccce('0x25')](db[_0xccce('0x26')]['rawAttributes'],function(_0x1531e6){return{'name':_0x1531e6[_0xccce('0x27')],'type':_0x1531e6[_0xccce('0x28')][_0xccce('0x29')]};});_0xcd71d3[_0xccce('0x2a')]=_['map'](_0xcad77b,_0xccce('0x23'));_0xcd71d3['query']=_[_0xccce('0x2b')](_0x1803d2['query']);_0xcd71d3['filters']=_[_0xccce('0x2c')](_0xcd71d3['model'],_0xcd71d3['query']);_0x393572['attributes']=_[_0xccce('0x2c')](_0xcd71d3[_0xccce('0x2a')],qs[_0xccce('0x2d')](_0x1803d2['query'][_0xccce('0x2d')]));_0x393572[_0xccce('0x2e')]=_0x393572[_0xccce('0x2e')][_0xccce('0x2f')]?_0x393572[_0xccce('0x2e')]:_0xcd71d3[_0xccce('0x2a')];if(!_0x1803d2['query']['hasOwnProperty']('nolimit')){_0x393572[_0xccce('0x1c')]=qs[_0xccce('0x1c')](_0x1803d2[_0xccce('0x30')][_0xccce('0x1c')]);_0x393572[_0xccce('0x1b')]=qs[_0xccce('0x1b')](_0x1803d2['query'][_0xccce('0x1b')]);}_0x393572['order']=qs[_0xccce('0x31')](_0x1803d2[_0xccce('0x30')][_0xccce('0x31')]);_0x393572[_0xccce('0x32')]=qs[_0xccce('0x33')](_[_0xccce('0x34')](_0x1803d2[_0xccce('0x30')],_0xcd71d3[_0xccce('0x33')]),_0xcad77b);if(_0x1803d2[_0xccce('0x30')][_0xccce('0x35')]){_0x393572['where']=_[_0xccce('0x36')](_0x393572[_0xccce('0x32')],{'$or':_['map'](_0xcad77b,function(_0x395ddc){if(_0x395ddc['type']!=='VIRTUAL'){var _0xca259f={};_0xca259f[_0x395ddc[_0xccce('0x23')]]={'$like':'%'+_0x1803d2[_0xccce('0x30')][_0xccce('0x35')]+'%'};return _0xca259f;}})});}_0x393572=_[_0xccce('0x36')]({},_0x393572,_0x1803d2[_0xccce('0x37')]);var _0x2c3e55={'where':_0x393572['where']};return db[_0xccce('0x26')][_0xccce('0x1a')](_0x2c3e55)[_0xccce('0x1f')](function(_0x23be60){_0x579bfb[_0xccce('0x1a')]=_0x23be60;if(_0x1803d2[_0xccce('0x30')]['includeAll']){_0x393572['include']=[{'all':!![]}];}return db[_0xccce('0x26')][_0xccce('0x38')](_0x393572);})[_0xccce('0x1f')](function(_0x4bee48){_0x579bfb['rows']=_0x4bee48;return _0x579bfb;})[_0xccce('0x1f')](respondWithFilteredResult(_0x5d0a9b,_0x393572))[_0xccce('0x39')](handleError(_0x5d0a9b,null));};exports[_0xccce('0x3a')]=function(_0x179a9c,_0x22f400){var _0x44f913={'raw':!![],'where':{'id':_0x179a9c[_0xccce('0x3b')]['id']}},_0x36ee61={};_0x36ee61[_0xccce('0x2a')]=_[_0xccce('0x2b')](db[_0xccce('0x26')]['rawAttributes']);_0x36ee61['query']=_[_0xccce('0x2b')](_0x179a9c[_0xccce('0x30')]);_0x36ee61[_0xccce('0x33')]=_['intersection'](_0x36ee61[_0xccce('0x2a')],_0x36ee61[_0xccce('0x30')]);_0x44f913[_0xccce('0x2e')]=_[_0xccce('0x2c')](_0x36ee61[_0xccce('0x2a')],qs['fields'](_0x179a9c[_0xccce('0x30')][_0xccce('0x2d')]));_0x44f913[_0xccce('0x2e')]=_0x44f913[_0xccce('0x2e')]['length']?_0x44f913[_0xccce('0x2e')]:_0x36ee61[_0xccce('0x2a')];if(_0x179a9c[_0xccce('0x30')][_0xccce('0x3c')]){_0x44f913[_0xccce('0x3d')]=[{'all':!![]}];}_0x44f913=_[_0xccce('0x36')]({},_0x44f913,_0x179a9c[_0xccce('0x37')]);return db[_0xccce('0x26')][_0xccce('0x3e')](_0x44f913)[_0xccce('0x1f')](handleEntityNotFound(_0x22f400,null))[_0xccce('0x1f')](respondWithResult(_0x22f400,null))[_0xccce('0x39')](handleError(_0x22f400,null));};exports[_0xccce('0x3f')]=function(_0x246dac,_0x143c71){return db[_0xccce('0x26')][_0xccce('0x3f')](_0x246dac[_0xccce('0x40')],{})[_0xccce('0x1f')](respondWithResult(_0x143c71,0xc9))[_0xccce('0x39')](handleError(_0x143c71,null));};exports[_0xccce('0x1e')]=function(_0x286528,_0x2366a){if(_0x286528[_0xccce('0x40')]['id']){delete _0x286528[_0xccce('0x40')]['id'];}return db[_0xccce('0x26')][_0xccce('0x3e')]({'where':{'id':_0x286528[_0xccce('0x3b')]['id']}})[_0xccce('0x1f')](handleEntityNotFound(_0x2366a,null))[_0xccce('0x1f')](saveUpdates(_0x286528[_0xccce('0x40')],null))['then'](respondWithResult(_0x2366a,null))[_0xccce('0x39')](handleError(_0x2366a,null));};exports[_0xccce('0x41')]=function(_0xf28ba3,_0x3cde26){return db[_0xccce('0x26')][_0xccce('0x3e')]({'where':{'id':_0xf28ba3[_0xccce('0x3b')]['id']}})[_0xccce('0x1f')](handleEntityNotFound(_0x3cde26,null))[_0xccce('0x1f')](removeEntity(_0x3cde26,null))[_0xccce('0x39')](handleError(_0x3cde26,null));}; \ No newline at end of file +var _0xb8f1=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailServerOut','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb8f1,0x8a));var _0x1b8f=function(_0x1368e0,_0x1241d4){_0x1368e0=_0x1368e0-0x0;var _0x37a764=_0xb8f1[_0x1368e0];return _0x37a764;};'use strict';var pdf=require(_0x1b8f('0x0'));var emlformat=require(_0x1b8f('0x1'));var rimraf=require(_0x1b8f('0x2'));var zipdir=require(_0x1b8f('0x3'));var jsonpatch=require(_0x1b8f('0x4'));var rp=require('request-promise');var moment=require(_0x1b8f('0x5'));var BPromise=require(_0x1b8f('0x6'));var Mustache=require(_0x1b8f('0x7'));var util=require(_0x1b8f('0x8'));var path=require('path');var sox=require(_0x1b8f('0x9'));var csv=require(_0x1b8f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b8f('0xb'));var squel=require(_0x1b8f('0xc'));var crypto=require('crypto');var jsforce=require(_0x1b8f('0xd'));var deskjs=require(_0x1b8f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1b8f('0xf'));var Papa=require(_0x1b8f('0x10'));var Redis=require(_0x1b8f('0x11'));var authService=require(_0x1b8f('0x12'));var qs=require(_0x1b8f('0x13'));var as=require(_0x1b8f('0x14'));var hardwareService=require(_0x1b8f('0x15'));var logger=require('../../config/logger')(_0x1b8f('0x16'));var utils=require(_0x1b8f('0x17'));var config=require(_0x1b8f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52504a,_0x269b78){_0x269b78=_0x269b78||0xcc;return function(_0xfe87cd){if(_0xfe87cd){return _0x52504a[_0x1b8f('0x19')](_0x269b78);}return _0x52504a[_0x1b8f('0x1a')](_0x269b78)[_0x1b8f('0x1b')]();};}function respondWithResult(_0x2bac20,_0x3618a7){_0x3618a7=_0x3618a7||0xc8;return function(_0x56f64c){if(_0x56f64c){return _0x2bac20[_0x1b8f('0x1a')](_0x3618a7)[_0x1b8f('0x1c')](_0x56f64c);}};}function respondWithFilteredResult(_0x332cfd,_0x3577b9){return function(_0x157b73){if(_0x157b73){var _0x2b3afa=_0x157b73[_0x1b8f('0x1d')],_0x3eccd9=_0x3577b9[_0x1b8f('0x1e')],_0x3f5ddf=_0x3577b9[_0x1b8f('0x1e')]+_0x3577b9[_0x1b8f('0x1f')],_0x3d4eca;if(_0x3f5ddf>=_0x2b3afa){_0x3f5ddf=_0x2b3afa;_0x3d4eca=0xc8;}else{_0x3d4eca=0xce;}_0x332cfd[_0x1b8f('0x1a')](_0x3d4eca);return _0x332cfd[_0x1b8f('0x20')](_0x1b8f('0x21'),_0x3eccd9+'-'+_0x3f5ddf+'/'+_0x2b3afa)['json'](_0x157b73);}return null;};}function patchUpdates(_0x23a14a){return function(_0x488c1a){try{jsonpatch[_0x1b8f('0x22')](_0x488c1a,_0x23a14a,!![]);}catch(_0x408459){return BPromise[_0x1b8f('0x23')](_0x408459);}return _0x488c1a[_0x1b8f('0x24')]();};}function saveUpdates(_0x5a0ac4,_0x4edc17){return function(_0x4b8a9b){if(_0x4b8a9b){return _0x4b8a9b[_0x1b8f('0x25')](_0x5a0ac4)[_0x1b8f('0x26')](function(_0x68dabd){return _0x68dabd;});}return null;};}function removeEntity(_0x4b5bde,_0x1f37c3){return function(_0x3c9b56){if(_0x3c9b56){return _0x3c9b56[_0x1b8f('0x27')]()[_0x1b8f('0x26')](function(){_0x4b5bde['status'](0xcc)[_0x1b8f('0x1b')]();});}};}function handleEntityNotFound(_0x2f9575,_0x4fd18f){return function(_0x3c1f8b){if(!_0x3c1f8b){_0x2f9575[_0x1b8f('0x19')](0x194);}return _0x3c1f8b;};}function handleError(_0xb0a0b0,_0x107a2d){_0x107a2d=_0x107a2d||0x1f4;return function(_0x250894){logger['error'](_0x250894[_0x1b8f('0x28')]);if(_0x250894[_0x1b8f('0x29')]){delete _0x250894[_0x1b8f('0x29')];}_0xb0a0b0[_0x1b8f('0x1a')](_0x107a2d)[_0x1b8f('0x2a')](_0x250894);};}exports[_0x1b8f('0x2b')]=function(_0x370fa1,_0x4b9f4e){var _0xb4594e={},_0x2a46d4={},_0x872faf={'count':0x0,'rows':[]};var _0x5150c1=_[_0x1b8f('0x2c')](db[_0x1b8f('0x2d')]['rawAttributes'],function(_0x3539c4){return{'name':_0x3539c4[_0x1b8f('0x2e')],'type':_0x3539c4[_0x1b8f('0x2f')][_0x1b8f('0x30')]};});_0x2a46d4['model']=_[_0x1b8f('0x2c')](_0x5150c1,_0x1b8f('0x29'));_0x2a46d4['query']=_[_0x1b8f('0x31')](_0x370fa1[_0x1b8f('0x32')]);_0x2a46d4[_0x1b8f('0x33')]=_[_0x1b8f('0x34')](_0x2a46d4[_0x1b8f('0x35')],_0x2a46d4['query']);_0xb4594e[_0x1b8f('0x36')]=_['intersection'](_0x2a46d4[_0x1b8f('0x35')],qs['fields'](_0x370fa1['query'][_0x1b8f('0x37')]));_0xb4594e[_0x1b8f('0x36')]=_0xb4594e['attributes'][_0x1b8f('0x38')]?_0xb4594e[_0x1b8f('0x36')]:_0x2a46d4['model'];if(!_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x39')](_0x1b8f('0x3a'))){_0xb4594e[_0x1b8f('0x1f')]=qs[_0x1b8f('0x1f')](_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x1f')]);_0xb4594e['offset']=qs[_0x1b8f('0x1e')](_0x370fa1[_0x1b8f('0x32')]['offset']);}_0xb4594e[_0x1b8f('0x3b')]=qs[_0x1b8f('0x3c')](_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x3c')]);_0xb4594e['where']=qs[_0x1b8f('0x33')](_[_0x1b8f('0x3d')](_0x370fa1['query'],_0x2a46d4['filters']),_0x5150c1);if(_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x3e')]){_0xb4594e[_0x1b8f('0x3f')]=_[_0x1b8f('0x40')](_0xb4594e['where'],{'$or':_['map'](_0x5150c1,function(_0x598faa){if(_0x598faa['type']!=='VIRTUAL'){var _0x464c98={};_0x464c98[_0x598faa[_0x1b8f('0x29')]]={'$like':'%'+_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x3e')]+'%'};return _0x464c98;}})});}_0xb4594e=_['merge']({},_0xb4594e,_0x370fa1['options']);var _0x1d3110={'where':_0xb4594e[_0x1b8f('0x3f')]};return db[_0x1b8f('0x2d')][_0x1b8f('0x1d')](_0x1d3110)[_0x1b8f('0x26')](function(_0x43fce2){_0x872faf['count']=_0x43fce2;if(_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x41')]){_0xb4594e[_0x1b8f('0x42')]=[{'all':!![]}];}return db[_0x1b8f('0x2d')][_0x1b8f('0x43')](_0xb4594e);})[_0x1b8f('0x26')](function(_0x342a55){_0x872faf['rows']=_0x342a55;return _0x872faf;})[_0x1b8f('0x26')](respondWithFilteredResult(_0x4b9f4e,_0xb4594e))[_0x1b8f('0x44')](handleError(_0x4b9f4e,null));};exports[_0x1b8f('0x45')]=function(_0x282b88,_0x91f43){var _0x256d93={'raw':!![],'where':{'id':_0x282b88[_0x1b8f('0x46')]['id']}},_0x2b95eb={};_0x2b95eb[_0x1b8f('0x35')]=_[_0x1b8f('0x31')](db['MailServerOut']['rawAttributes']);_0x2b95eb[_0x1b8f('0x32')]=_[_0x1b8f('0x31')](_0x282b88[_0x1b8f('0x32')]);_0x2b95eb['filters']=_[_0x1b8f('0x34')](_0x2b95eb[_0x1b8f('0x35')],_0x2b95eb[_0x1b8f('0x32')]);_0x256d93[_0x1b8f('0x36')]=_['intersection'](_0x2b95eb[_0x1b8f('0x35')],qs[_0x1b8f('0x37')](_0x282b88['query']['fields']));_0x256d93[_0x1b8f('0x36')]=_0x256d93[_0x1b8f('0x36')][_0x1b8f('0x38')]?_0x256d93[_0x1b8f('0x36')]:_0x2b95eb['model'];if(_0x282b88['query'][_0x1b8f('0x41')]){_0x256d93['include']=[{'all':!![]}];}_0x256d93=_['merge']({},_0x256d93,_0x282b88[_0x1b8f('0x47')]);return db[_0x1b8f('0x2d')]['find'](_0x256d93)[_0x1b8f('0x26')](handleEntityNotFound(_0x91f43,null))[_0x1b8f('0x26')](respondWithResult(_0x91f43,null))[_0x1b8f('0x44')](handleError(_0x91f43,null));};exports[_0x1b8f('0x48')]=function(_0x1caed8,_0x4aff65){return db[_0x1b8f('0x2d')][_0x1b8f('0x48')](_0x1caed8[_0x1b8f('0x49')],{})[_0x1b8f('0x26')](respondWithResult(_0x4aff65,0xc9))[_0x1b8f('0x44')](handleError(_0x4aff65,null));};exports[_0x1b8f('0x25')]=function(_0x527f8f,_0x854a46){if(_0x527f8f[_0x1b8f('0x49')]['id']){delete _0x527f8f[_0x1b8f('0x49')]['id'];}return db[_0x1b8f('0x2d')][_0x1b8f('0x4a')]({'where':{'id':_0x527f8f[_0x1b8f('0x46')]['id']}})[_0x1b8f('0x26')](handleEntityNotFound(_0x854a46,null))[_0x1b8f('0x26')](saveUpdates(_0x527f8f[_0x1b8f('0x49')],null))[_0x1b8f('0x26')](respondWithResult(_0x854a46,null))[_0x1b8f('0x44')](handleError(_0x854a46,null));};exports[_0x1b8f('0x27')]=function(_0x18faa4,_0x11457a){return db[_0x1b8f('0x2d')]['find']({'where':{'id':_0x18faa4[_0x1b8f('0x46')]['id']}})[_0x1b8f('0x26')](handleEntityNotFound(_0x11457a,null))['then'](removeEntity(_0x11457a,null))[_0x1b8f('0x44')](handleError(_0x11457a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 47cfba3..a64d5bf 100644 --- a/server/api/mailServerOut/mailServerOut.model.js +++ b/server/api/mailServerOut/mailServerOut.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x54567d,_0x2a6a71){var _0x45d71c=function(_0x7c3e43){while(--_0x7c3e43){_0x54567d['push'](_0x54567d['shift']());}};_0x45d71c(++_0x2a6a71);}(_0x24ca,0x1bc));var _0xa24c=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x24ca[_0x39cd3c];return _0x47a0ae;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util'];(function(_0x32237e,_0x1bf4bd){var _0x3b73ff=function(_0x165ad9){while(--_0x165ad9){_0x32237e['push'](_0x32237e['shift']());}};_0x3b73ff(++_0x1bf4bd);}(_0xf494,0x1c6));var _0x4f49=function(_0x1a7eb3,_0x23bf97){_0x1a7eb3=_0x1a7eb3-0x0;var _0x19e176=_0xf494[_0x1a7eb3];return _0x19e176;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 22d8d0c..3736583 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba29=['../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x5e1fb6,_0xf3495b){var _0x2cf20e=function(_0x4e51b4){while(--_0x4e51b4){_0x5e1fb6['push'](_0x5e1fb6['shift']());}};_0x2cf20e(++_0xf3495b);}(_0xba29,0x134));var _0x9ba2=function(_0x3b54ad,_0x3e9ddf){_0x3b54ad=_0x3b54ad-0x0;var _0x15dcbc=_0xba29[_0x3b54ad];return _0x15dcbc;};'use strict';var _=require(_0x9ba2('0x0'));var util=require(_0x9ba2('0x1'));var moment=require(_0x9ba2('0x2'));var BPromise=require(_0x9ba2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ba2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ba2('0x5'))(_0x9ba2('0x6'));var config=require(_0x9ba2('0x7'));var jayson=require(_0x9ba2('0x8'));var client=jayson[_0x9ba2('0x9')][_0x9ba2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c4444,_0x55c631,_0x5f0a68){return new BPromise(function(_0x24e44d,_0x321de7){return client[_0x9ba2('0xb')](_0x2c4444,_0x5f0a68)[_0x9ba2('0xc')](function(_0x49e222){logger[_0x9ba2('0xd')](_0x9ba2('0xe'),_0x55c631,'request\x20sent');logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x55c631,_0x9ba2('0xf'),JSON[_0x9ba2('0x10')](_0x49e222));if(_0x49e222[_0x9ba2('0x11')]){if(_0x49e222[_0x9ba2('0x11')][_0x9ba2('0x12')]===0x1f4){logger[_0x9ba2('0x11')]('MailServerOut,\x20%s,\x20%s',_0x55c631,_0x49e222[_0x9ba2('0x11')][_0x9ba2('0x13')]);return _0x321de7(_0x49e222[_0x9ba2('0x11')][_0x9ba2('0x13')]);}logger[_0x9ba2('0x11')](_0x9ba2('0xe'),_0x55c631,_0x49e222[_0x9ba2('0x11')][_0x9ba2('0x13')]);return _0x24e44d(_0x49e222['error']['message']);}else{logger[_0x9ba2('0xd')](_0x9ba2('0xe'),_0x55c631,_0x9ba2('0xf'));_0x24e44d(_0x49e222[_0x9ba2('0x14')]['message']);}})['catch'](function(_0x5f0ed4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x55c631,_0x5f0ed4);_0x321de7(_0x5f0ed4);});});} \ No newline at end of file +var _0xa0dd=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xa0dd,0x15e));var _0xda0d=function(_0x44a710,_0x3f9200){_0x44a710=_0x44a710-0x0;var _0x5e970f=_0xa0dd[_0x44a710];return _0x5e970f;};'use strict';var _=require('lodash');var util=require(_0xda0d('0x0'));var moment=require(_0xda0d('0x1'));var BPromise=require(_0xda0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda0d('0x3'))['db'];var utils=require(_0xda0d('0x4'));var logger=require(_0xda0d('0x5'))(_0xda0d('0x6'));var config=require(_0xda0d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xda0d('0x8')][_0xda0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17def0,_0x37e4c1,_0x49ed6e){return new BPromise(function(_0x2c71a6,_0x1022ab){return client[_0xda0d('0xa')](_0x17def0,_0x49ed6e)[_0xda0d('0xb')](function(_0x4ac824){logger[_0xda0d('0xc')](_0xda0d('0xd'),_0x37e4c1,_0xda0d('0xe'));logger[_0xda0d('0xf')](_0xda0d('0x10'),_0x37e4c1,_0xda0d('0xe'),JSON[_0xda0d('0x11')](_0x4ac824));if(_0x4ac824[_0xda0d('0x12')]){if(_0x4ac824[_0xda0d('0x12')][_0xda0d('0x13')]===0x1f4){logger[_0xda0d('0x12')](_0xda0d('0xd'),_0x37e4c1,_0x4ac824[_0xda0d('0x12')][_0xda0d('0x14')]);return _0x1022ab(_0x4ac824['error'][_0xda0d('0x14')]);}logger[_0xda0d('0x12')](_0xda0d('0xd'),_0x37e4c1,_0x4ac824['error'][_0xda0d('0x14')]);return _0x2c71a6(_0x4ac824[_0xda0d('0x12')][_0xda0d('0x14')]);}else{logger[_0xda0d('0xc')](_0xda0d('0xd'),_0x37e4c1,'request\x20sent');_0x2c71a6(_0x4ac824['result'][_0xda0d('0x14')]);}})[_0xda0d('0x15')](function(_0x4b642a){logger[_0xda0d('0x12')](_0xda0d('0xd'),_0x37e4c1,_0x4b642a);_0x1022ab(_0x4b642a);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2e18508..e7c9301 100644 --- a/server/api/mailSubstatus/index.js +++ b/server/api/mailSubstatus/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4fb=['../../components/interaction/service','./mailSubstatus.controller','get','index','/describe','isAuthenticated','show','post','delete','/:id','exports','connect-timeout','express','Router'];(function(_0x23a8ec,_0x3ddb28){var _0x2b2ce1=function(_0x598832){while(--_0x598832){_0x23a8ec['push'](_0x23a8ec['shift']());}};_0x2b2ce1(++_0x3ddb28);}(_0xc4fb,0x6d));var _0xbc4f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc4fb[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbc4f('0x0'));var express=require(_0xbc4f('0x1'));var router=express[_0xbc4f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xbc4f('0x3'));var config=require('../../config/environment');var controller=require(_0xbc4f('0x4'));router[_0xbc4f('0x5')]('/',auth['isAuthenticated'](),controller[_0xbc4f('0x6')]);router['get'](_0xbc4f('0x7'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbc4f('0x8')](),controller[_0xbc4f('0x9')]);router[_0xbc4f('0xa')]('/',auth[_0xbc4f('0x8')](),controller['create']);router['put']('/:id',auth[_0xbc4f('0x8')](),controller['update']);router[_0xbc4f('0xb')](_0xbc4f('0xc'),auth[_0xbc4f('0x8')](),controller['destroy']);module[_0xbc4f('0xd')]=router; \ No newline at end of file +var _0x92c4=['exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x1df0bb,_0x251c51){var _0x41a310=function(_0x4744c1){while(--_0x4744c1){_0x1df0bb['push'](_0x1df0bb['shift']());}};_0x41a310(++_0x251c51);}(_0x92c4,0x9a));var _0x492c=function(_0x4e944a,_0x54f6e0){_0x4e944a=_0x4e944a-0x0;var _0x2f81e2=_0x92c4[_0x4e944a];return _0x2f81e2;};'use strict';var multer=require('multer');var util=require(_0x492c('0x0'));var path=require('path');var timeout=require(_0x492c('0x1'));var express=require(_0x492c('0x2'));var router=express['Router']();var auth=require(_0x492c('0x3'));var interaction=require(_0x492c('0x4'));var config=require(_0x492c('0x5'));var controller=require(_0x492c('0x6'));router[_0x492c('0x7')]('/',auth['isAuthenticated'](),controller[_0x492c('0x8')]);router[_0x492c('0x7')]('/describe',auth[_0x492c('0x9')](),controller['describe']);router[_0x492c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x492c('0xa')]);router[_0x492c('0xb')]('/',auth[_0x492c('0x9')](),controller[_0x492c('0xc')]);router[_0x492c('0xd')](_0x492c('0xe'),auth[_0x492c('0x9')](),controller[_0x492c('0xf')]);router['delete'](_0x492c('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x492c('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9adc898..81c3fc4 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e82=['exports','STRING','name','sequelize'];(function(_0x259611,_0x460c3e){var _0x36c061=function(_0x261bcf){while(--_0x261bcf){_0x259611['push'](_0x259611['shift']());}};_0x36c061(++_0x460c3e);}(_0x1e82,0x8b));var _0x21e8=function(_0x48c6a7,_0x4b84bb){_0x48c6a7=_0x48c6a7-0x0;var _0x4a32f7=_0x1e82[_0x48c6a7];return _0x4a32f7;};'use strict';var Sequelize=require(_0x21e8('0x0'));module[_0x21e8('0x1')]={'name':{'type':Sequelize[_0x21e8('0x2')],'unique':_0x21e8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x21e8('0x2')]}}; \ No newline at end of file +var _0x39d2=['STRING','name','sequelize'];(function(_0x1dbf88,_0x5e01bb){var _0x3066c2=function(_0x30fb32){while(--_0x30fb32){_0x1dbf88['push'](_0x1dbf88['shift']());}};_0x3066c2(++_0x5e01bb);}(_0x39d2,0xf5));var _0x239d=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x39d2[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x239d('0x0'));module['exports']={'name':{'type':Sequelize[_0x239d('0x1')],'unique':_0x239d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x239d('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 072915c..bdd845d 100644 --- a/server/api/mailSubstatus/mailSubstatus.controller.js +++ b/server/api/mailSubstatus/mailSubstatus.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71c9=['intersection','attributes','fields','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','catch','params','rawAttributes','options','find','create','update','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','MailSubstatus','fieldName','type','key','model','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71c9,0x1dc));var _0x971c=function(_0x47a087,_0x31eeb0){_0x47a087=_0x47a087-0x0;var _0x23afd3=_0x71c9[_0x47a087];return _0x23afd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x971c('0x0'));var rimraf=require(_0x971c('0x1'));var zipdir=require(_0x971c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x971c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x971c('0x4'));var util=require(_0x971c('0x5'));var path=require(_0x971c('0x6'));var sox=require(_0x971c('0x7'));var csv=require('to-csv');var ejs=require(_0x971c('0x8'));var fs=require('fs');var _=require(_0x971c('0x9'));var squel=require(_0x971c('0xa'));var crypto=require(_0x971c('0xb'));var jsforce=require(_0x971c('0xc'));var deskjs=require(_0x971c('0xd'));var toCsv=require(_0x971c('0xe'));var querystring=require(_0x971c('0xf'));var Papa=require(_0x971c('0x10'));var Redis=require('ioredis');var authService=require(_0x971c('0x11'));var qs=require(_0x971c('0x12'));var as=require(_0x971c('0x13'));var hardwareService=require(_0x971c('0x14'));var logger=require(_0x971c('0x15'))(_0x971c('0x16'));var utils=require(_0x971c('0x17'));var config=require(_0x971c('0x18'));var licenseUtil=require(_0x971c('0x19'));var db=require(_0x971c('0x1a'))['db'];function respondWithStatusCode(_0xab44c8,_0x5cbc54){_0x5cbc54=_0x5cbc54||0xcc;return function(_0x1c9a5a){if(_0x1c9a5a){return _0xab44c8['sendStatus'](_0x5cbc54);}return _0xab44c8[_0x971c('0x1b')](_0x5cbc54)[_0x971c('0x1c')]();};}function respondWithResult(_0xf57603,_0x2d8e8d){_0x2d8e8d=_0x2d8e8d||0xc8;return function(_0x50c7d5){if(_0x50c7d5){return _0xf57603[_0x971c('0x1b')](_0x2d8e8d)[_0x971c('0x1d')](_0x50c7d5);}};}function respondWithFilteredResult(_0x10b07c,_0x55c344){return function(_0x54f359){if(_0x54f359){var _0x4e5c66=_0x54f359['count'],_0x297ac7=_0x55c344['offset'],_0x3a4ae1=_0x55c344[_0x971c('0x1e')]+_0x55c344['limit'],_0x40b354;if(_0x3a4ae1>=_0x4e5c66){_0x3a4ae1=_0x4e5c66;_0x40b354=0xc8;}else{_0x40b354=0xce;}_0x10b07c[_0x971c('0x1b')](_0x40b354);return _0x10b07c[_0x971c('0x1f')](_0x971c('0x20'),_0x297ac7+'-'+_0x3a4ae1+'/'+_0x4e5c66)[_0x971c('0x1d')](_0x54f359);}return null;};}function patchUpdates(_0x49d8cf){return function(_0x3a9aa8){try{jsonpatch[_0x971c('0x21')](_0x3a9aa8,_0x49d8cf,!![]);}catch(_0x3fe55b){return BPromise[_0x971c('0x22')](_0x3fe55b);}return _0x3a9aa8[_0x971c('0x23')]();};}function saveUpdates(_0x2349ec,_0x103b0e){return function(_0x4906a4){if(_0x4906a4){return _0x4906a4['update'](_0x2349ec)[_0x971c('0x24')](function(_0x5dee38){return _0x5dee38;});}return null;};}function removeEntity(_0x173670,_0x1005e9){return function(_0x4638f6){if(_0x4638f6){return _0x4638f6[_0x971c('0x25')]()[_0x971c('0x24')](function(){_0x173670[_0x971c('0x1b')](0xcc)[_0x971c('0x1c')]();});}};}function handleEntityNotFound(_0x482125,_0xd5293c){return function(_0x3fc762){if(!_0x3fc762){_0x482125['sendStatus'](0x194);}return _0x3fc762;};}function handleError(_0x2866d1,_0x21cf3e){_0x21cf3e=_0x21cf3e||0x1f4;return function(_0x64eaef){logger[_0x971c('0x26')](_0x64eaef['stack']);if(_0x64eaef[_0x971c('0x27')]){delete _0x64eaef[_0x971c('0x27')];}_0x2866d1['status'](_0x21cf3e)['send'](_0x64eaef);};}exports[_0x971c('0x28')]=function(_0x5f25ef,_0x4b6304){var _0xbf69c9={},_0xf0c73f={},_0x2dbe67={'count':0x0,'rows':[]};var _0x26a25d=_[_0x971c('0x29')](db[_0x971c('0x2a')]['rawAttributes'],function(_0x1b3073){return{'name':_0x1b3073[_0x971c('0x2b')],'type':_0x1b3073[_0x971c('0x2c')][_0x971c('0x2d')]};});_0xf0c73f[_0x971c('0x2e')]=_[_0x971c('0x29')](_0x26a25d,_0x971c('0x27'));_0xf0c73f['query']=_[_0x971c('0x2f')](_0x5f25ef['query']);_0xf0c73f[_0x971c('0x30')]=_[_0x971c('0x31')](_0xf0c73f['model'],_0xf0c73f['query']);_0xbf69c9[_0x971c('0x32')]=_[_0x971c('0x31')](_0xf0c73f[_0x971c('0x2e')],qs[_0x971c('0x33')](_0x5f25ef[_0x971c('0x34')][_0x971c('0x33')]));_0xbf69c9['attributes']=_0xbf69c9[_0x971c('0x32')]['length']?_0xbf69c9[_0x971c('0x32')]:_0xf0c73f['model'];if(!_0x5f25ef[_0x971c('0x34')][_0x971c('0x35')](_0x971c('0x36'))){_0xbf69c9['limit']=qs[_0x971c('0x37')](_0x5f25ef[_0x971c('0x34')][_0x971c('0x37')]);_0xbf69c9[_0x971c('0x1e')]=qs[_0x971c('0x1e')](_0x5f25ef['query']['offset']);}_0xbf69c9[_0x971c('0x38')]=qs['sort'](_0x5f25ef['query'][_0x971c('0x39')]);_0xbf69c9[_0x971c('0x3a')]=qs[_0x971c('0x30')](_[_0x971c('0x3b')](_0x5f25ef[_0x971c('0x34')],_0xf0c73f[_0x971c('0x30')]),_0x26a25d);if(_0x5f25ef[_0x971c('0x34')][_0x971c('0x3c')]){_0xbf69c9[_0x971c('0x3a')]=_[_0x971c('0x3d')](_0xbf69c9[_0x971c('0x3a')],{'$or':_[_0x971c('0x29')](_0x26a25d,function(_0x5e8de5){if(_0x5e8de5[_0x971c('0x2c')]!==_0x971c('0x3e')){var _0x17684d={};_0x17684d[_0x5e8de5[_0x971c('0x27')]]={'$like':'%'+_0x5f25ef['query'][_0x971c('0x3c')]+'%'};return _0x17684d;}})});}_0xbf69c9=_[_0x971c('0x3d')]({},_0xbf69c9,_0x5f25ef['options']);var _0x27d3ee={'where':_0xbf69c9[_0x971c('0x3a')]};return db['MailSubstatus'][_0x971c('0x3f')](_0x27d3ee)['then'](function(_0x39a327){_0x2dbe67[_0x971c('0x3f')]=_0x39a327;if(_0x5f25ef['query']['includeAll']){_0xbf69c9[_0x971c('0x40')]=[{'all':!![]}];}return db['MailSubstatus'][_0x971c('0x41')](_0xbf69c9);})['then'](function(_0xa468e7){_0x2dbe67['rows']=_0xa468e7;return _0x2dbe67;})[_0x971c('0x24')](respondWithFilteredResult(_0x4b6304,_0xbf69c9))[_0x971c('0x42')](handleError(_0x4b6304,null));};exports['show']=function(_0x50237d,_0x59a0cf){var _0x26cd55={'raw':!![],'where':{'id':_0x50237d[_0x971c('0x43')]['id']}},_0x2bf86d={};_0x2bf86d[_0x971c('0x2e')]=_[_0x971c('0x2f')](db[_0x971c('0x2a')][_0x971c('0x44')]);_0x2bf86d['query']=_[_0x971c('0x2f')](_0x50237d[_0x971c('0x34')]);_0x2bf86d[_0x971c('0x30')]=_[_0x971c('0x31')](_0x2bf86d['model'],_0x2bf86d['query']);_0x26cd55[_0x971c('0x32')]=_['intersection'](_0x2bf86d[_0x971c('0x2e')],qs[_0x971c('0x33')](_0x50237d[_0x971c('0x34')][_0x971c('0x33')]));_0x26cd55[_0x971c('0x32')]=_0x26cd55[_0x971c('0x32')]['length']?_0x26cd55[_0x971c('0x32')]:_0x2bf86d[_0x971c('0x2e')];if(_0x50237d[_0x971c('0x34')]['includeAll']){_0x26cd55['include']=[{'all':!![]}];}_0x26cd55=_[_0x971c('0x3d')]({},_0x26cd55,_0x50237d[_0x971c('0x45')]);return db['MailSubstatus'][_0x971c('0x46')](_0x26cd55)[_0x971c('0x24')](handleEntityNotFound(_0x59a0cf,null))['then'](respondWithResult(_0x59a0cf,null))['catch'](handleError(_0x59a0cf,null));};exports[_0x971c('0x47')]=function(_0x3f4693,_0x2fb8b6){return db[_0x971c('0x2a')][_0x971c('0x47')](_0x3f4693['body'],{})[_0x971c('0x24')](respondWithResult(_0x2fb8b6,0xc9))[_0x971c('0x42')](handleError(_0x2fb8b6,null));};exports[_0x971c('0x48')]=function(_0x2e358d,_0x6078f8){if(_0x2e358d[_0x971c('0x49')]['id']){delete _0x2e358d[_0x971c('0x49')]['id'];}return db[_0x971c('0x2a')][_0x971c('0x46')]({'where':{'id':_0x2e358d[_0x971c('0x43')]['id']}})[_0x971c('0x24')](handleEntityNotFound(_0x6078f8,null))[_0x971c('0x24')](saveUpdates(_0x2e358d['body'],null))[_0x971c('0x24')](respondWithResult(_0x6078f8,null))['catch'](handleError(_0x6078f8,null));};exports['destroy']=function(_0x548c82,_0x3847cc){return db[_0x971c('0x2a')][_0x971c('0x46')]({'where':{'id':_0x548c82[_0x971c('0x43')]['id']}})[_0x971c('0x24')](handleEntityNotFound(_0x3847cc,null))[_0x971c('0x24')](removeEntity(_0x3847cc,null))[_0x971c('0x42')](handleError(_0x3847cc,null));};exports[_0x971c('0x4a')]=function(_0x195902,_0x2394b5){return db[_0x971c('0x2a')]['describe']()[_0x971c('0x24')](respondWithResult(_0x2394b5,null))[_0x971c('0x42')](handleError(_0x2394b5,null));}; \ No newline at end of file +var _0x83bd=['stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','include','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error'];(function(_0x3ea4b1,_0x1c59b4){var _0x4fec31=function(_0x55fc7c){while(--_0x55fc7c){_0x3ea4b1['push'](_0x3ea4b1['shift']());}};_0x4fec31(++_0x1c59b4);}(_0x83bd,0x1ed));var _0xd83b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x83bd[_0x5bd426];return _0x23a7eb;};'use strict';var pdf=require(_0xd83b('0x0'));var emlformat=require(_0xd83b('0x1'));var rimraf=require(_0xd83b('0x2'));var zipdir=require(_0xd83b('0x3'));var jsonpatch=require(_0xd83b('0x4'));var rp=require(_0xd83b('0x5'));var moment=require(_0xd83b('0x6'));var BPromise=require(_0xd83b('0x7'));var Mustache=require(_0xd83b('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd83b('0x9'));var csv=require(_0xd83b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd83b('0xb'));var squel=require('squel');var crypto=require(_0xd83b('0xc'));var jsforce=require(_0xd83b('0xd'));var deskjs=require(_0xd83b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd83b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd83b('0x10'));var as=require(_0xd83b('0x11'));var hardwareService=require(_0xd83b('0x12'));var logger=require(_0xd83b('0x13'))(_0xd83b('0x14'));var utils=require(_0xd83b('0x15'));var config=require(_0xd83b('0x16'));var licenseUtil=require(_0xd83b('0x17'));var db=require(_0xd83b('0x18'))['db'];function respondWithStatusCode(_0x2cceda,_0x100182){_0x100182=_0x100182||0xcc;return function(_0x287505){if(_0x287505){return _0x2cceda[_0xd83b('0x19')](_0x100182);}return _0x2cceda[_0xd83b('0x1a')](_0x100182)[_0xd83b('0x1b')]();};}function respondWithResult(_0x4f52f8,_0x2fff09){_0x2fff09=_0x2fff09||0xc8;return function(_0xa32312){if(_0xa32312){return _0x4f52f8['status'](_0x2fff09)[_0xd83b('0x1c')](_0xa32312);}};}function respondWithFilteredResult(_0x1e493b,_0x2fef5d){return function(_0x4d8e7b){if(_0x4d8e7b){var _0x297288=_0x4d8e7b[_0xd83b('0x1d')],_0x916d32=_0x2fef5d['offset'],_0x5c374b=_0x2fef5d[_0xd83b('0x1e')]+_0x2fef5d[_0xd83b('0x1f')],_0x2cc4d4;if(_0x5c374b>=_0x297288){_0x5c374b=_0x297288;_0x2cc4d4=0xc8;}else{_0x2cc4d4=0xce;}_0x1e493b['status'](_0x2cc4d4);return _0x1e493b[_0xd83b('0x20')]('Content-Range',_0x916d32+'-'+_0x5c374b+'/'+_0x297288)[_0xd83b('0x1c')](_0x4d8e7b);}return null;};}function patchUpdates(_0x47dad4){return function(_0x39ec33){try{jsonpatch['apply'](_0x39ec33,_0x47dad4,!![]);}catch(_0x5f12c6){return BPromise[_0xd83b('0x21')](_0x5f12c6);}return _0x39ec33[_0xd83b('0x22')]();};}function saveUpdates(_0xcbdee4,_0x26ae9a){return function(_0x313837){if(_0x313837){return _0x313837[_0xd83b('0x23')](_0xcbdee4)[_0xd83b('0x24')](function(_0x54f4ad){return _0x54f4ad;});}return null;};}function removeEntity(_0x1ab0d9,_0xfb64d9){return function(_0x31d23a){if(_0x31d23a){return _0x31d23a[_0xd83b('0x25')]()['then'](function(){_0x1ab0d9[_0xd83b('0x1a')](0xcc)[_0xd83b('0x1b')]();});}};}function handleEntityNotFound(_0x2111cb,_0x4657c0){return function(_0x4946e3){if(!_0x4946e3){_0x2111cb[_0xd83b('0x19')](0x194);}return _0x4946e3;};}function handleError(_0x1c101b,_0x41edb3){_0x41edb3=_0x41edb3||0x1f4;return function(_0x2a4ae2){logger[_0xd83b('0x26')](_0x2a4ae2[_0xd83b('0x27')]);if(_0x2a4ae2['name']){delete _0x2a4ae2[_0xd83b('0x28')];}_0x1c101b[_0xd83b('0x1a')](_0x41edb3)[_0xd83b('0x29')](_0x2a4ae2);};}exports[_0xd83b('0x2a')]=function(_0x13f2f2,_0x5b1161){var _0x4b17b1={},_0x5c9c5a={},_0x185825={'count':0x0,'rows':[]};var _0x5f439d=_['map'](db[_0xd83b('0x2b')][_0xd83b('0x2c')],function(_0x33b4fb){return{'name':_0x33b4fb[_0xd83b('0x2d')],'type':_0x33b4fb[_0xd83b('0x2e')][_0xd83b('0x2f')]};});_0x5c9c5a[_0xd83b('0x30')]=_[_0xd83b('0x31')](_0x5f439d,_0xd83b('0x28'));_0x5c9c5a[_0xd83b('0x32')]=_['keys'](_0x13f2f2['query']);_0x5c9c5a[_0xd83b('0x33')]=_[_0xd83b('0x34')](_0x5c9c5a[_0xd83b('0x30')],_0x5c9c5a[_0xd83b('0x32')]);_0x4b17b1[_0xd83b('0x35')]=_[_0xd83b('0x34')](_0x5c9c5a[_0xd83b('0x30')],qs[_0xd83b('0x36')](_0x13f2f2[_0xd83b('0x32')]['fields']));_0x4b17b1[_0xd83b('0x35')]=_0x4b17b1['attributes'][_0xd83b('0x37')]?_0x4b17b1[_0xd83b('0x35')]:_0x5c9c5a[_0xd83b('0x30')];if(!_0x13f2f2[_0xd83b('0x32')]['hasOwnProperty'](_0xd83b('0x38'))){_0x4b17b1[_0xd83b('0x1f')]=qs['limit'](_0x13f2f2[_0xd83b('0x32')][_0xd83b('0x1f')]);_0x4b17b1['offset']=qs[_0xd83b('0x1e')](_0x13f2f2['query'][_0xd83b('0x1e')]);}_0x4b17b1[_0xd83b('0x39')]=qs[_0xd83b('0x3a')](_0x13f2f2[_0xd83b('0x32')][_0xd83b('0x3a')]);_0x4b17b1[_0xd83b('0x3b')]=qs['filters'](_[_0xd83b('0x3c')](_0x13f2f2['query'],_0x5c9c5a['filters']),_0x5f439d);if(_0x13f2f2[_0xd83b('0x32')]['filter']){_0x4b17b1['where']=_[_0xd83b('0x3d')](_0x4b17b1[_0xd83b('0x3b')],{'$or':_[_0xd83b('0x31')](_0x5f439d,function(_0x6f8393){if(_0x6f8393[_0xd83b('0x2e')]!==_0xd83b('0x3e')){var _0x1ef732={};_0x1ef732[_0x6f8393['name']]={'$like':'%'+_0x13f2f2[_0xd83b('0x32')][_0xd83b('0x3f')]+'%'};return _0x1ef732;}})});}_0x4b17b1=_[_0xd83b('0x3d')]({},_0x4b17b1,_0x13f2f2['options']);var _0x5e829a={'where':_0x4b17b1[_0xd83b('0x3b')]};return db[_0xd83b('0x2b')][_0xd83b('0x1d')](_0x5e829a)[_0xd83b('0x24')](function(_0x3c1f66){_0x185825['count']=_0x3c1f66;if(_0x13f2f2[_0xd83b('0x32')]['includeAll']){_0x4b17b1['include']=[{'all':!![]}];}return db[_0xd83b('0x2b')][_0xd83b('0x40')](_0x4b17b1);})[_0xd83b('0x24')](function(_0x19b382){_0x185825[_0xd83b('0x41')]=_0x19b382;return _0x185825;})[_0xd83b('0x24')](respondWithFilteredResult(_0x5b1161,_0x4b17b1))[_0xd83b('0x42')](handleError(_0x5b1161,null));};exports[_0xd83b('0x43')]=function(_0x197b28,_0x160563){var _0x4cf143={'raw':!![],'where':{'id':_0x197b28['params']['id']}},_0xc18fc4={};_0xc18fc4[_0xd83b('0x30')]=_[_0xd83b('0x44')](db[_0xd83b('0x2b')][_0xd83b('0x2c')]);_0xc18fc4[_0xd83b('0x32')]=_[_0xd83b('0x44')](_0x197b28['query']);_0xc18fc4['filters']=_[_0xd83b('0x34')](_0xc18fc4[_0xd83b('0x30')],_0xc18fc4[_0xd83b('0x32')]);_0x4cf143['attributes']=_[_0xd83b('0x34')](_0xc18fc4[_0xd83b('0x30')],qs[_0xd83b('0x36')](_0x197b28['query'][_0xd83b('0x36')]));_0x4cf143[_0xd83b('0x35')]=_0x4cf143[_0xd83b('0x35')]['length']?_0x4cf143[_0xd83b('0x35')]:_0xc18fc4['model'];if(_0x197b28['query']['includeAll']){_0x4cf143[_0xd83b('0x45')]=[{'all':!![]}];}_0x4cf143=_[_0xd83b('0x3d')]({},_0x4cf143,_0x197b28[_0xd83b('0x46')]);return db[_0xd83b('0x2b')][_0xd83b('0x47')](_0x4cf143)[_0xd83b('0x24')](handleEntityNotFound(_0x160563,null))[_0xd83b('0x24')](respondWithResult(_0x160563,null))[_0xd83b('0x42')](handleError(_0x160563,null));};exports[_0xd83b('0x48')]=function(_0x19d5f8,_0x401e5f){return db[_0xd83b('0x2b')][_0xd83b('0x48')](_0x19d5f8[_0xd83b('0x49')],{})[_0xd83b('0x24')](respondWithResult(_0x401e5f,0xc9))[_0xd83b('0x42')](handleError(_0x401e5f,null));};exports['update']=function(_0x56c504,_0x1b76a3){if(_0x56c504[_0xd83b('0x49')]['id']){delete _0x56c504['body']['id'];}return db[_0xd83b('0x2b')][_0xd83b('0x47')]({'where':{'id':_0x56c504[_0xd83b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b76a3,null))[_0xd83b('0x24')](saveUpdates(_0x56c504[_0xd83b('0x49')],null))[_0xd83b('0x24')](respondWithResult(_0x1b76a3,null))[_0xd83b('0x42')](handleError(_0x1b76a3,null));};exports['destroy']=function(_0x556d6e,_0x4cd300){return db[_0xd83b('0x2b')][_0xd83b('0x47')]({'where':{'id':_0x556d6e[_0xd83b('0x4a')]['id']}})[_0xd83b('0x24')](handleEntityNotFound(_0x4cd300,null))[_0xd83b('0x24')](removeEntity(_0x4cd300,null))['catch'](handleError(_0x4cd300,null));};exports[_0xd83b('0x4b')]=function(_0xd398de,_0x7e0cb7){return db['MailSubstatus'][_0xd83b('0x4b')]()[_0xd83b('0x24')](respondWithResult(_0x7e0cb7,null))['catch'](handleError(_0x7e0cb7,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index b339ecf..362bc90 100644 --- a/server/api/mailSubstatus/mailSubstatus.model.js +++ b/server/api/mailSubstatus/mailSubstatus.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe511=['bluebird','request-promise','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','lodash','util','api'];(function(_0x50ea20,_0x1221d6){var _0x498b59=function(_0x15100f){while(--_0x15100f){_0x50ea20['push'](_0x50ea20['shift']());}};_0x498b59(++_0x1221d6);}(_0xe511,0x16f));var _0x1e51=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0xe511[_0x1aeda2];return _0x32dc6d;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed3c=['util','../../config/logger','api','bluebird','request-promise','path','./mailSubstatus.attributes','exports','lodash'];(function(_0x2a1203,_0x20ddf0){var _0x44f4c8=function(_0x16c15a){while(--_0x16c15a){_0x2a1203['push'](_0x2a1203['shift']());}};_0x44f4c8(++_0x20ddf0);}(_0xed3c,0x1a6));var _0xced3=function(_0x4095b9,_0x17ac01){_0x4095b9=_0x4095b9-0x0;var _0x3f6909=_0xed3c[_0x4095b9];return _0x3f6909;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index fd68adb..e7ca90f 100644 --- a/server/api/mailSubstatus/mailSubstatus.rpc.js +++ b/server/api/mailSubstatus/mailSubstatus.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x750a=['error','code','MailSubstatus,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x14ba21,_0x47f566){var _0x1a84dc=function(_0x1dab2a){while(--_0x1dab2a){_0x14ba21['push'](_0x14ba21['shift']());}};_0x1a84dc(++_0x47f566);}(_0x750a,0x140));var _0xa750=function(_0x1f5c1b,_0x3ca8d3){_0x1f5c1b=_0x1f5c1b-0x0;var _0x56c9c2=_0x750a[_0x1f5c1b];return _0x56c9c2;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});} \ No newline at end of file +var _0x5ff3=['message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','MailSubstatus,\x20%s,\x20%s'];(function(_0xd1903e,_0xb833fa){var _0x1e0df7=function(_0x2004e8){while(--_0x2004e8){_0xd1903e['push'](_0xd1903e['shift']());}};_0x1e0df7(++_0xb833fa);}(_0x5ff3,0x17d));var _0x35ff=function(_0xfb5562,_0x146be){_0xfb5562=_0xfb5562-0x0;var _0x53e37e=_0x5ff3[_0xfb5562];return _0x53e37e;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 809aff0..6ff69fe 100644 --- a/server/api/mailTransferReport/index.js +++ b/server/api/mailTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bbb=['/describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x102a47,_0x1de836){var _0x54065c=function(_0x368335){while(--_0x368335){_0x102a47['push'](_0x102a47['shift']());}};_0x54065c(++_0x1de836);}(_0x3bbb,0x1bd));var _0xb3bb=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x3bbb[_0x3207aa];return _0x51758f;};'use strict';var multer=require(_0xb3bb('0x0'));var util=require(_0xb3bb('0x1'));var path=require(_0xb3bb('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3bb('0x3'));var router=express[_0xb3bb('0x4')]();var auth=require(_0xb3bb('0x5'));var interaction=require(_0xb3bb('0x6'));var config=require('../../config/environment');var controller=require(_0xb3bb('0x7'));router[_0xb3bb('0x8')]('/',auth[_0xb3bb('0x9')](),controller[_0xb3bb('0xa')]);router[_0xb3bb('0x8')](_0xb3bb('0xb'),auth[_0xb3bb('0x9')](),controller['describe']);router[_0xb3bb('0x8')](_0xb3bb('0xc'),auth[_0xb3bb('0x9')](),controller['show']);router[_0xb3bb('0xd')]('/',auth[_0xb3bb('0x9')](),controller[_0xb3bb('0xe')]);router['put'](_0xb3bb('0xc'),auth[_0xb3bb('0x9')](),controller[_0xb3bb('0xf')]);router[_0xb3bb('0x10')](_0xb3bb('0xc'),auth['isAuthenticated'](),controller[_0xb3bb('0x11')]);module[_0xb3bb('0x12')]=router; \ No newline at end of file +var _0xc67f=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','put','update'];(function(_0x1f2204,_0x2c6d0f){var _0x35439e=function(_0x4ef2e3){while(--_0x4ef2e3){_0x1f2204['push'](_0x1f2204['shift']());}};_0x35439e(++_0x2c6d0f);}(_0xc67f,0xdb));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfc67('0x0'));var util=require(_0xfc67('0x1'));var path=require(_0xfc67('0x2'));var timeout=require(_0xfc67('0x3'));var express=require('express');var router=express[_0xfc67('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfc67('0x5'));var controller=require(_0xfc67('0x6'));router[_0xfc67('0x7')]('/',auth[_0xfc67('0x8')](),controller[_0xfc67('0x9')]);router[_0xfc67('0x7')]('/describe',auth[_0xfc67('0x8')](),controller[_0xfc67('0xa')]);router[_0xfc67('0x7')](_0xfc67('0xb'),auth[_0xfc67('0x8')](),controller[_0xfc67('0xc')]);router['post']('/',auth[_0xfc67('0x8')](),controller['create']);router[_0xfc67('0xd')](_0xfc67('0xb'),auth[_0xfc67('0x8')](),controller[_0xfc67('0xe')]);router[_0xfc67('0xf')]('/:id',auth[_0xfc67('0x8')](),controller[_0xfc67('0x10')]);module[_0xfc67('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 4609ad8..2b7dabd 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x502b=['ENUM','account','queue','DATE','NOW','moment','STRING'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x502b,0x83));var _0xb502=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x502b[_0x416cdc];return _0x1931ce;};'use strict';var moment=require(_0xb502('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb502('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb502('0x2')](_0xb502('0x3'),'agent',_0xb502('0x4')),'allowNull':![],'defaultValue':_0xb502('0x4')},'transferredAt':{'type':Sequelize[_0xb502('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xb502('0x6')]}}; \ No newline at end of file +var _0x59ad=['queue','DATE','NOW','moment','exports','STRING','ENUM','agent'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0x59ad,0xc3));var _0xd59a=function(_0x4813d4,_0x2fa3ce){_0x4813d4=_0x4813d4-0x0;var _0x1d6425=_0x59ad[_0x4813d4];return _0x1d6425;};'use strict';var moment=require(_0xd59a('0x0'));var Sequelize=require('sequelize');module[_0xd59a('0x1')]={'uniqueid':{'type':Sequelize[_0xd59a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd59a('0x3')]('account',_0xd59a('0x4'),_0xd59a('0x5')),'allowNull':![],'defaultValue':_0xd59a('0x5')},'transferredAt':{'type':Sequelize[_0xd59a('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xd59a('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 62c0be8..a202b21 100644 --- a/server/api/mailTransferReport/mailTransferReport.controller.js +++ b/server/api/mailTransferReport/mailTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5a2=['map','VIRTUAL','filter','options','findAll','show','params','rawAttributes','include','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','json','count','offset','set','Content-Range','save','update','then','destroy','end','sendStatus','error','name','send','index','MailTransferReport','fieldName','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge'];(function(_0x19a8d0,_0x22d91e){var _0x1e1dc8=function(_0x1acd88){while(--_0x1acd88){_0x19a8d0['push'](_0x19a8d0['shift']());}};_0x1e1dc8(++_0x22d91e);}(_0xe5a2,0x98));var _0x2e5a=function(_0xb2f216,_0x4f9c9e){_0xb2f216=_0xb2f216-0x0;var _0x43f996=_0xe5a2[_0xb2f216];return _0x43f996;};'use strict';var pdf=require(_0x2e5a('0x0'));var emlformat=require(_0x2e5a('0x1'));var rimraf=require(_0x2e5a('0x2'));var zipdir=require(_0x2e5a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2e5a('0x4'));var Mustache=require(_0x2e5a('0x5'));var util=require(_0x2e5a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2e5a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2e5a('0x8'));var squel=require(_0x2e5a('0x9'));var crypto=require('crypto');var jsforce=require(_0x2e5a('0xa'));var deskjs=require(_0x2e5a('0xb'));var toCsv=require(_0x2e5a('0x7'));var querystring=require(_0x2e5a('0xc'));var Papa=require('papaparse');var Redis=require(_0x2e5a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2e5a('0xe'));var as=require(_0x2e5a('0xf'));var hardwareService=require(_0x2e5a('0x10'));var logger=require('../../config/logger')(_0x2e5a('0x11'));var utils=require(_0x2e5a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2e5a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51be77,_0x565930){_0x565930=_0x565930||0xcc;return function(_0x431806){if(_0x431806){return _0x51be77['sendStatus'](_0x565930);}return _0x51be77[_0x2e5a('0x14')](_0x565930)['end']();};}function respondWithResult(_0x35389f,_0x4d3955){_0x4d3955=_0x4d3955||0xc8;return function(_0x55683b){if(_0x55683b){return _0x35389f[_0x2e5a('0x14')](_0x4d3955)[_0x2e5a('0x15')](_0x55683b);}};}function respondWithFilteredResult(_0x32ac4b,_0x5727b2){return function(_0x33d65b){if(_0x33d65b){var _0xea48b4=_0x33d65b[_0x2e5a('0x16')],_0x3c1119=_0x5727b2[_0x2e5a('0x17')],_0xf84490=_0x5727b2['offset']+_0x5727b2['limit'],_0x163137;if(_0xf84490>=_0xea48b4){_0xf84490=_0xea48b4;_0x163137=0xc8;}else{_0x163137=0xce;}_0x32ac4b[_0x2e5a('0x14')](_0x163137);return _0x32ac4b[_0x2e5a('0x18')](_0x2e5a('0x19'),_0x3c1119+'-'+_0xf84490+'/'+_0xea48b4)['json'](_0x33d65b);}return null;};}function patchUpdates(_0x16095d){return function(_0x4b89ce){try{jsonpatch['apply'](_0x4b89ce,_0x16095d,!![]);}catch(_0x11471a){return BPromise['reject'](_0x11471a);}return _0x4b89ce[_0x2e5a('0x1a')]();};}function saveUpdates(_0x24e818,_0x345698){return function(_0x26c64b){if(_0x26c64b){return _0x26c64b[_0x2e5a('0x1b')](_0x24e818)[_0x2e5a('0x1c')](function(_0xf4786d){return _0xf4786d;});}return null;};}function removeEntity(_0x1551b2,_0x4229db){return function(_0x243ae2){if(_0x243ae2){return _0x243ae2[_0x2e5a('0x1d')]()['then'](function(){_0x1551b2[_0x2e5a('0x14')](0xcc)[_0x2e5a('0x1e')]();});}};}function handleEntityNotFound(_0x28518f,_0x33df1e){return function(_0x474ad4){if(!_0x474ad4){_0x28518f[_0x2e5a('0x1f')](0x194);}return _0x474ad4;};}function handleError(_0x3ae0f1,_0x38f778){_0x38f778=_0x38f778||0x1f4;return function(_0x26b708){logger[_0x2e5a('0x20')](_0x26b708['stack']);if(_0x26b708['name']){delete _0x26b708[_0x2e5a('0x21')];}_0x3ae0f1[_0x2e5a('0x14')](_0x38f778)[_0x2e5a('0x22')](_0x26b708);};}exports[_0x2e5a('0x23')]=function(_0x21f88e,_0x3ac33){var _0x23ed50={},_0x16a4b9={},_0x1681f2={'count':0x0,'rows':[]};var _0x583fe4=_['map'](db[_0x2e5a('0x24')]['rawAttributes'],function(_0x313a05){return{'name':_0x313a05[_0x2e5a('0x25')],'type':_0x313a05[_0x2e5a('0x26')]['key']};});_0x16a4b9['model']=_['map'](_0x583fe4,_0x2e5a('0x21'));_0x16a4b9['query']=_[_0x2e5a('0x27')](_0x21f88e[_0x2e5a('0x28')]);_0x16a4b9['filters']=_[_0x2e5a('0x29')](_0x16a4b9[_0x2e5a('0x2a')],_0x16a4b9[_0x2e5a('0x28')]);_0x23ed50[_0x2e5a('0x2b')]=_[_0x2e5a('0x29')](_0x16a4b9['model'],qs['fields'](_0x21f88e[_0x2e5a('0x28')][_0x2e5a('0x2c')]));_0x23ed50['attributes']=_0x23ed50['attributes'][_0x2e5a('0x2d')]?_0x23ed50[_0x2e5a('0x2b')]:_0x16a4b9[_0x2e5a('0x2a')];if(!_0x21f88e[_0x2e5a('0x28')][_0x2e5a('0x2e')](_0x2e5a('0x2f'))){_0x23ed50[_0x2e5a('0x30')]=qs[_0x2e5a('0x30')](_0x21f88e[_0x2e5a('0x28')]['limit']);_0x23ed50[_0x2e5a('0x17')]=qs[_0x2e5a('0x17')](_0x21f88e[_0x2e5a('0x28')][_0x2e5a('0x17')]);}_0x23ed50[_0x2e5a('0x31')]=qs[_0x2e5a('0x32')](_0x21f88e['query']['sort']);_0x23ed50[_0x2e5a('0x33')]=qs[_0x2e5a('0x34')](_[_0x2e5a('0x35')](_0x21f88e[_0x2e5a('0x28')],_0x16a4b9[_0x2e5a('0x34')]),_0x583fe4);if(_0x21f88e[_0x2e5a('0x28')]['filter']){_0x23ed50[_0x2e5a('0x33')]=_[_0x2e5a('0x36')](_0x23ed50['where'],{'$or':_[_0x2e5a('0x37')](_0x583fe4,function(_0x5127d4){if(_0x5127d4[_0x2e5a('0x26')]!==_0x2e5a('0x38')){var _0x535bea={};_0x535bea[_0x5127d4[_0x2e5a('0x21')]]={'$like':'%'+_0x21f88e[_0x2e5a('0x28')][_0x2e5a('0x39')]+'%'};return _0x535bea;}})});}_0x23ed50=_[_0x2e5a('0x36')]({},_0x23ed50,_0x21f88e[_0x2e5a('0x3a')]);var _0x4c679d={'where':_0x23ed50[_0x2e5a('0x33')]};return db[_0x2e5a('0x24')][_0x2e5a('0x16')](_0x4c679d)['then'](function(_0x244eff){_0x1681f2['count']=_0x244eff;if(_0x21f88e[_0x2e5a('0x28')]['includeAll']){_0x23ed50['include']=[{'all':!![]}];}return db[_0x2e5a('0x24')][_0x2e5a('0x3b')](_0x23ed50);})[_0x2e5a('0x1c')](function(_0x3badce){_0x1681f2['rows']=_0x3badce;return _0x1681f2;})[_0x2e5a('0x1c')](respondWithFilteredResult(_0x3ac33,_0x23ed50))['catch'](handleError(_0x3ac33,null));};exports[_0x2e5a('0x3c')]=function(_0x247e7b,_0x11b9a6){var _0xf6491d={'raw':!![],'where':{'id':_0x247e7b[_0x2e5a('0x3d')]['id']}},_0x23f29f={};_0x23f29f[_0x2e5a('0x2a')]=_['keys'](db[_0x2e5a('0x24')][_0x2e5a('0x3e')]);_0x23f29f[_0x2e5a('0x28')]=_[_0x2e5a('0x27')](_0x247e7b['query']);_0x23f29f['filters']=_[_0x2e5a('0x29')](_0x23f29f[_0x2e5a('0x2a')],_0x23f29f[_0x2e5a('0x28')]);_0xf6491d[_0x2e5a('0x2b')]=_['intersection'](_0x23f29f[_0x2e5a('0x2a')],qs[_0x2e5a('0x2c')](_0x247e7b[_0x2e5a('0x28')][_0x2e5a('0x2c')]));_0xf6491d[_0x2e5a('0x2b')]=_0xf6491d[_0x2e5a('0x2b')][_0x2e5a('0x2d')]?_0xf6491d[_0x2e5a('0x2b')]:_0x23f29f[_0x2e5a('0x2a')];if(_0x247e7b[_0x2e5a('0x28')]['includeAll']){_0xf6491d[_0x2e5a('0x3f')]=[{'all':!![]}];}_0xf6491d=_[_0x2e5a('0x36')]({},_0xf6491d,_0x247e7b['options']);return db['MailTransferReport'][_0x2e5a('0x40')](_0xf6491d)[_0x2e5a('0x1c')](handleEntityNotFound(_0x11b9a6,null))[_0x2e5a('0x1c')](respondWithResult(_0x11b9a6,null))['catch'](handleError(_0x11b9a6,null));};exports[_0x2e5a('0x41')]=function(_0x2755f5,_0x583045){return db[_0x2e5a('0x24')][_0x2e5a('0x41')](_0x2755f5[_0x2e5a('0x42')],{})[_0x2e5a('0x1c')](respondWithResult(_0x583045,0xc9))[_0x2e5a('0x43')](handleError(_0x583045,null));};exports[_0x2e5a('0x1b')]=function(_0x27ae84,_0x2935a6){if(_0x27ae84['body']['id']){delete _0x27ae84[_0x2e5a('0x42')]['id'];}return db[_0x2e5a('0x24')][_0x2e5a('0x40')]({'where':{'id':_0x27ae84['params']['id']}})[_0x2e5a('0x1c')](handleEntityNotFound(_0x2935a6,null))[_0x2e5a('0x1c')](saveUpdates(_0x27ae84[_0x2e5a('0x42')],null))[_0x2e5a('0x1c')](respondWithResult(_0x2935a6,null))[_0x2e5a('0x43')](handleError(_0x2935a6,null));};exports['destroy']=function(_0x2849cb,_0x4e8568){return db[_0x2e5a('0x24')]['find']({'where':{'id':_0x2849cb['params']['id']}})['then'](handleEntityNotFound(_0x4e8568,null))[_0x2e5a('0x1c')](removeEntity(_0x4e8568,null))[_0x2e5a('0x43')](handleError(_0x4e8568,null));};exports[_0x2e5a('0x44')]=function(_0x2fc22c,_0xa1c349){return db[_0x2e5a('0x24')][_0x2e5a('0x44')]()['then'](respondWithResult(_0xa1c349,null))[_0x2e5a('0x43')](handleError(_0xa1c349,null));}; \ No newline at end of file +var _0x9c36=['destroy','then','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','rows','catch','show','params','length','merge','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c36,0xbf));var _0x69c3=function(_0x44824d,_0x31d115){_0x44824d=_0x44824d-0x0;var _0x36f3c7=_0x9c36[_0x44824d];return _0x36f3c7;};'use strict';var pdf=require(_0x69c3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x69c3('0x1'));var zipdir=require(_0x69c3('0x2'));var jsonpatch=require(_0x69c3('0x3'));var rp=require(_0x69c3('0x4'));var moment=require(_0x69c3('0x5'));var BPromise=require(_0x69c3('0x6'));var Mustache=require(_0x69c3('0x7'));var util=require('util');var path=require('path');var sox=require(_0x69c3('0x8'));var csv=require(_0x69c3('0x9'));var ejs=require(_0x69c3('0xa'));var fs=require('fs');var _=require(_0x69c3('0xb'));var squel=require('squel');var crypto=require(_0x69c3('0xc'));var jsforce=require(_0x69c3('0xd'));var deskjs=require(_0x69c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x69c3('0xf'));var Papa=require(_0x69c3('0x10'));var Redis=require(_0x69c3('0x11'));var authService=require(_0x69c3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x69c3('0x13'));var hardwareService=require(_0x69c3('0x14'));var logger=require(_0x69c3('0x15'))(_0x69c3('0x16'));var utils=require('../../config/utils');var config=require(_0x69c3('0x17'));var licenseUtil=require(_0x69c3('0x18'));var db=require(_0x69c3('0x19'))['db'];function respondWithStatusCode(_0x5d8462,_0x9cc727){_0x9cc727=_0x9cc727||0xcc;return function(_0xb76c14){if(_0xb76c14){return _0x5d8462['sendStatus'](_0x9cc727);}return _0x5d8462[_0x69c3('0x1a')](_0x9cc727)[_0x69c3('0x1b')]();};}function respondWithResult(_0x13e6d5,_0x4a7f3c){_0x4a7f3c=_0x4a7f3c||0xc8;return function(_0x447b43){if(_0x447b43){return _0x13e6d5['status'](_0x4a7f3c)[_0x69c3('0x1c')](_0x447b43);}};}function respondWithFilteredResult(_0x3f5ca7,_0x4f039d){return function(_0x348716){if(_0x348716){var _0x4d3de0=_0x348716[_0x69c3('0x1d')],_0x2a827f=_0x4f039d[_0x69c3('0x1e')],_0x35534c=_0x4f039d['offset']+_0x4f039d[_0x69c3('0x1f')],_0x411d9e;if(_0x35534c>=_0x4d3de0){_0x35534c=_0x4d3de0;_0x411d9e=0xc8;}else{_0x411d9e=0xce;}_0x3f5ca7['status'](_0x411d9e);return _0x3f5ca7[_0x69c3('0x20')](_0x69c3('0x21'),_0x2a827f+'-'+_0x35534c+'/'+_0x4d3de0)['json'](_0x348716);}return null;};}function patchUpdates(_0x2b2e1f){return function(_0x6d8117){try{jsonpatch[_0x69c3('0x22')](_0x6d8117,_0x2b2e1f,!![]);}catch(_0x46aed0){return BPromise[_0x69c3('0x23')](_0x46aed0);}return _0x6d8117[_0x69c3('0x24')]();};}function saveUpdates(_0x2dac50,_0x261262){return function(_0x543bd5){if(_0x543bd5){return _0x543bd5['update'](_0x2dac50)['then'](function(_0xf5035d){return _0xf5035d;});}return null;};}function removeEntity(_0x41b5d1,_0x4e8354){return function(_0x22ad82){if(_0x22ad82){return _0x22ad82[_0x69c3('0x25')]()[_0x69c3('0x26')](function(){_0x41b5d1['status'](0xcc)[_0x69c3('0x1b')]();});}};}function handleEntityNotFound(_0x1bb8bc,_0xe92b55){return function(_0x238040){if(!_0x238040){_0x1bb8bc['sendStatus'](0x194);}return _0x238040;};}function handleError(_0x238ee0,_0x5bb625){_0x5bb625=_0x5bb625||0x1f4;return function(_0x17af97){logger[_0x69c3('0x27')](_0x17af97[_0x69c3('0x28')]);if(_0x17af97[_0x69c3('0x29')]){delete _0x17af97['name'];}_0x238ee0[_0x69c3('0x1a')](_0x5bb625)[_0x69c3('0x2a')](_0x17af97);};}exports[_0x69c3('0x2b')]=function(_0x5ab838,_0x5a839f){var _0x4119df={},_0x37b7fd={},_0x1f771d={'count':0x0,'rows':[]};var _0xb30484=_[_0x69c3('0x2c')](db[_0x69c3('0x2d')][_0x69c3('0x2e')],function(_0x47bc51){return{'name':_0x47bc51[_0x69c3('0x2f')],'type':_0x47bc51['type'][_0x69c3('0x30')]};});_0x37b7fd[_0x69c3('0x31')]=_[_0x69c3('0x2c')](_0xb30484,_0x69c3('0x29'));_0x37b7fd[_0x69c3('0x32')]=_[_0x69c3('0x33')](_0x5ab838[_0x69c3('0x32')]);_0x37b7fd[_0x69c3('0x34')]=_[_0x69c3('0x35')](_0x37b7fd['model'],_0x37b7fd[_0x69c3('0x32')]);_0x4119df[_0x69c3('0x36')]=_['intersection'](_0x37b7fd[_0x69c3('0x31')],qs['fields'](_0x5ab838[_0x69c3('0x32')][_0x69c3('0x37')]));_0x4119df['attributes']=_0x4119df['attributes']['length']?_0x4119df[_0x69c3('0x36')]:_0x37b7fd[_0x69c3('0x31')];if(!_0x5ab838['query'][_0x69c3('0x38')](_0x69c3('0x39'))){_0x4119df[_0x69c3('0x1f')]=qs[_0x69c3('0x1f')](_0x5ab838['query'][_0x69c3('0x1f')]);_0x4119df[_0x69c3('0x1e')]=qs['offset'](_0x5ab838[_0x69c3('0x32')][_0x69c3('0x1e')]);}_0x4119df[_0x69c3('0x3a')]=qs[_0x69c3('0x3b')](_0x5ab838[_0x69c3('0x32')][_0x69c3('0x3b')]);_0x4119df[_0x69c3('0x3c')]=qs[_0x69c3('0x34')](_[_0x69c3('0x3d')](_0x5ab838['query'],_0x37b7fd[_0x69c3('0x34')]),_0xb30484);if(_0x5ab838[_0x69c3('0x32')][_0x69c3('0x3e')]){_0x4119df[_0x69c3('0x3c')]=_['merge'](_0x4119df['where'],{'$or':_['map'](_0xb30484,function(_0x174144){if(_0x174144['type']!=='VIRTUAL'){var _0x556a4a={};_0x556a4a[_0x174144[_0x69c3('0x29')]]={'$like':'%'+_0x5ab838[_0x69c3('0x32')][_0x69c3('0x3e')]+'%'};return _0x556a4a;}})});}_0x4119df=_['merge']({},_0x4119df,_0x5ab838[_0x69c3('0x3f')]);var _0x4326d9={'where':_0x4119df[_0x69c3('0x3c')]};return db[_0x69c3('0x2d')][_0x69c3('0x1d')](_0x4326d9)[_0x69c3('0x26')](function(_0x4a1e88){_0x1f771d['count']=_0x4a1e88;if(_0x5ab838['query'][_0x69c3('0x40')]){_0x4119df[_0x69c3('0x41')]=[{'all':!![]}];}return db[_0x69c3('0x2d')]['findAll'](_0x4119df);})[_0x69c3('0x26')](function(_0x2d22d2){_0x1f771d[_0x69c3('0x42')]=_0x2d22d2;return _0x1f771d;})[_0x69c3('0x26')](respondWithFilteredResult(_0x5a839f,_0x4119df))[_0x69c3('0x43')](handleError(_0x5a839f,null));};exports[_0x69c3('0x44')]=function(_0x134208,_0x4ff07e){var _0x18ef2f={'raw':!![],'where':{'id':_0x134208[_0x69c3('0x45')]['id']}},_0x672368={};_0x672368[_0x69c3('0x31')]=_[_0x69c3('0x33')](db['MailTransferReport'][_0x69c3('0x2e')]);_0x672368[_0x69c3('0x32')]=_[_0x69c3('0x33')](_0x134208['query']);_0x672368[_0x69c3('0x34')]=_[_0x69c3('0x35')](_0x672368[_0x69c3('0x31')],_0x672368[_0x69c3('0x32')]);_0x18ef2f[_0x69c3('0x36')]=_[_0x69c3('0x35')](_0x672368['model'],qs[_0x69c3('0x37')](_0x134208[_0x69c3('0x32')][_0x69c3('0x37')]));_0x18ef2f['attributes']=_0x18ef2f['attributes'][_0x69c3('0x46')]?_0x18ef2f[_0x69c3('0x36')]:_0x672368[_0x69c3('0x31')];if(_0x134208[_0x69c3('0x32')][_0x69c3('0x40')]){_0x18ef2f[_0x69c3('0x41')]=[{'all':!![]}];}_0x18ef2f=_[_0x69c3('0x47')]({},_0x18ef2f,_0x134208['options']);return db[_0x69c3('0x2d')][_0x69c3('0x48')](_0x18ef2f)[_0x69c3('0x26')](handleEntityNotFound(_0x4ff07e,null))[_0x69c3('0x26')](respondWithResult(_0x4ff07e,null))[_0x69c3('0x43')](handleError(_0x4ff07e,null));};exports[_0x69c3('0x49')]=function(_0x2b778f,_0x536d05){return db[_0x69c3('0x2d')][_0x69c3('0x49')](_0x2b778f[_0x69c3('0x4a')],{})['then'](respondWithResult(_0x536d05,0xc9))['catch'](handleError(_0x536d05,null));};exports['update']=function(_0x109765,_0x37784c){if(_0x109765[_0x69c3('0x4a')]['id']){delete _0x109765[_0x69c3('0x4a')]['id'];}return db[_0x69c3('0x2d')][_0x69c3('0x48')]({'where':{'id':_0x109765[_0x69c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x37784c,null))[_0x69c3('0x26')](saveUpdates(_0x109765[_0x69c3('0x4a')],null))[_0x69c3('0x26')](respondWithResult(_0x37784c,null))[_0x69c3('0x43')](handleError(_0x37784c,null));};exports[_0x69c3('0x25')]=function(_0x2b07b8,_0x29aea6){return db[_0x69c3('0x2d')][_0x69c3('0x48')]({'where':{'id':_0x2b07b8[_0x69c3('0x45')]['id']}})[_0x69c3('0x26')](handleEntityNotFound(_0x29aea6,null))[_0x69c3('0x26')](removeEntity(_0x29aea6,null))[_0x69c3('0x43')](handleError(_0x29aea6,null));};exports[_0x69c3('0x4b')]=function(_0x4b5679,_0x4d2a31){return db[_0x69c3('0x2d')][_0x69c3('0x4b')]()[_0x69c3('0x26')](respondWithResult(_0x4d2a31,null))[_0x69c3('0x43')](handleError(_0x4d2a31,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f06db32..3f3c839 100644 --- a/server/api/mailTransferReport/mailTransferReport.model.js +++ b/server/api/mailTransferReport/mailTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45be=['exports','define','MailTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./mailTransferReport.attributes'];(function(_0x57c1a8,_0x267d33){var _0x1897cc=function(_0x50bb77){while(--_0x50bb77){_0x57c1a8['push'](_0x57c1a8['shift']());}};_0x1897cc(++_0x267d33);}(_0x45be,0x178));var _0xe45b=function(_0x5025cc,_0x50f81e){_0x5025cc=_0x5025cc-0x0;var _0x41c9fe=_0x45be[_0x5025cc];return _0x41c9fe;};'use strict';var _=require(_0xe45b('0x0'));var util=require(_0xe45b('0x1'));var logger=require(_0xe45b('0x2'))(_0xe45b('0x3'));var moment=require(_0xe45b('0x4'));var BPromise=require('bluebird');var rp=require(_0xe45b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe45b('0x6'));var attributes=require(_0xe45b('0x7'));module[_0xe45b('0x8')]=function(_0x419253,_0x502f4b){return _0x419253[_0xe45b('0x9')](_0xe45b('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xe45b('0xb'),'fields':[_0xe45b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3647=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x23b89f,_0x5dbf46){var _0x1be820=function(_0x28b027){while(--_0x28b027){_0x23b89f['push'](_0x23b89f['shift']());}};_0x1be820(++_0x5dbf46);}(_0x3647,0x1a0));var _0x7364=function(_0x2cf60c,_0xaa6755){_0x2cf60c=_0x2cf60c-0x0;var _0x2466ef=_0x3647[_0x2cf60c];return _0x2466ef;};'use strict';var _=require(_0x7364('0x0'));var util=require(_0x7364('0x1'));var logger=require(_0x7364('0x2'))('api');var moment=require(_0x7364('0x3'));var BPromise=require(_0x7364('0x4'));var rp=require(_0x7364('0x5'));var fs=require('fs');var path=require(_0x7364('0x6'));var rimraf=require(_0x7364('0x7'));var config=require(_0x7364('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0x7364('0x9')]=function(_0x1efcb7,_0x3ddaf3){return _0x1efcb7[_0x7364('0xa')](_0x7364('0xb'),attributes,{'tableName':_0x7364('0xc'),'paranoid':![],'indexes':[{'name':_0x7364('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index a4630fd..bb8210e 100644 --- a/server/api/mailTransferReport/mailTransferReport.rpc.js +++ b/server/api/mailTransferReport/mailTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea66=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea66,0x169));var _0x6ea6=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0xea66[_0x5ce15c];return _0x36e4f5;};'use strict';var _=require(_0x6ea6('0x0'));var util=require(_0x6ea6('0x1'));var moment=require(_0x6ea6('0x2'));var BPromise=require(_0x6ea6('0x3'));var rs=require(_0x6ea6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ea6('0x5'))['db'];var utils=require(_0x6ea6('0x6'));var logger=require(_0x6ea6('0x7'))(_0x6ea6('0x8'));var config=require(_0x6ea6('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6ea6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x72ea93,_0x598f74,_0x16da94){return new BPromise(function(_0x31fbb3,_0x2e9d8d){return client['request'](_0x72ea93,_0x16da94)[_0x6ea6('0xb')](function(_0x519c7c){logger[_0x6ea6('0xc')](_0x6ea6('0xd'),_0x598f74,_0x6ea6('0xe'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x598f74,_0x6ea6('0xe'),JSON[_0x6ea6('0xf')](_0x519c7c));if(_0x519c7c[_0x6ea6('0x10')]){if(_0x519c7c['error'][_0x6ea6('0x11')]===0x1f4){logger[_0x6ea6('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x598f74,_0x519c7c[_0x6ea6('0x10')][_0x6ea6('0x12')]);return _0x2e9d8d(_0x519c7c[_0x6ea6('0x10')][_0x6ea6('0x12')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x598f74,_0x519c7c[_0x6ea6('0x10')][_0x6ea6('0x12')]);return _0x31fbb3(_0x519c7c[_0x6ea6('0x10')][_0x6ea6('0x12')]);}else{logger['info'](_0x6ea6('0xd'),_0x598f74,_0x6ea6('0xe'));_0x31fbb3(_0x519c7c[_0x6ea6('0x13')][_0x6ea6('0x12')]);}})[_0x6ea6('0x14')](function(_0x18d48f){logger[_0x6ea6('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x598f74,_0x18d48f);_0x2e9d8d(_0x18d48f);});});} \ No newline at end of file +var _0x999e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailTransferReport,\x20%s,\x20%s','catch','lodash','util'];(function(_0x259cd5,_0x287d95){var _0x35835a=function(_0x5d7a07){while(--_0x5d7a07){_0x259cd5['push'](_0x259cd5['shift']());}};_0x35835a(++_0x287d95);}(_0x999e,0xcd));var _0xe999=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x999e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe999('0x0'));var util=require(_0xe999('0x1'));var moment=require(_0xe999('0x2'));var BPromise=require(_0xe999('0x3'));var rs=require(_0xe999('0x4'));var fs=require('fs');var Redis=require(_0xe999('0x5'));var db=require(_0xe999('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe999('0x7'))(_0xe999('0x8'));var config=require(_0xe999('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe999('0xa')][_0xe999('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x234554,_0x5b6d37,_0x3cb264){return new BPromise(function(_0x44a1db,_0x44f32f){return client[_0xe999('0xc')](_0x234554,_0x3cb264)[_0xe999('0xd')](function(_0x1efad3){logger[_0xe999('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x5b6d37,'request\x20sent');logger['debug'](_0xe999('0xf'),_0x5b6d37,_0xe999('0x10'),JSON[_0xe999('0x11')](_0x1efad3));if(_0x1efad3[_0xe999('0x12')]){if(_0x1efad3['error'][_0xe999('0x13')]===0x1f4){logger[_0xe999('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x5b6d37,_0x1efad3['error'][_0xe999('0x14')]);return _0x44f32f(_0x1efad3[_0xe999('0x12')]['message']);}logger['error'](_0xe999('0x15'),_0x5b6d37,_0x1efad3[_0xe999('0x12')][_0xe999('0x14')]);return _0x44a1db(_0x1efad3[_0xe999('0x12')]['message']);}else{logger[_0xe999('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x5b6d37,_0xe999('0x10'));_0x44a1db(_0x1efad3['result']['message']);}})[_0xe999('0x16')](function(_0x5643c3){logger[_0xe999('0x12')](_0xe999('0x15'),_0x5b6d37,_0x5643c3);_0x44f32f(_0x5643c3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ab679a3..2a8eac7 100644 --- a/server/api/memberReport/index.js +++ b/server/api/memberReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb513=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','show','post','create','/:id','update','delete','destroy','exports','path'];(function(_0x422430,_0x9904b4){var _0x146d73=function(_0x1f64ae){while(--_0x1f64ae){_0x422430['push'](_0x422430['shift']());}};_0x146d73(++_0x9904b4);}(_0xb513,0x179));var _0x3b51=function(_0x2ff8ae,_0x459670){_0x2ff8ae=_0x2ff8ae-0x0;var _0x52d112=_0xb513[_0x2ff8ae];return _0x52d112;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3b51('0x0'));var timeout=require(_0x3b51('0x1'));var express=require(_0x3b51('0x2'));var router=express[_0x3b51('0x3')]();var auth=require(_0x3b51('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3b51('0x5'));var controller=require(_0x3b51('0x6'));router['get']('/',auth[_0x3b51('0x7')](),controller[_0x3b51('0x8')]);router[_0x3b51('0x9')]('/describe',auth[_0x3b51('0x7')](),controller['describe']);router[_0x3b51('0x9')]('/:id',auth[_0x3b51('0x7')](),controller[_0x3b51('0xa')]);router[_0x3b51('0xb')]('/',auth['isAuthenticated'](),controller[_0x3b51('0xc')]);router['put'](_0x3b51('0xd'),auth[_0x3b51('0x7')](),controller[_0x3b51('0xe')]);router[_0x3b51('0xf')](_0x3b51('0xd'),auth['isAuthenticated'](),controller[_0x3b51('0x10')]);module[_0x3b51('0x11')]=router; \ No newline at end of file +var _0xeb15=['create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x4f1431,_0x17258e){var _0x511450=function(_0x2ec64c){while(--_0x2ec64c){_0x4f1431['push'](_0x4f1431['shift']());}};_0x511450(++_0x17258e);}(_0xeb15,0x1d3));var _0x5eb1=function(_0x18fd21,_0x4af3d1){_0x18fd21=_0x18fd21-0x0;var _0x113f67=_0xeb15[_0x18fd21];return _0x113f67;};'use strict';var multer=require(_0x5eb1('0x0'));var util=require(_0x5eb1('0x1'));var path=require(_0x5eb1('0x2'));var timeout=require(_0x5eb1('0x3'));var express=require('express');var router=express[_0x5eb1('0x4')]();var auth=require(_0x5eb1('0x5'));var interaction=require(_0x5eb1('0x6'));var config=require(_0x5eb1('0x7'));var controller=require(_0x5eb1('0x8'));router[_0x5eb1('0x9')]('/',auth['isAuthenticated'](),controller[_0x5eb1('0xa')]);router[_0x5eb1('0x9')](_0x5eb1('0xb'),auth[_0x5eb1('0xc')](),controller[_0x5eb1('0xd')]);router[_0x5eb1('0x9')](_0x5eb1('0xe'),auth[_0x5eb1('0xc')](),controller[_0x5eb1('0xf')]);router['post']('/',auth[_0x5eb1('0xc')](),controller[_0x5eb1('0x10')]);router[_0x5eb1('0x11')](_0x5eb1('0xe'),auth[_0x5eb1('0xc')](),controller[_0x5eb1('0x12')]);router[_0x5eb1('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5eb1('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 1caf2df..63075fd 100644 --- a/server/api/memberReport/memberReport.attributes.js +++ b/server/api/memberReport/memberReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6e2=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING'];(function(_0x1408b4,_0x22e866){var _0x39276b=function(_0x5d7918){while(--_0x5d7918){_0x1408b4['push'](_0x1408b4['shift']());}};_0x39276b(++_0x22e866);}(_0xb6e2,0x8d));var _0x2b6e=function(_0x21d246,_0x488894){_0x21d246=_0x21d246-0x0;var _0x55f10b=_0xb6e2[_0x21d246];return _0x55f10b;};'use strict';var Sequelize=require(_0x2b6e('0x0'));var moment=require(_0x2b6e('0x1'));module['exports']={'channel':{'type':Sequelize[_0x2b6e('0x2')]},'membername':{'type':Sequelize[_0x2b6e('0x2')]},'interface':{'type':Sequelize[_0x2b6e('0x2')]},'type':{'type':Sequelize[_0x2b6e('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x2b6e('0x3')},'duration':{'type':Sequelize[_0x2b6e('0x4')]},'enterAt':{'type':Sequelize[_0x2b6e('0x5')]},'exitAt':{'type':Sequelize[_0x2b6e('0x5')],'set':function(_0x46e622){var _0x423759=moment(_0x46e622);var _0x20de3d=moment(this[_0x2b6e('0x6')](_0x2b6e('0x7')));var _0x4d6b5e=_0x423759[_0x2b6e('0x8')](_0x20de3d,_0x2b6e('0x9'));this[_0x2b6e('0xa')](_0x2b6e('0xb'),_0x46e622);this['setDataValue'](_0x2b6e('0xc'),_0x4d6b5e||null);}},'data1':{'type':Sequelize[_0x2b6e('0x2')],'comment':_0x2b6e('0xd')},'data2':{'type':Sequelize[_0x2b6e('0x2')],'comment':_0x2b6e('0xe')},'data3':{'type':Sequelize[_0x2b6e('0x2')],'comment':_0x2b6e('0xf')},'data4':{'type':Sequelize[_0x2b6e('0x2')],'comment':_0x2b6e('0x10')},'data5':{'type':Sequelize[_0x2b6e('0x2')],'comment':_0x2b6e('0x11')},'role':{'type':Sequelize[_0x2b6e('0x2')]},'internal':{'type':Sequelize[_0x2b6e('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3127=['seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x46a6d2,_0x3e66f1){var _0x345284=function(_0x9d9bd7){while(--_0x9d9bd7){_0x46a6d2['push'](_0x46a6d2['shift']());}};_0x345284(++_0x3e66f1);}(_0x3127,0x1b8));var _0x7312=function(_0x220d63,_0x2ac173){_0x220d63=_0x220d63-0x0;var _0xffccaa=_0x3127[_0x220d63];return _0xffccaa;};'use strict';var Sequelize=require(_0x7312('0x0'));var moment=require('moment');module[_0x7312('0x1')]={'channel':{'type':Sequelize[_0x7312('0x2')]},'membername':{'type':Sequelize[_0x7312('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7312('0x2')],'defaultValue':_0x7312('0x3'),'comment':_0x7312('0x4')},'duration':{'type':Sequelize[_0x7312('0x5')]},'enterAt':{'type':Sequelize[_0x7312('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x29477c){var _0x1dc7b4=moment(_0x29477c);var _0x20afa7=moment(this[_0x7312('0x7')](_0x7312('0x8')));var _0x48c501=_0x1dc7b4[_0x7312('0x9')](_0x20afa7,_0x7312('0xa'));this[_0x7312('0xb')](_0x7312('0xc'),_0x29477c);this[_0x7312('0xb')](_0x7312('0xd'),_0x48c501||null);}},'data1':{'type':Sequelize[_0x7312('0x2')],'comment':_0x7312('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0x7312('0xf')},'data3':{'type':Sequelize[_0x7312('0x2')],'comment':_0x7312('0x10')},'data4':{'type':Sequelize[_0x7312('0x2')],'comment':_0x7312('0x11')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x7312('0x2')]},'internal':{'type':Sequelize[_0x7312('0x5')]},'uniqueid':{'type':Sequelize[_0x7312('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index fe0297f..cc7a8b4 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5967=['mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','index','map','MemberReport','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x436981,_0x19a0ed){var _0x74ad13=function(_0x212a69){while(--_0x212a69){_0x436981['push'](_0x436981['shift']());}};_0x74ad13(++_0x19a0ed);}(_0x5967,0x125));var _0x7596=function(_0x1c3501,_0x4d68c0){_0x1c3501=_0x1c3501-0x0;var _0x5123dd=_0x5967[_0x1c3501];return _0x5123dd;};'use strict';var pdf=require(_0x7596('0x0'));var emlformat=require(_0x7596('0x1'));var rimraf=require(_0x7596('0x2'));var zipdir=require(_0x7596('0x3'));var jsonpatch=require(_0x7596('0x4'));var rp=require(_0x7596('0x5'));var moment=require('moment');var BPromise=require(_0x7596('0x6'));var Mustache=require(_0x7596('0x7'));var util=require(_0x7596('0x8'));var path=require(_0x7596('0x9'));var sox=require('sox');var csv=require(_0x7596('0xa'));var ejs=require(_0x7596('0xb'));var fs=require('fs');var _=require(_0x7596('0xc'));var squel=require(_0x7596('0xd'));var crypto=require(_0x7596('0xe'));var jsforce=require(_0x7596('0xf'));var deskjs=require(_0x7596('0x10'));var toCsv=require(_0x7596('0xa'));var querystring=require(_0x7596('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7596('0x12'));var qs=require(_0x7596('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7596('0x14'))(_0x7596('0x15'));var utils=require(_0x7596('0x16'));var config=require(_0x7596('0x17'));var licenseUtil=require(_0x7596('0x18'));var db=require(_0x7596('0x19'))['db'];function respondWithStatusCode(_0x558f68,_0x5cceb0){_0x5cceb0=_0x5cceb0||0xcc;return function(_0x37ab33){if(_0x37ab33){return _0x558f68['sendStatus'](_0x5cceb0);}return _0x558f68['status'](_0x5cceb0)[_0x7596('0x1a')]();};}function respondWithResult(_0x4d745a,_0x4aae51){_0x4aae51=_0x4aae51||0xc8;return function(_0x591b35){if(_0x591b35){return _0x4d745a['status'](_0x4aae51)[_0x7596('0x1b')](_0x591b35);}};}function respondWithFilteredResult(_0x37c1d6,_0x2439ec){return function(_0x2e4238){if(_0x2e4238){var _0x180e59=_0x2e4238[_0x7596('0x1c')],_0x6ed274=_0x2439ec[_0x7596('0x1d')],_0x5be920=_0x2439ec['offset']+_0x2439ec[_0x7596('0x1e')],_0x1f497a;if(_0x5be920>=_0x180e59){_0x5be920=_0x180e59;_0x1f497a=0xc8;}else{_0x1f497a=0xce;}_0x37c1d6['status'](_0x1f497a);return _0x37c1d6[_0x7596('0x1f')](_0x7596('0x20'),_0x6ed274+'-'+_0x5be920+'/'+_0x180e59)['json'](_0x2e4238);}return null;};}function patchUpdates(_0x1817b){return function(_0x5f51f8){try{jsonpatch[_0x7596('0x21')](_0x5f51f8,_0x1817b,!![]);}catch(_0x2720c9){return BPromise[_0x7596('0x22')](_0x2720c9);}return _0x5f51f8[_0x7596('0x23')]();};}function saveUpdates(_0x32e657,_0x37a514){return function(_0xd8199f){if(_0xd8199f){return _0xd8199f[_0x7596('0x24')](_0x32e657)[_0x7596('0x25')](function(_0x21f8ca){return _0x21f8ca;});}return null;};}function removeEntity(_0x290560,_0x354580){return function(_0x4c3051){if(_0x4c3051){return _0x4c3051[_0x7596('0x26')]()[_0x7596('0x25')](function(){_0x290560[_0x7596('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20880b,_0x5e43bf){return function(_0x5a649d){if(!_0x5a649d){_0x20880b['sendStatus'](0x194);}return _0x5a649d;};}function handleError(_0x5ef5ef,_0x495236){_0x495236=_0x495236||0x1f4;return function(_0x518dfa){logger[_0x7596('0x28')](_0x518dfa[_0x7596('0x29')]);if(_0x518dfa[_0x7596('0x2a')]){delete _0x518dfa['name'];}_0x5ef5ef[_0x7596('0x27')](_0x495236)['send'](_0x518dfa);};}exports[_0x7596('0x2b')]=function(_0x154ee5,_0x5d1175){var _0x1dad2e={},_0x354b43={},_0x3eebef={'count':0x0,'rows':[]};var _0xa26d2d=_[_0x7596('0x2c')](db[_0x7596('0x2d')][_0x7596('0x2e')],function(_0x1936ed){return{'name':_0x1936ed[_0x7596('0x2f')],'type':_0x1936ed['type']['key']};});_0x354b43[_0x7596('0x30')]=_[_0x7596('0x2c')](_0xa26d2d,_0x7596('0x2a'));_0x354b43[_0x7596('0x31')]=_['keys'](_0x154ee5['query']);_0x354b43[_0x7596('0x32')]=_[_0x7596('0x33')](_0x354b43[_0x7596('0x30')],_0x354b43['query']);_0x1dad2e['attributes']=_[_0x7596('0x33')](_0x354b43[_0x7596('0x30')],qs[_0x7596('0x34')](_0x154ee5['query'][_0x7596('0x34')]));_0x1dad2e['attributes']=_0x1dad2e[_0x7596('0x35')][_0x7596('0x36')]?_0x1dad2e['attributes']:_0x354b43[_0x7596('0x30')];if(!_0x154ee5[_0x7596('0x31')][_0x7596('0x37')]('nolimit')){_0x1dad2e['limit']=qs['limit'](_0x154ee5[_0x7596('0x31')][_0x7596('0x1e')]);_0x1dad2e[_0x7596('0x1d')]=qs[_0x7596('0x1d')](_0x154ee5[_0x7596('0x31')][_0x7596('0x1d')]);}_0x1dad2e[_0x7596('0x38')]=qs[_0x7596('0x39')](_0x154ee5[_0x7596('0x31')][_0x7596('0x39')]);_0x1dad2e[_0x7596('0x3a')]=qs[_0x7596('0x32')](_[_0x7596('0x3b')](_0x154ee5[_0x7596('0x31')],_0x354b43[_0x7596('0x32')]),_0xa26d2d);if(_0x154ee5['query'][_0x7596('0x3c')]){_0x1dad2e[_0x7596('0x3a')]=_[_0x7596('0x3d')](_0x1dad2e[_0x7596('0x3a')],{'$or':_[_0x7596('0x2c')](_0xa26d2d,function(_0x581152){if(_0x581152[_0x7596('0x3e')]!==_0x7596('0x3f')){var _0x25de9e={};_0x25de9e[_0x581152['name']]={'$like':'%'+_0x154ee5[_0x7596('0x31')]['filter']+'%'};return _0x25de9e;}})});}_0x1dad2e=_[_0x7596('0x3d')]({},_0x1dad2e,_0x154ee5['options']);var _0x2d1d4f={'where':_0x1dad2e[_0x7596('0x3a')]};return db[_0x7596('0x2d')][_0x7596('0x1c')](_0x2d1d4f)[_0x7596('0x25')](function(_0x1dbde5){_0x3eebef[_0x7596('0x1c')]=_0x1dbde5;if(_0x154ee5[_0x7596('0x31')]['includeAll']){_0x1dad2e[_0x7596('0x40')]=[{'all':!![]}];}return db[_0x7596('0x2d')]['findAll'](_0x1dad2e);})[_0x7596('0x25')](function(_0xe0ce1e){_0x3eebef[_0x7596('0x41')]=_0xe0ce1e;return _0x3eebef;})[_0x7596('0x25')](respondWithFilteredResult(_0x5d1175,_0x1dad2e))[_0x7596('0x42')](handleError(_0x5d1175,null));};exports[_0x7596('0x43')]=function(_0x4d779e,_0x307848){var _0x15da04={'raw':!![],'where':{'id':_0x4d779e[_0x7596('0x44')]['id']}},_0x233b3d={};_0x233b3d[_0x7596('0x30')]=_[_0x7596('0x45')](db['MemberReport'][_0x7596('0x2e')]);_0x233b3d[_0x7596('0x31')]=_['keys'](_0x4d779e[_0x7596('0x31')]);_0x233b3d[_0x7596('0x32')]=_['intersection'](_0x233b3d['model'],_0x233b3d[_0x7596('0x31')]);_0x15da04[_0x7596('0x35')]=_[_0x7596('0x33')](_0x233b3d['model'],qs['fields'](_0x4d779e[_0x7596('0x31')]['fields']));_0x15da04[_0x7596('0x35')]=_0x15da04[_0x7596('0x35')][_0x7596('0x36')]?_0x15da04[_0x7596('0x35')]:_0x233b3d['model'];if(_0x4d779e[_0x7596('0x31')][_0x7596('0x46')]){_0x15da04[_0x7596('0x40')]=[{'all':!![]}];}_0x15da04=_[_0x7596('0x3d')]({},_0x15da04,_0x4d779e['options']);return db[_0x7596('0x2d')][_0x7596('0x47')](_0x15da04)[_0x7596('0x25')](handleEntityNotFound(_0x307848,null))[_0x7596('0x25')](respondWithResult(_0x307848,null))['catch'](handleError(_0x307848,null));};exports['create']=function(_0x1be94a,_0x330d32){return db['MemberReport'][_0x7596('0x48')](_0x1be94a['body'],{})['then'](respondWithResult(_0x330d32,0xc9))[_0x7596('0x42')](handleError(_0x330d32,null));};exports['update']=function(_0x353a7f,_0x45ea7b){if(_0x353a7f['body']['id']){delete _0x353a7f[_0x7596('0x49')]['id'];}return db[_0x7596('0x2d')][_0x7596('0x47')]({'where':{'id':_0x353a7f[_0x7596('0x44')]['id']}})[_0x7596('0x25')](handleEntityNotFound(_0x45ea7b,null))['then'](saveUpdates(_0x353a7f['body'],null))[_0x7596('0x25')](respondWithResult(_0x45ea7b,null))['catch'](handleError(_0x45ea7b,null));};exports[_0x7596('0x26')]=function(_0x573983,_0x438516){return db[_0x7596('0x2d')][_0x7596('0x47')]({'where':{'id':_0x573983[_0x7596('0x44')]['id']}})[_0x7596('0x25')](handleEntityNotFound(_0x438516,null))[_0x7596('0x25')](removeEntity(_0x438516,null))['catch'](handleError(_0x438516,null));};exports[_0x7596('0x4a')]=function(_0x1d0634,_0x41f09d){return db[_0x7596('0x2d')][_0x7596('0x4a')]()[_0x7596('0x25')](respondWithResult(_0x41f09d,null))[_0x7596('0x42')](handleError(_0x41f09d,null));}; \ No newline at end of file +var _0x9bca=['crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MemberReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0x9bca,0x16a));var _0xa9bc=function(_0xf686b2,_0x5c5866){_0xf686b2=_0xf686b2-0x0;var _0x307a5f=_0x9bca[_0xf686b2];return _0x307a5f;};'use strict';var pdf=require(_0xa9bc('0x0'));var emlformat=require(_0xa9bc('0x1'));var rimraf=require(_0xa9bc('0x2'));var zipdir=require(_0xa9bc('0x3'));var jsonpatch=require(_0xa9bc('0x4'));var rp=require('request-promise');var moment=require(_0xa9bc('0x5'));var BPromise=require(_0xa9bc('0x6'));var Mustache=require(_0xa9bc('0x7'));var util=require(_0xa9bc('0x8'));var path=require('path');var sox=require(_0xa9bc('0x9'));var csv=require(_0xa9bc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa9bc('0xb'));var squel=require(_0xa9bc('0xc'));var crypto=require(_0xa9bc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa9bc('0xa'));var querystring=require(_0xa9bc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa9bc('0xf'));var qs=require(_0xa9bc('0x10'));var as=require(_0xa9bc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9bc('0x12'))(_0xa9bc('0x13'));var utils=require(_0xa9bc('0x14'));var config=require(_0xa9bc('0x15'));var licenseUtil=require(_0xa9bc('0x16'));var db=require(_0xa9bc('0x17'))['db'];function respondWithStatusCode(_0x29deda,_0x36654c){_0x36654c=_0x36654c||0xcc;return function(_0x5edc30){if(_0x5edc30){return _0x29deda[_0xa9bc('0x18')](_0x36654c);}return _0x29deda['status'](_0x36654c)[_0xa9bc('0x19')]();};}function respondWithResult(_0x2e754e,_0x18be01){_0x18be01=_0x18be01||0xc8;return function(_0x521ad2){if(_0x521ad2){return _0x2e754e[_0xa9bc('0x1a')](_0x18be01)[_0xa9bc('0x1b')](_0x521ad2);}};}function respondWithFilteredResult(_0x3f81ed,_0x4dbd19){return function(_0x2e6166){if(_0x2e6166){var _0x26c965=_0x2e6166[_0xa9bc('0x1c')],_0x51076c=_0x4dbd19[_0xa9bc('0x1d')],_0xbdb289=_0x4dbd19[_0xa9bc('0x1d')]+_0x4dbd19[_0xa9bc('0x1e')],_0xc28f24;if(_0xbdb289>=_0x26c965){_0xbdb289=_0x26c965;_0xc28f24=0xc8;}else{_0xc28f24=0xce;}_0x3f81ed[_0xa9bc('0x1a')](_0xc28f24);return _0x3f81ed[_0xa9bc('0x1f')](_0xa9bc('0x20'),_0x51076c+'-'+_0xbdb289+'/'+_0x26c965)[_0xa9bc('0x1b')](_0x2e6166);}return null;};}function patchUpdates(_0xfbf042){return function(_0x509f11){try{jsonpatch[_0xa9bc('0x21')](_0x509f11,_0xfbf042,!![]);}catch(_0x27149d){return BPromise[_0xa9bc('0x22')](_0x27149d);}return _0x509f11[_0xa9bc('0x23')]();};}function saveUpdates(_0x17bec3,_0x1c52e8){return function(_0x27f286){if(_0x27f286){return _0x27f286[_0xa9bc('0x24')](_0x17bec3)[_0xa9bc('0x25')](function(_0x16ef6e){return _0x16ef6e;});}return null;};}function removeEntity(_0x344793,_0x12797d){return function(_0x34b6fb){if(_0x34b6fb){return _0x34b6fb[_0xa9bc('0x26')]()['then'](function(){_0x344793[_0xa9bc('0x1a')](0xcc)[_0xa9bc('0x19')]();});}};}function handleEntityNotFound(_0x4d80fd,_0x1d700c){return function(_0x5d3d40){if(!_0x5d3d40){_0x4d80fd['sendStatus'](0x194);}return _0x5d3d40;};}function handleError(_0xb57637,_0x4547de){_0x4547de=_0x4547de||0x1f4;return function(_0x2e30b4){logger[_0xa9bc('0x27')](_0x2e30b4[_0xa9bc('0x28')]);if(_0x2e30b4[_0xa9bc('0x29')]){delete _0x2e30b4[_0xa9bc('0x29')];}_0xb57637[_0xa9bc('0x1a')](_0x4547de)[_0xa9bc('0x2a')](_0x2e30b4);};}exports[_0xa9bc('0x2b')]=function(_0x423418,_0x3fde1e){var _0x17eef4={},_0x4b8cb8={},_0x683d1c={'count':0x0,'rows':[]};var _0x554f4c=_[_0xa9bc('0x2c')](db[_0xa9bc('0x2d')]['rawAttributes'],function(_0x471bb7){return{'name':_0x471bb7[_0xa9bc('0x2e')],'type':_0x471bb7['type'][_0xa9bc('0x2f')]};});_0x4b8cb8[_0xa9bc('0x30')]=_[_0xa9bc('0x2c')](_0x554f4c,_0xa9bc('0x29'));_0x4b8cb8[_0xa9bc('0x31')]=_[_0xa9bc('0x32')](_0x423418['query']);_0x4b8cb8[_0xa9bc('0x33')]=_[_0xa9bc('0x34')](_0x4b8cb8['model'],_0x4b8cb8[_0xa9bc('0x31')]);_0x17eef4[_0xa9bc('0x35')]=_[_0xa9bc('0x34')](_0x4b8cb8[_0xa9bc('0x30')],qs[_0xa9bc('0x36')](_0x423418[_0xa9bc('0x31')][_0xa9bc('0x36')]));_0x17eef4[_0xa9bc('0x35')]=_0x17eef4['attributes']['length']?_0x17eef4[_0xa9bc('0x35')]:_0x4b8cb8[_0xa9bc('0x30')];if(!_0x423418[_0xa9bc('0x31')][_0xa9bc('0x37')](_0xa9bc('0x38'))){_0x17eef4['limit']=qs['limit'](_0x423418[_0xa9bc('0x31')][_0xa9bc('0x1e')]);_0x17eef4['offset']=qs[_0xa9bc('0x1d')](_0x423418['query'][_0xa9bc('0x1d')]);}_0x17eef4['order']=qs[_0xa9bc('0x39')](_0x423418[_0xa9bc('0x31')][_0xa9bc('0x39')]);_0x17eef4['where']=qs['filters'](_['pick'](_0x423418[_0xa9bc('0x31')],_0x4b8cb8[_0xa9bc('0x33')]),_0x554f4c);if(_0x423418[_0xa9bc('0x31')][_0xa9bc('0x3a')]){_0x17eef4[_0xa9bc('0x3b')]=_[_0xa9bc('0x3c')](_0x17eef4['where'],{'$or':_[_0xa9bc('0x2c')](_0x554f4c,function(_0x69eb30){if(_0x69eb30[_0xa9bc('0x3d')]!=='VIRTUAL'){var _0x34e352={};_0x34e352[_0x69eb30[_0xa9bc('0x29')]]={'$like':'%'+_0x423418[_0xa9bc('0x31')][_0xa9bc('0x3a')]+'%'};return _0x34e352;}})});}_0x17eef4=_['merge']({},_0x17eef4,_0x423418[_0xa9bc('0x3e')]);var _0x261420={'where':_0x17eef4[_0xa9bc('0x3b')]};return db['MemberReport'][_0xa9bc('0x1c')](_0x261420)[_0xa9bc('0x25')](function(_0x1c0e5b){_0x683d1c[_0xa9bc('0x1c')]=_0x1c0e5b;if(_0x423418['query'][_0xa9bc('0x3f')]){_0x17eef4[_0xa9bc('0x40')]=[{'all':!![]}];}return db[_0xa9bc('0x2d')][_0xa9bc('0x41')](_0x17eef4);})[_0xa9bc('0x25')](function(_0x1e3157){_0x683d1c[_0xa9bc('0x42')]=_0x1e3157;return _0x683d1c;})[_0xa9bc('0x25')](respondWithFilteredResult(_0x3fde1e,_0x17eef4))[_0xa9bc('0x43')](handleError(_0x3fde1e,null));};exports['show']=function(_0x89b57d,_0x474f6e){var _0x572c53={'raw':!![],'where':{'id':_0x89b57d['params']['id']}},_0x1f85f1={};_0x1f85f1['model']=_[_0xa9bc('0x32')](db[_0xa9bc('0x2d')][_0xa9bc('0x44')]);_0x1f85f1['query']=_[_0xa9bc('0x32')](_0x89b57d['query']);_0x1f85f1[_0xa9bc('0x33')]=_[_0xa9bc('0x34')](_0x1f85f1['model'],_0x1f85f1[_0xa9bc('0x31')]);_0x572c53['attributes']=_[_0xa9bc('0x34')](_0x1f85f1[_0xa9bc('0x30')],qs[_0xa9bc('0x36')](_0x89b57d[_0xa9bc('0x31')]['fields']));_0x572c53[_0xa9bc('0x35')]=_0x572c53[_0xa9bc('0x35')][_0xa9bc('0x45')]?_0x572c53[_0xa9bc('0x35')]:_0x1f85f1[_0xa9bc('0x30')];if(_0x89b57d[_0xa9bc('0x31')][_0xa9bc('0x3f')]){_0x572c53[_0xa9bc('0x40')]=[{'all':!![]}];}_0x572c53=_[_0xa9bc('0x3c')]({},_0x572c53,_0x89b57d[_0xa9bc('0x3e')]);return db[_0xa9bc('0x2d')][_0xa9bc('0x46')](_0x572c53)[_0xa9bc('0x25')](handleEntityNotFound(_0x474f6e,null))['then'](respondWithResult(_0x474f6e,null))['catch'](handleError(_0x474f6e,null));};exports[_0xa9bc('0x47')]=function(_0x3bc717,_0x3c12f4){return db['MemberReport'][_0xa9bc('0x47')](_0x3bc717[_0xa9bc('0x48')],{})[_0xa9bc('0x25')](respondWithResult(_0x3c12f4,0xc9))[_0xa9bc('0x43')](handleError(_0x3c12f4,null));};exports[_0xa9bc('0x24')]=function(_0x18083a,_0x468bbe){if(_0x18083a[_0xa9bc('0x48')]['id']){delete _0x18083a[_0xa9bc('0x48')]['id'];}return db[_0xa9bc('0x2d')][_0xa9bc('0x46')]({'where':{'id':_0x18083a[_0xa9bc('0x49')]['id']}})[_0xa9bc('0x25')](handleEntityNotFound(_0x468bbe,null))[_0xa9bc('0x25')](saveUpdates(_0x18083a[_0xa9bc('0x48')],null))[_0xa9bc('0x25')](respondWithResult(_0x468bbe,null))[_0xa9bc('0x43')](handleError(_0x468bbe,null));};exports[_0xa9bc('0x26')]=function(_0x1f6830,_0x216439){return db['MemberReport'][_0xa9bc('0x46')]({'where':{'id':_0x1f6830[_0xa9bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x216439,null))[_0xa9bc('0x25')](removeEntity(_0x216439,null))['catch'](handleError(_0x216439,null));};exports[_0xa9bc('0x4a')]=function(_0x74bd50,_0x13f42e){return db[_0xa9bc('0x2d')]['describe']()['then'](respondWithResult(_0x13f42e,null))[_0xa9bc('0x43')](handleError(_0x13f42e,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index cf4e96b..44d0d6c 100644 --- a/server/api/memberReport/memberReport.model.js +++ b/server/api/memberReport/memberReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77ea=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','report_member','membername_interface','membername','lodash','util'];(function(_0x69e6bd,_0x22da67){var _0x4ac232=function(_0x42c788){while(--_0x42c788){_0x69e6bd['push'](_0x69e6bd['shift']());}};_0x4ac232(++_0x22da67);}(_0x77ea,0x1be));var _0xa77e=function(_0x4b22c7,_0x5259f5){_0x4b22c7=_0x4b22c7-0x0;var _0xffdd81=_0x77ea[_0x4b22c7];return _0xffdd81;};'use strict';var _=require(_0xa77e('0x0'));var util=require(_0xa77e('0x1'));var logger=require(_0xa77e('0x2'))('api');var moment=require(_0xa77e('0x3'));var BPromise=require(_0xa77e('0x4'));var rp=require(_0xa77e('0x5'));var fs=require('fs');var path=require(_0xa77e('0x6'));var rimraf=require(_0xa77e('0x7'));var config=require(_0xa77e('0x8'));var attributes=require(_0xa77e('0x9'));module[_0xa77e('0xa')]=function(_0x24972e,_0x1e6b8d){return _0x24972e['define']('MemberReport',attributes,{'tableName':_0xa77e('0xb'),'paranoid':![],'indexes':[{'name':_0xa77e('0xc'),'fields':[_0xa77e('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xda80=['util','api','moment','request-promise','path','rimraf','./memberReport.attributes','exports','define','report_member','membername_interface','lodash'];(function(_0x59f97a,_0x511696){var _0x411b33=function(_0x4f801e){while(--_0x4f801e){_0x59f97a['push'](_0x59f97a['shift']());}};_0x411b33(++_0x511696);}(_0xda80,0x83));var _0x0da8=function(_0x2de2c4,_0x21f72e){_0x2de2c4=_0x2de2c4-0x0;var _0xfef4cd=_0xda80[_0x2de2c4];return _0xfef4cd;};'use strict';var _=require(_0x0da8('0x0'));var util=require(_0x0da8('0x1'));var logger=require('../../config/logger')(_0x0da8('0x2'));var moment=require(_0x0da8('0x3'));var BPromise=require('bluebird');var rp=require(_0x0da8('0x4'));var fs=require('fs');var path=require(_0x0da8('0x5'));var rimraf=require(_0x0da8('0x6'));var config=require('../../config/environment');var attributes=require(_0x0da8('0x7'));module[_0x0da8('0x8')]=function(_0x514894,_0x581758){return _0x514894[_0x0da8('0x9')]('MemberReport',attributes,{'tableName':_0x0da8('0xa'),'paranoid':![],'indexes':[{'name':_0x0da8('0xb'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d5654f1..8ea5c39 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ba0=['request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','MemberReport','findAll','options','where','attributes','limit','map','include','model','debug','GetMemberReport','stringify','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x567386,_0xa8954f){var _0xb907d=function(_0x1b4280){while(--_0x1b4280){_0x567386['push'](_0x567386['shift']());}};_0xb907d(++_0xa8954f);}(_0x7ba0,0x1d4));var _0x07ba=function(_0x49b6f8,_0x354fdc){_0x49b6f8=_0x49b6f8-0x0;var _0x2c49e2=_0x7ba0[_0x49b6f8];return _0x2c49e2;};'use strict';var _=require(_0x07ba('0x0'));var util=require('util');var moment=require(_0x07ba('0x1'));var BPromise=require(_0x07ba('0x2'));var rs=require(_0x07ba('0x3'));var fs=require('fs');var Redis=require(_0x07ba('0x4'));var db=require(_0x07ba('0x5'))['db'];var utils=require(_0x07ba('0x6'));var logger=require(_0x07ba('0x7'))(_0x07ba('0x8'));var config=require(_0x07ba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x07ba('0xa')][_0x07ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b8ef6,_0xc12693,_0x3e1391){return new BPromise(function(_0x558940,_0x311208){return client[_0x07ba('0xc')](_0x3b8ef6,_0x3e1391)[_0x07ba('0xd')](function(_0x1550ac){logger[_0x07ba('0xe')](_0x07ba('0xf'),_0xc12693,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0xc12693,_0x07ba('0x10'),JSON['stringify'](_0x1550ac));if(_0x1550ac[_0x07ba('0x11')]){if(_0x1550ac[_0x07ba('0x11')][_0x07ba('0x12')]===0x1f4){logger['error'](_0x07ba('0xf'),_0xc12693,_0x1550ac['error'][_0x07ba('0x13')]);return _0x311208(_0x1550ac['error'][_0x07ba('0x13')]);}logger[_0x07ba('0x11')](_0x07ba('0xf'),_0xc12693,_0x1550ac[_0x07ba('0x11')]['message']);return _0x558940(_0x1550ac[_0x07ba('0x11')][_0x07ba('0x13')]);}else{logger['info'](_0x07ba('0xf'),_0xc12693,_0x07ba('0x10'));_0x558940(_0x1550ac[_0x07ba('0x14')][_0x07ba('0x13')]);}})[_0x07ba('0x15')](function(_0x51eb26){logger[_0x07ba('0x11')](_0x07ba('0xf'),_0xc12693,_0x51eb26);_0x311208(_0x51eb26);});});}exports['GetMemberReport']=function(_0x38ed59){var _0x2cbf26=this;return new Promise(function(_0x1ec0d4,_0x2188ed){return db[_0x07ba('0x16')][_0x07ba('0x17')]({'raw':_0x38ed59[_0x07ba('0x18')]?_0x38ed59[_0x07ba('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x38ed59[_0x07ba('0x18')]?_0x38ed59[_0x07ba('0x18')][_0x07ba('0x19')]||null:null,'attributes':_0x38ed59['options']?_0x38ed59['options'][_0x07ba('0x1a')]||null:null,'limit':_0x38ed59[_0x07ba('0x18')]?_0x38ed59['options'][_0x07ba('0x1b')]||null:null,'include':_0x38ed59[_0x07ba('0x18')]?_0x38ed59[_0x07ba('0x18')]['include']?_[_0x07ba('0x1c')](_0x38ed59[_0x07ba('0x18')][_0x07ba('0x1d')],function(_0xd4fd36){return{'model':db[_0xd4fd36[_0x07ba('0x1e')]],'as':_0xd4fd36['as'],'attributes':_0xd4fd36[_0x07ba('0x1a')],'include':_0xd4fd36[_0x07ba('0x1d')]?_['map'](_0xd4fd36[_0x07ba('0x1d')],function(_0xd03845){return{'model':db[_0xd03845[_0x07ba('0x1e')]],'as':_0xd03845['as'],'attributes':_0xd03845[_0x07ba('0x1a')],'include':_0xd03845[_0x07ba('0x1d')]?_['map'](_0xd03845['include'],function(_0x32e4a3){return{'model':db[_0x32e4a3['model']],'as':_0x32e4a3['as'],'attributes':_0x32e4a3['attributes']};}):[]};}):[]};}):[]:[]})[_0x07ba('0xd')](function(_0x3ad72f){logger['info']('GetMemberReport',_0x38ed59);logger[_0x07ba('0x1f')](_0x07ba('0x20'),_0x38ed59,JSON[_0x07ba('0x21')](_0x3ad72f));_0x1ec0d4(_0x3ad72f);})[_0x07ba('0x15')](function(_0x4bce0f){logger[_0x07ba('0x11')]('GetMemberReport',_0x4bce0f['message'],_0x38ed59);_0x2188ed(_0x2cbf26[_0x07ba('0x11')](0x1f4,_0x4bce0f[_0x07ba('0x13')]));});});};exports[_0x07ba('0x22')]=function(_0x1202c6){var _0x5c514d=this;return new Promise(function(_0x88e2a3,_0xb91a2e){return db['MemberReport'][_0x07ba('0x23')](_0x1202c6[_0x07ba('0x24')],{'raw':_0x1202c6[_0x07ba('0x18')]?_0x1202c6['options'][_0x07ba('0x25')]===undefined?!![]:![]:!![]})[_0x07ba('0xd')](function(_0x5d67d9){logger[_0x07ba('0xe')](_0x07ba('0x22'),_0x1202c6);logger[_0x07ba('0x1f')](_0x07ba('0x22'),_0x1202c6,JSON[_0x07ba('0x21')](_0x5d67d9));_0x88e2a3(_0x5d67d9);})['catch'](function(_0x5b8a9f){logger[_0x07ba('0x11')](_0x07ba('0x22'),_0x5b8a9f['message'],_0x1202c6);_0xb91a2e(_0x5c514d[_0x07ba('0x11')](0x1f4,_0x5b8a9f[_0x07ba('0x13')]));});});};exports[_0x07ba('0x26')]=function(_0x51f82a){var _0x194083=this;return new Promise(function(_0x5a8f58,_0x5df2f0){return db['MemberReport'][_0x07ba('0x27')](_0x51f82a[_0x07ba('0x24')],{'raw':_0x51f82a[_0x07ba('0x18')]?_0x51f82a[_0x07ba('0x18')][_0x07ba('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51f82a[_0x07ba('0x18')]?_0x51f82a[_0x07ba('0x18')]['where']||null:null,'attributes':_0x51f82a['options']?_0x51f82a[_0x07ba('0x18')]['attributes']||null:null,'limit':_0x51f82a['options']?_0x51f82a[_0x07ba('0x18')][_0x07ba('0x1b')]||null:null})[_0x07ba('0xd')](function(_0x514b42){logger[_0x07ba('0xe')](_0x07ba('0x26'),_0x51f82a);logger['debug'](_0x07ba('0x26'),_0x51f82a,JSON[_0x07ba('0x21')](_0x514b42));_0x5a8f58(_0x514b42);})['catch'](function(_0x544774){logger[_0x07ba('0x11')](_0x07ba('0x26'),_0x544774['message'],_0x51f82a);_0x5df2f0(_0x194083['error'](0x1f4,_0x544774[_0x07ba('0x13')]));});});}; \ No newline at end of file +var _0x07c7=['ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MemberReport','findAll','options','raw','where','limit','include','map','attributes','model','GetMemberReport','debug','create','body','CreateMemberReport','UpdateMemberReport','update','moment','bluebird','randomstring'];(function(_0x49813b,_0x4f170a){var _0x491ece=function(_0x45c465){while(--_0x45c465){_0x49813b['push'](_0x49813b['shift']());}};_0x491ece(++_0x4f170a);}(_0x07c7,0x1c5));var _0x707c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x07c7[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x707c('0x0'));var BPromise=require(_0x707c('0x1'));var rs=require(_0x707c('0x2'));var fs=require('fs');var Redis=require(_0x707c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x707c('0x4'));var logger=require(_0x707c('0x5'))(_0x707c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x707c('0x7')][_0x707c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52a869,_0x23dfd5,_0x240ace){return new BPromise(function(_0x529e2c,_0x543207){return client[_0x707c('0x9')](_0x52a869,_0x240ace)[_0x707c('0xa')](function(_0x3598d3){logger[_0x707c('0xb')](_0x707c('0xc'),_0x23dfd5,'request\x20sent');logger['debug'](_0x707c('0xd'),_0x23dfd5,_0x707c('0xe'),JSON[_0x707c('0xf')](_0x3598d3));if(_0x3598d3[_0x707c('0x10')]){if(_0x3598d3['error'][_0x707c('0x11')]===0x1f4){logger['error'](_0x707c('0xc'),_0x23dfd5,_0x3598d3[_0x707c('0x10')][_0x707c('0x12')]);return _0x543207(_0x3598d3[_0x707c('0x10')][_0x707c('0x12')]);}logger[_0x707c('0x10')]('MemberReport,\x20%s,\x20%s',_0x23dfd5,_0x3598d3[_0x707c('0x10')]['message']);return _0x529e2c(_0x3598d3[_0x707c('0x10')][_0x707c('0x12')]);}else{logger[_0x707c('0xb')](_0x707c('0xc'),_0x23dfd5,_0x707c('0xe'));_0x529e2c(_0x3598d3[_0x707c('0x13')][_0x707c('0x12')]);}})[_0x707c('0x14')](function(_0x3227c8){logger['error'](_0x707c('0xc'),_0x23dfd5,_0x3227c8);_0x543207(_0x3227c8);});});}exports['GetMemberReport']=function(_0x12167b){var _0x57bca0=this;return new Promise(function(_0x57a204,_0x418e3d){return db[_0x707c('0x15')][_0x707c('0x16')]({'raw':_0x12167b[_0x707c('0x17')]?_0x12167b[_0x707c('0x17')][_0x707c('0x18')]===undefined?!![]:![]:!![],'where':_0x12167b[_0x707c('0x17')]?_0x12167b[_0x707c('0x17')][_0x707c('0x19')]||null:null,'attributes':_0x12167b['options']?_0x12167b[_0x707c('0x17')]['attributes']||null:null,'limit':_0x12167b[_0x707c('0x17')]?_0x12167b[_0x707c('0x17')][_0x707c('0x1a')]||null:null,'include':_0x12167b[_0x707c('0x17')]?_0x12167b['options'][_0x707c('0x1b')]?_[_0x707c('0x1c')](_0x12167b[_0x707c('0x17')][_0x707c('0x1b')],function(_0x5c239e){return{'model':db[_0x5c239e['model']],'as':_0x5c239e['as'],'attributes':_0x5c239e['attributes'],'include':_0x5c239e[_0x707c('0x1b')]?_[_0x707c('0x1c')](_0x5c239e['include'],function(_0x58b523){return{'model':db[_0x58b523['model']],'as':_0x58b523['as'],'attributes':_0x58b523[_0x707c('0x1d')],'include':_0x58b523[_0x707c('0x1b')]?_[_0x707c('0x1c')](_0x58b523['include'],function(_0x3a3973){return{'model':db[_0x3a3973[_0x707c('0x1e')]],'as':_0x3a3973['as'],'attributes':_0x3a3973[_0x707c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x707c('0xa')](function(_0x325354){logger[_0x707c('0xb')](_0x707c('0x1f'),_0x12167b);logger[_0x707c('0x20')](_0x707c('0x1f'),_0x12167b,JSON[_0x707c('0xf')](_0x325354));_0x57a204(_0x325354);})['catch'](function(_0x340391){logger['error'](_0x707c('0x1f'),_0x340391['message'],_0x12167b);_0x418e3d(_0x57bca0[_0x707c('0x10')](0x1f4,_0x340391[_0x707c('0x12')]));});});};exports['CreateMemberReport']=function(_0x25ab49){var _0x5d3ec7=this;return new Promise(function(_0x407092,_0x385f6f){return db['MemberReport'][_0x707c('0x21')](_0x25ab49[_0x707c('0x22')],{'raw':_0x25ab49[_0x707c('0x17')]?_0x25ab49['options'][_0x707c('0x18')]===undefined?!![]:![]:!![]})[_0x707c('0xa')](function(_0x3f7bfa){logger['info'](_0x707c('0x23'),_0x25ab49);logger[_0x707c('0x20')](_0x707c('0x23'),_0x25ab49,JSON[_0x707c('0xf')](_0x3f7bfa));_0x407092(_0x3f7bfa);})[_0x707c('0x14')](function(_0x4d4e2d){logger[_0x707c('0x10')](_0x707c('0x23'),_0x4d4e2d[_0x707c('0x12')],_0x25ab49);_0x385f6f(_0x5d3ec7[_0x707c('0x10')](0x1f4,_0x4d4e2d['message']));});});};exports[_0x707c('0x24')]=function(_0x4a9c40){var _0x5d9f66=this;return new Promise(function(_0x2dbd27,_0x1e54e1){return db['MemberReport'][_0x707c('0x25')](_0x4a9c40[_0x707c('0x22')],{'raw':_0x4a9c40[_0x707c('0x17')]?_0x4a9c40['options'][_0x707c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a9c40[_0x707c('0x17')]?_0x4a9c40[_0x707c('0x17')][_0x707c('0x19')]||null:null,'attributes':_0x4a9c40[_0x707c('0x17')]?_0x4a9c40[_0x707c('0x17')][_0x707c('0x1d')]||null:null,'limit':_0x4a9c40['options']?_0x4a9c40['options'][_0x707c('0x1a')]||null:null})[_0x707c('0xa')](function(_0x34e3db){logger[_0x707c('0xb')](_0x707c('0x24'),_0x4a9c40);logger['debug'](_0x707c('0x24'),_0x4a9c40,JSON['stringify'](_0x34e3db));_0x2dbd27(_0x34e3db);})[_0x707c('0x14')](function(_0x5913d3){logger[_0x707c('0x10')](_0x707c('0x24'),_0x5913d3[_0x707c('0x12')],_0x4a9c40);_0x1e54e1(_0x5d9f66['error'](0x1f4,_0x5913d3[_0x707c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e62961c..d21dbb1 100644 --- a/server/api/migration/index.js +++ b/server/api/migration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b20=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer'];(function(_0x3f63b5,_0x461236){var _0x577d84=function(_0x2d6eba){while(--_0x2d6eba){_0x3f63b5['push'](_0x3f63b5['shift']());}};_0x577d84(++_0x461236);}(_0x6b20,0xd1));var _0x06b2=function(_0x55654d,_0x429aaa){_0x55654d=_0x55654d-0x0;var _0xdeb11=_0x6b20[_0x55654d];return _0xdeb11;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var auth=require(_0x06b2('0x4'));var interaction=require(_0x06b2('0x5'));var config=require('../../config/environment');var controller=require(_0x06b2('0x6'));router[_0x06b2('0x7')]('/',controller[_0x06b2('0x8')]);module[_0x06b2('0x9')]=router; \ No newline at end of file +var _0x02ce=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x379537,_0x3909c9){var _0xb1efdc=function(_0x758a0e){while(--_0x758a0e){_0x379537['push'](_0x379537['shift']());}};_0xb1efdc(++_0x3909c9);}(_0x02ce,0x1ac));var _0xe02c=function(_0x47a0b1,_0x103afb){_0x47a0b1=_0x47a0b1-0x0;var _0x2b588c=_0x02ce[_0x47a0b1];return _0x2b588c;};'use strict';var multer=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var path=require(_0xe02c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe02c('0x3'));var router=express['Router']();var auth=require(_0xe02c('0x4'));var interaction=require(_0xe02c('0x5'));var config=require(_0xe02c('0x6'));var controller=require(_0xe02c('0x7'));router[_0xe02c('0x8')]('/',controller[_0xe02c('0x9')]);module[_0xe02c('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 8f47511..40ee02a 100644 --- a/server/api/migration/migration.attributes.js +++ b/server/api/migration/migration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8745=['STRING','version','sequelize','exports'];(function(_0x1f40de,_0x5b55bd){var _0x196a56=function(_0x526820){while(--_0x526820){_0x1f40de['push'](_0x1f40de['shift']());}};_0x196a56(++_0x5b55bd);}(_0x8745,0xfa));var _0x5874=function(_0x2e8614,_0x56874a){_0x2e8614=_0x2e8614-0x0;var _0x457ee9=_0x8745[_0x2e8614];return _0x457ee9;};'use strict';var Sequelize=require(_0x5874('0x0'));module[_0x5874('0x1')]={'version':{'type':Sequelize[_0x5874('0x2')],'unique':_0x5874('0x3')}}; \ No newline at end of file +var _0x1ab3=['exports','STRING','version','sequelize'];(function(_0x55cc83,_0x492a0b){var _0x39880e=function(_0x40eed8){while(--_0x40eed8){_0x55cc83['push'](_0x55cc83['shift']());}};_0x39880e(++_0x492a0b);}(_0x1ab3,0x133));var _0x31ab=function(_0x290149,_0x10b077){_0x290149=_0x290149-0x0;var _0x341702=_0x1ab3[_0x290149];return _0x341702;};'use strict';var Sequelize=require(_0x31ab('0x0'));module[_0x31ab('0x1')]={'version':{'type':Sequelize[_0x31ab('0x2')],'unique':_0x31ab('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 50a98c6..16c7ec8 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd331=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','reject','save','update','then','destroy','end','sendStatus','stack','name','index','map','Migration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','include','findAll','rows','catch','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','squel','crypto'];(function(_0x4b2b3e,_0x720687){var _0x2f59a6=function(_0x29548c){while(--_0x29548c){_0x4b2b3e['push'](_0x4b2b3e['shift']());}};_0x2f59a6(++_0x720687);}(_0xd331,0xed));var _0x1d33=function(_0x23c2ed,_0x281ced){_0x23c2ed=_0x23c2ed-0x0;var _0x551fc4=_0xd331[_0x23c2ed];return _0x551fc4;};'use strict';var pdf=require(_0x1d33('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1d33('0x1'));var jsonpatch=require(_0x1d33('0x2'));var rp=require('request-promise');var moment=require(_0x1d33('0x3'));var BPromise=require(_0x1d33('0x4'));var Mustache=require(_0x1d33('0x5'));var util=require(_0x1d33('0x6'));var path=require('path');var sox=require(_0x1d33('0x7'));var csv=require(_0x1d33('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1d33('0x9'));var crypto=require(_0x1d33('0xa'));var jsforce=require(_0x1d33('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1d33('0x8'));var querystring=require(_0x1d33('0xc'));var Papa=require(_0x1d33('0xd'));var Redis=require(_0x1d33('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1d33('0xf'));var as=require(_0x1d33('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d33('0x11'))(_0x1d33('0x12'));var utils=require(_0x1d33('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1d33('0x14'));var db=require(_0x1d33('0x15'))['db'];function respondWithStatusCode(_0x134b4e,_0x37ac5b){_0x37ac5b=_0x37ac5b||0xcc;return function(_0x1f6184){if(_0x1f6184){return _0x134b4e['sendStatus'](_0x37ac5b);}return _0x134b4e[_0x1d33('0x16')](_0x37ac5b)['end']();};}function respondWithResult(_0x5c9cf9,_0x2d5faf){_0x2d5faf=_0x2d5faf||0xc8;return function(_0x2f8e93){if(_0x2f8e93){return _0x5c9cf9[_0x1d33('0x16')](_0x2d5faf)[_0x1d33('0x17')](_0x2f8e93);}};}function respondWithFilteredResult(_0x3ce052,_0xf88502){return function(_0x3d52e5){if(_0x3d52e5){var _0x3513e7=_0x3d52e5[_0x1d33('0x18')],_0x267ecf=_0xf88502['offset'],_0x71e752=_0xf88502[_0x1d33('0x19')]+_0xf88502[_0x1d33('0x1a')],_0xbae46;if(_0x71e752>=_0x3513e7){_0x71e752=_0x3513e7;_0xbae46=0xc8;}else{_0xbae46=0xce;}_0x3ce052[_0x1d33('0x16')](_0xbae46);return _0x3ce052[_0x1d33('0x1b')]('Content-Range',_0x267ecf+'-'+_0x71e752+'/'+_0x3513e7)[_0x1d33('0x17')](_0x3d52e5);}return null;};}function patchUpdates(_0x49b53a){return function(_0x12f432){try{jsonpatch['apply'](_0x12f432,_0x49b53a,!![]);}catch(_0x1ad9c5){return BPromise[_0x1d33('0x1c')](_0x1ad9c5);}return _0x12f432[_0x1d33('0x1d')]();};}function saveUpdates(_0x5a8e16,_0x4b8b22){return function(_0x372970){if(_0x372970){return _0x372970[_0x1d33('0x1e')](_0x5a8e16)[_0x1d33('0x1f')](function(_0x4e865c){return _0x4e865c;});}return null;};}function removeEntity(_0x18e657,_0xb30d9d){return function(_0x3a81b2){if(_0x3a81b2){return _0x3a81b2[_0x1d33('0x20')]()[_0x1d33('0x1f')](function(){_0x18e657['status'](0xcc)[_0x1d33('0x21')]();});}};}function handleEntityNotFound(_0x12a437,_0x4769c0){return function(_0x3ab917){if(!_0x3ab917){_0x12a437[_0x1d33('0x22')](0x194);}return _0x3ab917;};}function handleError(_0x47803b,_0x32af65){_0x32af65=_0x32af65||0x1f4;return function(_0x48c2c9){logger['error'](_0x48c2c9[_0x1d33('0x23')]);if(_0x48c2c9[_0x1d33('0x24')]){delete _0x48c2c9[_0x1d33('0x24')];}_0x47803b[_0x1d33('0x16')](_0x32af65)['send'](_0x48c2c9);};}exports[_0x1d33('0x25')]=function(_0x5301fb,_0x126733){var _0x5709d8={},_0x3c053b={},_0x387eeb={'count':0x0,'rows':[]};var _0x2a89b7=_[_0x1d33('0x26')](db[_0x1d33('0x27')][_0x1d33('0x28')],function(_0x583d5d){return{'name':_0x583d5d[_0x1d33('0x29')],'type':_0x583d5d[_0x1d33('0x2a')][_0x1d33('0x2b')]};});_0x3c053b[_0x1d33('0x2c')]=_['map'](_0x2a89b7,_0x1d33('0x24'));_0x3c053b['query']=_[_0x1d33('0x2d')](_0x5301fb[_0x1d33('0x2e')]);_0x3c053b[_0x1d33('0x2f')]=_['intersection'](_0x3c053b[_0x1d33('0x2c')],_0x3c053b['query']);_0x5709d8[_0x1d33('0x30')]=_['intersection'](_0x3c053b['model'],qs['fields'](_0x5301fb['query']['fields']));_0x5709d8['attributes']=_0x5709d8[_0x1d33('0x30')][_0x1d33('0x31')]?_0x5709d8[_0x1d33('0x30')]:_0x3c053b[_0x1d33('0x2c')];if(!_0x5301fb['query'][_0x1d33('0x32')](_0x1d33('0x33'))){_0x5709d8[_0x1d33('0x1a')]=qs[_0x1d33('0x1a')](_0x5301fb[_0x1d33('0x2e')][_0x1d33('0x1a')]);_0x5709d8[_0x1d33('0x19')]=qs[_0x1d33('0x19')](_0x5301fb[_0x1d33('0x2e')][_0x1d33('0x19')]);}_0x5709d8[_0x1d33('0x34')]=qs[_0x1d33('0x35')](_0x5301fb[_0x1d33('0x2e')][_0x1d33('0x35')]);_0x5709d8[_0x1d33('0x36')]=qs[_0x1d33('0x2f')](_['pick'](_0x5301fb[_0x1d33('0x2e')],_0x3c053b['filters']),_0x2a89b7);if(_0x5301fb['query']['filter']){_0x5709d8[_0x1d33('0x36')]=_[_0x1d33('0x37')](_0x5709d8[_0x1d33('0x36')],{'$or':_[_0x1d33('0x26')](_0x2a89b7,function(_0xccf3ca){if(_0xccf3ca['type']!==_0x1d33('0x38')){var _0x41fc54={};_0x41fc54[_0xccf3ca[_0x1d33('0x24')]]={'$like':'%'+_0x5301fb['query'][_0x1d33('0x39')]+'%'};return _0x41fc54;}})});}_0x5709d8=_[_0x1d33('0x37')]({},_0x5709d8,_0x5301fb['options']);var _0xce12e8={'where':_0x5709d8[_0x1d33('0x36')]};return db['Migration']['count'](_0xce12e8)[_0x1d33('0x1f')](function(_0x38819a){_0x387eeb['count']=_0x38819a;if(_0x5301fb[_0x1d33('0x2e')]['includeAll']){_0x5709d8[_0x1d33('0x3a')]=[{'all':!![]}];}return db[_0x1d33('0x27')][_0x1d33('0x3b')](_0x5709d8);})[_0x1d33('0x1f')](function(_0x3e313c){_0x387eeb[_0x1d33('0x3c')]=_0x3e313c;return _0x387eeb;})[_0x1d33('0x1f')](respondWithFilteredResult(_0x126733,_0x5709d8))[_0x1d33('0x3d')](handleError(_0x126733,null));}; \ No newline at end of file +var _0xbad3=['catch','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','filters','filter','options','includeAll','findAll','rows'];(function(_0x577b0f,_0x3ffbba){var _0x4b0ee0=function(_0xb3df86){while(--_0xb3df86){_0x577b0f['push'](_0x577b0f['shift']());}};_0x4b0ee0(++_0x3ffbba);}(_0xbad3,0x8d));var _0x3bad=function(_0x1aae68,_0x53905a){_0x1aae68=_0x1aae68-0x0;var _0x1e9b5c=_0xbad3[_0x1aae68];return _0x1e9b5c;};'use strict';var pdf=require(_0x3bad('0x0'));var emlformat=require(_0x3bad('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3bad('0x2'));var jsonpatch=require(_0x3bad('0x3'));var rp=require('request-promise');var moment=require(_0x3bad('0x4'));var BPromise=require(_0x3bad('0x5'));var Mustache=require(_0x3bad('0x6'));var util=require(_0x3bad('0x7'));var path=require(_0x3bad('0x8'));var sox=require(_0x3bad('0x9'));var csv=require('to-csv');var ejs=require(_0x3bad('0xa'));var fs=require('fs');var _=require(_0x3bad('0xb'));var squel=require(_0x3bad('0xc'));var crypto=require(_0x3bad('0xd'));var jsforce=require(_0x3bad('0xe'));var deskjs=require(_0x3bad('0xf'));var toCsv=require(_0x3bad('0x10'));var querystring=require(_0x3bad('0x11'));var Papa=require(_0x3bad('0x12'));var Redis=require(_0x3bad('0x13'));var authService=require(_0x3bad('0x14'));var qs=require(_0x3bad('0x15'));var as=require(_0x3bad('0x16'));var hardwareService=require(_0x3bad('0x17'));var logger=require(_0x3bad('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x3bad('0x19'));var licenseUtil=require(_0x3bad('0x1a'));var db=require(_0x3bad('0x1b'))['db'];function respondWithStatusCode(_0xac3057,_0x296dcb){_0x296dcb=_0x296dcb||0xcc;return function(_0x3ea608){if(_0x3ea608){return _0xac3057[_0x3bad('0x1c')](_0x296dcb);}return _0xac3057['status'](_0x296dcb)[_0x3bad('0x1d')]();};}function respondWithResult(_0x3ecabf,_0x31b201){_0x31b201=_0x31b201||0xc8;return function(_0x44055e){if(_0x44055e){return _0x3ecabf[_0x3bad('0x1e')](_0x31b201)[_0x3bad('0x1f')](_0x44055e);}};}function respondWithFilteredResult(_0x218014,_0x5b53b2){return function(_0x25e91f){if(_0x25e91f){var _0x120959=_0x25e91f[_0x3bad('0x20')],_0x3eaf06=_0x5b53b2[_0x3bad('0x21')],_0x18b8f7=_0x5b53b2[_0x3bad('0x21')]+_0x5b53b2[_0x3bad('0x22')],_0x555b33;if(_0x18b8f7>=_0x120959){_0x18b8f7=_0x120959;_0x555b33=0xc8;}else{_0x555b33=0xce;}_0x218014[_0x3bad('0x1e')](_0x555b33);return _0x218014[_0x3bad('0x23')]('Content-Range',_0x3eaf06+'-'+_0x18b8f7+'/'+_0x120959)['json'](_0x25e91f);}return null;};}function patchUpdates(_0x3c3e10){return function(_0x3efb38){try{jsonpatch[_0x3bad('0x24')](_0x3efb38,_0x3c3e10,!![]);}catch(_0x4e1978){return BPromise[_0x3bad('0x25')](_0x4e1978);}return _0x3efb38[_0x3bad('0x26')]();};}function saveUpdates(_0x3d854b,_0xda61cb){return function(_0x449f5d){if(_0x449f5d){return _0x449f5d[_0x3bad('0x27')](_0x3d854b)[_0x3bad('0x28')](function(_0x186f2d){return _0x186f2d;});}return null;};}function removeEntity(_0x1a3289,_0x9a9684){return function(_0x15ad98){if(_0x15ad98){return _0x15ad98[_0x3bad('0x29')]()['then'](function(){_0x1a3289[_0x3bad('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x793d05,_0x669259){return function(_0x4164c5){if(!_0x4164c5){_0x793d05[_0x3bad('0x1c')](0x194);}return _0x4164c5;};}function handleError(_0x3e1d7d,_0x46c7ad){_0x46c7ad=_0x46c7ad||0x1f4;return function(_0x4d6b5b){logger[_0x3bad('0x2a')](_0x4d6b5b['stack']);if(_0x4d6b5b[_0x3bad('0x2b')]){delete _0x4d6b5b[_0x3bad('0x2b')];}_0x3e1d7d[_0x3bad('0x1e')](_0x46c7ad)[_0x3bad('0x2c')](_0x4d6b5b);};}exports[_0x3bad('0x2d')]=function(_0x3d8fe8,_0x5072f5){var _0x35b51e={},_0x33b772={},_0x53ab91={'count':0x0,'rows':[]};var _0x59504a=_[_0x3bad('0x2e')](db[_0x3bad('0x2f')][_0x3bad('0x30')],function(_0x5b3eef){return{'name':_0x5b3eef[_0x3bad('0x31')],'type':_0x5b3eef[_0x3bad('0x32')][_0x3bad('0x33')]};});_0x33b772['model']=_[_0x3bad('0x2e')](_0x59504a,_0x3bad('0x2b'));_0x33b772[_0x3bad('0x34')]=_[_0x3bad('0x35')](_0x3d8fe8[_0x3bad('0x34')]);_0x33b772['filters']=_[_0x3bad('0x36')](_0x33b772['model'],_0x33b772[_0x3bad('0x34')]);_0x35b51e[_0x3bad('0x37')]=_['intersection'](_0x33b772['model'],qs[_0x3bad('0x38')](_0x3d8fe8['query'][_0x3bad('0x38')]));_0x35b51e['attributes']=_0x35b51e['attributes'][_0x3bad('0x39')]?_0x35b51e['attributes']:_0x33b772[_0x3bad('0x3a')];if(!_0x3d8fe8[_0x3bad('0x34')][_0x3bad('0x3b')]('nolimit')){_0x35b51e[_0x3bad('0x22')]=qs[_0x3bad('0x22')](_0x3d8fe8[_0x3bad('0x34')]['limit']);_0x35b51e[_0x3bad('0x21')]=qs[_0x3bad('0x21')](_0x3d8fe8['query'][_0x3bad('0x21')]);}_0x35b51e[_0x3bad('0x3c')]=qs['sort'](_0x3d8fe8[_0x3bad('0x34')][_0x3bad('0x3d')]);_0x35b51e[_0x3bad('0x3e')]=qs['filters'](_['pick'](_0x3d8fe8[_0x3bad('0x34')],_0x33b772[_0x3bad('0x3f')]),_0x59504a);if(_0x3d8fe8[_0x3bad('0x34')][_0x3bad('0x40')]){_0x35b51e[_0x3bad('0x3e')]=_['merge'](_0x35b51e[_0x3bad('0x3e')],{'$or':_[_0x3bad('0x2e')](_0x59504a,function(_0x4c1e31){if(_0x4c1e31['type']!=='VIRTUAL'){var _0x3921ed={};_0x3921ed[_0x4c1e31[_0x3bad('0x2b')]]={'$like':'%'+_0x3d8fe8[_0x3bad('0x34')][_0x3bad('0x40')]+'%'};return _0x3921ed;}})});}_0x35b51e=_['merge']({},_0x35b51e,_0x3d8fe8[_0x3bad('0x41')]);var _0x13b0c9={'where':_0x35b51e['where']};return db['Migration'][_0x3bad('0x20')](_0x13b0c9)[_0x3bad('0x28')](function(_0x444c7b){_0x53ab91[_0x3bad('0x20')]=_0x444c7b;if(_0x3d8fe8['query'][_0x3bad('0x42')]){_0x35b51e['include']=[{'all':!![]}];}return db[_0x3bad('0x2f')][_0x3bad('0x43')](_0x35b51e);})[_0x3bad('0x28')](function(_0x1bcc30){_0x53ab91[_0x3bad('0x44')]=_0x1bcc30;return _0x53ab91;})['then'](respondWithFilteredResult(_0x5072f5,_0x35b51e))[_0x3bad('0x45')](handleError(_0x5072f5,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e4c41ed..842e965 100644 --- a/server/api/migration/migration.model.js +++ b/server/api/migration/migration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1186=['request-promise','path','../../config/environment','exports','Migration','migrations','util','api'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1186,0xbe));var _0x6118=function(_0x479f2c,_0x40927a){_0x479f2c=_0x479f2c-0x0;var _0x4bd5e5=_0x1186[_0x479f2c];return _0x4bd5e5;};'use strict';var _=require('lodash');var util=require(_0x6118('0x0'));var logger=require('../../config/logger')(_0x6118('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6118('0x2'));var fs=require('fs');var path=require(_0x6118('0x3'));var rimraf=require('rimraf');var config=require(_0x6118('0x4'));var attributes=require('./migration.attributes');module[_0x6118('0x5')]=function(_0x536a58,_0x9d46dc){return _0x536a58['define'](_0x6118('0x6'),attributes,{'tableName':_0x6118('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe09e=['bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment'];(function(_0x4a878b,_0x47078d){var _0x13d337=function(_0x32833b){while(--_0x32833b){_0x4a878b['push'](_0x4a878b['shift']());}};_0x13d337(++_0x47078d);}(_0xe09e,0x13e));var _0xee09=function(_0x491ee7,_0x34c385){_0x491ee7=_0x491ee7-0x0;var _0x4374d3=_0xe09e[_0x491ee7];return _0x4374d3;};'use strict';var _=require(_0xee09('0x0'));var util=require('util');var logger=require(_0xee09('0x1'))(_0xee09('0x2'));var moment=require(_0xee09('0x3'));var BPromise=require(_0xee09('0x4'));var rp=require(_0xee09('0x5'));var fs=require('fs');var path=require(_0xee09('0x6'));var rimraf=require(_0xee09('0x7'));var config=require(_0xee09('0x8'));var attributes=require(_0xee09('0x9'));module[_0xee09('0xa')]=function(_0x46d362,_0x2ed5d8){return _0x46d362[_0xee09('0xb')](_0xee09('0xc'),attributes,{'tableName':_0xee09('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 18b63e4..959b986 100644 --- a/server/api/migration/migration.rpc.js +++ b/server/api/migration/migration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d8b=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x0d8b,0x1e6));var _0xb0d8=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0x0d8b[_0x44b7d6];return _0x5346f0;};'use strict';var _=require('lodash');var util=require(_0xb0d8('0x0'));var moment=require(_0xb0d8('0x1'));var BPromise=require(_0xb0d8('0x2'));var rs=require(_0xb0d8('0x3'));var fs=require('fs');var Redis=require(_0xb0d8('0x4'));var db=require(_0xb0d8('0x5'))['db'];var utils=require(_0xb0d8('0x6'));var logger=require('../../config/logger')(_0xb0d8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb0d8('0x8')][_0xb0d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c13be,_0x243b42,_0x326bad){return new BPromise(function(_0x24b91d,_0x2281e7){return client[_0xb0d8('0xa')](_0x2c13be,_0x326bad)[_0xb0d8('0xb')](function(_0x481a66){logger[_0xb0d8('0xc')](_0xb0d8('0xd'),_0x243b42,_0xb0d8('0xe'));logger[_0xb0d8('0xf')](_0xb0d8('0x10'),_0x243b42,'request\x20sent',JSON[_0xb0d8('0x11')](_0x481a66));if(_0x481a66[_0xb0d8('0x12')]){if(_0x481a66[_0xb0d8('0x12')][_0xb0d8('0x13')]===0x1f4){logger[_0xb0d8('0x12')](_0xb0d8('0xd'),_0x243b42,_0x481a66[_0xb0d8('0x12')][_0xb0d8('0x14')]);return _0x2281e7(_0x481a66[_0xb0d8('0x12')][_0xb0d8('0x14')]);}logger['error']('Migration,\x20%s,\x20%s',_0x243b42,_0x481a66['error'][_0xb0d8('0x14')]);return _0x24b91d(_0x481a66[_0xb0d8('0x12')][_0xb0d8('0x14')]);}else{logger[_0xb0d8('0xc')](_0xb0d8('0xd'),_0x243b42,_0xb0d8('0xe'));_0x24b91d(_0x481a66[_0xb0d8('0x15')][_0xb0d8('0x14')]);}})[_0xb0d8('0x16')](function(_0x326f42){logger['error'](_0xb0d8('0xd'),_0x243b42,_0x326f42);_0x2281e7(_0x326f42);});});} \ No newline at end of file +var _0x983f=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x983f,0xd3));var _0xf983=function(_0x48cc9d,_0x5f2c54){_0x48cc9d=_0x48cc9d-0x0;var _0x477f55=_0x983f[_0x48cc9d];return _0x477f55;};'use strict';var _=require('lodash');var util=require(_0xf983('0x0'));var moment=require(_0xf983('0x1'));var BPromise=require('bluebird');var rs=require(_0xf983('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf983('0x3'))['db'];var utils=require(_0xf983('0x4'));var logger=require(_0xf983('0x5'))(_0xf983('0x6'));var config=require(_0xf983('0x7'));var jayson=require(_0xf983('0x8'));var client=jayson['client'][_0xf983('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x117fa4,_0x1b4d92,_0x164d82){return new BPromise(function(_0x4ab230,_0x560d0e){return client[_0xf983('0xa')](_0x117fa4,_0x164d82)[_0xf983('0xb')](function(_0x14ef3f){logger[_0xf983('0xc')](_0xf983('0xd'),_0x1b4d92,_0xf983('0xe'));logger['debug'](_0xf983('0xf'),_0x1b4d92,'request\x20sent',JSON[_0xf983('0x10')](_0x14ef3f));if(_0x14ef3f[_0xf983('0x11')]){if(_0x14ef3f['error'][_0xf983('0x12')]===0x1f4){logger[_0xf983('0x11')]('Migration,\x20%s,\x20%s',_0x1b4d92,_0x14ef3f['error'][_0xf983('0x13')]);return _0x560d0e(_0x14ef3f[_0xf983('0x11')][_0xf983('0x13')]);}logger['error'](_0xf983('0xd'),_0x1b4d92,_0x14ef3f[_0xf983('0x11')]['message']);return _0x4ab230(_0x14ef3f[_0xf983('0x11')][_0xf983('0x13')]);}else{logger[_0xf983('0xc')](_0xf983('0xd'),_0x1b4d92,'request\x20sent');_0x4ab230(_0x14ef3f[_0xf983('0x14')][_0xf983('0x13')]);}})[_0xf983('0x15')](function(_0x36a2d0){logger[_0xf983('0x11')](_0xf983('0xd'),_0x1b4d92,_0x36a2d0);_0x560d0e(_0x36a2d0);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index dc53763..85513b4 100644 --- a/server/api/network/index.js +++ b/server/api/network/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cf7=['util','path','connect-timeout','express','Router','../../config/environment','./network.controller','/:id','isAuthenticated','show','create','put','update','destroy','exports'];(function(_0x4f704e,_0xbad62a){var _0x2ef78f=function(_0x2fda1a){while(--_0x2fda1a){_0x4f704e['push'](_0x4f704e['shift']());}};_0x2ef78f(++_0xbad62a);}(_0x5cf7,0x87));var _0x75cf=function(_0x359413,_0x2a6dd2){_0x359413=_0x359413-0x0;var _0x5f217f=_0x5cf7[_0x359413];return _0x5f217f;};'use strict';var multer=require('multer');var util=require(_0x75cf('0x0'));var path=require(_0x75cf('0x1'));var timeout=require(_0x75cf('0x2'));var express=require(_0x75cf('0x3'));var router=express[_0x75cf('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x75cf('0x5'));var controller=require(_0x75cf('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x75cf('0x7'),auth[_0x75cf('0x8')](),controller[_0x75cf('0x9')]);router['post']('/',auth[_0x75cf('0x8')](),controller[_0x75cf('0xa')]);router[_0x75cf('0xb')](_0x75cf('0x7'),auth[_0x75cf('0x8')](),controller[_0x75cf('0xc')]);router['delete'](_0x75cf('0x7'),auth[_0x75cf('0x8')](),controller[_0x75cf('0xd')]);module[_0x75cf('0xe')]=router; \ No newline at end of file +var _0x4325=['util','connect-timeout','express','Router','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','create','put','update','exports'];(function(_0x12a815,_0x472253){var _0x5dbdb5=function(_0x53eb88){while(--_0x53eb88){_0x12a815['push'](_0x12a815['shift']());}};_0x5dbdb5(++_0x472253);}(_0x4325,0x159));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x5432('0x0'));var path=require('path');var timeout=require(_0x5432('0x1'));var express=require(_0x5432('0x2'));var router=express[_0x5432('0x3')]();var auth=require(_0x5432('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5432('0x5'));router[_0x5432('0x6')]('/',auth[_0x5432('0x7')](),controller[_0x5432('0x8')]);router[_0x5432('0x6')](_0x5432('0x9'),auth['isAuthenticated'](),controller[_0x5432('0xa')]);router['post']('/',auth[_0x5432('0x7')](),controller[_0x5432('0xb')]);router[_0x5432('0xc')](_0x5432('0x9'),auth[_0x5432('0x7')](),controller[_0x5432('0xd')]);router['delete'](_0x5432('0x9'),auth[_0x5432('0x7')](),controller['destroy']);module[_0x5432('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 93a3268..e70a778 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x48ff6e,_0x4fe545){var _0x1ba545=function(_0x281d64){while(--_0x281d64){_0x48ff6e['push'](_0x48ff6e['shift']());}};_0x1ba545(++_0x4fe545);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x15ef42,_0x4d62d3){var _0x3184b1=function(_0x8ea0df){while(--_0x8ea0df){_0x15ef42['push'](_0x15ef42['shift']());}};_0x3184b1(++_0x4d62d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ca174f3..fbd1358 100644 --- a/server/api/network/network.controller.js +++ b/server/api/network/network.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236c=['toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','create','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','sequelize','find','chan_sip.so','params','toLowerCase','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','destroy','name','index','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','transaction','body'];(function(_0x4eb86f,_0x2f11d4){var _0x453cf5=function(_0x38cc95){while(--_0x38cc95){_0x4eb86f['push'](_0x4eb86f['shift']());}};_0x453cf5(++_0x2f11d4);}(_0x236c,0xec));var _0xc236=function(_0x10d87f,_0x32db8d){_0x10d87f=_0x10d87f-0x0;var _0x359f2a=_0x236c[_0x10d87f];return _0x359f2a;};'use strict';var pdf=require(_0xc236('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require(_0xc236('0x6'));var util=require(_0xc236('0x7'));var path=require(_0xc236('0x8'));var sox=require(_0xc236('0x9'));var csv=require(_0xc236('0xa'));var ejs=require(_0xc236('0xb'));var fs=require('fs');var _=require(_0xc236('0xc'));var squel=require(_0xc236('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc236('0xe'));var toCsv=require(_0xc236('0xa'));var querystring=require('querystring');var Papa=require(_0xc236('0xf'));var Redis=require(_0xc236('0x10'));var authService=require(_0xc236('0x11'));var qs=require(_0xc236('0x12'));var as=require(_0xc236('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc236('0x14'))(_0xc236('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc236('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc236('0x17')][_0xc236('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1f5609,_0x5d6863,_0x5f442e,_0x59b5ac){return new BPromise(function(_0xa1bc88,_0x441e05){var _0x49d18f=_0x59b5ac||client;return _0x49d18f[_0xc236('0x19')](_0x1f5609,_0x5f442e)[_0xc236('0x1a')](function(_0x32c483){logger['info'](_0xc236('0x1b'),_0x5d6863,_0xc236('0x1c'));logger[_0xc236('0x1d')](_0xc236('0x1e'),_0x5d6863,'request\x20sent',JSON[_0xc236('0x1f')](_0x32c483));if(_0x32c483['error']){if(_0x32c483[_0xc236('0x20')][_0xc236('0x21')]===0x1f4){logger[_0xc236('0x20')]('Network,\x20%s,\x20%s',_0x5d6863,_0x32c483[_0xc236('0x20')][_0xc236('0x22')]);return _0x441e05(_0x32c483[_0xc236('0x20')][_0xc236('0x22')]);}logger['error']('Network,\x20%s,\x20%s',_0x5d6863,_0x32c483['error']['message']);return _0xa1bc88(_0x32c483[_0xc236('0x20')]['message']);}else{logger[_0xc236('0x23')](_0xc236('0x1b'),_0x5d6863,_0xc236('0x1c'));_0xa1bc88(_0x32c483[_0xc236('0x24')][_0xc236('0x22')]);}})[_0xc236('0x25')](function(_0x2a06f8){logger['error'](_0xc236('0x1b'),_0x5d6863,_0x2a06f8);_0x441e05(_0x2a06f8);});});}function respondWithStatusCode(_0x18fe97,_0x3a684d){_0x3a684d=_0x3a684d||0xcc;return function(_0x43a6e0){if(_0x43a6e0){return _0x18fe97[_0xc236('0x26')](_0x3a684d);}return _0x18fe97[_0xc236('0x27')](_0x3a684d)[_0xc236('0x28')]();};}function respondWithResult(_0x30f863,_0xd76b3b){_0xd76b3b=_0xd76b3b||0xc8;return function(_0x4529df){if(_0x4529df){return _0x30f863[_0xc236('0x27')](_0xd76b3b)[_0xc236('0x29')](_0x4529df);}};}function respondWithFilteredResult(_0x2093a4,_0x23a951){return function(_0x37bff8){if(_0x37bff8){var _0x2584bb=_0x37bff8[_0xc236('0x2a')],_0xdd735f=_0x23a951[_0xc236('0x2b')],_0x5dc232=_0x23a951[_0xc236('0x2b')]+_0x23a951[_0xc236('0x2c')],_0x12b0cc;if(_0x5dc232>=_0x2584bb){_0x5dc232=_0x2584bb;_0x12b0cc=0xc8;}else{_0x12b0cc=0xce;}_0x2093a4['status'](_0x12b0cc);return _0x2093a4['set'](_0xc236('0x2d'),_0xdd735f+'-'+_0x5dc232+'/'+_0x2584bb)[_0xc236('0x29')](_0x37bff8);}return null;};}function patchUpdates(_0x4ef417){return function(_0x24229a){try{jsonpatch['apply'](_0x24229a,_0x4ef417,!![]);}catch(_0x52dca6){return BPromise['reject'](_0x52dca6);}return _0x24229a[_0xc236('0x2e')]();};}function saveUpdates(_0x759534,_0x26d61c){return function(_0x43130d){if(_0x43130d){return _0x43130d[_0xc236('0x2f')](_0x759534)[_0xc236('0x1a')](function(_0x3cf1a3){return _0x3cf1a3;});}return null;};}function removeEntity(_0x3f0b40,_0x4d0c5b){return function(_0x1249c2){if(_0x1249c2){return _0x1249c2[_0xc236('0x30')]()[_0xc236('0x1a')](function(){_0x3f0b40[_0xc236('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb838,_0x3be3a2){return function(_0x4bf253){if(!_0x4bf253){_0x5cb838['sendStatus'](0x194);}return _0x4bf253;};}function handleError(_0x1b7713,_0x23e585){_0x23e585=_0x23e585||0x1f4;return function(_0x4708c9){logger[_0xc236('0x20')](_0x4708c9['stack']);if(_0x4708c9[_0xc236('0x31')]){delete _0x4708c9[_0xc236('0x31')];}_0x1b7713[_0xc236('0x27')](_0x23e585)['send'](_0x4708c9);};}exports[_0xc236('0x32')]=function(_0x4aa121,_0x2461f9){var _0x8e429f={},_0x2f3813={},_0x2f29aa={'count':0x0,'rows':[]};var _0x54390a=_[_0xc236('0x33')](db[_0xc236('0x34')][_0xc236('0x35')],function(_0x2c259d){return{'name':_0x2c259d[_0xc236('0x36')],'type':_0x2c259d[_0xc236('0x37')][_0xc236('0x38')]};});_0x2f3813['model']=_['map'](_0x54390a,'name');_0x2f3813[_0xc236('0x39')]=_[_0xc236('0x3a')](_0x4aa121[_0xc236('0x39')]);_0x2f3813[_0xc236('0x3b')]=_[_0xc236('0x3c')](_0x2f3813[_0xc236('0x3d')],_0x2f3813['query']);_0x8e429f[_0xc236('0x3e')]=_['intersection'](_0x2f3813[_0xc236('0x3d')],qs[_0xc236('0x3f')](_0x4aa121[_0xc236('0x39')]['fields']));_0x8e429f['attributes']=_0x8e429f[_0xc236('0x3e')][_0xc236('0x40')]?_0x8e429f[_0xc236('0x3e')]:_0x2f3813['model'];if(!_0x4aa121[_0xc236('0x39')][_0xc236('0x41')](_0xc236('0x42'))){_0x8e429f[_0xc236('0x2c')]=qs[_0xc236('0x2c')](_0x4aa121[_0xc236('0x39')][_0xc236('0x2c')]);_0x8e429f['offset']=qs['offset'](_0x4aa121[_0xc236('0x39')][_0xc236('0x2b')]);}_0x8e429f[_0xc236('0x43')]=qs[_0xc236('0x44')](_0x4aa121[_0xc236('0x39')]['sort']);_0x8e429f[_0xc236('0x45')]=qs[_0xc236('0x3b')](_[_0xc236('0x46')](_0x4aa121['query'],_0x2f3813[_0xc236('0x3b')]),_0x54390a);if(_0x4aa121[_0xc236('0x39')][_0xc236('0x47')]){_0x8e429f[_0xc236('0x45')]=_[_0xc236('0x48')](_0x8e429f[_0xc236('0x45')],{'$or':_[_0xc236('0x33')](_0x54390a,function(_0x787169){if(_0x787169['type']!==_0xc236('0x49')){var _0x5be02e={};_0x5be02e[_0x787169[_0xc236('0x31')]]={'$like':'%'+_0x4aa121['query'][_0xc236('0x47')]+'%'};return _0x5be02e;}})});}_0x8e429f=_[_0xc236('0x48')]({},_0x8e429f,_0x4aa121[_0xc236('0x4a')]);var _0x163e45={'where':_0x8e429f[_0xc236('0x45')]};return db[_0xc236('0x34')]['count'](_0x163e45)[_0xc236('0x1a')](function(_0x2036a5){_0x2f29aa[_0xc236('0x2a')]=_0x2036a5;if(_0x4aa121[_0xc236('0x39')][_0xc236('0x4b')]){_0x8e429f[_0xc236('0x4c')]=[{'all':!![]}];}return db[_0xc236('0x34')][_0xc236('0x4d')](_0x8e429f);})[_0xc236('0x1a')](function(_0x13f75a){_0x2f29aa[_0xc236('0x4e')]=_0x13f75a;return _0x2f29aa;})[_0xc236('0x1a')](respondWithFilteredResult(_0x2461f9,_0x8e429f))['catch'](handleError(_0x2461f9,null));};exports[_0xc236('0x4f')]=function(_0x539408,_0x28de27){var _0x105f55={'raw':!![],'where':{'id':_0x539408['params']['id']}},_0x2f5912={};_0x2f5912[_0xc236('0x3d')]=_[_0xc236('0x3a')](db[_0xc236('0x34')][_0xc236('0x35')]);_0x2f5912[_0xc236('0x39')]=_[_0xc236('0x3a')](_0x539408[_0xc236('0x39')]);_0x2f5912[_0xc236('0x3b')]=_[_0xc236('0x3c')](_0x2f5912[_0xc236('0x3d')],_0x2f5912[_0xc236('0x39')]);_0x105f55[_0xc236('0x3e')]=_[_0xc236('0x3c')](_0x2f5912[_0xc236('0x3d')],qs[_0xc236('0x3f')](_0x539408[_0xc236('0x39')][_0xc236('0x3f')]));_0x105f55[_0xc236('0x3e')]=_0x105f55[_0xc236('0x3e')][_0xc236('0x40')]?_0x105f55['attributes']:_0x2f5912[_0xc236('0x3d')];if(_0x539408['query'][_0xc236('0x4b')]){_0x105f55['include']=[{'all':!![]}];}_0x105f55=_[_0xc236('0x48')]({},_0x105f55,_0x539408[_0xc236('0x4a')]);return db[_0xc236('0x34')]['find'](_0x105f55)['then'](handleEntityNotFound(_0x28de27,null))[_0xc236('0x1a')](respondWithResult(_0x28de27,null))[_0xc236('0x25')](handleError(_0x28de27,null));};exports['create']=function(_0x4887ad,_0x3d1507,_0x22d03d){var _0x31f18b;return db['sequelize'][_0xc236('0x50')](function(_0x2ec53e){return db[_0xc236('0x34')]['create'](_0x4887ad['body'],{'raw':!![]})[_0xc236('0x1a')](function(_0x572771){_0x31f18b=_0x572771;return db[_0xc236('0x34')]['findAll']({'where':{'type':_0x4887ad[_0xc236('0x51')][_0xc236('0x37')]},'raw':!![]});})[_0xc236('0x1a')](function(_0xa05f4a){if(_0x31f18b['type'][_0xc236('0x52')]()==_0xc236('0x53')){var _0xb7180b=fs[_0xc236('0x54')](path[_0xc236('0x55')](config[_0xc236('0x56')],_0xc236('0x57')),_0xc236('0x58'));var _0x527081=ejs[_0xc236('0x59')](_0xb7180b,{'networks':_0xa05f4a||[]});fs['writeFileSync'](_0xc236('0x5a'),_0x527081);return respondWithRpcPromise(_0xc236('0x5b'),_0xc236('0x5c'),{'module':_0xc236('0x5d')});}else if(_0x31f18b[_0xc236('0x37')]['toUpperCase']()==_0xc236('0x5e')){var _0x1ccf33=fs[_0xc236('0x54')](path[_0xc236('0x55')](config[_0xc236('0x56')],_0xc236('0x5f')),'utf8');var _0x9a788a=ejs[_0xc236('0x59')](_0x1ccf33,{'networks':_0xa05f4a||[]});fs[_0xc236('0x60')](_0xc236('0x61'),_0x9a788a);return respondWithRpcPromise(_0xc236('0x5b'),_0xc236('0x5c'),{'module':_0xc236('0x5d')});}else{var _0x545c17=fs[_0xc236('0x54')](path[_0xc236('0x55')](config[_0xc236('0x56')],_0xc236('0x62')),'utf8');var _0x51414b=ejs['render'](_0x545c17,{'networks':_0xa05f4a||[]});fs[_0xc236('0x60')](util[_0xc236('0x63')](_0xc236('0x64'),_0x4887ad[_0xc236('0x51')][_0xc236('0x37')]['toLowerCase']()),_0x51414b);return respondWithRpcPromise(_0xc236('0x5b'),_0xc236('0x5c'),{'module':'chan_sip.so'});}return null;})[_0xc236('0x1a')](function(){return _0x31f18b;});})[_0xc236('0x1a')](respondWithResult(_0x3d1507,0xc9))[_0xc236('0x25')](handleError(_0x3d1507,null));};exports[_0xc236('0x2f')]=function(_0x1a28b6,_0x891bd2,_0x144e57){var _0x21fc9b;return db[_0xc236('0x65')][_0xc236('0x50')](function(_0x1c5ac2){return db['Network'][_0xc236('0x66')]({'where':{'id':_0x1a28b6['params']['id']}})[_0xc236('0x1a')](handleEntityNotFound(_0x891bd2,null))[_0xc236('0x1a')](saveUpdates(_0x1a28b6[_0xc236('0x51')],null))[_0xc236('0x1a')](function(_0x161523){if(_0x161523){_0x21fc9b=_0x161523;return db[_0xc236('0x34')][_0xc236('0x4d')]({'where':{'type':_0x21fc9b[_0xc236('0x37')]},'raw':!![]});}return null;})['then'](function(_0x3c4083){if(_0x21fc9b[_0xc236('0x37')][_0xc236('0x52')]()==_0xc236('0x53')){var _0xc38d6b=fs[_0xc236('0x54')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0xc236('0x58'));var _0x4b7cb7=ejs[_0xc236('0x59')](_0xc38d6b,{'networks':_0x3c4083||[]});fs['writeFileSync'](_0xc236('0x5a'),_0x4b7cb7);return respondWithRpcPromise(_0xc236('0x5b'),_0xc236('0x2f'),{'module':_0xc236('0x5d')});}else if(_0x21fc9b[_0xc236('0x37')][_0xc236('0x52')]()==_0xc236('0x5e')){var _0x1c50e7=fs['readFileSync'](path['join'](config[_0xc236('0x56')],_0xc236('0x5f')),'utf8');var _0x5e7e1d=ejs['render'](_0x1c50e7,{'networks':_0x3c4083||[]});fs[_0xc236('0x60')](_0xc236('0x61'),_0x5e7e1d);return respondWithRpcPromise(_0xc236('0x5b'),_0xc236('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0xdb6fe=fs[_0xc236('0x54')](path[_0xc236('0x55')](config[_0xc236('0x56')],_0xc236('0x62')),_0xc236('0x58'));var _0x362e53=ejs[_0xc236('0x59')](_0xdb6fe,{'networks':_0x3c4083||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1a28b6[_0xc236('0x51')]['type']['toLowerCase']()),_0x362e53);return respondWithRpcPromise(_0xc236('0x5b'),_0xc236('0x2f'),{'module':_0xc236('0x67')});}return null;})[_0xc236('0x1a')](function(_0x56feaa){if(_0x56feaa){return _0x21fc9b;}return null;});})[_0xc236('0x1a')](respondWithResult(_0x891bd2,null))[_0xc236('0x25')](handleError(_0x891bd2,null));};exports[_0xc236('0x30')]=function(_0x931948,_0x16d512,_0x2f5354){var _0x2da097;return db[_0xc236('0x34')]['find']({'where':{'id':_0x931948[_0xc236('0x68')]['id']}})[_0xc236('0x1a')](function(_0x37c8c5){_0x2da097=_0x37c8c5;return _0x37c8c5;})['then'](handleEntityNotFound(_0x16d512,null))[_0xc236('0x1a')](removeEntity(_0x16d512,null))[_0xc236('0x1a')](function(){if(_0x2da097){return db[_0xc236('0x34')]['findAll']({'where':{'type':_0x2da097[_0xc236('0x37')]},'raw':!![]});}})[_0xc236('0x1a')](function(_0x5b13a5){if(_0x2da097[_0xc236('0x37')][_0xc236('0x52')]()==_0xc236('0x53')){var _0x34f6cc=fs[_0xc236('0x54')](path[_0xc236('0x55')](config[_0xc236('0x56')],_0xc236('0x57')),_0xc236('0x58'));var _0x32a935=ejs[_0xc236('0x59')](_0x34f6cc,{'networks':_0x5b13a5||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x32a935);return respondWithRpcPromise(_0xc236('0x5b'),_0xc236('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x2da097[_0xc236('0x37')]['toUpperCase']()==_0xc236('0x5e')){var _0x1e98a4=fs['readFileSync'](path[_0xc236('0x55')](config[_0xc236('0x56')],_0xc236('0x5f')),_0xc236('0x58'));var _0x3454f3=ejs[_0xc236('0x59')](_0x1e98a4,{'networks':_0x5b13a5||[]});fs[_0xc236('0x60')](_0xc236('0x61'),_0x3454f3);return respondWithRpcPromise(_0xc236('0x5b'),_0xc236('0x30'),{'module':_0xc236('0x5d')});}else{var _0x48e8e3=fs[_0xc236('0x54')](path[_0xc236('0x55')](config[_0xc236('0x56')],_0xc236('0x62')),_0xc236('0x58'));var _0x55fd05=ejs[_0xc236('0x59')](_0x48e8e3,{'networks':_0x5b13a5||[]});fs['writeFileSync'](util[_0xc236('0x63')](_0xc236('0x64'),_0x931948[_0xc236('0x51')][_0xc236('0x37')][_0xc236('0x69')]()),_0x55fd05);return respondWithRpcPromise(_0xc236('0x5b'),_0xc236('0x30'),{'module':_0xc236('0x67')});}return null;})[_0xc236('0x25')](handleError(_0x16d512,null));}; \ No newline at end of file +var _0xbfeb=['toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','Network','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','find','create','sequelize','transaction','body','toUpperCase','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','/etc/asterisk/turn_xcally.conf','Reload','readFileSync','format','/etc/asterisk/sip_xcally_%s.conf'];(function(_0xef5f0f,_0x35b798){var _0xd3b8d=function(_0x18abe4){while(--_0x18abe4){_0xef5f0f['push'](_0xef5f0f['shift']());}};_0xd3b8d(++_0x35b798);}(_0xbfeb,0x6c));var _0xbbfe=function(_0x5e18f2,_0x43d1ee){_0x5e18f2=_0x5e18f2-0x0;var _0x14d1ac=_0xbfeb[_0x5e18f2];return _0x14d1ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbfe('0x0'));var rimraf=require(_0xbbfe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbbfe('0x2'));var moment=require(_0xbbfe('0x3'));var BPromise=require(_0xbbfe('0x4'));var Mustache=require('mustache');var util=require(_0xbbfe('0x5'));var path=require(_0xbbfe('0x6'));var sox=require(_0xbbfe('0x7'));var csv=require(_0xbbfe('0x8'));var ejs=require(_0xbbfe('0x9'));var fs=require('fs');var _=require(_0xbbfe('0xa'));var squel=require('squel');var crypto=require(_0xbbfe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbbfe('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbbfe('0xd'));var Papa=require(_0xbbfe('0xe'));var Redis=require(_0xbbfe('0xf'));var authService=require(_0xbbfe('0x10'));var qs=require(_0xbbfe('0x11'));var as=require(_0xbbfe('0x12'));var hardwareService=require(_0xbbfe('0x13'));var logger=require(_0xbbfe('0x14'))(_0xbbfe('0x15'));var utils=require(_0xbbfe('0x16'));var config=require(_0xbbfe('0x17'));var licenseUtil=require(_0xbbfe('0x18'));var db=require(_0xbbfe('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x570a26,_0x164dfa,_0x5c9c85,_0x5e34bd){return new BPromise(function(_0x4b1c19,_0x298bf5){var _0x443ee1=_0x5e34bd||client;return _0x443ee1[_0xbbfe('0x1a')](_0x570a26,_0x5c9c85)[_0xbbfe('0x1b')](function(_0x7e51cb){logger[_0xbbfe('0x1c')](_0xbbfe('0x1d'),_0x164dfa,_0xbbfe('0x1e'));logger['debug'](_0xbbfe('0x1f'),_0x164dfa,_0xbbfe('0x1e'),JSON[_0xbbfe('0x20')](_0x7e51cb));if(_0x7e51cb[_0xbbfe('0x21')]){if(_0x7e51cb[_0xbbfe('0x21')]['code']===0x1f4){logger[_0xbbfe('0x21')]('Network,\x20%s,\x20%s',_0x164dfa,_0x7e51cb['error'][_0xbbfe('0x22')]);return _0x298bf5(_0x7e51cb[_0xbbfe('0x21')][_0xbbfe('0x22')]);}logger[_0xbbfe('0x21')]('Network,\x20%s,\x20%s',_0x164dfa,_0x7e51cb[_0xbbfe('0x21')][_0xbbfe('0x22')]);return _0x4b1c19(_0x7e51cb[_0xbbfe('0x21')][_0xbbfe('0x22')]);}else{logger[_0xbbfe('0x1c')]('Network,\x20%s,\x20%s',_0x164dfa,_0xbbfe('0x1e'));_0x4b1c19(_0x7e51cb['result']['message']);}})[_0xbbfe('0x23')](function(_0x5dee9e){logger['error'](_0xbbfe('0x1d'),_0x164dfa,_0x5dee9e);_0x298bf5(_0x5dee9e);});});}function respondWithStatusCode(_0x50b7d3,_0x1a9f48){_0x1a9f48=_0x1a9f48||0xcc;return function(_0x11d47f){if(_0x11d47f){return _0x50b7d3['sendStatus'](_0x1a9f48);}return _0x50b7d3['status'](_0x1a9f48)[_0xbbfe('0x24')]();};}function respondWithResult(_0x2887c7,_0x59c76a){_0x59c76a=_0x59c76a||0xc8;return function(_0x1472b1){if(_0x1472b1){return _0x2887c7[_0xbbfe('0x25')](_0x59c76a)[_0xbbfe('0x26')](_0x1472b1);}};}function respondWithFilteredResult(_0x1fb41e,_0x144a94){return function(_0x5460f2){if(_0x5460f2){var _0xed1e03=_0x5460f2['count'],_0x3a6cdd=_0x144a94['offset'],_0xc2dc59=_0x144a94[_0xbbfe('0x27')]+_0x144a94[_0xbbfe('0x28')],_0x427a6a;if(_0xc2dc59>=_0xed1e03){_0xc2dc59=_0xed1e03;_0x427a6a=0xc8;}else{_0x427a6a=0xce;}_0x1fb41e['status'](_0x427a6a);return _0x1fb41e[_0xbbfe('0x29')](_0xbbfe('0x2a'),_0x3a6cdd+'-'+_0xc2dc59+'/'+_0xed1e03)[_0xbbfe('0x26')](_0x5460f2);}return null;};}function patchUpdates(_0x3c074a){return function(_0x29359c){try{jsonpatch['apply'](_0x29359c,_0x3c074a,!![]);}catch(_0x207657){return BPromise[_0xbbfe('0x2b')](_0x207657);}return _0x29359c[_0xbbfe('0x2c')]();};}function saveUpdates(_0x1594ec,_0x1af057){return function(_0x316107){if(_0x316107){return _0x316107[_0xbbfe('0x2d')](_0x1594ec)[_0xbbfe('0x1b')](function(_0x3aa3a4){return _0x3aa3a4;});}return null;};}function removeEntity(_0xff3af3,_0x4f2952){return function(_0x3dfcb8){if(_0x3dfcb8){return _0x3dfcb8[_0xbbfe('0x2e')]()[_0xbbfe('0x1b')](function(){_0xff3af3[_0xbbfe('0x25')](0xcc)[_0xbbfe('0x24')]();});}};}function handleEntityNotFound(_0x25f870,_0x21b98a){return function(_0x2b5667){if(!_0x2b5667){_0x25f870[_0xbbfe('0x2f')](0x194);}return _0x2b5667;};}function handleError(_0x20f2c2,_0x4aea72){_0x4aea72=_0x4aea72||0x1f4;return function(_0x13e830){logger['error'](_0x13e830[_0xbbfe('0x30')]);if(_0x13e830[_0xbbfe('0x31')]){delete _0x13e830[_0xbbfe('0x31')];}_0x20f2c2[_0xbbfe('0x25')](_0x4aea72)[_0xbbfe('0x32')](_0x13e830);};}exports['index']=function(_0x2d966d,_0x1f0759){var _0xdc08eb={},_0x3e8e3b={},_0x154aa6={'count':0x0,'rows':[]};var _0x4070a7=_['map'](db[_0xbbfe('0x33')][_0xbbfe('0x34')],function(_0x1d1bda){return{'name':_0x1d1bda[_0xbbfe('0x35')],'type':_0x1d1bda[_0xbbfe('0x36')]['key']};});_0x3e8e3b[_0xbbfe('0x37')]=_[_0xbbfe('0x38')](_0x4070a7,'name');_0x3e8e3b[_0xbbfe('0x39')]=_['keys'](_0x2d966d[_0xbbfe('0x39')]);_0x3e8e3b[_0xbbfe('0x3a')]=_['intersection'](_0x3e8e3b[_0xbbfe('0x37')],_0x3e8e3b[_0xbbfe('0x39')]);_0xdc08eb[_0xbbfe('0x3b')]=_[_0xbbfe('0x3c')](_0x3e8e3b[_0xbbfe('0x37')],qs[_0xbbfe('0x3d')](_0x2d966d[_0xbbfe('0x39')][_0xbbfe('0x3d')]));_0xdc08eb[_0xbbfe('0x3b')]=_0xdc08eb[_0xbbfe('0x3b')][_0xbbfe('0x3e')]?_0xdc08eb[_0xbbfe('0x3b')]:_0x3e8e3b[_0xbbfe('0x37')];if(!_0x2d966d['query'][_0xbbfe('0x3f')](_0xbbfe('0x40'))){_0xdc08eb['limit']=qs[_0xbbfe('0x28')](_0x2d966d[_0xbbfe('0x39')][_0xbbfe('0x28')]);_0xdc08eb[_0xbbfe('0x27')]=qs[_0xbbfe('0x27')](_0x2d966d['query']['offset']);}_0xdc08eb['order']=qs['sort'](_0x2d966d[_0xbbfe('0x39')][_0xbbfe('0x41')]);_0xdc08eb[_0xbbfe('0x42')]=qs['filters'](_['pick'](_0x2d966d['query'],_0x3e8e3b[_0xbbfe('0x3a')]),_0x4070a7);if(_0x2d966d[_0xbbfe('0x39')]['filter']){_0xdc08eb['where']=_[_0xbbfe('0x43')](_0xdc08eb[_0xbbfe('0x42')],{'$or':_[_0xbbfe('0x38')](_0x4070a7,function(_0x594d3c){if(_0x594d3c[_0xbbfe('0x36')]!==_0xbbfe('0x44')){var _0x43d5af={};_0x43d5af[_0x594d3c[_0xbbfe('0x31')]]={'$like':'%'+_0x2d966d[_0xbbfe('0x39')][_0xbbfe('0x45')]+'%'};return _0x43d5af;}})});}_0xdc08eb=_['merge']({},_0xdc08eb,_0x2d966d[_0xbbfe('0x46')]);var _0x5b98a9={'where':_0xdc08eb['where']};return db[_0xbbfe('0x33')][_0xbbfe('0x47')](_0x5b98a9)[_0xbbfe('0x1b')](function(_0x1db055){_0x154aa6[_0xbbfe('0x47')]=_0x1db055;if(_0x2d966d['query'][_0xbbfe('0x48')]){_0xdc08eb[_0xbbfe('0x49')]=[{'all':!![]}];}return db[_0xbbfe('0x33')][_0xbbfe('0x4a')](_0xdc08eb);})['then'](function(_0x9bcda2){_0x154aa6[_0xbbfe('0x4b')]=_0x9bcda2;return _0x154aa6;})[_0xbbfe('0x1b')](respondWithFilteredResult(_0x1f0759,_0xdc08eb))[_0xbbfe('0x23')](handleError(_0x1f0759,null));};exports['show']=function(_0x112c7e,_0x5a1043){var _0x139e29={'raw':!![],'where':{'id':_0x112c7e[_0xbbfe('0x4c')]['id']}},_0x15557e={};_0x15557e[_0xbbfe('0x37')]=_['keys'](db['Network']['rawAttributes']);_0x15557e['query']=_['keys'](_0x112c7e[_0xbbfe('0x39')]);_0x15557e['filters']=_[_0xbbfe('0x3c')](_0x15557e['model'],_0x15557e[_0xbbfe('0x39')]);_0x139e29[_0xbbfe('0x3b')]=_[_0xbbfe('0x3c')](_0x15557e[_0xbbfe('0x37')],qs[_0xbbfe('0x3d')](_0x112c7e[_0xbbfe('0x39')][_0xbbfe('0x3d')]));_0x139e29[_0xbbfe('0x3b')]=_0x139e29[_0xbbfe('0x3b')][_0xbbfe('0x3e')]?_0x139e29[_0xbbfe('0x3b')]:_0x15557e[_0xbbfe('0x37')];if(_0x112c7e['query'][_0xbbfe('0x48')]){_0x139e29[_0xbbfe('0x49')]=[{'all':!![]}];}_0x139e29=_[_0xbbfe('0x43')]({},_0x139e29,_0x112c7e['options']);return db[_0xbbfe('0x33')][_0xbbfe('0x4d')](_0x139e29)[_0xbbfe('0x1b')](handleEntityNotFound(_0x5a1043,null))[_0xbbfe('0x1b')](respondWithResult(_0x5a1043,null))['catch'](handleError(_0x5a1043,null));};exports[_0xbbfe('0x4e')]=function(_0x1ac47f,_0x30d957,_0x524af1){var _0x422da3;return db[_0xbbfe('0x4f')][_0xbbfe('0x50')](function(_0x8c440b){return db[_0xbbfe('0x33')][_0xbbfe('0x4e')](_0x1ac47f[_0xbbfe('0x51')],{'raw':!![]})[_0xbbfe('0x1b')](function(_0x178eed){_0x422da3=_0x178eed;return db[_0xbbfe('0x33')][_0xbbfe('0x4a')]({'where':{'type':_0x1ac47f[_0xbbfe('0x51')]['type']},'raw':!![]});})[_0xbbfe('0x1b')](function(_0x91c010){if(_0x422da3[_0xbbfe('0x36')][_0xbbfe('0x52')]()==_0xbbfe('0x53')){var _0x39a612=fs['readFileSync'](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],'server/files/templates/stun_multiple.ejs'),_0xbbfe('0x56'));var _0x46e374=ejs[_0xbbfe('0x57')](_0x39a612,{'networks':_0x91c010||[]});fs[_0xbbfe('0x58')](_0xbbfe('0x59'),_0x46e374);return respondWithRpcPromise('Reload',_0xbbfe('0x4e'),{'module':_0xbbfe('0x5a')});}else if(_0x422da3['type']['toUpperCase']()=='TURN'){var _0x5e8750=fs['readFileSync'](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],'server/files/templates/turn_multiple.ejs'),_0xbbfe('0x56'));var _0x495825=ejs[_0xbbfe('0x57')](_0x5e8750,{'networks':_0x91c010||[]});fs['writeFileSync'](_0xbbfe('0x5b'),_0x495825);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x4e'),{'module':_0xbbfe('0x5a')});}else{var _0x327d6d=fs[_0xbbfe('0x5d')](path['join'](config[_0xbbfe('0x55')],'server/files/templates/network.ejs'),_0xbbfe('0x56'));var _0x36bb12=ejs[_0xbbfe('0x57')](_0x327d6d,{'networks':_0x91c010||[]});fs[_0xbbfe('0x58')](util[_0xbbfe('0x5e')](_0xbbfe('0x5f'),_0x1ac47f[_0xbbfe('0x51')][_0xbbfe('0x36')][_0xbbfe('0x60')]()),_0x36bb12);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x4e'),{'module':_0xbbfe('0x61')});}return null;})[_0xbbfe('0x1b')](function(){return _0x422da3;});})[_0xbbfe('0x1b')](respondWithResult(_0x30d957,0xc9))[_0xbbfe('0x23')](handleError(_0x30d957,null));};exports[_0xbbfe('0x2d')]=function(_0x165e51,_0x2d5177,_0x12faea){var _0x31d254;return db[_0xbbfe('0x4f')]['transaction'](function(_0x5c6454){return db[_0xbbfe('0x33')]['find']({'where':{'id':_0x165e51[_0xbbfe('0x4c')]['id']}})[_0xbbfe('0x1b')](handleEntityNotFound(_0x2d5177,null))['then'](saveUpdates(_0x165e51['body'],null))[_0xbbfe('0x1b')](function(_0x4630e3){if(_0x4630e3){_0x31d254=_0x4630e3;return db[_0xbbfe('0x33')][_0xbbfe('0x4a')]({'where':{'type':_0x31d254['type']},'raw':!![]});}return null;})[_0xbbfe('0x1b')](function(_0x36e7b2){if(_0x31d254[_0xbbfe('0x36')][_0xbbfe('0x52')]()==_0xbbfe('0x53')){var _0x1edef1=fs['readFileSync'](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x62')),_0xbbfe('0x56'));var _0x3fcbcf=ejs[_0xbbfe('0x57')](_0x1edef1,{'networks':_0x36e7b2||[]});fs[_0xbbfe('0x58')](_0xbbfe('0x59'),_0x3fcbcf);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2d'),{'module':'res_stun_monitor.so'});}else if(_0x31d254[_0xbbfe('0x36')][_0xbbfe('0x52')]()==_0xbbfe('0x63')){var _0x1dd21f=fs[_0xbbfe('0x5d')](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x64')),_0xbbfe('0x56'));var _0x452ff1=ejs[_0xbbfe('0x57')](_0x1dd21f,{'networks':_0x36e7b2||[]});fs[_0xbbfe('0x58')](_0xbbfe('0x5b'),_0x452ff1);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2d'),{'module':'res_stun_monitor.so'});}else{var _0x3c3447=fs[_0xbbfe('0x5d')](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x65')),_0xbbfe('0x56'));var _0x4e2fa5=ejs[_0xbbfe('0x57')](_0x3c3447,{'networks':_0x36e7b2||[]});fs[_0xbbfe('0x58')](util['format'](_0xbbfe('0x5f'),_0x165e51['body'][_0xbbfe('0x36')]['toLowerCase']()),_0x4e2fa5);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2d'),{'module':'chan_sip.so'});}return null;})[_0xbbfe('0x1b')](function(_0x6efcf){if(_0x6efcf){return _0x31d254;}return null;});})[_0xbbfe('0x1b')](respondWithResult(_0x2d5177,null))[_0xbbfe('0x23')](handleError(_0x2d5177,null));};exports[_0xbbfe('0x2e')]=function(_0x239628,_0x256a0c,_0x1f7b15){var _0x347be7;return db[_0xbbfe('0x33')]['find']({'where':{'id':_0x239628['params']['id']}})[_0xbbfe('0x1b')](function(_0x53e2ba){_0x347be7=_0x53e2ba;return _0x53e2ba;})[_0xbbfe('0x1b')](handleEntityNotFound(_0x256a0c,null))['then'](removeEntity(_0x256a0c,null))[_0xbbfe('0x1b')](function(){if(_0x347be7){return db[_0xbbfe('0x33')]['findAll']({'where':{'type':_0x347be7[_0xbbfe('0x36')]},'raw':!![]});}})['then'](function(_0x360d10){if(_0x347be7[_0xbbfe('0x36')][_0xbbfe('0x52')]()==_0xbbfe('0x53')){var _0x52876b=fs[_0xbbfe('0x5d')](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x62')),'utf8');var _0x49e9bb=ejs[_0xbbfe('0x57')](_0x52876b,{'networks':_0x360d10||[]});fs[_0xbbfe('0x58')]('/etc/asterisk/stun_xcally.conf',_0x49e9bb);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2e'),{'module':_0xbbfe('0x5a')});}else if(_0x347be7['type'][_0xbbfe('0x52')]()==_0xbbfe('0x63')){var _0x1477d3=fs[_0xbbfe('0x5d')](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x64')),_0xbbfe('0x56'));var _0x30a1b0=ejs[_0xbbfe('0x57')](_0x1477d3,{'networks':_0x360d10||[]});fs[_0xbbfe('0x58')]('/etc/asterisk/turn_xcally.conf',_0x30a1b0);return respondWithRpcPromise(_0xbbfe('0x5c'),'destroy',{'module':_0xbbfe('0x5a')});}else{var _0x542a04=fs['readFileSync'](path[_0xbbfe('0x54')](config['root'],_0xbbfe('0x65')),_0xbbfe('0x56'));var _0xe8766d=ejs[_0xbbfe('0x57')](_0x542a04,{'networks':_0x360d10||[]});fs[_0xbbfe('0x58')](util['format'](_0xbbfe('0x5f'),_0x239628[_0xbbfe('0x51')]['type'][_0xbbfe('0x60')]()),_0xe8766d);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2e'),{'module':_0xbbfe('0x61')});}return null;})['catch'](handleError(_0x256a0c,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6c08e6a..84c5756 100644 --- a/server/api/network/network.model.js +++ b/server/api/network/network.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8231=['request-promise','../../config/environment','./network.attributes','exports','define','Network','network','lodash','../../config/logger','api','bluebird'];(function(_0x2ba687,_0x4566ed){var _0xaa4e56=function(_0x25bd90){while(--_0x25bd90){_0x2ba687['push'](_0x2ba687['shift']());}};_0xaa4e56(++_0x4566ed);}(_0x8231,0x17d));var _0x1823=function(_0xc6b82a,_0x5d019f){_0xc6b82a=_0xc6b82a-0x0;var _0x5d51c3=_0x8231[_0xc6b82a];return _0x5d51c3;};'use strict';var _=require(_0x1823('0x0'));var util=require('util');var logger=require(_0x1823('0x1'))(_0x1823('0x2'));var moment=require('moment');var BPromise=require(_0x1823('0x3'));var rp=require(_0x1823('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1823('0x5'));var attributes=require(_0x1823('0x6'));module[_0x1823('0x7')]=function(_0x58cd81,_0x35071e){return _0x58cd81[_0x1823('0x8')](_0x1823('0x9'),attributes,{'tableName':_0x1823('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x769d=['rimraf','../../config/environment','exports','define','Network','lodash','../../config/logger','moment','request-promise','path'];(function(_0x1e0486,_0x129fcc){var _0x1363b9=function(_0x4e2857){while(--_0x4e2857){_0x1e0486['push'](_0x1e0486['shift']());}};_0x1363b9(++_0x129fcc);}(_0x769d,0x1e5));var _0xd769=function(_0x3cc09f,_0x1b8c98){_0x3cc09f=_0x3cc09f-0x0;var _0xc4c46f=_0x769d[_0x3cc09f];return _0xc4c46f;};'use strict';var _=require(_0xd769('0x0'));var util=require('util');var logger=require(_0xd769('0x1'))('api');var moment=require(_0xd769('0x2'));var BPromise=require('bluebird');var rp=require(_0xd769('0x3'));var fs=require('fs');var path=require(_0xd769('0x4'));var rimraf=require(_0xd769('0x5'));var config=require(_0xd769('0x6'));var attributes=require('./network.attributes');module[_0xd769('0x7')]=function(_0x2dc519,_0x1a8737){return _0x2dc519[_0xd769('0x8')](_0xd769('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 6ec992e..40bd9e9 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78b9=['ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x44719b,_0x12017c){var _0x5a6b33=function(_0x5b12ec){while(--_0x5b12ec){_0x44719b['push'](_0x44719b['shift']());}};_0x5a6b33(++_0x12017c);}(_0x78b9,0x103));var _0x978b=function(_0x5312ee,_0xddb1db){_0x5312ee=_0x5312ee-0x0;var _0x1595ac=_0x78b9[_0x5312ee];return _0x1595ac;};'use strict';var _=require(_0x978b('0x0'));var util=require(_0x978b('0x1'));var moment=require(_0x978b('0x2'));var BPromise=require(_0x978b('0x3'));var rs=require(_0x978b('0x4'));var fs=require('fs');var Redis=require(_0x978b('0x5'));var db=require(_0x978b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x978b('0x7'))(_0x978b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x978b('0x9')][_0x978b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4166c1,_0x5d3a76,_0x3dbd5d){return new BPromise(function(_0x5c4fff,_0x27fae2){return client['request'](_0x4166c1,_0x3dbd5d)[_0x978b('0xb')](function(_0x4b5e33){logger[_0x978b('0xc')](_0x978b('0xd'),_0x5d3a76,_0x978b('0xe'));logger[_0x978b('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0x5d3a76,_0x978b('0xe'),JSON[_0x978b('0x10')](_0x4b5e33));if(_0x4b5e33[_0x978b('0x11')]){if(_0x4b5e33[_0x978b('0x11')][_0x978b('0x12')]===0x1f4){logger[_0x978b('0x11')](_0x978b('0xd'),_0x5d3a76,_0x4b5e33['error'][_0x978b('0x13')]);return _0x27fae2(_0x4b5e33['error'][_0x978b('0x13')]);}logger[_0x978b('0x11')]('Network,\x20%s,\x20%s',_0x5d3a76,_0x4b5e33[_0x978b('0x11')][_0x978b('0x13')]);return _0x5c4fff(_0x4b5e33[_0x978b('0x11')][_0x978b('0x13')]);}else{logger[_0x978b('0xc')](_0x978b('0xd'),_0x5d3a76,_0x978b('0xe'));_0x5c4fff(_0x4b5e33[_0x978b('0x14')][_0x978b('0x13')]);}})[_0x978b('0x15')](function(_0x5e6ab6){logger[_0x978b('0x11')](_0x978b('0xd'),_0x5d3a76,_0x5e6ab6);_0x27fae2(_0x5e6ab6);});});} \ No newline at end of file +var _0x131c=['Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x131c,0xe5));var _0xc131=function(_0x10b518,_0x48181b){_0x10b518=_0x10b518-0x0;var _0x5cb26a=_0x131c[_0x10b518];return _0x5cb26a;};'use strict';var _=require(_0xc131('0x0'));var util=require(_0xc131('0x1'));var moment=require(_0xc131('0x2'));var BPromise=require('bluebird');var rs=require(_0xc131('0x3'));var fs=require('fs');var Redis=require(_0xc131('0x4'));var db=require(_0xc131('0x5'))['db'];var utils=require(_0xc131('0x6'));var logger=require(_0xc131('0x7'))(_0xc131('0x8'));var config=require(_0xc131('0x9'));var jayson=require(_0xc131('0xa'));var client=jayson['client'][_0xc131('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3388af,_0x4508fd,_0x25b9fe){return new BPromise(function(_0x515810,_0x29a387){return client['request'](_0x3388af,_0x25b9fe)['then'](function(_0x8bd4fe){logger[_0xc131('0xc')](_0xc131('0xd'),_0x4508fd,_0xc131('0xe'));logger[_0xc131('0xf')](_0xc131('0x10'),_0x4508fd,_0xc131('0xe'),JSON[_0xc131('0x11')](_0x8bd4fe));if(_0x8bd4fe[_0xc131('0x12')]){if(_0x8bd4fe[_0xc131('0x12')][_0xc131('0x13')]===0x1f4){logger[_0xc131('0x12')](_0xc131('0xd'),_0x4508fd,_0x8bd4fe[_0xc131('0x12')][_0xc131('0x14')]);return _0x29a387(_0x8bd4fe['error'][_0xc131('0x14')]);}logger[_0xc131('0x12')]('Network,\x20%s,\x20%s',_0x4508fd,_0x8bd4fe[_0xc131('0x12')][_0xc131('0x14')]);return _0x515810(_0x8bd4fe[_0xc131('0x12')][_0xc131('0x14')]);}else{logger[_0xc131('0xc')]('Network,\x20%s,\x20%s',_0x4508fd,'request\x20sent');_0x515810(_0x8bd4fe[_0xc131('0x15')][_0xc131('0x14')]);}})['catch'](function(_0x230a9b){logger[_0xc131('0x12')]('Network,\x20%s,\x20%s',_0x4508fd,_0x230a9b);_0x29a387(_0x230a9b);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index e733c51..6965fcd 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1477=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','multer','util','path'];(function(_0x17ec0e,_0x372f37){var _0x12e9a2=function(_0x454550){while(--_0x454550){_0x17ec0e['push'](_0x17ec0e['shift']());}};_0x12e9a2(++_0x372f37);}(_0x1477,0xed));var _0x7147=function(_0xe10e72,_0x5a003b){_0xe10e72=_0xe10e72-0x0;var _0x4a9453=_0x1477[_0xe10e72];return _0x4a9453;};'use strict';var multer=require(_0x7147('0x0'));var util=require(_0x7147('0x1'));var path=require(_0x7147('0x2'));var timeout=require(_0x7147('0x3'));var express=require('express');var router=express[_0x7147('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7147('0x5'));var config=require(_0x7147('0x6'));var controller=require(_0x7147('0x7'));router[_0x7147('0x8')]('/',auth[_0x7147('0x9')](),controller['sendNotification']);module['exports']=router; \ No newline at end of file +var _0xd5f5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendNotification','exports','util','connect-timeout','express'];(function(_0xe34243,_0x2744e5){var _0x3db09d=function(_0xeef42b){while(--_0xeef42b){_0xe34243['push'](_0xe34243['shift']());}};_0x3db09d(++_0x2744e5);}(_0xd5f5,0xe4));var _0x5d5f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd5f5[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require(_0x5d5f('0x0'));var path=require('path');var timeout=require(_0x5d5f('0x1'));var express=require(_0x5d5f('0x2'));var router=express[_0x5d5f('0x3')]();var auth=require(_0x5d5f('0x4'));var interaction=require(_0x5d5f('0x5'));var config=require(_0x5d5f('0x6'));var controller=require('./notification.controller');router[_0x5d5f('0x7')]('/',auth[_0x5d5f('0x8')](),controller[_0x5d5f('0x9')]);module[_0x5d5f('0xa')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 6363622..b3d04e0 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7eba=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x31ee56,_0x1bf3af){var _0x2091c5=function(_0x240528){while(--_0x240528){_0x31ee56['push'](_0x31ee56['shift']());}};_0x2091c5(++_0x1bf3af);}(_0x7eba,0x13d));var _0xa7eb=function(_0x37f3f,_0x3a2b80){_0x37f3f=_0x37f3f-0x0;var _0x31e641=_0x7eba[_0x37f3f];return _0x31e641;};'use strict';var Sequelize=require(_0xa7eb('0x0'));module[_0xa7eb('0x1')]={'body':{'type':Sequelize[_0xa7eb('0x2')]},'senderName':{'type':Sequelize[_0xa7eb('0x3')]},'recipientsId':{'type':Sequelize[_0xa7eb('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa7eb('0x3')]},'beep':{'type':Sequelize[_0xa7eb('0x4')]}}; \ No newline at end of file +var _0x84a2=['sequelize','TEXT','STRING'];(function(_0x2cced8,_0x41bcf0){var _0x2faa3c=function(_0x31f2d6){while(--_0x31f2d6){_0x2cced8['push'](_0x2cced8['shift']());}};_0x2faa3c(++_0x41bcf0);}(_0x84a2,0x13b));var _0x284a=function(_0x3b6d96,_0x5d3241){_0x3b6d96=_0x3b6d96-0x0;var _0x1e6b1c=_0x84a2[_0x3b6d96];return _0x1e6b1c;};'use strict';var Sequelize=require(_0x284a('0x0'));module['exports']={'body':{'type':Sequelize[_0x284a('0x1')]},'senderName':{'type':Sequelize[_0x284a('0x2')]},'recipientsId':{'type':Sequelize[_0x284a('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 3e0fc14..d72a6bb 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x478d=['Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','SenderId','sortBy','join','transaction','Notification','create','forEach','notification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','toLowerCase','union','ids','queue','replace','Queue','push','all','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','sendNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter'];(function(_0x1b053d,_0x543e99){var _0x29af91=function(_0x6736bb){while(--_0x6736bb){_0x1b053d['push'](_0x1b053d['shift']());}};_0x29af91(++_0x543e99);}(_0x478d,0x89));var _0xd478=function(_0xe5d5d3,_0x311893){_0xe5d5d3=_0xe5d5d3-0x0;var _0x4e4a97=_0x478d[_0xe5d5d3];return _0x4e4a97;};'use strict';var pdf=require(_0xd478('0x0'));var emlformat=require(_0xd478('0x1'));var rimraf=require(_0xd478('0x2'));var zipdir=require(_0xd478('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd478('0x4'));var BPromise=require(_0xd478('0x5'));var Mustache=require(_0xd478('0x6'));var util=require(_0xd478('0x7'));var path=require(_0xd478('0x8'));var sox=require(_0xd478('0x9'));var csv=require(_0xd478('0xa'));var ejs=require(_0xd478('0xb'));var fs=require('fs');var _=require(_0xd478('0xc'));var squel=require(_0xd478('0xd'));var crypto=require('crypto');var jsforce=require(_0xd478('0xe'));var deskjs=require(_0xd478('0xf'));var toCsv=require(_0xd478('0xa'));var querystring=require(_0xd478('0x10'));var Papa=require(_0xd478('0x11'));var Redis=require(_0xd478('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd478('0x13'));var logger=require('../../config/logger')(_0xd478('0x14'));var utils=require(_0xd478('0x15'));var config=require(_0xd478('0x16'));var licenseUtil=require(_0xd478('0x17'));var db=require(_0xd478('0x18'))['db'];config[_0xd478('0x19')]=_['defaults'](config['redis'],{'host':_0xd478('0x1a'),'port':0x18eb});var socket=require(_0xd478('0x1b'))(new Redis(config[_0xd478('0x19')]));require('./notification.socket')[_0xd478('0x1c')](socket);function respondWithStatusCode(_0x513069,_0xfb7f78){_0xfb7f78=_0xfb7f78||0xcc;return function(_0x359d81){if(_0x359d81){return _0x513069[_0xd478('0x1d')](_0xfb7f78);}return _0x513069[_0xd478('0x1e')](_0xfb7f78)['end']();};}function respondWithResult(_0x58b0fc,_0x5b254f){_0x5b254f=_0x5b254f||0xc8;return function(_0x4f2247){if(_0x4f2247){return _0x58b0fc[_0xd478('0x1e')](_0x5b254f)[_0xd478('0x1f')](_0x4f2247);}};}function respondWithFilteredResult(_0x15b08d,_0x72b4f){return function(_0x4bcd77){if(_0x4bcd77){var _0x1bb996=_0x4bcd77[_0xd478('0x20')],_0x2b36cd=_0x72b4f[_0xd478('0x21')],_0x2d2715=_0x72b4f['offset']+_0x72b4f[_0xd478('0x22')],_0x13f9af;if(_0x2d2715>=_0x1bb996){_0x2d2715=_0x1bb996;_0x13f9af=0xc8;}else{_0x13f9af=0xce;}_0x15b08d['status'](_0x13f9af);return _0x15b08d[_0xd478('0x23')](_0xd478('0x24'),_0x2b36cd+'-'+_0x2d2715+'/'+_0x1bb996)[_0xd478('0x1f')](_0x4bcd77);}return null;};}function patchUpdates(_0x2aec56){return function(_0x44347d){try{jsonpatch[_0xd478('0x25')](_0x44347d,_0x2aec56,!![]);}catch(_0x54e2a5){return BPromise[_0xd478('0x26')](_0x54e2a5);}return _0x44347d[_0xd478('0x27')]();};}function saveUpdates(_0x45b957,_0x1263de){return function(_0x13c57f){if(_0x13c57f){return _0x13c57f[_0xd478('0x28')](_0x45b957)[_0xd478('0x29')](function(_0x2236d0){return _0x2236d0;});}return null;};}function removeEntity(_0x470a11,_0x476396){return function(_0x5b6d7e){if(_0x5b6d7e){return _0x5b6d7e['destroy']()[_0xd478('0x29')](function(){_0x470a11['status'](0xcc)[_0xd478('0x2a')]();});}};}function handleEntityNotFound(_0x3021ea,_0x138cfd){return function(_0x5e03dc){if(!_0x5e03dc){_0x3021ea[_0xd478('0x1d')](0x194);}return _0x5e03dc;};}function handleError(_0x4bd980,_0x5ca13f){_0x5ca13f=_0x5ca13f||0x1f4;return function(_0x1a0c8c){logger[_0xd478('0x2b')](_0x1a0c8c[_0xd478('0x2c')]);if(_0x1a0c8c['name']){delete _0x1a0c8c[_0xd478('0x2d')];}_0x4bd980[_0xd478('0x1e')](_0x5ca13f)[_0xd478('0x2e')](_0x1a0c8c);};}exports[_0xd478('0x2f')]=function(_0x77ba3b,_0x268d48,_0x5672b7){if(!_0x77ba3b[_0xd478('0x30')][_0xd478('0x31')](_0xd478('0x32'))&&!_0x77ba3b['body']['hasOwnProperty']('TemplateId')){throw new db[(_0xd478('0x33'))][(_0xd478('0x34'))](_0xd478('0x35'));}else{if(_0x77ba3b[_0xd478('0x30')][_0xd478('0x31')](_0xd478('0x36'))&&!_0x77ba3b[_0xd478('0x30')][_0xd478('0x31')](_0xd478('0x37'))){throw new db[(_0xd478('0x33'))]['ValidationError'](_0xd478('0x38'));}if(!_0x77ba3b[_0xd478('0x30')][_0xd478('0x31')]('recipients')){throw new db[(_0xd478('0x33'))][(_0xd478('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x427665=JSON['parse'](_0x77ba3b[_0xd478('0x30')]['recipients']);}catch(_0x51fefd){logger[_0xd478('0x2b')](_0x51fefd);throw new db[(_0xd478('0x33'))][(_0xd478('0x34'))](_0xd478('0x39'));}var _0x4ca6e9=[_0xd478('0x3a'),_0xd478('0x3b'),'mailqueue','openchannelqueue',_0xd478('0x3c'),_0xd478('0x3d'),_0xd478('0x3e'),'team',_0xd478('0x3f')];if(_[_0xd478('0x40')](_0x427665,function(_0x24ad0a){return!_[_0xd478('0x41')](_0x4ca6e9,_0x24ad0a[_0xd478('0x42')]['toLowerCase']());})){throw new db['Sequelize'][(_0xd478('0x34'))](_0xd478('0x43'));}}}var _0x69c612={};_0x69c612[_0xd478('0x44')]=_0x77ba3b[_0xd478('0x30')][_0xd478('0x31')]('senderName')?_0x77ba3b[_0xd478('0x30')]['senderName']:_0x77ba3b['user'][_0xd478('0x45')];_0x69c612[_0xd478('0x46')]=_[_0xd478('0x47')](_0x77ba3b[_0xd478('0x30')][_0xd478('0x46')])?null:_0x77ba3b[_0xd478('0x30')]['recipientsDescription'];_0x69c612['beep']=_0x77ba3b[_0xd478('0x30')]['beep']||![];_0x69c612[_0xd478('0x48')]=_0x77ba3b[_0xd478('0x3f')]['id'];return getContent(_0x77ba3b[_0xd478('0x30')])[_0xd478('0x29')](function(_0x401332){_0x69c612[_0xd478('0x30')]=_0x401332;return getRecipients(_0x427665);})['then'](function(_0x228929){_0x69c612['recipientsId']=_[_0xd478('0x49')](_0x228929)[_0xd478('0x4a')](',');return db['sequelize'][_0xd478('0x4b')](function(_0x110dd1){return db[_0xd478('0x4c')][_0xd478('0x4d')](_0x69c612,{'raw':!![],'transaction':_0x110dd1})[_0xd478('0x29')](function(_0x2bd31b){var _0x1ab951={'sender':_0x69c612[_0xd478('0x44')],'description':_0x69c612[_0xd478('0x46')],'content':_0x69c612[_0xd478('0x30')],'beep':_0x69c612['beep']};_0x228929[_0xd478('0x4e')](function(_0x1dc1c6){_0x1ab951['recipient']=_0x1dc1c6;socket['emit'](_0xd478('0x4f'),_0x1ab951);});return _0x2bd31b;});});})['then'](respondWithResult(_0x268d48,0xc9))['catch'](handleError(_0x268d48,null));};function getContent(_0x1479cd){return new BPromise(function(_0x2727d4,_0x3a9e8b){if(_0x1479cd[_0xd478('0x32')]){_0x2727d4(_0x1479cd[_0xd478('0x32')]);return;}return db[_0xd478('0x50')][_0xd478('0x51')]({'attributes':[_0xd478('0x52')],'where':{'id':_0x1479cd[_0xd478('0x36')]},'raw':!![]})[_0xd478('0x29')](function(_0x2ed032){if(!_0x2ed032)throw new db[(_0xd478('0x33'))][(_0xd478('0x34'))](_0xd478('0x53'));var _0x2b30c0=Mustache[_0xd478('0x54')](_0x2ed032[_0xd478('0x52')],_0x1479cd[_0xd478('0x37')]);_0x2727d4(_0x2b30c0);})[_0xd478('0x55')](function(_0x50f41b){_0x3a9e8b(_0x50f41b);});});}function getRecipients(_0x377b41){return new BPromise(function(_0x2a70ca,_0x1f9c0c){var _0x4cacfb=[];var _0x44ae74=[];_0x377b41['forEach'](function(_0x1ae7fc){var _0x339056=_[_0xd478('0x56')](_0x1ae7fc['model'][_0xd478('0x57')]());if(_0x339056==='User'){_0x4cacfb=_[_0xd478('0x58')](_0x4cacfb,_0x1ae7fc[_0xd478('0x59')]);}else{if(_[_0xd478('0x41')](_0x339056,_0xd478('0x5a')))_0x339056=_0x339056[_0xd478('0x5b')](_0xd478('0x5a'),_0xd478('0x5c'));_0x1ae7fc[_0xd478('0x59')][_0xd478('0x4e')](function(_0x309a8e){_0x44ae74[_0xd478('0x5d')](getAgents(_0x339056,_0x309a8e));});}});return BPromise[_0xd478('0x5e')](_0x44ae74)['then'](function(_0x113fe5){_0x4cacfb=_['union'](_0x4cacfb,_['flatten'](_0x113fe5));_0x2a70ca(_0x4cacfb);})[_0xd478('0x55')](function(_0x209f11){_0x1f9c0c(_0x209f11);});});}function getAgents(_0x490ba9,_0x44580e){return new BPromise(function(_0x4fdbe0,_0x27b881){return db[_0x490ba9][_0xd478('0x51')]({'where':{'id':_0x44580e}})[_0xd478('0x29')](function(_0x50faa6){return _0x50faa6[_0xd478('0x5f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x589e5d){var _0x3091d9=_[_0xd478('0x60')](_0x589e5d,'id');_0x4fdbe0(_0x3091d9);});})[_0xd478('0x55')](function(_0xd8f6dc){_0x27b881(_0xd8f6dc);});});} \ No newline at end of file +var _0x8a2d=['redis','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','Notification','create','forEach','recipient','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','toLowerCase','User','union','replace','queue','Queue','ids','push','all','flatten','map','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults'];(function(_0x5ccab3,_0x5c7df5){var _0x8a5eb3=function(_0x13156f){while(--_0x13156f){_0x5ccab3['push'](_0x5ccab3['shift']());}};_0x8a5eb3(++_0x5c7df5);}(_0x8a2d,0x17f));var _0xd8a2=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x8a2d[_0x42245d];return _0x4b211a;};'use strict';var pdf=require(_0xd8a2('0x0'));var emlformat=require(_0xd8a2('0x1'));var rimraf=require(_0xd8a2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd8a2('0x3'));var moment=require(_0xd8a2('0x4'));var BPromise=require(_0xd8a2('0x5'));var Mustache=require(_0xd8a2('0x6'));var util=require(_0xd8a2('0x7'));var path=require(_0xd8a2('0x8'));var sox=require(_0xd8a2('0x9'));var csv=require(_0xd8a2('0xa'));var ejs=require(_0xd8a2('0xb'));var fs=require('fs');var _=require(_0xd8a2('0xc'));var squel=require(_0xd8a2('0xd'));var crypto=require(_0xd8a2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd8a2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd8a2('0x10'));var Redis=require(_0xd8a2('0x11'));var authService=require(_0xd8a2('0x12'));var qs=require(_0xd8a2('0x13'));var as=require(_0xd8a2('0x14'));var hardwareService=require(_0xd8a2('0x15'));var logger=require(_0xd8a2('0x16'))(_0xd8a2('0x17'));var utils=require(_0xd8a2('0x18'));var config=require(_0xd8a2('0x19'));var licenseUtil=require(_0xd8a2('0x1a'));var db=require(_0xd8a2('0x1b'))['db'];config['redis']=_[_0xd8a2('0x1c')](config[_0xd8a2('0x1d')],{'host':_0xd8a2('0x1e'),'port':0x18eb});var socket=require(_0xd8a2('0x1f'))(new Redis(config[_0xd8a2('0x1d')]));require(_0xd8a2('0x20'))[_0xd8a2('0x21')](socket);function respondWithStatusCode(_0x540a1d,_0x250760){_0x250760=_0x250760||0xcc;return function(_0x17f21d){if(_0x17f21d){return _0x540a1d[_0xd8a2('0x22')](_0x250760);}return _0x540a1d[_0xd8a2('0x23')](_0x250760)[_0xd8a2('0x24')]();};}function respondWithResult(_0x4b0874,_0x457e0b){_0x457e0b=_0x457e0b||0xc8;return function(_0x3b58fc){if(_0x3b58fc){return _0x4b0874[_0xd8a2('0x23')](_0x457e0b)['json'](_0x3b58fc);}};}function respondWithFilteredResult(_0x3358b3,_0x57ae2d){return function(_0x30a618){if(_0x30a618){var _0x6cc202=_0x30a618[_0xd8a2('0x25')],_0x37c2db=_0x57ae2d[_0xd8a2('0x26')],_0x506572=_0x57ae2d['offset']+_0x57ae2d[_0xd8a2('0x27')],_0x5a9431;if(_0x506572>=_0x6cc202){_0x506572=_0x6cc202;_0x5a9431=0xc8;}else{_0x5a9431=0xce;}_0x3358b3[_0xd8a2('0x23')](_0x5a9431);return _0x3358b3[_0xd8a2('0x28')](_0xd8a2('0x29'),_0x37c2db+'-'+_0x506572+'/'+_0x6cc202)[_0xd8a2('0x2a')](_0x30a618);}return null;};}function patchUpdates(_0x3e3ae1){return function(_0x2297d){try{jsonpatch[_0xd8a2('0x2b')](_0x2297d,_0x3e3ae1,!![]);}catch(_0x193043){return BPromise[_0xd8a2('0x2c')](_0x193043);}return _0x2297d['save']();};}function saveUpdates(_0xc7d781,_0x3fc4b5){return function(_0x58e192){if(_0x58e192){return _0x58e192[_0xd8a2('0x2d')](_0xc7d781)[_0xd8a2('0x2e')](function(_0x4fc301){return _0x4fc301;});}return null;};}function removeEntity(_0x596715,_0x44de70){return function(_0x14caa9){if(_0x14caa9){return _0x14caa9[_0xd8a2('0x2f')]()[_0xd8a2('0x2e')](function(){_0x596715[_0xd8a2('0x23')](0xcc)[_0xd8a2('0x24')]();});}};}function handleEntityNotFound(_0x415505,_0x75536d){return function(_0x1d6d2f){if(!_0x1d6d2f){_0x415505['sendStatus'](0x194);}return _0x1d6d2f;};}function handleError(_0x1d1d85,_0x4d1da1){_0x4d1da1=_0x4d1da1||0x1f4;return function(_0x36dc24){logger['error'](_0x36dc24[_0xd8a2('0x30')]);if(_0x36dc24[_0xd8a2('0x31')]){delete _0x36dc24['name'];}_0x1d1d85['status'](_0x4d1da1)['send'](_0x36dc24);};}exports[_0xd8a2('0x32')]=function(_0x44fb4f,_0x2dfae5,_0x44a35b){if(!_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x34')](_0xd8a2('0x35'))&&!_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x34')](_0xd8a2('0x36'))){throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x39'));}else{if(_0x44fb4f[_0xd8a2('0x33')]['hasOwnProperty']('TemplateId')&&!_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x34')]('view')){throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x3a'));}if(!_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x34')](_0xd8a2('0x3b'))){throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x3c'));}else{try{var _0xc4c991=JSON[_0xd8a2('0x3d')](_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x3b')]);}catch(_0x21ba60){logger['error'](_0x21ba60);throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x3e'));}var _0x20624e=[_0xd8a2('0x3f'),_0xd8a2('0x40'),_0xd8a2('0x41'),_0xd8a2('0x42'),'smsqueue','voicequeue','whatsappqueue',_0xd8a2('0x43'),'user'];if(_[_0xd8a2('0x44')](_0xc4c991,function(_0x3d3a43){return!_[_0xd8a2('0x45')](_0x20624e,_0x3d3a43[_0xd8a2('0x46')]['toLowerCase']());})){throw new db['Sequelize'][(_0xd8a2('0x38'))](_0xd8a2('0x47'));}}}var _0x25f78f={};_0x25f78f[_0xd8a2('0x48')]=_0x44fb4f[_0xd8a2('0x33')]['hasOwnProperty'](_0xd8a2('0x48'))?_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x48')]:_0x44fb4f[_0xd8a2('0x49')][_0xd8a2('0x4a')];_0x25f78f['recipientsDescription']=_[_0xd8a2('0x4b')](_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x4c')])?null:_0x44fb4f['body'][_0xd8a2('0x4c')];_0x25f78f[_0xd8a2('0x4d')]=_0x44fb4f[_0xd8a2('0x33')]['beep']||![];_0x25f78f[_0xd8a2('0x4e')]=_0x44fb4f[_0xd8a2('0x49')]['id'];return getContent(_0x44fb4f[_0xd8a2('0x33')])[_0xd8a2('0x2e')](function(_0x483dc3){_0x25f78f[_0xd8a2('0x33')]=_0x483dc3;return getRecipients(_0xc4c991);})['then'](function(_0x260982){_0x25f78f[_0xd8a2('0x4f')]=_[_0xd8a2('0x50')](_0x260982)['join'](',');return db['sequelize']['transaction'](function(_0x459d47){return db[_0xd8a2('0x51')][_0xd8a2('0x52')](_0x25f78f,{'raw':!![],'transaction':_0x459d47})[_0xd8a2('0x2e')](function(_0x3d07fc){var _0x1f2608={'sender':_0x25f78f[_0xd8a2('0x48')],'description':_0x25f78f[_0xd8a2('0x4c')],'content':_0x25f78f[_0xd8a2('0x33')],'beep':_0x25f78f[_0xd8a2('0x4d')]};_0x260982[_0xd8a2('0x53')](function(_0x5dbcfc){_0x1f2608[_0xd8a2('0x54')]=_0x5dbcfc;socket[_0xd8a2('0x55')]('notification:send',_0x1f2608);});return _0x3d07fc;});});})[_0xd8a2('0x2e')](respondWithResult(_0x2dfae5,0xc9))[_0xd8a2('0x56')](handleError(_0x2dfae5,null));};function getContent(_0x4794d8){return new BPromise(function(_0x1728bc,_0xa095ed){if(_0x4794d8[_0xd8a2('0x35')]){_0x1728bc(_0x4794d8[_0xd8a2('0x35')]);return;}return db[_0xd8a2('0x57')][_0xd8a2('0x58')]({'attributes':[_0xd8a2('0x59')],'where':{'id':_0x4794d8[_0xd8a2('0x36')]},'raw':!![]})[_0xd8a2('0x2e')](function(_0x4cd931){if(!_0x4cd931)throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x5a'));var _0x5652e9=Mustache[_0xd8a2('0x5b')](_0x4cd931[_0xd8a2('0x59')],_0x4794d8['view']);_0x1728bc(_0x5652e9);})[_0xd8a2('0x56')](function(_0x4f78d5){_0xa095ed(_0x4f78d5);});});}function getRecipients(_0x464b93){return new BPromise(function(_0x93e078,_0x553e72){var _0x2a96aa=[];var _0x186c7d=[];_0x464b93['forEach'](function(_0x54edc2){var _0x4de00d=_['startCase'](_0x54edc2[_0xd8a2('0x46')][_0xd8a2('0x5c')]());if(_0x4de00d===_0xd8a2('0x5d')){_0x2a96aa=_[_0xd8a2('0x5e')](_0x2a96aa,_0x54edc2['ids']);}else{if(_[_0xd8a2('0x45')](_0x4de00d,'queue'))_0x4de00d=_0x4de00d[_0xd8a2('0x5f')](_0xd8a2('0x60'),_0xd8a2('0x61'));_0x54edc2[_0xd8a2('0x62')][_0xd8a2('0x53')](function(_0x4592b6){_0x186c7d[_0xd8a2('0x63')](getAgents(_0x4de00d,_0x4592b6));});}});return BPromise[_0xd8a2('0x64')](_0x186c7d)[_0xd8a2('0x2e')](function(_0x535085){_0x2a96aa=_[_0xd8a2('0x5e')](_0x2a96aa,_[_0xd8a2('0x65')](_0x535085));_0x93e078(_0x2a96aa);})[_0xd8a2('0x56')](function(_0x5462a7){_0x553e72(_0x5462a7);});});}function getAgents(_0x3df009,_0x2f03ee){return new BPromise(function(_0x58104e,_0x117713){return db[_0x3df009]['findOne']({'where':{'id':_0x2f03ee}})[_0xd8a2('0x2e')](function(_0x35521a){return _0x35521a['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x1e80d3){var _0x44bd97=_[_0xd8a2('0x66')](_0x1e80d3,'id');_0x58104e(_0x44bd97);});})[_0xd8a2('0x56')](function(_0x5cf0e8){_0x117713(_0x5cf0e8);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index c9b372d..451b467 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['Notification','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x28ddcb,_0x33692c){var _0x3e6536=function(_0x1f5c1b){while(--_0x1f5c1b){_0x28ddcb['push'](_0x28ddcb['shift']());}};_0x3e6536(++_0x33692c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0x0b0e[_0x1ab0e6];return _0x248815;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var Notification=require('../../mysqldb')['db'][_0xe0b0('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){NotificationEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);NotificationEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];Notification[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x3e6058,_0x597b83){var _0x96eca0=function(_0x33cc7f){while(--_0x33cc7f){_0x3e6058['push'](_0x3e6058['shift']());}};_0x96eca0(++_0x597b83);}(_0x757a,0xde));var _0xa757=function(_0x19ff33,_0x1f3de3){_0x19ff33=_0x19ff33-0x0;var _0x3b4cdd=_0x757a[_0x19ff33];return _0x3b4cdd;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index adfb454..dd23e0c 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52d2=['define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','exports'];(function(_0x245502,_0xdbff36){var _0x580842=function(_0x5373f3){while(--_0x5373f3){_0x245502['push'](_0x245502['shift']());}};_0x580842(++_0xdbff36);}(_0x52d2,0x1f2));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x252d('0x0'));var util=require(_0x252d('0x1'));var logger=require(_0x252d('0x2'))(_0x252d('0x3'));var moment=require(_0x252d('0x4'));var BPromise=require(_0x252d('0x5'));var rp=require(_0x252d('0x6'));var fs=require('fs');var path=require(_0x252d('0x7'));var rimraf=require(_0x252d('0x8'));var config=require(_0x252d('0x9'));var attributes=require(_0x252d('0xa'));module[_0x252d('0xb')]=function(_0x2cc0ee,_0xf9d336){return _0x2cc0ee[_0x252d('0xc')](_0x252d('0xd'),attributes,{'tableName':_0x252d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x252d('0xf'),'collate':_0x252d('0x10')});}; \ No newline at end of file +var _0xdc95=['Notification','notifications','utf8mb4_unicode_ci','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x5b8685,_0x1a1c28){var _0xa3ef57=function(_0xa91aad){while(--_0xa91aad){_0x5b8685['push'](_0x5b8685['shift']());}};_0xa3ef57(++_0x1a1c28);}(_0xdc95,0x16b));var _0x5dc9=function(_0x2dbdac,_0x4d1e91){_0x2dbdac=_0x2dbdac-0x0;var _0x9a611e=_0xdc95[_0x2dbdac];return _0x9a611e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5dc9('0x0'))(_0x5dc9('0x1'));var moment=require('moment');var BPromise=require(_0x5dc9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dc9('0x3'));var config=require(_0x5dc9('0x4'));var attributes=require('./notification.attributes');module[_0x5dc9('0x5')]=function(_0x527b5f,_0x80d580){return _0x527b5f[_0x5dc9('0x6')](_0x5dc9('0x7'),attributes,{'tableName':_0x5dc9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5dc9('0x9')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 4b02b6b..0567a45 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcaa0=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2b7ffe,_0x3129be){var _0x1a009a=function(_0x1c0a18){while(--_0x1c0a18){_0x2b7ffe['push'](_0x2b7ffe['shift']());}};_0x1a009a(++_0x3129be);}(_0xcaa0,0xb5));var _0x0caa=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0xcaa0[_0x5d225a];return _0x1e7761;};'use strict';var _=require(_0x0caa('0x0'));var util=require(_0x0caa('0x1'));var moment=require(_0x0caa('0x2'));var BPromise=require(_0x0caa('0x3'));var rs=require(_0x0caa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0caa('0x5'))['db'];var utils=require(_0x0caa('0x6'));var logger=require(_0x0caa('0x7'))(_0x0caa('0x8'));var config=require(_0x0caa('0x9'));var jayson=require(_0x0caa('0xa'));var client=jayson[_0x0caa('0xb')][_0x0caa('0xc')]({'port':0x232a});config[_0x0caa('0xd')]=_[_0x0caa('0xe')](config['redis'],{'host':_0x0caa('0xf'),'port':0x18eb});var socket=require(_0x0caa('0x10'))(new Redis(config[_0x0caa('0xd')]));require(_0x0caa('0x11'))[_0x0caa('0x12')](socket);function respondWithRpcPromise(_0x3b2763,_0x4f41ac,_0x220631){return new BPromise(function(_0x1ffb51,_0x3ff235){return client[_0x0caa('0x13')](_0x3b2763,_0x220631)[_0x0caa('0x14')](function(_0x3a1aaf){logger[_0x0caa('0x15')](_0x0caa('0x16'),_0x4f41ac,_0x0caa('0x17'));logger[_0x0caa('0x18')](_0x0caa('0x19'),_0x4f41ac,_0x0caa('0x17'),JSON['stringify'](_0x3a1aaf));if(_0x3a1aaf['error']){if(_0x3a1aaf[_0x0caa('0x1a')][_0x0caa('0x1b')]===0x1f4){logger[_0x0caa('0x1a')](_0x0caa('0x16'),_0x4f41ac,_0x3a1aaf['error'][_0x0caa('0x1c')]);return _0x3ff235(_0x3a1aaf[_0x0caa('0x1a')][_0x0caa('0x1c')]);}logger[_0x0caa('0x1a')](_0x0caa('0x16'),_0x4f41ac,_0x3a1aaf[_0x0caa('0x1a')][_0x0caa('0x1c')]);return _0x1ffb51(_0x3a1aaf[_0x0caa('0x1a')]['message']);}else{logger['info'](_0x0caa('0x16'),_0x4f41ac,'request\x20sent');_0x1ffb51(_0x3a1aaf['result'][_0x0caa('0x1c')]);}})[_0x0caa('0x1d')](function(_0x5c5966){logger[_0x0caa('0x1a')](_0x0caa('0x16'),_0x4f41ac,_0x5c5966);_0x3ff235(_0x5c5966);});});} \ No newline at end of file +var _0x2c73=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','Notification,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x38dc5a,_0x3f48f4){var _0x65cf62=function(_0x57af7a){while(--_0x57af7a){_0x38dc5a['push'](_0x38dc5a['shift']());}};_0x65cf62(++_0x3f48f4);}(_0x2c73,0x162));var _0x32c7=function(_0x47e221,_0x20b0ec){_0x47e221=_0x47e221-0x0;var _0x2068bc=_0x2c73[_0x47e221];return _0x2068bc;};'use strict';var _=require(_0x32c7('0x0'));var util=require(_0x32c7('0x1'));var moment=require(_0x32c7('0x2'));var BPromise=require(_0x32c7('0x3'));var rs=require(_0x32c7('0x4'));var fs=require('fs');var Redis=require(_0x32c7('0x5'));var db=require(_0x32c7('0x6'))['db'];var utils=require(_0x32c7('0x7'));var logger=require('../../config/logger')(_0x32c7('0x8'));var config=require(_0x32c7('0x9'));var jayson=require(_0x32c7('0xa'));var client=jayson[_0x32c7('0xb')][_0x32c7('0xc')]({'port':0x232a});config['redis']=_[_0x32c7('0xd')](config[_0x32c7('0xe')],{'host':_0x32c7('0xf'),'port':0x18eb});var socket=require(_0x32c7('0x10'))(new Redis(config['redis']));require(_0x32c7('0x11'))[_0x32c7('0x12')](socket);function respondWithRpcPromise(_0x1bcc67,_0x6788d9,_0x5357d4){return new BPromise(function(_0x2b0432,_0x46ac09){return client[_0x32c7('0x13')](_0x1bcc67,_0x5357d4)[_0x32c7('0x14')](function(_0xfbe643){logger[_0x32c7('0x15')]('Notification,\x20%s,\x20%s',_0x6788d9,_0x32c7('0x16'));logger[_0x32c7('0x17')](_0x32c7('0x18'),_0x6788d9,_0x32c7('0x16'),JSON[_0x32c7('0x19')](_0xfbe643));if(_0xfbe643[_0x32c7('0x1a')]){if(_0xfbe643[_0x32c7('0x1a')]['code']===0x1f4){logger['error'](_0x32c7('0x1b'),_0x6788d9,_0xfbe643['error'][_0x32c7('0x1c')]);return _0x46ac09(_0xfbe643[_0x32c7('0x1a')]['message']);}logger[_0x32c7('0x1a')]('Notification,\x20%s,\x20%s',_0x6788d9,_0xfbe643[_0x32c7('0x1a')][_0x32c7('0x1c')]);return _0x2b0432(_0xfbe643[_0x32c7('0x1a')]['message']);}else{logger[_0x32c7('0x15')](_0x32c7('0x1b'),_0x6788d9,_0x32c7('0x16'));_0x2b0432(_0xfbe643[_0x32c7('0x1d')][_0x32c7('0x1c')]);}})['catch'](function(_0x21e2dc){logger['error'](_0x32c7('0x1b'),_0x6788d9,_0x21e2dc);_0x46ac09(_0x21e2dc);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 944d74d..ee92a0d 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32c8=['register','length','notification:','./notification.events','save','update','emit'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x32c8,0x184));var _0x832c=function(_0x11c28e,_0x29f844){_0x11c28e=_0x11c28e-0x0;var _0x1457f0=_0x32c8[_0x11c28e];return _0x1457f0;};'use strict';var NotificationEvents=require(_0x832c('0x0'));var events=[_0x832c('0x1'),'remove',_0x832c('0x2')];function createListener(_0xa8f762,_0x4ced41){return function(_0x27e978){_0x4ced41[_0x832c('0x3')](_0xa8f762,_0x27e978);};}function removeListener(_0x4030ae,_0xdb5bcc){return function(){NotificationEvents['removeListener'](_0x4030ae,_0xdb5bcc);};}exports[_0x832c('0x4')]=function(_0x5b5410){for(var _0x4a7377=0x0,_0x58f35b=events[_0x832c('0x5')];_0x4a7377<_0x58f35b;_0x4a7377++){var _0x4c5625=events[_0x4a7377];var _0x9446ea=createListener(_0x832c('0x6')+_0x4c5625,_0x5b5410);NotificationEvents['on'](_0x4c5625,_0x9446ea);}}; \ No newline at end of file +var _0x2558=['remove','update','emit','removeListener','register','notification:','save'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x2558,0x1cd));var _0x8255=function(_0x20c19f,_0xe79d0e){_0x20c19f=_0x20c19f-0x0;var _0x4e6151=_0x2558[_0x20c19f];return _0x4e6151;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x8255('0x0'),_0x8255('0x1'),_0x8255('0x2')];function createListener(_0x4b9601,_0xb1da24){return function(_0xba87fb){_0xb1da24[_0x8255('0x3')](_0x4b9601,_0xba87fb);};}function removeListener(_0x14a73b,_0x4fcd3d){return function(){NotificationEvents[_0x8255('0x4')](_0x14a73b,_0x4fcd3d);};}exports[_0x8255('0x5')]=function(_0x4b6066){for(var _0x458289=0x0,_0x1e9bd6=events['length'];_0x458289<_0x1e9bd6;_0x458289++){var _0xfae012=events[_0x458289];var _0x54faee=createListener(_0x8255('0x6')+_0xfae012,_0x4b6066);NotificationEvents['on'](_0xfae012,_0x54faee);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 1824a56..fae54ca 100644 --- a/server/api/openchannelAccount/index.js +++ b/server/api/openchannelAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce91=['isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','/:id/send','send','put','update','delete','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x17006e,_0x2f1413){var _0x5a5133=function(_0x29f7d8){while(--_0x29f7d8){_0x17006e['push'](_0x17006e['shift']());}};_0x5a5133(++_0x2f1413);}(_0xce91,0xac));var _0x1ce9=function(_0x6747b8,_0x34dd27){_0x6747b8=_0x6747b8-0x0;var _0x3a2d45=_0xce91[_0x6747b8];return _0x3a2d45;};'use strict';var multer=require(_0x1ce9('0x0'));var util=require(_0x1ce9('0x1'));var path=require(_0x1ce9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1ce9('0x3')]();var auth=require(_0x1ce9('0x4'));var interaction=require(_0x1ce9('0x5'));var config=require(_0x1ce9('0x6'));var controller=require(_0x1ce9('0x7'));router['get']('/',auth[_0x1ce9('0x8')](),controller[_0x1ce9('0x9')]);router[_0x1ce9('0xa')](_0x1ce9('0xb'),auth[_0x1ce9('0x8')](),controller[_0x1ce9('0xc')]);router[_0x1ce9('0xa')](_0x1ce9('0xd'),auth[_0x1ce9('0x8')](),controller[_0x1ce9('0xe')]);router['get'](_0x1ce9('0xf'),auth[_0x1ce9('0x8')](),controller[_0x1ce9('0x10')]);router[_0x1ce9('0xa')](_0x1ce9('0x11'),auth[_0x1ce9('0x8')](),controller[_0x1ce9('0x12')]);router[_0x1ce9('0xa')](_0x1ce9('0x13'),auth[_0x1ce9('0x8')](),controller[_0x1ce9('0x14')]);router['get'](_0x1ce9('0x15'),auth[_0x1ce9('0x8')](),controller['getInteractions']);router['get'](_0x1ce9('0x16'),auth[_0x1ce9('0x8')](),controller[_0x1ce9('0x17')]);router[_0x1ce9('0x18')]('/',auth[_0x1ce9('0x8')](),controller[_0x1ce9('0x19')]);router[_0x1ce9('0x18')](_0x1ce9('0xf'),auth['isAuthenticated'](),controller[_0x1ce9('0x1a')]);router[_0x1ce9('0x18')](_0x1ce9('0x11'),auth[_0x1ce9('0x8')](),controller['addAnswer']);router[_0x1ce9('0x18')](_0x1ce9('0x1b'),controller[_0x1ce9('0x1c')]);router[_0x1ce9('0x18')]('/:id/applications',auth[_0x1ce9('0x8')](),controller['addApplications']);router[_0x1ce9('0x18')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x1ce9('0x18')](_0x1ce9('0x1d'),auth[_0x1ce9('0x8')](),controller[_0x1ce9('0x1e')]);router[_0x1ce9('0x1f')](_0x1ce9('0xd'),auth[_0x1ce9('0x8')](),controller[_0x1ce9('0x20')]);router[_0x1ce9('0x21')]('/:id',auth[_0x1ce9('0x8')](),controller['destroy']);router[_0x1ce9('0x21')](_0x1ce9('0xf'),auth[_0x1ce9('0x8')](),controller['removeDispositions']);router[_0x1ce9('0x21')]('/:id/canned_answers',auth[_0x1ce9('0x8')](),controller['removeAnswers']);router[_0x1ce9('0x21')](_0x1ce9('0x16'),auth[_0x1ce9('0x8')](),controller[_0x1ce9('0x22')]);module[_0x1ce9('0x23')]=router; \ No newline at end of file +var _0x1301=['addAgents','/:id/send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/users','post','addAnswer','/:id/applications','addApplications'];(function(_0x28d2b9,_0x1caa3d){var _0x5a9b88=function(_0x1d2a2d){while(--_0x1d2a2d){_0x28d2b9['push'](_0x28d2b9['shift']());}};_0x5a9b88(++_0x1caa3d);}(_0x1301,0x16a));var _0x1130=function(_0x156e85,_0x222ba6){_0x156e85=_0x156e85-0x0;var _0x1dbf1e=_0x1301[_0x156e85];return _0x1dbf1e;};'use strict';var multer=require(_0x1130('0x0'));var util=require('util');var path=require(_0x1130('0x1'));var timeout=require(_0x1130('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x1130('0x3'));var interaction=require(_0x1130('0x4'));var config=require('../../config/environment');var controller=require(_0x1130('0x5'));router[_0x1130('0x6')]('/',auth[_0x1130('0x7')](),controller[_0x1130('0x8')]);router[_0x1130('0x6')](_0x1130('0x9'),auth[_0x1130('0x7')](),controller['describe']);router[_0x1130('0x6')]('/:id',auth[_0x1130('0x7')](),controller[_0x1130('0xa')]);router[_0x1130('0x6')](_0x1130('0xb'),auth[_0x1130('0x7')](),controller[_0x1130('0xc')]);router[_0x1130('0x6')](_0x1130('0xd'),auth['isAuthenticated'](),controller[_0x1130('0xe')]);router[_0x1130('0x6')]('/:id/applications',auth[_0x1130('0x7')](),controller[_0x1130('0xf')]);router[_0x1130('0x6')]('/:id/interactions',auth[_0x1130('0x7')](),controller[_0x1130('0x10')]);router[_0x1130('0x6')](_0x1130('0x11'),auth[_0x1130('0x7')](),controller['getAgents']);router[_0x1130('0x12')]('/',auth[_0x1130('0x7')](),controller['create']);router[_0x1130('0x12')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x1130('0x12')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1130('0x13')]);router[_0x1130('0x12')]('/:id/notify',controller['notify']);router[_0x1130('0x12')](_0x1130('0x14'),auth[_0x1130('0x7')](),controller[_0x1130('0x15')]);router[_0x1130('0x12')]('/:id/users',auth[_0x1130('0x7')](),controller[_0x1130('0x16')]);router[_0x1130('0x12')](_0x1130('0x17'),auth[_0x1130('0x7')](),controller['send']);router[_0x1130('0x18')](_0x1130('0x19'),auth[_0x1130('0x7')](),controller[_0x1130('0x1a')]);router[_0x1130('0x1b')](_0x1130('0x19'),auth[_0x1130('0x7')](),controller[_0x1130('0x1c')]);router[_0x1130('0x1b')](_0x1130('0xb'),auth[_0x1130('0x7')](),controller[_0x1130('0x1d')]);router['delete'](_0x1130('0xd'),auth[_0x1130('0x7')](),controller[_0x1130('0x1e')]);router[_0x1130('0x1b')](_0x1130('0x11'),auth[_0x1130('0x7')](),controller['removeAgents']);module[_0x1130('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index bae26a5..e7dd2e6 100644 --- a/server/api/openchannelAccount/openchannelAccount.attributes.js +++ b/server/api/openchannelAccount/openchannelAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabdd=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x4337ba,_0x1688d9){var _0x30d5d5=function(_0x3f7102){while(--_0x3f7102){_0x4337ba['push'](_0x4337ba['shift']());}};_0x30d5d5(++_0x1688d9);}(_0xabdd,0x1f0));var _0xdabd=function(_0x320730,_0x4636b2){_0x320730=_0x320730-0x0;var _0x28abb1=_0xabdd[_0x320730];return _0x28abb1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xdabd('0x0'));module[_0xdabd('0x1')]={'name':{'type':Sequelize[_0xdabd('0x2')],'unique':_0xdabd('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xdabd('0x2')]},'token':{'type':Sequelize[_0xdabd('0x2')],'defaultValue':function(){return rs[_0xdabd('0x4')]();}},'replyUri':{'type':Sequelize[_0xdabd('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xdabd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdabd('0x5')],'defaultValue':function(){return _0xdabd('0x6');}},'notificationSound':{'type':Sequelize[_0xdabd('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdabd('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdabd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xdabd('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdabd('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdabd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdabd('0x7')],'defaultValue':![],'comment':_0xdabd('0x9'),'set':function(_0x5a607f){if(!_0x5a607f)this['setDataValue'](_0xdabd('0xa'),null);this['setDataValue'](_0xdabd('0xb'),_0x5a607f);}}}; \ No newline at end of file +var _0x97ea=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x47baa4,_0x522480){var _0x484801=function(_0x4a1c32){while(--_0x4a1c32){_0x47baa4['push'](_0x47baa4['shift']());}};_0x484801(++_0x522480);}(_0x97ea,0xc5));var _0xa97e=function(_0x540701,_0x20df75){_0x540701=_0x540701-0x0;var _0xce5aa5=_0x97ea[_0x540701];return _0xce5aa5;};'use strict';var Sequelize=require(_0xa97e('0x0'));var rs=require(_0xa97e('0x1'));module[_0xa97e('0x2')]={'name':{'type':Sequelize[_0xa97e('0x3')],'unique':_0xa97e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xa97e('0x3')]},'token':{'type':Sequelize[_0xa97e('0x3')],'defaultValue':function(){return rs[_0xa97e('0x5')]();}},'replyUri':{'type':Sequelize[_0xa97e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa97e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa97e('0x6')],'defaultValue':function(){return _0xa97e('0x7');}},'notificationSound':{'type':Sequelize[_0xa97e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa97e('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa97e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa97e('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa97e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa97e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa97e('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xa97e('0x8')],'defaultValue':![],'comment':_0xa97e('0xb'),'set':function(_0x43bb0d){if(!_0x43bb0d)this[_0xa97e('0xc')](_0xa97e('0xd'),null);this[_0xa97e('0xc')](_0xa97e('0xe'),_0x43bb0d);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 1b6194c..8f28a7d 100644 --- a/server/api/openchannelAccount/openchannelAccount.controller.js +++ b/server/api/openchannelAccount/openchannelAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c60=['Owner','fullname','internal','Tag','tag','addAgents','omit','spread','emit','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','ListId','out','Messages','dataValues','push','html-pdf','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','OpenchannelAccount','fieldName','key','map','query','keys','intersection','model','fields','attributes','limit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','Pause','rawAttributes','length','options','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','pick','removeDispositions','CannedAnswer','nolimit','removeAnswers','ids','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','account','list','applications','asc','defaults','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','messageId','interaction','created','unmanaged','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','priority','getApplications','getInteractions','Contact','User'];(function(_0x1817ba,_0x564eb9){var _0x223e74=function(_0x45c83e){while(--_0x45c83e){_0x1817ba['push'](_0x1817ba['shift']());}};_0x223e74(++_0x564eb9);}(_0x4c60,0xc1));var _0x04c6=function(_0x37f549,_0x5a6c05){_0x37f549=_0x37f549-0x0;var _0x1712dc=_0x4c60[_0x37f549];return _0x1712dc;};'use strict';var pdf=require(_0x04c6('0x0'));var emlformat=require(_0x04c6('0x1'));var rimraf=require(_0x04c6('0x2'));var zipdir=require(_0x04c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x04c6('0x5'));var sox=require(_0x04c6('0x6'));var csv=require(_0x04c6('0x7'));var ejs=require(_0x04c6('0x8'));var fs=require('fs');var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x7'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];config[_0x04c6('0x15')]=_['defaults'](config[_0x04c6('0x15')],{'host':_0x04c6('0x16'),'port':0x18eb});var socket=require(_0x04c6('0x17'))(new Redis(config['redis']));require(_0x04c6('0x18'))[_0x04c6('0x19')](socket);var jayson=require(_0x04c6('0x1a'));var client=jayson[_0x04c6('0x1b')][_0x04c6('0x1c')]({'port':0x232c});var client9002=jayson[_0x04c6('0x1b')][_0x04c6('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3d46a9,_0x5a5a66,_0x31edf9,_0xa2bc92){return new BPromise(function(_0x382e58,_0x2bc754){var _0x43596a=_0xa2bc92||client;return _0x43596a[_0x04c6('0x1d')](_0x3d46a9,_0x31edf9)[_0x04c6('0x1e')](function(_0x423ea9){logger['info'](_0x04c6('0x1f'),_0x5a5a66,_0x04c6('0x20'));logger[_0x04c6('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5a5a66,'request\x20sent',JSON['stringify'](_0x423ea9));if(_0x423ea9[_0x04c6('0x22')]){if(_0x423ea9[_0x04c6('0x22')]['code']===0x1f4){logger['error'](_0x04c6('0x1f'),_0x5a5a66,_0x423ea9[_0x04c6('0x22')][_0x04c6('0x23')]);return _0x2bc754(_0x423ea9['error'][_0x04c6('0x23')]);}logger[_0x04c6('0x22')](_0x04c6('0x1f'),_0x5a5a66,_0x423ea9['error'][_0x04c6('0x23')]);return _0x382e58(_0x423ea9[_0x04c6('0x22')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5a5a66,_0x04c6('0x20'));_0x382e58(_0x423ea9[_0x04c6('0x24')][_0x04c6('0x23')]);}})[_0x04c6('0x25')](function(_0x3e1328){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5a5a66,_0x3e1328);_0x2bc754(_0x3e1328);});});}function respondWithStatusCode(_0x383435,_0x2ab1d2){_0x2ab1d2=_0x2ab1d2||0xcc;return function(_0x9acfa){if(_0x9acfa){return _0x383435[_0x04c6('0x26')](_0x2ab1d2);}return _0x383435[_0x04c6('0x27')](_0x2ab1d2)[_0x04c6('0x28')]();};}function respondWithResult(_0x47c69a,_0x1d0d3f){_0x1d0d3f=_0x1d0d3f||0xc8;return function(_0x165cb5){if(_0x165cb5){return _0x47c69a['status'](_0x1d0d3f)[_0x04c6('0x29')](_0x165cb5);}};}function respondWithFilteredResult(_0x1cd16a,_0x5f1331){return function(_0x5c9003){if(_0x5c9003){var _0x115d84=_0x5c9003[_0x04c6('0x2a')],_0x3a6d92=_0x5f1331[_0x04c6('0x2b')],_0x2a191f=_0x5f1331['offset']+_0x5f1331['limit'],_0xbb9e81;if(_0x2a191f>=_0x115d84){_0x2a191f=_0x115d84;_0xbb9e81=0xc8;}else{_0xbb9e81=0xce;}_0x1cd16a['status'](_0xbb9e81);return _0x1cd16a[_0x04c6('0x2c')]('Content-Range',_0x3a6d92+'-'+_0x2a191f+'/'+_0x115d84)[_0x04c6('0x29')](_0x5c9003);}return null;};}function patchUpdates(_0x2f4e5c){return function(_0x5ea4ea){try{jsonpatch[_0x04c6('0x2d')](_0x5ea4ea,_0x2f4e5c,!![]);}catch(_0x36f2af){return BPromise[_0x04c6('0x2e')](_0x36f2af);}return _0x5ea4ea[_0x04c6('0x2f')]();};}function saveUpdates(_0x5b2056,_0x7c3207){return function(_0x250bd6){if(_0x250bd6){return _0x250bd6[_0x04c6('0x30')](_0x5b2056)[_0x04c6('0x1e')](function(_0x3762af){return _0x3762af;});}return null;};}function removeEntity(_0x902e66,_0x3e59b2){return function(_0x46380e){if(_0x46380e){return _0x46380e[_0x04c6('0x31')]()[_0x04c6('0x1e')](function(){var _0x3294af=_0x46380e[_0x04c6('0x32')]({'plain':!![]});var _0x46eccb=_0x04c6('0x33');return db[_0x04c6('0x34')]['destroy']({'where':{'type':_0x46eccb,'resourceId':_0x3294af['id']}})[_0x04c6('0x1e')](function(){return _0x46380e;});})[_0x04c6('0x1e')](function(){_0x902e66[_0x04c6('0x27')](0xcc)[_0x04c6('0x28')]();});}};}function handleEntityNotFound(_0x5a2e6a,_0x181736){return function(_0x31de0f){if(!_0x31de0f){_0x5a2e6a['sendStatus'](0x194);}return _0x31de0f;};}function handleError(_0x59dad3,_0x4aac49){_0x4aac49=_0x4aac49||0x1f4;return function(_0x4f0600){logger[_0x04c6('0x22')](_0x4f0600['stack']);if(_0x4f0600[_0x04c6('0x35')]){delete _0x4f0600['name'];}_0x59dad3[_0x04c6('0x27')](_0x4aac49)[_0x04c6('0x36')](_0x4f0600);};}exports[_0x04c6('0x37')]=function(_0x2b28cd,_0x5144f5){var _0x57ce4b={'include':[{'model':db['Pause'],'as':_0x04c6('0x38')}]},_0x2955e6={},_0x3a9a3b={'count':0x0,'rows':[]};var _0x5ce4b0=_['map'](db[_0x04c6('0x39')]['rawAttributes'],function(_0x181d3f){return{'name':_0x181d3f[_0x04c6('0x3a')],'type':_0x181d3f['type'][_0x04c6('0x3b')]};});_0x2955e6['model']=_[_0x04c6('0x3c')](_0x5ce4b0,_0x04c6('0x35'));_0x2955e6[_0x04c6('0x3d')]=_[_0x04c6('0x3e')](_0x2b28cd[_0x04c6('0x3d')]);_0x2955e6['filters']=_[_0x04c6('0x3f')](_0x2955e6['model'],_0x2955e6[_0x04c6('0x3d')]);_0x57ce4b['attributes']=_[_0x04c6('0x3f')](_0x2955e6[_0x04c6('0x40')],qs[_0x04c6('0x41')](_0x2b28cd[_0x04c6('0x3d')][_0x04c6('0x41')]));_0x57ce4b[_0x04c6('0x42')]=_0x57ce4b[_0x04c6('0x42')]['length']?_0x57ce4b[_0x04c6('0x42')]:_0x2955e6['model'];if(!_0x2b28cd[_0x04c6('0x3d')]['hasOwnProperty']('nolimit')){_0x57ce4b[_0x04c6('0x43')]=qs['limit'](_0x2b28cd[_0x04c6('0x3d')][_0x04c6('0x43')]);_0x57ce4b[_0x04c6('0x2b')]=qs['offset'](_0x2b28cd[_0x04c6('0x3d')][_0x04c6('0x2b')]);}_0x57ce4b[_0x04c6('0x44')]=qs[_0x04c6('0x45')](_0x2b28cd[_0x04c6('0x3d')][_0x04c6('0x45')]);_0x57ce4b[_0x04c6('0x46')]=qs['filters'](_['pick'](_0x2b28cd[_0x04c6('0x3d')],_0x2955e6[_0x04c6('0x47')]),_0x5ce4b0);if(_0x2b28cd[_0x04c6('0x3d')]['filter']){_0x57ce4b[_0x04c6('0x46')]=_[_0x04c6('0x48')](_0x57ce4b[_0x04c6('0x46')],{'$or':_['map'](_0x5ce4b0,function(_0x4c9942){if(_0x4c9942['type']!==_0x04c6('0x49')){var _0x25c185={};_0x25c185[_0x4c9942['name']]={'$like':'%'+_0x2b28cd[_0x04c6('0x3d')][_0x04c6('0x4a')]+'%'};return _0x25c185;}})});}_0x57ce4b=_[_0x04c6('0x48')]({},_0x57ce4b,_0x2b28cd['options']);var _0x392983={'where':_0x57ce4b[_0x04c6('0x46')]};return db['OpenchannelAccount'][_0x04c6('0x2a')](_0x392983)[_0x04c6('0x1e')](function(_0x2472ed){_0x3a9a3b[_0x04c6('0x2a')]=_0x2472ed;if(_0x2b28cd['query'][_0x04c6('0x4b')]){_0x57ce4b[_0x04c6('0x4c')]=[{'all':!![]}];}return db[_0x04c6('0x39')][_0x04c6('0x4d')](_0x57ce4b);})['then'](function(_0x192437){_0x3a9a3b[_0x04c6('0x4e')]=_0x192437;return _0x3a9a3b;})[_0x04c6('0x1e')](respondWithFilteredResult(_0x5144f5,_0x57ce4b))[_0x04c6('0x25')](handleError(_0x5144f5,null));};exports['show']=function(_0x3a338d,_0x42273e){var _0x15ec61={'raw':![],'where':{'id':_0x3a338d[_0x04c6('0x4f')]['id']},'include':[{'model':db[_0x04c6('0x50')],'as':_0x04c6('0x38')}]},_0x489361={};_0x489361[_0x04c6('0x40')]=_[_0x04c6('0x3e')](db[_0x04c6('0x39')][_0x04c6('0x51')]);_0x489361[_0x04c6('0x3d')]=_[_0x04c6('0x3e')](_0x3a338d[_0x04c6('0x3d')]);_0x489361[_0x04c6('0x47')]=_[_0x04c6('0x3f')](_0x489361[_0x04c6('0x40')],_0x489361['query']);_0x15ec61[_0x04c6('0x42')]=_[_0x04c6('0x3f')](_0x489361[_0x04c6('0x40')],qs[_0x04c6('0x41')](_0x3a338d[_0x04c6('0x3d')]['fields']));_0x15ec61[_0x04c6('0x42')]=_0x15ec61[_0x04c6('0x42')][_0x04c6('0x52')]?_0x15ec61[_0x04c6('0x42')]:_0x489361[_0x04c6('0x40')];if(_0x3a338d[_0x04c6('0x3d')][_0x04c6('0x4b')]){_0x15ec61[_0x04c6('0x4c')]=[{'all':!![]}];}_0x15ec61=_[_0x04c6('0x48')]({},_0x15ec61,_0x3a338d[_0x04c6('0x53')]);return db['OpenchannelAccount']['find'](_0x15ec61)['then'](handleEntityNotFound(_0x42273e,null))['then'](respondWithResult(_0x42273e,null))[_0x04c6('0x25')](handleError(_0x42273e,null));};exports['create']=function(_0x32547e,_0x570e25){return db[_0x04c6('0x39')][_0x04c6('0x54')](_0x32547e['body'],{})['then'](function(_0x28cfc3){var _0x22f0dc=_0x32547e[_0x04c6('0x55')][_0x04c6('0x32')]({'plain':!![]});if(!_0x22f0dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22f0dc[_0x04c6('0x56')]===_0x04c6('0x55')){var _0x216cb0=_0x28cfc3[_0x04c6('0x32')]({'plain':!![]});var _0x24c5be=_0x04c6('0x33');return db[_0x04c6('0x57')]['find']({'where':{'name':_0x24c5be,'userProfileId':_0x22f0dc[_0x04c6('0x58')]},'raw':!![]})['then'](function(_0x4336a3){if(_0x4336a3&&_0x4336a3[_0x04c6('0x59')]===0x0){return db['UserProfileResource'][_0x04c6('0x54')]({'name':_0x216cb0[_0x04c6('0x35')],'resourceId':_0x216cb0['id'],'type':_0x4336a3[_0x04c6('0x35')],'sectionId':_0x4336a3['id']},{})[_0x04c6('0x1e')](function(){return _0x28cfc3;});}else{return _0x28cfc3;}})[_0x04c6('0x25')](function(_0x5b536f){logger[_0x04c6('0x22')](_0x04c6('0x5a'),_0x5b536f);throw _0x5b536f;});}return _0x28cfc3;})['then'](respondWithResult(_0x570e25,0xc9))[_0x04c6('0x25')](handleError(_0x570e25,null));};exports['update']=function(_0xbb2f9b,_0x224910){if(_0xbb2f9b['body']['id']){delete _0xbb2f9b['body']['id'];}return db[_0x04c6('0x39')]['find']({'where':{'id':_0xbb2f9b[_0x04c6('0x4f')]['id']},'include':[{'model':db[_0x04c6('0x50')],'as':'mandatoryDispositionPause'}]})[_0x04c6('0x1e')](handleEntityNotFound(_0x224910,null))[_0x04c6('0x1e')](saveUpdates(_0xbb2f9b[_0x04c6('0x5b')],null))[_0x04c6('0x1e')](respondWithResult(_0x224910,null))[_0x04c6('0x25')](handleError(_0x224910,null));};exports[_0x04c6('0x31')]=function(_0x3e5a53,_0x35ca98){return db[_0x04c6('0x39')][_0x04c6('0x5c')]({'where':{'id':_0x3e5a53[_0x04c6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x35ca98,null))[_0x04c6('0x1e')](removeEntity(_0x35ca98,null))[_0x04c6('0x25')](handleError(_0x35ca98,null));};exports[_0x04c6('0x5d')]=function(_0x12394f,_0x492aa1){return db[_0x04c6('0x39')][_0x04c6('0x5d')]()[_0x04c6('0x1e')](respondWithResult(_0x492aa1,null))['catch'](handleError(_0x492aa1,null));};exports['addDisposition']=function(_0x1655af,_0x1bb3cb,_0x2e8631){if(_0x1655af[_0x04c6('0x5b')]['id']){delete _0x1655af[_0x04c6('0x5b')]['id'];}return db[_0x04c6('0x39')]['find']({'where':{'id':_0x1655af[_0x04c6('0x4f')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x1bb3cb,null))[_0x04c6('0x1e')](function(_0x596ac0){if(_0x596ac0){_0x1655af['body'][_0x04c6('0x5e')]=_0x596ac0['id'];return db[_0x04c6('0x5f')][_0x04c6('0x54')](_0x1655af[_0x04c6('0x5b')]);}})['then'](respondWithResult(_0x1bb3cb,null))[_0x04c6('0x25')](handleError(_0x1bb3cb,null));};exports['getDispositions']=function(_0x5b5b09,_0x27a25b,_0xe178dd){var _0x2e75f5={'raw':![],'where':{}};var _0x1904d4={};var _0x43260e={'count':0x0,'rows':[]};return db[_0x04c6('0x39')][_0x04c6('0x60')]({'where':{'id':_0x5b5b09['params']['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x27a25b,null))[_0x04c6('0x1e')](function(_0x1f5b9a){if(_0x1f5b9a){_0x1904d4[_0x04c6('0x40')]=_[_0x04c6('0x3e')](db['Disposition']['rawAttributes']);_0x1904d4[_0x04c6('0x3d')]=_[_0x04c6('0x3e')](_0x5b5b09[_0x04c6('0x3d')]);_0x1904d4['filters']=_[_0x04c6('0x3f')](_0x1904d4[_0x04c6('0x40')],_0x1904d4['query']);_0x2e75f5[_0x04c6('0x42')]=_[_0x04c6('0x3f')](_0x1904d4[_0x04c6('0x40')],qs[_0x04c6('0x41')](_0x5b5b09[_0x04c6('0x3d')][_0x04c6('0x41')]));_0x2e75f5[_0x04c6('0x42')]=_0x2e75f5[_0x04c6('0x42')][_0x04c6('0x52')]?_0x2e75f5[_0x04c6('0x42')]:_0x1904d4[_0x04c6('0x40')];if(!_0x5b5b09[_0x04c6('0x3d')][_0x04c6('0x61')]('nolimit')){_0x2e75f5[_0x04c6('0x43')]=qs[_0x04c6('0x43')](_0x5b5b09['query'][_0x04c6('0x43')]);_0x2e75f5[_0x04c6('0x2b')]=qs[_0x04c6('0x2b')](_0x5b5b09[_0x04c6('0x3d')][_0x04c6('0x2b')]);}_0x2e75f5['order']=qs[_0x04c6('0x45')](_0x5b5b09['query'][_0x04c6('0x45')]);_0x2e75f5['where']=qs[_0x04c6('0x47')](_[_0x04c6('0x62')](_0x5b5b09[_0x04c6('0x3d')],_0x1904d4[_0x04c6('0x47')]));_0x2e75f5[_0x04c6('0x46')][_0x04c6('0x5e')]=_0x1f5b9a['id'];if(_0x5b5b09[_0x04c6('0x3d')][_0x04c6('0x4a')]){_0x2e75f5[_0x04c6('0x46')]=_['merge'](_0x2e75f5[_0x04c6('0x46')],{'$or':_[_0x04c6('0x3c')](_0x2e75f5['attributes'],function(_0x9825cf){var _0x5449fb={};_0x5449fb[_0x9825cf]={'$like':'%'+_0x5b5b09[_0x04c6('0x3d')][_0x04c6('0x4a')]+'%'};return _0x5449fb;})});}_0x2e75f5=_['merge']({},_0x2e75f5,_0x5b5b09[_0x04c6('0x53')]);return db[_0x04c6('0x5f')]['count']({'where':_0x2e75f5[_0x04c6('0x46')]})[_0x04c6('0x1e')](function(_0x4fbb5d){_0x43260e[_0x04c6('0x2a')]=_0x4fbb5d;if(_0x5b5b09[_0x04c6('0x3d')]['includeAll']){_0x2e75f5[_0x04c6('0x4c')]=[{'all':!![]}];}return db[_0x04c6('0x5f')]['findAll'](_0x2e75f5);})['then'](function(_0x4ea186){_0x43260e[_0x04c6('0x4e')]=_0x4ea186;return _0x43260e;});}})[_0x04c6('0x1e')](respondWithFilteredResult(_0x27a25b,_0x2e75f5))[_0x04c6('0x25')](handleError(_0x27a25b,null));};exports[_0x04c6('0x63')]=function(_0x44e7ac,_0x4a718e,_0x4667ba){return db[_0x04c6('0x39')][_0x04c6('0x5c')]({'where':{'id':_0x44e7ac[_0x04c6('0x4f')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x4a718e,null))[_0x04c6('0x1e')](function(_0x1c600b){if(_0x1c600b){return _0x1c600b['removeDispositions'](_0x44e7ac[_0x04c6('0x3d')]['ids']);}})[_0x04c6('0x1e')](respondWithStatusCode(_0x4a718e,null))['catch'](handleError(_0x4a718e,null));};exports['addAnswer']=function(_0x289469,_0x58f619,_0x34f705){if(_0x289469[_0x04c6('0x5b')]['id']){delete _0x289469[_0x04c6('0x5b')]['id'];}return db[_0x04c6('0x39')][_0x04c6('0x5c')]({'where':{'id':_0x289469['params']['id']}})['then'](handleEntityNotFound(_0x58f619,null))[_0x04c6('0x1e')](function(_0x14be40){if(_0x14be40){_0x289469[_0x04c6('0x5b')][_0x04c6('0x5e')]=_0x14be40['id'];return db[_0x04c6('0x64')][_0x04c6('0x54')](_0x289469['body']);}})[_0x04c6('0x1e')](respondWithResult(_0x58f619,null))['catch'](handleError(_0x58f619,null));};exports['getAnswers']=function(_0x866f47,_0x466cd9,_0x28bda5){var _0x787dab={'raw':![],'where':{}};var _0x449286={};var _0x42459d={'count':0x0,'rows':[]};return db[_0x04c6('0x39')][_0x04c6('0x60')]({'where':{'id':_0x866f47[_0x04c6('0x4f')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x466cd9,null))[_0x04c6('0x1e')](function(_0x5763c1){if(_0x5763c1){_0x449286[_0x04c6('0x40')]=_['keys'](db['CannedAnswer'][_0x04c6('0x51')]);_0x449286[_0x04c6('0x3d')]=_[_0x04c6('0x3e')](_0x866f47[_0x04c6('0x3d')]);_0x449286[_0x04c6('0x47')]=_[_0x04c6('0x3f')](_0x449286[_0x04c6('0x40')],_0x449286[_0x04c6('0x3d')]);_0x787dab[_0x04c6('0x42')]=_[_0x04c6('0x3f')](_0x449286[_0x04c6('0x40')],qs['fields'](_0x866f47['query'][_0x04c6('0x41')]));_0x787dab[_0x04c6('0x42')]=_0x787dab['attributes'][_0x04c6('0x52')]?_0x787dab[_0x04c6('0x42')]:_0x449286['model'];if(!_0x866f47[_0x04c6('0x3d')][_0x04c6('0x61')](_0x04c6('0x65'))){_0x787dab[_0x04c6('0x43')]=qs[_0x04c6('0x43')](_0x866f47[_0x04c6('0x3d')][_0x04c6('0x43')]);_0x787dab[_0x04c6('0x2b')]=qs['offset'](_0x866f47[_0x04c6('0x3d')]['offset']);}_0x787dab[_0x04c6('0x44')]=qs[_0x04c6('0x45')](_0x866f47[_0x04c6('0x3d')][_0x04c6('0x45')]);_0x787dab[_0x04c6('0x46')]=qs[_0x04c6('0x47')](_['pick'](_0x866f47[_0x04c6('0x3d')],_0x449286[_0x04c6('0x47')]));_0x787dab[_0x04c6('0x46')]['OpenchannelAccountId']=_0x5763c1['id'];if(_0x866f47['query']['filter']){_0x787dab[_0x04c6('0x46')]=_[_0x04c6('0x48')](_0x787dab['where'],{'$or':_[_0x04c6('0x3c')](_0x787dab[_0x04c6('0x42')],function(_0x3e5f45){var _0x5c47a4={};_0x5c47a4[_0x3e5f45]={'$like':'%'+_0x866f47[_0x04c6('0x3d')]['filter']+'%'};return _0x5c47a4;})});}_0x787dab=_[_0x04c6('0x48')]({},_0x787dab,_0x866f47[_0x04c6('0x53')]);return db[_0x04c6('0x64')]['count']({'where':_0x787dab['where']})[_0x04c6('0x1e')](function(_0x21c679){_0x42459d[_0x04c6('0x2a')]=_0x21c679;if(_0x866f47[_0x04c6('0x3d')]['includeAll']){_0x787dab['include']=[{'all':!![]}];}return db[_0x04c6('0x64')][_0x04c6('0x4d')](_0x787dab);})[_0x04c6('0x1e')](function(_0x5b64ad){_0x42459d[_0x04c6('0x4e')]=_0x5b64ad;return _0x42459d;});}})[_0x04c6('0x1e')](respondWithFilteredResult(_0x466cd9,_0x787dab))[_0x04c6('0x25')](handleError(_0x466cd9,null));};exports[_0x04c6('0x66')]=function(_0x49f1e0,_0x1af683,_0xf5a10a){return db[_0x04c6('0x39')][_0x04c6('0x5c')]({'where':{'id':_0x49f1e0[_0x04c6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1af683,null))[_0x04c6('0x1e')](function(_0x388811){if(_0x388811){return _0x388811[_0x04c6('0x66')](_0x49f1e0[_0x04c6('0x3d')][_0x04c6('0x67')]);}})[_0x04c6('0x1e')](respondWithStatusCode(_0x1af683,null))[_0x04c6('0x25')](handleError(_0x1af683,null));};exports['notify']=function(_0x1d5043,_0x4076ba,_0x1b5745){var _0x330dc6={'body':_0x1d5043[_0x04c6('0x5b')],'channel':_0x04c6('0x68')};var _0x3c2db5=[];var _0x13bf21=[];var _0x4bfb6c={};var _0x203630=![];return db[_0x04c6('0x69')]['describe']()[_0x04c6('0x1e')](function(_0xf53e3e){if(!_0xf53e3e){throw new db[(_0x04c6('0x6a'))][(_0x04c6('0x6b'))](_0x04c6('0x6c'));}_0x3c2db5=_['difference'](_['keys'](_0xf53e3e),[_0x04c6('0x6d'),_0x04c6('0x6e')]);_0x13bf21=_[_0x04c6('0x6f')](_['keys'](_0xf53e3e),[_0x04c6('0x6d'),_0x04c6('0x6e'),'CompanyId','ListId']);if(_0x1d5043[_0x04c6('0x5b')]['id']){delete _0x1d5043[_0x04c6('0x5b')]['id'];}if(_['isNil'](_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x70')])){throw new db[(_0x04c6('0x6a'))][(_0x04c6('0x6b'))]('from\x20is\x20mandatory');}if(_[_0x04c6('0x71')](_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x5b')])||_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x5b')]===''){throw new db[(_0x04c6('0x6a'))]['ValidationError'](_0x04c6('0x72'));}if(_[_0x04c6('0x71')](_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x73')])){throw new db[(_0x04c6('0x6a'))][(_0x04c6('0x6b'))](_0x04c6('0x74')+_0x13bf21);}if(!_[_0x04c6('0x75')](_0x13bf21,_0x1d5043['body']['mapKey'])){throw new db[(_0x04c6('0x6a'))][(_0x04c6('0x6b'))](_0x04c6('0x76')+_0x13bf21);}_0x4bfb6c[_0x1d5043['body'][_0x04c6('0x73')]]=_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x70')];})['then'](function(){return db['OpenchannelAccount'][_0x04c6('0x5c')]({'where':{'id':_0x1d5043[_0x04c6('0x4f')]['id']},'include':[{'model':db[_0x04c6('0x77')],'as':_0x04c6('0x78'),'include':[{'model':db[_0x04c6('0x69')],'as':_0x04c6('0x79'),'where':_0x4bfb6c,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x04c6('0x7a')}]});})[_0x04c6('0x1e')](handleEntityNotFound(_0x4076ba,null))['then'](function(_0x3a1763){if(_0x3a1763&&_0x3a1763[_0x04c6('0x78')]){_0x330dc6[_0x04c6('0x7b')]=_0x3a1763;_0x330dc6['applications']=_0x3a1763[_0x04c6('0x7a')];_0x330dc6[_0x04c6('0x7c')]=_0x3a1763[_0x04c6('0x78')];_0x330dc6[_0x04c6('0x7d')]=_['orderBy'](_0x330dc6['applications'],['priority'],[_0x04c6('0x7e')]);if(_0x330dc6[_0x04c6('0x7b')]['Applications']){delete _0x330dc6['account']['Applications'];}if(_0x330dc6[_0x04c6('0x7b')]['List']&&_0x330dc6[_0x04c6('0x7b')][_0x04c6('0x78')][_0x04c6('0x79')][_0x04c6('0x52')]){return _0x330dc6[_0x04c6('0x7b')][_0x04c6('0x78')]['Contacts'][0x0];}var _0xf3cde6=_[_0x04c6('0x7f')](_0x1d5043[_0x04c6('0x5b')],{'firstName':_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x70')],'ListId':_0x3a1763['ListId']});_0xf3cde6[_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x73')]]=_0x1d5043[_0x04c6('0x5b')]['from'];return db[_0x04c6('0x69')][_0x04c6('0x54')](_0xf3cde6,{'fields':_0x3c2db5,'raw':!![]});}})[_0x04c6('0x1e')](handleEntityNotFound(_0x4076ba,null))['then'](function(_0x3deaf4){_0x330dc6[_0x04c6('0x80')]=_0x3deaf4;if(_0x3deaf4){var _0x3e381a={'ContactId':_0x3deaf4['id'],'OpenchannelAccountId':_0x1d5043[_0x04c6('0x4f')]['id'],'from':(_0x3deaf4[_0x04c6('0x81')]||'')+'\x20'+(_0x3deaf4[_0x04c6('0x82')]||'')};var _0x38b1bd={'OpenchannelAccountId':_0x1d5043[_0x04c6('0x4f')]['id'],'closed':![]};if(_0x1d5043['body'][_0x04c6('0x83')]){_0x38b1bd[_0x04c6('0x83')]=_0x1d5043[_0x04c6('0x5b')]['threadId'];return db['OpenchannelInteraction']['find']({'where':_0x38b1bd})[_0x04c6('0x1e')](function(_0x2f96f4){if(_0x2f96f4){return[_0x2f96f4,![]];}_0x3e381a[_0x04c6('0x83')]=_0x1d5043['body'][_0x04c6('0x83')];_0x3e381a[_0x04c6('0x84')]=_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x84')];return db['OpenchannelInteraction'][_0x04c6('0x54')](_0x3e381a)[_0x04c6('0x1e')](function(_0x31e6bf){return[_0x31e6bf,!![]];});});}else{_0x38b1bd[_0x04c6('0x83')]=null;}_0x38b1bd['ContactId']=_0x3deaf4['id'];return db[_0x04c6('0x85')]['find']({'where':_0x38b1bd})[_0x04c6('0x1e')](function(_0xbfbdd6){if(_0xbfbdd6){return[_0xbfbdd6,![]];}return db['OpenchannelInteraction'][_0x04c6('0x54')](_0x3e381a)[_0x04c6('0x1e')](function(_0x46a009){return[_0x46a009,!![]];});});}})['spread'](function(_0x39985f,_0x2e71fa){if(_0x39985f){_0x203630=_0x2e71fa;if(!_0x2e71fa){var _0x464d21={'from':(_0x330dc6['contact'][_0x04c6('0x81')]||'')+'\x20'+(_0x330dc6[_0x04c6('0x80')]['lastName']||'')};if(_0x1d5043['body']['threadId']&&_0x1d5043['body'][_0x04c6('0x86')]&&_0x1d5043[_0x04c6('0x5b')]['threadId']!=_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x86')]){_0x464d21['threadId']=_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x86')];}return _0x39985f['update'](_0x464d21);}else{return _0x39985f;}}})[_0x04c6('0x1e')](function(_0x6e3354){_0x330dc6[_0x04c6('0x87')]=_0x6e3354['get']({'plain':!![]});_0x330dc6['interaction']['created']=_0x203630;if(_0x330dc6[_0x04c6('0x87')][_0x04c6('0x88')]){if(_0x330dc6[_0x04c6('0x7b')]['autoclose']){_0x330dc6['applications']['push']({'id':0x0,'priority':_0x330dc6[_0x04c6('0x7d')]['length']+0x1,'app':'close','appdata':_0x04c6('0x89'),'interval':'*,*,*,*'});}}return db[_0x04c6('0x8a')][_0x04c6('0x54')]({'body':_0x1d5043[_0x04c6('0x5b')][_0x04c6('0x5b')],'OpenchannelAccountId':_0x1d5043[_0x04c6('0x4f')]['id'],'OpenchannelInteractionId':_0x6e3354['id'],'direction':'in','ContactId':_0x330dc6['contact']['id'],'AttachmentId':_0x1d5043['body'][_0x04c6('0x8b')]});})[_0x04c6('0x1e')](function(_0x1ee682){_0x330dc6[_0x04c6('0x23')]=_0x1ee682;if(_0x330dc6[_0x04c6('0x87')][_0x04c6('0x8c')]){return db['User']['find']({'attributes':['id',_0x04c6('0x35')],'where':{'id':_0x330dc6[_0x04c6('0x87')]['UserId']}})[_0x04c6('0x1e')](function(_0x4d16fe){if(_0x4d16fe){_0x330dc6['applications'][_0x04c6('0x8d')]({'id':0x0,'priority':0x0,'app':_0x04c6('0x8e'),'appdata':_0x4d16fe['name']+','+(_0x330dc6[_0x04c6('0x7b')][_0x04c6('0x8f')]||0xa),'interval':_0x04c6('0x90')});_0x330dc6['forcedOwnership']=![];}return respondWithRpcPromise(_0x04c6('0x91'),_0x04c6('0x92'),_0x330dc6);});}return respondWithRpcPromise(_0x04c6('0x91'),_0x04c6('0x92'),_0x330dc6);})[_0x04c6('0x1e')](function(_0x2b107f){respondWithRpcPromise(_0x04c6('0x93'),_0x04c6('0x93'),{'event':'notify','message':_0x2b107f},client9002);return _0x2b107f;})[_0x04c6('0x1e')](respondWithResult(_0x4076ba,null))['catch'](handleError(_0x4076ba,null));};exports[_0x04c6('0x94')]=function(_0x1a9440,_0x3cfea6,_0x3e6d89){return db[_0x04c6('0x39')]['findOne']({'where':{'id':_0x1a9440[_0x04c6('0x4f')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x3cfea6,null))['then'](function(_0x18362f){if(_0x18362f){return db[_0x04c6('0x95')][_0x04c6('0x96')](function(_0x5b67ea){return db[_0x04c6('0x97')]['destroy']({'where':{'OpenchannelAccountId':_0x1a9440['params']['id']},'transaction':_0x5b67ea})[_0x04c6('0x1e')](function(_0x4f529a){var _0x1c14e7=_[_0x04c6('0x3c')](_0x1a9440[_0x04c6('0x5b')],function(_0x5236a4){_0x5236a4[_0x04c6('0x5e')]=_0x1a9440['params']['id'];return _0x5236a4;});return db[_0x04c6('0x97')]['bulkCreate'](_0x1c14e7,{'transaction':_0x5b67ea});});})['then'](function(){return db[_0x04c6('0x97')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1a9440[_0x04c6('0x4f')]['id']},'order':_0x04c6('0x98')});});}})[_0x04c6('0x1e')](respondWithResult(_0x3cfea6,null))[_0x04c6('0x25')](handleError(_0x3cfea6,null));};exports[_0x04c6('0x99')]=function(_0x1fffaa,_0x257524,_0x81e27b){var _0x2623c6={};var _0x9c108e={};var _0x493c7c;var _0x5101fc;return db[_0x04c6('0x39')][_0x04c6('0x60')]({'where':{'id':_0x1fffaa[_0x04c6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x257524,null))[_0x04c6('0x1e')](function(_0x4afc68){if(_0x4afc68){_0x493c7c=_0x4afc68;_0x9c108e['model']=_[_0x04c6('0x3e')](db[_0x04c6('0x97')][_0x04c6('0x51')]);_0x9c108e[_0x04c6('0x3d')]=_['keys'](_0x1fffaa['query']);_0x9c108e[_0x04c6('0x47')]=_[_0x04c6('0x3f')](_0x9c108e['model'],_0x9c108e[_0x04c6('0x3d')]);_0x2623c6[_0x04c6('0x42')]=_[_0x04c6('0x3f')](_0x9c108e['model'],qs['fields'](_0x1fffaa[_0x04c6('0x3d')][_0x04c6('0x41')]));_0x2623c6[_0x04c6('0x42')]=_0x2623c6[_0x04c6('0x42')][_0x04c6('0x52')]?_0x2623c6[_0x04c6('0x42')]:_0x9c108e[_0x04c6('0x40')];_0x2623c6[_0x04c6('0x44')]=qs['sort'](_0x1fffaa['query']['sort']);_0x2623c6[_0x04c6('0x46')]=qs[_0x04c6('0x47')](_[_0x04c6('0x62')](_0x1fffaa[_0x04c6('0x3d')],_0x9c108e[_0x04c6('0x47')]));if(_0x1fffaa[_0x04c6('0x3d')][_0x04c6('0x4a')]){_0x2623c6['where']=_[_0x04c6('0x48')](_0x2623c6['where'],{'$or':_['map'](_0x2623c6[_0x04c6('0x42')],function(_0xa417e2){var _0x3eac1f={};_0x3eac1f[_0xa417e2]={'$like':'%'+_0x1fffaa[_0x04c6('0x3d')][_0x04c6('0x4a')]+'%'};return _0x3eac1f;})});}_0x2623c6=_[_0x04c6('0x48')]({},_0x2623c6,_0x1fffaa[_0x04c6('0x53')]);return _0x493c7c['getApplications'](_0x2623c6);}})['then'](function(_0x30fcd1){if(_0x30fcd1){_0x5101fc=_0x30fcd1[_0x04c6('0x52')];if(!_0x1fffaa[_0x04c6('0x3d')]['hasOwnProperty'](_0x04c6('0x65'))){_0x2623c6[_0x04c6('0x43')]=qs[_0x04c6('0x43')](_0x1fffaa[_0x04c6('0x3d')]['limit']);_0x2623c6[_0x04c6('0x2b')]=qs[_0x04c6('0x2b')](_0x1fffaa[_0x04c6('0x3d')]['offset']);}return _0x493c7c[_0x04c6('0x99')](_0x2623c6);}})[_0x04c6('0x1e')](function(_0x1fd8e7){if(_0x1fd8e7){return _0x1fd8e7?{'count':_0x5101fc,'rows':_0x1fd8e7}:null;}})[_0x04c6('0x1e')](respondWithResult(_0x257524,null))[_0x04c6('0x25')](handleError(_0x257524,null));};exports[_0x04c6('0x9a')]=function(_0x179be4,_0x3d4459,_0x3355c2){var _0x3db53f={'raw':![],'where':{}};var _0x494c6c={};var _0x89e1d1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x04c6('0x60')]({'where':{'id':_0x179be4[_0x04c6('0x4f')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x3d4459,null))[_0x04c6('0x1e')](function(_0x27ba21){if(_0x27ba21){_0x494c6c[_0x04c6('0x40')]=_['keys'](db[_0x04c6('0x85')][_0x04c6('0x51')]);_0x494c6c[_0x04c6('0x3d')]=_[_0x04c6('0x3e')](_0x179be4[_0x04c6('0x3d')]);_0x494c6c[_0x04c6('0x47')]=_[_0x04c6('0x3f')](_0x494c6c[_0x04c6('0x40')],_0x494c6c[_0x04c6('0x3d')]);_0x3db53f[_0x04c6('0x42')]=_[_0x04c6('0x3f')](_0x494c6c[_0x04c6('0x40')],qs[_0x04c6('0x41')](_0x179be4[_0x04c6('0x3d')][_0x04c6('0x41')]));_0x3db53f[_0x04c6('0x42')]=_0x3db53f[_0x04c6('0x42')]['length']?_0x3db53f[_0x04c6('0x42')]:_0x494c6c[_0x04c6('0x40')];if(!_0x179be4[_0x04c6('0x3d')][_0x04c6('0x61')](_0x04c6('0x65'))){_0x3db53f[_0x04c6('0x43')]=qs[_0x04c6('0x43')](_0x179be4[_0x04c6('0x3d')][_0x04c6('0x43')]);_0x3db53f[_0x04c6('0x2b')]=qs[_0x04c6('0x2b')](_0x179be4['query'][_0x04c6('0x2b')]);}_0x3db53f[_0x04c6('0x44')]=qs[_0x04c6('0x45')](_0x179be4['query'][_0x04c6('0x45')]);_0x3db53f[_0x04c6('0x46')]=qs[_0x04c6('0x47')](_[_0x04c6('0x62')](_0x179be4[_0x04c6('0x3d')],_0x494c6c[_0x04c6('0x47')]));_0x3db53f[_0x04c6('0x46')][_0x04c6('0x5e')]=_0x27ba21['id'];if(_0x179be4[_0x04c6('0x3d')]['filter']){_0x3db53f['where']=_['merge'](_0x3db53f['where'],{'$or':_[_0x04c6('0x3c')](_0x3db53f['attributes'],function(_0x7fe8c5){var _0x5a72f4={};_0x5a72f4[_0x7fe8c5]={'$like':'%'+_0x179be4[_0x04c6('0x3d')][_0x04c6('0x4a')]+'%'};return _0x5a72f4;})});}_0x3db53f=_[_0x04c6('0x48')]({},_0x3db53f,_0x179be4[_0x04c6('0x53')]);return db['OpenchannelInteraction']['count']({'where':_0x3db53f[_0x04c6('0x46')]})['then'](function(_0x562c1e){_0x89e1d1[_0x04c6('0x2a')]=_0x562c1e;if(_0x179be4[_0x04c6('0x3d')]['includeAll']){_0x3db53f['include']=[{'model':db[_0x04c6('0x69')],'as':_0x04c6('0x9b'),'required':![]},{'model':db[_0x04c6('0x9c')],'as':_0x04c6('0x9d'),'attributes':[_0x04c6('0x35'),_0x04c6('0x9e'),_0x04c6('0x9f')],'required':![]},{'model':db[_0x04c6('0xa0')],'as':'Tags','attributes':['id','name','color'],'where':_0x179be4[_0x04c6('0x3d')][_0x04c6('0xa1')]?{'id':_0x179be4[_0x04c6('0x3d')]['tag']}:undefined,'required':_0x179be4[_0x04c6('0x3d')][_0x04c6('0xa1')]?!![]:![]}];}return db[_0x04c6('0x85')][_0x04c6('0x4d')](_0x3db53f);})[_0x04c6('0x1e')](function(_0x326503){_0x89e1d1['rows']=_0x326503;return _0x89e1d1;});}})['then'](respondWithFilteredResult(_0x3d4459,_0x3db53f))[_0x04c6('0x25')](handleError(_0x3d4459,null));};exports[_0x04c6('0xa2')]=function(_0x4e6968,_0xa0f80b,_0x234388){return db[_0x04c6('0x39')][_0x04c6('0x5c')]({'where':{'id':_0x4e6968[_0x04c6('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa0f80b,null))[_0x04c6('0x1e')](function(_0x2f1a2b){if(_0x2f1a2b){return _0x2f1a2b[_0x04c6('0xa2')](_0x4e6968[_0x04c6('0x5b')][_0x04c6('0x67')],_[_0x04c6('0xa3')](_0x4e6968[_0x04c6('0x5b')],[_0x04c6('0x67'),'id'])||{})[_0x04c6('0xa4')](function(_0x166d09){for(var _0x5507c3=0x0;_0x5507c3<_0x4e6968['body'][_0x04c6('0x67')]['length'];_0x5507c3+=0x1){socket[_0x04c6('0xa5')]('userOpenchannelAccount:save',{'UserId':_0x4e6968['body']['ids'][_0x5507c3],'OpenchannelAccountId':_0x4e6968[_0x04c6('0x4f')]['id']});}return _0x166d09;});}})[_0x04c6('0x1e')](respondWithResult(_0xa0f80b,null))[_0x04c6('0x25')](handleError(_0xa0f80b,null));};exports['removeAgents']=function(_0x3ee9c5,_0xa1ff74,_0x584280){return db[_0x04c6('0x39')]['find']({'where':{'id':_0x3ee9c5[_0x04c6('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa1ff74,null))[_0x04c6('0x1e')](function(_0x2956df){if(_0x2956df){return _0x2956df[_0x04c6('0xa6')](_0x3ee9c5[_0x04c6('0x3d')]['ids'])[_0x04c6('0x1e')](function(){if(_['isArray'](_0x3ee9c5['query'][_0x04c6('0x67')])){for(var _0x259937=0x0;_0x259937<_0x3ee9c5[_0x04c6('0x3d')][_0x04c6('0x67')][_0x04c6('0x52')];_0x259937+=0x1){socket[_0x04c6('0xa5')](_0x04c6('0xa7'),{'UserId':Number(_0x3ee9c5[_0x04c6('0x3d')]['ids'][_0x259937]),'OpenchannelAccountId':Number(_0x3ee9c5[_0x04c6('0x4f')]['id'])});}}else{socket[_0x04c6('0xa5')](_0x04c6('0xa7'),{'UserId':Number(_0x3ee9c5[_0x04c6('0x3d')][_0x04c6('0x67')]),'OpenchannelAccountId':Number(_0x3ee9c5[_0x04c6('0x4f')]['id'])});}});}})[_0x04c6('0x1e')](respondWithStatusCode(_0xa1ff74,null))[_0x04c6('0x25')](handleError(_0xa1ff74,null));};exports[_0x04c6('0xa8')]=function(_0x3de7f9,_0x2068d7,_0x4c5c2e){var _0x6893bd={};var _0x580e57={};var _0x46438b;var _0x22b68e;return db['OpenchannelAccount'][_0x04c6('0x60')]({'where':{'id':_0x3de7f9[_0x04c6('0x4f')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x2068d7,null))[_0x04c6('0x1e')](function(_0x5ca6a2){if(_0x5ca6a2){_0x46438b=_0x5ca6a2;_0x580e57['model']=_[_0x04c6('0x3e')](db[_0x04c6('0x9c')][_0x04c6('0x51')]);_0x580e57[_0x04c6('0x3d')]=_['keys'](_0x3de7f9[_0x04c6('0x3d')]);_0x580e57['filters']=_['intersection'](_0x580e57[_0x04c6('0x40')],_0x580e57[_0x04c6('0x3d')]);_0x6893bd[_0x04c6('0x42')]=_[_0x04c6('0x3f')](_0x580e57[_0x04c6('0x40')],qs[_0x04c6('0x41')](_0x3de7f9[_0x04c6('0x3d')]['fields']));_0x6893bd[_0x04c6('0x42')]=_0x6893bd[_0x04c6('0x42')][_0x04c6('0x52')]?_0x6893bd[_0x04c6('0x42')]:_0x580e57[_0x04c6('0x40')];_0x6893bd['order']=qs[_0x04c6('0x45')](_0x3de7f9[_0x04c6('0x3d')][_0x04c6('0x45')]);_0x6893bd[_0x04c6('0x46')]=qs['filters'](_[_0x04c6('0x62')](_0x3de7f9[_0x04c6('0x3d')],_0x580e57[_0x04c6('0x47')]));if(_0x3de7f9['query'][_0x04c6('0x4a')]){_0x6893bd[_0x04c6('0x46')]=_[_0x04c6('0x48')](_0x6893bd[_0x04c6('0x46')],{'$or':_['map'](_0x6893bd[_0x04c6('0x42')],function(_0x5b6470){var _0x4faf63={};_0x4faf63[_0x5b6470]={'$like':'%'+_0x3de7f9[_0x04c6('0x3d')][_0x04c6('0x4a')]+'%'};return _0x4faf63;})});}_0x6893bd=_['merge']({},_0x6893bd,_0x3de7f9[_0x04c6('0x53')]);return _0x46438b[_0x04c6('0xa8')](_0x6893bd);}})[_0x04c6('0x1e')](function(_0x432cd3){if(_0x432cd3){_0x22b68e=_0x432cd3['length'];if(!_0x3de7f9[_0x04c6('0x3d')][_0x04c6('0x61')](_0x04c6('0x65'))){_0x6893bd['limit']=qs[_0x04c6('0x43')](_0x3de7f9[_0x04c6('0x3d')][_0x04c6('0x43')]);_0x6893bd[_0x04c6('0x2b')]=qs[_0x04c6('0x2b')](_0x3de7f9[_0x04c6('0x3d')][_0x04c6('0x2b')]);}return _0x46438b[_0x04c6('0xa8')](_0x6893bd);}})['then'](function(_0x8d349a){if(_0x8d349a){return _0x8d349a?{'count':_0x22b68e,'rows':_0x8d349a}:null;}})[_0x04c6('0x1e')](respondWithResult(_0x2068d7,null))[_0x04c6('0x25')](handleError(_0x2068d7,null));};exports[_0x04c6('0x36')]=function(_0x5e9441,_0x41b764,_0x2b68e1){var _0x27c0c7,_0x3e4f61,_0x4d4f15;if(_[_0x04c6('0x71')](_0x5e9441[_0x04c6('0x5b')][_0x04c6('0x5b')])||_0x5e9441[_0x04c6('0x5b')][_0x04c6('0x5b')]===''){throw new db[(_0x04c6('0x6a'))]['ValidationError'](_0x04c6('0x72'));}if(_[_0x04c6('0x71')](_0x5e9441['body']['to'])){}_0x27c0c7=_0x5e9441[_0x04c6('0x5b')]['to'];return db[_0x04c6('0x39')]['findOne']({'where':{'id':_0x5e9441['params']['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x41b764,null))['then'](function(_0x40ba28){if(_0x40ba28){return db[_0x04c6('0x39')][_0x04c6('0x5c')]({'where':{'id':_0x40ba28['id']},'include':[{'model':db[_0x04c6('0x77')],'as':_0x04c6('0x78'),'include':[{'model':db['CmContact'],'as':_0x04c6('0x79'),'where':{[_0x40ba28[_0x04c6('0x73')]]:_0x27c0c7},'limit':0x1,'order':[[_0x04c6('0x6e'),_0x04c6('0xa9')]]}]}]})[_0x04c6('0x1e')](handleEntityNotFound(_0x41b764,null))['then'](function(_0x169b33){if(_0x169b33&&_0x169b33[_0x04c6('0x78')]){_0x3e4f61=_0x169b33[_0x04c6('0x32')]({'plain':!![]});if(_0x3e4f61[_0x04c6('0x78')]&&_0x3e4f61[_0x04c6('0x78')][_0x04c6('0x79')]['length']){return _0x3e4f61[_0x04c6('0x78')][_0x04c6('0x79')][0x0];}return db['CmContact'][_0x04c6('0x54')](_[_0x04c6('0x7f')](_0x5e9441[_0x04c6('0x5b')],{'firstName':_0x27c0c7,[_0x169b33[_0x04c6('0x73')]]:_0x27c0c7,'phone':_0x27c0c7,'ListId':_0x3e4f61[_0x04c6('0xaa')]}));}})['then'](handleEntityNotFound(_0x41b764,null))[_0x04c6('0x1e')](function(_0x422de4){if(_0x422de4){_0x4d4f15=_0x422de4;return db[_0x04c6('0x85')]['find']({'where':{'ContactId':_0x4d4f15['id'],'closed':![],'OpenchannelAccountId':_0x3e4f61['id']}})['then'](function(_0xc4181d){if(_0xc4181d){return[_0xc4181d,![]];}return db[_0x04c6('0x85')][_0x04c6('0x54')]({'UserId':_0x5e9441[_0x04c6('0x55')]['id'],'ContactId':_0x4d4f15['id'],'OpenchannelAccountId':_0x3e4f61['id'],'lastMsgDirection':_0x04c6('0xab'),'Messages':[_[_0x04c6('0x48')](_0x5e9441[_0x04c6('0x5b')],{'read':![],'body':_0x5e9441[_0x04c6('0x5b')][_0x04c6('0x5b')],'OpenchannelAccountId':_0x3e4f61['id'],'UserId':_0x5e9441[_0x04c6('0x55')]['id'],'ContactId':_0x4d4f15['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x04c6('0xac')}]})[_0x04c6('0x1e')](function(_0x5c668f){return[_0x5c668f,!![]];});});}})['spread'](function(_0x3a55f4,_0x5b411e){if(_0x5b411e){return _0x3a55f4;}return db[_0x04c6('0x8a')]['create'](_['merge'](_0x5e9441[_0x04c6('0x5b')],{'read':![],'body':_0x5e9441[_0x04c6('0x5b')]['body'],'OpenchannelAccountId':_0x3e4f61['id'],'OpenchannelInteractionId':_0x3a55f4['id'],'UserId':_0x5e9441['user']['id'],'ContactId':_0x4d4f15['id']}))['then'](function(_0x2852ca){_0x3a55f4[_0x04c6('0xad')][_0x04c6('0xac')]=[];_0x3a55f4['dataValues'][_0x04c6('0xac')][_0x04c6('0xae')](_0x2852ca[_0x04c6('0xad')]);return _0x3a55f4;});});}})[_0x04c6('0x1e')](respondWithResult(_0x41b764,null))[_0x04c6('0x25')](handleError(_0x41b764,null));}; \ No newline at end of file +var _0x038b=['merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addDisposition','Disposition','getDispositions','pick','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','Contacts','DESC','Applications','account','applications','List','CmContact','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','forcedOwnership','startRouting','Start','EventManager','notify','sequelize','transaction','OpenchannelApplication','priority','getApplications','Owner','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','getAgents','isNil','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','end','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x038b,0x114));var _0xb038=function(_0x527159,_0x4a4993){_0x527159=_0x527159-0x0;var _0x555c11=_0x038b[_0x527159];return _0x555c11;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb038('0x0'));var rimraf=require(_0xb038('0x1'));var zipdir=require(_0xb038('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb038('0x3'));var moment=require('moment');var BPromise=require(_0xb038('0x4'));var Mustache=require(_0xb038('0x5'));var util=require('util');var path=require(_0xb038('0x6'));var sox=require(_0xb038('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0xb'));var querystring=require(_0xb038('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xd'));var qs=require(_0xb038('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xf'));var logger=require(_0xb038('0x10'))(_0xb038('0x11'));var utils=require(_0xb038('0x12'));var config=require(_0xb038('0x13'));var licenseUtil=require(_0xb038('0x14'));var db=require(_0xb038('0x15'))['db'];config[_0xb038('0x16')]=_[_0xb038('0x17')](config[_0xb038('0x16')],{'host':_0xb038('0x18'),'port':0x18eb});var socket=require(_0xb038('0x19'))(new Redis(config[_0xb038('0x16')]));require(_0xb038('0x1a'))[_0xb038('0x1b')](socket);var jayson=require(_0xb038('0x1c'));var client=jayson[_0xb038('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xb038('0x1d')][_0xb038('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x183141,_0x39323e,_0xdef213,_0x2b4173){return new BPromise(function(_0x5246c3,_0x2a4134){var _0x3039b0=_0x2b4173||client;return _0x3039b0[_0xb038('0x1f')](_0x183141,_0xdef213)[_0xb038('0x20')](function(_0x4aa892){logger['info'](_0xb038('0x21'),_0x39323e,_0xb038('0x22'));logger[_0xb038('0x23')](_0xb038('0x24'),_0x39323e,'request\x20sent',JSON[_0xb038('0x25')](_0x4aa892));if(_0x4aa892[_0xb038('0x26')]){if(_0x4aa892[_0xb038('0x26')][_0xb038('0x27')]===0x1f4){logger[_0xb038('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x39323e,_0x4aa892[_0xb038('0x26')][_0xb038('0x28')]);return _0x2a4134(_0x4aa892[_0xb038('0x26')][_0xb038('0x28')]);}logger['error'](_0xb038('0x21'),_0x39323e,_0x4aa892[_0xb038('0x26')]['message']);return _0x5246c3(_0x4aa892[_0xb038('0x26')][_0xb038('0x28')]);}else{logger['info'](_0xb038('0x21'),_0x39323e,'request\x20sent');_0x5246c3(_0x4aa892[_0xb038('0x29')][_0xb038('0x28')]);}})[_0xb038('0x2a')](function(_0x1df7c4){logger[_0xb038('0x26')](_0xb038('0x21'),_0x39323e,_0x1df7c4);_0x2a4134(_0x1df7c4);});});}function respondWithStatusCode(_0x3f7cff,_0x576be5){_0x576be5=_0x576be5||0xcc;return function(_0xb6d93f){if(_0xb6d93f){return _0x3f7cff[_0xb038('0x2b')](_0x576be5);}return _0x3f7cff[_0xb038('0x2c')](_0x576be5)['end']();};}function respondWithResult(_0xa8fe18,_0x3af191){_0x3af191=_0x3af191||0xc8;return function(_0x1fa72d){if(_0x1fa72d){return _0xa8fe18['status'](_0x3af191)[_0xb038('0x2d')](_0x1fa72d);}};}function respondWithFilteredResult(_0x2855a6,_0x28a6a9){return function(_0x12b3b6){if(_0x12b3b6){var _0xc387d=_0x12b3b6[_0xb038('0x2e')],_0x551b55=_0x28a6a9[_0xb038('0x2f')],_0x1783d4=_0x28a6a9[_0xb038('0x2f')]+_0x28a6a9[_0xb038('0x30')],_0x1a8aa5;if(_0x1783d4>=_0xc387d){_0x1783d4=_0xc387d;_0x1a8aa5=0xc8;}else{_0x1a8aa5=0xce;}_0x2855a6[_0xb038('0x2c')](_0x1a8aa5);return _0x2855a6[_0xb038('0x31')](_0xb038('0x32'),_0x551b55+'-'+_0x1783d4+'/'+_0xc387d)[_0xb038('0x2d')](_0x12b3b6);}return null;};}function patchUpdates(_0x1599c9){return function(_0x1a741f){try{jsonpatch[_0xb038('0x33')](_0x1a741f,_0x1599c9,!![]);}catch(_0x4f6837){return BPromise[_0xb038('0x34')](_0x4f6837);}return _0x1a741f['save']();};}function saveUpdates(_0x908d1f,_0x13bf20){return function(_0x495253){if(_0x495253){return _0x495253[_0xb038('0x35')](_0x908d1f)[_0xb038('0x20')](function(_0x424b81){return _0x424b81;});}return null;};}function removeEntity(_0x3a393d,_0x3e6373){return function(_0x22fac4){if(_0x22fac4){return _0x22fac4[_0xb038('0x36')]()['then'](function(){var _0x2cac56=_0x22fac4[_0xb038('0x37')]({'plain':!![]});var _0x460599='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x460599,'resourceId':_0x2cac56['id']}})[_0xb038('0x20')](function(){return _0x22fac4;});})[_0xb038('0x20')](function(){_0x3a393d[_0xb038('0x2c')](0xcc)[_0xb038('0x38')]();});}};}function handleEntityNotFound(_0x5340d6,_0x268f1b){return function(_0x48f777){if(!_0x48f777){_0x5340d6[_0xb038('0x2b')](0x194);}return _0x48f777;};}function handleError(_0x378cae,_0x1b6f1e){_0x1b6f1e=_0x1b6f1e||0x1f4;return function(_0x17c445){logger['error'](_0x17c445[_0xb038('0x39')]);if(_0x17c445[_0xb038('0x3a')]){delete _0x17c445['name'];}_0x378cae['status'](_0x1b6f1e)[_0xb038('0x3b')](_0x17c445);};}exports[_0xb038('0x3c')]=function(_0x1e960c,_0x26cf19){var _0x1393e6={'include':[{'model':db[_0xb038('0x3d')],'as':_0xb038('0x3e')}]},_0x5cb540={},_0x404f82={'count':0x0,'rows':[]};var _0x2d1e57=_['map'](db[_0xb038('0x3f')][_0xb038('0x40')],function(_0x7d2f79){return{'name':_0x7d2f79['fieldName'],'type':_0x7d2f79[_0xb038('0x41')]['key']};});_0x5cb540[_0xb038('0x42')]=_[_0xb038('0x43')](_0x2d1e57,_0xb038('0x3a'));_0x5cb540['query']=_[_0xb038('0x44')](_0x1e960c[_0xb038('0x45')]);_0x5cb540[_0xb038('0x46')]=_['intersection'](_0x5cb540[_0xb038('0x42')],_0x5cb540[_0xb038('0x45')]);_0x1393e6[_0xb038('0x47')]=_[_0xb038('0x48')](_0x5cb540['model'],qs[_0xb038('0x49')](_0x1e960c[_0xb038('0x45')][_0xb038('0x49')]));_0x1393e6[_0xb038('0x47')]=_0x1393e6['attributes'][_0xb038('0x4a')]?_0x1393e6[_0xb038('0x47')]:_0x5cb540['model'];if(!_0x1e960c[_0xb038('0x45')][_0xb038('0x4b')](_0xb038('0x4c'))){_0x1393e6['limit']=qs[_0xb038('0x30')](_0x1e960c[_0xb038('0x45')]['limit']);_0x1393e6['offset']=qs[_0xb038('0x2f')](_0x1e960c[_0xb038('0x45')][_0xb038('0x2f')]);}_0x1393e6[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x1e960c[_0xb038('0x45')][_0xb038('0x4e')]);_0x1393e6[_0xb038('0x4f')]=qs['filters'](_['pick'](_0x1e960c['query'],_0x5cb540[_0xb038('0x46')]),_0x2d1e57);if(_0x1e960c[_0xb038('0x45')]['filter']){_0x1393e6[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x1393e6[_0xb038('0x4f')],{'$or':_['map'](_0x2d1e57,function(_0x1a3d73){if(_0x1a3d73['type']!=='VIRTUAL'){var _0xaf1567={};_0xaf1567[_0x1a3d73[_0xb038('0x3a')]]={'$like':'%'+_0x1e960c[_0xb038('0x45')][_0xb038('0x51')]+'%'};return _0xaf1567;}})});}_0x1393e6=_[_0xb038('0x50')]({},_0x1393e6,_0x1e960c[_0xb038('0x52')]);var _0x2f053a={'where':_0x1393e6[_0xb038('0x4f')]};return db[_0xb038('0x3f')][_0xb038('0x2e')](_0x2f053a)['then'](function(_0x2faf54){_0x404f82[_0xb038('0x2e')]=_0x2faf54;if(_0x1e960c['query'][_0xb038('0x53')]){_0x1393e6[_0xb038('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xb038('0x55')](_0x1393e6);})[_0xb038('0x20')](function(_0x1e7162){_0x404f82[_0xb038('0x56')]=_0x1e7162;return _0x404f82;})[_0xb038('0x20')](respondWithFilteredResult(_0x26cf19,_0x1393e6))[_0xb038('0x2a')](handleError(_0x26cf19,null));};exports[_0xb038('0x57')]=function(_0x19ed8d,_0x3a291d){var _0x54a826={'raw':![],'where':{'id':_0x19ed8d[_0xb038('0x58')]['id']},'include':[{'model':db[_0xb038('0x3d')],'as':_0xb038('0x3e')}]},_0x62daba={};_0x62daba[_0xb038('0x42')]=_[_0xb038('0x44')](db['OpenchannelAccount'][_0xb038('0x40')]);_0x62daba[_0xb038('0x45')]=_[_0xb038('0x44')](_0x19ed8d[_0xb038('0x45')]);_0x62daba[_0xb038('0x46')]=_[_0xb038('0x48')](_0x62daba[_0xb038('0x42')],_0x62daba['query']);_0x54a826[_0xb038('0x47')]=_['intersection'](_0x62daba[_0xb038('0x42')],qs[_0xb038('0x49')](_0x19ed8d[_0xb038('0x45')][_0xb038('0x49')]));_0x54a826[_0xb038('0x47')]=_0x54a826['attributes']['length']?_0x54a826['attributes']:_0x62daba[_0xb038('0x42')];if(_0x19ed8d[_0xb038('0x45')][_0xb038('0x53')]){_0x54a826[_0xb038('0x54')]=[{'all':!![]}];}_0x54a826=_[_0xb038('0x50')]({},_0x54a826,_0x19ed8d[_0xb038('0x52')]);return db['OpenchannelAccount'][_0xb038('0x59')](_0x54a826)[_0xb038('0x20')](handleEntityNotFound(_0x3a291d,null))['then'](respondWithResult(_0x3a291d,null))['catch'](handleError(_0x3a291d,null));};exports[_0xb038('0x5a')]=function(_0x4b7557,_0x199971){return db['OpenchannelAccount'][_0xb038('0x5a')](_0x4b7557[_0xb038('0x5b')],{})[_0xb038('0x20')](function(_0x4300e9){var _0x4ee38b=_0x4b7557[_0xb038('0x5c')][_0xb038('0x37')]({'plain':!![]});if(!_0x4ee38b)throw new Error(_0xb038('0x5d'));if(_0x4ee38b[_0xb038('0x5e')]===_0xb038('0x5c')){var _0x1246c8=_0x4300e9[_0xb038('0x37')]({'plain':!![]});var _0x401f4c=_0xb038('0x5f');return db[_0xb038('0x60')][_0xb038('0x59')]({'where':{'name':_0x401f4c,'userProfileId':_0x4ee38b[_0xb038('0x61')]},'raw':!![]})['then'](function(_0x29e11e){if(_0x29e11e&&_0x29e11e[_0xb038('0x62')]===0x0){return db[_0xb038('0x63')][_0xb038('0x5a')]({'name':_0x1246c8[_0xb038('0x3a')],'resourceId':_0x1246c8['id'],'type':_0x29e11e['name'],'sectionId':_0x29e11e['id']},{})[_0xb038('0x20')](function(){return _0x4300e9;});}else{return _0x4300e9;}})['catch'](function(_0xfb3ce6){logger[_0xb038('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfb3ce6);throw _0xfb3ce6;});}return _0x4300e9;})[_0xb038('0x20')](respondWithResult(_0x199971,0xc9))[_0xb038('0x2a')](handleError(_0x199971,null));};exports[_0xb038('0x35')]=function(_0x4137cc,_0x120cc7){if(_0x4137cc[_0xb038('0x5b')]['id']){delete _0x4137cc[_0xb038('0x5b')]['id'];}return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x4137cc[_0xb038('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xb038('0x3e')}]})['then'](handleEntityNotFound(_0x120cc7,null))[_0xb038('0x20')](saveUpdates(_0x4137cc[_0xb038('0x5b')],null))[_0xb038('0x20')](respondWithResult(_0x120cc7,null))[_0xb038('0x2a')](handleError(_0x120cc7,null));};exports[_0xb038('0x36')]=function(_0x23fb92,_0x1d6cf5){return db['OpenchannelAccount']['find']({'where':{'id':_0x23fb92[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x1d6cf5,null))[_0xb038('0x20')](removeEntity(_0x1d6cf5,null))['catch'](handleError(_0x1d6cf5,null));};exports['describe']=function(_0x2fe359,_0x4b807f){return db[_0xb038('0x3f')]['describe']()[_0xb038('0x20')](respondWithResult(_0x4b807f,null))['catch'](handleError(_0x4b807f,null));};exports[_0xb038('0x64')]=function(_0x3d0ee1,_0x13e42f,_0x112d77){if(_0x3d0ee1[_0xb038('0x5b')]['id']){delete _0x3d0ee1[_0xb038('0x5b')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x3d0ee1[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x13e42f,null))[_0xb038('0x20')](function(_0x42f5dc){if(_0x42f5dc){_0x3d0ee1[_0xb038('0x5b')]['OpenchannelAccountId']=_0x42f5dc['id'];return db[_0xb038('0x65')]['create'](_0x3d0ee1[_0xb038('0x5b')]);}})[_0xb038('0x20')](respondWithResult(_0x13e42f,null))[_0xb038('0x2a')](handleError(_0x13e42f,null));};exports[_0xb038('0x66')]=function(_0x40abb7,_0x41b1d1,_0x3e2b92){var _0x137d26={'raw':![],'where':{}};var _0x195a49={};var _0x494fe5={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x40abb7[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x41b1d1,null))[_0xb038('0x20')](function(_0x5a995c){if(_0x5a995c){_0x195a49[_0xb038('0x42')]=_[_0xb038('0x44')](db[_0xb038('0x65')][_0xb038('0x40')]);_0x195a49[_0xb038('0x45')]=_[_0xb038('0x44')](_0x40abb7[_0xb038('0x45')]);_0x195a49[_0xb038('0x46')]=_[_0xb038('0x48')](_0x195a49[_0xb038('0x42')],_0x195a49[_0xb038('0x45')]);_0x137d26[_0xb038('0x47')]=_[_0xb038('0x48')](_0x195a49[_0xb038('0x42')],qs[_0xb038('0x49')](_0x40abb7[_0xb038('0x45')][_0xb038('0x49')]));_0x137d26[_0xb038('0x47')]=_0x137d26[_0xb038('0x47')]['length']?_0x137d26[_0xb038('0x47')]:_0x195a49[_0xb038('0x42')];if(!_0x40abb7[_0xb038('0x45')][_0xb038('0x4b')](_0xb038('0x4c'))){_0x137d26['limit']=qs[_0xb038('0x30')](_0x40abb7[_0xb038('0x45')][_0xb038('0x30')]);_0x137d26[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x40abb7[_0xb038('0x45')][_0xb038('0x2f')]);}_0x137d26[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x40abb7['query']['sort']);_0x137d26[_0xb038('0x4f')]=qs['filters'](_[_0xb038('0x67')](_0x40abb7['query'],_0x195a49['filters']));_0x137d26['where'][_0xb038('0x68')]=_0x5a995c['id'];if(_0x40abb7[_0xb038('0x45')]['filter']){_0x137d26[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x137d26[_0xb038('0x4f')],{'$or':_[_0xb038('0x43')](_0x137d26[_0xb038('0x47')],function(_0x1f960b){var _0xac08cf={};_0xac08cf[_0x1f960b]={'$like':'%'+_0x40abb7[_0xb038('0x45')][_0xb038('0x51')]+'%'};return _0xac08cf;})});}_0x137d26=_[_0xb038('0x50')]({},_0x137d26,_0x40abb7['options']);return db[_0xb038('0x65')][_0xb038('0x2e')]({'where':_0x137d26[_0xb038('0x4f')]})[_0xb038('0x20')](function(_0xfd78cf){_0x494fe5[_0xb038('0x2e')]=_0xfd78cf;if(_0x40abb7[_0xb038('0x45')]['includeAll']){_0x137d26[_0xb038('0x54')]=[{'all':!![]}];}return db[_0xb038('0x65')][_0xb038('0x55')](_0x137d26);})['then'](function(_0x551fcc){_0x494fe5[_0xb038('0x56')]=_0x551fcc;return _0x494fe5;});}})[_0xb038('0x20')](respondWithFilteredResult(_0x41b1d1,_0x137d26))[_0xb038('0x2a')](handleError(_0x41b1d1,null));};exports['removeDispositions']=function(_0x3af6a2,_0x2c8d17,_0x5b003a){return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x3af6a2[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x2c8d17,null))[_0xb038('0x20')](function(_0x3dc0ba){if(_0x3dc0ba){return _0x3dc0ba[_0xb038('0x69')](_0x3af6a2[_0xb038('0x45')][_0xb038('0x6a')]);}})[_0xb038('0x20')](respondWithStatusCode(_0x2c8d17,null))[_0xb038('0x2a')](handleError(_0x2c8d17,null));};exports[_0xb038('0x6b')]=function(_0x2ee9c5,_0x394c62,_0x5d1410){if(_0x2ee9c5[_0xb038('0x5b')]['id']){delete _0x2ee9c5[_0xb038('0x5b')]['id'];}return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x2ee9c5[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x394c62,null))[_0xb038('0x20')](function(_0xf9caa5){if(_0xf9caa5){_0x2ee9c5['body'][_0xb038('0x68')]=_0xf9caa5['id'];return db[_0xb038('0x6c')]['create'](_0x2ee9c5[_0xb038('0x5b')]);}})['then'](respondWithResult(_0x394c62,null))['catch'](handleError(_0x394c62,null));};exports[_0xb038('0x6d')]=function(_0x5ca2b0,_0x22e5d4,_0x4ff6cf){var _0x3493da={'raw':![],'where':{}};var _0x1d15df={};var _0x231ba1={'count':0x0,'rows':[]};return db[_0xb038('0x3f')][_0xb038('0x6e')]({'where':{'id':_0x5ca2b0[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x22e5d4,null))[_0xb038('0x20')](function(_0x4f82f4){if(_0x4f82f4){_0x1d15df['model']=_[_0xb038('0x44')](db[_0xb038('0x6c')][_0xb038('0x40')]);_0x1d15df[_0xb038('0x45')]=_['keys'](_0x5ca2b0[_0xb038('0x45')]);_0x1d15df[_0xb038('0x46')]=_[_0xb038('0x48')](_0x1d15df[_0xb038('0x42')],_0x1d15df[_0xb038('0x45')]);_0x3493da[_0xb038('0x47')]=_[_0xb038('0x48')](_0x1d15df[_0xb038('0x42')],qs[_0xb038('0x49')](_0x5ca2b0[_0xb038('0x45')]['fields']));_0x3493da['attributes']=_0x3493da[_0xb038('0x47')][_0xb038('0x4a')]?_0x3493da[_0xb038('0x47')]:_0x1d15df[_0xb038('0x42')];if(!_0x5ca2b0[_0xb038('0x45')][_0xb038('0x4b')](_0xb038('0x4c'))){_0x3493da['limit']=qs[_0xb038('0x30')](_0x5ca2b0[_0xb038('0x45')][_0xb038('0x30')]);_0x3493da[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x5ca2b0[_0xb038('0x45')]['offset']);}_0x3493da[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x5ca2b0[_0xb038('0x45')][_0xb038('0x4e')]);_0x3493da[_0xb038('0x4f')]=qs[_0xb038('0x46')](_[_0xb038('0x67')](_0x5ca2b0[_0xb038('0x45')],_0x1d15df[_0xb038('0x46')]));_0x3493da[_0xb038('0x4f')][_0xb038('0x68')]=_0x4f82f4['id'];if(_0x5ca2b0[_0xb038('0x45')][_0xb038('0x51')]){_0x3493da[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x3493da[_0xb038('0x4f')],{'$or':_['map'](_0x3493da['attributes'],function(_0x183048){var _0x17870b={};_0x17870b[_0x183048]={'$like':'%'+_0x5ca2b0[_0xb038('0x45')]['filter']+'%'};return _0x17870b;})});}_0x3493da=_[_0xb038('0x50')]({},_0x3493da,_0x5ca2b0[_0xb038('0x52')]);return db[_0xb038('0x6c')][_0xb038('0x2e')]({'where':_0x3493da['where']})['then'](function(_0xd6037){_0x231ba1[_0xb038('0x2e')]=_0xd6037;if(_0x5ca2b0['query'][_0xb038('0x53')]){_0x3493da[_0xb038('0x54')]=[{'all':!![]}];}return db[_0xb038('0x6c')][_0xb038('0x55')](_0x3493da);})['then'](function(_0xb204f3){_0x231ba1[_0xb038('0x56')]=_0xb204f3;return _0x231ba1;});}})[_0xb038('0x20')](respondWithFilteredResult(_0x22e5d4,_0x3493da))[_0xb038('0x2a')](handleError(_0x22e5d4,null));};exports[_0xb038('0x6f')]=function(_0x42642a,_0x108021,_0x4b6d6a){return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x42642a[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x108021,null))[_0xb038('0x20')](function(_0x5842c8){if(_0x5842c8){return _0x5842c8[_0xb038('0x6f')](_0x42642a['query'][_0xb038('0x6a')]);}})[_0xb038('0x20')](respondWithStatusCode(_0x108021,null))[_0xb038('0x2a')](handleError(_0x108021,null));};exports['notify']=function(_0x4cc9c6,_0x50a6f3,_0x1ef260){var _0x37a24f={'body':_0x4cc9c6[_0xb038('0x5b')],'channel':'openchannel'};var _0x3d737f=[];var _0x55131f=[];var _0x364bec={};var _0x4a2841=![];return db['CmContact'][_0xb038('0x70')]()[_0xb038('0x20')](function(_0x8e49ae){if(!_0x8e49ae){throw new db[(_0xb038('0x71'))][(_0xb038('0x72'))](_0xb038('0x73'));}_0x3d737f=_[_0xb038('0x74')](_['keys'](_0x8e49ae),[_0xb038('0x75'),'updatedAt']);_0x55131f=_['difference'](_[_0xb038('0x44')](_0x8e49ae),[_0xb038('0x75'),_0xb038('0x76'),_0xb038('0x77'),_0xb038('0x78')]);if(_0x4cc9c6[_0xb038('0x5b')]['id']){delete _0x4cc9c6[_0xb038('0x5b')]['id'];}if(_['isNil'](_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x79')])){throw new db[(_0xb038('0x71'))][(_0xb038('0x72'))](_0xb038('0x7a'));}if(_['isNil'](_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x5b')])||_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x5b')]===''){throw new db['Sequelize'][(_0xb038('0x72'))](_0xb038('0x7b'));}if(_['isNil'](_0x4cc9c6[_0xb038('0x5b')]['mapKey'])){throw new db[(_0xb038('0x71'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55131f);}if(!_['includes'](_0x55131f,_0x4cc9c6[_0xb038('0x5b')]['mapKey'])){throw new db[(_0xb038('0x71'))][(_0xb038('0x72'))](_0xb038('0x7c')+_0x55131f);}_0x364bec[_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x7d')]]=_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x79')];})[_0xb038('0x20')](function(){return db['OpenchannelAccount'][_0xb038('0x59')]({'where':{'id':_0x4cc9c6[_0xb038('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xb038('0x7e'),'where':_0x364bec,'limit':0x1,'order':[[_0xb038('0x76'),_0xb038('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0xb038('0x80')}]});})[_0xb038('0x20')](handleEntityNotFound(_0x50a6f3,null))[_0xb038('0x20')](function(_0x3e56b2){if(_0x3e56b2&&_0x3e56b2['List']){_0x37a24f[_0xb038('0x81')]=_0x3e56b2;_0x37a24f[_0xb038('0x82')]=_0x3e56b2[_0xb038('0x80')];_0x37a24f['list']=_0x3e56b2[_0xb038('0x83')];_0x37a24f[_0xb038('0x82')]=_['orderBy'](_0x37a24f[_0xb038('0x82')],['priority'],['asc']);if(_0x37a24f[_0xb038('0x81')][_0xb038('0x80')]){delete _0x37a24f['account']['Applications'];}if(_0x37a24f[_0xb038('0x81')][_0xb038('0x83')]&&_0x37a24f[_0xb038('0x81')][_0xb038('0x83')][_0xb038('0x7e')][_0xb038('0x4a')]){return _0x37a24f[_0xb038('0x81')][_0xb038('0x83')][_0xb038('0x7e')][0x0];}var _0xf6b7da=_[_0xb038('0x17')](_0x4cc9c6[_0xb038('0x5b')],{'firstName':_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x79')],'ListId':_0x3e56b2[_0xb038('0x78')]});_0xf6b7da[_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x7d')]]=_0x4cc9c6[_0xb038('0x5b')]['from'];return db[_0xb038('0x84')]['create'](_0xf6b7da,{'fields':_0x3d737f,'raw':!![]});}})['then'](handleEntityNotFound(_0x50a6f3,null))['then'](function(_0x1b387b){_0x37a24f[_0xb038('0x85')]=_0x1b387b;if(_0x1b387b){var _0x2267df={'ContactId':_0x1b387b['id'],'OpenchannelAccountId':_0x4cc9c6[_0xb038('0x58')]['id'],'from':(_0x1b387b[_0xb038('0x86')]||'')+'\x20'+(_0x1b387b[_0xb038('0x87')]||'')};var _0x18c1c6={'OpenchannelAccountId':_0x4cc9c6[_0xb038('0x58')]['id'],'closed':![]};if(_0x4cc9c6[_0xb038('0x5b')]['threadId']){_0x18c1c6[_0xb038('0x88')]=_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x88')];return db[_0xb038('0x89')]['find']({'where':_0x18c1c6})[_0xb038('0x20')](function(_0x5054a8){if(_0x5054a8){return[_0x5054a8,![]];}_0x2267df[_0xb038('0x88')]=_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x88')];_0x2267df[_0xb038('0x8a')]=_0x4cc9c6['body'][_0xb038('0x8a')];return db[_0xb038('0x89')][_0xb038('0x5a')](_0x2267df)[_0xb038('0x20')](function(_0x3bb82c){return[_0x3bb82c,!![]];});});}else{_0x18c1c6[_0xb038('0x88')]=null;}_0x18c1c6[_0xb038('0x8b')]=_0x1b387b['id'];return db['OpenchannelInteraction']['find']({'where':_0x18c1c6})[_0xb038('0x20')](function(_0x3df6f7){if(_0x3df6f7){return[_0x3df6f7,![]];}return db['OpenchannelInteraction']['create'](_0x2267df)[_0xb038('0x20')](function(_0x5b6b6b){return[_0x5b6b6b,!![]];});});}})[_0xb038('0x8c')](function(_0x2a7471,_0x3c6a48){if(_0x2a7471){_0x4a2841=_0x3c6a48;if(!_0x3c6a48){var _0x1f42a2={'from':(_0x37a24f['contact']['firstName']||'')+'\x20'+(_0x37a24f[_0xb038('0x85')][_0xb038('0x87')]||'')};if(_0x4cc9c6[_0xb038('0x5b')]['threadId']&&_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x8d')]&&_0x4cc9c6['body'][_0xb038('0x88')]!=_0x4cc9c6['body'][_0xb038('0x8d')]){_0x1f42a2[_0xb038('0x88')]=_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x8d')];}return _0x2a7471[_0xb038('0x35')](_0x1f42a2);}else{return _0x2a7471;}}})[_0xb038('0x20')](function(_0x24472e){_0x37a24f[_0xb038('0x8e')]=_0x24472e[_0xb038('0x37')]({'plain':!![]});_0x37a24f[_0xb038('0x8e')]['created']=_0x4a2841;if(_0x37a24f[_0xb038('0x8e')]['created']){if(_0x37a24f[_0xb038('0x81')][_0xb038('0x8f')]){_0x37a24f[_0xb038('0x82')][_0xb038('0x90')]({'id':0x0,'priority':_0x37a24f['applications']['length']+0x1,'app':_0xb038('0x91'),'appdata':_0xb038('0x92'),'interval':_0xb038('0x93')});}}return db[_0xb038('0x94')][_0xb038('0x5a')]({'body':_0x4cc9c6['body'][_0xb038('0x5b')],'OpenchannelAccountId':_0x4cc9c6[_0xb038('0x58')]['id'],'OpenchannelInteractionId':_0x24472e['id'],'direction':'in','ContactId':_0x37a24f[_0xb038('0x85')]['id'],'AttachmentId':_0x4cc9c6[_0xb038('0x5b')]['AttachmentId']});})[_0xb038('0x20')](function(_0x47f490){_0x37a24f[_0xb038('0x28')]=_0x47f490;if(_0x37a24f[_0xb038('0x8e')][_0xb038('0x95')]){return db[_0xb038('0x96')][_0xb038('0x59')]({'attributes':['id','name'],'where':{'id':_0x37a24f['interaction'][_0xb038('0x95')]}})[_0xb038('0x20')](function(_0x5298eb){if(_0x5298eb){_0x37a24f['applications'][_0xb038('0x97')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5298eb[_0xb038('0x3a')]+','+(_0x37a24f[_0xb038('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xb038('0x93')});_0x37a24f[_0xb038('0x98')]=![];}return respondWithRpcPromise('Start',_0xb038('0x99'),_0x37a24f);});}return respondWithRpcPromise(_0xb038('0x9a'),_0xb038('0x99'),_0x37a24f);})[_0xb038('0x20')](function(_0x3be3e4){respondWithRpcPromise(_0xb038('0x9b'),_0xb038('0x9b'),{'event':_0xb038('0x9c'),'message':_0x3be3e4},client9002);return _0x3be3e4;})[_0xb038('0x20')](respondWithResult(_0x50a6f3,null))[_0xb038('0x2a')](handleError(_0x50a6f3,null));};exports['addApplications']=function(_0x5b61a0,_0x1c79b8,_0x5b4e1d){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5b61a0['params']['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x1c79b8,null))[_0xb038('0x20')](function(_0x3f6506){if(_0x3f6506){return db[_0xb038('0x9d')][_0xb038('0x9e')](function(_0x30667a){return db['OpenchannelApplication'][_0xb038('0x36')]({'where':{'OpenchannelAccountId':_0x5b61a0['params']['id']},'transaction':_0x30667a})['then'](function(_0x405fae){var _0x260a66=_[_0xb038('0x43')](_0x5b61a0[_0xb038('0x5b')],function(_0x5b82d0){_0x5b82d0[_0xb038('0x68')]=_0x5b61a0[_0xb038('0x58')]['id'];return _0x5b82d0;});return db[_0xb038('0x9f')]['bulkCreate'](_0x260a66,{'transaction':_0x30667a});});})[_0xb038('0x20')](function(){return db[_0xb038('0x9f')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5b61a0['params']['id']},'order':_0xb038('0xa0')});});}})[_0xb038('0x20')](respondWithResult(_0x1c79b8,null))[_0xb038('0x2a')](handleError(_0x1c79b8,null));};exports[_0xb038('0xa1')]=function(_0x212139,_0x4ca7a9,_0x1f4881){var _0x11c3a2={};var _0x3069e4={};var _0x2806c5;var _0x5865a6;return db[_0xb038('0x3f')]['findOne']({'where':{'id':_0x212139[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x4ca7a9,null))['then'](function(_0x5437a1){if(_0x5437a1){_0x2806c5=_0x5437a1;_0x3069e4['model']=_[_0xb038('0x44')](db[_0xb038('0x9f')][_0xb038('0x40')]);_0x3069e4['query']=_[_0xb038('0x44')](_0x212139[_0xb038('0x45')]);_0x3069e4[_0xb038('0x46')]=_[_0xb038('0x48')](_0x3069e4[_0xb038('0x42')],_0x3069e4['query']);_0x11c3a2['attributes']=_[_0xb038('0x48')](_0x3069e4['model'],qs[_0xb038('0x49')](_0x212139[_0xb038('0x45')][_0xb038('0x49')]));_0x11c3a2['attributes']=_0x11c3a2[_0xb038('0x47')][_0xb038('0x4a')]?_0x11c3a2['attributes']:_0x3069e4[_0xb038('0x42')];_0x11c3a2[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x212139[_0xb038('0x45')][_0xb038('0x4e')]);_0x11c3a2[_0xb038('0x4f')]=qs[_0xb038('0x46')](_[_0xb038('0x67')](_0x212139['query'],_0x3069e4['filters']));if(_0x212139[_0xb038('0x45')][_0xb038('0x51')]){_0x11c3a2[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x11c3a2[_0xb038('0x4f')],{'$or':_[_0xb038('0x43')](_0x11c3a2[_0xb038('0x47')],function(_0x3dfdd9){var _0x513785={};_0x513785[_0x3dfdd9]={'$like':'%'+_0x212139[_0xb038('0x45')][_0xb038('0x51')]+'%'};return _0x513785;})});}_0x11c3a2=_['merge']({},_0x11c3a2,_0x212139[_0xb038('0x52')]);return _0x2806c5[_0xb038('0xa1')](_0x11c3a2);}})[_0xb038('0x20')](function(_0xe40f97){if(_0xe40f97){_0x5865a6=_0xe40f97[_0xb038('0x4a')];if(!_0x212139[_0xb038('0x45')][_0xb038('0x4b')](_0xb038('0x4c'))){_0x11c3a2[_0xb038('0x30')]=qs['limit'](_0x212139[_0xb038('0x45')][_0xb038('0x30')]);_0x11c3a2[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x212139[_0xb038('0x45')][_0xb038('0x2f')]);}return _0x2806c5[_0xb038('0xa1')](_0x11c3a2);}})[_0xb038('0x20')](function(_0x304f2e){if(_0x304f2e){return _0x304f2e?{'count':_0x5865a6,'rows':_0x304f2e}:null;}})[_0xb038('0x20')](respondWithResult(_0x4ca7a9,null))[_0xb038('0x2a')](handleError(_0x4ca7a9,null));};exports['getInteractions']=function(_0x58fd38,_0x76e7d6,_0x3a3c9b){var _0x591c9c={'raw':![],'where':{}};var _0x17eee3={};var _0x22e37e={'count':0x0,'rows':[]};return db[_0xb038('0x3f')]['findOne']({'where':{'id':_0x58fd38['params']['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x76e7d6,null))[_0xb038('0x20')](function(_0x4cd719){if(_0x4cd719){_0x17eee3['model']=_[_0xb038('0x44')](db[_0xb038('0x89')][_0xb038('0x40')]);_0x17eee3[_0xb038('0x45')]=_[_0xb038('0x44')](_0x58fd38['query']);_0x17eee3[_0xb038('0x46')]=_[_0xb038('0x48')](_0x17eee3[_0xb038('0x42')],_0x17eee3['query']);_0x591c9c[_0xb038('0x47')]=_[_0xb038('0x48')](_0x17eee3['model'],qs[_0xb038('0x49')](_0x58fd38[_0xb038('0x45')][_0xb038('0x49')]));_0x591c9c[_0xb038('0x47')]=_0x591c9c['attributes']['length']?_0x591c9c['attributes']:_0x17eee3[_0xb038('0x42')];if(!_0x58fd38['query'][_0xb038('0x4b')](_0xb038('0x4c'))){_0x591c9c[_0xb038('0x30')]=qs[_0xb038('0x30')](_0x58fd38[_0xb038('0x45')][_0xb038('0x30')]);_0x591c9c[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x58fd38['query'][_0xb038('0x2f')]);}_0x591c9c[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x58fd38['query']['sort']);_0x591c9c[_0xb038('0x4f')]=qs[_0xb038('0x46')](_[_0xb038('0x67')](_0x58fd38[_0xb038('0x45')],_0x17eee3['filters']));_0x591c9c[_0xb038('0x4f')][_0xb038('0x68')]=_0x4cd719['id'];if(_0x58fd38[_0xb038('0x45')]['filter']){_0x591c9c['where']=_[_0xb038('0x50')](_0x591c9c[_0xb038('0x4f')],{'$or':_[_0xb038('0x43')](_0x591c9c[_0xb038('0x47')],function(_0x222e9a){var _0x51c64b={};_0x51c64b[_0x222e9a]={'$like':'%'+_0x58fd38[_0xb038('0x45')]['filter']+'%'};return _0x51c64b;})});}_0x591c9c=_[_0xb038('0x50')]({},_0x591c9c,_0x58fd38['options']);return db['OpenchannelInteraction'][_0xb038('0x2e')]({'where':_0x591c9c[_0xb038('0x4f')]})[_0xb038('0x20')](function(_0x4f1755){_0x22e37e[_0xb038('0x2e')]=_0x4f1755;if(_0x58fd38['query']['includeAll']){_0x591c9c['include']=[{'model':db[_0xb038('0x84')],'as':'Contact','required':![]},{'model':db[_0xb038('0x96')],'as':_0xb038('0xa2'),'attributes':[_0xb038('0x3a'),_0xb038('0xa3'),'internal'],'required':![]},{'model':db[_0xb038('0xa4')],'as':'Tags','attributes':['id',_0xb038('0x3a'),_0xb038('0xa5')],'where':_0x58fd38[_0xb038('0x45')][_0xb038('0xa6')]?{'id':_0x58fd38[_0xb038('0x45')][_0xb038('0xa6')]}:undefined,'required':_0x58fd38['query'][_0xb038('0xa6')]?!![]:![]}];}return db[_0xb038('0x89')][_0xb038('0x55')](_0x591c9c);})[_0xb038('0x20')](function(_0x27e37d){_0x22e37e['rows']=_0x27e37d;return _0x22e37e;});}})[_0xb038('0x20')](respondWithFilteredResult(_0x76e7d6,_0x591c9c))[_0xb038('0x2a')](handleError(_0x76e7d6,null));};exports[_0xb038('0xa7')]=function(_0x1b1750,_0x5c5edb,_0x30191a){return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x1b1750[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x5c5edb,null))[_0xb038('0x20')](function(_0x1322a8){if(_0x1322a8){return _0x1322a8[_0xb038('0xa7')](_0x1b1750['body'][_0xb038('0x6a')],_[_0xb038('0xa8')](_0x1b1750['body'],['ids','id'])||{})[_0xb038('0x8c')](function(_0x33225e){for(var _0x310ddc=0x0;_0x310ddc<_0x1b1750[_0xb038('0x5b')][_0xb038('0x6a')]['length'];_0x310ddc+=0x1){socket[_0xb038('0xa9')](_0xb038('0xaa'),{'UserId':_0x1b1750[_0xb038('0x5b')][_0xb038('0x6a')][_0x310ddc],'OpenchannelAccountId':_0x1b1750[_0xb038('0x58')]['id']});}return _0x33225e;});}})[_0xb038('0x20')](respondWithResult(_0x5c5edb,null))[_0xb038('0x2a')](handleError(_0x5c5edb,null));};exports[_0xb038('0xab')]=function(_0x3a0ce9,_0x24c951,_0xd0b234){return db[_0xb038('0x3f')]['find']({'where':{'id':_0x3a0ce9[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x24c951,null))[_0xb038('0x20')](function(_0x5ce44e){if(_0x5ce44e){return _0x5ce44e[_0xb038('0xab')](_0x3a0ce9[_0xb038('0x45')]['ids'])[_0xb038('0x20')](function(){if(_['isArray'](_0x3a0ce9[_0xb038('0x45')]['ids'])){for(var _0x18cc50=0x0;_0x18cc50<_0x3a0ce9[_0xb038('0x45')]['ids'][_0xb038('0x4a')];_0x18cc50+=0x1){socket[_0xb038('0xa9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3a0ce9['query']['ids'][_0x18cc50]),'OpenchannelAccountId':Number(_0x3a0ce9[_0xb038('0x58')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x3a0ce9[_0xb038('0x45')]['ids']),'OpenchannelAccountId':Number(_0x3a0ce9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x24c951,null))[_0xb038('0x2a')](handleError(_0x24c951,null));};exports[_0xb038('0xac')]=function(_0x18797a,_0x29403e,_0x2b9627){var _0x112b57={};var _0x13207a={};var _0x2de2a5;var _0x48f70b;return db[_0xb038('0x3f')][_0xb038('0x6e')]({'where':{'id':_0x18797a[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x29403e,null))[_0xb038('0x20')](function(_0xef58f){if(_0xef58f){_0x2de2a5=_0xef58f;_0x13207a[_0xb038('0x42')]=_[_0xb038('0x44')](db['User']['rawAttributes']);_0x13207a[_0xb038('0x45')]=_[_0xb038('0x44')](_0x18797a['query']);_0x13207a['filters']=_[_0xb038('0x48')](_0x13207a['model'],_0x13207a[_0xb038('0x45')]);_0x112b57[_0xb038('0x47')]=_[_0xb038('0x48')](_0x13207a['model'],qs[_0xb038('0x49')](_0x18797a[_0xb038('0x45')]['fields']));_0x112b57[_0xb038('0x47')]=_0x112b57[_0xb038('0x47')][_0xb038('0x4a')]?_0x112b57[_0xb038('0x47')]:_0x13207a[_0xb038('0x42')];_0x112b57[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x18797a[_0xb038('0x45')]['sort']);_0x112b57[_0xb038('0x4f')]=qs[_0xb038('0x46')](_[_0xb038('0x67')](_0x18797a[_0xb038('0x45')],_0x13207a[_0xb038('0x46')]));if(_0x18797a[_0xb038('0x45')][_0xb038('0x51')]){_0x112b57[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x112b57['where'],{'$or':_[_0xb038('0x43')](_0x112b57[_0xb038('0x47')],function(_0x2687fc){var _0xc54892={};_0xc54892[_0x2687fc]={'$like':'%'+_0x18797a[_0xb038('0x45')][_0xb038('0x51')]+'%'};return _0xc54892;})});}_0x112b57=_['merge']({},_0x112b57,_0x18797a['options']);return _0x2de2a5[_0xb038('0xac')](_0x112b57);}})['then'](function(_0x46947d){if(_0x46947d){_0x48f70b=_0x46947d[_0xb038('0x4a')];if(!_0x18797a[_0xb038('0x45')][_0xb038('0x4b')]('nolimit')){_0x112b57['limit']=qs['limit'](_0x18797a[_0xb038('0x45')][_0xb038('0x30')]);_0x112b57[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x18797a[_0xb038('0x45')][_0xb038('0x2f')]);}return _0x2de2a5['getAgents'](_0x112b57);}})[_0xb038('0x20')](function(_0x48e14f){if(_0x48e14f){return _0x48e14f?{'count':_0x48f70b,'rows':_0x48e14f}:null;}})[_0xb038('0x20')](respondWithResult(_0x29403e,null))['catch'](handleError(_0x29403e,null));};exports[_0xb038('0x3b')]=function(_0x387ee5,_0x5ae389,_0x15d479){var _0x1a782e,_0x39e5ef,_0x37a25d;if(_[_0xb038('0xad')](_0x387ee5[_0xb038('0x5b')][_0xb038('0x5b')])||_0x387ee5[_0xb038('0x5b')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb038('0xad')](_0x387ee5['body']['to'])){}_0x1a782e=_0x387ee5[_0xb038('0x5b')]['to'];return db['OpenchannelAccount'][_0xb038('0x6e')]({'where':{'id':_0x387ee5[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x5ae389,null))[_0xb038('0x20')](function(_0x1cf562){if(_0x1cf562){return db['OpenchannelAccount']['find']({'where':{'id':_0x1cf562['id']},'include':[{'model':db[_0xb038('0xae')],'as':_0xb038('0x83'),'include':[{'model':db[_0xb038('0x84')],'as':'Contacts','where':{[_0x1cf562[_0xb038('0x7d')]]:_0x1a782e},'limit':0x1,'order':[[_0xb038('0x76'),'DESC']]}]}]})[_0xb038('0x20')](handleEntityNotFound(_0x5ae389,null))[_0xb038('0x20')](function(_0x53db21){if(_0x53db21&&_0x53db21[_0xb038('0x83')]){_0x39e5ef=_0x53db21[_0xb038('0x37')]({'plain':!![]});if(_0x39e5ef[_0xb038('0x83')]&&_0x39e5ef[_0xb038('0x83')][_0xb038('0x7e')]['length']){return _0x39e5ef[_0xb038('0x83')][_0xb038('0x7e')][0x0];}return db['CmContact'][_0xb038('0x5a')](_['defaults'](_0x387ee5['body'],{'firstName':_0x1a782e,[_0x53db21[_0xb038('0x7d')]]:_0x1a782e,'phone':_0x1a782e,'ListId':_0x39e5ef[_0xb038('0x78')]}));}})[_0xb038('0x20')](handleEntityNotFound(_0x5ae389,null))[_0xb038('0x20')](function(_0x2b6e67){if(_0x2b6e67){_0x37a25d=_0x2b6e67;return db[_0xb038('0x89')][_0xb038('0x59')]({'where':{'ContactId':_0x37a25d['id'],'closed':![],'OpenchannelAccountId':_0x39e5ef['id']}})[_0xb038('0x20')](function(_0x1c5659){if(_0x1c5659){return[_0x1c5659,![]];}return db[_0xb038('0x89')][_0xb038('0x5a')]({'UserId':_0x387ee5[_0xb038('0x5c')]['id'],'ContactId':_0x37a25d['id'],'OpenchannelAccountId':_0x39e5ef['id'],'lastMsgDirection':_0xb038('0xaf'),'Messages':[_[_0xb038('0x50')](_0x387ee5[_0xb038('0x5b')],{'read':![],'body':_0x387ee5['body']['body'],'OpenchannelAccountId':_0x39e5ef['id'],'UserId':_0x387ee5['user']['id'],'ContactId':_0x37a25d['id']})]},{'include':[{'model':db[_0xb038('0x94')],'as':_0xb038('0xb0')}]})[_0xb038('0x20')](function(_0x42faf6){return[_0x42faf6,!![]];});});}})[_0xb038('0x8c')](function(_0x4045aa,_0xed0386){if(_0xed0386){return _0x4045aa;}return db[_0xb038('0x94')][_0xb038('0x5a')](_[_0xb038('0x50')](_0x387ee5['body'],{'read':![],'body':_0x387ee5[_0xb038('0x5b')][_0xb038('0x5b')],'OpenchannelAccountId':_0x39e5ef['id'],'OpenchannelInteractionId':_0x4045aa['id'],'UserId':_0x387ee5[_0xb038('0x5c')]['id'],'ContactId':_0x37a25d['id']}))[_0xb038('0x20')](function(_0x503679){_0x4045aa[_0xb038('0xb1')][_0xb038('0xb0')]=[];_0x4045aa['dataValues'][_0xb038('0xb0')][_0xb038('0x90')](_0x503679[_0xb038('0xb1')]);return _0x4045aa;});});}})['then'](respondWithResult(_0x5ae389,null))['catch'](handleError(_0x5ae389,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 47f01f8..e729af8 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ead=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount'];(function(_0x21497d,_0x202e49){var _0x56606e=function(_0x504744){while(--_0x504744){_0x21497d['push'](_0x21497d['shift']());}};_0x56606e(++_0x202e49);}(_0x3ead,0xbc));var _0xd3ea=function(_0x4a34e0,_0x29ff2f){_0x4a34e0=_0x4a34e0-0x0;var _0xb5ce1d=_0x3ead[_0x4a34e0];return _0xb5ce1d;};'use strict';var EventEmitter=require(_0xd3ea('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xd3ea('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd3ea('0x2')](0x0);var events={'afterCreate':_0xd3ea('0x3'),'afterUpdate':_0xd3ea('0x4'),'afterDestroy':_0xd3ea('0x5')};function emitEvent(_0x271486){return function(_0x43b521,_0x5cd6b8,_0x399cc0){OpenchannelAccountEvents['emit'](_0x271486+':'+_0x43b521['id'],_0x43b521);OpenchannelAccountEvents[_0xd3ea('0x6')](_0x271486,_0x43b521);_0x399cc0(null);};}for(var e in events){if(events[_0xd3ea('0x7')](e)){var event=events[e];OpenchannelAccount[_0xd3ea('0x8')](e,emitEvent(event));}}module[_0xd3ea('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xd807=['OpenchannelAccount','setMaxListeners','save','update','emit','hasOwnProperty','../../mysqldb'];(function(_0x42766f,_0x4cd443){var _0x5268bc=function(_0x25c4a2){while(--_0x25c4a2){_0x42766f['push'](_0x42766f['shift']());}};_0x5268bc(++_0x4cd443);}(_0xd807,0x102));var _0x7d80=function(_0x4e5fab,_0x131bbe){_0x4e5fab=_0x4e5fab-0x0;var _0x43c714=_0xd807[_0x4e5fab];return _0x43c714;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x7d80('0x0'))['db'][_0x7d80('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7d80('0x2')](0x0);var events={'afterCreate':_0x7d80('0x3'),'afterUpdate':_0x7d80('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a66a5){return function(_0x1e89b9,_0x344039,_0x210fcc){OpenchannelAccountEvents['emit'](_0x5a66a5+':'+_0x1e89b9['id'],_0x1e89b9);OpenchannelAccountEvents[_0x7d80('0x5')](_0x5a66a5,_0x1e89b9);_0x210fcc(null);};}for(var e in events){if(events[_0x7d80('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 7986e1f..1fbb198 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81f1=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts'];(function(_0x769935,_0x2311a5){var _0x24f62e=function(_0x44c9cd){while(--_0x44c9cd){_0x769935['push'](_0x769935['shift']());}};_0x24f62e(++_0x2311a5);}(_0x81f1,0x16c));var _0x181f=function(_0x492686,_0x2e048c){_0x492686=_0x492686-0x0;var _0x3399e5=_0x81f1[_0x492686];return _0x3399e5;};'use strict';var _=require(_0x181f('0x0'));var util=require(_0x181f('0x1'));var logger=require('../../config/logger')(_0x181f('0x2'));var moment=require(_0x181f('0x3'));var BPromise=require(_0x181f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x181f('0x5'));var rimraf=require(_0x181f('0x6'));var config=require(_0x181f('0x7'));var attributes=require(_0x181f('0x8'));module[_0x181f('0x9')]=function(_0x41a49a,_0x341e59){return _0x41a49a[_0x181f('0xa')](_0x181f('0xb'),attributes,{'tableName':_0x181f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbab3=['api','moment','request-promise','./openchannelAccount.attributes','define','OpenchannelAccount','openchannel_accounts','lodash','../../config/logger'];(function(_0xe2ebaa,_0x138483){var _0x563838=function(_0x542a4c){while(--_0x542a4c){_0xe2ebaa['push'](_0xe2ebaa['shift']());}};_0x563838(++_0x138483);}(_0xbab3,0x130));var _0x3bab=function(_0x40f4cc,_0x432f55){_0x40f4cc=_0x40f4cc-0x0;var _0x458315=_0xbab3[_0x40f4cc];return _0x458315;};'use strict';var _=require(_0x3bab('0x0'));var util=require('util');var logger=require(_0x3bab('0x1'))(_0x3bab('0x2'));var moment=require(_0x3bab('0x3'));var BPromise=require('bluebird');var rp=require(_0x3bab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3bab('0x5'));module['exports']=function(_0xb78bb2,_0x11a9e0){return _0xb78bb2[_0x3bab('0x6')](_0x3bab('0x7'),attributes,{'tableName':_0x3bab('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index fb0b44c..d9c637c 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36a8=['defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x36a8,0x1cf));var _0x836a=function(_0x3d86f4,_0x2a9220){_0x3d86f4=_0x3d86f4-0x0;var _0x5d8e87=_0x36a8[_0x3d86f4];return _0x5d8e87;};'use strict';var _=require(_0x836a('0x0'));var util=require(_0x836a('0x1'));var moment=require(_0x836a('0x2'));var BPromise=require(_0x836a('0x3'));var rs=require(_0x836a('0x4'));var fs=require('fs');var Redis=require(_0x836a('0x5'));var db=require(_0x836a('0x6'))['db'];var utils=require(_0x836a('0x7'));var logger=require(_0x836a('0x8'))('rpc');var config=require(_0x836a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x836a('0xa')][_0x836a('0xb')]({'port':0x232a});config[_0x836a('0xc')]=_[_0x836a('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x836a('0xe'))(new Redis(config[_0x836a('0xc')]));require(_0x836a('0xf'))[_0x836a('0x10')](socket);function respondWithRpcPromise(_0x4146f2,_0x2b20f9,_0x5310b0){return new BPromise(function(_0x2709a5,_0x489dc2){return client[_0x836a('0x11')](_0x4146f2,_0x5310b0)[_0x836a('0x12')](function(_0x750e3c){logger[_0x836a('0x13')](_0x836a('0x14'),_0x2b20f9,'request\x20sent');logger['debug'](_0x836a('0x15'),_0x2b20f9,_0x836a('0x16'),JSON[_0x836a('0x17')](_0x750e3c));if(_0x750e3c[_0x836a('0x18')]){if(_0x750e3c[_0x836a('0x18')]['code']===0x1f4){logger['error'](_0x836a('0x14'),_0x2b20f9,_0x750e3c['error'][_0x836a('0x19')]);return _0x489dc2(_0x750e3c[_0x836a('0x18')]['message']);}logger[_0x836a('0x18')](_0x836a('0x14'),_0x2b20f9,_0x750e3c[_0x836a('0x18')][_0x836a('0x19')]);return _0x2709a5(_0x750e3c[_0x836a('0x18')][_0x836a('0x19')]);}else{logger['info'](_0x836a('0x14'),_0x2b20f9,'request\x20sent');_0x2709a5(_0x750e3c[_0x836a('0x1a')][_0x836a('0x19')]);}})[_0x836a('0x1b')](function(_0x2f6ad8){logger[_0x836a('0x18')](_0x836a('0x14'),_0x2b20f9,_0x2f6ad8);_0x489dc2(_0x2f6ad8);});});} \ No newline at end of file +var _0x4102=['error','message','info','catch','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4102,0x122));var _0x2410=function(_0x58fad4,_0x489631){_0x58fad4=_0x58fad4-0x0;var _0x10db9c=_0x4102[_0x58fad4];return _0x10db9c;};'use strict';var _=require('lodash');var util=require(_0x2410('0x0'));var moment=require(_0x2410('0x1'));var BPromise=require('bluebird');var rs=require(_0x2410('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2410('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2410('0x4'));var config=require('../../config/environment');var jayson=require(_0x2410('0x5'));var client=jayson[_0x2410('0x6')][_0x2410('0x7')]({'port':0x232a});config['redis']=_[_0x2410('0x8')](config[_0x2410('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2410('0x9')]));require(_0x2410('0xa'))[_0x2410('0xb')](socket);function respondWithRpcPromise(_0x214739,_0x598c1b,_0x576bc4){return new BPromise(function(_0x43ae80,_0x1bb151){return client[_0x2410('0xc')](_0x214739,_0x576bc4)[_0x2410('0xd')](function(_0x4bd107){logger['info'](_0x2410('0xe'),_0x598c1b,_0x2410('0xf'));logger[_0x2410('0x10')](_0x2410('0x11'),_0x598c1b,_0x2410('0xf'),JSON['stringify'](_0x4bd107));if(_0x4bd107['error']){if(_0x4bd107[_0x2410('0x12')]['code']===0x1f4){logger[_0x2410('0x12')](_0x2410('0xe'),_0x598c1b,_0x4bd107[_0x2410('0x12')][_0x2410('0x13')]);return _0x1bb151(_0x4bd107[_0x2410('0x12')][_0x2410('0x13')]);}logger[_0x2410('0x12')](_0x2410('0xe'),_0x598c1b,_0x4bd107['error'][_0x2410('0x13')]);return _0x43ae80(_0x4bd107[_0x2410('0x12')][_0x2410('0x13')]);}else{logger[_0x2410('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x598c1b,_0x2410('0xf'));_0x43ae80(_0x4bd107['result']['message']);}})[_0x2410('0x15')](function(_0x3bf3b1){logger[_0x2410('0x12')](_0x2410('0xe'),_0x598c1b,_0x3bf3b1);_0x1bb151(_0x3bf3b1);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 3b384c6..0623870 100644 --- a/server/api/openchannelAccount/openchannelAccount.socket.js +++ b/server/api/openchannelAccount/openchannelAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac1d=['save','remove','update','emit','removeListener','register','length','./openchannelAccount.events'];(function(_0x2c9f17,_0x2c28c5){var _0x3112e4=function(_0x4208b0){while(--_0x4208b0){_0x2c9f17['push'](_0x2c9f17['shift']());}};_0x3112e4(++_0x2c28c5);}(_0xac1d,0x117));var _0xdac1=function(_0x3e303a,_0x1c95b4){_0x3e303a=_0x3e303a-0x0;var _0x3e2850=_0xac1d[_0x3e303a];return _0x3e2850;};'use strict';var OpenchannelAccountEvents=require(_0xdac1('0x0'));var events=[_0xdac1('0x1'),_0xdac1('0x2'),_0xdac1('0x3')];function createListener(_0x4f3aed,_0x54ddac){return function(_0x338de4){_0x54ddac[_0xdac1('0x4')](_0x4f3aed,_0x338de4);};}function removeListener(_0x2589e8,_0xf1c36c){return function(){OpenchannelAccountEvents[_0xdac1('0x5')](_0x2589e8,_0xf1c36c);};}exports[_0xdac1('0x6')]=function(_0x4a1ede){for(var _0x3f399f=0x0,_0x351249=events[_0xdac1('0x7')];_0x3f399f<_0x351249;_0x3f399f++){var _0x3f410b=events[_0x3f399f];var _0x5ca9e5=createListener('openchannelAccount:'+_0x3f410b,_0x4a1ede);OpenchannelAccountEvents['on'](_0x3f410b,_0x5ca9e5);}}; \ No newline at end of file +var _0x2a50=['update','removeListener','register','length','openchannelAccount:','remove'];(function(_0x2d3f1d,_0x2a0715){var _0x19b6fc=function(_0x58bec8){while(--_0x58bec8){_0x2d3f1d['push'](_0x2d3f1d['shift']());}};_0x19b6fc(++_0x2a0715);}(_0x2a50,0x1df));var _0x02a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a50[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x02a5('0x0'),_0x02a5('0x1')];function createListener(_0x5b5bad,_0x5560dc){return function(_0x180f32){_0x5560dc['emit'](_0x5b5bad,_0x180f32);};}function removeListener(_0x9b33fd,_0x10341c){return function(){OpenchannelAccountEvents[_0x02a5('0x2')](_0x9b33fd,_0x10341c);};}exports[_0x02a5('0x3')]=function(_0x39b750){for(var _0x157388=0x0,_0x2625fb=events[_0x02a5('0x4')];_0x157388<_0x2625fb;_0x157388++){var _0xc5ebf2=events[_0x157388];var _0x5b772e=createListener(_0x02a5('0x5')+_0xc5ebf2,_0x39b750);OpenchannelAccountEvents['on'](_0xc5ebf2,_0x5b772e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8975119..ac4020a 100644 --- a/server/api/openchannelApplication/index.js +++ b/server/api/openchannelApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50ab=['exports','multer','util','path','express','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','destroy'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x50ab,0x1e1));var _0xb50a=function(_0x554cab,_0x22a8c6){_0x554cab=_0x554cab-0x0;var _0x155fdd=_0x50ab[_0x554cab];return _0x155fdd;};'use strict';var multer=require(_0xb50a('0x0'));var util=require(_0xb50a('0x1'));var path=require(_0xb50a('0x2'));var timeout=require('connect-timeout');var express=require(_0xb50a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb50a('0x4'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xb50a('0x5')]('/',auth[_0xb50a('0x6')](),controller[_0xb50a('0x7')]);router['get'](_0xb50a('0x8'),auth[_0xb50a('0x6')](),controller[_0xb50a('0x9')]);router[_0xb50a('0xa')]('/',auth[_0xb50a('0x6')](),controller['create']);router[_0xb50a('0xb')](_0xb50a('0x8'),auth['isAuthenticated'](),controller[_0xb50a('0xc')]);router['delete'](_0xb50a('0x8'),auth[_0xb50a('0x6')](),controller[_0xb50a('0xd')]);module[_0xb50a('0xe')]=router; \ No newline at end of file +var _0x85c2=['delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0x251530,_0x1211a4){var _0x4b0683=function(_0x4ef876){while(--_0x4ef876){_0x251530['push'](_0x251530['shift']());}};_0x4b0683(++_0x1211a4);}(_0x85c2,0x17c));var _0x285c=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x85c2[_0x455c6c];return _0x488242;};'use strict';var multer=require(_0x285c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x285c('0x1'));var express=require(_0x285c('0x2'));var router=express[_0x285c('0x3')]();var auth=require(_0x285c('0x4'));var interaction=require(_0x285c('0x5'));var config=require(_0x285c('0x6'));var controller=require(_0x285c('0x7'));router['get']('/',auth[_0x285c('0x8')](),controller[_0x285c('0x9')]);router[_0x285c('0xa')](_0x285c('0xb'),auth[_0x285c('0x8')](),controller['show']);router[_0x285c('0xc')]('/',auth[_0x285c('0x8')](),controller[_0x285c('0xd')]);router[_0x285c('0xe')](_0x285c('0xb'),auth[_0x285c('0x8')](),controller[_0x285c('0xf')]);router[_0x285c('0x10')](_0x285c('0xb'),auth[_0x285c('0x8')](),controller[_0x285c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 9585315..2e0d330 100644 --- a/server/api/openchannelApplication/openchannelApplication.attributes.js +++ b/server/api/openchannelApplication/openchannelApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5424=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x5424,0x189));var _0x4542=function(_0x3a852a,_0xf3f1d3){_0x3a852a=_0x3a852a-0x0;var _0x48c902=_0x5424[_0x3a852a];return _0x48c902;};'use strict';var Sequelize=require(_0x4542('0x0'));module[_0x4542('0x1')]={'priority':{'type':Sequelize[_0x4542('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4542('0x3')],'allowNull':![],'defaultValue':_0x4542('0x4')},'appdata':{'type':Sequelize[_0x4542('0x5')]()},'description':{'type':Sequelize[_0x4542('0x3')]},'interval':{'type':Sequelize[_0x4542('0x3')],'defaultValue':_0x4542('0x6')}}; \ No newline at end of file +var _0x9077=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x9077,0x1cf));var _0x7907=function(_0x4bf9aa,_0xafa1ec){_0x4bf9aa=_0x4bf9aa-0x0;var _0x1db38a=_0x9077[_0x4bf9aa];return _0x1db38a;};'use strict';var Sequelize=require(_0x7907('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7907('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7907('0x2')],'allowNull':![],'defaultValue':_0x7907('0x3')},'appdata':{'type':Sequelize[_0x7907('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7907('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 51d56c2..b39c3fb 100644 --- a/server/api/openchannelApplication/openchannelApplication.controller.js +++ b/server/api/openchannelApplication/openchannelApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd54=['keys','length','includeAll','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','filter','where','merge','options','include','rows','catch','show'];(function(_0x4d2938,_0x332d65){var _0x5e7d9b=function(_0x135e24){while(--_0x135e24){_0x4d2938['push'](_0x4d2938['shift']());}};_0x5e7d9b(++_0x332d65);}(_0xbd54,0x1a5));var _0x4bd5=function(_0x1c4b46,_0x26ba44){_0x1c4b46=_0x1c4b46-0x0;var _0x32f50c=_0xbd54[_0x1c4b46];return _0x32f50c;};'use strict';var pdf=require(_0x4bd5('0x0'));var emlformat=require(_0x4bd5('0x1'));var rimraf=require(_0x4bd5('0x2'));var zipdir=require(_0x4bd5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4bd5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4bd5('0x5'));var path=require(_0x4bd5('0x6'));var sox=require(_0x4bd5('0x7'));var csv=require(_0x4bd5('0x8'));var ejs=require(_0x4bd5('0x9'));var fs=require('fs');var _=require(_0x4bd5('0xa'));var squel=require(_0x4bd5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4bd5('0x8'));var querystring=require(_0x4bd5('0xc'));var Papa=require(_0x4bd5('0xd'));var Redis=require('ioredis');var authService=require(_0x4bd5('0xe'));var qs=require(_0x4bd5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bd5('0x10'));var logger=require('../../config/logger')(_0x4bd5('0x11'));var utils=require(_0x4bd5('0x12'));var config=require(_0x4bd5('0x13'));var licenseUtil=require(_0x4bd5('0x14'));var db=require(_0x4bd5('0x15'))['db'];function respondWithStatusCode(_0x53e849,_0x1bd472){_0x1bd472=_0x1bd472||0xcc;return function(_0x4ec925){if(_0x4ec925){return _0x53e849[_0x4bd5('0x16')](_0x1bd472);}return _0x53e849[_0x4bd5('0x17')](_0x1bd472)[_0x4bd5('0x18')]();};}function respondWithResult(_0x923ca7,_0x28aa3f){_0x28aa3f=_0x28aa3f||0xc8;return function(_0x4666c1){if(_0x4666c1){return _0x923ca7[_0x4bd5('0x17')](_0x28aa3f)[_0x4bd5('0x19')](_0x4666c1);}};}function respondWithFilteredResult(_0x553589,_0x11c08c){return function(_0x112e68){if(_0x112e68){var _0x2a9a80=_0x112e68[_0x4bd5('0x1a')],_0x4d6b84=_0x11c08c[_0x4bd5('0x1b')],_0x3a48b1=_0x11c08c[_0x4bd5('0x1b')]+_0x11c08c['limit'],_0x1c91ea;if(_0x3a48b1>=_0x2a9a80){_0x3a48b1=_0x2a9a80;_0x1c91ea=0xc8;}else{_0x1c91ea=0xce;}_0x553589[_0x4bd5('0x17')](_0x1c91ea);return _0x553589[_0x4bd5('0x1c')](_0x4bd5('0x1d'),_0x4d6b84+'-'+_0x3a48b1+'/'+_0x2a9a80)[_0x4bd5('0x19')](_0x112e68);}return null;};}function patchUpdates(_0x2f8d4e){return function(_0xb8a370){try{jsonpatch[_0x4bd5('0x1e')](_0xb8a370,_0x2f8d4e,!![]);}catch(_0x486a3d){return BPromise['reject'](_0x486a3d);}return _0xb8a370[_0x4bd5('0x1f')]();};}function saveUpdates(_0x5917d5,_0x555282){return function(_0x56e9a5){if(_0x56e9a5){return _0x56e9a5[_0x4bd5('0x20')](_0x5917d5)[_0x4bd5('0x21')](function(_0x2bfc90){return _0x2bfc90;});}return null;};}function removeEntity(_0xe1f454,_0xce186c){return function(_0x3ec9e5){if(_0x3ec9e5){return _0x3ec9e5['destroy']()[_0x4bd5('0x21')](function(){_0xe1f454[_0x4bd5('0x17')](0xcc)[_0x4bd5('0x18')]();});}};}function handleEntityNotFound(_0x598e9f,_0x1efd89){return function(_0x118c20){if(!_0x118c20){_0x598e9f['sendStatus'](0x194);}return _0x118c20;};}function handleError(_0x51c88a,_0x391180){_0x391180=_0x391180||0x1f4;return function(_0x143af7){logger[_0x4bd5('0x22')](_0x143af7[_0x4bd5('0x23')]);if(_0x143af7[_0x4bd5('0x24')]){delete _0x143af7[_0x4bd5('0x24')];}_0x51c88a['status'](_0x391180)[_0x4bd5('0x25')](_0x143af7);};}exports[_0x4bd5('0x26')]=function(_0x534657,_0x52b49d){var _0xd35dcb={},_0x2e554b={},_0x45a54f={'count':0x0,'rows':[]};var _0x3c23b5=_[_0x4bd5('0x27')](db[_0x4bd5('0x28')][_0x4bd5('0x29')],function(_0x2ad588){return{'name':_0x2ad588['fieldName'],'type':_0x2ad588[_0x4bd5('0x2a')][_0x4bd5('0x2b')]};});_0x2e554b[_0x4bd5('0x2c')]=_[_0x4bd5('0x27')](_0x3c23b5,_0x4bd5('0x24'));_0x2e554b[_0x4bd5('0x2d')]=_['keys'](_0x534657[_0x4bd5('0x2d')]);_0x2e554b[_0x4bd5('0x2e')]=_[_0x4bd5('0x2f')](_0x2e554b[_0x4bd5('0x2c')],_0x2e554b['query']);_0xd35dcb['attributes']=_[_0x4bd5('0x2f')](_0x2e554b[_0x4bd5('0x2c')],qs[_0x4bd5('0x30')](_0x534657['query'][_0x4bd5('0x30')]));_0xd35dcb['attributes']=_0xd35dcb[_0x4bd5('0x31')]['length']?_0xd35dcb['attributes']:_0x2e554b[_0x4bd5('0x2c')];if(!_0x534657[_0x4bd5('0x2d')][_0x4bd5('0x32')](_0x4bd5('0x33'))){_0xd35dcb[_0x4bd5('0x34')]=qs['limit'](_0x534657[_0x4bd5('0x2d')][_0x4bd5('0x34')]);_0xd35dcb[_0x4bd5('0x1b')]=qs[_0x4bd5('0x1b')](_0x534657[_0x4bd5('0x2d')][_0x4bd5('0x1b')]);}_0xd35dcb['order']=qs[_0x4bd5('0x35')](_0x534657[_0x4bd5('0x2d')][_0x4bd5('0x35')]);_0xd35dcb['where']=qs[_0x4bd5('0x2e')](_['pick'](_0x534657['query'],_0x2e554b[_0x4bd5('0x2e')]),_0x3c23b5);if(_0x534657[_0x4bd5('0x2d')][_0x4bd5('0x36')]){_0xd35dcb[_0x4bd5('0x37')]=_[_0x4bd5('0x38')](_0xd35dcb['where'],{'$or':_['map'](_0x3c23b5,function(_0x36fc57){if(_0x36fc57[_0x4bd5('0x2a')]!=='VIRTUAL'){var _0x2718b5={};_0x2718b5[_0x36fc57['name']]={'$like':'%'+_0x534657[_0x4bd5('0x2d')][_0x4bd5('0x36')]+'%'};return _0x2718b5;}})});}_0xd35dcb=_[_0x4bd5('0x38')]({},_0xd35dcb,_0x534657[_0x4bd5('0x39')]);var _0x288cb3={'where':_0xd35dcb[_0x4bd5('0x37')]};return db[_0x4bd5('0x28')][_0x4bd5('0x1a')](_0x288cb3)[_0x4bd5('0x21')](function(_0x4b46cd){_0x45a54f[_0x4bd5('0x1a')]=_0x4b46cd;if(_0x534657[_0x4bd5('0x2d')]['includeAll']){_0xd35dcb[_0x4bd5('0x3a')]=[{'all':!![]}];}return db[_0x4bd5('0x28')]['findAll'](_0xd35dcb);})[_0x4bd5('0x21')](function(_0x5eb066){_0x45a54f[_0x4bd5('0x3b')]=_0x5eb066;return _0x45a54f;})[_0x4bd5('0x21')](respondWithFilteredResult(_0x52b49d,_0xd35dcb))[_0x4bd5('0x3c')](handleError(_0x52b49d,null));};exports[_0x4bd5('0x3d')]=function(_0x59faaf,_0x319a9c){var _0x454c64={'raw':!![],'where':{'id':_0x59faaf['params']['id']}},_0x324df7={};_0x324df7['model']=_['keys'](db['OpenchannelApplication'][_0x4bd5('0x29')]);_0x324df7[_0x4bd5('0x2d')]=_[_0x4bd5('0x3e')](_0x59faaf[_0x4bd5('0x2d')]);_0x324df7[_0x4bd5('0x2e')]=_[_0x4bd5('0x2f')](_0x324df7['model'],_0x324df7[_0x4bd5('0x2d')]);_0x454c64[_0x4bd5('0x31')]=_[_0x4bd5('0x2f')](_0x324df7['model'],qs['fields'](_0x59faaf[_0x4bd5('0x2d')][_0x4bd5('0x30')]));_0x454c64[_0x4bd5('0x31')]=_0x454c64['attributes'][_0x4bd5('0x3f')]?_0x454c64[_0x4bd5('0x31')]:_0x324df7[_0x4bd5('0x2c')];if(_0x59faaf[_0x4bd5('0x2d')][_0x4bd5('0x40')]){_0x454c64[_0x4bd5('0x3a')]=[{'all':!![]}];}_0x454c64=_['merge']({},_0x454c64,_0x59faaf[_0x4bd5('0x39')]);return db['OpenchannelApplication']['find'](_0x454c64)[_0x4bd5('0x21')](handleEntityNotFound(_0x319a9c,null))[_0x4bd5('0x21')](respondWithResult(_0x319a9c,null))[_0x4bd5('0x3c')](handleError(_0x319a9c,null));};exports[_0x4bd5('0x41')]=function(_0x135291,_0x49239a){return db[_0x4bd5('0x28')][_0x4bd5('0x41')](_0x135291[_0x4bd5('0x42')],{})[_0x4bd5('0x21')](respondWithResult(_0x49239a,0xc9))['catch'](handleError(_0x49239a,null));};exports[_0x4bd5('0x20')]=function(_0x17e63c,_0x54b5ee){if(_0x17e63c[_0x4bd5('0x42')]['id']){delete _0x17e63c[_0x4bd5('0x42')]['id'];}return db[_0x4bd5('0x28')][_0x4bd5('0x43')]({'where':{'id':_0x17e63c[_0x4bd5('0x44')]['id']}})[_0x4bd5('0x21')](handleEntityNotFound(_0x54b5ee,null))[_0x4bd5('0x21')](saveUpdates(_0x17e63c[_0x4bd5('0x42')],null))['then'](respondWithResult(_0x54b5ee,null))[_0x4bd5('0x3c')](handleError(_0x54b5ee,null));};exports['destroy']=function(_0x32b550,_0xf2d2f7){return db['OpenchannelApplication'][_0x4bd5('0x43')]({'where':{'id':_0x32b550['params']['id']}})['then'](handleEntityNotFound(_0xf2d2f7,null))[_0x4bd5('0x21')](removeEntity(_0xf2d2f7,null))[_0x4bd5('0x3c')](handleError(_0xf2d2f7,null));}; \ No newline at end of file +var _0xaaeb=['rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','offset','sort','where','merge','findAll','rows','catch','params','includeAll','include','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','OpenchannelApplication'];(function(_0x177fe0,_0x2036da){var _0x78f8fa=function(_0xd8658f){while(--_0xd8658f){_0x177fe0['push'](_0x177fe0['shift']());}};_0x78f8fa(++_0x2036da);}(_0xaaeb,0xa9));var _0xbaae=function(_0x4dedd3,_0x175841){_0x4dedd3=_0x4dedd3-0x0;var _0x48f768=_0xaaeb[_0x4dedd3];return _0x48f768;};'use strict';var pdf=require(_0xbaae('0x0'));var emlformat=require(_0xbaae('0x1'));var rimraf=require(_0xbaae('0x2'));var zipdir=require(_0xbaae('0x3'));var jsonpatch=require(_0xbaae('0x4'));var rp=require(_0xbaae('0x5'));var moment=require(_0xbaae('0x6'));var BPromise=require(_0xbaae('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbaae('0x8'));var csv=require(_0xbaae('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbaae('0xa'));var squel=require(_0xbaae('0xb'));var crypto=require('crypto');var jsforce=require(_0xbaae('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbaae('0x9'));var querystring=require(_0xbaae('0xd'));var Papa=require(_0xbaae('0xe'));var Redis=require(_0xbaae('0xf'));var authService=require(_0xbaae('0x10'));var qs=require(_0xbaae('0x11'));var as=require(_0xbaae('0x12'));var hardwareService=require(_0xbaae('0x13'));var logger=require(_0xbaae('0x14'))('api');var utils=require(_0xbaae('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbaae('0x16'));var db=require(_0xbaae('0x17'))['db'];function respondWithStatusCode(_0x30a7d8,_0x2f4cc2){_0x2f4cc2=_0x2f4cc2||0xcc;return function(_0x15a83b){if(_0x15a83b){return _0x30a7d8['sendStatus'](_0x2f4cc2);}return _0x30a7d8[_0xbaae('0x18')](_0x2f4cc2)[_0xbaae('0x19')]();};}function respondWithResult(_0x55260a,_0x45fbc2){_0x45fbc2=_0x45fbc2||0xc8;return function(_0x161f14){if(_0x161f14){return _0x55260a[_0xbaae('0x18')](_0x45fbc2)['json'](_0x161f14);}};}function respondWithFilteredResult(_0x1b17bf,_0xd1bbae){return function(_0x1c8261){if(_0x1c8261){var _0x1e7699=_0x1c8261[_0xbaae('0x1a')],_0x52e0b1=_0xd1bbae['offset'],_0x44d486=_0xd1bbae['offset']+_0xd1bbae[_0xbaae('0x1b')],_0x2ccb6e;if(_0x44d486>=_0x1e7699){_0x44d486=_0x1e7699;_0x2ccb6e=0xc8;}else{_0x2ccb6e=0xce;}_0x1b17bf[_0xbaae('0x18')](_0x2ccb6e);return _0x1b17bf[_0xbaae('0x1c')](_0xbaae('0x1d'),_0x52e0b1+'-'+_0x44d486+'/'+_0x1e7699)[_0xbaae('0x1e')](_0x1c8261);}return null;};}function patchUpdates(_0xfe7718){return function(_0x579623){try{jsonpatch[_0xbaae('0x1f')](_0x579623,_0xfe7718,!![]);}catch(_0x4511e6){return BPromise[_0xbaae('0x20')](_0x4511e6);}return _0x579623[_0xbaae('0x21')]();};}function saveUpdates(_0x4a3d42,_0x353110){return function(_0x5c72f3){if(_0x5c72f3){return _0x5c72f3[_0xbaae('0x22')](_0x4a3d42)[_0xbaae('0x23')](function(_0x5828f2){return _0x5828f2;});}return null;};}function removeEntity(_0x2b6c91,_0x27be60){return function(_0x233797){if(_0x233797){return _0x233797[_0xbaae('0x24')]()[_0xbaae('0x23')](function(){_0x2b6c91[_0xbaae('0x18')](0xcc)[_0xbaae('0x19')]();});}};}function handleEntityNotFound(_0x1be6d8,_0x4cea96){return function(_0x27dec1){if(!_0x27dec1){_0x1be6d8[_0xbaae('0x25')](0x194);}return _0x27dec1;};}function handleError(_0x1fd905,_0x48b8e5){_0x48b8e5=_0x48b8e5||0x1f4;return function(_0x522ad1){logger['error'](_0x522ad1[_0xbaae('0x26')]);if(_0x522ad1[_0xbaae('0x27')]){delete _0x522ad1['name'];}_0x1fd905['status'](_0x48b8e5)[_0xbaae('0x28')](_0x522ad1);};}exports[_0xbaae('0x29')]=function(_0xc6dc79,_0x565796){var _0x2341dc={},_0x7bb2e={},_0x39cab3={'count':0x0,'rows':[]};var _0x37b4f1=_[_0xbaae('0x2a')](db[_0xbaae('0x2b')][_0xbaae('0x2c')],function(_0x4f51bf){return{'name':_0x4f51bf[_0xbaae('0x2d')],'type':_0x4f51bf[_0xbaae('0x2e')][_0xbaae('0x2f')]};});_0x7bb2e['model']=_[_0xbaae('0x2a')](_0x37b4f1,'name');_0x7bb2e[_0xbaae('0x30')]=_[_0xbaae('0x31')](_0xc6dc79[_0xbaae('0x30')]);_0x7bb2e[_0xbaae('0x32')]=_[_0xbaae('0x33')](_0x7bb2e['model'],_0x7bb2e['query']);_0x2341dc[_0xbaae('0x34')]=_[_0xbaae('0x33')](_0x7bb2e[_0xbaae('0x35')],qs[_0xbaae('0x36')](_0xc6dc79['query'][_0xbaae('0x36')]));_0x2341dc[_0xbaae('0x34')]=_0x2341dc['attributes'][_0xbaae('0x37')]?_0x2341dc[_0xbaae('0x34')]:_0x7bb2e[_0xbaae('0x35')];if(!_0xc6dc79['query']['hasOwnProperty'](_0xbaae('0x38'))){_0x2341dc[_0xbaae('0x1b')]=qs[_0xbaae('0x1b')](_0xc6dc79[_0xbaae('0x30')][_0xbaae('0x1b')]);_0x2341dc[_0xbaae('0x39')]=qs[_0xbaae('0x39')](_0xc6dc79[_0xbaae('0x30')][_0xbaae('0x39')]);}_0x2341dc['order']=qs['sort'](_0xc6dc79[_0xbaae('0x30')][_0xbaae('0x3a')]);_0x2341dc[_0xbaae('0x3b')]=qs[_0xbaae('0x32')](_['pick'](_0xc6dc79[_0xbaae('0x30')],_0x7bb2e[_0xbaae('0x32')]),_0x37b4f1);if(_0xc6dc79[_0xbaae('0x30')]['filter']){_0x2341dc[_0xbaae('0x3b')]=_[_0xbaae('0x3c')](_0x2341dc[_0xbaae('0x3b')],{'$or':_['map'](_0x37b4f1,function(_0x477b8c){if(_0x477b8c[_0xbaae('0x2e')]!=='VIRTUAL'){var _0x2ddfbf={};_0x2ddfbf[_0x477b8c[_0xbaae('0x27')]]={'$like':'%'+_0xc6dc79[_0xbaae('0x30')]['filter']+'%'};return _0x2ddfbf;}})});}_0x2341dc=_['merge']({},_0x2341dc,_0xc6dc79['options']);var _0x54bdb1={'where':_0x2341dc[_0xbaae('0x3b')]};return db[_0xbaae('0x2b')]['count'](_0x54bdb1)[_0xbaae('0x23')](function(_0x1397c4){_0x39cab3[_0xbaae('0x1a')]=_0x1397c4;if(_0xc6dc79['query']['includeAll']){_0x2341dc['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xbaae('0x3d')](_0x2341dc);})[_0xbaae('0x23')](function(_0x191010){_0x39cab3[_0xbaae('0x3e')]=_0x191010;return _0x39cab3;})[_0xbaae('0x23')](respondWithFilteredResult(_0x565796,_0x2341dc))[_0xbaae('0x3f')](handleError(_0x565796,null));};exports['show']=function(_0x86c82b,_0x35992a){var _0x289264={'raw':!![],'where':{'id':_0x86c82b[_0xbaae('0x40')]['id']}},_0xb10619={};_0xb10619[_0xbaae('0x35')]=_[_0xbaae('0x31')](db[_0xbaae('0x2b')][_0xbaae('0x2c')]);_0xb10619[_0xbaae('0x30')]=_['keys'](_0x86c82b[_0xbaae('0x30')]);_0xb10619[_0xbaae('0x32')]=_[_0xbaae('0x33')](_0xb10619[_0xbaae('0x35')],_0xb10619['query']);_0x289264['attributes']=_[_0xbaae('0x33')](_0xb10619[_0xbaae('0x35')],qs[_0xbaae('0x36')](_0x86c82b[_0xbaae('0x30')][_0xbaae('0x36')]));_0x289264[_0xbaae('0x34')]=_0x289264[_0xbaae('0x34')][_0xbaae('0x37')]?_0x289264[_0xbaae('0x34')]:_0xb10619[_0xbaae('0x35')];if(_0x86c82b['query'][_0xbaae('0x41')]){_0x289264[_0xbaae('0x42')]=[{'all':!![]}];}_0x289264=_[_0xbaae('0x3c')]({},_0x289264,_0x86c82b[_0xbaae('0x43')]);return db[_0xbaae('0x2b')][_0xbaae('0x44')](_0x289264)[_0xbaae('0x23')](handleEntityNotFound(_0x35992a,null))[_0xbaae('0x23')](respondWithResult(_0x35992a,null))[_0xbaae('0x3f')](handleError(_0x35992a,null));};exports[_0xbaae('0x45')]=function(_0x240a2f,_0x59d545){return db['OpenchannelApplication'][_0xbaae('0x45')](_0x240a2f[_0xbaae('0x46')],{})[_0xbaae('0x23')](respondWithResult(_0x59d545,0xc9))['catch'](handleError(_0x59d545,null));};exports[_0xbaae('0x22')]=function(_0x59d1aa,_0x160369){if(_0x59d1aa[_0xbaae('0x46')]['id']){delete _0x59d1aa['body']['id'];}return db[_0xbaae('0x2b')][_0xbaae('0x44')]({'where':{'id':_0x59d1aa['params']['id']}})[_0xbaae('0x23')](handleEntityNotFound(_0x160369,null))[_0xbaae('0x23')](saveUpdates(_0x59d1aa[_0xbaae('0x46')],null))[_0xbaae('0x23')](respondWithResult(_0x160369,null))['catch'](handleError(_0x160369,null));};exports[_0xbaae('0x24')]=function(_0x52c63f,_0x12106e){return db['OpenchannelApplication']['find']({'where':{'id':_0x52c63f[_0xbaae('0x40')]['id']}})[_0xbaae('0x23')](handleEntityNotFound(_0x12106e,null))[_0xbaae('0x23')](removeEntity(_0x12106e,null))[_0xbaae('0x3f')](handleError(_0x12106e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9ef774a..ca1b625 100644 --- a/server/api/openchannelApplication/openchannelApplication.model.js +++ b/server/api/openchannelApplication/openchannelApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7717=['exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x390702,_0xee1f5c){var _0x9f6727=function(_0x200f77){while(--_0x200f77){_0x390702['push'](_0x390702['shift']());}};_0x9f6727(++_0xee1f5c);}(_0x7717,0x154));var _0x7771=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7717[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7771('0x0'));var util=require('util');var logger=require(_0x7771('0x1'))(_0x7771('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7771('0x3'));var fs=require('fs');var path=require(_0x7771('0x4'));var rimraf=require(_0x7771('0x5'));var config=require(_0x7771('0x6'));var attributes=require(_0x7771('0x7'));module[_0x7771('0x8')]=function(_0xd3c194,_0x24540c){return _0xd3c194[_0x7771('0x9')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7771('0xa'),'collate':_0x7771('0xb')});}; \ No newline at end of file +var _0x1e3d=['exports','openchannel_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x89628a,_0x4db523){var _0x40f563=function(_0xfcdb3f){while(--_0xfcdb3f){_0x89628a['push'](_0x89628a['shift']());}};_0x40f563(++_0x4db523);}(_0x1e3d,0x120));var _0xd1e3=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x1e3d[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xd1e3('0x0'));var util=require(_0xd1e3('0x1'));var logger=require(_0xd1e3('0x2'))(_0xd1e3('0x3'));var moment=require(_0xd1e3('0x4'));var BPromise=require(_0xd1e3('0x5'));var rp=require(_0xd1e3('0x6'));var fs=require('fs');var path=require(_0xd1e3('0x7'));var rimraf=require('rimraf');var config=require(_0xd1e3('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0xd1e3('0x9')]=function(_0x594766,_0x3a9a4e){return _0x594766['define']('OpenchannelApplication',attributes,{'tableName':_0xd1e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 4ff468f..fe90b10 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4759ef,_0x1e04e6){var _0x5d8399=function(_0x5722d0){while(--_0x5722d0){_0x4759ef['push'](_0x4759ef['shift']());}};_0x5d8399(++_0x1e04e6);}(_0xb10b,0x12a));var _0xbb10=function(_0xe9ce81,_0x4d48bb){_0xe9ce81=_0xe9ce81-0x0;var _0x27c089=_0xb10b[_0xe9ce81];return _0x27c089;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x21f659,_0x229f6e){var _0x310e2b=function(_0x41ebc5){while(--_0x41ebc5){_0x21f659['push'](_0x21f659['shift']());}};_0x310e2b(++_0x229f6e);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a5f1d,_0x3359d8){_0x5a5f1d=_0x5a5f1d-0x0;var _0x597cf4=_0xb10b[_0x5a5f1d];return _0x597cf4;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 60b12d2..15abc54 100644 --- a/server/api/openchannelInteraction/index.js +++ b/server/api/openchannelInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7064=['/:id/tags','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy'];(function(_0xab6786,_0x21ee5e){var _0x2d0418=function(_0x39fff0){while(--_0x39fff0){_0xab6786['push'](_0xab6786['shift']());}};_0x2d0418(++_0x21ee5e);}(_0x7064,0x1a5));var _0x4706=function(_0x2443c2,_0x327fd1){_0x2443c2=_0x2443c2-0x0;var _0x3317be=_0x7064[_0x2443c2];return _0x3317be;};'use strict';var multer=require(_0x4706('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4706('0x1'));var express=require('express');var router=express[_0x4706('0x2')]();var auth=require(_0x4706('0x3'));var interaction=require(_0x4706('0x4'));var config=require(_0x4706('0x5'));var controller=require(_0x4706('0x6'));router[_0x4706('0x7')]('/',auth['isAuthenticated'](),controller[_0x4706('0x8')]);router[_0x4706('0x7')](_0x4706('0x9'),auth['isAuthenticated'](),controller[_0x4706('0xa')]);router[_0x4706('0x7')](_0x4706('0xb'),auth[_0x4706('0xc')](),controller[_0x4706('0xd')]);router[_0x4706('0x7')](_0x4706('0xe'),auth[_0x4706('0xc')](),controller[_0x4706('0xf')]);router[_0x4706('0x7')](_0x4706('0x10'),auth[_0x4706('0xc')](),controller[_0x4706('0x11')]);router[_0x4706('0x12')]('/',auth[_0x4706('0xc')](),controller['create']);router[_0x4706('0x12')](_0x4706('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0x4706('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x4706('0x13')](_0x4706('0x14'),_0x4706('0x15')),controller[_0x4706('0x16')]);router['put'](_0x4706('0xb'),auth[_0x4706('0xc')](),interaction[_0x4706('0x13')]('openchannel',_0x4706('0x17')),controller['update']);router[_0x4706('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0x4706('0x13')]('openchannel',_0x4706('0x19')),controller[_0x4706('0x1a')]);router['delete'](_0x4706('0x1b'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x6a5b=['/:id/download','post','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages'];(function(_0x2411b0,_0x10949b){var _0x1980c4=function(_0x59026d){while(--_0x59026d){_0x2411b0['push'](_0x2411b0['shift']());}};_0x1980c4(++_0x10949b);}(_0x6a5b,0xc8));var _0xb6a5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6a5b[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xb6a5('0x0'));var path=require(_0xb6a5('0x1'));var timeout=require(_0xb6a5('0x2'));var express=require(_0xb6a5('0x3'));var router=express[_0xb6a5('0x4')]();var auth=require(_0xb6a5('0x5'));var interaction=require(_0xb6a5('0x6'));var config=require(_0xb6a5('0x7'));var controller=require(_0xb6a5('0x8'));router[_0xb6a5('0x9')]('/',auth[_0xb6a5('0xa')](),controller[_0xb6a5('0xb')]);router['get']('/describe',auth[_0xb6a5('0xa')](),controller[_0xb6a5('0xc')]);router[_0xb6a5('0x9')](_0xb6a5('0xd'),auth['isAuthenticated'](),controller[_0xb6a5('0xe')]);router[_0xb6a5('0x9')]('/:id/messages',auth[_0xb6a5('0xa')](),controller[_0xb6a5('0xf')]);router[_0xb6a5('0x9')](_0xb6a5('0x10'),auth[_0xb6a5('0xa')](),controller['download']);router[_0xb6a5('0x11')]('/',auth[_0xb6a5('0xa')](),controller['create']);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xb6a5('0x11')]('/:id/tags',auth[_0xb6a5('0xa')](),interaction['tracked'](_0xb6a5('0x12'),_0xb6a5('0x13')),controller[_0xb6a5('0x14')]);router[_0xb6a5('0x15')]('/:id',auth[_0xb6a5('0xa')](),interaction[_0xb6a5('0x16')](_0xb6a5('0x12'),_0xb6a5('0x17')),controller[_0xb6a5('0x18')]);router[_0xb6a5('0x19')](_0xb6a5('0xd'),auth[_0xb6a5('0xa')](),interaction[_0xb6a5('0x16')](_0xb6a5('0x12'),'openchannelinteraction:destroy'),controller[_0xb6a5('0x1a')]);router['delete']('/:id/tags',auth[_0xb6a5('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 7b1eb49..d1f5ad5 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.attributes.js +++ b/server/api/openchannelInteraction/openchannelInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20a3=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x3d75bf,_0x4fab4a){var _0x75fcf7=function(_0x5e4613){while(--_0x5e4613){_0x3d75bf['push'](_0x3d75bf['shift']());}};_0x75fcf7(++_0x4fab4a);}(_0x20a3,0x15b));var _0x320a=function(_0x24a3b2,_0x30b370){_0x24a3b2=_0x24a3b2-0x0;var _0x1ecf2e=_0x20a3[_0x24a3b2];return _0x1ecf2e;};'use strict';var Sequelize=require(_0x320a('0x0'));module['exports']={'closed':{'type':Sequelize[_0x320a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x320a('0x2')]},'disposition':{'type':Sequelize[_0x320a('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x320a('0x2')]},'threadId':{'type':Sequelize[_0x320a('0x3')]},'externalUrl':{'type':Sequelize[_0x320a('0x3')]},'lastMsgAt':{'type':Sequelize[_0x320a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x320a('0x4')]('in',_0x320a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8f83=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x5fe69a,_0x5484f5){var _0x3f1aee=function(_0x54387f){while(--_0x54387f){_0x5fe69a['push'](_0x5fe69a['shift']());}};_0x3f1aee(++_0x5484f5);}(_0x8f83,0x6d));var _0x38f8=function(_0x4f5bd4,_0xbde35b){_0x4f5bd4=_0x4f5bd4-0x0;var _0x464848=_0x8f83[_0x4f5bd4];return _0x464848;};'use strict';var Sequelize=require(_0x38f8('0x0'));module[_0x38f8('0x1')]={'closed':{'type':Sequelize[_0x38f8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x38f8('0x3')]},'disposition':{'type':Sequelize[_0x38f8('0x4')]},'secondDisposition':{'type':Sequelize[_0x38f8('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x38f8('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x38f8('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x38f8('0x5')]('in',_0x38f8('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x38f8('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a3173eb..95196ee 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.controller.js +++ b/server/api/openchannelInteraction/openchannelInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0829=['start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','concat','createdAt','parse','$gte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','params','OpenchannelInteraction','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','tmp','attachments','transcript-%d-%s.zip','fullname','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Account','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','out','renderFile','server','views','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','map','Tags','TagIds','forEach','push','catch','index','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x0829,0x17f));var _0x9082=function(_0x62c36f,_0x4bb414){_0x62c36f=_0x62c36f-0x0;var _0x449d96=_0x0829[_0x62c36f];return _0x449d96;};'use strict';var pdf=require(_0x9082('0x0'));var emlformat=require(_0x9082('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9082('0x2'));var jsonpatch=require(_0x9082('0x3'));var rp=require(_0x9082('0x4'));var moment=require(_0x9082('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9082('0x6'));var util=require(_0x9082('0x7'));var path=require(_0x9082('0x8'));var sox=require('sox');var csv=require(_0x9082('0x9'));var ejs=require(_0x9082('0xa'));var fs=require('fs');var _=require(_0x9082('0xb'));var squel=require(_0x9082('0xc'));var crypto=require(_0x9082('0xd'));var jsforce=require(_0x9082('0xe'));var deskjs=require(_0x9082('0xf'));var toCsv=require(_0x9082('0x9'));var querystring=require(_0x9082('0x10'));var Papa=require(_0x9082('0x11'));var Redis=require(_0x9082('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9082('0x13'));var as=require(_0x9082('0x14'));var hardwareService=require(_0x9082('0x15'));var logger=require(_0x9082('0x16'))(_0x9082('0x17'));var utils=require(_0x9082('0x18'));var config=require(_0x9082('0x19'));var licenseUtil=require(_0x9082('0x1a'));var db=require(_0x9082('0x1b'))['db'];config[_0x9082('0x1c')]=_[_0x9082('0x1d')](config['redis'],{'host':_0x9082('0x1e'),'port':0x18eb});var socket=require(_0x9082('0x1f'))(new Redis(config['redis']));require(_0x9082('0x20'))['register'](socket);function respondWithStatusCode(_0x2905f7,_0x1ec17c){_0x1ec17c=_0x1ec17c||0xcc;return function(_0x558f7b){if(_0x558f7b){return _0x2905f7['sendStatus'](_0x1ec17c);}return _0x2905f7[_0x9082('0x21')](_0x1ec17c)[_0x9082('0x22')]();};}function respondWithResult(_0x73fd81,_0x3b8ff8){_0x3b8ff8=_0x3b8ff8||0xc8;return function(_0x1ec20b){if(_0x1ec20b){return _0x73fd81[_0x9082('0x21')](_0x3b8ff8)[_0x9082('0x23')](_0x1ec20b);}};}function respondWithFilteredResult(_0x3657d1,_0x22c474){return function(_0x39d60d){if(_0x39d60d){var _0x455660=_0x39d60d[_0x9082('0x24')],_0xb37b1b=_0x22c474['offset'],_0x2c09b7=_0x22c474[_0x9082('0x25')]+_0x22c474[_0x9082('0x26')],_0x533847;if(_0x2c09b7>=_0x455660){_0x2c09b7=_0x455660;_0x533847=0xc8;}else{_0x533847=0xce;}_0x3657d1[_0x9082('0x21')](_0x533847);return _0x3657d1[_0x9082('0x27')](_0x9082('0x28'),_0xb37b1b+'-'+_0x2c09b7+'/'+_0x455660)['json'](_0x39d60d);}return null;};}function patchUpdates(_0xff0934){return function(_0x5c78be){try{jsonpatch[_0x9082('0x29')](_0x5c78be,_0xff0934,!![]);}catch(_0xa7c8c7){return BPromise['reject'](_0xa7c8c7);}return _0x5c78be[_0x9082('0x2a')]();};}function saveUpdates(_0x5922f6,_0x18d0bb){return function(_0x56f07a){if(_0x56f07a){return _0x56f07a[_0x9082('0x2b')](_0x5922f6)[_0x9082('0x2c')](function(_0x5eb35f){return _0x5eb35f;});}return null;};}function removeEntity(_0x5f526a,_0x504a6d){return function(_0x285e34){if(_0x285e34){return _0x285e34[_0x9082('0x2d')]()[_0x9082('0x2c')](function(){_0x5f526a[_0x9082('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a32d8,_0x56c28b){return function(_0x22d375){if(!_0x22d375){_0x5a32d8[_0x9082('0x2e')](0x194);}return _0x22d375;};}function handleError(_0x4cd3de,_0x1c5878){_0x1c5878=_0x1c5878||0x1f4;return function(_0x263911){logger['error'](_0x263911['stack']);if(_0x263911[_0x9082('0x2f')]){delete _0x263911[_0x9082('0x2f')];}_0x4cd3de[_0x9082('0x21')](_0x1c5878)[_0x9082('0x30')](_0x263911);};}function getInteractionUsers(_0x2541f2,_0x54b3dc){return new BPromise(function(_0x1fed8b,_0x52c5f4){try{if(_0x54b3dc[_0x2541f2['id']]){_0x2541f2['Users']=_[_0x9082('0x31')](_0x54b3dc[_0x2541f2['id']],function(_0x483e90){return{'id':_0x483e90['id'],'fullname':_0x483e90['fullname']};});}}catch(_0x5c51d3){_0x52c5f4(_0x5c51d3);}_0x1fed8b(_0x2541f2);});}function getInteractionTags(_0x40c41e,_0x38dc8d){return new BPromise(function(_0x5a62b4,_0x293277){try{if(_0x40c41e['TagIds']){_0x40c41e[_0x9082('0x32')]=[];_0x40c41e[_0x9082('0x33')]['split'](',')[_0x9082('0x34')](function(_0x566bdb){_0x40c41e[_0x9082('0x32')][_0x9082('0x35')](_0x38dc8d[_0x566bdb]);});}delete _0x40c41e['TagIds'];}catch(_0x35e83c){_0x293277(_0x35e83c);}_0x5a62b4(_0x40c41e);});}function updateOpenchannelInteraction(_0xcfbb40,_0x5d4e2d,_0x1195d6){return new BPromise(function(_0x1894a8,_0x501ad8){return getInteractionUsers(_0xcfbb40,_0x1195d6)[_0x9082('0x2c')](function(_0x29cfd8){return getInteractionTags(_0x29cfd8,_0x5d4e2d);})['then'](function(_0x59126a){_0x1894a8(_0x59126a);})[_0x9082('0x36')](function(_0x5986a1){_0x501ad8(_0x5986a1);});});}exports[_0x9082('0x37')]=function(_0x49d938,_0x3909b8){var _0x17ca66={},_0x22e823={},_0xca08b={'count':0x0,'rows':[]};var _0x3c6a5e=_[_0x9082('0x31')](db['OpenchannelInteraction'][_0x9082('0x38')],function(_0xbd0d97){return{'name':_0xbd0d97[_0x9082('0x39')],'type':_0xbd0d97[_0x9082('0x3a')][_0x9082('0x3b')]};});_0x22e823[_0x9082('0x3c')]=_[_0x9082('0x31')](_0x3c6a5e,'name');_0x22e823['query']=_[_0x9082('0x3d')](_0x49d938['query']);_0x22e823[_0x9082('0x3e')]=_[_0x9082('0x3f')](_0x22e823[_0x9082('0x3c')],_0x22e823[_0x9082('0x40')]);_0x17ca66[_0x9082('0x41')]=_[_0x9082('0x3f')](_0x22e823[_0x9082('0x3c')],qs[_0x9082('0x42')](_0x49d938[_0x9082('0x40')][_0x9082('0x42')]));_0x17ca66[_0x9082('0x41')]=_0x17ca66[_0x9082('0x41')]['length']?_0x17ca66[_0x9082('0x41')]:_0x22e823['model'];if(!_0x49d938[_0x9082('0x40')][_0x9082('0x43')](_0x9082('0x44'))){_0x17ca66[_0x9082('0x26')]=qs['limit'](_0x49d938[_0x9082('0x40')][_0x9082('0x26')]);_0x17ca66[_0x9082('0x25')]=qs[_0x9082('0x25')](_0x49d938[_0x9082('0x40')][_0x9082('0x25')]);}_0x17ca66[_0x9082('0x45')]=qs[_0x9082('0x46')](_0x49d938[_0x9082('0x40')][_0x9082('0x46')]);_0x17ca66[_0x9082('0x47')]=qs[_0x9082('0x3e')](_[_0x9082('0x48')](_0x49d938[_0x9082('0x40')],_0x22e823['filters']),_0x3c6a5e);var _0x30f64e=[];var _0xb637eb=squel[_0x9082('0x49')]()[_0x9082('0x4a')]('id')[_0x9082('0x4a')](_0x9082('0x2f'))[_0x9082('0x4a')](_0x9082('0x4b'))['from'](_0x9082('0x4c'));var _0xd8bcf4=squel[_0x9082('0x49')]()['field']('u.id')[_0x9082('0x4a')](_0x9082('0x4d'))[_0x9082('0x4a')]('ui.OpenchannelInteractionId')[_0x9082('0x4e')]('user_has_openchannel_interactions','ui')[_0x9082('0x4f')](_0x9082('0x50'),'u',_0x9082('0x51'));var _0x2aeeff=squel[_0x9082('0x49')]()[_0x9082('0x4e')](_0x9082('0x52'),'i')[_0x9082('0x4f')](_0x9082('0x53'),'c',_0x9082('0x54'))[_0x9082('0x4f')](_0x9082('0x50'),'o',_0x9082('0x55'))[_0x9082('0x4f')](_0x9082('0x56'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x9082('0x4f')]('openchannel_messages','me',_0x9082('0x57'))[_0x9082('0x4f')](_0x9082('0x58'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x9082('0x4f')](_0x9082('0x4c'),'t',_0x9082('0x59'));var _0x112f68=squel[_0x9082('0x5a')]();var _0x32f209=[];var _0x1abc80=squel[_0x9082('0x5a')]();var _0x5966a2;if(_0x49d938[_0x9082('0x40')][_0x9082('0x5b')]){_0x5966a2=as[_0x9082('0x5c')](_0x49d938[_0x9082('0x40')][_0x9082('0x5b')]);var _0x2540b5=_0x5966a2['sqlOperator'];for(var _0x3b9646=0x0;_0x3b9646<_0x5966a2[_0x9082('0x5d')][_0x9082('0x5e')];_0x3b9646++){var _0x1f60ad=_0x5966a2[_0x9082('0x5d')][_0x3b9646];var _0x39756e='i';var _0x598fe0=_['find'](_0x3c6a5e,[_0x9082('0x2f'),_0x1f60ad['field']]);if(!_0x598fe0){switch(_0x1f60ad[_0x9082('0x4a')]){case _0x9082('0x5f'):if(_0x1f60ad['value']==0x1){_0x2aeeff[_0x9082('0x60')]('`'+_0x1f60ad[_0x9082('0x4a')]+_0x9082('0x61'));}else{_0x2aeeff[_0x9082('0x60')]('`'+_0x1f60ad['field']+_0x9082('0x62'));}break;case _0x9082('0x63'):if(_0x1f60ad[_0x9082('0x64')]===_0x9082('0x65')){if(_0x1f60ad[_0x9082('0x66')][_0x9082('0x67')]('\x20')[_0x9082('0x5e')]>0x1){_0x112f68[_0x2540b5](_0x9082('0x68'),qs[_0x9082('0x69')](_0x1f60ad['value']),null);}else{var _0x7d1cc0='%'+_0x1f60ad[_0x9082('0x66')]+'%';_0x112f68[_0x2540b5](_0x9082('0x6a'),_0x7d1cc0,_0x7d1cc0,_0x7d1cc0);}}else{_0x598fe0=_[_0x9082('0x6b')](_0x3c6a5e,[_0x9082('0x2f'),_0x9082('0x6c')]);_0x1f60ad['field']=_0x9082('0x6c');_0x596ac0=as[_0x9082('0x6d')](_0x39756e,_0x598fe0[_0x9082('0x3a')],_0x1f60ad);_0x112f68[_0x2540b5](_0x596ac0[_0x9082('0x6e')],_0x596ac0[_0x9082('0x66')][_0x9082('0x6f')],_0x596ac0['value']['end']);}break;case _0x9082('0x70'):var _0x343e3b=_0x1f60ad[_0x9082('0x66')]['split'](',')['map'](function(_0x571eb5){return Number(_0x571eb5);});_0x343e3b[_0x9082('0x34')](function(_0x423e15){_0x1abc80['or'](_0x9082('0x71'),'%,'+_0x423e15+',%');});_0x32f209=_[_0x9082('0x72')](_0x32f209,_0x343e3b);break;case _0x9082('0x73'):if(_0x1f60ad[_0x9082('0x64')]==='$substring'){_0x112f68[_0x2540b5](_0x9082('0x74'),'%'+_0x1f60ad[_0x9082('0x66')]+'%',null);}else{_0x598fe0=_[_0x9082('0x6b')](_0x3c6a5e,[_0x9082('0x2f'),_0x9082('0x75')]);_0x1f60ad[_0x9082('0x4a')]=_0x9082('0x75');_0x596ac0=as['buildExpression'](_0x39756e,_0x598fe0['type'],_0x1f60ad);_0x112f68[_0x2540b5](_0x596ac0[_0x9082('0x6e')],_0x596ac0[_0x9082('0x66')]['start'],_0x596ac0[_0x9082('0x66')]['end']);}break;case _0x9082('0x76'):_0x596ac0=as[_0x9082('0x6d')]('me',null,_0x1f60ad);_0x112f68[_0x2540b5](_0x596ac0['text'],_0x596ac0['value'][_0x9082('0x6f')],_0x596ac0['value'][_0x9082('0x22')]);break;}}else{var _0x596ac0=as[_0x9082('0x6d')](_0x39756e,_0x598fe0[_0x9082('0x3a')],_0x1f60ad);_0x112f68[_0x2540b5](_0x596ac0[_0x9082('0x6e')],_0x596ac0['value'][_0x9082('0x6f')],_0x596ac0['value'][_0x9082('0x22')]);}}}else{var _0x25367d=_(_0x49d938['query'])[_0x9082('0x3d')]()['map'](function(_0x55cad3){return _[_0x9082('0x77')](_0x3c6a5e,[_0x9082('0x2f'),_0x55cad3])?_0x55cad3:undefined;})[_0x9082('0x78')]()[_0x9082('0x66')]();if(!_[_0x9082('0x79')](_0x25367d)){_0x25367d[_0x9082('0x34')](function(_0x4c2ec7){if(_0x4c2ec7==='OpenchannelAccountId'){_0x2aeeff[_0x9082('0x47')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x9082('0x7a')](_0x49d938[_0x9082('0x40')][_0x4c2ec7]));}else if(_0x4c2ec7===_0x9082('0x7b')){var _0xda46f1=JSON[_0x9082('0x7c')](_0x49d938[_0x9082('0x40')][_0x4c2ec7])[_0x9082('0x7d')];var _0x115406=JSON['parse'](_0x49d938[_0x9082('0x40')][_0x4c2ec7])['$lte'];_0x2aeeff['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xda46f1,_0x115406);}else{if(_0x49d938[_0x9082('0x40')][_0x4c2ec7]==='null'){_0x2aeeff[_0x9082('0x47')]('i.'+_0x4c2ec7+_0x9082('0x7e'));}else{_0x2aeeff[_0x9082('0x47')]('i.'+_0x4c2ec7+'\x20=\x20?',_0x49d938[_0x9082('0x40')][_0x4c2ec7]);}}});}if(_0x49d938[_0x9082('0x40')][_0x9082('0x7f')]){if(_0x49d938[_0x9082('0x40')][_0x9082('0x7f')]==0x1){_0x2aeeff[_0x9082('0x60')](_0x9082('0x80'));}else{_0x2aeeff[_0x9082('0x60')](_0x9082('0x81'));}}if(_0x49d938[_0x9082('0x40')]['tag']){_0x32f209=_[_0x9082('0x82')](_0x49d938[_0x9082('0x40')]['tag'])?_0x49d938[_0x9082('0x40')][_0x9082('0x83')]:new Array(_0x49d938['query'][_0x9082('0x83')]);_0x32f209[_0x9082('0x34')](function(_0x12d56){_0x1abc80['or'](_0x9082('0x71'),'%,'+_0x12d56+',%');});}if(_0x49d938[_0x9082('0x40')][_0x9082('0x84')]){var _0x4c8ff3=_0x49d938[_0x9082('0x40')][_0x9082('0x84')][_0x9082('0x85')]('\x5c','\x5c\x5c')[_0x9082('0x85')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4c8ff3)){_0x112f68['or'](_0x9082('0x86'),_0x4c8ff3+'%');}else{_0x112f68['or'](_0x9082('0x87'),qs[_0x9082('0x69')](_0x4c8ff3))['or'](_0x9082('0x88'),_0x4c8ff3+'%')['or'](_0x9082('0x89'),_0x4c8ff3+'%');}}}_0x2aeeff[_0x9082('0x47')](_0x112f68);_0x2aeeff['group'](_0x9082('0x8a'));var _0x2fac6e={'type':db['Sequelize'][_0x9082('0x8b')][_0x9082('0x8c')],'raw':!![]};var _0x1a1f7c=_0x2aeeff['clone']();_0x1a1f7c['field']('i.id');_0x1a1f7c[_0x9082('0x4a')](_0x9082('0x8d'),_0x9082('0x5f'));if(_0x17ca66['order']){_0x17ca66['order']['forEach'](function(_0x3ae368){var _0xc2592e=_0x3ae368[0x0]===_0x9082('0x8e')?_0x3ae368[0x0]:'i.'+_0x3ae368[0x0];_0x2aeeff[_0x9082('0x45')](_0xc2592e,_0x3ae368[0x1]===_0x9082('0x8f')?![]:!![]);});}if(!_[_0x9082('0x79')](_0x32f209)){_0x2aeeff[_0x9082('0x60')](_0x1abc80);_0x1a1f7c[_0x9082('0x47')](_0x9082('0x90'),_0x32f209);}BPromise[_0x9082('0x91')]()[_0x9082('0x2c')](function(){if(!_0x5966a2){if(_0x49d938[_0x9082('0x40')][_0x9082('0x92')]||_0x49d938[_0x9082('0x40')][_0x9082('0x93')])return;_0x1a1f7c[_0x9082('0x47')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2aeeff[_0x9082('0x47')](_0x9082('0x94'));return;}if(_0x49d938[_0x9082('0x95')][_0x9082('0x96')]!==_0x9082('0x97'))return;return _0x49d938[_0x9082('0x95')][_0x9082('0x98')]({'attributes':['id'],'raw':!![]})[_0x9082('0x2c')](function(_0x3e2af9){if(_[_0x9082('0x79')](_0x3e2af9)){_0x1a1f7c['where'](_0x9082('0x99'));_0x2aeeff[_0x9082('0x47')](_0x9082('0x99'));}else{_0x1a1f7c[_0x9082('0x47')](_0x9082('0x9a'),_[_0x9082('0x31')](_0x3e2af9,'id'));_0x2aeeff[_0x9082('0x47')](_0x9082('0x9a'),_[_0x9082('0x31')](_0x3e2af9,'id'));}});})['then'](function(){if(_0x49d938['user']['role']===_0x9082('0x97')&&!_0x5966a2&&!_0x49d938[_0x9082('0x40')][_0x9082('0x92')])return[];return db[_0x9082('0x9b')][_0x9082('0x40')](_0x1a1f7c['toString'](),_0x2fac6e);})['then'](function(_0xa1248b){_0xca08b['count']=_0xa1248b['length'];if(_0xca08b[_0x9082('0x24')]===0x0)return[];return db[_0x9082('0x9b')]['query'](_0xb637eb['toString'](),_0x2fac6e)[_0x9082('0x2c')](function(_0x2f466c){_0x30f64e=_[_0x9082('0x9c')](_0x2f466c,'id');_0x2fac6e=_[_0x9082('0x9d')](_0x2fac6e,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49d938[_0x9082('0x40')][_0x9082('0x42')]){_0x17ca66[_0x9082('0x41')][_0x9082('0x34')](function(_0x3a4d7f){_0x2aeeff[_0x9082('0x4a')]('i.'+_0x3a4d7f);});}else{_0x2aeeff[_0x9082('0x4a')](_0x9082('0x8d'),_0x9082('0x5f'));_0x2aeeff[_0x9082('0x4a')](_0x9082('0x9e'),_0x9082('0x9f'));_0x2aeeff[_0x9082('0x4a')](_0x9082('0xa0'),_0x9082('0xa1'));_0x2aeeff[_0x9082('0x4a')](_0x9082('0xa2'),'contactName');_0x2aeeff[_0x9082('0x4a')](_0x9082('0xa3'));_0x2aeeff[_0x9082('0x4a')](_0x9082('0xa4'),_0x9082('0xa5'));_0x2aeeff['field'](_0x9082('0xa6'),'Contact.lastName');_0x2aeeff[_0x9082('0x4a')]('c.email',_0x9082('0xa7'));_0x2aeeff[_0x9082('0x4a')](_0x9082('0xa8'),_0x9082('0xa9'));_0x2aeeff[_0x9082('0x4a')](_0x9082('0xaa'),_0x9082('0xab'));_0x2aeeff[_0x9082('0x4a')]('c.fax','Contact.fax');_0x2aeeff[_0x9082('0x4a')](_0x9082('0xac'),_0x9082('0xad'));_0x2aeeff['field'](_0x9082('0xae'),'Owner.internal');_0x2aeeff['field'](_0x9082('0xaf'),_0x9082('0x33'));}if(_0x17ca66[_0x9082('0x26')])_0x2aeeff['limit'](_0x17ca66['limit']);if(_0x17ca66[_0x9082('0x25')])_0x2aeeff[_0x9082('0x25')](_0x17ca66['offset']);return db['sequelize'][_0x9082('0x40')](_0x2aeeff['toString'](),_0x2fac6e);})[_0x9082('0x2c')](function(_0x120bde){_0xd8bcf4[_0x9082('0x47')](_0x9082('0xb0'),_[_0x9082('0x31')](_0x120bde,'id'));return db[_0x9082('0x9b')]['query'](_0xd8bcf4['toString'](),_0x2fac6e)[_0x9082('0x2c')](function(_0x940f21){var _0x300c12=_[_0x9082('0xb1')](_0x940f21,_0x9082('0xb2'));var _0x47230d=[];_0x120bde[_0x9082('0x34')](function(_0x1cf66a){_0x47230d[_0x9082('0x35')](updateOpenchannelInteraction(_0x1cf66a,_0x30f64e,_0x300c12));});return BPromise[_0x9082('0xb3')](_0x47230d);});});})['then'](function(_0x198a17){_0xca08b[_0x9082('0xb4')]=_0x198a17;return _0xca08b;})[_0x9082('0x2c')](respondWithFilteredResult(_0x3909b8,_0x17ca66))[_0x9082('0x36')](handleError(_0x3909b8,null));};exports['show']=function(_0x2d4e52,_0x3676dd){var _0x5439d2={};if(_0x2d4e52['query'][_0x9082('0x3a')]&&_0x2d4e52['query'][_0x9082('0x3a')]==='from'){_0x5439d2[_0x9082('0x4e')]=_0x2d4e52[_0x9082('0xb5')]['id'];}else{_0x5439d2['id']=_0x2d4e52[_0x9082('0xb5')]['id'];}var _0xb71821={'raw':![],'where':_0x5439d2},_0x4fe998={};_0x4fe998[_0x9082('0x3c')]=_['keys'](db[_0x9082('0xb6')][_0x9082('0x38')]);_0x4fe998[_0x9082('0x40')]=_[_0x9082('0x3d')](_0x2d4e52[_0x9082('0x40')]);_0x4fe998['filters']=_[_0x9082('0x3f')](_0x4fe998['model'],_0x4fe998[_0x9082('0x40')]);_0xb71821[_0x9082('0x41')]=_[_0x9082('0x3f')](_0x4fe998[_0x9082('0x3c')],qs['fields'](_0x2d4e52['query'][_0x9082('0x42')]));_0xb71821['attributes']=_0xb71821['attributes']['length']?_0xb71821[_0x9082('0x41')]:_0x4fe998[_0x9082('0x3c')];if(_0x2d4e52[_0x9082('0x40')][_0x9082('0xb7')]){_0xb71821[_0x9082('0xb8')]=[{'all':!![]}];}_0xb71821=_[_0x9082('0x9d')]({},_0xb71821,_0x2d4e52[_0x9082('0xb9')]);return db[_0x9082('0xb6')][_0x9082('0x6b')](_0xb71821)[_0x9082('0x2c')](handleEntityNotFound(_0x3676dd,null))[_0x9082('0x2c')](respondWithResult(_0x3676dd,null))[_0x9082('0x36')](handleError(_0x3676dd,null));};exports[_0x9082('0xba')]=function(_0x44daff,_0x12b9c8){return db[_0x9082('0xb6')]['create'](_0x44daff[_0x9082('0x76')],{})[_0x9082('0x2c')](respondWithResult(_0x12b9c8,0xc9))[_0x9082('0x36')](handleError(_0x12b9c8,null));};exports['update']=function(_0x3baf2b,_0x4b866b){if(_0x3baf2b['body']['id']){delete _0x3baf2b[_0x9082('0x76')]['id'];}return db[_0x9082('0xb6')][_0x9082('0x6b')]({'where':{'id':_0x3baf2b[_0x9082('0xb5')]['id']}})['then'](handleEntityNotFound(_0x4b866b,null))[_0x9082('0x2c')](saveUpdates(_0x3baf2b[_0x9082('0x76')],null))[_0x9082('0x2c')](respondWithResult(_0x4b866b,null))[_0x9082('0x36')](handleError(_0x4b866b,null));};exports[_0x9082('0x2d')]=function(_0x3eeb32,_0x365c9d){return db[_0x9082('0xb6')]['find']({'where':{'id':_0x3eeb32[_0x9082('0xb5')]['id']}})[_0x9082('0x2c')](handleEntityNotFound(_0x365c9d,null))[_0x9082('0x2c')](removeEntity(_0x365c9d,null))[_0x9082('0x36')](handleError(_0x365c9d,null));};exports[_0x9082('0xbb')]=function(_0x5b8d75,_0x3426f1){return db['OpenchannelInteraction'][_0x9082('0xbb')]()[_0x9082('0x2c')](respondWithResult(_0x3426f1,null))['catch'](handleError(_0x3426f1,null));};exports[_0x9082('0xbc')]=function(_0x20845d,_0x5555dd,_0x32bd3e){return db[_0x9082('0xbd')]['find']({'where':{'id':_0x20845d[_0x9082('0xb5')]['id']}})[_0x9082('0x2c')](handleEntityNotFound(_0x5555dd,null))[_0x9082('0x2c')](function(_0x591729){if(_0x591729){return _0x591729['addMessage'](_0x20845d[_0x9082('0x76')][_0x9082('0xbe')],_['omit'](_0x20845d[_0x9082('0x76')],['ids','id'])||{});}})['then'](respondWithResult(_0x5555dd,null))[_0x9082('0x36')](handleError(_0x5555dd,null));};exports[_0x9082('0xbf')]=function(_0xaabee0,_0x418c13,_0x3daea0){var _0x815cb5={'raw':![],'where':{}};var _0x3b0ecd={};var _0x4ff353={'count':0x0,'rows':[]};return db[_0x9082('0xb6')]['findOne']({'where':{'id':_0xaabee0[_0x9082('0xb5')]['id']}})[_0x9082('0x2c')](handleEntityNotFound(_0x418c13,null))[_0x9082('0x2c')](function(_0x20dacc){if(_0x20dacc){_0x3b0ecd[_0x9082('0x3c')]=_[_0x9082('0x3d')](db[_0x9082('0xbd')][_0x9082('0x38')]);_0x3b0ecd['query']=_[_0x9082('0x3d')](_0xaabee0[_0x9082('0x40')]);_0x3b0ecd[_0x9082('0x3e')]=_['intersection'](_0x3b0ecd[_0x9082('0x3c')],_0x3b0ecd[_0x9082('0x40')]);_0x815cb5['attributes']=_[_0x9082('0x3f')](_0x3b0ecd['model'],qs[_0x9082('0x42')](_0xaabee0[_0x9082('0x40')][_0x9082('0x42')]));_0x815cb5['attributes']=_0x815cb5[_0x9082('0x41')][_0x9082('0x5e')]?_0x815cb5[_0x9082('0x41')]:_0x3b0ecd[_0x9082('0x3c')];if(!_0xaabee0['query']['hasOwnProperty']('nolimit')){_0x815cb5[_0x9082('0x26')]=qs[_0x9082('0x26')](_0xaabee0['query']['limit']);_0x815cb5['offset']=qs[_0x9082('0x25')](_0xaabee0[_0x9082('0x40')]['offset']);}_0x815cb5['order']=qs['sort'](_0xaabee0[_0x9082('0x40')][_0x9082('0x46')]);_0x815cb5[_0x9082('0x47')]=qs[_0x9082('0x3e')](_[_0x9082('0x48')](_0xaabee0[_0x9082('0x40')],_0x3b0ecd[_0x9082('0x3e')]));_0x815cb5[_0x9082('0x47')][_0x9082('0xb2')]=_0x20dacc['id'];if(_0xaabee0[_0x9082('0x40')][_0x9082('0x84')]){_0x815cb5[_0x9082('0x47')]=_['merge'](_0x815cb5[_0x9082('0x47')],{'$or':_[_0x9082('0x31')](_0x815cb5[_0x9082('0x41')],function(_0x5d7aee){var _0x25a13c={};_0x25a13c[_0x5d7aee]={'$like':'%'+_0xaabee0[_0x9082('0x40')][_0x9082('0x84')]+'%'};return _0x25a13c;})});}if(_0xaabee0[_0x9082('0x40')][_0x9082('0x7d')]){var _0x4d0ac5=_0xaabee0[_0x9082('0x40')][_0x9082('0x7d')]['split'](',');var _0x4d7a3d={};_0x4d7a3d[_0x4d0ac5[0x0]]={'$gte':moment(_0x4d0ac5[0x1])[_0x9082('0xc0')](_0x9082('0xc1'))};_0x815cb5[_0x9082('0x47')]=_['merge'](_0x815cb5[_0x9082('0x47')],_0x4d7a3d);}_0x815cb5=_[_0x9082('0x9d')]({},_0x815cb5,_0xaabee0[_0x9082('0xb9')]);return db['OpenchannelMessage'][_0x9082('0x24')]({'where':_0x815cb5['where']})[_0x9082('0x2c')](function(_0x19c1bf){_0x4ff353['count']=_0x19c1bf;if(_0xaabee0[_0x9082('0x40')][_0x9082('0xb7')]){_0x815cb5['include']=[{'all':!![]}];}return db[_0x9082('0xbd')][_0x9082('0xc2')](_0x815cb5);})[_0x9082('0x2c')](function(_0x2a4012){_0x4ff353[_0x9082('0xb4')]=_0x2a4012;return _0x4ff353;});}})[_0x9082('0x2c')](respondWithFilteredResult(_0x418c13,_0x815cb5))[_0x9082('0x36')](handleError(_0x418c13,null));};exports[_0x9082('0xc3')]=function(_0x46a42d,_0x4a14b1,_0x2c2512){return db[_0x9082('0xb6')]['find']({'where':{'id':_0x46a42d[_0x9082('0xb5')]['id']}})[_0x9082('0x2c')](handleEntityNotFound(_0x4a14b1,null))[_0x9082('0x2c')](function(_0x532f2e){if(_0x532f2e){return _0x532f2e[_0x9082('0xc4')](_0x46a42d[_0x9082('0x76')]['ids'],_[_0x9082('0xc5')](_0x46a42d[_0x9082('0x76')],[_0x9082('0xbe'),'id'])||{})['spread'](function(){return db[_0x9082('0x70')]['findAll']({'attributes':['id',_0x9082('0x2f'),_0x9082('0x4b')],'where':{'id':_0x46a42d[_0x9082('0x76')][_0x9082('0xbe')]}});})['then'](function(_0x4092e2){socket[_0x9082('0xc6')](_0x9082('0xc7'),{'id':Number(_0x46a42d[_0x9082('0xb5')]['id']),'tags':_0x4092e2||[]});return{'id':Number(_0x46a42d['params']['id']),'tags':_0x4092e2||[]};});}})['then'](respondWithResult(_0x4a14b1,null))[_0x9082('0x36')](handleError(_0x4a14b1,null));};exports['removeTags']=function(_0xeb07b3,_0x57d08d,_0x4d206d){return db[_0x9082('0xb6')]['find']({'where':{'id':_0xeb07b3[_0x9082('0xb5')]['id']}})[_0x9082('0x2c')](handleEntityNotFound(_0x57d08d,null))[_0x9082('0x2c')](function(_0x218986){if(_0x218986){return _0x218986[_0x9082('0xc8')](_0xeb07b3[_0x9082('0x40')][_0x9082('0xbe')]);}})[_0x9082('0x2c')](respondWithStatusCode(_0x57d08d,null))[_0x9082('0x36')](handleError(_0x57d08d,null));};exports[_0x9082('0xc9')]=function(_0x4eb46c,_0x5c81fa){var _0xef4946=moment()[_0x9082('0xca')]()[_0x9082('0xcb')]();var _0x5760ee=path[_0x9082('0xcc')](config[_0x9082('0xcd')],'server','files',_0x9082('0xce'));var _0x1bbb1d=path[_0x9082('0xcc')](config['root'],'server','files',_0x9082('0xcf'));var _0x5bb65e=path[_0x9082('0xcc')](_0x5760ee,_0xef4946);var _0xc509db=util[_0x9082('0xc0')](_0x9082('0xd0'),_0x4eb46c[_0x9082('0xb5')]['id'],_0xef4946);var _0x427f6f=path['join'](_0x5760ee,_0xc509db);var _0x4cbfc3=[];_0x4cbfc3['push']({'model':db[_0x9082('0x73')],'as':_0x9082('0x73'),'attributes':['id',_0x9082('0xd1')],'raw':!![]});_0x4cbfc3[_0x9082('0x35')]({'model':db['CmContact'],'as':_0x9082('0x63'),'attributes':['id',_0x9082('0xd2'),_0x9082('0xd3')],'raw':!![]});if(_0x4eb46c[_0x9082('0x40')]['attachments']){_0x4cbfc3['push']({'model':db[_0x9082('0xd4')],'as':_0x9082('0xd4'),'raw':!![]});}var _0x179df8=[{'model':db[_0x9082('0xbd')],'as':_0x9082('0xd5'),'attributes':['id',_0x9082('0x76'),_0x9082('0x7b'),_0x9082('0xd6'),_0x9082('0xd7'),_0x9082('0x7f')],'include':_0x4cbfc3}];_0x179df8[_0x9082('0x35')]({'model':db[_0x9082('0xd8')],'as':'Account','attributes':['id','name']});_0x179df8[_0x9082('0x35')]({'model':db[_0x9082('0x73')],'as':_0x9082('0xd9'),'attributes':['id',_0x9082('0xd1')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x4eb46c['params']['id']},'include':_0x179df8})[_0x9082('0x2c')](handleEntityNotFound(_0x5c81fa,null))[_0x9082('0x2c')](function(_0x246407){if(_0x246407){var _0x1a4f56=_0x246407[_0x9082('0xda')]({'plain':!![]});fs[_0x9082('0xdb')](_0x5bb65e);var _0x3a2bed={'format':'A4','border':_0x9082('0xdc'),'header':{'height':_0x9082('0xdd'),'contents':{'first':_0x9082('0xde')}},'footer':{'height':_0x9082('0xdf'),'contents':{'default':util['format'](_0x9082('0xe0'),util[_0x9082('0xc0')](_0x9082('0xe1'),'Openchannel',_0x1a4f56['id']),moment()[_0x9082('0xc0')](_0x9082('0xe2'))[_0x9082('0xcb')]())}}};var _0x23a2d7={'channel':'Openchannel','account':_0x1a4f56[_0x9082('0xe3')]['name'],'agent':_0x1a4f56['Owner']?_0x1a4f56[_0x9082('0xd9')][_0x9082('0xd1')]:_0x9082('0xe4'),'createdAt':moment(_0x1a4f56[_0x9082('0x7b')])[_0x9082('0xc0')](_0x9082('0xc1'))[_0x9082('0xcb')](),'closedAt':_0x1a4f56[_0x9082('0xe5')]?moment(_0x1a4f56[_0x9082('0xe6')])['format'](_0x9082('0xc1'))[_0x9082('0xcb')]():'','disposition':_0x1a4f56['disposition'],'visibility':_0x1a4f56[_0x9082('0xe7')]?_0x9082('0xe8'):_0x9082('0xe9'),'messages':_(_0x1a4f56['Messages'])['filter']({'secret':![]})['map'](function(_0x24dcad){if(_0x24dcad[_0x9082('0xd4')]){var _0x59ca3f=path[_0x9082('0xcc')](_0x1bbb1d,_0x24dcad[_0x9082('0xd4')][_0x9082('0xea')]);if(fs[_0x9082('0xeb')](_0x59ca3f)){fs['createReadStream'](_0x59ca3f)[_0x9082('0xec')](fs[_0x9082('0xed')](path[_0x9082('0xcc')](_0x5bb65e,_0x24dcad[_0x9082('0xd4')]['basename'])));}}return{'date':moment(_0x24dcad[_0x9082('0x7b')])[_0x9082('0xc0')](_0x9082('0xc1'))[_0x9082('0xcb')](),'sender':_0x24dcad[_0x9082('0xd6')]===_0x9082('0xee')?_0x24dcad[_0x9082('0x73')]?_0x24dcad[_0x9082('0x73')][_0x9082('0xd1')]:'System':_0x24dcad[_0x9082('0x63')][_0x9082('0xd2')]+(_0x24dcad[_0x9082('0x63')][_0x9082('0xd3')]?'\x20'+_0x24dcad[_0x9082('0x63')][_0x9082('0xd3')]:''),'body':_0x24dcad['Attachment']?_0x24dcad[_0x9082('0xd4')][_0x9082('0xea')]:_0x24dcad['body'],'direction':_0x24dcad[_0x9082('0xd6')]===_0x9082('0xee')?'A':'C','secret':_0x24dcad[_0x9082('0xd7')],'read':_0x24dcad[_0x9082('0x7f')],'attachment':_0x24dcad[_0x9082('0xd4')]};})['value']()};return ejs[_0x9082('0xef')](path[_0x9082('0xcc')](config[_0x9082('0xcd')],_0x9082('0xf0'),_0x9082('0xf1'),'downloadInteraction.html'),{'interaction':_0x23a2d7})[_0x9082('0x2c')](function(_0x400e08){return new BPromise(function(_0x572759,_0x48dbbb){pdf[_0x9082('0xba')](_0x400e08,_0x3a2bed)[_0x9082('0xf2')](path[_0x9082('0xcc')](_0x5bb65e,_0x9082('0xf3')+_0x1a4f56['id']+'-'+_0xef4946+_0x9082('0xf4')),function(_0x2b51f1,_0x2043e1){if(_0x2b51f1)return _0x48dbbb(_0x2b51f1);_0x572759(_0x2043e1);});});})[_0x9082('0x2c')](function(){return new BPromise(function(_0x346f70,_0x788a72){zipdir(_0x5bb65e,{'saveTo':_0x427f6f},function(_0xc34692,_0x3bd7a3){if(_0xc34692)return _0x788a72(_0xc34692);return _0x346f70(_0x3bd7a3);});})[_0x9082('0x2c')](function(){return new BPromise(function(_0x538555,_0xed9fa8){rimraf(_0x5bb65e,function(_0xcacb00){if(_0xcacb00)_0xed9fa8(_0xcacb00);return _0x538555();});});})[_0x9082('0x2c')](function(){return _0x5c81fa['download'](_0x427f6f,_0xc509db,function(_0x4cdf84){if(_0x4cdf84){console[_0x9082('0xf5')](_0x9082('0xf6'),_0x4cdf84);}else{fs['unlinkSync'](_0x427f6f);}});});});}else{return _0x5c81fa[_0x9082('0x2e')](0xc8);}})[_0x9082('0x36')](handleError(_0x5c81fa,null));}; \ No newline at end of file +var _0x55f6=['UserId','body','some','compact','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','a.key','Account.key','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','Owner','N.A.','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','System','direction','renderFile','views','create','toFile','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','update','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','catch','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','select','field','color','from','tools_tags','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0x55f6,0x17a));var _0x655f=function(_0x1a0d09,_0x228e8f){_0x1a0d09=_0x1a0d09-0x0;var _0x507f0a=_0x55f6[_0x1a0d09];return _0x507f0a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x655f('0x0'));var rimraf=require(_0x655f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x655f('0x2'));var rp=require(_0x655f('0x3'));var moment=require(_0x655f('0x4'));var BPromise=require(_0x655f('0x5'));var Mustache=require(_0x655f('0x6'));var util=require(_0x655f('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x655f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x655f('0x9'));var crypto=require(_0x655f('0xa'));var jsforce=require(_0x655f('0xb'));var deskjs=require(_0x655f('0xc'));var toCsv=require(_0x655f('0xd'));var querystring=require(_0x655f('0xe'));var Papa=require(_0x655f('0xf'));var Redis=require(_0x655f('0x10'));var authService=require(_0x655f('0x11'));var qs=require(_0x655f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x655f('0x13'));var logger=require(_0x655f('0x14'))(_0x655f('0x15'));var utils=require(_0x655f('0x16'));var config=require(_0x655f('0x17'));var licenseUtil=require(_0x655f('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x655f('0x19')](config[_0x655f('0x1a')],{'host':_0x655f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x655f('0x1a')]));require(_0x655f('0x1c'))[_0x655f('0x1d')](socket);function respondWithStatusCode(_0x203b64,_0x1c3492){_0x1c3492=_0x1c3492||0xcc;return function(_0x382cfe){if(_0x382cfe){return _0x203b64[_0x655f('0x1e')](_0x1c3492);}return _0x203b64[_0x655f('0x1f')](_0x1c3492)[_0x655f('0x20')]();};}function respondWithResult(_0x15d938,_0x6ce5d6){_0x6ce5d6=_0x6ce5d6||0xc8;return function(_0x4fdade){if(_0x4fdade){return _0x15d938[_0x655f('0x1f')](_0x6ce5d6)['json'](_0x4fdade);}};}function respondWithFilteredResult(_0xb7abf2,_0x4a9b23){return function(_0x2d0674){if(_0x2d0674){var _0x30927b=_0x2d0674[_0x655f('0x21')],_0x68be57=_0x4a9b23[_0x655f('0x22')],_0x4954a4=_0x4a9b23['offset']+_0x4a9b23[_0x655f('0x23')],_0x5552d7;if(_0x4954a4>=_0x30927b){_0x4954a4=_0x30927b;_0x5552d7=0xc8;}else{_0x5552d7=0xce;}_0xb7abf2['status'](_0x5552d7);return _0xb7abf2['set'](_0x655f('0x24'),_0x68be57+'-'+_0x4954a4+'/'+_0x30927b)[_0x655f('0x25')](_0x2d0674);}return null;};}function patchUpdates(_0x2c7768){return function(_0x193eb0){try{jsonpatch[_0x655f('0x26')](_0x193eb0,_0x2c7768,!![]);}catch(_0x47190b){return BPromise['reject'](_0x47190b);}return _0x193eb0['save']();};}function saveUpdates(_0x2eb59b,_0x32108e){return function(_0x2c4d06){if(_0x2c4d06){return _0x2c4d06[_0x655f('0x27')](_0x2eb59b)[_0x655f('0x28')](function(_0x3fc5cf){return _0x3fc5cf;});}return null;};}function removeEntity(_0xe5be77,_0x233a06){return function(_0x28b1cf){if(_0x28b1cf){return _0x28b1cf[_0x655f('0x29')]()[_0x655f('0x28')](function(){_0xe5be77[_0x655f('0x1f')](0xcc)[_0x655f('0x20')]();});}};}function handleEntityNotFound(_0x52a061,_0x1c3b76){return function(_0x43c3b7){if(!_0x43c3b7){_0x52a061[_0x655f('0x1e')](0x194);}return _0x43c3b7;};}function handleError(_0x5823cc,_0x41bdc8){_0x41bdc8=_0x41bdc8||0x1f4;return function(_0x4ef92d){logger[_0x655f('0x2a')](_0x4ef92d[_0x655f('0x2b')]);if(_0x4ef92d[_0x655f('0x2c')]){delete _0x4ef92d[_0x655f('0x2c')];}_0x5823cc[_0x655f('0x1f')](_0x41bdc8)[_0x655f('0x2d')](_0x4ef92d);};}function getInteractionUsers(_0x1c35f1,_0x1ed77c){return new BPromise(function(_0x4b3108,_0x3bc2be){try{if(_0x1ed77c[_0x1c35f1['id']]){_0x1c35f1[_0x655f('0x2e')]=_[_0x655f('0x2f')](_0x1ed77c[_0x1c35f1['id']],function(_0x21e803){return{'id':_0x21e803['id'],'fullname':_0x21e803[_0x655f('0x30')]};});}}catch(_0x4a0071){_0x3bc2be(_0x4a0071);}_0x4b3108(_0x1c35f1);});}function getInteractionTags(_0x5123a3,_0x2d24f3){return new BPromise(function(_0x1dbc8d,_0x106108){try{if(_0x5123a3['TagIds']){_0x5123a3[_0x655f('0x31')]=[];_0x5123a3[_0x655f('0x32')][_0x655f('0x33')](',')[_0x655f('0x34')](function(_0x4e84c0){_0x5123a3[_0x655f('0x31')]['push'](_0x2d24f3[_0x4e84c0]);});}delete _0x5123a3['TagIds'];}catch(_0x390e36){_0x106108(_0x390e36);}_0x1dbc8d(_0x5123a3);});}function updateOpenchannelInteraction(_0x316ecc,_0x2c3d57,_0xf03e51){return new BPromise(function(_0x3f9979,_0x30a861){return getInteractionUsers(_0x316ecc,_0xf03e51)[_0x655f('0x28')](function(_0x5304f4){return getInteractionTags(_0x5304f4,_0x2c3d57);})[_0x655f('0x28')](function(_0x14c917){_0x3f9979(_0x14c917);})[_0x655f('0x35')](function(_0x1b0848){_0x30a861(_0x1b0848);});});}exports['index']=function(_0x4fc22b,_0x57e97c){var _0x3f4c42={},_0x34b799={},_0x2ab879={'count':0x0,'rows':[]};var _0x374f47=_[_0x655f('0x2f')](db[_0x655f('0x36')][_0x655f('0x37')],function(_0xda0272){return{'name':_0xda0272[_0x655f('0x38')],'type':_0xda0272[_0x655f('0x39')][_0x655f('0x3a')]};});_0x34b799[_0x655f('0x3b')]=_['map'](_0x374f47,'name');_0x34b799[_0x655f('0x3c')]=_[_0x655f('0x3d')](_0x4fc22b[_0x655f('0x3c')]);_0x34b799[_0x655f('0x3e')]=_[_0x655f('0x3f')](_0x34b799[_0x655f('0x3b')],_0x34b799[_0x655f('0x3c')]);_0x3f4c42[_0x655f('0x40')]=_[_0x655f('0x3f')](_0x34b799[_0x655f('0x3b')],qs['fields'](_0x4fc22b[_0x655f('0x3c')]['fields']));_0x3f4c42[_0x655f('0x40')]=_0x3f4c42[_0x655f('0x40')][_0x655f('0x41')]?_0x3f4c42[_0x655f('0x40')]:_0x34b799['model'];if(!_0x4fc22b[_0x655f('0x3c')][_0x655f('0x42')](_0x655f('0x43'))){_0x3f4c42[_0x655f('0x23')]=qs[_0x655f('0x23')](_0x4fc22b[_0x655f('0x3c')]['limit']);_0x3f4c42[_0x655f('0x22')]=qs[_0x655f('0x22')](_0x4fc22b[_0x655f('0x3c')][_0x655f('0x22')]);}_0x3f4c42['order']=qs[_0x655f('0x44')](_0x4fc22b[_0x655f('0x3c')][_0x655f('0x44')]);_0x3f4c42['where']=qs[_0x655f('0x3e')](_['pick'](_0x4fc22b[_0x655f('0x3c')],_0x34b799['filters']),_0x374f47);var _0x573108=[];var _0x3b5b99=squel[_0x655f('0x45')]()[_0x655f('0x46')]('id')[_0x655f('0x46')](_0x655f('0x2c'))['field'](_0x655f('0x47'))[_0x655f('0x48')](_0x655f('0x49'));var _0x336766=squel[_0x655f('0x45')]()[_0x655f('0x46')]('u.id')[_0x655f('0x46')](_0x655f('0x4a'))[_0x655f('0x46')]('ui.OpenchannelInteractionId')[_0x655f('0x48')](_0x655f('0x4b'),'ui')[_0x655f('0x4c')](_0x655f('0x4d'),'u',_0x655f('0x4e'));var _0x14c175=squel[_0x655f('0x45')]()[_0x655f('0x48')](_0x655f('0x4f'),'i')[_0x655f('0x4c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x655f('0x4c')](_0x655f('0x4d'),'o',_0x655f('0x50'))[_0x655f('0x4c')](_0x655f('0x51'),'a',_0x655f('0x52'))['left_join'](_0x655f('0x53'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x655f('0x4c')](_0x655f('0x54'),'it',_0x655f('0x55'))[_0x655f('0x4c')](_0x655f('0x49'),'t','t.id\x20=\x20it.TagId');var _0x239fde=squel[_0x655f('0x56')]();var _0xd92e18=[];var _0x14ba62=squel[_0x655f('0x56')]();var _0x3aece5;if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x57')]){_0x3aece5=as[_0x655f('0x58')](_0x4fc22b[_0x655f('0x3c')][_0x655f('0x57')]);var _0x41d4f3=_0x3aece5['sqlOperator'];for(var _0x3e9f06=0x0;_0x3e9f06<_0x3aece5[_0x655f('0x59')][_0x655f('0x41')];_0x3e9f06++){var _0x421132=_0x3aece5['conditions'][_0x3e9f06];var _0x441eed='i';var _0xaabbbb=_[_0x655f('0x5a')](_0x374f47,[_0x655f('0x2c'),_0x421132['field']]);if(!_0xaabbbb){switch(_0x421132['field']){case _0x655f('0x5b'):if(_0x421132['value']==0x1){_0x14c175[_0x655f('0x5c')]('`'+_0x421132[_0x655f('0x46')]+_0x655f('0x5d'));}else{_0x14c175[_0x655f('0x5c')]('`'+_0x421132[_0x655f('0x46')]+_0x655f('0x5e'));}break;case _0x655f('0x5f'):if(_0x421132[_0x655f('0x60')]===_0x655f('0x61')){if(_0x421132[_0x655f('0x62')][_0x655f('0x33')]('\x20')['length']>0x1){_0x239fde[_0x41d4f3](_0x655f('0x63'),qs[_0x655f('0x64')](_0x421132[_0x655f('0x62')]),null);}else{var _0x32c23b='%'+_0x421132[_0x655f('0x62')]+'%';_0x239fde[_0x41d4f3](_0x655f('0x65'),_0x32c23b,_0x32c23b,_0x32c23b);}}else{_0xaabbbb=_[_0x655f('0x5a')](_0x374f47,['name',_0x655f('0x66')]);_0x421132['field']='ContactId';_0x1ee8d7=as[_0x655f('0x67')](_0x441eed,_0xaabbbb[_0x655f('0x39')],_0x421132);_0x239fde[_0x41d4f3](_0x1ee8d7[_0x655f('0x68')],_0x1ee8d7['value'][_0x655f('0x69')],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x20')]);}break;case _0x655f('0x6a'):var _0x39474a=_0x421132[_0x655f('0x62')][_0x655f('0x33')](',')['map'](function(_0x240257){return Number(_0x240257);});_0x39474a[_0x655f('0x34')](function(_0x3bcc9f){_0x14ba62['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3bcc9f+',%');});_0xd92e18=_[_0x655f('0x6b')](_0xd92e18,_0x39474a);break;case _0x655f('0x6c'):if(_0x421132[_0x655f('0x60')]===_0x655f('0x61')){_0x239fde[_0x41d4f3](_0x655f('0x6d'),'%'+_0x421132[_0x655f('0x62')]+'%',null);}else{_0xaabbbb=_[_0x655f('0x5a')](_0x374f47,[_0x655f('0x2c'),_0x655f('0x6e')]);_0x421132[_0x655f('0x46')]=_0x655f('0x6e');_0x1ee8d7=as[_0x655f('0x67')](_0x441eed,_0xaabbbb[_0x655f('0x39')],_0x421132);_0x239fde[_0x41d4f3](_0x1ee8d7['text'],_0x1ee8d7[_0x655f('0x62')]['start'],_0x1ee8d7[_0x655f('0x62')]['end']);}break;case _0x655f('0x6f'):_0x1ee8d7=as['buildExpression']('me',null,_0x421132);_0x239fde[_0x41d4f3](_0x1ee8d7[_0x655f('0x68')],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x69')],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x20')]);break;}}else{var _0x1ee8d7=as[_0x655f('0x67')](_0x441eed,_0xaabbbb[_0x655f('0x39')],_0x421132);_0x239fde[_0x41d4f3](_0x1ee8d7['text'],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x69')],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x20')]);}}}else{var _0x335630=_(_0x4fc22b[_0x655f('0x3c')])['keys']()['map'](function(_0x397381){return _[_0x655f('0x70')](_0x374f47,[_0x655f('0x2c'),_0x397381])?_0x397381:undefined;})[_0x655f('0x71')]()[_0x655f('0x62')]();if(!_['isEmpty'](_0x335630)){_0x335630[_0x655f('0x34')](function(_0x26b646){if(_0x26b646===_0x655f('0x72')){_0x14c175[_0x655f('0x73')](_0x655f('0x74'),[][_0x655f('0x75')](_0x4fc22b[_0x655f('0x3c')][_0x26b646]));}else if(_0x26b646===_0x655f('0x76')){var _0xd9c137=JSON[_0x655f('0x77')](_0x4fc22b['query'][_0x26b646])[_0x655f('0x78')];var _0x1c9b4f=JSON[_0x655f('0x77')](_0x4fc22b[_0x655f('0x3c')][_0x26b646])['$lte'];_0x14c175[_0x655f('0x73')](_0x655f('0x79'),_0xd9c137,_0x1c9b4f);}else{if(_0x4fc22b['query'][_0x26b646]===_0x655f('0x7a')){_0x14c175[_0x655f('0x73')]('i.'+_0x26b646+_0x655f('0x7b'));}else{_0x14c175[_0x655f('0x73')]('i.'+_0x26b646+_0x655f('0x7c'),_0x4fc22b['query'][_0x26b646]);}}});}if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x7d')]){if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x7d')]==0x1){_0x14c175[_0x655f('0x5c')](_0x655f('0x7e'));}else{_0x14c175['having'](_0x655f('0x7f'));}}if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x80')]){_0xd92e18=_[_0x655f('0x81')](_0x4fc22b[_0x655f('0x3c')]['tag'])?_0x4fc22b['query']['tag']:new Array(_0x4fc22b['query']['tag']);_0xd92e18[_0x655f('0x34')](function(_0x2eb465){_0x14ba62['or'](_0x655f('0x82'),'%,'+_0x2eb465+',%');});}if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x83')]){var _0x217a38=_0x4fc22b[_0x655f('0x3c')][_0x655f('0x83')][_0x655f('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x655f('0x85')](_0x217a38)){_0x239fde['or'](_0x655f('0x86'),_0x217a38+'%');}else{_0x239fde['or'](_0x655f('0x87'),qs[_0x655f('0x64')](_0x217a38))['or'](_0x655f('0x88'),_0x217a38+'%')['or'](_0x655f('0x89'),_0x217a38+'%');}}}_0x14c175['where'](_0x239fde);_0x14c175[_0x655f('0x8a')](_0x655f('0x8b'));var _0x4f7f10={'type':db[_0x655f('0x8c')][_0x655f('0x8d')]['SELECT'],'raw':!![]};var _0xcf1459=_0x14c175['clone']();_0xcf1459['field'](_0x655f('0x8b'));_0xcf1459['field'](_0x655f('0x8e'),_0x655f('0x5b'));if(_0x3f4c42[_0x655f('0x8f')]){_0x3f4c42[_0x655f('0x8f')][_0x655f('0x34')](function(_0x36ca31){var _0xb17ea2=_0x36ca31[0x0]===_0x655f('0x90')?_0x36ca31[0x0]:'i.'+_0x36ca31[0x0];_0x14c175[_0x655f('0x8f')](_0xb17ea2,_0x36ca31[0x1]===_0x655f('0x91')?![]:!![]);});}if(!_[_0x655f('0x92')](_0xd92e18)){_0x14c175['having'](_0x14ba62);_0xcf1459[_0x655f('0x73')](_0x655f('0x93'),_0xd92e18);}BPromise[_0x655f('0x94')]()['then'](function(){if(!_0x3aece5){if(_0x4fc22b[_0x655f('0x3c')]['OpenchannelAccountId']||_0x4fc22b[_0x655f('0x3c')][_0x655f('0x95')])return;_0xcf1459[_0x655f('0x73')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x14c175[_0x655f('0x73')](_0x655f('0x96'));return;}if(_0x4fc22b[_0x655f('0x97')][_0x655f('0x98')]!==_0x655f('0x99'))return;return _0x4fc22b[_0x655f('0x97')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x655f('0x28')](function(_0x40935c){if(_[_0x655f('0x92')](_0x40935c)){_0xcf1459[_0x655f('0x73')](_0x655f('0x9a'));_0x14c175[_0x655f('0x73')](_0x655f('0x9a'));}else{_0xcf1459[_0x655f('0x73')](_0x655f('0x74'),_[_0x655f('0x2f')](_0x40935c,'id'));_0x14c175[_0x655f('0x73')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x40935c,'id'));}});})['then'](function(){if(_0x4fc22b[_0x655f('0x97')][_0x655f('0x98')]==='agent'&&!_0x3aece5&&!_0x4fc22b['query'][_0x655f('0x72')])return[];return db[_0x655f('0x9b')][_0x655f('0x3c')](_0xcf1459[_0x655f('0x9c')](),_0x4f7f10);})[_0x655f('0x28')](function(_0x18ee03){_0x2ab879[_0x655f('0x21')]=_0x18ee03[_0x655f('0x41')];if(_0x2ab879[_0x655f('0x21')]===0x0)return[];return db[_0x655f('0x9b')][_0x655f('0x3c')](_0x3b5b99[_0x655f('0x9c')](),_0x4f7f10)['then'](function(_0x1f4937){_0x573108=_[_0x655f('0x9d')](_0x1f4937,'id');_0x4f7f10=_[_0x655f('0x9e')](_0x4f7f10,{'model':db[_0x655f('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x9f')]){_0x3f4c42[_0x655f('0x40')][_0x655f('0x34')](function(_0x3c03c9){_0x14c175[_0x655f('0x46')]('i.'+_0x3c03c9);});}else{_0x14c175[_0x655f('0x46')](_0x655f('0x8e'),'unreadMessages');_0x14c175[_0x655f('0x46')](_0x655f('0xa0'),_0x655f('0xa1'));_0x14c175[_0x655f('0x46')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x14c175[_0x655f('0x46')](_0x655f('0xa2'),'contactName');_0x14c175[_0x655f('0x46')](_0x655f('0xa3'));_0x14c175[_0x655f('0x46')](_0x655f('0xa4'),_0x655f('0xa5'));_0x14c175[_0x655f('0x46')](_0x655f('0xa6'),_0x655f('0xa7'));_0x14c175[_0x655f('0x46')](_0x655f('0xa8'),_0x655f('0xa9'));_0x14c175[_0x655f('0x46')](_0x655f('0xaa'),_0x655f('0xab'));_0x14c175['field'](_0x655f('0xac'),_0x655f('0xad'));_0x14c175['field'](_0x655f('0xae'),_0x655f('0xaf'));_0x14c175['field'](_0x655f('0xb0'),_0x655f('0xb1'));_0x14c175[_0x655f('0x46')](_0x655f('0xb2'),_0x655f('0xb3'));_0x14c175[_0x655f('0x46')](_0x655f('0xb4'),_0x655f('0x32'));}if(_0x3f4c42[_0x655f('0x23')])_0x14c175[_0x655f('0x23')](_0x3f4c42[_0x655f('0x23')]);if(_0x3f4c42[_0x655f('0x22')])_0x14c175['offset'](_0x3f4c42['offset']);return db[_0x655f('0x9b')][_0x655f('0x3c')](_0x14c175[_0x655f('0x9c')](),_0x4f7f10);})['then'](function(_0x2d2c1e){_0x336766[_0x655f('0x73')](_0x655f('0xb5'),_['map'](_0x2d2c1e,'id'));return db['sequelize'][_0x655f('0x3c')](_0x336766[_0x655f('0x9c')](),_0x4f7f10)[_0x655f('0x28')](function(_0x507b40){var _0x49c99b=_[_0x655f('0xb6')](_0x507b40,_0x655f('0xb7'));var _0x4151f0=[];_0x2d2c1e['forEach'](function(_0x41139f){_0x4151f0['push'](updateOpenchannelInteraction(_0x41139f,_0x573108,_0x49c99b));});return BPromise[_0x655f('0xb8')](_0x4151f0);});});})['then'](function(_0x43ec9f){_0x2ab879[_0x655f('0xb9')]=_0x43ec9f;return _0x2ab879;})[_0x655f('0x28')](respondWithFilteredResult(_0x57e97c,_0x3f4c42))[_0x655f('0x35')](handleError(_0x57e97c,null));};exports[_0x655f('0xba')]=function(_0x23623a,_0x58ecb8){var _0x112122={};if(_0x23623a['query'][_0x655f('0x39')]&&_0x23623a[_0x655f('0x3c')][_0x655f('0x39')]===_0x655f('0x48')){_0x112122[_0x655f('0x48')]=_0x23623a[_0x655f('0xbb')]['id'];}else{_0x112122['id']=_0x23623a[_0x655f('0xbb')]['id'];}var _0x1758b3={'raw':![],'where':_0x112122},_0x3a5110={};_0x3a5110['model']=_['keys'](db[_0x655f('0x36')]['rawAttributes']);_0x3a5110['query']=_['keys'](_0x23623a[_0x655f('0x3c')]);_0x3a5110[_0x655f('0x3e')]=_[_0x655f('0x3f')](_0x3a5110[_0x655f('0x3b')],_0x3a5110['query']);_0x1758b3[_0x655f('0x40')]=_['intersection'](_0x3a5110[_0x655f('0x3b')],qs[_0x655f('0x9f')](_0x23623a['query'][_0x655f('0x9f')]));_0x1758b3['attributes']=_0x1758b3[_0x655f('0x40')][_0x655f('0x41')]?_0x1758b3[_0x655f('0x40')]:_0x3a5110[_0x655f('0x3b')];if(_0x23623a[_0x655f('0x3c')][_0x655f('0xbc')]){_0x1758b3['include']=[{'all':!![]}];}_0x1758b3=_[_0x655f('0x9e')]({},_0x1758b3,_0x23623a['options']);return db[_0x655f('0x36')]['find'](_0x1758b3)['then'](handleEntityNotFound(_0x58ecb8,null))[_0x655f('0x28')](respondWithResult(_0x58ecb8,null))[_0x655f('0x35')](handleError(_0x58ecb8,null));};exports['create']=function(_0x12030d,_0x3a4b76){return db[_0x655f('0x36')]['create'](_0x12030d[_0x655f('0x6f')],{})[_0x655f('0x28')](respondWithResult(_0x3a4b76,0xc9))['catch'](handleError(_0x3a4b76,null));};exports['update']=function(_0xcf7453,_0x16a09f){if(_0xcf7453[_0x655f('0x6f')]['id']){delete _0xcf7453['body']['id'];}return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0xcf7453[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x16a09f,null))[_0x655f('0x28')](saveUpdates(_0xcf7453[_0x655f('0x6f')],null))[_0x655f('0x28')](respondWithResult(_0x16a09f,null))['catch'](handleError(_0x16a09f,null));};exports[_0x655f('0x29')]=function(_0x1a8527,_0x1d9fcb){return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0x1a8527[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x1d9fcb,null))[_0x655f('0x28')](removeEntity(_0x1d9fcb,null))['catch'](handleError(_0x1d9fcb,null));};exports['describe']=function(_0x4868ea,_0x51a92b){return db[_0x655f('0x36')][_0x655f('0xbd')]()[_0x655f('0x28')](respondWithResult(_0x51a92b,null))['catch'](handleError(_0x51a92b,null));};exports[_0x655f('0xbe')]=function(_0x157868,_0x6533fb,_0x18560d){return db[_0x655f('0xbf')][_0x655f('0x5a')]({'where':{'id':_0x157868[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x6533fb,null))[_0x655f('0x28')](function(_0x54d73c){if(_0x54d73c){return _0x54d73c[_0x655f('0xbe')](_0x157868[_0x655f('0x6f')][_0x655f('0xc0')],_[_0x655f('0xc1')](_0x157868[_0x655f('0x6f')],[_0x655f('0xc0'),'id'])||{});}})[_0x655f('0x28')](respondWithResult(_0x6533fb,null))['catch'](handleError(_0x6533fb,null));};exports[_0x655f('0xc2')]=function(_0x5db969,_0x384173,_0x42066a){var _0x122f51={'raw':![],'where':{}};var _0x146e31={};var _0x27fac7={'count':0x0,'rows':[]};return db[_0x655f('0x36')]['findOne']({'where':{'id':_0x5db969[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x384173,null))['then'](function(_0x23692c){if(_0x23692c){_0x146e31[_0x655f('0x3b')]=_[_0x655f('0x3d')](db['OpenchannelMessage'][_0x655f('0x37')]);_0x146e31[_0x655f('0x3c')]=_[_0x655f('0x3d')](_0x5db969[_0x655f('0x3c')]);_0x146e31[_0x655f('0x3e')]=_[_0x655f('0x3f')](_0x146e31['model'],_0x146e31[_0x655f('0x3c')]);_0x122f51[_0x655f('0x40')]=_[_0x655f('0x3f')](_0x146e31[_0x655f('0x3b')],qs[_0x655f('0x9f')](_0x5db969[_0x655f('0x3c')][_0x655f('0x9f')]));_0x122f51[_0x655f('0x40')]=_0x122f51[_0x655f('0x40')][_0x655f('0x41')]?_0x122f51[_0x655f('0x40')]:_0x146e31[_0x655f('0x3b')];if(!_0x5db969[_0x655f('0x3c')][_0x655f('0x42')](_0x655f('0x43'))){_0x122f51[_0x655f('0x23')]=qs[_0x655f('0x23')](_0x5db969[_0x655f('0x3c')][_0x655f('0x23')]);_0x122f51[_0x655f('0x22')]=qs[_0x655f('0x22')](_0x5db969[_0x655f('0x3c')][_0x655f('0x22')]);}_0x122f51[_0x655f('0x8f')]=qs[_0x655f('0x44')](_0x5db969['query'][_0x655f('0x44')]);_0x122f51[_0x655f('0x73')]=qs[_0x655f('0x3e')](_['pick'](_0x5db969[_0x655f('0x3c')],_0x146e31[_0x655f('0x3e')]));_0x122f51[_0x655f('0x73')][_0x655f('0xb7')]=_0x23692c['id'];if(_0x5db969[_0x655f('0x3c')]['filter']){_0x122f51[_0x655f('0x73')]=_[_0x655f('0x9e')](_0x122f51['where'],{'$or':_[_0x655f('0x2f')](_0x122f51[_0x655f('0x40')],function(_0xc663c1){var _0x4a4ce3={};_0x4a4ce3[_0xc663c1]={'$like':'%'+_0x5db969[_0x655f('0x3c')][_0x655f('0x83')]+'%'};return _0x4a4ce3;})});}if(_0x5db969[_0x655f('0x3c')][_0x655f('0x78')]){var _0x4ceced=_0x5db969[_0x655f('0x3c')][_0x655f('0x78')][_0x655f('0x33')](',');var _0x557bf4={};_0x557bf4[_0x4ceced[0x0]]={'$gte':moment(_0x4ceced[0x1])[_0x655f('0xc3')](_0x655f('0xc4'))};_0x122f51[_0x655f('0x73')]=_[_0x655f('0x9e')](_0x122f51['where'],_0x557bf4);}_0x122f51=_[_0x655f('0x9e')]({},_0x122f51,_0x5db969[_0x655f('0xc5')]);return db[_0x655f('0xbf')][_0x655f('0x21')]({'where':_0x122f51['where']})[_0x655f('0x28')](function(_0xb01427){_0x27fac7[_0x655f('0x21')]=_0xb01427;if(_0x5db969[_0x655f('0x3c')][_0x655f('0xbc')]){_0x122f51[_0x655f('0xc6')]=[{'all':!![]}];}return db[_0x655f('0xbf')][_0x655f('0xc7')](_0x122f51);})[_0x655f('0x28')](function(_0x5a3b7d){_0x27fac7[_0x655f('0xb9')]=_0x5a3b7d;return _0x27fac7;});}})[_0x655f('0x28')](respondWithFilteredResult(_0x384173,_0x122f51))[_0x655f('0x35')](handleError(_0x384173,null));};exports['addTags']=function(_0x81df35,_0x3fe873,_0x34cf51){return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0x81df35[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x3fe873,null))[_0x655f('0x28')](function(_0x410470){if(_0x410470){return _0x410470['setTags'](_0x81df35[_0x655f('0x6f')]['ids'],_[_0x655f('0xc1')](_0x81df35['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x655f('0xc7')]({'attributes':['id',_0x655f('0x2c'),_0x655f('0x47')],'where':{'id':_0x81df35['body'][_0x655f('0xc0')]}});})['then'](function(_0x26b863){socket[_0x655f('0xc8')](_0x655f('0xc9'),{'id':Number(_0x81df35['params']['id']),'tags':_0x26b863||[]});return{'id':Number(_0x81df35[_0x655f('0xbb')]['id']),'tags':_0x26b863||[]};});}})['then'](respondWithResult(_0x3fe873,null))['catch'](handleError(_0x3fe873,null));};exports[_0x655f('0xca')]=function(_0x5de090,_0x3f82cc,_0x59b8a6){return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0x5de090['params']['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x3f82cc,null))['then'](function(_0x3ff61e){if(_0x3ff61e){return _0x3ff61e[_0x655f('0xca')](_0x5de090[_0x655f('0x3c')][_0x655f('0xc0')]);}})[_0x655f('0x28')](respondWithStatusCode(_0x3f82cc,null))[_0x655f('0x35')](handleError(_0x3f82cc,null));};exports['download']=function(_0x67a605,_0x2bea7d){var _0x48221f=moment()[_0x655f('0xcb')]()[_0x655f('0x9c')]();var _0x27a7ce=path[_0x655f('0xcc')](config[_0x655f('0xcd')],_0x655f('0xce'),_0x655f('0xcf'),_0x655f('0xd0'));var _0x56379f=path[_0x655f('0xcc')](config[_0x655f('0xcd')],_0x655f('0xce'),_0x655f('0xcf'),'attachments');var _0x425219=path['join'](_0x27a7ce,_0x48221f);var _0x375466=util[_0x655f('0xc3')](_0x655f('0xd1'),_0x67a605['params']['id'],_0x48221f);var _0x52e584=path[_0x655f('0xcc')](_0x27a7ce,_0x375466);var _0x26296f=[];_0x26296f[_0x655f('0xd2')]({'model':db[_0x655f('0x6c')],'as':_0x655f('0x6c'),'attributes':['id',_0x655f('0x30')],'raw':!![]});_0x26296f[_0x655f('0xd2')]({'model':db[_0x655f('0xd3')],'as':_0x655f('0x5f'),'attributes':['id',_0x655f('0xd4'),_0x655f('0xd5')],'raw':!![]});if(_0x67a605['query']['attachments']){_0x26296f['push']({'model':db['Attachment'],'as':_0x655f('0xd6'),'raw':!![]});}var _0x585728=[{'model':db[_0x655f('0xbf')],'as':_0x655f('0xd7'),'attributes':['id','body',_0x655f('0x76'),'direction',_0x655f('0xd8'),'read'],'include':_0x26296f}];_0x585728[_0x655f('0xd2')]({'model':db[_0x655f('0xd9')],'as':_0x655f('0xda'),'attributes':['id',_0x655f('0x2c')]});_0x585728[_0x655f('0xd2')]({'model':db[_0x655f('0x6c')],'as':'Owner','attributes':['id',_0x655f('0x30')]});return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0x67a605[_0x655f('0xbb')]['id']},'include':_0x585728})['then'](handleEntityNotFound(_0x2bea7d,null))[_0x655f('0x28')](function(_0x6cebb8){if(_0x6cebb8){var _0xe118c1=_0x6cebb8['get']({'plain':!![]});fs['mkdirSync'](_0x425219);var _0x46f87e={'format':'A4','border':_0x655f('0xdb'),'header':{'height':'40px','contents':{'first':_0x655f('0xdc')}},'footer':{'height':_0x655f('0xdd'),'contents':{'default':util[_0x655f('0xc3')](_0x655f('0xde'),util[_0x655f('0xc3')](_0x655f('0xdf'),_0x655f('0xe0'),_0xe118c1['id']),moment()[_0x655f('0xc3')](_0x655f('0xe1'))[_0x655f('0x9c')]())}}};var _0x4bf280={'channel':'Openchannel','account':_0xe118c1['Account'][_0x655f('0x2c')],'agent':_0xe118c1['Owner']?_0xe118c1[_0x655f('0xe2')][_0x655f('0x30')]:_0x655f('0xe3'),'createdAt':moment(_0xe118c1[_0x655f('0x76')])['format'](_0x655f('0xc4'))[_0x655f('0x9c')](),'closedAt':_0xe118c1['closed']?moment(_0xe118c1['closedAt'])['format'](_0x655f('0xc4'))[_0x655f('0x9c')]():'','disposition':_0xe118c1['disposition'],'visibility':_0xe118c1['threadId']?_0x655f('0xe4'):_0x655f('0xe5'),'messages':_(_0xe118c1[_0x655f('0xd7')])['filter']({'secret':![]})[_0x655f('0x2f')](function(_0x38a5cf){if(_0x38a5cf['Attachment']){var _0xfff834=path['join'](_0x56379f,_0x38a5cf['Attachment'][_0x655f('0xe6')]);if(fs[_0x655f('0xe7')](_0xfff834)){fs[_0x655f('0xe8')](_0xfff834)['pipe'](fs[_0x655f('0xe9')](path[_0x655f('0xcc')](_0x425219,_0x38a5cf[_0x655f('0xd6')][_0x655f('0xe6')])));}}return{'date':moment(_0x38a5cf[_0x655f('0x76')])['format'](_0x655f('0xc4'))['toString'](),'sender':_0x38a5cf['direction']===_0x655f('0xea')?_0x38a5cf[_0x655f('0x6c')]?_0x38a5cf['User'][_0x655f('0x30')]:_0x655f('0xeb'):_0x38a5cf[_0x655f('0x5f')]['firstName']+(_0x38a5cf[_0x655f('0x5f')][_0x655f('0xd5')]?'\x20'+_0x38a5cf[_0x655f('0x5f')][_0x655f('0xd5')]:''),'body':_0x38a5cf[_0x655f('0xd6')]?_0x38a5cf['Attachment'][_0x655f('0xe6')]:_0x38a5cf[_0x655f('0x6f')],'direction':_0x38a5cf[_0x655f('0xec')]===_0x655f('0xea')?'A':'C','secret':_0x38a5cf[_0x655f('0xd8')],'read':_0x38a5cf[_0x655f('0x7d')],'attachment':_0x38a5cf[_0x655f('0xd6')]};})['value']()};return ejs[_0x655f('0xed')](path[_0x655f('0xcc')](config['root'],_0x655f('0xce'),_0x655f('0xee'),'downloadInteraction.html'),{'interaction':_0x4bf280})[_0x655f('0x28')](function(_0x55b393){return new BPromise(function(_0x5a983d,_0x20c099){pdf[_0x655f('0xef')](_0x55b393,_0x46f87e)[_0x655f('0xf0')](path[_0x655f('0xcc')](_0x425219,'transcript-'+_0xe118c1['id']+'-'+_0x48221f+'.pdf'),function(_0x4dbaf3,_0x1aa720){if(_0x4dbaf3)return _0x20c099(_0x4dbaf3);_0x5a983d(_0x1aa720);});});})[_0x655f('0x28')](function(){return new BPromise(function(_0x3d0c8b,_0x373e52){zipdir(_0x425219,{'saveTo':_0x52e584},function(_0x18a7f6,_0x33016e){if(_0x18a7f6)return _0x373e52(_0x18a7f6);return _0x3d0c8b(_0x33016e);});})[_0x655f('0x28')](function(){return new BPromise(function(_0xe6ec3e,_0xe730a0){rimraf(_0x425219,function(_0x176c92){if(_0x176c92)_0xe730a0(_0x176c92);return _0xe6ec3e();});});})[_0x655f('0x28')](function(){return _0x2bea7d['download'](_0x52e584,_0x375466,function(_0x410151){if(_0x410151){console[_0x655f('0xf1')](_0x655f('0xf2'),_0x410151);}else{fs[_0x655f('0xf3')](_0x52e584);}});});});}else{return _0x2bea7d[_0x655f('0x1e')](0xc8);}})[_0x655f('0x35')](handleError(_0x2bea7d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 3c201cd..2e03f26 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.events.js +++ b/server/api/openchannelInteraction/openchannelInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9f7=['setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage'];(function(_0x10ab73,_0x3a0723){var _0x5d3363=function(_0x2e7807){while(--_0x2e7807){_0x10ab73['push'](_0x10ab73['shift']());}};_0x5d3363(++_0x3a0723);}(_0xb9f7,0x176));var _0x7b9f=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xb9f7[_0x474bc0];return _0x4b24cf;};'use strict';var EventEmitter=require(_0x7b9f('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x7b9f('0x1')];var OpenchannelMessage=require(_0x7b9f('0x2'))['db'][_0x7b9f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7b9f('0x4')](0x0);var events={'afterCreate':_0x7b9f('0x5'),'afterUpdate':_0x7b9f('0x6'),'afterDestroy':_0x7b9f('0x7')};function emitEvent(_0x45cfd3){return function(_0x30c678,_0x429293,_0x549c76){_0x30c678[_0x7b9f('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x23f82){_0x30c678[_0x7b9f('0x9')](_0x7b9f('0xa'),_0x23f82[_0x7b9f('0xb')](function(_0x5668f0){return{'id':_0x5668f0['id']};}));return OpenchannelMessage[_0x7b9f('0xc')]({'where':{'OpenchannelInteractionId':_0x30c678['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b9f('0xd')](function(_0x162a7e){_0x30c678[_0x7b9f('0x9')](_0x7b9f('0xe'),_0x162a7e[_0x7b9f('0xf')]);OpenchannelInteractionEvents[_0x7b9f('0x10')](_0x45cfd3+':'+_0x30c678['id'],_0x30c678);OpenchannelInteractionEvents[_0x7b9f('0x10')](_0x45cfd3,_0x30c678);_0x549c76(null);})[_0x7b9f('0x11')](_0x549c76(null));};}for(var e in events){if(events[_0x7b9f('0x12')](e)){var event=events[e];OpenchannelInteraction[_0x7b9f('0x13')](e,emitEvent(event));}}module[_0x7b9f('0x14')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x081f=['save','update','remove','getUsers','setDataValue','Users','map','unreadMessages','length','emit','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x5bd4fc,_0x4fbd8c){var _0x14b56e=function(_0x361e5c){while(--_0x361e5c){_0x5bd4fc['push'](_0x5bd4fc['shift']());}};_0x14b56e(++_0x4fbd8c);}(_0x081f,0x83));var _0xf081=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x081f[_0x2c3255];return _0x282aba;};'use strict';var EventEmitter=require(_0xf081('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xf081('0x1'))['db'][_0xf081('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf081('0x3')](0x0);var events={'afterCreate':_0xf081('0x4'),'afterUpdate':_0xf081('0x5'),'afterDestroy':_0xf081('0x6')};function emitEvent(_0x1756c4){return function(_0x3f7e0a,_0x38c988,_0x28b562){_0x3f7e0a[_0xf081('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5427a2){_0x3f7e0a[_0xf081('0x8')](_0xf081('0x9'),_0x5427a2[_0xf081('0xa')](function(_0x2df422){return{'id':_0x2df422['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3f7e0a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x875ff){_0x3f7e0a[_0xf081('0x8')](_0xf081('0xb'),_0x875ff[_0xf081('0xc')]);OpenchannelInteractionEvents[_0xf081('0xd')](_0x1756c4+':'+_0x3f7e0a['id'],_0x3f7e0a);OpenchannelInteractionEvents[_0xf081('0xd')](_0x1756c4,_0x3f7e0a);_0x28b562(null);})['catch'](_0x28b562(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xf081('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 86c06d3..cb7a19d 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.model.js +++ b/server/api/openchannelInteraction/openchannelInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4006=['OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','path','../../config/environment','define'];(function(_0x1df0e8,_0x16b24c){var _0x282dd1=function(_0x3469f0){while(--_0x3469f0){_0x1df0e8['push'](_0x1df0e8['shift']());}};_0x282dd1(++_0x16b24c);}(_0x4006,0x1c7));var _0x6400=function(_0x3f27b1,_0x5f7f2){_0x3f27b1=_0x3f27b1-0x0;var _0x2e42f9=_0x4006[_0x3f27b1];return _0x2e42f9;};'use strict';var _=require('lodash');var util=require(_0x6400('0x0'));var logger=require(_0x6400('0x1'))(_0x6400('0x2'));var moment=require(_0x6400('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6400('0x4'));var rimraf=require('rimraf');var config=require(_0x6400('0x5'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x2dbd03,_0x599e6f){return _0x2dbd03[_0x6400('0x6')](_0x6400('0x7'),attributes,{'tableName':_0x6400('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x250dba,_0x5cbe4f,_0x31cc99){if(_0x250dba[_0x6400('0x9')](_0x6400('0xa'))){_0x250dba[_0x6400('0xb')]=moment()[_0x6400('0xc')](_0x6400('0xd'));}_0x31cc99(null,_0x250dba);}}});}; \ No newline at end of file +var _0xfd7b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x423249,_0xacbaf6){var _0x1bffab=function(_0x16b599){while(--_0x16b599){_0x423249['push'](_0x423249['shift']());}};_0x1bffab(++_0xacbaf6);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xfd7b[_0x68ee8b];return _0x5148f7;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var logger=require(_0xbfd7('0x1'))(_0xbfd7('0x2'));var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require(_0xbfd7('0x6'));var rimraf=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var attributes=require(_0xbfd7('0x9'));module[_0xbfd7('0xa')]=function(_0x2ad158,_0x639dd4){return _0x2ad158['define'](_0xbfd7('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33dab1,_0x5cee3d,_0x3cf120){if(_0x33dab1[_0xbfd7('0xc')](_0xbfd7('0xd'))){_0x33dab1[_0xbfd7('0xe')]=moment()['format'](_0xbfd7('0xf'));}_0x3cf120(null,_0x33dab1);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 218b767..c472b58 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.rpc.js +++ b/server/api/openchannelInteraction/openchannelInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4017=['code','message','result','catch','OpenchannelInteraction','update','raw','options','where','attributes','UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction','find','addTags','body','omit','ids','spread','AddTags','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x5967c0,_0x452377){var _0x2ad249=function(_0x7eb26){while(--_0x7eb26){_0x5967c0['push'](_0x5967c0['shift']());}};_0x2ad249(++_0x452377);}(_0x4017,0xb4));var _0x7401=function(_0x185523,_0x2e4a69){_0x185523=_0x185523-0x0;var _0x4d3e49=_0x4017[_0x185523];return _0x4d3e49;};'use strict';var _=require('lodash');var util=require(_0x7401('0x0'));var moment=require(_0x7401('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7401('0x2'));var db=require(_0x7401('0x3'))['db'];var utils=require(_0x7401('0x4'));var logger=require(_0x7401('0x5'))(_0x7401('0x6'));var config=require(_0x7401('0x7'));var jayson=require(_0x7401('0x8'));var client=jayson[_0x7401('0x9')]['http']({'port':0x232a});config[_0x7401('0xa')]=_[_0x7401('0xb')](config[_0x7401('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7401('0xc'))(new Redis(config[_0x7401('0xa')]));require(_0x7401('0xd'))['register'](socket);function respondWithRpcPromise(_0x26e32e,_0x4f345c,_0x3e6a1b){return new BPromise(function(_0x1fbcc2,_0x162394){return client['request'](_0x26e32e,_0x3e6a1b)[_0x7401('0xe')](function(_0x3b07b5){logger[_0x7401('0xf')](_0x7401('0x10'),_0x4f345c,_0x7401('0x11'));logger['debug'](_0x7401('0x12'),_0x4f345c,'request\x20sent',JSON['stringify'](_0x3b07b5));if(_0x3b07b5[_0x7401('0x13')]){if(_0x3b07b5[_0x7401('0x13')][_0x7401('0x14')]===0x1f4){logger[_0x7401('0x13')](_0x7401('0x10'),_0x4f345c,_0x3b07b5[_0x7401('0x13')]['message']);return _0x162394(_0x3b07b5[_0x7401('0x13')]['message']);}logger[_0x7401('0x13')](_0x7401('0x10'),_0x4f345c,_0x3b07b5['error'][_0x7401('0x15')]);return _0x1fbcc2(_0x3b07b5[_0x7401('0x13')][_0x7401('0x15')]);}else{logger[_0x7401('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4f345c,_0x7401('0x11'));_0x1fbcc2(_0x3b07b5[_0x7401('0x16')][_0x7401('0x15')]);}})[_0x7401('0x17')](function(_0x5e2b22){logger[_0x7401('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4f345c,_0x5e2b22);_0x162394(_0x5e2b22);});});}exports['UpdateOpenchannelInteraction']=function(_0x402fa9){var _0x4c57aa=this;return new Promise(function(_0xc60d7d,_0x471cd1){return db[_0x7401('0x18')][_0x7401('0x19')](_0x402fa9['body'],{'raw':_0x402fa9['options']?_0x402fa9['options'][_0x7401('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x402fa9['options']?_0x402fa9[_0x7401('0x1b')][_0x7401('0x1c')]||null:null,'attributes':_0x402fa9['options']?_0x402fa9['options'][_0x7401('0x1d')]||null:null,'limit':_0x402fa9[_0x7401('0x1b')]?_0x402fa9[_0x7401('0x1b')]['limit']||null:null})['then'](function(_0x4db9b7){logger[_0x7401('0xf')](_0x7401('0x1e'),_0x402fa9);logger[_0x7401('0x1f')](_0x7401('0x1e'),_0x402fa9,JSON['stringify'](_0x4db9b7));_0xc60d7d(_0x4db9b7);})[_0x7401('0x17')](function(_0x5711b2){logger['error'](_0x7401('0x1e'),_0x5711b2[_0x7401('0x15')],_0x402fa9);_0x471cd1(_0x4c57aa[_0x7401('0x13')](0x1f4,_0x5711b2['message']));});});};exports[_0x7401('0x20')]=function(_0x99ecd6){return new Promise(function(_0x418f87,_0x548d32){return db[_0x7401('0x18')][_0x7401('0x21')]({'where':_0x99ecd6[_0x7401('0x1b')]?_0x99ecd6[_0x7401('0x1b')][_0x7401('0x1c')]||null:null})[_0x7401('0xe')](function(_0x17a3c9){if(_0x17a3c9){return _0x17a3c9[_0x7401('0x22')](_0x99ecd6[_0x7401('0x23')]['ids'],_[_0x7401('0x24')](_0x99ecd6[_0x7401('0x23')],[_0x7401('0x25'),'id'])||{});}})[_0x7401('0x26')](function(_0x24b4a1){logger[_0x7401('0xf')]('AddTags',_0x99ecd6);logger['debug'](_0x7401('0x27'),_0x99ecd6,JSON['stringify'](_0x24b4a1));_0x418f87(_0x24b4a1);})[_0x7401('0x17')](function(_0x1c34b3){logger['error'](_0x7401('0x27'),_0x1c34b3['message'],_0x99ecd6);_0x548d32(_this[_0x7401('0x13')](0x1f4,_0x1c34b3[_0x7401('0x15')]));});});}; \ No newline at end of file +var _0x508a=['UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw','options','where','limit','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x433605,_0x18201b){var _0x1736c6=function(_0x1ac461){while(--_0x1ac461){_0x433605['push'](_0x433605['shift']());}};_0x1736c6(++_0x18201b);}(_0x508a,0x1da));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa508('0x0'));var util=require(_0xa508('0x1'));var moment=require(_0xa508('0x2'));var BPromise=require(_0xa508('0x3'));var rs=require(_0xa508('0x4'));var fs=require('fs');var Redis=require(_0xa508('0x5'));var db=require(_0xa508('0x6'))['db'];var utils=require(_0xa508('0x7'));var logger=require(_0xa508('0x8'))(_0xa508('0x9'));var config=require('../../config/environment');var jayson=require(_0xa508('0xa'));var client=jayson[_0xa508('0xb')][_0xa508('0xc')]({'port':0x232a});config[_0xa508('0xd')]=_[_0xa508('0xe')](config[_0xa508('0xd')],{'host':_0xa508('0xf'),'port':0x18eb});var socket=require(_0xa508('0x10'))(new Redis(config[_0xa508('0xd')]));require(_0xa508('0x11'))[_0xa508('0x12')](socket);function respondWithRpcPromise(_0x461e1b,_0x2ee6,_0x103d56){return new BPromise(function(_0x38d5b8,_0x1ec018){return client[_0xa508('0x13')](_0x461e1b,_0x103d56)[_0xa508('0x14')](function(_0x143f95){logger[_0xa508('0x15')](_0xa508('0x16'),_0x2ee6,_0xa508('0x17'));logger[_0xa508('0x18')](_0xa508('0x19'),_0x2ee6,_0xa508('0x17'),JSON[_0xa508('0x1a')](_0x143f95));if(_0x143f95['error']){if(_0x143f95['error'][_0xa508('0x1b')]===0x1f4){logger[_0xa508('0x1c')](_0xa508('0x16'),_0x2ee6,_0x143f95[_0xa508('0x1c')]['message']);return _0x1ec018(_0x143f95[_0xa508('0x1c')][_0xa508('0x1d')]);}logger['error'](_0xa508('0x16'),_0x2ee6,_0x143f95[_0xa508('0x1c')][_0xa508('0x1d')]);return _0x38d5b8(_0x143f95[_0xa508('0x1c')]['message']);}else{logger[_0xa508('0x15')](_0xa508('0x16'),_0x2ee6,'request\x20sent');_0x38d5b8(_0x143f95[_0xa508('0x1e')][_0xa508('0x1d')]);}})[_0xa508('0x1f')](function(_0x16143c){logger[_0xa508('0x1c')](_0xa508('0x16'),_0x2ee6,_0x16143c);_0x1ec018(_0x16143c);});});}exports[_0xa508('0x20')]=function(_0x254240){var _0x2fea03=this;return new Promise(function(_0x29714d,_0x24aecc){return db[_0xa508('0x21')][_0xa508('0x22')](_0x254240[_0xa508('0x23')],{'raw':_0x254240['options']?_0x254240['options'][_0xa508('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254240[_0xa508('0x25')]?_0x254240[_0xa508('0x25')][_0xa508('0x26')]||null:null,'attributes':_0x254240[_0xa508('0x25')]?_0x254240[_0xa508('0x25')]['attributes']||null:null,'limit':_0x254240['options']?_0x254240[_0xa508('0x25')][_0xa508('0x27')]||null:null})[_0xa508('0x14')](function(_0x39a35a){logger[_0xa508('0x15')](_0xa508('0x20'),_0x254240);logger[_0xa508('0x18')]('UpdateOpenchannelInteraction',_0x254240,JSON['stringify'](_0x39a35a));_0x29714d(_0x39a35a);})[_0xa508('0x1f')](function(_0x396f7d){logger[_0xa508('0x1c')]('UpdateOpenchannelInteraction',_0x396f7d[_0xa508('0x1d')],_0x254240);_0x24aecc(_0x2fea03[_0xa508('0x1c')](0x1f4,_0x396f7d[_0xa508('0x1d')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x222fc3){return new Promise(function(_0x4adaed,_0x2ebe9c){return db[_0xa508('0x21')][_0xa508('0x28')]({'where':_0x222fc3[_0xa508('0x25')]?_0x222fc3['options'][_0xa508('0x26')]||null:null})['then'](function(_0x5e8bdc){if(_0x5e8bdc){return _0x5e8bdc[_0xa508('0x29')](_0x222fc3[_0xa508('0x23')][_0xa508('0x2a')],_[_0xa508('0x2b')](_0x222fc3[_0xa508('0x23')],[_0xa508('0x2a'),'id'])||{});}})[_0xa508('0x2c')](function(_0x5bba52){logger[_0xa508('0x15')](_0xa508('0x2d'),_0x222fc3);logger[_0xa508('0x18')](_0xa508('0x2d'),_0x222fc3,JSON[_0xa508('0x1a')](_0x5bba52));_0x4adaed(_0x5bba52);})[_0xa508('0x1f')](function(_0x3717cb){logger['error'](_0xa508('0x2d'),_0x3717cb[_0xa508('0x1d')],_0x222fc3);_0x2ebe9c(_this[_0xa508('0x1c')](0x1f4,_0x3717cb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index bea05bd..7b4bffa 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.socket.js +++ b/server/api/openchannelInteraction/openchannelInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8efc=['openchannelInteraction:','save','remove','update','removeListener','register','length'];(function(_0x16e824,_0x23ab90){var _0x1745ea=function(_0x327e55){while(--_0x327e55){_0x16e824['push'](_0x16e824['shift']());}};_0x1745ea(++_0x23ab90);}(_0x8efc,0xef));var _0xc8ef=function(_0x386187,_0x1ad2ac){_0x386187=_0x386187-0x0;var _0x4abeaa=_0x8efc[_0x386187];return _0x4abeaa;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xc8ef('0x0'),_0xc8ef('0x1'),_0xc8ef('0x2')];function createListener(_0x5e28c8,_0x16bbf4){return function(_0x3bd437){_0x16bbf4['emit'](_0x5e28c8,_0x3bd437);};}function removeListener(_0x4036c1,_0x41724c){return function(){OpenchannelInteractionEvents[_0xc8ef('0x3')](_0x4036c1,_0x41724c);};}exports[_0xc8ef('0x4')]=function(_0x166f57){for(var _0x1ec416=0x0,_0x3a3eba=events[_0xc8ef('0x5')];_0x1ec416<_0x3a3eba;_0x1ec416++){var _0x5fcf8e=events[_0x1ec416];var _0x15ad7f=createListener(_0xc8ef('0x6')+_0x5fcf8e,_0x166f57);OpenchannelInteractionEvents['on'](_0x5fcf8e,_0x15ad7f);}}; \ No newline at end of file +var _0xc7b7=['length','openchannelInteraction:','save','update','emit','removeListener','register'];(function(_0x44ac5f,_0xbfa9f8){var _0x4624be=function(_0x377a3e){while(--_0x377a3e){_0x44ac5f['push'](_0x44ac5f['shift']());}};_0x4624be(++_0xbfa9f8);}(_0xc7b7,0xcd));var _0x7c7b=function(_0x49df93,_0x2bb7ac){_0x49df93=_0x49df93-0x0;var _0x471bac=_0xc7b7[_0x49df93];return _0x471bac;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x7c7b('0x0'),'remove',_0x7c7b('0x1')];function createListener(_0x4d45dc,_0x1ae124){return function(_0x44c112){_0x1ae124[_0x7c7b('0x2')](_0x4d45dc,_0x44c112);};}function removeListener(_0x1e9b6f,_0x3c8d52){return function(){OpenchannelInteractionEvents[_0x7c7b('0x3')](_0x1e9b6f,_0x3c8d52);};}exports[_0x7c7b('0x4')]=function(_0x2f1372){for(var _0x4034c5=0x0,_0x27c67b=events[_0x7c7b('0x5')];_0x4034c5<_0x27c67b;_0x4034c5++){var _0x5c7b99=events[_0x4034c5];var _0x564f14=createListener(_0x7c7b('0x6')+_0x5c7b99,_0x2f1372);OpenchannelInteractionEvents['on'](_0x5c7b99,_0x564f14);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 7ba1ad4..3a313aa 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11f5=['express','Router','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','/:id/accept','accept','/:id/reject','delete','multer','util','path'];(function(_0x5df036,_0x5064d7){var _0x433c8d=function(_0x501acf){while(--_0x501acf){_0x5df036['push'](_0x5df036['shift']());}};_0x433c8d(++_0x5064d7);}(_0x11f5,0x16d));var _0x511f=function(_0x40fd16,_0x11286){_0x40fd16=_0x40fd16-0x0;var _0x8410e5=_0x11f5[_0x40fd16];return _0x8410e5;};'use strict';var multer=require(_0x511f('0x0'));var util=require(_0x511f('0x1'));var path=require(_0x511f('0x2'));var timeout=require('connect-timeout');var express=require(_0x511f('0x3'));var router=express[_0x511f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x511f('0x5'));var config=require('../../config/environment');var controller=require(_0x511f('0x6'));router[_0x511f('0x7')]('/',auth[_0x511f('0x8')](),controller[_0x511f('0x9')]);router[_0x511f('0x7')](_0x511f('0xa'),auth['isAuthenticated'](),controller[_0x511f('0xb')]);router['get'](_0x511f('0xc'),auth['isAuthenticated'](),controller[_0x511f('0xd')]);router[_0x511f('0xe')]('/',auth[_0x511f('0x8')](),interaction[_0x511f('0xf')](_0x511f('0x10'),_0x511f('0x11')),controller['create']);router[_0x511f('0x12')](_0x511f('0xc'),auth[_0x511f('0x8')](),controller['update']);router[_0x511f('0x12')](_0x511f('0x13'),auth[_0x511f('0x8')](),controller[_0x511f('0x14')]);router[_0x511f('0x12')](_0x511f('0x15'),auth[_0x511f('0x8')](),controller['reject']);router[_0x511f('0x16')](_0x511f('0xc'),auth[_0x511f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbaf4=['put','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14723d,_0x4e09de){var _0x53227d=function(_0x28aea4){while(--_0x28aea4){_0x14723d['push'](_0x14723d['shift']());}};_0x53227d(++_0x4e09de);}(_0xbaf4,0x1e6));var _0x4baf=function(_0x1959af,_0x4784c6){_0x1959af=_0x1959af-0x0;var _0xe7eaf6=_0xbaf4[_0x1959af];return _0xe7eaf6;};'use strict';var multer=require(_0x4baf('0x0'));var util=require('util');var path=require(_0x4baf('0x1'));var timeout=require(_0x4baf('0x2'));var express=require(_0x4baf('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4baf('0x4'));var config=require(_0x4baf('0x5'));var controller=require(_0x4baf('0x6'));router['get']('/',auth[_0x4baf('0x7')](),controller[_0x4baf('0x8')]);router[_0x4baf('0x9')](_0x4baf('0xa'),auth[_0x4baf('0x7')](),controller[_0x4baf('0xb')]);router['get'](_0x4baf('0xc'),auth['isAuthenticated'](),controller[_0x4baf('0xd')]);router[_0x4baf('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x4baf('0xf'),_0x4baf('0x10')),controller[_0x4baf('0x11')]);router['put'](_0x4baf('0xc'),auth[_0x4baf('0x7')](),controller['update']);router[_0x4baf('0x12')]('/:id/accept',auth[_0x4baf('0x7')](),controller[_0x4baf('0x13')]);router[_0x4baf('0x12')](_0x4baf('0x14'),auth[_0x4baf('0x7')](),controller[_0x4baf('0x15')]);router[_0x4baf('0x16')](_0x4baf('0xc'),auth[_0x4baf('0x7')](),controller['destroy']);module[_0x4baf('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 8bbe2fa..5f6b55b 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cfb=['medium','BOOLEAN','ENUM','DATE','STRING','sequelize','exports','TEXT'];(function(_0x53049f,_0x21313e){var _0x4f039f=function(_0x5940ac){while(--_0x5940ac){_0x53049f['push'](_0x53049f['shift']());}};_0x4f039f(++_0x21313e);}(_0x1cfb,0xed));var _0xb1cf=function(_0x4e5b60,_0x58b613){_0x4e5b60=_0x4e5b60-0x0;var _0x3b53bf=_0x1cfb[_0x4e5b60];return _0x3b53bf;};'use strict';var Sequelize=require(_0xb1cf('0x0'));module[_0xb1cf('0x1')]={'body':{'type':Sequelize[_0xb1cf('0x2')](_0xb1cf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb1cf('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb1cf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb1cf('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb1cf('0x6')]},'providerName':{'type':Sequelize[_0xb1cf('0x7')]},'providerResponse':{'type':Sequelize[_0xb1cf('0x2')]}}; \ No newline at end of file +var _0xb524=['medium','BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0xb524,0x132));var _0x4b52=function(_0x5817d8,_0x22c438){_0x5817d8=_0x5817d8-0x0;var _0x40505f=_0xb524[_0x5817d8];return _0x40505f;};'use strict';var Sequelize=require(_0x4b52('0x0'));module['exports']={'body':{'type':Sequelize[_0x4b52('0x1')](_0x4b52('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4b52('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4b52('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b52('0x4')]('in',_0x4b52('0x5')),'defaultValue':_0x4b52('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4b52('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4b52('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4e9e59a..20ab180 100644 --- a/server/api/openchannelMessage/openchannelMessage.controller.js +++ b/server/api/openchannelMessage/openchannelMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbee3=['./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','update','destroy','stack','name','send','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','filter','merge','options','includeAll','include','rows','show','params','find','create','body','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','openchannel','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x2bf329,_0x3e87d5){var _0x410bab=function(_0x2df57a){while(--_0x2df57a){_0x2bf329['push'](_0x2bf329['shift']());}};_0x410bab(++_0x3e87d5);}(_0xbee3,0xd5));var _0x3bee=function(_0x64ef48,_0x3eb8f8){_0x64ef48=_0x64ef48-0x0;var _0x3c20ef=_0xbee3[_0x64ef48];return _0x3c20ef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3bee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3bee('0x1'));var rp=require(_0x3bee('0x2'));var moment=require('moment');var BPromise=require(_0x3bee('0x3'));var Mustache=require(_0x3bee('0x4'));var util=require(_0x3bee('0x5'));var path=require('path');var sox=require(_0x3bee('0x6'));var csv=require(_0x3bee('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x7'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];config[_0x3bee('0x17')]=_[_0x3bee('0x18')](config[_0x3bee('0x17')],{'host':_0x3bee('0x19'),'port':0x18eb});var socket=require(_0x3bee('0x1a'))(new Redis(config['redis']));require(_0x3bee('0x1b'))[_0x3bee('0x1c')](socket);var jayson=require(_0x3bee('0x1d'));var client=jayson[_0x3bee('0x1e')][_0x3bee('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x346767,_0x515397,_0x2cfba7,_0x7e763c){return new BPromise(function(_0x57d42c,_0x5c87cf){var _0x1582a4=_0x7e763c||client;return _0x1582a4[_0x3bee('0x20')](_0x346767,_0x2cfba7)[_0x3bee('0x21')](function(_0x631ff8){logger['info'](_0x3bee('0x22'),_0x515397,_0x3bee('0x23'));logger[_0x3bee('0x24')](_0x3bee('0x25'),_0x515397,_0x3bee('0x23'),JSON[_0x3bee('0x26')](_0x631ff8));if(_0x631ff8[_0x3bee('0x27')]){if(_0x631ff8['error']['code']===0x1f4){logger[_0x3bee('0x27')](_0x3bee('0x22'),_0x515397,_0x631ff8['error'][_0x3bee('0x28')]);return _0x5c87cf(_0x631ff8[_0x3bee('0x27')][_0x3bee('0x28')]);}logger[_0x3bee('0x27')](_0x3bee('0x22'),_0x515397,_0x631ff8[_0x3bee('0x27')][_0x3bee('0x28')]);return _0x57d42c(_0x631ff8['error'][_0x3bee('0x28')]);}else{logger[_0x3bee('0x29')](_0x3bee('0x22'),_0x515397,_0x3bee('0x23'));_0x57d42c(_0x631ff8['result'][_0x3bee('0x28')]);}})[_0x3bee('0x2a')](function(_0x1e0111){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x515397,_0x1e0111);_0x5c87cf(_0x1e0111);});});}function respondWithStatusCode(_0x13181e,_0x479f45){_0x479f45=_0x479f45||0xcc;return function(_0x5341e2){if(_0x5341e2){return _0x13181e[_0x3bee('0x2b')](_0x479f45);}return _0x13181e[_0x3bee('0x2c')](_0x479f45)[_0x3bee('0x2d')]();};}function respondWithResult(_0x5b1eec,_0x1984c4){_0x1984c4=_0x1984c4||0xc8;return function(_0x355b64){if(_0x355b64){return _0x5b1eec[_0x3bee('0x2c')](_0x1984c4)['json'](_0x355b64);}};}function respondWithFilteredResult(_0x239fa4,_0xf08fb3){return function(_0x3a3d92){if(_0x3a3d92){var _0x496abd=_0x3a3d92[_0x3bee('0x2e')],_0x1115ed=_0xf08fb3[_0x3bee('0x2f')],_0x24d523=_0xf08fb3['offset']+_0xf08fb3['limit'],_0x27ed99;if(_0x24d523>=_0x496abd){_0x24d523=_0x496abd;_0x27ed99=0xc8;}else{_0x27ed99=0xce;}_0x239fa4[_0x3bee('0x2c')](_0x27ed99);return _0x239fa4[_0x3bee('0x30')](_0x3bee('0x31'),_0x1115ed+'-'+_0x24d523+'/'+_0x496abd)[_0x3bee('0x32')](_0x3a3d92);}return null;};}function patchUpdates(_0x4df2ac){return function(_0x47877d){try{jsonpatch[_0x3bee('0x33')](_0x47877d,_0x4df2ac,!![]);}catch(_0x42cb58){return BPromise['reject'](_0x42cb58);}return _0x47877d['save']();};}function saveUpdates(_0xf4701f,_0x3245c7){return function(_0x36447b){if(_0x36447b){return _0x36447b[_0x3bee('0x34')](_0xf4701f)[_0x3bee('0x21')](function(_0x2cfb4b){return _0x2cfb4b;});}return null;};}function removeEntity(_0x2790ce,_0x115d08){return function(_0xd6fd53){if(_0xd6fd53){return _0xd6fd53[_0x3bee('0x35')]()['then'](function(){_0x2790ce['status'](0xcc)[_0x3bee('0x2d')]();});}};}function handleEntityNotFound(_0x4a4706,_0x52015b){return function(_0x9cfb2f){if(!_0x9cfb2f){_0x4a4706[_0x3bee('0x2b')](0x194);}return _0x9cfb2f;};}function handleError(_0x15bba3,_0x474cf5){_0x474cf5=_0x474cf5||0x1f4;return function(_0xd926f8){logger[_0x3bee('0x27')](_0xd926f8[_0x3bee('0x36')]);if(_0xd926f8[_0x3bee('0x37')]){delete _0xd926f8['name'];}_0x15bba3[_0x3bee('0x2c')](_0x474cf5)[_0x3bee('0x38')](_0xd926f8);};}exports['index']=function(_0x3711e4,_0x28181b){var _0x106ce6={},_0x13d2d5={},_0x195540={'count':0x0,'rows':[]};var _0x5e24d0=_['map'](db[_0x3bee('0x39')][_0x3bee('0x3a')],function(_0x59ca12){return{'name':_0x59ca12[_0x3bee('0x3b')],'type':_0x59ca12[_0x3bee('0x3c')][_0x3bee('0x3d')]};});_0x13d2d5[_0x3bee('0x3e')]=_[_0x3bee('0x3f')](_0x5e24d0,_0x3bee('0x37'));_0x13d2d5[_0x3bee('0x40')]=_[_0x3bee('0x41')](_0x3711e4[_0x3bee('0x40')]);_0x13d2d5['filters']=_[_0x3bee('0x42')](_0x13d2d5[_0x3bee('0x3e')],_0x13d2d5[_0x3bee('0x40')]);_0x106ce6[_0x3bee('0x43')]=_[_0x3bee('0x42')](_0x13d2d5[_0x3bee('0x3e')],qs[_0x3bee('0x44')](_0x3711e4[_0x3bee('0x40')][_0x3bee('0x44')]));_0x106ce6[_0x3bee('0x43')]=_0x106ce6[_0x3bee('0x43')][_0x3bee('0x45')]?_0x106ce6[_0x3bee('0x43')]:_0x13d2d5['model'];if(!_0x3711e4[_0x3bee('0x40')][_0x3bee('0x46')](_0x3bee('0x47'))){_0x106ce6[_0x3bee('0x48')]=qs[_0x3bee('0x48')](_0x3711e4[_0x3bee('0x40')][_0x3bee('0x48')]);_0x106ce6[_0x3bee('0x2f')]=qs['offset'](_0x3711e4[_0x3bee('0x40')][_0x3bee('0x2f')]);}_0x106ce6[_0x3bee('0x49')]=qs['sort'](_0x3711e4[_0x3bee('0x40')]['sort']);_0x106ce6[_0x3bee('0x4a')]=qs['filters'](_['pick'](_0x3711e4[_0x3bee('0x40')],_0x13d2d5[_0x3bee('0x4b')]),_0x5e24d0);if(_0x3711e4[_0x3bee('0x40')][_0x3bee('0x4c')]){_0x106ce6[_0x3bee('0x4a')]=_['merge'](_0x106ce6['where'],{'$or':_[_0x3bee('0x3f')](_0x5e24d0,function(_0x5a9db2){if(_0x5a9db2[_0x3bee('0x3c')]!=='VIRTUAL'){var _0x422546={};_0x422546[_0x5a9db2['name']]={'$like':'%'+_0x3711e4[_0x3bee('0x40')][_0x3bee('0x4c')]+'%'};return _0x422546;}})});}_0x106ce6=_[_0x3bee('0x4d')]({},_0x106ce6,_0x3711e4[_0x3bee('0x4e')]);var _0x577a23={'where':_0x106ce6['where']};return db[_0x3bee('0x39')]['count'](_0x577a23)['then'](function(_0x5e20af){_0x195540[_0x3bee('0x2e')]=_0x5e20af;if(_0x3711e4['query'][_0x3bee('0x4f')]){_0x106ce6[_0x3bee('0x50')]=[{'all':!![]}];}return db[_0x3bee('0x39')]['findAll'](_0x106ce6);})[_0x3bee('0x21')](function(_0x5cc59d){_0x195540[_0x3bee('0x51')]=_0x5cc59d;return _0x195540;})['then'](respondWithFilteredResult(_0x28181b,_0x106ce6))[_0x3bee('0x2a')](handleError(_0x28181b,null));};exports[_0x3bee('0x52')]=function(_0x15a96a,_0x4ab393){var _0x2047b5={'raw':!![],'where':{'id':_0x15a96a[_0x3bee('0x53')]['id']}},_0x43aba5={};_0x43aba5['model']=_['keys'](db[_0x3bee('0x39')][_0x3bee('0x3a')]);_0x43aba5[_0x3bee('0x40')]=_[_0x3bee('0x41')](_0x15a96a[_0x3bee('0x40')]);_0x43aba5[_0x3bee('0x4b')]=_[_0x3bee('0x42')](_0x43aba5['model'],_0x43aba5[_0x3bee('0x40')]);_0x2047b5[_0x3bee('0x43')]=_['intersection'](_0x43aba5['model'],qs[_0x3bee('0x44')](_0x15a96a['query'][_0x3bee('0x44')]));_0x2047b5[_0x3bee('0x43')]=_0x2047b5[_0x3bee('0x43')]['length']?_0x2047b5[_0x3bee('0x43')]:_0x43aba5[_0x3bee('0x3e')];if(_0x15a96a[_0x3bee('0x40')]['includeAll']){_0x2047b5[_0x3bee('0x50')]=[{'all':!![]}];}_0x2047b5=_[_0x3bee('0x4d')]({},_0x2047b5,_0x15a96a['options']);return db[_0x3bee('0x39')][_0x3bee('0x54')](_0x2047b5)['then'](handleEntityNotFound(_0x4ab393,null))[_0x3bee('0x21')](respondWithResult(_0x4ab393,null))[_0x3bee('0x2a')](handleError(_0x4ab393,null));};exports[_0x3bee('0x55')]=function(_0x25cb9d,_0x1df317){return db[_0x3bee('0x39')][_0x3bee('0x55')](_0x25cb9d[_0x3bee('0x56')],{})['then'](respondWithResult(_0x1df317,0xc9))['catch'](handleError(_0x1df317,null));};exports[_0x3bee('0x34')]=function(_0x5e13e8,_0x38b82a){if(_0x5e13e8[_0x3bee('0x56')]['id']){delete _0x5e13e8[_0x3bee('0x56')]['id'];}return db['OpenchannelMessage'][_0x3bee('0x54')]({'where':{'id':_0x5e13e8[_0x3bee('0x53')]['id']}})[_0x3bee('0x21')](handleEntityNotFound(_0x38b82a,null))['then'](saveUpdates(_0x5e13e8[_0x3bee('0x56')],null))['then'](respondWithResult(_0x38b82a,null))[_0x3bee('0x2a')](handleError(_0x38b82a,null));};exports[_0x3bee('0x35')]=function(_0x404730,_0x4facff){return db[_0x3bee('0x39')][_0x3bee('0x54')]({'where':{'id':_0x404730[_0x3bee('0x53')]['id']}})['then'](handleEntityNotFound(_0x4facff,null))['then'](removeEntity(_0x4facff,null))[_0x3bee('0x2a')](handleError(_0x4facff,null));};exports[_0x3bee('0x57')]=function(_0x149b35,_0x4e6b22){return db['OpenchannelMessage'][_0x3bee('0x57')]()['then'](respondWithResult(_0x4e6b22,null))['catch'](handleError(_0x4e6b22,null));};var interaction_log=require(_0x3bee('0x13'))(_0x3bee('0x58'));exports[_0x3bee('0x59')]=function(_0x4a989c,_0x4d1766,_0xeb9c2c){var _0x1f4eb9={'channel':'openchannel'};if(_0x4a989c[_0x3bee('0x56')]['id']){delete _0x4a989c['body']['id'];}_0x4a989c[_0x3bee('0x56')][_0x3bee('0x5a')]=!![];_0x4a989c[_0x3bee('0x56')][_0x3bee('0x5b')]=moment()[_0x3bee('0x5c')](_0x3bee('0x5d'));_0x4a989c[_0x3bee('0x56')][_0x3bee('0x5e')]=_0x4a989c[_0x3bee('0x56')][_0x3bee('0x5e')]||_0x4a989c[_0x3bee('0x5f')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x4a989c['params']['id'],'UserId':null},'include':[{'model':db[_0x3bee('0x60')],'as':_0x3bee('0x61')}]})[_0x3bee('0x21')](handleEntityNotFound(_0x4d1766,null))[_0x3bee('0x21')](saveUpdates(_0x4a989c['body'],null))[_0x3bee('0x21')](function(_0x1be1c3){if(_0x1be1c3){_0x1f4eb9['message']=_0x1be1c3['get']({'plain':!![]});return db[_0x3bee('0x62')][_0x3bee('0x54')]({'where':{'id':_0x1be1c3[_0x3bee('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4d1766,null))[_0x3bee('0x21')](function(_0x1f7b50){if(_0x1f7b50){return _0x1f7b50[_0x3bee('0x34')]({'UserId':_0x4a989c['body'][_0x3bee('0x5e')],'read1stAt':_[_0x3bee('0x64')](_0x1f7b50[_0x3bee('0x65')])?moment()[_0x3bee('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x169f36){if(_0x169f36){_0x1f4eb9[_0x3bee('0x66')]=_0x169f36[_0x3bee('0x67')]({'plain':!![]});interaction_log[_0x3bee('0x29')](_0x3bee('0x68'),_0x4a989c['user']['id'],_0x4a989c[_0x3bee('0x5f')]['name'],_0x4a989c[_0x3bee('0x5f')][_0x3bee('0x69')],_0x1f4eb9[_0x3bee('0x66')]['id'],_0x4a989c[_0x3bee('0x56')]?JSON[_0x3bee('0x26')](_0x4a989c[_0x3bee('0x56')]):_0x3bee('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x3bee('0x6b'),_0x1f4eb9);}return null;})[_0x3bee('0x21')](function(_0x42045d){if(_0x42045d){if(_0x4a989c[_0x3bee('0x56')]['manual']){_0x1f4eb9[_0x3bee('0x28')][_0x3bee('0x6c')]=util[_0x3bee('0x5c')](_0x3bee('0x6d'),_0x4a989c[_0x3bee('0x5f')][_0x3bee('0x37')]);_0x1f4eb9[_0x3bee('0x28')][_0x3bee('0x6e')]=_0x1f4eb9['channel'];_0x1f4eb9[_0x3bee('0x28')][_0x3bee('0x6f')]=_0x3bee('0x59');return respondWithRpcPromise('EventManager',_0x3bee('0x70'),{'event':_0x3bee('0x71'),'message':_0x1f4eb9[_0x3bee('0x28')]},client9002)[_0x3bee('0x21')](function(){return _0x1f4eb9;});}return _0x1f4eb9;}return null;})[_0x3bee('0x21')](respondWithResult(_0x4d1766,null))[_0x3bee('0x2a')](handleError(_0x4d1766,null));};var interaction_log=require(_0x3bee('0x13'))(_0x3bee('0x58'));exports[_0x3bee('0x72')]=function(_0x30dd74,_0x3f72f7,_0x387924){var _0xda3a9d={'agent':{},'channel':_0x3bee('0x73')};if(_0x30dd74[_0x3bee('0x56')]['id']){delete _0x30dd74[_0x3bee('0x56')]['id'];}_0x30dd74[_0x3bee('0x56')][_0x3bee('0x5e')]=_0x30dd74[_0x3bee('0x56')][_0x3bee('0x5e')]||_0x30dd74[_0x3bee('0x5f')]['id'];_0xda3a9d[_0x3bee('0x74')]['id']=_0x30dd74[_0x3bee('0x56')][_0x3bee('0x5e')];return db[_0x3bee('0x39')]['find']({'where':{'id':_0x30dd74[_0x3bee('0x53')]['id'],'UserId':null}})[_0x3bee('0x21')](handleEntityNotFound(_0x3f72f7,null))[_0x3bee('0x21')](function(_0x6f0320){if(_0x6f0320){_0xda3a9d[_0x3bee('0x28')]=_0x6f0320[_0x3bee('0x67')]({'plain':!![]});return db[_0x3bee('0x62')][_0x3bee('0x54')]({'where':{'id':_0x6f0320[_0x3bee('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x3f72f7,null))[_0x3bee('0x21')](function(_0x3082f9){if(_0x3082f9){_0xda3a9d['interaction']=_0x3082f9[_0x3bee('0x67')]({'plain':!![]});interaction_log['info'](_0x3bee('0x75'),_0x30dd74[_0x3bee('0x5f')]['id'],_0x30dd74[_0x3bee('0x5f')]['name'],_0x30dd74['user'][_0x3bee('0x69')],_0xda3a9d[_0x3bee('0x66')]['id'],_0x30dd74[_0x3bee('0x56')]?JSON[_0x3bee('0x26')](_0x30dd74[_0x3bee('0x56')]):_0x3bee('0x6a'));return respondWithRpcPromise(_0x3bee('0x76'),_0x3bee('0x77'),_0xda3a9d);}return null;})['then'](function(_0x137e02){if(_0x137e02){_0x137e02[_0x3bee('0x28')][_0x3bee('0x6c')]=util[_0x3bee('0x5c')](_0x3bee('0x6d'),_0x30dd74[_0x3bee('0x5f')][_0x3bee('0x37')]);_0x137e02['message'][_0x3bee('0x6e')]=_0xda3a9d[_0x3bee('0x6e')];_0x137e02['message'][_0x3bee('0x6f')]=_0x3bee('0x72');respondWithRpcPromise('EventManager',_0x3bee('0x70'),{'event':'rejectmessage','message':_0x137e02[_0x3bee('0x28')]},client9002);return _0xda3a9d;}return null;})[_0x3bee('0x21')](respondWithResult(_0x3f72f7,null))[_0x3bee('0x2a')](handleError(_0x3f72f7,null));}; \ No newline at end of file +var _0x38a5=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','keys','intersection','options','body','find','describe','openchannel','read','readAt','format','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','openchannel-interactions','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x151b2a,_0x2b88b8){var _0x5c2c04=function(_0x1786d0){while(--_0x1786d0){_0x151b2a['push'](_0x151b2a['shift']());}};_0x5c2c04(++_0x2b88b8);}(_0x38a5,0x69));var _0x538a=function(_0x1d37f7,_0x4ff671){_0x1d37f7=_0x1d37f7-0x0;var _0x1521de=_0x38a5[_0x1d37f7];return _0x1521de;};'use strict';var pdf=require(_0x538a('0x0'));var emlformat=require(_0x538a('0x1'));var rimraf=require(_0x538a('0x2'));var zipdir=require(_0x538a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x538a('0x4'));var moment=require(_0x538a('0x5'));var BPromise=require(_0x538a('0x6'));var Mustache=require(_0x538a('0x7'));var util=require(_0x538a('0x8'));var path=require(_0x538a('0x9'));var sox=require(_0x538a('0xa'));var csv=require(_0x538a('0xb'));var ejs=require(_0x538a('0xc'));var fs=require('fs');var _=require(_0x538a('0xd'));var squel=require(_0x538a('0xe'));var crypto=require(_0x538a('0xf'));var jsforce=require(_0x538a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x538a('0x11'));var Papa=require(_0x538a('0x12'));var Redis=require(_0x538a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x538a('0x14'));var as=require(_0x538a('0x15'));var hardwareService=require(_0x538a('0x16'));var logger=require(_0x538a('0x17'))(_0x538a('0x18'));var utils=require(_0x538a('0x19'));var config=require(_0x538a('0x1a'));var licenseUtil=require(_0x538a('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x538a('0x1c')](config[_0x538a('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x538a('0x1d')]));require(_0x538a('0x1e'))[_0x538a('0x1f')](socket);var jayson=require(_0x538a('0x20'));var client=jayson[_0x538a('0x21')][_0x538a('0x22')]({'port':0x232c});var client9002=jayson[_0x538a('0x21')][_0x538a('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4c8fe1,_0xe56b7b,_0x29d92e,_0x3e1263){return new BPromise(function(_0x547adf,_0x4c0a3e){var _0x485be0=_0x3e1263||client;return _0x485be0['request'](_0x4c8fe1,_0x29d92e)[_0x538a('0x23')](function(_0x344b64){logger[_0x538a('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xe56b7b,_0x538a('0x25'));logger[_0x538a('0x26')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xe56b7b,_0x538a('0x25'),JSON[_0x538a('0x27')](_0x344b64));if(_0x344b64[_0x538a('0x28')]){if(_0x344b64[_0x538a('0x28')][_0x538a('0x29')]===0x1f4){logger['error'](_0x538a('0x2a'),_0xe56b7b,_0x344b64[_0x538a('0x28')]['message']);return _0x4c0a3e(_0x344b64[_0x538a('0x28')][_0x538a('0x2b')]);}logger[_0x538a('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0xe56b7b,_0x344b64[_0x538a('0x28')]['message']);return _0x547adf(_0x344b64[_0x538a('0x28')]['message']);}else{logger[_0x538a('0x24')](_0x538a('0x2a'),_0xe56b7b,'request\x20sent');_0x547adf(_0x344b64[_0x538a('0x2c')][_0x538a('0x2b')]);}})[_0x538a('0x2d')](function(_0x52824a){logger[_0x538a('0x28')](_0x538a('0x2a'),_0xe56b7b,_0x52824a);_0x4c0a3e(_0x52824a);});});}function respondWithStatusCode(_0x412209,_0x5c7874){_0x5c7874=_0x5c7874||0xcc;return function(_0x4f2188){if(_0x4f2188){return _0x412209[_0x538a('0x2e')](_0x5c7874);}return _0x412209['status'](_0x5c7874)['end']();};}function respondWithResult(_0x5523f9,_0x3ec7d4){_0x3ec7d4=_0x3ec7d4||0xc8;return function(_0x35ef91){if(_0x35ef91){return _0x5523f9[_0x538a('0x2f')](_0x3ec7d4)[_0x538a('0x30')](_0x35ef91);}};}function respondWithFilteredResult(_0x430b46,_0x42068a){return function(_0x4d5ece){if(_0x4d5ece){var _0x55b5c6=_0x4d5ece[_0x538a('0x31')],_0x3cc681=_0x42068a[_0x538a('0x32')],_0x5e6965=_0x42068a['offset']+_0x42068a[_0x538a('0x33')],_0x36a852;if(_0x5e6965>=_0x55b5c6){_0x5e6965=_0x55b5c6;_0x36a852=0xc8;}else{_0x36a852=0xce;}_0x430b46[_0x538a('0x2f')](_0x36a852);return _0x430b46[_0x538a('0x34')](_0x538a('0x35'),_0x3cc681+'-'+_0x5e6965+'/'+_0x55b5c6)[_0x538a('0x30')](_0x4d5ece);}return null;};}function patchUpdates(_0x20f1a0){return function(_0x55d808){try{jsonpatch[_0x538a('0x36')](_0x55d808,_0x20f1a0,!![]);}catch(_0x4b0ef1){return BPromise[_0x538a('0x37')](_0x4b0ef1);}return _0x55d808[_0x538a('0x38')]();};}function saveUpdates(_0x19d9a2,_0x2b36bf){return function(_0x210af5){if(_0x210af5){return _0x210af5[_0x538a('0x39')](_0x19d9a2)['then'](function(_0x5bfae1){return _0x5bfae1;});}return null;};}function removeEntity(_0x5de910,_0x18f72c){return function(_0x146bcf){if(_0x146bcf){return _0x146bcf[_0x538a('0x3a')]()[_0x538a('0x23')](function(){_0x5de910[_0x538a('0x2f')](0xcc)[_0x538a('0x3b')]();});}};}function handleEntityNotFound(_0x240f85,_0x383fb3){return function(_0x385b72){if(!_0x385b72){_0x240f85[_0x538a('0x2e')](0x194);}return _0x385b72;};}function handleError(_0x402c08,_0xe120f9){_0xe120f9=_0xe120f9||0x1f4;return function(_0x283776){logger[_0x538a('0x28')](_0x283776[_0x538a('0x3c')]);if(_0x283776[_0x538a('0x3d')]){delete _0x283776[_0x538a('0x3d')];}_0x402c08['status'](_0xe120f9)[_0x538a('0x3e')](_0x283776);};}exports['index']=function(_0x53205d,_0x462518){var _0x246ab9={},_0x25a3c4={},_0x5029f4={'count':0x0,'rows':[]};var _0x370966=_[_0x538a('0x3f')](db[_0x538a('0x40')][_0x538a('0x41')],function(_0x30aaf0){return{'name':_0x30aaf0[_0x538a('0x42')],'type':_0x30aaf0[_0x538a('0x43')]['key']};});_0x25a3c4[_0x538a('0x44')]=_[_0x538a('0x3f')](_0x370966,_0x538a('0x3d'));_0x25a3c4[_0x538a('0x45')]=_['keys'](_0x53205d[_0x538a('0x45')]);_0x25a3c4[_0x538a('0x46')]=_['intersection'](_0x25a3c4['model'],_0x25a3c4[_0x538a('0x45')]);_0x246ab9[_0x538a('0x47')]=_['intersection'](_0x25a3c4[_0x538a('0x44')],qs[_0x538a('0x48')](_0x53205d[_0x538a('0x45')]['fields']));_0x246ab9['attributes']=_0x246ab9[_0x538a('0x47')][_0x538a('0x49')]?_0x246ab9['attributes']:_0x25a3c4[_0x538a('0x44')];if(!_0x53205d['query'][_0x538a('0x4a')](_0x538a('0x4b'))){_0x246ab9['limit']=qs[_0x538a('0x33')](_0x53205d['query']['limit']);_0x246ab9['offset']=qs[_0x538a('0x32')](_0x53205d[_0x538a('0x45')][_0x538a('0x32')]);}_0x246ab9[_0x538a('0x4c')]=qs['sort'](_0x53205d[_0x538a('0x45')][_0x538a('0x4d')]);_0x246ab9[_0x538a('0x4e')]=qs['filters'](_['pick'](_0x53205d['query'],_0x25a3c4[_0x538a('0x46')]),_0x370966);if(_0x53205d['query'][_0x538a('0x4f')]){_0x246ab9['where']=_[_0x538a('0x50')](_0x246ab9[_0x538a('0x4e')],{'$or':_[_0x538a('0x3f')](_0x370966,function(_0x3e5b12){if(_0x3e5b12[_0x538a('0x43')]!==_0x538a('0x51')){var _0x6ad0b7={};_0x6ad0b7[_0x3e5b12[_0x538a('0x3d')]]={'$like':'%'+_0x53205d['query'][_0x538a('0x4f')]+'%'};return _0x6ad0b7;}})});}_0x246ab9=_[_0x538a('0x50')]({},_0x246ab9,_0x53205d['options']);var _0x4f202b={'where':_0x246ab9[_0x538a('0x4e')]};return db[_0x538a('0x40')]['count'](_0x4f202b)[_0x538a('0x23')](function(_0x3b8e11){_0x5029f4[_0x538a('0x31')]=_0x3b8e11;if(_0x53205d[_0x538a('0x45')][_0x538a('0x52')]){_0x246ab9['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x538a('0x53')](_0x246ab9);})[_0x538a('0x23')](function(_0x4f32d5){_0x5029f4[_0x538a('0x54')]=_0x4f32d5;return _0x5029f4;})[_0x538a('0x23')](respondWithFilteredResult(_0x462518,_0x246ab9))[_0x538a('0x2d')](handleError(_0x462518,null));};exports[_0x538a('0x55')]=function(_0x3b7ff7,_0x88b8ef){var _0x56e8e5={'raw':!![],'where':{'id':_0x3b7ff7[_0x538a('0x56')]['id']}},_0x2657d5={};_0x2657d5[_0x538a('0x44')]=_[_0x538a('0x57')](db['OpenchannelMessage']['rawAttributes']);_0x2657d5[_0x538a('0x45')]=_[_0x538a('0x57')](_0x3b7ff7[_0x538a('0x45')]);_0x2657d5[_0x538a('0x46')]=_['intersection'](_0x2657d5[_0x538a('0x44')],_0x2657d5[_0x538a('0x45')]);_0x56e8e5[_0x538a('0x47')]=_[_0x538a('0x58')](_0x2657d5[_0x538a('0x44')],qs['fields'](_0x3b7ff7[_0x538a('0x45')][_0x538a('0x48')]));_0x56e8e5[_0x538a('0x47')]=_0x56e8e5[_0x538a('0x47')][_0x538a('0x49')]?_0x56e8e5[_0x538a('0x47')]:_0x2657d5['model'];if(_0x3b7ff7[_0x538a('0x45')][_0x538a('0x52')]){_0x56e8e5['include']=[{'all':!![]}];}_0x56e8e5=_['merge']({},_0x56e8e5,_0x3b7ff7[_0x538a('0x59')]);return db[_0x538a('0x40')]['find'](_0x56e8e5)[_0x538a('0x23')](handleEntityNotFound(_0x88b8ef,null))[_0x538a('0x23')](respondWithResult(_0x88b8ef,null))[_0x538a('0x2d')](handleError(_0x88b8ef,null));};exports['create']=function(_0x21470f,_0x4415f8){return db['OpenchannelMessage']['create'](_0x21470f[_0x538a('0x5a')],{})[_0x538a('0x23')](respondWithResult(_0x4415f8,0xc9))[_0x538a('0x2d')](handleError(_0x4415f8,null));};exports[_0x538a('0x39')]=function(_0x199a53,_0x53a93f){if(_0x199a53[_0x538a('0x5a')]['id']){delete _0x199a53[_0x538a('0x5a')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x199a53['params']['id']}})['then'](handleEntityNotFound(_0x53a93f,null))[_0x538a('0x23')](saveUpdates(_0x199a53[_0x538a('0x5a')],null))[_0x538a('0x23')](respondWithResult(_0x53a93f,null))[_0x538a('0x2d')](handleError(_0x53a93f,null));};exports[_0x538a('0x3a')]=function(_0x3b294e,_0x24cc7a){return db[_0x538a('0x40')][_0x538a('0x5b')]({'where':{'id':_0x3b294e[_0x538a('0x56')]['id']}})[_0x538a('0x23')](handleEntityNotFound(_0x24cc7a,null))['then'](removeEntity(_0x24cc7a,null))['catch'](handleError(_0x24cc7a,null));};exports['describe']=function(_0x1ddc48,_0x32111e){return db[_0x538a('0x40')][_0x538a('0x5c')]()[_0x538a('0x23')](respondWithResult(_0x32111e,null))[_0x538a('0x2d')](handleError(_0x32111e,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['accept']=function(_0x2400d2,_0x2f4d21,_0x2e0420){var _0xb7f9fa={'channel':_0x538a('0x5d')};if(_0x2400d2[_0x538a('0x5a')]['id']){delete _0x2400d2['body']['id'];}_0x2400d2[_0x538a('0x5a')][_0x538a('0x5e')]=!![];_0x2400d2[_0x538a('0x5a')][_0x538a('0x5f')]=moment()[_0x538a('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x2400d2[_0x538a('0x5a')]['UserId']=_0x2400d2[_0x538a('0x5a')][_0x538a('0x61')]||_0x2400d2[_0x538a('0x62')]['id'];return db[_0x538a('0x40')]['find']({'where':{'id':_0x2400d2[_0x538a('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x538a('0x63')}]})['then'](handleEntityNotFound(_0x2f4d21,null))[_0x538a('0x23')](saveUpdates(_0x2400d2['body'],null))['then'](function(_0x2b1550){if(_0x2b1550){_0xb7f9fa['message']=_0x2b1550[_0x538a('0x64')]({'plain':!![]});return db[_0x538a('0x65')][_0x538a('0x5b')]({'where':{'id':_0x2b1550[_0x538a('0x66')]}});}return null;})[_0x538a('0x23')](handleEntityNotFound(_0x2f4d21,null))[_0x538a('0x23')](function(_0x40a652){if(_0x40a652){return _0x40a652[_0x538a('0x39')]({'UserId':_0x2400d2[_0x538a('0x5a')]['UserId'],'read1stAt':_[_0x538a('0x67')](_0x40a652[_0x538a('0x68')])?moment()['format'](_0x538a('0x69')):undefined});}return null;})[_0x538a('0x23')](function(_0x328bcf){if(_0x328bcf){_0xb7f9fa[_0x538a('0x6a')]=_0x328bcf[_0x538a('0x64')]({'plain':!![]});interaction_log[_0x538a('0x24')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2400d2[_0x538a('0x62')]['id'],_0x2400d2['user'][_0x538a('0x3d')],_0x2400d2[_0x538a('0x62')]['role'],_0xb7f9fa[_0x538a('0x6a')]['id'],_0x2400d2['body']?JSON[_0x538a('0x27')](_0x2400d2['body']):_0x538a('0x6b'));return respondWithRpcPromise(_0x538a('0x6c'),_0x538a('0x6d'),_0xb7f9fa);}return null;})['then'](function(_0x36115f){if(_0x36115f){if(_0x2400d2[_0x538a('0x5a')][_0x538a('0x6e')]){_0xb7f9fa[_0x538a('0x2b')]['interface']=util[_0x538a('0x60')]('SIP/%s',_0x2400d2[_0x538a('0x62')]['name']);_0xb7f9fa[_0x538a('0x2b')][_0x538a('0x6f')]=_0xb7f9fa['channel'];_0xb7f9fa[_0x538a('0x2b')][_0x538a('0x70')]='accept';return respondWithRpcPromise(_0x538a('0x71'),_0x538a('0x71'),{'event':'acceptmessage','message':_0xb7f9fa[_0x538a('0x2b')]},client9002)['then'](function(){return _0xb7f9fa;});}return _0xb7f9fa;}return null;})[_0x538a('0x23')](respondWithResult(_0x2f4d21,null))[_0x538a('0x2d')](handleError(_0x2f4d21,null));};var interaction_log=require(_0x538a('0x17'))(_0x538a('0x72'));exports['reject']=function(_0xcb3771,_0x20491f,_0x1a5c8f){var _0x4854e6={'agent':{},'channel':_0x538a('0x5d')};if(_0xcb3771['body']['id']){delete _0xcb3771['body']['id'];}_0xcb3771[_0x538a('0x5a')]['UserId']=_0xcb3771[_0x538a('0x5a')][_0x538a('0x61')]||_0xcb3771['user']['id'];_0x4854e6[_0x538a('0x73')]['id']=_0xcb3771['body'][_0x538a('0x61')];return db[_0x538a('0x40')][_0x538a('0x5b')]({'where':{'id':_0xcb3771[_0x538a('0x56')]['id'],'UserId':null}})[_0x538a('0x23')](handleEntityNotFound(_0x20491f,null))['then'](function(_0x3a2a79){if(_0x3a2a79){_0x4854e6[_0x538a('0x2b')]=_0x3a2a79[_0x538a('0x64')]({'plain':!![]});return db[_0x538a('0x65')][_0x538a('0x5b')]({'where':{'id':_0x3a2a79[_0x538a('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x20491f,null))[_0x538a('0x23')](function(_0x161680){if(_0x161680){_0x4854e6[_0x538a('0x6a')]=_0x161680[_0x538a('0x64')]({'plain':!![]});interaction_log[_0x538a('0x24')](_0x538a('0x74'),_0xcb3771[_0x538a('0x62')]['id'],_0xcb3771[_0x538a('0x62')][_0x538a('0x3d')],_0xcb3771['user'][_0x538a('0x75')],_0x4854e6['interaction']['id'],_0xcb3771[_0x538a('0x5a')]?JSON[_0x538a('0x27')](_0xcb3771[_0x538a('0x5a')]):_0x538a('0x6b'));return respondWithRpcPromise(_0x538a('0x76'),'rejectMessage',_0x4854e6);}return null;})[_0x538a('0x23')](function(_0x41bdab){if(_0x41bdab){_0x41bdab['message']['interface']=util['format'](_0x538a('0x77'),_0xcb3771['user']['name']);_0x41bdab[_0x538a('0x2b')][_0x538a('0x6f')]=_0x4854e6[_0x538a('0x6f')];_0x41bdab[_0x538a('0x2b')][_0x538a('0x70')]=_0x538a('0x37');respondWithRpcPromise(_0x538a('0x71'),_0x538a('0x71'),{'event':_0x538a('0x78'),'message':_0x41bdab['message']},client9002);return _0x4854e6;}return null;})['then'](respondWithResult(_0x20491f,null))[_0x538a('0x2d')](handleError(_0x20491f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0edccf0..255ca41 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9998=['remove','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x50c0de,_0x502f29){var _0x151a3d=function(_0x3cdeee){while(--_0x3cdeee){_0x50c0de['push'](_0x50c0de['shift']());}};_0x151a3d(++_0x502f29);}(_0x9998,0x1d8));var _0x8999=function(_0x4e75a2,_0x72fd){_0x4e75a2=_0x4e75a2-0x0;var _0x1bb201=_0x9998[_0x4e75a2];return _0x1bb201;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8999('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8999('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8999('0x2')};function emitEvent(_0x3616b2){return function(_0xed18bd,_0x58db05,_0x3095e0){OpenchannelMessageEvents['emit'](_0x3616b2+':'+_0xed18bd['id'],_0xed18bd);OpenchannelMessageEvents['emit'](_0x3616b2,_0xed18bd);_0x3095e0(null);};}for(var e in events){if(events[_0x8999('0x3')](e)){var event=events[e];OpenchannelMessage[_0x8999('0x4')](e,emitEvent(event));}}module[_0x8999('0x5')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xf57c=['exports','events','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x52cc94,_0xeff2c2){var _0x281529=function(_0x4171e7){while(--_0x4171e7){_0x52cc94['push'](_0x52cc94['shift']());}};_0x281529(++_0xeff2c2);}(_0xf57c,0xe8));var _0xcf57=function(_0x485277,_0x58702a){_0x485277=_0x485277-0x0;var _0xf553c5=_0xf57c[_0x485277];return _0xf553c5;};'use strict';var EventEmitter=require(_0xcf57('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcf57('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcf57('0x2')};function emitEvent(_0x15bf7e){return function(_0xef8b5b,_0x491075,_0x165f3e){OpenchannelMessageEvents[_0xcf57('0x3')](_0x15bf7e+':'+_0xef8b5b['id'],_0xef8b5b);OpenchannelMessageEvents[_0xcf57('0x3')](_0x15bf7e,_0xef8b5b);_0x165f3e(null);};}for(var e in events){if(events[_0xcf57('0x4')](e)){var event=events[e];OpenchannelMessage[_0xcf57('0x5')](e,emitEvent(event));}}module[_0xcf57('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 5279b68..746a8cf 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b76=['Interactions','Contact','keys','afterCreate','format','replyUri','POST','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','catch','error','CmContact','describe','OpenchannelAccount','find'];(function(_0x452fde,_0x339a5f){var _0x36ecee=function(_0x830839){while(--_0x830839){_0x452fde['push'](_0x452fde['shift']());}};_0x36ecee(++_0x339a5f);}(_0x8b76,0xa1));var _0x68b7=function(_0x2bd438,_0x4ff57c){_0x2bd438=_0x2bd438-0x0;var _0x45b09e=_0x8b76[_0x2bd438];return _0x45b09e;};'use strict';var _=require(_0x68b7('0x0'));var util=require(_0x68b7('0x1'));var logger=require(_0x68b7('0x2'))(_0x68b7('0x3'));var moment=require(_0x68b7('0x4'));var BPromise=require(_0x68b7('0x5'));var rp=require(_0x68b7('0x6'));var fs=require('fs');var path=require(_0x68b7('0x7'));var rimraf=require(_0x68b7('0x8'));var config=require(_0x68b7('0x9'));var attributes=require(_0x68b7('0xa'));module[_0x68b7('0xb')]=function(_0x3d2fbd,_0x47d654){return _0x3d2fbd[_0x68b7('0xc')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x68b7('0xd'),'fields':[_0x68b7('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7a3c82,_0x35d9d7,_0x3dc41c){var _0xc44625=_0x3d2fbd[_0x68b7('0xf')];var _0x335dd5=_0x7a3c82[_0x68b7('0x10')]({'plain':!![]});if(_0x335dd5[_0x68b7('0x11')][_0x68b7('0x12')]()==='in'||_0x335dd5['direction'][_0x68b7('0x12')]()===_0x68b7('0x13')&&!_0x335dd5[_0x68b7('0x14')]&&!_['isNil'](_0x335dd5[_0x68b7('0x15')])){_0xc44625[_0x68b7('0x16')]['findOne']({'where':{'id':_0x335dd5[_0x68b7('0x17')]}})[_0x68b7('0x18')](function(_0x1401c0){if(_0x1401c0){_0x1401c0['update']({'lastMsgAt':_0x335dd5['createdAt'],'lastMsgDirection':_0x335dd5[_0x68b7('0x11')][_0x68b7('0x12')]()});}})[_0x68b7('0x19')](function(_0x5c9435){console[_0x68b7('0x1a')](_0x5c9435);});}if(_0x335dd5['direction']===_0x68b7('0x13')&&!_0x335dd5[_0x68b7('0x14')]){var _0x3f9d1d;_0xc44625[_0x68b7('0x1b')][_0x68b7('0x1c')]()['then'](function(_0x416d50){return _0xc44625[_0x68b7('0x1d')][_0x68b7('0x1e')]({'where':{'id':_0x335dd5['OpenchannelAccountId']},'include':[{'model':_0xc44625[_0x68b7('0x16')],'as':_0x68b7('0x1f'),'where':{'id':_0x335dd5['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xc44625[_0x68b7('0x1b')],'as':_0x68b7('0x20'),'attributes':_[_0x68b7('0x21')](_0x416d50)}]}]});})[_0x68b7('0x18')](function(_0x596700){_0x3f9d1d=_0x596700[_0x68b7('0x10')]({'plain':!![]});if(_0x3f9d1d&&_0x3f9d1d['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x68b7('0x22'),util[_0x68b7('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x335dd5['id'],_0x3f9d1d[_0x68b7('0x24')]));if(_0x3f9d1d[_0x68b7('0x1f')]&&_0x3f9d1d[_0x68b7('0x1f')]['length']){_0x335dd5['Interaction']=_['omit'](_0x3f9d1d[_0x68b7('0x1f')][0x0],_0x68b7('0x20'));_0x335dd5['Contact']=_0x3f9d1d[_0x68b7('0x1f')][0x0]['Contact'];}var _0x35d9d7={'method':_0x68b7('0x25'),'uri':encodeURI(_0x3f9d1d[_0x68b7('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x35d9d7['method']){case'GET':_0x35d9d7['qs']=_0x335dd5;break;case _0x68b7('0x25'):_0x35d9d7['body']=_0x335dd5;break;}return rp(_0x35d9d7)[_0x68b7('0x18')](function(_0x895a5f){logger[_0x68b7('0x26')](_0x68b7('0x27'),_0x68b7('0x22'),util[_0x68b7('0x23')](_0x68b7('0x28'),_0x335dd5['id'],_0x3f9d1d[_0x68b7('0x24')]));if(_0x895a5f['body']['threadId']&&_0x895a5f[_0x68b7('0xe')][_0x68b7('0x29')]!=_0x335dd5[_0x68b7('0x2a')]['threadId']){return _0xc44625[_0x68b7('0x16')][_0x68b7('0x2b')]({'threadId':_0x895a5f[_0x68b7('0xe')]['threadId']},{'logging':!![],'where':{'id':_0x335dd5[_0x68b7('0x2a')]['id']}});}else{return;}})[_0x68b7('0x18')](function(){return _0x7a3c82['update']({'read':!![]});})['catch'](function(_0x2705c8){logger[_0x68b7('0x1a')](_0x68b7('0x27'),_0x68b7('0x22'),util[_0x68b7('0x2c')](_0x2705c8,{'showHidden':![],'depth':null}));_0x3dc41c();});}else{_0x3dc41c();}})[_0x68b7('0x2d')](function(){_0x3dc41c();});}else{_0x3dc41c();}}},'charset':_0x68b7('0x2e'),'collate':_0x68b7('0x2f')});}; \ No newline at end of file +var _0x16bd=['omit','Contact','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4_unicode_ci','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x16bd,0x1a8));var _0xd16b=function(_0x36a469,_0x59d84c){_0x36a469=_0x36a469-0x0;var _0x3347fc=_0x16bd[_0x36a469];return _0x3347fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd16b('0x0'));var moment=require('moment');var BPromise=require(_0xd16b('0x1'));var rp=require(_0xd16b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd16b('0x3'));var config=require(_0xd16b('0x4'));var attributes=require(_0xd16b('0x5'));module[_0xd16b('0x6')]=function(_0x3d6dd9,_0x36f533){return _0x3d6dd9['define'](_0xd16b('0x7'),attributes,{'tableName':_0xd16b('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xd16b('0x9')],'type':_0xd16b('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x490d31,_0xb1b898,_0x499f8e){var _0x49d5a6=_0x3d6dd9['models'];var _0x3f3731=_0x490d31[_0xd16b('0xb')]({'plain':!![]});if(_0x3f3731['direction'][_0xd16b('0xc')]()==='in'||_0x3f3731[_0xd16b('0xd')][_0xd16b('0xc')]()==='out'&&!_0x3f3731[_0xd16b('0xe')]&&!_[_0xd16b('0xf')](_0x3f3731['UserId'])){_0x49d5a6[_0xd16b('0x10')][_0xd16b('0x11')]({'where':{'id':_0x3f3731[_0xd16b('0x12')]}})[_0xd16b('0x13')](function(_0x253dde){if(_0x253dde){_0x253dde[_0xd16b('0x14')]({'lastMsgAt':_0x3f3731['createdAt'],'lastMsgDirection':_0x3f3731['direction']['toLowerCase']()});}})[_0xd16b('0x15')](function(_0x3e0c90){console[_0xd16b('0x16')](_0x3e0c90);});}if(_0x3f3731[_0xd16b('0xd')]===_0xd16b('0x17')&&!_0x3f3731[_0xd16b('0xe')]){var _0x471424;_0x49d5a6[_0xd16b('0x18')][_0xd16b('0x19')]()[_0xd16b('0x13')](function(_0x1f2ec5){return _0x49d5a6[_0xd16b('0x1a')][_0xd16b('0x1b')]({'where':{'id':_0x3f3731[_0xd16b('0x1c')]},'include':[{'model':_0x49d5a6[_0xd16b('0x10')],'as':_0xd16b('0x1d'),'where':{'id':_0x3f3731['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x49d5a6[_0xd16b('0x18')],'as':'Contact','attributes':_[_0xd16b('0x1e')](_0x1f2ec5)}]}]});})[_0xd16b('0x13')](function(_0x28d1f6){_0x471424=_0x28d1f6[_0xd16b('0xb')]({'plain':!![]});if(_0x471424&&_0x471424[_0xd16b('0x1f')]){logger[_0xd16b('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0xd16b('0x21'),util[_0xd16b('0x22')](_0xd16b('0x23'),_0x3f3731['id'],_0x471424[_0xd16b('0x1f')]));if(_0x471424[_0xd16b('0x1d')]&&_0x471424[_0xd16b('0x1d')]['length']){_0x3f3731['Interaction']=_[_0xd16b('0x24')](_0x471424[_0xd16b('0x1d')][0x0],_0xd16b('0x25'));_0x3f3731['Contact']=_0x471424[_0xd16b('0x1d')][0x0][_0xd16b('0x25')];}var _0xb1b898={'method':'POST','uri':encodeURI(_0x471424['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xb1b898['method']){case _0xd16b('0x26'):_0xb1b898['qs']=_0x3f3731;break;case'POST':_0xb1b898[_0xd16b('0x9')]=_0x3f3731;break;}return rp(_0xb1b898)[_0xd16b('0x13')](function(_0x25c94b){logger[_0xd16b('0x20')](_0xd16b('0x27'),'afterCreate',util[_0xd16b('0x22')](_0xd16b('0x28'),_0x3f3731['id'],_0x471424[_0xd16b('0x1f')]));if(_0x25c94b[_0xd16b('0x9')][_0xd16b('0x29')]&&_0x25c94b['body'][_0xd16b('0x29')]!=_0x3f3731[_0xd16b('0x2a')]['threadId']){return _0x49d5a6[_0xd16b('0x10')]['update']({'threadId':_0x25c94b[_0xd16b('0x9')][_0xd16b('0x29')]},{'logging':!![],'where':{'id':_0x3f3731[_0xd16b('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x490d31[_0xd16b('0x14')]({'read':!![]});})[_0xd16b('0x15')](function(_0x484ad1){logger[_0xd16b('0x16')](_0xd16b('0x27'),_0xd16b('0x21'),util[_0xd16b('0x2b')](_0x484ad1,{'showHidden':![],'depth':null}));_0x499f8e();});}else{_0x499f8e();}})[_0xd16b('0x2c')](function(){_0x499f8e();});}else{_0x499f8e();}}},'charset':'utf8mb4','collate':_0xd16b('0x2d')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6c82423..d63c161 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x41adc0,_0x1c2734){var _0x1fa929=function(_0x194661){while(--_0x194661){_0x41adc0['push'](_0x41adc0['shift']());}};_0x1fa929(++_0x1c2734);}(_0xb10b,0x12a));var _0xbb10=function(_0x49554d,_0x2f57a8){_0x49554d=_0x49554d-0x0;var _0x2ead18=_0xb10b[_0x49554d];return _0x2ead18;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x516565,_0x17b691){var _0x3ced91=function(_0x10dc80){while(--_0x10dc80){_0x516565['push'](_0x516565['shift']());}};_0x3ced91(++_0x17b691);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index bc0edf2..bd8e59f 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x3c9d34,_0x5813e0){var _0x240c15=function(_0x2e4acc){while(--_0x2e4acc){_0x3c9d34['push'](_0x3c9d34['shift']());}};_0x240c15(++_0x5813e0);}(_0xaa88,0x137));var _0x8aa8=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xaa88[_0x39d39d];return _0x577ac3;};'use strict';var OpenchannelMessageEvents=require(_0x8aa8('0x0'));var events=[_0x8aa8('0x1'),_0x8aa8('0x2'),_0x8aa8('0x3')];function createListener(_0x4aee38,_0x4ba9dd){return function(_0x3a5b12){_0x4ba9dd[_0x8aa8('0x4')](_0x4aee38,_0x3a5b12);};}function removeListener(_0x3b2c88,_0x3e3b70){return function(){OpenchannelMessageEvents[_0x8aa8('0x5')](_0x3b2c88,_0x3e3b70);};}exports['register']=function(_0x5bda0d){for(var _0x460042=0x0,_0x5264ff=events[_0x8aa8('0x6')];_0x460042<_0x5264ff;_0x460042++){var _0x1ed84d=events[_0x460042];var _0x27c08d=createListener(_0x8aa8('0x7')+_0x1ed84d,_0x5bda0d);OpenchannelMessageEvents['on'](_0x1ed84d,_0x27c08d);}}; \ No newline at end of file +var _0x9bde=['openchannelMessage:','save','update','emit','removeListener','register','length'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x99b64,_0x2d3c2f){_0x99b64=_0x99b64-0x0;var _0x4d8eee=_0x9bde[_0x99b64];return _0x4d8eee;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelMessageEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelMessageEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6cc7540..725ceb3 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4af9=['destroy','removeTeams','removeAgents','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update','delete'];(function(_0x10bc4b,_0x400589){var _0x25e298=function(_0xf69786){while(--_0xf69786){_0x10bc4b['push'](_0x10bc4b['shift']());}};_0x25e298(++_0x400589);}(_0x4af9,0x12c));var _0x94af=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4af9[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x94af('0x0'));var util=require(_0x94af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94af('0x2'));var router=express[_0x94af('0x3')]();var auth=require(_0x94af('0x4'));var interaction=require(_0x94af('0x5'));var config=require(_0x94af('0x6'));var controller=require(_0x94af('0x7'));router[_0x94af('0x8')]('/',auth['isAuthenticated'](),controller[_0x94af('0x9')]);router[_0x94af('0x8')](_0x94af('0xa'),auth[_0x94af('0xb')](),controller['describe']);router[_0x94af('0x8')](_0x94af('0xc'),auth[_0x94af('0xb')](),controller['show']);router['get'](_0x94af('0xd'),auth[_0x94af('0xb')](),controller[_0x94af('0xe')]);router[_0x94af('0x8')](_0x94af('0xf'),auth[_0x94af('0xb')](),controller['getTeams']);router[_0x94af('0x8')](_0x94af('0x10'),auth['isAuthenticated'](),controller[_0x94af('0x11')]);router[_0x94af('0x12')]('/',auth[_0x94af('0xb')](),controller[_0x94af('0x13')]);router[_0x94af('0x12')]('/:id/teams',auth[_0x94af('0xb')](),controller['addTeams']);router['post']('/:id/users',auth[_0x94af('0xb')](),controller[_0x94af('0x14')]);router[_0x94af('0x15')](_0x94af('0xc'),auth['isAuthenticated'](),controller[_0x94af('0x16')]);router[_0x94af('0x17')]('/:id',auth[_0x94af('0xb')](),controller[_0x94af('0x18')]);router[_0x94af('0x17')](_0x94af('0xf'),auth[_0x94af('0xb')](),controller[_0x94af('0x19')]);router[_0x94af('0x17')](_0x94af('0x10'),auth[_0x94af('0xb')](),controller[_0x94af('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x9c63=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getTeams','/:id/users','getAgents','create','post','/:id/teams','addAgents','put','update','delete','destroy','removeTeams','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9c63,0x1a7));var _0x39c6=function(_0xc63ce3,_0xbe2d8c){_0xc63ce3=_0xc63ce3-0x0;var _0x4b3f31=_0x9c63[_0xc63ce3];return _0x4b3f31;};'use strict';var multer=require(_0x39c6('0x0'));var util=require(_0x39c6('0x1'));var path=require(_0x39c6('0x2'));var timeout=require(_0x39c6('0x3'));var express=require(_0x39c6('0x4'));var router=express['Router']();var auth=require(_0x39c6('0x5'));var interaction=require(_0x39c6('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x39c6('0x7')]('/',auth[_0x39c6('0x8')](),controller[_0x39c6('0x9')]);router[_0x39c6('0x7')](_0x39c6('0xa'),auth[_0x39c6('0x8')](),controller['describe']);router[_0x39c6('0x7')](_0x39c6('0xb'),auth[_0x39c6('0x8')](),controller[_0x39c6('0xc')]);router[_0x39c6('0x7')]('/:id/members',auth[_0x39c6('0x8')](),controller['getMembers']);router[_0x39c6('0x7')]('/:id/teams',auth[_0x39c6('0x8')](),controller[_0x39c6('0xd')]);router[_0x39c6('0x7')](_0x39c6('0xe'),auth['isAuthenticated'](),controller[_0x39c6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x39c6('0x10')]);router[_0x39c6('0x11')](_0x39c6('0x12'),auth[_0x39c6('0x8')](),controller['addTeams']);router[_0x39c6('0x11')]('/:id/users',auth[_0x39c6('0x8')](),controller[_0x39c6('0x13')]);router[_0x39c6('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x39c6('0x15')]);router[_0x39c6('0x16')]('/:id',auth[_0x39c6('0x8')](),controller[_0x39c6('0x17')]);router[_0x39c6('0x16')](_0x39c6('0x12'),auth[_0x39c6('0x8')](),controller[_0x39c6('0x18')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index fdf8faf..0a20a50 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe585=['sequelize','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x107ad4,_0xab04b2){var _0x24b7e3=function(_0x24a42a){while(--_0x24a42a){_0x107ad4['push'](_0x107ad4['shift']());}};_0x24b7e3(++_0xab04b2);}(_0xe585,0x9a));var _0x5e58=function(_0x27d753,_0x4eb01b){_0x27d753=_0x27d753-0x0;var _0x4cb3b8=_0xe585[_0x27d753];return _0x4cb3b8;};'use strict';var Sequelize=require(_0x5e58('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e58('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e58('0x1')]},'timeout':{'type':Sequelize[_0x5e58('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5e58('0x3')](_0x5e58('0x4'),_0x5e58('0x5'),_0x5e58('0x6'))}}; \ No newline at end of file +var _0x932a=['sequelize','exports','STRING','name','ENUM','beepall'];(function(_0x1ccb95,_0x1b3be8){var _0x1a9725=function(_0x1a6bf7){while(--_0x1a6bf7){_0x1ccb95['push'](_0x1ccb95['shift']());}};_0x1a9725(++_0x1b3be8);}(_0x932a,0x96));var _0xa932=function(_0x958fff,_0x468916){_0x958fff=_0x958fff-0x0;var _0x54a665=_0x932a[_0x958fff];return _0x54a665;};'use strict';var Sequelize=require(_0xa932('0x0'));module[_0xa932('0x1')]={'name':{'type':Sequelize[_0xa932('0x2')],'unique':_0xa932('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa932('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa932('0x4')]('rrmemory',_0xa932('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8bf87ce..3c46744 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b92=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','openchannelPause','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','select','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','ids','omit','spread','emit','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','get','OpenchannelQueues','UserProfileResource','name','send','index','map','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','OpenchannelQueue','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId'];(function(_0x459369,_0x371c3c){var _0x12a0f0=function(_0x69149f){while(--_0x69149f){_0x459369['push'](_0x459369['shift']());}};_0x12a0f0(++_0x371c3c);}(_0x8b92,0xc2));var _0x28b9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b92[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x28b9('0x0'));var emlformat=require(_0x28b9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x28b9('0x2'));var jsonpatch=require(_0x28b9('0x3'));var rp=require(_0x28b9('0x4'));var moment=require('moment');var BPromise=require(_0x28b9('0x5'));var Mustache=require(_0x28b9('0x6'));var util=require(_0x28b9('0x7'));var path=require(_0x28b9('0x8'));var sox=require(_0x28b9('0x9'));var csv=require('to-csv');var ejs=require(_0x28b9('0xa'));var fs=require('fs');var _=require(_0x28b9('0xb'));var squel=require(_0x28b9('0xc'));var crypto=require(_0x28b9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x28b9('0xe'));var querystring=require(_0x28b9('0xf'));var Papa=require(_0x28b9('0x10'));var Redis=require(_0x28b9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x28b9('0x12'));var utils=require(_0x28b9('0x13'));var config=require(_0x28b9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x28b9('0x15'))['db'];config[_0x28b9('0x16')]=_[_0x28b9('0x17')](config[_0x28b9('0x16')],{'host':_0x28b9('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28b9('0x16')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x39033e,_0x28bee9){_0x28bee9=_0x28bee9||0xcc;return function(_0xe2814b){if(_0xe2814b){return _0x39033e[_0x28b9('0x19')](_0x28bee9);}return _0x39033e['status'](_0x28bee9)[_0x28b9('0x1a')]();};}function respondWithResult(_0x5e79fc,_0x4a0b3e){_0x4a0b3e=_0x4a0b3e||0xc8;return function(_0xf96775){if(_0xf96775){return _0x5e79fc[_0x28b9('0x1b')](_0x4a0b3e)[_0x28b9('0x1c')](_0xf96775);}};}function respondWithFilteredResult(_0x38d5d2,_0x1e6fff){return function(_0x373485){if(_0x373485){var _0xf76b1b=_0x373485[_0x28b9('0x1d')],_0x1b42a4=_0x1e6fff[_0x28b9('0x1e')],_0x2dc999=_0x1e6fff[_0x28b9('0x1e')]+_0x1e6fff[_0x28b9('0x1f')],_0x1c06c4;if(_0x2dc999>=_0xf76b1b){_0x2dc999=_0xf76b1b;_0x1c06c4=0xc8;}else{_0x1c06c4=0xce;}_0x38d5d2[_0x28b9('0x1b')](_0x1c06c4);return _0x38d5d2['set'](_0x28b9('0x20'),_0x1b42a4+'-'+_0x2dc999+'/'+_0xf76b1b)[_0x28b9('0x1c')](_0x373485);}return null;};}function patchUpdates(_0x5ddb4b){return function(_0x38a0a4){try{jsonpatch[_0x28b9('0x21')](_0x38a0a4,_0x5ddb4b,!![]);}catch(_0x5c029e){return BPromise[_0x28b9('0x22')](_0x5c029e);}return _0x38a0a4[_0x28b9('0x23')]();};}function saveUpdates(_0x517fc9,_0x4dbbad){return function(_0x27a424){if(_0x27a424){return _0x27a424['update'](_0x517fc9)['then'](function(_0x539506){return _0x539506;});}return null;};}function removeEntity(_0x151d79,_0x53105c){return function(_0x33ed20){if(_0x33ed20){return _0x33ed20[_0x28b9('0x24')]()[_0x28b9('0x25')](function(){var _0x1dbf72=_0x33ed20[_0x28b9('0x26')]({'plain':!![]});var _0x304d68=_0x28b9('0x27');return db[_0x28b9('0x28')][_0x28b9('0x24')]({'where':{'type':_0x304d68,'resourceId':_0x1dbf72['id']}})[_0x28b9('0x25')](function(){return _0x33ed20;});})['then'](function(){_0x151d79['status'](0xcc)[_0x28b9('0x1a')]();});}};}function handleEntityNotFound(_0x199d1c,_0x52ee57){return function(_0x1a9c5b){if(!_0x1a9c5b){_0x199d1c[_0x28b9('0x19')](0x194);}return _0x1a9c5b;};}function handleError(_0x2f6fff,_0x22555e){_0x22555e=_0x22555e||0x1f4;return function(_0x33723b){logger['error'](_0x33723b['stack']);if(_0x33723b[_0x28b9('0x29')]){delete _0x33723b[_0x28b9('0x29')];}_0x2f6fff[_0x28b9('0x1b')](_0x22555e)[_0x28b9('0x2a')](_0x33723b);};}exports[_0x28b9('0x2b')]=function(_0x6723d2,_0x4c1f70){var _0x2ca769={},_0x3d7786={},_0x5407ee={'count':0x0,'rows':[]};var _0x35b001=_[_0x28b9('0x2c')](db['OpenchannelQueue']['rawAttributes'],function(_0x38407d){return{'name':_0x38407d[_0x28b9('0x2d')],'type':_0x38407d[_0x28b9('0x2e')]['key']};});_0x3d7786[_0x28b9('0x2f')]=_['map'](_0x35b001,'name');_0x3d7786['query']=_[_0x28b9('0x30')](_0x6723d2['query']);_0x3d7786['filters']=_['intersection'](_0x3d7786[_0x28b9('0x2f')],_0x3d7786[_0x28b9('0x31')]);_0x2ca769['attributes']=_[_0x28b9('0x32')](_0x3d7786[_0x28b9('0x2f')],qs[_0x28b9('0x33')](_0x6723d2[_0x28b9('0x31')][_0x28b9('0x33')]));_0x2ca769[_0x28b9('0x34')]=_0x2ca769[_0x28b9('0x34')][_0x28b9('0x35')]?_0x2ca769['attributes']:_0x3d7786[_0x28b9('0x2f')];if(!_0x6723d2[_0x28b9('0x31')][_0x28b9('0x36')](_0x28b9('0x37'))){_0x2ca769[_0x28b9('0x1f')]=qs[_0x28b9('0x1f')](_0x6723d2[_0x28b9('0x31')][_0x28b9('0x1f')]);_0x2ca769[_0x28b9('0x1e')]=qs[_0x28b9('0x1e')](_0x6723d2['query'][_0x28b9('0x1e')]);}_0x2ca769[_0x28b9('0x38')]=qs[_0x28b9('0x39')](_0x6723d2[_0x28b9('0x31')][_0x28b9('0x39')]);_0x2ca769[_0x28b9('0x3a')]=qs['filters'](_['pick'](_0x6723d2[_0x28b9('0x31')],_0x3d7786[_0x28b9('0x3b')]),_0x35b001);if(_0x6723d2['query'][_0x28b9('0x3c')]){_0x2ca769[_0x28b9('0x3a')]=_[_0x28b9('0x3d')](_0x2ca769[_0x28b9('0x3a')],{'$or':_['map'](_0x35b001,function(_0x20afaa){if(_0x20afaa['type']!==_0x28b9('0x3e')){var _0x5b6ec0={};_0x5b6ec0[_0x20afaa['name']]={'$like':'%'+_0x6723d2[_0x28b9('0x31')]['filter']+'%'};return _0x5b6ec0;}})});}_0x2ca769=_[_0x28b9('0x3d')]({},_0x2ca769,_0x6723d2[_0x28b9('0x3f')]);var _0x406c17={'where':_0x2ca769[_0x28b9('0x3a')]};return db[_0x28b9('0x40')][_0x28b9('0x1d')](_0x406c17)[_0x28b9('0x25')](function(_0x5309f4){_0x5407ee[_0x28b9('0x1d')]=_0x5309f4;if(_0x6723d2[_0x28b9('0x31')][_0x28b9('0x41')]){_0x2ca769[_0x28b9('0x42')]=[{'all':!![]}];}return db[_0x28b9('0x40')][_0x28b9('0x43')](_0x2ca769);})[_0x28b9('0x25')](function(_0x177cf4){_0x5407ee[_0x28b9('0x44')]=_0x177cf4;return _0x5407ee;})[_0x28b9('0x25')](respondWithFilteredResult(_0x4c1f70,_0x2ca769))['catch'](handleError(_0x4c1f70,null));};exports[_0x28b9('0x45')]=function(_0x25f7b4,_0x183d13){var _0x8ea90a={'raw':!![],'where':{'id':_0x25f7b4[_0x28b9('0x46')]['id']}},_0x2f0307={};_0x2f0307['model']=_['keys'](db[_0x28b9('0x40')][_0x28b9('0x47')]);_0x2f0307[_0x28b9('0x31')]=_[_0x28b9('0x30')](_0x25f7b4[_0x28b9('0x31')]);_0x2f0307[_0x28b9('0x3b')]=_['intersection'](_0x2f0307['model'],_0x2f0307[_0x28b9('0x31')]);_0x8ea90a[_0x28b9('0x34')]=_[_0x28b9('0x32')](_0x2f0307[_0x28b9('0x2f')],qs[_0x28b9('0x33')](_0x25f7b4['query'][_0x28b9('0x33')]));_0x8ea90a[_0x28b9('0x34')]=_0x8ea90a[_0x28b9('0x34')]['length']?_0x8ea90a[_0x28b9('0x34')]:_0x2f0307[_0x28b9('0x2f')];if(_0x25f7b4[_0x28b9('0x31')][_0x28b9('0x41')]){_0x8ea90a['include']=[{'all':!![]}];}_0x8ea90a=_['merge']({},_0x8ea90a,_0x25f7b4['options']);return db[_0x28b9('0x40')][_0x28b9('0x48')](_0x8ea90a)['then'](handleEntityNotFound(_0x183d13,null))[_0x28b9('0x25')](respondWithResult(_0x183d13,null))[_0x28b9('0x49')](handleError(_0x183d13,null));};exports[_0x28b9('0x4a')]=function(_0x23a774,_0x33160f){return db[_0x28b9('0x40')][_0x28b9('0x4a')](_0x23a774[_0x28b9('0x4b')],{})[_0x28b9('0x25')](function(_0x59ff8a){var _0x2741c5=_0x23a774['user'][_0x28b9('0x26')]({'plain':!![]});if(!_0x2741c5)throw new Error(_0x28b9('0x4c'));if(_0x2741c5['role']===_0x28b9('0x4d')){var _0x5586ff=_0x59ff8a[_0x28b9('0x26')]({'plain':!![]});var _0x364907=_0x28b9('0x27');return db[_0x28b9('0x4e')][_0x28b9('0x48')]({'where':{'name':_0x364907,'userProfileId':_0x2741c5[_0x28b9('0x4f')]},'raw':!![]})['then'](function(_0x49261d){if(_0x49261d&&_0x49261d[_0x28b9('0x50')]===0x0){return db[_0x28b9('0x28')][_0x28b9('0x4a')]({'name':_0x5586ff[_0x28b9('0x29')],'resourceId':_0x5586ff['id'],'type':_0x49261d['name'],'sectionId':_0x49261d['id']},{})[_0x28b9('0x25')](function(){return _0x59ff8a;});}else{return _0x59ff8a;}})['catch'](function(_0x5ccf09){logger[_0x28b9('0x51')](_0x28b9('0x52'),_0x5ccf09);throw _0x5ccf09;});}return _0x59ff8a;})[_0x28b9('0x25')](respondWithResult(_0x33160f,0xc9))[_0x28b9('0x49')](handleError(_0x33160f,null));};exports[_0x28b9('0x53')]=function(_0x4ab5fa,_0x33012f){if(_0x4ab5fa[_0x28b9('0x4b')]['id']){delete _0x4ab5fa[_0x28b9('0x4b')]['id'];}return db[_0x28b9('0x40')][_0x28b9('0x48')]({'where':{'id':_0x4ab5fa[_0x28b9('0x46')]['id']}})[_0x28b9('0x25')](handleEntityNotFound(_0x33012f,null))[_0x28b9('0x25')](saveUpdates(_0x4ab5fa[_0x28b9('0x4b')],null))['then'](respondWithResult(_0x33012f,null))[_0x28b9('0x49')](handleError(_0x33012f,null));};exports[_0x28b9('0x24')]=function(_0x3ca43b,_0x1d5248){return db[_0x28b9('0x40')][_0x28b9('0x48')]({'where':{'id':_0x3ca43b[_0x28b9('0x46')]['id']}})[_0x28b9('0x25')](handleEntityNotFound(_0x1d5248,null))['then'](removeEntity(_0x1d5248,null))[_0x28b9('0x49')](handleError(_0x1d5248,null));};exports['describe']=function(_0x190545,_0x13791c){return db[_0x28b9('0x40')][_0x28b9('0x54')]()[_0x28b9('0x25')](respondWithResult(_0x13791c,null))['catch'](handleError(_0x13791c,null));};exports['getMembers']=function(_0xed26fc,_0x503958,_0x153215){var _0x3245ea={'raw':!![],'where':{}},_0x17a958={},_0x39d504;return db[_0x28b9('0x40')][_0x28b9('0x55')]({'where':{'id':_0xed26fc[_0x28b9('0x46')]['id']}})['then'](handleEntityNotFound(_0x503958,null))[_0x28b9('0x25')](function(_0xa1d598){if(_0xa1d598){_0x39d504=_0xa1d598[_0x28b9('0x26')]({'plain':!![]});_0x17a958['model']=_['keys'](db[_0x28b9('0x56')][_0x28b9('0x47')]);_0x17a958[_0x28b9('0x31')]=_[_0x28b9('0x30')](_0xed26fc['query']);_0x17a958[_0x28b9('0x3b')]=_[_0x28b9('0x32')](_0x17a958[_0x28b9('0x2f')],_0x17a958[_0x28b9('0x31')]);_0x3245ea[_0x28b9('0x34')]=_[_0x28b9('0x32')](_0x17a958[_0x28b9('0x2f')],qs[_0x28b9('0x33')](_0xed26fc[_0x28b9('0x31')][_0x28b9('0x33')]));_0x3245ea[_0x28b9('0x34')]=_0x3245ea['attributes'][_0x28b9('0x35')]?_0x3245ea[_0x28b9('0x34')]:_0x17a958['model'];if(!_0xed26fc[_0x28b9('0x31')]['hasOwnProperty']('nolimit')){_0x3245ea['limit']=qs[_0x28b9('0x1f')](_0xed26fc[_0x28b9('0x31')][_0x28b9('0x1f')]);_0x3245ea[_0x28b9('0x1e')]=qs[_0x28b9('0x1e')](_0xed26fc[_0x28b9('0x31')][_0x28b9('0x1e')]);}_0x3245ea[_0x28b9('0x38')]=qs[_0x28b9('0x39')](_0xed26fc[_0x28b9('0x31')][_0x28b9('0x39')]);_0x3245ea[_0x28b9('0x3a')]=qs['filters'](_[_0x28b9('0x57')](_0xed26fc[_0x28b9('0x31')],_0x17a958[_0x28b9('0x3b')]));_0x3245ea['where'][_0x28b9('0x58')]=_0xa1d598['id'];if(_0xed26fc['query'][_0x28b9('0x3c')]){_0x3245ea[_0x28b9('0x3a')]=_['merge'](_0x3245ea[_0x28b9('0x3a')],{'$or':_[_0x28b9('0x2c')](_0x3245ea[_0x28b9('0x34')],function(_0x5b022e){var _0x17393a={};_0x17393a[_0x5b022e]={'$like':'%'+_0xed26fc[_0x28b9('0x31')][_0x28b9('0x3c')]+'%'};return _0x17393a;})});}_0x3245ea=_[_0x28b9('0x3d')]({},_0x3245ea,_0xed26fc['options']);return db[_0x28b9('0x56')]['findAll'](_0x3245ea);}})[_0x28b9('0x25')](function(_0x394632){if(_0x394632){return db[_0x28b9('0x59')][_0x28b9('0x5a')]({'where':{'id':_['map'](_0x394632,_0x28b9('0x5b')),'role':_0x28b9('0x5c')},'attributes':['id','name','openchannelPause',_0x28b9('0x5d'),_0x28b9('0x5e')]});}})[_0x28b9('0x25')](function(_0x48f2b6){if(_0x48f2b6){return{'count':_0x48f2b6[_0x28b9('0x1d')],'rows':_[_0x28b9('0x2c')](_0x48f2b6[_0x28b9('0x44')],function(_0x480082){return{'membername':_0x480082[_0x28b9('0x29')],'UserId':_0x480082['id'],'queue_name':_0x39d504[_0x28b9('0x29')],'OpenchannelQueueId':_0x39d504['id'],'interface':util[_0x28b9('0x5f')](_0x28b9('0x60'),'SIP',_0x480082[_0x28b9('0x29')]),'penalty':0x0,'paused':_0x480082[_0x28b9('0x61')],'createdAt':_0x480082[_0x28b9('0x5e')],'updatedAt':_0x480082[_0x28b9('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x28b9('0x25')](respondWithFilteredResult(_0x503958,_0x3245ea))[_0x28b9('0x49')](handleError(_0x503958,null));};exports[_0x28b9('0x62')]=function(_0x2138e,_0x514bb4,_0x4dd68e){var _0x37f6c5={};var _0x236465={};var _0x388f37;var _0x434260;return db[_0x28b9('0x40')][_0x28b9('0x55')]({'where':{'id':_0x2138e[_0x28b9('0x46')]['id']}})['then'](handleEntityNotFound(_0x514bb4,null))[_0x28b9('0x25')](function(_0xc70c1){if(_0xc70c1){_0x388f37=_0xc70c1;_0x236465[_0x28b9('0x2f')]=_['keys'](db['Team']['rawAttributes']);_0x236465[_0x28b9('0x31')]=_[_0x28b9('0x30')](_0x2138e[_0x28b9('0x31')]);_0x236465[_0x28b9('0x3b')]=_[_0x28b9('0x32')](_0x236465[_0x28b9('0x2f')],_0x236465[_0x28b9('0x31')]);_0x37f6c5[_0x28b9('0x34')]=_[_0x28b9('0x32')](_0x236465[_0x28b9('0x2f')],qs[_0x28b9('0x33')](_0x2138e[_0x28b9('0x31')][_0x28b9('0x33')]));_0x37f6c5['attributes']=_0x37f6c5['attributes'][_0x28b9('0x35')]?_0x37f6c5[_0x28b9('0x34')]:_0x236465['model'];_0x37f6c5[_0x28b9('0x38')]=qs['sort'](_0x2138e['query'][_0x28b9('0x39')]);_0x37f6c5['where']=qs[_0x28b9('0x3b')](_[_0x28b9('0x57')](_0x2138e[_0x28b9('0x31')],_0x236465['filters']));if(_0x2138e[_0x28b9('0x31')][_0x28b9('0x3c')]){_0x37f6c5[_0x28b9('0x3a')]=_[_0x28b9('0x3d')](_0x37f6c5[_0x28b9('0x3a')],{'$or':_[_0x28b9('0x2c')](_0x37f6c5[_0x28b9('0x34')],function(_0x333616){var _0x577a0e={};_0x577a0e[_0x333616]={'$like':'%'+_0x2138e[_0x28b9('0x31')]['filter']+'%'};return _0x577a0e;})});}_0x37f6c5=_[_0x28b9('0x3d')]({},_0x37f6c5,_0x2138e[_0x28b9('0x3f')]);return _0x388f37[_0x28b9('0x62')](_0x37f6c5);}})[_0x28b9('0x25')](function(_0x2fef71){if(_0x2fef71){_0x434260=_0x2fef71['length'];if(!_0x2138e[_0x28b9('0x31')][_0x28b9('0x36')]('nolimit')){_0x37f6c5[_0x28b9('0x1f')]=qs[_0x28b9('0x1f')](_0x2138e[_0x28b9('0x31')]['limit']);_0x37f6c5['offset']=qs[_0x28b9('0x1e')](_0x2138e['query'][_0x28b9('0x1e')]);}return _0x388f37[_0x28b9('0x62')](_0x37f6c5);}})[_0x28b9('0x25')](function(_0x440e55){if(_0x440e55){return _0x440e55?{'count':_0x434260,'rows':_0x440e55}:null;}})[_0x28b9('0x25')](respondWithResult(_0x514bb4,null))[_0x28b9('0x49')](handleError(_0x514bb4,null));};exports[_0x28b9('0x63')]=function(_0x4f3127,_0x548fb9,_0x7d8287){var _0x147886=_0x4f3127['body']['ids'];return db[_0x28b9('0x64')][_0x28b9('0x43')]({'where':{'id':_0x147886},'attributes':['id'],'include':[{'model':db['User'],'as':_0x28b9('0x65'),'attributes':['id','name',_0x28b9('0x66'),_0x28b9('0x67'),_0x28b9('0x68')],'raw':!![]}]})[_0x28b9('0x25')](function(_0x15aeb9){if(_0x15aeb9){var _0x354c0f=_[_0x28b9('0x69')](_0x15aeb9,function(_0x48eede){var _0x1f3762=_0x48eede['get']({'plain':!![]});return _0x1f3762[_0x28b9('0x65')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x4f3127[_0x28b9('0x46')]['id']}})[_0x28b9('0x25')](function(_0x5572e1){return db[_0x28b9('0x6a')][_0x28b9('0x6b')](function(_0x3c0e1e){return _0x5572e1[_0x28b9('0x63')](_0x147886,{'transaction':_0x3c0e1e})[_0x28b9('0x25')](function(){return BPromise[_0x28b9('0x6c')](_0x354c0f,function(_0x50341d){return db[_0x28b9('0x56')][_0x28b9('0x6d')]({'where':{'UserId':_0x50341d['id'],'OpenchannelQueueId':_0x4f3127['params']['id']},'transaction':_0x3c0e1e});});})[_0x28b9('0x25')](function(){_0x354c0f[_0x28b9('0x6e')](function(_0x268aa5){socket['emit'](_0x28b9('0x6f'),{'UserId':_0x268aa5['id'],'OpenchannelQueueId':_0x5572e1['id']});});});});});}})[_0x28b9('0x25')](respondWithStatusCode(_0x548fb9,null))[_0x28b9('0x49')](handleError(_0x548fb9,null));};exports['removeTeams']=function(_0x206fcb,_0x10db7a,_0x2ba925){return db[_0x28b9('0x64')]['findAll']({'where':{'id':_0x206fcb['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x28b9('0x59')],'as':_0x28b9('0x65'),'attributes':['id'],'raw':!![]}]})[_0x28b9('0x25')](handleEntityNotFound(_0x10db7a,null))['then'](function(_0x39d2b6){var _0x129824=_[_0x28b9('0x2c')](_0x39d2b6,'id');var _0x3bf7e1=[];var _0xe94994=[];var _0x983ab6=squel[_0x28b9('0x70')]();_0x983ab6['field'](_0x28b9('0x71'))['from'](_0x28b9('0x72'),'tq')[_0x28b9('0x73')]('user_has_teams','ut',_0x28b9('0x74'))['where']('OpenchannelQueueId\x20=\x20?',_0x206fcb['params']['id']);for(var _0x1d230f=0x0;_0x1d230f<_0x39d2b6[_0x28b9('0x35')];_0x1d230f+=0x1){let _0xc7a281=_0x39d2b6[_0x1d230f];for(var _0x5c0bff=0x0;_0x5c0bff<_0xc7a281[_0x28b9('0x65')][_0x28b9('0x35')];_0x5c0bff+=0x1){let _0x195c96=_0xc7a281[_0x28b9('0x65')][_0x5c0bff];var _0x297453=_0x983ab6[_0x28b9('0x75')]();_0x297453[_0x28b9('0x3a')](_0x28b9('0x76'),_0x195c96['id']);_0xe94994[_0x28b9('0x77')](db[_0x28b9('0x6a')]['query'](_0x297453[_0x28b9('0x78')](),{'type':db[_0x28b9('0x6a')][_0x28b9('0x79')][_0x28b9('0x7a')]})[_0x28b9('0x25')](function(_0x4963b8){if(_0x4963b8[_0x28b9('0x35')]===0x1){return _0x195c96['id'];}else{var _0x537052=_[_0x28b9('0x7b')](_[_0x28b9('0x2c')](_0x4963b8,_0x28b9('0x7c')),function(_0x474439){return _[_0x28b9('0x7d')](_0x129824,_0x474439);});if(_0x537052){return _0x195c96['id'];}}}));}}return BPromise['all'](_0xe94994)['then'](function(_0x40d2fb){_0x3bf7e1=_(_0x3bf7e1)['union'](_0x40d2fb)[_0x28b9('0x7e')]()['value']();return db[_0x28b9('0x40')][_0x28b9('0x48')]({'where':{'id':_0x206fcb[_0x28b9('0x46')]['id']}})[_0x28b9('0x25')](function(_0x5bd145){return db[_0x28b9('0x6a')][_0x28b9('0x6b')](function(_0x23e38b){return _0x5bd145[_0x28b9('0x7f')](_0x206fcb['query']['ids'],{'transaction':_0x23e38b})['then'](function(){if(!_[_0x28b9('0x80')](_0x3bf7e1)){return _0x5bd145[_0x28b9('0x81')](_0x3bf7e1,{'transaction':_0x23e38b});}})['then'](function(){_0x3bf7e1[_0x28b9('0x6e')](function(_0x299ea6){socket['emit'](_0x28b9('0x82'),{'UserId':_0x299ea6,'OpenchannelQueueId':_0x5bd145['id']});});});});});});})['then'](respondWithStatusCode(_0x10db7a,null))[_0x28b9('0x49')](handleError(_0x10db7a,null));};exports[_0x28b9('0x83')]=function(_0x43ac14,_0x1f1f0f,_0x5f17b8){return db[_0x28b9('0x40')]['find']({'where':{'id':_0x43ac14[_0x28b9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f1f0f,null))[_0x28b9('0x25')](function(_0x44f836){if(_0x44f836){return _0x44f836[_0x28b9('0x83')](_0x43ac14['body'][_0x28b9('0x84')],_[_0x28b9('0x85')](_0x43ac14[_0x28b9('0x4b')],['ids','id'])||{})[_0x28b9('0x86')](function(_0x466a74){for(var _0x2c5314=0x0;_0x2c5314<_0x43ac14[_0x28b9('0x4b')][_0x28b9('0x84')][_0x28b9('0x35')];_0x2c5314+=0x1){socket[_0x28b9('0x87')]('userOpenchannelQueue:save',{'UserId':_0x43ac14[_0x28b9('0x4b')]['ids'][_0x2c5314],'OpenchannelQueueId':_0x43ac14[_0x28b9('0x46')]['id']});}return _0x466a74;});}})[_0x28b9('0x25')](respondWithResult(_0x1f1f0f,null))['catch'](handleError(_0x1f1f0f,null));};exports[_0x28b9('0x81')]=function(_0x54b1f4,_0x3c4b6f,_0x3a3ca5){return db['OpenchannelQueue']['find']({'where':{'id':_0x54b1f4[_0x28b9('0x46')]['id']}})[_0x28b9('0x25')](handleEntityNotFound(_0x3c4b6f,null))[_0x28b9('0x25')](function(_0x299cb9){if(_0x299cb9){return _0x299cb9[_0x28b9('0x81')](_0x54b1f4[_0x28b9('0x31')][_0x28b9('0x84')])[_0x28b9('0x25')](function(){if(_['isArray'](_0x54b1f4[_0x28b9('0x31')]['ids'])){for(var _0xcc1b7a=0x0;_0xcc1b7a<_0x54b1f4[_0x28b9('0x31')][_0x28b9('0x84')][_0x28b9('0x35')];_0xcc1b7a+=0x1){socket[_0x28b9('0x87')](_0x28b9('0x82'),{'UserId':Number(_0x54b1f4[_0x28b9('0x31')]['ids'][_0xcc1b7a]),'OpenchannelQueueId':Number(_0x54b1f4[_0x28b9('0x46')]['id'])});}}else{socket[_0x28b9('0x87')](_0x28b9('0x82'),{'UserId':Number(_0x54b1f4[_0x28b9('0x31')][_0x28b9('0x84')]),'OpenchannelQueueId':Number(_0x54b1f4[_0x28b9('0x46')]['id'])});}});}})[_0x28b9('0x25')](respondWithStatusCode(_0x3c4b6f,null))[_0x28b9('0x49')](handleError(_0x3c4b6f,null));};exports['getAgents']=function(_0x297f5a,_0x4ad730,_0x39037a){var _0x3367e2={};var _0x1f1721={};var _0x10e512;var _0x1a27f0;return db[_0x28b9('0x40')][_0x28b9('0x55')]({'where':{'id':_0x297f5a[_0x28b9('0x46')]['id']}})[_0x28b9('0x25')](handleEntityNotFound(_0x4ad730,null))[_0x28b9('0x25')](function(_0x2a33e2){if(_0x2a33e2){_0x10e512=_0x2a33e2;_0x1f1721[_0x28b9('0x2f')]=_[_0x28b9('0x30')](db[_0x28b9('0x59')][_0x28b9('0x47')]);_0x1f1721[_0x28b9('0x31')]=_['keys'](_0x297f5a[_0x28b9('0x31')]);_0x1f1721[_0x28b9('0x3b')]=_[_0x28b9('0x32')](_0x1f1721[_0x28b9('0x2f')],_0x1f1721['query']);_0x3367e2[_0x28b9('0x34')]=_['intersection'](_0x1f1721[_0x28b9('0x2f')],qs[_0x28b9('0x33')](_0x297f5a[_0x28b9('0x31')][_0x28b9('0x33')]));_0x3367e2[_0x28b9('0x34')]=_0x3367e2[_0x28b9('0x34')][_0x28b9('0x35')]?_0x3367e2[_0x28b9('0x34')]:_0x1f1721['model'];_0x3367e2[_0x28b9('0x38')]=qs['sort'](_0x297f5a[_0x28b9('0x31')]['sort']);_0x3367e2[_0x28b9('0x3a')]=qs[_0x28b9('0x3b')](_[_0x28b9('0x57')](_0x297f5a[_0x28b9('0x31')],_0x1f1721[_0x28b9('0x3b')]));if(_0x297f5a[_0x28b9('0x31')][_0x28b9('0x3c')]){_0x3367e2[_0x28b9('0x3a')]=_[_0x28b9('0x3d')](_0x3367e2[_0x28b9('0x3a')],{'$or':_['map'](_0x3367e2[_0x28b9('0x34')],function(_0x46eb09){var _0x1843ed={};_0x1843ed[_0x46eb09]={'$like':'%'+_0x297f5a[_0x28b9('0x31')][_0x28b9('0x3c')]+'%'};return _0x1843ed;})});}_0x3367e2=_[_0x28b9('0x3d')]({},_0x3367e2,_0x297f5a['options']);return _0x10e512[_0x28b9('0x88')](_0x3367e2);}})['then'](function(_0x247c85){if(_0x247c85){_0x1a27f0=_0x247c85[_0x28b9('0x35')];if(!_0x297f5a[_0x28b9('0x31')][_0x28b9('0x36')](_0x28b9('0x37'))){_0x3367e2[_0x28b9('0x1f')]=qs['limit'](_0x297f5a['query'][_0x28b9('0x1f')]);_0x3367e2[_0x28b9('0x1e')]=qs[_0x28b9('0x1e')](_0x297f5a['query'][_0x28b9('0x1e')]);}return _0x10e512[_0x28b9('0x88')](_0x3367e2);}})[_0x28b9('0x25')](function(_0x1d1304){if(_0x1d1304){return _0x1d1304?{'count':_0x1a27f0,'rows':_0x1d1304}:null;}})[_0x28b9('0x25')](respondWithResult(_0x4ad730,null))[_0x28b9('0x49')](handleError(_0x4ad730,null));}; \ No newline at end of file +var _0xc2e5=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','OpenchannelQueues','UserProfileResource','end','error','name','send','map','OpenchannelQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','User','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','tq.TeamId','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','getAgents','html-pdf'];(function(_0xfe3d61,_0x158867){var _0x29132f=function(_0x48999c){while(--_0x48999c){_0xfe3d61['push'](_0xfe3d61['shift']());}};_0x29132f(++_0x158867);}(_0xc2e5,0x87));var _0x5c2e=function(_0x117417,_0x214c67){_0x117417=_0x117417-0x0;var _0x5ba86d=_0xc2e5[_0x117417];return _0x5ba86d;};'use strict';var pdf=require(_0x5c2e('0x0'));var emlformat=require(_0x5c2e('0x1'));var rimraf=require(_0x5c2e('0x2'));var zipdir=require(_0x5c2e('0x3'));var jsonpatch=require(_0x5c2e('0x4'));var rp=require('request-promise');var moment=require(_0x5c2e('0x5'));var BPromise=require(_0x5c2e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5c2e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c2e('0x8'));var fs=require('fs');var _=require(_0x5c2e('0x9'));var squel=require(_0x5c2e('0xa'));var crypto=require(_0x5c2e('0xb'));var jsforce=require(_0x5c2e('0xc'));var deskjs=require(_0x5c2e('0xd'));var toCsv=require(_0x5c2e('0xe'));var querystring=require(_0x5c2e('0xf'));var Papa=require(_0x5c2e('0x10'));var Redis=require(_0x5c2e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5c2e('0x12'));var as=require(_0x5c2e('0x13'));var hardwareService=require(_0x5c2e('0x14'));var logger=require(_0x5c2e('0x15'))(_0x5c2e('0x16'));var utils=require(_0x5c2e('0x17'));var config=require(_0x5c2e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c2e('0x19'))['db'];config[_0x5c2e('0x1a')]=_['defaults'](config['redis'],{'host':_0x5c2e('0x1b'),'port':0x18eb});var socket=require(_0x5c2e('0x1c'))(new Redis(config[_0x5c2e('0x1a')]));require(_0x5c2e('0x1d'))[_0x5c2e('0x1e')](socket);function respondWithStatusCode(_0x15e616,_0x1c791e){_0x1c791e=_0x1c791e||0xcc;return function(_0x1893a5){if(_0x1893a5){return _0x15e616[_0x5c2e('0x1f')](_0x1c791e);}return _0x15e616[_0x5c2e('0x20')](_0x1c791e)['end']();};}function respondWithResult(_0x42b3cd,_0x46e47d){_0x46e47d=_0x46e47d||0xc8;return function(_0x4b04d7){if(_0x4b04d7){return _0x42b3cd['status'](_0x46e47d)[_0x5c2e('0x21')](_0x4b04d7);}};}function respondWithFilteredResult(_0x5463fd,_0x7f0cad){return function(_0x1b1f67){if(_0x1b1f67){var _0x5237e3=_0x1b1f67[_0x5c2e('0x22')],_0x3f4d44=_0x7f0cad['offset'],_0x1aafdc=_0x7f0cad[_0x5c2e('0x23')]+_0x7f0cad[_0x5c2e('0x24')],_0x11e7f0;if(_0x1aafdc>=_0x5237e3){_0x1aafdc=_0x5237e3;_0x11e7f0=0xc8;}else{_0x11e7f0=0xce;}_0x5463fd[_0x5c2e('0x20')](_0x11e7f0);return _0x5463fd[_0x5c2e('0x25')](_0x5c2e('0x26'),_0x3f4d44+'-'+_0x1aafdc+'/'+_0x5237e3)[_0x5c2e('0x21')](_0x1b1f67);}return null;};}function patchUpdates(_0x5205ae){return function(_0x588df1){try{jsonpatch[_0x5c2e('0x27')](_0x588df1,_0x5205ae,!![]);}catch(_0x4ec069){return BPromise[_0x5c2e('0x28')](_0x4ec069);}return _0x588df1['save']();};}function saveUpdates(_0x509c48,_0x569321){return function(_0x1e52a3){if(_0x1e52a3){return _0x1e52a3[_0x5c2e('0x29')](_0x509c48)[_0x5c2e('0x2a')](function(_0x1660f3){return _0x1660f3;});}return null;};}function removeEntity(_0x5f051d,_0x819453){return function(_0x24b09f){if(_0x24b09f){return _0x24b09f[_0x5c2e('0x2b')]()[_0x5c2e('0x2a')](function(){var _0x317e3e=_0x24b09f['get']({'plain':!![]});var _0x35a56b=_0x5c2e('0x2c');return db[_0x5c2e('0x2d')]['destroy']({'where':{'type':_0x35a56b,'resourceId':_0x317e3e['id']}})[_0x5c2e('0x2a')](function(){return _0x24b09f;});})['then'](function(){_0x5f051d[_0x5c2e('0x20')](0xcc)[_0x5c2e('0x2e')]();});}};}function handleEntityNotFound(_0x28aa56,_0x214926){return function(_0x518af3){if(!_0x518af3){_0x28aa56[_0x5c2e('0x1f')](0x194);}return _0x518af3;};}function handleError(_0x37d727,_0x412eb5){_0x412eb5=_0x412eb5||0x1f4;return function(_0x3b3bac){logger[_0x5c2e('0x2f')](_0x3b3bac['stack']);if(_0x3b3bac['name']){delete _0x3b3bac[_0x5c2e('0x30')];}_0x37d727[_0x5c2e('0x20')](_0x412eb5)[_0x5c2e('0x31')](_0x3b3bac);};}exports['index']=function(_0xb245b6,_0x2e5546){var _0x3a2a39={},_0x1efebd={},_0x35ca3f={'count':0x0,'rows':[]};var _0xebf254=_[_0x5c2e('0x32')](db[_0x5c2e('0x33')]['rawAttributes'],function(_0x2519fe){return{'name':_0x2519fe[_0x5c2e('0x34')],'type':_0x2519fe[_0x5c2e('0x35')][_0x5c2e('0x36')]};});_0x1efebd[_0x5c2e('0x37')]=_[_0x5c2e('0x32')](_0xebf254,_0x5c2e('0x30'));_0x1efebd[_0x5c2e('0x38')]=_[_0x5c2e('0x39')](_0xb245b6[_0x5c2e('0x38')]);_0x1efebd[_0x5c2e('0x3a')]=_[_0x5c2e('0x3b')](_0x1efebd[_0x5c2e('0x37')],_0x1efebd[_0x5c2e('0x38')]);_0x3a2a39[_0x5c2e('0x3c')]=_[_0x5c2e('0x3b')](_0x1efebd[_0x5c2e('0x37')],qs['fields'](_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x3d')]));_0x3a2a39[_0x5c2e('0x3c')]=_0x3a2a39['attributes'][_0x5c2e('0x3e')]?_0x3a2a39['attributes']:_0x1efebd[_0x5c2e('0x37')];if(!_0xb245b6['query'][_0x5c2e('0x3f')](_0x5c2e('0x40'))){_0x3a2a39[_0x5c2e('0x24')]=qs[_0x5c2e('0x24')](_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x24')]);_0x3a2a39[_0x5c2e('0x23')]=qs[_0x5c2e('0x23')](_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x23')]);}_0x3a2a39['order']=qs[_0x5c2e('0x41')](_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x41')]);_0x3a2a39[_0x5c2e('0x42')]=qs[_0x5c2e('0x3a')](_[_0x5c2e('0x43')](_0xb245b6[_0x5c2e('0x38')],_0x1efebd[_0x5c2e('0x3a')]),_0xebf254);if(_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x44')]){_0x3a2a39[_0x5c2e('0x42')]=_[_0x5c2e('0x45')](_0x3a2a39[_0x5c2e('0x42')],{'$or':_[_0x5c2e('0x32')](_0xebf254,function(_0x46faa5){if(_0x46faa5[_0x5c2e('0x35')]!==_0x5c2e('0x46')){var _0x249651={};_0x249651[_0x46faa5['name']]={'$like':'%'+_0xb245b6[_0x5c2e('0x38')]['filter']+'%'};return _0x249651;}})});}_0x3a2a39=_[_0x5c2e('0x45')]({},_0x3a2a39,_0xb245b6[_0x5c2e('0x47')]);var _0x39c6be={'where':_0x3a2a39[_0x5c2e('0x42')]};return db[_0x5c2e('0x33')][_0x5c2e('0x22')](_0x39c6be)[_0x5c2e('0x2a')](function(_0x31b28a){_0x35ca3f[_0x5c2e('0x22')]=_0x31b28a;if(_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x48')]){_0x3a2a39[_0x5c2e('0x49')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x5c2e('0x4a')](_0x3a2a39);})[_0x5c2e('0x2a')](function(_0x265c69){_0x35ca3f[_0x5c2e('0x4b')]=_0x265c69;return _0x35ca3f;})[_0x5c2e('0x2a')](respondWithFilteredResult(_0x2e5546,_0x3a2a39))[_0x5c2e('0x4c')](handleError(_0x2e5546,null));};exports[_0x5c2e('0x4d')]=function(_0x49d44b,_0x3db546){var _0x580cc1={'raw':!![],'where':{'id':_0x49d44b[_0x5c2e('0x4e')]['id']}},_0x3df394={};_0x3df394['model']=_[_0x5c2e('0x39')](db['OpenchannelQueue'][_0x5c2e('0x4f')]);_0x3df394['query']=_[_0x5c2e('0x39')](_0x49d44b['query']);_0x3df394[_0x5c2e('0x3a')]=_['intersection'](_0x3df394[_0x5c2e('0x37')],_0x3df394[_0x5c2e('0x38')]);_0x580cc1[_0x5c2e('0x3c')]=_['intersection'](_0x3df394[_0x5c2e('0x37')],qs[_0x5c2e('0x3d')](_0x49d44b[_0x5c2e('0x38')][_0x5c2e('0x3d')]));_0x580cc1['attributes']=_0x580cc1[_0x5c2e('0x3c')][_0x5c2e('0x3e')]?_0x580cc1[_0x5c2e('0x3c')]:_0x3df394['model'];if(_0x49d44b[_0x5c2e('0x38')]['includeAll']){_0x580cc1['include']=[{'all':!![]}];}_0x580cc1=_[_0x5c2e('0x45')]({},_0x580cc1,_0x49d44b[_0x5c2e('0x47')]);return db[_0x5c2e('0x33')]['find'](_0x580cc1)[_0x5c2e('0x2a')](handleEntityNotFound(_0x3db546,null))[_0x5c2e('0x2a')](respondWithResult(_0x3db546,null))['catch'](handleError(_0x3db546,null));};exports[_0x5c2e('0x50')]=function(_0x36157c,_0xaa6061){return db[_0x5c2e('0x33')]['create'](_0x36157c[_0x5c2e('0x51')],{})[_0x5c2e('0x2a')](function(_0x53a385){var _0x62f836=_0x36157c[_0x5c2e('0x52')][_0x5c2e('0x53')]({'plain':!![]});if(!_0x62f836)throw new Error(_0x5c2e('0x54'));if(_0x62f836[_0x5c2e('0x55')]==='user'){var _0x5e27e1=_0x53a385[_0x5c2e('0x53')]({'plain':!![]});var _0xac5da5='OpenchannelQueues';return db[_0x5c2e('0x56')][_0x5c2e('0x57')]({'where':{'name':_0xac5da5,'userProfileId':_0x62f836['userProfileId']},'raw':!![]})[_0x5c2e('0x2a')](function(_0x1fed00){if(_0x1fed00&&_0x1fed00[_0x5c2e('0x58')]===0x0){return db[_0x5c2e('0x2d')][_0x5c2e('0x50')]({'name':_0x5e27e1['name'],'resourceId':_0x5e27e1['id'],'type':_0x1fed00[_0x5c2e('0x30')],'sectionId':_0x1fed00['id']},{})[_0x5c2e('0x2a')](function(){return _0x53a385;});}else{return _0x53a385;}})[_0x5c2e('0x4c')](function(_0x1da7e4){logger[_0x5c2e('0x2f')](_0x5c2e('0x59'),_0x1da7e4);throw _0x1da7e4;});}return _0x53a385;})[_0x5c2e('0x2a')](respondWithResult(_0xaa6061,0xc9))[_0x5c2e('0x4c')](handleError(_0xaa6061,null));};exports[_0x5c2e('0x29')]=function(_0x3cb3c0,_0x9a316b){if(_0x3cb3c0[_0x5c2e('0x51')]['id']){delete _0x3cb3c0[_0x5c2e('0x51')]['id'];}return db['OpenchannelQueue'][_0x5c2e('0x57')]({'where':{'id':_0x3cb3c0[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x9a316b,null))['then'](saveUpdates(_0x3cb3c0['body'],null))['then'](respondWithResult(_0x9a316b,null))[_0x5c2e('0x4c')](handleError(_0x9a316b,null));};exports[_0x5c2e('0x2b')]=function(_0x5fb670,_0x53f300){return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x5fb670[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x53f300,null))[_0x5c2e('0x2a')](removeEntity(_0x53f300,null))['catch'](handleError(_0x53f300,null));};exports['describe']=function(_0x139a7a,_0x4556ae){return db[_0x5c2e('0x33')]['describe']()['then'](respondWithResult(_0x4556ae,null))['catch'](handleError(_0x4556ae,null));};exports[_0x5c2e('0x5a')]=function(_0x365672,_0x123d4f,_0x23901e){var _0x33140b={'raw':!![],'where':{}},_0x59f440={},_0x2a7a31;return db['OpenchannelQueue'][_0x5c2e('0x5b')]({'where':{'id':_0x365672[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x123d4f,null))['then'](function(_0x4e58c9){if(_0x4e58c9){_0x2a7a31=_0x4e58c9[_0x5c2e('0x53')]({'plain':!![]});_0x59f440[_0x5c2e('0x37')]=_['keys'](db[_0x5c2e('0x5c')][_0x5c2e('0x4f')]);_0x59f440[_0x5c2e('0x38')]=_[_0x5c2e('0x39')](_0x365672['query']);_0x59f440['filters']=_[_0x5c2e('0x3b')](_0x59f440[_0x5c2e('0x37')],_0x59f440[_0x5c2e('0x38')]);_0x33140b[_0x5c2e('0x3c')]=_[_0x5c2e('0x3b')](_0x59f440['model'],qs[_0x5c2e('0x3d')](_0x365672['query'][_0x5c2e('0x3d')]));_0x33140b[_0x5c2e('0x3c')]=_0x33140b[_0x5c2e('0x3c')]['length']?_0x33140b[_0x5c2e('0x3c')]:_0x59f440[_0x5c2e('0x37')];if(!_0x365672[_0x5c2e('0x38')][_0x5c2e('0x3f')](_0x5c2e('0x40'))){_0x33140b[_0x5c2e('0x24')]=qs[_0x5c2e('0x24')](_0x365672['query'][_0x5c2e('0x24')]);_0x33140b['offset']=qs[_0x5c2e('0x23')](_0x365672['query'][_0x5c2e('0x23')]);}_0x33140b[_0x5c2e('0x5d')]=qs[_0x5c2e('0x41')](_0x365672[_0x5c2e('0x38')][_0x5c2e('0x41')]);_0x33140b[_0x5c2e('0x42')]=qs[_0x5c2e('0x3a')](_[_0x5c2e('0x43')](_0x365672[_0x5c2e('0x38')],_0x59f440[_0x5c2e('0x3a')]));_0x33140b[_0x5c2e('0x42')][_0x5c2e('0x5e')]=_0x4e58c9['id'];if(_0x365672[_0x5c2e('0x38')][_0x5c2e('0x44')]){_0x33140b[_0x5c2e('0x42')]=_[_0x5c2e('0x45')](_0x33140b[_0x5c2e('0x42')],{'$or':_['map'](_0x33140b[_0x5c2e('0x3c')],function(_0x2ab3dd){var _0x41f23f={};_0x41f23f[_0x2ab3dd]={'$like':'%'+_0x365672['query']['filter']+'%'};return _0x41f23f;})});}_0x33140b=_['merge']({},_0x33140b,_0x365672[_0x5c2e('0x47')]);return db[_0x5c2e('0x5c')][_0x5c2e('0x4a')](_0x33140b);}})[_0x5c2e('0x2a')](function(_0x27b657){if(_0x27b657){return db['User'][_0x5c2e('0x5f')]({'where':{'id':_[_0x5c2e('0x32')](_0x27b657,_0x5c2e('0x60')),'role':'agent'},'attributes':['id',_0x5c2e('0x30'),_0x5c2e('0x61'),_0x5c2e('0x62'),_0x5c2e('0x63')]});}})[_0x5c2e('0x2a')](function(_0x21ab75){if(_0x21ab75){return{'count':_0x21ab75['count'],'rows':_[_0x5c2e('0x32')](_0x21ab75[_0x5c2e('0x4b')],function(_0x50676c){return{'membername':_0x50676c[_0x5c2e('0x30')],'UserId':_0x50676c['id'],'queue_name':_0x2a7a31[_0x5c2e('0x30')],'OpenchannelQueueId':_0x2a7a31['id'],'interface':util['format'](_0x5c2e('0x64'),_0x5c2e('0x65'),_0x50676c[_0x5c2e('0x30')]),'penalty':0x0,'paused':_0x50676c[_0x5c2e('0x61')],'createdAt':_0x50676c[_0x5c2e('0x63')],'updatedAt':_0x50676c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5c2e('0x2a')](respondWithFilteredResult(_0x123d4f,_0x33140b))[_0x5c2e('0x4c')](handleError(_0x123d4f,null));};exports[_0x5c2e('0x66')]=function(_0x97eed3,_0x40977f,_0x5be375){var _0x5f03ea={};var _0x4eab15={};var _0x1688f8;var _0x4a13b8;return db[_0x5c2e('0x33')]['findOne']({'where':{'id':_0x97eed3[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x40977f,null))[_0x5c2e('0x2a')](function(_0x8c8c11){if(_0x8c8c11){_0x1688f8=_0x8c8c11;_0x4eab15['model']=_['keys'](db['Team'][_0x5c2e('0x4f')]);_0x4eab15['query']=_[_0x5c2e('0x39')](_0x97eed3[_0x5c2e('0x38')]);_0x4eab15[_0x5c2e('0x3a')]=_[_0x5c2e('0x3b')](_0x4eab15[_0x5c2e('0x37')],_0x4eab15['query']);_0x5f03ea['attributes']=_[_0x5c2e('0x3b')](_0x4eab15[_0x5c2e('0x37')],qs['fields'](_0x97eed3['query'][_0x5c2e('0x3d')]));_0x5f03ea['attributes']=_0x5f03ea['attributes'][_0x5c2e('0x3e')]?_0x5f03ea[_0x5c2e('0x3c')]:_0x4eab15[_0x5c2e('0x37')];_0x5f03ea[_0x5c2e('0x5d')]=qs[_0x5c2e('0x41')](_0x97eed3['query']['sort']);_0x5f03ea[_0x5c2e('0x42')]=qs[_0x5c2e('0x3a')](_[_0x5c2e('0x43')](_0x97eed3[_0x5c2e('0x38')],_0x4eab15[_0x5c2e('0x3a')]));if(_0x97eed3['query'][_0x5c2e('0x44')]){_0x5f03ea[_0x5c2e('0x42')]=_[_0x5c2e('0x45')](_0x5f03ea[_0x5c2e('0x42')],{'$or':_[_0x5c2e('0x32')](_0x5f03ea['attributes'],function(_0x5480c9){var _0x3e83b8={};_0x3e83b8[_0x5480c9]={'$like':'%'+_0x97eed3[_0x5c2e('0x38')][_0x5c2e('0x44')]+'%'};return _0x3e83b8;})});}_0x5f03ea=_[_0x5c2e('0x45')]({},_0x5f03ea,_0x97eed3['options']);return _0x1688f8[_0x5c2e('0x66')](_0x5f03ea);}})['then'](function(_0x7063fd){if(_0x7063fd){_0x4a13b8=_0x7063fd[_0x5c2e('0x3e')];if(!_0x97eed3['query'][_0x5c2e('0x3f')](_0x5c2e('0x40'))){_0x5f03ea[_0x5c2e('0x24')]=qs[_0x5c2e('0x24')](_0x97eed3[_0x5c2e('0x38')][_0x5c2e('0x24')]);_0x5f03ea['offset']=qs[_0x5c2e('0x23')](_0x97eed3[_0x5c2e('0x38')]['offset']);}return _0x1688f8[_0x5c2e('0x66')](_0x5f03ea);}})[_0x5c2e('0x2a')](function(_0x1a2d8c){if(_0x1a2d8c){return _0x1a2d8c?{'count':_0x4a13b8,'rows':_0x1a2d8c}:null;}})[_0x5c2e('0x2a')](respondWithResult(_0x40977f,null))['catch'](handleError(_0x40977f,null));};exports['addTeams']=function(_0x38b206,_0x5e79cc,_0x378bd3){var _0x4d5bce=_0x38b206[_0x5c2e('0x51')][_0x5c2e('0x67')];return db[_0x5c2e('0x68')][_0x5c2e('0x4a')]({'where':{'id':_0x4d5bce},'attributes':['id'],'include':[{'model':db[_0x5c2e('0x69')],'as':_0x5c2e('0x6a'),'attributes':['id',_0x5c2e('0x30'),'online',_0x5c2e('0x6b'),'interface'],'raw':!![]}]})[_0x5c2e('0x2a')](function(_0x22d75b){if(_0x22d75b){var _0x4353a8=_[_0x5c2e('0x6c')](_0x22d75b,function(_0x5ca037){var _0xc90426=_0x5ca037['get']({'plain':!![]});return _0xc90426['Agents'];});return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x38b206[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](function(_0x15507e){return db[_0x5c2e('0x6d')][_0x5c2e('0x6e')](function(_0x238bb7){return _0x15507e[_0x5c2e('0x6f')](_0x4d5bce,{'transaction':_0x238bb7})['then'](function(){return BPromise[_0x5c2e('0x70')](_0x4353a8,function(_0x2469dd){return db[_0x5c2e('0x5c')][_0x5c2e('0x71')]({'where':{'UserId':_0x2469dd['id'],'OpenchannelQueueId':_0x38b206[_0x5c2e('0x4e')]['id']},'transaction':_0x238bb7});});})['then'](function(){_0x4353a8[_0x5c2e('0x72')](function(_0x15b08f){socket[_0x5c2e('0x73')](_0x5c2e('0x74'),{'UserId':_0x15b08f['id'],'OpenchannelQueueId':_0x15507e['id']});});});});});}})['then'](respondWithStatusCode(_0x5e79cc,null))[_0x5c2e('0x4c')](handleError(_0x5e79cc,null));};exports['removeTeams']=function(_0x43c78d,_0x1f5f87,_0x330225){return db[_0x5c2e('0x68')][_0x5c2e('0x4a')]({'where':{'id':_0x43c78d[_0x5c2e('0x38')][_0x5c2e('0x67')]},'attributes':['id'],'include':[{'model':db[_0x5c2e('0x69')],'as':_0x5c2e('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x5c2e('0x2a')](handleEntityNotFound(_0x1f5f87,null))[_0x5c2e('0x2a')](function(_0x5c4aa5){var _0x53e580=_[_0x5c2e('0x32')](_0x5c4aa5,'id');var _0x4ceaa0=[];var _0x23697e=[];var _0x1c6c7a=squel[_0x5c2e('0x75')]();_0x1c6c7a['field'](_0x5c2e('0x76'))['from']('team_has_openchannel_queues','tq')['join']('user_has_teams','ut',_0x5c2e('0x77'))['where']('OpenchannelQueueId\x20=\x20?',_0x43c78d[_0x5c2e('0x4e')]['id']);for(var _0x49326f=0x0;_0x49326f<_0x5c4aa5[_0x5c2e('0x3e')];_0x49326f+=0x1){let _0x47d2bb=_0x5c4aa5[_0x49326f];for(var _0x589147=0x0;_0x589147<_0x47d2bb[_0x5c2e('0x6a')][_0x5c2e('0x3e')];_0x589147+=0x1){let _0x316fd2=_0x47d2bb[_0x5c2e('0x6a')][_0x589147];var _0x52bde4=_0x1c6c7a[_0x5c2e('0x78')]();_0x52bde4['where'](_0x5c2e('0x79'),_0x316fd2['id']);_0x23697e[_0x5c2e('0x7a')](db[_0x5c2e('0x6d')][_0x5c2e('0x38')](_0x52bde4[_0x5c2e('0x7b')](),{'type':db[_0x5c2e('0x6d')]['QueryTypes'][_0x5c2e('0x7c')]})['then'](function(_0x4f01e1){if(_0x4f01e1[_0x5c2e('0x3e')]===0x1){return _0x316fd2['id'];}else{var _0x3c1105=_[_0x5c2e('0x7d')](_['map'](_0x4f01e1,'TeamId'),function(_0x411189){return _[_0x5c2e('0x7e')](_0x53e580,_0x411189);});if(_0x3c1105){return _0x316fd2['id'];}}}));}}return BPromise[_0x5c2e('0x7f')](_0x23697e)[_0x5c2e('0x2a')](function(_0x32dc4b){_0x4ceaa0=_(_0x4ceaa0)['union'](_0x32dc4b)[_0x5c2e('0x80')]()['value']();return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x43c78d[_0x5c2e('0x4e')]['id']}})['then'](function(_0x5c8f5a){return db[_0x5c2e('0x6d')][_0x5c2e('0x6e')](function(_0x35be58){return _0x5c8f5a[_0x5c2e('0x81')](_0x43c78d[_0x5c2e('0x38')]['ids'],{'transaction':_0x35be58})[_0x5c2e('0x2a')](function(){if(!_[_0x5c2e('0x82')](_0x4ceaa0)){return _0x5c8f5a[_0x5c2e('0x83')](_0x4ceaa0,{'transaction':_0x35be58});}})[_0x5c2e('0x2a')](function(){_0x4ceaa0[_0x5c2e('0x72')](function(_0x4f74b8){socket['emit'](_0x5c2e('0x84'),{'UserId':_0x4f74b8,'OpenchannelQueueId':_0x5c8f5a['id']});});});});});});})[_0x5c2e('0x2a')](respondWithStatusCode(_0x1f5f87,null))[_0x5c2e('0x4c')](handleError(_0x1f5f87,null));};exports[_0x5c2e('0x85')]=function(_0x24063a,_0x2ecc64,_0x411676){return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x24063a[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x2ecc64,null))[_0x5c2e('0x2a')](function(_0x209734){if(_0x209734){return _0x209734['addAgents'](_0x24063a[_0x5c2e('0x51')][_0x5c2e('0x67')],_['omit'](_0x24063a[_0x5c2e('0x51')],[_0x5c2e('0x67'),'id'])||{})[_0x5c2e('0x86')](function(_0x4a432f){for(var _0x48a2b4=0x0;_0x48a2b4<_0x24063a['body']['ids'][_0x5c2e('0x3e')];_0x48a2b4+=0x1){socket[_0x5c2e('0x73')](_0x5c2e('0x74'),{'UserId':_0x24063a['body'][_0x5c2e('0x67')][_0x48a2b4],'OpenchannelQueueId':_0x24063a[_0x5c2e('0x4e')]['id']});}return _0x4a432f;});}})[_0x5c2e('0x2a')](respondWithResult(_0x2ecc64,null))[_0x5c2e('0x4c')](handleError(_0x2ecc64,null));};exports['removeAgents']=function(_0x3cf65b,_0x473ecb,_0x1b091d){return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x3cf65b[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x473ecb,null))['then'](function(_0x2bfb0c){if(_0x2bfb0c){return _0x2bfb0c[_0x5c2e('0x83')](_0x3cf65b[_0x5c2e('0x38')][_0x5c2e('0x67')])[_0x5c2e('0x2a')](function(){if(_['isArray'](_0x3cf65b['query']['ids'])){for(var _0x5a8344=0x0;_0x5a8344<_0x3cf65b[_0x5c2e('0x38')]['ids'][_0x5c2e('0x3e')];_0x5a8344+=0x1){socket[_0x5c2e('0x73')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3cf65b['query']['ids'][_0x5a8344]),'OpenchannelQueueId':Number(_0x3cf65b[_0x5c2e('0x4e')]['id'])});}}else{socket['emit'](_0x5c2e('0x84'),{'UserId':Number(_0x3cf65b[_0x5c2e('0x38')][_0x5c2e('0x67')]),'OpenchannelQueueId':Number(_0x3cf65b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x473ecb,null))[_0x5c2e('0x4c')](handleError(_0x473ecb,null));};exports[_0x5c2e('0x87')]=function(_0x59bd72,_0x8b26ff,_0x44081e){var _0x3f5e5e={};var _0xf948bd={};var _0x2c38b5;var _0x11de1d;return db[_0x5c2e('0x33')][_0x5c2e('0x5b')]({'where':{'id':_0x59bd72[_0x5c2e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8b26ff,null))['then'](function(_0x1dae59){if(_0x1dae59){_0x2c38b5=_0x1dae59;_0xf948bd[_0x5c2e('0x37')]=_[_0x5c2e('0x39')](db[_0x5c2e('0x69')]['rawAttributes']);_0xf948bd[_0x5c2e('0x38')]=_[_0x5c2e('0x39')](_0x59bd72['query']);_0xf948bd['filters']=_[_0x5c2e('0x3b')](_0xf948bd['model'],_0xf948bd[_0x5c2e('0x38')]);_0x3f5e5e[_0x5c2e('0x3c')]=_[_0x5c2e('0x3b')](_0xf948bd[_0x5c2e('0x37')],qs[_0x5c2e('0x3d')](_0x59bd72[_0x5c2e('0x38')][_0x5c2e('0x3d')]));_0x3f5e5e[_0x5c2e('0x3c')]=_0x3f5e5e[_0x5c2e('0x3c')][_0x5c2e('0x3e')]?_0x3f5e5e['attributes']:_0xf948bd['model'];_0x3f5e5e[_0x5c2e('0x5d')]=qs['sort'](_0x59bd72['query']['sort']);_0x3f5e5e[_0x5c2e('0x42')]=qs[_0x5c2e('0x3a')](_[_0x5c2e('0x43')](_0x59bd72['query'],_0xf948bd[_0x5c2e('0x3a')]));if(_0x59bd72[_0x5c2e('0x38')][_0x5c2e('0x44')]){_0x3f5e5e[_0x5c2e('0x42')]=_[_0x5c2e('0x45')](_0x3f5e5e[_0x5c2e('0x42')],{'$or':_['map'](_0x3f5e5e[_0x5c2e('0x3c')],function(_0x27c576){var _0x361198={};_0x361198[_0x27c576]={'$like':'%'+_0x59bd72['query'][_0x5c2e('0x44')]+'%'};return _0x361198;})});}_0x3f5e5e=_[_0x5c2e('0x45')]({},_0x3f5e5e,_0x59bd72['options']);return _0x2c38b5[_0x5c2e('0x87')](_0x3f5e5e);}})[_0x5c2e('0x2a')](function(_0x3a162f){if(_0x3a162f){_0x11de1d=_0x3a162f[_0x5c2e('0x3e')];if(!_0x59bd72['query'][_0x5c2e('0x3f')]('nolimit')){_0x3f5e5e[_0x5c2e('0x24')]=qs[_0x5c2e('0x24')](_0x59bd72[_0x5c2e('0x38')][_0x5c2e('0x24')]);_0x3f5e5e['offset']=qs['offset'](_0x59bd72[_0x5c2e('0x38')][_0x5c2e('0x23')]);}return _0x2c38b5[_0x5c2e('0x87')](_0x3f5e5e);}})[_0x5c2e('0x2a')](function(_0x7c3d88){if(_0x7c3d88){return _0x7c3d88?{'count':_0x11de1d,'rows':_0x7c3d88}:null;}})[_0x5c2e('0x2a')](respondWithResult(_0x8b26ff,null))['catch'](handleError(_0x8b26ff,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 3fa8c83..d5f88ab 100644 --- a/server/api/openchannelQueue/openchannelQueue.events.js +++ b/server/api/openchannelQueue/openchannelQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ba0=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xc52550,_0x53feb1){var _0x30605b=function(_0x2fcdf8){while(--_0x2fcdf8){_0xc52550['push'](_0xc52550['shift']());}};_0x30605b(++_0x53feb1);}(_0x0ba0,0xdf));var _0x00ba=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x0ba0[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x00ba('0x0'));var OpenchannelQueue=require(_0x00ba('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x00ba('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x00ba('0x3'),'afterDestroy':_0x00ba('0x4')};function emitEvent(_0x166b0c){return function(_0x26d908,_0x2c6bda,_0x268b22){OpenchannelQueueEvents[_0x00ba('0x5')](_0x166b0c+':'+_0x26d908['id'],_0x26d908);OpenchannelQueueEvents['emit'](_0x166b0c,_0x26d908);_0x268b22(null);};}for(var e in events){if(events[_0x00ba('0x6')](e)){var event=events[e];OpenchannelQueue[_0x00ba('0x7')](e,emitEvent(event));}}module[_0x00ba('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1c98=['OpenchannelQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x70582f,_0x94c2c){var _0x244a1f=function(_0x1c715c){while(--_0x1c715c){_0x70582f['push'](_0x70582f['shift']());}};_0x244a1f(++_0x94c2c);}(_0x1c98,0x1c9));var _0x81c9=function(_0x4691fc,_0x36dcd3){_0x4691fc=_0x4691fc-0x0;var _0xe54241=_0x1c98[_0x4691fc];return _0xe54241;};'use strict';var EventEmitter=require(_0x81c9('0x0'));var OpenchannelQueue=require(_0x81c9('0x1'))['db'][_0x81c9('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x81c9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x81c9('0x4')};function emitEvent(_0xdccfd9){return function(_0x3ac02e,_0x3c8bfc,_0x44b577){OpenchannelQueueEvents[_0x81c9('0x5')](_0xdccfd9+':'+_0x3ac02e['id'],_0x3ac02e);OpenchannelQueueEvents['emit'](_0xdccfd9,_0x3ac02e);_0x44b577(null);};}for(var e in events){if(events[_0x81c9('0x6')](e)){var event=events[e];OpenchannelQueue[_0x81c9('0x7')](e,emitEvent(event));}}module[_0x81c9('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index d7a74be..abc4491 100644 --- a/server/api/openchannelQueue/openchannelQueue.model.js +++ b/server/api/openchannelQueue/openchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20c3=['moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x20c3,0x1e6));var _0x320c=function(_0x3ecfba,_0x58ec2f){_0x3ecfba=_0x3ecfba-0x0;var _0x272815=_0x20c3[_0x3ecfba];return _0x272815;};'use strict';var _=require(_0x320c('0x0'));var util=require(_0x320c('0x1'));var logger=require(_0x320c('0x2'))(_0x320c('0x3'));var moment=require(_0x320c('0x4'));var BPromise=require('bluebird');var rp=require(_0x320c('0x5'));var fs=require('fs');var path=require(_0x320c('0x6'));var rimraf=require(_0x320c('0x7'));var config=require(_0x320c('0x8'));var attributes=require(_0x320c('0x9'));module[_0x320c('0xa')]=function(_0x343f06,_0x34a987){return _0x343f06[_0x320c('0xb')](_0x320c('0xc'),attributes,{'tableName':_0x320c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2a1=['../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','util','api','moment','bluebird'];(function(_0x52ac03,_0x2d0cdb){var _0x419c19=function(_0x4f6acb){while(--_0x4f6acb){_0x52ac03['push'](_0x52ac03['shift']());}};_0x419c19(++_0x2d0cdb);}(_0xa2a1,0x1b5));var _0x1a2a=function(_0x105ae7,_0x187a6f){_0x105ae7=_0x105ae7-0x0;var _0x1e7641=_0xa2a1[_0x105ae7];return _0x1e7641;};'use strict';var _=require('lodash');var util=require(_0x1a2a('0x0'));var logger=require('../../config/logger')(_0x1a2a('0x1'));var moment=require(_0x1a2a('0x2'));var BPromise=require(_0x1a2a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a2a('0x4'));var attributes=require('./openchannelQueue.attributes');module[_0x1a2a('0x5')]=function(_0x498096,_0x82d075){return _0x498096[_0x1a2a('0x6')](_0x1a2a('0x7'),attributes,{'tableName':_0x1a2a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index ce51521..d78bd18 100644 --- a/server/api/openchannelQueue/openchannelQueue.rpc.js +++ b/server/api/openchannelQueue/openchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb65=['raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options'];(function(_0x287368,_0x336def){var _0x4a39b9=function(_0x67a96a){while(--_0x67a96a){_0x287368['push'](_0x287368['shift']());}};_0x4a39b9(++_0x336def);}(_0xcb65,0xe0));var _0x5cb6=function(_0x3bb21a,_0x353b56){_0x3bb21a=_0x3bb21a-0x0;var _0x5f3983=_0xcb65[_0x3bb21a];return _0x5f3983;};'use strict';var _=require(_0x5cb6('0x0'));var util=require(_0x5cb6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5cb6('0x2'));var fs=require('fs');var Redis=require(_0x5cb6('0x3'));var db=require(_0x5cb6('0x4'))['db'];var utils=require(_0x5cb6('0x5'));var logger=require(_0x5cb6('0x6'))('rpc');var config=require(_0x5cb6('0x7'));var jayson=require(_0x5cb6('0x8'));var client=jayson[_0x5cb6('0x9')][_0x5cb6('0xa')]({'port':0x232a});config['redis']=_[_0x5cb6('0xb')](config[_0x5cb6('0xc')],{'host':_0x5cb6('0xd'),'port':0x18eb});var socket=require(_0x5cb6('0xe'))(new Redis(config[_0x5cb6('0xc')]));require(_0x5cb6('0xf'))[_0x5cb6('0x10')](socket);function respondWithRpcPromise(_0xbaa9f2,_0x2a6276,_0x57edbb){return new BPromise(function(_0x2ed848,_0xf5ce2f){return client[_0x5cb6('0x11')](_0xbaa9f2,_0x57edbb)[_0x5cb6('0x12')](function(_0x5c6f90){logger['info'](_0x5cb6('0x13'),_0x2a6276,'request\x20sent');logger[_0x5cb6('0x14')](_0x5cb6('0x15'),_0x2a6276,'request\x20sent',JSON[_0x5cb6('0x16')](_0x5c6f90));if(_0x5c6f90[_0x5cb6('0x17')]){if(_0x5c6f90[_0x5cb6('0x17')][_0x5cb6('0x18')]===0x1f4){logger[_0x5cb6('0x17')](_0x5cb6('0x13'),_0x2a6276,_0x5c6f90[_0x5cb6('0x17')]['message']);return _0xf5ce2f(_0x5c6f90[_0x5cb6('0x17')]['message']);}logger[_0x5cb6('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x2a6276,_0x5c6f90[_0x5cb6('0x17')][_0x5cb6('0x19')]);return _0x2ed848(_0x5c6f90[_0x5cb6('0x17')]['message']);}else{logger[_0x5cb6('0x1a')](_0x5cb6('0x13'),_0x2a6276,_0x5cb6('0x1b'));_0x2ed848(_0x5c6f90[_0x5cb6('0x1c')]['message']);}})[_0x5cb6('0x1d')](function(_0x3736e2){logger[_0x5cb6('0x17')](_0x5cb6('0x13'),_0x2a6276,_0x3736e2);_0xf5ce2f(_0x3736e2);});});}exports[_0x5cb6('0x1e')]=function(_0x47ce21){var _0x25a0ed=this;return new Promise(function(_0x548244,_0x532b96){return db[_0x5cb6('0x1f')][_0x5cb6('0x20')]({'raw':_0x47ce21[_0x5cb6('0x21')]?_0x47ce21['options'][_0x5cb6('0x22')]===undefined?!![]:![]:!![],'where':_0x47ce21['options']?_0x47ce21['options'][_0x5cb6('0x23')]||null:null,'attributes':_0x47ce21['options']?_0x47ce21[_0x5cb6('0x21')][_0x5cb6('0x24')]||null:null,'limit':_0x47ce21[_0x5cb6('0x21')]?_0x47ce21[_0x5cb6('0x21')][_0x5cb6('0x25')]||null:null,'include':_0x47ce21[_0x5cb6('0x21')]?_0x47ce21[_0x5cb6('0x21')][_0x5cb6('0x26')]?_[_0x5cb6('0x27')](_0x47ce21[_0x5cb6('0x21')][_0x5cb6('0x26')],function(_0x5f2904){return{'model':db[_0x5f2904[_0x5cb6('0x28')]],'as':_0x5f2904['as'],'attributes':_0x5f2904[_0x5cb6('0x24')],'include':_0x5f2904[_0x5cb6('0x26')]?_[_0x5cb6('0x27')](_0x5f2904[_0x5cb6('0x26')],function(_0x31be5c){return{'model':db[_0x31be5c['model']],'as':_0x31be5c['as'],'attributes':_0x31be5c[_0x5cb6('0x24')],'include':_0x31be5c[_0x5cb6('0x26')]?_[_0x5cb6('0x27')](_0x31be5c[_0x5cb6('0x26')],function(_0x5edf68){return{'model':db[_0x5edf68['model']],'as':_0x5edf68['as'],'attributes':_0x5edf68['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f2ef2){logger[_0x5cb6('0x1a')](_0x5cb6('0x1e'),_0x47ce21);logger['debug']('GetOpenchannelQueue',_0x47ce21,JSON['stringify'](_0x4f2ef2));_0x548244(_0x4f2ef2);})[_0x5cb6('0x1d')](function(_0xf8b015){logger[_0x5cb6('0x17')](_0x5cb6('0x1e'),_0xf8b015[_0x5cb6('0x19')],_0x47ce21);_0x532b96(_0x25a0ed[_0x5cb6('0x17')](0x1f4,_0xf8b015[_0x5cb6('0x19')]));});});};exports[_0x5cb6('0x29')]=function(_0x2202ab){var _0x568719=this;return new Promise(function(_0x58ae0e,_0x31d4dd){return db['OpenchannelQueue'][_0x5cb6('0x2a')]({'raw':_0x2202ab['options']?_0x2202ab[_0x5cb6('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x2202ab[_0x5cb6('0x21')]?_0x2202ab['options']['where']||null:null,'attributes':_0x2202ab[_0x5cb6('0x21')]?_0x2202ab['options'][_0x5cb6('0x24')]||null:null,'include':_0x2202ab['options']?_0x2202ab['options'][_0x5cb6('0x26')]?_['map'](_0x2202ab[_0x5cb6('0x21')][_0x5cb6('0x26')],function(_0xc40565){return{'model':db[_0xc40565['model']],'as':_0xc40565['as'],'attributes':_0xc40565[_0x5cb6('0x24')],'include':_0xc40565[_0x5cb6('0x26')]?_[_0x5cb6('0x27')](_0xc40565[_0x5cb6('0x26')],function(_0x10ebdf){return{'model':db[_0x10ebdf[_0x5cb6('0x28')]],'as':_0x10ebdf['as'],'attributes':_0x10ebdf[_0x5cb6('0x24')],'include':_0x10ebdf[_0x5cb6('0x26')]?_[_0x5cb6('0x27')](_0x10ebdf[_0x5cb6('0x26')],function(_0x1e16fc){return{'model':db[_0x1e16fc[_0x5cb6('0x28')]],'as':_0x1e16fc['as'],'attributes':_0x1e16fc[_0x5cb6('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cfa3d){logger[_0x5cb6('0x1a')]('ShowOpenchannelQueue',_0x2202ab);logger['debug'](_0x5cb6('0x29'),_0x2202ab,JSON['stringify'](_0x5cfa3d));_0x58ae0e(_0x5cfa3d);})[_0x5cb6('0x1d')](function(_0x2715a8){logger[_0x5cb6('0x17')](_0x5cb6('0x29'),_0x2715a8[_0x5cb6('0x19')],_0x2202ab);_0x31d4dd(_0x568719[_0x5cb6('0x17')](0x1f4,_0x2715a8[_0x5cb6('0x19')]));});});}; \ No newline at end of file +var _0x7a84=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowOpenchannelQueue','find','lodash','moment','bluebird','ioredis'];(function(_0x584985,_0x31a01f){var _0x123c16=function(_0x54ae33){while(--_0x54ae33){_0x584985['push'](_0x584985['shift']());}};_0x123c16(++_0x31a01f);}(_0x7a84,0xf8));var _0x47a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a84[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x47a8('0x0'));var util=require('util');var moment=require(_0x47a8('0x1'));var BPromise=require(_0x47a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47a8('0x3'));var db=require(_0x47a8('0x4'))['db'];var utils=require(_0x47a8('0x5'));var logger=require(_0x47a8('0x6'))(_0x47a8('0x7'));var config=require('../../config/environment');var jayson=require(_0x47a8('0x8'));var client=jayson[_0x47a8('0x9')]['http']({'port':0x232a});config[_0x47a8('0xa')]=_[_0x47a8('0xb')](config[_0x47a8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a8('0xa')]));require('./openchannelQueue.socket')[_0x47a8('0xc')](socket);function respondWithRpcPromise(_0x512bcc,_0x1e8de4,_0x166936){return new BPromise(function(_0xb29598,_0x250790){return client[_0x47a8('0xd')](_0x512bcc,_0x166936)[_0x47a8('0xe')](function(_0x22ddb4){logger[_0x47a8('0xf')](_0x47a8('0x10'),_0x1e8de4,_0x47a8('0x11'));logger[_0x47a8('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1e8de4,_0x47a8('0x11'),JSON['stringify'](_0x22ddb4));if(_0x22ddb4['error']){if(_0x22ddb4['error']['code']===0x1f4){logger[_0x47a8('0x13')](_0x47a8('0x10'),_0x1e8de4,_0x22ddb4['error'][_0x47a8('0x14')]);return _0x250790(_0x22ddb4[_0x47a8('0x13')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x1e8de4,_0x22ddb4['error'][_0x47a8('0x14')]);return _0xb29598(_0x22ddb4[_0x47a8('0x13')][_0x47a8('0x14')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x1e8de4,'request\x20sent');_0xb29598(_0x22ddb4[_0x47a8('0x15')]['message']);}})[_0x47a8('0x16')](function(_0x154ff7){logger[_0x47a8('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e8de4,_0x154ff7);_0x250790(_0x154ff7);});});}exports[_0x47a8('0x17')]=function(_0x4f1193){var _0x15d7bd=this;return new Promise(function(_0x3a0ca2,_0x2a2644){return db['OpenchannelQueue'][_0x47a8('0x18')]({'raw':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1b')]||null:null,'attributes':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1c')]||null:null,'limit':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1d')]||null:null,'include':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')]['include']?_[_0x47a8('0x1e')](_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1f')],function(_0x2760cf){return{'model':db[_0x2760cf[_0x47a8('0x20')]],'as':_0x2760cf['as'],'attributes':_0x2760cf[_0x47a8('0x1c')],'include':_0x2760cf['include']?_[_0x47a8('0x1e')](_0x2760cf['include'],function(_0x3731e6){return{'model':db[_0x3731e6['model']],'as':_0x3731e6['as'],'attributes':_0x3731e6[_0x47a8('0x1c')],'include':_0x3731e6[_0x47a8('0x1f')]?_[_0x47a8('0x1e')](_0x3731e6['include'],function(_0xc193f2){return{'model':db[_0xc193f2[_0x47a8('0x20')]],'as':_0xc193f2['as'],'attributes':_0xc193f2[_0x47a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x47a8('0xe')](function(_0x512a9b){logger[_0x47a8('0xf')](_0x47a8('0x17'),_0x4f1193);logger[_0x47a8('0x12')]('GetOpenchannelQueue',_0x4f1193,JSON[_0x47a8('0x21')](_0x512a9b));_0x3a0ca2(_0x512a9b);})['catch'](function(_0x58f684){logger[_0x47a8('0x13')](_0x47a8('0x17'),_0x58f684['message'],_0x4f1193);_0x2a2644(_0x15d7bd[_0x47a8('0x13')](0x1f4,_0x58f684['message']));});});};exports[_0x47a8('0x22')]=function(_0x16c551){var _0x6db51b=this;return new Promise(function(_0x4e71db,_0x47db84){return db['OpenchannelQueue'][_0x47a8('0x23')]({'raw':_0x16c551[_0x47a8('0x19')]?_0x16c551['options'][_0x47a8('0x1a')]===undefined?!![]:![]:!![],'where':_0x16c551[_0x47a8('0x19')]?_0x16c551['options']['where']||null:null,'attributes':_0x16c551['options']?_0x16c551[_0x47a8('0x19')][_0x47a8('0x1c')]||null:null,'include':_0x16c551[_0x47a8('0x19')]?_0x16c551[_0x47a8('0x19')][_0x47a8('0x1f')]?_[_0x47a8('0x1e')](_0x16c551[_0x47a8('0x19')][_0x47a8('0x1f')],function(_0x16142a){return{'model':db[_0x16142a[_0x47a8('0x20')]],'as':_0x16142a['as'],'attributes':_0x16142a['attributes'],'include':_0x16142a[_0x47a8('0x1f')]?_[_0x47a8('0x1e')](_0x16142a[_0x47a8('0x1f')],function(_0x5d906c){return{'model':db[_0x5d906c[_0x47a8('0x20')]],'as':_0x5d906c['as'],'attributes':_0x5d906c[_0x47a8('0x1c')],'include':_0x5d906c[_0x47a8('0x1f')]?_[_0x47a8('0x1e')](_0x5d906c[_0x47a8('0x1f')],function(_0x26bb7c){return{'model':db[_0x26bb7c['model']],'as':_0x26bb7c['as'],'attributes':_0x26bb7c[_0x47a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x47a8('0xe')](function(_0x5757c0){logger[_0x47a8('0xf')]('ShowOpenchannelQueue',_0x16c551);logger['debug'](_0x47a8('0x22'),_0x16c551,JSON['stringify'](_0x5757c0));_0x4e71db(_0x5757c0);})['catch'](function(_0x1c4547){logger[_0x47a8('0x13')](_0x47a8('0x22'),_0x1c4547[_0x47a8('0x14')],_0x16c551);_0x47db84(_0x6db51b['error'](0x1f4,_0x1c4547[_0x47a8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 08261da..76625b0 100644 --- a/server/api/openchannelQueue/openchannelQueue.socket.js +++ b/server/api/openchannelQueue/openchannelQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1ae=['register','openchannelQueue:','./openchannelQueue.events','remove','update','removeListener'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd1ae,0xd4));var _0xed1a=function(_0x19e166,_0x4cc641){_0x19e166=_0x19e166-0x0;var _0x5e6bed=_0xd1ae[_0x19e166];return _0x5e6bed;};'use strict';var OpenchannelQueueEvents=require(_0xed1a('0x0'));var events=['save',_0xed1a('0x1'),_0xed1a('0x2')];function createListener(_0x49d27a,_0x57b010){return function(_0x1e44aa){_0x57b010['emit'](_0x49d27a,_0x1e44aa);};}function removeListener(_0x45f5d9,_0x158240){return function(){OpenchannelQueueEvents[_0xed1a('0x3')](_0x45f5d9,_0x158240);};}exports[_0xed1a('0x4')]=function(_0x94bfa4){for(var _0x4ca75f=0x0,_0x44be89=events['length'];_0x4ca75f<_0x44be89;_0x4ca75f++){var _0xf9f882=events[_0x4ca75f];var _0x55a5ae=createListener(_0xed1a('0x5')+_0xf9f882,_0x94bfa4);OpenchannelQueueEvents['on'](_0xf9f882,_0x55a5ae);}}; \ No newline at end of file +var _0x540d=['register','length','openchannelQueue:','save','remove'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x540d,0x71));var _0xd540=function(_0x301ef6,_0x25e340){_0x301ef6=_0x301ef6-0x0;var _0x5da2ef=_0x540d[_0x301ef6];return _0x5da2ef;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xd540('0x0'),_0xd540('0x1'),'update'];function createListener(_0x2aa3a1,_0x32e2a6){return function(_0x5e1ddb){_0x32e2a6['emit'](_0x2aa3a1,_0x5e1ddb);};}function removeListener(_0x398a43,_0x10227c){return function(){OpenchannelQueueEvents['removeListener'](_0x398a43,_0x10227c);};}exports[_0xd540('0x2')]=function(_0x3af909){for(var _0x9f6faf=0x0,_0x17caf3=events[_0xd540('0x3')];_0x9f6faf<_0x17caf3;_0x9f6faf++){var _0x2d1869=events[_0x9f6faf];var _0x4c6bd6=createListener(_0xd540('0x4')+_0x2d1869,_0x3af909);OpenchannelQueueEvents['on'](_0x2d1869,_0x4c6bd6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 027ba3e..12a6634 100644 --- a/server/api/openchannelQueueReport/index.js +++ b/server/api/openchannelQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7d8=['show','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xc7d8,0xd5));var _0x8c7d=function(_0x3380a8,_0x103706){_0x3380a8=_0x3380a8-0x0;var _0x5b4a7e=_0xc7d8[_0x3380a8];return _0x5b4a7e;};'use strict';var multer=require(_0x8c7d('0x0'));var util=require(_0x8c7d('0x1'));var path=require('path');var timeout=require(_0x8c7d('0x2'));var express=require(_0x8c7d('0x3'));var router=express[_0x8c7d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8c7d('0x5'));var config=require('../../config/environment');var controller=require(_0x8c7d('0x6'));router[_0x8c7d('0x7')]('/',auth[_0x8c7d('0x8')](),controller[_0x8c7d('0x9')]);router[_0x8c7d('0x7')]('/describe',auth[_0x8c7d('0x8')](),controller[_0x8c7d('0xa')]);router[_0x8c7d('0x7')]('/:id',auth[_0x8c7d('0x8')](),controller[_0x8c7d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8c7d('0x8')](),controller[_0x8c7d('0xc')]);router['delete'](_0x8c7d('0xd'),auth['isAuthenticated'](),controller[_0x8c7d('0xe')]);module[_0x8c7d('0xf')]=router; \ No newline at end of file +var _0xfe28=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xfe28,0x1a8));var _0x8fe2=function(_0x1336af,_0xa87e6){_0x1336af=_0x1336af-0x0;var _0x220134=_0xfe28[_0x1336af];return _0x220134;};'use strict';var multer=require(_0x8fe2('0x0'));var util=require(_0x8fe2('0x1'));var path=require(_0x8fe2('0x2'));var timeout=require(_0x8fe2('0x3'));var express=require(_0x8fe2('0x4'));var router=express[_0x8fe2('0x5')]();var auth=require(_0x8fe2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8fe2('0x7'));var controller=require(_0x8fe2('0x8'));router['get']('/',auth[_0x8fe2('0x9')](),controller[_0x8fe2('0xa')]);router[_0x8fe2('0xb')](_0x8fe2('0xc'),auth[_0x8fe2('0x9')](),controller[_0x8fe2('0xd')]);router[_0x8fe2('0xb')](_0x8fe2('0xe'),auth['isAuthenticated'](),controller[_0x8fe2('0xf')]);router[_0x8fe2('0x10')]('/',auth[_0x8fe2('0x9')](),controller[_0x8fe2('0x11')]);router[_0x8fe2('0x12')](_0x8fe2('0xe'),auth[_0x8fe2('0x9')](),controller[_0x8fe2('0x13')]);router[_0x8fe2('0x14')]('/:id',auth[_0x8fe2('0x9')](),controller[_0x8fe2('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index bf00773..c2581b1 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7690=['exports','STRING','DATE','sequelize'];(function(_0x22926b,_0x1cf61b){var _0x5acbc3=function(_0x6dc10b){while(--_0x6dc10b){_0x22926b['push'](_0x22926b['shift']());}};_0x5acbc3(++_0x1cf61b);}(_0x7690,0x10b));var _0x0769=function(_0x339398,_0xfa6c29){_0x339398=_0x339398-0x0;var _0x5129ce=_0x7690[_0x339398];return _0x5129ce;};'use strict';var moment=require('moment');var Sequelize=require(_0x0769('0x0'));module[_0x0769('0x1')]={'uniqueid':{'type':Sequelize[_0x0769('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0769('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0769('0x3')]},'acceptAt':{'type':Sequelize[_0x0769('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9b28=['sequelize','STRING','DATE'];(function(_0x3a7ace,_0x21a68e){var _0x537598=function(_0xe3a017){while(--_0xe3a017){_0x3a7ace['push'](_0x3a7ace['shift']());}};_0x537598(++_0x21a68e);}(_0x9b28,0x87));var _0x89b2=function(_0x217b21,_0x53d0d5){_0x217b21=_0x217b21-0x0;var _0x449d78=_0x9b28[_0x217b21];return _0x449d78;};'use strict';var moment=require('moment');var Sequelize=require(_0x89b2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x89b2('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x89b2('0x1')]},'joinAt':{'type':Sequelize[_0x89b2('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x89b2('0x2')]},'reason':{'type':Sequelize[_0x89b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a9d67df..a2d1abc 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa2f=['include','options','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','rows','catch','show','params'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfa2f,0xe8));var _0xffa2=function(_0x2330fa,_0x4a924a){_0x2330fa=_0x2330fa-0x0;var _0x131e69=_0xfa2f[_0x2330fa];return _0x131e69;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xffa2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffa2('0x1'));var rp=require(_0xffa2('0x2'));var moment=require(_0xffa2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xffa2('0x4'));var util=require(_0xffa2('0x5'));var path=require(_0xffa2('0x6'));var sox=require(_0xffa2('0x7'));var csv=require(_0xffa2('0x8'));var ejs=require(_0xffa2('0x9'));var fs=require('fs');var _=require(_0xffa2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xffa2('0xb'));var deskjs=require(_0xffa2('0xc'));var toCsv=require(_0xffa2('0x8'));var querystring=require(_0xffa2('0xd'));var Papa=require(_0xffa2('0xe'));var Redis=require(_0xffa2('0xf'));var authService=require(_0xffa2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xffa2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffa2('0x12'));var utils=require(_0xffa2('0x13'));var config=require(_0xffa2('0x14'));var licenseUtil=require(_0xffa2('0x15'));var db=require(_0xffa2('0x16'))['db'];function respondWithStatusCode(_0x569ebb,_0x33acac){_0x33acac=_0x33acac||0xcc;return function(_0x3f9363){if(_0x3f9363){return _0x569ebb[_0xffa2('0x17')](_0x33acac);}return _0x569ebb[_0xffa2('0x18')](_0x33acac)['end']();};}function respondWithResult(_0x5f44cc,_0x32e54e){_0x32e54e=_0x32e54e||0xc8;return function(_0x19a880){if(_0x19a880){return _0x5f44cc[_0xffa2('0x18')](_0x32e54e)['json'](_0x19a880);}};}function respondWithFilteredResult(_0x2d6803,_0x31a57f){return function(_0x2c4035){if(_0x2c4035){var _0x4019b3=_0x2c4035['count'],_0x316c7e=_0x31a57f[_0xffa2('0x19')],_0x3cc797=_0x31a57f[_0xffa2('0x19')]+_0x31a57f[_0xffa2('0x1a')],_0x892043;if(_0x3cc797>=_0x4019b3){_0x3cc797=_0x4019b3;_0x892043=0xc8;}else{_0x892043=0xce;}_0x2d6803[_0xffa2('0x18')](_0x892043);return _0x2d6803[_0xffa2('0x1b')](_0xffa2('0x1c'),_0x316c7e+'-'+_0x3cc797+'/'+_0x4019b3)[_0xffa2('0x1d')](_0x2c4035);}return null;};}function patchUpdates(_0x515123){return function(_0x2e93c0){try{jsonpatch[_0xffa2('0x1e')](_0x2e93c0,_0x515123,!![]);}catch(_0x3ef025){return BPromise[_0xffa2('0x1f')](_0x3ef025);}return _0x2e93c0['save']();};}function saveUpdates(_0x6c9785,_0x54c2f){return function(_0x406fa0){if(_0x406fa0){return _0x406fa0['update'](_0x6c9785)[_0xffa2('0x20')](function(_0x4e0ec9){return _0x4e0ec9;});}return null;};}function removeEntity(_0x204a0f,_0x3f602c){return function(_0x15edba){if(_0x15edba){return _0x15edba[_0xffa2('0x21')]()[_0xffa2('0x20')](function(){_0x204a0f[_0xffa2('0x18')](0xcc)[_0xffa2('0x22')]();});}};}function handleEntityNotFound(_0x251a0d,_0xcfec26){return function(_0x339f1e){if(!_0x339f1e){_0x251a0d['sendStatus'](0x194);}return _0x339f1e;};}function handleError(_0x1d62b1,_0x176b7e){_0x176b7e=_0x176b7e||0x1f4;return function(_0x4d97a3){logger[_0xffa2('0x23')](_0x4d97a3[_0xffa2('0x24')]);if(_0x4d97a3[_0xffa2('0x25')]){delete _0x4d97a3[_0xffa2('0x25')];}_0x1d62b1[_0xffa2('0x18')](_0x176b7e)[_0xffa2('0x26')](_0x4d97a3);};}exports[_0xffa2('0x27')]=function(_0x361540,_0x4e10b4){var _0x2d4376={},_0x2ca0a2={},_0x1f91bc={'count':0x0,'rows':[]};var _0x48cdf3=_[_0xffa2('0x28')](db[_0xffa2('0x29')][_0xffa2('0x2a')],function(_0x48e67b){return{'name':_0x48e67b[_0xffa2('0x2b')],'type':_0x48e67b[_0xffa2('0x2c')][_0xffa2('0x2d')]};});_0x2ca0a2[_0xffa2('0x2e')]=_[_0xffa2('0x28')](_0x48cdf3,_0xffa2('0x25'));_0x2ca0a2[_0xffa2('0x2f')]=_[_0xffa2('0x30')](_0x361540[_0xffa2('0x2f')]);_0x2ca0a2[_0xffa2('0x31')]=_[_0xffa2('0x32')](_0x2ca0a2[_0xffa2('0x2e')],_0x2ca0a2[_0xffa2('0x2f')]);_0x2d4376[_0xffa2('0x33')]=_[_0xffa2('0x32')](_0x2ca0a2['model'],qs[_0xffa2('0x34')](_0x361540[_0xffa2('0x2f')]['fields']));_0x2d4376[_0xffa2('0x33')]=_0x2d4376['attributes'][_0xffa2('0x35')]?_0x2d4376['attributes']:_0x2ca0a2['model'];if(!_0x361540[_0xffa2('0x2f')]['hasOwnProperty'](_0xffa2('0x36'))){_0x2d4376['limit']=qs[_0xffa2('0x1a')](_0x361540[_0xffa2('0x2f')][_0xffa2('0x1a')]);_0x2d4376[_0xffa2('0x19')]=qs['offset'](_0x361540[_0xffa2('0x2f')]['offset']);}_0x2d4376[_0xffa2('0x37')]=qs[_0xffa2('0x38')](_0x361540[_0xffa2('0x2f')]['sort']);_0x2d4376['where']=qs[_0xffa2('0x31')](_[_0xffa2('0x39')](_0x361540[_0xffa2('0x2f')],_0x2ca0a2['filters']),_0x48cdf3);if(_0x361540[_0xffa2('0x2f')]['filter']){_0x2d4376[_0xffa2('0x3a')]=_[_0xffa2('0x3b')](_0x2d4376[_0xffa2('0x3a')],{'$or':_[_0xffa2('0x28')](_0x48cdf3,function(_0x3b83bf){if(_0x3b83bf[_0xffa2('0x2c')]!==_0xffa2('0x3c')){var _0x3acf1a={};_0x3acf1a[_0x3b83bf[_0xffa2('0x25')]]={'$like':'%'+_0x361540[_0xffa2('0x2f')][_0xffa2('0x3d')]+'%'};return _0x3acf1a;}})});}_0x2d4376=_[_0xffa2('0x3b')]({},_0x2d4376,_0x361540['options']);var _0x1780ea={'where':_0x2d4376['where']};return db[_0xffa2('0x29')][_0xffa2('0x3e')](_0x1780ea)[_0xffa2('0x20')](function(_0x41d486){_0x1f91bc[_0xffa2('0x3e')]=_0x41d486;if(_0x361540['query'][_0xffa2('0x3f')]){_0x2d4376['include']=[{'all':!![]}];}return db[_0xffa2('0x29')]['findAll'](_0x2d4376);})['then'](function(_0x3b1f21){_0x1f91bc[_0xffa2('0x40')]=_0x3b1f21;return _0x1f91bc;})[_0xffa2('0x20')](respondWithFilteredResult(_0x4e10b4,_0x2d4376))[_0xffa2('0x41')](handleError(_0x4e10b4,null));};exports[_0xffa2('0x42')]=function(_0x5581e6,_0x4efcdb){var _0x261ec8={'raw':!![],'where':{'id':_0x5581e6[_0xffa2('0x43')]['id']}},_0x46d30a={};_0x46d30a[_0xffa2('0x2e')]=_['keys'](db[_0xffa2('0x29')][_0xffa2('0x2a')]);_0x46d30a[_0xffa2('0x2f')]=_['keys'](_0x5581e6[_0xffa2('0x2f')]);_0x46d30a[_0xffa2('0x31')]=_['intersection'](_0x46d30a[_0xffa2('0x2e')],_0x46d30a['query']);_0x261ec8[_0xffa2('0x33')]=_['intersection'](_0x46d30a['model'],qs[_0xffa2('0x34')](_0x5581e6[_0xffa2('0x2f')][_0xffa2('0x34')]));_0x261ec8[_0xffa2('0x33')]=_0x261ec8['attributes'][_0xffa2('0x35')]?_0x261ec8['attributes']:_0x46d30a[_0xffa2('0x2e')];if(_0x5581e6[_0xffa2('0x2f')][_0xffa2('0x3f')]){_0x261ec8[_0xffa2('0x44')]=[{'all':!![]}];}_0x261ec8=_['merge']({},_0x261ec8,_0x5581e6[_0xffa2('0x45')]);return db['OpenchannelQueueReport'][_0xffa2('0x46')](_0x261ec8)['then'](handleEntityNotFound(_0x4efcdb,null))[_0xffa2('0x20')](respondWithResult(_0x4efcdb,null))[_0xffa2('0x41')](handleError(_0x4efcdb,null));};exports[_0xffa2('0x47')]=function(_0x2fd3d9,_0x225642){return db[_0xffa2('0x29')][_0xffa2('0x47')](_0x2fd3d9[_0xffa2('0x48')],{})[_0xffa2('0x20')](respondWithResult(_0x225642,0xc9))[_0xffa2('0x41')](handleError(_0x225642,null));};exports[_0xffa2('0x49')]=function(_0x577bb9,_0x27196a){if(_0x577bb9[_0xffa2('0x48')]['id']){delete _0x577bb9[_0xffa2('0x48')]['id'];}return db[_0xffa2('0x29')][_0xffa2('0x46')]({'where':{'id':_0x577bb9[_0xffa2('0x43')]['id']}})[_0xffa2('0x20')](handleEntityNotFound(_0x27196a,null))[_0xffa2('0x20')](saveUpdates(_0x577bb9[_0xffa2('0x48')],null))[_0xffa2('0x20')](respondWithResult(_0x27196a,null))[_0xffa2('0x41')](handleError(_0x27196a,null));};exports['destroy']=function(_0x4c3c72,_0x21e875){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x4c3c72[_0xffa2('0x43')]['id']}})['then'](handleEntityNotFound(_0x21e875,null))[_0xffa2('0x20')](removeEntity(_0x21e875,null))[_0xffa2('0x41')](handleError(_0x21e875,null));};exports[_0xffa2('0x4a')]=function(_0x57545d,_0x34b257){return db[_0xffa2('0x29')][_0xffa2('0x4a')]()[_0xffa2('0x20')](respondWithResult(_0x34b257,null))[_0xffa2('0x41')](handleError(_0x34b257,null));}; \ No newline at end of file +var _0xe3ee=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','merge','map','filter','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','rimraf','zip-dir','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x74e783,_0x15bae7){var _0x92276f=function(_0x4db513){while(--_0x4db513){_0x74e783['push'](_0x74e783['shift']());}};_0x92276f(++_0x15bae7);}(_0xe3ee,0x116));var _0xee3e=function(_0x58cd83,_0x5172f7){_0x58cd83=_0x58cd83-0x0;var _0x12cd94=_0xe3ee[_0x58cd83];return _0x12cd94;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xee3e('0x0'));var zipdir=require(_0xee3e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee3e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee3e('0x3'));var path=require('path');var sox=require(_0xee3e('0x4'));var csv=require(_0xee3e('0x5'));var ejs=require(_0xee3e('0x6'));var fs=require('fs');var _=require(_0xee3e('0x7'));var squel=require(_0xee3e('0x8'));var crypto=require(_0xee3e('0x9'));var jsforce=require(_0xee3e('0xa'));var deskjs=require(_0xee3e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xee3e('0xc'));var Papa=require(_0xee3e('0xd'));var Redis=require('ioredis');var authService=require(_0xee3e('0xe'));var qs=require(_0xee3e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee3e('0x10'));var logger=require(_0xee3e('0x11'))(_0xee3e('0x12'));var utils=require(_0xee3e('0x13'));var config=require(_0xee3e('0x14'));var licenseUtil=require(_0xee3e('0x15'));var db=require(_0xee3e('0x16'))['db'];function respondWithStatusCode(_0x239052,_0x48506e){_0x48506e=_0x48506e||0xcc;return function(_0x4faeb8){if(_0x4faeb8){return _0x239052[_0xee3e('0x17')](_0x48506e);}return _0x239052[_0xee3e('0x18')](_0x48506e)['end']();};}function respondWithResult(_0x209595,_0x1c0eb0){_0x1c0eb0=_0x1c0eb0||0xc8;return function(_0xccec54){if(_0xccec54){return _0x209595['status'](_0x1c0eb0)[_0xee3e('0x19')](_0xccec54);}};}function respondWithFilteredResult(_0x4743d3,_0x502f47){return function(_0x51e498){if(_0x51e498){var _0x370f32=_0x51e498['count'],_0x450c5b=_0x502f47['offset'],_0x266449=_0x502f47['offset']+_0x502f47[_0xee3e('0x1a')],_0x512609;if(_0x266449>=_0x370f32){_0x266449=_0x370f32;_0x512609=0xc8;}else{_0x512609=0xce;}_0x4743d3[_0xee3e('0x18')](_0x512609);return _0x4743d3[_0xee3e('0x1b')](_0xee3e('0x1c'),_0x450c5b+'-'+_0x266449+'/'+_0x370f32)[_0xee3e('0x19')](_0x51e498);}return null;};}function patchUpdates(_0x4b1d63){return function(_0x2d1f93){try{jsonpatch[_0xee3e('0x1d')](_0x2d1f93,_0x4b1d63,!![]);}catch(_0x2200f1){return BPromise[_0xee3e('0x1e')](_0x2200f1);}return _0x2d1f93[_0xee3e('0x1f')]();};}function saveUpdates(_0x3b6d40,_0x5528f9){return function(_0x121166){if(_0x121166){return _0x121166[_0xee3e('0x20')](_0x3b6d40)[_0xee3e('0x21')](function(_0x30f0e3){return _0x30f0e3;});}return null;};}function removeEntity(_0x236de7,_0xfbf279){return function(_0x374847){if(_0x374847){return _0x374847[_0xee3e('0x22')]()[_0xee3e('0x21')](function(){_0x236de7[_0xee3e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e4100,_0x4b0d94){return function(_0x4aaf22){if(!_0x4aaf22){_0x5e4100[_0xee3e('0x17')](0x194);}return _0x4aaf22;};}function handleError(_0xc1a5af,_0x48555e){_0x48555e=_0x48555e||0x1f4;return function(_0xbfc488){logger[_0xee3e('0x23')](_0xbfc488[_0xee3e('0x24')]);if(_0xbfc488['name']){delete _0xbfc488[_0xee3e('0x25')];}_0xc1a5af[_0xee3e('0x18')](_0x48555e)[_0xee3e('0x26')](_0xbfc488);};}exports[_0xee3e('0x27')]=function(_0x5ec872,_0x59baf3){var _0x1c687c={},_0x3b6c7e={},_0x300b39={'count':0x0,'rows':[]};var _0x59f17f=_['map'](db[_0xee3e('0x28')][_0xee3e('0x29')],function(_0x179406){return{'name':_0x179406[_0xee3e('0x2a')],'type':_0x179406[_0xee3e('0x2b')][_0xee3e('0x2c')]};});_0x3b6c7e[_0xee3e('0x2d')]=_['map'](_0x59f17f,'name');_0x3b6c7e[_0xee3e('0x2e')]=_[_0xee3e('0x2f')](_0x5ec872['query']);_0x3b6c7e[_0xee3e('0x30')]=_['intersection'](_0x3b6c7e[_0xee3e('0x2d')],_0x3b6c7e[_0xee3e('0x2e')]);_0x1c687c[_0xee3e('0x31')]=_[_0xee3e('0x32')](_0x3b6c7e['model'],qs[_0xee3e('0x33')](_0x5ec872[_0xee3e('0x2e')][_0xee3e('0x33')]));_0x1c687c[_0xee3e('0x31')]=_0x1c687c[_0xee3e('0x31')][_0xee3e('0x34')]?_0x1c687c[_0xee3e('0x31')]:_0x3b6c7e[_0xee3e('0x2d')];if(!_0x5ec872[_0xee3e('0x2e')]['hasOwnProperty'](_0xee3e('0x35'))){_0x1c687c[_0xee3e('0x1a')]=qs[_0xee3e('0x1a')](_0x5ec872[_0xee3e('0x2e')][_0xee3e('0x1a')]);_0x1c687c[_0xee3e('0x36')]=qs[_0xee3e('0x36')](_0x5ec872[_0xee3e('0x2e')][_0xee3e('0x36')]);}_0x1c687c[_0xee3e('0x37')]=qs[_0xee3e('0x38')](_0x5ec872['query'][_0xee3e('0x38')]);_0x1c687c[_0xee3e('0x39')]=qs['filters'](_[_0xee3e('0x3a')](_0x5ec872[_0xee3e('0x2e')],_0x3b6c7e[_0xee3e('0x30')]),_0x59f17f);if(_0x5ec872[_0xee3e('0x2e')]['filter']){_0x1c687c[_0xee3e('0x39')]=_[_0xee3e('0x3b')](_0x1c687c[_0xee3e('0x39')],{'$or':_[_0xee3e('0x3c')](_0x59f17f,function(_0x471057){if(_0x471057[_0xee3e('0x2b')]!=='VIRTUAL'){var _0x44c8bf={};_0x44c8bf[_0x471057['name']]={'$like':'%'+_0x5ec872[_0xee3e('0x2e')][_0xee3e('0x3d')]+'%'};return _0x44c8bf;}})});}_0x1c687c=_['merge']({},_0x1c687c,_0x5ec872['options']);var _0x1a18db={'where':_0x1c687c[_0xee3e('0x39')]};return db[_0xee3e('0x28')]['count'](_0x1a18db)[_0xee3e('0x21')](function(_0x5437d9){_0x300b39[_0xee3e('0x3e')]=_0x5437d9;if(_0x5ec872[_0xee3e('0x2e')]['includeAll']){_0x1c687c[_0xee3e('0x3f')]=[{'all':!![]}];}return db[_0xee3e('0x28')][_0xee3e('0x40')](_0x1c687c);})['then'](function(_0x29c267){_0x300b39[_0xee3e('0x41')]=_0x29c267;return _0x300b39;})['then'](respondWithFilteredResult(_0x59baf3,_0x1c687c))[_0xee3e('0x42')](handleError(_0x59baf3,null));};exports[_0xee3e('0x43')]=function(_0x21110f,_0x11c10a){var _0x8cdcbb={'raw':!![],'where':{'id':_0x21110f[_0xee3e('0x44')]['id']}},_0x1e278a={};_0x1e278a['model']=_[_0xee3e('0x2f')](db[_0xee3e('0x28')][_0xee3e('0x29')]);_0x1e278a['query']=_[_0xee3e('0x2f')](_0x21110f[_0xee3e('0x2e')]);_0x1e278a[_0xee3e('0x30')]=_[_0xee3e('0x32')](_0x1e278a[_0xee3e('0x2d')],_0x1e278a[_0xee3e('0x2e')]);_0x8cdcbb['attributes']=_[_0xee3e('0x32')](_0x1e278a['model'],qs[_0xee3e('0x33')](_0x21110f[_0xee3e('0x2e')][_0xee3e('0x33')]));_0x8cdcbb[_0xee3e('0x31')]=_0x8cdcbb[_0xee3e('0x31')]['length']?_0x8cdcbb['attributes']:_0x1e278a['model'];if(_0x21110f[_0xee3e('0x2e')][_0xee3e('0x45')]){_0x8cdcbb[_0xee3e('0x3f')]=[{'all':!![]}];}_0x8cdcbb=_[_0xee3e('0x3b')]({},_0x8cdcbb,_0x21110f['options']);return db[_0xee3e('0x28')]['find'](_0x8cdcbb)[_0xee3e('0x21')](handleEntityNotFound(_0x11c10a,null))[_0xee3e('0x21')](respondWithResult(_0x11c10a,null))[_0xee3e('0x42')](handleError(_0x11c10a,null));};exports[_0xee3e('0x46')]=function(_0x408347,_0x18c769){return db[_0xee3e('0x28')]['create'](_0x408347[_0xee3e('0x47')],{})[_0xee3e('0x21')](respondWithResult(_0x18c769,0xc9))['catch'](handleError(_0x18c769,null));};exports['update']=function(_0x57697d,_0x55f087){if(_0x57697d[_0xee3e('0x47')]['id']){delete _0x57697d['body']['id'];}return db['OpenchannelQueueReport'][_0xee3e('0x48')]({'where':{'id':_0x57697d[_0xee3e('0x44')]['id']}})[_0xee3e('0x21')](handleEntityNotFound(_0x55f087,null))[_0xee3e('0x21')](saveUpdates(_0x57697d[_0xee3e('0x47')],null))[_0xee3e('0x21')](respondWithResult(_0x55f087,null))['catch'](handleError(_0x55f087,null));};exports[_0xee3e('0x22')]=function(_0x158c4d,_0x3473a3){return db[_0xee3e('0x28')][_0xee3e('0x48')]({'where':{'id':_0x158c4d['params']['id']}})['then'](handleEntityNotFound(_0x3473a3,null))[_0xee3e('0x21')](removeEntity(_0x3473a3,null))[_0xee3e('0x42')](handleError(_0x3473a3,null));};exports[_0xee3e('0x49')]=function(_0x151255,_0x347e61){return db[_0xee3e('0x28')][_0xee3e('0x49')]()[_0xee3e('0x21')](respondWithResult(_0x347e61,null))[_0xee3e('0x42')](handleError(_0x347e61,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index e10de17..bca4cd7 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e9d=['api','moment','bluebird','request-promise','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util'];(function(_0x586120,_0x407adf){var _0x582ee2=function(_0x32ff80){while(--_0x32ff80){_0x586120['push'](_0x586120['shift']());}};_0x582ee2(++_0x407adf);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x25fe93,_0x473711){_0x25fe93=_0x25fe93-0x0;var _0x506d30=_0x3e9d[_0x25fe93];return _0x506d30;};'use strict';var _=require(_0xd3e9('0x0'));var util=require(_0xd3e9('0x1'));var logger=require('../../config/logger')(_0xd3e9('0x2'));var moment=require(_0xd3e9('0x3'));var BPromise=require(_0xd3e9('0x4'));var rp=require(_0xd3e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd3e9('0x6'));var attributes=require(_0xd3e9('0x7'));module[_0xd3e9('0x8')]=function(_0x3dea0a,_0x568eea){return _0x3dea0a['define'](_0xd3e9('0x9'),attributes,{'tableName':_0xd3e9('0xa'),'paranoid':![],'indexes':[{'name':_0xd3e9('0xb'),'fields':[_0xd3e9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf53f=['../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x37c065,_0x4f3ac5){var _0x414f2a=function(_0x1daa7c){while(--_0x1daa7c){_0x37c065['push'](_0x37c065['shift']());}};_0x414f2a(++_0x4f3ac5);}(_0xf53f,0x8d));var _0xff53=function(_0xdd37de,_0x281b6e){_0xdd37de=_0xdd37de-0x0;var _0x563d53=_0xf53f[_0xdd37de];return _0x563d53;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var logger=require(_0xff53('0x2'))(_0xff53('0x3'));var moment=require(_0xff53('0x4'));var BPromise=require(_0xff53('0x5'));var rp=require(_0xff53('0x6'));var fs=require('fs');var path=require(_0xff53('0x7'));var rimraf=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var attributes=require(_0xff53('0xa'));module[_0xff53('0xb')]=function(_0x54d39c,_0x54e637){return _0x54d39c[_0xff53('0xc')]('OpenchannelQueueReport',attributes,{'tableName':_0xff53('0xd'),'paranoid':![],'indexes':[{'name':_0xff53('0xe'),'fields':[_0xff53('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 88bbc77..209b20a 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50e6=['then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','where','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3b0b8a,_0x18474e){var _0x450671=function(_0x160175){while(--_0x160175){_0x3b0b8a['push'](_0x3b0b8a['shift']());}};_0x450671(++_0x18474e);}(_0x50e6,0x1b4));var _0x650e=function(_0x44e277,_0x34cfbb){_0x44e277=_0x44e277-0x0;var _0x3097cc=_0x50e6[_0x44e277];return _0x3097cc;};'use strict';var _=require(_0x650e('0x0'));var util=require(_0x650e('0x1'));var moment=require(_0x650e('0x2'));var BPromise=require('bluebird');var rs=require(_0x650e('0x3'));var fs=require('fs');var Redis=require(_0x650e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x650e('0x5'));var logger=require(_0x650e('0x6'))(_0x650e('0x7'));var config=require(_0x650e('0x8'));var jayson=require(_0x650e('0x9'));var client=jayson[_0x650e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa3fc5a,_0x1f8a5c,_0xb3e2a3){return new BPromise(function(_0x574920,_0x1e0bd6){return client[_0x650e('0xb')](_0xa3fc5a,_0xb3e2a3)[_0x650e('0xc')](function(_0x55e33c){logger[_0x650e('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1f8a5c,_0x650e('0xe'));logger[_0x650e('0xf')](_0x650e('0x10'),_0x1f8a5c,_0x650e('0xe'),JSON[_0x650e('0x11')](_0x55e33c));if(_0x55e33c[_0x650e('0x12')]){if(_0x55e33c['error'][_0x650e('0x13')]===0x1f4){logger[_0x650e('0x12')](_0x650e('0x14'),_0x1f8a5c,_0x55e33c[_0x650e('0x12')][_0x650e('0x15')]);return _0x1e0bd6(_0x55e33c[_0x650e('0x12')][_0x650e('0x15')]);}logger[_0x650e('0x12')](_0x650e('0x14'),_0x1f8a5c,_0x55e33c[_0x650e('0x12')][_0x650e('0x15')]);return _0x574920(_0x55e33c[_0x650e('0x12')][_0x650e('0x15')]);}else{logger[_0x650e('0xd')](_0x650e('0x14'),_0x1f8a5c,_0x650e('0xe'));_0x574920(_0x55e33c[_0x650e('0x16')][_0x650e('0x15')]);}})[_0x650e('0x17')](function(_0x4e19f3){logger[_0x650e('0x12')](_0x650e('0x14'),_0x1f8a5c,_0x4e19f3);_0x1e0bd6(_0x4e19f3);});});}exports[_0x650e('0x18')]=function(_0x45cafc){var _0x186b0a=this;return new Promise(function(_0x53eab5,_0x52dc6e){return db[_0x650e('0x19')][_0x650e('0x1a')](_0x45cafc['body'],{'raw':_0x45cafc['options']?_0x45cafc[_0x650e('0x1b')][_0x650e('0x1c')]===undefined?!![]:![]:!![]})[_0x650e('0xc')](function(_0x51d14b){logger[_0x650e('0xd')]('CreateOpenchannelQueueReport',_0x45cafc);logger[_0x650e('0xf')](_0x650e('0x18'),_0x45cafc,JSON[_0x650e('0x11')](_0x51d14b));_0x53eab5(_0x51d14b);})[_0x650e('0x17')](function(_0x3e3145){logger[_0x650e('0x12')](_0x650e('0x18'),_0x3e3145[_0x650e('0x15')],_0x45cafc);_0x52dc6e(_0x186b0a[_0x650e('0x12')](0x1f4,_0x3e3145['message']));});});};exports[_0x650e('0x1d')]=function(_0x38ffc5){var _0x12450e=this;return new Promise(function(_0x5b2c7b,_0x1c9443){return db[_0x650e('0x19')]['update'](_0x38ffc5['body'],{'raw':_0x38ffc5[_0x650e('0x1b')]?_0x38ffc5['options'][_0x650e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38ffc5[_0x650e('0x1b')]?_0x38ffc5[_0x650e('0x1b')][_0x650e('0x1e')]||null:null,'attributes':_0x38ffc5['options']?_0x38ffc5[_0x650e('0x1b')]['attributes']||null:null,'limit':_0x38ffc5[_0x650e('0x1b')]?_0x38ffc5[_0x650e('0x1b')][_0x650e('0x1f')]||null:null})[_0x650e('0xc')](function(_0x45a563){logger[_0x650e('0xd')](_0x650e('0x1d'),_0x38ffc5);logger[_0x650e('0xf')](_0x650e('0x1d'),_0x38ffc5,JSON[_0x650e('0x11')](_0x45a563));_0x5b2c7b(_0x45a563);})[_0x650e('0x17')](function(_0x2cdb52){logger[_0x650e('0x12')](_0x650e('0x1d'),_0x2cdb52[_0x650e('0x15')],_0x38ffc5);_0x1c9443(_0x12450e[_0x650e('0x12')](0x1f4,_0x2cdb52[_0x650e('0x15')]));});});}; \ No newline at end of file +var _0xdb25=['error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','debug','catch','update','where','attributes','limit','UpdateOpenchannelQueueReport','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1c469b,_0x247c81){var _0x4e5014=function(_0x43a906){while(--_0x43a906){_0x1c469b['push'](_0x1c469b['shift']());}};_0x4e5014(++_0x247c81);}(_0xdb25,0x185));var _0x5db2=function(_0x5bdd2c,_0x5cd637){_0x5bdd2c=_0x5bdd2c-0x0;var _0x593f56=_0xdb25[_0x5bdd2c];return _0x593f56;};'use strict';var _=require(_0x5db2('0x0'));var util=require(_0x5db2('0x1'));var moment=require('moment');var BPromise=require(_0x5db2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5db2('0x3'));var db=require(_0x5db2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5db2('0x5'));var jayson=require(_0x5db2('0x6'));var client=jayson[_0x5db2('0x7')][_0x5db2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1846d1,_0x3199db,_0x5b097b){return new BPromise(function(_0xf57163,_0x22cd22){return client[_0x5db2('0x9')](_0x1846d1,_0x5b097b)[_0x5db2('0xa')](function(_0x5ba364){logger[_0x5db2('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3199db,'request\x20sent');logger['debug'](_0x5db2('0xc'),_0x3199db,_0x5db2('0xd'),JSON['stringify'](_0x5ba364));if(_0x5ba364['error']){if(_0x5ba364[_0x5db2('0xe')][_0x5db2('0xf')]===0x1f4){logger[_0x5db2('0xe')](_0x5db2('0x10'),_0x3199db,_0x5ba364['error'][_0x5db2('0x11')]);return _0x22cd22(_0x5ba364[_0x5db2('0xe')][_0x5db2('0x11')]);}logger[_0x5db2('0xe')](_0x5db2('0x10'),_0x3199db,_0x5ba364[_0x5db2('0xe')]['message']);return _0xf57163(_0x5ba364['error'][_0x5db2('0x11')]);}else{logger['info'](_0x5db2('0x10'),_0x3199db,_0x5db2('0xd'));_0xf57163(_0x5ba364['result'][_0x5db2('0x11')]);}})['catch'](function(_0x22b410){logger[_0x5db2('0xe')](_0x5db2('0x10'),_0x3199db,_0x22b410);_0x22cd22(_0x22b410);});});}exports[_0x5db2('0x12')]=function(_0x134990){var _0x29c5c4=this;return new Promise(function(_0x1ba3df,_0x3d7fcd){return db[_0x5db2('0x13')][_0x5db2('0x14')](_0x134990[_0x5db2('0x15')],{'raw':_0x134990['options']?_0x134990[_0x5db2('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x5db2('0xa')](function(_0xe3f768){logger['info'](_0x5db2('0x12'),_0x134990);logger[_0x5db2('0x17')](_0x5db2('0x12'),_0x134990,JSON['stringify'](_0xe3f768));_0x1ba3df(_0xe3f768);})[_0x5db2('0x18')](function(_0x649118){logger[_0x5db2('0xe')](_0x5db2('0x12'),_0x649118['message'],_0x134990);_0x3d7fcd(_0x29c5c4[_0x5db2('0xe')](0x1f4,_0x649118['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x26c532){var _0x30303e=this;return new Promise(function(_0x19b1ab,_0x31c5d8){return db[_0x5db2('0x13')][_0x5db2('0x19')](_0x26c532[_0x5db2('0x15')],{'raw':_0x26c532[_0x5db2('0x16')]?_0x26c532['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26c532[_0x5db2('0x16')]?_0x26c532[_0x5db2('0x16')][_0x5db2('0x1a')]||null:null,'attributes':_0x26c532[_0x5db2('0x16')]?_0x26c532['options'][_0x5db2('0x1b')]||null:null,'limit':_0x26c532[_0x5db2('0x16')]?_0x26c532[_0x5db2('0x16')][_0x5db2('0x1c')]||null:null})[_0x5db2('0xa')](function(_0x3c1bac){logger[_0x5db2('0xb')](_0x5db2('0x1d'),_0x26c532);logger[_0x5db2('0x17')]('UpdateOpenchannelQueueReport',_0x26c532,JSON[_0x5db2('0x1e')](_0x3c1bac));_0x19b1ab(_0x3c1bac);})['catch'](function(_0x5123b6){logger[_0x5db2('0xe')](_0x5db2('0x1d'),_0x5123b6['message'],_0x26c532);_0x31c5d8(_0x30303e[_0x5db2('0xe')](0x1f4,_0x5123b6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f97e617..c17d250 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ed3610d..d9e36a7 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d7e=['moment','sequelize','exports','ENUM','account','DATE','NOW'];(function(_0x1cdb37,_0x39e922){var _0x59ee69=function(_0x31a7b3){while(--_0x31a7b3){_0x1cdb37['push'](_0x1cdb37['shift']());}};_0x59ee69(++_0x39e922);}(_0x9d7e,0xa8));var _0xe9d7=function(_0x2a4e19,_0xa4ac77){_0x2a4e19=_0x2a4e19-0x0;var _0x3cebed=_0x9d7e[_0x2a4e19];return _0x3cebed;};'use strict';var moment=require(_0xe9d7('0x0'));var Sequelize=require(_0xe9d7('0x1'));module[_0xe9d7('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe9d7('0x3')](_0xe9d7('0x4'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xe9d7('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9d7('0x6')]}}; \ No newline at end of file +var _0x3a17=['moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x213569,_0x3554f4){var _0xb450e6=function(_0x5c5847){while(--_0x5c5847){_0x213569['push'](_0x213569['shift']());}};_0xb450e6(++_0x3554f4);}(_0x3a17,0x8c));var _0x73a1=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x3a17[_0x3e44fa];return _0x2a0aba;};'use strict';var moment=require(_0x73a1('0x0'));var Sequelize=require(_0x73a1('0x1'));module[_0x73a1('0x2')]={'uniqueid':{'type':Sequelize[_0x73a1('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x73a1('0x4')](_0x73a1('0x5'),_0x73a1('0x6'),_0x73a1('0x7')),'allowNull':![],'defaultValue':_0x73a1('0x7')},'transferredAt':{'type':Sequelize[_0x73a1('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x73a1('0x9')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index d810593..f5416f1 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1368=['limit','status','set','reject','save','update','then','destroy','error','stack','name','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','includeAll','include','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset'];(function(_0x435913,_0x2bb596){var _0x5062d6=function(_0x5968e1){while(--_0x5968e1){_0x435913['push'](_0x435913['shift']());}};_0x5062d6(++_0x2bb596);}(_0x1368,0x161));var _0x8136=function(_0x1b61fa,_0x5a8b64){_0x1b61fa=_0x1b61fa-0x0;var _0xbef2ca=_0x1368[_0x1b61fa];return _0xbef2ca;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8136('0x0'));var rimraf=require(_0x8136('0x1'));var zipdir=require(_0x8136('0x2'));var jsonpatch=require(_0x8136('0x3'));var rp=require(_0x8136('0x4'));var moment=require('moment');var BPromise=require(_0x8136('0x5'));var Mustache=require('mustache');var util=require(_0x8136('0x6'));var path=require(_0x8136('0x7'));var sox=require(_0x8136('0x8'));var csv=require('to-csv');var ejs=require(_0x8136('0x9'));var fs=require('fs');var _=require(_0x8136('0xa'));var squel=require('squel');var crypto=require(_0x8136('0xb'));var jsforce=require(_0x8136('0xc'));var deskjs=require(_0x8136('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8136('0xe'));var Papa=require(_0x8136('0xf'));var Redis=require(_0x8136('0x10'));var authService=require(_0x8136('0x11'));var qs=require(_0x8136('0x12'));var as=require(_0x8136('0x13'));var hardwareService=require(_0x8136('0x14'));var logger=require(_0x8136('0x15'))(_0x8136('0x16'));var utils=require(_0x8136('0x17'));var config=require(_0x8136('0x18'));var licenseUtil=require(_0x8136('0x19'));var db=require(_0x8136('0x1a'))['db'];function respondWithStatusCode(_0x2c6d6b,_0x55a2be){_0x55a2be=_0x55a2be||0xcc;return function(_0x3b4d06){if(_0x3b4d06){return _0x2c6d6b[_0x8136('0x1b')](_0x55a2be);}return _0x2c6d6b['status'](_0x55a2be)[_0x8136('0x1c')]();};}function respondWithResult(_0x679f54,_0x29c8c7){_0x29c8c7=_0x29c8c7||0xc8;return function(_0x336699){if(_0x336699){return _0x679f54['status'](_0x29c8c7)[_0x8136('0x1d')](_0x336699);}};}function respondWithFilteredResult(_0x1c58f5,_0x33031a){return function(_0x242615){if(_0x242615){var _0x15b8bf=_0x242615[_0x8136('0x1e')],_0x34d53f=_0x33031a[_0x8136('0x1f')],_0x143ea5=_0x33031a['offset']+_0x33031a[_0x8136('0x20')],_0x40fac4;if(_0x143ea5>=_0x15b8bf){_0x143ea5=_0x15b8bf;_0x40fac4=0xc8;}else{_0x40fac4=0xce;}_0x1c58f5[_0x8136('0x21')](_0x40fac4);return _0x1c58f5[_0x8136('0x22')]('Content-Range',_0x34d53f+'-'+_0x143ea5+'/'+_0x15b8bf)[_0x8136('0x1d')](_0x242615);}return null;};}function patchUpdates(_0x36850e){return function(_0xfb503c){try{jsonpatch['apply'](_0xfb503c,_0x36850e,!![]);}catch(_0x4324d6){return BPromise[_0x8136('0x23')](_0x4324d6);}return _0xfb503c[_0x8136('0x24')]();};}function saveUpdates(_0x594075,_0x41d6fa){return function(_0x2169dd){if(_0x2169dd){return _0x2169dd[_0x8136('0x25')](_0x594075)[_0x8136('0x26')](function(_0x95f7cb){return _0x95f7cb;});}return null;};}function removeEntity(_0x4c89d8,_0x4e110e){return function(_0x10e360){if(_0x10e360){return _0x10e360[_0x8136('0x27')]()[_0x8136('0x26')](function(){_0x4c89d8[_0x8136('0x21')](0xcc)[_0x8136('0x1c')]();});}};}function handleEntityNotFound(_0x2c343f,_0x5e837d){return function(_0x3c1ca7){if(!_0x3c1ca7){_0x2c343f[_0x8136('0x1b')](0x194);}return _0x3c1ca7;};}function handleError(_0x5b3354,_0x54e549){_0x54e549=_0x54e549||0x1f4;return function(_0x305541){logger[_0x8136('0x28')](_0x305541[_0x8136('0x29')]);if(_0x305541['name']){delete _0x305541[_0x8136('0x2a')];}_0x5b3354[_0x8136('0x21')](_0x54e549)['send'](_0x305541);};}exports['index']=function(_0x38f00b,_0x190644){var _0x1ea29c={},_0x3d8157={},_0x1a06ea={'count':0x0,'rows':[]};var _0x31d56b=_['map'](db[_0x8136('0x2b')][_0x8136('0x2c')],function(_0x43f9c9){return{'name':_0x43f9c9[_0x8136('0x2d')],'type':_0x43f9c9[_0x8136('0x2e')][_0x8136('0x2f')]};});_0x3d8157[_0x8136('0x30')]=_[_0x8136('0x31')](_0x31d56b,_0x8136('0x2a'));_0x3d8157[_0x8136('0x32')]=_[_0x8136('0x33')](_0x38f00b[_0x8136('0x32')]);_0x3d8157[_0x8136('0x34')]=_[_0x8136('0x35')](_0x3d8157[_0x8136('0x30')],_0x3d8157[_0x8136('0x32')]);_0x1ea29c['attributes']=_[_0x8136('0x35')](_0x3d8157[_0x8136('0x30')],qs[_0x8136('0x36')](_0x38f00b[_0x8136('0x32')][_0x8136('0x36')]));_0x1ea29c[_0x8136('0x37')]=_0x1ea29c[_0x8136('0x37')][_0x8136('0x38')]?_0x1ea29c[_0x8136('0x37')]:_0x3d8157['model'];if(!_0x38f00b[_0x8136('0x32')][_0x8136('0x39')](_0x8136('0x3a'))){_0x1ea29c['limit']=qs['limit'](_0x38f00b[_0x8136('0x32')][_0x8136('0x20')]);_0x1ea29c[_0x8136('0x1f')]=qs[_0x8136('0x1f')](_0x38f00b['query'][_0x8136('0x1f')]);}_0x1ea29c[_0x8136('0x3b')]=qs['sort'](_0x38f00b['query']['sort']);_0x1ea29c[_0x8136('0x3c')]=qs['filters'](_[_0x8136('0x3d')](_0x38f00b[_0x8136('0x32')],_0x3d8157[_0x8136('0x34')]),_0x31d56b);if(_0x38f00b[_0x8136('0x32')][_0x8136('0x3e')]){_0x1ea29c[_0x8136('0x3c')]=_[_0x8136('0x3f')](_0x1ea29c[_0x8136('0x3c')],{'$or':_[_0x8136('0x31')](_0x31d56b,function(_0x29b58d){if(_0x29b58d['type']!==_0x8136('0x40')){var _0x2ab7e8={};_0x2ab7e8[_0x29b58d[_0x8136('0x2a')]]={'$like':'%'+_0x38f00b[_0x8136('0x32')][_0x8136('0x3e')]+'%'};return _0x2ab7e8;}})});}_0x1ea29c=_[_0x8136('0x3f')]({},_0x1ea29c,_0x38f00b['options']);var _0x21b990={'where':_0x1ea29c[_0x8136('0x3c')]};return db['OpenchannelTransferReport'][_0x8136('0x1e')](_0x21b990)['then'](function(_0x208b1f){_0x1a06ea[_0x8136('0x1e')]=_0x208b1f;if(_0x38f00b[_0x8136('0x32')]['includeAll']){_0x1ea29c['include']=[{'all':!![]}];}return db[_0x8136('0x2b')][_0x8136('0x41')](_0x1ea29c);})[_0x8136('0x26')](function(_0x467291){_0x1a06ea[_0x8136('0x42')]=_0x467291;return _0x1a06ea;})[_0x8136('0x26')](respondWithFilteredResult(_0x190644,_0x1ea29c))[_0x8136('0x43')](handleError(_0x190644,null));};exports[_0x8136('0x44')]=function(_0x478a91,_0x3283a7){var _0x4e263f={'raw':!![],'where':{'id':_0x478a91['params']['id']}},_0x1784d0={};_0x1784d0[_0x8136('0x30')]=_[_0x8136('0x33')](db['OpenchannelTransferReport'][_0x8136('0x2c')]);_0x1784d0['query']=_[_0x8136('0x33')](_0x478a91[_0x8136('0x32')]);_0x1784d0[_0x8136('0x34')]=_[_0x8136('0x35')](_0x1784d0[_0x8136('0x30')],_0x1784d0[_0x8136('0x32')]);_0x4e263f['attributes']=_[_0x8136('0x35')](_0x1784d0[_0x8136('0x30')],qs[_0x8136('0x36')](_0x478a91[_0x8136('0x32')][_0x8136('0x36')]));_0x4e263f[_0x8136('0x37')]=_0x4e263f[_0x8136('0x37')][_0x8136('0x38')]?_0x4e263f[_0x8136('0x37')]:_0x1784d0[_0x8136('0x30')];if(_0x478a91[_0x8136('0x32')][_0x8136('0x45')]){_0x4e263f[_0x8136('0x46')]=[{'all':!![]}];}_0x4e263f=_[_0x8136('0x3f')]({},_0x4e263f,_0x478a91[_0x8136('0x47')]);return db['OpenchannelTransferReport'][_0x8136('0x48')](_0x4e263f)['then'](handleEntityNotFound(_0x3283a7,null))[_0x8136('0x26')](respondWithResult(_0x3283a7,null))[_0x8136('0x43')](handleError(_0x3283a7,null));};exports[_0x8136('0x49')]=function(_0x9877f1,_0x2db45c){return db[_0x8136('0x2b')][_0x8136('0x49')](_0x9877f1[_0x8136('0x4a')],{})['then'](respondWithResult(_0x2db45c,0xc9))[_0x8136('0x43')](handleError(_0x2db45c,null));};exports['update']=function(_0x3184fd,_0x45ace8){if(_0x3184fd[_0x8136('0x4a')]['id']){delete _0x3184fd['body']['id'];}return db[_0x8136('0x2b')][_0x8136('0x48')]({'where':{'id':_0x3184fd[_0x8136('0x4b')]['id']}})[_0x8136('0x26')](handleEntityNotFound(_0x45ace8,null))['then'](saveUpdates(_0x3184fd[_0x8136('0x4a')],null))[_0x8136('0x26')](respondWithResult(_0x45ace8,null))[_0x8136('0x43')](handleError(_0x45ace8,null));};exports['destroy']=function(_0x3a61b3,_0x3346ff){return db[_0x8136('0x2b')][_0x8136('0x48')]({'where':{'id':_0x3a61b3['params']['id']}})[_0x8136('0x26')](handleEntityNotFound(_0x3346ff,null))['then'](removeEntity(_0x3346ff,null))['catch'](handleError(_0x3346ff,null));};exports[_0x8136('0x4c')]=function(_0x483a46,_0x3e4136){return db[_0x8136('0x2b')][_0x8136('0x4c')]()[_0x8136('0x26')](respondWithResult(_0x3e4136,null))[_0x8136('0x43')](handleError(_0x3e4136,null));}; \ No newline at end of file +var _0xef98=['sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','end','error','stack','name','OpenchannelTransferReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x45c6dc,_0x46b21b){var _0x29623e=function(_0x23959a){while(--_0x23959a){_0x45c6dc['push'](_0x45c6dc['shift']());}};_0x29623e(++_0x46b21b);}(_0xef98,0x1c2));var _0x8ef9=function(_0xb63d5c,_0x509748){_0xb63d5c=_0xb63d5c-0x0;var _0x5c2ae0=_0xef98[_0xb63d5c];return _0x5c2ae0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8ef9('0x0'));var zipdir=require(_0x8ef9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ef9('0x2'));var moment=require('moment');var BPromise=require(_0x8ef9('0x3'));var Mustache=require(_0x8ef9('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8ef9('0x5'));var csv=require('to-csv');var ejs=require(_0x8ef9('0x6'));var fs=require('fs');var _=require(_0x8ef9('0x7'));var squel=require('squel');var crypto=require(_0x8ef9('0x8'));var jsforce=require(_0x8ef9('0x9'));var deskjs=require(_0x8ef9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8ef9('0xb'));var Papa=require(_0x8ef9('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ef9('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x8ef9('0xe'));var config=require(_0x8ef9('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ef9('0x10'))['db'];function respondWithStatusCode(_0x1b67fe,_0x295b08){_0x295b08=_0x295b08||0xcc;return function(_0x1267f8){if(_0x1267f8){return _0x1b67fe[_0x8ef9('0x11')](_0x295b08);}return _0x1b67fe[_0x8ef9('0x12')](_0x295b08)['end']();};}function respondWithResult(_0x325d1d,_0x38c73b){_0x38c73b=_0x38c73b||0xc8;return function(_0x44c861){if(_0x44c861){return _0x325d1d[_0x8ef9('0x12')](_0x38c73b)[_0x8ef9('0x13')](_0x44c861);}};}function respondWithFilteredResult(_0x5cbcf6,_0x1b33b8){return function(_0x4fdb0b){if(_0x4fdb0b){var _0x3f7300=_0x4fdb0b[_0x8ef9('0x14')],_0x304128=_0x1b33b8['offset'],_0x231e8a=_0x1b33b8[_0x8ef9('0x15')]+_0x1b33b8['limit'],_0x3fe308;if(_0x231e8a>=_0x3f7300){_0x231e8a=_0x3f7300;_0x3fe308=0xc8;}else{_0x3fe308=0xce;}_0x5cbcf6[_0x8ef9('0x12')](_0x3fe308);return _0x5cbcf6['set'](_0x8ef9('0x16'),_0x304128+'-'+_0x231e8a+'/'+_0x3f7300)[_0x8ef9('0x13')](_0x4fdb0b);}return null;};}function patchUpdates(_0x2b6ec4){return function(_0x5c34e8){try{jsonpatch[_0x8ef9('0x17')](_0x5c34e8,_0x2b6ec4,!![]);}catch(_0x13f434){return BPromise['reject'](_0x13f434);}return _0x5c34e8[_0x8ef9('0x18')]();};}function saveUpdates(_0x23492f,_0x3301b5){return function(_0xc4a320){if(_0xc4a320){return _0xc4a320[_0x8ef9('0x19')](_0x23492f)[_0x8ef9('0x1a')](function(_0x10d34c){return _0x10d34c;});}return null;};}function removeEntity(_0x5ee59e,_0x302aee){return function(_0x153c21){if(_0x153c21){return _0x153c21['destroy']()[_0x8ef9('0x1a')](function(){_0x5ee59e[_0x8ef9('0x12')](0xcc)[_0x8ef9('0x1b')]();});}};}function handleEntityNotFound(_0x55a779,_0x57e381){return function(_0x6a21df){if(!_0x6a21df){_0x55a779[_0x8ef9('0x11')](0x194);}return _0x6a21df;};}function handleError(_0x28b5e2,_0x50455c){_0x50455c=_0x50455c||0x1f4;return function(_0x337693){logger[_0x8ef9('0x1c')](_0x337693[_0x8ef9('0x1d')]);if(_0x337693[_0x8ef9('0x1e')]){delete _0x337693[_0x8ef9('0x1e')];}_0x28b5e2[_0x8ef9('0x12')](_0x50455c)['send'](_0x337693);};}exports['index']=function(_0x17d226,_0x401400){var _0x575ae4={},_0x3d84ca={},_0x35418a={'count':0x0,'rows':[]};var _0x5a5cbc=_['map'](db[_0x8ef9('0x1f')][_0x8ef9('0x20')],function(_0x28d499){return{'name':_0x28d499[_0x8ef9('0x21')],'type':_0x28d499[_0x8ef9('0x22')][_0x8ef9('0x23')]};});_0x3d84ca['model']=_[_0x8ef9('0x24')](_0x5a5cbc,_0x8ef9('0x1e'));_0x3d84ca[_0x8ef9('0x25')]=_[_0x8ef9('0x26')](_0x17d226[_0x8ef9('0x25')]);_0x3d84ca['filters']=_[_0x8ef9('0x27')](_0x3d84ca[_0x8ef9('0x28')],_0x3d84ca[_0x8ef9('0x25')]);_0x575ae4['attributes']=_[_0x8ef9('0x27')](_0x3d84ca[_0x8ef9('0x28')],qs[_0x8ef9('0x29')](_0x17d226[_0x8ef9('0x25')]['fields']));_0x575ae4['attributes']=_0x575ae4[_0x8ef9('0x2a')][_0x8ef9('0x2b')]?_0x575ae4['attributes']:_0x3d84ca[_0x8ef9('0x28')];if(!_0x17d226['query'][_0x8ef9('0x2c')]('nolimit')){_0x575ae4[_0x8ef9('0x2d')]=qs[_0x8ef9('0x2d')](_0x17d226[_0x8ef9('0x25')][_0x8ef9('0x2d')]);_0x575ae4[_0x8ef9('0x15')]=qs[_0x8ef9('0x15')](_0x17d226[_0x8ef9('0x25')]['offset']);}_0x575ae4[_0x8ef9('0x2e')]=qs['sort'](_0x17d226[_0x8ef9('0x25')][_0x8ef9('0x2f')]);_0x575ae4['where']=qs[_0x8ef9('0x30')](_['pick'](_0x17d226[_0x8ef9('0x25')],_0x3d84ca['filters']),_0x5a5cbc);if(_0x17d226['query'][_0x8ef9('0x31')]){_0x575ae4['where']=_[_0x8ef9('0x32')](_0x575ae4[_0x8ef9('0x33')],{'$or':_[_0x8ef9('0x24')](_0x5a5cbc,function(_0x24126b){if(_0x24126b['type']!==_0x8ef9('0x34')){var _0x49d045={};_0x49d045[_0x24126b[_0x8ef9('0x1e')]]={'$like':'%'+_0x17d226[_0x8ef9('0x25')][_0x8ef9('0x31')]+'%'};return _0x49d045;}})});}_0x575ae4=_['merge']({},_0x575ae4,_0x17d226[_0x8ef9('0x35')]);var _0x20f679={'where':_0x575ae4[_0x8ef9('0x33')]};return db[_0x8ef9('0x1f')][_0x8ef9('0x14')](_0x20f679)[_0x8ef9('0x1a')](function(_0x5460d7){_0x35418a[_0x8ef9('0x14')]=_0x5460d7;if(_0x17d226['query'][_0x8ef9('0x36')]){_0x575ae4[_0x8ef9('0x37')]=[{'all':!![]}];}return db[_0x8ef9('0x1f')][_0x8ef9('0x38')](_0x575ae4);})[_0x8ef9('0x1a')](function(_0x5c9322){_0x35418a[_0x8ef9('0x39')]=_0x5c9322;return _0x35418a;})[_0x8ef9('0x1a')](respondWithFilteredResult(_0x401400,_0x575ae4))[_0x8ef9('0x3a')](handleError(_0x401400,null));};exports[_0x8ef9('0x3b')]=function(_0x1173bb,_0x150319){var _0x2d7441={'raw':!![],'where':{'id':_0x1173bb[_0x8ef9('0x3c')]['id']}},_0x256231={};_0x256231[_0x8ef9('0x28')]=_[_0x8ef9('0x26')](db[_0x8ef9('0x1f')][_0x8ef9('0x20')]);_0x256231[_0x8ef9('0x25')]=_[_0x8ef9('0x26')](_0x1173bb[_0x8ef9('0x25')]);_0x256231[_0x8ef9('0x30')]=_[_0x8ef9('0x27')](_0x256231['model'],_0x256231[_0x8ef9('0x25')]);_0x2d7441['attributes']=_[_0x8ef9('0x27')](_0x256231[_0x8ef9('0x28')],qs['fields'](_0x1173bb[_0x8ef9('0x25')]['fields']));_0x2d7441[_0x8ef9('0x2a')]=_0x2d7441['attributes']['length']?_0x2d7441[_0x8ef9('0x2a')]:_0x256231[_0x8ef9('0x28')];if(_0x1173bb[_0x8ef9('0x25')][_0x8ef9('0x36')]){_0x2d7441['include']=[{'all':!![]}];}_0x2d7441=_[_0x8ef9('0x32')]({},_0x2d7441,_0x1173bb[_0x8ef9('0x35')]);return db[_0x8ef9('0x1f')][_0x8ef9('0x3d')](_0x2d7441)[_0x8ef9('0x1a')](handleEntityNotFound(_0x150319,null))[_0x8ef9('0x1a')](respondWithResult(_0x150319,null))['catch'](handleError(_0x150319,null));};exports[_0x8ef9('0x3e')]=function(_0x1098d3,_0x41161f){return db['OpenchannelTransferReport'][_0x8ef9('0x3e')](_0x1098d3[_0x8ef9('0x3f')],{})[_0x8ef9('0x1a')](respondWithResult(_0x41161f,0xc9))[_0x8ef9('0x3a')](handleError(_0x41161f,null));};exports[_0x8ef9('0x19')]=function(_0x3682b8,_0x16d2e8){if(_0x3682b8[_0x8ef9('0x3f')]['id']){delete _0x3682b8['body']['id'];}return db['OpenchannelTransferReport'][_0x8ef9('0x3d')]({'where':{'id':_0x3682b8[_0x8ef9('0x3c')]['id']}})[_0x8ef9('0x1a')](handleEntityNotFound(_0x16d2e8,null))[_0x8ef9('0x1a')](saveUpdates(_0x3682b8[_0x8ef9('0x3f')],null))[_0x8ef9('0x1a')](respondWithResult(_0x16d2e8,null))[_0x8ef9('0x3a')](handleError(_0x16d2e8,null));};exports['destroy']=function(_0x450472,_0x1bee53){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x450472[_0x8ef9('0x3c')]['id']}})[_0x8ef9('0x1a')](handleEntityNotFound(_0x1bee53,null))[_0x8ef9('0x1a')](removeEntity(_0x1bee53,null))[_0x8ef9('0x3a')](handleError(_0x1bee53,null));};exports[_0x8ef9('0x40')]=function(_0x26d394,_0x1d32b0){return db['OpenchannelTransferReport']['describe']()[_0x8ef9('0x1a')](respondWithResult(_0x1d32b0,null))[_0x8ef9('0x3a')](handleError(_0x1d32b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 5ddaf7b..0ae2f36 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.model.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d27=['path','rimraf','../../config/environment','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','api','moment','request-promise'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x9d27,0x19d));var _0x79d2=function(_0x17db61,_0x364236){_0x17db61=_0x17db61-0x0;var _0x7ac96b=_0x9d27[_0x17db61];return _0x7ac96b;};'use strict';var _=require(_0x79d2('0x0'));var util=require(_0x79d2('0x1'));var logger=require('../../config/logger')(_0x79d2('0x2'));var moment=require(_0x79d2('0x3'));var BPromise=require('bluebird');var rp=require(_0x79d2('0x4'));var fs=require('fs');var path=require(_0x79d2('0x5'));var rimraf=require(_0x79d2('0x6'));var config=require(_0x79d2('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x1ebaf1,_0x2690a2){return _0x1ebaf1[_0x79d2('0x8')](_0x79d2('0x9'),attributes,{'tableName':_0x79d2('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6cda=['uniqueid','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x5cb9d5,_0x5cc135){var _0x5b916b=function(_0x8233ea){while(--_0x8233ea){_0x5cb9d5['push'](_0x5cb9d5['shift']());}};_0x5b916b(++_0x5cc135);}(_0x6cda,0x1d5));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6cd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa6cd('0x1'));var rp=require(_0xa6cd('0x2'));var fs=require('fs');var path=require(_0xa6cd('0x3'));var rimraf=require(_0xa6cd('0x4'));var config=require(_0xa6cd('0x5'));var attributes=require(_0xa6cd('0x6'));module[_0xa6cd('0x7')]=function(_0xe8c69d,_0x7b1130){return _0xe8c69d[_0xa6cd('0x8')](_0xa6cd('0x9'),attributes,{'tableName':_0xa6cd('0xa'),'paranoid':![],'indexes':[{'name':_0xa6cd('0xb'),'fields':[_0xa6cd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 9d15231..c8859b1 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0159=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x473acb,_0x247eee){var _0x4fc8e3=function(_0x1e5080){while(--_0x1e5080){_0x473acb['push'](_0x473acb['shift']());}};_0x4fc8e3(++_0x247eee);}(_0x0159,0x141));var _0x9015=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0159[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9015('0x0'));var util=require(_0x9015('0x1'));var moment=require(_0x9015('0x2'));var BPromise=require(_0x9015('0x3'));var rs=require(_0x9015('0x4'));var fs=require('fs');var Redis=require(_0x9015('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9015('0x6'));var logger=require(_0x9015('0x7'))(_0x9015('0x8'));var config=require(_0x9015('0x9'));var jayson=require(_0x9015('0xa'));var client=jayson['client'][_0x9015('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21e1e2,_0x2613d,_0x2199ba){return new BPromise(function(_0x4b5a94,_0x12b505){return client[_0x9015('0xc')](_0x21e1e2,_0x2199ba)['then'](function(_0x3d6d3d){logger[_0x9015('0xd')](_0x9015('0xe'),_0x2613d,_0x9015('0xf'));logger[_0x9015('0x10')](_0x9015('0x11'),_0x2613d,_0x9015('0xf'),JSON[_0x9015('0x12')](_0x3d6d3d));if(_0x3d6d3d[_0x9015('0x13')]){if(_0x3d6d3d[_0x9015('0x13')][_0x9015('0x14')]===0x1f4){logger[_0x9015('0x13')](_0x9015('0xe'),_0x2613d,_0x3d6d3d[_0x9015('0x13')][_0x9015('0x15')]);return _0x12b505(_0x3d6d3d[_0x9015('0x13')][_0x9015('0x15')]);}logger['error'](_0x9015('0xe'),_0x2613d,_0x3d6d3d['error'][_0x9015('0x15')]);return _0x4b5a94(_0x3d6d3d[_0x9015('0x13')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2613d,_0x9015('0xf'));_0x4b5a94(_0x3d6d3d[_0x9015('0x16')][_0x9015('0x15')]);}})['catch'](function(_0x5927f1){logger[_0x9015('0x13')](_0x9015('0xe'),_0x2613d,_0x5927f1);_0x12b505(_0x5927f1);});});} \ No newline at end of file +var _0xe3aa=['request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe3aa,0x1e3));var _0xae3a=function(_0xdca029,_0xb32dcc){_0xdca029=_0xdca029-0x0;var _0x1fe14f=_0xe3aa[_0xdca029];return _0x1fe14f;};'use strict';var _=require(_0xae3a('0x0'));var util=require('util');var moment=require(_0xae3a('0x1'));var BPromise=require(_0xae3a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae3a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xae3a('0x4'))(_0xae3a('0x5'));var config=require(_0xae3a('0x6'));var jayson=require(_0xae3a('0x7'));var client=jayson['client'][_0xae3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x133ee6,_0x881969,_0x2a55d3){return new BPromise(function(_0x30638c,_0x4fe6b8){return client['request'](_0x133ee6,_0x2a55d3)[_0xae3a('0x9')](function(_0x2c4446){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x881969,_0xae3a('0xa'));logger[_0xae3a('0xb')](_0xae3a('0xc'),_0x881969,_0xae3a('0xa'),JSON['stringify'](_0x2c4446));if(_0x2c4446[_0xae3a('0xd')]){if(_0x2c4446[_0xae3a('0xd')]['code']===0x1f4){logger[_0xae3a('0xd')](_0xae3a('0xe'),_0x881969,_0x2c4446[_0xae3a('0xd')][_0xae3a('0xf')]);return _0x4fe6b8(_0x2c4446['error']['message']);}logger[_0xae3a('0xd')](_0xae3a('0xe'),_0x881969,_0x2c4446[_0xae3a('0xd')][_0xae3a('0xf')]);return _0x30638c(_0x2c4446[_0xae3a('0xd')][_0xae3a('0xf')]);}else{logger[_0xae3a('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x881969,'request\x20sent');_0x30638c(_0x2c4446['result'][_0xae3a('0xf')]);}})['catch'](function(_0x230010){logger['error'](_0xae3a('0xe'),_0x881969,_0x230010);_0x4fe6b8(_0x230010);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 11e24c6..ea5e0aa 100644 --- a/server/api/pause/index.js +++ b/server/api/pause/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe42f=['create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x2779f7,_0x578bf0){var _0x3428db=function(_0x34f663){while(--_0x34f663){_0x2779f7['push'](_0x2779f7['shift']());}};_0x3428db(++_0x578bf0);}(_0xe42f,0x15b));var _0xfe42=function(_0x51e1a6,_0xf32f3f){_0x51e1a6=_0x51e1a6-0x0;var _0x32653e=_0xe42f[_0x51e1a6];return _0x32653e;};'use strict';var multer=require('multer');var util=require(_0xfe42('0x0'));var path=require(_0xfe42('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe42('0x2'));var router=express[_0xfe42('0x3')]();var auth=require(_0xfe42('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfe42('0x5'));var controller=require('./pause.controller');router[_0xfe42('0x6')]('/',auth[_0xfe42('0x7')](),controller[_0xfe42('0x8')]);router[_0xfe42('0x6')]('/:id',auth[_0xfe42('0x7')](),controller[_0xfe42('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfe42('0xa')]);router[_0xfe42('0xb')](_0xfe42('0xc'),auth['isAuthenticated'](),controller[_0xfe42('0xd')]);router[_0xfe42('0xe')](_0xfe42('0xc'),auth[_0xfe42('0x7')](),controller[_0xfe42('0xf')]);module[_0xfe42('0x10')]=router; \ No newline at end of file +var _0x08d4=['index','/:id','post','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','./pause.controller','get','isAuthenticated'];(function(_0x226a1c,_0x31af06){var _0x11b6af=function(_0x45d9da){while(--_0x45d9da){_0x226a1c['push'](_0x226a1c['shift']());}};_0x11b6af(++_0x31af06);}(_0x08d4,0x157));var _0x408d=function(_0x2984c7,_0x2adf0a){_0x2984c7=_0x2984c7-0x0;var _0x45151f=_0x08d4[_0x2984c7];return _0x45151f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x408d('0x0'));var express=require(_0x408d('0x1'));var router=express[_0x408d('0x2')]();var auth=require(_0x408d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x408d('0x4'));router[_0x408d('0x5')]('/',auth[_0x408d('0x6')](),controller[_0x408d('0x7')]);router[_0x408d('0x5')](_0x408d('0x8'),auth[_0x408d('0x6')](),controller['show']);router[_0x408d('0x9')]('/',auth[_0x408d('0x6')](),controller['create']);router['put']('/:id',auth[_0x408d('0x6')](),controller[_0x408d('0xa')]);router[_0x408d('0xb')](_0x408d('0x8'),auth[_0x408d('0x6')](),controller[_0x408d('0xc')]);module[_0x408d('0xd')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4caea26..c3b183f 100644 --- a/server/api/pause/pause.attributes.js +++ b/server/api/pause/pause.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x733d=['name','exports','STRING'];(function(_0xe0ba38,_0x55a956){var _0x24f6a5=function(_0x2faf37){while(--_0x2faf37){_0xe0ba38['push'](_0xe0ba38['shift']());}};_0x24f6a5(++_0x55a956);}(_0x733d,0x121));var _0xd733=function(_0x1354b8,_0xa85b44){_0x1354b8=_0x1354b8-0x0;var _0x2f15ab=_0x733d[_0x1354b8];return _0x2f15ab;};'use strict';var Sequelize=require('sequelize');module[_0xd733('0x0')]={'name':{'type':Sequelize[_0xd733('0x1')],'unique':_0xd733('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe005=['exports','STRING','name','sequelize'];(function(_0x4b2f9d,_0x4093fd){var _0x1c9bd1=function(_0xdb3d12){while(--_0xdb3d12){_0x4b2f9d['push'](_0x4b2f9d['shift']());}};_0x1c9bd1(++_0x4093fd);}(_0xe005,0x1d7));var _0x5e00=function(_0x4a01a9,_0x2a5833){_0x4a01a9=_0x4a01a9-0x0;var _0x4ffd79=_0xe005[_0x4a01a9];return _0x4ffd79;};'use strict';var Sequelize=require(_0x5e00('0x0'));module[_0x5e00('0x1')]={'name':{'type':Sequelize[_0x5e00('0x2')],'unique':_0x5e00('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5e00('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b89931d..98da9c6 100644 --- a/server/api/pause/pause.controller.js +++ b/server/api/pause/pause.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf472=['stack','name','send','index','map','Pause','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','end','error'];(function(_0x2bbed7,_0x37adb2){var _0x337594=function(_0x1625b4){while(--_0x1625b4){_0x2bbed7['push'](_0x2bbed7['shift']());}};_0x337594(++_0x37adb2);}(_0xf472,0x17b));var _0x2f47=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf472[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x2f47('0x0'));var emlformat=require(_0x2f47('0x1'));var rimraf=require(_0x2f47('0x2'));var zipdir=require(_0x2f47('0x3'));var jsonpatch=require(_0x2f47('0x4'));var rp=require('request-promise');var moment=require(_0x2f47('0x5'));var BPromise=require(_0x2f47('0x6'));var Mustache=require(_0x2f47('0x7'));var util=require(_0x2f47('0x8'));var path=require(_0x2f47('0x9'));var sox=require(_0x2f47('0xa'));var csv=require(_0x2f47('0xb'));var ejs=require(_0x2f47('0xc'));var fs=require('fs');var _=require(_0x2f47('0xd'));var squel=require(_0x2f47('0xe'));var crypto=require(_0x2f47('0xf'));var jsforce=require(_0x2f47('0x10'));var deskjs=require(_0x2f47('0x11'));var toCsv=require(_0x2f47('0xb'));var querystring=require(_0x2f47('0x12'));var Papa=require(_0x2f47('0x13'));var Redis=require(_0x2f47('0x14'));var authService=require(_0x2f47('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x2f47('0x16'));var hardwareService=require(_0x2f47('0x17'));var logger=require(_0x2f47('0x18'))(_0x2f47('0x19'));var utils=require(_0x2f47('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x2f47('0x1b'));var db=require(_0x2f47('0x1c'))['db'];function respondWithStatusCode(_0x2f6162,_0x19d07c){_0x19d07c=_0x19d07c||0xcc;return function(_0x446969){if(_0x446969){return _0x2f6162[_0x2f47('0x1d')](_0x19d07c);}return _0x2f6162['status'](_0x19d07c)['end']();};}function respondWithResult(_0x1ac891,_0x354d27){_0x354d27=_0x354d27||0xc8;return function(_0x1bfd3c){if(_0x1bfd3c){return _0x1ac891[_0x2f47('0x1e')](_0x354d27)[_0x2f47('0x1f')](_0x1bfd3c);}};}function respondWithFilteredResult(_0x1dac5,_0x3ec7ae){return function(_0x13b0fe){if(_0x13b0fe){var _0x43b9ea=_0x13b0fe[_0x2f47('0x20')],_0x47dda4=_0x3ec7ae[_0x2f47('0x21')],_0x25fc73=_0x3ec7ae[_0x2f47('0x21')]+_0x3ec7ae['limit'],_0x59f43d;if(_0x25fc73>=_0x43b9ea){_0x25fc73=_0x43b9ea;_0x59f43d=0xc8;}else{_0x59f43d=0xce;}_0x1dac5['status'](_0x59f43d);return _0x1dac5[_0x2f47('0x22')]('Content-Range',_0x47dda4+'-'+_0x25fc73+'/'+_0x43b9ea)['json'](_0x13b0fe);}return null;};}function patchUpdates(_0x31a0bb){return function(_0x516b52){try{jsonpatch[_0x2f47('0x23')](_0x516b52,_0x31a0bb,!![]);}catch(_0x29c5ac){return BPromise[_0x2f47('0x24')](_0x29c5ac);}return _0x516b52[_0x2f47('0x25')]();};}function saveUpdates(_0x3576b2,_0x27d956){return function(_0x1ea983){if(_0x1ea983){return _0x1ea983[_0x2f47('0x26')](_0x3576b2)[_0x2f47('0x27')](function(_0x198224){return _0x198224;});}return null;};}function removeEntity(_0x41bcee,_0x35cb8d){return function(_0x4c1179){if(_0x4c1179){return _0x4c1179[_0x2f47('0x28')]()[_0x2f47('0x27')](function(){var _0x3baa3b=_0x4c1179[_0x2f47('0x29')]({'plain':!![]});var _0x43e4f7=_0x2f47('0x2a');return db[_0x2f47('0x2b')]['destroy']({'where':{'type':_0x43e4f7,'resourceId':_0x3baa3b['id']}})['then'](function(){return _0x4c1179;});})[_0x2f47('0x27')](function(){_0x41bcee[_0x2f47('0x1e')](0xcc)[_0x2f47('0x2c')]();});}};}function handleEntityNotFound(_0x4882ec,_0x6b51ee){return function(_0x48185f){if(!_0x48185f){_0x4882ec['sendStatus'](0x194);}return _0x48185f;};}function handleError(_0x4a2a12,_0x399f8b){_0x399f8b=_0x399f8b||0x1f4;return function(_0x3802e3){logger[_0x2f47('0x2d')](_0x3802e3[_0x2f47('0x2e')]);if(_0x3802e3['name']){delete _0x3802e3[_0x2f47('0x2f')];}_0x4a2a12[_0x2f47('0x1e')](_0x399f8b)[_0x2f47('0x30')](_0x3802e3);};}exports[_0x2f47('0x31')]=function(_0x4931d6,_0x10c4b1){var _0x13e1cb={},_0x3165cb={},_0x1651f9={'count':0x0,'rows':[]};var _0x109d57=_[_0x2f47('0x32')](db[_0x2f47('0x33')]['rawAttributes'],function(_0x2be9df){return{'name':_0x2be9df[_0x2f47('0x34')],'type':_0x2be9df[_0x2f47('0x35')][_0x2f47('0x36')]};});_0x3165cb['model']=_[_0x2f47('0x32')](_0x109d57,_0x2f47('0x2f'));_0x3165cb[_0x2f47('0x37')]=_[_0x2f47('0x38')](_0x4931d6[_0x2f47('0x37')]);_0x3165cb[_0x2f47('0x39')]=_[_0x2f47('0x3a')](_0x3165cb[_0x2f47('0x3b')],_0x3165cb[_0x2f47('0x37')]);_0x13e1cb['attributes']=_[_0x2f47('0x3a')](_0x3165cb[_0x2f47('0x3b')],qs[_0x2f47('0x3c')](_0x4931d6['query']['fields']));_0x13e1cb['attributes']=_0x13e1cb[_0x2f47('0x3d')][_0x2f47('0x3e')]?_0x13e1cb[_0x2f47('0x3d')]:_0x3165cb['model'];if(!_0x4931d6['query']['hasOwnProperty'](_0x2f47('0x3f'))){_0x13e1cb[_0x2f47('0x40')]=qs[_0x2f47('0x40')](_0x4931d6[_0x2f47('0x37')]['limit']);_0x13e1cb['offset']=qs['offset'](_0x4931d6[_0x2f47('0x37')]['offset']);}_0x13e1cb['order']=qs[_0x2f47('0x41')](_0x4931d6[_0x2f47('0x37')][_0x2f47('0x41')]);_0x13e1cb[_0x2f47('0x42')]=qs[_0x2f47('0x39')](_[_0x2f47('0x43')](_0x4931d6[_0x2f47('0x37')],_0x3165cb['filters']),_0x109d57);if(_0x4931d6[_0x2f47('0x37')][_0x2f47('0x44')]){_0x13e1cb[_0x2f47('0x42')]=_['merge'](_0x13e1cb[_0x2f47('0x42')],{'$or':_[_0x2f47('0x32')](_0x109d57,function(_0x96436c){if(_0x96436c[_0x2f47('0x35')]!=='VIRTUAL'){var _0x4a5530={};_0x4a5530[_0x96436c['name']]={'$like':'%'+_0x4931d6[_0x2f47('0x37')][_0x2f47('0x44')]+'%'};return _0x4a5530;}})});}_0x13e1cb=_[_0x2f47('0x45')]({},_0x13e1cb,_0x4931d6[_0x2f47('0x46')]);var _0x4d487e={'where':_0x13e1cb[_0x2f47('0x42')]};return db[_0x2f47('0x33')][_0x2f47('0x20')](_0x4d487e)['then'](function(_0x54a0f7){_0x1651f9[_0x2f47('0x20')]=_0x54a0f7;if(_0x4931d6[_0x2f47('0x37')][_0x2f47('0x47')]){_0x13e1cb[_0x2f47('0x48')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x13e1cb);})[_0x2f47('0x27')](function(_0x248c44){_0x1651f9[_0x2f47('0x49')]=_0x248c44;return _0x1651f9;})['then'](respondWithFilteredResult(_0x10c4b1,_0x13e1cb))[_0x2f47('0x4a')](handleError(_0x10c4b1,null));};exports['show']=function(_0x43fc40,_0x3810a8){var _0x433088={'raw':!![],'where':{'id':_0x43fc40[_0x2f47('0x4b')]['id']}},_0x3c258a={};_0x3c258a['model']=_['keys'](db['Pause'][_0x2f47('0x4c')]);_0x3c258a[_0x2f47('0x37')]=_[_0x2f47('0x38')](_0x43fc40[_0x2f47('0x37')]);_0x3c258a['filters']=_[_0x2f47('0x3a')](_0x3c258a[_0x2f47('0x3b')],_0x3c258a[_0x2f47('0x37')]);_0x433088[_0x2f47('0x3d')]=_['intersection'](_0x3c258a[_0x2f47('0x3b')],qs[_0x2f47('0x3c')](_0x43fc40['query']['fields']));_0x433088['attributes']=_0x433088[_0x2f47('0x3d')][_0x2f47('0x3e')]?_0x433088[_0x2f47('0x3d')]:_0x3c258a['model'];if(_0x43fc40['query'][_0x2f47('0x47')]){_0x433088['include']=[{'all':!![]}];}_0x433088=_[_0x2f47('0x45')]({},_0x433088,_0x43fc40[_0x2f47('0x46')]);return db['Pause'][_0x2f47('0x4d')](_0x433088)[_0x2f47('0x27')](handleEntityNotFound(_0x3810a8,null))[_0x2f47('0x27')](respondWithResult(_0x3810a8,null))[_0x2f47('0x4a')](handleError(_0x3810a8,null));};exports['create']=function(_0x37a320,_0x4fd004){return db[_0x2f47('0x33')][_0x2f47('0x4e')](_0x37a320[_0x2f47('0x4f')],{})[_0x2f47('0x27')](function(_0x3902b4){var _0x561990=_0x37a320[_0x2f47('0x50')][_0x2f47('0x29')]({'plain':!![]});if(!_0x561990)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x561990[_0x2f47('0x51')]==='user'){var _0x459db9=_0x3902b4[_0x2f47('0x29')]({'plain':!![]});var _0x33cc88=_0x2f47('0x2a');return db['UserProfileSection'][_0x2f47('0x4d')]({'where':{'name':_0x33cc88,'userProfileId':_0x561990[_0x2f47('0x52')]},'raw':!![]})['then'](function(_0x124f44){if(_0x124f44&&_0x124f44[_0x2f47('0x53')]===0x0){return db[_0x2f47('0x2b')][_0x2f47('0x4e')]({'name':_0x459db9['name'],'resourceId':_0x459db9['id'],'type':_0x124f44['name'],'sectionId':_0x124f44['id']},{})['then'](function(){return _0x3902b4;});}else{return _0x3902b4;}})[_0x2f47('0x4a')](function(_0x1b8d4f){logger['error'](_0x2f47('0x54'),_0x1b8d4f);throw _0x1b8d4f;});}return _0x3902b4;})['then'](respondWithResult(_0x4fd004,0xc9))[_0x2f47('0x4a')](handleError(_0x4fd004,null));};exports[_0x2f47('0x26')]=function(_0x28edb0,_0x3af0fe){if(_0x28edb0[_0x2f47('0x4f')]['id']){delete _0x28edb0['body']['id'];}return db[_0x2f47('0x33')][_0x2f47('0x4d')]({'where':{'id':_0x28edb0[_0x2f47('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3af0fe,null))[_0x2f47('0x27')](saveUpdates(_0x28edb0[_0x2f47('0x4f')],null))[_0x2f47('0x27')](respondWithResult(_0x3af0fe,null))['catch'](handleError(_0x3af0fe,null));};exports[_0x2f47('0x28')]=function(_0x505347,_0x120771){return db[_0x2f47('0x33')][_0x2f47('0x4d')]({'where':{'id':_0x505347[_0x2f47('0x4b')]['id']}})[_0x2f47('0x27')](handleEntityNotFound(_0x120771,null))[_0x2f47('0x27')](removeEntity(_0x120771,null))['catch'](handleError(_0x120771,null));}; \ No newline at end of file +var _0xdd03=['offset','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','Pause','findAll','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','set','Content-Range','save','update','then','destroy','get','Pauses','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length'];(function(_0x3d141f,_0x436724){var _0x4e214b=function(_0x467151){while(--_0x467151){_0x3d141f['push'](_0x3d141f['shift']());}};_0x4e214b(++_0x436724);}(_0xdd03,0xb8));var _0x3dd0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdd03[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3dd0('0x0'));var zipdir=require(_0x3dd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3dd0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3dd0('0x3'));var util=require('util');var path=require(_0x3dd0('0x4'));var sox=require(_0x3dd0('0x5'));var csv=require(_0x3dd0('0x6'));var ejs=require(_0x3dd0('0x7'));var fs=require('fs');var _=require(_0x3dd0('0x8'));var squel=require(_0x3dd0('0x9'));var crypto=require(_0x3dd0('0xa'));var jsforce=require(_0x3dd0('0xb'));var deskjs=require(_0x3dd0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3dd0('0xd'));var Redis=require(_0x3dd0('0xe'));var authService=require(_0x3dd0('0xf'));var qs=require(_0x3dd0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dd0('0x11'))(_0x3dd0('0x12'));var utils=require(_0x3dd0('0x13'));var config=require(_0x3dd0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3dd0('0x15'))['db'];function respondWithStatusCode(_0x594bc9,_0x576148){_0x576148=_0x576148||0xcc;return function(_0x4de4ce){if(_0x4de4ce){return _0x594bc9[_0x3dd0('0x16')](_0x576148);}return _0x594bc9['status'](_0x576148)[_0x3dd0('0x17')]();};}function respondWithResult(_0xe70a00,_0x3e156b){_0x3e156b=_0x3e156b||0xc8;return function(_0xb37029){if(_0xb37029){return _0xe70a00[_0x3dd0('0x18')](_0x3e156b)[_0x3dd0('0x19')](_0xb37029);}};}function respondWithFilteredResult(_0xde009b,_0x5de596){return function(_0xa74cf1){if(_0xa74cf1){var _0x44e85d=_0xa74cf1['count'],_0x7cbfac=_0x5de596['offset'],_0x8ce164=_0x5de596['offset']+_0x5de596[_0x3dd0('0x1a')],_0x414008;if(_0x8ce164>=_0x44e85d){_0x8ce164=_0x44e85d;_0x414008=0xc8;}else{_0x414008=0xce;}_0xde009b[_0x3dd0('0x18')](_0x414008);return _0xde009b[_0x3dd0('0x1b')](_0x3dd0('0x1c'),_0x7cbfac+'-'+_0x8ce164+'/'+_0x44e85d)[_0x3dd0('0x19')](_0xa74cf1);}return null;};}function patchUpdates(_0x56209b){return function(_0x383688){try{jsonpatch['apply'](_0x383688,_0x56209b,!![]);}catch(_0x11ef3a){return BPromise['reject'](_0x11ef3a);}return _0x383688[_0x3dd0('0x1d')]();};}function saveUpdates(_0x108e25,_0x44a7cb){return function(_0x317b41){if(_0x317b41){return _0x317b41[_0x3dd0('0x1e')](_0x108e25)[_0x3dd0('0x1f')](function(_0x55b56d){return _0x55b56d;});}return null;};}function removeEntity(_0x113776,_0x33426f){return function(_0x4b8425){if(_0x4b8425){return _0x4b8425[_0x3dd0('0x20')]()['then'](function(){var _0x5a1ec9=_0x4b8425[_0x3dd0('0x21')]({'plain':!![]});var _0x25364b=_0x3dd0('0x22');return db['UserProfileResource'][_0x3dd0('0x20')]({'where':{'type':_0x25364b,'resourceId':_0x5a1ec9['id']}})[_0x3dd0('0x1f')](function(){return _0x4b8425;});})[_0x3dd0('0x1f')](function(){_0x113776[_0x3dd0('0x18')](0xcc)[_0x3dd0('0x17')]();});}};}function handleEntityNotFound(_0x26b615,_0x320703){return function(_0x3f520c){if(!_0x3f520c){_0x26b615['sendStatus'](0x194);}return _0x3f520c;};}function handleError(_0x301c2c,_0x143c5a){_0x143c5a=_0x143c5a||0x1f4;return function(_0x56d71c){logger['error'](_0x56d71c[_0x3dd0('0x23')]);if(_0x56d71c['name']){delete _0x56d71c[_0x3dd0('0x24')];}_0x301c2c[_0x3dd0('0x18')](_0x143c5a)['send'](_0x56d71c);};}exports[_0x3dd0('0x25')]=function(_0x28374d,_0x30dc3c){var _0x315fce={},_0x37f7e7={},_0x4a94c6={'count':0x0,'rows':[]};var _0x5b5c23=_[_0x3dd0('0x26')](db['Pause'][_0x3dd0('0x27')],function(_0x576625){return{'name':_0x576625[_0x3dd0('0x28')],'type':_0x576625['type'][_0x3dd0('0x29')]};});_0x37f7e7['model']=_[_0x3dd0('0x26')](_0x5b5c23,_0x3dd0('0x24'));_0x37f7e7[_0x3dd0('0x2a')]=_[_0x3dd0('0x2b')](_0x28374d[_0x3dd0('0x2a')]);_0x37f7e7[_0x3dd0('0x2c')]=_['intersection'](_0x37f7e7[_0x3dd0('0x2d')],_0x37f7e7[_0x3dd0('0x2a')]);_0x315fce[_0x3dd0('0x2e')]=_[_0x3dd0('0x2f')](_0x37f7e7['model'],qs[_0x3dd0('0x30')](_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x30')]));_0x315fce[_0x3dd0('0x2e')]=_0x315fce[_0x3dd0('0x2e')][_0x3dd0('0x31')]?_0x315fce['attributes']:_0x37f7e7[_0x3dd0('0x2d')];if(!_0x28374d[_0x3dd0('0x2a')]['hasOwnProperty']('nolimit')){_0x315fce['limit']=qs[_0x3dd0('0x1a')](_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x1a')]);_0x315fce[_0x3dd0('0x32')]=qs[_0x3dd0('0x32')](_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x32')]);}_0x315fce[_0x3dd0('0x33')]=qs[_0x3dd0('0x34')](_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x34')]);_0x315fce[_0x3dd0('0x35')]=qs['filters'](_[_0x3dd0('0x36')](_0x28374d[_0x3dd0('0x2a')],_0x37f7e7[_0x3dd0('0x2c')]),_0x5b5c23);if(_0x28374d[_0x3dd0('0x2a')]['filter']){_0x315fce['where']=_[_0x3dd0('0x37')](_0x315fce['where'],{'$or':_[_0x3dd0('0x26')](_0x5b5c23,function(_0x2dc6e4){if(_0x2dc6e4['type']!==_0x3dd0('0x38')){var _0x20c10f={};_0x20c10f[_0x2dc6e4[_0x3dd0('0x24')]]={'$like':'%'+_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x39')]+'%'};return _0x20c10f;}})});}_0x315fce=_[_0x3dd0('0x37')]({},_0x315fce,_0x28374d[_0x3dd0('0x3a')]);var _0x217ac3={'where':_0x315fce['where']};return db['Pause'][_0x3dd0('0x3b')](_0x217ac3)[_0x3dd0('0x1f')](function(_0x3557bf){_0x4a94c6['count']=_0x3557bf;if(_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x3c')]){_0x315fce[_0x3dd0('0x3d')]=[{'all':!![]}];}return db[_0x3dd0('0x3e')][_0x3dd0('0x3f')](_0x315fce);})[_0x3dd0('0x1f')](function(_0x146d6c){_0x4a94c6['rows']=_0x146d6c;return _0x4a94c6;})[_0x3dd0('0x1f')](respondWithFilteredResult(_0x30dc3c,_0x315fce))['catch'](handleError(_0x30dc3c,null));};exports[_0x3dd0('0x40')]=function(_0x424a5c,_0x1608c5){var _0x26699c={'raw':!![],'where':{'id':_0x424a5c[_0x3dd0('0x41')]['id']}},_0x4b40fd={};_0x4b40fd[_0x3dd0('0x2d')]=_[_0x3dd0('0x2b')](db[_0x3dd0('0x3e')][_0x3dd0('0x27')]);_0x4b40fd[_0x3dd0('0x2a')]=_[_0x3dd0('0x2b')](_0x424a5c['query']);_0x4b40fd[_0x3dd0('0x2c')]=_[_0x3dd0('0x2f')](_0x4b40fd['model'],_0x4b40fd['query']);_0x26699c[_0x3dd0('0x2e')]=_[_0x3dd0('0x2f')](_0x4b40fd[_0x3dd0('0x2d')],qs[_0x3dd0('0x30')](_0x424a5c[_0x3dd0('0x2a')][_0x3dd0('0x30')]));_0x26699c[_0x3dd0('0x2e')]=_0x26699c[_0x3dd0('0x2e')][_0x3dd0('0x31')]?_0x26699c[_0x3dd0('0x2e')]:_0x4b40fd[_0x3dd0('0x2d')];if(_0x424a5c[_0x3dd0('0x2a')][_0x3dd0('0x3c')]){_0x26699c[_0x3dd0('0x3d')]=[{'all':!![]}];}_0x26699c=_[_0x3dd0('0x37')]({},_0x26699c,_0x424a5c[_0x3dd0('0x3a')]);return db['Pause'][_0x3dd0('0x42')](_0x26699c)['then'](handleEntityNotFound(_0x1608c5,null))[_0x3dd0('0x1f')](respondWithResult(_0x1608c5,null))[_0x3dd0('0x43')](handleError(_0x1608c5,null));};exports[_0x3dd0('0x44')]=function(_0x3d3468,_0x569d04){return db[_0x3dd0('0x3e')]['create'](_0x3d3468[_0x3dd0('0x45')],{})[_0x3dd0('0x1f')](function(_0x7616d1){var _0x1c9f8a=_0x3d3468['user'][_0x3dd0('0x21')]({'plain':!![]});if(!_0x1c9f8a)throw new Error(_0x3dd0('0x46'));if(_0x1c9f8a[_0x3dd0('0x47')]==='user'){var _0x431712=_0x7616d1[_0x3dd0('0x21')]({'plain':!![]});var _0x5e7103='Pauses';return db[_0x3dd0('0x48')][_0x3dd0('0x42')]({'where':{'name':_0x5e7103,'userProfileId':_0x1c9f8a[_0x3dd0('0x49')]},'raw':!![]})['then'](function(_0x5cfc0b){if(_0x5cfc0b&&_0x5cfc0b[_0x3dd0('0x4a')]===0x0){return db[_0x3dd0('0x4b')]['create']({'name':_0x431712[_0x3dd0('0x24')],'resourceId':_0x431712['id'],'type':_0x5cfc0b['name'],'sectionId':_0x5cfc0b['id']},{})[_0x3dd0('0x1f')](function(){return _0x7616d1;});}else{return _0x7616d1;}})[_0x3dd0('0x43')](function(_0x3925d1){logger[_0x3dd0('0x4c')](_0x3dd0('0x4d'),_0x3925d1);throw _0x3925d1;});}return _0x7616d1;})[_0x3dd0('0x1f')](respondWithResult(_0x569d04,0xc9))[_0x3dd0('0x43')](handleError(_0x569d04,null));};exports[_0x3dd0('0x1e')]=function(_0xfc7594,_0x1fbc38){if(_0xfc7594[_0x3dd0('0x45')]['id']){delete _0xfc7594[_0x3dd0('0x45')]['id'];}return db[_0x3dd0('0x3e')][_0x3dd0('0x42')]({'where':{'id':_0xfc7594['params']['id']}})[_0x3dd0('0x1f')](handleEntityNotFound(_0x1fbc38,null))['then'](saveUpdates(_0xfc7594[_0x3dd0('0x45')],null))[_0x3dd0('0x1f')](respondWithResult(_0x1fbc38,null))[_0x3dd0('0x43')](handleError(_0x1fbc38,null));};exports[_0x3dd0('0x20')]=function(_0x798151,_0x292f1c){return db[_0x3dd0('0x3e')][_0x3dd0('0x42')]({'where':{'id':_0x798151[_0x3dd0('0x41')]['id']}})[_0x3dd0('0x1f')](handleEntityNotFound(_0x292f1c,null))[_0x3dd0('0x1f')](removeEntity(_0x292f1c,null))['catch'](handleError(_0x292f1c,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a9115e0..86c99be 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x758a=['api','moment','bluebird','../../config/environment','exports','tools_pauses','lodash','util','../../config/logger'];(function(_0x4b1f74,_0x52fa13){var _0xd7d282=function(_0xb4213){while(--_0xb4213){_0x4b1f74['push'](_0x4b1f74['shift']());}};_0xd7d282(++_0x52fa13);}(_0x758a,0x1d1));var _0xa758=function(_0x10a6b6,_0x974621){_0x10a6b6=_0x10a6b6-0x0;var _0x2c5fe7=_0x758a[_0x10a6b6];return _0x2c5fe7;};'use strict';var _=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var logger=require(_0xa758('0x2'))(_0xa758('0x3'));var moment=require(_0xa758('0x4'));var BPromise=require(_0xa758('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa758('0x6'));var attributes=require('./pause.attributes');module[_0xa758('0x7')]=function(_0xa38e27,_0x1c13d4){return _0xa38e27['define']('Pause',attributes,{'tableName':_0xa758('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a3c=['moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger'];(function(_0x4fa4fd,_0x4c656b){var _0x3c50d0=function(_0x223600){while(--_0x223600){_0x4fa4fd['push'](_0x4fa4fd['shift']());}};_0x3c50d0(++_0x4c656b);}(_0x5a3c,0x176));var _0xc5a3=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x5a3c[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var logger=require(_0xc5a3('0x2'))('api');var moment=require(_0xc5a3('0x3'));var BPromise=require(_0xc5a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5a3('0x5'));var rimraf=require(_0xc5a3('0x6'));var config=require(_0xc5a3('0x7'));var attributes=require(_0xc5a3('0x8'));module[_0xc5a3('0x9')]=function(_0x44a036,_0xb0f633){return _0x44a036[_0xc5a3('0xa')](_0xc5a3('0xb'),attributes,{'tableName':_0xc5a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 68da2e4..66877f0 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ac0=['Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowPause','Pause','options','raw','where','include','attributes','map','model','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent'];(function(_0x2fbcf6,_0x4cccfb){var _0xef7509=function(_0x422e9a){while(--_0x422e9a){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0xef7509(++_0x4cccfb);}(_0x4ac0,0xa0));var _0x04ac=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4ac0[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x04ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x04ac('0x1'));var fs=require('fs');var Redis=require(_0x04ac('0x2'));var db=require(_0x04ac('0x3'))['db'];var utils=require(_0x04ac('0x4'));var logger=require(_0x04ac('0x5'))(_0x04ac('0x6'));var config=require('../../config/environment');var jayson=require(_0x04ac('0x7'));var client=jayson['client'][_0x04ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5020a2,_0x1b3b2a,_0x229171){return new BPromise(function(_0x51c524,_0x68d656){return client[_0x04ac('0x9')](_0x5020a2,_0x229171)[_0x04ac('0xa')](function(_0xdb1162){logger[_0x04ac('0xb')](_0x04ac('0xc'),_0x1b3b2a,_0x04ac('0xd'));logger['debug'](_0x04ac('0xe'),_0x1b3b2a,'request\x20sent',JSON[_0x04ac('0xf')](_0xdb1162));if(_0xdb1162[_0x04ac('0x10')]){if(_0xdb1162['error'][_0x04ac('0x11')]===0x1f4){logger[_0x04ac('0x10')](_0x04ac('0xc'),_0x1b3b2a,_0xdb1162['error'][_0x04ac('0x12')]);return _0x68d656(_0xdb1162[_0x04ac('0x10')][_0x04ac('0x12')]);}logger[_0x04ac('0x10')]('Pause,\x20%s,\x20%s',_0x1b3b2a,_0xdb1162[_0x04ac('0x10')][_0x04ac('0x12')]);return _0x51c524(_0xdb1162[_0x04ac('0x10')]['message']);}else{logger[_0x04ac('0xb')](_0x04ac('0xc'),_0x1b3b2a,'request\x20sent');_0x51c524(_0xdb1162['result'][_0x04ac('0x12')]);}})['catch'](function(_0x1da147){logger[_0x04ac('0x10')](_0x04ac('0xc'),_0x1b3b2a,_0x1da147);_0x68d656(_0x1da147);});});}exports[_0x04ac('0x13')]=function(_0x30a78b){var _0x58535a=this;return new Promise(function(_0x154e66,_0x1f213d){return db[_0x04ac('0x14')]['find']({'raw':_0x30a78b[_0x04ac('0x15')]?_0x30a78b['options'][_0x04ac('0x16')]===undefined?!![]:![]:!![],'where':_0x30a78b[_0x04ac('0x15')]?_0x30a78b[_0x04ac('0x15')][_0x04ac('0x17')]||null:null,'attributes':_0x30a78b['options']?_0x30a78b[_0x04ac('0x15')]['attributes']||null:null,'include':_0x30a78b[_0x04ac('0x15')]?_0x30a78b[_0x04ac('0x15')][_0x04ac('0x18')]?_['map'](_0x30a78b[_0x04ac('0x15')][_0x04ac('0x18')],function(_0x443ef1){return{'model':db[_0x443ef1['model']],'as':_0x443ef1['as'],'attributes':_0x443ef1[_0x04ac('0x19')],'include':_0x443ef1[_0x04ac('0x18')]?_[_0x04ac('0x1a')](_0x443ef1['include'],function(_0x364525){return{'model':db[_0x364525[_0x04ac('0x1b')]],'as':_0x364525['as'],'attributes':_0x364525[_0x04ac('0x19')],'include':_0x364525[_0x04ac('0x18')]?_['map'](_0x364525['include'],function(_0x1e0e3a){return{'model':db[_0x1e0e3a['model']],'as':_0x1e0e3a['as'],'attributes':_0x1e0e3a[_0x04ac('0x19')]};}):[]};}):[]};}):[]:[]})[_0x04ac('0xa')](function(_0x17c87e){logger[_0x04ac('0xb')](_0x04ac('0x13'),_0x30a78b);logger['debug']('ShowPause',_0x30a78b,JSON['stringify'](_0x17c87e));_0x154e66(_0x17c87e);})[_0x04ac('0x1c')](function(_0x23ae7b){logger[_0x04ac('0x10')](_0x04ac('0x13'),_0x23ae7b['message'],_0x30a78b);_0x1f213d(_0x58535a[_0x04ac('0x10')](0x1f4,_0x23ae7b['message']));});});}; \ No newline at end of file +var _0xfb16=['error','code','message','catch','Pause','find','options','raw','where','include','model','attributes','map','then','ShowPause','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x133f28,_0x183bd9){var _0x39f67b=function(_0x4d705b){while(--_0x4d705b){_0x133f28['push'](_0x133f28['shift']());}};_0x39f67b(++_0x183bd9);}(_0xfb16,0xd6));var _0x6fb1=function(_0x4635bc,_0x89606d){_0x4635bc=_0x4635bc-0x0;var _0x505aec=_0xfb16[_0x4635bc];return _0x505aec;};'use strict';var _=require(_0x6fb1('0x0'));var util=require(_0x6fb1('0x1'));var moment=require(_0x6fb1('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fb1('0x3'));var fs=require('fs');var Redis=require(_0x6fb1('0x4'));var db=require(_0x6fb1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fb1('0x6'))(_0x6fb1('0x7'));var config=require(_0x6fb1('0x8'));var jayson=require(_0x6fb1('0x9'));var client=jayson['client'][_0x6fb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f6672,_0xd7fa1b,_0x3aaa52){return new BPromise(function(_0x1d9f80,_0x204dc5){return client[_0x6fb1('0xb')](_0x1f6672,_0x3aaa52)['then'](function(_0x59fdcc){logger[_0x6fb1('0xc')](_0x6fb1('0xd'),_0xd7fa1b,_0x6fb1('0xe'));logger['debug'](_0x6fb1('0xf'),_0xd7fa1b,'request\x20sent',JSON[_0x6fb1('0x10')](_0x59fdcc));if(_0x59fdcc[_0x6fb1('0x11')]){if(_0x59fdcc[_0x6fb1('0x11')][_0x6fb1('0x12')]===0x1f4){logger[_0x6fb1('0x11')](_0x6fb1('0xd'),_0xd7fa1b,_0x59fdcc[_0x6fb1('0x11')][_0x6fb1('0x13')]);return _0x204dc5(_0x59fdcc['error'][_0x6fb1('0x13')]);}logger[_0x6fb1('0x11')](_0x6fb1('0xd'),_0xd7fa1b,_0x59fdcc['error'][_0x6fb1('0x13')]);return _0x1d9f80(_0x59fdcc[_0x6fb1('0x11')][_0x6fb1('0x13')]);}else{logger[_0x6fb1('0xc')](_0x6fb1('0xd'),_0xd7fa1b,'request\x20sent');_0x1d9f80(_0x59fdcc['result'][_0x6fb1('0x13')]);}})[_0x6fb1('0x14')](function(_0x55bdf6){logger['error'](_0x6fb1('0xd'),_0xd7fa1b,_0x55bdf6);_0x204dc5(_0x55bdf6);});});}exports['ShowPause']=function(_0xae1417){var _0x17e350=this;return new Promise(function(_0x5a0371,_0x10a5c2){return db[_0x6fb1('0x15')][_0x6fb1('0x16')]({'raw':_0xae1417[_0x6fb1('0x17')]?_0xae1417[_0x6fb1('0x17')][_0x6fb1('0x18')]===undefined?!![]:![]:!![],'where':_0xae1417['options']?_0xae1417['options'][_0x6fb1('0x19')]||null:null,'attributes':_0xae1417['options']?_0xae1417[_0x6fb1('0x17')]['attributes']||null:null,'include':_0xae1417[_0x6fb1('0x17')]?_0xae1417['options'][_0x6fb1('0x1a')]?_['map'](_0xae1417[_0x6fb1('0x17')]['include'],function(_0x5771c5){return{'model':db[_0x5771c5[_0x6fb1('0x1b')]],'as':_0x5771c5['as'],'attributes':_0x5771c5['attributes'],'include':_0x5771c5[_0x6fb1('0x1a')]?_['map'](_0x5771c5[_0x6fb1('0x1a')],function(_0x1505de){return{'model':db[_0x1505de[_0x6fb1('0x1b')]],'as':_0x1505de['as'],'attributes':_0x1505de[_0x6fb1('0x1c')],'include':_0x1505de[_0x6fb1('0x1a')]?_[_0x6fb1('0x1d')](_0x1505de['include'],function(_0x156cb1){return{'model':db[_0x156cb1['model']],'as':_0x156cb1['as'],'attributes':_0x156cb1['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fb1('0x1e')](function(_0x104a97){logger[_0x6fb1('0xc')](_0x6fb1('0x1f'),_0xae1417);logger[_0x6fb1('0x20')](_0x6fb1('0x1f'),_0xae1417,JSON[_0x6fb1('0x10')](_0x104a97));_0x5a0371(_0x104a97);})[_0x6fb1('0x14')](function(_0x3f26cc){logger['error'](_0x6fb1('0x1f'),_0x3f26cc[_0x6fb1('0x13')],_0xae1417);_0x10a5c2(_0x17e350[_0x6fb1('0x11')](0x1f4,_0x3f26cc[_0x6fb1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 96be9b7..6ef5ed0 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a2d=['root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage'];(function(_0x4c1dcf,_0x56b757){var _0x153529=function(_0x43e02b){while(--_0x43e02b){_0x4c1dcf['push'](_0x4c1dcf['shift']());}};_0x153529(++_0x56b757);}(_0x0a2d,0x170));var _0xd0a2=function(_0x531a73,_0x41f70b){_0x531a73=_0x531a73-0x0;var _0x2526b1=_0x0a2d[_0x531a73];return _0x2526b1;};'use strict';var multer=require('multer');var util=require(_0xd0a2('0x0'));var path=require('path');var timeout=require(_0xd0a2('0x1'));var express=require(_0xd0a2('0x2'));var router=express['Router']();var auth=require(_0xd0a2('0x3'));var interaction=require(_0xd0a2('0x4'));var config=require(_0xd0a2('0x5'));var controller=require(_0xd0a2('0x6'));router['get']('/',auth[_0xd0a2('0x7')](),controller[_0xd0a2('0x8')]);router[_0xd0a2('0x9')](_0xd0a2('0xa'),controller[_0xd0a2('0xb')]);router[_0xd0a2('0x9')](_0xd0a2('0xc'),auth[_0xd0a2('0x7')](),controller['show']);router[_0xd0a2('0x9')](_0xd0a2('0xd'),auth[_0xd0a2('0x7')](),controller[_0xd0a2('0xe')]);var upload=multer({'storage':multer[_0xd0a2('0xf')]({'destination':function(_0xb89476,_0x49c1cd,_0x311169){_0x311169(null,path['join'](config[_0xd0a2('0x10')],'server/files/plugins'));},'filename':function(_0x5eec52,_0x2990d3,_0x3e3be0){_0x2990d3[_0xd0a2('0x11')]=_0x2990d3[_0xd0a2('0x11')][_0xd0a2('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e3be0(null,util[_0xd0a2('0x13')](_0xd0a2('0x14'),path[_0xd0a2('0x15')](_0x2990d3['originalname'],path[_0xd0a2('0x16')](_0x2990d3[_0xd0a2('0x11')])),Date[_0xd0a2('0x17')](),path[_0xd0a2('0x16')](_0x2990d3['originalname'])));}})});router[_0xd0a2('0x18')]('/',upload[_0xd0a2('0x19')](_0xd0a2('0x1a')),controller[_0xd0a2('0x1b')]);router[_0xd0a2('0x18')]('/webhook',controller[_0xd0a2('0x1c')]);router[_0xd0a2('0x1d')](_0xd0a2('0xc'),auth[_0xd0a2('0x7')](),controller[_0xd0a2('0x1e')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd0a2('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x20b5=['get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','diskStorage','root','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller'];(function(_0x117475,_0xb11d93){var _0xdb578b=function(_0x5eb15a){while(--_0x5eb15a){_0x117475['push'](_0x117475['shift']());}};_0xdb578b(++_0xb11d93);}(_0x20b5,0xf8));var _0x520b=function(_0x589914,_0x202fff){_0x589914=_0x589914-0x0;var _0x17ef31=_0x20b5[_0x589914];return _0x17ef31;};'use strict';var multer=require(_0x520b('0x0'));var util=require(_0x520b('0x1'));var path=require(_0x520b('0x2'));var timeout=require('connect-timeout');var express=require(_0x520b('0x3'));var router=express['Router']();var auth=require(_0x520b('0x4'));var interaction=require(_0x520b('0x5'));var config=require(_0x520b('0x6'));var controller=require(_0x520b('0x7'));router[_0x520b('0x8')]('/',auth[_0x520b('0x9')](),controller[_0x520b('0xa')]);router['get'](_0x520b('0xb'),controller[_0x520b('0xc')]);router[_0x520b('0x8')]('/:id',auth[_0x520b('0x9')](),controller[_0x520b('0xd')]);router['get'](_0x520b('0xe'),auth[_0x520b('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x520b('0xf')]({'destination':function(_0x1afe85,_0x33d05c,_0x2274c2){_0x2274c2(null,path['join'](config[_0x520b('0x10')],'server/files/plugins'));},'filename':function(_0xe3a7b0,_0xc18fb2,_0x24d692){_0xc18fb2[_0x520b('0x11')]=_0xc18fb2[_0x520b('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x24d692(null,util[_0x520b('0x12')](_0x520b('0x13'),path[_0x520b('0x14')](_0xc18fb2[_0x520b('0x11')],path[_0x520b('0x15')](_0xc18fb2[_0x520b('0x11')])),Date[_0x520b('0x16')](),path[_0x520b('0x15')](_0xc18fb2[_0x520b('0x11')])));}})});router[_0x520b('0x17')]('/',upload[_0x520b('0x18')](_0x520b('0x19')),controller[_0x520b('0x1a')]);router[_0x520b('0x17')](_0x520b('0xb'),controller[_0x520b('0x1b')]);router[_0x520b('0x1c')](_0x520b('0x1d'),auth[_0x520b('0x9')](),controller[_0x520b('0x1e')]);router[_0x520b('0x1f')](_0x520b('0x1d'),auth[_0x520b('0x9')](),controller[_0x520b('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index c50c66b..441f183 100644 --- a/server/api/plugin/plugin.attributes.js +++ b/server/api/plugin/plugin.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a85=['html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x2a85,0x176));var _0x52a8=function(_0x5ea05f,_0x227fe7){_0x5ea05f=_0x5ea05f-0x0;var _0x4e23c8=_0x2a85[_0x5ea05f];return _0x4e23c8;};'use strict';var Sequelize=require('sequelize');module[_0x52a8('0x0')]={'name':{'type':Sequelize[_0x52a8('0x1')]},'type':{'type':Sequelize[_0x52a8('0x2')](_0x52a8('0x3'),_0x52a8('0x4'))},'description':{'type':Sequelize[_0x52a8('0x5')]},'version':{'type':Sequelize[_0x52a8('0x5')]},'path':{'type':Sequelize[_0x52a8('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x52a8('0x6')],'defaultValue':0x0,'comment':_0x52a8('0x7')},'sidebar':{'type':Sequelize[_0x52a8('0x2')](_0x52a8('0x8'),_0x52a8('0x9'),_0x52a8('0xa'),_0x52a8('0xb')),'defaultValue':'always','comment':_0x52a8('0xc')},'icon':{'type':Sequelize[_0x52a8('0x1')]},'adminUrl':{'type':Sequelize[_0x52a8('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x52a8('0x1')]}}; \ No newline at end of file +var _0xd688=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM','adminOnly'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd688,0x13c));var _0x8d68=function(_0x4172e8,_0x324975){_0x4172e8=_0x4172e8-0x0;var _0x235ee2=_0xd688[_0x4172e8];return _0x235ee2;};'use strict';var Sequelize=require(_0x8d68('0x0'));module[_0x8d68('0x1')]={'name':{'type':Sequelize[_0x8d68('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0x8d68('0x3'))},'description':{'type':Sequelize[_0x8d68('0x4')]},'version':{'type':Sequelize[_0x8d68('0x4')]},'path':{'type':Sequelize[_0x8d68('0x2')],'comment':_0x8d68('0x5')},'active':{'type':Sequelize[_0x8d68('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x8d68('0x7')](_0x8d68('0x8'),_0x8d68('0x9'),_0x8d68('0xa'),_0x8d68('0xb')),'defaultValue':_0x8d68('0xa'),'comment':_0x8d68('0xc')},'icon':{'type':Sequelize[_0x8d68('0x2')]},'adminUrl':{'type':Sequelize[_0x8d68('0x2')]},'agentUrl':{'type':Sequelize[_0x8d68('0x2')]},'scriptName':{'type':Sequelize[_0x8d68('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index c09f79b..6871135 100644 --- a/server/api/plugin/plugin.controller.js +++ b/server/api/plugin/plugin.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66f8=['get','Plugins','UserProfileResource','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','Plugin','find','download','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','**/*','join','dirname','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','file','filename','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','role','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','hostname','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','end','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x55df00,_0x175230){var _0x5a28c3=function(_0x46b911){while(--_0x46b911){_0x55df00['push'](_0x55df00['shift']());}};_0x5a28c3(++_0x175230);}(_0x66f8,0x7d));var _0x866f=function(_0x6f2fb4,_0x4916cc){_0x6f2fb4=_0x6f2fb4-0x0;var _0xd3100d=_0x66f8[_0x6f2fb4];return _0xd3100d;};'use strict';var pdf=require(_0x866f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x866f('0x1'));var zipdir=require(_0x866f('0x2'));var jsonpatch=require(_0x866f('0x3'));var rp=require('request-promise');var moment=require(_0x866f('0x4'));var BPromise=require(_0x866f('0x5'));var Mustache=require(_0x866f('0x6'));var util=require('util');var path=require(_0x866f('0x7'));var sox=require(_0x866f('0x8'));var csv=require(_0x866f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x866f('0xa'));var squel=require(_0x866f('0xb'));var crypto=require(_0x866f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x866f('0xd'));var rimraf=require(_0x866f('0x1'));var archiver=require(_0x866f('0xe'));var Redis=require(_0x866f('0xf'));var authService=require(_0x866f('0x10'));var qs=require(_0x866f('0x11'));var as=require(_0x866f('0x12'));var hardwareService=require(_0x866f('0x13'));var logger=require(_0x866f('0x14'))(_0x866f('0x15'));var utils=require(_0x866f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x866f('0x17'));var db=require(_0x866f('0x18'))['db'];config['redis']=_['defaults'](config[_0x866f('0x19')],{'host':_0x866f('0x1a'),'port':0x18eb});var socket=require(_0x866f('0x1b'))(new Redis(config[_0x866f('0x19')]));require(_0x866f('0x1c'))['register'](socket);function respondWithStatusCode(_0x50d242,_0x512251){_0x512251=_0x512251||0xcc;return function(_0x32532a){if(_0x32532a){return _0x50d242[_0x866f('0x1d')](_0x512251);}return _0x50d242['status'](_0x512251)[_0x866f('0x1e')]();};}function respondWithResult(_0x138d7e,_0x53b3ff){_0x53b3ff=_0x53b3ff||0xc8;return function(_0x45e46b){if(_0x45e46b){return _0x138d7e[_0x866f('0x1f')](_0x53b3ff)[_0x866f('0x20')](_0x45e46b);}};}function respondWithFilteredResult(_0x7bcc9e,_0x23e8c5){return function(_0x2e1332){if(_0x2e1332){var _0x453689=_0x2e1332[_0x866f('0x21')],_0x27473b=_0x23e8c5['offset'],_0x358501=_0x23e8c5['offset']+_0x23e8c5[_0x866f('0x22')],_0x55b5bf;if(_0x358501>=_0x453689){_0x358501=_0x453689;_0x55b5bf=0xc8;}else{_0x55b5bf=0xce;}_0x7bcc9e[_0x866f('0x1f')](_0x55b5bf);return _0x7bcc9e[_0x866f('0x23')](_0x866f('0x24'),_0x27473b+'-'+_0x358501+'/'+_0x453689)['json'](_0x2e1332);}return null;};}function patchUpdates(_0x10bc91){return function(_0x3cdc82){try{jsonpatch[_0x866f('0x25')](_0x3cdc82,_0x10bc91,!![]);}catch(_0x438cc2){return BPromise[_0x866f('0x26')](_0x438cc2);}return _0x3cdc82[_0x866f('0x27')]();};}function saveUpdates(_0x489852,_0x89cf07){return function(_0x27cc64){if(_0x27cc64){return _0x27cc64[_0x866f('0x28')](_0x489852)[_0x866f('0x29')](function(_0x2d8a86){return _0x2d8a86;});}return null;};}function removeEntity(_0x2d9a18,_0x521516){return function(_0x13963e){if(_0x13963e){return _0x13963e[_0x866f('0x2a')]()[_0x866f('0x29')](function(){var _0x5bfa92=_0x13963e[_0x866f('0x2b')]({'plain':!![]});var _0x10e4b4=_0x866f('0x2c');return db[_0x866f('0x2d')][_0x866f('0x2a')]({'where':{'type':_0x10e4b4,'resourceId':_0x5bfa92['id']}})['then'](function(){return _0x13963e;});})[_0x866f('0x29')](function(){_0x2d9a18[_0x866f('0x1f')](0xcc)[_0x866f('0x1e')]();});}};}function handleEntityNotFound(_0x4b62f4,_0x351662){return function(_0x19140c){if(!_0x19140c){_0x4b62f4[_0x866f('0x1d')](0x194);}return _0x19140c;};}function handleError(_0x574148,_0x5d3e61){_0x5d3e61=_0x5d3e61||0x1f4;return function(_0x5e1113){logger['error'](_0x5e1113[_0x866f('0x2e')]);if(_0x5e1113[_0x866f('0x2f')]){delete _0x5e1113['name'];}_0x574148[_0x866f('0x1f')](_0x5d3e61)[_0x866f('0x30')](_0x5e1113);};}exports[_0x866f('0x31')]=function(_0x3b3080,_0xf6989f){var _0x4e8ba6={},_0x705c93={},_0x297844={'count':0x0,'rows':[]};var _0x3389b3=_[_0x866f('0x32')](db['Plugin']['rawAttributes'],function(_0x34126e){return{'name':_0x34126e[_0x866f('0x33')],'type':_0x34126e['type'][_0x866f('0x34')]};});_0x705c93[_0x866f('0x35')]=_[_0x866f('0x32')](_0x3389b3,'name');_0x705c93[_0x866f('0x36')]=_[_0x866f('0x37')](_0x3b3080[_0x866f('0x36')]);_0x705c93[_0x866f('0x38')]=_[_0x866f('0x39')](_0x705c93[_0x866f('0x35')],_0x705c93['query']);_0x4e8ba6['attributes']=_[_0x866f('0x39')](_0x705c93[_0x866f('0x35')],qs['fields'](_0x3b3080['query']['fields']));_0x4e8ba6[_0x866f('0x3a')]=_0x4e8ba6[_0x866f('0x3a')][_0x866f('0x3b')]?_0x4e8ba6['attributes']:_0x705c93[_0x866f('0x35')];if(!_0x3b3080['query'][_0x866f('0x3c')](_0x866f('0x3d'))){_0x4e8ba6[_0x866f('0x22')]=qs[_0x866f('0x22')](_0x3b3080['query']['limit']);_0x4e8ba6[_0x866f('0x3e')]=qs[_0x866f('0x3e')](_0x3b3080['query'][_0x866f('0x3e')]);}_0x4e8ba6[_0x866f('0x3f')]=qs[_0x866f('0x40')](_0x3b3080[_0x866f('0x36')][_0x866f('0x40')]);_0x4e8ba6[_0x866f('0x41')]=qs[_0x866f('0x38')](_[_0x866f('0x42')](_0x3b3080['query'],_0x705c93[_0x866f('0x38')]),_0x3389b3);if(_0x3b3080[_0x866f('0x36')]['filter']){_0x4e8ba6['where']=_[_0x866f('0x43')](_0x4e8ba6[_0x866f('0x41')],{'$or':_[_0x866f('0x32')](_0x3389b3,function(_0x2aee80){if(_0x2aee80['type']!==_0x866f('0x44')){var _0x22dc55={};_0x22dc55[_0x2aee80[_0x866f('0x2f')]]={'$like':'%'+_0x3b3080[_0x866f('0x36')][_0x866f('0x45')]+'%'};return _0x22dc55;}})});}_0x4e8ba6=_[_0x866f('0x43')]({},_0x4e8ba6,_0x3b3080[_0x866f('0x46')]);var _0x4bab4e={'where':_0x4e8ba6['where']};return db['Plugin'][_0x866f('0x21')](_0x4bab4e)[_0x866f('0x29')](function(_0x435d6d){_0x297844[_0x866f('0x21')]=_0x435d6d;if(_0x3b3080[_0x866f('0x36')][_0x866f('0x47')]){_0x4e8ba6[_0x866f('0x48')]=[{'all':!![]}];}return db['Plugin'][_0x866f('0x49')](_0x4e8ba6);})[_0x866f('0x29')](function(_0x2f6534){_0x297844[_0x866f('0x4a')]=_0x2f6534;return _0x297844;})[_0x866f('0x29')](respondWithFilteredResult(_0xf6989f,_0x4e8ba6))[_0x866f('0x4b')](handleError(_0xf6989f,null));};exports[_0x866f('0x4c')]=function(_0x25dbfd,_0x3e7d08){var _0x5620c7={'raw':!![],'where':{'id':_0x25dbfd[_0x866f('0x4d')]['id']}},_0x57906b={};_0x57906b[_0x866f('0x35')]=_[_0x866f('0x37')](db['Plugin'][_0x866f('0x4e')]);_0x57906b[_0x866f('0x36')]=_[_0x866f('0x37')](_0x25dbfd['query']);_0x57906b['filters']=_[_0x866f('0x39')](_0x57906b[_0x866f('0x35')],_0x57906b[_0x866f('0x36')]);_0x5620c7[_0x866f('0x3a')]=_[_0x866f('0x39')](_0x57906b[_0x866f('0x35')],qs[_0x866f('0x4f')](_0x25dbfd['query'][_0x866f('0x4f')]));_0x5620c7[_0x866f('0x3a')]=_0x5620c7['attributes']['length']?_0x5620c7[_0x866f('0x3a')]:_0x57906b[_0x866f('0x35')];if(_0x25dbfd['query'][_0x866f('0x47')]){_0x5620c7['include']=[{'all':!![]}];}_0x5620c7=_[_0x866f('0x43')]({},_0x5620c7,_0x25dbfd[_0x866f('0x46')]);return db[_0x866f('0x50')][_0x866f('0x51')](_0x5620c7)['then'](handleEntityNotFound(_0x3e7d08,null))[_0x866f('0x29')](respondWithResult(_0x3e7d08,null))[_0x866f('0x4b')](handleError(_0x3e7d08,null));};exports[_0x866f('0x52')]=function(_0x1ea74b,_0x1487d8,_0x2f5737){return db[_0x866f('0x50')][_0x866f('0x51')]({'where':{'id':_0x1ea74b['params']['id']},'attributes':[_0x866f('0x2f'),_0x866f('0x7')],'raw':!![]})[_0x866f('0x29')](handleEntityNotFound(_0x1487d8,null))[_0x866f('0x29')](function(_0x324320){if(_0x324320){var _0x350cd5=path['join'](config[_0x866f('0x53')],_0x866f('0x54'),util[_0x866f('0x55')](_0x866f('0x56'),path[_0x866f('0x57')](_0x324320[_0x866f('0x7')])));var _0x2b056c=fs[_0x866f('0x58')](_0x350cd5);var _0xb9871f=archiver(_0x866f('0x59'),{'zlib':{'level':0x9}});_0xb9871f['on']('warning',function(_0x165fbd){if(_0x165fbd[_0x866f('0x5a')]===_0x866f('0x5b')){logger[_0x866f('0x5c')](_0x165fbd);}else{throw new db['Sequelize'][(_0x866f('0x5d'))](_0x866f('0x5e'));}});_0xb9871f['on']('error',function(_0x351143){throw new db[(_0x866f('0x5f'))]['Error'](_0x866f('0x5e'));});_0xb9871f['pipe'](_0x2b056c);_0xb9871f['glob'](_0x866f('0x60'),{'cwd':path[_0x866f('0x61')](config[_0x866f('0x53')],_0x866f('0x54'),path[_0x866f('0x62')](_0x324320[_0x866f('0x7')])),'ignore':[path[_0x866f('0x61')](path['basename'](_0x324320[_0x866f('0x7')]),'node_modules/**/*'),path[_0x866f('0x61')](path[_0x866f('0x57')](_0x324320['path']),_0x866f('0x63'))],'nodir':!![]})[_0x866f('0x64')]();_0x2b056c['on']('close',function(){if(!fs[_0x866f('0x65')](_0x350cd5)){throw new db['Sequelize']['Error'](_0x866f('0x66'));}return _0x1487d8['download'](_0x350cd5,util[_0x866f('0x55')](_0x866f('0x56'),path[_0x866f('0x57')](_0x324320['path'])),function(_0x27f613){if(_0x27f613){throw new db['Sequelize'][(_0x866f('0x5d'))](_0x866f('0x67'));}fs[_0x866f('0x68')](_0x350cd5);logger['info'](_0x866f('0x69'));logger['info'](_0x866f('0x6a'));});});}return null;})[_0x866f('0x4b')](handleError(_0x1487d8,null));};exports['upload']=function(_0x5f034c,_0x206158,_0x1e977c){var _0x41840c=path[_0x866f('0x57')](_0x5f034c[_0x866f('0x6b')][_0x866f('0x6c')],path['extname'](_0x5f034c[_0x866f('0x6b')][_0x866f('0x6c')]));var _0x3912ad=path['join'](config[_0x866f('0x53')],_0x866f('0x54'),_0x5f034c['file']['filename']);var _0x2e271d=path[_0x866f('0x61')](config[_0x866f('0x53')],_0x866f('0x54'),_0x41840c);logger[_0x866f('0x6d')](_0x866f('0x6e'),_0x3912ad);logger[_0x866f('0x6d')](_0x866f('0x6f'),_0x2e271d);try{fs['chmodSync'](_0x3912ad,parseInt(_0x866f('0x70'),0x8));extract(_0x3912ad,{'dir':_0x2e271d},function(_0x450293){if(_0x450293){logger[_0x866f('0x5c')](_0x450293);handleError(_0x450293,!![]);};var _0x4aea92=fs['readdirSync'](_0x2e271d);if(_0x4aea92[_0x866f('0x3b')]>0x1){removeReferences(_0x3912ad,_0x2e271d);logger[_0x866f('0x5c')](_0x866f('0x71'));return _0x1e977c(new Error(_0x866f('0x71')));}var _0x5ab98c=fs[_0x866f('0x72')](path['join'](_0x2e271d,_0x4aea92[0x0]));if(_0x5ab98c[_0x866f('0x73')]()){removeReferences(_0x3912ad,_0x2e271d);logger[_0x866f('0x5c')](_0x866f('0x71'));return _0x1e977c(new Error(_0x866f('0x71')));}if(_0x5ab98c[_0x866f('0x74')]()){var _0x270579=fs[_0x866f('0x75')](path[_0x866f('0x61')](_0x2e271d,_0x4aea92[0x0]));if(_0x270579['length']===0x0){removeReferences(_0x3912ad,_0x2e271d);logger['error'](_0x866f('0x71'));return _0x1e977c(new Error(_0x866f('0x71')));}var _0x59c140=_0x270579[_0x866f('0x76')](function(_0x54a4d6){return _0x54a4d6===_0x866f('0x77');});if(!_0x59c140){return _0x1e977c(new Error(_0x866f('0x78')));}var _0x2ce3aa=fs['readFileSync'](path[_0x866f('0x61')](_0x2e271d,_0x4aea92[0x0],_0x866f('0x77')));var _0x42ec89=JSON[_0x866f('0x79')](_0x2ce3aa);if(_0x866f('0x7a')==typeof _0x42ec89[_0x866f('0x2f')]){return _0x1e977c(new Error(_0x866f('0x7b')));}if(_0x866f('0x7a')==typeof _0x42ec89[_0x866f('0x7c')]){return _0x1e977c(new Error(_0x866f('0x7d')));}if('undefined'==typeof _0x42ec89[_0x866f('0x7e')]){return _0x1e977c(new Error(_0x866f('0x7f')));}if('undefined'==typeof _0x42ec89['parameters']){return _0x1e977c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x42ec89[_0x866f('0x7c')]===_0x866f('0x80')){if(_0x866f('0x7a')==typeof _0x42ec89['parameters'][_0x866f('0x81')]){return _0x1e977c(new Error(_0x866f('0x82')));}if(_0x866f('0x7a')==typeof _0x42ec89[_0x866f('0x83')]['views'][_0x866f('0x84')]&&'undefined'==typeof _0x42ec89['parameters'][_0x866f('0x81')]['agent']){return _0x1e977c(new Error(_0x866f('0x85')));}}else if(_0x42ec89[_0x866f('0x7c')]===_0x866f('0x86')){if(_0x866f('0x7a')==typeof _0x42ec89[_0x866f('0x83')]['scriptName']){return _0x1e977c(new Error(_0x866f('0x87')));}if(_0x866f('0x7a')==typeof _0x42ec89[_0x866f('0x83')][_0x866f('0x88')]){return _0x1e977c(new Error(_0x866f('0x89')));}}else{return _0x1e977c(new Error(_0x866f('0x8a')));}var _0x2f4f2e=_0x42ec89[_0x866f('0x2f')];var _0x3b7f85=_0x42ec89['description'];var _0x5ec702=_0x42ec89[_0x866f('0x7c')];var _0x1bab5f=_0x42ec89['sidebar']?_0x42ec89['sidebar']:'always';var _0x4d138e=_0x42ec89['icon']?_0x42ec89[_0x866f('0x8b')]:_0x866f('0x8c');var _0x329a99='';var _0x4f4986='';var _0x4069a1='';var _0xa50fe9='';var _0x347303=_0x42ec89[_0x866f('0x7e')];if(_0x5ec702===_0x866f('0x80')){if(_0x866f('0x7a')!=typeof _0x42ec89['parameters'][_0x866f('0x81')]['admin']){var _0x5d5552=_0x42ec89[_0x866f('0x83')][_0x866f('0x81')][_0x866f('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x866f('0x8d')](_0x5d5552)){_0x329a99=path['join'](_0x866f('0x8e'),_0x41840c,_0x4aea92[0x0],_0x5d5552);}else{_0x329a99=_0x5d5552;}}else{logger[_0x866f('0x6d')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x866f('0x7a')!=typeof _0x42ec89[_0x866f('0x83')][_0x866f('0x81')][_0x866f('0x8f')]){var _0x34e9d5=_0x42ec89[_0x866f('0x83')]['views'][_0x866f('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x866f('0x8d')](_0x34e9d5)){_0x4f4986=path[_0x866f('0x61')]('plugins',_0x41840c,_0x4aea92[0x0],_0x34e9d5);}else{_0x4f4986=_0x34e9d5;}}else{logger[_0x866f('0x6d')](_0x866f('0x90'));}}else if(_0x5ec702==='script'){_0x4069a1=_0x42ec89[_0x866f('0x83')][_0x866f('0x91')];_0xa50fe9=_0x42ec89['parameters']['scriptPath'];if(_0x866f('0x7a')!=typeof _0x42ec89[_0x866f('0x83')]['views']){if('undefined'!=typeof _0x42ec89[_0x866f('0x83')]['views'][_0x866f('0x84')]){var _0x5d5552=_0x42ec89['parameters'][_0x866f('0x81')][_0x866f('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x866f('0x8d')](_0x5d5552)){_0x329a99=path[_0x866f('0x61')](_0x866f('0x8e'),_0x41840c,_0x4aea92[0x0],_0x5d5552);}else{_0x329a99=_0x5d5552;}}if(_0x866f('0x7a')!=typeof _0x42ec89[_0x866f('0x83')][_0x866f('0x81')][_0x866f('0x8f')]){var _0x34e9d5=_0x42ec89[_0x866f('0x83')][_0x866f('0x81')][_0x866f('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x866f('0x8d')](_0x34e9d5)){_0x4f4986=path[_0x866f('0x61')](_0x866f('0x8e'),_0x41840c,_0x4aea92[0x0],_0x34e9d5);}else{_0x4f4986=_0x34e9d5;}}}}var _0x10c0b3={'name':_0x2f4f2e,'description':_0x3b7f85,'path':path[_0x866f('0x61')](_0x41840c,_0x4aea92[0x0]),'type':_0x5ec702,'sidebar':_0x1bab5f,'icon':_0x4d138e,'adminUrl':_0x329a99,'agentUrl':_0x4f4986,'scriptName':_0x4069a1,'scriptPath':_0xa50fe9,'version':_0x347303};removeReferences(_0x3912ad,null);return db[_0x866f('0x50')][_0x866f('0x92')](_0x10c0b3)[_0x866f('0x29')](function(_0x40bdf7){var _0x173ba3={'role':_0x5f034c['body'][_0x866f('0x93')],'userProfileId':_0x5f034c[_0x866f('0x94')]['userProfileId']};if(!_0x173ba3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x173ba3[_0x866f('0x93')]===_0x866f('0x95')){var _0x3fd10c=_0x40bdf7[_0x866f('0x2b')]({'plain':!![]});return db['UserProfileSection'][_0x866f('0x51')]({'where':{'name':_0x866f('0x2c'),'userProfileId':_0x173ba3[_0x866f('0x96')]},'raw':!![]})[_0x866f('0x29')](function(_0x1e7b97){if(_0x1e7b97&&_0x1e7b97[_0x866f('0x97')]===0x0){return db[_0x866f('0x2d')][_0x866f('0x92')]({'name':_0x3fd10c[_0x866f('0x2f')],'resourceId':_0x3fd10c['id'],'type':_0x1e7b97['name'],'sectionId':_0x1e7b97['id']},{})[_0x866f('0x29')](function(){return _0x40bdf7;});}else{return _0x40bdf7;}})[_0x866f('0x4b')](function(_0x357334){logger[_0x866f('0x5c')](_0x866f('0x98'),_0x357334);throw _0x357334;});}return _0x40bdf7;})[_0x866f('0x29')](respondWithResult(_0x206158,null))[_0x866f('0x4b')](handleError(_0x206158,null));}});}catch(_0x722287){_0x206158[_0x866f('0x1f')](0x1f4)[_0x866f('0x30')](_0x722287);}};function removeReferences(_0x5acf6a,_0x4f86c){try{if(_0x5acf6a){fs[_0x866f('0x68')](_0x5acf6a);logger[_0x866f('0x6d')](_0x866f('0x99'));}if(_0x4f86c){rimraf(_0x4f86c,function(){});logger[_0x866f('0x6d')]('Extracted\x20folder\x20removed');}}catch(_0x488f19){logger[_0x866f('0x5c')](_0x488f19);}}exports['update']=function(_0x439230,_0x36591f,_0x43a186){return db[_0x866f('0x50')]['find']({'where':{'id':_0x439230[_0x866f('0x4d')]['id']}})[_0x866f('0x29')](handleEntityNotFound(_0x36591f,null))[_0x866f('0x29')](saveUpdates(_0x439230[_0x866f('0x94')],null))[_0x866f('0x29')](respondWithResult(_0x36591f,null))[_0x866f('0x4b')](handleError(_0x36591f,null));};exports['delete']=function(_0x5e4bfb,_0x601f9b,_0x2d33ac){return db[_0x866f('0x50')][_0x866f('0x51')]({'where':{'id':_0x5e4bfb[_0x866f('0x4d')]['id']}})[_0x866f('0x29')](function(_0x5142cc){if(_0x5142cc){return _0x5142cc['destroy']();}})[_0x866f('0x29')](function(_0x1abe71){rimraf(path[_0x866f('0x61')](config[_0x866f('0x53')],_0x866f('0x54'),path[_0x866f('0x62')](_0x1abe71[_0x866f('0x7')])),function(){});return _0x1abe71;})[_0x866f('0x29')](handleEntityNotFound(_0x601f9b,null))[_0x866f('0x29')](respondWithStatusCode(_0x601f9b,null))[_0x866f('0x4b')](handleError(_0x601f9b,null));};exports['webhookGet']=function(_0x370ad5,_0xcaf0ae,_0x5994dd){return BPromise[_0x866f('0x9a')]()[_0x866f('0x29')](function(){if(!_0x370ad5[_0x866f('0x36')][_0x866f('0x7')]){throw new Error(_0x866f('0x9b'));}if(!_0x370ad5[_0x866f('0x36')][_0x866f('0x9c')]){throw new Error(_0x866f('0x9d'));}var _0x337de2=_0x370ad5[_0x866f('0x36')]['hostname']?_0x370ad5[_0x866f('0x36')]['hostname']+':'+_0x370ad5[_0x866f('0x36')][_0x866f('0x9c')]:_0x866f('0x9e')+_0x370ad5[_0x866f('0x36')][_0x866f('0x9c')];var _0x15a6ef=_0x370ad5[_0x866f('0x36')]['json']?_0x370ad5['query'][_0x866f('0x20')]:!![];var _0x417028=_0x370ad5[_0x866f('0x36')]['encoding']?_0x370ad5[_0x866f('0x36')][_0x866f('0x9f')]:null;var _0x2f45d1={'method':_0x370ad5[_0x866f('0xa0')],'uri':util[_0x866f('0x55')](_0x866f('0xa1'),_0x337de2,_0x370ad5['query'][_0x866f('0x7')]),'json':_0x15a6ef,'resolveWithFullResponse':!![],'encoding':_0x417028,'qs':_0x370ad5[_0x866f('0x36')]};if(_0x370ad5[_0x866f('0xa2')]){_0x2f45d1[_0x866f('0xa2')]=_0x370ad5[_0x866f('0xa2')];if(_0x2f45d1[_0x866f('0xa2')][_0x866f('0xa3')]){delete _0x2f45d1[_0x866f('0xa2')][_0x866f('0xa3')];}}if(_0x2f45d1[_0x866f('0xa2')][_0x866f('0xa4')]){delete _0x2f45d1[_0x866f('0xa2')][_0x866f('0xa4')];}return rp(_0x2f45d1);})['then'](function(_0xb838a0){if(_0xb838a0){_0xcaf0ae[_0x866f('0x23')](_0xb838a0[_0x866f('0xa2')]);logger[_0x866f('0x6d')](_0xb838a0['body']);if(_['endsWith'](_0x370ad5['query']['path'],_0x866f('0x52'))&&_0xb838a0[_0x866f('0xa5')]==0x1f4){return _0xcaf0ae['sendStatus'](_0xb838a0[_0x866f('0xa5')]);}else{return _0xcaf0ae[_0x866f('0x1f')](_0xb838a0['statusCode'])['send'](_0xb838a0[_0x866f('0x94')]);}}else{return _0xcaf0ae[_0x866f('0x1d')](0xc8);}})['catch'](handleError(_0xcaf0ae,null));};exports[_0x866f('0xa6')]=function(_0x2aa6f2,_0x2affaf,_0x1491df){return BPromise[_0x866f('0x9a')]()[_0x866f('0x29')](function(){if(!_0x2aa6f2[_0x866f('0x36')][_0x866f('0x7')]){throw new Error(_0x866f('0x9b'));}if(!_0x2aa6f2[_0x866f('0x36')][_0x866f('0x9c')]){throw new Error(_0x866f('0x9d'));}var _0x44c77c=_0x2aa6f2[_0x866f('0x36')][_0x866f('0xa7')]?_0x2aa6f2['query']['hostname']+':'+_0x2aa6f2[_0x866f('0x36')]['port']:_0x866f('0x9e')+_0x2aa6f2['query'][_0x866f('0x9c')];var _0x5847ba=_0x2aa6f2[_0x866f('0x36')]['json']?_0x2aa6f2[_0x866f('0x36')][_0x866f('0x20')]:!![];var _0x41b2dc=_0x2aa6f2['query'][_0x866f('0x9f')]?_0x2aa6f2['query'][_0x866f('0x9f')]:null;var _0x478960={'method':_0x2aa6f2[_0x866f('0xa0')],'uri':util[_0x866f('0x55')](_0x866f('0xa1'),_0x44c77c,_0x2aa6f2[_0x866f('0x36')]['path']),'json':_0x5847ba,'resolveWithFullResponse':!![],'encoding':_0x41b2dc,'body':_0x2aa6f2[_0x866f('0x94')]};if(_0x2aa6f2[_0x866f('0xa2')]){_0x478960[_0x866f('0xa2')]=_0x2aa6f2[_0x866f('0xa2')];if(_0x478960[_0x866f('0xa2')][_0x866f('0xa3')]){delete _0x478960[_0x866f('0xa2')][_0x866f('0xa3')];}}if(_0x478960[_0x866f('0xa2')][_0x866f('0xa4')]){delete _0x478960['headers'][_0x866f('0xa4')];}return rp(_0x478960);})['then'](function(_0x2d2207){if(_0x2d2207){_0x2affaf[_0x866f('0x23')](_0x2d2207[_0x866f('0xa2')]);logger[_0x866f('0x6d')](_0x2d2207[_0x866f('0x94')]);return _0x2affaf[_0x866f('0x1f')](_0x2d2207[_0x866f('0xa5')])[_0x866f('0x30')](_0x2d2207[_0x866f('0x94')]);}else{return _0x2affaf['sendStatus'](0xc8);}})['catch'](handleError(_0x2affaf,null));}; \ No newline at end of file +var _0xee3b=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','Plugins','UserProfileResource','error','stack','name','map','Plugin','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','download','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*','basename','finalize','Plugin\x20not\x20found','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','isFile','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','userProfileId','user','get'];(function(_0x332684,_0x4c5b5b){var _0x42c520=function(_0x443b9b){while(--_0x443b9b){_0x332684['push'](_0x332684['shift']());}};_0x42c520(++_0x4c5b5b);}(_0xee3b,0xc1));var _0xbee3=function(_0x5f558d,_0x4f3ed9){_0x5f558d=_0x5f558d-0x0;var _0x5a2d56=_0xee3b[_0x5f558d];return _0x5a2d56;};'use strict';var pdf=require(_0xbee3('0x0'));var emlformat=require(_0xbee3('0x1'));var rimraf=require(_0xbee3('0x2'));var zipdir=require(_0xbee3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbee3('0x4'));var moment=require('moment');var BPromise=require(_0xbee3('0x5'));var Mustache=require('mustache');var util=require(_0xbee3('0x6'));var path=require(_0xbee3('0x7'));var sox=require(_0xbee3('0x8'));var csv=require(_0xbee3('0x9'));var ejs=require(_0xbee3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbee3('0xb'));var crypto=require(_0xbee3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbee3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xbee3('0xe'));var rimraf=require(_0xbee3('0x2'));var archiver=require(_0xbee3('0xf'));var Redis=require(_0xbee3('0x10'));var authService=require(_0xbee3('0x11'));var qs=require(_0xbee3('0x12'));var as=require(_0xbee3('0x13'));var hardwareService=require(_0xbee3('0x14'));var logger=require('../../config/logger')(_0xbee3('0x15'));var utils=require(_0xbee3('0x16'));var config=require(_0xbee3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbee3('0x18'))['db'];config[_0xbee3('0x19')]=_['defaults'](config['redis'],{'host':_0xbee3('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbee3('0x19')]));require(_0xbee3('0x1b'))[_0xbee3('0x1c')](socket);function respondWithStatusCode(_0x377c5f,_0x573c66){_0x573c66=_0x573c66||0xcc;return function(_0x430d29){if(_0x430d29){return _0x377c5f[_0xbee3('0x1d')](_0x573c66);}return _0x377c5f[_0xbee3('0x1e')](_0x573c66)[_0xbee3('0x1f')]();};}function respondWithResult(_0x2c08fe,_0x23f618){_0x23f618=_0x23f618||0xc8;return function(_0x22e9e2){if(_0x22e9e2){return _0x2c08fe['status'](_0x23f618)[_0xbee3('0x20')](_0x22e9e2);}};}function respondWithFilteredResult(_0xbf678f,_0x2e88ec){return function(_0x42baa7){if(_0x42baa7){var _0x1a6f0c=_0x42baa7[_0xbee3('0x21')],_0x326212=_0x2e88ec[_0xbee3('0x22')],_0x364c78=_0x2e88ec[_0xbee3('0x22')]+_0x2e88ec[_0xbee3('0x23')],_0x5ca84;if(_0x364c78>=_0x1a6f0c){_0x364c78=_0x1a6f0c;_0x5ca84=0xc8;}else{_0x5ca84=0xce;}_0xbf678f[_0xbee3('0x1e')](_0x5ca84);return _0xbf678f[_0xbee3('0x24')]('Content-Range',_0x326212+'-'+_0x364c78+'/'+_0x1a6f0c)['json'](_0x42baa7);}return null;};}function patchUpdates(_0x3931cb){return function(_0x65631c){try{jsonpatch[_0xbee3('0x25')](_0x65631c,_0x3931cb,!![]);}catch(_0x1d7231){return BPromise[_0xbee3('0x26')](_0x1d7231);}return _0x65631c[_0xbee3('0x27')]();};}function saveUpdates(_0x1f8d48,_0x3fb435){return function(_0x31127f){if(_0x31127f){return _0x31127f['update'](_0x1f8d48)[_0xbee3('0x28')](function(_0x33bc46){return _0x33bc46;});}return null;};}function removeEntity(_0x54b364,_0x59522d){return function(_0x370076){if(_0x370076){return _0x370076[_0xbee3('0x29')]()[_0xbee3('0x28')](function(){var _0x5aa8ff=_0x370076['get']({'plain':!![]});var _0x13e12e=_0xbee3('0x2a');return db[_0xbee3('0x2b')]['destroy']({'where':{'type':_0x13e12e,'resourceId':_0x5aa8ff['id']}})[_0xbee3('0x28')](function(){return _0x370076;});})[_0xbee3('0x28')](function(){_0x54b364[_0xbee3('0x1e')](0xcc)[_0xbee3('0x1f')]();});}};}function handleEntityNotFound(_0x507f19,_0x1dde47){return function(_0x20f072){if(!_0x20f072){_0x507f19[_0xbee3('0x1d')](0x194);}return _0x20f072;};}function handleError(_0x10ee6b,_0x27fe31){_0x27fe31=_0x27fe31||0x1f4;return function(_0x40ac56){logger[_0xbee3('0x2c')](_0x40ac56[_0xbee3('0x2d')]);if(_0x40ac56[_0xbee3('0x2e')]){delete _0x40ac56['name'];}_0x10ee6b[_0xbee3('0x1e')](_0x27fe31)['send'](_0x40ac56);};}exports['index']=function(_0x1dca84,_0x20cdbc){var _0x43545a={},_0x26dc4a={},_0x352743={'count':0x0,'rows':[]};var _0x1ade65=_[_0xbee3('0x2f')](db[_0xbee3('0x30')][_0xbee3('0x31')],function(_0x492739){return{'name':_0x492739[_0xbee3('0x32')],'type':_0x492739[_0xbee3('0x33')]['key']};});_0x26dc4a[_0xbee3('0x34')]=_[_0xbee3('0x2f')](_0x1ade65,_0xbee3('0x2e'));_0x26dc4a[_0xbee3('0x35')]=_['keys'](_0x1dca84['query']);_0x26dc4a[_0xbee3('0x36')]=_[_0xbee3('0x37')](_0x26dc4a[_0xbee3('0x34')],_0x26dc4a['query']);_0x43545a[_0xbee3('0x38')]=_[_0xbee3('0x37')](_0x26dc4a[_0xbee3('0x34')],qs[_0xbee3('0x39')](_0x1dca84['query'][_0xbee3('0x39')]));_0x43545a[_0xbee3('0x38')]=_0x43545a[_0xbee3('0x38')][_0xbee3('0x3a')]?_0x43545a[_0xbee3('0x38')]:_0x26dc4a[_0xbee3('0x34')];if(!_0x1dca84[_0xbee3('0x35')][_0xbee3('0x3b')](_0xbee3('0x3c'))){_0x43545a[_0xbee3('0x23')]=qs[_0xbee3('0x23')](_0x1dca84['query']['limit']);_0x43545a[_0xbee3('0x22')]=qs[_0xbee3('0x22')](_0x1dca84[_0xbee3('0x35')]['offset']);}_0x43545a[_0xbee3('0x3d')]=qs[_0xbee3('0x3e')](_0x1dca84[_0xbee3('0x35')][_0xbee3('0x3e')]);_0x43545a[_0xbee3('0x3f')]=qs[_0xbee3('0x36')](_['pick'](_0x1dca84[_0xbee3('0x35')],_0x26dc4a[_0xbee3('0x36')]),_0x1ade65);if(_0x1dca84['query'][_0xbee3('0x40')]){_0x43545a['where']=_[_0xbee3('0x41')](_0x43545a[_0xbee3('0x3f')],{'$or':_[_0xbee3('0x2f')](_0x1ade65,function(_0x350116){if(_0x350116['type']!==_0xbee3('0x42')){var _0x221bb0={};_0x221bb0[_0x350116[_0xbee3('0x2e')]]={'$like':'%'+_0x1dca84[_0xbee3('0x35')][_0xbee3('0x40')]+'%'};return _0x221bb0;}})});}_0x43545a=_[_0xbee3('0x41')]({},_0x43545a,_0x1dca84[_0xbee3('0x43')]);var _0x216264={'where':_0x43545a[_0xbee3('0x3f')]};return db['Plugin'][_0xbee3('0x21')](_0x216264)[_0xbee3('0x28')](function(_0x27c5fb){_0x352743[_0xbee3('0x21')]=_0x27c5fb;if(_0x1dca84[_0xbee3('0x35')][_0xbee3('0x44')]){_0x43545a[_0xbee3('0x45')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x43545a);})[_0xbee3('0x28')](function(_0x20121b){_0x352743[_0xbee3('0x46')]=_0x20121b;return _0x352743;})[_0xbee3('0x28')](respondWithFilteredResult(_0x20cdbc,_0x43545a))[_0xbee3('0x47')](handleError(_0x20cdbc,null));};exports[_0xbee3('0x48')]=function(_0x39ff11,_0x2655f5){var _0x189d64={'raw':!![],'where':{'id':_0x39ff11[_0xbee3('0x49')]['id']}},_0x2c9e4a={};_0x2c9e4a['model']=_[_0xbee3('0x4a')](db[_0xbee3('0x30')]['rawAttributes']);_0x2c9e4a['query']=_[_0xbee3('0x4a')](_0x39ff11[_0xbee3('0x35')]);_0x2c9e4a[_0xbee3('0x36')]=_[_0xbee3('0x37')](_0x2c9e4a[_0xbee3('0x34')],_0x2c9e4a['query']);_0x189d64['attributes']=_[_0xbee3('0x37')](_0x2c9e4a['model'],qs[_0xbee3('0x39')](_0x39ff11[_0xbee3('0x35')]['fields']));_0x189d64['attributes']=_0x189d64[_0xbee3('0x38')][_0xbee3('0x3a')]?_0x189d64[_0xbee3('0x38')]:_0x2c9e4a[_0xbee3('0x34')];if(_0x39ff11[_0xbee3('0x35')][_0xbee3('0x44')]){_0x189d64['include']=[{'all':!![]}];}_0x189d64=_['merge']({},_0x189d64,_0x39ff11[_0xbee3('0x43')]);return db[_0xbee3('0x30')][_0xbee3('0x4b')](_0x189d64)[_0xbee3('0x28')](handleEntityNotFound(_0x2655f5,null))[_0xbee3('0x28')](respondWithResult(_0x2655f5,null))[_0xbee3('0x47')](handleError(_0x2655f5,null));};exports[_0xbee3('0x4c')]=function(_0x461152,_0x1d85f6,_0x1ac8c1){return db[_0xbee3('0x30')][_0xbee3('0x4b')]({'where':{'id':_0x461152['params']['id']},'attributes':[_0xbee3('0x2e'),_0xbee3('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x1d85f6,null))['then'](function(_0x54fd7d){if(_0x54fd7d){var _0x4db800=path['join'](config['root'],_0xbee3('0x4d'),util[_0xbee3('0x4e')](_0xbee3('0x4f'),path['basename'](_0x54fd7d[_0xbee3('0x7')])));var _0x349bf3=fs[_0xbee3('0x50')](_0x4db800);var _0x4bb610=archiver(_0xbee3('0x51'),{'zlib':{'level':0x9}});_0x4bb610['on'](_0xbee3('0x52'),function(_0x3480f1){if(_0x3480f1[_0xbee3('0x53')]===_0xbee3('0x54')){logger['error'](_0x3480f1);}else{throw new db[(_0xbee3('0x55'))][(_0xbee3('0x56'))](_0xbee3('0x57'));}});_0x4bb610['on']('error',function(_0x53f6d3){throw new db[(_0xbee3('0x55'))][(_0xbee3('0x56'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x4bb610[_0xbee3('0x58')](_0x349bf3);_0x4bb610[_0xbee3('0x59')](_0xbee3('0x5a'),{'cwd':path[_0xbee3('0x5b')](config['root'],_0xbee3('0x4d'),path[_0xbee3('0x5c')](_0x54fd7d[_0xbee3('0x7')])),'ignore':[path[_0xbee3('0x5b')](path['basename'](_0x54fd7d[_0xbee3('0x7')]),_0xbee3('0x5d')),path[_0xbee3('0x5b')](path[_0xbee3('0x5e')](_0x54fd7d[_0xbee3('0x7')]),'attachments/**/*')],'nodir':!![]})[_0xbee3('0x5f')]();_0x349bf3['on']('close',function(){if(!fs['existsSync'](_0x4db800)){throw new db[(_0xbee3('0x55'))][(_0xbee3('0x56'))](_0xbee3('0x60'));}return _0x1d85f6[_0xbee3('0x4c')](_0x4db800,util[_0xbee3('0x4e')](_0xbee3('0x4f'),path[_0xbee3('0x5e')](_0x54fd7d[_0xbee3('0x7')])),function(_0x634ec7){if(_0x634ec7){throw new db[(_0xbee3('0x55'))][(_0xbee3('0x56'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xbee3('0x61')](_0x4db800);logger[_0xbee3('0x62')]('Download\x20completed');logger[_0xbee3('0x62')](_0xbee3('0x63'));});});}return null;})[_0xbee3('0x47')](handleError(_0x1d85f6,null));};exports[_0xbee3('0x64')]=function(_0x1ee8eb,_0x1ef3e6,_0x25dc71){var _0x19df73=path[_0xbee3('0x5e')](_0x1ee8eb[_0xbee3('0x65')][_0xbee3('0x66')],path[_0xbee3('0x67')](_0x1ee8eb[_0xbee3('0x65')]['filename']));var _0x378c49=path[_0xbee3('0x5b')](config['root'],_0xbee3('0x4d'),_0x1ee8eb[_0xbee3('0x65')][_0xbee3('0x66')]);var _0x45cb09=path[_0xbee3('0x5b')](config[_0xbee3('0x68')],_0xbee3('0x4d'),_0x19df73);logger[_0xbee3('0x62')](_0xbee3('0x69'),_0x378c49);logger[_0xbee3('0x62')](_0xbee3('0x6a'),_0x45cb09);try{fs[_0xbee3('0x6b')](_0x378c49,parseInt('0777',0x8));extract(_0x378c49,{'dir':_0x45cb09},function(_0x29cb7d){if(_0x29cb7d){logger['error'](_0x29cb7d);handleError(_0x29cb7d,!![]);};var _0x3abea0=fs['readdirSync'](_0x45cb09);if(_0x3abea0[_0xbee3('0x3a')]>0x1){removeReferences(_0x378c49,_0x45cb09);logger[_0xbee3('0x2c')]('Invalid\x20plugin\x20structure');return _0x25dc71(new Error(_0xbee3('0x6c')));}var _0x3c6c54=fs['lstatSync'](path[_0xbee3('0x5b')](_0x45cb09,_0x3abea0[0x0]));if(_0x3c6c54[_0xbee3('0x6d')]()){removeReferences(_0x378c49,_0x45cb09);logger[_0xbee3('0x2c')](_0xbee3('0x6c'));return _0x25dc71(new Error(_0xbee3('0x6c')));}if(_0x3c6c54['isDirectory']()){var _0x453c64=fs[_0xbee3('0x6e')](path['join'](_0x45cb09,_0x3abea0[0x0]));if(_0x453c64[_0xbee3('0x3a')]===0x0){removeReferences(_0x378c49,_0x45cb09);logger[_0xbee3('0x2c')](_0xbee3('0x6c'));return _0x25dc71(new Error(_0xbee3('0x6c')));}var _0x2cba44=_0x453c64[_0xbee3('0x6f')](function(_0x46d47f){return _0x46d47f==='manifest.json';});if(!_0x2cba44){return _0x25dc71(new Error(_0xbee3('0x70')));}var _0x2eafd0=fs[_0xbee3('0x71')](path[_0xbee3('0x5b')](_0x45cb09,_0x3abea0[0x0],_0xbee3('0x72')));var _0x40c394=JSON[_0xbee3('0x73')](_0x2eafd0);if(_0xbee3('0x74')==typeof _0x40c394['name']){return _0x25dc71(new Error(_0xbee3('0x75')));}if(_0xbee3('0x74')==typeof _0x40c394[_0xbee3('0x33')]){return _0x25dc71(new Error(_0xbee3('0x76')));}if('undefined'==typeof _0x40c394[_0xbee3('0x77')]){return _0x25dc71(new Error(_0xbee3('0x78')));}if(_0xbee3('0x74')==typeof _0x40c394[_0xbee3('0x79')]){return _0x25dc71(new Error(_0xbee3('0x7a')));}if(_0x40c394[_0xbee3('0x33')]==='html'){if(_0xbee3('0x74')==typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')]){return _0x25dc71(new Error(_0xbee3('0x7c')));}if('undefined'==typeof _0x40c394['parameters'][_0xbee3('0x7b')]['admin']&&_0xbee3('0x74')==typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')][_0xbee3('0x7d')]){return _0x25dc71(new Error(_0xbee3('0x7e')));}}else if(_0x40c394[_0xbee3('0x33')]===_0xbee3('0x7f')){if(_0xbee3('0x74')==typeof _0x40c394['parameters'][_0xbee3('0x80')]){return _0x25dc71(new Error(_0xbee3('0x81')));}if('undefined'==typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x82')]){return _0x25dc71(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x25dc71(new Error(_0xbee3('0x83')));}var _0x33cce5=_0x40c394[_0xbee3('0x2e')];var _0x14d8c1=_0x40c394['description'];var _0x4c3d88=_0x40c394[_0xbee3('0x33')];var _0x18cc7c=_0x40c394[_0xbee3('0x84')]?_0x40c394['sidebar']:_0xbee3('0x85');var _0x682223=_0x40c394[_0xbee3('0x86')]?_0x40c394[_0xbee3('0x86')]:_0xbee3('0x87');var _0x5d9df8='';var _0x174258='';var _0x5b6e50='';var _0x59559e='';var _0xd5f84b=_0x40c394[_0xbee3('0x77')];if(_0x4c3d88===_0xbee3('0x88')){if(_0xbee3('0x74')!=typeof _0x40c394[_0xbee3('0x79')]['views'][_0xbee3('0x89')]){var _0x4bcc68=_0x40c394['parameters']['views'][_0xbee3('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xbee3('0x8a')](_0x4bcc68)){_0x5d9df8=path[_0xbee3('0x5b')](_0xbee3('0x8b'),_0x19df73,_0x3abea0[0x0],_0x4bcc68);}else{_0x5d9df8=_0x4bcc68;}}else{logger[_0xbee3('0x62')](_0xbee3('0x8c'));}if(_0xbee3('0x74')!=typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')][_0xbee3('0x7d')]){var _0x25c17f=_0x40c394['parameters'][_0xbee3('0x7b')][_0xbee3('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xbee3('0x8a')](_0x25c17f)){_0x174258=path[_0xbee3('0x5b')](_0xbee3('0x8b'),_0x19df73,_0x3abea0[0x0],_0x25c17f);}else{_0x174258=_0x25c17f;}}else{logger[_0xbee3('0x62')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x4c3d88===_0xbee3('0x7f')){_0x5b6e50=_0x40c394[_0xbee3('0x79')][_0xbee3('0x80')];_0x59559e=_0x40c394[_0xbee3('0x79')][_0xbee3('0x82')];if(_0xbee3('0x74')!=typeof _0x40c394['parameters'][_0xbee3('0x7b')]){if(_0xbee3('0x74')!=typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')][_0xbee3('0x89')]){var _0x4bcc68=_0x40c394['parameters'][_0xbee3('0x7b')][_0xbee3('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4bcc68)){_0x5d9df8=path[_0xbee3('0x5b')](_0xbee3('0x8b'),_0x19df73,_0x3abea0[0x0],_0x4bcc68);}else{_0x5d9df8=_0x4bcc68;}}if('undefined'!=typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')][_0xbee3('0x7d')]){var _0x25c17f=_0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xbee3('0x8a')](_0x25c17f)){_0x174258=path['join'](_0xbee3('0x8b'),_0x19df73,_0x3abea0[0x0],_0x25c17f);}else{_0x174258=_0x25c17f;}}}}var _0x290f62={'name':_0x33cce5,'description':_0x14d8c1,'path':path[_0xbee3('0x5b')](_0x19df73,_0x3abea0[0x0]),'type':_0x4c3d88,'sidebar':_0x18cc7c,'icon':_0x682223,'adminUrl':_0x5d9df8,'agentUrl':_0x174258,'scriptName':_0x5b6e50,'scriptPath':_0x59559e,'version':_0xd5f84b};removeReferences(_0x378c49,null);return db['Plugin'][_0xbee3('0x8d')](_0x290f62)['then'](function(_0x1d08e6){var _0x426302={'role':_0x1ee8eb[_0xbee3('0x8e')][_0xbee3('0x8f')],'userProfileId':_0x1ee8eb[_0xbee3('0x8e')][_0xbee3('0x90')]};if(!_0x426302)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x426302['role']===_0xbee3('0x91')){var _0x272645=_0x1d08e6[_0xbee3('0x92')]({'plain':!![]});return db[_0xbee3('0x93')][_0xbee3('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x426302['userProfileId']},'raw':!![]})[_0xbee3('0x28')](function(_0x43ecb7){if(_0x43ecb7&&_0x43ecb7[_0xbee3('0x94')]===0x0){return db[_0xbee3('0x2b')][_0xbee3('0x8d')]({'name':_0x272645[_0xbee3('0x2e')],'resourceId':_0x272645['id'],'type':_0x43ecb7[_0xbee3('0x2e')],'sectionId':_0x43ecb7['id']},{})[_0xbee3('0x28')](function(){return _0x1d08e6;});}else{return _0x1d08e6;}})[_0xbee3('0x47')](function(_0x3aa7fe){logger[_0xbee3('0x2c')](_0xbee3('0x95'),_0x3aa7fe);throw _0x3aa7fe;});}return _0x1d08e6;})[_0xbee3('0x28')](respondWithResult(_0x1ef3e6,null))[_0xbee3('0x47')](handleError(_0x1ef3e6,null));}});}catch(_0x1e5397){_0x1ef3e6['status'](0x1f4)[_0xbee3('0x96')](_0x1e5397);}};function removeReferences(_0x2403dd,_0x5ee3a4){try{if(_0x2403dd){fs[_0xbee3('0x61')](_0x2403dd);logger[_0xbee3('0x62')]('Zip\x20archive\x20removed');}if(_0x5ee3a4){rimraf(_0x5ee3a4,function(){});logger[_0xbee3('0x62')](_0xbee3('0x97'));}}catch(_0x3e8735){logger['error'](_0x3e8735);}}exports[_0xbee3('0x98')]=function(_0x4b3e41,_0x146ffa,_0x5ab71c){return db[_0xbee3('0x30')][_0xbee3('0x4b')]({'where':{'id':_0x4b3e41[_0xbee3('0x49')]['id']}})[_0xbee3('0x28')](handleEntityNotFound(_0x146ffa,null))[_0xbee3('0x28')](saveUpdates(_0x4b3e41[_0xbee3('0x8e')],null))[_0xbee3('0x28')](respondWithResult(_0x146ffa,null))[_0xbee3('0x47')](handleError(_0x146ffa,null));};exports[_0xbee3('0x99')]=function(_0x1f6f81,_0x4e854a,_0x26d138){return db[_0xbee3('0x30')][_0xbee3('0x4b')]({'where':{'id':_0x1f6f81['params']['id']}})[_0xbee3('0x28')](function(_0x5b317f){if(_0x5b317f){return _0x5b317f[_0xbee3('0x29')]();}})[_0xbee3('0x28')](function(_0x31de8a){rimraf(path[_0xbee3('0x5b')](config[_0xbee3('0x68')],_0xbee3('0x4d'),path[_0xbee3('0x5c')](_0x31de8a[_0xbee3('0x7')])),function(){});return _0x31de8a;})[_0xbee3('0x28')](handleEntityNotFound(_0x4e854a,null))[_0xbee3('0x28')](respondWithStatusCode(_0x4e854a,null))[_0xbee3('0x47')](handleError(_0x4e854a,null));};exports[_0xbee3('0x9a')]=function(_0x22af22,_0x3fb366,_0x4b2ab4){return BPromise[_0xbee3('0x9b')]()['then'](function(){if(!_0x22af22[_0xbee3('0x35')][_0xbee3('0x7')]){throw new Error(_0xbee3('0x9c'));}if(!_0x22af22[_0xbee3('0x35')][_0xbee3('0x9d')]){throw new Error(_0xbee3('0x9e'));}var _0x5e84f0=_0x22af22[_0xbee3('0x35')]['hostname']?_0x22af22[_0xbee3('0x35')][_0xbee3('0x9f')]+':'+_0x22af22[_0xbee3('0x35')]['port']:_0xbee3('0xa0')+_0x22af22[_0xbee3('0x35')]['port'];var _0x3e68a1=_0x22af22['query'][_0xbee3('0x20')]?_0x22af22[_0xbee3('0x35')][_0xbee3('0x20')]:!![];var _0x1b1d93=_0x22af22['query'][_0xbee3('0xa1')]?_0x22af22[_0xbee3('0x35')]['encoding']:null;var _0x2c2d67={'method':_0x22af22[_0xbee3('0xa2')],'uri':util[_0xbee3('0x4e')](_0xbee3('0xa3'),_0x5e84f0,_0x22af22[_0xbee3('0x35')]['path']),'json':_0x3e68a1,'resolveWithFullResponse':!![],'encoding':_0x1b1d93,'qs':_0x22af22['query']};if(_0x22af22['headers']){_0x2c2d67[_0xbee3('0xa4')]=_0x22af22[_0xbee3('0xa4')];if(_0x2c2d67[_0xbee3('0xa4')]['content-length']){delete _0x2c2d67['headers'][_0xbee3('0xa5')];}}if(_0x2c2d67[_0xbee3('0xa4')][_0xbee3('0xa6')]){delete _0x2c2d67[_0xbee3('0xa4')][_0xbee3('0xa6')];}return rp(_0x2c2d67);})[_0xbee3('0x28')](function(_0x4e2429){if(_0x4e2429){_0x3fb366[_0xbee3('0x24')](_0x4e2429['headers']);logger[_0xbee3('0x62')](_0x4e2429['body']);if(_[_0xbee3('0xa7')](_0x22af22['query'][_0xbee3('0x7')],'download')&&_0x4e2429[_0xbee3('0xa8')]==0x1f4){return _0x3fb366['sendStatus'](_0x4e2429[_0xbee3('0xa8')]);}else{return _0x3fb366[_0xbee3('0x1e')](_0x4e2429[_0xbee3('0xa8')])['send'](_0x4e2429['body']);}}else{return _0x3fb366[_0xbee3('0x1d')](0xc8);}})[_0xbee3('0x47')](handleError(_0x3fb366,null));};exports[_0xbee3('0xa9')]=function(_0x5d0431,_0xab1ec5,_0x50f3ce){return BPromise['resolve']()[_0xbee3('0x28')](function(){if(!_0x5d0431[_0xbee3('0x35')][_0xbee3('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5d0431[_0xbee3('0x35')]['port']){throw new Error(_0xbee3('0x9e'));}var _0x2b650a=_0x5d0431['query']['hostname']?_0x5d0431['query'][_0xbee3('0x9f')]+':'+_0x5d0431[_0xbee3('0x35')][_0xbee3('0x9d')]:_0xbee3('0xa0')+_0x5d0431[_0xbee3('0x35')][_0xbee3('0x9d')];var _0x48728f=_0x5d0431[_0xbee3('0x35')][_0xbee3('0x20')]?_0x5d0431[_0xbee3('0x35')][_0xbee3('0x20')]:!![];var _0x3e7e7e=_0x5d0431[_0xbee3('0x35')][_0xbee3('0xa1')]?_0x5d0431[_0xbee3('0x35')][_0xbee3('0xa1')]:null;var _0x53cda7={'method':_0x5d0431[_0xbee3('0xa2')],'uri':util[_0xbee3('0x4e')](_0xbee3('0xa3'),_0x2b650a,_0x5d0431['query'][_0xbee3('0x7')]),'json':_0x48728f,'resolveWithFullResponse':!![],'encoding':_0x3e7e7e,'body':_0x5d0431['body']};if(_0x5d0431[_0xbee3('0xa4')]){_0x53cda7[_0xbee3('0xa4')]=_0x5d0431[_0xbee3('0xa4')];if(_0x53cda7[_0xbee3('0xa4')][_0xbee3('0xa5')]){delete _0x53cda7[_0xbee3('0xa4')][_0xbee3('0xa5')];}}if(_0x53cda7['headers'][_0xbee3('0xa6')]){delete _0x53cda7[_0xbee3('0xa4')][_0xbee3('0xa6')];}return rp(_0x53cda7);})['then'](function(_0x13bb54){if(_0x13bb54){_0xab1ec5['set'](_0x13bb54[_0xbee3('0xa4')]);logger['info'](_0x13bb54['body']);return _0xab1ec5[_0xbee3('0x1e')](_0x13bb54[_0xbee3('0xa8')])[_0xbee3('0x96')](_0x13bb54[_0xbee3('0x8e')]);}else{return _0xab1ec5[_0xbee3('0x1d')](0xc8);}})[_0xbee3('0x47')](handleError(_0xab1ec5,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4d94956..15ec5eb 100644 --- a/server/api/plugin/plugin.events.js +++ b/server/api/plugin/plugin.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['hasOwnProperty','hook','exports','../../mysqldb','Plugin','save','update','remove','emit'];(function(_0x313bb3,_0x5af89c){var _0x19ef94=function(_0x2b62f4){while(--_0x2b62f4){_0x313bb3['push'](_0x313bb3['shift']());}};_0x19ef94(++_0x5af89c);}(_0x57ca,0x108));var _0xa57c=function(_0x35e7cb,_0xb3c521){_0x35e7cb=_0x35e7cb-0x0;var _0x459638=_0x57ca[_0x35e7cb];return _0x459638;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xa57c('0x0'))['db'][_0xa57c('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa57c('0x2'),'afterUpdate':_0xa57c('0x3'),'afterDestroy':_0xa57c('0x4')};function emitEvent(_0x15e330){return function(_0x1da469,_0x48be2d,_0x40ba22){PluginEvents[_0xa57c('0x5')](_0x15e330+':'+_0x1da469['id'],_0x1da469);PluginEvents[_0xa57c('0x5')](_0x15e330,_0x1da469);_0x40ba22(null);};}for(var e in events){if(events[_0xa57c('0x6')](e)){var event=events[e];Plugin[_0xa57c('0x7')](e,emitEvent(event));}}module[_0xa57c('0x8')]=PluginEvents; \ No newline at end of file +var _0xf2e3=['remove','emit','hasOwnProperty','hook','exports','events','Plugin','setMaxListeners','save','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf2e3[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x3f2e('0x0'));var Plugin=require('../../mysqldb')['db'][_0x3f2e('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x3f2e('0x2')](0x0);var events={'afterCreate':_0x3f2e('0x3'),'afterUpdate':_0x3f2e('0x4'),'afterDestroy':_0x3f2e('0x5')};function emitEvent(_0x1634cd){return function(_0x3938e2,_0xabcf5c,_0x216b26){PluginEvents['emit'](_0x1634cd+':'+_0x3938e2['id'],_0x3938e2);PluginEvents[_0x3f2e('0x6')](_0x1634cd,_0x3938e2);_0x216b26(null);};}for(var e in events){if(events[_0x3f2e('0x7')](e)){var event=events[e];Plugin[_0x3f2e('0x8')](e,emitEvent(event));}}module[_0x3f2e('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4e92e50..9b2889b 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c12=['./plugin.attributes','define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25e2bc,_0x27d1ef){var _0x5152d3=function(_0x354708){while(--_0x354708){_0x25e2bc['push'](_0x25e2bc['shift']());}};_0x5152d3(++_0x27d1ef);}(_0x5c12,0x188));var _0x25c1=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0x5c12[_0x53f04f];return _0x16a824;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))('api');var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rp=require(_0x25c1('0x4'));var fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require(_0x25c1('0x8'));module['exports']=function(_0x204287,_0x42ac16){return _0x204287[_0x25c1('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33c5=['Plugin','plugins','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x33c5,0xe6));var _0x533c=function(_0x493cea,_0x144c6a){_0x493cea=_0x493cea-0x0;var _0x1c32ba=_0x33c5[_0x493cea];return _0x1c32ba;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('api');var moment=require(_0x533c('0x2'));var BPromise=require(_0x533c('0x3'));var rp=require(_0x533c('0x4'));var fs=require('fs');var path=require(_0x533c('0x5'));var rimraf=require(_0x533c('0x6'));var config=require('../../config/environment');var attributes=require(_0x533c('0x7'));module[_0x533c('0x8')]=function(_0x31d912,_0x151732){return _0x31d912[_0x533c('0x9')](_0x533c('0xa'),attributes,{'tableName':_0x533c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 387c2a1..8445c63 100644 --- a/server/api/plugin/plugin.rpc.js +++ b/server/api/plugin/plugin.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cff=['request','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cff,0x6a));var _0xf5cf=function(_0x547d04,_0x858c6a){_0x547d04=_0x547d04-0x0;var _0x21c8fe=_0x5cff[_0x547d04];return _0x21c8fe;};'use strict';var _=require(_0xf5cf('0x0'));var util=require(_0xf5cf('0x1'));var moment=require(_0xf5cf('0x2'));var BPromise=require(_0xf5cf('0x3'));var rs=require(_0xf5cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5cf('0x5'))['db'];var utils=require(_0xf5cf('0x6'));var logger=require(_0xf5cf('0x7'))(_0xf5cf('0x8'));var config=require(_0xf5cf('0x9'));var jayson=require(_0xf5cf('0xa'));var client=jayson[_0xf5cf('0xb')][_0xf5cf('0xc')]({'port':0x232a});config[_0xf5cf('0xd')]=_['defaults'](config[_0xf5cf('0xd')],{'host':_0xf5cf('0xe'),'port':0x18eb});var socket=require(_0xf5cf('0xf'))(new Redis(config[_0xf5cf('0xd')]));require(_0xf5cf('0x10'))[_0xf5cf('0x11')](socket);function respondWithRpcPromise(_0x3d8f0b,_0x2cc374,_0x37892b){return new BPromise(function(_0x199b6e,_0x40a625){return client[_0xf5cf('0x12')](_0x3d8f0b,_0x37892b)['then'](function(_0x2ae7d3){logger[_0xf5cf('0x13')](_0xf5cf('0x14'),_0x2cc374,_0xf5cf('0x15'));logger['debug'](_0xf5cf('0x16'),_0x2cc374,'request\x20sent',JSON[_0xf5cf('0x17')](_0x2ae7d3));if(_0x2ae7d3[_0xf5cf('0x18')]){if(_0x2ae7d3[_0xf5cf('0x18')][_0xf5cf('0x19')]===0x1f4){logger[_0xf5cf('0x18')]('Plugin,\x20%s,\x20%s',_0x2cc374,_0x2ae7d3[_0xf5cf('0x18')]['message']);return _0x40a625(_0x2ae7d3[_0xf5cf('0x18')][_0xf5cf('0x1a')]);}logger[_0xf5cf('0x18')](_0xf5cf('0x14'),_0x2cc374,_0x2ae7d3['error'][_0xf5cf('0x1a')]);return _0x199b6e(_0x2ae7d3[_0xf5cf('0x18')][_0xf5cf('0x1a')]);}else{logger[_0xf5cf('0x13')]('Plugin,\x20%s,\x20%s',_0x2cc374,_0xf5cf('0x15'));_0x199b6e(_0x2ae7d3[_0xf5cf('0x1b')][_0xf5cf('0x1a')]);}})[_0xf5cf('0x1c')](function(_0x221575){logger[_0xf5cf('0x18')](_0xf5cf('0x14'),_0x2cc374,_0x221575);_0x40a625(_0x221575);});});}exports[_0xf5cf('0x1d')]=function(_0x76e0ab){var _0x25aec8=this;return new Promise(function(_0x9d5893,_0x4918a3){return db['Plugin']['create'](_0x76e0ab['body'],{'raw':_0x76e0ab[_0xf5cf('0x1e')]?_0x76e0ab[_0xf5cf('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x41a596){logger[_0xf5cf('0x13')](_0xf5cf('0x1d'),_0x76e0ab);logger['debug'](_0xf5cf('0x1d'),_0x76e0ab,JSON[_0xf5cf('0x17')](_0x41a596));_0x9d5893(_0x41a596);})[_0xf5cf('0x1c')](function(_0x5f30b9){logger['error'](_0xf5cf('0x1d'),_0x5f30b9[_0xf5cf('0x1a')],_0x76e0ab);_0x4918a3(_0x25aec8[_0xf5cf('0x18')](0x1f4,_0x5f30b9[_0xf5cf('0x1a')]));});});}; \ No newline at end of file +var _0x46bf=['client','http','redis','socket.io-emitter','./plugin.socket','register','request','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x46bf,0x1a2));var _0xf46b=function(_0x38ae4f,_0x1d3180){_0x38ae4f=_0x38ae4f-0x0;var _0x1e92db=_0x46bf[_0x38ae4f];return _0x1e92db;};'use strict';var _=require(_0xf46b('0x0'));var util=require(_0xf46b('0x1'));var moment=require(_0xf46b('0x2'));var BPromise=require(_0xf46b('0x3'));var rs=require(_0xf46b('0x4'));var fs=require('fs');var Redis=require(_0xf46b('0x5'));var db=require(_0xf46b('0x6'))['db'];var utils=require(_0xf46b('0x7'));var logger=require(_0xf46b('0x8'))('rpc');var config=require(_0xf46b('0x9'));var jayson=require(_0xf46b('0xa'));var client=jayson[_0xf46b('0xb')][_0xf46b('0xc')]({'port':0x232a});config[_0xf46b('0xd')]=_['defaults'](config[_0xf46b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf46b('0xe'))(new Redis(config[_0xf46b('0xd')]));require(_0xf46b('0xf'))[_0xf46b('0x10')](socket);function respondWithRpcPromise(_0x31ff33,_0x3af2e4,_0x2ae89c){return new BPromise(function(_0x14525e,_0x5baee1){return client[_0xf46b('0x11')](_0x31ff33,_0x2ae89c)[_0xf46b('0x12')](function(_0x58e645){logger[_0xf46b('0x13')]('Plugin,\x20%s,\x20%s',_0x3af2e4,'request\x20sent');logger[_0xf46b('0x14')](_0xf46b('0x15'),_0x3af2e4,_0xf46b('0x16'),JSON[_0xf46b('0x17')](_0x58e645));if(_0x58e645[_0xf46b('0x18')]){if(_0x58e645[_0xf46b('0x18')][_0xf46b('0x19')]===0x1f4){logger['error'](_0xf46b('0x1a'),_0x3af2e4,_0x58e645['error'][_0xf46b('0x1b')]);return _0x5baee1(_0x58e645[_0xf46b('0x18')][_0xf46b('0x1b')]);}logger[_0xf46b('0x18')](_0xf46b('0x1a'),_0x3af2e4,_0x58e645[_0xf46b('0x18')][_0xf46b('0x1b')]);return _0x14525e(_0x58e645[_0xf46b('0x18')][_0xf46b('0x1b')]);}else{logger[_0xf46b('0x13')]('Plugin,\x20%s,\x20%s',_0x3af2e4,_0xf46b('0x16'));_0x14525e(_0x58e645[_0xf46b('0x1c')][_0xf46b('0x1b')]);}})['catch'](function(_0x2c2272){logger[_0xf46b('0x18')](_0xf46b('0x1a'),_0x3af2e4,_0x2c2272);_0x5baee1(_0x2c2272);});});}exports[_0xf46b('0x1d')]=function(_0x3f972e){var _0x1f0916=this;return new Promise(function(_0x5e2377,_0x1283fc){return db['Plugin'][_0xf46b('0x1e')](_0x3f972e['body'],{'raw':_0x3f972e[_0xf46b('0x1f')]?_0x3f972e['options'][_0xf46b('0x20')]===undefined?!![]:![]:!![]})[_0xf46b('0x12')](function(_0x3dc458){logger[_0xf46b('0x13')](_0xf46b('0x1d'),_0x3f972e);logger[_0xf46b('0x14')](_0xf46b('0x1d'),_0x3f972e,JSON[_0xf46b('0x17')](_0x3dc458));_0x5e2377(_0x3dc458);})['catch'](function(_0x3393b2){logger[_0xf46b('0x18')](_0xf46b('0x1d'),_0x3393b2[_0xf46b('0x1b')],_0x3f972e);_0x1283fc(_0x1f0916[_0xf46b('0x18')](0x1f4,_0x3393b2[_0xf46b('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0333fec..f3db648 100644 --- a/server/api/plugin/plugin.socket.js +++ b/server/api/plugin/plugin.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcad1=['emit','removeListener','register','plugin:','save','remove'];(function(_0x6090f2,_0x90b872){var _0x2618d2=function(_0x3c4aa3){while(--_0x3c4aa3){_0x6090f2['push'](_0x6090f2['shift']());}};_0x2618d2(++_0x90b872);}(_0xcad1,0x16c));var _0x1cad=function(_0x27f056,_0x2e0600){_0x27f056=_0x27f056-0x0;var _0x4b9265=_0xcad1[_0x27f056];return _0x4b9265;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x1cad('0x0'),_0x1cad('0x1'),'update'];function createListener(_0x5a38e5,_0x3c78ca){return function(_0x3c7401){_0x3c78ca[_0x1cad('0x2')](_0x5a38e5,_0x3c7401);};}function removeListener(_0x1fddf9,_0x52b7aa){return function(){PluginEvents[_0x1cad('0x3')](_0x1fddf9,_0x52b7aa);};}exports[_0x1cad('0x4')]=function(_0x1358e0){for(var _0x56b487=0x0,_0x540201=events['length'];_0x56b487<_0x540201;_0x56b487++){var _0x27fec9=events[_0x56b487];var _0x5a79f7=createListener(_0x1cad('0x5')+_0x27fec9,_0x1358e0);PluginEvents['on'](_0x27fec9,_0x5a79f7);}}; \ No newline at end of file +var _0x1a40=['register','length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x1a40,0xb7));var _0x01a4=function(_0x8d2363,_0x5e83a3){_0x8d2363=_0x8d2363-0x0;var _0x2f2a1b=_0x1a40[_0x8d2363];return _0x2f2a1b;};'use strict';var PluginEvents=require(_0x01a4('0x0'));var events=[_0x01a4('0x1'),_0x01a4('0x2'),_0x01a4('0x3')];function createListener(_0x39ac21,_0x39f40a){return function(_0x32ecae){_0x39f40a[_0x01a4('0x4')](_0x39ac21,_0x32ecae);};}function removeListener(_0x3c096a,_0x4762fc){return function(){PluginEvents[_0x01a4('0x5')](_0x3c096a,_0x4762fc);};}exports[_0x01a4('0x6')]=function(_0x2e6cde){for(var _0xce027e=0x0,_0x14b7bc=events[_0x01a4('0x7')];_0xce027e<_0x14b7bc;_0xce027e++){var _0x167c0a=events[_0xce027e];var _0x5d4544=createListener(_0x01a4('0x8')+_0x167c0a,_0x2e6cde);PluginEvents['on'](_0x167c0a,_0x5d4544);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 7cbd5ed..7015890 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc658=['Router','../../components/auth/service','./pm2.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','express'];(function(_0x3ecf42,_0x54a214){var _0x3f80c0=function(_0x4c2ce3){while(--_0x4c2ce3){_0x3ecf42['push'](_0x3ecf42['shift']());}};_0x3f80c0(++_0x54a214);}(_0xc658,0x14f));var _0x8c65=function(_0x274db5,_0xde0e65){_0x274db5=_0x274db5-0x0;var _0x41262e=_0xc658[_0x274db5];return _0x41262e;};'use strict';var express=require(_0x8c65('0x0'));var router=express[_0x8c65('0x1')]();var auth=require(_0x8c65('0x2'));var controller=require(_0x8c65('0x3'));router['get']('/',auth[_0x8c65('0x4')](),controller['index']);router[_0x8c65('0x5')](_0x8c65('0x6'),auth[_0x8c65('0x4')](),controller[_0x8c65('0x7')]);router[_0x8c65('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c65('0x9')]);router[_0x8c65('0xa')](_0x8c65('0x6'),auth[_0x8c65('0x4')](),controller[_0x8c65('0xb')]);router[_0x8c65('0xc')](_0x8c65('0x6'),auth[_0x8c65('0x4')](),controller[_0x8c65('0xd')]);module['exports']=router; \ No newline at end of file +var _0xe1e2=['show','post','isAuthenticated','create','put','delete','exports','express','Router','get','index','/:id'];(function(_0x2d70e5,_0x297b6a){var _0x118960=function(_0x2d0ae2){while(--_0x2d0ae2){_0x2d70e5['push'](_0x2d70e5['shift']());}};_0x118960(++_0x297b6a);}(_0xe1e2,0x187));var _0x2e1e=function(_0x937379,_0x4688a0){_0x937379=_0x937379-0x0;var _0x465709=_0xe1e2[_0x937379];return _0x465709;};'use strict';var express=require(_0x2e1e('0x0'));var router=express[_0x2e1e('0x1')]();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0x2e1e('0x2')]('/',auth['isAuthenticated'](),controller[_0x2e1e('0x3')]);router[_0x2e1e('0x2')](_0x2e1e('0x4'),auth['isAuthenticated'](),controller[_0x2e1e('0x5')]);router[_0x2e1e('0x6')]('/',auth[_0x2e1e('0x7')](),controller[_0x2e1e('0x8')]);router[_0x2e1e('0x9')]('/:id',auth[_0x2e1e('0x7')](),controller['update']);router[_0x2e1e('0xa')]('/:id',auth[_0x2e1e('0x7')](),controller['destroy']);module[_0x2e1e('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index e0ca265..b63ab0b 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22e1=['length','show','describe','catch','create','body','script','join','chdir','dirname','Missing\x20name\x20and/or\x20path','restart','stop','params','Unknown\x20status','destroy','delete','dump','lodash','../../config/logger','path','child_process','exec','sendStatus','status','json','error','stack','name','send','info','index','then','reject','express','motion2'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x22e1,0x156));var _0x122e=function(_0x30d618,_0x590668){_0x30d618=_0x30d618-0x0;var _0x39731a=_0x22e1[_0x30d618];return _0x39731a;};'use strict';var _=require(_0x122e('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x122e('0x1'))('api');var path=require(_0x122e('0x2'));var exec=require(_0x122e('0x3'))[_0x122e('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x16a834,_0x5bded9){return function(_0x4bc751){if(!_0x4bc751){_0x16a834[_0x122e('0x5')](0x194);;}return _0x4bc751;};}function respondWithResult(_0x9e1e75,_0x459736){_0x459736=_0x459736||0xc8;return function(_0x3cb408){if(_0x3cb408){return _0x9e1e75[_0x122e('0x6')](_0x459736)[_0x122e('0x7')](_0x3cb408);}return null;};}function handleError(_0x5038d3,_0x23f306){_0x23f306=_0x23f306||0x1f4;return function(_0x867f12){logger[_0x122e('0x8')](_0x867f12[_0x122e('0x9')]);if(_0x867f12[_0x122e('0xa')]){delete _0x867f12[_0x122e('0xa')];}_0x5038d3[_0x122e('0x6')](_0x23f306)[_0x122e('0xb')](_0x867f12);};}function execChildProcess(){return new BPromise(function(_0x4638f8,_0x3af907){exec('npm\x20install',function(_0x496628,_0x11eeee,_0x156f87){logger['info'](_0x11eeee);logger[_0x122e('0xc')](_0x156f87);if(_0x496628){logger[_0x122e('0x8')](_0x496628);return _0x3af907(_0x496628);}return _0x4638f8(_0x11eeee);});});}exports[_0x122e('0xd')]=function(_0x59f9dc,_0x457159){return pm2['list']()[_0x122e('0xe')](function(_0xe860d0){if(_0xe860d0){var _0x349e77=_[_0x122e('0xf')](_0xe860d0,function(_0x5a441b){return _0x5a441b[_0x122e('0xa')]===_0x122e('0x10')||_0x5a441b[_0x122e('0xa')]===_0x122e('0x11');});return{'rows':_0x349e77,'count':_0x349e77[_0x122e('0x12')]};}return null;})['then'](respondWithResult(_0x457159,null))['catch'](handleError(_0x457159,null));};exports[_0x122e('0x13')]=function(_0x2cf792,_0x7d9ef4){return pm2[_0x122e('0x14')](_0x2cf792['params']['id'])[_0x122e('0xe')](respondWithResult(_0x7d9ef4,null))['then'](handleEntityNotFound(_0x7d9ef4,null))[_0x122e('0x15')](handleError(_0x7d9ef4,null));};exports[_0x122e('0x16')]=function(_0x5d5c31,_0x2c608c){if(_0x5d5c31['body'][_0x122e('0xa')]&&_0x5d5c31[_0x122e('0x17')][_0x122e('0x18')]){var _0x4d8d60=path[_0x122e('0x19')](__dirname,'../../files/plugins',_0x5d5c31[_0x122e('0x17')][_0x122e('0x18')]);var _0x2ea7d4=process['cwd']();process[_0x122e('0x1a')](path[_0x122e('0x1b')](_0x4d8d60));return execChildProcess()['then'](function(_0x3e5b33){process[_0x122e('0x1a')](_0x2ea7d4);return pm2['start']({'name':_0x5d5c31[_0x122e('0x17')][_0x122e('0xa')],'script':_0x4d8d60});})[_0x122e('0xe')](function(_0x97cb05){pm2['dump']();return _0x97cb05[0x0];})['then'](respondWithResult(_0x2c608c,0xc9))['catch'](handleError(_0x2c608c,null));}else{return _0x2c608c[_0x122e('0x6')](0x1f4)[_0x122e('0xb')]({'message':_0x122e('0x1c')});}};exports['update']=function(_0x16f9d4,_0x109f31){if(_0x16f9d4[_0x122e('0x17')]['id']){delete _0x16f9d4['body']['id'];}var _0x3e1f4a={'online':_0x122e('0x1d'),'stopped':_0x122e('0x1e')};if(_0x3e1f4a['hasOwnProperty'](_0x16f9d4['body'][_0x122e('0x6')])){return pm2[_0x3e1f4a[_0x16f9d4[_0x122e('0x17')][_0x122e('0x6')]]](_0x16f9d4[_0x122e('0x1f')]['id'])[_0x122e('0xe')](respondWithResult(_0x109f31,0xc8))[_0x122e('0x15')](handleError(_0x109f31,null));}else{return _0x109f31[_0x122e('0x6')](0x1f4)[_0x122e('0xb')]({'message':_0x122e('0x20')});}};exports[_0x122e('0x21')]=function(_0x165a7a,_0x26d63e){if(_0x165a7a['body']['id']){delete _0x165a7a[_0x122e('0x17')]['id'];}if(_0x165a7a['params']['id']){return pm2[_0x122e('0x22')](_0x165a7a[_0x122e('0x1f')]['id'])[_0x122e('0xe')](function(_0x2982ba){pm2[_0x122e('0x23')]();return _0x2982ba[0x0];})[_0x122e('0xe')](respondWithResult(_0x26d63e,null))[_0x122e('0x15')](handleError(_0x26d63e,null));}else{return _0x26d63e['status'](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xc041=['motion2','catch','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20status','destroy','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','sendStatus','status','json','error','name','send','npm\x20install','info','index','then'];(function(_0x49d0ae,_0x3bebf3){var _0x4d6723=function(_0x2824a1){while(--_0x2824a1){_0x49d0ae['push'](_0x49d0ae['shift']());}};_0x4d6723(++_0x3bebf3);}(_0xc041,0x9b));var _0x1c04=function(_0x245c4f,_0x34b70f){_0x245c4f=_0x245c4f-0x0;var _0x3157a1=_0xc041[_0x245c4f];return _0x3157a1;};'use strict';var _=require('lodash');var pm2=require(_0x1c04('0x0'));var logger=require(_0x1c04('0x1'))(_0x1c04('0x2'));var path=require(_0x1c04('0x3'));var exec=require('child_process')[_0x1c04('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5c6ce6,_0x2e07e8){return function(_0x5bb1d9){if(!_0x5bb1d9){_0x5c6ce6[_0x1c04('0x5')](0x194);;}return _0x5bb1d9;};}function respondWithResult(_0x23c6e7,_0x2f15dd){_0x2f15dd=_0x2f15dd||0xc8;return function(_0x40c5f4){if(_0x40c5f4){return _0x23c6e7[_0x1c04('0x6')](_0x2f15dd)[_0x1c04('0x7')](_0x40c5f4);}return null;};}function handleError(_0x453238,_0xb73257){_0xb73257=_0xb73257||0x1f4;return function(_0x575ddb){logger[_0x1c04('0x8')](_0x575ddb['stack']);if(_0x575ddb[_0x1c04('0x9')]){delete _0x575ddb[_0x1c04('0x9')];}_0x453238[_0x1c04('0x6')](_0xb73257)[_0x1c04('0xa')](_0x575ddb);};}function execChildProcess(){return new BPromise(function(_0x53e636,_0x3f9a9e){exec(_0x1c04('0xb'),function(_0xefe7f2,_0x3b05c7,_0x4cbb4a){logger[_0x1c04('0xc')](_0x3b05c7);logger[_0x1c04('0xc')](_0x4cbb4a);if(_0xefe7f2){logger[_0x1c04('0x8')](_0xefe7f2);return _0x3f9a9e(_0xefe7f2);}return _0x53e636(_0x3b05c7);});});}exports[_0x1c04('0xd')]=function(_0x274135,_0x32f826){return pm2['list']()[_0x1c04('0xe')](function(_0x142b3d){if(_0x142b3d){var _0x3be972=_['reject'](_0x142b3d,function(_0x18827f){return _0x18827f[_0x1c04('0x9')]==='express'||_0x18827f[_0x1c04('0x9')]===_0x1c04('0xf');});return{'rows':_0x3be972,'count':_0x3be972['length']};}return null;})['then'](respondWithResult(_0x32f826,null))[_0x1c04('0x10')](handleError(_0x32f826,null));};exports[_0x1c04('0x11')]=function(_0x5b01e1,_0x43fc4f){return pm2[_0x1c04('0x12')](_0x5b01e1[_0x1c04('0x13')]['id'])[_0x1c04('0xe')](respondWithResult(_0x43fc4f,null))[_0x1c04('0xe')](handleEntityNotFound(_0x43fc4f,null))[_0x1c04('0x10')](handleError(_0x43fc4f,null));};exports[_0x1c04('0x14')]=function(_0x1f815d,_0x4361b8){if(_0x1f815d[_0x1c04('0x15')][_0x1c04('0x9')]&&_0x1f815d[_0x1c04('0x15')][_0x1c04('0x16')]){var _0x4f524d=path['join'](__dirname,_0x1c04('0x17'),_0x1f815d['body'][_0x1c04('0x16')]);var _0x5384cf=process[_0x1c04('0x18')]();process[_0x1c04('0x19')](path[_0x1c04('0x1a')](_0x4f524d));return execChildProcess()['then'](function(_0x2ac3be){process[_0x1c04('0x19')](_0x5384cf);return pm2['start']({'name':_0x1f815d[_0x1c04('0x15')][_0x1c04('0x9')],'script':_0x4f524d});})[_0x1c04('0xe')](function(_0x491369){pm2[_0x1c04('0x1b')]();return _0x491369[0x0];})[_0x1c04('0xe')](respondWithResult(_0x4361b8,0xc9))[_0x1c04('0x10')](handleError(_0x4361b8,null));}else{return _0x4361b8[_0x1c04('0x6')](0x1f4)[_0x1c04('0xa')]({'message':_0x1c04('0x1c')});}};exports['update']=function(_0x11676d,_0x54fa5e){if(_0x11676d[_0x1c04('0x15')]['id']){delete _0x11676d['body']['id'];}var _0x5bcddb={'online':_0x1c04('0x1d'),'stopped':'stop'};if(_0x5bcddb[_0x1c04('0x1e')](_0x11676d[_0x1c04('0x15')][_0x1c04('0x6')])){return pm2[_0x5bcddb[_0x11676d[_0x1c04('0x15')][_0x1c04('0x6')]]](_0x11676d[_0x1c04('0x13')]['id'])['then'](respondWithResult(_0x54fa5e,0xc8))[_0x1c04('0x10')](handleError(_0x54fa5e,null));}else{return _0x54fa5e[_0x1c04('0x6')](0x1f4)[_0x1c04('0xa')]({'message':_0x1c04('0x1f')});}};exports[_0x1c04('0x20')]=function(_0x727617,_0x3ebbbc){if(_0x727617[_0x1c04('0x15')]['id']){delete _0x727617['body']['id'];}if(_0x727617[_0x1c04('0x13')]['id']){return pm2['delete'](_0x727617[_0x1c04('0x13')]['id'])[_0x1c04('0xe')](function(_0x204b30){pm2[_0x1c04('0x1b')]();return _0x204b30[0x0];})['then'](respondWithResult(_0x3ebbbc,null))[_0x1c04('0x10')](handleError(_0x3ebbbc,null));}else{return _0x3ebbbc[_0x1c04('0x6')](0x1f4)['send']({'message':_0x1c04('0x21')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 8ff1fb2..28062f4 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b80=['util','connect-timeout','../../config/environment','exports','multer'];(function(_0x4c5f37,_0x4cdde0){var _0x404426=function(_0x2898fe){while(--_0x2898fe){_0x4c5f37['push'](_0x4c5f37['shift']());}};_0x404426(++_0x4cdde0);}(_0x9b80,0xcc));var _0x09b8=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x9b80[_0x2c3255];return _0x282aba;};'use strict';var multer=require(_0x09b8('0x0'));var util=require(_0x09b8('0x1'));var path=require('path');var timeout=require(_0x09b8('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x09b8('0x3'));module[_0x09b8('0x4')]=router; \ No newline at end of file +var _0xcef4=['multer','path','express','../../components/interaction/service','../../config/environment'];(function(_0x21308a,_0x16b4a4){var _0x390f9a=function(_0x1a58ba){while(--_0x1a58ba){_0x21308a['push'](_0x21308a['shift']());}};_0x390f9a(++_0x16b4a4);}(_0xcef4,0x7d));var _0x4cef=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0xcef4[_0x2afb44];return _0x15ccc2;};'use strict';var multer=require(_0x4cef('0x0'));var util=require('util');var path=require(_0x4cef('0x1'));var timeout=require('connect-timeout');var express=require(_0x4cef('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4cef('0x3'));var config=require(_0x4cef('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a551b2b..253733d 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.attributes.js +++ b/server/api/reportAgentPreview/reportAgentPreview.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15f3=['exports','INTEGER','DATE','STRING','sequelize'];(function(_0x24df34,_0x50aa1a){var _0x3980e8=function(_0x24c43f){while(--_0x24c43f){_0x24df34['push'](_0x24df34['shift']());}};_0x3980e8(++_0x50aa1a);}(_0x15f3,0x13a));var _0x315f=function(_0x12b405,_0x12cd13){_0x12b405=_0x12b405-0x0;var _0x3ec8b5=_0x15f3[_0x12b405];return _0x3ec8b5;};'use strict';var Sequelize=require(_0x315f('0x0'));module[_0x315f('0x1')]={'state':{'type':Sequelize[_0x315f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x315f('0x3')]},'responsetime':{'type':Sequelize[_0x315f('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x315f('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x315f('0x4')]}}; \ No newline at end of file +var _0x29e8=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x2ef004,_0x22b0e4){var _0x55728c=function(_0x2add31){while(--_0x2add31){_0x2ef004['push'](_0x2ef004['shift']());}};_0x55728c(++_0x22b0e4);}(_0x29e8,0xdf));var _0x829e=function(_0x556631,_0x22a74c){_0x556631=_0x556631-0x0;var _0x3e10c6=_0x29e8[_0x556631];return _0x3e10c6;};'use strict';var Sequelize=require(_0x829e('0x0'));module[_0x829e('0x1')]={'state':{'type':Sequelize[_0x829e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x829e('0x3')]},'scheduledat':{'type':Sequelize[_0x829e('0x4')]},'uniqueid':{'type':Sequelize[_0x829e('0x3')]},'starttime':{'type':Sequelize[_0x829e('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x829e('0x3')]},'campaigntype':{'type':Sequelize[_0x829e('0x3')]},'membername':{'type':Sequelize[_0x829e('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5632923..68c5e0e 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.model.js +++ b/server/api/reportAgentPreview/reportAgentPreview.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd41a=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2c6a9c,_0x433116){var _0x15affb=function(_0x260f4b){while(--_0x260f4b){_0x2c6a9c['push'](_0x2c6a9c['shift']());}};_0x15affb(++_0x433116);}(_0xd41a,0xf9));var _0xad41=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0xd41a[_0x3f88bc];return _0x4df1c4;};'use strict';var _=require(_0xad41('0x0'));var util=require(_0xad41('0x1'));var logger=require(_0xad41('0x2'))(_0xad41('0x3'));var moment=require(_0xad41('0x4'));var BPromise=require(_0xad41('0x5'));var rp=require(_0xad41('0x6'));var fs=require('fs');var path=require(_0xad41('0x7'));var rimraf=require('rimraf');var config=require(_0xad41('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0xad41('0x9')]=function(_0x13c59e,_0xe7c87a){return _0x13c59e[_0xad41('0xa')](_0xad41('0xb'),attributes,{'tableName':_0xad41('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4da=['bluebird','path','rimraf','../../config/environment','exports','ReportAgentPreview','report_agent_preview','api','moment'];(function(_0x570b67,_0x5d27d3){var _0x2bb6ce=function(_0x2a44b8){while(--_0x2a44b8){_0x570b67['push'](_0x570b67['shift']());}};_0x2bb6ce(++_0x5d27d3);}(_0xa4da,0x1ae));var _0xaa4d=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xa4da[_0x1bb58c];return _0x277586;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xaa4d('0x0'));var moment=require(_0xaa4d('0x1'));var BPromise=require(_0xaa4d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa4d('0x3'));var rimraf=require(_0xaa4d('0x4'));var config=require(_0xaa4d('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0xaa4d('0x6')]=function(_0x2a799c,_0x2b1a8c){return _0x2a799c['define'](_0xaa4d('0x7'),attributes,{'tableName':_0xaa4d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index eba524d..7af03bc 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.rpc.js +++ b/server/api/reportAgentPreview/reportAgentPreview.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7559=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','debug','stringify','util','moment','randomstring','ioredis'];(function(_0x30bb30,_0x564af1){var _0xce44e7=function(_0x5b96aa){while(--_0x5b96aa){_0x30bb30['push'](_0x30bb30['shift']());}};_0xce44e7(++_0x564af1);}(_0x7559,0x1c7));var _0x9755=function(_0x4520d1,_0x4cf583){_0x4520d1=_0x4520d1-0x0;var _0x1c8a56=_0x7559[_0x4520d1];return _0x1c8a56;};'use strict';var _=require('lodash');var util=require(_0x9755('0x0'));var moment=require(_0x9755('0x1'));var BPromise=require('bluebird');var rs=require(_0x9755('0x2'));var fs=require('fs');var Redis=require(_0x9755('0x3'));var db=require(_0x9755('0x4'))['db'];var utils=require(_0x9755('0x5'));var logger=require(_0x9755('0x6'))(_0x9755('0x7'));var config=require(_0x9755('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9755('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x253a92,_0x215f2a,_0x139712){return new BPromise(function(_0x1147af,_0x50ef6f){return client[_0x9755('0xa')](_0x253a92,_0x139712)[_0x9755('0xb')](function(_0x1ebb9f){logger['info'](_0x9755('0xc'),_0x215f2a,'request\x20sent');logger['debug'](_0x9755('0xd'),_0x215f2a,_0x9755('0xe'),JSON['stringify'](_0x1ebb9f));if(_0x1ebb9f[_0x9755('0xf')]){if(_0x1ebb9f[_0x9755('0xf')][_0x9755('0x10')]===0x1f4){logger[_0x9755('0xf')](_0x9755('0xc'),_0x215f2a,_0x1ebb9f[_0x9755('0xf')][_0x9755('0x11')]);return _0x50ef6f(_0x1ebb9f[_0x9755('0xf')][_0x9755('0x11')]);}logger['error'](_0x9755('0xc'),_0x215f2a,_0x1ebb9f[_0x9755('0xf')][_0x9755('0x11')]);return _0x1147af(_0x1ebb9f[_0x9755('0xf')]['message']);}else{logger[_0x9755('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x215f2a,'request\x20sent');_0x1147af(_0x1ebb9f['result'][_0x9755('0x11')]);}})[_0x9755('0x13')](function(_0x3232bb){logger[_0x9755('0xf')](_0x9755('0xc'),_0x215f2a,_0x3232bb);_0x50ef6f(_0x3232bb);});});}exports[_0x9755('0x14')]=function(_0x311821){var _0x1e7e32=this;return new Promise(function(_0x721cfe,_0x5f4ea7){return db[_0x9755('0x15')][_0x9755('0x16')](_0x311821[_0x9755('0x17')],{'raw':_0x311821[_0x9755('0x18')]?_0x311821[_0x9755('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9755('0xb')](function(_0x1b26c7){logger[_0x9755('0x12')](_0x9755('0x14'),_0x311821);logger[_0x9755('0x19')](_0x9755('0x14'),_0x311821,JSON[_0x9755('0x1a')](_0x1b26c7));_0x721cfe(_0x1b26c7);})['catch'](function(_0x1edcce){logger['error'](_0x9755('0x14'),_0x1edcce[_0x9755('0x11')],_0x311821);_0x5f4ea7(_0x1e7e32[_0x9755('0xf')](0x1f4,_0x1edcce[_0x9755('0x11')]));});});}; \ No newline at end of file +var _0x66b0=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x42b8ab,_0x4b7771){var _0x5cb9ef=function(_0x591f1c){while(--_0x591f1c){_0x42b8ab['push'](_0x42b8ab['shift']());}};_0x5cb9ef(++_0x4b7771);}(_0x66b0,0x6c));var _0x066b=function(_0x20c8fe,_0x10ecf3){_0x20c8fe=_0x20c8fe-0x0;var _0x3e727f=_0x66b0[_0x20c8fe];return _0x3e727f;};'use strict';var _=require(_0x066b('0x0'));var util=require('util');var moment=require(_0x066b('0x1'));var BPromise=require(_0x066b('0x2'));var rs=require(_0x066b('0x3'));var fs=require('fs');var Redis=require(_0x066b('0x4'));var db=require(_0x066b('0x5'))['db'];var utils=require(_0x066b('0x6'));var logger=require(_0x066b('0x7'))(_0x066b('0x8'));var config=require(_0x066b('0x9'));var jayson=require(_0x066b('0xa'));var client=jayson[_0x066b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x514c49,_0x54ae26,_0xa5dbeb){return new BPromise(function(_0x43cb4d,_0x296895){return client[_0x066b('0xc')](_0x514c49,_0xa5dbeb)[_0x066b('0xd')](function(_0x228c44){logger[_0x066b('0xe')](_0x066b('0xf'),_0x54ae26,_0x066b('0x10'));logger[_0x066b('0x11')](_0x066b('0x12'),_0x54ae26,_0x066b('0x10'),JSON[_0x066b('0x13')](_0x228c44));if(_0x228c44['error']){if(_0x228c44[_0x066b('0x14')][_0x066b('0x15')]===0x1f4){logger[_0x066b('0x14')](_0x066b('0xf'),_0x54ae26,_0x228c44[_0x066b('0x14')]['message']);return _0x296895(_0x228c44[_0x066b('0x14')][_0x066b('0x16')]);}logger[_0x066b('0x14')](_0x066b('0xf'),_0x54ae26,_0x228c44['error'][_0x066b('0x16')]);return _0x43cb4d(_0x228c44[_0x066b('0x14')][_0x066b('0x16')]);}else{logger['info'](_0x066b('0xf'),_0x54ae26,_0x066b('0x10'));_0x43cb4d(_0x228c44[_0x066b('0x17')]['message']);}})[_0x066b('0x18')](function(_0x563c57){logger[_0x066b('0x14')](_0x066b('0xf'),_0x54ae26,_0x563c57);_0x296895(_0x563c57);});});}exports[_0x066b('0x19')]=function(_0x43522a){var _0x6440a0=this;return new Promise(function(_0x730155,_0x3f3ced){return db[_0x066b('0x1a')][_0x066b('0x1b')](_0x43522a[_0x066b('0x1c')],{'raw':_0x43522a[_0x066b('0x1d')]?_0x43522a['options'][_0x066b('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5273ed){logger[_0x066b('0xe')](_0x066b('0x19'),_0x43522a);logger[_0x066b('0x11')](_0x066b('0x19'),_0x43522a,JSON[_0x066b('0x13')](_0x5273ed));_0x730155(_0x5273ed);})[_0x066b('0x18')](function(_0x5b4dab){logger[_0x066b('0x14')](_0x066b('0x19'),_0x5b4dab[_0x066b('0x16')],_0x43522a);_0x3f3ced(_0x6440a0[_0x066b('0x14')](0x1f4,_0x5b4dab[_0x066b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 02ed922..8291f9b 100644 --- a/server/api/rpc/index.js +++ b/server/api/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e54=['showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','post','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0x4e54,0xad));var _0x44e5=function(_0x153512,_0x5016c2){_0x153512=_0x153512-0x0;var _0xf9682b=_0x4e54[_0x153512];return _0xf9682b;};'use strict';var multer=require(_0x44e5('0x0'));var util=require('util');var path=require(_0x44e5('0x1'));var express=require(_0x44e5('0x2'));var router=express[_0x44e5('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x44e5('0x4')](_0x44e5('0x5'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x7')]);router[_0x44e5('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x44e5('0x6')](),controller['voiceChannelMixMonitor']);router[_0x44e5('0x4')](_0x44e5('0x8'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x9')]);router[_0x44e5('0x4')](_0x44e5('0xa'),auth[_0x44e5('0x6')](),controller[_0x44e5('0xb')]);router[_0x44e5('0x4')](_0x44e5('0xc'),auth[_0x44e5('0x6')](),controller[_0x44e5('0xd')]);router['get'](_0x44e5('0xe'),auth[_0x44e5('0x6')](),controller['mailQueues']);router[_0x44e5('0x4')](_0x44e5('0xf'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x10')]);router[_0x44e5('0x4')](_0x44e5('0x11'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x12')]);router[_0x44e5('0x4')](_0x44e5('0x13'),auth['isAuthenticated'](),controller[_0x44e5('0x14')]);router['get'](_0x44e5('0x15'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x16')]);router[_0x44e5('0x4')]('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router[_0x44e5('0x4')](_0x44e5('0x17'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x18')]);router[_0x44e5('0x4')](_0x44e5('0x19'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x1a')]);router[_0x44e5('0x4')](_0x44e5('0x1b'),auth[_0x44e5('0x6')](),controller['voiceQueuesChannel']);router[_0x44e5('0x4')](_0x44e5('0x1c'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x1d')]);router[_0x44e5('0x4')](_0x44e5('0x1e'),auth['isAuthenticated'](),controller[_0x44e5('0x1f')]);router[_0x44e5('0x4')](_0x44e5('0x20'),auth['isAuthenticated'](),controller[_0x44e5('0x21')]);router[_0x44e5('0x4')]('/outbound',auth['isAuthenticated'](),controller[_0x44e5('0x22')]);router[_0x44e5('0x4')]('/outbound/channels',auth[_0x44e5('0x6')](),controller[_0x44e5('0x23')]);router[_0x44e5('0x4')](_0x44e5('0x24'),auth['isAuthenticated'](),controller[_0x44e5('0x25')]);router[_0x44e5('0x26')](_0x44e5('0x27'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x44e5('0x4')](_0x44e5('0x28'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x29')]);router[_0x44e5('0x4')](_0x44e5('0x2a'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x2b')]);router[_0x44e5('0x4')]('/campaigns',auth[_0x44e5('0x6')](),controller[_0x44e5('0x2c')]);router[_0x44e5('0x4')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x44e5('0x4')](_0x44e5('0x2d'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x2e')]);router[_0x44e5('0x4')](_0x44e5('0x2f'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x30')]);router['get'](_0x44e5('0x31'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x32')]);router[_0x44e5('0x4')](_0x44e5('0x33'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x34')]);router[_0x44e5('0x4')](_0x44e5('0x35'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x36')]);router[_0x44e5('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0x44e5('0x6')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x44e5('0x37'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x38')]);router['post'](_0x44e5('0x39'),auth['isAuthenticated'](),controller['queueNotify'](_0x44e5('0x3a')));router[_0x44e5('0x4')]('/mail/queues/:id',auth[_0x44e5('0x6')](),controller['showMailQueues']);router[_0x44e5('0x3b')]('/chat/queues/:id/notify',auth[_0x44e5('0x6')](),controller[_0x44e5('0x3c')](_0x44e5('0x3d')));router[_0x44e5('0x4')](_0x44e5('0x3e'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x3f')]);router[_0x44e5('0x3b')](_0x44e5('0x40'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x3c')](_0x44e5('0x41')));router[_0x44e5('0x4')](_0x44e5('0x42'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x43')]);router[_0x44e5('0x3b')](_0x44e5('0x44'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x3c')]('openchannel'));router[_0x44e5('0x4')](_0x44e5('0x45'),auth['isAuthenticated'](),controller[_0x44e5('0x46')]);router[_0x44e5('0x3b')](_0x44e5('0x47'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x3c')]('sms'));router['post'](_0x44e5('0x48'),auth['isAuthenticated'](),controller[_0x44e5('0x3c')](_0x44e5('0x49')));router['get'](_0x44e5('0x4a'),auth['isAuthenticated'](),controller[_0x44e5('0x4b')]);router[_0x44e5('0x4')](_0x44e5('0x4c'),auth['isAuthenticated'](),controller[_0x44e5('0x4d')]);router['post'](_0x44e5('0x4e'),auth[_0x44e5('0x6')](),controller[_0x44e5('0x4f')]);module[_0x44e5('0x50')]=router; \ No newline at end of file +var _0x80b0=['smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','mail','showMailQueues','queueNotify','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/outbound','outbound','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x80b0,0x139));var _0x080b=function(_0x1cfaba,_0x55d5a1){_0x1cfaba=_0x1cfaba-0x0;var _0x3a9e1b=_0x80b0[_0x1cfaba];return _0x3a9e1b;};'use strict';var multer=require(_0x080b('0x0'));var util=require(_0x080b('0x1'));var path=require(_0x080b('0x2'));var express=require(_0x080b('0x3'));var router=express[_0x080b('0x4')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x080b('0x5')]('/voice/channels',auth[_0x080b('0x6')](),controller[_0x080b('0x7')]);router[_0x080b('0x5')](_0x080b('0x8'),auth[_0x080b('0x6')](),controller['voiceChannelMixMonitor']);router[_0x080b('0x5')](_0x080b('0x9'),auth[_0x080b('0x6')](),controller['voiceChannelStopMixMonitor']);router['get'](_0x080b('0xa'),auth[_0x080b('0x6')](),controller[_0x080b('0xb')]);router['get']('/chat/queues',auth[_0x080b('0x6')](),controller['chatQueues']);router[_0x080b('0x5')](_0x080b('0xc'),auth[_0x080b('0x6')](),controller[_0x080b('0xd')]);router[_0x080b('0x5')](_0x080b('0xe'),auth['isAuthenticated'](),controller['mailAccounts']);router['get'](_0x080b('0xf'),auth[_0x080b('0x6')](),controller[_0x080b('0x10')]);router[_0x080b('0x5')](_0x080b('0x11'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x080b('0x5')](_0x080b('0x12'),auth[_0x080b('0x6')](),controller[_0x080b('0x13')]);router[_0x080b('0x5')](_0x080b('0x14'),auth[_0x080b('0x6')](),controller[_0x080b('0x15')]);router['get'](_0x080b('0x16'),auth[_0x080b('0x6')](),controller[_0x080b('0x17')]);router[_0x080b('0x5')](_0x080b('0x18'),auth[_0x080b('0x6')](),controller[_0x080b('0x19')]);router[_0x080b('0x5')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x080b('0x1a')]);router[_0x080b('0x5')](_0x080b('0x1b'),auth[_0x080b('0x6')](),controller[_0x080b('0x1c')]);router[_0x080b('0x5')](_0x080b('0x1d'),auth[_0x080b('0x6')](),controller[_0x080b('0x1e')]);router[_0x080b('0x5')]('/voice/queues/:id',auth[_0x080b('0x6')](),controller['showVoiceQueues']);router[_0x080b('0x5')](_0x080b('0x1f'),auth[_0x080b('0x6')](),controller[_0x080b('0x20')]);router['get']('/outbound/channels',auth[_0x080b('0x6')](),controller[_0x080b('0x21')]);router[_0x080b('0x5')](_0x080b('0x22'),auth[_0x080b('0x6')](),controller[_0x080b('0x23')]);router[_0x080b('0x24')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x080b('0x25')]);router['get'](_0x080b('0x26'),auth[_0x080b('0x6')](),controller[_0x080b('0x27')]);router['get'](_0x080b('0x28'),auth[_0x080b('0x6')](),controller[_0x080b('0x29')]);router[_0x080b('0x5')](_0x080b('0x2a'),auth[_0x080b('0x6')](),controller[_0x080b('0x2b')]);router[_0x080b('0x5')](_0x080b('0x2c'),auth[_0x080b('0x6')](),controller[_0x080b('0x2d')]);router[_0x080b('0x5')]('/chat/queues/waitinginteractions',auth[_0x080b('0x6')](),controller[_0x080b('0x2e')]);router[_0x080b('0x5')](_0x080b('0x2f'),auth[_0x080b('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x080b('0x5')](_0x080b('0x30'),auth['isAuthenticated'](),controller[_0x080b('0x31')]);router[_0x080b('0x5')](_0x080b('0x32'),auth[_0x080b('0x6')](),controller[_0x080b('0x33')]);router['get']('/sms/queues/waitinginteractions',auth[_0x080b('0x6')](),controller[_0x080b('0x34')]);router[_0x080b('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x080b('0x6')](),controller[_0x080b('0x35')]);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x080b('0x36')]);router[_0x080b('0x37')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x080b('0x38')));router[_0x080b('0x5')]('/mail/queues/:id',auth[_0x080b('0x6')](),controller[_0x080b('0x39')]);router['post']('/chat/queues/:id/notify',auth[_0x080b('0x6')](),controller[_0x080b('0x3a')]('chat'));router['get']('/chat/queues/:id',auth[_0x080b('0x6')](),controller[_0x080b('0x3b')]);router[_0x080b('0x37')](_0x080b('0x3c'),auth['isAuthenticated'](),controller[_0x080b('0x3a')]('fax'));router[_0x080b('0x5')]('/fax/queues/:id',auth[_0x080b('0x6')](),controller[_0x080b('0x3d')]);router[_0x080b('0x37')](_0x080b('0x3e'),auth[_0x080b('0x6')](),controller[_0x080b('0x3a')](_0x080b('0x3f')));router['get'](_0x080b('0x40'),auth[_0x080b('0x6')](),controller['showOpenchannelQueues']);router[_0x080b('0x37')](_0x080b('0x41'),auth[_0x080b('0x6')](),controller[_0x080b('0x3a')](_0x080b('0x42')));router[_0x080b('0x37')]('/whatsapp/queues/:id/notify',auth[_0x080b('0x6')](),controller[_0x080b('0x3a')]('whatsapp'));router[_0x080b('0x5')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x080b('0x43')]);router['get'](_0x080b('0x44'),auth[_0x080b('0x6')](),controller[_0x080b('0x45')]);router[_0x080b('0x37')](_0x080b('0x46'),auth[_0x080b('0x6')](),controller[_0x080b('0x47')]);module[_0x080b('0x48')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index ee1f75a..06eb516 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb6e=['name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','params','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','Telephones','trunks','Trunks','Campaigns','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','value','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','From','QueueId','TransferReport','create','Start','queue','*,*,*,*','channel','User','Agent\x20not\x20found','update','InteractionId','agentTransferTimeout','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack'];(function(_0x355511,_0x101f96){var _0x2f84b4=function(_0x4d62da){while(--_0x4d62da){_0x355511['push'](_0x355511['shift']());}};_0x2f84b4(++_0x101f96);}(_0xeb6e,0x6a));var _0xeeb6=function(_0x278b98,_0x44accd){_0x278b98=_0x278b98-0x0;var _0x3690e1=_0xeb6e[_0x278b98];return _0x3690e1;};'use strict';var BPromise=require('bluebird');var moment=require(_0xeeb6('0x0'));var _=require(_0xeeb6('0x1'));var util=require('util');var db=require(_0xeeb6('0x2'))['db'];var logger=require(_0xeeb6('0x3'))(_0xeeb6('0x4'));var jayson=require(_0xeeb6('0x5'));var amiClient=jayson[_0xeeb6('0x6')][_0xeeb6('0x7')]({'port':0x232a});var mailClient=jayson[_0xeeb6('0x6')][_0xeeb6('0x7')]({'port':0x232b});var routingClient=jayson[_0xeeb6('0x6')][_0xeeb6('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x10a843,_0x55f846,_0xbcd578){return new BPromise(function(_0x576b69,_0x381ec2){var _0xf62d93=_0xbcd578?_0xbcd578:amiClient;return _0xf62d93[_0xeeb6('0x8')](_0x10a843,_0x55f846)[_0xeeb6('0x9')](function(_0x9f09b3){if(_0x9f09b3['error']){if(_0x9f09b3[_0xeeb6('0xa')][_0xeeb6('0xb')]===0x1f4){return _0x381ec2(_0x9f09b3[_0xeeb6('0xa')][_0xeeb6('0xc')]);}return _0x576b69(_0x9f09b3[_0xeeb6('0xa')][_0xeeb6('0xc')]);}else{_0x576b69(_0x9f09b3[_0xeeb6('0xd')]);}})[_0xeeb6('0xe')](function(_0x26c150){_0x381ec2(_0x26c150);});});}function respondWithResult(_0xe689d9,_0x178ea2){_0x178ea2=_0x178ea2||0xc8;return function(_0x296efc){if(_0x296efc){return _0xe689d9[_0xeeb6('0xf')](_0x178ea2)[_0xeeb6('0x10')](_0x296efc);}return _0xe689d9[_0xeeb6('0x11')](0x194);};}function handleError(_0x2e868d,_0x1b3969){_0x1b3969=_0x1b3969||0x1f4;return function(_0x300134){logger[_0xeeb6('0xa')](_0x300134[_0xeeb6('0x12')]);if(_0x300134[_0xeeb6('0x13')]){delete _0x300134[_0xeeb6('0x13')];}_0x2e868d['status'](_0x1b3969)[_0xeeb6('0x14')](_0x300134);};}function findById(_0x47a041){return function(_0xceed8d){if(!_[_0xeeb6('0x15')](_0x47a041)&&!_['isNil'](_0xceed8d)&&!_[_0xeeb6('0x15')](_0xceed8d[_0xeeb6('0x16')])){return _[_0xeeb6('0x17')](_0xceed8d[_0xeeb6('0x16')],function(_0x5bb9f5){return _0x5bb9f5['id']==_0x47a041;});}return null;};}exports[_0xeeb6('0x18')]=function(_0x5bea4c,_0x202994){return respondWithRpcPromise(_0xeeb6('0x19'),_0x5bea4c[_0xeeb6('0x1a')])[_0xeeb6('0x9')](respondWithResult(_0x202994,null))[_0xeeb6('0xe')](handleError(_0x202994,null));};exports[_0xeeb6('0x1b')]=function(_0x46a020,_0x2db711){return respondWithRpcPromise(_0xeeb6('0x1c'),_[_0xeeb6('0x1d')](_0x46a020[_0xeeb6('0x1a')],_0x46a020['params']))[_0xeeb6('0x9')](respondWithResult(_0x2db711,null))[_0xeeb6('0xe')](handleError(_0x2db711,null));};exports[_0xeeb6('0x1e')]=function(_0x44ea9b,_0x220c6d){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x44ea9b['query'],_0x44ea9b['params']))['then'](respondWithResult(_0x220c6d,null))[_0xeeb6('0xe')](handleError(_0x220c6d,null));};exports[_0xeeb6('0x1f')]=function(_0x1f48e4,_0xf42de9){return respondWithRpcPromise(_0xeeb6('0x20'),_0x1f48e4['query'])['then'](respondWithResult(_0xf42de9,null))[_0xeeb6('0xe')](handleError(_0xf42de9,null));};exports[_0xeeb6('0x21')]=function(_0x1147d7,_0x1b55ab){return respondWithRpcPromise('VoiceQueues',_0x1147d7[_0xeeb6('0x1a')])[_0xeeb6('0x9')](findById(_0x1147d7[_0xeeb6('0x22')]['id']))[_0xeeb6('0x9')](respondWithResult(_0x1b55ab,null))[_0xeeb6('0xe')](handleError(_0x1b55ab,null));};exports['voiceQueuesPreview']=function(_0x2cd0cc,_0x5b1aeb){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x2cd0cc[_0xeeb6('0x1a')],_0x2cd0cc['params']))[_0xeeb6('0x9')](respondWithResult(_0x5b1aeb,null))[_0xeeb6('0xe')](handleError(_0x5b1aeb,null));};exports[_0xeeb6('0x23')]=function(_0x466839,_0x5bf705){return respondWithRpcPromise(_0xeeb6('0x24'),_0x466839[_0xeeb6('0x1a')])[_0xeeb6('0x9')](respondWithResult(_0x5bf705,null))[_0xeeb6('0xe')](handleError(_0x5bf705,null));};exports['voiceQueuesChannel']=function(_0x676ecd,_0x3bbe01){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xeeb6('0x1d')](_0x676ecd[_0xeeb6('0x1a')],_0x676ecd[_0xeeb6('0x22')]))[_0xeeb6('0x9')](respondWithResult(_0x3bbe01,null))[_0xeeb6('0xe')](handleError(_0x3bbe01,null));};exports[_0xeeb6('0x25')]=function(_0x57926f,_0x1a41d8){return respondWithRpcPromise(_0xeeb6('0x26'),_[_0xeeb6('0x1d')](_0x57926f[_0xeeb6('0x1a')],_0x57926f[_0xeeb6('0x22')]))[_0xeeb6('0x9')](respondWithResult(_0x1a41d8,null))['catch'](handleError(_0x1a41d8,null));};exports['voiceQueuesChannelRedirect']=function(_0x4b3b92,_0x195546){return respondWithRpcPromise(_0xeeb6('0x27'),_[_0xeeb6('0x1d')](_0x4b3b92[_0xeeb6('0x1a')],_0x4b3b92[_0xeeb6('0x22')]))[_0xeeb6('0x9')](respondWithResult(_0x195546,null))['catch'](handleError(_0x195546,null));};exports[_0xeeb6('0x28')]=function(_0x5db835,_0x423cf2){return respondWithRpcPromise('Outbound',_0x5db835[_0xeeb6('0x1a')])['then'](respondWithResult(_0x423cf2,null))[_0xeeb6('0xe')](handleError(_0x423cf2,null));};exports[_0xeeb6('0x29')]=function(_0x3794fc,_0x34defa){return respondWithRpcPromise(_0xeeb6('0x2a'),_0x3794fc[_0xeeb6('0x1a')])[_0xeeb6('0x9')](respondWithResult(_0x34defa,null))[_0xeeb6('0xe')](handleError(_0x34defa,null));};exports[_0xeeb6('0x2b')]=function(_0x44a930,_0x4cc971){var _0x961c4c;return respondWithRpcPromise(_0xeeb6('0x2c'),_0x44a930[_0xeeb6('0x1a')])[_0xeeb6('0x9')](function(_0x38e195){_0x961c4c=_0x38e195;return respondWithRpcPromise(_0xeeb6('0x2c'),_0x44a930[_0xeeb6('0x1a')],routingClient);})[_0xeeb6('0x9')](function(_0x1b3e38){return _[_0xeeb6('0x1d')]({},_0x1b3e38,_0x961c4c);})['then'](respondWithResult(_0x4cc971,null))[_0xeeb6('0xe')](handleError(_0x4cc971,null));};exports[_0xeeb6('0x2d')]=function(_0x5f5499,_0x1c67b4){if(_0x5f5499[_0xeeb6('0x2e')]&&_0x5f5499[_0xeeb6('0x2e')][_0xeeb6('0x2f')]&&_0x5f5499['user']&&_0x5f5499[_0xeeb6('0x30')]['name']){for(var _0x3a6a90 in _0x5f5499['body']['interaction']){if(_0x5f5499[_0xeeb6('0x2e')][_0xeeb6('0x2f')][_0xeeb6('0x31')](_0x3a6a90)){db[_0xeeb6('0x32')][_0xeeb6('0x33')]({'where':{'channel':_0x3a6a90,'membername':_0x5f5499[_0xeeb6('0x30')][_0xeeb6('0x13')],'type':_0xeeb6('0x34'),'exitAt':null,'uniqueid':_0x5f5499[_0xeeb6('0x2e')]['interaction'][_0x3a6a90]&&_0x5f5499[_0xeeb6('0x2e')]['interaction'][_0x3a6a90][_0xeeb6('0x35')]?{'$notIn':_0x5f5499[_0xeeb6('0x2e')][_0xeeb6('0x2f')][_0x3a6a90]}:{'$ne':null}}})['then'](function(_0xeb0dc8){var _0x11d371=moment()[_0xeeb6('0x36')](_0xeeb6('0x37'));for(var _0x498f28=0x0,_0x2f8434=_0xeb0dc8[_0xeeb6('0x35')];_0x498f28<_0x2f8434;_0x498f28+=0x1){_0xeb0dc8[_0x498f28]['updateAttributes']({'exitAt':_0x11d371});}});for(var _0x31315a=0x0;_0x31315a<_0x5f5499['body'][_0xeeb6('0x2f')][_0x3a6a90]['length'];_0x31315a+=0x1){db[_0xeeb6('0x32')][_0xeeb6('0x38')]({'where':{'channel':_0x3a6a90,'membername':_0x5f5499[_0xeeb6('0x30')][_0xeeb6('0x13')],'type':_0xeeb6('0x34'),'uniqueid':_0x5f5499[_0xeeb6('0x2e')][_0xeeb6('0x2f')][_0x3a6a90][_0x31315a],'exitAt':null},'defaults':{'channel':_0x3a6a90,'membername':_0x5f5499[_0xeeb6('0x30')][_0xeeb6('0x13')],'interface':_[_0xeeb6('0x15')](_0x5f5499[_0xeeb6('0x30')][_0xeeb6('0x39')])?util[_0xeeb6('0x36')](_0xeeb6('0x3a'),_0x5f5499[_0xeeb6('0x30')][_0xeeb6('0x13')]):_0x5f5499[_0xeeb6('0x30')][_0xeeb6('0x39')],'type':'INTERACTION','enterAt':moment()[_0xeeb6('0x36')](_0xeeb6('0x37')),'role':_0xeeb6('0x3b'),'internal':_0x5f5499[_0xeeb6('0x30')][_0xeeb6('0x3c')],'uniqueid':_0x5f5499[_0xeeb6('0x2e')][_0xeeb6('0x2f')][_0x3a6a90][_0x31315a]}});}}}}return respondWithRpcPromise(_0xeeb6('0x3d'),{'id':_0x5f5499[_0xeeb6('0x22')]['id'],'capacity':_0x5f5499[_0xeeb6('0x2e')]['capacity']},routingClient)[_0xeeb6('0x9')](respondWithResult(_0x1c67b4,null))[_0xeeb6('0xe')](handleError(_0x1c67b4,null));};exports['telephones']=function(_0x52618e,_0x409136){return respondWithRpcPromise(_0xeeb6('0x3e'),_0x52618e[_0xeeb6('0x1a')])['then'](respondWithResult(_0x409136,null))[_0xeeb6('0xe')](handleError(_0x409136,null));};exports[_0xeeb6('0x3f')]=function(_0x4c7c3d,_0x474b62){return respondWithRpcPromise(_0xeeb6('0x40'),_0x4c7c3d['query'])[_0xeeb6('0x9')](respondWithResult(_0x474b62,null))['catch'](handleError(_0x474b62,null));};exports['campaigns']=function(_0x4bed9f,_0x5277b1){return respondWithRpcPromise(_0xeeb6('0x41'),_0x4bed9f[_0xeeb6('0x1a')])[_0xeeb6('0x9')](respondWithResult(_0x5277b1,null))[_0xeeb6('0xe')](handleError(_0x5277b1,null));};exports['chatQueues']=function(_0x390a5f,_0x38d961){return respondWithRpcPromise(_0xeeb6('0x42'),_0x390a5f[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x38d961,null))[_0xeeb6('0xe')](handleError(_0x38d961,null));};exports[_0xeeb6('0x43')]=function(_0xc6d5a8,_0x46be7f){return respondWithRpcPromise(_0xeeb6('0x42'),_0xc6d5a8[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](findById(_0xc6d5a8[_0xeeb6('0x22')]['id']))[_0xeeb6('0x9')](respondWithResult(_0x46be7f,null))[_0xeeb6('0xe')](handleError(_0x46be7f,null));};exports['mailQueues']=function(_0x1ceb12,_0x58e05d){return respondWithRpcPromise('MailQueues',_0x1ceb12[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x58e05d,null))['catch'](handleError(_0x58e05d,null));};exports[_0xeeb6('0x44')]=function(_0x525495,_0xbe4f86){return respondWithRpcPromise(_0xeeb6('0x45'),_0x525495[_0xeeb6('0x1a')],routingClient)['then'](findById(_0x525495[_0xeeb6('0x22')]['id']))[_0xeeb6('0x9')](respondWithResult(_0xbe4f86,null))[_0xeeb6('0xe')](handleError(_0xbe4f86,null));};exports[_0xeeb6('0x46')]=function(_0x33a696,_0x3184ca){return respondWithRpcPromise('MailAccounts',_0x33a696[_0xeeb6('0x1a')],mailClient)[_0xeeb6('0x9')](respondWithResult(_0x3184ca,null))['catch'](handleError(_0x3184ca,null));};exports[_0xeeb6('0x47')]=function(_0x2bf930,_0x2d4c8f){return respondWithRpcPromise(_0xeeb6('0x48'),_0x2bf930['query'],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x2d4c8f,null))[_0xeeb6('0xe')](handleError(_0x2d4c8f,null));};exports[_0xeeb6('0x49')]=function(_0x47765f,_0x21f973){return respondWithRpcPromise(_0xeeb6('0x48'),_0x47765f[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](findById(_0x47765f[_0xeeb6('0x22')]['id']))[_0xeeb6('0x9')](respondWithResult(_0x21f973,null))[_0xeeb6('0xe')](handleError(_0x21f973,null));};exports[_0xeeb6('0x4a')]=function(_0x1acd4c,_0x5afe59){return respondWithRpcPromise('SmsQueues',_0x1acd4c[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x5afe59,null))['catch'](handleError(_0x5afe59,null));};exports[_0xeeb6('0x4b')]=function(_0x9a60b9,_0x1b347d){return respondWithRpcPromise(_0xeeb6('0x4c'),_0x9a60b9['query'],routingClient)[_0xeeb6('0x9')](findById(_0x9a60b9[_0xeeb6('0x22')]['id']))[_0xeeb6('0x9')](respondWithResult(_0x1b347d,null))['catch'](handleError(_0x1b347d,null));};exports[_0xeeb6('0x4d')]=function(_0x4f8448,_0x2c39ed){return respondWithRpcPromise('WhatsappQueues',_0x4f8448[_0xeeb6('0x1a')],routingClient)['then'](respondWithResult(_0x2c39ed,null))[_0xeeb6('0xe')](handleError(_0x2c39ed,null));};exports[_0xeeb6('0x4e')]=function(_0x44a3ff,_0xb81a30){return respondWithRpcPromise(_0xeeb6('0x4f'),_0x44a3ff[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](findById(_0x44a3ff['params']['id']))[_0xeeb6('0x9')](respondWithResult(_0xb81a30,null))[_0xeeb6('0xe')](handleError(_0xb81a30,null));};exports[_0xeeb6('0x50')]=function(_0x6f9611,_0x212ecf){return respondWithRpcPromise('FaxQueues',_0x6f9611[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x212ecf,null))['catch'](handleError(_0x212ecf,null));};exports[_0xeeb6('0x51')]=function(_0x5c2122,_0x2c69ad){return respondWithRpcPromise('FaxQueues',_0x5c2122[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](findById(_0x5c2122[_0xeeb6('0x22')]['id']))[_0xeeb6('0x9')](respondWithResult(_0x2c69ad,null))[_0xeeb6('0xe')](handleError(_0x2c69ad,null));};exports[_0xeeb6('0x52')]=function(_0xb4c441,_0x2d8ac7){return respondWithRpcPromise(_0xeeb6('0x53'),_0xb4c441['query'])[_0xeeb6('0x9')](respondWithResult(_0x2d8ac7,null))[_0xeeb6('0xe')](handleError(_0x2d8ac7,null));};exports[_0xeeb6('0x54')]=function(_0x46e7de,_0x214f92){return respondWithRpcPromise(_0xeeb6('0x55'),_0x46e7de['query'],routingClient)['then'](respondWithResult(_0x214f92,null))['catch'](handleError(_0x214f92,null));};exports[_0xeeb6('0x56')]=function(_0x9ea387,_0x44edf8){return respondWithRpcPromise(_0xeeb6('0x57'),_0x9ea387['query'],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x44edf8,null))['catch'](handleError(_0x44edf8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x3ca62f,_0x3a6f42){return respondWithRpcPromise(_0xeeb6('0x58'),_0x3ca62f['query'],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x3a6f42,null))[_0xeeb6('0xe')](handleError(_0x3a6f42,null));};exports[_0xeeb6('0x59')]=function(_0x22d4ce,_0x2abdd6){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x22d4ce[_0xeeb6('0x1a')],routingClient)['then'](function(_0x17475c){if(_0x22d4ce[_0xeeb6('0x1a')][_0xeeb6('0x5a')]!==undefined){var _0x15ceea=_(_0x17475c['rows'])[_0xeeb6('0x5b')]([_0x22d4ce[_0xeeb6('0x1a')]['type'],_0x22d4ce['params']['id']])[_0xeeb6('0x5c')](_0xeeb6('0x5d'))['uniq']()[_0xeeb6('0x5e')]();return _0x17475c[_0xeeb6('0x16')]['filter'](function(_0x4ac966){return _0x15ceea['indexOf'](_0x4ac966[_0xeeb6('0x5d')])>-0x1;});}else{return _0x17475c['rows']['filter'](function(_0x34021b){return _0x34021b[_0xeeb6('0x5d')]===parseInt(_0x22d4ce['params']['id']);});}})[_0xeeb6('0x9')](respondWithResult(_0x2abdd6,null))[_0xeeb6('0xe')](handleError(_0x2abdd6,null));};exports['smsQueuesWaitingInteractions']=function(_0x49f442,_0x5e471b){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x49f442[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x5e471b,null))[_0xeeb6('0xe')](handleError(_0x5e471b,null));};exports[_0xeeb6('0x5f')]=function(_0x3d1f8f,_0x582464){return respondWithRpcPromise(_0xeeb6('0x60'),_0x3d1f8f[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x582464,null))[_0xeeb6('0xe')](handleError(_0x582464,null));};exports[_0xeeb6('0x61')]=function(_0x398d7e,_0x1444e8){return respondWithRpcPromise(_0xeeb6('0x62'),_0x398d7e[_0xeeb6('0x1a')],routingClient)[_0xeeb6('0x9')](respondWithResult(_0x1444e8,null))[_0xeeb6('0xe')](handleError(_0x1444e8,null));};exports[_0xeeb6('0x63')]=function(_0x111566){return function(_0x5ef935,_0x5d63b4){var _0x1b587e,_0xc93d54;var _0x57ab4a=_[_0xeeb6('0x64')](_0x111566);var _0x379474=_0x111566===_0xeeb6('0x65')?_0xeeb6('0x66'):_0xeeb6('0x67');return db[_0x57ab4a+_0xeeb6('0x68')][_0xeeb6('0x69')]({'raw':!![],'where':{'id':_0x5ef935[_0xeeb6('0x22')]['id']}})[_0xeeb6('0x9')](function(_0x44bc9e){if(_[_0xeeb6('0x15')](_0x44bc9e)){throw new Error(_0x57ab4a+_0xeeb6('0x6a'));}_0x1b587e=_0x44bc9e;return db[_0x57ab4a+_0xeeb6('0x6b')][_0xeeb6('0x69')]({'where':{'id':_0x5ef935[_0xeeb6('0x2e')][_0xeeb6('0x6c')]},'include':[{'model':db[_0x57ab4a+_0xeeb6('0x6d')],'as':_0xeeb6('0x6d')},{'model':db[_0x57ab4a+_0x379474],'as':_0xeeb6('0x67')}]});})['then'](function(_0x55278e){if(_[_0xeeb6('0x15')](_0x55278e)){throw new Error(_0x57ab4a+_0xeeb6('0x6e'));}_0xc93d54=_0x55278e;return _0x55278e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xeeb6('0x9')](function(){var _0x304d7a={'uniqueid':_0x111566+'.'+_0xc93d54['id']+'.'+_0xc93d54[_0xeeb6('0x6d')]['id'],'FromUserId':_0x5ef935[_0xeeb6('0x30')]['id'],'type':'queue'};_0x304d7a[_0x57ab4a+_0xeeb6('0x6f')]=_0xc93d54['id'];_0x304d7a[_0x57ab4a+'InteractionId']=_0xc93d54['Interaction']['id'];_0x304d7a[_0xeeb6('0x70')+_0x57ab4a+_0x379474+'Id']=_0xc93d54[_0xeeb6('0x67')]['id'];_0x304d7a['To'+_0x57ab4a+_0xeeb6('0x71')]=_0x1b587e['id'];return db[_0x57ab4a+_0xeeb6('0x72')][_0xeeb6('0x73')](_0x304d7a);})[_0xeeb6('0x9')](function(){return respondWithRpcPromise(_0xeeb6('0x74'),{'channel':_0x111566,'interaction':_0xc93d54['Interaction'],'message':_0xc93d54,'account':_0xc93d54[_0xeeb6('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xeeb6('0x75'),'appdata':_0x1b587e[_0xeeb6('0x13')]+','+(_0xc93d54[_0xeeb6('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xeeb6('0x76')}]},routingClient);})[_0xeeb6('0x9')](respondWithResult(_0x5d63b4,null))['catch'](handleError(_0x5d63b4,null));};};exports['agentNotify']=function(_0x34dcb0,_0x417357){var _0x29f0a8,_0x4b65ec;if(_['isNil'](_0x34dcb0[_0xeeb6('0x2e')][_0xeeb6('0x77')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4bf0cc=_0x34dcb0[_0xeeb6('0x2e')][_0xeeb6('0x77')];var _0x1748af=_['capitalize'](_0x4bf0cc);var _0x54d0a2=_0x4bf0cc===_0xeeb6('0x65')?_0xeeb6('0x66'):_0xeeb6('0x67');return db[_0xeeb6('0x78')]['findOne']({'raw':!![],'where':{'id':_0x34dcb0[_0xeeb6('0x22')]['id'],'role':'agent'}})[_0xeeb6('0x9')](function(_0x172220){if(_['isNil'](_0x172220)){throw new Error(_0xeeb6('0x79'));}_0x29f0a8=_0x172220;return db[_0x1748af+'Message']['findOne']({'where':{'id':_0x34dcb0[_0xeeb6('0x2e')][_0xeeb6('0x6c')]},'include':[{'model':db[_0x1748af+_0xeeb6('0x6d')],'as':_0xeeb6('0x6d')},{'model':db[_0x1748af+_0x54d0a2],'as':_0xeeb6('0x67')}]});})[_0xeeb6('0x9')](function(_0x190a85){if(_['isNil'](_0x190a85)){throw new Error(_0x1748af+'\x20Message\x20not\x20found');}_0x4b65ec=_0x190a85;return _0x190a85[_0xeeb6('0x7a')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xaed602={'uniqueid':_0x4bf0cc+'.'+_0x4b65ec['id']+'.'+_0x4b65ec[_0xeeb6('0x6d')]['id'],'FromUserId':_0x34dcb0[_0xeeb6('0x30')]['id'],'type':_0xeeb6('0x75'),'ToUserId':_0x29f0a8['id']};_0xaed602[_0x1748af+'MessageId']=_0x4b65ec['id'];_0xaed602[_0x1748af+_0xeeb6('0x7b')]=_0x4b65ec[_0xeeb6('0x6d')]['id'];_0xaed602[_0xeeb6('0x70')+_0x1748af+_0x54d0a2+'Id']=_0x4b65ec[_0xeeb6('0x67')]['id'];return db[_0x1748af+'TransferReport'][_0xeeb6('0x73')](_0xaed602);})[_0xeeb6('0x9')](function(){return respondWithRpcPromise(_0xeeb6('0x74'),{'channel':_0x4bf0cc,'interaction':_0x4b65ec[_0xeeb6('0x6d')],'message':_0x4b65ec,'account':_0x4b65ec['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x29f0a8[_0xeeb6('0x13')]+','+(_0x4b65ec[_0xeeb6('0x67')][_0xeeb6('0x7c')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xeeb6('0x9')](respondWithResult(_0x417357,null))[_0xeeb6('0xe')](handleError(_0x417357,null));}; \ No newline at end of file +var _0x68be=['../../config/logger','api','http','client','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','user','interface','SIP/%s','agent','internal','capacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','InteractionId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','From','agentTransferTimeout','moment','lodash','util','../../mysqldb'];(function(_0x6884ee,_0x520f13){var _0x1f4b04=function(_0x5434b3){while(--_0x5434b3){_0x6884ee['push'](_0x6884ee['shift']());}};_0x1f4b04(++_0x520f13);}(_0x68be,0xf6));var _0xe68b=function(_0x3513a0,_0x3bdc88){_0x3513a0=_0x3513a0-0x0;var _0x2bdeb9=_0x68be[_0x3513a0];return _0x2bdeb9;};'use strict';var BPromise=require('bluebird');var moment=require(_0xe68b('0x0'));var _=require(_0xe68b('0x1'));var util=require(_0xe68b('0x2'));var db=require(_0xe68b('0x3'))['db'];var logger=require(_0xe68b('0x4'))(_0xe68b('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xe68b('0x6')]({'port':0x232a});var mailClient=jayson[_0xe68b('0x7')][_0xe68b('0x6')]({'port':0x232b});var routingClient=jayson[_0xe68b('0x7')][_0xe68b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x569558,_0x3b0cdc,_0x110de4){return new BPromise(function(_0x345e18,_0x200715){var _0x390127=_0x110de4?_0x110de4:amiClient;return _0x390127[_0xe68b('0x8')](_0x569558,_0x3b0cdc)[_0xe68b('0x9')](function(_0x57a1b0){if(_0x57a1b0[_0xe68b('0xa')]){if(_0x57a1b0['error'][_0xe68b('0xb')]===0x1f4){return _0x200715(_0x57a1b0[_0xe68b('0xa')][_0xe68b('0xc')]);}return _0x345e18(_0x57a1b0[_0xe68b('0xa')][_0xe68b('0xc')]);}else{_0x345e18(_0x57a1b0['result']);}})[_0xe68b('0xd')](function(_0xd64f94){_0x200715(_0xd64f94);});});}function respondWithResult(_0x1c2e03,_0x294969){_0x294969=_0x294969||0xc8;return function(_0x393109){if(_0x393109){return _0x1c2e03[_0xe68b('0xe')](_0x294969)[_0xe68b('0xf')](_0x393109);}return _0x1c2e03[_0xe68b('0x10')](0x194);};}function handleError(_0x1f6de8,_0x53c5ea){_0x53c5ea=_0x53c5ea||0x1f4;return function(_0x188a93){logger['error'](_0x188a93[_0xe68b('0x11')]);if(_0x188a93[_0xe68b('0x12')]){delete _0x188a93['name'];}_0x1f6de8[_0xe68b('0xe')](_0x53c5ea)[_0xe68b('0x13')](_0x188a93);};}function findById(_0x173e48){return function(_0x1f62dc){if(!_['isNil'](_0x173e48)&&!_[_0xe68b('0x14')](_0x1f62dc)&&!_[_0xe68b('0x14')](_0x1f62dc[_0xe68b('0x15')])){return _['find'](_0x1f62dc['rows'],function(_0x262e89){return _0x262e89['id']==_0x173e48;});}return null;};}exports[_0xe68b('0x16')]=function(_0x2461be,_0x3fe0b9){return respondWithRpcPromise(_0xe68b('0x17'),_0x2461be[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0x3fe0b9,null))['catch'](handleError(_0x3fe0b9,null));};exports['voiceChannelMixMonitor']=function(_0x53b082,_0x46509c){return respondWithRpcPromise(_0xe68b('0x19'),_[_0xe68b('0x1a')](_0x53b082['query'],_0x53b082[_0xe68b('0x1b')]))['then'](respondWithResult(_0x46509c,null))[_0xe68b('0xd')](handleError(_0x46509c,null));};exports[_0xe68b('0x1c')]=function(_0xe76478,_0x3adf2a){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xe68b('0x1a')](_0xe76478[_0xe68b('0x18')],_0xe76478[_0xe68b('0x1b')]))[_0xe68b('0x9')](respondWithResult(_0x3adf2a,null))[_0xe68b('0xd')](handleError(_0x3adf2a,null));};exports[_0xe68b('0x1d')]=function(_0x2d7ce8,_0x1af349){return respondWithRpcPromise('VoiceQueues',_0x2d7ce8[_0xe68b('0x18')])['then'](respondWithResult(_0x1af349,null))['catch'](handleError(_0x1af349,null));};exports[_0xe68b('0x1e')]=function(_0xcc85f0,_0x3c6b50){return respondWithRpcPromise('VoiceQueues',_0xcc85f0[_0xe68b('0x18')])[_0xe68b('0x9')](findById(_0xcc85f0[_0xe68b('0x1b')]['id']))[_0xe68b('0x9')](respondWithResult(_0x3c6b50,null))[_0xe68b('0xd')](handleError(_0x3c6b50,null));};exports[_0xe68b('0x1f')]=function(_0x10daa7,_0x14e4c9){return respondWithRpcPromise(_0xe68b('0x20'),_['merge'](_0x10daa7['query'],_0x10daa7[_0xe68b('0x1b')]))[_0xe68b('0x9')](respondWithResult(_0x14e4c9,null))[_0xe68b('0xd')](handleError(_0x14e4c9,null));};exports[_0xe68b('0x21')]=function(_0xb1df00,_0x2ed1af){return respondWithRpcPromise(_0xe68b('0x22'),_0xb1df00[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0x2ed1af,null))['catch'](handleError(_0x2ed1af,null));};exports['voiceQueuesChannel']=function(_0x2e835b,_0x4855f2){return respondWithRpcPromise(_0xe68b('0x23'),_['merge'](_0x2e835b[_0xe68b('0x18')],_0x2e835b['params']))[_0xe68b('0x9')](respondWithResult(_0x4855f2,null))[_0xe68b('0xd')](handleError(_0x4855f2,null));};exports['voiceQueuesChannelHangup']=function(_0x139f60,_0x112210){return respondWithRpcPromise(_0xe68b('0x24'),_[_0xe68b('0x1a')](_0x139f60[_0xe68b('0x18')],_0x139f60[_0xe68b('0x1b')]))['then'](respondWithResult(_0x112210,null))[_0xe68b('0xd')](handleError(_0x112210,null));};exports['voiceQueuesChannelRedirect']=function(_0x24f038,_0x2ba5e4){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xe68b('0x1a')](_0x24f038[_0xe68b('0x18')],_0x24f038['params']))[_0xe68b('0x9')](respondWithResult(_0x2ba5e4,null))['catch'](handleError(_0x2ba5e4,null));};exports[_0xe68b('0x25')]=function(_0x45d73a,_0x3e2c40){return respondWithRpcPromise('Outbound',_0x45d73a[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0x3e2c40,null))[_0xe68b('0xd')](handleError(_0x3e2c40,null));};exports[_0xe68b('0x26')]=function(_0xf4838b,_0xfbd9f){return respondWithRpcPromise(_0xe68b('0x27'),_0xf4838b[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0xfbd9f,null))[_0xe68b('0xd')](handleError(_0xfbd9f,null));};exports['agents']=function(_0x17ca39,_0xe1b2c1){var _0x236e73;return respondWithRpcPromise(_0xe68b('0x28'),_0x17ca39[_0xe68b('0x18')])[_0xe68b('0x9')](function(_0x2221e4){_0x236e73=_0x2221e4;return respondWithRpcPromise(_0xe68b('0x28'),_0x17ca39[_0xe68b('0x18')],routingClient);})['then'](function(_0x2bdb86){return _[_0xe68b('0x1a')]({},_0x2bdb86,_0x236e73);})[_0xe68b('0x9')](respondWithResult(_0xe1b2c1,null))[_0xe68b('0xd')](handleError(_0xe1b2c1,null));};exports[_0xe68b('0x29')]=function(_0x46b7ee,_0x36f97c){if(_0x46b7ee['body']&&_0x46b7ee[_0xe68b('0x2a')]['interaction']&&_0x46b7ee['user']&&_0x46b7ee['user'][_0xe68b('0x12')]){for(var _0x58b8ca in _0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x2b')]){if(_0x46b7ee[_0xe68b('0x2a')]['interaction'][_0xe68b('0x2c')](_0x58b8ca)){db[_0xe68b('0x2d')][_0xe68b('0x2e')]({'where':{'channel':_0x58b8ca,'membername':_0x46b7ee['user'][_0xe68b('0x12')],'type':_0xe68b('0x2f'),'exitAt':null,'uniqueid':_0x46b7ee[_0xe68b('0x2a')]['interaction'][_0x58b8ca]&&_0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x2b')][_0x58b8ca][_0xe68b('0x30')]?{'$notIn':_0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x2b')][_0x58b8ca]}:{'$ne':null}}})['then'](function(_0x647b03){var _0x2ace90=moment()[_0xe68b('0x31')](_0xe68b('0x32'));for(var _0x4e177c=0x0,_0x3dc9a0=_0x647b03[_0xe68b('0x30')];_0x4e177c<_0x3dc9a0;_0x4e177c+=0x1){_0x647b03[_0x4e177c]['updateAttributes']({'exitAt':_0x2ace90});}});for(var _0x5b94bb=0x0;_0x5b94bb<_0x46b7ee['body'][_0xe68b('0x2b')][_0x58b8ca][_0xe68b('0x30')];_0x5b94bb+=0x1){db['MemberReport'][_0xe68b('0x33')]({'where':{'channel':_0x58b8ca,'membername':_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x12')],'type':_0xe68b('0x2f'),'uniqueid':_0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x2b')][_0x58b8ca][_0x5b94bb],'exitAt':null},'defaults':{'channel':_0x58b8ca,'membername':_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x12')],'interface':_[_0xe68b('0x14')](_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x35')])?util[_0xe68b('0x31')](_0xe68b('0x36'),_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x12')]):_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x35')],'type':_0xe68b('0x2f'),'enterAt':moment()[_0xe68b('0x31')](_0xe68b('0x32')),'role':_0xe68b('0x37'),'internal':_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x38')],'uniqueid':_0x46b7ee[_0xe68b('0x2a')]['interaction'][_0x58b8ca][_0x5b94bb]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x46b7ee[_0xe68b('0x1b')]['id'],'capacity':_0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x39')]},routingClient)['then'](respondWithResult(_0x36f97c,null))[_0xe68b('0xd')](handleError(_0x36f97c,null));};exports[_0xe68b('0x3a')]=function(_0x197c13,_0x486cc9){return respondWithRpcPromise('Telephones',_0x197c13['query'])['then'](respondWithResult(_0x486cc9,null))[_0xe68b('0xd')](handleError(_0x486cc9,null));};exports[_0xe68b('0x3b')]=function(_0x2a8999,_0x3d3f85){return respondWithRpcPromise(_0xe68b('0x3c'),_0x2a8999[_0xe68b('0x18')])['then'](respondWithResult(_0x3d3f85,null))[_0xe68b('0xd')](handleError(_0x3d3f85,null));};exports[_0xe68b('0x3d')]=function(_0x21d58e,_0x546f4a){return respondWithRpcPromise(_0xe68b('0x3e'),_0x21d58e[_0xe68b('0x18')])['then'](respondWithResult(_0x546f4a,null))[_0xe68b('0xd')](handleError(_0x546f4a,null));};exports[_0xe68b('0x3f')]=function(_0x21004a,_0x4a55fc){return respondWithRpcPromise(_0xe68b('0x40'),_0x21004a['query'],routingClient)[_0xe68b('0x9')](respondWithResult(_0x4a55fc,null))[_0xe68b('0xd')](handleError(_0x4a55fc,null));};exports[_0xe68b('0x41')]=function(_0x54cb38,_0x22856f){return respondWithRpcPromise('ChatQueues',_0x54cb38[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0x54cb38['params']['id']))[_0xe68b('0x9')](respondWithResult(_0x22856f,null))['catch'](handleError(_0x22856f,null));};exports['mailQueues']=function(_0x128aef,_0x102db9){return respondWithRpcPromise(_0xe68b('0x42'),_0x128aef['query'],routingClient)['then'](respondWithResult(_0x102db9,null))[_0xe68b('0xd')](handleError(_0x102db9,null));};exports[_0xe68b('0x43')]=function(_0x4388c1,_0x5638e){return respondWithRpcPromise('MailQueues',_0x4388c1[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0x4388c1['params']['id']))[_0xe68b('0x9')](respondWithResult(_0x5638e,null))[_0xe68b('0xd')](handleError(_0x5638e,null));};exports[_0xe68b('0x44')]=function(_0x2d0f5f,_0xe8e003){return respondWithRpcPromise(_0xe68b('0x45'),_0x2d0f5f['query'],mailClient)[_0xe68b('0x9')](respondWithResult(_0xe8e003,null))[_0xe68b('0xd')](handleError(_0xe8e003,null));};exports[_0xe68b('0x46')]=function(_0x17a3e0,_0x52bbd2){return respondWithRpcPromise('OpenchannelQueues',_0x17a3e0[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x52bbd2,null))[_0xe68b('0xd')](handleError(_0x52bbd2,null));};exports[_0xe68b('0x47')]=function(_0x13eb8a,_0x149d41){return respondWithRpcPromise(_0xe68b('0x48'),_0x13eb8a[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0x13eb8a['params']['id']))[_0xe68b('0x9')](respondWithResult(_0x149d41,null))[_0xe68b('0xd')](handleError(_0x149d41,null));};exports[_0xe68b('0x49')]=function(_0x25f7a9,_0x257f55){return respondWithRpcPromise(_0xe68b('0x4a'),_0x25f7a9[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x257f55,null))[_0xe68b('0xd')](handleError(_0x257f55,null));};exports[_0xe68b('0x4b')]=function(_0x5ef8c4,_0x5c5bdb){return respondWithRpcPromise('SmsQueues',_0x5ef8c4[_0xe68b('0x18')],routingClient)['then'](findById(_0x5ef8c4[_0xe68b('0x1b')]['id']))['then'](respondWithResult(_0x5c5bdb,null))['catch'](handleError(_0x5c5bdb,null));};exports[_0xe68b('0x4c')]=function(_0x15b5a7,_0x20eea5){return respondWithRpcPromise(_0xe68b('0x4d'),_0x15b5a7[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x20eea5,null))[_0xe68b('0xd')](handleError(_0x20eea5,null));};exports[_0xe68b('0x4e')]=function(_0x1e20ac,_0x4a3e81){return respondWithRpcPromise('WhatsappQueues',_0x1e20ac[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0x1e20ac[_0xe68b('0x1b')]['id']))[_0xe68b('0x9')](respondWithResult(_0x4a3e81,null))[_0xe68b('0xd')](handleError(_0x4a3e81,null));};exports['faxQueues']=function(_0x59057b,_0x384c19){return respondWithRpcPromise(_0xe68b('0x4f'),_0x59057b[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x384c19,null))[_0xe68b('0xd')](handleError(_0x384c19,null));};exports[_0xe68b('0x50')]=function(_0xd40b30,_0x275c4f){return respondWithRpcPromise(_0xe68b('0x4f'),_0xd40b30[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0xd40b30['params']['id']))['then'](respondWithResult(_0x275c4f,null))[_0xe68b('0xd')](handleError(_0x275c4f,null));};exports['faxAccounts']=function(_0x4bd664,_0xf3b027){return respondWithRpcPromise(_0xe68b('0x51'),_0x4bd664[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0xf3b027,null))[_0xe68b('0xd')](handleError(_0xf3b027,null));};exports[_0xe68b('0x52')]=function(_0x1f5f74,_0x2c02c0){return respondWithRpcPromise(_0xe68b('0x53'),_0x1f5f74['query'],routingClient)[_0xe68b('0x9')](respondWithResult(_0x2c02c0,null))[_0xe68b('0xd')](handleError(_0x2c02c0,null));};exports['mailQueuesWaitingInteractions']=function(_0x340cb9,_0x51cf3e){return respondWithRpcPromise(_0xe68b('0x54'),_0x340cb9[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x51cf3e,null))[_0xe68b('0xd')](handleError(_0x51cf3e,null));};exports[_0xe68b('0x55')]=function(_0x8b508e,_0x40cc16){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x8b508e[_0xe68b('0x18')],routingClient)['then'](respondWithResult(_0x40cc16,null))[_0xe68b('0xd')](handleError(_0x40cc16,null));};exports[_0xe68b('0x56')]=function(_0x5e45ab,_0x11f0c9){return respondWithRpcPromise(_0xe68b('0x57'),_0x5e45ab[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](function(_0x410929){if(_0x5e45ab['query'][_0xe68b('0x58')]!==undefined){var _0x5ea9e3=_(_0x410929[_0xe68b('0x15')])[_0xe68b('0x59')]([_0x5e45ab[_0xe68b('0x18')][_0xe68b('0x58')],_0x5e45ab[_0xe68b('0x1b')]['id']])[_0xe68b('0x5a')](_0xe68b('0x5b'))['uniq']()[_0xe68b('0x5c')]();return _0x410929['rows'][_0xe68b('0x59')](function(_0x161967){return _0x5ea9e3[_0xe68b('0x5d')](_0x161967[_0xe68b('0x5b')])>-0x1;});}else{return _0x410929[_0xe68b('0x15')][_0xe68b('0x59')](function(_0x19d628){return _0x19d628[_0xe68b('0x5b')]===parseInt(_0x5e45ab[_0xe68b('0x1b')]['id']);});}})[_0xe68b('0x9')](respondWithResult(_0x11f0c9,null))[_0xe68b('0xd')](handleError(_0x11f0c9,null));};exports[_0xe68b('0x5e')]=function(_0x458442,_0x55452d){return respondWithRpcPromise(_0xe68b('0x5f'),_0x458442[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x55452d,null))[_0xe68b('0xd')](handleError(_0x55452d,null));};exports[_0xe68b('0x60')]=function(_0x56a904,_0x418b0d){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x56a904[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x418b0d,null))[_0xe68b('0xd')](handleError(_0x418b0d,null));};exports[_0xe68b('0x61')]=function(_0x124a59,_0x215865){return respondWithRpcPromise(_0xe68b('0x62'),_0x124a59[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x215865,null))[_0xe68b('0xd')](handleError(_0x215865,null));};exports[_0xe68b('0x63')]=function(_0x27016a){return function(_0x53d7a0,_0x187de4){var _0xb492ad,_0xee3a2a;var _0x4e64f2=_[_0xe68b('0x64')](_0x27016a);var _0x23d024=_0x27016a===_0xe68b('0x65')?_0xe68b('0x66'):'Account';return db[_0x4e64f2+_0xe68b('0x67')][_0xe68b('0x68')]({'raw':!![],'where':{'id':_0x53d7a0[_0xe68b('0x1b')]['id']}})[_0xe68b('0x9')](function(_0x70e377){if(_[_0xe68b('0x14')](_0x70e377)){throw new Error(_0x4e64f2+_0xe68b('0x69'));}_0xb492ad=_0x70e377;return db[_0x4e64f2+_0xe68b('0x6a')][_0xe68b('0x68')]({'where':{'id':_0x53d7a0['body'][_0xe68b('0x6b')]},'include':[{'model':db[_0x4e64f2+_0xe68b('0x6c')],'as':_0xe68b('0x6c')},{'model':db[_0x4e64f2+_0x23d024],'as':_0xe68b('0x6d')}]});})[_0xe68b('0x9')](function(_0x5d52bc){if(_[_0xe68b('0x14')](_0x5d52bc)){throw new Error(_0x4e64f2+_0xe68b('0x6e'));}_0xee3a2a=_0x5d52bc;return _0x5d52bc[_0xe68b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x567516={'uniqueid':_0x27016a+'.'+_0xee3a2a['id']+'.'+_0xee3a2a[_0xe68b('0x6c')]['id'],'FromUserId':_0x53d7a0['user']['id'],'type':_0xe68b('0x70')};_0x567516[_0x4e64f2+'MessageId']=_0xee3a2a['id'];_0x567516[_0x4e64f2+_0xe68b('0x71')]=_0xee3a2a[_0xe68b('0x6c')]['id'];_0x567516['From'+_0x4e64f2+_0x23d024+'Id']=_0xee3a2a['Account']['id'];_0x567516['To'+_0x4e64f2+'QueueId']=_0xb492ad['id'];return db[_0x4e64f2+_0xe68b('0x72')][_0xe68b('0x73')](_0x567516);})[_0xe68b('0x9')](function(){return respondWithRpcPromise(_0xe68b('0x74'),{'channel':_0x27016a,'interaction':_0xee3a2a[_0xe68b('0x6c')],'message':_0xee3a2a,'account':_0xee3a2a[_0xe68b('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe68b('0x70'),'appdata':_0xb492ad['name']+','+(_0xee3a2a[_0xe68b('0x6d')][_0xe68b('0x75')]||0x12c),'interval':_0xe68b('0x76')}]},routingClient);})[_0xe68b('0x9')](respondWithResult(_0x187de4,null))[_0xe68b('0xd')](handleError(_0x187de4,null));};};exports[_0xe68b('0x77')]=function(_0x25b308,_0x4ca9c1){var _0x3daeaf,_0x25b8fe;if(_[_0xe68b('0x14')](_0x25b308['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x508bde=_0x25b308[_0xe68b('0x2a')][_0xe68b('0x78')];var _0x5d3d9f=_[_0xe68b('0x64')](_0x508bde);var _0x1ed47e=_0x508bde===_0xe68b('0x65')?'Website':_0xe68b('0x6d');return db[_0xe68b('0x79')][_0xe68b('0x68')]({'raw':!![],'where':{'id':_0x25b308['params']['id'],'role':_0xe68b('0x37')}})[_0xe68b('0x9')](function(_0x37861c){if(_[_0xe68b('0x14')](_0x37861c)){throw new Error(_0xe68b('0x7a'));}_0x3daeaf=_0x37861c;return db[_0x5d3d9f+_0xe68b('0x6a')][_0xe68b('0x68')]({'where':{'id':_0x25b308[_0xe68b('0x2a')]['messageId']},'include':[{'model':db[_0x5d3d9f+_0xe68b('0x6c')],'as':_0xe68b('0x6c')},{'model':db[_0x5d3d9f+_0x1ed47e],'as':_0xe68b('0x6d')}]});})['then'](function(_0x50aadd){if(_['isNil'](_0x50aadd)){throw new Error(_0x5d3d9f+_0xe68b('0x6e'));}_0x25b8fe=_0x50aadd;return _0x50aadd['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xe68b('0x9')](function(){var _0x278b4f={'uniqueid':_0x508bde+'.'+_0x25b8fe['id']+'.'+_0x25b8fe['Interaction']['id'],'FromUserId':_0x25b308[_0xe68b('0x34')]['id'],'type':_0xe68b('0x70'),'ToUserId':_0x3daeaf['id']};_0x278b4f[_0x5d3d9f+'MessageId']=_0x25b8fe['id'];_0x278b4f[_0x5d3d9f+'InteractionId']=_0x25b8fe[_0xe68b('0x6c')]['id'];_0x278b4f[_0xe68b('0x7b')+_0x5d3d9f+_0x1ed47e+'Id']=_0x25b8fe[_0xe68b('0x6d')]['id'];return db[_0x5d3d9f+'TransferReport'][_0xe68b('0x73')](_0x278b4f);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x508bde,'interaction':_0x25b8fe[_0xe68b('0x6c')],'message':_0x25b8fe,'account':_0x25b8fe['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xe68b('0x37'),'appdata':_0x3daeaf[_0xe68b('0x12')]+','+(_0x25b8fe[_0xe68b('0x6d')][_0xe68b('0x7c')]||0x12c),'interval':_0xe68b('0x76')}]},routingClient);})['then'](respondWithResult(_0x4ca9c1,null))[_0xe68b('0xd')](handleError(_0x4ca9c1,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index fb530eb..02d7474 100644 --- a/server/api/schedule/index.js +++ b/server/api/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b6a=['./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4743c3,_0x121a22){var _0xeac401=function(_0x632fd3){while(--_0x632fd3){_0x4743c3['push'](_0x4743c3['shift']());}};_0xeac401(++_0x121a22);}(_0x7b6a,0x174));var _0xa7b6=function(_0x1ec672,_0x17895f){_0x1ec672=_0x1ec672-0x0;var _0x136b7d=_0x7b6a[_0x1ec672];return _0x136b7d;};'use strict';var multer=require(_0xa7b6('0x0'));var util=require(_0xa7b6('0x1'));var path=require(_0xa7b6('0x2'));var timeout=require(_0xa7b6('0x3'));var express=require(_0xa7b6('0x4'));var router=express[_0xa7b6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa7b6('0x6'));var config=require(_0xa7b6('0x7'));var controller=require(_0xa7b6('0x8'));router[_0xa7b6('0x9')]('/',auth[_0xa7b6('0xa')](),controller['index']);router['get'](_0xa7b6('0xb'),auth[_0xa7b6('0xa')](),controller[_0xa7b6('0xc')]);router[_0xa7b6('0x9')](_0xa7b6('0xd'),auth[_0xa7b6('0xa')](),controller[_0xa7b6('0xe')]);router[_0xa7b6('0xf')]('/',auth[_0xa7b6('0xa')](),controller[_0xa7b6('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa7b6('0x11')](_0xa7b6('0xb'),auth[_0xa7b6('0xa')](),controller['destroy']);module[_0xa7b6('0x12')]=router; \ No newline at end of file +var _0x51ce=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x285378,_0x388380){var _0x47f299=function(_0x31a8d7){while(--_0x31a8d7){_0x285378['push'](_0x285378['shift']());}};_0x47f299(++_0x388380);}(_0x51ce,0x1ba));var _0xe51c=function(_0x2daef6,_0xcac228){_0x2daef6=_0x2daef6-0x0;var _0x62d030=_0x51ce[_0x2daef6];return _0x62d030;};'use strict';var multer=require(_0xe51c('0x0'));var util=require(_0xe51c('0x1'));var path=require('path');var timeout=require(_0xe51c('0x2'));var express=require('express');var router=express[_0xe51c('0x3')]();var auth=require(_0xe51c('0x4'));var interaction=require(_0xe51c('0x5'));var config=require(_0xe51c('0x6'));var controller=require(_0xe51c('0x7'));router[_0xe51c('0x8')]('/',auth[_0xe51c('0x9')](),controller[_0xe51c('0xa')]);router['get'](_0xe51c('0xb'),auth[_0xe51c('0x9')](),controller[_0xe51c('0xc')]);router[_0xe51c('0x8')]('/:id/run',auth[_0xe51c('0x9')](),controller['run']);router[_0xe51c('0xd')]('/',auth[_0xe51c('0x9')](),controller[_0xe51c('0xe')]);router[_0xe51c('0xf')]('/:id',auth[_0xe51c('0x9')](),controller[_0xe51c('0x10')]);router[_0xe51c('0x11')](_0xe51c('0xb'),auth[_0xe51c('0x9')](),controller[_0xe51c('0x12')]);module[_0xe51c('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 0652e86..8cc29ee 100644 --- a/server/api/schedule/schedule.attributes.js +++ b/server/api/schedule/schedule.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a8b=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','weeks','hours','days','csv','xlsx','custom','default','TEXT','sequelize','STRING'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x8a8b,0xae));var _0xb8a8=function(_0x5a0b73,_0x549d99){_0x5a0b73=_0x5a0b73-0x0;var _0x5c1ab5=_0x8a8b[_0x5a0b73];return _0x5c1ab5;};'use strict';var Sequelize=require(_0xb8a8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb8a8('0x1')]},'active':{'type':Sequelize[_0xb8a8('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb8a8('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xb8a8('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb8a8('0x5')](_0xb8a8('0x6'),_0xb8a8('0x7'),'months',_0xb8a8('0x8'),'days',_0xb8a8('0x9'),'minutes'),'allowNull':![],'defaultValue':_0xb8a8('0xa')},'output':{'type':Sequelize[_0xb8a8('0x5')](_0xb8a8('0xb'),'pdf',_0xb8a8('0xc')),'allowNull':![],'defaultValue':_0xb8a8('0xb')},'type':{'type':Sequelize[_0xb8a8('0x5')](_0xb8a8('0xd'),_0xb8a8('0xe')),'allowNull':![],'defaultValue':_0xb8a8('0xd')},'sendMail':{'type':Sequelize[_0xb8a8('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xb8a8('0x1')]},'cc':{'type':Sequelize[_0xb8a8('0xf')]},'bcc':{'type':Sequelize[_0xb8a8('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xb8a8('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2f74=['xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','months','weeks','days','hours','minutes','ENUM','csv'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x2f74,0x7b));var _0x42f7=function(_0x211d4a,_0x9d4244){_0x211d4a=_0x211d4a-0x0;var _0x208576=_0x2f74[_0x211d4a];return _0x208576;};'use strict';var Sequelize=require(_0x42f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x42f7('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x42f7('0x1')]},'active':{'type':Sequelize[_0x42f7('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x42f7('0x1')],'allowNull':![],'defaultValue':_0x42f7('0x3')},'startAt':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x42f7('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters',_0x42f7('0x6'),_0x42f7('0x7'),_0x42f7('0x8'),_0x42f7('0x9'),_0x42f7('0xa')),'allowNull':![],'defaultValue':_0x42f7('0x8')},'output':{'type':Sequelize[_0x42f7('0xb')](_0x42f7('0xc'),'pdf',_0x42f7('0xd')),'allowNull':![],'defaultValue':_0x42f7('0xc')},'type':{'type':Sequelize[_0x42f7('0xb')](_0x42f7('0xe'),_0x42f7('0xf')),'allowNull':![],'defaultValue':_0x42f7('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x42f7('0x1')]},'cc':{'type':Sequelize[_0x42f7('0x10')]},'bcc':{'type':Sequelize[_0x42f7('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x42f7('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index e902aaf..fbdf86a 100644 --- a/server/api/schedule/schedule.controller.js +++ b/server/api/schedule/schedule.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0e2=['rawAttributes','fieldName','type','key','model','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','error','name','send','index','map','Schedule'];(function(_0x189ac2,_0x450975){var _0x36938c=function(_0x42063b){while(--_0x42063b){_0x189ac2['push'](_0x189ac2['shift']());}};_0x36938c(++_0x450975);}(_0xf0e2,0xcb));var _0x2f0e=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf0e2[_0x22b68a];return _0x1ac67a;};'use strict';var pdf=require(_0x2f0e('0x0'));var emlformat=require(_0x2f0e('0x1'));var rimraf=require(_0x2f0e('0x2'));var zipdir=require(_0x2f0e('0x3'));var jsonpatch=require(_0x2f0e('0x4'));var rp=require(_0x2f0e('0x5'));var moment=require('moment');var BPromise=require(_0x2f0e('0x6'));var Mustache=require(_0x2f0e('0x7'));var util=require(_0x2f0e('0x8'));var path=require(_0x2f0e('0x9'));var sox=require(_0x2f0e('0xa'));var csv=require(_0x2f0e('0xb'));var ejs=require(_0x2f0e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2f0e('0xd'));var crypto=require(_0x2f0e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f0e('0xb'));var querystring=require('querystring');var Papa=require(_0x2f0e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2f0e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f0e('0x11'))(_0x2f0e('0x12'));var utils=require(_0x2f0e('0x13'));var config=require(_0x2f0e('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29025f,_0xf6012d){_0xf6012d=_0xf6012d||0xcc;return function(_0x178368){if(_0x178368){return _0x29025f[_0x2f0e('0x15')](_0xf6012d);}return _0x29025f[_0x2f0e('0x16')](_0xf6012d)[_0x2f0e('0x17')]();};}function respondWithResult(_0x673269,_0x1bb0c4){_0x1bb0c4=_0x1bb0c4||0xc8;return function(_0x485e2c){if(_0x485e2c){return _0x673269[_0x2f0e('0x16')](_0x1bb0c4)[_0x2f0e('0x18')](_0x485e2c);}};}function respondWithFilteredResult(_0x45a6f8,_0x43998a){return function(_0x31bab0){if(_0x31bab0){var _0x5a5b0b=_0x31bab0[_0x2f0e('0x19')],_0x371a6e=_0x43998a[_0x2f0e('0x1a')],_0x495e3a=_0x43998a[_0x2f0e('0x1a')]+_0x43998a['limit'],_0x4ac964;if(_0x495e3a>=_0x5a5b0b){_0x495e3a=_0x5a5b0b;_0x4ac964=0xc8;}else{_0x4ac964=0xce;}_0x45a6f8['status'](_0x4ac964);return _0x45a6f8[_0x2f0e('0x1b')](_0x2f0e('0x1c'),_0x371a6e+'-'+_0x495e3a+'/'+_0x5a5b0b)[_0x2f0e('0x18')](_0x31bab0);}return null;};}function patchUpdates(_0x1fd160){return function(_0x4a788d){try{jsonpatch['apply'](_0x4a788d,_0x1fd160,!![]);}catch(_0x3fb17a){return BPromise[_0x2f0e('0x1d')](_0x3fb17a);}return _0x4a788d[_0x2f0e('0x1e')]();};}function saveUpdates(_0x403d5d,_0x8fbfeb){return function(_0x3709f7){if(_0x3709f7){return _0x3709f7[_0x2f0e('0x1f')](_0x403d5d)['then'](function(_0x55221b){return _0x55221b;});}return null;};}function removeEntity(_0x5390d6,_0x15699e){return function(_0xab7aaa){if(_0xab7aaa){return _0xab7aaa[_0x2f0e('0x20')]()[_0x2f0e('0x21')](function(){var _0x2104f2=_0xab7aaa[_0x2f0e('0x22')]({'plain':!![]});var _0x41062d=_0x2f0e('0x23');return db[_0x2f0e('0x24')][_0x2f0e('0x20')]({'where':{'type':_0x41062d,'resourceId':_0x2104f2['id']}})[_0x2f0e('0x21')](function(){return _0xab7aaa;});})[_0x2f0e('0x21')](function(){_0x5390d6[_0x2f0e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250e9b,_0x5ec5cd){return function(_0x30745f){if(!_0x30745f){_0x250e9b[_0x2f0e('0x15')](0x194);}return _0x30745f;};}function handleError(_0x3108a1,_0x4c6dab){_0x4c6dab=_0x4c6dab||0x1f4;return function(_0x5cddd5){logger[_0x2f0e('0x25')](_0x5cddd5['stack']);if(_0x5cddd5[_0x2f0e('0x26')]){delete _0x5cddd5[_0x2f0e('0x26')];}_0x3108a1['status'](_0x4c6dab)[_0x2f0e('0x27')](_0x5cddd5);};}exports[_0x2f0e('0x28')]=function(_0x58f7e5,_0xfccdd5){var _0xea3a0a={},_0x541d55={},_0x138d3d={'count':0x0,'rows':[]};var _0x319054=_[_0x2f0e('0x29')](db[_0x2f0e('0x2a')][_0x2f0e('0x2b')],function(_0x4a8068){return{'name':_0x4a8068[_0x2f0e('0x2c')],'type':_0x4a8068[_0x2f0e('0x2d')][_0x2f0e('0x2e')]};});_0x541d55[_0x2f0e('0x2f')]=_[_0x2f0e('0x29')](_0x319054,_0x2f0e('0x26'));_0x541d55['query']=_['keys'](_0x58f7e5['query']);_0x541d55[_0x2f0e('0x30')]=_['intersection'](_0x541d55[_0x2f0e('0x2f')],_0x541d55['query']);_0xea3a0a[_0x2f0e('0x31')]=_[_0x2f0e('0x32')](_0x541d55['model'],qs[_0x2f0e('0x33')](_0x58f7e5[_0x2f0e('0x34')][_0x2f0e('0x33')]));_0xea3a0a[_0x2f0e('0x31')]=_0xea3a0a[_0x2f0e('0x31')][_0x2f0e('0x35')]?_0xea3a0a[_0x2f0e('0x31')]:_0x541d55[_0x2f0e('0x2f')];if(!_0x58f7e5[_0x2f0e('0x34')][_0x2f0e('0x36')](_0x2f0e('0x37'))){_0xea3a0a[_0x2f0e('0x38')]=qs[_0x2f0e('0x38')](_0x58f7e5[_0x2f0e('0x34')][_0x2f0e('0x38')]);_0xea3a0a[_0x2f0e('0x1a')]=qs[_0x2f0e('0x1a')](_0x58f7e5[_0x2f0e('0x34')][_0x2f0e('0x1a')]);}_0xea3a0a[_0x2f0e('0x39')]=qs[_0x2f0e('0x3a')](_0x58f7e5['query'][_0x2f0e('0x3a')]);_0xea3a0a[_0x2f0e('0x3b')]=qs['filters'](_[_0x2f0e('0x3c')](_0x58f7e5[_0x2f0e('0x34')],_0x541d55['filters']),_0x319054);if(_0x58f7e5[_0x2f0e('0x34')][_0x2f0e('0x3d')]){_0xea3a0a[_0x2f0e('0x3b')]=_[_0x2f0e('0x3e')](_0xea3a0a['where'],{'$or':_[_0x2f0e('0x29')](_0x319054,function(_0x6505d6){if(_0x6505d6[_0x2f0e('0x2d')]!=='VIRTUAL'){var _0x37bc0d={};_0x37bc0d[_0x6505d6[_0x2f0e('0x26')]]={'$like':'%'+_0x58f7e5['query'][_0x2f0e('0x3d')]+'%'};return _0x37bc0d;}})});}_0xea3a0a=_[_0x2f0e('0x3e')]({},_0xea3a0a,_0x58f7e5['options']);var _0x2823ce={'where':_0xea3a0a[_0x2f0e('0x3b')]};return db[_0x2f0e('0x2a')]['count'](_0x2823ce)[_0x2f0e('0x21')](function(_0x4f3402){_0x138d3d['count']=_0x4f3402;if(_0x58f7e5[_0x2f0e('0x34')][_0x2f0e('0x3f')]){_0xea3a0a[_0x2f0e('0x40')]=[{'all':!![]}];}return db[_0x2f0e('0x2a')][_0x2f0e('0x41')](_0xea3a0a);})[_0x2f0e('0x21')](function(_0x31f258){_0x138d3d[_0x2f0e('0x42')]=_0x31f258;return _0x138d3d;})[_0x2f0e('0x21')](respondWithFilteredResult(_0xfccdd5,_0xea3a0a))[_0x2f0e('0x43')](handleError(_0xfccdd5,null));};exports[_0x2f0e('0x44')]=function(_0x2280ee,_0xc702c9){var _0x373734={'raw':![],'where':{'id':_0x2280ee[_0x2f0e('0x45')]['id']}},_0x2ad4b4={};_0x2ad4b4[_0x2f0e('0x2f')]=_[_0x2f0e('0x46')](db['Schedule']['rawAttributes']);_0x2ad4b4[_0x2f0e('0x34')]=_[_0x2f0e('0x46')](_0x2280ee[_0x2f0e('0x34')]);_0x2ad4b4[_0x2f0e('0x30')]=_[_0x2f0e('0x32')](_0x2ad4b4['model'],_0x2ad4b4['query']);_0x373734[_0x2f0e('0x31')]=_[_0x2f0e('0x32')](_0x2ad4b4['model'],qs[_0x2f0e('0x33')](_0x2280ee[_0x2f0e('0x34')][_0x2f0e('0x33')]));_0x373734['attributes']=_0x373734[_0x2f0e('0x31')][_0x2f0e('0x35')]?_0x373734[_0x2f0e('0x31')]:_0x2ad4b4[_0x2f0e('0x2f')];if(_0x2280ee[_0x2f0e('0x34')][_0x2f0e('0x3f')]){_0x373734[_0x2f0e('0x40')]=[{'all':!![]}];}_0x373734=_[_0x2f0e('0x3e')]({},_0x373734,_0x2280ee[_0x2f0e('0x47')]);return db['Schedule'][_0x2f0e('0x48')](_0x373734)[_0x2f0e('0x21')](handleEntityNotFound(_0xc702c9,null))[_0x2f0e('0x21')](respondWithResult(_0xc702c9,null))['catch'](handleError(_0xc702c9,null));};exports[_0x2f0e('0x49')]=function(_0x25efe7,_0x3987cf){return db[_0x2f0e('0x2a')][_0x2f0e('0x49')](_0x25efe7['body'],{})['then'](function(_0x145840){var _0x438d54=_0x25efe7[_0x2f0e('0x4a')][_0x2f0e('0x22')]({'plain':!![]});if(!_0x438d54)throw new Error(_0x2f0e('0x4b'));if(_0x438d54[_0x2f0e('0x4c')]===_0x2f0e('0x4a')){var _0x1fa39d=_0x145840['get']({'plain':!![]});var _0x3f0c04='Scheduler';return db[_0x2f0e('0x4d')][_0x2f0e('0x48')]({'where':{'name':_0x3f0c04,'userProfileId':_0x438d54['userProfileId']},'raw':!![]})[_0x2f0e('0x21')](function(_0x7e7457){if(_0x7e7457&&_0x7e7457[_0x2f0e('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x1fa39d[_0x2f0e('0x26')],'resourceId':_0x1fa39d['id'],'type':_0x7e7457[_0x2f0e('0x26')],'sectionId':_0x7e7457['id']},{})[_0x2f0e('0x21')](function(){return _0x145840;});}else{return _0x145840;}})['catch'](function(_0x955b5b){logger[_0x2f0e('0x25')](_0x2f0e('0x4f'),_0x955b5b);throw _0x955b5b;});}return _0x145840;})['then'](respondWithResult(_0x3987cf,0xc9))['catch'](handleError(_0x3987cf,null));};exports[_0x2f0e('0x1f')]=function(_0x457a4f,_0x564f9d){if(_0x457a4f['body']['id']){delete _0x457a4f[_0x2f0e('0x50')]['id'];}return db[_0x2f0e('0x2a')]['find']({'where':{'id':_0x457a4f[_0x2f0e('0x45')]['id']}})['then'](handleEntityNotFound(_0x564f9d,null))[_0x2f0e('0x21')](saveUpdates(_0x457a4f['body'],null))[_0x2f0e('0x21')](respondWithResult(_0x564f9d,null))[_0x2f0e('0x43')](handleError(_0x564f9d,null));};exports[_0x2f0e('0x20')]=function(_0x4e1b91,_0xa913c3){return db['Schedule'][_0x2f0e('0x48')]({'where':{'id':_0x4e1b91[_0x2f0e('0x45')]['id']}})[_0x2f0e('0x21')](handleEntityNotFound(_0xa913c3,null))[_0x2f0e('0x21')](removeEntity(_0xa913c3,null))[_0x2f0e('0x43')](handleError(_0xa913c3,null));};exports['run']=function(_0x19a302,_0x143078,_0x599992){var _0x5c7d61=require('../../config/schedule');return db[_0x2f0e('0x2a')][_0x2f0e('0x48')]({'where':{'id':_0x19a302[_0x2f0e('0x45')]['id']},'raw':!![]})[_0x2f0e('0x21')](handleEntityNotFound(_0x143078,null))[_0x2f0e('0x21')](function(){_0x5c7d61[_0x2f0e('0x51')](_0x19a302[_0x2f0e('0x45')]['id']);})[_0x2f0e('0x21')](respondWithStatusCode(_0x143078,null))[_0x2f0e('0x43')](handleError(_0x143078,null));}; \ No newline at end of file +var _0x26bf=['limit','set','Content-Range','json','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','Schedule','fieldName','type','key','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset'];(function(_0x148c65,_0x4a6a20){var _0x406635=function(_0x451146){while(--_0x451146){_0x148c65['push'](_0x148c65['shift']());}};_0x406635(++_0x4a6a20);}(_0x26bf,0x85));var _0xf26b=function(_0x27466b,_0x5bdb3d){_0x27466b=_0x27466b-0x0;var _0x4f4726=_0x26bf[_0x27466b];return _0x4f4726;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf26b('0x0'));var rimraf=require(_0xf26b('0x1'));var zipdir=require(_0xf26b('0x2'));var jsonpatch=require(_0xf26b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf26b('0x4'));var util=require('util');var path=require(_0xf26b('0x5'));var sox=require('sox');var csv=require(_0xf26b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf26b('0x7'));var squel=require('squel');var crypto=require(_0xf26b('0x8'));var jsforce=require(_0xf26b('0x9'));var deskjs=require(_0xf26b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf26b('0xb'));var authService=require(_0xf26b('0xc'));var qs=require(_0xf26b('0xd'));var as=require(_0xf26b('0xe'));var hardwareService=require(_0xf26b('0xf'));var logger=require(_0xf26b('0x10'))(_0xf26b('0x11'));var utils=require(_0xf26b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf26b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x62e78c,_0xc2b20f){_0xc2b20f=_0xc2b20f||0xcc;return function(_0x59c88c){if(_0x59c88c){return _0x62e78c[_0xf26b('0x14')](_0xc2b20f);}return _0x62e78c[_0xf26b('0x15')](_0xc2b20f)[_0xf26b('0x16')]();};}function respondWithResult(_0x5382a7,_0x113ac6){_0x113ac6=_0x113ac6||0xc8;return function(_0x1fee2c){if(_0x1fee2c){return _0x5382a7[_0xf26b('0x15')](_0x113ac6)['json'](_0x1fee2c);}};}function respondWithFilteredResult(_0x43c414,_0xb81b15){return function(_0x14407d){if(_0x14407d){var _0x2f8ea2=_0x14407d[_0xf26b('0x17')],_0x4ffa95=_0xb81b15[_0xf26b('0x18')],_0x21b893=_0xb81b15[_0xf26b('0x18')]+_0xb81b15[_0xf26b('0x19')],_0x53f854;if(_0x21b893>=_0x2f8ea2){_0x21b893=_0x2f8ea2;_0x53f854=0xc8;}else{_0x53f854=0xce;}_0x43c414[_0xf26b('0x15')](_0x53f854);return _0x43c414[_0xf26b('0x1a')](_0xf26b('0x1b'),_0x4ffa95+'-'+_0x21b893+'/'+_0x2f8ea2)[_0xf26b('0x1c')](_0x14407d);}return null;};}function patchUpdates(_0x235146){return function(_0xd070a1){try{jsonpatch['apply'](_0xd070a1,_0x235146,!![]);}catch(_0xead887){return BPromise['reject'](_0xead887);}return _0xd070a1[_0xf26b('0x1d')]();};}function saveUpdates(_0x4278b5,_0xfa93c4){return function(_0x2c1b46){if(_0x2c1b46){return _0x2c1b46['update'](_0x4278b5)[_0xf26b('0x1e')](function(_0x3c0025){return _0x3c0025;});}return null;};}function removeEntity(_0x443d8c,_0x4c52e7){return function(_0x6336bd){if(_0x6336bd){return _0x6336bd[_0xf26b('0x1f')]()[_0xf26b('0x1e')](function(){var _0x4c49e1=_0x6336bd[_0xf26b('0x20')]({'plain':!![]});var _0xc1219d='Scheduler';return db[_0xf26b('0x21')][_0xf26b('0x1f')]({'where':{'type':_0xc1219d,'resourceId':_0x4c49e1['id']}})[_0xf26b('0x1e')](function(){return _0x6336bd;});})[_0xf26b('0x1e')](function(){_0x443d8c[_0xf26b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa65510,_0x30ff47){return function(_0x5e3df0){if(!_0x5e3df0){_0xa65510[_0xf26b('0x14')](0x194);}return _0x5e3df0;};}function handleError(_0x19c2e2,_0x1a48c4){_0x1a48c4=_0x1a48c4||0x1f4;return function(_0x1e83f8){logger[_0xf26b('0x22')](_0x1e83f8[_0xf26b('0x23')]);if(_0x1e83f8[_0xf26b('0x24')]){delete _0x1e83f8[_0xf26b('0x24')];}_0x19c2e2['status'](_0x1a48c4)[_0xf26b('0x25')](_0x1e83f8);};}exports['index']=function(_0x4b8865,_0x61b786){var _0x2abee2={},_0x4cd9e8={},_0x6ddeb6={'count':0x0,'rows':[]};var _0x255fb7=_[_0xf26b('0x26')](db[_0xf26b('0x27')]['rawAttributes'],function(_0x33df15){return{'name':_0x33df15[_0xf26b('0x28')],'type':_0x33df15[_0xf26b('0x29')][_0xf26b('0x2a')]};});_0x4cd9e8['model']=_[_0xf26b('0x26')](_0x255fb7,_0xf26b('0x24'));_0x4cd9e8[_0xf26b('0x2b')]=_[_0xf26b('0x2c')](_0x4b8865[_0xf26b('0x2b')]);_0x4cd9e8['filters']=_['intersection'](_0x4cd9e8[_0xf26b('0x2d')],_0x4cd9e8[_0xf26b('0x2b')]);_0x2abee2['attributes']=_[_0xf26b('0x2e')](_0x4cd9e8[_0xf26b('0x2d')],qs['fields'](_0x4b8865['query'][_0xf26b('0x2f')]));_0x2abee2['attributes']=_0x2abee2['attributes']['length']?_0x2abee2[_0xf26b('0x30')]:_0x4cd9e8[_0xf26b('0x2d')];if(!_0x4b8865['query'][_0xf26b('0x31')](_0xf26b('0x32'))){_0x2abee2[_0xf26b('0x19')]=qs['limit'](_0x4b8865[_0xf26b('0x2b')]['limit']);_0x2abee2[_0xf26b('0x18')]=qs['offset'](_0x4b8865[_0xf26b('0x2b')][_0xf26b('0x18')]);}_0x2abee2[_0xf26b('0x33')]=qs[_0xf26b('0x34')](_0x4b8865[_0xf26b('0x2b')][_0xf26b('0x34')]);_0x2abee2[_0xf26b('0x35')]=qs[_0xf26b('0x36')](_[_0xf26b('0x37')](_0x4b8865['query'],_0x4cd9e8[_0xf26b('0x36')]),_0x255fb7);if(_0x4b8865[_0xf26b('0x2b')][_0xf26b('0x38')]){_0x2abee2[_0xf26b('0x35')]=_[_0xf26b('0x39')](_0x2abee2[_0xf26b('0x35')],{'$or':_['map'](_0x255fb7,function(_0x1ce5ce){if(_0x1ce5ce[_0xf26b('0x29')]!==_0xf26b('0x3a')){var _0x4f4378={};_0x4f4378[_0x1ce5ce[_0xf26b('0x24')]]={'$like':'%'+_0x4b8865['query'][_0xf26b('0x38')]+'%'};return _0x4f4378;}})});}_0x2abee2=_[_0xf26b('0x39')]({},_0x2abee2,_0x4b8865[_0xf26b('0x3b')]);var _0x12c4e4={'where':_0x2abee2[_0xf26b('0x35')]};return db[_0xf26b('0x27')][_0xf26b('0x17')](_0x12c4e4)[_0xf26b('0x1e')](function(_0xe5d79b){_0x6ddeb6[_0xf26b('0x17')]=_0xe5d79b;if(_0x4b8865[_0xf26b('0x2b')][_0xf26b('0x3c')]){_0x2abee2[_0xf26b('0x3d')]=[{'all':!![]}];}return db[_0xf26b('0x27')][_0xf26b('0x3e')](_0x2abee2);})[_0xf26b('0x1e')](function(_0x2682f2){_0x6ddeb6[_0xf26b('0x3f')]=_0x2682f2;return _0x6ddeb6;})[_0xf26b('0x1e')](respondWithFilteredResult(_0x61b786,_0x2abee2))[_0xf26b('0x40')](handleError(_0x61b786,null));};exports['show']=function(_0x55fcba,_0x40af02){var _0x16be13={'raw':![],'where':{'id':_0x55fcba[_0xf26b('0x41')]['id']}},_0x575d17={};_0x575d17['model']=_[_0xf26b('0x2c')](db['Schedule'][_0xf26b('0x42')]);_0x575d17[_0xf26b('0x2b')]=_[_0xf26b('0x2c')](_0x55fcba[_0xf26b('0x2b')]);_0x575d17[_0xf26b('0x36')]=_[_0xf26b('0x2e')](_0x575d17[_0xf26b('0x2d')],_0x575d17[_0xf26b('0x2b')]);_0x16be13[_0xf26b('0x30')]=_['intersection'](_0x575d17['model'],qs['fields'](_0x55fcba[_0xf26b('0x2b')][_0xf26b('0x2f')]));_0x16be13[_0xf26b('0x30')]=_0x16be13[_0xf26b('0x30')][_0xf26b('0x43')]?_0x16be13['attributes']:_0x575d17[_0xf26b('0x2d')];if(_0x55fcba[_0xf26b('0x2b')]['includeAll']){_0x16be13[_0xf26b('0x3d')]=[{'all':!![]}];}_0x16be13=_[_0xf26b('0x39')]({},_0x16be13,_0x55fcba[_0xf26b('0x3b')]);return db[_0xf26b('0x27')][_0xf26b('0x44')](_0x16be13)[_0xf26b('0x1e')](handleEntityNotFound(_0x40af02,null))[_0xf26b('0x1e')](respondWithResult(_0x40af02,null))[_0xf26b('0x40')](handleError(_0x40af02,null));};exports[_0xf26b('0x45')]=function(_0x3e2472,_0x579a81){return db[_0xf26b('0x27')][_0xf26b('0x45')](_0x3e2472[_0xf26b('0x46')],{})[_0xf26b('0x1e')](function(_0x10c97c){var _0x263fde=_0x3e2472[_0xf26b('0x47')][_0xf26b('0x20')]({'plain':!![]});if(!_0x263fde)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x263fde[_0xf26b('0x48')]===_0xf26b('0x47')){var _0x3a5d97=_0x10c97c['get']({'plain':!![]});var _0x283273=_0xf26b('0x49');return db[_0xf26b('0x4a')]['find']({'where':{'name':_0x283273,'userProfileId':_0x263fde[_0xf26b('0x4b')]},'raw':!![]})[_0xf26b('0x1e')](function(_0x554e96){if(_0x554e96&&_0x554e96[_0xf26b('0x4c')]===0x0){return db[_0xf26b('0x21')][_0xf26b('0x45')]({'name':_0x3a5d97[_0xf26b('0x24')],'resourceId':_0x3a5d97['id'],'type':_0x554e96['name'],'sectionId':_0x554e96['id']},{})['then'](function(){return _0x10c97c;});}else{return _0x10c97c;}})[_0xf26b('0x40')](function(_0xadc5eb){logger[_0xf26b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xadc5eb);throw _0xadc5eb;});}return _0x10c97c;})[_0xf26b('0x1e')](respondWithResult(_0x579a81,0xc9))[_0xf26b('0x40')](handleError(_0x579a81,null));};exports['update']=function(_0x1ddef9,_0x488a04){if(_0x1ddef9[_0xf26b('0x46')]['id']){delete _0x1ddef9[_0xf26b('0x46')]['id'];}return db[_0xf26b('0x27')][_0xf26b('0x44')]({'where':{'id':_0x1ddef9[_0xf26b('0x41')]['id']}})[_0xf26b('0x1e')](handleEntityNotFound(_0x488a04,null))[_0xf26b('0x1e')](saveUpdates(_0x1ddef9['body'],null))[_0xf26b('0x1e')](respondWithResult(_0x488a04,null))[_0xf26b('0x40')](handleError(_0x488a04,null));};exports[_0xf26b('0x1f')]=function(_0x2cfcce,_0xa488f3){return db[_0xf26b('0x27')][_0xf26b('0x44')]({'where':{'id':_0x2cfcce[_0xf26b('0x41')]['id']}})[_0xf26b('0x1e')](handleEntityNotFound(_0xa488f3,null))['then'](removeEntity(_0xa488f3,null))['catch'](handleError(_0xa488f3,null));};exports[_0xf26b('0x4d')]=function(_0x10f225,_0x3b0e29,_0x1fa75b){var _0xbe7c85=require(_0xf26b('0x4e'));return db[_0xf26b('0x27')][_0xf26b('0x44')]({'where':{'id':_0x10f225[_0xf26b('0x41')]['id']},'raw':!![]})[_0xf26b('0x1e')](handleEntityNotFound(_0x3b0e29,null))[_0xf26b('0x1e')](function(){_0xbe7c85[_0xf26b('0x4d')](_0x10f225[_0xf26b('0x41')]['id']);})[_0xf26b('0x1e')](respondWithStatusCode(_0x3b0e29,null))[_0xf26b('0x40')](handleError(_0x3b0e29,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index be02691..80b2bcf 100644 --- a/server/api/schedule/schedule.model.js +++ b/server/api/schedule/schedule.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbabb=['define','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x19b019,_0x567503){var _0x231668=function(_0x105579){while(--_0x105579){_0x19b019['push'](_0x19b019['shift']());}};_0x231668(++_0x567503);}(_0xbabb,0x8d));var _0xbbab=function(_0x3205e4,_0x174b99){_0x3205e4=_0x3205e4-0x0;var _0x461ba8=_0xbabb[_0x3205e4];return _0x461ba8;};'use strict';var _=require(_0xbbab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbbab('0x1'));var moment=require(_0xbbab('0x2'));var BPromise=require(_0xbbab('0x3'));var rp=require(_0xbbab('0x4'));var fs=require('fs');var path=require(_0xbbab('0x5'));var rimraf=require(_0xbbab('0x6'));var config=require(_0xbbab('0x7'));var attributes=require(_0xbbab('0x8'));module['exports']=function(_0x266968,_0x16a65b){return _0x266968[_0xbbab('0x9')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa589=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','tools_schedules'];(function(_0x4b80eb,_0x392b29){var _0x42ec95=function(_0x36d2ea){while(--_0x36d2ea){_0x4b80eb['push'](_0x4b80eb['shift']());}};_0x42ec95(++_0x392b29);}(_0xa589,0xe1));var _0x9a58=function(_0x3cec7e,_0x9decf5){_0x3cec7e=_0x3cec7e-0x0;var _0xdb488d=_0xa589[_0x3cec7e];return _0xdb488d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9a58('0x0'));var moment=require(_0x9a58('0x1'));var BPromise=require(_0x9a58('0x2'));var rp=require(_0x9a58('0x3'));var fs=require('fs');var path=require(_0x9a58('0x4'));var rimraf=require(_0x9a58('0x5'));var config=require(_0x9a58('0x6'));var attributes=require('./schedule.attributes');module[_0x9a58('0x7')]=function(_0x216637,_0xa62ab7){return _0x216637['define']('Schedule',attributes,{'tableName':_0x9a58('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 14a114c..48d39f5 100644 --- a/server/api/schedule/schedule.rpc.js +++ b/server/api/schedule/schedule.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9499=['../../config/utils','../../config/logger','client','http','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x9499,0x183));var _0x9949=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9499[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x9949('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9949('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9949('0x2'));var db=require(_0x9949('0x3'))['db'];var utils=require(_0x9949('0x4'));var logger=require(_0x9949('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9949('0x6')][_0x9949('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f8091,_0x399b41,_0x20c563){return new BPromise(function(_0x1042d3,_0x59267a){return client['request'](_0x1f8091,_0x20c563)['then'](function(_0xbb5e40){logger[_0x9949('0x8')](_0x9949('0x9'),_0x399b41,_0x9949('0xa'));logger['debug'](_0x9949('0xb'),_0x399b41,_0x9949('0xa'),JSON[_0x9949('0xc')](_0xbb5e40));if(_0xbb5e40[_0x9949('0xd')]){if(_0xbb5e40[_0x9949('0xd')]['code']===0x1f4){logger[_0x9949('0xd')]('Schedule,\x20%s,\x20%s',_0x399b41,_0xbb5e40['error'][_0x9949('0xe')]);return _0x59267a(_0xbb5e40['error'][_0x9949('0xe')]);}logger['error'](_0x9949('0x9'),_0x399b41,_0xbb5e40[_0x9949('0xd')][_0x9949('0xe')]);return _0x1042d3(_0xbb5e40['error'][_0x9949('0xe')]);}else{logger[_0x9949('0x8')](_0x9949('0x9'),_0x399b41,_0x9949('0xa'));_0x1042d3(_0xbb5e40[_0x9949('0xf')]['message']);}})[_0x9949('0x10')](function(_0xece370){logger[_0x9949('0xd')](_0x9949('0x9'),_0x399b41,_0xece370);_0x59267a(_0xece370);});});} \ No newline at end of file +var _0x307c=['catch','lodash','moment','../../mysqldb','../../config/environment','request','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x307c,0x1a1));var _0xc307=function(_0x87e53f,_0x37a3b9){_0x87e53f=_0x87e53f-0x0;var _0x5177ac=_0x307c[_0x87e53f];return _0x5177ac;};'use strict';var _=require(_0xc307('0x0'));var util=require('util');var moment=require(_0xc307('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc307('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc307('0x3'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bee40,_0x24269d,_0x3e48a2){return new BPromise(function(_0x32ac4,_0x370e49){return client[_0xc307('0x4')](_0x5bee40,_0x3e48a2)['then'](function(_0x3b6190){logger['info'](_0xc307('0x5'),_0x24269d,_0xc307('0x6'));logger['debug'](_0xc307('0x7'),_0x24269d,_0xc307('0x6'),JSON['stringify'](_0x3b6190));if(_0x3b6190[_0xc307('0x8')]){if(_0x3b6190[_0xc307('0x8')][_0xc307('0x9')]===0x1f4){logger[_0xc307('0x8')](_0xc307('0x5'),_0x24269d,_0x3b6190['error']['message']);return _0x370e49(_0x3b6190['error'][_0xc307('0xa')]);}logger[_0xc307('0x8')](_0xc307('0x5'),_0x24269d,_0x3b6190[_0xc307('0x8')][_0xc307('0xa')]);return _0x32ac4(_0x3b6190['error'][_0xc307('0xa')]);}else{logger['info'](_0xc307('0x5'),_0x24269d,_0xc307('0x6'));_0x32ac4(_0x3b6190[_0xc307('0xb')]['message']);}})[_0xc307('0xc')](function(_0x216568){logger[_0xc307('0x8')](_0xc307('0x5'),_0x24269d,_0x216568);_0x370e49(_0x216568);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index af39e81..fe51870 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb602=['/:id','show','/:id/download','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5062b9,_0x5cfda2){var _0x1aedd2=function(_0x42aebb){while(--_0x42aebb){_0x5062b9['push'](_0x5062b9['shift']());}};_0x1aedd2(++_0x5cfda2);}(_0xb602,0x17f));var _0x2b60=function(_0x316a88,_0x451333){_0x316a88=_0x316a88-0x0;var _0x2d35b1=_0xb602[_0x316a88];return _0x2d35b1;};'use strict';var multer=require(_0x2b60('0x0'));var util=require(_0x2b60('0x1'));var path=require(_0x2b60('0x2'));var timeout=require(_0x2b60('0x3'));var express=require(_0x2b60('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2b60('0x5'));var config=require(_0x2b60('0x6'));var controller=require(_0x2b60('0x7'));router[_0x2b60('0x8')]('/',auth[_0x2b60('0x9')](),controller[_0x2b60('0xa')]);router[_0x2b60('0x8')](_0x2b60('0xb'),auth['isAuthenticated'](),controller[_0x2b60('0xc')]);router[_0x2b60('0x8')](_0x2b60('0xd'),auth[_0x2b60('0x9')](),controller[_0x2b60('0xe')]);router[_0x2b60('0x8')](_0x2b60('0xf'),auth[_0x2b60('0x9')](),controller['download']);router[_0x2b60('0x10')]('/',auth[_0x2b60('0x9')](),controller[_0x2b60('0x11')]);router[_0x2b60('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2b60('0x13')]);router['delete']('/:id',auth[_0x2b60('0x9')](),controller[_0x2b60('0x14')]);module[_0x2b60('0x15')]=router; \ No newline at end of file +var _0xf75e=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x24ba52,_0x572ede){var _0x5b6197=function(_0x4641bf){while(--_0x4641bf){_0x24ba52['push'](_0x24ba52['shift']());}};_0x5b6197(++_0x572ede);}(_0xf75e,0x11d));var _0xef75=function(_0x3cf519,_0x205bb4){_0x3cf519=_0x3cf519-0x0;var _0x30c5ae=_0xf75e[_0x3cf519];return _0x30c5ae;};'use strict';var multer=require(_0xef75('0x0'));var util=require(_0xef75('0x1'));var path=require(_0xef75('0x2'));var timeout=require(_0xef75('0x3'));var express=require('express');var router=express[_0xef75('0x4')]();var auth=require(_0xef75('0x5'));var interaction=require(_0xef75('0x6'));var config=require(_0xef75('0x7'));var controller=require('./screenRecording.controller');router[_0xef75('0x8')]('/',auth[_0xef75('0x9')](),controller[_0xef75('0xa')]);router[_0xef75('0x8')](_0xef75('0xb'),auth['isAuthenticated'](),controller[_0xef75('0xc')]);router[_0xef75('0x8')](_0xef75('0xd'),auth[_0xef75('0x9')](),controller[_0xef75('0xe')]);router[_0xef75('0x8')](_0xef75('0xf'),auth[_0xef75('0x9')](),controller[_0xef75('0x10')]);router[_0xef75('0x11')]('/',auth['isAuthenticated'](),controller[_0xef75('0x12')]);router[_0xef75('0x13')](_0xef75('0xd'),auth[_0xef75('0x9')](),controller[_0xef75('0x14')]);router[_0xef75('0x15')]('/:id',auth[_0xef75('0x9')](),controller[_0xef75('0x16')]);module[_0xef75('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 2374272..fcf7c9f 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb458=['STRING','replace','setDataValue','INTEGER','startedAt','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','toString','createdAt','updatedAt','sequelize','moment','path','VIRTUAL','getDataValue','value','extname'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xb458,0x103));var _0x8b45=function(_0x45e725,_0x452382){_0x45e725=_0x45e725-0x0;var _0x1346a1=_0xb458[_0x45e725];return _0x1346a1;};'use strict';var Sequelize=require(_0x8b45('0x0'));var moment=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){return this[_0x8b45('0x4')](_0x8b45('0x5'))?path[_0x8b45('0x6')](this['getDataValue'](_0x8b45('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x8b45('0x7')],'set':function(_0x12bd05){var _0x2daa9a=_0x12bd05[_0x8b45('0x8')](/\\/g,'/');this[_0x8b45('0x9')]('value',_0x2daa9a);}},'rating':{'type':Sequelize[_0x8b45('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8b45('0xa')],'set':function(_0x33f30e){this[_0x8b45('0x9')](_0x8b45('0xb'),moment()['subtract'](_0x33f30e,'ms'));this[_0x8b45('0x9')](_0x8b45('0xc'),moment());this['setDataValue']('duration',_0x33f30e);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8b45('0xb')))[_0x8b45('0xd')](_0x8b45('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x8b45('0xf')],'get':function(){return moment(this[_0x8b45('0x4')](_0x8b45('0xc')))[_0x8b45('0xd')](_0x8b45('0xe'))[_0x8b45('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8b45('0x11')))[_0x8b45('0xd')](_0x8b45('0xe'))[_0x8b45('0x10')]();}},'updatedAt':{'type':Sequelize[_0x8b45('0xf')],'get':function(){return moment(this[_0x8b45('0x4')](_0x8b45('0x12')))[_0x8b45('0xd')](_0x8b45('0xe'))[_0x8b45('0x10')]();}}}; \ No newline at end of file +var _0x2bd8=['sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','DATE','format','toString','MM-DD-YYYY\x20HH:mm','updatedAt'];(function(_0x470223,_0x401b00){var _0x2fde5a=function(_0x46fc84){while(--_0x46fc84){_0x470223['push'](_0x470223['shift']());}};_0x2fde5a(++_0x401b00);}(_0x2bd8,0x130));var _0x82bd=function(_0x46fe32,_0x58700f){_0x46fe32=_0x46fe32-0x0;var _0x5195ce=_0x2bd8[_0x46fe32];return _0x5195ce;};'use strict';var Sequelize=require(_0x82bd('0x0'));var moment=require('moment');var path=require(_0x82bd('0x1'));var config=require(_0x82bd('0x2'));module[_0x82bd('0x3')]={'format':{'type':Sequelize[_0x82bd('0x4')],'get':function(){return this[_0x82bd('0x5')](_0x82bd('0x6'))?path[_0x82bd('0x7')](this['getDataValue'](_0x82bd('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x82bd('0x8')]},'channel':{'type':Sequelize[_0x82bd('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x19dbb1){var _0x77d7a9=_0x19dbb1[_0x82bd('0x9')](/\\/g,'/');this[_0x82bd('0xa')]('value',_0x77d7a9);}},'rating':{'type':Sequelize[_0x82bd('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4a9b2c){this['setDataValue'](_0x82bd('0xc'),moment()['subtract'](_0x4a9b2c,'ms'));this['setDataValue'](_0x82bd('0xd'),moment());this['setDataValue']('duration',_0x4a9b2c);}},'startedAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')]('startedAt'))[_0x82bd('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x82bd('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x82bd('0x5')](_0x82bd('0xd')))[_0x82bd('0xf')](_0x82bd('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')]('createdAt'))[_0x82bd('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x82bd('0x10')]();}},'updatedAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')](_0x82bd('0x12')))[_0x82bd('0xf')](_0x82bd('0x11'))[_0x82bd('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 41194ce..ccebe62 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2316=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','duration','createdAt','describe','download','uniqueid','join','root','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','message','Not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','request-promise'];(function(_0x4a7463,_0x346dab){var _0x3b489f=function(_0x48e39d){while(--_0x48e39d){_0x4a7463['push'](_0x4a7463['shift']());}};_0x3b489f(++_0x346dab);}(_0x2316,0xc4));var _0x6231=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x2316[_0x33bc64];return _0x3fdd34;};'use strict';var pdf=require(_0x6231('0x0'));var emlformat=require(_0x6231('0x1'));var rimraf=require(_0x6231('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6231('0x3'));var moment=require(_0x6231('0x4'));var BPromise=require(_0x6231('0x5'));var Mustache=require(_0x6231('0x6'));var util=require('util');var path=require(_0x6231('0x7'));var sox=require(_0x6231('0x8'));var csv=require(_0x6231('0x9'));var ejs=require(_0x6231('0xa'));var fs=require('fs');var _=require(_0x6231('0xb'));var squel=require(_0x6231('0xc'));var crypto=require(_0x6231('0xd'));var jsforce=require(_0x6231('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6231('0x9'));var querystring=require(_0x6231('0xf'));var Papa=require(_0x6231('0x10'));var Redis=require('ioredis');var authService=require(_0x6231('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6231('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6231('0x13'))('api');var utils=require(_0x6231('0x14'));var config=require(_0x6231('0x15'));var licenseUtil=require(_0x6231('0x16'));var db=require(_0x6231('0x17'))['db'];function respondWithStatusCode(_0x3dafec,_0x1da0ed){_0x1da0ed=_0x1da0ed||0xcc;return function(_0x689ace){if(_0x689ace){return _0x3dafec[_0x6231('0x18')](_0x1da0ed);}return _0x3dafec[_0x6231('0x19')](_0x1da0ed)[_0x6231('0x1a')]();};}function respondWithResult(_0xa3e10c,_0x255891){_0x255891=_0x255891||0xc8;return function(_0x41b709){if(_0x41b709){return _0xa3e10c[_0x6231('0x19')](_0x255891)['json'](_0x41b709);}};}function respondWithFilteredResult(_0x44e930,_0x25a1e7){return function(_0x43b106){if(_0x43b106){var _0x483618=_0x43b106[_0x6231('0x1b')],_0x5a4d30=_0x25a1e7[_0x6231('0x1c')],_0x5e63cd=_0x25a1e7[_0x6231('0x1c')]+_0x25a1e7[_0x6231('0x1d')],_0x196ac7;if(_0x5e63cd>=_0x483618){_0x5e63cd=_0x483618;_0x196ac7=0xc8;}else{_0x196ac7=0xce;}_0x44e930[_0x6231('0x19')](_0x196ac7);return _0x44e930['set'](_0x6231('0x1e'),_0x5a4d30+'-'+_0x5e63cd+'/'+_0x483618)[_0x6231('0x1f')](_0x43b106);}return null;};}function patchUpdates(_0x97ad59){return function(_0x1bd5c6){try{jsonpatch[_0x6231('0x20')](_0x1bd5c6,_0x97ad59,!![]);}catch(_0x1f7775){return BPromise[_0x6231('0x21')](_0x1f7775);}return _0x1bd5c6[_0x6231('0x22')]();};}function saveUpdates(_0x51cff2,_0x1be038){return function(_0x221075){if(_0x221075){return _0x221075[_0x6231('0x23')](_0x51cff2)[_0x6231('0x24')](function(_0x214662){return _0x214662;});}return null;};}function removeEntity(_0x5f2879,_0x2ef8b7){return function(_0x26bfac){if(_0x26bfac){return _0x26bfac[_0x6231('0x25')]()['then'](function(){_0x5f2879['status'](0xcc)[_0x6231('0x1a')]();});}};}function handleEntityNotFound(_0x5f4e6a,_0x24f4bb){return function(_0x541d66){if(!_0x541d66){_0x5f4e6a[_0x6231('0x18')](0x194);}return _0x541d66;};}function handleError(_0x5b987d,_0x5a537d){_0x5a537d=_0x5a537d||0x1f4;return function(_0x483248){logger['error'](_0x483248['stack']);if(_0x483248['name']){delete _0x483248[_0x6231('0x26')];}_0x5b987d[_0x6231('0x19')](_0x5a537d)[_0x6231('0x27')](_0x483248);};}exports[_0x6231('0x28')]=function(_0x5c1ff4,_0x410473){var _0x56e887={},_0x78ce1c={},_0x2ea615={'count':0x0,'rows':[]};var _0x20f6df=_[_0x6231('0x29')](db[_0x6231('0x2a')][_0x6231('0x2b')],function(_0x1ff0c5){return{'name':_0x1ff0c5['fieldName'],'type':_0x1ff0c5[_0x6231('0x2c')][_0x6231('0x2d')]};});_0x78ce1c[_0x6231('0x2e')]=_[_0x6231('0x2f')](_[_0x6231('0x29')](_0x20f6df,'name'),[_0x6231('0x30')]);_0x78ce1c[_0x6231('0x31')]=_[_0x6231('0x32')](_0x5c1ff4['query']);_0x78ce1c['filters']=_['intersection'](_0x78ce1c[_0x6231('0x2e')],_0x78ce1c['query']);_0x56e887['attributes']=_[_0x6231('0x33')](_0x78ce1c[_0x6231('0x2e')],qs[_0x6231('0x34')](_0x5c1ff4['query'][_0x6231('0x34')]));_0x56e887[_0x6231('0x35')]=_0x56e887[_0x6231('0x35')][_0x6231('0x36')]?_0x56e887[_0x6231('0x35')]:_0x78ce1c[_0x6231('0x2e')];if(!_0x5c1ff4['query']['hasOwnProperty'](_0x6231('0x37'))){_0x56e887['limit']=qs[_0x6231('0x1d')](_0x5c1ff4[_0x6231('0x31')][_0x6231('0x1d')]);_0x56e887[_0x6231('0x1c')]=qs[_0x6231('0x1c')](_0x5c1ff4['query']['offset']);}_0x56e887[_0x6231('0x38')]=qs[_0x6231('0x39')](_0x5c1ff4[_0x6231('0x31')][_0x6231('0x39')]);_0x56e887[_0x6231('0x3a')]=qs[_0x6231('0x3b')](_[_0x6231('0x3c')](_0x5c1ff4[_0x6231('0x31')],_0x78ce1c['filters']),_0x20f6df);if(_0x5c1ff4[_0x6231('0x31')][_0x6231('0x3d')]){_0x56e887['where']=_[_0x6231('0x3e')](_0x56e887[_0x6231('0x3a')],{'$or':_[_0x6231('0x29')](_0x20f6df,function(_0x1fd1ff){if(_0x1fd1ff[_0x6231('0x2c')]!=='VIRTUAL'){var _0x2cc242={};_0x2cc242[_0x1fd1ff['name']]={'$like':'%'+_0x5c1ff4[_0x6231('0x31')]['filter']+'%'};return _0x2cc242;}})});}_0x56e887=_[_0x6231('0x3e')]({},_0x56e887,_0x5c1ff4['options']);var _0x2b1ada={'where':_0x56e887['where']};return db[_0x6231('0x2a')]['count'](_0x2b1ada)[_0x6231('0x24')](function(_0x10748a){_0x2ea615['count']=_0x10748a;if(_0x5c1ff4[_0x6231('0x31')][_0x6231('0x3f')]){_0x56e887[_0x6231('0x40')]=[{'all':!![]}];}return db[_0x6231('0x2a')][_0x6231('0x41')](_0x56e887);})[_0x6231('0x24')](function(_0x31206e){_0x2ea615[_0x6231('0x42')]=_0x31206e;return _0x2ea615;})['then'](respondWithFilteredResult(_0x410473,_0x56e887))[_0x6231('0x43')](handleError(_0x410473,null));};exports[_0x6231('0x44')]=function(_0x734f4b,_0x216865){var _0x498842={'raw':![],'where':{'id':_0x734f4b[_0x6231('0x45')]['id']}},_0x133802={};_0x133802[_0x6231('0x2e')]=_[_0x6231('0x32')](db['ScreenRecording'][_0x6231('0x2b')]);_0x133802[_0x6231('0x31')]=_[_0x6231('0x32')](_0x734f4b['query']);_0x133802[_0x6231('0x3b')]=_[_0x6231('0x33')](_0x133802[_0x6231('0x2e')],_0x133802[_0x6231('0x31')]);_0x498842['attributes']=_[_0x6231('0x33')](_0x133802['model'],qs['fields'](_0x734f4b[_0x6231('0x31')][_0x6231('0x34')]));_0x498842[_0x6231('0x35')]=_0x498842[_0x6231('0x35')]['length']?_0x498842[_0x6231('0x35')]:_0x133802[_0x6231('0x2e')];if(_0x734f4b[_0x6231('0x31')]['includeAll']){_0x498842[_0x6231('0x40')]=[{'all':!![]}];}_0x498842=_[_0x6231('0x3e')]({},_0x498842,_0x734f4b[_0x6231('0x46')]);return db[_0x6231('0x2a')][_0x6231('0x47')](_0x498842)[_0x6231('0x24')](handleEntityNotFound(_0x216865,null))[_0x6231('0x24')](respondWithResult(_0x216865,null))[_0x6231('0x43')](handleError(_0x216865,null));};exports[_0x6231('0x48')]=function(_0xa3ff42,_0x50416d){return db[_0x6231('0x2a')]['create'](_0xa3ff42[_0x6231('0x49')],{})['then'](respondWithResult(_0x50416d,0xc9))[_0x6231('0x43')](handleError(_0x50416d,null));};exports[_0x6231('0x23')]=function(_0x85c7d5,_0x3f5cd3){if(_0x85c7d5[_0x6231('0x49')]['id']){delete _0x85c7d5[_0x6231('0x49')]['id'];}delete _0x85c7d5[_0x6231('0x49')][_0x6231('0x4a')];delete _0x85c7d5['body'][_0x6231('0x4b')];delete _0x85c7d5[_0x6231('0x49')]['closedAt'];delete _0x85c7d5[_0x6231('0x49')]['value'];return db[_0x6231('0x2a')][_0x6231('0x47')]({'where':{'id':_0x85c7d5[_0x6231('0x45')]['id']}})[_0x6231('0x24')](handleEntityNotFound(_0x3f5cd3,null))[_0x6231('0x24')](saveUpdates(_0x85c7d5[_0x6231('0x49')],null))[_0x6231('0x24')](respondWithResult(_0x3f5cd3,null))[_0x6231('0x43')](handleError(_0x3f5cd3,null));};exports[_0x6231('0x4c')]=function(_0x235a49,_0x41cd06){return db[_0x6231('0x2a')][_0x6231('0x4c')]()[_0x6231('0x24')](respondWithResult(_0x41cd06,null))['catch'](handleError(_0x41cd06,null));};exports[_0x6231('0x4d')]=function(_0x166fd0,_0x3ebfc4,_0x379a96){var _0x3d0f9d=require('../../components/encryptor');var _0x598114=![];var _0x4bd881={};if(_0x166fd0[_0x6231('0x31')][_0x6231('0x2c')]&&_0x166fd0['query'][_0x6231('0x2c')]===_0x6231('0x4e')){_0x4bd881[_0x6231('0x4e')]=_0x166fd0['params']['id'];}else{_0x4bd881['id']=_0x166fd0['params']['id'];}return db[_0x6231('0x2a')][_0x6231('0x47')]({'where':_0x4bd881,'attributes':['id','value'],'raw':!![]})[_0x6231('0x24')](handleEntityNotFound(_0x3ebfc4,null))['then'](function(_0x2f0814){if(_0x2f0814){var _0x5cba8f=path[_0x6231('0x4f')](config[_0x6231('0x50')],_0x6231('0x51'),_0x2f0814[_0x6231('0x52')]);var _0x34100c=util[_0x6231('0x30')](_0x6231('0x53'),_0x5cba8f);if(fs[_0x6231('0x54')](_0x34100c)){_0x598114=!![];return _0x3d0f9d[_0x6231('0x55')](_0x34100c,_0x5cba8f,config[_0x6231('0x56')][_0x6231('0x57')])['then'](function(){return _0x2f0814;});}return _0x2f0814;}})['then'](function(_0x47eb8e){if(_0x47eb8e){var _0x5ef525=path[_0x6231('0x4f')](config['root'],_0x6231('0x51'),_0x47eb8e[_0x6231('0x52')]);if(!fs[_0x6231('0x54')](_0x5ef525)){throw new db[(_0x6231('0x58'))][(_0x6231('0x59'))](_0x6231('0x5a'));}if(_0x47eb8e[_0x6231('0x5b')]){return _0x3ebfc4['download'](_0x5ef525,_0x47eb8e[_0x6231('0x5b')]+path[_0x6231('0x5c')](_0x5ef525),function(){if(_0x598114){fs['unlink'](_0x5ef525);}});}else{return _0x3ebfc4[_0x6231('0x4d')](_0x5ef525,function(_0x1b112e){if(_0x598114){fs['unlink'](_0x5ef525);}});}}})[_0x6231('0x43')](function(_0x4f16f5){if(_0x4f16f5[_0x6231('0x5d')]===_0x6231('0x5a')){_0x3ebfc4[_0x6231('0x19')](0x194)[_0x6231('0x27')](_0x6231('0x5e'));}else{return handleError(_0x3ebfc4,null);}});};exports[_0x6231('0x25')]=function(_0x509430,_0x2121cf){return db[_0x6231('0x2a')][_0x6231('0x47')]({'where':{'id':_0x509430[_0x6231('0x45')]['id']}})[_0x6231('0x24')](function(_0x1828ce){if(!_0x1828ce)throw new ReferenceError('Entity\x20not\x20found');return _0x1828ce;})[_0x6231('0x24')](function(_0x3b7d94){var _0x409aa6=path[_0x6231('0x4f')](config[_0x6231('0x50')],_0x6231('0x51'),_0x3b7d94[_0x6231('0x52')]);logger[_0x6231('0x5f')]('cancellazione\x20fisica\x20documento\x20%s',_0x409aa6);if(!_[_0x6231('0x60')](_0x3b7d94[_0x6231('0x52')])&&fs[_0x6231('0x54')](_0x409aa6)){logger[_0x6231('0x5f')](_0x6231('0x61')+_0x409aa6+_0x6231('0x62'));fs[_0x6231('0x63')](_0x409aa6);}_0x409aa6=_0x409aa6+'.cypher';if(!_[_0x6231('0x60')](_0x3b7d94[_0x6231('0x52')])&&fs['existsSync'](_0x409aa6)){logger[_0x6231('0x5f')]('File:\x20\x22'+_0x409aa6+_0x6231('0x62'));fs[_0x6231('0x63')](_0x409aa6);}return _0x3b7d94;})[_0x6231('0x24')](function(_0x207640){if(!_0x207640)throw new InternalError();return _0x207640['destroy']();})[_0x6231('0x24')](function(){_0x2121cf[_0x6231('0x19')](0xcc)[_0x6231('0x1a')]();})[_0x6231('0x43')](handleError(_0x2121cf,null));}; \ No newline at end of file +var _0x93dc=['util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x93dc,0xc8));var _0xc93d=function(_0x3a3853,_0x336839){_0x3a3853=_0x3a3853-0x0;var _0x112a71=_0x93dc[_0x3a3853];return _0x112a71;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc93d('0x0'));var rimraf=require(_0xc93d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc93d('0x2'));var moment=require(_0xc93d('0x3'));var BPromise=require(_0xc93d('0x4'));var Mustache=require(_0xc93d('0x5'));var util=require(_0xc93d('0x6'));var path=require('path');var sox=require(_0xc93d('0x7'));var csv=require(_0xc93d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc93d('0x9'));var crypto=require(_0xc93d('0xa'));var jsforce=require(_0xc93d('0xb'));var deskjs=require(_0xc93d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc93d('0xd'));var Papa=require('papaparse');var Redis=require(_0xc93d('0xe'));var authService=require(_0xc93d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc93d('0x10'));var logger=require(_0xc93d('0x11'))(_0xc93d('0x12'));var utils=require(_0xc93d('0x13'));var config=require(_0xc93d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc93d('0x15'))['db'];function respondWithStatusCode(_0x47a8db,_0x2d3ef3){_0x2d3ef3=_0x2d3ef3||0xcc;return function(_0x3e42fa){if(_0x3e42fa){return _0x47a8db[_0xc93d('0x16')](_0x2d3ef3);}return _0x47a8db['status'](_0x2d3ef3)[_0xc93d('0x17')]();};}function respondWithResult(_0x3d7714,_0x2feaac){_0x2feaac=_0x2feaac||0xc8;return function(_0x52dd21){if(_0x52dd21){return _0x3d7714[_0xc93d('0x18')](_0x2feaac)[_0xc93d('0x19')](_0x52dd21);}};}function respondWithFilteredResult(_0x5424e2,_0x2f18bc){return function(_0x3794c1){if(_0x3794c1){var _0x46a227=_0x3794c1[_0xc93d('0x1a')],_0x539995=_0x2f18bc[_0xc93d('0x1b')],_0x38bbdb=_0x2f18bc['offset']+_0x2f18bc['limit'],_0x1eecfe;if(_0x38bbdb>=_0x46a227){_0x38bbdb=_0x46a227;_0x1eecfe=0xc8;}else{_0x1eecfe=0xce;}_0x5424e2[_0xc93d('0x18')](_0x1eecfe);return _0x5424e2[_0xc93d('0x1c')](_0xc93d('0x1d'),_0x539995+'-'+_0x38bbdb+'/'+_0x46a227)[_0xc93d('0x19')](_0x3794c1);}return null;};}function patchUpdates(_0x33a923){return function(_0x441dce){try{jsonpatch[_0xc93d('0x1e')](_0x441dce,_0x33a923,!![]);}catch(_0x46ff2b){return BPromise[_0xc93d('0x1f')](_0x46ff2b);}return _0x441dce['save']();};}function saveUpdates(_0x516586,_0x45f591){return function(_0x2e0927){if(_0x2e0927){return _0x2e0927[_0xc93d('0x20')](_0x516586)['then'](function(_0xde6340){return _0xde6340;});}return null;};}function removeEntity(_0x546c21,_0x119eb5){return function(_0x59654d){if(_0x59654d){return _0x59654d[_0xc93d('0x21')]()[_0xc93d('0x22')](function(){_0x546c21[_0xc93d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x414346,_0x21c1e8){return function(_0x500a99){if(!_0x500a99){_0x414346[_0xc93d('0x16')](0x194);}return _0x500a99;};}function handleError(_0x241281,_0x4e3d2e){_0x4e3d2e=_0x4e3d2e||0x1f4;return function(_0x104333){logger[_0xc93d('0x23')](_0x104333[_0xc93d('0x24')]);if(_0x104333[_0xc93d('0x25')]){delete _0x104333[_0xc93d('0x25')];}_0x241281[_0xc93d('0x18')](_0x4e3d2e)['send'](_0x104333);};}exports[_0xc93d('0x26')]=function(_0xe2caa7,_0x1535db){var _0xe48a87={},_0x51da1c={},_0x2485d1={'count':0x0,'rows':[]};var _0x527ff2=_['map'](db[_0xc93d('0x27')][_0xc93d('0x28')],function(_0x5cf6ce){return{'name':_0x5cf6ce['fieldName'],'type':_0x5cf6ce['type'][_0xc93d('0x29')]};});_0x51da1c[_0xc93d('0x2a')]=_[_0xc93d('0x2b')](_[_0xc93d('0x2c')](_0x527ff2,_0xc93d('0x25')),[_0xc93d('0x2d')]);_0x51da1c[_0xc93d('0x2e')]=_['keys'](_0xe2caa7[_0xc93d('0x2e')]);_0x51da1c[_0xc93d('0x2f')]=_[_0xc93d('0x30')](_0x51da1c[_0xc93d('0x2a')],_0x51da1c[_0xc93d('0x2e')]);_0xe48a87[_0xc93d('0x31')]=_[_0xc93d('0x30')](_0x51da1c[_0xc93d('0x2a')],qs['fields'](_0xe2caa7['query'][_0xc93d('0x32')]));_0xe48a87['attributes']=_0xe48a87[_0xc93d('0x31')][_0xc93d('0x33')]?_0xe48a87[_0xc93d('0x31')]:_0x51da1c[_0xc93d('0x2a')];if(!_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x34')](_0xc93d('0x35'))){_0xe48a87[_0xc93d('0x36')]=qs[_0xc93d('0x36')](_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x36')]);_0xe48a87[_0xc93d('0x1b')]=qs[_0xc93d('0x1b')](_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x1b')]);}_0xe48a87[_0xc93d('0x37')]=qs[_0xc93d('0x38')](_0xe2caa7[_0xc93d('0x2e')]['sort']);_0xe48a87[_0xc93d('0x39')]=qs[_0xc93d('0x2f')](_['pick'](_0xe2caa7[_0xc93d('0x2e')],_0x51da1c[_0xc93d('0x2f')]),_0x527ff2);if(_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x3a')]){_0xe48a87['where']=_[_0xc93d('0x3b')](_0xe48a87[_0xc93d('0x39')],{'$or':_['map'](_0x527ff2,function(_0x4af415){if(_0x4af415[_0xc93d('0x3c')]!==_0xc93d('0x3d')){var _0x7e8ba0={};_0x7e8ba0[_0x4af415[_0xc93d('0x25')]]={'$like':'%'+_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x3a')]+'%'};return _0x7e8ba0;}})});}_0xe48a87=_[_0xc93d('0x3b')]({},_0xe48a87,_0xe2caa7[_0xc93d('0x3e')]);var _0x130c63={'where':_0xe48a87[_0xc93d('0x39')]};return db[_0xc93d('0x27')][_0xc93d('0x1a')](_0x130c63)[_0xc93d('0x22')](function(_0x2ca403){_0x2485d1[_0xc93d('0x1a')]=_0x2ca403;if(_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x3f')]){_0xe48a87[_0xc93d('0x40')]=[{'all':!![]}];}return db[_0xc93d('0x27')][_0xc93d('0x41')](_0xe48a87);})[_0xc93d('0x22')](function(_0x4ba60a){_0x2485d1['rows']=_0x4ba60a;return _0x2485d1;})[_0xc93d('0x22')](respondWithFilteredResult(_0x1535db,_0xe48a87))[_0xc93d('0x42')](handleError(_0x1535db,null));};exports[_0xc93d('0x43')]=function(_0x3c0cc2,_0x6966f5){var _0xec2d7c={'raw':![],'where':{'id':_0x3c0cc2[_0xc93d('0x44')]['id']}},_0x390f01={};_0x390f01[_0xc93d('0x2a')]=_[_0xc93d('0x45')](db[_0xc93d('0x27')][_0xc93d('0x28')]);_0x390f01[_0xc93d('0x2e')]=_[_0xc93d('0x45')](_0x3c0cc2[_0xc93d('0x2e')]);_0x390f01[_0xc93d('0x2f')]=_[_0xc93d('0x30')](_0x390f01[_0xc93d('0x2a')],_0x390f01['query']);_0xec2d7c[_0xc93d('0x31')]=_['intersection'](_0x390f01[_0xc93d('0x2a')],qs[_0xc93d('0x32')](_0x3c0cc2[_0xc93d('0x2e')]['fields']));_0xec2d7c[_0xc93d('0x31')]=_0xec2d7c[_0xc93d('0x31')][_0xc93d('0x33')]?_0xec2d7c['attributes']:_0x390f01[_0xc93d('0x2a')];if(_0x3c0cc2[_0xc93d('0x2e')]['includeAll']){_0xec2d7c[_0xc93d('0x40')]=[{'all':!![]}];}_0xec2d7c=_[_0xc93d('0x3b')]({},_0xec2d7c,_0x3c0cc2[_0xc93d('0x3e')]);return db[_0xc93d('0x27')][_0xc93d('0x46')](_0xec2d7c)[_0xc93d('0x22')](handleEntityNotFound(_0x6966f5,null))[_0xc93d('0x22')](respondWithResult(_0x6966f5,null))[_0xc93d('0x42')](handleError(_0x6966f5,null));};exports[_0xc93d('0x47')]=function(_0x357266,_0x42bed2){return db['ScreenRecording'][_0xc93d('0x47')](_0x357266[_0xc93d('0x48')],{})['then'](respondWithResult(_0x42bed2,0xc9))[_0xc93d('0x42')](handleError(_0x42bed2,null));};exports[_0xc93d('0x20')]=function(_0x2f441b,_0x3094bd){if(_0x2f441b[_0xc93d('0x48')]['id']){delete _0x2f441b[_0xc93d('0x48')]['id'];}delete _0x2f441b['body'][_0xc93d('0x49')];delete _0x2f441b['body'][_0xc93d('0x4a')];delete _0x2f441b[_0xc93d('0x48')][_0xc93d('0x4b')];delete _0x2f441b[_0xc93d('0x48')][_0xc93d('0x4c')];return db['ScreenRecording'][_0xc93d('0x46')]({'where':{'id':_0x2f441b[_0xc93d('0x44')]['id']}})[_0xc93d('0x22')](handleEntityNotFound(_0x3094bd,null))[_0xc93d('0x22')](saveUpdates(_0x2f441b['body'],null))[_0xc93d('0x22')](respondWithResult(_0x3094bd,null))[_0xc93d('0x42')](handleError(_0x3094bd,null));};exports['describe']=function(_0xb43af0,_0x1c022a){return db[_0xc93d('0x27')][_0xc93d('0x4d')]()[_0xc93d('0x22')](respondWithResult(_0x1c022a,null))[_0xc93d('0x42')](handleError(_0x1c022a,null));};exports[_0xc93d('0x4e')]=function(_0x21ee98,_0x26eada,_0x40d275){var _0x4f70fd=require(_0xc93d('0x4f'));var _0x476699=![];var _0x42318b={};if(_0x21ee98[_0xc93d('0x2e')][_0xc93d('0x3c')]&&_0x21ee98[_0xc93d('0x2e')][_0xc93d('0x3c')]===_0xc93d('0x50')){_0x42318b[_0xc93d('0x50')]=_0x21ee98[_0xc93d('0x44')]['id'];}else{_0x42318b['id']=_0x21ee98[_0xc93d('0x44')]['id'];}return db[_0xc93d('0x27')][_0xc93d('0x46')]({'where':_0x42318b,'attributes':['id',_0xc93d('0x4c')],'raw':!![]})[_0xc93d('0x22')](handleEntityNotFound(_0x26eada,null))['then'](function(_0x5d26e9){if(_0x5d26e9){var _0x4a75d9=path[_0xc93d('0x51')](config[_0xc93d('0x52')],_0xc93d('0x53'),_0x5d26e9[_0xc93d('0x4c')]);var _0x24711c=util[_0xc93d('0x2d')](_0xc93d('0x54'),_0x4a75d9);if(fs[_0xc93d('0x55')](_0x24711c)){_0x476699=!![];return _0x4f70fd[_0xc93d('0x56')](_0x24711c,_0x4a75d9,config['secrets'][_0xc93d('0x57')])[_0xc93d('0x22')](function(){return _0x5d26e9;});}return _0x5d26e9;}})[_0xc93d('0x22')](function(_0x23199f){if(_0x23199f){var _0x201519=path['join'](config['root'],_0xc93d('0x53'),_0x23199f['value']);if(!fs[_0xc93d('0x55')](_0x201519)){throw new db[(_0xc93d('0x58'))][(_0xc93d('0x59'))](_0xc93d('0x5a'));}if(_0x23199f[_0xc93d('0x5b')]){return _0x26eada[_0xc93d('0x4e')](_0x201519,_0x23199f[_0xc93d('0x5b')]+path[_0xc93d('0x5c')](_0x201519),function(){if(_0x476699){fs[_0xc93d('0x5d')](_0x201519);}});}else{return _0x26eada[_0xc93d('0x4e')](_0x201519,function(_0x5411ec){if(_0x476699){fs[_0xc93d('0x5d')](_0x201519);}});}}})['catch'](function(_0x54a2e0){if(_0x54a2e0[_0xc93d('0x5e')]===_0xc93d('0x5a')){_0x26eada['status'](0x194)[_0xc93d('0x5f')]('Not\x20found');}else{return handleError(_0x26eada,null);}});};exports[_0xc93d('0x21')]=function(_0x5b9d6f,_0x20d3c9){return db[_0xc93d('0x27')][_0xc93d('0x46')]({'where':{'id':_0x5b9d6f[_0xc93d('0x44')]['id']}})['then'](function(_0x3a843b){if(!_0x3a843b)throw new ReferenceError(_0xc93d('0x60'));return _0x3a843b;})[_0xc93d('0x22')](function(_0xb77a19){var _0x19aedd=path[_0xc93d('0x51')](config[_0xc93d('0x52')],_0xc93d('0x53'),_0xb77a19[_0xc93d('0x4c')]);logger[_0xc93d('0x61')](_0xc93d('0x62'),_0x19aedd);if(!_['isNil'](_0xb77a19[_0xc93d('0x4c')])&&fs[_0xc93d('0x55')](_0x19aedd)){logger[_0xc93d('0x61')](_0xc93d('0x63')+_0x19aedd+_0xc93d('0x64'));fs['unlinkSync'](_0x19aedd);}_0x19aedd=_0x19aedd+_0xc93d('0x65');if(!_['isNil'](_0xb77a19[_0xc93d('0x4c')])&&fs[_0xc93d('0x55')](_0x19aedd)){logger[_0xc93d('0x61')](_0xc93d('0x63')+_0x19aedd+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc93d('0x66')](_0x19aedd);}return _0xb77a19;})[_0xc93d('0x22')](function(_0x39488d){if(!_0x39488d)throw new InternalError();return _0x39488d[_0xc93d('0x21')]();})['then'](function(){_0x20d3c9[_0xc93d('0x18')](0xcc)[_0xc93d('0x17')]();})['catch'](handleError(_0x20d3c9,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d40f357..a333b6a 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1f5=['ScreenRecording','interactionid','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x3fafca,_0x195c8c){var _0x1096a5=function(_0x196eb9){while(--_0x196eb9){_0x3fafca['push'](_0x3fafca['shift']());}};_0x1096a5(++_0x195c8c);}(_0xa1f5,0x136));var _0x5a1f=function(_0x2f8629,_0x1862b6){_0x2f8629=_0x2f8629-0x0;var _0x4d9af4=_0xa1f5[_0x2f8629];return _0x4d9af4;};'use strict';var _=require(_0x5a1f('0x0'));var util=require('util');var logger=require(_0x5a1f('0x1'))(_0x5a1f('0x2'));var moment=require('moment');var BPromise=require(_0x5a1f('0x3'));var rp=require(_0x5a1f('0x4'));var fs=require('fs');var path=require(_0x5a1f('0x5'));var rimraf=require('rimraf');var config=require(_0x5a1f('0x6'));var attributes=require('./screenRecording.attributes');module[_0x5a1f('0x7')]=function(_0xb8d2d6,_0x256698){return _0xb8d2d6[_0x5a1f('0x8')](_0x5a1f('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x5a1f('0xa'),'fields':[_0x5a1f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x488d=['screen_recordings','interactionid','lodash','util','bluebird','request-promise','path','rimraf','exports','define','ScreenRecording'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x488d,0x16d));var _0xd488=function(_0x5f0f9e,_0x5bb27c){_0x5f0f9e=_0x5f0f9e-0x0;var _0x53dc00=_0x488d[_0x5f0f9e];return _0x53dc00;};'use strict';var _=require(_0xd488('0x0'));var util=require(_0xd488('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd488('0x2'));var rp=require(_0xd488('0x3'));var fs=require('fs');var path=require(_0xd488('0x4'));var rimraf=require(_0xd488('0x5'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xd488('0x6')]=function(_0x507777,_0x46bd8d){return _0x507777[_0xd488('0x7')](_0xd488('0x8'),attributes,{'tableName':_0xd488('0x9'),'paranoid':![],'indexes':[{'name':_0xd488('0xa'),'fields':[_0xd488('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 99515ff..2abaf8d 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5dad4d,_0x154f93){var _0x277b44=function(_0x5bfca6){while(--_0x5bfca6){_0x5dad4d['push'](_0x5dad4d['shift']());}};_0x277b44(++_0x154f93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2ea14,_0x222899){var _0x41817f=function(_0x2f94a4){while(--_0x2f94a4){_0x2ea14['push'](_0x2ea14['shift']());}};_0x41817f(++_0x222899);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 7985542..03ad6ba 100644 --- a/server/api/setting/index.js +++ b/server/api/setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b26=['../../components/auth/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','%s%s','logo','extname','originalname','post','single','server/files/images/logos/','format','logologin','file','preferred','addPreferred','addFavicon','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x8b26,0x79));var _0x68b2=function(_0x3a9b9b,_0x301972){_0x3a9b9b=_0x3a9b9b-0x0;var _0x4cb478=_0x8b26[_0x3a9b9b];return _0x4cb478;};'use strict';var multer=require(_0x68b2('0x0'));var util=require(_0x68b2('0x1'));var path=require(_0x68b2('0x2'));var timeout=require(_0x68b2('0x3'));var express=require(_0x68b2('0x4'));var router=express['Router']();var auth=require(_0x68b2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x68b2('0x6'));router[_0x68b2('0x7')]('/',auth[_0x68b2('0x8')](),controller[_0x68b2('0x9')]);router[_0x68b2('0x7')](_0x68b2('0xa'),controller[_0x68b2('0xb')]);router[_0x68b2('0x7')](_0x68b2('0xc'),controller[_0x68b2('0xd')]);router['get'](_0x68b2('0xe'),controller['getLogo']);router[_0x68b2('0x7')](_0x68b2('0xf'),controller[_0x68b2('0x10')]);router[_0x68b2('0x7')](_0x68b2('0x11'),controller[_0x68b2('0x12')]);router['get'](_0x68b2('0x13'),controller[_0x68b2('0x14')]);router[_0x68b2('0x7')](_0x68b2('0x15'),controller[_0x68b2('0x16')]);var upload=multer({'storage':multer[_0x68b2('0x17')]({'destination':function(_0x25c52c,_0x44a510,_0x43b9e2){_0x43b9e2(null,path[_0x68b2('0x18')](config[_0x68b2('0x19')],'server/files/images/logos/'));},'filename':function(_0x265c24,_0x3e8244,_0x46de7e){_0x46de7e(null,util['format'](_0x68b2('0x1a'),_0x68b2('0x1b'),path[_0x68b2('0x1c')](_0x3e8244[_0x68b2('0x1d')])));}})});router[_0x68b2('0x1e')](_0x68b2('0xe'),upload[_0x68b2('0x1f')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x68b2('0x17')]({'destination':function(_0x3a8793,_0x82f9ba,_0x48cb0f){_0x48cb0f(null,path[_0x68b2('0x18')](config['root'],_0x68b2('0x20')));},'filename':function(_0x3ec90d,_0x3fb9f2,_0x445cde){_0x445cde(null,util[_0x68b2('0x21')]('%s%s',_0x68b2('0x22'),path[_0x68b2('0x1c')](_0x3fb9f2[_0x68b2('0x1d')])));}})});router[_0x68b2('0x1e')](_0x68b2('0xf'),upload[_0x68b2('0x1f')](_0x68b2('0x23')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x823b38,_0x59d3a2,_0x4e1591){_0x4e1591(null,path[_0x68b2('0x18')](config[_0x68b2('0x19')],'server/files/images/logos/'));},'filename':function(_0x2e88f5,_0x114564,_0x3312b5){_0x3312b5(null,util[_0x68b2('0x21')](_0x68b2('0x1a'),_0x68b2('0x24'),path[_0x68b2('0x1c')](_0x114564[_0x68b2('0x1d')])));}})});router['post'](_0x68b2('0x13'),upload['single'](_0x68b2('0x23')),controller[_0x68b2('0x25')]);var upload=multer({'storage':multer[_0x68b2('0x17')]({'destination':function(_0x1013e,_0x3557b9,_0x15eac6){_0x15eac6(null,path[_0x68b2('0x18')](config[_0x68b2('0x19')],_0x68b2('0x20')));},'filename':function(_0x55451f,_0x50ebb5,_0x2ebdcd){_0x2ebdcd(null,util[_0x68b2('0x21')](_0x68b2('0x1a'),'favicon',path['extname'](_0x50ebb5[_0x68b2('0x1d')])));}})});router[_0x68b2('0x1e')]('/:id/favicon',upload[_0x68b2('0x1f')](_0x68b2('0x23')),controller[_0x68b2('0x26')]);router[_0x68b2('0x27')](_0x68b2('0xc'),auth[_0x68b2('0x8')](),controller[_0x68b2('0x28')]);module[_0x68b2('0x29')]=router; \ No newline at end of file +var _0xec07=['single','file','preferred','extname','addPreferred','favicon','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','root','format','%s%s','logo','originalname','addLogo','diskStorage','join','server/files/images/logos/','logologin','post','/:id/logo_login'];(function(_0x245eeb,_0x2e4663){var _0x28fbc5=function(_0x381c83){while(--_0x381c83){_0x245eeb['push'](_0x245eeb['shift']());}};_0x28fbc5(++_0x2e4663);}(_0xec07,0x1db));var _0x7ec0=function(_0x34429c,_0x544b66){_0x34429c=_0x34429c-0x0;var _0x315b3=_0xec07[_0x34429c];return _0x315b3;};'use strict';var multer=require(_0x7ec0('0x0'));var util=require(_0x7ec0('0x1'));var path=require(_0x7ec0('0x2'));var timeout=require(_0x7ec0('0x3'));var express=require('express');var router=express[_0x7ec0('0x4')]();var auth=require(_0x7ec0('0x5'));var interaction=require(_0x7ec0('0x6'));var config=require(_0x7ec0('0x7'));var controller=require(_0x7ec0('0x8'));router[_0x7ec0('0x9')]('/',auth[_0x7ec0('0xa')](),controller[_0x7ec0('0xb')]);router[_0x7ec0('0x9')]('/now',controller['getDate']);router['get'](_0x7ec0('0xc'),controller['show']);router[_0x7ec0('0x9')](_0x7ec0('0xd'),controller[_0x7ec0('0xe')]);router['get']('/:id/logo_login',controller[_0x7ec0('0xf')]);router[_0x7ec0('0x9')](_0x7ec0('0x10'),controller[_0x7ec0('0x11')]);router['get'](_0x7ec0('0x12'),controller['getPreferred']);router['get'](_0x7ec0('0x13'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x247fef,_0x2c57e0,_0x2c6166){_0x2c6166(null,path['join'](config[_0x7ec0('0x14')],'server/files/images/logos/'));},'filename':function(_0x43ae2e,_0x564c00,_0x207797){_0x207797(null,util[_0x7ec0('0x15')](_0x7ec0('0x16'),_0x7ec0('0x17'),path['extname'](_0x564c00[_0x7ec0('0x18')])));}})});router['post']('/:id/logo',upload['single']('file'),controller[_0x7ec0('0x19')]);var upload=multer({'storage':multer[_0x7ec0('0x1a')]({'destination':function(_0x47b6a6,_0x324b0e,_0x1231a4){_0x1231a4(null,path[_0x7ec0('0x1b')](config[_0x7ec0('0x14')],_0x7ec0('0x1c')));},'filename':function(_0x279cdc,_0xafe3de,_0x52dc65){_0x52dc65(null,util['format'](_0x7ec0('0x16'),_0x7ec0('0x1d'),path['extname'](_0xafe3de[_0x7ec0('0x18')])));}})});router[_0x7ec0('0x1e')](_0x7ec0('0x1f'),upload[_0x7ec0('0x20')](_0x7ec0('0x21')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x7ec0('0x1a')]({'destination':function(_0x3b01b5,_0x5cde60,_0x27995d){_0x27995d(null,path[_0x7ec0('0x1b')](config[_0x7ec0('0x14')],_0x7ec0('0x1c')));},'filename':function(_0x567447,_0x343a9c,_0x51cce1){_0x51cce1(null,util[_0x7ec0('0x15')]('%s%s',_0x7ec0('0x22'),path[_0x7ec0('0x23')](_0x343a9c[_0x7ec0('0x18')])));}})});router[_0x7ec0('0x1e')]('/:id/preferred',upload['single'](_0x7ec0('0x21')),controller[_0x7ec0('0x24')]);var upload=multer({'storage':multer[_0x7ec0('0x1a')]({'destination':function(_0x831a3c,_0x552d51,_0x1abfe7){_0x1abfe7(null,path[_0x7ec0('0x1b')](config[_0x7ec0('0x14')],_0x7ec0('0x1c')));},'filename':function(_0x272a59,_0x390105,_0x2a52ef){_0x2a52ef(null,util['format']('%s%s',_0x7ec0('0x25'),path[_0x7ec0('0x23')](_0x390105['originalname'])));}})});router['post'](_0x7ec0('0x13'),upload[_0x7ec0('0x20')](_0x7ec0('0x21')),controller['addFavicon']);router['put'](_0x7ec0('0xc'),auth[_0x7ec0('0xa')](),controller[_0x7ec0('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f89528a..2eac60e 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6035=['INTEGER','min_internal','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','STRING','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x54e1c3,_0x1d7b4d){var _0x920d08=function(_0x347e05){while(--_0x347e05){_0x54e1c3['push'](_0x54e1c3['shift']());}};_0x920d08(++_0x1d7b4d);}(_0x6035,0x1e8));var _0x5603=function(_0x46c253,_0x44bc69){_0x46c253=_0x46c253-0x0;var _0x30f4bc=_0x6035[_0x46c253];return _0x30f4bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x5603('0x0')](0xb),'unique':_0x5603('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5603('0x0')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x5603('0x2')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5603('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x5603('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x5603('0x4')]},'pageTitle':{'type':Sequelize[_0x5603('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5603('0x3')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5603('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5603('0x5')},'enableEmailPreview':{'type':Sequelize[_0x5603('0x3')],'defaultValue':![]},'split':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5603('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5603('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5603('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5603('0x4')],'defaultValue':_0x5603('0x6')},'chatTimeout':{'type':Sequelize[_0x5603('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5603('0x4')]},'defaultPreferred':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5603('0x3')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5603('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5603('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5603('0x3')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x5603('0x4')]},'sentiment':{'type':Sequelize[_0x5603('0x3')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5603('0x3')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5603('0x0')]},'sentimentRegion':{'type':Sequelize[_0x5603('0x4')]},'language':{'type':Sequelize[_0x5603('0x4')]},'bucket':{'type':Sequelize[_0x5603('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5603('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x5603('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6e5e=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x3fb2f9,_0x39863f){var _0x481813=function(_0x407b1e){while(--_0x407b1e){_0x3fb2f9['push'](_0x3fb2f9['shift']());}};_0x481813(++_0x39863f);}(_0x6e5e,0x111));var _0xe6e5=function(_0x35eaaf,_0x3bad0d){_0x35eaaf=_0x35eaaf-0x0;var _0x5e704c=_0x6e5e[_0x35eaaf];return _0x5e704c;};'use strict';var Sequelize=require('sequelize');module[_0xe6e5('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe6e5('0x1')](0xb),'unique':_0xe6e5('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe6e5('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe6e5('0x3')],'defaultValue':_0xe6e5('0x4')},'logo':{'type':Sequelize[_0xe6e5('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe6e5('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe6e5('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe6e5('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xe6e5('0x3')]},'turnpassword':{'type':Sequelize[_0xe6e5('0x3')]},'pageTitle':{'type':Sequelize[_0xe6e5('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xe6e5('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe6e5('0x3')],'defaultValue':_0xe6e5('0x6')},'enableEmailPreview':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe6e5('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xe6e5('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe6e5('0x3')],'defaultValue':_0xe6e5('0x7')},'chatTimeout':{'type':Sequelize[_0xe6e5('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xe6e5('0x3')]},'defaultPreferred':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe6e5('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xe6e5('0x3')]},'defaultFavicon':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xe6e5('0x1')]},'transcribeRegion':{'type':Sequelize[_0xe6e5('0x3')]},'sentiment':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe6e5('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe6e5('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xe6e5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ec5604c..7c33a1b 100644 --- a/server/api/setting/setting.controller.js +++ b/server/api/setting/setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7287=['utcOffset','format','send','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','index','Setting','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLicense','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','server/files/images/logos','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','default_loginLogo.svg','download','getPreferred','defaultLoginLogo','default_preferred.png','getFavicon','default_favicon.ico','ValidationError'];(function(_0x288f44,_0x1e8b9b){var _0x3ead75=function(_0x1dfc06){while(--_0x1dfc06){_0x288f44['push'](_0x288f44['shift']());}};_0x3ead75(++_0x1e8b9b);}(_0x7287,0xeb));var _0x7728=function(_0xafb867,_0x570ae8){_0xafb867=_0xafb867-0x0;var _0x4ae3f7=_0x7287[_0xafb867];return _0x4ae3f7;};'use strict';var pdf=require(_0x7728('0x0'));var emlformat=require(_0x7728('0x1'));var rimraf=require(_0x7728('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7728('0x3'));var rp=require(_0x7728('0x4'));var moment=require(_0x7728('0x5'));var BPromise=require(_0x7728('0x6'));var Mustache=require('mustache');var util=require(_0x7728('0x7'));var path=require(_0x7728('0x8'));var sox=require('sox');var csv=require(_0x7728('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7728('0xa'));var squel=require('squel');var crypto=require(_0x7728('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7728('0xc'));var toCsv=require(_0x7728('0x9'));var querystring=require(_0x7728('0xd'));var Papa=require('papaparse');var Redis=require(_0x7728('0xe'));var authService=require(_0x7728('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7728('0x10'));var hardwareService=require(_0x7728('0x11'));var logger=require(_0x7728('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7728('0x13'));var db=require(_0x7728('0x14'))['db'];var jayson=require(_0x7728('0x15'));var client=jayson[_0x7728('0x16')][_0x7728('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xded334,_0xa01a72,_0x302989,_0x463696){return new BPromise(function(_0x36f9f8,_0x11fdc3){var _0x1292ad=_0x463696||client;return _0x1292ad[_0x7728('0x18')](_0xded334,_0x302989)[_0x7728('0x19')](function(_0x12cd79){logger['info'](_0x7728('0x1a'),_0xa01a72,_0x7728('0x1b'));logger[_0x7728('0x1c')](_0x7728('0x1d'),_0xa01a72,_0x7728('0x1b'),JSON['stringify'](_0x12cd79));if(_0x12cd79[_0x7728('0x1e')]){if(_0x12cd79[_0x7728('0x1e')]['code']===0x1f4){logger[_0x7728('0x1e')](_0x7728('0x1a'),_0xa01a72,_0x12cd79[_0x7728('0x1e')][_0x7728('0x1f')]);return _0x11fdc3(_0x12cd79['error'][_0x7728('0x1f')]);}logger[_0x7728('0x1e')](_0x7728('0x1a'),_0xa01a72,_0x12cd79[_0x7728('0x1e')]['message']);return _0x36f9f8(_0x12cd79[_0x7728('0x1e')][_0x7728('0x1f')]);}else{logger[_0x7728('0x20')]('Setting,\x20%s,\x20%s',_0xa01a72,'request\x20sent');_0x36f9f8(_0x12cd79[_0x7728('0x21')]['message']);}})[_0x7728('0x22')](function(_0x113316){logger[_0x7728('0x1e')](_0x7728('0x1a'),_0xa01a72,_0x113316);_0x11fdc3(_0x113316);});});}function respondWithStatusCode(_0x1ba423,_0xbd73aa){_0xbd73aa=_0xbd73aa||0xcc;return function(_0x43a3e0){if(_0x43a3e0){return _0x1ba423[_0x7728('0x23')](_0xbd73aa);}return _0x1ba423[_0x7728('0x24')](_0xbd73aa)[_0x7728('0x25')]();};}function respondWithResult(_0x3bf7c4,_0x180e6e){_0x180e6e=_0x180e6e||0xc8;return function(_0x26df8a){if(_0x26df8a){return _0x3bf7c4[_0x7728('0x24')](_0x180e6e)[_0x7728('0x26')](_0x26df8a);}};}function respondWithFilteredResult(_0x14eb52,_0x5a8210){return function(_0x407793){if(_0x407793){var _0xf7fb34=_0x407793[_0x7728('0x27')],_0x2b0ddc=_0x5a8210['offset'],_0x5dd005=_0x5a8210[_0x7728('0x28')]+_0x5a8210[_0x7728('0x29')],_0x441f56;if(_0x5dd005>=_0xf7fb34){_0x5dd005=_0xf7fb34;_0x441f56=0xc8;}else{_0x441f56=0xce;}_0x14eb52[_0x7728('0x24')](_0x441f56);return _0x14eb52[_0x7728('0x2a')](_0x7728('0x2b'),_0x2b0ddc+'-'+_0x5dd005+'/'+_0xf7fb34)[_0x7728('0x26')](_0x407793);}return null;};}function patchUpdates(_0x277037){return function(_0xa95249){try{jsonpatch[_0x7728('0x2c')](_0xa95249,_0x277037,!![]);}catch(_0x475aca){return BPromise[_0x7728('0x2d')](_0x475aca);}return _0xa95249[_0x7728('0x2e')]();};}function saveUpdates(_0x41fc7d,_0x4bed34){return function(_0x59abbd){if(_0x59abbd){return _0x59abbd['update'](_0x41fc7d)[_0x7728('0x19')](function(_0x49e29e){return _0x49e29e;});}return null;};}function removeEntity(_0x3fe94e,_0x3fb9de){return function(_0x176d0a){if(_0x176d0a){return _0x176d0a['destroy']()['then'](function(){_0x3fe94e[_0x7728('0x24')](0xcc)[_0x7728('0x25')]();});}};}function handleEntityNotFound(_0x7c2620,_0x1a747c){return function(_0x2a382a){if(!_0x2a382a){_0x7c2620[_0x7728('0x23')](0x194);}return _0x2a382a;};}function handleError(_0x2ef7e7,_0x8f7e69){_0x8f7e69=_0x8f7e69||0x1f4;return function(_0x5d7573){logger[_0x7728('0x1e')](_0x5d7573[_0x7728('0x2f')]);if(_0x5d7573[_0x7728('0x30')]){delete _0x5d7573[_0x7728('0x30')];}_0x2ef7e7[_0x7728('0x24')](_0x8f7e69)['send'](_0x5d7573);};}exports[_0x7728('0x31')]=function(_0x3e0752,_0x454175){var _0x4aee44={},_0x223c24={},_0x9d743e={'count':0x0,'rows':[]};var _0x33193f=_['map'](db[_0x7728('0x32')][_0x7728('0x33')],function(_0x37a447){return{'name':_0x37a447[_0x7728('0x34')],'type':_0x37a447[_0x7728('0x35')][_0x7728('0x36')]};});_0x223c24[_0x7728('0x37')]=_[_0x7728('0x38')](_0x33193f,_0x7728('0x30'));_0x223c24[_0x7728('0x39')]=_[_0x7728('0x3a')](_0x3e0752[_0x7728('0x39')]);_0x223c24[_0x7728('0x3b')]=_[_0x7728('0x3c')](_0x223c24[_0x7728('0x37')],_0x223c24[_0x7728('0x39')]);_0x4aee44[_0x7728('0x3d')]=_[_0x7728('0x3c')](_0x223c24[_0x7728('0x37')],qs[_0x7728('0x3e')](_0x3e0752[_0x7728('0x39')][_0x7728('0x3e')]));_0x4aee44[_0x7728('0x3d')]=_0x4aee44[_0x7728('0x3d')]['length']?_0x4aee44[_0x7728('0x3d')]:_0x223c24[_0x7728('0x37')];if(!_0x3e0752[_0x7728('0x39')]['hasOwnProperty'](_0x7728('0x3f'))){_0x4aee44[_0x7728('0x29')]=qs[_0x7728('0x29')](_0x3e0752[_0x7728('0x39')][_0x7728('0x29')]);_0x4aee44['offset']=qs[_0x7728('0x28')](_0x3e0752[_0x7728('0x39')][_0x7728('0x28')]);}_0x4aee44[_0x7728('0x40')]=qs['sort'](_0x3e0752[_0x7728('0x39')][_0x7728('0x41')]);_0x4aee44['where']=qs[_0x7728('0x3b')](_[_0x7728('0x42')](_0x3e0752[_0x7728('0x39')],_0x223c24['filters']),_0x33193f);if(_0x3e0752[_0x7728('0x39')][_0x7728('0x43')]){_0x4aee44[_0x7728('0x44')]=_['merge'](_0x4aee44[_0x7728('0x44')],{'$or':_[_0x7728('0x38')](_0x33193f,function(_0x218d5d){if(_0x218d5d[_0x7728('0x35')]!==_0x7728('0x45')){var _0x54ce2d={};_0x54ce2d[_0x218d5d[_0x7728('0x30')]]={'$like':'%'+_0x3e0752[_0x7728('0x39')][_0x7728('0x43')]+'%'};return _0x54ce2d;}})});}_0x4aee44=_[_0x7728('0x46')]({},_0x4aee44,_0x3e0752[_0x7728('0x47')]);var _0x53d6ea={'where':_0x4aee44[_0x7728('0x44')]};return db[_0x7728('0x32')][_0x7728('0x27')](_0x53d6ea)[_0x7728('0x19')](function(_0x5784ba){_0x9d743e[_0x7728('0x27')]=_0x5784ba;if(_0x3e0752[_0x7728('0x39')][_0x7728('0x48')]){_0x4aee44[_0x7728('0x49')]=[{'all':!![]}];}return db[_0x7728('0x32')][_0x7728('0x4a')](_0x4aee44);})[_0x7728('0x19')](function(_0xa5703b){_0x9d743e[_0x7728('0x4b')]=_0xa5703b;return _0x9d743e;})['then'](respondWithFilteredResult(_0x454175,_0x4aee44))['catch'](handleError(_0x454175,null));};exports[_0x7728('0x4c')]=function(_0x213b53,_0x506e53){var _0xdd0e73={'raw':![],'where':{'id':_0x213b53[_0x7728('0x4d')]['id']}},_0x22d077={};_0x22d077[_0x7728('0x37')]=_[_0x7728('0x3a')](db[_0x7728('0x32')][_0x7728('0x33')]);_0x22d077['query']=_[_0x7728('0x3a')](_0x213b53['query']);_0x22d077[_0x7728('0x3b')]=_[_0x7728('0x3c')](_0x22d077[_0x7728('0x37')],_0x22d077[_0x7728('0x39')]);_0xdd0e73[_0x7728('0x3d')]=_['intersection'](_0x22d077[_0x7728('0x37')],qs[_0x7728('0x3e')](_0x213b53[_0x7728('0x39')][_0x7728('0x3e')]));_0xdd0e73['attributes']=_0xdd0e73[_0x7728('0x3d')][_0x7728('0x4e')]?_0xdd0e73[_0x7728('0x3d')]:_0x22d077[_0x7728('0x37')];if(_0x213b53[_0x7728('0x39')][_0x7728('0x48')]){_0xdd0e73[_0x7728('0x49')]=[{'all':!![]}];}_0xdd0e73=_[_0x7728('0x46')]({},_0xdd0e73,_0x213b53[_0x7728('0x47')]);return db['Setting'][_0x7728('0x4f')](_0xdd0e73)['then'](handleEntityNotFound(_0x506e53,null))[_0x7728('0x19')](respondWithResult(_0x506e53,null))[_0x7728('0x22')](handleError(_0x506e53,null));};exports[_0x7728('0x50')]=function(_0x5c73f8,_0x1fc8c9){if(_0x5c73f8[_0x7728('0x51')]['id']){delete _0x5c73f8[_0x7728('0x51')]['id'];}return db[_0x7728('0x32')][_0x7728('0x4f')]({'where':{'id':_0x5c73f8[_0x7728('0x4d')]['id']}})[_0x7728('0x19')](handleEntityNotFound(_0x1fc8c9,null))['then'](saveUpdates(_0x5c73f8['body'],null))[_0x7728('0x19')](respondWithResult(_0x1fc8c9,null))['catch'](handleError(_0x1fc8c9,null));};exports[_0x7728('0x52')]=function(_0x507c54,_0x432b8e,_0x54b246){if(_0x507c54['file']&&_0x507c54[_0x7728('0x53')][_0x7728('0x54')]){_0x507c54[_0x7728('0x51')][_0x7728('0x55')]=_0x507c54[_0x7728('0x53')][_0x7728('0x54')];}return db[_0x7728('0x32')][_0x7728('0x4f')]({'where':{'id':_0x507c54[_0x7728('0x4d')]['id']}})[_0x7728('0x19')](handleEntityNotFound(_0x432b8e,null))[_0x7728('0x19')](saveUpdates(_0x507c54['body'],null))['then'](respondWithResult(_0x432b8e,null))[_0x7728('0x22')](handleError(_0x432b8e,null));};exports[_0x7728('0x56')]=function(_0x216ef4,_0x460541,_0x91e3fb){if(_0x216ef4[_0x7728('0x53')]&&_0x216ef4[_0x7728('0x53')]['filename']){_0x216ef4[_0x7728('0x51')][_0x7728('0x57')]=_0x216ef4[_0x7728('0x53')][_0x7728('0x54')];}return db[_0x7728('0x32')][_0x7728('0x4f')]({'where':{'id':_0x216ef4[_0x7728('0x4d')]['id']}})[_0x7728('0x19')](handleEntityNotFound(_0x460541,null))['then'](saveUpdates(_0x216ef4['body'],null))[_0x7728('0x19')](respondWithResult(_0x460541,null))[_0x7728('0x22')](handleError(_0x460541,null));};var utilLicense=require(_0x7728('0x13'));exports['getLogo']=function(_0x214783,_0x5ad401,_0x23e3e4){var _0x3df3b9='server/files/images/logos';var _0x582c8a={'custom':![]};return utilLicense[_0x7728('0x58')]()[_0x7728('0x19')](function(_0x413e0c){if(_0x413e0c){_0x582c8a=_0x413e0c;}return db[_0x7728('0x32')][_0x7728('0x4f')]({'where':{'id':_0x214783[_0x7728('0x4d')]['id']},'attributes':[_0x7728('0x55'),_0x7728('0x57'),'preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x7728('0x19')](handleEntityNotFound(_0x5ad401,null))[_0x7728('0x19')](function(_0x573d58){if(_0x573d58){var _0x4dd40b=_0x573d58['logo']&&fs[_0x7728('0x59')](path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x3df3b9,_[_0x7728('0x5c')](_0x573d58[_0x7728('0x55')])))?path[_0x7728('0x5a')](config['root'],_0x3df3b9,_['toLower'](_0x573d58[_0x7728('0x55')])):path['join'](config[_0x7728('0x5b')],_0x3df3b9,_[_0x7728('0x5c')](_0x7728('0x5d')));var _0x40fa4b=_0x7728('0x5e')+_[_0x7728('0x5f')]('logo');if(_0x573d58[_0x40fa4b]||!_0x582c8a[_0x7728('0x60')]){_0x4dd40b=path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x3df3b9,_[_0x7728('0x5c')]('default_logo.svg'));}if(!fs[_0x7728('0x59')](_0x4dd40b)){throw new db[(_0x7728('0x61'))]['ValidationError'](_[_0x7728('0x5f')](_0x7728('0x55'))+_0x7728('0x62'));}return _0x5ad401['download'](_0x4dd40b);}})[_0x7728('0x22')](handleError(_0x5ad401,null));};var utilLicense=require(_0x7728('0x13'));exports['getLogoLogin']=function(_0x2b7cd9,_0x76f244,_0x11b0af){var _0x5669cf=_0x7728('0x63');var _0x4664ad={'custom':![]};return utilLicense[_0x7728('0x58')]()[_0x7728('0x19')](function(_0x126153){if(_0x126153){_0x4664ad=_0x126153;}return db[_0x7728('0x32')][_0x7728('0x4f')]({'where':{'id':_0x2b7cd9[_0x7728('0x4d')]['id']},'attributes':[_0x7728('0x55'),_0x7728('0x57'),_0x7728('0x64'),_0x7728('0x65'),_0x7728('0x66'),'defaultLoginLogo',_0x7728('0x67'),_0x7728('0x68')],'raw':!![]});})['then'](handleEntityNotFound(_0x76f244,null))[_0x7728('0x19')](function(_0x1144ed){if(_0x1144ed){var _0x373430=_0x1144ed[_0x7728('0x57')]&&fs['existsSync'](path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x5669cf,_[_0x7728('0x5c')](_0x1144ed[_0x7728('0x57')])))?path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x5669cf,_['toLower'](_0x1144ed['loginLogo'])):path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x5669cf,_[_0x7728('0x5c')](_0x7728('0x69')));var _0x3c420a='default'+_[_0x7728('0x5f')](_0x7728('0x57'));if(_0x1144ed[_0x3c420a]||!_0x4664ad[_0x7728('0x60')]){_0x373430=path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x5669cf,_[_0x7728('0x5c')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x373430)){throw new db[(_0x7728('0x61'))]['ValidationError'](_['upperFirst'](_0x7728('0x57'))+_0x7728('0x62'));}return _0x76f244[_0x7728('0x6a')](_0x373430);}})['catch'](handleError(_0x76f244,null));};exports['gdpr']=function(_0x2dcf90,_0x4877ea){return db[_0x7728('0x32')][_0x7728('0x4f')]({'where':{'id':_0x2dcf90[_0x7728('0x4d')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x4877ea,null))[_0x7728('0x22')](handleError(_0x4877ea,null));};exports['addPreferred']=function(_0xa285ee,_0x836604,_0x53618b){if(_0xa285ee[_0x7728('0x53')]&&_0xa285ee[_0x7728('0x53')]['filename']){_0xa285ee[_0x7728('0x51')][_0x7728('0x64')]=_0xa285ee['file']['filename'];}return db['Setting'][_0x7728('0x4f')]({'where':{'id':_0xa285ee['params']['id']}})[_0x7728('0x19')](handleEntityNotFound(_0x836604,null))[_0x7728('0x19')](saveUpdates(_0xa285ee[_0x7728('0x51')],null))[_0x7728('0x19')](respondWithResult(_0x836604,null))['catch'](handleError(_0x836604,null));};var utilLicense=require(_0x7728('0x13'));exports[_0x7728('0x6b')]=function(_0x286a6e,_0x202a36,_0x3ac72d){var _0x174434='server/files/images/logos';var _0x288b93={'custom':![]};return utilLicense[_0x7728('0x58')]()[_0x7728('0x19')](function(_0x2d5f01){if(_0x2d5f01){_0x288b93=_0x2d5f01;}return db[_0x7728('0x32')][_0x7728('0x4f')]({'where':{'id':_0x286a6e[_0x7728('0x4d')]['id']},'attributes':[_0x7728('0x55'),_0x7728('0x57'),_0x7728('0x64'),_0x7728('0x65'),_0x7728('0x66'),_0x7728('0x6c'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x7728('0x19')](handleEntityNotFound(_0x202a36,null))[_0x7728('0x19')](function(_0x2cff6f){if(_0x2cff6f){var _0x3d2b85=_0x2cff6f[_0x7728('0x64')]&&fs[_0x7728('0x59')](path['join'](config[_0x7728('0x5b')],_0x174434,_[_0x7728('0x5c')](_0x2cff6f[_0x7728('0x64')])))?path['join'](config['root'],_0x174434,_[_0x7728('0x5c')](_0x2cff6f['preferred'])):path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x174434,_[_0x7728('0x5c')](_0x7728('0x6d')));var _0x271584=_0x7728('0x5e')+_[_0x7728('0x5f')]('preferred');if(_0x2cff6f[_0x271584]||!_0x288b93['custom']||!_0x288b93[_0x7728('0x64')]){_0x3d2b85=path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x174434,_[_0x7728('0x5c')](_0x7728('0x6d')));}if(!fs[_0x7728('0x59')](_0x3d2b85)){throw new db[(_0x7728('0x61'))]['ValidationError'](_[_0x7728('0x5f')]('preferred')+'\x20not\x20found');}return _0x202a36[_0x7728('0x6a')](_0x3d2b85);}})['catch'](handleError(_0x202a36,null));};exports['addFavicon']=function(_0x1cf277,_0x268c7a,_0x162960){if(_0x1cf277[_0x7728('0x53')]&&_0x1cf277[_0x7728('0x53')][_0x7728('0x54')]){_0x1cf277[_0x7728('0x51')]['favicon']=_0x1cf277[_0x7728('0x53')][_0x7728('0x54')];}return db['Setting'][_0x7728('0x4f')]({'where':{'id':_0x1cf277[_0x7728('0x4d')]['id']}})['then'](handleEntityNotFound(_0x268c7a,null))[_0x7728('0x19')](saveUpdates(_0x1cf277[_0x7728('0x51')],null))[_0x7728('0x19')](respondWithResult(_0x268c7a,null))[_0x7728('0x22')](handleError(_0x268c7a,null));};var utilLicense=require(_0x7728('0x13'));exports[_0x7728('0x6e')]=function(_0x1b7ab3,_0x5b33f5,_0x35ddd3){var _0x58501e=_0x7728('0x63');var _0x62ed23={'custom':![]};return utilLicense[_0x7728('0x58')]()[_0x7728('0x19')](function(_0x581079){if(_0x581079){_0x62ed23=_0x581079;}return db['Setting']['find']({'where':{'id':_0x1b7ab3[_0x7728('0x4d')]['id']},'attributes':['logo',_0x7728('0x57'),_0x7728('0x64'),_0x7728('0x65'),'defaultLogo','defaultLoginLogo',_0x7728('0x67'),_0x7728('0x68')],'raw':!![]});})['then'](handleEntityNotFound(_0x5b33f5,null))[_0x7728('0x19')](function(_0x3bd6a9){if(_0x3bd6a9){var _0x178beb=_0x3bd6a9[_0x7728('0x65')]&&fs[_0x7728('0x59')](path[_0x7728('0x5a')](config['root'],_0x58501e,_[_0x7728('0x5c')](_0x3bd6a9[_0x7728('0x65')])))?path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x58501e,_[_0x7728('0x5c')](_0x3bd6a9[_0x7728('0x65')])):path[_0x7728('0x5a')](config[_0x7728('0x5b')],_0x58501e,_['toLower'](_0x7728('0x6f')));var _0x100da7=_0x7728('0x5e')+_[_0x7728('0x5f')]('favicon');if(_0x3bd6a9[_0x100da7]||!_0x62ed23[_0x7728('0x60')]){_0x178beb=path['join'](config[_0x7728('0x5b')],_0x58501e,_['toLower'](_0x7728('0x6f')));}if(!fs[_0x7728('0x59')](_0x178beb)){throw new db[(_0x7728('0x61'))][(_0x7728('0x70'))](_['upperFirst'](_0x7728('0x65'))+_0x7728('0x62'));}return _0x5b33f5[_0x7728('0x6a')](_0x178beb);}})[_0x7728('0x22')](handleError(_0x5b33f5,null));};exports['getDate']=function(_0x39d94b,_0x152f3d){var _0x293c22={'offset':moment()[_0x7728('0x71')]()};_0x293c22['now']=moment()[_0x7728('0x71')](_0x293c22[_0x7728('0x28')])[_0x7728('0x72')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x152f3d[_0x7728('0x24')](0xc8)[_0x7728('0x73')](_0x293c22);}; \ No newline at end of file +var _0xf98c=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting','include','show','params','body','find','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','custom','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0xf98c,0x12a));var _0xcf98=function(_0xc0866a,_0x3b8164){_0xc0866a=_0xc0866a-0x0;var _0x2d850c=_0xf98c[_0xc0866a];return _0x2d850c;};'use strict';var pdf=require(_0xcf98('0x0'));var emlformat=require(_0xcf98('0x1'));var rimraf=require(_0xcf98('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcf98('0x3'));var BPromise=require(_0xcf98('0x4'));var Mustache=require(_0xcf98('0x5'));var util=require(_0xcf98('0x6'));var path=require(_0xcf98('0x7'));var sox=require(_0xcf98('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf98('0x9'));var squel=require(_0xcf98('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcf98('0xb'));var toCsv=require(_0xcf98('0xc'));var querystring=require(_0xcf98('0xd'));var Papa=require(_0xcf98('0xe'));var Redis=require(_0xcf98('0xf'));var authService=require(_0xcf98('0x10'));var qs=require(_0xcf98('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf98('0x12'));var logger=require(_0xcf98('0x13'))(_0xcf98('0x14'));var utils=require('../../config/utils');var config=require(_0xcf98('0x15'));var licenseUtil=require(_0xcf98('0x16'));var db=require(_0xcf98('0x17'))['db'];var jayson=require(_0xcf98('0x18'));var client=jayson[_0xcf98('0x19')][_0xcf98('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x382050,_0x2a8b0e,_0x452980,_0x3f4491){return new BPromise(function(_0x4ce3d0,_0x4028e1){var _0x96a20e=_0x3f4491||client;return _0x96a20e[_0xcf98('0x1b')](_0x382050,_0x452980)[_0xcf98('0x1c')](function(_0x1489dd){logger['info'](_0xcf98('0x1d'),_0x2a8b0e,_0xcf98('0x1e'));logger['debug'](_0xcf98('0x1f'),_0x2a8b0e,_0xcf98('0x1e'),JSON[_0xcf98('0x20')](_0x1489dd));if(_0x1489dd[_0xcf98('0x21')]){if(_0x1489dd['error'][_0xcf98('0x22')]===0x1f4){logger[_0xcf98('0x21')](_0xcf98('0x1d'),_0x2a8b0e,_0x1489dd[_0xcf98('0x21')][_0xcf98('0x23')]);return _0x4028e1(_0x1489dd[_0xcf98('0x21')]['message']);}logger[_0xcf98('0x21')](_0xcf98('0x1d'),_0x2a8b0e,_0x1489dd['error'][_0xcf98('0x23')]);return _0x4ce3d0(_0x1489dd[_0xcf98('0x21')][_0xcf98('0x23')]);}else{logger[_0xcf98('0x24')](_0xcf98('0x1d'),_0x2a8b0e,_0xcf98('0x1e'));_0x4ce3d0(_0x1489dd[_0xcf98('0x25')][_0xcf98('0x23')]);}})[_0xcf98('0x26')](function(_0x25ce72){logger['error']('Setting,\x20%s,\x20%s',_0x2a8b0e,_0x25ce72);_0x4028e1(_0x25ce72);});});}function respondWithStatusCode(_0x42df43,_0x58564c){_0x58564c=_0x58564c||0xcc;return function(_0x4cf1a7){if(_0x4cf1a7){return _0x42df43[_0xcf98('0x27')](_0x58564c);}return _0x42df43[_0xcf98('0x28')](_0x58564c)[_0xcf98('0x29')]();};}function respondWithResult(_0x2af53e,_0x543198){_0x543198=_0x543198||0xc8;return function(_0x35924f){if(_0x35924f){return _0x2af53e['status'](_0x543198)[_0xcf98('0x2a')](_0x35924f);}};}function respondWithFilteredResult(_0x589874,_0x109272){return function(_0x1e5abc){if(_0x1e5abc){var _0x331de0=_0x1e5abc[_0xcf98('0x2b')],_0x1657da=_0x109272[_0xcf98('0x2c')],_0x4d3a22=_0x109272[_0xcf98('0x2c')]+_0x109272[_0xcf98('0x2d')],_0x19d06a;if(_0x4d3a22>=_0x331de0){_0x4d3a22=_0x331de0;_0x19d06a=0xc8;}else{_0x19d06a=0xce;}_0x589874[_0xcf98('0x28')](_0x19d06a);return _0x589874[_0xcf98('0x2e')]('Content-Range',_0x1657da+'-'+_0x4d3a22+'/'+_0x331de0)[_0xcf98('0x2a')](_0x1e5abc);}return null;};}function patchUpdates(_0x37c137){return function(_0x3ba294){try{jsonpatch[_0xcf98('0x2f')](_0x3ba294,_0x37c137,!![]);}catch(_0x167835){return BPromise[_0xcf98('0x30')](_0x167835);}return _0x3ba294['save']();};}function saveUpdates(_0x4bc9a,_0x3e9d46){return function(_0x27e64e){if(_0x27e64e){return _0x27e64e[_0xcf98('0x31')](_0x4bc9a)[_0xcf98('0x1c')](function(_0x1ce518){return _0x1ce518;});}return null;};}function removeEntity(_0x471170,_0x28c743){return function(_0x4072f9){if(_0x4072f9){return _0x4072f9[_0xcf98('0x32')]()['then'](function(){_0x471170[_0xcf98('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x992d0a,_0x260c69){return function(_0x29514e){if(!_0x29514e){_0x992d0a['sendStatus'](0x194);}return _0x29514e;};}function handleError(_0x4259bc,_0x215cf1){_0x215cf1=_0x215cf1||0x1f4;return function(_0xd72fec){logger['error'](_0xd72fec['stack']);if(_0xd72fec[_0xcf98('0x33')]){delete _0xd72fec[_0xcf98('0x33')];}_0x4259bc[_0xcf98('0x28')](_0x215cf1)['send'](_0xd72fec);};}exports[_0xcf98('0x34')]=function(_0x5bb871,_0x291868){var _0x125e79={},_0x3cc98f={},_0xdcdabd={'count':0x0,'rows':[]};var _0x545410=_[_0xcf98('0x35')](db['Setting'][_0xcf98('0x36')],function(_0x5b2a30){return{'name':_0x5b2a30[_0xcf98('0x37')],'type':_0x5b2a30[_0xcf98('0x38')]['key']};});_0x3cc98f[_0xcf98('0x39')]=_[_0xcf98('0x35')](_0x545410,_0xcf98('0x33'));_0x3cc98f[_0xcf98('0x3a')]=_[_0xcf98('0x3b')](_0x5bb871[_0xcf98('0x3a')]);_0x3cc98f[_0xcf98('0x3c')]=_[_0xcf98('0x3d')](_0x3cc98f[_0xcf98('0x39')],_0x3cc98f[_0xcf98('0x3a')]);_0x125e79['attributes']=_['intersection'](_0x3cc98f[_0xcf98('0x39')],qs['fields'](_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x3e')]));_0x125e79['attributes']=_0x125e79[_0xcf98('0x3f')][_0xcf98('0x40')]?_0x125e79['attributes']:_0x3cc98f['model'];if(!_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x41')](_0xcf98('0x42'))){_0x125e79['limit']=qs[_0xcf98('0x2d')](_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x2d')]);_0x125e79['offset']=qs[_0xcf98('0x2c')](_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x2c')]);}_0x125e79[_0xcf98('0x43')]=qs['sort'](_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x44')]);_0x125e79[_0xcf98('0x45')]=qs['filters'](_[_0xcf98('0x46')](_0x5bb871['query'],_0x3cc98f[_0xcf98('0x3c')]),_0x545410);if(_0x5bb871['query'][_0xcf98('0x47')]){_0x125e79[_0xcf98('0x45')]=_[_0xcf98('0x48')](_0x125e79[_0xcf98('0x45')],{'$or':_['map'](_0x545410,function(_0x4c3874){if(_0x4c3874[_0xcf98('0x38')]!==_0xcf98('0x49')){var _0x2905a8={};_0x2905a8[_0x4c3874[_0xcf98('0x33')]]={'$like':'%'+_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x47')]+'%'};return _0x2905a8;}})});}_0x125e79=_[_0xcf98('0x48')]({},_0x125e79,_0x5bb871[_0xcf98('0x4a')]);var _0x28ec23={'where':_0x125e79['where']};return db[_0xcf98('0x4b')][_0xcf98('0x2b')](_0x28ec23)[_0xcf98('0x1c')](function(_0x4fcdcd){_0xdcdabd['count']=_0x4fcdcd;if(_0x5bb871[_0xcf98('0x3a')]['includeAll']){_0x125e79[_0xcf98('0x4c')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x125e79);})[_0xcf98('0x1c')](function(_0x5b98f7){_0xdcdabd['rows']=_0x5b98f7;return _0xdcdabd;})[_0xcf98('0x1c')](respondWithFilteredResult(_0x291868,_0x125e79))['catch'](handleError(_0x291868,null));};exports[_0xcf98('0x4d')]=function(_0x5487e9,_0x1156de){var _0x1f57cb={'raw':![],'where':{'id':_0x5487e9[_0xcf98('0x4e')]['id']}},_0x5c255f={};_0x5c255f[_0xcf98('0x39')]=_['keys'](db[_0xcf98('0x4b')]['rawAttributes']);_0x5c255f['query']=_[_0xcf98('0x3b')](_0x5487e9[_0xcf98('0x3a')]);_0x5c255f[_0xcf98('0x3c')]=_['intersection'](_0x5c255f[_0xcf98('0x39')],_0x5c255f[_0xcf98('0x3a')]);_0x1f57cb[_0xcf98('0x3f')]=_[_0xcf98('0x3d')](_0x5c255f['model'],qs[_0xcf98('0x3e')](_0x5487e9[_0xcf98('0x3a')]['fields']));_0x1f57cb['attributes']=_0x1f57cb[_0xcf98('0x3f')]['length']?_0x1f57cb[_0xcf98('0x3f')]:_0x5c255f[_0xcf98('0x39')];if(_0x5487e9['query']['includeAll']){_0x1f57cb['include']=[{'all':!![]}];}_0x1f57cb=_[_0xcf98('0x48')]({},_0x1f57cb,_0x5487e9[_0xcf98('0x4a')]);return db[_0xcf98('0x4b')]['find'](_0x1f57cb)[_0xcf98('0x1c')](handleEntityNotFound(_0x1156de,null))['then'](respondWithResult(_0x1156de,null))['catch'](handleError(_0x1156de,null));};exports[_0xcf98('0x31')]=function(_0x1558ba,_0x927283){if(_0x1558ba[_0xcf98('0x4f')]['id']){delete _0x1558ba['body']['id'];}return db[_0xcf98('0x4b')][_0xcf98('0x50')]({'where':{'id':_0x1558ba[_0xcf98('0x4e')]['id']}})['then'](handleEntityNotFound(_0x927283,null))[_0xcf98('0x1c')](saveUpdates(_0x1558ba[_0xcf98('0x4f')],null))[_0xcf98('0x1c')](respondWithResult(_0x927283,null))[_0xcf98('0x26')](handleError(_0x927283,null));};exports[_0xcf98('0x51')]=function(_0x13647d,_0x1be3b4,_0xbfd029){if(_0x13647d[_0xcf98('0x52')]&&_0x13647d[_0xcf98('0x52')][_0xcf98('0x53')]){_0x13647d[_0xcf98('0x4f')]['logo']=_0x13647d['file']['filename'];}return db[_0xcf98('0x4b')][_0xcf98('0x50')]({'where':{'id':_0x13647d[_0xcf98('0x4e')]['id']}})[_0xcf98('0x1c')](handleEntityNotFound(_0x1be3b4,null))[_0xcf98('0x1c')](saveUpdates(_0x13647d[_0xcf98('0x4f')],null))['then'](respondWithResult(_0x1be3b4,null))[_0xcf98('0x26')](handleError(_0x1be3b4,null));};exports['addLogoLogin']=function(_0x25c664,_0x2b8ae8,_0x21dcfe){if(_0x25c664[_0xcf98('0x52')]&&_0x25c664['file'][_0xcf98('0x53')]){_0x25c664[_0xcf98('0x4f')][_0xcf98('0x54')]=_0x25c664[_0xcf98('0x52')][_0xcf98('0x53')];}return db['Setting']['find']({'where':{'id':_0x25c664[_0xcf98('0x4e')]['id']}})[_0xcf98('0x1c')](handleEntityNotFound(_0x2b8ae8,null))[_0xcf98('0x1c')](saveUpdates(_0x25c664['body'],null))['then'](respondWithResult(_0x2b8ae8,null))[_0xcf98('0x26')](handleError(_0x2b8ae8,null));};var utilLicense=require(_0xcf98('0x16'));exports[_0xcf98('0x55')]=function(_0x42581d,_0x2a6b5d,_0x1b1cae){var _0x487257=_0xcf98('0x56');var _0x277442={'custom':![]};return utilLicense[_0xcf98('0x57')]()[_0xcf98('0x1c')](function(_0xb3ae89){if(_0xb3ae89){_0x277442=_0xb3ae89;}return db['Setting'][_0xcf98('0x50')]({'where':{'id':_0x42581d[_0xcf98('0x4e')]['id']},'attributes':[_0xcf98('0x58'),_0xcf98('0x54'),_0xcf98('0x59'),'favicon',_0xcf98('0x5a'),_0xcf98('0x5b'),_0xcf98('0x5c'),_0xcf98('0x5d')],'raw':!![]});})[_0xcf98('0x1c')](handleEntityNotFound(_0x2a6b5d,null))[_0xcf98('0x1c')](function(_0xe6a173){if(_0xe6a173){var _0x2f38f1=_0xe6a173[_0xcf98('0x58')]&&fs[_0xcf98('0x5e')](path[_0xcf98('0x5f')](config['root'],_0x487257,_[_0xcf98('0x60')](_0xe6a173[_0xcf98('0x58')])))?path[_0xcf98('0x5f')](config['root'],_0x487257,_[_0xcf98('0x60')](_0xe6a173[_0xcf98('0x58')])):path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x487257,_['toLower'](_0xcf98('0x62')));var _0x259008=_0xcf98('0x63')+_[_0xcf98('0x64')]('logo');if(_0xe6a173[_0x259008]||!_0x277442['custom']){_0x2f38f1=path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x487257,_[_0xcf98('0x60')](_0xcf98('0x62')));}if(!fs[_0xcf98('0x5e')](_0x2f38f1)){throw new db[(_0xcf98('0x65'))][(_0xcf98('0x66'))](_[_0xcf98('0x64')](_0xcf98('0x58'))+_0xcf98('0x67'));}return _0x2a6b5d[_0xcf98('0x68')](_0x2f38f1);}})[_0xcf98('0x26')](handleError(_0x2a6b5d,null));};var utilLicense=require(_0xcf98('0x16'));exports[_0xcf98('0x69')]=function(_0x1431d6,_0x2a8028,_0x591c19){var _0x35b78b=_0xcf98('0x56');var _0x5f0d02={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x577e41){if(_0x577e41){_0x5f0d02=_0x577e41;}return db[_0xcf98('0x4b')]['find']({'where':{'id':_0x1431d6['params']['id']},'attributes':[_0xcf98('0x58'),_0xcf98('0x54'),_0xcf98('0x59'),_0xcf98('0x6a'),_0xcf98('0x5a'),_0xcf98('0x5b'),'defaultPreferred',_0xcf98('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x2a8028,null))[_0xcf98('0x1c')](function(_0x5bccc8){if(_0x5bccc8){var _0x4c7e10=_0x5bccc8[_0xcf98('0x54')]&&fs['existsSync'](path['join'](config['root'],_0x35b78b,_[_0xcf98('0x60')](_0x5bccc8[_0xcf98('0x54')])))?path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x35b78b,_['toLower'](_0x5bccc8['loginLogo'])):path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x35b78b,_[_0xcf98('0x60')]('default_loginLogo.svg'));var _0x5d2053=_0xcf98('0x63')+_[_0xcf98('0x64')](_0xcf98('0x54'));if(_0x5bccc8[_0x5d2053]||!_0x5f0d02[_0xcf98('0x6b')]){_0x4c7e10=path['join'](config['root'],_0x35b78b,_['toLower'](_0xcf98('0x6c')));}if(!fs[_0xcf98('0x5e')](_0x4c7e10)){throw new db[(_0xcf98('0x65'))]['ValidationError'](_[_0xcf98('0x64')](_0xcf98('0x54'))+'\x20not\x20found');}return _0x2a8028[_0xcf98('0x68')](_0x4c7e10);}})['catch'](handleError(_0x2a8028,null));};exports[_0xcf98('0x6d')]=function(_0x264b18,_0x52286f){return db[_0xcf98('0x4b')][_0xcf98('0x50')]({'where':{'id':_0x264b18[_0xcf98('0x4e')]['id']},'attributes':[_0xcf98('0x6e')]})[_0xcf98('0x1c')](respondWithResult(_0x52286f,null))[_0xcf98('0x26')](handleError(_0x52286f,null));};exports[_0xcf98('0x6f')]=function(_0x89b95e,_0x4503c7,_0x1b8f5f){if(_0x89b95e['file']&&_0x89b95e[_0xcf98('0x52')][_0xcf98('0x53')]){_0x89b95e['body']['preferred']=_0x89b95e['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x89b95e[_0xcf98('0x4e')]['id']}})[_0xcf98('0x1c')](handleEntityNotFound(_0x4503c7,null))['then'](saveUpdates(_0x89b95e[_0xcf98('0x4f')],null))['then'](respondWithResult(_0x4503c7,null))[_0xcf98('0x26')](handleError(_0x4503c7,null));};var utilLicense=require(_0xcf98('0x16'));exports[_0xcf98('0x70')]=function(_0x45df98,_0x3c0249,_0x369fa8){var _0x48f474=_0xcf98('0x56');var _0x3bddf3={'custom':![]};return utilLicense[_0xcf98('0x57')]()[_0xcf98('0x1c')](function(_0x4ef979){if(_0x4ef979){_0x3bddf3=_0x4ef979;}return db[_0xcf98('0x4b')][_0xcf98('0x50')]({'where':{'id':_0x45df98[_0xcf98('0x4e')]['id']},'attributes':[_0xcf98('0x58'),_0xcf98('0x54'),_0xcf98('0x59'),_0xcf98('0x6a'),_0xcf98('0x5a'),_0xcf98('0x5b'),_0xcf98('0x5c'),_0xcf98('0x5d')],'raw':!![]});})[_0xcf98('0x1c')](handleEntityNotFound(_0x3c0249,null))['then'](function(_0x4bcae4){if(_0x4bcae4){var _0x424dc3=_0x4bcae4[_0xcf98('0x59')]&&fs[_0xcf98('0x5e')](path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x48f474,_[_0xcf98('0x60')](_0x4bcae4[_0xcf98('0x59')])))?path[_0xcf98('0x5f')](config['root'],_0x48f474,_[_0xcf98('0x60')](_0x4bcae4[_0xcf98('0x59')])):path[_0xcf98('0x5f')](config['root'],_0x48f474,_[_0xcf98('0x60')](_0xcf98('0x71')));var _0x1f6a8a=_0xcf98('0x63')+_[_0xcf98('0x64')](_0xcf98('0x59'));if(_0x4bcae4[_0x1f6a8a]||!_0x3bddf3[_0xcf98('0x6b')]||!_0x3bddf3['preferred']){_0x424dc3=path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x48f474,_[_0xcf98('0x60')](_0xcf98('0x71')));}if(!fs['existsSync'](_0x424dc3)){throw new db[(_0xcf98('0x65'))][(_0xcf98('0x66'))](_[_0xcf98('0x64')]('preferred')+_0xcf98('0x67'));}return _0x3c0249[_0xcf98('0x68')](_0x424dc3);}})[_0xcf98('0x26')](handleError(_0x3c0249,null));};exports[_0xcf98('0x72')]=function(_0x5e98e1,_0x52fd02,_0x3c8089){if(_0x5e98e1[_0xcf98('0x52')]&&_0x5e98e1[_0xcf98('0x52')][_0xcf98('0x53')]){_0x5e98e1['body'][_0xcf98('0x6a')]=_0x5e98e1[_0xcf98('0x52')][_0xcf98('0x53')];}return db['Setting'][_0xcf98('0x50')]({'where':{'id':_0x5e98e1[_0xcf98('0x4e')]['id']}})[_0xcf98('0x1c')](handleEntityNotFound(_0x52fd02,null))[_0xcf98('0x1c')](saveUpdates(_0x5e98e1[_0xcf98('0x4f')],null))[_0xcf98('0x1c')](respondWithResult(_0x52fd02,null))[_0xcf98('0x26')](handleError(_0x52fd02,null));};var utilLicense=require(_0xcf98('0x16'));exports[_0xcf98('0x73')]=function(_0xe174dd,_0xfe207f,_0x222a5e){var _0x4ff2f3=_0xcf98('0x56');var _0x347fd5={'custom':![]};return utilLicense[_0xcf98('0x57')]()[_0xcf98('0x1c')](function(_0x3c45eb){if(_0x3c45eb){_0x347fd5=_0x3c45eb;}return db['Setting'][_0xcf98('0x50')]({'where':{'id':_0xe174dd[_0xcf98('0x4e')]['id']},'attributes':[_0xcf98('0x58'),_0xcf98('0x54'),_0xcf98('0x59'),_0xcf98('0x6a'),'defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xcf98('0x1c')](handleEntityNotFound(_0xfe207f,null))[_0xcf98('0x1c')](function(_0x109b40){if(_0x109b40){var _0x2893bc=_0x109b40[_0xcf98('0x6a')]&&fs['existsSync'](path['join'](config['root'],_0x4ff2f3,_[_0xcf98('0x60')](_0x109b40['favicon'])))?path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x4ff2f3,_[_0xcf98('0x60')](_0x109b40['favicon'])):path['join'](config['root'],_0x4ff2f3,_[_0xcf98('0x60')](_0xcf98('0x74')));var _0x2e1c1b='default'+_[_0xcf98('0x64')](_0xcf98('0x6a'));if(_0x109b40[_0x2e1c1b]||!_0x347fd5['custom']){_0x2893bc=path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x4ff2f3,_[_0xcf98('0x60')]('default_favicon.ico'));}if(!fs['existsSync'](_0x2893bc)){throw new db[(_0xcf98('0x65'))][(_0xcf98('0x66'))](_[_0xcf98('0x64')](_0xcf98('0x6a'))+_0xcf98('0x67'));}return _0xfe207f[_0xcf98('0x68')](_0x2893bc);}})[_0xcf98('0x26')](handleError(_0xfe207f,null));};exports['getDate']=function(_0x18adb3,_0x159d03){var _0x4bb7ec={'offset':moment()[_0xcf98('0x75')]()};_0x4bb7ec[_0xcf98('0x76')]=moment()[_0xcf98('0x75')](_0x4bb7ec[_0xcf98('0x2c')])[_0xcf98('0x77')](_0xcf98('0x78'));return _0x159d03[_0xcf98('0x28')](0xc8)['send'](_0x4bb7ec);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index d455dcc..e7d8998 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2f8=['request-promise','path','rimraf','../../config/environment','exports','define','Setting','settings','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3c45f8,_0x29a056){var _0x5f282e=function(_0x1510b0){while(--_0x1510b0){_0x3c45f8['push'](_0x3c45f8['shift']());}};_0x5f282e(++_0x29a056);}(_0xf2f8,0x1b5));var _0x8f2f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xf2f8[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x8f2f('0x0'));var util=require(_0x8f2f('0x1'));var logger=require(_0x8f2f('0x2'))('api');var moment=require(_0x8f2f('0x3'));var BPromise=require(_0x8f2f('0x4'));var rp=require(_0x8f2f('0x5'));var fs=require('fs');var path=require(_0x8f2f('0x6'));var rimraf=require(_0x8f2f('0x7'));var config=require(_0x8f2f('0x8'));var attributes=require('./setting.attributes');module[_0x8f2f('0x9')]=function(_0x2ceae1,_0x497d7c){return _0x2ceae1[_0x8f2f('0xa')](_0x8f2f('0xb'),attributes,{'tableName':_0x8f2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd69b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./setting.attributes','exports','define','Setting','util'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0xd69b,0x137));var _0xbd69=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xd69b[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require('lodash');var util=require(_0xbd69('0x0'));var logger=require(_0xbd69('0x1'))(_0xbd69('0x2'));var moment=require(_0xbd69('0x3'));var BPromise=require(_0xbd69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd69('0x5'));var rimraf=require(_0xbd69('0x6'));var config=require(_0xbd69('0x7'));var attributes=require(_0xbd69('0x8'));module[_0xbd69('0x9')]=function(_0x2b93c0,_0x355a17){return _0x2b93c0[_0xbd69('0xa')](_0xbd69('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 072e64a..7f0a922 100644 --- a/server/api/setting/setting.rpc.js +++ b/server/api/setting/setting.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99c8=['Setting,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code'];(function(_0xd20b19,_0x467e87){var _0x99a02e=function(_0x2b9b43){while(--_0x2b9b43){_0xd20b19['push'](_0xd20b19['shift']());}};_0x99a02e(++_0x467e87);}(_0x99c8,0x65));var _0x899c=function(_0x23c94d,_0xcb5c2f){_0x23c94d=_0x23c94d-0x0;var _0x30af37=_0x99c8[_0x23c94d];return _0x30af37;};'use strict';var _=require(_0x899c('0x0'));var util=require(_0x899c('0x1'));var moment=require(_0x899c('0x2'));var BPromise=require(_0x899c('0x3'));var rs=require(_0x899c('0x4'));var fs=require('fs');var Redis=require(_0x899c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x899c('0x6'));var logger=require(_0x899c('0x7'))(_0x899c('0x8'));var config=require(_0x899c('0x9'));var jayson=require(_0x899c('0xa'));var client=jayson[_0x899c('0xb')][_0x899c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a9783,_0x5852a8,_0x57e5b8){return new BPromise(function(_0x56887d,_0x4abf4d){return client['request'](_0x5a9783,_0x57e5b8)[_0x899c('0xd')](function(_0xc91479){logger['info']('Setting,\x20%s,\x20%s',_0x5852a8,_0x899c('0xe'));logger[_0x899c('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x5852a8,_0x899c('0xe'),JSON[_0x899c('0x10')](_0xc91479));if(_0xc91479['error']){if(_0xc91479[_0x899c('0x11')][_0x899c('0x12')]===0x1f4){logger[_0x899c('0x11')](_0x899c('0x13'),_0x5852a8,_0xc91479['error'][_0x899c('0x14')]);return _0x4abf4d(_0xc91479[_0x899c('0x11')][_0x899c('0x14')]);}logger[_0x899c('0x11')](_0x899c('0x13'),_0x5852a8,_0xc91479[_0x899c('0x11')]['message']);return _0x56887d(_0xc91479[_0x899c('0x11')][_0x899c('0x14')]);}else{logger[_0x899c('0x15')]('Setting,\x20%s,\x20%s',_0x5852a8,_0x899c('0xe'));_0x56887d(_0xc91479[_0x899c('0x16')][_0x899c('0x14')]);}})[_0x899c('0x17')](function(_0x346b36){logger[_0x899c('0x11')](_0x899c('0x13'),_0x5852a8,_0x346b36);_0x4abf4d(_0x346b36);});});} \ No newline at end of file +var _0x6164=['client','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Setting,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4dd745,_0x19b66e){var _0x5893b1=function(_0x18deb3){while(--_0x18deb3){_0x4dd745['push'](_0x4dd745['shift']());}};_0x5893b1(++_0x19b66e);}(_0x6164,0x74));var _0x4616=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0x6164[_0x919445];return _0x511b3e;};'use strict';var _=require(_0x4616('0x0'));var util=require(_0x4616('0x1'));var moment=require(_0x4616('0x2'));var BPromise=require(_0x4616('0x3'));var rs=require(_0x4616('0x4'));var fs=require('fs');var Redis=require(_0x4616('0x5'));var db=require(_0x4616('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4616('0x7'))('rpc');var config=require(_0x4616('0x8'));var jayson=require(_0x4616('0x9'));var client=jayson[_0x4616('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24af69,_0x4b638f,_0x4bc0d0){return new BPromise(function(_0x830b24,_0x2f3bf6){return client['request'](_0x24af69,_0x4bc0d0)['then'](function(_0x2d14e9){logger['info']('Setting,\x20%s,\x20%s',_0x4b638f,_0x4616('0xb'));logger[_0x4616('0xc')](_0x4616('0xd'),_0x4b638f,_0x4616('0xb'),JSON[_0x4616('0xe')](_0x2d14e9));if(_0x2d14e9[_0x4616('0xf')]){if(_0x2d14e9['error'][_0x4616('0x10')]===0x1f4){logger[_0x4616('0xf')]('Setting,\x20%s,\x20%s',_0x4b638f,_0x2d14e9[_0x4616('0xf')][_0x4616('0x11')]);return _0x2f3bf6(_0x2d14e9[_0x4616('0xf')][_0x4616('0x11')]);}logger['error']('Setting,\x20%s,\x20%s',_0x4b638f,_0x2d14e9[_0x4616('0xf')]['message']);return _0x830b24(_0x2d14e9['error'][_0x4616('0x11')]);}else{logger[_0x4616('0x12')](_0x4616('0x13'),_0x4b638f,_0x4616('0xb'));_0x830b24(_0x2d14e9[_0x4616('0x14')][_0x4616('0x11')]);}})['catch'](function(_0x154866){logger[_0x4616('0xf')](_0x4616('0x13'),_0x4b638f,_0x154866);_0x2f3bf6(_0x154866);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b567df3..adfcc06 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['/:id/notify','notify','/:id/send','status','/:id/users','addAgents','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/status','getAgents','post','create','addDisposition','addAnswer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x7')](_0x3071('0x10'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x7')](_0x3071('0x12'),auth[_0x3071('0x8')](),controller[_0x3071('0x13')]);router['get']('/:id/interactions',auth[_0x3071('0x8')](),controller['getInteractions']);router[_0x3071('0x7')](_0x3071('0x14'),controller['statusGet']);router[_0x3071('0x7')]('/:id/users',auth[_0x3071('0x8')](),controller[_0x3071('0x15')]);router[_0x3071('0x16')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x17')]);router[_0x3071('0x16')](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0x18')]);router[_0x3071('0x16')]('/:id/canned_answers',auth[_0x3071('0x8')](),controller[_0x3071('0x19')]);router[_0x3071('0x16')](_0x3071('0x1a'),controller[_0x3071('0x1b')]);router[_0x3071('0x16')](_0x3071('0x12'),auth[_0x3071('0x8')](),controller['addApplications']);router[_0x3071('0x16')](_0x3071('0x1c'),auth[_0x3071('0x8')](),controller['send']);router[_0x3071('0x16')]('/:id/status',controller[_0x3071('0x1d')]);router[_0x3071('0x16')](_0x3071('0x1e'),auth[_0x3071('0x8')](),controller[_0x3071('0x1f')]);router[_0x3071('0x20')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller['update']);router['delete'](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x21')]);router[_0x3071('0x22')](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0x23')]);router[_0x3071('0x22')](_0x3071('0x10'),auth['isAuthenticated'](),controller[_0x3071('0x24')]);router[_0x3071('0x22')](_0x3071('0x1e'),auth['isAuthenticated'](),controller[_0x3071('0x25')]);module[_0x3071('0x26')]=router; \ No newline at end of file +var _0xe706=['getInteractions','/:id/users','post','addDisposition','/:id/notify','addApplications','/:id/send','send','/:id/status','status','addAgents','update','delete','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions'];(function(_0x446a54,_0x25dc8a){var _0x28df98=function(_0x5d74e8){while(--_0x5d74e8){_0x446a54['push'](_0x446a54['shift']());}};_0x28df98(++_0x25dc8a);}(_0xe706,0xa3));var _0x6e70=function(_0x41a93b,_0x2fc19d){_0x41a93b=_0x41a93b-0x0;var _0x220a7e=_0xe706[_0x41a93b];return _0x220a7e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x9')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller['getAnswers']);router['get'](_0x6e70('0x13'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x9')](_0x6e70('0x15'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x9')]('/:id/status',controller['statusGet']);router['get'](_0x6e70('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6e70('0x18')]('/',auth[_0x6e70('0xa')](),controller['create']);router[_0x6e70('0x18')]('/:id/dispositions',auth[_0x6e70('0xa')](),controller[_0x6e70('0x19')]);router['post']('/:id/canned_answers',auth[_0x6e70('0xa')](),controller['addAnswer']);router[_0x6e70('0x18')](_0x6e70('0x1a'),controller['notify']);router['post'](_0x6e70('0x13'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x1b')]);router[_0x6e70('0x18')](_0x6e70('0x1c'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x1d')]);router[_0x6e70('0x18')](_0x6e70('0x1e'),controller[_0x6e70('0x1f')]);router['post'](_0x6e70('0x17'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x20')]);router['put'](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x21')]);router['delete'](_0x6e70('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller['removeDispositions']);router[_0x6e70('0x22')](_0x6e70('0x12'),auth['isAuthenticated'](),controller[_0x6e70('0x23')]);router[_0x6e70('0x22')](_0x6e70('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6e70('0x24')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 263bff4..37c3d80 100644 --- a/server/api/smsAccount/smsAccount.attributes.js +++ b/server/api/smsAccount/smsAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc706=['clicksend','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc706,0x97));var _0x6c70=function(_0x248553,_0x22ff05){_0x248553=_0x248553-0x0;var _0x34e3bd=_0xc706[_0x248553];return _0x34e3bd;};'use strict';var Sequelize=require(_0x6c70('0x0'));var rs=require(_0x6c70('0x1'));module[_0x6c70('0x2')]={'name':{'type':Sequelize[_0x6c70('0x3')],'unique':_0x6c70('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x6c70('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6c70('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6c70('0x3')],'defaultValue':function(){return rs[_0x6c70('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6c70('0x6')](_0x6c70('0x7'),_0x6c70('0x8'),_0x6c70('0x9'),_0x6c70('0xa'),_0x6c70('0xb'),_0x6c70('0xc'),_0x6c70('0xd'),_0x6c70('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0x6c70('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6c70('0x3')]},'smsMethod':{'type':Sequelize[_0x6c70('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6c70('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x6c70('0x3')]},'senderString':{'type':Sequelize[_0x6c70('0x3')]},'deliveryReport':{'type':Sequelize[_0x6c70('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x6c70('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6c70('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c70('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6c70('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6c70('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6c70('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6c70('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c70('0x11')],'comment':_0x6c70('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6c70('0xf')],'defaultValue':![],'comment':_0x6c70('0x13'),'set':function(_0x2a47b7){if(!_0x2a47b7)this[_0x6c70('0x14')](_0x6c70('0x15'),null);this[_0x6c70('0x14')](_0x6c70('0x16'),_0x2a47b7);}}}; \ No newline at end of file +var _0x5b3f=['INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','connectel','clicksend','plivo','clickatell','csc','intelepeer','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2dbb8a,_0x36d853){var _0x4774c5=function(_0xdef0f6){while(--_0xdef0f6){_0x2dbb8a['push'](_0x2dbb8a['shift']());}};_0x4774c5(++_0x36d853);}(_0x5b3f,0xa7));var _0xf5b3=function(_0x3c46d6,_0x365bb5){_0x3c46d6=_0x3c46d6-0x0;var _0x5ec4bd=_0x5b3f[_0x3c46d6];return _0x5ec4bd;};'use strict';var Sequelize=require(_0xf5b3('0x0'));var rs=require('randomstring');module[_0xf5b3('0x1')]={'name':{'type':Sequelize[_0xf5b3('0x2')],'unique':_0xf5b3('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf5b3('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xf5b3('0x2')],'defaultValue':function(){return rs[_0xf5b3('0x4')]();}},'phone':{'type':Sequelize[_0xf5b3('0x2')]},'type':{'type':Sequelize[_0xf5b3('0x5')]('twilio','skebby',_0xf5b3('0x6'),_0xf5b3('0x7'),_0xf5b3('0x8'),_0xf5b3('0x9'),_0xf5b3('0xa'),'infobip',_0xf5b3('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xf5b3('0x2')]},'authToken':{'type':Sequelize[_0xf5b3('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xf5b3('0x2')]},'password':{'type':Sequelize[_0xf5b3('0x2')]},'apiKey':{'type':Sequelize[_0xf5b3('0x2')]},'senderString':{'type':Sequelize[_0xf5b3('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xf5b3('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf5b3('0xc');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf5b3('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf5b3('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf5b3('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf5b3('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf5b3('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf5b3('0xd')],'comment':_0xf5b3('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf5b3('0x10'),'set':function(_0x3df45f){if(!_0x3df45f)this['setDataValue'](_0xf5b3('0x11'),null);this[_0xf5b3('0x12')](_0xf5b3('0x13'),_0x3df45f);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 41f58af..2f94584 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a32=['SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','Applications','account','applications','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','Body','messageId','MessageSid','sender','text','connectel','message_id','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','UserId','User','agent','waitForTheAssignedAgent','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','SmsApplication','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','defaults','out','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','skebby','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','clickatell','redif','inspect','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','destroy','get'];(function(_0xbadfa,_0x229aa0){var _0xfc4a25=function(_0x14cf37){while(--_0x14cf37){_0xbadfa['push'](_0xbadfa['shift']());}};_0xfc4a25(++_0x229aa0);}(_0x2a32,0x19a));var _0x22a3=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0x2a32[_0xfd9b19];return _0x514918;};'use strict';var pdf=require(_0x22a3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x22a3('0x1'));var zipdir=require(_0x22a3('0x2'));var jsonpatch=require(_0x22a3('0x3'));var rp=require(_0x22a3('0x4'));var moment=require(_0x22a3('0x5'));var BPromise=require(_0x22a3('0x6'));var Mustache=require(_0x22a3('0x7'));var util=require('util');var path=require(_0x22a3('0x8'));var sox=require(_0x22a3('0x9'));var csv=require(_0x22a3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x22a3('0xb'));var squel=require(_0x22a3('0xc'));var crypto=require('crypto');var jsforce=require(_0x22a3('0xd'));var deskjs=require(_0x22a3('0xe'));var toCsv=require(_0x22a3('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x22a3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x22a3('0x10'));var as=require(_0x22a3('0x11'));var hardwareService=require(_0x22a3('0x12'));var logger=require(_0x22a3('0x13'))(_0x22a3('0x14'));var utils=require(_0x22a3('0x15'));var config=require(_0x22a3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x22a3('0x17'))['db'];config[_0x22a3('0x18')]=_['defaults'](config[_0x22a3('0x18')],{'host':_0x22a3('0x19'),'port':0x18eb});var socket=require(_0x22a3('0x1a'))(new Redis(config[_0x22a3('0x18')]));require('./smsAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x22a3('0x1b')][_0x22a3('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x2ac8d0,_0x1763dc,_0x126c8c,_0x59acda){return new BPromise(function(_0x23e223,_0x226e4c){var _0x3d6c37=_0x59acda||client;return _0x3d6c37[_0x22a3('0x1d')](_0x2ac8d0,_0x126c8c)[_0x22a3('0x1e')](function(_0x32e597){logger[_0x22a3('0x1f')](_0x22a3('0x20'),_0x1763dc,_0x22a3('0x21'));logger[_0x22a3('0x22')](_0x22a3('0x23'),_0x1763dc,'request\x20sent',JSON['stringify'](_0x32e597));if(_0x32e597[_0x22a3('0x24')]){if(_0x32e597['error']['code']===0x1f4){logger[_0x22a3('0x24')]('SmsAccount,\x20%s,\x20%s',_0x1763dc,_0x32e597[_0x22a3('0x24')][_0x22a3('0x25')]);return _0x226e4c(_0x32e597[_0x22a3('0x24')][_0x22a3('0x25')]);}logger[_0x22a3('0x24')](_0x22a3('0x20'),_0x1763dc,_0x32e597[_0x22a3('0x24')][_0x22a3('0x25')]);return _0x23e223(_0x32e597[_0x22a3('0x24')][_0x22a3('0x25')]);}else{logger[_0x22a3('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x1763dc,_0x22a3('0x21'));_0x23e223(_0x32e597[_0x22a3('0x26')][_0x22a3('0x25')]);}})[_0x22a3('0x27')](function(_0xe2172f){logger[_0x22a3('0x24')]('SmsAccount,\x20%s,\x20%s',_0x1763dc,_0xe2172f);_0x226e4c(_0xe2172f);});});}function respondWithStatusCode(_0x68c00b,_0x11f436){_0x11f436=_0x11f436||0xcc;return function(_0x5800fe){if(_0x5800fe){return _0x68c00b[_0x22a3('0x28')](_0x11f436);}return _0x68c00b['status'](_0x11f436)[_0x22a3('0x29')]();};}function respondWithResult(_0x2c131c,_0x37a04f){_0x37a04f=_0x37a04f||0xc8;return function(_0x800dfc){if(_0x800dfc){return _0x2c131c[_0x22a3('0x2a')](_0x37a04f)[_0x22a3('0x2b')](_0x800dfc);}};}function respondWithFilteredResult(_0x4db94e,_0x1b5b6c){return function(_0x2b4424){if(_0x2b4424){var _0x118dc3=_0x2b4424['count'],_0x2a7cea=_0x1b5b6c[_0x22a3('0x2c')],_0x3998d2=_0x1b5b6c[_0x22a3('0x2c')]+_0x1b5b6c['limit'],_0x48169f;if(_0x3998d2>=_0x118dc3){_0x3998d2=_0x118dc3;_0x48169f=0xc8;}else{_0x48169f=0xce;}_0x4db94e['status'](_0x48169f);return _0x4db94e[_0x22a3('0x2d')](_0x22a3('0x2e'),_0x2a7cea+'-'+_0x3998d2+'/'+_0x118dc3)['json'](_0x2b4424);}return null;};}function patchUpdates(_0x3bc664){return function(_0x43f1b7){try{jsonpatch[_0x22a3('0x2f')](_0x43f1b7,_0x3bc664,!![]);}catch(_0x525749){return BPromise[_0x22a3('0x30')](_0x525749);}return _0x43f1b7[_0x22a3('0x31')]();};}function saveUpdates(_0x3ad375,_0x2c60c4){return function(_0x12e8c5){if(_0x12e8c5){return _0x12e8c5['update'](_0x3ad375)[_0x22a3('0x1e')](function(_0x52045c){return _0x52045c;});}return null;};}function removeEntity(_0x5f24f1,_0x18ef78){return function(_0x285ebe){if(_0x285ebe){return _0x285ebe[_0x22a3('0x32')]()[_0x22a3('0x1e')](function(){var _0x3b3748=_0x285ebe[_0x22a3('0x33')]({'plain':!![]});var _0x4272ae=_0x22a3('0x34');return db[_0x22a3('0x35')][_0x22a3('0x32')]({'where':{'type':_0x4272ae,'resourceId':_0x3b3748['id']}})[_0x22a3('0x1e')](function(){return _0x285ebe;});})[_0x22a3('0x1e')](function(){_0x5f24f1[_0x22a3('0x2a')](0xcc)[_0x22a3('0x29')]();});}};}function handleEntityNotFound(_0x1de836,_0x519066){return function(_0x3cd7db){if(!_0x3cd7db){_0x1de836[_0x22a3('0x28')](0x194);}return _0x3cd7db;};}function handleError(_0x384871,_0x23251e){_0x23251e=_0x23251e||0x1f4;return function(_0x2b5443){logger[_0x22a3('0x24')](_0x2b5443[_0x22a3('0x36')]);if(_0x2b5443[_0x22a3('0x37')]){delete _0x2b5443['name'];}_0x384871[_0x22a3('0x2a')](_0x23251e)[_0x22a3('0x38')](_0x2b5443);};}exports[_0x22a3('0x39')]=function(_0x1156a6,_0x3f9fb7){var _0x34f76a={'include':[{'model':db[_0x22a3('0x3a')],'as':_0x22a3('0x3b')}]},_0x13c462={},_0x2d7489={'count':0x0,'rows':[]};var _0x514c06=_[_0x22a3('0x3c')](db[_0x22a3('0x3d')][_0x22a3('0x3e')],function(_0x22d8fb){return{'name':_0x22d8fb[_0x22a3('0x3f')],'type':_0x22d8fb[_0x22a3('0x40')][_0x22a3('0x41')]};});_0x13c462[_0x22a3('0x42')]=_[_0x22a3('0x3c')](_0x514c06,'name');_0x13c462[_0x22a3('0x43')]=_[_0x22a3('0x44')](_0x1156a6[_0x22a3('0x43')]);_0x13c462[_0x22a3('0x45')]=_[_0x22a3('0x46')](_0x13c462[_0x22a3('0x42')],_0x13c462[_0x22a3('0x43')]);_0x34f76a[_0x22a3('0x47')]=_[_0x22a3('0x46')](_0x13c462[_0x22a3('0x42')],qs['fields'](_0x1156a6[_0x22a3('0x43')][_0x22a3('0x48')]));_0x34f76a[_0x22a3('0x47')]=_0x34f76a['attributes']['length']?_0x34f76a[_0x22a3('0x47')]:_0x13c462[_0x22a3('0x42')];if(!_0x1156a6[_0x22a3('0x43')][_0x22a3('0x49')](_0x22a3('0x4a'))){_0x34f76a[_0x22a3('0x4b')]=qs[_0x22a3('0x4b')](_0x1156a6[_0x22a3('0x43')][_0x22a3('0x4b')]);_0x34f76a[_0x22a3('0x2c')]=qs['offset'](_0x1156a6['query'][_0x22a3('0x2c')]);}_0x34f76a[_0x22a3('0x4c')]=qs[_0x22a3('0x4d')](_0x1156a6['query'][_0x22a3('0x4d')]);_0x34f76a['where']=qs['filters'](_[_0x22a3('0x4e')](_0x1156a6[_0x22a3('0x43')],_0x13c462['filters']),_0x514c06);if(_0x1156a6['query']['filter']){_0x34f76a[_0x22a3('0x4f')]=_[_0x22a3('0x50')](_0x34f76a[_0x22a3('0x4f')],{'$or':_[_0x22a3('0x3c')](_0x514c06,function(_0x57fe24){if(_0x57fe24[_0x22a3('0x40')]!==_0x22a3('0x51')){var _0xeb4c7a={};_0xeb4c7a[_0x57fe24[_0x22a3('0x37')]]={'$like':'%'+_0x1156a6[_0x22a3('0x43')][_0x22a3('0x52')]+'%'};return _0xeb4c7a;}})});}_0x34f76a=_[_0x22a3('0x50')]({},_0x34f76a,_0x1156a6[_0x22a3('0x53')]);var _0x326993={'where':_0x34f76a[_0x22a3('0x4f')]};return db[_0x22a3('0x3d')][_0x22a3('0x54')](_0x326993)['then'](function(_0x534ea6){_0x2d7489[_0x22a3('0x54')]=_0x534ea6;if(_0x1156a6['query'][_0x22a3('0x55')]){_0x34f76a[_0x22a3('0x56')]=[{'all':!![]}];}return db[_0x22a3('0x3d')][_0x22a3('0x57')](_0x34f76a);})[_0x22a3('0x1e')](function(_0x19b4b7){_0x2d7489[_0x22a3('0x58')]=_0x19b4b7;return _0x2d7489;})['then'](respondWithFilteredResult(_0x3f9fb7,_0x34f76a))[_0x22a3('0x27')](handleError(_0x3f9fb7,null));};exports[_0x22a3('0x59')]=function(_0x49f8ff,_0x467d9a){var _0x35e8b5={'raw':![],'where':{'id':_0x49f8ff[_0x22a3('0x5a')]['id']},'include':[{'model':db[_0x22a3('0x3a')],'as':_0x22a3('0x3b')}]},_0x142c24={};_0x142c24[_0x22a3('0x42')]=_[_0x22a3('0x44')](db[_0x22a3('0x3d')]['rawAttributes']);_0x142c24[_0x22a3('0x43')]=_[_0x22a3('0x44')](_0x49f8ff[_0x22a3('0x43')]);_0x142c24[_0x22a3('0x45')]=_['intersection'](_0x142c24[_0x22a3('0x42')],_0x142c24[_0x22a3('0x43')]);_0x35e8b5[_0x22a3('0x47')]=_[_0x22a3('0x46')](_0x142c24[_0x22a3('0x42')],qs[_0x22a3('0x48')](_0x49f8ff[_0x22a3('0x43')][_0x22a3('0x48')]));_0x35e8b5[_0x22a3('0x47')]=_0x35e8b5[_0x22a3('0x47')][_0x22a3('0x5b')]?_0x35e8b5[_0x22a3('0x47')]:_0x142c24[_0x22a3('0x42')];if(_0x49f8ff['query'][_0x22a3('0x55')]){_0x35e8b5[_0x22a3('0x56')]=[{'all':!![]}];}_0x35e8b5=_[_0x22a3('0x50')]({},_0x35e8b5,_0x49f8ff['options']);return db['SmsAccount'][_0x22a3('0x5c')](_0x35e8b5)['then'](handleEntityNotFound(_0x467d9a,null))['then'](respondWithResult(_0x467d9a,null))[_0x22a3('0x27')](handleError(_0x467d9a,null));};exports[_0x22a3('0x5d')]=function(_0x2a3580,_0x427122){return db[_0x22a3('0x3d')][_0x22a3('0x5d')](_0x2a3580['body'],{})['then'](function(_0x40ce0f){var _0x43774b=_0x2a3580[_0x22a3('0x5e')][_0x22a3('0x33')]({'plain':!![]});if(!_0x43774b)throw new Error(_0x22a3('0x5f'));if(_0x43774b[_0x22a3('0x60')]===_0x22a3('0x5e')){var _0x314d52=_0x40ce0f[_0x22a3('0x33')]({'plain':!![]});var _0x1632ab=_0x22a3('0x34');return db[_0x22a3('0x61')][_0x22a3('0x5c')]({'where':{'name':_0x1632ab,'userProfileId':_0x43774b[_0x22a3('0x62')]},'raw':!![]})['then'](function(_0x4b5554){if(_0x4b5554&&_0x4b5554['autoAssociation']===0x0){return db['UserProfileResource'][_0x22a3('0x5d')]({'name':_0x314d52[_0x22a3('0x37')],'resourceId':_0x314d52['id'],'type':_0x4b5554[_0x22a3('0x37')],'sectionId':_0x4b5554['id']},{})[_0x22a3('0x1e')](function(){return _0x40ce0f;});}else{return _0x40ce0f;}})[_0x22a3('0x27')](function(_0x2891c6){logger[_0x22a3('0x24')](_0x22a3('0x63'),_0x2891c6);throw _0x2891c6;});}return _0x40ce0f;})['then'](respondWithResult(_0x427122,0xc9))[_0x22a3('0x27')](handleError(_0x427122,null));};exports[_0x22a3('0x64')]=function(_0x50cd57,_0x307d2b){if(_0x50cd57[_0x22a3('0x65')]['id']){delete _0x50cd57[_0x22a3('0x65')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x50cd57[_0x22a3('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x22a3('0x3b')}]})['then'](handleEntityNotFound(_0x307d2b,null))[_0x22a3('0x1e')](saveUpdates(_0x50cd57[_0x22a3('0x65')],null))[_0x22a3('0x1e')](respondWithResult(_0x307d2b,null))[_0x22a3('0x27')](handleError(_0x307d2b,null));};exports['destroy']=function(_0x391e7b,_0x55741b){return db[_0x22a3('0x3d')][_0x22a3('0x5c')]({'where':{'id':_0x391e7b[_0x22a3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x55741b,null))['then'](removeEntity(_0x55741b,null))['catch'](handleError(_0x55741b,null));};exports['describe']=function(_0x5b994b,_0x40b20b){return db[_0x22a3('0x3d')][_0x22a3('0x66')]()[_0x22a3('0x1e')](respondWithResult(_0x40b20b,null))[_0x22a3('0x27')](handleError(_0x40b20b,null));};exports[_0x22a3('0x67')]=function(_0x2493ca,_0x4fc897,_0x4ec3e1){if(_0x2493ca[_0x22a3('0x65')]['id']){delete _0x2493ca[_0x22a3('0x65')]['id'];}return db[_0x22a3('0x3d')][_0x22a3('0x5c')]({'where':{'id':_0x2493ca[_0x22a3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4fc897,null))['then'](function(_0x489240){if(_0x489240){_0x2493ca[_0x22a3('0x65')][_0x22a3('0x68')]=_0x489240['id'];return db[_0x22a3('0x69')][_0x22a3('0x5d')](_0x2493ca[_0x22a3('0x65')]);}})['then'](respondWithResult(_0x4fc897,null))[_0x22a3('0x27')](handleError(_0x4fc897,null));};exports[_0x22a3('0x6a')]=function(_0x443b31,_0x104fc9,_0x29e830){var _0x455c23={'raw':![],'where':{}};var _0x20d65f={};var _0xca7379={'count':0x0,'rows':[]};return db[_0x22a3('0x3d')][_0x22a3('0x6b')]({'where':{'id':_0x443b31[_0x22a3('0x5a')]['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x104fc9,null))[_0x22a3('0x1e')](function(_0x49b012){if(_0x49b012){_0x20d65f[_0x22a3('0x42')]=_[_0x22a3('0x44')](db['Disposition'][_0x22a3('0x3e')]);_0x20d65f[_0x22a3('0x43')]=_[_0x22a3('0x44')](_0x443b31['query']);_0x20d65f[_0x22a3('0x45')]=_[_0x22a3('0x46')](_0x20d65f[_0x22a3('0x42')],_0x20d65f[_0x22a3('0x43')]);_0x455c23['attributes']=_[_0x22a3('0x46')](_0x20d65f[_0x22a3('0x42')],qs[_0x22a3('0x48')](_0x443b31[_0x22a3('0x43')][_0x22a3('0x48')]));_0x455c23[_0x22a3('0x47')]=_0x455c23['attributes'][_0x22a3('0x5b')]?_0x455c23[_0x22a3('0x47')]:_0x20d65f[_0x22a3('0x42')];if(!_0x443b31[_0x22a3('0x43')]['hasOwnProperty']('nolimit')){_0x455c23['limit']=qs[_0x22a3('0x4b')](_0x443b31[_0x22a3('0x43')]['limit']);_0x455c23[_0x22a3('0x2c')]=qs['offset'](_0x443b31[_0x22a3('0x43')]['offset']);}_0x455c23['order']=qs[_0x22a3('0x4d')](_0x443b31[_0x22a3('0x43')]['sort']);_0x455c23[_0x22a3('0x4f')]=qs[_0x22a3('0x45')](_[_0x22a3('0x4e')](_0x443b31['query'],_0x20d65f[_0x22a3('0x45')]));_0x455c23[_0x22a3('0x4f')]['SmsAccountId']=_0x49b012['id'];if(_0x443b31['query'][_0x22a3('0x52')]){_0x455c23[_0x22a3('0x4f')]=_[_0x22a3('0x50')](_0x455c23[_0x22a3('0x4f')],{'$or':_['map'](_0x455c23['attributes'],function(_0xe197ac){var _0x1b9f12={};_0x1b9f12[_0xe197ac]={'$like':'%'+_0x443b31[_0x22a3('0x43')][_0x22a3('0x52')]+'%'};return _0x1b9f12;})});}_0x455c23=_['merge']({},_0x455c23,_0x443b31[_0x22a3('0x53')]);return db[_0x22a3('0x69')]['count']({'where':_0x455c23[_0x22a3('0x4f')]})[_0x22a3('0x1e')](function(_0xa87edf){_0xca7379[_0x22a3('0x54')]=_0xa87edf;if(_0x443b31[_0x22a3('0x43')][_0x22a3('0x55')]){_0x455c23[_0x22a3('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x22a3('0x57')](_0x455c23);})['then'](function(_0x3de07d){_0xca7379[_0x22a3('0x58')]=_0x3de07d;return _0xca7379;});}})['then'](respondWithFilteredResult(_0x104fc9,_0x455c23))[_0x22a3('0x27')](handleError(_0x104fc9,null));};exports['removeDispositions']=function(_0xf522bb,_0x61508f,_0x52fcf6){return db[_0x22a3('0x3d')]['find']({'where':{'id':_0xf522bb[_0x22a3('0x5a')]['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x61508f,null))[_0x22a3('0x1e')](function(_0x309beb){if(_0x309beb){return _0x309beb['removeDispositions'](_0xf522bb[_0x22a3('0x43')]['ids']);}})[_0x22a3('0x1e')](respondWithStatusCode(_0x61508f,null))[_0x22a3('0x27')](handleError(_0x61508f,null));};exports[_0x22a3('0x6c')]=function(_0xab5b9c,_0x28753b,_0x2448cc){if(_0xab5b9c['body']['id']){delete _0xab5b9c[_0x22a3('0x65')]['id'];}return db[_0x22a3('0x3d')][_0x22a3('0x5c')]({'where':{'id':_0xab5b9c['params']['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x28753b,null))[_0x22a3('0x1e')](function(_0x29466c){if(_0x29466c){_0xab5b9c[_0x22a3('0x65')][_0x22a3('0x68')]=_0x29466c['id'];return db[_0x22a3('0x6d')][_0x22a3('0x5d')](_0xab5b9c['body']);}})['then'](respondWithResult(_0x28753b,null))[_0x22a3('0x27')](handleError(_0x28753b,null));};exports[_0x22a3('0x6e')]=function(_0x74a411,_0x4c111c,_0x5cd348){var _0x21bbed={'raw':![],'where':{}};var _0xe71ef2={};var _0x599352={'count':0x0,'rows':[]};return db[_0x22a3('0x3d')]['findOne']({'where':{'id':_0x74a411[_0x22a3('0x5a')]['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x4c111c,null))[_0x22a3('0x1e')](function(_0x525c15){if(_0x525c15){_0xe71ef2[_0x22a3('0x42')]=_[_0x22a3('0x44')](db[_0x22a3('0x6d')]['rawAttributes']);_0xe71ef2[_0x22a3('0x43')]=_[_0x22a3('0x44')](_0x74a411[_0x22a3('0x43')]);_0xe71ef2[_0x22a3('0x45')]=_['intersection'](_0xe71ef2[_0x22a3('0x42')],_0xe71ef2[_0x22a3('0x43')]);_0x21bbed['attributes']=_[_0x22a3('0x46')](_0xe71ef2[_0x22a3('0x42')],qs[_0x22a3('0x48')](_0x74a411[_0x22a3('0x43')][_0x22a3('0x48')]));_0x21bbed['attributes']=_0x21bbed[_0x22a3('0x47')][_0x22a3('0x5b')]?_0x21bbed[_0x22a3('0x47')]:_0xe71ef2[_0x22a3('0x42')];if(!_0x74a411['query'][_0x22a3('0x49')](_0x22a3('0x4a'))){_0x21bbed['limit']=qs[_0x22a3('0x4b')](_0x74a411[_0x22a3('0x43')][_0x22a3('0x4b')]);_0x21bbed['offset']=qs[_0x22a3('0x2c')](_0x74a411['query']['offset']);}_0x21bbed[_0x22a3('0x4c')]=qs[_0x22a3('0x4d')](_0x74a411['query']['sort']);_0x21bbed['where']=qs[_0x22a3('0x45')](_[_0x22a3('0x4e')](_0x74a411[_0x22a3('0x43')],_0xe71ef2[_0x22a3('0x45')]));_0x21bbed['where'][_0x22a3('0x68')]=_0x525c15['id'];if(_0x74a411['query'][_0x22a3('0x52')]){_0x21bbed['where']=_[_0x22a3('0x50')](_0x21bbed['where'],{'$or':_[_0x22a3('0x3c')](_0x21bbed[_0x22a3('0x47')],function(_0x28d2de){var _0x4a533b={};_0x4a533b[_0x28d2de]={'$like':'%'+_0x74a411[_0x22a3('0x43')]['filter']+'%'};return _0x4a533b;})});}_0x21bbed=_[_0x22a3('0x50')]({},_0x21bbed,_0x74a411[_0x22a3('0x53')]);return db[_0x22a3('0x6d')][_0x22a3('0x54')]({'where':_0x21bbed[_0x22a3('0x4f')]})[_0x22a3('0x1e')](function(_0x149154){_0x599352[_0x22a3('0x54')]=_0x149154;if(_0x74a411[_0x22a3('0x43')][_0x22a3('0x55')]){_0x21bbed[_0x22a3('0x56')]=[{'all':!![]}];}return db[_0x22a3('0x6d')][_0x22a3('0x57')](_0x21bbed);})[_0x22a3('0x1e')](function(_0x22a8e3){_0x599352['rows']=_0x22a8e3;return _0x599352;});}})['then'](respondWithFilteredResult(_0x4c111c,_0x21bbed))[_0x22a3('0x27')](handleError(_0x4c111c,null));};exports[_0x22a3('0x6f')]=function(_0x426b9d,_0x3e9b42,_0x75a12){return db[_0x22a3('0x3d')]['find']({'where':{'id':_0x426b9d['params']['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x3e9b42,null))[_0x22a3('0x1e')](function(_0x42ebda){if(_0x42ebda){return _0x42ebda[_0x22a3('0x6f')](_0x426b9d[_0x22a3('0x43')][_0x22a3('0x70')]);}})['then'](respondWithStatusCode(_0x3e9b42,null))[_0x22a3('0x27')](handleError(_0x3e9b42,null));};exports[_0x22a3('0x71')]=function(_0x3aa2f7,_0x360f57,_0x286a90){var _0x1af6d5={'channel':_0x22a3('0x72')};var _0x17eb85=[];var _0xb632d0=[];var _0x562d46={};return db[_0x22a3('0x3d')][_0x22a3('0x5c')]({'where':{'id':_0x3aa2f7[_0x22a3('0x5a')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x22a3('0x73')}]})[_0x22a3('0x1e')](handleEntityNotFound(_0x360f57,null))[_0x22a3('0x1e')](function(_0x47e034){_0x1af6d5[_0x22a3('0x74')]=_0x47e034;_0x1af6d5[_0x22a3('0x75')]=_[_0x22a3('0x76')](_0x47e034[_0x22a3('0x73')],['priority'],['asc']);if(_0x1af6d5['account'][_0x22a3('0x73')]){delete _0x1af6d5[_0x22a3('0x74')][_0x22a3('0x73')];}return db[_0x22a3('0x77')][_0x22a3('0x66')]();})[_0x22a3('0x1e')](function(_0x3003e5){if(!_0x3003e5){throw new db[(_0x22a3('0x78'))][(_0x22a3('0x79'))](_0x22a3('0x7a'));}_0x17eb85=_[_0x22a3('0x7b')](_[_0x22a3('0x44')](_0x3003e5),['createdAt','updatedAt']);_0xb632d0=_[_0x22a3('0x7b')](_[_0x22a3('0x44')](_0x3003e5),[_0x22a3('0x7c'),_0x22a3('0x7d'),_0x22a3('0x7e'),_0x22a3('0x7f')]);_0x1af6d5[_0x22a3('0x65')]={'mapKey':_0x22a3('0x80')};if(_0x1af6d5[_0x22a3('0x74')][_0x22a3('0x40')]){switch(_0x1af6d5[_0x22a3('0x74')][_0x22a3('0x40')]){case'twilio':_0x1af6d5['body'][_0x22a3('0x81')]=_0x3aa2f7['body']['From'];_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x65')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x82')];_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x83')]=_0x3aa2f7['body'][_0x22a3('0x84')];break;case'skebby':_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')]='+'+_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x85')];_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x65')]=_0x3aa2f7['body'][_0x22a3('0x86')];break;case _0x22a3('0x87'):_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')]=_0x3aa2f7[_0x22a3('0x65')]['from'];_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x65')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x25')];break;case'clicksend':_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')]=_0x3aa2f7[_0x22a3('0x65')]['from'];_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x65')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x65')];_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x83')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x88')];break;case _0x22a3('0x89'):_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x8a')];_0x1af6d5['body'][_0x22a3('0x65')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x8b')];_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x83')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x8c')];break;case _0x22a3('0x8d'):_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')]='+'+_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x8e')][0x0][_0x22a3('0x81')];_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x65')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x8e')][0x0]['text'];_0x1af6d5[_0x22a3('0x65')]['messageId']=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x8e')][0x0]['messageId'];break;case _0x22a3('0x8f'):_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x90')];_0x1af6d5['body'][_0x22a3('0x65')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x91')][_0x22a3('0x25')];break;case'clickatell':_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x92')];_0x1af6d5['body']['body']=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x86')];_0x1af6d5['body'][_0x22a3('0x83')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x93')];break;case _0x22a3('0x94'):_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')]=_0x3aa2f7['body'][_0x22a3('0x81')];_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x65')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x25')];_0x1af6d5['body'][_0x22a3('0x83')]=_0x3aa2f7[_0x22a3('0x65')][_0x22a3('0x95')];break;}}if(_0x1af6d5[_0x22a3('0x65')]['id']){delete _0x1af6d5[_0x22a3('0x65')]['id'];}if(_[_0x22a3('0x96')](_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')])){throw new db[(_0x22a3('0x78'))]['ValidationError'](_0x22a3('0x97'));}if(_[_0x22a3('0x96')](_0x1af6d5['body'][_0x22a3('0x65')])||_0x1af6d5[_0x22a3('0x65')]['body']===''){throw new db['Sequelize'][(_0x22a3('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x22a3('0x96')](_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x98')])){throw new db[(_0x22a3('0x78'))][(_0x22a3('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb632d0);}if(!_['includes'](_0xb632d0,_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x98')])){throw new db['Sequelize']['ValidationError'](_0x22a3('0x99')+_0xb632d0);}_0x562d46[_0x1af6d5['body'][_0x22a3('0x98')]]=_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')];return db[_0x22a3('0x9a')][_0x22a3('0x5c')]({'where':{'id':_0x1af6d5[_0x22a3('0x74')][_0x22a3('0x7f')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x562d46,'limit':0x1,'order':[[_0x22a3('0x7d'),_0x22a3('0x9b')]]}]});})[_0x22a3('0x1e')](handleEntityNotFound(_0x360f57,null))[_0x22a3('0x1e')](function(_0x473061){if(_0x473061){_0x1af6d5[_0x22a3('0x9c')]=_[_0x22a3('0x9d')](_0x473061,[_0x22a3('0x9e')]);if(_0x473061[_0x22a3('0x9e')][_0x22a3('0x5b')]){return _0x473061[_0x22a3('0x9e')][0x0];}var _0x58d771=_['defaults'](_0x1af6d5['body'],{'firstName':_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x81')],'ListId':_0x473061['id']});_0x58d771[_0x1af6d5['body']['mapKey']]=_0x1af6d5[_0x22a3('0x65')]['from'];return db['CmContact'][_0x22a3('0x5d')](_0x58d771,{'fields':_0x17eb85,'raw':!![]});}})['then'](handleEntityNotFound(_0x360f57,null))[_0x22a3('0x1e')](function(_0x180be3){if(_0x180be3){_0x1af6d5[_0x22a3('0x9f')]=_0x180be3;var _0x30c557={'ContactId':_0x180be3['id'],'phone':_0x1af6d5['body'][_0x22a3('0x81')],'SmsAccountId':_0x3aa2f7[_0x22a3('0x5a')]['id']};var _0x1f185b={'ContactId':_0x180be3['id'],'SmsAccountId':_0x3aa2f7[_0x22a3('0x5a')]['id'],'closed':![]};return db[_0x22a3('0xa0')][_0x22a3('0x5c')]({'where':_0x1f185b})[_0x22a3('0x1e')](function(_0x3a21ad){if(_0x3a21ad){return[_0x3a21ad,![]];}return db[_0x22a3('0xa0')]['create'](_0x30c557)['then'](function(_0x2fb67b){return[_0x2fb67b,!![]];});});}})[_0x22a3('0xa1')](function(_0x42f8f7,_0x1b43ed){_0x1af6d5[_0x22a3('0xa2')]=_0x42f8f7[_0x22a3('0x33')]({'plain':!![]});_0x1af6d5[_0x22a3('0xa2')]['created']=![];if(_0x1b43ed){if(_0x1af6d5[_0x22a3('0x74')]['autoclose']){_0x1af6d5[_0x22a3('0x75')][_0x22a3('0xa3')]({'id':0x0,'priority':_0x1af6d5[_0x22a3('0x75')][_0x22a3('0x5b')]+0x1,'app':_0x22a3('0xa4'),'appdata':_0x22a3('0xa5'),'interval':_0x22a3('0xa6')});}_0x1af6d5[_0x22a3('0xa2')][_0x22a3('0xa7')]=!![];}return db[_0x22a3('0xa8')][_0x22a3('0x5d')]({'phone':_0x1af6d5['body'][_0x22a3('0x81')],'messageId':_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x83')],'body':_0x1af6d5[_0x22a3('0x65')][_0x22a3('0x65')],'SmsAccountId':_0x3aa2f7[_0x22a3('0x5a')]['id'],'SmsInteractionId':_0x42f8f7['id'],'direction':'in','ContactId':_0x42f8f7[_0x22a3('0xa9')],'AttachmentId':_0x1af6d5[_0x22a3('0x65')]['AttachmentId']});})[_0x22a3('0x1e')](function(_0x4625ac){_0x1af6d5[_0x22a3('0x25')]=_0x4625ac;if(_0x1af6d5['interaction'][_0x22a3('0xaa')]){return db[_0x22a3('0xab')][_0x22a3('0x5c')]({'attributes':['id',_0x22a3('0x37')],'where':{'id':_0x1af6d5[_0x22a3('0xa2')][_0x22a3('0xaa')]}})[_0x22a3('0x1e')](function(_0x31e338){if(_0x31e338){_0x1af6d5['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x22a3('0xac'),'appdata':_0x31e338[_0x22a3('0x37')]+','+(_0x1af6d5['account'][_0x22a3('0xad')]||0xa),'interval':_0x22a3('0xa6')});}return respondWithRpcPromise('Start','startRouting',_0x1af6d5);});}return respondWithRpcPromise(_0x22a3('0xae'),'startRouting',_0x1af6d5);})[_0x22a3('0x1e')](function(_0x58a2c9){if(_0x58a2c9){var _0x29eb8a=0xc8;var _0x502cd4=_0x22a3('0xaf');logger['info'](_0x22a3('0x23'),_0x502cd4,_0x29eb8a,'entity\x20found');logger['debug'](_0x22a3('0xb0'),_0x502cd4,_0x29eb8a,_0x22a3('0xb1'),JSON[_0x22a3('0xb2')](_0x58a2c9));if(_0x1af6d5[_0x22a3('0x74')][_0x22a3('0x40')]===_0x22a3('0xb3')){return _0x360f57[_0x22a3('0x2a')](_0x29eb8a)[_0x22a3('0x2d')](_0x22a3('0xb4'),_0x22a3('0xb5'))['send'](_0x22a3('0xb6'));}else{return _0x360f57[_0x22a3('0x2a')](_0x29eb8a)[_0x22a3('0x2b')](_0x58a2c9);}}})[_0x22a3('0x27')](handleError(_0x360f57,null));};exports[_0x22a3('0xb7')]=function(_0x2d5112,_0x5720a4,_0x1635d0){return db[_0x22a3('0x3d')]['findOne']({'where':{'id':_0x2d5112[_0x22a3('0x5a')]['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x5720a4,null))[_0x22a3('0x1e')](function(_0x2ec13b){if(_0x2ec13b){return db[_0x22a3('0xb8')]['transaction'](function(_0x502e96){return db[_0x22a3('0xb9')][_0x22a3('0x32')]({'where':{'SmsAccountId':_0x2d5112['params']['id']},'transaction':_0x502e96})[_0x22a3('0x1e')](function(_0x25d471){var _0x2e8e69=_[_0x22a3('0x3c')](_0x2d5112[_0x22a3('0x65')],function(_0x1ebcd5){_0x1ebcd5[_0x22a3('0x68')]=_0x2d5112[_0x22a3('0x5a')]['id'];return _0x1ebcd5;});return db[_0x22a3('0xb9')]['bulkCreate'](_0x2e8e69,{'transaction':_0x502e96});});})[_0x22a3('0x1e')](function(){return db[_0x22a3('0xb9')][_0x22a3('0xba')]({'where':{'SmsAccountId':_0x2d5112['params']['id']},'order':_0x22a3('0xbb')});});}})[_0x22a3('0x1e')](respondWithResult(_0x5720a4,null))['catch'](handleError(_0x5720a4,null));};exports[_0x22a3('0xbc')]=function(_0x4dcd93,_0x5bfad1,_0x529b96){var _0x3fe73b={};var _0x22bdb2={};var _0x14471a;var _0x570047;return db[_0x22a3('0x3d')]['findOne']({'where':{'id':_0x4dcd93['params']['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x5bfad1,null))[_0x22a3('0x1e')](function(_0x226186){if(_0x226186){_0x14471a=_0x226186;_0x22bdb2[_0x22a3('0x42')]=_[_0x22a3('0x44')](db[_0x22a3('0xb9')]['rawAttributes']);_0x22bdb2[_0x22a3('0x43')]=_[_0x22a3('0x44')](_0x4dcd93['query']);_0x22bdb2[_0x22a3('0x45')]=_['intersection'](_0x22bdb2[_0x22a3('0x42')],_0x22bdb2[_0x22a3('0x43')]);_0x3fe73b['attributes']=_['intersection'](_0x22bdb2['model'],qs[_0x22a3('0x48')](_0x4dcd93['query'][_0x22a3('0x48')]));_0x3fe73b['attributes']=_0x3fe73b['attributes'][_0x22a3('0x5b')]?_0x3fe73b[_0x22a3('0x47')]:_0x22bdb2[_0x22a3('0x42')];_0x3fe73b['order']=qs[_0x22a3('0x4d')](_0x4dcd93[_0x22a3('0x43')][_0x22a3('0x4d')]);_0x3fe73b[_0x22a3('0x4f')]=qs[_0x22a3('0x45')](_[_0x22a3('0x4e')](_0x4dcd93[_0x22a3('0x43')],_0x22bdb2[_0x22a3('0x45')]));if(_0x4dcd93[_0x22a3('0x43')][_0x22a3('0x52')]){_0x3fe73b[_0x22a3('0x4f')]=_[_0x22a3('0x50')](_0x3fe73b[_0x22a3('0x4f')],{'$or':_[_0x22a3('0x3c')](_0x3fe73b['attributes'],function(_0x1d48da){var _0x389751={};_0x389751[_0x1d48da]={'$like':'%'+_0x4dcd93[_0x22a3('0x43')]['filter']+'%'};return _0x389751;})});}_0x3fe73b=_[_0x22a3('0x50')]({},_0x3fe73b,_0x4dcd93[_0x22a3('0x53')]);return _0x14471a[_0x22a3('0xbc')](_0x3fe73b);}})['then'](function(_0x188f0f){if(_0x188f0f){_0x570047=_0x188f0f[_0x22a3('0x5b')];if(!_0x4dcd93['query'][_0x22a3('0x49')](_0x22a3('0x4a'))){_0x3fe73b['limit']=qs[_0x22a3('0x4b')](_0x4dcd93['query']['limit']);_0x3fe73b[_0x22a3('0x2c')]=qs['offset'](_0x4dcd93[_0x22a3('0x43')][_0x22a3('0x2c')]);}return _0x14471a[_0x22a3('0xbc')](_0x3fe73b);}})[_0x22a3('0x1e')](function(_0x4e8cce){if(_0x4e8cce){return _0x4e8cce?{'count':_0x570047,'rows':_0x4e8cce}:null;}})[_0x22a3('0x1e')](respondWithResult(_0x5bfad1,null))[_0x22a3('0x27')](handleError(_0x5bfad1,null));};exports[_0x22a3('0xbd')]=function(_0x23a4da,_0x175caa,_0x12cdc2){var _0x13faea={'raw':![],'where':{}};var _0x2919fa={};var _0x372ae0={'count':0x0,'rows':[]};return db[_0x22a3('0x3d')][_0x22a3('0x6b')]({'where':{'id':_0x23a4da['params']['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x175caa,null))[_0x22a3('0x1e')](function(_0x5eb4ca){if(_0x5eb4ca){_0x2919fa[_0x22a3('0x42')]=_[_0x22a3('0x44')](db[_0x22a3('0xa0')]['rawAttributes']);_0x2919fa['query']=_[_0x22a3('0x44')](_0x23a4da[_0x22a3('0x43')]);_0x2919fa['filters']=_[_0x22a3('0x46')](_0x2919fa[_0x22a3('0x42')],_0x2919fa[_0x22a3('0x43')]);_0x13faea[_0x22a3('0x47')]=_[_0x22a3('0x46')](_0x2919fa[_0x22a3('0x42')],qs[_0x22a3('0x48')](_0x23a4da[_0x22a3('0x43')]['fields']));_0x13faea[_0x22a3('0x47')]=_0x13faea[_0x22a3('0x47')][_0x22a3('0x5b')]?_0x13faea['attributes']:_0x2919fa[_0x22a3('0x42')];if(!_0x23a4da['query'][_0x22a3('0x49')]('nolimit')){_0x13faea[_0x22a3('0x4b')]=qs['limit'](_0x23a4da[_0x22a3('0x43')][_0x22a3('0x4b')]);_0x13faea[_0x22a3('0x2c')]=qs['offset'](_0x23a4da['query'][_0x22a3('0x2c')]);}_0x13faea['order']=qs[_0x22a3('0x4d')](_0x23a4da[_0x22a3('0x43')]['sort']);_0x13faea[_0x22a3('0x4f')]=qs[_0x22a3('0x45')](_['pick'](_0x23a4da[_0x22a3('0x43')],_0x2919fa[_0x22a3('0x45')]));_0x13faea[_0x22a3('0x4f')]['SmsAccountId']=_0x5eb4ca['id'];if(_0x23a4da[_0x22a3('0x43')][_0x22a3('0x52')]){_0x13faea['where']=_[_0x22a3('0x50')](_0x13faea[_0x22a3('0x4f')],{'$or':_['map'](_0x13faea[_0x22a3('0x47')],function(_0x52e111){var _0x34babc={};_0x34babc[_0x52e111]={'$like':'%'+_0x23a4da[_0x22a3('0x43')][_0x22a3('0x52')]+'%'};return _0x34babc;})});}_0x13faea=_[_0x22a3('0x50')]({},_0x13faea,_0x23a4da[_0x22a3('0x53')]);return db[_0x22a3('0xa0')][_0x22a3('0x54')]({'where':_0x13faea[_0x22a3('0x4f')]})[_0x22a3('0x1e')](function(_0x2c80f0){_0x372ae0[_0x22a3('0x54')]=_0x2c80f0;if(_0x23a4da[_0x22a3('0x43')]['includeAll']){_0x13faea[_0x22a3('0x56')]=[{'model':db[_0x22a3('0x77')],'as':_0x22a3('0xbe'),'required':![]},{'model':db[_0x22a3('0xab')],'as':_0x22a3('0xbf'),'attributes':['name',_0x22a3('0xc0'),_0x22a3('0xc1')],'required':![]},{'model':db[_0x22a3('0xc2')],'as':_0x22a3('0xc3'),'attributes':['id','name','color'],'where':_0x23a4da[_0x22a3('0x43')][_0x22a3('0xc4')]?{'id':_0x23a4da[_0x22a3('0x43')]['tag']}:undefined,'required':_0x23a4da['query'][_0x22a3('0xc4')]?!![]:![]}];}return db['SmsInteraction'][_0x22a3('0x57')](_0x13faea);})['then'](function(_0x3df50f){_0x372ae0[_0x22a3('0x58')]=_0x3df50f;return _0x372ae0;});}})['then'](respondWithFilteredResult(_0x175caa,_0x13faea))['catch'](handleError(_0x175caa,null));};exports['send']=function(_0x5eb61c,_0x3aa0ce,_0x580280){var _0x410340,_0x562ad4,_0xd66e5e;if(_['isNil'](_0x5eb61c[_0x22a3('0x65')][_0x22a3('0x65')])||_0x5eb61c[_0x22a3('0x65')]['body']===''){throw new db[(_0x22a3('0x78'))][(_0x22a3('0x79'))](_0x22a3('0xc5'));}if(_[_0x22a3('0x96')](_0x5eb61c[_0x22a3('0x65')]['to'])){throw new db[(_0x22a3('0x78'))][(_0x22a3('0x79'))](_0x22a3('0xc6'));}_0x410340=_0x5eb61c['body']['to'];return db[_0x22a3('0x3d')][_0x22a3('0x5c')]({'where':{'id':_0x5eb61c[_0x22a3('0x5a')]['id']},'include':[{'model':db[_0x22a3('0x9a')],'as':'List','include':[{'model':db[_0x22a3('0x77')],'as':_0x22a3('0x9e'),'where':{'mobile':_0x410340},'limit':0x1,'order':[[_0x22a3('0x7d'),'DESC']]}]}]})[_0x22a3('0x1e')](handleEntityNotFound(_0x3aa0ce,null))[_0x22a3('0x1e')](function(_0x2e27dd){if(_0x2e27dd&&_0x2e27dd[_0x22a3('0xc7')]){_0x562ad4=_0x2e27dd[_0x22a3('0x33')]({'plain':!![]});if(_0x562ad4[_0x22a3('0xc7')]&&_0x562ad4[_0x22a3('0xc7')][_0x22a3('0x9e')]['length']){return _0x562ad4[_0x22a3('0xc7')][_0x22a3('0x9e')][0x0];}return db[_0x22a3('0x77')][_0x22a3('0x5d')](_[_0x22a3('0xc8')](_0x5eb61c[_0x22a3('0x65')],{'firstName':_0x410340,'mobile':_0x410340,'phone':_0x410340,'ListId':_0x562ad4[_0x22a3('0x7f')]}));}})[_0x22a3('0x1e')](handleEntityNotFound(_0x3aa0ce,null))[_0x22a3('0x1e')](function(_0x436a40){if(_0x436a40){_0xd66e5e=_0x436a40;return db['SmsInteraction'][_0x22a3('0x5c')]({'where':{'ContactId':_0xd66e5e['id'],'closed':![],'SmsAccountId':_0x562ad4['id']}})[_0x22a3('0x1e')](function(_0x33476a){if(_0x33476a){return[_0x33476a,![]];}return db[_0x22a3('0xa0')][_0x22a3('0x5d')]({'UserId':_0x5eb61c[_0x22a3('0x5e')]['id'],'ContactId':_0xd66e5e['id'],'SmsAccountId':_0x562ad4['id'],'phone':_0x410340,'firstMsgDirection':_0x22a3('0xc9'),'Messages':[_['merge'](_0x5eb61c[_0x22a3('0x65')],{'read':![],'body':_0x5eb61c[_0x22a3('0x65')][_0x22a3('0x65')],'phone':_0x410340,'SmsAccountId':_0x562ad4['id'],'UserId':_0x5eb61c[_0x22a3('0x5e')]['id'],'ContactId':_0xd66e5e['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x22a3('0x1e')](function(_0x3be100){return[_0x3be100,!![]];});});}})[_0x22a3('0xa1')](function(_0x4e045b,_0x57bd10){if(_0x57bd10){return _0x4e045b;}return db['SmsMessage'][_0x22a3('0x5d')](_[_0x22a3('0x50')](_0x5eb61c[_0x22a3('0x65')],{'read':![],'body':_0x5eb61c[_0x22a3('0x65')][_0x22a3('0x65')],'phone':_0x410340,'SmsAccountId':_0x562ad4['id'],'SmsInteractionId':_0x4e045b['id'],'UserId':_0x5eb61c[_0x22a3('0x5e')]['id'],'ContactId':_0xd66e5e['id']}))[_0x22a3('0x1e')](function(_0x5556a9){_0x4e045b[_0x22a3('0xca')]['Messages']=[];_0x4e045b[_0x22a3('0xca')][_0x22a3('0xcb')][_0x22a3('0xa3')](_0x5556a9[_0x22a3('0xca')]);return _0x4e045b;});})['then'](respondWithResult(_0x3aa0ce,null))['catch'](handleError(_0x3aa0ce,null));};exports[_0x22a3('0x2a')]=function(_0x122db5,_0x326eed,_0x17969e){if(_0x122db5[_0x22a3('0x65')]['id']){delete _0x122db5[_0x22a3('0x65')]['id'];}console[_0x22a3('0xcc')](_0x22a3('0xcd'),_0x122db5['body']);var _0x527290,_0x53b68a,_0x51df5d;return db[_0x22a3('0x3d')][_0x22a3('0x5c')]({'where':{'id':_0x122db5['params']['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x326eed,null))[_0x22a3('0x1e')](function(_0x9ee753){if(_0x9ee753){_0x51df5d=_0x9ee753;logger[_0x22a3('0x22')](_0x22a3('0x23'),_0x22a3('0x2a'),_0x22a3('0xce'),_0x9ee753[_0x22a3('0x40')],util['inspect'](_0x122db5['body'],{'showHidden':![],'depth':null}));switch(_0x9ee753[_0x22a3('0x40')]){case _0x22a3('0xcf'):if(_0x122db5[_0x22a3('0x65')][_0x22a3('0xd0')]&&_0x122db5[_0x22a3('0x65')][_0x22a3('0x2a')]){_0x53b68a=_0x122db5['body'][_0x22a3('0x2a')];return db[_0x22a3('0xa8')][_0x22a3('0x5c')]({'where':{'messageId':_0x122db5[_0x22a3('0x65')]['skebby_dispatch_id']}});}break;case _0x22a3('0x87'):if(_0x122db5[_0x22a3('0x65')]['requestid']&&_0x122db5[_0x22a3('0x65')][_0x22a3('0xd1')]){_0x53b68a=_0x122db5['body'][_0x22a3('0xd1')];return db[_0x22a3('0xa8')][_0x22a3('0x5c')]({'where':{'messageId':_0x122db5['body'][_0x22a3('0xd2')]}});}break;case _0x22a3('0xd3'):if(_0x122db5[_0x22a3('0x65')]['message_id']&&_0x122db5[_0x22a3('0x65')][_0x22a3('0xd4')]){_0x53b68a=_0x122db5[_0x22a3('0x65')][_0x22a3('0xd4')];return db[_0x22a3('0xa8')][_0x22a3('0x5c')]({'where':{'messageId':_0x122db5['body'][_0x22a3('0x88')]}});}break;case'infobip':var _0x562228=_0x122db5['body']['results'][0x0];if(_0x562228[_0x22a3('0x83')]&&_0x562228['status'][_0x22a3('0xd5')]===_0x22a3('0xd6')){_0x53b68a=_0x562228['status'][_0x22a3('0xd5')];return db[_0x22a3('0xa8')][_0x22a3('0x5c')]({'where':{'messageId':_0x562228[_0x22a3('0x83')]}});}break;case _0x22a3('0xd7'):if(_0x122db5['body'][_0x22a3('0x83')]&&_0x122db5[_0x22a3('0x65')]['status']){_0x53b68a=_0x122db5[_0x22a3('0x65')]['status'];return db[_0x22a3('0xa8')][_0x22a3('0x5c')]({'where':{'messageId':_0x122db5[_0x22a3('0x65')][_0x22a3('0x83')]}});}break;case'intelepeer':if(_0x122db5[_0x22a3('0x65')][_0x22a3('0xd8')]&&_0x122db5[_0x22a3('0x65')][_0x22a3('0x2a')]){_0x53b68a=_0x122db5[_0x22a3('0x65')][_0x22a3('0x2a')];return db['SmsMessage'][_0x22a3('0x5c')]({'where':{'messageId':_0x122db5[_0x22a3('0x65')][_0x22a3('0xd8')]}});}break;}}})[_0x22a3('0x1e')](handleEntityNotFound(_0x326eed,null))['then'](function(_0x10eda2){if(_0x10eda2){_0x527290=_0x10eda2;switch(_0x51df5d[_0x22a3('0x40')]){case _0x22a3('0xcf'):if(_0x53b68a===_0x22a3('0xd6')){return _0x527290[_0x22a3('0x64')]({'read':!![]});}else{logger[_0x22a3('0x24')](_0x22a3('0x23'),_0x22a3('0x2a'),_0x22a3('0xcf'),util[_0x22a3('0xd9')](_0x122db5['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x53b68a==='1'){return _0x527290[_0x22a3('0x64')]({'read':!![]});}else{logger[_0x22a3('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x22a3('0x2a'),_0x22a3('0xcf'),util['inspect'](_0x122db5[_0x22a3('0x65')],{'showHidden':![],'depth':null}));}break;case _0x22a3('0xd3'):if(!_0x122db5['body'][_0x22a3('0xda')]&&_0x53b68a>=0xc8&&_0x53b68a<=0xce){return _0x527290[_0x22a3('0x64')]({'read':!![]});}else{logger[_0x22a3('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x22a3('0x2a'),_0x22a3('0xd3'),util[_0x22a3('0xd9')](_0x122db5[_0x22a3('0x65')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3f9f7a=_0x122db5['body']['results'][0x0];if(_0x3f9f7a['status']['groupName']===_0x22a3('0xd6')){return _0x527290['update']({'read':!![]});}else{logger[_0x22a3('0x24')](_0x22a3('0x23'),_0x22a3('0x2a'),_0x22a3('0x8d'),util['inspect'](_0x122db5['body'],{'showHidden':![],'depth':null}));}break;case _0x22a3('0xd7'):if(_0x53b68a=='DELIVERED_TO_GATEWAY'||_0x53b68a==_0x22a3('0xdb')){return _0x527290[_0x22a3('0x64')]({'read':!![]});}else{logger[_0x22a3('0x24')](_0x22a3('0x23'),'status',_0x22a3('0xd7'),util['inspect'](_0x122db5[_0x22a3('0x65')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x53b68a===_0x22a3('0xdc')||_0x53b68a===_0x22a3('0xdd')){return _0x527290[_0x22a3('0x64')]({'read':!![]});}else{logger['error'](_0x22a3('0x23'),_0x22a3('0x2a'),_0x22a3('0x94'),util[_0x22a3('0xd9')](_0x122db5[_0x22a3('0x65')],{'showHidden':![],'depth':null}));}break;}return _0x527290;}})[_0x22a3('0x1e')](respondWithResult(_0x326eed,null))[_0x22a3('0x27')](handleError(_0x326eed,null));};exports[_0x22a3('0xde')]=function(_0x53d18d,_0x261ccd,_0x1a15aa){var _0x174818,_0x168bb5,_0x48d2aa;return db[_0x22a3('0x3d')][_0x22a3('0x5c')]({'where':{'id':_0x53d18d[_0x22a3('0x5a')]['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x261ccd,null))[_0x22a3('0x1e')](function(_0xda3ed2){if(_0xda3ed2){_0x48d2aa=_0xda3ed2;logger[_0x22a3('0x22')](_0x22a3('0x23'),_0x22a3('0x2a'),_0x22a3('0xce'),_0xda3ed2[_0x22a3('0x40')],util[_0x22a3('0xd9')](_0x53d18d[_0x22a3('0x43')],{'showHidden':![],'depth':null}));switch(_0xda3ed2['type']){case _0x22a3('0x8f'):if(_0x53d18d[_0x22a3('0x43')][_0x22a3('0xdf')]&&_0x53d18d[_0x22a3('0x43')][_0x22a3('0xe0')]){_0x168bb5=_0x53d18d[_0x22a3('0x43')]['state'];return db[_0x22a3('0xa8')][_0x22a3('0x5c')]({'where':{'messageId':_0x53d18d[_0x22a3('0x43')]['message-id']}});}break;}}})[_0x22a3('0x1e')](handleEntityNotFound(_0x261ccd,null))['then'](function(_0x493afd){if(_0x493afd){_0x174818=_0x493afd;switch(_0x48d2aa[_0x22a3('0x40')]){case'csc':if(_0x168bb5==='2'||_0x168bb5==='6'){return _0x174818['update']({'read':!![]});}else{logger[_0x22a3('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x22a3('0x2a'),_0x22a3('0x8f'),util[_0x22a3('0xd9')](_0x53d18d[_0x22a3('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x174818;}})[_0x22a3('0x1e')](respondWithResult(_0x261ccd,null))['catch'](handleError(_0x261ccd,null));};exports[_0x22a3('0xe1')]=function(_0x5af4f1,_0x3e8298,_0x22501b){return db['SmsAccount'][_0x22a3('0x5c')]({'where':{'id':_0x5af4f1[_0x22a3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3e8298,null))[_0x22a3('0x1e')](function(_0x4b0015){if(_0x4b0015){return _0x4b0015['addAgents'](_0x5af4f1[_0x22a3('0x65')]['ids'],_[_0x22a3('0x9d')](_0x5af4f1[_0x22a3('0x65')],[_0x22a3('0x70'),'id'])||{})[_0x22a3('0xa1')](function(_0x1a8562){for(var _0x5069a6=0x0;_0x5069a6<_0x5af4f1['body'][_0x22a3('0x70')]['length'];_0x5069a6+=0x1){socket['emit'](_0x22a3('0xe2'),{'UserId':_0x5af4f1['body'][_0x22a3('0x70')][_0x5069a6],'SmsAccountId':_0x5af4f1[_0x22a3('0x5a')]['id']});}return _0x1a8562;});}})['then'](respondWithResult(_0x3e8298,null))[_0x22a3('0x27')](handleError(_0x3e8298,null));};exports[_0x22a3('0xe3')]=function(_0x432b2f,_0x2cc725,_0x34faa0){return db[_0x22a3('0x3d')]['find']({'where':{'id':_0x432b2f[_0x22a3('0x5a')]['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x2cc725,null))[_0x22a3('0x1e')](function(_0x3ab46f){if(_0x3ab46f){return _0x3ab46f[_0x22a3('0xe3')](_0x432b2f[_0x22a3('0x43')]['ids'])[_0x22a3('0x1e')](function(){if(_['isArray'](_0x432b2f[_0x22a3('0x43')][_0x22a3('0x70')])){for(var _0x38f058=0x0;_0x38f058<_0x432b2f['query'][_0x22a3('0x70')][_0x22a3('0x5b')];_0x38f058+=0x1){socket[_0x22a3('0xe4')](_0x22a3('0xe5'),{'UserId':Number(_0x432b2f[_0x22a3('0x43')]['ids'][_0x38f058]),'SmsAccountId':Number(_0x432b2f[_0x22a3('0x5a')]['id'])});}}else{socket[_0x22a3('0xe4')](_0x22a3('0xe5'),{'UserId':Number(_0x432b2f[_0x22a3('0x43')][_0x22a3('0x70')]),'SmsAccountId':Number(_0x432b2f[_0x22a3('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2cc725,null))[_0x22a3('0x27')](handleError(_0x2cc725,null));};exports[_0x22a3('0xe6')]=function(_0x3daee7,_0x58c245,_0x2e6215){var _0x437d35={};var _0x428130={};var _0x2099e7;var _0x3d92da;return db[_0x22a3('0x3d')][_0x22a3('0x6b')]({'where':{'id':_0x3daee7[_0x22a3('0x5a')]['id']}})[_0x22a3('0x1e')](handleEntityNotFound(_0x58c245,null))['then'](function(_0x1eda0f){if(_0x1eda0f){_0x2099e7=_0x1eda0f;_0x428130[_0x22a3('0x42')]=_[_0x22a3('0x44')](db[_0x22a3('0xab')][_0x22a3('0x3e')]);_0x428130[_0x22a3('0x43')]=_['keys'](_0x3daee7[_0x22a3('0x43')]);_0x428130[_0x22a3('0x45')]=_[_0x22a3('0x46')](_0x428130[_0x22a3('0x42')],_0x428130[_0x22a3('0x43')]);_0x437d35['attributes']=_[_0x22a3('0x46')](_0x428130[_0x22a3('0x42')],qs[_0x22a3('0x48')](_0x3daee7[_0x22a3('0x43')][_0x22a3('0x48')]));_0x437d35[_0x22a3('0x47')]=_0x437d35[_0x22a3('0x47')]['length']?_0x437d35[_0x22a3('0x47')]:_0x428130[_0x22a3('0x42')];_0x437d35['order']=qs[_0x22a3('0x4d')](_0x3daee7[_0x22a3('0x43')]['sort']);_0x437d35[_0x22a3('0x4f')]=qs[_0x22a3('0x45')](_[_0x22a3('0x4e')](_0x3daee7[_0x22a3('0x43')],_0x428130[_0x22a3('0x45')]));if(_0x3daee7[_0x22a3('0x43')][_0x22a3('0x52')]){_0x437d35[_0x22a3('0x4f')]=_['merge'](_0x437d35[_0x22a3('0x4f')],{'$or':_[_0x22a3('0x3c')](_0x437d35[_0x22a3('0x47')],function(_0x5bd098){var _0x334566={};_0x334566[_0x5bd098]={'$like':'%'+_0x3daee7[_0x22a3('0x43')][_0x22a3('0x52')]+'%'};return _0x334566;})});}_0x437d35=_[_0x22a3('0x50')]({},_0x437d35,_0x3daee7[_0x22a3('0x53')]);return _0x2099e7[_0x22a3('0xe6')](_0x437d35);}})[_0x22a3('0x1e')](function(_0x4818a3){if(_0x4818a3){_0x3d92da=_0x4818a3[_0x22a3('0x5b')];if(!_0x3daee7[_0x22a3('0x43')][_0x22a3('0x49')](_0x22a3('0x4a'))){_0x437d35[_0x22a3('0x4b')]=qs[_0x22a3('0x4b')](_0x3daee7[_0x22a3('0x43')][_0x22a3('0x4b')]);_0x437d35[_0x22a3('0x2c')]=qs[_0x22a3('0x2c')](_0x3daee7[_0x22a3('0x43')]['offset']);}return _0x2099e7['getAgents'](_0x437d35);}})[_0x22a3('0x1e')](function(_0x19273c){if(_0x19273c){return _0x19273c?{'count':_0x3d92da,'rows':_0x19273c}:null;}})['then'](respondWithResult(_0x58c245,null))['catch'](handleError(_0x58c245,null));}; \ No newline at end of file +var _0xdc98=['mapKey','CmList','Contacts','DESC','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','send','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','defaults','Messages','dataValues','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','groupName','DELIVERED','redif','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','SmsAccounts','UserProfileResource','end','stack','name','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','SmsAccount','includeAll','include','findAll','rows','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','order','removeDispositions','CannedAnswer','nolimit','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','Body','messageId','text','connectel','plivo','From','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x5cdefc,_0x252cc2){var _0x5a066d=function(_0x208f8e){while(--_0x208f8e){_0x5cdefc['push'](_0x5cdefc['shift']());}};_0x5a066d(++_0x252cc2);}(_0xdc98,0x122));var _0x8dc9=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xdc98[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0x8dc9('0x0'));var emlformat=require(_0x8dc9('0x1'));var rimraf=require(_0x8dc9('0x2'));var zipdir=require(_0x8dc9('0x3'));var jsonpatch=require(_0x8dc9('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8dc9('0x5'));var Mustache=require(_0x8dc9('0x6'));var util=require(_0x8dc9('0x7'));var path=require(_0x8dc9('0x8'));var sox=require(_0x8dc9('0x9'));var csv=require(_0x8dc9('0xa'));var ejs=require(_0x8dc9('0xb'));var fs=require('fs');var _=require(_0x8dc9('0xc'));var squel=require(_0x8dc9('0xd'));var crypto=require(_0x8dc9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8dc9('0xf'));var toCsv=require(_0x8dc9('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8dc9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8dc9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dc9('0x12'));var logger=require(_0x8dc9('0x13'))(_0x8dc9('0x14'));var utils=require('../../config/utils');var config=require(_0x8dc9('0x15'));var licenseUtil=require(_0x8dc9('0x16'));var db=require(_0x8dc9('0x17'))['db'];config['redis']=_['defaults'](config[_0x8dc9('0x18')],{'host':_0x8dc9('0x19'),'port':0x18eb});var socket=require(_0x8dc9('0x1a'))(new Redis(config['redis']));require(_0x8dc9('0x1b'))['register'](socket);var jayson=require(_0x8dc9('0x1c'));var client=jayson[_0x8dc9('0x1d')][_0x8dc9('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x40d563,_0x365c3c,_0xe09cf9,_0x2ef9d7){return new BPromise(function(_0x2f1125,_0x541fa9){var _0x101035=_0x2ef9d7||client;return _0x101035[_0x8dc9('0x1f')](_0x40d563,_0xe09cf9)['then'](function(_0xfe4428){logger[_0x8dc9('0x20')](_0x8dc9('0x21'),_0x365c3c,_0x8dc9('0x22'));logger[_0x8dc9('0x23')](_0x8dc9('0x24'),_0x365c3c,_0x8dc9('0x22'),JSON[_0x8dc9('0x25')](_0xfe4428));if(_0xfe4428[_0x8dc9('0x26')]){if(_0xfe4428[_0x8dc9('0x26')]['code']===0x1f4){logger[_0x8dc9('0x26')]('SmsAccount,\x20%s,\x20%s',_0x365c3c,_0xfe4428[_0x8dc9('0x26')][_0x8dc9('0x27')]);return _0x541fa9(_0xfe4428[_0x8dc9('0x26')]['message']);}logger[_0x8dc9('0x26')](_0x8dc9('0x21'),_0x365c3c,_0xfe4428[_0x8dc9('0x26')][_0x8dc9('0x27')]);return _0x2f1125(_0xfe4428[_0x8dc9('0x26')]['message']);}else{logger[_0x8dc9('0x20')]('SmsAccount,\x20%s,\x20%s',_0x365c3c,_0x8dc9('0x22'));_0x2f1125(_0xfe4428[_0x8dc9('0x28')][_0x8dc9('0x27')]);}})[_0x8dc9('0x29')](function(_0x56fd34){logger[_0x8dc9('0x26')](_0x8dc9('0x21'),_0x365c3c,_0x56fd34);_0x541fa9(_0x56fd34);});});}function respondWithStatusCode(_0x376a1a,_0x48e4c7){_0x48e4c7=_0x48e4c7||0xcc;return function(_0x53e57){if(_0x53e57){return _0x376a1a[_0x8dc9('0x2a')](_0x48e4c7);}return _0x376a1a[_0x8dc9('0x2b')](_0x48e4c7)['end']();};}function respondWithResult(_0x6a402b,_0x377bd1){_0x377bd1=_0x377bd1||0xc8;return function(_0x78ad9f){if(_0x78ad9f){return _0x6a402b['status'](_0x377bd1)[_0x8dc9('0x2c')](_0x78ad9f);}};}function respondWithFilteredResult(_0x4e3460,_0x19370c){return function(_0x3e8198){if(_0x3e8198){var _0x33e6d1=_0x3e8198[_0x8dc9('0x2d')],_0x1feb23=_0x19370c[_0x8dc9('0x2e')],_0x44f9a4=_0x19370c[_0x8dc9('0x2e')]+_0x19370c[_0x8dc9('0x2f')],_0x4f824c;if(_0x44f9a4>=_0x33e6d1){_0x44f9a4=_0x33e6d1;_0x4f824c=0xc8;}else{_0x4f824c=0xce;}_0x4e3460[_0x8dc9('0x2b')](_0x4f824c);return _0x4e3460[_0x8dc9('0x30')](_0x8dc9('0x31'),_0x1feb23+'-'+_0x44f9a4+'/'+_0x33e6d1)[_0x8dc9('0x2c')](_0x3e8198);}return null;};}function patchUpdates(_0x45151f){return function(_0x4f03de){try{jsonpatch['apply'](_0x4f03de,_0x45151f,!![]);}catch(_0x3ba847){return BPromise['reject'](_0x3ba847);}return _0x4f03de[_0x8dc9('0x32')]();};}function saveUpdates(_0x180f51,_0x22d96a){return function(_0x1c4109){if(_0x1c4109){return _0x1c4109[_0x8dc9('0x33')](_0x180f51)[_0x8dc9('0x34')](function(_0x1c1a94){return _0x1c1a94;});}return null;};}function removeEntity(_0x13cc31,_0xaddf51){return function(_0x49dc97){if(_0x49dc97){return _0x49dc97[_0x8dc9('0x35')]()['then'](function(){var _0xfdf9b=_0x49dc97['get']({'plain':!![]});var _0x1190fe=_0x8dc9('0x36');return db[_0x8dc9('0x37')][_0x8dc9('0x35')]({'where':{'type':_0x1190fe,'resourceId':_0xfdf9b['id']}})[_0x8dc9('0x34')](function(){return _0x49dc97;});})[_0x8dc9('0x34')](function(){_0x13cc31[_0x8dc9('0x2b')](0xcc)[_0x8dc9('0x38')]();});}};}function handleEntityNotFound(_0x196232,_0x151d40){return function(_0x135168){if(!_0x135168){_0x196232[_0x8dc9('0x2a')](0x194);}return _0x135168;};}function handleError(_0x27fd39,_0x1f31d6){_0x1f31d6=_0x1f31d6||0x1f4;return function(_0x59a642){logger[_0x8dc9('0x26')](_0x59a642[_0x8dc9('0x39')]);if(_0x59a642[_0x8dc9('0x3a')]){delete _0x59a642[_0x8dc9('0x3a')];}_0x27fd39[_0x8dc9('0x2b')](_0x1f31d6)['send'](_0x59a642);};}exports['index']=function(_0x3a7d7e,_0x41c20f){var _0x24f69f={'include':[{'model':db[_0x8dc9('0x3b')],'as':_0x8dc9('0x3c')}]},_0x251e63={},_0x51bfb8={'count':0x0,'rows':[]};var _0x1bf57f=_[_0x8dc9('0x3d')](db['SmsAccount']['rawAttributes'],function(_0x465458){return{'name':_0x465458[_0x8dc9('0x3e')],'type':_0x465458[_0x8dc9('0x3f')][_0x8dc9('0x40')]};});_0x251e63[_0x8dc9('0x41')]=_[_0x8dc9('0x3d')](_0x1bf57f,'name');_0x251e63[_0x8dc9('0x42')]=_['keys'](_0x3a7d7e[_0x8dc9('0x42')]);_0x251e63[_0x8dc9('0x43')]=_[_0x8dc9('0x44')](_0x251e63[_0x8dc9('0x41')],_0x251e63[_0x8dc9('0x42')]);_0x24f69f['attributes']=_[_0x8dc9('0x44')](_0x251e63[_0x8dc9('0x41')],qs['fields'](_0x3a7d7e[_0x8dc9('0x42')][_0x8dc9('0x45')]));_0x24f69f['attributes']=_0x24f69f[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x24f69f[_0x8dc9('0x46')]:_0x251e63['model'];if(!_0x3a7d7e['query'][_0x8dc9('0x48')]('nolimit')){_0x24f69f[_0x8dc9('0x2f')]=qs[_0x8dc9('0x2f')](_0x3a7d7e['query'][_0x8dc9('0x2f')]);_0x24f69f[_0x8dc9('0x2e')]=qs[_0x8dc9('0x2e')](_0x3a7d7e[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}_0x24f69f['order']=qs[_0x8dc9('0x49')](_0x3a7d7e['query'][_0x8dc9('0x49')]);_0x24f69f[_0x8dc9('0x4a')]=qs[_0x8dc9('0x43')](_[_0x8dc9('0x4b')](_0x3a7d7e[_0x8dc9('0x42')],_0x251e63[_0x8dc9('0x43')]),_0x1bf57f);if(_0x3a7d7e[_0x8dc9('0x42')]['filter']){_0x24f69f[_0x8dc9('0x4a')]=_['merge'](_0x24f69f[_0x8dc9('0x4a')],{'$or':_['map'](_0x1bf57f,function(_0x1ac01a){if(_0x1ac01a[_0x8dc9('0x3f')]!==_0x8dc9('0x4c')){var _0x569966={};_0x569966[_0x1ac01a[_0x8dc9('0x3a')]]={'$like':'%'+_0x3a7d7e[_0x8dc9('0x42')][_0x8dc9('0x4d')]+'%'};return _0x569966;}})});}_0x24f69f=_[_0x8dc9('0x4e')]({},_0x24f69f,_0x3a7d7e[_0x8dc9('0x4f')]);var _0x29e076={'where':_0x24f69f['where']};return db[_0x8dc9('0x50')]['count'](_0x29e076)[_0x8dc9('0x34')](function(_0x2cb573){_0x51bfb8[_0x8dc9('0x2d')]=_0x2cb573;if(_0x3a7d7e[_0x8dc9('0x42')][_0x8dc9('0x51')]){_0x24f69f[_0x8dc9('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x8dc9('0x53')](_0x24f69f);})['then'](function(_0x39073a){_0x51bfb8[_0x8dc9('0x54')]=_0x39073a;return _0x51bfb8;})[_0x8dc9('0x34')](respondWithFilteredResult(_0x41c20f,_0x24f69f))[_0x8dc9('0x29')](handleError(_0x41c20f,null));};exports['show']=function(_0x347a5c,_0xcbcca8){var _0x5c5b68={'raw':![],'where':{'id':_0x347a5c['params']['id']},'include':[{'model':db[_0x8dc9('0x3b')],'as':'mandatoryDispositionPause'}]},_0x30b3e7={};_0x30b3e7['model']=_[_0x8dc9('0x55')](db[_0x8dc9('0x50')][_0x8dc9('0x56')]);_0x30b3e7[_0x8dc9('0x42')]=_[_0x8dc9('0x55')](_0x347a5c['query']);_0x30b3e7[_0x8dc9('0x43')]=_[_0x8dc9('0x44')](_0x30b3e7['model'],_0x30b3e7[_0x8dc9('0x42')]);_0x5c5b68['attributes']=_[_0x8dc9('0x44')](_0x30b3e7[_0x8dc9('0x41')],qs['fields'](_0x347a5c[_0x8dc9('0x42')]['fields']));_0x5c5b68[_0x8dc9('0x46')]=_0x5c5b68[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x5c5b68[_0x8dc9('0x46')]:_0x30b3e7['model'];if(_0x347a5c[_0x8dc9('0x42')][_0x8dc9('0x51')]){_0x5c5b68[_0x8dc9('0x52')]=[{'all':!![]}];}_0x5c5b68=_[_0x8dc9('0x4e')]({},_0x5c5b68,_0x347a5c[_0x8dc9('0x4f')]);return db[_0x8dc9('0x50')][_0x8dc9('0x57')](_0x5c5b68)['then'](handleEntityNotFound(_0xcbcca8,null))[_0x8dc9('0x34')](respondWithResult(_0xcbcca8,null))[_0x8dc9('0x29')](handleError(_0xcbcca8,null));};exports['create']=function(_0x2d262e,_0x1237d2){return db[_0x8dc9('0x50')][_0x8dc9('0x58')](_0x2d262e[_0x8dc9('0x59')],{})[_0x8dc9('0x34')](function(_0xe31492){var _0x222c1f=_0x2d262e[_0x8dc9('0x5a')]['get']({'plain':!![]});if(!_0x222c1f)throw new Error(_0x8dc9('0x5b'));if(_0x222c1f[_0x8dc9('0x5c')]===_0x8dc9('0x5a')){var _0x4e1b44=_0xe31492[_0x8dc9('0x5d')]({'plain':!![]});var _0x40907f=_0x8dc9('0x36');return db['UserProfileSection']['find']({'where':{'name':_0x40907f,'userProfileId':_0x222c1f['userProfileId']},'raw':!![]})['then'](function(_0x581c08){if(_0x581c08&&_0x581c08[_0x8dc9('0x5e')]===0x0){return db[_0x8dc9('0x37')][_0x8dc9('0x58')]({'name':_0x4e1b44['name'],'resourceId':_0x4e1b44['id'],'type':_0x581c08[_0x8dc9('0x3a')],'sectionId':_0x581c08['id']},{})[_0x8dc9('0x34')](function(){return _0xe31492;});}else{return _0xe31492;}})[_0x8dc9('0x29')](function(_0x4d0df3){logger[_0x8dc9('0x26')](_0x8dc9('0x5f'),_0x4d0df3);throw _0x4d0df3;});}return _0xe31492;})['then'](respondWithResult(_0x1237d2,0xc9))[_0x8dc9('0x29')](handleError(_0x1237d2,null));};exports['update']=function(_0x412d2a,_0x219e94){if(_0x412d2a['body']['id']){delete _0x412d2a['body']['id'];}return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0x412d2a[_0x8dc9('0x60')]['id']},'include':[{'model':db[_0x8dc9('0x3b')],'as':_0x8dc9('0x3c')}]})['then'](handleEntityNotFound(_0x219e94,null))[_0x8dc9('0x34')](saveUpdates(_0x412d2a[_0x8dc9('0x59')],null))[_0x8dc9('0x34')](respondWithResult(_0x219e94,null))[_0x8dc9('0x29')](handleError(_0x219e94,null));};exports[_0x8dc9('0x35')]=function(_0xc0f047,_0x4fc352){return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0xc0f047[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x4fc352,null))[_0x8dc9('0x34')](removeEntity(_0x4fc352,null))[_0x8dc9('0x29')](handleError(_0x4fc352,null));};exports[_0x8dc9('0x61')]=function(_0x2605f8,_0x569b86){return db[_0x8dc9('0x50')][_0x8dc9('0x61')]()[_0x8dc9('0x34')](respondWithResult(_0x569b86,null))[_0x8dc9('0x29')](handleError(_0x569b86,null));};exports[_0x8dc9('0x62')]=function(_0x177072,_0x18a0cc,_0x56bb79){if(_0x177072[_0x8dc9('0x59')]['id']){delete _0x177072['body']['id'];}return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0x177072[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x18a0cc,null))['then'](function(_0x5e1ba8){if(_0x5e1ba8){_0x177072['body'][_0x8dc9('0x63')]=_0x5e1ba8['id'];return db['Disposition'][_0x8dc9('0x58')](_0x177072[_0x8dc9('0x59')]);}})[_0x8dc9('0x34')](respondWithResult(_0x18a0cc,null))[_0x8dc9('0x29')](handleError(_0x18a0cc,null));};exports[_0x8dc9('0x64')]=function(_0x540cc9,_0x49cbc5,_0x11023a){var _0x3c40c0={'raw':![],'where':{}};var _0x2e5e16={};var _0x5d3941={'count':0x0,'rows':[]};return db[_0x8dc9('0x50')][_0x8dc9('0x65')]({'where':{'id':_0x540cc9[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x49cbc5,null))['then'](function(_0x4ed502){if(_0x4ed502){_0x2e5e16['model']=_[_0x8dc9('0x55')](db[_0x8dc9('0x66')][_0x8dc9('0x56')]);_0x2e5e16['query']=_[_0x8dc9('0x55')](_0x540cc9['query']);_0x2e5e16[_0x8dc9('0x43')]=_['intersection'](_0x2e5e16[_0x8dc9('0x41')],_0x2e5e16['query']);_0x3c40c0[_0x8dc9('0x46')]=_['intersection'](_0x2e5e16['model'],qs[_0x8dc9('0x45')](_0x540cc9['query']['fields']));_0x3c40c0[_0x8dc9('0x46')]=_0x3c40c0[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x3c40c0[_0x8dc9('0x46')]:_0x2e5e16[_0x8dc9('0x41')];if(!_0x540cc9[_0x8dc9('0x42')]['hasOwnProperty']('nolimit')){_0x3c40c0[_0x8dc9('0x2f')]=qs[_0x8dc9('0x2f')](_0x540cc9['query']['limit']);_0x3c40c0[_0x8dc9('0x2e')]=qs[_0x8dc9('0x2e')](_0x540cc9[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}_0x3c40c0[_0x8dc9('0x67')]=qs[_0x8dc9('0x49')](_0x540cc9[_0x8dc9('0x42')]['sort']);_0x3c40c0[_0x8dc9('0x4a')]=qs[_0x8dc9('0x43')](_[_0x8dc9('0x4b')](_0x540cc9['query'],_0x2e5e16[_0x8dc9('0x43')]));_0x3c40c0[_0x8dc9('0x4a')][_0x8dc9('0x63')]=_0x4ed502['id'];if(_0x540cc9[_0x8dc9('0x42')][_0x8dc9('0x4d')]){_0x3c40c0[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x3c40c0[_0x8dc9('0x4a')],{'$or':_['map'](_0x3c40c0['attributes'],function(_0x24d0ff){var _0x315fb8={};_0x315fb8[_0x24d0ff]={'$like':'%'+_0x540cc9[_0x8dc9('0x42')][_0x8dc9('0x4d')]+'%'};return _0x315fb8;})});}_0x3c40c0=_['merge']({},_0x3c40c0,_0x540cc9[_0x8dc9('0x4f')]);return db['Disposition']['count']({'where':_0x3c40c0[_0x8dc9('0x4a')]})[_0x8dc9('0x34')](function(_0x127dd3){_0x5d3941[_0x8dc9('0x2d')]=_0x127dd3;if(_0x540cc9[_0x8dc9('0x42')][_0x8dc9('0x51')]){_0x3c40c0[_0x8dc9('0x52')]=[{'all':!![]}];}return db[_0x8dc9('0x66')][_0x8dc9('0x53')](_0x3c40c0);})[_0x8dc9('0x34')](function(_0x56adbf){_0x5d3941[_0x8dc9('0x54')]=_0x56adbf;return _0x5d3941;});}})[_0x8dc9('0x34')](respondWithFilteredResult(_0x49cbc5,_0x3c40c0))['catch'](handleError(_0x49cbc5,null));};exports[_0x8dc9('0x68')]=function(_0x46d7c4,_0x595735,_0x2eb016){return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x46d7c4[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x595735,null))['then'](function(_0x2cf3fb){if(_0x2cf3fb){return _0x2cf3fb[_0x8dc9('0x68')](_0x46d7c4[_0x8dc9('0x42')]['ids']);}})[_0x8dc9('0x34')](respondWithStatusCode(_0x595735,null))[_0x8dc9('0x29')](handleError(_0x595735,null));};exports['addAnswer']=function(_0x322a03,_0x30f1f3,_0x47367c){if(_0x322a03['body']['id']){delete _0x322a03[_0x8dc9('0x59')]['id'];}return db['SmsAccount'][_0x8dc9('0x57')]({'where':{'id':_0x322a03[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0x30f1f3,null))['then'](function(_0x35b24a){if(_0x35b24a){_0x322a03[_0x8dc9('0x59')][_0x8dc9('0x63')]=_0x35b24a['id'];return db[_0x8dc9('0x69')][_0x8dc9('0x58')](_0x322a03[_0x8dc9('0x59')]);}})[_0x8dc9('0x34')](respondWithResult(_0x30f1f3,null))[_0x8dc9('0x29')](handleError(_0x30f1f3,null));};exports['getAnswers']=function(_0x379be7,_0x4d17b7,_0x1e9b10){var _0x46b006={'raw':![],'where':{}};var _0x3eda54={};var _0x52323a={'count':0x0,'rows':[]};return db[_0x8dc9('0x50')][_0x8dc9('0x65')]({'where':{'id':_0x379be7[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x4d17b7,null))['then'](function(_0x1f7e25){if(_0x1f7e25){_0x3eda54[_0x8dc9('0x41')]=_[_0x8dc9('0x55')](db[_0x8dc9('0x69')][_0x8dc9('0x56')]);_0x3eda54[_0x8dc9('0x42')]=_['keys'](_0x379be7['query']);_0x3eda54[_0x8dc9('0x43')]=_['intersection'](_0x3eda54[_0x8dc9('0x41')],_0x3eda54['query']);_0x46b006[_0x8dc9('0x46')]=_[_0x8dc9('0x44')](_0x3eda54[_0x8dc9('0x41')],qs['fields'](_0x379be7[_0x8dc9('0x42')]['fields']));_0x46b006[_0x8dc9('0x46')]=_0x46b006[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x46b006[_0x8dc9('0x46')]:_0x3eda54[_0x8dc9('0x41')];if(!_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x48')](_0x8dc9('0x6a'))){_0x46b006[_0x8dc9('0x2f')]=qs['limit'](_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x2f')]);_0x46b006[_0x8dc9('0x2e')]=qs[_0x8dc9('0x2e')](_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}_0x46b006['order']=qs[_0x8dc9('0x49')](_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x49')]);_0x46b006[_0x8dc9('0x4a')]=qs['filters'](_[_0x8dc9('0x4b')](_0x379be7[_0x8dc9('0x42')],_0x3eda54[_0x8dc9('0x43')]));_0x46b006[_0x8dc9('0x4a')][_0x8dc9('0x63')]=_0x1f7e25['id'];if(_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x4d')]){_0x46b006[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x46b006[_0x8dc9('0x4a')],{'$or':_[_0x8dc9('0x3d')](_0x46b006[_0x8dc9('0x46')],function(_0x90362a){var _0x5e295d={};_0x5e295d[_0x90362a]={'$like':'%'+_0x379be7['query'][_0x8dc9('0x4d')]+'%'};return _0x5e295d;})});}_0x46b006=_[_0x8dc9('0x4e')]({},_0x46b006,_0x379be7[_0x8dc9('0x4f')]);return db[_0x8dc9('0x69')]['count']({'where':_0x46b006[_0x8dc9('0x4a')]})[_0x8dc9('0x34')](function(_0x5bb468){_0x52323a[_0x8dc9('0x2d')]=_0x5bb468;if(_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x51')]){_0x46b006[_0x8dc9('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x46b006);})[_0x8dc9('0x34')](function(_0x38b280){_0x52323a[_0x8dc9('0x54')]=_0x38b280;return _0x52323a;});}})[_0x8dc9('0x34')](respondWithFilteredResult(_0x4d17b7,_0x46b006))[_0x8dc9('0x29')](handleError(_0x4d17b7,null));};exports[_0x8dc9('0x6b')]=function(_0x375d25,_0x2998ff,_0x42682e){return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x375d25[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x2998ff,null))[_0x8dc9('0x34')](function(_0x4a015c){if(_0x4a015c){return _0x4a015c['removeAnswers'](_0x375d25[_0x8dc9('0x42')][_0x8dc9('0x6c')]);}})[_0x8dc9('0x34')](respondWithStatusCode(_0x2998ff,null))['catch'](handleError(_0x2998ff,null));};exports[_0x8dc9('0x6d')]=function(_0x3024ed,_0x1f0556,_0x328700){var _0x455625={'channel':_0x8dc9('0x6e')};var _0x15612e=[];var _0x2106e2=[];var _0xb523c9={};return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x3024ed[_0x8dc9('0x60')]['id']},'include':[{'model':db[_0x8dc9('0x6f')],'as':_0x8dc9('0x70')}]})[_0x8dc9('0x34')](handleEntityNotFound(_0x1f0556,null))[_0x8dc9('0x34')](function(_0x5aebdd){_0x455625[_0x8dc9('0x71')]=_0x5aebdd;_0x455625[_0x8dc9('0x72')]=_[_0x8dc9('0x73')](_0x5aebdd[_0x8dc9('0x70')],[_0x8dc9('0x74')],[_0x8dc9('0x75')]);if(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x70')]){delete _0x455625['account']['Applications'];}return db[_0x8dc9('0x76')][_0x8dc9('0x61')]();})[_0x8dc9('0x34')](function(_0x3a6558){if(!_0x3a6558){throw new db[(_0x8dc9('0x77'))]['ValidationError'](_0x8dc9('0x78'));}_0x15612e=_[_0x8dc9('0x79')](_[_0x8dc9('0x55')](_0x3a6558),[_0x8dc9('0x7a'),_0x8dc9('0x7b')]);_0x2106e2=_[_0x8dc9('0x79')](_[_0x8dc9('0x55')](_0x3a6558),[_0x8dc9('0x7a'),'updatedAt',_0x8dc9('0x7c'),_0x8dc9('0x7d')]);_0x455625[_0x8dc9('0x59')]={'mapKey':'mobile'};if(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x3f')]){switch(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x3f')]){case _0x8dc9('0x7e'):_0x455625['body'][_0x8dc9('0x7f')]=_0x3024ed['body']['From'];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x80')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')]['MessageSid'];break;case'skebby':_0x455625['body'][_0x8dc9('0x7f')]='+'+_0x3024ed[_0x8dc9('0x59')]['sender'];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed['body'][_0x8dc9('0x82')];break;case _0x8dc9('0x83'):_0x455625[_0x8dc9('0x59')]['from']=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x7f')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x27')];break;case'clicksend':_0x455625['body'][_0x8dc9('0x7f')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x7f')];_0x455625[_0x8dc9('0x59')]['body']=_0x3024ed['body'][_0x8dc9('0x59')];_0x455625['body'][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')]['message_id'];break;case _0x8dc9('0x84'):_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')]=_0x3024ed['body'][_0x8dc9('0x85')];_0x455625['body'][_0x8dc9('0x59')]=_0x3024ed['body'][_0x8dc9('0x86')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x87')];break;case _0x8dc9('0x88'):_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')]='+'+_0x3024ed['body'][_0x8dc9('0x89')][0x0][_0x8dc9('0x7f')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed['body']['results'][0x0][_0x8dc9('0x82')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')]['results'][0x0][_0x8dc9('0x81')];break;case _0x8dc9('0x8a'):_0x455625[_0x8dc9('0x59')]['from']=_0x3024ed[_0x8dc9('0x59')]['originatingAddress'];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x8b')]['message'];break;case _0x8dc9('0x8c'):_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x8d')];_0x455625['body'][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x82')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x8e')];break;case _0x8dc9('0x8f'):_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x7f')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x27')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x90')];break;}}if(_0x455625['body']['id']){delete _0x455625[_0x8dc9('0x59')]['id'];}if(_[_0x8dc9('0x91')](_0x455625['body'][_0x8dc9('0x7f')])){throw new db[(_0x8dc9('0x77'))][(_0x8dc9('0x92'))](_0x8dc9('0x93'));}if(_['isNil'](_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')])||_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]===''){throw new db['Sequelize'][(_0x8dc9('0x92'))](_0x8dc9('0x94'));}if(_[_0x8dc9('0x91')](_0x455625[_0x8dc9('0x59')]['mapKey'])){throw new db[(_0x8dc9('0x77'))][(_0x8dc9('0x92'))](_0x8dc9('0x95')+_0x2106e2);}if(!_['includes'](_0x2106e2,_0x455625[_0x8dc9('0x59')][_0x8dc9('0x96')])){throw new db['Sequelize'][(_0x8dc9('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2106e2);}_0xb523c9[_0x455625[_0x8dc9('0x59')][_0x8dc9('0x96')]]=_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')];return db[_0x8dc9('0x97')]['find']({'where':{'id':_0x455625[_0x8dc9('0x71')][_0x8dc9('0x7d')]},'include':[{'model':db[_0x8dc9('0x76')],'as':_0x8dc9('0x98'),'where':_0xb523c9,'limit':0x1,'order':[[_0x8dc9('0x7b'),_0x8dc9('0x99')]]}]});})[_0x8dc9('0x34')](handleEntityNotFound(_0x1f0556,null))['then'](function(_0xc8b1f5){if(_0xc8b1f5){_0x455625['list']=_['omit'](_0xc8b1f5,[_0x8dc9('0x98')]);if(_0xc8b1f5[_0x8dc9('0x98')][_0x8dc9('0x47')]){return _0xc8b1f5[_0x8dc9('0x98')][0x0];}var _0x5199fd=_['defaults'](_0x455625[_0x8dc9('0x59')],{'firstName':_0x455625['body'][_0x8dc9('0x7f')],'ListId':_0xc8b1f5['id']});_0x5199fd[_0x455625[_0x8dc9('0x59')]['mapKey']]=_0x455625['body'][_0x8dc9('0x7f')];return db[_0x8dc9('0x76')][_0x8dc9('0x58')](_0x5199fd,{'fields':_0x15612e,'raw':!![]});}})[_0x8dc9('0x34')](handleEntityNotFound(_0x1f0556,null))[_0x8dc9('0x34')](function(_0x14151e){if(_0x14151e){_0x455625[_0x8dc9('0x9a')]=_0x14151e;var _0x2e4b96={'ContactId':_0x14151e['id'],'phone':_0x455625['body'][_0x8dc9('0x7f')],'SmsAccountId':_0x3024ed['params']['id']};var _0x2aa739={'ContactId':_0x14151e['id'],'SmsAccountId':_0x3024ed[_0x8dc9('0x60')]['id'],'closed':![]};return db[_0x8dc9('0x9b')][_0x8dc9('0x57')]({'where':_0x2aa739})['then'](function(_0x4f16e7){if(_0x4f16e7){return[_0x4f16e7,![]];}return db[_0x8dc9('0x9b')][_0x8dc9('0x58')](_0x2e4b96)[_0x8dc9('0x34')](function(_0x286f23){return[_0x286f23,!![]];});});}})[_0x8dc9('0x9c')](function(_0x5c8418,_0x41926c){_0x455625['interaction']=_0x5c8418[_0x8dc9('0x5d')]({'plain':!![]});_0x455625[_0x8dc9('0x9d')][_0x8dc9('0x9e')]=![];if(_0x41926c){if(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x9f')]){_0x455625[_0x8dc9('0x72')][_0x8dc9('0xa0')]({'id':0x0,'priority':_0x455625[_0x8dc9('0x72')]['length']+0x1,'app':'close','appdata':_0x8dc9('0xa1'),'interval':_0x8dc9('0xa2')});}_0x455625[_0x8dc9('0x9d')]['created']=!![];}return db[_0x8dc9('0xa3')][_0x8dc9('0x58')]({'phone':_0x455625[_0x8dc9('0x59')]['from'],'messageId':_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')],'body':_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')],'SmsAccountId':_0x3024ed[_0x8dc9('0x60')]['id'],'SmsInteractionId':_0x5c8418['id'],'direction':'in','ContactId':_0x5c8418[_0x8dc9('0xa4')],'AttachmentId':_0x455625['body'][_0x8dc9('0xa5')]});})['then'](function(_0x5a09a8){_0x455625[_0x8dc9('0x27')]=_0x5a09a8;if(_0x455625[_0x8dc9('0x9d')][_0x8dc9('0xa6')]){return db[_0x8dc9('0xa7')][_0x8dc9('0x57')]({'attributes':['id',_0x8dc9('0x3a')],'where':{'id':_0x455625['interaction'][_0x8dc9('0xa6')]}})[_0x8dc9('0x34')](function(_0x11389b){if(_0x11389b){_0x455625[_0x8dc9('0x72')][_0x8dc9('0xa8')]({'id':0x0,'priority':0x0,'app':_0x8dc9('0xa9'),'appdata':_0x11389b[_0x8dc9('0x3a')]+','+(_0x455625['account'][_0x8dc9('0xaa')]||0xa),'interval':_0x8dc9('0xa2')});}return respondWithRpcPromise(_0x8dc9('0xab'),'startRouting',_0x455625);});}return respondWithRpcPromise(_0x8dc9('0xab'),'startRouting',_0x455625);})[_0x8dc9('0x34')](function(_0x41ca4d){if(_0x41ca4d){var _0x5e17fc=0xc8;var _0x226bb4=_0x8dc9('0xac');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x226bb4,_0x5e17fc,_0x8dc9('0xad'));logger[_0x8dc9('0x23')](_0x8dc9('0xae'),_0x226bb4,_0x5e17fc,_0x8dc9('0xad'),JSON[_0x8dc9('0x25')](_0x41ca4d));if(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x3f')]===_0x8dc9('0x7e')){return _0x1f0556['status'](_0x5e17fc)['set']('Content-Type',_0x8dc9('0xaf'))[_0x8dc9('0xb0')]('\x0a');}else{return _0x1f0556[_0x8dc9('0x2b')](_0x5e17fc)[_0x8dc9('0x2c')](_0x41ca4d);}}})['catch'](handleError(_0x1f0556,null));};exports['addApplications']=function(_0x5f370d,_0x2ce674,_0x565687){return db[_0x8dc9('0x50')][_0x8dc9('0x65')]({'where':{'id':_0x5f370d[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x2ce674,null))[_0x8dc9('0x34')](function(_0x428934){if(_0x428934){return db[_0x8dc9('0xb1')][_0x8dc9('0xb2')](function(_0x356c5a){return db[_0x8dc9('0x6f')][_0x8dc9('0x35')]({'where':{'SmsAccountId':_0x5f370d[_0x8dc9('0x60')]['id']},'transaction':_0x356c5a})[_0x8dc9('0x34')](function(_0x1ff694){var _0x4c076d=_[_0x8dc9('0x3d')](_0x5f370d[_0x8dc9('0x59')],function(_0x3328f3){_0x3328f3[_0x8dc9('0x63')]=_0x5f370d[_0x8dc9('0x60')]['id'];return _0x3328f3;});return db['SmsApplication'][_0x8dc9('0xb3')](_0x4c076d,{'transaction':_0x356c5a});});})[_0x8dc9('0x34')](function(){return db['SmsApplication'][_0x8dc9('0xb4')]({'where':{'SmsAccountId':_0x5f370d['params']['id']},'order':_0x8dc9('0x74')});});}})[_0x8dc9('0x34')](respondWithResult(_0x2ce674,null))[_0x8dc9('0x29')](handleError(_0x2ce674,null));};exports[_0x8dc9('0xb5')]=function(_0x7c76e4,_0x51c37a,_0x206b48){var _0x32129a={};var _0x449454={};var _0x4a59ba;var _0x1f8a0b;return db[_0x8dc9('0x50')]['findOne']({'where':{'id':_0x7c76e4[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0x51c37a,null))[_0x8dc9('0x34')](function(_0x3444aa){if(_0x3444aa){_0x4a59ba=_0x3444aa;_0x449454[_0x8dc9('0x41')]=_[_0x8dc9('0x55')](db[_0x8dc9('0x6f')][_0x8dc9('0x56')]);_0x449454['query']=_['keys'](_0x7c76e4[_0x8dc9('0x42')]);_0x449454['filters']=_[_0x8dc9('0x44')](_0x449454[_0x8dc9('0x41')],_0x449454[_0x8dc9('0x42')]);_0x32129a[_0x8dc9('0x46')]=_['intersection'](_0x449454[_0x8dc9('0x41')],qs['fields'](_0x7c76e4[_0x8dc9('0x42')]['fields']));_0x32129a[_0x8dc9('0x46')]=_0x32129a[_0x8dc9('0x46')]['length']?_0x32129a[_0x8dc9('0x46')]:_0x449454[_0x8dc9('0x41')];_0x32129a[_0x8dc9('0x67')]=qs[_0x8dc9('0x49')](_0x7c76e4[_0x8dc9('0x42')][_0x8dc9('0x49')]);_0x32129a[_0x8dc9('0x4a')]=qs[_0x8dc9('0x43')](_['pick'](_0x7c76e4[_0x8dc9('0x42')],_0x449454[_0x8dc9('0x43')]));if(_0x7c76e4[_0x8dc9('0x42')]['filter']){_0x32129a[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x32129a['where'],{'$or':_[_0x8dc9('0x3d')](_0x32129a[_0x8dc9('0x46')],function(_0x2e5dfe){var _0x55ef9b={};_0x55ef9b[_0x2e5dfe]={'$like':'%'+_0x7c76e4[_0x8dc9('0x42')]['filter']+'%'};return _0x55ef9b;})});}_0x32129a=_[_0x8dc9('0x4e')]({},_0x32129a,_0x7c76e4['options']);return _0x4a59ba[_0x8dc9('0xb5')](_0x32129a);}})['then'](function(_0x4553cf){if(_0x4553cf){_0x1f8a0b=_0x4553cf[_0x8dc9('0x47')];if(!_0x7c76e4[_0x8dc9('0x42')][_0x8dc9('0x48')](_0x8dc9('0x6a'))){_0x32129a['limit']=qs[_0x8dc9('0x2f')](_0x7c76e4[_0x8dc9('0x42')]['limit']);_0x32129a[_0x8dc9('0x2e')]=qs[_0x8dc9('0x2e')](_0x7c76e4[_0x8dc9('0x42')]['offset']);}return _0x4a59ba[_0x8dc9('0xb5')](_0x32129a);}})[_0x8dc9('0x34')](function(_0x56a7ff){if(_0x56a7ff){return _0x56a7ff?{'count':_0x1f8a0b,'rows':_0x56a7ff}:null;}})[_0x8dc9('0x34')](respondWithResult(_0x51c37a,null))[_0x8dc9('0x29')](handleError(_0x51c37a,null));};exports[_0x8dc9('0xb6')]=function(_0xb8cb6f,_0xde7eaf,_0x9e54f6){var _0x34e78e={'raw':![],'where':{}};var _0x356737={};var _0x9db5fe={'count':0x0,'rows':[]};return db[_0x8dc9('0x50')][_0x8dc9('0x65')]({'where':{'id':_0xb8cb6f[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0xde7eaf,null))['then'](function(_0x68a0ea){if(_0x68a0ea){_0x356737['model']=_['keys'](db[_0x8dc9('0x9b')][_0x8dc9('0x56')]);_0x356737[_0x8dc9('0x42')]=_[_0x8dc9('0x55')](_0xb8cb6f[_0x8dc9('0x42')]);_0x356737[_0x8dc9('0x43')]=_['intersection'](_0x356737['model'],_0x356737[_0x8dc9('0x42')]);_0x34e78e[_0x8dc9('0x46')]=_[_0x8dc9('0x44')](_0x356737[_0x8dc9('0x41')],qs[_0x8dc9('0x45')](_0xb8cb6f['query'][_0x8dc9('0x45')]));_0x34e78e[_0x8dc9('0x46')]=_0x34e78e[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x34e78e[_0x8dc9('0x46')]:_0x356737['model'];if(!_0xb8cb6f['query'][_0x8dc9('0x48')](_0x8dc9('0x6a'))){_0x34e78e[_0x8dc9('0x2f')]=qs[_0x8dc9('0x2f')](_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0x2f')]);_0x34e78e[_0x8dc9('0x2e')]=qs['offset'](_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}_0x34e78e['order']=qs[_0x8dc9('0x49')](_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0x49')]);_0x34e78e['where']=qs[_0x8dc9('0x43')](_[_0x8dc9('0x4b')](_0xb8cb6f[_0x8dc9('0x42')],_0x356737['filters']));_0x34e78e[_0x8dc9('0x4a')][_0x8dc9('0x63')]=_0x68a0ea['id'];if(_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0x4d')]){_0x34e78e[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x34e78e['where'],{'$or':_['map'](_0x34e78e[_0x8dc9('0x46')],function(_0x33a7cf){var _0x172b72={};_0x172b72[_0x33a7cf]={'$like':'%'+_0xb8cb6f['query'][_0x8dc9('0x4d')]+'%'};return _0x172b72;})});}_0x34e78e=_[_0x8dc9('0x4e')]({},_0x34e78e,_0xb8cb6f['options']);return db[_0x8dc9('0x9b')][_0x8dc9('0x2d')]({'where':_0x34e78e[_0x8dc9('0x4a')]})[_0x8dc9('0x34')](function(_0x5ba421){_0x9db5fe[_0x8dc9('0x2d')]=_0x5ba421;if(_0xb8cb6f[_0x8dc9('0x42')]['includeAll']){_0x34e78e[_0x8dc9('0x52')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x8dc9('0xa7')],'as':'Owner','attributes':[_0x8dc9('0x3a'),_0x8dc9('0xb7'),'internal'],'required':![]},{'model':db[_0x8dc9('0xb8')],'as':_0x8dc9('0xb9'),'attributes':['id',_0x8dc9('0x3a'),_0x8dc9('0xba')],'where':_0xb8cb6f['query'][_0x8dc9('0xbb')]?{'id':_0xb8cb6f[_0x8dc9('0x42')]['tag']}:undefined,'required':_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0xbb')]?!![]:![]}];}return db['SmsInteraction'][_0x8dc9('0x53')](_0x34e78e);})['then'](function(_0x4288a8){_0x9db5fe[_0x8dc9('0x54')]=_0x4288a8;return _0x9db5fe;});}})[_0x8dc9('0x34')](respondWithFilteredResult(_0xde7eaf,_0x34e78e))['catch'](handleError(_0xde7eaf,null));};exports[_0x8dc9('0xb0')]=function(_0x27af6b,_0x6783d4,_0x663d28){var _0x4795ea,_0x5c4e3f,_0x562681;if(_['isNil'](_0x27af6b[_0x8dc9('0x59')][_0x8dc9('0x59')])||_0x27af6b[_0x8dc9('0x59')]['body']===''){throw new db[(_0x8dc9('0x77'))][(_0x8dc9('0x92'))](_0x8dc9('0x94'));}if(_[_0x8dc9('0x91')](_0x27af6b[_0x8dc9('0x59')]['to'])){throw new db[(_0x8dc9('0x77'))][(_0x8dc9('0x92'))](_0x8dc9('0xbc'));}_0x4795ea=_0x27af6b['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x27af6b['params']['id']},'include':[{'model':db[_0x8dc9('0x97')],'as':_0x8dc9('0xbd'),'include':[{'model':db[_0x8dc9('0x76')],'as':_0x8dc9('0x98'),'where':{'mobile':_0x4795ea},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x8dc9('0x34')](handleEntityNotFound(_0x6783d4,null))[_0x8dc9('0x34')](function(_0x42b5e0){if(_0x42b5e0&&_0x42b5e0['List']){_0x5c4e3f=_0x42b5e0[_0x8dc9('0x5d')]({'plain':!![]});if(_0x5c4e3f['List']&&_0x5c4e3f[_0x8dc9('0xbd')]['Contacts'][_0x8dc9('0x47')]){return _0x5c4e3f[_0x8dc9('0xbd')][_0x8dc9('0x98')][0x0];}return db['CmContact'][_0x8dc9('0x58')](_[_0x8dc9('0xbe')](_0x27af6b[_0x8dc9('0x59')],{'firstName':_0x4795ea,'mobile':_0x4795ea,'phone':_0x4795ea,'ListId':_0x5c4e3f[_0x8dc9('0x7d')]}));}})[_0x8dc9('0x34')](handleEntityNotFound(_0x6783d4,null))['then'](function(_0x59d2f6){if(_0x59d2f6){_0x562681=_0x59d2f6;return db[_0x8dc9('0x9b')][_0x8dc9('0x57')]({'where':{'ContactId':_0x562681['id'],'closed':![],'SmsAccountId':_0x5c4e3f['id']}})[_0x8dc9('0x34')](function(_0x127b61){if(_0x127b61){return[_0x127b61,![]];}return db[_0x8dc9('0x9b')]['create']({'UserId':_0x27af6b[_0x8dc9('0x5a')]['id'],'ContactId':_0x562681['id'],'SmsAccountId':_0x5c4e3f['id'],'phone':_0x4795ea,'firstMsgDirection':'out','Messages':[_[_0x8dc9('0x4e')](_0x27af6b[_0x8dc9('0x59')],{'read':![],'body':_0x27af6b[_0x8dc9('0x59')]['body'],'phone':_0x4795ea,'SmsAccountId':_0x5c4e3f['id'],'UserId':_0x27af6b['user']['id'],'ContactId':_0x562681['id']})]},{'include':[{'model':db[_0x8dc9('0xa3')],'as':_0x8dc9('0xbf')}]})[_0x8dc9('0x34')](function(_0x576e89){return[_0x576e89,!![]];});});}})[_0x8dc9('0x9c')](function(_0x4737df,_0x42e1f1){if(_0x42e1f1){return _0x4737df;}return db[_0x8dc9('0xa3')][_0x8dc9('0x58')](_[_0x8dc9('0x4e')](_0x27af6b['body'],{'read':![],'body':_0x27af6b[_0x8dc9('0x59')][_0x8dc9('0x59')],'phone':_0x4795ea,'SmsAccountId':_0x5c4e3f['id'],'SmsInteractionId':_0x4737df['id'],'UserId':_0x27af6b['user']['id'],'ContactId':_0x562681['id']}))[_0x8dc9('0x34')](function(_0x2bbff4){_0x4737df[_0x8dc9('0xc0')][_0x8dc9('0xbf')]=[];_0x4737df['dataValues'][_0x8dc9('0xbf')][_0x8dc9('0xa0')](_0x2bbff4[_0x8dc9('0xc0')]);return _0x4737df;});})[_0x8dc9('0x34')](respondWithResult(_0x6783d4,null))[_0x8dc9('0x29')](handleError(_0x6783d4,null));};exports['status']=function(_0x3af2e5,_0x1edbb1,_0x45138a){if(_0x3af2e5[_0x8dc9('0x59')]['id']){delete _0x3af2e5[_0x8dc9('0x59')]['id'];}console['log'](_0x8dc9('0xc1'),_0x3af2e5[_0x8dc9('0x59')]);var _0x70ee6f,_0x97c29a,_0x3fca6d;return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0x3af2e5[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x1edbb1,null))[_0x8dc9('0x34')](function(_0x51ca50){if(_0x51ca50){_0x3fca6d=_0x51ca50;logger[_0x8dc9('0x23')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xc2'),_0x51ca50['type'],util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));switch(_0x51ca50['type']){case'skebby':if(_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc4')]&&_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0x2b')]){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')]['status'];return db[_0x8dc9('0xa3')]['find']({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc4')]}});}break;case'connectel':if(_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc5')]&&_0x3af2e5['body']['statusInt']){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc6')];return db[_0x8dc9('0xa3')][_0x8dc9('0x57')]({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc5')]}});}break;case _0x8dc9('0xc7'):if(_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc8')]&&_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc9')]){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc9')];return db[_0x8dc9('0xa3')]['find']({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc8')]}});}break;case _0x8dc9('0x88'):var _0x37475b=_0x3af2e5[_0x8dc9('0x59')]['results'][0x0];if(_0x37475b[_0x8dc9('0x81')]&&_0x37475b[_0x8dc9('0x2b')][_0x8dc9('0xca')]===_0x8dc9('0xcb')){_0x97c29a=_0x37475b[_0x8dc9('0x2b')][_0x8dc9('0xca')];return db[_0x8dc9('0xa3')]['find']({'where':{'messageId':_0x37475b[_0x8dc9('0x81')]}});}break;case _0x8dc9('0x8c'):if(_0x3af2e5[_0x8dc9('0x59')]['messageId']&&_0x3af2e5[_0x8dc9('0x59')]['status']){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0x2b')];return db[_0x8dc9('0xa3')][_0x8dc9('0x57')]({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')]['messageId']}});}break;case _0x8dc9('0x8f'):if(_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xcc')]&&_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0x2b')]){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0x2b')];return db[_0x8dc9('0xa3')]['find']({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xcc')]}});}break;}}})[_0x8dc9('0x34')](handleEntityNotFound(_0x1edbb1,null))[_0x8dc9('0x34')](function(_0x2021f4){if(_0x2021f4){_0x70ee6f=_0x2021f4;switch(_0x3fca6d['type']){case _0x8dc9('0xcd'):if(_0x97c29a===_0x8dc9('0xcb')){return _0x70ee6f[_0x8dc9('0x33')]({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xcd'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8dc9('0x83'):if(_0x97c29a==='1'){return _0x70ee6f[_0x8dc9('0x33')]({'read':!![]});}else{logger['error'](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xcd'),util[_0x8dc9('0xc3')](_0x3af2e5['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xce')]&&_0x97c29a>=0xc8&&_0x97c29a<=0xce){return _0x70ee6f['update']({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xc7'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8dc9('0x88'):var _0x15abda=_0x3af2e5[_0x8dc9('0x59')]['results'][0x0];if(_0x15abda[_0x8dc9('0x2b')][_0x8dc9('0xca')]===_0x8dc9('0xcb')){return _0x70ee6f['update']({'read':!![]});}else{logger['error'](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0x88'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8dc9('0x8c'):if(_0x97c29a==_0x8dc9('0xcf')||_0x97c29a==_0x8dc9('0xd0')){return _0x70ee6f['update']({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0x8c'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8dc9('0x8f'):if(_0x97c29a==='DELIVRD'||_0x97c29a===_0x8dc9('0xd1')){return _0x70ee6f['update']({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),'status',_0x8dc9('0x8f'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x70ee6f;}})['then'](respondWithResult(_0x1edbb1,null))[_0x8dc9('0x29')](handleError(_0x1edbb1,null));};exports[_0x8dc9('0xd2')]=function(_0x24c648,_0x2198aa,_0x15860e){var _0x3f3a33,_0x41dfef,_0x215cd2;return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x24c648[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0x2198aa,null))[_0x8dc9('0x34')](function(_0x37f8e8){if(_0x37f8e8){_0x215cd2=_0x37f8e8;logger[_0x8dc9('0x23')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xc2'),_0x37f8e8[_0x8dc9('0x3f')],util[_0x8dc9('0xc3')](_0x24c648[_0x8dc9('0x42')],{'showHidden':![],'depth':null}));switch(_0x37f8e8['type']){case _0x8dc9('0x8a'):if(_0x24c648[_0x8dc9('0x42')][_0x8dc9('0xd3')]&&_0x24c648[_0x8dc9('0x42')][_0x8dc9('0xd4')]){_0x41dfef=_0x24c648[_0x8dc9('0x42')][_0x8dc9('0xd4')];return db['SmsMessage'][_0x8dc9('0x57')]({'where':{'messageId':_0x24c648[_0x8dc9('0x42')][_0x8dc9('0xd3')]}});}break;}}})[_0x8dc9('0x34')](handleEntityNotFound(_0x2198aa,null))[_0x8dc9('0x34')](function(_0x2bf85d){if(_0x2bf85d){_0x3f3a33=_0x2bf85d;switch(_0x215cd2[_0x8dc9('0x3f')]){case _0x8dc9('0x8a'):if(_0x41dfef==='2'||_0x41dfef==='6'){return _0x3f3a33[_0x8dc9('0x33')]({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0x8a'),util['inspect'](_0x24c648[_0x8dc9('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x3f3a33;}})[_0x8dc9('0x34')](respondWithResult(_0x2198aa,null))['catch'](handleError(_0x2198aa,null));};exports[_0x8dc9('0xd5')]=function(_0x5ad9fa,_0x38c702,_0x538e7d){return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0x5ad9fa[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x38c702,null))['then'](function(_0x457db1){if(_0x457db1){return _0x457db1[_0x8dc9('0xd5')](_0x5ad9fa[_0x8dc9('0x59')][_0x8dc9('0x6c')],_[_0x8dc9('0xd6')](_0x5ad9fa[_0x8dc9('0x59')],[_0x8dc9('0x6c'),'id'])||{})[_0x8dc9('0x9c')](function(_0xe213a7){for(var _0x522c64=0x0;_0x522c64<_0x5ad9fa[_0x8dc9('0x59')][_0x8dc9('0x6c')][_0x8dc9('0x47')];_0x522c64+=0x1){socket[_0x8dc9('0xd7')](_0x8dc9('0xd8'),{'UserId':_0x5ad9fa['body'][_0x8dc9('0x6c')][_0x522c64],'SmsAccountId':_0x5ad9fa[_0x8dc9('0x60')]['id']});}return _0xe213a7;});}})[_0x8dc9('0x34')](respondWithResult(_0x38c702,null))[_0x8dc9('0x29')](handleError(_0x38c702,null));};exports['removeAgents']=function(_0x3a26f0,_0x39b015,_0x184ed5){return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x3a26f0[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0x39b015,null))[_0x8dc9('0x34')](function(_0x15e471){if(_0x15e471){return _0x15e471[_0x8dc9('0xd9')](_0x3a26f0['query']['ids'])['then'](function(){if(_['isArray'](_0x3a26f0['query'][_0x8dc9('0x6c')])){for(var _0x5b204a=0x0;_0x5b204a<_0x3a26f0['query'][_0x8dc9('0x6c')][_0x8dc9('0x47')];_0x5b204a+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x3a26f0[_0x8dc9('0x42')][_0x8dc9('0x6c')][_0x5b204a]),'SmsAccountId':Number(_0x3a26f0[_0x8dc9('0x60')]['id'])});}}else{socket[_0x8dc9('0xd7')](_0x8dc9('0xda'),{'UserId':Number(_0x3a26f0[_0x8dc9('0x42')][_0x8dc9('0x6c')]),'SmsAccountId':Number(_0x3a26f0[_0x8dc9('0x60')]['id'])});}});}})[_0x8dc9('0x34')](respondWithStatusCode(_0x39b015,null))[_0x8dc9('0x29')](handleError(_0x39b015,null));};exports[_0x8dc9('0xdb')]=function(_0x5c0461,_0x56e1cf,_0x3bfdea){var _0x4165db={};var _0x58440e={};var _0x4f2aa0;var _0x213d2b;return db[_0x8dc9('0x50')]['findOne']({'where':{'id':_0x5c0461[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x56e1cf,null))['then'](function(_0x419f37){if(_0x419f37){_0x4f2aa0=_0x419f37;_0x58440e[_0x8dc9('0x41')]=_['keys'](db['User'][_0x8dc9('0x56')]);_0x58440e[_0x8dc9('0x42')]=_['keys'](_0x5c0461['query']);_0x58440e[_0x8dc9('0x43')]=_[_0x8dc9('0x44')](_0x58440e[_0x8dc9('0x41')],_0x58440e[_0x8dc9('0x42')]);_0x4165db[_0x8dc9('0x46')]=_[_0x8dc9('0x44')](_0x58440e[_0x8dc9('0x41')],qs[_0x8dc9('0x45')](_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x45')]));_0x4165db['attributes']=_0x4165db[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x4165db[_0x8dc9('0x46')]:_0x58440e['model'];_0x4165db[_0x8dc9('0x67')]=qs[_0x8dc9('0x49')](_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x49')]);_0x4165db[_0x8dc9('0x4a')]=qs[_0x8dc9('0x43')](_['pick'](_0x5c0461['query'],_0x58440e[_0x8dc9('0x43')]));if(_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x4d')]){_0x4165db[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x4165db[_0x8dc9('0x4a')],{'$or':_['map'](_0x4165db[_0x8dc9('0x46')],function(_0x10f98f){var _0x5bbe9f={};_0x5bbe9f[_0x10f98f]={'$like':'%'+_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x4d')]+'%'};return _0x5bbe9f;})});}_0x4165db=_['merge']({},_0x4165db,_0x5c0461[_0x8dc9('0x4f')]);return _0x4f2aa0[_0x8dc9('0xdb')](_0x4165db);}})[_0x8dc9('0x34')](function(_0x1547c5){if(_0x1547c5){_0x213d2b=_0x1547c5[_0x8dc9('0x47')];if(!_0x5c0461[_0x8dc9('0x42')]['hasOwnProperty']('nolimit')){_0x4165db[_0x8dc9('0x2f')]=qs[_0x8dc9('0x2f')](_0x5c0461['query'][_0x8dc9('0x2f')]);_0x4165db['offset']=qs[_0x8dc9('0x2e')](_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}return _0x4f2aa0[_0x8dc9('0xdb')](_0x4165db);}})[_0x8dc9('0x34')](function(_0x544f6d){if(_0x544f6d){return _0x544f6d?{'count':_0x213d2b,'rows':_0x544f6d}:null;}})[_0x8dc9('0x34')](respondWithResult(_0x56e1cf,null))[_0x8dc9('0x29')](handleError(_0x56e1cf,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 688205e..5c810b9 100644 --- a/server/api/smsAccount/smsAccount.events.js +++ b/server/api/smsAccount/smsAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7395=['setMaxListeners','save','emit','hook','events','SmsAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7395,0x1f0));var _0x5739=function(_0x2783eb,_0xe4b247){_0x2783eb=_0x2783eb-0x0;var _0x562216=_0x7395[_0x2783eb];return _0x562216;};'use strict';var EventEmitter=require(_0x5739('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x5739('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5739('0x2')](0x0);var events={'afterCreate':_0x5739('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2dae83){return function(_0x50efa3,_0xee88e,_0xc1733d){SmsAccountEvents[_0x5739('0x4')](_0x2dae83+':'+_0x50efa3['id'],_0x50efa3);SmsAccountEvents[_0x5739('0x4')](_0x2dae83,_0x50efa3);_0xc1733d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x5739('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xcccf=['hook','exports','../../mysqldb','SmsAccount','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x15434a,_0x10a30){var _0x1a310e=function(_0x426743){while(--_0x426743){_0x15434a['push'](_0x15434a['shift']());}};_0x1a310e(++_0x10a30);}(_0xcccf,0xb2));var _0xfccc=function(_0x216d8f,_0x2fe842){_0x216d8f=_0x216d8f-0x0;var _0x1013c0=_0xcccf[_0x216d8f];return _0x1013c0;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xfccc('0x0'))['db'][_0xfccc('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfccc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfccc('0x3')};function emitEvent(_0x2931ce){return function(_0x7e8665,_0x1ca353,_0x457aac){SmsAccountEvents[_0xfccc('0x4')](_0x2931ce+':'+_0x7e8665['id'],_0x7e8665);SmsAccountEvents[_0xfccc('0x4')](_0x2931ce,_0x7e8665);_0x457aac(null);};}for(var e in events){if(events[_0xfccc('0x5')](e)){var event=events[e];SmsAccount[_0xfccc('0x6')](e,emitEvent(event));}}module[_0xfccc('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 0b95ef3..3c70c42 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e45=['rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3eda0c,_0x1fc5c6){var _0x2ce4de=function(_0x23147d){while(--_0x23147d){_0x3eda0c['push'](_0x3eda0c['shift']());}};_0x2ce4de(++_0x1fc5c6);}(_0x1e45,0x181));var _0x51e4=function(_0x46ec40,_0x1c07d3){_0x46ec40=_0x46ec40-0x0;var _0x16e1e8=_0x1e45[_0x46ec40];return _0x16e1e8;};'use strict';var _=require(_0x51e4('0x0'));var util=require(_0x51e4('0x1'));var logger=require(_0x51e4('0x2'))(_0x51e4('0x3'));var moment=require('moment');var BPromise=require(_0x51e4('0x4'));var rp=require(_0x51e4('0x5'));var fs=require('fs');var path=require(_0x51e4('0x6'));var rimraf=require(_0x51e4('0x7'));var config=require(_0x51e4('0x8'));var attributes=require(_0x51e4('0x9'));module[_0x51e4('0xa')]=function(_0x2a1dde,_0x36d3b8){return _0x2a1dde[_0x51e4('0xb')](_0x51e4('0xc'),attributes,{'tableName':_0x51e4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33dd=['path','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','moment','bluebird','request-promise'];(function(_0x2cc136,_0x159126){var _0x4ad9fc=function(_0x15ed7f){while(--_0x15ed7f){_0x2cc136['push'](_0x2cc136['shift']());}};_0x4ad9fc(++_0x159126);}(_0x33dd,0x73));var _0xd33d=function(_0x5454fd,_0x25d702){_0x5454fd=_0x5454fd-0x0;var _0x3fa091=_0x33dd[_0x5454fd];return _0x3fa091;};'use strict';var _=require(_0xd33d('0x0'));var util=require(_0xd33d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd33d('0x2'));var BPromise=require(_0xd33d('0x3'));var rp=require(_0xd33d('0x4'));var fs=require('fs');var path=require(_0xd33d('0x5'));var rimraf=require('rimraf');var config=require(_0xd33d('0x6'));var attributes=require(_0xd33d('0x7'));module[_0xd33d('0x8')]=function(_0xfb1fe3,_0x660123){return _0xfb1fe3[_0xd33d('0x9')](_0xd33d('0xa'),attributes,{'tableName':_0xd33d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index c5a3bff..0cf8a9e 100644 --- a/server/api/smsAccount/smsAccount.rpc.js +++ b/server/api/smsAccount/smsAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6359=['debug','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsAccount','options','include','map','model','then','ShowSmsAccount'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x6359,0xa9));var _0x9635=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6359[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x9635('0x0'));var moment=require(_0x9635('0x1'));var BPromise=require('bluebird');var rs=require(_0x9635('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9635('0x3'))(_0x9635('0x4'));var config=require(_0x9635('0x5'));var jayson=require(_0x9635('0x6'));var client=jayson['client'][_0x9635('0x7')]({'port':0x232a});config[_0x9635('0x8')]=_['defaults'](config[_0x9635('0x8')],{'host':_0x9635('0x9'),'port':0x18eb});var socket=require(_0x9635('0xa'))(new Redis(config[_0x9635('0x8')]));require(_0x9635('0xb'))[_0x9635('0xc')](socket);function respondWithRpcPromise(_0x271d4b,_0x329c4c,_0x266356){return new BPromise(function(_0x1b4158,_0x44716a){return client['request'](_0x271d4b,_0x266356)['then'](function(_0x16aadf){logger[_0x9635('0xd')](_0x9635('0xe'),_0x329c4c,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x329c4c,_0x9635('0xf'),JSON[_0x9635('0x10')](_0x16aadf));if(_0x16aadf[_0x9635('0x11')]){if(_0x16aadf[_0x9635('0x11')][_0x9635('0x12')]===0x1f4){logger[_0x9635('0x11')]('SmsAccount,\x20%s,\x20%s',_0x329c4c,_0x16aadf[_0x9635('0x11')]['message']);return _0x44716a(_0x16aadf[_0x9635('0x11')][_0x9635('0x13')]);}logger[_0x9635('0x11')](_0x9635('0xe'),_0x329c4c,_0x16aadf[_0x9635('0x11')][_0x9635('0x13')]);return _0x1b4158(_0x16aadf[_0x9635('0x11')][_0x9635('0x13')]);}else{logger[_0x9635('0xd')](_0x9635('0xe'),_0x329c4c,_0x9635('0xf'));_0x1b4158(_0x16aadf['result'][_0x9635('0x13')]);}})['catch'](function(_0x195c04){logger['error']('SmsAccount,\x20%s,\x20%s',_0x329c4c,_0x195c04);_0x44716a(_0x195c04);});});}exports['ShowSmsAccount']=function(_0x5d7c1f){var _0x4c6c70=this;return new Promise(function(_0x14c3a2,_0x3a8a47){return db[_0x9635('0x14')]['find']({'raw':_0x5d7c1f[_0x9635('0x15')]?_0x5d7c1f[_0x9635('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5d7c1f['options']?_0x5d7c1f[_0x9635('0x15')]['where']||null:null,'attributes':_0x5d7c1f[_0x9635('0x15')]?_0x5d7c1f[_0x9635('0x15')]['attributes']||null:null,'include':_0x5d7c1f[_0x9635('0x15')]?_0x5d7c1f[_0x9635('0x15')][_0x9635('0x16')]?_[_0x9635('0x17')](_0x5d7c1f[_0x9635('0x15')][_0x9635('0x16')],function(_0x5f2eb1){return{'model':db[_0x5f2eb1[_0x9635('0x18')]],'as':_0x5f2eb1['as'],'attributes':_0x5f2eb1['attributes'],'include':_0x5f2eb1[_0x9635('0x16')]?_['map'](_0x5f2eb1['include'],function(_0x2105a1){return{'model':db[_0x2105a1['model']],'as':_0x2105a1['as'],'attributes':_0x2105a1['attributes'],'include':_0x2105a1['include']?_[_0x9635('0x17')](_0x2105a1[_0x9635('0x16')],function(_0x58957e){return{'model':db[_0x58957e[_0x9635('0x18')]],'as':_0x58957e['as'],'attributes':_0x58957e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9635('0x19')](function(_0x158ff4){logger[_0x9635('0xd')](_0x9635('0x1a'),_0x5d7c1f);logger[_0x9635('0x1b')](_0x9635('0x1a'),_0x5d7c1f,JSON[_0x9635('0x10')](_0x158ff4));_0x14c3a2(_0x158ff4);})['catch'](function(_0x6e701b){logger[_0x9635('0x11')](_0x9635('0x1a'),_0x6e701b['message'],_0x5d7c1f);_0x3a8a47(_0x4c6c70['error'](0x1f4,_0x6e701b[_0x9635('0x13')]));});});}; \ No newline at end of file +var _0x280d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','then','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','model','map','lodash','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x280d,0x1b8));var _0xd280=function(_0x2180af,_0x5ed02d){_0x2180af=_0x2180af-0x0;var _0xe9e097=_0x280d[_0x2180af];return _0xe9e097;};'use strict';var _=require(_0xd280('0x0'));var util=require(_0xd280('0x1'));var moment=require('moment');var BPromise=require(_0xd280('0x2'));var rs=require(_0xd280('0x3'));var fs=require('fs');var Redis=require(_0xd280('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd280('0x5'));var config=require(_0xd280('0x6'));var jayson=require(_0xd280('0x7'));var client=jayson[_0xd280('0x8')][_0xd280('0x9')]({'port':0x232a});config[_0xd280('0xa')]=_[_0xd280('0xb')](config['redis'],{'host':_0xd280('0xc'),'port':0x18eb});var socket=require(_0xd280('0xd'))(new Redis(config['redis']));require(_0xd280('0xe'))['register'](socket);function respondWithRpcPromise(_0xaad512,_0x231afa,_0x30dc42){return new BPromise(function(_0x52a76e,_0x55208d){return client['request'](_0xaad512,_0x30dc42)[_0xd280('0xf')](function(_0x1fabe7){logger['info']('SmsAccount,\x20%s,\x20%s',_0x231afa,_0xd280('0x10'));logger['debug'](_0xd280('0x11'),_0x231afa,_0xd280('0x10'),JSON['stringify'](_0x1fabe7));if(_0x1fabe7[_0xd280('0x12')]){if(_0x1fabe7[_0xd280('0x12')][_0xd280('0x13')]===0x1f4){logger[_0xd280('0x12')]('SmsAccount,\x20%s,\x20%s',_0x231afa,_0x1fabe7[_0xd280('0x12')][_0xd280('0x14')]);return _0x55208d(_0x1fabe7[_0xd280('0x12')][_0xd280('0x14')]);}logger[_0xd280('0x12')]('SmsAccount,\x20%s,\x20%s',_0x231afa,_0x1fabe7[_0xd280('0x12')][_0xd280('0x14')]);return _0x52a76e(_0x1fabe7[_0xd280('0x12')]['message']);}else{logger[_0xd280('0x15')](_0xd280('0x16'),_0x231afa,'request\x20sent');_0x52a76e(_0x1fabe7[_0xd280('0x17')][_0xd280('0x14')]);}})[_0xd280('0x18')](function(_0x51cf03){logger[_0xd280('0x12')](_0xd280('0x16'),_0x231afa,_0x51cf03);_0x55208d(_0x51cf03);});});}exports[_0xd280('0x19')]=function(_0x4b3f6d){var _0x1027ce=this;return new Promise(function(_0x583d5d,_0x3dd198){return db[_0xd280('0x1a')][_0xd280('0x1b')]({'raw':_0x4b3f6d[_0xd280('0x1c')]?_0x4b3f6d[_0xd280('0x1c')][_0xd280('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b3f6d[_0xd280('0x1c')]?_0x4b3f6d['options']['where']||null:null,'attributes':_0x4b3f6d['options']?_0x4b3f6d['options'][_0xd280('0x1e')]||null:null,'include':_0x4b3f6d[_0xd280('0x1c')]?_0x4b3f6d[_0xd280('0x1c')]['include']?_['map'](_0x4b3f6d[_0xd280('0x1c')][_0xd280('0x1f')],function(_0x5a4630){return{'model':db[_0x5a4630[_0xd280('0x20')]],'as':_0x5a4630['as'],'attributes':_0x5a4630[_0xd280('0x1e')],'include':_0x5a4630[_0xd280('0x1f')]?_[_0xd280('0x21')](_0x5a4630[_0xd280('0x1f')],function(_0x2d9b11){return{'model':db[_0x2d9b11[_0xd280('0x20')]],'as':_0x2d9b11['as'],'attributes':_0x2d9b11[_0xd280('0x1e')],'include':_0x2d9b11['include']?_[_0xd280('0x21')](_0x2d9b11['include'],function(_0x48a091){return{'model':db[_0x48a091[_0xd280('0x20')]],'as':_0x48a091['as'],'attributes':_0x48a091[_0xd280('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd9674a){logger[_0xd280('0x15')](_0xd280('0x19'),_0x4b3f6d);logger['debug'](_0xd280('0x19'),_0x4b3f6d,JSON['stringify'](_0xd9674a));_0x583d5d(_0xd9674a);})['catch'](function(_0x47545e){logger['error'](_0xd280('0x19'),_0x47545e['message'],_0x4b3f6d);_0x3dd198(_0x1027ce[_0xd280('0x12')](0x1f4,_0x47545e[_0xd280('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3585f7f..eab5e70 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75ac=['./smsAccount.events','remove','update','emit','length','smsAccount:'];(function(_0x4af72f,_0xd67b2e){var _0x5a25e4=function(_0x3f7724){while(--_0x3f7724){_0x4af72f['push'](_0x4af72f['shift']());}};_0x5a25e4(++_0xd67b2e);}(_0x75ac,0x1b6));var _0xc75a=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x75ac[_0x48d6a3];return _0x38bfa0;};'use strict';var SmsAccountEvents=require(_0xc75a('0x0'));var events=['save',_0xc75a('0x1'),_0xc75a('0x2')];function createListener(_0x42bf23,_0x3c585b){return function(_0x5bf2ff){_0x3c585b[_0xc75a('0x3')](_0x42bf23,_0x5bf2ff);};}function removeListener(_0x21b166,_0x4be67d){return function(){SmsAccountEvents['removeListener'](_0x21b166,_0x4be67d);};}exports['register']=function(_0x350c5d){for(var _0x2e9464=0x0,_0x5ad1c2=events[_0xc75a('0x4')];_0x2e9464<_0x5ad1c2;_0x2e9464++){var _0x2542b3=events[_0x2e9464];var _0x5d93bb=createListener(_0xc75a('0x5')+_0x2542b3,_0x350c5d);SmsAccountEvents['on'](_0x2542b3,_0x5d93bb);}}; \ No newline at end of file +var _0xe455=['removeListener','register','smsAccount:','save','remove','update','emit'];(function(_0x25f404,_0x485a38){var _0x2c0e38=function(_0x4dcbf2){while(--_0x4dcbf2){_0x25f404['push'](_0x25f404['shift']());}};_0x2c0e38(++_0x485a38);}(_0xe455,0x1ca));var _0x5e45=function(_0x6cc9d2,_0x203201){_0x6cc9d2=_0x6cc9d2-0x0;var _0x2daba6=_0xe455[_0x6cc9d2];return _0x2daba6;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x5e45('0x0'),_0x5e45('0x1'),_0x5e45('0x2')];function createListener(_0x48c432,_0x523dc1){return function(_0x441b49){_0x523dc1[_0x5e45('0x3')](_0x48c432,_0x441b49);};}function removeListener(_0x4b7711,_0x32082d){return function(){SmsAccountEvents[_0x5e45('0x4')](_0x4b7711,_0x32082d);};}exports[_0x5e45('0x5')]=function(_0x5c692f){for(var _0x1d7e39=0x0,_0x571584=events['length'];_0x1d7e39<_0x571584;_0x1d7e39++){var _0x5a581d=events[_0x1d7e39];var _0x592e35=createListener(_0x5e45('0x6')+_0x5a581d,_0x5c692f);SmsAccountEvents['on'](_0x5a581d,_0x592e35);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index c43c6af..e7b379c 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c22=['destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','isAuthenticated','/:id','show','create','update','delete'];(function(_0x261289,_0x5e1c13){var _0x4a6764=function(_0x15102b){while(--_0x15102b){_0x261289['push'](_0x261289['shift']());}};_0x4a6764(++_0x5e1c13);}(_0x9c22,0x136));var _0x29c2=function(_0x1a4b42,_0x198645){_0x1a4b42=_0x1a4b42-0x0;var _0x4e78a9=_0x9c22[_0x1a4b42];return _0x4e78a9;};'use strict';var multer=require(_0x29c2('0x0'));var util=require('util');var path=require(_0x29c2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x29c2('0x2'));var interaction=require(_0x29c2('0x3'));var config=require(_0x29c2('0x4'));var controller=require(_0x29c2('0x5'));router['get']('/',auth[_0x29c2('0x6')](),controller['index']);router['get'](_0x29c2('0x7'),auth[_0x29c2('0x6')](),controller[_0x29c2('0x8')]);router['post']('/',auth[_0x29c2('0x6')](),controller[_0x29c2('0x9')]);router['put'](_0x29c2('0x7'),auth[_0x29c2('0x6')](),controller[_0x29c2('0xa')]);router[_0x29c2('0xb')](_0x29c2('0x7'),auth[_0x29c2('0x6')](),controller[_0x29c2('0xc')]);module[_0x29c2('0xd')]=router; \ No newline at end of file +var _0x01a5=['post','put','/:id','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show'];(function(_0x160a68,_0x837a75){var _0x43334f=function(_0xdbdefc){while(--_0xdbdefc){_0x160a68['push'](_0x160a68['shift']());}};_0x43334f(++_0x837a75);}(_0x01a5,0x193));var _0x501a=function(_0x10676c,_0x2bb532){_0x10676c=_0x10676c-0x0;var _0x376ae4=_0x01a5[_0x10676c];return _0x376ae4;};'use strict';var multer=require('multer');var util=require(_0x501a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x501a('0x1'));var router=express[_0x501a('0x2')]();var auth=require(_0x501a('0x3'));var interaction=require(_0x501a('0x4'));var config=require(_0x501a('0x5'));var controller=require(_0x501a('0x6'));router[_0x501a('0x7')]('/',auth[_0x501a('0x8')](),controller[_0x501a('0x9')]);router[_0x501a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x501a('0xa')]);router[_0x501a('0xb')]('/',auth[_0x501a('0x8')](),controller['create']);router[_0x501a('0xc')](_0x501a('0xd'),auth[_0x501a('0x8')](),controller[_0x501a('0xe')]);router[_0x501a('0xf')](_0x501a('0xd'),auth['isAuthenticated'](),controller[_0x501a('0x10')]);module[_0x501a('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9c2a6b6..ec5a7d6 100644 --- a/server/api/smsApplication/smsApplication.attributes.js +++ b/server/api/smsApplication/smsApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0553=['STRING','*,*,*,*','exports','INTEGER','noop','TEXT'];(function(_0x268f8c,_0x1e34c8){var _0x326219=function(_0x57196e){while(--_0x57196e){_0x268f8c['push'](_0x268f8c['shift']());}};_0x326219(++_0x1e34c8);}(_0x0553,0xe6));var _0x3055=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x0553[_0x547456];return _0xc1fd7b;};'use strict';var Sequelize=require('sequelize');module[_0x3055('0x0')]={'priority':{'type':Sequelize[_0x3055('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3055('0x2')},'appdata':{'type':Sequelize[_0x3055('0x3')]()},'description':{'type':Sequelize[_0x3055('0x4')]},'interval':{'type':Sequelize[_0x3055('0x4')],'defaultValue':_0x3055('0x5')}}; \ No newline at end of file +var _0x3270=['TEXT','STRING','exports','INTEGER'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x3270,0x10e));var _0x0327=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x3270[_0x527824];return _0xc8b8ed;};'use strict';var Sequelize=require('sequelize');module[_0x0327('0x0')]={'priority':{'type':Sequelize[_0x0327('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0327('0x2')]()},'description':{'type':Sequelize[_0x0327('0x3')]},'interval':{'type':Sequelize[_0x0327('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index db7aa55..af9aa6d 100644 --- a/server/api/smsApplication/smsApplication.controller.js +++ b/server/api/smsApplication/smsApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8a1=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','count','offset','status','Content-Range','apply','reject','destroy','then','end','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x556b6a,_0x1429c6){var _0x401712=function(_0x58514f){while(--_0x58514f){_0x556b6a['push'](_0x556b6a['shift']());}};_0x401712(++_0x1429c6);}(_0xe8a1,0x1d8));var _0x1e8a=function(_0x201263,_0xf13cb4){_0x201263=_0x201263-0x0;var _0x35ac53=_0xe8a1[_0x201263];return _0x35ac53;};'use strict';var pdf=require(_0x1e8a('0x0'));var emlformat=require(_0x1e8a('0x1'));var rimraf=require(_0x1e8a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e8a('0x3'));var rp=require(_0x1e8a('0x4'));var moment=require(_0x1e8a('0x5'));var BPromise=require(_0x1e8a('0x6'));var Mustache=require(_0x1e8a('0x7'));var util=require(_0x1e8a('0x8'));var path=require(_0x1e8a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e8a('0xa'));var fs=require('fs');var _=require(_0x1e8a('0xb'));var squel=require(_0x1e8a('0xc'));var crypto=require(_0x1e8a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e8a('0xe'));var querystring=require('querystring');var Papa=require(_0x1e8a('0xf'));var Redis=require(_0x1e8a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e8a('0x11'));var hardwareService=require(_0x1e8a('0x12'));var logger=require(_0x1e8a('0x13'))('api');var utils=require(_0x1e8a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1e8a('0x15'));var db=require(_0x1e8a('0x16'))['db'];function respondWithStatusCode(_0x30948e,_0x3c12f5){_0x3c12f5=_0x3c12f5||0xcc;return function(_0x486f09){if(_0x486f09){return _0x30948e['sendStatus'](_0x3c12f5);}return _0x30948e['status'](_0x3c12f5)['end']();};}function respondWithResult(_0x3149e3,_0x40c1af){_0x40c1af=_0x40c1af||0xc8;return function(_0x2187e7){if(_0x2187e7){return _0x3149e3['status'](_0x40c1af)['json'](_0x2187e7);}};}function respondWithFilteredResult(_0x54c1ae,_0x34faca){return function(_0x5dc0d3){if(_0x5dc0d3){var _0x1a466a=_0x5dc0d3[_0x1e8a('0x17')],_0x2546f7=_0x34faca['offset'],_0x14654e=_0x34faca[_0x1e8a('0x18')]+_0x34faca['limit'],_0x44943f;if(_0x14654e>=_0x1a466a){_0x14654e=_0x1a466a;_0x44943f=0xc8;}else{_0x44943f=0xce;}_0x54c1ae[_0x1e8a('0x19')](_0x44943f);return _0x54c1ae['set'](_0x1e8a('0x1a'),_0x2546f7+'-'+_0x14654e+'/'+_0x1a466a)['json'](_0x5dc0d3);}return null;};}function patchUpdates(_0x5056d7){return function(_0x5c6d50){try{jsonpatch[_0x1e8a('0x1b')](_0x5c6d50,_0x5056d7,!![]);}catch(_0x2a9e0e){return BPromise[_0x1e8a('0x1c')](_0x2a9e0e);}return _0x5c6d50['save']();};}function saveUpdates(_0xc9c032,_0x5db0c8){return function(_0x546f0e){if(_0x546f0e){return _0x546f0e['update'](_0xc9c032)['then'](function(_0x3fdb89){return _0x3fdb89;});}return null;};}function removeEntity(_0x16e4fc,_0x511359){return function(_0xb957c7){if(_0xb957c7){return _0xb957c7[_0x1e8a('0x1d')]()[_0x1e8a('0x1e')](function(){_0x16e4fc[_0x1e8a('0x19')](0xcc)[_0x1e8a('0x1f')]();});}};}function handleEntityNotFound(_0x45a515,_0x4f9815){return function(_0x1de545){if(!_0x1de545){_0x45a515['sendStatus'](0x194);}return _0x1de545;};}function handleError(_0xcc7f93,_0x4cf1ee){_0x4cf1ee=_0x4cf1ee||0x1f4;return function(_0x57e70c){logger['error'](_0x57e70c[_0x1e8a('0x20')]);if(_0x57e70c[_0x1e8a('0x21')]){delete _0x57e70c[_0x1e8a('0x21')];}_0xcc7f93[_0x1e8a('0x19')](_0x4cf1ee)[_0x1e8a('0x22')](_0x57e70c);};}exports[_0x1e8a('0x23')]=function(_0x2b0197,_0xd56776){var _0x1fa07b={},_0x925562={},_0x3963ce={'count':0x0,'rows':[]};var _0x3ffae8=_['map'](db[_0x1e8a('0x24')][_0x1e8a('0x25')],function(_0x37c0c9){return{'name':_0x37c0c9[_0x1e8a('0x26')],'type':_0x37c0c9[_0x1e8a('0x27')][_0x1e8a('0x28')]};});_0x925562['model']=_[_0x1e8a('0x29')](_0x3ffae8,_0x1e8a('0x21'));_0x925562[_0x1e8a('0x2a')]=_[_0x1e8a('0x2b')](_0x2b0197[_0x1e8a('0x2a')]);_0x925562[_0x1e8a('0x2c')]=_[_0x1e8a('0x2d')](_0x925562[_0x1e8a('0x2e')],_0x925562[_0x1e8a('0x2a')]);_0x1fa07b[_0x1e8a('0x2f')]=_[_0x1e8a('0x2d')](_0x925562[_0x1e8a('0x2e')],qs['fields'](_0x2b0197[_0x1e8a('0x2a')][_0x1e8a('0x30')]));_0x1fa07b[_0x1e8a('0x2f')]=_0x1fa07b[_0x1e8a('0x2f')][_0x1e8a('0x31')]?_0x1fa07b[_0x1e8a('0x2f')]:_0x925562['model'];if(!_0x2b0197[_0x1e8a('0x2a')][_0x1e8a('0x32')](_0x1e8a('0x33'))){_0x1fa07b[_0x1e8a('0x34')]=qs['limit'](_0x2b0197[_0x1e8a('0x2a')][_0x1e8a('0x34')]);_0x1fa07b[_0x1e8a('0x18')]=qs[_0x1e8a('0x18')](_0x2b0197[_0x1e8a('0x2a')][_0x1e8a('0x18')]);}_0x1fa07b[_0x1e8a('0x35')]=qs['sort'](_0x2b0197[_0x1e8a('0x2a')]['sort']);_0x1fa07b['where']=qs['filters'](_['pick'](_0x2b0197[_0x1e8a('0x2a')],_0x925562['filters']),_0x3ffae8);if(_0x2b0197[_0x1e8a('0x2a')][_0x1e8a('0x36')]){_0x1fa07b[_0x1e8a('0x37')]=_['merge'](_0x1fa07b['where'],{'$or':_[_0x1e8a('0x29')](_0x3ffae8,function(_0x769e2d){if(_0x769e2d['type']!==_0x1e8a('0x38')){var _0x33f938={};_0x33f938[_0x769e2d['name']]={'$like':'%'+_0x2b0197[_0x1e8a('0x2a')][_0x1e8a('0x36')]+'%'};return _0x33f938;}})});}_0x1fa07b=_[_0x1e8a('0x39')]({},_0x1fa07b,_0x2b0197['options']);var _0x4b38c2={'where':_0x1fa07b[_0x1e8a('0x37')]};return db['SmsApplication'][_0x1e8a('0x17')](_0x4b38c2)[_0x1e8a('0x1e')](function(_0x149237){_0x3963ce[_0x1e8a('0x17')]=_0x149237;if(_0x2b0197[_0x1e8a('0x2a')][_0x1e8a('0x3a')]){_0x1fa07b[_0x1e8a('0x3b')]=[{'all':!![]}];}return db[_0x1e8a('0x24')][_0x1e8a('0x3c')](_0x1fa07b);})[_0x1e8a('0x1e')](function(_0x583602){_0x3963ce[_0x1e8a('0x3d')]=_0x583602;return _0x3963ce;})[_0x1e8a('0x1e')](respondWithFilteredResult(_0xd56776,_0x1fa07b))[_0x1e8a('0x3e')](handleError(_0xd56776,null));};exports[_0x1e8a('0x3f')]=function(_0x1339e0,_0x21a7e8){var _0x24176e={'raw':!![],'where':{'id':_0x1339e0[_0x1e8a('0x40')]['id']}},_0x77cdc2={};_0x77cdc2[_0x1e8a('0x2e')]=_[_0x1e8a('0x2b')](db[_0x1e8a('0x24')][_0x1e8a('0x25')]);_0x77cdc2[_0x1e8a('0x2a')]=_['keys'](_0x1339e0[_0x1e8a('0x2a')]);_0x77cdc2[_0x1e8a('0x2c')]=_[_0x1e8a('0x2d')](_0x77cdc2[_0x1e8a('0x2e')],_0x77cdc2[_0x1e8a('0x2a')]);_0x24176e[_0x1e8a('0x2f')]=_['intersection'](_0x77cdc2[_0x1e8a('0x2e')],qs[_0x1e8a('0x30')](_0x1339e0[_0x1e8a('0x2a')][_0x1e8a('0x30')]));_0x24176e[_0x1e8a('0x2f')]=_0x24176e[_0x1e8a('0x2f')][_0x1e8a('0x31')]?_0x24176e[_0x1e8a('0x2f')]:_0x77cdc2[_0x1e8a('0x2e')];if(_0x1339e0[_0x1e8a('0x2a')][_0x1e8a('0x3a')]){_0x24176e[_0x1e8a('0x3b')]=[{'all':!![]}];}_0x24176e=_[_0x1e8a('0x39')]({},_0x24176e,_0x1339e0[_0x1e8a('0x41')]);return db['SmsApplication'][_0x1e8a('0x42')](_0x24176e)[_0x1e8a('0x1e')](handleEntityNotFound(_0x21a7e8,null))['then'](respondWithResult(_0x21a7e8,null))[_0x1e8a('0x3e')](handleError(_0x21a7e8,null));};exports[_0x1e8a('0x43')]=function(_0x762d2c,_0x4d2521){return db[_0x1e8a('0x24')][_0x1e8a('0x43')](_0x762d2c[_0x1e8a('0x44')],{})[_0x1e8a('0x1e')](respondWithResult(_0x4d2521,0xc9))['catch'](handleError(_0x4d2521,null));};exports[_0x1e8a('0x45')]=function(_0x23e59b,_0x51b9b9){if(_0x23e59b['body']['id']){delete _0x23e59b[_0x1e8a('0x44')]['id'];}return db[_0x1e8a('0x24')][_0x1e8a('0x42')]({'where':{'id':_0x23e59b[_0x1e8a('0x40')]['id']}})[_0x1e8a('0x1e')](handleEntityNotFound(_0x51b9b9,null))[_0x1e8a('0x1e')](saveUpdates(_0x23e59b[_0x1e8a('0x44')],null))[_0x1e8a('0x1e')](respondWithResult(_0x51b9b9,null))[_0x1e8a('0x3e')](handleError(_0x51b9b9,null));};exports[_0x1e8a('0x1d')]=function(_0x163037,_0x270eb8){return db[_0x1e8a('0x24')][_0x1e8a('0x42')]({'where':{'id':_0x163037[_0x1e8a('0x40')]['id']}})[_0x1e8a('0x1e')](handleEntityNotFound(_0x270eb8,null))['then'](removeEntity(_0x270eb8,null))['catch'](handleError(_0x270eb8,null));}; \ No newline at end of file +var _0x6bae=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SmsApplication','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','filter','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','include','merge','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv'];(function(_0x4eefe6,_0x1202ce){var _0x22b387=function(_0xb34c64){while(--_0xb34c64){_0x4eefe6['push'](_0x4eefe6['shift']());}};_0x22b387(++_0x1202ce);}(_0x6bae,0x84));var _0xe6ba=function(_0x4159e3,_0x53a785){_0x4159e3=_0x4159e3-0x0;var _0x47db5e=_0x6bae[_0x4159e3];return _0x47db5e;};'use strict';var pdf=require(_0xe6ba('0x0'));var emlformat=require(_0xe6ba('0x1'));var rimraf=require(_0xe6ba('0x2'));var zipdir=require(_0xe6ba('0x3'));var jsonpatch=require(_0xe6ba('0x4'));var rp=require(_0xe6ba('0x5'));var moment=require(_0xe6ba('0x6'));var BPromise=require(_0xe6ba('0x7'));var Mustache=require(_0xe6ba('0x8'));var util=require(_0xe6ba('0x9'));var path=require(_0xe6ba('0xa'));var sox=require(_0xe6ba('0xb'));var csv=require('to-csv');var ejs=require(_0xe6ba('0xc'));var fs=require('fs');var _=require(_0xe6ba('0xd'));var squel=require(_0xe6ba('0xe'));var crypto=require(_0xe6ba('0xf'));var jsforce=require(_0xe6ba('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe6ba('0x11'));var querystring=require('querystring');var Papa=require(_0xe6ba('0x12'));var Redis=require(_0xe6ba('0x13'));var authService=require(_0xe6ba('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6ba('0x15'));var logger=require(_0xe6ba('0x16'))('api');var utils=require(_0xe6ba('0x17'));var config=require(_0xe6ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6ba('0x19'))['db'];function respondWithStatusCode(_0x7c832f,_0xae3c32){_0xae3c32=_0xae3c32||0xcc;return function(_0x9d34dc){if(_0x9d34dc){return _0x7c832f[_0xe6ba('0x1a')](_0xae3c32);}return _0x7c832f[_0xe6ba('0x1b')](_0xae3c32)[_0xe6ba('0x1c')]();};}function respondWithResult(_0x13a1f9,_0x5c5274){_0x5c5274=_0x5c5274||0xc8;return function(_0x923d3c){if(_0x923d3c){return _0x13a1f9[_0xe6ba('0x1b')](_0x5c5274)[_0xe6ba('0x1d')](_0x923d3c);}};}function respondWithFilteredResult(_0x50db7a,_0x2e889d){return function(_0xb22699){if(_0xb22699){var _0x4f1b39=_0xb22699[_0xe6ba('0x1e')],_0x1f7a69=_0x2e889d['offset'],_0x3c0f39=_0x2e889d[_0xe6ba('0x1f')]+_0x2e889d[_0xe6ba('0x20')],_0x1ef695;if(_0x3c0f39>=_0x4f1b39){_0x3c0f39=_0x4f1b39;_0x1ef695=0xc8;}else{_0x1ef695=0xce;}_0x50db7a[_0xe6ba('0x1b')](_0x1ef695);return _0x50db7a[_0xe6ba('0x21')](_0xe6ba('0x22'),_0x1f7a69+'-'+_0x3c0f39+'/'+_0x4f1b39)[_0xe6ba('0x1d')](_0xb22699);}return null;};}function patchUpdates(_0x3f3d65){return function(_0x488b88){try{jsonpatch[_0xe6ba('0x23')](_0x488b88,_0x3f3d65,!![]);}catch(_0x99e5e3){return BPromise[_0xe6ba('0x24')](_0x99e5e3);}return _0x488b88[_0xe6ba('0x25')]();};}function saveUpdates(_0x378a81,_0x5f428c){return function(_0x505e45){if(_0x505e45){return _0x505e45[_0xe6ba('0x26')](_0x378a81)[_0xe6ba('0x27')](function(_0x2b1c86){return _0x2b1c86;});}return null;};}function removeEntity(_0x19f591,_0x54fd53){return function(_0x43c79b){if(_0x43c79b){return _0x43c79b[_0xe6ba('0x28')]()[_0xe6ba('0x27')](function(){_0x19f591[_0xe6ba('0x1b')](0xcc)[_0xe6ba('0x1c')]();});}};}function handleEntityNotFound(_0x2acb66,_0x1717aa){return function(_0x150c8b){if(!_0x150c8b){_0x2acb66['sendStatus'](0x194);}return _0x150c8b;};}function handleError(_0x405296,_0x28e1c4){_0x28e1c4=_0x28e1c4||0x1f4;return function(_0x2c4e5c){logger[_0xe6ba('0x29')](_0x2c4e5c[_0xe6ba('0x2a')]);if(_0x2c4e5c['name']){delete _0x2c4e5c[_0xe6ba('0x2b')];}_0x405296['status'](_0x28e1c4)[_0xe6ba('0x2c')](_0x2c4e5c);};}exports['index']=function(_0x1711fb,_0x1e84bb){var _0x11c203={},_0x731ae7={},_0x37d3ed={'count':0x0,'rows':[]};var _0x3a48c4=_['map'](db[_0xe6ba('0x2d')]['rawAttributes'],function(_0x1670a1){return{'name':_0x1670a1[_0xe6ba('0x2e')],'type':_0x1670a1[_0xe6ba('0x2f')][_0xe6ba('0x30')]};});_0x731ae7[_0xe6ba('0x31')]=_[_0xe6ba('0x32')](_0x3a48c4,_0xe6ba('0x2b'));_0x731ae7[_0xe6ba('0x33')]=_[_0xe6ba('0x34')](_0x1711fb['query']);_0x731ae7[_0xe6ba('0x35')]=_[_0xe6ba('0x36')](_0x731ae7[_0xe6ba('0x31')],_0x731ae7[_0xe6ba('0x33')]);_0x11c203['attributes']=_[_0xe6ba('0x36')](_0x731ae7['model'],qs[_0xe6ba('0x37')](_0x1711fb[_0xe6ba('0x33')][_0xe6ba('0x37')]));_0x11c203[_0xe6ba('0x38')]=_0x11c203['attributes']['length']?_0x11c203[_0xe6ba('0x38')]:_0x731ae7[_0xe6ba('0x31')];if(!_0x1711fb['query'][_0xe6ba('0x39')](_0xe6ba('0x3a'))){_0x11c203[_0xe6ba('0x20')]=qs['limit'](_0x1711fb[_0xe6ba('0x33')][_0xe6ba('0x20')]);_0x11c203[_0xe6ba('0x1f')]=qs['offset'](_0x1711fb['query'][_0xe6ba('0x1f')]);}_0x11c203['order']=qs['sort'](_0x1711fb['query']['sort']);_0x11c203[_0xe6ba('0x3b')]=qs[_0xe6ba('0x35')](_['pick'](_0x1711fb['query'],_0x731ae7['filters']),_0x3a48c4);if(_0x1711fb[_0xe6ba('0x33')][_0xe6ba('0x3c')]){_0x11c203[_0xe6ba('0x3b')]=_['merge'](_0x11c203['where'],{'$or':_[_0xe6ba('0x32')](_0x3a48c4,function(_0xb1553b){if(_0xb1553b['type']!==_0xe6ba('0x3d')){var _0x10c471={};_0x10c471[_0xb1553b[_0xe6ba('0x2b')]]={'$like':'%'+_0x1711fb[_0xe6ba('0x33')][_0xe6ba('0x3c')]+'%'};return _0x10c471;}})});}_0x11c203=_['merge']({},_0x11c203,_0x1711fb[_0xe6ba('0x3e')]);var _0x36c5d4={'where':_0x11c203[_0xe6ba('0x3b')]};return db[_0xe6ba('0x2d')][_0xe6ba('0x1e')](_0x36c5d4)[_0xe6ba('0x27')](function(_0x461b49){_0x37d3ed[_0xe6ba('0x1e')]=_0x461b49;if(_0x1711fb['query']['includeAll']){_0x11c203['include']=[{'all':!![]}];}return db[_0xe6ba('0x2d')][_0xe6ba('0x3f')](_0x11c203);})[_0xe6ba('0x27')](function(_0x3c191b){_0x37d3ed[_0xe6ba('0x40')]=_0x3c191b;return _0x37d3ed;})['then'](respondWithFilteredResult(_0x1e84bb,_0x11c203))[_0xe6ba('0x41')](handleError(_0x1e84bb,null));};exports[_0xe6ba('0x42')]=function(_0x4508d3,_0xc71fe8){var _0x527982={'raw':!![],'where':{'id':_0x4508d3[_0xe6ba('0x43')]['id']}},_0x54c262={};_0x54c262[_0xe6ba('0x31')]=_['keys'](db[_0xe6ba('0x2d')][_0xe6ba('0x44')]);_0x54c262[_0xe6ba('0x33')]=_[_0xe6ba('0x34')](_0x4508d3[_0xe6ba('0x33')]);_0x54c262[_0xe6ba('0x35')]=_['intersection'](_0x54c262['model'],_0x54c262[_0xe6ba('0x33')]);_0x527982[_0xe6ba('0x38')]=_[_0xe6ba('0x36')](_0x54c262[_0xe6ba('0x31')],qs[_0xe6ba('0x37')](_0x4508d3[_0xe6ba('0x33')][_0xe6ba('0x37')]));_0x527982[_0xe6ba('0x38')]=_0x527982[_0xe6ba('0x38')][_0xe6ba('0x45')]?_0x527982[_0xe6ba('0x38')]:_0x54c262[_0xe6ba('0x31')];if(_0x4508d3[_0xe6ba('0x33')]['includeAll']){_0x527982[_0xe6ba('0x46')]=[{'all':!![]}];}_0x527982=_[_0xe6ba('0x47')]({},_0x527982,_0x4508d3[_0xe6ba('0x3e')]);return db[_0xe6ba('0x2d')]['find'](_0x527982)[_0xe6ba('0x27')](handleEntityNotFound(_0xc71fe8,null))[_0xe6ba('0x27')](respondWithResult(_0xc71fe8,null))[_0xe6ba('0x41')](handleError(_0xc71fe8,null));};exports[_0xe6ba('0x48')]=function(_0x5f4adb,_0x5ed4cd){return db[_0xe6ba('0x2d')]['create'](_0x5f4adb[_0xe6ba('0x49')],{})[_0xe6ba('0x27')](respondWithResult(_0x5ed4cd,0xc9))[_0xe6ba('0x41')](handleError(_0x5ed4cd,null));};exports[_0xe6ba('0x26')]=function(_0x3f3670,_0x18f820){if(_0x3f3670[_0xe6ba('0x49')]['id']){delete _0x3f3670[_0xe6ba('0x49')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3f3670[_0xe6ba('0x43')]['id']}})[_0xe6ba('0x27')](handleEntityNotFound(_0x18f820,null))[_0xe6ba('0x27')](saveUpdates(_0x3f3670[_0xe6ba('0x49')],null))[_0xe6ba('0x27')](respondWithResult(_0x18f820,null))['catch'](handleError(_0x18f820,null));};exports['destroy']=function(_0x5a168a,_0x249735){return db[_0xe6ba('0x2d')][_0xe6ba('0x4a')]({'where':{'id':_0x5a168a[_0xe6ba('0x43')]['id']}})[_0xe6ba('0x27')](handleEntityNotFound(_0x249735,null))['then'](removeEntity(_0x249735,null))[_0xe6ba('0x41')](handleError(_0x249735,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f61dd33..88e4800 100644 --- a/server/api/smsApplication/smsApplication.model.js +++ b/server/api/smsApplication/smsApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2477=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x92a1c0,_0x26e3b2){var _0x2f741f=function(_0x46791a){while(--_0x46791a){_0x92a1c0['push'](_0x92a1c0['shift']());}};_0x2f741f(++_0x26e3b2);}(_0x2477,0xa7));var _0x7247=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x2477[_0x54ccd7];return _0x4e667b;};'use strict';var _=require('lodash');var util=require(_0x7247('0x0'));var logger=require(_0x7247('0x1'))(_0x7247('0x2'));var moment=require('moment');var BPromise=require(_0x7247('0x3'));var rp=require(_0x7247('0x4'));var fs=require('fs');var path=require(_0x7247('0x5'));var rimraf=require(_0x7247('0x6'));var config=require(_0x7247('0x7'));var attributes=require(_0x7247('0x8'));module[_0x7247('0x9')]=function(_0x203eb3,_0x42f235){return _0x203eb3[_0x7247('0xa')](_0x7247('0xb'),attributes,{'tableName':_0x7247('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7247('0xd'),'collate':_0x7247('0xe')});}; \ No newline at end of file +var _0xc905=['path','rimraf','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','util','bluebird','request-promise'];(function(_0x5786df,_0x33b73c){var _0x424302=function(_0x226e4a){while(--_0x226e4a){_0x5786df['push'](_0x5786df['shift']());}};_0x424302(++_0x33b73c);}(_0xc905,0x97));var _0x5c90=function(_0x4d9b80,_0x3deb54){_0x4d9b80=_0x4d9b80-0x0;var _0x3e6b70=_0xc905[_0x4d9b80];return _0x3e6b70;};'use strict';var _=require('lodash');var util=require(_0x5c90('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5c90('0x1'));var rp=require(_0x5c90('0x2'));var fs=require('fs');var path=require(_0x5c90('0x3'));var rimraf=require(_0x5c90('0x4'));var config=require('../../config/environment');var attributes=require(_0x5c90('0x5'));module[_0x5c90('0x6')]=function(_0x51c4c3,_0x241713){return _0x51c4c3[_0x5c90('0x7')](_0x5c90('0x8'),attributes,{'tableName':_0x5c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5c90('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index e6527b5..9dd5081 100644 --- a/server/api/smsApplication/smsApplication.rpc.js +++ b/server/api/smsApplication/smsApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3595=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','lodash','util','moment'];(function(_0x5a037a,_0x44a3fc){var _0x28ff57=function(_0x13d49f){while(--_0x13d49f){_0x5a037a['push'](_0x5a037a['shift']());}};_0x28ff57(++_0x44a3fc);}(_0x3595,0x147));var _0x5359=function(_0x2af1af,_0x190307){_0x2af1af=_0x2af1af-0x0;var _0x324544=_0x3595[_0x2af1af];return _0x324544;};'use strict';var _=require(_0x5359('0x0'));var util=require(_0x5359('0x1'));var moment=require(_0x5359('0x2'));var BPromise=require('bluebird');var rs=require(_0x5359('0x3'));var fs=require('fs');var Redis=require(_0x5359('0x4'));var db=require(_0x5359('0x5'))['db'];var utils=require(_0x5359('0x6'));var logger=require(_0x5359('0x7'))(_0x5359('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5359('0x9')][_0x5359('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f48,_0x29a776,_0x39fcd8){return new BPromise(function(_0x51b2fb,_0x400db4){return client[_0x5359('0xb')](_0x1b6f48,_0x39fcd8)[_0x5359('0xc')](function(_0x15e2c6){logger['info']('SmsApplication,\x20%s,\x20%s',_0x29a776,'request\x20sent');logger['debug'](_0x5359('0xd'),_0x29a776,_0x5359('0xe'),JSON[_0x5359('0xf')](_0x15e2c6));if(_0x15e2c6[_0x5359('0x10')]){if(_0x15e2c6[_0x5359('0x10')][_0x5359('0x11')]===0x1f4){logger[_0x5359('0x10')](_0x5359('0x12'),_0x29a776,_0x15e2c6[_0x5359('0x10')][_0x5359('0x13')]);return _0x400db4(_0x15e2c6[_0x5359('0x10')][_0x5359('0x13')]);}logger[_0x5359('0x10')](_0x5359('0x12'),_0x29a776,_0x15e2c6['error']['message']);return _0x51b2fb(_0x15e2c6[_0x5359('0x10')][_0x5359('0x13')]);}else{logger[_0x5359('0x14')](_0x5359('0x12'),_0x29a776,_0x5359('0xe'));_0x51b2fb(_0x15e2c6[_0x5359('0x15')]['message']);}})['catch'](function(_0x267d4c){logger[_0x5359('0x10')]('SmsApplication,\x20%s,\x20%s',_0x29a776,_0x267d4c);_0x400db4(_0x267d4c);});});} \ No newline at end of file +var _0xd206=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsApplication,\x20%s,\x20%s'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0xd206,0x107));var _0x6d20=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xd206[_0x616290];return _0x453879;};'use strict';var _=require(_0x6d20('0x0'));var util=require(_0x6d20('0x1'));var moment=require('moment');var BPromise=require(_0x6d20('0x2'));var rs=require(_0x6d20('0x3'));var fs=require('fs');var Redis=require(_0x6d20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d20('0x5'));var logger=require(_0x6d20('0x6'))(_0x6d20('0x7'));var config=require(_0x6d20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc981,_0x125a39,_0x3080fb){return new BPromise(function(_0x5b4154,_0x2b338c){return client['request'](_0x4dc981,_0x3080fb)[_0x6d20('0xa')](function(_0x4222dc){logger['info']('SmsApplication,\x20%s,\x20%s',_0x125a39,'request\x20sent');logger[_0x6d20('0xb')](_0x6d20('0xc'),_0x125a39,'request\x20sent',JSON[_0x6d20('0xd')](_0x4222dc));if(_0x4222dc['error']){if(_0x4222dc[_0x6d20('0xe')]['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x125a39,_0x4222dc['error'][_0x6d20('0xf')]);return _0x2b338c(_0x4222dc[_0x6d20('0xe')][_0x6d20('0xf')]);}logger[_0x6d20('0xe')](_0x6d20('0x10'),_0x125a39,_0x4222dc[_0x6d20('0xe')]['message']);return _0x5b4154(_0x4222dc[_0x6d20('0xe')]['message']);}else{logger[_0x6d20('0x11')](_0x6d20('0x10'),_0x125a39,'request\x20sent');_0x5b4154(_0x4222dc[_0x6d20('0x12')][_0x6d20('0xf')]);}})[_0x6d20('0x13')](function(_0x133cd0){logger['error']('SmsApplication,\x20%s,\x20%s',_0x125a39,_0x133cd0);_0x2b338c(_0x133cd0);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a9e2856..51fef2c 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7a6=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','sms','smsinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0xc7a6,0x15b));var _0x6c7a=function(_0x1314d6,_0x214f2f){_0x1314d6=_0x1314d6-0x0;var _0x28b527=_0xc7a6[_0x1314d6];return _0x28b527;};'use strict';var multer=require(_0x6c7a('0x0'));var util=require('util');var path=require(_0x6c7a('0x1'));var timeout=require(_0x6c7a('0x2'));var express=require(_0x6c7a('0x3'));var router=express['Router']();var auth=require(_0x6c7a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6c7a('0x5'));var controller=require(_0x6c7a('0x6'));router[_0x6c7a('0x7')]('/',auth[_0x6c7a('0x8')](),controller[_0x6c7a('0x9')]);router[_0x6c7a('0x7')]('/describe',auth[_0x6c7a('0x8')](),controller[_0x6c7a('0xa')]);router['get'](_0x6c7a('0xb'),auth[_0x6c7a('0x8')](),controller[_0x6c7a('0xc')]);router[_0x6c7a('0x7')](_0x6c7a('0xd'),auth[_0x6c7a('0x8')](),controller[_0x6c7a('0xe')]);router[_0x6c7a('0x7')](_0x6c7a('0xf'),auth[_0x6c7a('0x8')](),controller[_0x6c7a('0x10')]);router[_0x6c7a('0x11')]('/',auth[_0x6c7a('0x8')](),controller[_0x6c7a('0x12')]);router[_0x6c7a('0x11')](_0x6c7a('0xd'),auth[_0x6c7a('0x8')](),controller['addMessage']);router[_0x6c7a('0x11')](_0x6c7a('0x13'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x6c7a('0x14')),controller[_0x6c7a('0x15')]);router[_0x6c7a('0x16')](_0x6c7a('0xb'),auth[_0x6c7a('0x8')](),interaction[_0x6c7a('0x17')]('sms',_0x6c7a('0x18')),controller[_0x6c7a('0x19')]);router[_0x6c7a('0x1a')]('/:id',auth[_0x6c7a('0x8')](),interaction[_0x6c7a('0x17')](_0x6c7a('0x1b'),_0x6c7a('0x1c')),controller[_0x6c7a('0x1d')]);router[_0x6c7a('0x1a')]('/:id/tags',auth[_0x6c7a('0x8')](),controller[_0x6c7a('0x1e')]);module[_0x6c7a('0x1f')]=router; \ No newline at end of file +var _0x2a75=['/describe','describe','/:id','isAuthenticated','show','getMessages','post','create','/:id/messages','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get'];(function(_0x2b46ac,_0x3e056d){var _0xe79fea=function(_0x249c3b){while(--_0x249c3b){_0x2b46ac['push'](_0x2b46ac['shift']());}};_0xe79fea(++_0x3e056d);}(_0x2a75,0x175));var _0x52a7=function(_0x15b2ba,_0x32637b){_0x15b2ba=_0x15b2ba-0x0;var _0x4c6689=_0x2a75[_0x15b2ba];return _0x4c6689;};'use strict';var multer=require(_0x52a7('0x0'));var util=require('util');var path=require(_0x52a7('0x1'));var timeout=require(_0x52a7('0x2'));var express=require(_0x52a7('0x3'));var router=express[_0x52a7('0x4')]();var auth=require(_0x52a7('0x5'));var interaction=require(_0x52a7('0x6'));var config=require(_0x52a7('0x7'));var controller=require(_0x52a7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x52a7('0x9')]);router[_0x52a7('0xa')](_0x52a7('0xb'),auth['isAuthenticated'](),controller[_0x52a7('0xc')]);router[_0x52a7('0xa')](_0x52a7('0xd'),auth[_0x52a7('0xe')](),controller[_0x52a7('0xf')]);router[_0x52a7('0xa')]('/:id/messages',auth[_0x52a7('0xe')](),controller[_0x52a7('0x10')]);router[_0x52a7('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x52a7('0x11')]('/',auth['isAuthenticated'](),controller[_0x52a7('0x12')]);router[_0x52a7('0x11')](_0x52a7('0x13'),auth[_0x52a7('0xe')](),controller['addMessage']);router[_0x52a7('0x11')](_0x52a7('0x14'),auth[_0x52a7('0xe')](),interaction[_0x52a7('0x15')](_0x52a7('0x16'),_0x52a7('0x17')),controller['addTags']);router[_0x52a7('0x18')](_0x52a7('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x52a7('0x16'),_0x52a7('0x19')),controller[_0x52a7('0x1a')]);router[_0x52a7('0x1b')](_0x52a7('0xd'),auth['isAuthenticated'](),interaction[_0x52a7('0x15')](_0x52a7('0x16'),_0x52a7('0x1c')),controller[_0x52a7('0x1d')]);router[_0x52a7('0x1b')](_0x52a7('0x14'),auth[_0x52a7('0xe')](),controller[_0x52a7('0x1e')]);module[_0x52a7('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 44557cf..a715904 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bcc=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x555069,_0x23d66a){var _0x100af7=function(_0x1606bd){while(--_0x1606bd){_0x555069['push'](_0x555069['shift']());}};_0x100af7(++_0x23d66a);}(_0x9bcc,0xf6));var _0xc9bc=function(_0x101c99,_0x27a8ed){_0x101c99=_0x101c99-0x0;var _0x250a4e=_0x9bcc[_0x101c99];return _0x250a4e;};'use strict';var Sequelize=require(_0xc9bc('0x0'));var moment=require(_0xc9bc('0x1'));module[_0xc9bc('0x2')]={'closed':{'type':Sequelize[_0xc9bc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc9bc('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc9bc('0x5')]},'thirdDisposition':{'type':Sequelize[_0xc9bc('0x5')]},'note':{'type':Sequelize[_0xc9bc('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc9bc('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc9bc('0x6')]('in',_0xc9bc('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc9bc('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc9bc('0x6')]('in',_0xc9bc('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7a1b=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x4af7c3,_0x5de577){var _0x4652c8=function(_0x4a5ec8){while(--_0x4a5ec8){_0x4af7c3['push'](_0x4af7c3['shift']());}};_0x4652c8(++_0x5de577);}(_0x7a1b,0x76));var _0xb7a1=function(_0x17b488,_0x9ab8e5){_0x17b488=_0x17b488-0x0;var _0x45d4ba=_0x7a1b[_0x17b488];return _0x45d4ba;};'use strict';var Sequelize=require(_0xb7a1('0x0'));var moment=require(_0xb7a1('0x1'));module[_0xb7a1('0x2')]={'closed':{'type':Sequelize[_0xb7a1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb7a1('0x4')]},'disposition':{'type':Sequelize[_0xb7a1('0x5')]},'secondDisposition':{'type':Sequelize[_0xb7a1('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb7a1('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb7a1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb7a1('0x6')]('in',_0xb7a1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb7a1('0x6')]('in',_0xb7a1('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 9d572b7..a034486 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf2e=['model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','includeAll','create','destroy','describe','addMessage','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','SmsMessage','include','addTags','setTags','ids','spread','findAll','color','emit','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','closed','disposition','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdf2e,0x1a6));var _0xedf2=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0xdf2e[_0x31b9cf];return _0x357b8a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedf2('0x0'));var rimraf=require(_0xedf2('0x1'));var zipdir=require(_0xedf2('0x2'));var jsonpatch=require(_0xedf2('0x3'));var rp=require(_0xedf2('0x4'));var moment=require(_0xedf2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xedf2('0x6'));var util=require(_0xedf2('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xedf2('0x8'));var fs=require('fs');var _=require(_0xedf2('0x9'));var squel=require('squel');var crypto=require(_0xedf2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xedf2('0xb'));var toCsv=require(_0xedf2('0xc'));var querystring=require(_0xedf2('0xd'));var Papa=require(_0xedf2('0xe'));var Redis=require(_0xedf2('0xf'));var authService=require(_0xedf2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xedf2('0x11'));var hardwareService=require(_0xedf2('0x12'));var logger=require(_0xedf2('0x13'))(_0xedf2('0x14'));var utils=require('../../config/utils');var config=require(_0xedf2('0x15'));var licenseUtil=require(_0xedf2('0x16'));var db=require(_0xedf2('0x17'))['db'];config['redis']=_[_0xedf2('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedf2('0x19')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x154a3f,_0x54a23c){_0x54a23c=_0x54a23c||0xcc;return function(_0x21d607){if(_0x21d607){return _0x154a3f[_0xedf2('0x1a')](_0x54a23c);}return _0x154a3f[_0xedf2('0x1b')](_0x54a23c)[_0xedf2('0x1c')]();};}function respondWithResult(_0x345181,_0x412506){_0x412506=_0x412506||0xc8;return function(_0x43c0d6){if(_0x43c0d6){return _0x345181[_0xedf2('0x1b')](_0x412506)[_0xedf2('0x1d')](_0x43c0d6);}};}function respondWithFilteredResult(_0x41b699,_0xb3cbee){return function(_0x4e087){if(_0x4e087){var _0x3f163b=_0x4e087[_0xedf2('0x1e')],_0x31bed8=_0xb3cbee[_0xedf2('0x1f')],_0x2d646d=_0xb3cbee[_0xedf2('0x1f')]+_0xb3cbee[_0xedf2('0x20')],_0x4e6f06;if(_0x2d646d>=_0x3f163b){_0x2d646d=_0x3f163b;_0x4e6f06=0xc8;}else{_0x4e6f06=0xce;}_0x41b699[_0xedf2('0x1b')](_0x4e6f06);return _0x41b699[_0xedf2('0x21')](_0xedf2('0x22'),_0x31bed8+'-'+_0x2d646d+'/'+_0x3f163b)['json'](_0x4e087);}return null;};}function patchUpdates(_0x454ad4){return function(_0xdc8c5f){try{jsonpatch[_0xedf2('0x23')](_0xdc8c5f,_0x454ad4,!![]);}catch(_0x1609d6){return BPromise['reject'](_0x1609d6);}return _0xdc8c5f[_0xedf2('0x24')]();};}function saveUpdates(_0x1dfc10,_0x1ff104){return function(_0x188bba){if(_0x188bba){return _0x188bba[_0xedf2('0x25')](_0x1dfc10)['then'](function(_0x34b4ab){return _0x34b4ab;});}return null;};}function removeEntity(_0x5760b0,_0x1144ba){return function(_0x229bfb){if(_0x229bfb){return _0x229bfb['destroy']()[_0xedf2('0x26')](function(){_0x5760b0['status'](0xcc)[_0xedf2('0x1c')]();});}};}function handleEntityNotFound(_0x586c25,_0x420c50){return function(_0x569710){if(!_0x569710){_0x586c25['sendStatus'](0x194);}return _0x569710;};}function handleError(_0x2deb8d,_0x5d30e7){_0x5d30e7=_0x5d30e7||0x1f4;return function(_0x53b03b){logger[_0xedf2('0x27')](_0x53b03b[_0xedf2('0x28')]);if(_0x53b03b[_0xedf2('0x29')]){delete _0x53b03b['name'];}_0x2deb8d['status'](_0x5d30e7)[_0xedf2('0x2a')](_0x53b03b);};}function getInteractionUsers(_0x3566ae,_0x308520){return new BPromise(function(_0x34c529,_0x2b96bb){try{if(_0x308520[_0x3566ae['id']]){_0x3566ae[_0xedf2('0x2b')]=_[_0xedf2('0x2c')](_0x308520[_0x3566ae['id']],function(_0x4d89d9){return{'id':_0x4d89d9['id'],'fullname':_0x4d89d9[_0xedf2('0x2d')]};});}}catch(_0x443ac4){_0x2b96bb(_0x443ac4);}_0x34c529(_0x3566ae);});}function getInteractionTags(_0x179897,_0x8e13b0){return new BPromise(function(_0x1fd654,_0x2cb195){try{if(_0x179897[_0xedf2('0x2e')]){_0x179897[_0xedf2('0x2f')]=[];_0x179897[_0xedf2('0x2e')][_0xedf2('0x30')](',')[_0xedf2('0x31')](function(_0x45be56){_0x179897[_0xedf2('0x2f')][_0xedf2('0x32')](_0x8e13b0[_0x45be56]);});}delete _0x179897[_0xedf2('0x2e')];}catch(_0x1261e3){_0x2cb195(_0x1261e3);}_0x1fd654(_0x179897);});}function updateSmsInteraction(_0x2f98d3,_0x59e95f,_0xb13749){return new BPromise(function(_0x5a9ac8,_0x38e758){return getInteractionUsers(_0x2f98d3,_0xb13749)[_0xedf2('0x26')](function(_0x227dd1){return getInteractionTags(_0x227dd1,_0x59e95f);})[_0xedf2('0x26')](function(_0x20b6b3){_0x5a9ac8(_0x20b6b3);})[_0xedf2('0x33')](function(_0x593545){_0x38e758(_0x593545);});});}exports[_0xedf2('0x34')]=function(_0x273699,_0x256f4c){var _0x3fc342={},_0x4bf766={},_0x15f99c={'count':0x0,'rows':[]};var _0x57ff24=_[_0xedf2('0x2c')](db[_0xedf2('0x35')][_0xedf2('0x36')],function(_0xb23c85){return{'name':_0xb23c85[_0xedf2('0x37')],'type':_0xb23c85[_0xedf2('0x38')][_0xedf2('0x39')]};});_0x4bf766[_0xedf2('0x3a')]=_['map'](_0x57ff24,'name');_0x4bf766[_0xedf2('0x3b')]=_['keys'](_0x273699['query']);_0x4bf766[_0xedf2('0x3c')]=_['intersection'](_0x4bf766['model'],_0x4bf766[_0xedf2('0x3b')]);_0x3fc342[_0xedf2('0x3d')]=_[_0xedf2('0x3e')](_0x4bf766['model'],qs[_0xedf2('0x3f')](_0x273699[_0xedf2('0x3b')]['fields']));_0x3fc342[_0xedf2('0x3d')]=_0x3fc342[_0xedf2('0x3d')][_0xedf2('0x40')]?_0x3fc342[_0xedf2('0x3d')]:_0x4bf766[_0xedf2('0x3a')];if(!_0x273699[_0xedf2('0x3b')][_0xedf2('0x41')](_0xedf2('0x42'))){_0x3fc342['limit']=qs[_0xedf2('0x20')](_0x273699['query'][_0xedf2('0x20')]);_0x3fc342['offset']=qs[_0xedf2('0x1f')](_0x273699[_0xedf2('0x3b')][_0xedf2('0x1f')]);}_0x3fc342[_0xedf2('0x43')]=qs[_0xedf2('0x44')](_0x273699[_0xedf2('0x3b')][_0xedf2('0x44')]);_0x3fc342[_0xedf2('0x45')]=qs['filters'](_[_0xedf2('0x46')](_0x273699['query'],_0x4bf766[_0xedf2('0x3c')]),_0x57ff24);var _0x36e27c=[];var _0x5b8738=squel[_0xedf2('0x47')]()['field']('id')['field'](_0xedf2('0x29'))[_0xedf2('0x48')]('color')[_0xedf2('0x49')](_0xedf2('0x4a'));var _0x193ad3=squel[_0xedf2('0x47')]()[_0xedf2('0x48')](_0xedf2('0x4b'))[_0xedf2('0x48')](_0xedf2('0x4c'))[_0xedf2('0x48')](_0xedf2('0x4d'))['from'](_0xedf2('0x4e'),'ui')[_0xedf2('0x4f')](_0xedf2('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x24fce7=squel['select']()['from']('sms_interactions','i')['left_join'](_0xedf2('0x51'),'c',_0xedf2('0x52'))[_0xedf2('0x4f')](_0xedf2('0x50'),'o',_0xedf2('0x53'))[_0xedf2('0x4f')](_0xedf2('0x54'),'a',_0xedf2('0x55'))[_0xedf2('0x4f')](_0xedf2('0x56'),'me',_0xedf2('0x57'))['left_join']('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0xedf2('0x4f')](_0xedf2('0x4a'),'t',_0xedf2('0x58'));var _0x282b2f=squel[_0xedf2('0x59')]();var _0x1715f3=[];var _0x388d27=squel[_0xedf2('0x59')]();var _0x1aaf74;if(_0x273699[_0xedf2('0x3b')][_0xedf2('0x5a')]){_0x1aaf74=as[_0xedf2('0x5b')](_0x273699[_0xedf2('0x3b')][_0xedf2('0x5a')]);var _0x1cdf81=_0x1aaf74['sqlOperator'];for(var _0x2c992d=0x0;_0x2c992d<_0x1aaf74[_0xedf2('0x5c')][_0xedf2('0x40')];_0x2c992d++){var _0x41e7ab=_0x1aaf74['conditions'][_0x2c992d];var _0x14a5dd='i';var _0x1717eb=_[_0xedf2('0x5d')](_0x57ff24,[_0xedf2('0x29'),_0x41e7ab[_0xedf2('0x48')]]);if(!_0x1717eb){switch(_0x41e7ab[_0xedf2('0x48')]){case _0xedf2('0x5e'):if(_0x41e7ab[_0xedf2('0x5f')]==0x1){_0x24fce7['having']('`'+_0x41e7ab[_0xedf2('0x48')]+_0xedf2('0x60'));}else{_0x24fce7['having']('`'+_0x41e7ab[_0xedf2('0x48')]+_0xedf2('0x61'));}break;case _0xedf2('0x62'):if(_0x41e7ab[_0xedf2('0x63')]==='$substring'){if(_0x41e7ab['value'][_0xedf2('0x30')]('\x20')[_0xedf2('0x40')]>0x1){_0x282b2f[_0x1cdf81](_0xedf2('0x64'),qs[_0xedf2('0x65')](_0x41e7ab[_0xedf2('0x5f')]),null);}else{var _0x50fdb2='%'+_0x41e7ab['value']+'%';_0x282b2f[_0x1cdf81](_0xedf2('0x66'),_0x50fdb2,_0x50fdb2,_0x50fdb2);}}else{_0x1717eb=_[_0xedf2('0x5d')](_0x57ff24,['name',_0xedf2('0x67')]);_0x41e7ab['field']=_0xedf2('0x67');_0x1011cc=as[_0xedf2('0x68')](_0x14a5dd,_0x1717eb[_0xedf2('0x38')],_0x41e7ab);_0x282b2f[_0x1cdf81](_0x1011cc[_0xedf2('0x69')],_0x1011cc[_0xedf2('0x5f')][_0xedf2('0x6a')],_0x1011cc['value'][_0xedf2('0x1c')]);}break;case _0xedf2('0x6b'):var _0x13c0a8=_0x41e7ab['value'][_0xedf2('0x30')](',')[_0xedf2('0x2c')](function(_0x583414){return Number(_0x583414);});_0x13c0a8[_0xedf2('0x31')](function(_0x3ff89f){_0x388d27['or'](_0xedf2('0x6c'),'%,'+_0x3ff89f+',%');});_0x1715f3=_[_0xedf2('0x6d')](_0x1715f3,_0x13c0a8);break;case _0xedf2('0x6e'):if(_0x41e7ab[_0xedf2('0x63')]===_0xedf2('0x6f')){_0x282b2f[_0x1cdf81](_0xedf2('0x70'),'%'+_0x41e7ab[_0xedf2('0x5f')]+'%',null);}else{_0x1717eb=_[_0xedf2('0x5d')](_0x57ff24,['name',_0xedf2('0x71')]);_0x41e7ab['field']=_0xedf2('0x71');_0x1011cc=as[_0xedf2('0x68')](_0x14a5dd,_0x1717eb[_0xedf2('0x38')],_0x41e7ab);_0x282b2f[_0x1cdf81](_0x1011cc['text'],_0x1011cc[_0xedf2('0x5f')][_0xedf2('0x6a')],_0x1011cc[_0xedf2('0x5f')]['end']);}break;case _0xedf2('0x72'):_0x1011cc=as[_0xedf2('0x68')]('me',null,_0x41e7ab);_0x282b2f[_0x1cdf81](_0x1011cc[_0xedf2('0x69')],_0x1011cc[_0xedf2('0x5f')]['start'],_0x1011cc['value']['end']);break;}}else{var _0x1011cc=as[_0xedf2('0x68')](_0x14a5dd,_0x1717eb[_0xedf2('0x38')],_0x41e7ab);_0x282b2f[_0x1cdf81](_0x1011cc['text'],_0x1011cc[_0xedf2('0x5f')][_0xedf2('0x6a')],_0x1011cc['value'][_0xedf2('0x1c')]);}}}else{var _0x16ab8c=_(_0x273699[_0xedf2('0x3b')])[_0xedf2('0x73')]()[_0xedf2('0x2c')](function(_0x41fec4){return _[_0xedf2('0x74')](_0x57ff24,['name',_0x41fec4])?_0x41fec4:undefined;})[_0xedf2('0x75')]()[_0xedf2('0x5f')]();if(!_['isEmpty'](_0x16ab8c)){_0x16ab8c['forEach'](function(_0x47e0c0){if(_0x47e0c0==='SmsAccountId'){_0x24fce7[_0xedf2('0x45')](_0xedf2('0x76'),[]['concat'](_0x273699[_0xedf2('0x3b')][_0x47e0c0]));}else if(_0x47e0c0===_0xedf2('0x77')){var _0x11f4c3=JSON[_0xedf2('0x78')](_0x273699[_0xedf2('0x3b')][_0x47e0c0])[_0xedf2('0x79')];var _0x534e6a=JSON[_0xedf2('0x78')](_0x273699[_0xedf2('0x3b')][_0x47e0c0])[_0xedf2('0x7a')];_0x24fce7[_0xedf2('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x11f4c3,_0x534e6a);}else{if(_0x273699['query'][_0x47e0c0]===_0xedf2('0x7b')){_0x24fce7['where']('i.'+_0x47e0c0+'\x20IS\x20NULL');}else{_0x24fce7[_0xedf2('0x45')]('i.'+_0x47e0c0+_0xedf2('0x7c'),_0x273699[_0xedf2('0x3b')][_0x47e0c0]);}}});}if(_0x273699[_0xedf2('0x3b')][_0xedf2('0x7d')]){if(_0x273699[_0xedf2('0x3b')][_0xedf2('0x7d')]==0x1){_0x24fce7['having'](_0xedf2('0x7e'));}else{_0x24fce7[_0xedf2('0x7f')](_0xedf2('0x80'));}}if(_0x273699[_0xedf2('0x3b')][_0xedf2('0x81')]){_0x1715f3=_[_0xedf2('0x82')](_0x273699[_0xedf2('0x3b')][_0xedf2('0x81')])?_0x273699[_0xedf2('0x3b')][_0xedf2('0x81')]:new Array(_0x273699[_0xedf2('0x3b')][_0xedf2('0x81')]);_0x1715f3[_0xedf2('0x31')](function(_0x3ef929){_0x388d27['or'](_0xedf2('0x6c'),'%,'+_0x3ef929+',%');});}if(_0x273699[_0xedf2('0x3b')]['filter']){var _0x1fe65c=_0x273699['query'][_0xedf2('0x83')]['replace']('\x5c','\x5c\x5c')[_0xedf2('0x84')](/'/g,'\x27\x27');if(qs[_0xedf2('0x85')](_0x1fe65c)){_0x282b2f['or'](_0xedf2('0x86'),_0x1fe65c+'%')['or']('i.phone\x20LIKE\x20?',_0x1fe65c+'%');}else{_0x282b2f['or'](_0xedf2('0x87'),qs[_0xedf2('0x65')](_0x1fe65c))['or'](_0xedf2('0x88'),_0x1fe65c+'%');}}}_0x24fce7[_0xedf2('0x45')](_0x282b2f);_0x24fce7[_0xedf2('0x89')]('i.id');var _0x2c6b98={'type':db[_0xedf2('0x8a')][_0xedf2('0x8b')]['SELECT'],'raw':!![]};var _0x4c78de=_0x24fce7[_0xedf2('0x8c')]();_0x4c78de[_0xedf2('0x48')](_0xedf2('0x8d'));_0x4c78de[_0xedf2('0x48')](_0xedf2('0x8e'),'unreadMessages');if(_0x3fc342[_0xedf2('0x43')]){_0x3fc342['order']['forEach'](function(_0x443654){var _0x40d997=_0x443654[0x0]===_0xedf2('0x8f')?_0x443654[0x0]:'i.'+_0x443654[0x0];_0x24fce7[_0xedf2('0x43')](_0x40d997,_0x443654[0x1]===_0xedf2('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x1715f3)){_0x24fce7['having'](_0x388d27);_0x4c78de[_0xedf2('0x45')](_0xedf2('0x91'),_0x1715f3);}BPromise[_0xedf2('0x92')]()[_0xedf2('0x26')](function(){if(!_0x1aaf74){if(_0x273699[_0xedf2('0x3b')][_0xedf2('0x93')]||_0x273699['query'][_0xedf2('0x94')])return;_0x4c78de[_0xedf2('0x45')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x24fce7[_0xedf2('0x45')](_0xedf2('0x95'));return;}if(_0x273699[_0xedf2('0x96')][_0xedf2('0x97')]!=='agent')return;return _0x273699[_0xedf2('0x96')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xedf2('0x26')](function(_0x376875){if(_['isEmpty'](_0x376875)){_0x4c78de[_0xedf2('0x45')](_0xedf2('0x98'));_0x24fce7[_0xedf2('0x45')](_0xedf2('0x98'));}else{_0x4c78de[_0xedf2('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0xedf2('0x2c')](_0x376875,'id'));_0x24fce7[_0xedf2('0x45')](_0xedf2('0x76'),_[_0xedf2('0x2c')](_0x376875,'id'));}});})['then'](function(){if(_0x273699['user'][_0xedf2('0x97')]==='agent'&&!_0x1aaf74&&!_0x273699[_0xedf2('0x3b')][_0xedf2('0x93')])return[];return db[_0xedf2('0x99')][_0xedf2('0x3b')](_0x4c78de[_0xedf2('0x9a')](),_0x2c6b98);})['then'](function(_0x3b95da){_0x15f99c[_0xedf2('0x1e')]=_0x3b95da[_0xedf2('0x40')];if(_0x15f99c[_0xedf2('0x1e')]===0x0)return[];return db['sequelize'][_0xedf2('0x3b')](_0x5b8738[_0xedf2('0x9a')](),_0x2c6b98)[_0xedf2('0x26')](function(_0x1ad5b3){_0x36e27c=_[_0xedf2('0x9b')](_0x1ad5b3,'id');_0x2c6b98=_[_0xedf2('0x9c')](_0x2c6b98,{'model':db[_0xedf2('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x273699[_0xedf2('0x3b')]['fields']){_0x3fc342[_0xedf2('0x3d')][_0xedf2('0x31')](function(_0x284e13){_0x24fce7['field']('i.'+_0x284e13);});}else{_0x24fce7['field'](_0xedf2('0x8e'),_0xedf2('0x5e'));_0x24fce7[_0xedf2('0x48')](_0xedf2('0x9d'),_0xedf2('0x9e'));_0x24fce7[_0xedf2('0x48')](_0xedf2('0x9f'),_0xedf2('0xa0'));_0x24fce7[_0xedf2('0x48')](_0xedf2('0xa1'),_0xedf2('0x8f'));_0x24fce7[_0xedf2('0x48')](_0xedf2('0xa2'));_0x24fce7[_0xedf2('0x48')](_0xedf2('0xa3'),'Contact.firstName');_0x24fce7[_0xedf2('0x48')](_0xedf2('0xa4'),_0xedf2('0xa5'));_0x24fce7[_0xedf2('0x48')](_0xedf2('0xa6'),_0xedf2('0xa7'));_0x24fce7['field']('c.phone',_0xedf2('0xa8'));_0x24fce7[_0xedf2('0x48')](_0xedf2('0xa9'),_0xedf2('0xaa'));_0x24fce7['field']('c.fax',_0xedf2('0xab'));_0x24fce7['field']('o.fullname',_0xedf2('0xac'));_0x24fce7[_0xedf2('0x48')](_0xedf2('0xad'),_0xedf2('0xae'));_0x24fce7['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xedf2('0x2e'));}if(_0x3fc342[_0xedf2('0x20')])_0x24fce7[_0xedf2('0x20')](_0x3fc342[_0xedf2('0x20')]);if(_0x3fc342['offset'])_0x24fce7[_0xedf2('0x1f')](_0x3fc342[_0xedf2('0x1f')]);return db[_0xedf2('0x99')][_0xedf2('0x3b')](_0x24fce7[_0xedf2('0x9a')](),_0x2c6b98);})[_0xedf2('0x26')](function(_0x4b6976){_0x193ad3[_0xedf2('0x45')](_0xedf2('0xaf'),_[_0xedf2('0x2c')](_0x4b6976,'id'));return db[_0xedf2('0x99')][_0xedf2('0x3b')](_0x193ad3[_0xedf2('0x9a')](),_0x2c6b98)[_0xedf2('0x26')](function(_0x3ec983){var _0xfd6e89=_[_0xedf2('0xb0')](_0x3ec983,_0xedf2('0xb1'));var _0xba4056=[];_0x4b6976[_0xedf2('0x31')](function(_0x3f9a8e){_0xba4056['push'](updateSmsInteraction(_0x3f9a8e,_0x36e27c,_0xfd6e89));});return BPromise[_0xedf2('0xb2')](_0xba4056);});});})[_0xedf2('0x26')](function(_0x4fb55b){_0x15f99c[_0xedf2('0xb3')]=_0x4fb55b;return _0x15f99c;})[_0xedf2('0x26')](respondWithFilteredResult(_0x256f4c,_0x3fc342))[_0xedf2('0x33')](handleError(_0x256f4c,null));};exports['show']=function(_0x1638f0,_0x43620d){var _0x2c49f8={'raw':![],'where':{'id':_0x1638f0[_0xedf2('0xb4')]['id']}},_0x31ebc0={};_0x31ebc0[_0xedf2('0x3a')]=_[_0xedf2('0x73')](db[_0xedf2('0x35')]['rawAttributes']);_0x31ebc0[_0xedf2('0x3b')]=_[_0xedf2('0x73')](_0x1638f0['query']);_0x31ebc0[_0xedf2('0x3c')]=_[_0xedf2('0x3e')](_0x31ebc0[_0xedf2('0x3a')],_0x31ebc0[_0xedf2('0x3b')]);_0x2c49f8[_0xedf2('0x3d')]=_[_0xedf2('0x3e')](_0x31ebc0[_0xedf2('0x3a')],qs[_0xedf2('0x3f')](_0x1638f0[_0xedf2('0x3b')][_0xedf2('0x3f')]));_0x2c49f8[_0xedf2('0x3d')]=_0x2c49f8['attributes']['length']?_0x2c49f8[_0xedf2('0x3d')]:_0x31ebc0[_0xedf2('0x3a')];if(_0x1638f0[_0xedf2('0x3b')][_0xedf2('0xb5')]){_0x2c49f8['include']=[{'all':!![]}];}_0x2c49f8=_[_0xedf2('0x9c')]({},_0x2c49f8,_0x1638f0['options']);return db['SmsInteraction'][_0xedf2('0x5d')](_0x2c49f8)[_0xedf2('0x26')](handleEntityNotFound(_0x43620d,null))[_0xedf2('0x26')](respondWithResult(_0x43620d,null))[_0xedf2('0x33')](handleError(_0x43620d,null));};exports[_0xedf2('0xb6')]=function(_0x377d18,_0x2f639c){return db[_0xedf2('0x35')][_0xedf2('0xb6')](_0x377d18[_0xedf2('0x72')],{})[_0xedf2('0x26')](respondWithResult(_0x2f639c,0xc9))['catch'](handleError(_0x2f639c,null));};exports['update']=function(_0x23a316,_0x15e24b){if(_0x23a316[_0xedf2('0x72')]['id']){delete _0x23a316[_0xedf2('0x72')]['id'];}return db[_0xedf2('0x35')][_0xedf2('0x5d')]({'where':{'id':_0x23a316[_0xedf2('0xb4')]['id']}})[_0xedf2('0x26')](handleEntityNotFound(_0x15e24b,null))[_0xedf2('0x26')](saveUpdates(_0x23a316[_0xedf2('0x72')],null))[_0xedf2('0x26')](respondWithResult(_0x15e24b,null))['catch'](handleError(_0x15e24b,null));};exports[_0xedf2('0xb7')]=function(_0x1699d9,_0x3a1f2b){return db[_0xedf2('0x35')]['find']({'where':{'id':_0x1699d9[_0xedf2('0xb4')]['id']}})['then'](handleEntityNotFound(_0x3a1f2b,null))['then'](removeEntity(_0x3a1f2b,null))['catch'](handleError(_0x3a1f2b,null));};exports[_0xedf2('0xb8')]=function(_0x2b3821,_0x3030a4){return db[_0xedf2('0x35')][_0xedf2('0xb8')]()['then'](respondWithResult(_0x3030a4,null))['catch'](handleError(_0x3030a4,null));};exports[_0xedf2('0xb9')]=function(_0x2697c3,_0x414aaa,_0x153a89){return db['SmsMessage'][_0xedf2('0x5d')]({'where':{'id':_0x2697c3['params']['id']}})[_0xedf2('0x26')](handleEntityNotFound(_0x414aaa,null))[_0xedf2('0x26')](function(_0x2388b7){if(_0x2388b7){return _0x2388b7['addMessage'](_0x2697c3[_0xedf2('0x72')]['ids'],_[_0xedf2('0xba')](_0x2697c3[_0xedf2('0x72')],['ids','id'])||{});}})[_0xedf2('0x26')](respondWithResult(_0x414aaa,null))[_0xedf2('0x33')](handleError(_0x414aaa,null));};exports[_0xedf2('0xbb')]=function(_0x58e483,_0x4b5b8e,_0x10faf2){var _0x3c38d9={'raw':![],'where':{}};var _0x3b479f={};var _0x4ac5cf={'count':0x0,'rows':[]};return db[_0xedf2('0x35')][_0xedf2('0xbc')]({'where':{'id':_0x58e483[_0xedf2('0xb4')]['id']}})[_0xedf2('0x26')](handleEntityNotFound(_0x4b5b8e,null))['then'](function(_0x2de551){if(_0x2de551){_0x3b479f[_0xedf2('0x3a')]=_[_0xedf2('0x73')](db['SmsMessage'][_0xedf2('0x36')]);_0x3b479f['query']=_[_0xedf2('0x73')](_0x58e483[_0xedf2('0x3b')]);_0x3b479f[_0xedf2('0x3c')]=_[_0xedf2('0x3e')](_0x3b479f[_0xedf2('0x3a')],_0x3b479f['query']);_0x3c38d9['attributes']=_[_0xedf2('0x3e')](_0x3b479f[_0xedf2('0x3a')],qs['fields'](_0x58e483[_0xedf2('0x3b')][_0xedf2('0x3f')]));_0x3c38d9[_0xedf2('0x3d')]=_0x3c38d9[_0xedf2('0x3d')][_0xedf2('0x40')]?_0x3c38d9['attributes']:_0x3b479f[_0xedf2('0x3a')];if(!_0x58e483['query']['hasOwnProperty']('nolimit')){_0x3c38d9[_0xedf2('0x20')]=qs['limit'](_0x58e483[_0xedf2('0x3b')][_0xedf2('0x20')]);_0x3c38d9[_0xedf2('0x1f')]=qs['offset'](_0x58e483[_0xedf2('0x3b')][_0xedf2('0x1f')]);}_0x3c38d9['order']=qs[_0xedf2('0x44')](_0x58e483[_0xedf2('0x3b')]['sort']);_0x3c38d9[_0xedf2('0x45')]=qs[_0xedf2('0x3c')](_[_0xedf2('0x46')](_0x58e483['query'],_0x3b479f[_0xedf2('0x3c')]));_0x3c38d9[_0xedf2('0x45')][_0xedf2('0xb1')]=_0x2de551['id'];if(_0x58e483[_0xedf2('0x3b')][_0xedf2('0x83')]){_0x3c38d9['where']=_[_0xedf2('0x9c')](_0x3c38d9[_0xedf2('0x45')],{'$or':_[_0xedf2('0x2c')](_0x3c38d9[_0xedf2('0x3d')],function(_0x25aed2){var _0x529c6e={};_0x529c6e[_0x25aed2]={'$like':'%'+_0x58e483[_0xedf2('0x3b')]['filter']+'%'};return _0x529c6e;})});}if(_0x58e483[_0xedf2('0x3b')][_0xedf2('0x79')]){var _0x5a7375=_0x58e483['query']['$gte'][_0xedf2('0x30')](',');var _0x18dc4b={};_0x18dc4b[_0x5a7375[0x0]]={'$gte':moment(_0x5a7375[0x1])[_0xedf2('0xbd')](_0xedf2('0xbe'))};_0x3c38d9[_0xedf2('0x45')]=_[_0xedf2('0x9c')](_0x3c38d9[_0xedf2('0x45')],_0x18dc4b);}_0x3c38d9=_[_0xedf2('0x9c')]({},_0x3c38d9,_0x58e483[_0xedf2('0xbf')]);return db[_0xedf2('0xc0')]['count']({'where':_0x3c38d9[_0xedf2('0x45')]})[_0xedf2('0x26')](function(_0x1f7c00){_0x4ac5cf['count']=_0x1f7c00;if(_0x58e483['query']['includeAll']){_0x3c38d9[_0xedf2('0xc1')]=[{'all':!![]}];}return db[_0xedf2('0xc0')]['findAll'](_0x3c38d9);})[_0xedf2('0x26')](function(_0x2474ef){_0x4ac5cf[_0xedf2('0xb3')]=_0x2474ef;return _0x4ac5cf;});}})[_0xedf2('0x26')](respondWithFilteredResult(_0x4b5b8e,_0x3c38d9))[_0xedf2('0x33')](handleError(_0x4b5b8e,null));};exports[_0xedf2('0xc2')]=function(_0x48d1b3,_0x30ed4d,_0x41d941){return db[_0xedf2('0x35')]['find']({'where':{'id':_0x48d1b3['params']['id']}})[_0xedf2('0x26')](handleEntityNotFound(_0x30ed4d,null))[_0xedf2('0x26')](function(_0x14320e){if(_0x14320e){return _0x14320e[_0xedf2('0xc3')](_0x48d1b3[_0xedf2('0x72')][_0xedf2('0xc4')],_['omit'](_0x48d1b3[_0xedf2('0x72')],[_0xedf2('0xc4'),'id'])||{})[_0xedf2('0xc5')](function(){return db[_0xedf2('0x6b')][_0xedf2('0xc6')]({'attributes':['id',_0xedf2('0x29'),_0xedf2('0xc7')],'where':{'id':_0x48d1b3[_0xedf2('0x72')][_0xedf2('0xc4')]}});})[_0xedf2('0x26')](function(_0x2709e6){socket[_0xedf2('0xc8')]('smsInteractionTags:save',{'id':Number(_0x48d1b3[_0xedf2('0xb4')]['id']),'tags':_0x2709e6||[]});return{'id':Number(_0x48d1b3[_0xedf2('0xb4')]['id']),'tags':_0x2709e6||[]};});}})[_0xedf2('0x26')](respondWithResult(_0x30ed4d,null))[_0xedf2('0x33')](handleError(_0x30ed4d,null));};exports['removeTags']=function(_0xab6cd2,_0x248c61,_0x4af751){return db[_0xedf2('0x35')]['find']({'where':{'id':_0xab6cd2[_0xedf2('0xb4')]['id']}})[_0xedf2('0x26')](handleEntityNotFound(_0x248c61,null))['then'](function(_0x2aea2c){if(_0x2aea2c){return _0x2aea2c[_0xedf2('0xc9')](_0xab6cd2['query'][_0xedf2('0xc4')]);}})[_0xedf2('0x26')](respondWithStatusCode(_0x248c61,null))['catch'](handleError(_0x248c61,null));};exports[_0xedf2('0xca')]=function(_0x1257c7,_0x40c6f1){var _0x203509=moment()['unix']()[_0xedf2('0x9a')]();var _0x17935d=path[_0xedf2('0xcb')](config[_0xedf2('0xcc')],_0xedf2('0xcd'),_0xedf2('0xce'),'tmp');var _0x38aa0d=path[_0xedf2('0xcb')](config[_0xedf2('0xcc')],_0xedf2('0xcd'),_0xedf2('0xce'),_0xedf2('0xcf'));var _0x1487f0=path[_0xedf2('0xcb')](_0x17935d,_0x203509);var _0x48f891=util[_0xedf2('0xbd')](_0xedf2('0xd0'),_0x1257c7[_0xedf2('0xb4')]['id'],_0x203509);var _0x3856a0=path[_0xedf2('0xcb')](_0x17935d,_0x48f891);var _0x2342c9=[];_0x2342c9['push']({'model':db[_0xedf2('0x6e')],'as':_0xedf2('0x6e'),'attributes':['id',_0xedf2('0x2d')],'raw':!![]});_0x2342c9['push']({'model':db[_0xedf2('0xd1')],'as':_0xedf2('0x62'),'attributes':['id',_0xedf2('0xd2'),_0xedf2('0xd3')],'raw':!![]});var _0x321def=[{'model':db[_0xedf2('0xc0')],'as':_0xedf2('0xd4'),'attributes':['id','body',_0xedf2('0x77'),_0xedf2('0xd5'),_0xedf2('0xd6'),_0xedf2('0x7d')],'include':_0x2342c9}];_0x321def[_0xedf2('0x32')]({'model':db['SmsAccount'],'as':_0xedf2('0xd7'),'attributes':['id',_0xedf2('0x29')]});_0x321def['push']({'model':db['User'],'as':_0xedf2('0xd8'),'attributes':['id',_0xedf2('0x2d')]});return db['SmsInteraction'][_0xedf2('0x5d')]({'where':{'id':_0x1257c7[_0xedf2('0xb4')]['id']},'include':_0x321def})[_0xedf2('0x26')](handleEntityNotFound(_0x40c6f1,null))[_0xedf2('0x26')](function(_0x217a3c){if(_0x217a3c){var _0x3dbdc4=_0x217a3c[_0xedf2('0xd9')]({'plain':!![]});fs[_0xedf2('0xda')](_0x1487f0);var _0x2480c7={'format':'A4','border':'10px','header':{'height':_0xedf2('0xdb'),'contents':{'first':_0xedf2('0xdc')}},'footer':{'height':_0xedf2('0xdd'),'contents':{'default':util['format'](_0xedf2('0xde'),util['format'](_0xedf2('0xdf'),_0xedf2('0xe0'),_0x3dbdc4['id']),moment()['format'](_0xedf2('0xe1'))[_0xedf2('0x9a')]())}}};var _0x3695da={'channel':_0xedf2('0xe0'),'account':_0x3dbdc4['Account'][_0xedf2('0x29')],'agent':_0x3dbdc4[_0xedf2('0xd8')]?_0x3dbdc4[_0xedf2('0xd8')]['fullname']:_0xedf2('0xe2'),'createdAt':moment(_0x3dbdc4[_0xedf2('0x77')])[_0xedf2('0xbd')](_0xedf2('0xbe'))[_0xedf2('0x9a')](),'closedAt':_0x3dbdc4[_0xedf2('0xe3')]?moment(_0x3dbdc4['closedAt'])[_0xedf2('0xbd')](_0xedf2('0xbe'))[_0xedf2('0x9a')]():'','disposition':_0x3dbdc4[_0xedf2('0xe4')],'messages':_(_0x3dbdc4[_0xedf2('0xd4')])[_0xedf2('0x83')]({'secret':![]})[_0xedf2('0x2c')](function(_0x1e632c){return{'date':moment(_0x1e632c[_0xedf2('0x77')])[_0xedf2('0xbd')](_0xedf2('0xbe'))[_0xedf2('0x9a')](),'sender':_0x1e632c[_0xedf2('0xd5')]==='out'?_0x1e632c[_0xedf2('0x6e')]?_0x1e632c[_0xedf2('0x6e')][_0xedf2('0x2d')]:_0xedf2('0xe5'):_0x1e632c[_0xedf2('0x62')][_0xedf2('0xd2')]+(_0x1e632c[_0xedf2('0x62')]['lastName']?'\x20'+_0x1e632c[_0xedf2('0x62')][_0xedf2('0xd3')]:''),'body':_0x1e632c[_0xedf2('0x72')],'direction':_0x1e632c[_0xedf2('0xd5')]===_0xedf2('0xe6')?'A':'C','secret':_0x1e632c[_0xedf2('0xd6')],'read':_0x1e632c[_0xedf2('0x7d')]};})[_0xedf2('0x5f')]()};return ejs[_0xedf2('0xe7')](path[_0xedf2('0xcb')](config[_0xedf2('0xcc')],_0xedf2('0xcd'),_0xedf2('0xe8'),_0xedf2('0xe9')),{'interaction':_0x3695da})[_0xedf2('0x26')](function(_0x1a252f){return new BPromise(function(_0x485b98,_0x102817){pdf[_0xedf2('0xb6')](_0x1a252f,_0x2480c7)[_0xedf2('0xea')](path[_0xedf2('0xcb')](_0x1487f0,_0xedf2('0xeb')+_0x3dbdc4['id']+'-'+_0x203509+_0xedf2('0xec')),function(_0x49245f,_0x74a693){if(_0x49245f)return _0x102817(_0x49245f);_0x485b98(_0x74a693);});});})[_0xedf2('0x26')](function(){return new BPromise(function(_0x1dafe4,_0x3d60d8){zipdir(_0x1487f0,{'saveTo':_0x3856a0},function(_0x5d831b,_0x343499){if(_0x5d831b)return _0x3d60d8(_0x5d831b);return _0x1dafe4(_0x343499);});})[_0xedf2('0x26')](function(){return new BPromise(function(_0x245961,_0x1a124a){rimraf(_0x1487f0,function(_0x3cb7f7){if(_0x3cb7f7)_0x1a124a(_0x3cb7f7);return _0x245961();});});})[_0xedf2('0x26')](function(){return _0x40c6f1[_0xedf2('0xca')](_0x3856a0,_0x48f891,function(_0x514b0f){if(_0x514b0f){console[_0xedf2('0xed')](_0xedf2('0xee'),_0x514b0f);}else{fs[_0xedf2('0xef')](_0x3856a0);}});});});}else{return _0x40c6f1[_0xedf2('0x1a')](0xc8);}})['catch'](handleError(_0x40c6f1,null));}; \ No newline at end of file +var _0x8dd0=['key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','u.id','u.fullname','ui.SmsInteractionId','from','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','show','params','includeAll','include','merge','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','findAll','color','emit','smsInteractionTags:save','removeTags','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','lastName','Messages','direction','secret','Account','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Sms','Owner','disposition','out','System','firstName','views','downloadInteraction.html','transcript-','.pdf','download','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','catch','map','SmsInteraction','rawAttributes','fieldName','type'];(function(_0x500b8e,_0x32b7e1){var _0xc549a8=function(_0x4e0545){while(--_0x4e0545){_0x500b8e['push'](_0x500b8e['shift']());}};_0xc549a8(++_0x32b7e1);}(_0x8dd0,0x19c));var _0x08dd=function(_0xe72bbb,_0x4100a4){_0xe72bbb=_0xe72bbb-0x0;var _0x5c15f2=_0x8dd0[_0xe72bbb];return _0x5c15f2;};'use strict';var pdf=require(_0x08dd('0x0'));var emlformat=require(_0x08dd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x08dd('0x2'));var jsonpatch=require(_0x08dd('0x3'));var rp=require(_0x08dd('0x4'));var moment=require('moment');var BPromise=require(_0x08dd('0x5'));var Mustache=require(_0x08dd('0x6'));var util=require(_0x08dd('0x7'));var path=require(_0x08dd('0x8'));var sox=require('sox');var csv=require(_0x08dd('0x9'));var ejs=require(_0x08dd('0xa'));var fs=require('fs');var _=require(_0x08dd('0xb'));var squel=require(_0x08dd('0xc'));var crypto=require(_0x08dd('0xd'));var jsforce=require(_0x08dd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08dd('0xf'));var Papa=require(_0x08dd('0x10'));var Redis=require('ioredis');var authService=require(_0x08dd('0x11'));var qs=require(_0x08dd('0x12'));var as=require(_0x08dd('0x13'));var hardwareService=require(_0x08dd('0x14'));var logger=require(_0x08dd('0x15'))(_0x08dd('0x16'));var utils=require(_0x08dd('0x17'));var config=require(_0x08dd('0x18'));var licenseUtil=require(_0x08dd('0x19'));var db=require(_0x08dd('0x1a'))['db'];config[_0x08dd('0x1b')]=_[_0x08dd('0x1c')](config['redis'],{'host':_0x08dd('0x1d'),'port':0x18eb});var socket=require(_0x08dd('0x1e'))(new Redis(config[_0x08dd('0x1b')]));require(_0x08dd('0x1f'))['register'](socket);function respondWithStatusCode(_0x27d3e6,_0xf104d4){_0xf104d4=_0xf104d4||0xcc;return function(_0x47bbb4){if(_0x47bbb4){return _0x27d3e6[_0x08dd('0x20')](_0xf104d4);}return _0x27d3e6['status'](_0xf104d4)[_0x08dd('0x21')]();};}function respondWithResult(_0x148106,_0x333681){_0x333681=_0x333681||0xc8;return function(_0x513423){if(_0x513423){return _0x148106[_0x08dd('0x22')](_0x333681)[_0x08dd('0x23')](_0x513423);}};}function respondWithFilteredResult(_0x216576,_0x2066a2){return function(_0x482a83){if(_0x482a83){var _0x33dd61=_0x482a83[_0x08dd('0x24')],_0x1b947e=_0x2066a2[_0x08dd('0x25')],_0x128d84=_0x2066a2[_0x08dd('0x25')]+_0x2066a2[_0x08dd('0x26')],_0x142b07;if(_0x128d84>=_0x33dd61){_0x128d84=_0x33dd61;_0x142b07=0xc8;}else{_0x142b07=0xce;}_0x216576[_0x08dd('0x22')](_0x142b07);return _0x216576[_0x08dd('0x27')](_0x08dd('0x28'),_0x1b947e+'-'+_0x128d84+'/'+_0x33dd61)[_0x08dd('0x23')](_0x482a83);}return null;};}function patchUpdates(_0x25e76a){return function(_0x223e94){try{jsonpatch[_0x08dd('0x29')](_0x223e94,_0x25e76a,!![]);}catch(_0x44a1a9){return BPromise[_0x08dd('0x2a')](_0x44a1a9);}return _0x223e94[_0x08dd('0x2b')]();};}function saveUpdates(_0x201440,_0x16661f){return function(_0x27a86c){if(_0x27a86c){return _0x27a86c[_0x08dd('0x2c')](_0x201440)['then'](function(_0x397d8e){return _0x397d8e;});}return null;};}function removeEntity(_0x241651,_0x13d99d){return function(_0xeb4871){if(_0xeb4871){return _0xeb4871[_0x08dd('0x2d')]()[_0x08dd('0x2e')](function(){_0x241651[_0x08dd('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14274b,_0x3681f8){return function(_0x570510){if(!_0x570510){_0x14274b['sendStatus'](0x194);}return _0x570510;};}function handleError(_0x2afbb9,_0x3184b8){_0x3184b8=_0x3184b8||0x1f4;return function(_0x21e5b7){logger['error'](_0x21e5b7[_0x08dd('0x2f')]);if(_0x21e5b7[_0x08dd('0x30')]){delete _0x21e5b7[_0x08dd('0x30')];}_0x2afbb9[_0x08dd('0x22')](_0x3184b8)[_0x08dd('0x31')](_0x21e5b7);};}function getInteractionUsers(_0x42824f,_0x42c7da){return new BPromise(function(_0x525a90,_0x1184e6){try{if(_0x42c7da[_0x42824f['id']]){_0x42824f[_0x08dd('0x32')]=_['map'](_0x42c7da[_0x42824f['id']],function(_0x1638f6){return{'id':_0x1638f6['id'],'fullname':_0x1638f6[_0x08dd('0x33')]};});}}catch(_0x424af3){_0x1184e6(_0x424af3);}_0x525a90(_0x42824f);});}function getInteractionTags(_0x1d4942,_0x6ac0cf){return new BPromise(function(_0x7abfe2,_0x48b0f5){try{if(_0x1d4942[_0x08dd('0x34')]){_0x1d4942[_0x08dd('0x35')]=[];_0x1d4942[_0x08dd('0x34')]['split'](',')[_0x08dd('0x36')](function(_0xc75f25){_0x1d4942[_0x08dd('0x35')][_0x08dd('0x37')](_0x6ac0cf[_0xc75f25]);});}delete _0x1d4942['TagIds'];}catch(_0x4ed46a){_0x48b0f5(_0x4ed46a);}_0x7abfe2(_0x1d4942);});}function updateSmsInteraction(_0x3bd14e,_0x20a174,_0x131f64){return new BPromise(function(_0x185ac5,_0x5af7a3){return getInteractionUsers(_0x3bd14e,_0x131f64)['then'](function(_0x2f859a){return getInteractionTags(_0x2f859a,_0x20a174);})[_0x08dd('0x2e')](function(_0x37d09d){_0x185ac5(_0x37d09d);})[_0x08dd('0x38')](function(_0x4d1828){_0x5af7a3(_0x4d1828);});});}exports['index']=function(_0x1c0422,_0x31dae2){var _0x4ce803={},_0x47778c={},_0x51b71f={'count':0x0,'rows':[]};var _0x3fa4a2=_[_0x08dd('0x39')](db[_0x08dd('0x3a')][_0x08dd('0x3b')],function(_0x270757){return{'name':_0x270757[_0x08dd('0x3c')],'type':_0x270757[_0x08dd('0x3d')][_0x08dd('0x3e')]};});_0x47778c[_0x08dd('0x3f')]=_[_0x08dd('0x39')](_0x3fa4a2,'name');_0x47778c[_0x08dd('0x40')]=_[_0x08dd('0x41')](_0x1c0422[_0x08dd('0x40')]);_0x47778c[_0x08dd('0x42')]=_['intersection'](_0x47778c[_0x08dd('0x3f')],_0x47778c['query']);_0x4ce803[_0x08dd('0x43')]=_[_0x08dd('0x44')](_0x47778c['model'],qs[_0x08dd('0x45')](_0x1c0422[_0x08dd('0x40')][_0x08dd('0x45')]));_0x4ce803[_0x08dd('0x43')]=_0x4ce803[_0x08dd('0x43')][_0x08dd('0x46')]?_0x4ce803[_0x08dd('0x43')]:_0x47778c['model'];if(!_0x1c0422[_0x08dd('0x40')][_0x08dd('0x47')](_0x08dd('0x48'))){_0x4ce803[_0x08dd('0x26')]=qs['limit'](_0x1c0422[_0x08dd('0x40')]['limit']);_0x4ce803[_0x08dd('0x25')]=qs[_0x08dd('0x25')](_0x1c0422[_0x08dd('0x40')]['offset']);}_0x4ce803[_0x08dd('0x49')]=qs[_0x08dd('0x4a')](_0x1c0422[_0x08dd('0x40')][_0x08dd('0x4a')]);_0x4ce803[_0x08dd('0x4b')]=qs[_0x08dd('0x42')](_[_0x08dd('0x4c')](_0x1c0422[_0x08dd('0x40')],_0x47778c['filters']),_0x3fa4a2);var _0x410a9f=[];var _0x319eea=squel[_0x08dd('0x4d')]()[_0x08dd('0x4e')]('id')[_0x08dd('0x4e')]('name')[_0x08dd('0x4e')]('color')['from']('tools_tags');var _0x1df771=squel[_0x08dd('0x4d')]()[_0x08dd('0x4e')](_0x08dd('0x4f'))[_0x08dd('0x4e')](_0x08dd('0x50'))['field'](_0x08dd('0x51'))[_0x08dd('0x52')]('user_has_sms_interactions','ui')[_0x08dd('0x53')]('users','u',_0x08dd('0x54'));var _0x2c2d89=squel[_0x08dd('0x4d')]()['from'](_0x08dd('0x55'),'i')['left_join'](_0x08dd('0x56'),'c',_0x08dd('0x57'))[_0x08dd('0x53')]('users','o',_0x08dd('0x58'))[_0x08dd('0x53')]('sms_accounts','a',_0x08dd('0x59'))[_0x08dd('0x53')]('sms_messages','me',_0x08dd('0x5a'))[_0x08dd('0x53')](_0x08dd('0x5b'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x08dd('0x5c'));var _0x53e03d=squel[_0x08dd('0x5d')]();var _0x308393=[];var _0x1df273=squel[_0x08dd('0x5d')]();var _0x2c0a90;if(_0x1c0422[_0x08dd('0x40')][_0x08dd('0x5e')]){_0x2c0a90=as[_0x08dd('0x5f')](_0x1c0422[_0x08dd('0x40')][_0x08dd('0x5e')]);var _0x1fd3ea=_0x2c0a90['sqlOperator'];for(var _0xe7a017=0x0;_0xe7a017<_0x2c0a90[_0x08dd('0x60')]['length'];_0xe7a017++){var _0x3a2ced=_0x2c0a90[_0x08dd('0x60')][_0xe7a017];var _0x2fcf71='i';var _0x57af33=_[_0x08dd('0x61')](_0x3fa4a2,[_0x08dd('0x30'),_0x3a2ced[_0x08dd('0x4e')]]);if(!_0x57af33){switch(_0x3a2ced[_0x08dd('0x4e')]){case _0x08dd('0x62'):if(_0x3a2ced[_0x08dd('0x63')]==0x1){_0x2c2d89['having']('`'+_0x3a2ced['field']+_0x08dd('0x64'));}else{_0x2c2d89['having']('`'+_0x3a2ced[_0x08dd('0x4e')]+_0x08dd('0x65'));}break;case _0x08dd('0x66'):if(_0x3a2ced['operator']==='$substring'){if(_0x3a2ced[_0x08dd('0x63')][_0x08dd('0x67')]('\x20')['length']>0x1){_0x53e03d[_0x1fd3ea](_0x08dd('0x68'),qs[_0x08dd('0x69')](_0x3a2ced[_0x08dd('0x63')]),null);}else{var _0x178c6a='%'+_0x3a2ced[_0x08dd('0x63')]+'%';_0x53e03d[_0x1fd3ea](_0x08dd('0x6a'),_0x178c6a,_0x178c6a,_0x178c6a);}}else{_0x57af33=_['find'](_0x3fa4a2,[_0x08dd('0x30'),_0x08dd('0x6b')]);_0x3a2ced[_0x08dd('0x4e')]=_0x08dd('0x6b');_0x3b6f6f=as[_0x08dd('0x6c')](_0x2fcf71,_0x57af33[_0x08dd('0x3d')],_0x3a2ced);_0x53e03d[_0x1fd3ea](_0x3b6f6f[_0x08dd('0x6d')],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x6e')],_0x3b6f6f['value']['end']);}break;case _0x08dd('0x6f'):var _0x2f735e=_0x3a2ced[_0x08dd('0x63')][_0x08dd('0x67')](',')[_0x08dd('0x39')](function(_0x26828c){return Number(_0x26828c);});_0x2f735e[_0x08dd('0x36')](function(_0xaf457){_0x1df273['or'](_0x08dd('0x70'),'%,'+_0xaf457+',%');});_0x308393=_['union'](_0x308393,_0x2f735e);break;case _0x08dd('0x71'):if(_0x3a2ced[_0x08dd('0x72')]==='$substring'){_0x53e03d[_0x1fd3ea](_0x08dd('0x73'),'%'+_0x3a2ced[_0x08dd('0x63')]+'%',null);}else{_0x57af33=_[_0x08dd('0x61')](_0x3fa4a2,['name','UserId']);_0x3a2ced[_0x08dd('0x4e')]='UserId';_0x3b6f6f=as[_0x08dd('0x6c')](_0x2fcf71,_0x57af33[_0x08dd('0x3d')],_0x3a2ced);_0x53e03d[_0x1fd3ea](_0x3b6f6f['text'],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x6e')],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x21')]);}break;case _0x08dd('0x74'):_0x3b6f6f=as[_0x08dd('0x6c')]('me',null,_0x3a2ced);_0x53e03d[_0x1fd3ea](_0x3b6f6f[_0x08dd('0x6d')],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x6e')],_0x3b6f6f['value']['end']);break;}}else{var _0x3b6f6f=as[_0x08dd('0x6c')](_0x2fcf71,_0x57af33['type'],_0x3a2ced);_0x53e03d[_0x1fd3ea](_0x3b6f6f[_0x08dd('0x6d')],_0x3b6f6f['value'][_0x08dd('0x6e')],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x21')]);}}}else{var _0x52d6fc=_(_0x1c0422[_0x08dd('0x40')])[_0x08dd('0x41')]()['map'](function(_0x1c8fb8){return _[_0x08dd('0x75')](_0x3fa4a2,[_0x08dd('0x30'),_0x1c8fb8])?_0x1c8fb8:undefined;})[_0x08dd('0x76')]()[_0x08dd('0x63')]();if(!_[_0x08dd('0x77')](_0x52d6fc)){_0x52d6fc['forEach'](function(_0x5d9cff){if(_0x5d9cff===_0x08dd('0x78')){_0x2c2d89['where'](_0x08dd('0x79'),[][_0x08dd('0x7a')](_0x1c0422[_0x08dd('0x40')][_0x5d9cff]));}else if(_0x5d9cff===_0x08dd('0x7b')){var _0x2b6a64=JSON['parse'](_0x1c0422['query'][_0x5d9cff])[_0x08dd('0x7c')];var _0x43f866=JSON[_0x08dd('0x7d')](_0x1c0422['query'][_0x5d9cff])['$lte'];_0x2c2d89[_0x08dd('0x4b')](_0x08dd('0x7e'),_0x2b6a64,_0x43f866);}else{if(_0x1c0422['query'][_0x5d9cff]===_0x08dd('0x7f')){_0x2c2d89[_0x08dd('0x4b')]('i.'+_0x5d9cff+_0x08dd('0x80'));}else{_0x2c2d89[_0x08dd('0x4b')]('i.'+_0x5d9cff+_0x08dd('0x81'),_0x1c0422['query'][_0x5d9cff]);}}});}if(_0x1c0422[_0x08dd('0x40')]['read']){if(_0x1c0422[_0x08dd('0x40')][_0x08dd('0x82')]==0x1){_0x2c2d89[_0x08dd('0x83')](_0x08dd('0x84'));}else{_0x2c2d89[_0x08dd('0x83')](_0x08dd('0x85'));}}if(_0x1c0422['query']['tag']){_0x308393=_['isArray'](_0x1c0422[_0x08dd('0x40')][_0x08dd('0x86')])?_0x1c0422[_0x08dd('0x40')][_0x08dd('0x86')]:new Array(_0x1c0422['query'][_0x08dd('0x86')]);_0x308393[_0x08dd('0x36')](function(_0x29434c){_0x1df273['or'](_0x08dd('0x70'),'%,'+_0x29434c+',%');});}if(_0x1c0422[_0x08dd('0x40')][_0x08dd('0x87')]){var _0x46b178=_0x1c0422[_0x08dd('0x40')][_0x08dd('0x87')][_0x08dd('0x88')]('\x5c','\x5c\x5c')[_0x08dd('0x88')](/'/g,'\x27\x27');if(qs[_0x08dd('0x89')](_0x46b178)){_0x53e03d['or'](_0x08dd('0x8a'),_0x46b178+'%')['or'](_0x08dd('0x8b'),_0x46b178+'%');}else{_0x53e03d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x08dd('0x69')](_0x46b178))['or'](_0x08dd('0x8c'),_0x46b178+'%');}}}_0x2c2d89[_0x08dd('0x4b')](_0x53e03d);_0x2c2d89[_0x08dd('0x8d')](_0x08dd('0x8e'));var _0x1b6598={'type':db[_0x08dd('0x8f')]['QueryTypes'][_0x08dd('0x90')],'raw':!![]};var _0x55b5e9=_0x2c2d89[_0x08dd('0x91')]();_0x55b5e9[_0x08dd('0x4e')](_0x08dd('0x8e'));_0x55b5e9[_0x08dd('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x4ce803['order']){_0x4ce803[_0x08dd('0x49')][_0x08dd('0x36')](function(_0x213017){var _0xf999f9=_0x213017[0x0]===_0x08dd('0x92')?_0x213017[0x0]:'i.'+_0x213017[0x0];_0x2c2d89[_0x08dd('0x49')](_0xf999f9,_0x213017[0x1]===_0x08dd('0x93')?![]:!![]);});}if(!_[_0x08dd('0x77')](_0x308393)){_0x2c2d89['having'](_0x1df273);_0x55b5e9[_0x08dd('0x4b')](_0x08dd('0x94'),_0x308393);}BPromise[_0x08dd('0x95')]()['then'](function(){if(!_0x2c0a90){if(_0x1c0422['query']['SmsAccountId']||_0x1c0422['query'][_0x08dd('0x96')])return;_0x55b5e9['where'](_0x08dd('0x97'));_0x2c2d89['where'](_0x08dd('0x97'));return;}if(_0x1c0422[_0x08dd('0x98')]['role']!==_0x08dd('0x99'))return;return _0x1c0422['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x08dd('0x2e')](function(_0x587dd5){if(_['isEmpty'](_0x587dd5)){_0x55b5e9[_0x08dd('0x4b')](_0x08dd('0x9a'));_0x2c2d89['where'](_0x08dd('0x9a'));}else{_0x55b5e9[_0x08dd('0x4b')](_0x08dd('0x79'),_[_0x08dd('0x39')](_0x587dd5,'id'));_0x2c2d89[_0x08dd('0x4b')](_0x08dd('0x79'),_['map'](_0x587dd5,'id'));}});})[_0x08dd('0x2e')](function(){if(_0x1c0422['user'][_0x08dd('0x9b')]==='agent'&&!_0x2c0a90&&!_0x1c0422['query'][_0x08dd('0x78')])return[];return db[_0x08dd('0x9c')][_0x08dd('0x40')](_0x55b5e9[_0x08dd('0x9d')](),_0x1b6598);})[_0x08dd('0x2e')](function(_0x3f8179){_0x51b71f[_0x08dd('0x24')]=_0x3f8179[_0x08dd('0x46')];if(_0x51b71f[_0x08dd('0x24')]===0x0)return[];return db[_0x08dd('0x9c')]['query'](_0x319eea[_0x08dd('0x9d')](),_0x1b6598)['then'](function(_0x42b05e){_0x410a9f=_[_0x08dd('0x9e')](_0x42b05e,'id');_0x1b6598=_['merge'](_0x1b6598,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c0422['query'][_0x08dd('0x45')]){_0x4ce803[_0x08dd('0x43')]['forEach'](function(_0x400607){_0x2c2d89[_0x08dd('0x4e')]('i.'+_0x400607);});}else{_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0x9f'),_0x08dd('0x62'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa0'),'Account.key');_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa1'),'Account.mandatoryDisposition');_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa2'),'contactName');_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa3'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa4'),_0x08dd('0xa5'));_0x2c2d89[_0x08dd('0x4e')]('c.lastName',_0x08dd('0xa6'));_0x2c2d89[_0x08dd('0x4e')]('c.email',_0x08dd('0xa7'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa8'),'Contact.phone');_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa9'),_0x08dd('0xaa'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xab'),_0x08dd('0xac'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xad'),_0x08dd('0xae'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xaf'),_0x08dd('0xb0'));_0x2c2d89[_0x08dd('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4ce803[_0x08dd('0x26')])_0x2c2d89[_0x08dd('0x26')](_0x4ce803[_0x08dd('0x26')]);if(_0x4ce803[_0x08dd('0x25')])_0x2c2d89[_0x08dd('0x25')](_0x4ce803[_0x08dd('0x25')]);return db['sequelize'][_0x08dd('0x40')](_0x2c2d89[_0x08dd('0x9d')](),_0x1b6598);})[_0x08dd('0x2e')](function(_0x5bfceb){_0x1df771[_0x08dd('0x4b')](_0x08dd('0xb1'),_[_0x08dd('0x39')](_0x5bfceb,'id'));return db[_0x08dd('0x9c')][_0x08dd('0x40')](_0x1df771[_0x08dd('0x9d')](),_0x1b6598)[_0x08dd('0x2e')](function(_0x34b35c){var _0x1a76e3=_['groupBy'](_0x34b35c,_0x08dd('0xb2'));var _0x52ac88=[];_0x5bfceb[_0x08dd('0x36')](function(_0x1a8a8a){_0x52ac88[_0x08dd('0x37')](updateSmsInteraction(_0x1a8a8a,_0x410a9f,_0x1a76e3));});return BPromise[_0x08dd('0xb3')](_0x52ac88);});});})[_0x08dd('0x2e')](function(_0x54d86e){_0x51b71f['rows']=_0x54d86e;return _0x51b71f;})[_0x08dd('0x2e')](respondWithFilteredResult(_0x31dae2,_0x4ce803))['catch'](handleError(_0x31dae2,null));};exports[_0x08dd('0xb4')]=function(_0x684b2d,_0x44a784){var _0x2a0f1b={'raw':![],'where':{'id':_0x684b2d[_0x08dd('0xb5')]['id']}},_0x2c6dfa={};_0x2c6dfa[_0x08dd('0x3f')]=_[_0x08dd('0x41')](db[_0x08dd('0x3a')][_0x08dd('0x3b')]);_0x2c6dfa[_0x08dd('0x40')]=_[_0x08dd('0x41')](_0x684b2d[_0x08dd('0x40')]);_0x2c6dfa[_0x08dd('0x42')]=_[_0x08dd('0x44')](_0x2c6dfa['model'],_0x2c6dfa[_0x08dd('0x40')]);_0x2a0f1b[_0x08dd('0x43')]=_[_0x08dd('0x44')](_0x2c6dfa[_0x08dd('0x3f')],qs['fields'](_0x684b2d[_0x08dd('0x40')][_0x08dd('0x45')]));_0x2a0f1b[_0x08dd('0x43')]=_0x2a0f1b[_0x08dd('0x43')][_0x08dd('0x46')]?_0x2a0f1b[_0x08dd('0x43')]:_0x2c6dfa['model'];if(_0x684b2d['query'][_0x08dd('0xb6')]){_0x2a0f1b[_0x08dd('0xb7')]=[{'all':!![]}];}_0x2a0f1b=_[_0x08dd('0xb8')]({},_0x2a0f1b,_0x684b2d[_0x08dd('0xb9')]);return db[_0x08dd('0x3a')]['find'](_0x2a0f1b)[_0x08dd('0x2e')](handleEntityNotFound(_0x44a784,null))['then'](respondWithResult(_0x44a784,null))[_0x08dd('0x38')](handleError(_0x44a784,null));};exports[_0x08dd('0xba')]=function(_0x1212d6,_0x5ab7ce){return db[_0x08dd('0x3a')]['create'](_0x1212d6[_0x08dd('0x74')],{})[_0x08dd('0x2e')](respondWithResult(_0x5ab7ce,0xc9))['catch'](handleError(_0x5ab7ce,null));};exports['update']=function(_0x17bc7a,_0x4c1db8){if(_0x17bc7a[_0x08dd('0x74')]['id']){delete _0x17bc7a[_0x08dd('0x74')]['id'];}return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x17bc7a[_0x08dd('0xb5')]['id']}})[_0x08dd('0x2e')](handleEntityNotFound(_0x4c1db8,null))[_0x08dd('0x2e')](saveUpdates(_0x17bc7a[_0x08dd('0x74')],null))[_0x08dd('0x2e')](respondWithResult(_0x4c1db8,null))[_0x08dd('0x38')](handleError(_0x4c1db8,null));};exports[_0x08dd('0x2d')]=function(_0x33d565,_0x1d0de7){return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x33d565[_0x08dd('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1d0de7,null))[_0x08dd('0x2e')](removeEntity(_0x1d0de7,null))[_0x08dd('0x38')](handleError(_0x1d0de7,null));};exports[_0x08dd('0xbb')]=function(_0x53151b,_0x4e84c1){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x4e84c1,null))['catch'](handleError(_0x4e84c1,null));};exports[_0x08dd('0xbc')]=function(_0x23fae1,_0xee4e16,_0x902d4b){return db[_0x08dd('0xbd')]['find']({'where':{'id':_0x23fae1[_0x08dd('0xb5')]['id']}})['then'](handleEntityNotFound(_0xee4e16,null))[_0x08dd('0x2e')](function(_0x524bf2){if(_0x524bf2){return _0x524bf2[_0x08dd('0xbc')](_0x23fae1[_0x08dd('0x74')][_0x08dd('0xbe')],_[_0x08dd('0xbf')](_0x23fae1[_0x08dd('0x74')],[_0x08dd('0xbe'),'id'])||{});}})[_0x08dd('0x2e')](respondWithResult(_0xee4e16,null))[_0x08dd('0x38')](handleError(_0xee4e16,null));};exports[_0x08dd('0xc0')]=function(_0xfe5668,_0x5abba0,_0x1f4914){var _0x5ee349={'raw':![],'where':{}};var _0x2468b6={};var _0x39ec12={'count':0x0,'rows':[]};return db[_0x08dd('0x3a')][_0x08dd('0xc1')]({'where':{'id':_0xfe5668[_0x08dd('0xb5')]['id']}})['then'](handleEntityNotFound(_0x5abba0,null))[_0x08dd('0x2e')](function(_0x5d2fea){if(_0x5d2fea){_0x2468b6[_0x08dd('0x3f')]=_[_0x08dd('0x41')](db[_0x08dd('0xbd')][_0x08dd('0x3b')]);_0x2468b6[_0x08dd('0x40')]=_['keys'](_0xfe5668[_0x08dd('0x40')]);_0x2468b6[_0x08dd('0x42')]=_[_0x08dd('0x44')](_0x2468b6['model'],_0x2468b6[_0x08dd('0x40')]);_0x5ee349[_0x08dd('0x43')]=_[_0x08dd('0x44')](_0x2468b6['model'],qs[_0x08dd('0x45')](_0xfe5668[_0x08dd('0x40')]['fields']));_0x5ee349[_0x08dd('0x43')]=_0x5ee349['attributes'][_0x08dd('0x46')]?_0x5ee349['attributes']:_0x2468b6[_0x08dd('0x3f')];if(!_0xfe5668[_0x08dd('0x40')][_0x08dd('0x47')](_0x08dd('0x48'))){_0x5ee349['limit']=qs[_0x08dd('0x26')](_0xfe5668[_0x08dd('0x40')][_0x08dd('0x26')]);_0x5ee349[_0x08dd('0x25')]=qs[_0x08dd('0x25')](_0xfe5668['query'][_0x08dd('0x25')]);}_0x5ee349[_0x08dd('0x49')]=qs['sort'](_0xfe5668[_0x08dd('0x40')][_0x08dd('0x4a')]);_0x5ee349[_0x08dd('0x4b')]=qs[_0x08dd('0x42')](_[_0x08dd('0x4c')](_0xfe5668[_0x08dd('0x40')],_0x2468b6[_0x08dd('0x42')]));_0x5ee349[_0x08dd('0x4b')]['SmsInteractionId']=_0x5d2fea['id'];if(_0xfe5668[_0x08dd('0x40')][_0x08dd('0x87')]){_0x5ee349[_0x08dd('0x4b')]=_['merge'](_0x5ee349[_0x08dd('0x4b')],{'$or':_[_0x08dd('0x39')](_0x5ee349[_0x08dd('0x43')],function(_0x2785be){var _0x17066c={};_0x17066c[_0x2785be]={'$like':'%'+_0xfe5668[_0x08dd('0x40')][_0x08dd('0x87')]+'%'};return _0x17066c;})});}if(_0xfe5668[_0x08dd('0x40')]['$gte']){var _0x526873=_0xfe5668[_0x08dd('0x40')][_0x08dd('0x7c')][_0x08dd('0x67')](',');var _0x36b942={};_0x36b942[_0x526873[0x0]]={'$gte':moment(_0x526873[0x1])['format'](_0x08dd('0xc2'))};_0x5ee349[_0x08dd('0x4b')]=_[_0x08dd('0xb8')](_0x5ee349[_0x08dd('0x4b')],_0x36b942);}_0x5ee349=_[_0x08dd('0xb8')]({},_0x5ee349,_0xfe5668['options']);return db[_0x08dd('0xbd')]['count']({'where':_0x5ee349[_0x08dd('0x4b')]})[_0x08dd('0x2e')](function(_0xc1be91){_0x39ec12[_0x08dd('0x24')]=_0xc1be91;if(_0xfe5668[_0x08dd('0x40')][_0x08dd('0xb6')]){_0x5ee349['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x5ee349);})[_0x08dd('0x2e')](function(_0x3739f5){_0x39ec12[_0x08dd('0xc3')]=_0x3739f5;return _0x39ec12;});}})[_0x08dd('0x2e')](respondWithFilteredResult(_0x5abba0,_0x5ee349))[_0x08dd('0x38')](handleError(_0x5abba0,null));};exports['addTags']=function(_0x700265,_0x307a45,_0x55dd5c){return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x700265[_0x08dd('0xb5')]['id']}})[_0x08dd('0x2e')](handleEntityNotFound(_0x307a45,null))[_0x08dd('0x2e')](function(_0x1a7f38){if(_0x1a7f38){return _0x1a7f38[_0x08dd('0xc4')](_0x700265[_0x08dd('0x74')][_0x08dd('0xbe')],_['omit'](_0x700265['body'],[_0x08dd('0xbe'),'id'])||{})[_0x08dd('0xc5')](function(){return db[_0x08dd('0x6f')][_0x08dd('0xc6')]({'attributes':['id',_0x08dd('0x30'),_0x08dd('0xc7')],'where':{'id':_0x700265[_0x08dd('0x74')][_0x08dd('0xbe')]}});})['then'](function(_0x22969b){socket[_0x08dd('0xc8')](_0x08dd('0xc9'),{'id':Number(_0x700265[_0x08dd('0xb5')]['id']),'tags':_0x22969b||[]});return{'id':Number(_0x700265['params']['id']),'tags':_0x22969b||[]};});}})[_0x08dd('0x2e')](respondWithResult(_0x307a45,null))[_0x08dd('0x38')](handleError(_0x307a45,null));};exports['removeTags']=function(_0x5753ea,_0x13f48b,_0x438eb9){return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x5753ea[_0x08dd('0xb5')]['id']}})['then'](handleEntityNotFound(_0x13f48b,null))[_0x08dd('0x2e')](function(_0x273541){if(_0x273541){return _0x273541[_0x08dd('0xca')](_0x5753ea['query'][_0x08dd('0xbe')]);}})['then'](respondWithStatusCode(_0x13f48b,null))['catch'](handleError(_0x13f48b,null));};exports['download']=function(_0x4c8559,_0x24f128){var _0x17657e=moment()['unix']()['toString']();var _0x15d8c9=path[_0x08dd('0xcb')](config['root'],_0x08dd('0xcc'),_0x08dd('0xcd'),_0x08dd('0xce'));var _0x1e4f5e=path[_0x08dd('0xcb')](config[_0x08dd('0xcf')],'server',_0x08dd('0xcd'),_0x08dd('0xd0'));var _0x427232=path[_0x08dd('0xcb')](_0x15d8c9,_0x17657e);var _0x535c06=util[_0x08dd('0xd1')](_0x08dd('0xd2'),_0x4c8559[_0x08dd('0xb5')]['id'],_0x17657e);var _0x5bc680=path[_0x08dd('0xcb')](_0x15d8c9,_0x535c06);var _0x508d6b=[];_0x508d6b[_0x08dd('0x37')]({'model':db['User'],'as':_0x08dd('0x71'),'attributes':['id',_0x08dd('0x33')],'raw':!![]});_0x508d6b[_0x08dd('0x37')]({'model':db['CmContact'],'as':_0x08dd('0x66'),'attributes':['id','firstName',_0x08dd('0xd3')],'raw':!![]});var _0x20bb8e=[{'model':db['SmsMessage'],'as':_0x08dd('0xd4'),'attributes':['id',_0x08dd('0x74'),_0x08dd('0x7b'),_0x08dd('0xd5'),_0x08dd('0xd6'),_0x08dd('0x82')],'include':_0x508d6b}];_0x20bb8e[_0x08dd('0x37')]({'model':db['SmsAccount'],'as':_0x08dd('0xd7'),'attributes':['id','name']});_0x20bb8e['push']({'model':db[_0x08dd('0x71')],'as':'Owner','attributes':['id',_0x08dd('0x33')]});return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x4c8559['params']['id']},'include':_0x20bb8e})[_0x08dd('0x2e')](handleEntityNotFound(_0x24f128,null))['then'](function(_0x36ad27){if(_0x36ad27){var _0x207a54=_0x36ad27[_0x08dd('0xd8')]({'plain':!![]});fs[_0x08dd('0xd9')](_0x427232);var _0x4fdf8b={'format':'A4','border':_0x08dd('0xda'),'header':{'height':_0x08dd('0xdb'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x08dd('0xdc'),'contents':{'default':util['format'](_0x08dd('0xdd'),util['format'](_0x08dd('0xde'),'Sms',_0x207a54['id']),moment()['format'](_0x08dd('0xdf'))[_0x08dd('0x9d')]())}}};var _0x4b3522={'channel':_0x08dd('0xe0'),'account':_0x207a54[_0x08dd('0xd7')][_0x08dd('0x30')],'agent':_0x207a54[_0x08dd('0xe1')]?_0x207a54[_0x08dd('0xe1')]['fullname']:'N.A.','createdAt':moment(_0x207a54[_0x08dd('0x7b')])[_0x08dd('0xd1')](_0x08dd('0xc2'))[_0x08dd('0x9d')](),'closedAt':_0x207a54['closed']?moment(_0x207a54['closedAt'])[_0x08dd('0xd1')](_0x08dd('0xc2'))[_0x08dd('0x9d')]():'','disposition':_0x207a54[_0x08dd('0xe2')],'messages':_(_0x207a54[_0x08dd('0xd4')])[_0x08dd('0x87')]({'secret':![]})[_0x08dd('0x39')](function(_0x57378d){return{'date':moment(_0x57378d[_0x08dd('0x7b')])['format'](_0x08dd('0xc2'))[_0x08dd('0x9d')](),'sender':_0x57378d[_0x08dd('0xd5')]===_0x08dd('0xe3')?_0x57378d[_0x08dd('0x71')]?_0x57378d['User'][_0x08dd('0x33')]:_0x08dd('0xe4'):_0x57378d[_0x08dd('0x66')][_0x08dd('0xe5')]+(_0x57378d[_0x08dd('0x66')][_0x08dd('0xd3')]?'\x20'+_0x57378d[_0x08dd('0x66')]['lastName']:''),'body':_0x57378d[_0x08dd('0x74')],'direction':_0x57378d['direction']===_0x08dd('0xe3')?'A':'C','secret':_0x57378d[_0x08dd('0xd6')],'read':_0x57378d[_0x08dd('0x82')]};})['value']()};return ejs['renderFile'](path[_0x08dd('0xcb')](config[_0x08dd('0xcf')],_0x08dd('0xcc'),_0x08dd('0xe6'),_0x08dd('0xe7')),{'interaction':_0x4b3522})['then'](function(_0x120fba){return new BPromise(function(_0x25a65b,_0x46862e){pdf[_0x08dd('0xba')](_0x120fba,_0x4fdf8b)['toFile'](path[_0x08dd('0xcb')](_0x427232,_0x08dd('0xe8')+_0x207a54['id']+'-'+_0x17657e+_0x08dd('0xe9')),function(_0x44d778,_0x3d52f1){if(_0x44d778)return _0x46862e(_0x44d778);_0x25a65b(_0x3d52f1);});});})[_0x08dd('0x2e')](function(){return new BPromise(function(_0x55144b,_0x3b7f1c){zipdir(_0x427232,{'saveTo':_0x5bc680},function(_0x437142,_0x19a4de){if(_0x437142)return _0x3b7f1c(_0x437142);return _0x55144b(_0x19a4de);});})[_0x08dd('0x2e')](function(){return new BPromise(function(_0x27c1d3,_0x1cbfa5){rimraf(_0x427232,function(_0x34d2d7){if(_0x34d2d7)_0x1cbfa5(_0x34d2d7);return _0x27c1d3();});});})['then'](function(){return _0x24f128[_0x08dd('0xea')](_0x5bc680,_0x535c06,function(_0xc8085d){if(_0xc8085d){console['log'](_0x08dd('0xeb'),_0xc8085d);}else{fs[_0x08dd('0xec')](_0x5bc680);}});});});}else{return _0x24f128['sendStatus'](0xc8);}})['catch'](handleError(_0x24f128,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 0ac93ca..4656935 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfe8=['map','findAll','unreadMessages','length','emit','catch','hook','../../mysqldb','SmsMessage','update','remove','then','setDataValue','Users'];(function(_0x3b0090,_0x35de50){var _0x29a46c=function(_0x3eab1f){while(--_0x3eab1f){_0x3b0090['push'](_0x3b0090['shift']());}};_0x29a46c(++_0x35de50);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x4f4c42,_0x4da0f1){_0x4f4c42=_0x4f4c42-0x0;var _0xb3cc24=_0xbfe8[_0x4f4c42];return _0xb3cc24;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x8bfe('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x8bfe('0x0'))['db'][_0x8bfe('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8bfe('0x2'),'afterDestroy':_0x8bfe('0x3')};function emitEvent(_0x57eb53){return function(_0x134227,_0x1deab0,_0x314a9a){_0x134227['getUsers']({'attributes':['id'],'raw':!![]})[_0x8bfe('0x4')](function(_0x1b7dbd){_0x134227[_0x8bfe('0x5')](_0x8bfe('0x6'),_0x1b7dbd[_0x8bfe('0x7')](function(_0x1bb8ca){return{'id':_0x1bb8ca['id']};}));return SmsMessage[_0x8bfe('0x8')]({'where':{'SmsInteractionId':_0x134227['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8bfe('0x4')](function(_0x243a11){_0x134227[_0x8bfe('0x5')](_0x8bfe('0x9'),_0x243a11[_0x8bfe('0xa')]);SmsInteractionEvents[_0x8bfe('0xb')](_0x57eb53+':'+_0x134227['id'],_0x134227);SmsInteractionEvents[_0x8bfe('0xb')](_0x57eb53,_0x134227);_0x314a9a(null);})[_0x8bfe('0xc')](_0x314a9a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x8bfe('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x207c=['then','Users','map','setDataValue','unreadMessages','length','emit','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0x207c,0x1e8));var _0xc207=function(_0x5b26be,_0x24893b){_0x5b26be=_0x5b26be-0x0;var _0x4c02c9=_0x207c[_0x5b26be];return _0x4c02c9;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xc207('0x0'))['db'][_0xc207('0x1')];var SmsMessage=require(_0xc207('0x0'))['db'][_0xc207('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc207('0x3')](0x0);var events={'afterCreate':_0xc207('0x4'),'afterUpdate':_0xc207('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38ff02){return function(_0x59bc89,_0x5a727b,_0x55023e){_0x59bc89[_0xc207('0x6')]({'attributes':['id'],'raw':!![]})[_0xc207('0x7')](function(_0x3395e4){_0x59bc89['setDataValue'](_0xc207('0x8'),_0x3395e4[_0xc207('0x9')](function(_0x3c579f){return{'id':_0x3c579f['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x59bc89['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc207('0x7')](function(_0x817576){_0x59bc89[_0xc207('0xa')](_0xc207('0xb'),_0x817576[_0xc207('0xc')]);SmsInteractionEvents[_0xc207('0xd')](_0x38ff02+':'+_0x59bc89['id'],_0x59bc89);SmsInteractionEvents['emit'](_0x38ff02,_0x59bc89);_0x55023e(null);})['catch'](_0x55023e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc207('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7bbeadc..5b4c14d 100644 --- a/server/api/smsInteraction/smsInteraction.model.js +++ b/server/api/smsInteraction/smsInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd902=['path','rimraf','exports','define','sms_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x587270,_0x9efebd){var _0x38f8ca=function(_0x3d9009){while(--_0x3d9009){_0x587270['push'](_0x587270['shift']());}};_0x38f8ca(++_0x9efebd);}(_0xd902,0xb0));var _0x2d90=function(_0x4da78e,_0x13cb84){_0x4da78e=_0x4da78e-0x0;var _0x4463b1=_0xd902[_0x4da78e];return _0x4463b1;};'use strict';var _=require(_0x2d90('0x0'));var util=require(_0x2d90('0x1'));var logger=require(_0x2d90('0x2'))(_0x2d90('0x3'));var moment=require(_0x2d90('0x4'));var BPromise=require('bluebird');var rp=require(_0x2d90('0x5'));var fs=require('fs');var path=require(_0x2d90('0x6'));var rimraf=require(_0x2d90('0x7'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x2d90('0x8')]=function(_0x32e724,_0xe4088d){return _0x32e724[_0x2d90('0x9')]('SmsInteraction',attributes,{'tableName':_0x2d90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7dcb49,_0x4b4385,_0x4af501){if(_0x7dcb49[_0x2d90('0xb')](_0x2d90('0xc'))){_0x7dcb49['closedAt']=moment()['format'](_0x2d90('0xd'));}_0x4af501(null,_0x7dcb49);}}});}; \ No newline at end of file +var _0xe838=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x489e1c,_0x28fc3e){var _0x491aa7=function(_0x3e4a86){while(--_0x3e4a86){_0x489e1c['push'](_0x489e1c['shift']());}};_0x491aa7(++_0x28fc3e);}(_0xe838,0xfc));var _0x8e83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe838[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8e83('0x0'));var util=require(_0x8e83('0x1'));var logger=require(_0x8e83('0x2'))(_0x8e83('0x3'));var moment=require(_0x8e83('0x4'));var BPromise=require('bluebird');var rp=require(_0x8e83('0x5'));var fs=require('fs');var path=require(_0x8e83('0x6'));var rimraf=require(_0x8e83('0x7'));var config=require(_0x8e83('0x8'));var attributes=require(_0x8e83('0x9'));module[_0x8e83('0xa')]=function(_0x361d8f,_0x278dec){return _0x361d8f[_0x8e83('0xb')](_0x8e83('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43fe91,_0x20d31f,_0x4b9288){if(_0x43fe91[_0x8e83('0xd')](_0x8e83('0xe'))){_0x43fe91[_0x8e83('0xf')]=moment()[_0x8e83('0x10')](_0x8e83('0x11'));}_0x4b9288(null,_0x43fe91);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 44253d4..ce5f6cf 100644 --- a/server/api/smsInteraction/smsInteraction.rpc.js +++ b/server/api/smsInteraction/smsInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb1d=['raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','SmsInteraction','update','options'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xbb1d,0x89));var _0xdbb1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbb1d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xdbb1('0x0'));var util=require(_0xdbb1('0x1'));var moment=require(_0xdbb1('0x2'));var BPromise=require(_0xdbb1('0x3'));var rs=require(_0xdbb1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdbb1('0x5'));var logger=require(_0xdbb1('0x6'))(_0xdbb1('0x7'));var config=require(_0xdbb1('0x8'));var jayson=require(_0xdbb1('0x9'));var client=jayson[_0xdbb1('0xa')]['http']({'port':0x232a});config['redis']=_[_0xdbb1('0xb')](config[_0xdbb1('0xc')],{'host':_0xdbb1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbb1('0xc')]));require(_0xdbb1('0xe'))[_0xdbb1('0xf')](socket);function respondWithRpcPromise(_0x40cf41,_0x4017ec,_0x5d5a70){return new BPromise(function(_0xd23ca8,_0x5a5c78){return client[_0xdbb1('0x10')](_0x40cf41,_0x5d5a70)[_0xdbb1('0x11')](function(_0xb2c23f){logger[_0xdbb1('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x4017ec,_0xdbb1('0x13'));logger[_0xdbb1('0x14')](_0xdbb1('0x15'),_0x4017ec,_0xdbb1('0x13'),JSON[_0xdbb1('0x16')](_0xb2c23f));if(_0xb2c23f[_0xdbb1('0x17')]){if(_0xb2c23f[_0xdbb1('0x17')][_0xdbb1('0x18')]===0x1f4){logger['error'](_0xdbb1('0x19'),_0x4017ec,_0xb2c23f[_0xdbb1('0x17')][_0xdbb1('0x1a')]);return _0x5a5c78(_0xb2c23f['error']['message']);}logger[_0xdbb1('0x17')](_0xdbb1('0x19'),_0x4017ec,_0xb2c23f[_0xdbb1('0x17')][_0xdbb1('0x1a')]);return _0xd23ca8(_0xb2c23f['error'][_0xdbb1('0x1a')]);}else{logger[_0xdbb1('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x4017ec,_0xdbb1('0x13'));_0xd23ca8(_0xb2c23f['result'][_0xdbb1('0x1a')]);}})[_0xdbb1('0x1b')](function(_0x3a6cb9){logger['error'](_0xdbb1('0x19'),_0x4017ec,_0x3a6cb9);_0x5a5c78(_0x3a6cb9);});});}exports['UpdateSmsInteraction']=function(_0xb38bbc){var _0x318503=this;return new Promise(function(_0x4f9a71,_0x395778){return db[_0xdbb1('0x1c')][_0xdbb1('0x1d')](_0xb38bbc['body'],{'raw':_0xb38bbc[_0xdbb1('0x1e')]?_0xb38bbc[_0xdbb1('0x1e')][_0xdbb1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb38bbc[_0xdbb1('0x1e')]?_0xb38bbc[_0xdbb1('0x1e')][_0xdbb1('0x20')]||null:null,'attributes':_0xb38bbc['options']?_0xb38bbc[_0xdbb1('0x1e')][_0xdbb1('0x21')]||null:null,'limit':_0xb38bbc[_0xdbb1('0x1e')]?_0xb38bbc['options'][_0xdbb1('0x22')]||null:null})[_0xdbb1('0x11')](function(_0x4fc48b){logger[_0xdbb1('0x12')]('UpdateSmsInteraction',_0xb38bbc);logger[_0xdbb1('0x14')](_0xdbb1('0x23'),_0xb38bbc,JSON[_0xdbb1('0x16')](_0x4fc48b));_0x4f9a71(_0x4fc48b);})[_0xdbb1('0x1b')](function(_0x51401d){logger[_0xdbb1('0x17')](_0xdbb1('0x23'),_0x51401d['message'],_0xb38bbc);_0x395778(_0x318503[_0xdbb1('0x17')](0x1f4,_0x51401d['message']));});});};exports[_0xdbb1('0x24')]=function(_0x3cce04){return new Promise(function(_0x225180,_0x2847f9){return db[_0xdbb1('0x1c')]['find']({'where':_0x3cce04[_0xdbb1('0x1e')]?_0x3cce04['options'][_0xdbb1('0x20')]||null:null})['then'](function(_0x59266f){if(_0x59266f){return _0x59266f[_0xdbb1('0x25')](_0x3cce04[_0xdbb1('0x26')]['ids'],_['omit'](_0x3cce04[_0xdbb1('0x26')],[_0xdbb1('0x27'),'id'])||{});}})[_0xdbb1('0x28')](function(_0x177493){logger[_0xdbb1('0x12')](_0xdbb1('0x29'),_0x3cce04);logger[_0xdbb1('0x14')]('AddTags',_0x3cce04,JSON['stringify'](_0x177493));_0x225180(_0x177493);})[_0xdbb1('0x1b')](function(_0x259f33){logger[_0xdbb1('0x17')](_0xdbb1('0x29'),_0x259f33[_0xdbb1('0x1a')],_0x3cce04);_0x2847f9(_this[_0xdbb1('0x17')](0x1f4,_0x259f33[_0xdbb1('0x1a')]));});});}; \ No newline at end of file +var _0x6c1e=['result','catch','UpdateSmsInteraction','update','body','options','raw','where','find','addTags','ids','omit','spread','debug','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1b3470,_0x3fadda){var _0x2f54cb=function(_0x3c8028){while(--_0x3c8028){_0x1b3470['push'](_0x1b3470['shift']());}};_0x2f54cb(++_0x3fadda);}(_0x6c1e,0x1bf));var _0xe6c1=function(_0x15ece6,_0x51a965){_0x15ece6=_0x15ece6-0x0;var _0x3dc05c=_0x6c1e[_0x15ece6];return _0x3dc05c;};'use strict';var _=require(_0xe6c1('0x0'));var util=require(_0xe6c1('0x1'));var moment=require('moment');var BPromise=require(_0xe6c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6c1('0x3'));var db=require(_0xe6c1('0x4'))['db'];var utils=require(_0xe6c1('0x5'));var logger=require('../../config/logger')(_0xe6c1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe6c1('0x7')][_0xe6c1('0x8')]({'port':0x232a});config[_0xe6c1('0x9')]=_[_0xe6c1('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6c1('0x9')]));require('./smsInteraction.socket')[_0xe6c1('0xb')](socket);function respondWithRpcPromise(_0x4a4a10,_0x15b78c,_0x41f90c){return new BPromise(function(_0x2c4de4,_0x1a1aa2){return client['request'](_0x4a4a10,_0x41f90c)[_0xe6c1('0xc')](function(_0x1d7a11){logger['info'](_0xe6c1('0xd'),_0x15b78c,_0xe6c1('0xe'));logger['debug'](_0xe6c1('0xf'),_0x15b78c,_0xe6c1('0xe'),JSON[_0xe6c1('0x10')](_0x1d7a11));if(_0x1d7a11['error']){if(_0x1d7a11[_0xe6c1('0x11')][_0xe6c1('0x12')]===0x1f4){logger[_0xe6c1('0x11')](_0xe6c1('0xd'),_0x15b78c,_0x1d7a11[_0xe6c1('0x11')][_0xe6c1('0x13')]);return _0x1a1aa2(_0x1d7a11[_0xe6c1('0x11')][_0xe6c1('0x13')]);}logger[_0xe6c1('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x15b78c,_0x1d7a11['error'][_0xe6c1('0x13')]);return _0x2c4de4(_0x1d7a11['error'][_0xe6c1('0x13')]);}else{logger[_0xe6c1('0x14')](_0xe6c1('0xd'),_0x15b78c,'request\x20sent');_0x2c4de4(_0x1d7a11[_0xe6c1('0x15')]['message']);}})[_0xe6c1('0x16')](function(_0x20723a){logger[_0xe6c1('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x15b78c,_0x20723a);_0x1a1aa2(_0x20723a);});});}exports[_0xe6c1('0x17')]=function(_0x128f78){var _0x2772b0=this;return new Promise(function(_0x59bc9b,_0xe87a7d){return db['SmsInteraction'][_0xe6c1('0x18')](_0x128f78[_0xe6c1('0x19')],{'raw':_0x128f78[_0xe6c1('0x1a')]?_0x128f78[_0xe6c1('0x1a')][_0xe6c1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x128f78[_0xe6c1('0x1a')]?_0x128f78['options'][_0xe6c1('0x1c')]||null:null,'attributes':_0x128f78['options']?_0x128f78[_0xe6c1('0x1a')]['attributes']||null:null,'limit':_0x128f78[_0xe6c1('0x1a')]?_0x128f78[_0xe6c1('0x1a')]['limit']||null:null})[_0xe6c1('0xc')](function(_0xc1783e){logger[_0xe6c1('0x14')](_0xe6c1('0x17'),_0x128f78);logger['debug'](_0xe6c1('0x17'),_0x128f78,JSON[_0xe6c1('0x10')](_0xc1783e));_0x59bc9b(_0xc1783e);})['catch'](function(_0x571757){logger[_0xe6c1('0x11')](_0xe6c1('0x17'),_0x571757['message'],_0x128f78);_0xe87a7d(_0x2772b0[_0xe6c1('0x11')](0x1f4,_0x571757[_0xe6c1('0x13')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1788ad){return new Promise(function(_0x8e412f,_0x7647d3){return db['SmsInteraction'][_0xe6c1('0x1d')]({'where':_0x1788ad['options']?_0x1788ad[_0xe6c1('0x1a')][_0xe6c1('0x1c')]||null:null})[_0xe6c1('0xc')](function(_0x4eac78){if(_0x4eac78){return _0x4eac78[_0xe6c1('0x1e')](_0x1788ad[_0xe6c1('0x19')][_0xe6c1('0x1f')],_[_0xe6c1('0x20')](_0x1788ad[_0xe6c1('0x19')],['ids','id'])||{});}})[_0xe6c1('0x21')](function(_0x4367fc){logger[_0xe6c1('0x14')]('AddTags',_0x1788ad);logger[_0xe6c1('0x22')](_0xe6c1('0x23'),_0x1788ad,JSON['stringify'](_0x4367fc));_0x8e412f(_0x4367fc);})[_0xe6c1('0x16')](function(_0x7b6357){logger[_0xe6c1('0x11')](_0xe6c1('0x23'),_0x7b6357[_0xe6c1('0x13')],_0x1788ad);_0x7647d3(_this[_0xe6c1('0x11')](0x1f4,_0x7b6357[_0xe6c1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 69e3126..f285b6e 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x4faf85,_0x537fae){var _0x685275=function(_0x3996b8){while(--_0x3996b8){_0x4faf85['push'](_0x4faf85['shift']());}};_0x685275(++_0x537fae);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file +var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x4809b0,_0xcedc2b){var _0x244cd5=function(_0x17425e){while(--_0x17425e){_0x4809b0['push'](_0x4809b0['shift']());}};_0x244cd5(++_0xcedc2b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb7e7[_0x297fd3];return _0x2af381;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 79a5da0..fde1a88 100644 --- a/server/api/smsMessage/index.js +++ b/server/api/smsMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07e9=['describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./smsMessage.controller','isAuthenticated','get','/describe'];(function(_0xe1650a,_0x112d11){var _0x77bcec=function(_0x4da7f6){while(--_0x4da7f6){_0xe1650a['push'](_0xe1650a['shift']());}};_0x77bcec(++_0x112d11);}(_0x07e9,0x1ee));var _0x907e=function(_0x3a55d0,_0x4bc35c){_0x3a55d0=_0x3a55d0-0x0;var _0xb8c328=_0x07e9[_0x3a55d0];return _0xb8c328;};'use strict';var multer=require(_0x907e('0x0'));var util=require(_0x907e('0x1'));var path=require(_0x907e('0x2'));var timeout=require(_0x907e('0x3'));var express=require(_0x907e('0x4'));var router=express['Router']();var auth=require(_0x907e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x907e('0x6'));router['get']('/',auth[_0x907e('0x7')](),controller['index']);router[_0x907e('0x8')](_0x907e('0x9'),auth['isAuthenticated'](),controller[_0x907e('0xa')]);router['get'](_0x907e('0xb'),auth[_0x907e('0x7')](),controller[_0x907e('0xc')]);router['post']('/',auth[_0x907e('0x7')](),interaction[_0x907e('0xd')](_0x907e('0xe'),_0x907e('0xf')),controller[_0x907e('0x10')]);router[_0x907e('0x11')](_0x907e('0x12'),controller[_0x907e('0x13')]);router['put']('/:id',auth[_0x907e('0x7')](),controller[_0x907e('0x14')]);router[_0x907e('0x15')](_0x907e('0x16'),auth[_0x907e('0x7')](),controller[_0x907e('0x17')]);router[_0x907e('0x15')](_0x907e('0x18'),auth[_0x907e('0x7')](),controller['reject']);router[_0x907e('0x19')](_0x907e('0xb'),auth[_0x907e('0x7')](),controller[_0x907e('0x1a')]);module[_0x907e('0x1b')]=router; \ No newline at end of file +var _0xd2b7=['index','isAuthenticated','describe','/:id','tracked','create','/:id/status','status','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0xcd07c,_0x8f566c){var _0xb99e27=function(_0x2d19d2){while(--_0x2d19d2){_0xcd07c['push'](_0xcd07c['shift']());}};_0xb99e27(++_0x8f566c);}(_0xd2b7,0x184));var _0x7d2b=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xd2b7[_0x257495];return _0x3849aa;};'use strict';var multer=require(_0x7d2b('0x0'));var util=require(_0x7d2b('0x1'));var path=require(_0x7d2b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x7d2b('0x3'));var interaction=require(_0x7d2b('0x4'));var config=require(_0x7d2b('0x5'));var controller=require(_0x7d2b('0x6'));router[_0x7d2b('0x7')]('/',auth['isAuthenticated'](),controller[_0x7d2b('0x8')]);router[_0x7d2b('0x7')]('/describe',auth[_0x7d2b('0x9')](),controller[_0x7d2b('0xa')]);router[_0x7d2b('0x7')](_0x7d2b('0xb'),auth[_0x7d2b('0x9')](),controller['show']);router['post']('/',auth[_0x7d2b('0x9')](),interaction[_0x7d2b('0xc')]('sms','smsmessage:create'),controller[_0x7d2b('0xd')]);router['post'](_0x7d2b('0xe'),controller[_0x7d2b('0xf')]);router['put'](_0x7d2b('0xb'),auth[_0x7d2b('0x9')](),controller[_0x7d2b('0x10')]);router['put'](_0x7d2b('0x11'),auth['isAuthenticated'](),controller[_0x7d2b('0x12')]);router['put']('/:id/reject',auth[_0x7d2b('0x9')](),controller[_0x7d2b('0x13')]);router['delete'](_0x7d2b('0xb'),auth['isAuthenticated'](),controller[_0x7d2b('0x14')]);module[_0x7d2b('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index c53a169..db576b7 100644 --- a/server/api/smsMessage/smsMessage.attributes.js +++ b/server/api/smsMessage/smsMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89bc=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x3ef474,_0x5f1402){var _0x3583e4=function(_0x2e67d5){while(--_0x2e67d5){_0x3ef474['push'](_0x3ef474['shift']());}};_0x3583e4(++_0x5f1402);}(_0x89bc,0xee));var _0xc89b=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0x89bc[_0x1aa049];return _0x357f29;};'use strict';var Sequelize=require(_0xc89b('0x0'));module[_0xc89b('0x1')]={'body':{'type':Sequelize[_0xc89b('0x2')](_0xc89b('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc89b('0x4')]('in',_0xc89b('0x5')),'defaultValue':_0xc89b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc89b('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc89b('0x6')]},'readAt':{'type':Sequelize[_0xc89b('0x7')]},'secret':{'type':Sequelize[_0xc89b('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc89b('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x94ee=['out','DATE','sequelize','TEXT','medium','ENUM'];(function(_0x1d0343,_0x472470){var _0xeba613=function(_0x241b24){while(--_0x241b24){_0x1d0343['push'](_0x1d0343['shift']());}};_0xeba613(++_0x472470);}(_0x94ee,0x152));var _0xe94e=function(_0x410fc6,_0x99dadd){_0x410fc6=_0x410fc6-0x0;var _0x4d79c0=_0x94ee[_0x410fc6];return _0x4d79c0;};'use strict';var Sequelize=require(_0xe94e('0x0'));module['exports']={'body':{'type':Sequelize[_0xe94e('0x1')](_0xe94e('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe94e('0x3')]('in',_0xe94e('0x4')),'defaultValue':_0xe94e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xe94e('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe94e('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9ae81c8..d2a3146 100644 --- a/server/api/smsMessage/smsMessage.controller.js +++ b/server/api/smsMessage/smsMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6218=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','fields','length','create','body','params','find','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','inspect','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1564da,_0x434395){var _0x3bc014=function(_0x520e9b){while(--_0x520e9b){_0x1564da['push'](_0x1564da['shift']());}};_0x3bc014(++_0x434395);}(_0x6218,0x78));var _0x8621=function(_0x2072f4,_0x1f2f7e){_0x2072f4=_0x2072f4-0x0;var _0x330448=_0x6218[_0x2072f4];return _0x330448;};'use strict';var pdf=require(_0x8621('0x0'));var emlformat=require(_0x8621('0x1'));var rimraf=require(_0x8621('0x2'));var zipdir=require(_0x8621('0x3'));var jsonpatch=require(_0x8621('0x4'));var rp=require('request-promise');var moment=require(_0x8621('0x5'));var BPromise=require(_0x8621('0x6'));var Mustache=require(_0x8621('0x7'));var util=require(_0x8621('0x8'));var path=require(_0x8621('0x9'));var sox=require('sox');var csv=require(_0x8621('0xa'));var ejs=require(_0x8621('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8621('0xc'));var jsforce=require(_0x8621('0xd'));var deskjs=require(_0x8621('0xe'));var toCsv=require(_0x8621('0xa'));var querystring=require(_0x8621('0xf'));var Papa=require(_0x8621('0x10'));var Redis=require(_0x8621('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8621('0x12'));var as=require(_0x8621('0x13'));var hardwareService=require(_0x8621('0x14'));var logger=require(_0x8621('0x15'))(_0x8621('0x16'));var utils=require(_0x8621('0x17'));var config=require(_0x8621('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8621('0x19'))['db'];config['redis']=_[_0x8621('0x1a')](config[_0x8621('0x1b')],{'host':_0x8621('0x1c'),'port':0x18eb});var socket=require(_0x8621('0x1d'))(new Redis(config[_0x8621('0x1b')]));require(_0x8621('0x1e'))[_0x8621('0x1f')](socket);var jayson=require(_0x8621('0x20'));var client=jayson[_0x8621('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x8621('0x21')][_0x8621('0x22')]({'port':0x232a});function respondWithRpcPromise(_0xf9a6fc,_0x330b59,_0x5749f6,_0x11262d){return new BPromise(function(_0x545e52,_0x5debe3){var _0x1a068f=_0x11262d||client;return _0x1a068f[_0x8621('0x23')](_0xf9a6fc,_0x5749f6)[_0x8621('0x24')](function(_0x5468da){logger[_0x8621('0x25')](_0x8621('0x26'),_0x330b59,'request\x20sent');logger[_0x8621('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x330b59,_0x8621('0x28'),JSON[_0x8621('0x29')](_0x5468da));if(_0x5468da[_0x8621('0x2a')]){if(_0x5468da[_0x8621('0x2a')][_0x8621('0x2b')]===0x1f4){logger[_0x8621('0x2a')](_0x8621('0x26'),_0x330b59,_0x5468da[_0x8621('0x2a')][_0x8621('0x2c')]);return _0x5debe3(_0x5468da[_0x8621('0x2a')][_0x8621('0x2c')]);}logger[_0x8621('0x2a')](_0x8621('0x26'),_0x330b59,_0x5468da[_0x8621('0x2a')][_0x8621('0x2c')]);return _0x545e52(_0x5468da[_0x8621('0x2a')][_0x8621('0x2c')]);}else{logger[_0x8621('0x25')](_0x8621('0x26'),_0x330b59,_0x8621('0x28'));_0x545e52(_0x5468da['result']['message']);}})[_0x8621('0x2d')](function(_0x53b19a){logger[_0x8621('0x2a')](_0x8621('0x26'),_0x330b59,_0x53b19a);_0x5debe3(_0x53b19a);});});}function respondWithStatusCode(_0x1e66b1,_0x4ee7f7){_0x4ee7f7=_0x4ee7f7||0xcc;return function(_0x24fd57){if(_0x24fd57){return _0x1e66b1[_0x8621('0x2e')](_0x4ee7f7);}return _0x1e66b1[_0x8621('0x2f')](_0x4ee7f7)[_0x8621('0x30')]();};}function respondWithResult(_0x19f306,_0x14c36f){_0x14c36f=_0x14c36f||0xc8;return function(_0x53619c){if(_0x53619c){return _0x19f306[_0x8621('0x2f')](_0x14c36f)['json'](_0x53619c);}};}function respondWithFilteredResult(_0x20e40e,_0x5440f1){return function(_0x3eff4a){if(_0x3eff4a){var _0x7d07d7=_0x3eff4a[_0x8621('0x31')],_0x1f938f=_0x5440f1['offset'],_0x27ffd4=_0x5440f1[_0x8621('0x32')]+_0x5440f1[_0x8621('0x33')],_0x3eb394;if(_0x27ffd4>=_0x7d07d7){_0x27ffd4=_0x7d07d7;_0x3eb394=0xc8;}else{_0x3eb394=0xce;}_0x20e40e[_0x8621('0x2f')](_0x3eb394);return _0x20e40e[_0x8621('0x34')](_0x8621('0x35'),_0x1f938f+'-'+_0x27ffd4+'/'+_0x7d07d7)[_0x8621('0x36')](_0x3eff4a);}return null;};}function patchUpdates(_0x21add4){return function(_0x518152){try{jsonpatch[_0x8621('0x37')](_0x518152,_0x21add4,!![]);}catch(_0x3c9c9f){return BPromise[_0x8621('0x38')](_0x3c9c9f);}return _0x518152[_0x8621('0x39')]();};}function saveUpdates(_0x152ce5,_0x28044a){return function(_0x41f78f){if(_0x41f78f){return _0x41f78f[_0x8621('0x3a')](_0x152ce5)['then'](function(_0x3995f5){return _0x3995f5;});}return null;};}function removeEntity(_0x65a1d1,_0x32850a){return function(_0x53c45a){if(_0x53c45a){return _0x53c45a[_0x8621('0x3b')]()[_0x8621('0x24')](function(){_0x65a1d1[_0x8621('0x2f')](0xcc)[_0x8621('0x30')]();});}};}function handleEntityNotFound(_0x1bd8e0,_0x5159c2){return function(_0x512aca){if(!_0x512aca){_0x1bd8e0[_0x8621('0x2e')](0x194);}return _0x512aca;};}function handleError(_0x578186,_0x1d83a4){_0x1d83a4=_0x1d83a4||0x1f4;return function(_0x1fa495){logger[_0x8621('0x2a')](_0x1fa495[_0x8621('0x3c')]);if(_0x1fa495[_0x8621('0x3d')]){delete _0x1fa495['name'];}_0x578186[_0x8621('0x2f')](_0x1d83a4)[_0x8621('0x3e')](_0x1fa495);};}exports[_0x8621('0x3f')]=function(_0x57b970,_0x32798f){var _0x54c6b1={},_0x38d5c7={},_0xef47f7={'count':0x0,'rows':[]};var _0x65c246=_[_0x8621('0x40')](db[_0x8621('0x41')][_0x8621('0x42')],function(_0x31fefd){return{'name':_0x31fefd[_0x8621('0x43')],'type':_0x31fefd[_0x8621('0x44')][_0x8621('0x45')]};});_0x38d5c7[_0x8621('0x46')]=_[_0x8621('0x40')](_0x65c246,_0x8621('0x3d'));_0x38d5c7[_0x8621('0x47')]=_[_0x8621('0x48')](_0x57b970[_0x8621('0x47')]);_0x38d5c7['filters']=_['intersection'](_0x38d5c7[_0x8621('0x46')],_0x38d5c7[_0x8621('0x47')]);_0x54c6b1[_0x8621('0x49')]=_[_0x8621('0x4a')](_0x38d5c7[_0x8621('0x46')],qs['fields'](_0x57b970[_0x8621('0x47')]['fields']));_0x54c6b1['attributes']=_0x54c6b1[_0x8621('0x49')]['length']?_0x54c6b1['attributes']:_0x38d5c7['model'];if(!_0x57b970[_0x8621('0x47')]['hasOwnProperty'](_0x8621('0x4b'))){_0x54c6b1[_0x8621('0x33')]=qs[_0x8621('0x33')](_0x57b970[_0x8621('0x47')][_0x8621('0x33')]);_0x54c6b1['offset']=qs[_0x8621('0x32')](_0x57b970[_0x8621('0x47')][_0x8621('0x32')]);}_0x54c6b1[_0x8621('0x4c')]=qs[_0x8621('0x4d')](_0x57b970[_0x8621('0x47')][_0x8621('0x4d')]);_0x54c6b1[_0x8621('0x4e')]=qs[_0x8621('0x4f')](_[_0x8621('0x50')](_0x57b970['query'],_0x38d5c7[_0x8621('0x4f')]),_0x65c246);if(_0x57b970['query'][_0x8621('0x51')]){_0x54c6b1['where']=_[_0x8621('0x52')](_0x54c6b1['where'],{'$or':_['map'](_0x65c246,function(_0x2ea9b5){if(_0x2ea9b5[_0x8621('0x44')]!==_0x8621('0x53')){var _0x51ff0c={};_0x51ff0c[_0x2ea9b5[_0x8621('0x3d')]]={'$like':'%'+_0x57b970[_0x8621('0x47')][_0x8621('0x51')]+'%'};return _0x51ff0c;}})});}_0x54c6b1=_[_0x8621('0x52')]({},_0x54c6b1,_0x57b970[_0x8621('0x54')]);var _0x5057b6={'where':_0x54c6b1[_0x8621('0x4e')]};return db['SmsMessage'][_0x8621('0x31')](_0x5057b6)[_0x8621('0x24')](function(_0x2ebd33){_0xef47f7[_0x8621('0x31')]=_0x2ebd33;if(_0x57b970['query'][_0x8621('0x55')]){_0x54c6b1[_0x8621('0x56')]=[{'all':!![]}];}return db[_0x8621('0x41')][_0x8621('0x57')](_0x54c6b1);})[_0x8621('0x24')](function(_0x841963){_0xef47f7[_0x8621('0x58')]=_0x841963;return _0xef47f7;})[_0x8621('0x24')](respondWithFilteredResult(_0x32798f,_0x54c6b1))[_0x8621('0x2d')](handleError(_0x32798f,null));};exports[_0x8621('0x59')]=function(_0x3d4e0b,_0x592f96){var _0x4c3181={'raw':!![],'where':{'id':_0x3d4e0b['params']['id']}},_0x3db10e={};_0x3db10e['model']=_[_0x8621('0x48')](db[_0x8621('0x41')]['rawAttributes']);_0x3db10e[_0x8621('0x47')]=_['keys'](_0x3d4e0b['query']);_0x3db10e['filters']=_[_0x8621('0x4a')](_0x3db10e[_0x8621('0x46')],_0x3db10e['query']);_0x4c3181[_0x8621('0x49')]=_[_0x8621('0x4a')](_0x3db10e['model'],qs['fields'](_0x3d4e0b[_0x8621('0x47')][_0x8621('0x5a')]));_0x4c3181[_0x8621('0x49')]=_0x4c3181['attributes'][_0x8621('0x5b')]?_0x4c3181[_0x8621('0x49')]:_0x3db10e[_0x8621('0x46')];if(_0x3d4e0b[_0x8621('0x47')][_0x8621('0x55')]){_0x4c3181[_0x8621('0x56')]=[{'all':!![]}];}_0x4c3181=_[_0x8621('0x52')]({},_0x4c3181,_0x3d4e0b[_0x8621('0x54')]);return db[_0x8621('0x41')]['find'](_0x4c3181)[_0x8621('0x24')](handleEntityNotFound(_0x592f96,null))[_0x8621('0x24')](respondWithResult(_0x592f96,null))['catch'](handleError(_0x592f96,null));};exports[_0x8621('0x5c')]=function(_0x2c159c,_0x9de967){return db[_0x8621('0x41')][_0x8621('0x5c')](_0x2c159c[_0x8621('0x5d')],{})[_0x8621('0x24')](respondWithResult(_0x9de967,0xc9))[_0x8621('0x2d')](handleError(_0x9de967,null));};exports['update']=function(_0x5d19dc,_0x22cd9b){if(_0x5d19dc[_0x8621('0x5d')]['id']){delete _0x5d19dc[_0x8621('0x5d')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x5d19dc[_0x8621('0x5e')]['id']}})[_0x8621('0x24')](handleEntityNotFound(_0x22cd9b,null))[_0x8621('0x24')](saveUpdates(_0x5d19dc[_0x8621('0x5d')],null))[_0x8621('0x24')](respondWithResult(_0x22cd9b,null))[_0x8621('0x2d')](handleError(_0x22cd9b,null));};exports[_0x8621('0x3b')]=function(_0x538c7b,_0x425b58){return db[_0x8621('0x41')][_0x8621('0x5f')]({'where':{'id':_0x538c7b[_0x8621('0x5e')]['id']}})['then'](handleEntityNotFound(_0x425b58,null))[_0x8621('0x24')](removeEntity(_0x425b58,null))[_0x8621('0x2d')](handleError(_0x425b58,null));};exports[_0x8621('0x60')]=function(_0x5d9cb9,_0x2885ae){return db['SmsMessage'][_0x8621('0x60')]()[_0x8621('0x24')](respondWithResult(_0x2885ae,null))[_0x8621('0x2d')](handleError(_0x2885ae,null));};var interaction_log=require(_0x8621('0x15'))(_0x8621('0x61'));exports[_0x8621('0x62')]=function(_0x9157b0,_0x1d10c0,_0x411e4f){var _0x1af713={'channel':_0x8621('0x63')};if(_0x9157b0[_0x8621('0x5d')]['id']){delete _0x9157b0[_0x8621('0x5d')]['id'];}_0x9157b0[_0x8621('0x5d')][_0x8621('0x64')]=!![];_0x9157b0[_0x8621('0x5d')][_0x8621('0x65')]=moment()['format'](_0x8621('0x66'));_0x9157b0[_0x8621('0x5d')][_0x8621('0x67')]=_0x9157b0[_0x8621('0x5d')]['UserId']||_0x9157b0[_0x8621('0x68')]['id'];return db[_0x8621('0x41')]['find']({'where':{'id':_0x9157b0['params']['id'],'UserId':null},'include':[{'model':db[_0x8621('0x69')],'as':_0x8621('0x6a')}]})['then'](handleEntityNotFound(_0x1d10c0,null))[_0x8621('0x24')](saveUpdates(_0x9157b0['body'],null))[_0x8621('0x24')](function(_0x2df451){if(_0x2df451){_0x1af713[_0x8621('0x2c')]=_0x2df451[_0x8621('0x6b')]({'plain':!![]});return db[_0x8621('0x6c')][_0x8621('0x5f')]({'where':{'id':_0x2df451[_0x8621('0x6d')]}});}return null;})[_0x8621('0x24')](handleEntityNotFound(_0x1d10c0,null))[_0x8621('0x24')](function(_0x28efaf){if(_0x28efaf){return _0x28efaf[_0x8621('0x3a')]({'UserId':_0x9157b0[_0x8621('0x5d')][_0x8621('0x67')],'read1stAt':_[_0x8621('0x6e')](_0x28efaf[_0x8621('0x6f')])?moment()[_0x8621('0x70')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8621('0x24')](function(_0x2e43e4){if(_0x2e43e4){_0x1af713[_0x8621('0x71')]=_0x2e43e4[_0x8621('0x6b')]({'plain':!![]});interaction_log[_0x8621('0x25')](_0x8621('0x72'),_0x9157b0[_0x8621('0x68')]['id'],_0x9157b0[_0x8621('0x68')][_0x8621('0x3d')],_0x9157b0[_0x8621('0x68')][_0x8621('0x73')],_0x1af713['interaction']['id'],_0x9157b0['body']?JSON[_0x8621('0x29')](_0x9157b0[_0x8621('0x5d')]):_0x8621('0x74'));return respondWithRpcPromise(_0x8621('0x75'),'acceptMessage',_0x1af713);}return null;})[_0x8621('0x24')](function(_0x37d611){if(_0x37d611){if(_0x9157b0[_0x8621('0x5d')]['manual']){_0x1af713[_0x8621('0x2c')][_0x8621('0x76')]=util[_0x8621('0x70')](_0x8621('0x77'),_0x9157b0[_0x8621('0x68')][_0x8621('0x3d')]);_0x1af713[_0x8621('0x2c')][_0x8621('0x78')]=_0x1af713[_0x8621('0x78')];_0x1af713['message'][_0x8621('0x79')]=_0x8621('0x62');return respondWithRpcPromise(_0x8621('0x7a'),_0x8621('0x7a'),{'event':_0x8621('0x7b'),'message':_0x1af713[_0x8621('0x2c')]},client9002)['then'](function(){return _0x1af713;});}return _0x1af713;}return null;})[_0x8621('0x24')](respondWithResult(_0x1d10c0,null))['catch'](handleError(_0x1d10c0,null));};var interaction_log=require(_0x8621('0x15'))('sms-interactions');exports[_0x8621('0x38')]=function(_0x99d92d,_0x1c59a7,_0x39cb4d){var _0x802068={'agent':{},'channel':_0x8621('0x63')};if(_0x99d92d['body']['id']){delete _0x99d92d['body']['id'];}_0x99d92d[_0x8621('0x5d')][_0x8621('0x67')]=_0x99d92d[_0x8621('0x5d')][_0x8621('0x67')]||_0x99d92d['user']['id'];_0x802068[_0x8621('0x7c')]['id']=_0x99d92d['body']['UserId'];return db[_0x8621('0x41')]['find']({'where':{'id':_0x99d92d[_0x8621('0x5e')]['id'],'UserId':null}})[_0x8621('0x24')](handleEntityNotFound(_0x1c59a7,null))['then'](function(_0x322dc6){if(_0x322dc6){_0x802068[_0x8621('0x2c')]=_0x322dc6[_0x8621('0x6b')]({'plain':!![]});return db[_0x8621('0x6c')]['find']({'where':{'id':_0x322dc6[_0x8621('0x6d')]}});}return null;})[_0x8621('0x24')](handleEntityNotFound(_0x1c59a7,null))[_0x8621('0x24')](function(_0x991d64){if(_0x991d64){_0x802068['interaction']=_0x991d64[_0x8621('0x6b')]({'plain':!![]});interaction_log['info'](_0x8621('0x7d'),_0x99d92d[_0x8621('0x68')]['id'],_0x99d92d[_0x8621('0x68')][_0x8621('0x3d')],_0x99d92d['user'][_0x8621('0x73')],_0x802068[_0x8621('0x71')]['id'],_0x99d92d[_0x8621('0x5d')]?JSON[_0x8621('0x29')](_0x99d92d[_0x8621('0x5d')]):_0x8621('0x74'));return respondWithRpcPromise(_0x8621('0x7e'),_0x8621('0x7f'),_0x802068);}return null;})[_0x8621('0x24')](function(_0x5cbf69){if(_0x5cbf69){_0x5cbf69['message'][_0x8621('0x76')]=util[_0x8621('0x70')](_0x8621('0x77'),_0x99d92d['user'][_0x8621('0x3d')]);_0x5cbf69['message']['channel']=_0x802068['channel'];_0x5cbf69[_0x8621('0x2c')]['event']=_0x8621('0x38');respondWithRpcPromise(_0x8621('0x7a'),_0x8621('0x7a'),{'event':'rejectmessage','message':_0x5cbf69[_0x8621('0x2c')]},client9002);return _0x802068;}return null;})[_0x8621('0x24')](respondWithResult(_0x1c59a7,null))['catch'](handleError(_0x1c59a7,null));};exports[_0x8621('0x2f')]=function(_0x17b0e7,_0x49e51b,_0x3b64cf){if(_0x17b0e7[_0x8621('0x5d')]['id']){delete _0x17b0e7['body']['id'];}var _0x3bba1a;return db[_0x8621('0x41')][_0x8621('0x5f')]({'where':{'id':_0x17b0e7[_0x8621('0x5e')]['id']}})['then'](handleEntityNotFound(_0x49e51b,null))['then'](function(_0x5664){if(_0x5664){_0x3bba1a=_0x5664;return db[_0x8621('0x80')][_0x8621('0x5f')]({'where':{'id':_0x5664['SmsAccountId']}});}})[_0x8621('0x24')](handleEntityNotFound(_0x49e51b,null))[_0x8621('0x24')](function(_0x7a8a54){if(_0x7a8a54){logger[_0x8621('0x27')](_0x8621('0x81'),_0x8621('0x2f'),_0x8621('0x82'),_0x7a8a54[_0x8621('0x44')],util['inspect'](_0x17b0e7[_0x8621('0x5d')],{'showHidden':![],'depth':null}));switch(_0x7a8a54['type']){case _0x8621('0x83'):if(_0x17b0e7[_0x8621('0x5d')][_0x8621('0x84')]&&_0x17b0e7['body'][_0x8621('0x84')]===_0x3bba1a[_0x8621('0x85')]){return _0x3bba1a[_0x8621('0x3a')]({'read':!![]});}else{logger[_0x8621('0x2a')](_0x8621('0x86'),'status',_0x8621('0x83'),util['inspect'](_0x17b0e7[_0x8621('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8621('0x87'):if(_0x17b0e7[_0x8621('0x5d')][_0x8621('0x88')]&&_0x17b0e7[_0x8621('0x5d')][_0x8621('0x88')]===_0x3bba1a[_0x8621('0x85')]&&_[_0x8621('0x89')]([_0x8621('0x8a'),'delivered'],_0x17b0e7[_0x8621('0x5d')][_0x8621('0x8b')])>=0x0){return _0x3bba1a['update']({'read':!![]});}else{logger[_0x8621('0x2a')](_0x8621('0x86'),_0x8621('0x2f'),_0x8621('0x8c'),util[_0x8621('0x8d')](_0x17b0e7[_0x8621('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8621('0x8e'):var _0x1abe0b=_0x17b0e7[_0x8621('0x5d')]['results'][0x0];if(_0x1abe0b[_0x8621('0x2f')][_0x8621('0x8f')]===_0x8621('0x90')){return _0x3bba1a[_0x8621('0x3a')]({'read':!![]});}else{logger[_0x8621('0x2a')](_0x8621('0x86'),_0x8621('0x2f'),_0x8621('0x8e'),util['inspect'](_0x17b0e7[_0x8621('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x3bba1a;}})[_0x8621('0x24')](respondWithResult(_0x49e51b,null))[_0x8621('0x2d')](handleError(_0x49e51b,null));}; \ No newline at end of file +var _0xb3f6=['CmContact','get','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','SmsMessage','rawAttributes','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','keys','options','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user'];(function(_0x2c80bc,_0x473f91){var _0x11829f=function(_0x319c0a){while(--_0x319c0a){_0x2c80bc['push'](_0x2c80bc['shift']());}};_0x11829f(++_0x473f91);}(_0xb3f6,0x1bb));var _0x6b3f=function(_0x358437,_0x204fae){_0x358437=_0x358437-0x0;var _0x43eca9=_0xb3f6[_0x358437];return _0x43eca9;};'use strict';var pdf=require(_0x6b3f('0x0'));var emlformat=require(_0x6b3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6b3f('0x2'));var jsonpatch=require(_0x6b3f('0x3'));var rp=require(_0x6b3f('0x4'));var moment=require(_0x6b3f('0x5'));var BPromise=require(_0x6b3f('0x6'));var Mustache=require(_0x6b3f('0x7'));var util=require(_0x6b3f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6b3f('0x9'));var ejs=require(_0x6b3f('0xa'));var fs=require('fs');var _=require(_0x6b3f('0xb'));var squel=require('squel');var crypto=require(_0x6b3f('0xc'));var jsforce=require(_0x6b3f('0xd'));var deskjs=require(_0x6b3f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6b3f('0xf'));var Papa=require(_0x6b3f('0x10'));var Redis=require(_0x6b3f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6b3f('0x12'));var as=require(_0x6b3f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b3f('0x14'))(_0x6b3f('0x15'));var utils=require(_0x6b3f('0x16'));var config=require(_0x6b3f('0x17'));var licenseUtil=require(_0x6b3f('0x18'));var db=require('../../mysqldb')['db'];config[_0x6b3f('0x19')]=_[_0x6b3f('0x1a')](config[_0x6b3f('0x19')],{'host':_0x6b3f('0x1b'),'port':0x18eb});var socket=require(_0x6b3f('0x1c'))(new Redis(config[_0x6b3f('0x19')]));require(_0x6b3f('0x1d'))[_0x6b3f('0x1e')](socket);var jayson=require(_0x6b3f('0x1f'));var client=jayson[_0x6b3f('0x20')][_0x6b3f('0x21')]({'port':0x232c});var client9002=jayson[_0x6b3f('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b7ecf,_0x1cf52e,_0x5b403d,_0x9bdba6){return new BPromise(function(_0x58a449,_0x1c45cf){var _0x310397=_0x9bdba6||client;return _0x310397['request'](_0x5b7ecf,_0x5b403d)['then'](function(_0x541ce5){logger[_0x6b3f('0x22')](_0x6b3f('0x23'),_0x1cf52e,_0x6b3f('0x24'));logger[_0x6b3f('0x25')](_0x6b3f('0x26'),_0x1cf52e,'request\x20sent',JSON[_0x6b3f('0x27')](_0x541ce5));if(_0x541ce5[_0x6b3f('0x28')]){if(_0x541ce5[_0x6b3f('0x28')]['code']===0x1f4){logger[_0x6b3f('0x28')](_0x6b3f('0x23'),_0x1cf52e,_0x541ce5[_0x6b3f('0x28')][_0x6b3f('0x29')]);return _0x1c45cf(_0x541ce5['error'][_0x6b3f('0x29')]);}logger[_0x6b3f('0x28')](_0x6b3f('0x23'),_0x1cf52e,_0x541ce5['error']['message']);return _0x58a449(_0x541ce5['error'][_0x6b3f('0x29')]);}else{logger[_0x6b3f('0x22')](_0x6b3f('0x23'),_0x1cf52e,'request\x20sent');_0x58a449(_0x541ce5[_0x6b3f('0x2a')][_0x6b3f('0x29')]);}})[_0x6b3f('0x2b')](function(_0x3b054e){logger['error'](_0x6b3f('0x23'),_0x1cf52e,_0x3b054e);_0x1c45cf(_0x3b054e);});});}function respondWithStatusCode(_0x2751a7,_0x2493ed){_0x2493ed=_0x2493ed||0xcc;return function(_0x3ed6cf){if(_0x3ed6cf){return _0x2751a7[_0x6b3f('0x2c')](_0x2493ed);}return _0x2751a7[_0x6b3f('0x2d')](_0x2493ed)[_0x6b3f('0x2e')]();};}function respondWithResult(_0x27802d,_0x528c8f){_0x528c8f=_0x528c8f||0xc8;return function(_0xb3f12){if(_0xb3f12){return _0x27802d[_0x6b3f('0x2d')](_0x528c8f)[_0x6b3f('0x2f')](_0xb3f12);}};}function respondWithFilteredResult(_0x79aee3,_0x53fe0b){return function(_0x1bc4ed){if(_0x1bc4ed){var _0x5dd165=_0x1bc4ed[_0x6b3f('0x30')],_0x513fa5=_0x53fe0b[_0x6b3f('0x31')],_0x4c656d=_0x53fe0b['offset']+_0x53fe0b[_0x6b3f('0x32')],_0x237663;if(_0x4c656d>=_0x5dd165){_0x4c656d=_0x5dd165;_0x237663=0xc8;}else{_0x237663=0xce;}_0x79aee3[_0x6b3f('0x2d')](_0x237663);return _0x79aee3['set']('Content-Range',_0x513fa5+'-'+_0x4c656d+'/'+_0x5dd165)[_0x6b3f('0x2f')](_0x1bc4ed);}return null;};}function patchUpdates(_0x107a84){return function(_0x3c686e){try{jsonpatch[_0x6b3f('0x33')](_0x3c686e,_0x107a84,!![]);}catch(_0x3a8352){return BPromise[_0x6b3f('0x34')](_0x3a8352);}return _0x3c686e[_0x6b3f('0x35')]();};}function saveUpdates(_0x272c1e,_0x470098){return function(_0x1d615a){if(_0x1d615a){return _0x1d615a[_0x6b3f('0x36')](_0x272c1e)[_0x6b3f('0x37')](function(_0x18245e){return _0x18245e;});}return null;};}function removeEntity(_0x4e26fe,_0x28864a){return function(_0x47e42b){if(_0x47e42b){return _0x47e42b[_0x6b3f('0x38')]()[_0x6b3f('0x37')](function(){_0x4e26fe[_0x6b3f('0x2d')](0xcc)[_0x6b3f('0x2e')]();});}};}function handleEntityNotFound(_0x47a304,_0x51d056){return function(_0x30d6fd){if(!_0x30d6fd){_0x47a304[_0x6b3f('0x2c')](0x194);}return _0x30d6fd;};}function handleError(_0x4d5155,_0x43d6f6){_0x43d6f6=_0x43d6f6||0x1f4;return function(_0x155e6b){logger['error'](_0x155e6b[_0x6b3f('0x39')]);if(_0x155e6b[_0x6b3f('0x3a')]){delete _0x155e6b[_0x6b3f('0x3a')];}_0x4d5155[_0x6b3f('0x2d')](_0x43d6f6)[_0x6b3f('0x3b')](_0x155e6b);};}exports['index']=function(_0x112b98,_0x443b00){var _0xefb908={},_0x18a380={},_0x3ac818={'count':0x0,'rows':[]};var _0x19ea02=_['map'](db[_0x6b3f('0x3c')][_0x6b3f('0x3d')],function(_0x1b3f5c){return{'name':_0x1b3f5c['fieldName'],'type':_0x1b3f5c['type'][_0x6b3f('0x3e')]};});_0x18a380[_0x6b3f('0x3f')]=_[_0x6b3f('0x40')](_0x19ea02,_0x6b3f('0x3a'));_0x18a380[_0x6b3f('0x41')]=_['keys'](_0x112b98[_0x6b3f('0x41')]);_0x18a380[_0x6b3f('0x42')]=_['intersection'](_0x18a380[_0x6b3f('0x3f')],_0x18a380[_0x6b3f('0x41')]);_0xefb908[_0x6b3f('0x43')]=_[_0x6b3f('0x44')](_0x18a380[_0x6b3f('0x3f')],qs[_0x6b3f('0x45')](_0x112b98[_0x6b3f('0x41')][_0x6b3f('0x45')]));_0xefb908[_0x6b3f('0x43')]=_0xefb908[_0x6b3f('0x43')][_0x6b3f('0x46')]?_0xefb908['attributes']:_0x18a380[_0x6b3f('0x3f')];if(!_0x112b98[_0x6b3f('0x41')][_0x6b3f('0x47')](_0x6b3f('0x48'))){_0xefb908[_0x6b3f('0x32')]=qs['limit'](_0x112b98['query'][_0x6b3f('0x32')]);_0xefb908[_0x6b3f('0x31')]=qs[_0x6b3f('0x31')](_0x112b98[_0x6b3f('0x41')]['offset']);}_0xefb908[_0x6b3f('0x49')]=qs[_0x6b3f('0x4a')](_0x112b98[_0x6b3f('0x41')]['sort']);_0xefb908[_0x6b3f('0x4b')]=qs[_0x6b3f('0x42')](_[_0x6b3f('0x4c')](_0x112b98[_0x6b3f('0x41')],_0x18a380[_0x6b3f('0x42')]),_0x19ea02);if(_0x112b98['query'][_0x6b3f('0x4d')]){_0xefb908[_0x6b3f('0x4b')]=_[_0x6b3f('0x4e')](_0xefb908['where'],{'$or':_['map'](_0x19ea02,function(_0x14499e){if(_0x14499e[_0x6b3f('0x4f')]!==_0x6b3f('0x50')){var _0xc65c11={};_0xc65c11[_0x14499e[_0x6b3f('0x3a')]]={'$like':'%'+_0x112b98[_0x6b3f('0x41')][_0x6b3f('0x4d')]+'%'};return _0xc65c11;}})});}_0xefb908=_[_0x6b3f('0x4e')]({},_0xefb908,_0x112b98['options']);var _0x1688ad={'where':_0xefb908[_0x6b3f('0x4b')]};return db[_0x6b3f('0x3c')]['count'](_0x1688ad)['then'](function(_0x5d0fff){_0x3ac818[_0x6b3f('0x30')]=_0x5d0fff;if(_0x112b98['query'][_0x6b3f('0x51')]){_0xefb908[_0x6b3f('0x52')]=[{'all':!![]}];}return db[_0x6b3f('0x3c')][_0x6b3f('0x53')](_0xefb908);})['then'](function(_0x371613){_0x3ac818['rows']=_0x371613;return _0x3ac818;})[_0x6b3f('0x37')](respondWithFilteredResult(_0x443b00,_0xefb908))[_0x6b3f('0x2b')](handleError(_0x443b00,null));};exports[_0x6b3f('0x54')]=function(_0xbc031b,_0x229238){var _0x5dcc15={'raw':!![],'where':{'id':_0xbc031b['params']['id']}},_0x1b0d51={};_0x1b0d51[_0x6b3f('0x3f')]=_[_0x6b3f('0x55')](db[_0x6b3f('0x3c')]['rawAttributes']);_0x1b0d51[_0x6b3f('0x41')]=_[_0x6b3f('0x55')](_0xbc031b['query']);_0x1b0d51[_0x6b3f('0x42')]=_[_0x6b3f('0x44')](_0x1b0d51['model'],_0x1b0d51[_0x6b3f('0x41')]);_0x5dcc15[_0x6b3f('0x43')]=_[_0x6b3f('0x44')](_0x1b0d51[_0x6b3f('0x3f')],qs[_0x6b3f('0x45')](_0xbc031b['query']['fields']));_0x5dcc15[_0x6b3f('0x43')]=_0x5dcc15['attributes'][_0x6b3f('0x46')]?_0x5dcc15[_0x6b3f('0x43')]:_0x1b0d51[_0x6b3f('0x3f')];if(_0xbc031b[_0x6b3f('0x41')][_0x6b3f('0x51')]){_0x5dcc15[_0x6b3f('0x52')]=[{'all':!![]}];}_0x5dcc15=_[_0x6b3f('0x4e')]({},_0x5dcc15,_0xbc031b[_0x6b3f('0x56')]);return db['SmsMessage'][_0x6b3f('0x57')](_0x5dcc15)[_0x6b3f('0x37')](handleEntityNotFound(_0x229238,null))[_0x6b3f('0x37')](respondWithResult(_0x229238,null))[_0x6b3f('0x2b')](handleError(_0x229238,null));};exports[_0x6b3f('0x58')]=function(_0x2c6df5,_0x1028ed){return db[_0x6b3f('0x3c')]['create'](_0x2c6df5['body'],{})['then'](respondWithResult(_0x1028ed,0xc9))['catch'](handleError(_0x1028ed,null));};exports[_0x6b3f('0x36')]=function(_0x3162ab,_0x1bf223){if(_0x3162ab[_0x6b3f('0x59')]['id']){delete _0x3162ab[_0x6b3f('0x59')]['id'];}return db[_0x6b3f('0x3c')][_0x6b3f('0x57')]({'where':{'id':_0x3162ab[_0x6b3f('0x5a')]['id']}})[_0x6b3f('0x37')](handleEntityNotFound(_0x1bf223,null))[_0x6b3f('0x37')](saveUpdates(_0x3162ab[_0x6b3f('0x59')],null))[_0x6b3f('0x37')](respondWithResult(_0x1bf223,null))['catch'](handleError(_0x1bf223,null));};exports[_0x6b3f('0x38')]=function(_0x5100da,_0x3bbd63){return db[_0x6b3f('0x3c')][_0x6b3f('0x57')]({'where':{'id':_0x5100da[_0x6b3f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3bbd63,null))[_0x6b3f('0x37')](removeEntity(_0x3bbd63,null))[_0x6b3f('0x2b')](handleError(_0x3bbd63,null));};exports[_0x6b3f('0x5b')]=function(_0x172b9f,_0x3856bc){return db[_0x6b3f('0x3c')][_0x6b3f('0x5b')]()['then'](respondWithResult(_0x3856bc,null))[_0x6b3f('0x2b')](handleError(_0x3856bc,null));};var interaction_log=require(_0x6b3f('0x14'))(_0x6b3f('0x5c'));exports[_0x6b3f('0x5d')]=function(_0x4d0181,_0x2dae60,_0x3a6c99){var _0x176561={'channel':_0x6b3f('0x5e')};if(_0x4d0181[_0x6b3f('0x59')]['id']){delete _0x4d0181[_0x6b3f('0x59')]['id'];}_0x4d0181[_0x6b3f('0x59')][_0x6b3f('0x5f')]=!![];_0x4d0181[_0x6b3f('0x59')][_0x6b3f('0x60')]=moment()[_0x6b3f('0x61')](_0x6b3f('0x62'));_0x4d0181[_0x6b3f('0x59')][_0x6b3f('0x63')]=_0x4d0181[_0x6b3f('0x59')]['UserId']||_0x4d0181[_0x6b3f('0x64')]['id'];return db[_0x6b3f('0x3c')][_0x6b3f('0x57')]({'where':{'id':_0x4d0181[_0x6b3f('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x6b3f('0x65')],'as':'Contact'}]})[_0x6b3f('0x37')](handleEntityNotFound(_0x2dae60,null))[_0x6b3f('0x37')](saveUpdates(_0x4d0181[_0x6b3f('0x59')],null))[_0x6b3f('0x37')](function(_0x3005c5){if(_0x3005c5){_0x176561[_0x6b3f('0x29')]=_0x3005c5[_0x6b3f('0x66')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3005c5[_0x6b3f('0x67')]}});}return null;})[_0x6b3f('0x37')](handleEntityNotFound(_0x2dae60,null))['then'](function(_0x2f909d){if(_0x2f909d){return _0x2f909d[_0x6b3f('0x36')]({'UserId':_0x4d0181[_0x6b3f('0x59')]['UserId'],'read1stAt':_['isNil'](_0x2f909d[_0x6b3f('0x68')])?moment()[_0x6b3f('0x61')](_0x6b3f('0x62')):undefined});}return null;})['then'](function(_0x54fb82){if(_0x54fb82){_0x176561[_0x6b3f('0x69')]=_0x54fb82[_0x6b3f('0x66')]({'plain':!![]});interaction_log[_0x6b3f('0x22')](_0x6b3f('0x6a'),_0x4d0181[_0x6b3f('0x64')]['id'],_0x4d0181[_0x6b3f('0x64')][_0x6b3f('0x3a')],_0x4d0181[_0x6b3f('0x64')]['role'],_0x176561[_0x6b3f('0x69')]['id'],_0x4d0181[_0x6b3f('0x59')]?JSON['stringify'](_0x4d0181[_0x6b3f('0x59')]):_0x6b3f('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x6b3f('0x6c'),_0x176561);}return null;})[_0x6b3f('0x37')](function(_0x216264){if(_0x216264){if(_0x4d0181[_0x6b3f('0x59')]['manual']){_0x176561[_0x6b3f('0x29')][_0x6b3f('0x6d')]=util['format'](_0x6b3f('0x6e'),_0x4d0181[_0x6b3f('0x64')][_0x6b3f('0x3a')]);_0x176561[_0x6b3f('0x29')]['channel']=_0x176561[_0x6b3f('0x6f')];_0x176561['message']['event']=_0x6b3f('0x5d');return respondWithRpcPromise(_0x6b3f('0x70'),_0x6b3f('0x70'),{'event':_0x6b3f('0x71'),'message':_0x176561[_0x6b3f('0x29')]},client9002)[_0x6b3f('0x37')](function(){return _0x176561;});}return _0x176561;}return null;})[_0x6b3f('0x37')](respondWithResult(_0x2dae60,null))[_0x6b3f('0x2b')](handleError(_0x2dae60,null));};var interaction_log=require(_0x6b3f('0x14'))(_0x6b3f('0x5c'));exports[_0x6b3f('0x34')]=function(_0x2905a0,_0x56cfa1,_0x448a0a){var _0x12cd23={'agent':{},'channel':_0x6b3f('0x5e')};if(_0x2905a0[_0x6b3f('0x59')]['id']){delete _0x2905a0[_0x6b3f('0x59')]['id'];}_0x2905a0[_0x6b3f('0x59')][_0x6b3f('0x63')]=_0x2905a0[_0x6b3f('0x59')][_0x6b3f('0x63')]||_0x2905a0[_0x6b3f('0x64')]['id'];_0x12cd23[_0x6b3f('0x72')]['id']=_0x2905a0[_0x6b3f('0x59')]['UserId'];return db[_0x6b3f('0x3c')]['find']({'where':{'id':_0x2905a0[_0x6b3f('0x5a')]['id'],'UserId':null}})[_0x6b3f('0x37')](handleEntityNotFound(_0x56cfa1,null))['then'](function(_0x5e5d30){if(_0x5e5d30){_0x12cd23[_0x6b3f('0x29')]=_0x5e5d30[_0x6b3f('0x66')]({'plain':!![]});return db['SmsInteraction'][_0x6b3f('0x57')]({'where':{'id':_0x5e5d30[_0x6b3f('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x56cfa1,null))[_0x6b3f('0x37')](function(_0x5bd58b){if(_0x5bd58b){_0x12cd23[_0x6b3f('0x69')]=_0x5bd58b[_0x6b3f('0x66')]({'plain':!![]});interaction_log['info'](_0x6b3f('0x73'),_0x2905a0[_0x6b3f('0x64')]['id'],_0x2905a0[_0x6b3f('0x64')][_0x6b3f('0x3a')],_0x2905a0[_0x6b3f('0x64')]['role'],_0x12cd23[_0x6b3f('0x69')]['id'],_0x2905a0[_0x6b3f('0x59')]?JSON[_0x6b3f('0x27')](_0x2905a0['body']):_0x6b3f('0x6b'));return respondWithRpcPromise(_0x6b3f('0x74'),_0x6b3f('0x75'),_0x12cd23);}return null;})[_0x6b3f('0x37')](function(_0x5c6f03){if(_0x5c6f03){_0x5c6f03[_0x6b3f('0x29')][_0x6b3f('0x6d')]=util['format'](_0x6b3f('0x6e'),_0x2905a0[_0x6b3f('0x64')][_0x6b3f('0x3a')]);_0x5c6f03[_0x6b3f('0x29')]['channel']=_0x12cd23['channel'];_0x5c6f03[_0x6b3f('0x29')][_0x6b3f('0x76')]='reject';respondWithRpcPromise(_0x6b3f('0x70'),'EventManager',{'event':_0x6b3f('0x77'),'message':_0x5c6f03[_0x6b3f('0x29')]},client9002);return _0x12cd23;}return null;})[_0x6b3f('0x37')](respondWithResult(_0x56cfa1,null))[_0x6b3f('0x2b')](handleError(_0x56cfa1,null));};exports[_0x6b3f('0x2d')]=function(_0x34d302,_0x53bd9b,_0x302deb){if(_0x34d302[_0x6b3f('0x59')]['id']){delete _0x34d302['body']['id'];}var _0x315b2a;return db[_0x6b3f('0x3c')][_0x6b3f('0x57')]({'where':{'id':_0x34d302[_0x6b3f('0x5a')]['id']}})[_0x6b3f('0x37')](handleEntityNotFound(_0x53bd9b,null))[_0x6b3f('0x37')](function(_0x2f0555){if(_0x2f0555){_0x315b2a=_0x2f0555;return db['SmsAccount'][_0x6b3f('0x57')]({'where':{'id':_0x2f0555[_0x6b3f('0x78')]}});}})[_0x6b3f('0x37')](handleEntityNotFound(_0x53bd9b,null))[_0x6b3f('0x37')](function(_0x3a4038){if(_0x3a4038){logger[_0x6b3f('0x25')](_0x6b3f('0x26'),_0x6b3f('0x2d'),_0x6b3f('0x79'),_0x3a4038[_0x6b3f('0x4f')],util['inspect'](_0x34d302[_0x6b3f('0x59')],{'showHidden':![],'depth':null}));switch(_0x3a4038[_0x6b3f('0x4f')]){case _0x6b3f('0x7a'):if(_0x34d302[_0x6b3f('0x59')]['MessageSid']&&_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x7b')]===_0x315b2a[_0x6b3f('0x7c')]){return _0x315b2a[_0x6b3f('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b3f('0x2d'),_0x6b3f('0x7a'),util[_0x6b3f('0x7d')](_0x34d302[_0x6b3f('0x59')],{'showHidden':![],'depth':null}));}break;case _0x6b3f('0x7e'):if(_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x7f')]&&_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x7f')]===_0x315b2a[_0x6b3f('0x7c')]&&_[_0x6b3f('0x80')](['sent',_0x6b3f('0x81')],_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x82')])>=0x0){return _0x315b2a[_0x6b3f('0x36')]({'read':!![]});}else{logger[_0x6b3f('0x28')](_0x6b3f('0x83'),_0x6b3f('0x2d'),_0x6b3f('0x84'),util[_0x6b3f('0x7d')](_0x34d302['body'],{'showHidden':![],'depth':null}));}break;case _0x6b3f('0x85'):var _0x47b29e=_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x86')][0x0];if(_0x47b29e['status'][_0x6b3f('0x87')]==='DELIVERED'){return _0x315b2a[_0x6b3f('0x36')]({'read':!![]});}else{logger[_0x6b3f('0x28')](_0x6b3f('0x83'),_0x6b3f('0x2d'),_0x6b3f('0x85'),util[_0x6b3f('0x7d')](_0x34d302[_0x6b3f('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x315b2a;}})[_0x6b3f('0x37')](respondWithResult(_0x53bd9b,null))['catch'](handleError(_0x53bd9b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7195678..94caf70 100644 --- a/server/api/smsMessage/smsMessage.events.js +++ b/server/api/smsMessage/smsMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x637b=['remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','update'];(function(_0xb2aa46,_0x110187){var _0x3fc7d4=function(_0x4b593b){while(--_0x4b593b){_0xb2aa46['push'](_0xb2aa46['shift']());}};_0x3fc7d4(++_0x110187);}(_0x637b,0xb3));var _0xb637=function(_0x30809f,_0x2b2dc8){_0x30809f=_0x30809f-0x0;var _0xd9f5b5=_0x637b[_0x30809f];return _0xd9f5b5;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xb637('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb637('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb637('0x2'),'afterDestroy':_0xb637('0x3')};function emitEvent(_0x8a7139){return function(_0x24dc11,_0x1051e3,_0x440942){SmsMessageEvents[_0xb637('0x4')](_0x8a7139+':'+_0x24dc11['id'],_0x24dc11);SmsMessageEvents[_0xb637('0x4')](_0x8a7139,_0x24dc11);_0x440942(null);};}for(var e in events){if(events[_0xb637('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xb637('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x30e7=['exports','events','setMaxListeners','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30e7,0x12d));var _0x730e=function(_0x243c79,_0x27b2cc){_0x243c79=_0x243c79-0x0;var _0x55a0d6=_0x30e7[_0x243c79];return _0x55a0d6;};'use strict';var EventEmitter=require(_0x730e('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x730e('0x1')](0x0);var events={'afterCreate':_0x730e('0x2'),'afterUpdate':_0x730e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3bfa3d){return function(_0x295a47,_0xf546dd,_0x33dc1a){SmsMessageEvents[_0x730e('0x4')](_0x3bfa3d+':'+_0x295a47['id'],_0x295a47);SmsMessageEvents[_0x730e('0x4')](_0x3bfa3d,_0x295a47);_0x33dc1a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x730e('0x5')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a8367c7..cd4c8a7 100644 --- a/server/api/smsMessage/smsMessage.model.js +++ b/server/api/smsMessage/smsMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27ce=['toLowerCase','out','secret','SmsInteraction','findOne','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','authToken','phone','accountSid','messages','create','remote','/status?token=','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','login?username=','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','update','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','clicksend','username','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/api/sms/messages/','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sender','text','keys','sort','createHash','md5','signature=','csc','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','application/json','refid','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','direction'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x27ce,0xd5));var _0xe27c=function(_0x34655c,_0x305bd4){_0x34655c=_0x34655c-0x0;var _0x269574=_0x27ce[_0x34655c];return _0x269574;};'use strict';var _=require(_0xe27c('0x0'));var util=require('util');var logger=require(_0xe27c('0x1'))(_0xe27c('0x2'));var moment=require('moment');var BPromise=require(_0xe27c('0x3'));var rp=require(_0xe27c('0x4'));var fs=require('fs');var path=require(_0xe27c('0x5'));var rimraf=require('rimraf');var config=require(_0xe27c('0x6'));var attributes=require('./smsMessage.attributes');module[_0xe27c('0x7')]=function(_0x1c8a01,_0xf8218b){return _0x1c8a01['define'](_0xe27c('0x8'),attributes,{'tableName':_0xe27c('0x9'),'paranoid':![],'indexes':[{'name':_0xe27c('0xa'),'fields':[_0xe27c('0xa')]},{'name':'fti_sms_messages','fields':[_0xe27c('0xb')],'type':_0xe27c('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e349d,_0x36f4fb,_0xd511a){var _0x284be2=_0x1c8a01[_0xe27c('0xd')];var _0x478efd=_0x2e349d['get']({'plain':!![]});if(_0x478efd[_0xe27c('0xe')][_0xe27c('0xf')]()==='in'||_0x478efd[_0xe27c('0xe')][_0xe27c('0xf')]()===_0xe27c('0x10')&&!_0x478efd[_0xe27c('0x11')]&&!_['isNil'](_0x478efd['UserId'])){_0x284be2[_0xe27c('0x12')][_0xe27c('0x13')]({'where':{'id':_0x478efd['SmsInteractionId']}})['then'](function(_0x44d111){if(_0x44d111){_0x44d111['update']({'lastMsgAt':_0x478efd[_0xe27c('0x14')],'lastMsgDirection':_0x478efd['direction'][_0xe27c('0xf')]()});}})[_0xe27c('0x15')](function(_0x19d187){console[_0xe27c('0x16')](_0x19d187);});}if(_0x478efd[_0xe27c('0xe')]===_0xe27c('0x10')&&!_0x478efd[_0xe27c('0x11')]){var _0x372d53;_0x284be2[_0xe27c('0x17')][_0xe27c('0x18')]({'where':{'id':_0x478efd[_0xe27c('0x19')]},'raw':!![]})[_0xe27c('0x1a')](function(_0x5721e9){_0x372d53=_0x5721e9;if(_0x372d53&&_0x372d53[_0xe27c('0x1b')]){switch(_0x372d53[_0xe27c('0x1b')]){case _0xe27c('0x1c'):var _0x2264a2=require(_0xe27c('0x1c'));if(_0x372d53['accountSid']&&_0x372d53[_0xe27c('0x1d')]&&_0x372d53[_0xe27c('0x1e')]){var _0x243663=new _0x2264a2(_0x372d53[_0xe27c('0x1f')],_0x372d53[_0xe27c('0x1d')]);_0x243663[_0xe27c('0x20')][_0xe27c('0x21')]({'body':_0x478efd[_0xe27c('0xb')],'to':_0x478efd[_0xe27c('0x1e')],'from':_0x372d53['phone'],'statusCallback':_0x372d53[_0xe27c('0x22')]+'/api/sms/messages/'+_0x478efd['id']+_0xe27c('0x23')+_0x372d53['token']})[_0xe27c('0x1a')](function(_0x219445){if(_0x219445['sid']){return _0x2e349d['update']({'messageId':_0x219445['sid']});}})[_0xe27c('0x15')](function(_0x1d7c36){logger[_0xe27c('0x16')](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x1c'),util[_0xe27c('0x26')](_0x1d7c36,{'showHidden':![],'depth':null}));});}else{logger[_0xe27c('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe27c('0x25'),_0xe27c('0x1c'),_0xe27c('0x27'));}break;case'skebby':var _0x32581c=_0xe27c('0x28');if(_0x372d53['username']&&_0x372d53[_0xe27c('0x29')]){var _0x2d308b={'recipient':[_0x478efd[_0xe27c('0x1e')]],'message':_0x478efd[_0xe27c('0xb')],'message_type':_0x372d53[_0xe27c('0x2a')]};if(_0x372d53[_0xe27c('0x2a')]&&_0x372d53[_0xe27c('0x2a')]!=='SI'){_0x2d308b['sender']=_0x372d53[_0xe27c('0x1e')];}var _0x27d7bf={'url':_0x32581c+_0xe27c('0x2b')+_0x372d53['username']+_0xe27c('0x2c')+_0x372d53['password'],'method':_0xe27c('0x2d')};rp(_0x27d7bf)['then'](function(_0x293c6a){var _0x2816b4=_0x293c6a[_0xe27c('0x2e')](';');var _0x2585be={'user_key':_0x2816b4[0x0],'session_key':_0x2816b4[0x1]};_0x27d7bf={'url':_0x32581c+_0xe27c('0x2f'),'method':_0xe27c('0x30'),'headers':{'user_key':_0x2585be[_0xe27c('0x31')],'Session_key':_0x2585be['session_key']},'json':!![],'body':_0x2d308b};return rp(_0x27d7bf);})[_0xe27c('0x1a')](function(_0x385b56){if(_0x385b56[_0xe27c('0x32')]>=0x1){var _0x371fea={'messageId':_0x385b56[_0xe27c('0x33')]};if(_0x372d53[_0xe27c('0x2a')]!=='GP'||!_0x372d53[_0xe27c('0x34')]){_0x371fea[_0xe27c('0x35')]=!![];}return _0x2e349d[_0xe27c('0x36')](_0x371fea);}else{return logger[_0xe27c('0x16')](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x37'),util[_0xe27c('0x26')](_0x385b56,{'showHidden':![],'depth':null}));}})[_0xe27c('0x15')](function(_0x43d849){return logger[_0xe27c('0x16')](_0xe27c('0x24'),'afterCreate','skebby',util[_0xe27c('0x26')](_0x43d849,{'showHidden':![],'depth':null}));});}else{logger[_0xe27c('0x16')](_0xe27c('0x24'),'afterCreate',_0xe27c('0x37'),_0xe27c('0x38'));}break;case _0xe27c('0x39'):if(_0x372d53[_0xe27c('0x1d')]){var _0x4373d1={'recipient':_0x478efd[_0xe27c('0x1e')],'message':_0x478efd['body'],'sender':_0x372d53[_0xe27c('0x3a')]||_0x372d53['phone'],'authorization':_0x372d53[_0xe27c('0x1d')]};var _0x36f4fb={'method':_0xe27c('0x30'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4373d1,'json':!![]};rp(_0x36f4fb)[_0xe27c('0x1a')](function(_0x22951e){var _0x304eac={'messageId':_0x22951e[_0xe27c('0x3b')]};if(!_0x372d53[_0xe27c('0x34')]){_0x304eac[_0xe27c('0x35')]=!![];}return _0x2e349d[_0xe27c('0x36')](_0x304eac);})['catch'](function(_0x2f2179){logger[_0xe27c('0x16')](_0xe27c('0x24'),'afterCreate','connectel',util['inspect'](_0x2f2179,{'showHidden':![],'depth':null}));});}else{logger[_0xe27c('0x16')](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x39'),'Missing\x20parameters:\x20authToken');}break;case _0xe27c('0x3c'):if(_0x372d53[_0xe27c('0x3d')]&&_0x372d53[_0xe27c('0x29')]){var _0x4373d1={'messages':[{'source':_0xe27c('0x3e'),'to':_0x478efd['phone'],'body':_0x478efd['body'],'from':_0x372d53[_0xe27c('0x3a')]||_0x372d53['phone']}]};var _0x3cbbe2=util[_0xe27c('0x3f')](_0xe27c('0x40'),_0x372d53['username'],_0x372d53[_0xe27c('0x29')]);var _0x36f4fb={'method':_0xe27c('0x30'),'uri':_0xe27c('0x41'),'body':_0x4373d1,'headers':{'Authorization':util[_0xe27c('0x3f')](_0xe27c('0x42'),new Buffer(_0x3cbbe2)[_0xe27c('0x43')](_0xe27c('0x44')))},'json':!![]};rp(_0x36f4fb)[_0xe27c('0x1a')](function(_0xa02d1d){if(_0xa02d1d[_0xe27c('0x45')]>=0xc8&&_0xa02d1d[_0xe27c('0x45')]<=0xce){if(_0xa02d1d[_0xe27c('0x46')]&&_0xa02d1d[_0xe27c('0x46')][_0xe27c('0x47')]>0x0){var _0x5dea0c=_[_0xe27c('0x48')](_0xa02d1d[_0xe27c('0x46')]['messages']);var _0x25193c={'messageId':_0x5dea0c['message_id']};if(!_0x372d53[_0xe27c('0x34')]){_0x25193c[_0xe27c('0x35')]=!![];}return _0x2e349d[_0xe27c('0x36')](_0x25193c);}else{logger[_0xe27c('0x16')](_0xe27c('0x24'),'afterCreate',_0xe27c('0x49'),util[_0xe27c('0x26')](_0xa02d1d,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xe27c('0x24'),'afterCreate',_0xe27c('0x49'),util[_0xe27c('0x26')](_0xa02d1d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3366ef){logger[_0xe27c('0x16')](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x49'),util[_0xe27c('0x26')](_0x3366ef,{'showHidden':![],'depth':null}));});}else{logger[_0xe27c('0x16')](_0xe27c('0x24'),'afterCreate',_0xe27c('0x49'),_0xe27c('0x38'));}break;case _0xe27c('0x4a'):if(_0x372d53[_0xe27c('0x4b')]&&_0x372d53[_0xe27c('0x1d')]){var _0x4373d1={'dst':_0x478efd[_0xe27c('0x1e')],'text':_0x478efd[_0xe27c('0xb')],'src':_0x372d53['senderString']||_0x372d53[_0xe27c('0x1e')],'url':_0x372d53[_0xe27c('0x22')]+_0xe27c('0x4c')+_0x478efd['id']+_0xe27c('0x23')+_0x372d53[_0xe27c('0x4d')]};var _0x3cbbe2=util['format'](_0xe27c('0x40'),_0x372d53[_0xe27c('0x4b')],_0x372d53[_0xe27c('0x1d')]);var _0x36f4fb={'method':_0xe27c('0x30'),'uri':util[_0xe27c('0x3f')](_0xe27c('0x4e'),_0x372d53[_0xe27c('0x4b')]),'body':_0x4373d1,'headers':{'Authorization':util[_0xe27c('0x3f')](_0xe27c('0x42'),new Buffer(_0x3cbbe2)[_0xe27c('0x43')](_0xe27c('0x44')))},'json':!![]};rp(_0x36f4fb)['then'](function(_0xaf688c){var _0x296efd={'messageId':_0xaf688c[_0xe27c('0x4f')][0x0]};return _0x2e349d[_0xe27c('0x36')](_0x296efd);})[_0xe27c('0x15')](function(_0x5611d2){logger['error'](_0xe27c('0x24'),_0xe27c('0x25'),'plivo',util[_0xe27c('0x26')](_0x5611d2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe27c('0x24'),'afterCreate',_0xe27c('0x4a'),_0xe27c('0x50'));}break;case'infobip':if(_0x372d53[_0xe27c('0x3d')]&&_0x372d53[_0xe27c('0x29')]){if(_0x372d53['baseUrl']){var _0x3b779b={'method':'POST','uri':_0x372d53[_0xe27c('0x51')]+_0xe27c('0x52'),'body':{'username':_0x372d53[_0xe27c('0x3d')],'password':_0x372d53[_0xe27c('0x29')]},'json':!![]};return rp(_0x3b779b)[_0xe27c('0x1a')](function(_0x58becc){var _0x33671b={'method':_0xe27c('0x30'),'uri':_0x372d53[_0xe27c('0x51')]+_0xe27c('0x53'),'body':{'messages':[{'from':_0x372d53[_0xe27c('0x1e')],'destinations':[{'to':_0x478efd['phone']}],'text':_0x478efd[_0xe27c('0xb')],'notifyUrl':_0x372d53[_0xe27c('0x22')]+_0xe27c('0x4c')+_0x478efd['id']+_0xe27c('0x23')+_0x372d53[_0xe27c('0x4d')],'notifyContentType':'application/json','callbackData':_0x372d53[_0xe27c('0x1e')]+';'+_0x478efd[_0xe27c('0xb')]}]},'headers':{'Authorization':_0xe27c('0x54')+_0x58becc[_0xe27c('0x4d')]},'json':!![]};return rp(_0x33671b)[_0xe27c('0x1a')](function(_0x2d2909){if(_0x2d2909['messages']){var _0x289fe4={'messageId':_0x2d2909[_0xe27c('0x20')][0x0][_0xe27c('0xa')]};if(!_0x372d53['deliveryReport']){_0x289fe4[_0xe27c('0x35')]=!![];}return _0x2e349d[_0xe27c('0x36')](_0x289fe4);}else{return logger[_0xe27c('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe27c('0x25'),_0xe27c('0x55'),util[_0xe27c('0x26')](_0x2d2909,{'showHidden':![],'depth':null}));}});})[_0xe27c('0x15')](function(_0x489112){return logger[_0xe27c('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe27c('0x25'),_0xe27c('0x55'),util[_0xe27c('0x26')](_0x489112,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe27c('0x24'),'afterCreate',_0xe27c('0x55'),_0xe27c('0x56'));}}else{logger['error'](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x55'),_0xe27c('0x38'));}break;case'csc':var _0x580a89=require(_0xe27c('0x57'));if(_0x372d53[_0xe27c('0x58')]){var _0x1e4a9c={};_0x1e4a9c[_0xe27c('0x59')]=_0x372d53[_0xe27c('0x3d')];_0x1e4a9c[_0xe27c('0x1e')]=_0x478efd['phone'];_0x1e4a9c[_0xe27c('0x5a')]=_0x372d53[_0xe27c('0x1e')];_0x1e4a9c[_0xe27c('0x5b')]=_0x478efd['body'];_0x1e4a9c['timestamp']=+new Date();var _0x3f3259='';var _0x28f44a='';var _0x55e301=Object[_0xe27c('0x5c')](_0x1e4a9c);_0x55e301[_0xe27c('0x5d')]();for(var _0x298690=0x0;_0x298690<_0x55e301['length'];_0x298690++){if(_0x3f3259!=''){_0x3f3259+='&';}_0x3f3259+=_0x55e301[_0x298690]+'='+encodeURIComponent(_0x1e4a9c[_0x55e301[_0x298690]]);_0x28f44a+=_0x1e4a9c[_0x55e301[_0x298690]];}_0x28f44a+=_0x372d53[_0xe27c('0x58')];_0x28f44a=_0x580a89[_0xe27c('0x5e')](_0xe27c('0x5f'))[_0xe27c('0x36')](_0x28f44a)['digest']('hex');if(_0x3f3259!==''){_0x3f3259+='&';}_0x3f3259+=_0xe27c('0x60')+_0x28f44a;var _0x27d7bf={'method':_0xe27c('0x2d'),'uri':_0x372d53[_0xe27c('0x51')]+'/external/get/send.php?'+_0x3f3259,'json':!![]};return rp(_0x27d7bf)[_0xe27c('0x1a')](function(_0x419fa6){var _0x43c8c9=Object[_0xe27c('0x5c')](_0x419fa6);if(_0x419fa6[_0x43c8c9[0x0]][_0xe27c('0x16')]&&parseInt(_0x419fa6[_0x43c8c9[0x0]][_0xe27c('0x16')])===0x0){var _0x31a967={'messageId':_0x419fa6[_0x43c8c9[0x0]]['id_sms']};if(!_0x372d53[_0xe27c('0x34')]){_0x31a967[_0xe27c('0x35')]=!![];}return _0x2e349d[_0xe27c('0x36')](_0x31a967);}else{return logger[_0xe27c('0x16')](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x61'),util[_0xe27c('0x26')](_0x419fa6['error'],{'showHidden':![],'depth':null}));}})[_0xe27c('0x15')](function(_0x13a68f){return logger[_0xe27c('0x16')](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x61'),util[_0xe27c('0x26')](_0x13a68f,{'showHidden':![],'depth':null}));});}else{logger[_0xe27c('0x16')](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x61'),'Missing\x20parameters:\x20apiKey');}break;case _0xe27c('0x62'):if(_0x372d53[_0xe27c('0x58')]){var _0x4607d4={'method':_0xe27c('0x30'),'uri':_0xe27c('0x63'),'headers':{'Authorization':_0x372d53[_0xe27c('0x58')]},'body':{'content':_0x478efd[_0xe27c('0xb')],'to':[_0x478efd['phone']],'from':_0x372d53['phone'],'binary':![],'clientMessageId':_0xe27c('0x64'),'charset':_0xe27c('0x65')},'json':!![]};rp(_0x4607d4)['then'](function(_0x144067){if(!_0x144067[_0xe27c('0x16')]){var _0x35ea56={'messageId':_0x144067[_0xe27c('0x20')][0x0][_0xe27c('0x66')]};if(!_0x372d53[_0xe27c('0x34')]){_0x35ea56[_0xe27c('0x35')]=!![];}return _0x2e349d['update'](_0x35ea56);}else{return logger[_0xe27c('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe27c('0x25'),'clickatell',util['inspect'](_0x144067[_0xe27c('0x16')],{'showHidden':![],'depth':null}));}})[_0xe27c('0x15')](function(_0x5b8464){return logger[_0xe27c('0x16')](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x62'),util[_0xe27c('0x26')](_0x5b8464,{'showHidden':![],'depth':null}));});}else{logger[_0xe27c('0x16')](_0xe27c('0x24'),_0xe27c('0x25'),_0xe27c('0x62'),_0xe27c('0x67'));}break;case _0xe27c('0x68'):if(_0x372d53[_0xe27c('0x58')]){var _0x4801dd={};var _0x27d7bf={'method':_0xe27c('0x30'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xe27c('0x69')+_0x372d53[_0xe27c('0x58')],'Content-Type':'application/json'},'body':{'from':_0x372d53['phone'],'to':_0x478efd[_0xe27c('0x1e')],'text':_0x478efd[_0xe27c('0xb')]},'json':!![]};return rp(_0x27d7bf)[_0xe27c('0x1a')](function(_0x447d73){if(_0x447d73[_0xe27c('0x6a')]==0xca){_0x4801dd[_0xe27c('0x6b')]=_0x447d73;var _0x3c1bb4={'method':_0xe27c('0x30'),'uri':_0xe27c('0x6c'),'headers':{'Authorization':'Bearer\x20'+_0x372d53[_0xe27c('0x58')],'Content-Type':_0xe27c('0x6d')},'body':{'refid':_0x4801dd[_0xe27c('0x6b')][_0xe27c('0x6e')]},'json':!![]};return rp(_0x3c1bb4)[_0xe27c('0x1a')](function(_0xb7ce74){_0x4801dd['status']=_0xb7ce74;var _0x1b511d={'messageId':_0x4801dd[_0xe27c('0x6b')][_0xe27c('0x6e')],'read':!![]};return _0x2e349d[_0xe27c('0x36')](_0x1b511d);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe27c('0x68'),util[_0xe27c('0x26')](_0x447d73,{'showHidden':![],'depth':null}));}})[_0xe27c('0x15')](function(_0x4a215c){return logger[_0xe27c('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe27c('0x25'),_0xe27c('0x68'),util[_0xe27c('0x26')](_0x4a215c,{'showHidden':![],'depth':null}));});}else{return logger[_0xe27c('0x16')](_0xe27c('0x24'),'afterCreate','intelepeer',_0xe27c('0x6f'));}break;}}})[_0xe27c('0x70')](function(){_0xd511a();});}else{_0xd511a();}}},'charset':_0xe27c('0x71'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0e76=['sender','login?username=','&password=','GET','POST','session_key','total_sent','internal_order_id','deliveryReport','connectel','senderString','requestid','read','clicksend','password','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','http_code','data','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','/status?token=','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','sort','length','createHash','md5','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','body','remote','/api/sms/messages/','token','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0e76,0x1a4));var _0x60e7=function(_0x5ef70d,_0x1b14c0){_0x5ef70d=_0x5ef70d-0x0;var _0x307667=_0x0e76[_0x5ef70d];return _0x307667;};'use strict';var _=require('lodash');var util=require(_0x60e7('0x0'));var logger=require(_0x60e7('0x1'))(_0x60e7('0x2'));var moment=require(_0x60e7('0x3'));var BPromise=require(_0x60e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60e7('0x5'));var rimraf=require(_0x60e7('0x6'));var config=require(_0x60e7('0x7'));var attributes=require(_0x60e7('0x8'));module[_0x60e7('0x9')]=function(_0x385d02,_0x45c725){return _0x385d02[_0x60e7('0xa')](_0x60e7('0xb'),attributes,{'tableName':_0x60e7('0xc'),'paranoid':![],'indexes':[{'name':_0x60e7('0xd'),'fields':['messageId']},{'name':_0x60e7('0xe'),'fields':['body'],'type':_0x60e7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27c2cb,_0x1e3be0,_0x13f888){var _0xf66c8f=_0x385d02['models'];var _0x2aace6=_0x27c2cb[_0x60e7('0x10')]({'plain':!![]});if(_0x2aace6[_0x60e7('0x11')]['toLowerCase']()==='in'||_0x2aace6[_0x60e7('0x11')][_0x60e7('0x12')]()===_0x60e7('0x13')&&!_0x2aace6[_0x60e7('0x14')]&&!_[_0x60e7('0x15')](_0x2aace6[_0x60e7('0x16')])){_0xf66c8f[_0x60e7('0x17')][_0x60e7('0x18')]({'where':{'id':_0x2aace6[_0x60e7('0x19')]}})[_0x60e7('0x1a')](function(_0x30deab){if(_0x30deab){_0x30deab['update']({'lastMsgAt':_0x2aace6[_0x60e7('0x1b')],'lastMsgDirection':_0x2aace6[_0x60e7('0x11')]['toLowerCase']()});}})['catch'](function(_0x48c4ab){console[_0x60e7('0x1c')](_0x48c4ab);});}if(_0x2aace6[_0x60e7('0x11')]===_0x60e7('0x13')&&!_0x2aace6[_0x60e7('0x14')]){var _0x21b05b;_0xf66c8f[_0x60e7('0x1d')][_0x60e7('0x1e')]({'where':{'id':_0x2aace6[_0x60e7('0x1f')]},'raw':!![]})['then'](function(_0x3c15af){_0x21b05b=_0x3c15af;if(_0x21b05b&&_0x21b05b[_0x60e7('0x20')]){switch(_0x21b05b[_0x60e7('0x20')]){case'twilio':var _0x390801=require(_0x60e7('0x21'));if(_0x21b05b[_0x60e7('0x22')]&&_0x21b05b[_0x60e7('0x23')]&&_0x21b05b[_0x60e7('0x24')]){var _0xb7585=new _0x390801(_0x21b05b[_0x60e7('0x22')],_0x21b05b['authToken']);_0xb7585['messages'][_0x60e7('0x25')]({'body':_0x2aace6[_0x60e7('0x26')],'to':_0x2aace6['phone'],'from':_0x21b05b[_0x60e7('0x24')],'statusCallback':_0x21b05b[_0x60e7('0x27')]+_0x60e7('0x28')+_0x2aace6['id']+'/status?token='+_0x21b05b[_0x60e7('0x29')]})['then'](function(_0x804606){if(_0x804606[_0x60e7('0x2a')]){return _0x27c2cb[_0x60e7('0x2b')]({'messageId':_0x804606[_0x60e7('0x2a')]});}})[_0x60e7('0x2c')](function(_0x1b25cf){logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate',_0x60e7('0x21'),util[_0x60e7('0x2e')](_0x1b25cf,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x60e7('0x2f'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x60e7('0x30'):var _0x51a8fd=_0x60e7('0x31');if(_0x21b05b[_0x60e7('0x32')]&&_0x21b05b['password']){var _0x33ca67={'recipient':[_0x2aace6['phone']],'message':_0x2aace6[_0x60e7('0x26')],'message_type':_0x21b05b[_0x60e7('0x33')]};if(_0x21b05b[_0x60e7('0x33')]&&_0x21b05b[_0x60e7('0x33')]!=='SI'){_0x33ca67[_0x60e7('0x34')]=_0x21b05b['phone'];}var _0x23a7f9={'url':_0x51a8fd+_0x60e7('0x35')+_0x21b05b[_0x60e7('0x32')]+_0x60e7('0x36')+_0x21b05b['password'],'method':_0x60e7('0x37')};rp(_0x23a7f9)[_0x60e7('0x1a')](function(_0x5690ce){var _0x1bd332=_0x5690ce['split'](';');var _0x44477f={'user_key':_0x1bd332[0x0],'session_key':_0x1bd332[0x1]};_0x23a7f9={'url':_0x51a8fd+'sms','method':_0x60e7('0x38'),'headers':{'user_key':_0x44477f['user_key'],'Session_key':_0x44477f[_0x60e7('0x39')]},'json':!![],'body':_0x33ca67};return rp(_0x23a7f9);})[_0x60e7('0x1a')](function(_0xe2de17){if(_0xe2de17[_0x60e7('0x3a')]>=0x1){var _0x423dcc={'messageId':_0xe2de17[_0x60e7('0x3b')]};if(_0x21b05b['smsMethod']!=='GP'||!_0x21b05b[_0x60e7('0x3c')]){_0x423dcc['read']=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x423dcc);}else{return logger['error'](_0x60e7('0x2d'),_0x60e7('0x2f'),'skebby',util['inspect'](_0xe2de17,{'showHidden':![],'depth':null}));}})[_0x60e7('0x2c')](function(_0x4f0314){return logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x60e7('0x2f'),_0x60e7('0x30'),util[_0x60e7('0x2e')](_0x4f0314,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x60e7('0x30'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x60e7('0x3d'):if(_0x21b05b[_0x60e7('0x23')]){var _0x349961={'recipient':_0x2aace6[_0x60e7('0x24')],'message':_0x2aace6[_0x60e7('0x26')],'sender':_0x21b05b[_0x60e7('0x3e')]||_0x21b05b[_0x60e7('0x24')],'authorization':_0x21b05b[_0x60e7('0x23')]};var _0x1e3be0={'method':_0x60e7('0x38'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x349961,'json':!![]};rp(_0x1e3be0)[_0x60e7('0x1a')](function(_0x4e0893){var _0x29205e={'messageId':_0x4e0893[_0x60e7('0x3f')]};if(!_0x21b05b['deliveryReport']){_0x29205e[_0x60e7('0x40')]=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x29205e);})[_0x60e7('0x2c')](function(_0x5444dc){logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x3d'),util['inspect'](_0x5444dc,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate',_0x60e7('0x3d'),'Missing\x20parameters:\x20authToken');}break;case _0x60e7('0x41'):if(_0x21b05b[_0x60e7('0x32')]&&_0x21b05b[_0x60e7('0x42')]){var _0x349961={'messages':[{'source':_0x60e7('0x43'),'to':_0x2aace6[_0x60e7('0x24')],'body':_0x2aace6[_0x60e7('0x26')],'from':_0x21b05b[_0x60e7('0x3e')]||_0x21b05b[_0x60e7('0x24')]}]};var _0x31bed4=util['format'](_0x60e7('0x44'),_0x21b05b[_0x60e7('0x32')],_0x21b05b[_0x60e7('0x42')]);var _0x1e3be0={'method':_0x60e7('0x38'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x349961,'headers':{'Authorization':util[_0x60e7('0x45')](_0x60e7('0x46'),new Buffer(_0x31bed4)[_0x60e7('0x47')]('base64'))},'json':!![]};rp(_0x1e3be0)['then'](function(_0x47da53){if(_0x47da53[_0x60e7('0x48')]>=0xc8&&_0x47da53[_0x60e7('0x48')]<=0xce){if(_0x47da53['data']&&_0x47da53[_0x60e7('0x49')]['queued_count']>0x0){var _0x18b73d=_['head'](_0x47da53[_0x60e7('0x49')][_0x60e7('0x4a')]);var _0x28de11={'messageId':_0x18b73d[_0x60e7('0x4b')]};if(!_0x21b05b[_0x60e7('0x3c')]){_0x28de11[_0x60e7('0x40')]=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x28de11);}else{logger['error'](_0x60e7('0x2d'),'afterCreate','clickSend',util[_0x60e7('0x2e')](_0x47da53,{'showHidden':![],'depth':null}));}}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),'clickSend',util[_0x60e7('0x2e')](_0x47da53,{'showHidden':![],'depth':null}));}})[_0x60e7('0x2c')](function(_0x4a41d0){logger['error'](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x4c'),util[_0x60e7('0x2e')](_0x4a41d0,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate','clickSend',_0x60e7('0x4d'));}break;case'plivo':if(_0x21b05b['authId']&&_0x21b05b[_0x60e7('0x23')]){var _0x349961={'dst':_0x2aace6['phone'],'text':_0x2aace6[_0x60e7('0x26')],'src':_0x21b05b['senderString']||_0x21b05b[_0x60e7('0x24')],'url':_0x21b05b[_0x60e7('0x27')]+'/api/sms/messages/'+_0x2aace6['id']+_0x60e7('0x4e')+_0x21b05b['token']};var _0x31bed4=util[_0x60e7('0x45')](_0x60e7('0x44'),_0x21b05b['authId'],_0x21b05b['authToken']);var _0x1e3be0={'method':_0x60e7('0x38'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x21b05b['authId']),'body':_0x349961,'headers':{'Authorization':util[_0x60e7('0x45')](_0x60e7('0x46'),new Buffer(_0x31bed4)['toString'](_0x60e7('0x4f')))},'json':!![]};rp(_0x1e3be0)[_0x60e7('0x1a')](function(_0x45df7a){var _0x15fad9={'messageId':_0x45df7a[_0x60e7('0x50')][0x0]};return _0x27c2cb[_0x60e7('0x2b')](_0x15fad9);})[_0x60e7('0x2c')](function(_0x4d5531){logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x51'),util[_0x60e7('0x2e')](_0x4d5531,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x51'),_0x60e7('0x52'));}break;case _0x60e7('0x53'):if(_0x21b05b[_0x60e7('0x32')]&&_0x21b05b[_0x60e7('0x42')]){if(_0x21b05b[_0x60e7('0x54')]){var _0x19eb1a={'method':_0x60e7('0x38'),'uri':_0x21b05b[_0x60e7('0x54')]+_0x60e7('0x55'),'body':{'username':_0x21b05b[_0x60e7('0x32')],'password':_0x21b05b[_0x60e7('0x42')]},'json':!![]};return rp(_0x19eb1a)[_0x60e7('0x1a')](function(_0x52c4bc){var _0x17f9bc={'method':_0x60e7('0x38'),'uri':_0x21b05b[_0x60e7('0x54')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x21b05b['phone'],'destinations':[{'to':_0x2aace6[_0x60e7('0x24')]}],'text':_0x2aace6['body'],'notifyUrl':_0x21b05b[_0x60e7('0x27')]+_0x60e7('0x28')+_0x2aace6['id']+_0x60e7('0x4e')+_0x21b05b[_0x60e7('0x29')],'notifyContentType':_0x60e7('0x56'),'callbackData':_0x21b05b[_0x60e7('0x24')]+';'+_0x2aace6[_0x60e7('0x26')]}]},'headers':{'Authorization':_0x60e7('0x57')+_0x52c4bc[_0x60e7('0x29')]},'json':!![]};return rp(_0x17f9bc)['then'](function(_0x5e0791){if(_0x5e0791[_0x60e7('0x4a')]){var _0x187d95={'messageId':_0x5e0791[_0x60e7('0x4a')][0x0][_0x60e7('0xd')]};if(!_0x21b05b['deliveryReport']){_0x187d95[_0x60e7('0x40')]=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x187d95);}else{return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate',_0x60e7('0x53'),util[_0x60e7('0x2e')](_0x5e0791,{'showHidden':![],'depth':null}));}});})[_0x60e7('0x2c')](function(_0x47d2fd){return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x53'),util[_0x60e7('0x2e')](_0x47d2fd,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),'infobip',_0x60e7('0x58'));}}else{logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x60e7('0x2f'),_0x60e7('0x53'),_0x60e7('0x4d'));}break;case _0x60e7('0x59'):var _0x5bee41=require('crypto');if(_0x21b05b[_0x60e7('0x5a')]){var _0x162e82={};_0x162e82[_0x60e7('0x5b')]=_0x21b05b['username'];_0x162e82[_0x60e7('0x24')]=_0x2aace6[_0x60e7('0x24')];_0x162e82[_0x60e7('0x34')]=_0x21b05b[_0x60e7('0x24')];_0x162e82[_0x60e7('0x5c')]=_0x2aace6[_0x60e7('0x26')];_0x162e82[_0x60e7('0x5d')]=+new Date();var _0x2d4a35='';var _0x2f589f='';var _0x1fdbcc=Object['keys'](_0x162e82);_0x1fdbcc[_0x60e7('0x5e')]();for(var _0x3822f5=0x0;_0x3822f5<_0x1fdbcc[_0x60e7('0x5f')];_0x3822f5++){if(_0x2d4a35!=''){_0x2d4a35+='&';}_0x2d4a35+=_0x1fdbcc[_0x3822f5]+'='+encodeURIComponent(_0x162e82[_0x1fdbcc[_0x3822f5]]);_0x2f589f+=_0x162e82[_0x1fdbcc[_0x3822f5]];}_0x2f589f+=_0x21b05b['apiKey'];_0x2f589f=_0x5bee41[_0x60e7('0x60')](_0x60e7('0x61'))[_0x60e7('0x2b')](_0x2f589f)[_0x60e7('0x62')](_0x60e7('0x63'));if(_0x2d4a35!==''){_0x2d4a35+='&';}_0x2d4a35+=_0x60e7('0x64')+_0x2f589f;var _0x23a7f9={'method':'GET','uri':_0x21b05b[_0x60e7('0x54')]+'/external/get/send.php?'+_0x2d4a35,'json':!![]};return rp(_0x23a7f9)[_0x60e7('0x1a')](function(_0x2f6dc4){var _0x3402ce=Object[_0x60e7('0x65')](_0x2f6dc4);if(_0x2f6dc4[_0x3402ce[0x0]][_0x60e7('0x1c')]&&parseInt(_0x2f6dc4[_0x3402ce[0x0]][_0x60e7('0x1c')])===0x0){var _0xb0af1c={'messageId':_0x2f6dc4[_0x3402ce[0x0]][_0x60e7('0x66')]};if(!_0x21b05b[_0x60e7('0x3c')]){_0xb0af1c[_0x60e7('0x40')]=!![];}return _0x27c2cb['update'](_0xb0af1c);}else{return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x59'),util[_0x60e7('0x2e')](_0x2f6dc4[_0x60e7('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a8c1a){return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate','csc',util['inspect'](_0x2a8c1a,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x59'),_0x60e7('0x67'));}break;case _0x60e7('0x68'):if(_0x21b05b[_0x60e7('0x5a')]){var _0x5563d1={'method':_0x60e7('0x38'),'uri':_0x60e7('0x69'),'headers':{'Authorization':_0x21b05b[_0x60e7('0x5a')]},'body':{'content':_0x2aace6['body'],'to':[_0x2aace6['phone']],'from':_0x21b05b[_0x60e7('0x24')],'binary':![],'clientMessageId':_0x60e7('0x6a'),'charset':_0x60e7('0x6b')},'json':!![]};rp(_0x5563d1)[_0x60e7('0x1a')](function(_0x2a1adf){if(!_0x2a1adf[_0x60e7('0x1c')]){var _0x46e490={'messageId':_0x2a1adf[_0x60e7('0x4a')][0x0][_0x60e7('0x6c')]};if(!_0x21b05b[_0x60e7('0x3c')]){_0x46e490[_0x60e7('0x40')]=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x46e490);}else{return logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x60e7('0x2f'),'clickatell',util[_0x60e7('0x2e')](_0x2a1adf[_0x60e7('0x1c')],{'showHidden':![],'depth':null}));}})[_0x60e7('0x2c')](function(_0x28b370){return logger['error'](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x68'),util[_0x60e7('0x2e')](_0x28b370,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate','clickatell',_0x60e7('0x67'));}break;case _0x60e7('0x6d'):if(_0x21b05b[_0x60e7('0x5a')]){var _0x287f35={};var _0x23a7f9={'method':_0x60e7('0x38'),'uri':_0x60e7('0x6e'),'headers':{'Authorization':_0x60e7('0x6f')+_0x21b05b[_0x60e7('0x5a')],'Content-Type':'application/json'},'body':{'from':_0x21b05b['phone'],'to':_0x2aace6['phone'],'text':_0x2aace6['body']},'json':!![]};return rp(_0x23a7f9)[_0x60e7('0x1a')](function(_0x229de5){if(_0x229de5['code']==0xca){_0x287f35['message']=_0x229de5;var _0x71b90={'method':_0x60e7('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x60e7('0x6f')+_0x21b05b[_0x60e7('0x5a')],'Content-Type':_0x60e7('0x56')},'body':{'refid':_0x287f35[_0x60e7('0x70')][_0x60e7('0x71')]},'json':!![]};return rp(_0x71b90)[_0x60e7('0x1a')](function(_0x21ab5f){_0x287f35[_0x60e7('0x72')]=_0x21ab5f;var _0x24c01c={'messageId':_0x287f35['message'][_0x60e7('0x71')],'read':!![]};return _0x27c2cb['update'](_0x24c01c);});}else{return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x6d'),util[_0x60e7('0x2e')](_0x229de5,{'showHidden':![],'depth':null}));}})[_0x60e7('0x2c')](function(_0x5458e4){return logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x60e7('0x2e')](_0x5458e4,{'showHidden':![],'depth':null}));});}else{return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x60e7('0x73')](function(){_0x13f888();});}else{_0x13f888();}}},'charset':_0x60e7('0x74'),'collate':_0x60e7('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 1b66b96..6f97d7c 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec00=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','SmsMessage,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd49e15,_0x5e34ac){var _0x306b6a=function(_0x38ce9c){while(--_0x38ce9c){_0xd49e15['push'](_0xd49e15['shift']());}};_0x306b6a(++_0x5e34ac);}(_0xec00,0x122));var _0x0ec0=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xec00[_0x269ee8];return _0x4d98bd;};'use strict';var _=require(_0x0ec0('0x0'));var util=require(_0x0ec0('0x1'));var moment=require(_0x0ec0('0x2'));var BPromise=require(_0x0ec0('0x3'));var rs=require(_0x0ec0('0x4'));var fs=require('fs');var Redis=require(_0x0ec0('0x5'));var db=require(_0x0ec0('0x6'))['db'];var utils=require(_0x0ec0('0x7'));var logger=require(_0x0ec0('0x8'))('rpc');var config=require(_0x0ec0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0ec0('0xa')][_0x0ec0('0xb')]({'port':0x232a});config[_0x0ec0('0xc')]=_[_0x0ec0('0xd')](config[_0x0ec0('0xc')],{'host':_0x0ec0('0xe'),'port':0x18eb});var socket=require(_0x0ec0('0xf'))(new Redis(config[_0x0ec0('0xc')]));require(_0x0ec0('0x10'))['register'](socket);function respondWithRpcPromise(_0x1f5199,_0x5f1a11,_0x123f4a){return new BPromise(function(_0x7dcaa5,_0x1a204f){return client['request'](_0x1f5199,_0x123f4a)['then'](function(_0x1b70e1){logger['info'](_0x0ec0('0x11'),_0x5f1a11,'request\x20sent');logger[_0x0ec0('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f1a11,'request\x20sent',JSON[_0x0ec0('0x13')](_0x1b70e1));if(_0x1b70e1[_0x0ec0('0x14')]){if(_0x1b70e1[_0x0ec0('0x14')][_0x0ec0('0x15')]===0x1f4){logger[_0x0ec0('0x14')](_0x0ec0('0x11'),_0x5f1a11,_0x1b70e1[_0x0ec0('0x14')]['message']);return _0x1a204f(_0x1b70e1[_0x0ec0('0x14')][_0x0ec0('0x16')]);}logger[_0x0ec0('0x14')](_0x0ec0('0x11'),_0x5f1a11,_0x1b70e1['error'][_0x0ec0('0x16')]);return _0x7dcaa5(_0x1b70e1[_0x0ec0('0x14')][_0x0ec0('0x16')]);}else{logger[_0x0ec0('0x17')](_0x0ec0('0x11'),_0x5f1a11,_0x0ec0('0x18'));_0x7dcaa5(_0x1b70e1[_0x0ec0('0x19')][_0x0ec0('0x16')]);}})[_0x0ec0('0x1a')](function(_0xeb9cc4){logger[_0x0ec0('0x14')](_0x0ec0('0x11'),_0x5f1a11,_0xeb9cc4);_0x1a204f(_0xeb9cc4);});});}exports[_0x0ec0('0x1b')]=function(_0x1ce7ff){var _0x4a19ab=this;return new Promise(function(_0x5c3577,_0x57c296){return db[_0x0ec0('0x1c')][_0x0ec0('0x1d')](_0x1ce7ff['body'],{'raw':_0x1ce7ff['options']?_0x1ce7ff[_0x0ec0('0x1e')][_0x0ec0('0x1f')]===undefined?!![]:![]:!![]})[_0x0ec0('0x20')](function(_0x33991b){logger[_0x0ec0('0x17')](_0x0ec0('0x1b'),_0x1ce7ff);logger[_0x0ec0('0x12')](_0x0ec0('0x1b'),_0x1ce7ff,JSON[_0x0ec0('0x13')](_0x33991b));_0x5c3577(_0x33991b);})[_0x0ec0('0x1a')](function(_0x412f5a){logger[_0x0ec0('0x14')](_0x0ec0('0x1b'),_0x412f5a[_0x0ec0('0x16')],_0x1ce7ff);_0x57c296(_0x4a19ab['error'](0x1f4,_0x412f5a[_0x0ec0('0x16')]));});});}; \ No newline at end of file +var _0x08c8=['rpc','../../config/environment','redis','defaults','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3c1348,_0x34923e){var _0x1995fd=function(_0x954685){while(--_0x954685){_0x3c1348['push'](_0x3c1348['shift']());}};_0x1995fd(++_0x34923e);}(_0x08c8,0x1bb));var _0x808c=function(_0x2a5a8d,_0x59d06c){_0x2a5a8d=_0x2a5a8d-0x0;var _0x364fd2=_0x08c8[_0x2a5a8d];return _0x364fd2;};'use strict';var _=require(_0x808c('0x0'));var util=require(_0x808c('0x1'));var moment=require(_0x808c('0x2'));var BPromise=require('bluebird');var rs=require(_0x808c('0x3'));var fs=require('fs');var Redis=require(_0x808c('0x4'));var db=require(_0x808c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x808c('0x6'))(_0x808c('0x7'));var config=require(_0x808c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x808c('0x9')]=_[_0x808c('0xa')](config[_0x808c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x808c('0xb'))[_0x808c('0xc')](socket);function respondWithRpcPromise(_0x4bc2a0,_0x29ed2e,_0x235476){return new BPromise(function(_0x3ef165,_0x294904){return client[_0x808c('0xd')](_0x4bc2a0,_0x235476)['then'](function(_0x2598d7){logger[_0x808c('0xe')](_0x808c('0xf'),_0x29ed2e,_0x808c('0x10'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29ed2e,_0x808c('0x10'),JSON[_0x808c('0x11')](_0x2598d7));if(_0x2598d7[_0x808c('0x12')]){if(_0x2598d7[_0x808c('0x12')][_0x808c('0x13')]===0x1f4){logger[_0x808c('0x12')](_0x808c('0xf'),_0x29ed2e,_0x2598d7[_0x808c('0x12')][_0x808c('0x14')]);return _0x294904(_0x2598d7[_0x808c('0x12')][_0x808c('0x14')]);}logger[_0x808c('0x12')](_0x808c('0xf'),_0x29ed2e,_0x2598d7['error'][_0x808c('0x14')]);return _0x3ef165(_0x2598d7[_0x808c('0x12')][_0x808c('0x14')]);}else{logger['info'](_0x808c('0xf'),_0x29ed2e,_0x808c('0x10'));_0x3ef165(_0x2598d7[_0x808c('0x15')][_0x808c('0x14')]);}})['catch'](function(_0x864a0e){logger[_0x808c('0x12')](_0x808c('0xf'),_0x29ed2e,_0x864a0e);_0x294904(_0x864a0e);});});}exports[_0x808c('0x16')]=function(_0x30f2e5){var _0xd758ca=this;return new Promise(function(_0xf99498,_0x100336){return db[_0x808c('0x17')][_0x808c('0x18')](_0x30f2e5[_0x808c('0x19')],{'raw':_0x30f2e5['options']?_0x30f2e5[_0x808c('0x1a')][_0x808c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3683e1){logger[_0x808c('0xe')](_0x808c('0x16'),_0x30f2e5);logger[_0x808c('0x1c')](_0x808c('0x16'),_0x30f2e5,JSON['stringify'](_0x3683e1));_0xf99498(_0x3683e1);})[_0x808c('0x1d')](function(_0x38b72b){logger[_0x808c('0x12')](_0x808c('0x16'),_0x38b72b['message'],_0x30f2e5);_0x100336(_0xd758ca[_0x808c('0x12')](0x1f4,_0x38b72b[_0x808c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 47dd42e..8826461 100644 --- a/server/api/smsMessage/smsMessage.socket.js +++ b/server/api/smsMessage/smsMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d75=['smsMessage:','save','remove','update','emit','register','length'];(function(_0x1c5c08,_0x4c9664){var _0x30402e=function(_0x1c037e){while(--_0x1c037e){_0x1c5c08['push'](_0x1c5c08['shift']());}};_0x30402e(++_0x4c9664);}(_0x4d75,0x16d));var _0x54d7=function(_0xb14f5d,_0x41204e){_0xb14f5d=_0xb14f5d-0x0;var _0x11eabe=_0x4d75[_0xb14f5d];return _0x11eabe;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x54d7('0x0'),_0x54d7('0x1'),_0x54d7('0x2')];function createListener(_0xba4018,_0x24de7a){return function(_0x2147b5){_0x24de7a[_0x54d7('0x3')](_0xba4018,_0x2147b5);};}function removeListener(_0x2bdc72,_0x12e97e){return function(){SmsMessageEvents['removeListener'](_0x2bdc72,_0x12e97e);};}exports[_0x54d7('0x4')]=function(_0x411119){for(var _0x1a2f29=0x0,_0x56bad1=events[_0x54d7('0x5')];_0x1a2f29<_0x56bad1;_0x1a2f29++){var _0x55dba9=events[_0x1a2f29];var _0x80cb6f=createListener(_0x54d7('0x6')+_0x55dba9,_0x411119);SmsMessageEvents['on'](_0x55dba9,_0x80cb6f);}}; \ No newline at end of file +var _0x1e70=['./smsMessage.events','save','remove','update','emit','removeListener','register','length','smsMessage:'];(function(_0xb91f14,_0x1795cb){var _0xa826f0=function(_0x16733d){while(--_0x16733d){_0xb91f14['push'](_0xb91f14['shift']());}};_0xa826f0(++_0x1795cb);}(_0x1e70,0x19e));var _0x01e7=function(_0x16d06c,_0x60b541){_0x16d06c=_0x16d06c-0x0;var _0x22e0a8=_0x1e70[_0x16d06c];return _0x22e0a8;};'use strict';var SmsMessageEvents=require(_0x01e7('0x0'));var events=[_0x01e7('0x1'),_0x01e7('0x2'),_0x01e7('0x3')];function createListener(_0x4b626f,_0x107c16){return function(_0x1e8b79){_0x107c16[_0x01e7('0x4')](_0x4b626f,_0x1e8b79);};}function removeListener(_0x43690d,_0x168d2d){return function(){SmsMessageEvents[_0x01e7('0x5')](_0x43690d,_0x168d2d);};}exports[_0x01e7('0x6')]=function(_0x420208){for(var _0x5db71c=0x0,_0x166135=events[_0x01e7('0x7')];_0x5db71c<_0x166135;_0x5db71c++){var _0x25d101=events[_0x5db71c];var _0x5e7731=createListener(_0x01e7('0x8')+_0x25d101,_0x420208);SmsMessageEvents['on'](_0x25d101,_0x5e7731);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e9397af..8a3635f 100644 --- a/server/api/smsQueue/index.js +++ b/server/api/smsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34f0=['delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update'];(function(_0x55e839,_0x3b5345){var _0x39c61a=function(_0x5bd269){while(--_0x5bd269){_0x55e839['push'](_0x55e839['shift']());}};_0x39c61a(++_0x3b5345);}(_0x34f0,0x13b));var _0x034f=function(_0x518f52,_0x541802){_0x518f52=_0x518f52-0x0;var _0x2ea2cf=_0x34f0[_0x518f52];return _0x2ea2cf;};'use strict';var multer=require(_0x034f('0x0'));var util=require(_0x034f('0x1'));var path=require('path');var timeout=require(_0x034f('0x2'));var express=require('express');var router=express[_0x034f('0x3')]();var auth=require(_0x034f('0x4'));var interaction=require(_0x034f('0x5'));var config=require(_0x034f('0x6'));var controller=require(_0x034f('0x7'));router['get']('/',auth[_0x034f('0x8')](),controller[_0x034f('0x9')]);router['get'](_0x034f('0xa'),auth['isAuthenticated'](),controller[_0x034f('0xb')]);router[_0x034f('0xc')](_0x034f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x034f('0xc')]('/:id/members',auth['isAuthenticated'](),controller[_0x034f('0xe')]);router[_0x034f('0xc')](_0x034f('0xf'),auth[_0x034f('0x8')](),controller[_0x034f('0x10')]);router['get'](_0x034f('0x11'),auth[_0x034f('0x8')](),controller[_0x034f('0x12')]);router['post']('/',auth[_0x034f('0x8')](),controller['create']);router[_0x034f('0x13')](_0x034f('0xf'),auth[_0x034f('0x8')](),controller[_0x034f('0x14')]);router[_0x034f('0x13')](_0x034f('0x11'),auth[_0x034f('0x8')](),controller[_0x034f('0x15')]);router['put']('/:id',auth[_0x034f('0x8')](),controller[_0x034f('0x16')]);router[_0x034f('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x034f('0x18')]);router[_0x034f('0x17')]('/:id/teams',auth[_0x034f('0x8')](),controller['removeTeams']);router[_0x034f('0x17')](_0x034f('0x11'),auth[_0x034f('0x8')](),controller['removeAgents']);module[_0x034f('0x19')]=router; \ No newline at end of file +var _0x9a14=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','/describe','isAuthenticated','describe','/:id','show','/:id/members','get','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeAgents'];(function(_0x3a1a2c,_0x530568){var _0x37d134=function(_0x5acf44){while(--_0x5acf44){_0x3a1a2c['push'](_0x3a1a2c['shift']());}};_0x37d134(++_0x530568);}(_0x9a14,0xa8));var _0x49a1=function(_0xfd16a3,_0x31b475){_0xfd16a3=_0xfd16a3-0x0;var _0x348ef1=_0x9a14[_0xfd16a3];return _0x348ef1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49a1('0x0'));var timeout=require(_0x49a1('0x1'));var express=require(_0x49a1('0x2'));var router=express[_0x49a1('0x3')]();var auth=require(_0x49a1('0x4'));var interaction=require(_0x49a1('0x5'));var config=require(_0x49a1('0x6'));var controller=require(_0x49a1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x49a1('0x8'),auth[_0x49a1('0x9')](),controller[_0x49a1('0xa')]);router['get'](_0x49a1('0xb'),auth[_0x49a1('0x9')](),controller[_0x49a1('0xc')]);router['get'](_0x49a1('0xd'),auth[_0x49a1('0x9')](),controller['getMembers']);router[_0x49a1('0xe')](_0x49a1('0xf'),auth[_0x49a1('0x9')](),controller[_0x49a1('0x10')]);router[_0x49a1('0xe')]('/:id/users',auth[_0x49a1('0x9')](),controller[_0x49a1('0x11')]);router[_0x49a1('0x12')]('/',auth[_0x49a1('0x9')](),controller[_0x49a1('0x13')]);router[_0x49a1('0x12')](_0x49a1('0xf'),auth[_0x49a1('0x9')](),controller[_0x49a1('0x14')]);router[_0x49a1('0x12')](_0x49a1('0x15'),auth[_0x49a1('0x9')](),controller[_0x49a1('0x16')]);router[_0x49a1('0x17')](_0x49a1('0xb'),auth['isAuthenticated'](),controller[_0x49a1('0x18')]);router[_0x49a1('0x19')](_0x49a1('0xb'),auth['isAuthenticated'](),controller[_0x49a1('0x1a')]);router[_0x49a1('0x19')]('/:id/teams',auth[_0x49a1('0x9')](),controller['removeTeams']);router[_0x49a1('0x19')](_0x49a1('0x15'),auth['isAuthenticated'](),controller[_0x49a1('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 748a8f0..97a05fd 100644 --- a/server/api/smsQueue/smsQueue.attributes.js +++ b/server/api/smsQueue/smsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c99=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4602e4,_0x378ee6){var _0x425e18=function(_0x328524){while(--_0x328524){_0x4602e4['push'](_0x4602e4['shift']());}};_0x425e18(++_0x378ee6);}(_0x8c99,0x1a8));var _0x98c9=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x8c99[_0x4f3b2d];return _0x3dddfa;};'use strict';var Sequelize=require(_0x98c9('0x0'));module[_0x98c9('0x1')]={'name':{'type':Sequelize[_0x98c9('0x2')],'unique':_0x98c9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x98c9('0x2')]},'timeout':{'type':Sequelize[_0x98c9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x98c9('0x5')](_0x98c9('0x6'),_0x98c9('0x7'),_0x98c9('0x8'))}}; \ No newline at end of file +var _0x6444=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x6444,0x1a8));var _0x4644=function(_0x490eba,_0x518ea9){_0x490eba=_0x490eba-0x0;var _0x37ac7b=_0x6444[_0x490eba];return _0x37ac7b;};'use strict';var Sequelize=require(_0x4644('0x0'));module[_0x4644('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4644('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4644('0x3')]},'timeout':{'type':Sequelize[_0x4644('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4644('0x5')](_0x4644('0x6'),_0x4644('0x7'),_0x4644('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 25244f7..f100353 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['union','value','removeAgents','addAgents','omit','spread','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','get','SmsQueues','UserProfileResource','error','name','send','map','SmsQueue','fieldName','type','model','query','keys','filters','attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','count','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','describe','UserSmsQueue','hasOwnProperty','sort','pick','SmsQueueId','User','findAndCountAll','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all'];(function(_0x2acc93,_0x535884){var _0x4e2685=function(_0x1d4eed){while(--_0x1d4eed){_0x2acc93['push'](_0x2acc93['shift']());}};_0x4e2685(++_0x535884);}(_0x814b,0x1a2));var _0xb814=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0x814b[_0x4ac48d];return _0x7537af;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];config[_0xb814('0x1b')]=_[_0xb814('0x1c')](config[_0xb814('0x1b')],{'host':_0xb814('0x1d'),'port':0x18eb});var socket=require(_0xb814('0x1e'))(new Redis(config[_0xb814('0x1b')]));require(_0xb814('0x1f'))[_0xb814('0x20')](socket);function respondWithStatusCode(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xcc;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x21')](_0x44fb96);}return _0x3f4881[_0xb814('0x22')](_0x44fb96)[_0xb814('0x23')]();};}function respondWithResult(_0x45e0d0,_0x265a83){_0x265a83=_0x265a83||0xc8;return function(_0x125ce2){if(_0x125ce2){return _0x45e0d0[_0xb814('0x22')](_0x265a83)[_0xb814('0x24')](_0x125ce2);}};}function respondWithFilteredResult(_0x48c9df,_0x168a48){return function(_0x55ba16){if(_0x55ba16){var _0x270598=_0x55ba16['count'],_0xfac75b=_0x168a48[_0xb814('0x25')],_0x4c3007=_0x168a48['offset']+_0x168a48['limit'],_0x4b55a7;if(_0x4c3007>=_0x270598){_0x4c3007=_0x270598;_0x4b55a7=0xc8;}else{_0x4b55a7=0xce;}_0x48c9df[_0xb814('0x22')](_0x4b55a7);return _0x48c9df[_0xb814('0x26')](_0xb814('0x27'),_0xfac75b+'-'+_0x4c3007+'/'+_0x270598)['json'](_0x55ba16);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x28')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x29')](_0x1808a3);}return _0x531032[_0xb814('0x2a')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x2b')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x2c')]()[_0xb814('0x2b')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2d')]({'plain':!![]});var _0x5755ea=_0xb814('0x2e');return db[_0xb814('0x2f')][_0xb814('0x2c')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x2b')](function(){return _0x31c7ec;});})[_0xb814('0x2b')](function(){_0x3f81d0[_0xb814('0x22')](0xcc)[_0xb814('0x23')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x21')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x30')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x31')]){delete _0x37d24d[_0xb814('0x31')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x32')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x33')](db[_0xb814('0x34')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x35')],'type':_0x51d5ae[_0xb814('0x36')]['key']};});_0x419cd9[_0xb814('0x37')]=_[_0xb814('0x33')](_0x2431e2,_0xb814('0x31'));_0x419cd9[_0xb814('0x38')]=_[_0xb814('0x39')](_0x6efe9a[_0xb814('0x38')]);_0x419cd9[_0xb814('0x3a')]=_['intersection'](_0x419cd9[_0xb814('0x37')],_0x419cd9[_0xb814('0x38')]);_0x4cfc58[_0xb814('0x3b')]=_[_0xb814('0x3c')](_0x419cd9[_0xb814('0x37')],qs['fields'](_0x6efe9a[_0xb814('0x38')]['fields']));_0x4cfc58[_0xb814('0x3b')]=_0x4cfc58[_0xb814('0x3b')][_0xb814('0x3d')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x37')];if(!_0x6efe9a[_0xb814('0x38')]['hasOwnProperty'](_0xb814('0x3e'))){_0x4cfc58[_0xb814('0x3f')]=qs[_0xb814('0x3f')](_0x6efe9a[_0xb814('0x38')][_0xb814('0x3f')]);_0x4cfc58[_0xb814('0x25')]=qs['offset'](_0x6efe9a[_0xb814('0x38')]['offset']);}_0x4cfc58[_0xb814('0x40')]=qs['sort'](_0x6efe9a[_0xb814('0x38')]['sort']);_0x4cfc58[_0xb814('0x41')]=qs[_0xb814('0x3a')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58[_0xb814('0x41')]=_[_0xb814('0x43')](_0x4cfc58[_0xb814('0x41')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x36')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x31')]]={'$like':'%'+_0x6efe9a[_0xb814('0x38')][_0xb814('0x42')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x43')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x44')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x41')]};return db[_0xb814('0x34')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x45')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x46')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x34')][_0xb814('0x47')](_0x4cfc58);})[_0xb814('0x2b')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x2b')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x48')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x49')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x4a')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x37')]=_[_0xb814('0x39')](db[_0xb814('0x34')][_0xb814('0x4b')]);_0x534eb8[_0xb814('0x38')]=_[_0xb814('0x39')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x3c')](_0x534eb8[_0xb814('0x37')],_0x534eb8[_0xb814('0x38')]);_0x450a08[_0xb814('0x3b')]=_[_0xb814('0x3c')](_0x534eb8[_0xb814('0x37')],qs[_0xb814('0x4c')](_0x22cf27[_0xb814('0x38')][_0xb814('0x4c')]));_0x450a08[_0xb814('0x3b')]=_0x450a08[_0xb814('0x3b')]['length']?_0x450a08[_0xb814('0x3b')]:_0x534eb8[_0xb814('0x37')];if(_0x22cf27['query'][_0xb814('0x46')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x43')]({},_0x450a08,_0x22cf27[_0xb814('0x44')]);return db[_0xb814('0x34')][_0xb814('0x4d')](_0x450a08)[_0xb814('0x2b')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x2b')](respondWithResult(_0x7d92aa,null))[_0xb814('0x48')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4e')]=function(_0x32a397,_0x2a422a){return db['SmsQueue']['create'](_0x32a397[_0xb814('0x4f')],{})[_0xb814('0x2b')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x50')][_0xb814('0x2d')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x51'));if(_0x3f8e29['role']===_0xb814('0x50')){var _0x388324=_0x4156d8[_0xb814('0x2d')]({'plain':!![]});var _0x5a916d=_0xb814('0x2e');return db['UserProfileSection'][_0xb814('0x4d')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x2b')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2f')][_0xb814('0x4e')]({'name':_0x388324[_0xb814('0x31')],'resourceId':_0x388324['id'],'type':_0x3cf8f8['name'],'sectionId':_0x3cf8f8['id']},{})[_0xb814('0x2b')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x2b')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4f')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x34')]['find']({'where':{'id':_0x3b9709[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4f')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x48')](handleError(_0x35f59a,null));};exports[_0xb814('0x2c')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x34')][_0xb814('0x4d')]({'where':{'id':_0xb2bd82[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x48')](handleError(_0x113fe5,null));};exports[_0xb814('0x52')]=function(_0x5d71d5,_0x29a127){return db[_0xb814('0x34')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x29a127,null))['catch'](handleError(_0x29a127,null));};exports['getMembers']=function(_0x2114ca,_0x5257be,_0x3ff213){var _0xd1cd8b={'raw':!![],'where':{}},_0x2dec52={},_0x586957;return db[_0xb814('0x34')]['findOne']({'where':{'id':_0x2114ca[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x5257be,null))[_0xb814('0x2b')](function(_0x176585){if(_0x176585){_0x586957=_0x176585[_0xb814('0x2d')]({'plain':!![]});_0x2dec52[_0xb814('0x37')]=_[_0xb814('0x39')](db[_0xb814('0x53')][_0xb814('0x4b')]);_0x2dec52['query']=_[_0xb814('0x39')](_0x2114ca[_0xb814('0x38')]);_0x2dec52[_0xb814('0x3a')]=_[_0xb814('0x3c')](_0x2dec52[_0xb814('0x37')],_0x2dec52[_0xb814('0x38')]);_0xd1cd8b['attributes']=_[_0xb814('0x3c')](_0x2dec52['model'],qs[_0xb814('0x4c')](_0x2114ca[_0xb814('0x38')][_0xb814('0x4c')]));_0xd1cd8b['attributes']=_0xd1cd8b[_0xb814('0x3b')]['length']?_0xd1cd8b[_0xb814('0x3b')]:_0x2dec52['model'];if(!_0x2114ca[_0xb814('0x38')][_0xb814('0x54')](_0xb814('0x3e'))){_0xd1cd8b[_0xb814('0x3f')]=qs[_0xb814('0x3f')](_0x2114ca[_0xb814('0x38')][_0xb814('0x3f')]);_0xd1cd8b['offset']=qs[_0xb814('0x25')](_0x2114ca['query'][_0xb814('0x25')]);}_0xd1cd8b[_0xb814('0x40')]=qs[_0xb814('0x55')](_0x2114ca[_0xb814('0x38')][_0xb814('0x55')]);_0xd1cd8b[_0xb814('0x41')]=qs['filters'](_[_0xb814('0x56')](_0x2114ca[_0xb814('0x38')],_0x2dec52['filters']));_0xd1cd8b[_0xb814('0x41')][_0xb814('0x57')]=_0x176585['id'];if(_0x2114ca[_0xb814('0x38')][_0xb814('0x42')]){_0xd1cd8b[_0xb814('0x41')]=_['merge'](_0xd1cd8b[_0xb814('0x41')],{'$or':_['map'](_0xd1cd8b[_0xb814('0x3b')],function(_0x16f8f2){var _0x2645f6={};_0x2645f6[_0x16f8f2]={'$like':'%'+_0x2114ca[_0xb814('0x38')][_0xb814('0x42')]+'%'};return _0x2645f6;})});}_0xd1cd8b=_[_0xb814('0x43')]({},_0xd1cd8b,_0x2114ca['options']);return db['UserSmsQueue']['findAll'](_0xd1cd8b);}})[_0xb814('0x2b')](function(_0x490e5c){if(_0x490e5c){return db[_0xb814('0x58')][_0xb814('0x59')]({'where':{'id':_[_0xb814('0x33')](_0x490e5c,'UserId'),'role':_0xb814('0x5a')},'attributes':['id',_0xb814('0x31'),_0xb814('0x5b'),'updatedAt',_0xb814('0x5c')]});}})[_0xb814('0x2b')](function(_0x1f39c0){if(_0x1f39c0){return{'count':_0x1f39c0[_0xb814('0x45')],'rows':_['map'](_0x1f39c0['rows'],function(_0x28eaf8){return{'membername':_0x28eaf8[_0xb814('0x31')],'UserId':_0x28eaf8['id'],'queue_name':_0x586957[_0xb814('0x31')],'SmsQueueId':_0x586957['id'],'interface':util[_0xb814('0x5d')](_0xb814('0x5e'),_0xb814('0x5f'),_0x28eaf8[_0xb814('0x31')]),'penalty':0x0,'paused':_0x28eaf8[_0xb814('0x5b')],'createdAt':_0x28eaf8[_0xb814('0x5c')],'updatedAt':_0x28eaf8[_0xb814('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb814('0x2b')](respondWithFilteredResult(_0x5257be,_0xd1cd8b))[_0xb814('0x48')](handleError(_0x5257be,null));};exports[_0xb814('0x61')]=function(_0x21fc41,_0xc94e99,_0x55a9c4){var _0x2332dc={};var _0x33cfc4={};var _0xfc9a65;var _0x357b90;return db[_0xb814('0x34')][_0xb814('0x62')]({'where':{'id':_0x21fc41['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0xc94e99,null))['then'](function(_0x872d43){if(_0x872d43){_0xfc9a65=_0x872d43;_0x33cfc4[_0xb814('0x37')]=_[_0xb814('0x39')](db[_0xb814('0x63')][_0xb814('0x4b')]);_0x33cfc4['query']=_['keys'](_0x21fc41[_0xb814('0x38')]);_0x33cfc4[_0xb814('0x3a')]=_[_0xb814('0x3c')](_0x33cfc4[_0xb814('0x37')],_0x33cfc4['query']);_0x2332dc[_0xb814('0x3b')]=_['intersection'](_0x33cfc4[_0xb814('0x37')],qs[_0xb814('0x4c')](_0x21fc41['query']['fields']));_0x2332dc[_0xb814('0x3b')]=_0x2332dc['attributes'][_0xb814('0x3d')]?_0x2332dc[_0xb814('0x3b')]:_0x33cfc4[_0xb814('0x37')];_0x2332dc[_0xb814('0x40')]=qs[_0xb814('0x55')](_0x21fc41[_0xb814('0x38')][_0xb814('0x55')]);_0x2332dc['where']=qs[_0xb814('0x3a')](_['pick'](_0x21fc41[_0xb814('0x38')],_0x33cfc4['filters']));if(_0x21fc41[_0xb814('0x38')][_0xb814('0x42')]){_0x2332dc['where']=_[_0xb814('0x43')](_0x2332dc['where'],{'$or':_[_0xb814('0x33')](_0x2332dc[_0xb814('0x3b')],function(_0x4e15c2){var _0x5a0c4a={};_0x5a0c4a[_0x4e15c2]={'$like':'%'+_0x21fc41[_0xb814('0x38')][_0xb814('0x42')]+'%'};return _0x5a0c4a;})});}_0x2332dc=_[_0xb814('0x43')]({},_0x2332dc,_0x21fc41[_0xb814('0x44')]);return _0xfc9a65[_0xb814('0x61')](_0x2332dc);}})[_0xb814('0x2b')](function(_0x2b12a9){if(_0x2b12a9){_0x357b90=_0x2b12a9[_0xb814('0x3d')];if(!_0x21fc41[_0xb814('0x38')][_0xb814('0x54')]('nolimit')){_0x2332dc['limit']=qs['limit'](_0x21fc41['query']['limit']);_0x2332dc[_0xb814('0x25')]=qs[_0xb814('0x25')](_0x21fc41[_0xb814('0x38')]['offset']);}return _0xfc9a65[_0xb814('0x61')](_0x2332dc);}})[_0xb814('0x2b')](function(_0x31c072){if(_0x31c072){return _0x31c072?{'count':_0x357b90,'rows':_0x31c072}:null;}})[_0xb814('0x2b')](respondWithResult(_0xc94e99,null))[_0xb814('0x48')](handleError(_0xc94e99,null));};exports[_0xb814('0x64')]=function(_0x3367b8,_0x1d9f13,_0x5cf5ad){var _0x20efc3=_0x3367b8[_0xb814('0x4f')][_0xb814('0x65')];return db[_0xb814('0x63')]['findAll']({'where':{'id':_0x20efc3},'attributes':['id'],'include':[{'model':db[_0xb814('0x58')],'as':_0xb814('0x66'),'attributes':['id',_0xb814('0x31'),_0xb814('0x67'),_0xb814('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x252f9c){if(_0x252f9c){var _0x57b3f2=_[_0xb814('0x69')](_0x252f9c,function(_0x3882f8){var _0x592aae=_0x3882f8[_0xb814('0x2d')]({'plain':!![]});return _0x592aae['Agents'];});return db[_0xb814('0x34')]['find']({'where':{'id':_0x3367b8[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](function(_0x41867b){return db[_0xb814('0x6a')][_0xb814('0x6b')](function(_0x1ae812){return _0x41867b[_0xb814('0x64')](_0x20efc3,{'transaction':_0x1ae812})['then'](function(){return BPromise['each'](_0x57b3f2,function(_0x21aa36){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x21aa36['id'],'SmsQueueId':_0x3367b8[_0xb814('0x4a')]['id']},'transaction':_0x1ae812});});})[_0xb814('0x2b')](function(){_0x57b3f2[_0xb814('0x6c')](function(_0x57bf1b){socket[_0xb814('0x6d')]('userSmsQueue:save',{'UserId':_0x57bf1b['id'],'SmsQueueId':_0x41867b['id']});});});});});}})[_0xb814('0x2b')](respondWithStatusCode(_0x1d9f13,null))[_0xb814('0x48')](handleError(_0x1d9f13,null));};exports[_0xb814('0x6e')]=function(_0x2d2b6c,_0x4c8a00,_0x1454b3){return db[_0xb814('0x63')][_0xb814('0x47')]({'where':{'id':_0x2d2b6c['query'][_0xb814('0x65')]},'attributes':['id'],'include':[{'model':db[_0xb814('0x58')],'as':_0xb814('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c8a00,null))[_0xb814('0x2b')](function(_0x2d0651){var _0x9dc06b=_[_0xb814('0x33')](_0x2d0651,'id');var _0x40b3c5=[];var _0x1ae8e8=[];var _0x37a7ab=squel[_0xb814('0x6f')]();_0x37a7ab[_0xb814('0x70')](_0xb814('0x71'))[_0xb814('0x72')](_0xb814('0x73'),'tq')[_0xb814('0x74')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb814('0x41')]('SmsQueueId\x20=\x20?',_0x2d2b6c[_0xb814('0x4a')]['id']);for(var _0x3949fd=0x0;_0x3949fd<_0x2d0651[_0xb814('0x3d')];_0x3949fd+=0x1){let _0x2bc95b=_0x2d0651[_0x3949fd];for(var _0x405db7=0x0;_0x405db7<_0x2bc95b[_0xb814('0x66')][_0xb814('0x3d')];_0x405db7+=0x1){let _0x5db5d0=_0x2bc95b['Agents'][_0x405db7];var _0x3f6df9=_0x37a7ab['clone']();_0x3f6df9[_0xb814('0x41')](_0xb814('0x75'),_0x5db5d0['id']);_0x1ae8e8[_0xb814('0x76')](db['sequelize'][_0xb814('0x38')](_0x3f6df9[_0xb814('0x77')](),{'type':db[_0xb814('0x6a')][_0xb814('0x78')][_0xb814('0x79')]})['then'](function(_0x59425f){if(_0x59425f[_0xb814('0x3d')]===0x1){return _0x5db5d0['id'];}else{var _0x4ac8c5=_[_0xb814('0x7a')](_[_0xb814('0x33')](_0x59425f,_0xb814('0x7b')),function(_0x4b96a6){return _[_0xb814('0x7c')](_0x9dc06b,_0x4b96a6);});if(_0x4ac8c5){return _0x5db5d0['id'];}}}));}}return BPromise[_0xb814('0x7d')](_0x1ae8e8)['then'](function(_0x32562d){_0x40b3c5=_(_0x40b3c5)[_0xb814('0x7e')](_0x32562d)['compact']()[_0xb814('0x7f')]();return db[_0xb814('0x34')][_0xb814('0x4d')]({'where':{'id':_0x2d2b6c[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](function(_0x2ee22e){return db[_0xb814('0x6a')][_0xb814('0x6b')](function(_0xb115ba){return _0x2ee22e[_0xb814('0x6e')](_0x2d2b6c[_0xb814('0x38')][_0xb814('0x65')],{'transaction':_0xb115ba})['then'](function(){if(!_['isEmpty'](_0x40b3c5)){return _0x2ee22e[_0xb814('0x80')](_0x40b3c5,{'transaction':_0xb115ba});}})['then'](function(){_0x40b3c5['forEach'](function(_0x3f2ff9){socket['emit']('userSmsQueue:remove',{'UserId':_0x3f2ff9,'SmsQueueId':_0x2ee22e['id']});});});});});});})['then'](respondWithStatusCode(_0x4c8a00,null))[_0xb814('0x48')](handleError(_0x4c8a00,null));};exports[_0xb814('0x81')]=function(_0x3341f5,_0x5eb4b1,_0xa721d3){return db['SmsQueue'][_0xb814('0x4d')]({'where':{'id':_0x3341f5[_0xb814('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5eb4b1,null))[_0xb814('0x2b')](function(_0x53467f){if(_0x53467f){return _0x53467f[_0xb814('0x81')](_0x3341f5[_0xb814('0x4f')][_0xb814('0x65')],_[_0xb814('0x82')](_0x3341f5[_0xb814('0x4f')],[_0xb814('0x65'),'id'])||{})[_0xb814('0x83')](function(_0x2b7abf){for(var _0x3a3b35=0x0;_0x3a3b35<_0x3341f5[_0xb814('0x4f')][_0xb814('0x65')][_0xb814('0x3d')];_0x3a3b35+=0x1){socket[_0xb814('0x6d')](_0xb814('0x84'),{'UserId':_0x3341f5[_0xb814('0x4f')]['ids'][_0x3a3b35],'SmsQueueId':_0x3341f5[_0xb814('0x4a')]['id']});}return _0x2b7abf;});}})[_0xb814('0x2b')](respondWithResult(_0x5eb4b1,null))['catch'](handleError(_0x5eb4b1,null));};exports[_0xb814('0x80')]=function(_0x552aae,_0x1868d9,_0x570191){return db['SmsQueue'][_0xb814('0x4d')]({'where':{'id':_0x552aae['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x1868d9,null))['then'](function(_0xdf3e07){if(_0xdf3e07){return _0xdf3e07['removeAgents'](_0x552aae['query'][_0xb814('0x65')])[_0xb814('0x2b')](function(){if(_[_0xb814('0x85')](_0x552aae[_0xb814('0x38')][_0xb814('0x65')])){for(var _0x4339a2=0x0;_0x4339a2<_0x552aae[_0xb814('0x38')][_0xb814('0x65')][_0xb814('0x3d')];_0x4339a2+=0x1){socket[_0xb814('0x6d')](_0xb814('0x86'),{'UserId':Number(_0x552aae['query'][_0xb814('0x65')][_0x4339a2]),'SmsQueueId':Number(_0x552aae['params']['id'])});}}else{socket[_0xb814('0x6d')](_0xb814('0x86'),{'UserId':Number(_0x552aae[_0xb814('0x38')]['ids']),'SmsQueueId':Number(_0x552aae[_0xb814('0x4a')]['id'])});}});}})[_0xb814('0x2b')](respondWithStatusCode(_0x1868d9,null))[_0xb814('0x48')](handleError(_0x1868d9,null));};exports[_0xb814('0x87')]=function(_0x290718,_0x2972b9,_0x26ce1a){var _0x44588a={};var _0x1462fb={};var _0x11d14f;var _0x3b65c0;return db[_0xb814('0x34')][_0xb814('0x62')]({'where':{'id':_0x290718[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2972b9,null))['then'](function(_0x37dec4){if(_0x37dec4){_0x11d14f=_0x37dec4;_0x1462fb[_0xb814('0x37')]=_[_0xb814('0x39')](db['User']['rawAttributes']);_0x1462fb[_0xb814('0x38')]=_['keys'](_0x290718['query']);_0x1462fb['filters']=_['intersection'](_0x1462fb[_0xb814('0x37')],_0x1462fb[_0xb814('0x38')]);_0x44588a['attributes']=_[_0xb814('0x3c')](_0x1462fb[_0xb814('0x37')],qs[_0xb814('0x4c')](_0x290718[_0xb814('0x38')][_0xb814('0x4c')]));_0x44588a[_0xb814('0x3b')]=_0x44588a[_0xb814('0x3b')][_0xb814('0x3d')]?_0x44588a[_0xb814('0x3b')]:_0x1462fb[_0xb814('0x37')];_0x44588a[_0xb814('0x40')]=qs['sort'](_0x290718[_0xb814('0x38')]['sort']);_0x44588a[_0xb814('0x41')]=qs[_0xb814('0x3a')](_[_0xb814('0x56')](_0x290718[_0xb814('0x38')],_0x1462fb[_0xb814('0x3a')]));if(_0x290718[_0xb814('0x38')][_0xb814('0x42')]){_0x44588a[_0xb814('0x41')]=_['merge'](_0x44588a['where'],{'$or':_['map'](_0x44588a[_0xb814('0x3b')],function(_0x4a2e90){var _0x1f49eb={};_0x1f49eb[_0x4a2e90]={'$like':'%'+_0x290718[_0xb814('0x38')][_0xb814('0x42')]+'%'};return _0x1f49eb;})});}_0x44588a=_[_0xb814('0x43')]({},_0x44588a,_0x290718[_0xb814('0x44')]);return _0x11d14f[_0xb814('0x87')](_0x44588a);}})[_0xb814('0x2b')](function(_0x1a5685){if(_0x1a5685){_0x3b65c0=_0x1a5685['length'];if(!_0x290718['query'][_0xb814('0x54')](_0xb814('0x3e'))){_0x44588a[_0xb814('0x3f')]=qs[_0xb814('0x3f')](_0x290718[_0xb814('0x38')][_0xb814('0x3f')]);_0x44588a['offset']=qs[_0xb814('0x25')](_0x290718['query'][_0xb814('0x25')]);}return _0x11d14f[_0xb814('0x87')](_0x44588a);}})[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05?{'count':_0x3b65c0,'rows':_0x94aa05}:null;}})[_0xb814('0x2b')](respondWithResult(_0x2972b9,null))[_0xb814('0x48')](handleError(_0x2972b9,null));}; \ No newline at end of file +var _0x5ad3=['params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','keys','nolimit','SmsQueueId','UserSmsQueue','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','addTeams','ids','Team','User','Agents','online','interface','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','json','count','limit','status','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','offset','order','sort','pick','filter','where','merge','type','VIRTUAL','options','SmsQueue','include','findAll','rows','catch','show'];(function(_0xfc38ec,_0x452395){var _0x3bf341=function(_0x2ba79e){while(--_0x2ba79e){_0xfc38ec['push'](_0xfc38ec['shift']());}};_0x3bf341(++_0x452395);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x506b51,_0x2d2b6d){_0x506b51=_0x506b51-0x0;var _0xca5779=_0x5ad3[_0x506b51];return _0xca5779;};'use strict';var pdf=require(_0x35ad('0x0'));var emlformat=require(_0x35ad('0x1'));var rimraf=require(_0x35ad('0x2'));var zipdir=require(_0x35ad('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35ad('0x4'));var moment=require(_0x35ad('0x5'));var BPromise=require(_0x35ad('0x6'));var Mustache=require(_0x35ad('0x7'));var util=require(_0x35ad('0x8'));var path=require(_0x35ad('0x9'));var sox=require(_0x35ad('0xa'));var csv=require(_0x35ad('0xb'));var ejs=require(_0x35ad('0xc'));var fs=require('fs');var _=require(_0x35ad('0xd'));var squel=require('squel');var crypto=require(_0x35ad('0xe'));var jsforce=require(_0x35ad('0xf'));var deskjs=require(_0x35ad('0x10'));var toCsv=require('to-csv');var querystring=require(_0x35ad('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35ad('0x12'));var qs=require(_0x35ad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35ad('0x14'));var logger=require(_0x35ad('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x35ad('0x16'));var licenseUtil=require(_0x35ad('0x17'));var db=require('../../mysqldb')['db'];config[_0x35ad('0x18')]=_[_0x35ad('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x35ad('0x1a'))(new Redis(config[_0x35ad('0x18')]));require(_0x35ad('0x1b'))['register'](socket);function respondWithStatusCode(_0x3e2676,_0x2ebceb){_0x2ebceb=_0x2ebceb||0xcc;return function(_0x591917){if(_0x591917){return _0x3e2676[_0x35ad('0x1c')](_0x2ebceb);}return _0x3e2676['status'](_0x2ebceb)['end']();};}function respondWithResult(_0x3a981a,_0x3ff2f0){_0x3ff2f0=_0x3ff2f0||0xc8;return function(_0x27efeb){if(_0x27efeb){return _0x3a981a['status'](_0x3ff2f0)[_0x35ad('0x1d')](_0x27efeb);}};}function respondWithFilteredResult(_0x2f3f27,_0x233394){return function(_0x3158a1){if(_0x3158a1){var _0x3a73c8=_0x3158a1[_0x35ad('0x1e')],_0x418416=_0x233394['offset'],_0x49e960=_0x233394['offset']+_0x233394[_0x35ad('0x1f')],_0xd32a43;if(_0x49e960>=_0x3a73c8){_0x49e960=_0x3a73c8;_0xd32a43=0xc8;}else{_0xd32a43=0xce;}_0x2f3f27[_0x35ad('0x20')](_0xd32a43);return _0x2f3f27['set'](_0x35ad('0x21'),_0x418416+'-'+_0x49e960+'/'+_0x3a73c8)[_0x35ad('0x1d')](_0x3158a1);}return null;};}function patchUpdates(_0x496620){return function(_0x37c03d){try{jsonpatch[_0x35ad('0x22')](_0x37c03d,_0x496620,!![]);}catch(_0x504cbc){return BPromise[_0x35ad('0x23')](_0x504cbc);}return _0x37c03d[_0x35ad('0x24')]();};}function saveUpdates(_0x43a6a8,_0x45e041){return function(_0x1e0527){if(_0x1e0527){return _0x1e0527[_0x35ad('0x25')](_0x43a6a8)[_0x35ad('0x26')](function(_0x4c5740){return _0x4c5740;});}return null;};}function removeEntity(_0x1cb9da,_0x1b3d01){return function(_0x47e818){if(_0x47e818){return _0x47e818[_0x35ad('0x27')]()[_0x35ad('0x26')](function(){var _0xa3cb9f=_0x47e818[_0x35ad('0x28')]({'plain':!![]});var _0x368468='SmsQueues';return db[_0x35ad('0x29')][_0x35ad('0x27')]({'where':{'type':_0x368468,'resourceId':_0xa3cb9f['id']}})[_0x35ad('0x26')](function(){return _0x47e818;});})[_0x35ad('0x26')](function(){_0x1cb9da[_0x35ad('0x20')](0xcc)[_0x35ad('0x2a')]();});}};}function handleEntityNotFound(_0x2e601a,_0xaf7237){return function(_0x5418c2){if(!_0x5418c2){_0x2e601a[_0x35ad('0x1c')](0x194);}return _0x5418c2;};}function handleError(_0x11da54,_0x2f8b3){_0x2f8b3=_0x2f8b3||0x1f4;return function(_0x34b8b9){logger[_0x35ad('0x2b')](_0x34b8b9['stack']);if(_0x34b8b9['name']){delete _0x34b8b9[_0x35ad('0x2c')];}_0x11da54['status'](_0x2f8b3)[_0x35ad('0x2d')](_0x34b8b9);};}exports['index']=function(_0x53603f,_0x589e4a){var _0x5380e5={},_0x55906e={},_0x5a60e1={'count':0x0,'rows':[]};var _0x4dc5ee=_[_0x35ad('0x2e')](db['SmsQueue'][_0x35ad('0x2f')],function(_0x51cf37){return{'name':_0x51cf37[_0x35ad('0x30')],'type':_0x51cf37['type'][_0x35ad('0x31')]};});_0x55906e['model']=_[_0x35ad('0x2e')](_0x4dc5ee,_0x35ad('0x2c'));_0x55906e[_0x35ad('0x32')]=_['keys'](_0x53603f[_0x35ad('0x32')]);_0x55906e[_0x35ad('0x33')]=_[_0x35ad('0x34')](_0x55906e[_0x35ad('0x35')],_0x55906e[_0x35ad('0x32')]);_0x5380e5['attributes']=_['intersection'](_0x55906e[_0x35ad('0x35')],qs[_0x35ad('0x36')](_0x53603f[_0x35ad('0x32')][_0x35ad('0x36')]));_0x5380e5['attributes']=_0x5380e5[_0x35ad('0x37')][_0x35ad('0x38')]?_0x5380e5[_0x35ad('0x37')]:_0x55906e[_0x35ad('0x35')];if(!_0x53603f[_0x35ad('0x32')][_0x35ad('0x39')]('nolimit')){_0x5380e5['limit']=qs[_0x35ad('0x1f')](_0x53603f[_0x35ad('0x32')][_0x35ad('0x1f')]);_0x5380e5[_0x35ad('0x3a')]=qs[_0x35ad('0x3a')](_0x53603f[_0x35ad('0x32')][_0x35ad('0x3a')]);}_0x5380e5[_0x35ad('0x3b')]=qs[_0x35ad('0x3c')](_0x53603f['query'][_0x35ad('0x3c')]);_0x5380e5['where']=qs[_0x35ad('0x33')](_[_0x35ad('0x3d')](_0x53603f[_0x35ad('0x32')],_0x55906e[_0x35ad('0x33')]),_0x4dc5ee);if(_0x53603f[_0x35ad('0x32')][_0x35ad('0x3e')]){_0x5380e5[_0x35ad('0x3f')]=_[_0x35ad('0x40')](_0x5380e5[_0x35ad('0x3f')],{'$or':_['map'](_0x4dc5ee,function(_0x200e4d){if(_0x200e4d[_0x35ad('0x41')]!==_0x35ad('0x42')){var _0x4b8453={};_0x4b8453[_0x200e4d[_0x35ad('0x2c')]]={'$like':'%'+_0x53603f[_0x35ad('0x32')][_0x35ad('0x3e')]+'%'};return _0x4b8453;}})});}_0x5380e5=_[_0x35ad('0x40')]({},_0x5380e5,_0x53603f[_0x35ad('0x43')]);var _0x2d0f86={'where':_0x5380e5[_0x35ad('0x3f')]};return db[_0x35ad('0x44')][_0x35ad('0x1e')](_0x2d0f86)[_0x35ad('0x26')](function(_0x21d730){_0x5a60e1['count']=_0x21d730;if(_0x53603f[_0x35ad('0x32')]['includeAll']){_0x5380e5[_0x35ad('0x45')]=[{'all':!![]}];}return db[_0x35ad('0x44')][_0x35ad('0x46')](_0x5380e5);})[_0x35ad('0x26')](function(_0x1785b5){_0x5a60e1[_0x35ad('0x47')]=_0x1785b5;return _0x5a60e1;})[_0x35ad('0x26')](respondWithFilteredResult(_0x589e4a,_0x5380e5))[_0x35ad('0x48')](handleError(_0x589e4a,null));};exports[_0x35ad('0x49')]=function(_0x564407,_0xdf7e22){var _0x253d02={'raw':!![],'where':{'id':_0x564407[_0x35ad('0x4a')]['id']}},_0xd184f7={};_0xd184f7[_0x35ad('0x35')]=_['keys'](db[_0x35ad('0x44')][_0x35ad('0x2f')]);_0xd184f7['query']=_['keys'](_0x564407[_0x35ad('0x32')]);_0xd184f7[_0x35ad('0x33')]=_[_0x35ad('0x34')](_0xd184f7[_0x35ad('0x35')],_0xd184f7['query']);_0x253d02[_0x35ad('0x37')]=_[_0x35ad('0x34')](_0xd184f7[_0x35ad('0x35')],qs[_0x35ad('0x36')](_0x564407[_0x35ad('0x32')][_0x35ad('0x36')]));_0x253d02[_0x35ad('0x37')]=_0x253d02['attributes'][_0x35ad('0x38')]?_0x253d02[_0x35ad('0x37')]:_0xd184f7[_0x35ad('0x35')];if(_0x564407['query']['includeAll']){_0x253d02['include']=[{'all':!![]}];}_0x253d02=_[_0x35ad('0x40')]({},_0x253d02,_0x564407[_0x35ad('0x43')]);return db[_0x35ad('0x44')][_0x35ad('0x4b')](_0x253d02)['then'](handleEntityNotFound(_0xdf7e22,null))[_0x35ad('0x26')](respondWithResult(_0xdf7e22,null))[_0x35ad('0x48')](handleError(_0xdf7e22,null));};exports[_0x35ad('0x4c')]=function(_0x2e384a,_0x43d1ab){return db[_0x35ad('0x44')]['create'](_0x2e384a['body'],{})[_0x35ad('0x26')](function(_0x3e5d31){var _0x5acc34=_0x2e384a['user'][_0x35ad('0x28')]({'plain':!![]});if(!_0x5acc34)throw new Error(_0x35ad('0x4d'));if(_0x5acc34[_0x35ad('0x4e')]==='user'){var _0x486a11=_0x3e5d31[_0x35ad('0x28')]({'plain':!![]});var _0x19bc07=_0x35ad('0x4f');return db['UserProfileSection'][_0x35ad('0x4b')]({'where':{'name':_0x19bc07,'userProfileId':_0x5acc34[_0x35ad('0x50')]},'raw':!![]})[_0x35ad('0x26')](function(_0x467887){if(_0x467887&&_0x467887[_0x35ad('0x51')]===0x0){return db[_0x35ad('0x29')]['create']({'name':_0x486a11[_0x35ad('0x2c')],'resourceId':_0x486a11['id'],'type':_0x467887[_0x35ad('0x2c')],'sectionId':_0x467887['id']},{})[_0x35ad('0x26')](function(){return _0x3e5d31;});}else{return _0x3e5d31;}})['catch'](function(_0x325b2a){logger[_0x35ad('0x2b')](_0x35ad('0x52'),_0x325b2a);throw _0x325b2a;});}return _0x3e5d31;})[_0x35ad('0x26')](respondWithResult(_0x43d1ab,0xc9))['catch'](handleError(_0x43d1ab,null));};exports['update']=function(_0x19ae62,_0x14101f){if(_0x19ae62[_0x35ad('0x53')]['id']){delete _0x19ae62[_0x35ad('0x53')]['id'];}return db[_0x35ad('0x44')]['find']({'where':{'id':_0x19ae62[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](handleEntityNotFound(_0x14101f,null))[_0x35ad('0x26')](saveUpdates(_0x19ae62[_0x35ad('0x53')],null))[_0x35ad('0x26')](respondWithResult(_0x14101f,null))[_0x35ad('0x48')](handleError(_0x14101f,null));};exports['destroy']=function(_0x579090,_0x33da9c){return db[_0x35ad('0x44')][_0x35ad('0x4b')]({'where':{'id':_0x579090[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](handleEntityNotFound(_0x33da9c,null))[_0x35ad('0x26')](removeEntity(_0x33da9c,null))[_0x35ad('0x48')](handleError(_0x33da9c,null));};exports['describe']=function(_0x1da9a7,_0x13229d){return db[_0x35ad('0x44')][_0x35ad('0x54')]()['then'](respondWithResult(_0x13229d,null))[_0x35ad('0x48')](handleError(_0x13229d,null));};exports[_0x35ad('0x55')]=function(_0x4baa80,_0x1d66c6,_0x1aed75){var _0x1da9ca={'raw':!![],'where':{}},_0x3f9607={},_0x12895c;return db[_0x35ad('0x44')][_0x35ad('0x56')]({'where':{'id':_0x4baa80[_0x35ad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d66c6,null))[_0x35ad('0x26')](function(_0x1b8823){if(_0x1b8823){_0x12895c=_0x1b8823[_0x35ad('0x28')]({'plain':!![]});_0x3f9607['model']=_[_0x35ad('0x57')](db['UserSmsQueue'][_0x35ad('0x2f')]);_0x3f9607[_0x35ad('0x32')]=_[_0x35ad('0x57')](_0x4baa80[_0x35ad('0x32')]);_0x3f9607['filters']=_[_0x35ad('0x34')](_0x3f9607[_0x35ad('0x35')],_0x3f9607[_0x35ad('0x32')]);_0x1da9ca[_0x35ad('0x37')]=_[_0x35ad('0x34')](_0x3f9607['model'],qs[_0x35ad('0x36')](_0x4baa80['query'][_0x35ad('0x36')]));_0x1da9ca[_0x35ad('0x37')]=_0x1da9ca['attributes'][_0x35ad('0x38')]?_0x1da9ca['attributes']:_0x3f9607[_0x35ad('0x35')];if(!_0x4baa80[_0x35ad('0x32')]['hasOwnProperty'](_0x35ad('0x58'))){_0x1da9ca[_0x35ad('0x1f')]=qs[_0x35ad('0x1f')](_0x4baa80[_0x35ad('0x32')][_0x35ad('0x1f')]);_0x1da9ca[_0x35ad('0x3a')]=qs[_0x35ad('0x3a')](_0x4baa80['query'][_0x35ad('0x3a')]);}_0x1da9ca[_0x35ad('0x3b')]=qs[_0x35ad('0x3c')](_0x4baa80[_0x35ad('0x32')][_0x35ad('0x3c')]);_0x1da9ca[_0x35ad('0x3f')]=qs[_0x35ad('0x33')](_['pick'](_0x4baa80[_0x35ad('0x32')],_0x3f9607[_0x35ad('0x33')]));_0x1da9ca[_0x35ad('0x3f')][_0x35ad('0x59')]=_0x1b8823['id'];if(_0x4baa80[_0x35ad('0x32')]['filter']){_0x1da9ca[_0x35ad('0x3f')]=_[_0x35ad('0x40')](_0x1da9ca['where'],{'$or':_[_0x35ad('0x2e')](_0x1da9ca[_0x35ad('0x37')],function(_0x891ab4){var _0x286543={};_0x286543[_0x891ab4]={'$like':'%'+_0x4baa80['query'][_0x35ad('0x3e')]+'%'};return _0x286543;})});}_0x1da9ca=_['merge']({},_0x1da9ca,_0x4baa80[_0x35ad('0x43')]);return db[_0x35ad('0x5a')][_0x35ad('0x46')](_0x1da9ca);}})['then'](function(_0x395370){if(_0x395370){return db['User'][_0x35ad('0x5b')]({'where':{'id':_['map'](_0x395370,'UserId'),'role':_0x35ad('0x5c')},'attributes':['id',_0x35ad('0x2c'),'smsPause',_0x35ad('0x5d'),_0x35ad('0x5e')]});}})[_0x35ad('0x26')](function(_0x511bbb){if(_0x511bbb){return{'count':_0x511bbb['count'],'rows':_['map'](_0x511bbb['rows'],function(_0x3f98a2){return{'membername':_0x3f98a2[_0x35ad('0x2c')],'UserId':_0x3f98a2['id'],'queue_name':_0x12895c[_0x35ad('0x2c')],'SmsQueueId':_0x12895c['id'],'interface':util[_0x35ad('0x5f')](_0x35ad('0x60'),_0x35ad('0x61'),_0x3f98a2['name']),'penalty':0x0,'paused':_0x3f98a2[_0x35ad('0x62')],'createdAt':_0x3f98a2[_0x35ad('0x5e')],'updatedAt':_0x3f98a2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x35ad('0x26')](respondWithFilteredResult(_0x1d66c6,_0x1da9ca))[_0x35ad('0x48')](handleError(_0x1d66c6,null));};exports['getTeams']=function(_0x18436d,_0x31f8bb,_0x4409db){var _0x2c710={};var _0x5324f4={};var _0x1e7722;var _0x11af74;return db[_0x35ad('0x44')][_0x35ad('0x56')]({'where':{'id':_0x18436d[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](handleEntityNotFound(_0x31f8bb,null))[_0x35ad('0x26')](function(_0x3dc5e5){if(_0x3dc5e5){_0x1e7722=_0x3dc5e5;_0x5324f4[_0x35ad('0x35')]=_[_0x35ad('0x57')](db['Team']['rawAttributes']);_0x5324f4[_0x35ad('0x32')]=_[_0x35ad('0x57')](_0x18436d['query']);_0x5324f4[_0x35ad('0x33')]=_[_0x35ad('0x34')](_0x5324f4[_0x35ad('0x35')],_0x5324f4[_0x35ad('0x32')]);_0x2c710[_0x35ad('0x37')]=_[_0x35ad('0x34')](_0x5324f4['model'],qs[_0x35ad('0x36')](_0x18436d[_0x35ad('0x32')][_0x35ad('0x36')]));_0x2c710[_0x35ad('0x37')]=_0x2c710[_0x35ad('0x37')][_0x35ad('0x38')]?_0x2c710[_0x35ad('0x37')]:_0x5324f4[_0x35ad('0x35')];_0x2c710['order']=qs[_0x35ad('0x3c')](_0x18436d[_0x35ad('0x32')][_0x35ad('0x3c')]);_0x2c710[_0x35ad('0x3f')]=qs['filters'](_[_0x35ad('0x3d')](_0x18436d['query'],_0x5324f4[_0x35ad('0x33')]));if(_0x18436d['query']['filter']){_0x2c710[_0x35ad('0x3f')]=_[_0x35ad('0x40')](_0x2c710[_0x35ad('0x3f')],{'$or':_['map'](_0x2c710[_0x35ad('0x37')],function(_0x52c478){var _0x4125ed={};_0x4125ed[_0x52c478]={'$like':'%'+_0x18436d[_0x35ad('0x32')][_0x35ad('0x3e')]+'%'};return _0x4125ed;})});}_0x2c710=_[_0x35ad('0x40')]({},_0x2c710,_0x18436d['options']);return _0x1e7722[_0x35ad('0x63')](_0x2c710);}})['then'](function(_0x1c3862){if(_0x1c3862){_0x11af74=_0x1c3862['length'];if(!_0x18436d[_0x35ad('0x32')][_0x35ad('0x39')]('nolimit')){_0x2c710['limit']=qs['limit'](_0x18436d[_0x35ad('0x32')][_0x35ad('0x1f')]);_0x2c710[_0x35ad('0x3a')]=qs[_0x35ad('0x3a')](_0x18436d[_0x35ad('0x32')]['offset']);}return _0x1e7722['getTeams'](_0x2c710);}})[_0x35ad('0x26')](function(_0x5ee19d){if(_0x5ee19d){return _0x5ee19d?{'count':_0x11af74,'rows':_0x5ee19d}:null;}})[_0x35ad('0x26')](respondWithResult(_0x31f8bb,null))['catch'](handleError(_0x31f8bb,null));};exports[_0x35ad('0x64')]=function(_0x343eb4,_0x777835,_0x6d8f0c){var _0x5b2b32=_0x343eb4[_0x35ad('0x53')][_0x35ad('0x65')];return db[_0x35ad('0x66')][_0x35ad('0x46')]({'where':{'id':_0x5b2b32},'attributes':['id'],'include':[{'model':db[_0x35ad('0x67')],'as':_0x35ad('0x68'),'attributes':['id',_0x35ad('0x2c'),_0x35ad('0x69'),'voicePause',_0x35ad('0x6a')],'raw':!![]}]})[_0x35ad('0x26')](function(_0x47aa75){if(_0x47aa75){var _0x496e31=_['flatMap'](_0x47aa75,function(_0x3daf3f){var _0x331090=_0x3daf3f[_0x35ad('0x28')]({'plain':!![]});return _0x331090[_0x35ad('0x68')];});return db['SmsQueue'][_0x35ad('0x4b')]({'where':{'id':_0x343eb4[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](function(_0x21a774){return db[_0x35ad('0x6b')][_0x35ad('0x6c')](function(_0x9e55cc){return _0x21a774[_0x35ad('0x64')](_0x5b2b32,{'transaction':_0x9e55cc})[_0x35ad('0x26')](function(){return BPromise[_0x35ad('0x6d')](_0x496e31,function(_0x356888){return db['UserSmsQueue'][_0x35ad('0x6e')]({'where':{'UserId':_0x356888['id'],'SmsQueueId':_0x343eb4[_0x35ad('0x4a')]['id']},'transaction':_0x9e55cc});});})[_0x35ad('0x26')](function(){_0x496e31[_0x35ad('0x6f')](function(_0xbff7b7){socket['emit']('userSmsQueue:save',{'UserId':_0xbff7b7['id'],'SmsQueueId':_0x21a774['id']});});});});});}})[_0x35ad('0x26')](respondWithStatusCode(_0x777835,null))[_0x35ad('0x48')](handleError(_0x777835,null));};exports[_0x35ad('0x70')]=function(_0xaa4bac,_0x39e513,_0xf7b5dc){return db[_0x35ad('0x66')][_0x35ad('0x46')]({'where':{'id':_0xaa4bac[_0x35ad('0x32')][_0x35ad('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35ad('0x68'),'attributes':['id'],'raw':!![]}]})[_0x35ad('0x26')](handleEntityNotFound(_0x39e513,null))[_0x35ad('0x26')](function(_0x2bdaf3){var _0x32e675=_['map'](_0x2bdaf3,'id');var _0x1a6ad4=[];var _0x1540fa=[];var _0x321530=squel[_0x35ad('0x71')]();_0x321530['field'](_0x35ad('0x72'))[_0x35ad('0x73')]('team_has_sms_queues','tq')['join'](_0x35ad('0x74'),'ut',_0x35ad('0x75'))['where'](_0x35ad('0x76'),_0xaa4bac[_0x35ad('0x4a')]['id']);for(var _0x42f2d8=0x0;_0x42f2d8<_0x2bdaf3['length'];_0x42f2d8+=0x1){let _0xb2c023=_0x2bdaf3[_0x42f2d8];for(var _0x550020=0x0;_0x550020<_0xb2c023[_0x35ad('0x68')]['length'];_0x550020+=0x1){let _0x2eb824=_0xb2c023[_0x35ad('0x68')][_0x550020];var _0xdec48a=_0x321530[_0x35ad('0x77')]();_0xdec48a[_0x35ad('0x3f')]('ut.UserId\x20=\x20?',_0x2eb824['id']);_0x1540fa[_0x35ad('0x78')](db[_0x35ad('0x6b')][_0x35ad('0x32')](_0xdec48a[_0x35ad('0x79')](),{'type':db['sequelize']['QueryTypes'][_0x35ad('0x7a')]})['then'](function(_0x1cf545){if(_0x1cf545['length']===0x1){return _0x2eb824['id'];}else{var _0xc8d2b7=_['every'](_['map'](_0x1cf545,_0x35ad('0x7b')),function(_0x5c69e3){return _[_0x35ad('0x7c')](_0x32e675,_0x5c69e3);});if(_0xc8d2b7){return _0x2eb824['id'];}}}));}}return BPromise[_0x35ad('0x7d')](_0x1540fa)[_0x35ad('0x26')](function(_0x19df6d){_0x1a6ad4=_(_0x1a6ad4)[_0x35ad('0x7e')](_0x19df6d)[_0x35ad('0x7f')]()[_0x35ad('0x80')]();return db[_0x35ad('0x44')]['find']({'where':{'id':_0xaa4bac[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](function(_0x2312a2){return db[_0x35ad('0x6b')]['transaction'](function(_0x32515d){return _0x2312a2[_0x35ad('0x70')](_0xaa4bac['query']['ids'],{'transaction':_0x32515d})[_0x35ad('0x26')](function(){if(!_[_0x35ad('0x81')](_0x1a6ad4)){return _0x2312a2[_0x35ad('0x82')](_0x1a6ad4,{'transaction':_0x32515d});}})['then'](function(){_0x1a6ad4[_0x35ad('0x6f')](function(_0x52bd6d){socket[_0x35ad('0x83')](_0x35ad('0x84'),{'UserId':_0x52bd6d,'SmsQueueId':_0x2312a2['id']});});});});});});})[_0x35ad('0x26')](respondWithStatusCode(_0x39e513,null))[_0x35ad('0x48')](handleError(_0x39e513,null));};exports[_0x35ad('0x85')]=function(_0x3dfda9,_0x142327,_0xce3f){return db[_0x35ad('0x44')]['find']({'where':{'id':_0x3dfda9[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](handleEntityNotFound(_0x142327,null))[_0x35ad('0x26')](function(_0x56c2e6){if(_0x56c2e6){return _0x56c2e6['addAgents'](_0x3dfda9[_0x35ad('0x53')][_0x35ad('0x65')],_[_0x35ad('0x86')](_0x3dfda9[_0x35ad('0x53')],['ids','id'])||{})[_0x35ad('0x87')](function(_0x290af7){for(var _0x340b3a=0x0;_0x340b3a<_0x3dfda9[_0x35ad('0x53')][_0x35ad('0x65')][_0x35ad('0x38')];_0x340b3a+=0x1){socket[_0x35ad('0x83')](_0x35ad('0x88'),{'UserId':_0x3dfda9[_0x35ad('0x53')][_0x35ad('0x65')][_0x340b3a],'SmsQueueId':_0x3dfda9['params']['id']});}return _0x290af7;});}})['then'](respondWithResult(_0x142327,null))[_0x35ad('0x48')](handleError(_0x142327,null));};exports[_0x35ad('0x82')]=function(_0x408092,_0x12e640,_0x3475da){return db[_0x35ad('0x44')][_0x35ad('0x4b')]({'where':{'id':_0x408092['params']['id']}})['then'](handleEntityNotFound(_0x12e640,null))[_0x35ad('0x26')](function(_0x1b7d67){if(_0x1b7d67){return _0x1b7d67['removeAgents'](_0x408092['query'][_0x35ad('0x65')])['then'](function(){if(_[_0x35ad('0x89')](_0x408092[_0x35ad('0x32')][_0x35ad('0x65')])){for(var _0x5e45dc=0x0;_0x5e45dc<_0x408092['query']['ids'][_0x35ad('0x38')];_0x5e45dc+=0x1){socket[_0x35ad('0x83')](_0x35ad('0x84'),{'UserId':Number(_0x408092[_0x35ad('0x32')][_0x35ad('0x65')][_0x5e45dc]),'SmsQueueId':Number(_0x408092[_0x35ad('0x4a')]['id'])});}}else{socket[_0x35ad('0x83')](_0x35ad('0x84'),{'UserId':Number(_0x408092['query'][_0x35ad('0x65')]),'SmsQueueId':Number(_0x408092[_0x35ad('0x4a')]['id'])});}});}})[_0x35ad('0x26')](respondWithStatusCode(_0x12e640,null))[_0x35ad('0x48')](handleError(_0x12e640,null));};exports['getAgents']=function(_0x3e8acb,_0x4eefd5,_0x42446f){var _0x2e376b={};var _0x2318fc={};var _0x7fccfc;var _0x5e742a;return db[_0x35ad('0x44')][_0x35ad('0x56')]({'where':{'id':_0x3e8acb[_0x35ad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4eefd5,null))[_0x35ad('0x26')](function(_0x104537){if(_0x104537){_0x7fccfc=_0x104537;_0x2318fc[_0x35ad('0x35')]=_[_0x35ad('0x57')](db[_0x35ad('0x67')][_0x35ad('0x2f')]);_0x2318fc['query']=_[_0x35ad('0x57')](_0x3e8acb[_0x35ad('0x32')]);_0x2318fc[_0x35ad('0x33')]=_[_0x35ad('0x34')](_0x2318fc[_0x35ad('0x35')],_0x2318fc[_0x35ad('0x32')]);_0x2e376b[_0x35ad('0x37')]=_[_0x35ad('0x34')](_0x2318fc[_0x35ad('0x35')],qs[_0x35ad('0x36')](_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x36')]));_0x2e376b[_0x35ad('0x37')]=_0x2e376b[_0x35ad('0x37')][_0x35ad('0x38')]?_0x2e376b[_0x35ad('0x37')]:_0x2318fc[_0x35ad('0x35')];_0x2e376b['order']=qs[_0x35ad('0x3c')](_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x3c')]);_0x2e376b[_0x35ad('0x3f')]=qs[_0x35ad('0x33')](_[_0x35ad('0x3d')](_0x3e8acb[_0x35ad('0x32')],_0x2318fc[_0x35ad('0x33')]));if(_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x3e')]){_0x2e376b[_0x35ad('0x3f')]=_['merge'](_0x2e376b[_0x35ad('0x3f')],{'$or':_['map'](_0x2e376b[_0x35ad('0x37')],function(_0x5b0f18){var _0x44cd29={};_0x44cd29[_0x5b0f18]={'$like':'%'+_0x3e8acb['query'][_0x35ad('0x3e')]+'%'};return _0x44cd29;})});}_0x2e376b=_[_0x35ad('0x40')]({},_0x2e376b,_0x3e8acb[_0x35ad('0x43')]);return _0x7fccfc[_0x35ad('0x8a')](_0x2e376b);}})[_0x35ad('0x26')](function(_0x4867a9){if(_0x4867a9){_0x5e742a=_0x4867a9[_0x35ad('0x38')];if(!_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x39')](_0x35ad('0x58'))){_0x2e376b['limit']=qs[_0x35ad('0x1f')](_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x1f')]);_0x2e376b['offset']=qs['offset'](_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x3a')]);}return _0x7fccfc[_0x35ad('0x8a')](_0x2e376b);}})[_0x35ad('0x26')](function(_0x1ed24d){if(_0x1ed24d){return _0x1ed24d?{'count':_0x5e742a,'rows':_0x1ed24d}:null;}})[_0x35ad('0x26')](respondWithResult(_0x4eefd5,null))[_0x35ad('0x48')](handleError(_0x4eefd5,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 6cc317f..93abbdd 100644 --- a/server/api/smsQueue/smsQueue.events.js +++ b/server/api/smsQueue/smsQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4aec=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x4aec,0x145));var _0xc4ae=function(_0x4cc8fd,_0x89bd2b){_0x4cc8fd=_0x4cc8fd-0x0;var _0x4e02b1=_0x4aec[_0x4cc8fd];return _0x4e02b1;};'use strict';var EventEmitter=require(_0xc4ae('0x0'));var SmsQueue=require(_0xc4ae('0x1'))['db'][_0xc4ae('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc4ae('0x3')](0x0);var events={'afterCreate':_0xc4ae('0x4'),'afterUpdate':_0xc4ae('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2e1c59){return function(_0x4ab321,_0x24db9c,_0x59d004){SmsQueueEvents[_0xc4ae('0x6')](_0x2e1c59+':'+_0x4ab321['id'],_0x4ab321);SmsQueueEvents[_0xc4ae('0x6')](_0x2e1c59,_0x4ab321);_0x59d004(null);};}for(var e in events){if(events[_0xc4ae('0x7')](e)){var event=events[e];SmsQueue[_0xc4ae('0x8')](e,emitEvent(event));}}module[_0xc4ae('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x916c=['save','update','emit','exports','events','SmsQueue','setMaxListeners'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x916c,0x6d));var _0xc916=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x916c[_0x5b561d];return _0x431060;};'use strict';var EventEmitter=require(_0xc916('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xc916('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc916('0x2')](0x0);var events={'afterCreate':_0xc916('0x3'),'afterUpdate':_0xc916('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2f6379){return function(_0xc6419e,_0x4aa50e,_0x19bd36){SmsQueueEvents[_0xc916('0x5')](_0x2f6379+':'+_0xc6419e['id'],_0xc6419e);SmsQueueEvents[_0xc916('0x5')](_0x2f6379,_0xc6419e);_0x19bd36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xc916('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 84462cd..0a682be 100644 --- a/server/api/smsQueue/smsQueue.model.js +++ b/server/api/smsQueue/smsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x194f=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','sms_queues'];(function(_0x260b70,_0x46318f){var _0x50f55a=function(_0x1c61b4){while(--_0x1c61b4){_0x260b70['push'](_0x260b70['shift']());}};_0x50f55a(++_0x46318f);}(_0x194f,0x1b0));var _0xf194=function(_0x22f4af,_0x481c37){_0x22f4af=_0x22f4af-0x0;var _0x11a28c=_0x194f[_0x22f4af];return _0x11a28c;};'use strict';var _=require('lodash');var util=require(_0xf194('0x0'));var logger=require('../../config/logger')(_0xf194('0x1'));var moment=require('moment');var BPromise=require(_0xf194('0x2'));var rp=require(_0xf194('0x3'));var fs=require('fs');var path=require(_0xf194('0x4'));var rimraf=require(_0xf194('0x5'));var config=require(_0xf194('0x6'));var attributes=require(_0xf194('0x7'));module['exports']=function(_0x2773e1,_0xee6727){return _0x2773e1['define']('SmsQueue',attributes,{'tableName':_0xf194('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2882=['../../config/environment','./smsQueue.attributes','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3c0c96,_0x449674){var _0x1780ec=function(_0x395465){while(--_0x395465){_0x3c0c96['push'](_0x3c0c96['shift']());}};_0x1780ec(++_0x449674);}(_0x2882,0xb8));var _0x2288=function(_0x4efe53,_0x4fbfc5){_0x4efe53=_0x4efe53-0x0;var _0x5846d2=_0x2882[_0x4efe53];return _0x5846d2;};'use strict';var _=require(_0x2288('0x0'));var util=require(_0x2288('0x1'));var logger=require(_0x2288('0x2'))(_0x2288('0x3'));var moment=require(_0x2288('0x4'));var BPromise=require(_0x2288('0x5'));var rp=require(_0x2288('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2288('0x7'));var config=require(_0x2288('0x8'));var attributes=require(_0x2288('0x9'));module['exports']=function(_0x4dce99,_0x4b7061){return _0x4dce99['define'](_0x2288('0xa'),attributes,{'tableName':_0x2288('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index d7fd1c8..b8e9f24 100644 --- a/server/api/smsQueue/smsQueue.rpc.js +++ b/server/api/smsQueue/smsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cb9=['defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','SmsQueue','options','raw','limit','include','map','model','attributes','debug','ShowSmsQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x8cb9,0x120));var _0x98cb=function(_0x229fd6,_0x14619a){_0x229fd6=_0x229fd6-0x0;var _0x39e9b8=_0x8cb9[_0x229fd6];return _0x39e9b8;};'use strict';var _=require(_0x98cb('0x0'));var util=require(_0x98cb('0x1'));var moment=require(_0x98cb('0x2'));var BPromise=require(_0x98cb('0x3'));var rs=require(_0x98cb('0x4'));var fs=require('fs');var Redis=require(_0x98cb('0x5'));var db=require(_0x98cb('0x6'))['db'];var utils=require(_0x98cb('0x7'));var logger=require(_0x98cb('0x8'))('rpc');var config=require(_0x98cb('0x9'));var jayson=require(_0x98cb('0xa'));var client=jayson['client'][_0x98cb('0xb')]({'port':0x232a});config[_0x98cb('0xc')]=_[_0x98cb('0xd')](config[_0x98cb('0xc')],{'host':_0x98cb('0xe'),'port':0x18eb});var socket=require(_0x98cb('0xf'))(new Redis(config[_0x98cb('0xc')]));require(_0x98cb('0x10'))[_0x98cb('0x11')](socket);function respondWithRpcPromise(_0x289898,_0x39f8d0,_0x306ecd){return new BPromise(function(_0x1cf2d2,_0x404c35){return client[_0x98cb('0x12')](_0x289898,_0x306ecd)[_0x98cb('0x13')](function(_0x1aa2b9){logger[_0x98cb('0x14')]('SmsQueue,\x20%s,\x20%s',_0x39f8d0,_0x98cb('0x15'));logger['debug'](_0x98cb('0x16'),_0x39f8d0,'request\x20sent',JSON[_0x98cb('0x17')](_0x1aa2b9));if(_0x1aa2b9[_0x98cb('0x18')]){if(_0x1aa2b9[_0x98cb('0x18')][_0x98cb('0x19')]===0x1f4){logger['error'](_0x98cb('0x1a'),_0x39f8d0,_0x1aa2b9[_0x98cb('0x18')][_0x98cb('0x1b')]);return _0x404c35(_0x1aa2b9[_0x98cb('0x18')][_0x98cb('0x1b')]);}logger[_0x98cb('0x18')](_0x98cb('0x1a'),_0x39f8d0,_0x1aa2b9[_0x98cb('0x18')][_0x98cb('0x1b')]);return _0x1cf2d2(_0x1aa2b9['error'][_0x98cb('0x1b')]);}else{logger[_0x98cb('0x14')](_0x98cb('0x1a'),_0x39f8d0,_0x98cb('0x15'));_0x1cf2d2(_0x1aa2b9[_0x98cb('0x1c')]['message']);}})[_0x98cb('0x1d')](function(_0xe4dad1){logger['error']('SmsQueue,\x20%s,\x20%s',_0x39f8d0,_0xe4dad1);_0x404c35(_0xe4dad1);});});}exports[_0x98cb('0x1e')]=function(_0x1f18d2){var _0x5acf75=this;return new Promise(function(_0x3610d2,_0x4ac19a){return db[_0x98cb('0x1f')]['findAll']({'raw':_0x1f18d2[_0x98cb('0x20')]?_0x1f18d2['options'][_0x98cb('0x21')]===undefined?!![]:![]:!![],'where':_0x1f18d2[_0x98cb('0x20')]?_0x1f18d2['options']['where']||null:null,'attributes':_0x1f18d2['options']?_0x1f18d2[_0x98cb('0x20')]['attributes']||null:null,'limit':_0x1f18d2[_0x98cb('0x20')]?_0x1f18d2[_0x98cb('0x20')][_0x98cb('0x22')]||null:null,'include':_0x1f18d2[_0x98cb('0x20')]?_0x1f18d2[_0x98cb('0x20')][_0x98cb('0x23')]?_[_0x98cb('0x24')](_0x1f18d2[_0x98cb('0x20')]['include'],function(_0x35c0ea){return{'model':db[_0x35c0ea[_0x98cb('0x25')]],'as':_0x35c0ea['as'],'attributes':_0x35c0ea[_0x98cb('0x26')],'include':_0x35c0ea['include']?_[_0x98cb('0x24')](_0x35c0ea['include'],function(_0x4d4b45){return{'model':db[_0x4d4b45[_0x98cb('0x25')]],'as':_0x4d4b45['as'],'attributes':_0x4d4b45[_0x98cb('0x26')],'include':_0x4d4b45[_0x98cb('0x23')]?_['map'](_0x4d4b45[_0x98cb('0x23')],function(_0x36ca09){return{'model':db[_0x36ca09[_0x98cb('0x25')]],'as':_0x36ca09['as'],'attributes':_0x36ca09['attributes']};}):[]};}):[]};}):[]:[]})[_0x98cb('0x13')](function(_0x31c87e){logger[_0x98cb('0x14')](_0x98cb('0x1e'),_0x1f18d2);logger[_0x98cb('0x27')](_0x98cb('0x1e'),_0x1f18d2,JSON[_0x98cb('0x17')](_0x31c87e));_0x3610d2(_0x31c87e);})[_0x98cb('0x1d')](function(_0x17efc8){logger[_0x98cb('0x18')]('GetSmsQueue',_0x17efc8[_0x98cb('0x1b')],_0x1f18d2);_0x4ac19a(_0x5acf75['error'](0x1f4,_0x17efc8[_0x98cb('0x1b')]));});});};exports[_0x98cb('0x28')]=function(_0x2c4687){var _0x518898=this;return new Promise(function(_0xd98527,_0x4bb8bf){return db[_0x98cb('0x1f')][_0x98cb('0x29')]({'raw':_0x2c4687['options']?_0x2c4687[_0x98cb('0x20')][_0x98cb('0x21')]===undefined?!![]:![]:!![],'where':_0x2c4687[_0x98cb('0x20')]?_0x2c4687[_0x98cb('0x20')][_0x98cb('0x2a')]||null:null,'attributes':_0x2c4687[_0x98cb('0x20')]?_0x2c4687[_0x98cb('0x20')][_0x98cb('0x26')]||null:null,'include':_0x2c4687[_0x98cb('0x20')]?_0x2c4687[_0x98cb('0x20')][_0x98cb('0x23')]?_[_0x98cb('0x24')](_0x2c4687[_0x98cb('0x20')][_0x98cb('0x23')],function(_0x3c5428){return{'model':db[_0x3c5428['model']],'as':_0x3c5428['as'],'attributes':_0x3c5428[_0x98cb('0x26')],'include':_0x3c5428['include']?_[_0x98cb('0x24')](_0x3c5428[_0x98cb('0x23')],function(_0x30515a){return{'model':db[_0x30515a[_0x98cb('0x25')]],'as':_0x30515a['as'],'attributes':_0x30515a[_0x98cb('0x26')],'include':_0x30515a[_0x98cb('0x23')]?_[_0x98cb('0x24')](_0x30515a['include'],function(_0x42f6ee){return{'model':db[_0x42f6ee[_0x98cb('0x25')]],'as':_0x42f6ee['as'],'attributes':_0x42f6ee[_0x98cb('0x26')]};}):[]};}):[]};}):[]:[]})[_0x98cb('0x13')](function(_0x25aa8c){logger[_0x98cb('0x14')](_0x98cb('0x28'),_0x2c4687);logger[_0x98cb('0x27')](_0x98cb('0x28'),_0x2c4687,JSON[_0x98cb('0x17')](_0x25aa8c));_0xd98527(_0x25aa8c);})[_0x98cb('0x1d')](function(_0x6d2434){logger[_0x98cb('0x18')]('ShowSmsQueue',_0x6d2434[_0x98cb('0x1b')],_0x2c4687);_0x4bb8bf(_0x518898[_0x98cb('0x18')](0x1f4,_0x6d2434[_0x98cb('0x1b')]));});});}; \ No newline at end of file +var _0xdc45=['defaults','localhost','./smsQueue.socket','register','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue','SmsQueue','options','where','attributes','limit','include','model','map','ShowSmsQueue','find','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x4a3823,_0x2f868f){var _0x146fb0=function(_0x200502){while(--_0x200502){_0x4a3823['push'](_0x4a3823['shift']());}};_0x146fb0(++_0x2f868f);}(_0xdc45,0xd4));var _0x5dc4=function(_0x28cddc,_0x1be16d){_0x28cddc=_0x28cddc-0x0;var _0x5ce855=_0xdc45[_0x28cddc];return _0x5ce855;};'use strict';var _=require(_0x5dc4('0x0'));var util=require(_0x5dc4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dc4('0x2'));var db=require(_0x5dc4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dc4('0x4'))(_0x5dc4('0x5'));var config=require(_0x5dc4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5dc4('0x7')][_0x5dc4('0x8')]({'port':0x232a});config[_0x5dc4('0x9')]=_[_0x5dc4('0xa')](config[_0x5dc4('0x9')],{'host':_0x5dc4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5dc4('0x9')]));require(_0x5dc4('0xc'))[_0x5dc4('0xd')](socket);function respondWithRpcPromise(_0x23106e,_0x13384e,_0x5e9d9e){return new BPromise(function(_0x42de15,_0x218a4c){return client['request'](_0x23106e,_0x5e9d9e)[_0x5dc4('0xe')](function(_0x3c7b21){logger['info']('SmsQueue,\x20%s,\x20%s',_0x13384e,_0x5dc4('0xf'));logger[_0x5dc4('0x10')](_0x5dc4('0x11'),_0x13384e,_0x5dc4('0xf'),JSON[_0x5dc4('0x12')](_0x3c7b21));if(_0x3c7b21[_0x5dc4('0x13')]){if(_0x3c7b21[_0x5dc4('0x13')][_0x5dc4('0x14')]===0x1f4){logger[_0x5dc4('0x13')](_0x5dc4('0x15'),_0x13384e,_0x3c7b21[_0x5dc4('0x13')][_0x5dc4('0x16')]);return _0x218a4c(_0x3c7b21[_0x5dc4('0x13')]['message']);}logger[_0x5dc4('0x13')](_0x5dc4('0x15'),_0x13384e,_0x3c7b21['error'][_0x5dc4('0x16')]);return _0x42de15(_0x3c7b21[_0x5dc4('0x13')][_0x5dc4('0x16')]);}else{logger[_0x5dc4('0x17')](_0x5dc4('0x15'),_0x13384e,'request\x20sent');_0x42de15(_0x3c7b21[_0x5dc4('0x18')][_0x5dc4('0x16')]);}})[_0x5dc4('0x19')](function(_0x19f3ef){logger[_0x5dc4('0x13')](_0x5dc4('0x15'),_0x13384e,_0x19f3ef);_0x218a4c(_0x19f3ef);});});}exports[_0x5dc4('0x1a')]=function(_0x37216d){var _0x1bf57b=this;return new Promise(function(_0x5befc0,_0x1d7b39){return db[_0x5dc4('0x1b')]['findAll']({'raw':_0x37216d['options']?_0x37216d[_0x5dc4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x37216d[_0x5dc4('0x1c')]?_0x37216d['options'][_0x5dc4('0x1d')]||null:null,'attributes':_0x37216d[_0x5dc4('0x1c')]?_0x37216d[_0x5dc4('0x1c')][_0x5dc4('0x1e')]||null:null,'limit':_0x37216d[_0x5dc4('0x1c')]?_0x37216d[_0x5dc4('0x1c')][_0x5dc4('0x1f')]||null:null,'include':_0x37216d['options']?_0x37216d[_0x5dc4('0x1c')][_0x5dc4('0x20')]?_['map'](_0x37216d[_0x5dc4('0x1c')][_0x5dc4('0x20')],function(_0x528e7c){return{'model':db[_0x528e7c[_0x5dc4('0x21')]],'as':_0x528e7c['as'],'attributes':_0x528e7c['attributes'],'include':_0x528e7c['include']?_[_0x5dc4('0x22')](_0x528e7c[_0x5dc4('0x20')],function(_0x3c9484){return{'model':db[_0x3c9484[_0x5dc4('0x21')]],'as':_0x3c9484['as'],'attributes':_0x3c9484[_0x5dc4('0x1e')],'include':_0x3c9484['include']?_[_0x5dc4('0x22')](_0x3c9484[_0x5dc4('0x20')],function(_0x44971c){return{'model':db[_0x44971c['model']],'as':_0x44971c['as'],'attributes':_0x44971c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5dc4('0xe')](function(_0x1cf23b){logger[_0x5dc4('0x17')]('GetSmsQueue',_0x37216d);logger['debug'](_0x5dc4('0x1a'),_0x37216d,JSON[_0x5dc4('0x12')](_0x1cf23b));_0x5befc0(_0x1cf23b);})[_0x5dc4('0x19')](function(_0x4b9f60){logger[_0x5dc4('0x13')](_0x5dc4('0x1a'),_0x4b9f60[_0x5dc4('0x16')],_0x37216d);_0x1d7b39(_0x1bf57b[_0x5dc4('0x13')](0x1f4,_0x4b9f60[_0x5dc4('0x16')]));});});};exports[_0x5dc4('0x23')]=function(_0x468016){var _0x299da0=this;return new Promise(function(_0x4ca818,_0x372836){return db[_0x5dc4('0x1b')][_0x5dc4('0x24')]({'raw':_0x468016[_0x5dc4('0x1c')]?_0x468016[_0x5dc4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x468016['options']?_0x468016[_0x5dc4('0x1c')][_0x5dc4('0x1d')]||null:null,'attributes':_0x468016[_0x5dc4('0x1c')]?_0x468016[_0x5dc4('0x1c')][_0x5dc4('0x1e')]||null:null,'include':_0x468016[_0x5dc4('0x1c')]?_0x468016[_0x5dc4('0x1c')][_0x5dc4('0x20')]?_[_0x5dc4('0x22')](_0x468016[_0x5dc4('0x1c')][_0x5dc4('0x20')],function(_0x22d400){return{'model':db[_0x22d400['model']],'as':_0x22d400['as'],'attributes':_0x22d400[_0x5dc4('0x1e')],'include':_0x22d400[_0x5dc4('0x20')]?_['map'](_0x22d400[_0x5dc4('0x20')],function(_0x5783ad){return{'model':db[_0x5783ad[_0x5dc4('0x21')]],'as':_0x5783ad['as'],'attributes':_0x5783ad[_0x5dc4('0x1e')],'include':_0x5783ad[_0x5dc4('0x20')]?_['map'](_0x5783ad['include'],function(_0x15e9a7){return{'model':db[_0x15e9a7[_0x5dc4('0x21')]],'as':_0x15e9a7['as'],'attributes':_0x15e9a7[_0x5dc4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5dc4('0xe')](function(_0x3bc8d2){logger[_0x5dc4('0x17')]('ShowSmsQueue',_0x468016);logger[_0x5dc4('0x10')](_0x5dc4('0x23'),_0x468016,JSON[_0x5dc4('0x12')](_0x3bc8d2));_0x4ca818(_0x3bc8d2);})[_0x5dc4('0x19')](function(_0x28d142){logger['error'](_0x5dc4('0x23'),_0x28d142[_0x5dc4('0x16')],_0x468016);_0x372836(_0x299da0[_0x5dc4('0x13')](0x1f4,_0x28d142['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0b326ac..464b4ae 100644 --- a/server/api/smsQueue/smsQueue.socket.js +++ b/server/api/smsQueue/smsQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd301=['./smsQueue.events','remove','update','emit','removeListener','register','smsQueue:'];(function(_0x4adb8c,_0x293ef4){var _0x3279ce=function(_0x20f57b){while(--_0x20f57b){_0x4adb8c['push'](_0x4adb8c['shift']());}};_0x3279ce(++_0x293ef4);}(_0xd301,0xfc));var _0x1d30=function(_0x381985,_0x56911e){_0x381985=_0x381985-0x0;var _0x1617bb=_0xd301[_0x381985];return _0x1617bb;};'use strict';var SmsQueueEvents=require(_0x1d30('0x0'));var events=['save',_0x1d30('0x1'),_0x1d30('0x2')];function createListener(_0x53427a,_0x280a39){return function(_0x164054){_0x280a39[_0x1d30('0x3')](_0x53427a,_0x164054);};}function removeListener(_0x34ec68,_0x102bd1){return function(){SmsQueueEvents[_0x1d30('0x4')](_0x34ec68,_0x102bd1);};}exports[_0x1d30('0x5')]=function(_0x314ed2){for(var _0x302118=0x0,_0x17165d=events['length'];_0x302118<_0x17165d;_0x302118++){var _0x13f7eb=events[_0x302118];var _0x23005f=createListener(_0x1d30('0x6')+_0x13f7eb,_0x314ed2);SmsQueueEvents['on'](_0x13f7eb,_0x23005f);}}; \ No newline at end of file +var _0xf22c=['removeListener','register','smsQueue:','./smsQueue.events','save','update','emit'];(function(_0x412d17,_0x298f1d){var _0x7e9095=function(_0x3e6a7a){while(--_0x3e6a7a){_0x412d17['push'](_0x412d17['shift']());}};_0x7e9095(++_0x298f1d);}(_0xf22c,0x9d));var _0xcf22=function(_0x258caf,_0x34ec5b){_0x258caf=_0x258caf-0x0;var _0x47a00c=_0xf22c[_0x258caf];return _0x47a00c;};'use strict';var SmsQueueEvents=require(_0xcf22('0x0'));var events=[_0xcf22('0x1'),'remove',_0xcf22('0x2')];function createListener(_0x68e0aa,_0x523562){return function(_0x191876){_0x523562[_0xcf22('0x3')](_0x68e0aa,_0x191876);};}function removeListener(_0x4a6bb9,_0x3a0418){return function(){SmsQueueEvents[_0xcf22('0x4')](_0x4a6bb9,_0x3a0418);};}exports[_0xcf22('0x5')]=function(_0x559cbf){for(var _0x3288f8=0x0,_0x24ee57=events['length'];_0x3288f8<_0x24ee57;_0x3288f8++){var _0x8781a8=events[_0x3288f8];var _0x1e627=createListener(_0xcf22('0x6')+_0x8781a8,_0x559cbf);SmsQueueEvents['on'](_0x8781a8,_0x1e627);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 31efea9..b4bc067 100644 --- a/server/api/smsQueueReport/index.js +++ b/server/api/smsQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef1=['../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x2cebc0,_0x340793){var _0x2afa6e=function(_0x5da5e7){while(--_0x5da5e7){_0x2cebc0['push'](_0x2cebc0['shift']());}};_0x2afa6e(++_0x340793);}(_0x2ef1,0x163));var _0x12ef=function(_0x368929,_0x10a531){_0x368929=_0x368929-0x0;var _0x2229b0=_0x2ef1[_0x368929];return _0x2229b0;};'use strict';var multer=require(_0x12ef('0x0'));var util=require(_0x12ef('0x1'));var path=require('path');var timeout=require(_0x12ef('0x2'));var express=require(_0x12ef('0x3'));var router=express[_0x12ef('0x4')]();var auth=require(_0x12ef('0x5'));var interaction=require(_0x12ef('0x6'));var config=require('../../config/environment');var controller=require(_0x12ef('0x7'));router[_0x12ef('0x8')]('/',auth['isAuthenticated'](),controller[_0x12ef('0x9')]);router[_0x12ef('0x8')](_0x12ef('0xa'),auth[_0x12ef('0xb')](),controller['describe']);router[_0x12ef('0x8')](_0x12ef('0xc'),auth[_0x12ef('0xb')](),controller[_0x12ef('0xd')]);router['post']('/',auth[_0x12ef('0xb')](),controller['create']);router[_0x12ef('0xe')](_0x12ef('0xc'),auth['isAuthenticated'](),controller[_0x12ef('0xf')]);router['delete']('/:id',auth[_0x12ef('0xb')](),controller[_0x12ef('0x10')]);module[_0x12ef('0x11')]=router; \ No newline at end of file +var _0xf6ef=['multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0xf6ef,0xcc));var _0xff6e=function(_0x16b77e,_0x4a56a3){_0x16b77e=_0x16b77e-0x0;var _0x3ae284=_0xf6ef[_0x16b77e];return _0x3ae284;};'use strict';var multer=require(_0xff6e('0x0'));var util=require('util');var path=require(_0xff6e('0x1'));var timeout=require('connect-timeout');var express=require(_0xff6e('0x2'));var router=express['Router']();var auth=require(_0xff6e('0x3'));var interaction=require(_0xff6e('0x4'));var config=require(_0xff6e('0x5'));var controller=require('./smsQueueReport.controller');router[_0xff6e('0x6')]('/',auth[_0xff6e('0x7')](),controller[_0xff6e('0x8')]);router[_0xff6e('0x6')]('/describe',auth[_0xff6e('0x7')](),controller['describe']);router[_0xff6e('0x6')]('/:id',auth[_0xff6e('0x7')](),controller[_0xff6e('0x9')]);router[_0xff6e('0xa')]('/',auth[_0xff6e('0x7')](),controller[_0xff6e('0xb')]);router[_0xff6e('0xc')](_0xff6e('0xd'),auth[_0xff6e('0x7')](),controller[_0xff6e('0xe')]);router['delete'](_0xff6e('0xd'),auth[_0xff6e('0x7')](),controller[_0xff6e('0xf')]);module[_0xff6e('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c9ed586..b1203a3 100644 --- a/server/api/smsQueueReport/smsQueueReport.attributes.js +++ b/server/api/smsQueueReport/smsQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9b3=['STRING','DATE','moment','exports'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xc9b3,0x13a));var _0x3c9b=function(_0xdab42b,_0x584ecf){_0xdab42b=_0xdab42b-0x0;var _0x32a7af=_0xc9b3[_0xdab42b];return _0x32a7af;};'use strict';var moment=require(_0x3c9b('0x0'));var Sequelize=require('sequelize');module[_0x3c9b('0x1')]={'uniqueid':{'type':Sequelize[_0x3c9b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3c9b('0x2')]},'joinAt':{'type':Sequelize[_0x3c9b('0x3')]},'leaveAt':{'type':Sequelize[_0x3c9b('0x3')]},'acceptAt':{'type':Sequelize[_0x3c9b('0x3')]},'exitAt':{'type':Sequelize[_0x3c9b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2b3d=['moment','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2b3d,0x1c7));var _0xd2b3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2b3d[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0xd2b3('0x0'));var Sequelize=require(_0xd2b3('0x1'));module[_0xd2b3('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd2b3('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd2b3('0x4')]},'acceptAt':{'type':Sequelize[_0xd2b3('0x4')]},'exitAt':{'type':Sequelize[_0xd2b3('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b8e96b9..a104ec1 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf409=['update','then','error','stack','send','index','map','SmsQueueReport','rawAttributes','type','model','name','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save'];(function(_0x4bc4f3,_0xb93bd2){var _0x478fab=function(_0x2404ea){while(--_0x2404ea){_0x4bc4f3['push'](_0x4bc4f3['shift']());}};_0x478fab(++_0xb93bd2);}(_0xf409,0x1cf));var _0x9f40=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xf409[_0x4ae625];return _0x31accf;};'use strict';var pdf=require(_0x9f40('0x0'));var emlformat=require(_0x9f40('0x1'));var rimraf=require(_0x9f40('0x2'));var zipdir=require(_0x9f40('0x3'));var jsonpatch=require(_0x9f40('0x4'));var rp=require(_0x9f40('0x5'));var moment=require(_0x9f40('0x6'));var BPromise=require(_0x9f40('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9f40('0x8'));var fs=require('fs');var _=require(_0x9f40('0x9'));var squel=require(_0x9f40('0xa'));var crypto=require(_0x9f40('0xb'));var jsforce=require(_0x9f40('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9f40('0xd'));var Papa=require('papaparse');var Redis=require(_0x9f40('0xe'));var authService=require(_0x9f40('0xf'));var qs=require(_0x9f40('0x10'));var as=require(_0x9f40('0x11'));var hardwareService=require(_0x9f40('0x12'));var logger=require(_0x9f40('0x13'))(_0x9f40('0x14'));var utils=require('../../config/utils');var config=require(_0x9f40('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f40('0x16'))['db'];function respondWithStatusCode(_0x98a905,_0x4db5a2){_0x4db5a2=_0x4db5a2||0xcc;return function(_0x476b59){if(_0x476b59){return _0x98a905[_0x9f40('0x17')](_0x4db5a2);}return _0x98a905[_0x9f40('0x18')](_0x4db5a2)[_0x9f40('0x19')]();};}function respondWithResult(_0x2f6f63,_0x38d419){_0x38d419=_0x38d419||0xc8;return function(_0x52fa66){if(_0x52fa66){return _0x2f6f63[_0x9f40('0x18')](_0x38d419)['json'](_0x52fa66);}};}function respondWithFilteredResult(_0x410a57,_0x5328d8){return function(_0x13641c){if(_0x13641c){var _0x2e176a=_0x13641c[_0x9f40('0x1a')],_0x3b77bf=_0x5328d8[_0x9f40('0x1b')],_0x55a8a5=_0x5328d8[_0x9f40('0x1b')]+_0x5328d8[_0x9f40('0x1c')],_0x49127d;if(_0x55a8a5>=_0x2e176a){_0x55a8a5=_0x2e176a;_0x49127d=0xc8;}else{_0x49127d=0xce;}_0x410a57['status'](_0x49127d);return _0x410a57[_0x9f40('0x1d')](_0x9f40('0x1e'),_0x3b77bf+'-'+_0x55a8a5+'/'+_0x2e176a)[_0x9f40('0x1f')](_0x13641c);}return null;};}function patchUpdates(_0x4afa95){return function(_0x2a1e37){try{jsonpatch['apply'](_0x2a1e37,_0x4afa95,!![]);}catch(_0x2b0866){return BPromise[_0x9f40('0x20')](_0x2b0866);}return _0x2a1e37[_0x9f40('0x21')]();};}function saveUpdates(_0x41b042,_0x4ab98c){return function(_0x4aabdc){if(_0x4aabdc){return _0x4aabdc[_0x9f40('0x22')](_0x41b042)[_0x9f40('0x23')](function(_0x101270){return _0x101270;});}return null;};}function removeEntity(_0x4f66a4,_0x4c5335){return function(_0x10ce0b){if(_0x10ce0b){return _0x10ce0b['destroy']()[_0x9f40('0x23')](function(){_0x4f66a4['status'](0xcc)[_0x9f40('0x19')]();});}};}function handleEntityNotFound(_0x5b1b73,_0x149b52){return function(_0x319ed9){if(!_0x319ed9){_0x5b1b73['sendStatus'](0x194);}return _0x319ed9;};}function handleError(_0xbc5968,_0x4a448e){_0x4a448e=_0x4a448e||0x1f4;return function(_0x2bdad2){logger[_0x9f40('0x24')](_0x2bdad2[_0x9f40('0x25')]);if(_0x2bdad2['name']){delete _0x2bdad2['name'];}_0xbc5968[_0x9f40('0x18')](_0x4a448e)[_0x9f40('0x26')](_0x2bdad2);};}exports[_0x9f40('0x27')]=function(_0x597cca,_0x301255){var _0x2b7a70={},_0x552253={},_0x3a7a61={'count':0x0,'rows':[]};var _0x3907eb=_[_0x9f40('0x28')](db[_0x9f40('0x29')][_0x9f40('0x2a')],function(_0x44f544){return{'name':_0x44f544['fieldName'],'type':_0x44f544[_0x9f40('0x2b')]['key']};});_0x552253[_0x9f40('0x2c')]=_[_0x9f40('0x28')](_0x3907eb,_0x9f40('0x2d'));_0x552253[_0x9f40('0x2e')]=_['keys'](_0x597cca[_0x9f40('0x2e')]);_0x552253[_0x9f40('0x2f')]=_['intersection'](_0x552253[_0x9f40('0x2c')],_0x552253[_0x9f40('0x2e')]);_0x2b7a70[_0x9f40('0x30')]=_['intersection'](_0x552253[_0x9f40('0x2c')],qs[_0x9f40('0x31')](_0x597cca['query'][_0x9f40('0x31')]));_0x2b7a70[_0x9f40('0x30')]=_0x2b7a70[_0x9f40('0x30')][_0x9f40('0x32')]?_0x2b7a70[_0x9f40('0x30')]:_0x552253['model'];if(!_0x597cca[_0x9f40('0x2e')][_0x9f40('0x33')]('nolimit')){_0x2b7a70['limit']=qs[_0x9f40('0x1c')](_0x597cca[_0x9f40('0x2e')][_0x9f40('0x1c')]);_0x2b7a70['offset']=qs[_0x9f40('0x1b')](_0x597cca[_0x9f40('0x2e')][_0x9f40('0x1b')]);}_0x2b7a70['order']=qs[_0x9f40('0x34')](_0x597cca[_0x9f40('0x2e')][_0x9f40('0x34')]);_0x2b7a70[_0x9f40('0x35')]=qs[_0x9f40('0x2f')](_[_0x9f40('0x36')](_0x597cca[_0x9f40('0x2e')],_0x552253[_0x9f40('0x2f')]),_0x3907eb);if(_0x597cca['query'][_0x9f40('0x37')]){_0x2b7a70[_0x9f40('0x35')]=_[_0x9f40('0x38')](_0x2b7a70[_0x9f40('0x35')],{'$or':_[_0x9f40('0x28')](_0x3907eb,function(_0x20ca9e){if(_0x20ca9e[_0x9f40('0x2b')]!==_0x9f40('0x39')){var _0x1ddfcd={};_0x1ddfcd[_0x20ca9e['name']]={'$like':'%'+_0x597cca[_0x9f40('0x2e')][_0x9f40('0x37')]+'%'};return _0x1ddfcd;}})});}_0x2b7a70=_[_0x9f40('0x38')]({},_0x2b7a70,_0x597cca[_0x9f40('0x3a')]);var _0x3e0b7f={'where':_0x2b7a70[_0x9f40('0x35')]};return db[_0x9f40('0x29')]['count'](_0x3e0b7f)[_0x9f40('0x23')](function(_0x2b0532){_0x3a7a61[_0x9f40('0x1a')]=_0x2b0532;if(_0x597cca[_0x9f40('0x2e')][_0x9f40('0x3b')]){_0x2b7a70[_0x9f40('0x3c')]=[{'all':!![]}];}return db[_0x9f40('0x29')][_0x9f40('0x3d')](_0x2b7a70);})['then'](function(_0x3e509b){_0x3a7a61['rows']=_0x3e509b;return _0x3a7a61;})[_0x9f40('0x23')](respondWithFilteredResult(_0x301255,_0x2b7a70))[_0x9f40('0x3e')](handleError(_0x301255,null));};exports[_0x9f40('0x3f')]=function(_0x559c40,_0x3b9ca7){var _0x5bb143={'raw':!![],'where':{'id':_0x559c40[_0x9f40('0x40')]['id']}},_0x2821dc={};_0x2821dc['model']=_[_0x9f40('0x41')](db[_0x9f40('0x29')][_0x9f40('0x2a')]);_0x2821dc['query']=_['keys'](_0x559c40[_0x9f40('0x2e')]);_0x2821dc[_0x9f40('0x2f')]=_[_0x9f40('0x42')](_0x2821dc[_0x9f40('0x2c')],_0x2821dc[_0x9f40('0x2e')]);_0x5bb143['attributes']=_['intersection'](_0x2821dc['model'],qs[_0x9f40('0x31')](_0x559c40[_0x9f40('0x2e')][_0x9f40('0x31')]));_0x5bb143['attributes']=_0x5bb143[_0x9f40('0x30')][_0x9f40('0x32')]?_0x5bb143[_0x9f40('0x30')]:_0x2821dc['model'];if(_0x559c40[_0x9f40('0x2e')][_0x9f40('0x3b')]){_0x5bb143[_0x9f40('0x3c')]=[{'all':!![]}];}_0x5bb143=_[_0x9f40('0x38')]({},_0x5bb143,_0x559c40[_0x9f40('0x3a')]);return db[_0x9f40('0x29')][_0x9f40('0x43')](_0x5bb143)[_0x9f40('0x23')](handleEntityNotFound(_0x3b9ca7,null))[_0x9f40('0x23')](respondWithResult(_0x3b9ca7,null))[_0x9f40('0x3e')](handleError(_0x3b9ca7,null));};exports['create']=function(_0x3a31d6,_0x22dde0){return db['SmsQueueReport'][_0x9f40('0x44')](_0x3a31d6['body'],{})[_0x9f40('0x23')](respondWithResult(_0x22dde0,0xc9))[_0x9f40('0x3e')](handleError(_0x22dde0,null));};exports[_0x9f40('0x22')]=function(_0x300d07,_0x2b452b){if(_0x300d07['body']['id']){delete _0x300d07[_0x9f40('0x45')]['id'];}return db[_0x9f40('0x29')]['find']({'where':{'id':_0x300d07['params']['id']}})[_0x9f40('0x23')](handleEntityNotFound(_0x2b452b,null))[_0x9f40('0x23')](saveUpdates(_0x300d07[_0x9f40('0x45')],null))[_0x9f40('0x23')](respondWithResult(_0x2b452b,null))[_0x9f40('0x3e')](handleError(_0x2b452b,null));};exports['destroy']=function(_0x33bbb9,_0x2b972a){return db[_0x9f40('0x29')]['find']({'where':{'id':_0x33bbb9[_0x9f40('0x40')]['id']}})[_0x9f40('0x23')](handleEntityNotFound(_0x2b972a,null))[_0x9f40('0x23')](removeEntity(_0x2b972a,null))['catch'](handleError(_0x2b972a,null));};exports[_0x9f40('0x46')]=function(_0x5a4d48,_0x2f0b21){return db[_0x9f40('0x29')][_0x9f40('0x46')]()['then'](respondWithResult(_0x2f0b21,null))['catch'](handleError(_0x2f0b21,null));}; \ No newline at end of file +var _0x9186=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','options','SmsQueueReport','includeAll','findAll','show','params','keys','include','find','create','body','catch','update','destroy'];(function(_0x270e5f,_0x550ce1){var _0x418c39=function(_0x5da3f6){while(--_0x5da3f6){_0x270e5f['push'](_0x270e5f['shift']());}};_0x418c39(++_0x550ce1);}(_0x9186,0x97));var _0x6918=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x9186[_0x8afdd0];return _0x3de7ac;};'use strict';var pdf=require(_0x6918('0x0'));var emlformat=require(_0x6918('0x1'));var rimraf=require(_0x6918('0x2'));var zipdir=require(_0x6918('0x3'));var jsonpatch=require(_0x6918('0x4'));var rp=require('request-promise');var moment=require(_0x6918('0x5'));var BPromise=require(_0x6918('0x6'));var Mustache=require(_0x6918('0x7'));var util=require(_0x6918('0x8'));var path=require(_0x6918('0x9'));var sox=require(_0x6918('0xa'));var csv=require(_0x6918('0xb'));var ejs=require(_0x6918('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6918('0xd'));var crypto=require(_0x6918('0xe'));var jsforce=require(_0x6918('0xf'));var deskjs=require(_0x6918('0x10'));var toCsv=require(_0x6918('0xb'));var querystring=require(_0x6918('0x11'));var Papa=require(_0x6918('0x12'));var Redis=require(_0x6918('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6918('0x14'));var as=require(_0x6918('0x15'));var hardwareService=require(_0x6918('0x16'));var logger=require(_0x6918('0x17'))(_0x6918('0x18'));var utils=require('../../config/utils');var config=require(_0x6918('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6918('0x1a'))['db'];function respondWithStatusCode(_0x43c864,_0x1c8078){_0x1c8078=_0x1c8078||0xcc;return function(_0x19cd71){if(_0x19cd71){return _0x43c864[_0x6918('0x1b')](_0x1c8078);}return _0x43c864[_0x6918('0x1c')](_0x1c8078)['end']();};}function respondWithResult(_0x3cd926,_0x234d1e){_0x234d1e=_0x234d1e||0xc8;return function(_0xf1a52d){if(_0xf1a52d){return _0x3cd926[_0x6918('0x1c')](_0x234d1e)[_0x6918('0x1d')](_0xf1a52d);}};}function respondWithFilteredResult(_0x33c9e6,_0x1b545f){return function(_0x108ac4){if(_0x108ac4){var _0x587cdc=_0x108ac4[_0x6918('0x1e')],_0x551baa=_0x1b545f[_0x6918('0x1f')],_0x396f30=_0x1b545f[_0x6918('0x1f')]+_0x1b545f[_0x6918('0x20')],_0x4dea2e;if(_0x396f30>=_0x587cdc){_0x396f30=_0x587cdc;_0x4dea2e=0xc8;}else{_0x4dea2e=0xce;}_0x33c9e6[_0x6918('0x1c')](_0x4dea2e);return _0x33c9e6[_0x6918('0x21')]('Content-Range',_0x551baa+'-'+_0x396f30+'/'+_0x587cdc)['json'](_0x108ac4);}return null;};}function patchUpdates(_0x1298f9){return function(_0x10da56){try{jsonpatch[_0x6918('0x22')](_0x10da56,_0x1298f9,!![]);}catch(_0x1a8d42){return BPromise[_0x6918('0x23')](_0x1a8d42);}return _0x10da56[_0x6918('0x24')]();};}function saveUpdates(_0x342858,_0x2cf43e){return function(_0x277163){if(_0x277163){return _0x277163['update'](_0x342858)[_0x6918('0x25')](function(_0xf9fbe5){return _0xf9fbe5;});}return null;};}function removeEntity(_0x58912,_0x39fe2f){return function(_0x357c57){if(_0x357c57){return _0x357c57['destroy']()['then'](function(){_0x58912[_0x6918('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28162e,_0x593202){return function(_0x1221d8){if(!_0x1221d8){_0x28162e[_0x6918('0x1b')](0x194);}return _0x1221d8;};}function handleError(_0x4bbaba,_0x8651f3){_0x8651f3=_0x8651f3||0x1f4;return function(_0x4853bb){logger['error'](_0x4853bb[_0x6918('0x26')]);if(_0x4853bb[_0x6918('0x27')]){delete _0x4853bb['name'];}_0x4bbaba['status'](_0x8651f3)[_0x6918('0x28')](_0x4853bb);};}exports[_0x6918('0x29')]=function(_0x449c1f,_0x1f1454){var _0xb26e34={},_0x1e4ffd={},_0x38fbc8={'count':0x0,'rows':[]};var _0x75ed57=_[_0x6918('0x2a')](db['SmsQueueReport'][_0x6918('0x2b')],function(_0x15c345){return{'name':_0x15c345['fieldName'],'type':_0x15c345[_0x6918('0x2c')][_0x6918('0x2d')]};});_0x1e4ffd['model']=_['map'](_0x75ed57,_0x6918('0x27'));_0x1e4ffd[_0x6918('0x2e')]=_['keys'](_0x449c1f[_0x6918('0x2e')]);_0x1e4ffd[_0x6918('0x2f')]=_[_0x6918('0x30')](_0x1e4ffd['model'],_0x1e4ffd[_0x6918('0x2e')]);_0xb26e34[_0x6918('0x31')]=_[_0x6918('0x30')](_0x1e4ffd['model'],qs[_0x6918('0x32')](_0x449c1f[_0x6918('0x2e')][_0x6918('0x32')]));_0xb26e34['attributes']=_0xb26e34['attributes'][_0x6918('0x33')]?_0xb26e34[_0x6918('0x31')]:_0x1e4ffd[_0x6918('0x34')];if(!_0x449c1f[_0x6918('0x2e')]['hasOwnProperty'](_0x6918('0x35'))){_0xb26e34['limit']=qs[_0x6918('0x20')](_0x449c1f[_0x6918('0x2e')][_0x6918('0x20')]);_0xb26e34[_0x6918('0x1f')]=qs['offset'](_0x449c1f[_0x6918('0x2e')]['offset']);}_0xb26e34[_0x6918('0x36')]=qs[_0x6918('0x37')](_0x449c1f[_0x6918('0x2e')][_0x6918('0x37')]);_0xb26e34[_0x6918('0x38')]=qs[_0x6918('0x2f')](_[_0x6918('0x39')](_0x449c1f[_0x6918('0x2e')],_0x1e4ffd[_0x6918('0x2f')]),_0x75ed57);if(_0x449c1f[_0x6918('0x2e')][_0x6918('0x3a')]){_0xb26e34[_0x6918('0x38')]=_[_0x6918('0x3b')](_0xb26e34[_0x6918('0x38')],{'$or':_['map'](_0x75ed57,function(_0x17f477){if(_0x17f477[_0x6918('0x2c')]!=='VIRTUAL'){var _0x2f60c9={};_0x2f60c9[_0x17f477[_0x6918('0x27')]]={'$like':'%'+_0x449c1f[_0x6918('0x2e')][_0x6918('0x3a')]+'%'};return _0x2f60c9;}})});}_0xb26e34=_[_0x6918('0x3b')]({},_0xb26e34,_0x449c1f[_0x6918('0x3c')]);var _0x4b906a={'where':_0xb26e34[_0x6918('0x38')]};return db[_0x6918('0x3d')][_0x6918('0x1e')](_0x4b906a)[_0x6918('0x25')](function(_0x5bed74){_0x38fbc8[_0x6918('0x1e')]=_0x5bed74;if(_0x449c1f[_0x6918('0x2e')][_0x6918('0x3e')]){_0xb26e34['include']=[{'all':!![]}];}return db[_0x6918('0x3d')][_0x6918('0x3f')](_0xb26e34);})[_0x6918('0x25')](function(_0x40afb6){_0x38fbc8['rows']=_0x40afb6;return _0x38fbc8;})[_0x6918('0x25')](respondWithFilteredResult(_0x1f1454,_0xb26e34))['catch'](handleError(_0x1f1454,null));};exports[_0x6918('0x40')]=function(_0x54805e,_0x146152){var _0x3cb2ac={'raw':!![],'where':{'id':_0x54805e[_0x6918('0x41')]['id']}},_0x3ed015={};_0x3ed015[_0x6918('0x34')]=_[_0x6918('0x42')](db['SmsQueueReport'][_0x6918('0x2b')]);_0x3ed015[_0x6918('0x2e')]=_[_0x6918('0x42')](_0x54805e[_0x6918('0x2e')]);_0x3ed015[_0x6918('0x2f')]=_[_0x6918('0x30')](_0x3ed015[_0x6918('0x34')],_0x3ed015[_0x6918('0x2e')]);_0x3cb2ac[_0x6918('0x31')]=_['intersection'](_0x3ed015[_0x6918('0x34')],qs[_0x6918('0x32')](_0x54805e['query']['fields']));_0x3cb2ac[_0x6918('0x31')]=_0x3cb2ac[_0x6918('0x31')]['length']?_0x3cb2ac[_0x6918('0x31')]:_0x3ed015[_0x6918('0x34')];if(_0x54805e[_0x6918('0x2e')][_0x6918('0x3e')]){_0x3cb2ac[_0x6918('0x43')]=[{'all':!![]}];}_0x3cb2ac=_[_0x6918('0x3b')]({},_0x3cb2ac,_0x54805e['options']);return db[_0x6918('0x3d')][_0x6918('0x44')](_0x3cb2ac)[_0x6918('0x25')](handleEntityNotFound(_0x146152,null))[_0x6918('0x25')](respondWithResult(_0x146152,null))['catch'](handleError(_0x146152,null));};exports['create']=function(_0x551ed9,_0x269bad){return db['SmsQueueReport'][_0x6918('0x45')](_0x551ed9[_0x6918('0x46')],{})[_0x6918('0x25')](respondWithResult(_0x269bad,0xc9))[_0x6918('0x47')](handleError(_0x269bad,null));};exports[_0x6918('0x48')]=function(_0x407286,_0x42c0bc){if(_0x407286[_0x6918('0x46')]['id']){delete _0x407286[_0x6918('0x46')]['id'];}return db[_0x6918('0x3d')][_0x6918('0x44')]({'where':{'id':_0x407286[_0x6918('0x41')]['id']}})[_0x6918('0x25')](handleEntityNotFound(_0x42c0bc,null))[_0x6918('0x25')](saveUpdates(_0x407286[_0x6918('0x46')],null))[_0x6918('0x25')](respondWithResult(_0x42c0bc,null))['catch'](handleError(_0x42c0bc,null));};exports[_0x6918('0x49')]=function(_0x4bf28d,_0x7c2f73){return db[_0x6918('0x3d')][_0x6918('0x44')]({'where':{'id':_0x4bf28d[_0x6918('0x41')]['id']}})[_0x6918('0x25')](handleEntityNotFound(_0x7c2f73,null))[_0x6918('0x25')](removeEntity(_0x7c2f73,null))[_0x6918('0x47')](handleError(_0x7c2f73,null));};exports['describe']=function(_0x484dc2,_0x2b7c31){return db[_0x6918('0x3d')][_0x6918('0x4a')]()[_0x6918('0x25')](respondWithResult(_0x2b7c31,null))[_0x6918('0x47')](handleError(_0x2b7c31,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 2fa6e80..ff38153 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2137=['../../config/logger','bluebird','path','rimraf','../../config/environment','define','report_sms_queue','uniqueid','lodash','util'];(function(_0x31d032,_0x18cdb4){var _0x4fd331=function(_0x3ed895){while(--_0x3ed895){_0x31d032['push'](_0x31d032['shift']());}};_0x4fd331(++_0x18cdb4);}(_0x2137,0x134));var _0x7213=function(_0x103aa0,_0x4b2079){_0x103aa0=_0x103aa0-0x0;var _0x128855=_0x2137[_0x103aa0];return _0x128855;};'use strict';var _=require(_0x7213('0x0'));var util=require(_0x7213('0x1'));var logger=require(_0x7213('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7213('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7213('0x4'));var rimraf=require(_0x7213('0x5'));var config=require(_0x7213('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x4f36f0,_0x2cf2d6){return _0x4f36f0[_0x7213('0x7')]('SmsQueueReport',attributes,{'tableName':_0x7213('0x8'),'paranoid':![],'indexes':[{'name':_0x7213('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ce2=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5899df,_0x56dce4){var _0xd39505=function(_0x145d55){while(--_0x145d55){_0x5899df['push'](_0x5899df['shift']());}};_0xd39505(++_0x56dce4);}(_0x0ce2,0xfd));var _0x20ce=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0ce2[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x20ce('0x0'));var util=require('util');var logger=require(_0x20ce('0x1'))(_0x20ce('0x2'));var moment=require(_0x20ce('0x3'));var BPromise=require(_0x20ce('0x4'));var rp=require(_0x20ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x20ce('0x6'));var attributes=require('./smsQueueReport.attributes');module[_0x20ce('0x7')]=function(_0x208e54,_0x5ae7b2){return _0x208e54['define'](_0x20ce('0x8'),attributes,{'tableName':_0x20ce('0x9'),'paranoid':![],'indexes':[{'name':_0x20ce('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c2da3c3..7593dce 100644 --- a/server/api/smsQueueReport/smsQueueReport.rpc.js +++ b/server/api/smsQueueReport/smsQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cf1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','CreateSmsQueueReport','create','body','options','catch','UpdateSmsQueueReport','SmsQueueReport','update','raw','where','limit','lodash','util','moment'];(function(_0x17b2ee,_0x5eeb74){var _0x59dd6f=function(_0x517649){while(--_0x517649){_0x17b2ee['push'](_0x17b2ee['shift']());}};_0x59dd6f(++_0x5eeb74);}(_0x9cf1,0x81));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x19cf('0x0'));var util=require(_0x19cf('0x1'));var moment=require(_0x19cf('0x2'));var BPromise=require(_0x19cf('0x3'));var rs=require(_0x19cf('0x4'));var fs=require('fs');var Redis=require(_0x19cf('0x5'));var db=require(_0x19cf('0x6'))['db'];var utils=require(_0x19cf('0x7'));var logger=require(_0x19cf('0x8'))(_0x19cf('0x9'));var config=require(_0x19cf('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a328e,_0x446512,_0x1aa622){return new BPromise(function(_0x1bb8ca,_0x427e90){return client[_0x19cf('0xb')](_0x1a328e,_0x1aa622)[_0x19cf('0xc')](function(_0x51ab53){logger[_0x19cf('0xd')](_0x19cf('0xe'),_0x446512,_0x19cf('0xf'));logger[_0x19cf('0x10')](_0x19cf('0x11'),_0x446512,'request\x20sent',JSON[_0x19cf('0x12')](_0x51ab53));if(_0x51ab53['error']){if(_0x51ab53['error'][_0x19cf('0x13')]===0x1f4){logger[_0x19cf('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x446512,_0x51ab53[_0x19cf('0x14')][_0x19cf('0x15')]);return _0x427e90(_0x51ab53[_0x19cf('0x14')]['message']);}logger[_0x19cf('0x14')](_0x19cf('0xe'),_0x446512,_0x51ab53[_0x19cf('0x14')][_0x19cf('0x15')]);return _0x1bb8ca(_0x51ab53[_0x19cf('0x14')]['message']);}else{logger[_0x19cf('0xd')](_0x19cf('0xe'),_0x446512,_0x19cf('0xf'));_0x1bb8ca(_0x51ab53['result']['message']);}})['catch'](function(_0x55d47a){logger[_0x19cf('0x14')](_0x19cf('0xe'),_0x446512,_0x55d47a);_0x427e90(_0x55d47a);});});}exports[_0x19cf('0x16')]=function(_0x10198c){var _0x40bbbe=this;return new Promise(function(_0x176b8e,_0x5820cf){return db['SmsQueueReport'][_0x19cf('0x17')](_0x10198c[_0x19cf('0x18')],{'raw':_0x10198c[_0x19cf('0x19')]?_0x10198c['options']['raw']===undefined?!![]:![]:!![]})[_0x19cf('0xc')](function(_0x2c2513){logger['info'](_0x19cf('0x16'),_0x10198c);logger[_0x19cf('0x10')](_0x19cf('0x16'),_0x10198c,JSON[_0x19cf('0x12')](_0x2c2513));_0x176b8e(_0x2c2513);})[_0x19cf('0x1a')](function(_0x34d734){logger[_0x19cf('0x14')](_0x19cf('0x16'),_0x34d734[_0x19cf('0x15')],_0x10198c);_0x5820cf(_0x40bbbe[_0x19cf('0x14')](0x1f4,_0x34d734[_0x19cf('0x15')]));});});};exports[_0x19cf('0x1b')]=function(_0x36a529){var _0x595a43=this;return new Promise(function(_0x5c20d6,_0x55e1b5){return db[_0x19cf('0x1c')][_0x19cf('0x1d')](_0x36a529[_0x19cf('0x18')],{'raw':_0x36a529[_0x19cf('0x19')]?_0x36a529[_0x19cf('0x19')][_0x19cf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a529['options']?_0x36a529[_0x19cf('0x19')][_0x19cf('0x1f')]||null:null,'attributes':_0x36a529[_0x19cf('0x19')]?_0x36a529['options']['attributes']||null:null,'limit':_0x36a529[_0x19cf('0x19')]?_0x36a529[_0x19cf('0x19')][_0x19cf('0x20')]||null:null})[_0x19cf('0xc')](function(_0x1d9c30){logger['info']('UpdateSmsQueueReport',_0x36a529);logger['debug'](_0x19cf('0x1b'),_0x36a529,JSON[_0x19cf('0x12')](_0x1d9c30));_0x5c20d6(_0x1d9c30);})[_0x19cf('0x1a')](function(_0x1f11b6){logger[_0x19cf('0x14')]('UpdateSmsQueueReport',_0x1f11b6[_0x19cf('0x15')],_0x36a529);_0x55e1b5(_0x595a43['error'](0x1f4,_0x1f11b6[_0x19cf('0x15')]));});});}; \ No newline at end of file +var _0x2c4e=['create','options','update','body','raw','where','attributes','limit','UpdateSmsQueueReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateSmsQueueReport','SmsQueueReport'];(function(_0x250d1f,_0x19c348){var _0x5356fe=function(_0x18de1f){while(--_0x18de1f){_0x250d1f['push'](_0x250d1f['shift']());}};_0x5356fe(++_0x19c348);}(_0x2c4e,0xca));var _0xe2c4=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x2c4e[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xe2c4('0x0'));var util=require(_0xe2c4('0x1'));var moment=require(_0xe2c4('0x2'));var BPromise=require(_0xe2c4('0x3'));var rs=require(_0xe2c4('0x4'));var fs=require('fs');var Redis=require(_0xe2c4('0x5'));var db=require(_0xe2c4('0x6'))['db'];var utils=require(_0xe2c4('0x7'));var logger=require(_0xe2c4('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe2c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360394,_0x25809d,_0x277c5c){return new BPromise(function(_0x3fd279,_0x431c3d){return client[_0xe2c4('0xa')](_0x360394,_0x277c5c)[_0xe2c4('0xb')](function(_0x2e608c){logger[_0xe2c4('0xc')](_0xe2c4('0xd'),_0x25809d,_0xe2c4('0xe'));logger[_0xe2c4('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x25809d,'request\x20sent',JSON[_0xe2c4('0x10')](_0x2e608c));if(_0x2e608c['error']){if(_0x2e608c[_0xe2c4('0x11')]['code']===0x1f4){logger[_0xe2c4('0x11')](_0xe2c4('0xd'),_0x25809d,_0x2e608c['error'][_0xe2c4('0x12')]);return _0x431c3d(_0x2e608c[_0xe2c4('0x11')]['message']);}logger[_0xe2c4('0x11')](_0xe2c4('0xd'),_0x25809d,_0x2e608c[_0xe2c4('0x11')][_0xe2c4('0x12')]);return _0x3fd279(_0x2e608c[_0xe2c4('0x11')]['message']);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x25809d,_0xe2c4('0xe'));_0x3fd279(_0x2e608c[_0xe2c4('0x13')][_0xe2c4('0x12')]);}})['catch'](function(_0x436c21){logger[_0xe2c4('0x11')](_0xe2c4('0xd'),_0x25809d,_0x436c21);_0x431c3d(_0x436c21);});});}exports[_0xe2c4('0x14')]=function(_0x502133){var _0x2ad2c0=this;return new Promise(function(_0x23985a,_0x11dbfc){return db[_0xe2c4('0x15')][_0xe2c4('0x16')](_0x502133['body'],{'raw':_0x502133[_0xe2c4('0x17')]?_0x502133[_0xe2c4('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xe2c4('0xb')](function(_0x40bd58){logger[_0xe2c4('0xc')](_0xe2c4('0x14'),_0x502133);logger[_0xe2c4('0xf')](_0xe2c4('0x14'),_0x502133,JSON[_0xe2c4('0x10')](_0x40bd58));_0x23985a(_0x40bd58);})['catch'](function(_0x30d340){logger[_0xe2c4('0x11')](_0xe2c4('0x14'),_0x30d340['message'],_0x502133);_0x11dbfc(_0x2ad2c0['error'](0x1f4,_0x30d340[_0xe2c4('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x20c30f){var _0x429f84=this;return new Promise(function(_0x118e6d,_0x5ade22){return db[_0xe2c4('0x15')][_0xe2c4('0x18')](_0x20c30f[_0xe2c4('0x19')],{'raw':_0x20c30f[_0xe2c4('0x17')]?_0x20c30f['options'][_0xe2c4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20c30f[_0xe2c4('0x17')]?_0x20c30f[_0xe2c4('0x17')][_0xe2c4('0x1b')]||null:null,'attributes':_0x20c30f[_0xe2c4('0x17')]?_0x20c30f[_0xe2c4('0x17')][_0xe2c4('0x1c')]||null:null,'limit':_0x20c30f[_0xe2c4('0x17')]?_0x20c30f['options'][_0xe2c4('0x1d')]||null:null})[_0xe2c4('0xb')](function(_0x5a7482){logger['info'](_0xe2c4('0x1e'),_0x20c30f);logger[_0xe2c4('0xf')](_0xe2c4('0x1e'),_0x20c30f,JSON[_0xe2c4('0x10')](_0x5a7482));_0x118e6d(_0x5a7482);})[_0xe2c4('0x1f')](function(_0x1f5907){logger[_0xe2c4('0x11')]('UpdateSmsQueueReport',_0x1f5907[_0xe2c4('0x12')],_0x20c30f);_0x5ade22(_0x429f84[_0xe2c4('0x11')](0x1f4,_0x1f5907[_0xe2c4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ce510ae..2ca5768 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36ee=['update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','/:id'];(function(_0x138f7b,_0x4cf17b){var _0x449305=function(_0x3a0c1d){while(--_0x3a0c1d){_0x138f7b['push'](_0x138f7b['shift']());}};_0x449305(++_0x4cf17b);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var auth=require(_0xe36e('0x3'));var interaction=require(_0xe36e('0x4'));var config=require(_0xe36e('0x5'));var controller=require(_0xe36e('0x6'));router[_0xe36e('0x7')]('/',auth[_0xe36e('0x8')](),controller[_0xe36e('0x9')]);router[_0xe36e('0x7')](_0xe36e('0xa'),auth[_0xe36e('0x8')](),controller['describe']);router[_0xe36e('0x7')]('/:id',auth[_0xe36e('0x8')](),controller[_0xe36e('0xb')]);router[_0xe36e('0xc')]('/',auth['isAuthenticated'](),controller[_0xe36e('0xd')]);router['put'](_0xe36e('0xe'),auth[_0xe36e('0x8')](),controller[_0xe36e('0xf')]);router[_0xe36e('0x10')](_0xe36e('0xe'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x11')]);module[_0xe36e('0x12')]=router; \ No newline at end of file +var _0xb62e=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','create','put','update','delete','destroy','multer','util'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0xb62e,0x1de));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var auth=require(_0xeb62('0x5'));var interaction=require(_0xeb62('0x6'));var config=require(_0xeb62('0x7'));var controller=require(_0xeb62('0x8'));router[_0xeb62('0x9')]('/',auth['isAuthenticated'](),controller[_0xeb62('0xa')]);router[_0xeb62('0x9')](_0xeb62('0xb'),auth['isAuthenticated'](),controller[_0xeb62('0xc')]);router[_0xeb62('0x9')](_0xeb62('0xd'),auth[_0xeb62('0xe')](),controller['show']);router['post']('/',auth[_0xeb62('0xe')](),controller[_0xeb62('0xf')]);router[_0xeb62('0x10')](_0xeb62('0xd'),auth[_0xeb62('0xe')](),controller[_0xeb62('0x11')]);router[_0xeb62('0x12')](_0xeb62('0xd'),auth[_0xeb62('0xe')](),controller[_0xeb62('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9280e8b..3922f07 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9261=['queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x59097f,_0x3cce9a){var _0x17b7c8=function(_0x1e5a79){while(--_0x1e5a79){_0x59097f['push'](_0x59097f['shift']());}};_0x17b7c8(++_0x3cce9a);}(_0x9261,0x73));var _0x1926=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x9261[_0x40822a];return _0x357420;};'use strict';var moment=require(_0x1926('0x0'));var Sequelize=require(_0x1926('0x1'));module[_0x1926('0x2')]={'uniqueid':{'type':Sequelize[_0x1926('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1926('0x4')]('account','agent',_0x1926('0x5')),'allowNull':![],'defaultValue':_0x1926('0x5')},'transferredAt':{'type':Sequelize[_0x1926('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x1926('0x7')]}}; \ No newline at end of file +var _0x629f=['queue','moment','sequelize','STRING','ENUM','account'];(function(_0x24bba0,_0x6d581f){var _0x11b8cd=function(_0x55893f){while(--_0x55893f){_0x24bba0['push'](_0x24bba0['shift']());}};_0x11b8cd(++_0x6d581f);}(_0x629f,0xb5));var _0xf629=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x629f[_0x406696];return _0x10e35c;};'use strict';var moment=require(_0xf629('0x0'));var Sequelize=require(_0xf629('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf629('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf629('0x3')](_0xf629('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0xf629('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a6bf9e5..57daae2 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf430=['util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','where','pick','merge','options','includeAll','findAll','catch','show','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xf430,0x1e4));var _0x0f43=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0xf430[_0x43a37c];return _0x5d1d40;};'use strict';var pdf=require(_0x0f43('0x0'));var emlformat=require(_0x0f43('0x1'));var rimraf=require(_0x0f43('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f43('0x3'));var rp=require(_0x0f43('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0f43('0x5'));var util=require(_0x0f43('0x6'));var path=require(_0x0f43('0x7'));var sox=require('sox');var csv=require(_0x0f43('0x8'));var ejs=require(_0x0f43('0x9'));var fs=require('fs');var _=require(_0x0f43('0xa'));var squel=require('squel');var crypto=require(_0x0f43('0xb'));var jsforce=require(_0x0f43('0xc'));var deskjs=require(_0x0f43('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0f43('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f43('0xf'));var authService=require(_0x0f43('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f43('0x11'));var logger=require(_0x0f43('0x12'))(_0x0f43('0x13'));var utils=require(_0x0f43('0x14'));var config=require(_0x0f43('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f43('0x16'))['db'];function respondWithStatusCode(_0x323440,_0x4425d8){_0x4425d8=_0x4425d8||0xcc;return function(_0xdf710e){if(_0xdf710e){return _0x323440[_0x0f43('0x17')](_0x4425d8);}return _0x323440[_0x0f43('0x18')](_0x4425d8)[_0x0f43('0x19')]();};}function respondWithResult(_0x470edf,_0x3d668f){_0x3d668f=_0x3d668f||0xc8;return function(_0x13d3b9){if(_0x13d3b9){return _0x470edf[_0x0f43('0x18')](_0x3d668f)['json'](_0x13d3b9);}};}function respondWithFilteredResult(_0xfad7d0,_0x3223c2){return function(_0x5c4e52){if(_0x5c4e52){var _0xcd9415=_0x5c4e52[_0x0f43('0x1a')],_0x41e85e=_0x3223c2['offset'],_0x465795=_0x3223c2[_0x0f43('0x1b')]+_0x3223c2['limit'],_0x5631e1;if(_0x465795>=_0xcd9415){_0x465795=_0xcd9415;_0x5631e1=0xc8;}else{_0x5631e1=0xce;}_0xfad7d0['status'](_0x5631e1);return _0xfad7d0[_0x0f43('0x1c')]('Content-Range',_0x41e85e+'-'+_0x465795+'/'+_0xcd9415)[_0x0f43('0x1d')](_0x5c4e52);}return null;};}function patchUpdates(_0x49d04c){return function(_0xdbb20e){try{jsonpatch[_0x0f43('0x1e')](_0xdbb20e,_0x49d04c,!![]);}catch(_0x2ace0f){return BPromise[_0x0f43('0x1f')](_0x2ace0f);}return _0xdbb20e[_0x0f43('0x20')]();};}function saveUpdates(_0x3b9785,_0x5a5e16){return function(_0x42aaef){if(_0x42aaef){return _0x42aaef[_0x0f43('0x21')](_0x3b9785)[_0x0f43('0x22')](function(_0x338017){return _0x338017;});}return null;};}function removeEntity(_0x27053a,_0x645f35){return function(_0x41e539){if(_0x41e539){return _0x41e539[_0x0f43('0x23')]()['then'](function(){_0x27053a['status'](0xcc)[_0x0f43('0x19')]();});}};}function handleEntityNotFound(_0x5c4b61,_0x291949){return function(_0xc9eeb0){if(!_0xc9eeb0){_0x5c4b61[_0x0f43('0x17')](0x194);}return _0xc9eeb0;};}function handleError(_0x368c7c,_0x5e0f38){_0x5e0f38=_0x5e0f38||0x1f4;return function(_0x227f03){logger[_0x0f43('0x24')](_0x227f03[_0x0f43('0x25')]);if(_0x227f03['name']){delete _0x227f03['name'];}_0x368c7c['status'](_0x5e0f38)['send'](_0x227f03);};}exports[_0x0f43('0x26')]=function(_0xa44a52,_0xfbecc3){var _0x1494e4={},_0x17696d={},_0x1a70d0={'count':0x0,'rows':[]};var _0x499b6b=_[_0x0f43('0x27')](db[_0x0f43('0x28')][_0x0f43('0x29')],function(_0x29e89f){return{'name':_0x29e89f[_0x0f43('0x2a')],'type':_0x29e89f['type'][_0x0f43('0x2b')]};});_0x17696d[_0x0f43('0x2c')]=_[_0x0f43('0x27')](_0x499b6b,_0x0f43('0x2d'));_0x17696d['query']=_[_0x0f43('0x2e')](_0xa44a52[_0x0f43('0x2f')]);_0x17696d[_0x0f43('0x30')]=_[_0x0f43('0x31')](_0x17696d['model'],_0x17696d[_0x0f43('0x2f')]);_0x1494e4[_0x0f43('0x32')]=_['intersection'](_0x17696d[_0x0f43('0x2c')],qs[_0x0f43('0x33')](_0xa44a52[_0x0f43('0x2f')][_0x0f43('0x33')]));_0x1494e4['attributes']=_0x1494e4[_0x0f43('0x32')]['length']?_0x1494e4['attributes']:_0x17696d['model'];if(!_0xa44a52[_0x0f43('0x2f')][_0x0f43('0x34')]('nolimit')){_0x1494e4[_0x0f43('0x35')]=qs[_0x0f43('0x35')](_0xa44a52[_0x0f43('0x2f')][_0x0f43('0x35')]);_0x1494e4['offset']=qs[_0x0f43('0x1b')](_0xa44a52[_0x0f43('0x2f')][_0x0f43('0x1b')]);}_0x1494e4[_0x0f43('0x36')]=qs['sort'](_0xa44a52[_0x0f43('0x2f')]['sort']);_0x1494e4[_0x0f43('0x37')]=qs['filters'](_[_0x0f43('0x38')](_0xa44a52[_0x0f43('0x2f')],_0x17696d[_0x0f43('0x30')]),_0x499b6b);if(_0xa44a52[_0x0f43('0x2f')]['filter']){_0x1494e4[_0x0f43('0x37')]=_[_0x0f43('0x39')](_0x1494e4[_0x0f43('0x37')],{'$or':_[_0x0f43('0x27')](_0x499b6b,function(_0x28ee89){if(_0x28ee89['type']!=='VIRTUAL'){var _0x2fb351={};_0x2fb351[_0x28ee89[_0x0f43('0x2d')]]={'$like':'%'+_0xa44a52[_0x0f43('0x2f')]['filter']+'%'};return _0x2fb351;}})});}_0x1494e4=_[_0x0f43('0x39')]({},_0x1494e4,_0xa44a52[_0x0f43('0x3a')]);var _0x5f0a94={'where':_0x1494e4[_0x0f43('0x37')]};return db[_0x0f43('0x28')][_0x0f43('0x1a')](_0x5f0a94)['then'](function(_0x461c1e){_0x1a70d0[_0x0f43('0x1a')]=_0x461c1e;if(_0xa44a52[_0x0f43('0x2f')][_0x0f43('0x3b')]){_0x1494e4['include']=[{'all':!![]}];}return db[_0x0f43('0x28')][_0x0f43('0x3c')](_0x1494e4);})[_0x0f43('0x22')](function(_0x4ae966){_0x1a70d0['rows']=_0x4ae966;return _0x1a70d0;})[_0x0f43('0x22')](respondWithFilteredResult(_0xfbecc3,_0x1494e4))[_0x0f43('0x3d')](handleError(_0xfbecc3,null));};exports[_0x0f43('0x3e')]=function(_0x36a475,_0x491f01){var _0x3d069e={'raw':!![],'where':{'id':_0x36a475['params']['id']}},_0x35e7a5={};_0x35e7a5[_0x0f43('0x2c')]=_[_0x0f43('0x2e')](db['SmsTransferReport'][_0x0f43('0x29')]);_0x35e7a5[_0x0f43('0x2f')]=_['keys'](_0x36a475[_0x0f43('0x2f')]);_0x35e7a5[_0x0f43('0x30')]=_[_0x0f43('0x31')](_0x35e7a5[_0x0f43('0x2c')],_0x35e7a5[_0x0f43('0x2f')]);_0x3d069e[_0x0f43('0x32')]=_[_0x0f43('0x31')](_0x35e7a5['model'],qs[_0x0f43('0x33')](_0x36a475['query']['fields']));_0x3d069e[_0x0f43('0x32')]=_0x3d069e[_0x0f43('0x32')][_0x0f43('0x3f')]?_0x3d069e['attributes']:_0x35e7a5[_0x0f43('0x2c')];if(_0x36a475['query']['includeAll']){_0x3d069e[_0x0f43('0x40')]=[{'all':!![]}];}_0x3d069e=_[_0x0f43('0x39')]({},_0x3d069e,_0x36a475[_0x0f43('0x3a')]);return db[_0x0f43('0x28')][_0x0f43('0x41')](_0x3d069e)[_0x0f43('0x22')](handleEntityNotFound(_0x491f01,null))['then'](respondWithResult(_0x491f01,null))['catch'](handleError(_0x491f01,null));};exports[_0x0f43('0x42')]=function(_0x31f110,_0x3e7b46){return db[_0x0f43('0x28')][_0x0f43('0x42')](_0x31f110[_0x0f43('0x43')],{})[_0x0f43('0x22')](respondWithResult(_0x3e7b46,0xc9))[_0x0f43('0x3d')](handleError(_0x3e7b46,null));};exports[_0x0f43('0x21')]=function(_0x4c1955,_0x50ca48){if(_0x4c1955[_0x0f43('0x43')]['id']){delete _0x4c1955[_0x0f43('0x43')]['id'];}return db['SmsTransferReport'][_0x0f43('0x41')]({'where':{'id':_0x4c1955[_0x0f43('0x44')]['id']}})[_0x0f43('0x22')](handleEntityNotFound(_0x50ca48,null))['then'](saveUpdates(_0x4c1955[_0x0f43('0x43')],null))['then'](respondWithResult(_0x50ca48,null))[_0x0f43('0x3d')](handleError(_0x50ca48,null));};exports[_0x0f43('0x23')]=function(_0x316fe9,_0x1d1392){return db['SmsTransferReport'][_0x0f43('0x41')]({'where':{'id':_0x316fe9[_0x0f43('0x44')]['id']}})[_0x0f43('0x22')](handleEntityNotFound(_0x1d1392,null))[_0x0f43('0x22')](removeEntity(_0x1d1392,null))[_0x0f43('0x3d')](handleError(_0x1d1392,null));};exports[_0x0f43('0x45')]=function(_0x54cf62,_0x46835d){return db['SmsTransferReport'][_0x0f43('0x45')]()[_0x0f43('0x22')](respondWithResult(_0x46835d,null))['catch'](handleError(_0x46835d,null));}; \ No newline at end of file +var _0xd957=['end','offset','limit','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','options','count','include','findAll','rows','catch','params','keys','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0xd957,0x153));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x7d95('0x0'));var emlformat=require(_0x7d95('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7d95('0x2'));var jsonpatch=require(_0x7d95('0x3'));var rp=require('request-promise');var moment=require(_0x7d95('0x4'));var BPromise=require(_0x7d95('0x5'));var Mustache=require(_0x7d95('0x6'));var util=require(_0x7d95('0x7'));var path=require(_0x7d95('0x8'));var sox=require(_0x7d95('0x9'));var csv=require(_0x7d95('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d95('0xb'));var squel=require(_0x7d95('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d95('0xd'));var deskjs=require(_0x7d95('0xe'));var toCsv=require(_0x7d95('0xa'));var querystring=require(_0x7d95('0xf'));var Papa=require(_0x7d95('0x10'));var Redis=require('ioredis');var authService=require(_0x7d95('0x11'));var qs=require(_0x7d95('0x12'));var as=require(_0x7d95('0x13'));var hardwareService=require(_0x7d95('0x14'));var logger=require(_0x7d95('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7d95('0x16'));var licenseUtil=require(_0x7d95('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8aea6,_0x1d6b13){_0x1d6b13=_0x1d6b13||0xcc;return function(_0x310657){if(_0x310657){return _0x8aea6[_0x7d95('0x18')](_0x1d6b13);}return _0x8aea6[_0x7d95('0x19')](_0x1d6b13)[_0x7d95('0x1a')]();};}function respondWithResult(_0x4da709,_0x82ac5f){_0x82ac5f=_0x82ac5f||0xc8;return function(_0x56e18f){if(_0x56e18f){return _0x4da709[_0x7d95('0x19')](_0x82ac5f)['json'](_0x56e18f);}};}function respondWithFilteredResult(_0x9b5091,_0x4f333d){return function(_0x3b519a){if(_0x3b519a){var _0x30c2f8=_0x3b519a['count'],_0x293f87=_0x4f333d[_0x7d95('0x1b')],_0x45bf02=_0x4f333d[_0x7d95('0x1b')]+_0x4f333d[_0x7d95('0x1c')],_0x5ab72e;if(_0x45bf02>=_0x30c2f8){_0x45bf02=_0x30c2f8;_0x5ab72e=0xc8;}else{_0x5ab72e=0xce;}_0x9b5091[_0x7d95('0x19')](_0x5ab72e);return _0x9b5091['set'](_0x7d95('0x1d'),_0x293f87+'-'+_0x45bf02+'/'+_0x30c2f8)[_0x7d95('0x1e')](_0x3b519a);}return null;};}function patchUpdates(_0x55e083){return function(_0x3c264b){try{jsonpatch[_0x7d95('0x1f')](_0x3c264b,_0x55e083,!![]);}catch(_0x2d0627){return BPromise[_0x7d95('0x20')](_0x2d0627);}return _0x3c264b[_0x7d95('0x21')]();};}function saveUpdates(_0x1a058c,_0x3ae23a){return function(_0x45bec0){if(_0x45bec0){return _0x45bec0[_0x7d95('0x22')](_0x1a058c)['then'](function(_0x30c121){return _0x30c121;});}return null;};}function removeEntity(_0x5a0f78,_0x1e2b58){return function(_0x4c0133){if(_0x4c0133){return _0x4c0133['destroy']()[_0x7d95('0x23')](function(){_0x5a0f78[_0x7d95('0x19')](0xcc)[_0x7d95('0x1a')]();});}};}function handleEntityNotFound(_0x54c0a2,_0x2f54c4){return function(_0xd7d5){if(!_0xd7d5){_0x54c0a2['sendStatus'](0x194);}return _0xd7d5;};}function handleError(_0x1938a5,_0x4e97c9){_0x4e97c9=_0x4e97c9||0x1f4;return function(_0x4ec676){logger['error'](_0x4ec676[_0x7d95('0x24')]);if(_0x4ec676[_0x7d95('0x25')]){delete _0x4ec676['name'];}_0x1938a5[_0x7d95('0x19')](_0x4e97c9)[_0x7d95('0x26')](_0x4ec676);};}exports[_0x7d95('0x27')]=function(_0x51f5c6,_0x2583e2){var _0x16ebff={},_0x2ff04c={},_0x5c0664={'count':0x0,'rows':[]};var _0x41c8c1=_['map'](db[_0x7d95('0x28')][_0x7d95('0x29')],function(_0x3d3bb8){return{'name':_0x3d3bb8[_0x7d95('0x2a')],'type':_0x3d3bb8[_0x7d95('0x2b')][_0x7d95('0x2c')]};});_0x2ff04c[_0x7d95('0x2d')]=_[_0x7d95('0x2e')](_0x41c8c1,'name');_0x2ff04c[_0x7d95('0x2f')]=_['keys'](_0x51f5c6[_0x7d95('0x2f')]);_0x2ff04c['filters']=_[_0x7d95('0x30')](_0x2ff04c[_0x7d95('0x2d')],_0x2ff04c[_0x7d95('0x2f')]);_0x16ebff[_0x7d95('0x31')]=_[_0x7d95('0x30')](_0x2ff04c[_0x7d95('0x2d')],qs['fields'](_0x51f5c6[_0x7d95('0x2f')][_0x7d95('0x32')]));_0x16ebff[_0x7d95('0x31')]=_0x16ebff[_0x7d95('0x31')][_0x7d95('0x33')]?_0x16ebff[_0x7d95('0x31')]:_0x2ff04c['model'];if(!_0x51f5c6[_0x7d95('0x2f')][_0x7d95('0x34')]('nolimit')){_0x16ebff['limit']=qs[_0x7d95('0x1c')](_0x51f5c6[_0x7d95('0x2f')]['limit']);_0x16ebff[_0x7d95('0x1b')]=qs[_0x7d95('0x1b')](_0x51f5c6[_0x7d95('0x2f')][_0x7d95('0x1b')]);}_0x16ebff[_0x7d95('0x35')]=qs[_0x7d95('0x36')](_0x51f5c6[_0x7d95('0x2f')]['sort']);_0x16ebff[_0x7d95('0x37')]=qs[_0x7d95('0x38')](_[_0x7d95('0x39')](_0x51f5c6['query'],_0x2ff04c[_0x7d95('0x38')]),_0x41c8c1);if(_0x51f5c6[_0x7d95('0x2f')]['filter']){_0x16ebff[_0x7d95('0x37')]=_[_0x7d95('0x3a')](_0x16ebff[_0x7d95('0x37')],{'$or':_[_0x7d95('0x2e')](_0x41c8c1,function(_0x4d102b){if(_0x4d102b['type']!=='VIRTUAL'){var _0x586480={};_0x586480[_0x4d102b['name']]={'$like':'%'+_0x51f5c6['query']['filter']+'%'};return _0x586480;}})});}_0x16ebff=_[_0x7d95('0x3a')]({},_0x16ebff,_0x51f5c6[_0x7d95('0x3b')]);var _0x40f2ae={'where':_0x16ebff[_0x7d95('0x37')]};return db[_0x7d95('0x28')][_0x7d95('0x3c')](_0x40f2ae)[_0x7d95('0x23')](function(_0x19496e){_0x5c0664[_0x7d95('0x3c')]=_0x19496e;if(_0x51f5c6[_0x7d95('0x2f')]['includeAll']){_0x16ebff[_0x7d95('0x3d')]=[{'all':!![]}];}return db[_0x7d95('0x28')][_0x7d95('0x3e')](_0x16ebff);})[_0x7d95('0x23')](function(_0x753179){_0x5c0664[_0x7d95('0x3f')]=_0x753179;return _0x5c0664;})[_0x7d95('0x23')](respondWithFilteredResult(_0x2583e2,_0x16ebff))[_0x7d95('0x40')](handleError(_0x2583e2,null));};exports['show']=function(_0x265fab,_0x3b9c54){var _0x543bb7={'raw':!![],'where':{'id':_0x265fab[_0x7d95('0x41')]['id']}},_0xb2f72a={};_0xb2f72a['model']=_[_0x7d95('0x42')](db['SmsTransferReport']['rawAttributes']);_0xb2f72a[_0x7d95('0x2f')]=_[_0x7d95('0x42')](_0x265fab[_0x7d95('0x2f')]);_0xb2f72a[_0x7d95('0x38')]=_[_0x7d95('0x30')](_0xb2f72a[_0x7d95('0x2d')],_0xb2f72a[_0x7d95('0x2f')]);_0x543bb7[_0x7d95('0x31')]=_[_0x7d95('0x30')](_0xb2f72a['model'],qs[_0x7d95('0x32')](_0x265fab['query'][_0x7d95('0x32')]));_0x543bb7[_0x7d95('0x31')]=_0x543bb7[_0x7d95('0x31')][_0x7d95('0x33')]?_0x543bb7[_0x7d95('0x31')]:_0xb2f72a[_0x7d95('0x2d')];if(_0x265fab[_0x7d95('0x2f')][_0x7d95('0x43')]){_0x543bb7[_0x7d95('0x3d')]=[{'all':!![]}];}_0x543bb7=_[_0x7d95('0x3a')]({},_0x543bb7,_0x265fab['options']);return db[_0x7d95('0x28')][_0x7d95('0x44')](_0x543bb7)[_0x7d95('0x23')](handleEntityNotFound(_0x3b9c54,null))[_0x7d95('0x23')](respondWithResult(_0x3b9c54,null))[_0x7d95('0x40')](handleError(_0x3b9c54,null));};exports[_0x7d95('0x45')]=function(_0x53bd0e,_0x55301e){return db[_0x7d95('0x28')][_0x7d95('0x45')](_0x53bd0e['body'],{})[_0x7d95('0x23')](respondWithResult(_0x55301e,0xc9))[_0x7d95('0x40')](handleError(_0x55301e,null));};exports['update']=function(_0x476d06,_0xb5e531){if(_0x476d06[_0x7d95('0x46')]['id']){delete _0x476d06[_0x7d95('0x46')]['id'];}return db[_0x7d95('0x28')][_0x7d95('0x44')]({'where':{'id':_0x476d06[_0x7d95('0x41')]['id']}})[_0x7d95('0x23')](handleEntityNotFound(_0xb5e531,null))[_0x7d95('0x23')](saveUpdates(_0x476d06['body'],null))[_0x7d95('0x23')](respondWithResult(_0xb5e531,null))['catch'](handleError(_0xb5e531,null));};exports[_0x7d95('0x47')]=function(_0x4af396,_0x29d3c2){return db[_0x7d95('0x28')][_0x7d95('0x44')]({'where':{'id':_0x4af396[_0x7d95('0x41')]['id']}})[_0x7d95('0x23')](handleEntityNotFound(_0x29d3c2,null))[_0x7d95('0x23')](removeEntity(_0x29d3c2,null))[_0x7d95('0x40')](handleError(_0x29d3c2,null));};exports[_0x7d95('0x48')]=function(_0x3f7944,_0x54176c){return db[_0x7d95('0x28')][_0x7d95('0x48')]()[_0x7d95('0x23')](respondWithResult(_0x54176c,null))[_0x7d95('0x40')](handleError(_0x54176c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6c865e6..b332aee 100644 --- a/server/api/smsTransferReport/smsTransferReport.model.js +++ b/server/api/smsTransferReport/smsTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f4d=['define','SmsTransferReport','uniqueid','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x56e1a8,_0x531b56){var _0x45eb8f=function(_0x584390){while(--_0x584390){_0x56e1a8['push'](_0x56e1a8['shift']());}};_0x45eb8f(++_0x531b56);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x2239dc,_0x42b7bd){_0x2239dc=_0x2239dc-0x0;var _0x42169a=_0x0f4d[_0x2239dc];return _0x42169a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xd0f4('0xa'),'fields':[_0xd0f4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport'];(function(_0x187ba8,_0x246f24){var _0x227546=function(_0x259fa5){while(--_0x259fa5){_0x187ba8['push'](_0x187ba8['shift']());}};_0x227546(++_0x246f24);}(_0x7a54,0x106));var _0x47a5=function(_0x5828f5,_0xd391c4){_0x5828f5=_0x5828f5-0x0;var _0x39af8d=_0x7a54[_0x5828f5];return _0x39af8d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 618d0aa..537f805 100644 --- a/server/api/smsTransferReport/smsTransferReport.rpc.js +++ b/server/api/smsTransferReport/smsTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e1e=['info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x4c5076,_0x139e05){var _0x3e3ec9=function(_0x281548){while(--_0x281548){_0x4c5076['push'](_0x4c5076['shift']());}};_0x3e3ec9(++_0x139e05);}(_0x6e1e,0x186));var _0xe6e1=function(_0x28b973,_0xd9c370){_0x28b973=_0x28b973-0x0;var _0x279bd9=_0x6e1e[_0x28b973];return _0x279bd9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe6e1('0x0'));var BPromise=require(_0xe6e1('0x1'));var rs=require(_0xe6e1('0x2'));var fs=require('fs');var Redis=require(_0xe6e1('0x3'));var db=require(_0xe6e1('0x4'))['db'];var utils=require(_0xe6e1('0x5'));var logger=require('../../config/logger')(_0xe6e1('0x6'));var config=require(_0xe6e1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe6e1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56ab08,_0x4d78a8,_0x46d318){return new BPromise(function(_0x40aa5d,_0x44e3a7){return client['request'](_0x56ab08,_0x46d318)['then'](function(_0x5a6432){logger[_0xe6e1('0x9')](_0xe6e1('0xa'),_0x4d78a8,_0xe6e1('0xb'));logger[_0xe6e1('0xc')](_0xe6e1('0xd'),_0x4d78a8,'request\x20sent',JSON[_0xe6e1('0xe')](_0x5a6432));if(_0x5a6432[_0xe6e1('0xf')]){if(_0x5a6432[_0xe6e1('0xf')][_0xe6e1('0x10')]===0x1f4){logger[_0xe6e1('0xf')](_0xe6e1('0xa'),_0x4d78a8,_0x5a6432[_0xe6e1('0xf')][_0xe6e1('0x11')]);return _0x44e3a7(_0x5a6432['error'][_0xe6e1('0x11')]);}logger[_0xe6e1('0xf')](_0xe6e1('0xa'),_0x4d78a8,_0x5a6432[_0xe6e1('0xf')][_0xe6e1('0x11')]);return _0x40aa5d(_0x5a6432[_0xe6e1('0xf')][_0xe6e1('0x11')]);}else{logger[_0xe6e1('0x9')](_0xe6e1('0xa'),_0x4d78a8,'request\x20sent');_0x40aa5d(_0x5a6432['result']['message']);}})[_0xe6e1('0x12')](function(_0x250c24){logger[_0xe6e1('0xf')](_0xe6e1('0xa'),_0x4d78a8,_0x250c24);_0x44e3a7(_0x250c24);});});} \ No newline at end of file +var _0x48aa=['error','code','message','SmsTransferReport,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5edbe2,_0x4ca04a){var _0x2f1264=function(_0xb5d23a){while(--_0xb5d23a){_0x5edbe2['push'](_0x5edbe2['shift']());}};_0x2f1264(++_0x4ca04a);}(_0x48aa,0x155));var _0xa48a=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0x48aa[_0x3c0dcc];return _0x1a224c;};'use strict';var _=require(_0xa48a('0x0'));var util=require(_0xa48a('0x1'));var moment=require('moment');var BPromise=require(_0xa48a('0x2'));var rs=require(_0xa48a('0x3'));var fs=require('fs');var Redis=require(_0xa48a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa48a('0x5'));var config=require(_0xa48a('0x6'));var jayson=require(_0xa48a('0x7'));var client=jayson[_0xa48a('0x8')][_0xa48a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48aeb9,_0x13eb6e,_0xd190be){return new BPromise(function(_0x34b9a3,_0x262cbd){return client[_0xa48a('0xa')](_0x48aeb9,_0xd190be)['then'](function(_0x6e12c0){logger[_0xa48a('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x13eb6e,_0xa48a('0xc'));logger[_0xa48a('0xd')](_0xa48a('0xe'),_0x13eb6e,'request\x20sent',JSON[_0xa48a('0xf')](_0x6e12c0));if(_0x6e12c0['error']){if(_0x6e12c0[_0xa48a('0x10')][_0xa48a('0x11')]===0x1f4){logger[_0xa48a('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x13eb6e,_0x6e12c0[_0xa48a('0x10')][_0xa48a('0x12')]);return _0x262cbd(_0x6e12c0[_0xa48a('0x10')][_0xa48a('0x12')]);}logger[_0xa48a('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x13eb6e,_0x6e12c0[_0xa48a('0x10')]['message']);return _0x34b9a3(_0x6e12c0[_0xa48a('0x10')][_0xa48a('0x12')]);}else{logger[_0xa48a('0xb')](_0xa48a('0x13'),_0x13eb6e,_0xa48a('0xc'));_0x34b9a3(_0x6e12c0[_0xa48a('0x14')]['message']);}})['catch'](function(_0x43e7a3){logger[_0xa48a('0x10')](_0xa48a('0x13'),_0x13eb6e,_0x43e7a3);_0x262cbd(_0x43e7a3);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 1178f66..fb13cc3 100644 --- a/server/api/sound/index.js +++ b/server/api/sound/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa880=['originalname','replace','format','extname','now','post','single','file','create','put','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0xa880,0xa2));var _0x0a88=function(_0x4ccde3,_0x38ca57){_0x4ccde3=_0x4ccde3-0x0;var _0x3348ac=_0xa880[_0x4ccde3];return _0x3348ac;};'use strict';var multer=require(_0x0a88('0x0'));var util=require(_0x0a88('0x1'));var path=require(_0x0a88('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a88('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a88('0x4'));var config=require(_0x0a88('0x5'));var controller=require(_0x0a88('0x6'));router[_0x0a88('0x7')]('/',auth[_0x0a88('0x8')](),controller[_0x0a88('0x9')]);router[_0x0a88('0x7')](_0x0a88('0xa'),auth[_0x0a88('0x8')](),controller[_0x0a88('0xb')]);router[_0x0a88('0x7')](_0x0a88('0xc'),auth['isAuthenticated'](),controller[_0x0a88('0xd')]);var upload=multer({'storage':multer[_0x0a88('0xe')]({'destination':function(_0x1d722c,_0x5e18b4,_0x59db7e){_0x59db7e(null,path[_0x0a88('0xf')](config[_0x0a88('0x10')],_0x0a88('0x11')));},'filename':function(_0x128f49,_0x208c70,_0x213049){_0x208c70[_0x0a88('0x12')]=_0x208c70[_0x0a88('0x12')][_0x0a88('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x213049(null,util[_0x0a88('0x14')]('%s-%s%s',path['basename'](_0x208c70[_0x0a88('0x12')],path[_0x0a88('0x15')](_0x208c70[_0x0a88('0x12')])),Date[_0x0a88('0x16')](),path[_0x0a88('0x15')](_0x208c70[_0x0a88('0x12')])));}})});router[_0x0a88('0x17')]('/',upload[_0x0a88('0x18')](_0x0a88('0x19')),controller[_0x0a88('0x1a')]);router[_0x0a88('0x1b')](_0x0a88('0xa'),auth[_0x0a88('0x8')](),controller['update']);router[_0x0a88('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x0a88('0x1c')]);module[_0x0a88('0x1d')]=router; \ No newline at end of file +var _0x6436=['replace','format','%s-%s%s','basename','now','extname','post','single','file','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname'];(function(_0x57ca7e,_0x353397){var _0x708dd4=function(_0x503444){while(--_0x503444){_0x57ca7e['push'](_0x57ca7e['shift']());}};_0x708dd4(++_0x353397);}(_0x6436,0x1bc));var _0x6643=function(_0x40159a,_0x16d91d){_0x40159a=_0x40159a-0x0;var _0x2c6a57=_0x6436[_0x40159a];return _0x2c6a57;};'use strict';var multer=require('multer');var util=require(_0x6643('0x0'));var path=require(_0x6643('0x1'));var timeout=require(_0x6643('0x2'));var express=require(_0x6643('0x3'));var router=express[_0x6643('0x4')]();var auth=require(_0x6643('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6643('0x6'));var controller=require(_0x6643('0x7'));router[_0x6643('0x8')]('/',auth[_0x6643('0x9')](),controller[_0x6643('0xa')]);router[_0x6643('0x8')](_0x6643('0xb'),auth[_0x6643('0x9')](),controller[_0x6643('0xc')]);router[_0x6643('0x8')](_0x6643('0xd'),auth['isAuthenticated'](),controller[_0x6643('0xe')]);var upload=multer({'storage':multer[_0x6643('0xf')]({'destination':function(_0x1d5fe2,_0x185d46,_0x8f30d2){_0x8f30d2(null,path[_0x6643('0x10')](config[_0x6643('0x11')],_0x6643('0x12')));},'filename':function(_0x3397dc,_0x4283ec,_0x4c4af8){_0x4283ec[_0x6643('0x13')]=_0x4283ec[_0x6643('0x13')][_0x6643('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4c4af8(null,util[_0x6643('0x15')](_0x6643('0x16'),path[_0x6643('0x17')](_0x4283ec[_0x6643('0x13')],path['extname'](_0x4283ec[_0x6643('0x13')])),Date[_0x6643('0x18')](),path[_0x6643('0x19')](_0x4283ec[_0x6643('0x13')])));}})});router[_0x6643('0x1a')]('/',upload[_0x6643('0x1b')](_0x6643('0x1c')),controller['create']);router['put'](_0x6643('0xb'),auth[_0x6643('0x9')](),controller['update']);router['delete']('/:id',auth[_0x6643('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e9c511d..91a46a6 100644 --- a/server/api/sound/sound.attributes.js +++ b/server/api/sound/sound.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8063=['exports','STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x8063,0x14f));var _0x3806=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8063[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3806('0x0'));module[_0x3806('0x1')]={'name':{'type':Sequelize[_0x3806('0x2')],'unique':_0x3806('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3806('0x2')]},'display_name':{'type':Sequelize[_0x3806('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x3806('0x2')]},'original_duration':{'type':Sequelize[_0x3806('0x4')]},'original_sampleCount':{'type':Sequelize[_0x3806('0x5')]},'original_channelCount':{'type':Sequelize[_0x3806('0x6')]},'original_bitRate':{'type':Sequelize[_0x3806('0x5')]},'original_sampleRate':{'type':Sequelize[_0x3806('0x6')]},'converted_format':{'type':Sequelize[_0x3806('0x2')]},'converted_duration':{'type':Sequelize[_0x3806('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x3806('0x5')]},'converted_channelCount':{'type':Sequelize[_0x3806('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2a60=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x370c9c,_0x3a9218){var _0x426c30=function(_0x324bc8){while(--_0x324bc8){_0x370c9c['push'](_0x370c9c['shift']());}};_0x426c30(++_0x3a9218);}(_0x2a60,0x1e6));var _0x02a6=function(_0x4f6ecc,_0x562169){_0x4f6ecc=_0x4f6ecc-0x0;var _0x1627a7=_0x2a60[_0x4f6ecc];return _0x1627a7;};'use strict';var Sequelize=require(_0x02a6('0x0'));module[_0x02a6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x02a6('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x02a6('0x2')]},'original_format':{'type':Sequelize[_0x02a6('0x2')]},'original_duration':{'type':Sequelize[_0x02a6('0x3')]},'original_sampleCount':{'type':Sequelize[_0x02a6('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x02a6('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x02a6('0x2')]},'converted_duration':{'type':Sequelize[_0x02a6('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x02a6('0x4')]},'converted_channelCount':{'type':Sequelize[_0x02a6('0x5')]},'converted_bitRate':{'type':Sequelize[_0x02a6('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x02a6('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9eddb89..47e1fa1 100644 --- a/server/api/sound/sound.controller.js +++ b/server/api/sound/sound.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a0c=['extname','filename','substring','wav','server/files/sounds/original','join','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','end','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','Sound','includeAll','include','findAll','rows','catch','show','find','download','params','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a0c,0x97));var _0xc6a0=function(_0x357661,_0xd657ac){_0x357661=_0x357661-0x0;var _0x2af858=_0x6a0c[_0x357661];return _0x2af858;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc6a0('0x0'));var zipdir=require(_0xc6a0('0x1'));var jsonpatch=require(_0xc6a0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6a0('0x3'));var util=require(_0xc6a0('0x4'));var path=require(_0xc6a0('0x5'));var sox=require(_0xc6a0('0x6'));var csv=require(_0xc6a0('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc6a0('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc6a0('0x7'));var querystring=require('querystring');var Papa=require(_0xc6a0('0x9'));var Redis=require(_0xc6a0('0xa'));var authService=require(_0xc6a0('0xb'));var qs=require(_0xc6a0('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6a0('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0xc6a0('0xe'));var config=require(_0xc6a0('0xf'));var licenseUtil=require(_0xc6a0('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3a43,_0x4dd162){_0x4dd162=_0x4dd162||0xcc;return function(_0x4d2c78){if(_0x4d2c78){return _0x5b3a43[_0xc6a0('0x11')](_0x4dd162);}return _0x5b3a43['status'](_0x4dd162)['end']();};}function respondWithResult(_0x434ca2,_0x45d0a2){_0x45d0a2=_0x45d0a2||0xc8;return function(_0x4f323f){if(_0x4f323f){return _0x434ca2[_0xc6a0('0x12')](_0x45d0a2)[_0xc6a0('0x13')](_0x4f323f);}};}function respondWithFilteredResult(_0x3113be,_0x343b9d){return function(_0x4dd670){if(_0x4dd670){var _0x3f50c0=_0x4dd670[_0xc6a0('0x14')],_0x9d093a=_0x343b9d[_0xc6a0('0x15')],_0x56171b=_0x343b9d[_0xc6a0('0x15')]+_0x343b9d[_0xc6a0('0x16')],_0x45a6b1;if(_0x56171b>=_0x3f50c0){_0x56171b=_0x3f50c0;_0x45a6b1=0xc8;}else{_0x45a6b1=0xce;}_0x3113be['status'](_0x45a6b1);return _0x3113be[_0xc6a0('0x17')](_0xc6a0('0x18'),_0x9d093a+'-'+_0x56171b+'/'+_0x3f50c0)['json'](_0x4dd670);}return null;};}function patchUpdates(_0x343016){return function(_0x568acc){try{jsonpatch[_0xc6a0('0x19')](_0x568acc,_0x343016,!![]);}catch(_0x2b2259){return BPromise[_0xc6a0('0x1a')](_0x2b2259);}return _0x568acc[_0xc6a0('0x1b')]();};}function saveUpdates(_0x15ca61,_0x4ca1ff){return function(_0x4388d8){if(_0x4388d8){return _0x4388d8[_0xc6a0('0x1c')](_0x15ca61)[_0xc6a0('0x1d')](function(_0x240aca){return _0x240aca;});}return null;};}function removeEntity(_0x2ed8e0,_0x38e9d3){return function(_0x36ab9b){if(_0x36ab9b){return _0x36ab9b[_0xc6a0('0x1e')]()[_0xc6a0('0x1d')](function(){var _0x30927f=_0x36ab9b[_0xc6a0('0x1f')]({'plain':!![]});var _0x3ccf51=_0xc6a0('0x20');return db['UserProfileResource'][_0xc6a0('0x1e')]({'where':{'type':_0x3ccf51,'resourceId':_0x30927f['id']}})[_0xc6a0('0x1d')](function(){return _0x36ab9b;});})[_0xc6a0('0x1d')](function(){_0x2ed8e0[_0xc6a0('0x12')](0xcc)[_0xc6a0('0x21')]();});}};}function handleEntityNotFound(_0x270683,_0x94ba81){return function(_0x58564e){if(!_0x58564e){_0x270683[_0xc6a0('0x11')](0x194);}return _0x58564e;};}function handleError(_0x412170,_0x16dc47){_0x16dc47=_0x16dc47||0x1f4;return function(_0x6955b7){logger['error'](_0x6955b7[_0xc6a0('0x22')]);if(_0x6955b7[_0xc6a0('0x23')]){delete _0x6955b7['name'];}_0x412170[_0xc6a0('0x12')](_0x16dc47)[_0xc6a0('0x24')](_0x6955b7);};}exports['index']=function(_0x52246b,_0x466d64){var _0x531027={},_0x53f05b={},_0x23b8fc={'count':0x0,'rows':[]};var _0x1278d4=_[_0xc6a0('0x25')](db['Sound'][_0xc6a0('0x26')],function(_0x373e75){return{'name':_0x373e75[_0xc6a0('0x27')],'type':_0x373e75[_0xc6a0('0x28')]['key']};});_0x53f05b[_0xc6a0('0x29')]=_['map'](_0x1278d4,_0xc6a0('0x23'));_0x53f05b['query']=_[_0xc6a0('0x2a')](_0x52246b[_0xc6a0('0x2b')]);_0x53f05b[_0xc6a0('0x2c')]=_['intersection'](_0x53f05b[_0xc6a0('0x29')],_0x53f05b[_0xc6a0('0x2b')]);_0x531027[_0xc6a0('0x2d')]=_['intersection'](_0x53f05b[_0xc6a0('0x29')],qs[_0xc6a0('0x2e')](_0x52246b['query'][_0xc6a0('0x2e')]));_0x531027[_0xc6a0('0x2d')]=_0x531027['attributes'][_0xc6a0('0x2f')]?_0x531027['attributes']:_0x53f05b[_0xc6a0('0x29')];if(!_0x52246b[_0xc6a0('0x2b')][_0xc6a0('0x30')]('nolimit')){_0x531027['limit']=qs['limit'](_0x52246b['query'][_0xc6a0('0x16')]);_0x531027[_0xc6a0('0x15')]=qs[_0xc6a0('0x15')](_0x52246b[_0xc6a0('0x2b')][_0xc6a0('0x15')]);}_0x531027[_0xc6a0('0x31')]=qs[_0xc6a0('0x32')](_0x52246b[_0xc6a0('0x2b')][_0xc6a0('0x32')]);_0x531027[_0xc6a0('0x33')]=qs[_0xc6a0('0x2c')](_[_0xc6a0('0x34')](_0x52246b['query'],_0x53f05b[_0xc6a0('0x2c')]),_0x1278d4);if(_0x52246b['query']['filter']){_0x531027['where']=_[_0xc6a0('0x35')](_0x531027[_0xc6a0('0x33')],{'$or':_['map'](_0x1278d4,function(_0x528d57){if(_0x528d57[_0xc6a0('0x28')]!==_0xc6a0('0x36')){var _0x260ecd={};_0x260ecd[_0x528d57[_0xc6a0('0x23')]]={'$like':'%'+_0x52246b[_0xc6a0('0x2b')][_0xc6a0('0x37')]+'%'};return _0x260ecd;}})});}_0x531027=_[_0xc6a0('0x35')]({},_0x531027,_0x52246b[_0xc6a0('0x38')]);var _0x1cde29={'where':_0x531027[_0xc6a0('0x33')]};return db[_0xc6a0('0x39')][_0xc6a0('0x14')](_0x1cde29)['then'](function(_0x36b702){_0x23b8fc['count']=_0x36b702;if(_0x52246b['query'][_0xc6a0('0x3a')]){_0x531027[_0xc6a0('0x3b')]=[{'all':!![]}];}return db[_0xc6a0('0x39')][_0xc6a0('0x3c')](_0x531027);})[_0xc6a0('0x1d')](function(_0x48519b){_0x23b8fc[_0xc6a0('0x3d')]=_0x48519b;return _0x23b8fc;})[_0xc6a0('0x1d')](respondWithFilteredResult(_0x466d64,_0x531027))[_0xc6a0('0x3e')](handleError(_0x466d64,null));};exports[_0xc6a0('0x3f')]=function(_0x19172f,_0x578a1a){var _0x1e9a78={'raw':!![],'where':{'id':_0x19172f['params']['id']}},_0x4660c2={};_0x4660c2[_0xc6a0('0x29')]=_['keys'](db[_0xc6a0('0x39')][_0xc6a0('0x26')]);_0x4660c2[_0xc6a0('0x2b')]=_[_0xc6a0('0x2a')](_0x19172f['query']);_0x4660c2['filters']=_['intersection'](_0x4660c2[_0xc6a0('0x29')],_0x4660c2[_0xc6a0('0x2b')]);_0x1e9a78[_0xc6a0('0x2d')]=_['intersection'](_0x4660c2[_0xc6a0('0x29')],qs[_0xc6a0('0x2e')](_0x19172f[_0xc6a0('0x2b')][_0xc6a0('0x2e')]));_0x1e9a78[_0xc6a0('0x2d')]=_0x1e9a78[_0xc6a0('0x2d')]['length']?_0x1e9a78[_0xc6a0('0x2d')]:_0x4660c2[_0xc6a0('0x29')];if(_0x19172f[_0xc6a0('0x2b')][_0xc6a0('0x3a')]){_0x1e9a78[_0xc6a0('0x3b')]=[{'all':!![]}];}_0x1e9a78=_['merge']({},_0x1e9a78,_0x19172f[_0xc6a0('0x38')]);return db['Sound'][_0xc6a0('0x40')](_0x1e9a78)[_0xc6a0('0x1d')](handleEntityNotFound(_0x578a1a,null))[_0xc6a0('0x1d')](respondWithResult(_0x578a1a,null))[_0xc6a0('0x3e')](handleError(_0x578a1a,null));};exports[_0xc6a0('0x41')]=function(_0x16a5bd,_0x1410d4,_0x4830f6){return db[_0xc6a0('0x39')][_0xc6a0('0x40')]({'where':{'id':_0x16a5bd[_0xc6a0('0x42')]['id']},'attributes':[_0xc6a0('0x23'),_0xc6a0('0x43'),_0xc6a0('0x44')],'raw':!![]})['then'](handleEntityNotFound(_0x1410d4,null))['then'](function(_0x48dc9e){if(_0x48dc9e){if(!fs[_0xc6a0('0x45')](path['join'](config['root'],_0xc6a0('0x46'),_0x48dc9e[_0xc6a0('0x43')]+'.'+_0x48dc9e[_0xc6a0('0x44')]))){throw new db[(_0xc6a0('0x47'))][(_0xc6a0('0x48'))](_0xc6a0('0x49'));}return _0x1410d4[_0xc6a0('0x41')](path['join'](config[_0xc6a0('0x4a')],_0xc6a0('0x46'),util[_0xc6a0('0x4b')]('%s.%s',_0x48dc9e[_0xc6a0('0x43')],_0x48dc9e[_0xc6a0('0x44')])),util[_0xc6a0('0x4b')](_0xc6a0('0x4c'),_0x48dc9e[_0xc6a0('0x23')],_0x48dc9e[_0xc6a0('0x44')]));}return null;})[_0xc6a0('0x3e')](handleError(_0x1410d4,null));};exports[_0xc6a0('0x4d')]=function(_0x36b3f3,_0x2e7613,_0x47f6ef){var _0x582173={'name':path[_0xc6a0('0x4e')](_0x36b3f3[_0xc6a0('0x4f')][_0xc6a0('0x50')],path[_0xc6a0('0x51')](_0x36b3f3[_0xc6a0('0x4f')][_0xc6a0('0x50')])),'save_name':path['basename'](_0x36b3f3['file'][_0xc6a0('0x52')],path[_0xc6a0('0x51')](_0x36b3f3[_0xc6a0('0x4f')][_0xc6a0('0x52')])),'original_format':path[_0xc6a0('0x51')](_0x36b3f3[_0xc6a0('0x4f')][_0xc6a0('0x50')])[_0xc6a0('0x53')](0x1),'converted_format':_0xc6a0('0x54')};var _0x378c39=path['join'](config[_0xc6a0('0x4a')],_0xc6a0('0x55'),_0x36b3f3[_0xc6a0('0x4f')][_0xc6a0('0x52')]);var _0xf757f=path[_0xc6a0('0x56')](config[_0xc6a0('0x4a')],_0xc6a0('0x46'),util['format'](_0xc6a0('0x4c'),path[_0xc6a0('0x4e')](_0x36b3f3[_0xc6a0('0x4f')][_0xc6a0('0x52')],path[_0xc6a0('0x51')](_0x36b3f3[_0xc6a0('0x4f')][_0xc6a0('0x52')])),_0x582173['converted_format']));logger[_0xc6a0('0x57')](_0xc6a0('0x58'),_0x378c39);logger[_0xc6a0('0x57')](_0xc6a0('0x59'),_0xf757f);try{fs[_0xc6a0('0x5a')](_0x378c39,parseInt(_0xc6a0('0x5b'),0x8));var _0x574090=sox['transcode'](_0x378c39,_0xf757f,{'sampleRate':0x1f40,'format':_0xc6a0('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x574090['on'](_0xc6a0('0x5c'),function(_0x3fb9cf){fs['unlinkSync'](_0x378c39);_0x2e7613[_0xc6a0('0x12')](0x1f4)[_0xc6a0('0x24')](_0x3fb9cf);});_0x574090['on'](_0xc6a0('0x5d'),function(_0x28abd3){_0x582173[_0xc6a0('0x5e')]=isNaN(_0x28abd3[_0xc6a0('0x5f')])?null:_0x28abd3[_0xc6a0('0x5f')]*0x3e8;_0x582173[_0xc6a0('0x60')]=isNaN(_0x28abd3['sampleCount'])?null:_0x28abd3[_0xc6a0('0x61')];_0x582173['original_channelCount']=isNaN(_0x28abd3[_0xc6a0('0x62')])?null:_0x28abd3[_0xc6a0('0x62')];_0x582173['original_bitRate']=isNaN(_0x28abd3[_0xc6a0('0x63')])?null:_0x28abd3[_0xc6a0('0x63')];_0x582173[_0xc6a0('0x64')]=isNaN(_0x28abd3['sampleRate'])?null:_0x28abd3[_0xc6a0('0x65')];});_0x574090['on'](_0xc6a0('0x66'),function(_0x50e718){_0x582173['converted_duration']=isNaN(_0x50e718['duration'])?null:_0x50e718[_0xc6a0('0x5f')]*0x3e8;_0x582173[_0xc6a0('0x67')]=isNaN(_0x50e718['sampleCount'])?null:_0x50e718[_0xc6a0('0x61')];_0x582173[_0xc6a0('0x68')]=isNaN(_0x50e718[_0xc6a0('0x62')])?null:_0x50e718[_0xc6a0('0x62')];_0x582173['converted_bitRate']=isNaN(_0x50e718['bitRate'])?null:_0x50e718[_0xc6a0('0x63')];_0x582173[_0xc6a0('0x69')]=isNaN(_0x50e718[_0xc6a0('0x65')])?null:_0x50e718['sampleRate'];});_0x574090['on'](_0xc6a0('0x21'),function(){fs['chmodSync'](_0xf757f,parseInt('0777',0x8));return db[_0xc6a0('0x39')][_0xc6a0('0x4d')](_0x582173)[_0xc6a0('0x1d')](function(_0x4ba467){var _0x3fb0e0={'role':_0x36b3f3[_0xc6a0('0x6a')][_0xc6a0('0x6b')],'userProfileId':_0x36b3f3[_0xc6a0('0x6a')][_0xc6a0('0x6c')]};if(!_0x3fb0e0)throw new Error(_0xc6a0('0x6d'));if(_0x3fb0e0[_0xc6a0('0x6b')]==='user'){var _0x5bc02d=_0x4ba467[_0xc6a0('0x1f')]({'plain':!![]});return db[_0xc6a0('0x6e')][_0xc6a0('0x40')]({'where':{'name':_0xc6a0('0x20'),'userProfileId':_0x3fb0e0['userProfileId']},'raw':!![]})[_0xc6a0('0x1d')](function(_0x45a7ab){if(_0x45a7ab&&_0x45a7ab['autoAssociation']===0x0){return db['UserProfileResource'][_0xc6a0('0x4d')]({'name':_0x5bc02d[_0xc6a0('0x23')],'resourceId':_0x5bc02d['id'],'type':_0x45a7ab[_0xc6a0('0x23')],'sectionId':_0x45a7ab['id']},{})['then'](function(){return _0x4ba467;});}else{return _0x4ba467;}})[_0xc6a0('0x3e')](function(_0x302afb){logger[_0xc6a0('0x5c')](_0xc6a0('0x6f'),_0x302afb);throw _0x302afb;});}return _0x4ba467;})[_0xc6a0('0x1d')](respondWithResult(_0x2e7613,null))[_0xc6a0('0x3e')](handleError(_0x2e7613,null));});_0x574090[_0xc6a0('0x70')]();}catch(_0x33e5c8){_0x2e7613[_0xc6a0('0x12')](0x1f4)[_0xc6a0('0x24')](_0x33e5c8);}};exports['update']=function(_0x352f31,_0x3928de,_0x466b06){return db[_0xc6a0('0x39')][_0xc6a0('0x40')]({'where':{'id':_0x352f31[_0xc6a0('0x42')]['id']}})[_0xc6a0('0x1d')](handleEntityNotFound(_0x3928de,null))['then'](saveUpdates(_[_0xc6a0('0x34')](_0x352f31[_0xc6a0('0x6a')],[_0xc6a0('0x23'),'description']),null))['then'](respondWithResult(_0x3928de,null))[_0xc6a0('0x3e')](handleError(_0x3928de,null));};exports[_0xc6a0('0x71')]=function(_0x1c460d,_0xc713ce,_0x3f4fb9){return db[_0xc6a0('0x39')][_0xc6a0('0x40')]({'where':{'id':_0x1c460d[_0xc6a0('0x42')]['id']}})[_0xc6a0('0x1d')](function(_0x4b05b7){if(_0x4b05b7){return _0x4b05b7['destroy']();}})['then'](function(_0x43d3d7){var _0x1ac556=path[_0xc6a0('0x56')](config[_0xc6a0('0x4a')],_0xc6a0('0x55'),util[_0xc6a0('0x4b')](_0xc6a0('0x4c'),_0x43d3d7[_0xc6a0('0x43')],_0x43d3d7[_0xc6a0('0x72')]));var _0x2154f1=path['join'](config[_0xc6a0('0x4a')],_0xc6a0('0x46'),util[_0xc6a0('0x4b')](_0xc6a0('0x4c'),_0x43d3d7[_0xc6a0('0x43')],_0x43d3d7[_0xc6a0('0x44')]));fs[_0xc6a0('0x73')](_0x1ac556);fs[_0xc6a0('0x73')](_0x2154f1);return _0x43d3d7;})[_0xc6a0('0x1d')](function(_0x4fb24e){if(_0x4fb24e){return _0xc713ce[_0xc6a0('0x12')](0xcc)[_0xc6a0('0x21')]();}})[_0xc6a0('0x1d')](handleEntityNotFound(_0xc713ce,null))[_0xc6a0('0x3e')](handleError(_0xc713ce,null));}; \ No newline at end of file +var _0x1d5d=['info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','start','description','delete','server/files/sounds/original','original_format','unlinkSync','end','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','originalname','extname','filename','substring','wav','join','Sound\x20upload\x20filepath:\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1d5d,0x1a5));var _0xd1d5=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x1d5d[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd1d5('0x0'));var rimraf=require(_0xd1d5('0x1'));var zipdir=require(_0xd1d5('0x2'));var jsonpatch=require(_0xd1d5('0x3'));var rp=require(_0xd1d5('0x4'));var moment=require(_0xd1d5('0x5'));var BPromise=require(_0xd1d5('0x6'));var Mustache=require(_0xd1d5('0x7'));var util=require(_0xd1d5('0x8'));var path=require(_0xd1d5('0x9'));var sox=require(_0xd1d5('0xa'));var csv=require(_0xd1d5('0xb'));var ejs=require(_0xd1d5('0xc'));var fs=require('fs');var _=require(_0xd1d5('0xd'));var squel=require('squel');var crypto=require(_0xd1d5('0xe'));var jsforce=require(_0xd1d5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd1d5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd1d5('0x10'));var qs=require(_0xd1d5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1d5('0x12'));var logger=require(_0xd1d5('0x13'))(_0xd1d5('0x14'));var utils=require(_0xd1d5('0x15'));var config=require(_0xd1d5('0x16'));var licenseUtil=require(_0xd1d5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfa86c0,_0x2eed26){_0x2eed26=_0x2eed26||0xcc;return function(_0x1bebb8){if(_0x1bebb8){return _0xfa86c0[_0xd1d5('0x18')](_0x2eed26);}return _0xfa86c0[_0xd1d5('0x19')](_0x2eed26)['end']();};}function respondWithResult(_0x22ce4a,_0x1dd450){_0x1dd450=_0x1dd450||0xc8;return function(_0x4e771c){if(_0x4e771c){return _0x22ce4a[_0xd1d5('0x19')](_0x1dd450)[_0xd1d5('0x1a')](_0x4e771c);}};}function respondWithFilteredResult(_0x4a7cc2,_0xef3b79){return function(_0x11ded2){if(_0x11ded2){var _0xe2acb5=_0x11ded2[_0xd1d5('0x1b')],_0x37fb9b=_0xef3b79['offset'],_0x39d8d0=_0xef3b79['offset']+_0xef3b79[_0xd1d5('0x1c')],_0x4970ac;if(_0x39d8d0>=_0xe2acb5){_0x39d8d0=_0xe2acb5;_0x4970ac=0xc8;}else{_0x4970ac=0xce;}_0x4a7cc2[_0xd1d5('0x19')](_0x4970ac);return _0x4a7cc2[_0xd1d5('0x1d')](_0xd1d5('0x1e'),_0x37fb9b+'-'+_0x39d8d0+'/'+_0xe2acb5)[_0xd1d5('0x1a')](_0x11ded2);}return null;};}function patchUpdates(_0xfc161d){return function(_0x69f5fb){try{jsonpatch[_0xd1d5('0x1f')](_0x69f5fb,_0xfc161d,!![]);}catch(_0x1da95d){return BPromise[_0xd1d5('0x20')](_0x1da95d);}return _0x69f5fb[_0xd1d5('0x21')]();};}function saveUpdates(_0x3a584c,_0x2f6361){return function(_0x575d6e){if(_0x575d6e){return _0x575d6e[_0xd1d5('0x22')](_0x3a584c)[_0xd1d5('0x23')](function(_0x2bc76b){return _0x2bc76b;});}return null;};}function removeEntity(_0x1c2c5e,_0x5bb8ad){return function(_0x5b5db1){if(_0x5b5db1){return _0x5b5db1[_0xd1d5('0x24')]()['then'](function(){var _0xcd4c60=_0x5b5db1[_0xd1d5('0x25')]({'plain':!![]});var _0x3361c5=_0xd1d5('0x26');return db[_0xd1d5('0x27')][_0xd1d5('0x24')]({'where':{'type':_0x3361c5,'resourceId':_0xcd4c60['id']}})[_0xd1d5('0x23')](function(){return _0x5b5db1;});})[_0xd1d5('0x23')](function(){_0x1c2c5e[_0xd1d5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb951,_0x3ba5c2){return function(_0x2eee5c){if(!_0x2eee5c){_0x1eb951[_0xd1d5('0x18')](0x194);}return _0x2eee5c;};}function handleError(_0x386702,_0x133cbd){_0x133cbd=_0x133cbd||0x1f4;return function(_0x4bf006){logger[_0xd1d5('0x28')](_0x4bf006[_0xd1d5('0x29')]);if(_0x4bf006[_0xd1d5('0x2a')]){delete _0x4bf006[_0xd1d5('0x2a')];}_0x386702[_0xd1d5('0x19')](_0x133cbd)[_0xd1d5('0x2b')](_0x4bf006);};}exports[_0xd1d5('0x2c')]=function(_0x46bfaa,_0x38da47){var _0xcb5b16={},_0x2aef86={},_0x41740d={'count':0x0,'rows':[]};var _0x5e2edb=_[_0xd1d5('0x2d')](db[_0xd1d5('0x2e')]['rawAttributes'],function(_0x55bb09){return{'name':_0x55bb09['fieldName'],'type':_0x55bb09['type'][_0xd1d5('0x2f')]};});_0x2aef86[_0xd1d5('0x30')]=_['map'](_0x5e2edb,_0xd1d5('0x2a'));_0x2aef86['query']=_[_0xd1d5('0x31')](_0x46bfaa['query']);_0x2aef86[_0xd1d5('0x32')]=_[_0xd1d5('0x33')](_0x2aef86[_0xd1d5('0x30')],_0x2aef86['query']);_0xcb5b16[_0xd1d5('0x34')]=_[_0xd1d5('0x33')](_0x2aef86[_0xd1d5('0x30')],qs[_0xd1d5('0x35')](_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x35')]));_0xcb5b16['attributes']=_0xcb5b16[_0xd1d5('0x34')][_0xd1d5('0x37')]?_0xcb5b16[_0xd1d5('0x34')]:_0x2aef86['model'];if(!_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x38')](_0xd1d5('0x39'))){_0xcb5b16[_0xd1d5('0x1c')]=qs[_0xd1d5('0x1c')](_0x46bfaa['query'][_0xd1d5('0x1c')]);_0xcb5b16['offset']=qs[_0xd1d5('0x3a')](_0x46bfaa['query']['offset']);}_0xcb5b16[_0xd1d5('0x3b')]=qs['sort'](_0x46bfaa['query'][_0xd1d5('0x3c')]);_0xcb5b16[_0xd1d5('0x3d')]=qs[_0xd1d5('0x32')](_[_0xd1d5('0x3e')](_0x46bfaa[_0xd1d5('0x36')],_0x2aef86[_0xd1d5('0x32')]),_0x5e2edb);if(_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x3f')]){_0xcb5b16['where']=_['merge'](_0xcb5b16[_0xd1d5('0x3d')],{'$or':_[_0xd1d5('0x2d')](_0x5e2edb,function(_0x5c860b){if(_0x5c860b[_0xd1d5('0x40')]!=='VIRTUAL'){var _0x4307ac={};_0x4307ac[_0x5c860b[_0xd1d5('0x2a')]]={'$like':'%'+_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x3f')]+'%'};return _0x4307ac;}})});}_0xcb5b16=_[_0xd1d5('0x41')]({},_0xcb5b16,_0x46bfaa[_0xd1d5('0x42')]);var _0x13cd6a={'where':_0xcb5b16[_0xd1d5('0x3d')]};return db[_0xd1d5('0x2e')][_0xd1d5('0x1b')](_0x13cd6a)['then'](function(_0x4f4c4e){_0x41740d[_0xd1d5('0x1b')]=_0x4f4c4e;if(_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x43')]){_0xcb5b16[_0xd1d5('0x44')]=[{'all':!![]}];}return db[_0xd1d5('0x2e')][_0xd1d5('0x45')](_0xcb5b16);})['then'](function(_0x3d2a49){_0x41740d['rows']=_0x3d2a49;return _0x41740d;})['then'](respondWithFilteredResult(_0x38da47,_0xcb5b16))[_0xd1d5('0x46')](handleError(_0x38da47,null));};exports[_0xd1d5('0x47')]=function(_0x473d01,_0x54681f){var _0x5cdcda={'raw':!![],'where':{'id':_0x473d01[_0xd1d5('0x48')]['id']}},_0x4e0d6b={};_0x4e0d6b['model']=_['keys'](db[_0xd1d5('0x2e')][_0xd1d5('0x49')]);_0x4e0d6b[_0xd1d5('0x36')]=_['keys'](_0x473d01['query']);_0x4e0d6b[_0xd1d5('0x32')]=_[_0xd1d5('0x33')](_0x4e0d6b[_0xd1d5('0x30')],_0x4e0d6b[_0xd1d5('0x36')]);_0x5cdcda[_0xd1d5('0x34')]=_['intersection'](_0x4e0d6b['model'],qs[_0xd1d5('0x35')](_0x473d01[_0xd1d5('0x36')][_0xd1d5('0x35')]));_0x5cdcda[_0xd1d5('0x34')]=_0x5cdcda['attributes'][_0xd1d5('0x37')]?_0x5cdcda[_0xd1d5('0x34')]:_0x4e0d6b[_0xd1d5('0x30')];if(_0x473d01[_0xd1d5('0x36')]['includeAll']){_0x5cdcda['include']=[{'all':!![]}];}_0x5cdcda=_['merge']({},_0x5cdcda,_0x473d01[_0xd1d5('0x42')]);return db[_0xd1d5('0x2e')][_0xd1d5('0x4a')](_0x5cdcda)[_0xd1d5('0x23')](handleEntityNotFound(_0x54681f,null))['then'](respondWithResult(_0x54681f,null))[_0xd1d5('0x46')](handleError(_0x54681f,null));};exports[_0xd1d5('0x4b')]=function(_0x111e09,_0x9163d2,_0x32f66e){return db['Sound']['find']({'where':{'id':_0x111e09['params']['id']},'attributes':[_0xd1d5('0x2a'),_0xd1d5('0x4c'),_0xd1d5('0x4d')],'raw':!![]})[_0xd1d5('0x23')](handleEntityNotFound(_0x9163d2,null))['then'](function(_0x4c549d){if(_0x4c549d){if(!fs[_0xd1d5('0x4e')](path['join'](config[_0xd1d5('0x4f')],_0xd1d5('0x50'),_0x4c549d[_0xd1d5('0x4c')]+'.'+_0x4c549d[_0xd1d5('0x4d')]))){throw new db['Sequelize'][(_0xd1d5('0x51'))](_0xd1d5('0x52'));}return _0x9163d2[_0xd1d5('0x4b')](path['join'](config[_0xd1d5('0x4f')],_0xd1d5('0x50'),util['format'](_0xd1d5('0x53'),_0x4c549d['save_name'],_0x4c549d[_0xd1d5('0x4d')])),util[_0xd1d5('0x54')](_0xd1d5('0x53'),_0x4c549d[_0xd1d5('0x2a')],_0x4c549d[_0xd1d5('0x4d')]));}return null;})[_0xd1d5('0x46')](handleError(_0x9163d2,null));};exports[_0xd1d5('0x55')]=function(_0x5983c9,_0x497741,_0xc99da5){var _0x59781f={'name':path[_0xd1d5('0x56')](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x58')],path[_0xd1d5('0x59')](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x58')])),'save_name':path[_0xd1d5('0x56')](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x5a')],path['extname'](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x5a')])),'original_format':path[_0xd1d5('0x59')](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x58')])[_0xd1d5('0x5b')](0x1),'converted_format':_0xd1d5('0x5c')};var _0x529010=path['join'](config[_0xd1d5('0x4f')],'server/files/sounds/original',_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x5a')]);var _0x206929=path[_0xd1d5('0x5d')](config[_0xd1d5('0x4f')],'server/files/sounds/converted',util[_0xd1d5('0x54')](_0xd1d5('0x53'),path[_0xd1d5('0x56')](_0x5983c9['file'][_0xd1d5('0x5a')],path[_0xd1d5('0x59')](_0x5983c9['file']['filename'])),_0x59781f['converted_format']));logger['info'](_0xd1d5('0x5e'),_0x529010);logger[_0xd1d5('0x5f')](_0xd1d5('0x60'),_0x206929);try{fs[_0xd1d5('0x61')](_0x529010,parseInt(_0xd1d5('0x62'),0x8));var _0x154b90=sox[_0xd1d5('0x63')](_0x529010,_0x206929,{'sampleRate':0x1f40,'format':_0xd1d5('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x154b90['on'](_0xd1d5('0x28'),function(_0x3f424a){fs['unlinkSync'](_0x529010);_0x497741[_0xd1d5('0x19')](0x1f4)['send'](_0x3f424a);});_0x154b90['on'](_0xd1d5('0x64'),function(_0x29bf47){_0x59781f[_0xd1d5('0x65')]=isNaN(_0x29bf47[_0xd1d5('0x66')])?null:_0x29bf47['duration']*0x3e8;_0x59781f[_0xd1d5('0x67')]=isNaN(_0x29bf47[_0xd1d5('0x68')])?null:_0x29bf47[_0xd1d5('0x68')];_0x59781f[_0xd1d5('0x69')]=isNaN(_0x29bf47[_0xd1d5('0x6a')])?null:_0x29bf47[_0xd1d5('0x6a')];_0x59781f[_0xd1d5('0x6b')]=isNaN(_0x29bf47[_0xd1d5('0x6c')])?null:_0x29bf47[_0xd1d5('0x6c')];_0x59781f[_0xd1d5('0x6d')]=isNaN(_0x29bf47[_0xd1d5('0x6e')])?null:_0x29bf47[_0xd1d5('0x6e')];});_0x154b90['on'](_0xd1d5('0x6f'),function(_0x1bddc0){_0x59781f[_0xd1d5('0x70')]=isNaN(_0x1bddc0[_0xd1d5('0x66')])?null:_0x1bddc0[_0xd1d5('0x66')]*0x3e8;_0x59781f[_0xd1d5('0x71')]=isNaN(_0x1bddc0['sampleCount'])?null:_0x1bddc0[_0xd1d5('0x68')];_0x59781f['converted_channelCount']=isNaN(_0x1bddc0[_0xd1d5('0x6a')])?null:_0x1bddc0[_0xd1d5('0x6a')];_0x59781f[_0xd1d5('0x72')]=isNaN(_0x1bddc0[_0xd1d5('0x6c')])?null:_0x1bddc0[_0xd1d5('0x6c')];_0x59781f['converted_sampleRate']=isNaN(_0x1bddc0[_0xd1d5('0x6e')])?null:_0x1bddc0[_0xd1d5('0x6e')];});_0x154b90['on']('end',function(){fs[_0xd1d5('0x61')](_0x206929,parseInt(_0xd1d5('0x62'),0x8));return db[_0xd1d5('0x2e')]['create'](_0x59781f)[_0xd1d5('0x23')](function(_0x396931){var _0xc0b6ee={'role':_0x5983c9[_0xd1d5('0x73')]['role'],'userProfileId':_0x5983c9[_0xd1d5('0x73')][_0xd1d5('0x74')]};if(!_0xc0b6ee)throw new Error(_0xd1d5('0x75'));if(_0xc0b6ee[_0xd1d5('0x76')]===_0xd1d5('0x77')){var _0x1d43ec=_0x396931[_0xd1d5('0x25')]({'plain':!![]});return db[_0xd1d5('0x78')][_0xd1d5('0x4a')]({'where':{'name':_0xd1d5('0x26'),'userProfileId':_0xc0b6ee[_0xd1d5('0x74')]},'raw':!![]})[_0xd1d5('0x23')](function(_0x1817f1){if(_0x1817f1&&_0x1817f1[_0xd1d5('0x79')]===0x0){return db[_0xd1d5('0x27')][_0xd1d5('0x55')]({'name':_0x1d43ec['name'],'resourceId':_0x1d43ec['id'],'type':_0x1817f1['name'],'sectionId':_0x1817f1['id']},{})['then'](function(){return _0x396931;});}else{return _0x396931;}})[_0xd1d5('0x46')](function(_0x4617b8){logger[_0xd1d5('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4617b8);throw _0x4617b8;});}return _0x396931;})[_0xd1d5('0x23')](respondWithResult(_0x497741,null))['catch'](handleError(_0x497741,null));});_0x154b90[_0xd1d5('0x7a')]();}catch(_0x261083){_0x497741['status'](0x1f4)[_0xd1d5('0x2b')](_0x261083);}};exports[_0xd1d5('0x22')]=function(_0x164eb7,_0x4c3ce9,_0x1dfa60){return db[_0xd1d5('0x2e')][_0xd1d5('0x4a')]({'where':{'id':_0x164eb7[_0xd1d5('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c3ce9,null))[_0xd1d5('0x23')](saveUpdates(_[_0xd1d5('0x3e')](_0x164eb7[_0xd1d5('0x73')],[_0xd1d5('0x2a'),_0xd1d5('0x7b')]),null))[_0xd1d5('0x23')](respondWithResult(_0x4c3ce9,null))[_0xd1d5('0x46')](handleError(_0x4c3ce9,null));};exports[_0xd1d5('0x7c')]=function(_0x3d23c2,_0x5c5d8f,_0x35e84e){return db['Sound'][_0xd1d5('0x4a')]({'where':{'id':_0x3d23c2[_0xd1d5('0x48')]['id']}})[_0xd1d5('0x23')](function(_0x42a9e7){if(_0x42a9e7){return _0x42a9e7['destroy']();}})['then'](function(_0x33f6f6){var _0x36ade3=path[_0xd1d5('0x5d')](config[_0xd1d5('0x4f')],_0xd1d5('0x7d'),util['format'](_0xd1d5('0x53'),_0x33f6f6['save_name'],_0x33f6f6[_0xd1d5('0x7e')]));var _0x6cd709=path['join'](config[_0xd1d5('0x4f')],_0xd1d5('0x50'),util[_0xd1d5('0x54')](_0xd1d5('0x53'),_0x33f6f6['save_name'],_0x33f6f6['converted_format']));fs[_0xd1d5('0x7f')](_0x36ade3);fs[_0xd1d5('0x7f')](_0x6cd709);return _0x33f6f6;})['then'](function(_0x19dc9a){if(_0x19dc9a){return _0x5c5d8f[_0xd1d5('0x19')](0xcc)[_0xd1d5('0x80')]();}})[_0xd1d5('0x23')](handleEntityNotFound(_0x5c5d8f,null))[_0xd1d5('0x46')](handleError(_0x5c5d8f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d77626a..8f10133 100644 --- a/server/api/sound/sound.model.js +++ b/server/api/sound/sound.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2068=['moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','Sound','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2068,0x152));var _0x8206=function(_0x4dde94,_0x52b903){_0x4dde94=_0x4dde94-0x0;var _0x30acf7=_0x2068[_0x4dde94];return _0x30acf7;};'use strict';var _=require(_0x8206('0x0'));var util=require(_0x8206('0x1'));var logger=require('../../config/logger')(_0x8206('0x2'));var moment=require(_0x8206('0x3'));var BPromise=require(_0x8206('0x4'));var rp=require(_0x8206('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8206('0x6'));var config=require(_0x8206('0x7'));var attributes=require(_0x8206('0x8'));module[_0x8206('0x9')]=function(_0x142ffe,_0x48b9ca){return _0x142ffe['define'](_0x8206('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ef7=['api','moment','bluebird','path','./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger'];(function(_0x31c79d,_0x2d70d8){var _0x4c04b6=function(_0x4586d6){while(--_0x4586d6){_0x31c79d['push'](_0x31c79d['shift']());}};_0x4c04b6(++_0x2d70d8);}(_0x7ef7,0x81));var _0x77ef=function(_0x3b552,_0x3a6075){_0x3b552=_0x3b552-0x0;var _0x39578f=_0x7ef7[_0x3b552];return _0x39578f;};'use strict';var _=require(_0x77ef('0x0'));var util=require(_0x77ef('0x1'));var logger=require(_0x77ef('0x2'))(_0x77ef('0x3'));var moment=require(_0x77ef('0x4'));var BPromise=require(_0x77ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x77ef('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x77ef('0x7'));module[_0x77ef('0x8')]=function(_0x2dd0d2,_0x126195){return _0x2dd0d2[_0x77ef('0x9')]('Sound',attributes,{'tableName':_0x77ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index be9adff..c7eea79 100644 --- a/server/api/sound/sound.rpc.js +++ b/server/api/sound/sound.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc991=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSound','Sound','find','options','raw','attributes','include','map','model','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s'];(function(_0x1f160d,_0x37dca6){var _0x1aedf0=function(_0x27fe87){while(--_0x27fe87){_0x1f160d['push'](_0x1f160d['shift']());}};_0x1aedf0(++_0x37dca6);}(_0xc991,0xbf));var _0x1c99=function(_0x185b86,_0x29b658){_0x185b86=_0x185b86-0x0;var _0x12a22f=_0xc991[_0x185b86];return _0x12a22f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1c99('0x0'));var BPromise=require(_0x1c99('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c99('0x2'));var db=require(_0x1c99('0x3'))['db'];var utils=require(_0x1c99('0x4'));var logger=require(_0x1c99('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1c99('0x6'));var client=jayson[_0x1c99('0x7')][_0x1c99('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a711b,_0x37cf6a,_0x5596e3){return new BPromise(function(_0x9b8134,_0xea72f8){return client[_0x1c99('0x9')](_0x1a711b,_0x5596e3)['then'](function(_0x59d4b2){logger[_0x1c99('0xa')](_0x1c99('0xb'),_0x37cf6a,_0x1c99('0xc'));logger[_0x1c99('0xd')](_0x1c99('0xe'),_0x37cf6a,_0x1c99('0xc'),JSON[_0x1c99('0xf')](_0x59d4b2));if(_0x59d4b2[_0x1c99('0x10')]){if(_0x59d4b2[_0x1c99('0x10')]['code']===0x1f4){logger[_0x1c99('0x10')](_0x1c99('0xb'),_0x37cf6a,_0x59d4b2[_0x1c99('0x10')][_0x1c99('0x11')]);return _0xea72f8(_0x59d4b2[_0x1c99('0x10')]['message']);}logger[_0x1c99('0x10')](_0x1c99('0xb'),_0x37cf6a,_0x59d4b2[_0x1c99('0x10')]['message']);return _0x9b8134(_0x59d4b2[_0x1c99('0x10')][_0x1c99('0x11')]);}else{logger[_0x1c99('0xa')]('Sound,\x20%s,\x20%s',_0x37cf6a,_0x1c99('0xc'));_0x9b8134(_0x59d4b2[_0x1c99('0x12')]['message']);}})['catch'](function(_0x43fe26){logger[_0x1c99('0x10')](_0x1c99('0xb'),_0x37cf6a,_0x43fe26);_0xea72f8(_0x43fe26);});});}exports[_0x1c99('0x13')]=function(_0x5c2491){var _0x58c613=this;return new Promise(function(_0x2c3d31,_0x292430){return db[_0x1c99('0x14')][_0x1c99('0x15')]({'raw':_0x5c2491['options']?_0x5c2491[_0x1c99('0x16')][_0x1c99('0x17')]===undefined?!![]:![]:!![],'where':_0x5c2491[_0x1c99('0x16')]?_0x5c2491[_0x1c99('0x16')]['where']||null:null,'attributes':_0x5c2491[_0x1c99('0x16')]?_0x5c2491[_0x1c99('0x16')][_0x1c99('0x18')]||null:null,'include':_0x5c2491[_0x1c99('0x16')]?_0x5c2491[_0x1c99('0x16')][_0x1c99('0x19')]?_[_0x1c99('0x1a')](_0x5c2491[_0x1c99('0x16')][_0x1c99('0x19')],function(_0x30afa6){return{'model':db[_0x30afa6['model']],'as':_0x30afa6['as'],'attributes':_0x30afa6[_0x1c99('0x18')],'include':_0x30afa6[_0x1c99('0x19')]?_['map'](_0x30afa6[_0x1c99('0x19')],function(_0x38baf6){return{'model':db[_0x38baf6[_0x1c99('0x1b')]],'as':_0x38baf6['as'],'attributes':_0x38baf6[_0x1c99('0x18')],'include':_0x38baf6['include']?_['map'](_0x38baf6[_0x1c99('0x19')],function(_0x11db03){return{'model':db[_0x11db03[_0x1c99('0x1b')]],'as':_0x11db03['as'],'attributes':_0x11db03[_0x1c99('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a3c64){logger[_0x1c99('0xa')]('ShowSound',_0x5c2491);logger[_0x1c99('0xd')](_0x1c99('0x13'),_0x5c2491,JSON[_0x1c99('0xf')](_0x1a3c64));_0x2c3d31(_0x1a3c64);})[_0x1c99('0x1c')](function(_0x26912e){logger['error'](_0x1c99('0x13'),_0x26912e['message'],_0x5c2491);_0x292430(_0x58c613[_0x1c99('0x10')](0x1f4,_0x26912e['message']));});});}; \ No newline at end of file +var _0x9dff=['../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','code','error','message','Sound,\x20%s,\x20%s','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','then','stringify','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x9dff,0x15b));var _0xf9df=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9dff[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require(_0xf9df('0x0'));var moment=require(_0xf9df('0x1'));var BPromise=require(_0xf9df('0x2'));var rs=require(_0xf9df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9df('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9df('0x5'))(_0xf9df('0x6'));var config=require(_0xf9df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf9df('0x8')][_0xf9df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x467bb9,_0x416b6e,_0x47f2e7){return new BPromise(function(_0x440b49,_0x2c0a7a){return client[_0xf9df('0xa')](_0x467bb9,_0x47f2e7)['then'](function(_0x446a6d){logger[_0xf9df('0xb')]('Sound,\x20%s,\x20%s',_0x416b6e,_0xf9df('0xc'));logger[_0xf9df('0xd')](_0xf9df('0xe'),_0x416b6e,_0xf9df('0xc'),JSON['stringify'](_0x446a6d));if(_0x446a6d['error']){if(_0x446a6d['error'][_0xf9df('0xf')]===0x1f4){logger[_0xf9df('0x10')]('Sound,\x20%s,\x20%s',_0x416b6e,_0x446a6d[_0xf9df('0x10')][_0xf9df('0x11')]);return _0x2c0a7a(_0x446a6d['error']['message']);}logger[_0xf9df('0x10')](_0xf9df('0x12'),_0x416b6e,_0x446a6d[_0xf9df('0x10')][_0xf9df('0x11')]);return _0x440b49(_0x446a6d[_0xf9df('0x10')][_0xf9df('0x11')]);}else{logger[_0xf9df('0xb')](_0xf9df('0x12'),_0x416b6e,'request\x20sent');_0x440b49(_0x446a6d[_0xf9df('0x13')][_0xf9df('0x11')]);}})['catch'](function(_0x3bb5cd){logger['error']('Sound,\x20%s,\x20%s',_0x416b6e,_0x3bb5cd);_0x2c0a7a(_0x3bb5cd);});});}exports[_0xf9df('0x14')]=function(_0x58a71d){var _0x453b5a=this;return new Promise(function(_0x46b0a8,_0x235e81){return db[_0xf9df('0x15')][_0xf9df('0x16')]({'raw':_0x58a71d[_0xf9df('0x17')]?_0x58a71d[_0xf9df('0x17')][_0xf9df('0x18')]===undefined?!![]:![]:!![],'where':_0x58a71d[_0xf9df('0x17')]?_0x58a71d[_0xf9df('0x17')][_0xf9df('0x19')]||null:null,'attributes':_0x58a71d[_0xf9df('0x17')]?_0x58a71d[_0xf9df('0x17')][_0xf9df('0x1a')]||null:null,'include':_0x58a71d['options']?_0x58a71d['options'][_0xf9df('0x1b')]?_[_0xf9df('0x1c')](_0x58a71d[_0xf9df('0x17')][_0xf9df('0x1b')],function(_0xa6d23c){return{'model':db[_0xa6d23c[_0xf9df('0x1d')]],'as':_0xa6d23c['as'],'attributes':_0xa6d23c['attributes'],'include':_0xa6d23c[_0xf9df('0x1b')]?_[_0xf9df('0x1c')](_0xa6d23c['include'],function(_0x48579f){return{'model':db[_0x48579f[_0xf9df('0x1d')]],'as':_0x48579f['as'],'attributes':_0x48579f[_0xf9df('0x1a')],'include':_0x48579f[_0xf9df('0x1b')]?_['map'](_0x48579f['include'],function(_0x5b5311){return{'model':db[_0x5b5311[_0xf9df('0x1d')]],'as':_0x5b5311['as'],'attributes':_0x5b5311['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9df('0x1e')](function(_0x383291){logger[_0xf9df('0xb')]('ShowSound',_0x58a71d);logger['debug'](_0xf9df('0x14'),_0x58a71d,JSON[_0xf9df('0x1f')](_0x383291));_0x46b0a8(_0x383291);})['catch'](function(_0x2c6423){logger[_0xf9df('0x10')](_0xf9df('0x14'),_0x2c6423[_0xf9df('0x11')],_0x58a71d);_0x235e81(_0x453b5a[_0xf9df('0x10')](0x1f4,_0x2c6423['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index bf3528c..4b33c29 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa21=['update','delete','destroy','multer','util','path','connect-timeout','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xaa21,0x163));var _0x1aa2=function(_0x109a2c,_0x1bce8a){_0x109a2c=_0x109a2c-0x0;var _0x4034bb=_0xaa21[_0x109a2c];return _0x4034bb;};'use strict';var multer=require(_0x1aa2('0x0'));var util=require(_0x1aa2('0x1'));var path=require(_0x1aa2('0x2'));var timeout=require(_0x1aa2('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1aa2('0x4'));router[_0x1aa2('0x5')]('/',auth[_0x1aa2('0x6')](),controller[_0x1aa2('0x7')]);router['get'](_0x1aa2('0x8'),auth[_0x1aa2('0x6')](),controller[_0x1aa2('0x9')]);router[_0x1aa2('0xa')]('/',auth[_0x1aa2('0x6')](),controller[_0x1aa2('0xb')]);router[_0x1aa2('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1aa2('0xd')]);router[_0x1aa2('0xe')](_0x1aa2('0x8'),auth[_0x1aa2('0x6')](),controller[_0x1aa2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x37e9=['../../config/environment','./squareMessage.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x53e19d,_0x604957){var _0x5ba332=function(_0x34f66e){while(--_0x34f66e){_0x53e19d['push'](_0x53e19d['shift']());}};_0x5ba332(++_0x604957);}(_0x37e9,0x1d7));var _0x937e=function(_0x26b3c7,_0x14891f){_0x26b3c7=_0x26b3c7-0x0;var _0x443e56=_0x37e9[_0x26b3c7];return _0x443e56;};'use strict';var multer=require(_0x937e('0x0'));var util=require(_0x937e('0x1'));var path=require('path');var timeout=require(_0x937e('0x2'));var express=require(_0x937e('0x3'));var router=express[_0x937e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x937e('0x5'));var controller=require(_0x937e('0x6'));router[_0x937e('0x7')]('/',auth[_0x937e('0x8')](),controller['index']);router['get'](_0x937e('0x9'),auth['isAuthenticated'](),controller[_0x937e('0xa')]);router[_0x937e('0xb')]('/',auth['isAuthenticated'](),controller[_0x937e('0xc')]);router['put']('/:id',auth[_0x937e('0x8')](),controller[_0x937e('0xd')]);router[_0x937e('0xe')](_0x937e('0x9'),auth[_0x937e('0x8')](),controller[_0x937e('0xf')]);module[_0x937e('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 3e86ba0..b437b0b 100644 --- a/server/api/squareMessage/squareMessage.attributes.js +++ b/server/api/squareMessage/squareMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed1f=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x42f036,_0x5e6443){var _0xcda4b=function(_0xa920a0){while(--_0xa920a0){_0x42f036['push'](_0x42f036['shift']());}};_0xcda4b(++_0x5e6443);}(_0xed1f,0x6a));var _0xfed1=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xed1f[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'body':{'type':Sequelize[_0xfed1('0x3')](_0xfed1('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xfed1('0x5')]('in',_0xfed1('0x6')),'defaultValue':_0xfed1('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xfed1('0x2')]},'providerResponse':{'type':Sequelize[_0xfed1('0x3')]}}; \ No newline at end of file +var _0x4c4e=['TEXT','medium','out','sequelize','STRING'];(function(_0x3d1b03,_0x23a423){var _0x4917c1=function(_0x83593b){while(--_0x83593b){_0x3d1b03['push'](_0x3d1b03['shift']());}};_0x4917c1(++_0x23a423);}(_0x4c4e,0x152));var _0xe4c4=function(_0x213da5,_0x38b66d){_0x213da5=_0x213da5-0x0;var _0x3e2157=_0x4c4e[_0x213da5];return _0x3e2157;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe4c4('0x1')]},'body':{'type':Sequelize[_0xe4c4('0x2')](_0xe4c4('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe4c4('0x4')),'defaultValue':_0xe4c4('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe4c4('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 5e2763a..d78e6dd 100644 --- a/server/api/squareMessage/squareMessage.controller.js +++ b/server/api/squareMessage/squareMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b77=['papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x31c317,_0x1c2e8b){var _0x5b81fb=function(_0xac1000){while(--_0xac1000){_0x31c317['push'](_0x31c317['shift']());}};_0x5b81fb(++_0x1c2e8b);}(_0x2b77,0xcb));var _0x72b7=function(_0x44ebba,_0x3cae9a){_0x44ebba=_0x44ebba-0x0;var _0x1fd11d=_0x2b77[_0x44ebba];return _0x1fd11d;};'use strict';var pdf=require(_0x72b7('0x0'));var emlformat=require(_0x72b7('0x1'));var rimraf=require(_0x72b7('0x2'));var zipdir=require(_0x72b7('0x3'));var jsonpatch=require(_0x72b7('0x4'));var rp=require(_0x72b7('0x5'));var moment=require(_0x72b7('0x6'));var BPromise=require(_0x72b7('0x7'));var Mustache=require(_0x72b7('0x8'));var util=require(_0x72b7('0x9'));var path=require(_0x72b7('0xa'));var sox=require(_0x72b7('0xb'));var csv=require(_0x72b7('0xc'));var ejs=require(_0x72b7('0xd'));var fs=require('fs');var _=require(_0x72b7('0xe'));var squel=require(_0x72b7('0xf'));var crypto=require(_0x72b7('0x10'));var jsforce=require(_0x72b7('0x11'));var deskjs=require(_0x72b7('0x12'));var toCsv=require(_0x72b7('0xc'));var querystring=require('querystring');var Papa=require(_0x72b7('0x13'));var Redis=require(_0x72b7('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72b7('0x15'));var logger=require(_0x72b7('0x16'))(_0x72b7('0x17'));var utils=require(_0x72b7('0x18'));var config=require(_0x72b7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x72b7('0x1a'))['db'];function respondWithStatusCode(_0x44fb46,_0x1fa59b){_0x1fa59b=_0x1fa59b||0xcc;return function(_0x1f08f9){if(_0x1f08f9){return _0x44fb46['sendStatus'](_0x1fa59b);}return _0x44fb46[_0x72b7('0x1b')](_0x1fa59b)[_0x72b7('0x1c')]();};}function respondWithResult(_0xd86415,_0xf973f7){_0xf973f7=_0xf973f7||0xc8;return function(_0x4ea71e){if(_0x4ea71e){return _0xd86415[_0x72b7('0x1b')](_0xf973f7)[_0x72b7('0x1d')](_0x4ea71e);}};}function respondWithFilteredResult(_0x2b32bc,_0x189ef4){return function(_0x3bacad){if(_0x3bacad){var _0x5c951e=_0x3bacad['count'],_0x9e1f91=_0x189ef4[_0x72b7('0x1e')],_0x9ca92a=_0x189ef4[_0x72b7('0x1e')]+_0x189ef4[_0x72b7('0x1f')],_0x480d69;if(_0x9ca92a>=_0x5c951e){_0x9ca92a=_0x5c951e;_0x480d69=0xc8;}else{_0x480d69=0xce;}_0x2b32bc['status'](_0x480d69);return _0x2b32bc['set'](_0x72b7('0x20'),_0x9e1f91+'-'+_0x9ca92a+'/'+_0x5c951e)[_0x72b7('0x1d')](_0x3bacad);}return null;};}function patchUpdates(_0x53a6ec){return function(_0xcbeb68){try{jsonpatch[_0x72b7('0x21')](_0xcbeb68,_0x53a6ec,!![]);}catch(_0x182117){return BPromise[_0x72b7('0x22')](_0x182117);}return _0xcbeb68['save']();};}function saveUpdates(_0x4239f0,_0x376f0a){return function(_0x533498){if(_0x533498){return _0x533498[_0x72b7('0x23')](_0x4239f0)[_0x72b7('0x24')](function(_0x1d5c65){return _0x1d5c65;});}return null;};}function removeEntity(_0x5cb3f3,_0x3d58aa){return function(_0x1fc91f){if(_0x1fc91f){return _0x1fc91f[_0x72b7('0x25')]()[_0x72b7('0x24')](function(){_0x5cb3f3[_0x72b7('0x1b')](0xcc)[_0x72b7('0x1c')]();});}};}function handleEntityNotFound(_0x36fb5a,_0x35aebd){return function(_0x48a5e5){if(!_0x48a5e5){_0x36fb5a['sendStatus'](0x194);}return _0x48a5e5;};}function handleError(_0x10b359,_0x3c8ff5){_0x3c8ff5=_0x3c8ff5||0x1f4;return function(_0x39ebe4){logger[_0x72b7('0x26')](_0x39ebe4[_0x72b7('0x27')]);if(_0x39ebe4[_0x72b7('0x28')]){delete _0x39ebe4[_0x72b7('0x28')];}_0x10b359['status'](_0x3c8ff5)[_0x72b7('0x29')](_0x39ebe4);};}exports[_0x72b7('0x2a')]=function(_0xeba951,_0x1efbef){var _0x4dc79a={},_0x53ba7c={},_0x2a4904={'count':0x0,'rows':[]};var _0xc536d7=_[_0x72b7('0x2b')](db[_0x72b7('0x2c')][_0x72b7('0x2d')],function(_0x206daf){return{'name':_0x206daf['fieldName'],'type':_0x206daf['type'][_0x72b7('0x2e')]};});_0x53ba7c[_0x72b7('0x2f')]=_[_0x72b7('0x2b')](_0xc536d7,_0x72b7('0x28'));_0x53ba7c['query']=_[_0x72b7('0x30')](_0xeba951['query']);_0x53ba7c[_0x72b7('0x31')]=_[_0x72b7('0x32')](_0x53ba7c[_0x72b7('0x2f')],_0x53ba7c[_0x72b7('0x33')]);_0x4dc79a[_0x72b7('0x34')]=_[_0x72b7('0x32')](_0x53ba7c[_0x72b7('0x2f')],qs['fields'](_0xeba951[_0x72b7('0x33')][_0x72b7('0x35')]));_0x4dc79a[_0x72b7('0x34')]=_0x4dc79a['attributes'][_0x72b7('0x36')]?_0x4dc79a['attributes']:_0x53ba7c['model'];if(!_0xeba951[_0x72b7('0x33')][_0x72b7('0x37')](_0x72b7('0x38'))){_0x4dc79a[_0x72b7('0x1f')]=qs[_0x72b7('0x1f')](_0xeba951[_0x72b7('0x33')][_0x72b7('0x1f')]);_0x4dc79a['offset']=qs[_0x72b7('0x1e')](_0xeba951[_0x72b7('0x33')]['offset']);}_0x4dc79a[_0x72b7('0x39')]=qs[_0x72b7('0x3a')](_0xeba951[_0x72b7('0x33')][_0x72b7('0x3a')]);_0x4dc79a[_0x72b7('0x3b')]=qs[_0x72b7('0x31')](_['pick'](_0xeba951[_0x72b7('0x33')],_0x53ba7c[_0x72b7('0x31')]),_0xc536d7);if(_0xeba951[_0x72b7('0x33')][_0x72b7('0x3c')]){_0x4dc79a[_0x72b7('0x3b')]=_[_0x72b7('0x3d')](_0x4dc79a[_0x72b7('0x3b')],{'$or':_[_0x72b7('0x2b')](_0xc536d7,function(_0x2e9f80){if(_0x2e9f80[_0x72b7('0x3e')]!==_0x72b7('0x3f')){var _0x65820d={};_0x65820d[_0x2e9f80[_0x72b7('0x28')]]={'$like':'%'+_0xeba951[_0x72b7('0x33')]['filter']+'%'};return _0x65820d;}})});}_0x4dc79a=_[_0x72b7('0x3d')]({},_0x4dc79a,_0xeba951[_0x72b7('0x40')]);var _0x536aeb={'where':_0x4dc79a[_0x72b7('0x3b')]};return db[_0x72b7('0x2c')][_0x72b7('0x41')](_0x536aeb)['then'](function(_0x306043){_0x2a4904['count']=_0x306043;if(_0xeba951[_0x72b7('0x33')][_0x72b7('0x42')]){_0x4dc79a[_0x72b7('0x43')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x4dc79a);})[_0x72b7('0x24')](function(_0x532af9){_0x2a4904[_0x72b7('0x44')]=_0x532af9;return _0x2a4904;})[_0x72b7('0x24')](respondWithFilteredResult(_0x1efbef,_0x4dc79a))[_0x72b7('0x45')](handleError(_0x1efbef,null));};exports['show']=function(_0x17a751,_0x58ea67){var _0x3503a2={'raw':!![],'where':{'id':_0x17a751[_0x72b7('0x46')]['id']}},_0x5b3ed7={};_0x5b3ed7[_0x72b7('0x2f')]=_['keys'](db['SquareMessage'][_0x72b7('0x2d')]);_0x5b3ed7['query']=_['keys'](_0x17a751[_0x72b7('0x33')]);_0x5b3ed7[_0x72b7('0x31')]=_[_0x72b7('0x32')](_0x5b3ed7[_0x72b7('0x2f')],_0x5b3ed7[_0x72b7('0x33')]);_0x3503a2['attributes']=_[_0x72b7('0x32')](_0x5b3ed7[_0x72b7('0x2f')],qs[_0x72b7('0x35')](_0x17a751['query']['fields']));_0x3503a2[_0x72b7('0x34')]=_0x3503a2[_0x72b7('0x34')][_0x72b7('0x36')]?_0x3503a2['attributes']:_0x5b3ed7[_0x72b7('0x2f')];if(_0x17a751[_0x72b7('0x33')][_0x72b7('0x42')]){_0x3503a2[_0x72b7('0x43')]=[{'all':!![]}];}_0x3503a2=_[_0x72b7('0x3d')]({},_0x3503a2,_0x17a751[_0x72b7('0x40')]);return db[_0x72b7('0x2c')][_0x72b7('0x47')](_0x3503a2)[_0x72b7('0x24')](handleEntityNotFound(_0x58ea67,null))['then'](respondWithResult(_0x58ea67,null))[_0x72b7('0x45')](handleError(_0x58ea67,null));};exports[_0x72b7('0x48')]=function(_0x2df331,_0x1f5aec){return db[_0x72b7('0x2c')][_0x72b7('0x48')](_0x2df331[_0x72b7('0x49')],{})['then'](respondWithResult(_0x1f5aec,0xc9))[_0x72b7('0x45')](handleError(_0x1f5aec,null));};exports[_0x72b7('0x23')]=function(_0xcd1ddd,_0x2d1097){if(_0xcd1ddd[_0x72b7('0x49')]['id']){delete _0xcd1ddd[_0x72b7('0x49')]['id'];}return db[_0x72b7('0x2c')][_0x72b7('0x47')]({'where':{'id':_0xcd1ddd['params']['id']}})['then'](handleEntityNotFound(_0x2d1097,null))[_0x72b7('0x24')](saveUpdates(_0xcd1ddd[_0x72b7('0x49')],null))['then'](respondWithResult(_0x2d1097,null))[_0x72b7('0x45')](handleError(_0x2d1097,null));};exports[_0x72b7('0x25')]=function(_0x54858f,_0x2d0871){return db[_0x72b7('0x2c')]['find']({'where':{'id':_0x54858f['params']['id']}})['then'](handleEntityNotFound(_0x2d0871,null))[_0x72b7('0x24')](removeEntity(_0x2d0871,null))[_0x72b7('0x45')](handleError(_0x2d0871,null));}; \ No newline at end of file +var _0xdcfb=['status','end','json','offset','Content-Range','apply','reject','update','then','error','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','keys','length','options','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus'];(function(_0x25f0f4,_0x15e7d3){var _0x42d351=function(_0x3966fe){while(--_0x3966fe){_0x25f0f4['push'](_0x25f0f4['shift']());}};_0x42d351(++_0x15e7d3);}(_0xdcfb,0x77));var _0xbdcf=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0xdcfb[_0x29d6e6];return _0xc75ff0;};'use strict';var pdf=require(_0xbdcf('0x0'));var emlformat=require(_0xbdcf('0x1'));var rimraf=require(_0xbdcf('0x2'));var zipdir=require(_0xbdcf('0x3'));var jsonpatch=require(_0xbdcf('0x4'));var rp=require('request-promise');var moment=require(_0xbdcf('0x5'));var BPromise=require(_0xbdcf('0x6'));var Mustache=require('mustache');var util=require(_0xbdcf('0x7'));var path=require(_0xbdcf('0x8'));var sox=require(_0xbdcf('0x9'));var csv=require(_0xbdcf('0xa'));var ejs=require(_0xbdcf('0xb'));var fs=require('fs');var _=require(_0xbdcf('0xc'));var squel=require('squel');var crypto=require(_0xbdcf('0xd'));var jsforce=require(_0xbdcf('0xe'));var deskjs=require(_0xbdcf('0xf'));var toCsv=require(_0xbdcf('0xa'));var querystring=require(_0xbdcf('0x10'));var Papa=require('papaparse');var Redis=require(_0xbdcf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbdcf('0x12'));var as=require(_0xbdcf('0x13'));var hardwareService=require(_0xbdcf('0x14'));var logger=require(_0xbdcf('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xbdcf('0x16'));var licenseUtil=require(_0xbdcf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59215b,_0x30079c){_0x30079c=_0x30079c||0xcc;return function(_0x4db23d){if(_0x4db23d){return _0x59215b[_0xbdcf('0x18')](_0x30079c);}return _0x59215b[_0xbdcf('0x19')](_0x30079c)[_0xbdcf('0x1a')]();};}function respondWithResult(_0x2aea22,_0x4bb734){_0x4bb734=_0x4bb734||0xc8;return function(_0xce5e28){if(_0xce5e28){return _0x2aea22[_0xbdcf('0x19')](_0x4bb734)[_0xbdcf('0x1b')](_0xce5e28);}};}function respondWithFilteredResult(_0x22d849,_0x86125f){return function(_0x189049){if(_0x189049){var _0x4f0807=_0x189049['count'],_0x4911a3=_0x86125f['offset'],_0x4e09eb=_0x86125f[_0xbdcf('0x1c')]+_0x86125f['limit'],_0x5ef26a;if(_0x4e09eb>=_0x4f0807){_0x4e09eb=_0x4f0807;_0x5ef26a=0xc8;}else{_0x5ef26a=0xce;}_0x22d849[_0xbdcf('0x19')](_0x5ef26a);return _0x22d849['set'](_0xbdcf('0x1d'),_0x4911a3+'-'+_0x4e09eb+'/'+_0x4f0807)[_0xbdcf('0x1b')](_0x189049);}return null;};}function patchUpdates(_0x15a075){return function(_0x7a4d6a){try{jsonpatch[_0xbdcf('0x1e')](_0x7a4d6a,_0x15a075,!![]);}catch(_0x2236d9){return BPromise[_0xbdcf('0x1f')](_0x2236d9);}return _0x7a4d6a['save']();};}function saveUpdates(_0x3f265c,_0x1fa086){return function(_0x3cc48d){if(_0x3cc48d){return _0x3cc48d[_0xbdcf('0x20')](_0x3f265c)[_0xbdcf('0x21')](function(_0x56166d){return _0x56166d;});}return null;};}function removeEntity(_0x1d61d0,_0x4ac68d){return function(_0x1f379e){if(_0x1f379e){return _0x1f379e['destroy']()[_0xbdcf('0x21')](function(){_0x1d61d0[_0xbdcf('0x19')](0xcc)[_0xbdcf('0x1a')]();});}};}function handleEntityNotFound(_0x5e6b9e,_0x437347){return function(_0x15403b){if(!_0x15403b){_0x5e6b9e[_0xbdcf('0x18')](0x194);}return _0x15403b;};}function handleError(_0x2bb880,_0x3f1ada){_0x3f1ada=_0x3f1ada||0x1f4;return function(_0x183729){logger[_0xbdcf('0x22')](_0x183729['stack']);if(_0x183729[_0xbdcf('0x23')]){delete _0x183729[_0xbdcf('0x23')];}_0x2bb880[_0xbdcf('0x19')](_0x3f1ada)['send'](_0x183729);};}exports[_0xbdcf('0x24')]=function(_0x3f323d,_0x53eb54){var _0x5ed279={},_0x1fa57c={},_0x22e8e5={'count':0x0,'rows':[]};var _0x474b79=_[_0xbdcf('0x25')](db[_0xbdcf('0x26')][_0xbdcf('0x27')],function(_0x10a28c){return{'name':_0x10a28c[_0xbdcf('0x28')],'type':_0x10a28c[_0xbdcf('0x29')][_0xbdcf('0x2a')]};});_0x1fa57c[_0xbdcf('0x2b')]=_[_0xbdcf('0x25')](_0x474b79,_0xbdcf('0x23'));_0x1fa57c['query']=_['keys'](_0x3f323d[_0xbdcf('0x2c')]);_0x1fa57c[_0xbdcf('0x2d')]=_[_0xbdcf('0x2e')](_0x1fa57c[_0xbdcf('0x2b')],_0x1fa57c['query']);_0x5ed279[_0xbdcf('0x2f')]=_[_0xbdcf('0x2e')](_0x1fa57c[_0xbdcf('0x2b')],qs[_0xbdcf('0x30')](_0x3f323d[_0xbdcf('0x2c')]['fields']));_0x5ed279['attributes']=_0x5ed279['attributes']['length']?_0x5ed279[_0xbdcf('0x2f')]:_0x1fa57c[_0xbdcf('0x2b')];if(!_0x3f323d['query'][_0xbdcf('0x31')](_0xbdcf('0x32'))){_0x5ed279[_0xbdcf('0x33')]=qs[_0xbdcf('0x33')](_0x3f323d['query'][_0xbdcf('0x33')]);_0x5ed279[_0xbdcf('0x1c')]=qs['offset'](_0x3f323d['query'][_0xbdcf('0x1c')]);}_0x5ed279[_0xbdcf('0x34')]=qs['sort'](_0x3f323d[_0xbdcf('0x2c')][_0xbdcf('0x35')]);_0x5ed279[_0xbdcf('0x36')]=qs[_0xbdcf('0x2d')](_[_0xbdcf('0x37')](_0x3f323d[_0xbdcf('0x2c')],_0x1fa57c[_0xbdcf('0x2d')]),_0x474b79);if(_0x3f323d['query']['filter']){_0x5ed279[_0xbdcf('0x36')]=_[_0xbdcf('0x38')](_0x5ed279['where'],{'$or':_[_0xbdcf('0x25')](_0x474b79,function(_0x346b39){if(_0x346b39['type']!==_0xbdcf('0x39')){var _0x1dcc05={};_0x1dcc05[_0x346b39[_0xbdcf('0x23')]]={'$like':'%'+_0x3f323d['query'][_0xbdcf('0x3a')]+'%'};return _0x1dcc05;}})});}_0x5ed279=_[_0xbdcf('0x38')]({},_0x5ed279,_0x3f323d['options']);var _0x10294d={'where':_0x5ed279[_0xbdcf('0x36')]};return db[_0xbdcf('0x26')]['count'](_0x10294d)[_0xbdcf('0x21')](function(_0x45d30e){_0x22e8e5['count']=_0x45d30e;if(_0x3f323d[_0xbdcf('0x2c')][_0xbdcf('0x3b')]){_0x5ed279[_0xbdcf('0x3c')]=[{'all':!![]}];}return db[_0xbdcf('0x26')][_0xbdcf('0x3d')](_0x5ed279);})[_0xbdcf('0x21')](function(_0x14b3ae){_0x22e8e5['rows']=_0x14b3ae;return _0x22e8e5;})[_0xbdcf('0x21')](respondWithFilteredResult(_0x53eb54,_0x5ed279))['catch'](handleError(_0x53eb54,null));};exports[_0xbdcf('0x3e')]=function(_0x5bc777,_0xc244b8){var _0x409ae0={'raw':!![],'where':{'id':_0x5bc777['params']['id']}},_0xfad5cf={};_0xfad5cf[_0xbdcf('0x2b')]=_['keys'](db['SquareMessage']['rawAttributes']);_0xfad5cf[_0xbdcf('0x2c')]=_[_0xbdcf('0x3f')](_0x5bc777['query']);_0xfad5cf['filters']=_[_0xbdcf('0x2e')](_0xfad5cf[_0xbdcf('0x2b')],_0xfad5cf[_0xbdcf('0x2c')]);_0x409ae0[_0xbdcf('0x2f')]=_[_0xbdcf('0x2e')](_0xfad5cf[_0xbdcf('0x2b')],qs[_0xbdcf('0x30')](_0x5bc777[_0xbdcf('0x2c')][_0xbdcf('0x30')]));_0x409ae0[_0xbdcf('0x2f')]=_0x409ae0[_0xbdcf('0x2f')][_0xbdcf('0x40')]?_0x409ae0[_0xbdcf('0x2f')]:_0xfad5cf[_0xbdcf('0x2b')];if(_0x5bc777[_0xbdcf('0x2c')][_0xbdcf('0x3b')]){_0x409ae0[_0xbdcf('0x3c')]=[{'all':!![]}];}_0x409ae0=_['merge']({},_0x409ae0,_0x5bc777[_0xbdcf('0x41')]);return db[_0xbdcf('0x26')][_0xbdcf('0x42')](_0x409ae0)[_0xbdcf('0x21')](handleEntityNotFound(_0xc244b8,null))[_0xbdcf('0x21')](respondWithResult(_0xc244b8,null))[_0xbdcf('0x43')](handleError(_0xc244b8,null));};exports[_0xbdcf('0x44')]=function(_0x43e9ba,_0x8315bb){return db[_0xbdcf('0x26')][_0xbdcf('0x44')](_0x43e9ba[_0xbdcf('0x45')],{})[_0xbdcf('0x21')](respondWithResult(_0x8315bb,0xc9))[_0xbdcf('0x43')](handleError(_0x8315bb,null));};exports['update']=function(_0x7e3684,_0x35cc30){if(_0x7e3684[_0xbdcf('0x45')]['id']){delete _0x7e3684[_0xbdcf('0x45')]['id'];}return db[_0xbdcf('0x26')][_0xbdcf('0x42')]({'where':{'id':_0x7e3684[_0xbdcf('0x46')]['id']}})[_0xbdcf('0x21')](handleEntityNotFound(_0x35cc30,null))[_0xbdcf('0x21')](saveUpdates(_0x7e3684['body'],null))[_0xbdcf('0x21')](respondWithResult(_0x35cc30,null))[_0xbdcf('0x43')](handleError(_0x35cc30,null));};exports[_0xbdcf('0x47')]=function(_0x9007dd,_0x5235ba){return db[_0xbdcf('0x26')][_0xbdcf('0x42')]({'where':{'id':_0x9007dd['params']['id']}})[_0xbdcf('0x21')](handleEntityNotFound(_0x5235ba,null))[_0xbdcf('0x21')](removeEntity(_0x5235ba,null))[_0xbdcf('0x43')](handleError(_0x5235ba,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index da28ab3..791dae1 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c3b=['rimraf','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xe68d7d,_0x25750b){var _0x1ada39=function(_0x234e1a){while(--_0x234e1a){_0xe68d7d['push'](_0xe68d7d['shift']());}};_0x1ada39(++_0x25750b);}(_0x7c3b,0x19d));var _0xb7c3=function(_0x271866,_0x10879c){_0x271866=_0x271866-0x0;var _0x47989a=_0x7c3b[_0x271866];return _0x47989a;};'use strict';var _=require(_0xb7c3('0x0'));var util=require(_0xb7c3('0x1'));var logger=require(_0xb7c3('0x2'))(_0xb7c3('0x3'));var moment=require(_0xb7c3('0x4'));var BPromise=require(_0xb7c3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7c3('0x6'));var rimraf=require(_0xb7c3('0x7'));var config=require('../../config/environment');var attributes=require(_0xb7c3('0x8'));module[_0xb7c3('0x9')]=function(_0x483bcb,_0x38de9e){return _0x483bcb['define'](_0xb7c3('0xa'),attributes,{'tableName':_0xb7c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x663a=['rimraf','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4b0e95,_0x4ed0f6){var _0x25e584=function(_0x3f9a5d){while(--_0x3f9a5d){_0x4b0e95['push'](_0x4b0e95['shift']());}};_0x25e584(++_0x4ed0f6);}(_0x663a,0xb9));var _0xa663=function(_0x5b9069,_0x32b9c6){_0x5b9069=_0x5b9069-0x0;var _0x54e771=_0x663a[_0x5b9069];return _0x54e771;};'use strict';var _=require(_0xa663('0x0'));var util=require(_0xa663('0x1'));var logger=require(_0xa663('0x2'))(_0xa663('0x3'));var moment=require(_0xa663('0x4'));var BPromise=require('bluebird');var rp=require(_0xa663('0x5'));var fs=require('fs');var path=require(_0xa663('0x6'));var rimraf=require(_0xa663('0x7'));var config=require('../../config/environment');var attributes=require(_0xa663('0x8'));module[_0xa663('0x9')]=function(_0x3cd2cf,_0x1659cd){return _0x3cd2cf[_0xa663('0xa')](_0xa663('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 1ea8a7b..002b7ca 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x2424a0,_0x2c17e6){var _0x4648d1=function(_0x2c94b7){while(--_0x2c94b7){_0x2424a0['push'](_0x2424a0['shift']());}};_0x4648d1(++_0x2c17e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x55b14a,_0x3ee989){var _0x5d7df9=function(_0x31dbc5){while(--_0x31dbc5){_0x55b14a['push'](_0x55b14a['shift']());}};_0x5d7df9(++_0x3ee989);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 3860a13..4a8de0b 100644 --- a/server/api/squareOdbc/index.js +++ b/server/api/squareOdbc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6346=['path','connect-timeout','express','../../config/environment','./squareOdbc.controller','isAuthenticated','index','/:id','/:id/test','15s','post','put','update','delete','exports','multer','util'];(function(_0x363b8a,_0xc340f9){var _0x3ba5d4=function(_0x551758){while(--_0x551758){_0x363b8a['push'](_0x363b8a['shift']());}};_0x3ba5d4(++_0xc340f9);}(_0x6346,0x152));var _0x6634=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x6346[_0x342baa];return _0x1208f3;};'use strict';var multer=require(_0x6634('0x0'));var util=require(_0x6634('0x1'));var path=require(_0x6634('0x2'));var timeout=require(_0x6634('0x3'));var express=require(_0x6634('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6634('0x5'));var controller=require(_0x6634('0x6'));router['get']('/',auth[_0x6634('0x7')](),controller[_0x6634('0x8')]);router['get'](_0x6634('0x9'),auth[_0x6634('0x7')](),controller['show']);router['get'](_0x6634('0xa'),auth[_0x6634('0x7')](),timeout(_0x6634('0xb')),controller['test']);router[_0x6634('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6634('0xd')](_0x6634('0x9'),auth[_0x6634('0x7')](),controller[_0x6634('0xe')]);router[_0x6634('0xf')](_0x6634('0x9'),auth[_0x6634('0x7')](),controller['destroy']);module[_0x6634('0x10')]=router; \ No newline at end of file +var _0xc36d=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','test','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x52cdb5,_0x12a0a8){var _0x21c37a=function(_0x34bcca){while(--_0x34bcca){_0x52cdb5['push'](_0x52cdb5['shift']());}};_0x21c37a(++_0x12a0a8);}(_0xc36d,0x7d));var _0xdc36=function(_0x392be3,_0xf1d603){_0x392be3=_0x392be3-0x0;var _0x1453b2=_0xc36d[_0x392be3];return _0x1453b2;};'use strict';var multer=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var path=require(_0xdc36('0x2'));var timeout=require(_0xdc36('0x3'));var express=require(_0xdc36('0x4'));var router=express[_0xdc36('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdc36('0x6'));var config=require(_0xdc36('0x7'));var controller=require('./squareOdbc.controller');router[_0xdc36('0x8')]('/',auth[_0xdc36('0x9')](),controller[_0xdc36('0xa')]);router[_0xdc36('0x8')](_0xdc36('0xb'),auth['isAuthenticated'](),controller[_0xdc36('0xc')]);router[_0xdc36('0x8')](_0xdc36('0xd'),auth[_0xdc36('0x9')](),timeout('15s'),controller[_0xdc36('0xe')]);router[_0xdc36('0xf')]('/',auth['isAuthenticated'](),controller[_0xdc36('0x10')]);router[_0xdc36('0x11')](_0xdc36('0xb'),auth['isAuthenticated'](),controller[_0xdc36('0x12')]);router[_0xdc36('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xdc36('0x14')]);module[_0xdc36('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8dead8b..5b2d9d6 100644 --- a/server/api/squareOdbc/squareOdbc.attributes.js +++ b/server/api/squareOdbc/squareOdbc.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2da7=['STRING','exports'];(function(_0x134a72,_0x5cf1f5){var _0x36d44b=function(_0x5ab9bd){while(--_0x5ab9bd){_0x134a72['push'](_0x134a72['shift']());}};_0x36d44b(++_0x5cf1f5);}(_0x2da7,0x1af));var _0x72da=function(_0x2f9ece,_0x5afb2d){_0x2f9ece=_0x2f9ece-0x0;var _0x51f2fa=_0x2da7[_0x2f9ece];return _0x51f2fa;};'use strict';var Sequelize=require('sequelize');module[_0x72da('0x0')]={'name':{'type':Sequelize[_0x72da('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x72da('0x1')]}}; \ No newline at end of file +var _0xfb96=['name','sequelize','exports','STRING'];(function(_0x29b929,_0x2a4b10){var _0x3a8ce6=function(_0x1e2759){while(--_0x1e2759){_0x29b929['push'](_0x29b929['shift']());}};_0x3a8ce6(++_0x2a4b10);}(_0xfb96,0x69));var _0x6fb9=function(_0x5c929d,_0x56251b){_0x5c929d=_0x5c929d-0x0;var _0x50c0c3=_0xfb96[_0x5c929d];return _0x50c0c3;};'use strict';var Sequelize=require(_0x6fb9('0x0'));module[_0x6fb9('0x1')]={'name':{'type':Sequelize[_0x6fb9('0x2')],'unique':_0x6fb9('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x6fb9('0x2')]},'description':{'type':Sequelize[_0x6fb9('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 30f037d..37f2887 100644 --- a/server/api/squareOdbc/squareOdbc.controller.js +++ b/server/api/squareOdbc/squareOdbc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92e8=['destroy','get','ODBC','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then'];(function(_0x57eb70,_0x4061b6){var _0x58e6eb=function(_0x994875){while(--_0x994875){_0x57eb70['push'](_0x57eb70['shift']());}};_0x58e6eb(++_0x4061b6);}(_0x92e8,0x8a));var _0x892e=function(_0x255b94,_0x352b45){_0x255b94=_0x255b94-0x0;var _0xc5806b=_0x92e8[_0x255b94];return _0xc5806b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x892e('0x0'));var rimraf=require(_0x892e('0x1'));var zipdir=require(_0x892e('0x2'));var jsonpatch=require(_0x892e('0x3'));var rp=require(_0x892e('0x4'));var moment=require('moment');var BPromise=require(_0x892e('0x5'));var Mustache=require('mustache');var util=require(_0x892e('0x6'));var path=require('path');var sox=require(_0x892e('0x7'));var csv=require(_0x892e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x892e('0x9'));var squel=require(_0x892e('0xa'));var crypto=require(_0x892e('0xb'));var jsforce=require(_0x892e('0xc'));var deskjs=require(_0x892e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x892e('0xe'));var Redis=require(_0x892e('0xf'));var authService=require(_0x892e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x892e('0x11'));var hardwareService=require(_0x892e('0x12'));var logger=require(_0x892e('0x13'))(_0x892e('0x14'));var utils=require(_0x892e('0x15'));var config=require(_0x892e('0x16'));var licenseUtil=require(_0x892e('0x17'));var db=require(_0x892e('0x18'))['db'];function respondWithStatusCode(_0x3c8a55,_0x4d28bb){_0x4d28bb=_0x4d28bb||0xcc;return function(_0x4ac6be){if(_0x4ac6be){return _0x3c8a55[_0x892e('0x19')](_0x4d28bb);}return _0x3c8a55[_0x892e('0x1a')](_0x4d28bb)[_0x892e('0x1b')]();};}function respondWithResult(_0x4c1751,_0x13713c){_0x13713c=_0x13713c||0xc8;return function(_0x24ac7b){if(_0x24ac7b){return _0x4c1751[_0x892e('0x1a')](_0x13713c)[_0x892e('0x1c')](_0x24ac7b);}};}function respondWithFilteredResult(_0xb9905e,_0x5a019b){return function(_0x4aabb1){if(_0x4aabb1){var _0x3bc643=_0x4aabb1[_0x892e('0x1d')],_0x18cfac=_0x5a019b[_0x892e('0x1e')],_0x574da3=_0x5a019b['offset']+_0x5a019b[_0x892e('0x1f')],_0x30665b;if(_0x574da3>=_0x3bc643){_0x574da3=_0x3bc643;_0x30665b=0xc8;}else{_0x30665b=0xce;}_0xb9905e[_0x892e('0x1a')](_0x30665b);return _0xb9905e[_0x892e('0x20')]('Content-Range',_0x18cfac+'-'+_0x574da3+'/'+_0x3bc643)[_0x892e('0x1c')](_0x4aabb1);}return null;};}function patchUpdates(_0x231fe2){return function(_0x5f23ca){try{jsonpatch[_0x892e('0x21')](_0x5f23ca,_0x231fe2,!![]);}catch(_0x15e5e7){return BPromise[_0x892e('0x22')](_0x15e5e7);}return _0x5f23ca[_0x892e('0x23')]();};}function saveUpdates(_0x515cf3,_0x4fc578){return function(_0x37d1c7){if(_0x37d1c7){return _0x37d1c7[_0x892e('0x24')](_0x515cf3)[_0x892e('0x25')](function(_0x522e3c){return _0x522e3c;});}return null;};}function removeEntity(_0x565b42,_0x423263){return function(_0x789420){if(_0x789420){return _0x789420[_0x892e('0x26')]()[_0x892e('0x25')](function(){var _0x466941=_0x789420[_0x892e('0x27')]({'plain':!![]});var _0x1d6048=_0x892e('0x28');return db[_0x892e('0x29')][_0x892e('0x26')]({'where':{'type':_0x1d6048,'resourceId':_0x466941['id']}})[_0x892e('0x25')](function(){return _0x789420;});})['then'](function(){_0x565b42[_0x892e('0x1a')](0xcc)[_0x892e('0x1b')]();});}};}function handleEntityNotFound(_0x4b5b3c,_0x5df430){return function(_0x66d48f){if(!_0x66d48f){_0x4b5b3c[_0x892e('0x19')](0x194);}return _0x66d48f;};}function handleError(_0x1ac859,_0x27dbc8){_0x27dbc8=_0x27dbc8||0x1f4;return function(_0x2c6a61){logger[_0x892e('0x2a')](_0x2c6a61[_0x892e('0x2b')]);if(_0x2c6a61[_0x892e('0x2c')]){delete _0x2c6a61['name'];}_0x1ac859['status'](_0x27dbc8)[_0x892e('0x2d')](_0x2c6a61);};}exports['index']=function(_0x19f684,_0xdf19c2){var _0x502708={},_0x34d1a1={},_0x8dc7ed={'count':0x0,'rows':[]};var _0x5e6b35=_[_0x892e('0x2e')](db[_0x892e('0x2f')][_0x892e('0x30')],function(_0x13e98c){return{'name':_0x13e98c[_0x892e('0x31')],'type':_0x13e98c['type'][_0x892e('0x32')]};});_0x34d1a1[_0x892e('0x33')]=_[_0x892e('0x2e')](_0x5e6b35,'name');_0x34d1a1[_0x892e('0x34')]=_[_0x892e('0x35')](_0x19f684[_0x892e('0x34')]);_0x34d1a1[_0x892e('0x36')]=_[_0x892e('0x37')](_0x34d1a1[_0x892e('0x33')],_0x34d1a1[_0x892e('0x34')]);_0x502708[_0x892e('0x38')]=_['intersection'](_0x34d1a1[_0x892e('0x33')],qs[_0x892e('0x39')](_0x19f684[_0x892e('0x34')][_0x892e('0x39')]));_0x502708[_0x892e('0x38')]=_0x502708[_0x892e('0x38')]['length']?_0x502708[_0x892e('0x38')]:_0x34d1a1['model'];if(!_0x19f684['query']['hasOwnProperty'](_0x892e('0x3a'))){_0x502708[_0x892e('0x1f')]=qs[_0x892e('0x1f')](_0x19f684[_0x892e('0x34')]['limit']);_0x502708[_0x892e('0x1e')]=qs['offset'](_0x19f684[_0x892e('0x34')][_0x892e('0x1e')]);}_0x502708['order']=qs['sort'](_0x19f684[_0x892e('0x34')][_0x892e('0x3b')]);_0x502708[_0x892e('0x3c')]=qs[_0x892e('0x36')](_[_0x892e('0x3d')](_0x19f684[_0x892e('0x34')],_0x34d1a1['filters']),_0x5e6b35);if(_0x19f684[_0x892e('0x34')][_0x892e('0x3e')]){_0x502708[_0x892e('0x3c')]=_[_0x892e('0x3f')](_0x502708[_0x892e('0x3c')],{'$or':_[_0x892e('0x2e')](_0x5e6b35,function(_0x3775d5){if(_0x3775d5[_0x892e('0x40')]!==_0x892e('0x41')){var _0x2c0bac={};_0x2c0bac[_0x3775d5[_0x892e('0x2c')]]={'$like':'%'+_0x19f684['query'][_0x892e('0x3e')]+'%'};return _0x2c0bac;}})});}_0x502708=_[_0x892e('0x3f')]({},_0x502708,_0x19f684[_0x892e('0x42')]);var _0x3bb411={'where':_0x502708[_0x892e('0x3c')]};return db['SquareOdbc']['count'](_0x3bb411)['then'](function(_0x5400f2){_0x8dc7ed[_0x892e('0x1d')]=_0x5400f2;if(_0x19f684[_0x892e('0x34')][_0x892e('0x43')]){_0x502708['include']=[{'all':!![]}];}return db[_0x892e('0x2f')][_0x892e('0x44')](_0x502708);})[_0x892e('0x25')](function(_0x5dd09d){_0x8dc7ed[_0x892e('0x45')]=_0x5dd09d;return _0x8dc7ed;})[_0x892e('0x25')](respondWithFilteredResult(_0xdf19c2,_0x502708))[_0x892e('0x46')](handleError(_0xdf19c2,null));};exports[_0x892e('0x47')]=function(_0x269fe6,_0x594740){var _0x19cab6={'raw':!![],'where':{'id':_0x269fe6[_0x892e('0x48')]['id']}},_0x3ce18c={};_0x3ce18c[_0x892e('0x33')]=_[_0x892e('0x35')](db['SquareOdbc'][_0x892e('0x30')]);_0x3ce18c[_0x892e('0x34')]=_[_0x892e('0x35')](_0x269fe6[_0x892e('0x34')]);_0x3ce18c[_0x892e('0x36')]=_[_0x892e('0x37')](_0x3ce18c[_0x892e('0x33')],_0x3ce18c[_0x892e('0x34')]);_0x19cab6[_0x892e('0x38')]=_[_0x892e('0x37')](_0x3ce18c[_0x892e('0x33')],qs['fields'](_0x269fe6[_0x892e('0x34')]['fields']));_0x19cab6[_0x892e('0x38')]=_0x19cab6[_0x892e('0x38')][_0x892e('0x49')]?_0x19cab6['attributes']:_0x3ce18c['model'];if(_0x269fe6[_0x892e('0x34')]['includeAll']){_0x19cab6['include']=[{'all':!![]}];}_0x19cab6=_[_0x892e('0x3f')]({},_0x19cab6,_0x269fe6[_0x892e('0x42')]);return db[_0x892e('0x2f')]['find'](_0x19cab6)[_0x892e('0x25')](handleEntityNotFound(_0x594740,null))[_0x892e('0x25')](respondWithResult(_0x594740,null))[_0x892e('0x46')](handleError(_0x594740,null));};exports[_0x892e('0x4a')]=function(_0x23101b,_0x40da9e){return db[_0x892e('0x2f')][_0x892e('0x4a')](_0x23101b[_0x892e('0x4b')],{})[_0x892e('0x25')](function(_0x7e0bdb){var _0x4ee1b8=_0x23101b[_0x892e('0x4c')]['get']({'plain':!![]});if(!_0x4ee1b8)throw new Error(_0x892e('0x4d'));if(_0x4ee1b8[_0x892e('0x4e')]===_0x892e('0x4c')){var _0x33c635=_0x7e0bdb[_0x892e('0x27')]({'plain':!![]});var _0x212bfd=_0x892e('0x28');return db[_0x892e('0x4f')][_0x892e('0x50')]({'where':{'name':_0x212bfd,'userProfileId':_0x4ee1b8[_0x892e('0x51')]},'raw':!![]})[_0x892e('0x25')](function(_0x3269a9){if(_0x3269a9&&_0x3269a9['autoAssociation']===0x0){return db[_0x892e('0x29')][_0x892e('0x4a')]({'name':_0x33c635[_0x892e('0x2c')],'resourceId':_0x33c635['id'],'type':_0x3269a9[_0x892e('0x2c')],'sectionId':_0x3269a9['id']},{})[_0x892e('0x25')](function(){return _0x7e0bdb;});}else{return _0x7e0bdb;}})[_0x892e('0x46')](function(_0x5f540a){logger[_0x892e('0x2a')](_0x892e('0x52'),_0x5f540a);throw _0x5f540a;});}return _0x7e0bdb;})['then'](respondWithResult(_0x40da9e,0xc9))[_0x892e('0x46')](handleError(_0x40da9e,null));};exports[_0x892e('0x24')]=function(_0x2dadc1,_0x402a65){if(_0x2dadc1[_0x892e('0x4b')]['id']){delete _0x2dadc1['body']['id'];}return db[_0x892e('0x2f')]['find']({'where':{'id':_0x2dadc1[_0x892e('0x48')]['id']}})['then'](handleEntityNotFound(_0x402a65,null))[_0x892e('0x25')](saveUpdates(_0x2dadc1[_0x892e('0x4b')],null))[_0x892e('0x25')](respondWithResult(_0x402a65,null))[_0x892e('0x46')](handleError(_0x402a65,null));};exports[_0x892e('0x26')]=function(_0x4a4f39,_0x4328c2){return db['SquareOdbc'][_0x892e('0x50')]({'where':{'id':_0x4a4f39[_0x892e('0x48')]['id']}})[_0x892e('0x25')](handleEntityNotFound(_0x4328c2,null))['then'](removeEntity(_0x4328c2,null))[_0x892e('0x46')](handleError(_0x4328c2,null));};exports[_0x892e('0x53')]=function(_0x38bd51,_0x154b46,_0x40306e){var _0x2e9a2f;return db[_0x892e('0x2f')]['find']({'where':{'id':_0x38bd51[_0x892e('0x48')]['id']},'attributes':['id',_0x892e('0x54')]})[_0x892e('0x25')](handleEntityNotFound(_0x154b46,null))[_0x892e('0x25')](function(_0x130173){if(_0x130173){var _0x3ae9df=require(_0x892e('0x55'))();_0x3ae9df[_0x892e('0x56')](_0x130173['dsn']);_0x3ae9df[_0x892e('0x57')]();return _0x130173;}})['then'](respondWithResult(_0x154b46,null))['catch'](handleError(_0x154b46,null));}; \ No newline at end of file +var _0xb715=['send','index','map','SquareOdbc','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','params','keys','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','reject','update','destroy','get','ODBC','UserProfileResource','then','error','stack','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb715,0x175));var _0x5b71=function(_0x39ef91,_0x1c1657){_0x39ef91=_0x39ef91-0x0;var _0x4daad7=_0xb715[_0x39ef91];return _0x4daad7;};'use strict';var pdf=require(_0x5b71('0x0'));var emlformat=require(_0x5b71('0x1'));var rimraf=require(_0x5b71('0x2'));var zipdir=require(_0x5b71('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b71('0x4'));var BPromise=require(_0x5b71('0x5'));var Mustache=require(_0x5b71('0x6'));var util=require(_0x5b71('0x7'));var path=require(_0x5b71('0x8'));var sox=require(_0x5b71('0x9'));var csv=require(_0x5b71('0xa'));var ejs=require(_0x5b71('0xb'));var fs=require('fs');var _=require(_0x5b71('0xc'));var squel=require(_0x5b71('0xd'));var crypto=require(_0x5b71('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5b71('0xf'));var toCsv=require(_0x5b71('0xa'));var querystring=require(_0x5b71('0x10'));var Papa=require('papaparse');var Redis=require(_0x5b71('0x11'));var authService=require(_0x5b71('0x12'));var qs=require(_0x5b71('0x13'));var as=require(_0x5b71('0x14'));var hardwareService=require(_0x5b71('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5b71('0x16'));var config=require(_0x5b71('0x17'));var licenseUtil=require(_0x5b71('0x18'));var db=require(_0x5b71('0x19'))['db'];function respondWithStatusCode(_0x2c173f,_0xe163a7){_0xe163a7=_0xe163a7||0xcc;return function(_0x206b4e){if(_0x206b4e){return _0x2c173f[_0x5b71('0x1a')](_0xe163a7);}return _0x2c173f[_0x5b71('0x1b')](_0xe163a7)['end']();};}function respondWithResult(_0x3b779a,_0x392dd3){_0x392dd3=_0x392dd3||0xc8;return function(_0x544e63){if(_0x544e63){return _0x3b779a['status'](_0x392dd3)[_0x5b71('0x1c')](_0x544e63);}};}function respondWithFilteredResult(_0x154a0c,_0x450768){return function(_0xb807b9){if(_0xb807b9){var _0xa77a9e=_0xb807b9[_0x5b71('0x1d')],_0xe87399=_0x450768['offset'],_0x1545b4=_0x450768[_0x5b71('0x1e')]+_0x450768['limit'],_0x2a6fa1;if(_0x1545b4>=_0xa77a9e){_0x1545b4=_0xa77a9e;_0x2a6fa1=0xc8;}else{_0x2a6fa1=0xce;}_0x154a0c[_0x5b71('0x1b')](_0x2a6fa1);return _0x154a0c['set'](_0x5b71('0x1f'),_0xe87399+'-'+_0x1545b4+'/'+_0xa77a9e)[_0x5b71('0x1c')](_0xb807b9);}return null;};}function patchUpdates(_0x3017a5){return function(_0x405602){try{jsonpatch['apply'](_0x405602,_0x3017a5,!![]);}catch(_0x500b00){return BPromise[_0x5b71('0x20')](_0x500b00);}return _0x405602['save']();};}function saveUpdates(_0x36035a,_0x2b93ca){return function(_0x2ed5db){if(_0x2ed5db){return _0x2ed5db[_0x5b71('0x21')](_0x36035a)['then'](function(_0x56633a){return _0x56633a;});}return null;};}function removeEntity(_0xd1f98d,_0x2f6d34){return function(_0x265ab0){if(_0x265ab0){return _0x265ab0[_0x5b71('0x22')]()['then'](function(){var _0x3bd96a=_0x265ab0[_0x5b71('0x23')]({'plain':!![]});var _0x2bdbd4=_0x5b71('0x24');return db[_0x5b71('0x25')][_0x5b71('0x22')]({'where':{'type':_0x2bdbd4,'resourceId':_0x3bd96a['id']}})['then'](function(){return _0x265ab0;});})[_0x5b71('0x26')](function(){_0xd1f98d[_0x5b71('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x287f1b,_0x5e2b6b){return function(_0x381969){if(!_0x381969){_0x287f1b['sendStatus'](0x194);}return _0x381969;};}function handleError(_0x762cb9,_0x37f1ab){_0x37f1ab=_0x37f1ab||0x1f4;return function(_0x19bcb8){logger[_0x5b71('0x27')](_0x19bcb8[_0x5b71('0x28')]);if(_0x19bcb8[_0x5b71('0x29')]){delete _0x19bcb8['name'];}_0x762cb9[_0x5b71('0x1b')](_0x37f1ab)[_0x5b71('0x2a')](_0x19bcb8);};}exports[_0x5b71('0x2b')]=function(_0x31950,_0x3ad4c5){var _0x414e52={},_0x5bdbf4={},_0x575b9a={'count':0x0,'rows':[]};var _0x14b01a=_[_0x5b71('0x2c')](db[_0x5b71('0x2d')]['rawAttributes'],function(_0x2a8a11){return{'name':_0x2a8a11['fieldName'],'type':_0x2a8a11[_0x5b71('0x2e')][_0x5b71('0x2f')]};});_0x5bdbf4['model']=_['map'](_0x14b01a,'name');_0x5bdbf4[_0x5b71('0x30')]=_['keys'](_0x31950[_0x5b71('0x30')]);_0x5bdbf4[_0x5b71('0x31')]=_[_0x5b71('0x32')](_0x5bdbf4[_0x5b71('0x33')],_0x5bdbf4['query']);_0x414e52[_0x5b71('0x34')]=_[_0x5b71('0x32')](_0x5bdbf4[_0x5b71('0x33')],qs[_0x5b71('0x35')](_0x31950[_0x5b71('0x30')][_0x5b71('0x35')]));_0x414e52[_0x5b71('0x34')]=_0x414e52['attributes'][_0x5b71('0x36')]?_0x414e52['attributes']:_0x5bdbf4['model'];if(!_0x31950[_0x5b71('0x30')][_0x5b71('0x37')](_0x5b71('0x38'))){_0x414e52[_0x5b71('0x39')]=qs[_0x5b71('0x39')](_0x31950['query'][_0x5b71('0x39')]);_0x414e52[_0x5b71('0x1e')]=qs[_0x5b71('0x1e')](_0x31950[_0x5b71('0x30')][_0x5b71('0x1e')]);}_0x414e52[_0x5b71('0x3a')]=qs[_0x5b71('0x3b')](_0x31950[_0x5b71('0x30')][_0x5b71('0x3b')]);_0x414e52[_0x5b71('0x3c')]=qs['filters'](_[_0x5b71('0x3d')](_0x31950[_0x5b71('0x30')],_0x5bdbf4['filters']),_0x14b01a);if(_0x31950[_0x5b71('0x30')][_0x5b71('0x3e')]){_0x414e52[_0x5b71('0x3c')]=_['merge'](_0x414e52[_0x5b71('0x3c')],{'$or':_[_0x5b71('0x2c')](_0x14b01a,function(_0x55c9df){if(_0x55c9df['type']!==_0x5b71('0x3f')){var _0x436ae1={};_0x436ae1[_0x55c9df[_0x5b71('0x29')]]={'$like':'%'+_0x31950[_0x5b71('0x30')][_0x5b71('0x3e')]+'%'};return _0x436ae1;}})});}_0x414e52=_[_0x5b71('0x40')]({},_0x414e52,_0x31950[_0x5b71('0x41')]);var _0x2240f7={'where':_0x414e52[_0x5b71('0x3c')]};return db[_0x5b71('0x2d')]['count'](_0x2240f7)['then'](function(_0x31fdb2){_0x575b9a[_0x5b71('0x1d')]=_0x31fdb2;if(_0x31950[_0x5b71('0x30')][_0x5b71('0x42')]){_0x414e52['include']=[{'all':!![]}];}return db[_0x5b71('0x2d')]['findAll'](_0x414e52);})[_0x5b71('0x26')](function(_0x54b0ad){_0x575b9a['rows']=_0x54b0ad;return _0x575b9a;})[_0x5b71('0x26')](respondWithFilteredResult(_0x3ad4c5,_0x414e52))[_0x5b71('0x43')](handleError(_0x3ad4c5,null));};exports['show']=function(_0x1fa0df,_0x3f76ae){var _0x403351={'raw':!![],'where':{'id':_0x1fa0df[_0x5b71('0x44')]['id']}},_0x4da000={};_0x4da000[_0x5b71('0x33')]=_['keys'](db[_0x5b71('0x2d')]['rawAttributes']);_0x4da000[_0x5b71('0x30')]=_[_0x5b71('0x45')](_0x1fa0df[_0x5b71('0x30')]);_0x4da000['filters']=_['intersection'](_0x4da000[_0x5b71('0x33')],_0x4da000['query']);_0x403351['attributes']=_['intersection'](_0x4da000['model'],qs[_0x5b71('0x35')](_0x1fa0df[_0x5b71('0x30')]['fields']));_0x403351[_0x5b71('0x34')]=_0x403351[_0x5b71('0x34')][_0x5b71('0x36')]?_0x403351[_0x5b71('0x34')]:_0x4da000[_0x5b71('0x33')];if(_0x1fa0df['query'][_0x5b71('0x42')]){_0x403351[_0x5b71('0x46')]=[{'all':!![]}];}_0x403351=_['merge']({},_0x403351,_0x1fa0df[_0x5b71('0x41')]);return db[_0x5b71('0x2d')][_0x5b71('0x47')](_0x403351)['then'](handleEntityNotFound(_0x3f76ae,null))['then'](respondWithResult(_0x3f76ae,null))['catch'](handleError(_0x3f76ae,null));};exports[_0x5b71('0x48')]=function(_0x1b06a1,_0x4bdd09){return db[_0x5b71('0x2d')]['create'](_0x1b06a1[_0x5b71('0x49')],{})[_0x5b71('0x26')](function(_0x290eeb){var _0x1468ef=_0x1b06a1[_0x5b71('0x4a')][_0x5b71('0x23')]({'plain':!![]});if(!_0x1468ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1468ef['role']===_0x5b71('0x4a')){var _0x210c2e=_0x290eeb['get']({'plain':!![]});var _0x1963b8=_0x5b71('0x24');return db[_0x5b71('0x4b')][_0x5b71('0x47')]({'where':{'name':_0x1963b8,'userProfileId':_0x1468ef[_0x5b71('0x4c')]},'raw':!![]})[_0x5b71('0x26')](function(_0x32749c){if(_0x32749c&&_0x32749c[_0x5b71('0x4d')]===0x0){return db[_0x5b71('0x25')]['create']({'name':_0x210c2e[_0x5b71('0x29')],'resourceId':_0x210c2e['id'],'type':_0x32749c[_0x5b71('0x29')],'sectionId':_0x32749c['id']},{})[_0x5b71('0x26')](function(){return _0x290eeb;});}else{return _0x290eeb;}})['catch'](function(_0x464ad2){logger[_0x5b71('0x27')](_0x5b71('0x4e'),_0x464ad2);throw _0x464ad2;});}return _0x290eeb;})['then'](respondWithResult(_0x4bdd09,0xc9))[_0x5b71('0x43')](handleError(_0x4bdd09,null));};exports['update']=function(_0x5211a8,_0x3b2bf8){if(_0x5211a8[_0x5b71('0x49')]['id']){delete _0x5211a8[_0x5b71('0x49')]['id'];}return db[_0x5b71('0x2d')][_0x5b71('0x47')]({'where':{'id':_0x5211a8[_0x5b71('0x44')]['id']}})[_0x5b71('0x26')](handleEntityNotFound(_0x3b2bf8,null))[_0x5b71('0x26')](saveUpdates(_0x5211a8[_0x5b71('0x49')],null))['then'](respondWithResult(_0x3b2bf8,null))[_0x5b71('0x43')](handleError(_0x3b2bf8,null));};exports[_0x5b71('0x22')]=function(_0x18740b,_0x3e4084){return db['SquareOdbc'][_0x5b71('0x47')]({'where':{'id':_0x18740b[_0x5b71('0x44')]['id']}})[_0x5b71('0x26')](handleEntityNotFound(_0x3e4084,null))[_0x5b71('0x26')](removeEntity(_0x3e4084,null))['catch'](handleError(_0x3e4084,null));};exports[_0x5b71('0x4f')]=function(_0x5cc4b6,_0xcdc7b6,_0x56aa19){var _0x1f0d0c;return db[_0x5b71('0x2d')][_0x5b71('0x47')]({'where':{'id':_0x5cc4b6[_0x5b71('0x44')]['id']},'attributes':['id',_0x5b71('0x50')]})[_0x5b71('0x26')](handleEntityNotFound(_0xcdc7b6,null))['then'](function(_0xf83f97){if(_0xf83f97){var _0x30175f=require(_0x5b71('0x51'))();_0x30175f[_0x5b71('0x52')](_0xf83f97[_0x5b71('0x50')]);_0x30175f['closeSync']();return _0xf83f97;}})[_0x5b71('0x26')](respondWithResult(_0xcdc7b6,null))[_0x5b71('0x43')](handleError(_0xcdc7b6,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 975e1b0..80d1d16 100644 --- a/server/api/squareOdbc/squareOdbc.model.js +++ b/server/api/squareOdbc/squareOdbc.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1f4=['util','api','moment','bluebird','request-promise','path','rimraf','exports','define','lodash'];(function(_0x5f424e,_0x52a31c){var _0x5eff27=function(_0x5303ab){while(--_0x5303ab){_0x5f424e['push'](_0x5f424e['shift']());}};_0x5eff27(++_0x52a31c);}(_0xc1f4,0xc7));var _0x4c1f=function(_0x5d57c7,_0x3547be){_0x5d57c7=_0x5d57c7-0x0;var _0x2ee0ee=_0xc1f4[_0x5d57c7];return _0x2ee0ee;};'use strict';var _=require(_0x4c1f('0x0'));var util=require(_0x4c1f('0x1'));var logger=require('../../config/logger')(_0x4c1f('0x2'));var moment=require(_0x4c1f('0x3'));var BPromise=require(_0x4c1f('0x4'));var rp=require(_0x4c1f('0x5'));var fs=require('fs');var path=require(_0x4c1f('0x6'));var rimraf=require(_0x4c1f('0x7'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x4c1f('0x8')]=function(_0x5199a6,_0x44ed92){return _0x5199a6[_0x4c1f('0x9')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ae2=['util','api','bluebird','path','rimraf','../../config/environment','define','square_odbc','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ae2,0x143));var _0x28ae=function(_0xe7ded8,_0x27189e){_0xe7ded8=_0xe7ded8-0x0;var _0x312c1d=_0x8ae2[_0xe7ded8];return _0x312c1d;};'use strict';var _=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var logger=require('../../config/logger')(_0x28ae('0x2'));var moment=require('moment');var BPromise=require(_0x28ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x28ae('0x4'));var rimraf=require(_0x28ae('0x5'));var config=require(_0x28ae('0x6'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x442ce4,_0x1fb778){return _0x442ce4[_0x28ae('0x7')]('SquareOdbc',attributes,{'tableName':_0x28ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index f6b416e..4fd2e03 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x37c006,_0x1f647a){var _0x3f306e=function(_0x48de6a){while(--_0x48de6a){_0x37c006['push'](_0x37c006['shift']());}};_0x3f306e(++_0x1f647a);}(_0x008c,0x188));var _0xc008=function(_0x442b41,_0x22dc53){_0x442b41=_0x442b41-0x0;var _0x140d06=_0x008c[_0x442b41];return _0x140d06;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x26462e,_0x416ff7){var _0x31c3f0=function(_0xd387ea){while(--_0xd387ea){_0x26462e['push'](_0x26462e['shift']());}};_0x31c3f0(++_0x416ff7);}(_0xe14b,0x93));var _0xbe14=function(_0x495ae1,_0xf0af00){_0x495ae1=_0x495ae1-0x0;var _0x245e58=_0xe14b[_0x495ae1];return _0x245e58;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 567a664..db478e3 100644 --- a/server/api/squareProject/index.js +++ b/server/api/squareProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3955=['update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create','put'];(function(_0x890db7,_0x4dcf2c){var _0x46412=function(_0x2685df){while(--_0x2685df){_0x890db7['push'](_0x890db7['shift']());}};_0x46412(++_0x4dcf2c);}(_0x3955,0xa6));var _0x5395=function(_0x8cd2c,_0x46441c){_0x8cd2c=_0x8cd2c-0x0;var _0x17f3ba=_0x3955[_0x8cd2c];return _0x17f3ba;};'use strict';var multer=require(_0x5395('0x0'));var util=require(_0x5395('0x1'));var path=require(_0x5395('0x2'));var timeout=require(_0x5395('0x3'));var express=require(_0x5395('0x4'));var router=express['Router']();var auth=require(_0x5395('0x5'));var interaction=require(_0x5395('0x6'));var config=require(_0x5395('0x7'));var controller=require('./squareProject.controller');router[_0x5395('0x8')]('/',auth[_0x5395('0x9')](),controller[_0x5395('0xa')]);router['get'](_0x5395('0xb'),auth[_0x5395('0x9')](),controller[_0x5395('0xc')]);router[_0x5395('0x8')](_0x5395('0xd'),auth['isAuthenticated'](),controller[_0x5395('0xe')]);router[_0x5395('0xf')]('/',auth[_0x5395('0x9')](),controller[_0x5395('0x10')]);router[_0x5395('0xf')]('/:id/users',auth['isAuthenticated'](),controller['addUsers']);router[_0x5395('0x11')](_0x5395('0xb'),auth[_0x5395('0x9')](),controller[_0x5395('0x12')]);router[_0x5395('0x13')](_0x5395('0xb'),auth['isAuthenticated'](),controller[_0x5395('0x14')]);router[_0x5395('0x13')](_0x5395('0xd'),auth[_0x5395('0x9')](),controller[_0x5395('0x15')]);module[_0x5395('0x16')]=router; \ No newline at end of file +var _0xf043=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','getUsers','post','/:id/users','addUsers','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x70338f,_0x28b42a){var _0x1748de=function(_0xf04f5f){while(--_0xf04f5f){_0x70338f['push'](_0x70338f['shift']());}};_0x1748de(++_0x28b42a);}(_0xf043,0x93));var _0x3f04=function(_0x378432,_0x640f2){_0x378432=_0x378432-0x0;var _0x2f98fa=_0xf043[_0x378432];return _0x2f98fa;};'use strict';var multer=require(_0x3f04('0x0'));var util=require(_0x3f04('0x1'));var path=require(_0x3f04('0x2'));var timeout=require(_0x3f04('0x3'));var express=require(_0x3f04('0x4'));var router=express[_0x3f04('0x5')]();var auth=require(_0x3f04('0x6'));var interaction=require(_0x3f04('0x7'));var config=require(_0x3f04('0x8'));var controller=require('./squareProject.controller');router[_0x3f04('0x9')]('/',auth[_0x3f04('0xa')](),controller['index']);router['get'](_0x3f04('0xb'),auth[_0x3f04('0xa')](),controller['show']);router[_0x3f04('0x9')]('/:id/users',auth[_0x3f04('0xa')](),controller[_0x3f04('0xc')]);router[_0x3f04('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3f04('0xd')](_0x3f04('0xe'),auth[_0x3f04('0xa')](),controller[_0x3f04('0xf')]);router[_0x3f04('0x10')](_0x3f04('0xb'),auth[_0x3f04('0xa')](),controller['update']);router[_0x3f04('0x11')](_0x3f04('0xb'),auth['isAuthenticated'](),controller[_0x3f04('0x12')]);router['delete'](_0x3f04('0xe'),auth[_0x3f04('0xa')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index c79def6..60a0c6e 100644 --- a/server/api/squareProject/squareProject.attributes.js +++ b/server/api/squareProject/squareProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeab2=['utf8','DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','production','toString'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0xeab2,0x18e));var _0x2eab=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xeab2[_0x466247];return _0x4b352e;};'use strict';var Sequelize=require(_0x2eab('0x0'));module[_0x2eab('0x1')]={'name':{'type':Sequelize[_0x2eab('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2eab('0x2')]},'notes':{'type':Sequelize[_0x2eab('0x3')]},'preproduction':{'type':Sequelize[_0x2eab('0x4')](_0x2eab('0x5')),'get':function(){if(this[_0x2eab('0x6')]('preproduction')){return this['getDataValue'](_0x2eab('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x2eab('0x5')),'get':function(){if(this[_0x2eab('0x6')](_0x2eab('0x8'))){return this['getDataValue'](_0x2eab('0x8'))[_0x2eab('0x9')](_0x2eab('0xa'));}}},'savedAt':{'type':Sequelize[_0x2eab('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xbc0c=['production','DATE','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0xbc0c,0x98));var _0xcbc0=function(_0x545081,_0x19c0b5){_0x545081=_0x545081-0x0;var _0x388046=_0xbc0c[_0x545081];return _0x388046;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcbc0('0x0')],'unique':_0xcbc0('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xcbc0('0x2')]},'preproduction':{'type':Sequelize[_0xcbc0('0x3')]('long'),'get':function(){if(this[_0xcbc0('0x4')]('preproduction')){return this[_0xcbc0('0x4')](_0xcbc0('0x5'))[_0xcbc0('0x6')](_0xcbc0('0x7'));}}},'production':{'type':Sequelize[_0xcbc0('0x3')]('long'),'get':function(){if(this['getDataValue'](_0xcbc0('0x8'))){return this['getDataValue'](_0xcbc0('0x8'))[_0xcbc0('0x6')](_0xcbc0('0x7'));}}},'savedAt':{'type':Sequelize[_0xcbc0('0x9')]},'publishedAt':{'type':Sequelize[_0xcbc0('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 95a8401..520b2de 100644 --- a/server/api/squareProject/squareProject.controller.js +++ b/server/api/squareProject/squareProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda44=['SquareProject','count','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addUsers','ids','removeUsers','emit','userSquareProject:remove','findOne','User','getUsers','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','SquareProjects','UserProfileResource','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','options'];(function(_0x54f4a4,_0x21da9e){var _0x3446b5=function(_0x104091){while(--_0x104091){_0x54f4a4['push'](_0x54f4a4['shift']());}};_0x3446b5(++_0x21da9e);}(_0xda44,0x196));var _0x4da4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xda44[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x4da4('0x0'));var emlformat=require(_0x4da4('0x1'));var rimraf=require(_0x4da4('0x2'));var zipdir=require(_0x4da4('0x3'));var jsonpatch=require(_0x4da4('0x4'));var rp=require(_0x4da4('0x5'));var moment=require(_0x4da4('0x6'));var BPromise=require(_0x4da4('0x7'));var Mustache=require(_0x4da4('0x8'));var util=require('util');var path=require(_0x4da4('0x9'));var sox=require('sox');var csv=require(_0x4da4('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4da4('0xb'));var squel=require(_0x4da4('0xc'));var crypto=require('crypto');var jsforce=require(_0x4da4('0xd'));var deskjs=require(_0x4da4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4da4('0xf'));var Papa=require('papaparse');var Redis=require(_0x4da4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4da4('0x11'));var hardwareService=require(_0x4da4('0x12'));var logger=require(_0x4da4('0x13'))(_0x4da4('0x14'));var utils=require(_0x4da4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4da4('0x16'))['db'];config[_0x4da4('0x17')]=_[_0x4da4('0x18')](config[_0x4da4('0x17')],{'host':_0x4da4('0x19'),'port':0x18eb});var socket=require(_0x4da4('0x1a'))(new Redis(config[_0x4da4('0x17')]));require(_0x4da4('0x1b'))[_0x4da4('0x1c')](socket);function respondWithStatusCode(_0x445841,_0x364504){_0x364504=_0x364504||0xcc;return function(_0x509062){if(_0x509062){return _0x445841['sendStatus'](_0x364504);}return _0x445841[_0x4da4('0x1d')](_0x364504)[_0x4da4('0x1e')]();};}function respondWithResult(_0x1d923c,_0x18b94d){_0x18b94d=_0x18b94d||0xc8;return function(_0x343a44){if(_0x343a44){return _0x1d923c[_0x4da4('0x1d')](_0x18b94d)[_0x4da4('0x1f')](_0x343a44);}};}function respondWithFilteredResult(_0x25721f,_0x2f40d8){return function(_0x3255e9){if(_0x3255e9){var _0x10ca80=_0x3255e9['count'],_0x52e83f=_0x2f40d8[_0x4da4('0x20')],_0x3f55b5=_0x2f40d8['offset']+_0x2f40d8[_0x4da4('0x21')],_0x1573b5;if(_0x3f55b5>=_0x10ca80){_0x3f55b5=_0x10ca80;_0x1573b5=0xc8;}else{_0x1573b5=0xce;}_0x25721f[_0x4da4('0x1d')](_0x1573b5);return _0x25721f[_0x4da4('0x22')](_0x4da4('0x23'),_0x52e83f+'-'+_0x3f55b5+'/'+_0x10ca80)[_0x4da4('0x1f')](_0x3255e9);}return null;};}function patchUpdates(_0x53522f){return function(_0x5ece18){try{jsonpatch[_0x4da4('0x24')](_0x5ece18,_0x53522f,!![]);}catch(_0x1d3934){return BPromise[_0x4da4('0x25')](_0x1d3934);}return _0x5ece18['save']();};}function saveUpdates(_0x394b37,_0x33a192){return function(_0x1fc415){if(_0x1fc415){return _0x1fc415[_0x4da4('0x26')](_0x394b37)['then'](function(_0x437f79){return _0x437f79;});}return null;};}function removeEntity(_0x468443,_0x4a25c9){return function(_0x34d6eb){if(_0x34d6eb){return _0x34d6eb[_0x4da4('0x27')]()[_0x4da4('0x28')](function(){var _0x489157=_0x34d6eb[_0x4da4('0x29')]({'plain':!![]});var _0xaaee37=_0x4da4('0x2a');return db[_0x4da4('0x2b')]['destroy']({'where':{'type':_0xaaee37,'resourceId':_0x489157['id']}})[_0x4da4('0x28')](function(){return _0x34d6eb;});})[_0x4da4('0x28')](function(){_0x468443[_0x4da4('0x1d')](0xcc)[_0x4da4('0x1e')]();});}};}function handleEntityNotFound(_0x3456e2,_0xd656b7){return function(_0x512ac5){if(!_0x512ac5){_0x3456e2[_0x4da4('0x2c')](0x194);}return _0x512ac5;};}function handleError(_0x1a9f7c,_0x41aa71){_0x41aa71=_0x41aa71||0x1f4;return function(_0x2ac183){logger[_0x4da4('0x2d')](_0x2ac183[_0x4da4('0x2e')]);if(_0x2ac183[_0x4da4('0x2f')]){delete _0x2ac183[_0x4da4('0x2f')];}_0x1a9f7c[_0x4da4('0x1d')](_0x41aa71)['send'](_0x2ac183);};}exports[_0x4da4('0x30')]=function(_0x277df1,_0x3df68f){var _0x4d4b31={},_0x394b5e={},_0x5e6cb9={'count':0x0,'rows':[]};var _0x17e0fb=_['map'](db['SquareProject'][_0x4da4('0x31')],function(_0x55595a){return{'name':_0x55595a[_0x4da4('0x32')],'type':_0x55595a[_0x4da4('0x33')][_0x4da4('0x34')]};});_0x394b5e[_0x4da4('0x35')]=_['map'](_0x17e0fb,'name');_0x394b5e[_0x4da4('0x36')]=_[_0x4da4('0x37')](_0x277df1[_0x4da4('0x36')]);_0x394b5e[_0x4da4('0x38')]=_[_0x4da4('0x39')](_0x394b5e[_0x4da4('0x35')],_0x394b5e[_0x4da4('0x36')]);_0x4d4b31[_0x4da4('0x3a')]=_['intersection'](_0x394b5e['model'],qs['fields'](_0x277df1[_0x4da4('0x36')][_0x4da4('0x3b')]));_0x4d4b31[_0x4da4('0x3a')]=_0x4d4b31[_0x4da4('0x3a')][_0x4da4('0x3c')]?_0x4d4b31['attributes']:_0x394b5e['model'];if(!_0x277df1[_0x4da4('0x36')]['hasOwnProperty'](_0x4da4('0x3d'))){_0x4d4b31[_0x4da4('0x21')]=qs[_0x4da4('0x21')](_0x277df1[_0x4da4('0x36')][_0x4da4('0x21')]);_0x4d4b31[_0x4da4('0x20')]=qs[_0x4da4('0x20')](_0x277df1[_0x4da4('0x36')][_0x4da4('0x20')]);}_0x4d4b31[_0x4da4('0x3e')]=qs[_0x4da4('0x3f')](_0x277df1[_0x4da4('0x36')]['sort']);_0x4d4b31[_0x4da4('0x40')]=qs[_0x4da4('0x38')](_['pick'](_0x277df1[_0x4da4('0x36')],_0x394b5e[_0x4da4('0x38')]),_0x17e0fb);if(_0x277df1['query'][_0x4da4('0x41')]){_0x4d4b31['where']=_[_0x4da4('0x42')](_0x4d4b31[_0x4da4('0x40')],{'$or':_[_0x4da4('0x43')](_0x17e0fb,function(_0x223c64){if(_0x223c64[_0x4da4('0x33')]!=='VIRTUAL'){var _0x493b4d={};_0x493b4d[_0x223c64[_0x4da4('0x2f')]]={'$like':'%'+_0x277df1[_0x4da4('0x36')][_0x4da4('0x41')]+'%'};return _0x493b4d;}})});}_0x4d4b31=_[_0x4da4('0x42')]({},_0x4d4b31,_0x277df1[_0x4da4('0x44')]);var _0x596332={'where':_0x4d4b31[_0x4da4('0x40')]};return db[_0x4da4('0x45')][_0x4da4('0x46')](_0x596332)['then'](function(_0x20c0c5){_0x5e6cb9[_0x4da4('0x46')]=_0x20c0c5;if(_0x277df1[_0x4da4('0x36')][_0x4da4('0x47')]){_0x4d4b31['include']=[{'all':!![]}];}return db[_0x4da4('0x45')][_0x4da4('0x48')](_0x4d4b31);})[_0x4da4('0x28')](function(_0x491b42){_0x5e6cb9[_0x4da4('0x49')]=_0x491b42;return _0x5e6cb9;})[_0x4da4('0x28')](respondWithFilteredResult(_0x3df68f,_0x4d4b31))[_0x4da4('0x4a')](handleError(_0x3df68f,null));};exports[_0x4da4('0x4b')]=function(_0x311dcd,_0x203a01){var _0x53d3fa={'raw':![],'where':{'id':_0x311dcd[_0x4da4('0x4c')]['id']}},_0x30d667={};_0x30d667[_0x4da4('0x35')]=_[_0x4da4('0x37')](db['SquareProject']['rawAttributes']);_0x30d667[_0x4da4('0x36')]=_[_0x4da4('0x37')](_0x311dcd[_0x4da4('0x36')]);_0x30d667['filters']=_[_0x4da4('0x39')](_0x30d667['model'],_0x30d667['query']);_0x53d3fa[_0x4da4('0x3a')]=_[_0x4da4('0x39')](_0x30d667['model'],qs[_0x4da4('0x3b')](_0x311dcd[_0x4da4('0x36')][_0x4da4('0x3b')]));_0x53d3fa['attributes']=_0x53d3fa[_0x4da4('0x3a')]['length']?_0x53d3fa[_0x4da4('0x3a')]:_0x30d667[_0x4da4('0x35')];if(_0x311dcd[_0x4da4('0x36')][_0x4da4('0x47')]){_0x53d3fa[_0x4da4('0x4d')]=[{'all':!![]}];}_0x53d3fa=_[_0x4da4('0x42')]({},_0x53d3fa,_0x311dcd['options']);return db['SquareProject']['find'](_0x53d3fa)['then'](handleEntityNotFound(_0x203a01,null))['then'](respondWithResult(_0x203a01,null))[_0x4da4('0x4a')](handleError(_0x203a01,null));};exports[_0x4da4('0x4e')]=function(_0x18263a,_0x5aec1c){return db['SquareProject'][_0x4da4('0x4e')](_0x18263a[_0x4da4('0x4f')],{})[_0x4da4('0x28')](function(_0x4321a8){var _0x1e0a36=_0x18263a[_0x4da4('0x50')][_0x4da4('0x29')]({'plain':!![]});if(!_0x1e0a36)throw new Error(_0x4da4('0x51'));if(_0x1e0a36[_0x4da4('0x52')]===_0x4da4('0x50')){var _0x239223=_0x4321a8['get']({'plain':!![]});var _0x460c98=_0x4da4('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x460c98,'userProfileId':_0x1e0a36['userProfileId']},'raw':!![]})[_0x4da4('0x28')](function(_0x1f4495){if(_0x1f4495&&_0x1f4495[_0x4da4('0x53')]===0x0){return db[_0x4da4('0x2b')][_0x4da4('0x4e')]({'name':_0x239223[_0x4da4('0x2f')],'resourceId':_0x239223['id'],'type':_0x1f4495[_0x4da4('0x2f')],'sectionId':_0x1f4495['id']},{})[_0x4da4('0x28')](function(){return _0x4321a8;});}else{return _0x4321a8;}})[_0x4da4('0x4a')](function(_0x205c4b){logger[_0x4da4('0x2d')](_0x4da4('0x54'),_0x205c4b);throw _0x205c4b;});}return _0x4321a8;})['then'](respondWithResult(_0x5aec1c,0xc9))['catch'](handleError(_0x5aec1c,null));};exports[_0x4da4('0x26')]=function(_0x16560e,_0x47235){if(_0x16560e['body']['id']){delete _0x16560e['body']['id'];}return db[_0x4da4('0x45')][_0x4da4('0x55')]({'where':{'id':_0x16560e[_0x4da4('0x4c')]['id']}})[_0x4da4('0x28')](handleEntityNotFound(_0x47235,null))[_0x4da4('0x28')](saveUpdates(_0x16560e[_0x4da4('0x4f')],null))[_0x4da4('0x28')](respondWithResult(_0x47235,null))[_0x4da4('0x4a')](handleError(_0x47235,null));};exports['destroy']=function(_0x46bfed,_0x35b40f){return db[_0x4da4('0x45')]['find']({'where':{'id':_0x46bfed[_0x4da4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x35b40f,null))[_0x4da4('0x28')](removeEntity(_0x35b40f,null))[_0x4da4('0x4a')](handleError(_0x35b40f,null));};exports[_0x4da4('0x56')]=function(_0x4a27b4,_0x3904a2,_0x564913){return db[_0x4da4('0x45')]['find']({'where':{'id':_0x4a27b4[_0x4da4('0x4c')]['id']}})[_0x4da4('0x28')](handleEntityNotFound(_0x3904a2,null))[_0x4da4('0x28')](function(_0x3741ab){if(_0x3741ab){return _0x3741ab[_0x4da4('0x56')](_0x4a27b4[_0x4da4('0x4f')][_0x4da4('0x57')],_['omit'](_0x4a27b4[_0x4da4('0x4f')],['ids','id'])||{});}})[_0x4da4('0x28')](respondWithResult(_0x3904a2,null))[_0x4da4('0x4a')](handleError(_0x3904a2,null));};exports[_0x4da4('0x58')]=function(_0x4d39fa,_0x5ee2e7,_0x1216c6){return db[_0x4da4('0x45')]['find']({'where':{'id':_0x4d39fa[_0x4da4('0x4c')]['id']}})[_0x4da4('0x28')](handleEntityNotFound(_0x5ee2e7,null))[_0x4da4('0x28')](function(_0x51a668){if(_0x51a668){return _0x51a668[_0x4da4('0x58')](_0x4d39fa[_0x4da4('0x36')][_0x4da4('0x57')])[_0x4da4('0x28')](function(){if(_['isArray'](_0x4d39fa[_0x4da4('0x36')]['ids'])){for(var _0x5ebf81=0x0;_0x5ebf81<_0x4d39fa['query'][_0x4da4('0x57')][_0x4da4('0x3c')];_0x5ebf81+=0x1){socket[_0x4da4('0x59')](_0x4da4('0x5a'),{'UserId':Number(_0x4d39fa[_0x4da4('0x36')]['ids'][_0x5ebf81]),'SquareProjectId':Number(_0x4d39fa[_0x4da4('0x4c')]['id'])});}}else{socket[_0x4da4('0x59')](_0x4da4('0x5a'),{'UserId':Number(_0x4d39fa[_0x4da4('0x36')]['ids']),'SquareProjectId':Number(_0x4d39fa[_0x4da4('0x4c')]['id'])});}});}})[_0x4da4('0x28')](respondWithStatusCode(_0x5ee2e7,null))[_0x4da4('0x4a')](handleError(_0x5ee2e7,null));};exports['getUsers']=function(_0x332642,_0x26415e,_0xa7efb){var _0x5d2ff8={};var _0x68ade2={};var _0x30cada;var _0x566cbb;return db[_0x4da4('0x45')][_0x4da4('0x5b')]({'where':{'id':_0x332642['params']['id']}})[_0x4da4('0x28')](handleEntityNotFound(_0x26415e,null))['then'](function(_0xbda088){if(_0xbda088){_0x30cada=_0xbda088;_0x68ade2[_0x4da4('0x35')]=_[_0x4da4('0x37')](db[_0x4da4('0x5c')][_0x4da4('0x31')]);_0x68ade2['query']=_[_0x4da4('0x37')](_0x332642[_0x4da4('0x36')]);_0x68ade2['filters']=_['intersection'](_0x68ade2[_0x4da4('0x35')],_0x68ade2[_0x4da4('0x36')]);_0x5d2ff8[_0x4da4('0x3a')]=_[_0x4da4('0x39')](_0x68ade2[_0x4da4('0x35')],qs['fields'](_0x332642[_0x4da4('0x36')][_0x4da4('0x3b')]));_0x5d2ff8['attributes']=_0x5d2ff8[_0x4da4('0x3a')][_0x4da4('0x3c')]?_0x5d2ff8[_0x4da4('0x3a')]:_0x68ade2[_0x4da4('0x35')];_0x5d2ff8[_0x4da4('0x3e')]=qs[_0x4da4('0x3f')](_0x332642[_0x4da4('0x36')][_0x4da4('0x3f')]);_0x5d2ff8[_0x4da4('0x40')]=qs['filters'](_['pick'](_0x332642[_0x4da4('0x36')],_0x68ade2[_0x4da4('0x38')]));if(_0x332642[_0x4da4('0x36')][_0x4da4('0x41')]){_0x5d2ff8[_0x4da4('0x40')]=_[_0x4da4('0x42')](_0x5d2ff8['where'],{'$or':_['map'](_0x5d2ff8['attributes'],function(_0x317122){var _0x5dc993={};_0x5dc993[_0x317122]={'$like':'%'+_0x332642['query'][_0x4da4('0x41')]+'%'};return _0x5dc993;})});}_0x5d2ff8=_[_0x4da4('0x42')]({},_0x5d2ff8,_0x332642[_0x4da4('0x44')]);return _0x30cada[_0x4da4('0x5d')](_0x5d2ff8);}})[_0x4da4('0x28')](function(_0x1956e8){if(_0x1956e8){_0x566cbb=_0x1956e8[_0x4da4('0x3c')];if(!_0x332642[_0x4da4('0x36')][_0x4da4('0x5e')](_0x4da4('0x3d'))){_0x5d2ff8['limit']=qs['limit'](_0x332642[_0x4da4('0x36')]['limit']);_0x5d2ff8[_0x4da4('0x20')]=qs[_0x4da4('0x20')](_0x332642[_0x4da4('0x36')][_0x4da4('0x20')]);}return _0x30cada[_0x4da4('0x5d')](_0x5d2ff8);}})[_0x4da4('0x28')](function(_0x24573b){if(_0x24573b){return _0x24573b?{'count':_0x566cbb,'rows':_0x24573b}:null;}})[_0x4da4('0x28')](respondWithResult(_0x26415e,null))[_0x4da4('0x4a')](handleError(_0x26415e,null));}; \ No newline at end of file +var _0x83b6=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','findOne','sort','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','SquareProject','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','filter','merge','includeAll','include','findAll','rows','show','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x13bb0b,_0x4c6d55){var _0x1ccebc=function(_0xca60e){while(--_0xca60e){_0x13bb0b['push'](_0x13bb0b['shift']());}};_0x1ccebc(++_0x4c6d55);}(_0x83b6,0x187));var _0x683b=function(_0x395688,_0x3ff6be){_0x395688=_0x395688-0x0;var _0x50533a=_0x83b6[_0x395688];return _0x50533a;};'use strict';var pdf=require(_0x683b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x683b('0x1'));var zipdir=require(_0x683b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x683b('0x3'));var moment=require(_0x683b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x683b('0x5'));var util=require('util');var path=require(_0x683b('0x6'));var sox=require(_0x683b('0x7'));var csv=require('to-csv');var ejs=require(_0x683b('0x8'));var fs=require('fs');var _=require(_0x683b('0x9'));var squel=require('squel');var crypto=require(_0x683b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x683b('0xb'));var toCsv=require(_0x683b('0xc'));var querystring=require(_0x683b('0xd'));var Papa=require(_0x683b('0xe'));var Redis=require('ioredis');var authService=require(_0x683b('0xf'));var qs=require(_0x683b('0x10'));var as=require(_0x683b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x683b('0x12'))(_0x683b('0x13'));var utils=require(_0x683b('0x14'));var config=require(_0x683b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x683b('0x16'))['db'];config[_0x683b('0x17')]=_[_0x683b('0x18')](config[_0x683b('0x17')],{'host':_0x683b('0x19'),'port':0x18eb});var socket=require(_0x683b('0x1a'))(new Redis(config[_0x683b('0x17')]));require(_0x683b('0x1b'))[_0x683b('0x1c')](socket);function respondWithStatusCode(_0x342a07,_0x4d04c9){_0x4d04c9=_0x4d04c9||0xcc;return function(_0x2ec5e5){if(_0x2ec5e5){return _0x342a07['sendStatus'](_0x4d04c9);}return _0x342a07[_0x683b('0x1d')](_0x4d04c9)[_0x683b('0x1e')]();};}function respondWithResult(_0x149ced,_0x2e09f1){_0x2e09f1=_0x2e09f1||0xc8;return function(_0x25f1b5){if(_0x25f1b5){return _0x149ced['status'](_0x2e09f1)[_0x683b('0x1f')](_0x25f1b5);}};}function respondWithFilteredResult(_0x59a34d,_0xabebc3){return function(_0x536b90){if(_0x536b90){var _0x2f9201=_0x536b90[_0x683b('0x20')],_0x5476a5=_0xabebc3[_0x683b('0x21')],_0x1f834a=_0xabebc3[_0x683b('0x21')]+_0xabebc3[_0x683b('0x22')],_0x4ddebc;if(_0x1f834a>=_0x2f9201){_0x1f834a=_0x2f9201;_0x4ddebc=0xc8;}else{_0x4ddebc=0xce;}_0x59a34d[_0x683b('0x1d')](_0x4ddebc);return _0x59a34d[_0x683b('0x23')](_0x683b('0x24'),_0x5476a5+'-'+_0x1f834a+'/'+_0x2f9201)[_0x683b('0x1f')](_0x536b90);}return null;};}function patchUpdates(_0x2bb7ba){return function(_0x33bc4d){try{jsonpatch[_0x683b('0x25')](_0x33bc4d,_0x2bb7ba,!![]);}catch(_0x3c413d){return BPromise[_0x683b('0x26')](_0x3c413d);}return _0x33bc4d[_0x683b('0x27')]();};}function saveUpdates(_0x12b057,_0x26a8f9){return function(_0x492f8d){if(_0x492f8d){return _0x492f8d[_0x683b('0x28')](_0x12b057)[_0x683b('0x29')](function(_0x3cffbf){return _0x3cffbf;});}return null;};}function removeEntity(_0x3d479a,_0x1e3882){return function(_0x14e9f7){if(_0x14e9f7){return _0x14e9f7[_0x683b('0x2a')]()['then'](function(){var _0x2b0d13=_0x14e9f7[_0x683b('0x2b')]({'plain':!![]});var _0x552b90='SquareProjects';return db[_0x683b('0x2c')][_0x683b('0x2a')]({'where':{'type':_0x552b90,'resourceId':_0x2b0d13['id']}})[_0x683b('0x29')](function(){return _0x14e9f7;});})[_0x683b('0x29')](function(){_0x3d479a[_0x683b('0x1d')](0xcc)[_0x683b('0x1e')]();});}};}function handleEntityNotFound(_0xe51221,_0x478207){return function(_0x58146f){if(!_0x58146f){_0xe51221[_0x683b('0x2d')](0x194);}return _0x58146f;};}function handleError(_0x139288,_0x467e2a){_0x467e2a=_0x467e2a||0x1f4;return function(_0x1465c7){logger['error'](_0x1465c7[_0x683b('0x2e')]);if(_0x1465c7[_0x683b('0x2f')]){delete _0x1465c7[_0x683b('0x2f')];}_0x139288[_0x683b('0x1d')](_0x467e2a)[_0x683b('0x30')](_0x1465c7);};}exports[_0x683b('0x31')]=function(_0x11d3d9,_0x358484){var _0x1e7ff1={},_0x585e66={},_0x3bc30f={'count':0x0,'rows':[]};var _0x2873a1=_[_0x683b('0x32')](db[_0x683b('0x33')][_0x683b('0x34')],function(_0x5e0045){return{'name':_0x5e0045['fieldName'],'type':_0x5e0045[_0x683b('0x35')][_0x683b('0x36')]};});_0x585e66['model']=_[_0x683b('0x32')](_0x2873a1,_0x683b('0x2f'));_0x585e66[_0x683b('0x37')]=_[_0x683b('0x38')](_0x11d3d9[_0x683b('0x37')]);_0x585e66[_0x683b('0x39')]=_['intersection'](_0x585e66['model'],_0x585e66['query']);_0x1e7ff1['attributes']=_[_0x683b('0x3a')](_0x585e66[_0x683b('0x3b')],qs[_0x683b('0x3c')](_0x11d3d9[_0x683b('0x37')][_0x683b('0x3c')]));_0x1e7ff1[_0x683b('0x3d')]=_0x1e7ff1[_0x683b('0x3d')]['length']?_0x1e7ff1[_0x683b('0x3d')]:_0x585e66[_0x683b('0x3b')];if(!_0x11d3d9[_0x683b('0x37')][_0x683b('0x3e')](_0x683b('0x3f'))){_0x1e7ff1[_0x683b('0x22')]=qs[_0x683b('0x22')](_0x11d3d9[_0x683b('0x37')]['limit']);_0x1e7ff1['offset']=qs['offset'](_0x11d3d9[_0x683b('0x37')][_0x683b('0x21')]);}_0x1e7ff1[_0x683b('0x40')]=qs['sort'](_0x11d3d9[_0x683b('0x37')]['sort']);_0x1e7ff1[_0x683b('0x41')]=qs[_0x683b('0x39')](_['pick'](_0x11d3d9[_0x683b('0x37')],_0x585e66[_0x683b('0x39')]),_0x2873a1);if(_0x11d3d9[_0x683b('0x37')][_0x683b('0x42')]){_0x1e7ff1[_0x683b('0x41')]=_[_0x683b('0x43')](_0x1e7ff1[_0x683b('0x41')],{'$or':_[_0x683b('0x32')](_0x2873a1,function(_0x415813){if(_0x415813['type']!=='VIRTUAL'){var _0x5def25={};_0x5def25[_0x415813['name']]={'$like':'%'+_0x11d3d9['query']['filter']+'%'};return _0x5def25;}})});}_0x1e7ff1=_[_0x683b('0x43')]({},_0x1e7ff1,_0x11d3d9['options']);var _0xf37cbb={'where':_0x1e7ff1[_0x683b('0x41')]};return db['SquareProject'][_0x683b('0x20')](_0xf37cbb)[_0x683b('0x29')](function(_0x4b6963){_0x3bc30f[_0x683b('0x20')]=_0x4b6963;if(_0x11d3d9['query'][_0x683b('0x44')]){_0x1e7ff1[_0x683b('0x45')]=[{'all':!![]}];}return db[_0x683b('0x33')][_0x683b('0x46')](_0x1e7ff1);})[_0x683b('0x29')](function(_0x1b403d){_0x3bc30f[_0x683b('0x47')]=_0x1b403d;return _0x3bc30f;})[_0x683b('0x29')](respondWithFilteredResult(_0x358484,_0x1e7ff1))['catch'](handleError(_0x358484,null));};exports[_0x683b('0x48')]=function(_0x2ef83d,_0x29e7f2){var _0x7c728={'raw':![],'where':{'id':_0x2ef83d[_0x683b('0x49')]['id']}},_0x5149ad={};_0x5149ad[_0x683b('0x3b')]=_['keys'](db[_0x683b('0x33')][_0x683b('0x34')]);_0x5149ad[_0x683b('0x37')]=_['keys'](_0x2ef83d[_0x683b('0x37')]);_0x5149ad[_0x683b('0x39')]=_[_0x683b('0x3a')](_0x5149ad[_0x683b('0x3b')],_0x5149ad['query']);_0x7c728[_0x683b('0x3d')]=_['intersection'](_0x5149ad[_0x683b('0x3b')],qs['fields'](_0x2ef83d['query'][_0x683b('0x3c')]));_0x7c728[_0x683b('0x3d')]=_0x7c728['attributes'][_0x683b('0x4a')]?_0x7c728[_0x683b('0x3d')]:_0x5149ad['model'];if(_0x2ef83d[_0x683b('0x37')][_0x683b('0x44')]){_0x7c728[_0x683b('0x45')]=[{'all':!![]}];}_0x7c728=_[_0x683b('0x43')]({},_0x7c728,_0x2ef83d['options']);return db['SquareProject'][_0x683b('0x4b')](_0x7c728)['then'](handleEntityNotFound(_0x29e7f2,null))[_0x683b('0x29')](respondWithResult(_0x29e7f2,null))[_0x683b('0x4c')](handleError(_0x29e7f2,null));};exports[_0x683b('0x4d')]=function(_0x35d86f,_0x172187){return db['SquareProject'][_0x683b('0x4d')](_0x35d86f['body'],{})[_0x683b('0x29')](function(_0x1a29b2){var _0x4f5806=_0x35d86f[_0x683b('0x4e')][_0x683b('0x2b')]({'plain':!![]});if(!_0x4f5806)throw new Error(_0x683b('0x4f'));if(_0x4f5806[_0x683b('0x50')]===_0x683b('0x4e')){var _0x2cd043=_0x1a29b2[_0x683b('0x2b')]({'plain':!![]});var _0x33216d='SquareProjects';return db[_0x683b('0x51')]['find']({'where':{'name':_0x33216d,'userProfileId':_0x4f5806[_0x683b('0x52')]},'raw':!![]})[_0x683b('0x29')](function(_0x295e52){if(_0x295e52&&_0x295e52[_0x683b('0x53')]===0x0){return db[_0x683b('0x2c')][_0x683b('0x4d')]({'name':_0x2cd043[_0x683b('0x2f')],'resourceId':_0x2cd043['id'],'type':_0x295e52[_0x683b('0x2f')],'sectionId':_0x295e52['id']},{})[_0x683b('0x29')](function(){return _0x1a29b2;});}else{return _0x1a29b2;}})[_0x683b('0x4c')](function(_0x37c07c){logger['error'](_0x683b('0x54'),_0x37c07c);throw _0x37c07c;});}return _0x1a29b2;})[_0x683b('0x29')](respondWithResult(_0x172187,0xc9))['catch'](handleError(_0x172187,null));};exports[_0x683b('0x28')]=function(_0x167019,_0x2055a2){if(_0x167019[_0x683b('0x55')]['id']){delete _0x167019[_0x683b('0x55')]['id'];}return db[_0x683b('0x33')][_0x683b('0x4b')]({'where':{'id':_0x167019[_0x683b('0x49')]['id']}})[_0x683b('0x29')](handleEntityNotFound(_0x2055a2,null))[_0x683b('0x29')](saveUpdates(_0x167019[_0x683b('0x55')],null))['then'](respondWithResult(_0x2055a2,null))[_0x683b('0x4c')](handleError(_0x2055a2,null));};exports[_0x683b('0x2a')]=function(_0xbf911e,_0xdde971){return db['SquareProject'][_0x683b('0x4b')]({'where':{'id':_0xbf911e['params']['id']}})[_0x683b('0x29')](handleEntityNotFound(_0xdde971,null))[_0x683b('0x29')](removeEntity(_0xdde971,null))[_0x683b('0x4c')](handleError(_0xdde971,null));};exports[_0x683b('0x56')]=function(_0x425991,_0x3e5262,_0x42f3f4){return db[_0x683b('0x33')]['find']({'where':{'id':_0x425991[_0x683b('0x49')]['id']}})[_0x683b('0x29')](handleEntityNotFound(_0x3e5262,null))[_0x683b('0x29')](function(_0x58d71a){if(_0x58d71a){return _0x58d71a['addUsers'](_0x425991['body'][_0x683b('0x57')],_[_0x683b('0x58')](_0x425991['body'],[_0x683b('0x57'),'id'])||{});}})['then'](respondWithResult(_0x3e5262,null))[_0x683b('0x4c')](handleError(_0x3e5262,null));};exports[_0x683b('0x59')]=function(_0x370a25,_0x199d0d,_0xb07eba){return db[_0x683b('0x33')]['find']({'where':{'id':_0x370a25['params']['id']}})[_0x683b('0x29')](handleEntityNotFound(_0x199d0d,null))[_0x683b('0x29')](function(_0x5f356a){if(_0x5f356a){return _0x5f356a[_0x683b('0x59')](_0x370a25[_0x683b('0x37')]['ids'])[_0x683b('0x29')](function(){if(_['isArray'](_0x370a25[_0x683b('0x37')][_0x683b('0x57')])){for(var _0x4afd57=0x0;_0x4afd57<_0x370a25[_0x683b('0x37')][_0x683b('0x57')][_0x683b('0x4a')];_0x4afd57+=0x1){socket[_0x683b('0x5a')](_0x683b('0x5b'),{'UserId':Number(_0x370a25[_0x683b('0x37')]['ids'][_0x4afd57]),'SquareProjectId':Number(_0x370a25[_0x683b('0x49')]['id'])});}}else{socket[_0x683b('0x5a')](_0x683b('0x5b'),{'UserId':Number(_0x370a25[_0x683b('0x37')][_0x683b('0x57')]),'SquareProjectId':Number(_0x370a25[_0x683b('0x49')]['id'])});}});}})[_0x683b('0x29')](respondWithStatusCode(_0x199d0d,null))[_0x683b('0x4c')](handleError(_0x199d0d,null));};exports[_0x683b('0x5c')]=function(_0xdc3ddf,_0x2f0d94,_0x2558c4){var _0xf65ad={};var _0x5861c0={};var _0x5f3329;var _0x2d8371;return db['SquareProject'][_0x683b('0x5d')]({'where':{'id':_0xdc3ddf[_0x683b('0x49')]['id']}})[_0x683b('0x29')](handleEntityNotFound(_0x2f0d94,null))[_0x683b('0x29')](function(_0x3b392a){if(_0x3b392a){_0x5f3329=_0x3b392a;_0x5861c0[_0x683b('0x3b')]=_[_0x683b('0x38')](db['User'][_0x683b('0x34')]);_0x5861c0[_0x683b('0x37')]=_[_0x683b('0x38')](_0xdc3ddf[_0x683b('0x37')]);_0x5861c0[_0x683b('0x39')]=_[_0x683b('0x3a')](_0x5861c0[_0x683b('0x3b')],_0x5861c0['query']);_0xf65ad['attributes']=_[_0x683b('0x3a')](_0x5861c0['model'],qs['fields'](_0xdc3ddf[_0x683b('0x37')]['fields']));_0xf65ad[_0x683b('0x3d')]=_0xf65ad[_0x683b('0x3d')][_0x683b('0x4a')]?_0xf65ad[_0x683b('0x3d')]:_0x5861c0[_0x683b('0x3b')];_0xf65ad[_0x683b('0x40')]=qs[_0x683b('0x5e')](_0xdc3ddf['query'][_0x683b('0x5e')]);_0xf65ad['where']=qs[_0x683b('0x39')](_['pick'](_0xdc3ddf[_0x683b('0x37')],_0x5861c0['filters']));if(_0xdc3ddf['query']['filter']){_0xf65ad[_0x683b('0x41')]=_['merge'](_0xf65ad[_0x683b('0x41')],{'$or':_['map'](_0xf65ad[_0x683b('0x3d')],function(_0x6555ad){var _0x354d67={};_0x354d67[_0x6555ad]={'$like':'%'+_0xdc3ddf['query'][_0x683b('0x42')]+'%'};return _0x354d67;})});}_0xf65ad=_[_0x683b('0x43')]({},_0xf65ad,_0xdc3ddf['options']);return _0x5f3329['getUsers'](_0xf65ad);}})[_0x683b('0x29')](function(_0x1cf2fe){if(_0x1cf2fe){_0x2d8371=_0x1cf2fe[_0x683b('0x4a')];if(!_0xdc3ddf['query']['hasOwnProperty'](_0x683b('0x3f'))){_0xf65ad[_0x683b('0x22')]=qs[_0x683b('0x22')](_0xdc3ddf[_0x683b('0x37')][_0x683b('0x22')]);_0xf65ad[_0x683b('0x21')]=qs[_0x683b('0x21')](_0xdc3ddf['query'][_0x683b('0x21')]);}return _0x5f3329['getUsers'](_0xf65ad);}})[_0x683b('0x29')](function(_0x638000){if(_0x638000){return _0x638000?{'count':_0x2d8371,'rows':_0x638000}:null;}})[_0x683b('0x29')](respondWithResult(_0x2f0d94,null))[_0x683b('0x4c')](handleError(_0x2f0d94,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index bf14c9e..f259f18 100644 --- a/server/api/squareProject/squareProject.events.js +++ b/server/api/squareProject/squareProject.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3357=['emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners','save','update','remove'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x3357,0xa4));var _0x7335=function(_0x2be105,_0x3b42cd){_0x2be105=_0x2be105-0x0;var _0x5ec45c=_0x3357[_0x2be105];return _0x5ec45c;};'use strict';var EventEmitter=require(_0x7335('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x7335('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7335('0x2')](0x0);var events={'afterCreate':_0x7335('0x3'),'afterUpdate':_0x7335('0x4'),'afterDestroy':_0x7335('0x5')};function emitEvent(_0x196229){return function(_0x5d25c6,_0x2b8a21,_0x30ae7c){SquareProjectEvents[_0x7335('0x6')](_0x196229+':'+_0x5d25c6['id'],_0x5d25c6);SquareProjectEvents[_0x7335('0x6')](_0x196229,_0x5d25c6);_0x30ae7c(null);};}for(var e in events){if(events[_0x7335('0x7')](e)){var event=events[e];SquareProject[_0x7335('0x8')](e,emitEvent(event));}}module[_0x7335('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xbfb8=['../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x504f7b,_0x1ac4e0){var _0x2b0904=function(_0x28e51d){while(--_0x28e51d){_0x504f7b['push'](_0x504f7b['shift']());}};_0x2b0904(++_0x1ac4e0);}(_0xbfb8,0x194));var _0x8bfb=function(_0x5d7b9c,_0x160f4d){_0x5d7b9c=_0x5d7b9c-0x0;var _0x443cc7=_0xbfb8[_0x5d7b9c];return _0x443cc7;};'use strict';var EventEmitter=require(_0x8bfb('0x0'));var SquareProject=require(_0x8bfb('0x1'))['db'][_0x8bfb('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8bfb('0x3')](0x0);var events={'afterCreate':_0x8bfb('0x4'),'afterUpdate':_0x8bfb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x14da9c){return function(_0x41c5d1,_0x5b3558,_0x4a7426){SquareProjectEvents[_0x8bfb('0x6')](_0x14da9c+':'+_0x41c5d1['id'],_0x41c5d1);SquareProjectEvents['emit'](_0x14da9c,_0x41c5d1);_0x4a7426(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x8bfb('0x7')](e,emitEvent(event));}}module[_0x8bfb('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0beea9e..98de01f 100644 --- a/server/api/squareProject/squareProject.model.js +++ b/server/api/squareProject/squareProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe93b=['define','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x11caeb,_0x3e1903){var _0x290bb4=function(_0x189404){while(--_0x189404){_0x11caeb['push'](_0x11caeb['shift']());}};_0x290bb4(++_0x3e1903);}(_0xe93b,0x1c2));var _0xbe93=function(_0x119399,_0x47270f){_0x119399=_0x119399-0x0;var _0x5cbbff=_0xe93b[_0x119399];return _0x5cbbff;};'use strict';var _=require('lodash');var util=require(_0xbe93('0x0'));var logger=require(_0xbe93('0x1'))(_0xbe93('0x2'));var moment=require('moment');var BPromise=require(_0xbe93('0x3'));var rp=require(_0xbe93('0x4'));var fs=require('fs');var path=require(_0xbe93('0x5'));var rimraf=require(_0xbe93('0x6'));var config=require(_0xbe93('0x7'));var attributes=require(_0xbe93('0x8'));module[_0xbe93('0x9')]=function(_0x704555,_0x5ad742){return _0x704555[_0xbe93('0xa')](_0xbe93('0xb'),attributes,{'tableName':_0xbe93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb5f3bb,_0x3832c0,_0xfba559){if(_0xb5f3bb[_0xbe93('0xd')](_0xbe93('0xe'))){_0xb5f3bb[_0xbe93('0xf')]=moment()['format'](_0xbe93('0x10'));}if(_0xb5f3bb[_0xbe93('0xd')](_0xbe93('0x11'))){_0xb5f3bb[_0xbe93('0x12')]=moment()[_0xbe93('0x13')](_0xbe93('0x10'));}_0xfba559(null,_0xb5f3bb);}}});}; \ No newline at end of file +var _0x2356=['request-promise','../../config/environment','define','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird'];(function(_0x1b9607,_0x5d799a){var _0x170046=function(_0x1a9ccc){while(--_0x1a9ccc){_0x1b9607['push'](_0x1b9607['shift']());}};_0x170046(++_0x5d799a);}(_0x2356,0x14f));var _0x6235=function(_0x1e3be7,_0x35c632){_0x1e3be7=_0x1e3be7-0x0;var _0x5b4a55=_0x2356[_0x1e3be7];return _0x5b4a55;};'use strict';var _=require('lodash');var util=require(_0x6235('0x0'));var logger=require(_0x6235('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6235('0x2'));var rp=require(_0x6235('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6235('0x4'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x390c55,_0x17e08f){return _0x390c55[_0x6235('0x5')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x547159,_0x3a5750,_0x5a8e7c){if(_0x547159[_0x6235('0x6')](_0x6235('0x7'))){_0x547159[_0x6235('0x8')]=moment()[_0x6235('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x547159[_0x6235('0x6')](_0x6235('0xa'))){_0x547159[_0x6235('0xb')]=moment()[_0x6235('0x9')](_0x6235('0xc'));}_0x5a8e7c(null,_0x547159);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 9b5cb03..2466dec 100644 --- a/server/api/squareProject/squareProject.rpc.js +++ b/server/api/squareProject/squareProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45a7=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util'];(function(_0x31d86c,_0x1886d8){var _0x4346ca=function(_0x3cbb80){while(--_0x3cbb80){_0x31d86c['push'](_0x31d86c['shift']());}};_0x4346ca(++_0x1886d8);}(_0x45a7,0xb2));var _0x745a=function(_0x4072d0,_0x2c84bd){_0x4072d0=_0x4072d0-0x0;var _0x2fc971=_0x45a7[_0x4072d0];return _0x2fc971;};'use strict';var _=require(_0x745a('0x0'));var util=require(_0x745a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x745a('0x2'));var fs=require('fs');var Redis=require(_0x745a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x745a('0x4'))(_0x745a('0x5'));var config=require(_0x745a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x745a('0x7')][_0x745a('0x8')]({'port':0x232a});config[_0x745a('0x9')]=_[_0x745a('0xa')](config[_0x745a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x745a('0xb'))(new Redis(config[_0x745a('0x9')]));require(_0x745a('0xc'))[_0x745a('0xd')](socket);function respondWithRpcPromise(_0x31bc70,_0x2768bb,_0x4b9ae0){return new BPromise(function(_0x335f3e,_0x2a3a3c){return client['request'](_0x31bc70,_0x4b9ae0)['then'](function(_0x589e47){logger[_0x745a('0xe')](_0x745a('0xf'),_0x2768bb,_0x745a('0x10'));logger[_0x745a('0x11')](_0x745a('0x12'),_0x2768bb,'request\x20sent',JSON[_0x745a('0x13')](_0x589e47));if(_0x589e47['error']){if(_0x589e47[_0x745a('0x14')][_0x745a('0x15')]===0x1f4){logger[_0x745a('0x14')](_0x745a('0xf'),_0x2768bb,_0x589e47[_0x745a('0x14')][_0x745a('0x16')]);return _0x2a3a3c(_0x589e47[_0x745a('0x14')][_0x745a('0x16')]);}logger[_0x745a('0x14')](_0x745a('0xf'),_0x2768bb,_0x589e47[_0x745a('0x14')][_0x745a('0x16')]);return _0x335f3e(_0x589e47[_0x745a('0x14')]['message']);}else{logger[_0x745a('0xe')](_0x745a('0xf'),_0x2768bb,'request\x20sent');_0x335f3e(_0x589e47[_0x745a('0x17')][_0x745a('0x16')]);}})[_0x745a('0x18')](function(_0x11b45f){logger[_0x745a('0x14')](_0x745a('0xf'),_0x2768bb,_0x11b45f);_0x2a3a3c(_0x11b45f);});});}exports[_0x745a('0x19')]=function(_0x206c99){var _0x24441e=this;return new Promise(function(_0x3e9d41,_0x34d26a){return db[_0x745a('0x1a')][_0x745a('0x1b')]({'raw':_0x206c99['options']?_0x206c99[_0x745a('0x1c')][_0x745a('0x1d')]===undefined?!![]:![]:!![],'where':_0x206c99['options']?_0x206c99[_0x745a('0x1c')][_0x745a('0x1e')]||null:null,'attributes':_0x206c99['options']?_0x206c99[_0x745a('0x1c')][_0x745a('0x1f')]||null:null,'include':_0x206c99['options']?_0x206c99['options'][_0x745a('0x20')]?_[_0x745a('0x21')](_0x206c99[_0x745a('0x1c')][_0x745a('0x20')],function(_0x3f6425){return{'model':db[_0x3f6425[_0x745a('0x22')]],'as':_0x3f6425['as'],'attributes':_0x3f6425[_0x745a('0x1f')],'include':_0x3f6425[_0x745a('0x20')]?_[_0x745a('0x21')](_0x3f6425[_0x745a('0x20')],function(_0x4338ee){return{'model':db[_0x4338ee[_0x745a('0x22')]],'as':_0x4338ee['as'],'attributes':_0x4338ee[_0x745a('0x1f')],'include':_0x4338ee['include']?_[_0x745a('0x21')](_0x4338ee[_0x745a('0x20')],function(_0x205be4){return{'model':db[_0x205be4[_0x745a('0x22')]],'as':_0x205be4['as'],'attributes':_0x205be4[_0x745a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x745a('0x23')](function(_0x29d8f9){logger[_0x745a('0xe')](_0x745a('0x19'),_0x206c99);logger[_0x745a('0x11')](_0x745a('0x19'),_0x206c99,JSON[_0x745a('0x13')](_0x29d8f9));_0x3e9d41(_0x29d8f9);})['catch'](function(_0x3ea8f6){logger['error']('ShowSquareProject',_0x3ea8f6[_0x745a('0x16')],_0x206c99);_0x34d26a(_0x24441e[_0x745a('0x14')](0x1f4,_0x3ea8f6[_0x745a('0x16')]));});});}; \ No newline at end of file +var _0x0886=['message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x0886,0x1ed));var _0x6088=function(_0x269a32,_0x2774ae){_0x269a32=_0x269a32-0x0;var _0x36dc48=_0x0886[_0x269a32];return _0x36dc48;};'use strict';var _=require(_0x6088('0x0'));var util=require('util');var moment=require(_0x6088('0x1'));var BPromise=require(_0x6088('0x2'));var rs=require(_0x6088('0x3'));var fs=require('fs');var Redis=require(_0x6088('0x4'));var db=require(_0x6088('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6088('0x6'))('rpc');var config=require(_0x6088('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6088('0x8')][_0x6088('0x9')]({'port':0x232a});config[_0x6088('0xa')]=_[_0x6088('0xb')](config[_0x6088('0xa')],{'host':_0x6088('0xc'),'port':0x18eb});var socket=require(_0x6088('0xd'))(new Redis(config['redis']));require(_0x6088('0xe'))[_0x6088('0xf')](socket);function respondWithRpcPromise(_0x4f6be2,_0x15ee4d,_0x2c36f){return new BPromise(function(_0xd3a856,_0x51d6c3){return client[_0x6088('0x10')](_0x4f6be2,_0x2c36f)[_0x6088('0x11')](function(_0x2431ee){logger[_0x6088('0x12')](_0x6088('0x13'),_0x15ee4d,_0x6088('0x14'));logger[_0x6088('0x15')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x15ee4d,_0x6088('0x14'),JSON[_0x6088('0x16')](_0x2431ee));if(_0x2431ee['error']){if(_0x2431ee['error'][_0x6088('0x17')]===0x1f4){logger[_0x6088('0x18')](_0x6088('0x13'),_0x15ee4d,_0x2431ee[_0x6088('0x18')]['message']);return _0x51d6c3(_0x2431ee['error'][_0x6088('0x19')]);}logger['error'](_0x6088('0x13'),_0x15ee4d,_0x2431ee[_0x6088('0x18')][_0x6088('0x19')]);return _0xd3a856(_0x2431ee['error'][_0x6088('0x19')]);}else{logger[_0x6088('0x12')]('SquareProject,\x20%s,\x20%s',_0x15ee4d,_0x6088('0x14'));_0xd3a856(_0x2431ee['result']['message']);}})[_0x6088('0x1a')](function(_0x5bc5a5){logger['error'](_0x6088('0x13'),_0x15ee4d,_0x5bc5a5);_0x51d6c3(_0x5bc5a5);});});}exports[_0x6088('0x1b')]=function(_0x4777a7){var _0x2bfbb1=this;return new Promise(function(_0x3af70e,_0x9a4a5){return db[_0x6088('0x1c')][_0x6088('0x1d')]({'raw':_0x4777a7[_0x6088('0x1e')]?_0x4777a7[_0x6088('0x1e')][_0x6088('0x1f')]===undefined?!![]:![]:!![],'where':_0x4777a7[_0x6088('0x1e')]?_0x4777a7[_0x6088('0x1e')][_0x6088('0x20')]||null:null,'attributes':_0x4777a7[_0x6088('0x1e')]?_0x4777a7[_0x6088('0x1e')][_0x6088('0x21')]||null:null,'include':_0x4777a7[_0x6088('0x1e')]?_0x4777a7[_0x6088('0x1e')][_0x6088('0x22')]?_[_0x6088('0x23')](_0x4777a7[_0x6088('0x1e')][_0x6088('0x22')],function(_0x8c5b8d){return{'model':db[_0x8c5b8d[_0x6088('0x24')]],'as':_0x8c5b8d['as'],'attributes':_0x8c5b8d[_0x6088('0x21')],'include':_0x8c5b8d[_0x6088('0x22')]?_[_0x6088('0x23')](_0x8c5b8d[_0x6088('0x22')],function(_0x220c56){return{'model':db[_0x220c56['model']],'as':_0x220c56['as'],'attributes':_0x220c56[_0x6088('0x21')],'include':_0x220c56[_0x6088('0x22')]?_[_0x6088('0x23')](_0x220c56[_0x6088('0x22')],function(_0x215e63){return{'model':db[_0x215e63[_0x6088('0x24')]],'as':_0x215e63['as'],'attributes':_0x215e63[_0x6088('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ca462){logger[_0x6088('0x12')]('ShowSquareProject',_0x4777a7);logger['debug'](_0x6088('0x1b'),_0x4777a7,JSON['stringify'](_0x1ca462));_0x3af70e(_0x1ca462);})[_0x6088('0x1a')](function(_0x3ab857){logger[_0x6088('0x18')](_0x6088('0x1b'),_0x3ab857[_0x6088('0x19')],_0x4777a7);_0x9a4a5(_0x2bfbb1[_0x6088('0x18')](0x1f4,_0x3ab857[_0x6088('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index eba940f..02d6e1e 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd51=['removeListener','register','length','squareProject:','./squareProject.events','remove','update'];(function(_0xc08d93,_0x4f48cf){var _0x38591c=function(_0x4953e9){while(--_0x4953e9){_0xc08d93['push'](_0xc08d93['shift']());}};_0x38591c(++_0x4f48cf);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x24cd86,_0x356f36){_0x24cd86=_0x24cd86-0x0;var _0x197585=_0xbd51[_0x24cd86];return _0x197585;};'use strict';var SquareProjectEvents=require(_0x1bd5('0x0'));var events=['save',_0x1bd5('0x1'),_0x1bd5('0x2')];function createListener(_0x3b9f71,_0x1a9dcc){return function(_0x545aac){_0x1a9dcc['emit'](_0x3b9f71,_0x545aac);};}function removeListener(_0x58af16,_0x531028){return function(){SquareProjectEvents[_0x1bd5('0x3')](_0x58af16,_0x531028);};}exports[_0x1bd5('0x4')]=function(_0x43e6b6){for(var _0x59ddfb=0x0,_0x29abea=events[_0x1bd5('0x5')];_0x59ddfb<_0x29abea;_0x59ddfb++){var _0x19077c=events[_0x59ddfb];var _0x27d58f=createListener(_0x1bd5('0x6')+_0x19077c,_0x43e6b6);SquareProjectEvents['on'](_0x19077c,_0x27d58f);}}; \ No newline at end of file +var _0x687b=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x687b,0x14a));var _0xb687=function(_0x371b25,_0x224870){_0x371b25=_0x371b25-0x0;var _0x5588e8=_0x687b[_0x371b25];return _0x5588e8;};'use strict';var SquareProjectEvents=require(_0xb687('0x0'));var events=[_0xb687('0x1'),_0xb687('0x2'),_0xb687('0x3')];function createListener(_0x5d8563,_0x5e5f06){return function(_0x35069a){_0x5e5f06[_0xb687('0x4')](_0x5d8563,_0x35069a);};}function removeListener(_0x36c468,_0x31bd0d){return function(){SquareProjectEvents[_0xb687('0x5')](_0x36c468,_0x31bd0d);};}exports[_0xb687('0x6')]=function(_0x16ccf3){for(var _0xf43a1f=0x0,_0x47ffea=events[_0xb687('0x7')];_0xf43a1f<_0x47ffea;_0xf43a1f++){var _0x48942b=events[_0xf43a1f];var _0x2aea59=createListener(_0xb687('0x8')+_0x48942b,_0x16ccf3);SquareProjectEvents['on'](_0x48942b,_0x2aea59);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index c4b5a4b..00eed3b 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd54=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','/:id/download','download','post','put','update','delete','/:id/delete','destroy','exports'];(function(_0x332c78,_0x27da30){var _0x493f96=function(_0x14377a){while(--_0x14377a){_0x332c78['push'](_0x332c78['shift']());}};_0x493f96(++_0x27da30);}(_0xbd54,0x1a4));var _0x4bd5=function(_0x3b5c38,_0x2c7022){_0x3b5c38=_0x3b5c38-0x0;var _0x442ebd=_0xbd54[_0x3b5c38];return _0x442ebd;};'use strict';var multer=require(_0x4bd5('0x0'));var util=require(_0x4bd5('0x1'));var path=require(_0x4bd5('0x2'));var timeout=require(_0x4bd5('0x3'));var express=require('express');var router=express[_0x4bd5('0x4')]();var auth=require(_0x4bd5('0x5'));var interaction=require(_0x4bd5('0x6'));var config=require(_0x4bd5('0x7'));var controller=require(_0x4bd5('0x8'));router['get']('/',auth[_0x4bd5('0x9')](),controller['index']);router[_0x4bd5('0xa')](_0x4bd5('0xb'),auth[_0x4bd5('0x9')](),controller['show']);router['get'](_0x4bd5('0xc'),auth[_0x4bd5('0x9')](),controller[_0x4bd5('0xd')]);router[_0x4bd5('0xe')]('/',auth[_0x4bd5('0x9')](),controller['create']);router[_0x4bd5('0xf')](_0x4bd5('0xb'),auth[_0x4bd5('0x9')](),controller[_0x4bd5('0x10')]);router[_0x4bd5('0x11')](_0x4bd5('0x12'),auth['isAuthenticated'](),controller[_0x4bd5('0x13')]);module[_0x4bd5('0x14')]=router; \ No newline at end of file +var _0xfeff=['isAuthenticated','download','post','create','put','update','/:id/delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','/:id/download'];(function(_0x228e70,_0x3b3a7e){var _0x1f5890=function(_0x5dd0fc){while(--_0x5dd0fc){_0x228e70['push'](_0x228e70['shift']());}};_0x1f5890(++_0x3b3a7e);}(_0xfeff,0x1ac));var _0xffef=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xfeff[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0xffef('0x0'));var util=require(_0xffef('0x1'));var path=require(_0xffef('0x2'));var timeout=require('connect-timeout');var express=require(_0xffef('0x3'));var router=express[_0xffef('0x4')]();var auth=require(_0xffef('0x5'));var interaction=require(_0xffef('0x6'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0xffef('0x7')]('/',auth['isAuthenticated'](),controller[_0xffef('0x8')]);router['get'](_0xffef('0x9'),auth['isAuthenticated'](),controller[_0xffef('0xa')]);router[_0xffef('0x7')](_0xffef('0xb'),auth[_0xffef('0xc')](),controller[_0xffef('0xd')]);router[_0xffef('0xe')]('/',auth[_0xffef('0xc')](),controller[_0xffef('0xf')]);router[_0xffef('0x10')](_0xffef('0x9'),auth[_0xffef('0xc')](),controller[_0xffef('0x11')]);router['delete'](_0xffef('0x12'),auth[_0xffef('0xc')](),controller[_0xffef('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 59da742..933b0ee 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ed2=['VIRTUAL','getDataValue','substring','sequelize','exports','STRING'];(function(_0x581960,_0x1232ff){var _0x4ee892=function(_0x2a920d){while(--_0x2a920d){_0x581960['push'](_0x581960['shift']());}};_0x4ee892(++_0x1232ff);}(_0x4ed2,0x1d7));var _0x24ed=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4ed2[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x24ed('0x0'));module[_0x24ed('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x24ed('0x2')]},'calleridname':{'type':Sequelize[_0x24ed('0x2')]},'context':{'type':Sequelize[_0x24ed('0x2')]},'extension':{'type':Sequelize[_0x24ed('0x2')]},'priority':{'type':Sequelize[_0x24ed('0x2')]},'accountcode':{'type':Sequelize[_0x24ed('0x2')]},'dnid':{'type':Sequelize[_0x24ed('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x24ed('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x24ed('0x2')]},'format':{'type':Sequelize[_0x24ed('0x3')],'get':function(){var _0x4ea66e='';var _0x489a9b=this[_0x24ed('0x4')]('savePath');if(_0x489a9b){_0x4ea66e=_0x489a9b[_0x24ed('0x5')](_0x489a9b['lastIndexOf']('.'));}return _0x4ea66e;}}}; \ No newline at end of file +var _0xf2d8=['getDataValue','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x571d37,_0x456e70){var _0x171f06=function(_0x479950){while(--_0x479950){_0x571d37['push'](_0x571d37['shift']());}};_0x171f06(++_0x456e70);}(_0xf2d8,0xe6));var _0x8f2d=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0xf2d8[_0x5e1b91];return _0x59b52f;};'use strict';var Sequelize=require(_0x8f2d('0x0'));module[_0x8f2d('0x1')]={'uniqueid':{'type':Sequelize[_0x8f2d('0x2')]},'callerid':{'type':Sequelize[_0x8f2d('0x2')]},'calleridname':{'type':Sequelize[_0x8f2d('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8f2d('0x2')]},'dnid':{'type':Sequelize[_0x8f2d('0x2')]},'projectName':{'type':Sequelize[_0x8f2d('0x2')]},'saveName':{'type':Sequelize[_0x8f2d('0x2')]},'filename':{'type':Sequelize[_0x8f2d('0x2')]},'savePath':{'type':Sequelize[_0x8f2d('0x2')]},'format':{'type':Sequelize[_0x8f2d('0x3')],'get':function(){var _0x196edb='';var _0x7ccb5c=this[_0x8f2d('0x4')]('savePath');if(_0x7ccb5c){_0x196edb=_0x7ccb5c['substring'](_0x7ccb5c[_0x8f2d('0x5')]('.'));}return _0x196edb;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f5cb701..274b7fc 100644 --- a/server/api/squareRecording/squareRecording.controller.js +++ b/server/api/squareRecording/squareRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x980b=['length','order','sort','pick','filter','where','map','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','recording','Sequelize','extname','unlink','message','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','then','destroy','stack','name','send','SquareRecording','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x416f93,_0x1305ac){var _0x548154=function(_0x27d30e){while(--_0x27d30e){_0x416f93['push'](_0x416f93['shift']());}};_0x548154(++_0x1305ac);}(_0x980b,0x18f));var _0xb980=function(_0x51028e,_0x3faf25){_0x51028e=_0x51028e-0x0;var _0x399f9f=_0x980b[_0x51028e];return _0x399f9f;};'use strict';var pdf=require(_0xb980('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb980('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb980('0x2'));var moment=require(_0xb980('0x3'));var BPromise=require(_0xb980('0x4'));var Mustache=require(_0xb980('0x5'));var util=require(_0xb980('0x6'));var path=require(_0xb980('0x7'));var sox=require(_0xb980('0x8'));var csv=require(_0xb980('0x9'));var ejs=require(_0xb980('0xa'));var fs=require('fs');var _=require(_0xb980('0xb'));var squel=require(_0xb980('0xc'));var crypto=require(_0xb980('0xd'));var jsforce=require(_0xb980('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb980('0x9'));var querystring=require(_0xb980('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb980('0x10'));var as=require(_0xb980('0x11'));var hardwareService=require(_0xb980('0x12'));var logger=require(_0xb980('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb980('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb980('0x15'))['db'];function respondWithStatusCode(_0x425c47,_0x8b9921){_0x8b9921=_0x8b9921||0xcc;return function(_0x6b74b4){if(_0x6b74b4){return _0x425c47[_0xb980('0x16')](_0x8b9921);}return _0x425c47[_0xb980('0x17')](_0x8b9921)[_0xb980('0x18')]();};}function respondWithResult(_0x22e657,_0x3ef154){_0x3ef154=_0x3ef154||0xc8;return function(_0x4be211){if(_0x4be211){return _0x22e657[_0xb980('0x17')](_0x3ef154)['json'](_0x4be211);}};}function respondWithFilteredResult(_0x2d56be,_0x638fc9){return function(_0x13bbca){if(_0x13bbca){var _0x3df68e=_0x13bbca['count'],_0x41850b=_0x638fc9[_0xb980('0x19')],_0x2b5ba7=_0x638fc9[_0xb980('0x19')]+_0x638fc9[_0xb980('0x1a')],_0x22137f;if(_0x2b5ba7>=_0x3df68e){_0x2b5ba7=_0x3df68e;_0x22137f=0xc8;}else{_0x22137f=0xce;}_0x2d56be['status'](_0x22137f);return _0x2d56be[_0xb980('0x1b')](_0xb980('0x1c'),_0x41850b+'-'+_0x2b5ba7+'/'+_0x3df68e)[_0xb980('0x1d')](_0x13bbca);}return null;};}function patchUpdates(_0xe34f61){return function(_0xd74865){try{jsonpatch['apply'](_0xd74865,_0xe34f61,!![]);}catch(_0x4257be){return BPromise['reject'](_0x4257be);}return _0xd74865['save']();};}function saveUpdates(_0x4bdec0,_0xb77cd2){return function(_0x31db44){if(_0x31db44){return _0x31db44['update'](_0x4bdec0)[_0xb980('0x1e')](function(_0x20c800){return _0x20c800;});}return null;};}function removeEntity(_0x327ee2,_0x571dde){return function(_0xaa2d3d){if(_0xaa2d3d){return _0xaa2d3d[_0xb980('0x1f')]()[_0xb980('0x1e')](function(){_0x327ee2[_0xb980('0x17')](0xcc)[_0xb980('0x18')]();});}};}function handleEntityNotFound(_0x1286c0,_0x3cc6ee){return function(_0x33312b){if(!_0x33312b){_0x1286c0[_0xb980('0x16')](0x194);}return _0x33312b;};}function handleError(_0x433d09,_0x5a71a5){_0x5a71a5=_0x5a71a5||0x1f4;return function(_0x12878c){logger['error'](_0x12878c[_0xb980('0x20')]);if(_0x12878c[_0xb980('0x21')]){delete _0x12878c['name'];}_0x433d09['status'](_0x5a71a5)[_0xb980('0x22')](_0x12878c);};}exports['index']=function(_0x352c4d,_0x251dd3){var _0x59a2d8={},_0x56e0d1={},_0x1fcc9a={'count':0x0,'rows':[]};var _0x2cd5a8=_['map'](db[_0xb980('0x23')][_0xb980('0x24')],function(_0x2ff601){return{'name':_0x2ff601[_0xb980('0x25')],'type':_0x2ff601[_0xb980('0x26')]['key']};});_0x56e0d1[_0xb980('0x27')]=_['map'](_0x2cd5a8,_0xb980('0x21'));_0x56e0d1[_0xb980('0x28')]=_[_0xb980('0x29')](_0x352c4d[_0xb980('0x28')]);_0x56e0d1[_0xb980('0x2a')]=_[_0xb980('0x2b')](_0x56e0d1[_0xb980('0x27')],_0x56e0d1[_0xb980('0x28')]);_0x59a2d8[_0xb980('0x2c')]=_[_0xb980('0x2b')](_0x56e0d1[_0xb980('0x27')],qs['fields'](_0x352c4d[_0xb980('0x28')][_0xb980('0x2d')]));_0x59a2d8[_0xb980('0x2c')]=_0x59a2d8[_0xb980('0x2c')][_0xb980('0x2e')]?_0x59a2d8['attributes']:_0x56e0d1[_0xb980('0x27')];if(!_0x352c4d[_0xb980('0x28')]['hasOwnProperty']('nolimit')){_0x59a2d8[_0xb980('0x1a')]=qs[_0xb980('0x1a')](_0x352c4d[_0xb980('0x28')][_0xb980('0x1a')]);_0x59a2d8[_0xb980('0x19')]=qs[_0xb980('0x19')](_0x352c4d[_0xb980('0x28')]['offset']);}_0x59a2d8[_0xb980('0x2f')]=qs[_0xb980('0x30')](_0x352c4d['query'][_0xb980('0x30')]);_0x59a2d8['where']=qs[_0xb980('0x2a')](_[_0xb980('0x31')](_0x352c4d[_0xb980('0x28')],_0x56e0d1[_0xb980('0x2a')]),_0x2cd5a8);if(_0x352c4d['query'][_0xb980('0x32')]){_0x59a2d8[_0xb980('0x33')]=_['merge'](_0x59a2d8[_0xb980('0x33')],{'$or':_[_0xb980('0x34')](_0x2cd5a8,function(_0x12d075){if(_0x12d075[_0xb980('0x26')]!==_0xb980('0x35')){var _0x201ef9={};_0x201ef9[_0x12d075['name']]={'$like':'%'+_0x352c4d[_0xb980('0x28')][_0xb980('0x32')]+'%'};return _0x201ef9;}})});}_0x59a2d8=_[_0xb980('0x36')]({},_0x59a2d8,_0x352c4d[_0xb980('0x37')]);var _0x210510={'where':_0x59a2d8[_0xb980('0x33')]};return db[_0xb980('0x23')][_0xb980('0x38')](_0x210510)[_0xb980('0x1e')](function(_0xbb7a63){_0x1fcc9a['count']=_0xbb7a63;if(_0x352c4d[_0xb980('0x28')][_0xb980('0x39')]){_0x59a2d8['include']=[{'all':!![]}];}return db['SquareRecording'][_0xb980('0x3a')](_0x59a2d8);})[_0xb980('0x1e')](function(_0x2bf891){_0x1fcc9a[_0xb980('0x3b')]=_0x2bf891;return _0x1fcc9a;})[_0xb980('0x1e')](respondWithFilteredResult(_0x251dd3,_0x59a2d8))[_0xb980('0x3c')](handleError(_0x251dd3,null));};exports[_0xb980('0x3d')]=function(_0x5bfcde,_0x227e75){var _0x43815a={'raw':!![],'where':{'id':_0x5bfcde[_0xb980('0x3e')]['id']}},_0x49eb7a={};_0x49eb7a[_0xb980('0x27')]=_[_0xb980('0x29')](db[_0xb980('0x23')][_0xb980('0x24')]);_0x49eb7a[_0xb980('0x28')]=_['keys'](_0x5bfcde['query']);_0x49eb7a[_0xb980('0x2a')]=_[_0xb980('0x2b')](_0x49eb7a[_0xb980('0x27')],_0x49eb7a['query']);_0x43815a[_0xb980('0x2c')]=_[_0xb980('0x2b')](_0x49eb7a[_0xb980('0x27')],qs['fields'](_0x5bfcde[_0xb980('0x28')][_0xb980('0x2d')]));_0x43815a[_0xb980('0x2c')]=_0x43815a[_0xb980('0x2c')]['length']?_0x43815a['attributes']:_0x49eb7a[_0xb980('0x27')];if(_0x5bfcde[_0xb980('0x28')]['includeAll']){_0x43815a[_0xb980('0x3f')]=[{'all':!![]}];}_0x43815a=_[_0xb980('0x36')]({},_0x43815a,_0x5bfcde[_0xb980('0x37')]);return db['SquareRecording'][_0xb980('0x40')](_0x43815a)[_0xb980('0x1e')](handleEntityNotFound(_0x227e75,null))[_0xb980('0x1e')](respondWithResult(_0x227e75,null))['catch'](handleError(_0x227e75,null));};exports[_0xb980('0x41')]=function(_0x2c1903,_0x326a72){return db[_0xb980('0x23')][_0xb980('0x41')](_0x2c1903[_0xb980('0x42')],{})[_0xb980('0x1e')](respondWithResult(_0x326a72,0xc9))[_0xb980('0x3c')](handleError(_0x326a72,null));};exports[_0xb980('0x43')]=function(_0x3f2e62,_0x5665b1){if(_0x3f2e62[_0xb980('0x42')]['id']){delete _0x3f2e62[_0xb980('0x42')]['id'];}return db[_0xb980('0x23')][_0xb980('0x40')]({'where':{'id':_0x3f2e62[_0xb980('0x3e')]['id']}})[_0xb980('0x1e')](handleEntityNotFound(_0x5665b1,null))[_0xb980('0x1e')](saveUpdates(_0x3f2e62['body'],null))[_0xb980('0x1e')](respondWithResult(_0x5665b1,null))['catch'](handleError(_0x5665b1,null));};exports[_0xb980('0x44')]=function(_0x14f36b,_0x345d78,_0x577e77){var _0x119009=require(_0xb980('0x45'));var _0x44b59b=![];var _0xeaa9f6={};if(_0x14f36b[_0xb980('0x28')]['type']&&_0x14f36b[_0xb980('0x28')][_0xb980('0x26')]===_0xb980('0x46')){_0xeaa9f6['uniqueid']=_0x14f36b[_0xb980('0x3e')]['id'];}else{_0xeaa9f6['id']=_0x14f36b[_0xb980('0x3e')]['id'];}return db[_0xb980('0x23')]['find']({'where':_0xeaa9f6,'attributes':['id',_0xb980('0x47'),_0xb980('0x48')],'raw':!![]})[_0xb980('0x1e')](handleEntityNotFound(_0x345d78,null))[_0xb980('0x1e')](function(_0x14d6ea){if(_0x14d6ea){var _0x345eb0=_0x14d6ea[_0xb980('0x47')];var _0x2f4348=util[_0xb980('0x49')](_0xb980('0x4a'),_0x345eb0);if(fs[_0xb980('0x4b')](_0x2f4348)){_0x44b59b=!![];return _0x119009['decryptFile'](_0x2f4348,_0x345eb0,config[_0xb980('0x4c')][_0xb980('0x4d')])[_0xb980('0x1e')](function(){return _0x14d6ea;});}return _0x14d6ea;}})['then'](function(_0x512b9c){if(_0x512b9c){var _0x22cfa4=_0x512b9c[_0xb980('0x47')];if(!fs[_0xb980('0x4b')](_0x22cfa4)){throw new db[(_0xb980('0x4e'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x512b9c['filename']){return _0x345d78['download'](_0x22cfa4,_0x512b9c[_0xb980('0x48')]+path[_0xb980('0x4f')](_0x22cfa4),function(){if(_0x44b59b){fs[_0xb980('0x50')](_0x22cfa4);}});}else{return _0x345d78[_0xb980('0x44')](_0x22cfa4,function(_0x456da9){if(_0x44b59b){fs['unlink'](_0x22cfa4);}});}}})[_0xb980('0x3c')](function(_0x446e86){if(_0x446e86[_0xb980('0x51')]==='SquareRecording\x20not\x20found'){_0x345d78[_0xb980('0x17')](0x194)['send']('Not\x20found');}else{return handleError(_0x345d78,null);}});};exports[_0xb980('0x1f')]=function(_0x1db0d9,_0x14039b){return db['SquareRecording'][_0xb980('0x40')]({'where':{'id':_0x1db0d9[_0xb980('0x3e')]['id']}})[_0xb980('0x1e')](function(_0x37c59c){if(!_0x37c59c)throw new ReferenceError(_0xb980('0x52'));return _0x37c59c;})[_0xb980('0x1e')](function(_0x4233c5){var _0x416bf1=_0x4233c5[_0xb980('0x47')];logger['info'](_0xb980('0x53'),_0x416bf1);if(!_['isNil'](_0x4233c5[_0xb980('0x47')])&&fs[_0xb980('0x4b')](_0x416bf1)){logger[_0xb980('0x54')](_0xb980('0x55')+_0x416bf1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb980('0x56')](_0x416bf1);}_0x416bf1=_0x416bf1+'.cypher';if(!_[_0xb980('0x57')](_0x4233c5[_0xb980('0x47')])&&fs[_0xb980('0x4b')](_0x416bf1)){logger[_0xb980('0x54')](_0xb980('0x55')+_0x416bf1+_0xb980('0x58'));fs['unlinkSync'](_0x416bf1);}return _0x4233c5;})[_0xb980('0x1e')](function(_0x2d0d26){if(!_0x2d0d26)throw new InternalError();return _0x2d0d26['destroy']();})[_0xb980('0x1e')](function(){_0x14039b[_0xb980('0x17')](0xcc)[_0xb980('0x18')]();})['catch'](handleError(_0x14039b,null));}; \ No newline at end of file +var _0xfd40=['count','offset','Content-Range','reject','save','update','then','destroy','stack','name','SquareRecording','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','recording','ValidationError','extname','unlink','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x330304,_0x4e9347){var _0x288a85=function(_0x2d3583){while(--_0x2d3583){_0x330304['push'](_0x330304['shift']());}};_0x288a85(++_0x4e9347);}(_0xfd40,0x155));var _0x0fd4=function(_0x426270,_0x4d02fb){_0x426270=_0x426270-0x0;var _0xa8e620=_0xfd40[_0x426270];return _0xa8e620;};'use strict';var pdf=require(_0x0fd4('0x0'));var emlformat=require(_0x0fd4('0x1'));var rimraf=require(_0x0fd4('0x2'));var zipdir=require(_0x0fd4('0x3'));var jsonpatch=require(_0x0fd4('0x4'));var rp=require(_0x0fd4('0x5'));var moment=require('moment');var BPromise=require(_0x0fd4('0x6'));var Mustache=require('mustache');var util=require(_0x0fd4('0x7'));var path=require(_0x0fd4('0x8'));var sox=require('sox');var csv=require(_0x0fd4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0fd4('0xa'));var squel=require(_0x0fd4('0xb'));var crypto=require('crypto');var jsforce=require(_0x0fd4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0fd4('0x9'));var querystring=require(_0x0fd4('0xd'));var Papa=require(_0x0fd4('0xe'));var Redis=require(_0x0fd4('0xf'));var authService=require(_0x0fd4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0fd4('0x11'));var hardwareService=require(_0x0fd4('0x12'));var logger=require(_0x0fd4('0x13'))('api');var utils=require(_0x0fd4('0x14'));var config=require(_0x0fd4('0x15'));var licenseUtil=require(_0x0fd4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b2233,_0x198edf){_0x198edf=_0x198edf||0xcc;return function(_0x21798d){if(_0x21798d){return _0x5b2233[_0x0fd4('0x17')](_0x198edf);}return _0x5b2233['status'](_0x198edf)[_0x0fd4('0x18')]();};}function respondWithResult(_0x422ece,_0x273b4a){_0x273b4a=_0x273b4a||0xc8;return function(_0x3800f9){if(_0x3800f9){return _0x422ece[_0x0fd4('0x19')](_0x273b4a)[_0x0fd4('0x1a')](_0x3800f9);}};}function respondWithFilteredResult(_0x5941e0,_0x43c005){return function(_0x3d9435){if(_0x3d9435){var _0x360327=_0x3d9435[_0x0fd4('0x1b')],_0x1f4fda=_0x43c005[_0x0fd4('0x1c')],_0x11d562=_0x43c005[_0x0fd4('0x1c')]+_0x43c005['limit'],_0x5acbd4;if(_0x11d562>=_0x360327){_0x11d562=_0x360327;_0x5acbd4=0xc8;}else{_0x5acbd4=0xce;}_0x5941e0[_0x0fd4('0x19')](_0x5acbd4);return _0x5941e0['set'](_0x0fd4('0x1d'),_0x1f4fda+'-'+_0x11d562+'/'+_0x360327)[_0x0fd4('0x1a')](_0x3d9435);}return null;};}function patchUpdates(_0x153f10){return function(_0x64472a){try{jsonpatch['apply'](_0x64472a,_0x153f10,!![]);}catch(_0x41eb09){return BPromise[_0x0fd4('0x1e')](_0x41eb09);}return _0x64472a[_0x0fd4('0x1f')]();};}function saveUpdates(_0x236995,_0x54883a){return function(_0x16fd1a){if(_0x16fd1a){return _0x16fd1a[_0x0fd4('0x20')](_0x236995)[_0x0fd4('0x21')](function(_0x29ed94){return _0x29ed94;});}return null;};}function removeEntity(_0x187b0d,_0x22cfd4){return function(_0x18bbe1){if(_0x18bbe1){return _0x18bbe1[_0x0fd4('0x22')]()[_0x0fd4('0x21')](function(){_0x187b0d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53bfbc,_0x32c18c){return function(_0x2ebeac){if(!_0x2ebeac){_0x53bfbc[_0x0fd4('0x17')](0x194);}return _0x2ebeac;};}function handleError(_0x20bdb5,_0x25caba){_0x25caba=_0x25caba||0x1f4;return function(_0x5d0e2c){logger['error'](_0x5d0e2c[_0x0fd4('0x23')]);if(_0x5d0e2c[_0x0fd4('0x24')]){delete _0x5d0e2c[_0x0fd4('0x24')];}_0x20bdb5['status'](_0x25caba)['send'](_0x5d0e2c);};}exports['index']=function(_0x216d14,_0x627dda){var _0x2e26a4={},_0x453a81={},_0x472105={'count':0x0,'rows':[]};var _0x39481d=_['map'](db[_0x0fd4('0x25')]['rawAttributes'],function(_0x49a1b0){return{'name':_0x49a1b0[_0x0fd4('0x26')],'type':_0x49a1b0['type'][_0x0fd4('0x27')]};});_0x453a81[_0x0fd4('0x28')]=_[_0x0fd4('0x29')](_0x39481d,_0x0fd4('0x24'));_0x453a81[_0x0fd4('0x2a')]=_[_0x0fd4('0x2b')](_0x216d14[_0x0fd4('0x2a')]);_0x453a81[_0x0fd4('0x2c')]=_[_0x0fd4('0x2d')](_0x453a81[_0x0fd4('0x28')],_0x453a81[_0x0fd4('0x2a')]);_0x2e26a4[_0x0fd4('0x2e')]=_['intersection'](_0x453a81[_0x0fd4('0x28')],qs[_0x0fd4('0x2f')](_0x216d14['query'][_0x0fd4('0x2f')]));_0x2e26a4[_0x0fd4('0x2e')]=_0x2e26a4[_0x0fd4('0x2e')]['length']?_0x2e26a4['attributes']:_0x453a81[_0x0fd4('0x28')];if(!_0x216d14[_0x0fd4('0x2a')][_0x0fd4('0x30')](_0x0fd4('0x31'))){_0x2e26a4[_0x0fd4('0x32')]=qs[_0x0fd4('0x32')](_0x216d14[_0x0fd4('0x2a')][_0x0fd4('0x32')]);_0x2e26a4[_0x0fd4('0x1c')]=qs[_0x0fd4('0x1c')](_0x216d14['query'][_0x0fd4('0x1c')]);}_0x2e26a4[_0x0fd4('0x33')]=qs['sort'](_0x216d14[_0x0fd4('0x2a')]['sort']);_0x2e26a4[_0x0fd4('0x34')]=qs['filters'](_['pick'](_0x216d14[_0x0fd4('0x2a')],_0x453a81['filters']),_0x39481d);if(_0x216d14['query'][_0x0fd4('0x35')]){_0x2e26a4['where']=_[_0x0fd4('0x36')](_0x2e26a4[_0x0fd4('0x34')],{'$or':_['map'](_0x39481d,function(_0x55d4f5){if(_0x55d4f5[_0x0fd4('0x37')]!==_0x0fd4('0x38')){var _0x14bb5e={};_0x14bb5e[_0x55d4f5[_0x0fd4('0x24')]]={'$like':'%'+_0x216d14[_0x0fd4('0x2a')]['filter']+'%'};return _0x14bb5e;}})});}_0x2e26a4=_[_0x0fd4('0x36')]({},_0x2e26a4,_0x216d14[_0x0fd4('0x39')]);var _0x45d5de={'where':_0x2e26a4[_0x0fd4('0x34')]};return db[_0x0fd4('0x25')][_0x0fd4('0x1b')](_0x45d5de)[_0x0fd4('0x21')](function(_0x4d1f62){_0x472105[_0x0fd4('0x1b')]=_0x4d1f62;if(_0x216d14[_0x0fd4('0x2a')][_0x0fd4('0x3a')]){_0x2e26a4[_0x0fd4('0x3b')]=[{'all':!![]}];}return db[_0x0fd4('0x25')][_0x0fd4('0x3c')](_0x2e26a4);})[_0x0fd4('0x21')](function(_0x58a5c4){_0x472105[_0x0fd4('0x3d')]=_0x58a5c4;return _0x472105;})[_0x0fd4('0x21')](respondWithFilteredResult(_0x627dda,_0x2e26a4))[_0x0fd4('0x3e')](handleError(_0x627dda,null));};exports[_0x0fd4('0x3f')]=function(_0x286a35,_0x451c3a){var _0x3fbc24={'raw':!![],'where':{'id':_0x286a35['params']['id']}},_0x3b31f6={};_0x3b31f6[_0x0fd4('0x28')]=_[_0x0fd4('0x2b')](db[_0x0fd4('0x25')][_0x0fd4('0x40')]);_0x3b31f6['query']=_[_0x0fd4('0x2b')](_0x286a35[_0x0fd4('0x2a')]);_0x3b31f6['filters']=_[_0x0fd4('0x2d')](_0x3b31f6[_0x0fd4('0x28')],_0x3b31f6[_0x0fd4('0x2a')]);_0x3fbc24['attributes']=_[_0x0fd4('0x2d')](_0x3b31f6['model'],qs[_0x0fd4('0x2f')](_0x286a35[_0x0fd4('0x2a')][_0x0fd4('0x2f')]));_0x3fbc24[_0x0fd4('0x2e')]=_0x3fbc24[_0x0fd4('0x2e')]['length']?_0x3fbc24[_0x0fd4('0x2e')]:_0x3b31f6[_0x0fd4('0x28')];if(_0x286a35[_0x0fd4('0x2a')]['includeAll']){_0x3fbc24['include']=[{'all':!![]}];}_0x3fbc24=_[_0x0fd4('0x36')]({},_0x3fbc24,_0x286a35[_0x0fd4('0x39')]);return db[_0x0fd4('0x25')][_0x0fd4('0x41')](_0x3fbc24)[_0x0fd4('0x21')](handleEntityNotFound(_0x451c3a,null))[_0x0fd4('0x21')](respondWithResult(_0x451c3a,null))['catch'](handleError(_0x451c3a,null));};exports[_0x0fd4('0x42')]=function(_0x1bd138,_0x4b0511){return db['SquareRecording'][_0x0fd4('0x42')](_0x1bd138[_0x0fd4('0x43')],{})['then'](respondWithResult(_0x4b0511,0xc9))[_0x0fd4('0x3e')](handleError(_0x4b0511,null));};exports['update']=function(_0x1d4200,_0x185805){if(_0x1d4200[_0x0fd4('0x43')]['id']){delete _0x1d4200[_0x0fd4('0x43')]['id'];}return db[_0x0fd4('0x25')][_0x0fd4('0x41')]({'where':{'id':_0x1d4200[_0x0fd4('0x44')]['id']}})[_0x0fd4('0x21')](handleEntityNotFound(_0x185805,null))['then'](saveUpdates(_0x1d4200[_0x0fd4('0x43')],null))['then'](respondWithResult(_0x185805,null))[_0x0fd4('0x3e')](handleError(_0x185805,null));};exports[_0x0fd4('0x45')]=function(_0x200cdb,_0x5bab1b,_0xe9c29f){var _0x42595c=require(_0x0fd4('0x46'));var _0x133a5=![];var _0x23101d={};if(_0x200cdb[_0x0fd4('0x2a')]['type']&&_0x200cdb[_0x0fd4('0x2a')][_0x0fd4('0x37')]===_0x0fd4('0x47')){_0x23101d[_0x0fd4('0x47')]=_0x200cdb[_0x0fd4('0x44')]['id'];}else{_0x23101d['id']=_0x200cdb[_0x0fd4('0x44')]['id'];}return db['SquareRecording'][_0x0fd4('0x41')]({'where':_0x23101d,'attributes':['id',_0x0fd4('0x48'),_0x0fd4('0x49')],'raw':!![]})[_0x0fd4('0x21')](handleEntityNotFound(_0x5bab1b,null))['then'](function(_0x18800f){if(_0x18800f){var _0x4c8f1c=_0x18800f[_0x0fd4('0x48')];var _0x2b2b12=util[_0x0fd4('0x4a')](_0x0fd4('0x4b'),_0x4c8f1c);if(fs[_0x0fd4('0x4c')](_0x2b2b12)){_0x133a5=!![];return _0x42595c['decryptFile'](_0x2b2b12,_0x4c8f1c,config[_0x0fd4('0x4d')][_0x0fd4('0x4e')])[_0x0fd4('0x21')](function(){return _0x18800f;});}return _0x18800f;}})[_0x0fd4('0x21')](function(_0x2fe89f){if(_0x2fe89f){var _0x53f02e=_0x2fe89f[_0x0fd4('0x48')];if(!fs[_0x0fd4('0x4c')](_0x53f02e)){throw new db['Sequelize'][(_0x0fd4('0x4f'))]('SquareRecording\x20not\x20found');}if(_0x2fe89f[_0x0fd4('0x49')]){return _0x5bab1b[_0x0fd4('0x45')](_0x53f02e,_0x2fe89f[_0x0fd4('0x49')]+path[_0x0fd4('0x50')](_0x53f02e),function(){if(_0x133a5){fs[_0x0fd4('0x51')](_0x53f02e);}});}else{return _0x5bab1b['download'](_0x53f02e,function(_0x36214a){if(_0x133a5){fs[_0x0fd4('0x51')](_0x53f02e);}});}}})[_0x0fd4('0x3e')](function(_0x466db6){if(_0x466db6['message']==='SquareRecording\x20not\x20found'){_0x5bab1b[_0x0fd4('0x19')](0x194)[_0x0fd4('0x52')](_0x0fd4('0x53'));}else{return handleError(_0x5bab1b,null);}});};exports[_0x0fd4('0x22')]=function(_0x59b547,_0x3be8d6){return db[_0x0fd4('0x25')][_0x0fd4('0x41')]({'where':{'id':_0x59b547[_0x0fd4('0x44')]['id']}})[_0x0fd4('0x21')](function(_0x42e15a){if(!_0x42e15a)throw new ReferenceError(_0x0fd4('0x54'));return _0x42e15a;})[_0x0fd4('0x21')](function(_0x1a1861){var _0x4cc5d8=_0x1a1861['savePath'];logger[_0x0fd4('0x55')](_0x0fd4('0x56'),_0x4cc5d8);if(!_[_0x0fd4('0x57')](_0x1a1861[_0x0fd4('0x48')])&&fs[_0x0fd4('0x4c')](_0x4cc5d8)){logger[_0x0fd4('0x55')](_0x0fd4('0x58')+_0x4cc5d8+_0x0fd4('0x59'));fs[_0x0fd4('0x5a')](_0x4cc5d8);}_0x4cc5d8=_0x4cc5d8+_0x0fd4('0x5b');if(!_[_0x0fd4('0x57')](_0x1a1861['savePath'])&&fs[_0x0fd4('0x4c')](_0x4cc5d8)){logger[_0x0fd4('0x55')]('File:\x20\x22'+_0x4cc5d8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0fd4('0x5a')](_0x4cc5d8);}return _0x1a1861;})[_0x0fd4('0x21')](function(_0x5c4f53){if(!_0x5c4f53)throw new InternalError();return _0x5c4f53[_0x0fd4('0x22')]();})['then'](function(){_0x3be8d6[_0x0fd4('0x19')](0xcc)[_0x0fd4('0x18')]();})[_0x0fd4('0x3e')](handleError(_0x3be8d6,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 5076020..f1cd7bc 100644 --- a/server/api/squareRecording/squareRecording.model.js +++ b/server/api/squareRecording/squareRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f37=['lodash','util','api','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings'];(function(_0x4a5182,_0x135866){var _0x5c1ae5=function(_0x59eb7c){while(--_0x59eb7c){_0x4a5182['push'](_0x4a5182['shift']());}};_0x5c1ae5(++_0x135866);}(_0x9f37,0xd1));var _0x79f3=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x9f37[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var logger=require('../../config/logger')(_0x79f3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x79f3('0x3'));var fs=require('fs');var path=require(_0x79f3('0x4'));var rimraf=require(_0x79f3('0x5'));var config=require('../../config/environment');var attributes=require(_0x79f3('0x6'));module[_0x79f3('0x7')]=function(_0x594d87,_0x5db84b){return _0x594d87[_0x79f3('0x8')](_0x79f3('0x9'),attributes,{'tableName':_0x79f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f0e=['./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3152b0,_0x5a0cfe){_0x3152b0=_0x3152b0-0x0;var _0x53e5ba=_0x9f0e[_0x3152b0];return _0x53e5ba;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));module[_0xe9f0('0x9')]=function(_0x50313d,_0x5b87c1){return _0x50313d[_0xe9f0('0xa')](_0xe9f0('0xb'),attributes,{'tableName':_0xe9f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 108c9cc..2b123f2 100644 --- a/server/api/squareRecording/squareRecording.rpc.js +++ b/server/api/squareRecording/squareRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3744=['SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s'];(function(_0x96015a,_0x594666){var _0x23e791=function(_0x12493b){while(--_0x12493b){_0x96015a['push'](_0x96015a['shift']());}};_0x23e791(++_0x594666);}(_0x3744,0xd9));var _0x4374=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x3744[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x4374('0x0'));var util=require(_0x4374('0x1'));var moment=require(_0x4374('0x2'));var BPromise=require(_0x4374('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4374('0x4'));var db=require(_0x4374('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4374('0x6'))(_0x4374('0x7'));var config=require(_0x4374('0x8'));var jayson=require(_0x4374('0x9'));var client=jayson[_0x4374('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6fa4,_0x368df8,_0x424b9c){return new BPromise(function(_0x4ea754,_0x5f4b35){return client[_0x4374('0xb')](_0x4e6fa4,_0x424b9c)[_0x4374('0xc')](function(_0x1bb733){logger[_0x4374('0xd')](_0x4374('0xe'),_0x368df8,'request\x20sent');logger['debug'](_0x4374('0xf'),_0x368df8,_0x4374('0x10'),JSON[_0x4374('0x11')](_0x1bb733));if(_0x1bb733[_0x4374('0x12')]){if(_0x1bb733[_0x4374('0x12')][_0x4374('0x13')]===0x1f4){logger[_0x4374('0x12')](_0x4374('0xe'),_0x368df8,_0x1bb733[_0x4374('0x12')][_0x4374('0x14')]);return _0x5f4b35(_0x1bb733[_0x4374('0x12')]['message']);}logger[_0x4374('0x12')](_0x4374('0xe'),_0x368df8,_0x1bb733['error'][_0x4374('0x14')]);return _0x4ea754(_0x1bb733[_0x4374('0x12')][_0x4374('0x14')]);}else{logger['info'](_0x4374('0xe'),_0x368df8,'request\x20sent');_0x4ea754(_0x1bb733['result'][_0x4374('0x14')]);}})[_0x4374('0x15')](function(_0x10adc6){logger[_0x4374('0x12')]('SquareRecording,\x20%s,\x20%s',_0x368df8,_0x10adc6);_0x5f4b35(_0x10adc6);});});}exports[_0x4374('0x16')]=function(_0xbdb304){var _0x1fa874=this;return new Promise(function(_0x18a1cb,_0x3a2099){return db[_0x4374('0x17')][_0x4374('0x18')](_0xbdb304[_0x4374('0x19')],{'raw':_0xbdb304[_0x4374('0x1a')]?_0xbdb304[_0x4374('0x1a')][_0x4374('0x1b')]===undefined?!![]:![]:!![]})[_0x4374('0xc')](function(_0x41423d){logger[_0x4374('0xd')]('CreateSquareRecording',_0xbdb304);logger[_0x4374('0x1c')](_0x4374('0x16'),_0xbdb304,JSON['stringify'](_0x41423d));_0x18a1cb(_0x41423d);})['catch'](function(_0x28493d){logger[_0x4374('0x12')](_0x4374('0x16'),_0x28493d[_0x4374('0x14')],_0xbdb304);_0x3a2099(_0x1fa874['error'](0x1f4,_0x28493d[_0x4374('0x14')]));});});}; \ No newline at end of file +var _0x04ae=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareRecording','SquareRecording','create','body','options','lodash','moment','bluebird'];(function(_0x4cb9d0,_0x2e0b00){var _0xbe1647=function(_0x534790){while(--_0x534790){_0x4cb9d0['push'](_0x4cb9d0['shift']());}};_0xbe1647(++_0x2e0b00);}(_0x04ae,0xc1));var _0xe04a=function(_0x14655a,_0xe801e1){_0x14655a=_0x14655a-0x0;var _0x34b158=_0x04ae[_0x14655a];return _0x34b158;};'use strict';var _=require(_0xe04a('0x0'));var util=require('util');var moment=require(_0xe04a('0x1'));var BPromise=require(_0xe04a('0x2'));var rs=require(_0xe04a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe04a('0x4'))['db'];var utils=require(_0xe04a('0x5'));var logger=require(_0xe04a('0x6'))(_0xe04a('0x7'));var config=require(_0xe04a('0x8'));var jayson=require(_0xe04a('0x9'));var client=jayson[_0xe04a('0xa')][_0xe04a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bf0d5,_0xdc60aa,_0x39c345){return new BPromise(function(_0x22bd49,_0x56c97b){return client[_0xe04a('0xc')](_0x3bf0d5,_0x39c345)[_0xe04a('0xd')](function(_0x21980f){logger[_0xe04a('0xe')](_0xe04a('0xf'),_0xdc60aa,_0xe04a('0x10'));logger[_0xe04a('0x11')](_0xe04a('0x12'),_0xdc60aa,_0xe04a('0x10'),JSON[_0xe04a('0x13')](_0x21980f));if(_0x21980f[_0xe04a('0x14')]){if(_0x21980f[_0xe04a('0x14')]['code']===0x1f4){logger[_0xe04a('0x14')]('SquareRecording,\x20%s,\x20%s',_0xdc60aa,_0x21980f['error']['message']);return _0x56c97b(_0x21980f['error'][_0xe04a('0x15')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0xdc60aa,_0x21980f[_0xe04a('0x14')][_0xe04a('0x15')]);return _0x22bd49(_0x21980f[_0xe04a('0x14')][_0xe04a('0x15')]);}else{logger[_0xe04a('0xe')](_0xe04a('0xf'),_0xdc60aa,_0xe04a('0x10'));_0x22bd49(_0x21980f[_0xe04a('0x16')][_0xe04a('0x15')]);}})['catch'](function(_0x4c4cc5){logger[_0xe04a('0x14')](_0xe04a('0xf'),_0xdc60aa,_0x4c4cc5);_0x56c97b(_0x4c4cc5);});});}exports[_0xe04a('0x17')]=function(_0x18e6b5){var _0xe03691=this;return new Promise(function(_0x1aa438,_0x1a1e06){return db[_0xe04a('0x18')][_0xe04a('0x19')](_0x18e6b5[_0xe04a('0x1a')],{'raw':_0x18e6b5['options']?_0x18e6b5[_0xe04a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xe04a('0xd')](function(_0x1f42bb){logger[_0xe04a('0xe')](_0xe04a('0x17'),_0x18e6b5);logger[_0xe04a('0x11')]('CreateSquareRecording',_0x18e6b5,JSON[_0xe04a('0x13')](_0x1f42bb));_0x1aa438(_0x1f42bb);})['catch'](function(_0x3a12f8){logger[_0xe04a('0x14')](_0xe04a('0x17'),_0x3a12f8[_0xe04a('0x15')],_0x18e6b5);_0x1a1e06(_0xe03691[_0xe04a('0x14')](0x1f4,_0x3a12f8[_0xe04a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 5f08db8..a8a85c0 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64a6=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','update','destroy'];(function(_0x3013c6,_0x2641ca){var _0x373245=function(_0x1138ae){while(--_0x1138ae){_0x3013c6['push'](_0x3013c6['shift']());}};_0x373245(++_0x2641ca);}(_0x64a6,0x7e));var _0x664a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x64a6[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x664a('0x0'));var util=require(_0x664a('0x1'));var path=require(_0x664a('0x2'));var timeout=require('connect-timeout');var express=require(_0x664a('0x3'));var router=express[_0x664a('0x4')]();var auth=require(_0x664a('0x5'));var interaction=require(_0x664a('0x6'));var config=require(_0x664a('0x7'));var controller=require(_0x664a('0x8'));router[_0x664a('0x9')]('/',auth['isAuthenticated'](),controller[_0x664a('0xa')]);router[_0x664a('0x9')](_0x664a('0xb'),auth[_0x664a('0xc')](),controller[_0x664a('0xd')]);router[_0x664a('0x9')](_0x664a('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x664a('0xc')](),controller[_0x664a('0xf')]);router['put'](_0x664a('0xe'),auth[_0x664a('0xc')](),controller[_0x664a('0x10')]);router['delete'](_0x664a('0xe'),auth[_0x664a('0xc')](),controller[_0x664a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x38ab=['index','/describe','describe','post','create','put','/:id','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated'];(function(_0x232bc8,_0x5362d6){var _0x573007=function(_0x4efc29){while(--_0x4efc29){_0x232bc8['push'](_0x232bc8['shift']());}};_0x573007(++_0x5362d6);}(_0x38ab,0x1d1));var _0xb38a=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x38ab[_0x22ee1e];return _0x49a5c9;};'use strict';var multer=require(_0xb38a('0x0'));var util=require('util');var path=require(_0xb38a('0x1'));var timeout=require(_0xb38a('0x2'));var express=require(_0xb38a('0x3'));var router=express['Router']();var auth=require(_0xb38a('0x4'));var interaction=require(_0xb38a('0x5'));var config=require(_0xb38a('0x6'));var controller=require(_0xb38a('0x7'));router[_0xb38a('0x8')]('/',auth[_0xb38a('0x9')](),controller[_0xb38a('0xa')]);router[_0xb38a('0x8')](_0xb38a('0xb'),auth['isAuthenticated'](),controller[_0xb38a('0xc')]);router[_0xb38a('0x8')]('/:id',auth[_0xb38a('0x9')](),controller['show']);router[_0xb38a('0xd')]('/',auth['isAuthenticated'](),controller[_0xb38a('0xe')]);router[_0xb38a('0xf')](_0xb38a('0x10'),auth[_0xb38a('0x9')](),controller[_0xb38a('0x11')]);router[_0xb38a('0x12')](_0xb38a('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 788d5e7..fb7b685 100644 --- a/server/api/squareReport/squareReport.attributes.js +++ b/server/api/squareReport/squareReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54b9=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x34ca7a,_0x2eecc2){var _0x12a55c=function(_0x546375){while(--_0x546375){_0x34ca7a['push'](_0x34ca7a['shift']());}};_0x12a55c(++_0x2eecc2);}(_0x54b9,0xb3));var _0x954b=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x54b9[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0x954b('0x0'));module[_0x954b('0x1')]={'network':{'type':Sequelize[_0x954b('0x2')]},'network_script':{'type':Sequelize[_0x954b('0x2')]},'request':{'type':Sequelize[_0x954b('0x2')]},'channel':{'type':Sequelize[_0x954b('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x954b('0x2')]},'version':{'type':Sequelize[_0x954b('0x2')]},'callerid':{'type':Sequelize[_0x954b('0x2')]},'calleridname':{'type':Sequelize[_0x954b('0x2')]},'callingpres':{'type':Sequelize[_0x954b('0x2')]},'callingani2':{'type':Sequelize[_0x954b('0x2')]},'callington':{'type':Sequelize[_0x954b('0x2')]},'callingtns':{'type':Sequelize[_0x954b('0x2')]},'dnid':{'type':Sequelize[_0x954b('0x2')]},'rdnis':{'type':Sequelize[_0x954b('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x954b('0x2')]},'priority':{'type':Sequelize[_0x954b('0x2')]},'enhanced':{'type':Sequelize[_0x954b('0x2')]},'accountcode':{'type':Sequelize[_0x954b('0x2')]},'threadid':{'type':Sequelize[_0x954b('0x2')]},'project_name':{'type':Sequelize[_0x954b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x954b('0x3')]},'bot':{'type':Sequelize[_0x954b('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xbaf3=['exports','STRING','DATE','sequelize'];(function(_0x201d87,_0x4096fa){var _0xfe8c99=function(_0x500809){while(--_0x500809){_0x201d87['push'](_0x201d87['shift']());}};_0xfe8c99(++_0x4096fa);}(_0xbaf3,0x1d3));var _0x3baf=function(_0x5a2199,_0x5bebe6){_0x5a2199=_0x5a2199-0x0;var _0xe34487=_0xbaf3[_0x5a2199];return _0xe34487;};'use strict';var Sequelize=require(_0x3baf('0x0'));module[_0x3baf('0x1')]={'network':{'type':Sequelize[_0x3baf('0x2')]},'network_script':{'type':Sequelize[_0x3baf('0x2')]},'request':{'type':Sequelize[_0x3baf('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3baf('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x3baf('0x2')]},'callerid':{'type':Sequelize[_0x3baf('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x3baf('0x2')]},'callingani2':{'type':Sequelize[_0x3baf('0x2')]},'callington':{'type':Sequelize[_0x3baf('0x2')]},'callingtns':{'type':Sequelize[_0x3baf('0x2')]},'dnid':{'type':Sequelize[_0x3baf('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3baf('0x2')]},'extension':{'type':Sequelize[_0x3baf('0x2')]},'priority':{'type':Sequelize[_0x3baf('0x2')]},'enhanced':{'type':Sequelize[_0x3baf('0x2')]},'accountcode':{'type':Sequelize[_0x3baf('0x2')]},'threadid':{'type':Sequelize[_0x3baf('0x2')]},'project_name':{'type':Sequelize[_0x3baf('0x2')]},'joinAt':{'type':Sequelize[_0x3baf('0x3')]},'leaveAt':{'type':Sequelize[_0x3baf('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index f5a3afa..13f2939 100644 --- a/server/api/squareReport/squareReport.controller.js +++ b/server/api/squareReport/squareReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78e0=['body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','find','create'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x78e0,0x13e));var _0x078e=function(_0x3e7b59,_0x14a4cd){_0x3e7b59=_0x3e7b59-0x0;var _0x4bd64a=_0x78e0[_0x3e7b59];return _0x4bd64a;};'use strict';var pdf=require(_0x078e('0x0'));var emlformat=require(_0x078e('0x1'));var rimraf=require(_0x078e('0x2'));var zipdir=require(_0x078e('0x3'));var jsonpatch=require(_0x078e('0x4'));var rp=require(_0x078e('0x5'));var moment=require(_0x078e('0x6'));var BPromise=require(_0x078e('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x078e('0x8'));var sox=require(_0x078e('0x9'));var csv=require(_0x078e('0xa'));var ejs=require(_0x078e('0xb'));var fs=require('fs');var _=require(_0x078e('0xc'));var squel=require('squel');var crypto=require(_0x078e('0xd'));var jsforce=require(_0x078e('0xe'));var deskjs=require(_0x078e('0xf'));var toCsv=require(_0x078e('0xa'));var querystring=require(_0x078e('0x10'));var Papa=require(_0x078e('0x11'));var Redis=require(_0x078e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x078e('0x13'));var as=require(_0x078e('0x14'));var hardwareService=require(_0x078e('0x15'));var logger=require(_0x078e('0x16'))(_0x078e('0x17'));var utils=require(_0x078e('0x18'));var config=require(_0x078e('0x19'));var licenseUtil=require(_0x078e('0x1a'));var db=require(_0x078e('0x1b'))['db'];function respondWithStatusCode(_0x4e4811,_0x3b0d4e){_0x3b0d4e=_0x3b0d4e||0xcc;return function(_0x528647){if(_0x528647){return _0x4e4811['sendStatus'](_0x3b0d4e);}return _0x4e4811[_0x078e('0x1c')](_0x3b0d4e)['end']();};}function respondWithResult(_0xe39d18,_0x341853){_0x341853=_0x341853||0xc8;return function(_0x14e3f4){if(_0x14e3f4){return _0xe39d18[_0x078e('0x1c')](_0x341853)[_0x078e('0x1d')](_0x14e3f4);}};}function respondWithFilteredResult(_0x2a5902,_0x4e2fc5){return function(_0x5833a5){if(_0x5833a5){var _0x4af45d=_0x5833a5[_0x078e('0x1e')],_0x44f75b=_0x4e2fc5[_0x078e('0x1f')],_0x150529=_0x4e2fc5[_0x078e('0x1f')]+_0x4e2fc5[_0x078e('0x20')],_0x48aa6b;if(_0x150529>=_0x4af45d){_0x150529=_0x4af45d;_0x48aa6b=0xc8;}else{_0x48aa6b=0xce;}_0x2a5902[_0x078e('0x1c')](_0x48aa6b);return _0x2a5902[_0x078e('0x21')](_0x078e('0x22'),_0x44f75b+'-'+_0x150529+'/'+_0x4af45d)[_0x078e('0x1d')](_0x5833a5);}return null;};}function patchUpdates(_0x2fa816){return function(_0x429cad){try{jsonpatch[_0x078e('0x23')](_0x429cad,_0x2fa816,!![]);}catch(_0x478f27){return BPromise[_0x078e('0x24')](_0x478f27);}return _0x429cad['save']();};}function saveUpdates(_0x1d0b2b,_0x2508d5){return function(_0x2909e6){if(_0x2909e6){return _0x2909e6[_0x078e('0x25')](_0x1d0b2b)['then'](function(_0x2f14ac){return _0x2f14ac;});}return null;};}function removeEntity(_0x56ddb2,_0x4d5ef7){return function(_0x30b6b0){if(_0x30b6b0){return _0x30b6b0[_0x078e('0x26')]()['then'](function(){_0x56ddb2[_0x078e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x211592,_0x20421a){return function(_0x23173b){if(!_0x23173b){_0x211592[_0x078e('0x27')](0x194);}return _0x23173b;};}function handleError(_0x357b3a,_0xa28b6c){_0xa28b6c=_0xa28b6c||0x1f4;return function(_0x5979bf){logger['error'](_0x5979bf[_0x078e('0x28')]);if(_0x5979bf['name']){delete _0x5979bf[_0x078e('0x29')];}_0x357b3a[_0x078e('0x1c')](_0xa28b6c)[_0x078e('0x2a')](_0x5979bf);};}exports[_0x078e('0x2b')]=function(_0x53ce23,_0x5e6d26){var _0x19ad2f={},_0x880085={},_0x46444d={'count':0x0,'rows':[]};var _0x329481=_[_0x078e('0x2c')](db[_0x078e('0x2d')][_0x078e('0x2e')],function(_0x26a486){return{'name':_0x26a486[_0x078e('0x2f')],'type':_0x26a486['type']['key']};});_0x880085[_0x078e('0x30')]=_[_0x078e('0x2c')](_0x329481,'name');_0x880085[_0x078e('0x31')]=_['keys'](_0x53ce23[_0x078e('0x31')]);_0x880085[_0x078e('0x32')]=_[_0x078e('0x33')](_0x880085[_0x078e('0x30')],_0x880085[_0x078e('0x31')]);_0x19ad2f['attributes']=_[_0x078e('0x33')](_0x880085[_0x078e('0x30')],qs[_0x078e('0x34')](_0x53ce23['query'][_0x078e('0x34')]));_0x19ad2f[_0x078e('0x35')]=_0x19ad2f[_0x078e('0x35')][_0x078e('0x36')]?_0x19ad2f[_0x078e('0x35')]:_0x880085[_0x078e('0x30')];if(!_0x53ce23['query'][_0x078e('0x37')](_0x078e('0x38'))){_0x19ad2f[_0x078e('0x20')]=qs[_0x078e('0x20')](_0x53ce23[_0x078e('0x31')][_0x078e('0x20')]);_0x19ad2f[_0x078e('0x1f')]=qs[_0x078e('0x1f')](_0x53ce23[_0x078e('0x31')][_0x078e('0x1f')]);}_0x19ad2f[_0x078e('0x39')]=qs[_0x078e('0x3a')](_0x53ce23[_0x078e('0x31')]['sort']);_0x19ad2f[_0x078e('0x3b')]=qs[_0x078e('0x32')](_[_0x078e('0x3c')](_0x53ce23[_0x078e('0x31')],_0x880085[_0x078e('0x32')]),_0x329481);if(_0x53ce23[_0x078e('0x31')][_0x078e('0x3d')]){_0x19ad2f['where']=_[_0x078e('0x3e')](_0x19ad2f[_0x078e('0x3b')],{'$or':_['map'](_0x329481,function(_0x32b00b){if(_0x32b00b[_0x078e('0x3f')]!==_0x078e('0x40')){var _0x57257a={};_0x57257a[_0x32b00b[_0x078e('0x29')]]={'$like':'%'+_0x53ce23[_0x078e('0x31')][_0x078e('0x3d')]+'%'};return _0x57257a;}})});}_0x19ad2f=_[_0x078e('0x3e')]({},_0x19ad2f,_0x53ce23[_0x078e('0x41')]);var _0xc90922={'where':_0x19ad2f[_0x078e('0x3b')]};return db['SquareReport'][_0x078e('0x1e')](_0xc90922)[_0x078e('0x42')](function(_0xfda371){_0x46444d['count']=_0xfda371;if(_0x53ce23[_0x078e('0x31')][_0x078e('0x43')]){_0x19ad2f[_0x078e('0x44')]=[{'all':!![]}];}return db['SquareReport'][_0x078e('0x45')](_0x19ad2f);})[_0x078e('0x42')](function(_0x426ff5){_0x46444d[_0x078e('0x46')]=_0x426ff5;return _0x46444d;})[_0x078e('0x42')](respondWithFilteredResult(_0x5e6d26,_0x19ad2f))[_0x078e('0x47')](handleError(_0x5e6d26,null));};exports[_0x078e('0x48')]=function(_0x36d992,_0x1c96fe){var _0x45fd4c={'raw':!![],'where':{'id':_0x36d992[_0x078e('0x49')]['id']}},_0x1ccb4e={};_0x1ccb4e[_0x078e('0x30')]=_[_0x078e('0x4a')](db['SquareReport'][_0x078e('0x2e')]);_0x1ccb4e[_0x078e('0x31')]=_[_0x078e('0x4a')](_0x36d992['query']);_0x1ccb4e[_0x078e('0x32')]=_[_0x078e('0x33')](_0x1ccb4e[_0x078e('0x30')],_0x1ccb4e[_0x078e('0x31')]);_0x45fd4c[_0x078e('0x35')]=_[_0x078e('0x33')](_0x1ccb4e[_0x078e('0x30')],qs[_0x078e('0x34')](_0x36d992['query']['fields']));_0x45fd4c[_0x078e('0x35')]=_0x45fd4c[_0x078e('0x35')][_0x078e('0x36')]?_0x45fd4c['attributes']:_0x1ccb4e['model'];if(_0x36d992[_0x078e('0x31')][_0x078e('0x43')]){_0x45fd4c[_0x078e('0x44')]=[{'all':!![]}];}_0x45fd4c=_['merge']({},_0x45fd4c,_0x36d992[_0x078e('0x41')]);return db[_0x078e('0x2d')][_0x078e('0x4b')](_0x45fd4c)['then'](handleEntityNotFound(_0x1c96fe,null))['then'](respondWithResult(_0x1c96fe,null))[_0x078e('0x47')](handleError(_0x1c96fe,null));};exports[_0x078e('0x4c')]=function(_0xedb8e,_0x274ddd){return db['SquareReport']['create'](_0xedb8e[_0x078e('0x4d')],{})['then'](respondWithResult(_0x274ddd,0xc9))[_0x078e('0x47')](handleError(_0x274ddd,null));};exports[_0x078e('0x25')]=function(_0xee8b01,_0x53ce90){if(_0xee8b01[_0x078e('0x4d')]['id']){delete _0xee8b01[_0x078e('0x4d')]['id'];}return db[_0x078e('0x2d')][_0x078e('0x4b')]({'where':{'id':_0xee8b01[_0x078e('0x49')]['id']}})[_0x078e('0x42')](handleEntityNotFound(_0x53ce90,null))[_0x078e('0x42')](saveUpdates(_0xee8b01[_0x078e('0x4d')],null))[_0x078e('0x42')](respondWithResult(_0x53ce90,null))[_0x078e('0x47')](handleError(_0x53ce90,null));};exports[_0x078e('0x26')]=function(_0x5c893b,_0x1b6aed){return db[_0x078e('0x2d')]['find']({'where':{'id':_0x5c893b['params']['id']}})['then'](handleEntityNotFound(_0x1b6aed,null))[_0x078e('0x42')](removeEntity(_0x1b6aed,null))[_0x078e('0x47')](handleError(_0x1b6aed,null));};exports[_0x078e('0x4e')]=function(_0x4ac518,_0x528436){return db['SquareReport'][_0x078e('0x4e')]()[_0x078e('0x42')](respondWithResult(_0x528436,null))[_0x078e('0x47')](handleError(_0x528436,null));}; \ No newline at end of file +var _0x50e5=['name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','sort','filters','merge','where','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','Content-Range','json','apply','reject','save','update','destroy','then','error','stack'];(function(_0x1c9786,_0x26dd12){var _0x255c3d=function(_0x1c1f98){while(--_0x1c1f98){_0x1c9786['push'](_0x1c9786['shift']());}};_0x255c3d(++_0x26dd12);}(_0x50e5,0xb7));var _0x550e=function(_0x1f9577,_0x24cafd){_0x1f9577=_0x1f9577-0x0;var _0x4222c5=_0x50e5[_0x1f9577];return _0x4222c5;};'use strict';var pdf=require(_0x550e('0x0'));var emlformat=require(_0x550e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x550e('0x2'));var jsonpatch=require(_0x550e('0x3'));var rp=require(_0x550e('0x4'));var moment=require(_0x550e('0x5'));var BPromise=require(_0x550e('0x6'));var Mustache=require(_0x550e('0x7'));var util=require(_0x550e('0x8'));var path=require(_0x550e('0x9'));var sox=require(_0x550e('0xa'));var csv=require(_0x550e('0xb'));var ejs=require(_0x550e('0xc'));var fs=require('fs');var _=require(_0x550e('0xd'));var squel=require('squel');var crypto=require(_0x550e('0xe'));var jsforce=require(_0x550e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x550e('0xb'));var querystring=require(_0x550e('0x10'));var Papa=require(_0x550e('0x11'));var Redis=require('ioredis');var authService=require(_0x550e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x550e('0x13'));var logger=require(_0x550e('0x14'))('api');var utils=require(_0x550e('0x15'));var config=require(_0x550e('0x16'));var licenseUtil=require(_0x550e('0x17'));var db=require(_0x550e('0x18'))['db'];function respondWithStatusCode(_0x518cad,_0x335cba){_0x335cba=_0x335cba||0xcc;return function(_0x57214a){if(_0x57214a){return _0x518cad[_0x550e('0x19')](_0x335cba);}return _0x518cad['status'](_0x335cba)[_0x550e('0x1a')]();};}function respondWithResult(_0x4c6070,_0x393055){_0x393055=_0x393055||0xc8;return function(_0x2d4b79){if(_0x2d4b79){return _0x4c6070[_0x550e('0x1b')](_0x393055)['json'](_0x2d4b79);}};}function respondWithFilteredResult(_0x302be0,_0x49787c){return function(_0xf28ba7){if(_0xf28ba7){var _0x49474f=_0xf28ba7['count'],_0x4a5f7a=_0x49787c['offset'],_0x31f4bf=_0x49787c['offset']+_0x49787c[_0x550e('0x1c')],_0xabb30d;if(_0x31f4bf>=_0x49474f){_0x31f4bf=_0x49474f;_0xabb30d=0xc8;}else{_0xabb30d=0xce;}_0x302be0['status'](_0xabb30d);return _0x302be0['set'](_0x550e('0x1d'),_0x4a5f7a+'-'+_0x31f4bf+'/'+_0x49474f)[_0x550e('0x1e')](_0xf28ba7);}return null;};}function patchUpdates(_0x6c7178){return function(_0x846ad){try{jsonpatch[_0x550e('0x1f')](_0x846ad,_0x6c7178,!![]);}catch(_0x29f2db){return BPromise[_0x550e('0x20')](_0x29f2db);}return _0x846ad[_0x550e('0x21')]();};}function saveUpdates(_0x1b9799,_0x47e6e1){return function(_0x23adb1){if(_0x23adb1){return _0x23adb1[_0x550e('0x22')](_0x1b9799)['then'](function(_0x4f70bd){return _0x4f70bd;});}return null;};}function removeEntity(_0x3e9822,_0x2663c7){return function(_0x5769bb){if(_0x5769bb){return _0x5769bb[_0x550e('0x23')]()[_0x550e('0x24')](function(){_0x3e9822[_0x550e('0x1b')](0xcc)[_0x550e('0x1a')]();});}};}function handleEntityNotFound(_0x3aa1b8,_0x3bbca3){return function(_0x56f6a2){if(!_0x56f6a2){_0x3aa1b8[_0x550e('0x19')](0x194);}return _0x56f6a2;};}function handleError(_0x205e3a,_0x45d972){_0x45d972=_0x45d972||0x1f4;return function(_0x2d10f3){logger[_0x550e('0x25')](_0x2d10f3[_0x550e('0x26')]);if(_0x2d10f3[_0x550e('0x27')]){delete _0x2d10f3[_0x550e('0x27')];}_0x205e3a[_0x550e('0x1b')](_0x45d972)[_0x550e('0x28')](_0x2d10f3);};}exports[_0x550e('0x29')]=function(_0x362d21,_0x5e0434){var _0x291976={},_0x11bec0={},_0x48d367={'count':0x0,'rows':[]};var _0x3a1d62=_[_0x550e('0x2a')](db[_0x550e('0x2b')][_0x550e('0x2c')],function(_0x1a4caa){return{'name':_0x1a4caa[_0x550e('0x2d')],'type':_0x1a4caa[_0x550e('0x2e')][_0x550e('0x2f')]};});_0x11bec0[_0x550e('0x30')]=_[_0x550e('0x2a')](_0x3a1d62,_0x550e('0x27'));_0x11bec0[_0x550e('0x31')]=_[_0x550e('0x32')](_0x362d21[_0x550e('0x31')]);_0x11bec0['filters']=_[_0x550e('0x33')](_0x11bec0[_0x550e('0x30')],_0x11bec0['query']);_0x291976[_0x550e('0x34')]=_[_0x550e('0x33')](_0x11bec0['model'],qs[_0x550e('0x35')](_0x362d21[_0x550e('0x31')][_0x550e('0x35')]));_0x291976[_0x550e('0x34')]=_0x291976[_0x550e('0x34')][_0x550e('0x36')]?_0x291976[_0x550e('0x34')]:_0x11bec0[_0x550e('0x30')];if(!_0x362d21['query'][_0x550e('0x37')]('nolimit')){_0x291976[_0x550e('0x1c')]=qs[_0x550e('0x1c')](_0x362d21['query'][_0x550e('0x1c')]);_0x291976[_0x550e('0x38')]=qs['offset'](_0x362d21['query']['offset']);}_0x291976['order']=qs[_0x550e('0x39')](_0x362d21[_0x550e('0x31')][_0x550e('0x39')]);_0x291976['where']=qs['filters'](_['pick'](_0x362d21[_0x550e('0x31')],_0x11bec0[_0x550e('0x3a')]),_0x3a1d62);if(_0x362d21['query']['filter']){_0x291976['where']=_[_0x550e('0x3b')](_0x291976[_0x550e('0x3c')],{'$or':_[_0x550e('0x2a')](_0x3a1d62,function(_0x575e0b){if(_0x575e0b['type']!==_0x550e('0x3d')){var _0x380f85={};_0x380f85[_0x575e0b[_0x550e('0x27')]]={'$like':'%'+_0x362d21[_0x550e('0x31')]['filter']+'%'};return _0x380f85;}})});}_0x291976=_[_0x550e('0x3b')]({},_0x291976,_0x362d21[_0x550e('0x3e')]);var _0x4cfde4={'where':_0x291976['where']};return db[_0x550e('0x2b')][_0x550e('0x3f')](_0x4cfde4)[_0x550e('0x24')](function(_0x437716){_0x48d367['count']=_0x437716;if(_0x362d21[_0x550e('0x31')][_0x550e('0x40')]){_0x291976[_0x550e('0x41')]=[{'all':!![]}];}return db[_0x550e('0x2b')]['findAll'](_0x291976);})[_0x550e('0x24')](function(_0x24532e){_0x48d367[_0x550e('0x42')]=_0x24532e;return _0x48d367;})[_0x550e('0x24')](respondWithFilteredResult(_0x5e0434,_0x291976))[_0x550e('0x43')](handleError(_0x5e0434,null));};exports[_0x550e('0x44')]=function(_0x489571,_0x2f8cf5){var _0x1e3550={'raw':!![],'where':{'id':_0x489571[_0x550e('0x45')]['id']}},_0x3db475={};_0x3db475[_0x550e('0x30')]=_['keys'](db[_0x550e('0x2b')][_0x550e('0x2c')]);_0x3db475['query']=_[_0x550e('0x32')](_0x489571[_0x550e('0x31')]);_0x3db475[_0x550e('0x3a')]=_['intersection'](_0x3db475['model'],_0x3db475[_0x550e('0x31')]);_0x1e3550[_0x550e('0x34')]=_['intersection'](_0x3db475[_0x550e('0x30')],qs[_0x550e('0x35')](_0x489571['query'][_0x550e('0x35')]));_0x1e3550[_0x550e('0x34')]=_0x1e3550[_0x550e('0x34')][_0x550e('0x36')]?_0x1e3550[_0x550e('0x34')]:_0x3db475[_0x550e('0x30')];if(_0x489571['query'][_0x550e('0x40')]){_0x1e3550['include']=[{'all':!![]}];}_0x1e3550=_[_0x550e('0x3b')]({},_0x1e3550,_0x489571[_0x550e('0x3e')]);return db['SquareReport'][_0x550e('0x46')](_0x1e3550)[_0x550e('0x24')](handleEntityNotFound(_0x2f8cf5,null))[_0x550e('0x24')](respondWithResult(_0x2f8cf5,null))[_0x550e('0x43')](handleError(_0x2f8cf5,null));};exports[_0x550e('0x47')]=function(_0x35881f,_0x5e4596){return db[_0x550e('0x2b')][_0x550e('0x47')](_0x35881f[_0x550e('0x48')],{})[_0x550e('0x24')](respondWithResult(_0x5e4596,0xc9))[_0x550e('0x43')](handleError(_0x5e4596,null));};exports[_0x550e('0x22')]=function(_0x3e1c3e,_0xf4b987){if(_0x3e1c3e[_0x550e('0x48')]['id']){delete _0x3e1c3e[_0x550e('0x48')]['id'];}return db[_0x550e('0x2b')][_0x550e('0x46')]({'where':{'id':_0x3e1c3e[_0x550e('0x45')]['id']}})[_0x550e('0x24')](handleEntityNotFound(_0xf4b987,null))[_0x550e('0x24')](saveUpdates(_0x3e1c3e[_0x550e('0x48')],null))[_0x550e('0x24')](respondWithResult(_0xf4b987,null))[_0x550e('0x43')](handleError(_0xf4b987,null));};exports[_0x550e('0x23')]=function(_0x203b32,_0x3b437f){return db[_0x550e('0x2b')]['find']({'where':{'id':_0x203b32[_0x550e('0x45')]['id']}})[_0x550e('0x24')](handleEntityNotFound(_0x3b437f,null))[_0x550e('0x24')](removeEntity(_0x3b437f,null))[_0x550e('0x43')](handleError(_0x3b437f,null));};exports[_0x550e('0x49')]=function(_0x8a5c64,_0x1e95c3){return db['SquareReport'][_0x550e('0x49')]()[_0x550e('0x24')](respondWithResult(_0x1e95c3,null))[_0x550e('0x43')](handleError(_0x1e95c3,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f7fd571..133cde1 100644 --- a/server/api/squareReport/squareReport.model.js +++ b/server/api/squareReport/squareReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdf4=['rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','api','moment','request-promise'];(function(_0x31b630,_0x365e05){var _0x384bcc=function(_0xe467b4){while(--_0xe467b4){_0x31b630['push'](_0x31b630['shift']());}};_0x384bcc(++_0x365e05);}(_0xbdf4,0x96));var _0x4bdf=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xbdf4[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require(_0x4bdf('0x0'));var logger=require('../../config/logger')(_0x4bdf('0x1'));var moment=require(_0x4bdf('0x2'));var BPromise=require('bluebird');var rp=require(_0x4bdf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4bdf('0x4'));var config=require('../../config/environment');var attributes=require(_0x4bdf('0x5'));module[_0x4bdf('0x6')]=function(_0x1e2068,_0x4ebf91){return _0x1e2068[_0x4bdf('0x7')](_0x4bdf('0x8'),attributes,{'tableName':_0x4bdf('0x9'),'paranoid':![],'indexes':[{'name':_0x4bdf('0xa'),'fields':[_0x4bdf('0xb'),_0x4bdf('0xc')]},{'name':_0x4bdf('0xd'),'fields':[_0x4bdf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd87d=['uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareReport.attributes','define','report_square'];(function(_0x44e50a,_0x1cc4a2){var _0x1b5994=function(_0x29a487){while(--_0x29a487){_0x44e50a['push'](_0x44e50a['shift']());}};_0x1b5994(++_0x1cc4a2);}(_0xd87d,0x1e4));var _0xdd87=function(_0xc290eb,_0x4bb6c4){_0xc290eb=_0xc290eb-0x0;var _0x45b953=_0xd87d[_0xc290eb];return _0x45b953;};'use strict';var _=require(_0xdd87('0x0'));var util=require(_0xdd87('0x1'));var logger=require(_0xdd87('0x2'))(_0xdd87('0x3'));var moment=require(_0xdd87('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd87('0x5'));var rimraf=require(_0xdd87('0x6'));var config=require(_0xdd87('0x7'));var attributes=require(_0xdd87('0x8'));module['exports']=function(_0x1aae5,_0x21c2dc){return _0x1aae5[_0xdd87('0x9')]('SquareReport',attributes,{'tableName':_0xdd87('0xa'),'paranoid':![],'indexes':[{'name':_0xdd87('0xb'),'fields':[_0xdd87('0xc'),_0xdd87('0xd')]},{'name':_0xdd87('0xe'),'fields':[_0xdd87('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 7dc1954..0702376 100644 --- a/server/api/squareReport/squareReport.rpc.js +++ b/server/api/squareReport/squareReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46ed=['options','raw','CreateSquareReport','catch','UpdateSquareReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','create','body'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('SquareReport,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});}exports['CreateSquareReport']=function(_0x5ddd04){var _0x2e8f6d=this;return new Promise(function(_0x1bd574,_0x488690){return db['SquareReport'][_0xd46e('0x16')](_0x5ddd04[_0xd46e('0x17')],{'raw':_0x5ddd04[_0xd46e('0x18')]?_0x5ddd04[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![]})[_0xd46e('0xc')](function(_0x3b5fa4){logger[_0xd46e('0xd')](_0xd46e('0x1a'),_0x5ddd04);logger[_0xd46e('0xf')](_0xd46e('0x1a'),_0x5ddd04,JSON['stringify'](_0x3b5fa4));_0x1bd574(_0x3b5fa4);})[_0xd46e('0x1b')](function(_0x1c83fa){logger[_0xd46e('0x13')](_0xd46e('0x1a'),_0x1c83fa[_0xd46e('0x14')],_0x5ddd04);_0x488690(_0x2e8f6d[_0xd46e('0x13')](0x1f4,_0x1c83fa[_0xd46e('0x14')]));});});};exports[_0xd46e('0x1c')]=function(_0x62dea5){var _0x4cf899=this;return new Promise(function(_0x314570,_0x5424e5){return db['SquareReport'][_0xd46e('0x1d')](_0x62dea5[_0xd46e('0x17')],{'raw':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')]['where']||null:null,'attributes':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x1e')]||null:null,'limit':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x1f')]||null:null})['then'](function(_0x465d54){logger[_0xd46e('0xd')](_0xd46e('0x1c'),_0x62dea5);logger[_0xd46e('0xf')](_0xd46e('0x1c'),_0x62dea5,JSON[_0xd46e('0x12')](_0x465d54));_0x314570(_0x465d54);})[_0xd46e('0x1b')](function(_0x2c5ec7){logger[_0xd46e('0x13')](_0xd46e('0x1c'),_0x2c5ec7[_0xd46e('0x14')],_0x62dea5);_0x5424e5(_0x4cf899[_0xd46e('0x13')](0x1f4,_0x2c5ec7[_0xd46e('0x14')]));});});}; \ No newline at end of file +var _0x55ca=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','update','raw','where','limit','UpdateSquareReport','lodash','util','ioredis'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x55ca,0x126));var _0xa55c=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x55ca[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareReport,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareReport,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')](_0x24783b[_0xa55c('0x1a')],{'raw':_0x24783b[_0xa55c('0x1b')]?_0x24783b['options']['raw']===undefined?!![]:![]:!![]})[_0xa55c('0xb')](function(_0x3776ac){logger[_0xa55c('0x14')]('CreateSquareReport',_0x24783b);logger[_0xa55c('0xe')](_0xa55c('0x17'),_0x24783b,JSON['stringify'](_0x3776ac));_0x3d4c9e(_0x3776ac);})[_0xa55c('0x16')](function(_0x133096){logger[_0xa55c('0x11')](_0xa55c('0x17'),_0x133096[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c['error'](0x1f4,_0x133096[_0xa55c('0x13')]));});});};exports['UpdateSquareReport']=function(_0x5ba836){var _0x59d89a=this;return new Promise(function(_0x19ae88,_0x54b038){return db[_0xa55c('0x18')][_0xa55c('0x1c')](_0x5ba836[_0xa55c('0x1a')],{'raw':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1e')]||null:null,'attributes':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')]['attributes']||null:null,'limit':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1f')]||null:null})[_0xa55c('0xb')](function(_0x5d940d){logger[_0xa55c('0x14')](_0xa55c('0x20'),_0x5ba836);logger[_0xa55c('0xe')](_0xa55c('0x20'),_0x5ba836,JSON[_0xa55c('0x10')](_0x5d940d));_0x19ae88(_0x5d940d);})[_0xa55c('0x16')](function(_0x52d37f){logger[_0xa55c('0x11')]('UpdateSquareReport',_0x52d37f[_0xa55c('0x13')],_0x5ba836);_0x54b038(_0x59d89a[_0xa55c('0x11')](0x1f4,_0x52d37f[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 2b06a41..c0397e7 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x54710e,_0x122291){var _0x4fa992=function(_0x4c735d){while(--_0x4c735d){_0x54710e['push'](_0x54710e['shift']());}};_0x4fa992(++_0x122291);}(_0x7a54,0x106));var _0x47a5=function(_0x54c4be,_0x52d74e){_0x54c4be=_0x54c4be-0x0;var _0x2c6f83=_0x7a54[_0x54c4be];return _0x2c6f83;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5f10c9,_0x375acb){var _0x297815=function(_0x4c2781){while(--_0x4c2781){_0x5f10c9['push'](_0x5f10c9['shift']());}};_0x297815(++_0x375acb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x313a5f,_0x4a4342){_0x313a5f=_0x313a5f-0x0;var _0x24e749=_0x5f2f[_0x313a5f];return _0x24e749;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 71c94ab..6d2620a 100644 --- a/server/api/squareReportDetail/squareReportDetail.attributes.js +++ b/server/api/squareReportDetail/squareReportDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa57c=['TEXT','exports','STRING'];(function(_0xc5caf7,_0xc6d31b){var _0x509351=function(_0x531902){while(--_0x531902){_0xc5caf7['push'](_0xc5caf7['shift']());}};_0x509351(++_0xc6d31b);}(_0xa57c,0x1ed));var _0xca57=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa57c[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0xca57('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xca57('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xca57('0x2')]},'project_name':{'type':Sequelize[_0xca57('0x1')]},'callerid':{'type':Sequelize[_0xca57('0x1')]}}; \ No newline at end of file +var _0xf9e3=['exports','STRING','TEXT','sequelize'];(function(_0x1d8387,_0xd6a8d6){var _0x1eb713=function(_0x5752c8){while(--_0x5752c8){_0x1d8387['push'](_0x1d8387['shift']());}};_0x1eb713(++_0xd6a8d6);}(_0xf9e3,0x1eb));var _0x3f9e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf9e3[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x3f9e('0x0'));module[_0x3f9e('0x1')]={'uniqueid':{'type':Sequelize[_0x3f9e('0x2')]},'node':{'type':Sequelize[_0x3f9e('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x3f9e('0x3')]},'project_name':{'type':Sequelize[_0x3f9e('0x2')]},'callerid':{'type':Sequelize[_0x3f9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 5e85ee0..7050fd5 100644 --- a/server/api/squareReportDetail/squareReportDetail.controller.js +++ b/server/api/squareReportDetail/squareReportDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ce8=['type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','rows','catch','keys','rawAttributes','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','name','index','map','SquareDetailsReport','fieldName'];(function(_0x3a69eb,_0x292a45){var _0x3096a9=function(_0x3476b2){while(--_0x3476b2){_0x3a69eb['push'](_0x3a69eb['shift']());}};_0x3096a9(++_0x292a45);}(_0x7ce8,0x165));var _0x87ce=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x7ce8[_0xa9a245];return _0x2d0eaa;};'use strict';var pdf=require(_0x87ce('0x0'));var emlformat=require(_0x87ce('0x1'));var rimraf=require(_0x87ce('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x87ce('0x3'));var moment=require(_0x87ce('0x4'));var BPromise=require(_0x87ce('0x5'));var Mustache=require(_0x87ce('0x6'));var util=require(_0x87ce('0x7'));var path=require(_0x87ce('0x8'));var sox=require('sox');var csv=require(_0x87ce('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x87ce('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x87ce('0xb'));var deskjs=require(_0x87ce('0xc'));var toCsv=require(_0x87ce('0x9'));var querystring=require(_0x87ce('0xd'));var Papa=require(_0x87ce('0xe'));var Redis=require('ioredis');var authService=require(_0x87ce('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x87ce('0x10'));var hardwareService=require(_0x87ce('0x11'));var logger=require(_0x87ce('0x12'))(_0x87ce('0x13'));var utils=require(_0x87ce('0x14'));var config=require(_0x87ce('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fce1c,_0x392068){_0x392068=_0x392068||0xcc;return function(_0x114937){if(_0x114937){return _0x3fce1c['sendStatus'](_0x392068);}return _0x3fce1c[_0x87ce('0x16')](_0x392068)['end']();};}function respondWithResult(_0xe9fdc1,_0xf0ab4a){_0xf0ab4a=_0xf0ab4a||0xc8;return function(_0x3cc0c4){if(_0x3cc0c4){return _0xe9fdc1[_0x87ce('0x16')](_0xf0ab4a)[_0x87ce('0x17')](_0x3cc0c4);}};}function respondWithFilteredResult(_0xea5d27,_0x4ce3b6){return function(_0x21573e){if(_0x21573e){var _0x3cdda3=_0x21573e[_0x87ce('0x18')],_0x340f9b=_0x4ce3b6[_0x87ce('0x19')],_0x3e82e9=_0x4ce3b6[_0x87ce('0x19')]+_0x4ce3b6[_0x87ce('0x1a')],_0x4cf8b6;if(_0x3e82e9>=_0x3cdda3){_0x3e82e9=_0x3cdda3;_0x4cf8b6=0xc8;}else{_0x4cf8b6=0xce;}_0xea5d27[_0x87ce('0x16')](_0x4cf8b6);return _0xea5d27[_0x87ce('0x1b')](_0x87ce('0x1c'),_0x340f9b+'-'+_0x3e82e9+'/'+_0x3cdda3)[_0x87ce('0x17')](_0x21573e);}return null;};}function patchUpdates(_0x2a4dca){return function(_0xef78cb){try{jsonpatch[_0x87ce('0x1d')](_0xef78cb,_0x2a4dca,!![]);}catch(_0x4c4dc8){return BPromise['reject'](_0x4c4dc8);}return _0xef78cb[_0x87ce('0x1e')]();};}function saveUpdates(_0x29ec91,_0x571214){return function(_0x45d4cd){if(_0x45d4cd){return _0x45d4cd['update'](_0x29ec91)[_0x87ce('0x1f')](function(_0x1250b6){return _0x1250b6;});}return null;};}function removeEntity(_0x4f4088,_0x1c731e){return function(_0x51a033){if(_0x51a033){return _0x51a033[_0x87ce('0x20')]()[_0x87ce('0x1f')](function(){_0x4f4088[_0x87ce('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e71cf,_0x430dd8){return function(_0x4b49a1){if(!_0x4b49a1){_0x3e71cf[_0x87ce('0x21')](0x194);}return _0x4b49a1;};}function handleError(_0x5916ed,_0x5de669){_0x5de669=_0x5de669||0x1f4;return function(_0x103018){logger['error'](_0x103018['stack']);if(_0x103018[_0x87ce('0x22')]){delete _0x103018[_0x87ce('0x22')];}_0x5916ed[_0x87ce('0x16')](_0x5de669)['send'](_0x103018);};}exports[_0x87ce('0x23')]=function(_0x1b68d6,_0x8426ba){var _0x18754a={},_0x1f8a98={},_0x4055c8={'count':0x0,'rows':[]};var _0x25c2a2=_[_0x87ce('0x24')](db[_0x87ce('0x25')]['rawAttributes'],function(_0x4f452d){return{'name':_0x4f452d[_0x87ce('0x26')],'type':_0x4f452d[_0x87ce('0x27')]['key']};});_0x1f8a98[_0x87ce('0x28')]=_[_0x87ce('0x24')](_0x25c2a2,_0x87ce('0x22'));_0x1f8a98[_0x87ce('0x29')]=_['keys'](_0x1b68d6[_0x87ce('0x29')]);_0x1f8a98[_0x87ce('0x2a')]=_[_0x87ce('0x2b')](_0x1f8a98[_0x87ce('0x28')],_0x1f8a98[_0x87ce('0x29')]);_0x18754a[_0x87ce('0x2c')]=_[_0x87ce('0x2b')](_0x1f8a98[_0x87ce('0x28')],qs['fields'](_0x1b68d6[_0x87ce('0x29')][_0x87ce('0x2d')]));_0x18754a['attributes']=_0x18754a[_0x87ce('0x2c')][_0x87ce('0x2e')]?_0x18754a[_0x87ce('0x2c')]:_0x1f8a98[_0x87ce('0x28')];if(!_0x1b68d6['query'][_0x87ce('0x2f')](_0x87ce('0x30'))){_0x18754a[_0x87ce('0x1a')]=qs['limit'](_0x1b68d6[_0x87ce('0x29')]['limit']);_0x18754a[_0x87ce('0x19')]=qs[_0x87ce('0x19')](_0x1b68d6[_0x87ce('0x29')]['offset']);}_0x18754a[_0x87ce('0x31')]=qs[_0x87ce('0x32')](_0x1b68d6[_0x87ce('0x29')][_0x87ce('0x32')]);_0x18754a[_0x87ce('0x33')]=qs[_0x87ce('0x2a')](_['pick'](_0x1b68d6[_0x87ce('0x29')],_0x1f8a98[_0x87ce('0x2a')]),_0x25c2a2);if(_0x1b68d6[_0x87ce('0x29')]['filter']){_0x18754a[_0x87ce('0x33')]=_[_0x87ce('0x34')](_0x18754a[_0x87ce('0x33')],{'$or':_[_0x87ce('0x24')](_0x25c2a2,function(_0x443110){if(_0x443110[_0x87ce('0x27')]!==_0x87ce('0x35')){var _0x215975={};_0x215975[_0x443110['name']]={'$like':'%'+_0x1b68d6[_0x87ce('0x29')]['filter']+'%'};return _0x215975;}})});}_0x18754a=_['merge']({},_0x18754a,_0x1b68d6[_0x87ce('0x36')]);var _0x1e894e={'where':_0x18754a[_0x87ce('0x33')]};return db[_0x87ce('0x25')]['count'](_0x1e894e)['then'](function(_0x4a071d){_0x4055c8[_0x87ce('0x18')]=_0x4a071d;if(_0x1b68d6[_0x87ce('0x29')][_0x87ce('0x37')]){_0x18754a['include']=[{'all':!![]}];}return db[_0x87ce('0x25')]['findAll'](_0x18754a);})[_0x87ce('0x1f')](function(_0x5a4c9b){_0x4055c8[_0x87ce('0x38')]=_0x5a4c9b;return _0x4055c8;})['then'](respondWithFilteredResult(_0x8426ba,_0x18754a))[_0x87ce('0x39')](handleError(_0x8426ba,null));};exports['show']=function(_0x2b4ca7,_0x90b393){var _0x2f85c1={'raw':!![],'where':{'id':_0x2b4ca7['params']['id']}},_0x5a38c3={};_0x5a38c3[_0x87ce('0x28')]=_[_0x87ce('0x3a')](db['SquareDetailsReport'][_0x87ce('0x3b')]);_0x5a38c3[_0x87ce('0x29')]=_['keys'](_0x2b4ca7[_0x87ce('0x29')]);_0x5a38c3[_0x87ce('0x2a')]=_['intersection'](_0x5a38c3[_0x87ce('0x28')],_0x5a38c3[_0x87ce('0x29')]);_0x2f85c1[_0x87ce('0x2c')]=_[_0x87ce('0x2b')](_0x5a38c3[_0x87ce('0x28')],qs[_0x87ce('0x2d')](_0x2b4ca7[_0x87ce('0x29')][_0x87ce('0x2d')]));_0x2f85c1['attributes']=_0x2f85c1[_0x87ce('0x2c')][_0x87ce('0x2e')]?_0x2f85c1[_0x87ce('0x2c')]:_0x5a38c3[_0x87ce('0x28')];if(_0x2b4ca7[_0x87ce('0x29')][_0x87ce('0x37')]){_0x2f85c1[_0x87ce('0x3c')]=[{'all':!![]}];}_0x2f85c1=_['merge']({},_0x2f85c1,_0x2b4ca7[_0x87ce('0x36')]);return db[_0x87ce('0x25')][_0x87ce('0x3d')](_0x2f85c1)[_0x87ce('0x1f')](handleEntityNotFound(_0x90b393,null))['then'](respondWithResult(_0x90b393,null))[_0x87ce('0x39')](handleError(_0x90b393,null));};exports['create']=function(_0x5447aa,_0x291201){return db[_0x87ce('0x25')][_0x87ce('0x3e')](_0x5447aa[_0x87ce('0x3f')],{})[_0x87ce('0x1f')](respondWithResult(_0x291201,0xc9))[_0x87ce('0x39')](handleError(_0x291201,null));};exports['update']=function(_0xf7e9e4,_0x5f11f3){if(_0xf7e9e4['body']['id']){delete _0xf7e9e4[_0x87ce('0x3f')]['id'];}return db[_0x87ce('0x25')]['find']({'where':{'id':_0xf7e9e4[_0x87ce('0x40')]['id']}})[_0x87ce('0x1f')](handleEntityNotFound(_0x5f11f3,null))[_0x87ce('0x1f')](saveUpdates(_0xf7e9e4['body'],null))[_0x87ce('0x1f')](respondWithResult(_0x5f11f3,null))[_0x87ce('0x39')](handleError(_0x5f11f3,null));};exports[_0x87ce('0x20')]=function(_0x56cfd7,_0x2b5530){return db['SquareDetailsReport']['find']({'where':{'id':_0x56cfd7[_0x87ce('0x40')]['id']}})[_0x87ce('0x1f')](handleEntityNotFound(_0x2b5530,null))[_0x87ce('0x1f')](removeEntity(_0x2b5530,null))['catch'](handleError(_0x2b5530,null));};exports[_0x87ce('0x41')]=function(_0x219a97,_0x3e3989){return db[_0x87ce('0x25')]['describe']()[_0x87ce('0x1f')](respondWithResult(_0x3e3989,null))[_0x87ce('0x39')](handleError(_0x3e3989,null));}; \ No newline at end of file +var _0xf2e3=['describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','SquareDetailsReport','findAll','rows','params','includeAll','find','catch','create','body'];(function(_0x365abc,_0x15dc0f){var _0x58c8ca=function(_0x4d720d){while(--_0x4d720d){_0x365abc['push'](_0x365abc['shift']());}};_0x58c8ca(++_0x15dc0f);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xf2e3[_0x2070da];return _0x4f9fe1;};'use strict';var pdf=require(_0x3f2e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f2e('0x1'));var zipdir=require(_0x3f2e('0x2'));var jsonpatch=require(_0x3f2e('0x3'));var rp=require(_0x3f2e('0x4'));var moment=require(_0x3f2e('0x5'));var BPromise=require(_0x3f2e('0x6'));var Mustache=require(_0x3f2e('0x7'));var util=require(_0x3f2e('0x8'));var path=require(_0x3f2e('0x9'));var sox=require('sox');var csv=require(_0x3f2e('0xa'));var ejs=require(_0x3f2e('0xb'));var fs=require('fs');var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0xa'));var querystring=require(_0x3f2e('0x11'));var Papa=require(_0x3f2e('0x12'));var Redis=require(_0x3f2e('0x13'));var authService=require(_0x3f2e('0x14'));var qs=require(_0x3f2e('0x15'));var as=require(_0x3f2e('0x16'));var hardwareService=require(_0x3f2e('0x17'));var logger=require(_0x3f2e('0x18'))(_0x3f2e('0x19'));var utils=require(_0x3f2e('0x1a'));var config=require(_0x3f2e('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1c'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1d')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9)[_0x3f2e('0x1f')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1e')](_0x57cba7)[_0x3f2e('0x20')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=_0x218b44[_0x3f2e('0x21')],_0x2c4feb=_0x43f69e[_0x3f2e('0x22')],_0x1dc5d0=_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x23')],_0x2fef73;if(_0x1dc5d0>=_0x17ef58){_0x1dc5d0=_0x17ef58;_0x2fef73=0xc8;}else{_0x2fef73=0xce;}_0x4f2e38[_0x3f2e('0x1e')](_0x2fef73);return _0x4f2e38['set'](_0x3f2e('0x24'),_0x2c4feb+'-'+_0x1dc5d0+'/'+_0x17ef58)[_0x3f2e('0x20')](_0x218b44);}return null;};}function patchUpdates(_0x38925f){return function(_0xbe899c){try{jsonpatch[_0x3f2e('0x25')](_0xbe899c,_0x38925f,!![]);}catch(_0x4eb1e7){return BPromise['reject'](_0x4eb1e7);}return _0xbe899c[_0x3f2e('0x26')]();};}function saveUpdates(_0x11f84c,_0x38bbae){return function(_0x2ac500){if(_0x2ac500){return _0x2ac500[_0x3f2e('0x27')](_0x11f84c)[_0x3f2e('0x28')](function(_0x552443){return _0x552443;});}return null;};}function removeEntity(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['destroy']()['then'](function(){_0x5a7047[_0x3f2e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8c67,_0x401ed9){return function(_0x515e32){if(!_0x515e32){_0x1b8c67['sendStatus'](0x194);}return _0x515e32;};}function handleError(_0x52803d,_0x265bf1){_0x265bf1=_0x265bf1||0x1f4;return function(_0x3d7631){logger['error'](_0x3d7631[_0x3f2e('0x29')]);if(_0x3d7631['name']){delete _0x3d7631[_0x3f2e('0x2a')];}_0x52803d['status'](_0x265bf1)[_0x3f2e('0x2b')](_0x3d7631);};}exports[_0x3f2e('0x2c')]=function(_0x12926e,_0x9c6c34){var _0x11bad1={},_0x4799d3={},_0x426d68={'count':0x0,'rows':[]};var _0x28ef64=_['map'](db['SquareDetailsReport'][_0x3f2e('0x2d')],function(_0x1e5db4){return{'name':_0x1e5db4[_0x3f2e('0x2e')],'type':_0x1e5db4[_0x3f2e('0x2f')]['key']};});_0x4799d3[_0x3f2e('0x30')]=_[_0x3f2e('0x31')](_0x28ef64,_0x3f2e('0x2a'));_0x4799d3['query']=_[_0x3f2e('0x32')](_0x12926e[_0x3f2e('0x33')]);_0x4799d3[_0x3f2e('0x34')]=_['intersection'](_0x4799d3[_0x3f2e('0x30')],_0x4799d3[_0x3f2e('0x33')]);_0x11bad1[_0x3f2e('0x35')]=_[_0x3f2e('0x36')](_0x4799d3[_0x3f2e('0x30')],qs[_0x3f2e('0x37')](_0x12926e['query'][_0x3f2e('0x37')]));_0x11bad1[_0x3f2e('0x35')]=_0x11bad1[_0x3f2e('0x35')][_0x3f2e('0x38')]?_0x11bad1[_0x3f2e('0x35')]:_0x4799d3[_0x3f2e('0x30')];if(!_0x12926e[_0x3f2e('0x33')]['hasOwnProperty'](_0x3f2e('0x39'))){_0x11bad1[_0x3f2e('0x23')]=qs[_0x3f2e('0x23')](_0x12926e[_0x3f2e('0x33')]['limit']);_0x11bad1['offset']=qs[_0x3f2e('0x22')](_0x12926e[_0x3f2e('0x33')][_0x3f2e('0x22')]);}_0x11bad1[_0x3f2e('0x3a')]=qs[_0x3f2e('0x3b')](_0x12926e[_0x3f2e('0x33')][_0x3f2e('0x3b')]);_0x11bad1[_0x3f2e('0x3c')]=qs[_0x3f2e('0x34')](_[_0x3f2e('0x3d')](_0x12926e['query'],_0x4799d3[_0x3f2e('0x34')]),_0x28ef64);if(_0x12926e[_0x3f2e('0x33')][_0x3f2e('0x3e')]){_0x11bad1[_0x3f2e('0x3c')]=_['merge'](_0x11bad1[_0x3f2e('0x3c')],{'$or':_[_0x3f2e('0x31')](_0x28ef64,function(_0x3f41af){if(_0x3f41af[_0x3f2e('0x2f')]!==_0x3f2e('0x3f')){var _0x69f940={};_0x69f940[_0x3f41af[_0x3f2e('0x2a')]]={'$like':'%'+_0x12926e[_0x3f2e('0x33')]['filter']+'%'};return _0x69f940;}})});}_0x11bad1=_[_0x3f2e('0x40')]({},_0x11bad1,_0x12926e[_0x3f2e('0x41')]);var _0x238b6b={'where':_0x11bad1[_0x3f2e('0x3c')]};return db['SquareDetailsReport'][_0x3f2e('0x21')](_0x238b6b)[_0x3f2e('0x28')](function(_0x4cb56b){_0x426d68[_0x3f2e('0x21')]=_0x4cb56b;if(_0x12926e[_0x3f2e('0x33')]['includeAll']){_0x11bad1[_0x3f2e('0x42')]=[{'all':!![]}];}return db[_0x3f2e('0x43')][_0x3f2e('0x44')](_0x11bad1);})[_0x3f2e('0x28')](function(_0x59e383){_0x426d68[_0x3f2e('0x45')]=_0x59e383;return _0x426d68;})[_0x3f2e('0x28')](respondWithFilteredResult(_0x9c6c34,_0x11bad1))['catch'](handleError(_0x9c6c34,null));};exports['show']=function(_0x2be69f,_0x23de01){var _0xe67d03={'raw':!![],'where':{'id':_0x2be69f[_0x3f2e('0x46')]['id']}},_0x5b5dc2={};_0x5b5dc2[_0x3f2e('0x30')]=_[_0x3f2e('0x32')](db[_0x3f2e('0x43')][_0x3f2e('0x2d')]);_0x5b5dc2[_0x3f2e('0x33')]=_[_0x3f2e('0x32')](_0x2be69f[_0x3f2e('0x33')]);_0x5b5dc2[_0x3f2e('0x34')]=_[_0x3f2e('0x36')](_0x5b5dc2['model'],_0x5b5dc2['query']);_0xe67d03[_0x3f2e('0x35')]=_[_0x3f2e('0x36')](_0x5b5dc2['model'],qs['fields'](_0x2be69f[_0x3f2e('0x33')][_0x3f2e('0x37')]));_0xe67d03[_0x3f2e('0x35')]=_0xe67d03['attributes'][_0x3f2e('0x38')]?_0xe67d03[_0x3f2e('0x35')]:_0x5b5dc2[_0x3f2e('0x30')];if(_0x2be69f['query'][_0x3f2e('0x47')]){_0xe67d03[_0x3f2e('0x42')]=[{'all':!![]}];}_0xe67d03=_[_0x3f2e('0x40')]({},_0xe67d03,_0x2be69f['options']);return db[_0x3f2e('0x43')][_0x3f2e('0x48')](_0xe67d03)[_0x3f2e('0x28')](handleEntityNotFound(_0x23de01,null))['then'](respondWithResult(_0x23de01,null))[_0x3f2e('0x49')](handleError(_0x23de01,null));};exports['create']=function(_0x3dc995,_0x538a4f){return db['SquareDetailsReport'][_0x3f2e('0x4a')](_0x3dc995[_0x3f2e('0x4b')],{})[_0x3f2e('0x28')](respondWithResult(_0x538a4f,0xc9))[_0x3f2e('0x49')](handleError(_0x538a4f,null));};exports[_0x3f2e('0x27')]=function(_0x5c9cda,_0x5e2abd){if(_0x5c9cda[_0x3f2e('0x4b')]['id']){delete _0x5c9cda[_0x3f2e('0x4b')]['id'];}return db[_0x3f2e('0x43')][_0x3f2e('0x48')]({'where':{'id':_0x5c9cda[_0x3f2e('0x46')]['id']}})[_0x3f2e('0x28')](handleEntityNotFound(_0x5e2abd,null))[_0x3f2e('0x28')](saveUpdates(_0x5c9cda[_0x3f2e('0x4b')],null))[_0x3f2e('0x28')](respondWithResult(_0x5e2abd,null))['catch'](handleError(_0x5e2abd,null));};exports['destroy']=function(_0x2fe0c3,_0x5bdea1){return db[_0x3f2e('0x43')][_0x3f2e('0x48')]({'where':{'id':_0x2fe0c3[_0x3f2e('0x46')]['id']}})[_0x3f2e('0x28')](handleEntityNotFound(_0x5bdea1,null))['then'](removeEntity(_0x5bdea1,null))[_0x3f2e('0x49')](handleError(_0x5bdea1,null));};exports['describe']=function(_0x1ec348,_0x7ed57d){return db['SquareDetailsReport'][_0x3f2e('0x4c')]()['then'](respondWithResult(_0x7ed57d,null))[_0x3f2e('0x49')](handleError(_0x7ed57d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 202a781..4675075 100644 --- a/server/api/squareReportDetail/squareReportDetail.model.js +++ b/server/api/squareReportDetail/squareReportDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba0e=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x46d39e,_0x5b6735){var _0x226283=function(_0x103ce7){while(--_0x103ce7){_0x46d39e['push'](_0x46d39e['shift']());}};_0x226283(++_0x5b6735);}(_0xba0e,0x1b2));var _0xeba0=function(_0x4b9f08,_0x2d637d){_0x4b9f08=_0x4b9f08-0x0;var _0x50835a=_0xba0e[_0x4b9f08];return _0x50835a;};'use strict';var _=require(_0xeba0('0x0'));var util=require('util');var logger=require(_0xeba0('0x1'))(_0xeba0('0x2'));var moment=require(_0xeba0('0x3'));var BPromise=require(_0xeba0('0x4'));var rp=require(_0xeba0('0x5'));var fs=require('fs');var path=require(_0xeba0('0x6'));var rimraf=require(_0xeba0('0x7'));var config=require('../../config/environment');var attributes=require(_0xeba0('0x8'));module[_0xeba0('0x9')]=function(_0x43deeb,_0x60153c){return _0x43deeb[_0xeba0('0xa')](_0xeba0('0xb'),attributes,{'tableName':_0xeba0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cbc=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','lodash'];(function(_0x2f7190,_0x12aa73){var _0x1d2f75=function(_0x524256){while(--_0x524256){_0x2f7190['push'](_0x2f7190['shift']());}};_0x1d2f75(++_0x12aa73);}(_0x7cbc,0xa4));var _0xc7cb=function(_0x205899,_0x3794c8){_0x205899=_0x205899-0x0;var _0x17c5a7=_0x7cbc[_0x205899];return _0x17c5a7;};'use strict';var _=require(_0xc7cb('0x0'));var util=require(_0xc7cb('0x1'));var logger=require(_0xc7cb('0x2'))(_0xc7cb('0x3'));var moment=require('moment');var BPromise=require(_0xc7cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7cb('0x5'));var rimraf=require(_0xc7cb('0x6'));var config=require(_0xc7cb('0x7'));var attributes=require(_0xc7cb('0x8'));module['exports']=function(_0x3819a3,_0x5c0dae){return _0x3819a3[_0xc7cb('0x9')](_0xc7cb('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 24164a1..787ec35 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1910=['jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','create','body','raw','CreateSquareDetailsReport','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3980dd,_0x541085){var _0x26f462=function(_0x341b79){while(--_0x341b79){_0x3980dd['push'](_0x3980dd['shift']());}};_0x26f462(++_0x541085);}(_0x1910,0x95));var _0x0191=function(_0x48b217,_0x39bec9){_0x48b217=_0x48b217-0x0;var _0x219a7a=_0x1910[_0x48b217];return _0x219a7a;};'use strict';var _=require(_0x0191('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0191('0x1'));var rs=require(_0x0191('0x2'));var fs=require('fs');var Redis=require(_0x0191('0x3'));var db=require(_0x0191('0x4'))['db'];var utils=require(_0x0191('0x5'));var logger=require(_0x0191('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0191('0x7'));var client=jayson[_0x0191('0x8')][_0x0191('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f02ac,_0x6acafd,_0x58755d){return new BPromise(function(_0x263676,_0x3c0cc6){return client[_0x0191('0xa')](_0x4f02ac,_0x58755d)[_0x0191('0xb')](function(_0x278ab5){logger[_0x0191('0xc')](_0x0191('0xd'),_0x6acafd,_0x0191('0xe'));logger[_0x0191('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x6acafd,_0x0191('0xe'),JSON[_0x0191('0x10')](_0x278ab5));if(_0x278ab5[_0x0191('0x11')]){if(_0x278ab5[_0x0191('0x11')][_0x0191('0x12')]===0x1f4){logger[_0x0191('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x6acafd,_0x278ab5['error'][_0x0191('0x13')]);return _0x3c0cc6(_0x278ab5[_0x0191('0x11')][_0x0191('0x13')]);}logger[_0x0191('0x11')](_0x0191('0xd'),_0x6acafd,_0x278ab5[_0x0191('0x11')][_0x0191('0x13')]);return _0x263676(_0x278ab5['error'][_0x0191('0x13')]);}else{logger[_0x0191('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x6acafd,_0x0191('0xe'));_0x263676(_0x278ab5[_0x0191('0x14')][_0x0191('0x13')]);}})['catch'](function(_0x389638){logger[_0x0191('0x11')](_0x0191('0xd'),_0x6acafd,_0x389638);_0x3c0cc6(_0x389638);});});}exports['CreateSquareDetailsReport']=function(_0x11da0a){var _0x1823e2=this;return new Promise(function(_0x5cefdd,_0x4b3fe5){return db['SquareDetailsReport'][_0x0191('0x15')](_0x11da0a[_0x0191('0x16')],{'raw':_0x11da0a['options']?_0x11da0a['options'][_0x0191('0x17')]===undefined?!![]:![]:!![]})[_0x0191('0xb')](function(_0x87d88d){logger[_0x0191('0xc')](_0x0191('0x18'),_0x11da0a);logger[_0x0191('0xf')]('CreateSquareDetailsReport',_0x11da0a,JSON['stringify'](_0x87d88d));_0x5cefdd(_0x87d88d);})[_0x0191('0x19')](function(_0x65e5b){logger[_0x0191('0x11')]('CreateSquareDetailsReport',_0x65e5b[_0x0191('0x13')],_0x11da0a);_0x4b3fe5(_0x1823e2['error'](0x1f4,_0x65e5b[_0x0191('0x13')]));});});}; \ No newline at end of file +var _0x5677=['stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','info','catch','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4936fb,_0x10fda9){var _0x4430ab=function(_0xd722c3){while(--_0xd722c3){_0x4936fb['push'](_0x4936fb['shift']());}};_0x4430ab(++_0x10fda9);}(_0x5677,0x6c));var _0x7567=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x5677[_0x3fe042];return _0x7d4a1f;};'use strict';var _=require(_0x7567('0x0'));var util=require(_0x7567('0x1'));var moment=require('moment');var BPromise=require(_0x7567('0x2'));var rs=require(_0x7567('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7567('0x4'))('rpc');var config=require(_0x7567('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9b007d,_0x16e692,_0x36a7d4){return new BPromise(function(_0x6cdb88,_0x1b5605){return client[_0x7567('0x6')](_0x9b007d,_0x36a7d4)[_0x7567('0x7')](function(_0x293742){logger['info'](_0x7567('0x8'),_0x16e692,'request\x20sent');logger[_0x7567('0x9')](_0x7567('0xa'),_0x16e692,_0x7567('0xb'),JSON[_0x7567('0xc')](_0x293742));if(_0x293742[_0x7567('0xd')]){if(_0x293742[_0x7567('0xd')][_0x7567('0xe')]===0x1f4){logger[_0x7567('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x16e692,_0x293742[_0x7567('0xd')][_0x7567('0xf')]);return _0x1b5605(_0x293742[_0x7567('0xd')][_0x7567('0xf')]);}logger[_0x7567('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x16e692,_0x293742[_0x7567('0xd')][_0x7567('0xf')]);return _0x6cdb88(_0x293742['error'][_0x7567('0xf')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x16e692,'request\x20sent');_0x6cdb88(_0x293742[_0x7567('0x10')][_0x7567('0xf')]);}})['catch'](function(_0x102d28){logger['error'](_0x7567('0x8'),_0x16e692,_0x102d28);_0x1b5605(_0x102d28);});});}exports[_0x7567('0x11')]=function(_0x50e159){var _0x492b7c=this;return new Promise(function(_0x999d09,_0x1cc8cf){return db[_0x7567('0x12')][_0x7567('0x13')](_0x50e159[_0x7567('0x14')],{'raw':_0x50e159[_0x7567('0x15')]?_0x50e159['options']['raw']===undefined?!![]:![]:!![]})[_0x7567('0x7')](function(_0x2d0d58){logger[_0x7567('0x16')](_0x7567('0x11'),_0x50e159);logger[_0x7567('0x9')](_0x7567('0x11'),_0x50e159,JSON[_0x7567('0xc')](_0x2d0d58));_0x999d09(_0x2d0d58);})[_0x7567('0x17')](function(_0xd20fd4){logger[_0x7567('0xd')]('CreateSquareDetailsReport',_0xd20fd4[_0x7567('0xf')],_0x50e159);_0x1cc8cf(_0x492b7c[_0x7567('0xd')](0x1f4,_0xd20fd4[_0x7567('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e70437a..3a4b9ea 100644 --- a/server/api/system/index.js +++ b/server/api/system/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6c5=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6c5,0x64));var _0x5e6c=function(_0x4588d8,_0x330b7f){_0x4588d8=_0x4588d8-0x0;var _0x3cfa9f=_0xe6c5[_0x4588d8];return _0x3cfa9f;};'use strict';var express=require(_0x5e6c('0x0'));var router=express[_0x5e6c('0x1')]();var auth=require(_0x5e6c('0x2'));var controller=require(_0x5e6c('0x3'));router[_0x5e6c('0x4')]('/',auth[_0x5e6c('0x5')](),controller[_0x5e6c('0x6')]);router[_0x5e6c('0x4')](_0x5e6c('0x7'),auth[_0x5e6c('0x5')](),controller[_0x5e6c('0x8')]);module[_0x5e6c('0x9')]=router; \ No newline at end of file +var _0xd626=['index','/process/:pid/kill','isAuthenticated','exports','./system.controller'];(function(_0x5efa49,_0x177a05){var _0x4287fc=function(_0x131bd7){while(--_0x131bd7){_0x5efa49['push'](_0x5efa49['shift']());}};_0x4287fc(++_0x177a05);}(_0xd626,0x1a8));var _0x6d62=function(_0x2328a7,_0x3c1e62){_0x2328a7=_0x2328a7-0x0;var _0x17ef7a=_0xd626[_0x2328a7];return _0x17ef7a;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x6d62('0x0'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d62('0x1')]);router['get'](_0x6d62('0x2'),auth[_0x6d62('0x3')](),controller['killProcess']);module[_0x6d62('0x4')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 29a4ad7..307ef3c 100644 --- a/server/api/system/system.controller.js +++ b/server/api/system/system.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa014=['format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','util','bluebird','lodash','inspect','name','index','getAllData','then','status','json','catch','killProcess','components/import/cm'];(function(_0x75fe72,_0x465abb){var _0xc8dafe=function(_0x1e75b3){while(--_0x1e75b3){_0x75fe72['push'](_0x75fe72['shift']());}};_0xc8dafe(++_0x465abb);}(_0xa014,0xeb));var _0x4a01=function(_0x333f36,_0x19d843){_0x333f36=_0x333f36-0x0;var _0x5a2f0f=_0xa014[_0x333f36];return _0x5a2f0f;};'use strict';var info=require(_0x4a01('0x0'));var exec=require(_0x4a01('0x1'))['exec'];var logger=require('../../config/logger')('api');var util=require(_0x4a01('0x2'));var BPromise=require(_0x4a01('0x3'));var _=require(_0x4a01('0x4'));function handleError(_0x5e45ff,_0x41b7dc,_0x374996){_0x41b7dc=_0x41b7dc||0x1f4;return function(_0x4525f9){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x374996,_0x41b7dc,util[_0x4a01('0x5')](_0x4525f9,{'showHidden':![],'depth':null}));delete _0x4525f9[_0x4a01('0x6')];_0x5e45ff['status'](_0x41b7dc)['send'](_0x4525f9);};}exports[_0x4a01('0x7')]=function(_0x463ca4,_0x4bd767){return info[_0x4a01('0x8')]()[_0x4a01('0x9')](function(_0x54ca89){return _0x4bd767[_0x4a01('0xa')](0xc8)[_0x4a01('0xb')](_0x54ca89);})[_0x4a01('0xc')](function(_0x2a055e){return _0x4bd767[_0x4a01('0xa')](0x1f4)[_0x4a01('0xb')](_0x2a055e);});};exports[_0x4a01('0xd')]=function(_0x417d43,_0x1acdb7){var _0x50cdd8=[_0x4a01('0xe')];return new BPromise(function(_0x5d1ac9,_0x3d9fdf){return exec(util[_0x4a01('0xf')](_0x4a01('0x10'),_0x417d43[_0x4a01('0x11')][_0x4a01('0x12')]),function(_0x3a5d68,_0x5deba7,_0x4d15f4){if(_0x3a5d68){return _0x3d9fdf(_0x3a5d68);}return _0x5d1ac9(_0x5deba7);});})[_0x4a01('0x9')](function(_0x511d6e){var _0x17836b=![];var _0x102577=_0x511d6e[_0x4a01('0x13')](/\n/);for(var _0x508e26=0x0,_0x456cda=_0x50cdd8[_0x4a01('0x14')];_0x508e26<_0x456cda,_0x17836b===![];_0x508e26+=0x1){if(_0x511d6e[_0x4a01('0x15')](_0x50cdd8[_0x508e26])>=0x0){_0x17836b=!![];}}if(!_0x17836b){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x417d43[_0x4a01('0x11')][_0x4a01('0x12')]));}process[_0x4a01('0x16')](_0x417d43[_0x4a01('0x11')][_0x4a01('0x12')],_0x4a01('0x17'));return _0x1acdb7['status'](0xc8)['json']({'message':util['format'](_0x4a01('0x18'),_0x417d43[_0x4a01('0x11')][_0x4a01('0x12')])});})[_0x4a01('0xc')](handleError(_0x1acdb7,null,_0x4a01('0xd')));}; \ No newline at end of file +var _0x8784=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash'];(function(_0x4b8aaf,_0x7bd566){var _0x21589e=function(_0x2322a6){while(--_0x2322a6){_0x4b8aaf['push'](_0x4b8aaf['shift']());}};_0x21589e(++_0x7bd566);}(_0x8784,0x172));var _0x4878=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x8784[_0xf4666e];return _0x1853f1;};'use strict';var info=require(_0x4878('0x0'));var exec=require(_0x4878('0x1'))['exec'];var logger=require(_0x4878('0x2'))(_0x4878('0x3'));var util=require(_0x4878('0x4'));var BPromise=require(_0x4878('0x5'));var _=require(_0x4878('0x6'));function handleError(_0x55969c,_0x509521,_0x101d58){_0x509521=_0x509521||0x1f4;return function(_0x254097){logger[_0x4878('0x7')](_0x4878('0x8'),_0x101d58,_0x509521,util[_0x4878('0x9')](_0x254097,{'showHidden':![],'depth':null}));delete _0x254097[_0x4878('0xa')];_0x55969c[_0x4878('0xb')](_0x509521)[_0x4878('0xc')](_0x254097);};}exports[_0x4878('0xd')]=function(_0x5ea144,_0x10a0cf){return info[_0x4878('0xe')]()[_0x4878('0xf')](function(_0x2b28a8){return _0x10a0cf[_0x4878('0xb')](0xc8)[_0x4878('0x10')](_0x2b28a8);})[_0x4878('0x11')](function(_0xfcbf9e){return _0x10a0cf[_0x4878('0xb')](0x1f4)[_0x4878('0x10')](_0xfcbf9e);});};exports[_0x4878('0x12')]=function(_0x1d5f30,_0x4fdc75){var _0xa3b6c=[_0x4878('0x13')];return new BPromise(function(_0x188e81,_0x566468){return exec(util[_0x4878('0x14')](_0x4878('0x15'),_0x1d5f30['params'][_0x4878('0x16')]),function(_0x5e67cc,_0x4ec9f8,_0x1b9209){if(_0x5e67cc){return _0x566468(_0x5e67cc);}return _0x188e81(_0x4ec9f8);});})[_0x4878('0xf')](function(_0x2b7ccc){var _0x297b43=![];var _0x37a150=_0x2b7ccc['split'](/\n/);for(var _0x27ed83=0x0,_0x25282f=_0xa3b6c['length'];_0x27ed83<_0x25282f,_0x297b43===![];_0x27ed83+=0x1){if(_0x2b7ccc[_0x4878('0x17')](_0xa3b6c[_0x27ed83])>=0x0){_0x297b43=!![];}}if(!_0x297b43){throw new Error(util['format'](_0x4878('0x18'),_0x1d5f30['params']['pid']));}process[_0x4878('0x19')](_0x1d5f30[_0x4878('0x1a')][_0x4878('0x16')],_0x4878('0x1b'));return _0x4fdc75[_0x4878('0xb')](0xc8)['json']({'message':util[_0x4878('0x14')](_0x4878('0x1c'),_0x1d5f30[_0x4878('0x1a')][_0x4878('0x16')])});})[_0x4878('0x11')](handleError(_0x4fdc75,null,_0x4878('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d659e23..ded868a 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55e0=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55e0,0xdc));var _0x055e=function(_0x361a74,_0x10c457){_0x361a74=_0x361a74-0x0;var _0x275413=_0x55e0[_0x361a74];return _0x275413;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x055e('0x4'));var interaction=require(_0x055e('0x5'));var config=require(_0x055e('0x6'));var controller=require(_0x055e('0x7'));router[_0x055e('0x8')]('/',auth[_0x055e('0x9')](),controller['index']);router['get'](_0x055e('0xa'),auth['isAuthenticated'](),controller[_0x055e('0xb')]);router[_0x055e('0xc')]('/',auth[_0x055e('0x9')](),controller[_0x055e('0xd')]);router[_0x055e('0xe')]('/:id',auth[_0x055e('0x9')](),controller[_0x055e('0xf')]);router[_0x055e('0x10')](_0x055e('0xa'),auth[_0x055e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6f0d=['delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','post','put','update'];(function(_0xc28abb,_0x465bc9){var _0x335a2e=function(_0x121d5d){while(--_0x121d5d){_0xc28abb['push'](_0xc28abb['shift']());}};_0x335a2e(++_0x465bc9);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x171ec7,_0x3a0305){_0x171ec7=_0x171ec7-0x0;var _0x18ee70=_0x6f0d[_0x171ec7];return _0x18ee70;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var auth=require(_0xd6f0('0x4'));var interaction=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var controller=require(_0xd6f0('0x7'));router[_0xd6f0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6f0('0x9')]);router['get'](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd6f0('0xe')](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xf')]);router[_0xd6f0('0x10')]('/:id',auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x11')]);module[_0xd6f0('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 2db6fa9..a5fa4f2 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4024=['STRING','sequelize','exports','name'];(function(_0x448ff2,_0x3d226a){var _0x5456ee=function(_0x48ce35){while(--_0x48ce35){_0x448ff2['push'](_0x448ff2['shift']());}};_0x5456ee(++_0x3d226a);}(_0x4024,0x89));var _0x4402=function(_0x32aa29,_0x440937){_0x32aa29=_0x32aa29-0x0;var _0x32a670=_0x4024[_0x32aa29];return _0x32a670;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4402('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4402('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x4402('0x3')]}}; \ No newline at end of file +var _0x4024=['STRING','sequelize','exports','name'];(function(_0x410565,_0x3f1785){var _0x48f9be=function(_0x28e6ea){while(--_0x28e6ea){_0x410565['push'](_0x410565['shift']());}};_0x48f9be(++_0x3f1785);}(_0x4024,0x89));var _0x4402=function(_0x3ce0e2,_0x18661b){_0x3ce0e2=_0x3ce0e2-0x0;var _0x5dc8f3=_0x4024[_0x3ce0e2];return _0x5dc8f3;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4402('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4402('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x4402('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 7e0a791..e84af5e 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06d1=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','Content-Range','apply','save','update','then','destroy','get','Tags','sendStatus','error','name','index','map','Tag','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','offset','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x06d1,0x18c));var _0x106d=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x06d1[_0x17b6e3];return _0x3906f3;};'use strict';var pdf=require(_0x106d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x106d('0x1'));var zipdir=require(_0x106d('0x2'));var jsonpatch=require(_0x106d('0x3'));var rp=require(_0x106d('0x4'));var moment=require('moment');var BPromise=require(_0x106d('0x5'));var Mustache=require(_0x106d('0x6'));var util=require(_0x106d('0x7'));var path=require('path');var sox=require(_0x106d('0x8'));var csv=require(_0x106d('0x9'));var ejs=require(_0x106d('0xa'));var fs=require('fs');var _=require(_0x106d('0xb'));var squel=require(_0x106d('0xc'));var crypto=require(_0x106d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x106d('0xe'));var toCsv=require(_0x106d('0x9'));var querystring=require(_0x106d('0xf'));var Papa=require(_0x106d('0x10'));var Redis=require(_0x106d('0x11'));var authService=require(_0x106d('0x12'));var qs=require(_0x106d('0x13'));var as=require(_0x106d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x106d('0x15'));var config=require(_0x106d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x106d('0x17'))['db'];function respondWithStatusCode(_0x31d060,_0x5304d9){_0x5304d9=_0x5304d9||0xcc;return function(_0x257d11){if(_0x257d11){return _0x31d060['sendStatus'](_0x5304d9);}return _0x31d060[_0x106d('0x18')](_0x5304d9)[_0x106d('0x19')]();};}function respondWithResult(_0x5845ca,_0x5e2b1d){_0x5e2b1d=_0x5e2b1d||0xc8;return function(_0x28461c){if(_0x28461c){return _0x5845ca['status'](_0x5e2b1d)[_0x106d('0x1a')](_0x28461c);}};}function respondWithFilteredResult(_0x20a7bc,_0x3edb1a){return function(_0x47b820){if(_0x47b820){var _0x2d71e4=_0x47b820[_0x106d('0x1b')],_0x3ff63b=_0x3edb1a['offset'],_0x57ce14=_0x3edb1a['offset']+_0x3edb1a[_0x106d('0x1c')],_0x519dcf;if(_0x57ce14>=_0x2d71e4){_0x57ce14=_0x2d71e4;_0x519dcf=0xc8;}else{_0x519dcf=0xce;}_0x20a7bc[_0x106d('0x18')](_0x519dcf);return _0x20a7bc['set'](_0x106d('0x1d'),_0x3ff63b+'-'+_0x57ce14+'/'+_0x2d71e4)[_0x106d('0x1a')](_0x47b820);}return null;};}function patchUpdates(_0x22e0c6){return function(_0x3d63f0){try{jsonpatch[_0x106d('0x1e')](_0x3d63f0,_0x22e0c6,!![]);}catch(_0x2c497f){return BPromise['reject'](_0x2c497f);}return _0x3d63f0[_0x106d('0x1f')]();};}function saveUpdates(_0x4a674d,_0x3a1c24){return function(_0x230968){if(_0x230968){return _0x230968[_0x106d('0x20')](_0x4a674d)[_0x106d('0x21')](function(_0xce5be5){return _0xce5be5;});}return null;};}function removeEntity(_0x596524,_0x4d39f1){return function(_0x545d3e){if(_0x545d3e){return _0x545d3e[_0x106d('0x22')]()[_0x106d('0x21')](function(){var _0x597920=_0x545d3e[_0x106d('0x23')]({'plain':!![]});var _0x2b9553=_0x106d('0x24');return db['UserProfileResource'][_0x106d('0x22')]({'where':{'type':_0x2b9553,'resourceId':_0x597920['id']}})[_0x106d('0x21')](function(){return _0x545d3e;});})['then'](function(){_0x596524[_0x106d('0x18')](0xcc)[_0x106d('0x19')]();});}};}function handleEntityNotFound(_0x4e3e61,_0x9579c9){return function(_0x15250f){if(!_0x15250f){_0x4e3e61[_0x106d('0x25')](0x194);}return _0x15250f;};}function handleError(_0x388115,_0x376b76){_0x376b76=_0x376b76||0x1f4;return function(_0xe0ea68){logger[_0x106d('0x26')](_0xe0ea68['stack']);if(_0xe0ea68['name']){delete _0xe0ea68[_0x106d('0x27')];}_0x388115[_0x106d('0x18')](_0x376b76)['send'](_0xe0ea68);};}exports[_0x106d('0x28')]=function(_0x4675ff,_0x5917a1){var _0x407ad6={},_0xbe2a81={},_0x597427={'count':0x0,'rows':[]};var _0x521c4a=_[_0x106d('0x29')](db[_0x106d('0x2a')][_0x106d('0x2b')],function(_0x201e9d){return{'name':_0x201e9d['fieldName'],'type':_0x201e9d[_0x106d('0x2c')]['key']};});_0xbe2a81['model']=_[_0x106d('0x29')](_0x521c4a,_0x106d('0x27'));_0xbe2a81[_0x106d('0x2d')]=_[_0x106d('0x2e')](_0x4675ff[_0x106d('0x2d')]);_0xbe2a81[_0x106d('0x2f')]=_[_0x106d('0x30')](_0xbe2a81[_0x106d('0x31')],_0xbe2a81[_0x106d('0x2d')]);_0x407ad6[_0x106d('0x32')]=_[_0x106d('0x30')](_0xbe2a81[_0x106d('0x31')],qs[_0x106d('0x33')](_0x4675ff[_0x106d('0x2d')][_0x106d('0x33')]));_0x407ad6[_0x106d('0x32')]=_0x407ad6[_0x106d('0x32')][_0x106d('0x34')]?_0x407ad6[_0x106d('0x32')]:_0xbe2a81[_0x106d('0x31')];if(!_0x4675ff[_0x106d('0x2d')]['hasOwnProperty']('nolimit')){_0x407ad6['limit']=qs[_0x106d('0x1c')](_0x4675ff[_0x106d('0x2d')]['limit']);_0x407ad6[_0x106d('0x35')]=qs['offset'](_0x4675ff[_0x106d('0x2d')][_0x106d('0x35')]);}_0x407ad6[_0x106d('0x36')]=qs['sort'](_0x4675ff['query'][_0x106d('0x37')]);_0x407ad6[_0x106d('0x38')]=qs[_0x106d('0x2f')](_['pick'](_0x4675ff[_0x106d('0x2d')],_0xbe2a81[_0x106d('0x2f')]),_0x521c4a);if(_0x4675ff[_0x106d('0x2d')][_0x106d('0x39')]){_0x407ad6['where']=_['merge'](_0x407ad6[_0x106d('0x38')],{'$or':_['map'](_0x521c4a,function(_0x1e3a6b){if(_0x1e3a6b[_0x106d('0x2c')]!==_0x106d('0x3a')){var _0x56a472={};_0x56a472[_0x1e3a6b['name']]={'$like':'%'+_0x4675ff[_0x106d('0x2d')][_0x106d('0x39')]+'%'};return _0x56a472;}})});}_0x407ad6=_[_0x106d('0x3b')]({},_0x407ad6,_0x4675ff[_0x106d('0x3c')]);var _0x2e2611={'where':_0x407ad6['where']};return db[_0x106d('0x2a')][_0x106d('0x1b')](_0x2e2611)['then'](function(_0x9efaae){_0x597427[_0x106d('0x1b')]=_0x9efaae;if(_0x4675ff[_0x106d('0x2d')][_0x106d('0x3d')]){_0x407ad6[_0x106d('0x3e')]=[{'all':!![]}];}return db[_0x106d('0x2a')][_0x106d('0x3f')](_0x407ad6);})[_0x106d('0x21')](function(_0x18f6d9){_0x597427[_0x106d('0x40')]=_0x18f6d9;return _0x597427;})[_0x106d('0x21')](respondWithFilteredResult(_0x5917a1,_0x407ad6))[_0x106d('0x41')](handleError(_0x5917a1,null));};exports[_0x106d('0x42')]=function(_0x42cd25,_0x12f226){var _0x32ddf9={'raw':!![],'where':{'id':_0x42cd25[_0x106d('0x43')]['id']}},_0x3b61b2={};_0x3b61b2[_0x106d('0x31')]=_[_0x106d('0x2e')](db[_0x106d('0x2a')]['rawAttributes']);_0x3b61b2[_0x106d('0x2d')]=_[_0x106d('0x2e')](_0x42cd25['query']);_0x3b61b2[_0x106d('0x2f')]=_[_0x106d('0x30')](_0x3b61b2[_0x106d('0x31')],_0x3b61b2[_0x106d('0x2d')]);_0x32ddf9[_0x106d('0x32')]=_[_0x106d('0x30')](_0x3b61b2['model'],qs[_0x106d('0x33')](_0x42cd25['query'][_0x106d('0x33')]));_0x32ddf9[_0x106d('0x32')]=_0x32ddf9['attributes'][_0x106d('0x34')]?_0x32ddf9['attributes']:_0x3b61b2[_0x106d('0x31')];if(_0x42cd25[_0x106d('0x2d')]['includeAll']){_0x32ddf9[_0x106d('0x3e')]=[{'all':!![]}];}_0x32ddf9=_[_0x106d('0x3b')]({},_0x32ddf9,_0x42cd25[_0x106d('0x3c')]);return db[_0x106d('0x2a')][_0x106d('0x44')](_0x32ddf9)['then'](handleEntityNotFound(_0x12f226,null))[_0x106d('0x21')](respondWithResult(_0x12f226,null))[_0x106d('0x41')](handleError(_0x12f226,null));};exports[_0x106d('0x45')]=function(_0x66ce4a,_0x18ccca){return db[_0x106d('0x2a')][_0x106d('0x45')](_0x66ce4a['body'],{})[_0x106d('0x21')](function(_0x1de0e3){var _0x49257c=_0x66ce4a[_0x106d('0x46')][_0x106d('0x23')]({'plain':!![]});if(!_0x49257c)throw new Error(_0x106d('0x47'));if(_0x49257c[_0x106d('0x48')]==='user'){var _0x1abb7d=_0x1de0e3[_0x106d('0x23')]({'plain':!![]});var _0x316779=_0x106d('0x24');return db[_0x106d('0x49')][_0x106d('0x44')]({'where':{'name':_0x316779,'userProfileId':_0x49257c[_0x106d('0x4a')]},'raw':!![]})[_0x106d('0x21')](function(_0x3d2b03){if(_0x3d2b03&&_0x3d2b03[_0x106d('0x4b')]===0x0){return db[_0x106d('0x4c')]['create']({'name':_0x1abb7d['name'],'resourceId':_0x1abb7d['id'],'type':_0x3d2b03[_0x106d('0x27')],'sectionId':_0x3d2b03['id']},{})[_0x106d('0x21')](function(){return _0x1de0e3;});}else{return _0x1de0e3;}})[_0x106d('0x41')](function(_0x2ccbb9){logger[_0x106d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ccbb9);throw _0x2ccbb9;});}return _0x1de0e3;})[_0x106d('0x21')](respondWithResult(_0x18ccca,0xc9))[_0x106d('0x41')](handleError(_0x18ccca,null));};exports[_0x106d('0x20')]=function(_0x2f318b,_0x12e5a2){if(_0x2f318b[_0x106d('0x4d')]['id']){delete _0x2f318b['body']['id'];}return db[_0x106d('0x2a')]['find']({'where':{'id':_0x2f318b['params']['id']}})[_0x106d('0x21')](handleEntityNotFound(_0x12e5a2,null))[_0x106d('0x21')](saveUpdates(_0x2f318b['body'],null))[_0x106d('0x21')](respondWithResult(_0x12e5a2,null))[_0x106d('0x41')](handleError(_0x12e5a2,null));};exports[_0x106d('0x22')]=function(_0x563ca9,_0x105235){return db[_0x106d('0x2a')][_0x106d('0x44')]({'where':{'id':_0x563ca9[_0x106d('0x43')]['id']}})['then'](handleEntityNotFound(_0x105235,null))[_0x106d('0x21')](removeEntity(_0x105235,null))[_0x106d('0x41')](handleError(_0x105235,null));}; \ No newline at end of file +var _0x62cd=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','apply','reject','save','update','then','destroy','Tags','error','stack','name','send','index','Tag','rawAttributes','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4b3b41,_0x3bf24c){var _0x2000ae=function(_0x975acd){while(--_0x975acd){_0x4b3b41['push'](_0x4b3b41['shift']());}};_0x2000ae(++_0x3bf24c);}(_0x62cd,0x8c));var _0xd62c=function(_0x122315,_0x20a4f6){_0x122315=_0x122315-0x0;var _0x39cd5e=_0x62cd[_0x122315];return _0x39cd5e;};'use strict';var pdf=require(_0xd62c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd62c('0x1'));var zipdir=require(_0xd62c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd62c('0x3'));var BPromise=require(_0xd62c('0x4'));var Mustache=require(_0xd62c('0x5'));var util=require(_0xd62c('0x6'));var path=require('path');var sox=require(_0xd62c('0x7'));var csv=require('to-csv');var ejs=require(_0xd62c('0x8'));var fs=require('fs');var _=require(_0xd62c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd62c('0xa'));var deskjs=require(_0xd62c('0xb'));var toCsv=require(_0xd62c('0xc'));var querystring=require(_0xd62c('0xd'));var Papa=require(_0xd62c('0xe'));var Redis=require(_0xd62c('0xf'));var authService=require(_0xd62c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd62c('0x11'));var hardwareService=require(_0xd62c('0x12'));var logger=require(_0xd62c('0x13'))('api');var utils=require(_0xd62c('0x14'));var config=require(_0xd62c('0x15'));var licenseUtil=require(_0xd62c('0x16'));var db=require(_0xd62c('0x17'))['db'];function respondWithStatusCode(_0x340243,_0x376c12){_0x376c12=_0x376c12||0xcc;return function(_0x2ce20d){if(_0x2ce20d){return _0x340243[_0xd62c('0x18')](_0x376c12);}return _0x340243['status'](_0x376c12)[_0xd62c('0x19')]();};}function respondWithResult(_0x37c575,_0x572834){_0x572834=_0x572834||0xc8;return function(_0x424be1){if(_0x424be1){return _0x37c575[_0xd62c('0x1a')](_0x572834)['json'](_0x424be1);}};}function respondWithFilteredResult(_0x52f707,_0x221868){return function(_0x4c9efe){if(_0x4c9efe){var _0x5243d9=_0x4c9efe[_0xd62c('0x1b')],_0x5e42eb=_0x221868[_0xd62c('0x1c')],_0xf8b905=_0x221868[_0xd62c('0x1c')]+_0x221868[_0xd62c('0x1d')],_0x2c5ff4;if(_0xf8b905>=_0x5243d9){_0xf8b905=_0x5243d9;_0x2c5ff4=0xc8;}else{_0x2c5ff4=0xce;}_0x52f707[_0xd62c('0x1a')](_0x2c5ff4);return _0x52f707[_0xd62c('0x1e')]('Content-Range',_0x5e42eb+'-'+_0xf8b905+'/'+_0x5243d9)['json'](_0x4c9efe);}return null;};}function patchUpdates(_0x1a5208){return function(_0x5712bc){try{jsonpatch[_0xd62c('0x1f')](_0x5712bc,_0x1a5208,!![]);}catch(_0x9ff325){return BPromise[_0xd62c('0x20')](_0x9ff325);}return _0x5712bc[_0xd62c('0x21')]();};}function saveUpdates(_0x45eff5,_0xf986eb){return function(_0x46daa9){if(_0x46daa9){return _0x46daa9[_0xd62c('0x22')](_0x45eff5)[_0xd62c('0x23')](function(_0x51c67f){return _0x51c67f;});}return null;};}function removeEntity(_0x21b4f7,_0x10d8bf){return function(_0x1587ba){if(_0x1587ba){return _0x1587ba[_0xd62c('0x24')]()[_0xd62c('0x23')](function(){var _0x59a64e=_0x1587ba['get']({'plain':!![]});var _0x520f7b=_0xd62c('0x25');return db['UserProfileResource'][_0xd62c('0x24')]({'where':{'type':_0x520f7b,'resourceId':_0x59a64e['id']}})[_0xd62c('0x23')](function(){return _0x1587ba;});})[_0xd62c('0x23')](function(){_0x21b4f7[_0xd62c('0x1a')](0xcc)[_0xd62c('0x19')]();});}};}function handleEntityNotFound(_0x193d56,_0xcc11b4){return function(_0x3d4847){if(!_0x3d4847){_0x193d56[_0xd62c('0x18')](0x194);}return _0x3d4847;};}function handleError(_0xbe1459,_0x3c2894){_0x3c2894=_0x3c2894||0x1f4;return function(_0x2ad658){logger[_0xd62c('0x26')](_0x2ad658[_0xd62c('0x27')]);if(_0x2ad658[_0xd62c('0x28')]){delete _0x2ad658['name'];}_0xbe1459[_0xd62c('0x1a')](_0x3c2894)[_0xd62c('0x29')](_0x2ad658);};}exports[_0xd62c('0x2a')]=function(_0x11dcc2,_0x59109e){var _0x2e772e={},_0x12b77f={},_0x13a2de={'count':0x0,'rows':[]};var _0x37aa6a=_['map'](db[_0xd62c('0x2b')][_0xd62c('0x2c')],function(_0x213509){return{'name':_0x213509['fieldName'],'type':_0x213509['type'][_0xd62c('0x2d')]};});_0x12b77f['model']=_[_0xd62c('0x2e')](_0x37aa6a,_0xd62c('0x28'));_0x12b77f[_0xd62c('0x2f')]=_[_0xd62c('0x30')](_0x11dcc2['query']);_0x12b77f['filters']=_[_0xd62c('0x31')](_0x12b77f[_0xd62c('0x32')],_0x12b77f[_0xd62c('0x2f')]);_0x2e772e[_0xd62c('0x33')]=_[_0xd62c('0x31')](_0x12b77f['model'],qs['fields'](_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x34')]));_0x2e772e[_0xd62c('0x33')]=_0x2e772e[_0xd62c('0x33')][_0xd62c('0x35')]?_0x2e772e[_0xd62c('0x33')]:_0x12b77f[_0xd62c('0x32')];if(!_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x36')](_0xd62c('0x37'))){_0x2e772e['limit']=qs['limit'](_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x1d')]);_0x2e772e['offset']=qs[_0xd62c('0x1c')](_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x1c')]);}_0x2e772e[_0xd62c('0x38')]=qs[_0xd62c('0x39')](_0x11dcc2['query'][_0xd62c('0x39')]);_0x2e772e[_0xd62c('0x3a')]=qs[_0xd62c('0x3b')](_['pick'](_0x11dcc2[_0xd62c('0x2f')],_0x12b77f[_0xd62c('0x3b')]),_0x37aa6a);if(_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x3c')]){_0x2e772e['where']=_[_0xd62c('0x3d')](_0x2e772e[_0xd62c('0x3a')],{'$or':_['map'](_0x37aa6a,function(_0x138a0d){if(_0x138a0d[_0xd62c('0x3e')]!==_0xd62c('0x3f')){var _0x2703ec={};_0x2703ec[_0x138a0d['name']]={'$like':'%'+_0x11dcc2['query'][_0xd62c('0x3c')]+'%'};return _0x2703ec;}})});}_0x2e772e=_[_0xd62c('0x3d')]({},_0x2e772e,_0x11dcc2[_0xd62c('0x40')]);var _0x102102={'where':_0x2e772e[_0xd62c('0x3a')]};return db[_0xd62c('0x2b')][_0xd62c('0x1b')](_0x102102)['then'](function(_0x4e15de){_0x13a2de['count']=_0x4e15de;if(_0x11dcc2[_0xd62c('0x2f')]['includeAll']){_0x2e772e['include']=[{'all':!![]}];}return db[_0xd62c('0x2b')]['findAll'](_0x2e772e);})['then'](function(_0x467e75){_0x13a2de['rows']=_0x467e75;return _0x13a2de;})['then'](respondWithFilteredResult(_0x59109e,_0x2e772e))[_0xd62c('0x41')](handleError(_0x59109e,null));};exports[_0xd62c('0x42')]=function(_0x453fe5,_0x4b06ac){var _0x12ca77={'raw':!![],'where':{'id':_0x453fe5[_0xd62c('0x43')]['id']}},_0x26e91d={};_0x26e91d[_0xd62c('0x32')]=_[_0xd62c('0x30')](db['Tag']['rawAttributes']);_0x26e91d[_0xd62c('0x2f')]=_[_0xd62c('0x30')](_0x453fe5['query']);_0x26e91d['filters']=_[_0xd62c('0x31')](_0x26e91d[_0xd62c('0x32')],_0x26e91d[_0xd62c('0x2f')]);_0x12ca77['attributes']=_['intersection'](_0x26e91d['model'],qs['fields'](_0x453fe5[_0xd62c('0x2f')]['fields']));_0x12ca77[_0xd62c('0x33')]=_0x12ca77[_0xd62c('0x33')][_0xd62c('0x35')]?_0x12ca77[_0xd62c('0x33')]:_0x26e91d[_0xd62c('0x32')];if(_0x453fe5[_0xd62c('0x2f')][_0xd62c('0x44')]){_0x12ca77[_0xd62c('0x45')]=[{'all':!![]}];}_0x12ca77=_['merge']({},_0x12ca77,_0x453fe5[_0xd62c('0x40')]);return db[_0xd62c('0x2b')][_0xd62c('0x46')](_0x12ca77)[_0xd62c('0x23')](handleEntityNotFound(_0x4b06ac,null))['then'](respondWithResult(_0x4b06ac,null))[_0xd62c('0x41')](handleError(_0x4b06ac,null));};exports[_0xd62c('0x47')]=function(_0x55d5cb,_0x982b7a){return db[_0xd62c('0x2b')][_0xd62c('0x47')](_0x55d5cb[_0xd62c('0x48')],{})[_0xd62c('0x23')](function(_0x1a7538){var _0x3308a8=_0x55d5cb[_0xd62c('0x49')][_0xd62c('0x4a')]({'plain':!![]});if(!_0x3308a8)throw new Error(_0xd62c('0x4b'));if(_0x3308a8['role']===_0xd62c('0x49')){var _0x127864=_0x1a7538['get']({'plain':!![]});var _0x55f91e=_0xd62c('0x25');return db[_0xd62c('0x4c')][_0xd62c('0x46')]({'where':{'name':_0x55f91e,'userProfileId':_0x3308a8[_0xd62c('0x4d')]},'raw':!![]})[_0xd62c('0x23')](function(_0x72ec9c){if(_0x72ec9c&&_0x72ec9c[_0xd62c('0x4e')]===0x0){return db['UserProfileResource'][_0xd62c('0x47')]({'name':_0x127864[_0xd62c('0x28')],'resourceId':_0x127864['id'],'type':_0x72ec9c['name'],'sectionId':_0x72ec9c['id']},{})['then'](function(){return _0x1a7538;});}else{return _0x1a7538;}})[_0xd62c('0x41')](function(_0x35614a){logger[_0xd62c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35614a);throw _0x35614a;});}return _0x1a7538;})[_0xd62c('0x23')](respondWithResult(_0x982b7a,0xc9))[_0xd62c('0x41')](handleError(_0x982b7a,null));};exports[_0xd62c('0x22')]=function(_0xc3d7c9,_0x1ebf55){if(_0xc3d7c9[_0xd62c('0x48')]['id']){delete _0xc3d7c9[_0xd62c('0x48')]['id'];}return db['Tag'][_0xd62c('0x46')]({'where':{'id':_0xc3d7c9[_0xd62c('0x43')]['id']}})[_0xd62c('0x23')](handleEntityNotFound(_0x1ebf55,null))[_0xd62c('0x23')](saveUpdates(_0xc3d7c9[_0xd62c('0x48')],null))[_0xd62c('0x23')](respondWithResult(_0x1ebf55,null))['catch'](handleError(_0x1ebf55,null));};exports[_0xd62c('0x24')]=function(_0x570b62,_0x5e97cd){return db['Tag']['find']({'where':{'id':_0x570b62[_0xd62c('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e97cd,null))[_0xd62c('0x23')](removeEntity(_0x5e97cd,null))['catch'](handleError(_0x5e97cd,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 4aa834a..7e6dafc 100644 --- a/server/api/tag/tag.model.js +++ b/server/api/tag/tag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda27=['bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','define','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xda27,0x1cf));var _0x7da2=function(_0x1f0c2c,_0x2a597e){_0x1f0c2c=_0x1f0c2c-0x0;var _0x59c73f=_0xda27[_0x1f0c2c];return _0x59c73f;};'use strict';var _=require(_0x7da2('0x0'));var util=require(_0x7da2('0x1'));var logger=require(_0x7da2('0x2'))(_0x7da2('0x3'));var moment=require(_0x7da2('0x4'));var BPromise=require(_0x7da2('0x5'));var rp=require(_0x7da2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7da2('0x7'));var config=require(_0x7da2('0x8'));var attributes=require(_0x7da2('0x9'));module['exports']=function(_0x2f2ec8,_0x14babf){return _0x2f2ec8[_0x7da2('0xa')]('Tag',attributes,{'tableName':_0x7da2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbada=['api','rimraf','./tag.attributes','exports','define','Tag','lodash','util'];(function(_0x42a0c0,_0x374ca0){var _0x344726=function(_0x4d8051){while(--_0x4d8051){_0x42a0c0['push'](_0x42a0c0['shift']());}};_0x344726(++_0x374ca0);}(_0xbada,0x18e));var _0xabad=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xbada[_0x35da42];return _0x370035;};'use strict';var _=require(_0xabad('0x0'));var util=require(_0xabad('0x1'));var logger=require('../../config/logger')(_0xabad('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xabad('0x3'));var config=require('../../config/environment');var attributes=require(_0xabad('0x4'));module[_0xabad('0x5')]=function(_0x1aaf3,_0x204186){return _0x1aaf3[_0xabad('0x6')](_0xabad('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 69369b0..b5e2d7d 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bc6=['../../config/environment','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','lodash','util','moment','../../config/utils','rpc'];(function(_0x3818c0,_0x542521){var _0x55ec33=function(_0x2be9ea){while(--_0x2be9ea){_0x3818c0['push'](_0x3818c0['shift']());}};_0x55ec33(++_0x542521);}(_0x2bc6,0x163));var _0x62bc=function(_0x2c74ab,_0x4a4ebf){_0x2c74ab=_0x2c74ab-0x0;var _0x5245b1=_0x2bc6[_0x2c74ab];return _0x5245b1;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var moment=require(_0x62bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62bc('0x3'));var logger=require('../../config/logger')(_0x62bc('0x4'));var config=require(_0x62bc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x62bc('0x6')][_0x62bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40af10,_0x3f3dc9,_0x3ed6ad){return new BPromise(function(_0x3f625c,_0x5bedeb){return client[_0x62bc('0x8')](_0x40af10,_0x3ed6ad)[_0x62bc('0x9')](function(_0x1917e1){logger[_0x62bc('0xa')]('Tag,\x20%s,\x20%s',_0x3f3dc9,_0x62bc('0xb'));logger[_0x62bc('0xc')](_0x62bc('0xd'),_0x3f3dc9,'request\x20sent',JSON[_0x62bc('0xe')](_0x1917e1));if(_0x1917e1[_0x62bc('0xf')]){if(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x10')]===0x1f4){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')]['message']);return _0x5bedeb(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);}logger['error'](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);return _0x3f625c(_0x1917e1['error'][_0x62bc('0x12')]);}else{logger[_0x62bc('0xa')]('Tag,\x20%s,\x20%s',_0x3f3dc9,'request\x20sent');_0x3f625c(_0x1917e1[_0x62bc('0x13')][_0x62bc('0x12')]);}})['catch'](function(_0x278893){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x278893);_0x5bedeb(_0x278893);});});} \ No newline at end of file +var _0x76dc=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x3d0946,_0x51edd3){var _0x2599e6=function(_0x846cab){while(--_0x846cab){_0x3d0946['push'](_0x3d0946['shift']());}};_0x2599e6(++_0x51edd3);}(_0x76dc,0x1f2));var _0xc76d=function(_0x424b80,_0x4845b5){_0x424b80=_0x424b80-0x0;var _0xfe67ca=_0x76dc[_0x424b80];return _0xfe67ca;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76d('0x4'));var db=require(_0xc76d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc76d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc76d('0x7'));var client=jayson[_0xc76d('0x8')][_0xc76d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4832bd,_0x4ce0bd,_0x119f38){return new BPromise(function(_0x114572,_0x18574f){return client['request'](_0x4832bd,_0x119f38)['then'](function(_0x1dc996){logger[_0xc76d('0xa')]('Tag,\x20%s,\x20%s',_0x4ce0bd,_0xc76d('0xb'));logger['debug'](_0xc76d('0xc'),_0x4ce0bd,_0xc76d('0xb'),JSON[_0xc76d('0xd')](_0x1dc996));if(_0x1dc996[_0xc76d('0xe')]){if(_0x1dc996[_0xc76d('0xe')][_0xc76d('0xf')]===0x1f4){logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);return _0x18574f(_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);}logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996['error'][_0xc76d('0x11')]);return _0x114572(_0x1dc996[_0xc76d('0xe')]['message']);}else{logger[_0xc76d('0xa')](_0xc76d('0x10'),_0x4ce0bd,_0xc76d('0xb'));_0x114572(_0x1dc996[_0xc76d('0x12')]['message']);}})[_0xc76d('0x13')](function(_0x5d881c){logger['error'](_0xc76d('0x10'),_0x4ce0bd,_0x5d881c);_0x18574f(_0x5d881c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0eabf2d..0c01d3e 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97ec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','/:id/queues','getQueues','/:id/users','getAgents','create','addQueues','post','put','/:id','delete','destroy','removeQueues','removeAgents','exports','util','path','connect-timeout','express'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x97ec,0x134));var _0xc97e=function(_0x29b86a,_0x5b4e38){_0x29b86a=_0x29b86a-0x0;var _0x16f6a7=_0x97ec[_0x29b86a];return _0x16f6a7;};'use strict';var multer=require('multer');var util=require(_0xc97e('0x0'));var path=require(_0xc97e('0x1'));var timeout=require(_0xc97e('0x2'));var express=require(_0xc97e('0x3'));var router=express['Router']();var auth=require(_0xc97e('0x4'));var interaction=require(_0xc97e('0x5'));var config=require(_0xc97e('0x6'));var controller=require(_0xc97e('0x7'));router[_0xc97e('0x8')]('/',auth[_0xc97e('0x9')](),controller[_0xc97e('0xa')]);router['get']('/:id',auth[_0xc97e('0x9')](),controller[_0xc97e('0xb')]);router[_0xc97e('0x8')](_0xc97e('0xc'),auth[_0xc97e('0x9')](),controller[_0xc97e('0xd')]);router[_0xc97e('0x8')](_0xc97e('0xe'),auth[_0xc97e('0x9')](),controller[_0xc97e('0xf')]);router['post']('/',auth[_0xc97e('0x9')](),controller[_0xc97e('0x10')]);router['post'](_0xc97e('0xc'),auth['isAuthenticated'](),controller[_0xc97e('0x11')]);router[_0xc97e('0x12')](_0xc97e('0xe'),auth[_0xc97e('0x9')](),controller['addAgents']);router[_0xc97e('0x13')](_0xc97e('0x14'),auth[_0xc97e('0x9')](),controller['update']);router[_0xc97e('0x15')](_0xc97e('0x14'),auth[_0xc97e('0x9')](),controller[_0xc97e('0x16')]);router[_0xc97e('0x15')]('/:id/queues',auth[_0xc97e('0x9')](),controller[_0xc97e('0x17')]);router['delete'](_0xc97e('0xe'),auth[_0xc97e('0x9')](),controller[_0xc97e('0x18')]);module[_0xc97e('0x19')]=router; \ No newline at end of file +var _0x19c6=['../../config/environment','./team.controller','get','isAuthenticated','index','/:id','/:id/queues','getQueues','/:id/users','getAgents','post','addQueues','put','update','delete','destroy','removeQueues','removeAgents','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x33a3c8,_0x40d91e){var _0x298219=function(_0x3eab9b){while(--_0x3eab9b){_0x33a3c8['push'](_0x33a3c8['shift']());}};_0x298219(++_0x40d91e);}(_0x19c6,0x85));var _0x619c=function(_0x312663,_0x145fc5){_0x312663=_0x312663-0x0;var _0x3a0bea=_0x19c6[_0x312663];return _0x3a0bea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x619c('0x0'));var timeout=require(_0x619c('0x1'));var express=require(_0x619c('0x2'));var router=express[_0x619c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x619c('0x4'));var config=require(_0x619c('0x5'));var controller=require(_0x619c('0x6'));router[_0x619c('0x7')]('/',auth[_0x619c('0x8')](),controller[_0x619c('0x9')]);router[_0x619c('0x7')](_0x619c('0xa'),auth[_0x619c('0x8')](),controller['show']);router[_0x619c('0x7')](_0x619c('0xb'),auth[_0x619c('0x8')](),controller[_0x619c('0xc')]);router[_0x619c('0x7')](_0x619c('0xd'),auth[_0x619c('0x8')](),controller[_0x619c('0xe')]);router[_0x619c('0xf')]('/',auth[_0x619c('0x8')](),controller['create']);router[_0x619c('0xf')](_0x619c('0xb'),auth[_0x619c('0x8')](),controller[_0x619c('0x10')]);router[_0x619c('0xf')](_0x619c('0xd'),auth['isAuthenticated'](),controller['addAgents']);router[_0x619c('0x11')](_0x619c('0xa'),auth[_0x619c('0x8')](),controller[_0x619c('0x12')]);router[_0x619c('0x13')](_0x619c('0xa'),auth[_0x619c('0x8')](),controller[_0x619c('0x14')]);router[_0x619c('0x13')]('/:id/queues',auth['isAuthenticated'](),controller[_0x619c('0x15')]);router['delete'](_0x619c('0xd'),auth['isAuthenticated'](),controller[_0x619c('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 8cd36bb..d47b1ff 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f66=['name','sequelize','exports','STRING'];(function(_0x8b63ab,_0x51553d){var _0x48d7f4=function(_0x47b2c5){while(--_0x47b2c5){_0x8b63ab['push'](_0x8b63ab['shift']());}};_0x48d7f4(++_0x51553d);}(_0x3f66,0x79));var _0x63f6=function(_0x1e9094,_0x4c488c){_0x1e9094=_0x1e9094-0x0;var _0x14d291=_0x3f66[_0x1e9094];return _0x14d291;};'use strict';var Sequelize=require(_0x63f6('0x0'));module[_0x63f6('0x1')]={'name':{'type':Sequelize[_0x63f6('0x2')],'allowNull':![],'unique':_0x63f6('0x3')},'description':{'type':Sequelize[_0x63f6('0x2')]}}; \ No newline at end of file +var _0x8dd6=['exports','name','STRING','sequelize'];(function(_0x5f0707,_0x4debdf){var _0x4220d7=function(_0x184eae){while(--_0x184eae){_0x5f0707['push'](_0x5f0707['shift']());}};_0x4220d7(++_0x4debdf);}(_0x8dd6,0x15b));var _0x68dd=function(_0x5d9cae,_0x705712){_0x5d9cae=_0x5d9cae-0x0;var _0x129be9=_0x8dd6[_0x5d9cae];return _0x129be9;};'use strict';var Sequelize=require(_0x68dd('0x0'));module[_0x68dd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x68dd('0x2')},'description':{'type':Sequelize[_0x68dd('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 6adffe4..f94e1df 100644 --- a/server/api/team/team.controller.js +++ b/server/api/team/team.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe73=['User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','whatsapp','userTeam:remove','getAgents','hasOwnProperty','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./team.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','Teams','UserProfileResource','end','stack','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','Queues','ids','removeQueues','remove','addAgents','Chat','Sms','Whatsapp','each','Voice'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfe73,0x192));var _0x3fe7=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xfe73[_0x4b7895];return _0x264180;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3fe7('0x0'));var zipdir=require(_0x3fe7('0x1'));var jsonpatch=require(_0x3fe7('0x2'));var rp=require(_0x3fe7('0x3'));var moment=require(_0x3fe7('0x4'));var BPromise=require(_0x3fe7('0x5'));var Mustache=require(_0x3fe7('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3fe7('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3fe7('0x8'));var crypto=require(_0x3fe7('0x9'));var jsforce=require(_0x3fe7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3fe7('0xb'));var querystring=require(_0x3fe7('0xc'));var Papa=require(_0x3fe7('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3fe7('0xe'));var as=require(_0x3fe7('0xf'));var hardwareService=require(_0x3fe7('0x10'));var logger=require(_0x3fe7('0x11'))('api');var utils=require(_0x3fe7('0x12'));var config=require(_0x3fe7('0x13'));var licenseUtil=require(_0x3fe7('0x14'));var db=require('../../mysqldb')['db'];config[_0x3fe7('0x15')]=_[_0x3fe7('0x16')](config[_0x3fe7('0x15')],{'host':_0x3fe7('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fe7('0x15')]));require(_0x3fe7('0x18'))[_0x3fe7('0x19')](socket);function respondWithStatusCode(_0x190a65,_0x43bc76){_0x43bc76=_0x43bc76||0xcc;return function(_0x294964){if(_0x294964){return _0x190a65[_0x3fe7('0x1a')](_0x43bc76);}return _0x190a65[_0x3fe7('0x1b')](_0x43bc76)['end']();};}function respondWithResult(_0x474c67,_0x21041a){_0x21041a=_0x21041a||0xc8;return function(_0x220fad){if(_0x220fad){return _0x474c67[_0x3fe7('0x1b')](_0x21041a)['json'](_0x220fad);}};}function respondWithFilteredResult(_0x27a683,_0x36c0fc){return function(_0x3b0346){if(_0x3b0346){var _0x1b3895=_0x3b0346[_0x3fe7('0x1c')],_0x5a123e=_0x36c0fc['offset'],_0x1c19a9=_0x36c0fc[_0x3fe7('0x1d')]+_0x36c0fc[_0x3fe7('0x1e')],_0x381ea9;if(_0x1c19a9>=_0x1b3895){_0x1c19a9=_0x1b3895;_0x381ea9=0xc8;}else{_0x381ea9=0xce;}_0x27a683['status'](_0x381ea9);return _0x27a683[_0x3fe7('0x1f')](_0x3fe7('0x20'),_0x5a123e+'-'+_0x1c19a9+'/'+_0x1b3895)[_0x3fe7('0x21')](_0x3b0346);}return null;};}function patchUpdates(_0x55878d){return function(_0x4914de){try{jsonpatch[_0x3fe7('0x22')](_0x4914de,_0x55878d,!![]);}catch(_0x15fdce){return BPromise[_0x3fe7('0x23')](_0x15fdce);}return _0x4914de[_0x3fe7('0x24')]();};}function saveUpdates(_0x222f5d,_0x5c3717){return function(_0x3cb339){if(_0x3cb339){return _0x3cb339['update'](_0x222f5d)['then'](function(_0x546ac5){return _0x546ac5;});}return null;};}function removeEntity(_0x257f38,_0x4041eb){return function(_0x2fae20){if(_0x2fae20){return _0x2fae20[_0x3fe7('0x25')]()[_0x3fe7('0x26')](function(){var _0x250f48=_0x2fae20['get']({'plain':!![]});var _0x3e0d6c=_0x3fe7('0x27');return db[_0x3fe7('0x28')][_0x3fe7('0x25')]({'where':{'type':_0x3e0d6c,'resourceId':_0x250f48['id']}})['then'](function(){return _0x2fae20;});})[_0x3fe7('0x26')](function(){_0x257f38[_0x3fe7('0x1b')](0xcc)[_0x3fe7('0x29')]();});}};}function handleEntityNotFound(_0x4fd727,_0xaf2b56){return function(_0x2ee173){if(!_0x2ee173){_0x4fd727[_0x3fe7('0x1a')](0x194);}return _0x2ee173;};}function handleError(_0x5a4a5d,_0x3f5606){_0x3f5606=_0x3f5606||0x1f4;return function(_0x34aa35){logger['error'](_0x34aa35[_0x3fe7('0x2a')]);if(_0x34aa35['name']){delete _0x34aa35[_0x3fe7('0x2b')];}_0x5a4a5d[_0x3fe7('0x1b')](_0x3f5606)[_0x3fe7('0x2c')](_0x34aa35);};}exports[_0x3fe7('0x2d')]=function(_0x58accb,_0x34bb3a){var _0x12f88a={},_0x4f28c7={},_0x3e28c4={'count':0x0,'rows':[]};var _0x393d8a=_[_0x3fe7('0x2e')](db[_0x3fe7('0x2f')][_0x3fe7('0x30')],function(_0x481997){return{'name':_0x481997[_0x3fe7('0x31')],'type':_0x481997['type'][_0x3fe7('0x32')]};});_0x4f28c7[_0x3fe7('0x33')]=_[_0x3fe7('0x2e')](_0x393d8a,'name');_0x4f28c7[_0x3fe7('0x34')]=_[_0x3fe7('0x35')](_0x58accb[_0x3fe7('0x34')]);_0x4f28c7['filters']=_[_0x3fe7('0x36')](_0x4f28c7[_0x3fe7('0x33')],_0x4f28c7[_0x3fe7('0x34')]);_0x12f88a[_0x3fe7('0x37')]=_['intersection'](_0x4f28c7['model'],qs[_0x3fe7('0x38')](_0x58accb['query']['fields']));_0x12f88a[_0x3fe7('0x37')]=_0x12f88a[_0x3fe7('0x37')][_0x3fe7('0x39')]?_0x12f88a[_0x3fe7('0x37')]:_0x4f28c7['model'];if(!_0x58accb[_0x3fe7('0x34')]['hasOwnProperty']('nolimit')){_0x12f88a['limit']=qs['limit'](_0x58accb[_0x3fe7('0x34')][_0x3fe7('0x1e')]);_0x12f88a['offset']=qs['offset'](_0x58accb['query'][_0x3fe7('0x1d')]);}_0x12f88a[_0x3fe7('0x3a')]=qs[_0x3fe7('0x3b')](_0x58accb[_0x3fe7('0x34')][_0x3fe7('0x3b')]);_0x12f88a[_0x3fe7('0x3c')]=qs['filters'](_['pick'](_0x58accb[_0x3fe7('0x34')],_0x4f28c7['filters']),_0x393d8a);if(_0x58accb[_0x3fe7('0x34')][_0x3fe7('0x3d')]){_0x12f88a[_0x3fe7('0x3c')]=_[_0x3fe7('0x3e')](_0x12f88a['where'],{'$or':_[_0x3fe7('0x2e')](_0x393d8a,function(_0x222fe4){if(_0x222fe4['type']!==_0x3fe7('0x3f')){var _0x16857c={};_0x16857c[_0x222fe4[_0x3fe7('0x2b')]]={'$like':'%'+_0x58accb[_0x3fe7('0x34')]['filter']+'%'};return _0x16857c;}})});}_0x12f88a=_[_0x3fe7('0x3e')]({},_0x12f88a,_0x58accb[_0x3fe7('0x40')]);var _0x5585e0={'where':_0x12f88a[_0x3fe7('0x3c')]};return db[_0x3fe7('0x2f')][_0x3fe7('0x1c')](_0x5585e0)[_0x3fe7('0x26')](function(_0x208fa1){_0x3e28c4[_0x3fe7('0x1c')]=_0x208fa1;if(_0x58accb['query'][_0x3fe7('0x41')]){_0x12f88a[_0x3fe7('0x42')]=[{'all':!![]}];}return db[_0x3fe7('0x2f')][_0x3fe7('0x43')](_0x12f88a);})[_0x3fe7('0x26')](function(_0x52d081){_0x3e28c4[_0x3fe7('0x44')]=_0x52d081;return _0x3e28c4;})[_0x3fe7('0x26')](respondWithFilteredResult(_0x34bb3a,_0x12f88a))[_0x3fe7('0x45')](handleError(_0x34bb3a,null));};exports[_0x3fe7('0x46')]=function(_0x59c4a9,_0x908b4e){var _0x4436ff={'raw':![],'where':{'id':_0x59c4a9[_0x3fe7('0x47')]['id']}},_0x583924={};_0x583924[_0x3fe7('0x33')]=_[_0x3fe7('0x35')](db[_0x3fe7('0x2f')]['rawAttributes']);_0x583924['query']=_[_0x3fe7('0x35')](_0x59c4a9[_0x3fe7('0x34')]);_0x583924[_0x3fe7('0x48')]=_[_0x3fe7('0x36')](_0x583924[_0x3fe7('0x33')],_0x583924[_0x3fe7('0x34')]);_0x4436ff['attributes']=_[_0x3fe7('0x36')](_0x583924['model'],qs[_0x3fe7('0x38')](_0x59c4a9[_0x3fe7('0x34')][_0x3fe7('0x38')]));_0x4436ff['attributes']=_0x4436ff[_0x3fe7('0x37')]['length']?_0x4436ff[_0x3fe7('0x37')]:_0x583924[_0x3fe7('0x33')];if(_0x59c4a9['query'][_0x3fe7('0x41')]){_0x4436ff['include']=[{'all':!![]}];}_0x4436ff=_['merge']({},_0x4436ff,_0x59c4a9[_0x3fe7('0x40')]);return db['Team']['find'](_0x4436ff)[_0x3fe7('0x26')](handleEntityNotFound(_0x908b4e,null))['then'](respondWithResult(_0x908b4e,null))[_0x3fe7('0x45')](handleError(_0x908b4e,null));};exports[_0x3fe7('0x49')]=function(_0x12d1d6,_0x26a4d9){return db[_0x3fe7('0x2f')][_0x3fe7('0x49')](_0x12d1d6['body'],{})[_0x3fe7('0x26')](function(_0x3f8480){var _0x27171a=_0x12d1d6[_0x3fe7('0x4a')]['get']({'plain':!![]});if(!_0x27171a)throw new Error(_0x3fe7('0x4b'));if(_0x27171a[_0x3fe7('0x4c')]===_0x3fe7('0x4a')){var _0x5ca597=_0x3f8480[_0x3fe7('0x4d')]({'plain':!![]});var _0x2413d7='Teams';return db[_0x3fe7('0x4e')][_0x3fe7('0x4f')]({'where':{'name':_0x2413d7,'userProfileId':_0x27171a[_0x3fe7('0x50')]},'raw':!![]})[_0x3fe7('0x26')](function(_0x3fa2ef){if(_0x3fa2ef&&_0x3fa2ef['autoAssociation']===0x0){return db[_0x3fe7('0x28')][_0x3fe7('0x49')]({'name':_0x5ca597[_0x3fe7('0x2b')],'resourceId':_0x5ca597['id'],'type':_0x3fa2ef[_0x3fe7('0x2b')],'sectionId':_0x3fa2ef['id']},{})[_0x3fe7('0x26')](function(){return _0x3f8480;});}else{return _0x3f8480;}})[_0x3fe7('0x45')](function(_0x15bf91){logger[_0x3fe7('0x51')](_0x3fe7('0x52'),_0x15bf91);throw _0x15bf91;});}return _0x3f8480;})[_0x3fe7('0x26')](respondWithResult(_0x26a4d9,0xc9))[_0x3fe7('0x45')](handleError(_0x26a4d9,null));};exports[_0x3fe7('0x53')]=function(_0x2f768a,_0x4db843){if(_0x2f768a[_0x3fe7('0x54')]['id']){delete _0x2f768a['body']['id'];}return db[_0x3fe7('0x2f')][_0x3fe7('0x4f')]({'where':{'id':_0x2f768a[_0x3fe7('0x47')]['id']}})['then'](handleEntityNotFound(_0x4db843,null))[_0x3fe7('0x26')](saveUpdates(_0x2f768a['body'],null))[_0x3fe7('0x26')](respondWithResult(_0x4db843,null))[_0x3fe7('0x45')](handleError(_0x4db843,null));};exports['destroy']=function(_0x1f5881,_0x10227e){return db[_0x3fe7('0x2f')][_0x3fe7('0x4f')]({'where':{'id':_0x1f5881[_0x3fe7('0x47')]['id']}})[_0x3fe7('0x26')](handleEntityNotFound(_0x10227e,null))[_0x3fe7('0x26')](removeEntity(_0x10227e,null))[_0x3fe7('0x45')](handleError(_0x10227e,null));};exports[_0x3fe7('0x55')]=function(_0x20a550,_0x460e03,_0x4cdde7){return db['Team'][_0x3fe7('0x56')]({'where':{'id':_0x20a550[_0x3fe7('0x47')]['id']}})[_0x3fe7('0x26')](handleEntityNotFound(_0x460e03,null))[_0x3fe7('0x26')](function(_0x46cdfb){if(!_0x20a550['query'][_0x3fe7('0x57')]||!utils[_0x3fe7('0x58')](_0x20a550['query'][_0x3fe7('0x57')])){throw new db[(_0x3fe7('0x59'))][(_0x3fe7('0x5a'))](_0x3fe7('0x5b'));}var _0x13f573={};var _0x16c018={};_0x16c018[_0x3fe7('0x33')]=_[_0x3fe7('0x35')](db[_[_0x3fe7('0x5c')](_0x20a550[_0x3fe7('0x34')][_0x3fe7('0x57')][_0x3fe7('0x5d')]())+_0x3fe7('0x5e')][_0x3fe7('0x30')]);_0x16c018['query']=_['keys'](_0x20a550['query']);_0x16c018[_0x3fe7('0x48')]=_[_0x3fe7('0x36')](_0x16c018['model'],_0x16c018['query']);_0x13f573[_0x3fe7('0x37')]=_[_0x3fe7('0x36')](_0x16c018[_0x3fe7('0x33')],qs['fields'](_0x20a550[_0x3fe7('0x34')][_0x3fe7('0x38')]));_0x13f573[_0x3fe7('0x37')]=_0x13f573[_0x3fe7('0x37')][_0x3fe7('0x39')]?_0x13f573[_0x3fe7('0x37')]:_0x16c018[_0x3fe7('0x33')];_0x13f573[_0x3fe7('0x1e')]=qs[_0x3fe7('0x1e')](_0x20a550[_0x3fe7('0x34')]['limit']);_0x13f573[_0x3fe7('0x1d')]=qs[_0x3fe7('0x1d')](_0x20a550[_0x3fe7('0x34')][_0x3fe7('0x1d')]);_0x13f573[_0x3fe7('0x3a')]=qs['sort'](_0x20a550[_0x3fe7('0x34')][_0x3fe7('0x3b')]);_0x13f573[_0x3fe7('0x3c')]=qs[_0x3fe7('0x48')](_['pick'](_0x20a550[_0x3fe7('0x34')],_0x16c018[_0x3fe7('0x48')]));_0x13f573=_[_0x3fe7('0x3e')]({},_0x13f573,_0x20a550['options']);return _0x46cdfb['get'+_[_0x3fe7('0x5c')](_0x20a550[_0x3fe7('0x34')][_0x3fe7('0x57')][_0x3fe7('0x5d')]())+'Queues'](_0x13f573);})['then'](respondWithResult(_0x460e03,null))['catch'](handleError(_0x460e03,null));};exports[_0x3fe7('0x5f')]=function(_0x25b14f,_0x2d9c69,_0x36291c){return db[_0x3fe7('0x2f')][_0x3fe7('0x56')]({'where':{'id':_0x25b14f[_0x3fe7('0x47')]['id']}})[_0x3fe7('0x26')](function(_0x1f67df){if(_0x1f67df){if(!_0x25b14f[_0x3fe7('0x54')][_0x3fe7('0x57')]||!utils['isValidChannel'](_0x25b14f[_0x3fe7('0x54')][_0x3fe7('0x57')])){throw new db['Sequelize'][(_0x3fe7('0x5a'))](_0x3fe7('0x5b'));}return _0x1f67df['add'+_[_0x3fe7('0x5c')](_0x25b14f[_0x3fe7('0x54')]['channel'][_0x3fe7('0x5d')]())+_0x3fe7('0x60')](_0x25b14f[_0x3fe7('0x54')][_0x3fe7('0x61')]);}return null;})['then'](handleEntityNotFound(_0x2d9c69,null))[_0x3fe7('0x26')](respondWithStatusCode(_0x2d9c69,null))['catch'](handleError(_0x2d9c69,null));};exports[_0x3fe7('0x62')]=function(_0x63b376,_0x459f5d,_0x1dc778){return db[_0x3fe7('0x2f')][_0x3fe7('0x56')]({'where':{'id':_0x63b376[_0x3fe7('0x47')]['id']}})[_0x3fe7('0x26')](function(_0x48a0d6){if(_0x48a0d6){if(!_0x63b376[_0x3fe7('0x34')][_0x3fe7('0x57')]||!utils['isValidChannel'](_0x63b376[_0x3fe7('0x34')][_0x3fe7('0x57')])){throw new db['Sequelize']['ValidationError'](_0x3fe7('0x5b'));}return _0x48a0d6[_0x3fe7('0x63')+_[_0x3fe7('0x5c')](_0x63b376[_0x3fe7('0x34')][_0x3fe7('0x57')][_0x3fe7('0x5d')]())+_0x3fe7('0x60')](_0x63b376[_0x3fe7('0x34')][_0x3fe7('0x61')]);}return null;})[_0x3fe7('0x26')](handleEntityNotFound(_0x459f5d,null))[_0x3fe7('0x26')](respondWithStatusCode(_0x459f5d,null))[_0x3fe7('0x45')](handleError(_0x459f5d,null));};exports[_0x3fe7('0x64')]=function(_0x4d879c,_0x363a6d,_0x2485af){return db['Team'][_0x3fe7('0x4f')]({'where':{'id':_0x4d879c[_0x3fe7('0x47')]['id']}})[_0x3fe7('0x26')](handleEntityNotFound(_0x363a6d,null))['then'](function(_0x20cc0f){if(_0x20cc0f){var _0x31cb80=['Voice',_0x3fe7('0x65'),'Mail',_0x3fe7('0x66'),'Fax','Openchannel',_0x3fe7('0x67')];return BPromise['each'](_0x31cb80,function(_0x712c08){return _0x20cc0f['get'+_0x712c08+_0x3fe7('0x60')]({'attributes':['id','name']})[_0x3fe7('0x26')](function(_0x11155f){return BPromise[_0x3fe7('0x68')](_0x11155f,function(_0x4c33d6){return _0x4c33d6[_0x3fe7('0x64')](_0x4d879c[_0x3fe7('0x54')][_0x3fe7('0x61')])[_0x3fe7('0x26')](function(){if(_0x712c08===_0x3fe7('0x69')){return db[_0x3fe7('0x6a')][_0x3fe7('0x43')]({'where':{'id':_0x4d879c[_0x3fe7('0x54')][_0x3fe7('0x61')]},'attributes':['id',_0x3fe7('0x2b'),'online',_0x3fe7('0x6b'),_0x3fe7('0x6c')],'raw':!![]})['then'](function(_0x282101){return BPromise['each'](_['filter'](_0x282101,{'online':0x1}),function(_0x1c72bf){return db[_0x3fe7('0x6d')][_0x3fe7('0x6e')]({'membername':_0x1c72bf[_0x3fe7('0x2b')],'UserId':_0x1c72bf['id'],'queue_name':_0x4c33d6[_0x3fe7('0x2b')],'VoiceQueueId':_0x4c33d6['id'],'interface':_[_0x3fe7('0x6f')](_0x1c72bf['interface'])?util[_0x3fe7('0x70')](_0x3fe7('0x71'),_0x1c72bf[_0x3fe7('0x2b')]):_0x1c72bf[_0x3fe7('0x6c')],'paused':_0x1c72bf[_0x3fe7('0x6b')]||![],'penalty':0x0});});});}});});})[_0x3fe7('0x26')](function(){return _0x20cc0f;});})[_0x3fe7('0x26')](function(){return _0x20cc0f;});}})[_0x3fe7('0x26')](function(_0x411d91){if(_0x411d91){return _0x411d91[_0x3fe7('0x64')](_0x4d879c['body'][_0x3fe7('0x61')],_[_0x3fe7('0x72')](_0x4d879c[_0x3fe7('0x54')],[_0x3fe7('0x61'),'id'])||{})[_0x3fe7('0x73')](function(_0x38bdf4){for(var _0x2e2f7a=0x0;_0x2e2f7a<_0x4d879c[_0x3fe7('0x54')]['ids'][_0x3fe7('0x39')];_0x2e2f7a+=0x1){socket[_0x3fe7('0x74')](_0x3fe7('0x75'),{'UserId':_0x4d879c[_0x3fe7('0x54')][_0x3fe7('0x61')][_0x2e2f7a],'TeamId':_0x4d879c[_0x3fe7('0x47')]['id']});}return _0x38bdf4;});}})['then'](respondWithResult(_0x363a6d,null))[_0x3fe7('0x45')](handleError(_0x363a6d,null));};exports[_0x3fe7('0x76')]=function(_0x8f8b02,_0xc95ffa,_0x30cbae){return db[_0x3fe7('0x2f')][_0x3fe7('0x4f')]({'where':{'id':_0x8f8b02[_0x3fe7('0x47')]['id']}})[_0x3fe7('0x26')](handleEntityNotFound(_0xc95ffa,null))[_0x3fe7('0x26')](function(_0x372489){if(_0x372489){return BPromise[_0x3fe7('0x68')]([_0x3fe7('0x77'),_0x3fe7('0x78'),_0x3fe7('0x79'),'sms','fax','openchannel',_0x3fe7('0x7a')],function(_0x5917a4){return _0x372489[_0x3fe7('0x4d')+_[_0x3fe7('0x5c')](_0x5917a4)+_0x3fe7('0x60')]({'attributes':['id',_0x3fe7('0x2b')]})[_0x3fe7('0x26')](function(_0x4135e5){return BPromise[_0x3fe7('0x68')](_0x4135e5,function(_0x504815){return _0x504815['removeAgents'](_0x8f8b02['query'][_0x3fe7('0x61')])[_0x3fe7('0x26')](function(){if(_0x5917a4===_0x3fe7('0x77')){return db['UserVoiceQueueRt'][_0x3fe7('0x25')]({'where':{'VoiceQueueId':_0x504815['id'],'UserId':_0x8f8b02[_0x3fe7('0x34')]['ids']}});}});});})['then'](function(){return _0x372489;});})[_0x3fe7('0x26')](function(){return _0x372489;});}})[_0x3fe7('0x26')](function(_0x4a815e){if(_0x4a815e){return _0x4a815e[_0x3fe7('0x76')](_0x8f8b02[_0x3fe7('0x34')][_0x3fe7('0x61')])[_0x3fe7('0x26')](function(){if(_['isArray'](_0x8f8b02[_0x3fe7('0x34')][_0x3fe7('0x61')])){for(var _0x637b3f=0x0;_0x637b3f<_0x8f8b02[_0x3fe7('0x34')][_0x3fe7('0x61')]['length'];_0x637b3f+=0x1){socket[_0x3fe7('0x74')](_0x3fe7('0x7b'),{'UserId':Number(_0x8f8b02['query'][_0x3fe7('0x61')][_0x637b3f]),'TeamId':Number(_0x8f8b02['params']['id'])});}}else{socket[_0x3fe7('0x74')](_0x3fe7('0x7b'),{'UserId':Number(_0x8f8b02[_0x3fe7('0x34')][_0x3fe7('0x61')]),'TeamId':Number(_0x8f8b02[_0x3fe7('0x47')]['id'])});}});}})[_0x3fe7('0x26')](respondWithStatusCode(_0xc95ffa,null))[_0x3fe7('0x45')](handleError(_0xc95ffa,null));};exports[_0x3fe7('0x7c')]=function(_0x5ac9b2,_0x444b07,_0x43e995){var _0x26c1bc={};var _0x421bce={};var _0x17a72c;var _0x3e5d2b;return db[_0x3fe7('0x2f')][_0x3fe7('0x56')]({'where':{'id':_0x5ac9b2[_0x3fe7('0x47')]['id']}})[_0x3fe7('0x26')](handleEntityNotFound(_0x444b07,null))[_0x3fe7('0x26')](function(_0x5f0dcf){if(_0x5f0dcf){_0x17a72c=_0x5f0dcf;_0x421bce['model']=_[_0x3fe7('0x35')](db[_0x3fe7('0x6a')]['rawAttributes']);_0x421bce[_0x3fe7('0x34')]=_['keys'](_0x5ac9b2['query']);_0x421bce[_0x3fe7('0x48')]=_[_0x3fe7('0x36')](_0x421bce[_0x3fe7('0x33')],_0x421bce[_0x3fe7('0x34')]);_0x26c1bc[_0x3fe7('0x37')]=_[_0x3fe7('0x36')](_0x421bce[_0x3fe7('0x33')],qs['fields'](_0x5ac9b2[_0x3fe7('0x34')][_0x3fe7('0x38')]));_0x26c1bc['attributes']=_0x26c1bc[_0x3fe7('0x37')][_0x3fe7('0x39')]?_0x26c1bc['attributes']:_0x421bce[_0x3fe7('0x33')];_0x26c1bc[_0x3fe7('0x3a')]=qs[_0x3fe7('0x3b')](_0x5ac9b2[_0x3fe7('0x34')][_0x3fe7('0x3b')]);_0x26c1bc[_0x3fe7('0x3c')]=qs[_0x3fe7('0x48')](_['pick'](_0x5ac9b2[_0x3fe7('0x34')],_0x421bce[_0x3fe7('0x48')]));if(_0x5ac9b2[_0x3fe7('0x34')][_0x3fe7('0x3d')]){_0x26c1bc[_0x3fe7('0x3c')]=_[_0x3fe7('0x3e')](_0x26c1bc[_0x3fe7('0x3c')],{'$or':_['map'](_0x26c1bc[_0x3fe7('0x37')],function(_0x4003af){var _0x505ff9={};_0x505ff9[_0x4003af]={'$like':'%'+_0x5ac9b2[_0x3fe7('0x34')]['filter']+'%'};return _0x505ff9;})});}_0x26c1bc=_[_0x3fe7('0x3e')]({},_0x26c1bc,_0x5ac9b2[_0x3fe7('0x40')]);return _0x17a72c[_0x3fe7('0x7c')](_0x26c1bc);}})[_0x3fe7('0x26')](function(_0x2ff194){if(_0x2ff194){_0x3e5d2b=_0x2ff194['length'];if(!_0x5ac9b2[_0x3fe7('0x34')][_0x3fe7('0x7d')](_0x3fe7('0x7e'))){_0x26c1bc[_0x3fe7('0x1e')]=qs['limit'](_0x5ac9b2[_0x3fe7('0x34')][_0x3fe7('0x1e')]);_0x26c1bc[_0x3fe7('0x1d')]=qs[_0x3fe7('0x1d')](_0x5ac9b2[_0x3fe7('0x34')][_0x3fe7('0x1d')]);}return _0x17a72c[_0x3fe7('0x7c')](_0x26c1bc);}})['then'](function(_0x14e02e){if(_0x14e02e){return _0x14e02e?{'count':_0x3e5d2b,'rows':_0x14e02e}:null;}})['then'](respondWithResult(_0x444b07,null))[_0x3fe7('0x45')](handleError(_0x444b07,null));}; \ No newline at end of file +var _0x32c2=['isNil','interface','format','SIP/%s','spread','emit','userTeam:save','removeAgents','voice','chat','sms','fax','openchannel','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','Teams','UserProfileResource','destroy','error','stack','name','map','Team','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','getQueues','findOne','isValidChannel','channel','Sequelize','Unknown\x20channel','toLowerCase','Queue','pick','capitalize','Queues','ValidationError','removeQueues','remove','ids','Voice','Chat','Sms','Fax','each','User','voicePause','upsert'];(function(_0x53d1f4,_0x7967b7){var _0x339f51=function(_0x22212a){while(--_0x22212a){_0x53d1f4['push'](_0x53d1f4['shift']());}};_0x339f51(++_0x7967b7);}(_0x32c2,0x113));var _0x232c=function(_0xb5b5bf,_0x3b7283){_0xb5b5bf=_0xb5b5bf-0x0;var _0x2f841f=_0x32c2[_0xb5b5bf];return _0x2f841f;};'use strict';var pdf=require(_0x232c('0x0'));var emlformat=require(_0x232c('0x1'));var rimraf=require(_0x232c('0x2'));var zipdir=require(_0x232c('0x3'));var jsonpatch=require(_0x232c('0x4'));var rp=require(_0x232c('0x5'));var moment=require(_0x232c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x232c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x232c('0x8'));var csv=require('to-csv');var ejs=require(_0x232c('0x9'));var fs=require('fs');var _=require(_0x232c('0xa'));var squel=require(_0x232c('0xb'));var crypto=require(_0x232c('0xc'));var jsforce=require(_0x232c('0xd'));var deskjs=require(_0x232c('0xe'));var toCsv=require(_0x232c('0xf'));var querystring=require(_0x232c('0x10'));var Papa=require(_0x232c('0x11'));var Redis=require(_0x232c('0x12'));var authService=require(_0x232c('0x13'));var qs=require(_0x232c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x232c('0x15'))(_0x232c('0x16'));var utils=require(_0x232c('0x17'));var config=require(_0x232c('0x18'));var licenseUtil=require(_0x232c('0x19'));var db=require(_0x232c('0x1a'))['db'];config[_0x232c('0x1b')]=_[_0x232c('0x1c')](config[_0x232c('0x1b')],{'host':_0x232c('0x1d'),'port':0x18eb});var socket=require(_0x232c('0x1e'))(new Redis(config[_0x232c('0x1b')]));require(_0x232c('0x1f'))['register'](socket);function respondWithStatusCode(_0x4c462c,_0x5bcf4e){_0x5bcf4e=_0x5bcf4e||0xcc;return function(_0x35f2ee){if(_0x35f2ee){return _0x4c462c[_0x232c('0x20')](_0x5bcf4e);}return _0x4c462c[_0x232c('0x21')](_0x5bcf4e)[_0x232c('0x22')]();};}function respondWithResult(_0x3257e7,_0xda435a){_0xda435a=_0xda435a||0xc8;return function(_0x1caea9){if(_0x1caea9){return _0x3257e7['status'](_0xda435a)[_0x232c('0x23')](_0x1caea9);}};}function respondWithFilteredResult(_0x203c31,_0x3625be){return function(_0x37f2ec){if(_0x37f2ec){var _0x64463f=_0x37f2ec[_0x232c('0x24')],_0x34288c=_0x3625be['offset'],_0x283b90=_0x3625be[_0x232c('0x25')]+_0x3625be[_0x232c('0x26')],_0x36b498;if(_0x283b90>=_0x64463f){_0x283b90=_0x64463f;_0x36b498=0xc8;}else{_0x36b498=0xce;}_0x203c31[_0x232c('0x21')](_0x36b498);return _0x203c31[_0x232c('0x27')](_0x232c('0x28'),_0x34288c+'-'+_0x283b90+'/'+_0x64463f)[_0x232c('0x23')](_0x37f2ec);}return null;};}function patchUpdates(_0x443db1){return function(_0x4f8511){try{jsonpatch[_0x232c('0x29')](_0x4f8511,_0x443db1,!![]);}catch(_0x592b17){return BPromise[_0x232c('0x2a')](_0x592b17);}return _0x4f8511[_0x232c('0x2b')]();};}function saveUpdates(_0x2011e2,_0x1d2751){return function(_0x371470){if(_0x371470){return _0x371470[_0x232c('0x2c')](_0x2011e2)['then'](function(_0x27ca52){return _0x27ca52;});}return null;};}function removeEntity(_0x2ee42e,_0x68c300){return function(_0x50a9e2){if(_0x50a9e2){return _0x50a9e2['destroy']()[_0x232c('0x2d')](function(){var _0x356f9e=_0x50a9e2['get']({'plain':!![]});var _0x58314f=_0x232c('0x2e');return db[_0x232c('0x2f')][_0x232c('0x30')]({'where':{'type':_0x58314f,'resourceId':_0x356f9e['id']}})[_0x232c('0x2d')](function(){return _0x50a9e2;});})[_0x232c('0x2d')](function(){_0x2ee42e[_0x232c('0x21')](0xcc)[_0x232c('0x22')]();});}};}function handleEntityNotFound(_0x50db43,_0x20730b){return function(_0x152606){if(!_0x152606){_0x50db43['sendStatus'](0x194);}return _0x152606;};}function handleError(_0x12d176,_0x16ebf6){_0x16ebf6=_0x16ebf6||0x1f4;return function(_0x325e5c){logger[_0x232c('0x31')](_0x325e5c[_0x232c('0x32')]);if(_0x325e5c[_0x232c('0x33')]){delete _0x325e5c[_0x232c('0x33')];}_0x12d176[_0x232c('0x21')](_0x16ebf6)['send'](_0x325e5c);};}exports['index']=function(_0x24a3af,_0x122371){var _0x33c10f={},_0x54cb85={},_0x1cc3a6={'count':0x0,'rows':[]};var _0x3d4d6a=_[_0x232c('0x34')](db[_0x232c('0x35')][_0x232c('0x36')],function(_0x40ccda){return{'name':_0x40ccda['fieldName'],'type':_0x40ccda[_0x232c('0x37')][_0x232c('0x38')]};});_0x54cb85[_0x232c('0x39')]=_[_0x232c('0x34')](_0x3d4d6a,_0x232c('0x33'));_0x54cb85[_0x232c('0x3a')]=_['keys'](_0x24a3af[_0x232c('0x3a')]);_0x54cb85[_0x232c('0x3b')]=_['intersection'](_0x54cb85[_0x232c('0x39')],_0x54cb85['query']);_0x33c10f[_0x232c('0x3c')]=_[_0x232c('0x3d')](_0x54cb85[_0x232c('0x39')],qs[_0x232c('0x3e')](_0x24a3af['query']['fields']));_0x33c10f[_0x232c('0x3c')]=_0x33c10f[_0x232c('0x3c')][_0x232c('0x3f')]?_0x33c10f[_0x232c('0x3c')]:_0x54cb85[_0x232c('0x39')];if(!_0x24a3af['query'][_0x232c('0x40')](_0x232c('0x41'))){_0x33c10f['limit']=qs[_0x232c('0x26')](_0x24a3af[_0x232c('0x3a')]['limit']);_0x33c10f['offset']=qs['offset'](_0x24a3af[_0x232c('0x3a')][_0x232c('0x25')]);}_0x33c10f[_0x232c('0x42')]=qs[_0x232c('0x43')](_0x24a3af[_0x232c('0x3a')][_0x232c('0x43')]);_0x33c10f[_0x232c('0x44')]=qs[_0x232c('0x3b')](_['pick'](_0x24a3af[_0x232c('0x3a')],_0x54cb85[_0x232c('0x3b')]),_0x3d4d6a);if(_0x24a3af['query'][_0x232c('0x45')]){_0x33c10f[_0x232c('0x44')]=_['merge'](_0x33c10f[_0x232c('0x44')],{'$or':_['map'](_0x3d4d6a,function(_0x519422){if(_0x519422['type']!==_0x232c('0x46')){var _0x27d046={};_0x27d046[_0x519422[_0x232c('0x33')]]={'$like':'%'+_0x24a3af['query'][_0x232c('0x45')]+'%'};return _0x27d046;}})});}_0x33c10f=_[_0x232c('0x47')]({},_0x33c10f,_0x24a3af[_0x232c('0x48')]);var _0x526dc6={'where':_0x33c10f[_0x232c('0x44')]};return db[_0x232c('0x35')][_0x232c('0x24')](_0x526dc6)[_0x232c('0x2d')](function(_0x3e0f70){_0x1cc3a6[_0x232c('0x24')]=_0x3e0f70;if(_0x24a3af[_0x232c('0x3a')][_0x232c('0x49')]){_0x33c10f[_0x232c('0x4a')]=[{'all':!![]}];}return db[_0x232c('0x35')][_0x232c('0x4b')](_0x33c10f);})[_0x232c('0x2d')](function(_0xc81bfc){_0x1cc3a6['rows']=_0xc81bfc;return _0x1cc3a6;})[_0x232c('0x2d')](respondWithFilteredResult(_0x122371,_0x33c10f))[_0x232c('0x4c')](handleError(_0x122371,null));};exports['show']=function(_0x371800,_0xa45591){var _0x3e6898={'raw':![],'where':{'id':_0x371800[_0x232c('0x4d')]['id']}},_0x2abb02={};_0x2abb02[_0x232c('0x39')]=_[_0x232c('0x4e')](db[_0x232c('0x35')][_0x232c('0x36')]);_0x2abb02[_0x232c('0x3a')]=_[_0x232c('0x4e')](_0x371800[_0x232c('0x3a')]);_0x2abb02[_0x232c('0x3b')]=_[_0x232c('0x3d')](_0x2abb02[_0x232c('0x39')],_0x2abb02[_0x232c('0x3a')]);_0x3e6898['attributes']=_[_0x232c('0x3d')](_0x2abb02[_0x232c('0x39')],qs[_0x232c('0x3e')](_0x371800['query']['fields']));_0x3e6898[_0x232c('0x3c')]=_0x3e6898[_0x232c('0x3c')][_0x232c('0x3f')]?_0x3e6898[_0x232c('0x3c')]:_0x2abb02[_0x232c('0x39')];if(_0x371800[_0x232c('0x3a')][_0x232c('0x49')]){_0x3e6898['include']=[{'all':!![]}];}_0x3e6898=_[_0x232c('0x47')]({},_0x3e6898,_0x371800['options']);return db[_0x232c('0x35')]['find'](_0x3e6898)['then'](handleEntityNotFound(_0xa45591,null))[_0x232c('0x2d')](respondWithResult(_0xa45591,null))[_0x232c('0x4c')](handleError(_0xa45591,null));};exports[_0x232c('0x4f')]=function(_0x3a9602,_0x59bfb5){return db[_0x232c('0x35')][_0x232c('0x4f')](_0x3a9602[_0x232c('0x50')],{})[_0x232c('0x2d')](function(_0x2bb528){var _0x49bc07=_0x3a9602[_0x232c('0x51')][_0x232c('0x52')]({'plain':!![]});if(!_0x49bc07)throw new Error(_0x232c('0x53'));if(_0x49bc07[_0x232c('0x54')]===_0x232c('0x51')){var _0x19d47d=_0x2bb528[_0x232c('0x52')]({'plain':!![]});var _0x1f8eab=_0x232c('0x2e');return db[_0x232c('0x55')]['find']({'where':{'name':_0x1f8eab,'userProfileId':_0x49bc07[_0x232c('0x56')]},'raw':!![]})[_0x232c('0x2d')](function(_0x2b4576){if(_0x2b4576&&_0x2b4576[_0x232c('0x57')]===0x0){return db[_0x232c('0x2f')][_0x232c('0x4f')]({'name':_0x19d47d[_0x232c('0x33')],'resourceId':_0x19d47d['id'],'type':_0x2b4576[_0x232c('0x33')],'sectionId':_0x2b4576['id']},{})[_0x232c('0x2d')](function(){return _0x2bb528;});}else{return _0x2bb528;}})[_0x232c('0x4c')](function(_0x2820b4){logger[_0x232c('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2820b4);throw _0x2820b4;});}return _0x2bb528;})[_0x232c('0x2d')](respondWithResult(_0x59bfb5,0xc9))[_0x232c('0x4c')](handleError(_0x59bfb5,null));};exports[_0x232c('0x2c')]=function(_0x25993a,_0x492035){if(_0x25993a['body']['id']){delete _0x25993a[_0x232c('0x50')]['id'];}return db[_0x232c('0x35')][_0x232c('0x58')]({'where':{'id':_0x25993a[_0x232c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x492035,null))[_0x232c('0x2d')](saveUpdates(_0x25993a['body'],null))[_0x232c('0x2d')](respondWithResult(_0x492035,null))[_0x232c('0x4c')](handleError(_0x492035,null));};exports['destroy']=function(_0x18768,_0x5ede39){return db[_0x232c('0x35')][_0x232c('0x58')]({'where':{'id':_0x18768[_0x232c('0x4d')]['id']}})[_0x232c('0x2d')](handleEntityNotFound(_0x5ede39,null))[_0x232c('0x2d')](removeEntity(_0x5ede39,null))[_0x232c('0x4c')](handleError(_0x5ede39,null));};exports[_0x232c('0x59')]=function(_0x13471a,_0x29d22c,_0x30b2ff){return db['Team'][_0x232c('0x5a')]({'where':{'id':_0x13471a['params']['id']}})[_0x232c('0x2d')](handleEntityNotFound(_0x29d22c,null))['then'](function(_0x1564e2){if(!_0x13471a[_0x232c('0x3a')]['channel']||!utils[_0x232c('0x5b')](_0x13471a[_0x232c('0x3a')][_0x232c('0x5c')])){throw new db[(_0x232c('0x5d'))]['ValidationError'](_0x232c('0x5e'));}var _0x45aa25={};var _0x48bf55={};_0x48bf55[_0x232c('0x39')]=_[_0x232c('0x4e')](db[_['capitalize'](_0x13471a[_0x232c('0x3a')][_0x232c('0x5c')][_0x232c('0x5f')]())+_0x232c('0x60')]['rawAttributes']);_0x48bf55['query']=_['keys'](_0x13471a[_0x232c('0x3a')]);_0x48bf55[_0x232c('0x3b')]=_['intersection'](_0x48bf55[_0x232c('0x39')],_0x48bf55[_0x232c('0x3a')]);_0x45aa25['attributes']=_[_0x232c('0x3d')](_0x48bf55['model'],qs['fields'](_0x13471a[_0x232c('0x3a')][_0x232c('0x3e')]));_0x45aa25[_0x232c('0x3c')]=_0x45aa25['attributes'][_0x232c('0x3f')]?_0x45aa25[_0x232c('0x3c')]:_0x48bf55[_0x232c('0x39')];_0x45aa25[_0x232c('0x26')]=qs['limit'](_0x13471a[_0x232c('0x3a')][_0x232c('0x26')]);_0x45aa25[_0x232c('0x25')]=qs['offset'](_0x13471a[_0x232c('0x3a')][_0x232c('0x25')]);_0x45aa25['order']=qs['sort'](_0x13471a[_0x232c('0x3a')]['sort']);_0x45aa25[_0x232c('0x44')]=qs['filters'](_[_0x232c('0x61')](_0x13471a[_0x232c('0x3a')],_0x48bf55[_0x232c('0x3b')]));_0x45aa25=_[_0x232c('0x47')]({},_0x45aa25,_0x13471a[_0x232c('0x48')]);return _0x1564e2[_0x232c('0x52')+_[_0x232c('0x62')](_0x13471a['query'][_0x232c('0x5c')]['toLowerCase']())+_0x232c('0x63')](_0x45aa25);})[_0x232c('0x2d')](respondWithResult(_0x29d22c,null))['catch'](handleError(_0x29d22c,null));};exports['addQueues']=function(_0x3b4d07,_0x2875f3,_0x202969){return db['Team'][_0x232c('0x5a')]({'where':{'id':_0x3b4d07[_0x232c('0x4d')]['id']}})[_0x232c('0x2d')](function(_0x11a5d6){if(_0x11a5d6){if(!_0x3b4d07[_0x232c('0x50')][_0x232c('0x5c')]||!utils[_0x232c('0x5b')](_0x3b4d07[_0x232c('0x50')]['channel'])){throw new db[(_0x232c('0x5d'))][(_0x232c('0x64'))](_0x232c('0x5e'));}return _0x11a5d6['add'+_[_0x232c('0x62')](_0x3b4d07['body'][_0x232c('0x5c')][_0x232c('0x5f')]())+'Queues'](_0x3b4d07[_0x232c('0x50')]['ids']);}return null;})['then'](handleEntityNotFound(_0x2875f3,null))['then'](respondWithStatusCode(_0x2875f3,null))[_0x232c('0x4c')](handleError(_0x2875f3,null));};exports[_0x232c('0x65')]=function(_0x1d2061,_0x29f5f5,_0x5f4a9b){return db[_0x232c('0x35')][_0x232c('0x5a')]({'where':{'id':_0x1d2061['params']['id']}})[_0x232c('0x2d')](function(_0x4f58bd){if(_0x4f58bd){if(!_0x1d2061[_0x232c('0x3a')][_0x232c('0x5c')]||!utils['isValidChannel'](_0x1d2061[_0x232c('0x3a')][_0x232c('0x5c')])){throw new db[(_0x232c('0x5d'))][(_0x232c('0x64'))]('Unknown\x20channel');}return _0x4f58bd[_0x232c('0x66')+_[_0x232c('0x62')](_0x1d2061['query'][_0x232c('0x5c')][_0x232c('0x5f')]())+_0x232c('0x63')](_0x1d2061[_0x232c('0x3a')][_0x232c('0x67')]);}return null;})[_0x232c('0x2d')](handleEntityNotFound(_0x29f5f5,null))[_0x232c('0x2d')](respondWithStatusCode(_0x29f5f5,null))[_0x232c('0x4c')](handleError(_0x29f5f5,null));};exports['addAgents']=function(_0x358b19,_0x64f409,_0x399cfe){return db[_0x232c('0x35')][_0x232c('0x58')]({'where':{'id':_0x358b19[_0x232c('0x4d')]['id']}})[_0x232c('0x2d')](handleEntityNotFound(_0x64f409,null))[_0x232c('0x2d')](function(_0x3d3060){if(_0x3d3060){var _0x439b19=[_0x232c('0x68'),_0x232c('0x69'),'Mail',_0x232c('0x6a'),_0x232c('0x6b'),'Openchannel','Whatsapp'];return BPromise[_0x232c('0x6c')](_0x439b19,function(_0x2c0bc4){return _0x3d3060['get'+_0x2c0bc4+_0x232c('0x63')]({'attributes':['id',_0x232c('0x33')]})['then'](function(_0x284774){return BPromise['each'](_0x284774,function(_0x4210bf){return _0x4210bf['addAgents'](_0x358b19[_0x232c('0x50')][_0x232c('0x67')])[_0x232c('0x2d')](function(){if(_0x2c0bc4===_0x232c('0x68')){return db[_0x232c('0x6d')][_0x232c('0x4b')]({'where':{'id':_0x358b19['body'][_0x232c('0x67')]},'attributes':['id',_0x232c('0x33'),'online',_0x232c('0x6e'),'interface'],'raw':!![]})['then'](function(_0x2a011c){return BPromise[_0x232c('0x6c')](_[_0x232c('0x45')](_0x2a011c,{'online':0x1}),function(_0x293a11){return db['UserVoiceQueueRt'][_0x232c('0x6f')]({'membername':_0x293a11[_0x232c('0x33')],'UserId':_0x293a11['id'],'queue_name':_0x4210bf[_0x232c('0x33')],'VoiceQueueId':_0x4210bf['id'],'interface':_[_0x232c('0x70')](_0x293a11[_0x232c('0x71')])?util[_0x232c('0x72')](_0x232c('0x73'),_0x293a11[_0x232c('0x33')]):_0x293a11[_0x232c('0x71')],'paused':_0x293a11[_0x232c('0x6e')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x3d3060;});})[_0x232c('0x2d')](function(){return _0x3d3060;});}})[_0x232c('0x2d')](function(_0x3e99f2){if(_0x3e99f2){return _0x3e99f2['addAgents'](_0x358b19['body']['ids'],_['omit'](_0x358b19[_0x232c('0x50')],['ids','id'])||{})[_0x232c('0x74')](function(_0x41c063){for(var _0x2f6ce5=0x0;_0x2f6ce5<_0x358b19[_0x232c('0x50')][_0x232c('0x67')]['length'];_0x2f6ce5+=0x1){socket[_0x232c('0x75')](_0x232c('0x76'),{'UserId':_0x358b19['body'][_0x232c('0x67')][_0x2f6ce5],'TeamId':_0x358b19[_0x232c('0x4d')]['id']});}return _0x41c063;});}})[_0x232c('0x2d')](respondWithResult(_0x64f409,null))[_0x232c('0x4c')](handleError(_0x64f409,null));};exports[_0x232c('0x77')]=function(_0x5026e0,_0x33667d,_0x6d56a7){return db[_0x232c('0x35')][_0x232c('0x58')]({'where':{'id':_0x5026e0[_0x232c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33667d,null))[_0x232c('0x2d')](function(_0x1ddb0f){if(_0x1ddb0f){return BPromise[_0x232c('0x6c')]([_0x232c('0x78'),_0x232c('0x79'),'mail',_0x232c('0x7a'),_0x232c('0x7b'),_0x232c('0x7c'),'whatsapp'],function(_0x15911b){return _0x1ddb0f['get'+_[_0x232c('0x62')](_0x15911b)+'Queues']({'attributes':['id',_0x232c('0x33')]})['then'](function(_0x336fdc){return BPromise[_0x232c('0x6c')](_0x336fdc,function(_0x4955f9){return _0x4955f9['removeAgents'](_0x5026e0[_0x232c('0x3a')][_0x232c('0x67')])['then'](function(){if(_0x15911b==='voice'){return db[_0x232c('0x7d')][_0x232c('0x30')]({'where':{'VoiceQueueId':_0x4955f9['id'],'UserId':_0x5026e0[_0x232c('0x3a')]['ids']}});}});});})[_0x232c('0x2d')](function(){return _0x1ddb0f;});})[_0x232c('0x2d')](function(){return _0x1ddb0f;});}})[_0x232c('0x2d')](function(_0x484017){if(_0x484017){return _0x484017['removeAgents'](_0x5026e0['query']['ids'])['then'](function(){if(_[_0x232c('0x7e')](_0x5026e0[_0x232c('0x3a')][_0x232c('0x67')])){for(var _0x3d8efc=0x0;_0x3d8efc<_0x5026e0['query'][_0x232c('0x67')][_0x232c('0x3f')];_0x3d8efc+=0x1){socket[_0x232c('0x75')]('userTeam:remove',{'UserId':Number(_0x5026e0[_0x232c('0x3a')][_0x232c('0x67')][_0x3d8efc]),'TeamId':Number(_0x5026e0[_0x232c('0x4d')]['id'])});}}else{socket[_0x232c('0x75')](_0x232c('0x7f'),{'UserId':Number(_0x5026e0['query'][_0x232c('0x67')]),'TeamId':Number(_0x5026e0['params']['id'])});}});}})[_0x232c('0x2d')](respondWithStatusCode(_0x33667d,null))[_0x232c('0x4c')](handleError(_0x33667d,null));};exports[_0x232c('0x80')]=function(_0x10aa78,_0x22d396,_0x5e7cd5){var _0x2463b3={};var _0x51f013={};var _0x1cade2;var _0x3e998d;return db[_0x232c('0x35')]['findOne']({'where':{'id':_0x10aa78[_0x232c('0x4d')]['id']}})[_0x232c('0x2d')](handleEntityNotFound(_0x22d396,null))[_0x232c('0x2d')](function(_0x35d3e5){if(_0x35d3e5){_0x1cade2=_0x35d3e5;_0x51f013[_0x232c('0x39')]=_[_0x232c('0x4e')](db[_0x232c('0x6d')][_0x232c('0x36')]);_0x51f013[_0x232c('0x3a')]=_[_0x232c('0x4e')](_0x10aa78[_0x232c('0x3a')]);_0x51f013[_0x232c('0x3b')]=_[_0x232c('0x3d')](_0x51f013['model'],_0x51f013[_0x232c('0x3a')]);_0x2463b3[_0x232c('0x3c')]=_[_0x232c('0x3d')](_0x51f013[_0x232c('0x39')],qs[_0x232c('0x3e')](_0x10aa78[_0x232c('0x3a')]['fields']));_0x2463b3['attributes']=_0x2463b3[_0x232c('0x3c')][_0x232c('0x3f')]?_0x2463b3[_0x232c('0x3c')]:_0x51f013[_0x232c('0x39')];_0x2463b3['order']=qs[_0x232c('0x43')](_0x10aa78[_0x232c('0x3a')][_0x232c('0x43')]);_0x2463b3[_0x232c('0x44')]=qs['filters'](_[_0x232c('0x61')](_0x10aa78[_0x232c('0x3a')],_0x51f013[_0x232c('0x3b')]));if(_0x10aa78[_0x232c('0x3a')][_0x232c('0x45')]){_0x2463b3[_0x232c('0x44')]=_[_0x232c('0x47')](_0x2463b3[_0x232c('0x44')],{'$or':_[_0x232c('0x34')](_0x2463b3[_0x232c('0x3c')],function(_0x3d0d4d){var _0x4fc62e={};_0x4fc62e[_0x3d0d4d]={'$like':'%'+_0x10aa78['query'][_0x232c('0x45')]+'%'};return _0x4fc62e;})});}_0x2463b3=_[_0x232c('0x47')]({},_0x2463b3,_0x10aa78[_0x232c('0x48')]);return _0x1cade2[_0x232c('0x80')](_0x2463b3);}})['then'](function(_0x198f67){if(_0x198f67){_0x3e998d=_0x198f67[_0x232c('0x3f')];if(!_0x10aa78[_0x232c('0x3a')][_0x232c('0x40')](_0x232c('0x41'))){_0x2463b3['limit']=qs[_0x232c('0x26')](_0x10aa78[_0x232c('0x3a')]['limit']);_0x2463b3[_0x232c('0x25')]=qs[_0x232c('0x25')](_0x10aa78['query'][_0x232c('0x25')]);}return _0x1cade2['getAgents'](_0x2463b3);}})['then'](function(_0x529d5a){if(_0x529d5a){return _0x529d5a?{'count':_0x3e998d,'rows':_0x529d5a}:null;}})[_0x232c('0x2d')](respondWithResult(_0x22d396,null))[_0x232c('0x4c')](handleError(_0x22d396,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8d9c40c..c812bf2 100644 --- a/server/api/team/team.events.js +++ b/server/api/team/team.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb343=['hook','exports','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x56ab67,_0x3a629){var _0x11ce56=function(_0x326500){while(--_0x326500){_0x56ab67['push'](_0x56ab67['shift']());}};_0x11ce56(++_0x3a629);}(_0xb343,0x1c4));var _0x3b34=function(_0x322849,_0x4fb81e){_0x322849=_0x322849-0x0;var _0x14b2c2=_0xb343[_0x322849];return _0x14b2c2;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x3b34('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x3b34('0x1')](0x0);var events={'afterCreate':_0x3b34('0x2'),'afterUpdate':_0x3b34('0x3'),'afterDestroy':_0x3b34('0x4')};function emitEvent(_0x27ac4c){return function(_0x4090a9,_0x3452d8,_0x2df28f){TeamEvents[_0x3b34('0x5')](_0x27ac4c+':'+_0x4090a9['id'],_0x4090a9);TeamEvents[_0x3b34('0x5')](_0x27ac4c,_0x4090a9);_0x2df28f(null);};}for(var e in events){if(events[_0x3b34('0x6')](e)){var event=events[e];Team[_0x3b34('0x7')](e,emitEvent(event));}}module[_0x3b34('0x8')]=TeamEvents; \ No newline at end of file +var _0x99d6=['emit','hook','events','../../mysqldb','save','update'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x99d6,0xf2));var _0x699d=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x99d6[_0x237da8];return _0x558825;};'use strict';var EventEmitter=require(_0x699d('0x0'));var Team=require(_0x699d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x699d('0x2'),'afterUpdate':_0x699d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5efbc9){return function(_0x4ff457,_0x502fd0,_0x21011e){TeamEvents[_0x699d('0x4')](_0x5efbc9+':'+_0x4ff457['id'],_0x4ff457);TeamEvents['emit'](_0x5efbc9,_0x4ff457);_0x21011e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x699d('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 71d5fbd..800f56e 100644 --- a/server/api/team/team.model.js +++ b/server/api/team/team.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27e3=['api','bluebird','request-promise','path','rimraf','exports','define','teams','lodash','util','../../config/logger'];(function(_0x511fad,_0x26cf29){var _0x4b61bd=function(_0x543692){while(--_0x543692){_0x511fad['push'](_0x511fad['shift']());}};_0x4b61bd(++_0x26cf29);}(_0x27e3,0x168));var _0x327e=function(_0x526b6f,_0x34bc07){_0x526b6f=_0x526b6f-0x0;var _0x6a5e88=_0x27e3[_0x526b6f];return _0x6a5e88;};'use strict';var _=require(_0x327e('0x0'));var util=require(_0x327e('0x1'));var logger=require(_0x327e('0x2'))(_0x327e('0x3'));var moment=require('moment');var BPromise=require(_0x327e('0x4'));var rp=require(_0x327e('0x5'));var fs=require('fs');var path=require(_0x327e('0x6'));var rimraf=require(_0x327e('0x7'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x327e('0x8')]=function(_0xc4f281,_0x1bdcc8){return _0xc4f281[_0x327e('0x9')]('Team',attributes,{'tableName':_0x327e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7cc=['bluebird','path','../../config/environment','./team.attributes','define','Team','teams','lodash','util','../../config/logger','api'];(function(_0x3b5524,_0xff6ab3){var _0x3b1331=function(_0xc5dbda){while(--_0xc5dbda){_0x3b5524['push'](_0x3b5524['shift']());}};_0x3b1331(++_0xff6ab3);}(_0xe7cc,0xc2));var _0xce7c=function(_0x31f6a9,_0x3b5ddb){_0x31f6a9=_0x31f6a9-0x0;var _0x153f35=_0xe7cc[_0x31f6a9];return _0x153f35;};'use strict';var _=require(_0xce7c('0x0'));var util=require(_0xce7c('0x1'));var logger=require(_0xce7c('0x2'))(_0xce7c('0x3'));var moment=require('moment');var BPromise=require(_0xce7c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce7c('0x5'));var rimraf=require('rimraf');var config=require(_0xce7c('0x6'));var attributes=require(_0xce7c('0x7'));module['exports']=function(_0x39ac6c,_0x38abc1){return _0x39ac6c[_0xce7c('0x8')](_0xce7c('0x9'),attributes,{'tableName':_0xce7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 8b5ac8d..241be23 100644 --- a/server/api/team/team.rpc.js +++ b/server/api/team/team.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ae1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','Team,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x4ae1,0x132));var _0x14ae=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0x4ae1[_0x1c0f41];return _0x369a9f;};'use strict';var _=require(_0x14ae('0x0'));var util=require(_0x14ae('0x1'));var moment=require(_0x14ae('0x2'));var BPromise=require(_0x14ae('0x3'));var rs=require(_0x14ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14ae('0x5'))['db'];var utils=require(_0x14ae('0x6'));var logger=require(_0x14ae('0x7'))(_0x14ae('0x8'));var config=require(_0x14ae('0x9'));var jayson=require(_0x14ae('0xa'));var client=jayson[_0x14ae('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x14ae('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x14ae('0xd'))(new Redis(config[_0x14ae('0xc')]));require(_0x14ae('0xe'))[_0x14ae('0xf')](socket);function respondWithRpcPromise(_0x4aa22a,_0x337ab9,_0x4ceee2){return new BPromise(function(_0x3bf7b2,_0x3ec09c){return client[_0x14ae('0x10')](_0x4aa22a,_0x4ceee2)[_0x14ae('0x11')](function(_0x4ad4af){logger[_0x14ae('0x12')]('Team,\x20%s,\x20%s',_0x337ab9,_0x14ae('0x13'));logger[_0x14ae('0x14')](_0x14ae('0x15'),_0x337ab9,'request\x20sent',JSON['stringify'](_0x4ad4af));if(_0x4ad4af['error']){if(_0x4ad4af['error']['code']===0x1f4){logger[_0x14ae('0x16')]('Team,\x20%s,\x20%s',_0x337ab9,_0x4ad4af['error']['message']);return _0x3ec09c(_0x4ad4af[_0x14ae('0x16')]['message']);}logger[_0x14ae('0x16')](_0x14ae('0x17'),_0x337ab9,_0x4ad4af[_0x14ae('0x16')][_0x14ae('0x18')]);return _0x3bf7b2(_0x4ad4af['error'][_0x14ae('0x18')]);}else{logger[_0x14ae('0x12')]('Team,\x20%s,\x20%s',_0x337ab9,_0x14ae('0x13'));_0x3bf7b2(_0x4ad4af[_0x14ae('0x19')]['message']);}})['catch'](function(_0xed1970){logger['error']('Team,\x20%s,\x20%s',_0x337ab9,_0xed1970);_0x3ec09c(_0xed1970);});});} \ No newline at end of file +var _0x0689=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x31a9d9,_0x32ae74){var _0x3832da=function(_0x5a4c10){while(--_0x5a4c10){_0x31a9d9['push'](_0x31a9d9['shift']());}};_0x3832da(++_0x32ae74);}(_0x0689,0xc4));var _0x9068=function(_0x221b76,_0x3ecddd){_0x221b76=_0x221b76-0x0;var _0x37d2eb=_0x0689[_0x221b76];return _0x37d2eb;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var moment=require(_0x9068('0x1'));var BPromise=require(_0x9068('0x2'));var rs=require(_0x9068('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9068('0x4'))['db'];var utils=require(_0x9068('0x5'));var logger=require(_0x9068('0x6'))('rpc');var config=require(_0x9068('0x7'));var jayson=require(_0x9068('0x8'));var client=jayson[_0x9068('0x9')][_0x9068('0xa')]({'port':0x232a});config[_0x9068('0xb')]=_[_0x9068('0xc')](config[_0x9068('0xb')],{'host':_0x9068('0xd'),'port':0x18eb});var socket=require(_0x9068('0xe'))(new Redis(config[_0x9068('0xb')]));require(_0x9068('0xf'))[_0x9068('0x10')](socket);function respondWithRpcPromise(_0x4ecdd8,_0x5b1e38,_0x145053){return new BPromise(function(_0x371ed6,_0x4b5882){return client[_0x9068('0x11')](_0x4ecdd8,_0x145053)[_0x9068('0x12')](function(_0x4d894f){logger['info'](_0x9068('0x13'),_0x5b1e38,'request\x20sent');logger['debug'](_0x9068('0x14'),_0x5b1e38,'request\x20sent',JSON[_0x9068('0x15')](_0x4d894f));if(_0x4d894f['error']){if(_0x4d894f['error'][_0x9068('0x16')]===0x1f4){logger[_0x9068('0x17')](_0x9068('0x13'),_0x5b1e38,_0x4d894f['error'][_0x9068('0x18')]);return _0x4b5882(_0x4d894f[_0x9068('0x17')]['message']);}logger[_0x9068('0x17')](_0x9068('0x13'),_0x5b1e38,_0x4d894f[_0x9068('0x17')][_0x9068('0x18')]);return _0x371ed6(_0x4d894f[_0x9068('0x17')][_0x9068('0x18')]);}else{logger[_0x9068('0x19')](_0x9068('0x13'),_0x5b1e38,_0x9068('0x1a'));_0x371ed6(_0x4d894f[_0x9068('0x1b')][_0x9068('0x18')]);}})[_0x9068('0x1c')](function(_0x439db1){logger[_0x9068('0x17')]('Team,\x20%s,\x20%s',_0x5b1e38,_0x439db1);_0x4b5882(_0x439db1);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f9c7cdd..f68ccf2 100644 --- a/server/api/team/team.socket.js +++ b/server/api/team/team.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97ce=['team:','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x97ce,0x151));var _0xe97c=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x97ce[_0x122096];return _0x3d1966;};'use strict';var TeamEvents=require(_0xe97c('0x0'));var events=[_0xe97c('0x1'),_0xe97c('0x2'),_0xe97c('0x3')];function createListener(_0x4d3faa,_0x39e994){return function(_0x4ff29b){_0x39e994[_0xe97c('0x4')](_0x4d3faa,_0x4ff29b);};}function removeListener(_0x49df42,_0x443ea2){return function(){TeamEvents[_0xe97c('0x5')](_0x49df42,_0x443ea2);};}exports[_0xe97c('0x6')]=function(_0x447030){for(var _0x29184f=0x0,_0x6603e0=events['length'];_0x29184f<_0x6603e0;_0x29184f++){var _0x3bf4ef=events[_0x29184f];var _0x9c1b00=createListener(_0xe97c('0x7')+_0x3bf4ef,_0x447030);TeamEvents['on'](_0x3bf4ef,_0x9c1b00);}}; \ No newline at end of file +var _0xf78f=['remove','update','length','team:','save'];(function(_0x12276f,_0x308738){var _0x4c2383=function(_0x4e4392){while(--_0x4e4392){_0x12276f['push'](_0x12276f['shift']());}};_0x4c2383(++_0x308738);}(_0xf78f,0x72));var _0xff78=function(_0x25a228,_0x77fd54){_0x25a228=_0x25a228-0x0;var _0x3aa8db=_0xf78f[_0x25a228];return _0x3aa8db;};'use strict';var TeamEvents=require('./team.events');var events=[_0xff78('0x0'),_0xff78('0x1'),_0xff78('0x2')];function createListener(_0x2be014,_0x1c54c2){return function(_0x2cf009){_0x1c54c2['emit'](_0x2be014,_0x2cf009);};}function removeListener(_0x48fe97,_0x5b8499){return function(){TeamEvents['removeListener'](_0x48fe97,_0x5b8499);};}exports['register']=function(_0x35f208){for(var _0x487ec1=0x0,_0x14edec=events[_0xff78('0x3')];_0x487ec1<_0x14edec;_0x487ec1++){var _0x437ed4=events[_0x487ec1];var _0x32df40=createListener(_0xff78('0x4')+_0x437ed4,_0x35f208);TeamEvents['on'](_0x437ed4,_0x32df40);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 25763c2..d19f811 100644 --- a/server/api/template/index.js +++ b/server/api/template/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3f2=['put','update','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x212d2f,_0x5a7a54){var _0x3773ca=function(_0x46777d){while(--_0x46777d){_0x212d2f['push'](_0x212d2f['shift']());}};_0x3773ca(++_0x5a7a54);}(_0xd3f2,0x170));var _0x2d3f=function(_0x204ce5,_0x46fb75){_0x204ce5=_0x204ce5-0x0;var _0x4f5a44=_0xd3f2[_0x204ce5];return _0x4f5a44;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2d3f('0x0'));var express=require(_0x2d3f('0x1'));var router=express[_0x2d3f('0x2')]();var auth=require(_0x2d3f('0x3'));var interaction=require(_0x2d3f('0x4'));var config=require(_0x2d3f('0x5'));var controller=require('./template.controller');router[_0x2d3f('0x6')]('/',auth[_0x2d3f('0x7')](),controller['index']);router[_0x2d3f('0x6')](_0x2d3f('0x8'),auth[_0x2d3f('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2d3f('0x9')]('/:id',auth[_0x2d3f('0x7')](),controller[_0x2d3f('0xa')]);router[_0x2d3f('0xb')](_0x2d3f('0x8'),auth['isAuthenticated'](),controller[_0x2d3f('0xc')]);module['exports']=router; \ No newline at end of file +var _0x3155=['/:id','show','post','create','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x3d4e91,_0x3218ed){var _0x47f62d=function(_0x50cea5){while(--_0x50cea5){_0x3d4e91['push'](_0x3d4e91['shift']());}};_0x47f62d(++_0x3218ed);}(_0x3155,0x179));var _0x5315=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x3155[_0x14e27a];return _0x288688;};'use strict';var multer=require(_0x5315('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5315('0x1'));var router=express[_0x5315('0x2')]();var auth=require(_0x5315('0x3'));var interaction=require(_0x5315('0x4'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x5315('0x5')]('/',auth[_0x5315('0x6')](),controller['index']);router[_0x5315('0x5')](_0x5315('0x7'),auth[_0x5315('0x6')](),controller[_0x5315('0x8')]);router[_0x5315('0x9')]('/',auth['isAuthenticated'](),controller[_0x5315('0xa')]);router[_0x5315('0xb')](_0x5315('0x7'),auth['isAuthenticated'](),controller[_0x5315('0xc')]);router[_0x5315('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5315('0xe')]);module[_0x5315('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0d68645..8a8a11a 100644 --- a/server/api/template/template.attributes.js +++ b/server/api/template/template.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ca0=['sequelize','exports','STRING','TEXT'];(function(_0x271d7e,_0x497dc2){var _0x26d833=function(_0x3a0518){while(--_0x3a0518){_0x271d7e['push'](_0x271d7e['shift']());}};_0x26d833(++_0x497dc2);}(_0x4ca0,0x178));var _0x04ca=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x4ca0[_0x121b1a];return _0x2d89a6;};'use strict';var Sequelize=require(_0x04ca('0x0'));module[_0x04ca('0x1')]={'name':{'type':Sequelize[_0x04ca('0x2')]},'description':{'type':Sequelize[_0x04ca('0x2')]},'html':{'type':Sequelize[_0x04ca('0x3')]}}; \ No newline at end of file +var _0xe060=['sequelize','exports','STRING','TEXT'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0xe060,0x150));var _0x0e06=function(_0x24f0b8,_0x3ce0ab){_0x24f0b8=_0x24f0b8-0x0;var _0x43b0d4=_0xe060[_0x24f0b8];return _0x43b0d4;};'use strict';var Sequelize=require(_0x0e06('0x0'));module[_0x0e06('0x1')]={'name':{'type':Sequelize[_0x0e06('0x2')]},'description':{'type':Sequelize[_0x0e06('0x2')]},'html':{'type':Sequelize[_0x0e06('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6918846..1935eca 100644 --- a/server/api/template/template.controller.js +++ b/server/api/template/template.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['UserProfileResource','error','stack','name','index','map','Template','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','then','destroy','get','Templates'];(function(_0x3ed3fd,_0x520983){var _0x385d94=function(_0x113b29){while(--_0x113b29){_0x3ed3fd['push'](_0x3ed3fd['shift']());}};_0x385d94(++_0x520983);}(_0x326f,0xd1));var _0xf326=function(_0x1beaa3,_0x49f6ff){_0x1beaa3=_0x1beaa3-0x0;var _0x5ccf04=_0x326f[_0x1beaa3];return _0x5ccf04;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=_0x1f2e5a[_0xf326('0x1a')],_0x292f4b=_0x11f6d2['offset'],_0x287a2a=_0x11f6d2[_0xf326('0x1b')]+_0x11f6d2[_0xf326('0x1c')],_0x34128e;if(_0x287a2a>=_0xa63d1a){_0x287a2a=_0xa63d1a;_0x34128e=0xc8;}else{_0x34128e=0xce;}_0xdf21d9[_0xf326('0x18')](_0x34128e);return _0xdf21d9[_0xf326('0x1d')](_0xf326('0x1e'),_0x292f4b+'-'+_0x287a2a+'/'+_0xa63d1a)[_0xf326('0x1f')](_0x1f2e5a);}return null;};}function patchUpdates(_0x4d3d41){return function(_0x4a5b6c){try{jsonpatch['apply'](_0x4a5b6c,_0x4d3d41,!![]);}catch(_0x16e605){return BPromise[_0xf326('0x20')](_0x16e605);}return _0x4a5b6c['save']();};}function saveUpdates(_0x4cabce,_0x128c68){return function(_0x4dfa76){if(_0x4dfa76){return _0x4dfa76['update'](_0x4cabce)[_0xf326('0x21')](function(_0x18ead3){return _0x18ead3;});}return null;};}function removeEntity(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')]()['then'](function(){var _0x337ed5=_0x19b8ba[_0xf326('0x23')]({'plain':!![]});var _0x43c53e=_0xf326('0x24');return db[_0xf326('0x25')][_0xf326('0x22')]({'where':{'type':_0x43c53e,'resourceId':_0x337ed5['id']}})['then'](function(){return _0x19b8ba;});})['then'](function(){_0x549b46['status'](0xcc)[_0xf326('0x19')]();});}};}function handleEntityNotFound(_0x1a2c4e,_0x2cd45a){return function(_0x1ff2b5){if(!_0x1ff2b5){_0x1a2c4e[_0xf326('0x17')](0x194);}return _0x1ff2b5;};}function handleError(_0x410237,_0x5217d4){_0x5217d4=_0x5217d4||0x1f4;return function(_0x201d28){logger[_0xf326('0x26')](_0x201d28[_0xf326('0x27')]);if(_0x201d28['name']){delete _0x201d28[_0xf326('0x28')];}_0x410237['status'](_0x5217d4)['send'](_0x201d28);};}exports[_0xf326('0x29')]=function(_0x1ae23a,_0x2fa28e){var _0x5dbe63={},_0xc115d9={},_0x292500={'count':0x0,'rows':[]};var _0x55790d=_[_0xf326('0x2a')](db[_0xf326('0x2b')][_0xf326('0x2c')],function(_0x18d110){return{'name':_0x18d110[_0xf326('0x2d')],'type':_0x18d110[_0xf326('0x2e')][_0xf326('0x2f')]};});_0xc115d9[_0xf326('0x30')]=_[_0xf326('0x2a')](_0x55790d,_0xf326('0x28'));_0xc115d9['query']=_[_0xf326('0x31')](_0x1ae23a[_0xf326('0x32')]);_0xc115d9[_0xf326('0x33')]=_['intersection'](_0xc115d9[_0xf326('0x30')],_0xc115d9[_0xf326('0x32')]);_0x5dbe63[_0xf326('0x34')]=_['intersection'](_0xc115d9['model'],qs[_0xf326('0x35')](_0x1ae23a[_0xf326('0x32')][_0xf326('0x35')]));_0x5dbe63[_0xf326('0x34')]=_0x5dbe63[_0xf326('0x34')][_0xf326('0x36')]?_0x5dbe63[_0xf326('0x34')]:_0xc115d9[_0xf326('0x30')];if(!_0x1ae23a['query'][_0xf326('0x37')](_0xf326('0x38'))){_0x5dbe63['limit']=qs[_0xf326('0x1c')](_0x1ae23a['query'][_0xf326('0x1c')]);_0x5dbe63['offset']=qs['offset'](_0x1ae23a[_0xf326('0x32')]['offset']);}_0x5dbe63[_0xf326('0x39')]=qs['sort'](_0x1ae23a[_0xf326('0x32')][_0xf326('0x3a')]);_0x5dbe63[_0xf326('0x3b')]=qs['filters'](_[_0xf326('0x3c')](_0x1ae23a[_0xf326('0x32')],_0xc115d9['filters']),_0x55790d);if(_0x1ae23a[_0xf326('0x32')][_0xf326('0x3d')]){_0x5dbe63[_0xf326('0x3b')]=_[_0xf326('0x3e')](_0x5dbe63['where'],{'$or':_[_0xf326('0x2a')](_0x55790d,function(_0xb1ef35){if(_0xb1ef35[_0xf326('0x2e')]!==_0xf326('0x3f')){var _0x1d88ed={};_0x1d88ed[_0xb1ef35['name']]={'$like':'%'+_0x1ae23a[_0xf326('0x32')][_0xf326('0x3d')]+'%'};return _0x1d88ed;}})});}_0x5dbe63=_['merge']({},_0x5dbe63,_0x1ae23a['options']);var _0x40564e={'where':_0x5dbe63['where']};return db['Template'][_0xf326('0x1a')](_0x40564e)['then'](function(_0x3e1e8c){_0x292500[_0xf326('0x1a')]=_0x3e1e8c;if(_0x1ae23a[_0xf326('0x32')][_0xf326('0x40')]){_0x5dbe63['include']=[{'all':!![]}];}return db[_0xf326('0x2b')][_0xf326('0x41')](_0x5dbe63);})[_0xf326('0x21')](function(_0x365627){_0x292500[_0xf326('0x42')]=_0x365627;return _0x292500;})[_0xf326('0x21')](respondWithFilteredResult(_0x2fa28e,_0x5dbe63))[_0xf326('0x43')](handleError(_0x2fa28e,null));};exports[_0xf326('0x44')]=function(_0x31283b,_0x1227d3){var _0x361776={'raw':!![],'where':{'id':_0x31283b['params']['id']}},_0x2bab13={};_0x2bab13[_0xf326('0x30')]=_[_0xf326('0x31')](db[_0xf326('0x2b')][_0xf326('0x2c')]);_0x2bab13[_0xf326('0x32')]=_[_0xf326('0x31')](_0x31283b['query']);_0x2bab13[_0xf326('0x33')]=_[_0xf326('0x45')](_0x2bab13['model'],_0x2bab13[_0xf326('0x32')]);_0x361776[_0xf326('0x34')]=_[_0xf326('0x45')](_0x2bab13[_0xf326('0x30')],qs[_0xf326('0x35')](_0x31283b['query']['fields']));_0x361776[_0xf326('0x34')]=_0x361776[_0xf326('0x34')]['length']?_0x361776['attributes']:_0x2bab13[_0xf326('0x30')];if(_0x31283b[_0xf326('0x32')][_0xf326('0x40')]){_0x361776['include']=[{'all':!![]}];}_0x361776=_[_0xf326('0x3e')]({},_0x361776,_0x31283b[_0xf326('0x46')]);return db[_0xf326('0x2b')][_0xf326('0x47')](_0x361776)[_0xf326('0x21')](handleEntityNotFound(_0x1227d3,null))[_0xf326('0x21')](respondWithResult(_0x1227d3,null))[_0xf326('0x43')](handleError(_0x1227d3,null));};exports[_0xf326('0x48')]=function(_0x3df9a8,_0x27ced1){return db[_0xf326('0x2b')][_0xf326('0x48')](_0x3df9a8[_0xf326('0x49')],{})[_0xf326('0x21')](function(_0xeac1a1){var _0x59f9a7=_0x3df9a8[_0xf326('0x4a')][_0xf326('0x23')]({'plain':!![]});if(!_0x59f9a7)throw new Error(_0xf326('0x4b'));if(_0x59f9a7[_0xf326('0x4c')]==='user'){var _0x10f437=_0xeac1a1[_0xf326('0x23')]({'plain':!![]});var _0xca88e=_0xf326('0x24');return db['UserProfileSection'][_0xf326('0x47')]({'where':{'name':_0xca88e,'userProfileId':_0x59f9a7[_0xf326('0x4d')]},'raw':!![]})[_0xf326('0x21')](function(_0x451ac7){if(_0x451ac7&&_0x451ac7[_0xf326('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x10f437[_0xf326('0x28')],'resourceId':_0x10f437['id'],'type':_0x451ac7[_0xf326('0x28')],'sectionId':_0x451ac7['id']},{})[_0xf326('0x21')](function(){return _0xeac1a1;});}else{return _0xeac1a1;}})['catch'](function(_0x102fba){logger[_0xf326('0x26')](_0xf326('0x4f'),_0x102fba);throw _0x102fba;});}return _0xeac1a1;})['then'](respondWithResult(_0x27ced1,0xc9))['catch'](handleError(_0x27ced1,null));};exports[_0xf326('0x50')]=function(_0x5b4832,_0x1cf58f){if(_0x5b4832['body']['id']){delete _0x5b4832[_0xf326('0x49')]['id'];}return db[_0xf326('0x2b')][_0xf326('0x47')]({'where':{'id':_0x5b4832[_0xf326('0x51')]['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x1cf58f,null))[_0xf326('0x21')](saveUpdates(_0x5b4832[_0xf326('0x49')],null))['then'](respondWithResult(_0x1cf58f,null))[_0xf326('0x43')](handleError(_0x1cf58f,null));};exports[_0xf326('0x22')]=function(_0x424d24,_0x4b0d8e){return db[_0xf326('0x2b')][_0xf326('0x47')]({'where':{'id':_0x424d24[_0xf326('0x51')]['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x4b0d8e,null))[_0xf326('0x21')](removeEntity(_0x4b0d8e,null))['catch'](handleError(_0x4b0d8e,null));}; \ No newline at end of file +var _0x7217=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','name','send','index','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','Template','count','includeAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x3ccc1c,_0x37ed12){var _0x3bc6a1=function(_0x1b64f2){while(--_0x1b64f2){_0x3ccc1c['push'](_0x3ccc1c['shift']());}};_0x3bc6a1(++_0x37ed12);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=_0x4b183e['count'],_0x25a628=_0x4e199a[_0x7721('0x1f')],_0x3cc909=_0x4e199a['offset']+_0x4e199a[_0x7721('0x20')],_0x32550d;if(_0x3cc909>=_0x5ed54){_0x3cc909=_0x5ed54;_0x32550d=0xc8;}else{_0x32550d=0xce;}_0x534f1b['status'](_0x32550d);return _0x534f1b[_0x7721('0x21')](_0x7721('0x22'),_0x25a628+'-'+_0x3cc909+'/'+_0x5ed54)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0x3e140d){return function(_0x2286e5){try{jsonpatch[_0x7721('0x23')](_0x2286e5,_0x3e140d,!![]);}catch(_0x402820){return BPromise[_0x7721('0x24')](_0x402820);}return _0x2286e5[_0x7721('0x25')]();};}function saveUpdates(_0xaeccc4,_0x4ce1db){return function(_0x288f7e){if(_0x288f7e){return _0x288f7e[_0x7721('0x26')](_0xaeccc4)[_0x7721('0x27')](function(_0xd8ad3c){return _0xd8ad3c;});}return null;};}function removeEntity(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')]()[_0x7721('0x27')](function(){var _0x3e8a4e=_0x512f31[_0x7721('0x29')]({'plain':!![]});var _0x121cc4=_0x7721('0x2a');return db[_0x7721('0x2b')]['destroy']({'where':{'type':_0x121cc4,'resourceId':_0x3e8a4e['id']}})[_0x7721('0x27')](function(){return _0x512f31;});})[_0x7721('0x27')](function(){_0x57140c[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x40d550,_0x16355a){return function(_0x424e05){if(!_0x424e05){_0x40d550[_0x7721('0x2c')](0x194);}return _0x424e05;};}function handleError(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0x1f4;return function(_0x258ddf){logger['error'](_0x258ddf['stack']);if(_0x258ddf[_0x7721('0x2d')]){delete _0x258ddf[_0x7721('0x2d')];}_0x40f367[_0x7721('0x1c')](_0x52316e)[_0x7721('0x2e')](_0x258ddf);};}exports[_0x7721('0x2f')]=function(_0x37b9f0,_0xd7d703){var _0x1da2d8={},_0x5c54f0={},_0x471651={'count':0x0,'rows':[]};var _0x2871c5=_['map'](db['Template'][_0x7721('0x30')],function(_0x220bbf){return{'name':_0x220bbf['fieldName'],'type':_0x220bbf[_0x7721('0x31')][_0x7721('0x32')]};});_0x5c54f0[_0x7721('0x33')]=_['map'](_0x2871c5,_0x7721('0x2d'));_0x5c54f0[_0x7721('0x34')]=_[_0x7721('0x35')](_0x37b9f0[_0x7721('0x34')]);_0x5c54f0[_0x7721('0x36')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],_0x5c54f0[_0x7721('0x34')]);_0x1da2d8[_0x7721('0x37')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],qs[_0x7721('0x38')](_0x37b9f0['query'][_0x7721('0x38')]));_0x1da2d8['attributes']=_0x1da2d8[_0x7721('0x37')][_0x7721('0x39')]?_0x1da2d8[_0x7721('0x37')]:_0x5c54f0[_0x7721('0x33')];if(!_0x37b9f0[_0x7721('0x34')][_0x7721('0x3a')](_0x7721('0x3b'))){_0x1da2d8[_0x7721('0x20')]=qs[_0x7721('0x20')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x20')]);_0x1da2d8['offset']=qs[_0x7721('0x1f')](_0x37b9f0['query'][_0x7721('0x1f')]);}_0x1da2d8[_0x7721('0x3c')]=qs[_0x7721('0x3d')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x3d')]);_0x1da2d8[_0x7721('0x3e')]=qs['filters'](_['pick'](_0x37b9f0['query'],_0x5c54f0['filters']),_0x2871c5);if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x3f')]){_0x1da2d8[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x1da2d8['where'],{'$or':_[_0x7721('0x41')](_0x2871c5,function(_0x4cf659){if(_0x4cf659[_0x7721('0x31')]!==_0x7721('0x42')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x2d')]]={'$like':'%'+_0x37b9f0[_0x7721('0x34')]['filter']+'%'};return _0x5a278e;}})});}_0x1da2d8=_['merge']({},_0x1da2d8,_0x37b9f0[_0x7721('0x43')]);var _0xfc4dc4={'where':_0x1da2d8[_0x7721('0x3e')]};return db[_0x7721('0x44')]['count'](_0xfc4dc4)[_0x7721('0x27')](function(_0x120de9){_0x471651[_0x7721('0x45')]=_0x120de9;if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x46')]){_0x1da2d8['include']=[{'all':!![]}];}return db[_0x7721('0x44')]['findAll'](_0x1da2d8);})[_0x7721('0x27')](function(_0x4a5b59){_0x471651[_0x7721('0x47')]=_0x4a5b59;return _0x471651;})[_0x7721('0x27')](respondWithFilteredResult(_0xd7d703,_0x1da2d8))[_0x7721('0x48')](handleError(_0xd7d703,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':!![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x35')](db[_0x7721('0x44')][_0x7721('0x30')]);_0x481fa8[_0x7721('0x34')]=_[_0x7721('0x35')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x34')]);_0x1ad315[_0x7721('0x37')]=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x38')](_0x1453d4[_0x7721('0x34')][_0x7721('0x38')]));_0x1ad315[_0x7721('0x37')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x37')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x34')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x40')]({},_0x1ad315,_0x1453d4[_0x7721('0x43')]);return db['Template'][_0x7721('0x4b')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x27')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4c')]=function(_0x196be4,_0xf17c40){return db['Template'][_0x7721('0x4c')](_0x196be4[_0x7721('0x4d')],{})['then'](function(_0x223d93){var _0x1196c2=_0x196be4[_0x7721('0x4e')]['get']({'plain':!![]});if(!_0x1196c2)throw new Error(_0x7721('0x4f'));if(_0x1196c2['role']===_0x7721('0x4e')){var _0x310549=_0x223d93[_0x7721('0x29')]({'plain':!![]});var _0x443503=_0x7721('0x2a');return db[_0x7721('0x50')][_0x7721('0x4b')]({'where':{'name':_0x443503,'userProfileId':_0x1196c2[_0x7721('0x51')]},'raw':!![]})[_0x7721('0x27')](function(_0x3386aa){if(_0x3386aa&&_0x3386aa[_0x7721('0x52')]===0x0){return db[_0x7721('0x2b')][_0x7721('0x4c')]({'name':_0x310549[_0x7721('0x2d')],'resourceId':_0x310549['id'],'type':_0x3386aa[_0x7721('0x2d')],'sectionId':_0x3386aa['id']},{})['then'](function(){return _0x223d93;});}else{return _0x223d93;}})[_0x7721('0x48')](function(_0x2f6f30){logger[_0x7721('0x53')](_0x7721('0x54'),_0x2f6f30);throw _0x2f6f30;});}return _0x223d93;})[_0x7721('0x27')](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x26')]=function(_0x57484c,_0x234bee){if(_0x57484c[_0x7721('0x4d')]['id']){delete _0x57484c[_0x7721('0x4d')]['id'];}return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x57484c[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0x234bee,null))[_0x7721('0x27')](saveUpdates(_0x57484c[_0x7721('0x4d')],null))[_0x7721('0x27')](respondWithResult(_0x234bee,null))[_0x7721('0x48')](handleError(_0x234bee,null));};exports['destroy']=function(_0x421c27,_0xadb365){return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x421c27[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0xadb365,null))[_0x7721('0x27')](removeEntity(_0xadb365,null))[_0x7721('0x48')](handleError(_0xadb365,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 76d5a61..a40a469 100644 --- a/server/api/template/template.model.js +++ b/server/api/template/template.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36e2=['bluebird','request-promise','path','rimraf','./template.attributes','exports','Template','tools_templates','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x36e2,0xc8));var _0x236e=function(_0x101e51,_0x5d055f){_0x101e51=_0x101e51-0x0;var _0x2902e8=_0x36e2[_0x101e51];return _0x2902e8;};'use strict';var _=require('lodash');var util=require(_0x236e('0x0'));var logger=require(_0x236e('0x1'))(_0x236e('0x2'));var moment=require(_0x236e('0x3'));var BPromise=require(_0x236e('0x4'));var rp=require(_0x236e('0x5'));var fs=require('fs');var path=require(_0x236e('0x6'));var rimraf=require(_0x236e('0x7'));var config=require('../../config/environment');var attributes=require(_0x236e('0x8'));module[_0x236e('0x9')]=function(_0x3eba21,_0x567063){return _0x3eba21['define'](_0x236e('0xa'),attributes,{'tableName':_0x236e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf13c=['util','moment','bluebird','request-promise','path','rimraf','./template.attributes','exports','define','tools_templates','lodash'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf13c,0x1b7));var _0xcf13=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xf13c[_0xd0a847];return _0x2536ec;};'use strict';var _=require(_0xcf13('0x0'));var util=require(_0xcf13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcf13('0x2'));var BPromise=require(_0xcf13('0x3'));var rp=require(_0xcf13('0x4'));var fs=require('fs');var path=require(_0xcf13('0x5'));var rimraf=require(_0xcf13('0x6'));var config=require('../../config/environment');var attributes=require(_0xcf13('0x7'));module[_0xcf13('0x8')]=function(_0x8af4fe,_0x4952ca){return _0x8af4fe[_0xcf13('0x9')]('Template',attributes,{'tableName':_0xcf13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 64aeb13..bb8ff9e 100644 --- a/server/api/template/template.rpc.js +++ b/server/api/template/template.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x036b=['stringify','error','code','message','catch','GetTemplate','options','raw','where','attributes','limit','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x036b,0xa4));var _0xb036=function(_0x176e9e,_0x3dfe11){_0x176e9e=_0x176e9e-0x0;var _0x1b675f=_0x036b[_0x176e9e];return _0x1b675f;};'use strict';var _=require('lodash');var util=require(_0xb036('0x0'));var moment=require(_0xb036('0x1'));var BPromise=require(_0xb036('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb036('0x3'));var db=require(_0xb036('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb036('0x5'))(_0xb036('0x6'));var config=require(_0xb036('0x7'));var jayson=require(_0xb036('0x8'));var client=jayson[_0xb036('0x9')][_0xb036('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34cfa4,_0x33ddf2,_0x15f8e1){return new BPromise(function(_0x6ab309,_0xd0e0bb){return client[_0xb036('0xb')](_0x34cfa4,_0x15f8e1)['then'](function(_0x44383e){logger[_0xb036('0xc')](_0xb036('0xd'),_0x33ddf2,_0xb036('0xe'));logger[_0xb036('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x33ddf2,_0xb036('0xe'),JSON[_0xb036('0x10')](_0x44383e));if(_0x44383e[_0xb036('0x11')]){if(_0x44383e['error'][_0xb036('0x12')]===0x1f4){logger[_0xb036('0x11')](_0xb036('0xd'),_0x33ddf2,_0x44383e[_0xb036('0x11')][_0xb036('0x13')]);return _0xd0e0bb(_0x44383e[_0xb036('0x11')][_0xb036('0x13')]);}logger['error'](_0xb036('0xd'),_0x33ddf2,_0x44383e['error'][_0xb036('0x13')]);return _0x6ab309(_0x44383e[_0xb036('0x11')]['message']);}else{logger['info'](_0xb036('0xd'),_0x33ddf2,_0xb036('0xe'));_0x6ab309(_0x44383e['result'][_0xb036('0x13')]);}})[_0xb036('0x14')](function(_0x394321){logger['error'](_0xb036('0xd'),_0x33ddf2,_0x394321);_0xd0e0bb(_0x394321);});});}exports[_0xb036('0x15')]=function(_0x2de74b){var _0x148a72=this;return new Promise(function(_0x4b9504,_0x1d5acf){return db['Template']['findAll']({'raw':_0x2de74b[_0xb036('0x16')]?_0x2de74b[_0xb036('0x16')][_0xb036('0x17')]===undefined?!![]:![]:!![],'where':_0x2de74b['options']?_0x2de74b['options'][_0xb036('0x18')]||null:null,'attributes':_0x2de74b[_0xb036('0x16')]?_0x2de74b['options'][_0xb036('0x19')]||null:null,'limit':_0x2de74b[_0xb036('0x16')]?_0x2de74b[_0xb036('0x16')][_0xb036('0x1a')]||null:null,'include':_0x2de74b[_0xb036('0x16')]?_0x2de74b[_0xb036('0x16')][_0xb036('0x1b')]?_['map'](_0x2de74b['options'][_0xb036('0x1b')],function(_0x20de14){return{'model':db[_0x20de14['model']],'as':_0x20de14['as'],'attributes':_0x20de14[_0xb036('0x19')],'include':_0x20de14[_0xb036('0x1b')]?_['map'](_0x20de14[_0xb036('0x1b')],function(_0x3aa891){return{'model':db[_0x3aa891['model']],'as':_0x3aa891['as'],'attributes':_0x3aa891['attributes'],'include':_0x3aa891[_0xb036('0x1b')]?_[_0xb036('0x1c')](_0x3aa891['include'],function(_0x19298b){return{'model':db[_0x19298b[_0xb036('0x1d')]],'as':_0x19298b['as'],'attributes':_0x19298b[_0xb036('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x148813){logger[_0xb036('0xc')](_0xb036('0x15'),_0x2de74b);logger[_0xb036('0xf')](_0xb036('0x15'),_0x2de74b,JSON['stringify'](_0x148813));_0x4b9504(_0x148813);})[_0xb036('0x14')](function(_0x3febf9){logger[_0xb036('0x11')](_0xb036('0x15'),_0x3febf9[_0xb036('0x13')],_0x2de74b);_0x1d5acf(_0x148a72[_0xb036('0x11')](0x1f4,_0x3febf9['message']));});});}; \ No newline at end of file +var _0xb69b=['attributes','limit','include','map','model','debug','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetTemplate','findAll','options'];(function(_0x226054,_0x159a6c){var _0x44f7d8=function(_0xcd629e){while(--_0xcd629e){_0x226054['push'](_0x226054['shift']());}};_0x44f7d8(++_0x159a6c);}(_0xb69b,0x93));var _0xbb69=function(_0x2199ea,_0x52ee8e){_0x2199ea=_0x2199ea-0x0;var _0x4a7a43=_0xb69b[_0x2199ea];return _0x4a7a43;};'use strict';var _=require('lodash');var util=require(_0xbb69('0x0'));var moment=require('moment');var BPromise=require(_0xbb69('0x1'));var rs=require(_0xbb69('0x2'));var fs=require('fs');var Redis=require(_0xbb69('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb69('0x4'));var logger=require(_0xbb69('0x5'))(_0xbb69('0x6'));var config=require(_0xbb69('0x7'));var jayson=require(_0xbb69('0x8'));var client=jayson['client'][_0xbb69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dbcf6,_0x1bf03a,_0x1681e1){return new BPromise(function(_0x34cc02,_0x21ac1d){return client['request'](_0x1dbcf6,_0x1681e1)[_0xbb69('0xa')](function(_0x5d09da){logger[_0xbb69('0xb')](_0xbb69('0xc'),_0x1bf03a,_0xbb69('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x1bf03a,_0xbb69('0xd'),JSON[_0xbb69('0xe')](_0x5d09da));if(_0x5d09da[_0xbb69('0xf')]){if(_0x5d09da[_0xbb69('0xf')][_0xbb69('0x10')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x1bf03a,_0x5d09da[_0xbb69('0xf')][_0xbb69('0x11')]);return _0x21ac1d(_0x5d09da[_0xbb69('0xf')][_0xbb69('0x11')]);}logger[_0xbb69('0xf')](_0xbb69('0xc'),_0x1bf03a,_0x5d09da[_0xbb69('0xf')][_0xbb69('0x11')]);return _0x34cc02(_0x5d09da[_0xbb69('0xf')]['message']);}else{logger['info'](_0xbb69('0xc'),_0x1bf03a,_0xbb69('0xd'));_0x34cc02(_0x5d09da['result']['message']);}})['catch'](function(_0x5dd193){logger[_0xbb69('0xf')](_0xbb69('0xc'),_0x1bf03a,_0x5dd193);_0x21ac1d(_0x5dd193);});});}exports[_0xbb69('0x12')]=function(_0x593e45){var _0x1d4cd0=this;return new Promise(function(_0x2e1154,_0x4422e2){return db['Template'][_0xbb69('0x13')]({'raw':_0x593e45['options']?_0x593e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x593e45[_0xbb69('0x14')]?_0x593e45[_0xbb69('0x14')]['where']||null:null,'attributes':_0x593e45[_0xbb69('0x14')]?_0x593e45[_0xbb69('0x14')][_0xbb69('0x15')]||null:null,'limit':_0x593e45[_0xbb69('0x14')]?_0x593e45[_0xbb69('0x14')][_0xbb69('0x16')]||null:null,'include':_0x593e45[_0xbb69('0x14')]?_0x593e45['options'][_0xbb69('0x17')]?_[_0xbb69('0x18')](_0x593e45[_0xbb69('0x14')][_0xbb69('0x17')],function(_0x386eec){return{'model':db[_0x386eec['model']],'as':_0x386eec['as'],'attributes':_0x386eec[_0xbb69('0x15')],'include':_0x386eec[_0xbb69('0x17')]?_[_0xbb69('0x18')](_0x386eec[_0xbb69('0x17')],function(_0x29de0f){return{'model':db[_0x29de0f[_0xbb69('0x19')]],'as':_0x29de0f['as'],'attributes':_0x29de0f[_0xbb69('0x15')],'include':_0x29de0f['include']?_[_0xbb69('0x18')](_0x29de0f[_0xbb69('0x17')],function(_0x4b507e){return{'model':db[_0x4b507e[_0xbb69('0x19')]],'as':_0x4b507e['as'],'attributes':_0x4b507e[_0xbb69('0x15')]};}):[]};}):[]};}):[]:[]})[_0xbb69('0xa')](function(_0x11fbd2){logger['info']('GetTemplate',_0x593e45);logger[_0xbb69('0x1a')]('GetTemplate',_0x593e45,JSON[_0xbb69('0xe')](_0x11fbd2));_0x2e1154(_0x11fbd2);})[_0xbb69('0x1b')](function(_0x2903e3){logger['error'](_0xbb69('0x12'),_0x2903e3[_0xbb69('0x11')],_0x593e45);_0x4422e2(_0x1d4cd0[_0xbb69('0xf')](0x1f4,_0x2903e3[_0xbb69('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 82855cb..6be870b 100644 --- a/server/api/trigger/index.js +++ b/server/api/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e09=['put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','isAuthenticated','index','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAnyCondition','addAction'];(function(_0x2eca28,_0x10cc78){var _0x275de4=function(_0x56d109){while(--_0x56d109){_0x2eca28['push'](_0x2eca28['shift']());}};_0x275de4(++_0x10cc78);}(_0x2e09,0x1ba));var _0x92e0=function(_0x419ce7,_0x586f39){_0x419ce7=_0x419ce7-0x0;var _0x106617=_0x2e09[_0x419ce7];return _0x106617;};'use strict';var multer=require(_0x92e0('0x0'));var util=require(_0x92e0('0x1'));var path=require(_0x92e0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x92e0('0x3')]();var auth=require(_0x92e0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0x92e0('0x5')](),controller[_0x92e0('0x6')]);router[_0x92e0('0x7')](_0x92e0('0x8'),auth[_0x92e0('0x5')](),controller['show']);router['get'](_0x92e0('0x9'),auth[_0x92e0('0x5')](),controller[_0x92e0('0xa')]);router[_0x92e0('0x7')](_0x92e0('0xb'),auth['isAuthenticated'](),controller[_0x92e0('0xc')]);router[_0x92e0('0x7')](_0x92e0('0xd'),auth[_0x92e0('0x5')](),controller['getActions']);router[_0x92e0('0xe')]('/',auth[_0x92e0('0x5')](),controller[_0x92e0('0xf')]);router['post'](_0x92e0('0x9'),auth[_0x92e0('0x5')](),controller['addAllCondition']);router[_0x92e0('0xe')](_0x92e0('0xb'),auth[_0x92e0('0x5')](),controller[_0x92e0('0x10')]);router[_0x92e0('0xe')](_0x92e0('0xd'),auth[_0x92e0('0x5')](),controller[_0x92e0('0x11')]);router[_0x92e0('0x12')](_0x92e0('0x8'),auth[_0x92e0('0x5')](),controller[_0x92e0('0x13')]);router[_0x92e0('0x14')](_0x92e0('0x8'),auth[_0x92e0('0x5')](),controller[_0x92e0('0x15')]);module[_0x92e0('0x16')]=router; \ No newline at end of file +var _0xbad4=['/:id/all_conditions','addAllCondition','addAnyCondition','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post'];(function(_0x4ef483,_0x5e7c0b){var _0x3f0475=function(_0x37c0ae){while(--_0x37c0ae){_0x4ef483['push'](_0x4ef483['shift']());}};_0x3f0475(++_0x5e7c0b);}(_0xbad4,0x104));var _0x4bad=function(_0x1dbd89,_0x3805bf){_0x1dbd89=_0x1dbd89-0x0;var _0x40ed9b=_0xbad4[_0x1dbd89];return _0x40ed9b;};'use strict';var multer=require(_0x4bad('0x0'));var util=require(_0x4bad('0x1'));var path=require(_0x4bad('0x2'));var timeout=require(_0x4bad('0x3'));var express=require(_0x4bad('0x4'));var router=express[_0x4bad('0x5')]();var auth=require(_0x4bad('0x6'));var interaction=require(_0x4bad('0x7'));var config=require(_0x4bad('0x8'));var controller=require(_0x4bad('0x9'));router[_0x4bad('0xa')]('/',auth[_0x4bad('0xb')](),controller[_0x4bad('0xc')]);router['get'](_0x4bad('0xd'),auth[_0x4bad('0xb')](),controller[_0x4bad('0xe')]);router['get']('/:id/all_conditions',auth[_0x4bad('0xb')](),controller[_0x4bad('0xf')]);router[_0x4bad('0xa')](_0x4bad('0x10'),auth[_0x4bad('0xb')](),controller['getAnyConditions']);router['get'](_0x4bad('0x11'),auth[_0x4bad('0xb')](),controller[_0x4bad('0x12')]);router[_0x4bad('0x13')]('/',auth[_0x4bad('0xb')](),controller['create']);router['post'](_0x4bad('0x14'),auth[_0x4bad('0xb')](),controller[_0x4bad('0x15')]);router[_0x4bad('0x13')]('/:id/any_conditions',auth[_0x4bad('0xb')](),controller[_0x4bad('0x16')]);router[_0x4bad('0x13')](_0x4bad('0x11'),auth[_0x4bad('0xb')](),controller['addAction']);router[_0x4bad('0x17')](_0x4bad('0xd'),auth[_0x4bad('0xb')](),controller[_0x4bad('0x18')]);router[_0x4bad('0x19')](_0x4bad('0xd'),auth[_0x4bad('0xb')](),controller[_0x4bad('0x1a')]);module[_0x4bad('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 363b2a7..427dbc1 100644 --- a/server/api/trigger/trigger.attributes.js +++ b/server/api/trigger/trigger.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31ac=['exports','STRING','sequelize'];(function(_0x1f1cd4,_0x4a52c9){var _0x2c4bac=function(_0x11abe5){while(--_0x11abe5){_0x1f1cd4['push'](_0x1f1cd4['shift']());}};_0x2c4bac(++_0x4a52c9);}(_0x31ac,0x161));var _0xc31a=function(_0x2b6968,_0x57b2c8){_0x2b6968=_0x2b6968-0x0;var _0x12fef7=_0x31ac[_0x2b6968];return _0x12fef7;};'use strict';var Sequelize=require(_0xc31a('0x0'));module[_0xc31a('0x1')]={'name':{'type':Sequelize[_0xc31a('0x2')]},'channel':{'type':Sequelize[_0xc31a('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xcbca=['sequelize','exports','STRING','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcbca,0xac));var _0xacbc=function(_0x54a117,_0x240c61){_0x54a117=_0x54a117-0x0;var _0x16fca6=_0xcbca[_0x54a117];return _0x16fca6;};'use strict';var Sequelize=require(_0xacbc('0x0'));module[_0xacbc('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xacbc('0x2')]},'description':{'type':Sequelize[_0xacbc('0x2')]},'status':{'type':Sequelize[_0xacbc('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 12dbeb8..f97e890 100644 --- a/server/api/trigger/trigger.controller.js +++ b/server/api/trigger/trigger.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dc0=['rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','getAllConditions','nolimit','getAnyConditions','pick','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','get','Triggers','UserProfileResource','end','stack','name','send','index','map','Trigger'];(function(_0x5340cc,_0x3eaab7){var _0x2190d4=function(_0xe18d4b){while(--_0xe18d4b){_0x5340cc['push'](_0x5340cc['shift']());}};_0x2190d4(++_0x3eaab7);}(_0x6dc0,0x18c));var _0x06dc=function(_0x3b8155,_0x149298){_0x3b8155=_0x3b8155-0x0;var _0x4003ef=_0x6dc0[_0x3b8155];return _0x4003ef;};'use strict';var pdf=require(_0x06dc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x06dc('0x1'));var zipdir=require(_0x06dc('0x2'));var jsonpatch=require(_0x06dc('0x3'));var rp=require(_0x06dc('0x4'));var moment=require(_0x06dc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x06dc('0x6'));var path=require(_0x06dc('0x7'));var sox=require('sox');var csv=require(_0x06dc('0x8'));var ejs=require(_0x06dc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x06dc('0xa'));var crypto=require('crypto');var jsforce=require(_0x06dc('0xb'));var deskjs=require(_0x06dc('0xc'));var toCsv=require(_0x06dc('0x8'));var querystring=require(_0x06dc('0xd'));var Papa=require(_0x06dc('0xe'));var Redis=require('ioredis');var authService=require(_0x06dc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x06dc('0x10'));var hardwareService=require(_0x06dc('0x11'));var logger=require('../../config/logger')(_0x06dc('0x12'));var utils=require(_0x06dc('0x13'));var config=require(_0x06dc('0x14'));var licenseUtil=require(_0x06dc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ce891,_0x3ffc60){_0x3ffc60=_0x3ffc60||0xcc;return function(_0x387c19){if(_0x387c19){return _0x3ce891[_0x06dc('0x16')](_0x3ffc60);}return _0x3ce891[_0x06dc('0x17')](_0x3ffc60)['end']();};}function respondWithResult(_0x17129d,_0xfc22f0){_0xfc22f0=_0xfc22f0||0xc8;return function(_0x9806ef){if(_0x9806ef){return _0x17129d[_0x06dc('0x17')](_0xfc22f0)[_0x06dc('0x18')](_0x9806ef);}};}function respondWithFilteredResult(_0x44a252,_0x42414d){return function(_0x592cb7){if(_0x592cb7){var _0xc2eb3c=_0x592cb7[_0x06dc('0x19')],_0x42eaeb=_0x42414d[_0x06dc('0x1a')],_0x2a09bc=_0x42414d[_0x06dc('0x1a')]+_0x42414d[_0x06dc('0x1b')],_0x5bc9d9;if(_0x2a09bc>=_0xc2eb3c){_0x2a09bc=_0xc2eb3c;_0x5bc9d9=0xc8;}else{_0x5bc9d9=0xce;}_0x44a252[_0x06dc('0x17')](_0x5bc9d9);return _0x44a252[_0x06dc('0x1c')](_0x06dc('0x1d'),_0x42eaeb+'-'+_0x2a09bc+'/'+_0xc2eb3c)[_0x06dc('0x18')](_0x592cb7);}return null;};}function patchUpdates(_0x512502){return function(_0x2d5e70){try{jsonpatch['apply'](_0x2d5e70,_0x512502,!![]);}catch(_0xe0874b){return BPromise['reject'](_0xe0874b);}return _0x2d5e70[_0x06dc('0x1e')]();};}function saveUpdates(_0x461b34,_0x1a231b){return function(_0x197bc6){if(_0x197bc6){return _0x197bc6[_0x06dc('0x1f')](_0x461b34)['then'](function(_0x4bd225){return _0x4bd225;});}return null;};}function removeEntity(_0x591cc3,_0x4dd262){return function(_0x4ab33b){if(_0x4ab33b){return _0x4ab33b[_0x06dc('0x20')]()[_0x06dc('0x21')](function(){var _0x4cee44=_0x4ab33b[_0x06dc('0x22')]({'plain':!![]});var _0x411d8f=_0x06dc('0x23');return db[_0x06dc('0x24')]['destroy']({'where':{'type':_0x411d8f,'resourceId':_0x4cee44['id']}})[_0x06dc('0x21')](function(){return _0x4ab33b;});})[_0x06dc('0x21')](function(){_0x591cc3[_0x06dc('0x17')](0xcc)[_0x06dc('0x25')]();});}};}function handleEntityNotFound(_0x20f761,_0x56081e){return function(_0x53f9a3){if(!_0x53f9a3){_0x20f761[_0x06dc('0x16')](0x194);}return _0x53f9a3;};}function handleError(_0x387818,_0x100db3){_0x100db3=_0x100db3||0x1f4;return function(_0x39d9a4){logger['error'](_0x39d9a4[_0x06dc('0x26')]);if(_0x39d9a4[_0x06dc('0x27')]){delete _0x39d9a4['name'];}_0x387818['status'](_0x100db3)[_0x06dc('0x28')](_0x39d9a4);};}exports[_0x06dc('0x29')]=function(_0x4a3e76,_0x46c89b){var _0x486181={},_0x7fa51={},_0x40655f={'count':0x0,'rows':[]};var _0x227c6a=_[_0x06dc('0x2a')](db[_0x06dc('0x2b')][_0x06dc('0x2c')],function(_0x2b08e2){return{'name':_0x2b08e2[_0x06dc('0x2d')],'type':_0x2b08e2['type'][_0x06dc('0x2e')]};});_0x7fa51[_0x06dc('0x2f')]=_[_0x06dc('0x2a')](_0x227c6a,_0x06dc('0x27'));_0x7fa51[_0x06dc('0x30')]=_[_0x06dc('0x31')](_0x4a3e76[_0x06dc('0x30')]);_0x7fa51[_0x06dc('0x32')]=_['intersection'](_0x7fa51['model'],_0x7fa51['query']);_0x486181[_0x06dc('0x33')]=_[_0x06dc('0x34')](_0x7fa51['model'],qs[_0x06dc('0x35')](_0x4a3e76[_0x06dc('0x30')][_0x06dc('0x35')]));_0x486181[_0x06dc('0x33')]=_0x486181[_0x06dc('0x33')][_0x06dc('0x36')]?_0x486181['attributes']:_0x7fa51[_0x06dc('0x2f')];if(!_0x4a3e76['query'][_0x06dc('0x37')]('nolimit')){_0x486181['limit']=qs['limit'](_0x4a3e76[_0x06dc('0x30')][_0x06dc('0x1b')]);_0x486181[_0x06dc('0x1a')]=qs[_0x06dc('0x1a')](_0x4a3e76['query']['offset']);}_0x486181[_0x06dc('0x38')]=qs[_0x06dc('0x39')](_0x4a3e76['query'][_0x06dc('0x39')]);_0x486181[_0x06dc('0x3a')]=qs[_0x06dc('0x32')](_['pick'](_0x4a3e76[_0x06dc('0x30')],_0x7fa51[_0x06dc('0x32')]),_0x227c6a);if(_0x4a3e76['query'][_0x06dc('0x3b')]){_0x486181['where']=_['merge'](_0x486181[_0x06dc('0x3a')],{'$or':_[_0x06dc('0x2a')](_0x227c6a,function(_0x4eeba6){if(_0x4eeba6['type']!==_0x06dc('0x3c')){var _0x15d0bb={};_0x15d0bb[_0x4eeba6['name']]={'$like':'%'+_0x4a3e76[_0x06dc('0x30')][_0x06dc('0x3b')]+'%'};return _0x15d0bb;}})});}_0x486181=_[_0x06dc('0x3d')]({},_0x486181,_0x4a3e76[_0x06dc('0x3e')]);var _0x431204={'where':_0x486181[_0x06dc('0x3a')]};return db[_0x06dc('0x2b')][_0x06dc('0x19')](_0x431204)['then'](function(_0x2f792d){_0x40655f['count']=_0x2f792d;if(_0x4a3e76['query'][_0x06dc('0x3f')]){_0x486181[_0x06dc('0x40')]=[{'all':!![]}];}return db[_0x06dc('0x2b')][_0x06dc('0x41')](_0x486181);})[_0x06dc('0x21')](function(_0x1bad90){_0x40655f[_0x06dc('0x42')]=_0x1bad90;return _0x40655f;})[_0x06dc('0x21')](respondWithFilteredResult(_0x46c89b,_0x486181))['catch'](handleError(_0x46c89b,null));};exports[_0x06dc('0x43')]=function(_0x17f707,_0x2629e2){var _0x4a3dc8={'raw':![],'where':{'id':_0x17f707[_0x06dc('0x44')]['id']}},_0x144625={};_0x144625['model']=_[_0x06dc('0x31')](db[_0x06dc('0x2b')][_0x06dc('0x2c')]);_0x144625[_0x06dc('0x30')]=_[_0x06dc('0x31')](_0x17f707[_0x06dc('0x30')]);_0x144625[_0x06dc('0x32')]=_[_0x06dc('0x34')](_0x144625[_0x06dc('0x2f')],_0x144625[_0x06dc('0x30')]);_0x4a3dc8['attributes']=_[_0x06dc('0x34')](_0x144625[_0x06dc('0x2f')],qs[_0x06dc('0x35')](_0x17f707[_0x06dc('0x30')][_0x06dc('0x35')]));_0x4a3dc8['attributes']=_0x4a3dc8[_0x06dc('0x33')][_0x06dc('0x36')]?_0x4a3dc8[_0x06dc('0x33')]:_0x144625[_0x06dc('0x2f')];if(_0x17f707['query'][_0x06dc('0x3f')]){_0x4a3dc8[_0x06dc('0x40')]=[{'all':!![]}];}_0x4a3dc8=_[_0x06dc('0x3d')]({},_0x4a3dc8,_0x17f707[_0x06dc('0x3e')]);return db[_0x06dc('0x2b')][_0x06dc('0x45')](_0x4a3dc8)[_0x06dc('0x21')](handleEntityNotFound(_0x2629e2,null))[_0x06dc('0x21')](respondWithResult(_0x2629e2,null))[_0x06dc('0x46')](handleError(_0x2629e2,null));};exports['create']=function(_0x569234,_0x4a5240){return db[_0x06dc('0x2b')][_0x06dc('0x47')](_0x569234[_0x06dc('0x48')],{})['then'](function(_0x338da0){var _0x5e02ce=_0x569234[_0x06dc('0x49')][_0x06dc('0x22')]({'plain':!![]});if(!_0x5e02ce)throw new Error(_0x06dc('0x4a'));if(_0x5e02ce['role']==='user'){var _0x495e6a=_0x338da0[_0x06dc('0x22')]({'plain':!![]});var _0x2679b7=_0x06dc('0x23');return db['UserProfileSection'][_0x06dc('0x45')]({'where':{'name':_0x2679b7,'userProfileId':_0x5e02ce['userProfileId']},'raw':!![]})[_0x06dc('0x21')](function(_0x691a93){if(_0x691a93&&_0x691a93[_0x06dc('0x4b')]===0x0){return db[_0x06dc('0x24')][_0x06dc('0x47')]({'name':_0x495e6a['name'],'resourceId':_0x495e6a['id'],'type':_0x691a93['name'],'sectionId':_0x691a93['id']},{})[_0x06dc('0x21')](function(){return _0x338da0;});}else{return _0x338da0;}})[_0x06dc('0x46')](function(_0x146d63){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x146d63);throw _0x146d63;});}return _0x338da0;})[_0x06dc('0x21')](respondWithResult(_0x4a5240,0xc9))[_0x06dc('0x46')](handleError(_0x4a5240,null));};exports[_0x06dc('0x1f')]=function(_0x12eef3,_0x334840){if(_0x12eef3[_0x06dc('0x48')]['id']){delete _0x12eef3['body']['id'];}return db['Trigger'][_0x06dc('0x45')]({'where':{'id':_0x12eef3[_0x06dc('0x44')]['id']}})[_0x06dc('0x21')](handleEntityNotFound(_0x334840,null))[_0x06dc('0x21')](saveUpdates(_0x12eef3[_0x06dc('0x48')],null))[_0x06dc('0x21')](respondWithResult(_0x334840,null))[_0x06dc('0x46')](handleError(_0x334840,null));};exports[_0x06dc('0x20')]=function(_0x410179,_0x4f2901){return db[_0x06dc('0x2b')]['find']({'where':{'id':_0x410179[_0x06dc('0x44')]['id']}})[_0x06dc('0x21')](handleEntityNotFound(_0x4f2901,null))['then'](removeEntity(_0x4f2901,null))[_0x06dc('0x46')](handleError(_0x4f2901,null));};exports[_0x06dc('0x4c')]=function(_0x30f0cb,_0x1d26c7,_0x228be5){if(_0x30f0cb[_0x06dc('0x48')]['id']){delete _0x30f0cb['body']['id'];}return db[_0x06dc('0x2b')]['find']({'where':{'id':_0x30f0cb['params']['id']}})[_0x06dc('0x21')](handleEntityNotFound(_0x1d26c7,null))[_0x06dc('0x21')](function(_0x245ee2){if(_0x245ee2){_0x30f0cb['body'][_0x06dc('0x4d')]=_0x245ee2['id'];return db['Condition']['create'](_0x30f0cb['body']);}})[_0x06dc('0x21')](respondWithResult(_0x1d26c7,null))[_0x06dc('0x46')](handleError(_0x1d26c7,null));};exports[_0x06dc('0x4e')]=function(_0x4372f6,_0x5ad735,_0x3ce733){if(_0x4372f6['body']['id']){delete _0x4372f6[_0x06dc('0x48')]['id'];}return db[_0x06dc('0x2b')]['find']({'where':{'id':_0x4372f6[_0x06dc('0x44')]['id']}})[_0x06dc('0x21')](handleEntityNotFound(_0x5ad735,null))[_0x06dc('0x21')](function(_0x1aedd6){if(_0x1aedd6){_0x4372f6[_0x06dc('0x48')][_0x06dc('0x4f')]=_0x1aedd6['id'];return db[_0x06dc('0x50')][_0x06dc('0x47')](_0x4372f6[_0x06dc('0x48')]);}})[_0x06dc('0x21')](respondWithResult(_0x5ad735,null))[_0x06dc('0x46')](handleError(_0x5ad735,null));};exports['getAllConditions']=function(_0x5a4c22,_0x26bc2e,_0x5316f0){var _0x2977b2={};var _0x402a9c={};var _0x586ceb;var _0x43c306;return db['Trigger'][_0x06dc('0x51')]({'where':{'id':_0x5a4c22[_0x06dc('0x44')]['id']}})[_0x06dc('0x21')](handleEntityNotFound(_0x26bc2e,null))[_0x06dc('0x21')](function(_0x311982){if(_0x311982){_0x586ceb=_0x311982;_0x402a9c['model']=_['keys'](db[_0x06dc('0x50')][_0x06dc('0x2c')]);_0x402a9c[_0x06dc('0x30')]=_['keys'](_0x5a4c22[_0x06dc('0x30')]);_0x402a9c[_0x06dc('0x32')]=_[_0x06dc('0x34')](_0x402a9c['model'],_0x402a9c['query']);_0x2977b2['attributes']=_['intersection'](_0x402a9c['model'],qs[_0x06dc('0x35')](_0x5a4c22[_0x06dc('0x30')][_0x06dc('0x35')]));_0x2977b2[_0x06dc('0x33')]=_0x2977b2[_0x06dc('0x33')]['length']?_0x2977b2[_0x06dc('0x33')]:_0x402a9c[_0x06dc('0x2f')];_0x2977b2[_0x06dc('0x38')]=qs[_0x06dc('0x39')](_0x5a4c22[_0x06dc('0x30')][_0x06dc('0x39')]);_0x2977b2['where']=qs[_0x06dc('0x32')](_['pick'](_0x5a4c22['query'],_0x402a9c[_0x06dc('0x32')]));if(_0x5a4c22[_0x06dc('0x30')][_0x06dc('0x3b')]){_0x2977b2[_0x06dc('0x3a')]=_[_0x06dc('0x3d')](_0x2977b2[_0x06dc('0x3a')],{'$or':_[_0x06dc('0x2a')](_0x2977b2['attributes'],function(_0x3f8850){var _0x57420c={};_0x57420c[_0x3f8850]={'$like':'%'+_0x5a4c22[_0x06dc('0x30')][_0x06dc('0x3b')]+'%'};return _0x57420c;})});}_0x2977b2=_[_0x06dc('0x3d')]({},_0x2977b2,_0x5a4c22[_0x06dc('0x3e')]);return _0x586ceb[_0x06dc('0x52')](_0x2977b2);}})['then'](function(_0x5bf757){if(_0x5bf757){_0x43c306=_0x5bf757[_0x06dc('0x36')];if(!_0x5a4c22[_0x06dc('0x30')][_0x06dc('0x37')](_0x06dc('0x53'))){_0x2977b2['limit']=qs[_0x06dc('0x1b')](_0x5a4c22[_0x06dc('0x30')]['limit']);_0x2977b2['offset']=qs[_0x06dc('0x1a')](_0x5a4c22[_0x06dc('0x30')][_0x06dc('0x1a')]);}return _0x586ceb['getAllConditions'](_0x2977b2);}})[_0x06dc('0x21')](function(_0x392075){if(_0x392075){return _0x392075?{'count':_0x43c306,'rows':_0x392075}:null;}})[_0x06dc('0x21')](respondWithResult(_0x26bc2e,null))['catch'](handleError(_0x26bc2e,null));};exports[_0x06dc('0x54')]=function(_0x21415b,_0x4fd6e8,_0x203117){var _0x491f3b={};var _0x2ad11a={};var _0x487140;var _0xd6c226;return db[_0x06dc('0x2b')][_0x06dc('0x51')]({'where':{'id':_0x21415b['params']['id']}})['then'](handleEntityNotFound(_0x4fd6e8,null))[_0x06dc('0x21')](function(_0x2cc677){if(_0x2cc677){_0x487140=_0x2cc677;_0x2ad11a[_0x06dc('0x2f')]=_[_0x06dc('0x31')](db['Condition'][_0x06dc('0x2c')]);_0x2ad11a[_0x06dc('0x30')]=_['keys'](_0x21415b[_0x06dc('0x30')]);_0x2ad11a[_0x06dc('0x32')]=_[_0x06dc('0x34')](_0x2ad11a[_0x06dc('0x2f')],_0x2ad11a[_0x06dc('0x30')]);_0x491f3b[_0x06dc('0x33')]=_['intersection'](_0x2ad11a[_0x06dc('0x2f')],qs[_0x06dc('0x35')](_0x21415b[_0x06dc('0x30')][_0x06dc('0x35')]));_0x491f3b[_0x06dc('0x33')]=_0x491f3b[_0x06dc('0x33')]['length']?_0x491f3b[_0x06dc('0x33')]:_0x2ad11a['model'];_0x491f3b[_0x06dc('0x38')]=qs[_0x06dc('0x39')](_0x21415b[_0x06dc('0x30')]['sort']);_0x491f3b[_0x06dc('0x3a')]=qs[_0x06dc('0x32')](_[_0x06dc('0x55')](_0x21415b['query'],_0x2ad11a[_0x06dc('0x32')]));if(_0x21415b[_0x06dc('0x30')][_0x06dc('0x3b')]){_0x491f3b[_0x06dc('0x3a')]=_[_0x06dc('0x3d')](_0x491f3b[_0x06dc('0x3a')],{'$or':_[_0x06dc('0x2a')](_0x491f3b[_0x06dc('0x33')],function(_0x15949d){var _0x13e9c2={};_0x13e9c2[_0x15949d]={'$like':'%'+_0x21415b[_0x06dc('0x30')][_0x06dc('0x3b')]+'%'};return _0x13e9c2;})});}_0x491f3b=_['merge']({},_0x491f3b,_0x21415b[_0x06dc('0x3e')]);return _0x487140[_0x06dc('0x54')](_0x491f3b);}})['then'](function(_0x412b88){if(_0x412b88){_0xd6c226=_0x412b88['length'];if(!_0x21415b['query']['hasOwnProperty'](_0x06dc('0x53'))){_0x491f3b[_0x06dc('0x1b')]=qs[_0x06dc('0x1b')](_0x21415b[_0x06dc('0x30')][_0x06dc('0x1b')]);_0x491f3b[_0x06dc('0x1a')]=qs['offset'](_0x21415b['query'][_0x06dc('0x1a')]);}return _0x487140['getAnyConditions'](_0x491f3b);}})[_0x06dc('0x21')](function(_0x5d5150){if(_0x5d5150){return _0x5d5150?{'count':_0xd6c226,'rows':_0x5d5150}:null;}})[_0x06dc('0x21')](respondWithResult(_0x4fd6e8,null))['catch'](handleError(_0x4fd6e8,null));};exports['addAction']=function(_0x379933,_0x20c432,_0x5cf06b){if(_0x379933['body']['id']){delete _0x379933[_0x06dc('0x48')]['id'];}return db[_0x06dc('0x2b')]['find']({'where':{'id':_0x379933['params']['id']}})['then'](handleEntityNotFound(_0x20c432,null))[_0x06dc('0x21')](function(_0x1e4a7e){if(_0x1e4a7e){_0x379933[_0x06dc('0x48')]['TriggerId']=_0x1e4a7e['id'];return db[_0x06dc('0x56')]['create'](_0x379933['body']);}})['then'](respondWithResult(_0x20c432,null))['catch'](handleError(_0x20c432,null));};exports[_0x06dc('0x57')]=function(_0x544ab0,_0x159be3,_0x4f36bd){var _0x5c3b62={};var _0x4bd9ef={};var _0x10f96b;var _0x480e49;return db[_0x06dc('0x2b')][_0x06dc('0x51')]({'where':{'id':_0x544ab0['params']['id']}})[_0x06dc('0x21')](handleEntityNotFound(_0x159be3,null))[_0x06dc('0x21')](function(_0x6e8f46){if(_0x6e8f46){_0x10f96b=_0x6e8f46;_0x4bd9ef['model']=_[_0x06dc('0x31')](db[_0x06dc('0x56')][_0x06dc('0x2c')]);_0x4bd9ef['query']=_[_0x06dc('0x31')](_0x544ab0[_0x06dc('0x30')]);_0x4bd9ef['filters']=_[_0x06dc('0x34')](_0x4bd9ef['model'],_0x4bd9ef[_0x06dc('0x30')]);_0x5c3b62[_0x06dc('0x33')]=_[_0x06dc('0x34')](_0x4bd9ef[_0x06dc('0x2f')],qs['fields'](_0x544ab0[_0x06dc('0x30')][_0x06dc('0x35')]));_0x5c3b62['attributes']=_0x5c3b62[_0x06dc('0x33')][_0x06dc('0x36')]?_0x5c3b62['attributes']:_0x4bd9ef[_0x06dc('0x2f')];_0x5c3b62[_0x06dc('0x38')]=qs[_0x06dc('0x39')](_0x544ab0[_0x06dc('0x30')][_0x06dc('0x39')]);_0x5c3b62[_0x06dc('0x3a')]=qs['filters'](_[_0x06dc('0x55')](_0x544ab0[_0x06dc('0x30')],_0x4bd9ef[_0x06dc('0x32')]));if(_0x544ab0['query'][_0x06dc('0x3b')]){_0x5c3b62[_0x06dc('0x3a')]=_['merge'](_0x5c3b62[_0x06dc('0x3a')],{'$or':_[_0x06dc('0x2a')](_0x5c3b62[_0x06dc('0x33')],function(_0x2c11d8){var _0x23d973={};_0x23d973[_0x2c11d8]={'$like':'%'+_0x544ab0['query'][_0x06dc('0x3b')]+'%'};return _0x23d973;})});}_0x5c3b62=_[_0x06dc('0x3d')]({},_0x5c3b62,_0x544ab0['options']);return _0x10f96b['getActions'](_0x5c3b62);}})[_0x06dc('0x21')](function(_0x331665){if(_0x331665){_0x480e49=_0x331665['length'];if(!_0x544ab0[_0x06dc('0x30')]['hasOwnProperty']('nolimit')){_0x5c3b62[_0x06dc('0x1b')]=qs[_0x06dc('0x1b')](_0x544ab0[_0x06dc('0x30')]['limit']);_0x5c3b62['offset']=qs[_0x06dc('0x1a')](_0x544ab0['query']['offset']);}return _0x10f96b[_0x06dc('0x57')](_0x5c3b62);}})[_0x06dc('0x21')](function(_0x1b2172){if(_0x1b2172){return _0x1b2172?{'count':_0x480e49,'rows':_0x1b2172}:null;}})[_0x06dc('0x21')](respondWithResult(_0x159be3,null))[_0x06dc('0x46')](handleError(_0x159be3,null));}; \ No newline at end of file +var _0x80ce=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','Trigger','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','order','pick','options','getAnyConditions','addAction','TriggerId','Action','getActions','hasOwnProperty','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x80ce,0xae));var _0xe80c=function(_0x36b7fe,_0x353b66){_0x36b7fe=_0x36b7fe-0x0;var _0x281dd2=_0x80ce[_0x36b7fe];return _0x281dd2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe80c('0x0'));var jsonpatch=require(_0xe80c('0x1'));var rp=require('request-promise');var moment=require(_0xe80c('0x2'));var BPromise=require(_0xe80c('0x3'));var Mustache=require(_0xe80c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe80c('0x5'));var ejs=require(_0xe80c('0x6'));var fs=require('fs');var _=require(_0xe80c('0x7'));var squel=require(_0xe80c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe80c('0x9'));var toCsv=require(_0xe80c('0x5'));var querystring=require('querystring');var Papa=require(_0xe80c('0xa'));var Redis=require(_0xe80c('0xb'));var authService=require(_0xe80c('0xc'));var qs=require(_0xe80c('0xd'));var as=require(_0xe80c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe80c('0xf'));var config=require(_0xe80c('0x10'));var licenseUtil=require(_0xe80c('0x11'));var db=require(_0xe80c('0x12'))['db'];function respondWithStatusCode(_0xfc0809,_0x3cd7ba){_0x3cd7ba=_0x3cd7ba||0xcc;return function(_0xefba08){if(_0xefba08){return _0xfc0809[_0xe80c('0x13')](_0x3cd7ba);}return _0xfc0809[_0xe80c('0x14')](_0x3cd7ba)[_0xe80c('0x15')]();};}function respondWithResult(_0x185a51,_0x46f217){_0x46f217=_0x46f217||0xc8;return function(_0x24bbd2){if(_0x24bbd2){return _0x185a51['status'](_0x46f217)[_0xe80c('0x16')](_0x24bbd2);}};}function respondWithFilteredResult(_0x52801b,_0x451535){return function(_0x2a118e){if(_0x2a118e){var _0x100606=_0x2a118e['count'],_0x532e00=_0x451535[_0xe80c('0x17')],_0x6ff463=_0x451535[_0xe80c('0x17')]+_0x451535['limit'],_0x35d108;if(_0x6ff463>=_0x100606){_0x6ff463=_0x100606;_0x35d108=0xc8;}else{_0x35d108=0xce;}_0x52801b[_0xe80c('0x14')](_0x35d108);return _0x52801b[_0xe80c('0x18')]('Content-Range',_0x532e00+'-'+_0x6ff463+'/'+_0x100606)['json'](_0x2a118e);}return null;};}function patchUpdates(_0x1ba731){return function(_0x752469){try{jsonpatch[_0xe80c('0x19')](_0x752469,_0x1ba731,!![]);}catch(_0xdc8b26){return BPromise[_0xe80c('0x1a')](_0xdc8b26);}return _0x752469[_0xe80c('0x1b')]();};}function saveUpdates(_0x534471,_0x5da513){return function(_0x5417c4){if(_0x5417c4){return _0x5417c4['update'](_0x534471)[_0xe80c('0x1c')](function(_0x5078f8){return _0x5078f8;});}return null;};}function removeEntity(_0x39996f,_0x3efad0){return function(_0x3e6058){if(_0x3e6058){return _0x3e6058[_0xe80c('0x1d')]()[_0xe80c('0x1c')](function(){var _0x3fd5ba=_0x3e6058[_0xe80c('0x1e')]({'plain':!![]});var _0x360d8b=_0xe80c('0x1f');return db[_0xe80c('0x20')][_0xe80c('0x1d')]({'where':{'type':_0x360d8b,'resourceId':_0x3fd5ba['id']}})[_0xe80c('0x1c')](function(){return _0x3e6058;});})['then'](function(){_0x39996f[_0xe80c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31e778,_0x4ef883){return function(_0x270ded){if(!_0x270ded){_0x31e778['sendStatus'](0x194);}return _0x270ded;};}function handleError(_0x468875,_0x43f290){_0x43f290=_0x43f290||0x1f4;return function(_0x54595d){logger[_0xe80c('0x21')](_0x54595d[_0xe80c('0x22')]);if(_0x54595d[_0xe80c('0x23')]){delete _0x54595d[_0xe80c('0x23')];}_0x468875[_0xe80c('0x14')](_0x43f290)[_0xe80c('0x24')](_0x54595d);};}exports[_0xe80c('0x25')]=function(_0x2936bf,_0x1e1b23){var _0x5bb254={},_0x415690={},_0x460cef={'count':0x0,'rows':[]};var _0x512c94=_[_0xe80c('0x26')](db['Trigger'][_0xe80c('0x27')],function(_0x3be1d2){return{'name':_0x3be1d2[_0xe80c('0x28')],'type':_0x3be1d2[_0xe80c('0x29')][_0xe80c('0x2a')]};});_0x415690[_0xe80c('0x2b')]=_[_0xe80c('0x26')](_0x512c94,_0xe80c('0x23'));_0x415690[_0xe80c('0x2c')]=_['keys'](_0x2936bf['query']);_0x415690['filters']=_[_0xe80c('0x2d')](_0x415690[_0xe80c('0x2b')],_0x415690[_0xe80c('0x2c')]);_0x5bb254[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x415690['model'],qs[_0xe80c('0x2f')](_0x2936bf['query']['fields']));_0x5bb254[_0xe80c('0x2e')]=_0x5bb254[_0xe80c('0x2e')][_0xe80c('0x30')]?_0x5bb254[_0xe80c('0x2e')]:_0x415690[_0xe80c('0x2b')];if(!_0x2936bf[_0xe80c('0x2c')]['hasOwnProperty'](_0xe80c('0x31'))){_0x5bb254[_0xe80c('0x32')]=qs[_0xe80c('0x32')](_0x2936bf[_0xe80c('0x2c')][_0xe80c('0x32')]);_0x5bb254[_0xe80c('0x17')]=qs[_0xe80c('0x17')](_0x2936bf[_0xe80c('0x2c')][_0xe80c('0x17')]);}_0x5bb254['order']=qs['sort'](_0x2936bf['query'][_0xe80c('0x33')]);_0x5bb254[_0xe80c('0x34')]=qs[_0xe80c('0x35')](_['pick'](_0x2936bf[_0xe80c('0x2c')],_0x415690[_0xe80c('0x35')]),_0x512c94);if(_0x2936bf[_0xe80c('0x2c')]['filter']){_0x5bb254[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x5bb254[_0xe80c('0x34')],{'$or':_[_0xe80c('0x26')](_0x512c94,function(_0x2e22b0){if(_0x2e22b0[_0xe80c('0x29')]!==_0xe80c('0x37')){var _0xbfeb3d={};_0xbfeb3d[_0x2e22b0['name']]={'$like':'%'+_0x2936bf[_0xe80c('0x2c')][_0xe80c('0x38')]+'%'};return _0xbfeb3d;}})});}_0x5bb254=_[_0xe80c('0x36')]({},_0x5bb254,_0x2936bf['options']);var _0x5b628e={'where':_0x5bb254[_0xe80c('0x34')]};return db[_0xe80c('0x39')]['count'](_0x5b628e)[_0xe80c('0x1c')](function(_0x1e9dff){_0x460cef[_0xe80c('0x3a')]=_0x1e9dff;if(_0x2936bf['query'][_0xe80c('0x3b')]){_0x5bb254[_0xe80c('0x3c')]=[{'all':!![]}];}return db[_0xe80c('0x39')][_0xe80c('0x3d')](_0x5bb254);})[_0xe80c('0x1c')](function(_0x17d0e6){_0x460cef[_0xe80c('0x3e')]=_0x17d0e6;return _0x460cef;})['then'](respondWithFilteredResult(_0x1e1b23,_0x5bb254))['catch'](handleError(_0x1e1b23,null));};exports[_0xe80c('0x3f')]=function(_0x90219d,_0xef04bf){var _0x1bd916={'raw':![],'where':{'id':_0x90219d[_0xe80c('0x40')]['id']}},_0x41cc60={};_0x41cc60['model']=_[_0xe80c('0x41')](db[_0xe80c('0x39')]['rawAttributes']);_0x41cc60['query']=_[_0xe80c('0x41')](_0x90219d[_0xe80c('0x2c')]);_0x41cc60[_0xe80c('0x35')]=_['intersection'](_0x41cc60['model'],_0x41cc60[_0xe80c('0x2c')]);_0x1bd916[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x41cc60[_0xe80c('0x2b')],qs[_0xe80c('0x2f')](_0x90219d['query']['fields']));_0x1bd916[_0xe80c('0x2e')]=_0x1bd916[_0xe80c('0x2e')]['length']?_0x1bd916['attributes']:_0x41cc60[_0xe80c('0x2b')];if(_0x90219d[_0xe80c('0x2c')][_0xe80c('0x3b')]){_0x1bd916[_0xe80c('0x3c')]=[{'all':!![]}];}_0x1bd916=_[_0xe80c('0x36')]({},_0x1bd916,_0x90219d['options']);return db[_0xe80c('0x39')][_0xe80c('0x42')](_0x1bd916)[_0xe80c('0x1c')](handleEntityNotFound(_0xef04bf,null))[_0xe80c('0x1c')](respondWithResult(_0xef04bf,null))[_0xe80c('0x43')](handleError(_0xef04bf,null));};exports[_0xe80c('0x44')]=function(_0x4ddf5c,_0x28013f){return db[_0xe80c('0x39')][_0xe80c('0x44')](_0x4ddf5c['body'],{})[_0xe80c('0x1c')](function(_0x2dde4d){var _0x4e6d7e=_0x4ddf5c[_0xe80c('0x45')][_0xe80c('0x1e')]({'plain':!![]});if(!_0x4e6d7e)throw new Error(_0xe80c('0x46'));if(_0x4e6d7e[_0xe80c('0x47')]===_0xe80c('0x45')){var _0x3dc0b1=_0x2dde4d[_0xe80c('0x1e')]({'plain':!![]});var _0x50bee9=_0xe80c('0x1f');return db[_0xe80c('0x48')][_0xe80c('0x42')]({'where':{'name':_0x50bee9,'userProfileId':_0x4e6d7e[_0xe80c('0x49')]},'raw':!![]})[_0xe80c('0x1c')](function(_0x5e1b32){if(_0x5e1b32&&_0x5e1b32[_0xe80c('0x4a')]===0x0){return db[_0xe80c('0x20')][_0xe80c('0x44')]({'name':_0x3dc0b1[_0xe80c('0x23')],'resourceId':_0x3dc0b1['id'],'type':_0x5e1b32[_0xe80c('0x23')],'sectionId':_0x5e1b32['id']},{})['then'](function(){return _0x2dde4d;});}else{return _0x2dde4d;}})[_0xe80c('0x43')](function(_0x192b7f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x192b7f);throw _0x192b7f;});}return _0x2dde4d;})[_0xe80c('0x1c')](respondWithResult(_0x28013f,0xc9))[_0xe80c('0x43')](handleError(_0x28013f,null));};exports['update']=function(_0x5088ef,_0x376cc4){if(_0x5088ef['body']['id']){delete _0x5088ef[_0xe80c('0x4b')]['id'];}return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0x5088ef['params']['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x376cc4,null))['then'](saveUpdates(_0x5088ef['body'],null))[_0xe80c('0x1c')](respondWithResult(_0x376cc4,null))[_0xe80c('0x43')](handleError(_0x376cc4,null));};exports[_0xe80c('0x1d')]=function(_0xa54742,_0x3e4ce2){return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0xa54742[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x3e4ce2,null))[_0xe80c('0x1c')](removeEntity(_0x3e4ce2,null))[_0xe80c('0x43')](handleError(_0x3e4ce2,null));};exports[_0xe80c('0x4c')]=function(_0x29518a,_0x475e32,_0x12bcf5){if(_0x29518a[_0xe80c('0x4b')]['id']){delete _0x29518a[_0xe80c('0x4b')]['id'];}return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0x29518a[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x475e32,null))[_0xe80c('0x1c')](function(_0x3be7f1){if(_0x3be7f1){_0x29518a[_0xe80c('0x4b')]['TriggerAllId']=_0x3be7f1['id'];return db[_0xe80c('0x4d')][_0xe80c('0x44')](_0x29518a[_0xe80c('0x4b')]);}})['then'](respondWithResult(_0x475e32,null))['catch'](handleError(_0x475e32,null));};exports[_0xe80c('0x4e')]=function(_0x4e6c95,_0x303603,_0x3d5e5e){if(_0x4e6c95[_0xe80c('0x4b')]['id']){delete _0x4e6c95[_0xe80c('0x4b')]['id'];}return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0x4e6c95[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x303603,null))['then'](function(_0x34d843){if(_0x34d843){_0x4e6c95['body']['TriggerAnyId']=_0x34d843['id'];return db[_0xe80c('0x4d')][_0xe80c('0x44')](_0x4e6c95[_0xe80c('0x4b')]);}})[_0xe80c('0x1c')](respondWithResult(_0x303603,null))[_0xe80c('0x43')](handleError(_0x303603,null));};exports[_0xe80c('0x4f')]=function(_0x13b623,_0x4a920f,_0x515876){var _0x554401={};var _0x5ddab3={};var _0x15c541;var _0x5d46b9;return db[_0xe80c('0x39')][_0xe80c('0x50')]({'where':{'id':_0x13b623[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x4a920f,null))[_0xe80c('0x1c')](function(_0x100418){if(_0x100418){_0x15c541=_0x100418;_0x5ddab3[_0xe80c('0x2b')]=_['keys'](db[_0xe80c('0x4d')][_0xe80c('0x27')]);_0x5ddab3[_0xe80c('0x2c')]=_[_0xe80c('0x41')](_0x13b623[_0xe80c('0x2c')]);_0x5ddab3[_0xe80c('0x35')]=_['intersection'](_0x5ddab3['model'],_0x5ddab3['query']);_0x554401['attributes']=_[_0xe80c('0x2d')](_0x5ddab3[_0xe80c('0x2b')],qs['fields'](_0x13b623[_0xe80c('0x2c')][_0xe80c('0x2f')]));_0x554401['attributes']=_0x554401['attributes'][_0xe80c('0x30')]?_0x554401['attributes']:_0x5ddab3[_0xe80c('0x2b')];_0x554401[_0xe80c('0x51')]=qs['sort'](_0x13b623['query']['sort']);_0x554401['where']=qs[_0xe80c('0x35')](_[_0xe80c('0x52')](_0x13b623[_0xe80c('0x2c')],_0x5ddab3[_0xe80c('0x35')]));if(_0x13b623[_0xe80c('0x2c')][_0xe80c('0x38')]){_0x554401[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x554401[_0xe80c('0x34')],{'$or':_['map'](_0x554401[_0xe80c('0x2e')],function(_0x183d9f){var _0x3e3e32={};_0x3e3e32[_0x183d9f]={'$like':'%'+_0x13b623[_0xe80c('0x2c')]['filter']+'%'};return _0x3e3e32;})});}_0x554401=_[_0xe80c('0x36')]({},_0x554401,_0x13b623[_0xe80c('0x53')]);return _0x15c541[_0xe80c('0x4f')](_0x554401);}})[_0xe80c('0x1c')](function(_0x584c65){if(_0x584c65){_0x5d46b9=_0x584c65[_0xe80c('0x30')];if(!_0x13b623[_0xe80c('0x2c')]['hasOwnProperty'](_0xe80c('0x31'))){_0x554401[_0xe80c('0x32')]=qs[_0xe80c('0x32')](_0x13b623[_0xe80c('0x2c')][_0xe80c('0x32')]);_0x554401[_0xe80c('0x17')]=qs[_0xe80c('0x17')](_0x13b623[_0xe80c('0x2c')][_0xe80c('0x17')]);}return _0x15c541[_0xe80c('0x4f')](_0x554401);}})[_0xe80c('0x1c')](function(_0x31efbc){if(_0x31efbc){return _0x31efbc?{'count':_0x5d46b9,'rows':_0x31efbc}:null;}})['then'](respondWithResult(_0x4a920f,null))[_0xe80c('0x43')](handleError(_0x4a920f,null));};exports[_0xe80c('0x54')]=function(_0x7bd4c4,_0x3bc71b,_0x2ca24e){var _0x550d71={};var _0x26e58c={};var _0x28b5b7;var _0x50ae66;return db[_0xe80c('0x39')]['findOne']({'where':{'id':_0x7bd4c4[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x3bc71b,null))[_0xe80c('0x1c')](function(_0x4acb25){if(_0x4acb25){_0x28b5b7=_0x4acb25;_0x26e58c['model']=_[_0xe80c('0x41')](db[_0xe80c('0x4d')][_0xe80c('0x27')]);_0x26e58c[_0xe80c('0x2c')]=_[_0xe80c('0x41')](_0x7bd4c4[_0xe80c('0x2c')]);_0x26e58c[_0xe80c('0x35')]=_[_0xe80c('0x2d')](_0x26e58c[_0xe80c('0x2b')],_0x26e58c[_0xe80c('0x2c')]);_0x550d71[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x26e58c[_0xe80c('0x2b')],qs[_0xe80c('0x2f')](_0x7bd4c4['query']['fields']));_0x550d71[_0xe80c('0x2e')]=_0x550d71['attributes'][_0xe80c('0x30')]?_0x550d71[_0xe80c('0x2e')]:_0x26e58c[_0xe80c('0x2b')];_0x550d71[_0xe80c('0x51')]=qs[_0xe80c('0x33')](_0x7bd4c4[_0xe80c('0x2c')]['sort']);_0x550d71['where']=qs['filters'](_['pick'](_0x7bd4c4[_0xe80c('0x2c')],_0x26e58c[_0xe80c('0x35')]));if(_0x7bd4c4[_0xe80c('0x2c')][_0xe80c('0x38')]){_0x550d71[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x550d71[_0xe80c('0x34')],{'$or':_['map'](_0x550d71[_0xe80c('0x2e')],function(_0xfcd2fc){var _0x3e103a={};_0x3e103a[_0xfcd2fc]={'$like':'%'+_0x7bd4c4[_0xe80c('0x2c')][_0xe80c('0x38')]+'%'};return _0x3e103a;})});}_0x550d71=_['merge']({},_0x550d71,_0x7bd4c4[_0xe80c('0x53')]);return _0x28b5b7[_0xe80c('0x54')](_0x550d71);}})['then'](function(_0x40d4a8){if(_0x40d4a8){_0x50ae66=_0x40d4a8[_0xe80c('0x30')];if(!_0x7bd4c4[_0xe80c('0x2c')]['hasOwnProperty'](_0xe80c('0x31'))){_0x550d71[_0xe80c('0x32')]=qs[_0xe80c('0x32')](_0x7bd4c4[_0xe80c('0x2c')]['limit']);_0x550d71[_0xe80c('0x17')]=qs[_0xe80c('0x17')](_0x7bd4c4[_0xe80c('0x2c')]['offset']);}return _0x28b5b7[_0xe80c('0x54')](_0x550d71);}})['then'](function(_0xa7f199){if(_0xa7f199){return _0xa7f199?{'count':_0x50ae66,'rows':_0xa7f199}:null;}})['then'](respondWithResult(_0x3bc71b,null))[_0xe80c('0x43')](handleError(_0x3bc71b,null));};exports[_0xe80c('0x55')]=function(_0x419e48,_0x80fe71,_0x1542bc){if(_0x419e48[_0xe80c('0x4b')]['id']){delete _0x419e48[_0xe80c('0x4b')]['id'];}return db['Trigger'][_0xe80c('0x42')]({'where':{'id':_0x419e48[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x80fe71,null))['then'](function(_0x48e26f){if(_0x48e26f){_0x419e48[_0xe80c('0x4b')][_0xe80c('0x56')]=_0x48e26f['id'];return db[_0xe80c('0x57')][_0xe80c('0x44')](_0x419e48['body']);}})[_0xe80c('0x1c')](respondWithResult(_0x80fe71,null))[_0xe80c('0x43')](handleError(_0x80fe71,null));};exports[_0xe80c('0x58')]=function(_0x24b2a9,_0xaf2bca,_0x4a32d7){var _0x3daf19={};var _0x4713ce={};var _0x236bad;var _0x44397b;return db['Trigger'][_0xe80c('0x50')]({'where':{'id':_0x24b2a9['params']['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0xaf2bca,null))[_0xe80c('0x1c')](function(_0x18cdd2){if(_0x18cdd2){_0x236bad=_0x18cdd2;_0x4713ce['model']=_[_0xe80c('0x41')](db[_0xe80c('0x57')]['rawAttributes']);_0x4713ce[_0xe80c('0x2c')]=_[_0xe80c('0x41')](_0x24b2a9[_0xe80c('0x2c')]);_0x4713ce[_0xe80c('0x35')]=_[_0xe80c('0x2d')](_0x4713ce[_0xe80c('0x2b')],_0x4713ce[_0xe80c('0x2c')]);_0x3daf19[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x4713ce['model'],qs[_0xe80c('0x2f')](_0x24b2a9['query']['fields']));_0x3daf19['attributes']=_0x3daf19[_0xe80c('0x2e')][_0xe80c('0x30')]?_0x3daf19[_0xe80c('0x2e')]:_0x4713ce[_0xe80c('0x2b')];_0x3daf19[_0xe80c('0x51')]=qs[_0xe80c('0x33')](_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x33')]);_0x3daf19[_0xe80c('0x34')]=qs['filters'](_[_0xe80c('0x52')](_0x24b2a9[_0xe80c('0x2c')],_0x4713ce[_0xe80c('0x35')]));if(_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x38')]){_0x3daf19[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x3daf19['where'],{'$or':_[_0xe80c('0x26')](_0x3daf19['attributes'],function(_0x6e1d81){var _0x347f87={};_0x347f87[_0x6e1d81]={'$like':'%'+_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x38')]+'%'};return _0x347f87;})});}_0x3daf19=_[_0xe80c('0x36')]({},_0x3daf19,_0x24b2a9[_0xe80c('0x53')]);return _0x236bad[_0xe80c('0x58')](_0x3daf19);}})[_0xe80c('0x1c')](function(_0x4caa8c){if(_0x4caa8c){_0x44397b=_0x4caa8c[_0xe80c('0x30')];if(!_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x59')](_0xe80c('0x31'))){_0x3daf19['limit']=qs['limit'](_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x32')]);_0x3daf19['offset']=qs[_0xe80c('0x17')](_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x17')]);}return _0x236bad[_0xe80c('0x58')](_0x3daf19);}})[_0xe80c('0x1c')](function(_0x329c88){if(_0x329c88){return _0x329c88?{'count':_0x44397b,'rows':_0x329c88}:null;}})[_0xe80c('0x1c')](respondWithResult(_0xaf2bca,null))['catch'](handleError(_0xaf2bca,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index b0f1a36..649072b 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec31=['api','moment','bluebird','request-promise','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util'];(function(_0x133425,_0x2d60f2){var _0x45c4a4=function(_0x39b453){while(--_0x39b453){_0x133425['push'](_0x133425['shift']());}};_0x45c4a4(++_0x2d60f2);}(_0xec31,0xc4));var _0x1ec3=function(_0x2b41e3,_0x5d920c){_0x2b41e3=_0x2b41e3-0x0;var _0x4e8aeb=_0xec31[_0x2b41e3];return _0x4e8aeb;};'use strict';var _=require(_0x1ec3('0x0'));var util=require(_0x1ec3('0x1'));var logger=require('../../config/logger')(_0x1ec3('0x2'));var moment=require(_0x1ec3('0x3'));var BPromise=require(_0x1ec3('0x4'));var rp=require(_0x1ec3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1ec3('0x6'));var attributes=require(_0x1ec3('0x7'));module['exports']=function(_0x1ad8be,_0x916974){return _0x1ad8be[_0x1ec3('0x8')](_0x1ec3('0x9'),attributes,{'tableName':_0x1ec3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10fe=['moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger'];(function(_0x7e5e6,_0x3e0055){var _0x1434cb=function(_0x39eacc){while(--_0x39eacc){_0x7e5e6['push'](_0x7e5e6['shift']());}};_0x1434cb(++_0x3e0055);}(_0x10fe,0x159));var _0xe10f=function(_0xbbcd26,_0x17ba2b){_0xbbcd26=_0xbbcd26-0x0;var _0x272bd0=_0x10fe[_0xbbcd26];return _0x272bd0;};'use strict';var _=require(_0xe10f('0x0'));var util=require(_0xe10f('0x1'));var logger=require(_0xe10f('0x2'))('api');var moment=require(_0xe10f('0x3'));var BPromise=require(_0xe10f('0x4'));var rp=require(_0xe10f('0x5'));var fs=require('fs');var path=require(_0xe10f('0x6'));var rimraf=require('rimraf');var config=require(_0xe10f('0x7'));var attributes=require(_0xe10f('0x8'));module[_0xe10f('0x9')]=function(_0x53a3da,_0x1762e4){return _0x53a3da[_0xe10f('0xa')](_0xe10f('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 25b620f..c34c12c 100644 --- a/server/api/trigger/trigger.rpc.js +++ b/server/api/trigger/trigger.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea28=['code','message','result','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','ShowTrigger','find','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3db464,_0x53fd4e){var _0x81faa2=function(_0x98fc91){while(--_0x98fc91){_0x3db464['push'](_0x3db464['shift']());}};_0x81faa2(++_0x53fd4e);}(_0xea28,0x13a));var _0x8ea2=function(_0x5aa6db,_0x4992a9){_0x5aa6db=_0x5aa6db-0x0;var _0x359596=_0xea28[_0x5aa6db];return _0x359596;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('Trigger,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});}exports[_0x8ea2('0x17')]=function(_0x1b64cf){var _0x174ef2=this;return new Promise(function(_0x467045,_0x2a0329){return db[_0x8ea2('0x18')][_0x8ea2('0x19')]({'raw':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf[_0x8ea2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1b64cf['options']?_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1b')]||null:null,'attributes':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf['options'][_0x8ea2('0x1c')]||null:null,'limit':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf['options'][_0x8ea2('0x1d')]||null:null,'include':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1e')]?_[_0x8ea2('0x1f')](_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1e')],function(_0x1e4cc9){return{'model':db[_0x1e4cc9[_0x8ea2('0x20')]],'as':_0x1e4cc9['as'],'attributes':_0x1e4cc9['attributes'],'include':_0x1e4cc9[_0x8ea2('0x1e')]?_['map'](_0x1e4cc9[_0x8ea2('0x1e')],function(_0x42bec8){return{'model':db[_0x42bec8[_0x8ea2('0x20')]],'as':_0x42bec8['as'],'attributes':_0x42bec8['attributes'],'include':_0x42bec8['include']?_[_0x8ea2('0x1f')](_0x42bec8['include'],function(_0x200a49){return{'model':db[_0x200a49['model']],'as':_0x200a49['as'],'attributes':_0x200a49[_0x8ea2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8ea2('0xd')](function(_0x21c526){logger[_0x8ea2('0xe')]('GetTrigger',_0x1b64cf);logger['debug'](_0x8ea2('0x17'),_0x1b64cf,JSON['stringify'](_0x21c526));_0x467045(_0x21c526);})[_0x8ea2('0x16')](function(_0x287078){logger[_0x8ea2('0x12')](_0x8ea2('0x17'),_0x287078[_0x8ea2('0x14')],_0x1b64cf);_0x2a0329(_0x174ef2[_0x8ea2('0x12')](0x1f4,_0x287078[_0x8ea2('0x14')]));});});};exports[_0x8ea2('0x21')]=function(_0x19e868){var _0x9c5fac=this;return new Promise(function(_0x56d914,_0x5b7ff9){return db[_0x8ea2('0x18')][_0x8ea2('0x22')]({'raw':_0x19e868['options']?_0x19e868['options'][_0x8ea2('0x23')]===undefined?!![]:![]:!![],'where':_0x19e868['options']?_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1b')]||null:null,'attributes':_0x19e868['options']?_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1c')]||null:null,'include':_0x19e868[_0x8ea2('0x1a')]?_0x19e868['options']['include']?_['map'](_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1e')],function(_0x3fc785){return{'model':db[_0x3fc785['model']],'as':_0x3fc785['as'],'attributes':_0x3fc785[_0x8ea2('0x1c')],'include':_0x3fc785[_0x8ea2('0x1e')]?_[_0x8ea2('0x1f')](_0x3fc785[_0x8ea2('0x1e')],function(_0x253031){return{'model':db[_0x253031[_0x8ea2('0x20')]],'as':_0x253031['as'],'attributes':_0x253031[_0x8ea2('0x1c')],'include':_0x253031[_0x8ea2('0x1e')]?_['map'](_0x253031[_0x8ea2('0x1e')],function(_0x29e3f5){return{'model':db[_0x29e3f5[_0x8ea2('0x20')]],'as':_0x29e3f5['as'],'attributes':_0x29e3f5[_0x8ea2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a1f14){logger['info'](_0x8ea2('0x21'),_0x19e868);logger[_0x8ea2('0x24')](_0x8ea2('0x21'),_0x19e868,JSON[_0x8ea2('0x11')](_0x2a1f14));_0x56d914(_0x2a1f14);})['catch'](function(_0x2bed24){logger['error']('ShowTrigger',_0x2bed24[_0x8ea2('0x14')],_0x19e868);_0x5b7ff9(_0x9c5fac['error'](0x1f4,_0x2bed24[_0x8ea2('0x14')]));});});}; \ No newline at end of file +var _0x1eba=['find','where','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','catch','ShowTrigger'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0x1eba[_0xba1760];return _0x1f3143;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bfbb0,_0x39a5a3,_0x7d2982){return new BPromise(function(_0x2aebb6,_0x9d7113){return client['request'](_0x2bfbb0,_0x7d2982)[_0xa1eb('0xc')](function(_0x4d4aaf){logger[_0xa1eb('0xd')]('Trigger,\x20%s,\x20%s',_0x39a5a3,_0xa1eb('0xe'));logger['debug'](_0xa1eb('0xf'),_0x39a5a3,'request\x20sent',JSON[_0xa1eb('0x10')](_0x4d4aaf));if(_0x4d4aaf[_0xa1eb('0x11')]){if(_0x4d4aaf[_0xa1eb('0x11')]['code']===0x1f4){logger[_0xa1eb('0x11')](_0xa1eb('0x12'),_0x39a5a3,_0x4d4aaf['error'][_0xa1eb('0x13')]);return _0x9d7113(_0x4d4aaf['error']['message']);}logger[_0xa1eb('0x11')]('Trigger,\x20%s,\x20%s',_0x39a5a3,_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);return _0x2aebb6(_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);}else{logger[_0xa1eb('0xd')](_0xa1eb('0x12'),_0x39a5a3,_0xa1eb('0xe'));_0x2aebb6(_0x4d4aaf[_0xa1eb('0x14')][_0xa1eb('0x13')]);}})['catch'](function(_0xbd6a6b){logger['error'](_0xa1eb('0x12'),_0x39a5a3,_0xbd6a6b);_0x9d7113(_0xbd6a6b);});});}exports[_0xa1eb('0x15')]=function(_0x33c4e3){var _0x1a5d2c=this;return new Promise(function(_0x49bfaa,_0x1dd621){return db[_0xa1eb('0x16')][_0xa1eb('0x17')]({'raw':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')][_0xa1eb('0x19')]===undefined?!![]:![]:!![],'where':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')]['where']||null:null,'attributes':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3['options'][_0xa1eb('0x1a')]||null:null,'limit':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')][_0xa1eb('0x1b')]||null:null,'include':_0x33c4e3['options']?_0x33c4e3['options'][_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x33c4e3['options'][_0xa1eb('0x1c')],function(_0x250728){return{'model':db[_0x250728[_0xa1eb('0x1e')]],'as':_0x250728['as'],'attributes':_0x250728[_0xa1eb('0x1a')],'include':_0x250728[_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x250728[_0xa1eb('0x1c')],function(_0x364b1c){return{'model':db[_0x364b1c[_0xa1eb('0x1e')]],'as':_0x364b1c['as'],'attributes':_0x364b1c[_0xa1eb('0x1a')],'include':_0x364b1c[_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x364b1c['include'],function(_0x7c617e){return{'model':db[_0x7c617e[_0xa1eb('0x1e')]],'as':_0x7c617e['as'],'attributes':_0x7c617e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa1eb('0xc')](function(_0x4e2aa7){logger[_0xa1eb('0xd')](_0xa1eb('0x15'),_0x33c4e3);logger['debug'](_0xa1eb('0x15'),_0x33c4e3,JSON[_0xa1eb('0x10')](_0x4e2aa7));_0x49bfaa(_0x4e2aa7);})[_0xa1eb('0x1f')](function(_0x4f64bb){logger[_0xa1eb('0x11')](_0xa1eb('0x15'),_0x4f64bb['message'],_0x33c4e3);_0x1dd621(_0x1a5d2c[_0xa1eb('0x11')](0x1f4,_0x4f64bb[_0xa1eb('0x13')]));});});};exports[_0xa1eb('0x20')]=function(_0x2e281a){var _0x5a6544=this;return new Promise(function(_0x52f9c7,_0x9d49d8){return db[_0xa1eb('0x16')][_0xa1eb('0x21')]({'raw':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x19')]===undefined?!![]:![]:!![],'where':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x22')]||null:null,'attributes':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')]['attributes']||null:null,'include':_0x2e281a['options']?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x1c')],function(_0x58d336){return{'model':db[_0x58d336['model']],'as':_0x58d336['as'],'attributes':_0x58d336[_0xa1eb('0x1a')],'include':_0x58d336[_0xa1eb('0x1c')]?_['map'](_0x58d336['include'],function(_0x3761bf){return{'model':db[_0x3761bf['model']],'as':_0x3761bf['as'],'attributes':_0x3761bf[_0xa1eb('0x1a')],'include':_0x3761bf['include']?_[_0xa1eb('0x1d')](_0x3761bf[_0xa1eb('0x1c')],function(_0x229931){return{'model':db[_0x229931['model']],'as':_0x229931['as'],'attributes':_0x229931[_0xa1eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1eb('0xc')](function(_0x35ed30){logger['info'](_0xa1eb('0x20'),_0x2e281a);logger[_0xa1eb('0x23')](_0xa1eb('0x20'),_0x2e281a,JSON[_0xa1eb('0x10')](_0x35ed30));_0x52f9c7(_0x35ed30);})[_0xa1eb('0x1f')](function(_0x5912d5){logger[_0xa1eb('0x11')](_0xa1eb('0x20'),_0x5912d5[_0xa1eb('0x13')],_0x2e281a);_0x9d49d8(_0x5a6544[_0xa1eb('0x11')](0x1f4,_0x5912d5[_0xa1eb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0ec64f3..6a4931b 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c4e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','/:id/clone','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4c4e,0x152));var _0xe4c4=function(_0x20d040,_0x449695){_0x20d040=_0x20d040-0x0;var _0x46e252=_0x4c4e[_0x20d040];return _0x46e252;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var auth=require(_0xe4c4('0x4'));var interaction=require(_0xe4c4('0x5'));var config=require(_0xe4c4('0x6'));var controller=require('./trunk.controller');router[_0xe4c4('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4c4('0x8')]);router[_0xe4c4('0x7')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xb')]);router[_0xe4c4('0xc')](_0xe4c4('0xd'),auth[_0xe4c4('0xa')](),controller['clone']);router['post']('/',auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xe')]);router[_0xe4c4('0xf')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x10')]);router['delete'](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x11')]);module[_0xe4c4('0x12')]=router; \ No newline at end of file +var _0x3e74=['/:id/clone','put','/:id','update','exports','multer','path','connect-timeout','express','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','show','post'];(function(_0x39ff0c,_0x2069c7){var _0x5c4ca6=function(_0xa4ffba){while(--_0xa4ffba){_0x39ff0c['push'](_0x39ff0c['shift']());}};_0x5c4ca6(++_0x2069c7);}(_0x3e74,0x175));var _0x43e7=function(_0x3fe085,_0x739bf9){_0x3fe085=_0x3fe085-0x0;var _0x599686=_0x3e74[_0x3fe085];return _0x599686;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')](_0x43e7('0xb'),auth[_0x43e7('0x7')](),controller['clone']);router[_0x43e7('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xc')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['delete'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['destroy']);module[_0x43e7('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 0e16c45..6836c74 100644 --- a/server/api/trunk/trunk.attributes.js +++ b/server/api/trunk/trunk.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8e7=['INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','BOOLEAN','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'];(function(_0x5da11a,_0x4ab614){var _0x481113=function(_0xe2088d){while(--_0xe2088d){_0x5da11a['push'](_0x5da11a['shift']());}};_0x481113(++_0x4ab614);}(_0xd8e7,0x145));var _0x7d8e=function(_0x4c529c,_0x263a7d){_0x4c529c=_0x4c529c-0x0;var _0x3f1c8e=_0xd8e7[_0x4c529c];return _0x3f1c8e;};'use strict';var Sequelize=require('sequelize');module[_0x7d8e('0x0')]={'name':{'type':Sequelize[_0x7d8e('0x1')],'allowNull':![],'unique':_0x7d8e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x4'),_0x7d8e('0x5'),_0x7d8e('0x6')),'allowNull':![],'defaultValue':_0x7d8e('0x4')},'context':{'type':Sequelize[_0x7d8e('0x1')],'allowNull':![],'defaultValue':_0x7d8e('0x7')},'callingpres':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x8'),_0x7d8e('0x9'),_0x7d8e('0xa'),_0x7d8e('0xb'),_0x7d8e('0xc'),_0x7d8e('0xd'),_0x7d8e('0xe'),_0x7d8e('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x7d8e('0x1')]},'secret':{'type':Sequelize[_0x7d8e('0x1')]},'md5secret':{'type':Sequelize[_0x7d8e('0x1')]},'remotesecret':{'type':Sequelize[_0x7d8e('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x7d8e('0x10'),'set':function(_0x13face){this[_0x7d8e('0x11')]('transport',_0x13face?_0x13face[_0x7d8e('0x12')](','):null);},'get':function(){return this[_0x7d8e('0x13')]('transport')?this[_0x7d8e('0x13')](_0x7d8e('0x14'))['split'](','):null;},'comment':_0x7d8e('0x15')},'dtmfmode':{'type':Sequelize[_0x7d8e('0x3')]('rfc2833','info',_0x7d8e('0x16'),_0x7d8e('0x17'),_0x7d8e('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7d8e('0x3')]('yes','no',_0x7d8e('0x19'),_0x7d8e('0x1a'),_0x7d8e('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7d8e('0x1')]},'directmediadeny':{'type':Sequelize[_0x7d8e('0x1')]},'nat':{'type':Sequelize[_0x7d8e('0x1')],'defaultValue':_0x7d8e('0x1d'),'set':function(_0x5287d2){this[_0x7d8e('0x11')](_0x7d8e('0x1e'),_0x5287d2?_0x5287d2[_0x7d8e('0x12')](','):null);},'get':function(){return this[_0x7d8e('0x13')](_0x7d8e('0x1e'))?this[_0x7d8e('0x13')](_0x7d8e('0x1e'))[_0x7d8e('0x1f')](','):null;},'comment':_0x7d8e('0x20')},'callgroup':{'type':Sequelize[_0x7d8e('0x1')]},'namedcallgroup':{'type':Sequelize[_0x7d8e('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x7d8e('0x1')]},'language':{'type':Sequelize[_0x7d8e('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7d8e('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x7d8e('0x21')},'allow':{'type':Sequelize[_0x7d8e('0x1')],'allowNull':![],'defaultValue':_0x7d8e('0x22'),'set':function(_0x56d1a2){this['setDataValue'](_0x7d8e('0x23'),_0x56d1a2?_0x56d1a2[_0x7d8e('0x12')](';'):_0x7d8e('0x22'));},'get':function(){return this[_0x7d8e('0x13')](_0x7d8e('0x23'))?this[_0x7d8e('0x13')](_0x7d8e('0x23'))['split'](';'):null;},'comment':_0x7d8e('0x24')},'autoframing':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no')},'insecure':{'type':Sequelize[_0x7d8e('0x1')],'defaultValue':_0x7d8e('0x25'),'set':function(_0x5ca475){this['setDataValue']('insecure',_0x5ca475?_0x5ca475[_0x7d8e('0x12')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x7d8e('0x13')]('insecure')[_0x7d8e('0x1f')](','):null;},'comment':_0x7d8e('0x26')},'trustrpid':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no','never')},'promiscredir':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0x7d8e('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'setvar':{'type':Sequelize[_0x7d8e('0x1')]},'callerid':{'type':Sequelize[_0x7d8e('0x1')],'defaultValue':_0x7d8e('0x28')},'amaflags':{'type':Sequelize[_0x7d8e('0x1')]},'callcounter':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no'),'defaultValue':_0x7d8e('0x1c')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no')},'allowsubscribe':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0x7d8e('0x1')]},'template':{'type':Sequelize[_0x7d8e('0x1')]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x7d8e('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x7d8e('0x29'),_0x7d8e('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x2b'),_0x7d8e('0x2c')),'defaultValue':_0x7d8e('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x7d8e('0x1')]},'regexten':{'type':Sequelize[_0x7d8e('0x1')]},'fromdomain':{'type':Sequelize[_0x7d8e('0x1')]},'fromuser':{'type':Sequelize[_0x7d8e('0x1')]},'port':{'type':Sequelize[_0x7d8e('0x27')](0x5)},'qualify':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no'),'defaultValue':_0x7d8e('0x1c')},'keepalive':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x7d8e('0x1')]},'rtptimeout':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no',_0x7d8e('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7d8e('0x1')]},'callbackextension':{'type':Sequelize[_0x7d8e('0x1')]},'timert1':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'timerb':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x7d8e('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7d8e('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x7d8e('0x1')]},'use_q850_reason':{'type':Sequelize[_0x7d8e('0x1')]},'maxforwards':{'type':Sequelize[_0x7d8e('0x27')](0xb)},'encryption':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no')},'force_avp':{'type':Sequelize[_0x7d8e('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x7d8e('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no',_0x7d8e('0x2e'),_0x7d8e('0x2f'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x7d8e('0x1')]},'dtlscipher':{'type':Sequelize[_0x7d8e('0x1')]},'dtlscafile':{'type':Sequelize[_0x7d8e('0x1')]},'dtlscapath':{'type':Sequelize[_0x7d8e('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x7d8e('0x30'),'passive',_0x7d8e('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7d8e('0x1')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x7d8e('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no')},'subscribemwi':{'type':Sequelize[_0x7d8e('0x3')](_0x7d8e('0x1c'),'no')},'vmexten':{'type':Sequelize[_0x7d8e('0x1')]},'mohinterpret':{'type':Sequelize[_0x7d8e('0x1')]},'mohsuggest':{'type':Sequelize[_0x7d8e('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7d8e('0x1')]},'host':{'type':Sequelize[_0x7d8e('0x1')],'defaultValue':_0x7d8e('0x32')},'canreinvite':{'type':Sequelize[_0x7d8e('0x3')]('yes','no',_0x7d8e('0x19'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7d8e('0x1')]},'otherFields':{'type':Sequelize[_0x7d8e('0x1')]},'active':{'type':Sequelize[_0x7d8e('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x569f=['fingerprint','certificate','active','passive','actpass','dynamic','BOOLEAN','exports','STRING','ENUM','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','uac','uas'];(function(_0x4a49f2,_0x2be437){var _0x37e097=function(_0x5f2b0d){while(--_0x5f2b0d){_0x4a49f2['push'](_0x4a49f2['shift']());}};_0x37e097(++_0x2be437);}(_0x569f,0x15e));var _0xf569=function(_0x4a6a4c,_0x5149d1){_0x4a6a4c=_0x4a6a4c-0x0;var _0xdb0e5b=_0x569f[_0x4a6a4c];return _0xdb0e5b;};'use strict';var Sequelize=require('sequelize');module[_0xf569('0x0')]={'name':{'type':Sequelize[_0xf569('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf569('0x2')]('friend',_0xf569('0x3'),_0xf569('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xf569('0x1')],'allowNull':![],'defaultValue':_0xf569('0x5')},'callingpres':{'type':Sequelize[_0xf569('0x2')]('ALLOWED_NOT_SCREENED',_0xf569('0x6'),_0xf569('0x7'),_0xf569('0x8'),_0xf569('0x9'),_0xf569('0xa'),_0xf569('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xf569('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xf569('0x1')]},'md5secret':{'type':Sequelize[_0xf569('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xf569('0x1')],'defaultValue':_0xf569('0xc'),'set':function(_0x192629){this['setDataValue'](_0xf569('0xd'),_0x192629?_0x192629[_0xf569('0xe')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xf569('0xf')]('transport')[_0xf569('0x10')](','):null;},'comment':_0xf569('0x11')},'dtmfmode':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x12'),_0xf569('0x13'),'shortinfo',_0xf569('0x14'),_0xf569('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf569('0x2')]('yes','no',_0xf569('0x16'),_0xf569('0x17'),_0xf569('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf569('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x4cdda9){this['setDataValue']('nat',_0x4cdda9?_0x4cdda9[_0xf569('0xe')](','):null);},'get':function(){return this[_0xf569('0xf')]('nat')?this['getDataValue'](_0xf569('0x1a'))['split'](','):null;},'comment':_0xf569('0x1b')},'callgroup':{'type':Sequelize[_0xf569('0x1')]},'namedcallgroup':{'type':Sequelize[_0xf569('0x1')]},'pickupgroup':{'type':Sequelize[_0xf569('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf569('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf569('0x1')],'defaultValue':_0xf569('0x1c')},'allow':{'type':Sequelize[_0xf569('0x1')],'allowNull':![],'defaultValue':_0xf569('0x1d'),'set':function(_0x510df8){this[_0xf569('0x1e')](_0xf569('0x1f'),_0x510df8?_0x510df8[_0xf569('0xe')](';'):_0xf569('0x1d'));},'get':function(){return this[_0xf569('0xf')](_0xf569('0x1f'))?this[_0xf569('0xf')](_0xf569('0x1f'))[_0xf569('0x10')](';'):null;},'comment':_0xf569('0x20')},'autoframing':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x46b974){this[_0xf569('0x1e')](_0xf569('0x21'),_0x46b974?_0x46b974[_0xf569('0xe')](','):null);},'get':function(){return this[_0xf569('0xf')]('insecure')?this['getDataValue'](_0xf569('0x21'))[_0xf569('0x10')](','):null;},'comment':_0xf569('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf569('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no',_0xf569('0x23'))},'promiscredir':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xf569('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0xf569('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf569('0x1')],'defaultValue':_0xf569('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf569('0x19')},'busylevel':{'type':Sequelize[_0xf569('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xf569('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf569('0x1')]},'videosupport':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no',_0xf569('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf569('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'mailbox':{'type':Sequelize[_0xf569('0x1')]},'session_timers':{'type':Sequelize[_0xf569('0x2')]('accept',_0xf569('0x27'),'originate')},'session_expires':{'type':Sequelize[_0xf569('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xf569('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x28'),_0xf569('0x29')),'defaultValue':_0xf569('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xf569('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf569('0x24')](0x5)},'qualify':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no'),'defaultValue':_0xf569('0x19')},'keepalive':{'type':Sequelize[_0xf569('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xf569('0x1')]},'defaultuser':{'type':Sequelize[_0xf569('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf569('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf569('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf569('0x1')]},'callbackextension':{'type':Sequelize[_0xf569('0x1')]},'timert1':{'type':Sequelize[_0xf569('0x24')](0xb)},'timerb':{'type':Sequelize[_0xf569('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf569('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf569('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xf569('0x1')]},'use_q850_reason':{'type':Sequelize[_0xf569('0x1')]},'maxforwards':{'type':Sequelize[_0xf569('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'force_avp':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'icesupport':{'type':Sequelize[_0xf569('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xf569('0x2')]('yes','no',_0xf569('0x2a'),_0xf569('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xf569('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xf569('0x1')]},'dtlscipher':{'type':Sequelize[_0xf569('0x1')]},'dtlscafile':{'type':Sequelize[_0xf569('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x2c'),_0xf569('0x2d'),_0xf569('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf569('0x1')]},'recordofffeature':{'type':Sequelize[_0xf569('0x1')]},'call_limit':{'type':Sequelize[_0xf569('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'vmexten':{'type':Sequelize[_0xf569('0x1')]},'mohinterpret':{'type':Sequelize[_0xf569('0x1')]},'mohsuggest':{'type':Sequelize[_0xf569('0x1')]},'parkinglot':{'type':Sequelize[_0xf569('0x1')]},'description':{'type':Sequelize[_0xf569('0x1')]},'host':{'type':Sequelize[_0xf569('0x1')],'defaultValue':_0xf569('0x2f')},'canreinvite':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no',_0xf569('0x16'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xf569('0x1')]},'active':{'type':Sequelize[_0xf569('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf569('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index ddf9ff6..2839af0 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b06=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','count','includeAll','include','findAll','rows','catch','show','params','clone','options','omit','createdAt','updatedAt','body','create','user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','server/files/templates/trunk.ejs','utf8','readFileSync','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','UserProfileSection','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format'];(function(_0x11731f,_0x2271b5){var _0x14587c=function(_0x31e014){while(--_0x31e014){_0x11731f['push'](_0x11731f['shift']());}};_0x14587c(++_0x2271b5);}(_0x2b06,0x70));var _0x62b0=function(_0x3fc287,_0x5c3f36){_0x3fc287=_0x3fc287-0x0;var _0x33af9f=_0x2b06[_0x3fc287];return _0x33af9f;};'use strict';var pdf=require(_0x62b0('0x0'));var emlformat=require(_0x62b0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x62b0('0x2'));var jsonpatch=require(_0x62b0('0x3'));var rp=require(_0x62b0('0x4'));var moment=require(_0x62b0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x62b0('0x6'));var util=require(_0x62b0('0x7'));var path=require(_0x62b0('0x8'));var sox=require(_0x62b0('0x9'));var csv=require(_0x62b0('0xa'));var ejs=require(_0x62b0('0xb'));var fs=require('fs');var _=require(_0x62b0('0xc'));var squel=require('squel');var crypto=require(_0x62b0('0xd'));var jsforce=require(_0x62b0('0xe'));var deskjs=require(_0x62b0('0xf'));var toCsv=require(_0x62b0('0xa'));var querystring=require(_0x62b0('0x10'));var Papa=require(_0x62b0('0x11'));var Redis=require('ioredis');var authService=require(_0x62b0('0x12'));var qs=require(_0x62b0('0x13'));var as=require(_0x62b0('0x14'));var hardwareService=require(_0x62b0('0x15'));var logger=require('../../config/logger')(_0x62b0('0x16'));var utils=require(_0x62b0('0x17'));var config=require(_0x62b0('0x18'));var licenseUtil=require(_0x62b0('0x19'));var db=require(_0x62b0('0x1a'))['db'];var jayson=require(_0x62b0('0x1b'));var client=jayson[_0x62b0('0x1c')][_0x62b0('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x27ede1,_0x3e73a2,_0x4013ba,_0x101c22){return new BPromise(function(_0x3d20d4,_0x560f9b){var _0xb42b62=_0x101c22||client;return _0xb42b62[_0x62b0('0x1e')](_0x27ede1,_0x4013ba)[_0x62b0('0x1f')](function(_0x2c3453){logger[_0x62b0('0x20')]('Trunk,\x20%s,\x20%s',_0x3e73a2,'request\x20sent');logger['debug'](_0x62b0('0x21'),_0x3e73a2,_0x62b0('0x22'),JSON[_0x62b0('0x23')](_0x2c3453));if(_0x2c3453[_0x62b0('0x24')]){if(_0x2c3453[_0x62b0('0x24')][_0x62b0('0x25')]===0x1f4){logger[_0x62b0('0x24')]('Trunk,\x20%s,\x20%s',_0x3e73a2,_0x2c3453[_0x62b0('0x24')]['message']);return _0x560f9b(_0x2c3453[_0x62b0('0x24')][_0x62b0('0x26')]);}logger['error'](_0x62b0('0x27'),_0x3e73a2,_0x2c3453['error'][_0x62b0('0x26')]);return _0x3d20d4(_0x2c3453[_0x62b0('0x24')][_0x62b0('0x26')]);}else{logger[_0x62b0('0x20')](_0x62b0('0x27'),_0x3e73a2,_0x62b0('0x22'));_0x3d20d4(_0x2c3453[_0x62b0('0x28')][_0x62b0('0x26')]);}})['catch'](function(_0x4d86c7){logger['error'](_0x62b0('0x27'),_0x3e73a2,_0x4d86c7);_0x560f9b(_0x4d86c7);});});}function respondWithStatusCode(_0x10f467,_0x3de82b){_0x3de82b=_0x3de82b||0xcc;return function(_0x40610a){if(_0x40610a){return _0x10f467[_0x62b0('0x29')](_0x3de82b);}return _0x10f467[_0x62b0('0x2a')](_0x3de82b)[_0x62b0('0x2b')]();};}function respondWithResult(_0x4b545d,_0x26c9e5){_0x26c9e5=_0x26c9e5||0xc8;return function(_0x110b21){if(_0x110b21){return _0x4b545d[_0x62b0('0x2a')](_0x26c9e5)[_0x62b0('0x2c')](_0x110b21);}};}function respondWithFilteredResult(_0x1d1283,_0x53e3a4){return function(_0x4fdca8){if(_0x4fdca8){var _0x1c88d5=_0x4fdca8['count'],_0x1d05e4=_0x53e3a4[_0x62b0('0x2d')],_0x5d8cfc=_0x53e3a4[_0x62b0('0x2d')]+_0x53e3a4[_0x62b0('0x2e')],_0x4c6813;if(_0x5d8cfc>=_0x1c88d5){_0x5d8cfc=_0x1c88d5;_0x4c6813=0xc8;}else{_0x4c6813=0xce;}_0x1d1283[_0x62b0('0x2a')](_0x4c6813);return _0x1d1283[_0x62b0('0x2f')](_0x62b0('0x30'),_0x1d05e4+'-'+_0x5d8cfc+'/'+_0x1c88d5)[_0x62b0('0x2c')](_0x4fdca8);}return null;};}function patchUpdates(_0x525d68){return function(_0x8d4a72){try{jsonpatch['apply'](_0x8d4a72,_0x525d68,!![]);}catch(_0x503957){return BPromise[_0x62b0('0x31')](_0x503957);}return _0x8d4a72[_0x62b0('0x32')]();};}function saveUpdates(_0x2c8131,_0x82fed1){return function(_0x138491){if(_0x138491){return _0x138491[_0x62b0('0x33')](_0x2c8131)['then'](function(_0xfa4582){return _0xfa4582;});}return null;};}function removeEntity(_0x50623c,_0x11ac16){return function(_0x1c3ae7){if(_0x1c3ae7){return _0x1c3ae7[_0x62b0('0x34')]()[_0x62b0('0x1f')](function(){var _0x57ddb7=_0x1c3ae7[_0x62b0('0x35')]({'plain':!![]});var _0xb2d165=_0x62b0('0x36');return db[_0x62b0('0x37')][_0x62b0('0x34')]({'where':{'type':_0xb2d165,'resourceId':_0x57ddb7['id']}})[_0x62b0('0x1f')](function(){return _0x1c3ae7;});})[_0x62b0('0x1f')](function(){_0x50623c[_0x62b0('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x551f52,_0x1f8b47){return function(_0x4e25e0){if(!_0x4e25e0){_0x551f52['sendStatus'](0x194);}return _0x4e25e0;};}function handleError(_0x2cc8ca,_0x1cc664){_0x1cc664=_0x1cc664||0x1f4;return function(_0x38471c){logger['error'](_0x38471c[_0x62b0('0x38')]);if(_0x38471c[_0x62b0('0x39')]){delete _0x38471c[_0x62b0('0x39')];}_0x2cc8ca[_0x62b0('0x2a')](_0x1cc664)[_0x62b0('0x3a')](_0x38471c);};}exports[_0x62b0('0x3b')]=function(_0x4d9ef5,_0x3420fc){var _0x414d84={},_0x27973b={},_0x104c64={'count':0x0,'rows':[]};var _0x38916c=_['map'](db[_0x62b0('0x3c')][_0x62b0('0x3d')],function(_0x1c28d2){return{'name':_0x1c28d2[_0x62b0('0x3e')],'type':_0x1c28d2[_0x62b0('0x3f')][_0x62b0('0x40')]};});_0x27973b['model']=_[_0x62b0('0x41')](_0x38916c,_0x62b0('0x39'));_0x27973b[_0x62b0('0x42')]=_[_0x62b0('0x43')](_0x4d9ef5['query']);_0x27973b[_0x62b0('0x44')]=_[_0x62b0('0x45')](_0x27973b[_0x62b0('0x46')],_0x27973b['query']);_0x414d84['attributes']=_[_0x62b0('0x45')](_0x27973b[_0x62b0('0x46')],qs[_0x62b0('0x47')](_0x4d9ef5[_0x62b0('0x42')]['fields']));_0x414d84[_0x62b0('0x48')]=_0x414d84[_0x62b0('0x48')][_0x62b0('0x49')]?_0x414d84[_0x62b0('0x48')]:_0x27973b[_0x62b0('0x46')];if(!_0x4d9ef5['query'][_0x62b0('0x4a')](_0x62b0('0x4b'))){_0x414d84[_0x62b0('0x2e')]=qs[_0x62b0('0x2e')](_0x4d9ef5['query'][_0x62b0('0x2e')]);_0x414d84['offset']=qs['offset'](_0x4d9ef5['query'][_0x62b0('0x2d')]);}_0x414d84[_0x62b0('0x4c')]=qs[_0x62b0('0x4d')](_0x4d9ef5[_0x62b0('0x42')]['sort']);_0x414d84[_0x62b0('0x4e')]=qs['filters'](_['pick'](_0x4d9ef5[_0x62b0('0x42')],_0x27973b[_0x62b0('0x44')]),_0x38916c);if(_0x4d9ef5[_0x62b0('0x42')]['filter']){_0x414d84[_0x62b0('0x4e')]=_[_0x62b0('0x4f')](_0x414d84[_0x62b0('0x4e')],{'$or':_[_0x62b0('0x41')](_0x38916c,function(_0x5dda2d){if(_0x5dda2d[_0x62b0('0x3f')]!=='VIRTUAL'){var _0x531176={};_0x531176[_0x5dda2d['name']]={'$like':'%'+_0x4d9ef5['query']['filter']+'%'};return _0x531176;}})});}_0x414d84=_[_0x62b0('0x4f')]({},_0x414d84,_0x4d9ef5['options']);var _0x5e3a1f={'where':_0x414d84[_0x62b0('0x4e')]};return db['Trunk'][_0x62b0('0x50')](_0x5e3a1f)[_0x62b0('0x1f')](function(_0x4b0d42){_0x104c64['count']=_0x4b0d42;if(_0x4d9ef5['query'][_0x62b0('0x51')]){_0x414d84[_0x62b0('0x52')]=[{'all':!![]}];}return db[_0x62b0('0x3c')][_0x62b0('0x53')](_0x414d84);})['then'](function(_0xbefe6e){_0x104c64[_0x62b0('0x54')]=_0xbefe6e;return _0x104c64;})[_0x62b0('0x1f')](respondWithFilteredResult(_0x3420fc,_0x414d84))[_0x62b0('0x55')](handleError(_0x3420fc,null));};exports[_0x62b0('0x56')]=function(_0x4e5f41,_0x452c52){var _0x5ee3dc={'raw':![],'where':{'id':_0x4e5f41[_0x62b0('0x57')]['id']}},_0x48fe16={};_0x48fe16[_0x62b0('0x46')]=_['keys'](db[_0x62b0('0x3c')]['rawAttributes']);_0x48fe16[_0x62b0('0x42')]=_['keys'](_0x4e5f41['query']);_0x48fe16[_0x62b0('0x44')]=_['intersection'](_0x48fe16[_0x62b0('0x46')],_0x48fe16[_0x62b0('0x42')]);_0x5ee3dc[_0x62b0('0x48')]=_[_0x62b0('0x45')](_0x48fe16[_0x62b0('0x46')],qs[_0x62b0('0x47')](_0x4e5f41[_0x62b0('0x42')][_0x62b0('0x47')]));_0x5ee3dc[_0x62b0('0x48')]=_0x5ee3dc[_0x62b0('0x48')][_0x62b0('0x49')]?_0x5ee3dc[_0x62b0('0x48')]:_0x48fe16[_0x62b0('0x46')];if(_0x4e5f41[_0x62b0('0x42')][_0x62b0('0x51')]){_0x5ee3dc[_0x62b0('0x52')]=[{'all':!![]}];}_0x5ee3dc=_[_0x62b0('0x4f')]({},_0x5ee3dc,_0x4e5f41['options']);return db['Trunk']['find'](_0x5ee3dc)[_0x62b0('0x1f')](handleEntityNotFound(_0x452c52,null))[_0x62b0('0x1f')](respondWithResult(_0x452c52,null))[_0x62b0('0x55')](handleError(_0x452c52,null));};exports[_0x62b0('0x58')]=function(_0x273333,_0x1f826e){var _0x505405={'where':{'id':_0x273333[_0x62b0('0x57')]['id']}},_0xfc7ea3={};_0xfc7ea3[_0x62b0('0x46')]=_['keys'](db[_0x62b0('0x3c')]['rawAttributes']);_0x505405[_0x62b0('0x48')]=_['intersection'](_0xfc7ea3[_0x62b0('0x46')],qs['fields'](_0x273333[_0x62b0('0x42')]['fields']));_0x505405[_0x62b0('0x48')]=_0x505405['attributes']['length']?_0x505405['attributes']:_0xfc7ea3['model'];if(_0x273333[_0x62b0('0x42')]['includeAll']){_0x505405[_0x62b0('0x52')]=[{'all':!![]}];}_0x505405=_[_0x62b0('0x4f')]({},_0x505405,_0x273333[_0x62b0('0x59')]);return db['Trunk']['find'](_0x505405)['then'](handleEntityNotFound(_0x1f826e,null))['then'](function(_0x2d404a){if(_0x2d404a){var _0x2c7aea=_0x2d404a[_0x62b0('0x35')]({'plain':!![]});_0x2c7aea=qs[_0x62b0('0x5a')](_0x2c7aea,['id',_0x62b0('0x5b'),_0x62b0('0x5c')]);_0x273333[_0x62b0('0x5d')]=_['omit'](_0x273333[_0x62b0('0x5d')],['id',_0x62b0('0x5b'),'updatedAt']);return db['Trunk'][_0x62b0('0x5e')](_[_0x62b0('0x4f')](_0x2c7aea,_0x273333[_0x62b0('0x5d')]),{'include':_0x273333['query'][_0x62b0('0x51')]?[{'all':!![]}]:undefined})[_0x62b0('0x1f')](function(_0x1b802a){var _0x1e83c6=_0x273333[_0x62b0('0x5f')][_0x62b0('0x35')]({'plain':!![]});if(!_0x1e83c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e83c6[_0x62b0('0x60')]==='user'){var _0x271409=_0x1b802a['get']({'plain':!![]});var _0x88b766=_0x62b0('0x36');return db['UserProfileSection'][_0x62b0('0x61')]({'where':{'name':_0x88b766,'userProfileId':_0x1e83c6['userProfileId']},'raw':!![]})[_0x62b0('0x1f')](function(_0x5975bb){if(_0x5975bb&&_0x5975bb[_0x62b0('0x62')]===0x0){return db['UserProfileResource'][_0x62b0('0x5e')]({'name':_0x271409[_0x62b0('0x39')],'resourceId':_0x271409['id'],'type':_0x5975bb['name'],'sectionId':_0x5975bb['id']},{})[_0x62b0('0x1f')](function(){return _0x1b802a;});}else{return _0x1b802a;}})['catch'](function(_0xf44a11){logger[_0x62b0('0x24')](_0x62b0('0x63'),_0xf44a11);throw _0xf44a11;});}return _0x1b802a;});}})[_0x62b0('0x1f')](respondWithResult(_0x1f826e,0xc9))[_0x62b0('0x55')](handleError(_0x1f826e,null));};exports[_0x62b0('0x5e')]=function(_0x2c2dc3,_0x26d9fa,_0xe4dc47){var _0x2050ef;return db['Trunk'][_0x62b0('0x5e')](_0x2c2dc3[_0x62b0('0x5d')],{'raw':!![]})[_0x62b0('0x1f')](function(_0x1f4b98){_0x2050ef=_0x1f4b98;return db[_0x62b0('0x3c')][_0x62b0('0x53')]({'raw':!![]});})[_0x62b0('0x1f')](function(_0x370830){var _0x268b63=fs['readFileSync'](path['join'](config[_0x62b0('0x64')],_0x62b0('0x65')),_0x62b0('0x66'));var _0x264230=fs[_0x62b0('0x67')](path[_0x62b0('0x68')](config['root'],_0x62b0('0x69')),'utf8');var _0x42d1e6=ejs[_0x62b0('0x6a')](_0x268b63,{'trunks':_0x370830||[]});fs[_0x62b0('0x6b')](_0x62b0('0x6c'),_0x42d1e6);if(_0x2050ef[_0x62b0('0x6d')]){var _0x4b33e3=ejs[_0x62b0('0x6a')](_0x264230,{'trunks':_0x370830||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x4b33e3);}})['then'](function(){return respondWithRpcPromise(_0x62b0('0x6e'),_0x62b0('0x5e'),{'module':_0x62b0('0x6f')});})[_0x62b0('0x1f')](function(){var _0x17d446=_0x2c2dc3[_0x62b0('0x5f')][_0x62b0('0x35')]({'plain':!![]});if(!_0x17d446)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17d446['role']===_0x62b0('0x5f')){var _0x1a2b9a=_0x2050ef['get']({'plain':!![]});return db[_0x62b0('0x70')]['find']({'where':{'name':_0x62b0('0x36'),'userProfileId':_0x17d446['userProfileId']},'raw':!![]})[_0x62b0('0x1f')](function(_0x2e02c4){if(_0x2e02c4&&_0x2e02c4[_0x62b0('0x62')]===0x0){return db['UserProfileResource'][_0x62b0('0x5e')]({'name':_0x1a2b9a[_0x62b0('0x39')],'resourceId':_0x1a2b9a['id'],'type':_0x2e02c4[_0x62b0('0x39')],'sectionId':_0x2e02c4['id']},{})[_0x62b0('0x1f')](function(){return _0x2050ef;});}else{return _0x2050ef;}})[_0x62b0('0x55')](function(_0x5e4d93){logger[_0x62b0('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e4d93);throw _0x5e4d93;});}return _0x2050ef;})[_0x62b0('0x1f')](respondWithResult(_0x26d9fa,0xc9))['catch'](handleError(_0x26d9fa,null));};exports[_0x62b0('0x33')]=function(_0x22aebb,_0xb4498b,_0x4c123a){var _0x3e8366;return db[_0x62b0('0x3c')][_0x62b0('0x61')]({'where':{'id':_0x22aebb['params']['id']}})[_0x62b0('0x1f')](handleEntityNotFound(_0xb4498b,null))[_0x62b0('0x1f')](saveUpdates(_0x22aebb[_0x62b0('0x5d')],null))['then'](function(_0x307d55){if(_0x307d55){_0x3e8366=_0x307d55;return db[_0x62b0('0x3c')][_0x62b0('0x53')]({'raw':!![]});}})[_0x62b0('0x1f')](function(_0x59d9d1){if(_0x59d9d1){var _0x1d0acd=fs[_0x62b0('0x67')](path['join'](config[_0x62b0('0x64')],_0x62b0('0x65')),_0x62b0('0x66'));var _0x431dbb=fs['readFileSync'](path[_0x62b0('0x68')](config[_0x62b0('0x64')],_0x62b0('0x69')),_0x62b0('0x66'));var _0x38d192=ejs[_0x62b0('0x6a')](_0x1d0acd,{'trunks':_0x59d9d1||[]});fs[_0x62b0('0x6b')](_0x62b0('0x6c'),_0x38d192);var _0x21c5c0=ejs['render'](_0x431dbb,{'trunks':_0x59d9d1||[]});fs[_0x62b0('0x6b')](_0x62b0('0x71'),_0x21c5c0);return respondWithRpcPromise(_0x62b0('0x6e'),_0x62b0('0x33'),{'module':_0x62b0('0x6f')});}return null;})['then'](function(_0x3b1f8d){if(_0x3b1f8d){return _0x3e8366;}})[_0x62b0('0x1f')](respondWithResult(_0xb4498b,null))[_0x62b0('0x55')](handleError(_0xb4498b,null));};exports['destroy']=function(_0x5c01de,_0x20b2b9,_0x3e99f2){var _0x5b58ec;return db[_0x62b0('0x3c')][_0x62b0('0x61')]({'where':{'id':_0x5c01de[_0x62b0('0x57')]['id']}})[_0x62b0('0x1f')](handleEntityNotFound(_0x20b2b9,null))['then'](removeEntity(_0x20b2b9,null))[_0x62b0('0x1f')](function(){return db[_0x62b0('0x3c')][_0x62b0('0x53')]({'raw':!![]});})[_0x62b0('0x1f')](function(_0x3a639c){var _0x1b701b=fs[_0x62b0('0x67')](path[_0x62b0('0x68')](config[_0x62b0('0x64')],'server/files/templates/trunk.ejs'),_0x62b0('0x66'));var _0x43eaa7=fs[_0x62b0('0x67')](path[_0x62b0('0x68')](config[_0x62b0('0x64')],_0x62b0('0x69')),'utf8');var _0x11a552=ejs[_0x62b0('0x6a')](_0x1b701b,{'trunks':_0x3a639c});var _0x144ffa=ejs[_0x62b0('0x6a')](_0x43eaa7,{'trunks':_0x3a639c});fs[_0x62b0('0x6b')](_0x62b0('0x6c'),_0x11a552);fs['writeFileSync'](_0x62b0('0x71'),_0x144ffa);return respondWithRpcPromise(_0x62b0('0x6e'),_0x62b0('0x34'),{'module':'chan_sip.so'});})[_0x62b0('0x55')](handleError(_0x20b2b9,null));}; \ No newline at end of file +var _0x53ee=['../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','count','offset','limit','set','apply','reject','destroy','get','UserProfileResource','name','send','index','map','Trunk','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','clone','find','updatedAt','body','omit','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','/etc/asterisk/sip_xcally_trunks.conf','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','update','readFileSync','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x2efe86,_0x4b6c3f){var _0x48e01c=function(_0x5b1412){while(--_0x5b1412){_0x2efe86['push'](_0x2efe86['shift']());}};_0x48e01c(++_0x4b6c3f);}(_0x53ee,0xbd));var _0xe53e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53ee[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0xe53e('0x0'));var emlformat=require(_0xe53e('0x1'));var rimraf=require(_0xe53e('0x2'));var zipdir=require(_0xe53e('0x3'));var jsonpatch=require(_0xe53e('0x4'));var rp=require('request-promise');var moment=require(_0xe53e('0x5'));var BPromise=require(_0xe53e('0x6'));var Mustache=require(_0xe53e('0x7'));var util=require(_0xe53e('0x8'));var path=require(_0xe53e('0x9'));var sox=require(_0xe53e('0xa'));var csv=require(_0xe53e('0xb'));var ejs=require(_0xe53e('0xc'));var fs=require('fs');var _=require(_0xe53e('0xd'));var squel=require(_0xe53e('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe53e('0xf'));var toCsv=require(_0xe53e('0xb'));var querystring=require(_0xe53e('0x10'));var Papa=require(_0xe53e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe53e('0x12'));var as=require(_0xe53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe53e('0x14'));var db=require(_0xe53e('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe53e('0x16')][_0xe53e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x10d519,_0x598f8c,_0x7fe7ae,_0x1601a5){return new BPromise(function(_0x19db7d,_0x403ce6){var _0x4bb631=_0x1601a5||client;return _0x4bb631[_0xe53e('0x18')](_0x10d519,_0x7fe7ae)[_0xe53e('0x19')](function(_0x32b7a7){logger['info'](_0xe53e('0x1a'),_0x598f8c,_0xe53e('0x1b'));logger[_0xe53e('0x1c')](_0xe53e('0x1d'),_0x598f8c,'request\x20sent',JSON[_0xe53e('0x1e')](_0x32b7a7));if(_0x32b7a7['error']){if(_0x32b7a7[_0xe53e('0x1f')][_0xe53e('0x20')]===0x1f4){logger['error'](_0xe53e('0x1a'),_0x598f8c,_0x32b7a7[_0xe53e('0x1f')][_0xe53e('0x21')]);return _0x403ce6(_0x32b7a7[_0xe53e('0x1f')]['message']);}logger[_0xe53e('0x1f')](_0xe53e('0x1a'),_0x598f8c,_0x32b7a7[_0xe53e('0x1f')]['message']);return _0x19db7d(_0x32b7a7[_0xe53e('0x1f')][_0xe53e('0x21')]);}else{logger['info'](_0xe53e('0x1a'),_0x598f8c,_0xe53e('0x1b'));_0x19db7d(_0x32b7a7['result'][_0xe53e('0x21')]);}})['catch'](function(_0x301094){logger[_0xe53e('0x1f')](_0xe53e('0x1a'),_0x598f8c,_0x301094);_0x403ce6(_0x301094);});});}function respondWithStatusCode(_0x34a2a4,_0x321470){_0x321470=_0x321470||0xcc;return function(_0x1c8de5){if(_0x1c8de5){return _0x34a2a4[_0xe53e('0x22')](_0x321470);}return _0x34a2a4['status'](_0x321470)[_0xe53e('0x23')]();};}function respondWithResult(_0x5d537d,_0x3d5ad3){_0x3d5ad3=_0x3d5ad3||0xc8;return function(_0x5399b2){if(_0x5399b2){return _0x5d537d[_0xe53e('0x24')](_0x3d5ad3)[_0xe53e('0x25')](_0x5399b2);}};}function respondWithFilteredResult(_0x1d7f4e,_0x56d881){return function(_0x417e55){if(_0x417e55){var _0x83da7e=_0x417e55[_0xe53e('0x26')],_0x2bc761=_0x56d881[_0xe53e('0x27')],_0x420b7c=_0x56d881[_0xe53e('0x27')]+_0x56d881[_0xe53e('0x28')],_0x50916e;if(_0x420b7c>=_0x83da7e){_0x420b7c=_0x83da7e;_0x50916e=0xc8;}else{_0x50916e=0xce;}_0x1d7f4e[_0xe53e('0x24')](_0x50916e);return _0x1d7f4e[_0xe53e('0x29')]('Content-Range',_0x2bc761+'-'+_0x420b7c+'/'+_0x83da7e)['json'](_0x417e55);}return null;};}function patchUpdates(_0x3effed){return function(_0x283cfa){try{jsonpatch[_0xe53e('0x2a')](_0x283cfa,_0x3effed,!![]);}catch(_0x3996df){return BPromise[_0xe53e('0x2b')](_0x3996df);}return _0x283cfa['save']();};}function saveUpdates(_0x160d99,_0x5daa29){return function(_0x27e7c4){if(_0x27e7c4){return _0x27e7c4['update'](_0x160d99)[_0xe53e('0x19')](function(_0x376dbe){return _0x376dbe;});}return null;};}function removeEntity(_0x58f4db,_0x597511){return function(_0x25f11b){if(_0x25f11b){return _0x25f11b[_0xe53e('0x2c')]()[_0xe53e('0x19')](function(){var _0x2fcfea=_0x25f11b[_0xe53e('0x2d')]({'plain':!![]});var _0x31abb1='Trunks';return db[_0xe53e('0x2e')][_0xe53e('0x2c')]({'where':{'type':_0x31abb1,'resourceId':_0x2fcfea['id']}})[_0xe53e('0x19')](function(){return _0x25f11b;});})['then'](function(){_0x58f4db[_0xe53e('0x24')](0xcc)[_0xe53e('0x23')]();});}};}function handleEntityNotFound(_0x4ef514,_0xbf28d8){return function(_0x2522ae){if(!_0x2522ae){_0x4ef514[_0xe53e('0x22')](0x194);}return _0x2522ae;};}function handleError(_0x1b5f35,_0x2d4677){_0x2d4677=_0x2d4677||0x1f4;return function(_0x2e9dba){logger['error'](_0x2e9dba['stack']);if(_0x2e9dba[_0xe53e('0x2f')]){delete _0x2e9dba['name'];}_0x1b5f35['status'](_0x2d4677)[_0xe53e('0x30')](_0x2e9dba);};}exports[_0xe53e('0x31')]=function(_0x41cdfe,_0x3bc804){var _0x13a393={},_0x599ac1={},_0x587c15={'count':0x0,'rows':[]};var _0x8adebc=_[_0xe53e('0x32')](db[_0xe53e('0x33')]['rawAttributes'],function(_0x2f6d65){return{'name':_0x2f6d65[_0xe53e('0x34')],'type':_0x2f6d65['type'][_0xe53e('0x35')]};});_0x599ac1[_0xe53e('0x36')]=_[_0xe53e('0x32')](_0x8adebc,_0xe53e('0x2f'));_0x599ac1['query']=_[_0xe53e('0x37')](_0x41cdfe[_0xe53e('0x38')]);_0x599ac1[_0xe53e('0x39')]=_[_0xe53e('0x3a')](_0x599ac1[_0xe53e('0x36')],_0x599ac1['query']);_0x13a393[_0xe53e('0x3b')]=_[_0xe53e('0x3a')](_0x599ac1['model'],qs['fields'](_0x41cdfe[_0xe53e('0x38')][_0xe53e('0x3c')]));_0x13a393[_0xe53e('0x3b')]=_0x13a393[_0xe53e('0x3b')][_0xe53e('0x3d')]?_0x13a393[_0xe53e('0x3b')]:_0x599ac1[_0xe53e('0x36')];if(!_0x41cdfe[_0xe53e('0x38')]['hasOwnProperty']('nolimit')){_0x13a393[_0xe53e('0x28')]=qs[_0xe53e('0x28')](_0x41cdfe[_0xe53e('0x38')][_0xe53e('0x28')]);_0x13a393[_0xe53e('0x27')]=qs['offset'](_0x41cdfe[_0xe53e('0x38')][_0xe53e('0x27')]);}_0x13a393[_0xe53e('0x3e')]=qs[_0xe53e('0x3f')](_0x41cdfe['query']['sort']);_0x13a393[_0xe53e('0x40')]=qs[_0xe53e('0x39')](_['pick'](_0x41cdfe[_0xe53e('0x38')],_0x599ac1[_0xe53e('0x39')]),_0x8adebc);if(_0x41cdfe[_0xe53e('0x38')]['filter']){_0x13a393[_0xe53e('0x40')]=_['merge'](_0x13a393['where'],{'$or':_['map'](_0x8adebc,function(_0x500aa6){if(_0x500aa6[_0xe53e('0x41')]!==_0xe53e('0x42')){var _0xc7ce79={};_0xc7ce79[_0x500aa6[_0xe53e('0x2f')]]={'$like':'%'+_0x41cdfe[_0xe53e('0x38')]['filter']+'%'};return _0xc7ce79;}})});}_0x13a393=_['merge']({},_0x13a393,_0x41cdfe[_0xe53e('0x43')]);var _0x1104dc={'where':_0x13a393[_0xe53e('0x40')]};return db[_0xe53e('0x33')][_0xe53e('0x26')](_0x1104dc)[_0xe53e('0x19')](function(_0x4753bd){_0x587c15[_0xe53e('0x26')]=_0x4753bd;if(_0x41cdfe[_0xe53e('0x38')][_0xe53e('0x44')]){_0x13a393[_0xe53e('0x45')]=[{'all':!![]}];}return db['Trunk'][_0xe53e('0x46')](_0x13a393);})[_0xe53e('0x19')](function(_0x30e0ca){_0x587c15[_0xe53e('0x47')]=_0x30e0ca;return _0x587c15;})[_0xe53e('0x19')](respondWithFilteredResult(_0x3bc804,_0x13a393))[_0xe53e('0x48')](handleError(_0x3bc804,null));};exports[_0xe53e('0x49')]=function(_0x3abfe9,_0x4cd20c){var _0x10a298={'raw':![],'where':{'id':_0x3abfe9[_0xe53e('0x4a')]['id']}},_0x528d74={};_0x528d74['model']=_[_0xe53e('0x37')](db[_0xe53e('0x33')][_0xe53e('0x4b')]);_0x528d74[_0xe53e('0x38')]=_[_0xe53e('0x37')](_0x3abfe9[_0xe53e('0x38')]);_0x528d74[_0xe53e('0x39')]=_[_0xe53e('0x3a')](_0x528d74['model'],_0x528d74[_0xe53e('0x38')]);_0x10a298['attributes']=_['intersection'](_0x528d74[_0xe53e('0x36')],qs['fields'](_0x3abfe9[_0xe53e('0x38')][_0xe53e('0x3c')]));_0x10a298[_0xe53e('0x3b')]=_0x10a298['attributes']['length']?_0x10a298[_0xe53e('0x3b')]:_0x528d74[_0xe53e('0x36')];if(_0x3abfe9[_0xe53e('0x38')][_0xe53e('0x44')]){_0x10a298[_0xe53e('0x45')]=[{'all':!![]}];}_0x10a298=_[_0xe53e('0x4c')]({},_0x10a298,_0x3abfe9[_0xe53e('0x43')]);return db['Trunk']['find'](_0x10a298)['then'](handleEntityNotFound(_0x4cd20c,null))[_0xe53e('0x19')](respondWithResult(_0x4cd20c,null))[_0xe53e('0x48')](handleError(_0x4cd20c,null));};exports[_0xe53e('0x4d')]=function(_0x19fbd5,_0x3aeade){var _0x4bc991={'where':{'id':_0x19fbd5[_0xe53e('0x4a')]['id']}},_0x43e1fd={};_0x43e1fd[_0xe53e('0x36')]=_[_0xe53e('0x37')](db[_0xe53e('0x33')][_0xe53e('0x4b')]);_0x4bc991[_0xe53e('0x3b')]=_[_0xe53e('0x3a')](_0x43e1fd[_0xe53e('0x36')],qs[_0xe53e('0x3c')](_0x19fbd5[_0xe53e('0x38')][_0xe53e('0x3c')]));_0x4bc991['attributes']=_0x4bc991['attributes'][_0xe53e('0x3d')]?_0x4bc991[_0xe53e('0x3b')]:_0x43e1fd['model'];if(_0x19fbd5[_0xe53e('0x38')][_0xe53e('0x44')]){_0x4bc991[_0xe53e('0x45')]=[{'all':!![]}];}_0x4bc991=_[_0xe53e('0x4c')]({},_0x4bc991,_0x19fbd5['options']);return db[_0xe53e('0x33')][_0xe53e('0x4e')](_0x4bc991)[_0xe53e('0x19')](handleEntityNotFound(_0x3aeade,null))[_0xe53e('0x19')](function(_0x242946){if(_0x242946){var _0x33750d=_0x242946[_0xe53e('0x2d')]({'plain':!![]});_0x33750d=qs['omit'](_0x33750d,['id','createdAt',_0xe53e('0x4f')]);_0x19fbd5[_0xe53e('0x50')]=_[_0xe53e('0x51')](_0x19fbd5[_0xe53e('0x50')],['id',_0xe53e('0x52'),_0xe53e('0x4f')]);return db[_0xe53e('0x33')][_0xe53e('0x53')](_[_0xe53e('0x4c')](_0x33750d,_0x19fbd5[_0xe53e('0x50')]),{'include':_0x19fbd5[_0xe53e('0x38')][_0xe53e('0x44')]?[{'all':!![]}]:undefined})[_0xe53e('0x19')](function(_0x85acf4){var _0x2a14ee=_0x19fbd5[_0xe53e('0x54')][_0xe53e('0x2d')]({'plain':!![]});if(!_0x2a14ee)throw new Error(_0xe53e('0x55'));if(_0x2a14ee[_0xe53e('0x56')]===_0xe53e('0x54')){var _0x1438e5=_0x85acf4[_0xe53e('0x2d')]({'plain':!![]});var _0x2f95eb=_0xe53e('0x57');return db[_0xe53e('0x58')]['find']({'where':{'name':_0x2f95eb,'userProfileId':_0x2a14ee[_0xe53e('0x59')]},'raw':!![]})[_0xe53e('0x19')](function(_0x1c6dcc){if(_0x1c6dcc&&_0x1c6dcc['autoAssociation']===0x0){return db[_0xe53e('0x2e')]['create']({'name':_0x1438e5[_0xe53e('0x2f')],'resourceId':_0x1438e5['id'],'type':_0x1c6dcc[_0xe53e('0x2f')],'sectionId':_0x1c6dcc['id']},{})[_0xe53e('0x19')](function(){return _0x85acf4;});}else{return _0x85acf4;}})[_0xe53e('0x48')](function(_0x14fc30){logger['error'](_0xe53e('0x5a'),_0x14fc30);throw _0x14fc30;});}return _0x85acf4;});}})[_0xe53e('0x19')](respondWithResult(_0x3aeade,0xc9))[_0xe53e('0x48')](handleError(_0x3aeade,null));};exports[_0xe53e('0x53')]=function(_0x2e092e,_0x7c2d31,_0x4c2d27){var _0x29dc8e;return db[_0xe53e('0x33')][_0xe53e('0x53')](_0x2e092e[_0xe53e('0x50')],{'raw':!![]})[_0xe53e('0x19')](function(_0x2c5986){_0x29dc8e=_0x2c5986;return db['Trunk'][_0xe53e('0x46')]({'raw':!![]});})[_0xe53e('0x19')](function(_0x1237a6){var _0x93aa23=fs['readFileSync'](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5d')),'utf8');var _0x47e416=fs['readFileSync'](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5e')),_0xe53e('0x5f'));var _0x2ec384=ejs['render'](_0x93aa23,{'trunks':_0x1237a6||[]});fs['writeFileSync'](_0xe53e('0x60'),_0x2ec384);if(_0x29dc8e['registry']){var _0xf1575b=ejs[_0xe53e('0x61')](_0x47e416,{'trunks':_0x1237a6||[]});fs[_0xe53e('0x62')](_0xe53e('0x63'),_0xf1575b);}})[_0xe53e('0x19')](function(){return respondWithRpcPromise(_0xe53e('0x64'),_0xe53e('0x53'),{'module':'chan_sip.so'});})[_0xe53e('0x19')](function(){var _0x3a53e5=_0x2e092e['user'][_0xe53e('0x2d')]({'plain':!![]});if(!_0x3a53e5)throw new Error(_0xe53e('0x55'));if(_0x3a53e5[_0xe53e('0x56')]===_0xe53e('0x54')){var _0x3b7b36=_0x29dc8e[_0xe53e('0x2d')]({'plain':!![]});return db[_0xe53e('0x58')][_0xe53e('0x4e')]({'where':{'name':_0xe53e('0x57'),'userProfileId':_0x3a53e5[_0xe53e('0x59')]},'raw':!![]})[_0xe53e('0x19')](function(_0x39e644){if(_0x39e644&&_0x39e644['autoAssociation']===0x0){return db[_0xe53e('0x2e')][_0xe53e('0x53')]({'name':_0x3b7b36[_0xe53e('0x2f')],'resourceId':_0x3b7b36['id'],'type':_0x39e644[_0xe53e('0x2f')],'sectionId':_0x39e644['id']},{})[_0xe53e('0x19')](function(){return _0x29dc8e;});}else{return _0x29dc8e;}})[_0xe53e('0x48')](function(_0x33a5d3){logger[_0xe53e('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33a5d3);throw _0x33a5d3;});}return _0x29dc8e;})[_0xe53e('0x19')](respondWithResult(_0x7c2d31,0xc9))[_0xe53e('0x48')](handleError(_0x7c2d31,null));};exports[_0xe53e('0x65')]=function(_0x57b79d,_0x42ea84,_0xe443a4){var _0x10a4b6;return db[_0xe53e('0x33')][_0xe53e('0x4e')]({'where':{'id':_0x57b79d['params']['id']}})['then'](handleEntityNotFound(_0x42ea84,null))[_0xe53e('0x19')](saveUpdates(_0x57b79d[_0xe53e('0x50')],null))[_0xe53e('0x19')](function(_0x4e28ca){if(_0x4e28ca){_0x10a4b6=_0x4e28ca;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x18fb62){if(_0x18fb62){var _0x29ab4c=fs[_0xe53e('0x66')](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5d')),'utf8');var _0x561a3a=fs[_0xe53e('0x66')](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5e')),_0xe53e('0x5f'));var _0x139f6b=ejs[_0xe53e('0x61')](_0x29ab4c,{'trunks':_0x18fb62||[]});fs[_0xe53e('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x139f6b);var _0x4380cc=ejs['render'](_0x561a3a,{'trunks':_0x18fb62||[]});fs[_0xe53e('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x4380cc);return respondWithRpcPromise(_0xe53e('0x64'),_0xe53e('0x65'),{'module':_0xe53e('0x67')});}return null;})['then'](function(_0x4dbb01){if(_0x4dbb01){return _0x10a4b6;}})[_0xe53e('0x19')](respondWithResult(_0x42ea84,null))['catch'](handleError(_0x42ea84,null));};exports[_0xe53e('0x2c')]=function(_0x2682ee,_0x5ed464,_0x3adf90){var _0x433c7e;return db[_0xe53e('0x33')]['find']({'where':{'id':_0x2682ee[_0xe53e('0x4a')]['id']}})[_0xe53e('0x19')](handleEntityNotFound(_0x5ed464,null))[_0xe53e('0x19')](removeEntity(_0x5ed464,null))[_0xe53e('0x19')](function(){return db[_0xe53e('0x33')][_0xe53e('0x46')]({'raw':!![]});})[_0xe53e('0x19')](function(_0x32655c){var _0x2ee85e=fs[_0xe53e('0x66')](path['join'](config[_0xe53e('0x5c')],_0xe53e('0x5d')),'utf8');var _0x5925e0=fs[_0xe53e('0x66')](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5e')),'utf8');var _0x36bcf8=ejs[_0xe53e('0x61')](_0x2ee85e,{'trunks':_0x32655c});var _0x6ebb44=ejs[_0xe53e('0x61')](_0x5925e0,{'trunks':_0x32655c});fs['writeFileSync'](_0xe53e('0x60'),_0x36bcf8);fs[_0xe53e('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x6ebb44);return respondWithRpcPromise(_0xe53e('0x64'),_0xe53e('0x2c'),{'module':'chan_sip.so'});})[_0xe53e('0x48')](handleError(_0x5ed464,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a3f681c..8cc2462 100644 --- a/server/api/trunk/trunk.model.js +++ b/server/api/trunk/trunk.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11fb=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x2583b1,_0x1aadda){var _0x43dc5e=function(_0x56882b){while(--_0x56882b){_0x2583b1['push'](_0x2583b1['shift']());}};_0x43dc5e(++_0x1aadda);}(_0x11fb,0x11e));var _0xb11f=function(_0x5815db,_0x5d8e84){_0x5815db=_0x5815db-0x0;var _0x581e49=_0x11fb[_0x5815db];return _0x581e49;};'use strict';var _=require(_0xb11f('0x0'));var util=require('util');var logger=require(_0xb11f('0x1'))(_0xb11f('0x2'));var moment=require(_0xb11f('0x3'));var BPromise=require('bluebird');var rp=require(_0xb11f('0x4'));var fs=require('fs');var path=require(_0xb11f('0x5'));var rimraf=require(_0xb11f('0x6'));var config=require(_0xb11f('0x7'));var attributes=require(_0xb11f('0x8'));module[_0xb11f('0x9')]=function(_0x7bde2b,_0x5bcd4a){return _0x7bde2b[_0xb11f('0xa')](_0xb11f('0xb'),attributes,{'tableName':_0xb11f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e73=['bluebird','request-promise','rimraf','../../config/environment','exports','define','Trunk','lodash','util','../../config/logger','moment'];(function(_0x3db128,_0x5d1bae){var _0x8ea5ac=function(_0x484bf1){while(--_0x484bf1){_0x3db128['push'](_0x3db128['shift']());}};_0x8ea5ac(++_0x5d1bae);}(_0x4e73,0x167));var _0x34e7=function(_0x48633c,_0x4a41cb){_0x48633c=_0x48633c-0x0;var _0x2a9e26=_0x4e73[_0x48633c];return _0x2a9e26;};'use strict';var _=require(_0x34e7('0x0'));var util=require(_0x34e7('0x1'));var logger=require(_0x34e7('0x2'))('api');var moment=require(_0x34e7('0x3'));var BPromise=require(_0x34e7('0x4'));var rp=require(_0x34e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x34e7('0x6'));var config=require(_0x34e7('0x7'));var attributes=require('./trunk.attributes');module[_0x34e7('0x8')]=function(_0x340ba1,_0x200cb3){return _0x340ba1[_0x34e7('0x9')](_0x34e7('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 6e75ace..8d95b83 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13f2ec,_0x407206){var _0x389ca9=function(_0x43d7d6){while(--_0x43d7d6){_0x13f2ec['push'](_0x13f2ec['shift']());}};_0x389ca9(++_0x407206);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0x1a85=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','map','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x1a85,0x178));var _0x51a8=function(_0x1499c4,_0x57c5c3){_0x1499c4=_0x1499c4-0x0;var _0x3cf45a=_0x1a85[_0x1499c4];return _0x3cf45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Trunk,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['Trunk'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowTrunk',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index b1562c0..42ede17 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7d0=['../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','post','create','bulkCreate','addQueues','diskStorage','join','format','%s-%s','single','file','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts','addOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','addChatWebsites','addSquareProjects','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x5e2b61,_0x2994ce){var _0x16b48e=function(_0x3d14bc){while(--_0x3d14bc){_0x5e2b61['push'](_0x5e2b61['shift']());}};_0x16b48e(++_0x2994ce);}(_0xe7d0,0x18a));var _0x0e7d=function(_0x50da1d,_0x1fa929){_0x50da1d=_0x50da1d-0x0;var _0x30cd08=_0xe7d0[_0x50da1d];return _0x30cd08;};'use strict';var multer=require(_0x0e7d('0x0'));var util=require(_0x0e7d('0x1'));var path=require(_0x0e7d('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e7d('0x3'));var router=express[_0x0e7d('0x4')]();var auth=require(_0x0e7d('0x5'));var interaction=require(_0x0e7d('0x6'));var config=require(_0x0e7d('0x7'));var controller=require(_0x0e7d('0x8'));router[_0x0e7d('0x9')]('/',auth[_0x0e7d('0xa')](),controller['index']);router[_0x0e7d('0x9')](_0x0e7d('0xb'),auth['isAuthenticated'](),controller[_0x0e7d('0xc')]);router[_0x0e7d('0x9')]('/whoami',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0xd')]);router['get'](_0x0e7d('0xe'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0xf')]);router[_0x0e7d('0x9')](_0x0e7d('0x10'),controller[_0x0e7d('0x11')]);router[_0x0e7d('0x9')](_0x0e7d('0x12'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x13')]);router['get'](_0x0e7d('0x14'),auth['isAuthenticated'](),controller['getQueues']);router[_0x0e7d('0x9')](_0x0e7d('0x15'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x16')]);router[_0x0e7d('0x9')](_0x0e7d('0x17'),auth['isAuthenticated'](),controller['getGroups']);router[_0x0e7d('0x9')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x0e7d('0x18')]);router[_0x0e7d('0x9')](_0x0e7d('0x19'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x1a')]);router[_0x0e7d('0x9')](_0x0e7d('0x1b'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x1c')]);router[_0x0e7d('0x9')]('/:id/openchannel/interactions',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x1d')]);router[_0x0e7d('0x9')](_0x0e7d('0x1e'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x0e7d('0x9')](_0x0e7d('0x1f'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x20')]);router[_0x0e7d('0x9')](_0x0e7d('0x21'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x22')]);router[_0x0e7d('0x9')](_0x0e7d('0x23'),auth[_0x0e7d('0xa')](),controller['getWhatsappInteractions']);router[_0x0e7d('0x9')](_0x0e7d('0x24'),auth['isAuthenticated'](),controller['getTeams']);router[_0x0e7d('0x9')](_0x0e7d('0x25'),auth['isAuthenticated'](),controller['getLists']);router[_0x0e7d('0x9')](_0x0e7d('0x26'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x27')]);router[_0x0e7d('0x9')](_0x0e7d('0x28'),auth[_0x0e7d('0xa')](),controller['getVoicePrefixes']);router[_0x0e7d('0x9')](_0x0e7d('0x29'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x2a')]);router[_0x0e7d('0x9')]('/:id/mail_accounts',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x2b')]);router['get'](_0x0e7d('0x2c'),auth['isAuthenticated'](),controller[_0x0e7d('0x2d')]);router['get']('/:id/sms_accounts',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x2e')]);router[_0x0e7d('0x9')]('/:id/chat_websites',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x2f')]);router['get'](_0x0e7d('0x30'),auth['isAuthenticated'](),controller[_0x0e7d('0x31')]);router[_0x0e7d('0x9')](_0x0e7d('0x32'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x33')]);router[_0x0e7d('0x9')](_0x0e7d('0x34'),auth[_0x0e7d('0xa')](),controller['getScheduledCalls']);router[_0x0e7d('0x9')]('/:id/api_key',auth[_0x0e7d('0xa')](),controller['getApiKey']);router[_0x0e7d('0x35')]('/:id/contacts',auth[_0x0e7d('0xa')](),controller['addContacts']);router[_0x0e7d('0x35')]('/',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x36')]);router[_0x0e7d('0x35')]('/create_many',auth['isAuthenticated'](),controller[_0x0e7d('0x37')]);router['post'](_0x0e7d('0x14'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x38')]);var upload=multer({'storage':multer[_0x0e7d('0x39')]({'destination':function(_0xdc5937,_0x59e5a6,_0x3db360){_0x3db360(null,path[_0x0e7d('0x3a')](config['root'],'server/files/images/'));},'filename':function(_0x524568,_0x21c021,_0x1ad7bd){_0x1ad7bd(null,util[_0x0e7d('0x3b')](_0x0e7d('0x3c'),Date['now'](),_0x21c021['originalname']));}})});router['post'](_0x0e7d('0x10'),upload[_0x0e7d('0x3d')](_0x0e7d('0x3e')),controller['addAvatar']);router[_0x0e7d('0x35')](_0x0e7d('0x3f'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x40')]);router[_0x0e7d('0x35')](_0x0e7d('0x41'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x42')]);router['post']('/:id/pause',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x43')]);router[_0x0e7d('0x35')](_0x0e7d('0x44'),auth[_0x0e7d('0xa')](),controller['unpause']);router[_0x0e7d('0x35')](_0x0e7d('0x24'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x45')]);router[_0x0e7d('0x35')](_0x0e7d('0x46'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x0e7d('0x35')](_0x0e7d('0x47'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x0e7d('0x35')](_0x0e7d('0x48'),auth['isAuthenticated'](),controller[_0x0e7d('0x49')]);router[_0x0e7d('0x35')](_0x0e7d('0x4a'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x4b')]);router['post'](_0x0e7d('0x4c'),auth[_0x0e7d('0xa')](),controller['addOpenchannelInteractions']);router[_0x0e7d('0x35')](_0x0e7d('0x4d'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x4e')]);router[_0x0e7d('0x35')](_0x0e7d('0x29'),auth[_0x0e7d('0xa')](),controller['addFaxAccounts']);router[_0x0e7d('0x35')](_0x0e7d('0x4f'),auth[_0x0e7d('0xa')](),controller['addMailAccounts']);router[_0x0e7d('0x35')](_0x0e7d('0x2c'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x50')]);router[_0x0e7d('0x35')](_0x0e7d('0x51'),auth[_0x0e7d('0xa')](),controller['addSmsAccounts']);router[_0x0e7d('0x35')](_0x0e7d('0x52'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x53')]);router[_0x0e7d('0x35')](_0x0e7d('0x30'),auth[_0x0e7d('0xa')](),controller['addWhatsappAccounts']);router[_0x0e7d('0x35')]('/:id/square_projects',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x54')]);router[_0x0e7d('0x35')]('/:id/api_key',auth[_0x0e7d('0xa')](),controller['createApiKey']);router[_0x0e7d('0x55')](_0x0e7d('0xe'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x56')]);router['put'](_0x0e7d('0x57'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x58')]);router[_0x0e7d('0x59')](_0x0e7d('0x14'),auth['isAuthenticated'](),controller[_0x0e7d('0x5a')]);router[_0x0e7d('0x59')](_0x0e7d('0x24'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x5b')]);router[_0x0e7d('0x59')](_0x0e7d('0xe'),auth['isAuthenticated'](),controller[_0x0e7d('0x5c')]);router['delete']('/:id/chat_interactions',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x5d')]);router['delete'](_0x0e7d('0x47'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x0e7d('0x59')](_0x0e7d('0x48'),auth[_0x0e7d('0xa')](),controller['removeFaxInteractions']);router[_0x0e7d('0x59')](_0x0e7d('0x4a'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x5e')]);router['delete'](_0x0e7d('0x4c'),auth[_0x0e7d('0xa')](),controller['removeOpenchannelInteractions']);router['delete'](_0x0e7d('0x4d'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x0e7d('0x59')]('/:id/fax_accounts',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x5f')]);router['delete']('/:id/mail_accounts',auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x60')]);router[_0x0e7d('0x59')]('/:id/openchannel_accounts',auth[_0x0e7d('0xa')](),controller['removeOpenchannelAccounts']);router[_0x0e7d('0x59')]('/:id/sms_accounts',auth[_0x0e7d('0xa')](),controller['removeSmsAccounts']);router[_0x0e7d('0x59')](_0x0e7d('0x52'),auth[_0x0e7d('0xa')](),controller['removeChatWebsites']);router[_0x0e7d('0x59')](_0x0e7d('0x30'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x61')]);router['delete'](_0x0e7d('0x32'),auth[_0x0e7d('0xa')](),controller[_0x0e7d('0x62')]);router['delete']('/:id/api_key',auth[_0x0e7d('0xa')](),controller['removeApiKey']);module[_0x0e7d('0x63')]=router; \ No newline at end of file +var _0x5783=['removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','create','bulkCreate','join','root','server/files/images/','format','%s-%s','originalname','single','file','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites'];(function(_0x5ae1dc,_0x26bcc1){var _0x723cab=function(_0x169dca){while(--_0x169dca){_0x5ae1dc['push'](_0x5ae1dc['shift']());}};_0x723cab(++_0x26bcc1);}(_0x5783,0x72));var _0x3578=function(_0x118616,_0x476beb){_0x118616=_0x118616-0x0;var _0x26302d=_0x5783[_0x118616];return _0x26302d;};'use strict';var multer=require(_0x3578('0x0'));var util=require(_0x3578('0x1'));var path=require('path');var timeout=require(_0x3578('0x2'));var express=require('express');var router=express[_0x3578('0x3')]();var auth=require(_0x3578('0x4'));var interaction=require(_0x3578('0x5'));var config=require(_0x3578('0x6'));var controller=require(_0x3578('0x7'));router[_0x3578('0x8')]('/',auth[_0x3578('0x9')](),controller[_0x3578('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3578('0x8')](_0x3578('0xb'),auth['isAuthenticated'](),controller[_0x3578('0xc')]);router['get'](_0x3578('0xd'),auth[_0x3578('0x9')](),controller[_0x3578('0xe')]);router[_0x3578('0x8')](_0x3578('0xf'),controller[_0x3578('0x10')]);router[_0x3578('0x8')](_0x3578('0x11'),auth[_0x3578('0x9')](),controller[_0x3578('0x12')]);router[_0x3578('0x8')](_0x3578('0x13'),auth[_0x3578('0x9')](),controller['getQueues']);router[_0x3578('0x8')]('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x3578('0x8')](_0x3578('0x14'),auth['isAuthenticated'](),controller[_0x3578('0x15')]);router[_0x3578('0x8')](_0x3578('0x16'),auth[_0x3578('0x9')](),controller[_0x3578('0x17')]);router[_0x3578('0x8')](_0x3578('0x18'),auth[_0x3578('0x9')](),controller[_0x3578('0x19')]);router[_0x3578('0x8')](_0x3578('0x1a'),auth[_0x3578('0x9')](),controller[_0x3578('0x1b')]);router[_0x3578('0x8')](_0x3578('0x1c'),auth[_0x3578('0x9')](),controller['getOpenchannelInteractions']);router['get']('/:id/mail/interactions',auth[_0x3578('0x9')](),controller[_0x3578('0x1d')]);router[_0x3578('0x8')](_0x3578('0x1e'),auth['isAuthenticated'](),controller[_0x3578('0x1f')]);router[_0x3578('0x8')](_0x3578('0x20'),auth[_0x3578('0x9')](),controller['getFaxInteractions']);router[_0x3578('0x8')](_0x3578('0x21'),auth[_0x3578('0x9')](),controller[_0x3578('0x22')]);router[_0x3578('0x8')](_0x3578('0x23'),auth[_0x3578('0x9')](),controller[_0x3578('0x24')]);router[_0x3578('0x8')]('/:id/lists',auth['isAuthenticated'](),controller[_0x3578('0x25')]);router[_0x3578('0x8')]('/:id/agents',auth['isAuthenticated'](),controller[_0x3578('0x26')]);router[_0x3578('0x8')](_0x3578('0x27'),auth[_0x3578('0x9')](),controller[_0x3578('0x28')]);router[_0x3578('0x8')](_0x3578('0x29'),auth[_0x3578('0x9')](),controller[_0x3578('0x2a')]);router[_0x3578('0x8')](_0x3578('0x2b'),auth[_0x3578('0x9')](),controller[_0x3578('0x2c')]);router['get'](_0x3578('0x2d'),auth['isAuthenticated'](),controller[_0x3578('0x2e')]);router[_0x3578('0x8')](_0x3578('0x2f'),auth['isAuthenticated'](),controller[_0x3578('0x30')]);router['get']('/:id/chat_websites',auth[_0x3578('0x9')](),controller['getChatWebsites']);router[_0x3578('0x8')](_0x3578('0x31'),auth[_0x3578('0x9')](),controller[_0x3578('0x32')]);router['get'](_0x3578('0x33'),auth[_0x3578('0x9')](),controller[_0x3578('0x34')]);router[_0x3578('0x8')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x3578('0x35')]);router['get'](_0x3578('0x36'),auth[_0x3578('0x9')](),controller[_0x3578('0x37')]);router[_0x3578('0x38')](_0x3578('0x11'),auth[_0x3578('0x9')](),controller['addContacts']);router[_0x3578('0x38')]('/',auth[_0x3578('0x9')](),controller[_0x3578('0x39')]);router[_0x3578('0x38')]('/create_many',auth[_0x3578('0x9')](),controller[_0x3578('0x3a')]);router[_0x3578('0x38')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x11f478,_0x2c6d94,_0x13122d){_0x13122d(null,path[_0x3578('0x3b')](config[_0x3578('0x3c')],_0x3578('0x3d')));},'filename':function(_0x41afd0,_0xb4f87e,_0x38bb7f){_0x38bb7f(null,util[_0x3578('0x3e')](_0x3578('0x3f'),Date['now'](),_0xb4f87e[_0x3578('0x40')]));}})});router[_0x3578('0x38')](_0x3578('0xf'),upload[_0x3578('0x41')](_0x3578('0x42')),controller['addAvatar']);router['post'](_0x3578('0x43'),auth[_0x3578('0x9')](),controller[_0x3578('0x44')]);router[_0x3578('0x38')](_0x3578('0x45'),auth[_0x3578('0x9')](),controller['logout']);router['post'](_0x3578('0x46'),auth['isAuthenticated'](),controller[_0x3578('0x47')]);router[_0x3578('0x38')](_0x3578('0x48'),auth[_0x3578('0x9')](),controller[_0x3578('0x49')]);router[_0x3578('0x38')](_0x3578('0x23'),auth[_0x3578('0x9')](),controller[_0x3578('0x4a')]);router['post'](_0x3578('0x4b'),auth[_0x3578('0x9')](),controller[_0x3578('0x4c')]);router['post'](_0x3578('0x4d'),auth[_0x3578('0x9')](),controller[_0x3578('0x4e')]);router['post'](_0x3578('0x4f'),auth[_0x3578('0x9')](),controller[_0x3578('0x50')]);router[_0x3578('0x38')](_0x3578('0x51'),auth['isAuthenticated'](),controller[_0x3578('0x52')]);router[_0x3578('0x38')](_0x3578('0x53'),auth[_0x3578('0x9')](),controller[_0x3578('0x54')]);router['post']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['addWhatsappInteractions']);router['post'](_0x3578('0x29'),auth[_0x3578('0x9')](),controller[_0x3578('0x55')]);router[_0x3578('0x38')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x3578('0x56')]);router['post'](_0x3578('0x2d'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x3578('0x9')](),controller[_0x3578('0x57')]);router[_0x3578('0x38')](_0x3578('0x58'),auth[_0x3578('0x9')](),controller['addChatWebsites']);router[_0x3578('0x38')](_0x3578('0x31'),auth['isAuthenticated'](),controller[_0x3578('0x59')]);router[_0x3578('0x38')](_0x3578('0x33'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x3578('0x38')](_0x3578('0x36'),auth[_0x3578('0x9')](),controller['createApiKey']);router['put']('/:id',auth[_0x3578('0x9')](),controller[_0x3578('0x5a')]);router[_0x3578('0x5b')](_0x3578('0x5c'),auth[_0x3578('0x9')](),controller[_0x3578('0x5d')]);router[_0x3578('0x5e')]('/:id/queues',auth[_0x3578('0x9')](),controller[_0x3578('0x5f')]);router['delete']('/:id/teams',auth[_0x3578('0x9')](),controller[_0x3578('0x60')]);router[_0x3578('0x5e')]('/:id',auth[_0x3578('0x9')](),controller['destroy']);router[_0x3578('0x5e')](_0x3578('0x4b'),auth[_0x3578('0x9')](),controller['removeChatInteractions']);router[_0x3578('0x5e')](_0x3578('0x4d'),auth[_0x3578('0x9')](),controller[_0x3578('0x61')]);router[_0x3578('0x5e')](_0x3578('0x4f'),auth['isAuthenticated'](),controller[_0x3578('0x62')]);router[_0x3578('0x5e')](_0x3578('0x51'),auth[_0x3578('0x9')](),controller[_0x3578('0x63')]);router[_0x3578('0x5e')](_0x3578('0x53'),auth['isAuthenticated'](),controller[_0x3578('0x64')]);router['delete'](_0x3578('0x65'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x3578('0x5e')](_0x3578('0x29'),auth[_0x3578('0x9')](),controller[_0x3578('0x66')]);router[_0x3578('0x5e')](_0x3578('0x2b'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x3578('0x5e')](_0x3578('0x2d'),auth['isAuthenticated'](),controller[_0x3578('0x67')]);router[_0x3578('0x5e')](_0x3578('0x2f'),auth[_0x3578('0x9')](),controller[_0x3578('0x68')]);router[_0x3578('0x5e')]('/:id/chat_websites',auth[_0x3578('0x9')](),controller[_0x3578('0x69')]);router[_0x3578('0x5e')](_0x3578('0x31'),auth[_0x3578('0x9')](),controller[_0x3578('0x6a')]);router['delete'](_0x3578('0x33'),auth[_0x3578('0x9')](),controller[_0x3578('0x6b')]);router['delete'](_0x3578('0x36'),auth[_0x3578('0x9')](),controller[_0x3578('0x6c')]);module[_0x3578('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 5a3f4c1..e1c5f4a 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61b1=['\x22\x22\x20<>','always','originate','uac','uas','fingerprint','certificate','active','actpass','update','update,nonat','showWebBar','isArray','wss','avpf','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','encryption','dtlsverify','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','util','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','INTEGER','accountcode','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x3d0b03,_0x28d17b){var _0x17efb8=function(_0x361d41){while(--_0x361d41){_0x3d0b03['push'](_0x3d0b03['shift']());}};_0x17efb8(++_0x28d17b);}(_0x61b1,0xd1));var _0x161b=function(_0x4e7544,_0x17891b){_0x4e7544=_0x4e7544-0x0;var _0x1c20ee=_0x61b1[_0x4e7544];return _0x1c20ee;};'use strict';var Sequelize=require(_0x161b('0x0'));var moment=require('moment');var util=require(_0x161b('0x1'));var _=require('lodash');module[_0x161b('0x2')]={'name':{'type':Sequelize[_0x161b('0x3')],'allowNull':![],'unique':_0x161b('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1a4207){this[_0x161b('0x5')](_0x161b('0x4'),_0x1a4207);this[_0x161b('0x5')](_0x161b('0x6'),_0x1a4207);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x161b('0x3')],'allowNull':![],'set':function(_0x27fa39){this[_0x161b('0x5')](_0x161b('0x7'),_0x27fa39);this[_0x161b('0x5')](_0x161b('0x8'),util[_0x161b('0x9')](_0x161b('0xa'),_0x27fa39,this['getDataValue'](_0x161b('0xb'))));}},'alias':{'type':Sequelize[_0x161b('0x3')]},'email':{'type':Sequelize[_0x161b('0x3')],'allowNull':![],'unique':_0x161b('0xc'),'validate':{'isEmail':!![]},'set':function(_0x311000){if(_0x311000){this[_0x161b('0x5')](_0x161b('0xc'),_0x311000['toLowerCase']());}}},'role':{'type':Sequelize[_0x161b('0xd')](_0x161b('0xe'),_0x161b('0xf'),_0x161b('0x10'),_0x161b('0x11')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':![],'unique':_0x161b('0xb'),'set':function(_0x5c8c37){this[_0x161b('0x5')](_0x161b('0xb'),_0x5c8c37);this[_0x161b('0x5')](_0x161b('0x13'),_0x5c8c37);this['setDataValue'](_0x161b('0x8'),util[_0x161b('0x9')](_0x161b('0xa'),this[_0x161b('0x14')](_0x161b('0x7')),_0x5c8c37));}},'salt':{'type':Sequelize[_0x161b('0x3')]},'phone':{'type':Sequelize[_0x161b('0x3')]},'mobile':{'type':Sequelize[_0x161b('0x3')]},'address':{'type':Sequelize[_0x161b('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x161b('0x3')]},'city':{'type':Sequelize[_0x161b('0x3')]},'country':{'type':Sequelize[_0x161b('0x3')]},'online':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x161b('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x161b('0x3')],'defaultValue':_0x161b('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x161b('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x161b('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x161b('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x161b('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x161b('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x161b('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x161b('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x161b('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user',_0x161b('0x18')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x19'),_0x161b('0x1a'),'ALLOWED_FAILED_SCREEN',_0x161b('0x1b'),'PROHIB_NOT_SCREENED',_0x161b('0x1c'),'PROHIB_FAILED_SCREEN',_0x161b('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0xdcea44){this[_0x161b('0x5')](_0x161b('0x1e'),_0xdcea44?_0xdcea44['join'](','):null);},'get':function(){return this[_0x161b('0x14')](_0x161b('0x1e'))?this['getDataValue'](_0x161b('0x1e'))['split'](','):null;},'comment':_0x161b('0x1f')},'dtmfmode':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x20'),_0x161b('0x21'),_0x161b('0x22'),_0x161b('0x23'),_0x161b('0x24')),'allowNull':!![],'defaultValue':_0x161b('0x20')},'directmedia':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no',_0x161b('0x26'),'update',_0x161b('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x161b('0x28'),'set':function(_0x2c9c1a){this['setDataValue']('nat',_0x2c9c1a?_0x2c9c1a['join'](','):null);},'get':function(){return this[_0x161b('0x14')](_0x161b('0x29'))?this[_0x161b('0x14')](_0x161b('0x29'))[_0x161b('0x2a')](','):null;},'comment':_0x161b('0x2b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x161b('0x3')]},'pickupgroup':{'type':Sequelize[_0x161b('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x161b('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x161b('0x3')]},'disallow':{'type':Sequelize[_0x161b('0x3')],'allowNull':![],'defaultValue':_0x161b('0x2c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x161b('0x2d'),'set':function(_0x9a1d28){this['setDataValue'](_0x161b('0x2e'),_0x9a1d28?_0x9a1d28[_0x161b('0x2f')](';'):_0x161b('0x2d'));},'get':function(){return this[_0x161b('0x14')]('allow')?this[_0x161b('0x14')](_0x161b('0x2e'))[_0x161b('0x2a')](';'):null;},'comment':_0x161b('0x30')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![],'set':function(_0x164a73){this['setDataValue'](_0x161b('0x31'),_0x164a73?_0x164a73[_0x161b('0x2f')](','):null);},'get':function(){return this[_0x161b('0x14')](_0x161b('0x31'))?this[_0x161b('0x14')](_0x161b('0x31'))[_0x161b('0x2a')](','):null;},'comment':_0x161b('0x32')},'trustrpid':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no',_0x161b('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x161b('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x161b('0x34')},'amaflags':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![],'defaultValue':_0x161b('0x25')},'busylevel':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x161b('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x161b('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no',_0x161b('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x161b('0xd')]('accept','refuse',_0x161b('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x37'),'uas'),'allowNull':!![],'defaultValue':_0x161b('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x161b('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x161b('0x25')},'keepalive':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x161b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x161b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no',_0x161b('0x39'),_0x161b('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x3b'),'passive',_0x161b('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x161b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x161b('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x161b('0x25'),'no','nonat',_0x161b('0x3d'),_0x161b('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x161b('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x161b('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x161b('0x3')]},'showWebBar':{'type':Sequelize[_0x161b('0x12')],'defaultValue':0x0,'set':function(_0x772efd){this[_0x161b('0x5')](_0x161b('0x3f'),_0x772efd);var _0x1800b8=this['get']({'plain':!![]});switch(_0x772efd){case 0x0:case 0x1:var _0x39e9fc=_0x1800b8[_0x161b('0x1e')]?_[_0x161b('0x40')](_0x1800b8['transport'])?_0x1800b8['transport'][_0x161b('0x2f')]():_0x1800b8[_0x161b('0x1e')]:'udp';if(_0x39e9fc===_0x161b('0x41')){_0x39e9fc='udp';}this['setDataValue'](_0x161b('0x1e'),_0x39e9fc);this[_0x161b('0x5')]('encryption','no');this['setDataValue'](_0x161b('0x42'),null);this['setDataValue']('force_avp',null);this[_0x161b('0x5')](_0x161b('0x43'),null);this[_0x161b('0x5')](_0x161b('0x44'),null);this[_0x161b('0x5')]('dtlsverify',null);this['setDataValue'](_0x161b('0x45'),null);this[_0x161b('0x5')](_0x161b('0x46'),null);this['setDataValue'](_0x161b('0x47'),null);this[_0x161b('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x161b('0x1e'),_0x161b('0x41'));this[_0x161b('0x5')](_0x161b('0x48'),_0x161b('0x25'));this['setDataValue'](_0x161b('0x42'),_0x161b('0x25'));this['setDataValue']('force_avp','yes');this[_0x161b('0x5')]('icesupport','yes');this[_0x161b('0x5')](_0x161b('0x44'),_0x161b('0x25'));this[_0x161b('0x5')](_0x161b('0x49'),'no');this['setDataValue'](_0x161b('0x45'),'actpass');this[_0x161b('0x5')]('dtlscertfile',_0x1800b8['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x161b('0x47'),_0x1800b8[_0x161b('0x47')]||_0x161b('0x4a'));this['setDataValue'](_0x161b('0x4b'),_0x161b('0x25'));break;default:}}},'permissions':{'type':Sequelize[_0x161b('0x4c')],'set':function(_0x458f37){this[_0x161b('0x5')](_0x161b('0x4d'),_0x458f37?_0x458f37[_0x161b('0x2f')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0x161b('0x4e')](this[_0x161b('0x14')](_0x161b('0x4d'))['split'](','),function(_0x220302){return parseInt(_0x220302,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x161b('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x161b('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x161b('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x161b('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x161b('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x161b('0xd')](_0x161b('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x161b('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x161b('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x161b('0x4f')],'get':function(){return this['getDataValue'](_0x161b('0x50'))?this[_0x161b('0x14')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x161b('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x161b('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![],'set':function(_0x3b0daf){if(typeof _0x3b0daf===_0x161b('0x51')){var _0x435f9f=_0x3b0daf==='1'?!![]:_0x3b0daf==='0'?![]:_0x3b0daf===_0x161b('0x52')?!![]:_0x3b0daf===_0x161b('0x53')?![]:![];this['setDataValue'](_0x161b('0x54'),_0x435f9f);}else{this[_0x161b('0x5')](_0x161b('0x54'),_0x3b0daf);}}},'blocked':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![],'set':function(_0xb37eed){this[_0x161b('0x5')](_0x161b('0x55'),_0xb37eed);if(_0xb37eed===!![]){this[_0x161b('0x5')]('blockedAt',moment());this[_0x161b('0x5')]('loginAttempts',0x0);}else{this[_0x161b('0x5')](_0x161b('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x161b('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x161b('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x161b('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x161b('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0x77d4=['uas','certificate','active','passive','actpass','update,nonat','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','loginAttempts','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','callerid','getDataValue','email','toLowerCase','admin','user','telephone','INTEGER','internal','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','originate','uac'];(function(_0x486c1b,_0x5893b3){var _0x19e4d4=function(_0xec78bb){while(--_0xec78bb){_0x486c1b['push'](_0x486c1b['shift']());}};_0x19e4d4(++_0x5893b3);}(_0x77d4,0xd0));var _0x477d=function(_0x15c420,_0x1a8ef1){_0x15c420=_0x15c420-0x0;var _0x23f862=_0x77d4[_0x15c420];return _0x23f862;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require(_0x477d('0x0'));module[_0x477d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x477d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e2b18){this[_0x477d('0x3')]('name',_0x3e2b18);this[_0x477d('0x3')](_0x477d('0x4'),_0x3e2b18);},'comment':_0x477d('0x5')},'fullname':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'set':function(_0x31b6dd){this[_0x477d('0x3')]('fullname',_0x31b6dd);this[_0x477d('0x3')](_0x477d('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x31b6dd,this[_0x477d('0x8')]('internal')));}},'alias':{'type':Sequelize[_0x477d('0x6')]},'email':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'unique':_0x477d('0x9'),'validate':{'isEmail':!![]},'set':function(_0x27fb71){if(_0x27fb71){this[_0x477d('0x3')](_0x477d('0x9'),_0x27fb71[_0x477d('0xa')]());}}},'role':{'type':Sequelize['ENUM'](_0x477d('0xb'),_0x477d('0xc'),'agent',_0x477d('0xd')),'allowNull':![]},'password':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x477d('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':![],'unique':'internal','set':function(_0x23635b){this[_0x477d('0x3')](_0x477d('0xf'),_0x23635b);this[_0x477d('0x3')]('accountcode',_0x23635b);this[_0x477d('0x3')](_0x477d('0x7'),util[_0x477d('0x10')]('\x22%s\x22\x20<%s>',this[_0x477d('0x8')](_0x477d('0x11')),_0x23635b));}},'salt':{'type':Sequelize[_0x477d('0x6')]},'phone':{'type':Sequelize[_0x477d('0x6')]},'mobile':{'type':Sequelize[_0x477d('0x6')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x477d('0x6')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x477d('0x6')]},'online':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x477d('0x13')]},'voicePause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x477d('0x6')],'defaultValue':_0x477d('0x14')},'lastPauseAt':{'type':Sequelize[_0x477d('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x477d('0xe')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x477d('0xe')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![],'defaultValue':_0x477d('0x15')},'ipaddr':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0x477d('0xe')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x17'),_0x477d('0xc'),_0x477d('0x18')),'allowNull':!![],'defaultValue':_0x477d('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x477d('0x19')},'callingpres':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x1a'),'ALLOWED_PASSED_SCREEN',_0x477d('0x1b'),_0x477d('0x1c'),_0x477d('0x1d'),_0x477d('0x1e'),_0x477d('0x1f'),_0x477d('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![],'defaultValue':_0x477d('0x21'),'set':function(_0x48d40c){this[_0x477d('0x3')](_0x477d('0x22'),_0x48d40c?_0x48d40c[_0x477d('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x477d('0x8')](_0x477d('0x22'))[_0x477d('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x25'),_0x477d('0x26'),'shortinfo',_0x477d('0x27'),_0x477d('0x28')),'allowNull':!![],'defaultValue':_0x477d('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no',_0x477d('0x2a'),_0x477d('0x2b'),_0x477d('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x477d('0x2d'),'set':function(_0x10ed7b){this['setDataValue'](_0x477d('0x2e'),_0x10ed7b?_0x10ed7b['join'](','):null);},'get':function(){return this[_0x477d('0x8')]('nat')?this[_0x477d('0x8')](_0x477d('0x2e'))[_0x477d('0x24')](','):null;},'comment':_0x477d('0x2f')},'callgroup':{'type':Sequelize[_0x477d('0x6')]},'namedcallgroup':{'type':Sequelize[_0x477d('0x6')]},'pickupgroup':{'type':Sequelize[_0x477d('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x477d('0x6')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'defaultValue':_0x477d('0x30')},'allow':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'defaultValue':_0x477d('0x31'),'set':function(_0xaa9759){this['setDataValue']('allow',_0xaa9759?_0xaa9759[_0x477d('0x23')](';'):_0x477d('0x31'));},'get':function(){return this['getDataValue'](_0x477d('0x32'))?this['getDataValue'](_0x477d('0x32'))[_0x477d('0x24')](';'):null;},'comment':_0x477d('0x33')},'autoframing':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![],'set':function(_0x43a661){this[_0x477d('0x3')](_0x477d('0x34'),_0x43a661?_0x43a661[_0x477d('0x23')](','):null);},'get':function(){return this[_0x477d('0x8')]('insecure')?this['getDataValue'](_0x477d('0x34'))[_0x477d('0x24')](','):null;},'comment':_0x477d('0x35')},'trustrpid':{'type':Sequelize[_0x477d('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x477d('0x16')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![],'defaultValue':_0x477d('0x36')},'amaflags':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':_0x477d('0x29')},'busylevel':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x477d('0x16')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x477d('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x38'),'refuse',_0x477d('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x3a'),_0x477d('0x3b')),'allowNull':!![],'defaultValue':_0x477d('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':_0x477d('0x29')},'keepalive':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no','fingerprint',_0x477d('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x3d'),_0x477d('0x3e'),_0x477d('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no',_0x477d('0x2a'),_0x477d('0x2b'),_0x477d('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x477d('0x6')]},'resetPasswordExpires':{'type':Sequelize[_0x477d('0x13')]},'passwordResetAt':{'type':Sequelize[_0x477d('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x477d('0x6')]},'showWebBar':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0,'set':function(_0x53f916){this['setDataValue']('showWebBar',_0x53f916);var _0x42fd46=this[_0x477d('0x41')]({'plain':!![]});switch(_0x53f916){case 0x0:case 0x1:var _0x88a7db=_0x42fd46[_0x477d('0x22')]?_[_0x477d('0x42')](_0x42fd46[_0x477d('0x22')])?_0x42fd46[_0x477d('0x22')][_0x477d('0x23')]():_0x42fd46['transport']:_0x477d('0x21');if(_0x88a7db===_0x477d('0x43')){_0x88a7db=_0x477d('0x21');}this[_0x477d('0x3')](_0x477d('0x22'),_0x88a7db);this[_0x477d('0x3')](_0x477d('0x44'),'no');this[_0x477d('0x3')]('avpf',null);this[_0x477d('0x3')](_0x477d('0x45'),null);this[_0x477d('0x3')](_0x477d('0x46'),null);this[_0x477d('0x3')](_0x477d('0x47'),null);this[_0x477d('0x3')](_0x477d('0x48'),null);this[_0x477d('0x3')](_0x477d('0x49'),null);this[_0x477d('0x3')](_0x477d('0x4a'),null);this['setDataValue']('dtlsprivatekey',null);this[_0x477d('0x3')](_0x477d('0x4b'),'no');break;case 0x2:this[_0x477d('0x3')](_0x477d('0x22'),_0x477d('0x43'));this[_0x477d('0x3')](_0x477d('0x44'),_0x477d('0x29'));this['setDataValue'](_0x477d('0x4c'),_0x477d('0x29'));this[_0x477d('0x3')](_0x477d('0x45'),_0x477d('0x29'));this[_0x477d('0x3')]('icesupport',_0x477d('0x29'));this[_0x477d('0x3')](_0x477d('0x47'),_0x477d('0x29'));this[_0x477d('0x3')]('dtlsverify','no');this[_0x477d('0x3')]('dtlssetup',_0x477d('0x3f'));this['setDataValue'](_0x477d('0x4a'),_0x42fd46[_0x477d('0x4a')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x477d('0x4d'),_0x42fd46[_0x477d('0x4d')]||_0x477d('0x4e'));this['setDataValue'](_0x477d('0x4b'),_0x477d('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x477d('0x4f')],'set':function(_0x2a59ee){this[_0x477d('0x3')](_0x477d('0x50'),_0x2a59ee?_0x2a59ee[_0x477d('0x23')](','):[]);},'get':function(){return this['getDataValue'](_0x477d('0x50'))?_[_0x477d('0x51')](this[_0x477d('0x8')](_0x477d('0x50'))[_0x477d('0x24')](','),function(_0x99b172){return parseInt(_0x99b172,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x477d('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0x477d('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x477d('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x477d('0x6')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x477d('0x52')],'get':function(){return this[_0x477d('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x477d('0x8')](_0x477d('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![],'set':function(_0x187627){if(typeof _0x187627==='string'){var _0x4eb30b=_0x187627==='1'?!![]:_0x187627==='0'?![]:_0x187627===_0x477d('0x54')?!![]:_0x187627===_0x477d('0x55')?![]:![];this[_0x477d('0x3')]('screenrecording',_0x4eb30b);}else{this[_0x477d('0x3')](_0x477d('0x56'),_0x187627);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x242025){this['setDataValue']('blocked',_0x242025);if(_0x242025===!![]){this[_0x477d('0x3')](_0x477d('0x57'),moment());this['setDataValue'](_0x477d('0x58'),0x0);}else{this[_0x477d('0x3')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x477d('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 28e4885..a076ad2 100644 --- a/server/api/user/user.controller.js +++ b/server/api/user/user.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60b0=['sms','openchannel','manual','%s%s','Pause','getTeams','addTeams','Voice','Chat','Mail','setDataValue','Sms','Whatsapp','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','Team','getVoiceQueues','getChatQueues','getMailQueues','getFaxQueues','Fax','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$contains','$contained','$any','lastName','phone','Contact','dialActive','getApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./user.socket','register','jayson/promise','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','role','admin','Agents','agent','Telephones','filter','ignore','map','value','find','name','UserProfileResource','end','stack','User','fieldName','key','model','differenceBy','password','salt','query','keys','intersection','attributes','fields','length','order','sort','where','filters','type','sequelize','lower','col','merge','includeAll','include','rows','show','rawAttributes','body','params','describe','addContacts','omit','ids','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','104','105','106','107','109','100','111','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','push','each','telephone','findAll','isEmpty','compact','includes','changePassword','newPassword','Sequelize','oldPassword','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','Queues','penalty','spread','capitalize','toLowerCase','QueueId','emit','Queue:save','voice','VoiceQueue','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','addAvatar','userpic','file','filename','getAvatar','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','getContacts','CmContact','options','CmList','Tags','tag','hasOwnProperty','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','pick','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','mobile','format','LOCAL/%s@from-sip/n','intrf','user:forcelogout','x-forwarded-for','remoteAddress','connection','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','concat','isMiddleware','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','faxPause','openchannelPause','smsPause','whatsapppause','QueuePause','mail','chat','fax'];(function(_0x207f2a,_0x2a9968){var _0x522f27=function(_0x8d7b03){while(--_0x8d7b03){_0x207f2a['push'](_0x207f2a['shift']());}};_0x522f27(++_0x2a9968);}(_0x60b0,0x77));var _0x060b=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x60b0[_0x556927];return _0x5f1235;};'use strict';var pdf=require(_0x060b('0x0'));var emlformat=require(_0x060b('0x1'));var rimraf=require(_0x060b('0x2'));var zipdir=require(_0x060b('0x3'));var jsonpatch=require(_0x060b('0x4'));var rp=require('request-promise');var moment=require(_0x060b('0x5'));var BPromise=require(_0x060b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x060b('0x7'));var csv=require('to-csv');var ejs=require(_0x060b('0x8'));var fs=require('fs');var _=require(_0x060b('0x9'));var squel=require(_0x060b('0xa'));var crypto=require('crypto');var jsforce=require(_0x060b('0xb'));var deskjs=require(_0x060b('0xc'));var toCsv=require(_0x060b('0xd'));var querystring=require(_0x060b('0xe'));var Papa=require(_0x060b('0xf'));var Redis=require('ioredis');var authService=require(_0x060b('0x10'));var qs=require(_0x060b('0x11'));var as=require(_0x060b('0x12'));var hardwareService=require(_0x060b('0x13'));var logger=require('../../config/logger')(_0x060b('0x14'));var utils=require(_0x060b('0x15'));var config=require(_0x060b('0x16'));var licenseUtil=require(_0x060b('0x17'));var db=require(_0x060b('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x060b('0x19'),'port':0x18eb});var socket=require(_0x060b('0x1a'))(new Redis(config[_0x060b('0x1b')]));require(_0x060b('0x1c'))[_0x060b('0x1d')](socket);var jayson=require(_0x060b('0x1e'));var client=jayson[_0x060b('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4190b5,_0x5f33b4,_0x18f407,_0x2391cc){return new BPromise(function(_0x2fc275,_0x5f414d){var _0x3d07c8=_0x2391cc||client;return _0x3d07c8[_0x060b('0x20')](_0x4190b5,_0x18f407)[_0x060b('0x21')](function(_0x4194c9){logger[_0x060b('0x22')](_0x060b('0x23'),_0x5f33b4,_0x060b('0x24'));logger[_0x060b('0x25')]('User,\x20%s,\x20%s,\x20%s',_0x5f33b4,_0x060b('0x24'),JSON[_0x060b('0x26')](_0x4194c9));if(_0x4194c9[_0x060b('0x27')]){if(_0x4194c9[_0x060b('0x27')][_0x060b('0x28')]===0x1f4){logger[_0x060b('0x27')]('User,\x20%s,\x20%s',_0x5f33b4,_0x4194c9[_0x060b('0x27')][_0x060b('0x29')]);return _0x5f414d(_0x4194c9[_0x060b('0x27')][_0x060b('0x29')]);}logger[_0x060b('0x27')](_0x060b('0x23'),_0x5f33b4,_0x4194c9[_0x060b('0x27')][_0x060b('0x29')]);return _0x2fc275(_0x4194c9[_0x060b('0x27')][_0x060b('0x29')]);}else{logger[_0x060b('0x22')](_0x060b('0x23'),_0x5f33b4,_0x060b('0x24'));_0x2fc275(_0x4194c9[_0x060b('0x2a')]['message']);}})[_0x060b('0x2b')](function(_0x360e72){logger[_0x060b('0x27')](_0x060b('0x23'),_0x5f33b4,_0x360e72);_0x5f414d(_0x360e72);});});}function respondWithStatusCode(_0x5d129b,_0x458e04){_0x458e04=_0x458e04||0xcc;return function(_0x2dbff7){if(_0x2dbff7){return _0x5d129b[_0x060b('0x2c')](_0x458e04);}return _0x5d129b[_0x060b('0x2d')](_0x458e04)['end']();};}function respondWithResult(_0x20681b,_0x594e01){_0x594e01=_0x594e01||0xc8;return function(_0xea3717){if(_0xea3717){return _0x20681b[_0x060b('0x2d')](_0x594e01)[_0x060b('0x2e')](_0xea3717);}};}function respondWithFilteredResult(_0x2cd7c3,_0x1d6260){return function(_0x5b3c8b){if(_0x5b3c8b){var _0x524293=_0x5b3c8b[_0x060b('0x2f')],_0x2a3523=_0x1d6260[_0x060b('0x30')],_0x38074e=_0x1d6260['offset']+_0x1d6260[_0x060b('0x31')],_0x1f3fcb;if(_0x38074e>=_0x524293){_0x38074e=_0x524293;_0x1f3fcb=0xc8;}else{_0x1f3fcb=0xce;}_0x2cd7c3[_0x060b('0x2d')](_0x1f3fcb);return _0x2cd7c3[_0x060b('0x32')](_0x060b('0x33'),_0x2a3523+'-'+_0x38074e+'/'+_0x524293)[_0x060b('0x2e')](_0x5b3c8b);}return null;};}function patchUpdates(_0x2a5352){return function(_0x1389a6){try{jsonpatch[_0x060b('0x34')](_0x1389a6,_0x2a5352,!![]);}catch(_0x430876){return BPromise[_0x060b('0x35')](_0x430876);}return _0x1389a6['save']();};}function saveUpdates(_0x2f0289,_0x5bb8af){return function(_0x21969f){if(_0x21969f){return _0x21969f[_0x060b('0x36')](_0x2f0289)['then'](function(_0x4ab3bf){return _0x4ab3bf;});}return null;};}function removeEntity(_0x50bd1b,_0x4e6414){return function(_0x435078){if(_0x435078){return _0x435078[_0x060b('0x37')]()['then'](function(){var _0x575023=_0x435078[_0x060b('0x38')]({'plain':!![]});if(_0x575023[_0x060b('0x39')]===_0x060b('0x3a'))return;var _0xaadc9a=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x060b('0x3b'),'value':_0x060b('0x3c'),'ignore':![]},{'name':_0x060b('0x3d'),'value':'telephone','ignore':![]}];var _0x349f81=_(_0xaadc9a)[_0x060b('0x3e')](_0x060b('0x3f'))[_0x060b('0x40')](_0x060b('0x41'))['value']();if(_['includes'](_0x349f81,_0x575023[_0x060b('0x39')])){return;}var _0x4e1013=_[_0x060b('0x42')](_0xaadc9a,['value',_0x575023[_0x060b('0x39')]])[_0x060b('0x43')];return db[_0x060b('0x44')][_0x060b('0x37')]({'where':{'type':_0x4e1013,'resourceId':_0x575023['id']}})[_0x060b('0x21')](function(){return _0x435078;});})['then'](function(){_0x50bd1b['status'](0xcc)[_0x060b('0x45')]();});}};}function handleEntityNotFound(_0x514bd6,_0xb79be){return function(_0x26ace1){if(!_0x26ace1){_0x514bd6[_0x060b('0x2c')](0x194);}return _0x26ace1;};}function handleError(_0x409a18,_0x5494e0){_0x5494e0=_0x5494e0||0x1f4;return function(_0x1a14d6){logger[_0x060b('0x27')](_0x1a14d6[_0x060b('0x46')]);if(_0x1a14d6[_0x060b('0x43')]){delete _0x1a14d6[_0x060b('0x43')];}_0x409a18[_0x060b('0x2d')](_0x5494e0)['send'](_0x1a14d6);};}exports['index']=function(_0x5830e0,_0x3f64c7){var _0x2083c7={},_0x200cbe={},_0x45ba12={'count':0x0,'rows':[]};var _0x956c54=_['map'](db[_0x060b('0x47')]['rawAttributes'],function(_0xceddc4){return{'name':_0xceddc4[_0x060b('0x48')],'type':_0xceddc4['type'][_0x060b('0x49')]};});_0x200cbe[_0x060b('0x4a')]=_[_0x060b('0x4b')](_[_0x060b('0x40')](_0x956c54,_0x060b('0x43')),[_0x060b('0x4c'),_0x060b('0x4d')]);_0x200cbe[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x5830e0[_0x060b('0x4e')]);_0x200cbe['filters']=_[_0x060b('0x50')](_0x200cbe[_0x060b('0x4a')],_0x200cbe[_0x060b('0x4e')]);_0x2083c7[_0x060b('0x51')]=_[_0x060b('0x50')](_0x200cbe[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x5830e0[_0x060b('0x4e')]['fields']));_0x2083c7[_0x060b('0x51')]=_0x2083c7[_0x060b('0x51')][_0x060b('0x53')]?_0x2083c7[_0x060b('0x51')]:_0x200cbe[_0x060b('0x4a')];if(!_0x5830e0[_0x060b('0x4e')]['hasOwnProperty']('nolimit')){_0x2083c7[_0x060b('0x31')]=qs['limit'](_0x5830e0[_0x060b('0x4e')]['limit']);_0x2083c7['offset']=qs[_0x060b('0x30')](_0x5830e0[_0x060b('0x4e')][_0x060b('0x30')]);}_0x2083c7[_0x060b('0x54')]=qs[_0x060b('0x55')](_0x5830e0[_0x060b('0x4e')][_0x060b('0x55')]);_0x2083c7[_0x060b('0x56')]=qs[_0x060b('0x57')](_['pick'](_0x5830e0[_0x060b('0x4e')],_0x200cbe[_0x060b('0x57')]),_0x956c54);if(_0x5830e0[_0x060b('0x4e')][_0x060b('0x3e')]){_0x2083c7[_0x060b('0x56')]=_['merge'](_0x2083c7[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x956c54,function(_0x4d9bfe){if(_0x4d9bfe[_0x060b('0x58')]!=='VIRTUAL'){return db[_0x060b('0x59')][_0x060b('0x56')](db[_0x060b('0x59')]['fn'](_0x060b('0x5a'),db[_0x060b('0x59')][_0x060b('0x5b')](_0x4d9bfe['name'])),{'$like':db[_0x060b('0x59')]['fn'](_0x060b('0x5a'),'%'+_0x5830e0[_0x060b('0x4e')]['filter']+'%')});}})});}_0x2083c7=_[_0x060b('0x5c')]({},_0x2083c7,_0x5830e0['options']);var _0x338c77={'where':_0x2083c7['where']};return db[_0x060b('0x47')][_0x060b('0x2f')](_0x338c77)[_0x060b('0x21')](function(_0x3b19ac){_0x45ba12[_0x060b('0x2f')]=_0x3b19ac;if(_0x5830e0[_0x060b('0x4e')][_0x060b('0x5d')]){_0x2083c7[_0x060b('0x5e')]=[{'all':!![]}];}return db[_0x060b('0x47')]['findAll'](_0x2083c7);})['then'](function(_0xf8da35){_0x45ba12[_0x060b('0x5f')]=_0xf8da35;return _0x45ba12;})[_0x060b('0x21')](respondWithFilteredResult(_0x3f64c7,_0x2083c7))['catch'](handleError(_0x3f64c7,null));};exports[_0x060b('0x60')]=function(_0x51cb30,_0x47528e){var _0x3695d3={'raw':![],'where':{'id':_0x51cb30['params']['id']}},_0x456a7d={};_0x456a7d['model']=_[_0x060b('0x4b')](_['keys'](db[_0x060b('0x47')][_0x060b('0x61')]),[_0x060b('0x4c'),'salt']);_0x456a7d[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x51cb30['query']);_0x456a7d['filters']=_[_0x060b('0x50')](_0x456a7d['model'],_0x456a7d['query']);_0x3695d3[_0x060b('0x51')]=_[_0x060b('0x50')](_0x456a7d[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x51cb30[_0x060b('0x4e')][_0x060b('0x52')]));_0x3695d3[_0x060b('0x51')]=_0x3695d3[_0x060b('0x51')]['length']?_0x3695d3[_0x060b('0x51')]:_0x456a7d[_0x060b('0x4a')];if(_0x51cb30[_0x060b('0x4e')]['includeAll']){_0x3695d3[_0x060b('0x5e')]=[{'all':!![]}];}_0x3695d3=_[_0x060b('0x5c')]({},_0x3695d3,_0x51cb30['options']);return db[_0x060b('0x47')]['find'](_0x3695d3)[_0x060b('0x21')](handleEntityNotFound(_0x47528e,null))[_0x060b('0x21')](respondWithResult(_0x47528e,null))[_0x060b('0x2b')](handleError(_0x47528e,null));};exports[_0x060b('0x36')]=function(_0x40b8b3,_0x4c3b2e){if(_0x40b8b3[_0x060b('0x62')]['id']){delete _0x40b8b3['body']['id'];}delete _0x40b8b3[_0x060b('0x62')][_0x060b('0x39')];return db[_0x060b('0x47')][_0x060b('0x42')]({'where':{'id':_0x40b8b3[_0x060b('0x63')]['id']}})['then'](handleEntityNotFound(_0x4c3b2e,null))[_0x060b('0x21')](saveUpdates(_0x40b8b3['body'],null))['then'](respondWithResult(_0x4c3b2e,null))[_0x060b('0x2b')](handleError(_0x4c3b2e,null));};exports[_0x060b('0x64')]=function(_0xa5ada6,_0x4e8f7f){return db[_0x060b('0x47')][_0x060b('0x64')]()['then'](respondWithResult(_0x4e8f7f,null))[_0x060b('0x2b')](handleError(_0x4e8f7f,null));};exports['addContacts']=function(_0x5718b6,_0x557a49,_0x2f88d8){return db['User'][_0x060b('0x42')]({'where':{'id':_0x5718b6[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x557a49,null))[_0x060b('0x21')](function(_0x33e172){if(_0x33e172){return _0x33e172[_0x060b('0x65')](_0x5718b6[_0x060b('0x62')]['ids'],_[_0x060b('0x66')](_0x5718b6[_0x060b('0x62')],[_0x060b('0x67'),'id'])||{});}})['then'](respondWithResult(_0x557a49,null))['catch'](handleError(_0x557a49,null));};function validateUser(_0x5164e2){return new BPromise(function(_0x1b8e15,_0x160292){if(_0x5164e2[_0x060b('0x68')])return _0x1b8e15(_0x5164e2);return db[_0x060b('0x69')][_0x060b('0x6a')](0x1)['then'](function(_0x1efdfd){if(_0x1efdfd['securePassword'])authService[_0x060b('0x6b')](_0x5164e2[_0x060b('0x4c')]);db[_0x060b('0x47')][_0x060b('0x6c')](_0x060b('0x68'))['then'](function(_0x444493){if(_[_0x060b('0x6d')](_0x444493)){_0x5164e2[_0x060b('0x68')]=_0x1efdfd[_0x060b('0x6e')]||0x1;return;}if(_[_0x060b('0x6d')](_0x1efdfd[_0x060b('0x6e')])||_0x1efdfd[_0x060b('0x6e')]===_0x444493){_0x5164e2[_0x060b('0x68')]=_0x444493+0x1;return;}if(_0x1efdfd['min_internal']>_0x444493){_0x5164e2[_0x060b('0x68')]=_0x1efdfd['min_internal'];return;}return db[_0x060b('0x59')]['query'](_0x060b('0x6f'),{'type':db[_0x060b('0x59')][_0x060b('0x70')][_0x060b('0x71')]})[_0x060b('0x21')](function(_0x538aa6){if(_0x538aa6&&_0x538aa6['length']){for(var _0x21600d=0x0,_0x507e76=_0x538aa6[_0x060b('0x53')];_0x21600d<_0x507e76&&_[_0x060b('0x6d')](_0x5164e2['internal']);_0x21600d++){if(_0x1efdfd[_0x060b('0x6e')]<=_0x538aa6[_0x21600d]['from']){_0x5164e2[_0x060b('0x68')]=_0x538aa6[_0x21600d][_0x060b('0x72')];}else if(_0x1efdfd['min_internal']>_0x538aa6[_0x21600d][_0x060b('0x72')]&&_0x1efdfd[_0x060b('0x6e')]<=_0x538aa6[_0x21600d]['to']){_0x5164e2['internal']=_0x1efdfd['min_internal'];}}}if(_[_0x060b('0x6d')](_0x5164e2[_0x060b('0x68')])){_0x5164e2[_0x060b('0x68')]=_0x444493+0x1;}return _0x1b8e15(_0x5164e2);});});})[_0x060b('0x2b')](function(_0x5c563c){_0x160292(_0x5c563c);});});}function updateUser(_0x1151dd){return new BPromise(function(_0x5090bc,_0x20e419){try{if(_0x1151dd[_0x060b('0x73')]){_0x1151dd[_0x060b('0x74')]=_0x1151dd[_0x060b('0x68')];_0x1151dd[_0x060b('0x75')]={'mailbox':_0x1151dd['internal'],'password':_0x1151dd['password'],'fullname':_0x1151dd[_0x060b('0x76')],'email':_0x1151dd[_0x060b('0x77')]};}if(_0x1151dd[_0x060b('0x39')]===_0x060b('0x3c')){if(!_0x1151dd['permissions'])_0x1151dd[_0x060b('0x78')]=[_0x060b('0x79'),_0x060b('0x7a'),_0x060b('0x7b'),_0x060b('0x7c'),'110',_0x060b('0x7d'),_0x060b('0x7e'),_0x060b('0x7f'),_0x060b('0x80'),'108',_0x060b('0x81'),_0x060b('0x82'),_0x060b('0x83'),'114'];}_0x5090bc(_0x1151dd);}catch(_0x516644){_0x20e419(_0x516644);}});}exports[_0x060b('0x84')]=function(_0x4d92b9,_0x2069b0){if(_0x4d92b9[_0x060b('0x85')]['role']===_0x060b('0x3c'))throw new Error(_0x060b('0x86'));if(_0x4d92b9[_0x060b('0x62')]['role']===_0x060b('0x85')&&_0x4d92b9[_0x060b('0x85')][_0x060b('0x39')]!==_0x060b('0x3a')){throw new Error(_0x060b('0x87'));}if(_0x4d92b9[_0x060b('0x62')][_0x060b('0x39')]===_0x060b('0x3a')&&_0x4d92b9[_0x060b('0x85')][_0x060b('0x39')]!==_0x060b('0x3a')){throw new Error(_0x060b('0x88'));}return licenseUtil[_0x060b('0x89')]([_0x4d92b9[_0x060b('0x62')]])['then'](function(){return validateUser(_0x4d92b9[_0x060b('0x62')]);})[_0x060b('0x21')](function(_0x94a834){return updateUser(_0x94a834)['then'](function(_0x32753b){if(_0x32753b[_0x060b('0x39')]===_0x060b('0x3a')){_0x32753b[_0x060b('0x8a')]=_0x4d92b9['user'][_0x060b('0x8a')];delete _0x32753b[_0x060b('0x8b')];}return _0x32753b;});})[_0x060b('0x21')](function(_0x377f93){return db[_0x060b('0x47')][_0x060b('0x84')](_0x377f93,{'include':[{'model':db[_0x060b('0x75')],'as':_0x060b('0x75')}]});})[_0x060b('0x21')](function(_0x1666f3){if(_0x4d92b9[_0x060b('0x62')][_0x060b('0x39')]===_0x060b('0x85'))return _0x1666f3;if(_0x4d92b9[_0x060b('0x85')][_0x060b('0x39')]!==_0x060b('0x85'))return _0x1666f3;return db[_0x060b('0x8c')][_0x060b('0x42')]({'where':{'name':_0x1666f3[_0x060b('0x39')]==='agent'?'Agents':_0x060b('0x3d'),'userProfileId':_0x4d92b9[_0x060b('0x85')][_0x060b('0x8b')]},'raw':!![]})[_0x060b('0x21')](function(_0x38f1fc){if(!_0x38f1fc||_0x38f1fc[_0x060b('0x8d')]!=0x0)return _0x1666f3;return db[_0x060b('0x44')][_0x060b('0x84')]({'name':_0x1666f3[_0x060b('0x43')],'resourceId':_0x1666f3['id'],'type':_0x38f1fc[_0x060b('0x43')],'sectionId':_0x38f1fc['id']},{})['then'](function(){return _0x1666f3;});})[_0x060b('0x2b')](function(_0xcadf3){logger[_0x060b('0x27')](_0x060b('0x8e'),_0xcadf3);throw _0xcadf3;});})[_0x060b('0x21')](respondWithResult(_0x2069b0,0xc9))[_0x060b('0x2b')](handleError(_0x2069b0,null));};exports[_0x060b('0x8f')]=function(_0x21898c,_0x2423c1){var _0x186d61=_0x21898c[_0x060b('0x62')];var _0x5d2d18=[];if(_0x21898c[_0x060b('0x85')][_0x060b('0x39')]===_0x060b('0x3c'))throw new Error(_0x060b('0x86'));if(_[_0x060b('0x90')](_0x186d61,[_0x060b('0x39'),'user'])&&_0x21898c[_0x060b('0x85')][_0x060b('0x39')]!==_0x060b('0x3a')){throw new Error(_0x060b('0x87'));}if(_[_0x060b('0x90')](_0x186d61,['role',_0x060b('0x3a')])&&_0x21898c[_0x060b('0x85')]['role']!==_0x060b('0x3a')){throw new Error(_0x060b('0x91'));}return licenseUtil[_0x060b('0x89')](_0x186d61)[_0x060b('0x21')](function(){return validateUser(_0x186d61[0x0]);})[_0x060b('0x21')](function(){for(var _0x56a6fd=0x1;_0x56a6fd<_0x186d61[_0x060b('0x53')];_0x56a6fd++){var _0x337457=_0x186d61[_0x56a6fd-0x1][_0x060b('0x68')];if(!_0x186d61[_0x56a6fd]['internal'])_0x186d61[_0x56a6fd]['internal']=_0x337457+0x1;_0x5d2d18['push'](validateUser(_0x186d61[_0x56a6fd]));}return BPromise[_0x060b('0x92')](_0x5d2d18);})['then'](function(){_0x5d2d18=[];for(var _0x5cb566=0x0;_0x5cb566<_0x186d61[_0x060b('0x53')];_0x5cb566++){_0x5d2d18[_0x060b('0x93')](updateUser(_0x186d61[_0x5cb566]));}return BPromise[_0x060b('0x92')](_0x5d2d18);})['then'](function(){return BPromise[_0x060b('0x94')](_0x186d61,function(_0x53b882){return db['User'][_0x060b('0x84')](_0x53b882,{'include':[{'model':db[_0x060b('0x75')],'as':_0x060b('0x75')}]})['then'](function(_0x439281){_0x53b882['id']=_0x439281['id'];return _0x53b882;});});})[_0x060b('0x21')](function(_0x269042){if(_0x21898c['body'][_0x060b('0x39')]===_0x060b('0x85'))return _0x269042;if(_0x21898c[_0x060b('0x85')][_0x060b('0x39')]!==_0x060b('0x85'))return _0x269042;var _0x4c28b3=_[_0x060b('0x90')](_0x269042,function(_0x3a7a9a){return _0x3a7a9a[_0x060b('0x39')]==='agent'||_0x3a7a9a[_0x060b('0x39')]===_0x060b('0x95');});if(!_0x4c28b3)return _0x269042;return db['UserProfileSection'][_0x060b('0x96')]({'where':{'name':{'$or':[_0x060b('0x3b'),_0x060b('0x3d')]},'userProfileId':_0x21898c[_0x060b('0x85')][_0x060b('0x8b')]},'raw':!![]})[_0x060b('0x21')](function(_0x5df193){if(_[_0x060b('0x97')](_0x5df193)||!_[_0x060b('0x90')](_0x5df193,[_0x060b('0x8d'),0x0]))return _0x269042;_0x5d2d18=[];var _0x11bd8b=_(_0x5df193)[_0x060b('0x40')](function(_0x5ebb2a){if(_0x5ebb2a['autoAssociation']===0x1)return;return _0x5ebb2a[_0x060b('0x43')]==='Agents'?_0x060b('0x3c'):'telephone';})[_0x060b('0x98')]()['value']();for(var _0x167dee=0x0;_0x167dee<_0x269042[_0x060b('0x53')];_0x167dee++){if(!_[_0x060b('0x99')](_0x11bd8b,_0x269042[_0x167dee][_0x060b('0x39')]))return;var _0x3d8132=_0x269042[_0x167dee][_0x060b('0x39')]===_0x060b('0x3c')?_0x060b('0x3b'):_0x060b('0x3d');_0x5d2d18['push'](db[_0x060b('0x44')]['create']({'name':_0x269042[_0x167dee]['name'],'resourceId':_0x269042[_0x167dee]['id'],'type':_0x3d8132,'sectionId':_['find'](_0x5df193,[_0x060b('0x43'),_0x3d8132])['id']},{}));}return BPromise['all'](_0x5d2d18);})[_0x060b('0x21')](respondWithResult(_0x2423c1,0xc9))[_0x060b('0x2b')](handleError(_0x2423c1,null));});};exports[_0x060b('0x9a')]=function(_0x50e8be,_0x2a7cb9,_0x3d8b09){if(_0x50e8be[_0x060b('0x62')]['id']){delete _0x50e8be[_0x060b('0x62')]['id'];}return db[_0x060b('0x47')][_0x060b('0x42')]({'where':{'id':_0x50e8be[_0x060b('0x63')]['id']}})[_0x060b('0x21')](function(_0x4f1200){if(!_0x4f1200)return null;if(_0x4f1200['id']===_0x50e8be['user']['id']){if(!_0x50e8be['body']['oldPassword']||!_0x50e8be['body'][_0x060b('0x9b')]){throw new db[(_0x060b('0x9c'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4f1200['authenticate'](_0x50e8be[_0x060b('0x62')][_0x060b('0x9d')])){throw new db[(_0x060b('0x9c'))][(_0x060b('0x9e'))](_0x060b('0x9f'));}if(_0x50e8be[_0x060b('0x62')][_0x060b('0x9d')]===_0x50e8be[_0x060b('0x62')][_0x060b('0x9b')]){throw new db['Sequelize'][(_0x060b('0x9e'))](_0x060b('0xa0'));}}else if(_0x50e8be[_0x060b('0x85')][_0x060b('0x39')]==='admin'){if(!_0x50e8be[_0x060b('0x62')][_0x060b('0x9b')]){throw new db[(_0x060b('0x9c'))][(_0x060b('0x9e'))](_0x060b('0xa1'));}}else if(_0x50e8be['user'][_0x060b('0x39')]===_0x060b('0x85')){if(!_0x50e8be['body'][_0x060b('0x9b')]){throw new db[(_0x060b('0x9c'))][(_0x060b('0x9e'))](_0x060b('0xa1'));}if(_0x4f1200[_0x060b('0x39')]!==_0x060b('0x3c')){throw new db['Sequelize'][(_0x060b('0x9e'))](_0x060b('0x86'));}}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}return _0x4f1200;})[_0x060b('0x21')](handleEntityNotFound(_0x2a7cb9,null))['then'](function(_0x222528){return db['Setting'][_0x060b('0xa2')]({'attributes':['id',_0x060b('0xa3'),_0x060b('0xa4'),'passwordHistoryLimit']})['then'](function(_0x11869b){if(_0x11869b['securePassword'])authService[_0x060b('0x6b')](_0x50e8be['body'][_0x060b('0x9b')]);if(!_0x11869b['enforcePasswordHistory']||!_0x222528['previousPasswords'])return _0x222528;authService[_0x060b('0xa5')](_0x50e8be[_0x060b('0x62')][_0x060b('0x9b')],_0x222528['previousPasswords'],_0x11869b['passwordHistoryLimit']);return _0x222528;})[_0x060b('0x21')](saveUpdates({'password':_0x50e8be[_0x060b('0x62')][_0x060b('0x9b')],'passwordResetAt':_0x50e8be[_0x060b('0x85')]['id']==_0x50e8be[_0x060b('0x63')]['id']?moment():null,'previousPasswords':authService[_0x060b('0xa6')](_0x50e8be[_0x060b('0x62')][_0x060b('0x9b')],_0x222528['previousPasswords'])},null));})[_0x060b('0x21')](respondWithResult(_0x2a7cb9,null))['catch'](handleError(_0x2a7cb9,null));};exports[_0x060b('0xa7')]=function(_0x5f2fa7,_0x33a034,_0xd480d4){var _0x3dc633=_0x5f2fa7[_0x060b('0x62')][_0x060b('0xa8')];return db[_0x060b('0x47')]['find']({'where':{'id':_0x5f2fa7[_0x060b('0x63')]['id']},'attributes':['id',_0x060b('0x43'),'role','online',_0x060b('0xa9'),_0x060b('0xaa'),_0x060b('0xab')]})[_0x060b('0x21')](handleEntityNotFound(_0x33a034,null))['then'](function(_0x2d0718){if(_0x2d0718){if(!utils[_0x060b('0xac')](_0x3dc633)){throw new db[(_0x060b('0x9c'))]['ValidationError'](_0x060b('0xad'));}return _0x2d0718['add'+_['capitalize'](_0x3dc633['toLowerCase']())+_0x060b('0xae')](_0x5f2fa7[_0x060b('0x62')][_0x060b('0x67')],{'penalty':_0x5f2fa7[_0x060b('0x62')][_0x060b('0xaf')]||0x0})[_0x060b('0xb0')](function(_0x3de367){for(var _0x12e5a6=0x0;_0x12e5a6<_0x5f2fa7['body']['ids'][_0x060b('0x53')];_0x12e5a6+=0x1){var _0x1d6f78={'UserId':_0x5f2fa7[_0x060b('0x63')]['id']};_0x1d6f78[_[_0x060b('0xb1')](_0x3dc633[_0x060b('0xb2')]())+_0x060b('0xb3')]=_0x5f2fa7[_0x060b('0x62')]['ids'][_0x12e5a6];socket[_0x060b('0xb4')](_0x060b('0x85')+_[_0x060b('0xb1')](_0x3dc633[_0x060b('0xb2')]())+_0x060b('0xb5'),_0x1d6f78);}return _0x3de367;})['then'](function(){if(_0x3dc633===_0x060b('0xb6')){return db[_0x060b('0xb7')][_0x060b('0x96')]({'where':{'id':_0x5f2fa7[_0x060b('0x62')][_0x060b('0x67')]||[]},'raw':!![],'attributes':['id',_0x060b('0x43')]});}})[_0x060b('0x21')](function(_0x3c77e5){var _0x4d5d46=_0x2d0718[_0x060b('0x38')]({'plain':!![]});var _0x4551d9=[];if(_0x3dc633===_0x060b('0xb6')&&_0x4d5d46[_0x060b('0x39')]===_0x060b('0x3c')&&_0x4d5d46['online']){for(var _0x316da4=0x0;_0x316da4<_0x3c77e5['length'];_0x316da4+=0x1){_0x4551d9['push']({'membername':_0x4d5d46[_0x060b('0x43')],'UserId':_0x4d5d46['id'],'queue_name':_0x3c77e5[_0x316da4][_0x060b('0x43')],'VoiceQueueId':_0x3c77e5[_0x316da4]['id'],'interface':_[_0x060b('0x6d')](_0x4d5d46[_0x060b('0xab')])?util['format'](_0x060b('0xb8'),_0x4d5d46['name']):_0x4d5d46[_0x060b('0xab')],'paused':_0x4d5d46[_0x060b('0xaa')]||![],'penalty':_0x5f2fa7[_0x060b('0x62')][_0x060b('0xaf')]||0x0});}return BPromise['each'](_0x4551d9,function(_0x268f6d){return db[_0x060b('0xb9')][_0x060b('0xba')](_0x268f6d);});}return _0x2d0718;});}})[_0x060b('0x21')](respondWithStatusCode(_0x33a034,null))[_0x060b('0x2b')](handleError(_0x33a034,null));};exports[_0x060b('0xbb')]=function(_0x3e157b,_0x5866f9,_0x45ba77){var _0x4823d8;return db[_0x060b('0x47')][_0x060b('0x42')]({'where':{'id':_0x3e157b['params']['id']},'attributes':['id',_0x060b('0x43'),_0x060b('0x39')]})[_0x060b('0x21')](handleEntityNotFound(_0x5866f9,null))[_0x060b('0x21')](function(_0x9fc655){if(_0x9fc655){_0x4823d8=_0x9fc655;if(!_0x3e157b[_0x060b('0x4e')][_0x060b('0xa8')]||!utils[_0x060b('0xac')](_0x3e157b['query'][_0x060b('0xa8')])){throw new db['Sequelize'][(_0x060b('0x9e'))](_0x060b('0xad'));}return _0x9fc655['remove'+_[_0x060b('0xb1')](_0x3e157b['query']['channel'][_0x060b('0xb2')]())+'Queues'](_0x3e157b[_0x060b('0x4e')]['ids']);}})[_0x060b('0x21')](function(_0x19dda1){for(var _0x54e49b=0x0;_0x54e49b<_0x3e157b[_0x060b('0x4e')][_0x060b('0x67')]['length'];_0x54e49b+=0x1){var _0x34dccf={'UserId':_0x3e157b['params']['id']};_0x34dccf[_['capitalize'](_0x3e157b[_0x060b('0x4e')][_0x060b('0xa8')][_0x060b('0xb2')]())+_0x060b('0xb3')]=_0x3e157b[_0x060b('0x4e')][_0x060b('0x67')][_0x54e49b];socket['emit'](_0x060b('0x85')+_[_0x060b('0xb1')](_0x3e157b[_0x060b('0x4e')][_0x060b('0xa8')][_0x060b('0xb2')]())+'Queue:remove',_0x34dccf);}return _0x19dda1;})[_0x060b('0x21')](function(){if(_0x3e157b[_0x060b('0x4e')][_0x060b('0xa8')]===_0x060b('0xb6')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x3e157b[_0x060b('0x63')]['id'],'VoiceQueueId':_0x3e157b[_0x060b('0x4e')][_0x060b('0x67')]},'individualHooks':!![]})[_0x060b('0x21')](function(){return _0x4823d8;});}return _0x4823d8;})[_0x060b('0x21')](respondWithStatusCode(_0x5866f9,null))[_0x060b('0x2b')](handleError(_0x5866f9,null));};exports[_0x060b('0xbc')]=function(_0x3fd8c8,_0x45e657,_0x5bfd83){_0x3fd8c8[_0x060b('0x62')][_0x060b('0xbd')]=_0x3fd8c8[_0x060b('0xbe')][_0x060b('0xbf')];return db['User'][_0x060b('0x42')]({'where':{'id':_0x3fd8c8[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x45e657,null))['then'](saveUpdates(_0x3fd8c8[_0x060b('0x62')],null))[_0x060b('0x21')](respondWithResult(_0x45e657,null))[_0x060b('0x2b')](handleError(_0x45e657,null));};exports[_0x060b('0xc0')]=function(_0x35e86d,_0x3a636c,_0x11daf4){var _0x47d079=path['join'](config['root'],_0x060b('0xc1'));return db[_0x060b('0x47')]['find']({'where':{'id':_0x35e86d[_0x060b('0x63')]['id']},'attributes':['id',_0x060b('0xbd')],'raw':!![]})[_0x060b('0x21')](handleEntityNotFound(_0x3a636c,null))[_0x060b('0x21')](function(_0x1a768c){if(_0x1a768c){if(_[_0x060b('0x6d')](_0x1a768c['userpic'])){return _0x3a636c[_0x060b('0xc2')](_0x47d079);}else{if(!fs[_0x060b('0xc3')](path[_0x060b('0xc4')](config['root'],_0x060b('0xc5'),_0x1a768c[_0x060b('0xbd')]))){return _0x3a636c['download'](_0x47d079);}return _0x3a636c[_0x060b('0xc2')](path[_0x060b('0xc4')](config['root'],_0x060b('0xc5'),_0x1a768c['userpic']));}}})[_0x060b('0x2b')](handleError(_0x3a636c,null));};exports[_0x060b('0xc6')]=function(_0x17065a,_0x4bacbf,_0x2377db){var _0x49b9b3={};var _0x38c4c2={};var _0x12cd0f;var _0x351d6c;return db[_0x060b('0x47')]['findOne']({'where':{'id':_0x17065a['params']['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x4bacbf,null))[_0x060b('0x21')](function(_0x5b19d8){if(_0x5b19d8){_0x12cd0f=_0x5b19d8;_0x38c4c2[_0x060b('0x4a')]=_['keys'](db[_0x060b('0xc7')][_0x060b('0x61')]);_0x38c4c2[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x17065a[_0x060b('0x4e')]);_0x38c4c2['filters']=_[_0x060b('0x50')](_0x38c4c2['model'],_0x38c4c2[_0x060b('0x4e')]);_0x49b9b3[_0x060b('0x51')]=_[_0x060b('0x50')](_0x38c4c2[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x17065a[_0x060b('0x4e')]['fields']));_0x49b9b3[_0x060b('0x51')]=_0x49b9b3['attributes'][_0x060b('0x53')]?_0x49b9b3[_0x060b('0x51')]:_0x38c4c2[_0x060b('0x4a')];_0x49b9b3['order']=qs[_0x060b('0x55')](_0x17065a['query']['sort']);_0x49b9b3[_0x060b('0x56')]=qs[_0x060b('0x57')](_['pick'](_0x17065a[_0x060b('0x4e')],_0x38c4c2[_0x060b('0x57')]));if(_0x17065a[_0x060b('0x4e')][_0x060b('0x3e')]){_0x49b9b3[_0x060b('0x56')]=_['merge'](_0x49b9b3[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x49b9b3[_0x060b('0x51')],function(_0x47ebf1){var _0xffba9={};_0xffba9[_0x47ebf1]={'$like':'%'+_0x17065a['query'][_0x060b('0x3e')]+'%'};return _0xffba9;})});}_0x49b9b3=_[_0x060b('0x5c')]({},_0x49b9b3,_0x17065a[_0x060b('0xc8')]);return _0x12cd0f[_0x060b('0xc6')](_0x49b9b3);}})[_0x060b('0x21')](function(_0x43bd8c){if(_0x43bd8c){_0x351d6c=_0x43bd8c['length'];if(_0x17065a[_0x060b('0x4e')]['hasOwnProperty'](_0x060b('0x5d'))){_0x49b9b3[_0x060b('0x5e')]=[{'model':db[_0x060b('0xc9')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x060b('0xca'),'attributes':['id',_0x060b('0x43'),'color'],'where':_0x17065a[_0x060b('0x4e')][_0x060b('0xcb')]?{'id':_0x17065a[_0x060b('0x4e')][_0x060b('0xcb')]}:undefined,'required':_0x17065a[_0x060b('0x4e')][_0x060b('0xcb')]?!![]:![]}];}if(!_0x17065a[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x49b9b3[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x17065a[_0x060b('0x4e')][_0x060b('0x31')]);_0x49b9b3[_0x060b('0x30')]=qs[_0x060b('0x30')](_0x17065a[_0x060b('0x4e')][_0x060b('0x30')]);}return _0x12cd0f[_0x060b('0xc6')](_0x49b9b3);}})[_0x060b('0x21')](function(_0x1ce8a3){if(_0x1ce8a3){return _0x1ce8a3?{'count':_0x351d6c,'rows':_0x1ce8a3}:null;}})['then'](respondWithResult(_0x4bacbf,null))['catch'](handleError(_0x4bacbf,null));};exports[_0x060b('0xce')]=function(_0x1ed6ea,_0x2210c5,_0x51b7bb){var _0x3e7b53;var _0x56cef7;var _0x5430d0={};var _0x1291cd;return db['User'][_0x060b('0xa2')]({'where':{'id':_0x1ed6ea[_0x060b('0x63')]['id']},'attributes':['id',_0x060b('0x43'),_0x060b('0x39')]})[_0x060b('0x21')](handleEntityNotFound(_0x2210c5,null))['then'](function(_0x48f612){if(!utils[_0x060b('0xac')](_0x1ed6ea['query'][_0x060b('0xa8')])){throw new db[(_0x060b('0x9c'))]['ValidationError'](_0x060b('0xad'));}_0x3e7b53=_0x48f612;var _0x8e9ac1={};_0x8e9ac1[_0x060b('0x4a')]=_[_0x060b('0x4f')](db[_[_0x060b('0xb1')](_0x1ed6ea[_0x060b('0x4e')]['channel'])+'Queue'][_0x060b('0x61')]);_0x8e9ac1[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x1ed6ea[_0x060b('0x4e')]);_0x8e9ac1['filters']=_['intersection'](_0x8e9ac1[_0x060b('0x4a')],_0x8e9ac1[_0x060b('0x4e')]);_0x5430d0[_0x060b('0x51')]=_['intersection'](_0x8e9ac1[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x1ed6ea[_0x060b('0x4e')]['fields']));_0x5430d0[_0x060b('0x51')]=_0x5430d0[_0x060b('0x51')][_0x060b('0x53')]?_0x5430d0[_0x060b('0x51')]:_0x8e9ac1[_0x060b('0x4a')];_0x5430d0[_0x060b('0x54')]=qs[_0x060b('0x55')](_0x1ed6ea[_0x060b('0x4e')][_0x060b('0x55')]);_0x5430d0[_0x060b('0x56')]=qs[_0x060b('0x57')](_['pick'](_0x1ed6ea[_0x060b('0x4e')],_0x8e9ac1[_0x060b('0x57')]));if(_0x1ed6ea[_0x060b('0x4e')][_0x060b('0x3e')]){_0x5430d0[_0x060b('0x56')]=_['merge'](_0x5430d0[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x5430d0['attributes'],function(_0x59dbbc){var _0x4f5357={};_0x4f5357[_0x59dbbc]={'$like':'%'+_0x1ed6ea['query'][_0x060b('0x3e')]+'%'};return _0x4f5357;})});}_0x5430d0=_['merge']({},_0x5430d0,_0x1ed6ea[_0x060b('0xc8')]);switch(_0x3e7b53[_0x060b('0x39')]){case _0x060b('0x3a'):return db[_['capitalize'](_0x1ed6ea[_0x060b('0x4e')][_0x060b('0xa8')])+_0x060b('0xcf')][_0x060b('0x96')](_0x5430d0);case _0x060b('0x85'):case _0x060b('0x3c'):return _0x3e7b53[_0x060b('0x38')+_['capitalize'](_0x1ed6ea[_0x060b('0x4e')][_0x060b('0xa8')])+'Queues'](_0x5430d0);default:throw new db[(_0x060b('0x9c'))][(_0x060b('0x9e'))](_0x060b('0xd0'));}})['then'](function(_0x3e4fba){_0x1291cd=_0x3e4fba[_0x060b('0x53')];if(!_0x1ed6ea[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x5430d0[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x1ed6ea[_0x060b('0x4e')][_0x060b('0x31')]);_0x5430d0[_0x060b('0x30')]=qs[_0x060b('0x30')](_0x1ed6ea[_0x060b('0x4e')][_0x060b('0x30')]);}switch(_0x3e7b53[_0x060b('0x39')]){case _0x060b('0x3a'):return db[_['capitalize'](_0x1ed6ea[_0x060b('0x4e')][_0x060b('0xa8')])+'Queue'][_0x060b('0x96')](_0x5430d0);case'user':case'agent':return _0x3e7b53[_0x060b('0x38')+_[_0x060b('0xb1')](_0x1ed6ea['query']['channel'])+_0x060b('0xae')](_0x5430d0);}})['then'](function(_0xfa51ee){return{'count':_0x1291cd,'rows':_0xfa51ee};})['then'](respondWithResult(_0x2210c5,null))[_0x060b('0x2b')](handleError(_0x2210c5,null));};exports[_0x060b('0xd1')]=function(_0x221c3d,_0x47c2c7,_0x58cd75){var _0x4beb96={};var _0x11ea97={};var _0x18641b;var _0x14aee3;return db[_0x060b('0x47')][_0x060b('0xa2')]({'where':{'id':_0x221c3d[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x47c2c7,null))[_0x060b('0x21')](function(_0x59fbaf){if(_0x59fbaf){_0x18641b=_0x59fbaf;_0x11ea97[_0x060b('0x4a')]=_[_0x060b('0x4f')](db['UserVoiceQueueRt'][_0x060b('0x61')]);_0x11ea97[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x221c3d['query']);_0x11ea97[_0x060b('0x57')]=_[_0x060b('0x50')](_0x11ea97[_0x060b('0x4a')],_0x11ea97[_0x060b('0x4e')]);_0x4beb96[_0x060b('0x51')]=_['intersection'](_0x11ea97[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x221c3d['query'][_0x060b('0x52')]));_0x4beb96['attributes']=_0x4beb96[_0x060b('0x51')][_0x060b('0x53')]?_0x4beb96[_0x060b('0x51')]:_0x11ea97[_0x060b('0x4a')];_0x4beb96[_0x060b('0x54')]=qs['sort'](_0x221c3d[_0x060b('0x4e')][_0x060b('0x55')]);_0x4beb96['where']=qs[_0x060b('0x57')](_[_0x060b('0xd2')](_0x221c3d[_0x060b('0x4e')],_0x11ea97[_0x060b('0x57')]));if(_0x221c3d[_0x060b('0x4e')][_0x060b('0x3e')]){_0x4beb96[_0x060b('0x56')]=_[_0x060b('0x5c')](_0x4beb96[_0x060b('0x56')],{'$or':_['map'](_0x4beb96[_0x060b('0x51')],function(_0x49c4a1){var _0x7dbffb={};_0x7dbffb[_0x49c4a1]={'$like':'%'+_0x221c3d['query'][_0x060b('0x3e')]+'%'};return _0x7dbffb;})});}_0x4beb96=_[_0x060b('0x5c')]({},_0x4beb96,_0x221c3d['options']);return _0x18641b['getVoiceQueuesRt'](_0x4beb96);}})['then'](function(_0x4256e6){if(_0x4256e6){_0x14aee3=_0x4256e6[_0x060b('0x53')];if(!_0x221c3d[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x4beb96[_0x060b('0x31')]=qs['limit'](_0x221c3d['query']['limit']);_0x4beb96[_0x060b('0x30')]=qs[_0x060b('0x30')](_0x221c3d['query'][_0x060b('0x30')]);}return _0x18641b[_0x060b('0xd1')](_0x4beb96);}})[_0x060b('0x21')](function(_0x3a9b03){if(_0x3a9b03){return _0x3a9b03?{'count':_0x14aee3,'rows':_0x3a9b03}:null;}})[_0x060b('0x21')](respondWithResult(_0x47c2c7,null))['catch'](handleError(_0x47c2c7,null));};exports[_0x060b('0xd3')]=function(_0x2ec5b6,_0x23e2b1,_0x2567e4){var _0x2082b0={};var _0x1c56f2={};var _0x1638c6;var _0x485cc1;return db[_0x060b('0x47')][_0x060b('0xa2')]({'where':{'id':_0x2ec5b6[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x23e2b1,null))[_0x060b('0x21')](function(_0x33ecaa){if(_0x33ecaa){_0x1638c6=_0x33ecaa;_0x1c56f2[_0x060b('0x4a')]=_['keys'](db[_0x060b('0xd4')][_0x060b('0x61')]);_0x1c56f2[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x2ec5b6[_0x060b('0x4e')]);_0x1c56f2[_0x060b('0x57')]=_[_0x060b('0x50')](_0x1c56f2[_0x060b('0x4a')],_0x1c56f2[_0x060b('0x4e')]);_0x2082b0[_0x060b('0x51')]=_[_0x060b('0x50')](_0x1c56f2['model'],qs[_0x060b('0x52')](_0x2ec5b6[_0x060b('0x4e')][_0x060b('0x52')]));_0x2082b0[_0x060b('0x51')]=_0x2082b0['attributes'][_0x060b('0x53')]?_0x2082b0['attributes']:_0x1c56f2[_0x060b('0x4a')];_0x2082b0[_0x060b('0x54')]=qs[_0x060b('0x55')](_0x2ec5b6[_0x060b('0x4e')][_0x060b('0x55')]);_0x2082b0[_0x060b('0x56')]=qs['filters'](_['pick'](_0x2ec5b6[_0x060b('0x4e')],_0x1c56f2['filters']));if(_0x2ec5b6['query'][_0x060b('0x3e')]){_0x2082b0['where']=_[_0x060b('0x5c')](_0x2082b0[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x2082b0['attributes'],function(_0x1d49c3){var _0x2c05ee={};_0x2c05ee[_0x1d49c3]={'$like':'%'+_0x2ec5b6[_0x060b('0x4e')]['filter']+'%'};return _0x2c05ee;})});}_0x2082b0=_[_0x060b('0x5c')]({},_0x2082b0,_0x2ec5b6[_0x060b('0xc8')]);return _0x1638c6[_0x060b('0xd3')](_0x2082b0);}})[_0x060b('0x21')](function(_0x29545d){if(_0x29545d){_0x485cc1=_0x29545d[_0x060b('0x53')];if(!_0x2ec5b6[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x2082b0[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x2ec5b6['query'][_0x060b('0x31')]);_0x2082b0[_0x060b('0x30')]=qs['offset'](_0x2ec5b6[_0x060b('0x4e')][_0x060b('0x30')]);}return _0x1638c6[_0x060b('0xd3')](_0x2082b0);}})[_0x060b('0x21')](function(_0x43ca23){if(_0x43ca23){return _0x43ca23?{'count':_0x485cc1,'rows':_0x43ca23}:null;}})['then'](respondWithResult(_0x23e2b1,null))[_0x060b('0x2b')](handleError(_0x23e2b1,null));};exports[_0x060b('0xd5')]=function(_0x3ae2b3,_0x471d4f,_0x418450){var _0x15aee1={'raw':!![],'where':{}};var _0x5054f1={};var _0x9fc8a3={'count':0x0,'rows':[]};return db['User'][_0x060b('0xa2')]({'where':{'id':_0x3ae2b3[_0x060b('0x63')]['id']}})['then'](handleEntityNotFound(_0x471d4f,null))[_0x060b('0x21')](function(_0x4b5501){if(_0x4b5501){_0x5054f1[_0x060b('0x4a')]=_['keys'](db['VoiceRecording'][_0x060b('0x61')]);_0x5054f1[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x3ae2b3['query']);_0x5054f1[_0x060b('0x57')]=_[_0x060b('0x50')](_0x5054f1['model'],_0x5054f1[_0x060b('0x4e')]);_0x15aee1['attributes']=_[_0x060b('0x50')](_0x5054f1[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x3ae2b3[_0x060b('0x4e')][_0x060b('0x52')]));_0x15aee1[_0x060b('0x51')]=_0x15aee1[_0x060b('0x51')][_0x060b('0x53')]?_0x15aee1[_0x060b('0x51')]:_0x5054f1[_0x060b('0x4a')];if(!_0x3ae2b3[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x15aee1[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x3ae2b3['query'][_0x060b('0x31')]);_0x15aee1[_0x060b('0x30')]=qs[_0x060b('0x30')](_0x3ae2b3[_0x060b('0x4e')][_0x060b('0x30')]);}_0x15aee1[_0x060b('0x54')]=qs[_0x060b('0x55')](_0x3ae2b3['query']['sort']);_0x15aee1[_0x060b('0x56')]=qs[_0x060b('0x57')](_[_0x060b('0xd2')](_0x3ae2b3[_0x060b('0x4e')],_0x5054f1[_0x060b('0x57')]));_0x15aee1[_0x060b('0x56')][_0x060b('0xd6')]=_0x4b5501['id'];if(_0x3ae2b3[_0x060b('0x4e')]['filter']){_0x15aee1['where']=_[_0x060b('0x5c')](_0x15aee1['where'],{'$or':_[_0x060b('0x40')](_0x15aee1[_0x060b('0x51')],function(_0x4051d9){var _0x491ce0={};_0x491ce0[_0x4051d9]={'$like':'%'+_0x3ae2b3['query'][_0x060b('0x3e')]+'%'};return _0x491ce0;})});}_0x15aee1=_[_0x060b('0x5c')]({},_0x15aee1,_0x3ae2b3[_0x060b('0xc8')]);return db[_0x060b('0xd7')][_0x060b('0x2f')]({'where':_0x15aee1[_0x060b('0x56')]})[_0x060b('0x21')](function(_0x128dfd){_0x9fc8a3[_0x060b('0x2f')]=_0x128dfd;if(_0x3ae2b3[_0x060b('0x4e')]['includeAll']){_0x15aee1[_0x060b('0x5e')]=[{'all':!![]}];}return db['VoiceRecording'][_0x060b('0x96')](_0x15aee1);})[_0x060b('0x21')](function(_0x12fc92){_0x9fc8a3['rows']=_0x12fc92;return _0x9fc8a3;});}})[_0x060b('0x21')](respondWithFilteredResult(_0x471d4f,_0x15aee1))['catch'](handleError(_0x471d4f,null));};exports[_0x060b('0xd8')]=function(_0x39b64c,_0x523fe0,_0x195833){var _0x170356={'raw':!![],'where':{}};var _0x47b546={};var _0x15fe3a={'count':0x0,'rows':[]};return db[_0x060b('0x47')][_0x060b('0xa2')]({'where':{'id':_0x39b64c[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x523fe0,null))[_0x060b('0x21')](function(_0x4d2694){if(_0x4d2694){_0x47b546[_0x060b('0x4a')]=_['keys'](db[_0x060b('0xd9')][_0x060b('0x61')]);_0x47b546[_0x060b('0x4e')]=_['keys'](_0x39b64c[_0x060b('0x4e')]);_0x47b546[_0x060b('0x57')]=_[_0x060b('0x50')](_0x47b546['model'],_0x47b546['query']);_0x170356['attributes']=_[_0x060b('0x50')](_0x47b546[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x39b64c[_0x060b('0x4e')][_0x060b('0x52')]));_0x170356[_0x060b('0x51')]=_0x170356[_0x060b('0x51')]['length']?_0x170356[_0x060b('0x51')]:_0x47b546[_0x060b('0x4a')];if(!_0x39b64c['query'][_0x060b('0xcc')](_0x060b('0xcd'))){_0x170356['limit']=qs['limit'](_0x39b64c[_0x060b('0x4e')]['limit']);_0x170356[_0x060b('0x30')]=qs[_0x060b('0x30')](_0x39b64c[_0x060b('0x4e')][_0x060b('0x30')]);}_0x170356[_0x060b('0x54')]=qs[_0x060b('0x55')](_0x39b64c['query'][_0x060b('0x55')]);_0x170356[_0x060b('0x56')]=qs[_0x060b('0x57')](_[_0x060b('0xd2')](_0x39b64c[_0x060b('0x4e')],_0x47b546[_0x060b('0x57')]));_0x170356[_0x060b('0x56')]['UserId']=_0x4d2694['id'];if(_0x39b64c['query']['filter']){_0x170356[_0x060b('0x56')]=_[_0x060b('0x5c')](_0x170356[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x170356[_0x060b('0x51')],function(_0x2f289f){var _0x41c1fa={};_0x41c1fa[_0x2f289f]={'$like':'%'+_0x39b64c[_0x060b('0x4e')][_0x060b('0x3e')]+'%'};return _0x41c1fa;})});}_0x170356=_[_0x060b('0x5c')]({},_0x170356,_0x39b64c[_0x060b('0xc8')]);return db[_0x060b('0xd9')][_0x060b('0x2f')]({'where':_0x170356['where']})[_0x060b('0x21')](function(_0x490a78){_0x15fe3a['count']=_0x490a78;if(_0x39b64c[_0x060b('0x4e')][_0x060b('0x5d')]){_0x170356[_0x060b('0x5e')]=[{'all':!![]}];}return db[_0x060b('0xd9')][_0x060b('0x96')](_0x170356);})[_0x060b('0x21')](function(_0x4d04cf){_0x15fe3a[_0x060b('0x5f')]=_0x4d04cf;return _0x15fe3a;});}})[_0x060b('0x21')](respondWithFilteredResult(_0x523fe0,_0x170356))['catch'](handleError(_0x523fe0,null));};exports[_0x060b('0xda')]=function(_0x27142c,_0x2c46b4,_0x168699){var _0x15ecfa={};var _0x3099ae={};var _0xf85f40;var _0x508174;return db[_0x060b('0x47')][_0x060b('0xa2')]({'where':{'id':_0x27142c[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x2c46b4,null))['then'](function(_0xef4b94){if(_0xef4b94){_0xf85f40=_0xef4b94;_0x3099ae[_0x060b('0x4a')]=_[_0x060b('0x4f')](db[_0x060b('0xdb')]['rawAttributes']);_0x3099ae[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x27142c[_0x060b('0x4e')]);_0x3099ae[_0x060b('0x57')]=_[_0x060b('0x50')](_0x3099ae['model'],_0x3099ae[_0x060b('0x4e')]);_0x15ecfa[_0x060b('0x51')]=_[_0x060b('0x50')](_0x3099ae[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x27142c[_0x060b('0x4e')][_0x060b('0x52')]));_0x15ecfa['attributes']=_0x15ecfa['attributes'][_0x060b('0x53')]?_0x15ecfa['attributes']:_0x3099ae[_0x060b('0x4a')];_0x15ecfa['order']=qs[_0x060b('0x55')](_0x27142c[_0x060b('0x4e')]['sort']);_0x15ecfa[_0x060b('0x56')]=qs['filters'](_[_0x060b('0xd2')](_0x27142c[_0x060b('0x4e')],_0x3099ae[_0x060b('0x57')]));if(_0x27142c['query']['filter']){_0x15ecfa['where']=_[_0x060b('0x5c')](_0x15ecfa['where'],{'$or':_[_0x060b('0x40')](_0x15ecfa[_0x060b('0x51')],function(_0x5b0c38){var _0x1c7137={};_0x1c7137[_0x5b0c38]={'$like':'%'+_0x27142c[_0x060b('0x4e')]['filter']+'%'};return _0x1c7137;})});}_0x15ecfa=_[_0x060b('0x5c')]({},_0x15ecfa,_0x27142c['options']);return _0xf85f40['getChatInteractions'](_0x15ecfa);}})[_0x060b('0x21')](function(_0x4a649d){if(_0x4a649d){_0x508174=_0x4a649d['length'];if(!_0x27142c[_0x060b('0x4e')]['hasOwnProperty']('nolimit')){_0x15ecfa[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x27142c[_0x060b('0x4e')][_0x060b('0x31')]);_0x15ecfa[_0x060b('0x30')]=qs[_0x060b('0x30')](_0x27142c[_0x060b('0x4e')][_0x060b('0x30')]);}return _0xf85f40[_0x060b('0xda')](_0x15ecfa);}})[_0x060b('0x21')](function(_0x54eb41){if(_0x54eb41){return _0x54eb41?{'count':_0x508174,'rows':_0x54eb41}:null;}})['then'](respondWithResult(_0x2c46b4,null))['catch'](handleError(_0x2c46b4,null));};exports[_0x060b('0xdc')]=function(_0x281f60,_0x480b60,_0x15d52c){var _0x24ded9={};var _0x63a3fa={};var _0x4ede18;var _0x34c311;return db[_0x060b('0x47')][_0x060b('0xa2')]({'where':{'id':_0x281f60['params']['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x480b60,null))[_0x060b('0x21')](function(_0x3fc319){if(_0x3fc319){_0x4ede18=_0x3fc319;_0x63a3fa['model']=_[_0x060b('0x4f')](db[_0x060b('0xdd')][_0x060b('0x61')]);_0x63a3fa[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x281f60[_0x060b('0x4e')]);_0x63a3fa['filters']=_[_0x060b('0x50')](_0x63a3fa['model'],_0x63a3fa['query']);_0x24ded9[_0x060b('0x51')]=_[_0x060b('0x50')](_0x63a3fa[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x281f60[_0x060b('0x4e')]['fields']));_0x24ded9[_0x060b('0x51')]=_0x24ded9[_0x060b('0x51')][_0x060b('0x53')]?_0x24ded9['attributes']:_0x63a3fa[_0x060b('0x4a')];_0x24ded9[_0x060b('0x54')]=qs['sort'](_0x281f60['query'][_0x060b('0x55')]);_0x24ded9['where']=qs['filters'](_[_0x060b('0xd2')](_0x281f60[_0x060b('0x4e')],_0x63a3fa['filters']));if(_0x281f60['query'][_0x060b('0x3e')]){_0x24ded9['where']=_[_0x060b('0x5c')](_0x24ded9[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x24ded9[_0x060b('0x51')],function(_0x308f1e){var _0xcb2331={};_0xcb2331[_0x308f1e]={'$like':'%'+_0x281f60[_0x060b('0x4e')][_0x060b('0x3e')]+'%'};return _0xcb2331;})});}_0x24ded9=_[_0x060b('0x5c')]({},_0x24ded9,_0x281f60[_0x060b('0xc8')]);return _0x4ede18[_0x060b('0xdc')](_0x24ded9);}})[_0x060b('0x21')](function(_0x1f846e){if(_0x1f846e){_0x34c311=_0x1f846e[_0x060b('0x53')];if(!_0x281f60[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x24ded9[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x281f60[_0x060b('0x4e')][_0x060b('0x31')]);_0x24ded9[_0x060b('0x30')]=qs['offset'](_0x281f60[_0x060b('0x4e')]['offset']);}return _0x4ede18['getOpenchannelInteractions'](_0x24ded9);}})[_0x060b('0x21')](function(_0x16709b){if(_0x16709b){return _0x16709b?{'count':_0x34c311,'rows':_0x16709b}:null;}})['then'](respondWithResult(_0x480b60,null))[_0x060b('0x2b')](handleError(_0x480b60,null));};exports[_0x060b('0xde')]=function(_0x30c876,_0x2137c3,_0x3aea4e){var _0x35a9b7={'raw':!![],'where':{}};var _0x4ebde3={};var _0x419a72={'count':0x0,'rows':[]};return db['User'][_0x060b('0xa2')]({'where':{'id':_0x30c876[_0x060b('0x63')]['id']}})['then'](handleEntityNotFound(_0x2137c3,null))['then'](function(_0x321577){if(_0x321577){_0x4ebde3['model']=_['keys'](db[_0x060b('0xdf')][_0x060b('0x61')]);_0x4ebde3[_0x060b('0x4e')]=_['keys'](_0x30c876['query']);_0x4ebde3[_0x060b('0x57')]=_[_0x060b('0x50')](_0x4ebde3[_0x060b('0x4a')],_0x4ebde3[_0x060b('0x4e')]);_0x35a9b7[_0x060b('0x51')]=_[_0x060b('0x50')](_0x4ebde3[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x30c876[_0x060b('0x4e')][_0x060b('0x52')]));_0x35a9b7['attributes']=_0x35a9b7['attributes'][_0x060b('0x53')]?_0x35a9b7['attributes']:_0x4ebde3[_0x060b('0x4a')];if(!_0x30c876[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x35a9b7['limit']=qs[_0x060b('0x31')](_0x30c876['query'][_0x060b('0x31')]);_0x35a9b7[_0x060b('0x30')]=qs[_0x060b('0x30')](_0x30c876['query'][_0x060b('0x30')]);}_0x35a9b7['order']=qs[_0x060b('0x55')](_0x30c876[_0x060b('0x4e')][_0x060b('0x55')]);_0x35a9b7['where']=qs['filters'](_[_0x060b('0xd2')](_0x30c876[_0x060b('0x4e')],_0x4ebde3[_0x060b('0x57')]));_0x35a9b7[_0x060b('0x56')][_0x060b('0xd6')]=_0x321577['id'];if(_0x30c876['query']['filter']){_0x35a9b7['where']=_[_0x060b('0x5c')](_0x35a9b7[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x35a9b7[_0x060b('0x51')],function(_0x37cc7c){var _0xeb9b46={};_0xeb9b46[_0x37cc7c]={'$like':'%'+_0x30c876[_0x060b('0x4e')][_0x060b('0x3e')]+'%'};return _0xeb9b46;})});}_0x35a9b7=_[_0x060b('0x5c')]({},_0x35a9b7,_0x30c876['options']);return db[_0x060b('0xdf')][_0x060b('0x2f')]({'where':_0x35a9b7['where']})[_0x060b('0x21')](function(_0x4c4212){_0x419a72[_0x060b('0x2f')]=_0x4c4212;if(_0x30c876[_0x060b('0x4e')][_0x060b('0x5d')]){_0x35a9b7[_0x060b('0x5e')]=[{'all':!![]}];}return db[_0x060b('0xdf')][_0x060b('0x96')](_0x35a9b7);})[_0x060b('0x21')](function(_0x5370de){_0x419a72[_0x060b('0x5f')]=_0x5370de;return _0x419a72;});}})[_0x060b('0x21')](respondWithFilteredResult(_0x2137c3,_0x35a9b7))[_0x060b('0x2b')](handleError(_0x2137c3,null));};exports[_0x060b('0xe0')]=function(_0x25bfa3,_0x8d7874,_0x31f88a){var _0x10a8db={};var _0x55b57f={};var _0x4d472f;var _0x2d430c;return db[_0x060b('0x47')][_0x060b('0xa2')]({'where':{'id':_0x25bfa3[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x8d7874,null))[_0x060b('0x21')](function(_0x255e0d){if(_0x255e0d){_0x4d472f=_0x255e0d;_0x55b57f[_0x060b('0x4a')]=_[_0x060b('0x4f')](db['SmsInteraction'][_0x060b('0x61')]);_0x55b57f[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x25bfa3['query']);_0x55b57f[_0x060b('0x57')]=_['intersection'](_0x55b57f['model'],_0x55b57f['query']);_0x10a8db[_0x060b('0x51')]=_['intersection'](_0x55b57f[_0x060b('0x4a')],qs['fields'](_0x25bfa3[_0x060b('0x4e')][_0x060b('0x52')]));_0x10a8db[_0x060b('0x51')]=_0x10a8db[_0x060b('0x51')][_0x060b('0x53')]?_0x10a8db[_0x060b('0x51')]:_0x55b57f[_0x060b('0x4a')];_0x10a8db[_0x060b('0x54')]=qs[_0x060b('0x55')](_0x25bfa3[_0x060b('0x4e')]['sort']);_0x10a8db['where']=qs[_0x060b('0x57')](_['pick'](_0x25bfa3[_0x060b('0x4e')],_0x55b57f[_0x060b('0x57')]));if(_0x25bfa3[_0x060b('0x4e')][_0x060b('0x3e')]){_0x10a8db[_0x060b('0x56')]=_[_0x060b('0x5c')](_0x10a8db[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x10a8db[_0x060b('0x51')],function(_0x26385b){var _0x45e59f={};_0x45e59f[_0x26385b]={'$like':'%'+_0x25bfa3[_0x060b('0x4e')][_0x060b('0x3e')]+'%'};return _0x45e59f;})});}_0x10a8db=_[_0x060b('0x5c')]({},_0x10a8db,_0x25bfa3[_0x060b('0xc8')]);return _0x4d472f[_0x060b('0xe0')](_0x10a8db);}})[_0x060b('0x21')](function(_0x7140c8){if(_0x7140c8){_0x2d430c=_0x7140c8[_0x060b('0x53')];if(!_0x25bfa3[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x10a8db[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x25bfa3[_0x060b('0x4e')][_0x060b('0x31')]);_0x10a8db['offset']=qs['offset'](_0x25bfa3[_0x060b('0x4e')][_0x060b('0x30')]);}return _0x4d472f[_0x060b('0xe0')](_0x10a8db);}})[_0x060b('0x21')](function(_0x107ee2){if(_0x107ee2){return _0x107ee2?{'count':_0x2d430c,'rows':_0x107ee2}:null;}})[_0x060b('0x21')](respondWithResult(_0x8d7874,null))[_0x060b('0x2b')](handleError(_0x8d7874,null));};exports[_0x060b('0xe1')]=function(_0x5acabf,_0xa41249,_0x29eec9){var _0x259ad8={};var _0x4ba33b={};var _0x27f45a;var _0xbff479;return db['User'][_0x060b('0xa2')]({'where':{'id':_0x5acabf[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0xa41249,null))['then'](function(_0xd0adb2){if(_0xd0adb2){_0x27f45a=_0xd0adb2;_0x4ba33b[_0x060b('0x4a')]=_[_0x060b('0x4f')](db[_0x060b('0xe2')][_0x060b('0x61')]);_0x4ba33b[_0x060b('0x4e')]=_['keys'](_0x5acabf[_0x060b('0x4e')]);_0x4ba33b[_0x060b('0x57')]=_['intersection'](_0x4ba33b[_0x060b('0x4a')],_0x4ba33b[_0x060b('0x4e')]);_0x259ad8[_0x060b('0x51')]=_[_0x060b('0x50')](_0x4ba33b[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x5acabf[_0x060b('0x4e')][_0x060b('0x52')]));_0x259ad8[_0x060b('0x51')]=_0x259ad8[_0x060b('0x51')][_0x060b('0x53')]?_0x259ad8[_0x060b('0x51')]:_0x4ba33b[_0x060b('0x4a')];_0x259ad8[_0x060b('0x54')]=qs[_0x060b('0x55')](_0x5acabf[_0x060b('0x4e')][_0x060b('0x55')]);_0x259ad8[_0x060b('0x56')]=qs[_0x060b('0x57')](_['pick'](_0x5acabf['query'],_0x4ba33b[_0x060b('0x57')]));if(_0x5acabf[_0x060b('0x4e')]['filter']){_0x259ad8[_0x060b('0x56')]=_[_0x060b('0x5c')](_0x259ad8[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x259ad8[_0x060b('0x51')],function(_0x29eba2){var _0x365105={};_0x365105[_0x29eba2]={'$like':'%'+_0x5acabf[_0x060b('0x4e')][_0x060b('0x3e')]+'%'};return _0x365105;})});}_0x259ad8=_['merge']({},_0x259ad8,_0x5acabf[_0x060b('0xc8')]);return _0x27f45a[_0x060b('0xe1')](_0x259ad8);}})[_0x060b('0x21')](function(_0x38e70d){if(_0x38e70d){_0xbff479=_0x38e70d[_0x060b('0x53')];if(!_0x5acabf[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x259ad8[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x5acabf[_0x060b('0x4e')][_0x060b('0x31')]);_0x259ad8[_0x060b('0x30')]=qs[_0x060b('0x30')](_0x5acabf['query'][_0x060b('0x30')]);}return _0x27f45a[_0x060b('0xe1')](_0x259ad8);}})[_0x060b('0x21')](function(_0x54fe7c){if(_0x54fe7c){return _0x54fe7c?{'count':_0xbff479,'rows':_0x54fe7c}:null;}})[_0x060b('0x21')](respondWithResult(_0xa41249,null))[_0x060b('0x2b')](handleError(_0xa41249,null));};exports['getWhatsappInteractions']=function(_0x21309f,_0x5dd005,_0x17cd52){var _0x51d7b3={};var _0x273e24={};var _0x134a25;var _0x3e4a8c;return db['User'][_0x060b('0xa2')]({'where':{'id':_0x21309f['params']['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x5dd005,null))[_0x060b('0x21')](function(_0x5dc1ac){if(_0x5dc1ac){_0x134a25=_0x5dc1ac;_0x273e24[_0x060b('0x4a')]=_[_0x060b('0x4f')](db[_0x060b('0xe3')][_0x060b('0x61')]);_0x273e24[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x21309f['query']);_0x273e24[_0x060b('0x57')]=_[_0x060b('0x50')](_0x273e24[_0x060b('0x4a')],_0x273e24[_0x060b('0x4e')]);_0x51d7b3['attributes']=_[_0x060b('0x50')](_0x273e24[_0x060b('0x4a')],qs['fields'](_0x21309f[_0x060b('0x4e')]['fields']));_0x51d7b3[_0x060b('0x51')]=_0x51d7b3['attributes'][_0x060b('0x53')]?_0x51d7b3[_0x060b('0x51')]:_0x273e24['model'];_0x51d7b3[_0x060b('0x54')]=qs['sort'](_0x21309f[_0x060b('0x4e')][_0x060b('0x55')]);_0x51d7b3[_0x060b('0x56')]=qs[_0x060b('0x57')](_[_0x060b('0xd2')](_0x21309f[_0x060b('0x4e')],_0x273e24[_0x060b('0x57')]));if(_0x21309f[_0x060b('0x4e')]['filter']){_0x51d7b3[_0x060b('0x56')]=_[_0x060b('0x5c')](_0x51d7b3[_0x060b('0x56')],{'$or':_['map'](_0x51d7b3[_0x060b('0x51')],function(_0x1cef61){var _0x5f0215={};_0x5f0215[_0x1cef61]={'$like':'%'+_0x21309f[_0x060b('0x4e')][_0x060b('0x3e')]+'%'};return _0x5f0215;})});}_0x51d7b3=_[_0x060b('0x5c')]({},_0x51d7b3,_0x21309f[_0x060b('0xc8')]);return _0x134a25[_0x060b('0xe4')](_0x51d7b3);}})['then'](function(_0x4e5ce5){if(_0x4e5ce5){_0x3e4a8c=_0x4e5ce5[_0x060b('0x53')];if(!_0x21309f[_0x060b('0x4e')][_0x060b('0xcc')](_0x060b('0xcd'))){_0x51d7b3[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x21309f[_0x060b('0x4e')][_0x060b('0x31')]);_0x51d7b3[_0x060b('0x30')]=qs['offset'](_0x21309f[_0x060b('0x4e')]['offset']);}return _0x134a25[_0x060b('0xe4')](_0x51d7b3);}})[_0x060b('0x21')](function(_0x484b66){if(_0x484b66){return _0x484b66?{'count':_0x3e4a8c,'rows':_0x484b66}:null;}})[_0x060b('0x21')](respondWithResult(_0x5dd005,null))[_0x060b('0x2b')](handleError(_0x5dd005,null));};exports[_0x060b('0xe5')]=function(_0x5807ad,_0xce8547,_0x369621){var _0x54c3c1;var _0x5288a0;var _0x32730f;var _0x181a0e=!_[_0x060b('0x6d')](_0x5807ad[_0x060b('0x63')]['id'])?_0x5807ad['params']['id']:!_[_0x060b('0x6d')](_0x5807ad[_0x060b('0x85')]['id'])?_0x5807ad['user']['id']:null;return db[_0x060b('0x47')][_0x060b('0x42')]({'where':{'id':_0x181a0e,'role':{'$or':[_0x060b('0x3a'),_0x060b('0x85'),'agent']}},'attributes':['id',_0x060b('0x43'),'phone',_0x060b('0xe6'),_0x060b('0x39'),_0x060b('0x68'),_0x060b('0xa9')]})['then'](function(_0x2f7516){if(_0x2f7516){if(_0x2f7516[_0x060b('0x39')]===_0x060b('0x3c')){_0x54c3c1=_0x2f7516;if(_0x5807ad[_0x060b('0x62')]['interface']){_0x32730f=util[_0x060b('0xe7')](_0x060b('0xe8'),_0x54c3c1[_0x5807ad[_0x060b('0x62')]['interface']]);}else if(_0x5807ad[_0x060b('0x62')][_0x060b('0xe9')]){_0x32730f=util[_0x060b('0xe7')](_0x060b('0xb8'),_0x5807ad['body'][_0x060b('0xe9')]);}else{_0x32730f=util[_0x060b('0xe7')](_0x060b('0xb8'),_0x54c3c1[_0x060b('0x43')]);}socket['to'](util['format']('user:%s',_0x54c3c1[_0x060b('0x43')]))[_0x060b('0xb4')](_0x060b('0xea'),{'ip':_0x5807ad['headers'][_0x060b('0xeb')]||_0x5807ad['connection'][_0x060b('0xec')]||_0x5807ad['socket'][_0x060b('0xec')]||_0x5807ad[_0x060b('0xed')][_0x060b('0xee')][_0x060b('0xec')]});return db['UserVoiceQueueRt'][_0x060b('0x37')]({'where':{'membername':_0x54c3c1[_0x060b('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x060b('0x9c'))][(_0x060b('0x9e'))](_0x060b('0xef'));}})[_0x060b('0x21')](function(){if(_0x54c3c1){return _0x54c3c1['getVoiceQueues']({'raw':!![]});}})[_0x060b('0x21')](function(_0x340709){if(_0x54c3c1){var _0x5e1a0a=[];if(_0x340709){_0x5288a0=_0x340709;if(_0x5288a0[_0x060b('0x53')]){for(var _0x542121=0x0;_0x542121<_0x5288a0[_0x060b('0x53')];_0x542121++){_0x5e1a0a[_0x060b('0x93')]({'membername':_0x54c3c1[_0x060b('0x43')],'UserId':_0x54c3c1['id'],'queue_name':_0x5288a0[_0x542121][_0x060b('0x43')],'VoiceQueueId':_0x5288a0[_0x542121]['id'],'interface':_0x32730f,'paused':_0x54c3c1[_0x060b('0xa9')]||![],'penalty':_0x5288a0[_0x542121]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x5e1a0a,function(_0x51a9b2){return db['UserVoiceQueueRt'][_0x060b('0xba')](_0x51a9b2);});}}}})['then'](function(){if(_0x54c3c1){return db[_0x060b('0xf0')]['findAll']({'where':{'membername':_0x54c3c1[_0x060b('0x43')],'exitAt':null}});}})[_0x060b('0x21')](function(_0x5da112){if(_0x54c3c1){var _0x5c7507=[];_0x5da112[_0x060b('0xf1')](function(_0x5bddff){_0x5c7507[_0x060b('0x93')](_0x5bddff[_0x060b('0x36')]({'exitAt':moment()[_0x060b('0xe7')](_0x060b('0xf2'))}));});return BPromise[_0x060b('0x92')](_0x5c7507);}})['then'](function(){if(_0x54c3c1){var _0x491763=[];var _0x50396c=[];var _0x1dee87=utils[_0x060b('0xf3')]();var _0x5aeb2f={'membername':_0x54c3c1[_0x060b('0x43')],'interface':_0x32730f,'enterAt':moment()[_0x060b('0xe7')](_0x060b('0xf2')),'role':_0x54c3c1[_0x060b('0x39')],'internal':_0x54c3c1[_0x060b('0x68')]};_0x1dee87['forEach'](function(_0x23e6a6){_0x491763[_0x060b('0x93')](_[_0x060b('0x5c')]({'channel':_0x23e6a6,'type':'LOGIN','data1':_0x5807ad[_0x060b('0x62')][_0x060b('0xf4')],'data2':_0x32730f},_0x5aeb2f));if(_0x54c3c1['loginInPause']){_0x50396c['push'](_[_0x060b('0x5c')]({'channel':_0x23e6a6,'type':_0x060b('0xf5'),'data1':_0x060b('0xf6')},_0x5aeb2f));}});return db[_0x060b('0xf0')][_0x060b('0x8f')](_0x491763[_0x060b('0xf7')](_0x50396c),{'individualHooks':!![]});}})[_0x060b('0x21')](function(){if(_0x54c3c1){return _0x54c3c1[_0x060b('0x36')]({'online':!![],'lastLoginAt':moment()[_0x060b('0xe7')](_0x060b('0xf2')),'voicePause':_0x54c3c1['loginInPause']||![],'mailPause':_0x54c3c1[_0x060b('0xa9')]||![],'chatPause':_0x54c3c1[_0x060b('0xa9')]||![],'faxPause':_0x54c3c1['loginInPause']||![],'smsPause':_0x54c3c1[_0x060b('0xa9')]||![],'openchannelPause':_0x54c3c1[_0x060b('0xa9')]||![],'whatsappPause':_0x54c3c1['loginInPause']||![],'pauseType':_0x54c3c1[_0x060b('0xa9')]?_0x060b('0xf6'):null,'interface':_0x32730f,'lastPauseAt':moment()[_0x060b('0xe7')](_0x060b('0xf2'))});}})[_0x060b('0x21')](function(_0x5e0fd2){if(_0x5807ad[_0x060b('0xf8')]){return _0x369621();}else{return BPromise['resolve'](_0x5e0fd2)[_0x060b('0x21')](respondWithResult(_0xce8547,null));}})[_0x060b('0x2b')](handleError(_0xce8547,null));};exports['logout']=function(_0x3f02d2,_0x238116,_0x49e83){var _0x44e087;return db[_0x060b('0x47')][_0x060b('0x42')]({'where':{'id':_0x3f02d2[_0x060b('0x63')]['id'],'role':'agent'},'attributes':['id',_0x060b('0x43'),_0x060b('0x39')]})[_0x060b('0x21')](handleEntityNotFound(_0x238116,null))[_0x060b('0x21')](function(_0x196225){if(_0x196225){_0x44e087=_0x196225;return db[_0x060b('0xb9')][_0x060b('0x37')]({'where':{'membername':_0x44e087['name']},'individualHooks':!![]});}})[_0x060b('0x21')](function(){return db[_0x060b('0xf0')]['findAll']({'where':{'membername':_0x44e087[_0x060b('0x43')],'exitAt':null}});})[_0x060b('0x21')](function(_0x35f7ed){var _0x22085f=[];_0x35f7ed[_0x060b('0xf1')](function(_0x57398f){_0x22085f[_0x060b('0x93')](_0x57398f[_0x060b('0x36')]({'exitAt':moment()[_0x060b('0xe7')](_0x060b('0xf2'))}));});return BPromise[_0x060b('0x92')](_0x22085f);})[_0x060b('0x21')](function(){return _0x44e087[_0x060b('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x060b('0x21')](respondWithResult(_0x238116,null))['catch'](handleError(_0x238116,null));};exports[_0x060b('0xf9')]=function(_0x2c54b0,_0x498fcf,_0x3247f7){var _0x3bd45b;return db[_0x060b('0xb9')][_0x060b('0x36')]({'paused':0x1},{'where':{'UserId':_0x2c54b0[_0x060b('0x63')]['id']},'individualHooks':!![]})[_0x060b('0x21')](function(){return db[_0x060b('0x47')][_0x060b('0x42')]({'where':{'id':_0x2c54b0['params']['id'],'role':_0x060b('0x3c')},'attributes':['id',_0x060b('0x43'),_0x060b('0x39'),'internal',_0x060b('0xab')]});})[_0x060b('0x21')](handleEntityNotFound(_0x498fcf,null))[_0x060b('0x21')](function(_0x482161){if(_0x482161){_0x3bd45b=_0x482161;return respondWithRpcPromise('QueuePause',_0x060b('0xf9'),{'id':_0x3bd45b['id'],'name':_0x3bd45b[_0x060b('0x43')],'pause':!![]});}})[_0x060b('0x21')](function(){if(_0x3bd45b){return db[_0x060b('0xf0')][_0x060b('0x96')]({'where':{'membername':_0x3bd45b['name'],'type':_0x060b('0xf5'),'exitAt':null}});}})['then'](function(_0x3346c4){if(_0x3346c4[_0x060b('0x53')]){var _0x2d1701=moment()[_0x060b('0xe7')](_0x060b('0xf2'));for(var _0x5738f1=0x0,_0x4c14dc=_0x3346c4[_0x060b('0x53')];_0x5738f1<_0x4c14dc;_0x5738f1++){_0x3346c4[_0x5738f1][_0x060b('0xfa')]({'exitAt':_0x2d1701});}}})['then'](function(){var _0x519167=[];var _0x32a9a8=utils[_0x060b('0xf3')]();_0x32a9a8[_0x060b('0xf1')](function(_0x13990a){_0x519167['push']({'channel':_0x13990a,'membername':_0x3bd45b[_0x060b('0x43')],'interface':_['isNil'](_0x3bd45b[_0x060b('0xab')])?util[_0x060b('0xe7')]('SIP/%s',_0x3bd45b[_0x060b('0x43')]):_0x3bd45b[_0x060b('0xab')],'type':'PAUSE','enterAt':moment()['format'](_0x060b('0xf2')),'data1':_0x2c54b0[_0x060b('0x62')]['type']||'DEFAULT\x20PAUSE','role':_0x3bd45b[_0x060b('0x39')],'internal':_0x3bd45b[_0x060b('0x68')]});});return db[_0x060b('0xf0')][_0x060b('0x8f')](_0x519167,{'individualHooks':!![]});})[_0x060b('0x21')](function(){return _0x3bd45b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2c54b0[_0x060b('0x62')][_0x060b('0x58')]||_0x060b('0xfb'),'lastPauseAt':moment()['format'](_0x060b('0xf2'))});})[_0x060b('0x21')](respondWithResult(_0x498fcf,null))[_0x060b('0x2b')](handleError(_0x498fcf,null));};exports[_0x060b('0xfc')]=function(_0xc881f6,_0xa4488c,_0x46f3e6){var _0x5dda3b;return db[_0x060b('0x47')][_0x060b('0x42')]({'where':{'id':_0xc881f6['params']['id']},'attributes':['id',_0x060b('0x43'),_0x060b('0x39'),_0x060b('0xaa'),'mailPause','chatPause',_0x060b('0xfd'),_0x060b('0xfe'),_0x060b('0xff'),_0x060b('0x100'),'pauseType','lastPauseAt']})[_0x060b('0x21')](handleEntityNotFound(_0xa4488c,null))[_0x060b('0x21')](function(_0x501887){if(_0x501887){_0x5dda3b=_0x501887;if(_0xc881f6[_0x060b('0x62')][_0x060b('0xa8')]&&!utils['isValidChannel'](_0xc881f6[_0x060b('0x62')][_0x060b('0xa8')])){throw new db[(_0x060b('0x9c'))][(_0x060b('0x9e'))](_0x060b('0xad'));}switch(_0xc881f6[_0x060b('0x62')][_0x060b('0xa8')]){case _0x060b('0xb6'):return respondWithRpcPromise(_0x060b('0x101'),'unpause',{'id':_0x5dda3b['id'],'name':_0x5dda3b[_0x060b('0x43')],'pause':![]})[_0x060b('0x21')](function(){return db[_0x060b('0xb9')][_0x060b('0x36')]({'paused':0x0},{'where':{'UserId':_0x5dda3b['id']},'individualHooks':!![]});})[_0x060b('0x21')](function(){return db[_0x060b('0xf0')]['find']({'where':{'channel':_0xc881f6['body'][_0x060b('0xa8')],'membername':_0x5dda3b[_0x060b('0x43')],'type':_0x060b('0xf5'),'exitAt':null}});})[_0x060b('0x21')](function(_0x1e685e){if(_0x1e685e){return _0x1e685e[_0x060b('0x36')]({'exitAt':moment()[_0x060b('0xe7')](_0x060b('0xf2')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x060b('0x21')](function(){return _0x5dda3b['update']({'voicePause':![]});});case _0x060b('0x102'):case _0x060b('0x103'):case _0x060b('0x104'):case _0x060b('0x105'):case'whatsapp':case _0x060b('0x106'):return db[_0x060b('0xf0')][_0x060b('0x42')]({'where':{'channel':_0xc881f6[_0x060b('0x62')]['channel'],'membername':_0x5dda3b['name'],'type':_0x060b('0xf5'),'exitAt':null}})['then'](function(_0x24c8ff){if(_0x24c8ff){return _0x24c8ff['update']({'exitAt':moment()[_0x060b('0xe7')](_0x060b('0xf2')),'data2':_0x060b('0x107')},{'individualHooks':!![]});}return null;})[_0x060b('0x21')](function(){var _0x556fa5={};_['set'](_0x556fa5,util[_0x060b('0xe7')](_0x060b('0x108'),_0xc881f6[_0x060b('0x62')][_0x060b('0xa8')],_0x060b('0x109')),![]);return _0x5dda3b[_0x060b('0x36')](_0x556fa5);});default:return respondWithRpcPromise('QueuePause',_0x060b('0xfc'),{'id':_0x5dda3b['id'],'name':_0x5dda3b[_0x060b('0x43')],'pause':![]})[_0x060b('0x21')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x5dda3b['id']}});})['then'](function(){return db['MemberReport'][_0x060b('0x96')]({'where':{'membername':_0x5dda3b['name'],'type':_0x060b('0xf5'),'exitAt':null}});})[_0x060b('0x21')](function(_0x3bd9dc){var _0x365de6=[];_0x3bd9dc[_0x060b('0xf1')](function(_0x575100){_0x365de6[_0x060b('0x93')](_0x575100[_0x060b('0x36')]({'exitAt':moment()[_0x060b('0xe7')](_0x060b('0xf2')),'data2':_0x060b('0x107')}));});return BPromise['all'](_0x365de6);})[_0x060b('0x21')](function(){return _0x5dda3b[_0x060b('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x060b('0x21')](respondWithResult(_0xa4488c,null))[_0x060b('0x2b')](handleError(_0xa4488c,null));};exports[_0x060b('0x10a')]=function(_0x1bd09c,_0x313589,_0x99e58a){var _0x1baade={};var _0x5741ff={};var _0x5183de;var _0x241e4c;return db[_0x060b('0x47')][_0x060b('0xa2')]({'where':{'id':_0x1bd09c[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x313589,null))['then'](function(_0x28f96c){if(_0x28f96c){_0x5183de=_0x28f96c;_0x5741ff[_0x060b('0x4a')]=_[_0x060b('0x4f')](db['Team'][_0x060b('0x61')]);_0x5741ff['query']=_[_0x060b('0x4f')](_0x1bd09c['query']);_0x5741ff[_0x060b('0x57')]=_[_0x060b('0x50')](_0x5741ff[_0x060b('0x4a')],_0x5741ff[_0x060b('0x4e')]);_0x1baade[_0x060b('0x51')]=_[_0x060b('0x50')](_0x5741ff[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x1bd09c[_0x060b('0x4e')][_0x060b('0x52')]));_0x1baade[_0x060b('0x51')]=_0x1baade[_0x060b('0x51')]['length']?_0x1baade[_0x060b('0x51')]:_0x5741ff[_0x060b('0x4a')];_0x1baade[_0x060b('0x54')]=qs[_0x060b('0x55')](_0x1bd09c['query'][_0x060b('0x55')]);_0x1baade[_0x060b('0x56')]=qs[_0x060b('0x57')](_[_0x060b('0xd2')](_0x1bd09c[_0x060b('0x4e')],_0x5741ff['filters']));if(_0x1bd09c['query'][_0x060b('0x3e')]){_0x1baade['where']=_[_0x060b('0x5c')](_0x1baade[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x1baade[_0x060b('0x51')],function(_0x4a0f65){var _0x51b441={};_0x51b441[_0x4a0f65]={'$like':'%'+_0x1bd09c[_0x060b('0x4e')][_0x060b('0x3e')]+'%'};return _0x51b441;})});}_0x1baade=_[_0x060b('0x5c')]({},_0x1baade,_0x1bd09c[_0x060b('0xc8')]);return _0x5183de[_0x060b('0x10a')](_0x1baade);}})[_0x060b('0x21')](function(_0x55ecd0){if(_0x55ecd0){_0x241e4c=_0x55ecd0[_0x060b('0x53')];if(!_0x1bd09c[_0x060b('0x4e')]['hasOwnProperty'](_0x060b('0xcd'))){_0x1baade[_0x060b('0x31')]=qs[_0x060b('0x31')](_0x1bd09c[_0x060b('0x4e')][_0x060b('0x31')]);_0x1baade[_0x060b('0x30')]=qs[_0x060b('0x30')](_0x1bd09c[_0x060b('0x4e')]['offset']);}return _0x5183de[_0x060b('0x10a')](_0x1baade);}})['then'](function(_0x2a00cb){if(_0x2a00cb){return _0x2a00cb?{'count':_0x241e4c,'rows':_0x2a00cb}:null;}})[_0x060b('0x21')](respondWithResult(_0x313589,null))[_0x060b('0x2b')](handleError(_0x313589,null));};exports['addTeams']=function(_0xef73d8,_0x152b6f){return db[_0x060b('0x47')][_0x060b('0x42')]({'where':{'id':_0xef73d8['params']['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x152b6f,null))[_0x060b('0x21')](function(_0x3cad6d){if(_0x3cad6d){var _0x1c1014=_0x3cad6d['get']({'plain':!![]});return _0x3cad6d[_0x060b('0x10b')](_0xef73d8[_0x060b('0x62')][_0x060b('0x67')],_[_0x060b('0x66')](_0xef73d8['body'],[_0x060b('0x67'),'id'])||{})[_0x060b('0x21')](function(){for(var _0x2e59f6=0x0;_0x2e59f6<_0xef73d8[_0x060b('0x62')][_0x060b('0x67')][_0x060b('0x53')];_0x2e59f6++){var _0xb7f692=[];db['Team']['findOne']({'where':{'id':_0xef73d8[_0x060b('0x62')][_0x060b('0x67')][_0x2e59f6]}})[_0x060b('0x21')](function(_0x4e256a){_0xb7f692['push'](_0x4e256a['getVoiceQueues']()[_0x060b('0x21')](function(_0x34d063){for(var _0x38243f=0x0;_0x38243f<_0x34d063[_0x060b('0x53')];_0x38243f++){_0x34d063[_0x38243f]['setDataValue'](_0x060b('0xa8'),_0x060b('0x10c'));}return _0x34d063;}));_0xb7f692[_0x060b('0x93')](_0x4e256a['getChatQueues']()[_0x060b('0x21')](function(_0x3c2a3d){for(var _0x41cbc3=0x0;_0x41cbc3<_0x3c2a3d[_0x060b('0x53')];_0x41cbc3++){_0x3c2a3d[_0x41cbc3]['setDataValue'](_0x060b('0xa8'),_0x060b('0x10d'));}return _0x3c2a3d;}));_0xb7f692[_0x060b('0x93')](_0x4e256a['getMailQueues']()['then'](function(_0x4c23b2){for(var _0x4c0d48=0x0;_0x4c0d48<_0x4c23b2['length'];_0x4c0d48++){_0x4c23b2[_0x4c0d48]['setDataValue']('channel',_0x060b('0x10e'));}return _0x4c23b2;}));_0xb7f692['push'](_0x4e256a['getSmsQueues']()['then'](function(_0x375059){for(var _0x318129=0x0;_0x318129<_0x375059[_0x060b('0x53')];_0x318129++){_0x375059[_0x318129][_0x060b('0x10f')](_0x060b('0xa8'),_0x060b('0x110'));}return _0x375059;}));_0xb7f692['push'](_0x4e256a['getWhatsappQueues']()['then'](function(_0x2e6581){for(var _0x45f642=0x0;_0x45f642<_0x2e6581[_0x060b('0x53')];_0x45f642++){_0x2e6581[_0x45f642][_0x060b('0x10f')](_0x060b('0xa8'),_0x060b('0x111'));}return _0x2e6581;}));_0xb7f692[_0x060b('0x93')](_0x4e256a['getFaxQueues']()['then'](function(_0x3a4e0d){for(var _0x2c8fb7=0x0;_0x2c8fb7<_0x3a4e0d[_0x060b('0x53')];_0x2c8fb7++){_0x3a4e0d[_0x2c8fb7]['setDataValue'](_0x060b('0xa8'),'Fax');}return _0x3a4e0d;}));_0xb7f692[_0x060b('0x93')](_0x4e256a[_0x060b('0x112')]()['then'](function(_0x1d83d5){for(var _0xbd10c4=0x0;_0xbd10c4<_0x1d83d5['length'];_0xbd10c4++){_0x1d83d5[_0xbd10c4][_0x060b('0x10f')]('channel',_0x060b('0x113'));}return _0x1d83d5;}));return BPromise[_0x060b('0x92')](_0xb7f692);})[_0x060b('0x21')](function(_0x5480d0){var _0x56b349=_[_0x060b('0x114')](_0x5480d0);_0xb7f692=[];return db[_0x060b('0x59')][_0x060b('0x115')](function(_0x2b72ea){for(var _0x4a4eea=0x0;_0x4a4eea<_0x56b349[_0x060b('0x53')];_0x4a4eea++){_0xb7f692[_0x060b('0x93')](_0x56b349[_0x4a4eea][_0x060b('0x116')](_0x1c1014['id']),{'transaction':_0x2b72ea});}return BPromise[_0x060b('0x92')](_0xb7f692)['then'](function(){if(_0x1c1014['online']){return BPromise[_0x060b('0x94')](_[_0x060b('0x3e')](_0x56b349,function(_0x2dbf0c){return _0x2dbf0c[_0x060b('0x117')]('channel')==='Voice';}),function(_0x21e3af){return db[_0x060b('0xb9')][_0x060b('0xba')]({'membername':_0x1c1014['name'],'UserId':_0x1c1014['id'],'queue_name':_0x21e3af[_0x060b('0x43')],'VoiceQueueId':_0x21e3af['id'],'interface':_[_0x060b('0x6d')](_0x1c1014['interface'])?util[_0x060b('0xe7')]('SIP/%s',_0x1c1014[_0x060b('0x43')]):_0x1c1014['interface'],'paused':_0x1c1014[_0x060b('0xaa')]||![],'penalty':_0x1c1014[_0x060b('0xaf')]},{'transaction':_0x2b72ea});});}else{return;}})[_0x060b('0x21')](function(){for(var _0x4748e0=0x0;_0x4748e0<_0x56b349[_0x060b('0x53')];_0x4748e0++){var _0x2642d0=_0x56b349[_0x4748e0][_0x060b('0x117')](_0x060b('0xa8'));var _0x383031=_0x2642d0+_0x060b('0xb3');socket[_0x060b('0xb4')](_0x060b('0x85')+_0x2642d0+_0x060b('0xb5'),{'UserId':_0x1c1014['id'],['queueField']:_0x56b349[_0x4748e0]['id']});}});});});}});}})[_0x060b('0x21')](respondWithStatusCode(_0x152b6f,null))[_0x060b('0x2b')](handleError(_0x152b6f,null));};exports[_0x060b('0x118')]=function(_0x88bc3f,_0x2964e5){return db[_0x060b('0x47')][_0x060b('0xa2')]({'where':{'id':_0x88bc3f[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x2964e5,null))[_0x060b('0x21')](function(_0x3053da){if(_0x3053da){var _0x2dc592=_0x3053da['get']({'plain':!![]});var _0x409d9e=_0x88bc3f[_0x060b('0x4e')]['ids'];return _0x3053da[_0x060b('0x118')](_0x409d9e)['then'](function(){for(var _0x55319b=0x0;_0x55319b<_0x409d9e['length'];_0x55319b++){var _0x25e669=[];db[_0x060b('0x119')][_0x060b('0xa2')]({'where':{'id':_0x409d9e[_0x55319b]}})[_0x060b('0x21')](function(_0x25f97d){_0x25e669[_0x060b('0x93')](_0x25f97d[_0x060b('0x11a')]()[_0x060b('0x21')](function(_0x55c174){for(var _0x2cfd7c=0x0;_0x2cfd7c<_0x55c174[_0x060b('0x53')];_0x2cfd7c++){_0x55c174[_0x2cfd7c][_0x060b('0x10f')](_0x060b('0xa8'),_0x060b('0x10c'));}return _0x55c174;}));_0x25e669[_0x060b('0x93')](_0x25f97d[_0x060b('0x11b')]()[_0x060b('0x21')](function(_0x38abaf){for(var _0x386880=0x0;_0x386880<_0x38abaf[_0x060b('0x53')];_0x386880++){_0x38abaf[_0x386880][_0x060b('0x10f')](_0x060b('0xa8'),_0x060b('0x10d'));}return _0x38abaf;}));_0x25e669[_0x060b('0x93')](_0x25f97d[_0x060b('0x11c')]()[_0x060b('0x21')](function(_0x4b893f){for(var _0x5e9caa=0x0;_0x5e9caa<_0x4b893f['length'];_0x5e9caa++){_0x4b893f[_0x5e9caa][_0x060b('0x10f')](_0x060b('0xa8'),_0x060b('0x10e'));}return _0x4b893f;}));_0x25e669[_0x060b('0x93')](_0x25f97d['getSmsQueues']()['then'](function(_0x181007){for(var _0x229d37=0x0;_0x229d37<_0x181007['length'];_0x229d37++){_0x181007[_0x229d37][_0x060b('0x10f')](_0x060b('0xa8'),_0x060b('0x110'));}return _0x181007;}));_0x25e669[_0x060b('0x93')](_0x25f97d['getWhatsappQueues']()[_0x060b('0x21')](function(_0x5352c1){for(var _0x458801=0x0;_0x458801<_0x5352c1[_0x060b('0x53')];_0x458801++){_0x5352c1[_0x458801][_0x060b('0x10f')](_0x060b('0xa8'),_0x060b('0x111'));}return _0x5352c1;}));_0x25e669[_0x060b('0x93')](_0x25f97d[_0x060b('0x11d')]()['then'](function(_0x2a3f50){for(var _0x517d2b=0x0;_0x517d2b<_0x2a3f50['length'];_0x517d2b++){_0x2a3f50[_0x517d2b][_0x060b('0x10f')](_0x060b('0xa8'),_0x060b('0x11e'));}return _0x2a3f50;}));_0x25e669[_0x060b('0x93')](_0x25f97d[_0x060b('0x112')]()[_0x060b('0x21')](function(_0x40b8c9){for(var _0x34b7c2=0x0;_0x34b7c2<_0x40b8c9[_0x060b('0x53')];_0x34b7c2++){_0x40b8c9[_0x34b7c2]['setDataValue'](_0x060b('0xa8'),_0x060b('0x113'));}return _0x40b8c9;}));return BPromise['all'](_0x25e669);})[_0x060b('0x21')](function(_0x65bbed){var _0x196638=_[_0x060b('0x114')](_0x65bbed);_0x25e669=[];return db[_0x060b('0x59')][_0x060b('0x115')](function(_0x50da2b){for(var _0x100968=0x0;_0x100968<_0x196638['length'];_0x100968++){_0x25e669[_0x060b('0x93')](_0x196638[_0x100968]['removeAgent'](_0x2dc592['id']),{'transaction':_0x50da2b});}return BPromise[_0x060b('0x92')](_0x25e669)[_0x060b('0x21')](function(){if(_0x2dc592['online']){return BPromise[_0x060b('0x94')](_[_0x060b('0x3e')](_0x196638,function(_0x234b2b){return _0x234b2b['getDataValue']('channel')==='Voice';}),function(_0x1e6b77){return db[_0x060b('0xb9')][_0x060b('0x37')]({'where':{'VoiceQueueId':_0x1e6b77['id'],'UserId':_0x2dc592['id']},'transaction':_0x50da2b});});}else{return;}})[_0x060b('0x21')](function(){for(var _0x3af921=0x0;_0x3af921<_0x196638[_0x060b('0x53')];_0x3af921++){var _0x2be883=_0x196638[_0x3af921]['getDataValue'](_0x060b('0xa8'));var _0x425bf8=_0x2be883+_0x060b('0xb3');socket[_0x060b('0xb4')](_0x060b('0x85')+_0x2be883+'Queue:remove',{'UserId':_0x2dc592['id'],['queueField']:_0x196638[_0x3af921]['id']});}});});});}});}})[_0x060b('0x21')](respondWithStatusCode(_0x2964e5,null))[_0x060b('0x2b')](handleError(_0x2964e5,null));};exports[_0x060b('0x11f')]=function(_0x15f12b,_0x10934d,_0x551135){var _0x3951c6={};var _0x13fb6b={};var _0x3a0027;var _0x48fe9a;return db[_0x060b('0x47')][_0x060b('0xa2')]({'where':{'id':_0x15f12b['params']['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x10934d,null))[_0x060b('0x21')](function(_0x2222b3){if(_0x2222b3){_0x3a0027=_0x2222b3;_0x13fb6b[_0x060b('0x4a')]=_[_0x060b('0x4f')](db[_0x060b('0xc9')][_0x060b('0x61')]);_0x13fb6b[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x15f12b[_0x060b('0x4e')]);_0x13fb6b[_0x060b('0x57')]=_[_0x060b('0x50')](_0x13fb6b[_0x060b('0x4a')],_0x13fb6b['query']);_0x3951c6[_0x060b('0x51')]=_[_0x060b('0x50')](_0x13fb6b[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x15f12b['query'][_0x060b('0x52')]));_0x3951c6[_0x060b('0x51')]=_0x3951c6[_0x060b('0x51')][_0x060b('0x53')]?_0x3951c6[_0x060b('0x51')]:_0x13fb6b[_0x060b('0x4a')];_0x3951c6['order']=qs[_0x060b('0x55')](_0x15f12b['query'][_0x060b('0x55')]);_0x3951c6[_0x060b('0x56')]=qs[_0x060b('0x57')](_[_0x060b('0xd2')](_0x15f12b[_0x060b('0x4e')],_0x13fb6b['filters']));if(_0x15f12b[_0x060b('0x4e')][_0x060b('0x3e')]){_0x3951c6[_0x060b('0x56')]=_[_0x060b('0x5c')](_0x3951c6['where'],{'$or':_[_0x060b('0x40')](_0x3951c6[_0x060b('0x51')],function(_0x2f6be7){var _0x13c7d3={};_0x13c7d3[_0x2f6be7]={'$like':'%'+_0x15f12b[_0x060b('0x4e')][_0x060b('0x3e')]+'%'};return _0x13c7d3;})});}_0x3951c6=_['merge']({},_0x3951c6,_0x15f12b['options']);return _0x3a0027['getLists'](_0x3951c6);}})[_0x060b('0x21')](function(_0x3fde47){if(_0x3fde47){_0x48fe9a=_0x3fde47[_0x060b('0x53')];if(!_0x15f12b['query'][_0x060b('0xcc')]('nolimit')){_0x3951c6[_0x060b('0x31')]=qs['limit'](_0x15f12b[_0x060b('0x4e')][_0x060b('0x31')]);_0x3951c6['offset']=qs[_0x060b('0x30')](_0x15f12b[_0x060b('0x4e')][_0x060b('0x30')]);}return _0x3a0027[_0x060b('0x11f')](_0x3951c6);}})[_0x060b('0x21')](function(_0xa578ed){if(_0xa578ed){return _0xa578ed?{'count':_0x48fe9a,'rows':_0xa578ed}:null;}})[_0x060b('0x21')](respondWithResult(_0x10934d,null))['catch'](handleError(_0x10934d,null));};exports[_0x060b('0x120')]=function(_0x282a0c,_0x3254c5,_0x5a3245){var _0x2fa678={};var _0x3577ce={};var _0x151b49;var _0x2f98c6;return db['User']['findOne']({'where':{'id':_0x282a0c[_0x060b('0x63')]['id']}})[_0x060b('0x21')](handleEntityNotFound(_0x3254c5,null))['then'](function(_0x188b2e){if(_0x188b2e){_0x151b49=_0x188b2e;_0x3577ce[_0x060b('0x4a')]=_[_0x060b('0x4f')](db[_0x060b('0x47')]['rawAttributes']);_0x3577ce[_0x060b('0x4e')]=_[_0x060b('0x4f')](_0x282a0c[_0x060b('0x4e')]);_0x3577ce[_0x060b('0x57')]=_[_0x060b('0x50')](_0x3577ce[_0x060b('0x4a')],_0x3577ce['query']);_0x2fa678[_0x060b('0x51')]=_[_0x060b('0x50')](_0x3577ce[_0x060b('0x4a')],qs[_0x060b('0x52')](_0x282a0c[_0x060b('0x4e')][_0x060b('0x52')]));_0x2fa678[_0x060b('0x51')]=_0x2fa678[_0x060b('0x51')][_0x060b('0x53')]?_0x2fa678[_0x060b('0x51')]:_0x3577ce[_0x060b('0x4a')];_0x2fa678[_0x060b('0x54')]=qs[_0x060b('0x55')](_0x282a0c[_0x060b('0x4e')][_0x060b('0x55')]);_0x2fa678[_0x060b('0x56')]=qs[_0x060b('0x57')](_[_0x060b('0xd2')](_0x282a0c[_0x060b('0x4e')],_0x3577ce[_0x060b('0x57')]));if(_0x282a0c[_0x060b('0x4e')][_0x060b('0x3e')]){_0x2fa678[_0x060b('0x56')]=_['merge'](_0x2fa678[_0x060b('0x56')],{'$or':_[_0x060b('0x40')](_0x2fa678['attributes'],function(_0x5d11eb){var _0x54236b={};_0x54236b[_0x5d11eb]={'$like':'%'+_0x282a0c[_0x060b('0x4e')][_0x060b('0x3e')]+'%'};return _0x54236b;})});}_0x2fa678[_0x060b('0x4a')]=db[_0x060b('0x47')];_0x2fa678['as']=_0x060b('0x3b');_0x2fa678=_[_0x060b('0x5c')]({},_0x2fa678,_0x282a0c[_0x060b('0xc8')]);return _0x151b49[_0x060b('0x11a')]({'include':[_0x2fa678]});}})[_0x060b('0x21')](function(_0x409ccd){if(_0x409ccd){var _0x354f02={},_0xe51341=[],_0x390c91=0x0;for(var _0x3a5b81=0x0;_0x3a5b81<_0x409ccd[_0x060b('0x53')];_0x3a5b81+=0x1){for(var _0x2f1250=0x0,_0x2a6f4f;_0x2f1250<_0x409ccd[_0x3a5b81][_0x060b('0x3b')]['length'];_0x2f1250+=0x1){_0x2a6f4f=_0x409ccd[_0x3a5b81]['Agents'][_0x2f1250][_0x060b('0x38')]({'plain':!![]});_0x354f02[_0x2a6f4f['id']]=_0x2a6f4f;}}_0x354f02=_[_0x060b('0x121')](_0x354f02);for(var _0x3e67eb=qs[_0x060b('0x30')](_0x282a0c[_0x060b('0x4e')]['offset']);_0x3e67eb<_0x354f02[_0x060b('0x53')]&&_0xe51341[_0x060b('0x53')]=_0x3d842c){_0x4409b2=_0x3d842c;_0x5bc97f=0xc8;}else{_0x5bc97f=0xce;}_0x22ff38[_0x2c01('0x31')](_0x5bc97f);return _0x22ff38[_0x2c01('0x35')](_0x2c01('0x36'),_0x3e0075+'-'+_0x4409b2+'/'+_0x3d842c)[_0x2c01('0x37')](_0x27b41b);}return null;};}function patchUpdates(_0x17822c){return function(_0x33eaef){try{jsonpatch[_0x2c01('0x38')](_0x33eaef,_0x17822c,!![]);}catch(_0x32450f){return BPromise[_0x2c01('0x39')](_0x32450f);}return _0x33eaef[_0x2c01('0x3a')]();};}function saveUpdates(_0x1d5056,_0x23f66a){return function(_0x42999a){if(_0x42999a){return _0x42999a[_0x2c01('0x3b')](_0x1d5056)[_0x2c01('0x27')](function(_0x10ad6c){return _0x10ad6c;});}return null;};}function removeEntity(_0x450083,_0x101b6f){return function(_0x22f184){if(_0x22f184){return _0x22f184[_0x2c01('0x3c')]()[_0x2c01('0x27')](function(){var _0x342b47=_0x22f184[_0x2c01('0x3d')]({'plain':!![]});if(_0x342b47[_0x2c01('0x3e')]===_0x2c01('0x3f'))return;var _0x2c545b=[{'name':_0x2c01('0x40'),'value':_0x2c01('0x41'),'ignore':!![]},{'name':'Agents','value':_0x2c01('0x42'),'ignore':![]},{'name':_0x2c01('0x43'),'value':_0x2c01('0x44'),'ignore':![]}];var _0x5859a1=_(_0x2c545b)['filter']('ignore')['map'](_0x2c01('0x45'))[_0x2c01('0x45')]();if(_[_0x2c01('0x46')](_0x5859a1,_0x342b47[_0x2c01('0x3e')])){return;}var _0xcaa774=_['find'](_0x2c545b,[_0x2c01('0x45'),_0x342b47[_0x2c01('0x3e')]])[_0x2c01('0x47')];return db[_0x2c01('0x48')][_0x2c01('0x3c')]({'where':{'type':_0xcaa774,'resourceId':_0x342b47['id']}})[_0x2c01('0x27')](function(){return _0x22f184;});})[_0x2c01('0x27')](function(){_0x450083[_0x2c01('0x31')](0xcc)[_0x2c01('0x30')]();});}};}function handleEntityNotFound(_0x118578,_0x499c2b){return function(_0x23a7b0){if(!_0x23a7b0){_0x118578[_0x2c01('0x49')](0x194);}return _0x23a7b0;};}function handleError(_0x25e6c8,_0x2a36d0){_0x2a36d0=_0x2a36d0||0x1f4;return function(_0xad372b){logger['error'](_0xad372b['stack']);if(_0xad372b['name']){delete _0xad372b[_0x2c01('0x47')];}_0x25e6c8[_0x2c01('0x31')](_0x2a36d0)[_0x2c01('0x4a')](_0xad372b);};}exports[_0x2c01('0x4b')]=function(_0x5d6158,_0x26cd28){var _0x507aa2={},_0x37aa52={},_0x438de0={'count':0x0,'rows':[]};var _0x7ec4af=_[_0x2c01('0x4c')](db['User'][_0x2c01('0x4d')],function(_0x158805){return{'name':_0x158805[_0x2c01('0x4e')],'type':_0x158805['type'][_0x2c01('0x4f')]};});_0x37aa52[_0x2c01('0x50')]=_[_0x2c01('0x51')](_['map'](_0x7ec4af,_0x2c01('0x47')),[_0x2c01('0x52'),_0x2c01('0x53')]);_0x37aa52['query']=_[_0x2c01('0x54')](_0x5d6158[_0x2c01('0x55')]);_0x37aa52['filters']=_['intersection'](_0x37aa52['model'],_0x37aa52[_0x2c01('0x55')]);_0x507aa2[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x37aa52[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x5d6158['query']['fields']));_0x507aa2[_0x2c01('0x56')]=_0x507aa2[_0x2c01('0x56')][_0x2c01('0x59')]?_0x507aa2[_0x2c01('0x56')]:_0x37aa52[_0x2c01('0x50')];if(!_0x5d6158[_0x2c01('0x55')][_0x2c01('0x5a')](_0x2c01('0x5b'))){_0x507aa2[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x5d6158[_0x2c01('0x55')][_0x2c01('0x34')]);_0x507aa2['offset']=qs[_0x2c01('0x33')](_0x5d6158[_0x2c01('0x55')][_0x2c01('0x33')]);}_0x507aa2['order']=qs[_0x2c01('0x5c')](_0x5d6158[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x507aa2[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x5d6158['query'],_0x37aa52[_0x2c01('0x5e')]),_0x7ec4af);if(_0x5d6158['query']['filter']){_0x507aa2['where']=_[_0x2c01('0x60')](_0x507aa2[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x7ec4af,function(_0x293478){if(_0x293478[_0x2c01('0x61')]!==_0x2c01('0x62')){return db[_0x2c01('0x63')]['where'](db[_0x2c01('0x63')]['fn'](_0x2c01('0x64'),db[_0x2c01('0x63')][_0x2c01('0x65')](_0x293478[_0x2c01('0x47')])),{'$like':db[_0x2c01('0x63')]['fn'](_0x2c01('0x64'),'%'+_0x5d6158[_0x2c01('0x55')][_0x2c01('0x66')]+'%')});}})});}_0x507aa2=_[_0x2c01('0x60')]({},_0x507aa2,_0x5d6158[_0x2c01('0x67')]);var _0x181326={'where':_0x507aa2[_0x2c01('0x5d')]};return db[_0x2c01('0x68')]['count'](_0x181326)[_0x2c01('0x27')](function(_0x44d668){_0x438de0[_0x2c01('0x32')]=_0x44d668;if(_0x5d6158[_0x2c01('0x55')]['includeAll']){_0x507aa2['include']=[{'all':!![]}];}return db[_0x2c01('0x68')][_0x2c01('0x69')](_0x507aa2);})['then'](function(_0xf265fa){_0x438de0[_0x2c01('0x6a')]=_0xf265fa;return _0x438de0;})[_0x2c01('0x27')](respondWithFilteredResult(_0x26cd28,_0x507aa2))[_0x2c01('0x2f')](handleError(_0x26cd28,null));};exports['show']=function(_0x129a16,_0x28a253){var _0x480458={'raw':![],'where':{'id':_0x129a16[_0x2c01('0x6b')]['id']}},_0x22ab20={};_0x22ab20['model']=_[_0x2c01('0x51')](_[_0x2c01('0x54')](db[_0x2c01('0x68')][_0x2c01('0x4d')]),[_0x2c01('0x52'),'salt']);_0x22ab20['query']=_[_0x2c01('0x54')](_0x129a16['query']);_0x22ab20['filters']=_[_0x2c01('0x57')](_0x22ab20[_0x2c01('0x50')],_0x22ab20[_0x2c01('0x55')]);_0x480458[_0x2c01('0x56')]=_['intersection'](_0x22ab20[_0x2c01('0x50')],qs['fields'](_0x129a16[_0x2c01('0x55')][_0x2c01('0x58')]));_0x480458[_0x2c01('0x56')]=_0x480458[_0x2c01('0x56')][_0x2c01('0x59')]?_0x480458[_0x2c01('0x56')]:_0x22ab20[_0x2c01('0x50')];if(_0x129a16[_0x2c01('0x55')][_0x2c01('0x6c')]){_0x480458[_0x2c01('0x6d')]=[{'all':!![]}];}_0x480458=_[_0x2c01('0x60')]({},_0x480458,_0x129a16[_0x2c01('0x67')]);return db['User'][_0x2c01('0x6e')](_0x480458)[_0x2c01('0x27')](handleEntityNotFound(_0x28a253,null))[_0x2c01('0x27')](respondWithResult(_0x28a253,null))['catch'](handleError(_0x28a253,null));};exports['update']=function(_0xcfec96,_0x869b08){if(_0xcfec96[_0x2c01('0x6f')]['id']){delete _0xcfec96['body']['id'];}delete _0xcfec96[_0x2c01('0x6f')][_0x2c01('0x3e')];return db['User'][_0x2c01('0x6e')]({'where':{'id':_0xcfec96[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x869b08,null))['then'](saveUpdates(_0xcfec96[_0x2c01('0x6f')],null))['then'](respondWithResult(_0x869b08,null))[_0x2c01('0x2f')](handleError(_0x869b08,null));};exports[_0x2c01('0x70')]=function(_0x42dd34,_0x270090){return db[_0x2c01('0x68')]['describe']()[_0x2c01('0x27')](respondWithResult(_0x270090,null))[_0x2c01('0x2f')](handleError(_0x270090,null));};exports[_0x2c01('0x71')]=function(_0x40cf5b,_0x8f8945,_0x4cbeeb){return db[_0x2c01('0x68')]['find']({'where':{'id':_0x40cf5b[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x8f8945,null))[_0x2c01('0x27')](function(_0x41169a){if(_0x41169a){return _0x41169a[_0x2c01('0x71')](_0x40cf5b[_0x2c01('0x6f')][_0x2c01('0x72')],_[_0x2c01('0x73')](_0x40cf5b[_0x2c01('0x6f')],[_0x2c01('0x72'),'id'])||{});}})[_0x2c01('0x27')](respondWithResult(_0x8f8945,null))[_0x2c01('0x2f')](handleError(_0x8f8945,null));};function validateUser(_0x2212f9){return new BPromise(function(_0x1aec00,_0x2990f5){if(_0x2212f9[_0x2c01('0x74')])return _0x1aec00(_0x2212f9);return db[_0x2c01('0x75')][_0x2c01('0x76')](0x1)[_0x2c01('0x27')](function(_0x17bfb5){if(_0x17bfb5[_0x2c01('0x77')])authService[_0x2c01('0x78')](_0x2212f9['password']);db[_0x2c01('0x68')]['max'](_0x2c01('0x74'))['then'](function(_0x4e868c){if(_['isNil'](_0x4e868c)){_0x2212f9[_0x2c01('0x74')]=_0x17bfb5[_0x2c01('0x79')]||0x1;return;}if(_[_0x2c01('0x7a')](_0x17bfb5['min_internal'])||_0x17bfb5[_0x2c01('0x79')]===_0x4e868c){_0x2212f9[_0x2c01('0x74')]=_0x4e868c+0x1;return;}if(_0x17bfb5[_0x2c01('0x79')]>_0x4e868c){_0x2212f9[_0x2c01('0x74')]=_0x17bfb5[_0x2c01('0x79')];return;}return db[_0x2c01('0x63')][_0x2c01('0x55')](_0x2c01('0x7b'),{'type':db[_0x2c01('0x63')]['QueryTypes'][_0x2c01('0x7c')]})['then'](function(_0x165f91){if(_0x165f91&&_0x165f91[_0x2c01('0x59')]){for(var _0x3404aa=0x0,_0x4bd3a8=_0x165f91['length'];_0x3404aa<_0x4bd3a8&&_[_0x2c01('0x7a')](_0x2212f9[_0x2c01('0x74')]);_0x3404aa++){if(_0x17bfb5[_0x2c01('0x79')]<=_0x165f91[_0x3404aa]['from']){_0x2212f9['internal']=_0x165f91[_0x3404aa][_0x2c01('0x7d')];}else if(_0x17bfb5[_0x2c01('0x79')]>_0x165f91[_0x3404aa]['from']&&_0x17bfb5[_0x2c01('0x79')]<=_0x165f91[_0x3404aa]['to']){_0x2212f9[_0x2c01('0x74')]=_0x17bfb5[_0x2c01('0x79')];}}}if(_['isNil'](_0x2212f9[_0x2c01('0x74')])){_0x2212f9[_0x2c01('0x74')]=_0x4e868c+0x1;}return _0x1aec00(_0x2212f9);});});})[_0x2c01('0x2f')](function(_0x4b062f){_0x2990f5(_0x4b062f);});});}function updateUser(_0x524699){return new BPromise(function(_0x5df913,_0x25c9fb){try{if(_0x524699['voicemail']){_0x524699[_0x2c01('0x7e')]=_0x524699['internal'];_0x524699[_0x2c01('0x7f')]={'mailbox':_0x524699[_0x2c01('0x74')],'password':_0x524699['password'],'fullname':_0x524699[_0x2c01('0x80')],'email':_0x524699['email']};}if(_0x524699[_0x2c01('0x3e')]===_0x2c01('0x42')){if(!_0x524699[_0x2c01('0x81')])_0x524699[_0x2c01('0x81')]=[_0x2c01('0x82'),_0x2c01('0x83'),_0x2c01('0x84'),_0x2c01('0x85'),_0x2c01('0x86'),_0x2c01('0x87'),_0x2c01('0x88'),_0x2c01('0x89'),_0x2c01('0x8a'),_0x2c01('0x8b'),'109',_0x2c01('0x8c'),'111','114'];}_0x5df913(_0x524699);}catch(_0xda0664){_0x25c9fb(_0xda0664);}});}exports[_0x2c01('0x8d')]=function(_0x267b98,_0x3348d8){if(_0x267b98[_0x2c01('0x41')]['role']===_0x2c01('0x42'))throw new Error(_0x2c01('0x8e'));if(_0x267b98[_0x2c01('0x6f')][_0x2c01('0x3e')]==='user'&&_0x267b98[_0x2c01('0x41')][_0x2c01('0x3e')]!==_0x2c01('0x3f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x267b98['body'][_0x2c01('0x3e')]===_0x2c01('0x3f')&&_0x267b98[_0x2c01('0x41')][_0x2c01('0x3e')]!==_0x2c01('0x3f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x2c01('0x8f')]([_0x267b98[_0x2c01('0x6f')]])['then'](function(){return validateUser(_0x267b98['body']);})[_0x2c01('0x27')](function(_0xf51005){return updateUser(_0xf51005)[_0x2c01('0x27')](function(_0x57614a){if(_0x57614a[_0x2c01('0x3e')]===_0x2c01('0x3f')){_0x57614a[_0x2c01('0x90')]=_0x267b98[_0x2c01('0x41')][_0x2c01('0x90')];delete _0x57614a[_0x2c01('0x91')];}return _0x57614a;});})[_0x2c01('0x27')](function(_0x24f0cf){return db[_0x2c01('0x68')][_0x2c01('0x8d')](_0x24f0cf,{'include':[{'model':db[_0x2c01('0x7f')],'as':_0x2c01('0x7f')}]});})['then'](function(_0x32eee9){if(_0x267b98[_0x2c01('0x6f')][_0x2c01('0x3e')]==='user')return _0x32eee9;if(_0x267b98[_0x2c01('0x41')][_0x2c01('0x3e')]!==_0x2c01('0x41'))return _0x32eee9;return db[_0x2c01('0x92')][_0x2c01('0x6e')]({'where':{'name':_0x32eee9[_0x2c01('0x3e')]==='agent'?'Agents':_0x2c01('0x43'),'userProfileId':_0x267b98[_0x2c01('0x41')][_0x2c01('0x91')]},'raw':!![]})[_0x2c01('0x27')](function(_0xe99331){if(!_0xe99331||_0xe99331[_0x2c01('0x93')]!=0x0)return _0x32eee9;return db[_0x2c01('0x48')][_0x2c01('0x8d')]({'name':_0x32eee9['name'],'resourceId':_0x32eee9['id'],'type':_0xe99331[_0x2c01('0x47')],'sectionId':_0xe99331['id']},{})[_0x2c01('0x27')](function(){return _0x32eee9;});})[_0x2c01('0x2f')](function(_0x296531){logger[_0x2c01('0x2c')](_0x2c01('0x94'),_0x296531);throw _0x296531;});})[_0x2c01('0x27')](respondWithResult(_0x3348d8,0xc9))[_0x2c01('0x2f')](handleError(_0x3348d8,null));};exports['bulkCreate']=function(_0x7731cb,_0xcb8d49){var _0x1d033c=_0x7731cb[_0x2c01('0x6f')];var _0x1fe9a5=[];if(_0x7731cb[_0x2c01('0x41')][_0x2c01('0x3e')]===_0x2c01('0x42'))throw new Error(_0x2c01('0x8e'));if(_[_0x2c01('0x95')](_0x1d033c,['role',_0x2c01('0x41')])&&_0x7731cb[_0x2c01('0x41')][_0x2c01('0x3e')]!=='admin'){throw new Error(_0x2c01('0x96'));}if(_[_0x2c01('0x95')](_0x1d033c,[_0x2c01('0x3e'),_0x2c01('0x3f')])&&_0x7731cb[_0x2c01('0x41')][_0x2c01('0x3e')]!=='admin'){throw new Error(_0x2c01('0x97'));}return licenseUtil[_0x2c01('0x8f')](_0x1d033c)['then'](function(){return validateUser(_0x1d033c[0x0]);})[_0x2c01('0x27')](function(){for(var _0x47352f=0x1;_0x47352f<_0x1d033c['length'];_0x47352f++){var _0x8dac47=_0x1d033c[_0x47352f-0x1]['internal'];if(!_0x1d033c[_0x47352f][_0x2c01('0x74')])_0x1d033c[_0x47352f][_0x2c01('0x74')]=_0x8dac47+0x1;_0x1fe9a5[_0x2c01('0x98')](validateUser(_0x1d033c[_0x47352f]));}return BPromise[_0x2c01('0x99')](_0x1fe9a5);})[_0x2c01('0x27')](function(){_0x1fe9a5=[];for(var _0x357993=0x0;_0x357993<_0x1d033c[_0x2c01('0x59')];_0x357993++){_0x1fe9a5[_0x2c01('0x98')](updateUser(_0x1d033c[_0x357993]));}return BPromise[_0x2c01('0x99')](_0x1fe9a5);})[_0x2c01('0x27')](function(){return BPromise['each'](_0x1d033c,function(_0x4cfe4f){return db['User'][_0x2c01('0x8d')](_0x4cfe4f,{'include':[{'model':db['VoiceMail'],'as':_0x2c01('0x7f')}]})[_0x2c01('0x27')](function(_0x7ce75d){_0x4cfe4f['id']=_0x7ce75d['id'];return _0x4cfe4f;});});})['then'](function(_0x4d03b8){if(_0x7731cb[_0x2c01('0x6f')][_0x2c01('0x3e')]==='user')return _0x4d03b8;if(_0x7731cb[_0x2c01('0x41')][_0x2c01('0x3e')]!=='user')return _0x4d03b8;var _0x47aa39=_[_0x2c01('0x95')](_0x4d03b8,function(_0x34b8e9){return _0x34b8e9[_0x2c01('0x3e')]===_0x2c01('0x42')||_0x34b8e9[_0x2c01('0x3e')]===_0x2c01('0x44');});if(!_0x47aa39)return _0x4d03b8;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x2c01('0x9a'),'Telephones']},'userProfileId':_0x7731cb[_0x2c01('0x41')][_0x2c01('0x91')]},'raw':!![]})[_0x2c01('0x27')](function(_0x3ffa03){if(_[_0x2c01('0x9b')](_0x3ffa03)||!_[_0x2c01('0x95')](_0x3ffa03,[_0x2c01('0x93'),0x0]))return _0x4d03b8;_0x1fe9a5=[];var _0x3b07b1=_(_0x3ffa03)[_0x2c01('0x4c')](function(_0x2cf1bb){if(_0x2cf1bb['autoAssociation']===0x1)return;return _0x2cf1bb[_0x2c01('0x47')]===_0x2c01('0x9a')?_0x2c01('0x42'):_0x2c01('0x44');})[_0x2c01('0x9c')]()['value']();for(var _0x2d6088=0x0;_0x2d6088<_0x4d03b8[_0x2c01('0x59')];_0x2d6088++){if(!_[_0x2c01('0x46')](_0x3b07b1,_0x4d03b8[_0x2d6088][_0x2c01('0x3e')]))return;var _0x1bcc4d=_0x4d03b8[_0x2d6088][_0x2c01('0x3e')]===_0x2c01('0x42')?_0x2c01('0x9a'):_0x2c01('0x43');_0x1fe9a5[_0x2c01('0x98')](db[_0x2c01('0x48')]['create']({'name':_0x4d03b8[_0x2d6088][_0x2c01('0x47')],'resourceId':_0x4d03b8[_0x2d6088]['id'],'type':_0x1bcc4d,'sectionId':_[_0x2c01('0x6e')](_0x3ffa03,[_0x2c01('0x47'),_0x1bcc4d])['id']},{}));}return BPromise[_0x2c01('0x99')](_0x1fe9a5);})[_0x2c01('0x27')](respondWithResult(_0xcb8d49,0xc9))[_0x2c01('0x2f')](handleError(_0xcb8d49,null));});};exports[_0x2c01('0x9d')]=function(_0x1c6c3c,_0x10928a,_0x244f73){if(_0x1c6c3c[_0x2c01('0x6f')]['id']){delete _0x1c6c3c[_0x2c01('0x6f')]['id'];}return db[_0x2c01('0x68')]['find']({'where':{'id':_0x1c6c3c[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](function(_0x36df75){if(!_0x36df75)return null;if(_0x36df75['id']===_0x1c6c3c[_0x2c01('0x41')]['id']){if(!_0x1c6c3c[_0x2c01('0x6f')]['oldPassword']||!_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')]){throw new db[(_0x2c01('0x9f'))]['ValidationError'](_0x2c01('0xa0'));}if(!_0x36df75['authenticate'](_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0xa1')])){throw new db['Sequelize'][(_0x2c01('0xa2'))]('Wrong\x20credentials');}if(_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0xa1')]===_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')]){throw new db[(_0x2c01('0x9f'))]['ValidationError'](_0x2c01('0xa3'));}}else if(_0x1c6c3c[_0x2c01('0x41')][_0x2c01('0x3e')]===_0x2c01('0x3f')){if(!_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')]){throw new db[(_0x2c01('0x9f'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1c6c3c[_0x2c01('0x41')]['role']===_0x2c01('0x41')){if(!_0x1c6c3c['body'][_0x2c01('0x9e')]){throw new db[(_0x2c01('0x9f'))][(_0x2c01('0xa2'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x36df75[_0x2c01('0x3e')]!=='agent'){throw new db[(_0x2c01('0x9f'))]['ValidationError'](_0x2c01('0x8e'));}}else{throw new db['Sequelize'][(_0x2c01('0xa2'))](_0x2c01('0x8e'));}return _0x36df75;})[_0x2c01('0x27')](handleEntityNotFound(_0x10928a,null))[_0x2c01('0x27')](function(_0x317ada){return db['Setting'][_0x2c01('0xa4')]({'attributes':['id',_0x2c01('0x77'),_0x2c01('0xa5'),'passwordHistoryLimit']})[_0x2c01('0x27')](function(_0x447e9f){if(_0x447e9f[_0x2c01('0x77')])authService[_0x2c01('0x78')](_0x1c6c3c[_0x2c01('0x6f')]['newPassword']);if(!_0x447e9f[_0x2c01('0xa5')]||!_0x317ada[_0x2c01('0xa6')])return _0x317ada;authService[_0x2c01('0xa7')](_0x1c6c3c['body'][_0x2c01('0x9e')],_0x317ada[_0x2c01('0xa6')],_0x447e9f['passwordHistoryLimit']);return _0x317ada;})[_0x2c01('0x27')](saveUpdates({'password':_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')],'passwordResetAt':_0x1c6c3c['user']['id']==_0x1c6c3c[_0x2c01('0x6b')]['id']?moment():null,'previousPasswords':authService[_0x2c01('0xa8')](_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')],_0x317ada[_0x2c01('0xa6')])},null));})[_0x2c01('0x27')](respondWithResult(_0x10928a,null))[_0x2c01('0x2f')](handleError(_0x10928a,null));};exports[_0x2c01('0xa9')]=function(_0x5dab81,_0x183a0a,_0x3a8f31){var _0x3e39c2=_0x5dab81[_0x2c01('0x6f')][_0x2c01('0xaa')];return db['User']['find']({'where':{'id':_0x5dab81[_0x2c01('0x6b')]['id']},'attributes':['id',_0x2c01('0x47'),'role','online',_0x2c01('0xab'),_0x2c01('0xac'),_0x2c01('0xad')]})['then'](handleEntityNotFound(_0x183a0a,null))[_0x2c01('0x27')](function(_0x3467ec){if(_0x3467ec){if(!utils[_0x2c01('0xae')](_0x3e39c2)){throw new db[(_0x2c01('0x9f'))][(_0x2c01('0xa2'))]('Unknown\x20channel');}return _0x3467ec[_0x2c01('0xaf')+_[_0x2c01('0xb0')](_0x3e39c2[_0x2c01('0xb1')]())+_0x2c01('0xb2')](_0x5dab81[_0x2c01('0x6f')][_0x2c01('0x72')],{'penalty':_0x5dab81[_0x2c01('0x6f')][_0x2c01('0xb3')]||0x0})[_0x2c01('0xb4')](function(_0x3de5b4){for(var _0x3479e8=0x0;_0x3479e8<_0x5dab81[_0x2c01('0x6f')][_0x2c01('0x72')]['length'];_0x3479e8+=0x1){var _0x201998={'UserId':_0x5dab81[_0x2c01('0x6b')]['id']};_0x201998[_[_0x2c01('0xb0')](_0x3e39c2[_0x2c01('0xb1')]())+_0x2c01('0xb5')]=_0x5dab81[_0x2c01('0x6f')][_0x2c01('0x72')][_0x3479e8];socket['emit'](_0x2c01('0x41')+_[_0x2c01('0xb0')](_0x3e39c2[_0x2c01('0xb1')]())+_0x2c01('0xb6'),_0x201998);}return _0x3de5b4;})['then'](function(){if(_0x3e39c2==='voice'){return db[_0x2c01('0xb7')][_0x2c01('0x69')]({'where':{'id':_0x5dab81[_0x2c01('0x6f')][_0x2c01('0x72')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x2c01('0x27')](function(_0x2be48a){var _0x2229d9=_0x3467ec[_0x2c01('0x3d')]({'plain':!![]});var _0x23f872=[];if(_0x3e39c2===_0x2c01('0xb8')&&_0x2229d9[_0x2c01('0x3e')]===_0x2c01('0x42')&&_0x2229d9['online']){for(var _0x19d6c9=0x0;_0x19d6c9<_0x2be48a['length'];_0x19d6c9+=0x1){_0x23f872[_0x2c01('0x98')]({'membername':_0x2229d9['name'],'UserId':_0x2229d9['id'],'queue_name':_0x2be48a[_0x19d6c9][_0x2c01('0x47')],'VoiceQueueId':_0x2be48a[_0x19d6c9]['id'],'interface':_[_0x2c01('0x7a')](_0x2229d9['interface'])?util[_0x2c01('0xb9')](_0x2c01('0xba'),_0x2229d9['name']):_0x2229d9[_0x2c01('0xad')],'paused':_0x2229d9['voicePause']||![],'penalty':_0x5dab81[_0x2c01('0x6f')][_0x2c01('0xb3')]||0x0});}return BPromise[_0x2c01('0xbb')](_0x23f872,function(_0x5f235d){return db['UserVoiceQueueRt']['upsert'](_0x5f235d);});}return _0x3467ec;});}})[_0x2c01('0x27')](respondWithStatusCode(_0x183a0a,null))[_0x2c01('0x2f')](handleError(_0x183a0a,null));};exports[_0x2c01('0xbc')]=function(_0x37e561,_0x449917,_0xe17e81){var _0x4b4197;return db[_0x2c01('0x68')]['find']({'where':{'id':_0x37e561[_0x2c01('0x6b')]['id']},'attributes':['id',_0x2c01('0x47'),'role']})[_0x2c01('0x27')](handleEntityNotFound(_0x449917,null))[_0x2c01('0x27')](function(_0x444573){if(_0x444573){_0x4b4197=_0x444573;if(!_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')]||!utils['isValidChannel'](_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')])){throw new db[(_0x2c01('0x9f'))][(_0x2c01('0xa2'))](_0x2c01('0xbd'));}return _0x444573[_0x2c01('0xbe')+_[_0x2c01('0xb0')](_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')]['toLowerCase']())+_0x2c01('0xb2')](_0x37e561[_0x2c01('0x55')][_0x2c01('0x72')]);}})[_0x2c01('0x27')](function(_0x3cc30b){for(var _0x5d5d33=0x0;_0x5d5d33<_0x37e561['query'][_0x2c01('0x72')][_0x2c01('0x59')];_0x5d5d33+=0x1){var _0x374137={'UserId':_0x37e561[_0x2c01('0x6b')]['id']};_0x374137[_['capitalize'](_0x37e561[_0x2c01('0x55')]['channel'][_0x2c01('0xb1')]())+_0x2c01('0xb5')]=_0x37e561['query'][_0x2c01('0x72')][_0x5d5d33];socket[_0x2c01('0xbf')](_0x2c01('0x41')+_[_0x2c01('0xb0')](_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')][_0x2c01('0xb1')]())+_0x2c01('0xc0'),_0x374137);}return _0x3cc30b;})[_0x2c01('0x27')](function(){if(_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')]==='voice'){return db[_0x2c01('0xc1')]['destroy']({'where':{'UserId':_0x37e561['params']['id'],'VoiceQueueId':_0x37e561[_0x2c01('0x55')][_0x2c01('0x72')]},'individualHooks':!![]})[_0x2c01('0x27')](function(){return _0x4b4197;});}return _0x4b4197;})[_0x2c01('0x27')](respondWithStatusCode(_0x449917,null))[_0x2c01('0x2f')](handleError(_0x449917,null));};exports['addAvatar']=function(_0x1e1e4d,_0x433f1f,_0x23be7f){_0x1e1e4d[_0x2c01('0x6f')][_0x2c01('0xc2')]=_0x1e1e4d[_0x2c01('0xc3')][_0x2c01('0xc4')];return db[_0x2c01('0x68')][_0x2c01('0x6e')]({'where':{'id':_0x1e1e4d[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x433f1f,null))[_0x2c01('0x27')](saveUpdates(_0x1e1e4d[_0x2c01('0x6f')],null))[_0x2c01('0x27')](respondWithResult(_0x433f1f,null))[_0x2c01('0x2f')](handleError(_0x433f1f,null));};exports[_0x2c01('0xc5')]=function(_0x37b0fb,_0x1a1adb,_0x1930e8){var _0x1fe79c=path[_0x2c01('0xc6')](config['root'],_0x2c01('0xc7'));return db[_0x2c01('0x68')]['find']({'where':{'id':_0x37b0fb[_0x2c01('0x6b')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x2c01('0x27')](handleEntityNotFound(_0x1a1adb,null))['then'](function(_0x1c8cce){if(_0x1c8cce){if(_[_0x2c01('0x7a')](_0x1c8cce[_0x2c01('0xc2')])){return _0x1a1adb['download'](_0x1fe79c);}else{if(!fs[_0x2c01('0xc8')](path[_0x2c01('0xc6')](config[_0x2c01('0xc9')],_0x2c01('0xca'),_0x1c8cce[_0x2c01('0xc2')]))){return _0x1a1adb[_0x2c01('0xcb')](_0x1fe79c);}return _0x1a1adb[_0x2c01('0xcb')](path[_0x2c01('0xc6')](config[_0x2c01('0xc9')],_0x2c01('0xca'),_0x1c8cce['userpic']));}}})[_0x2c01('0x2f')](handleError(_0x1a1adb,null));};exports[_0x2c01('0xcc')]=function(_0x524173,_0xf2106e,_0x43c7a9){var _0x1a9334={};var _0x5e95c9={};var _0x49f924;var _0x54adcd;return db['User'][_0x2c01('0xa4')]({'where':{'id':_0x524173[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0xf2106e,null))[_0x2c01('0x27')](function(_0x248a6a){if(_0x248a6a){_0x49f924=_0x248a6a;_0x5e95c9[_0x2c01('0x50')]=_['keys'](db[_0x2c01('0xcd')][_0x2c01('0x4d')]);_0x5e95c9['query']=_[_0x2c01('0x54')](_0x524173[_0x2c01('0x55')]);_0x5e95c9[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x5e95c9[_0x2c01('0x50')],_0x5e95c9[_0x2c01('0x55')]);_0x1a9334[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x5e95c9[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x524173[_0x2c01('0x55')][_0x2c01('0x58')]));_0x1a9334[_0x2c01('0x56')]=_0x1a9334['attributes'][_0x2c01('0x59')]?_0x1a9334[_0x2c01('0x56')]:_0x5e95c9[_0x2c01('0x50')];_0x1a9334[_0x2c01('0xce')]=qs['sort'](_0x524173[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x1a9334['where']=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x524173[_0x2c01('0x55')],_0x5e95c9[_0x2c01('0x5e')]));if(_0x524173[_0x2c01('0x55')]['filter']){_0x1a9334[_0x2c01('0x5d')]=_['merge'](_0x1a9334[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x1a9334[_0x2c01('0x56')],function(_0x4941ec){var _0x2f49c0={};_0x2f49c0[_0x4941ec]={'$like':'%'+_0x524173[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x2f49c0;})});}_0x1a9334=_['merge']({},_0x1a9334,_0x524173[_0x2c01('0x67')]);return _0x49f924[_0x2c01('0xcc')](_0x1a9334);}})[_0x2c01('0x27')](function(_0x4c76f5){if(_0x4c76f5){_0x54adcd=_0x4c76f5['length'];if(_0x524173[_0x2c01('0x55')][_0x2c01('0x5a')](_0x2c01('0x6c'))){_0x1a9334[_0x2c01('0x6d')]=[{'model':db[_0x2c01('0xcf')],'as':_0x2c01('0xd0'),'required':![]},{'model':db[_0x2c01('0xd1')],'as':'Tags','attributes':['id',_0x2c01('0x47'),_0x2c01('0xd2')],'where':_0x524173[_0x2c01('0x55')][_0x2c01('0xd3')]?{'id':_0x524173[_0x2c01('0x55')][_0x2c01('0xd3')]}:undefined,'required':_0x524173['query'][_0x2c01('0xd3')]?!![]:![]}];}if(!_0x524173[_0x2c01('0x55')]['hasOwnProperty'](_0x2c01('0x5b'))){_0x1a9334[_0x2c01('0x34')]=qs['limit'](_0x524173[_0x2c01('0x55')]['limit']);_0x1a9334[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x524173[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x49f924[_0x2c01('0xcc')](_0x1a9334);}})[_0x2c01('0x27')](function(_0x7d8783){if(_0x7d8783){return _0x7d8783?{'count':_0x54adcd,'rows':_0x7d8783}:null;}})['then'](respondWithResult(_0xf2106e,null))[_0x2c01('0x2f')](handleError(_0xf2106e,null));};exports[_0x2c01('0xd4')]=function(_0x34020f,_0x2bf59,_0x3ebafb){var _0x5d5b0f;var _0x5ca5d0;var _0x1a80bb={};var _0x462267;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x34020f[_0x2c01('0x6b')]['id']},'attributes':['id','name',_0x2c01('0x3e')]})[_0x2c01('0x27')](handleEntityNotFound(_0x2bf59,null))[_0x2c01('0x27')](function(_0x5663bb){if(!utils[_0x2c01('0xae')](_0x34020f['query'][_0x2c01('0xaa')])){throw new db[(_0x2c01('0x9f'))][(_0x2c01('0xa2'))](_0x2c01('0xbd'));}_0x5d5b0f=_0x5663bb;var _0xfd16f1={};_0xfd16f1['model']=_[_0x2c01('0x54')](db[_[_0x2c01('0xb0')](_0x34020f[_0x2c01('0x55')][_0x2c01('0xaa')])+_0x2c01('0xd5')][_0x2c01('0x4d')]);_0xfd16f1[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x34020f['query']);_0xfd16f1[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0xfd16f1[_0x2c01('0x50')],_0xfd16f1[_0x2c01('0x55')]);_0x1a80bb[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0xfd16f1['model'],qs[_0x2c01('0x58')](_0x34020f['query']['fields']));_0x1a80bb['attributes']=_0x1a80bb[_0x2c01('0x56')][_0x2c01('0x59')]?_0x1a80bb[_0x2c01('0x56')]:_0xfd16f1[_0x2c01('0x50')];_0x1a80bb[_0x2c01('0xce')]=qs['sort'](_0x34020f[_0x2c01('0x55')]['sort']);_0x1a80bb[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x34020f[_0x2c01('0x55')],_0xfd16f1[_0x2c01('0x5e')]));if(_0x34020f[_0x2c01('0x55')]['filter']){_0x1a80bb[_0x2c01('0x5d')]=_['merge'](_0x1a80bb['where'],{'$or':_[_0x2c01('0x4c')](_0x1a80bb[_0x2c01('0x56')],function(_0x20cbbf){var _0x5b751f={};_0x5b751f[_0x20cbbf]={'$like':'%'+_0x34020f[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x5b751f;})});}_0x1a80bb=_['merge']({},_0x1a80bb,_0x34020f['options']);switch(_0x5d5b0f[_0x2c01('0x3e')]){case _0x2c01('0x3f'):return db[_[_0x2c01('0xb0')](_0x34020f[_0x2c01('0x55')][_0x2c01('0xaa')])+_0x2c01('0xd5')]['findAll'](_0x1a80bb);case _0x2c01('0x41'):case _0x2c01('0x42'):return _0x5d5b0f[_0x2c01('0x3d')+_[_0x2c01('0xb0')](_0x34020f[_0x2c01('0x55')][_0x2c01('0xaa')])+_0x2c01('0xb2')](_0x1a80bb);default:throw new db[(_0x2c01('0x9f'))]['ValidationError']('Unknown\x20role');}})[_0x2c01('0x27')](function(_0x231947){_0x462267=_0x231947[_0x2c01('0x59')];if(!_0x34020f[_0x2c01('0x55')][_0x2c01('0x5a')](_0x2c01('0x5b'))){_0x1a80bb[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x34020f[_0x2c01('0x55')][_0x2c01('0x34')]);_0x1a80bb[_0x2c01('0x33')]=qs['offset'](_0x34020f[_0x2c01('0x55')][_0x2c01('0x33')]);}switch(_0x5d5b0f[_0x2c01('0x3e')]){case _0x2c01('0x3f'):return db[_[_0x2c01('0xb0')](_0x34020f['query'][_0x2c01('0xaa')])+_0x2c01('0xd5')][_0x2c01('0x69')](_0x1a80bb);case _0x2c01('0x41'):case'agent':return _0x5d5b0f['get'+_[_0x2c01('0xb0')](_0x34020f[_0x2c01('0x55')][_0x2c01('0xaa')])+_0x2c01('0xb2')](_0x1a80bb);}})[_0x2c01('0x27')](function(_0x1ee115){return{'count':_0x462267,'rows':_0x1ee115};})['then'](respondWithResult(_0x2bf59,null))[_0x2c01('0x2f')](handleError(_0x2bf59,null));};exports[_0x2c01('0xd6')]=function(_0xbca968,_0x28d3a6,_0x6788ef){var _0x5d2daa={};var _0x4b08b8={};var _0xeab796;var _0x5a2daa;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0xbca968[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x28d3a6,null))[_0x2c01('0x27')](function(_0x21c648){if(_0x21c648){_0xeab796=_0x21c648;_0x4b08b8['model']=_[_0x2c01('0x54')](db[_0x2c01('0xc1')][_0x2c01('0x4d')]);_0x4b08b8[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0xbca968[_0x2c01('0x55')]);_0x4b08b8['filters']=_[_0x2c01('0x57')](_0x4b08b8[_0x2c01('0x50')],_0x4b08b8[_0x2c01('0x55')]);_0x5d2daa[_0x2c01('0x56')]=_['intersection'](_0x4b08b8[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0xbca968[_0x2c01('0x55')][_0x2c01('0x58')]));_0x5d2daa[_0x2c01('0x56')]=_0x5d2daa[_0x2c01('0x56')][_0x2c01('0x59')]?_0x5d2daa['attributes']:_0x4b08b8[_0x2c01('0x50')];_0x5d2daa['order']=qs['sort'](_0xbca968[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x5d2daa[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0xbca968[_0x2c01('0x55')],_0x4b08b8['filters']));if(_0xbca968[_0x2c01('0x55')][_0x2c01('0x66')]){_0x5d2daa[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x5d2daa[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x5d2daa[_0x2c01('0x56')],function(_0x4570e3){var _0x3496d0={};_0x3496d0[_0x4570e3]={'$like':'%'+_0xbca968['query']['filter']+'%'};return _0x3496d0;})});}_0x5d2daa=_['merge']({},_0x5d2daa,_0xbca968[_0x2c01('0x67')]);return _0xeab796[_0x2c01('0xd6')](_0x5d2daa);}})['then'](function(_0x339af4){if(_0x339af4){_0x5a2daa=_0x339af4[_0x2c01('0x59')];if(!_0xbca968[_0x2c01('0x55')][_0x2c01('0x5a')]('nolimit')){_0x5d2daa[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0xbca968['query'][_0x2c01('0x34')]);_0x5d2daa['offset']=qs[_0x2c01('0x33')](_0xbca968[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0xeab796['getVoiceQueuesRt'](_0x5d2daa);}})[_0x2c01('0x27')](function(_0x329da3){if(_0x329da3){return _0x329da3?{'count':_0x5a2daa,'rows':_0x329da3}:null;}})[_0x2c01('0x27')](respondWithResult(_0x28d3a6,null))[_0x2c01('0x2f')](handleError(_0x28d3a6,null));};exports[_0x2c01('0xd7')]=function(_0x4951ef,_0x1ce93b,_0x21d6a1){var _0x530ee4={};var _0x29b6cd={};var _0x382dd8;var _0x1859fd;return db[_0x2c01('0x68')]['findOne']({'where':{'id':_0x4951ef[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x1ce93b,null))['then'](function(_0x3119a9){if(_0x3119a9){_0x382dd8=_0x3119a9;_0x29b6cd[_0x2c01('0x50')]=_['keys'](db[_0x2c01('0xd8')][_0x2c01('0x4d')]);_0x29b6cd[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x4951ef[_0x2c01('0x55')]);_0x29b6cd[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x29b6cd[_0x2c01('0x50')],_0x29b6cd[_0x2c01('0x55')]);_0x530ee4['attributes']=_[_0x2c01('0x57')](_0x29b6cd['model'],qs['fields'](_0x4951ef[_0x2c01('0x55')][_0x2c01('0x58')]));_0x530ee4[_0x2c01('0x56')]=_0x530ee4[_0x2c01('0x56')][_0x2c01('0x59')]?_0x530ee4[_0x2c01('0x56')]:_0x29b6cd[_0x2c01('0x50')];_0x530ee4[_0x2c01('0xce')]=qs['sort'](_0x4951ef['query']['sort']);_0x530ee4[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_['pick'](_0x4951ef[_0x2c01('0x55')],_0x29b6cd['filters']));if(_0x4951ef['query']['filter']){_0x530ee4[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x530ee4['where'],{'$or':_[_0x2c01('0x4c')](_0x530ee4['attributes'],function(_0x3dfcff){var _0x423245={};_0x423245[_0x3dfcff]={'$like':'%'+_0x4951ef[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x423245;})});}_0x530ee4=_[_0x2c01('0x60')]({},_0x530ee4,_0x4951ef[_0x2c01('0x67')]);return _0x382dd8[_0x2c01('0xd7')](_0x530ee4);}})[_0x2c01('0x27')](function(_0x4fdedc){if(_0x4fdedc){_0x1859fd=_0x4fdedc[_0x2c01('0x59')];if(!_0x4951ef['query']['hasOwnProperty'](_0x2c01('0x5b'))){_0x530ee4[_0x2c01('0x34')]=qs['limit'](_0x4951ef[_0x2c01('0x55')][_0x2c01('0x34')]);_0x530ee4[_0x2c01('0x33')]=qs['offset'](_0x4951ef[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x382dd8['getGroups'](_0x530ee4);}})['then'](function(_0x577290){if(_0x577290){return _0x577290?{'count':_0x1859fd,'rows':_0x577290}:null;}})[_0x2c01('0x27')](respondWithResult(_0x1ce93b,null))[_0x2c01('0x2f')](handleError(_0x1ce93b,null));};exports['getRecordings']=function(_0x1a1f84,_0x520922,_0x52ba26){var _0xba5436={'raw':!![],'where':{}};var _0x4f204c={};var _0x171f93={'count':0x0,'rows':[]};return db['User'][_0x2c01('0xa4')]({'where':{'id':_0x1a1f84[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x520922,null))[_0x2c01('0x27')](function(_0x11b9b3){if(_0x11b9b3){_0x4f204c[_0x2c01('0x50')]=_[_0x2c01('0x54')](db['VoiceRecording'][_0x2c01('0x4d')]);_0x4f204c[_0x2c01('0x55')]=_['keys'](_0x1a1f84[_0x2c01('0x55')]);_0x4f204c['filters']=_['intersection'](_0x4f204c['model'],_0x4f204c[_0x2c01('0x55')]);_0xba5436['attributes']=_[_0x2c01('0x57')](_0x4f204c['model'],qs[_0x2c01('0x58')](_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x58')]));_0xba5436[_0x2c01('0x56')]=_0xba5436[_0x2c01('0x56')][_0x2c01('0x59')]?_0xba5436[_0x2c01('0x56')]:_0x4f204c[_0x2c01('0x50')];if(!_0x1a1f84['query'][_0x2c01('0x5a')]('nolimit')){_0xba5436['limit']=qs[_0x2c01('0x34')](_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x34')]);_0xba5436['offset']=qs[_0x2c01('0x33')](_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x33')]);}_0xba5436['order']=qs[_0x2c01('0x5c')](_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x5c')]);_0xba5436[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x1a1f84[_0x2c01('0x55')],_0x4f204c[_0x2c01('0x5e')]));_0xba5436[_0x2c01('0x5d')][_0x2c01('0xd9')]=_0x11b9b3['id'];if(_0x1a1f84[_0x2c01('0x55')]['filter']){_0xba5436[_0x2c01('0x5d')]=_['merge'](_0xba5436[_0x2c01('0x5d')],{'$or':_['map'](_0xba5436[_0x2c01('0x56')],function(_0x2d2e90){var _0x3211af={};_0x3211af[_0x2d2e90]={'$like':'%'+_0x1a1f84[_0x2c01('0x55')]['filter']+'%'};return _0x3211af;})});}_0xba5436=_[_0x2c01('0x60')]({},_0xba5436,_0x1a1f84['options']);return db[_0x2c01('0xda')]['count']({'where':_0xba5436['where']})['then'](function(_0x5f1eb3){_0x171f93['count']=_0x5f1eb3;if(_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x6c')]){_0xba5436['include']=[{'all':!![]}];}return db[_0x2c01('0xda')][_0x2c01('0x69')](_0xba5436);})[_0x2c01('0x27')](function(_0x400287){_0x171f93[_0x2c01('0x6a')]=_0x400287;return _0x171f93;});}})[_0x2c01('0x27')](respondWithFilteredResult(_0x520922,_0xba5436))[_0x2c01('0x2f')](handleError(_0x520922,null));};exports[_0x2c01('0xdb')]=function(_0x388f1b,_0x5f2d1b,_0x2ecd19){var _0xaa997={'raw':!![],'where':{}};var _0x930e8e={};var _0x198697={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x388f1b[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x5f2d1b,null))[_0x2c01('0x27')](function(_0x4d34ee){if(_0x4d34ee){_0x930e8e[_0x2c01('0x50')]=_[_0x2c01('0x54')](db['ScreenRecording'][_0x2c01('0x4d')]);_0x930e8e[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x388f1b[_0x2c01('0x55')]);_0x930e8e[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x930e8e[_0x2c01('0x50')],_0x930e8e[_0x2c01('0x55')]);_0xaa997[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x930e8e[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x388f1b['query']['fields']));_0xaa997[_0x2c01('0x56')]=_0xaa997['attributes'][_0x2c01('0x59')]?_0xaa997[_0x2c01('0x56')]:_0x930e8e[_0x2c01('0x50')];if(!_0x388f1b['query']['hasOwnProperty'](_0x2c01('0x5b'))){_0xaa997[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x388f1b[_0x2c01('0x55')][_0x2c01('0x34')]);_0xaa997['offset']=qs['offset'](_0x388f1b[_0x2c01('0x55')][_0x2c01('0x33')]);}_0xaa997[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x388f1b['query'][_0x2c01('0x5c')]);_0xaa997['where']=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x388f1b[_0x2c01('0x55')],_0x930e8e[_0x2c01('0x5e')]));_0xaa997[_0x2c01('0x5d')][_0x2c01('0xd9')]=_0x4d34ee['id'];if(_0x388f1b['query'][_0x2c01('0x66')]){_0xaa997[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0xaa997[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0xaa997['attributes'],function(_0x568b50){var _0x409e18={};_0x409e18[_0x568b50]={'$like':'%'+_0x388f1b[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x409e18;})});}_0xaa997=_[_0x2c01('0x60')]({},_0xaa997,_0x388f1b[_0x2c01('0x67')]);return db['ScreenRecording'][_0x2c01('0x32')]({'where':_0xaa997[_0x2c01('0x5d')]})[_0x2c01('0x27')](function(_0x271bb6){_0x198697[_0x2c01('0x32')]=_0x271bb6;if(_0x388f1b['query']['includeAll']){_0xaa997[_0x2c01('0x6d')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0xaa997);})['then'](function(_0x3ed2b2){_0x198697[_0x2c01('0x6a')]=_0x3ed2b2;return _0x198697;});}})[_0x2c01('0x27')](respondWithFilteredResult(_0x5f2d1b,_0xaa997))['catch'](handleError(_0x5f2d1b,null));};exports['getChatInteractions']=function(_0xc1ec38,_0xbac2d6,_0x23a6ff){var _0x5d0de7={};var _0x4daca8={};var _0x3a95e1;var _0x15671e;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0xc1ec38[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0xbac2d6,null))[_0x2c01('0x27')](function(_0x5c1baf){if(_0x5c1baf){_0x3a95e1=_0x5c1baf;_0x4daca8[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0xdc')]['rawAttributes']);_0x4daca8['query']=_['keys'](_0xc1ec38['query']);_0x4daca8[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x4daca8[_0x2c01('0x50')],_0x4daca8[_0x2c01('0x55')]);_0x5d0de7[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x4daca8[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0xc1ec38[_0x2c01('0x55')][_0x2c01('0x58')]));_0x5d0de7['attributes']=_0x5d0de7['attributes'][_0x2c01('0x59')]?_0x5d0de7[_0x2c01('0x56')]:_0x4daca8[_0x2c01('0x50')];_0x5d0de7['order']=qs['sort'](_0xc1ec38['query'][_0x2c01('0x5c')]);_0x5d0de7[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0xc1ec38[_0x2c01('0x55')],_0x4daca8['filters']));if(_0xc1ec38['query']['filter']){_0x5d0de7['where']=_[_0x2c01('0x60')](_0x5d0de7[_0x2c01('0x5d')],{'$or':_['map'](_0x5d0de7[_0x2c01('0x56')],function(_0x30aa64){var _0xbdbed4={};_0xbdbed4[_0x30aa64]={'$like':'%'+_0xc1ec38['query'][_0x2c01('0x66')]+'%'};return _0xbdbed4;})});}_0x5d0de7=_[_0x2c01('0x60')]({},_0x5d0de7,_0xc1ec38[_0x2c01('0x67')]);return _0x3a95e1[_0x2c01('0xdd')](_0x5d0de7);}})[_0x2c01('0x27')](function(_0x2d9c5e){if(_0x2d9c5e){_0x15671e=_0x2d9c5e[_0x2c01('0x59')];if(!_0xc1ec38[_0x2c01('0x55')]['hasOwnProperty'](_0x2c01('0x5b'))){_0x5d0de7[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0xc1ec38['query'][_0x2c01('0x34')]);_0x5d0de7['offset']=qs['offset'](_0xc1ec38[_0x2c01('0x55')]['offset']);}return _0x3a95e1['getChatInteractions'](_0x5d0de7);}})[_0x2c01('0x27')](function(_0x411f60){if(_0x411f60){return _0x411f60?{'count':_0x15671e,'rows':_0x411f60}:null;}})[_0x2c01('0x27')](respondWithResult(_0xbac2d6,null))[_0x2c01('0x2f')](handleError(_0xbac2d6,null));};exports[_0x2c01('0xde')]=function(_0x24d36e,_0xc81954,_0x3b9d23){var _0x121f5c={};var _0x17cb50={};var _0x5119eb;var _0x211f52;return db[_0x2c01('0x68')]['findOne']({'where':{'id':_0x24d36e[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0xc81954,null))[_0x2c01('0x27')](function(_0x58b3a1){if(_0x58b3a1){_0x5119eb=_0x58b3a1;_0x17cb50[_0x2c01('0x50')]=_[_0x2c01('0x54')](db['OpenchannelInteraction'][_0x2c01('0x4d')]);_0x17cb50[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x24d36e[_0x2c01('0x55')]);_0x17cb50['filters']=_[_0x2c01('0x57')](_0x17cb50[_0x2c01('0x50')],_0x17cb50['query']);_0x121f5c['attributes']=_[_0x2c01('0x57')](_0x17cb50[_0x2c01('0x50')],qs['fields'](_0x24d36e[_0x2c01('0x55')][_0x2c01('0x58')]));_0x121f5c[_0x2c01('0x56')]=_0x121f5c[_0x2c01('0x56')]['length']?_0x121f5c[_0x2c01('0x56')]:_0x17cb50['model'];_0x121f5c[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x24d36e[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x121f5c[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x24d36e[_0x2c01('0x55')],_0x17cb50[_0x2c01('0x5e')]));if(_0x24d36e[_0x2c01('0x55')][_0x2c01('0x66')]){_0x121f5c['where']=_[_0x2c01('0x60')](_0x121f5c[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x121f5c[_0x2c01('0x56')],function(_0x31f819){var _0x10d57a={};_0x10d57a[_0x31f819]={'$like':'%'+_0x24d36e[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x10d57a;})});}_0x121f5c=_['merge']({},_0x121f5c,_0x24d36e[_0x2c01('0x67')]);return _0x5119eb[_0x2c01('0xde')](_0x121f5c);}})[_0x2c01('0x27')](function(_0x34ba2a){if(_0x34ba2a){_0x211f52=_0x34ba2a[_0x2c01('0x59')];if(!_0x24d36e[_0x2c01('0x55')]['hasOwnProperty']('nolimit')){_0x121f5c[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x24d36e[_0x2c01('0x55')][_0x2c01('0x34')]);_0x121f5c[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x24d36e[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x5119eb[_0x2c01('0xde')](_0x121f5c);}})[_0x2c01('0x27')](function(_0x10f6db){if(_0x10f6db){return _0x10f6db?{'count':_0x211f52,'rows':_0x10f6db}:null;}})['then'](respondWithResult(_0xc81954,null))[_0x2c01('0x2f')](handleError(_0xc81954,null));};exports[_0x2c01('0xdf')]=function(_0x535862,_0x2ea8c3,_0x2ecd6c){var _0x3716ee={'raw':!![],'where':{}};var _0x43ee77={};var _0x587bbb={'count':0x0,'rows':[]};return db['User'][_0x2c01('0xa4')]({'where':{'id':_0x535862[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x2ea8c3,null))['then'](function(_0x3524d1){if(_0x3524d1){_0x43ee77[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0xe0')][_0x2c01('0x4d')]);_0x43ee77[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x535862['query']);_0x43ee77[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x43ee77[_0x2c01('0x50')],_0x43ee77[_0x2c01('0x55')]);_0x3716ee['attributes']=_[_0x2c01('0x57')](_0x43ee77[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x535862['query'][_0x2c01('0x58')]));_0x3716ee[_0x2c01('0x56')]=_0x3716ee[_0x2c01('0x56')]['length']?_0x3716ee['attributes']:_0x43ee77[_0x2c01('0x50')];if(!_0x535862[_0x2c01('0x55')]['hasOwnProperty']('nolimit')){_0x3716ee[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x535862[_0x2c01('0x55')]['limit']);_0x3716ee[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x535862[_0x2c01('0x55')][_0x2c01('0x33')]);}_0x3716ee[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x535862['query']['sort']);_0x3716ee[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x535862['query'],_0x43ee77[_0x2c01('0x5e')]));_0x3716ee[_0x2c01('0x5d')][_0x2c01('0xd9')]=_0x3524d1['id'];if(_0x535862[_0x2c01('0x55')]['filter']){_0x3716ee[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x3716ee[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x3716ee[_0x2c01('0x56')],function(_0x326c94){var _0x4593d8={};_0x4593d8[_0x326c94]={'$like':'%'+_0x535862[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x4593d8;})});}_0x3716ee=_[_0x2c01('0x60')]({},_0x3716ee,_0x535862[_0x2c01('0x67')]);return db['MailInteraction'][_0x2c01('0x32')]({'where':_0x3716ee[_0x2c01('0x5d')]})[_0x2c01('0x27')](function(_0x5f2665){_0x587bbb[_0x2c01('0x32')]=_0x5f2665;if(_0x535862['query'][_0x2c01('0x6c')]){_0x3716ee['include']=[{'all':!![]}];}return db[_0x2c01('0xe0')]['findAll'](_0x3716ee);})['then'](function(_0x4dd5ec){_0x587bbb[_0x2c01('0x6a')]=_0x4dd5ec;return _0x587bbb;});}})[_0x2c01('0x27')](respondWithFilteredResult(_0x2ea8c3,_0x3716ee))[_0x2c01('0x2f')](handleError(_0x2ea8c3,null));};exports[_0x2c01('0xe1')]=function(_0x2f5a2e,_0x48b1ab,_0x30c40a){var _0xfe373e={};var _0x21aa99={};var _0x274315;var _0x3327a0;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x2f5a2e[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x48b1ab,null))[_0x2c01('0x27')](function(_0x208900){if(_0x208900){_0x274315=_0x208900;_0x21aa99[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0xe2')]['rawAttributes']);_0x21aa99[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x2f5a2e[_0x2c01('0x55')]);_0x21aa99[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x21aa99[_0x2c01('0x50')],_0x21aa99[_0x2c01('0x55')]);_0xfe373e['attributes']=_['intersection'](_0x21aa99[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x2f5a2e['query'][_0x2c01('0x58')]));_0xfe373e[_0x2c01('0x56')]=_0xfe373e[_0x2c01('0x56')][_0x2c01('0x59')]?_0xfe373e[_0x2c01('0x56')]:_0x21aa99[_0x2c01('0x50')];_0xfe373e[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x5c')]);_0xfe373e[_0x2c01('0x5d')]=qs['filters'](_['pick'](_0x2f5a2e[_0x2c01('0x55')],_0x21aa99['filters']));if(_0x2f5a2e['query']['filter']){_0xfe373e[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0xfe373e[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0xfe373e[_0x2c01('0x56')],function(_0x542aa5){var _0x4cde04={};_0x4cde04[_0x542aa5]={'$like':'%'+_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x4cde04;})});}_0xfe373e=_[_0x2c01('0x60')]({},_0xfe373e,_0x2f5a2e[_0x2c01('0x67')]);return _0x274315[_0x2c01('0xe1')](_0xfe373e);}})[_0x2c01('0x27')](function(_0x8defae){if(_0x8defae){_0x3327a0=_0x8defae[_0x2c01('0x59')];if(!_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x5a')](_0x2c01('0x5b'))){_0xfe373e[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x34')]);_0xfe373e['offset']=qs[_0x2c01('0x33')](_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x274315[_0x2c01('0xe1')](_0xfe373e);}})[_0x2c01('0x27')](function(_0x28e065){if(_0x28e065){return _0x28e065?{'count':_0x3327a0,'rows':_0x28e065}:null;}})[_0x2c01('0x27')](respondWithResult(_0x48b1ab,null))[_0x2c01('0x2f')](handleError(_0x48b1ab,null));};exports[_0x2c01('0xe3')]=function(_0x29728a,_0x43770b,_0x3ad0c8){var _0x3eb4ca={};var _0x1c8131={};var _0x57b3e7;var _0x307bdc;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x29728a[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x43770b,null))['then'](function(_0x333f1b){if(_0x333f1b){_0x57b3e7=_0x333f1b;_0x1c8131['model']=_['keys'](db[_0x2c01('0xe4')][_0x2c01('0x4d')]);_0x1c8131[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x29728a[_0x2c01('0x55')]);_0x1c8131[_0x2c01('0x5e')]=_['intersection'](_0x1c8131[_0x2c01('0x50')],_0x1c8131['query']);_0x3eb4ca[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x1c8131[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x29728a[_0x2c01('0x55')][_0x2c01('0x58')]));_0x3eb4ca[_0x2c01('0x56')]=_0x3eb4ca[_0x2c01('0x56')][_0x2c01('0x59')]?_0x3eb4ca['attributes']:_0x1c8131['model'];_0x3eb4ca[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x29728a[_0x2c01('0x55')]['sort']);_0x3eb4ca[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x29728a['query'],_0x1c8131['filters']));if(_0x29728a[_0x2c01('0x55')][_0x2c01('0x66')]){_0x3eb4ca[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x3eb4ca[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x3eb4ca[_0x2c01('0x56')],function(_0x1d6daa){var _0x21b6b6={};_0x21b6b6[_0x1d6daa]={'$like':'%'+_0x29728a[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x21b6b6;})});}_0x3eb4ca=_[_0x2c01('0x60')]({},_0x3eb4ca,_0x29728a[_0x2c01('0x67')]);return _0x57b3e7[_0x2c01('0xe3')](_0x3eb4ca);}})['then'](function(_0x186553){if(_0x186553){_0x307bdc=_0x186553[_0x2c01('0x59')];if(!_0x29728a[_0x2c01('0x55')][_0x2c01('0x5a')]('nolimit')){_0x3eb4ca[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x29728a[_0x2c01('0x55')]['limit']);_0x3eb4ca[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x29728a[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x57b3e7['getFaxInteractions'](_0x3eb4ca);}})[_0x2c01('0x27')](function(_0x5faed0){if(_0x5faed0){return _0x5faed0?{'count':_0x307bdc,'rows':_0x5faed0}:null;}})['then'](respondWithResult(_0x43770b,null))[_0x2c01('0x2f')](handleError(_0x43770b,null));};exports['getWhatsappInteractions']=function(_0x33e86f,_0x55f7e9,_0x1e031e){var _0x23a223={};var _0x1d7cdd={};var _0x1ef5ea;var _0x25fd18;return db[_0x2c01('0x68')]['findOne']({'where':{'id':_0x33e86f[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x55f7e9,null))[_0x2c01('0x27')](function(_0xaf577){if(_0xaf577){_0x1ef5ea=_0xaf577;_0x1d7cdd['model']=_['keys'](db[_0x2c01('0xe5')]['rawAttributes']);_0x1d7cdd[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x33e86f['query']);_0x1d7cdd[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x1d7cdd[_0x2c01('0x50')],_0x1d7cdd[_0x2c01('0x55')]);_0x23a223[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x1d7cdd[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x33e86f[_0x2c01('0x55')][_0x2c01('0x58')]));_0x23a223['attributes']=_0x23a223[_0x2c01('0x56')]['length']?_0x23a223['attributes']:_0x1d7cdd['model'];_0x23a223[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x33e86f['query'][_0x2c01('0x5c')]);_0x23a223['where']=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x33e86f[_0x2c01('0x55')],_0x1d7cdd['filters']));if(_0x33e86f['query'][_0x2c01('0x66')]){_0x23a223[_0x2c01('0x5d')]=_['merge'](_0x23a223[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x23a223[_0x2c01('0x56')],function(_0x4931d7){var _0x2e8c35={};_0x2e8c35[_0x4931d7]={'$like':'%'+_0x33e86f[_0x2c01('0x55')]['filter']+'%'};return _0x2e8c35;})});}_0x23a223=_[_0x2c01('0x60')]({},_0x23a223,_0x33e86f[_0x2c01('0x67')]);return _0x1ef5ea[_0x2c01('0xe6')](_0x23a223);}})[_0x2c01('0x27')](function(_0x4f63ce){if(_0x4f63ce){_0x25fd18=_0x4f63ce[_0x2c01('0x59')];if(!_0x33e86f[_0x2c01('0x55')]['hasOwnProperty'](_0x2c01('0x5b'))){_0x23a223['limit']=qs[_0x2c01('0x34')](_0x33e86f['query'][_0x2c01('0x34')]);_0x23a223[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x33e86f[_0x2c01('0x55')]['offset']);}return _0x1ef5ea[_0x2c01('0xe6')](_0x23a223);}})['then'](function(_0x38828a){if(_0x38828a){return _0x38828a?{'count':_0x25fd18,'rows':_0x38828a}:null;}})['then'](respondWithResult(_0x55f7e9,null))['catch'](handleError(_0x55f7e9,null));};exports['login']=function(_0x55313d,_0x518359,_0x1c9359){var _0x506bc0;var _0x142c40;var _0x270403;var _0x63caee=!_[_0x2c01('0x7a')](_0x55313d[_0x2c01('0x6b')]['id'])?_0x55313d[_0x2c01('0x6b')]['id']:!_[_0x2c01('0x7a')](_0x55313d[_0x2c01('0x41')]['id'])?_0x55313d['user']['id']:null;return db[_0x2c01('0x68')]['find']({'where':{'id':_0x63caee,'role':{'$or':[_0x2c01('0x3f'),_0x2c01('0x41'),'agent']}},'attributes':['id',_0x2c01('0x47'),'phone',_0x2c01('0xe7'),_0x2c01('0x3e'),_0x2c01('0x74'),'loginInPause']})['then'](function(_0x1b6b54){if(_0x1b6b54){if(_0x1b6b54[_0x2c01('0x3e')]===_0x2c01('0x42')){_0x506bc0=_0x1b6b54;if(_0x55313d[_0x2c01('0x6f')]['interface']){_0x270403=util[_0x2c01('0xb9')]('LOCAL/%s@from-sip/n',_0x506bc0[_0x55313d[_0x2c01('0x6f')][_0x2c01('0xad')]]);}else if(_0x55313d[_0x2c01('0x6f')][_0x2c01('0xe8')]){_0x270403=util['format'](_0x2c01('0xba'),_0x55313d[_0x2c01('0x6f')][_0x2c01('0xe8')]);}else{_0x270403=util[_0x2c01('0xb9')](_0x2c01('0xba'),_0x506bc0[_0x2c01('0x47')]);}socket['to'](util[_0x2c01('0xb9')](_0x2c01('0xe9'),_0x506bc0[_0x2c01('0x47')]))[_0x2c01('0xbf')]('user:forcelogout',{'ip':_0x55313d['headers'][_0x2c01('0xea')]||_0x55313d[_0x2c01('0xeb')][_0x2c01('0xec')]||_0x55313d[_0x2c01('0xed')][_0x2c01('0xec')]||_0x55313d[_0x2c01('0xeb')][_0x2c01('0xed')][_0x2c01('0xec')]});return db['UserVoiceQueueRt'][_0x2c01('0x3c')]({'where':{'membername':_0x506bc0['name']},'individualHooks':!![]});}}else{throw new db[(_0x2c01('0x9f'))]['ValidationError'](_0x2c01('0xee'));}})['then'](function(){if(_0x506bc0){return _0x506bc0[_0x2c01('0xef')]({'raw':!![]});}})[_0x2c01('0x27')](function(_0x25aade){if(_0x506bc0){var _0x37b3fa=[];if(_0x25aade){_0x142c40=_0x25aade;if(_0x142c40['length']){for(var _0x192067=0x0;_0x192067<_0x142c40[_0x2c01('0x59')];_0x192067++){_0x37b3fa[_0x2c01('0x98')]({'membername':_0x506bc0['name'],'UserId':_0x506bc0['id'],'queue_name':_0x142c40[_0x192067][_0x2c01('0x47')],'VoiceQueueId':_0x142c40[_0x192067]['id'],'interface':_0x270403,'paused':_0x506bc0[_0x2c01('0xab')]||![],'penalty':_0x142c40[_0x192067][_0x2c01('0xf0')]||0x0});}return BPromise[_0x2c01('0xbb')](_0x37b3fa,function(_0x171445){return db[_0x2c01('0xc1')][_0x2c01('0xf1')](_0x171445);});}}}})[_0x2c01('0x27')](function(){if(_0x506bc0){return db[_0x2c01('0xf2')][_0x2c01('0x69')]({'where':{'membername':_0x506bc0[_0x2c01('0x47')],'exitAt':null}});}})[_0x2c01('0x27')](function(_0x455a48){if(_0x506bc0){var _0x176f29=[];_0x455a48[_0x2c01('0xf3')](function(_0xfefaf2){_0x176f29[_0x2c01('0x98')](_0xfefaf2[_0x2c01('0x3b')]({'exitAt':moment()['format'](_0x2c01('0xf4'))}));});return BPromise[_0x2c01('0x99')](_0x176f29);}})[_0x2c01('0x27')](function(){if(_0x506bc0){var _0x430be9=[];var _0x5e6e96=[];var _0x263803=utils[_0x2c01('0xf5')]();var _0x426b19={'membername':_0x506bc0[_0x2c01('0x47')],'interface':_0x270403,'enterAt':moment()[_0x2c01('0xb9')](_0x2c01('0xf4')),'role':_0x506bc0[_0x2c01('0x3e')],'internal':_0x506bc0[_0x2c01('0x74')]};_0x263803[_0x2c01('0xf3')](function(_0x428ce0){_0x430be9[_0x2c01('0x98')](_[_0x2c01('0x60')]({'channel':_0x428ce0,'type':_0x2c01('0xf6'),'data1':_0x55313d[_0x2c01('0x6f')][_0x2c01('0xf7')],'data2':_0x270403},_0x426b19));if(_0x506bc0[_0x2c01('0xab')]){_0x5e6e96[_0x2c01('0x98')](_[_0x2c01('0x60')]({'channel':_0x428ce0,'type':_0x2c01('0xf8'),'data1':_0x2c01('0xf9')},_0x426b19));}});return db['MemberReport'][_0x2c01('0xfa')](_0x430be9[_0x2c01('0xfb')](_0x5e6e96),{'individualHooks':!![]});}})[_0x2c01('0x27')](function(){if(_0x506bc0){return _0x506bc0['update']({'online':!![],'lastLoginAt':moment()[_0x2c01('0xb9')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x506bc0[_0x2c01('0xab')]||![],'mailPause':_0x506bc0[_0x2c01('0xab')]||![],'chatPause':_0x506bc0[_0x2c01('0xab')]||![],'faxPause':_0x506bc0[_0x2c01('0xab')]||![],'smsPause':_0x506bc0['loginInPause']||![],'openchannelPause':_0x506bc0[_0x2c01('0xab')]||![],'whatsappPause':_0x506bc0[_0x2c01('0xab')]||![],'pauseType':_0x506bc0[_0x2c01('0xab')]?_0x2c01('0xf9'):null,'interface':_0x270403,'lastPauseAt':moment()[_0x2c01('0xb9')](_0x2c01('0xf4'))});}})['then'](function(_0x146a3d){if(_0x55313d[_0x2c01('0xfc')]){return _0x1c9359();}else{return BPromise['resolve'](_0x146a3d)[_0x2c01('0x27')](respondWithResult(_0x518359,null));}})[_0x2c01('0x2f')](handleError(_0x518359,null));};exports[_0x2c01('0xfd')]=function(_0x4c0b9d,_0x4743e7,_0x3689ce){var _0x590d09;return db[_0x2c01('0x68')][_0x2c01('0x6e')]({'where':{'id':_0x4c0b9d[_0x2c01('0x6b')]['id'],'role':_0x2c01('0x42')},'attributes':['id',_0x2c01('0x47'),_0x2c01('0x3e')]})[_0x2c01('0x27')](handleEntityNotFound(_0x4743e7,null))[_0x2c01('0x27')](function(_0x194fb4){if(_0x194fb4){_0x590d09=_0x194fb4;return db['UserVoiceQueueRt'][_0x2c01('0x3c')]({'where':{'membername':_0x590d09[_0x2c01('0x47')]},'individualHooks':!![]});}})[_0x2c01('0x27')](function(){return db[_0x2c01('0xf2')][_0x2c01('0x69')]({'where':{'membername':_0x590d09[_0x2c01('0x47')],'exitAt':null}});})['then'](function(_0x1105b1){var _0x4e4fae=[];_0x1105b1[_0x2c01('0xf3')](function(_0xd2bc39){_0x4e4fae['push'](_0xd2bc39['update']({'exitAt':moment()[_0x2c01('0xb9')](_0x2c01('0xf4'))}));});return BPromise[_0x2c01('0x99')](_0x4e4fae);})['then'](function(){return _0x590d09['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2c01('0x27')](respondWithResult(_0x4743e7,null))[_0x2c01('0x2f')](handleError(_0x4743e7,null));};exports[_0x2c01('0xfe')]=function(_0x5b0224,_0x4ca58c,_0x6e1b2e){var _0x3a6de3;return db[_0x2c01('0xc1')][_0x2c01('0x3b')]({'paused':0x1},{'where':{'UserId':_0x5b0224[_0x2c01('0x6b')]['id']},'individualHooks':!![]})[_0x2c01('0x27')](function(){return db['User'][_0x2c01('0x6e')]({'where':{'id':_0x5b0224[_0x2c01('0x6b')]['id'],'role':'agent'},'attributes':['id','name',_0x2c01('0x3e'),'internal','interface']});})[_0x2c01('0x27')](handleEntityNotFound(_0x4ca58c,null))[_0x2c01('0x27')](function(_0x4df9ad){if(_0x4df9ad){_0x3a6de3=_0x4df9ad;return respondWithRpcPromise('QueuePause',_0x2c01('0xfe'),{'id':_0x3a6de3['id'],'name':_0x3a6de3['name'],'pause':!![]});}})['then'](function(){if(_0x3a6de3){return db[_0x2c01('0xf2')][_0x2c01('0x69')]({'where':{'membername':_0x3a6de3[_0x2c01('0x47')],'type':_0x2c01('0xf8'),'exitAt':null}});}})[_0x2c01('0x27')](function(_0x28037c){if(_0x28037c['length']){var _0x492002=moment()[_0x2c01('0xb9')](_0x2c01('0xf4'));for(var _0x1e3e61=0x0,_0x272fea=_0x28037c['length'];_0x1e3e61<_0x272fea;_0x1e3e61++){_0x28037c[_0x1e3e61][_0x2c01('0xff')]({'exitAt':_0x492002});}}})[_0x2c01('0x27')](function(){var _0x2a8ec5=[];var _0x225d11=utils[_0x2c01('0xf5')]();_0x225d11[_0x2c01('0xf3')](function(_0x102227){_0x2a8ec5['push']({'channel':_0x102227,'membername':_0x3a6de3[_0x2c01('0x47')],'interface':_[_0x2c01('0x7a')](_0x3a6de3[_0x2c01('0xad')])?util[_0x2c01('0xb9')]('SIP/%s',_0x3a6de3[_0x2c01('0x47')]):_0x3a6de3['interface'],'type':_0x2c01('0xf8'),'enterAt':moment()[_0x2c01('0xb9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5b0224['body']['type']||'DEFAULT\x20PAUSE','role':_0x3a6de3[_0x2c01('0x3e')],'internal':_0x3a6de3['internal']});});return db[_0x2c01('0xf2')][_0x2c01('0xfa')](_0x2a8ec5,{'individualHooks':!![]});})[_0x2c01('0x27')](function(){return _0x3a6de3[_0x2c01('0x3b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5b0224['body']['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x2c01('0xb9')](_0x2c01('0xf4'))});})[_0x2c01('0x27')](respondWithResult(_0x4ca58c,null))[_0x2c01('0x2f')](handleError(_0x4ca58c,null));};exports[_0x2c01('0x100')]=function(_0x59086b,_0x2a8740,_0x291fac){var _0x2167ab;return db[_0x2c01('0x68')][_0x2c01('0x6e')]({'where':{'id':_0x59086b['params']['id']},'attributes':['id',_0x2c01('0x47'),_0x2c01('0x3e'),_0x2c01('0xac'),_0x2c01('0x101'),_0x2c01('0x102'),_0x2c01('0x103'),_0x2c01('0x104'),_0x2c01('0x105'),_0x2c01('0x106'),_0x2c01('0x107'),_0x2c01('0x108')]})[_0x2c01('0x27')](handleEntityNotFound(_0x2a8740,null))['then'](function(_0xfe2c93){if(_0xfe2c93){_0x2167ab=_0xfe2c93;if(_0x59086b['body'][_0x2c01('0xaa')]&&!utils['isValidChannel'](_0x59086b[_0x2c01('0x6f')][_0x2c01('0xaa')])){throw new db['Sequelize'][(_0x2c01('0xa2'))]('Unknown\x20channel');}switch(_0x59086b[_0x2c01('0x6f')][_0x2c01('0xaa')]){case _0x2c01('0xb8'):return respondWithRpcPromise(_0x2c01('0x109'),_0x2c01('0x100'),{'id':_0x2167ab['id'],'name':_0x2167ab[_0x2c01('0x47')],'pause':![]})[_0x2c01('0x27')](function(){return db[_0x2c01('0xc1')]['update']({'paused':0x0},{'where':{'UserId':_0x2167ab['id']},'individualHooks':!![]});})[_0x2c01('0x27')](function(){return db[_0x2c01('0xf2')][_0x2c01('0x6e')]({'where':{'channel':_0x59086b['body'][_0x2c01('0xaa')],'membername':_0x2167ab[_0x2c01('0x47')],'type':'PAUSE','exitAt':null}});})[_0x2c01('0x27')](function(_0x11fbd){if(_0x11fbd){return _0x11fbd['update']({'exitAt':moment()['format'](_0x2c01('0xf4')),'data2':_0x2c01('0x10a')},{'individualHooks':!![]});}return null;})[_0x2c01('0x27')](function(){return _0x2167ab['update']({'voicePause':![]});});case _0x2c01('0x10b'):case'chat':case _0x2c01('0x10c'):case _0x2c01('0x10d'):case _0x2c01('0x10e'):case _0x2c01('0x10f'):return db[_0x2c01('0xf2')][_0x2c01('0x6e')]({'where':{'channel':_0x59086b[_0x2c01('0x6f')]['channel'],'membername':_0x2167ab[_0x2c01('0x47')],'type':_0x2c01('0xf8'),'exitAt':null}})[_0x2c01('0x27')](function(_0x117fd6){if(_0x117fd6){return _0x117fd6[_0x2c01('0x3b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2c01('0x10a')},{'individualHooks':!![]});}return null;})[_0x2c01('0x27')](function(){var _0x46edcb={};_[_0x2c01('0x35')](_0x46edcb,util['format'](_0x2c01('0x110'),_0x59086b['body'][_0x2c01('0xaa')],_0x2c01('0x111')),![]);return _0x2167ab[_0x2c01('0x3b')](_0x46edcb);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x2167ab['id'],'name':_0x2167ab[_0x2c01('0x47')],'pause':![]})[_0x2c01('0x27')](function(){return db[_0x2c01('0xc1')][_0x2c01('0x3b')]({'paused':0x0},{'where':{'UserId':_0x2167ab['id']}});})[_0x2c01('0x27')](function(){return db[_0x2c01('0xf2')][_0x2c01('0x69')]({'where':{'membername':_0x2167ab['name'],'type':'PAUSE','exitAt':null}});})[_0x2c01('0x27')](function(_0x25b5d5){var _0x4fa9ba=[];_0x25b5d5['forEach'](function(_0x3f7284){_0x4fa9ba['push'](_0x3f7284[_0x2c01('0x3b')]({'exitAt':moment()['format'](_0x2c01('0xf4')),'data2':_0x2c01('0x10a')}));});return BPromise[_0x2c01('0x99')](_0x4fa9ba);})[_0x2c01('0x27')](function(){return _0x2167ab[_0x2c01('0x3b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2c01('0x27')](respondWithResult(_0x2a8740,null))[_0x2c01('0x2f')](handleError(_0x2a8740,null));};exports[_0x2c01('0x112')]=function(_0x493990,_0x2b272c,_0x20bb74){var _0x203abe={};var _0x4f3a1c={};var _0x7bac5d;var _0xcb846;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x493990['params']['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x2b272c,null))[_0x2c01('0x27')](function(_0x1a3138){if(_0x1a3138){_0x7bac5d=_0x1a3138;_0x4f3a1c[_0x2c01('0x50')]=_['keys'](db[_0x2c01('0x113')][_0x2c01('0x4d')]);_0x4f3a1c[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x493990[_0x2c01('0x55')]);_0x4f3a1c[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x4f3a1c[_0x2c01('0x50')],_0x4f3a1c[_0x2c01('0x55')]);_0x203abe[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x4f3a1c[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x493990[_0x2c01('0x55')][_0x2c01('0x58')]));_0x203abe[_0x2c01('0x56')]=_0x203abe[_0x2c01('0x56')][_0x2c01('0x59')]?_0x203abe['attributes']:_0x4f3a1c[_0x2c01('0x50')];_0x203abe[_0x2c01('0xce')]=qs['sort'](_0x493990[_0x2c01('0x55')]['sort']);_0x203abe['where']=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x493990[_0x2c01('0x55')],_0x4f3a1c['filters']));if(_0x493990[_0x2c01('0x55')]['filter']){_0x203abe[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x203abe['where'],{'$or':_[_0x2c01('0x4c')](_0x203abe[_0x2c01('0x56')],function(_0x46d1f6){var _0xea12b6={};_0xea12b6[_0x46d1f6]={'$like':'%'+_0x493990[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0xea12b6;})});}_0x203abe=_[_0x2c01('0x60')]({},_0x203abe,_0x493990['options']);return _0x7bac5d[_0x2c01('0x112')](_0x203abe);}})[_0x2c01('0x27')](function(_0x58d1ac){if(_0x58d1ac){_0xcb846=_0x58d1ac[_0x2c01('0x59')];if(!_0x493990['query']['hasOwnProperty']('nolimit')){_0x203abe[_0x2c01('0x34')]=qs['limit'](_0x493990[_0x2c01('0x55')]['limit']);_0x203abe[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x493990[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x7bac5d['getTeams'](_0x203abe);}})[_0x2c01('0x27')](function(_0x4f6350){if(_0x4f6350){return _0x4f6350?{'count':_0xcb846,'rows':_0x4f6350}:null;}})[_0x2c01('0x27')](respondWithResult(_0x2b272c,null))['catch'](handleError(_0x2b272c,null));};exports[_0x2c01('0x114')]=function(_0x5d1b8b,_0xa48eda){return db[_0x2c01('0x68')][_0x2c01('0x6e')]({'where':{'id':_0x5d1b8b[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0xa48eda,null))[_0x2c01('0x27')](function(_0xa95f8d){if(_0xa95f8d){var _0x242069=_0xa95f8d[_0x2c01('0x3d')]({'plain':!![]});return _0xa95f8d[_0x2c01('0x114')](_0x5d1b8b['body'][_0x2c01('0x72')],_[_0x2c01('0x73')](_0x5d1b8b['body'],['ids','id'])||{})[_0x2c01('0x27')](function(){for(var _0x47ae3d=0x0;_0x47ae3d<_0x5d1b8b['body']['ids'][_0x2c01('0x59')];_0x47ae3d++){var _0x56f814=[];db[_0x2c01('0x113')][_0x2c01('0xa4')]({'where':{'id':_0x5d1b8b[_0x2c01('0x6f')][_0x2c01('0x72')][_0x47ae3d]}})[_0x2c01('0x27')](function(_0x16fb43){_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0xef')]()[_0x2c01('0x27')](function(_0x5ad1f7){for(var _0x221287=0x0;_0x221287<_0x5ad1f7[_0x2c01('0x59')];_0x221287++){_0x5ad1f7[_0x221287][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x116'));}return _0x5ad1f7;}));_0x56f814['push'](_0x16fb43[_0x2c01('0x117')]()['then'](function(_0x109ab3){for(var _0x3fa7da=0x0;_0x3fa7da<_0x109ab3[_0x2c01('0x59')];_0x3fa7da++){_0x109ab3[_0x3fa7da][_0x2c01('0x115')]('channel',_0x2c01('0x118'));}return _0x109ab3;}));_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0x119')]()[_0x2c01('0x27')](function(_0x1e699d){for(var _0x7bd1c1=0x0;_0x7bd1c1<_0x1e699d[_0x2c01('0x59')];_0x7bd1c1++){_0x1e699d[_0x7bd1c1][_0x2c01('0x115')]('channel',_0x2c01('0x11a'));}return _0x1e699d;}));_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0x11b')]()[_0x2c01('0x27')](function(_0x2f889b){for(var _0x1c56fe=0x0;_0x1c56fe<_0x2f889b[_0x2c01('0x59')];_0x1c56fe++){_0x2f889b[_0x1c56fe]['setDataValue'](_0x2c01('0xaa'),_0x2c01('0x11c'));}return _0x2f889b;}));_0x56f814['push'](_0x16fb43[_0x2c01('0x11d')]()[_0x2c01('0x27')](function(_0x4d8bb0){for(var _0x2b06b0=0x0;_0x2b06b0<_0x4d8bb0[_0x2c01('0x59')];_0x2b06b0++){_0x4d8bb0[_0x2b06b0][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x11e'));}return _0x4d8bb0;}));_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0x11f')]()[_0x2c01('0x27')](function(_0xf33fb8){for(var _0x5f21c8=0x0;_0x5f21c8<_0xf33fb8[_0x2c01('0x59')];_0x5f21c8++){_0xf33fb8[_0x5f21c8][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x120'));}return _0xf33fb8;}));_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0x121')]()['then'](function(_0x4932eb){for(var _0x5c5871=0x0;_0x5c5871<_0x4932eb[_0x2c01('0x59')];_0x5c5871++){_0x4932eb[_0x5c5871][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x122'));}return _0x4932eb;}));return BPromise[_0x2c01('0x99')](_0x56f814);})['then'](function(_0x1a0457){var _0x4be4d8=_[_0x2c01('0x123')](_0x1a0457);_0x56f814=[];return db['sequelize'][_0x2c01('0x124')](function(_0x4a7117){for(var _0x5be70a=0x0;_0x5be70a<_0x4be4d8[_0x2c01('0x59')];_0x5be70a++){_0x56f814['push'](_0x4be4d8[_0x5be70a][_0x2c01('0x125')](_0x242069['id']),{'transaction':_0x4a7117});}return BPromise[_0x2c01('0x99')](_0x56f814)[_0x2c01('0x27')](function(){if(_0x242069['online']){return BPromise[_0x2c01('0xbb')](_[_0x2c01('0x66')](_0x4be4d8,function(_0x32b10d){return _0x32b10d['getDataValue'](_0x2c01('0xaa'))===_0x2c01('0x116');}),function(_0x4eeb90){return db[_0x2c01('0xc1')][_0x2c01('0xf1')]({'membername':_0x242069[_0x2c01('0x47')],'UserId':_0x242069['id'],'queue_name':_0x4eeb90['name'],'VoiceQueueId':_0x4eeb90['id'],'interface':_[_0x2c01('0x7a')](_0x242069[_0x2c01('0xad')])?util[_0x2c01('0xb9')]('SIP/%s',_0x242069[_0x2c01('0x47')]):_0x242069[_0x2c01('0xad')],'paused':_0x242069[_0x2c01('0xac')]||![],'penalty':_0x242069[_0x2c01('0xb3')]},{'transaction':_0x4a7117});});}else{return;}})['then'](function(){for(var _0x457529=0x0;_0x457529<_0x4be4d8[_0x2c01('0x59')];_0x457529++){var _0x4176d1=_0x4be4d8[_0x457529]['getDataValue'](_0x2c01('0xaa'));var _0x4a18fd=_0x4176d1+'QueueId';socket[_0x2c01('0xbf')](_0x2c01('0x41')+_0x4176d1+_0x2c01('0xb6'),{'UserId':_0x242069['id'],['queueField']:_0x4be4d8[_0x457529]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xa48eda,null))['catch'](handleError(_0xa48eda,null));};exports[_0x2c01('0x126')]=function(_0x416bd2,_0x4f9b03){return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x416bd2[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x4f9b03,null))['then'](function(_0xf135b7){if(_0xf135b7){var _0x4dd2e6=_0xf135b7[_0x2c01('0x3d')]({'plain':!![]});var _0x4910de=_0x416bd2[_0x2c01('0x55')][_0x2c01('0x72')];return _0xf135b7[_0x2c01('0x126')](_0x4910de)[_0x2c01('0x27')](function(){for(var _0x53d0a3=0x0;_0x53d0a3<_0x4910de[_0x2c01('0x59')];_0x53d0a3++){var _0x3a7b16=[];db['Team'][_0x2c01('0xa4')]({'where':{'id':_0x4910de[_0x53d0a3]}})[_0x2c01('0x27')](function(_0x1e966b){_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0xef')]()['then'](function(_0x1d06d9){for(var _0x13e5ec=0x0;_0x13e5ec<_0x1d06d9[_0x2c01('0x59')];_0x13e5ec++){_0x1d06d9[_0x13e5ec][_0x2c01('0x115')](_0x2c01('0xaa'),'Voice');}return _0x1d06d9;}));_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0x117')]()[_0x2c01('0x27')](function(_0x5b92cb){for(var _0xf5f3cc=0x0;_0xf5f3cc<_0x5b92cb[_0x2c01('0x59')];_0xf5f3cc++){_0x5b92cb[_0xf5f3cc]['setDataValue'](_0x2c01('0xaa'),_0x2c01('0x118'));}return _0x5b92cb;}));_0x3a7b16['push'](_0x1e966b[_0x2c01('0x119')]()[_0x2c01('0x27')](function(_0x3c796d){for(var _0x38a6c1=0x0;_0x38a6c1<_0x3c796d[_0x2c01('0x59')];_0x38a6c1++){_0x3c796d[_0x38a6c1][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x11a'));}return _0x3c796d;}));_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0x11b')]()[_0x2c01('0x27')](function(_0x40e935){for(var _0x5c5fda=0x0;_0x5c5fda<_0x40e935['length'];_0x5c5fda++){_0x40e935[_0x5c5fda][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x11c'));}return _0x40e935;}));_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0x11d')]()['then'](function(_0x1fbb74){for(var _0x204d6a=0x0;_0x204d6a<_0x1fbb74['length'];_0x204d6a++){_0x1fbb74[_0x204d6a][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x11e'));}return _0x1fbb74;}));_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0x11f')]()[_0x2c01('0x27')](function(_0x41098d){for(var _0x21b040=0x0;_0x21b040<_0x41098d[_0x2c01('0x59')];_0x21b040++){_0x41098d[_0x21b040][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x120'));}return _0x41098d;}));_0x3a7b16['push'](_0x1e966b[_0x2c01('0x121')]()['then'](function(_0x1d8190){for(var _0x11f2a9=0x0;_0x11f2a9<_0x1d8190['length'];_0x11f2a9++){_0x1d8190[_0x11f2a9]['setDataValue'](_0x2c01('0xaa'),_0x2c01('0x122'));}return _0x1d8190;}));return BPromise[_0x2c01('0x99')](_0x3a7b16);})['then'](function(_0x5103ba){var _0x24a575=_[_0x2c01('0x123')](_0x5103ba);_0x3a7b16=[];return db['sequelize'][_0x2c01('0x124')](function(_0x43de87){for(var _0x266601=0x0;_0x266601<_0x24a575[_0x2c01('0x59')];_0x266601++){_0x3a7b16[_0x2c01('0x98')](_0x24a575[_0x266601]['removeAgent'](_0x4dd2e6['id']),{'transaction':_0x43de87});}return BPromise[_0x2c01('0x99')](_0x3a7b16)[_0x2c01('0x27')](function(){if(_0x4dd2e6[_0x2c01('0x127')]){return BPromise[_0x2c01('0xbb')](_[_0x2c01('0x66')](_0x24a575,function(_0x127963){return _0x127963[_0x2c01('0x128')](_0x2c01('0xaa'))==='Voice';}),function(_0x5d38d8){return db['UserVoiceQueueRt'][_0x2c01('0x3c')]({'where':{'VoiceQueueId':_0x5d38d8['id'],'UserId':_0x4dd2e6['id']},'transaction':_0x43de87});});}else{return;}})[_0x2c01('0x27')](function(){for(var _0x173798=0x0;_0x173798<_0x24a575[_0x2c01('0x59')];_0x173798++){var _0x3b306e=_0x24a575[_0x173798][_0x2c01('0x128')](_0x2c01('0xaa'));var _0x578616=_0x3b306e+'QueueId';socket[_0x2c01('0xbf')]('user'+_0x3b306e+'Queue:remove',{'UserId':_0x4dd2e6['id'],['queueField']:_0x24a575[_0x173798]['id']});}});});});}});}})[_0x2c01('0x27')](respondWithStatusCode(_0x4f9b03,null))[_0x2c01('0x2f')](handleError(_0x4f9b03,null));};exports[_0x2c01('0x129')]=function(_0xd10f46,_0x3d00d9,_0x35d7fd){var _0x4765e5={};var _0x9688c={};var _0x1e1da1;var _0x3b96a8;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0xd10f46[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x3d00d9,null))[_0x2c01('0x27')](function(_0x27ca6e){if(_0x27ca6e){_0x1e1da1=_0x27ca6e;_0x9688c[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0xcf')][_0x2c01('0x4d')]);_0x9688c[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0xd10f46[_0x2c01('0x55')]);_0x9688c[_0x2c01('0x5e')]=_['intersection'](_0x9688c[_0x2c01('0x50')],_0x9688c[_0x2c01('0x55')]);_0x4765e5['attributes']=_['intersection'](_0x9688c[_0x2c01('0x50')],qs['fields'](_0xd10f46[_0x2c01('0x55')][_0x2c01('0x58')]));_0x4765e5[_0x2c01('0x56')]=_0x4765e5[_0x2c01('0x56')]['length']?_0x4765e5[_0x2c01('0x56')]:_0x9688c[_0x2c01('0x50')];_0x4765e5[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0xd10f46[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x4765e5[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_['pick'](_0xd10f46[_0x2c01('0x55')],_0x9688c['filters']));if(_0xd10f46[_0x2c01('0x55')]['filter']){_0x4765e5[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x4765e5[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x4765e5['attributes'],function(_0x313c5d){var _0x11557c={};_0x11557c[_0x313c5d]={'$like':'%'+_0xd10f46[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x11557c;})});}_0x4765e5=_[_0x2c01('0x60')]({},_0x4765e5,_0xd10f46[_0x2c01('0x67')]);return _0x1e1da1['getLists'](_0x4765e5);}})[_0x2c01('0x27')](function(_0x35c713){if(_0x35c713){_0x3b96a8=_0x35c713[_0x2c01('0x59')];if(!_0xd10f46['query'][_0x2c01('0x5a')]('nolimit')){_0x4765e5[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0xd10f46['query'][_0x2c01('0x34')]);_0x4765e5[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0xd10f46[_0x2c01('0x55')]['offset']);}return _0x1e1da1[_0x2c01('0x129')](_0x4765e5);}})[_0x2c01('0x27')](function(_0x157f40){if(_0x157f40){return _0x157f40?{'count':_0x3b96a8,'rows':_0x157f40}:null;}})[_0x2c01('0x27')](respondWithResult(_0x3d00d9,null))[_0x2c01('0x2f')](handleError(_0x3d00d9,null));};exports[_0x2c01('0x12a')]=function(_0x29b38f,_0x2fd769,_0x260750){var _0x106cf8={};var _0x4a39ad={};var _0x1f6178;var _0x405dc8;return db['User'][_0x2c01('0xa4')]({'where':{'id':_0x29b38f[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x2fd769,null))['then'](function(_0x54c83c){if(_0x54c83c){_0x1f6178=_0x54c83c;_0x4a39ad[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0x68')][_0x2c01('0x4d')]);_0x4a39ad[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x29b38f[_0x2c01('0x55')]);_0x4a39ad[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x4a39ad[_0x2c01('0x50')],_0x4a39ad[_0x2c01('0x55')]);_0x106cf8[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x4a39ad[_0x2c01('0x50')],qs['fields'](_0x29b38f[_0x2c01('0x55')]['fields']));_0x106cf8[_0x2c01('0x56')]=_0x106cf8[_0x2c01('0x56')][_0x2c01('0x59')]?_0x106cf8[_0x2c01('0x56')]:_0x4a39ad[_0x2c01('0x50')];_0x106cf8[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x29b38f['query'][_0x2c01('0x5c')]);_0x106cf8[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x29b38f[_0x2c01('0x55')],_0x4a39ad['filters']));if(_0x29b38f[_0x2c01('0x55')][_0x2c01('0x66')]){_0x106cf8[_0x2c01('0x5d')]=_['merge'](_0x106cf8['where'],{'$or':_[_0x2c01('0x4c')](_0x106cf8['attributes'],function(_0x3f9096){var _0x55f43d={};_0x55f43d[_0x3f9096]={'$like':'%'+_0x29b38f[_0x2c01('0x55')]['filter']+'%'};return _0x55f43d;})});}_0x106cf8[_0x2c01('0x50')]=db[_0x2c01('0x68')];_0x106cf8['as']=_0x2c01('0x9a');_0x106cf8=_[_0x2c01('0x60')]({},_0x106cf8,_0x29b38f[_0x2c01('0x67')]);return _0x1f6178[_0x2c01('0xef')]({'include':[_0x106cf8]});}})['then'](function(_0x182aee){if(_0x182aee){var _0x441f5d={},_0x58ef3f=[],_0x13a8c7=0x0;for(var _0x2cc907=0x0;_0x2cc907<_0x182aee['length'];_0x2cc907+=0x1){for(var _0xc2c31b=0x0,_0xacb478;_0xc2c31b<_0x182aee[_0x2cc907]['Agents'][_0x2c01('0x59')];_0xc2c31b+=0x1){_0xacb478=_0x182aee[_0x2cc907]['Agents'][_0xc2c31b][_0x2c01('0x3d')]({'plain':!![]});_0x441f5d[_0xacb478['id']]=_0xacb478;}}_0x441f5d=_[_0x2c01('0x12b')](_0x441f5d);for(var _0x2953e0=qs[_0x2c01('0x33')](_0x29b38f[_0x2c01('0x55')][_0x2c01('0x33')]);_0x2953e0<_0x441f5d[_0x2c01('0x59')]&&_0x58ef3f[_0x2c01('0x59')]=_0x5771ed['agents']){throw new Error(_0x3c93('0x58'));}})[_0x3c93('0x13')](function(){if(_0x2f543d){return db[_0x3c93('0x30')][_0x3c93('0x4f')]({'where':{'membername':_0x2f543d[_0x3c93('0x3a')]},'individualHooks':!![]});}})['then'](function(){if(_0x2f543d){return _0x2f543d[_0x3c93('0x59')]({'raw':!![]});}})[_0x3c93('0x13')](function(_0x4b0e18){if(_0x2f543d){if(_0x4b0e18){var _0x2fc73a=[];_0x2b098e=_0x4b0e18;if(_0x2b098e[_0x3c93('0x33')]){for(var _0x3b0c39=0x0;_0x3b0c39<_0x2b098e[_0x3c93('0x33')];_0x3b0c39++){_0x2fc73a[_0x3c93('0x39')](db[_0x3c93('0x30')]['upsert']({'membername':_0x2f543d[_0x3c93('0x3a')],'UserId':_0x2f543d['id'],'queue_name':_0x2b098e[_0x3b0c39]['name'],'VoiceQueueId':_0x2b098e[_0x3b0c39]['id'],'interface':_0x54168b,'paused':_0x2f543d['loginInPause']||![],'penalty':_0x2b098e[_0x3b0c39][_0x3c93('0x5a')]||0x0}));}return BPromise['all'](_0x2fc73a);}}}})[_0x3c93('0x13')](function(){if(_0x2f543d){return db[_0x3c93('0x32')][_0x3c93('0x1f')]({'where':{'membername':_0x2f543d[_0x3c93('0x3a')],'exitAt':null}});}})[_0x3c93('0x13')](function(_0x37f435){if(_0x2f543d){if(_0x37f435&&_0x37f435[_0x3c93('0x33')]){var _0x264053=[];_0x37f435[_0x3c93('0x38')](function(_0x57a929){_0x264053[_0x3c93('0x39')](_0x57a929['update']({'exitAt':moment()['format'](_0x3c93('0x35'))}));});return BPromise[_0x3c93('0x5b')](_0x264053);}}})[_0x3c93('0x13')](function(_0x94d709){if(_0x2f543d){var _0x435aa5=[];var _0x527f5c=[];var _0x46bde3=utils[_0x3c93('0x37')]();var _0x41f4cc={'membername':_0x2f543d[_0x3c93('0x3a')],'interface':_0x54168b,'enterAt':moment()[_0x3c93('0x34')](_0x3c93('0x35')),'role':_0x2f543d['role'],'internal':_0x2f543d[_0x3c93('0x2e')]};_0x46bde3['forEach'](function(_0x1e066f){_0x435aa5['push'](_[_0x3c93('0x5c')]({'channel':_0x1e066f,'type':_0x3c93('0x5d'),'data1':_0x3c93('0x5e'),'data2':_0x54168b},_0x41f4cc));if(_0x2f543d[_0x3c93('0x52')]){_0x527f5c[_0x3c93('0x39')](_[_0x3c93('0x5c')]({'channel':_0x1e066f,'type':'PAUSE','data1':'LOGININPAUSE'},_0x41f4cc));}});return db[_0x3c93('0x32')][_0x3c93('0x3f')](_0x435aa5[_0x3c93('0x5f')](_0x527f5c),{'individualHooks':!![]});}})['then'](function(){if(_0x2f543d){return _0x2f543d['update']({'online':!![],'lastLoginAt':moment()['format'](_0x3c93('0x35')),'voicePause':_0x2f543d[_0x3c93('0x52')]||![],'mailPause':_0x2f543d[_0x3c93('0x52')]||![],'chatPause':_0x2f543d[_0x3c93('0x52')]||![],'faxPause':_0x2f543d[_0x3c93('0x52')]||![],'smsPause':_0x2f543d[_0x3c93('0x52')]||![],'openchannelPause':_0x2f543d[_0x3c93('0x52')]||![],'pauseType':_0x2f543d['loginInPause']?_0x3c93('0x60'):null,'lastPauseAt':moment()[_0x3c93('0x34')](_0x3c93('0x35')),'interface':_0x54168b});}})[_0x3c93('0x13')](function(_0xab8e48){_0x20e8f5(_0xab8e48);})['catch'](function(_0xacb768){_0xdfe7bc(_0x59f6de['error'](0x1f4,_0xacb768[_0x3c93('0x1c')]));});});}; \ No newline at end of file +var _0x1e8c=['findOne','channel','isValidChannel','Unknown\x20channel','voice','mail','chat','sms','whatsapp','system','%s%s','Pause','forEach','LogoutUser','LoginUser','loginInPause','count','agent','getLicense','agents','destroy','getVoiceQueues','upsert','all','merge','LOGIN','callysquare','LOGININPAUSE','concat','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','User','findAll','options','raw','where','attributes','limit','include','map','model','GetUser','ShowUser','find','PauseUser','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','getChannels','push','name','format','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','type','UnpauseUser'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1e8c,0xd3));var _0xc1e8=function(_0x56f6c0,_0x37c097){_0x56f6c0=_0x56f6c0-0x0;var _0x249342=_0x1e8c[_0x56f6c0];return _0x249342;};'use strict';var _=require('lodash');var util=require(_0xc1e8('0x0'));var moment=require(_0xc1e8('0x1'));var BPromise=require(_0xc1e8('0x2'));var rs=require(_0xc1e8('0x3'));var fs=require('fs');var Redis=require(_0xc1e8('0x4'));var db=require(_0xc1e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1e8('0x6'))(_0xc1e8('0x7'));var config=require(_0xc1e8('0x8'));var jayson=require(_0xc1e8('0x9'));var client=jayson[_0xc1e8('0xa')][_0xc1e8('0xb')]({'port':0x232a});config['redis']=_[_0xc1e8('0xc')](config[_0xc1e8('0xd')],{'host':_0xc1e8('0xe'),'port':0x18eb});var socket=require(_0xc1e8('0xf'))(new Redis(config[_0xc1e8('0xd')]));require(_0xc1e8('0x10'))[_0xc1e8('0x11')](socket);function respondWithRpcPromise(_0x2c5f56,_0x24c6b0,_0x5e4086){return new BPromise(function(_0x32728a,_0x43a338){return client[_0xc1e8('0x12')](_0x2c5f56,_0x5e4086)[_0xc1e8('0x13')](function(_0x2c4d2d){logger[_0xc1e8('0x14')](_0xc1e8('0x15'),_0x24c6b0,_0xc1e8('0x16'));logger['debug'](_0xc1e8('0x17'),_0x24c6b0,_0xc1e8('0x16'),JSON[_0xc1e8('0x18')](_0x2c4d2d));if(_0x2c4d2d[_0xc1e8('0x19')]){if(_0x2c4d2d[_0xc1e8('0x19')][_0xc1e8('0x1a')]===0x1f4){logger[_0xc1e8('0x19')]('User,\x20%s,\x20%s',_0x24c6b0,_0x2c4d2d[_0xc1e8('0x19')][_0xc1e8('0x1b')]);return _0x43a338(_0x2c4d2d['error']['message']);}logger[_0xc1e8('0x19')](_0xc1e8('0x15'),_0x24c6b0,_0x2c4d2d[_0xc1e8('0x19')][_0xc1e8('0x1b')]);return _0x32728a(_0x2c4d2d[_0xc1e8('0x19')]['message']);}else{logger[_0xc1e8('0x14')](_0xc1e8('0x15'),_0x24c6b0,_0xc1e8('0x16'));_0x32728a(_0x2c4d2d['result'][_0xc1e8('0x1b')]);}})[_0xc1e8('0x1c')](function(_0x3ee778){logger[_0xc1e8('0x19')](_0xc1e8('0x15'),_0x24c6b0,_0x3ee778);_0x43a338(_0x3ee778);});});}exports['GetUser']=function(_0x2c2402){var _0x4eb948=this;return new Promise(function(_0x489f3c,_0x3e988b){return db[_0xc1e8('0x1d')][_0xc1e8('0x1e')]({'raw':_0x2c2402[_0xc1e8('0x1f')]?_0x2c2402[_0xc1e8('0x1f')][_0xc1e8('0x20')]===undefined?!![]:![]:!![],'where':_0x2c2402[_0xc1e8('0x1f')]?_0x2c2402[_0xc1e8('0x1f')][_0xc1e8('0x21')]||null:null,'attributes':_0x2c2402[_0xc1e8('0x1f')]?_0x2c2402[_0xc1e8('0x1f')][_0xc1e8('0x22')]||null:null,'limit':_0x2c2402[_0xc1e8('0x1f')]?_0x2c2402['options'][_0xc1e8('0x23')]||null:null,'include':_0x2c2402[_0xc1e8('0x1f')]?_0x2c2402[_0xc1e8('0x1f')][_0xc1e8('0x24')]?_[_0xc1e8('0x25')](_0x2c2402[_0xc1e8('0x1f')][_0xc1e8('0x24')],function(_0x53d25e){return{'model':db[_0x53d25e[_0xc1e8('0x26')]],'as':_0x53d25e['as'],'attributes':_0x53d25e[_0xc1e8('0x22')],'include':_0x53d25e['include']?_['map'](_0x53d25e['include'],function(_0x323132){return{'model':db[_0x323132[_0xc1e8('0x26')]],'as':_0x323132['as'],'attributes':_0x323132[_0xc1e8('0x22')],'include':_0x323132['include']?_[_0xc1e8('0x25')](_0x323132[_0xc1e8('0x24')],function(_0xea3934){return{'model':db[_0xea3934['model']],'as':_0xea3934['as'],'attributes':_0xea3934['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1e8('0x13')](function(_0x57a72f){logger[_0xc1e8('0x14')](_0xc1e8('0x27'),_0x2c2402);logger['debug']('GetUser',_0x2c2402,JSON[_0xc1e8('0x18')](_0x57a72f));_0x489f3c(_0x57a72f);})[_0xc1e8('0x1c')](function(_0x5c5c92){logger['error'](_0xc1e8('0x27'),_0x5c5c92[_0xc1e8('0x1b')],_0x2c2402);_0x3e988b(_0x4eb948[_0xc1e8('0x19')](0x1f4,_0x5c5c92[_0xc1e8('0x1b')]));});});};exports[_0xc1e8('0x28')]=function(_0x2cc7aa){var _0x3bcff5=this;return new Promise(function(_0x212623,_0x2c5cef){return db[_0xc1e8('0x1d')][_0xc1e8('0x29')]({'raw':_0x2cc7aa[_0xc1e8('0x1f')]?_0x2cc7aa[_0xc1e8('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2cc7aa[_0xc1e8('0x1f')]?_0x2cc7aa[_0xc1e8('0x1f')]['where']||null:null,'attributes':_0x2cc7aa['options']?_0x2cc7aa[_0xc1e8('0x1f')]['attributes']||null:null,'include':_0x2cc7aa[_0xc1e8('0x1f')]?_0x2cc7aa[_0xc1e8('0x1f')][_0xc1e8('0x24')]?_['map'](_0x2cc7aa['options'][_0xc1e8('0x24')],function(_0x4e6004){return{'model':db[_0x4e6004[_0xc1e8('0x26')]],'as':_0x4e6004['as'],'attributes':_0x4e6004['attributes'],'include':_0x4e6004['include']?_[_0xc1e8('0x25')](_0x4e6004[_0xc1e8('0x24')],function(_0x161345){return{'model':db[_0x161345[_0xc1e8('0x26')]],'as':_0x161345['as'],'attributes':_0x161345[_0xc1e8('0x22')],'include':_0x161345['include']?_['map'](_0x161345[_0xc1e8('0x24')],function(_0x50a0a5){return{'model':db[_0x50a0a5[_0xc1e8('0x26')]],'as':_0x50a0a5['as'],'attributes':_0x50a0a5[_0xc1e8('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc1e8('0x13')](function(_0x46c64c){logger['info']('ShowUser',_0x2cc7aa);logger['debug'](_0xc1e8('0x28'),_0x2cc7aa,JSON[_0xc1e8('0x18')](_0x46c64c));_0x212623(_0x46c64c);})[_0xc1e8('0x1c')](function(_0x256be4){logger[_0xc1e8('0x19')](_0xc1e8('0x28'),_0x256be4['message'],_0x2cc7aa);_0x2c5cef(_0x3bcff5['error'](0x1f4,_0x256be4['message']));});});};exports[_0xc1e8('0x2a')]=function(_0x5eefcd){var _0x4c4df4=this;return new Promise(function(_0x44f730,_0x1a5fb2){var _0xd79f6f;return db[_0xc1e8('0x1d')][_0xc1e8('0x29')]({'where':_0x5eefcd['options'][_0xc1e8('0x21')]||{},'attributes':['id','name',_0xc1e8('0x2b'),_0xc1e8('0x2c'),_0xc1e8('0x2d')]})[_0xc1e8('0x13')](function(_0x34c91d){if(_0x34c91d){_0xd79f6f=_0x34c91d;return db[_0xc1e8('0x2e')][_0xc1e8('0x2f')]({'paused':0x1},{'where':{'UserId':_0xd79f6f['id']},'individualHooks':!![]});}})[_0xc1e8('0x13')](function(){if(_0xd79f6f){return db[_0xc1e8('0x30')][_0xc1e8('0x1e')]({'where':{'membername':_0xd79f6f['name'],'type':_0xc1e8('0x31'),'exitAt':null}});}})[_0xc1e8('0x13')](function(_0x2755f8){if(_0xd79f6f){if(_0x2755f8&&_0x2755f8[_0xc1e8('0x32')]){var _0xb76541=moment()['format'](_0xc1e8('0x33'));for(var _0x1477c3=0x0,_0x73c98b=_0x2755f8[_0xc1e8('0x32')];_0x1477c3<_0x73c98b;_0x1477c3++){_0x2755f8[_0x1477c3]['updateAttributes']({'exitAt':_0xb76541});}}}})[_0xc1e8('0x13')](function(){if(_0xd79f6f){var _0x1faf59=[];var _0x469764=utils[_0xc1e8('0x34')]();_0x469764['forEach'](function(_0x230387){_0x1faf59[_0xc1e8('0x35')]({'channel':_0x230387,'membername':_0xd79f6f[_0xc1e8('0x36')],'interface':_['isNil'](_0xd79f6f[_0xc1e8('0x2d')])?util[_0xc1e8('0x37')](_0xc1e8('0x38'),_0xd79f6f['name']):_0xd79f6f[_0xc1e8('0x2d')],'type':_0xc1e8('0x31'),'enterAt':moment()['format'](_0xc1e8('0x33')),'data1':_0x5eefcd[_0xc1e8('0x39')]['type']||_0xc1e8('0x3a'),'role':_0xd79f6f[_0xc1e8('0x2b')],'internal':_0xd79f6f[_0xc1e8('0x2c')],'uniqueid':_0x5eefcd[_0xc1e8('0x39')][_0xc1e8('0x3b')]||null});});return db[_0xc1e8('0x30')]['bulkCreate'](_0x1faf59,{'individualHooks':!![]});}})['then'](function(){if(_0xd79f6f){return _0xd79f6f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5eefcd['body'][_0xc1e8('0x3c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xc1e8('0x37')](_0xc1e8('0x33'))});}})[_0xc1e8('0x13')](function(_0x49a1ce){_0x44f730(_0x49a1ce);})['catch'](function(_0x41d3a6){_0x1a5fb2(_0x4c4df4[_0xc1e8('0x19')](0x1f4,_0x41d3a6[_0xc1e8('0x1b')]));});});};exports[_0xc1e8('0x3d')]=function(_0x374ac8){var _0x1b1a94=this;return new Promise(function(_0x1f393c,_0x273e51){var _0x58ecd2;return db['User'][_0xc1e8('0x3e')]({'where':_0x374ac8['options'][_0xc1e8('0x21')]||{},'attributes':['id',_0xc1e8('0x36')]})[_0xc1e8('0x13')](function(_0x58d29c){if(_0x58d29c){_0x58ecd2=_0x58d29c;if(_0x374ac8[_0xc1e8('0x39')][_0xc1e8('0x3f')]&&!utils[_0xc1e8('0x40')](_0x374ac8['body']['channel'])){throw new Error(_0xc1e8('0x41'));}switch(_0x374ac8[_0xc1e8('0x39')][_0xc1e8('0x3f')]){case _0xc1e8('0x42'):return db[_0xc1e8('0x2e')]['update']({'paused':0x0},{'where':{'UserId':_0x58ecd2['id']}})[_0xc1e8('0x13')](function(){return db[_0xc1e8('0x30')][_0xc1e8('0x29')]({'where':{'channel':_0x374ac8[_0xc1e8('0x39')][_0xc1e8('0x3f')],'membername':_0x58ecd2[_0xc1e8('0x36')],'type':_0xc1e8('0x31'),'exitAt':null}});})[_0xc1e8('0x13')](function(_0x3a7877){if(_0x3a7877){return _0x3a7877[_0xc1e8('0x2f')]({'exitAt':moment()[_0xc1e8('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x58ecd2[_0xc1e8('0x2f')]({'voicePause':![]});});case _0xc1e8('0x43'):case _0xc1e8('0x44'):case'fax':case _0xc1e8('0x45'):case'openchannel':case _0xc1e8('0x46'):return db[_0xc1e8('0x30')][_0xc1e8('0x29')]({'where':{'channel':_0x374ac8[_0xc1e8('0x39')]['channel'],'membername':_0x58ecd2[_0xc1e8('0x36')],'type':_0xc1e8('0x31'),'exitAt':null}})[_0xc1e8('0x13')](function(_0x3dbf75){return _0x3dbf75[_0xc1e8('0x2f')]({'exitAt':moment()[_0xc1e8('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xc1e8('0x47')},{'individualHooks':!![]});})[_0xc1e8('0x13')](function(){var _0xb0bee4={};_['set'](_0xb0bee4,util['format'](_0xc1e8('0x48'),_0x374ac8[_0xc1e8('0x39')][_0xc1e8('0x3f')],_0xc1e8('0x49')),![]);return _0x58ecd2[_0xc1e8('0x2f')](_0xb0bee4);});default:return db[_0xc1e8('0x2e')]['update']({'paused':0x0},{'where':{'UserId':_0x58ecd2['id']}})['then'](function(){return db[_0xc1e8('0x30')][_0xc1e8('0x1e')]({'where':{'membername':_0x58ecd2['name'],'type':_0xc1e8('0x31'),'exitAt':null}});})[_0xc1e8('0x13')](function(_0x1b45a3){var _0x5b3816=[];_0x1b45a3[_0xc1e8('0x4a')](function(_0x5e4d9c){_0x5b3816[_0xc1e8('0x35')](_0x5e4d9c[_0xc1e8('0x2f')]({'exitAt':moment()[_0xc1e8('0x37')](_0xc1e8('0x33')),'data2':'system'}));});return BPromise['all'](_0x5b3816);})[_0xc1e8('0x13')](function(){return _0x58ecd2[_0xc1e8('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xc1e8('0x13')](function(_0x37e9bf){_0x1f393c(_0x37e9bf);})[_0xc1e8('0x1c')](function(_0x2b7fc9){_0x273e51(_0x1b1a94[_0xc1e8('0x19')](0x1f4,_0x2b7fc9['message']));});});};exports[_0xc1e8('0x4b')]=function(_0x240e80){var _0x1c6109=this;return new Promise(function(_0x1909d0,_0x3b63ac){var _0xe84750;return db[_0xc1e8('0x1d')]['findOne']({'where':_0x240e80[_0xc1e8('0x1f')]['where']||{},'attributes':['id',_0xc1e8('0x36')]})['then'](function(_0x36fc19){if(_0x36fc19){_0xe84750=_0x36fc19;return db[_0xc1e8('0x2e')]['destroy']({'where':{'membername':_0xe84750[_0xc1e8('0x36')]},'individualHooks':!![]});}})[_0xc1e8('0x13')](function(){if(_0xe84750){return db[_0xc1e8('0x30')][_0xc1e8('0x1e')]({'where':{'membername':_0xe84750[_0xc1e8('0x36')],'exitAt':null}});}})['then'](function(_0x2341e8){if(_0xe84750){if(_0x2341e8&&_0x2341e8[_0xc1e8('0x32')]){var _0x4a0577=[];_0x2341e8[_0xc1e8('0x4a')](function(_0x22946d){_0x4a0577[_0xc1e8('0x35')](_0x22946d[_0xc1e8('0x2f')]({'exitAt':moment()['format'](_0xc1e8('0x33'))}));});return BPromise['all'](_0x4a0577);}}})[_0xc1e8('0x13')](function(){if(_0xe84750){return _0xe84750[_0xc1e8('0x2f')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x26be17){_0x1909d0(_0x26be17);})['catch'](function(_0x24744f){_0x3b63ac(_0x1c6109['error'](0x1f4,_0x24744f[_0xc1e8('0x1b')]));});});};exports[_0xc1e8('0x4c')]=function(_0x394a68){var _0x871c1e=this;return new Promise(function(_0x45f494,_0x3d9804){var _0x284749;var _0xbc894a;var _0xf7c017;var _0x10159b;return db[_0xc1e8('0x1d')][_0xc1e8('0x3e')]({'where':_0x394a68['options']['where']||{},'attributes':['id',_0xc1e8('0x36'),'role','mobile','phone',_0xc1e8('0x2c'),_0xc1e8('0x4d'),_0xc1e8('0x2d')]})[_0xc1e8('0x13')](function(_0xe1bd20){if(_0xe1bd20){_0x284749=_0xe1bd20;_0x10159b=_0x394a68[_0xc1e8('0x39')][_0xc1e8('0x2d')]?_0x394a68[_0xc1e8('0x39')][_0xc1e8('0x2d')]:util['format']('SIP/%s',_0x284749[_0xc1e8('0x36')]);return db['User'][_0xc1e8('0x4e')]({'where':{'role':_0xc1e8('0x4f'),'online':!![],'id':{'$ne':_0x284749['id']}}});}})[_0xc1e8('0x13')](function(_0x271406){if(_0x271406){_0xf7c017=_0x271406;return require('../../config/license/util')[_0xc1e8('0x50')]();}})[_0xc1e8('0x13')](function(_0x2b18f7){if(_0x2b18f7&&_0x2b18f7[_0xc1e8('0x51')]&&_0xf7c017>=_0x2b18f7[_0xc1e8('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xc1e8('0x13')](function(){if(_0x284749){return db['UserVoiceQueueRt'][_0xc1e8('0x52')]({'where':{'membername':_0x284749[_0xc1e8('0x36')]},'individualHooks':!![]});}})[_0xc1e8('0x13')](function(){if(_0x284749){return _0x284749[_0xc1e8('0x53')]({'raw':!![]});}})[_0xc1e8('0x13')](function(_0x448453){if(_0x284749){if(_0x448453){var _0x584aa8=[];_0xbc894a=_0x448453;if(_0xbc894a[_0xc1e8('0x32')]){for(var _0x4492d5=0x0;_0x4492d5<_0xbc894a['length'];_0x4492d5++){_0x584aa8[_0xc1e8('0x35')](db[_0xc1e8('0x2e')][_0xc1e8('0x54')]({'membername':_0x284749[_0xc1e8('0x36')],'UserId':_0x284749['id'],'queue_name':_0xbc894a[_0x4492d5][_0xc1e8('0x36')],'VoiceQueueId':_0xbc894a[_0x4492d5]['id'],'interface':_0x10159b,'paused':_0x284749[_0xc1e8('0x4d')]||![],'penalty':_0xbc894a[_0x4492d5]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x584aa8);}}}})['then'](function(){if(_0x284749){return db[_0xc1e8('0x30')][_0xc1e8('0x1e')]({'where':{'membername':_0x284749['name'],'exitAt':null}});}})[_0xc1e8('0x13')](function(_0x506f36){if(_0x284749){if(_0x506f36&&_0x506f36[_0xc1e8('0x32')]){var _0x4d1adb=[];_0x506f36[_0xc1e8('0x4a')](function(_0x15353e){_0x4d1adb['push'](_0x15353e[_0xc1e8('0x2f')]({'exitAt':moment()[_0xc1e8('0x37')](_0xc1e8('0x33'))}));});return BPromise[_0xc1e8('0x55')](_0x4d1adb);}}})['then'](function(_0x1597dc){if(_0x284749){var _0x3e8df7=[];var _0x3c10e8=[];var _0x1054f5=utils[_0xc1e8('0x34')]();var _0xc203c8={'membername':_0x284749[_0xc1e8('0x36')],'interface':_0x10159b,'enterAt':moment()[_0xc1e8('0x37')](_0xc1e8('0x33')),'role':_0x284749[_0xc1e8('0x2b')],'internal':_0x284749[_0xc1e8('0x2c')]};_0x1054f5[_0xc1e8('0x4a')](function(_0x2a6cc1){_0x3e8df7[_0xc1e8('0x35')](_[_0xc1e8('0x56')]({'channel':_0x2a6cc1,'type':_0xc1e8('0x57'),'data1':_0xc1e8('0x58'),'data2':_0x10159b},_0xc203c8));if(_0x284749[_0xc1e8('0x4d')]){_0x3c10e8[_0xc1e8('0x35')](_[_0xc1e8('0x56')]({'channel':_0x2a6cc1,'type':_0xc1e8('0x31'),'data1':_0xc1e8('0x59')},_0xc203c8));}});return db[_0xc1e8('0x30')]['bulkCreate'](_0x3e8df7[_0xc1e8('0x5a')](_0x3c10e8),{'individualHooks':!![]});}})[_0xc1e8('0x13')](function(){if(_0x284749){return _0x284749[_0xc1e8('0x2f')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x284749[_0xc1e8('0x4d')]||![],'mailPause':_0x284749[_0xc1e8('0x4d')]||![],'chatPause':_0x284749[_0xc1e8('0x4d')]||![],'faxPause':_0x284749[_0xc1e8('0x4d')]||![],'smsPause':_0x284749[_0xc1e8('0x4d')]||![],'openchannelPause':_0x284749[_0xc1e8('0x4d')]||![],'pauseType':_0x284749[_0xc1e8('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xc1e8('0x33')),'interface':_0x10159b});}})[_0xc1e8('0x13')](function(_0x20265a){_0x45f494(_0x20265a);})[_0xc1e8('0x1c')](function(_0x5e07fe){_0x3d9804(_0x871c1e[_0xc1e8('0x19')](0x1f4,_0x5e07fe[_0xc1e8('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a456458..f170bed 100644 --- a/server/api/user/user.socket.js +++ b/server/api/user/user.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x655e=['save','update','emit','removeListener','register','user:','./user.events'];(function(_0x1b3227,_0x47dc4d){var _0x22c765=function(_0xe93404){while(--_0xe93404){_0x1b3227['push'](_0x1b3227['shift']());}};_0x22c765(++_0x47dc4d);}(_0x655e,0x109));var _0xe655=function(_0x12c8ca,_0x116d35){_0x12c8ca=_0x12c8ca-0x0;var _0x52a409=_0x655e[_0x12c8ca];return _0x52a409;};'use strict';var UserEvents=require(_0xe655('0x0'));var events=[_0xe655('0x1'),'remove',_0xe655('0x2')];function createListener(_0x332ea7,_0x3e2e6c){return function(_0x3f9c56){_0x3e2e6c[_0xe655('0x3')](_0x332ea7,_0x3f9c56);};}function removeListener(_0x562643,_0x2f294d){return function(){UserEvents[_0xe655('0x4')](_0x562643,_0x2f294d);};}exports[_0xe655('0x5')]=function(_0x3b4ce8){for(var _0x427338=0x0,_0x355b20=events['length'];_0x427338<_0x355b20;_0x427338++){var _0xde71d3=events[_0x427338];var _0x53133c=createListener(_0xe655('0x6')+_0xde71d3,_0x3b4ce8);UserEvents['on'](_0xde71d3,_0x53133c);}}; \ No newline at end of file +var _0x354e=['emit','removeListener','register','user:','./user.events','save','remove'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x354e,0xba));var _0xe354=function(_0x2a9c86,_0x92e104){_0x2a9c86=_0x2a9c86-0x0;var _0x1ee0da=_0x354e[_0x2a9c86];return _0x1ee0da;};'use strict';var UserEvents=require(_0xe354('0x0'));var events=[_0xe354('0x1'),_0xe354('0x2'),'update'];function createListener(_0x40e1c0,_0x2c1753){return function(_0x7ff0bb){_0x2c1753[_0xe354('0x3')](_0x40e1c0,_0x7ff0bb);};}function removeListener(_0x4ed69f,_0x8ec156){return function(){UserEvents[_0xe354('0x4')](_0x4ed69f,_0x8ec156);};}exports[_0xe354('0x5')]=function(_0xda518c){for(var _0x2a3c22=0x0,_0x3d0747=events['length'];_0x2a3c22<_0x3d0747;_0x2a3c22++){var _0x1181bd=events[_0x2a3c22];var _0x62dd9a=createListener(_0xe354('0x6')+_0x1181bd,_0xda518c);UserEvents['on'](_0x1181bd,_0x62dd9a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 8c6d109..521d0e0 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fe7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x2b1460,_0x4cbcbb){var _0x52699d=function(_0x2d1523){while(--_0x2d1523){_0x2b1460['push'](_0x2b1460['shift']());}};_0x52699d(++_0x4cbcbb);}(_0x4fe7,0x73));var _0x74fe=function(_0x8942b3,_0x2e2451){_0x8942b3=_0x8942b3-0x0;var _0x22d876=_0x4fe7[_0x8942b3];return _0x22d876;};'use strict';var multer=require(_0x74fe('0x0'));var util=require(_0x74fe('0x1'));var path=require(_0x74fe('0x2'));var timeout=require(_0x74fe('0x3'));var express=require(_0x74fe('0x4'));var router=express[_0x74fe('0x5')]();var auth=require(_0x74fe('0x6'));var interaction=require(_0x74fe('0x7'));var config=require(_0x74fe('0x8'));module[_0x74fe('0x9')]=router; \ No newline at end of file +var _0x065f=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','path'];(function(_0x5be342,_0x433d45){var _0x2c0a04=function(_0x115568){while(--_0x115568){_0x5be342['push'](_0x5be342['shift']());}};_0x2c0a04(++_0x433d45);}(_0x065f,0x1df));var _0xf065=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x065f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf065('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf065('0x1'));var interaction=require(_0xf065('0x2'));var config=require(_0xf065('0x3'));module[_0xf065('0x4')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c7bfab2..b7e02cc 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x5a38a6,_0x3c9622){var _0x380124=function(_0x1745bc){while(--_0x1745bc){_0x5a38a6['push'](_0x5a38a6['shift']());}};_0x380124(++_0x3c9622);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x34e29e,_0x3d6df5){var _0x4d0088=function(_0x317af6){while(--_0x317af6){_0x34e29e['push'](_0x34e29e['shift']());}};_0x4d0088(++_0x3d6df5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index d35588c..776c119 100644 --- a/server/api/userChatQueue/userChatQueue.model.js +++ b/server/api/userChatQueue/userChatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x582b=['./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x582b,0x185));var _0xb582=function(_0x372594,_0x38c3ae){_0x372594=_0x372594-0x0;var _0x83765d=_0x582b[_0x372594];return _0x83765d;};'use strict';var _=require('lodash');var util=require(_0xb582('0x0'));var logger=require(_0xb582('0x1'))('api');var moment=require(_0xb582('0x2'));var BPromise=require('bluebird');var rp=require(_0xb582('0x3'));var fs=require('fs');var path=require(_0xb582('0x4'));var rimraf=require(_0xb582('0x5'));var config=require(_0xb582('0x6'));var attributes=require(_0xb582('0x7'));module[_0xb582('0x8')]=function(_0x35719b,_0x307fa7){return _0x35719b['define'](_0xb582('0x9'),attributes,{'tableName':_0xb582('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x286a=['../../config/logger','api','path','./userChatQueue.attributes','lodash','util'];(function(_0x536732,_0x5212e5){var _0x35ef50=function(_0x365b2f){while(--_0x365b2f){_0x536732['push'](_0x536732['shift']());}};_0x35ef50(++_0x5212e5);}(_0x286a,0x76));var _0xa286=function(_0x5f9fba,_0x253261){_0x5f9fba=_0x5f9fba-0x0;var _0x2b8664=_0x286a[_0x5f9fba];return _0x2b8664;};'use strict';var _=require(_0xa286('0x0'));var util=require(_0xa286('0x1'));var logger=require(_0xa286('0x2'))(_0xa286('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa286('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa286('0x5'));module['exports']=function(_0x5a8a2c,_0x3815be){return _0x5a8a2c['define']('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 14a9db7..72b5115 100644 --- a/server/api/userChatQueue/userChatQueue.rpc.js +++ b/server/api/userChatQueue/userChatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x202e=['UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2295a6,_0x5c7f21){var _0x38055b=function(_0x3b93d7){while(--_0x3b93d7){_0x2295a6['push'](_0x2295a6['shift']());}};_0x38055b(++_0x5c7f21);}(_0x202e,0xef));var _0xe202=function(_0x4d50f4,_0x135628){_0x4d50f4=_0x4d50f4-0x0;var _0xf1acf3=_0x202e[_0x4d50f4];return _0xf1acf3;};'use strict';var _=require(_0xe202('0x0'));var util=require(_0xe202('0x1'));var moment=require('moment');var BPromise=require(_0xe202('0x2'));var rs=require(_0xe202('0x3'));var fs=require('fs');var Redis=require(_0xe202('0x4'));var db=require(_0xe202('0x5'))['db'];var utils=require(_0xe202('0x6'));var logger=require('../../config/logger')(_0xe202('0x7'));var config=require(_0xe202('0x8'));var jayson=require(_0xe202('0x9'));var client=jayson[_0xe202('0xa')][_0xe202('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5be72d,_0x145dce,_0x32e8a1){return new BPromise(function(_0x1bf27d,_0x249c03){return client['request'](_0x5be72d,_0x32e8a1)[_0xe202('0xc')](function(_0x60808b){logger[_0xe202('0xd')](_0xe202('0xe'),_0x145dce,'request\x20sent');logger[_0xe202('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x145dce,_0xe202('0x10'),JSON[_0xe202('0x11')](_0x60808b));if(_0x60808b['error']){if(_0x60808b['error'][_0xe202('0x12')]===0x1f4){logger['error'](_0xe202('0xe'),_0x145dce,_0x60808b[_0xe202('0x13')]['message']);return _0x249c03(_0x60808b[_0xe202('0x13')]['message']);}logger[_0xe202('0x13')](_0xe202('0xe'),_0x145dce,_0x60808b[_0xe202('0x13')][_0xe202('0x14')]);return _0x1bf27d(_0x60808b[_0xe202('0x13')][_0xe202('0x14')]);}else{logger[_0xe202('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x145dce,'request\x20sent');_0x1bf27d(_0x60808b[_0xe202('0x15')][_0xe202('0x14')]);}})[_0xe202('0x16')](function(_0x109618){logger[_0xe202('0x13')](_0xe202('0xe'),_0x145dce,_0x109618);_0x249c03(_0x109618);});});} \ No newline at end of file +var _0xe18f=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','error','code','message','UserChatQueue,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe18f,0x1b2));var _0xfe18=function(_0x44969c,_0x17151e){_0x44969c=_0x44969c-0x0;var _0x48afb3=_0xe18f[_0x44969c];return _0x48afb3;};'use strict';var _=require('lodash');var util=require(_0xfe18('0x0'));var moment=require('moment');var BPromise=require(_0xfe18('0x1'));var rs=require(_0xfe18('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe18('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe18('0x4'))(_0xfe18('0x5'));var config=require(_0xfe18('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x427a1f,_0xfd3c1e,_0x6a63ee){return new BPromise(function(_0xf9ba5e,_0x4a9846){return client[_0xfe18('0x7')](_0x427a1f,_0x6a63ee)[_0xfe18('0x8')](function(_0x1122f4){logger[_0xfe18('0x9')]('UserChatQueue,\x20%s,\x20%s',_0xfd3c1e,_0xfe18('0xa'));logger[_0xfe18('0xb')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xfd3c1e,_0xfe18('0xa'),JSON['stringify'](_0x1122f4));if(_0x1122f4[_0xfe18('0xc')]){if(_0x1122f4[_0xfe18('0xc')][_0xfe18('0xd')]===0x1f4){logger[_0xfe18('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xfd3c1e,_0x1122f4[_0xfe18('0xc')][_0xfe18('0xe')]);return _0x4a9846(_0x1122f4[_0xfe18('0xc')][_0xfe18('0xe')]);}logger[_0xfe18('0xc')](_0xfe18('0xf'),_0xfd3c1e,_0x1122f4[_0xfe18('0xc')][_0xfe18('0xe')]);return _0xf9ba5e(_0x1122f4[_0xfe18('0xc')][_0xfe18('0xe')]);}else{logger[_0xfe18('0x9')](_0xfe18('0xf'),_0xfd3c1e,_0xfe18('0xa'));_0xf9ba5e(_0x1122f4[_0xfe18('0x10')]['message']);}})[_0xfe18('0x11')](function(_0x42d90c){logger[_0xfe18('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xfd3c1e,_0x42d90c);_0x4a9846(_0x42d90c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9f70516..517e7cb 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa921=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x7ec0ec,_0x127fb7){var _0x33f049=function(_0x4fc6c5){while(--_0x4fc6c5){_0x7ec0ec['push'](_0x7ec0ec['shift']());}};_0x33f049(++_0x127fb7);}(_0xa921,0xd9));var _0x1a92=function(_0x2ffc6c,_0x125925){_0x2ffc6c=_0x2ffc6c-0x0;var _0x4b3590=_0xa921[_0x2ffc6c];return _0x4b3590;};'use strict';var multer=require(_0x1a92('0x0'));var util=require(_0x1a92('0x1'));var path=require(_0x1a92('0x2'));var timeout=require('connect-timeout');var express=require(_0x1a92('0x3'));var router=express[_0x1a92('0x4')]();var auth=require(_0x1a92('0x5'));var interaction=require(_0x1a92('0x6'));var config=require('../../config/environment');module[_0x1a92('0x7')]=router; \ No newline at end of file +var _0x665c=['multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3182bb,_0x4aaf26){var _0xf2be5a=function(_0x580af4){while(--_0x580af4){_0x3182bb['push'](_0x3182bb['shift']());}};_0xf2be5a(++_0x4aaf26);}(_0x665c,0x1e3));var _0xc665=function(_0x594f5f,_0x1ed564){_0x594f5f=_0x594f5f-0x0;var _0x357dea=_0x665c[_0x594f5f];return _0x357dea;};'use strict';var multer=require(_0xc665('0x0'));var util=require(_0xc665('0x1'));var path=require(_0xc665('0x2'));var timeout=require('connect-timeout');var express=require(_0xc665('0x3'));var router=express[_0xc665('0x4')]();var auth=require(_0xc665('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc665('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 942303f..3eac270 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['STRING','exports','INTEGER'];(function(_0x507d77,_0x425049){var _0x1bddbf=function(_0x459ccd){while(--_0x459ccd){_0x507d77['push'](_0x507d77['shift']());}};_0x1bddbf(++_0x425049);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'penalty':{'type':Sequelize[_0x5177('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5177('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5177('0x2')]}}; \ No newline at end of file +var _0x4cf8=['STRING','sequelize','exports','INTEGER'];(function(_0x41d300,_0x2d0c64){var _0x1e02e7=function(_0x19e308){while(--_0x19e308){_0x41d300['push'](_0x41d300['shift']());}};_0x1e02e7(++_0x2d0c64);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xc8a02c,_0x4809d3){_0xc8a02c=_0xc8a02c-0x0;var _0x3d89da=_0x4cf8[_0xc8a02c];return _0x3d89da;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'penalty':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x84cf('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index dc477bd..d0a7d93 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7a8=['path','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26f688,_0x873a6b){var _0x4be1fa=function(_0x35007e){while(--_0x35007e){_0x26f688['push'](_0x26f688['shift']());}};_0x4be1fa(++_0x873a6b);}(_0xb7a8,0x95));var _0x8b7a=function(_0x5e2de9,_0x345caf){_0x5e2de9=_0x5e2de9-0x0;var _0x418d25=_0xb7a8[_0x5e2de9];return _0x418d25;};'use strict';var _=require(_0x8b7a('0x0'));var util=require(_0x8b7a('0x1'));var logger=require(_0x8b7a('0x2'))(_0x8b7a('0x3'));var moment=require(_0x8b7a('0x4'));var BPromise=require(_0x8b7a('0x5'));var rp=require(_0x8b7a('0x6'));var fs=require('fs');var path=require(_0x8b7a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8b7a('0x8'));module[_0x8b7a('0x9')]=function(_0x2546d7,_0x350dbf){return _0x2546d7[_0x8b7a('0xa')](_0x8b7a('0xb'),attributes,{'tableName':_0x8b7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b74=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4b74,0x103));var _0x44b7=function(_0x388be2,_0x15d334){_0x388be2=_0x388be2-0x0;var _0x26b754=_0x4b74[_0x388be2];return _0x26b754;};'use strict';var _=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var logger=require(_0x44b7('0x2'))('api');var moment=require(_0x44b7('0x3'));var BPromise=require(_0x44b7('0x4'));var rp=require(_0x44b7('0x5'));var fs=require('fs');var path=require(_0x44b7('0x6'));var rimraf=require(_0x44b7('0x7'));var config=require(_0x44b7('0x8'));var attributes=require(_0x44b7('0x9'));module[_0x44b7('0xa')]=function(_0x5ef96c,_0xdfcf5){return _0x5ef96c[_0x44b7('0xb')](_0x44b7('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index c3c45cc..cac53a4 100644 --- a/server/api/userFaxQueue/userFaxQueue.rpc.js +++ b/server/api/userFaxQueue/userFaxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c6a=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x19787d,_0x2a5ff0){var _0x5447b4=function(_0x2614c9){while(--_0x2614c9){_0x19787d['push'](_0x19787d['shift']());}};_0x5447b4(++_0x2a5ff0);}(_0x3c6a,0xd1));var _0xa3c6=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0x3c6a[_0x4b4d43];return _0x5706ba;};'use strict';var _=require('lodash');var util=require(_0xa3c6('0x0'));var moment=require(_0xa3c6('0x1'));var BPromise=require(_0xa3c6('0x2'));var rs=require(_0xa3c6('0x3'));var fs=require('fs');var Redis=require(_0xa3c6('0x4'));var db=require(_0xa3c6('0x5'))['db'];var utils=require(_0xa3c6('0x6'));var logger=require(_0xa3c6('0x7'))(_0xa3c6('0x8'));var config=require(_0xa3c6('0x9'));var jayson=require(_0xa3c6('0xa'));var client=jayson['client'][_0xa3c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cae92,_0x1ce825,_0x1b814b){return new BPromise(function(_0x43c5c0,_0xa4d22){return client[_0xa3c6('0xc')](_0x1cae92,_0x1b814b)[_0xa3c6('0xd')](function(_0x24c520){logger[_0xa3c6('0xe')](_0xa3c6('0xf'),_0x1ce825,'request\x20sent');logger[_0xa3c6('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1ce825,_0xa3c6('0x11'),JSON[_0xa3c6('0x12')](_0x24c520));if(_0x24c520[_0xa3c6('0x13')]){if(_0x24c520['error']['code']===0x1f4){logger['error'](_0xa3c6('0xf'),_0x1ce825,_0x24c520['error'][_0xa3c6('0x14')]);return _0xa4d22(_0x24c520[_0xa3c6('0x13')][_0xa3c6('0x14')]);}logger[_0xa3c6('0x13')](_0xa3c6('0xf'),_0x1ce825,_0x24c520[_0xa3c6('0x13')][_0xa3c6('0x14')]);return _0x43c5c0(_0x24c520['error'][_0xa3c6('0x14')]);}else{logger[_0xa3c6('0xe')](_0xa3c6('0xf'),_0x1ce825,'request\x20sent');_0x43c5c0(_0x24c520[_0xa3c6('0x15')]['message']);}})[_0xa3c6('0x16')](function(_0x4ad5dc){logger[_0xa3c6('0x13')](_0xa3c6('0xf'),_0x1ce825,_0x4ad5dc);_0xa4d22(_0x4ad5dc);});});} \ No newline at end of file +var _0x0216=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xa651d4,_0x5df6cb){var _0x1301be=function(_0x5aa409){while(--_0x5aa409){_0xa651d4['push'](_0xa651d4['shift']());}};_0x1301be(++_0x5df6cb);}(_0x0216,0x1c4));var _0x6021=function(_0x2e5f80,_0x5de3ce){_0x2e5f80=_0x2e5f80-0x0;var _0x2804a4=_0x0216[_0x2e5f80];return _0x2804a4;};'use strict';var _=require(_0x6021('0x0'));var util=require(_0x6021('0x1'));var moment=require(_0x6021('0x2'));var BPromise=require(_0x6021('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6021('0x4'));var db=require(_0x6021('0x5'))['db'];var utils=require(_0x6021('0x6'));var logger=require(_0x6021('0x7'))(_0x6021('0x8'));var config=require(_0x6021('0x9'));var jayson=require(_0x6021('0xa'));var client=jayson[_0x6021('0xb')][_0x6021('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3391ad,_0x16b07e,_0x587c6e){return new BPromise(function(_0xe58d1,_0x53843c){return client[_0x6021('0xd')](_0x3391ad,_0x587c6e)[_0x6021('0xe')](function(_0x3dc766){logger[_0x6021('0xf')](_0x6021('0x10'),_0x16b07e,_0x6021('0x11'));logger['debug'](_0x6021('0x12'),_0x16b07e,'request\x20sent',JSON['stringify'](_0x3dc766));if(_0x3dc766['error']){if(_0x3dc766[_0x6021('0x13')]['code']===0x1f4){logger[_0x6021('0x13')](_0x6021('0x10'),_0x16b07e,_0x3dc766[_0x6021('0x13')]['message']);return _0x53843c(_0x3dc766['error']['message']);}logger[_0x6021('0x13')](_0x6021('0x10'),_0x16b07e,_0x3dc766['error'][_0x6021('0x14')]);return _0xe58d1(_0x3dc766[_0x6021('0x13')][_0x6021('0x14')]);}else{logger[_0x6021('0xf')](_0x6021('0x10'),_0x16b07e,_0x6021('0x11'));_0xe58d1(_0x3dc766[_0x6021('0x15')][_0x6021('0x14')]);}})[_0x6021('0x16')](function(_0x1f85a2){logger[_0x6021('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x16b07e,_0x1f85a2);_0x53843c(_0x1f85a2);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 337b426..a8d95de 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd5c=['../../config/environment','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0xdd5c,0xda));var _0xcdd5=function(_0x379ee5,_0x336c42){_0x379ee5=_0x379ee5-0x0;var _0x114694=_0xdd5c[_0x379ee5];return _0x114694;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcdd5('0x0'));var express=require(_0xcdd5('0x1'));var router=express[_0xcdd5('0x2')]();var auth=require(_0xcdd5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcdd5('0x4'));module[_0xcdd5('0x5')]=router; \ No newline at end of file +var _0xe20c=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5528ea,_0x4d95cf){var _0x1253b8=function(_0x972d5d){while(--_0x972d5d){_0x5528ea['push'](_0x5528ea['shift']());}};_0x1253b8(++_0x4d95cf);}(_0xe20c,0x8d));var _0xce20=function(_0x196beb,_0x8f007){_0x196beb=_0x196beb-0x0;var _0x2f3049=_0xe20c[_0x196beb];return _0x2f3049;};'use strict';var multer=require(_0xce20('0x0'));var util=require(_0xce20('0x1'));var path=require(_0xce20('0x2'));var timeout=require('connect-timeout');var express=require(_0xce20('0x3'));var router=express['Router']();var auth=require(_0xce20('0x4'));var interaction=require(_0xce20('0x5'));var config=require('../../config/environment');module[_0xce20('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index f47b615..7eb5fc3 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1efe72,_0x45f360){var _0x4d988a=function(_0x5166d7){while(--_0x5166d7){_0x1efe72['push'](_0x1efe72['shift']());}};_0x4d988a(++_0x45f360);}(_0xe706,0xa3));var _0x6e70=function(_0x12c076,_0x5bef17){_0x12c076=_0x12c076-0x0;var _0x2ddd18=_0xe706[_0x12c076];return _0x2ddd18;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index a40cbb2..b07465c 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1bf9c0,_0xfe30f7){var _0x5ae697=function(_0x2cc210){while(--_0x2cc210){_0x1bf9c0['push'](_0x1bf9c0['shift']());}};_0x5ae697(++_0xfe30f7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x212a8e,_0x259099){var _0x1cbbc7=function(_0x1ef08c){while(--_0x1ef08c){_0x212a8e['push'](_0x212a8e['shift']());}};_0x1cbbc7(++_0x259099);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index b179af1..7e78b2a 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x3a0d3c,_0xbb8ba8){var _0x316bfd=function(_0x4dd88a){while(--_0x4dd88a){_0x3a0d3c['push'](_0x3a0d3c['shift']());}};_0x316bfd(++_0xbb8ba8);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5bef63,_0x18c5bc){_0x5bef63=_0x5bef63-0x0;var _0x38ab17=_0xdbf5[_0x5bef63];return _0x38ab17;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file +var _0x7a8d=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x7a8d,0x185));var _0xd7a8=function(_0x23be27,_0x4a5655){_0x23be27=_0x23be27-0x0;var _0x5c270f=_0x7a8d[_0x23be27];return _0x5c270f;};'use strict';var _=require(_0xd7a8('0x0'));var util=require(_0xd7a8('0x1'));var moment=require(_0xd7a8('0x2'));var BPromise=require('bluebird');var rs=require(_0xd7a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7a8('0x4'))['db'];var utils=require(_0xd7a8('0x5'));var logger=require('../../config/logger')(_0xd7a8('0x6'));var config=require(_0xd7a8('0x7'));var jayson=require(_0xd7a8('0x8'));var client=jayson[_0xd7a8('0x9')][_0xd7a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x579f5d,_0x343e6a,_0x1c5050){return new BPromise(function(_0x3bda3b,_0x3d5f77){return client[_0xd7a8('0xb')](_0x579f5d,_0x1c5050)[_0xd7a8('0xc')](function(_0x2a2d90){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x343e6a,_0xd7a8('0xd'));logger[_0xd7a8('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x343e6a,_0xd7a8('0xd'),JSON[_0xd7a8('0xf')](_0x2a2d90));if(_0x2a2d90['error']){if(_0x2a2d90[_0xd7a8('0x10')][_0xd7a8('0x11')]===0x1f4){logger[_0xd7a8('0x10')](_0xd7a8('0x12'),_0x343e6a,_0x2a2d90['error']['message']);return _0x3d5f77(_0x2a2d90['error'][_0xd7a8('0x13')]);}logger[_0xd7a8('0x10')](_0xd7a8('0x12'),_0x343e6a,_0x2a2d90[_0xd7a8('0x10')][_0xd7a8('0x13')]);return _0x3bda3b(_0x2a2d90['error'][_0xd7a8('0x13')]);}else{logger['info'](_0xd7a8('0x12'),_0x343e6a,_0xd7a8('0xd'));_0x3bda3b(_0x2a2d90[_0xd7a8('0x14')][_0xd7a8('0x13')]);}})[_0xd7a8('0x15')](function(_0x37918e){logger[_0xd7a8('0x10')](_0xd7a8('0x12'),_0x343e6a,_0x37918e);_0x3d5f77(_0x37918e);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 7c387e4..c55c06a 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef78=['../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xef78,0x18b));var _0x8ef7=function(_0x785b85,_0x2bd057){_0x785b85=_0x785b85-0x0;var _0xaddcc5=_0xef78[_0x785b85];return _0xaddcc5;};'use strict';var multer=require(_0x8ef7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ef7('0x1'));var express=require(_0x8ef7('0x2'));var router=express[_0x8ef7('0x3')]();var auth=require(_0x8ef7('0x4'));var interaction=require(_0x8ef7('0x5'));var config=require(_0x8ef7('0x6'));module[_0x8ef7('0x7')]=router; \ No newline at end of file +var _0x264f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x4db1d7,_0xe0d557){var _0x53f2d7=function(_0x167c55){while(--_0x167c55){_0x4db1d7['push'](_0x4db1d7['shift']());}};_0x53f2d7(++_0xe0d557);}(_0x264f,0x184));var _0xf264=function(_0x35fbfa,_0x1c219f){_0x35fbfa=_0x35fbfa-0x0;var _0xe51b5e=_0x264f[_0x35fbfa];return _0xe51b5e;};'use strict';var multer=require(_0xf264('0x0'));var util=require(_0xf264('0x1'));var path=require(_0xf264('0x2'));var timeout=require(_0xf264('0x3'));var express=require(_0xf264('0x4'));var router=express[_0xf264('0x5')]();var auth=require(_0xf264('0x6'));var interaction=require(_0xf264('0x7'));var config=require(_0xf264('0x8'));module[_0xf264('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 090d59d..8eaa7f9 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x349b5c,_0x55e5fa){var _0x3efcac=function(_0x27832d){while(--_0x27832d){_0x349b5c['push'](_0x349b5c['shift']());}};_0x3efcac(++_0x55e5fa);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index d9d1114..48b243d 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6646=['api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger'];(function(_0x3aec1e,_0x3be4a2){var _0x4df3d7=function(_0x4c92c6){while(--_0x4c92c6){_0x3aec1e['push'](_0x3aec1e['shift']());}};_0x4df3d7(++_0x3be4a2);}(_0x6646,0x6d));var _0x6664=function(_0x514b87,_0x289744){_0x514b87=_0x514b87-0x0;var _0x28bf7b=_0x6646[_0x514b87];return _0x28bf7b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6664('0x0'))(_0x6664('0x1'));var moment=require(_0x6664('0x2'));var BPromise=require(_0x6664('0x3'));var rp=require(_0x6664('0x4'));var fs=require('fs');var path=require(_0x6664('0x5'));var rimraf=require(_0x6664('0x6'));var config=require('../../config/environment');var attributes=require(_0x6664('0x7'));module['exports']=function(_0x2c5b76,_0x12c82d){return _0x2c5b76[_0x6664('0x8')](_0x6664('0x9'),attributes,{'tableName':_0x6664('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf82=['moment','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x146c3d,_0x152dbd){var _0x33423e=function(_0x5a1728){while(--_0x5a1728){_0x146c3d['push'](_0x146c3d['shift']());}};_0x33423e(++_0x152dbd);}(_0xcf82,0xf8));var _0x2cf8=function(_0x2b94b6,_0x32450c){_0x2b94b6=_0x2b94b6-0x0;var _0x3b218c=_0xcf82[_0x2b94b6];return _0x3b218c;};'use strict';var _=require(_0x2cf8('0x0'));var util=require(_0x2cf8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2cf8('0x2'));var BPromise=require(_0x2cf8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2cf8('0x4'));var config=require(_0x2cf8('0x5'));var attributes=require(_0x2cf8('0x6'));module[_0x2cf8('0x7')]=function(_0x255b38,_0x3c09ec){return _0x255b38['define'](_0x2cf8('0x8'),attributes,{'tableName':_0x2cf8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 4023df1..b9ec812 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0283=['error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x565bbe,_0x4abfb8){var _0xb22387=function(_0x579da1){while(--_0x579da1){_0x565bbe['push'](_0x565bbe['shift']());}};_0xb22387(++_0x4abfb8);}(_0x0283,0x1d8));var _0x3028=function(_0x10bf5d,_0x10a3a9){_0x10bf5d=_0x10bf5d-0x0;var _0x27f511=_0x0283[_0x10bf5d];return _0x27f511;};'use strict';var _=require('lodash');var util=require(_0x3028('0x0'));var moment=require(_0x3028('0x1'));var BPromise=require('bluebird');var rs=require(_0x3028('0x2'));var fs=require('fs');var Redis=require(_0x3028('0x3'));var db=require(_0x3028('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3028('0x5'));var config=require(_0x3028('0x6'));var jayson=require(_0x3028('0x7'));var client=jayson['client'][_0x3028('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bbaf6,_0x27a667,_0x5609c0){return new BPromise(function(_0x271517,_0x14acbf){return client['request'](_0x3bbaf6,_0x5609c0)[_0x3028('0x9')](function(_0x4fe25d){logger[_0x3028('0xa')](_0x3028('0xb'),_0x27a667,_0x3028('0xc'));logger['debug'](_0x3028('0xd'),_0x27a667,_0x3028('0xc'),JSON['stringify'](_0x4fe25d));if(_0x4fe25d[_0x3028('0xe')]){if(_0x4fe25d[_0x3028('0xe')][_0x3028('0xf')]===0x1f4){logger[_0x3028('0xe')](_0x3028('0xb'),_0x27a667,_0x4fe25d[_0x3028('0xe')]['message']);return _0x14acbf(_0x4fe25d['error'][_0x3028('0x10')]);}logger[_0x3028('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x27a667,_0x4fe25d[_0x3028('0xe')]['message']);return _0x271517(_0x4fe25d[_0x3028('0xe')][_0x3028('0x10')]);}else{logger[_0x3028('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x27a667,_0x3028('0xc'));_0x271517(_0x4fe25d['result'][_0x3028('0x10')]);}})[_0x3028('0x11')](function(_0x5323ee){logger[_0x3028('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x27a667,_0x5323ee);_0x14acbf(_0x5323ee);});});} \ No newline at end of file +var _0x74f6=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x326d37,_0x1d2511){var _0x27f6f3=function(_0x5d89cd){while(--_0x5d89cd){_0x326d37['push'](_0x326d37['shift']());}};_0x27f6f3(++_0x1d2511);}(_0x74f6,0xfc));var _0x674f=function(_0x297396,_0x4a8c79){_0x297396=_0x297396-0x0;var _0x58521f=_0x74f6[_0x297396];return _0x58521f;};'use strict';var _=require(_0x674f('0x0'));var util=require('util');var moment=require(_0x674f('0x1'));var BPromise=require('bluebird');var rs=require(_0x674f('0x2'));var fs=require('fs');var Redis=require(_0x674f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x674f('0x4'));var logger=require(_0x674f('0x5'))('rpc');var config=require(_0x674f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x674f('0x7')][_0x674f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dd294,_0x44bfbf,_0x3689ea){return new BPromise(function(_0x5644ab,_0x519239){return client[_0x674f('0x9')](_0x2dd294,_0x3689ea)['then'](function(_0x2e7d0f){logger[_0x674f('0xa')](_0x674f('0xb'),_0x44bfbf,_0x674f('0xc'));logger[_0x674f('0xd')](_0x674f('0xe'),_0x44bfbf,_0x674f('0xc'),JSON['stringify'](_0x2e7d0f));if(_0x2e7d0f[_0x674f('0xf')]){if(_0x2e7d0f['error'][_0x674f('0x10')]===0x1f4){logger[_0x674f('0xf')](_0x674f('0xb'),_0x44bfbf,_0x2e7d0f['error'][_0x674f('0x11')]);return _0x519239(_0x2e7d0f[_0x674f('0xf')][_0x674f('0x11')]);}logger[_0x674f('0xf')](_0x674f('0xb'),_0x44bfbf,_0x2e7d0f[_0x674f('0xf')]['message']);return _0x5644ab(_0x2e7d0f['error']['message']);}else{logger[_0x674f('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x44bfbf,_0x674f('0xc'));_0x5644ab(_0x2e7d0f[_0x674f('0x12')][_0x674f('0x11')]);}})['catch'](function(_0x1a2073){logger[_0x674f('0xf')](_0x674f('0xb'),_0x44bfbf,_0x1a2073);_0x519239(_0x1a2073);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 2202da1..dc3ef15 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd528=['describe','isAuthenticated','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe'];(function(_0x146446,_0x1db952){var _0x2b58d1=function(_0x562bc2){while(--_0x562bc2){_0x146446['push'](_0x146446['shift']());}};_0x2b58d1(++_0x1db952);}(_0xd528,0xd5));var _0x8d52=function(_0x35f248,_0x443910){_0x35f248=_0x35f248-0x0;var _0x442f70=_0xd528[_0x35f248];return _0x442f70;};'use strict';var multer=require(_0x8d52('0x0'));var util=require(_0x8d52('0x1'));var path=require(_0x8d52('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d52('0x3'));var router=express[_0x8d52('0x4')]();var auth=require(_0x8d52('0x5'));var interaction=require(_0x8d52('0x6'));var config=require(_0x8d52('0x7'));var controller=require(_0x8d52('0x8'));router[_0x8d52('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8d52('0x9')](_0x8d52('0xa'),auth['isAuthenticated'](),controller[_0x8d52('0xb')]);router['get']('/:id',auth[_0x8d52('0xc')](),controller['show']);router['get'](_0x8d52('0xd'),auth[_0x8d52('0xc')](),controller[_0x8d52('0xe')]);router[_0x8d52('0x9')](_0x8d52('0xf'),auth[_0x8d52('0xc')](),controller[_0x8d52('0x10')]);router[_0x8d52('0x11')]('/',auth[_0x8d52('0xc')](),controller['create']);router[_0x8d52('0x11')](_0x8d52('0x12'),auth[_0x8d52('0xc')](),controller[_0x8d52('0x13')]);router[_0x8d52('0x11')](_0x8d52('0xd'),auth[_0x8d52('0xc')](),controller[_0x8d52('0x14')]);router[_0x8d52('0x11')](_0x8d52('0xf'),auth[_0x8d52('0xc')](),controller['addResources']);router['put'](_0x8d52('0x15'),auth[_0x8d52('0xc')](),controller[_0x8d52('0x16')]);router[_0x8d52('0x17')](_0x8d52('0x15'),auth[_0x8d52('0xc')](),controller[_0x8d52('0x18')]);router[_0x8d52('0x17')](_0x8d52('0xd'),auth[_0x8d52('0xc')](),controller[_0x8d52('0x19')]);router[_0x8d52('0x17')]('/:id/resources',auth[_0x8d52('0xc')](),controller[_0x8d52('0x1a')]);module[_0x8d52('0x1b')]=router; \ No newline at end of file +var _0x1d55=['index','/describe','/:id','/:id/sections','getResources','post','addSections','/:id/resources','addResources','delete','destroy','removeSections','removeResources','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x1d55,0x189));var _0x51d5=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x1d55[_0x2b8077];return _0x308091;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x51d5('0x0'));var express=require(_0x51d5('0x1'));var router=express[_0x51d5('0x2')]();var auth=require(_0x51d5('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x51d5('0x4')]('/',auth[_0x51d5('0x5')](),controller[_0x51d5('0x6')]);router[_0x51d5('0x4')](_0x51d5('0x7'),auth[_0x51d5('0x5')](),controller['describe']);router[_0x51d5('0x4')](_0x51d5('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x51d5('0x4')](_0x51d5('0x9'),auth[_0x51d5('0x5')](),controller['getSections']);router['get']('/:id/resources',auth[_0x51d5('0x5')](),controller[_0x51d5('0xa')]);router[_0x51d5('0xb')]('/',auth[_0x51d5('0x5')](),controller['create']);router[_0x51d5('0xb')]('/:id/clone',auth[_0x51d5('0x5')](),controller['clone']);router['post'](_0x51d5('0x9'),auth[_0x51d5('0x5')](),controller[_0x51d5('0xc')]);router[_0x51d5('0xb')](_0x51d5('0xd'),auth[_0x51d5('0x5')](),controller[_0x51d5('0xe')]);router['put'](_0x51d5('0x8'),auth[_0x51d5('0x5')](),controller['update']);router[_0x51d5('0xf')]('/:id',auth[_0x51d5('0x5')](),controller[_0x51d5('0x10')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0x51d5('0x11')]);router['delete']('/:id/resources',auth[_0x51d5('0x5')](),controller[_0x51d5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 61ede6e..ffe89cd 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6738=['crudPermissions','join','getDataValue','sequelize','STRING','name','setDataValue'];(function(_0x4fdddb,_0x4ba901){var _0xc863d=function(_0x231a16){while(--_0x231a16){_0x4fdddb['push'](_0x4fdddb['shift']());}};_0xc863d(++_0x4ba901);}(_0x6738,0x16f));var _0x8673=function(_0x1c4a25,_0xd3e9ef){_0x1c4a25=_0x1c4a25-0x0;var _0x277ed7=_0x6738[_0x1c4a25];return _0x277ed7;};'use strict';var Sequelize=require(_0x8673('0x0'));module['exports']={'name':{'type':Sequelize[_0x8673('0x1')],'allowNull':![],'unique':_0x8673('0x2')},'crudPermissions':{'type':Sequelize[_0x8673('0x1')],'set':function(_0x230bbe){this[_0x8673('0x3')](_0x8673('0x4'),_0x230bbe?_0x230bbe[_0x8673('0x5')](''):[]);},'get':function(){return this[_0x8673('0x6')](_0x8673('0x4'))?this['getDataValue'](_0x8673('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8673('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xa0e2=['join','getDataValue','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0xa0e2,0xaa));var _0x2a0e=function(_0x5a46ca,_0x3f30a5){_0x5a46ca=_0x5a46ca-0x0;var _0x1606db=_0xa0e2[_0x5a46ca];return _0x1606db;};'use strict';var Sequelize=require(_0x2a0e('0x0'));module[_0x2a0e('0x1')]={'name':{'type':Sequelize[_0x2a0e('0x2')],'allowNull':![],'unique':_0x2a0e('0x3')},'crudPermissions':{'type':Sequelize[_0x2a0e('0x2')],'set':function(_0x14b3c7){this[_0x2a0e('0x4')](_0x2a0e('0x5'),_0x14b3c7?_0x14b3c7[_0x2a0e('0x6')](''):[]);},'get':function(){return this[_0x2a0e('0x7')](_0x2a0e('0x5'))?this['getDataValue'](_0x2a0e('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index b0de0c0..f2c1125 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d62=['foreignKey','associatedResources','reportId','DefaultReports','custom','rows','Tag','Tags','tag','color','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','voicequeues','queuecampaigns','users','Users','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','templates','Template','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticMetric','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','count','offset','limit','set','json','reject','update','then','destroy','end','sendStatus','error','stack','name','UserProfile','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','clone','omit','createdAt','updatedAt','body','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','push','removeSections','getSections','enabled','includes','isEmpty','sectionId','subsections','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','Sequelize','ValidationError','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','pick','key','VIRTUAL','field','AnalyticExtractedReport'];(function(_0x5800cd,_0x41c894){var _0xf01297=function(_0x4674d3){while(--_0x4674d3){_0x5800cd['push'](_0x5800cd['shift']());}};_0xf01297(++_0x41c894);}(_0x3d62,0x70));var _0x23d6=function(_0x541b2d,_0x378914){_0x541b2d=_0x541b2d-0x0;var _0x1928c1=_0x3d62[_0x541b2d];return _0x1928c1;};'use strict';var pdf=require(_0x23d6('0x0'));var emlformat=require(_0x23d6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x23d6('0x2'));var rp=require(_0x23d6('0x3'));var moment=require(_0x23d6('0x4'));var BPromise=require(_0x23d6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23d6('0x6'));var sox=require(_0x23d6('0x7'));var csv=require(_0x23d6('0x8'));var ejs=require(_0x23d6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x23d6('0xa'));var crypto=require(_0x23d6('0xb'));var jsforce=require(_0x23d6('0xc'));var deskjs=require(_0x23d6('0xd'));var toCsv=require(_0x23d6('0x8'));var querystring=require(_0x23d6('0xe'));var Papa=require(_0x23d6('0xf'));var Redis=require(_0x23d6('0x10'));var authService=require(_0x23d6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23d6('0x12'));var hardwareService=require(_0x23d6('0x13'));var logger=require(_0x23d6('0x14'))(_0x23d6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23d6('0x16'));var db=require(_0x23d6('0x17'))['db'];config[_0x23d6('0x18')]=_[_0x23d6('0x19')](config[_0x23d6('0x18')],{'host':_0x23d6('0x1a'),'port':0x18eb});var socket=require(_0x23d6('0x1b'))(new Redis(config['redis']));require('./userProfile.socket')[_0x23d6('0x1c')](socket);function respondWithStatusCode(_0x522522,_0x2572db){_0x2572db=_0x2572db||0xcc;return function(_0x20c025){if(_0x20c025){return _0x522522['sendStatus'](_0x2572db);}return _0x522522[_0x23d6('0x1d')](_0x2572db)['end']();};}function respondWithResult(_0x40322c,_0x2b0f11){_0x2b0f11=_0x2b0f11||0xc8;return function(_0x2157ff){if(_0x2157ff){return _0x40322c['status'](_0x2b0f11)['json'](_0x2157ff);}};}function respondWithFilteredResult(_0x20043c,_0x3df633){return function(_0x33ab98){if(_0x33ab98){var _0x42d40a=_0x33ab98[_0x23d6('0x1e')],_0x32d25b=_0x3df633['offset'],_0x9b125c=_0x3df633[_0x23d6('0x1f')]+_0x3df633[_0x23d6('0x20')],_0x40eecf;if(_0x9b125c>=_0x42d40a){_0x9b125c=_0x42d40a;_0x40eecf=0xc8;}else{_0x40eecf=0xce;}_0x20043c[_0x23d6('0x1d')](_0x40eecf);return _0x20043c[_0x23d6('0x21')]('Content-Range',_0x32d25b+'-'+_0x9b125c+'/'+_0x42d40a)[_0x23d6('0x22')](_0x33ab98);}return null;};}function patchUpdates(_0x9313a1){return function(_0x34dec3){try{jsonpatch['apply'](_0x34dec3,_0x9313a1,!![]);}catch(_0x41de1f){return BPromise[_0x23d6('0x23')](_0x41de1f);}return _0x34dec3['save']();};}function saveUpdates(_0x5111b6,_0x97d26c){return function(_0x1493e9){if(_0x1493e9){return _0x1493e9[_0x23d6('0x24')](_0x5111b6)[_0x23d6('0x25')](function(_0x526fd2){return _0x526fd2;});}return null;};}function removeEntity(_0x22f2d5,_0x3bddc2){return function(_0x578935){if(_0x578935){return _0x578935[_0x23d6('0x26')]()[_0x23d6('0x25')](function(){_0x22f2d5[_0x23d6('0x1d')](0xcc)[_0x23d6('0x27')]();});}};}function handleEntityNotFound(_0x257656,_0x185afb){return function(_0x4d1897){if(!_0x4d1897){_0x257656[_0x23d6('0x28')](0x194);}return _0x4d1897;};}function handleError(_0x3583ad,_0x341f4c){_0x341f4c=_0x341f4c||0x1f4;return function(_0x41db29){logger[_0x23d6('0x29')](_0x41db29[_0x23d6('0x2a')]);if(_0x41db29['name']){delete _0x41db29[_0x23d6('0x2b')];}_0x3583ad[_0x23d6('0x1d')](_0x341f4c)['send'](_0x41db29);};}exports['index']=function(_0x456b54,_0x3ce074){var _0x5ed138={},_0x2e5d4a={},_0x1b8302={'count':0x0,'rows':[]};var _0x8e307d=_['map'](db[_0x23d6('0x2c')]['rawAttributes'],function(_0xd9c204){return{'name':_0xd9c204['fieldName'],'type':_0xd9c204['type']['key']};});_0x2e5d4a[_0x23d6('0x2d')]=_[_0x23d6('0x2e')](_0x8e307d,_0x23d6('0x2b'));_0x2e5d4a[_0x23d6('0x2f')]=_[_0x23d6('0x30')](_0x456b54['query']);_0x2e5d4a[_0x23d6('0x31')]=_[_0x23d6('0x32')](_0x2e5d4a[_0x23d6('0x2d')],_0x2e5d4a[_0x23d6('0x2f')]);_0x5ed138[_0x23d6('0x33')]=_[_0x23d6('0x32')](_0x2e5d4a['model'],qs['fields'](_0x456b54[_0x23d6('0x2f')][_0x23d6('0x34')]));_0x5ed138[_0x23d6('0x33')]=_0x5ed138['attributes'][_0x23d6('0x35')]?_0x5ed138[_0x23d6('0x33')]:_0x2e5d4a['model'];if(!_0x456b54['query'][_0x23d6('0x36')](_0x23d6('0x37'))){_0x5ed138[_0x23d6('0x20')]=qs[_0x23d6('0x20')](_0x456b54['query']['limit']);_0x5ed138[_0x23d6('0x1f')]=qs[_0x23d6('0x1f')](_0x456b54[_0x23d6('0x2f')][_0x23d6('0x1f')]);}_0x5ed138[_0x23d6('0x38')]=qs[_0x23d6('0x39')](_0x456b54['query']['sort']);_0x5ed138[_0x23d6('0x3a')]=qs[_0x23d6('0x31')](_['pick'](_0x456b54['query'],_0x2e5d4a[_0x23d6('0x31')]),_0x8e307d);if(_0x456b54[_0x23d6('0x2f')][_0x23d6('0x3b')]){_0x5ed138['where']=_[_0x23d6('0x3c')](_0x5ed138[_0x23d6('0x3a')],{'$or':_[_0x23d6('0x2e')](_0x8e307d,function(_0x56eab0){if(_0x56eab0[_0x23d6('0x3d')]!=='VIRTUAL'){var _0x37008a={};_0x37008a[_0x56eab0['name']]={'$like':'%'+_0x456b54[_0x23d6('0x2f')][_0x23d6('0x3b')]+'%'};return _0x37008a;}})});}_0x5ed138=_['merge']({},_0x5ed138,_0x456b54[_0x23d6('0x3e')]);var _0x5eeed0={'where':_0x5ed138['where']};return db[_0x23d6('0x2c')][_0x23d6('0x1e')](_0x5eeed0)['then'](function(_0x250fee){_0x1b8302[_0x23d6('0x1e')]=_0x250fee;if(_0x456b54[_0x23d6('0x2f')][_0x23d6('0x3f')]){_0x5ed138[_0x23d6('0x40')]=[{'all':!![]}];}return db[_0x23d6('0x2c')][_0x23d6('0x41')](_0x5ed138);})[_0x23d6('0x25')](function(_0x263676){_0x1b8302['rows']=_0x263676;return _0x1b8302;})[_0x23d6('0x25')](respondWithFilteredResult(_0x3ce074,_0x5ed138))[_0x23d6('0x42')](handleError(_0x3ce074,null));};exports[_0x23d6('0x43')]=function(_0x22580d,_0xa499f3){var _0x351d76={'raw':![],'where':{'id':_0x22580d[_0x23d6('0x44')]['id']}},_0x223db2={};_0x223db2[_0x23d6('0x2d')]=_['keys'](db[_0x23d6('0x2c')][_0x23d6('0x45')]);_0x223db2['query']=_[_0x23d6('0x30')](_0x22580d[_0x23d6('0x2f')]);_0x223db2[_0x23d6('0x31')]=_[_0x23d6('0x32')](_0x223db2[_0x23d6('0x2d')],_0x223db2[_0x23d6('0x2f')]);_0x351d76[_0x23d6('0x33')]=_[_0x23d6('0x32')](_0x223db2[_0x23d6('0x2d')],qs[_0x23d6('0x34')](_0x22580d[_0x23d6('0x2f')][_0x23d6('0x34')]));_0x351d76['attributes']=_0x351d76[_0x23d6('0x33')][_0x23d6('0x35')]?_0x351d76['attributes']:_0x223db2[_0x23d6('0x2d')];if(_0x22580d[_0x23d6('0x2f')][_0x23d6('0x3f')]){_0x351d76[_0x23d6('0x40')]=[{'all':!![]}];}_0x351d76=_[_0x23d6('0x3c')]({},_0x351d76,_0x22580d['options']);return db['UserProfile'][_0x23d6('0x46')](_0x351d76)[_0x23d6('0x25')](handleEntityNotFound(_0xa499f3,null))[_0x23d6('0x25')](respondWithResult(_0xa499f3,null))[_0x23d6('0x42')](handleError(_0xa499f3,null));};exports['create']=function(_0x13e6c9,_0x3ef213){return db[_0x23d6('0x2c')][_0x23d6('0x47')](_0x13e6c9['body'],{})[_0x23d6('0x25')](respondWithResult(_0x3ef213,0xc9))[_0x23d6('0x42')](handleError(_0x3ef213,null));};exports[_0x23d6('0x48')]=function(_0x17a98f,_0x55f58c){var _0x499573={'where':{'id':_0x17a98f[_0x23d6('0x44')]['id']}},_0x96889d={};_0x96889d[_0x23d6('0x2d')]=_[_0x23d6('0x30')](db[_0x23d6('0x2c')][_0x23d6('0x45')]);_0x499573[_0x23d6('0x33')]=_[_0x23d6('0x32')](_0x96889d[_0x23d6('0x2d')],qs[_0x23d6('0x34')](_0x17a98f[_0x23d6('0x2f')][_0x23d6('0x34')]));_0x499573[_0x23d6('0x33')]=_0x499573[_0x23d6('0x33')]['length']?_0x499573[_0x23d6('0x33')]:_0x96889d[_0x23d6('0x2d')];if(_0x17a98f[_0x23d6('0x2f')][_0x23d6('0x3f')]){_0x499573['include']=[{'all':!![]}];}_0x499573=_[_0x23d6('0x3c')]({},_0x499573,_0x17a98f['options']);return db[_0x23d6('0x2c')][_0x23d6('0x46')](_0x499573)[_0x23d6('0x25')](handleEntityNotFound(_0x55f58c,null))['then'](function(_0x1ada87){if(_0x1ada87){var _0x3a0346=_0x1ada87['get']({'plain':!![]});_0x3a0346=qs[_0x23d6('0x49')](_0x3a0346,['id',_0x23d6('0x4a'),_0x23d6('0x4b'),'crudPermissions']);_0x17a98f['body']=_[_0x23d6('0x49')](_0x17a98f[_0x23d6('0x4c')],['id',_0x23d6('0x4a'),_0x23d6('0x4b')]);return db[_0x23d6('0x4d')][_0x23d6('0x4e')](function(_0xa0c31a){return db[_0x23d6('0x2c')]['create'](_[_0x23d6('0x3c')](_0x3a0346,_0x17a98f['body']),{'include':_0x17a98f[_0x23d6('0x2f')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0xa0c31a})[_0x23d6('0x25')](function(_0x2519fd){var _0x139fde=_0x2519fd[_0x23d6('0x4f')]({'plain':!![]});return db[_0x23d6('0x50')][_0x23d6('0x41')]({'where':{'userProfileId':_0x17a98f[_0x23d6('0x44')]['id']},'raw':!![]})[_0x23d6('0x25')](function(_0x4c5d19){if(_0x4c5d19){return BPromise[_0x23d6('0x51')](_0x4c5d19,function(_0x59722a){return new BPromise(function(_0x3d563e,_0x5752a3){if(_0x59722a[_0x23d6('0x52')]===null||_0x59722a['autoAssociation']===0x1)_0x3d563e(null);return db[_0x23d6('0x53')][_0x23d6('0x41')]({'where':{'sectionId':_0x59722a['id']},'raw':!![]})[_0x23d6('0x25')](function(_0x455cd9){var _0x988d09=_[_0x23d6('0x2e')](_0x455cd9,function(_0x85b4de){return qs[_0x23d6('0x49')](_0x85b4de,['id','createdAt',_0x23d6('0x4b'),'sectionId']);});_0x3d563e(_0x988d09);})[_0x23d6('0x42')](function(_0xc2a6bf){_0x5752a3(_0xc2a6bf);});})[_0x23d6('0x25')](function(_0x2488dc){var _0x2c8661=qs[_0x23d6('0x49')](_0x59722a,['id',_0x23d6('0x4a'),_0x23d6('0x4b')]);_0x2c8661[_0x23d6('0x54')]=_0x139fde['id'];if(_0x2488dc)_0x2c8661[_0x23d6('0x55')]=_0x2488dc;return _0x2c8661;})['then'](function(_0x4329a8){return db['UserProfileSection']['create'](_0x4329a8,{'include':[{'model':db[_0x23d6('0x53')],'as':_0x23d6('0x55')}],'raw':!![],'transaction':_0xa0c31a});});})[_0x23d6('0x25')](function(){return _0x139fde;});}});});});}})[_0x23d6('0x25')](respondWithResult(_0x55f58c,0xc9))[_0x23d6('0x42')](handleError(_0x55f58c,null));};exports['update']=function(_0x44c075,_0x3288a1){if(_0x44c075[_0x23d6('0x4c')]['id']){delete _0x44c075[_0x23d6('0x4c')]['id'];}return db[_0x23d6('0x2c')][_0x23d6('0x46')]({'where':{'id':_0x44c075['params']['id']}})['then'](handleEntityNotFound(_0x3288a1,null))[_0x23d6('0x25')](saveUpdates(_0x44c075[_0x23d6('0x4c')],null))['then'](respondWithResult(_0x3288a1,null))[_0x23d6('0x42')](handleError(_0x3288a1,null));};exports[_0x23d6('0x26')]=function(_0x28ea75,_0x31bf40){return db[_0x23d6('0x2c')]['find']({'where':{'id':_0x28ea75['params']['id']}})[_0x23d6('0x25')](handleEntityNotFound(_0x31bf40,null))[_0x23d6('0x25')](removeEntity(_0x31bf40,null))[_0x23d6('0x42')](handleError(_0x31bf40,null));};exports[_0x23d6('0x56')]=function(_0x148503,_0x2a27ab){return db[_0x23d6('0x2c')][_0x23d6('0x56')]()[_0x23d6('0x25')](respondWithResult(_0x2a27ab,null))[_0x23d6('0x42')](handleError(_0x2a27ab,null));};exports[_0x23d6('0x57')]=function(_0x202feb,_0x24c2a5){var _0x508b12=_0x202feb[_0x23d6('0x4c')];return db['UserProfile']['find']({'where':{'id':_0x202feb[_0x23d6('0x44')]['id']}})[_0x23d6('0x25')](handleEntityNotFound(_0x24c2a5,null))['then'](function(_0x3bd0b1){if(_0x3bd0b1){return db[_0x23d6('0x4d')][_0x23d6('0x4e')](function(_0x1cb808){return db[_0x23d6('0x50')][_0x23d6('0x26')]({'where':{'userProfileId':_0x202feb['params']['id'],'sectionId':_[_0x23d6('0x2e')](_0x508b12,function(_0x13cdd4){return _0x13cdd4['sectionId'];})},'transaction':_0x1cb808})['then'](function(){var _0x132600=_['map'](_0x508b12,function(_0x4e06fb){_0x4e06fb['userProfileId']=_0x202feb[_0x23d6('0x44')]['id'];return _0x4e06fb;});var _0x13caae=[];return BPromise[_0x23d6('0x51')](_0x132600,function(_0x1e4637){return db[_0x23d6('0x50')][_0x23d6('0x47')](_0x1e4637,{'include':[{'model':db['UserProfileResource'],'as':_0x23d6('0x55')}],'raw':!![],'transaction':_0x1cb808})[_0x23d6('0x25')](function(_0x38fb02){_0x13caae[_0x23d6('0x58')](_0x38fb02[_0x23d6('0x4f')]({'plain':!![]}));});})[_0x23d6('0x25')](function(){return _0x13caae;});});});}})[_0x23d6('0x25')](function(_0x5659e1){return _0x5659e1;})[_0x23d6('0x25')](respondWithResult(_0x24c2a5,null))[_0x23d6('0x42')](handleError(_0x24c2a5,null));};exports[_0x23d6('0x59')]=function(_0x1e3d5f,_0x529a7e){var _0x32556b;return db['UserProfile'][_0x23d6('0x46')]({'where':{'id':_0x1e3d5f[_0x23d6('0x44')]['id']},'attributes':['id',_0x23d6('0x2b')]})[_0x23d6('0x25')](handleEntityNotFound(_0x529a7e,null))['then'](function(_0x4abb3e){if(_0x4abb3e){_0x32556b=_0x4abb3e;return db[_0x23d6('0x50')]['destroy']({'where':{'userProfileId':_0x1e3d5f[_0x23d6('0x44')]['id'],'sectionId':_0x1e3d5f[_0x23d6('0x2f')]['ids']}});}})['then'](function(){return _0x32556b;})[_0x23d6('0x25')](respondWithStatusCode(_0x529a7e,null))[_0x23d6('0x42')](handleError(_0x529a7e,null));};exports[_0x23d6('0x5a')]=function(_0x475966,_0x4186e6){var _0xdfb5a6=[];var _0x4b7c05=[];return db['UserProfileSection'][_0x23d6('0x41')]({'where':{'userProfileId':_0x475966[_0x23d6('0x44')]['id']},'raw':!![]})['then'](function(_0xb415f3){_0xdfb5a6=_['filter'](_0xb415f3,function(_0x4e061b){return _0x4e061b[_0x23d6('0x5b')]===0x1||_[_0x23d6('0x5c')]([0x3eb,0x709],_0x4e061b['sectionId']);});if(!_[_0x23d6('0x5d')](_0xdfb5a6)){return _['map'](_0xdfb5a6,function(_0xceaab2){return _0xceaab2['sectionId'];});}else{return;}})[_0x23d6('0x25')](function(_0x351576){if(_0x351576)_0x4b7c05=_0x351576;if(_[_0x23d6('0x5c')](_0x4b7c05,0x64)){var _0x90bd4c=_['find'](_0xdfb5a6,{'sectionId':0x64});return hasDefaultDashboard(_0x90bd4c)[_0x23d6('0x25')](function(_0x951505){return _[_0x23d6('0x2e')](_0xdfb5a6,function(_0x4fa44c){if(_0x4fa44c[_0x23d6('0x5e')]===0x64){_0x4fa44c[_0x23d6('0x5f')]=_0x951505;}return _0x4fa44c;});});}else{return;}})['then'](function(_0x377142){if(_0x377142)_0xdfb5a6=_0x377142;if(_['includes'](_0x4b7c05,0x3eb)){var _0x384858=_[_0x23d6('0x46')](_0xdfb5a6,{'sectionId':0x3eb});return getCustomDashboards(_0x384858)[_0x23d6('0x25')](function(_0x4e480e){return _['map'](_0xdfb5a6,function(_0x3bf2c3){if(_0x384858[_0x23d6('0x5b')]){if(_0x3bf2c3[_0x23d6('0x5e')]===0x3eb){_0x3bf2c3[_0x23d6('0x5f')]=_0x4e480e;}}else{if(_0x3bf2c3[_0x23d6('0x5e')]===0x64){_0x3bf2c3[_0x23d6('0x5f')]=_0x4e480e;}}return _0x3bf2c3;});});}else{return;}})[_0x23d6('0x25')](function(_0x24be5e){if(_0x24be5e)_0xdfb5a6=_0x24be5e;if(_['includes'](_0x4b7c05,0x709)){var _0xa98314=_['find'](_0xdfb5a6,{'sectionId':0x709});return getPlugins(_0xa98314)[_0x23d6('0x25')](function(_0xecddb2){if(_0xa98314[_0x23d6('0x5b')]){return _['map'](_0xdfb5a6,function(_0x2d31cb){if(_0x2d31cb[_0x23d6('0x5e')]===0x709){_0x2d31cb['subsections']=_0xecddb2;}return _0x2d31cb;});}else{var _0x1c3777={'sectionId':0x76c,'enabled':0x1,'subsections':_0xecddb2};var _0x29d2f7=_['map'](_0xdfb5a6);_0x29d2f7[_0x23d6('0x58')](_0x1c3777);return _0x29d2f7;}});}else{return;}})[_0x23d6('0x25')](function(_0x32b59f){if(_0x32b59f)_0xdfb5a6=_0x32b59f;return _[_0x23d6('0x3b')](_0xdfb5a6,[_0x23d6('0x5b'),0x1]);})[_0x23d6('0x25')](respondWithResult(_0x4186e6,null))[_0x23d6('0x42')](handleError(_0x4186e6,null));};function hasDefaultDashboard(_0x10cbe9){var _0x321ab7=[0x65];return new BPromise(function(_0x38e188,_0x737674){try{if(_0x10cbe9[_0x23d6('0x52')]){_0x38e188(_0x321ab7);}else{return db[_0x23d6('0x53')][_0x23d6('0x60')]({'where':{'sectionId':_0x10cbe9['id']},'raw':!![]})[_0x23d6('0x25')](function(_0x345fdd){_0x345fdd?_0x38e188(_0x321ab7):_0x38e188();});}}catch(_0x53d625){_0x737674(_0x53d625);}});}function getCustomDashboards(_0x593702){var _0x4f80d0=[];return new BPromise(function(_0x2b5891,_0x485bc4){try{if(_0x593702[_0x23d6('0x52')]){return db['Dashboard'][_0x23d6('0x41')]({'raw':!![]})[_0x23d6('0x25')](function(_0x2600f0){_0x2600f0['forEach'](function(_0x451ef3){_0x4f80d0[_0x23d6('0x58')](_0x451ef3['id']+0x1869f);});_0x2b5891(_0x4f80d0);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x593702['id']},'raw':!![]})[_0x23d6('0x25')](function(_0xf5d780){_0xf5d780[_0x23d6('0x61')](function(_0x294d18){_0x4f80d0[_0x23d6('0x58')](_0x294d18[_0x23d6('0x62')]+0x1869f);});_0x2b5891(_0x4f80d0);});}}catch(_0x3f9abd){_0x485bc4(_0x3f9abd);}});}function getPlugins(_0x342760){var _0x4e4823=[];return new BPromise(function(_0x51f111,_0x9dcbb0){try{if(_0x342760['autoAssociation']){return db['Plugin']['findAll']({'raw':!![]})['then'](function(_0x33da3f){_0x33da3f[_0x23d6('0x61')](function(_0x219739){_0x4e4823[_0x23d6('0x58')](_0x219739['id']+0x15b38);});_0x51f111(_0x4e4823);});}else{return db[_0x23d6('0x53')][_0x23d6('0x41')]({'where':{'sectionId':_0x342760['id']},'raw':!![]})[_0x23d6('0x25')](function(_0xcb4e67){_0xcb4e67['forEach'](function(_0x3f0e43){_0x4e4823['push'](_0x3f0e43[_0x23d6('0x62')]+0x15b38);});_0x51f111(_0x4e4823);});}}catch(_0x2a2d4a){_0x9dcbb0(_0x2a2d4a);}});}exports[_0x23d6('0x63')]=function(_0x2041e1,_0x1511e8){return db[_0x23d6('0x2c')]['find']({'where':{'id':_0x2041e1[_0x23d6('0x44')]['id']}})['then'](handleEntityNotFound(_0x1511e8,null))[_0x23d6('0x25')](function(_0x327c01){if(_0x327c01){return db['sequelize'][_0x23d6('0x4e')](function(_0x431db3){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x2041e1[_0x23d6('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x23d6('0x25')](function(_0x3c6a22){if(_0x3c6a22){return db[_0x23d6('0x50')]['destroy']({'where':{'userProfileId':_0x2041e1[_0x23d6('0x44')]['id'],'id':_['map'](_0x3c6a22,function(_0x1d276c){return _0x1d276c['id'];})},'transaction':_0x431db3});}})[_0x23d6('0x25')](function(_0x1962e5){var _0x503634=_[_0x23d6('0x2e')](_0x2041e1[_0x23d6('0x4c')],function(_0xd4446f){_0xd4446f[_0x23d6('0x54')]=_0x2041e1[_0x23d6('0x44')]['id'];return _0xd4446f;});return db[_0x23d6('0x50')][_0x23d6('0x64')](_0x503634,{'raw':!![],'transaction':_0x431db3});})[_0x23d6('0x25')](function(_0x51387e){var _0x4104d1=_[_0x23d6('0x3b')](_[_0x23d6('0x2e')](_0x51387e,function(_0x262bf4){return _0x262bf4[_0x23d6('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x4104d1){return db[_0x23d6('0x50')][_0x23d6('0x41')]({'where':{'userProfileId':_0x2041e1[_0x23d6('0x44')]['id'],'sectionId':_[_0x23d6('0x2e')](_0x4104d1,function(_0x4590b4){return _0x4590b4[_0x23d6('0x5e')];})},'attributes':['id',_0x23d6('0x5e')],'raw':!![]})[_0x23d6('0x25')](function(_0x309a04){var _0x1ef0c4=_[_0x23d6('0x2e')](_0x2041e1[_0x23d6('0x4c')],function(_0x38001c){_0x38001c[_0x23d6('0x54')]=_0x2041e1[_0x23d6('0x44')]['id'];return _0x38001c;});return db[_0x23d6('0x53')]['bulkCreate'](_0x1ef0c4,{'raw':!![],'transaction':_0x431db3});});}})[_0x23d6('0x42')](handleError(_0x1511e8,null));});}})[_0x23d6('0x25')](function(_0x2c213a){var _0x4f1c3e=_[_0x23d6('0x2e')](_0x2c213a,function(_0x4fac30){return _0x4fac30[_0x23d6('0x4f')]({'plain':!![]});});})['then'](respondWithResult(_0x1511e8,null))[_0x23d6('0x42')](handleError(_0x1511e8,null));};exports[_0x23d6('0x65')]=function(_0x4e3028,_0x337b07,_0x187b0e){return db[_0x23d6('0x2c')][_0x23d6('0x46')]({'where':{'id':_0x4e3028[_0x23d6('0x44')]['id']}})[_0x23d6('0x25')](handleEntityNotFound(_0x337b07,null))['then'](function(_0x5c8274){if(_0x5c8274){return _0x5c8274[_0x23d6('0x65')](_0x4e3028['query'][_0x23d6('0x66')]);}})[_0x23d6('0x25')](respondWithStatusCode(_0x337b07,null))[_0x23d6('0x42')](handleError(_0x337b07,null));};exports[_0x23d6('0x67')]=function(_0x26029a,_0x5d722b){var _0x533f27={'raw':![],'where':{}};var _0x1492d4={};var _0x4710a9={'count':0x0,'rows':[]};var _0x2f369b=_0x26029a[_0x23d6('0x2f')][_0x23d6('0x68')];if(typeof _0x2f369b===_0x23d6('0x69')){throw new db[(_0x23d6('0x6a'))][(_0x23d6('0x6b'))]('Unknown\x20section');}var _0x2e9010=_0x26029a[_0x23d6('0x2f')][_0x23d6('0x6c')]||![];var _0x7403b5=getQueryModels(_0x2f369b,_0x2e9010);if(typeof _0x7403b5[_0x23d6('0x6d')]===_0x23d6('0x69')){throw new db[(_0x23d6('0x6a'))][(_0x23d6('0x6b'))](_0x23d6('0x6e')+_0x2f369b+'\x27');}var _0x30e7ac=[];if(!_[_0x23d6('0x5d')](_0x7403b5[_0x23d6('0x6f')])){_0x30e7ac=_0x7403b5[_0x23d6('0x6f')];}else{_0x30e7ac=[{'name':_0x2f369b}];}return db[_0x23d6('0x2c')][_0x23d6('0x60')]({'where':{'id':_0x26029a[_0x23d6('0x44')]['id']}})[_0x23d6('0x25')](handleEntityNotFound(_0x5d722b,null))[_0x23d6('0x25')](function(_0x1be838){if(_0x1be838){var _0x2d73b5=[];for(var _0x45703d=0x0;_0x45703d<_0x30e7ac[_0x23d6('0x35')];_0x45703d++){_0x2d73b5[_0x23d6('0x58')](db[_0x23d6('0x50')]['findOne']({'where':{'userProfileId':_0x1be838['id'],'name':_0x30e7ac[_0x45703d]['name']},'raw':!![]}));}return BPromise[_0x23d6('0x70')](_0x2d73b5);}})[_0x23d6('0x25')](function(_0x29ca0d){var _0x597f7a=_[_0x23d6('0x3b')](_0x29ca0d,function(_0x1d4820){return _0x1d4820?_0x1d4820:undefined;});var _0x5e6696=_[_0x23d6('0x3b')](_0x30e7ac,[_0x23d6('0x71'),!![]]);var _0x96a116=_[_0x23d6('0x5d')](_0x597f7a)&&_['isEmpty'](_0x5e6696)?null:_['union'](_0x5e6696,_0x597f7a);if(_0x96a116){var _0x202203=[];for(var _0x228097=0x0;_0x228097<_0x96a116[_0x23d6('0x35')];_0x228097++){var _0x26745c=_[_0x23d6('0x46')](_0x30e7ac,function(_0x1ed998){return _0x96a116[_0x228097]?_0x1ed998[_0x23d6('0x2b')]===_0x96a116[_0x228097][_0x23d6('0x2b')]:null;});if(_0x26745c){if(_0x96a116[_0x228097][_0x23d6('0x71')]){_0x202203[_0x23d6('0x58')](getAllResources(_0x7403b5[_0x23d6('0x6d')],_0x96a116[_0x228097]));}else{if(!_0x96a116[_0x228097][_0x23d6('0x52')]){_0x202203[_0x23d6('0x58')](getAllowedResources(_0x26745c,_0x96a116[_0x228097],_0x7403b5[_0x23d6('0x6d')]));}else{if(_0x26745c['model']){_0x202203[_0x23d6('0x58')](getAllFilteredResources(_0x26745c,_0x96a116[_0x228097]));}}}}}return BPromise[_0x23d6('0x70')](_0x202203);}else{return null;}})[_0x23d6('0x25')](function(_0x5c3d8a){var _0x29fd92=_0x5c3d8a;var _0x25f1c3=null;if(_0x29fd92){_0x25f1c3=_0x29fd92[_0x23d6('0x35')]===0x1?_0x29fd92[0x0]:null;}if(_0x25f1c3||_0x29fd92){var _0x8450f7=db[_0x7403b5[_0x23d6('0x6d')]][_0x23d6('0x45')];_0x1492d4[_0x23d6('0x2d')]=_[_0x23d6('0x30')](_0x8450f7);_0x1492d4[_0x23d6('0x2f')]=_[_0x23d6('0x30')](_0x26029a[_0x23d6('0x2f')]);_0x1492d4['filters']=_[_0x23d6('0x32')](_0x1492d4[_0x23d6('0x2d')],_0x1492d4['query']);_0x533f27[_0x23d6('0x33')]=_[_0x23d6('0x32')](_0x1492d4[_0x23d6('0x2d')],qs[_0x23d6('0x34')](_0x26029a['query'][_0x23d6('0x34')]));_0x533f27['attributes']=_0x533f27[_0x23d6('0x33')]['length']?_0x533f27[_0x23d6('0x33')]:_0x1492d4[_0x23d6('0x2d')];if(!_0x26029a[_0x23d6('0x2f')][_0x23d6('0x36')](_0x23d6('0x37'))){_0x533f27[_0x23d6('0x20')]=qs[_0x23d6('0x20')](_0x26029a[_0x23d6('0x2f')]['limit']);_0x533f27[_0x23d6('0x1f')]=qs[_0x23d6('0x1f')](_0x26029a[_0x23d6('0x2f')]['offset']);}_0x533f27[_0x23d6('0x38')]=qs[_0x23d6('0x39')](_0x26029a[_0x23d6('0x2f')][_0x23d6('0x39')]);_0x533f27[_0x23d6('0x3a')]=qs[_0x23d6('0x31')](_[_0x23d6('0x72')](_0x26029a['query'],_0x1492d4[_0x23d6('0x31')]));if(_0x26029a[_0x23d6('0x2f')][_0x23d6('0x3b')]){_0x533f27[_0x23d6('0x3a')]=_[_0x23d6('0x3c')](_0x533f27['where'],{'$or':_[_0x23d6('0x2e')](_0x8450f7,function(_0x59cd8d){if(_0x59cd8d['type'][_0x23d6('0x73')]!==_0x23d6('0x74')){var _0x229d5f={};_0x229d5f[_0x59cd8d['field']]={'$like':'%'+_0x26029a[_0x23d6('0x2f')][_0x23d6('0x3b')]+'%'};return _0x229d5f;}})});}var _0x191c0d=[];if(_0x25f1c3){var _0x28dfcf=_[_0x23d6('0x46')](_0x30e7ac,['name',_0x25f1c3[_0x23d6('0x2b')]]);if(_0x28dfcf[_0x23d6('0x75')]){var _0x3f279d={};if(_0x7403b5['childModel']===_0x23d6('0x76')){_0x3f279d[_0x28dfcf[_0x23d6('0x77')]]=_[_0x23d6('0x2e')](_0x25f1c3[_0x23d6('0x78')],'id');}else{_0x3f279d[_0x28dfcf[_0x23d6('0x77')]]=_0x25f1c3['associatedResources'];}_0x191c0d[_0x23d6('0x58')](_0x3f279d);}else{_0x533f27['where']['id']=_0x25f1c3['associatedResources'];}}else{for(var _0x3d3493=0x0;_0x3d3493<_0x29fd92[_0x23d6('0x35')];_0x3d3493++){var _0x28dfcf=_[_0x23d6('0x46')](_0x30e7ac,[_0x23d6('0x2b'),_0x29fd92[_0x3d3493][_0x23d6('0x2b')]]);if(_0x28dfcf['field']){var _0x3f279d={};_0x3f279d[_0x28dfcf[_0x23d6('0x77')]]=_0x29fd92[_0x3d3493][_0x23d6('0x78')];_0x191c0d[_0x23d6('0x58')](_0x3f279d);}else{if(!_0x533f27[_0x23d6('0x3a')]['id'])_0x533f27[_0x23d6('0x3a')]['id']=[];_0x29fd92[_0x3d3493][_0x23d6('0x78')][_0x23d6('0x61')](function(_0x5e99c0){_0x533f27[_0x23d6('0x3a')]['id']['push'](_0x5e99c0);});}}}if(!_[_0x23d6('0x5d')](_0x191c0d)){_0x533f27[_0x23d6('0x3a')]=_[_0x23d6('0x3c')](_0x533f27[_0x23d6('0x3a')],{'$and':{'$or':_0x191c0d}});}_0x533f27=_[_0x23d6('0x3c')]({},_0x533f27,_0x26029a[_0x23d6('0x3e')]);if(_0x25f1c3&&!_0x25f1c3[_0x23d6('0x52')]&&_0x7403b5[_0x23d6('0x6d')]===_0x23d6('0x76')){if(_0x26029a['query'][_0x23d6('0x3f')]){_0x533f27[_0x23d6('0x40')]=[{'all':!![]}];}return db[_0x7403b5[_0x23d6('0x6d')]][_0x23d6('0x41')](_0x533f27)[_0x23d6('0x25')](function(_0xa68c8f){var _0x436eb8=[];_0xa68c8f[_0x23d6('0x61')](function(_0x5c72b6){var _0x226c43;switch(_0x5c72b6['reportType']){case'default':_0x226c43=_[_0x23d6('0x46')](_0x25f1c3[_0x23d6('0x78')],function(_0x362763){return _0x362763['id']===_0x5c72b6[_0x23d6('0x79')]&&_0x362763[_0x23d6('0x3d')]===_0x23d6('0x7a');});break;case _0x23d6('0x7b'):_0x226c43=_['find'](_0x25f1c3[_0x23d6('0x78')],function(_0x44418e){return _0x44418e['id']===_0x5c72b6[_0x23d6('0x79')]&&_0x44418e[_0x23d6('0x3d')]==='CustomReports';});break;}if(_0x226c43)_0x436eb8['push'](_0x5c72b6);});_0x4710a9[_0x23d6('0x1e')]=_0x436eb8[_0x23d6('0x35')];_0x4710a9[_0x23d6('0x7c')]=_0x436eb8;return _0x4710a9;});}else{return db[_0x7403b5[_0x23d6('0x6d')]]['count']({'where':_0x533f27[_0x23d6('0x3a')]})['then'](function(_0x410a9d){_0x4710a9[_0x23d6('0x1e')]=_0x410a9d;if(_0x26029a[_0x23d6('0x2f')]['includeAll']){if(_0x7403b5[_0x23d6('0x6d')]==='CmContact'){_0x533f27[_0x23d6('0x40')]=[{'model':db[_0x23d6('0x7d')],'as':_0x23d6('0x7e'),'attributes':['id',_0x23d6('0x2b'),'color'],'required':_0x26029a[_0x23d6('0x2f')][_0x23d6('0x7f')]?!![]:![]},{'model':db[_0x23d6('0x7d')],'as':'ThroughTags','attributes':['id',_0x23d6('0x2b'),_0x23d6('0x80')],'through':_0x26029a['query']['tag']?{'attributes':[],'where':{'TagId':_0x26029a[_0x23d6('0x2f')][_0x23d6('0x7f')]||undefined}}:{},'required':_0x26029a[_0x23d6('0x2f')][_0x23d6('0x7f')]?!![]:![]}];}else{_0x533f27[_0x23d6('0x40')]=[{'all':!![]}];}}return db[_0x7403b5[_0x23d6('0x6d')]]['findAll'](_0x533f27);})[_0x23d6('0x25')](function(_0x1f94ca){_0x4710a9[_0x23d6('0x7c')]=_0x1f94ca;return _0x4710a9;});}}else{return _0x4710a9;}})[_0x23d6('0x25')](respondWithFilteredResult(_0x5d722b,_0x533f27))['catch'](handleError(_0x5d722b,null));};function getAllResources(_0x290ca2,_0xe16245){return new BPromise(function(_0x4e1ae7,_0x2130c1){if(_0xe16245){var _0x34a79e=_0xe16245[_0x23d6('0x3b')]?{[_0xe16245['filter']['field']]:_0xe16245[_0x23d6('0x3b')]['value']}:undefined;return db[_0x290ca2][_0x23d6('0x41')]({'where':_0x34a79e,'raw':!![]})[_0x23d6('0x25')](function(_0x1fc86b){_0xe16245[_0x23d6('0x78')]=_['map'](_0x1fc86b,'id');_0x4e1ae7(_0xe16245);})['catch'](function(_0x4fe6c0){_0x2130c1(_0x4fe6c0);});}else{_0x4e1ae7(null);}});}function getAllFilteredResources(_0xb45f,_0x38f5d6){return new BPromise(function(_0x5b0ffa,_0x5e4e1d){var _0x236223=_0xb45f[_0x23d6('0x3b')]?{[_0xb45f[_0x23d6('0x3b')][_0x23d6('0x75')]]:_0xb45f[_0x23d6('0x3b')]['value']}:undefined;return db[_0xb45f[_0x23d6('0x2d')]]['findAll']({'where':_0x236223,'raw':!![]})['then'](function(_0x2ddc57){_0x38f5d6[_0x23d6('0x78')]=_[_0x23d6('0x2e')](_0x2ddc57,function(_0x21a056){return _0x21a056[_0x23d6('0x2b')];});_0x5b0ffa(_0x38f5d6);})[_0x23d6('0x42')](function(_0x1765a0){_0x5e4e1d(_0x1765a0);});});}function getAllowedResources(_0x49f502,_0x35aa0e,_0x1b0d99){return new BPromise(function(_0x2d496a,_0x112d6e){if(_0x35aa0e){return db[_0x23d6('0x53')][_0x23d6('0x41')]({'where':{'sectionId':_0x35aa0e['id']},'raw':!![]})[_0x23d6('0x25')](function(_0x400f5f){if(_0x49f502['field']&&_0x49f502[_0x23d6('0x75')]!=='id'){_0x35aa0e[_0x23d6('0x78')]=_[_0x23d6('0x2e')](_0x400f5f,function(_0x573725){return _0x573725[_0x49f502[_0x23d6('0x75')]];});}else{if(_0x1b0d99===_0x23d6('0x76')){_0x35aa0e['associatedResources']=_['map'](_0x400f5f,function(_0x5582b6){return{'id':_0x5582b6['resourceId'],'type':_0x5582b6[_0x23d6('0x3d')]};});}else{_0x35aa0e['associatedResources']=_[_0x23d6('0x2e')](_0x400f5f,function(_0x5c30cb){return _0x5c30cb[_0x23d6('0x62')];});}}_0x2d496a(_0x35aa0e);})[_0x23d6('0x42')](function(_0x1b32c1){_0x112d6e(_0x1b32c1);});}else{_0x2d496a(null);}});}function getQueryModels(_0xc3c4b6,_0x1ca55f){var _0x787a2a=_0xc3c4b6[_0x23d6('0x81')]();var _0x1cd6ae={'childModel':undefined,'parentSections':[]};switch(_0x787a2a){case _0x23d6('0x82'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x83');break;case _0x23d6('0x84'):_0x1cd6ae['childModel']=_0x23d6('0x85');break;case'squarerecordings':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x86');_0x1cd6ae[_0x23d6('0x6f')]=[{'name':_0x23d6('0x87'),'field':'name','foreignKey':_0x23d6('0x88')}];break;case _0x23d6('0x89'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x8a');break;case _0x23d6('0x8b'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x8c');_0x1cd6ae['parentSections']=[{'name':_0x23d6('0x8d'),'field':'id','foreignKey':_0x23d6('0x8e')}];break;case _0x23d6('0x8f'):_0x1cd6ae[_0x23d6('0x6d')]='CmList';break;case _0x23d6('0x90'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x91');break;case _0x23d6('0x92'):_0x1cd6ae[_0x23d6('0x6d')]='CmCustomField';break;case _0x23d6('0x93'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x94');break;case _0x23d6('0x95'):_0x1cd6ae[_0x23d6('0x6d')]='ChatWebsite';break;case _0x23d6('0x96'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x97');break;case _0x23d6('0x98'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x99');break;case _0x23d6('0x9a'):case _0x23d6('0x9b'):case _0x23d6('0x9c'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x9d');break;case _0x23d6('0x9e'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x9f');break;case _0x23d6('0xa0'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xa1');break;case _0x23d6('0xa2'):_0x1cd6ae['childModel']='VoiceRecording';_0x1cd6ae[_0x23d6('0x6f')]=[{'name':_0x23d6('0xa3'),'field':_0x23d6('0x2b'),'foreignKey':_0x23d6('0xa4'),'model':_0x23d6('0xa5'),'filter':{'field':'role','value':[_0x23d6('0xa6')]}},{'name':_0x23d6('0xa7'),'field':_0x23d6('0x2b'),'foreignKey':_0x23d6('0xa4'),'model':_0x23d6('0xa5'),'filter':{'field':_0x23d6('0xa8'),'value':[_0x23d6('0xa9')]}},{'name':_0x23d6('0xaa'),'field':_0x23d6('0x2b'),'foreignKey':_0x23d6('0xab'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x23d6('0xac')]}},{'name':_0x23d6('0xad'),'field':_0x23d6('0x2b'),'foreignKey':_0x23d6('0xab'),'model':_0x23d6('0xae'),'filter':{'field':_0x23d6('0x3d'),'value':[_0x23d6('0xaf')]}}];break;case _0x23d6('0xb0'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xb1');break;case'chanspies':_0x1cd6ae['childModel']='VoiceChanSpy';break;case _0x23d6('0xb2'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xb3');break;case _0x23d6('0xb4'):_0x1cd6ae[_0x23d6('0x6d')]='Campaign';break;case'mailqueues':_0x1cd6ae['childModel']=_0x23d6('0xb5');break;case _0x23d6('0xb6'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xb7');break;case _0x23d6('0xb8'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xb9');break;case _0x23d6('0xba'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xbb');break;case _0x23d6('0xbc'):_0x1cd6ae[_0x23d6('0x6d')]='OpenchannelAccount';break;case _0x23d6('0xbd'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xbe');break;case _0x23d6('0xbf'):_0x1cd6ae[_0x23d6('0x6d')]='SmsAccount';break;case _0x23d6('0xc0'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xc1');break;case'whatsappaccounts':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xc2');break;case _0x23d6('0xc3'):_0x1cd6ae[_0x23d6('0x6d')]='Team';break;case _0x23d6('0xc4'):case _0x23d6('0xc5'):_0x1cd6ae[_0x23d6('0x6d')]='VoiceQueue';if(_0x1ca55f){_0x1cd6ae[_0x23d6('0x6f')]=[{'name':_0x23d6('0xaa')},{'name':_0x23d6('0xad')}];}break;case _0x23d6('0xc6'):case'agents':case'telephones':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xa5');if(_0x1ca55f){_0x1cd6ae[_0x23d6('0x6f')]=[{'name':_0x23d6('0xc7'),'filter':{'field':_0x23d6('0xa8'),'value':[_0x23d6('0xc8'),'user']},'ignore':!![]},{'name':_0x23d6('0xa3')},{'name':'Telephones'}];}break;case _0x23d6('0xc9'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xca');break;case'salesforceaccounts':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xcb');break;case'freshdeskaccounts':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xcc');break;case'sugarcrmaccounts':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xcd');break;case _0x23d6('0xce'):_0x1cd6ae['childModel']=_0x23d6('0xcf');break;case'zohoaccounts':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xd0');break;case _0x23d6('0xd1'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xa5');break;case _0x23d6('0xd2'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xd3');break;case _0x23d6('0xd4'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xd5');break;case _0x23d6('0xd6'):_0x1cd6ae['childModel']=_0x23d6('0xd7');break;case _0x23d6('0xd8'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xd9');break;case'pauses':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xda');break;case _0x23d6('0xdb'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xdc');break;case _0x23d6('0xdd'):_0x1cd6ae[_0x23d6('0x6d')]='Sound';break;case'tags':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0x7d');break;case _0x23d6('0xde'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xdf');break;case'triggers':_0x1cd6ae[_0x23d6('0x6d')]='Trigger';break;case'trunks':_0x1cd6ae['childModel']=_0x23d6('0xe0');break;case _0x23d6('0xe1'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xe2');break;case _0x23d6('0xe3'):_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xe4');break;case _0x23d6('0xe5'):_0x1cd6ae['childModel']='AnalyticExtractedReport';_0x1cd6ae[_0x23d6('0x6f')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case'metrics':_0x1cd6ae['childModel']=_0x23d6('0xe6');break;case'whatsappaccounts':_0x1cd6ae[_0x23d6('0x6d')]=_0x23d6('0xc2');break;default:return _0x1cd6ae;}return _0x1cd6ae;} \ No newline at end of file +var _0xb00d=['autoAssociation','userProfileId','Resources','UserProfileResource','describe','sectionId','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','pick','key','field','AnalyticExtractedReport','foreignKey','associatedResources','default','DefaultReports','custom','reportId','CustomReports','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','odbc','squarerecordings','SquareRecording','projectName','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','faxqueues','FaxQueue','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','ZohoAccount','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','templates','Template','trunks','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','omit','crudPermissions','createdAt','updatedAt','sequelize','transaction','get','UserProfileSection','each'];(function(_0x4afb68,_0x39a838){var _0x21e88b=function(_0x1877ea){while(--_0x1877ea){_0x4afb68['push'](_0x4afb68['shift']());}};_0x21e88b(++_0x39a838);}(_0xb00d,0x97));var _0xdb00=function(_0x4c8232,_0x4e0dea){_0x4c8232=_0x4c8232-0x0;var _0x3cc8e5=_0xb00d[_0x4c8232];return _0x3cc8e5;};'use strict';var pdf=require(_0xdb00('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdb00('0x1'));var rp=require(_0xdb00('0x2'));var moment=require(_0xdb00('0x3'));var BPromise=require(_0xdb00('0x4'));var Mustache=require(_0xdb00('0x5'));var util=require(_0xdb00('0x6'));var path=require(_0xdb00('0x7'));var sox=require(_0xdb00('0x8'));var csv=require('to-csv');var ejs=require(_0xdb00('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdb00('0xa'));var deskjs=require(_0xdb00('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdb00('0xc'));var Papa=require('papaparse');var Redis=require(_0xdb00('0xd'));var authService=require(_0xdb00('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb00('0xf'))(_0xdb00('0x10'));var utils=require(_0xdb00('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xdb00('0x12'));var db=require(_0xdb00('0x13'))['db'];config[_0xdb00('0x14')]=_[_0xdb00('0x15')](config[_0xdb00('0x14')],{'host':_0xdb00('0x16'),'port':0x18eb});var socket=require(_0xdb00('0x17'))(new Redis(config['redis']));require(_0xdb00('0x18'))[_0xdb00('0x19')](socket);function respondWithStatusCode(_0x5966ec,_0x303ee0){_0x303ee0=_0x303ee0||0xcc;return function(_0x43accb){if(_0x43accb){return _0x5966ec[_0xdb00('0x1a')](_0x303ee0);}return _0x5966ec['status'](_0x303ee0)['end']();};}function respondWithResult(_0x1f9295,_0x25b570){_0x25b570=_0x25b570||0xc8;return function(_0x2e49fc){if(_0x2e49fc){return _0x1f9295[_0xdb00('0x1b')](_0x25b570)[_0xdb00('0x1c')](_0x2e49fc);}};}function respondWithFilteredResult(_0xc16102,_0x5beda0){return function(_0x126e9c){if(_0x126e9c){var _0xbd0108=_0x126e9c[_0xdb00('0x1d')],_0x433a0d=_0x5beda0[_0xdb00('0x1e')],_0x20663e=_0x5beda0['offset']+_0x5beda0[_0xdb00('0x1f')],_0x4ce15c;if(_0x20663e>=_0xbd0108){_0x20663e=_0xbd0108;_0x4ce15c=0xc8;}else{_0x4ce15c=0xce;}_0xc16102['status'](_0x4ce15c);return _0xc16102[_0xdb00('0x20')](_0xdb00('0x21'),_0x433a0d+'-'+_0x20663e+'/'+_0xbd0108)[_0xdb00('0x1c')](_0x126e9c);}return null;};}function patchUpdates(_0x1634ec){return function(_0x1cd544){try{jsonpatch[_0xdb00('0x22')](_0x1cd544,_0x1634ec,!![]);}catch(_0x5b2e37){return BPromise['reject'](_0x5b2e37);}return _0x1cd544[_0xdb00('0x23')]();};}function saveUpdates(_0xfa8b20,_0x5cd6bc){return function(_0x102b62){if(_0x102b62){return _0x102b62[_0xdb00('0x24')](_0xfa8b20)['then'](function(_0x10a173){return _0x10a173;});}return null;};}function removeEntity(_0x1ea9c2,_0x5df808){return function(_0x243455){if(_0x243455){return _0x243455[_0xdb00('0x25')]()[_0xdb00('0x26')](function(){_0x1ea9c2[_0xdb00('0x1b')](0xcc)[_0xdb00('0x27')]();});}};}function handleEntityNotFound(_0xfd862d,_0x30f893){return function(_0x164e18){if(!_0x164e18){_0xfd862d[_0xdb00('0x1a')](0x194);}return _0x164e18;};}function handleError(_0x4593ce,_0x4c13d8){_0x4c13d8=_0x4c13d8||0x1f4;return function(_0x59ce6f){logger[_0xdb00('0x28')](_0x59ce6f[_0xdb00('0x29')]);if(_0x59ce6f[_0xdb00('0x2a')]){delete _0x59ce6f['name'];}_0x4593ce[_0xdb00('0x1b')](_0x4c13d8)['send'](_0x59ce6f);};}exports[_0xdb00('0x2b')]=function(_0x363a0b,_0xae2037){var _0x4ad23b={},_0x4e8d17={},_0x45aa3b={'count':0x0,'rows':[]};var _0x40187d=_[_0xdb00('0x2c')](db[_0xdb00('0x2d')][_0xdb00('0x2e')],function(_0x27518b){return{'name':_0x27518b[_0xdb00('0x2f')],'type':_0x27518b[_0xdb00('0x30')]['key']};});_0x4e8d17[_0xdb00('0x31')]=_[_0xdb00('0x2c')](_0x40187d,_0xdb00('0x2a'));_0x4e8d17[_0xdb00('0x32')]=_[_0xdb00('0x33')](_0x363a0b[_0xdb00('0x32')]);_0x4e8d17[_0xdb00('0x34')]=_[_0xdb00('0x35')](_0x4e8d17[_0xdb00('0x31')],_0x4e8d17[_0xdb00('0x32')]);_0x4ad23b[_0xdb00('0x36')]=_[_0xdb00('0x35')](_0x4e8d17['model'],qs[_0xdb00('0x37')](_0x363a0b[_0xdb00('0x32')][_0xdb00('0x37')]));_0x4ad23b['attributes']=_0x4ad23b[_0xdb00('0x36')][_0xdb00('0x38')]?_0x4ad23b['attributes']:_0x4e8d17[_0xdb00('0x31')];if(!_0x363a0b['query'][_0xdb00('0x39')](_0xdb00('0x3a'))){_0x4ad23b['limit']=qs['limit'](_0x363a0b[_0xdb00('0x32')][_0xdb00('0x1f')]);_0x4ad23b['offset']=qs[_0xdb00('0x1e')](_0x363a0b[_0xdb00('0x32')][_0xdb00('0x1e')]);}_0x4ad23b['order']=qs[_0xdb00('0x3b')](_0x363a0b[_0xdb00('0x32')]['sort']);_0x4ad23b[_0xdb00('0x3c')]=qs[_0xdb00('0x34')](_['pick'](_0x363a0b[_0xdb00('0x32')],_0x4e8d17[_0xdb00('0x34')]),_0x40187d);if(_0x363a0b['query'][_0xdb00('0x3d')]){_0x4ad23b[_0xdb00('0x3c')]=_[_0xdb00('0x3e')](_0x4ad23b['where'],{'$or':_[_0xdb00('0x2c')](_0x40187d,function(_0x2f721a){if(_0x2f721a['type']!==_0xdb00('0x3f')){var _0x1296fe={};_0x1296fe[_0x2f721a['name']]={'$like':'%'+_0x363a0b['query']['filter']+'%'};return _0x1296fe;}})});}_0x4ad23b=_[_0xdb00('0x3e')]({},_0x4ad23b,_0x363a0b[_0xdb00('0x40')]);var _0x18aca1={'where':_0x4ad23b[_0xdb00('0x3c')]};return db[_0xdb00('0x2d')][_0xdb00('0x1d')](_0x18aca1)[_0xdb00('0x26')](function(_0x2b868a){_0x45aa3b[_0xdb00('0x1d')]=_0x2b868a;if(_0x363a0b[_0xdb00('0x32')][_0xdb00('0x41')]){_0x4ad23b[_0xdb00('0x42')]=[{'all':!![]}];}return db[_0xdb00('0x2d')][_0xdb00('0x43')](_0x4ad23b);})[_0xdb00('0x26')](function(_0x2d8246){_0x45aa3b[_0xdb00('0x44')]=_0x2d8246;return _0x45aa3b;})[_0xdb00('0x26')](respondWithFilteredResult(_0xae2037,_0x4ad23b))[_0xdb00('0x45')](handleError(_0xae2037,null));};exports[_0xdb00('0x46')]=function(_0x51e6d2,_0x507a15){var _0x36c01f={'raw':![],'where':{'id':_0x51e6d2[_0xdb00('0x47')]['id']}},_0x3ad17d={};_0x3ad17d[_0xdb00('0x31')]=_['keys'](db['UserProfile']['rawAttributes']);_0x3ad17d[_0xdb00('0x32')]=_[_0xdb00('0x33')](_0x51e6d2['query']);_0x3ad17d[_0xdb00('0x34')]=_[_0xdb00('0x35')](_0x3ad17d[_0xdb00('0x31')],_0x3ad17d[_0xdb00('0x32')]);_0x36c01f[_0xdb00('0x36')]=_[_0xdb00('0x35')](_0x3ad17d[_0xdb00('0x31')],qs[_0xdb00('0x37')](_0x51e6d2['query'][_0xdb00('0x37')]));_0x36c01f[_0xdb00('0x36')]=_0x36c01f[_0xdb00('0x36')][_0xdb00('0x38')]?_0x36c01f[_0xdb00('0x36')]:_0x3ad17d[_0xdb00('0x31')];if(_0x51e6d2[_0xdb00('0x32')][_0xdb00('0x41')]){_0x36c01f['include']=[{'all':!![]}];}_0x36c01f=_['merge']({},_0x36c01f,_0x51e6d2['options']);return db['UserProfile'][_0xdb00('0x48')](_0x36c01f)['then'](handleEntityNotFound(_0x507a15,null))[_0xdb00('0x26')](respondWithResult(_0x507a15,null))['catch'](handleError(_0x507a15,null));};exports[_0xdb00('0x49')]=function(_0x250f11,_0x4643b3){return db[_0xdb00('0x2d')][_0xdb00('0x49')](_0x250f11[_0xdb00('0x4a')],{})[_0xdb00('0x26')](respondWithResult(_0x4643b3,0xc9))[_0xdb00('0x45')](handleError(_0x4643b3,null));};exports['clone']=function(_0x1daff8,_0x13e668){var _0x37c9a1={'where':{'id':_0x1daff8[_0xdb00('0x47')]['id']}},_0x5cdb7f={};_0x5cdb7f[_0xdb00('0x31')]=_[_0xdb00('0x33')](db['UserProfile'][_0xdb00('0x2e')]);_0x37c9a1['attributes']=_[_0xdb00('0x35')](_0x5cdb7f[_0xdb00('0x31')],qs[_0xdb00('0x37')](_0x1daff8[_0xdb00('0x32')][_0xdb00('0x37')]));_0x37c9a1[_0xdb00('0x36')]=_0x37c9a1[_0xdb00('0x36')][_0xdb00('0x38')]?_0x37c9a1[_0xdb00('0x36')]:_0x5cdb7f[_0xdb00('0x31')];if(_0x1daff8[_0xdb00('0x32')][_0xdb00('0x41')]){_0x37c9a1['include']=[{'all':!![]}];}_0x37c9a1=_['merge']({},_0x37c9a1,_0x1daff8[_0xdb00('0x40')]);return db['UserProfile'][_0xdb00('0x48')](_0x37c9a1)[_0xdb00('0x26')](handleEntityNotFound(_0x13e668,null))[_0xdb00('0x26')](function(_0x4626fd){if(_0x4626fd){var _0x327fb5=_0x4626fd['get']({'plain':!![]});_0x327fb5=qs[_0xdb00('0x4b')](_0x327fb5,['id','createdAt','updatedAt',_0xdb00('0x4c')]);_0x1daff8[_0xdb00('0x4a')]=_[_0xdb00('0x4b')](_0x1daff8[_0xdb00('0x4a')],['id',_0xdb00('0x4d'),_0xdb00('0x4e')]);return db[_0xdb00('0x4f')][_0xdb00('0x50')](function(_0x3d7f24){return db[_0xdb00('0x2d')][_0xdb00('0x49')](_[_0xdb00('0x3e')](_0x327fb5,_0x1daff8['body']),{'include':_0x1daff8[_0xdb00('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3d7f24})[_0xdb00('0x26')](function(_0x228da1){var _0x591646=_0x228da1[_0xdb00('0x51')]({'plain':!![]});return db[_0xdb00('0x52')][_0xdb00('0x43')]({'where':{'userProfileId':_0x1daff8['params']['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x175f69){if(_0x175f69){return BPromise[_0xdb00('0x53')](_0x175f69,function(_0x563a06){return new BPromise(function(_0x56dd74,_0x1165a3){if(_0x563a06[_0xdb00('0x54')]===null||_0x563a06[_0xdb00('0x54')]===0x1)_0x56dd74(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x563a06['id']},'raw':!![]})['then'](function(_0x34a58e){var _0x42ecf9=_['map'](_0x34a58e,function(_0x4b22d4){return qs[_0xdb00('0x4b')](_0x4b22d4,['id','createdAt',_0xdb00('0x4e'),'sectionId']);});_0x56dd74(_0x42ecf9);})[_0xdb00('0x45')](function(_0x1e2b59){_0x1165a3(_0x1e2b59);});})[_0xdb00('0x26')](function(_0x35c3b4){var _0x53737e=qs[_0xdb00('0x4b')](_0x563a06,['id',_0xdb00('0x4d'),_0xdb00('0x4e')]);_0x53737e[_0xdb00('0x55')]=_0x591646['id'];if(_0x35c3b4)_0x53737e[_0xdb00('0x56')]=_0x35c3b4;return _0x53737e;})[_0xdb00('0x26')](function(_0x49866c){return db[_0xdb00('0x52')][_0xdb00('0x49')](_0x49866c,{'include':[{'model':db[_0xdb00('0x57')],'as':_0xdb00('0x56')}],'raw':!![],'transaction':_0x3d7f24});});})[_0xdb00('0x26')](function(){return _0x591646;});}});});});}})[_0xdb00('0x26')](respondWithResult(_0x13e668,0xc9))[_0xdb00('0x45')](handleError(_0x13e668,null));};exports[_0xdb00('0x24')]=function(_0x57bca5,_0x45954b){if(_0x57bca5[_0xdb00('0x4a')]['id']){delete _0x57bca5['body']['id'];}return db[_0xdb00('0x2d')][_0xdb00('0x48')]({'where':{'id':_0x57bca5[_0xdb00('0x47')]['id']}})[_0xdb00('0x26')](handleEntityNotFound(_0x45954b,null))['then'](saveUpdates(_0x57bca5[_0xdb00('0x4a')],null))[_0xdb00('0x26')](respondWithResult(_0x45954b,null))[_0xdb00('0x45')](handleError(_0x45954b,null));};exports[_0xdb00('0x25')]=function(_0x279ab3,_0x2b7db4){return db['UserProfile'][_0xdb00('0x48')]({'where':{'id':_0x279ab3[_0xdb00('0x47')]['id']}})[_0xdb00('0x26')](handleEntityNotFound(_0x2b7db4,null))[_0xdb00('0x26')](removeEntity(_0x2b7db4,null))['catch'](handleError(_0x2b7db4,null));};exports[_0xdb00('0x58')]=function(_0x4cc00a,_0x489875){return db['UserProfile'][_0xdb00('0x58')]()['then'](respondWithResult(_0x489875,null))[_0xdb00('0x45')](handleError(_0x489875,null));};exports['addSections']=function(_0x3add0e,_0x3e69d0){var _0x5c3387=_0x3add0e['body'];return db[_0xdb00('0x2d')]['find']({'where':{'id':_0x3add0e[_0xdb00('0x47')]['id']}})[_0xdb00('0x26')](handleEntityNotFound(_0x3e69d0,null))['then'](function(_0x172a9b){if(_0x172a9b){return db[_0xdb00('0x4f')][_0xdb00('0x50')](function(_0x298aff){return db[_0xdb00('0x52')]['destroy']({'where':{'userProfileId':_0x3add0e[_0xdb00('0x47')]['id'],'sectionId':_[_0xdb00('0x2c')](_0x5c3387,function(_0x2367c6){return _0x2367c6[_0xdb00('0x59')];})},'transaction':_0x298aff})['then'](function(){var _0x20c1fb=_[_0xdb00('0x2c')](_0x5c3387,function(_0x37e193){_0x37e193[_0xdb00('0x55')]=_0x3add0e[_0xdb00('0x47')]['id'];return _0x37e193;});var _0x450eb8=[];return BPromise[_0xdb00('0x53')](_0x20c1fb,function(_0x5d4fc9){return db[_0xdb00('0x52')][_0xdb00('0x49')](_0x5d4fc9,{'include':[{'model':db[_0xdb00('0x57')],'as':_0xdb00('0x56')}],'raw':!![],'transaction':_0x298aff})[_0xdb00('0x26')](function(_0x84df6){_0x450eb8[_0xdb00('0x5a')](_0x84df6['get']({'plain':!![]}));});})[_0xdb00('0x26')](function(){return _0x450eb8;});});});}})[_0xdb00('0x26')](function(_0x497046){return _0x497046;})['then'](respondWithResult(_0x3e69d0,null))[_0xdb00('0x45')](handleError(_0x3e69d0,null));};exports[_0xdb00('0x5b')]=function(_0x4683b5,_0x5ca634){var _0x177c52;return db[_0xdb00('0x2d')][_0xdb00('0x48')]({'where':{'id':_0x4683b5[_0xdb00('0x47')]['id']},'attributes':['id',_0xdb00('0x2a')]})[_0xdb00('0x26')](handleEntityNotFound(_0x5ca634,null))[_0xdb00('0x26')](function(_0x40bbba){if(_0x40bbba){_0x177c52=_0x40bbba;return db['UserProfileSection'][_0xdb00('0x25')]({'where':{'userProfileId':_0x4683b5[_0xdb00('0x47')]['id'],'sectionId':_0x4683b5[_0xdb00('0x32')]['ids']}});}})[_0xdb00('0x26')](function(){return _0x177c52;})['then'](respondWithStatusCode(_0x5ca634,null))[_0xdb00('0x45')](handleError(_0x5ca634,null));};exports[_0xdb00('0x5c')]=function(_0x4d0604,_0x243a1d){var _0x4b8b88=[];var _0xd1a7eb=[];return db[_0xdb00('0x52')][_0xdb00('0x43')]({'where':{'userProfileId':_0x4d0604[_0xdb00('0x47')]['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x1dd0ae){_0x4b8b88=_[_0xdb00('0x3d')](_0x1dd0ae,function(_0x4cc149){return _0x4cc149[_0xdb00('0x5d')]===0x1||_[_0xdb00('0x5e')]([0x3eb,0x709],_0x4cc149[_0xdb00('0x59')]);});if(!_[_0xdb00('0x5f')](_0x4b8b88)){return _[_0xdb00('0x2c')](_0x4b8b88,function(_0x27c40c){return _0x27c40c['sectionId'];});}else{return;}})[_0xdb00('0x26')](function(_0x3bce41){if(_0x3bce41)_0xd1a7eb=_0x3bce41;if(_[_0xdb00('0x5e')](_0xd1a7eb,0x64)){var _0x521255=_[_0xdb00('0x48')](_0x4b8b88,{'sectionId':0x64});return hasDefaultDashboard(_0x521255)['then'](function(_0x993f04){return _['map'](_0x4b8b88,function(_0x5305e9){if(_0x5305e9[_0xdb00('0x59')]===0x64){_0x5305e9[_0xdb00('0x60')]=_0x993f04;}return _0x5305e9;});});}else{return;}})['then'](function(_0x46e0e5){if(_0x46e0e5)_0x4b8b88=_0x46e0e5;if(_['includes'](_0xd1a7eb,0x3eb)){var _0x97a294=_[_0xdb00('0x48')](_0x4b8b88,{'sectionId':0x3eb});return getCustomDashboards(_0x97a294)['then'](function(_0xbf9c5e){return _[_0xdb00('0x2c')](_0x4b8b88,function(_0x2da3ba){if(_0x97a294[_0xdb00('0x5d')]){if(_0x2da3ba[_0xdb00('0x59')]===0x3eb){_0x2da3ba[_0xdb00('0x60')]=_0xbf9c5e;}}else{if(_0x2da3ba[_0xdb00('0x59')]===0x64){_0x2da3ba[_0xdb00('0x60')]=_0xbf9c5e;}}return _0x2da3ba;});});}else{return;}})[_0xdb00('0x26')](function(_0x5ab2f6){if(_0x5ab2f6)_0x4b8b88=_0x5ab2f6;if(_[_0xdb00('0x5e')](_0xd1a7eb,0x709)){var _0x143c8a=_['find'](_0x4b8b88,{'sectionId':0x709});return getPlugins(_0x143c8a)[_0xdb00('0x26')](function(_0x5a6222){if(_0x143c8a['enabled']){return _['map'](_0x4b8b88,function(_0x5ccd3e){if(_0x5ccd3e[_0xdb00('0x59')]===0x709){_0x5ccd3e[_0xdb00('0x60')]=_0x5a6222;}return _0x5ccd3e;});}else{var _0x58e29a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5a6222};var _0x5100cf=_['map'](_0x4b8b88);_0x5100cf[_0xdb00('0x5a')](_0x58e29a);return _0x5100cf;}});}else{return;}})['then'](function(_0x40aeb7){if(_0x40aeb7)_0x4b8b88=_0x40aeb7;return _['filter'](_0x4b8b88,[_0xdb00('0x5d'),0x1]);})[_0xdb00('0x26')](respondWithResult(_0x243a1d,null))['catch'](handleError(_0x243a1d,null));};function hasDefaultDashboard(_0x4a7dc4){var _0x2d80e1=[0x65];return new BPromise(function(_0x115529,_0xf2cde6){try{if(_0x4a7dc4[_0xdb00('0x54')]){_0x115529(_0x2d80e1);}else{return db[_0xdb00('0x57')][_0xdb00('0x61')]({'where':{'sectionId':_0x4a7dc4['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x46b88d){_0x46b88d?_0x115529(_0x2d80e1):_0x115529();});}}catch(_0x5c298f){_0xf2cde6(_0x5c298f);}});}function getCustomDashboards(_0x3f626c){var _0x33ddb4=[];return new BPromise(function(_0x36113f,_0x2c7713){try{if(_0x3f626c[_0xdb00('0x54')]){return db['Dashboard'][_0xdb00('0x43')]({'raw':!![]})[_0xdb00('0x26')](function(_0x4d6141){_0x4d6141[_0xdb00('0x62')](function(_0x4f5e96){_0x33ddb4[_0xdb00('0x5a')](_0x4f5e96['id']+0x1869f);});_0x36113f(_0x33ddb4);});}else{return db[_0xdb00('0x57')][_0xdb00('0x43')]({'where':{'sectionId':_0x3f626c['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x2c99e5){_0x2c99e5['forEach'](function(_0x1754fb){_0x33ddb4[_0xdb00('0x5a')](_0x1754fb[_0xdb00('0x63')]+0x1869f);});_0x36113f(_0x33ddb4);});}}catch(_0x12056e){_0x2c7713(_0x12056e);}});}function getPlugins(_0x2cfe51){var _0x36314a=[];return new BPromise(function(_0x5e297b,_0x272b7f){try{if(_0x2cfe51['autoAssociation']){return db[_0xdb00('0x64')]['findAll']({'raw':!![]})[_0xdb00('0x26')](function(_0x5e5e99){_0x5e5e99[_0xdb00('0x62')](function(_0xbd384b){_0x36314a[_0xdb00('0x5a')](_0xbd384b['id']+0x15b38);});_0x5e297b(_0x36314a);});}else{return db[_0xdb00('0x57')][_0xdb00('0x43')]({'where':{'sectionId':_0x2cfe51['id']},'raw':!![]})['then'](function(_0x5f0948){_0x5f0948['forEach'](function(_0x2c67c3){_0x36314a[_0xdb00('0x5a')](_0x2c67c3[_0xdb00('0x63')]+0x15b38);});_0x5e297b(_0x36314a);});}}catch(_0x583016){_0x272b7f(_0x583016);}});}exports[_0xdb00('0x65')]=function(_0x4ab305,_0x4c3be1){return db[_0xdb00('0x2d')]['find']({'where':{'id':_0x4ab305[_0xdb00('0x47')]['id']}})[_0xdb00('0x26')](handleEntityNotFound(_0x4c3be1,null))[_0xdb00('0x26')](function(_0x360b0d){if(_0x360b0d){return db['sequelize'][_0xdb00('0x50')](function(_0x274270){return db[_0xdb00('0x52')][_0xdb00('0x43')]({'where':{'userProfileId':_0x4ab305[_0xdb00('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xdb00('0x26')](function(_0x3f8f95){if(_0x3f8f95){return db[_0xdb00('0x52')][_0xdb00('0x25')]({'where':{'userProfileId':_0x4ab305[_0xdb00('0x47')]['id'],'id':_[_0xdb00('0x2c')](_0x3f8f95,function(_0x518082){return _0x518082['id'];})},'transaction':_0x274270});}})[_0xdb00('0x26')](function(_0x57391e){var _0x40465d=_[_0xdb00('0x2c')](_0x4ab305[_0xdb00('0x4a')],function(_0x4d7a14){_0x4d7a14[_0xdb00('0x55')]=_0x4ab305[_0xdb00('0x47')]['id'];return _0x4d7a14;});return db['UserProfileSection'][_0xdb00('0x66')](_0x40465d,{'raw':!![],'transaction':_0x274270});})[_0xdb00('0x26')](function(_0x595f7b){var _0x45a10d=_[_0xdb00('0x3d')](_[_0xdb00('0x2c')](_0x595f7b,function(_0x1446b9){return _0x1446b9['get']({'plain':!![]});}),{'includeAll':![]});if(_0x45a10d){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4ab305[_0xdb00('0x47')]['id'],'sectionId':_[_0xdb00('0x2c')](_0x45a10d,function(_0x471681){return _0x471681['sectionId'];})},'attributes':['id',_0xdb00('0x59')],'raw':!![]})[_0xdb00('0x26')](function(_0x235080){var _0x29b920=_[_0xdb00('0x2c')](_0x4ab305[_0xdb00('0x4a')],function(_0x5b11ed){_0x5b11ed[_0xdb00('0x55')]=_0x4ab305['params']['id'];return _0x5b11ed;});return db[_0xdb00('0x57')][_0xdb00('0x66')](_0x29b920,{'raw':!![],'transaction':_0x274270});});}})['catch'](handleError(_0x4c3be1,null));});}})[_0xdb00('0x26')](function(_0x3ca7b1){var _0x2fd8ed=_[_0xdb00('0x2c')](_0x3ca7b1,function(_0xbdddda){return _0xbdddda['get']({'plain':!![]});});})[_0xdb00('0x26')](respondWithResult(_0x4c3be1,null))['catch'](handleError(_0x4c3be1,null));};exports[_0xdb00('0x67')]=function(_0x5a7fcb,_0x1420c5,_0x4a2d71){return db['UserProfile'][_0xdb00('0x48')]({'where':{'id':_0x5a7fcb[_0xdb00('0x47')]['id']}})['then'](handleEntityNotFound(_0x1420c5,null))['then'](function(_0x4b04c5){if(_0x4b04c5){return _0x4b04c5[_0xdb00('0x67')](_0x5a7fcb[_0xdb00('0x32')][_0xdb00('0x68')]);}})['then'](respondWithStatusCode(_0x1420c5,null))[_0xdb00('0x45')](handleError(_0x1420c5,null));};exports[_0xdb00('0x69')]=function(_0x22ddcd,_0x4e99e1){var _0x51f346={'raw':![],'where':{}};var _0x197510={};var _0x5a1b09={'count':0x0,'rows':[]};var _0x3ecc6f=_0x22ddcd['query'][_0xdb00('0x6a')];if(typeof _0x3ecc6f===_0xdb00('0x6b')){throw new db[(_0xdb00('0x6c'))][(_0xdb00('0x6d'))](_0xdb00('0x6e'));}var _0x147b0b=_0x22ddcd['query'][_0xdb00('0x6f')]||![];var _0x5180ca=getQueryModels(_0x3ecc6f,_0x147b0b);if(typeof _0x5180ca[_0xdb00('0x70')]===_0xdb00('0x6b')){throw new db[(_0xdb00('0x6c'))][(_0xdb00('0x6d'))](_0xdb00('0x71')+_0x3ecc6f+'\x27');}var _0x363b2e=[];if(!_[_0xdb00('0x5f')](_0x5180ca[_0xdb00('0x72')])){_0x363b2e=_0x5180ca[_0xdb00('0x72')];}else{_0x363b2e=[{'name':_0x3ecc6f}];}return db['UserProfile'][_0xdb00('0x61')]({'where':{'id':_0x22ddcd[_0xdb00('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e99e1,null))[_0xdb00('0x26')](function(_0x1ddbd2){if(_0x1ddbd2){var _0x25d2a4=[];for(var _0x5317d4=0x0;_0x5317d4<_0x363b2e[_0xdb00('0x38')];_0x5317d4++){_0x25d2a4['push'](db[_0xdb00('0x52')][_0xdb00('0x61')]({'where':{'userProfileId':_0x1ddbd2['id'],'name':_0x363b2e[_0x5317d4][_0xdb00('0x2a')]},'raw':!![]}));}return BPromise[_0xdb00('0x73')](_0x25d2a4);}})[_0xdb00('0x26')](function(_0x38cce4){var _0x414770=_['filter'](_0x38cce4,function(_0x3ac74e){return _0x3ac74e?_0x3ac74e:undefined;});var _0x53775b=_[_0xdb00('0x3d')](_0x363b2e,[_0xdb00('0x74'),!![]]);var _0x483416=_['isEmpty'](_0x414770)&&_['isEmpty'](_0x53775b)?null:_[_0xdb00('0x75')](_0x53775b,_0x414770);if(_0x483416){var _0xbcca22=[];for(var _0x4ce57e=0x0;_0x4ce57e<_0x483416['length'];_0x4ce57e++){var _0x5dcf85=_[_0xdb00('0x48')](_0x363b2e,function(_0x2a1ed8){return _0x483416[_0x4ce57e]?_0x2a1ed8[_0xdb00('0x2a')]===_0x483416[_0x4ce57e][_0xdb00('0x2a')]:null;});if(_0x5dcf85){if(_0x483416[_0x4ce57e][_0xdb00('0x74')]){_0xbcca22[_0xdb00('0x5a')](getAllResources(_0x5180ca[_0xdb00('0x70')],_0x483416[_0x4ce57e]));}else{if(!_0x483416[_0x4ce57e]['autoAssociation']){_0xbcca22[_0xdb00('0x5a')](getAllowedResources(_0x5dcf85,_0x483416[_0x4ce57e],_0x5180ca['childModel']));}else{if(_0x5dcf85[_0xdb00('0x31')]){_0xbcca22[_0xdb00('0x5a')](getAllFilteredResources(_0x5dcf85,_0x483416[_0x4ce57e]));}}}}}return BPromise[_0xdb00('0x73')](_0xbcca22);}else{return null;}})[_0xdb00('0x26')](function(_0x5cbd75){var _0x4644fe=_0x5cbd75;var _0x40558b=null;if(_0x4644fe){_0x40558b=_0x4644fe['length']===0x1?_0x4644fe[0x0]:null;}if(_0x40558b||_0x4644fe){var _0x54d5d4=db[_0x5180ca['childModel']][_0xdb00('0x2e')];_0x197510[_0xdb00('0x31')]=_[_0xdb00('0x33')](_0x54d5d4);_0x197510[_0xdb00('0x32')]=_[_0xdb00('0x33')](_0x22ddcd[_0xdb00('0x32')]);_0x197510['filters']=_[_0xdb00('0x35')](_0x197510[_0xdb00('0x31')],_0x197510['query']);_0x51f346[_0xdb00('0x36')]=_[_0xdb00('0x35')](_0x197510[_0xdb00('0x31')],qs['fields'](_0x22ddcd['query'][_0xdb00('0x37')]));_0x51f346['attributes']=_0x51f346['attributes'][_0xdb00('0x38')]?_0x51f346['attributes']:_0x197510[_0xdb00('0x31')];if(!_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x39')](_0xdb00('0x3a'))){_0x51f346[_0xdb00('0x1f')]=qs[_0xdb00('0x1f')](_0x22ddcd[_0xdb00('0x32')]['limit']);_0x51f346[_0xdb00('0x1e')]=qs['offset'](_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x1e')]);}_0x51f346['order']=qs['sort'](_0x22ddcd['query'][_0xdb00('0x3b')]);_0x51f346[_0xdb00('0x3c')]=qs[_0xdb00('0x34')](_[_0xdb00('0x76')](_0x22ddcd[_0xdb00('0x32')],_0x197510[_0xdb00('0x34')]));if(_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x3d')]){_0x51f346[_0xdb00('0x3c')]=_[_0xdb00('0x3e')](_0x51f346[_0xdb00('0x3c')],{'$or':_[_0xdb00('0x2c')](_0x54d5d4,function(_0x498e56){if(_0x498e56[_0xdb00('0x30')][_0xdb00('0x77')]!==_0xdb00('0x3f')){var _0x1e45db={};_0x1e45db[_0x498e56[_0xdb00('0x78')]]={'$like':'%'+_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x3d')]+'%'};return _0x1e45db;}})});}var _0x2c409b=[];if(_0x40558b){var _0x188301=_[_0xdb00('0x48')](_0x363b2e,['name',_0x40558b[_0xdb00('0x2a')]]);if(_0x188301['field']){var _0x26abe5={};if(_0x5180ca[_0xdb00('0x70')]===_0xdb00('0x79')){_0x26abe5[_0x188301[_0xdb00('0x7a')]]=_[_0xdb00('0x2c')](_0x40558b[_0xdb00('0x7b')],'id');}else{_0x26abe5[_0x188301[_0xdb00('0x7a')]]=_0x40558b[_0xdb00('0x7b')];}_0x2c409b[_0xdb00('0x5a')](_0x26abe5);}else{_0x51f346['where']['id']=_0x40558b[_0xdb00('0x7b')];}}else{for(var _0x47a44e=0x0;_0x47a44e<_0x4644fe[_0xdb00('0x38')];_0x47a44e++){var _0x188301=_[_0xdb00('0x48')](_0x363b2e,[_0xdb00('0x2a'),_0x4644fe[_0x47a44e][_0xdb00('0x2a')]]);if(_0x188301[_0xdb00('0x78')]){var _0x26abe5={};_0x26abe5[_0x188301['foreignKey']]=_0x4644fe[_0x47a44e][_0xdb00('0x7b')];_0x2c409b[_0xdb00('0x5a')](_0x26abe5);}else{if(!_0x51f346[_0xdb00('0x3c')]['id'])_0x51f346['where']['id']=[];_0x4644fe[_0x47a44e][_0xdb00('0x7b')][_0xdb00('0x62')](function(_0x514c7a){_0x51f346[_0xdb00('0x3c')]['id']['push'](_0x514c7a);});}}}if(!_['isEmpty'](_0x2c409b)){_0x51f346[_0xdb00('0x3c')]=_[_0xdb00('0x3e')](_0x51f346['where'],{'$and':{'$or':_0x2c409b}});}_0x51f346=_[_0xdb00('0x3e')]({},_0x51f346,_0x22ddcd[_0xdb00('0x40')]);if(_0x40558b&&!_0x40558b['autoAssociation']&&_0x5180ca[_0xdb00('0x70')]===_0xdb00('0x79')){if(_0x22ddcd['query'][_0xdb00('0x41')]){_0x51f346[_0xdb00('0x42')]=[{'all':!![]}];}return db[_0x5180ca[_0xdb00('0x70')]]['findAll'](_0x51f346)[_0xdb00('0x26')](function(_0xed8204){var _0x3e2cc3=[];_0xed8204[_0xdb00('0x62')](function(_0x76c633){var _0x20cd29;switch(_0x76c633['reportType']){case _0xdb00('0x7c'):_0x20cd29=_['find'](_0x40558b[_0xdb00('0x7b')],function(_0x7be856){return _0x7be856['id']===_0x76c633['reportId']&&_0x7be856[_0xdb00('0x30')]===_0xdb00('0x7d');});break;case _0xdb00('0x7e'):_0x20cd29=_[_0xdb00('0x48')](_0x40558b[_0xdb00('0x7b')],function(_0x49eadf){return _0x49eadf['id']===_0x76c633[_0xdb00('0x7f')]&&_0x49eadf['type']===_0xdb00('0x80');});break;}if(_0x20cd29)_0x3e2cc3[_0xdb00('0x5a')](_0x76c633);});_0x5a1b09[_0xdb00('0x1d')]=_0x3e2cc3['length'];_0x5a1b09[_0xdb00('0x44')]=_0x3e2cc3;return _0x5a1b09;});}else{return db[_0x5180ca['childModel']][_0xdb00('0x1d')]({'where':_0x51f346[_0xdb00('0x3c')]})[_0xdb00('0x26')](function(_0x151b93){_0x5a1b09[_0xdb00('0x1d')]=_0x151b93;if(_0x22ddcd['query']['includeAll']){if(_0x5180ca['childModel']==='CmContact'){_0x51f346[_0xdb00('0x42')]=[{'model':db[_0xdb00('0x81')],'as':_0xdb00('0x82'),'attributes':['id',_0xdb00('0x2a'),_0xdb00('0x83')],'required':_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x84')]?!![]:![]},{'model':db['Tag'],'as':_0xdb00('0x85'),'attributes':['id',_0xdb00('0x2a'),_0xdb00('0x83')],'through':_0x22ddcd[_0xdb00('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x22ddcd['query'][_0xdb00('0x84')]||undefined}}:{},'required':_0x22ddcd[_0xdb00('0x32')]['tag']?!![]:![]}];}else{_0x51f346[_0xdb00('0x42')]=[{'all':!![]}];}}return db[_0x5180ca[_0xdb00('0x70')]][_0xdb00('0x43')](_0x51f346);})[_0xdb00('0x26')](function(_0x3b0426){_0x5a1b09[_0xdb00('0x44')]=_0x3b0426;return _0x5a1b09;});}}else{return _0x5a1b09;}})[_0xdb00('0x26')](respondWithFilteredResult(_0x4e99e1,_0x51f346))[_0xdb00('0x45')](handleError(_0x4e99e1,null));};function getAllResources(_0x186a3a,_0x585662){return new BPromise(function(_0x20efc1,_0x4e99b8){if(_0x585662){var _0x18190c=_0x585662[_0xdb00('0x3d')]?{[_0x585662['filter']['field']]:_0x585662[_0xdb00('0x3d')][_0xdb00('0x86')]}:undefined;return db[_0x186a3a][_0xdb00('0x43')]({'where':_0x18190c,'raw':!![]})[_0xdb00('0x26')](function(_0x39fc86){_0x585662['associatedResources']=_[_0xdb00('0x2c')](_0x39fc86,'id');_0x20efc1(_0x585662);})[_0xdb00('0x45')](function(_0x581a5d){_0x4e99b8(_0x581a5d);});}else{_0x20efc1(null);}});}function getAllFilteredResources(_0x55fa22,_0x4873ba){return new BPromise(function(_0x3aa001,_0x1ac53a){var _0x3504be=_0x55fa22[_0xdb00('0x3d')]?{[_0x55fa22[_0xdb00('0x3d')]['field']]:_0x55fa22[_0xdb00('0x3d')]['value']}:undefined;return db[_0x55fa22[_0xdb00('0x31')]][_0xdb00('0x43')]({'where':_0x3504be,'raw':!![]})[_0xdb00('0x26')](function(_0x48f9c6){_0x4873ba[_0xdb00('0x7b')]=_['map'](_0x48f9c6,function(_0x4b26b2){return _0x4b26b2[_0xdb00('0x2a')];});_0x3aa001(_0x4873ba);})[_0xdb00('0x45')](function(_0x68183f){_0x1ac53a(_0x68183f);});});}function getAllowedResources(_0x376c91,_0x367abd,_0x4793e0){return new BPromise(function(_0x4cf459,_0x58ec9c){if(_0x367abd){return db[_0xdb00('0x57')]['findAll']({'where':{'sectionId':_0x367abd['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x1509b5){if(_0x376c91['field']&&_0x376c91[_0xdb00('0x78')]!=='id'){_0x367abd[_0xdb00('0x7b')]=_[_0xdb00('0x2c')](_0x1509b5,function(_0x53dd8c){return _0x53dd8c[_0x376c91['field']];});}else{if(_0x4793e0===_0xdb00('0x79')){_0x367abd[_0xdb00('0x7b')]=_[_0xdb00('0x2c')](_0x1509b5,function(_0x3e1579){return{'id':_0x3e1579[_0xdb00('0x63')],'type':_0x3e1579[_0xdb00('0x30')]};});}else{_0x367abd[_0xdb00('0x7b')]=_[_0xdb00('0x2c')](_0x1509b5,function(_0x4f41de){return _0x4f41de[_0xdb00('0x63')];});}}_0x4cf459(_0x367abd);})[_0xdb00('0x45')](function(_0x4805fa){_0x58ec9c(_0x4805fa);});}else{_0x4cf459(null);}});}function getQueryModels(_0x5c68f5,_0x15bc6c){var _0x3dd05c=_0x5c68f5[_0xdb00('0x87')]();var _0x2889ed={'childModel':undefined,'parentSections':[]};switch(_0x3dd05c){case _0xdb00('0x88'):_0x2889ed[_0xdb00('0x70')]='SquareProject';break;case _0xdb00('0x89'):_0x2889ed[_0xdb00('0x70')]='SquareOdbc';break;case _0xdb00('0x8a'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x8b');_0x2889ed[_0xdb00('0x72')]=[{'name':'SquareProjects','field':_0xdb00('0x2a'),'foreignKey':_0xdb00('0x8c')}];break;case'projects':_0x2889ed[_0xdb00('0x70')]='JscriptyProject';break;case _0xdb00('0x8d'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x8e');_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0x8f'),'field':'id','foreignKey':_0xdb00('0x90')}];break;case _0xdb00('0x91'):_0x2889ed['childModel']='CmList';break;case _0xdb00('0x92'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x93');break;case _0xdb00('0x94'):_0x2889ed['childModel']=_0xdb00('0x95');break;case'chatqueues':_0x2889ed[_0xdb00('0x70')]='ChatQueue';break;case _0xdb00('0x96'):_0x2889ed[_0xdb00('0x70')]='ChatWebsite';break;case _0xdb00('0x97'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x98');break;case'faxaccounts':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x99');break;case'inboundroutes':case _0xdb00('0x9a'):case'outboundroutes':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x9b');break;case _0xdb00('0x9c'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x9d');break;case _0xdb00('0x9e'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x9f');break;case _0xdb00('0xa0'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xa1');_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0xa2'),'field':_0xdb00('0x2a'),'foreignKey':_0xdb00('0xa3'),'model':_0xdb00('0xa4'),'filter':{'field':_0xdb00('0xa5'),'value':[_0xdb00('0xa6')]}},{'name':_0xdb00('0xa7'),'field':_0xdb00('0x2a'),'foreignKey':'membername','model':_0xdb00('0xa4'),'filter':{'field':_0xdb00('0xa5'),'value':[_0xdb00('0xa8')]}},{'name':_0xdb00('0xa9'),'field':_0xdb00('0x2a'),'foreignKey':_0xdb00('0xaa'),'model':'VoiceQueue','filter':{'field':_0xdb00('0x30'),'value':[_0xdb00('0xab')]}},{'name':_0xdb00('0xac'),'field':_0xdb00('0x2a'),'foreignKey':_0xdb00('0xaa'),'model':_0xdb00('0xad'),'filter':{'field':_0xdb00('0x30'),'value':[_0xdb00('0xae')]}}];break;case'musiconholds':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xaf');break;case _0xdb00('0xb0'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xb1');break;case _0xdb00('0xb2'):_0x2889ed[_0xdb00('0x70')]='VoicePrefix';break;case _0xdb00('0xb3'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xb4');break;case'mailqueues':_0x2889ed['childModel']=_0xdb00('0xb5');break;case _0xdb00('0xb6'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xb7');break;case'mailsubstatuses':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xb8');break;case'openchannelqueues':_0x2889ed['childModel']=_0xdb00('0xb9');break;case _0xdb00('0xba'):_0x2889ed['childModel']='OpenchannelAccount';break;case _0xdb00('0xbb'):_0x2889ed['childModel']=_0xdb00('0xbc');break;case _0xdb00('0xbd'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xbe');break;case _0xdb00('0xbf'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xc0');break;case _0xdb00('0xc1'):_0x2889ed[_0xdb00('0x70')]='WhatsappAccount';break;case _0xdb00('0xc2'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xc3');break;case _0xdb00('0xc4'):case _0xdb00('0xc5'):_0x2889ed['childModel']=_0xdb00('0xad');if(_0x15bc6c){_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0xa9')},{'name':_0xdb00('0xac')}];}break;case _0xdb00('0xc6'):case _0xdb00('0xc7'):case _0xdb00('0xc8'):_0x2889ed['childModel']='User';if(_0x15bc6c){_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0xc9'),'filter':{'field':_0xdb00('0xa5'),'value':[_0xdb00('0xca'),'user']},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0xdb00('0xcb'):_0x2889ed['childModel']=_0xdb00('0xcc');break;case _0xdb00('0xcd'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xce');break;case _0xdb00('0xcf'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xd0');break;case _0xdb00('0xd1'):_0x2889ed['childModel']=_0xdb00('0xd2');break;case'deskaccounts':_0x2889ed['childModel']=_0xdb00('0xd3');break;case'zohoaccounts':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xd4');break;case'vtigeraccounts':_0x2889ed['childModel']=_0xdb00('0xa4');break;case'cannedanswers':_0x2889ed['childModel']=_0xdb00('0xd5');break;case _0xdb00('0xd6'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xd7');break;case'customdashboards':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xd8');break;case _0xdb00('0xd9'):_0x2889ed['childModel']=_0xdb00('0xda');break;case _0xdb00('0xdb'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xdc');break;case'scheduler':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xdd');break;case _0xdb00('0xde'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xdf');break;case'tags':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x81');break;case _0xdb00('0xe0'):_0x2889ed['childModel']=_0xdb00('0xe1');break;case'triggers':_0x2889ed[_0xdb00('0x70')]='Trigger';break;case _0xdb00('0xe2'):_0x2889ed[_0xdb00('0x70')]='Trunk';break;case _0xdb00('0xe3'):_0x2889ed['childModel']=_0xdb00('0xe4');break;case _0xdb00('0xe5'):_0x2889ed['childModel']=_0xdb00('0x64');break;case _0xdb00('0xe6'):_0x2889ed['childModel']=_0xdb00('0x79');_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0xe7'),'field':'id','foreignKey':_0xdb00('0x7f')}];break;case _0xdb00('0xe8'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xe9');break;case _0xdb00('0xc1'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xea');break;default:return _0x2889ed;}return _0x2889ed;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 0eb0e94..e72cbec 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e5f=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x1effdf,_0x356292){var _0x4b27c2=function(_0x5e2b17){while(--_0x5e2b17){_0x1effdf['push'](_0x1effdf['shift']());}};_0x4b27c2(++_0x356292);}(_0x5e5f,0x6f));var _0xf5e5=function(_0x544ca4,_0x1eea36){_0x544ca4=_0x544ca4-0x0;var _0x130ecf=_0x5e5f[_0x544ca4];return _0x130ecf;};'use strict';var EventEmitter=require(_0xf5e5('0x0'));var UserProfile=require(_0xf5e5('0x1'))['db'][_0xf5e5('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf5e5('0x3')](0x0);var events={'afterCreate':_0xf5e5('0x4'),'afterUpdate':'update','afterDestroy':_0xf5e5('0x5')};function emitEvent(_0x52b665){return function(_0x50595e,_0x53f540,_0xeda2be){UserProfileEvents[_0xf5e5('0x6')](_0x52b665+':'+_0x50595e['id'],_0x50595e);UserProfileEvents[_0xf5e5('0x6')](_0x52b665,_0x50595e);_0xeda2be(null);};}for(var e in events){if(events[_0xf5e5('0x7')](e)){var event=events[e];UserProfile[_0xf5e5('0x8')](e,emitEvent(event));}}module[_0xf5e5('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xa615=['update','emit','hasOwnProperty','hook','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x5dadc1,_0x1c4785){var _0x197fbd=function(_0x4f6480){while(--_0x4f6480){_0x5dadc1['push'](_0x5dadc1['shift']());}};_0x197fbd(++_0x1c4785);}(_0xa615,0x175));var _0x5a61=function(_0x507a3b,_0x2e8aba){_0x507a3b=_0x507a3b-0x0;var _0x31a2e0=_0xa615[_0x507a3b];return _0x31a2e0;};'use strict';var EventEmitter=require(_0x5a61('0x0'));var UserProfile=require(_0x5a61('0x1'))['db'][_0x5a61('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5a61('0x3')](0x0);var events={'afterCreate':_0x5a61('0x4'),'afterUpdate':_0x5a61('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1e8727){return function(_0xa29cb0,_0x4d53ed,_0x2c975f){UserProfileEvents[_0x5a61('0x6')](_0x1e8727+':'+_0xa29cb0['id'],_0xa29cb0);UserProfileEvents[_0x5a61('0x6')](_0x1e8727,_0xa29cb0);_0x2c975f(null);};}for(var e in events){if(events[_0x5a61('0x7')](e)){var event=events[e];UserProfile[_0x5a61('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index c7c2c79..a846f88 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x198b=['rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x198b,0xbd));var _0xb198=function(_0x472438,_0x1fd9cd){_0x472438=_0x472438-0x0;var _0x1ddcea=_0x198b[_0x472438];return _0x1ddcea;};'use strict';var _=require(_0xb198('0x0'));var util=require(_0xb198('0x1'));var logger=require(_0xb198('0x2'))(_0xb198('0x3'));var moment=require(_0xb198('0x4'));var BPromise=require('bluebird');var rp=require(_0xb198('0x5'));var fs=require('fs');var path=require(_0xb198('0x6'));var rimraf=require(_0xb198('0x7'));var config=require(_0xb198('0x8'));var attributes=require(_0xb198('0x9'));module[_0xb198('0xa')]=function(_0x4ff5ca,_0x4e553e){return _0x4ff5ca[_0xb198('0xb')](_0xb198('0xc'),attributes,{'tableName':_0xb198('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe53e=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./userProfile.attributes','exports','define','UserProfile','lodash','util'];(function(_0x2caf3d,_0x330368){var _0x5f0bca=function(_0x421d8a){while(--_0x421d8a){_0x2caf3d['push'](_0x2caf3d['shift']());}};_0x5f0bca(++_0x330368);}(_0xe53e,0x6a));var _0xee53=function(_0x3615cd,_0x9dce6e){_0x3615cd=_0x3615cd-0x0;var _0x1350a4=_0xe53e[_0x3615cd];return _0x1350a4;};'use strict';var _=require(_0xee53('0x0'));var util=require(_0xee53('0x1'));var logger=require(_0xee53('0x2'))(_0xee53('0x3'));var moment=require(_0xee53('0x4'));var BPromise=require(_0xee53('0x5'));var rp=require(_0xee53('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee53('0x7'));var config=require('../../config/environment');var attributes=require(_0xee53('0x8'));module[_0xee53('0x9')]=function(_0x5524e5,_0x1fe5fa){return _0x5524e5[_0xee53('0xa')](_0xee53('0xb'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5e3866e..f5f08c7 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0xabce,0x103));var _0xeabc=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xabce[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});config[_0xeabc('0x9')]=_['defaults'](config[_0xeabc('0x9')],{'host':_0xeabc('0xa'),'port':0x18eb});var socket=require(_0xeabc('0xb'))(new Redis(config['redis']));require(_0xeabc('0xc'))[_0xeabc('0xd')](socket);function respondWithRpcPromise(_0x2f73e9,_0x1b4d1b,_0x4301e4){return new BPromise(function(_0x283cdf,_0x111aaf){return client[_0xeabc('0xe')](_0x2f73e9,_0x4301e4)[_0xeabc('0xf')](function(_0xf0d9c0){logger[_0xeabc('0x10')](_0xeabc('0x11'),_0x1b4d1b,_0xeabc('0x12'));logger[_0xeabc('0x13')](_0xeabc('0x14'),_0x1b4d1b,_0xeabc('0x12'),JSON['stringify'](_0xf0d9c0));if(_0xf0d9c0[_0xeabc('0x15')]){if(_0xf0d9c0[_0xeabc('0x15')][_0xeabc('0x16')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1b4d1b,_0xf0d9c0[_0xeabc('0x15')][_0xeabc('0x17')]);return _0x111aaf(_0xf0d9c0[_0xeabc('0x15')]['message']);}logger[_0xeabc('0x15')](_0xeabc('0x11'),_0x1b4d1b,_0xf0d9c0['error']['message']);return _0x283cdf(_0xf0d9c0[_0xeabc('0x15')]['message']);}else{logger[_0xeabc('0x10')](_0xeabc('0x11'),_0x1b4d1b,_0xeabc('0x12'));_0x283cdf(_0xf0d9c0[_0xeabc('0x18')][_0xeabc('0x17')]);}})[_0xeabc('0x19')](function(_0x384be5){logger[_0xeabc('0x15')]('UserProfile,\x20%s,\x20%s',_0x1b4d1b,_0x384be5);_0x111aaf(_0x384be5);});});} \ No newline at end of file +var _0xfdbd=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x48d4dc,_0x2f042e){var _0x1c1c7a=function(_0x1306eb){while(--_0x1306eb){_0x48d4dc['push'](_0x48d4dc['shift']());}};_0x1c1c7a(++_0x2f042e);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0xfdbd[_0x463376];return _0x336ccd;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var moment=require(_0xdfdb('0x2'));var BPromise=require(_0xdfdb('0x3'));var rs=require(_0xdfdb('0x4'));var fs=require('fs');var Redis=require(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var utils=require(_0xdfdb('0x7'));var logger=require(_0xdfdb('0x8'))('rpc');var config=require(_0xdfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdb('0xa')][_0xdfdb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdfdb('0xc'),'port':0x18eb});var socket=require(_0xdfdb('0xd'))(new Redis(config['redis']));require(_0xdfdb('0xe'))[_0xdfdb('0xf')](socket);function respondWithRpcPromise(_0x24eb73,_0x27ddcd,_0x3a44a9){return new BPromise(function(_0x1ace28,_0x2bb8d4){return client['request'](_0x24eb73,_0x3a44a9)[_0xdfdb('0x10')](function(_0x1972db){logger['info'](_0xdfdb('0x11'),_0x27ddcd,_0xdfdb('0x12'));logger[_0xdfdb('0x13')](_0xdfdb('0x14'),_0x27ddcd,_0xdfdb('0x12'),JSON[_0xdfdb('0x15')](_0x1972db));if(_0x1972db[_0xdfdb('0x16')]){if(_0x1972db[_0xdfdb('0x16')]['code']===0x1f4){logger['error'](_0xdfdb('0x11'),_0x27ddcd,_0x1972db['error'][_0xdfdb('0x17')]);return _0x2bb8d4(_0x1972db[_0xdfdb('0x16')][_0xdfdb('0x17')]);}logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0x1972db[_0xdfdb('0x16')]['message']);return _0x1ace28(_0x1972db['error'][_0xdfdb('0x17')]);}else{logger[_0xdfdb('0x18')](_0xdfdb('0x11'),_0x27ddcd,'request\x20sent');_0x1ace28(_0x1972db[_0xdfdb('0x19')][_0xdfdb('0x17')]);}})[_0xdfdb('0x1a')](function(_0xd60a30){logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0xd60a30);_0x2bb8d4(_0xd60a30);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index dec7c79..bd8caad 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e94=['userProfile:','remove','update','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7e94,0x150));var _0x47e9=function(_0x460194,_0x27a7fd){_0x460194=_0x460194-0x0;var _0x2bc096=_0x7e94[_0x460194];return _0x2bc096;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x47e9('0x0'),_0x47e9('0x1')];function createListener(_0x280c16,_0x16e789){return function(_0x106a0f){_0x16e789['emit'](_0x280c16,_0x106a0f);};}function removeListener(_0x3a37e4,_0x55ec32){return function(){UserProfileEvents['removeListener'](_0x3a37e4,_0x55ec32);};}exports[_0x47e9('0x2')]=function(_0x49a47d){for(var _0x9e43cc=0x0,_0x22c1d2=events[_0x47e9('0x3')];_0x9e43cc<_0x22c1d2;_0x9e43cc++){var _0x9debd=events[_0x9e43cc];var _0x3f1e4a=createListener(_0x47e9('0x4')+_0x9debd,_0x49a47d);UserProfileEvents['on'](_0x9debd,_0x3f1e4a);}}; \ No newline at end of file +var _0x5ec5=['userProfile:','save','update','emit','register'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5ec5,0x187));var _0x55ec=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5ec5[_0x167cc1];return _0x10bc4b;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x55ec('0x0'),'remove',_0x55ec('0x1')];function createListener(_0x3ffb4c,_0x407390){return function(_0x2127c4){_0x407390[_0x55ec('0x2')](_0x3ffb4c,_0x2127c4);};}function removeListener(_0x1a8bc1,_0x4953ff){return function(){UserProfileEvents['removeListener'](_0x1a8bc1,_0x4953ff);};}exports[_0x55ec('0x3')]=function(_0x598219){for(var _0x2e1cd6=0x0,_0x3fac4f=events['length'];_0x2e1cd6<_0x3fac4f;_0x2e1cd6++){var _0x1bfd81=events[_0x2e1cd6];var _0x394575=createListener(_0x55ec('0x4')+_0x1bfd81,_0x598219);UserProfileEvents['on'](_0x1bfd81,_0x394575);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 31c15e9..5ca5591 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x518e=['post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x127155,_0x25c0be){var _0x1aac6a=function(_0x352c31){while(--_0x352c31){_0x127155['push'](_0x127155['shift']());}};_0x1aac6a(++_0x25c0be);}(_0x518e,0x1d9));var _0xe518=function(_0x16a51c,_0x135be0){_0x16a51c=_0x16a51c-0x0;var _0x312530=_0x518e[_0x16a51c];return _0x312530;};'use strict';var multer=require(_0xe518('0x0'));var util=require(_0xe518('0x1'));var path=require(_0xe518('0x2'));var timeout=require(_0xe518('0x3'));var express=require(_0xe518('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe518('0x5'));var controller=require(_0xe518('0x6'));router['get']('/',auth[_0xe518('0x7')](),controller[_0xe518('0x8')]);router[_0xe518('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe518('0xa')]);router[_0xe518('0x9')](_0xe518('0xb'),auth[_0xe518('0x7')](),controller[_0xe518('0xc')]);router[_0xe518('0xd')]('/',auth[_0xe518('0x7')](),controller[_0xe518('0xe')]);router['put'](_0xe518('0xb'),auth[_0xe518('0x7')](),controller['update']);router[_0xe518('0xf')](_0xe518('0xb'),auth[_0xe518('0x7')](),controller[_0xe518('0x10')]);module[_0xe518('0x11')]=router; \ No newline at end of file +var _0x667b=['connect-timeout','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x667b,0x1b7));var _0xb667=function(_0x530245,_0x1541ab){_0x530245=_0x530245-0x0;var _0x22506d=_0x667b[_0x530245];return _0x22506d;};'use strict';var multer=require(_0xb667('0x0'));var util=require(_0xb667('0x1'));var path=require(_0xb667('0x2'));var timeout=require(_0xb667('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb667('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb667('0x5'));var controller=require(_0xb667('0x6'));router['get']('/',auth[_0xb667('0x7')](),controller['index']);router[_0xb667('0x8')]('/describe',auth[_0xb667('0x7')](),controller['describe']);router[_0xb667('0x8')](_0xb667('0x9'),auth[_0xb667('0x7')](),controller[_0xb667('0xa')]);router['post']('/',auth[_0xb667('0x7')](),controller[_0xb667('0xb')]);router[_0xb667('0xc')](_0xb667('0x9'),auth[_0xb667('0x7')](),controller[_0xb667('0xd')]);router[_0xb667('0xe')](_0xb667('0x9'),auth[_0xb667('0x7')](),controller[_0xb667('0xf')]);module[_0xb667('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7e905bc..a1662b3 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3f9=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb3f9,0x8e));var _0x9b3f=function(_0x2d3892,_0x1f0033){_0x2d3892=_0x2d3892-0x0;var _0x4306a7=_0xb3f9[_0x2d3892];return _0x4306a7;};'use strict';var Sequelize=require(_0x9b3f('0x0'));module[_0x9b3f('0x1')]={'name':{'type':Sequelize[_0x9b3f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x83c9=['INTEGER','STRING','sequelize'];(function(_0x46345b,_0x38a304){var _0x5b7a99=function(_0x45f010){while(--_0x45f010){_0x46345b['push'](_0x46345b['shift']());}};_0x5b7a99(++_0x38a304);}(_0x83c9,0x161));var _0x983c=function(_0x3b20c2,_0x888661){_0x3b20c2=_0x3b20c2-0x0;var _0x5b4482=_0x83c9[_0x3b20c2];return _0x5b4482;};'use strict';var Sequelize=require(_0x983c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x983c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x983c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index c4c5587..ea8a774 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=_0x26dbb8[_0xac4a('0x1b')],_0x402fff=_0x11e101[_0xac4a('0x1c')],_0x34d797=_0x11e101[_0xac4a('0x1c')]+_0x11e101[_0xac4a('0x1d')],_0x23eb66;if(_0x34d797>=_0x4a2119){_0x34d797=_0x4a2119;_0x23eb66=0xc8;}else{_0x23eb66=0xce;}_0x42c7fc[_0xac4a('0x18')](_0x23eb66);return _0x42c7fc['set']('Content-Range',_0x402fff+'-'+_0x34d797+'/'+_0x4a2119)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x13c8eb){return function(_0x39b691){try{jsonpatch['apply'](_0x39b691,_0x13c8eb,!![]);}catch(_0x39e83e){return BPromise[_0xac4a('0x1e')](_0x39e83e);}return _0x39b691[_0xac4a('0x1f')]();};}function saveUpdates(_0x3a3cdb,_0x123694){return function(_0x3e829c){if(_0x3e829c){return _0x3e829c[_0xac4a('0x20')](_0x3a3cdb)[_0xac4a('0x21')](function(_0x534092){return _0x534092;});}return null;};}function removeEntity(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x22')]()[_0xac4a('0x21')](function(){_0x3d8f0a[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(!_0x2503d8){_0x4d2d6c[_0xac4a('0x17')](0x194);}return _0x2503d8;};}function handleError(_0x412494,_0x594f36){_0x594f36=_0x594f36||0x1f4;return function(_0x2b0dc2){logger[_0xac4a('0x23')](_0x2b0dc2[_0xac4a('0x24')]);if(_0x2b0dc2[_0xac4a('0x25')]){delete _0x2b0dc2[_0xac4a('0x25')];}_0x412494[_0xac4a('0x18')](_0x594f36)[_0xac4a('0x26')](_0x2b0dc2);};}exports[_0xac4a('0x27')]=function(_0x472c57,_0x1c13dc){var _0x20202c={},_0x4e17ce={},_0x23b061={'count':0x0,'rows':[]};var _0x267a22=_[_0xac4a('0x28')](db[_0xac4a('0x29')][_0xac4a('0x2a')],function(_0x4a5a9e){return{'name':_0x4a5a9e['fieldName'],'type':_0x4a5a9e[_0xac4a('0x2b')][_0xac4a('0x2c')]};});_0x4e17ce[_0xac4a('0x2d')]=_['map'](_0x267a22,'name');_0x4e17ce[_0xac4a('0x2e')]=_[_0xac4a('0x2f')](_0x472c57[_0xac4a('0x2e')]);_0x4e17ce[_0xac4a('0x30')]=_[_0xac4a('0x31')](_0x4e17ce['model'],_0x4e17ce[_0xac4a('0x2e')]);_0x20202c['attributes']=_[_0xac4a('0x31')](_0x4e17ce['model'],qs[_0xac4a('0x32')](_0x472c57[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x20202c[_0xac4a('0x33')]=_0x20202c[_0xac4a('0x33')][_0xac4a('0x34')]?_0x20202c[_0xac4a('0x33')]:_0x4e17ce[_0xac4a('0x2d')];if(!_0x472c57[_0xac4a('0x2e')][_0xac4a('0x35')](_0xac4a('0x36'))){_0x20202c[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x472c57[_0xac4a('0x2e')]['limit']);_0x20202c[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x472c57['query'][_0xac4a('0x1c')]);}_0x20202c[_0xac4a('0x37')]=qs['sort'](_0x472c57['query'][_0xac4a('0x38')]);_0x20202c[_0xac4a('0x39')]=qs[_0xac4a('0x30')](_[_0xac4a('0x3a')](_0x472c57['query'],_0x4e17ce[_0xac4a('0x30')]),_0x267a22);if(_0x472c57[_0xac4a('0x2e')]['filter']){_0x20202c[_0xac4a('0x39')]=_[_0xac4a('0x3b')](_0x20202c[_0xac4a('0x39')],{'$or':_['map'](_0x267a22,function(_0x121328){if(_0x121328[_0xac4a('0x2b')]!==_0xac4a('0x3c')){var _0x4e0445={};_0x4e0445[_0x121328[_0xac4a('0x25')]]={'$like':'%'+_0x472c57[_0xac4a('0x2e')]['filter']+'%'};return _0x4e0445;}})});}_0x20202c=_['merge']({},_0x20202c,_0x472c57[_0xac4a('0x3d')]);var _0x5e0926={'where':_0x20202c['where']};return db['UserProfileResource']['count'](_0x5e0926)[_0xac4a('0x21')](function(_0x2bf8e8){_0x23b061[_0xac4a('0x1b')]=_0x2bf8e8;if(_0x472c57[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x20202c[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x29')][_0xac4a('0x40')](_0x20202c);})[_0xac4a('0x21')](function(_0x1f7721){_0x23b061[_0xac4a('0x41')]=_0x1f7721;return _0x23b061;})[_0xac4a('0x21')](respondWithFilteredResult(_0x1c13dc,_0x20202c))['catch'](handleError(_0x1c13dc,null));};exports['show']=function(_0x5cd24f,_0x1e1cc5){var _0x5c46a={'raw':![],'where':{'id':_0x5cd24f[_0xac4a('0x42')]['id']}},_0x14e80b={};_0x14e80b[_0xac4a('0x2d')]=_[_0xac4a('0x2f')](db[_0xac4a('0x29')][_0xac4a('0x2a')]);_0x14e80b[_0xac4a('0x2e')]=_[_0xac4a('0x2f')](_0x5cd24f['query']);_0x14e80b[_0xac4a('0x30')]=_[_0xac4a('0x31')](_0x14e80b[_0xac4a('0x2d')],_0x14e80b[_0xac4a('0x2e')]);_0x5c46a[_0xac4a('0x33')]=_['intersection'](_0x14e80b[_0xac4a('0x2d')],qs[_0xac4a('0x32')](_0x5cd24f['query'][_0xac4a('0x32')]));_0x5c46a['attributes']=_0x5c46a[_0xac4a('0x33')][_0xac4a('0x34')]?_0x5c46a[_0xac4a('0x33')]:_0x14e80b[_0xac4a('0x2d')];if(_0x5cd24f[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x5c46a[_0xac4a('0x3f')]=[{'all':!![]}];}_0x5c46a=_[_0xac4a('0x3b')]({},_0x5c46a,_0x5cd24f[_0xac4a('0x3d')]);return db[_0xac4a('0x29')][_0xac4a('0x43')](_0x5c46a)[_0xac4a('0x21')](handleEntityNotFound(_0x1e1cc5,null))['then'](respondWithResult(_0x1e1cc5,null))[_0xac4a('0x44')](handleError(_0x1e1cc5,null));};exports[_0xac4a('0x45')]=function(_0xeca4e9,_0x58759a){return db[_0xac4a('0x29')][_0xac4a('0x45')](_0xeca4e9['body'],{})[_0xac4a('0x21')](respondWithResult(_0x58759a,0xc9))['catch'](handleError(_0x58759a,null));};exports[_0xac4a('0x20')]=function(_0xe620f6,_0x136a65){if(_0xe620f6['body']['id']){delete _0xe620f6['body']['id'];}return db[_0xac4a('0x29')]['find']({'where':{'id':_0xe620f6[_0xac4a('0x42')]['id']}})['then'](handleEntityNotFound(_0x136a65,null))[_0xac4a('0x21')](saveUpdates(_0xe620f6['body'],null))[_0xac4a('0x21')](respondWithResult(_0x136a65,null))[_0xac4a('0x44')](handleError(_0x136a65,null));};exports[_0xac4a('0x22')]=function(_0x1c8c39,_0x54782f){return db[_0xac4a('0x29')][_0xac4a('0x43')]({'where':{'id':_0x1c8c39[_0xac4a('0x42')]['id']}})[_0xac4a('0x21')](handleEntityNotFound(_0x54782f,null))[_0xac4a('0x21')](removeEntity(_0x54782f,null))[_0xac4a('0x44')](handleError(_0x54782f,null));};exports[_0xac4a('0x46')]=function(_0x4e6e19,_0x35dee5){return db[_0xac4a('0x29')]['describe']()[_0xac4a('0x21')](respondWithResult(_0x35dee5,null))[_0xac4a('0x44')](handleError(_0x35dee5,null));}; \ No newline at end of file +var _0xdc97=['sendStatus','name','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','length','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x1fa590,_0x1d394b){var _0x57b81e=function(_0x560e90){while(--_0x560e90){_0x1fa590['push'](_0x1fa590['shift']());}};_0x57b81e(++_0x1d394b);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3e263f,_0x452b25){_0x3e263f=_0x3e263f-0x0;var _0x31783f=_0xdc97[_0x3e263f];return _0x31783f;};'use strict';var pdf=require(_0x7dc9('0x0'));var emlformat=require(_0x7dc9('0x1'));var rimraf=require(_0x7dc9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dc9('0x3'));var rp=require('request-promise');var moment=require(_0x7dc9('0x4'));var BPromise=require(_0x7dc9('0x5'));var Mustache=require('mustache');var util=require(_0x7dc9('0x6'));var path=require(_0x7dc9('0x7'));var sox=require(_0x7dc9('0x8'));var csv=require(_0x7dc9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x9'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=_0x1b0aa1[_0x7dc9('0x18')],_0x11606f=_0x278191[_0x7dc9('0x19')],_0xbe0437=_0x278191['offset']+_0x278191[_0x7dc9('0x1a')],_0x45698c;if(_0xbe0437>=_0x442819){_0xbe0437=_0x442819;_0x45698c=0xc8;}else{_0x45698c=0xce;}_0x3a54f2['status'](_0x45698c);return _0x3a54f2[_0x7dc9('0x1b')](_0x7dc9('0x1c'),_0x11606f+'-'+_0xbe0437+'/'+_0x442819)['json'](_0x1b0aa1);}return null;};}function patchUpdates(_0x41f66e){return function(_0x3b738a){try{jsonpatch[_0x7dc9('0x1d')](_0x3b738a,_0x41f66e,!![]);}catch(_0x4b2703){return BPromise[_0x7dc9('0x1e')](_0x4b2703);}return _0x3b738a[_0x7dc9('0x1f')]();};}function saveUpdates(_0x2dad65,_0x2895f5){return function(_0x155cc4){if(_0x155cc4){return _0x155cc4[_0x7dc9('0x20')](_0x2dad65)['then'](function(_0x593e60){return _0x593e60;});}return null;};}function removeEntity(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x21')]()[_0x7dc9('0x22')](function(){_0x12954f['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x43d31f,_0x41110a){return function(_0x4906b1){if(!_0x4906b1){_0x43d31f[_0x7dc9('0x23')](0x194);}return _0x4906b1;};}function handleError(_0x1e3a8d,_0xf95336){_0xf95336=_0xf95336||0x1f4;return function(_0x55a482){logger['error'](_0x55a482['stack']);if(_0x55a482[_0x7dc9('0x24')]){delete _0x55a482[_0x7dc9('0x24')];}_0x1e3a8d['status'](_0xf95336)['send'](_0x55a482);};}exports[_0x7dc9('0x25')]=function(_0x5afb7d,_0x2d22eb){var _0x1c690b={},_0x3a74a0={},_0x3e4102={'count':0x0,'rows':[]};var _0xa2aaa9=_[_0x7dc9('0x26')](db[_0x7dc9('0x27')][_0x7dc9('0x28')],function(_0x1fcf0e){return{'name':_0x1fcf0e[_0x7dc9('0x29')],'type':_0x1fcf0e[_0x7dc9('0x2a')][_0x7dc9('0x2b')]};});_0x3a74a0['model']=_['map'](_0xa2aaa9,'name');_0x3a74a0['query']=_['keys'](_0x5afb7d['query']);_0x3a74a0['filters']=_['intersection'](_0x3a74a0[_0x7dc9('0x2c')],_0x3a74a0[_0x7dc9('0x2d')]);_0x1c690b[_0x7dc9('0x2e')]=_[_0x7dc9('0x2f')](_0x3a74a0[_0x7dc9('0x2c')],qs[_0x7dc9('0x30')](_0x5afb7d['query']['fields']));_0x1c690b['attributes']=_0x1c690b[_0x7dc9('0x2e')]['length']?_0x1c690b[_0x7dc9('0x2e')]:_0x3a74a0[_0x7dc9('0x2c')];if(!_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x31')](_0x7dc9('0x32'))){_0x1c690b[_0x7dc9('0x1a')]=qs[_0x7dc9('0x1a')](_0x5afb7d[_0x7dc9('0x2d')]['limit']);_0x1c690b[_0x7dc9('0x19')]=qs['offset'](_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x19')]);}_0x1c690b[_0x7dc9('0x33')]=qs[_0x7dc9('0x34')](_0x5afb7d['query'][_0x7dc9('0x34')]);_0x1c690b['where']=qs[_0x7dc9('0x35')](_['pick'](_0x5afb7d['query'],_0x3a74a0[_0x7dc9('0x35')]),_0xa2aaa9);if(_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x36')]){_0x1c690b[_0x7dc9('0x37')]=_['merge'](_0x1c690b[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x26')](_0xa2aaa9,function(_0x138f33){if(_0x138f33[_0x7dc9('0x2a')]!==_0x7dc9('0x38')){var _0x21faa6={};_0x21faa6[_0x138f33[_0x7dc9('0x24')]]={'$like':'%'+_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x36')]+'%'};return _0x21faa6;}})});}_0x1c690b=_[_0x7dc9('0x39')]({},_0x1c690b,_0x5afb7d[_0x7dc9('0x3a')]);var _0x3a8d80={'where':_0x1c690b['where']};return db[_0x7dc9('0x27')][_0x7dc9('0x18')](_0x3a8d80)[_0x7dc9('0x22')](function(_0xfd2612){_0x3e4102['count']=_0xfd2612;if(_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x3b')]){_0x1c690b[_0x7dc9('0x3c')]=[{'all':!![]}];}return db[_0x7dc9('0x27')][_0x7dc9('0x3d')](_0x1c690b);})[_0x7dc9('0x22')](function(_0x5a1201){_0x3e4102['rows']=_0x5a1201;return _0x3e4102;})[_0x7dc9('0x22')](respondWithFilteredResult(_0x2d22eb,_0x1c690b))[_0x7dc9('0x3e')](handleError(_0x2d22eb,null));};exports['show']=function(_0x3a705c,_0x4a37ec){var _0x315d65={'raw':![],'where':{'id':_0x3a705c[_0x7dc9('0x3f')]['id']}},_0x2a91fe={};_0x2a91fe['model']=_[_0x7dc9('0x40')](db[_0x7dc9('0x27')][_0x7dc9('0x28')]);_0x2a91fe[_0x7dc9('0x2d')]=_[_0x7dc9('0x40')](_0x3a705c[_0x7dc9('0x2d')]);_0x2a91fe[_0x7dc9('0x35')]=_['intersection'](_0x2a91fe[_0x7dc9('0x2c')],_0x2a91fe['query']);_0x315d65['attributes']=_[_0x7dc9('0x2f')](_0x2a91fe[_0x7dc9('0x2c')],qs[_0x7dc9('0x30')](_0x3a705c[_0x7dc9('0x2d')][_0x7dc9('0x30')]));_0x315d65[_0x7dc9('0x2e')]=_0x315d65[_0x7dc9('0x2e')][_0x7dc9('0x41')]?_0x315d65[_0x7dc9('0x2e')]:_0x2a91fe['model'];if(_0x3a705c[_0x7dc9('0x2d')][_0x7dc9('0x3b')]){_0x315d65[_0x7dc9('0x3c')]=[{'all':!![]}];}_0x315d65=_[_0x7dc9('0x39')]({},_0x315d65,_0x3a705c[_0x7dc9('0x3a')]);return db[_0x7dc9('0x27')]['find'](_0x315d65)[_0x7dc9('0x22')](handleEntityNotFound(_0x4a37ec,null))[_0x7dc9('0x22')](respondWithResult(_0x4a37ec,null))['catch'](handleError(_0x4a37ec,null));};exports[_0x7dc9('0x42')]=function(_0x1f7700,_0x3c45b5){return db['UserProfileResource'][_0x7dc9('0x42')](_0x1f7700['body'],{})['then'](respondWithResult(_0x3c45b5,0xc9))[_0x7dc9('0x3e')](handleError(_0x3c45b5,null));};exports[_0x7dc9('0x20')]=function(_0x36d591,_0x5e0dc5){if(_0x36d591['body']['id']){delete _0x36d591[_0x7dc9('0x43')]['id'];}return db['UserProfileResource'][_0x7dc9('0x44')]({'where':{'id':_0x36d591[_0x7dc9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5e0dc5,null))[_0x7dc9('0x22')](saveUpdates(_0x36d591[_0x7dc9('0x43')],null))[_0x7dc9('0x22')](respondWithResult(_0x5e0dc5,null))[_0x7dc9('0x3e')](handleError(_0x5e0dc5,null));};exports[_0x7dc9('0x21')]=function(_0x113087,_0x86739f){return db[_0x7dc9('0x27')][_0x7dc9('0x44')]({'where':{'id':_0x113087[_0x7dc9('0x3f')]['id']}})[_0x7dc9('0x22')](handleEntityNotFound(_0x86739f,null))[_0x7dc9('0x22')](removeEntity(_0x86739f,null))[_0x7dc9('0x3e')](handleError(_0x86739f,null));};exports['describe']=function(_0x3132b1,_0x4fcfd5){return db['UserProfileResource'][_0x7dc9('0x45')]()[_0x7dc9('0x22')](respondWithResult(_0x4fcfd5,null))[_0x7dc9('0x3e')](handleError(_0x4fcfd5,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 4f0d5aa..ebe80c0 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x759e=['path','rimraf','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x37b851,_0x469969){var _0x574599=function(_0x4e6ab8){while(--_0x4e6ab8){_0x37b851['push'](_0x37b851['shift']());}};_0x574599(++_0x469969);}(_0x759e,0x104));var _0xe759=function(_0x480747,_0x49ea37){_0x480747=_0x480747-0x0;var _0x10d32a=_0x759e[_0x480747];return _0x10d32a;};'use strict';var _=require(_0xe759('0x0'));var util=require('util');var logger=require(_0xe759('0x1'))(_0xe759('0x2'));var moment=require(_0xe759('0x3'));var BPromise=require(_0xe759('0x4'));var rp=require(_0xe759('0x5'));var fs=require('fs');var path=require(_0xe759('0x6'));var rimraf=require(_0xe759('0x7'));var config=require(_0xe759('0x8'));var attributes=require(_0xe759('0x9'));module[_0xe759('0xa')]=function(_0x4fbeb8,_0x1383a5){return _0x4fbeb8['define']('UserProfileResource',attributes,{'tableName':_0xe759('0xb'),'paranoid':![],'indexes':[{'name':_0xe759('0xc'),'fields':['resourceId',_0xe759('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6414=['compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources'];(function(_0x1f8ac7,_0x4c2312){var _0x33fdc2=function(_0x531a89){while(--_0x531a89){_0x1f8ac7['push'](_0x1f8ac7['shift']());}};_0x33fdc2(++_0x4c2312);}(_0x6414,0xaa));var _0x4641=function(_0x483294,_0x49d0e3){_0x483294=_0x483294-0x0;var _0xf073fc=_0x6414[_0x483294];return _0xf073fc;};'use strict';var _=require(_0x4641('0x0'));var util=require(_0x4641('0x1'));var logger=require(_0x4641('0x2'))(_0x4641('0x3'));var moment=require(_0x4641('0x4'));var BPromise=require(_0x4641('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4641('0x6'));var rimraf=require('rimraf');var config=require(_0x4641('0x7'));var attributes=require(_0x4641('0x8'));module[_0x4641('0x9')]=function(_0x6e99fa,_0x5d94c7){return _0x6e99fa[_0x4641('0xa')]('UserProfileResource',attributes,{'tableName':_0x4641('0xb'),'paranoid':![],'indexes':[{'name':_0x4641('0xc'),'fields':[_0x4641('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index f591b6e..7cfa32d 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7791=['request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s'];(function(_0x8051d7,_0x263ba9){var _0x3fb835=function(_0x3605a6){while(--_0x3605a6){_0x8051d7['push'](_0x8051d7['shift']());}};_0x3fb835(++_0x263ba9);}(_0x7791,0x169));var _0x1779=function(_0x1c8314,_0x512e7e){_0x1c8314=_0x1c8314-0x0;var _0x4bfc4b=_0x7791[_0x1c8314];return _0x4bfc4b;};'use strict';var _=require(_0x1779('0x0'));var util=require(_0x1779('0x1'));var moment=require(_0x1779('0x2'));var BPromise=require(_0x1779('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1779('0x4'));var db=require(_0x1779('0x5'))['db'];var utils=require(_0x1779('0x6'));var logger=require('../../config/logger')(_0x1779('0x7'));var config=require('../../config/environment');var jayson=require(_0x1779('0x8'));var client=jayson[_0x1779('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x565f8c,_0x5052dd,_0xf0f9ea){return new BPromise(function(_0x474bbd,_0x3c327b){return client[_0x1779('0xa')](_0x565f8c,_0xf0f9ea)[_0x1779('0xb')](function(_0x28b0f9){logger['info'](_0x1779('0xc'),_0x5052dd,_0x1779('0xd'));logger['debug'](_0x1779('0xe'),_0x5052dd,_0x1779('0xd'),JSON[_0x1779('0xf')](_0x28b0f9));if(_0x28b0f9['error']){if(_0x28b0f9[_0x1779('0x10')][_0x1779('0x11')]===0x1f4){logger[_0x1779('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x5052dd,_0x28b0f9['error'][_0x1779('0x12')]);return _0x3c327b(_0x28b0f9[_0x1779('0x10')][_0x1779('0x12')]);}logger[_0x1779('0x10')](_0x1779('0xc'),_0x5052dd,_0x28b0f9['error']['message']);return _0x474bbd(_0x28b0f9['error'][_0x1779('0x12')]);}else{logger[_0x1779('0x13')](_0x1779('0xc'),_0x5052dd,_0x1779('0xd'));_0x474bbd(_0x28b0f9[_0x1779('0x14')]['message']);}})[_0x1779('0x15')](function(_0x3e7149){logger[_0x1779('0x10')](_0x1779('0xc'),_0x5052dd,_0x3e7149);_0x3c327b(_0x3e7149);});});} \ No newline at end of file +var _0xbe88=['moment','randomstring','ioredis','../../config/logger','rpc','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x331a2c,_0xc59b3e){var _0x508e83=function(_0x5e8d02){while(--_0x5e8d02){_0x331a2c['push'](_0x331a2c['shift']());}};_0x508e83(++_0xc59b3e);}(_0xbe88,0x12e));var _0x8be8=function(_0x1653b1,_0x35b7d1){_0x1653b1=_0x1653b1-0x0;var _0x3e0b17=_0xbe88[_0x1653b1];return _0x3e0b17;};'use strict';var _=require(_0x8be8('0x0'));var util=require(_0x8be8('0x1'));var moment=require(_0x8be8('0x2'));var BPromise=require('bluebird');var rs=require(_0x8be8('0x3'));var fs=require('fs');var Redis=require(_0x8be8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8be8('0x5'))(_0x8be8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8be8('0x7')][_0x8be8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x193368,_0x1a91a1,_0x272a3f){return new BPromise(function(_0x469d5d,_0x267a24){return client['request'](_0x193368,_0x272a3f)[_0x8be8('0x9')](function(_0xd862bc){logger[_0x8be8('0xa')](_0x8be8('0xb'),_0x1a91a1,_0x8be8('0xc'));logger['debug'](_0x8be8('0xd'),_0x1a91a1,_0x8be8('0xc'),JSON[_0x8be8('0xe')](_0xd862bc));if(_0xd862bc['error']){if(_0xd862bc[_0x8be8('0xf')][_0x8be8('0x10')]===0x1f4){logger[_0x8be8('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x1a91a1,_0xd862bc[_0x8be8('0xf')][_0x8be8('0x11')]);return _0x267a24(_0xd862bc['error'][_0x8be8('0x11')]);}logger['error'](_0x8be8('0xb'),_0x1a91a1,_0xd862bc[_0x8be8('0xf')]['message']);return _0x469d5d(_0xd862bc[_0x8be8('0xf')][_0x8be8('0x11')]);}else{logger[_0x8be8('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x1a91a1,_0x8be8('0xc'));_0x469d5d(_0xd862bc[_0x8be8('0x12')][_0x8be8('0x11')]);}})['catch'](function(_0x15718b){logger[_0x8be8('0xf')](_0x8be8('0xb'),_0x1a91a1,_0x15718b);_0x267a24(_0x15718b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 350e5fa..6b27baf 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbcf=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x317a83,_0x3d1153){var _0x526918=function(_0x5be864){while(--_0x5be864){_0x317a83['push'](_0x317a83['shift']());}};_0x526918(++_0x3d1153);}(_0xdbcf,0x158));var _0xfdbc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdbcf[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xfdbc('0x0'));var util=require(_0xfdbc('0x1'));var path=require(_0xfdbc('0x2'));var timeout=require(_0xfdbc('0x3'));var express=require(_0xfdbc('0x4'));var router=express[_0xfdbc('0x5')]();var auth=require(_0xfdbc('0x6'));var interaction=require(_0xfdbc('0x7'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xfdbc('0x8')]('/',auth[_0xfdbc('0x9')](),controller[_0xfdbc('0xa')]);router[_0xfdbc('0x8')](_0xfdbc('0xb'),auth[_0xfdbc('0x9')](),controller[_0xfdbc('0xc')]);router[_0xfdbc('0x8')](_0xfdbc('0xd'),auth[_0xfdbc('0x9')](),controller[_0xfdbc('0xe')]);router[_0xfdbc('0xf')]('/',auth[_0xfdbc('0x9')](),controller[_0xfdbc('0x10')]);router['put'](_0xfdbc('0xd'),auth['isAuthenticated'](),controller[_0xfdbc('0x11')]);router[_0xfdbc('0x12')]('/:id',auth[_0xfdbc('0x9')](),controller[_0xfdbc('0x13')]);module[_0xfdbc('0x14')]=router; \ No newline at end of file +var _0x5144=['connect-timeout','express','Router','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','delete','/:id','destroy','util','path'];(function(_0x288999,_0x3c2aef){var _0xa1e447=function(_0x3ae83c){while(--_0x3ae83c){_0x288999['push'](_0x288999['shift']());}};_0xa1e447(++_0x3c2aef);}(_0x5144,0xe2));var _0x4514=function(_0x45af13,_0x13fb83){_0x45af13=_0x45af13-0x0;var _0x29a59f=_0x5144[_0x45af13];return _0x29a59f;};'use strict';var multer=require('multer');var util=require(_0x4514('0x0'));var path=require(_0x4514('0x1'));var timeout=require(_0x4514('0x2'));var express=require(_0x4514('0x3'));var router=express[_0x4514('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4514('0x5'));var config=require('../../config/environment');var controller=require(_0x4514('0x6'));router[_0x4514('0x7')]('/',auth[_0x4514('0x8')](),controller['index']);router[_0x4514('0x7')](_0x4514('0x9'),auth[_0x4514('0x8')](),controller[_0x4514('0xa')]);router[_0x4514('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4514('0xb')]);router[_0x4514('0xc')]('/',auth[_0x4514('0x8')](),controller[_0x4514('0xd')]);router[_0x4514('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4514('0xf')]);router[_0x4514('0x10')](_0x4514('0x11'),auth[_0x4514('0x8')](),controller[_0x4514('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f942607..8f8512e 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbca0=['STRING','BOOLEAN','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x58fa7c,_0x36ad65){var _0x38690d=function(_0x4fa534){while(--_0x4fa534){_0x58fa7c['push'](_0x58fa7c['shift']());}};_0x38690d(++_0x36ad65);}(_0xbca0,0x17f));var _0x0bca=function(_0x18f7ed,_0x2c2ab7){_0x18f7ed=_0x18f7ed-0x0;var _0x3d56cd=_0xbca0[_0x18f7ed];return _0x3d56cd;};'use strict';var Sequelize=require(_0x0bca('0x0'));module[_0x0bca('0x1')]={'name':{'type':Sequelize[_0x0bca('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x0bca('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0bca('0x2')],'set':function(_0x5be3b4){this['setDataValue'](_0x0bca('0x4'),_0x5be3b4?_0x5be3b4['join'](''):[]);},'get':function(){return this[_0x0bca('0x5')](_0x0bca('0x4'))?this[_0x0bca('0x5')]('crudPermissions')[_0x0bca('0x6')](''):[];}}}; \ No newline at end of file +var _0x2123=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x5dd957,_0x5c5c19){var _0x1ec165=function(_0x1ce6a4){while(--_0x1ce6a4){_0x5dd957['push'](_0x5dd957['shift']());}};_0x1ec165(++_0x5c5c19);}(_0x2123,0x190));var _0x3212=function(_0x27c5e1,_0x46afc4){_0x27c5e1=_0x27c5e1-0x0;var _0x380050=_0x2123[_0x27c5e1];return _0x380050;};'use strict';var Sequelize=require(_0x3212('0x0'));module[_0x3212('0x1')]={'name':{'type':Sequelize[_0x3212('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x3212('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3212('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3212('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3212('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3212('0x2')],'set':function(_0x304f80){this[_0x3212('0x5')](_0x3212('0x6'),_0x304f80?_0x304f80[_0x3212('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0x3212('0x6'))?this[_0x3212('0x8')](_0x3212('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e77379b..6af2784 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfcf=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','count','offset','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','map','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','catch','params','keys','rawAttributes','find','create','update','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce'];(function(_0x53d9af,_0x8789d6){var _0x30e406=function(_0x8ab511){while(--_0x8ab511){_0x53d9af['push'](_0x53d9af['shift']());}};_0x30e406(++_0x8789d6);}(_0xdfcf,0x1dc));var _0xfdfc=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xdfcf[_0x1573ea];return _0x51c0e2;};'use strict';var pdf=require(_0xfdfc('0x0'));var emlformat=require(_0xfdfc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfdfc('0x2'));var jsonpatch=require(_0xfdfc('0x3'));var rp=require(_0xfdfc('0x4'));var moment=require(_0xfdfc('0x5'));var BPromise=require(_0xfdfc('0x6'));var Mustache=require('mustache');var util=require(_0xfdfc('0x7'));var path=require(_0xfdfc('0x8'));var sox=require(_0xfdfc('0x9'));var csv=require(_0xfdfc('0xa'));var ejs=require(_0xfdfc('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfdfc('0xc'));var crypto=require('crypto');var jsforce=require(_0xfdfc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfdfc('0xa'));var querystring=require(_0xfdfc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfdfc('0xf'));var qs=require(_0xfdfc('0x10'));var as=require(_0xfdfc('0x11'));var hardwareService=require(_0xfdfc('0x12'));var logger=require(_0xfdfc('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfdfc('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21096d,_0x22c28e){_0x22c28e=_0x22c28e||0xcc;return function(_0x32b157){if(_0x32b157){return _0x21096d[_0xfdfc('0x15')](_0x22c28e);}return _0x21096d[_0xfdfc('0x16')](_0x22c28e)['end']();};}function respondWithResult(_0x203adf,_0x530e08){_0x530e08=_0x530e08||0xc8;return function(_0x5b66f1){if(_0x5b66f1){return _0x203adf[_0xfdfc('0x16')](_0x530e08)['json'](_0x5b66f1);}};}function respondWithFilteredResult(_0x2d35df,_0x58cc0c){return function(_0x1009ef){if(_0x1009ef){var _0x13a68e=_0x1009ef[_0xfdfc('0x17')],_0x29475c=_0x58cc0c[_0xfdfc('0x18')],_0x8b5878=_0x58cc0c[_0xfdfc('0x18')]+_0x58cc0c['limit'],_0xa5d2ea;if(_0x8b5878>=_0x13a68e){_0x8b5878=_0x13a68e;_0xa5d2ea=0xc8;}else{_0xa5d2ea=0xce;}_0x2d35df[_0xfdfc('0x16')](_0xa5d2ea);return _0x2d35df[_0xfdfc('0x19')](_0xfdfc('0x1a'),_0x29475c+'-'+_0x8b5878+'/'+_0x13a68e)['json'](_0x1009ef);}return null;};}function patchUpdates(_0x52e54f){return function(_0x777a0d){try{jsonpatch[_0xfdfc('0x1b')](_0x777a0d,_0x52e54f,!![]);}catch(_0x37b277){return BPromise[_0xfdfc('0x1c')](_0x37b277);}return _0x777a0d['save']();};}function saveUpdates(_0x1978cb,_0x2609a0){return function(_0x344cc1){if(_0x344cc1){return _0x344cc1['update'](_0x1978cb)[_0xfdfc('0x1d')](function(_0x265a7d){return _0x265a7d;});}return null;};}function removeEntity(_0x504092,_0x108b49){return function(_0x147c39){if(_0x147c39){return _0x147c39[_0xfdfc('0x1e')]()[_0xfdfc('0x1d')](function(){_0x504092['status'](0xcc)[_0xfdfc('0x1f')]();});}};}function handleEntityNotFound(_0x3045fa,_0x49a052){return function(_0x5377c3){if(!_0x5377c3){_0x3045fa['sendStatus'](0x194);}return _0x5377c3;};}function handleError(_0x4701a6,_0x7ddc8e){_0x7ddc8e=_0x7ddc8e||0x1f4;return function(_0x218eca){logger[_0xfdfc('0x20')](_0x218eca[_0xfdfc('0x21')]);if(_0x218eca[_0xfdfc('0x22')]){delete _0x218eca[_0xfdfc('0x22')];}_0x4701a6[_0xfdfc('0x16')](_0x7ddc8e)[_0xfdfc('0x23')](_0x218eca);};}exports['index']=function(_0x3b8828,_0x35546a){var _0x53ede6={},_0x3641a9={},_0x527d94={'count':0x0,'rows':[]};var _0x5b2f3e=_[_0xfdfc('0x24')](db['UserProfileSection']['rawAttributes'],function(_0x53bd5f){return{'name':_0x53bd5f[_0xfdfc('0x25')],'type':_0x53bd5f[_0xfdfc('0x26')][_0xfdfc('0x27')]};});_0x3641a9[_0xfdfc('0x28')]=_[_0xfdfc('0x24')](_0x5b2f3e,'name');_0x3641a9['query']=_['keys'](_0x3b8828[_0xfdfc('0x29')]);_0x3641a9['filters']=_['intersection'](_0x3641a9[_0xfdfc('0x28')],_0x3641a9[_0xfdfc('0x29')]);_0x53ede6[_0xfdfc('0x2a')]=_[_0xfdfc('0x2b')](_0x3641a9[_0xfdfc('0x28')],qs[_0xfdfc('0x2c')](_0x3b8828[_0xfdfc('0x29')][_0xfdfc('0x2c')]));_0x53ede6['attributes']=_0x53ede6[_0xfdfc('0x2a')][_0xfdfc('0x2d')]?_0x53ede6[_0xfdfc('0x2a')]:_0x3641a9[_0xfdfc('0x28')];if(!_0x3b8828['query'][_0xfdfc('0x2e')](_0xfdfc('0x2f'))){_0x53ede6['limit']=qs['limit'](_0x3b8828[_0xfdfc('0x29')]['limit']);_0x53ede6[_0xfdfc('0x18')]=qs[_0xfdfc('0x18')](_0x3b8828[_0xfdfc('0x29')][_0xfdfc('0x18')]);}_0x53ede6[_0xfdfc('0x30')]=qs['sort'](_0x3b8828[_0xfdfc('0x29')][_0xfdfc('0x31')]);_0x53ede6['where']=qs[_0xfdfc('0x32')](_[_0xfdfc('0x33')](_0x3b8828[_0xfdfc('0x29')],_0x3641a9[_0xfdfc('0x32')]),_0x5b2f3e);if(_0x3b8828[_0xfdfc('0x29')][_0xfdfc('0x34')]){_0x53ede6[_0xfdfc('0x35')]=_[_0xfdfc('0x36')](_0x53ede6[_0xfdfc('0x35')],{'$or':_['map'](_0x5b2f3e,function(_0x5cddd1){if(_0x5cddd1[_0xfdfc('0x26')]!==_0xfdfc('0x37')){var _0x1c8374={};_0x1c8374[_0x5cddd1[_0xfdfc('0x22')]]={'$like':'%'+_0x3b8828[_0xfdfc('0x29')][_0xfdfc('0x34')]+'%'};return _0x1c8374;}})});}_0x53ede6=_['merge']({},_0x53ede6,_0x3b8828[_0xfdfc('0x38')]);var _0xd760f8={'where':_0x53ede6['where']};return db[_0xfdfc('0x39')][_0xfdfc('0x17')](_0xd760f8)['then'](function(_0x56b383){_0x527d94[_0xfdfc('0x17')]=_0x56b383;if(_0x3b8828[_0xfdfc('0x29')][_0xfdfc('0x3a')]){_0x53ede6[_0xfdfc('0x3b')]=[{'all':!![]}];}return db[_0xfdfc('0x39')][_0xfdfc('0x3c')](_0x53ede6);})[_0xfdfc('0x1d')](function(_0xfba750){_0x527d94['rows']=_0xfba750;return _0x527d94;})['then'](respondWithFilteredResult(_0x35546a,_0x53ede6))[_0xfdfc('0x3d')](handleError(_0x35546a,null));};exports['show']=function(_0x9225c9,_0x26591f){var _0x1363cf={'raw':![],'where':{'id':_0x9225c9[_0xfdfc('0x3e')]['id']}},_0x35ca59={};_0x35ca59[_0xfdfc('0x28')]=_[_0xfdfc('0x3f')](db['UserProfileSection'][_0xfdfc('0x40')]);_0x35ca59[_0xfdfc('0x29')]=_[_0xfdfc('0x3f')](_0x9225c9[_0xfdfc('0x29')]);_0x35ca59[_0xfdfc('0x32')]=_[_0xfdfc('0x2b')](_0x35ca59[_0xfdfc('0x28')],_0x35ca59[_0xfdfc('0x29')]);_0x1363cf[_0xfdfc('0x2a')]=_['intersection'](_0x35ca59[_0xfdfc('0x28')],qs['fields'](_0x9225c9['query'][_0xfdfc('0x2c')]));_0x1363cf['attributes']=_0x1363cf['attributes']['length']?_0x1363cf[_0xfdfc('0x2a')]:_0x35ca59[_0xfdfc('0x28')];if(_0x9225c9[_0xfdfc('0x29')]['includeAll']){_0x1363cf['include']=[{'all':!![]}];}_0x1363cf=_[_0xfdfc('0x36')]({},_0x1363cf,_0x9225c9[_0xfdfc('0x38')]);return db['UserProfileSection'][_0xfdfc('0x41')](_0x1363cf)[_0xfdfc('0x1d')](handleEntityNotFound(_0x26591f,null))['then'](respondWithResult(_0x26591f,null))['catch'](handleError(_0x26591f,null));};exports[_0xfdfc('0x42')]=function(_0x28187d,_0x2f99f9){return db[_0xfdfc('0x39')]['create'](_0x28187d['body'],{})[_0xfdfc('0x1d')](respondWithResult(_0x2f99f9,0xc9))['catch'](handleError(_0x2f99f9,null));};exports[_0xfdfc('0x43')]=function(_0x399716,_0x5e1844){if(_0x399716['body']['id']){delete _0x399716[_0xfdfc('0x44')]['id'];}return db[_0xfdfc('0x39')][_0xfdfc('0x41')]({'where':{'id':_0x399716['params']['id']}})[_0xfdfc('0x1d')](handleEntityNotFound(_0x5e1844,null))[_0xfdfc('0x1d')](saveUpdates(_0x399716[_0xfdfc('0x44')],null))['then'](respondWithResult(_0x5e1844,null))[_0xfdfc('0x3d')](handleError(_0x5e1844,null));};exports[_0xfdfc('0x1e')]=function(_0x5a5a55,_0x13c530){return db['UserProfileSection'][_0xfdfc('0x41')]({'where':{'id':_0x5a5a55[_0xfdfc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x13c530,null))[_0xfdfc('0x1d')](removeEntity(_0x13c530,null))[_0xfdfc('0x3d')](handleError(_0x13c530,null));};exports[_0xfdfc('0x45')]=function(_0x25df75,_0x237ed9){return db['UserProfileSection'][_0xfdfc('0x45')]()[_0xfdfc('0x1d')](respondWithResult(_0x237ed9,null))['catch'](handleError(_0x237ed9,null));}; \ No newline at end of file +var _0xd7ae=['error','stack','name','send','index','map','UserProfileSection','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','create','body','find','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4a4d71,_0x1d4d72){var _0x2f1f18=function(_0x50796d){while(--_0x50796d){_0x4a4d71['push'](_0x4a4d71['shift']());}};_0x2f1f18(++_0x1d4d72);}(_0xd7ae,0x156));var _0xed7a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd7ae[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0xed7a('0x0'));var emlformat=require(_0xed7a('0x1'));var rimraf=require(_0xed7a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xed7a('0x3'));var moment=require(_0xed7a('0x4'));var BPromise=require(_0xed7a('0x5'));var Mustache=require(_0xed7a('0x6'));var util=require(_0xed7a('0x7'));var path=require(_0xed7a('0x8'));var sox=require(_0xed7a('0x9'));var csv=require(_0xed7a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xed7a('0xb'));var squel=require(_0xed7a('0xc'));var crypto=require(_0xed7a('0xd'));var jsforce=require(_0xed7a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xed7a('0xa'));var querystring=require(_0xed7a('0xf'));var Papa=require('papaparse');var Redis=require(_0xed7a('0x10'));var authService=require(_0xed7a('0x11'));var qs=require(_0xed7a('0x12'));var as=require(_0xed7a('0x13'));var hardwareService=require(_0xed7a('0x14'));var logger=require(_0xed7a('0x15'))(_0xed7a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xed7a('0x17'))['db'];function respondWithStatusCode(_0x2bc892,_0xcba736){_0xcba736=_0xcba736||0xcc;return function(_0x408287){if(_0x408287){return _0x2bc892[_0xed7a('0x18')](_0xcba736);}return _0x2bc892[_0xed7a('0x19')](_0xcba736)[_0xed7a('0x1a')]();};}function respondWithResult(_0x5b9c5d,_0xb83f3b){_0xb83f3b=_0xb83f3b||0xc8;return function(_0x2c049e){if(_0x2c049e){return _0x5b9c5d[_0xed7a('0x19')](_0xb83f3b)['json'](_0x2c049e);}};}function respondWithFilteredResult(_0x3ae4a0,_0x438223){return function(_0x2c73eb){if(_0x2c73eb){var _0xfb8478=_0x2c73eb[_0xed7a('0x1b')],_0x4e9b75=_0x438223[_0xed7a('0x1c')],_0x561a67=_0x438223['offset']+_0x438223[_0xed7a('0x1d')],_0x18e92f;if(_0x561a67>=_0xfb8478){_0x561a67=_0xfb8478;_0x18e92f=0xc8;}else{_0x18e92f=0xce;}_0x3ae4a0[_0xed7a('0x19')](_0x18e92f);return _0x3ae4a0[_0xed7a('0x1e')](_0xed7a('0x1f'),_0x4e9b75+'-'+_0x561a67+'/'+_0xfb8478)['json'](_0x2c73eb);}return null;};}function patchUpdates(_0x372324){return function(_0x5474b9){try{jsonpatch[_0xed7a('0x20')](_0x5474b9,_0x372324,!![]);}catch(_0x2315e5){return BPromise[_0xed7a('0x21')](_0x2315e5);}return _0x5474b9[_0xed7a('0x22')]();};}function saveUpdates(_0x1c31fa,_0x159424){return function(_0x5aa03b){if(_0x5aa03b){return _0x5aa03b[_0xed7a('0x23')](_0x1c31fa)[_0xed7a('0x24')](function(_0x1688c9){return _0x1688c9;});}return null;};}function removeEntity(_0x1d9287,_0x2644fa){return function(_0x44841a){if(_0x44841a){return _0x44841a[_0xed7a('0x25')]()[_0xed7a('0x24')](function(){_0x1d9287['status'](0xcc)[_0xed7a('0x1a')]();});}};}function handleEntityNotFound(_0x5d24c7,_0xe2acf8){return function(_0x4999c0){if(!_0x4999c0){_0x5d24c7[_0xed7a('0x18')](0x194);}return _0x4999c0;};}function handleError(_0x51b097,_0x313227){_0x313227=_0x313227||0x1f4;return function(_0x3f4845){logger[_0xed7a('0x26')](_0x3f4845[_0xed7a('0x27')]);if(_0x3f4845[_0xed7a('0x28')]){delete _0x3f4845['name'];}_0x51b097[_0xed7a('0x19')](_0x313227)[_0xed7a('0x29')](_0x3f4845);};}exports[_0xed7a('0x2a')]=function(_0x20c84b,_0xb35dd9){var _0x40de3f={},_0x241bfc={},_0x2ecc6d={'count':0x0,'rows':[]};var _0x1542fb=_[_0xed7a('0x2b')](db[_0xed7a('0x2c')]['rawAttributes'],function(_0x2a2097){return{'name':_0x2a2097[_0xed7a('0x2d')],'type':_0x2a2097['type'][_0xed7a('0x2e')]};});_0x241bfc[_0xed7a('0x2f')]=_[_0xed7a('0x2b')](_0x1542fb,'name');_0x241bfc[_0xed7a('0x30')]=_[_0xed7a('0x31')](_0x20c84b[_0xed7a('0x30')]);_0x241bfc[_0xed7a('0x32')]=_[_0xed7a('0x33')](_0x241bfc[_0xed7a('0x2f')],_0x241bfc[_0xed7a('0x30')]);_0x40de3f[_0xed7a('0x34')]=_['intersection'](_0x241bfc[_0xed7a('0x2f')],qs[_0xed7a('0x35')](_0x20c84b[_0xed7a('0x30')][_0xed7a('0x35')]));_0x40de3f[_0xed7a('0x34')]=_0x40de3f['attributes'][_0xed7a('0x36')]?_0x40de3f[_0xed7a('0x34')]:_0x241bfc[_0xed7a('0x2f')];if(!_0x20c84b[_0xed7a('0x30')][_0xed7a('0x37')](_0xed7a('0x38'))){_0x40de3f[_0xed7a('0x1d')]=qs[_0xed7a('0x1d')](_0x20c84b[_0xed7a('0x30')][_0xed7a('0x1d')]);_0x40de3f['offset']=qs['offset'](_0x20c84b['query'][_0xed7a('0x1c')]);}_0x40de3f['order']=qs[_0xed7a('0x39')](_0x20c84b[_0xed7a('0x30')][_0xed7a('0x39')]);_0x40de3f[_0xed7a('0x3a')]=qs[_0xed7a('0x32')](_[_0xed7a('0x3b')](_0x20c84b[_0xed7a('0x30')],_0x241bfc[_0xed7a('0x32')]),_0x1542fb);if(_0x20c84b[_0xed7a('0x30')][_0xed7a('0x3c')]){_0x40de3f[_0xed7a('0x3a')]=_[_0xed7a('0x3d')](_0x40de3f['where'],{'$or':_[_0xed7a('0x2b')](_0x1542fb,function(_0x316080){if(_0x316080[_0xed7a('0x3e')]!==_0xed7a('0x3f')){var _0x12f86b={};_0x12f86b[_0x316080[_0xed7a('0x28')]]={'$like':'%'+_0x20c84b[_0xed7a('0x30')][_0xed7a('0x3c')]+'%'};return _0x12f86b;}})});}_0x40de3f=_[_0xed7a('0x3d')]({},_0x40de3f,_0x20c84b[_0xed7a('0x40')]);var _0xf3243b={'where':_0x40de3f['where']};return db[_0xed7a('0x2c')]['count'](_0xf3243b)[_0xed7a('0x24')](function(_0x24d6da){_0x2ecc6d[_0xed7a('0x1b')]=_0x24d6da;if(_0x20c84b[_0xed7a('0x30')][_0xed7a('0x41')]){_0x40de3f[_0xed7a('0x42')]=[{'all':!![]}];}return db['UserProfileSection'][_0xed7a('0x43')](_0x40de3f);})[_0xed7a('0x24')](function(_0x439ad1){_0x2ecc6d['rows']=_0x439ad1;return _0x2ecc6d;})[_0xed7a('0x24')](respondWithFilteredResult(_0xb35dd9,_0x40de3f))[_0xed7a('0x44')](handleError(_0xb35dd9,null));};exports[_0xed7a('0x45')]=function(_0x46550c,_0x272928){var _0x1eef1d={'raw':![],'where':{'id':_0x46550c['params']['id']}},_0x543e96={};_0x543e96[_0xed7a('0x2f')]=_[_0xed7a('0x31')](db[_0xed7a('0x2c')][_0xed7a('0x46')]);_0x543e96[_0xed7a('0x30')]=_[_0xed7a('0x31')](_0x46550c['query']);_0x543e96['filters']=_[_0xed7a('0x33')](_0x543e96[_0xed7a('0x2f')],_0x543e96[_0xed7a('0x30')]);_0x1eef1d[_0xed7a('0x34')]=_[_0xed7a('0x33')](_0x543e96['model'],qs['fields'](_0x46550c[_0xed7a('0x30')][_0xed7a('0x35')]));_0x1eef1d[_0xed7a('0x34')]=_0x1eef1d[_0xed7a('0x34')][_0xed7a('0x36')]?_0x1eef1d[_0xed7a('0x34')]:_0x543e96[_0xed7a('0x2f')];if(_0x46550c[_0xed7a('0x30')]['includeAll']){_0x1eef1d[_0xed7a('0x42')]=[{'all':!![]}];}_0x1eef1d=_[_0xed7a('0x3d')]({},_0x1eef1d,_0x46550c[_0xed7a('0x40')]);return db[_0xed7a('0x2c')]['find'](_0x1eef1d)['then'](handleEntityNotFound(_0x272928,null))[_0xed7a('0x24')](respondWithResult(_0x272928,null))[_0xed7a('0x44')](handleError(_0x272928,null));};exports[_0xed7a('0x47')]=function(_0x4ec623,_0x5a694a){return db[_0xed7a('0x2c')]['create'](_0x4ec623['body'],{})[_0xed7a('0x24')](respondWithResult(_0x5a694a,0xc9))[_0xed7a('0x44')](handleError(_0x5a694a,null));};exports[_0xed7a('0x23')]=function(_0x1445b1,_0x2c8b16){if(_0x1445b1[_0xed7a('0x48')]['id']){delete _0x1445b1[_0xed7a('0x48')]['id'];}return db[_0xed7a('0x2c')][_0xed7a('0x49')]({'where':{'id':_0x1445b1['params']['id']}})[_0xed7a('0x24')](handleEntityNotFound(_0x2c8b16,null))[_0xed7a('0x24')](saveUpdates(_0x1445b1[_0xed7a('0x48')],null))[_0xed7a('0x24')](respondWithResult(_0x2c8b16,null))[_0xed7a('0x44')](handleError(_0x2c8b16,null));};exports['destroy']=function(_0x40a576,_0x37707e){return db['UserProfileSection'][_0xed7a('0x49')]({'where':{'id':_0x40a576[_0xed7a('0x4a')]['id']}})[_0xed7a('0x24')](handleEntityNotFound(_0x37707e,null))['then'](removeEntity(_0x37707e,null))[_0xed7a('0x44')](handleError(_0x37707e,null));};exports['describe']=function(_0x1f534c,_0x1a0100){return db[_0xed7a('0x2c')][_0xed7a('0x4b')]()[_0xed7a('0x24')](respondWithResult(_0x1a0100,null))[_0xed7a('0x44')](handleError(_0x1a0100,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 18b9f2f..6d5a43e 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6305=['exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x6305,0x1ab));var _0x5630=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x6305[_0x1a36a5];return _0x746243;};'use strict';var _=require('lodash');var util=require(_0x5630('0x0'));var logger=require('../../config/logger')(_0x5630('0x1'));var moment=require(_0x5630('0x2'));var BPromise=require(_0x5630('0x3'));var rp=require(_0x5630('0x4'));var fs=require('fs');var path=require(_0x5630('0x5'));var rimraf=require('rimraf');var config=require(_0x5630('0x6'));var attributes=require(_0x5630('0x7'));module[_0x5630('0x8')]=function(_0x4d26b0,_0x47a8e2){return _0x4d26b0[_0x5630('0x9')](_0x5630('0xa'),attributes,{'tableName':_0x5630('0xb'),'paranoid':![],'indexes':[{'name':_0x5630('0xc'),'fields':[_0x5630('0xd'),_0x5630('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2cc0=['compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./userProfileSection.attributes','define'];(function(_0x23e57f,_0x5a2bae){var _0x322481=function(_0x4a2211){while(--_0x4a2211){_0x23e57f['push'](_0x23e57f['shift']());}};_0x322481(++_0x5a2bae);}(_0x2cc0,0xc3));var _0x02cc=function(_0x8b4581,_0x3189d6){_0x8b4581=_0x8b4581-0x0;var _0x3f2da7=_0x2cc0[_0x8b4581];return _0x3f2da7;};'use strict';var _=require(_0x02cc('0x0'));var util=require(_0x02cc('0x1'));var logger=require(_0x02cc('0x2'))(_0x02cc('0x3'));var moment=require(_0x02cc('0x4'));var BPromise=require(_0x02cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x02cc('0x6'));var attributes=require(_0x02cc('0x7'));module['exports']=function(_0x416d49,_0x2d22d3){return _0x416d49[_0x02cc('0x8')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x02cc('0x9'),'fields':[_0x02cc('0xa'),_0x02cc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index fe81f50..6e60410 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd293=['catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd293,0x12d));var _0x3d29=function(_0x5df89c,_0xb5c572){_0x5df89c=_0x5df89c-0x0;var _0x266318=_0xd293[_0x5df89c];return _0x266318;};'use strict';var _=require('lodash');var util=require(_0x3d29('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3d29('0x1'));var fs=require('fs');var Redis=require(_0x3d29('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d29('0x3'));var logger=require(_0x3d29('0x4'))(_0x3d29('0x5'));var config=require(_0x3d29('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3d29('0x7')][_0x3d29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x547990,_0x1480f1,_0xa89fc6){return new BPromise(function(_0x49564b,_0x1cdc22){return client[_0x3d29('0x9')](_0x547990,_0xa89fc6)[_0x3d29('0xa')](function(_0x3f67e0){logger['info'](_0x3d29('0xb'),_0x1480f1,_0x3d29('0xc'));logger[_0x3d29('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1480f1,'request\x20sent',JSON[_0x3d29('0xe')](_0x3f67e0));if(_0x3f67e0[_0x3d29('0xf')]){if(_0x3f67e0[_0x3d29('0xf')][_0x3d29('0x10')]===0x1f4){logger['error'](_0x3d29('0xb'),_0x1480f1,_0x3f67e0[_0x3d29('0xf')]['message']);return _0x1cdc22(_0x3f67e0[_0x3d29('0xf')]['message']);}logger[_0x3d29('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x1480f1,_0x3f67e0['error'][_0x3d29('0x11')]);return _0x49564b(_0x3f67e0[_0x3d29('0xf')][_0x3d29('0x11')]);}else{logger[_0x3d29('0x12')](_0x3d29('0xb'),_0x1480f1,_0x3d29('0xc'));_0x49564b(_0x3f67e0['result']['message']);}})[_0x3d29('0x13')](function(_0x1ae54d){logger[_0x3d29('0xf')](_0x3d29('0xb'),_0x1480f1,_0x1ae54d);_0x1cdc22(_0x1ae54d);});});} \ No newline at end of file +var _0x76fd=['../../config/logger','../../config/environment','jayson/promise','client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4574b0,_0x3bd754){var _0x3d720c=function(_0x18a7da){while(--_0x18a7da){_0x4574b0['push'](_0x4574b0['shift']());}};_0x3d720c(++_0x3bd754);}(_0x76fd,0x9b));var _0xd76f=function(_0xdc5a08,_0x4eab21){_0xdc5a08=_0xdc5a08-0x0;var _0x3f6e2e=_0x76fd[_0xdc5a08];return _0x3f6e2e;};'use strict';var _=require(_0xd76f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd76f('0x1'));var fs=require('fs');var Redis=require(_0xd76f('0x2'));var db=require(_0xd76f('0x3'))['db'];var utils=require(_0xd76f('0x4'));var logger=require(_0xd76f('0x5'))('rpc');var config=require(_0xd76f('0x6'));var jayson=require(_0xd76f('0x7'));var client=jayson[_0xd76f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24222e,_0x4f90f0,_0x4e6ea0){return new BPromise(function(_0x513775,_0x97707a){return client['request'](_0x24222e,_0x4e6ea0)[_0xd76f('0x9')](function(_0x103131){logger[_0xd76f('0xa')](_0xd76f('0xb'),_0x4f90f0,_0xd76f('0xc'));logger[_0xd76f('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4f90f0,_0xd76f('0xc'),JSON[_0xd76f('0xe')](_0x103131));if(_0x103131[_0xd76f('0xf')]){if(_0x103131[_0xd76f('0xf')][_0xd76f('0x10')]===0x1f4){logger[_0xd76f('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x4f90f0,_0x103131['error']['message']);return _0x97707a(_0x103131['error'][_0xd76f('0x11')]);}logger['error'](_0xd76f('0xb'),_0x4f90f0,_0x103131[_0xd76f('0xf')][_0xd76f('0x11')]);return _0x513775(_0x103131[_0xd76f('0xf')][_0xd76f('0x11')]);}else{logger[_0xd76f('0xa')](_0xd76f('0xb'),_0x4f90f0,'request\x20sent');_0x513775(_0x103131[_0xd76f('0x12')][_0xd76f('0x11')]);}})[_0xd76f('0x13')](function(_0x41c806){logger[_0xd76f('0xf')](_0xd76f('0xb'),_0x4f90f0,_0x41c806);_0x97707a(_0x41c806);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ef134b4..268ef92 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafe0=['connect-timeout','express','Router','../../components/auth/service','exports','multer','util','path'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xafe0,0x85));var _0x0afe=function(_0x3a8ec5,_0x378f44){_0x3a8ec5=_0x3a8ec5-0x0;var _0x483caf=_0xafe0[_0x3a8ec5];return _0x483caf;};'use strict';var multer=require(_0x0afe('0x0'));var util=require(_0x0afe('0x1'));var path=require(_0x0afe('0x2'));var timeout=require(_0x0afe('0x3'));var express=require(_0x0afe('0x4'));var router=express[_0x0afe('0x5')]();var auth=require(_0x0afe('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x0afe('0x7')]=router; \ No newline at end of file +var _0x53ca=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x53ca,0x1a0));var _0xa53c=function(_0xd26500,_0xfa64ae){_0xd26500=_0xd26500-0x0;var _0x16cdba=_0x53ca[_0xd26500];return _0x16cdba;};'use strict';var multer=require(_0xa53c('0x0'));var util=require('util');var path=require(_0xa53c('0x1'));var timeout=require(_0xa53c('0x2'));var express=require('express');var router=express[_0xa53c('0x3')]();var auth=require(_0xa53c('0x4'));var interaction=require(_0xa53c('0x5'));var config=require(_0xa53c('0x6'));module[_0xa53c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 00c8ca3..2e23775 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0xf7e04a,_0x32409a){var _0x3166fb=function(_0x3d60a9){while(--_0x3d60a9){_0xf7e04a['push'](_0xf7e04a['shift']());}};_0x3166fb(++_0x32409a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 3c8b6bf..c25fa23 100644 --- a/server/api/userSmsQueue/userSmsQueue.model.js +++ b/server/api/userSmsQueue/userSmsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12f2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','../../config/logger'];(function(_0x50bcab,_0x5786d1){var _0xf1278f=function(_0xe289ab){while(--_0xe289ab){_0x50bcab['push'](_0x50bcab['shift']());}};_0xf1278f(++_0x5786d1);}(_0x12f2,0x110));var _0x212f=function(_0x3c5957,_0x4f29bf){_0x3c5957=_0x3c5957-0x0;var _0x45adeb=_0x12f2[_0x3c5957];return _0x45adeb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x212f('0x0'))(_0x212f('0x1'));var moment=require(_0x212f('0x2'));var BPromise=require(_0x212f('0x3'));var rp=require(_0x212f('0x4'));var fs=require('fs');var path=require(_0x212f('0x5'));var rimraf=require(_0x212f('0x6'));var config=require(_0x212f('0x7'));var attributes=require(_0x212f('0x8'));module[_0x212f('0x9')]=function(_0x4345d8,_0x14d4ea){return _0x4345d8[_0x212f('0xa')](_0x212f('0xb'),attributes,{'tableName':_0x212f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85b1=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment'];(function(_0x505168,_0x3dc03d){var _0x366c93=function(_0x1d063f){while(--_0x1d063f){_0x505168['push'](_0x505168['shift']());}};_0x366c93(++_0x3dc03d);}(_0x85b1,0xa4));var _0x185b=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x85b1[_0x119d5a];return _0x15bff4;};'use strict';var _=require('lodash');var util=require(_0x185b('0x0'));var logger=require(_0x185b('0x1'))(_0x185b('0x2'));var moment=require(_0x185b('0x3'));var BPromise=require(_0x185b('0x4'));var rp=require(_0x185b('0x5'));var fs=require('fs');var path=require(_0x185b('0x6'));var rimraf=require(_0x185b('0x7'));var config=require(_0x185b('0x8'));var attributes=require(_0x185b('0x9'));module[_0x185b('0xa')]=function(_0x3d64ba,_0x44f7b8){return _0x3d64ba[_0x185b('0xb')](_0x185b('0xc'),attributes,{'tableName':_0x185b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 5099309..eb4a918 100644 --- a/server/api/userSmsQueue/userSmsQueue.rpc.js +++ b/server/api/userSmsQueue/userSmsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe71a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util'];(function(_0x14f92f,_0x9bd0f1){var _0x5ee8af=function(_0x145dd2){while(--_0x145dd2){_0x14f92f['push'](_0x14f92f['shift']());}};_0x5ee8af(++_0x9bd0f1);}(_0xe71a,0xa6));var _0xae71=function(_0x437fea,_0x4747b6){_0x437fea=_0x437fea-0x0;var _0x4c09d6=_0xe71a[_0x437fea];return _0x4c09d6;};'use strict';var _=require(_0xae71('0x0'));var util=require(_0xae71('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xae71('0x2'));var fs=require('fs');var Redis=require(_0xae71('0x3'));var db=require(_0xae71('0x4'))['db'];var utils=require(_0xae71('0x5'));var logger=require('../../config/logger')(_0xae71('0x6'));var config=require(_0xae71('0x7'));var jayson=require(_0xae71('0x8'));var client=jayson[_0xae71('0x9')][_0xae71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2fc8,_0x208aac,_0x3541e6){return new BPromise(function(_0x2c32f1,_0x6a9703){return client[_0xae71('0xb')](_0x3a2fc8,_0x3541e6)[_0xae71('0xc')](function(_0x87a2d8){logger[_0xae71('0xd')](_0xae71('0xe'),_0x208aac,'request\x20sent');logger[_0xae71('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x208aac,_0xae71('0x10'),JSON['stringify'](_0x87a2d8));if(_0x87a2d8[_0xae71('0x11')]){if(_0x87a2d8['error'][_0xae71('0x12')]===0x1f4){logger[_0xae71('0x11')](_0xae71('0xe'),_0x208aac,_0x87a2d8[_0xae71('0x11')][_0xae71('0x13')]);return _0x6a9703(_0x87a2d8[_0xae71('0x11')][_0xae71('0x13')]);}logger[_0xae71('0x11')](_0xae71('0xe'),_0x208aac,_0x87a2d8[_0xae71('0x11')][_0xae71('0x13')]);return _0x2c32f1(_0x87a2d8['error'][_0xae71('0x13')]);}else{logger[_0xae71('0xd')](_0xae71('0xe'),_0x208aac,_0xae71('0x10'));_0x2c32f1(_0x87a2d8['result']['message']);}})[_0xae71('0x14')](function(_0xb375fd){logger[_0xae71('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x208aac,_0xb375fd);_0x6a9703(_0xb375fd);});});} \ No newline at end of file +var _0xfadc=['UserSmsQueue,\x20%s,\x20%s','info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2646d9,_0x2cd27b){var _0x380e46=function(_0x570b04){while(--_0x570b04){_0x2646d9['push'](_0x2646d9['shift']());}};_0x380e46(++_0x2cd27b);}(_0xfadc,0x7b));var _0xcfad=function(_0x71ad56,_0x41d017){_0x71ad56=_0x71ad56-0x0;var _0xe791ac=_0xfadc[_0x71ad56];return _0xe791ac;};'use strict';var _=require(_0xcfad('0x0'));var util=require('util');var moment=require(_0xcfad('0x1'));var BPromise=require(_0xcfad('0x2'));var rs=require(_0xcfad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfad('0x4'))['db'];var utils=require(_0xcfad('0x5'));var logger=require(_0xcfad('0x6'))(_0xcfad('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfad('0x8'));var client=jayson[_0xcfad('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c018d,_0x50eb3c,_0x2caa2b){return new BPromise(function(_0x1b89b0,_0x44db4e){return client['request'](_0x5c018d,_0x2caa2b)['then'](function(_0x35ccee){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x50eb3c,_0xcfad('0xa'));logger[_0xcfad('0xb')](_0xcfad('0xc'),_0x50eb3c,_0xcfad('0xa'),JSON[_0xcfad('0xd')](_0x35ccee));if(_0x35ccee['error']){if(_0x35ccee[_0xcfad('0xe')][_0xcfad('0xf')]===0x1f4){logger[_0xcfad('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x50eb3c,_0x35ccee[_0xcfad('0xe')][_0xcfad('0x10')]);return _0x44db4e(_0x35ccee[_0xcfad('0xe')][_0xcfad('0x10')]);}logger['error'](_0xcfad('0x11'),_0x50eb3c,_0x35ccee['error'][_0xcfad('0x10')]);return _0x1b89b0(_0x35ccee['error'][_0xcfad('0x10')]);}else{logger[_0xcfad('0x12')](_0xcfad('0x11'),_0x50eb3c,_0xcfad('0xa'));_0x1b89b0(_0x35ccee[_0xcfad('0x13')]['message']);}})['catch'](function(_0x2e6b5d){logger[_0xcfad('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x50eb3c,_0x2e6b5d);_0x44db4e(_0x2e6b5d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index b22a383..5afd84d 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50d3=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x50d3,0xdb));var _0x350d=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x50d3[_0x2f2360];return _0x1cc8d3;};'use strict';var multer=require(_0x350d('0x0'));var util=require(_0x350d('0x1'));var path=require(_0x350d('0x2'));var timeout=require(_0x350d('0x3'));var express=require(_0x350d('0x4'));var router=express[_0x350d('0x5')]();var auth=require(_0x350d('0x6'));var interaction=require(_0x350d('0x7'));var config=require(_0x350d('0x8'));module[_0x350d('0x9')]=router; \ No newline at end of file +var _0xeaa8=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','connect-timeout','express','Router'];(function(_0xa6218c,_0x125b83){var _0x67c132=function(_0x589044){while(--_0x589044){_0xa6218c['push'](_0xa6218c['shift']());}};_0x67c132(++_0x125b83);}(_0xeaa8,0x6c));var _0x8eaa=function(_0x5f5028,_0x37f8d6){_0x5f5028=_0x5f5028-0x0;var _0x1e2bf4=_0xeaa8[_0x5f5028];return _0x1e2bf4;};'use strict';var multer=require('multer');var util=require(_0x8eaa('0x0'));var path=require('path');var timeout=require(_0x8eaa('0x1'));var express=require(_0x8eaa('0x2'));var router=express[_0x8eaa('0x3')]();var auth=require(_0x8eaa('0x4'));var interaction=require(_0x8eaa('0x5'));var config=require(_0x8eaa('0x6'));module[_0x8eaa('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index baecb07..d3b606a 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x5e58bd,_0x5074f4){var _0x25c6ed=function(_0x454dfa){while(--_0x454dfa){_0x5e58bd['push'](_0x5e58bd['shift']());}};_0x25c6ed(++_0x5074f4);}(_0xe706,0xa3));var _0x6e70=function(_0x4934aa,_0x55d2a3){_0x4934aa=_0x4934aa-0x0;var _0x59dd38=_0xe706[_0x4934aa];return _0x59dd38;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x1d0c88,_0x30dfbe){var _0x1196ae=function(_0x48b0e8){while(--_0x48b0e8){_0x1d0c88['push'](_0x1d0c88['shift']());}};_0x1196ae(++_0x30dfbe);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ab3fe64..be6efc7 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.model.js +++ b/server/api/userVoiceQueue/userVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0faf=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x6287b6,_0x5682e7){var _0x5d6be4=function(_0x3e3975){while(--_0x3e3975){_0x6287b6['push'](_0x6287b6['shift']());}};_0x5d6be4(++_0x5682e7);}(_0x0faf,0x132));var _0xf0fa=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0x0faf[_0x3b81eb];return _0x149491;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));module['exports']=function(_0x3637a3,_0x44ffa0){return _0x3637a3[_0xf0fa('0xa')](_0xf0fa('0xb'),attributes,{'tableName':_0xf0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 2279f0e..240d59a 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.rpc.js +++ b/server/api/userVoiceQueue/userVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde4d=['client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xde4d,0x10f));var _0xdde4=function(_0x33c279,_0x2b4efc){_0x33c279=_0x33c279-0x0;var _0xb7b0b9=_0xde4d[_0x33c279];return _0xb7b0b9;};'use strict';var _=require(_0xdde4('0x0'));var util=require(_0xdde4('0x1'));var moment=require('moment');var BPromise=require(_0xdde4('0x2'));var rs=require(_0xdde4('0x3'));var fs=require('fs');var Redis=require(_0xdde4('0x4'));var db=require(_0xdde4('0x5'))['db'];var utils=require(_0xdde4('0x6'));var logger=require(_0xdde4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdde4('0x8'));var client=jayson[_0xdde4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d3965,_0x4a9f24,_0x2d2fbc){return new BPromise(function(_0x3c21b7,_0xa911c){return client[_0xdde4('0xa')](_0x3d3965,_0x2d2fbc)[_0xdde4('0xb')](function(_0x5d3fea){logger[_0xdde4('0xc')](_0xdde4('0xd'),_0x4a9f24,_0xdde4('0xe'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4a9f24,'request\x20sent',JSON[_0xdde4('0xf')](_0x5d3fea));if(_0x5d3fea[_0xdde4('0x10')]){if(_0x5d3fea[_0xdde4('0x10')][_0xdde4('0x11')]===0x1f4){logger['error'](_0xdde4('0xd'),_0x4a9f24,_0x5d3fea['error'][_0xdde4('0x12')]);return _0xa911c(_0x5d3fea['error']['message']);}logger[_0xdde4('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x4a9f24,_0x5d3fea['error'][_0xdde4('0x12')]);return _0x3c21b7(_0x5d3fea['error'][_0xdde4('0x12')]);}else{logger[_0xdde4('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x4a9f24,_0xdde4('0xe'));_0x3c21b7(_0x5d3fea['result']['message']);}})[_0xdde4('0x13')](function(_0xa73170){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4a9f24,_0xa73170);_0xa911c(_0xa73170);});});} \ No newline at end of file +var _0x6ec0=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','lodash','util'];(function(_0x4be47f,_0x42354f){var _0xf9626b=function(_0x593dd1){while(--_0x593dd1){_0x4be47f['push'](_0x4be47f['shift']());}};_0xf9626b(++_0x42354f);}(_0x6ec0,0xfb));var _0x06ec=function(_0x5de7a5,_0x23948a){_0x5de7a5=_0x5de7a5-0x0;var _0x41e57b=_0x6ec0[_0x5de7a5];return _0x41e57b;};'use strict';var _=require(_0x06ec('0x0'));var util=require(_0x06ec('0x1'));var moment=require(_0x06ec('0x2'));var BPromise=require(_0x06ec('0x3'));var rs=require(_0x06ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06ec('0x5'))['db'];var utils=require(_0x06ec('0x6'));var logger=require(_0x06ec('0x7'))(_0x06ec('0x8'));var config=require('../../config/environment');var jayson=require(_0x06ec('0x9'));var client=jayson[_0x06ec('0xa')][_0x06ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f0707,_0x4dd0a4,_0x5a3fd0){return new BPromise(function(_0x136fdc,_0x152c2a){return client[_0x06ec('0xc')](_0x5f0707,_0x5a3fd0)[_0x06ec('0xd')](function(_0x585699){logger[_0x06ec('0xe')](_0x06ec('0xf'),_0x4dd0a4,_0x06ec('0x10'));logger[_0x06ec('0x11')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4dd0a4,'request\x20sent',JSON[_0x06ec('0x12')](_0x585699));if(_0x585699['error']){if(_0x585699['error'][_0x06ec('0x13')]===0x1f4){logger[_0x06ec('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x4dd0a4,_0x585699[_0x06ec('0x14')]['message']);return _0x152c2a(_0x585699[_0x06ec('0x14')][_0x06ec('0x15')]);}logger['error'](_0x06ec('0xf'),_0x4dd0a4,_0x585699[_0x06ec('0x14')]['message']);return _0x136fdc(_0x585699['error'][_0x06ec('0x15')]);}else{logger[_0x06ec('0xe')](_0x06ec('0xf'),_0x4dd0a4,_0x06ec('0x10'));_0x136fdc(_0x585699['result'][_0x06ec('0x15')]);}})[_0x06ec('0x16')](function(_0x210001){logger['error'](_0x06ec('0xf'),_0x4dd0a4,_0x210001);_0x152c2a(_0x210001);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3bfd362..79a952c 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1600=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','connect-timeout','express'];(function(_0x289afd,_0x42daf2){var _0x14df2c=function(_0x6d9e7){while(--_0x6d9e7){_0x289afd['push'](_0x289afd['shift']());}};_0x14df2c(++_0x42daf2);}(_0x1600,0x67));var _0x0160=function(_0x325b70,_0x54cf4a){_0x325b70=_0x325b70-0x0;var _0x1a2604=_0x1600[_0x325b70];return _0x1a2604;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0160('0x0'));var express=require(_0x0160('0x1'));var router=express[_0x0160('0x2')]();var auth=require(_0x0160('0x3'));var interaction=require(_0x0160('0x4'));var config=require(_0x0160('0x5'));module[_0x0160('0x6')]=router; \ No newline at end of file +var _0x5883=['../../components/interaction/service','exports','multer','util','Router','../../components/auth/service'];(function(_0x128fc3,_0x29cf4d){var _0x3150b1=function(_0x3b4d5b){while(--_0x3b4d5b){_0x128fc3['push'](_0x128fc3['shift']());}};_0x3150b1(++_0x29cf4d);}(_0x5883,0x13a));var _0x3588=function(_0x450ac6,_0x4f3807){_0x450ac6=_0x450ac6-0x0;var _0x24c343=_0x5883[_0x450ac6];return _0x24c343;};'use strict';var multer=require(_0x3588('0x0'));var util=require(_0x3588('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3588('0x2')]();var auth=require(_0x3588('0x3'));var interaction=require(_0x3588('0x4'));var config=require('../../config/environment');module[_0x3588('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 9bbcdb5..02def35 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf750=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x2a6bc,_0x761a07){var _0x288d3a=function(_0x3c52d8){while(--_0x3c52d8){_0x2a6bc['push'](_0x2a6bc['shift']());}};_0x288d3a(++_0x761a07);}(_0xf750,0xc5));var _0x0f75=function(_0x57062a,_0x123026){_0x57062a=_0x57062a-0x0;var _0xa178da=_0xf750[_0x57062a];return _0xa178da;};'use strict';var Sequelize=require(_0x0f75('0x0'));module[_0x0f75('0x1')]={'uniqueid':{'type':Sequelize[_0x0f75('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0f75('0x3')},'membername':{'type':Sequelize[_0x0f75('0x4')],'allowNull':![],'comment':_0x0f75('0x3')},'UserId':{'type':Sequelize[_0x0f75('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0f75('0x4')],'allowNull':![],'unique':_0x0f75('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x0f75('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x0f75('0x4')],'allowNull':![],'unique':_0x0f75('0x5'),'comment':_0x0f75('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x0f75('0x3')},'paused':{'type':Sequelize[_0x0f75('0x2')](0xb),'defaultValue':0x0,'comment':_0x0f75('0x3')}}; \ No newline at end of file +var _0x5945=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x5d057f,_0x481121){var _0x26d39b=function(_0x2f2163){while(--_0x2f2163){_0x5d057f['push'](_0x5d057f['shift']());}};_0x26d39b(++_0x481121);}(_0x5945,0x1de));var _0x5594=function(_0x7b8b47,_0x274711){_0x7b8b47=_0x7b8b47-0x0;var _0x5b3c2a=_0x5945[_0x7b8b47];return _0x5b3c2a;};'use strict';var Sequelize=require(_0x5594('0x0'));module[_0x5594('0x1')]={'uniqueid':{'type':Sequelize[_0x5594('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5594('0x3')},'membername':{'type':Sequelize[_0x5594('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5594('0x4')],'allowNull':![],'unique':_0x5594('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x5594('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x5594('0x4')],'allowNull':![],'unique':_0x5594('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x5594('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x5594('0x2')](0xb),'defaultValue':0x0,'comment':_0x5594('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 15fdc14..988ad6a 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7324=['hasOwnProperty','hook','exports','UserVoiceQueueRt','save','remove'];(function(_0x2d7c82,_0x49c48d){var _0x186310=function(_0xe26eca){while(--_0xe26eca){_0x2d7c82['push'](_0x2d7c82['shift']());}};_0x186310(++_0x49c48d);}(_0x7324,0xc9));var _0x4732=function(_0x4d76fd,_0x4ae87f){_0x4d76fd=_0x4d76fd-0x0;var _0x51a50a=_0x7324[_0x4d76fd];return _0x51a50a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x4732('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4732('0x1'),'afterUpdate':'update','afterDestroy':_0x4732('0x2')};function emitEvent(_0x3a7d40){return function(_0x397afa,_0x53e356,_0x4745c2){UserVoiceQueueRtEvents['emit'](_0x3a7d40+':'+_0x397afa['id'],_0x397afa);UserVoiceQueueRtEvents['emit'](_0x3a7d40,_0x397afa);_0x4745c2(null);};}for(var e in events){if(events[_0x4732('0x3')](e)){var event=events[e];UserVoiceQueueRt[_0x4732('0x4')](e,emitEvent(event));}}module[_0x4732('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd386=['hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit'];(function(_0x5d3ad7,_0x150d60){var _0x1ed853=function(_0x5eac0f){while(--_0x5eac0f){_0x5d3ad7['push'](_0x5d3ad7['shift']());}};_0x1ed853(++_0x150d60);}(_0xd386,0x14f));var _0x6d38=function(_0x5e8602,_0x2ce012){_0x5e8602=_0x5e8602-0x0;var _0x4434fb=_0xd386[_0x5e8602];return _0x4434fb;};'use strict';var EventEmitter=require(_0x6d38('0x0'));var UserVoiceQueueRt=require(_0x6d38('0x1'))['db'][_0x6d38('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6d38('0x3')](0x0);var events={'afterCreate':_0x6d38('0x4'),'afterUpdate':_0x6d38('0x5'),'afterDestroy':'remove'};function emitEvent(_0x266e42){return function(_0x3b763f,_0x40addc,_0x2d53c9){UserVoiceQueueRtEvents[_0x6d38('0x6')](_0x266e42+':'+_0x3b763f['id'],_0x3b763f);UserVoiceQueueRtEvents[_0x6d38('0x6')](_0x266e42,_0x3b763f);_0x2d53c9(null);};}for(var e in events){if(events[_0x6d38('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x6d38('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3061e5e..8d75e6a 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd462=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x2cc3d1,_0x968402){var _0x3c4dd5=function(_0x4aa953){while(--_0x4aa953){_0x2cc3d1['push'](_0x2cc3d1['shift']());}};_0x3c4dd5(++_0x968402);}(_0xd462,0xd0));var _0x2d46=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xd462[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var util=require(_0x2d46('0x0'));var logger=require('../../config/logger')(_0x2d46('0x1'));var moment=require(_0x2d46('0x2'));var BPromise=require(_0x2d46('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d46('0x4'));var rimraf=require(_0x2d46('0x5'));var config=require(_0x2d46('0x6'));var attributes=require(_0x2d46('0x7'));module[_0x2d46('0x8')]=function(_0x4ab883,_0x4f4e71){return _0x4ab883[_0x2d46('0x9')](_0x2d46('0xa'),attributes,{'tableName':_0x2d46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd3e=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0xbd3e,0x158));var _0xebd3=function(_0x53902d,_0x10a1d7){_0x53902d=_0x53902d-0x0;var _0x3954bc=_0xbd3e[_0x53902d];return _0x3954bc;};'use strict';var _=require(_0xebd3('0x0'));var util=require(_0xebd3('0x1'));var logger=require('../../config/logger')(_0xebd3('0x2'));var moment=require(_0xebd3('0x3'));var BPromise=require(_0xebd3('0x4'));var rp=require(_0xebd3('0x5'));var fs=require('fs');var path=require(_0xebd3('0x6'));var rimraf=require(_0xebd3('0x7'));var config=require(_0xebd3('0x8'));var attributes=require(_0xebd3('0x9'));module[_0xebd3('0xa')]=function(_0x47636c,_0x404a07){return _0x47636c[_0xebd3('0xb')](_0xebd3('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index e0892ca..75b8a47 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8d2=['moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','GetVoiceQueueRtPauses','catch','lodash','util'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0xd8d2,0x1cc));var _0x2d8d=function(_0x1d9fbc,_0x6a62f3){_0x1d9fbc=_0x1d9fbc-0x0;var _0x50e7e0=_0xd8d2[_0x1d9fbc];return _0x50e7e0;};'use strict';var _=require(_0x2d8d('0x0'));var util=require(_0x2d8d('0x1'));var moment=require(_0x2d8d('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d8d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d8d('0x4'));var logger=require(_0x2d8d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2d8d('0x6'));var client=jayson[_0x2d8d('0x7')][_0x2d8d('0x8')]({'port':0x232a});config[_0x2d8d('0x9')]=_[_0x2d8d('0xa')](config[_0x2d8d('0x9')],{'host':_0x2d8d('0xb'),'port':0x18eb});var socket=require(_0x2d8d('0xc'))(new Redis(config['redis']));require(_0x2d8d('0xd'))[_0x2d8d('0xe')](socket);function respondWithRpcPromise(_0x11ef10,_0xdc0381,_0x39cc3d){return new BPromise(function(_0x3f69bb,_0x1fb3aa){return client[_0x2d8d('0xf')](_0x11ef10,_0x39cc3d)['then'](function(_0xa0941b){logger[_0x2d8d('0x10')](_0x2d8d('0x11'),_0xdc0381,'request\x20sent');logger[_0x2d8d('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0xdc0381,_0x2d8d('0x13'),JSON[_0x2d8d('0x14')](_0xa0941b));if(_0xa0941b['error']){if(_0xa0941b[_0x2d8d('0x15')][_0x2d8d('0x16')]===0x1f4){logger[_0x2d8d('0x15')](_0x2d8d('0x11'),_0xdc0381,_0xa0941b[_0x2d8d('0x15')][_0x2d8d('0x17')]);return _0x1fb3aa(_0xa0941b[_0x2d8d('0x15')]['message']);}logger[_0x2d8d('0x15')](_0x2d8d('0x11'),_0xdc0381,_0xa0941b[_0x2d8d('0x15')][_0x2d8d('0x17')]);return _0x3f69bb(_0xa0941b[_0x2d8d('0x15')][_0x2d8d('0x17')]);}else{logger[_0x2d8d('0x10')](_0x2d8d('0x11'),_0xdc0381,'request\x20sent');_0x3f69bb(_0xa0941b['result'][_0x2d8d('0x17')]);}})['catch'](function(_0x27fa32){logger['error'](_0x2d8d('0x11'),_0xdc0381,_0x27fa32);_0x1fb3aa(_0x27fa32);});});}exports['GetVoiceQueueRtPauses']=function(_0x168f55){var _0x3af8fb=this;return new Promise(function(_0x450bba,_0x2e1db2){return db[_0x2d8d('0x18')]['findAll']({'raw':_0x168f55['options']?_0x168f55[_0x2d8d('0x19')][_0x2d8d('0x1a')]===undefined?!![]:![]:!![],'where':_0x168f55[_0x2d8d('0x19')]?_0x168f55[_0x2d8d('0x19')][_0x2d8d('0x1b')]||null:null,'attributes':[[db[_0x2d8d('0x1c')]['fn'](_0x2d8d('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x2d8d('0x1e')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})['then'](function(_0x39447f){logger[_0x2d8d('0x10')](_0x2d8d('0x1f'),_0x168f55);logger[_0x2d8d('0x12')](_0x2d8d('0x1f'),_0x168f55,JSON[_0x2d8d('0x14')](_0x39447f));_0x450bba(_0x39447f);})[_0x2d8d('0x20')](function(_0x29d656){logger[_0x2d8d('0x15')](_0x2d8d('0x1f'),_0x29d656[_0x2d8d('0x17')],_0x168f55);_0x2e1db2(_0x3af8fb[_0x2d8d('0x15')](0x1f4,_0x29d656[_0x2d8d('0x17')]));});});}; \ No newline at end of file +var _0x93c8=['request\x20sent','error','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x57241e,_0x33ba78){var _0x33ad39=function(_0x1b40e4){while(--_0x1b40e4){_0x57241e['push'](_0x57241e['shift']());}};_0x33ad39(++_0x33ba78);}(_0x93c8,0x178));var _0x893c=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x93c8[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x893c('0x0'));var moment=require(_0x893c('0x1'));var BPromise=require(_0x893c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x893c('0x3'));var db=require(_0x893c('0x4'))['db'];var utils=require(_0x893c('0x5'));var logger=require('../../config/logger')(_0x893c('0x6'));var config=require(_0x893c('0x7'));var jayson=require(_0x893c('0x8'));var client=jayson[_0x893c('0x9')]['http']({'port':0x232a});config['redis']=_[_0x893c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x893c('0xb'))(new Redis(config[_0x893c('0xc')]));require('./userVoiceQueueRt.socket')[_0x893c('0xd')](socket);function respondWithRpcPromise(_0x45599e,_0x5b5a00,_0x35d897){return new BPromise(function(_0x41668c,_0x46d567){return client[_0x893c('0xe')](_0x45599e,_0x35d897)[_0x893c('0xf')](function(_0x200500){logger[_0x893c('0x10')](_0x893c('0x11'),_0x5b5a00,'request\x20sent');logger[_0x893c('0x12')](_0x893c('0x13'),_0x5b5a00,_0x893c('0x14'),JSON['stringify'](_0x200500));if(_0x200500[_0x893c('0x15')]){if(_0x200500['error']['code']===0x1f4){logger['error'](_0x893c('0x11'),_0x5b5a00,_0x200500[_0x893c('0x15')]['message']);return _0x46d567(_0x200500[_0x893c('0x15')]['message']);}logger['error'](_0x893c('0x11'),_0x5b5a00,_0x200500['error'][_0x893c('0x16')]);return _0x41668c(_0x200500[_0x893c('0x15')][_0x893c('0x16')]);}else{logger['info'](_0x893c('0x11'),_0x5b5a00,_0x893c('0x14'));_0x41668c(_0x200500['result'][_0x893c('0x16')]);}})['catch'](function(_0x24228a){logger[_0x893c('0x15')](_0x893c('0x11'),_0x5b5a00,_0x24228a);_0x46d567(_0x24228a);});});}exports[_0x893c('0x17')]=function(_0x3a8fe9){var _0x3db3dd=this;return new Promise(function(_0x56efb7,_0x671e0c){return db[_0x893c('0x18')][_0x893c('0x19')]({'raw':_0x3a8fe9[_0x893c('0x1a')]?_0x3a8fe9['options'][_0x893c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a8fe9[_0x893c('0x1a')]?_0x3a8fe9['options'][_0x893c('0x1c')]||null:null,'attributes':[[db[_0x893c('0x1d')]['fn']('COUNT',db[_0x893c('0x1d')]['fn']('IF',db[_0x893c('0x1d')][_0x893c('0x1e')](_0x893c('0x1f')))),'outboundQueuePauses']]})[_0x893c('0xf')](function(_0x56e271){logger[_0x893c('0x10')](_0x893c('0x17'),_0x3a8fe9);logger['debug'](_0x893c('0x17'),_0x3a8fe9,JSON[_0x893c('0x20')](_0x56e271));_0x56efb7(_0x56e271);})['catch'](function(_0x105ab1){logger[_0x893c('0x15')](_0x893c('0x17'),_0x105ab1['message'],_0x3a8fe9);_0x671e0c(_0x3db3dd[_0x893c('0x15')](0x1f4,_0x105ab1[_0x893c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e58a0cd..bacc100 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7236=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x3f61da,_0x1d745a){var _0x2b7ae2=function(_0x1117de){while(--_0x1117de){_0x3f61da['push'](_0x3f61da['shift']());}};_0x2b7ae2(++_0x1d745a);}(_0x7236,0x13e));var _0x6723=function(_0x5a5819,_0x47ea9f){_0x5a5819=_0x5a5819-0x0;var _0x49ad2e=_0x7236[_0x5a5819];return _0x49ad2e;};'use strict';var UserVoiceQueueRtEvents=require(_0x6723('0x0'));var events=[_0x6723('0x1'),_0x6723('0x2'),_0x6723('0x3')];function createListener(_0x37d755,_0x23371f){return function(_0x25a0b2){_0x23371f['emit'](_0x37d755,_0x25a0b2);};}function removeListener(_0x500bc6,_0x21493c){return function(){UserVoiceQueueRtEvents['removeListener'](_0x500bc6,_0x21493c);};}exports[_0x6723('0x4')]=function(_0x402f69){for(var _0x4cb02d=0x0,_0x2433b5=events[_0x6723('0x5')];_0x4cb02d<_0x2433b5;_0x4cb02d++){var _0xf9052f=events[_0x4cb02d];var _0x1f7345=createListener(_0x6723('0x6')+_0xf9052f,_0x402f69);UserVoiceQueueRtEvents['on'](_0xf9052f,_0x1f7345);}}; \ No newline at end of file +var _0x9a42=['emit','removeListener','register','length','./userVoiceQueueRt.events','save','remove','update'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9a42,0x134));var _0x29a4=function(_0x8f9b2f,_0x17d552){_0x8f9b2f=_0x8f9b2f-0x0;var _0x487038=_0x9a42[_0x8f9b2f];return _0x487038;};'use strict';var UserVoiceQueueRtEvents=require(_0x29a4('0x0'));var events=[_0x29a4('0x1'),_0x29a4('0x2'),_0x29a4('0x3')];function createListener(_0x1a2615,_0x4cd9a4){return function(_0x5292d4){_0x4cd9a4[_0x29a4('0x4')](_0x1a2615,_0x5292d4);};}function removeListener(_0x2a3088,_0x4b579a){return function(){UserVoiceQueueRtEvents[_0x29a4('0x5')](_0x2a3088,_0x4b579a);};}exports[_0x29a4('0x6')]=function(_0xbd75a0){for(var _0x4fb454=0x0,_0x1f34bb=events[_0x29a4('0x7')];_0x4fb454<_0x1f34bb;_0x4fb454++){var _0x376f10=events[_0x4fb454];var _0x39bbb9=createListener('userVoiceQueueRt:'+_0x376f10,_0xbd75a0);UserVoiceQueueRtEvents['on'](_0x376f10,_0x39bbb9);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 07740fb..66878b3 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb35d=['express','Router','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x3f4f3b,_0x2d7be2){var _0xfc6f02=function(_0x226ae2){while(--_0x226ae2){_0x3f4f3b['push'](_0x3f4f3b['shift']());}};_0xfc6f02(++_0x2d7be2);}(_0xb35d,0x19c));var _0xdb35=function(_0x44b346,_0xeb097d){_0x44b346=_0x44b346-0x0;var _0x1c2f2b=_0xb35d[_0x44b346];return _0x1c2f2b;};'use strict';var multer=require(_0xdb35('0x0'));var util=require(_0xdb35('0x1'));var path=require(_0xdb35('0x2'));var timeout=require(_0xdb35('0x3'));var express=require(_0xdb35('0x4'));var router=express[_0xdb35('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdb35('0x6'));module[_0xdb35('0x7')]=router; \ No newline at end of file +var _0x7370=['multer','util','path','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5c10d3,_0x3a3b3a){var _0x2cbab4=function(_0x167680){while(--_0x167680){_0x5c10d3['push'](_0x5c10d3['shift']());}};_0x2cbab4(++_0x3a3b3a);}(_0x7370,0x11a));var _0x0737=function(_0xb26065,_0x36df08){_0xb26065=_0xb26065-0x0;var _0x974dce=_0x7370[_0xb26065];return _0x974dce;};'use strict';var multer=require(_0x0737('0x0'));var util=require(_0x0737('0x1'));var path=require(_0x0737('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0737('0x3'));var interaction=require(_0x0737('0x4'));var config=require('../../config/environment');module[_0x0737('0x5')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index d1df9fe..6d27d4c 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x30f56c,_0x39bebf){var _0x2c7047=function(_0x2f0847){while(--_0x2f0847){_0x30f56c['push'](_0x30f56c['shift']());}};_0x2c7047(++_0x39bebf);}(_0xe706,0xa3));var _0x6e70=function(_0x22a15e,_0x25fbc4){_0x22a15e=_0x22a15e-0x0;var _0x3e459f=_0xe706[_0x22a15e];return _0x3e459f;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index ad72c71..db8c964 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1e3=['exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x1d5daa,_0x452e80){var _0x5d14b1=function(_0x2ae76d){while(--_0x2ae76d){_0x1d5daa['push'](_0x1d5daa['shift']());}};_0x5d14b1(++_0x452e80);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x5c8109,_0x190d5b){_0x5c8109=_0x5c8109-0x0;var _0x1903d3=_0xe1e3[_0x5c8109];return _0x1903d3;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['user_has_whatsapp_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x4e38cf,_0x2f02cf){var _0x22a027=function(_0x15e70d){while(--_0x15e70d){_0x4e38cf['push'](_0x4e38cf['shift']());}};_0x22a027(++_0x2f02cf);}(_0x2032,0xd9));var _0x2203=function(_0x20b7ac,_0x24d8d9){_0x20b7ac=_0x20b7ac-0x0;var _0x468e89=_0x2032[_0x20b7ac];return _0x468e89;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index ca027c1..a48d2e6 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x43d211,_0x4323b0){var _0x5b2c20=function(_0x3b8821){while(--_0x3b8821){_0x43d211['push'](_0x43d211['shift']());}};_0x5b2c20(++_0x4323b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1582eb,_0x50cc43){var _0x382b06=function(_0xe4edfc){while(--_0xe4edfc){_0x1582eb['push'](_0x1582eb['shift']());}};_0x382b06(++_0x50cc43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index a7a0096..e4d565b 100644 --- a/server/api/variable/index.js +++ b/server/api/variable/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc321=['create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x4ed1fa,_0x42ec71){var _0x23944e=function(_0x390628){while(--_0x390628){_0x4ed1fa['push'](_0x4ed1fa['shift']());}};_0x23944e(++_0x42ec71);}(_0xc321,0xc0));var _0x1c32=function(_0x2a09e8,_0x1d75cd){_0x2a09e8=_0x2a09e8-0x0;var _0x1441e6=_0xc321[_0x2a09e8];return _0x1441e6;};'use strict';var multer=require(_0x1c32('0x0'));var util=require(_0x1c32('0x1'));var path=require(_0x1c32('0x2'));var timeout=require(_0x1c32('0x3'));var express=require('express');var router=express[_0x1c32('0x4')]();var auth=require(_0x1c32('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1c32('0x6'));var controller=require('./variable.controller');router['get']('/',auth[_0x1c32('0x7')](),controller[_0x1c32('0x8')]);router[_0x1c32('0x9')](_0x1c32('0xa'),auth[_0x1c32('0x7')](),controller[_0x1c32('0xb')]);router['post']('/',auth[_0x1c32('0x7')](),controller[_0x1c32('0xc')]);router[_0x1c32('0xd')](_0x1c32('0xa'),auth['isAuthenticated'](),controller[_0x1c32('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1c32('0xf')]);module[_0x1c32('0x10')]=router; \ No newline at end of file +var _0x532b=['index','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x532b,0x16f));var _0xb532=function(_0x308dcc,_0x2d1178){_0x308dcc=_0x308dcc-0x0;var _0x361717=_0x532b[_0x308dcc];return _0x361717;};'use strict';var multer=require(_0xb532('0x0'));var util=require('util');var path=require(_0xb532('0x1'));var timeout=require('connect-timeout');var express=require(_0xb532('0x2'));var router=express[_0xb532('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb532('0x4'));var config=require(_0xb532('0x5'));var controller=require('./variable.controller');router[_0xb532('0x6')]('/',auth['isAuthenticated'](),controller[_0xb532('0x7')]);router[_0xb532('0x6')](_0xb532('0x8'),auth['isAuthenticated'](),controller[_0xb532('0x9')]);router[_0xb532('0xa')]('/',auth[_0xb532('0xb')](),controller[_0xb532('0xc')]);router['put'](_0xb532('0x8'),auth[_0xb532('0xb')](),controller[_0xb532('0xd')]);router[_0xb532('0xe')](_0xb532('0x8'),auth[_0xb532('0xb')](),controller[_0xb532('0xf')]);module[_0xb532('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ef4a6ad..afc7eb6 100644 --- a/server/api/variable/variable.attributes.js +++ b/server/api/variable/variable.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e67=['STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e67,0x89));var _0x77e6=function(_0x3a19d4,_0x981e81){_0x3a19d4=_0x3a19d4-0x0;var _0x2e214f=_0x7e67[_0x3a19d4];return _0x2e214f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x77e6('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9d66=['STRING','name','sequelize','exports'];(function(_0x3598da,_0x246ecc){var _0x1bd18f=function(_0x2718cb){while(--_0x2718cb){_0x3598da['push'](_0x3598da['shift']());}};_0x1bd18f(++_0x246ecc);}(_0x9d66,0x10a));var _0x69d6=function(_0x5741de,_0x5e3daa){_0x5741de=_0x5741de-0x0;var _0x239628=_0x9d66[_0x5741de];return _0x239628;};'use strict';var Sequelize=require(_0x69d6('0x0'));module[_0x69d6('0x1')]={'name':{'type':Sequelize[_0x69d6('0x2')],'unique':_0x69d6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x69d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3ccdace..2a6f6e1 100644 --- a/server/api/variable/variable.controller.js +++ b/server/api/variable/variable.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8955=['json','count','offset','limit','Content-Range','reject','update','then','error','name','send','index','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','pick','filter','where','options','includeAll','include','rows','catch','show','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','autoAssociation','UserProfileResource','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x135083,_0x8f1013){var _0x5e7117=function(_0x553302){while(--_0x553302){_0x135083['push'](_0x135083['shift']());}};_0x5e7117(++_0x8f1013);}(_0x8955,0xc3));var _0x5895=function(_0x514df4,_0xba59d7){_0x514df4=_0x514df4-0x0;var _0x3c9e54=_0x8955[_0x514df4];return _0x3c9e54;};'use strict';var pdf=require(_0x5895('0x0'));var emlformat=require(_0x5895('0x1'));var rimraf=require(_0x5895('0x2'));var zipdir=require(_0x5895('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5895('0x4'));var moment=require(_0x5895('0x5'));var BPromise=require(_0x5895('0x6'));var Mustache=require(_0x5895('0x7'));var util=require(_0x5895('0x8'));var path=require('path');var sox=require(_0x5895('0x9'));var csv=require(_0x5895('0xa'));var ejs=require(_0x5895('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5895('0xc'));var crypto=require('crypto');var jsforce=require(_0x5895('0xd'));var deskjs=require(_0x5895('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5895('0xf'));var Papa=require(_0x5895('0x10'));var Redis=require(_0x5895('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5895('0x12'));var as=require(_0x5895('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5895('0x14'));var utils=require(_0x5895('0x15'));var config=require(_0x5895('0x16'));var licenseUtil=require(_0x5895('0x17'));var db=require(_0x5895('0x18'))['db'];function respondWithStatusCode(_0x2225cf,_0x1fa638){_0x1fa638=_0x1fa638||0xcc;return function(_0x4bcf38){if(_0x4bcf38){return _0x2225cf['sendStatus'](_0x1fa638);}return _0x2225cf[_0x5895('0x19')](_0x1fa638)[_0x5895('0x1a')]();};}function respondWithResult(_0x3b7a68,_0x429faa){_0x429faa=_0x429faa||0xc8;return function(_0x1a7039){if(_0x1a7039){return _0x3b7a68[_0x5895('0x19')](_0x429faa)[_0x5895('0x1b')](_0x1a7039);}};}function respondWithFilteredResult(_0x4dbb96,_0x4865b6){return function(_0x29587b){if(_0x29587b){var _0x5c7be1=_0x29587b[_0x5895('0x1c')],_0x3b5c25=_0x4865b6[_0x5895('0x1d')],_0x216e56=_0x4865b6[_0x5895('0x1d')]+_0x4865b6[_0x5895('0x1e')],_0x1cd5e9;if(_0x216e56>=_0x5c7be1){_0x216e56=_0x5c7be1;_0x1cd5e9=0xc8;}else{_0x1cd5e9=0xce;}_0x4dbb96['status'](_0x1cd5e9);return _0x4dbb96['set'](_0x5895('0x1f'),_0x3b5c25+'-'+_0x216e56+'/'+_0x5c7be1)[_0x5895('0x1b')](_0x29587b);}return null;};}function patchUpdates(_0x4d2841){return function(_0x5b80f1){try{jsonpatch['apply'](_0x5b80f1,_0x4d2841,!![]);}catch(_0xeca813){return BPromise[_0x5895('0x20')](_0xeca813);}return _0x5b80f1['save']();};}function saveUpdates(_0x587845,_0x50c5a6){return function(_0x2f1e8f){if(_0x2f1e8f){return _0x2f1e8f[_0x5895('0x21')](_0x587845)[_0x5895('0x22')](function(_0x59d7ce){return _0x59d7ce;});}return null;};}function removeEntity(_0x12e22c,_0x919bc){return function(_0x21a664){if(_0x21a664){return _0x21a664['destroy']()[_0x5895('0x22')](function(){var _0x3266c0=_0x21a664['get']({'plain':!![]});var _0x29f395='Variables';return db['UserProfileResource']['destroy']({'where':{'type':_0x29f395,'resourceId':_0x3266c0['id']}})[_0x5895('0x22')](function(){return _0x21a664;});})[_0x5895('0x22')](function(){_0x12e22c[_0x5895('0x19')](0xcc)[_0x5895('0x1a')]();});}};}function handleEntityNotFound(_0x1d8e8c,_0x6c1837){return function(_0x342b1a){if(!_0x342b1a){_0x1d8e8c['sendStatus'](0x194);}return _0x342b1a;};}function handleError(_0x30da53,_0x2a0f71){_0x2a0f71=_0x2a0f71||0x1f4;return function(_0x44207c){logger[_0x5895('0x23')](_0x44207c['stack']);if(_0x44207c[_0x5895('0x24')]){delete _0x44207c['name'];}_0x30da53[_0x5895('0x19')](_0x2a0f71)[_0x5895('0x25')](_0x44207c);};}exports[_0x5895('0x26')]=function(_0x3884ac,_0x2afd3d){var _0x24ac37={},_0x15e63b={},_0x43d233={'count':0x0,'rows':[]};var _0x180605=_[_0x5895('0x27')](db[_0x5895('0x28')][_0x5895('0x29')],function(_0xfcca5a){return{'name':_0xfcca5a[_0x5895('0x2a')],'type':_0xfcca5a[_0x5895('0x2b')]['key']};});_0x15e63b[_0x5895('0x2c')]=_[_0x5895('0x27')](_0x180605,_0x5895('0x24'));_0x15e63b[_0x5895('0x2d')]=_[_0x5895('0x2e')](_0x3884ac['query']);_0x15e63b[_0x5895('0x2f')]=_['intersection'](_0x15e63b[_0x5895('0x2c')],_0x15e63b[_0x5895('0x2d')]);_0x24ac37[_0x5895('0x30')]=_[_0x5895('0x31')](_0x15e63b['model'],qs[_0x5895('0x32')](_0x3884ac['query'][_0x5895('0x32')]));_0x24ac37[_0x5895('0x30')]=_0x24ac37[_0x5895('0x30')]['length']?_0x24ac37[_0x5895('0x30')]:_0x15e63b[_0x5895('0x2c')];if(!_0x3884ac[_0x5895('0x2d')]['hasOwnProperty'](_0x5895('0x33'))){_0x24ac37['limit']=qs['limit'](_0x3884ac[_0x5895('0x2d')][_0x5895('0x1e')]);_0x24ac37[_0x5895('0x1d')]=qs[_0x5895('0x1d')](_0x3884ac['query'][_0x5895('0x1d')]);}_0x24ac37['order']=qs['sort'](_0x3884ac[_0x5895('0x2d')][_0x5895('0x34')]);_0x24ac37['where']=qs['filters'](_[_0x5895('0x35')](_0x3884ac[_0x5895('0x2d')],_0x15e63b[_0x5895('0x2f')]),_0x180605);if(_0x3884ac[_0x5895('0x2d')][_0x5895('0x36')]){_0x24ac37[_0x5895('0x37')]=_['merge'](_0x24ac37[_0x5895('0x37')],{'$or':_[_0x5895('0x27')](_0x180605,function(_0x44871d){if(_0x44871d[_0x5895('0x2b')]!=='VIRTUAL'){var _0x462762={};_0x462762[_0x44871d[_0x5895('0x24')]]={'$like':'%'+_0x3884ac[_0x5895('0x2d')][_0x5895('0x36')]+'%'};return _0x462762;}})});}_0x24ac37=_['merge']({},_0x24ac37,_0x3884ac[_0x5895('0x38')]);var _0x44371d={'where':_0x24ac37['where']};return db[_0x5895('0x28')]['count'](_0x44371d)[_0x5895('0x22')](function(_0x48221b){_0x43d233['count']=_0x48221b;if(_0x3884ac[_0x5895('0x2d')][_0x5895('0x39')]){_0x24ac37[_0x5895('0x3a')]=[{'all':!![]}];}return db[_0x5895('0x28')]['findAll'](_0x24ac37);})[_0x5895('0x22')](function(_0x3f698a){_0x43d233[_0x5895('0x3b')]=_0x3f698a;return _0x43d233;})['then'](respondWithFilteredResult(_0x2afd3d,_0x24ac37))[_0x5895('0x3c')](handleError(_0x2afd3d,null));};exports[_0x5895('0x3d')]=function(_0x1f73c6,_0x3e1555){var _0xc9c14a={'raw':!![],'where':{'id':_0x1f73c6['params']['id']}},_0xffbd95={};_0xffbd95[_0x5895('0x2c')]=_[_0x5895('0x2e')](db[_0x5895('0x28')][_0x5895('0x29')]);_0xffbd95['query']=_[_0x5895('0x2e')](_0x1f73c6['query']);_0xffbd95['filters']=_[_0x5895('0x31')](_0xffbd95[_0x5895('0x2c')],_0xffbd95[_0x5895('0x2d')]);_0xc9c14a['attributes']=_['intersection'](_0xffbd95[_0x5895('0x2c')],qs[_0x5895('0x32')](_0x1f73c6[_0x5895('0x2d')][_0x5895('0x32')]));_0xc9c14a[_0x5895('0x30')]=_0xc9c14a[_0x5895('0x30')][_0x5895('0x3e')]?_0xc9c14a[_0x5895('0x30')]:_0xffbd95[_0x5895('0x2c')];if(_0x1f73c6[_0x5895('0x2d')][_0x5895('0x39')]){_0xc9c14a[_0x5895('0x3a')]=[{'all':!![]}];}_0xc9c14a=_['merge']({},_0xc9c14a,_0x1f73c6[_0x5895('0x38')]);return db[_0x5895('0x28')][_0x5895('0x3f')](_0xc9c14a)[_0x5895('0x22')](handleEntityNotFound(_0x3e1555,null))[_0x5895('0x22')](respondWithResult(_0x3e1555,null))['catch'](handleError(_0x3e1555,null));};exports[_0x5895('0x40')]=function(_0x30441b,_0x37303c){return db[_0x5895('0x28')][_0x5895('0x40')](_0x30441b[_0x5895('0x41')],{})[_0x5895('0x22')](function(_0x3dc320){var _0x5ec650=_0x30441b['user'][_0x5895('0x42')]({'plain':!![]});if(!_0x5ec650)throw new Error(_0x5895('0x43'));if(_0x5ec650[_0x5895('0x44')]===_0x5895('0x45')){var _0x17c983=_0x3dc320['get']({'plain':!![]});var _0xc5399=_0x5895('0x46');return db[_0x5895('0x47')]['find']({'where':{'name':_0xc5399,'userProfileId':_0x5ec650['userProfileId']},'raw':!![]})[_0x5895('0x22')](function(_0x293e63){if(_0x293e63&&_0x293e63[_0x5895('0x48')]===0x0){return db[_0x5895('0x49')][_0x5895('0x40')]({'name':_0x17c983[_0x5895('0x24')],'resourceId':_0x17c983['id'],'type':_0x293e63[_0x5895('0x24')],'sectionId':_0x293e63['id']},{})[_0x5895('0x22')](function(){return _0x3dc320;});}else{return _0x3dc320;}})['catch'](function(_0x17cc06){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17cc06);throw _0x17cc06;});}return _0x3dc320;})['then'](respondWithResult(_0x37303c,0xc9))[_0x5895('0x3c')](handleError(_0x37303c,null));};exports[_0x5895('0x21')]=function(_0x934dfe,_0x5794af){if(_0x934dfe[_0x5895('0x41')]['id']){delete _0x934dfe[_0x5895('0x41')]['id'];}return db['Variable'][_0x5895('0x3f')]({'where':{'id':_0x934dfe['params']['id']}})[_0x5895('0x22')](handleEntityNotFound(_0x5794af,null))[_0x5895('0x22')](saveUpdates(_0x934dfe[_0x5895('0x41')],null))[_0x5895('0x22')](respondWithResult(_0x5794af,null))[_0x5895('0x3c')](handleError(_0x5794af,null));};exports['destroy']=function(_0xdcffa1,_0x3f4cb2){return db[_0x5895('0x28')][_0x5895('0x3f')]({'where':{'id':_0xdcffa1['params']['id']}})['then'](handleEntityNotFound(_0x3f4cb2,null))[_0x5895('0x22')](removeEntity(_0x3f4cb2,null))[_0x5895('0x3c')](handleError(_0x3f4cb2,null));}; \ No newline at end of file +var _0x3c3b=['limit','set','Content-Range','apply','reject','save','update','destroy','then','Variables','UserProfileResource','name','send','map','Variable','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x3c76cf,_0x2db5d8){var _0xf10f91=function(_0x9ee515){while(--_0x9ee515){_0x3c76cf['push'](_0x3c76cf['shift']());}};_0xf10f91(++_0x2db5d8);}(_0x3c3b,0x172));var _0xb3c3=function(_0x25c02d,_0x27f7ae){_0x25c02d=_0x25c02d-0x0;var _0xea1527=_0x3c3b[_0x25c02d];return _0xea1527;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb3c3('0x0'));var rimraf=require(_0xb3c3('0x1'));var zipdir=require(_0xb3c3('0x2'));var jsonpatch=require(_0xb3c3('0x3'));var rp=require(_0xb3c3('0x4'));var moment=require(_0xb3c3('0x5'));var BPromise=require(_0xb3c3('0x6'));var Mustache=require(_0xb3c3('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb3c3('0x8'));var csv=require(_0xb3c3('0x9'));var ejs=require(_0xb3c3('0xa'));var fs=require('fs');var _=require(_0xb3c3('0xb'));var squel=require('squel');var crypto=require(_0xb3c3('0xc'));var jsforce=require(_0xb3c3('0xd'));var deskjs=require(_0xb3c3('0xe'));var toCsv=require(_0xb3c3('0x9'));var querystring=require(_0xb3c3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb3c3('0x10'));var qs=require(_0xb3c3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3c3('0x12'))(_0xb3c3('0x13'));var utils=require(_0xb3c3('0x14'));var config=require(_0xb3c3('0x15'));var licenseUtil=require(_0xb3c3('0x16'));var db=require(_0xb3c3('0x17'))['db'];function respondWithStatusCode(_0x319692,_0x493a54){_0x493a54=_0x493a54||0xcc;return function(_0x96b17d){if(_0x96b17d){return _0x319692[_0xb3c3('0x18')](_0x493a54);}return _0x319692['status'](_0x493a54)[_0xb3c3('0x19')]();};}function respondWithResult(_0x2d3bc9,_0x2d586c){_0x2d586c=_0x2d586c||0xc8;return function(_0x337b22){if(_0x337b22){return _0x2d3bc9[_0xb3c3('0x1a')](_0x2d586c)[_0xb3c3('0x1b')](_0x337b22);}};}function respondWithFilteredResult(_0x21b06a,_0x347af5){return function(_0x3393d8){if(_0x3393d8){var _0x2a40f5=_0x3393d8[_0xb3c3('0x1c')],_0x564f7b=_0x347af5[_0xb3c3('0x1d')],_0x3dd10a=_0x347af5[_0xb3c3('0x1d')]+_0x347af5[_0xb3c3('0x1e')],_0x20e2c6;if(_0x3dd10a>=_0x2a40f5){_0x3dd10a=_0x2a40f5;_0x20e2c6=0xc8;}else{_0x20e2c6=0xce;}_0x21b06a[_0xb3c3('0x1a')](_0x20e2c6);return _0x21b06a[_0xb3c3('0x1f')](_0xb3c3('0x20'),_0x564f7b+'-'+_0x3dd10a+'/'+_0x2a40f5)[_0xb3c3('0x1b')](_0x3393d8);}return null;};}function patchUpdates(_0x21569c){return function(_0x358b59){try{jsonpatch[_0xb3c3('0x21')](_0x358b59,_0x21569c,!![]);}catch(_0x22e97){return BPromise[_0xb3c3('0x22')](_0x22e97);}return _0x358b59[_0xb3c3('0x23')]();};}function saveUpdates(_0x52e8ec,_0x35a2b3){return function(_0x4d2e2b){if(_0x4d2e2b){return _0x4d2e2b[_0xb3c3('0x24')](_0x52e8ec)['then'](function(_0x10c314){return _0x10c314;});}return null;};}function removeEntity(_0x3aeb17,_0x12869c){return function(_0x2257f3){if(_0x2257f3){return _0x2257f3[_0xb3c3('0x25')]()[_0xb3c3('0x26')](function(){var _0x244166=_0x2257f3['get']({'plain':!![]});var _0x1990e5=_0xb3c3('0x27');return db[_0xb3c3('0x28')][_0xb3c3('0x25')]({'where':{'type':_0x1990e5,'resourceId':_0x244166['id']}})[_0xb3c3('0x26')](function(){return _0x2257f3;});})[_0xb3c3('0x26')](function(){_0x3aeb17['status'](0xcc)[_0xb3c3('0x19')]();});}};}function handleEntityNotFound(_0x40f6e6,_0x11282d){return function(_0x53e1a5){if(!_0x53e1a5){_0x40f6e6['sendStatus'](0x194);}return _0x53e1a5;};}function handleError(_0x3c8d7e,_0xadf4e7){_0xadf4e7=_0xadf4e7||0x1f4;return function(_0x165347){logger['error'](_0x165347['stack']);if(_0x165347[_0xb3c3('0x29')]){delete _0x165347[_0xb3c3('0x29')];}_0x3c8d7e[_0xb3c3('0x1a')](_0xadf4e7)[_0xb3c3('0x2a')](_0x165347);};}exports['index']=function(_0x554274,_0x244948){var _0xa3a56e={},_0x58fcbe={},_0x341030={'count':0x0,'rows':[]};var _0xce0009=_[_0xb3c3('0x2b')](db[_0xb3c3('0x2c')][_0xb3c3('0x2d')],function(_0x5ea9cf){return{'name':_0x5ea9cf[_0xb3c3('0x2e')],'type':_0x5ea9cf[_0xb3c3('0x2f')]['key']};});_0x58fcbe[_0xb3c3('0x30')]=_[_0xb3c3('0x2b')](_0xce0009,_0xb3c3('0x29'));_0x58fcbe[_0xb3c3('0x31')]=_['keys'](_0x554274[_0xb3c3('0x31')]);_0x58fcbe['filters']=_[_0xb3c3('0x32')](_0x58fcbe[_0xb3c3('0x30')],_0x58fcbe[_0xb3c3('0x31')]);_0xa3a56e[_0xb3c3('0x33')]=_[_0xb3c3('0x32')](_0x58fcbe[_0xb3c3('0x30')],qs['fields'](_0x554274[_0xb3c3('0x31')][_0xb3c3('0x34')]));_0xa3a56e[_0xb3c3('0x33')]=_0xa3a56e[_0xb3c3('0x33')][_0xb3c3('0x35')]?_0xa3a56e[_0xb3c3('0x33')]:_0x58fcbe[_0xb3c3('0x30')];if(!_0x554274['query'][_0xb3c3('0x36')](_0xb3c3('0x37'))){_0xa3a56e['limit']=qs[_0xb3c3('0x1e')](_0x554274[_0xb3c3('0x31')][_0xb3c3('0x1e')]);_0xa3a56e[_0xb3c3('0x1d')]=qs['offset'](_0x554274[_0xb3c3('0x31')]['offset']);}_0xa3a56e['order']=qs[_0xb3c3('0x38')](_0x554274[_0xb3c3('0x31')][_0xb3c3('0x38')]);_0xa3a56e['where']=qs[_0xb3c3('0x39')](_['pick'](_0x554274[_0xb3c3('0x31')],_0x58fcbe['filters']),_0xce0009);if(_0x554274[_0xb3c3('0x31')][_0xb3c3('0x3a')]){_0xa3a56e[_0xb3c3('0x3b')]=_[_0xb3c3('0x3c')](_0xa3a56e[_0xb3c3('0x3b')],{'$or':_[_0xb3c3('0x2b')](_0xce0009,function(_0x699e5a){if(_0x699e5a[_0xb3c3('0x2f')]!==_0xb3c3('0x3d')){var _0x484c4a={};_0x484c4a[_0x699e5a[_0xb3c3('0x29')]]={'$like':'%'+_0x554274[_0xb3c3('0x31')][_0xb3c3('0x3a')]+'%'};return _0x484c4a;}})});}_0xa3a56e=_[_0xb3c3('0x3c')]({},_0xa3a56e,_0x554274[_0xb3c3('0x3e')]);var _0x5405a7={'where':_0xa3a56e[_0xb3c3('0x3b')]};return db[_0xb3c3('0x2c')]['count'](_0x5405a7)[_0xb3c3('0x26')](function(_0x3391f3){_0x341030['count']=_0x3391f3;if(_0x554274['query']['includeAll']){_0xa3a56e[_0xb3c3('0x3f')]=[{'all':!![]}];}return db[_0xb3c3('0x2c')][_0xb3c3('0x40')](_0xa3a56e);})[_0xb3c3('0x26')](function(_0x5ca35d){_0x341030['rows']=_0x5ca35d;return _0x341030;})[_0xb3c3('0x26')](respondWithFilteredResult(_0x244948,_0xa3a56e))[_0xb3c3('0x41')](handleError(_0x244948,null));};exports[_0xb3c3('0x42')]=function(_0x9cc961,_0x3b91e4){var _0x2f2cf3={'raw':!![],'where':{'id':_0x9cc961[_0xb3c3('0x43')]['id']}},_0x1e7e09={};_0x1e7e09[_0xb3c3('0x30')]=_[_0xb3c3('0x44')](db['Variable']['rawAttributes']);_0x1e7e09[_0xb3c3('0x31')]=_[_0xb3c3('0x44')](_0x9cc961[_0xb3c3('0x31')]);_0x1e7e09[_0xb3c3('0x39')]=_['intersection'](_0x1e7e09[_0xb3c3('0x30')],_0x1e7e09['query']);_0x2f2cf3['attributes']=_[_0xb3c3('0x32')](_0x1e7e09[_0xb3c3('0x30')],qs[_0xb3c3('0x34')](_0x9cc961['query'][_0xb3c3('0x34')]));_0x2f2cf3[_0xb3c3('0x33')]=_0x2f2cf3[_0xb3c3('0x33')][_0xb3c3('0x35')]?_0x2f2cf3[_0xb3c3('0x33')]:_0x1e7e09[_0xb3c3('0x30')];if(_0x9cc961[_0xb3c3('0x31')]['includeAll']){_0x2f2cf3[_0xb3c3('0x3f')]=[{'all':!![]}];}_0x2f2cf3=_[_0xb3c3('0x3c')]({},_0x2f2cf3,_0x9cc961[_0xb3c3('0x3e')]);return db[_0xb3c3('0x2c')][_0xb3c3('0x45')](_0x2f2cf3)[_0xb3c3('0x26')](handleEntityNotFound(_0x3b91e4,null))['then'](respondWithResult(_0x3b91e4,null))['catch'](handleError(_0x3b91e4,null));};exports[_0xb3c3('0x46')]=function(_0x1d0e3b,_0x519886){return db[_0xb3c3('0x2c')][_0xb3c3('0x46')](_0x1d0e3b['body'],{})[_0xb3c3('0x26')](function(_0x47ebfb){var _0x17d15d=_0x1d0e3b[_0xb3c3('0x47')]['get']({'plain':!![]});if(!_0x17d15d)throw new Error(_0xb3c3('0x48'));if(_0x17d15d[_0xb3c3('0x49')]===_0xb3c3('0x47')){var _0x40fd13=_0x47ebfb[_0xb3c3('0x4a')]({'plain':!![]});var _0xc17590=_0xb3c3('0x27');return db[_0xb3c3('0x4b')][_0xb3c3('0x45')]({'where':{'name':_0xc17590,'userProfileId':_0x17d15d['userProfileId']},'raw':!![]})['then'](function(_0x512723){if(_0x512723&&_0x512723[_0xb3c3('0x4c')]===0x0){return db[_0xb3c3('0x28')]['create']({'name':_0x40fd13[_0xb3c3('0x29')],'resourceId':_0x40fd13['id'],'type':_0x512723[_0xb3c3('0x29')],'sectionId':_0x512723['id']},{})[_0xb3c3('0x26')](function(){return _0x47ebfb;});}else{return _0x47ebfb;}})[_0xb3c3('0x41')](function(_0x18ccde){logger[_0xb3c3('0x4d')](_0xb3c3('0x4e'),_0x18ccde);throw _0x18ccde;});}return _0x47ebfb;})[_0xb3c3('0x26')](respondWithResult(_0x519886,0xc9))[_0xb3c3('0x41')](handleError(_0x519886,null));};exports[_0xb3c3('0x24')]=function(_0x36b584,_0x44609a){if(_0x36b584[_0xb3c3('0x4f')]['id']){delete _0x36b584[_0xb3c3('0x4f')]['id'];}return db['Variable'][_0xb3c3('0x45')]({'where':{'id':_0x36b584[_0xb3c3('0x43')]['id']}})['then'](handleEntityNotFound(_0x44609a,null))[_0xb3c3('0x26')](saveUpdates(_0x36b584[_0xb3c3('0x4f')],null))[_0xb3c3('0x26')](respondWithResult(_0x44609a,null))[_0xb3c3('0x41')](handleError(_0x44609a,null));};exports[_0xb3c3('0x25')]=function(_0x21d9e8,_0x178988){return db['Variable'][_0xb3c3('0x45')]({'where':{'id':_0x21d9e8['params']['id']}})[_0xb3c3('0x26')](handleEntityNotFound(_0x178988,null))[_0xb3c3('0x26')](removeEntity(_0x178988,null))[_0xb3c3('0x41')](handleError(_0x178988,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 8b595b2..7a9c42d 100644 --- a/server/api/variable/variable.model.js +++ b/server/api/variable/variable.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x823c=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash'];(function(_0x306c3f,_0x1cd98b){var _0x51f2c2=function(_0x13f408){while(--_0x13f408){_0x306c3f['push'](_0x306c3f['shift']());}};_0x51f2c2(++_0x1cd98b);}(_0x823c,0x143));var _0xc823=function(_0x32b41a,_0x3b6e0b){_0x32b41a=_0x32b41a-0x0;var _0x442597=_0x823c[_0x32b41a];return _0x442597;};'use strict';var _=require(_0xc823('0x0'));var util=require('util');var logger=require(_0xc823('0x1'))(_0xc823('0x2'));var moment=require(_0xc823('0x3'));var BPromise=require(_0xc823('0x4'));var rp=require(_0xc823('0x5'));var fs=require('fs');var path=require(_0xc823('0x6'));var rimraf=require('rimraf');var config=require(_0xc823('0x7'));var attributes=require(_0xc823('0x8'));module[_0xc823('0x9')]=function(_0x42e0c0,_0x380607){return _0x42e0c0['define'](_0xc823('0xa'),attributes,{'tableName':_0xc823('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc30d=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./variable.attributes','exports','define','Variable'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc30d,0x6e));var _0xdc30=function(_0x1da10a,_0x1fe948){_0x1da10a=_0x1da10a-0x0;var _0x5aea64=_0xc30d[_0x1da10a];return _0x5aea64;};'use strict';var _=require(_0xdc30('0x0'));var util=require('util');var logger=require(_0xdc30('0x1'))(_0xdc30('0x2'));var moment=require(_0xdc30('0x3'));var BPromise=require(_0xdc30('0x4'));var rp=require(_0xdc30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc30('0x6'));var config=require('../../config/environment');var attributes=require(_0xdc30('0x7'));module[_0xdc30('0x8')]=function(_0x1d2db4,_0x3e480e){return _0x1d2db4[_0xdc30('0x9')](_0xdc30('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index a32b7ac..3420151 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ec4=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Variable,\x20%s,\x20%s','message','result','ShowVariable','find','options','raw','where','model','attributes','include','then','catch','lodash','util','moment','bluebird'];(function(_0x31c5e9,_0x30e373){var _0x517a8d=function(_0x7f9a48){while(--_0x7f9a48){_0x31c5e9['push'](_0x31c5e9['shift']());}};_0x517a8d(++_0x30e373);}(_0x9ec4,0xc8));var _0x49ec=function(_0x62da21,_0x5d2b87){_0x62da21=_0x62da21-0x0;var _0x2a8305=_0x9ec4[_0x62da21];return _0x2a8305;};'use strict';var _=require(_0x49ec('0x0'));var util=require(_0x49ec('0x1'));var moment=require(_0x49ec('0x2'));var BPromise=require(_0x49ec('0x3'));var rs=require(_0x49ec('0x4'));var fs=require('fs');var Redis=require(_0x49ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x49ec('0x6'));var logger=require(_0x49ec('0x7'))(_0x49ec('0x8'));var config=require(_0x49ec('0x9'));var jayson=require(_0x49ec('0xa'));var client=jayson[_0x49ec('0xb')][_0x49ec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x184f94,_0x25ced2,_0x1337f3){return new BPromise(function(_0x4f5342,_0x58e11f){return client[_0x49ec('0xd')](_0x184f94,_0x1337f3)['then'](function(_0x138bed){logger[_0x49ec('0xe')]('Variable,\x20%s,\x20%s',_0x25ced2,'request\x20sent');logger[_0x49ec('0xf')](_0x49ec('0x10'),_0x25ced2,_0x49ec('0x11'),JSON[_0x49ec('0x12')](_0x138bed));if(_0x138bed[_0x49ec('0x13')]){if(_0x138bed[_0x49ec('0x13')][_0x49ec('0x14')]===0x1f4){logger[_0x49ec('0x13')](_0x49ec('0x15'),_0x25ced2,_0x138bed[_0x49ec('0x13')]['message']);return _0x58e11f(_0x138bed[_0x49ec('0x13')]['message']);}logger['error'](_0x49ec('0x15'),_0x25ced2,_0x138bed[_0x49ec('0x13')]['message']);return _0x4f5342(_0x138bed[_0x49ec('0x13')][_0x49ec('0x16')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x25ced2,_0x49ec('0x11'));_0x4f5342(_0x138bed[_0x49ec('0x17')][_0x49ec('0x16')]);}})['catch'](function(_0x3b3106){logger[_0x49ec('0x13')](_0x49ec('0x15'),_0x25ced2,_0x3b3106);_0x58e11f(_0x3b3106);});});}exports[_0x49ec('0x18')]=function(_0x3c2b){var _0x4c65c7=this;return new Promise(function(_0x4f60ab,_0x1558c6){return db['Variable'][_0x49ec('0x19')]({'raw':_0x3c2b[_0x49ec('0x1a')]?_0x3c2b['options'][_0x49ec('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c2b[_0x49ec('0x1a')]?_0x3c2b[_0x49ec('0x1a')][_0x49ec('0x1c')]||null:null,'attributes':_0x3c2b[_0x49ec('0x1a')]?_0x3c2b['options']['attributes']||null:null,'include':_0x3c2b['options']?_0x3c2b['options']['include']?_['map'](_0x3c2b[_0x49ec('0x1a')]['include'],function(_0x36cd55){return{'model':db[_0x36cd55[_0x49ec('0x1d')]],'as':_0x36cd55['as'],'attributes':_0x36cd55[_0x49ec('0x1e')],'include':_0x36cd55[_0x49ec('0x1f')]?_['map'](_0x36cd55[_0x49ec('0x1f')],function(_0x41c093){return{'model':db[_0x41c093['model']],'as':_0x41c093['as'],'attributes':_0x41c093[_0x49ec('0x1e')],'include':_0x41c093[_0x49ec('0x1f')]?_['map'](_0x41c093['include'],function(_0x27d007){return{'model':db[_0x27d007['model']],'as':_0x27d007['as'],'attributes':_0x27d007['attributes']};}):[]};}):[]};}):[]:[]})[_0x49ec('0x20')](function(_0x374ec3){logger[_0x49ec('0xe')](_0x49ec('0x18'),_0x3c2b);logger[_0x49ec('0xf')](_0x49ec('0x18'),_0x3c2b,JSON[_0x49ec('0x12')](_0x374ec3));_0x4f60ab(_0x374ec3);})[_0x49ec('0x21')](function(_0x1849bd){logger[_0x49ec('0x13')]('ShowVariable',_0x1849bd['message'],_0x3c2b);_0x1558c6(_0x4c65c7[_0x49ec('0x13')](0x1f4,_0x1849bd[_0x49ec('0x16')]));});});}; \ No newline at end of file +var _0xd19d=['message','result','catch','ShowVariable','find','options','raw','where','include','map','attributes','model','debug','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','Variable,\x20%s,\x20%s'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xd19d,0x11b));var _0xdd19=function(_0x3b37bd,_0x36c79b){_0x3b37bd=_0x3b37bd-0x0;var _0x7fd5f9=_0xd19d[_0x3b37bd];return _0x7fd5f9;};'use strict';var _=require('lodash');var util=require(_0xdd19('0x0'));var moment=require('moment');var BPromise=require(_0xdd19('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd19('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd19('0x3'))(_0xdd19('0x4'));var config=require('../../config/environment');var jayson=require(_0xdd19('0x5'));var client=jayson[_0xdd19('0x6')][_0xdd19('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x340bd9,_0x434270,_0x2071f6){return new BPromise(function(_0x49e3c5,_0x1d99bd){return client[_0xdd19('0x8')](_0x340bd9,_0x2071f6)[_0xdd19('0x9')](function(_0x3a34a6){logger[_0xdd19('0xa')]('Variable,\x20%s,\x20%s',_0x434270,_0xdd19('0xb'));logger['debug'](_0xdd19('0xc'),_0x434270,_0xdd19('0xb'),JSON[_0xdd19('0xd')](_0x3a34a6));if(_0x3a34a6[_0xdd19('0xe')]){if(_0x3a34a6['error'][_0xdd19('0xf')]===0x1f4){logger[_0xdd19('0xe')](_0xdd19('0x10'),_0x434270,_0x3a34a6[_0xdd19('0xe')][_0xdd19('0x11')]);return _0x1d99bd(_0x3a34a6[_0xdd19('0xe')][_0xdd19('0x11')]);}logger['error']('Variable,\x20%s,\x20%s',_0x434270,_0x3a34a6[_0xdd19('0xe')]['message']);return _0x49e3c5(_0x3a34a6['error'][_0xdd19('0x11')]);}else{logger['info'](_0xdd19('0x10'),_0x434270,_0xdd19('0xb'));_0x49e3c5(_0x3a34a6[_0xdd19('0x12')][_0xdd19('0x11')]);}})[_0xdd19('0x13')](function(_0x7d9151){logger[_0xdd19('0xe')](_0xdd19('0x10'),_0x434270,_0x7d9151);_0x1d99bd(_0x7d9151);});});}exports[_0xdd19('0x14')]=function(_0xec0b87){var _0x55c324=this;return new Promise(function(_0x5405b3,_0x2c503f){return db['Variable'][_0xdd19('0x15')]({'raw':_0xec0b87[_0xdd19('0x16')]?_0xec0b87[_0xdd19('0x16')][_0xdd19('0x17')]===undefined?!![]:![]:!![],'where':_0xec0b87[_0xdd19('0x16')]?_0xec0b87[_0xdd19('0x16')][_0xdd19('0x18')]||null:null,'attributes':_0xec0b87['options']?_0xec0b87['options']['attributes']||null:null,'include':_0xec0b87[_0xdd19('0x16')]?_0xec0b87['options'][_0xdd19('0x19')]?_[_0xdd19('0x1a')](_0xec0b87['options'][_0xdd19('0x19')],function(_0x15c608){return{'model':db[_0x15c608['model']],'as':_0x15c608['as'],'attributes':_0x15c608[_0xdd19('0x1b')],'include':_0x15c608[_0xdd19('0x19')]?_[_0xdd19('0x1a')](_0x15c608[_0xdd19('0x19')],function(_0x19af50){return{'model':db[_0x19af50[_0xdd19('0x1c')]],'as':_0x19af50['as'],'attributes':_0x19af50[_0xdd19('0x1b')],'include':_0x19af50[_0xdd19('0x19')]?_[_0xdd19('0x1a')](_0x19af50[_0xdd19('0x19')],function(_0x48bd21){return{'model':db[_0x48bd21[_0xdd19('0x1c')]],'as':_0x48bd21['as'],'attributes':_0x48bd21[_0xdd19('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdd19('0x9')](function(_0xa12dd){logger[_0xdd19('0xa')](_0xdd19('0x14'),_0xec0b87);logger[_0xdd19('0x1d')](_0xdd19('0x14'),_0xec0b87,JSON[_0xdd19('0xd')](_0xa12dd));_0x5405b3(_0xa12dd);})[_0xdd19('0x13')](function(_0x10a50a){logger[_0xdd19('0xe')]('ShowVariable',_0x10a50a[_0xdd19('0x11')],_0xec0b87);_0x2c503f(_0x55c324[_0xdd19('0xe')](0x1f4,_0x10a50a[_0xdd19('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index ae64880..1fb51e6 100644 --- a/server/api/version/index.js +++ b/server/api/version/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce49=['/pull','pull','/restart','restart','/migrations','exports','Router','isAuthenticated','get','/reset','canUpdate','reset'];(function(_0x38bccc,_0xd4090e){var _0x5a5109=function(_0x256e54){while(--_0x256e54){_0x38bccc['push'](_0x38bccc['shift']());}};_0x5a5109(++_0xd4090e);}(_0xce49,0x132));var _0x9ce4=function(_0x4d6524,_0x4fc9f2){_0x4d6524=_0x4d6524-0x0;var _0x19122c=_0xce49[_0x4d6524];return _0x19122c;};'use strict';var express=require('express');var router=express[_0x9ce4('0x0')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router['get']('/',controller['index']);router['get']('/fetch',auth[_0x9ce4('0x1')](),auth['canUpdate'](),controller['fetch']);router[_0x9ce4('0x2')](_0x9ce4('0x3'),auth[_0x9ce4('0x1')](),auth[_0x9ce4('0x4')](),controller[_0x9ce4('0x5')]);router[_0x9ce4('0x2')](_0x9ce4('0x6'),auth['isAuthenticated'](),auth[_0x9ce4('0x4')](),controller[_0x9ce4('0x7')]);router[_0x9ce4('0x2')](_0x9ce4('0x8'),auth[_0x9ce4('0x1')](),controller[_0x9ce4('0x9')]);router[_0x9ce4('0x2')](_0x9ce4('0xa'),controller['migrations']);module[_0x9ce4('0xb')]=router; \ No newline at end of file +var _0x8558=['pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate'];(function(_0x211a8f,_0x1dc64b){var _0x2a3a6b=function(_0x19b901){while(--_0x19b901){_0x211a8f['push'](_0x211a8f['shift']());}};_0x2a3a6b(++_0x1dc64b);}(_0x8558,0x1c5));var _0x8855=function(_0x1ac27b,_0x50f711){_0x1ac27b=_0x1ac27b-0x0;var _0x1a4920=_0x8558[_0x1ac27b];return _0x1a4920;};'use strict';var express=require(_0x8855('0x0'));var router=express[_0x8855('0x1')]();var auth=require(_0x8855('0x2'));var controller=require(_0x8855('0x3'));router[_0x8855('0x4')]('/',controller[_0x8855('0x5')]);router[_0x8855('0x4')](_0x8855('0x6'),auth[_0x8855('0x7')](),auth['canUpdate'](),controller[_0x8855('0x8')]);router[_0x8855('0x4')](_0x8855('0x9'),auth[_0x8855('0x7')](),auth[_0x8855('0xa')](),controller['reset']);router[_0x8855('0x4')]('/pull',auth[_0x8855('0x7')](),auth[_0x8855('0xa')](),controller[_0x8855('0xb')]);router[_0x8855('0x4')]('/restart',auth[_0x8855('0x7')](),controller[_0x8855('0xc')]);router[_0x8855('0x4')](_0x8855('0xd'),controller[_0x8855('0xe')]);module[_0x8855('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index c6ac46a..0672971 100644 --- a/server/api/version/version.controller.js +++ b/server/api/version/version.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c8e=['../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','length','.js','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','catch','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','../../mysqldb','../../config/environment'];(function(_0x50c9ef,_0x1341d7){var _0x319f50=function(_0x147cb9){while(--_0x147cb9){_0x50c9ef['push'](_0x50c9ef['shift']());}};_0x319f50(++_0x1341d7);}(_0x3c8e,0x89));var _0xe3c8=function(_0x16f321,_0x11686e){_0x16f321=_0x16f321-0x0;var _0x4232b9=_0x3c8e[_0x16f321];return _0x4232b9;};'use strict';var Umzug=require(_0xe3c8('0x0'));var path=require(_0xe3c8('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xe3c8('0x2'));var compareVersions=require(_0xe3c8('0x3'));var exec=require(_0xe3c8('0x4'))['exec'];var db=require(_0xe3c8('0x5'))['db'];var config=require(_0xe3c8('0x6'));var pm2=require(_0xe3c8('0x7'));var logger=require(_0xe3c8('0x8'))('update');var git=require(_0xe3c8('0x9'))(config[_0xe3c8('0xa')]);exports[_0xe3c8('0xb')]=function(_0x222f26,_0xf4387f){var _0x5f3375={'current':module[_0xe3c8('0xc')]['version'],'phonebar':0x2};if(_0x222f26[_0xe3c8('0xd')]&&_0x222f26[_0xe3c8('0xd')][_0xe3c8('0xe')]){return git[_0xe3c8('0xf')]()['tags'](function(_0x2eb76d,_0x216f2a){_0x5f3375[_0xe3c8('0xe')]=(_0x2eb76d?module['exports'][_0xe3c8('0x2')]:_0x216f2a['latest'])||_0xe3c8('0x10');return _0xf4387f['status'](0xc8)['json'](_0x5f3375);});}else{return _0xf4387f[_0xe3c8('0x11')](0xc8)[_0xe3c8('0x12')](_0x5f3375);}};exports[_0xe3c8('0xf')]=function(_0x530317,_0x41b01b){return git[_0xe3c8('0xf')]([_0xe3c8('0x13'),_0xe3c8('0x14')],function(_0x369b2a){if(_0x369b2a){logger[_0xe3c8('0x15')](_0x369b2a);return _0x41b01b['status'](0x1f4)[_0xe3c8('0x12')](_0x369b2a);}logger[_0xe3c8('0x16')]('git\x20fetch');return _0x41b01b[_0xe3c8('0x11')](0xc8)[_0xe3c8('0x12')]({'output':_0xe3c8('0x17')});});};exports['reset']=function(_0x2196f2,_0x1dc06e){return git[_0xe3c8('0x18')]([_0xe3c8('0x19'),_0xe3c8('0x1a')],function(_0x1136d1){if(_0x1136d1){logger[_0xe3c8('0x15')](_0x1136d1);return _0x1dc06e['status'](0x1f4)[_0xe3c8('0x12')](_0x1136d1);}logger[_0xe3c8('0x16')](_0xe3c8('0x1b'));return _0x1dc06e[_0xe3c8('0x11')](0xc8)[_0xe3c8('0x12')]({'output':_0xe3c8('0x1c')});});};exports['pull']=function(_0x1010a3,_0x175205){exec('npm\x20install\x20--production',function(_0x35f730,_0x44bf1d,_0x5396ea){logger[_0xe3c8('0x16')](_0x44bf1d);logger[_0xe3c8('0x16')](_0x5396ea);if(_0x35f730){logger['error'](_0x35f730);return _0x175205[_0xe3c8('0x11')](0x1f4)[_0xe3c8('0x12')](_0x35f730);}return _0x175205[_0xe3c8('0x11')](0xc8)[_0xe3c8('0x12')]({'output':_0x44bf1d});});};exports[_0xe3c8('0x1d')]=function(_0x4ddae1,_0x1665c6){return pm2['restart']('motion2')['then'](function(_0xf2f111){logger['info'](_0xe3c8('0x1e'),_0xf2f111);return _0x1665c6[_0xe3c8('0x11')](0xc8)['json']({'output':_0xe3c8('0x1f')});})['catch'](function(_0x2941c2){logger[_0xe3c8('0x15')](_0x2941c2);return _0x1665c6[_0xe3c8('0x11')](0x1f4)[_0xe3c8('0x12')](_0x2941c2);});};exports[_0xe3c8('0x20')]=function(_0x182d57,_0x9d9e45){var _0x497448=fs['readdirSync'](path[_0xe3c8('0x21')](config[_0xe3c8('0xa')],_0xe3c8('0x22'),'migrations'));var _0x28cc46=[];for(var _0x266399=0x0;_0x266399<_0x497448[_0xe3c8('0x23')];_0x266399++){var _0x1d5da7=_0x497448[_0x266399]['replace'](_0xe3c8('0x24'),'');if(compareVersions(module['exports'][_0xe3c8('0x2')],_0x1d5da7)===-0x1){_0x28cc46[_0xe3c8('0x25')](_0x1d5da7);}}if(_0x28cc46[_0xe3c8('0x23')]){var _0x3aceb7=_0x28cc46['sort'](compareVersions);var _0x2dbaa3=new Umzug({'storage':_0xe3c8('0x26'),'storageOptions':{'model':db[_0xe3c8('0x27')],'modelName':'Migration','columnName':_0xe3c8('0x2')},'migrations':{'params':[db[_0xe3c8('0x26')][_0xe3c8('0x28')](),db[_0xe3c8('0x26')][_0xe3c8('0x29')],function(){throw new Error(_0xe3c8('0x2a'));}],'path':path['join'](config[_0xe3c8('0xa')],'server',_0xe3c8('0x20')),'pattern':/\.js$/}});_0x2dbaa3['up']({'migrations':_[_0xe3c8('0x2b')](_0x3aceb7,function(_0x1e9912){return _0x1e9912+_0xe3c8('0x24');})})[_0xe3c8('0x2c')](function(){return _0x9d9e45[_0xe3c8('0x11')](0xc8)[_0xe3c8('0x12')]({'output':_0xe3c8('0x2d')+module['exports'][_0xe3c8('0x2')]+'\x20to\x20'+_['last'](_0x3aceb7),'migrations':_[_0xe3c8('0x21')](_0x3aceb7)});})[_0xe3c8('0x2e')](function(_0x27f5ba){if(_0x27f5ba instanceof db[_0xe3c8('0x26')]['UniqueConstraintError']){return _0x9d9e45[_0xe3c8('0x11')](0xc8)['json']({'output':_0xe3c8('0x2f')});}else{return _0x9d9e45[_0xe3c8('0x11')](0x1f4)[_0xe3c8('0x12')](_0x27f5ba);}});}else{return _0x9d9e45[_0xe3c8('0x11')](0xc8)[_0xe3c8('0x12')]({'output':_0xe3c8('0x2f')});}}; \ No newline at end of file +var _0xb4b6=['2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','npm\x20install\x20--production','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','server','migrations','.js','push','length','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','sequelize','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','exports','query','latest','fetch','tags'];(function(_0x5e3147,_0x4bcdad){var _0x2a8609=function(_0x536fd2){while(--_0x536fd2){_0x5e3147['push'](_0x5e3147['shift']());}};_0x2a8609(++_0x4bcdad);}(_0xb4b6,0x7e));var _0x6b4b=function(_0xd9a3dd,_0x391f20){_0xd9a3dd=_0xd9a3dd-0x0;var _0x203c67=_0xb4b6[_0xd9a3dd];return _0x203c67;};'use strict';var Umzug=require('umzug');var path=require(_0x6b4b('0x0'));var fs=require('fs');var _=require(_0x6b4b('0x1'));var pkginfo=require(_0x6b4b('0x2'))(module,_0x6b4b('0x3'));var compareVersions=require(_0x6b4b('0x4'));var exec=require(_0x6b4b('0x5'))[_0x6b4b('0x6')];var db=require(_0x6b4b('0x7'))['db'];var config=require(_0x6b4b('0x8'));var pm2=require('../../config/pm2');var logger=require(_0x6b4b('0x9'))('update');var git=require(_0x6b4b('0xa'))(config[_0x6b4b('0xb')]);exports[_0x6b4b('0xc')]=function(_0x127577,_0x2e6b81){var _0x572b2d={'current':module[_0x6b4b('0xd')][_0x6b4b('0x3')],'phonebar':0x2};if(_0x127577[_0x6b4b('0xe')]&&_0x127577[_0x6b4b('0xe')][_0x6b4b('0xf')]){return git[_0x6b4b('0x10')]()[_0x6b4b('0x11')](function(_0x214ebb,_0x54b8b6){_0x572b2d[_0x6b4b('0xf')]=(_0x214ebb?module['exports'][_0x6b4b('0x3')]:_0x54b8b6[_0x6b4b('0xf')])||_0x6b4b('0x12');return _0x2e6b81[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')](_0x572b2d);});}else{return _0x2e6b81[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')](_0x572b2d);}};exports['fetch']=function(_0x38c40f,_0x2acc64){return git[_0x6b4b('0x10')](['origin','master'],function(_0x39390c){if(_0x39390c){logger[_0x6b4b('0x15')](_0x39390c);return _0x2acc64['status'](0x1f4)[_0x6b4b('0x14')](_0x39390c);}logger[_0x6b4b('0x16')](_0x6b4b('0x17'));return _0x2acc64[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')]({'output':_0x6b4b('0x18')});});};exports[_0x6b4b('0x19')]=function(_0xc3e02c,_0x15333b){return git['reset'](['--hard',_0x6b4b('0x1a')],function(_0x5b37ce){if(_0x5b37ce){logger[_0x6b4b('0x15')](_0x5b37ce);return _0x15333b[_0x6b4b('0x13')](0x1f4)[_0x6b4b('0x14')](_0x5b37ce);}logger[_0x6b4b('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x15333b[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x5ec8a9,_0x4735eb){exec(_0x6b4b('0x1b'),function(_0x203f2a,_0x222e23,_0x1a9fba){logger['info'](_0x222e23);logger[_0x6b4b('0x16')](_0x1a9fba);if(_0x203f2a){logger[_0x6b4b('0x15')](_0x203f2a);return _0x4735eb[_0x6b4b('0x13')](0x1f4)[_0x6b4b('0x14')](_0x203f2a);}return _0x4735eb['status'](0xc8)['json']({'output':_0x222e23});});};exports['restart']=function(_0x4c4ecc,_0x17f017){return pm2['restart']('motion2')[_0x6b4b('0x1c')](function(_0x2cbe79){logger[_0x6b4b('0x16')](_0x6b4b('0x1d'),_0x2cbe79);return _0x17f017['status'](0xc8)['json']({'output':_0x6b4b('0x1e')});})[_0x6b4b('0x1f')](function(_0x2973f){logger[_0x6b4b('0x15')](_0x2973f);return _0x17f017['status'](0x1f4)[_0x6b4b('0x14')](_0x2973f);});};exports['migrations']=function(_0x1c2f42,_0x1ab47c){var _0x334cf8=fs['readdirSync'](path[_0x6b4b('0x20')](config[_0x6b4b('0xb')],_0x6b4b('0x21'),_0x6b4b('0x22')));var _0x102305=[];for(var _0x1ab7de=0x0;_0x1ab7de<_0x334cf8['length'];_0x1ab7de++){var _0x509a54=_0x334cf8[_0x1ab7de]['replace'](_0x6b4b('0x23'),'');if(compareVersions(module[_0x6b4b('0xd')][_0x6b4b('0x3')],_0x509a54)===-0x1){_0x102305[_0x6b4b('0x24')](_0x509a54);}}if(_0x102305[_0x6b4b('0x25')]){var _0x44788f=_0x102305['sort'](compareVersions);var _0x5798b3=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x6b4b('0x26')],'modelName':'Migration','columnName':_0x6b4b('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x6b4b('0x27')],function(){throw new Error(_0x6b4b('0x28'));}],'path':path[_0x6b4b('0x20')](config[_0x6b4b('0xb')],_0x6b4b('0x21'),'migrations'),'pattern':/\.js$/}});_0x5798b3['up']({'migrations':_[_0x6b4b('0x29')](_0x44788f,function(_0x5c5efb){return _0x5c5efb+_0x6b4b('0x23');})})['then'](function(){return _0x1ab47c[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')]({'output':_0x6b4b('0x2a')+module['exports'][_0x6b4b('0x3')]+_0x6b4b('0x2b')+_[_0x6b4b('0x2c')](_0x44788f),'migrations':_['join'](_0x44788f)});})['catch'](function(_0x1d27a3){if(_0x1d27a3 instanceof db[_0x6b4b('0x2d')][_0x6b4b('0x2e')]){return _0x1ab47c[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')]({'output':_0x6b4b('0x2f')});}else{return _0x1ab47c['status'](0x1f4)[_0x6b4b('0x14')](_0x1d27a3);}});}else{return _0x1ab47c['status'](0xc8)[_0x6b4b('0x14')]({'output':_0x6b4b('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index cac2423..8375c3f 100644 --- a/server/api/voiceAgentReport/index.js +++ b/server/api/voiceAgentReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a9d=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x328b1c,_0xec0b4f){var _0x4dbeaa=function(_0x432519){while(--_0x432519){_0x328b1c['push'](_0x328b1c['shift']());}};_0x4dbeaa(++_0xec0b4f);}(_0x9a9d,0x174));var _0xd9a9=function(_0x5739b7,_0x56e665){_0x5739b7=_0x5739b7-0x0;var _0x2e1f02=_0x9a9d[_0x5739b7];return _0x2e1f02;};'use strict';var multer=require(_0xd9a9('0x0'));var util=require('util');var path=require(_0xd9a9('0x1'));var timeout=require(_0xd9a9('0x2'));var express=require(_0xd9a9('0x3'));var router=express['Router']();var auth=require(_0xd9a9('0x4'));var interaction=require(_0xd9a9('0x5'));var config=require(_0xd9a9('0x6'));var controller=require(_0xd9a9('0x7'));router[_0xd9a9('0x8')]('/',auth[_0xd9a9('0x9')](),controller[_0xd9a9('0xa')]);router[_0xd9a9('0x8')](_0xd9a9('0xb'),auth[_0xd9a9('0x9')](),controller[_0xd9a9('0xc')]);router['get'](_0xd9a9('0xd'),auth['isAuthenticated'](),controller[_0xd9a9('0xe')]);router['post']('/',auth[_0xd9a9('0x9')](),controller[_0xd9a9('0xf')]);router[_0xd9a9('0x10')](_0xd9a9('0xd'),auth[_0xd9a9('0x9')](),controller[_0xd9a9('0x11')]);router[_0xd9a9('0x12')](_0xd9a9('0xd'),auth[_0xd9a9('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4d22=['get','isAuthenticated','index','describe','/:id','show','post','put','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x499193,_0x5a6272){var _0x5e3dcc=function(_0x27afbc){while(--_0x27afbc){_0x499193['push'](_0x499193['shift']());}};_0x5e3dcc(++_0x5a6272);}(_0x4d22,0x7a));var _0x24d2=function(_0x24d70e,_0x78c804){_0x24d70e=_0x24d70e-0x0;var _0xc9176d=_0x4d22[_0x24d70e];return _0xc9176d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x24d2('0x0'));var timeout=require(_0x24d2('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x24d2('0x2'));var interaction=require(_0x24d2('0x3'));var config=require(_0x24d2('0x4'));var controller=require(_0x24d2('0x5'));router[_0x24d2('0x6')]('/',auth[_0x24d2('0x7')](),controller[_0x24d2('0x8')]);router[_0x24d2('0x6')]('/describe',auth[_0x24d2('0x7')](),controller[_0x24d2('0x9')]);router['get'](_0x24d2('0xa'),auth[_0x24d2('0x7')](),controller[_0x24d2('0xb')]);router[_0x24d2('0xc')]('/',auth[_0x24d2('0x7')](),controller['create']);router[_0x24d2('0xd')]('/:id',auth[_0x24d2('0x7')](),controller['update']);router['delete'](_0x24d2('0xa'),auth['isAuthenticated'](),controller[_0x24d2('0xe')]);module[_0x24d2('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 3b04467..06154ae 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x2f25de,_0x356d8e){var _0x1212a1=function(_0x16cd33){while(--_0x16cd33){_0x2f25de['push'](_0x2f25de['shift']());}};_0x1212a1(++_0x356d8e);}(_0x326f,0xd1));var _0xf326=function(_0x4d2365,_0x4aad8a){_0x4d2365=_0x4d2365-0x0;var _0x1ea0db=_0x326f[_0x4d2365];return _0x1ea0db;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf326('0x1')]},'calleridnum':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'queue':{'type':Sequelize[_0xf326('0x1')]},'interface':{'type':Sequelize[_0xf326('0x1')]},'membername':{'type':Sequelize[_0xf326('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf326('0x2')]},'agentconnectAt':{'type':Sequelize[_0xf326('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xf326('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xf326('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xf326('0x3')]},'agentcomplete':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf326('0x1')]},'lastevent':{'type':Sequelize[_0xf326('0x1')]},'channel':{'type':Sequelize[_0xf326('0x1')]},'channelstate':{'type':Sequelize[_0xf326('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf326('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf326('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf326('0x1')]},'destchannelstate':{'type':Sequelize[_0xf326('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf326('0x1')]},'destcalleridname':{'type':Sequelize[_0xf326('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf326('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf326('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xf326('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf326('0x1')]},'destuniqueid':{'type':Sequelize[_0xf326('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf326('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xf326('0x1')]},'transfer':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf326('0x1')],'comment':_0xf326('0x5')},'transferexten':{'type':Sequelize[_0xf326('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xf326('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x038b=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x182b14,_0x856d25){var _0x41db1f=function(_0x2f346b){while(--_0x2f346b){_0x182b14['push'](_0x182b14['shift']());}};_0x41db1f(++_0x856d25);}(_0x038b,0x114));var _0xb038=function(_0x580816,_0x48f227){_0x580816=_0x580816-0x0;var _0x344250=_0x038b[_0x580816];return _0x344250;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'type':{'type':Sequelize[_0xb038('0x1')]},'uniqueid':{'type':Sequelize[_0xb038('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb038('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb038('0x1')]},'membername':{'type':Sequelize[_0xb038('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb038('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xb038('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb038('0x3')]},'agentcomplete':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb038('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb038('0x1')]},'channelstate':{'type':Sequelize[_0xb038('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb038('0x1')]},'connectedlinename':{'type':Sequelize[_0xb038('0x1')]},'language':{'type':Sequelize[_0xb038('0x1')]},'accountcode':{'type':Sequelize[_0xb038('0x1')]},'context':{'type':Sequelize[_0xb038('0x1')]},'exten':{'type':Sequelize[_0xb038('0x1')]},'priority':{'type':Sequelize[_0xb038('0x1')]},'destchannel':{'type':Sequelize[_0xb038('0x1')]},'destchannelstate':{'type':Sequelize[_0xb038('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb038('0x1')]},'destcalleridnum':{'type':Sequelize[_0xb038('0x1')]},'destcalleridname':{'type':Sequelize[_0xb038('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb038('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb038('0x1')]},'destlanguage':{'type':Sequelize[_0xb038('0x1')]},'destaccountcode':{'type':Sequelize[_0xb038('0x1')]},'destcontext':{'type':Sequelize[_0xb038('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb038('0x1')]},'destuniqueid':{'type':Sequelize[_0xb038('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb038('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xb038('0x1')]},'transfer':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb038('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xb038('0x1')]},'transferuniqueid':{'type':Sequelize[_0xb038('0x1')]},'agententerreason':{'type':Sequelize[_0xb038('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index c76cbe0..4045036 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb9c=['includeAll','merge','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','apply','save','update','then','destroy','name','send','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','limit','order','sort','filters','pick','where','VIRTUAL','filter','count','include','findAll','rows','catch','params'];(function(_0x272c6d,_0x400f14){var _0x559103=function(_0x49512a){while(--_0x49512a){_0x272c6d['push'](_0x272c6d['shift']());}};_0x559103(++_0x400f14);}(_0xfb9c,0x1a4));var _0xcfb9=function(_0x5b2809,_0x48b226){_0x5b2809=_0x5b2809-0x0;var _0x572dee=_0xfb9c[_0x5b2809];return _0x572dee;};'use strict';var pdf=require(_0xcfb9('0x0'));var emlformat=require(_0xcfb9('0x1'));var rimraf=require(_0xcfb9('0x2'));var zipdir=require(_0xcfb9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfb9('0x4'));var moment=require(_0xcfb9('0x5'));var BPromise=require(_0xcfb9('0x6'));var Mustache=require('mustache');var util=require(_0xcfb9('0x7'));var path=require(_0xcfb9('0x8'));var sox=require(_0xcfb9('0x9'));var csv=require('to-csv');var ejs=require(_0xcfb9('0xa'));var fs=require('fs');var _=require(_0xcfb9('0xb'));var squel=require(_0xcfb9('0xc'));var crypto=require(_0xcfb9('0xd'));var jsforce=require(_0xcfb9('0xe'));var deskjs=require(_0xcfb9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcfb9('0x10'));var Papa=require(_0xcfb9('0x11'));var Redis=require('ioredis');var authService=require(_0xcfb9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcfb9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfb9('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xcfb9('0x15'));var licenseUtil=require(_0xcfb9('0x16'));var db=require(_0xcfb9('0x17'))['db'];function respondWithStatusCode(_0x39b937,_0x2e52d6){_0x2e52d6=_0x2e52d6||0xcc;return function(_0x303add){if(_0x303add){return _0x39b937[_0xcfb9('0x18')](_0x2e52d6);}return _0x39b937[_0xcfb9('0x19')](_0x2e52d6)[_0xcfb9('0x1a')]();};}function respondWithResult(_0x189540,_0x3387b7){_0x3387b7=_0x3387b7||0xc8;return function(_0x280b21){if(_0x280b21){return _0x189540[_0xcfb9('0x19')](_0x3387b7)[_0xcfb9('0x1b')](_0x280b21);}};}function respondWithFilteredResult(_0xc9588d,_0xf9a29d){return function(_0x5e5dd5){if(_0x5e5dd5){var _0x1551e0=_0x5e5dd5['count'],_0x5dc343=_0xf9a29d[_0xcfb9('0x1c')],_0x317396=_0xf9a29d['offset']+_0xf9a29d['limit'],_0x278701;if(_0x317396>=_0x1551e0){_0x317396=_0x1551e0;_0x278701=0xc8;}else{_0x278701=0xce;}_0xc9588d[_0xcfb9('0x19')](_0x278701);return _0xc9588d[_0xcfb9('0x1d')]('Content-Range',_0x5dc343+'-'+_0x317396+'/'+_0x1551e0)[_0xcfb9('0x1b')](_0x5e5dd5);}return null;};}function patchUpdates(_0x8ca9ac){return function(_0x4a761c){try{jsonpatch[_0xcfb9('0x1e')](_0x4a761c,_0x8ca9ac,!![]);}catch(_0x463bd8){return BPromise['reject'](_0x463bd8);}return _0x4a761c[_0xcfb9('0x1f')]();};}function saveUpdates(_0x3e8f2a,_0x115172){return function(_0xb75b64){if(_0xb75b64){return _0xb75b64[_0xcfb9('0x20')](_0x3e8f2a)[_0xcfb9('0x21')](function(_0x5d2269){return _0x5d2269;});}return null;};}function removeEntity(_0x22732a,_0x104560){return function(_0x1043dd){if(_0x1043dd){return _0x1043dd[_0xcfb9('0x22')]()[_0xcfb9('0x21')](function(){_0x22732a['status'](0xcc)[_0xcfb9('0x1a')]();});}};}function handleEntityNotFound(_0x3f8e23,_0x46e7df){return function(_0x34e588){if(!_0x34e588){_0x3f8e23['sendStatus'](0x194);}return _0x34e588;};}function handleError(_0x366cf6,_0x271a01){_0x271a01=_0x271a01||0x1f4;return function(_0x53a4c7){logger['error'](_0x53a4c7['stack']);if(_0x53a4c7[_0xcfb9('0x23')]){delete _0x53a4c7[_0xcfb9('0x23')];}_0x366cf6[_0xcfb9('0x19')](_0x271a01)[_0xcfb9('0x24')](_0x53a4c7);};}exports['index']=function(_0x354a20,_0x1e7028){var _0x15c82f={},_0x2d399b={},_0x70d03f={'count':0x0,'rows':[]};var _0x546094=_[_0xcfb9('0x25')](db[_0xcfb9('0x26')][_0xcfb9('0x27')],function(_0x3d929b){return{'name':_0x3d929b[_0xcfb9('0x28')],'type':_0x3d929b[_0xcfb9('0x29')][_0xcfb9('0x2a')]};});_0x2d399b[_0xcfb9('0x2b')]=_['map'](_0x546094,'name');_0x2d399b[_0xcfb9('0x2c')]=_[_0xcfb9('0x2d')](_0x354a20[_0xcfb9('0x2c')]);_0x2d399b['filters']=_[_0xcfb9('0x2e')](_0x2d399b[_0xcfb9('0x2b')],_0x2d399b[_0xcfb9('0x2c')]);_0x15c82f[_0xcfb9('0x2f')]=_['intersection'](_0x2d399b[_0xcfb9('0x2b')],qs[_0xcfb9('0x30')](_0x354a20['query'][_0xcfb9('0x30')]));_0x15c82f[_0xcfb9('0x2f')]=_0x15c82f[_0xcfb9('0x2f')]['length']?_0x15c82f[_0xcfb9('0x2f')]:_0x2d399b[_0xcfb9('0x2b')];if(!_0x354a20[_0xcfb9('0x2c')]['hasOwnProperty']('nolimit')){_0x15c82f['limit']=qs['limit'](_0x354a20[_0xcfb9('0x2c')][_0xcfb9('0x31')]);_0x15c82f[_0xcfb9('0x1c')]=qs['offset'](_0x354a20[_0xcfb9('0x2c')][_0xcfb9('0x1c')]);}_0x15c82f[_0xcfb9('0x32')]=qs[_0xcfb9('0x33')](_0x354a20[_0xcfb9('0x2c')][_0xcfb9('0x33')]);_0x15c82f['where']=qs[_0xcfb9('0x34')](_[_0xcfb9('0x35')](_0x354a20[_0xcfb9('0x2c')],_0x2d399b[_0xcfb9('0x34')]),_0x546094);if(_0x354a20[_0xcfb9('0x2c')]['filter']){_0x15c82f[_0xcfb9('0x36')]=_['merge'](_0x15c82f[_0xcfb9('0x36')],{'$or':_[_0xcfb9('0x25')](_0x546094,function(_0x4424ab){if(_0x4424ab[_0xcfb9('0x29')]!==_0xcfb9('0x37')){var _0x49ddb1={};_0x49ddb1[_0x4424ab[_0xcfb9('0x23')]]={'$like':'%'+_0x354a20[_0xcfb9('0x2c')][_0xcfb9('0x38')]+'%'};return _0x49ddb1;}})});}_0x15c82f=_['merge']({},_0x15c82f,_0x354a20['options']);var _0x186ede={'where':_0x15c82f[_0xcfb9('0x36')]};return db[_0xcfb9('0x26')][_0xcfb9('0x39')](_0x186ede)['then'](function(_0x1df9cb){_0x70d03f[_0xcfb9('0x39')]=_0x1df9cb;if(_0x354a20[_0xcfb9('0x2c')]['includeAll']){_0x15c82f[_0xcfb9('0x3a')]=[{'all':!![]}];}return db[_0xcfb9('0x26')][_0xcfb9('0x3b')](_0x15c82f);})[_0xcfb9('0x21')](function(_0x548554){_0x70d03f[_0xcfb9('0x3c')]=_0x548554;return _0x70d03f;})[_0xcfb9('0x21')](respondWithFilteredResult(_0x1e7028,_0x15c82f))[_0xcfb9('0x3d')](handleError(_0x1e7028,null));};exports['show']=function(_0x2d4961,_0x385989){var _0x160105={'raw':![],'where':{'id':_0x2d4961[_0xcfb9('0x3e')]['id']}},_0x40a284={};_0x40a284[_0xcfb9('0x2b')]=_[_0xcfb9('0x2d')](db['VoiceAgentReport']['rawAttributes']);_0x40a284[_0xcfb9('0x2c')]=_[_0xcfb9('0x2d')](_0x2d4961['query']);_0x40a284[_0xcfb9('0x34')]=_['intersection'](_0x40a284['model'],_0x40a284['query']);_0x160105[_0xcfb9('0x2f')]=_['intersection'](_0x40a284[_0xcfb9('0x2b')],qs[_0xcfb9('0x30')](_0x2d4961['query'][_0xcfb9('0x30')]));_0x160105['attributes']=_0x160105[_0xcfb9('0x2f')]['length']?_0x160105['attributes']:_0x40a284[_0xcfb9('0x2b')];if(_0x2d4961[_0xcfb9('0x2c')][_0xcfb9('0x3f')]){_0x160105[_0xcfb9('0x3a')]=[{'all':!![]}];}_0x160105=_[_0xcfb9('0x40')]({},_0x160105,_0x2d4961['options']);return db[_0xcfb9('0x26')][_0xcfb9('0x41')](_0x160105)[_0xcfb9('0x21')](handleEntityNotFound(_0x385989,null))['then'](respondWithResult(_0x385989,null))[_0xcfb9('0x3d')](handleError(_0x385989,null));};exports[_0xcfb9('0x42')]=function(_0x1fa5b8,_0x33f9ff){return db[_0xcfb9('0x26')]['create'](_0x1fa5b8['body'],{})['then'](respondWithResult(_0x33f9ff,0xc9))['catch'](handleError(_0x33f9ff,null));};exports[_0xcfb9('0x20')]=function(_0x1d1aae,_0x8be1c6){if(_0x1d1aae['body']['id']){delete _0x1d1aae[_0xcfb9('0x43')]['id'];}return db[_0xcfb9('0x26')][_0xcfb9('0x41')]({'where':{'id':_0x1d1aae[_0xcfb9('0x3e')]['id']}})[_0xcfb9('0x21')](handleEntityNotFound(_0x8be1c6,null))[_0xcfb9('0x21')](saveUpdates(_0x1d1aae[_0xcfb9('0x43')],null))[_0xcfb9('0x21')](respondWithResult(_0x8be1c6,null))[_0xcfb9('0x3d')](handleError(_0x8be1c6,null));};exports[_0xcfb9('0x22')]=function(_0x42d011,_0x4bce7e){return db[_0xcfb9('0x26')][_0xcfb9('0x41')]({'where':{'id':_0x42d011[_0xcfb9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4bce7e,null))['then'](removeEntity(_0x4bce7e,null))['catch'](handleError(_0x4bce7e,null));};exports[_0xcfb9('0x44')]=function(_0x5d73db,_0x134e7d){return db['VoiceAgentReport'][_0xcfb9('0x44')]()[_0xcfb9('0x21')](respondWithResult(_0x134e7d,null))[_0xcfb9('0x3d')](handleError(_0x134e7d,null));}; \ No newline at end of file +var _0xd5c3=['offset','limit','set','Content-Range','apply','save','then','destroy','name','send','index','map','VoiceAgentReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','catch','show','params','rawAttributes','include','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x265971,_0x41453e){var _0x4a6d7a=function(_0x2a2925){while(--_0x2a2925){_0x265971['push'](_0x265971['shift']());}};_0x4a6d7a(++_0x41453e);}(_0xd5c3,0x1a7));var _0x3d5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5c3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3d5c('0x0'));var emlformat=require(_0x3d5c('0x1'));var rimraf=require(_0x3d5c('0x2'));var zipdir=require(_0x3d5c('0x3'));var jsonpatch=require(_0x3d5c('0x4'));var rp=require(_0x3d5c('0x5'));var moment=require(_0x3d5c('0x6'));var BPromise=require(_0x3d5c('0x7'));var Mustache=require('mustache');var util=require(_0x3d5c('0x8'));var path=require(_0x3d5c('0x9'));var sox=require(_0x3d5c('0xa'));var csv=require(_0x3d5c('0xb'));var ejs=require(_0x3d5c('0xc'));var fs=require('fs');var _=require(_0x3d5c('0xd'));var squel=require(_0x3d5c('0xe'));var crypto=require(_0x3d5c('0xf'));var jsforce=require(_0x3d5c('0x10'));var deskjs=require(_0x3d5c('0x11'));var toCsv=require(_0x3d5c('0xb'));var querystring=require(_0x3d5c('0x12'));var Papa=require('papaparse');var Redis=require(_0x3d5c('0x13'));var authService=require(_0x3d5c('0x14'));var qs=require(_0x3d5c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d5c('0x16'));var logger=require(_0x3d5c('0x17'))(_0x3d5c('0x18'));var utils=require('../../config/utils');var config=require(_0x3d5c('0x19'));var licenseUtil=require(_0x3d5c('0x1a'));var db=require(_0x3d5c('0x1b'))['db'];function respondWithStatusCode(_0x62fb81,_0x5f036f){_0x5f036f=_0x5f036f||0xcc;return function(_0x5d5489){if(_0x5d5489){return _0x62fb81[_0x3d5c('0x1c')](_0x5f036f);}return _0x62fb81[_0x3d5c('0x1d')](_0x5f036f)[_0x3d5c('0x1e')]();};}function respondWithResult(_0x21b618,_0x4f249c){_0x4f249c=_0x4f249c||0xc8;return function(_0x21a8c6){if(_0x21a8c6){return _0x21b618[_0x3d5c('0x1d')](_0x4f249c)[_0x3d5c('0x1f')](_0x21a8c6);}};}function respondWithFilteredResult(_0x51ffd7,_0x57e517){return function(_0x545f15){if(_0x545f15){var _0x2fa8bc=_0x545f15[_0x3d5c('0x20')],_0x151e91=_0x57e517[_0x3d5c('0x21')],_0x53fbaf=_0x57e517['offset']+_0x57e517[_0x3d5c('0x22')],_0x1ae9bd;if(_0x53fbaf>=_0x2fa8bc){_0x53fbaf=_0x2fa8bc;_0x1ae9bd=0xc8;}else{_0x1ae9bd=0xce;}_0x51ffd7['status'](_0x1ae9bd);return _0x51ffd7[_0x3d5c('0x23')](_0x3d5c('0x24'),_0x151e91+'-'+_0x53fbaf+'/'+_0x2fa8bc)[_0x3d5c('0x1f')](_0x545f15);}return null;};}function patchUpdates(_0x58153b){return function(_0xe54507){try{jsonpatch[_0x3d5c('0x25')](_0xe54507,_0x58153b,!![]);}catch(_0x52544d){return BPromise['reject'](_0x52544d);}return _0xe54507[_0x3d5c('0x26')]();};}function saveUpdates(_0x12ff88,_0x5a9d58){return function(_0x19a8ac){if(_0x19a8ac){return _0x19a8ac['update'](_0x12ff88)[_0x3d5c('0x27')](function(_0x1e6a08){return _0x1e6a08;});}return null;};}function removeEntity(_0x7f9893,_0x16947b){return function(_0xe15403){if(_0xe15403){return _0xe15403[_0x3d5c('0x28')]()[_0x3d5c('0x27')](function(){_0x7f9893['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb9cf,_0x27e988){return function(_0x3cb582){if(!_0x3cb582){_0x2eb9cf[_0x3d5c('0x1c')](0x194);}return _0x3cb582;};}function handleError(_0x484ae3,_0x23b33e){_0x23b33e=_0x23b33e||0x1f4;return function(_0x9d5752){logger['error'](_0x9d5752['stack']);if(_0x9d5752[_0x3d5c('0x29')]){delete _0x9d5752['name'];}_0x484ae3['status'](_0x23b33e)[_0x3d5c('0x2a')](_0x9d5752);};}exports[_0x3d5c('0x2b')]=function(_0x37e83e,_0x5956c3){var _0x2d6e7a={},_0x426fd1={},_0x5d3991={'count':0x0,'rows':[]};var _0x45f664=_[_0x3d5c('0x2c')](db[_0x3d5c('0x2d')]['rawAttributes'],function(_0x1c63b7){return{'name':_0x1c63b7['fieldName'],'type':_0x1c63b7[_0x3d5c('0x2e')][_0x3d5c('0x2f')]};});_0x426fd1[_0x3d5c('0x30')]=_[_0x3d5c('0x2c')](_0x45f664,'name');_0x426fd1[_0x3d5c('0x31')]=_[_0x3d5c('0x32')](_0x37e83e['query']);_0x426fd1[_0x3d5c('0x33')]=_[_0x3d5c('0x34')](_0x426fd1[_0x3d5c('0x30')],_0x426fd1[_0x3d5c('0x31')]);_0x2d6e7a[_0x3d5c('0x35')]=_[_0x3d5c('0x34')](_0x426fd1['model'],qs[_0x3d5c('0x36')](_0x37e83e[_0x3d5c('0x31')][_0x3d5c('0x36')]));_0x2d6e7a[_0x3d5c('0x35')]=_0x2d6e7a[_0x3d5c('0x35')][_0x3d5c('0x37')]?_0x2d6e7a['attributes']:_0x426fd1[_0x3d5c('0x30')];if(!_0x37e83e['query'][_0x3d5c('0x38')](_0x3d5c('0x39'))){_0x2d6e7a['limit']=qs[_0x3d5c('0x22')](_0x37e83e[_0x3d5c('0x31')][_0x3d5c('0x22')]);_0x2d6e7a[_0x3d5c('0x21')]=qs[_0x3d5c('0x21')](_0x37e83e[_0x3d5c('0x31')][_0x3d5c('0x21')]);}_0x2d6e7a[_0x3d5c('0x3a')]=qs[_0x3d5c('0x3b')](_0x37e83e[_0x3d5c('0x31')][_0x3d5c('0x3b')]);_0x2d6e7a[_0x3d5c('0x3c')]=qs[_0x3d5c('0x33')](_[_0x3d5c('0x3d')](_0x37e83e[_0x3d5c('0x31')],_0x426fd1[_0x3d5c('0x33')]),_0x45f664);if(_0x37e83e['query']['filter']){_0x2d6e7a[_0x3d5c('0x3c')]=_[_0x3d5c('0x3e')](_0x2d6e7a[_0x3d5c('0x3c')],{'$or':_[_0x3d5c('0x2c')](_0x45f664,function(_0x248b30){if(_0x248b30[_0x3d5c('0x2e')]!==_0x3d5c('0x3f')){var _0x599531={};_0x599531[_0x248b30[_0x3d5c('0x29')]]={'$like':'%'+_0x37e83e['query'][_0x3d5c('0x40')]+'%'};return _0x599531;}})});}_0x2d6e7a=_[_0x3d5c('0x3e')]({},_0x2d6e7a,_0x37e83e[_0x3d5c('0x41')]);var _0x3cee66={'where':_0x2d6e7a['where']};return db[_0x3d5c('0x2d')]['count'](_0x3cee66)[_0x3d5c('0x27')](function(_0x560fc4){_0x5d3991[_0x3d5c('0x20')]=_0x560fc4;if(_0x37e83e['query'][_0x3d5c('0x42')]){_0x2d6e7a['include']=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x2d6e7a);})[_0x3d5c('0x27')](function(_0x224a0c){_0x5d3991['rows']=_0x224a0c;return _0x5d3991;})[_0x3d5c('0x27')](respondWithFilteredResult(_0x5956c3,_0x2d6e7a))[_0x3d5c('0x43')](handleError(_0x5956c3,null));};exports[_0x3d5c('0x44')]=function(_0x4beb19,_0x5ae524){var _0x3fe5a8={'raw':![],'where':{'id':_0x4beb19[_0x3d5c('0x45')]['id']}},_0x2baddf={};_0x2baddf['model']=_[_0x3d5c('0x32')](db[_0x3d5c('0x2d')][_0x3d5c('0x46')]);_0x2baddf[_0x3d5c('0x31')]=_[_0x3d5c('0x32')](_0x4beb19[_0x3d5c('0x31')]);_0x2baddf[_0x3d5c('0x33')]=_[_0x3d5c('0x34')](_0x2baddf[_0x3d5c('0x30')],_0x2baddf[_0x3d5c('0x31')]);_0x3fe5a8['attributes']=_[_0x3d5c('0x34')](_0x2baddf[_0x3d5c('0x30')],qs[_0x3d5c('0x36')](_0x4beb19['query'][_0x3d5c('0x36')]));_0x3fe5a8[_0x3d5c('0x35')]=_0x3fe5a8['attributes'][_0x3d5c('0x37')]?_0x3fe5a8['attributes']:_0x2baddf['model'];if(_0x4beb19['query'][_0x3d5c('0x42')]){_0x3fe5a8[_0x3d5c('0x47')]=[{'all':!![]}];}_0x3fe5a8=_[_0x3d5c('0x3e')]({},_0x3fe5a8,_0x4beb19[_0x3d5c('0x41')]);return db['VoiceAgentReport']['find'](_0x3fe5a8)['then'](handleEntityNotFound(_0x5ae524,null))[_0x3d5c('0x27')](respondWithResult(_0x5ae524,null))[_0x3d5c('0x43')](handleError(_0x5ae524,null));};exports[_0x3d5c('0x48')]=function(_0x4171e0,_0x3139d4){return db['VoiceAgentReport']['create'](_0x4171e0['body'],{})['then'](respondWithResult(_0x3139d4,0xc9))[_0x3d5c('0x43')](handleError(_0x3139d4,null));};exports['update']=function(_0xa84d8e,_0x4dfae6){if(_0xa84d8e[_0x3d5c('0x49')]['id']){delete _0xa84d8e[_0x3d5c('0x49')]['id'];}return db[_0x3d5c('0x2d')]['find']({'where':{'id':_0xa84d8e[_0x3d5c('0x45')]['id']}})[_0x3d5c('0x27')](handleEntityNotFound(_0x4dfae6,null))[_0x3d5c('0x27')](saveUpdates(_0xa84d8e[_0x3d5c('0x49')],null))[_0x3d5c('0x27')](respondWithResult(_0x4dfae6,null))['catch'](handleError(_0x4dfae6,null));};exports[_0x3d5c('0x28')]=function(_0x11f77e,_0x5264d1){return db[_0x3d5c('0x2d')][_0x3d5c('0x4a')]({'where':{'id':_0x11f77e[_0x3d5c('0x45')]['id']}})[_0x3d5c('0x27')](handleEntityNotFound(_0x5264d1,null))['then'](removeEntity(_0x5264d1,null))['catch'](handleError(_0x5264d1,null));};exports[_0x3d5c('0x4b')]=function(_0x140477,_0x156fe4){return db[_0x3d5c('0x2d')]['describe']()[_0x3d5c('0x27')](respondWithResult(_0x156fe4,null))[_0x3d5c('0x43')](handleError(_0x156fe4,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 96ff955..c20055e 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x865e=['exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x332986,_0x592c39){var _0x3720c5=function(_0x2c3f5a){while(--_0x2c3f5a){_0x332986['push'](_0x332986['shift']());}};_0x3720c5(++_0x592c39);}(_0x865e,0x6d));var _0xe865=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x865e[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0xe865('0x0'));var util=require(_0xe865('0x1'));var logger=require(_0xe865('0x2'))('api');var moment=require(_0xe865('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe865('0x4'));var rimraf=require(_0xe865('0x5'));var config=require(_0xe865('0x6'));var attributes=require(_0xe865('0x7'));module[_0xe865('0x8')]=function(_0x520712,_0x2ce819){return _0x520712[_0xe865('0x9')](_0xe865('0xa'),attributes,{'tableName':_0xe865('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xe865('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ea2=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x40ae09,_0x5a2214){var _0x4e573f=function(_0x511b56){while(--_0x511b56){_0x40ae09['push'](_0x40ae09['shift']());}};_0x4e573f(++_0x5a2214);}(_0x3ea2,0x1d4));var _0x23ea=function(_0x3e2d49,_0x29b1ea){_0x3e2d49=_0x3e2d49-0x0;var _0x47f51b=_0x3ea2[_0x3e2d49];return _0x47f51b;};'use strict';var _=require(_0x23ea('0x0'));var util=require(_0x23ea('0x1'));var logger=require(_0x23ea('0x2'))(_0x23ea('0x3'));var moment=require('moment');var BPromise=require(_0x23ea('0x4'));var rp=require(_0x23ea('0x5'));var fs=require('fs');var path=require(_0x23ea('0x6'));var rimraf=require(_0x23ea('0x7'));var config=require('../../config/environment');var attributes=require(_0x23ea('0x8'));module[_0x23ea('0x9')]=function(_0x26936e,_0x3f291c){return _0x26936e[_0x23ea('0xa')](_0x23ea('0xb'),attributes,{'tableName':_0x23ea('0xc'),'paranoid':![],'indexes':[{'fields':[_0x23ea('0xd'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 7dee33a..82eb9e2 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.rpc.js +++ b/server/api/voiceAgentReport/voiceAgentReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f38=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7f38,0x73));var _0x87f3=function(_0x59cbc9,_0x5d1411){_0x59cbc9=_0x59cbc9-0x0;var _0x489c72=_0x7f38[_0x59cbc9];return _0x489c72;};'use strict';var _=require(_0x87f3('0x0'));var util=require(_0x87f3('0x1'));var moment=require(_0x87f3('0x2'));var BPromise=require(_0x87f3('0x3'));var rs=require(_0x87f3('0x4'));var fs=require('fs');var Redis=require(_0x87f3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x87f3('0x6'));var logger=require(_0x87f3('0x7'))(_0x87f3('0x8'));var config=require(_0x87f3('0x9'));var jayson=require(_0x87f3('0xa'));var client=jayson['client'][_0x87f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10f798,_0x398c98,_0x312fc0){return new BPromise(function(_0x13c13c,_0x3ad56d){return client[_0x87f3('0xc')](_0x10f798,_0x312fc0)[_0x87f3('0xd')](function(_0x41a27e){logger[_0x87f3('0xe')](_0x87f3('0xf'),_0x398c98,_0x87f3('0x10'));logger[_0x87f3('0x11')](_0x87f3('0x12'),_0x398c98,'request\x20sent',JSON[_0x87f3('0x13')](_0x41a27e));if(_0x41a27e[_0x87f3('0x14')]){if(_0x41a27e[_0x87f3('0x14')][_0x87f3('0x15')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x398c98,_0x41a27e['error'][_0x87f3('0x16')]);return _0x3ad56d(_0x41a27e[_0x87f3('0x14')][_0x87f3('0x16')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x398c98,_0x41a27e[_0x87f3('0x14')][_0x87f3('0x16')]);return _0x13c13c(_0x41a27e['error'][_0x87f3('0x16')]);}else{logger[_0x87f3('0xe')](_0x87f3('0xf'),_0x398c98,_0x87f3('0x10'));_0x13c13c(_0x41a27e['result'][_0x87f3('0x16')]);}})['catch'](function(_0x3e7cfa){logger[_0x87f3('0x14')](_0x87f3('0xf'),_0x398c98,_0x3e7cfa);_0x3ad56d(_0x3e7cfa);});});}exports[_0x87f3('0x17')]=function(_0x10ca99){var _0x498da5=this;return new Promise(function(_0x3b9bd8,_0x585a82){return db[_0x87f3('0x18')][_0x87f3('0x19')](_0x10ca99[_0x87f3('0x1a')],{'raw':_0x10ca99[_0x87f3('0x1b')]?_0x10ca99['options'][_0x87f3('0x1c')]===undefined?!![]:![]:!![]})[_0x87f3('0xd')](function(_0x419557){logger[_0x87f3('0xe')](_0x87f3('0x17'),_0x10ca99);logger['debug'](_0x87f3('0x17'),_0x10ca99,JSON[_0x87f3('0x13')](_0x419557));_0x3b9bd8(_0x419557);})[_0x87f3('0x1d')](function(_0x3486eb){logger[_0x87f3('0x14')]('CreateVoiceAgentReport',_0x3486eb['message'],_0x10ca99);_0x585a82(_0x498da5[_0x87f3('0x14')](0x1f4,_0x3486eb[_0x87f3('0x16')]));});});};exports[_0x87f3('0x1e')]=function(_0x1befd8){var _0x2b2547=this;return new Promise(function(_0x469b6e,_0x3aa810){return db[_0x87f3('0x18')]['update'](_0x1befd8[_0x87f3('0x1a')],{'raw':_0x1befd8[_0x87f3('0x1b')]?_0x1befd8['options'][_0x87f3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1befd8['options']?_0x1befd8[_0x87f3('0x1b')][_0x87f3('0x1f')]||null:null,'attributes':_0x1befd8['options']?_0x1befd8['options'][_0x87f3('0x20')]||null:null,'limit':_0x1befd8[_0x87f3('0x1b')]?_0x1befd8[_0x87f3('0x1b')]['limit']||null:null})[_0x87f3('0xd')](function(_0x3c20cb){logger[_0x87f3('0xe')]('UpdateVoiceAgentReport',_0x1befd8);logger[_0x87f3('0x11')]('UpdateVoiceAgentReport',_0x1befd8,JSON[_0x87f3('0x13')](_0x3c20cb));_0x469b6e(_0x3c20cb);})[_0x87f3('0x1d')](function(_0x524a63){logger[_0x87f3('0x14')]('UpdateVoiceAgentReport',_0x524a63[_0x87f3('0x16')],_0x1befd8);_0x3aa810(_0x2b2547[_0x87f3('0x14')](0x1f4,_0x524a63[_0x87f3('0x16')]));});});}; \ No newline at end of file +var _0x40d1=['catch','VoiceAgentReport','attributes','limit','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceAgentReport','create','options'];(function(_0x5c14b0,_0x7cee8c){var _0x3c1a44=function(_0x41a7f1){while(--_0x41a7f1){_0x5c14b0['push'](_0x5c14b0['shift']());}};_0x3c1a44(++_0x7cee8c);}(_0x40d1,0x1c5));var _0x140d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x40d1[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x140d('0x0'));var util=require(_0x140d('0x1'));var moment=require('moment');var BPromise=require(_0x140d('0x2'));var rs=require(_0x140d('0x3'));var fs=require('fs');var Redis=require(_0x140d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x140d('0x5'));var config=require(_0x140d('0x6'));var jayson=require(_0x140d('0x7'));var client=jayson['client'][_0x140d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11cd54,_0x3423d6,_0x1d0c72){return new BPromise(function(_0x1fa766,_0x352ddc){return client[_0x140d('0x9')](_0x11cd54,_0x1d0c72)[_0x140d('0xa')](function(_0x282fc8){logger[_0x140d('0xb')](_0x140d('0xc'),_0x3423d6,_0x140d('0xd'));logger[_0x140d('0xe')](_0x140d('0xf'),_0x3423d6,'request\x20sent',JSON[_0x140d('0x10')](_0x282fc8));if(_0x282fc8[_0x140d('0x11')]){if(_0x282fc8[_0x140d('0x11')][_0x140d('0x12')]===0x1f4){logger['error'](_0x140d('0xc'),_0x3423d6,_0x282fc8[_0x140d('0x11')][_0x140d('0x13')]);return _0x352ddc(_0x282fc8[_0x140d('0x11')][_0x140d('0x13')]);}logger[_0x140d('0x11')](_0x140d('0xc'),_0x3423d6,_0x282fc8[_0x140d('0x11')][_0x140d('0x13')]);return _0x1fa766(_0x282fc8[_0x140d('0x11')]['message']);}else{logger[_0x140d('0xb')](_0x140d('0xc'),_0x3423d6,_0x140d('0xd'));_0x1fa766(_0x282fc8['result']['message']);}})['catch'](function(_0x313d8f){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x3423d6,_0x313d8f);_0x352ddc(_0x313d8f);});});}exports[_0x140d('0x14')]=function(_0x5063b5){var _0x4b00f6=this;return new Promise(function(_0x576545,_0x969650){return db['VoiceAgentReport'][_0x140d('0x15')](_0x5063b5['body'],{'raw':_0x5063b5[_0x140d('0x16')]?_0x5063b5['options']['raw']===undefined?!![]:![]:!![]})[_0x140d('0xa')](function(_0x4796a6){logger[_0x140d('0xb')](_0x140d('0x14'),_0x5063b5);logger['debug']('CreateVoiceAgentReport',_0x5063b5,JSON['stringify'](_0x4796a6));_0x576545(_0x4796a6);})[_0x140d('0x17')](function(_0x522428){logger[_0x140d('0x11')](_0x140d('0x14'),_0x522428[_0x140d('0x13')],_0x5063b5);_0x969650(_0x4b00f6[_0x140d('0x11')](0x1f4,_0x522428[_0x140d('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x2111fa){var _0x386c5b=this;return new Promise(function(_0x184456,_0x2139f3){return db[_0x140d('0x18')]['update'](_0x2111fa['body'],{'raw':_0x2111fa['options']?_0x2111fa[_0x140d('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2111fa['options']?_0x2111fa[_0x140d('0x16')]['where']||null:null,'attributes':_0x2111fa[_0x140d('0x16')]?_0x2111fa[_0x140d('0x16')][_0x140d('0x19')]||null:null,'limit':_0x2111fa['options']?_0x2111fa[_0x140d('0x16')][_0x140d('0x1a')]||null:null})['then'](function(_0x58cfe3){logger[_0x140d('0xb')](_0x140d('0x1b'),_0x2111fa);logger[_0x140d('0xe')](_0x140d('0x1b'),_0x2111fa,JSON[_0x140d('0x10')](_0x58cfe3));_0x184456(_0x58cfe3);})[_0x140d('0x17')](function(_0x3954cb){logger[_0x140d('0x11')](_0x140d('0x1b'),_0x3954cb[_0x140d('0x13')],_0x2111fa);_0x2139f3(_0x386c5b[_0x140d('0x11')](0x1f4,_0x3954cb['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8c24897..d75f33e 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbeea=['./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x442d6c,_0x28266c){var _0x1497c9=function(_0x248eb9){while(--_0x248eb9){_0x442d6c['push'](_0x442d6c['shift']());}};_0x1497c9(++_0x28266c);}(_0xbeea,0x1b1));var _0xabee=function(_0x398436,_0x11da31){_0x398436=_0x398436-0x0;var _0x2d454c=_0xbeea[_0x398436];return _0x2d454c;};'use strict';var multer=require(_0xabee('0x0'));var util=require(_0xabee('0x1'));var path=require(_0xabee('0x2'));var timeout=require(_0xabee('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xabee('0x4'));var interaction=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var controller=require(_0xabee('0x7'));router[_0xabee('0x8')]('/',auth['isAuthenticated'](),controller[_0xabee('0x9')]);router[_0xabee('0x8')](_0xabee('0xa'),auth[_0xabee('0xb')](),controller['describe']);router['get'](_0xabee('0xc'),auth[_0xabee('0xb')](),controller[_0xabee('0xd')]);router[_0xabee('0xe')]('/',auth[_0xabee('0xb')](),controller['create']);router[_0xabee('0xf')](_0xabee('0xc'),auth[_0xabee('0xb')](),controller[_0xabee('0x10')]);router[_0xabee('0x11')](_0xabee('0xc'),auth['isAuthenticated'](),controller[_0xabee('0x12')]);module[_0xabee('0x13')]=router; \ No newline at end of file +var _0x225b=['destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','post','put','update','delete'];(function(_0x5c6b3d,_0x20fa0f){var _0x5572f8=function(_0x2cdfda){while(--_0x2cdfda){_0x5c6b3d['push'](_0x5c6b3d['shift']());}};_0x5572f8(++_0x20fa0f);}(_0x225b,0x161));var _0xb225=function(_0x54e6fc,_0x51ec5d){_0x54e6fc=_0x54e6fc-0x0;var _0x2b513d=_0x225b[_0x54e6fc];return _0x2b513d;};'use strict';var multer=require(_0xb225('0x0'));var util=require('util');var path=require(_0xb225('0x1'));var timeout=require(_0xb225('0x2'));var express=require(_0xb225('0x3'));var router=express['Router']();var auth=require(_0xb225('0x4'));var interaction=require(_0xb225('0x5'));var config=require(_0xb225('0x6'));var controller=require('./voiceCallReport.controller');router[_0xb225('0x7')]('/',auth['isAuthenticated'](),controller[_0xb225('0x8')]);router[_0xb225('0x7')](_0xb225('0x9'),auth[_0xb225('0xa')](),controller['describe']);router[_0xb225('0x7')]('/:id',auth[_0xb225('0xa')](),controller['show']);router[_0xb225('0xb')]('/',auth[_0xb225('0xa')](),controller['create']);router[_0xb225('0xc')]('/:id',auth[_0xb225('0xa')](),controller[_0xb225('0xd')]);router[_0xb225('0xe')]('/:id',auth[_0xb225('0xa')](),controller[_0xb225('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index df663e6..32e204e 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x885a=['STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','exports'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x885a,0x180));var _0xa885=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x885a[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require('sequelize');module[_0xa885('0x0')]={'uniqueid':{'type':Sequelize[_0xa885('0x1')]},'type':{'type':Sequelize[_0xa885('0x2')](_0xa885('0x3'),'internal',_0xa885('0x4'),_0xa885('0x5'),_0xa885('0x6'),_0xa885('0x7'))},'tag':{'type':Sequelize[_0xa885('0x1')]},'accountcode':{'type':Sequelize[_0xa885('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xa885('0x1')]},'destinationcontext':{'type':Sequelize[_0xa885('0x1')]},'callerid':{'type':Sequelize[_0xa885('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xa885('0x1')]},'lastapplication':{'type':Sequelize[_0xa885('0x1')]},'lastdata':{'type':Sequelize[_0xa885('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xa885('0x9')]},'answertime':{'type':Sequelize[_0xa885('0x9')]},'endtime':{'type':Sequelize[_0xa885('0x9')]},'duration':{'type':Sequelize[_0xa885('0xa')]},'billableseconds':{'type':Sequelize[_0xa885('0xa')]},'mohtime':{'type':Sequelize[_0xa885('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa885('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xa885('0x1')]},'userDisposition':{'type':Sequelize[_0xa885('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xa885('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xa885('0x1')]},'note':{'type':Sequelize[_0xa885('0x1')]},'prefix':{'type':Sequelize[_0xa885('0x1')]},'routeid':{'type':Sequelize[_0xa885('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c6c=['TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer'];(function(_0x8a565b,_0x49df9f){var _0x231c1d=function(_0x1e51c8){while(--_0x1e51c8){_0x8a565b['push'](_0x8a565b['shift']());}};_0x231c1d(++_0x49df9f);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x230d86,_0x343420){_0x230d86=_0x230d86-0x0;var _0x41aab9=_0x3c6c[_0x230d86];return _0x41aab9;};'use strict';var Sequelize=require(_0xc3c6('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc3c6('0x1')]},'type':{'type':Sequelize[_0xc3c6('0x2')](_0xc3c6('0x3'),_0xc3c6('0x4'),_0xc3c6('0x5'),_0xc3c6('0x6'),_0xc3c6('0x7'),_0xc3c6('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc3c6('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xc3c6('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc3c6('0x9')]},'starttime':{'type':Sequelize[_0xc3c6('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc3c6('0xa')]},'endtime':{'type':Sequelize[_0xc3c6('0xa')]},'duration':{'type':Sequelize[_0xc3c6('0xb')]},'billableseconds':{'type':Sequelize[_0xc3c6('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc3c6('0x1')]},'amaflags':{'type':Sequelize[_0xc3c6('0x1')]},'userfield':{'type':Sequelize[_0xc3c6('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc3c6('0x1')]},'note':{'type':Sequelize[_0xc3c6('0x1')]},'prefix':{'type':Sequelize[_0xc3c6('0x1')]},'routeid':{'type':Sequelize[_0xc3c6('0xb')]},'sipcallid':{'type':Sequelize[_0xc3c6('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ef95108..a323818 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index d90c499..f856d28 100644 --- a/server/api/voiceCallReport/voiceCallReport.model.js +++ b/server/api/voiceCallReport/voiceCallReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb6a=['request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x249aa8,_0x3b3146){var _0x4ea34=function(_0x5faa4e){while(--_0x5faa4e){_0x249aa8['push'](_0x249aa8['shift']());}};_0x4ea34(++_0x3b3146);}(_0xdb6a,0x192));var _0xadb6=function(_0x52a6e8,_0x16240d){_0x52a6e8=_0x52a6e8-0x0;var _0x28a198=_0xdb6a[_0x52a6e8];return _0x28a198;};'use strict';var _=require(_0xadb6('0x0'));var util=require(_0xadb6('0x1'));var logger=require(_0xadb6('0x2'))(_0xadb6('0x3'));var moment=require(_0xadb6('0x4'));var BPromise=require(_0xadb6('0x5'));var rp=require(_0xadb6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadb6('0x7'));var config=require(_0xadb6('0x8'));var attributes=require(_0xadb6('0x9'));module['exports']=function(_0x55bbd3,_0x465ea3){return _0x55bbd3['define'](_0xadb6('0xa'),attributes,{'tableName':_0xadb6('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x540f=['exports','define','VoiceCallReport','uniqueid','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0xec84e,_0x3a4944){var _0x21b7f9=function(_0x36abc8){while(--_0x36abc8){_0xec84e['push'](_0xec84e['shift']());}};_0x21b7f9(++_0x3a4944);}(_0x540f,0x190));var _0xf540=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x540f[_0x49052b];return _0x48c045;};'use strict';var _=require('lodash');var util=require(_0xf540('0x0'));var logger=require(_0xf540('0x1'))(_0xf540('0x2'));var moment=require(_0xf540('0x3'));var BPromise=require(_0xf540('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf540('0x5'));var config=require(_0xf540('0x6'));var attributes=require(_0xf540('0x7'));module[_0xf540('0x8')]=function(_0x222066,_0x17d583){return _0x222066[_0xf540('0x9')](_0xf540('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xf540('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b06d1fa..81dde56 100644 --- a/server/api/voiceCallReport/voiceCallReport.rpc.js +++ b/server/api/voiceCallReport/voiceCallReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1edd=['raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1edd,0xd9));var _0xd1ed=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x1edd[_0x5b34c0];return _0x242bd3;};'use strict';var _=require(_0xd1ed('0x0'));var util=require(_0xd1ed('0x1'));var moment=require(_0xd1ed('0x2'));var BPromise=require(_0xd1ed('0x3'));var rs=require(_0xd1ed('0x4'));var fs=require('fs');var Redis=require(_0xd1ed('0x5'));var db=require(_0xd1ed('0x6'))['db'];var utils=require(_0xd1ed('0x7'));var logger=require(_0xd1ed('0x8'))('rpc');var config=require(_0xd1ed('0x9'));var jayson=require(_0xd1ed('0xa'));var client=jayson[_0xd1ed('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36e091,_0x21b925,_0x532c33){return new BPromise(function(_0xcd406d,_0x4b3482){return client[_0xd1ed('0xc')](_0x36e091,_0x532c33)[_0xd1ed('0xd')](function(_0x1fd6b1){logger[_0xd1ed('0xe')](_0xd1ed('0xf'),_0x21b925,_0xd1ed('0x10'));logger[_0xd1ed('0x11')](_0xd1ed('0x12'),_0x21b925,'request\x20sent',JSON[_0xd1ed('0x13')](_0x1fd6b1));if(_0x1fd6b1[_0xd1ed('0x14')]){if(_0x1fd6b1['error'][_0xd1ed('0x15')]===0x1f4){logger['error'](_0xd1ed('0xf'),_0x21b925,_0x1fd6b1[_0xd1ed('0x14')][_0xd1ed('0x16')]);return _0x4b3482(_0x1fd6b1[_0xd1ed('0x14')][_0xd1ed('0x16')]);}logger[_0xd1ed('0x14')](_0xd1ed('0xf'),_0x21b925,_0x1fd6b1[_0xd1ed('0x14')][_0xd1ed('0x16')]);return _0xcd406d(_0x1fd6b1[_0xd1ed('0x14')][_0xd1ed('0x16')]);}else{logger['info'](_0xd1ed('0xf'),_0x21b925,_0xd1ed('0x10'));_0xcd406d(_0x1fd6b1[_0xd1ed('0x17')][_0xd1ed('0x16')]);}})[_0xd1ed('0x18')](function(_0x3bd91b){logger[_0xd1ed('0x14')](_0xd1ed('0xf'),_0x21b925,_0x3bd91b);_0x4b3482(_0x3bd91b);});});}exports[_0xd1ed('0x19')]=function(_0x1fea2f){var _0xcc1b5e=this;return new Promise(function(_0x2e8ae9,_0x1a2df2){return db[_0xd1ed('0x1a')][_0xd1ed('0x1b')]({'raw':_0x1fea2f[_0xd1ed('0x1c')]?_0x1fea2f[_0xd1ed('0x1c')][_0xd1ed('0x1d')]===undefined?!![]:![]:!![],'where':_0x1fea2f[_0xd1ed('0x1c')]?_0x1fea2f[_0xd1ed('0x1c')][_0xd1ed('0x1e')]||null:null,'attributes':_0x1fea2f[_0xd1ed('0x1c')]?_0x1fea2f[_0xd1ed('0x1c')][_0xd1ed('0x1f')]||null:null,'limit':_0x1fea2f[_0xd1ed('0x1c')]?_0x1fea2f['options'][_0xd1ed('0x20')]||null:null,'include':_0x1fea2f[_0xd1ed('0x1c')]?_0x1fea2f[_0xd1ed('0x1c')][_0xd1ed('0x21')]?_[_0xd1ed('0x22')](_0x1fea2f[_0xd1ed('0x1c')][_0xd1ed('0x21')],function(_0x1c4f65){return{'model':db[_0x1c4f65['model']],'as':_0x1c4f65['as'],'attributes':_0x1c4f65['attributes'],'include':_0x1c4f65[_0xd1ed('0x21')]?_[_0xd1ed('0x22')](_0x1c4f65[_0xd1ed('0x21')],function(_0x2c85c5){return{'model':db[_0x2c85c5['model']],'as':_0x2c85c5['as'],'attributes':_0x2c85c5['attributes'],'include':_0x2c85c5[_0xd1ed('0x21')]?_['map'](_0x2c85c5[_0xd1ed('0x21')],function(_0x1edc53){return{'model':db[_0x1edc53[_0xd1ed('0x23')]],'as':_0x1edc53['as'],'attributes':_0x1edc53['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1ed('0xd')](function(_0x10a423){logger[_0xd1ed('0xe')]('GetVoiceCallReport',_0x1fea2f);logger[_0xd1ed('0x11')](_0xd1ed('0x19'),_0x1fea2f,JSON[_0xd1ed('0x13')](_0x10a423));_0x2e8ae9(_0x10a423);})[_0xd1ed('0x18')](function(_0xfd9ff0){logger[_0xd1ed('0x14')](_0xd1ed('0x19'),_0xfd9ff0['message'],_0x1fea2f);_0x1a2df2(_0xcc1b5e[_0xd1ed('0x14')](0x1f4,_0xfd9ff0[_0xd1ed('0x16')]));});});};exports[_0xd1ed('0x24')]=function(_0x3fba2e){var _0x2e69d8=this;return new Promise(function(_0x3c737d,_0x56b31c){return db[_0xd1ed('0x1a')][_0xd1ed('0x25')](_0x3fba2e[_0xd1ed('0x26')],{'raw':_0x3fba2e[_0xd1ed('0x1c')]?_0x3fba2e['options'][_0xd1ed('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x21b72e){logger[_0xd1ed('0xe')](_0xd1ed('0x24'),_0x3fba2e);logger[_0xd1ed('0x11')](_0xd1ed('0x24'),_0x3fba2e,JSON[_0xd1ed('0x13')](_0x21b72e));_0x3c737d(_0x21b72e);})['catch'](function(_0x2a4edc){logger[_0xd1ed('0x14')](_0xd1ed('0x24'),_0x2a4edc[_0xd1ed('0x16')],_0x3fba2e);_0x56b31c(_0x2e69d8[_0xd1ed('0x14')](0x1f4,_0x2a4edc[_0xd1ed('0x16')]));});});};exports[_0xd1ed('0x27')]=function(_0x52109b){var _0x80046f=this;return new Promise(function(_0x2746db,_0x4d15c1){return db[_0xd1ed('0x1a')][_0xd1ed('0x28')](_0x52109b[_0xd1ed('0x26')],{'raw':_0x52109b[_0xd1ed('0x1c')]?_0x52109b['options'][_0xd1ed('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52109b[_0xd1ed('0x1c')]?_0x52109b['options']['where']||null:null,'attributes':_0x52109b[_0xd1ed('0x1c')]?_0x52109b[_0xd1ed('0x1c')][_0xd1ed('0x1f')]||null:null,'limit':_0x52109b['options']?_0x52109b['options'][_0xd1ed('0x20')]||null:null})[_0xd1ed('0xd')](function(_0x29f718){logger['info'](_0xd1ed('0x27'),_0x52109b);logger[_0xd1ed('0x11')](_0xd1ed('0x27'),_0x52109b,JSON[_0xd1ed('0x13')](_0x29f718));_0x2746db(_0x29f718);})[_0xd1ed('0x18')](function(_0x1389c5){logger[_0xd1ed('0x14')](_0xd1ed('0x27'),_0x1389c5[_0xd1ed('0x16')],_0x52109b);_0x4d15c1(_0x80046f[_0xd1ed('0x14')](0x1f4,_0x1389c5['message']));});});}; \ No newline at end of file +var _0xdc6b=['http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','include','attributes','map','model','info','stringify','CreateVoiceCallReport','raw','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x18d19c,_0xb389f8){var _0xbc6fb4=function(_0x3a9427){while(--_0x3a9427){_0x18d19c['push'](_0x18d19c['shift']());}};_0xbc6fb4(++_0xb389f8);}(_0xdc6b,0x132));var _0xbdc6=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0xdc6b[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0xbdc6('0x0'));var util=require(_0xbdc6('0x1'));var moment=require(_0xbdc6('0x2'));var BPromise=require(_0xbdc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdc6('0x4'));var db=require(_0xbdc6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdc6('0x6'))('rpc');var config=require(_0xbdc6('0x7'));var jayson=require(_0xbdc6('0x8'));var client=jayson['client'][_0xbdc6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a0f51,_0x34dd1,_0x438232){return new BPromise(function(_0x47150d,_0x475c35){return client[_0xbdc6('0xa')](_0x2a0f51,_0x438232)[_0xbdc6('0xb')](function(_0x3ed2ef){logger['info'](_0xbdc6('0xc'),_0x34dd1,'request\x20sent');logger[_0xbdc6('0xd')](_0xbdc6('0xe'),_0x34dd1,'request\x20sent',JSON['stringify'](_0x3ed2ef));if(_0x3ed2ef['error']){if(_0x3ed2ef[_0xbdc6('0xf')]['code']===0x1f4){logger['error'](_0xbdc6('0xc'),_0x34dd1,_0x3ed2ef[_0xbdc6('0xf')][_0xbdc6('0x10')]);return _0x475c35(_0x3ed2ef[_0xbdc6('0xf')]['message']);}logger[_0xbdc6('0xf')](_0xbdc6('0xc'),_0x34dd1,_0x3ed2ef[_0xbdc6('0xf')][_0xbdc6('0x10')]);return _0x47150d(_0x3ed2ef['error'][_0xbdc6('0x10')]);}else{logger['info'](_0xbdc6('0xc'),_0x34dd1,'request\x20sent');_0x47150d(_0x3ed2ef[_0xbdc6('0x11')][_0xbdc6('0x10')]);}})[_0xbdc6('0x12')](function(_0x53dce4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x34dd1,_0x53dce4);_0x475c35(_0x53dce4);});});}exports[_0xbdc6('0x13')]=function(_0x38d180){var _0x5eebc3=this;return new Promise(function(_0x1389b9,_0x3553a7){return db[_0xbdc6('0x14')][_0xbdc6('0x15')]({'raw':_0x38d180[_0xbdc6('0x16')]?_0x38d180[_0xbdc6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x38d180['options']?_0x38d180[_0xbdc6('0x16')][_0xbdc6('0x17')]||null:null,'attributes':_0x38d180['options']?_0x38d180[_0xbdc6('0x16')]['attributes']||null:null,'limit':_0x38d180[_0xbdc6('0x16')]?_0x38d180[_0xbdc6('0x16')][_0xbdc6('0x18')]||null:null,'include':_0x38d180[_0xbdc6('0x16')]?_0x38d180[_0xbdc6('0x16')][_0xbdc6('0x19')]?_['map'](_0x38d180[_0xbdc6('0x16')]['include'],function(_0x29a8d0){return{'model':db[_0x29a8d0['model']],'as':_0x29a8d0['as'],'attributes':_0x29a8d0[_0xbdc6('0x1a')],'include':_0x29a8d0[_0xbdc6('0x19')]?_[_0xbdc6('0x1b')](_0x29a8d0[_0xbdc6('0x19')],function(_0x5f38d6){return{'model':db[_0x5f38d6[_0xbdc6('0x1c')]],'as':_0x5f38d6['as'],'attributes':_0x5f38d6['attributes'],'include':_0x5f38d6['include']?_[_0xbdc6('0x1b')](_0x5f38d6[_0xbdc6('0x19')],function(_0x70ffbe){return{'model':db[_0x70ffbe[_0xbdc6('0x1c')]],'as':_0x70ffbe['as'],'attributes':_0x70ffbe['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdc6('0xb')](function(_0x5ab06d){logger[_0xbdc6('0x1d')](_0xbdc6('0x13'),_0x38d180);logger['debug'](_0xbdc6('0x13'),_0x38d180,JSON[_0xbdc6('0x1e')](_0x5ab06d));_0x1389b9(_0x5ab06d);})[_0xbdc6('0x12')](function(_0x3e46c3){logger[_0xbdc6('0xf')](_0xbdc6('0x13'),_0x3e46c3[_0xbdc6('0x10')],_0x38d180);_0x3553a7(_0x5eebc3[_0xbdc6('0xf')](0x1f4,_0x3e46c3[_0xbdc6('0x10')]));});});};exports[_0xbdc6('0x1f')]=function(_0x3f379e){var _0x513ae4=this;return new Promise(function(_0x5c4cac,_0x4af5b2){return db[_0xbdc6('0x14')]['create'](_0x3f379e['body'],{'raw':_0x3f379e['options']?_0x3f379e[_0xbdc6('0x16')][_0xbdc6('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1e36e3){logger[_0xbdc6('0x1d')](_0xbdc6('0x1f'),_0x3f379e);logger['debug']('CreateVoiceCallReport',_0x3f379e,JSON['stringify'](_0x1e36e3));_0x5c4cac(_0x1e36e3);})['catch'](function(_0x4ef1a6){logger['error']('CreateVoiceCallReport',_0x4ef1a6[_0xbdc6('0x10')],_0x3f379e);_0x4af5b2(_0x513ae4[_0xbdc6('0xf')](0x1f4,_0x4ef1a6['message']));});});};exports['UpdateVoiceCallReport']=function(_0x881013){var _0x464e8f=this;return new Promise(function(_0x1bd6e0,_0x20dae6){return db[_0xbdc6('0x14')][_0xbdc6('0x21')](_0x881013['body'],{'raw':_0x881013[_0xbdc6('0x16')]?_0x881013[_0xbdc6('0x16')][_0xbdc6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x881013[_0xbdc6('0x16')]?_0x881013[_0xbdc6('0x16')][_0xbdc6('0x17')]||null:null,'attributes':_0x881013[_0xbdc6('0x16')]?_0x881013[_0xbdc6('0x16')][_0xbdc6('0x1a')]||null:null,'limit':_0x881013[_0xbdc6('0x16')]?_0x881013[_0xbdc6('0x16')][_0xbdc6('0x18')]||null:null})['then'](function(_0x19c588){logger[_0xbdc6('0x1d')](_0xbdc6('0x22'),_0x881013);logger['debug']('UpdateVoiceCallReport',_0x881013,JSON[_0xbdc6('0x1e')](_0x19c588));_0x1bd6e0(_0x19c588);})[_0xbdc6('0x12')](function(_0x135287){logger['error']('UpdateVoiceCallReport',_0x135287[_0xbdc6('0x10')],_0x881013);_0x20dae6(_0x464e8f[_0xbdc6('0xf')](0x1f4,_0x135287['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9f3376f..2c37088 100644 --- a/server/api/voiceChanSpy/index.js +++ b/server/api/voiceChanSpy/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1447=['delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','./voiceChanSpy.controller','index','get','/:id','isAuthenticated','show','post','put'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1447,0xd3));var _0x7144=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1447[_0x4e676e];return _0x336a3c;};'use strict';var multer=require('multer');var util=require(_0x7144('0x0'));var path=require('path');var timeout=require(_0x7144('0x1'));var express=require(_0x7144('0x2'));var router=express[_0x7144('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7144('0x4'));var config=require('../../config/environment');var controller=require(_0x7144('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x7144('0x6')]);router[_0x7144('0x7')](_0x7144('0x8'),auth[_0x7144('0x9')](),controller[_0x7144('0xa')]);router[_0x7144('0xb')]('/',auth[_0x7144('0x9')](),controller['create']);router[_0x7144('0xc')](_0x7144('0x8'),auth[_0x7144('0x9')](),controller['update']);router[_0x7144('0xd')]('/:id',auth[_0x7144('0x9')](),controller[_0x7144('0xe')]);module[_0x7144('0xf')]=router; \ No newline at end of file +var _0xcbd3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4f7da6,_0x97330f){var _0x474753=function(_0x55120a){while(--_0x55120a){_0x4f7da6['push'](_0x4f7da6['shift']());}};_0x474753(++_0x97330f);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x3e94f6,_0x35e860){_0x3e94f6=_0x3e94f6-0x0;var _0x36bd06=_0xcbd3[_0x3e94f6];return _0x36bd06;};'use strict';var multer=require(_0x3cbd('0x0'));var util=require(_0x3cbd('0x1'));var path=require(_0x3cbd('0x2'));var timeout=require(_0x3cbd('0x3'));var express=require(_0x3cbd('0x4'));var router=express[_0x3cbd('0x5')]();var auth=require(_0x3cbd('0x6'));var interaction=require(_0x3cbd('0x7'));var config=require(_0x3cbd('0x8'));var controller=require(_0x3cbd('0x9'));router['get']('/',auth[_0x3cbd('0xa')](),controller[_0x3cbd('0xb')]);router['get'](_0x3cbd('0xc'),auth['isAuthenticated'](),controller[_0x3cbd('0xd')]);router['post']('/',auth[_0x3cbd('0xa')](),controller[_0x3cbd('0xe')]);router[_0x3cbd('0xf')](_0x3cbd('0xc'),auth[_0x3cbd('0xa')](),controller['update']);router[_0x3cbd('0x10')]('/:id',auth[_0x3cbd('0xa')](),controller[_0x3cbd('0x11')]);module[_0x3cbd('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 84380ef..f094867 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.attributes.js +++ b/server/api/voiceChanSpy/voiceChanSpy.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ca5=['getDataValue','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x2efd1d,_0x44f696){var _0x1ef3f6=function(_0x25da5f){while(--_0x25da5f){_0x2efd1d['push'](_0x2efd1d['shift']());}};_0x1ef3f6(++_0x44f696);}(_0x5ca5,0xc5));var _0x55ca=function(_0x251053,_0x33b680){_0x251053=_0x251053-0x0;var _0x2f5d4a=_0x5ca5[_0x251053];return _0x2f5d4a;};'use strict';var Sequelize=require(_0x55ca('0x0'));module[_0x55ca('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x55ca('0x2')],'unique':_0x55ca('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x55ca('0x2')],'set':function(_0x2e0fdc){this[_0x55ca('0x4')](_0x55ca('0x5'),_0x2e0fdc?_0x2e0fdc['join'](''):[]);},'get':function(){return this[_0x55ca('0x6')](_0x55ca('0x5'))?this[_0x55ca('0x6')](_0x55ca('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x55ca('0x2')]}}; \ No newline at end of file +var _0xaf15=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','BOOLEAN'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xaf15,0x87));var _0x5af1=function(_0x549d4e,_0x48cfe7){_0x549d4e=_0x549d4e-0x0;var _0x4a8362=_0xaf15[_0x549d4e];return _0x4a8362;};'use strict';var Sequelize=require(_0x5af1('0x0'));module[_0x5af1('0x1')]={'name':{'type':Sequelize[_0x5af1('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x5af1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x5af1('0x2')],'set':function(_0x3da583){this[_0x5af1('0x4')](_0x5af1('0x5'),_0x3da583?_0x3da583[_0x5af1('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x5af1('0x5'))?this[_0x5af1('0x7')](_0x5af1('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x5af1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x5af1('0x2')]},'record':{'type':Sequelize[_0x5af1('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5af1('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 7c55aaa..fe5b46a 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.controller.js +++ b/server/api/voiceChanSpy/voiceChanSpy.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7566=['set','apply','reject','save','update','then','destroy','get','UserProfileResource','name','map','VoiceChanSpy','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','rawAttributes','create','body','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x7566,0x117));var _0x6756=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0x7566[_0x2136d5];return _0x3bee2e;};'use strict';var pdf=require(_0x6756('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6756('0x1'));var zipdir=require(_0x6756('0x2'));var jsonpatch=require(_0x6756('0x3'));var rp=require(_0x6756('0x4'));var moment=require(_0x6756('0x5'));var BPromise=require(_0x6756('0x6'));var Mustache=require(_0x6756('0x7'));var util=require(_0x6756('0x8'));var path=require('path');var sox=require(_0x6756('0x9'));var csv=require(_0x6756('0xa'));var ejs=require(_0x6756('0xb'));var fs=require('fs');var _=require(_0x6756('0xc'));var squel=require(_0x6756('0xd'));var crypto=require(_0x6756('0xe'));var jsforce=require(_0x6756('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6756('0xa'));var querystring=require('querystring');var Papa=require(_0x6756('0x10'));var Redis=require('ioredis');var authService=require(_0x6756('0x11'));var qs=require(_0x6756('0x12'));var as=require(_0x6756('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6756('0x14'))(_0x6756('0x15'));var utils=require(_0x6756('0x16'));var config=require(_0x6756('0x17'));var licenseUtil=require(_0x6756('0x18'));var db=require(_0x6756('0x19'))['db'];function respondWithStatusCode(_0x1337c4,_0x5a0bba){_0x5a0bba=_0x5a0bba||0xcc;return function(_0x1af018){if(_0x1af018){return _0x1337c4[_0x6756('0x1a')](_0x5a0bba);}return _0x1337c4[_0x6756('0x1b')](_0x5a0bba)[_0x6756('0x1c')]();};}function respondWithResult(_0x2cad4d,_0x2c71ef){_0x2c71ef=_0x2c71ef||0xc8;return function(_0x2cfe1c){if(_0x2cfe1c){return _0x2cad4d['status'](_0x2c71ef)[_0x6756('0x1d')](_0x2cfe1c);}};}function respondWithFilteredResult(_0x20fc1e,_0x1a30a4){return function(_0x398f6e){if(_0x398f6e){var _0x54e78d=_0x398f6e[_0x6756('0x1e')],_0x89399b=_0x1a30a4[_0x6756('0x1f')],_0x2ea098=_0x1a30a4[_0x6756('0x1f')]+_0x1a30a4[_0x6756('0x20')],_0x2db29e;if(_0x2ea098>=_0x54e78d){_0x2ea098=_0x54e78d;_0x2db29e=0xc8;}else{_0x2db29e=0xce;}_0x20fc1e['status'](_0x2db29e);return _0x20fc1e[_0x6756('0x21')]('Content-Range',_0x89399b+'-'+_0x2ea098+'/'+_0x54e78d)['json'](_0x398f6e);}return null;};}function patchUpdates(_0x58f199){return function(_0x2d6040){try{jsonpatch[_0x6756('0x22')](_0x2d6040,_0x58f199,!![]);}catch(_0x305c9c){return BPromise[_0x6756('0x23')](_0x305c9c);}return _0x2d6040[_0x6756('0x24')]();};}function saveUpdates(_0x34cf6c,_0x47239d){return function(_0x415f41){if(_0x415f41){return _0x415f41[_0x6756('0x25')](_0x34cf6c)[_0x6756('0x26')](function(_0x32da67){return _0x32da67;});}return null;};}function removeEntity(_0x4f6af3,_0x109b5f){return function(_0xf1af29){if(_0xf1af29){return _0xf1af29[_0x6756('0x27')]()['then'](function(){var _0x3ddc67=_0xf1af29[_0x6756('0x28')]({'plain':!![]});var _0x4fcbdb='ChanSpies';return db[_0x6756('0x29')]['destroy']({'where':{'type':_0x4fcbdb,'resourceId':_0x3ddc67['id']}})[_0x6756('0x26')](function(){return _0xf1af29;});})[_0x6756('0x26')](function(){_0x4f6af3['status'](0xcc)[_0x6756('0x1c')]();});}};}function handleEntityNotFound(_0x2f2c98,_0x5526f0){return function(_0xba5690){if(!_0xba5690){_0x2f2c98[_0x6756('0x1a')](0x194);}return _0xba5690;};}function handleError(_0x34f4ba,_0x51f0d4){_0x51f0d4=_0x51f0d4||0x1f4;return function(_0x534553){logger['error'](_0x534553['stack']);if(_0x534553[_0x6756('0x2a')]){delete _0x534553[_0x6756('0x2a')];}_0x34f4ba[_0x6756('0x1b')](_0x51f0d4)['send'](_0x534553);};}exports['index']=function(_0x40a24c,_0x34d94b){var _0x2ab95b={},_0x43b593={},_0x3a8969={'count':0x0,'rows':[]};var _0x5c9671=_[_0x6756('0x2b')](db[_0x6756('0x2c')]['rawAttributes'],function(_0x209fee){return{'name':_0x209fee[_0x6756('0x2d')],'type':_0x209fee['type'][_0x6756('0x2e')]};});_0x43b593[_0x6756('0x2f')]=_[_0x6756('0x2b')](_0x5c9671,_0x6756('0x2a'));_0x43b593[_0x6756('0x30')]=_[_0x6756('0x31')](_0x40a24c[_0x6756('0x30')]);_0x43b593['filters']=_[_0x6756('0x32')](_0x43b593[_0x6756('0x2f')],_0x43b593[_0x6756('0x30')]);_0x2ab95b[_0x6756('0x33')]=_[_0x6756('0x32')](_0x43b593[_0x6756('0x2f')],qs[_0x6756('0x34')](_0x40a24c[_0x6756('0x30')][_0x6756('0x34')]));_0x2ab95b[_0x6756('0x33')]=_0x2ab95b['attributes'][_0x6756('0x35')]?_0x2ab95b['attributes']:_0x43b593[_0x6756('0x2f')];if(!_0x40a24c[_0x6756('0x30')]['hasOwnProperty'](_0x6756('0x36'))){_0x2ab95b[_0x6756('0x20')]=qs[_0x6756('0x20')](_0x40a24c['query'][_0x6756('0x20')]);_0x2ab95b[_0x6756('0x1f')]=qs[_0x6756('0x1f')](_0x40a24c[_0x6756('0x30')][_0x6756('0x1f')]);}_0x2ab95b[_0x6756('0x37')]=qs[_0x6756('0x38')](_0x40a24c[_0x6756('0x30')][_0x6756('0x38')]);_0x2ab95b[_0x6756('0x39')]=qs[_0x6756('0x3a')](_['pick'](_0x40a24c[_0x6756('0x30')],_0x43b593['filters']),_0x5c9671);if(_0x40a24c[_0x6756('0x30')][_0x6756('0x3b')]){_0x2ab95b[_0x6756('0x39')]=_[_0x6756('0x3c')](_0x2ab95b['where'],{'$or':_[_0x6756('0x2b')](_0x5c9671,function(_0x207574){if(_0x207574['type']!==_0x6756('0x3d')){var _0x4bebe6={};_0x4bebe6[_0x207574['name']]={'$like':'%'+_0x40a24c[_0x6756('0x30')]['filter']+'%'};return _0x4bebe6;}})});}_0x2ab95b=_[_0x6756('0x3c')]({},_0x2ab95b,_0x40a24c['options']);var _0x2455b7={'where':_0x2ab95b[_0x6756('0x39')]};return db[_0x6756('0x2c')][_0x6756('0x1e')](_0x2455b7)['then'](function(_0x4d2f1a){_0x3a8969['count']=_0x4d2f1a;if(_0x40a24c[_0x6756('0x30')][_0x6756('0x3e')]){_0x2ab95b[_0x6756('0x3f')]=[{'all':!![]}];}return db[_0x6756('0x2c')]['findAll'](_0x2ab95b);})[_0x6756('0x26')](function(_0x5a9bbe){_0x3a8969[_0x6756('0x40')]=_0x5a9bbe;return _0x3a8969;})['then'](respondWithFilteredResult(_0x34d94b,_0x2ab95b))[_0x6756('0x41')](handleError(_0x34d94b,null));};exports['show']=function(_0x264217,_0x54d145){var _0x1b023e={'raw':![],'where':{'id':_0x264217[_0x6756('0x42')]['id']}},_0x4684f1={};_0x4684f1['model']=_['keys'](db['VoiceChanSpy'][_0x6756('0x43')]);_0x4684f1['query']=_['keys'](_0x264217[_0x6756('0x30')]);_0x4684f1[_0x6756('0x3a')]=_[_0x6756('0x32')](_0x4684f1[_0x6756('0x2f')],_0x4684f1[_0x6756('0x30')]);_0x1b023e[_0x6756('0x33')]=_[_0x6756('0x32')](_0x4684f1['model'],qs[_0x6756('0x34')](_0x264217['query'][_0x6756('0x34')]));_0x1b023e[_0x6756('0x33')]=_0x1b023e[_0x6756('0x33')][_0x6756('0x35')]?_0x1b023e[_0x6756('0x33')]:_0x4684f1[_0x6756('0x2f')];if(_0x264217[_0x6756('0x30')][_0x6756('0x3e')]){_0x1b023e[_0x6756('0x3f')]=[{'all':!![]}];}_0x1b023e=_[_0x6756('0x3c')]({},_0x1b023e,_0x264217['options']);return db[_0x6756('0x2c')]['find'](_0x1b023e)[_0x6756('0x26')](handleEntityNotFound(_0x54d145,null))[_0x6756('0x26')](respondWithResult(_0x54d145,null))[_0x6756('0x41')](handleError(_0x54d145,null));};exports[_0x6756('0x44')]=function(_0x515504,_0x2015e2){return db[_0x6756('0x2c')]['create'](_0x515504[_0x6756('0x45')],{})[_0x6756('0x26')](function(_0x19e96d){var _0x289a69=_0x515504[_0x6756('0x46')][_0x6756('0x28')]({'plain':!![]});if(!_0x289a69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x289a69['role']===_0x6756('0x46')){var _0x3f38f6=_0x19e96d[_0x6756('0x28')]({'plain':!![]});var _0x352446=_0x6756('0x47');return db[_0x6756('0x48')]['find']({'where':{'name':_0x352446,'userProfileId':_0x289a69[_0x6756('0x49')]},'raw':!![]})[_0x6756('0x26')](function(_0x5ebf9d){if(_0x5ebf9d&&_0x5ebf9d[_0x6756('0x4a')]===0x0){return db[_0x6756('0x29')]['create']({'name':_0x3f38f6[_0x6756('0x2a')],'resourceId':_0x3f38f6['id'],'type':_0x5ebf9d[_0x6756('0x2a')],'sectionId':_0x5ebf9d['id']},{})['then'](function(){return _0x19e96d;});}else{return _0x19e96d;}})['catch'](function(_0x24c8eb){logger[_0x6756('0x4b')](_0x6756('0x4c'),_0x24c8eb);throw _0x24c8eb;});}return _0x19e96d;})[_0x6756('0x26')](respondWithResult(_0x2015e2,0xc9))[_0x6756('0x41')](handleError(_0x2015e2,null));};exports[_0x6756('0x25')]=function(_0x3e8c79,_0x15d7f8){if(_0x3e8c79['body']['id']){delete _0x3e8c79[_0x6756('0x45')]['id'];}return db[_0x6756('0x2c')][_0x6756('0x4d')]({'where':{'id':_0x3e8c79['params']['id']}})['then'](handleEntityNotFound(_0x15d7f8,null))[_0x6756('0x26')](saveUpdates(_0x3e8c79['body'],null))[_0x6756('0x26')](respondWithResult(_0x15d7f8,null))[_0x6756('0x41')](handleError(_0x15d7f8,null));};exports['destroy']=function(_0x2440b5,_0xaed1a7){return db['VoiceChanSpy'][_0x6756('0x4d')]({'where':{'id':_0x2440b5['params']['id']}})[_0x6756('0x26')](handleEntityNotFound(_0xaed1a7,null))[_0x6756('0x26')](removeEntity(_0xaed1a7,null))[_0x6756('0x41')](handleError(_0xaed1a7,null));}; \ No newline at end of file +var _0x9a35=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','body','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','name','send','index','VoiceChanSpy','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where'];(function(_0xa79f2,_0x5e4491){var _0x1a015e=function(_0x65bf69){while(--_0x65bf69){_0xa79f2['push'](_0xa79f2['shift']());}};_0x1a015e(++_0x5e4491);}(_0x9a35,0x10e));var _0x59a3=function(_0x65d748,_0x35e146){_0x65d748=_0x65d748-0x0;var _0x52e055=_0x9a35[_0x65d748];return _0x52e055;};'use strict';var pdf=require(_0x59a3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x59a3('0x1'));var zipdir=require(_0x59a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x59a3('0x3'));var moment=require(_0x59a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x59a3('0x5'));var util=require(_0x59a3('0x6'));var path=require(_0x59a3('0x7'));var sox=require(_0x59a3('0x8'));var csv=require(_0x59a3('0x9'));var ejs=require(_0x59a3('0xa'));var fs=require('fs');var _=require(_0x59a3('0xb'));var squel=require(_0x59a3('0xc'));var crypto=require('crypto');var jsforce=require(_0x59a3('0xd'));var deskjs=require(_0x59a3('0xe'));var toCsv=require(_0x59a3('0x9'));var querystring=require(_0x59a3('0xf'));var Papa=require(_0x59a3('0x10'));var Redis=require(_0x59a3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x59a3('0x12'));var as=require(_0x59a3('0x13'));var hardwareService=require(_0x59a3('0x14'));var logger=require(_0x59a3('0x15'))(_0x59a3('0x16'));var utils=require(_0x59a3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x59a3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe935,_0x17d88a){_0x17d88a=_0x17d88a||0xcc;return function(_0x220b5c){if(_0x220b5c){return _0x3fe935[_0x59a3('0x19')](_0x17d88a);}return _0x3fe935[_0x59a3('0x1a')](_0x17d88a)[_0x59a3('0x1b')]();};}function respondWithResult(_0x21ed2b,_0x428e59){_0x428e59=_0x428e59||0xc8;return function(_0x5b41da){if(_0x5b41da){return _0x21ed2b[_0x59a3('0x1a')](_0x428e59)['json'](_0x5b41da);}};}function respondWithFilteredResult(_0x4380b4,_0x541207){return function(_0x47c237){if(_0x47c237){var _0x3484f4=_0x47c237[_0x59a3('0x1c')],_0x105681=_0x541207[_0x59a3('0x1d')],_0x279ef1=_0x541207[_0x59a3('0x1d')]+_0x541207[_0x59a3('0x1e')],_0x2cb78a;if(_0x279ef1>=_0x3484f4){_0x279ef1=_0x3484f4;_0x2cb78a=0xc8;}else{_0x2cb78a=0xce;}_0x4380b4[_0x59a3('0x1a')](_0x2cb78a);return _0x4380b4[_0x59a3('0x1f')](_0x59a3('0x20'),_0x105681+'-'+_0x279ef1+'/'+_0x3484f4)[_0x59a3('0x21')](_0x47c237);}return null;};}function patchUpdates(_0x3b107c){return function(_0x154255){try{jsonpatch[_0x59a3('0x22')](_0x154255,_0x3b107c,!![]);}catch(_0x13e032){return BPromise[_0x59a3('0x23')](_0x13e032);}return _0x154255[_0x59a3('0x24')]();};}function saveUpdates(_0x5e8fb4,_0x32abba){return function(_0x4eb6b6){if(_0x4eb6b6){return _0x4eb6b6[_0x59a3('0x25')](_0x5e8fb4)[_0x59a3('0x26')](function(_0x2f9cba){return _0x2f9cba;});}return null;};}function removeEntity(_0x451d8e,_0x5f2fd4){return function(_0x21e631){if(_0x21e631){return _0x21e631[_0x59a3('0x27')]()['then'](function(){var _0x347739=_0x21e631[_0x59a3('0x28')]({'plain':!![]});var _0x536c1f=_0x59a3('0x29');return db[_0x59a3('0x2a')]['destroy']({'where':{'type':_0x536c1f,'resourceId':_0x347739['id']}})['then'](function(){return _0x21e631;});})[_0x59a3('0x26')](function(){_0x451d8e[_0x59a3('0x1a')](0xcc)[_0x59a3('0x1b')]();});}};}function handleEntityNotFound(_0x256640,_0x5e52f4){return function(_0x53c864){if(!_0x53c864){_0x256640[_0x59a3('0x19')](0x194);}return _0x53c864;};}function handleError(_0x252ee3,_0x582a6d){_0x582a6d=_0x582a6d||0x1f4;return function(_0x153e4d){logger['error'](_0x153e4d[_0x59a3('0x2b')]);if(_0x153e4d[_0x59a3('0x2c')]){delete _0x153e4d[_0x59a3('0x2c')];}_0x252ee3[_0x59a3('0x1a')](_0x582a6d)[_0x59a3('0x2d')](_0x153e4d);};}exports[_0x59a3('0x2e')]=function(_0x2632f0,_0x3fcae0){var _0x39c3ac={},_0x43a77e={},_0x476d9c={'count':0x0,'rows':[]};var _0x9f2d9d=_['map'](db[_0x59a3('0x2f')][_0x59a3('0x30')],function(_0x58c391){return{'name':_0x58c391['fieldName'],'type':_0x58c391[_0x59a3('0x31')]['key']};});_0x43a77e[_0x59a3('0x32')]=_[_0x59a3('0x33')](_0x9f2d9d,_0x59a3('0x2c'));_0x43a77e[_0x59a3('0x34')]=_[_0x59a3('0x35')](_0x2632f0[_0x59a3('0x34')]);_0x43a77e[_0x59a3('0x36')]=_[_0x59a3('0x37')](_0x43a77e[_0x59a3('0x32')],_0x43a77e[_0x59a3('0x34')]);_0x39c3ac['attributes']=_[_0x59a3('0x37')](_0x43a77e[_0x59a3('0x32')],qs[_0x59a3('0x38')](_0x2632f0[_0x59a3('0x34')][_0x59a3('0x38')]));_0x39c3ac[_0x59a3('0x39')]=_0x39c3ac[_0x59a3('0x39')]['length']?_0x39c3ac[_0x59a3('0x39')]:_0x43a77e[_0x59a3('0x32')];if(!_0x2632f0['query'][_0x59a3('0x3a')]('nolimit')){_0x39c3ac[_0x59a3('0x1e')]=qs['limit'](_0x2632f0[_0x59a3('0x34')][_0x59a3('0x1e')]);_0x39c3ac[_0x59a3('0x1d')]=qs['offset'](_0x2632f0[_0x59a3('0x34')]['offset']);}_0x39c3ac[_0x59a3('0x3b')]=qs[_0x59a3('0x3c')](_0x2632f0[_0x59a3('0x34')]['sort']);_0x39c3ac[_0x59a3('0x3d')]=qs[_0x59a3('0x36')](_[_0x59a3('0x3e')](_0x2632f0[_0x59a3('0x34')],_0x43a77e[_0x59a3('0x36')]),_0x9f2d9d);if(_0x2632f0[_0x59a3('0x34')][_0x59a3('0x3f')]){_0x39c3ac[_0x59a3('0x3d')]=_[_0x59a3('0x40')](_0x39c3ac[_0x59a3('0x3d')],{'$or':_['map'](_0x9f2d9d,function(_0x45a467){if(_0x45a467[_0x59a3('0x31')]!==_0x59a3('0x41')){var _0x271cc4={};_0x271cc4[_0x45a467[_0x59a3('0x2c')]]={'$like':'%'+_0x2632f0[_0x59a3('0x34')][_0x59a3('0x3f')]+'%'};return _0x271cc4;}})});}_0x39c3ac=_['merge']({},_0x39c3ac,_0x2632f0[_0x59a3('0x42')]);var _0x2800e6={'where':_0x39c3ac[_0x59a3('0x3d')]};return db[_0x59a3('0x2f')][_0x59a3('0x1c')](_0x2800e6)['then'](function(_0x2e0ef0){_0x476d9c['count']=_0x2e0ef0;if(_0x2632f0[_0x59a3('0x34')][_0x59a3('0x43')]){_0x39c3ac[_0x59a3('0x44')]=[{'all':!![]}];}return db[_0x59a3('0x2f')][_0x59a3('0x45')](_0x39c3ac);})[_0x59a3('0x26')](function(_0x5462d3){_0x476d9c[_0x59a3('0x46')]=_0x5462d3;return _0x476d9c;})[_0x59a3('0x26')](respondWithFilteredResult(_0x3fcae0,_0x39c3ac))[_0x59a3('0x47')](handleError(_0x3fcae0,null));};exports['show']=function(_0x35e803,_0xa72a58){var _0x30c128={'raw':![],'where':{'id':_0x35e803[_0x59a3('0x48')]['id']}},_0x8a73dc={};_0x8a73dc['model']=_['keys'](db['VoiceChanSpy'][_0x59a3('0x30')]);_0x8a73dc[_0x59a3('0x34')]=_[_0x59a3('0x35')](_0x35e803[_0x59a3('0x34')]);_0x8a73dc[_0x59a3('0x36')]=_['intersection'](_0x8a73dc[_0x59a3('0x32')],_0x8a73dc[_0x59a3('0x34')]);_0x30c128[_0x59a3('0x39')]=_[_0x59a3('0x37')](_0x8a73dc[_0x59a3('0x32')],qs[_0x59a3('0x38')](_0x35e803[_0x59a3('0x34')][_0x59a3('0x38')]));_0x30c128[_0x59a3('0x39')]=_0x30c128[_0x59a3('0x39')][_0x59a3('0x49')]?_0x30c128['attributes']:_0x8a73dc[_0x59a3('0x32')];if(_0x35e803[_0x59a3('0x34')]['includeAll']){_0x30c128[_0x59a3('0x44')]=[{'all':!![]}];}_0x30c128=_['merge']({},_0x30c128,_0x35e803[_0x59a3('0x42')]);return db[_0x59a3('0x2f')][_0x59a3('0x4a')](_0x30c128)[_0x59a3('0x26')](handleEntityNotFound(_0xa72a58,null))[_0x59a3('0x26')](respondWithResult(_0xa72a58,null))[_0x59a3('0x47')](handleError(_0xa72a58,null));};exports[_0x59a3('0x4b')]=function(_0x208859,_0x34a1b8){return db['VoiceChanSpy']['create'](_0x208859['body'],{})[_0x59a3('0x26')](function(_0x49a009){var _0x5cd1e0=_0x208859['user']['get']({'plain':!![]});if(!_0x5cd1e0)throw new Error(_0x59a3('0x4c'));if(_0x5cd1e0['role']===_0x59a3('0x4d')){var _0x5e56b4=_0x49a009[_0x59a3('0x28')]({'plain':!![]});var _0x2f4881='ChanSpies';return db[_0x59a3('0x4e')]['find']({'where':{'name':_0x2f4881,'userProfileId':_0x5cd1e0[_0x59a3('0x4f')]},'raw':!![]})[_0x59a3('0x26')](function(_0x4dc7df){if(_0x4dc7df&&_0x4dc7df[_0x59a3('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e56b4[_0x59a3('0x2c')],'resourceId':_0x5e56b4['id'],'type':_0x4dc7df[_0x59a3('0x2c')],'sectionId':_0x4dc7df['id']},{})[_0x59a3('0x26')](function(){return _0x49a009;});}else{return _0x49a009;}})[_0x59a3('0x47')](function(_0x172c6d){logger[_0x59a3('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x172c6d);throw _0x172c6d;});}return _0x49a009;})[_0x59a3('0x26')](respondWithResult(_0x34a1b8,0xc9))['catch'](handleError(_0x34a1b8,null));};exports[_0x59a3('0x25')]=function(_0x485b9f,_0x47464c){if(_0x485b9f[_0x59a3('0x52')]['id']){delete _0x485b9f[_0x59a3('0x52')]['id'];}return db['VoiceChanSpy'][_0x59a3('0x4a')]({'where':{'id':_0x485b9f[_0x59a3('0x48')]['id']}})[_0x59a3('0x26')](handleEntityNotFound(_0x47464c,null))['then'](saveUpdates(_0x485b9f[_0x59a3('0x52')],null))[_0x59a3('0x26')](respondWithResult(_0x47464c,null))[_0x59a3('0x47')](handleError(_0x47464c,null));};exports[_0x59a3('0x27')]=function(_0x653731,_0x429ab1){return db[_0x59a3('0x2f')][_0x59a3('0x4a')]({'where':{'id':_0x653731[_0x59a3('0x48')]['id']}})[_0x59a3('0x26')](handleEntityNotFound(_0x429ab1,null))[_0x59a3('0x26')](removeEntity(_0x429ab1,null))[_0x59a3('0x47')](handleError(_0x429ab1,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 2d2603f..401136c 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.model.js +++ b/server/api/voiceChanSpy/voiceChanSpy.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ca3=['options','join','concat','internal','User','agent','then','catch','exports','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name'];(function(_0x49a47e,_0x360d00){var _0x1a5411=function(_0x50a229){while(--_0x50a229){_0x49a47e['push'](_0x49a47e['shift']());}};_0x1a5411(++_0x360d00);}(_0x4ca3,0x9f));var _0x34ca=function(_0x35f364,_0x11e270){_0x35f364=_0x35f364-0x0;var _0x216ca8=_0x4ca3[_0x35f364];return _0x216ca8;};'use strict';var _=require(_0x34ca('0x0'));var util=require(_0x34ca('0x1'));var BPromise=require(_0x34ca('0x2'));var attributes=require(_0x34ca('0x3'));var getUserApplications=function(_0x307e5f,_0x5e324c,_0x36e893){var _0x5793e1=0x1;var _0x607dba=[];var _0x4fe1ec={'context':_0x5e324c[_0x34ca('0x4')]||'from-sip','exten':util[_0x34ca('0x5')]('%s%s',_0x307e5f[_0x34ca('0x6')],_0x36e893),'type':'system','isApp':![],'ChanSpyId':_0x307e5f['id'],'UserId':_0x5e324c['id']};_0x607dba[_0x34ca('0x7')](_[_0x34ca('0x8')]({'app':_0x34ca('0x9'),'appdata':util[_0x34ca('0x5')](_0x34ca('0xa'),_0x34ca('0xb')),'priority':_0x5793e1++},_0x4fe1ec));if(_0x307e5f[_0x34ca('0xc')]){_0x607dba[_0x34ca('0x7')](_[_0x34ca('0x8')]({'app':_0x34ca('0xd'),'appdata':util[_0x34ca('0x5')](_0x34ca('0xe'),_0x307e5f[_0x34ca('0xf')]),'priority':_0x5793e1++},_0x4fe1ec));}if(_0x307e5f['auth']){_0x607dba[_0x34ca('0x7')](_['merge']({'app':_0x34ca('0x10'),'appdata':_0x307e5f[_0x34ca('0x11')],'priority':_0x5793e1++},_0x4fe1ec));}_0x607dba[_0x34ca('0x7')](_[_0x34ca('0x8')]({'app':_0x34ca('0x12'),'appdata':util['format'](_0x34ca('0x13'),_0x5e324c[_0x34ca('0x14')],_0x307e5f[_0x34ca('0x15')]?_0x307e5f[_0x34ca('0x15')][_0x34ca('0x16')](''):''),'priority':_0x5793e1++},_0x4fe1ec));if(_0x307e5f[_0x34ca('0xc')]){_0x607dba[_0x34ca('0x7')](_['merge']({'app':'StopMixMonitor','priority':_0x5793e1++},_0x4fe1ec));}return _0x607dba;};var getChanSpyApplications=function(_0x527a1c,_0xe18555){var _0x552ad9=[];for(var _0x62f451=0x0,_0x213149=0x1;_0x62f451<_0xe18555['length'];_0x62f451++,_0x213149=0x1){_0x552ad9=_0x552ad9[_0x34ca('0x17')](getUserApplications(_0x527a1c,_0xe18555[_0x62f451],_0xe18555[_0x62f451][_0x34ca('0x18')]));if(_0xe18555[_0x62f451]['internal']!=_0xe18555[_0x62f451][_0x34ca('0x14')]){_0x552ad9=_0x552ad9[_0x34ca('0x17')](getUserApplications(_0x527a1c,_0xe18555[_0x62f451],_0xe18555[_0x62f451][_0x34ca('0x14')]));}}return _0x552ad9;};var getChanSpyPromise=function(_0x4522c2,_0x218e24){return new BPromise(function(_0x23cdd6,_0x248987){return _0x4522c2[_0x34ca('0x19')]['findAll']({'attributes':['id','name',_0x34ca('0x18')],'where':{'role':_0x34ca('0x1a'),'chanspy':!![]},'raw':!![]})[_0x34ca('0x1b')](function(_0x4f980a){if(_0x4f980a){return _0x23cdd6(getChanSpyApplications(_0x218e24,_0x4f980a));}return _0x23cdd6([]);})[_0x34ca('0x1c')](function(_0x5de054){_0x248987(_0x5de054);});});};module[_0x34ca('0x1d')]=function(_0x531001,_0x3e6c0f){var _0x4028d8=_0x531001['models'];return _0x531001['define'](_0x34ca('0x1e'),attributes,{'tableName':_0x34ca('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x458cec,_0xcede8a,_0x42ddcc){return getChanSpyPromise(_0x4028d8,_0x458cec)[_0x34ca('0x1b')](function(_0x3ddbdc){if(_0x3ddbdc&&_0x3ddbdc[_0x34ca('0x20')]){return _0x4028d8[_0x34ca('0x21')][_0x34ca('0x22')](_0x3ddbdc);}})[_0x34ca('0x1b')](function(){_0x42ddcc();})['catch'](function(_0x76d9f0){_0x42ddcc(_0x76d9f0);});},'afterUpdate':function(_0x537c01,_0x59e321,_0x107dfb){return _0x4028d8[_0x34ca('0x21')][_0x34ca('0x23')]({'where':{'ChanSpyId':_0x537c01['id']}})['then'](function(){return getChanSpyPromise(_0x4028d8,_0x537c01);})['then'](function(_0x2c27cf){if(_0x2c27cf&&_0x2c27cf[_0x34ca('0x20')]){return _0x4028d8[_0x34ca('0x21')][_0x34ca('0x22')](_0x2c27cf);}})[_0x34ca('0x1b')](function(){_0x107dfb();})[_0x34ca('0x1c')](function(_0x2102d0){_0x107dfb(_0x2102d0);});},'afterDestroy':function(_0x50f887,_0x37c432,_0x38eb45){return _0x4028d8[_0x34ca('0x21')][_0x34ca('0x23')]({'where':{'ChanSpyId':_0x50f887['id']}})['then'](function(){_0x38eb45();})[_0x34ca('0x1c')](function(_0x5a8477){_0x38eb45(_0x5a8477);});}}});}; \ No newline at end of file +var _0xe860=['User','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','chanspy','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','record','StopMixMonitor','length','concat','internal'];(function(_0x5d5597,_0x4ade20){var _0x362dbd=function(_0x58f5b8){while(--_0x58f5b8){_0x5d5597['push'](_0x5d5597['shift']());}};_0x362dbd(++_0x4ade20);}(_0xe860,0x188));var _0x0e86=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xe860[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require(_0x0e86('0x0'));var util=require(_0x0e86('0x1'));var BPromise=require(_0x0e86('0x2'));var attributes=require(_0x0e86('0x3'));var getUserApplications=function(_0x4b3b17,_0x75754f,_0x23c2d4){var _0x49b8bb=0x1;var _0x21d021=[];var _0x19711d={'context':_0x75754f[_0x0e86('0x4')]||_0x0e86('0x5'),'exten':util[_0x0e86('0x6')](_0x0e86('0x7'),_0x4b3b17[_0x0e86('0x8')],_0x23c2d4),'type':_0x0e86('0x9'),'isApp':![],'ChanSpyId':_0x4b3b17['id'],'UserId':_0x75754f['id']};_0x21d021[_0x0e86('0xa')](_[_0x0e86('0xb')]({'app':'Set','appdata':util[_0x0e86('0x6')]('CDR(type)=%s',_0x0e86('0xc')),'priority':_0x49b8bb++},_0x19711d));if(_0x4b3b17['record']){_0x21d021['push'](_['merge']({'app':'MixMonitor','appdata':util[_0x0e86('0x6')]('${UNIQUEID}.%s,a',_0x4b3b17[_0x0e86('0xd')]),'priority':_0x49b8bb++},_0x19711d));}if(_0x4b3b17[_0x0e86('0xe')]){_0x21d021['push'](_[_0x0e86('0xb')]({'app':_0x0e86('0xf'),'appdata':_0x4b3b17[_0x0e86('0x10')],'priority':_0x49b8bb++},_0x19711d));}_0x21d021[_0x0e86('0xa')](_[_0x0e86('0xb')]({'app':_0x0e86('0x11'),'appdata':util[_0x0e86('0x6')]('SIP/%s,%s',_0x75754f[_0x0e86('0x12')],_0x4b3b17[_0x0e86('0x13')]?_0x4b3b17[_0x0e86('0x13')][_0x0e86('0x14')](''):''),'priority':_0x49b8bb++},_0x19711d));if(_0x4b3b17[_0x0e86('0x15')]){_0x21d021[_0x0e86('0xa')](_[_0x0e86('0xb')]({'app':_0x0e86('0x16'),'priority':_0x49b8bb++},_0x19711d));}return _0x21d021;};var getChanSpyApplications=function(_0x32cd00,_0x120d6b){var _0x3087ed=[];for(var _0x27c16a=0x0,_0xe48b49=0x1;_0x27c16a<_0x120d6b[_0x0e86('0x17')];_0x27c16a++,_0xe48b49=0x1){_0x3087ed=_0x3087ed[_0x0e86('0x18')](getUserApplications(_0x32cd00,_0x120d6b[_0x27c16a],_0x120d6b[_0x27c16a][_0x0e86('0x19')]));if(_0x120d6b[_0x27c16a][_0x0e86('0x19')]!=_0x120d6b[_0x27c16a][_0x0e86('0x12')]){_0x3087ed=_0x3087ed[_0x0e86('0x18')](getUserApplications(_0x32cd00,_0x120d6b[_0x27c16a],_0x120d6b[_0x27c16a]['name']));}}return _0x3087ed;};var getChanSpyPromise=function(_0x5bc4e3,_0x54579d){return new BPromise(function(_0x1fd8be,_0x1dcc3e){return _0x5bc4e3[_0x0e86('0x1a')]['findAll']({'attributes':['id',_0x0e86('0x12'),'internal'],'where':{'role':_0x0e86('0x1b'),'chanspy':!![]},'raw':!![]})[_0x0e86('0x1c')](function(_0x32e777){if(_0x32e777){return _0x1fd8be(getChanSpyApplications(_0x54579d,_0x32e777));}return _0x1fd8be([]);})[_0x0e86('0x1d')](function(_0x17edb4){_0x1dcc3e(_0x17edb4);});});};module[_0x0e86('0x1e')]=function(_0x538ef3,_0x215f51){var _0x122cd2=_0x538ef3[_0x0e86('0x1f')];return _0x538ef3[_0x0e86('0x20')](_0x0e86('0x21'),attributes,{'tableName':_0x0e86('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x285f14,_0x52b4a1,_0x7ad308){return getChanSpyPromise(_0x122cd2,_0x285f14)[_0x0e86('0x1c')](function(_0x1ae6fe){if(_0x1ae6fe&&_0x1ae6fe[_0x0e86('0x17')]){return _0x122cd2[_0x0e86('0x23')][_0x0e86('0x24')](_0x1ae6fe);}})['then'](function(){_0x7ad308();})[_0x0e86('0x1d')](function(_0x487afa){_0x7ad308(_0x487afa);});},'afterUpdate':function(_0x3a2e4a,_0x13a187,_0x5b483f){return _0x122cd2['VoiceExtension'][_0x0e86('0x25')]({'where':{'ChanSpyId':_0x3a2e4a['id']}})[_0x0e86('0x1c')](function(){return getChanSpyPromise(_0x122cd2,_0x3a2e4a);})[_0x0e86('0x1c')](function(_0x1a7f77){if(_0x1a7f77&&_0x1a7f77['length']){return _0x122cd2['VoiceExtension'][_0x0e86('0x24')](_0x1a7f77);}})[_0x0e86('0x1c')](function(){_0x5b483f();})[_0x0e86('0x1d')](function(_0xfd3577){_0x5b483f(_0xfd3577);});},'afterDestroy':function(_0x40519b,_0x53139c,_0x2194fd){return _0x122cd2[_0x0e86('0x23')][_0x0e86('0x25')]({'where':{'ChanSpyId':_0x40519b['id']}})[_0x0e86('0x1c')](function(){_0x2194fd();})['catch'](function(_0x12e8ab){_0x2194fd(_0x12e8ab);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 0e84b80..a17cf09 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.rpc.js +++ b/server/api/voiceChanSpy/voiceChanSpy.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x950d=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x950d,0x1a6));var _0xd950=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x950d[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xd950('0x0'));var util=require(_0xd950('0x1'));var moment=require(_0xd950('0x2'));var BPromise=require(_0xd950('0x3'));var rs=require(_0xd950('0x4'));var fs=require('fs');var Redis=require(_0xd950('0x5'));var db=require(_0xd950('0x6'))['db'];var utils=require(_0xd950('0x7'));var logger=require('../../config/logger')(_0xd950('0x8'));var config=require(_0xd950('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd950('0xa')][_0xd950('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f1a37,_0x21bfa2,_0xc54150){return new BPromise(function(_0x3e2787,_0x4a403c){return client[_0xd950('0xc')](_0x3f1a37,_0xc54150)[_0xd950('0xd')](function(_0x3ca482){logger[_0xd950('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x21bfa2,_0xd950('0xf'));logger['debug'](_0xd950('0x10'),_0x21bfa2,_0xd950('0xf'),JSON[_0xd950('0x11')](_0x3ca482));if(_0x3ca482['error']){if(_0x3ca482[_0xd950('0x12')]['code']===0x1f4){logger['error'](_0xd950('0x13'),_0x21bfa2,_0x3ca482[_0xd950('0x12')]['message']);return _0x4a403c(_0x3ca482['error'][_0xd950('0x14')]);}logger[_0xd950('0x12')](_0xd950('0x13'),_0x21bfa2,_0x3ca482[_0xd950('0x12')]['message']);return _0x3e2787(_0x3ca482[_0xd950('0x12')][_0xd950('0x14')]);}else{logger[_0xd950('0xe')](_0xd950('0x13'),_0x21bfa2,_0xd950('0xf'));_0x3e2787(_0x3ca482[_0xd950('0x15')][_0xd950('0x14')]);}})[_0xd950('0x16')](function(_0x3aa7b1){logger[_0xd950('0x12')](_0xd950('0x13'),_0x21bfa2,_0x3aa7b1);_0x4a403c(_0x3aa7b1);});});} \ No newline at end of file +var _0xa20b=['util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0xa20b,0x18f));var _0xba20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa20b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xba20('0x0'));var util=require(_0xba20('0x1'));var moment=require('moment');var BPromise=require(_0xba20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba20('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xba20('0x4'))('rpc');var config=require(_0xba20('0x5'));var jayson=require(_0xba20('0x6'));var client=jayson[_0xba20('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d4de8,_0x325abe,_0x49b483){return new BPromise(function(_0x2373ec,_0x7efb30){return client[_0xba20('0x8')](_0x5d4de8,_0x49b483)[_0xba20('0x9')](function(_0x388191){logger['info'](_0xba20('0xa'),_0x325abe,_0xba20('0xb'));logger[_0xba20('0xc')](_0xba20('0xd'),_0x325abe,_0xba20('0xb'),JSON[_0xba20('0xe')](_0x388191));if(_0x388191[_0xba20('0xf')]){if(_0x388191[_0xba20('0xf')][_0xba20('0x10')]===0x1f4){logger['error'](_0xba20('0xa'),_0x325abe,_0x388191[_0xba20('0xf')][_0xba20('0x11')]);return _0x7efb30(_0x388191[_0xba20('0xf')][_0xba20('0x11')]);}logger[_0xba20('0xf')](_0xba20('0xa'),_0x325abe,_0x388191[_0xba20('0xf')][_0xba20('0x11')]);return _0x2373ec(_0x388191[_0xba20('0xf')][_0xba20('0x11')]);}else{logger['info'](_0xba20('0xa'),_0x325abe,_0xba20('0xb'));_0x2373ec(_0x388191[_0xba20('0x12')][_0xba20('0x11')]);}})[_0xba20('0x13')](function(_0x5bee0a){logger[_0xba20('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x325abe,_0x5bee0a);_0x7efb30(_0x5bee0a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4379a6d..933f3da 100644 --- a/server/api/voiceContext/index.js +++ b/server/api/voiceContext/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9633=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceContext.controller','index','get','/:id','isAuthenticated','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9633,0x133));var _0x3963=function(_0x2b18f2,_0xccf589){_0x2b18f2=_0x2b18f2-0x0;var _0x4ed53d=_0x9633[_0x2b18f2];return _0x4ed53d;};'use strict';var multer=require(_0x3963('0x0'));var util=require(_0x3963('0x1'));var path=require('path');var timeout=require(_0x3963('0x2'));var express=require(_0x3963('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3963('0x4'));var config=require(_0x3963('0x5'));var controller=require(_0x3963('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3963('0x7')]);router[_0x3963('0x8')](_0x3963('0x9'),auth[_0x3963('0xa')](),controller['show']);router[_0x3963('0xb')]('/',auth[_0x3963('0xa')](),controller[_0x3963('0xc')]);router[_0x3963('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3963('0xe')]);router[_0x3963('0xf')](_0x3963('0x9'),auth[_0x3963('0xa')](),controller['destroy']);module[_0x3963('0x10')]=router; \ No newline at end of file +var _0xd238=['multer','connect-timeout','express','../../components/auth/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','exports'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xd238,0x1ea));var _0x8d23=function(_0x2f9c2b,_0x3151de){_0x2f9c2b=_0x2f9c2b-0x0;var _0x2b0fc6=_0xd238[_0x2f9c2b];return _0x2b0fc6;};'use strict';var multer=require(_0x8d23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8d23('0x1'));var express=require(_0x8d23('0x2'));var router=express['Router']();var auth=require(_0x8d23('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8d23('0x4'));router[_0x8d23('0x5')]('/',auth[_0x8d23('0x6')](),controller[_0x8d23('0x7')]);router[_0x8d23('0x5')](_0x8d23('0x8'),auth[_0x8d23('0x6')](),controller[_0x8d23('0x9')]);router[_0x8d23('0xa')]('/',auth[_0x8d23('0x6')](),controller[_0x8d23('0xb')]);router['put'](_0x8d23('0x8'),auth[_0x8d23('0x6')](),controller[_0x8d23('0xc')]);router['delete']('/:id',auth[_0x8d23('0x6')](),controller['destroy']);module[_0x8d23('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index e4da252..5066056 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['name','sequelize','STRING'];(function(_0x50bfe8,_0x4a9f3c){var _0x3991d3=function(_0x442b20){while(--_0x442b20){_0x50bfe8['push'](_0x50bfe8['shift']());}};_0x3991d3(++_0x4a9f3c);}(_0x3e74,0x175));var _0x43e7=function(_0x1ed874,_0x8a6975){_0x1ed874=_0x1ed874-0x0;var _0xa735a0=_0x3e74[_0x1ed874];return _0xa735a0;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x3e74,0x175));var _0x43e7=function(_0x3b20c1,_0x228c02){_0x3b20c1=_0x3b20c1-0x0;var _0x405901=_0x3e74[_0x3b20c1];return _0x405901;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 2777743..5bf4530 100644 --- a/server/api/voiceContext/voiceContext.controller.js +++ b/server/api/voiceContext/voiceContext.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3ed=['index','map','VoiceContext','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','params','length','include','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','client','then','info','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','json','count','limit','Content-Range','update','destroy','get','Contexts','UserProfileResource','end','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3ed,0x8d));var _0xde3e=function(_0x4342f7,_0x2cc689){_0x4342f7=_0x4342f7-0x0;var _0x369003=_0xe3ed[_0x4342f7];return _0x369003;};'use strict';var pdf=require(_0xde3e('0x0'));var emlformat=require(_0xde3e('0x1'));var rimraf=require(_0xde3e('0x2'));var zipdir=require(_0xde3e('0x3'));var jsonpatch=require(_0xde3e('0x4'));var rp=require(_0xde3e('0x5'));var moment=require(_0xde3e('0x6'));var BPromise=require(_0xde3e('0x7'));var Mustache=require('mustache');var util=require(_0xde3e('0x8'));var path=require(_0xde3e('0x9'));var sox=require('sox');var csv=require(_0xde3e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xde3e('0xb'));var squel=require(_0xde3e('0xc'));var crypto=require('crypto');var jsforce=require(_0xde3e('0xd'));var deskjs=require(_0xde3e('0xe'));var toCsv=require(_0xde3e('0xa'));var querystring=require(_0xde3e('0xf'));var Papa=require(_0xde3e('0x10'));var Redis=require('ioredis');var authService=require(_0xde3e('0x11'));var qs=require(_0xde3e('0x12'));var as=require(_0xde3e('0x13'));var hardwareService=require(_0xde3e('0x14'));var logger=require('../../config/logger')(_0xde3e('0x15'));var utils=require(_0xde3e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xde3e('0x17'));var db=require(_0xde3e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xde3e('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cdf9c,_0x3574ab,_0x3f67c2,_0x4fe882){return new BPromise(function(_0x167fa7,_0x1fee7b){var _0x5ddb5a=_0x4fe882||client;return _0x5ddb5a['request'](_0x2cdf9c,_0x3f67c2)[_0xde3e('0x1a')](function(_0x11db96){logger[_0xde3e('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x3574ab,'request\x20sent');logger[_0xde3e('0x1c')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3574ab,'request\x20sent',JSON[_0xde3e('0x1d')](_0x11db96));if(_0x11db96[_0xde3e('0x1e')]){if(_0x11db96['error'][_0xde3e('0x1f')]===0x1f4){logger[_0xde3e('0x1e')](_0xde3e('0x20'),_0x3574ab,_0x11db96['error']['message']);return _0x1fee7b(_0x11db96['error'][_0xde3e('0x21')]);}logger[_0xde3e('0x1e')](_0xde3e('0x20'),_0x3574ab,_0x11db96['error'][_0xde3e('0x21')]);return _0x167fa7(_0x11db96[_0xde3e('0x1e')][_0xde3e('0x21')]);}else{logger[_0xde3e('0x1b')](_0xde3e('0x20'),_0x3574ab,_0xde3e('0x22'));_0x167fa7(_0x11db96[_0xde3e('0x23')][_0xde3e('0x21')]);}})[_0xde3e('0x24')](function(_0x5a1c6c){logger[_0xde3e('0x1e')](_0xde3e('0x20'),_0x3574ab,_0x5a1c6c);_0x1fee7b(_0x5a1c6c);});});}function respondWithStatusCode(_0x37615f,_0x57df9e){_0x57df9e=_0x57df9e||0xcc;return function(_0x361511){if(_0x361511){return _0x37615f[_0xde3e('0x25')](_0x57df9e);}return _0x37615f[_0xde3e('0x26')](_0x57df9e)['end']();};}function respondWithResult(_0x2103da,_0x78647){_0x78647=_0x78647||0xc8;return function(_0x1d9432){if(_0x1d9432){return _0x2103da[_0xde3e('0x26')](_0x78647)[_0xde3e('0x27')](_0x1d9432);}};}function respondWithFilteredResult(_0x5ec4b6,_0x5313cb){return function(_0x6c0db0){if(_0x6c0db0){var _0x27ee92=_0x6c0db0[_0xde3e('0x28')],_0x40b702=_0x5313cb['offset'],_0x4d2176=_0x5313cb['offset']+_0x5313cb[_0xde3e('0x29')],_0x3d1404;if(_0x4d2176>=_0x27ee92){_0x4d2176=_0x27ee92;_0x3d1404=0xc8;}else{_0x3d1404=0xce;}_0x5ec4b6[_0xde3e('0x26')](_0x3d1404);return _0x5ec4b6['set'](_0xde3e('0x2a'),_0x40b702+'-'+_0x4d2176+'/'+_0x27ee92)[_0xde3e('0x27')](_0x6c0db0);}return null;};}function patchUpdates(_0x46db9d){return function(_0x5d4742){try{jsonpatch['apply'](_0x5d4742,_0x46db9d,!![]);}catch(_0x29bbcf){return BPromise['reject'](_0x29bbcf);}return _0x5d4742['save']();};}function saveUpdates(_0x2c4548,_0x3657d1){return function(_0x23c798){if(_0x23c798){return _0x23c798[_0xde3e('0x2b')](_0x2c4548)[_0xde3e('0x1a')](function(_0x3686a0){return _0x3686a0;});}return null;};}function removeEntity(_0x379e65,_0x29161d){return function(_0x393f9a){if(_0x393f9a){return _0x393f9a[_0xde3e('0x2c')]()[_0xde3e('0x1a')](function(){var _0x39a4cb=_0x393f9a[_0xde3e('0x2d')]({'plain':!![]});var _0x21d9f5=_0xde3e('0x2e');return db[_0xde3e('0x2f')][_0xde3e('0x2c')]({'where':{'type':_0x21d9f5,'resourceId':_0x39a4cb['id']}})['then'](function(){return _0x393f9a;});})[_0xde3e('0x1a')](function(){_0x379e65[_0xde3e('0x26')](0xcc)[_0xde3e('0x30')]();});}};}function handleEntityNotFound(_0x33128e,_0x152e63){return function(_0x30a2f6){if(!_0x30a2f6){_0x33128e[_0xde3e('0x25')](0x194);}return _0x30a2f6;};}function handleError(_0x3432aa,_0x4a541c){_0x4a541c=_0x4a541c||0x1f4;return function(_0x50f1e3){logger[_0xde3e('0x1e')](_0x50f1e3['stack']);if(_0x50f1e3['name']){delete _0x50f1e3[_0xde3e('0x31')];}_0x3432aa[_0xde3e('0x26')](_0x4a541c)[_0xde3e('0x32')](_0x50f1e3);};}exports[_0xde3e('0x33')]=function(_0x1c6122,_0x3f8a51){var _0x5155ce={},_0x4c9aa0={},_0x325289={'count':0x0,'rows':[]};var _0x24adee=_[_0xde3e('0x34')](db[_0xde3e('0x35')][_0xde3e('0x36')],function(_0x3bf3f8){return{'name':_0x3bf3f8['fieldName'],'type':_0x3bf3f8[_0xde3e('0x37')]['key']};});_0x4c9aa0[_0xde3e('0x38')]=_[_0xde3e('0x34')](_0x24adee,_0xde3e('0x31'));_0x4c9aa0[_0xde3e('0x39')]=_['keys'](_0x1c6122[_0xde3e('0x39')]);_0x4c9aa0[_0xde3e('0x3a')]=_['intersection'](_0x4c9aa0[_0xde3e('0x38')],_0x4c9aa0[_0xde3e('0x39')]);_0x5155ce[_0xde3e('0x3b')]=_[_0xde3e('0x3c')](_0x4c9aa0[_0xde3e('0x38')],qs[_0xde3e('0x3d')](_0x1c6122[_0xde3e('0x39')][_0xde3e('0x3d')]));_0x5155ce[_0xde3e('0x3b')]=_0x5155ce[_0xde3e('0x3b')]['length']?_0x5155ce[_0xde3e('0x3b')]:_0x4c9aa0['model'];if(!_0x1c6122[_0xde3e('0x39')][_0xde3e('0x3e')](_0xde3e('0x3f'))){_0x5155ce[_0xde3e('0x29')]=qs[_0xde3e('0x29')](_0x1c6122[_0xde3e('0x39')][_0xde3e('0x29')]);_0x5155ce['offset']=qs[_0xde3e('0x40')](_0x1c6122[_0xde3e('0x39')][_0xde3e('0x40')]);}_0x5155ce['order']=qs[_0xde3e('0x41')](_0x1c6122[_0xde3e('0x39')][_0xde3e('0x41')]);_0x5155ce['where']=qs[_0xde3e('0x3a')](_[_0xde3e('0x42')](_0x1c6122[_0xde3e('0x39')],_0x4c9aa0[_0xde3e('0x3a')]),_0x24adee);if(_0x1c6122['query'][_0xde3e('0x43')]){_0x5155ce[_0xde3e('0x44')]=_['merge'](_0x5155ce[_0xde3e('0x44')],{'$or':_[_0xde3e('0x34')](_0x24adee,function(_0x11aa12){if(_0x11aa12['type']!==_0xde3e('0x45')){var _0x541622={};_0x541622[_0x11aa12['name']]={'$like':'%'+_0x1c6122['query']['filter']+'%'};return _0x541622;}})});}_0x5155ce=_[_0xde3e('0x46')]({},_0x5155ce,_0x1c6122[_0xde3e('0x47')]);var _0x5e8895={'where':_0x5155ce['where']};return db[_0xde3e('0x35')]['count'](_0x5e8895)[_0xde3e('0x1a')](function(_0x4f5672){_0x325289['count']=_0x4f5672;if(_0x1c6122[_0xde3e('0x39')]['includeAll']){_0x5155ce['include']=[{'all':!![]}];}return db[_0xde3e('0x35')][_0xde3e('0x48')](_0x5155ce);})[_0xde3e('0x1a')](function(_0xc45e52){_0x325289[_0xde3e('0x49')]=_0xc45e52;return _0x325289;})[_0xde3e('0x1a')](respondWithFilteredResult(_0x3f8a51,_0x5155ce))['catch'](handleError(_0x3f8a51,null));};exports['show']=function(_0x117ab6,_0x66449d){var _0x2f2001={'raw':![],'where':{'id':_0x117ab6[_0xde3e('0x4a')]['id']}},_0x5e6121={};_0x5e6121[_0xde3e('0x38')]=_['keys'](db[_0xde3e('0x35')][_0xde3e('0x36')]);_0x5e6121[_0xde3e('0x39')]=_['keys'](_0x117ab6[_0xde3e('0x39')]);_0x5e6121[_0xde3e('0x3a')]=_[_0xde3e('0x3c')](_0x5e6121[_0xde3e('0x38')],_0x5e6121[_0xde3e('0x39')]);_0x2f2001[_0xde3e('0x3b')]=_[_0xde3e('0x3c')](_0x5e6121[_0xde3e('0x38')],qs['fields'](_0x117ab6[_0xde3e('0x39')]['fields']));_0x2f2001[_0xde3e('0x3b')]=_0x2f2001[_0xde3e('0x3b')][_0xde3e('0x4b')]?_0x2f2001[_0xde3e('0x3b')]:_0x5e6121[_0xde3e('0x38')];if(_0x117ab6[_0xde3e('0x39')]['includeAll']){_0x2f2001[_0xde3e('0x4c')]=[{'all':!![]}];}_0x2f2001=_['merge']({},_0x2f2001,_0x117ab6[_0xde3e('0x47')]);return db[_0xde3e('0x35')][_0xde3e('0x4d')](_0x2f2001)['then'](handleEntityNotFound(_0x66449d,null))['then'](respondWithResult(_0x66449d,null))[_0xde3e('0x24')](handleError(_0x66449d,null));};exports[_0xde3e('0x4e')]=function(_0x2ebc87,_0x3fd6e0,_0x3cb739){var _0x39fc82;return db[_0xde3e('0x35')][_0xde3e('0x4e')](_0x2ebc87[_0xde3e('0x4f')],{'raw':!![]})[_0xde3e('0x1a')](function(_0x1c9eff){_0x39fc82=_0x1c9eff;return db['VoiceContext'][_0xde3e('0x48')]({'raw':!![]});})['then'](function(_0x1c233f){var _0x3cc206=fs[_0xde3e('0x50')](path[_0xde3e('0x51')](config['root'],_0xde3e('0x52')),_0xde3e('0x53'));var _0x1a829e=ejs[_0xde3e('0x54')](_0x3cc206,{'contexts':_0x1c233f||[]});fs[_0xde3e('0x55')](_0xde3e('0x56'),_0x1a829e);})[_0xde3e('0x1a')](function(){return respondWithRpcPromise(_0xde3e('0x57'),_0xde3e('0x4e'),{'module':_0xde3e('0x58')});})[_0xde3e('0x1a')](function(){var _0x2ee59c=_0x2ebc87[_0xde3e('0x59')]['get']({'plain':!![]});if(!_0x2ee59c)throw new Error(_0xde3e('0x5a'));if(_0x2ee59c[_0xde3e('0x5b')]===_0xde3e('0x59')){var _0x1ffa87=_0x39fc82[_0xde3e('0x2d')]({'plain':!![]});return db[_0xde3e('0x5c')][_0xde3e('0x4d')]({'where':{'name':_0xde3e('0x2e'),'userProfileId':_0x2ee59c['userProfileId']},'raw':!![]})[_0xde3e('0x1a')](function(_0xb7cc23){if(_0xb7cc23&&_0xb7cc23[_0xde3e('0x5d')]===0x0){return db[_0xde3e('0x2f')][_0xde3e('0x4e')]({'name':_0x1ffa87[_0xde3e('0x31')],'resourceId':_0x1ffa87['id'],'type':_0xb7cc23[_0xde3e('0x31')],'sectionId':_0xb7cc23['id']},{})['then'](function(){return _0x39fc82;});}else{return _0x39fc82;}})['catch'](function(_0x4e7a8d){logger[_0xde3e('0x1e')](_0xde3e('0x5e'),_0x4e7a8d);throw _0x4e7a8d;});}return _0x39fc82;})[_0xde3e('0x1a')](respondWithResult(_0x3fd6e0,0xc9))[_0xde3e('0x24')](handleError(_0x3fd6e0,null));};exports[_0xde3e('0x2b')]=function(_0x1da4c3,_0x44de4e,_0x398f33){var _0x14a022;return db[_0xde3e('0x35')]['find']({'where':{'id':_0x1da4c3[_0xde3e('0x4a')]['id']}})[_0xde3e('0x1a')](handleEntityNotFound(_0x44de4e,null))['then'](saveUpdates(_0x1da4c3['body'],null))[_0xde3e('0x1a')](function(_0x1c2ee1){if(_0x1c2ee1){_0x14a022=_0x1c2ee1;return db[_0xde3e('0x35')][_0xde3e('0x48')]({'raw':!![]});}})[_0xde3e('0x1a')](function(_0x2fd43b){var _0x3c8a90=fs[_0xde3e('0x50')](path[_0xde3e('0x51')](config[_0xde3e('0x5f')],'server/files/templates/context.ejs'),_0xde3e('0x53'));var _0x388ffe=ejs[_0xde3e('0x54')](_0x3c8a90,{'contexts':_0x2fd43b||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x388ffe);})[_0xde3e('0x1a')](function(){return respondWithRpcPromise('Reload',_0xde3e('0x2b'),{'module':'chan_sip.so'});})[_0xde3e('0x1a')](function(){return _0x14a022;})[_0xde3e('0x1a')](respondWithResult(_0x44de4e,null))['catch'](handleError(_0x44de4e,null));};exports['destroy']=function(_0x3178c9,_0x50259c,_0x2c1913){var _0x10d731;return db[_0xde3e('0x35')]['find']({'where':{'id':_0x3178c9['params']['id']}})['then'](handleEntityNotFound(_0x50259c,null))[_0xde3e('0x1a')](removeEntity(_0x50259c,null))[_0xde3e('0x1a')](function(){return db['VoiceContext'][_0xde3e('0x48')]({'raw':!![]});})[_0xde3e('0x1a')](function(_0x4907e9){var _0x3a7775=fs[_0xde3e('0x50')](path[_0xde3e('0x51')](config['root'],_0xde3e('0x52')),_0xde3e('0x53'));var _0x4b0fe6=ejs[_0xde3e('0x54')](_0x3a7775,{'contexts':_0x4907e9});fs[_0xde3e('0x55')](_0xde3e('0x56'),_0x4b0fe6);return respondWithRpcPromise('Reload',_0xde3e('0x2c'),{'module':_0xde3e('0x58')});})[_0xde3e('0x24')](handleError(_0x50259c,null));}; \ No newline at end of file +var _0x7b05=['then','get','Contexts','UserProfileResource','sendStatus','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','merge','where','options','includeAll','include','findAll','show','params','find','create','body','readFileSync','root','utf8','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','join','server/files/templates/context.ejs','render','Reload','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','Content-Range','save','update','destroy'];(function(_0x2b053d,_0x5ccc5c){var _0x3b9030=function(_0x22016e){while(--_0x22016e){_0x2b053d['push'](_0x2b053d['shift']());}};_0x3b9030(++_0x5ccc5c);}(_0x7b05,0x91));var _0x57b0=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0x7b05[_0x1a89ca];return _0x29cbb2;};'use strict';var pdf=require(_0x57b0('0x0'));var emlformat=require(_0x57b0('0x1'));var rimraf=require(_0x57b0('0x2'));var zipdir=require(_0x57b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57b0('0x4'));var moment=require('moment');var BPromise=require(_0x57b0('0x5'));var Mustache=require(_0x57b0('0x6'));var util=require(_0x57b0('0x7'));var path=require(_0x57b0('0x8'));var sox=require(_0x57b0('0x9'));var csv=require('to-csv');var ejs=require(_0x57b0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var licenseUtil=require(_0x57b0('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x57b0('0x15'));var client=jayson[_0x57b0('0x16')][_0x57b0('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x520f45,_0x575901,_0x6d060a,_0x3f95e3){return new BPromise(function(_0xc9044f,_0x3b48a3){var _0x564b15=_0x3f95e3||client;return _0x564b15[_0x57b0('0x18')](_0x520f45,_0x6d060a)['then'](function(_0x235d4a){logger[_0x57b0('0x19')]('VoiceContext,\x20%s,\x20%s',_0x575901,_0x57b0('0x1a'));logger[_0x57b0('0x1b')](_0x57b0('0x1c'),_0x575901,_0x57b0('0x1a'),JSON[_0x57b0('0x1d')](_0x235d4a));if(_0x235d4a['error']){if(_0x235d4a[_0x57b0('0x1e')]['code']===0x1f4){logger['error'](_0x57b0('0x1f'),_0x575901,_0x235d4a[_0x57b0('0x1e')][_0x57b0('0x20')]);return _0x3b48a3(_0x235d4a[_0x57b0('0x1e')][_0x57b0('0x20')]);}logger[_0x57b0('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x575901,_0x235d4a[_0x57b0('0x1e')][_0x57b0('0x20')]);return _0xc9044f(_0x235d4a[_0x57b0('0x1e')]['message']);}else{logger[_0x57b0('0x19')](_0x57b0('0x1f'),_0x575901,_0x57b0('0x1a'));_0xc9044f(_0x235d4a[_0x57b0('0x21')][_0x57b0('0x20')]);}})[_0x57b0('0x22')](function(_0x29cf6f){logger[_0x57b0('0x1e')](_0x57b0('0x1f'),_0x575901,_0x29cf6f);_0x3b48a3(_0x29cf6f);});});}function respondWithStatusCode(_0x5c60b9,_0x55b870){_0x55b870=_0x55b870||0xcc;return function(_0x40c279){if(_0x40c279){return _0x5c60b9['sendStatus'](_0x55b870);}return _0x5c60b9[_0x57b0('0x23')](_0x55b870)[_0x57b0('0x24')]();};}function respondWithResult(_0x11514c,_0x38e3a0){_0x38e3a0=_0x38e3a0||0xc8;return function(_0x3e75e8){if(_0x3e75e8){return _0x11514c[_0x57b0('0x23')](_0x38e3a0)[_0x57b0('0x25')](_0x3e75e8);}};}function respondWithFilteredResult(_0x1eb523,_0xacd07c){return function(_0x109678){if(_0x109678){var _0x3e4e5f=_0x109678[_0x57b0('0x26')],_0x43b90f=_0xacd07c[_0x57b0('0x27')],_0x196c85=_0xacd07c[_0x57b0('0x27')]+_0xacd07c[_0x57b0('0x28')],_0x508288;if(_0x196c85>=_0x3e4e5f){_0x196c85=_0x3e4e5f;_0x508288=0xc8;}else{_0x508288=0xce;}_0x1eb523['status'](_0x508288);return _0x1eb523['set'](_0x57b0('0x29'),_0x43b90f+'-'+_0x196c85+'/'+_0x3e4e5f)[_0x57b0('0x25')](_0x109678);}return null;};}function patchUpdates(_0x1ccf42){return function(_0x5958a8){try{jsonpatch['apply'](_0x5958a8,_0x1ccf42,!![]);}catch(_0x9d9195){return BPromise['reject'](_0x9d9195);}return _0x5958a8[_0x57b0('0x2a')]();};}function saveUpdates(_0x5b6c1d,_0x5d19a6){return function(_0x2fb4b7){if(_0x2fb4b7){return _0x2fb4b7[_0x57b0('0x2b')](_0x5b6c1d)['then'](function(_0x17ac64){return _0x17ac64;});}return null;};}function removeEntity(_0x32e03e,_0x55ca86){return function(_0x16d6e1){if(_0x16d6e1){return _0x16d6e1[_0x57b0('0x2c')]()[_0x57b0('0x2d')](function(){var _0x547ea6=_0x16d6e1[_0x57b0('0x2e')]({'plain':!![]});var _0x1df6cd=_0x57b0('0x2f');return db[_0x57b0('0x30')][_0x57b0('0x2c')]({'where':{'type':_0x1df6cd,'resourceId':_0x547ea6['id']}})['then'](function(){return _0x16d6e1;});})['then'](function(){_0x32e03e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2df3b,_0xb44fff){return function(_0x1592ac){if(!_0x1592ac){_0xe2df3b[_0x57b0('0x31')](0x194);}return _0x1592ac;};}function handleError(_0x46513d,_0x4ba453){_0x4ba453=_0x4ba453||0x1f4;return function(_0x85fdfe){logger[_0x57b0('0x1e')](_0x85fdfe[_0x57b0('0x32')]);if(_0x85fdfe[_0x57b0('0x33')]){delete _0x85fdfe['name'];}_0x46513d[_0x57b0('0x23')](_0x4ba453)[_0x57b0('0x34')](_0x85fdfe);};}exports['index']=function(_0xbf8d86,_0x530d66){var _0x4bd714={},_0x5ba34c={},_0x223484={'count':0x0,'rows':[]};var _0x1b1d95=_[_0x57b0('0x35')](db[_0x57b0('0x36')][_0x57b0('0x37')],function(_0x43ca03){return{'name':_0x43ca03[_0x57b0('0x38')],'type':_0x43ca03[_0x57b0('0x39')][_0x57b0('0x3a')]};});_0x5ba34c[_0x57b0('0x3b')]=_[_0x57b0('0x35')](_0x1b1d95,_0x57b0('0x33'));_0x5ba34c['query']=_[_0x57b0('0x3c')](_0xbf8d86[_0x57b0('0x3d')]);_0x5ba34c[_0x57b0('0x3e')]=_['intersection'](_0x5ba34c['model'],_0x5ba34c['query']);_0x4bd714[_0x57b0('0x3f')]=_[_0x57b0('0x40')](_0x5ba34c[_0x57b0('0x3b')],qs[_0x57b0('0x41')](_0xbf8d86['query'][_0x57b0('0x41')]));_0x4bd714[_0x57b0('0x3f')]=_0x4bd714['attributes'][_0x57b0('0x42')]?_0x4bd714[_0x57b0('0x3f')]:_0x5ba34c[_0x57b0('0x3b')];if(!_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x43')]('nolimit')){_0x4bd714[_0x57b0('0x28')]=qs[_0x57b0('0x28')](_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x28')]);_0x4bd714['offset']=qs['offset'](_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x27')]);}_0x4bd714['order']=qs[_0x57b0('0x44')](_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x44')]);_0x4bd714['where']=qs['filters'](_[_0x57b0('0x45')](_0xbf8d86[_0x57b0('0x3d')],_0x5ba34c[_0x57b0('0x3e')]),_0x1b1d95);if(_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x46')]){_0x4bd714['where']=_[_0x57b0('0x47')](_0x4bd714[_0x57b0('0x48')],{'$or':_[_0x57b0('0x35')](_0x1b1d95,function(_0x308c08){if(_0x308c08[_0x57b0('0x39')]!=='VIRTUAL'){var _0x531ac1={};_0x531ac1[_0x308c08['name']]={'$like':'%'+_0xbf8d86['query'][_0x57b0('0x46')]+'%'};return _0x531ac1;}})});}_0x4bd714=_[_0x57b0('0x47')]({},_0x4bd714,_0xbf8d86[_0x57b0('0x49')]);var _0x2af039={'where':_0x4bd714[_0x57b0('0x48')]};return db[_0x57b0('0x36')][_0x57b0('0x26')](_0x2af039)['then'](function(_0x39a393){_0x223484[_0x57b0('0x26')]=_0x39a393;if(_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x4a')]){_0x4bd714[_0x57b0('0x4b')]=[{'all':!![]}];}return db[_0x57b0('0x36')][_0x57b0('0x4c')](_0x4bd714);})['then'](function(_0x25e952){_0x223484['rows']=_0x25e952;return _0x223484;})[_0x57b0('0x2d')](respondWithFilteredResult(_0x530d66,_0x4bd714))['catch'](handleError(_0x530d66,null));};exports[_0x57b0('0x4d')]=function(_0x5cae47,_0x40dae2){var _0x464a50={'raw':![],'where':{'id':_0x5cae47[_0x57b0('0x4e')]['id']}},_0x554a36={};_0x554a36[_0x57b0('0x3b')]=_[_0x57b0('0x3c')](db['VoiceContext'][_0x57b0('0x37')]);_0x554a36[_0x57b0('0x3d')]=_['keys'](_0x5cae47[_0x57b0('0x3d')]);_0x554a36[_0x57b0('0x3e')]=_['intersection'](_0x554a36[_0x57b0('0x3b')],_0x554a36[_0x57b0('0x3d')]);_0x464a50[_0x57b0('0x3f')]=_[_0x57b0('0x40')](_0x554a36[_0x57b0('0x3b')],qs['fields'](_0x5cae47['query'][_0x57b0('0x41')]));_0x464a50[_0x57b0('0x3f')]=_0x464a50[_0x57b0('0x3f')]['length']?_0x464a50[_0x57b0('0x3f')]:_0x554a36[_0x57b0('0x3b')];if(_0x5cae47[_0x57b0('0x3d')][_0x57b0('0x4a')]){_0x464a50[_0x57b0('0x4b')]=[{'all':!![]}];}_0x464a50=_[_0x57b0('0x47')]({},_0x464a50,_0x5cae47[_0x57b0('0x49')]);return db[_0x57b0('0x36')][_0x57b0('0x4f')](_0x464a50)[_0x57b0('0x2d')](handleEntityNotFound(_0x40dae2,null))[_0x57b0('0x2d')](respondWithResult(_0x40dae2,null))[_0x57b0('0x22')](handleError(_0x40dae2,null));};exports[_0x57b0('0x50')]=function(_0x3f5b87,_0x89e2e1,_0xfabe8){var _0x31265e;return db[_0x57b0('0x36')]['create'](_0x3f5b87[_0x57b0('0x51')],{'raw':!![]})[_0x57b0('0x2d')](function(_0x439101){_0x31265e=_0x439101;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x57b0('0x2d')](function(_0x5a33a1){var _0x5acb94=fs[_0x57b0('0x52')](path['join'](config[_0x57b0('0x53')],'server/files/templates/context.ejs'),_0x57b0('0x54'));var _0xa97db6=ejs['render'](_0x5acb94,{'contexts':_0x5a33a1||[]});fs['writeFileSync'](_0x57b0('0x55'),_0xa97db6);})[_0x57b0('0x2d')](function(){return respondWithRpcPromise('Reload',_0x57b0('0x50'),{'module':_0x57b0('0x56')});})[_0x57b0('0x2d')](function(){var _0x3f490f=_0x3f5b87['user'][_0x57b0('0x2e')]({'plain':!![]});if(!_0x3f490f)throw new Error(_0x57b0('0x57'));if(_0x3f490f['role']===_0x57b0('0x58')){var _0x1d87b1=_0x31265e[_0x57b0('0x2e')]({'plain':!![]});return db['UserProfileSection'][_0x57b0('0x4f')]({'where':{'name':_0x57b0('0x2f'),'userProfileId':_0x3f490f[_0x57b0('0x59')]},'raw':!![]})['then'](function(_0x4b6d6f){if(_0x4b6d6f&&_0x4b6d6f[_0x57b0('0x5a')]===0x0){return db['UserProfileResource'][_0x57b0('0x50')]({'name':_0x1d87b1['name'],'resourceId':_0x1d87b1['id'],'type':_0x4b6d6f[_0x57b0('0x33')],'sectionId':_0x4b6d6f['id']},{})['then'](function(){return _0x31265e;});}else{return _0x31265e;}})['catch'](function(_0x323f57){logger[_0x57b0('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x323f57);throw _0x323f57;});}return _0x31265e;})['then'](respondWithResult(_0x89e2e1,0xc9))['catch'](handleError(_0x89e2e1,null));};exports[_0x57b0('0x2b')]=function(_0x3a01f3,_0x3f3031,_0x2ea329){var _0x5ca216;return db['VoiceContext'][_0x57b0('0x4f')]({'where':{'id':_0x3a01f3[_0x57b0('0x4e')]['id']}})[_0x57b0('0x2d')](handleEntityNotFound(_0x3f3031,null))[_0x57b0('0x2d')](saveUpdates(_0x3a01f3[_0x57b0('0x51')],null))[_0x57b0('0x2d')](function(_0x531bf2){if(_0x531bf2){_0x5ca216=_0x531bf2;return db[_0x57b0('0x36')][_0x57b0('0x4c')]({'raw':!![]});}})[_0x57b0('0x2d')](function(_0x3b2093){var _0x429219=fs['readFileSync'](path[_0x57b0('0x5b')](config[_0x57b0('0x53')],_0x57b0('0x5c')),_0x57b0('0x54'));var _0x2f7835=ejs[_0x57b0('0x5d')](_0x429219,{'contexts':_0x3b2093||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2f7835);})['then'](function(){return respondWithRpcPromise(_0x57b0('0x5e'),_0x57b0('0x2b'),{'module':'chan_sip.so'});})[_0x57b0('0x2d')](function(){return _0x5ca216;})[_0x57b0('0x2d')](respondWithResult(_0x3f3031,null))[_0x57b0('0x22')](handleError(_0x3f3031,null));};exports[_0x57b0('0x2c')]=function(_0x49f132,_0x4e04dd,_0x4ea35d){var _0x46d600;return db[_0x57b0('0x36')][_0x57b0('0x4f')]({'where':{'id':_0x49f132['params']['id']}})[_0x57b0('0x2d')](handleEntityNotFound(_0x4e04dd,null))['then'](removeEntity(_0x4e04dd,null))['then'](function(){return db['VoiceContext'][_0x57b0('0x4c')]({'raw':!![]});})['then'](function(_0x3363ed){var _0x9b131f=fs[_0x57b0('0x52')](path[_0x57b0('0x5b')](config[_0x57b0('0x53')],_0x57b0('0x5c')),_0x57b0('0x54'));var _0x417f42=ejs[_0x57b0('0x5d')](_0x9b131f,{'contexts':_0x3363ed});fs['writeFileSync'](_0x57b0('0x55'),_0x417f42);return respondWithRpcPromise(_0x57b0('0x5e'),_0x57b0('0x2c'),{'module':'chan_sip.so'});})[_0x57b0('0x22')](handleError(_0x4e04dd,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5f3f9ef..2cb075a 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03b3=['VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','define'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x03b3,0xc7));var _0x303b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x303b('0x0'));var util=require(_0x303b('0x1'));var logger=require(_0x303b('0x2'))(_0x303b('0x3'));var moment=require('moment');var BPromise=require(_0x303b('0x4'));var rp=require(_0x303b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x303b('0x6'));var config=require(_0x303b('0x7'));var attributes=require(_0x303b('0x8'));module['exports']=function(_0xd9c3d3,_0x2d5d3d){return _0xd9c3d3[_0x303b('0x9')](_0x303b('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6047=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x29cb61,_0x494484){var _0x21d3e0=function(_0x3e0ac4){while(--_0x3e0ac4){_0x29cb61['push'](_0x29cb61['shift']());}};_0x21d3e0(++_0x494484);}(_0x6047,0xd5));var _0x7604=function(_0x10fd3d,_0x1b2e1f){_0x10fd3d=_0x10fd3d-0x0;var _0x37b66f=_0x6047[_0x10fd3d];return _0x37b66f;};'use strict';var _=require('lodash');var util=require(_0x7604('0x0'));var logger=require(_0x7604('0x1'))(_0x7604('0x2'));var moment=require(_0x7604('0x3'));var BPromise=require(_0x7604('0x4'));var rp=require(_0x7604('0x5'));var fs=require('fs');var path=require(_0x7604('0x6'));var rimraf=require('rimraf');var config=require(_0x7604('0x7'));var attributes=require(_0x7604('0x8'));module[_0x7604('0x9')]=function(_0xcf6f3a,_0x512aef){return _0xcf6f3a[_0x7604('0xa')](_0x7604('0xb'),attributes,{'tableName':_0x7604('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index a2d3a74..af0447c 100644 --- a/server/api/voiceContext/voiceContext.rpc.js +++ b/server/api/voiceContext/voiceContext.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5418=['util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x57dbd4,_0x1191bb){var _0x34d5eb=function(_0x51d0ef){while(--_0x51d0ef){_0x57dbd4['push'](_0x57dbd4['shift']());}};_0x34d5eb(++_0x1191bb);}(_0x5418,0xc7));var _0x8541=function(_0x362699,_0x2e473b){_0x362699=_0x362699-0x0;var _0x109e33=_0x5418[_0x362699];return _0x109e33;};'use strict';var _=require(_0x8541('0x0'));var util=require(_0x8541('0x1'));var moment=require(_0x8541('0x2'));var BPromise=require(_0x8541('0x3'));var rs=require(_0x8541('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8541('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8541('0x6'));var jayson=require(_0x8541('0x7'));var client=jayson[_0x8541('0x8')][_0x8541('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x239f4f,_0x47d63f,_0x1fe8f1){return new BPromise(function(_0x266301,_0x3c27ba){return client['request'](_0x239f4f,_0x1fe8f1)['then'](function(_0x4a1beb){logger[_0x8541('0xa')]('VoiceContext,\x20%s,\x20%s',_0x47d63f,_0x8541('0xb'));logger[_0x8541('0xc')](_0x8541('0xd'),_0x47d63f,_0x8541('0xb'),JSON[_0x8541('0xe')](_0x4a1beb));if(_0x4a1beb['error']){if(_0x4a1beb['error']['code']===0x1f4){logger[_0x8541('0xf')](_0x8541('0x10'),_0x47d63f,_0x4a1beb[_0x8541('0xf')][_0x8541('0x11')]);return _0x3c27ba(_0x4a1beb[_0x8541('0xf')]['message']);}logger[_0x8541('0xf')](_0x8541('0x10'),_0x47d63f,_0x4a1beb[_0x8541('0xf')][_0x8541('0x11')]);return _0x266301(_0x4a1beb['error'][_0x8541('0x11')]);}else{logger[_0x8541('0xa')]('VoiceContext,\x20%s,\x20%s',_0x47d63f,_0x8541('0xb'));_0x266301(_0x4a1beb[_0x8541('0x12')]['message']);}})[_0x8541('0x13')](function(_0x4360e9){logger[_0x8541('0xf')](_0x8541('0x10'),_0x47d63f,_0x4360e9);_0x3c27ba(_0x4360e9);});});} \ No newline at end of file +var _0xbbb7=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbbb7,0x17d));var _0x7bbb=function(_0x4b0830,_0x2e3b0a){_0x4b0830=_0x4b0830-0x0;var _0x1f53a7=_0xbbb7[_0x4b0830];return _0x1f53a7;};'use strict';var _=require(_0x7bbb('0x0'));var util=require(_0x7bbb('0x1'));var moment=require(_0x7bbb('0x2'));var BPromise=require(_0x7bbb('0x3'));var rs=require(_0x7bbb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bbb('0x5'))['db'];var utils=require(_0x7bbb('0x6'));var logger=require('../../config/logger')(_0x7bbb('0x7'));var config=require('../../config/environment');var jayson=require(_0x7bbb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x435c4f,_0x3ffe91,_0x39103e){return new BPromise(function(_0x3e25aa,_0x910152){return client[_0x7bbb('0x9')](_0x435c4f,_0x39103e)[_0x7bbb('0xa')](function(_0x12a446){logger['info'](_0x7bbb('0xb'),_0x3ffe91,_0x7bbb('0xc'));logger[_0x7bbb('0xd')](_0x7bbb('0xe'),_0x3ffe91,_0x7bbb('0xc'),JSON['stringify'](_0x12a446));if(_0x12a446['error']){if(_0x12a446[_0x7bbb('0xf')][_0x7bbb('0x10')]===0x1f4){logger[_0x7bbb('0xf')]('VoiceContext,\x20%s,\x20%s',_0x3ffe91,_0x12a446['error'][_0x7bbb('0x11')]);return _0x910152(_0x12a446[_0x7bbb('0xf')][_0x7bbb('0x11')]);}logger[_0x7bbb('0xf')](_0x7bbb('0xb'),_0x3ffe91,_0x12a446[_0x7bbb('0xf')][_0x7bbb('0x11')]);return _0x3e25aa(_0x12a446[_0x7bbb('0xf')][_0x7bbb('0x11')]);}else{logger[_0x7bbb('0x12')](_0x7bbb('0xb'),_0x3ffe91,_0x7bbb('0xc'));_0x3e25aa(_0x12a446[_0x7bbb('0x13')][_0x7bbb('0x11')]);}})[_0x7bbb('0x14')](function(_0x411cdd){logger[_0x7bbb('0xf')](_0x7bbb('0xb'),_0x3ffe91,_0x411cdd);_0x910152(_0x411cdd);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 0545e41..8b8f141 100644 --- a/server/api/voiceDialReport/index.js +++ b/server/api/voiceDialReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38de=['describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3fc7e5,_0x1b4c48){var _0xc39d72=function(_0x35fa05){while(--_0x35fa05){_0x3fc7e5['push'](_0x3fc7e5['shift']());}};_0xc39d72(++_0x1b4c48);}(_0x38de,0x129));var _0xe38d=function(_0x57f178,_0x107b67){_0x57f178=_0x57f178-0x0;var _0x2dfe8e=_0x38de[_0x57f178];return _0x2dfe8e;};'use strict';var multer=require(_0xe38d('0x0'));var util=require(_0xe38d('0x1'));var path=require(_0xe38d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe38d('0x3'));var config=require(_0xe38d('0x4'));var controller=require('./voiceDialReport.controller');router[_0xe38d('0x5')]('/',auth[_0xe38d('0x6')](),controller[_0xe38d('0x7')]);router[_0xe38d('0x5')](_0xe38d('0x8'),auth[_0xe38d('0x6')](),controller[_0xe38d('0x9')]);router[_0xe38d('0x5')](_0xe38d('0xa'),auth[_0xe38d('0x6')](),controller['show']);router[_0xe38d('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe38d('0xc')](_0xe38d('0xa'),auth[_0xe38d('0x6')](),controller[_0xe38d('0xd')]);router[_0xe38d('0xe')](_0xe38d('0xa'),auth[_0xe38d('0x6')](),controller[_0xe38d('0xf')]);module[_0xe38d('0x10')]=router; \ No newline at end of file +var _0xe9bd=['isAuthenticated','index','describe','show','post','create','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get'];(function(_0x3df7c6,_0x5ade8c){var _0x21e2f7=function(_0x2f8808){while(--_0x2f8808){_0x3df7c6['push'](_0x3df7c6['shift']());}};_0x21e2f7(++_0x5ade8c);}(_0xe9bd,0x6a));var _0xde9b=function(_0xcc51d,_0x10c495){_0xcc51d=_0xcc51d-0x0;var _0x17d867=_0xe9bd[_0xcc51d];return _0x17d867;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde9b('0x0'));var timeout=require(_0xde9b('0x1'));var express=require(_0xde9b('0x2'));var router=express[_0xde9b('0x3')]();var auth=require(_0xde9b('0x4'));var interaction=require(_0xde9b('0x5'));var config=require('../../config/environment');var controller=require(_0xde9b('0x6'));router[_0xde9b('0x7')]('/',auth[_0xde9b('0x8')](),controller[_0xde9b('0x9')]);router[_0xde9b('0x7')]('/describe',auth[_0xde9b('0x8')](),controller[_0xde9b('0xa')]);router[_0xde9b('0x7')]('/:id',auth[_0xde9b('0x8')](),controller[_0xde9b('0xb')]);router[_0xde9b('0xc')]('/',auth['isAuthenticated'](),controller[_0xde9b('0xd')]);router['put']('/:id',auth[_0xde9b('0x8')](),controller[_0xde9b('0xe')]);router[_0xde9b('0xf')](_0xde9b('0x10'),auth[_0xde9b('0x8')](),controller[_0xde9b('0x11')]);module[_0xde9b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index eaf9e9e..aef1579 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ea3=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x1672ee,_0x409c0b){var _0x128b66=function(_0x191676){while(--_0x191676){_0x1672ee['push'](_0x1672ee['shift']());}};_0x128b66(++_0x409c0b);}(_0x0ea3,0xc3));var _0x30ea=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x0ea3[_0x420b24];return _0x4da552;};'use strict';var Sequelize=require(_0x30ea('0x0'));module[_0x30ea('0x1')]={'privilege':{'type':Sequelize[_0x30ea('0x2')]},'channel':{'type':Sequelize[_0x30ea('0x2')]},'channelstate':{'type':Sequelize[_0x30ea('0x3')]},'channelstatedesc':{'type':Sequelize[_0x30ea('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x30ea('0x2')]},'connectedlinenum':{'type':Sequelize[_0x30ea('0x2')]},'connectedlinename':{'type':Sequelize[_0x30ea('0x2')]},'language':{'type':Sequelize[_0x30ea('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x30ea('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x30ea('0x2')]},'linkedid':{'type':Sequelize[_0x30ea('0x2')]},'destchannel':{'type':Sequelize[_0x30ea('0x2')]},'destchannelstate':{'type':Sequelize[_0x30ea('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x30ea('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x30ea('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x30ea('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x30ea('0x2')]},'destlanguage':{'type':Sequelize[_0x30ea('0x2')]},'destaccountcode':{'type':Sequelize[_0x30ea('0x2')]},'destcontext':{'type':Sequelize[_0x30ea('0x2')]},'destexten':{'type':Sequelize[_0x30ea('0x2')]},'destpriority':{'type':Sequelize[_0x30ea('0x3')]},'destuniqueid':{'type':Sequelize[_0x30ea('0x2')]},'destlinkedid':{'type':Sequelize[_0x30ea('0x2')]},'dialstring':{'type':Sequelize[_0x30ea('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x30ea('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x30ea('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x30ea('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x30ea('0x3')]},'holdtime':{'type':Sequelize[_0x30ea('0x3')]},'billableseconds':{'type':Sequelize[_0x30ea('0x3')]}}; \ No newline at end of file +var _0xce13=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x584d0,_0x43c8fa){var _0xecb06d=function(_0x56a521){while(--_0x56a521){_0x584d0['push'](_0x584d0['shift']());}};_0xecb06d(++_0x43c8fa);}(_0xce13,0x74));var _0x3ce1=function(_0x1fda85,_0x52593f){_0x1fda85=_0x1fda85-0x0;var _0x5f41ae=_0xce13[_0x1fda85];return _0x5f41ae;};'use strict';var Sequelize=require(_0x3ce1('0x0'));module[_0x3ce1('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3ce1('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3ce1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3ce1('0x2')]},'connectedlinename':{'type':Sequelize[_0x3ce1('0x2')]},'language':{'type':Sequelize[_0x3ce1('0x2')]},'accountcode':{'type':Sequelize[_0x3ce1('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3ce1('0x2')]},'priority':{'type':Sequelize[_0x3ce1('0x3')]},'uniqueid':{'type':Sequelize[_0x3ce1('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x3ce1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x3ce1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3ce1('0x2')]},'destcalleridname':{'type':Sequelize[_0x3ce1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3ce1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3ce1('0x2')]},'destlanguage':{'type':Sequelize[_0x3ce1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x3ce1('0x2')]},'destexten':{'type':Sequelize[_0x3ce1('0x2')]},'destpriority':{'type':Sequelize[_0x3ce1('0x3')]},'destuniqueid':{'type':Sequelize[_0x3ce1('0x2')]},'destlinkedid':{'type':Sequelize[_0x3ce1('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x3ce1('0x2')]},'starttime':{'type':Sequelize[_0x3ce1('0x4')]},'answertime':{'type':Sequelize[_0x3ce1('0x4')]},'endtime':{'type':Sequelize[_0x3ce1('0x4')]},'lastevent':{'type':Sequelize[_0x3ce1('0x2')],'comment':_0x3ce1('0x5')},'routeId':{'type':Sequelize[_0x3ce1('0x3')]},'duration':{'type':Sequelize[_0x3ce1('0x3')]},'holdtime':{'type':Sequelize[_0x3ce1('0x3')]},'billableseconds':{'type':Sequelize[_0x3ce1('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e086bc2..391fa7e 100644 --- a/server/api/voiceDialReport/voiceDialReport.controller.js +++ b/server/api/voiceDialReport/voiceDialReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4209=['status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x40977c,_0x10bc83){var _0x31cfee=function(_0x4240e6){while(--_0x4240e6){_0x40977c['push'](_0x40977c['shift']());}};_0x31cfee(++_0x10bc83);}(_0x4209,0x1a1));var _0x9420=function(_0x3bd4e5,_0x33854f){_0x3bd4e5=_0x3bd4e5-0x0;var _0x2d1522=_0x4209[_0x3bd4e5];return _0x2d1522;};'use strict';var pdf=require(_0x9420('0x0'));var emlformat=require(_0x9420('0x1'));var rimraf=require(_0x9420('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9420('0x3'));var moment=require(_0x9420('0x4'));var BPromise=require(_0x9420('0x5'));var Mustache=require('mustache');var util=require(_0x9420('0x6'));var path=require(_0x9420('0x7'));var sox=require('sox');var csv=require(_0x9420('0x8'));var ejs=require(_0x9420('0x9'));var fs=require('fs');var _=require(_0x9420('0xa'));var squel=require(_0x9420('0xb'));var crypto=require(_0x9420('0xc'));var jsforce=require(_0x9420('0xd'));var deskjs=require(_0x9420('0xe'));var toCsv=require(_0x9420('0x8'));var querystring=require(_0x9420('0xf'));var Papa=require(_0x9420('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9420('0x11'));var as=require(_0x9420('0x12'));var hardwareService=require(_0x9420('0x13'));var logger=require(_0x9420('0x14'))(_0x9420('0x15'));var utils=require(_0x9420('0x16'));var config=require(_0x9420('0x17'));var licenseUtil=require(_0x9420('0x18'));var db=require(_0x9420('0x19'))['db'];function respondWithStatusCode(_0x482ec0,_0x3c4127){_0x3c4127=_0x3c4127||0xcc;return function(_0x47e331){if(_0x47e331){return _0x482ec0[_0x9420('0x1a')](_0x3c4127);}return _0x482ec0[_0x9420('0x1b')](_0x3c4127)[_0x9420('0x1c')]();};}function respondWithResult(_0x2ba7dd,_0x2784aa){_0x2784aa=_0x2784aa||0xc8;return function(_0x3f6014){if(_0x3f6014){return _0x2ba7dd['status'](_0x2784aa)[_0x9420('0x1d')](_0x3f6014);}};}function respondWithFilteredResult(_0x2e8e89,_0x24a3ff){return function(_0x564c2a){if(_0x564c2a){var _0x15789a=_0x564c2a[_0x9420('0x1e')],_0x478876=_0x24a3ff[_0x9420('0x1f')],_0x56281a=_0x24a3ff[_0x9420('0x1f')]+_0x24a3ff[_0x9420('0x20')],_0x253632;if(_0x56281a>=_0x15789a){_0x56281a=_0x15789a;_0x253632=0xc8;}else{_0x253632=0xce;}_0x2e8e89[_0x9420('0x1b')](_0x253632);return _0x2e8e89[_0x9420('0x21')]('Content-Range',_0x478876+'-'+_0x56281a+'/'+_0x15789a)['json'](_0x564c2a);}return null;};}function patchUpdates(_0x1f04ea){return function(_0x522bb3){try{jsonpatch['apply'](_0x522bb3,_0x1f04ea,!![]);}catch(_0x3ec856){return BPromise[_0x9420('0x22')](_0x3ec856);}return _0x522bb3[_0x9420('0x23')]();};}function saveUpdates(_0x5fd9,_0x134ac4){return function(_0x1a1c7e){if(_0x1a1c7e){return _0x1a1c7e[_0x9420('0x24')](_0x5fd9)[_0x9420('0x25')](function(_0x260e15){return _0x260e15;});}return null;};}function removeEntity(_0x9b4a07,_0x343a4c){return function(_0x3c7a43){if(_0x3c7a43){return _0x3c7a43[_0x9420('0x26')]()[_0x9420('0x25')](function(){_0x9b4a07[_0x9420('0x1b')](0xcc)[_0x9420('0x1c')]();});}};}function handleEntityNotFound(_0x302f01,_0xd43945){return function(_0x182d73){if(!_0x182d73){_0x302f01['sendStatus'](0x194);}return _0x182d73;};}function handleError(_0x1173e5,_0x51da92){_0x51da92=_0x51da92||0x1f4;return function(_0x1251f9){logger[_0x9420('0x27')](_0x1251f9[_0x9420('0x28')]);if(_0x1251f9[_0x9420('0x29')]){delete _0x1251f9[_0x9420('0x29')];}_0x1173e5[_0x9420('0x1b')](_0x51da92)[_0x9420('0x2a')](_0x1251f9);};}exports[_0x9420('0x2b')]=function(_0x543bb9,_0xb27bfd){var _0x35732d={},_0x5920b8={},_0x4e607e={'count':0x0,'rows':[]};var _0x5cf6df=_['map'](db[_0x9420('0x2c')][_0x9420('0x2d')],function(_0x130648){return{'name':_0x130648[_0x9420('0x2e')],'type':_0x130648[_0x9420('0x2f')]['key']};});_0x5920b8[_0x9420('0x30')]=_[_0x9420('0x31')](_0x5cf6df,_0x9420('0x29'));_0x5920b8[_0x9420('0x32')]=_[_0x9420('0x33')](_0x543bb9[_0x9420('0x32')]);_0x5920b8['filters']=_[_0x9420('0x34')](_0x5920b8[_0x9420('0x30')],_0x5920b8[_0x9420('0x32')]);_0x35732d[_0x9420('0x35')]=_[_0x9420('0x34')](_0x5920b8[_0x9420('0x30')],qs['fields'](_0x543bb9['query'][_0x9420('0x36')]));_0x35732d[_0x9420('0x35')]=_0x35732d[_0x9420('0x35')][_0x9420('0x37')]?_0x35732d[_0x9420('0x35')]:_0x5920b8[_0x9420('0x30')];if(!_0x543bb9[_0x9420('0x32')]['hasOwnProperty']('nolimit')){_0x35732d['limit']=qs['limit'](_0x543bb9[_0x9420('0x32')][_0x9420('0x20')]);_0x35732d[_0x9420('0x1f')]=qs[_0x9420('0x1f')](_0x543bb9[_0x9420('0x32')][_0x9420('0x1f')]);}_0x35732d[_0x9420('0x38')]=qs[_0x9420('0x39')](_0x543bb9[_0x9420('0x32')][_0x9420('0x39')]);_0x35732d[_0x9420('0x3a')]=qs[_0x9420('0x3b')](_[_0x9420('0x3c')](_0x543bb9[_0x9420('0x32')],_0x5920b8[_0x9420('0x3b')]),_0x5cf6df);if(_0x543bb9['query'][_0x9420('0x3d')]){_0x35732d[_0x9420('0x3a')]=_[_0x9420('0x3e')](_0x35732d[_0x9420('0x3a')],{'$or':_[_0x9420('0x31')](_0x5cf6df,function(_0x15541f){if(_0x15541f['type']!==_0x9420('0x3f')){var _0x2fe91c={};_0x2fe91c[_0x15541f['name']]={'$like':'%'+_0x543bb9[_0x9420('0x32')]['filter']+'%'};return _0x2fe91c;}})});}_0x35732d=_['merge']({},_0x35732d,_0x543bb9[_0x9420('0x40')]);var _0x1021dc={'where':_0x35732d[_0x9420('0x3a')]};return db[_0x9420('0x2c')][_0x9420('0x1e')](_0x1021dc)[_0x9420('0x25')](function(_0xff53fe){_0x4e607e[_0x9420('0x1e')]=_0xff53fe;if(_0x543bb9[_0x9420('0x32')]['includeAll']){_0x35732d[_0x9420('0x41')]=[{'all':!![]}];}return db[_0x9420('0x2c')][_0x9420('0x42')](_0x35732d);})[_0x9420('0x25')](function(_0x2878fb){_0x4e607e['rows']=_0x2878fb;return _0x4e607e;})[_0x9420('0x25')](respondWithFilteredResult(_0xb27bfd,_0x35732d))['catch'](handleError(_0xb27bfd,null));};exports[_0x9420('0x43')]=function(_0xba07b2,_0x2d3a84){var _0x80bc8a={'raw':!![],'where':{'id':_0xba07b2[_0x9420('0x44')]['id']}},_0x4155ad={};_0x4155ad['model']=_['keys'](db['VoiceDialReport'][_0x9420('0x2d')]);_0x4155ad['query']=_[_0x9420('0x33')](_0xba07b2[_0x9420('0x32')]);_0x4155ad[_0x9420('0x3b')]=_[_0x9420('0x34')](_0x4155ad[_0x9420('0x30')],_0x4155ad[_0x9420('0x32')]);_0x80bc8a[_0x9420('0x35')]=_[_0x9420('0x34')](_0x4155ad[_0x9420('0x30')],qs[_0x9420('0x36')](_0xba07b2[_0x9420('0x32')][_0x9420('0x36')]));_0x80bc8a[_0x9420('0x35')]=_0x80bc8a[_0x9420('0x35')][_0x9420('0x37')]?_0x80bc8a[_0x9420('0x35')]:_0x4155ad[_0x9420('0x30')];if(_0xba07b2[_0x9420('0x32')]['includeAll']){_0x80bc8a['include']=[{'all':!![]}];}_0x80bc8a=_['merge']({},_0x80bc8a,_0xba07b2[_0x9420('0x40')]);return db[_0x9420('0x2c')][_0x9420('0x45')](_0x80bc8a)['then'](handleEntityNotFound(_0x2d3a84,null))[_0x9420('0x25')](respondWithResult(_0x2d3a84,null))[_0x9420('0x46')](handleError(_0x2d3a84,null));};exports['create']=function(_0x5215c7,_0x42123c){return db[_0x9420('0x2c')][_0x9420('0x47')](_0x5215c7[_0x9420('0x48')],{})[_0x9420('0x25')](respondWithResult(_0x42123c,0xc9))[_0x9420('0x46')](handleError(_0x42123c,null));};exports['update']=function(_0x323297,_0x5014fe){if(_0x323297[_0x9420('0x48')]['id']){delete _0x323297[_0x9420('0x48')]['id'];}return db[_0x9420('0x2c')][_0x9420('0x45')]({'where':{'id':_0x323297[_0x9420('0x44')]['id']}})[_0x9420('0x25')](handleEntityNotFound(_0x5014fe,null))[_0x9420('0x25')](saveUpdates(_0x323297['body'],null))[_0x9420('0x25')](respondWithResult(_0x5014fe,null))['catch'](handleError(_0x5014fe,null));};exports['destroy']=function(_0x5da2a2,_0x3371f6){return db['VoiceDialReport'][_0x9420('0x45')]({'where':{'id':_0x5da2a2[_0x9420('0x44')]['id']}})[_0x9420('0x25')](handleEntityNotFound(_0x3371f6,null))[_0x9420('0x25')](removeEntity(_0x3371f6,null))[_0x9420('0x46')](handleError(_0x3371f6,null));};exports[_0x9420('0x49')]=function(_0x149731,_0x588c1a){return db[_0x9420('0x2c')][_0x9420('0x49')]()['then'](respondWithResult(_0x588c1a,null))[_0x9420('0x46')](handleError(_0x588c1a,null));}; \ No newline at end of file +var _0xf7f8=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','stack','name','send','index','map','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','filter','VIRTUAL','merge','options','VoiceDialReport','then','includeAll','findAll','catch','show','rawAttributes','keys','include','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xf7f8,0x1e2));var _0x8f7f=function(_0x593306,_0x42977d){_0x593306=_0x593306-0x0;var _0x98423=_0xf7f8[_0x593306];return _0x98423;};'use strict';var pdf=require(_0x8f7f('0x0'));var emlformat=require(_0x8f7f('0x1'));var rimraf=require(_0x8f7f('0x2'));var zipdir=require(_0x8f7f('0x3'));var jsonpatch=require(_0x8f7f('0x4'));var rp=require('request-promise');var moment=require(_0x8f7f('0x5'));var BPromise=require(_0x8f7f('0x6'));var Mustache=require(_0x8f7f('0x7'));var util=require('util');var path=require(_0x8f7f('0x8'));var sox=require(_0x8f7f('0x9'));var csv=require('to-csv');var ejs=require(_0x8f7f('0xa'));var fs=require('fs');var _=require(_0x8f7f('0xb'));var squel=require(_0x8f7f('0xc'));var crypto=require(_0x8f7f('0xd'));var jsforce=require(_0x8f7f('0xe'));var deskjs=require(_0x8f7f('0xf'));var toCsv=require(_0x8f7f('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f7f('0x11'));var authService=require(_0x8f7f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8f7f('0x13'));var hardwareService=require(_0x8f7f('0x14'));var logger=require(_0x8f7f('0x15'))(_0x8f7f('0x16'));var utils=require(_0x8f7f('0x17'));var config=require(_0x8f7f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f7f('0x19'))['db'];function respondWithStatusCode(_0x43e5b7,_0x1e2dfb){_0x1e2dfb=_0x1e2dfb||0xcc;return function(_0x51b7a9){if(_0x51b7a9){return _0x43e5b7[_0x8f7f('0x1a')](_0x1e2dfb);}return _0x43e5b7['status'](_0x1e2dfb)['end']();};}function respondWithResult(_0x1fb4dc,_0x1c832c){_0x1c832c=_0x1c832c||0xc8;return function(_0x223afb){if(_0x223afb){return _0x1fb4dc[_0x8f7f('0x1b')](_0x1c832c)[_0x8f7f('0x1c')](_0x223afb);}};}function respondWithFilteredResult(_0x48b136,_0x7b77b3){return function(_0x255607){if(_0x255607){var _0x214703=_0x255607[_0x8f7f('0x1d')],_0x2b48fd=_0x7b77b3[_0x8f7f('0x1e')],_0x426d9c=_0x7b77b3[_0x8f7f('0x1e')]+_0x7b77b3[_0x8f7f('0x1f')],_0x396269;if(_0x426d9c>=_0x214703){_0x426d9c=_0x214703;_0x396269=0xc8;}else{_0x396269=0xce;}_0x48b136['status'](_0x396269);return _0x48b136[_0x8f7f('0x20')](_0x8f7f('0x21'),_0x2b48fd+'-'+_0x426d9c+'/'+_0x214703)['json'](_0x255607);}return null;};}function patchUpdates(_0x5cbdd8){return function(_0x45b8d4){try{jsonpatch['apply'](_0x45b8d4,_0x5cbdd8,!![]);}catch(_0x21c7a4){return BPromise[_0x8f7f('0x22')](_0x21c7a4);}return _0x45b8d4['save']();};}function saveUpdates(_0x4895b1,_0x4d34ec){return function(_0x484864){if(_0x484864){return _0x484864[_0x8f7f('0x23')](_0x4895b1)['then'](function(_0x47ef02){return _0x47ef02;});}return null;};}function removeEntity(_0x1392c3,_0x34f1cf){return function(_0xd96716){if(_0xd96716){return _0xd96716['destroy']()['then'](function(){_0x1392c3[_0x8f7f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cbc4b,_0x2f4434){return function(_0x14e701){if(!_0x14e701){_0x1cbc4b[_0x8f7f('0x1a')](0x194);}return _0x14e701;};}function handleError(_0x1df42d,_0x598a57){_0x598a57=_0x598a57||0x1f4;return function(_0x3311ad){logger['error'](_0x3311ad[_0x8f7f('0x24')]);if(_0x3311ad[_0x8f7f('0x25')]){delete _0x3311ad[_0x8f7f('0x25')];}_0x1df42d[_0x8f7f('0x1b')](_0x598a57)[_0x8f7f('0x26')](_0x3311ad);};}exports[_0x8f7f('0x27')]=function(_0x41b1d9,_0x245a84){var _0xd836ab={},_0x57e95e={},_0x384d52={'count':0x0,'rows':[]};var _0x9d5b67=_[_0x8f7f('0x28')](db['VoiceDialReport']['rawAttributes'],function(_0xea352b){return{'name':_0xea352b['fieldName'],'type':_0xea352b[_0x8f7f('0x29')][_0x8f7f('0x2a')]};});_0x57e95e['model']=_[_0x8f7f('0x28')](_0x9d5b67,_0x8f7f('0x25'));_0x57e95e[_0x8f7f('0x2b')]=_['keys'](_0x41b1d9[_0x8f7f('0x2b')]);_0x57e95e[_0x8f7f('0x2c')]=_[_0x8f7f('0x2d')](_0x57e95e[_0x8f7f('0x2e')],_0x57e95e[_0x8f7f('0x2b')]);_0xd836ab['attributes']=_[_0x8f7f('0x2d')](_0x57e95e['model'],qs[_0x8f7f('0x2f')](_0x41b1d9[_0x8f7f('0x2b')]['fields']));_0xd836ab[_0x8f7f('0x30')]=_0xd836ab[_0x8f7f('0x30')][_0x8f7f('0x31')]?_0xd836ab['attributes']:_0x57e95e[_0x8f7f('0x2e')];if(!_0x41b1d9['query']['hasOwnProperty']('nolimit')){_0xd836ab['limit']=qs[_0x8f7f('0x1f')](_0x41b1d9['query'][_0x8f7f('0x1f')]);_0xd836ab['offset']=qs[_0x8f7f('0x1e')](_0x41b1d9['query'][_0x8f7f('0x1e')]);}_0xd836ab[_0x8f7f('0x32')]=qs[_0x8f7f('0x33')](_0x41b1d9[_0x8f7f('0x2b')][_0x8f7f('0x33')]);_0xd836ab[_0x8f7f('0x34')]=qs[_0x8f7f('0x2c')](_['pick'](_0x41b1d9[_0x8f7f('0x2b')],_0x57e95e[_0x8f7f('0x2c')]),_0x9d5b67);if(_0x41b1d9[_0x8f7f('0x2b')][_0x8f7f('0x35')]){_0xd836ab['where']=_['merge'](_0xd836ab[_0x8f7f('0x34')],{'$or':_['map'](_0x9d5b67,function(_0x489032){if(_0x489032[_0x8f7f('0x29')]!==_0x8f7f('0x36')){var _0x178927={};_0x178927[_0x489032[_0x8f7f('0x25')]]={'$like':'%'+_0x41b1d9[_0x8f7f('0x2b')]['filter']+'%'};return _0x178927;}})});}_0xd836ab=_[_0x8f7f('0x37')]({},_0xd836ab,_0x41b1d9[_0x8f7f('0x38')]);var _0x588fd6={'where':_0xd836ab['where']};return db[_0x8f7f('0x39')][_0x8f7f('0x1d')](_0x588fd6)[_0x8f7f('0x3a')](function(_0x4d29f2){_0x384d52[_0x8f7f('0x1d')]=_0x4d29f2;if(_0x41b1d9[_0x8f7f('0x2b')][_0x8f7f('0x3b')]){_0xd836ab['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x8f7f('0x3c')](_0xd836ab);})['then'](function(_0x39c537){_0x384d52['rows']=_0x39c537;return _0x384d52;})[_0x8f7f('0x3a')](respondWithFilteredResult(_0x245a84,_0xd836ab))[_0x8f7f('0x3d')](handleError(_0x245a84,null));};exports[_0x8f7f('0x3e')]=function(_0x509b10,_0x5babe7){var _0x5ac38f={'raw':!![],'where':{'id':_0x509b10['params']['id']}},_0x114375={};_0x114375[_0x8f7f('0x2e')]=_['keys'](db[_0x8f7f('0x39')][_0x8f7f('0x3f')]);_0x114375['query']=_[_0x8f7f('0x40')](_0x509b10['query']);_0x114375[_0x8f7f('0x2c')]=_['intersection'](_0x114375[_0x8f7f('0x2e')],_0x114375[_0x8f7f('0x2b')]);_0x5ac38f[_0x8f7f('0x30')]=_[_0x8f7f('0x2d')](_0x114375[_0x8f7f('0x2e')],qs[_0x8f7f('0x2f')](_0x509b10[_0x8f7f('0x2b')][_0x8f7f('0x2f')]));_0x5ac38f[_0x8f7f('0x30')]=_0x5ac38f[_0x8f7f('0x30')][_0x8f7f('0x31')]?_0x5ac38f[_0x8f7f('0x30')]:_0x114375['model'];if(_0x509b10['query'][_0x8f7f('0x3b')]){_0x5ac38f[_0x8f7f('0x41')]=[{'all':!![]}];}_0x5ac38f=_[_0x8f7f('0x37')]({},_0x5ac38f,_0x509b10['options']);return db[_0x8f7f('0x39')][_0x8f7f('0x42')](_0x5ac38f)[_0x8f7f('0x3a')](handleEntityNotFound(_0x5babe7,null))['then'](respondWithResult(_0x5babe7,null))[_0x8f7f('0x3d')](handleError(_0x5babe7,null));};exports[_0x8f7f('0x43')]=function(_0x4716e9,_0x2faf82){return db[_0x8f7f('0x39')]['create'](_0x4716e9[_0x8f7f('0x44')],{})[_0x8f7f('0x3a')](respondWithResult(_0x2faf82,0xc9))[_0x8f7f('0x3d')](handleError(_0x2faf82,null));};exports[_0x8f7f('0x23')]=function(_0x14817d,_0x3a68ea){if(_0x14817d['body']['id']){delete _0x14817d[_0x8f7f('0x44')]['id'];}return db['VoiceDialReport'][_0x8f7f('0x42')]({'where':{'id':_0x14817d[_0x8f7f('0x45')]['id']}})[_0x8f7f('0x3a')](handleEntityNotFound(_0x3a68ea,null))[_0x8f7f('0x3a')](saveUpdates(_0x14817d[_0x8f7f('0x44')],null))[_0x8f7f('0x3a')](respondWithResult(_0x3a68ea,null))[_0x8f7f('0x3d')](handleError(_0x3a68ea,null));};exports[_0x8f7f('0x46')]=function(_0x3d3e53,_0x3f394b){return db[_0x8f7f('0x39')][_0x8f7f('0x42')]({'where':{'id':_0x3d3e53['params']['id']}})[_0x8f7f('0x3a')](handleEntityNotFound(_0x3f394b,null))[_0x8f7f('0x3a')](removeEntity(_0x3f394b,null))[_0x8f7f('0x3d')](handleError(_0x3f394b,null));};exports[_0x8f7f('0x47')]=function(_0x18e95f,_0x3c8a9b){return db[_0x8f7f('0x39')][_0x8f7f('0x47')]()[_0x8f7f('0x3a')](respondWithResult(_0x3c8a9b,null))[_0x8f7f('0x3d')](handleError(_0x3c8a9b,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9b67c88..1507fa9 100644 --- a/server/api/voiceDialReport/voiceDialReport.model.js +++ b/server/api/voiceDialReport/voiceDialReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50ad=['api','moment','path','rimraf','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','lodash'];(function(_0x4748a2,_0x5d04bd){var _0x16c342=function(_0x26237e){while(--_0x26237e){_0x4748a2['push'](_0x4748a2['shift']());}};_0x16c342(++_0x5d04bd);}(_0x50ad,0x104));var _0xd50a=function(_0x5d1f9a,_0x3c75fd){_0x5d1f9a=_0x5d1f9a-0x0;var _0x864ff7=_0x50ad[_0x5d1f9a];return _0x864ff7;};'use strict';var _=require(_0xd50a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd50a('0x1'));var moment=require(_0xd50a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd50a('0x3'));var rimraf=require(_0xd50a('0x4'));var config=require('../../config/environment');var attributes=require(_0xd50a('0x5'));module[_0xd50a('0x6')]=function(_0x126167,_0xcc5c8){return _0x126167['define'](_0xd50a('0x7'),attributes,{'tableName':_0xd50a('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xff24=['../../config/logger','api','moment','bluebird','request-promise','define','util'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xff24,0x92));var _0x4ff2=function(_0x119e3f,_0x2281f3){_0x119e3f=_0x119e3f-0x0;var _0x3d67d1=_0xff24[_0x119e3f];return _0x3d67d1;};'use strict';var _=require('lodash');var util=require(_0x4ff2('0x0'));var logger=require(_0x4ff2('0x1'))(_0x4ff2('0x2'));var moment=require(_0x4ff2('0x3'));var BPromise=require(_0x4ff2('0x4'));var rp=require(_0x4ff2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0xe28f5f,_0x46aea8){return _0xe28f5f[_0x4ff2('0x6')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 23a3f95..775b657 100644 --- a/server/api/voiceDialReport/voiceDialReport.rpc.js +++ b/server/api/voiceDialReport/voiceDialReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16b7=['body','options','then','CreateVoiceDialReport','catch','update','raw','where','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create'];(function(_0x12c7e3,_0x417a84){var _0x348f08=function(_0x3b3052){while(--_0x3b3052){_0x12c7e3['push'](_0x12c7e3['shift']());}};_0x348f08(++_0x417a84);}(_0x16b7,0x101));var _0x716b=function(_0x5a0fc3,_0x294fc0){_0x5a0fc3=_0x5a0fc3-0x0;var _0x330bc1=_0x16b7[_0x5a0fc3];return _0x330bc1;};'use strict';var _=require(_0x716b('0x0'));var util=require('util');var moment=require(_0x716b('0x1'));var BPromise=require(_0x716b('0x2'));var rs=require(_0x716b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x716b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x716b('0x5'))(_0x716b('0x6'));var config=require(_0x716b('0x7'));var jayson=require(_0x716b('0x8'));var client=jayson[_0x716b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b52c,_0x55ac9b,_0x2df7cd){return new BPromise(function(_0x4a8a13,_0x29061a){return client[_0x716b('0xa')](_0x27b52c,_0x2df7cd)['then'](function(_0x4b1aa8){logger[_0x716b('0xb')](_0x716b('0xc'),_0x55ac9b,_0x716b('0xd'));logger[_0x716b('0xe')](_0x716b('0xf'),_0x55ac9b,_0x716b('0xd'),JSON[_0x716b('0x10')](_0x4b1aa8));if(_0x4b1aa8[_0x716b('0x11')]){if(_0x4b1aa8[_0x716b('0x11')][_0x716b('0x12')]===0x1f4){logger[_0x716b('0x11')](_0x716b('0xc'),_0x55ac9b,_0x4b1aa8[_0x716b('0x11')][_0x716b('0x13')]);return _0x29061a(_0x4b1aa8[_0x716b('0x11')]['message']);}logger[_0x716b('0x11')](_0x716b('0xc'),_0x55ac9b,_0x4b1aa8[_0x716b('0x11')]['message']);return _0x4a8a13(_0x4b1aa8[_0x716b('0x11')][_0x716b('0x13')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x55ac9b,'request\x20sent');_0x4a8a13(_0x4b1aa8[_0x716b('0x14')]['message']);}})['catch'](function(_0x4f5af1){logger['error'](_0x716b('0xc'),_0x55ac9b,_0x4f5af1);_0x29061a(_0x4f5af1);});});}exports['CreateVoiceDialReport']=function(_0x55b49b){var _0x5598e0=this;return new Promise(function(_0xf632d6,_0x83ed3c){return db['VoiceDialReport'][_0x716b('0x15')](_0x55b49b[_0x716b('0x16')],{'raw':_0x55b49b[_0x716b('0x17')]?_0x55b49b[_0x716b('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x716b('0x18')](function(_0x4fd107){logger[_0x716b('0xb')](_0x716b('0x19'),_0x55b49b);logger[_0x716b('0xe')]('CreateVoiceDialReport',_0x55b49b,JSON[_0x716b('0x10')](_0x4fd107));_0xf632d6(_0x4fd107);})[_0x716b('0x1a')](function(_0x740153){logger['error'](_0x716b('0x19'),_0x740153['message'],_0x55b49b);_0x83ed3c(_0x5598e0['error'](0x1f4,_0x740153[_0x716b('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x163546){var _0x2d36d1=this;return new Promise(function(_0x506bd1,_0x3065f9){return db['VoiceDialReport'][_0x716b('0x1b')](_0x163546[_0x716b('0x16')],{'raw':_0x163546[_0x716b('0x17')]?_0x163546[_0x716b('0x17')][_0x716b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163546[_0x716b('0x17')]?_0x163546['options'][_0x716b('0x1d')]||null:null,'attributes':_0x163546[_0x716b('0x17')]?_0x163546[_0x716b('0x17')]['attributes']||null:null,'limit':_0x163546[_0x716b('0x17')]?_0x163546[_0x716b('0x17')]['limit']||null:null})[_0x716b('0x18')](function(_0x15a001){logger['info']('UpdateVoiceDialReport',_0x163546);logger[_0x716b('0xe')](_0x716b('0x1e'),_0x163546,JSON[_0x716b('0x10')](_0x15a001));_0x506bd1(_0x15a001);})[_0x716b('0x1a')](function(_0x3eca62){logger[_0x716b('0x11')](_0x716b('0x1e'),_0x3eca62[_0x716b('0x13')],_0x163546);_0x3065f9(_0x2d36d1[_0x716b('0x11')](0x1f4,_0x3eca62[_0x716b('0x13')]));});});}; \ No newline at end of file +var _0xf45f=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','lodash','util'];(function(_0x8fe409,_0x3c212c){var _0xb24771=function(_0x41125a){while(--_0x41125a){_0x8fe409['push'](_0x8fe409['shift']());}};_0xb24771(++_0x3c212c);}(_0xf45f,0xd0));var _0xff45=function(_0x307287,_0x4454db){_0x307287=_0x307287-0x0;var _0x438e41=_0xf45f[_0x307287];return _0x438e41;};'use strict';var _=require(_0xff45('0x0'));var util=require(_0xff45('0x1'));var moment=require(_0xff45('0x2'));var BPromise=require(_0xff45('0x3'));var rs=require(_0xff45('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff45('0x5'))['db'];var utils=require(_0xff45('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xff45('0x7'));var jayson=require(_0xff45('0x8'));var client=jayson[_0xff45('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1debee,_0x32f16c,_0x2dcc49){return new BPromise(function(_0x15f771,_0x5eee67){return client[_0xff45('0xa')](_0x1debee,_0x2dcc49)[_0xff45('0xb')](function(_0x5603ac){logger[_0xff45('0xc')](_0xff45('0xd'),_0x32f16c,_0xff45('0xe'));logger[_0xff45('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x32f16c,_0xff45('0xe'),JSON[_0xff45('0x10')](_0x5603ac));if(_0x5603ac[_0xff45('0x11')]){if(_0x5603ac[_0xff45('0x11')]['code']===0x1f4){logger[_0xff45('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x32f16c,_0x5603ac['error']['message']);return _0x5eee67(_0x5603ac['error'][_0xff45('0x12')]);}logger[_0xff45('0x11')](_0xff45('0xd'),_0x32f16c,_0x5603ac[_0xff45('0x11')][_0xff45('0x12')]);return _0x15f771(_0x5603ac['error'][_0xff45('0x12')]);}else{logger[_0xff45('0xc')](_0xff45('0xd'),_0x32f16c,'request\x20sent');_0x15f771(_0x5603ac[_0xff45('0x13')][_0xff45('0x12')]);}})[_0xff45('0x14')](function(_0xb7dd69){logger[_0xff45('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x32f16c,_0xb7dd69);_0x5eee67(_0xb7dd69);});});}exports[_0xff45('0x15')]=function(_0x240cea){var _0x3cdda8=this;return new Promise(function(_0x126759,_0x15d1a2){return db[_0xff45('0x16')][_0xff45('0x17')](_0x240cea[_0xff45('0x18')],{'raw':_0x240cea[_0xff45('0x19')]?_0x240cea['options'][_0xff45('0x1a')]===undefined?!![]:![]:!![]})[_0xff45('0xb')](function(_0x5778d1){logger['info'](_0xff45('0x15'),_0x240cea);logger['debug'](_0xff45('0x15'),_0x240cea,JSON[_0xff45('0x10')](_0x5778d1));_0x126759(_0x5778d1);})[_0xff45('0x14')](function(_0x20d0e7){logger[_0xff45('0x11')](_0xff45('0x15'),_0x20d0e7[_0xff45('0x12')],_0x240cea);_0x15d1a2(_0x3cdda8[_0xff45('0x11')](0x1f4,_0x20d0e7[_0xff45('0x12')]));});});};exports[_0xff45('0x1b')]=function(_0x51068f){var _0xb5b102=this;return new Promise(function(_0x586247,_0xf217d3){return db[_0xff45('0x16')][_0xff45('0x1c')](_0x51068f[_0xff45('0x18')],{'raw':_0x51068f[_0xff45('0x19')]?_0x51068f[_0xff45('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51068f['options']?_0x51068f[_0xff45('0x19')][_0xff45('0x1d')]||null:null,'attributes':_0x51068f[_0xff45('0x19')]?_0x51068f[_0xff45('0x19')]['attributes']||null:null,'limit':_0x51068f['options']?_0x51068f['options']['limit']||null:null})[_0xff45('0xb')](function(_0x130228){logger[_0xff45('0xc')](_0xff45('0x1b'),_0x51068f);logger[_0xff45('0xf')]('UpdateVoiceDialReport',_0x51068f,JSON[_0xff45('0x10')](_0x130228));_0x586247(_0x130228);})[_0xff45('0x14')](function(_0x59db11){logger['error'](_0xff45('0x1b'),_0x59db11[_0xff45('0x12')],_0x51068f);_0xf217d3(_0xb5b102[_0xff45('0x11')](0x1f4,_0x59db11[_0xff45('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 9adc98a..999e1b6 100644 --- a/server/api/voiceExtension/index.js +++ b/server/api/voiceExtension/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1e1=['create','addApplications','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','post'];(function(_0x3d8163,_0x5470c4){var _0x49db86=function(_0x2542cb){while(--_0x2542cb){_0x3d8163['push'](_0x3d8163['shift']());}};_0x49db86(++_0x5470c4);}(_0xc1e1,0x11e));var _0x1c1e=function(_0x1dee44,_0x28f5a9){_0x1dee44=_0x1dee44-0x0;var _0x4828ac=_0xc1e1[_0x1dee44];return _0x4828ac;};'use strict';var multer=require(_0x1c1e('0x0'));var util=require(_0x1c1e('0x1'));var path=require(_0x1c1e('0x2'));var timeout=require(_0x1c1e('0x3'));var express=require(_0x1c1e('0x4'));var router=express['Router']();var auth=require(_0x1c1e('0x5'));var interaction=require(_0x1c1e('0x6'));var config=require(_0x1c1e('0x7'));var controller=require(_0x1c1e('0x8'));router[_0x1c1e('0x9')]('/',auth[_0x1c1e('0xa')](),controller[_0x1c1e('0xb')]);router[_0x1c1e('0x9')](_0x1c1e('0xc'),auth[_0x1c1e('0xa')](),controller['show']);router[_0x1c1e('0xd')]('/',auth['isAuthenticated'](),controller[_0x1c1e('0xe')]);router['post']('/:id/applications',auth[_0x1c1e('0xa')](),controller[_0x1c1e('0xf')]);router[_0x1c1e('0x10')]('/:id',auth[_0x1c1e('0xa')](),controller['update']);router[_0x1c1e('0x11')]('/:id',auth[_0x1c1e('0xa')](),controller[_0x1c1e('0x12')]);module[_0x1c1e('0x13')]=router; \ No newline at end of file +var _0xdc3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x54c92c,_0x25b4f5){var _0x402089=function(_0x127e54){while(--_0x127e54){_0x54c92c['push'](_0x54c92c['shift']());}};_0x402089(++_0x25b4f5);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x4f7ed9,_0x27d4d3){_0x4f7ed9=_0x4f7ed9-0x0;var _0x4d60a5=_0xdc3c[_0x4f7ed9];return _0x4d60a5;};'use strict';var multer=require(_0xcdc3('0x0'));var util=require('util');var path=require(_0xcdc3('0x1'));var timeout=require(_0xcdc3('0x2'));var express=require(_0xcdc3('0x3'));var router=express[_0xcdc3('0x4')]();var auth=require(_0xcdc3('0x5'));var interaction=require(_0xcdc3('0x6'));var config=require(_0xcdc3('0x7'));var controller=require(_0xcdc3('0x8'));router[_0xcdc3('0x9')]('/',auth[_0xcdc3('0xa')](),controller[_0xcdc3('0xb')]);router[_0xcdc3('0x9')](_0xcdc3('0xc'),auth[_0xcdc3('0xa')](),controller[_0xcdc3('0xd')]);router[_0xcdc3('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xcdc3('0xf'),auth[_0xcdc3('0xa')](),controller[_0xcdc3('0x10')]);router[_0xcdc3('0x11')](_0xcdc3('0xc'),auth[_0xcdc3('0xa')](),controller[_0xcdc3('0x12')]);router[_0xcdc3('0x13')](_0xcdc3('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcdc3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 55125b8..31ac722 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0xab9ebb,_0x4a5a28){var _0x1c5fa8=function(_0x4ab0a5){while(--_0x4ab0a5){_0xab9ebb['push'](_0xab9ebb['shift']());}};_0x1c5fa8(++_0x4a5a28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x438660,_0x5d6757){var _0xe33ab7=function(_0x17a3ef){while(--_0x17a3ef){_0x438660['push'](_0x438660['shift']());}};_0xe33ab7(++_0x5d6757);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index d06e095..893659c 100644 --- a/server/api/voiceExtension/voiceExtension.controller.js +++ b/server/api/voiceExtension/voiceExtension.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x091f=['path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','map','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','VoiceExtension','includeAll','include','findAll','rows','show','length','catch','params','body','startsWith','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','mandatoryDisposition','findOne','sequelize','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x2c0d99,_0x23fd8e){var _0x108b80=function(_0x3205a6){while(--_0x3205a6){_0x2c0d99['push'](_0x2c0d99['shift']());}};_0x108b80(++_0x23fd8e);}(_0x091f,0x135));var _0xf091=function(_0x289fd4,_0xd34ba6){_0x289fd4=_0x289fd4-0x0;var _0x3d4a88=_0x091f[_0x289fd4];return _0x3d4a88;};'use strict';var pdf=require(_0xf091('0x0'));var emlformat=require(_0xf091('0x1'));var rimraf=require(_0xf091('0x2'));var zipdir=require(_0xf091('0x3'));var jsonpatch=require(_0xf091('0x4'));var rp=require(_0xf091('0x5'));var moment=require(_0xf091('0x6'));var BPromise=require(_0xf091('0x7'));var Mustache=require('mustache');var util=require(_0xf091('0x8'));var path=require(_0xf091('0x9'));var sox=require(_0xf091('0xa'));var csv=require(_0xf091('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf091('0xc'));var squel=require(_0xf091('0xd'));var crypto=require(_0xf091('0xe'));var jsforce=require(_0xf091('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf091('0xb'));var querystring=require('querystring');var Papa=require(_0xf091('0x10'));var Redis=require(_0xf091('0x11'));var authService=require(_0xf091('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf091('0x13'));var hardwareService=require(_0xf091('0x14'));var logger=require('../../config/logger')(_0xf091('0x15'));var utils=require(_0xf091('0x16'));var config=require(_0xf091('0x17'));var licenseUtil=require(_0xf091('0x18'));var db=require(_0xf091('0x19'))['db'];config['redis']=_[_0xf091('0x1a')](config[_0xf091('0x1b')],{'host':_0xf091('0x1c'),'port':0x18eb});var socket=require(_0xf091('0x1d'))(new Redis(config[_0xf091('0x1b')]));require(_0xf091('0x1e'))[_0xf091('0x1f')](socket);function respondWithStatusCode(_0x1a0837,_0x22b7ec){_0x22b7ec=_0x22b7ec||0xcc;return function(_0x45f226){if(_0x45f226){return _0x1a0837[_0xf091('0x20')](_0x22b7ec);}return _0x1a0837[_0xf091('0x21')](_0x22b7ec)[_0xf091('0x22')]();};}function respondWithResult(_0xade682,_0x32cef6){_0x32cef6=_0x32cef6||0xc8;return function(_0x49b3af){if(_0x49b3af){return _0xade682[_0xf091('0x21')](_0x32cef6)[_0xf091('0x23')](_0x49b3af);}};}function respondWithFilteredResult(_0x5bba8f,_0x403aa1){return function(_0x1d77c8){if(_0x1d77c8){var _0x20f0b1=_0x1d77c8[_0xf091('0x24')],_0x1efb87=_0x403aa1[_0xf091('0x25')],_0xb56b5c=_0x403aa1[_0xf091('0x25')]+_0x403aa1[_0xf091('0x26')],_0x2b1e05;if(_0xb56b5c>=_0x20f0b1){_0xb56b5c=_0x20f0b1;_0x2b1e05=0xc8;}else{_0x2b1e05=0xce;}_0x5bba8f[_0xf091('0x21')](_0x2b1e05);return _0x5bba8f['set'](_0xf091('0x27'),_0x1efb87+'-'+_0xb56b5c+'/'+_0x20f0b1)[_0xf091('0x23')](_0x1d77c8);}return null;};}function patchUpdates(_0x57ba5e){return function(_0x24d600){try{jsonpatch[_0xf091('0x28')](_0x24d600,_0x57ba5e,!![]);}catch(_0x372240){return BPromise[_0xf091('0x29')](_0x372240);}return _0x24d600[_0xf091('0x2a')]();};}function saveUpdates(_0x2e09f8,_0x596383){return function(_0x3ca595){if(_0x3ca595){return _0x3ca595[_0xf091('0x2b')](_0x2e09f8)[_0xf091('0x2c')](function(_0x5a75f9){return _0x5a75f9;});}return null;};}function removeEntity(_0x12437a,_0x327f57){return function(_0x10ad7e){if(_0x10ad7e){return _0x10ad7e[_0xf091('0x2d')]()[_0xf091('0x2c')](function(){var _0x8cc1ff=_0x10ad7e[_0xf091('0x2e')]({'plain':!![]});var _0x37fb44=[{'name':'InboundRoutes','value':_0xf091('0x2f'),'ignore':![]},{'name':_0xf091('0x30'),'value':_0xf091('0x31'),'ignore':![]},{'name':_0xf091('0x32'),'value':_0xf091('0x33'),'ignore':![]}];var _0x41a03f=_(_0x37fb44)[_0xf091('0x34')](_0xf091('0x35'))['map'](_0xf091('0x36'))[_0xf091('0x36')]();if(_[_0xf091('0x37')](_0x41a03f,_0x8cc1ff[_0xf091('0x38')])){return;}var _0x11402e=_[_0xf091('0x39')](_0x37fb44,[_0xf091('0x36'),_0x8cc1ff['type']])[_0xf091('0x3a')];return db[_0xf091('0x3b')][_0xf091('0x2d')]({'where':{'type':_0x11402e,'resourceId':_0x8cc1ff['id']}})[_0xf091('0x2c')](function(){return _0x10ad7e;});})['then'](function(){_0x12437a[_0xf091('0x21')](0xcc)[_0xf091('0x22')]();});}};}function handleEntityNotFound(_0x705084,_0x2f8958){return function(_0x33dcd6){if(!_0x33dcd6){_0x705084[_0xf091('0x20')](0x194);}return _0x33dcd6;};}function handleError(_0x7251fc,_0x45554f){_0x45554f=_0x45554f||0x1f4;return function(_0x3c0dcd){logger[_0xf091('0x3c')](_0x3c0dcd[_0xf091('0x3d')]);if(_0x3c0dcd['name']){delete _0x3c0dcd[_0xf091('0x3a')];}_0x7251fc[_0xf091('0x21')](_0x45554f)['send'](_0x3c0dcd);};}exports['index']=function(_0x59e685,_0x56d767){var _0x39d458={},_0x224558={},_0x7d94eb={'count':0x0,'rows':[]};var _0x52ea25=_[_0xf091('0x3e')](db['VoiceExtension'][_0xf091('0x3f')],function(_0x498021){return{'name':_0x498021[_0xf091('0x40')],'type':_0x498021['type']['key']};});_0x224558[_0xf091('0x41')]=_[_0xf091('0x3e')](_0x52ea25,_0xf091('0x3a'));_0x224558['query']=_['keys'](_0x59e685[_0xf091('0x42')]);_0x224558[_0xf091('0x43')]=_['intersection'](_0x224558['model'],_0x224558[_0xf091('0x42')]);_0x39d458[_0xf091('0x44')]=_[_0xf091('0x45')](_0x224558['model'],qs[_0xf091('0x46')](_0x59e685[_0xf091('0x42')][_0xf091('0x46')]));_0x39d458[_0xf091('0x44')]=_0x39d458['attributes']['length']?_0x39d458[_0xf091('0x44')]:_0x224558[_0xf091('0x41')];if(!_0x59e685[_0xf091('0x42')][_0xf091('0x47')](_0xf091('0x48'))){_0x39d458[_0xf091('0x26')]=qs[_0xf091('0x26')](_0x59e685[_0xf091('0x42')][_0xf091('0x26')]);_0x39d458['offset']=qs[_0xf091('0x25')](_0x59e685[_0xf091('0x42')][_0xf091('0x25')]);}_0x39d458[_0xf091('0x49')]=qs[_0xf091('0x4a')](_0x59e685['query'][_0xf091('0x4a')]);_0x39d458['where']=qs[_0xf091('0x43')](_[_0xf091('0x4b')](_0x59e685[_0xf091('0x42')],_0x224558[_0xf091('0x43')]),_0x52ea25);if(_0x59e685[_0xf091('0x42')]['filter']){_0x39d458[_0xf091('0x4c')]=_[_0xf091('0x4d')](_0x39d458['where'],{'$or':_[_0xf091('0x3e')](_0x52ea25,function(_0x37fbef){if(_0x37fbef['type']!=='VIRTUAL'){var _0x2bbb0e={};_0x2bbb0e[_0x37fbef[_0xf091('0x3a')]]={'$like':'%'+_0x59e685[_0xf091('0x42')]['filter']+'%'};return _0x2bbb0e;}})});}_0x39d458=_[_0xf091('0x4d')]({},_0x39d458,_0x59e685[_0xf091('0x4e')]);var _0x1a4d09={'where':_0x39d458[_0xf091('0x4c')]};return db[_0xf091('0x4f')][_0xf091('0x24')](_0x1a4d09)[_0xf091('0x2c')](function(_0x5269d2){_0x7d94eb[_0xf091('0x24')]=_0x5269d2;if(_0x59e685[_0xf091('0x42')][_0xf091('0x50')]){_0x39d458[_0xf091('0x51')]=[{'all':!![]}];}return db['VoiceExtension'][_0xf091('0x52')](_0x39d458);})[_0xf091('0x2c')](function(_0x18c26d){_0x7d94eb[_0xf091('0x53')]=_0x18c26d;return _0x7d94eb;})[_0xf091('0x2c')](respondWithFilteredResult(_0x56d767,_0x39d458))['catch'](handleError(_0x56d767,null));};exports[_0xf091('0x54')]=function(_0x4909d2,_0x32485d){var _0x3b2c20={'raw':![],'where':{'id':_0x4909d2['params']['id']}},_0x252e27={};_0x252e27[_0xf091('0x41')]=_['keys'](db[_0xf091('0x4f')][_0xf091('0x3f')]);_0x252e27[_0xf091('0x42')]=_['keys'](_0x4909d2[_0xf091('0x42')]);_0x252e27[_0xf091('0x43')]=_[_0xf091('0x45')](_0x252e27['model'],_0x252e27[_0xf091('0x42')]);_0x3b2c20[_0xf091('0x44')]=_[_0xf091('0x45')](_0x252e27[_0xf091('0x41')],qs[_0xf091('0x46')](_0x4909d2['query'][_0xf091('0x46')]));_0x3b2c20[_0xf091('0x44')]=_0x3b2c20[_0xf091('0x44')][_0xf091('0x55')]?_0x3b2c20[_0xf091('0x44')]:_0x252e27[_0xf091('0x41')];if(_0x4909d2[_0xf091('0x42')][_0xf091('0x50')]){_0x3b2c20[_0xf091('0x51')]=[{'all':!![]}];}_0x3b2c20=_[_0xf091('0x4d')]({},_0x3b2c20,_0x4909d2[_0xf091('0x4e')]);return db[_0xf091('0x4f')][_0xf091('0x39')](_0x3b2c20)[_0xf091('0x2c')](handleEntityNotFound(_0x32485d,null))['then'](respondWithResult(_0x32485d,null))[_0xf091('0x56')](handleError(_0x32485d,null));};exports[_0xf091('0x2d')]=function(_0x1d9560,_0x3e7094){return db[_0xf091('0x4f')]['find']({'where':{'id':_0x1d9560[_0xf091('0x57')]['id']}})[_0xf091('0x2c')](handleEntityNotFound(_0x3e7094,null))[_0xf091('0x2c')](removeEntity(_0x3e7094,null))[_0xf091('0x56')](handleError(_0x3e7094,null));};exports['create']=function(_0x49ba33,_0x20a9a9){if(_0x49ba33[_0xf091('0x58')]['type']==='outbound'&&!_[_0xf091('0x59')](_0x49ba33[_0xf091('0x58')][_0xf091('0x5a')],'_')){_0x49ba33[_0xf091('0x58')]['exten']='_'['concat'](_0x49ba33[_0xf091('0x58')][_0xf091('0x5a')]);}return db[_0xf091('0x4f')][_0xf091('0x5b')](_0x49ba33[_0xf091('0x58')],{'raw':![]})[_0xf091('0x2c')](function(_0x4d2900){var _0x2f5207=_0x49ba33[_0xf091('0x5c')]['get']({'plain':!![]});if(!_0x2f5207)throw new Error(_0xf091('0x5d'));if(_0x2f5207['role']==='user'){var _0x4b6966=_0x4d2900['get']({'plain':!![]});var _0x21ca75=[{'name':_0xf091('0x5e'),'value':'inbound'},{'name':_0xf091('0x30'),'value':_0xf091('0x31')},{'name':_0xf091('0x32'),'value':_0xf091('0x33')}];var _0x3c9b62=_[_0xf091('0x39')](_0x21ca75,[_0xf091('0x36'),_0x4b6966[_0xf091('0x38')]])[_0xf091('0x3a')];return db['UserProfileSection'][_0xf091('0x39')]({'where':{'name':_0x3c9b62,'userProfileId':_0x2f5207[_0xf091('0x5f')]},'raw':!![]})[_0xf091('0x2c')](function(_0x4b89f6){if(_0x4b89f6&&_0x4b89f6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4b6966[_0xf091('0x3a')],'resourceId':_0x4b6966['id'],'type':_0x4b89f6['name'],'sectionId':_0x4b89f6['id']},{})['then'](function(){return _0x4d2900;});}else{return _0x4d2900;}})['catch'](function(_0x39b99f){logger['error'](_0xf091('0x60'),_0x39b99f);throw _0x39b99f;});}return _0x4d2900;})['then'](respondWithResult(_0x20a9a9,0xc9))[_0xf091('0x56')](handleError(_0x20a9a9,null));};exports[_0xf091('0x2b')]=function(_0x568199,_0xdefc18){if(_0x568199[_0xf091('0x58')]['id']){delete _0x568199[_0xf091('0x58')]['id'];}return db[_0xf091('0x4f')]['find']({'where':{'id':_0x568199[_0xf091('0x57')]['id']}})[_0xf091('0x2c')](handleEntityNotFound(_0xdefc18,null))[_0xf091('0x2c')](function(_0x176ea8){if(_0x176ea8){return db['VoiceExtension']['update'](_[_0xf091('0x4b')](_0x568199[_0xf091('0x58')],['exten',_0xf091('0x61'),_0xf091('0x62'),_0xf091('0x63'),'cutdigits',_0xf091('0x64')]),{'where':{'context':_0x176ea8[_0xf091('0x61')],'exten':_0x176ea8['exten']},'individualHooks':!![]})['then'](function(_0x13d0e9){return _0x13d0e9;});}return null;})['then'](respondWithStatusCode(_0xdefc18,null))[_0xf091('0x56')](handleError(_0xdefc18,null));};exports['addApplications']=function(_0x242679,_0x5cab4d,_0x4b0513){return db['VoiceExtension'][_0xf091('0x65')]({'where':{'id':_0x242679[_0xf091('0x57')]['id']}})['then'](handleEntityNotFound(_0x5cab4d,null))['then'](function(_0x5432e6){if(_0x5432e6){return db[_0xf091('0x66')]['transaction'](function(_0x1fdd66){return db[_0xf091('0x4f')]['destroy']({'where':{'VoiceExtensionId':_0x242679[_0xf091('0x57')]['id']},'transaction':_0x1fdd66})['then'](function(_0x56eaf5){var _0x4a0f7f=_[_0xf091('0x3e')](_0x242679[_0xf091('0x58')],function(_0x4443db){_0x4443db[_0xf091('0x67')]=_0x242679[_0xf091('0x57')]['id'];return _0x4443db;});return db[_0xf091('0x4f')][_0xf091('0x68')](_0x4a0f7f,{'transaction':_0x1fdd66});});})[_0xf091('0x2c')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x242679['params']['id']},'order':_0xf091('0x69')});});}})[_0xf091('0x2c')](respondWithResult(_0x5cab4d,null))['catch'](handleError(_0x5cab4d,null));}; \ No newline at end of file +var _0x39ec=['update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','destroy','VoiceExtensionId','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','json','apply','reject','save','get','InternalRoutes','filter','map','value','find','type','name','then','error','send','index','rawAttributes','fieldName','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','VoiceExtension','count','includeAll','include','rows','catch','params','keys','length','create','body','outbound','startsWith','exten','role','internal','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x23e6ab,_0x5410ab){var _0x171bab=function(_0x3f6fc0){while(--_0x3f6fc0){_0x23e6ab['push'](_0x23e6ab['shift']());}};_0x171bab(++_0x5410ab);}(_0x39ec,0x195));var _0xc39e=function(_0x18da22,_0x42a30f){_0x18da22=_0x18da22-0x0;var _0x4fbcec=_0x39ec[_0x18da22];return _0x4fbcec;};'use strict';var pdf=require(_0xc39e('0x0'));var emlformat=require(_0xc39e('0x1'));var rimraf=require(_0xc39e('0x2'));var zipdir=require(_0xc39e('0x3'));var jsonpatch=require(_0xc39e('0x4'));var rp=require(_0xc39e('0x5'));var moment=require('moment');var BPromise=require(_0xc39e('0x6'));var Mustache=require(_0xc39e('0x7'));var util=require(_0xc39e('0x8'));var path=require('path');var sox=require(_0xc39e('0x9'));var csv=require('to-csv');var ejs=require(_0xc39e('0xa'));var fs=require('fs');var _=require(_0xc39e('0xb'));var squel=require(_0xc39e('0xc'));var crypto=require('crypto');var jsforce=require(_0xc39e('0xd'));var deskjs=require(_0xc39e('0xe'));var toCsv=require(_0xc39e('0xf'));var querystring=require(_0xc39e('0x10'));var Papa=require(_0xc39e('0x11'));var Redis=require(_0xc39e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc39e('0x13'));var hardwareService=require(_0xc39e('0x14'));var logger=require(_0xc39e('0x15'))(_0xc39e('0x16'));var utils=require(_0xc39e('0x17'));var config=require(_0xc39e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc39e('0x19'))['db'];config[_0xc39e('0x1a')]=_['defaults'](config[_0xc39e('0x1a')],{'host':_0xc39e('0x1b'),'port':0x18eb});var socket=require(_0xc39e('0x1c'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x1019d3,_0x1a8f2b){_0x1a8f2b=_0x1a8f2b||0xcc;return function(_0x2da91b){if(_0x2da91b){return _0x1019d3[_0xc39e('0x1d')](_0x1a8f2b);}return _0x1019d3[_0xc39e('0x1e')](_0x1a8f2b)[_0xc39e('0x1f')]();};}function respondWithResult(_0x30509a,_0x59254b){_0x59254b=_0x59254b||0xc8;return function(_0x1cb51b){if(_0x1cb51b){return _0x30509a[_0xc39e('0x1e')](_0x59254b)['json'](_0x1cb51b);}};}function respondWithFilteredResult(_0xaa221e,_0x4f9b9a){return function(_0xd9417b){if(_0xd9417b){var _0x3c4491=_0xd9417b['count'],_0x2a27c2=_0x4f9b9a[_0xc39e('0x20')],_0x1620b3=_0x4f9b9a[_0xc39e('0x20')]+_0x4f9b9a['limit'],_0x356edb;if(_0x1620b3>=_0x3c4491){_0x1620b3=_0x3c4491;_0x356edb=0xc8;}else{_0x356edb=0xce;}_0xaa221e[_0xc39e('0x1e')](_0x356edb);return _0xaa221e['set']('Content-Range',_0x2a27c2+'-'+_0x1620b3+'/'+_0x3c4491)[_0xc39e('0x21')](_0xd9417b);}return null;};}function patchUpdates(_0x109140){return function(_0x14e336){try{jsonpatch[_0xc39e('0x22')](_0x14e336,_0x109140,!![]);}catch(_0x42f1f3){return BPromise[_0xc39e('0x23')](_0x42f1f3);}return _0x14e336[_0xc39e('0x24')]();};}function saveUpdates(_0x169363,_0x8a549e){return function(_0x242249){if(_0x242249){return _0x242249['update'](_0x169363)['then'](function(_0x5479b2){return _0x5479b2;});}return null;};}function removeEntity(_0x24dc3f,_0x5218cb){return function(_0x2b5599){if(_0x2b5599){return _0x2b5599['destroy']()['then'](function(){var _0x406df4=_0x2b5599[_0xc39e('0x25')]({'plain':!![]});var _0x114286=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0xc39e('0x26'),'value':'internal','ignore':![]}];var _0x5e89a8=_(_0x114286)[_0xc39e('0x27')]('ignore')[_0xc39e('0x28')]('value')[_0xc39e('0x29')]();if(_['includes'](_0x5e89a8,_0x406df4['type'])){return;}var _0x1cffb5=_[_0xc39e('0x2a')](_0x114286,[_0xc39e('0x29'),_0x406df4[_0xc39e('0x2b')]])[_0xc39e('0x2c')];return db['UserProfileResource']['destroy']({'where':{'type':_0x1cffb5,'resourceId':_0x406df4['id']}})['then'](function(){return _0x2b5599;});})[_0xc39e('0x2d')](function(){_0x24dc3f[_0xc39e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8bd285,_0x6dacb1){return function(_0x2adf64){if(!_0x2adf64){_0x8bd285[_0xc39e('0x1d')](0x194);}return _0x2adf64;};}function handleError(_0x4fc42d,_0x379a34){_0x379a34=_0x379a34||0x1f4;return function(_0x19b795){logger[_0xc39e('0x2e')](_0x19b795['stack']);if(_0x19b795[_0xc39e('0x2c')]){delete _0x19b795['name'];}_0x4fc42d['status'](_0x379a34)[_0xc39e('0x2f')](_0x19b795);};}exports[_0xc39e('0x30')]=function(_0x47bc70,_0x39f57b){var _0x481673={},_0x1ec651={},_0x323fda={'count':0x0,'rows':[]};var _0x116b20=_[_0xc39e('0x28')](db['VoiceExtension'][_0xc39e('0x31')],function(_0x238476){return{'name':_0x238476[_0xc39e('0x32')],'type':_0x238476[_0xc39e('0x2b')]['key']};});_0x1ec651[_0xc39e('0x33')]=_[_0xc39e('0x28')](_0x116b20,_0xc39e('0x2c'));_0x1ec651['query']=_['keys'](_0x47bc70['query']);_0x1ec651[_0xc39e('0x34')]=_[_0xc39e('0x35')](_0x1ec651[_0xc39e('0x33')],_0x1ec651[_0xc39e('0x36')]);_0x481673[_0xc39e('0x37')]=_['intersection'](_0x1ec651[_0xc39e('0x33')],qs['fields'](_0x47bc70['query'][_0xc39e('0x38')]));_0x481673[_0xc39e('0x37')]=_0x481673[_0xc39e('0x37')]['length']?_0x481673[_0xc39e('0x37')]:_0x1ec651[_0xc39e('0x33')];if(!_0x47bc70[_0xc39e('0x36')][_0xc39e('0x39')](_0xc39e('0x3a'))){_0x481673[_0xc39e('0x3b')]=qs[_0xc39e('0x3b')](_0x47bc70['query'][_0xc39e('0x3b')]);_0x481673['offset']=qs[_0xc39e('0x20')](_0x47bc70[_0xc39e('0x36')]['offset']);}_0x481673[_0xc39e('0x3c')]=qs[_0xc39e('0x3d')](_0x47bc70[_0xc39e('0x36')][_0xc39e('0x3d')]);_0x481673[_0xc39e('0x3e')]=qs[_0xc39e('0x34')](_[_0xc39e('0x3f')](_0x47bc70[_0xc39e('0x36')],_0x1ec651[_0xc39e('0x34')]),_0x116b20);if(_0x47bc70[_0xc39e('0x36')][_0xc39e('0x27')]){_0x481673['where']=_[_0xc39e('0x40')](_0x481673[_0xc39e('0x3e')],{'$or':_[_0xc39e('0x28')](_0x116b20,function(_0x26cbb3){if(_0x26cbb3[_0xc39e('0x2b')]!=='VIRTUAL'){var _0x16fb26={};_0x16fb26[_0x26cbb3['name']]={'$like':'%'+_0x47bc70[_0xc39e('0x36')][_0xc39e('0x27')]+'%'};return _0x16fb26;}})});}_0x481673=_['merge']({},_0x481673,_0x47bc70[_0xc39e('0x41')]);var _0x542a7={'where':_0x481673['where']};return db[_0xc39e('0x42')][_0xc39e('0x43')](_0x542a7)['then'](function(_0x1443e5){_0x323fda['count']=_0x1443e5;if(_0x47bc70[_0xc39e('0x36')][_0xc39e('0x44')]){_0x481673[_0xc39e('0x45')]=[{'all':!![]}];}return db[_0xc39e('0x42')]['findAll'](_0x481673);})[_0xc39e('0x2d')](function(_0x122fa3){_0x323fda[_0xc39e('0x46')]=_0x122fa3;return _0x323fda;})[_0xc39e('0x2d')](respondWithFilteredResult(_0x39f57b,_0x481673))[_0xc39e('0x47')](handleError(_0x39f57b,null));};exports['show']=function(_0xe4ba3e,_0x2999e1){var _0x4453eb={'raw':![],'where':{'id':_0xe4ba3e[_0xc39e('0x48')]['id']}},_0x42f1e4={};_0x42f1e4[_0xc39e('0x33')]=_[_0xc39e('0x49')](db[_0xc39e('0x42')][_0xc39e('0x31')]);_0x42f1e4['query']=_[_0xc39e('0x49')](_0xe4ba3e['query']);_0x42f1e4[_0xc39e('0x34')]=_[_0xc39e('0x35')](_0x42f1e4[_0xc39e('0x33')],_0x42f1e4[_0xc39e('0x36')]);_0x4453eb[_0xc39e('0x37')]=_['intersection'](_0x42f1e4['model'],qs[_0xc39e('0x38')](_0xe4ba3e[_0xc39e('0x36')][_0xc39e('0x38')]));_0x4453eb[_0xc39e('0x37')]=_0x4453eb[_0xc39e('0x37')][_0xc39e('0x4a')]?_0x4453eb['attributes']:_0x42f1e4[_0xc39e('0x33')];if(_0xe4ba3e[_0xc39e('0x36')][_0xc39e('0x44')]){_0x4453eb['include']=[{'all':!![]}];}_0x4453eb=_['merge']({},_0x4453eb,_0xe4ba3e[_0xc39e('0x41')]);return db['VoiceExtension'][_0xc39e('0x2a')](_0x4453eb)[_0xc39e('0x2d')](handleEntityNotFound(_0x2999e1,null))['then'](respondWithResult(_0x2999e1,null))[_0xc39e('0x47')](handleError(_0x2999e1,null));};exports['destroy']=function(_0x29e8cf,_0x4c8864){return db[_0xc39e('0x42')][_0xc39e('0x2a')]({'where':{'id':_0x29e8cf[_0xc39e('0x48')]['id']}})[_0xc39e('0x2d')](handleEntityNotFound(_0x4c8864,null))[_0xc39e('0x2d')](removeEntity(_0x4c8864,null))['catch'](handleError(_0x4c8864,null));};exports[_0xc39e('0x4b')]=function(_0x4fa0e,_0x2ba1cc){if(_0x4fa0e[_0xc39e('0x4c')][_0xc39e('0x2b')]===_0xc39e('0x4d')&&!_[_0xc39e('0x4e')](_0x4fa0e[_0xc39e('0x4c')][_0xc39e('0x4f')],'_')){_0x4fa0e[_0xc39e('0x4c')][_0xc39e('0x4f')]='_'['concat'](_0x4fa0e['body'][_0xc39e('0x4f')]);}return db[_0xc39e('0x42')][_0xc39e('0x4b')](_0x4fa0e['body'],{'raw':![]})[_0xc39e('0x2d')](function(_0x58ff41){var _0x300504=_0x4fa0e['user'][_0xc39e('0x25')]({'plain':!![]});if(!_0x300504)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x300504[_0xc39e('0x50')]==='user'){var _0x5df610=_0x58ff41[_0xc39e('0x25')]({'plain':!![]});var _0x1527fa=[{'name':'InboundRoutes','value':'inbound'},{'name':'OutboundRoutes','value':_0xc39e('0x4d')},{'name':_0xc39e('0x26'),'value':_0xc39e('0x51')}];var _0xb2e955=_['find'](_0x1527fa,['value',_0x5df610[_0xc39e('0x2b')]])[_0xc39e('0x2c')];return db[_0xc39e('0x52')][_0xc39e('0x2a')]({'where':{'name':_0xb2e955,'userProfileId':_0x300504[_0xc39e('0x53')]},'raw':!![]})[_0xc39e('0x2d')](function(_0x103246){if(_0x103246&&_0x103246['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5df610[_0xc39e('0x2c')],'resourceId':_0x5df610['id'],'type':_0x103246[_0xc39e('0x2c')],'sectionId':_0x103246['id']},{})[_0xc39e('0x2d')](function(){return _0x58ff41;});}else{return _0x58ff41;}})['catch'](function(_0x490212){logger[_0xc39e('0x2e')](_0xc39e('0x54'),_0x490212);throw _0x490212;});}return _0x58ff41;})[_0xc39e('0x2d')](respondWithResult(_0x2ba1cc,0xc9))['catch'](handleError(_0x2ba1cc,null));};exports[_0xc39e('0x55')]=function(_0x114977,_0x3f7528){if(_0x114977['body']['id']){delete _0x114977[_0xc39e('0x4c')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x114977[_0xc39e('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f7528,null))[_0xc39e('0x2d')](function(_0xd11ff7){if(_0xd11ff7){return db[_0xc39e('0x42')][_0xc39e('0x55')](_[_0xc39e('0x3f')](_0x114977[_0xc39e('0x4c')],[_0xc39e('0x4f'),_0xc39e('0x56'),_0xc39e('0x57'),_0xc39e('0x58'),_0xc39e('0x59'),_0xc39e('0x5a')]),{'where':{'context':_0xd11ff7[_0xc39e('0x56')],'exten':_0xd11ff7['exten']},'individualHooks':!![]})[_0xc39e('0x2d')](function(_0x122604){return _0x122604;});}return null;})[_0xc39e('0x2d')](respondWithStatusCode(_0x3f7528,null))[_0xc39e('0x47')](handleError(_0x3f7528,null));};exports[_0xc39e('0x5b')]=function(_0xd90b5e,_0x25c558,_0xded321){return db[_0xc39e('0x42')][_0xc39e('0x5c')]({'where':{'id':_0xd90b5e[_0xc39e('0x48')]['id']}})[_0xc39e('0x2d')](handleEntityNotFound(_0x25c558,null))[_0xc39e('0x2d')](function(_0x5ba944){if(_0x5ba944){return db[_0xc39e('0x5d')][_0xc39e('0x5e')](function(_0x5ac07e){return db[_0xc39e('0x42')][_0xc39e('0x5f')]({'where':{'VoiceExtensionId':_0xd90b5e['params']['id']},'transaction':_0x5ac07e})[_0xc39e('0x2d')](function(_0x591527){var _0x5a422e=_['map'](_0xd90b5e['body'],function(_0x52bafe){_0x52bafe[_0xc39e('0x60')]=_0xd90b5e['params']['id'];return _0x52bafe;});return db[_0xc39e('0x42')]['bulkCreate'](_0x5a422e,{'transaction':_0x5ac07e});});})[_0xc39e('0x2d')](function(){return db[_0xc39e('0x42')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0xd90b5e[_0xc39e('0x48')]['id']},'order':_0xc39e('0x61')});});}})[_0xc39e('0x2d')](respondWithResult(_0x25c558,null))[_0xc39e('0x47')](handleError(_0x25c558,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9db91bf..d92e5ce 100644 --- a/server/api/voiceExtension/voiceExtension.events.js +++ b/server/api/voiceExtension/voiceExtension.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23a2=['hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners','save','emit'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x23a2,0xcb));var _0x223a=function(_0x3298fd,_0x1a5829){_0x3298fd=_0x3298fd-0x0;var _0x4fba6=_0x23a2[_0x3298fd];return _0x4fba6;};'use strict';var EventEmitter=require(_0x223a('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x223a('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x223a('0x2')](0x0);var events={'afterCreate':_0x223a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x31edb1){return function(_0x5adecf,_0x43aa1,_0x1b9d88){VoiceExtensionEvents[_0x223a('0x4')](_0x31edb1+':'+_0x5adecf['id'],_0x5adecf);VoiceExtensionEvents['emit'](_0x31edb1,_0x5adecf);_0x1b9d88(null);};}for(var e in events){if(events[_0x223a('0x5')](e)){var event=events[e];VoiceExtension[_0x223a('0x6')](e,emitEvent(event));}}module[_0x223a('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6a7d=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x26f804,_0x2adcb){var _0x589dff=function(_0x524193){while(--_0x524193){_0x26f804['push'](_0x26f804['shift']());}};_0x589dff(++_0x2adcb);}(_0x6a7d,0x12f));var _0xd6a7=function(_0x105b20,_0x388d13){_0x105b20=_0x105b20-0x0;var _0x357455=_0x6a7d[_0x105b20];return _0x357455;};'use strict';var EventEmitter=require(_0xd6a7('0x0'));var VoiceExtension=require(_0xd6a7('0x1'))['db'][_0xd6a7('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd6a7('0x3'),'afterUpdate':'update','afterDestroy':_0xd6a7('0x4')};function emitEvent(_0x463738){return function(_0x2c9f12,_0x3ef3e1,_0x31ef02){VoiceExtensionEvents[_0xd6a7('0x5')](_0x463738+':'+_0x2c9f12['id'],_0x2c9f12);VoiceExtensionEvents[_0xd6a7('0x5')](_0x463738,_0x2c9f12);_0x31ef02(null);};}for(var e in events){if(events[_0xd6a7('0x6')](e)){var event=events[e];VoiceExtension[_0xd6a7('0x7')](e,emitEvent(event));}}module[_0xd6a7('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a03cda6..68bfc2a 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b09=['./voiceExtension.attributes','define','voice_extensions','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4d7ecb,_0x33ef23){var _0x784b5f=function(_0x225546){while(--_0x225546){_0x4d7ecb['push'](_0x4d7ecb['shift']());}};_0x784b5f(++_0x33ef23);}(_0x9b09,0x184));var _0x99b0=function(_0x187499,_0x5e416a){_0x187499=_0x187499-0x0;var _0x2965fe=_0x9b09[_0x187499];return _0x2965fe;};'use strict';var _=require('lodash');var util=require(_0x99b0('0x0'));var logger=require(_0x99b0('0x1'))(_0x99b0('0x2'));var moment=require(_0x99b0('0x3'));var BPromise=require(_0x99b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99b0('0x5'));var rimraf=require(_0x99b0('0x6'));var config=require(_0x99b0('0x7'));var attributes=require(_0x99b0('0x8'));module['exports']=function(_0x36e0d9,_0x304f7c){return _0x36e0d9[_0x99b0('0x9')]('VoiceExtension',attributes,{'tableName':_0x99b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71fb=['request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4af1c0,_0x5d38a2){var _0x175d43=function(_0x45a4a1){while(--_0x45a4a1){_0x4af1c0['push'](_0x4af1c0['shift']());}};_0x175d43(++_0x5d38a2);}(_0x71fb,0x6f));var _0xb71f=function(_0xd39472,_0x3e2493){_0xd39472=_0xd39472-0x0;var _0x295cb6=_0x71fb[_0xd39472];return _0x295cb6;};'use strict';var _=require(_0xb71f('0x0'));var util=require(_0xb71f('0x1'));var logger=require(_0xb71f('0x2'))(_0xb71f('0x3'));var moment=require(_0xb71f('0x4'));var BPromise=require(_0xb71f('0x5'));var rp=require(_0xb71f('0x6'));var fs=require('fs');var path=require(_0xb71f('0x7'));var rimraf=require(_0xb71f('0x8'));var config=require(_0xb71f('0x9'));var attributes=require(_0xb71f('0xa'));module[_0xb71f('0xb')]=function(_0x25dd68,_0x4a3571){return _0x25dd68['define'](_0xb71f('0xc'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index f36af99..209b6bc 100644 --- a/server/api/voiceExtension/voiceExtension.rpc.js +++ b/server/api/voiceExtension/voiceExtension.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92e8=['request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceExtension.socket','then','info'];(function(_0x53fd4e,_0x55aacd){var _0x100362=function(_0x4d375b){while(--_0x4d375b){_0x53fd4e['push'](_0x53fd4e['shift']());}};_0x100362(++_0x55aacd);}(_0x92e8,0x118));var _0x892e=function(_0x3b7b42,_0x31badd){_0x3b7b42=_0x3b7b42-0x0;var _0x1ebaad=_0x92e8[_0x3b7b42];return _0x1ebaad;};'use strict';var _=require(_0x892e('0x0'));var util=require('util');var moment=require(_0x892e('0x1'));var BPromise=require(_0x892e('0x2'));var rs=require(_0x892e('0x3'));var fs=require('fs');var Redis=require(_0x892e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x892e('0x5'));var logger=require(_0x892e('0x6'))(_0x892e('0x7'));var config=require('../../config/environment');var jayson=require(_0x892e('0x8'));var client=jayson[_0x892e('0x9')]['http']({'port':0x232a});config[_0x892e('0xa')]=_[_0x892e('0xb')](config[_0x892e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x892e('0xc'))(new Redis(config['redis']));require(_0x892e('0xd'))['register'](socket);function respondWithRpcPromise(_0x5b308e,_0x87b76d,_0x15e72f){return new BPromise(function(_0x47f851,_0x5ebf3f){return client['request'](_0x5b308e,_0x15e72f)[_0x892e('0xe')](function(_0x22d534){logger[_0x892e('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x87b76d,_0x892e('0x10'));logger['debug'](_0x892e('0x11'),_0x87b76d,_0x892e('0x10'),JSON[_0x892e('0x12')](_0x22d534));if(_0x22d534['error']){if(_0x22d534[_0x892e('0x13')][_0x892e('0x14')]===0x1f4){logger[_0x892e('0x13')](_0x892e('0x15'),_0x87b76d,_0x22d534['error'][_0x892e('0x16')]);return _0x5ebf3f(_0x22d534[_0x892e('0x13')][_0x892e('0x16')]);}logger['error'](_0x892e('0x15'),_0x87b76d,_0x22d534['error']['message']);return _0x47f851(_0x22d534['error']['message']);}else{logger[_0x892e('0xf')](_0x892e('0x15'),_0x87b76d,_0x892e('0x10'));_0x47f851(_0x22d534[_0x892e('0x17')][_0x892e('0x16')]);}})[_0x892e('0x18')](function(_0x494d9c){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x87b76d,_0x494d9c);_0x5ebf3f(_0x494d9c);});});}exports[_0x892e('0x19')]=function(_0x3faf42){var _0x5a3f13=this;return new Promise(function(_0x5603e3,_0x4bf1e7){return db[_0x892e('0x1a')][_0x892e('0x1b')]({'raw':_0x3faf42[_0x892e('0x1c')]?_0x3faf42[_0x892e('0x1c')][_0x892e('0x1d')]===undefined?!![]:![]:!![],'where':_0x3faf42[_0x892e('0x1c')]?_0x3faf42['options'][_0x892e('0x1e')]||null:null,'attributes':_0x3faf42[_0x892e('0x1c')]?_0x3faf42[_0x892e('0x1c')][_0x892e('0x1f')]||null:null,'limit':_0x3faf42['options']?_0x3faf42[_0x892e('0x1c')][_0x892e('0x20')]||null:null,'include':_0x3faf42['options']?_0x3faf42[_0x892e('0x1c')][_0x892e('0x21')]?_[_0x892e('0x22')](_0x3faf42['options']['include'],function(_0x8ffa29){return{'model':db[_0x8ffa29[_0x892e('0x23')]],'as':_0x8ffa29['as'],'attributes':_0x8ffa29[_0x892e('0x1f')],'include':_0x8ffa29[_0x892e('0x21')]?_[_0x892e('0x22')](_0x8ffa29[_0x892e('0x21')],function(_0x246026){return{'model':db[_0x246026[_0x892e('0x23')]],'as':_0x246026['as'],'attributes':_0x246026[_0x892e('0x1f')],'include':_0x246026[_0x892e('0x21')]?_[_0x892e('0x22')](_0x246026[_0x892e('0x21')],function(_0x3e1f26){return{'model':db[_0x3e1f26[_0x892e('0x23')]],'as':_0x3e1f26['as'],'attributes':_0x3e1f26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de1b5){logger[_0x892e('0xf')]('GetVoiceExtension',_0x3faf42);logger[_0x892e('0x24')](_0x892e('0x19'),_0x3faf42,JSON[_0x892e('0x12')](_0x2de1b5));_0x5603e3(_0x2de1b5);})[_0x892e('0x18')](function(_0x3ece9d){logger[_0x892e('0x13')](_0x892e('0x19'),_0x3ece9d[_0x892e('0x16')],_0x3faf42);_0x4bf1e7(_0x5a3f13[_0x892e('0x13')](0x1f4,_0x3ece9d[_0x892e('0x16')]));});});}; \ No newline at end of file +var _0x0b9b=['../../config/environment','client','http','redis','socket.io-emitter','./voiceExtension.socket','request','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','map','model','include','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3a190a,_0x2ef054){var _0x1a35b5=function(_0x22ce69){while(--_0x22ce69){_0x3a190a['push'](_0x3a190a['shift']());}};_0x1a35b5(++_0x2ef054);}(_0x0b9b,0x186));var _0xb0b9=function(_0x404d68,_0x11bc24){_0x404d68=_0x404d68-0x0;var _0xe1496d=_0x0b9b[_0x404d68];return _0xe1496d;};'use strict';var _=require(_0xb0b9('0x0'));var util=require(_0xb0b9('0x1'));var moment=require(_0xb0b9('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0b9('0x3'));var fs=require('fs');var Redis=require(_0xb0b9('0x4'));var db=require(_0xb0b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb0b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb0b9('0x7')][_0xb0b9('0x8')]({'port':0x232a});config[_0xb0b9('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb0b9('0xa'))(new Redis(config[_0xb0b9('0x9')]));require(_0xb0b9('0xb'))['register'](socket);function respondWithRpcPromise(_0x2f1198,_0x5c66c3,_0xbe56db){return new BPromise(function(_0x24f37b,_0x360b9a){return client[_0xb0b9('0xc')](_0x2f1198,_0xbe56db)[_0xb0b9('0xd')](function(_0x284ae5){logger[_0xb0b9('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x5c66c3,_0xb0b9('0xf'));logger['debug'](_0xb0b9('0x10'),_0x5c66c3,_0xb0b9('0xf'),JSON[_0xb0b9('0x11')](_0x284ae5));if(_0x284ae5[_0xb0b9('0x12')]){if(_0x284ae5['error'][_0xb0b9('0x13')]===0x1f4){logger['error'](_0xb0b9('0x14'),_0x5c66c3,_0x284ae5[_0xb0b9('0x12')][_0xb0b9('0x15')]);return _0x360b9a(_0x284ae5[_0xb0b9('0x12')][_0xb0b9('0x15')]);}logger[_0xb0b9('0x12')](_0xb0b9('0x14'),_0x5c66c3,_0x284ae5[_0xb0b9('0x12')][_0xb0b9('0x15')]);return _0x24f37b(_0x284ae5[_0xb0b9('0x12')][_0xb0b9('0x15')]);}else{logger[_0xb0b9('0xe')](_0xb0b9('0x14'),_0x5c66c3,_0xb0b9('0xf'));_0x24f37b(_0x284ae5[_0xb0b9('0x16')][_0xb0b9('0x15')]);}})[_0xb0b9('0x17')](function(_0x394088){logger[_0xb0b9('0x12')](_0xb0b9('0x14'),_0x5c66c3,_0x394088);_0x360b9a(_0x394088);});});}exports[_0xb0b9('0x18')]=function(_0x4826c9){var _0x3502b4=this;return new Promise(function(_0x4c220e,_0x61a6b){return db[_0xb0b9('0x19')][_0xb0b9('0x1a')]({'raw':_0x4826c9['options']?_0x4826c9[_0xb0b9('0x1b')][_0xb0b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x4826c9[_0xb0b9('0x1b')]?_0x4826c9[_0xb0b9('0x1b')][_0xb0b9('0x1d')]||null:null,'attributes':_0x4826c9[_0xb0b9('0x1b')]?_0x4826c9['options'][_0xb0b9('0x1e')]||null:null,'limit':_0x4826c9['options']?_0x4826c9[_0xb0b9('0x1b')][_0xb0b9('0x1f')]||null:null,'include':_0x4826c9[_0xb0b9('0x1b')]?_0x4826c9[_0xb0b9('0x1b')]['include']?_[_0xb0b9('0x20')](_0x4826c9[_0xb0b9('0x1b')]['include'],function(_0x307ba1){return{'model':db[_0x307ba1[_0xb0b9('0x21')]],'as':_0x307ba1['as'],'attributes':_0x307ba1['attributes'],'include':_0x307ba1[_0xb0b9('0x22')]?_[_0xb0b9('0x20')](_0x307ba1[_0xb0b9('0x22')],function(_0xdd5472){return{'model':db[_0xdd5472['model']],'as':_0xdd5472['as'],'attributes':_0xdd5472['attributes'],'include':_0xdd5472[_0xb0b9('0x22')]?_['map'](_0xdd5472[_0xb0b9('0x22')],function(_0x17b461){return{'model':db[_0x17b461[_0xb0b9('0x21')]],'as':_0x17b461['as'],'attributes':_0x17b461['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0b9('0xd')](function(_0x6466cc){logger[_0xb0b9('0xe')](_0xb0b9('0x18'),_0x4826c9);logger[_0xb0b9('0x23')](_0xb0b9('0x18'),_0x4826c9,JSON[_0xb0b9('0x11')](_0x6466cc));_0x4c220e(_0x6466cc);})['catch'](function(_0x1a703e){logger[_0xb0b9('0x12')]('GetVoiceExtension',_0x1a703e['message'],_0x4826c9);_0x61a6b(_0x3502b4[_0xb0b9('0x12')](0x1f4,_0x1a703e[_0xb0b9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d527f8f..48db48e 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3050=['save','remove','update','register','voiceExtension:','./voiceExtension.events'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x3050,0x12b));var _0x0305=function(_0x411706,_0xfb1946){_0x411706=_0x411706-0x0;var _0x24a80f=_0x3050[_0x411706];return _0x24a80f;};'use strict';var VoiceExtensionEvents=require(_0x0305('0x0'));var events=[_0x0305('0x1'),_0x0305('0x2'),_0x0305('0x3')];function createListener(_0x2e6efc,_0x42861c){return function(_0x1761ec){_0x42861c['emit'](_0x2e6efc,_0x1761ec);};}function removeListener(_0x542b4f,_0x361089){return function(){VoiceExtensionEvents['removeListener'](_0x542b4f,_0x361089);};}exports[_0x0305('0x4')]=function(_0xbc499a){for(var _0x1a2ad1=0x0,_0x209371=events['length'];_0x1a2ad1<_0x209371;_0x1a2ad1++){var _0x24dcf0=events[_0x1a2ad1];var _0x1d7ec8=createListener(_0x0305('0x5')+_0x24dcf0,_0xbc499a);VoiceExtensionEvents['on'](_0x24dcf0,_0x1d7ec8);}}; \ No newline at end of file +var _0x6974=['removeListener','register','length','./voiceExtension.events','save','update','emit'];(function(_0x97c71f,_0x4896d7){var _0x7eb4bf=function(_0x1531f7){while(--_0x1531f7){_0x97c71f['push'](_0x97c71f['shift']());}};_0x7eb4bf(++_0x4896d7);}(_0x6974,0x145));var _0x4697=function(_0x318c36,_0x5647e9){_0x318c36=_0x318c36-0x0;var _0x4182bd=_0x6974[_0x318c36];return _0x4182bd;};'use strict';var VoiceExtensionEvents=require(_0x4697('0x0'));var events=[_0x4697('0x1'),'remove',_0x4697('0x2')];function createListener(_0x556376,_0x2a7547){return function(_0x236ac2){_0x2a7547[_0x4697('0x3')](_0x556376,_0x236ac2);};}function removeListener(_0x13359d,_0x165885){return function(){VoiceExtensionEvents[_0x4697('0x4')](_0x13359d,_0x165885);};}exports[_0x4697('0x5')]=function(_0x2ff716){for(var _0x42484c=0x0,_0x43d060=events[_0x4697('0x6')];_0x42484c<_0x43d060;_0x42484c++){var _0x460fdb=events[_0x42484c];var _0x3a3f48=createListener('voiceExtension:'+_0x460fdb,_0x2ff716);VoiceExtensionEvents['on'](_0x460fdb,_0x3a3f48);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index a7a8baf..989c60b 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45d0=['Router','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','create','put','update','destroy','exports','multer','util','express'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x45d0,0x15d));var _0x045d=function(_0x264954,_0x4de852){_0x264954=_0x264954-0x0;var _0x8f4e0e=_0x45d0[_0x264954];return _0x8f4e0e;};'use strict';var multer=require(_0x045d('0x0'));var util=require(_0x045d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x045d('0x2'));var router=express[_0x045d('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x045d('0x4'));var controller=require('./voiceMail.controller');router[_0x045d('0x5')]('/',auth[_0x045d('0x6')](),controller[_0x045d('0x7')]);router[_0x045d('0x5')](_0x045d('0x8'),auth[_0x045d('0x6')](),controller[_0x045d('0x9')]);router[_0x045d('0x5')]('/:id/messages',auth[_0x045d('0x6')](),controller[_0x045d('0xa')]);router['post']('/',auth[_0x045d('0x6')](),controller[_0x045d('0xb')]);router[_0x045d('0xc')](_0x045d('0x8'),auth[_0x045d('0x6')](),controller[_0x045d('0xd')]);router['delete'](_0x045d('0x8'),auth[_0x045d('0x6')](),controller[_0x045d('0xe')]);module[_0x045d('0xf')]=router; \ No newline at end of file +var _0x47d4=['multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','getMessages','post','put','update'];(function(_0x3cda08,_0x149a60){var _0x45cd62=function(_0x4d890d){while(--_0x4d890d){_0x3cda08['push'](_0x3cda08['shift']());}};_0x45cd62(++_0x149a60);}(_0x47d4,0x150));var _0x447d=function(_0x11376f,_0x3630aa){_0x11376f=_0x11376f-0x0;var _0x4ec55b=_0x47d4[_0x11376f];return _0x4ec55b;};'use strict';var multer=require(_0x447d('0x0'));var util=require('util');var path=require(_0x447d('0x1'));var timeout=require(_0x447d('0x2'));var express=require('express');var router=express[_0x447d('0x3')]();var auth=require(_0x447d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x447d('0x5'));var controller=require(_0x447d('0x6'));router['get']('/',auth[_0x447d('0x7')](),controller['index']);router[_0x447d('0x8')](_0x447d('0x9'),auth['isAuthenticated'](),controller[_0x447d('0xa')]);router['get'](_0x447d('0xb'),auth[_0x447d('0x7')](),controller[_0x447d('0xc')]);router[_0x447d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x447d('0xe')]('/:id',auth[_0x447d('0x7')](),controller[_0x447d('0xf')]);router['delete']('/:id',auth[_0x447d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 42a0b1b..1cc8264 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd4f=['string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','from-voicemail','contest_mailbox','STRING','setDataValue','email'];(function(_0x1cce50,_0x39aaba){var _0x2b0884=function(_0x2fab65){while(--_0x2fab65){_0x1cce50['push'](_0x1cce50['shift']());}};_0x2b0884(++_0x39aaba);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x454cd5,_0x1cae75){_0x454cd5=_0x454cd5-0x0;var _0x2a52dc=_0xdd4f[_0x454cd5];return _0x2a52dc;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xfdd4('0x1'),'unique':_0xfdd4('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xfdd4('0x2')},'password':{'type':Sequelize[_0xfdd4('0x3')]},'fullname':{'type':Sequelize[_0xfdd4('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x398015){this[_0xfdd4('0x4')](_0xfdd4('0x5'),typeof _0x398015===_0xfdd4('0x6')&&_0x398015[_0xfdd4('0x7')]()?_0x398015['trim']():null);}},'pager':{'type':Sequelize[_0xfdd4('0x3')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xfdd4('0x8')},'attach':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xfdd4('0x9')]('yes','no'),'defaultValue':_0xfdd4('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfdd4('0x3')]},'callback':{'type':Sequelize[_0xfdd4('0x3')]},'review':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xfdd4('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfdd4('0x9')]('yes','no'),'defaultValue':_0xfdd4('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xfdd4('0xb')},'emailsubject':{'type':Sequelize[_0xfdd4('0x3')]},'emailbody':{'type':Sequelize[_0xfdd4('0x3')]},'maxsecs':{'type':Sequelize[_0xfdd4('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfdd4('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfdd4('0xd')],'get':function(){return this[_0xfdd4('0xe')](_0xfdd4('0xf'))+_0xfdd4('0x10')+this['getDataValue'](_0xfdd4('0x11'));}}}; \ No newline at end of file +var _0x80ed=['setDataValue','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox'];(function(_0x3f6598,_0x1a677d){var _0x589cdb=function(_0x55e4e8){while(--_0x55e4e8){_0x3f6598['push'](_0x3f6598['shift']());}};_0x589cdb(++_0x1a677d);}(_0x80ed,0x11c));var _0xd80e=function(_0xe2303a,_0x142c20){_0xe2303a=_0xe2303a-0x0;var _0x3ab386=_0x80ed[_0xe2303a];return _0x3ab386;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xd80e('0x1')]},'context':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':'','allowNull':![],'unique':_0xd80e('0x3')},'password':{'type':Sequelize[_0xd80e('0x1')]},'fullname':{'type':Sequelize[_0xd80e('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x26e6ff){this[_0xd80e('0x4')](_0xd80e('0x5'),typeof _0x26e6ff==='string'&&_0x26e6ff[_0xd80e('0x6')]()?_0x26e6ff[_0xd80e('0x6')]():null);}},'pager':{'type':Sequelize[_0xd80e('0x1')]},'tz':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x7')},'attach':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xd80e('0x1')]},'callback':{'type':Sequelize[_0xd80e('0x1')]},'review':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd80e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'stamp':{'type':_0xd80e('0xa')},'emailsubject':{'type':Sequelize[_0xd80e('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd80e('0xc')],'get':function(){return this[_0xd80e('0xd')]('fullname')+_0xd80e('0xe')+this[_0xd80e('0xd')](_0xd80e('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5bc0163..d241a19 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','includeAll','include','rows','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','getMessages','findOne','VoiceMailMessage','hasOwnProperty','pick','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','then','get','Voicemails','error','stack','name','map','VoiceMail','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2aff0c,_0x501711){_0x2aff0c=_0x2aff0c-0x0;var _0x3cd4c7=_0x5f2f[_0x2aff0c];return _0x3cd4c7;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=_0x17d656[_0xf5f2('0x1b')],_0x23e23a=_0x286197[_0xf5f2('0x1c')],_0x3a9dbb=_0x286197[_0xf5f2('0x1c')]+_0x286197[_0xf5f2('0x1d')],_0xdb61b3;if(_0x3a9dbb>=_0x1b6dd2){_0x3a9dbb=_0x1b6dd2;_0xdb61b3=0xc8;}else{_0xdb61b3=0xce;}_0xafe430[_0xf5f2('0x1a')](_0xdb61b3);return _0xafe430[_0xf5f2('0x1e')](_0xf5f2('0x1f'),_0x23e23a+'-'+_0x3a9dbb+'/'+_0x1b6dd2)[_0xf5f2('0x20')](_0x17d656);}return null;};}function patchUpdates(_0x626999){return function(_0x1bf655){try{jsonpatch['apply'](_0x1bf655,_0x626999,!![]);}catch(_0x34706d){return BPromise[_0xf5f2('0x21')](_0x34706d);}return _0x1bf655['save']();};}function saveUpdates(_0x47acfc,_0x2d2805){return function(_0x388e6c){if(_0x388e6c){return _0x388e6c['update'](_0x47acfc)[_0xf5f2('0x22')](function(_0x170042){return _0x170042;});}return null;};}function removeEntity(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['destroy']()[_0xf5f2('0x22')](function(){var _0x4669a6=_0x36f1cb[_0xf5f2('0x23')]({'plain':!![]});var _0x2833fe=_0xf5f2('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x2833fe,'resourceId':_0x4669a6['id']}})[_0xf5f2('0x22')](function(){return _0x36f1cb;});})[_0xf5f2('0x22')](function(){_0x39e44a[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0xf6c58d,_0x788a8d){return function(_0x13a3be){if(!_0x13a3be){_0xf6c58d[_0xf5f2('0x18')](0x194);}return _0x13a3be;};}function handleError(_0x294414,_0x4ab014){_0x4ab014=_0x4ab014||0x1f4;return function(_0xaa2602){logger[_0xf5f2('0x25')](_0xaa2602[_0xf5f2('0x26')]);if(_0xaa2602[_0xf5f2('0x27')]){delete _0xaa2602[_0xf5f2('0x27')];}_0x294414[_0xf5f2('0x1a')](_0x4ab014)['send'](_0xaa2602);};}exports['index']=function(_0x22c826,_0x14c829){var _0x11c771={},_0x5027ab={},_0x5a2c7e={'count':0x0,'rows':[]};var _0x29571b=_[_0xf5f2('0x28')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x1b381e){return{'name':_0x1b381e['fieldName'],'type':_0x1b381e['type'][_0xf5f2('0x2b')]};});_0x5027ab['model']=_[_0xf5f2('0x28')](_0x29571b,'name');_0x5027ab[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](_0x22c826[_0xf5f2('0x2c')]);_0x5027ab[_0xf5f2('0x2e')]=_[_0xf5f2('0x2f')](_0x5027ab[_0xf5f2('0x30')],_0x5027ab[_0xf5f2('0x2c')]);_0x11c771[_0xf5f2('0x31')]=_['intersection'](_0x5027ab[_0xf5f2('0x30')],qs[_0xf5f2('0x32')](_0x22c826[_0xf5f2('0x2c')][_0xf5f2('0x32')]));_0x11c771[_0xf5f2('0x31')]=_0x11c771[_0xf5f2('0x31')][_0xf5f2('0x33')]?_0x11c771['attributes']:_0x5027ab[_0xf5f2('0x30')];if(!_0x22c826[_0xf5f2('0x2c')]['hasOwnProperty'](_0xf5f2('0x34'))){_0x11c771['limit']=qs[_0xf5f2('0x1d')](_0x22c826[_0xf5f2('0x2c')][_0xf5f2('0x1d')]);_0x11c771[_0xf5f2('0x1c')]=qs['offset'](_0x22c826['query'][_0xf5f2('0x1c')]);}_0x11c771[_0xf5f2('0x35')]=qs[_0xf5f2('0x36')](_0x22c826['query'][_0xf5f2('0x36')]);_0x11c771['where']=qs[_0xf5f2('0x2e')](_['pick'](_0x22c826[_0xf5f2('0x2c')],_0x5027ab[_0xf5f2('0x2e')]),_0x29571b);if(_0x22c826['query'][_0xf5f2('0x37')]){_0x11c771[_0xf5f2('0x38')]=_[_0xf5f2('0x39')](_0x11c771[_0xf5f2('0x38')],{'$or':_['map'](_0x29571b,function(_0x5d2d82){if(_0x5d2d82[_0xf5f2('0x3a')]!==_0xf5f2('0x3b')){var _0x22b20c={};_0x22b20c[_0x5d2d82[_0xf5f2('0x27')]]={'$like':'%'+_0x22c826[_0xf5f2('0x2c')][_0xf5f2('0x37')]+'%'};return _0x22b20c;}})});}_0x11c771=_[_0xf5f2('0x39')]({},_0x11c771,_0x22c826['options']);var _0x110fe5={'where':_0x11c771[_0xf5f2('0x38')]};return db['VoiceMail'][_0xf5f2('0x1b')](_0x110fe5)[_0xf5f2('0x22')](function(_0x71b0e7){_0x5a2c7e[_0xf5f2('0x1b')]=_0x71b0e7;if(_0x22c826[_0xf5f2('0x2c')][_0xf5f2('0x3c')]){_0x11c771[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')]['findAll'](_0x11c771);})[_0xf5f2('0x22')](function(_0x34792f){_0x5a2c7e[_0xf5f2('0x3e')]=_0x34792f;return _0x5a2c7e;})['then'](respondWithFilteredResult(_0x14c829,_0x11c771))['catch'](handleError(_0x14c829,null));};exports['show']=function(_0x76d21b,_0x2ad13c){var _0x4c8d8e={'raw':!![],'where':{'id':_0x76d21b[_0xf5f2('0x3f')]['id']}},_0x106272={};_0x106272[_0xf5f2('0x30')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x106272[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](_0x76d21b[_0xf5f2('0x2c')]);_0x106272[_0xf5f2('0x2e')]=_[_0xf5f2('0x2f')](_0x106272[_0xf5f2('0x30')],_0x106272[_0xf5f2('0x2c')]);_0x4c8d8e[_0xf5f2('0x31')]=_['intersection'](_0x106272[_0xf5f2('0x30')],qs['fields'](_0x76d21b[_0xf5f2('0x2c')][_0xf5f2('0x32')]));_0x4c8d8e[_0xf5f2('0x31')]=_0x4c8d8e[_0xf5f2('0x31')][_0xf5f2('0x33')]?_0x4c8d8e[_0xf5f2('0x31')]:_0x106272['model'];if(_0x76d21b[_0xf5f2('0x2c')][_0xf5f2('0x3c')]){_0x4c8d8e[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x4c8d8e=_[_0xf5f2('0x39')]({},_0x4c8d8e,_0x76d21b[_0xf5f2('0x40')]);return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x4c8d8e)[_0xf5f2('0x22')](handleEntityNotFound(_0x2ad13c,null))['then'](respondWithResult(_0x2ad13c,null))[_0xf5f2('0x42')](handleError(_0x2ad13c,null));};exports[_0xf5f2('0x43')]=function(_0x45db9a,_0x492eea){return db[_0xf5f2('0x29')][_0xf5f2('0x43')](_0x45db9a[_0xf5f2('0x44')],{})['then'](function(_0x57a7cb){var _0x7bb942=_0x45db9a[_0xf5f2('0x45')]['get']({'plain':!![]});if(!_0x7bb942)throw new Error(_0xf5f2('0x46'));if(_0x7bb942['role']===_0xf5f2('0x45')){var _0x497eb8=_0x57a7cb[_0xf5f2('0x23')]({'plain':!![]});var _0x5d9120=_0xf5f2('0x24');return db[_0xf5f2('0x47')][_0xf5f2('0x41')]({'where':{'name':_0x5d9120,'userProfileId':_0x7bb942[_0xf5f2('0x48')]},'raw':!![]})['then'](function(_0x3154c1){if(_0x3154c1&&_0x3154c1[_0xf5f2('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x497eb8[_0xf5f2('0x27')],'resourceId':_0x497eb8['id'],'type':_0x3154c1[_0xf5f2('0x27')],'sectionId':_0x3154c1['id']},{})['then'](function(){return _0x57a7cb;});}else{return _0x57a7cb;}})[_0xf5f2('0x42')](function(_0xe0ce7f){logger[_0xf5f2('0x25')](_0xf5f2('0x4a'),_0xe0ce7f);throw _0xe0ce7f;});}return _0x57a7cb;})['then'](respondWithResult(_0x492eea,0xc9))['catch'](handleError(_0x492eea,null));};exports[_0xf5f2('0x4b')]=function(_0xa3cc67,_0x4b62fc){if(_0xa3cc67[_0xf5f2('0x44')]['id']){delete _0xa3cc67[_0xf5f2('0x44')]['id'];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')]({'where':{'id':_0xa3cc67[_0xf5f2('0x3f')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x4b62fc,null))[_0xf5f2('0x22')](saveUpdates(_0xa3cc67['body'],null))['then'](respondWithResult(_0x4b62fc,null))[_0xf5f2('0x42')](handleError(_0x4b62fc,null));};exports[_0xf5f2('0x4c')]=function(_0x3c349f,_0x46a905){return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x3c349f[_0xf5f2('0x3f')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x46a905,null))[_0xf5f2('0x22')](removeEntity(_0x46a905,null))['catch'](handleError(_0x46a905,null));};exports[_0xf5f2('0x4d')]=function(_0x4c749f,_0x78f1d2,_0x1a8d33){return db[_0xf5f2('0x29')][_0xf5f2('0x4e')]({'where':{'id':_0x4c749f['params']['id']}})['then'](handleEntityNotFound(_0x78f1d2,null))[_0xf5f2('0x22')](function(_0x4de303){var _0xa39c65;var _0x1f1916={},_0x572ec1={};_0x572ec1[_0xf5f2('0x30')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x4f')]['rawAttributes']);_0x572ec1[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](_0x4c749f[_0xf5f2('0x2c')]);_0x572ec1[_0xf5f2('0x2e')]=_['intersection'](_0x572ec1[_0xf5f2('0x30')],_0x572ec1['query']);_0x1f1916[_0xf5f2('0x31')]=_[_0xf5f2('0x2f')](_0x572ec1[_0xf5f2('0x30')],qs[_0xf5f2('0x32')](_0x4c749f[_0xf5f2('0x2c')]['fields']));_0x1f1916[_0xf5f2('0x31')]=_0x1f1916[_0xf5f2('0x31')][_0xf5f2('0x33')]?_0x1f1916[_0xf5f2('0x31')]:_0x572ec1[_0xf5f2('0x30')];if(!_0x4c749f['query'][_0xf5f2('0x50')]('nolimit')){_0x1f1916['limit']=qs[_0xf5f2('0x1d')](_0x4c749f['query'][_0xf5f2('0x1d')]);_0x1f1916[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4c749f[_0xf5f2('0x2c')]['offset']);}_0x1f1916[_0xf5f2('0x35')]=qs[_0xf5f2('0x36')](_0x4c749f[_0xf5f2('0x2c')][_0xf5f2('0x36')]);_0x1f1916[_0xf5f2('0x38')]=qs[_0xf5f2('0x2e')](_[_0xf5f2('0x51')](_0x4c749f['query'],_0x572ec1[_0xf5f2('0x2e')]));if(_0x4c749f[_0xf5f2('0x2c')][_0xf5f2('0x37')]){_0x1f1916[_0xf5f2('0x38')]=_['merge'](_0x1f1916[_0xf5f2('0x38')],{'$or':_['map'](_0x1f1916[_0xf5f2('0x31')],function(_0x1c7f06){var _0x5588cf={};_0x5588cf[_0x1c7f06]={'$like':'%'+_0x4c749f[_0xf5f2('0x2c')][_0xf5f2('0x37')]+'%'};return _0x5588cf;})});}_0x1f1916[_0xf5f2('0x38')]=_[_0xf5f2('0x39')](_0x1f1916[_0xf5f2('0x38')],{'mailboxuser':_0x4de303['mailbox']});_0x1f1916=_[_0xf5f2('0x39')]({},_0x1f1916,_0x4c749f[_0xf5f2('0x40')]);return db[_0xf5f2('0x4f')][_0xf5f2('0x52')](_0x1f1916)[_0xf5f2('0x22')](respondWithFilteredResult(_0x78f1d2,_0x1f1916));})[_0xf5f2('0x42')](handleError(_0x78f1d2,null));}; \ No newline at end of file +var _0x8921=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','status','Content-Range','reject','save','then','destroy','get','Voicemails','UserProfileResource','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','params','length','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getMessages','findOne','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x8921,0x9a));var _0x1892=function(_0x598da3,_0xd9411f){_0x598da3=_0x598da3-0x0;var _0x5611a1=_0x8921[_0x598da3];return _0x5611a1;};'use strict';var pdf=require(_0x1892('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1892('0x1'));var zipdir=require(_0x1892('0x2'));var jsonpatch=require(_0x1892('0x3'));var rp=require(_0x1892('0x4'));var moment=require(_0x1892('0x5'));var BPromise=require(_0x1892('0x6'));var Mustache=require(_0x1892('0x7'));var util=require(_0x1892('0x8'));var path=require(_0x1892('0x9'));var sox=require(_0x1892('0xa'));var csv=require(_0x1892('0xb'));var ejs=require(_0x1892('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1892('0xd'));var crypto=require(_0x1892('0xe'));var jsforce=require(_0x1892('0xf'));var deskjs=require(_0x1892('0x10'));var toCsv=require(_0x1892('0xb'));var querystring=require(_0x1892('0x11'));var Papa=require('papaparse');var Redis=require(_0x1892('0x12'));var authService=require(_0x1892('0x13'));var qs=require(_0x1892('0x14'));var as=require(_0x1892('0x15'));var hardwareService=require(_0x1892('0x16'));var logger=require(_0x1892('0x17'))(_0x1892('0x18'));var utils=require(_0x1892('0x19'));var config=require(_0x1892('0x1a'));var licenseUtil=require(_0x1892('0x1b'));var db=require(_0x1892('0x1c'))['db'];function respondWithStatusCode(_0x5b8534,_0x9437fc){_0x9437fc=_0x9437fc||0xcc;return function(_0x3eec77){if(_0x3eec77){return _0x5b8534[_0x1892('0x1d')](_0x9437fc);}return _0x5b8534['status'](_0x9437fc)[_0x1892('0x1e')]();};}function respondWithResult(_0xeb57f7,_0xdfdecf){_0xdfdecf=_0xdfdecf||0xc8;return function(_0xf11b26){if(_0xf11b26){return _0xeb57f7['status'](_0xdfdecf)['json'](_0xf11b26);}};}function respondWithFilteredResult(_0x934968,_0x4b15ec){return function(_0x1fafe1){if(_0x1fafe1){var _0x4b3757=_0x1fafe1[_0x1892('0x1f')],_0x10b5f7=_0x4b15ec[_0x1892('0x20')],_0x425251=_0x4b15ec['offset']+_0x4b15ec['limit'],_0x237451;if(_0x425251>=_0x4b3757){_0x425251=_0x4b3757;_0x237451=0xc8;}else{_0x237451=0xce;}_0x934968[_0x1892('0x21')](_0x237451);return _0x934968['set'](_0x1892('0x22'),_0x10b5f7+'-'+_0x425251+'/'+_0x4b3757)['json'](_0x1fafe1);}return null;};}function patchUpdates(_0x11c2e6){return function(_0x148da7){try{jsonpatch['apply'](_0x148da7,_0x11c2e6,!![]);}catch(_0x3191f8){return BPromise[_0x1892('0x23')](_0x3191f8);}return _0x148da7[_0x1892('0x24')]();};}function saveUpdates(_0xf4d237,_0x55b410){return function(_0x53f24c){if(_0x53f24c){return _0x53f24c['update'](_0xf4d237)[_0x1892('0x25')](function(_0x1fd123){return _0x1fd123;});}return null;};}function removeEntity(_0x48ca15,_0xa9a3e0){return function(_0x8fd69a){if(_0x8fd69a){return _0x8fd69a[_0x1892('0x26')]()[_0x1892('0x25')](function(){var _0x53e3bf=_0x8fd69a[_0x1892('0x27')]({'plain':!![]});var _0x3d7da3=_0x1892('0x28');return db[_0x1892('0x29')]['destroy']({'where':{'type':_0x3d7da3,'resourceId':_0x53e3bf['id']}})[_0x1892('0x25')](function(){return _0x8fd69a;});})[_0x1892('0x25')](function(){_0x48ca15[_0x1892('0x21')](0xcc)[_0x1892('0x1e')]();});}};}function handleEntityNotFound(_0x296c45,_0x11275b){return function(_0x8b09dc){if(!_0x8b09dc){_0x296c45[_0x1892('0x1d')](0x194);}return _0x8b09dc;};}function handleError(_0x3b6628,_0x2c3465){_0x2c3465=_0x2c3465||0x1f4;return function(_0x2a40ba){logger['error'](_0x2a40ba[_0x1892('0x2a')]);if(_0x2a40ba[_0x1892('0x2b')]){delete _0x2a40ba['name'];}_0x3b6628[_0x1892('0x21')](_0x2c3465)['send'](_0x2a40ba);};}exports[_0x1892('0x2c')]=function(_0x1ca4db,_0x1ed528){var _0x416794={},_0x823674={},_0x4dd29b={'count':0x0,'rows':[]};var _0x31b022=_[_0x1892('0x2d')](db[_0x1892('0x2e')][_0x1892('0x2f')],function(_0x43e72b){return{'name':_0x43e72b[_0x1892('0x30')],'type':_0x43e72b[_0x1892('0x31')][_0x1892('0x32')]};});_0x823674[_0x1892('0x33')]=_['map'](_0x31b022,'name');_0x823674['query']=_[_0x1892('0x34')](_0x1ca4db[_0x1892('0x35')]);_0x823674['filters']=_['intersection'](_0x823674[_0x1892('0x33')],_0x823674[_0x1892('0x35')]);_0x416794['attributes']=_[_0x1892('0x36')](_0x823674[_0x1892('0x33')],qs[_0x1892('0x37')](_0x1ca4db[_0x1892('0x35')]['fields']));_0x416794[_0x1892('0x38')]=_0x416794[_0x1892('0x38')]['length']?_0x416794[_0x1892('0x38')]:_0x823674['model'];if(!_0x1ca4db['query'][_0x1892('0x39')](_0x1892('0x3a'))){_0x416794['limit']=qs[_0x1892('0x3b')](_0x1ca4db[_0x1892('0x35')][_0x1892('0x3b')]);_0x416794[_0x1892('0x20')]=qs[_0x1892('0x20')](_0x1ca4db[_0x1892('0x35')][_0x1892('0x20')]);}_0x416794[_0x1892('0x3c')]=qs[_0x1892('0x3d')](_0x1ca4db[_0x1892('0x35')]['sort']);_0x416794[_0x1892('0x3e')]=qs[_0x1892('0x3f')](_[_0x1892('0x40')](_0x1ca4db['query'],_0x823674[_0x1892('0x3f')]),_0x31b022);if(_0x1ca4db[_0x1892('0x35')][_0x1892('0x41')]){_0x416794[_0x1892('0x3e')]=_['merge'](_0x416794[_0x1892('0x3e')],{'$or':_[_0x1892('0x2d')](_0x31b022,function(_0x128faf){if(_0x128faf[_0x1892('0x31')]!==_0x1892('0x42')){var _0x83853c={};_0x83853c[_0x128faf[_0x1892('0x2b')]]={'$like':'%'+_0x1ca4db[_0x1892('0x35')][_0x1892('0x41')]+'%'};return _0x83853c;}})});}_0x416794=_[_0x1892('0x43')]({},_0x416794,_0x1ca4db[_0x1892('0x44')]);var _0x5b7dc4={'where':_0x416794[_0x1892('0x3e')]};return db[_0x1892('0x2e')][_0x1892('0x1f')](_0x5b7dc4)[_0x1892('0x25')](function(_0x178b6c){_0x4dd29b[_0x1892('0x1f')]=_0x178b6c;if(_0x1ca4db[_0x1892('0x35')][_0x1892('0x45')]){_0x416794[_0x1892('0x46')]=[{'all':!![]}];}return db[_0x1892('0x2e')][_0x1892('0x47')](_0x416794);})[_0x1892('0x25')](function(_0x4f2646){_0x4dd29b['rows']=_0x4f2646;return _0x4dd29b;})['then'](respondWithFilteredResult(_0x1ed528,_0x416794))['catch'](handleError(_0x1ed528,null));};exports['show']=function(_0x17b833,_0x4c0261){var _0x261040={'raw':!![],'where':{'id':_0x17b833[_0x1892('0x48')]['id']}},_0x554618={};_0x554618[_0x1892('0x33')]=_[_0x1892('0x34')](db[_0x1892('0x2e')][_0x1892('0x2f')]);_0x554618[_0x1892('0x35')]=_[_0x1892('0x34')](_0x17b833[_0x1892('0x35')]);_0x554618[_0x1892('0x3f')]=_[_0x1892('0x36')](_0x554618[_0x1892('0x33')],_0x554618[_0x1892('0x35')]);_0x261040[_0x1892('0x38')]=_['intersection'](_0x554618[_0x1892('0x33')],qs['fields'](_0x17b833['query'][_0x1892('0x37')]));_0x261040['attributes']=_0x261040[_0x1892('0x38')][_0x1892('0x49')]?_0x261040[_0x1892('0x38')]:_0x554618[_0x1892('0x33')];if(_0x17b833['query']['includeAll']){_0x261040[_0x1892('0x46')]=[{'all':!![]}];}_0x261040=_[_0x1892('0x43')]({},_0x261040,_0x17b833['options']);return db[_0x1892('0x2e')]['find'](_0x261040)[_0x1892('0x25')](handleEntityNotFound(_0x4c0261,null))[_0x1892('0x25')](respondWithResult(_0x4c0261,null))[_0x1892('0x4a')](handleError(_0x4c0261,null));};exports[_0x1892('0x4b')]=function(_0x3f9135,_0x5441f1){return db[_0x1892('0x2e')]['create'](_0x3f9135['body'],{})[_0x1892('0x25')](function(_0x137533){var _0x12555f=_0x3f9135[_0x1892('0x4c')][_0x1892('0x27')]({'plain':!![]});if(!_0x12555f)throw new Error(_0x1892('0x4d'));if(_0x12555f[_0x1892('0x4e')]==='user'){var _0x16b5bc=_0x137533[_0x1892('0x27')]({'plain':!![]});var _0x352ce6=_0x1892('0x28');return db[_0x1892('0x4f')][_0x1892('0x50')]({'where':{'name':_0x352ce6,'userProfileId':_0x12555f['userProfileId']},'raw':!![]})[_0x1892('0x25')](function(_0x52fefe){if(_0x52fefe&&_0x52fefe[_0x1892('0x51')]===0x0){return db[_0x1892('0x29')]['create']({'name':_0x16b5bc[_0x1892('0x2b')],'resourceId':_0x16b5bc['id'],'type':_0x52fefe[_0x1892('0x2b')],'sectionId':_0x52fefe['id']},{})['then'](function(){return _0x137533;});}else{return _0x137533;}})[_0x1892('0x4a')](function(_0x87c6c4){logger['error'](_0x1892('0x52'),_0x87c6c4);throw _0x87c6c4;});}return _0x137533;})[_0x1892('0x25')](respondWithResult(_0x5441f1,0xc9))[_0x1892('0x4a')](handleError(_0x5441f1,null));};exports[_0x1892('0x53')]=function(_0x371ab2,_0x20319d){if(_0x371ab2[_0x1892('0x54')]['id']){delete _0x371ab2[_0x1892('0x54')]['id'];}return db['VoiceMail'][_0x1892('0x50')]({'where':{'id':_0x371ab2[_0x1892('0x48')]['id']}})[_0x1892('0x25')](handleEntityNotFound(_0x20319d,null))['then'](saveUpdates(_0x371ab2[_0x1892('0x54')],null))[_0x1892('0x25')](respondWithResult(_0x20319d,null))['catch'](handleError(_0x20319d,null));};exports[_0x1892('0x26')]=function(_0x350df0,_0x4517bb){return db['VoiceMail'][_0x1892('0x50')]({'where':{'id':_0x350df0[_0x1892('0x48')]['id']}})['then'](handleEntityNotFound(_0x4517bb,null))[_0x1892('0x25')](removeEntity(_0x4517bb,null))['catch'](handleError(_0x4517bb,null));};exports[_0x1892('0x55')]=function(_0x2f8112,_0x4a279a,_0x1e56bb){return db['VoiceMail'][_0x1892('0x56')]({'where':{'id':_0x2f8112[_0x1892('0x48')]['id']}})[_0x1892('0x25')](handleEntityNotFound(_0x4a279a,null))[_0x1892('0x25')](function(_0x4af99e){var _0x15ccd8;var _0x3b0c23={},_0x347476={};_0x347476[_0x1892('0x33')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x347476[_0x1892('0x35')]=_[_0x1892('0x34')](_0x2f8112[_0x1892('0x35')]);_0x347476[_0x1892('0x3f')]=_[_0x1892('0x36')](_0x347476[_0x1892('0x33')],_0x347476[_0x1892('0x35')]);_0x3b0c23['attributes']=_[_0x1892('0x36')](_0x347476[_0x1892('0x33')],qs['fields'](_0x2f8112[_0x1892('0x35')][_0x1892('0x37')]));_0x3b0c23[_0x1892('0x38')]=_0x3b0c23[_0x1892('0x38')][_0x1892('0x49')]?_0x3b0c23['attributes']:_0x347476[_0x1892('0x33')];if(!_0x2f8112['query'][_0x1892('0x39')](_0x1892('0x3a'))){_0x3b0c23[_0x1892('0x3b')]=qs[_0x1892('0x3b')](_0x2f8112['query'][_0x1892('0x3b')]);_0x3b0c23[_0x1892('0x20')]=qs[_0x1892('0x20')](_0x2f8112[_0x1892('0x35')][_0x1892('0x20')]);}_0x3b0c23['order']=qs['sort'](_0x2f8112[_0x1892('0x35')][_0x1892('0x3d')]);_0x3b0c23[_0x1892('0x3e')]=qs[_0x1892('0x3f')](_[_0x1892('0x40')](_0x2f8112[_0x1892('0x35')],_0x347476[_0x1892('0x3f')]));if(_0x2f8112['query'][_0x1892('0x41')]){_0x3b0c23['where']=_['merge'](_0x3b0c23['where'],{'$or':_[_0x1892('0x2d')](_0x3b0c23['attributes'],function(_0x47897d){var _0x1c9418={};_0x1c9418[_0x47897d]={'$like':'%'+_0x2f8112[_0x1892('0x35')][_0x1892('0x41')]+'%'};return _0x1c9418;})});}_0x3b0c23[_0x1892('0x3e')]=_[_0x1892('0x43')](_0x3b0c23['where'],{'mailboxuser':_0x4af99e['mailbox']});_0x3b0c23=_[_0x1892('0x43')]({},_0x3b0c23,_0x2f8112[_0x1892('0x44')]);return db['VoiceMailMessage'][_0x1892('0x57')](_0x3b0c23)[_0x1892('0x25')](respondWithFilteredResult(_0x4a279a,_0x3b0c23));})[_0x1892('0x4a')](handleError(_0x4a279a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 310d88a..3714bf3 100644 --- a/server/api/voiceMail/voiceMail.model.js +++ b/server/api/voiceMail/voiceMail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf6e=['exports','voice_voicemail','mailbox','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x3261c1,_0x4b62fa){_0x3261c1=_0x3261c1-0x0;var _0x46d44a=_0xaf6e[_0x3261c1];return _0x46d44a;};'use strict';var _=require(_0xeaf6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeaf6('0x1'));var moment=require(_0xeaf6('0x2'));var BPromise=require(_0xeaf6('0x3'));var rp=require(_0xeaf6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeaf6('0x5'));var config=require(_0xeaf6('0x6'));var attributes=require(_0xeaf6('0x7'));module[_0xeaf6('0x8')]=function(_0x284ffc,_0x4c8814){return _0x284ffc['define']('VoiceMail',attributes,{'tableName':_0xeaf6('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xeaf6('0xa'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb366=['../../config/logger','api','bluebird','request-promise','path','exports','define','mailbox_context','mailbox','context','lodash'];(function(_0x2df0a4,_0x2613ba){var _0x4b3409=function(_0x1c067d){while(--_0x1c067d){_0x2df0a4['push'](_0x2df0a4['shift']());}};_0x4b3409(++_0x2613ba);}(_0xb366,0xa4));var _0x6b36=function(_0x4c8b00,_0x16c38a){_0x4c8b00=_0x4c8b00-0x0;var _0x406a86=_0xb366[_0x4c8b00];return _0x406a86;};'use strict';var _=require(_0x6b36('0x0'));var util=require('util');var logger=require(_0x6b36('0x1'))(_0x6b36('0x2'));var moment=require('moment');var BPromise=require(_0x6b36('0x3'));var rp=require(_0x6b36('0x4'));var fs=require('fs');var path=require(_0x6b36('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x6b36('0x6')]=function(_0x2c7a78,_0x485e85){return _0x2c7a78[_0x6b36('0x7')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x6b36('0x8'),'fields':[_0x6b36('0x9'),_0x6b36('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 3646bd0..89a9685 100644 --- a/server/api/voiceMail/voiceMail.rpc.js +++ b/server/api/voiceMail/voiceMail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60a2=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x60a2,0xb1));var _0x260a=function(_0x5262df,_0x19a181){_0x5262df=_0x5262df-0x0;var _0x35fe0f=_0x60a2[_0x5262df];return _0x35fe0f;};'use strict';var _=require(_0x260a('0x0'));var util=require(_0x260a('0x1'));var moment=require('moment');var BPromise=require(_0x260a('0x2'));var rs=require(_0x260a('0x3'));var fs=require('fs');var Redis=require(_0x260a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x260a('0x5'));var logger=require(_0x260a('0x6'))(_0x260a('0x7'));var config=require(_0x260a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x260a('0x9')][_0x260a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c8d0f,_0x44c0bb,_0x43c08a){return new BPromise(function(_0xee66dd,_0x54ec55){return client['request'](_0x5c8d0f,_0x43c08a)[_0x260a('0xb')](function(_0x5df30a){logger[_0x260a('0xc')](_0x260a('0xd'),_0x44c0bb,_0x260a('0xe'));logger[_0x260a('0xf')](_0x260a('0x10'),_0x44c0bb,_0x260a('0xe'),JSON[_0x260a('0x11')](_0x5df30a));if(_0x5df30a[_0x260a('0x12')]){if(_0x5df30a[_0x260a('0x12')]['code']===0x1f4){logger[_0x260a('0x12')](_0x260a('0xd'),_0x44c0bb,_0x5df30a['error'][_0x260a('0x13')]);return _0x54ec55(_0x5df30a[_0x260a('0x12')][_0x260a('0x13')]);}logger[_0x260a('0x12')](_0x260a('0xd'),_0x44c0bb,_0x5df30a[_0x260a('0x12')][_0x260a('0x13')]);return _0xee66dd(_0x5df30a['error']['message']);}else{logger[_0x260a('0xc')]('VoiceMail,\x20%s,\x20%s',_0x44c0bb,_0x260a('0xe'));_0xee66dd(_0x5df30a[_0x260a('0x14')]['message']);}})[_0x260a('0x15')](function(_0x88ec74){logger[_0x260a('0x12')](_0x260a('0xd'),_0x44c0bb,_0x88ec74);_0x54ec55(_0x88ec74);});});} \ No newline at end of file +var _0xb34c=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb34c,0xf2));var _0xcb34=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb34c[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xcb34('0x0'));var moment=require(_0xcb34('0x1'));var BPromise=require(_0xcb34('0x2'));var rs=require(_0xcb34('0x3'));var fs=require('fs');var Redis=require(_0xcb34('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcb34('0x5'))(_0xcb34('0x6'));var config=require(_0xcb34('0x7'));var jayson=require(_0xcb34('0x8'));var client=jayson[_0xcb34('0x9')][_0xcb34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x882202,_0x2e07ff,_0x13b7cf){return new BPromise(function(_0x4cc4b3,_0x33ff3c){return client['request'](_0x882202,_0x13b7cf)[_0xcb34('0xb')](function(_0x4f923f){logger['info'](_0xcb34('0xc'),_0x2e07ff,_0xcb34('0xd'));logger[_0xcb34('0xe')](_0xcb34('0xf'),_0x2e07ff,_0xcb34('0xd'),JSON['stringify'](_0x4f923f));if(_0x4f923f['error']){if(_0x4f923f[_0xcb34('0x10')][_0xcb34('0x11')]===0x1f4){logger[_0xcb34('0x10')](_0xcb34('0xc'),_0x2e07ff,_0x4f923f[_0xcb34('0x10')][_0xcb34('0x12')]);return _0x33ff3c(_0x4f923f[_0xcb34('0x10')][_0xcb34('0x12')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x2e07ff,_0x4f923f['error'][_0xcb34('0x12')]);return _0x4cc4b3(_0x4f923f[_0xcb34('0x10')][_0xcb34('0x12')]);}else{logger[_0xcb34('0x13')](_0xcb34('0xc'),_0x2e07ff,'request\x20sent');_0x4cc4b3(_0x4f923f[_0xcb34('0x14')][_0xcb34('0x12')]);}})[_0xcb34('0x15')](function(_0x52237a){logger[_0xcb34('0x10')](_0xcb34('0xc'),_0x2e07ff,_0x52237a);_0x33ff3c(_0x52237a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 48671b7..a654dd9 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/:id/download',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/',auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router['delete'](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0x7217=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1b041c,_0x57e834){var _0x1f2519=function(_0x12ac7e){while(--_0x12ac7e){_0x1b041c['push'](_0x1b041c['shift']());}};_0x1f2519(++_0x57e834);}(_0x7217,0x19e));var _0x7721=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7217[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['put'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0x11')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);module[_0x7721('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index bdaa1a7..c0d5686 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.attributes.js +++ b/server/api/voiceMailMessage/voiceMailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x461f=['STRING','long','TIMESTAMP','sequelize','VIRTUAL','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x461f,0x153));var _0xf461=function(_0x253e1f,_0xd247f0){_0x253e1f=_0x253e1f-0x0;var _0x1adb58=_0x461f[_0x253e1f];return _0x1adb58;};'use strict';var Sequelize=require(_0xf461('0x0'));module['exports']={'name':{'type':Sequelize[_0xf461('0x1')],'get':function(_0xd75560){return this[_0xf461('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf461('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xf461('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf461('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf461('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf461('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xf461('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf461('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf461('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xf461('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xf461('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xf461('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x8366=['getDataValue','STRING','BLOB','long','sequelize','exports','VIRTUAL'];(function(_0xd47bfa,_0x547ff3){var _0x539439=function(_0x4e04b2){while(--_0x4e04b2){_0xd47bfa['push'](_0xd47bfa['shift']());}};_0x539439(++_0x547ff3);}(_0x8366,0x18c));var _0x6836=function(_0x2a9fb6,_0x2af06c){_0x2a9fb6=_0x2a9fb6-0x0;var _0x209a2b=_0x8366[_0x2a9fb6];return _0x209a2b;};'use strict';var Sequelize=require(_0x6836('0x0'));module[_0x6836('0x1')]={'name':{'type':Sequelize[_0x6836('0x2')],'get':function(_0x24c24d){return this[_0x6836('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x6836('0x5')](_0x6836('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a9ea49b..5b142d2 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.controller.js +++ b/server/api/voiceMailMessage/voiceMailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2289=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceMailMessage','count','include','findAll','rows','keys','includeAll','find','create','body','catch','params','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','lodash','crypto','jsforce','to-csv','querystring'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2289,0x98));var _0x9228=function(_0x404cde,_0x27b51c){_0x404cde=_0x404cde-0x0;var _0x139882=_0x2289[_0x404cde];return _0x139882;};'use strict';var pdf=require(_0x9228('0x0'));var emlformat=require(_0x9228('0x1'));var rimraf=require(_0x9228('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9228('0x3'));var rp=require(_0x9228('0x4'));var moment=require(_0x9228('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9228('0x6'));var util=require(_0x9228('0x7'));var path=require(_0x9228('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9228('0x9'));var squel=require('squel');var crypto=require(_0x9228('0xa'));var jsforce=require(_0x9228('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9228('0xc'));var querystring=require(_0x9228('0xd'));var Papa=require('papaparse');var Redis=require(_0x9228('0xe'));var authService=require(_0x9228('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9228('0x10'));var logger=require(_0x9228('0x11'))(_0x9228('0x12'));var utils=require(_0x9228('0x13'));var config=require(_0x9228('0x14'));var licenseUtil=require(_0x9228('0x15'));var db=require(_0x9228('0x16'))['db'];function respondWithStatusCode(_0x4de7f4,_0x5955ab){_0x5955ab=_0x5955ab||0xcc;return function(_0x5d119d){if(_0x5d119d){return _0x4de7f4[_0x9228('0x17')](_0x5955ab);}return _0x4de7f4[_0x9228('0x18')](_0x5955ab)[_0x9228('0x19')]();};}function respondWithResult(_0x14eb36,_0x4cfcd6){_0x4cfcd6=_0x4cfcd6||0xc8;return function(_0x469c07){if(_0x469c07){return _0x14eb36[_0x9228('0x18')](_0x4cfcd6)[_0x9228('0x1a')](_0x469c07);}};}function respondWithFilteredResult(_0x569426,_0x380a56){return function(_0x4a62b4){if(_0x4a62b4){var _0x152995=_0x4a62b4['count'],_0x27c6cf=_0x380a56[_0x9228('0x1b')],_0x197d5a=_0x380a56[_0x9228('0x1b')]+_0x380a56['limit'],_0x26e904;if(_0x197d5a>=_0x152995){_0x197d5a=_0x152995;_0x26e904=0xc8;}else{_0x26e904=0xce;}_0x569426['status'](_0x26e904);return _0x569426['set'](_0x9228('0x1c'),_0x27c6cf+'-'+_0x197d5a+'/'+_0x152995)[_0x9228('0x1a')](_0x4a62b4);}return null;};}function patchUpdates(_0x56d53e){return function(_0xed94){try{jsonpatch[_0x9228('0x1d')](_0xed94,_0x56d53e,!![]);}catch(_0x367905){return BPromise[_0x9228('0x1e')](_0x367905);}return _0xed94['save']();};}function saveUpdates(_0x844b7a,_0x3f2748){return function(_0x283f63){if(_0x283f63){return _0x283f63[_0x9228('0x1f')](_0x844b7a)[_0x9228('0x20')](function(_0x29aac6){return _0x29aac6;});}return null;};}function removeEntity(_0x5cd66d,_0x2ff8cf){return function(_0x2c540b){if(_0x2c540b){return _0x2c540b[_0x9228('0x21')]()[_0x9228('0x20')](function(){_0x5cd66d[_0x9228('0x18')](0xcc)[_0x9228('0x19')]();});}};}function handleEntityNotFound(_0x59e1ba,_0xe7aee8){return function(_0x17e2ca){if(!_0x17e2ca){_0x59e1ba['sendStatus'](0x194);}return _0x17e2ca;};}function handleError(_0x322204,_0x2a9c90){_0x2a9c90=_0x2a9c90||0x1f4;return function(_0x39f72e){logger[_0x9228('0x22')](_0x39f72e[_0x9228('0x23')]);if(_0x39f72e[_0x9228('0x24')]){delete _0x39f72e['name'];}_0x322204[_0x9228('0x18')](_0x2a9c90)[_0x9228('0x25')](_0x39f72e);};}exports[_0x9228('0x26')]=function(_0x30904b,_0x1b1c8a){var _0x4135f1={},_0x2e8fa7={},_0x4614fd={'count':0x0,'rows':[]};var _0x3ae07d=_[_0x9228('0x27')](db['VoiceMailMessage']['rawAttributes'],function(_0x25daab){return{'name':_0x25daab[_0x9228('0x28')],'type':_0x25daab['type'][_0x9228('0x29')]};});_0x2e8fa7['model']=_['differenceBy'](_[_0x9228('0x27')](_0x3ae07d,'name'),[_0x9228('0x24')]);_0x2e8fa7[_0x9228('0x2a')]=_['keys'](_0x30904b['query']);_0x2e8fa7[_0x9228('0x2b')]=_[_0x9228('0x2c')](_0x2e8fa7[_0x9228('0x2d')],_0x2e8fa7[_0x9228('0x2a')]);_0x4135f1[_0x9228('0x2e')]=_[_0x9228('0x2c')](_0x2e8fa7[_0x9228('0x2d')],qs[_0x9228('0x2f')](_0x30904b[_0x9228('0x2a')][_0x9228('0x2f')]));_0x4135f1[_0x9228('0x2e')]=_0x4135f1[_0x9228('0x2e')][_0x9228('0x30')]?_0x4135f1['attributes']:_0x2e8fa7[_0x9228('0x2d')];if(!_0x30904b['query'][_0x9228('0x31')](_0x9228('0x32'))){_0x4135f1[_0x9228('0x33')]=qs[_0x9228('0x33')](_0x30904b[_0x9228('0x2a')][_0x9228('0x33')]);_0x4135f1[_0x9228('0x1b')]=qs[_0x9228('0x1b')](_0x30904b[_0x9228('0x2a')]['offset']);}_0x4135f1[_0x9228('0x34')]=qs[_0x9228('0x35')](_0x30904b[_0x9228('0x2a')][_0x9228('0x35')]);_0x4135f1[_0x9228('0x36')]=qs['filters'](_[_0x9228('0x37')](_0x30904b[_0x9228('0x2a')],_0x2e8fa7[_0x9228('0x2b')]),_0x3ae07d);if(_0x30904b['query'][_0x9228('0x38')]){_0x4135f1['where']=_[_0x9228('0x39')](_0x4135f1[_0x9228('0x36')],{'$or':_['map'](_0x3ae07d,function(_0x52c792){if(_0x52c792[_0x9228('0x3a')]!==_0x9228('0x3b')){var _0x43a1ca={};_0x43a1ca[_0x52c792[_0x9228('0x24')]]={'$like':'%'+_0x30904b[_0x9228('0x2a')][_0x9228('0x38')]+'%'};return _0x43a1ca;}})});}_0x4135f1=_[_0x9228('0x39')]({},_0x4135f1,_0x30904b[_0x9228('0x3c')]);var _0x200955={'where':_0x4135f1[_0x9228('0x36')]};return db[_0x9228('0x3d')][_0x9228('0x3e')](_0x200955)[_0x9228('0x20')](function(_0x5d7137){_0x4614fd[_0x9228('0x3e')]=_0x5d7137;if(_0x30904b[_0x9228('0x2a')]['includeAll']){_0x4135f1[_0x9228('0x3f')]=[{'all':!![]}];}return db[_0x9228('0x3d')][_0x9228('0x40')](_0x4135f1);})['then'](function(_0x38ef0e){_0x4614fd[_0x9228('0x41')]=_0x38ef0e;return _0x4614fd;})[_0x9228('0x20')](respondWithFilteredResult(_0x1b1c8a,_0x4135f1))['catch'](handleError(_0x1b1c8a,null));};exports['show']=function(_0x205ed6,_0x19f4d4){var _0x3069b4={'raw':!![],'where':{'id':_0x205ed6['params']['id']}},_0x16bcea={};_0x16bcea[_0x9228('0x2d')]=_[_0x9228('0x42')](db[_0x9228('0x3d')]['rawAttributes']);_0x16bcea['query']=_[_0x9228('0x42')](_0x205ed6['query']);_0x16bcea[_0x9228('0x2b')]=_[_0x9228('0x2c')](_0x16bcea[_0x9228('0x2d')],_0x16bcea[_0x9228('0x2a')]);_0x3069b4[_0x9228('0x2e')]=_[_0x9228('0x2c')](_0x16bcea[_0x9228('0x2d')],qs[_0x9228('0x2f')](_0x205ed6['query'][_0x9228('0x2f')]));_0x3069b4[_0x9228('0x2e')]=_0x3069b4[_0x9228('0x2e')][_0x9228('0x30')]?_0x3069b4[_0x9228('0x2e')]:_0x16bcea[_0x9228('0x2d')];if(_0x205ed6['query'][_0x9228('0x43')]){_0x3069b4[_0x9228('0x3f')]=[{'all':!![]}];}_0x3069b4=_[_0x9228('0x39')]({},_0x3069b4,_0x205ed6[_0x9228('0x3c')]);return db[_0x9228('0x3d')][_0x9228('0x44')](_0x3069b4)[_0x9228('0x20')](handleEntityNotFound(_0x19f4d4,null))[_0x9228('0x20')](respondWithResult(_0x19f4d4,null))['catch'](handleError(_0x19f4d4,null));};exports[_0x9228('0x45')]=function(_0x35251d,_0x7647f9){return db[_0x9228('0x3d')][_0x9228('0x45')](_0x35251d[_0x9228('0x46')],{})[_0x9228('0x20')](respondWithResult(_0x7647f9,0xc9))[_0x9228('0x47')](handleError(_0x7647f9,null));};exports['update']=function(_0x4044cb,_0xab77b){if(_0x4044cb[_0x9228('0x46')]['id']){delete _0x4044cb[_0x9228('0x46')]['id'];}return db[_0x9228('0x3d')][_0x9228('0x44')]({'where':{'id':_0x4044cb[_0x9228('0x48')]['id']}})['then'](handleEntityNotFound(_0xab77b,null))[_0x9228('0x20')](saveUpdates(_0x4044cb[_0x9228('0x46')],null))[_0x9228('0x20')](respondWithResult(_0xab77b,null))[_0x9228('0x47')](handleError(_0xab77b,null));};exports[_0x9228('0x21')]=function(_0x584205,_0x277603){return db[_0x9228('0x3d')][_0x9228('0x44')]({'where':{'id':_0x584205['params']['id']}})[_0x9228('0x20')](handleEntityNotFound(_0x277603,null))[_0x9228('0x20')](removeEntity(_0x277603,null))['catch'](handleError(_0x277603,null));};exports['download']=function(_0x4f8564,_0x1cac61,_0x596a0c){return db[_0x9228('0x3d')]['find']({'where':{'id':_0x4f8564['params']['id']},'attributes':['id',_0x9228('0x49'),_0x9228('0x4a')]})['then'](handleEntityNotFound(_0x1cac61,null))[_0x9228('0x20')](function(_0x98bc6c){if(_0x98bc6c){if(!_0x98bc6c[_0x9228('0x49')]){throw new db['Sequelize'][(_0x9228('0x4b'))](_0x9228('0x4c'));}var _0x1bc632={'Content-Type':_0x9228('0x4d'),'Content-Disposition':_0x9228('0x4e')};if(_0x98bc6c[_0x9228('0x4a')]){_0x1bc632[_0x9228('0x4f')]=_0x9228('0x50')+_0x98bc6c[_0x9228('0x4a')]+_0x9228('0x51');}_0x1cac61[_0x9228('0x52')](_0x1bc632);return _0x1cac61[_0x9228('0x25')](new Buffer(_0x98bc6c[_0x9228('0x49')]));}})[_0x9228('0x47')](handleError(_0x1cac61,null));}; \ No newline at end of file +var _0x34d4=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','intersection','find','create','catch','body','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x4cf8ff,_0x37e13d){var _0x4a19cf=function(_0x49b2fc){while(--_0x49b2fc){_0x4cf8ff['push'](_0x4cf8ff['shift']());}};_0x4a19cf(++_0x37e13d);}(_0x34d4,0x1e7));var _0x434d=function(_0x248685,_0x380e40){_0x248685=_0x248685-0x0;var _0xa5d9cf=_0x34d4[_0x248685];return _0xa5d9cf;};'use strict';var pdf=require(_0x434d('0x0'));var emlformat=require(_0x434d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x434d('0x2'));var jsonpatch=require(_0x434d('0x3'));var rp=require(_0x434d('0x4'));var moment=require(_0x434d('0x5'));var BPromise=require(_0x434d('0x6'));var Mustache=require(_0x434d('0x7'));var util=require(_0x434d('0x8'));var path=require(_0x434d('0x9'));var sox=require(_0x434d('0xa'));var csv=require(_0x434d('0xb'));var ejs=require(_0x434d('0xc'));var fs=require('fs');var _=require(_0x434d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x434d('0xe'));var deskjs=require(_0x434d('0xf'));var toCsv=require(_0x434d('0xb'));var querystring=require('querystring');var Papa=require(_0x434d('0x10'));var Redis=require(_0x434d('0x11'));var authService=require(_0x434d('0x12'));var qs=require(_0x434d('0x13'));var as=require(_0x434d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x434d('0x15'))('api');var utils=require(_0x434d('0x16'));var config=require(_0x434d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x434d('0x18'))['db'];function respondWithStatusCode(_0x650e96,_0x565316){_0x565316=_0x565316||0xcc;return function(_0x256f45){if(_0x256f45){return _0x650e96[_0x434d('0x19')](_0x565316);}return _0x650e96['status'](_0x565316)['end']();};}function respondWithResult(_0x363042,_0x175b8e){_0x175b8e=_0x175b8e||0xc8;return function(_0x1ae8ff){if(_0x1ae8ff){return _0x363042[_0x434d('0x1a')](_0x175b8e)[_0x434d('0x1b')](_0x1ae8ff);}};}function respondWithFilteredResult(_0x189f6a,_0x1b3ad1){return function(_0x3da83b){if(_0x3da83b){var _0x1096f3=_0x3da83b[_0x434d('0x1c')],_0x36344b=_0x1b3ad1['offset'],_0x3d4a6a=_0x1b3ad1[_0x434d('0x1d')]+_0x1b3ad1[_0x434d('0x1e')],_0x59e96c;if(_0x3d4a6a>=_0x1096f3){_0x3d4a6a=_0x1096f3;_0x59e96c=0xc8;}else{_0x59e96c=0xce;}_0x189f6a[_0x434d('0x1a')](_0x59e96c);return _0x189f6a['set'](_0x434d('0x1f'),_0x36344b+'-'+_0x3d4a6a+'/'+_0x1096f3)[_0x434d('0x1b')](_0x3da83b);}return null;};}function patchUpdates(_0x3a2ae1){return function(_0x1bcfb0){try{jsonpatch[_0x434d('0x20')](_0x1bcfb0,_0x3a2ae1,!![]);}catch(_0x4b7f4b){return BPromise['reject'](_0x4b7f4b);}return _0x1bcfb0[_0x434d('0x21')]();};}function saveUpdates(_0x10e736,_0x18cfb4){return function(_0x3e3000){if(_0x3e3000){return _0x3e3000[_0x434d('0x22')](_0x10e736)[_0x434d('0x23')](function(_0x3b84a7){return _0x3b84a7;});}return null;};}function removeEntity(_0x4a3d35,_0x80e422){return function(_0x260e93){if(_0x260e93){return _0x260e93[_0x434d('0x24')]()[_0x434d('0x23')](function(){_0x4a3d35[_0x434d('0x1a')](0xcc)[_0x434d('0x25')]();});}};}function handleEntityNotFound(_0x5da22e,_0x23b000){return function(_0x32bf3c){if(!_0x32bf3c){_0x5da22e[_0x434d('0x19')](0x194);}return _0x32bf3c;};}function handleError(_0x4299dd,_0x458686){_0x458686=_0x458686||0x1f4;return function(_0x3f173b){logger[_0x434d('0x26')](_0x3f173b[_0x434d('0x27')]);if(_0x3f173b[_0x434d('0x28')]){delete _0x3f173b['name'];}_0x4299dd[_0x434d('0x1a')](_0x458686)[_0x434d('0x29')](_0x3f173b);};}exports['index']=function(_0x351813,_0x383dee){var _0x451d40={},_0x2b2f86={},_0x5b096e={'count':0x0,'rows':[]};var _0x5e9f9b=_[_0x434d('0x2a')](db[_0x434d('0x2b')][_0x434d('0x2c')],function(_0x31c950){return{'name':_0x31c950[_0x434d('0x2d')],'type':_0x31c950['type'][_0x434d('0x2e')]};});_0x2b2f86[_0x434d('0x2f')]=_['differenceBy'](_[_0x434d('0x2a')](_0x5e9f9b,_0x434d('0x28')),[_0x434d('0x28')]);_0x2b2f86[_0x434d('0x30')]=_['keys'](_0x351813[_0x434d('0x30')]);_0x2b2f86[_0x434d('0x31')]=_['intersection'](_0x2b2f86[_0x434d('0x2f')],_0x2b2f86[_0x434d('0x30')]);_0x451d40[_0x434d('0x32')]=_['intersection'](_0x2b2f86[_0x434d('0x2f')],qs[_0x434d('0x33')](_0x351813[_0x434d('0x30')]['fields']));_0x451d40[_0x434d('0x32')]=_0x451d40[_0x434d('0x32')][_0x434d('0x34')]?_0x451d40[_0x434d('0x32')]:_0x2b2f86[_0x434d('0x2f')];if(!_0x351813[_0x434d('0x30')]['hasOwnProperty']('nolimit')){_0x451d40[_0x434d('0x1e')]=qs[_0x434d('0x1e')](_0x351813[_0x434d('0x30')][_0x434d('0x1e')]);_0x451d40['offset']=qs[_0x434d('0x1d')](_0x351813['query']['offset']);}_0x451d40[_0x434d('0x35')]=qs[_0x434d('0x36')](_0x351813[_0x434d('0x30')][_0x434d('0x36')]);_0x451d40['where']=qs['filters'](_[_0x434d('0x37')](_0x351813[_0x434d('0x30')],_0x2b2f86[_0x434d('0x31')]),_0x5e9f9b);if(_0x351813['query']['filter']){_0x451d40[_0x434d('0x38')]=_[_0x434d('0x39')](_0x451d40[_0x434d('0x38')],{'$or':_[_0x434d('0x2a')](_0x5e9f9b,function(_0x188e8f){if(_0x188e8f[_0x434d('0x3a')]!==_0x434d('0x3b')){var _0x16b4bf={};_0x16b4bf[_0x188e8f[_0x434d('0x28')]]={'$like':'%'+_0x351813[_0x434d('0x30')]['filter']+'%'};return _0x16b4bf;}})});}_0x451d40=_[_0x434d('0x39')]({},_0x451d40,_0x351813[_0x434d('0x3c')]);var _0x2786a2={'where':_0x451d40['where']};return db[_0x434d('0x2b')][_0x434d('0x1c')](_0x2786a2)[_0x434d('0x23')](function(_0x459689){_0x5b096e[_0x434d('0x1c')]=_0x459689;if(_0x351813['query'][_0x434d('0x3d')]){_0x451d40[_0x434d('0x3e')]=[{'all':!![]}];}return db[_0x434d('0x2b')][_0x434d('0x3f')](_0x451d40);})[_0x434d('0x23')](function(_0x429eea){_0x5b096e['rows']=_0x429eea;return _0x5b096e;})[_0x434d('0x23')](respondWithFilteredResult(_0x383dee,_0x451d40))['catch'](handleError(_0x383dee,null));};exports[_0x434d('0x40')]=function(_0x4140a9,_0x5dee14){var _0x40ec13={'raw':!![],'where':{'id':_0x4140a9[_0x434d('0x41')]['id']}},_0x1e623c={};_0x1e623c[_0x434d('0x2f')]=_[_0x434d('0x42')](db[_0x434d('0x2b')]['rawAttributes']);_0x1e623c[_0x434d('0x30')]=_[_0x434d('0x42')](_0x4140a9[_0x434d('0x30')]);_0x1e623c['filters']=_[_0x434d('0x43')](_0x1e623c[_0x434d('0x2f')],_0x1e623c[_0x434d('0x30')]);_0x40ec13['attributes']=_[_0x434d('0x43')](_0x1e623c[_0x434d('0x2f')],qs[_0x434d('0x33')](_0x4140a9['query'][_0x434d('0x33')]));_0x40ec13['attributes']=_0x40ec13[_0x434d('0x32')][_0x434d('0x34')]?_0x40ec13[_0x434d('0x32')]:_0x1e623c[_0x434d('0x2f')];if(_0x4140a9[_0x434d('0x30')][_0x434d('0x3d')]){_0x40ec13['include']=[{'all':!![]}];}_0x40ec13=_['merge']({},_0x40ec13,_0x4140a9[_0x434d('0x3c')]);return db['VoiceMailMessage'][_0x434d('0x44')](_0x40ec13)[_0x434d('0x23')](handleEntityNotFound(_0x5dee14,null))['then'](respondWithResult(_0x5dee14,null))['catch'](handleError(_0x5dee14,null));};exports[_0x434d('0x45')]=function(_0x5863b7,_0x11999d){return db[_0x434d('0x2b')][_0x434d('0x45')](_0x5863b7['body'],{})['then'](respondWithResult(_0x11999d,0xc9))[_0x434d('0x46')](handleError(_0x11999d,null));};exports[_0x434d('0x22')]=function(_0x3c097d,_0x271841){if(_0x3c097d[_0x434d('0x47')]['id']){delete _0x3c097d[_0x434d('0x47')]['id'];}return db[_0x434d('0x2b')][_0x434d('0x44')]({'where':{'id':_0x3c097d['params']['id']}})[_0x434d('0x23')](handleEntityNotFound(_0x271841,null))[_0x434d('0x23')](saveUpdates(_0x3c097d[_0x434d('0x47')],null))[_0x434d('0x23')](respondWithResult(_0x271841,null))[_0x434d('0x46')](handleError(_0x271841,null));};exports['destroy']=function(_0x19babe,_0x5c80e0){return db[_0x434d('0x2b')][_0x434d('0x44')]({'where':{'id':_0x19babe[_0x434d('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c80e0,null))[_0x434d('0x23')](removeEntity(_0x5c80e0,null))[_0x434d('0x46')](handleError(_0x5c80e0,null));};exports['download']=function(_0xbc50ea,_0x54ad12,_0x50943d){return db[_0x434d('0x2b')][_0x434d('0x44')]({'where':{'id':_0xbc50ea['params']['id']},'attributes':['id',_0x434d('0x48'),_0x434d('0x49')]})['then'](handleEntityNotFound(_0x54ad12,null))['then'](function(_0x15c689){if(_0x15c689){if(!_0x15c689[_0x434d('0x48')]){throw new db[(_0x434d('0x4a'))]['ValidationError'](_0x434d('0x4b'));}var _0x417176={'Content-Type':_0x434d('0x4c'),'Content-Disposition':_0x434d('0x4d')};if(_0x15c689[_0x434d('0x49')]){_0x417176[_0x434d('0x4e')]=_0x434d('0x4f')+_0x15c689[_0x434d('0x49')]+_0x434d('0x50');}_0x54ad12[_0x434d('0x51')](_0x417176);return _0x54ad12[_0x434d('0x29')](new Buffer(_0x15c689[_0x434d('0x48')]));}})[_0x434d('0x46')](handleError(_0x54ad12,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index d1beafd..dbe9940 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.model.js +++ b/server/api/voiceMailMessage/voiceMailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0884=['lodash','util','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir'];(function(_0xc34cd4,_0x463064){var _0x128eaa=function(_0x221318){while(--_0x221318){_0xc34cd4['push'](_0xc34cd4['shift']());}};_0x128eaa(++_0x463064);}(_0x0884,0x108));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4088('0x0'));var util=require(_0x4088('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4088('0x2'));var BPromise=require(_0x4088('0x3'));var rp=require(_0x4088('0x4'));var fs=require('fs');var path=require(_0x4088('0x5'));var rimraf=require(_0x4088('0x6'));var config=require('../../config/environment');var attributes=require(_0x4088('0x7'));module[_0x4088('0x8')]=function(_0x4bfe80,_0x166cfe){return _0x4bfe80['define']('VoiceMailMessage',attributes,{'tableName':_0x4088('0x9'),'paranoid':![],'indexes':[{'name':_0x4088('0xa'),'fields':[_0x4088('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3d91=['path','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x3d91,0xf7));var _0x13d9=function(_0x52cbe2,_0x5afefb){_0x52cbe2=_0x52cbe2-0x0;var _0x277141=_0x3d91[_0x52cbe2];return _0x277141;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13d9('0x0'))(_0x13d9('0x1'));var moment=require(_0x13d9('0x2'));var BPromise=require(_0x13d9('0x3'));var rp=require(_0x13d9('0x4'));var fs=require('fs');var path=require(_0x13d9('0x5'));var rimraf=require(_0x13d9('0x6'));var config=require('../../config/environment');var attributes=require(_0x13d9('0x7'));module[_0x13d9('0x8')]=function(_0x22c3b7,_0x399bf5){return _0x22c3b7[_0x13d9('0x9')](_0x13d9('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x13d9('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 459394a..d6af331 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x50b9b1,_0x41ba1d){var _0x182711=function(_0x3d6ffd){while(--_0x3d6ffd){_0x50b9b1['push'](_0x50b9b1['shift']());}};_0x182711(++_0x41ba1d);}(_0x14a0,0x8e));var _0x014a=function(_0x285a06,_0x344860){_0x285a06=_0x285a06-0x0;var _0x18191c=_0x14a0[_0x285a06];return _0x18191c;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x454c4d,_0x210aa7){var _0x3abbf2=function(_0x2b1309){while(--_0x2b1309){_0x454c4d['push'](_0x454c4d['shift']());}};_0x3abbf2(++_0x210aa7);}(_0x57ca,0x108));var _0xa57c=function(_0x1ccbaf,_0x37204c){_0x1ccbaf=_0x1ccbaf-0x0;var _0x40b67b=_0x57ca[_0x1ccbaf];return _0x40b67b;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5f67b69..0f719e4 100644 --- a/server/api/voiceMusicOnHold/index.js +++ b/server/api/voiceMusicOnHold/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf35=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','multer','util','path','connect-timeout'];(function(_0x1d0a26,_0x38eb82){var _0x20eede=function(_0xfe957b){while(--_0xfe957b){_0x1d0a26['push'](_0x1d0a26['shift']());}};_0x20eede(++_0x38eb82);}(_0xdf35,0xd8));var _0x5df3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xdf35[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x5df3('0x0'));var util=require(_0x5df3('0x1'));var path=require(_0x5df3('0x2'));var timeout=require(_0x5df3('0x3'));var express=require(_0x5df3('0x4'));var router=express['Router']();var auth=require(_0x5df3('0x5'));var interaction=require(_0x5df3('0x6'));var config=require(_0x5df3('0x7'));var controller=require(_0x5df3('0x8'));router[_0x5df3('0x9')]('/',auth[_0x5df3('0xa')](),controller[_0x5df3('0xb')]);router[_0x5df3('0x9')](_0x5df3('0xc'),auth[_0x5df3('0xa')](),controller[_0x5df3('0xd')]);router[_0x5df3('0x9')](_0x5df3('0xe'),auth['isAuthenticated'](),controller['getSounds']);router[_0x5df3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5df3('0xf')](_0x5df3('0xe'),auth['isAuthenticated'](),controller[_0x5df3('0x10')]);router[_0x5df3('0x11')](_0x5df3('0xc'),auth[_0x5df3('0xa')](),controller[_0x5df3('0x12')]);router[_0x5df3('0x13')](_0x5df3('0xc'),auth[_0x5df3('0xa')](),controller[_0x5df3('0x14')]);router['delete'](_0x5df3('0x15'),auth[_0x5df3('0xa')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0xe0f2=['create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','express','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post'];(function(_0x2c6096,_0x35137a){var _0x157b92=function(_0xa5bd8d){while(--_0xa5bd8d){_0x2c6096['push'](_0x2c6096['shift']());}};_0x157b92(++_0x35137a);}(_0xe0f2,0x67));var _0x2e0f=function(_0x5f6485,_0x3325a5){_0x5f6485=_0x5f6485-0x0;var _0x5ac362=_0xe0f2[_0x5f6485];return _0x5ac362;};'use strict';var multer=require(_0x2e0f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2e0f('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2e0f('0x2'));var config=require(_0x2e0f('0x3'));var controller=require(_0x2e0f('0x4'));router[_0x2e0f('0x5')]('/',auth[_0x2e0f('0x6')](),controller[_0x2e0f('0x7')]);router[_0x2e0f('0x5')](_0x2e0f('0x8'),auth[_0x2e0f('0x6')](),controller['show']);router['get'](_0x2e0f('0x9'),auth['isAuthenticated'](),controller['getSounds']);router[_0x2e0f('0xa')]('/',auth[_0x2e0f('0x6')](),controller[_0x2e0f('0xb')]);router['post'](_0x2e0f('0x9'),auth['isAuthenticated'](),controller[_0x2e0f('0xc')]);router[_0x2e0f('0xd')](_0x2e0f('0x8'),auth[_0x2e0f('0x6')](),controller[_0x2e0f('0xe')]);router[_0x2e0f('0xf')](_0x2e0f('0x8'),auth['isAuthenticated'](),controller[_0x2e0f('0x10')]);router[_0x2e0f('0xf')](_0x2e0f('0x11'),auth[_0x2e0f('0x6')](),controller[_0x2e0f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 73c3eb6..c4a4b5c 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x201e=['name','ENUM','custom','quietmp3nb','files','TIMESTAMP','BOOLEAN','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x201e,0x181));var _0xe201=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x201e[_0x3430aa];return _0x2ac5c;};'use strict';var Sequelize=require(_0xe201('0x0'));module['exports']={'name':{'type':Sequelize[_0xe201('0x1')],'allowNull':![],'unique':_0xe201('0x2')},'mode':{'type':Sequelize[_0xe201('0x3')](_0xe201('0x4'),'files','mp3nb',_0xe201('0x5'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0xe201('0x6')},'directory':{'type':Sequelize[_0xe201('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xe201('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe201('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe201('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xe201('0x1')],'allowNull':!![]},'stamp':{'type':_0xe201('0x7')},'defaultEntry':{'type':Sequelize[_0xe201('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7e51=['sequelize','exports','STRING','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN'];(function(_0x11004c,_0x5bb659){var _0x5016d4=function(_0x37015e){while(--_0x37015e){_0x11004c['push'](_0x11004c['shift']());}};_0x5016d4(++_0x5bb659);}(_0x7e51,0xf2));var _0x17e5=function(_0x2e8265,_0x7e9f21){_0x2e8265=_0x2e8265-0x0;var _0x1527f5=_0x7e51[_0x2e8265];return _0x1527f5;};'use strict';var Sequelize=require(_0x17e5('0x0'));module[_0x17e5('0x1')]={'name':{'type':Sequelize[_0x17e5('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x17e5('0x3'),_0x17e5('0x4'),_0x17e5('0x5'),_0x17e5('0x6'),_0x17e5('0x7'),_0x17e5('0x8')),'allowNull':!![],'defaultValue':_0x17e5('0x4')},'directory':{'type':Sequelize[_0x17e5('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x17e5('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x17e5('0x2')],'allowNull':!![],'defaultValue':_0x17e5('0x9')},'format':{'type':Sequelize[_0x17e5('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x17e5('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index dea4bf6..24182ff 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa2b=['type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','count','includeAll','include','rows','catch','show','params','rawAttributes','options','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','Sequelize','ValidationError','message','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','findOne','removeSound','id2','getSounds','Sound','rimraf','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','name','send','index','map','VoiceMusicOnHold'];(function(_0xcab9e5,_0x2b8ecf){var _0x3602b9=function(_0xa04418){while(--_0xa04418){_0xcab9e5['push'](_0xcab9e5['shift']());}};_0x3602b9(++_0x2b8ecf);}(_0xaa2b,0xa7));var _0xbaa2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaa2b[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbaa2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbaa2('0x1'));var util=require(_0xbaa2('0x2'));var path=require(_0xbaa2('0x3'));var sox=require(_0xbaa2('0x4'));var csv=require(_0xbaa2('0x5'));var ejs=require(_0xbaa2('0x6'));var fs=require('fs');var _=require(_0xbaa2('0x7'));var squel=require(_0xbaa2('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbaa2('0x9'));var toCsv=require(_0xbaa2('0x5'));var querystring=require(_0xbaa2('0xa'));var Papa=require(_0xbaa2('0xb'));var Redis=require(_0xbaa2('0xc'));var authService=require(_0xbaa2('0xd'));var qs=require(_0xbaa2('0xe'));var as=require(_0xbaa2('0xf'));var hardwareService=require(_0xbaa2('0x10'));var logger=require(_0xbaa2('0x11'))(_0xbaa2('0x12'));var utils=require(_0xbaa2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbaa2('0x14'));var db=require(_0xbaa2('0x15'))['db'];function respondWithStatusCode(_0xfa4f42,_0x3b1b19){_0x3b1b19=_0x3b1b19||0xcc;return function(_0x54749b){if(_0x54749b){return _0xfa4f42['sendStatus'](_0x3b1b19);}return _0xfa4f42[_0xbaa2('0x16')](_0x3b1b19)[_0xbaa2('0x17')]();};}function respondWithResult(_0x26cab4,_0x595ffd){_0x595ffd=_0x595ffd||0xc8;return function(_0x157f46){if(_0x157f46){return _0x26cab4[_0xbaa2('0x16')](_0x595ffd)['json'](_0x157f46);}};}function respondWithFilteredResult(_0x5381f8,_0x4569b6){return function(_0x3cc630){if(_0x3cc630){var _0x49381a=_0x3cc630['count'],_0x5ef15d=_0x4569b6[_0xbaa2('0x18')],_0x4c15fe=_0x4569b6[_0xbaa2('0x18')]+_0x4569b6[_0xbaa2('0x19')],_0x3434c4;if(_0x4c15fe>=_0x49381a){_0x4c15fe=_0x49381a;_0x3434c4=0xc8;}else{_0x3434c4=0xce;}_0x5381f8[_0xbaa2('0x16')](_0x3434c4);return _0x5381f8[_0xbaa2('0x1a')](_0xbaa2('0x1b'),_0x5ef15d+'-'+_0x4c15fe+'/'+_0x49381a)[_0xbaa2('0x1c')](_0x3cc630);}return null;};}function patchUpdates(_0x3bf7ea){return function(_0x349d17){try{jsonpatch[_0xbaa2('0x1d')](_0x349d17,_0x3bf7ea,!![]);}catch(_0x103e8e){return BPromise[_0xbaa2('0x1e')](_0x103e8e);}return _0x349d17[_0xbaa2('0x1f')]();};}function saveUpdates(_0x140fcf,_0x1a7e6b){return function(_0x198062){if(_0x198062){return _0x198062[_0xbaa2('0x20')](_0x140fcf)[_0xbaa2('0x21')](function(_0xa9eac4){return _0xa9eac4;});}return null;};}function removeEntity(_0x3819d7,_0x479235){return function(_0x2d08bb){if(_0x2d08bb){return _0x2d08bb[_0xbaa2('0x22')]()[_0xbaa2('0x21')](function(){var _0x323d9b=_0x2d08bb['get']({'plain':!![]});var _0x42a73a=_0xbaa2('0x23');return db[_0xbaa2('0x24')][_0xbaa2('0x22')]({'where':{'type':_0x42a73a,'resourceId':_0x323d9b['id']}})[_0xbaa2('0x21')](function(){return _0x2d08bb;});})[_0xbaa2('0x21')](function(){_0x3819d7[_0xbaa2('0x16')](0xcc)[_0xbaa2('0x17')]();});}};}function handleEntityNotFound(_0x576485,_0x42ba2a){return function(_0x4d3bec){if(!_0x4d3bec){_0x576485['sendStatus'](0x194);}return _0x4d3bec;};}function handleError(_0x58934d,_0x5b3e44){_0x5b3e44=_0x5b3e44||0x1f4;return function(_0xc31138){logger[_0xbaa2('0x25')](_0xc31138['stack']);if(_0xc31138[_0xbaa2('0x26')]){delete _0xc31138[_0xbaa2('0x26')];}_0x58934d[_0xbaa2('0x16')](_0x5b3e44)[_0xbaa2('0x27')](_0xc31138);};}exports[_0xbaa2('0x28')]=function(_0x14bfde,_0xa8e44b){var _0x3157fa={},_0x1c9f4d={},_0x3015e4={'count':0x0,'rows':[]};var _0x40d0af=_[_0xbaa2('0x29')](db[_0xbaa2('0x2a')]['rawAttributes'],function(_0x2c6711){return{'name':_0x2c6711['fieldName'],'type':_0x2c6711[_0xbaa2('0x2b')][_0xbaa2('0x2c')]};});_0x1c9f4d[_0xbaa2('0x2d')]=_['map'](_0x40d0af,_0xbaa2('0x26'));_0x1c9f4d['query']=_[_0xbaa2('0x2e')](_0x14bfde[_0xbaa2('0x2f')]);_0x1c9f4d[_0xbaa2('0x30')]=_[_0xbaa2('0x31')](_0x1c9f4d[_0xbaa2('0x2d')],_0x1c9f4d[_0xbaa2('0x2f')]);_0x3157fa[_0xbaa2('0x32')]=_['intersection'](_0x1c9f4d[_0xbaa2('0x2d')],qs[_0xbaa2('0x33')](_0x14bfde[_0xbaa2('0x2f')][_0xbaa2('0x33')]));_0x3157fa[_0xbaa2('0x32')]=_0x3157fa[_0xbaa2('0x32')][_0xbaa2('0x34')]?_0x3157fa[_0xbaa2('0x32')]:_0x1c9f4d['model'];if(!_0x14bfde[_0xbaa2('0x2f')][_0xbaa2('0x35')](_0xbaa2('0x36'))){_0x3157fa[_0xbaa2('0x19')]=qs[_0xbaa2('0x19')](_0x14bfde[_0xbaa2('0x2f')][_0xbaa2('0x19')]);_0x3157fa[_0xbaa2('0x18')]=qs[_0xbaa2('0x18')](_0x14bfde[_0xbaa2('0x2f')][_0xbaa2('0x18')]);}_0x3157fa[_0xbaa2('0x37')]=qs[_0xbaa2('0x38')](_0x14bfde[_0xbaa2('0x2f')]['sort']);_0x3157fa['where']=qs[_0xbaa2('0x30')](_['pick'](_0x14bfde[_0xbaa2('0x2f')],_0x1c9f4d[_0xbaa2('0x30')]),_0x40d0af);if(_0x14bfde['query'][_0xbaa2('0x39')]){_0x3157fa[_0xbaa2('0x3a')]=_[_0xbaa2('0x3b')](_0x3157fa[_0xbaa2('0x3a')],{'$or':_[_0xbaa2('0x29')](_0x40d0af,function(_0x133df4){if(_0x133df4[_0xbaa2('0x2b')]!=='VIRTUAL'){var _0x33a6c0={};_0x33a6c0[_0x133df4[_0xbaa2('0x26')]]={'$like':'%'+_0x14bfde[_0xbaa2('0x2f')][_0xbaa2('0x39')]+'%'};return _0x33a6c0;}})});}_0x3157fa=_['merge']({},_0x3157fa,_0x14bfde['options']);var _0x33ed66={'where':_0x3157fa['where']};return db['VoiceMusicOnHold'][_0xbaa2('0x3c')](_0x33ed66)['then'](function(_0x35039c){_0x3015e4[_0xbaa2('0x3c')]=_0x35039c;if(_0x14bfde[_0xbaa2('0x2f')][_0xbaa2('0x3d')]){_0x3157fa[_0xbaa2('0x3e')]=[{'all':!![]}];}return db[_0xbaa2('0x2a')]['findAll'](_0x3157fa);})['then'](function(_0x5a72ec){_0x3015e4[_0xbaa2('0x3f')]=_0x5a72ec;return _0x3015e4;})[_0xbaa2('0x21')](respondWithFilteredResult(_0xa8e44b,_0x3157fa))[_0xbaa2('0x40')](handleError(_0xa8e44b,null));};exports[_0xbaa2('0x41')]=function(_0x5e14b0,_0x4b7041){var _0x1213fa={'raw':![],'where':{'id':_0x5e14b0[_0xbaa2('0x42')]['id']}},_0x44fd92={};_0x44fd92[_0xbaa2('0x2d')]=_[_0xbaa2('0x2e')](db[_0xbaa2('0x2a')][_0xbaa2('0x43')]);_0x44fd92[_0xbaa2('0x2f')]=_['keys'](_0x5e14b0['query']);_0x44fd92[_0xbaa2('0x30')]=_['intersection'](_0x44fd92[_0xbaa2('0x2d')],_0x44fd92[_0xbaa2('0x2f')]);_0x1213fa['attributes']=_[_0xbaa2('0x31')](_0x44fd92[_0xbaa2('0x2d')],qs[_0xbaa2('0x33')](_0x5e14b0['query'][_0xbaa2('0x33')]));_0x1213fa[_0xbaa2('0x32')]=_0x1213fa[_0xbaa2('0x32')]['length']?_0x1213fa['attributes']:_0x44fd92[_0xbaa2('0x2d')];if(_0x5e14b0[_0xbaa2('0x2f')][_0xbaa2('0x3d')]){_0x1213fa[_0xbaa2('0x3e')]=[{'all':!![]}];}_0x1213fa=_[_0xbaa2('0x3b')]({},_0x1213fa,_0x5e14b0[_0xbaa2('0x44')]);return db[_0xbaa2('0x2a')][_0xbaa2('0x45')](_0x1213fa)[_0xbaa2('0x21')](handleEntityNotFound(_0x4b7041,null))['then'](respondWithResult(_0x4b7041,null))[_0xbaa2('0x40')](handleError(_0x4b7041,null));};exports[_0xbaa2('0x20')]=function(_0x3f6922,_0x18fef8){if(_0x3f6922[_0xbaa2('0x46')]['id']){delete _0x3f6922[_0xbaa2('0x46')]['id'];}return db[_0xbaa2('0x2a')]['find']({'where':{'id':_0x3f6922[_0xbaa2('0x42')]['id']}})[_0xbaa2('0x21')](handleEntityNotFound(_0x18fef8,null))[_0xbaa2('0x21')](saveUpdates(_0x3f6922[_0xbaa2('0x46')],null))[_0xbaa2('0x21')](respondWithResult(_0x18fef8,null))[_0xbaa2('0x40')](handleError(_0x18fef8,null));};exports[_0xbaa2('0x47')]=function(_0x516d98,_0x2d47a5,_0x4e4967){return db[_0xbaa2('0x48')][_0xbaa2('0x49')](function(_0x31b8ec){if(_0x516d98[_0xbaa2('0x46')][_0xbaa2('0x4a')]===_0xbaa2('0x4b')){_0x516d98[_0xbaa2('0x46')][_0xbaa2('0x4c')]=path[_0xbaa2('0x4d')](config[_0xbaa2('0x4e')],_0xbaa2('0x4f'),_0x516d98[_0xbaa2('0x46')]['name']);}return db['VoiceMusicOnHold'][_0xbaa2('0x47')](_0x516d98['body'],{'transaction':_0x31b8ec})[_0xbaa2('0x21')](function(_0x35605a){if(_0x516d98[_0xbaa2('0x46')][_0xbaa2('0x4a')]===_0xbaa2('0x4b')){fs['mkdirSync'](_0x35605a[_0xbaa2('0x4c')],parseInt(_0xbaa2('0x50'),0x8));}var _0x5e7ed3=_0x516d98[_0xbaa2('0x51')][_0xbaa2('0x52')]({'plain':!![]});if(!_0x5e7ed3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e7ed3[_0xbaa2('0x53')]==='user'){var _0x1b5dd2=_0x35605a['get']({'plain':!![]});return db[_0xbaa2('0x54')][_0xbaa2('0x45')]({'where':{'name':_0xbaa2('0x23'),'userProfileId':_0x5e7ed3[_0xbaa2('0x55')]},'raw':!![]})['then'](function(_0x24ff45){if(_0x24ff45&&_0x24ff45[_0xbaa2('0x56')]===0x0){return db[_0xbaa2('0x24')][_0xbaa2('0x47')]({'name':_0x1b5dd2[_0xbaa2('0x26')],'resourceId':_0x1b5dd2['id'],'type':_0x24ff45['name'],'sectionId':_0x24ff45['id']},{})[_0xbaa2('0x21')](function(){return _0x35605a;});}else{return _0x35605a;}})[_0xbaa2('0x40')](function(_0xf1605c){logger[_0xbaa2('0x25')](_0xbaa2('0x57'),_0xf1605c);});}return _0x35605a;});})[_0xbaa2('0x21')](respondWithResult(_0x2d47a5,0xc9))[_0xbaa2('0x40')](handleError(_0x2d47a5,null));};exports[_0xbaa2('0x22')]=function(_0x32a8b5,_0x73e6b9,_0x591269){var _0x4ff9f4;return db[_0xbaa2('0x2a')][_0xbaa2('0x45')]({'where':{'id':_0x32a8b5[_0xbaa2('0x42')]['id']}})[_0xbaa2('0x21')](function(_0x1b7f23){if(_0x1b7f23){return db['sequelize'][_0xbaa2('0x49')](function(_0x5c20d7){return _0x1b7f23[_0xbaa2('0x22')]({'transaction':_0x5c20d7,'raw':!![]})[_0xbaa2('0x21')](function(_0x5c429e){if(_0x5c429e[_0xbaa2('0x4c')]){fs[_0xbaa2('0x58')](_0x5c429e[_0xbaa2('0x4c')])[_0xbaa2('0x59')](function(_0x3ae04d){fs['unlinkSync'](path['join'](_0x5c429e[_0xbaa2('0x4c')],_0x3ae04d));});fs['rmdirSync'](_0x5c429e[_0xbaa2('0x4c')]);}return _0x5c429e;});})[_0xbaa2('0x40')](function(_0x50ed18){throw new db[(_0xbaa2('0x5a'))][(_0xbaa2('0x5b'))](_0x50ed18[_0xbaa2('0x5c')]);});}})['then'](handleEntityNotFound(_0x73e6b9,null))['then'](removeEntity(_0x73e6b9,null))['catch'](handleError(_0x73e6b9,null));};exports['addSound']=function(_0x1f2c97,_0x2f3446,_0x58213c){return db[_0xbaa2('0x48')][_0xbaa2('0x49')](function(_0x22d448){var _0x14c796;return db[_0xbaa2('0x2a')][_0xbaa2('0x45')]({'where':{'id':_0x1f2c97[_0xbaa2('0x42')]['id']}})[_0xbaa2('0x21')](function(_0x45e4c3){if(_0x45e4c3){_0x14c796=_0x45e4c3;return _0x45e4c3['addSound'](_0x1f2c97[_0xbaa2('0x46')]['id'],{'transaction':_0x22d448});}})[_0xbaa2('0x21')](function(_0xa61a79){if(_0xa61a79){return db['Sound']['findOne']({'where':{'id':_0x1f2c97[_0xbaa2('0x46')]['id']},'attributes':['id',_0xbaa2('0x26'),'save_name',_0xbaa2('0x5d'),_0xbaa2('0x5e')],'raw':!![]});}})['then'](function(_0x2b2ce6){if(_0x2b2ce6){var _0x20da8c=path[_0xbaa2('0x4d')](config['root'],_0xbaa2('0x5f'),util[_0xbaa2('0x60')](_0xbaa2('0x61'),path[_0xbaa2('0x62')](_0x2b2ce6['save_name'],path['extname'](_0x2b2ce6[_0xbaa2('0x63')])),_0x2b2ce6[_0xbaa2('0x5d')]));var _0x1fa9a3=path[_0xbaa2('0x4d')](config[_0xbaa2('0x4e')],'server/files/moh',_0x14c796[_0xbaa2('0x26')],util[_0xbaa2('0x60')]('%s.%s',_0x2b2ce6[_0xbaa2('0x26')],_0x2b2ce6[_0xbaa2('0x5d')]));fs['symlinkSync'](_0x20da8c,_0x1fa9a3);return _0x2b2ce6;}})[_0xbaa2('0x40')](function(_0x2448b3){throw new db[(_0xbaa2('0x5a'))]['ValidationError'](_0x2448b3['message']);});})[_0xbaa2('0x21')](handleEntityNotFound(_0x2f3446,null))[_0xbaa2('0x21')](respondWithResult(_0x2f3446,0xc9))[_0xbaa2('0x40')](handleError(_0x2f3446,null));};exports['removeSound']=function(_0x1b0a45,_0x375137,_0x1b9030){return db['sequelize'][_0xbaa2('0x49')](function(_0x15e6ed){var _0x47fae2;return db[_0xbaa2('0x2a')][_0xbaa2('0x64')]({'where':{'id':_0x1b0a45['params']['id']}})['then'](handleEntityNotFound(_0x375137,null))[_0xbaa2('0x21')](function(_0x5ecbd6){if(_0x5ecbd6){_0x47fae2=_0x5ecbd6;return _0x5ecbd6[_0xbaa2('0x65')](_0x1b0a45['params']['id2']);}})['then'](function(_0x4bd19d){if(_0x4bd19d){return db['Sound']['findOne']({'where':{'id':_0x1b0a45[_0xbaa2('0x42')][_0xbaa2('0x66')]},'attributes':['id','name',_0xbaa2('0x63'),_0xbaa2('0x5d'),_0xbaa2('0x5e')],'raw':!![]});}})[_0xbaa2('0x21')](function(_0x521e86){if(_0x521e86){fs['unlinkSync'](path[_0xbaa2('0x4d')](_0x47fae2['directory'],util['format']('%s.%s',_0x521e86[_0xbaa2('0x26')],_0x521e86[_0xbaa2('0x5d')])));return _0x521e86;}})[_0xbaa2('0x40')](function(_0x113c1a){throw new db[(_0xbaa2('0x5a'))][(_0xbaa2('0x5b'))](_0x113c1a['message']);});})['then'](handleEntityNotFound(_0x375137,null))[_0xbaa2('0x21')](respondWithStatusCode(_0x375137,0xcc))[_0xbaa2('0x40')](handleError(_0x375137,null));};exports[_0xbaa2('0x67')]=function(_0x3a62b3,_0x17ca98,_0x18d05a){var _0x3cc171={};var _0x3099b3={};var _0x57c6d0;var _0x5294cf;return db[_0xbaa2('0x2a')][_0xbaa2('0x64')]({'where':{'id':_0x3a62b3['params']['id']}})['then'](handleEntityNotFound(_0x17ca98,null))[_0xbaa2('0x21')](function(_0x9a9261){if(_0x9a9261){_0x57c6d0=_0x9a9261;_0x3099b3[_0xbaa2('0x2d')]=_['keys'](db[_0xbaa2('0x68')][_0xbaa2('0x43')]);_0x3099b3[_0xbaa2('0x2f')]=_[_0xbaa2('0x2e')](_0x3a62b3['query']);_0x3099b3[_0xbaa2('0x30')]=_['intersection'](_0x3099b3[_0xbaa2('0x2d')],_0x3099b3[_0xbaa2('0x2f')]);_0x3cc171[_0xbaa2('0x32')]=_[_0xbaa2('0x31')](_0x3099b3[_0xbaa2('0x2d')],qs[_0xbaa2('0x33')](_0x3a62b3[_0xbaa2('0x2f')][_0xbaa2('0x33')]));_0x3cc171[_0xbaa2('0x32')]=_0x3cc171['attributes'][_0xbaa2('0x34')]?_0x3cc171[_0xbaa2('0x32')]:_0x3099b3[_0xbaa2('0x2d')];_0x3cc171[_0xbaa2('0x37')]=qs[_0xbaa2('0x38')](_0x3a62b3[_0xbaa2('0x2f')][_0xbaa2('0x38')]);_0x3cc171[_0xbaa2('0x3a')]=qs[_0xbaa2('0x30')](_['pick'](_0x3a62b3[_0xbaa2('0x2f')],_0x3099b3[_0xbaa2('0x30')]));if(_0x3a62b3[_0xbaa2('0x2f')][_0xbaa2('0x39')]){_0x3cc171[_0xbaa2('0x3a')]=_['merge'](_0x3cc171[_0xbaa2('0x3a')],{'$or':_['map'](_0x3cc171[_0xbaa2('0x32')],function(_0x17011b){var _0x190473={};_0x190473[_0x17011b]={'$like':'%'+_0x3a62b3[_0xbaa2('0x2f')]['filter']+'%'};return _0x190473;})});}_0x3cc171=_['merge']({},_0x3cc171,_0x3a62b3[_0xbaa2('0x44')]);return _0x57c6d0[_0xbaa2('0x67')](_0x3cc171);}})[_0xbaa2('0x21')](function(_0x2498f2){if(_0x2498f2){_0x5294cf=_0x2498f2[_0xbaa2('0x34')];if(!_0x3a62b3[_0xbaa2('0x2f')][_0xbaa2('0x35')]('nolimit')){_0x3cc171['limit']=qs[_0xbaa2('0x19')](_0x3a62b3[_0xbaa2('0x2f')][_0xbaa2('0x19')]);_0x3cc171[_0xbaa2('0x18')]=qs['offset'](_0x3a62b3['query'][_0xbaa2('0x18')]);}return _0x57c6d0[_0xbaa2('0x67')](_0x3cc171);}})['then'](function(_0x1c64aa){if(_0x1c64aa){return _0x1c64aa?{'count':_0x5294cf,'rows':_0x1c64aa}:null;}})['then'](respondWithResult(_0x17ca98,null))[_0xbaa2('0x40')](handleError(_0x17ca98,null));}; \ No newline at end of file +var _0x10dd=['root','format','%s.%s','basename','extname','symlinkSync','removeSound','params','id2','Sound','getSounds','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','MusicOnHolds','then','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','keys','rawAttributes','include','body','find','create','sequelize','transaction','mode','files','directory','join','server/files/moh','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt'];(function(_0x124703,_0x17b603){var _0xa47749=function(_0x339c47){while(--_0x339c47){_0x124703['push'](_0x124703['shift']());}};_0xa47749(++_0x17b603);}(_0x10dd,0x7c));var _0xd10d=function(_0x5004ab,_0x2dbfaa){_0x5004ab=_0x5004ab-0x0;var _0x34ec4b=_0x10dd[_0x5004ab];return _0x34ec4b;};'use strict';var pdf=require(_0xd10d('0x0'));var emlformat=require(_0xd10d('0x1'));var rimraf=require(_0xd10d('0x2'));var zipdir=require(_0xd10d('0x3'));var jsonpatch=require(_0xd10d('0x4'));var rp=require('request-promise');var moment=require(_0xd10d('0x5'));var BPromise=require(_0xd10d('0x6'));var Mustache=require('mustache');var util=require(_0xd10d('0x7'));var path=require('path');var sox=require(_0xd10d('0x8'));var csv=require(_0xd10d('0x9'));var ejs=require(_0xd10d('0xa'));var fs=require('fs');var _=require(_0xd10d('0xb'));var squel=require(_0xd10d('0xc'));var crypto=require(_0xd10d('0xd'));var jsforce=require(_0xd10d('0xe'));var deskjs=require(_0xd10d('0xf'));var toCsv=require(_0xd10d('0x9'));var querystring=require(_0xd10d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd10d('0x11'));var qs=require(_0xd10d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd10d('0x13'));var logger=require(_0xd10d('0x14'))(_0xd10d('0x15'));var utils=require(_0xd10d('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3132b7,_0x1fd4c3){_0x1fd4c3=_0x1fd4c3||0xcc;return function(_0x45b877){if(_0x45b877){return _0x3132b7[_0xd10d('0x17')](_0x1fd4c3);}return _0x3132b7[_0xd10d('0x18')](_0x1fd4c3)[_0xd10d('0x19')]();};}function respondWithResult(_0x4c71aa,_0x5bf64e){_0x5bf64e=_0x5bf64e||0xc8;return function(_0x56eca4){if(_0x56eca4){return _0x4c71aa['status'](_0x5bf64e)[_0xd10d('0x1a')](_0x56eca4);}};}function respondWithFilteredResult(_0xb2c9d9,_0x357db6){return function(_0x39efc7){if(_0x39efc7){var _0xb091e2=_0x39efc7[_0xd10d('0x1b')],_0x3a1cfe=_0x357db6[_0xd10d('0x1c')],_0x55246a=_0x357db6['offset']+_0x357db6[_0xd10d('0x1d')],_0x3f5d4b;if(_0x55246a>=_0xb091e2){_0x55246a=_0xb091e2;_0x3f5d4b=0xc8;}else{_0x3f5d4b=0xce;}_0xb2c9d9['status'](_0x3f5d4b);return _0xb2c9d9[_0xd10d('0x1e')]('Content-Range',_0x3a1cfe+'-'+_0x55246a+'/'+_0xb091e2)[_0xd10d('0x1a')](_0x39efc7);}return null;};}function patchUpdates(_0x249609){return function(_0x39ac03){try{jsonpatch[_0xd10d('0x1f')](_0x39ac03,_0x249609,!![]);}catch(_0x401f6f){return BPromise[_0xd10d('0x20')](_0x401f6f);}return _0x39ac03[_0xd10d('0x21')]();};}function saveUpdates(_0x37b786,_0x449558){return function(_0x543755){if(_0x543755){return _0x543755[_0xd10d('0x22')](_0x37b786)['then'](function(_0x23d378){return _0x23d378;});}return null;};}function removeEntity(_0x4a4899,_0x3fa4d0){return function(_0x3f1dc6){if(_0x3f1dc6){return _0x3f1dc6[_0xd10d('0x23')]()['then'](function(){var _0x52b662=_0x3f1dc6['get']({'plain':!![]});var _0x2ca1c0=_0xd10d('0x24');return db['UserProfileResource'][_0xd10d('0x23')]({'where':{'type':_0x2ca1c0,'resourceId':_0x52b662['id']}})[_0xd10d('0x25')](function(){return _0x3f1dc6;});})[_0xd10d('0x25')](function(){_0x4a4899['status'](0xcc)[_0xd10d('0x19')]();});}};}function handleEntityNotFound(_0x5d7d1d,_0x25e127){return function(_0x23e3c3){if(!_0x23e3c3){_0x5d7d1d['sendStatus'](0x194);}return _0x23e3c3;};}function handleError(_0x3237f5,_0x164880){_0x164880=_0x164880||0x1f4;return function(_0x29bf0b){logger[_0xd10d('0x26')](_0x29bf0b[_0xd10d('0x27')]);if(_0x29bf0b[_0xd10d('0x28')]){delete _0x29bf0b[_0xd10d('0x28')];}_0x3237f5['status'](_0x164880)[_0xd10d('0x29')](_0x29bf0b);};}exports[_0xd10d('0x2a')]=function(_0x428e6e,_0xf46bea){var _0x27e77e={},_0x5a24f1={},_0x1171d9={'count':0x0,'rows':[]};var _0x1abe9b=_[_0xd10d('0x2b')](db[_0xd10d('0x2c')]['rawAttributes'],function(_0x20b04f){return{'name':_0x20b04f[_0xd10d('0x2d')],'type':_0x20b04f['type'][_0xd10d('0x2e')]};});_0x5a24f1[_0xd10d('0x2f')]=_[_0xd10d('0x2b')](_0x1abe9b,_0xd10d('0x28'));_0x5a24f1[_0xd10d('0x30')]=_['keys'](_0x428e6e['query']);_0x5a24f1[_0xd10d('0x31')]=_[_0xd10d('0x32')](_0x5a24f1[_0xd10d('0x2f')],_0x5a24f1[_0xd10d('0x30')]);_0x27e77e[_0xd10d('0x33')]=_[_0xd10d('0x32')](_0x5a24f1[_0xd10d('0x2f')],qs[_0xd10d('0x34')](_0x428e6e[_0xd10d('0x30')]['fields']));_0x27e77e[_0xd10d('0x33')]=_0x27e77e[_0xd10d('0x33')][_0xd10d('0x35')]?_0x27e77e[_0xd10d('0x33')]:_0x5a24f1[_0xd10d('0x2f')];if(!_0x428e6e[_0xd10d('0x30')][_0xd10d('0x36')](_0xd10d('0x37'))){_0x27e77e['limit']=qs['limit'](_0x428e6e[_0xd10d('0x30')][_0xd10d('0x1d')]);_0x27e77e[_0xd10d('0x1c')]=qs[_0xd10d('0x1c')](_0x428e6e[_0xd10d('0x30')][_0xd10d('0x1c')]);}_0x27e77e[_0xd10d('0x38')]=qs[_0xd10d('0x39')](_0x428e6e[_0xd10d('0x30')][_0xd10d('0x39')]);_0x27e77e[_0xd10d('0x3a')]=qs[_0xd10d('0x31')](_[_0xd10d('0x3b')](_0x428e6e[_0xd10d('0x30')],_0x5a24f1[_0xd10d('0x31')]),_0x1abe9b);if(_0x428e6e[_0xd10d('0x30')][_0xd10d('0x3c')]){_0x27e77e[_0xd10d('0x3a')]=_[_0xd10d('0x3d')](_0x27e77e['where'],{'$or':_[_0xd10d('0x2b')](_0x1abe9b,function(_0x22436d){if(_0x22436d[_0xd10d('0x3e')]!==_0xd10d('0x3f')){var _0x8ae945={};_0x8ae945[_0x22436d[_0xd10d('0x28')]]={'$like':'%'+_0x428e6e['query'][_0xd10d('0x3c')]+'%'};return _0x8ae945;}})});}_0x27e77e=_[_0xd10d('0x3d')]({},_0x27e77e,_0x428e6e[_0xd10d('0x40')]);var _0x2b6704={'where':_0x27e77e['where']};return db[_0xd10d('0x2c')][_0xd10d('0x1b')](_0x2b6704)[_0xd10d('0x25')](function(_0x4310fe){_0x1171d9[_0xd10d('0x1b')]=_0x4310fe;if(_0x428e6e['query'][_0xd10d('0x41')]){_0x27e77e['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x27e77e);})[_0xd10d('0x25')](function(_0x6959a4){_0x1171d9['rows']=_0x6959a4;return _0x1171d9;})[_0xd10d('0x25')](respondWithFilteredResult(_0xf46bea,_0x27e77e))[_0xd10d('0x42')](handleError(_0xf46bea,null));};exports[_0xd10d('0x43')]=function(_0x579484,_0x31f1e2){var _0x5a653c={'raw':![],'where':{'id':_0x579484['params']['id']}},_0x213f78={};_0x213f78['model']=_[_0xd10d('0x44')](db['VoiceMusicOnHold'][_0xd10d('0x45')]);_0x213f78['query']=_['keys'](_0x579484[_0xd10d('0x30')]);_0x213f78['filters']=_[_0xd10d('0x32')](_0x213f78['model'],_0x213f78[_0xd10d('0x30')]);_0x5a653c['attributes']=_[_0xd10d('0x32')](_0x213f78['model'],qs[_0xd10d('0x34')](_0x579484['query'][_0xd10d('0x34')]));_0x5a653c[_0xd10d('0x33')]=_0x5a653c[_0xd10d('0x33')][_0xd10d('0x35')]?_0x5a653c[_0xd10d('0x33')]:_0x213f78['model'];if(_0x579484[_0xd10d('0x30')][_0xd10d('0x41')]){_0x5a653c[_0xd10d('0x46')]=[{'all':!![]}];}_0x5a653c=_['merge']({},_0x5a653c,_0x579484[_0xd10d('0x40')]);return db[_0xd10d('0x2c')]['find'](_0x5a653c)[_0xd10d('0x25')](handleEntityNotFound(_0x31f1e2,null))[_0xd10d('0x25')](respondWithResult(_0x31f1e2,null))[_0xd10d('0x42')](handleError(_0x31f1e2,null));};exports['update']=function(_0x1b1b00,_0x4edf58){if(_0x1b1b00[_0xd10d('0x47')]['id']){delete _0x1b1b00[_0xd10d('0x47')]['id'];}return db['VoiceMusicOnHold'][_0xd10d('0x48')]({'where':{'id':_0x1b1b00['params']['id']}})[_0xd10d('0x25')](handleEntityNotFound(_0x4edf58,null))['then'](saveUpdates(_0x1b1b00['body'],null))[_0xd10d('0x25')](respondWithResult(_0x4edf58,null))[_0xd10d('0x42')](handleError(_0x4edf58,null));};exports[_0xd10d('0x49')]=function(_0x32a1c0,_0x3d71b9,_0x4e9032){return db[_0xd10d('0x4a')][_0xd10d('0x4b')](function(_0x27bc89){if(_0x32a1c0[_0xd10d('0x47')][_0xd10d('0x4c')]===_0xd10d('0x4d')){_0x32a1c0[_0xd10d('0x47')][_0xd10d('0x4e')]=path[_0xd10d('0x4f')](config['root'],_0xd10d('0x50'),_0x32a1c0[_0xd10d('0x47')][_0xd10d('0x28')]);}return db[_0xd10d('0x2c')][_0xd10d('0x49')](_0x32a1c0[_0xd10d('0x47')],{'transaction':_0x27bc89})['then'](function(_0x3b3a81){if(_0x32a1c0[_0xd10d('0x47')]['mode']===_0xd10d('0x4d')){fs['mkdirSync'](_0x3b3a81[_0xd10d('0x4e')],parseInt(_0xd10d('0x51'),0x8));}var _0x32d091=_0x32a1c0['user'][_0xd10d('0x52')]({'plain':!![]});if(!_0x32d091)throw new Error(_0xd10d('0x53'));if(_0x32d091[_0xd10d('0x54')]===_0xd10d('0x55')){var _0x5f34b5=_0x3b3a81[_0xd10d('0x52')]({'plain':!![]});return db[_0xd10d('0x56')][_0xd10d('0x48')]({'where':{'name':_0xd10d('0x24'),'userProfileId':_0x32d091[_0xd10d('0x57')]},'raw':!![]})[_0xd10d('0x25')](function(_0xd53752){if(_0xd53752&&_0xd53752[_0xd10d('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x5f34b5['name'],'resourceId':_0x5f34b5['id'],'type':_0xd53752[_0xd10d('0x28')],'sectionId':_0xd53752['id']},{})[_0xd10d('0x25')](function(){return _0x3b3a81;});}else{return _0x3b3a81;}})[_0xd10d('0x42')](function(_0x2a997b){logger[_0xd10d('0x26')](_0xd10d('0x59'),_0x2a997b);});}return _0x3b3a81;});})[_0xd10d('0x25')](respondWithResult(_0x3d71b9,0xc9))[_0xd10d('0x42')](handleError(_0x3d71b9,null));};exports[_0xd10d('0x23')]=function(_0x29d1f5,_0x2bd43f,_0x4f0ce6){var _0x483421;return db['VoiceMusicOnHold'][_0xd10d('0x48')]({'where':{'id':_0x29d1f5['params']['id']}})[_0xd10d('0x25')](function(_0x44cd40){if(_0x44cd40){return db[_0xd10d('0x4a')]['transaction'](function(_0x1585a9){return _0x44cd40[_0xd10d('0x23')]({'transaction':_0x1585a9,'raw':!![]})[_0xd10d('0x25')](function(_0x3786cf){if(_0x3786cf[_0xd10d('0x4e')]){fs[_0xd10d('0x5a')](_0x3786cf['directory'])[_0xd10d('0x5b')](function(_0x31f01a){fs[_0xd10d('0x5c')](path[_0xd10d('0x4f')](_0x3786cf[_0xd10d('0x4e')],_0x31f01a));});fs[_0xd10d('0x5d')](_0x3786cf[_0xd10d('0x4e')]);}return _0x3786cf;});})[_0xd10d('0x42')](function(_0xe22ec4){throw new db[(_0xd10d('0x5e'))][(_0xd10d('0x5f'))](_0xe22ec4[_0xd10d('0x60')]);});}})['then'](handleEntityNotFound(_0x2bd43f,null))[_0xd10d('0x25')](removeEntity(_0x2bd43f,null))[_0xd10d('0x42')](handleError(_0x2bd43f,null));};exports[_0xd10d('0x61')]=function(_0x19437d,_0x30a769,_0x3d1a9e){return db[_0xd10d('0x4a')][_0xd10d('0x4b')](function(_0x396619){var _0x5620ea;return db[_0xd10d('0x2c')][_0xd10d('0x48')]({'where':{'id':_0x19437d['params']['id']}})[_0xd10d('0x25')](function(_0x80360){if(_0x80360){_0x5620ea=_0x80360;return _0x80360[_0xd10d('0x61')](_0x19437d[_0xd10d('0x47')]['id'],{'transaction':_0x396619});}})[_0xd10d('0x25')](function(_0x20c64c){if(_0x20c64c){return db['Sound'][_0xd10d('0x62')]({'where':{'id':_0x19437d[_0xd10d('0x47')]['id']},'attributes':['id','name',_0xd10d('0x63'),_0xd10d('0x64'),_0xd10d('0x65')],'raw':!![]});}})[_0xd10d('0x25')](function(_0x22add3){if(_0x22add3){var _0x15b1ff=path[_0xd10d('0x4f')](config[_0xd10d('0x66')],'server/files/sounds/converted',util[_0xd10d('0x67')](_0xd10d('0x68'),path[_0xd10d('0x69')](_0x22add3[_0xd10d('0x63')],path[_0xd10d('0x6a')](_0x22add3[_0xd10d('0x63')])),_0x22add3[_0xd10d('0x64')]));var _0x310f8d=path[_0xd10d('0x4f')](config[_0xd10d('0x66')],_0xd10d('0x50'),_0x5620ea[_0xd10d('0x28')],util[_0xd10d('0x67')](_0xd10d('0x68'),_0x22add3[_0xd10d('0x28')],_0x22add3['converted_format']));fs[_0xd10d('0x6b')](_0x15b1ff,_0x310f8d);return _0x22add3;}})[_0xd10d('0x42')](function(_0x54a6c4){throw new db['Sequelize'][(_0xd10d('0x5f'))](_0x54a6c4[_0xd10d('0x60')]);});})[_0xd10d('0x25')](handleEntityNotFound(_0x30a769,null))[_0xd10d('0x25')](respondWithResult(_0x30a769,0xc9))['catch'](handleError(_0x30a769,null));};exports[_0xd10d('0x6c')]=function(_0x2746d9,_0x5124df,_0x1af4f1){return db['sequelize'][_0xd10d('0x4b')](function(_0x48c0e5){var _0x53553e;return db[_0xd10d('0x2c')][_0xd10d('0x62')]({'where':{'id':_0x2746d9[_0xd10d('0x6d')]['id']}})[_0xd10d('0x25')](handleEntityNotFound(_0x5124df,null))['then'](function(_0x3017c9){if(_0x3017c9){_0x53553e=_0x3017c9;return _0x3017c9[_0xd10d('0x6c')](_0x2746d9[_0xd10d('0x6d')][_0xd10d('0x6e')]);}})['then'](function(_0x269baf){if(_0x269baf){return db[_0xd10d('0x6f')][_0xd10d('0x62')]({'where':{'id':_0x2746d9['params'][_0xd10d('0x6e')]},'attributes':['id',_0xd10d('0x28'),_0xd10d('0x63'),_0xd10d('0x64'),'createdAt'],'raw':!![]});}})['then'](function(_0x6cd561){if(_0x6cd561){fs[_0xd10d('0x5c')](path[_0xd10d('0x4f')](_0x53553e[_0xd10d('0x4e')],util[_0xd10d('0x67')](_0xd10d('0x68'),_0x6cd561['name'],_0x6cd561[_0xd10d('0x64')])));return _0x6cd561;}})[_0xd10d('0x42')](function(_0x4eb4fb){throw new db[(_0xd10d('0x5e'))][(_0xd10d('0x5f'))](_0x4eb4fb[_0xd10d('0x60')]);});})[_0xd10d('0x25')](handleEntityNotFound(_0x5124df,null))[_0xd10d('0x25')](respondWithStatusCode(_0x5124df,0xcc))[_0xd10d('0x42')](handleError(_0x5124df,null));};exports['getSounds']=function(_0x5244d2,_0x5807bb,_0x1d6ae3){var _0x100fbd={};var _0x328d68={};var _0x49b833;var _0x2ef436;return db['VoiceMusicOnHold'][_0xd10d('0x62')]({'where':{'id':_0x5244d2[_0xd10d('0x6d')]['id']}})['then'](handleEntityNotFound(_0x5807bb,null))['then'](function(_0x3f7bde){if(_0x3f7bde){_0x49b833=_0x3f7bde;_0x328d68[_0xd10d('0x2f')]=_['keys'](db['Sound']['rawAttributes']);_0x328d68['query']=_[_0xd10d('0x44')](_0x5244d2[_0xd10d('0x30')]);_0x328d68[_0xd10d('0x31')]=_[_0xd10d('0x32')](_0x328d68[_0xd10d('0x2f')],_0x328d68['query']);_0x100fbd[_0xd10d('0x33')]=_[_0xd10d('0x32')](_0x328d68[_0xd10d('0x2f')],qs[_0xd10d('0x34')](_0x5244d2[_0xd10d('0x30')][_0xd10d('0x34')]));_0x100fbd[_0xd10d('0x33')]=_0x100fbd['attributes'][_0xd10d('0x35')]?_0x100fbd[_0xd10d('0x33')]:_0x328d68[_0xd10d('0x2f')];_0x100fbd[_0xd10d('0x38')]=qs[_0xd10d('0x39')](_0x5244d2['query'][_0xd10d('0x39')]);_0x100fbd[_0xd10d('0x3a')]=qs['filters'](_[_0xd10d('0x3b')](_0x5244d2[_0xd10d('0x30')],_0x328d68[_0xd10d('0x31')]));if(_0x5244d2[_0xd10d('0x30')][_0xd10d('0x3c')]){_0x100fbd[_0xd10d('0x3a')]=_[_0xd10d('0x3d')](_0x100fbd[_0xd10d('0x3a')],{'$or':_['map'](_0x100fbd['attributes'],function(_0x511cac){var _0x46f245={};_0x46f245[_0x511cac]={'$like':'%'+_0x5244d2['query']['filter']+'%'};return _0x46f245;})});}_0x100fbd=_[_0xd10d('0x3d')]({},_0x100fbd,_0x5244d2[_0xd10d('0x40')]);return _0x49b833[_0xd10d('0x70')](_0x100fbd);}})[_0xd10d('0x25')](function(_0x573f20){if(_0x573f20){_0x2ef436=_0x573f20[_0xd10d('0x35')];if(!_0x5244d2[_0xd10d('0x30')][_0xd10d('0x36')](_0xd10d('0x37'))){_0x100fbd[_0xd10d('0x1d')]=qs[_0xd10d('0x1d')](_0x5244d2[_0xd10d('0x30')][_0xd10d('0x1d')]);_0x100fbd[_0xd10d('0x1c')]=qs['offset'](_0x5244d2['query'][_0xd10d('0x1c')]);}return _0x49b833[_0xd10d('0x70')](_0x100fbd);}})['then'](function(_0x5a27cd){if(_0x5a27cd){return _0x5a27cd?{'count':_0x2ef436,'rows':_0x5a27cd}:null;}})[_0xd10d('0x25')](respondWithResult(_0x5807bb,null))[_0xd10d('0x42')](handleError(_0x5807bb,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index ce55f8c..4705934 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5c9=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x1bf14c,_0x5902ba){var _0x25ef15=function(_0x8c0f8){while(--_0x8c0f8){_0x1bf14c['push'](_0x1bf14c['shift']());}};_0x25ef15(++_0x5902ba);}(_0xa5c9,0x148));var _0x9a5c=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xa5c9[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var moment=require(_0x9a5c('0x4'));var BPromise=require(_0x9a5c('0x5'));var rp=require(_0x9a5c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a5c('0x7'));var config=require(_0x9a5c('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x304ef7,_0x2c89ef){return _0x304ef7['define'](_0x9a5c('0x9'),attributes,{'tableName':_0x9a5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68e4=['request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','api','moment','bluebird'];(function(_0x7810d4,_0x26d275){var _0x526aa1=function(_0x3ff962){while(--_0x3ff962){_0x7810d4['push'](_0x7810d4['shift']());}};_0x526aa1(++_0x26d275);}(_0x68e4,0x1b7));var _0x468e=function(_0xa94ece,_0x7974e6){_0xa94ece=_0xa94ece-0x0;var _0x47a2a4=_0x68e4[_0xa94ece];return _0x47a2a4;};'use strict';var _=require(_0x468e('0x0'));var util=require(_0x468e('0x1'));var logger=require('../../config/logger')(_0x468e('0x2'));var moment=require(_0x468e('0x3'));var BPromise=require(_0x468e('0x4'));var rp=require(_0x468e('0x5'));var fs=require('fs');var path=require(_0x468e('0x6'));var rimraf=require('rimraf');var config=require(_0x468e('0x7'));var attributes=require(_0x468e('0x8'));module[_0x468e('0x9')]=function(_0x4d2c2a,_0x4f7177){return _0x4d2c2a[_0x468e('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0x468e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 50dbc55..31c70ec 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d2c=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMusicOnHold,\x20%s,\x20%s','result','catch'];(function(_0x45e5f1,_0x5ac3ee){var _0x448018=function(_0x115b44){while(--_0x115b44){_0x45e5f1['push'](_0x45e5f1['shift']());}};_0x448018(++_0x5ac3ee);}(_0x2d2c,0x108));var _0xc2d2=function(_0x18a4f7,_0x3f915c){_0x18a4f7=_0x18a4f7-0x0;var _0x368cf3=_0x2d2c[_0x18a4f7];return _0x368cf3;};'use strict';var _=require(_0xc2d2('0x0'));var util=require(_0xc2d2('0x1'));var moment=require(_0xc2d2('0x2'));var BPromise=require('bluebird');var rs=require(_0xc2d2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2d2('0x4'))['db'];var utils=require(_0xc2d2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc2d2('0x6'));var jayson=require(_0xc2d2('0x7'));var client=jayson[_0xc2d2('0x8')][_0xc2d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x985227,_0x51cf69,_0x5c689b){return new BPromise(function(_0x55e9ec,_0x1ea6a8){return client['request'](_0x985227,_0x5c689b)[_0xc2d2('0xa')](function(_0x162777){logger[_0xc2d2('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x51cf69,_0xc2d2('0xc'));logger[_0xc2d2('0xd')](_0xc2d2('0xe'),_0x51cf69,'request\x20sent',JSON[_0xc2d2('0xf')](_0x162777));if(_0x162777[_0xc2d2('0x10')]){if(_0x162777[_0xc2d2('0x10')][_0xc2d2('0x11')]===0x1f4){logger[_0xc2d2('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x51cf69,_0x162777[_0xc2d2('0x10')][_0xc2d2('0x12')]);return _0x1ea6a8(_0x162777[_0xc2d2('0x10')][_0xc2d2('0x12')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x51cf69,_0x162777[_0xc2d2('0x10')][_0xc2d2('0x12')]);return _0x55e9ec(_0x162777[_0xc2d2('0x10')]['message']);}else{logger['info'](_0xc2d2('0x13'),_0x51cf69,_0xc2d2('0xc'));_0x55e9ec(_0x162777[_0xc2d2('0x14')][_0xc2d2('0x12')]);}})[_0xc2d2('0x15')](function(_0x5e262c){logger[_0xc2d2('0x10')](_0xc2d2('0x13'),_0x51cf69,_0x5e262c);_0x1ea6a8(_0x5e262c);});});} \ No newline at end of file +var _0x210b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x33974c,_0x406989){var _0xa0c564=function(_0x4a5aa3){while(--_0x4a5aa3){_0x33974c['push'](_0x33974c['shift']());}};_0xa0c564(++_0x406989);}(_0x210b,0x1df));var _0xb210=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x210b[_0x26f1b2];return _0x1624a4;};'use strict';var _=require(_0xb210('0x0'));var util=require(_0xb210('0x1'));var moment=require(_0xb210('0x2'));var BPromise=require(_0xb210('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb210('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb210('0x5'));var logger=require(_0xb210('0x6'))('rpc');var config=require(_0xb210('0x7'));var jayson=require(_0xb210('0x8'));var client=jayson[_0xb210('0x9')][_0xb210('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x294080,_0x54681c,_0x3876a9){return new BPromise(function(_0x5d1eef,_0x5ec19e){return client[_0xb210('0xb')](_0x294080,_0x3876a9)[_0xb210('0xc')](function(_0x49db56){logger[_0xb210('0xd')](_0xb210('0xe'),_0x54681c,'request\x20sent');logger[_0xb210('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x54681c,_0xb210('0x10'),JSON[_0xb210('0x11')](_0x49db56));if(_0x49db56[_0xb210('0x12')]){if(_0x49db56[_0xb210('0x12')][_0xb210('0x13')]===0x1f4){logger['error'](_0xb210('0xe'),_0x54681c,_0x49db56[_0xb210('0x12')][_0xb210('0x14')]);return _0x5ec19e(_0x49db56[_0xb210('0x12')][_0xb210('0x14')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x54681c,_0x49db56[_0xb210('0x12')]['message']);return _0x5d1eef(_0x49db56['error'][_0xb210('0x14')]);}else{logger[_0xb210('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x54681c,_0xb210('0x10'));_0x5d1eef(_0x49db56['result']['message']);}})[_0xb210('0x15')](function(_0x31eb8d){logger[_0xb210('0x12')](_0xb210('0xe'),_0x54681c,_0x31eb8d);_0x5ec19e(_0x31eb8d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5fb1e51..94d32cc 100644 --- a/server/api/voicePrefix/index.js +++ b/server/api/voicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x992e=['../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','get','/describe','describe','/:id/users','getAgents','post','create','addAgents','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x992e,0x13c));var _0xe992=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0x992e[_0x228641];return _0x5d5d78;};'use strict';var multer=require(_0xe992('0x0'));var util=require(_0xe992('0x1'));var path=require(_0xe992('0x2'));var timeout=require(_0xe992('0x3'));var express=require(_0xe992('0x4'));var router=express[_0xe992('0x5')]();var auth=require(_0xe992('0x6'));var interaction=require(_0xe992('0x7'));var config=require('../../config/environment');var controller=require(_0xe992('0x8'));router['get']('/',auth[_0xe992('0x9')](),controller['index']);router[_0xe992('0xa')](_0xe992('0xb'),auth[_0xe992('0x9')](),controller[_0xe992('0xc')]);router[_0xe992('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe992('0xa')](_0xe992('0xd'),auth[_0xe992('0x9')](),controller[_0xe992('0xe')]);router[_0xe992('0xf')]('/',auth[_0xe992('0x9')](),controller[_0xe992('0x10')]);router[_0xe992('0xf')](_0xe992('0xd'),auth[_0xe992('0x9')](),controller[_0xe992('0x11')]);router[_0xe992('0x12')](_0xe992('0x13'),auth[_0xe992('0x9')](),controller['update']);router[_0xe992('0x14')](_0xe992('0x13'),auth[_0xe992('0x9')](),controller[_0xe992('0x15')]);router[_0xe992('0x14')](_0xe992('0xd'),auth[_0xe992('0x9')](),controller['removeAgents']);module[_0xe992('0x16')]=router; \ No newline at end of file +var _0xce78=['express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update','delete','removeAgents','exports','multer','connect-timeout'];(function(_0x535589,_0x4e5568){var _0x14b9c2=function(_0xc783ef){while(--_0xc783ef){_0x535589['push'](_0x535589['shift']());}};_0x14b9c2(++_0x4e5568);}(_0xce78,0xfa));var _0x8ce7=function(_0x20116d,_0x39b844){_0x20116d=_0x20116d-0x0;var _0x39ecfb=_0xce78[_0x20116d];return _0x39ecfb;};'use strict';var multer=require(_0x8ce7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ce7('0x1'));var express=require(_0x8ce7('0x2'));var router=express[_0x8ce7('0x3')]();var auth=require(_0x8ce7('0x4'));var interaction=require(_0x8ce7('0x5'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x8ce7('0x6')](),controller['index']);router[_0x8ce7('0x7')]('/describe',auth[_0x8ce7('0x6')](),controller[_0x8ce7('0x8')]);router[_0x8ce7('0x7')](_0x8ce7('0x9'),auth[_0x8ce7('0x6')](),controller[_0x8ce7('0xa')]);router[_0x8ce7('0x7')](_0x8ce7('0xb'),auth[_0x8ce7('0x6')](),controller[_0x8ce7('0xc')]);router[_0x8ce7('0xd')]('/',auth[_0x8ce7('0x6')](),controller[_0x8ce7('0xe')]);router[_0x8ce7('0xd')](_0x8ce7('0xb'),auth[_0x8ce7('0x6')](),controller[_0x8ce7('0xf')]);router[_0x8ce7('0x10')](_0x8ce7('0x9'),auth['isAuthenticated'](),controller[_0x8ce7('0x11')]);router[_0x8ce7('0x12')](_0x8ce7('0x9'),auth[_0x8ce7('0x6')](),controller['destroy']);router[_0x8ce7('0x12')](_0x8ce7('0xb'),auth[_0x8ce7('0x6')](),controller[_0x8ce7('0x13')]);module[_0x8ce7('0x14')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6a87909..c6cdd1e 100644 --- a/server/api/voicePrefix/voicePrefix.attributes.js +++ b/server/api/voicePrefix/voicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdc9=['system-','getDataValue','INTEGER','STRING','name'];(function(_0x31eb98,_0x592fa2){var _0x20cf3e=function(_0x5e30b1){while(--_0x5e30b1){_0x31eb98['push'](_0x31eb98['shift']());}};_0x20cf3e(++_0x592fa2);}(_0xfdc9,0xe9));var _0x9fdc=function(_0x3e30a8,_0x257732){_0x3e30a8=_0x3e30a8-0x0;var _0x5d5d1d=_0xfdc9[_0x3e30a8];return _0x5d5d1d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9fdc('0x0')],'allowNull':![],'unique':_0x9fdc('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x471b84){return _0x9fdc('0x2')+this[_0x9fdc('0x3')](_0x9fdc('0x1'))+'-';}},'description':{'type':Sequelize[_0x9fdc('0x0')]},'callerIdAll':{'type':Sequelize[_0x9fdc('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0x9fdc('0x4')]}}; \ No newline at end of file +var _0xd98c=['sequelize','exports','STRING','name','VIRTUAL','INTEGER'];(function(_0x3ed5e8,_0x2ceeef){var _0x19f6c5=function(_0x25d348){while(--_0x25d348){_0x3ed5e8['push'](_0x3ed5e8['shift']());}};_0x19f6c5(++_0x2ceeef);}(_0xd98c,0x168));var _0xcd98=function(_0x5d6654,_0x2a2ac6){_0x5d6654=_0x5d6654-0x0;var _0x4bb038=_0xd98c[_0x5d6654];return _0x4bb038;};'use strict';var Sequelize=require(_0xcd98('0x0'));module[_0xcd98('0x1')]={'name':{'type':Sequelize[_0xcd98('0x2')],'allowNull':![],'unique':_0xcd98('0x3')},'prefix':{'type':Sequelize[_0xcd98('0x4')],'get':function(_0x26fdf3){return'system-'+this['getDataValue'](_0xcd98('0x3'))+'-';}},'description':{'type':Sequelize[_0xcd98('0x2')]},'callerIdAll':{'type':Sequelize[_0xcd98('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xcd98('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 805d5a9..ecea01d 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','sendStatus','status','end','json','count','offset','limit','set','save','destroy','then','get','error','stack','name','send','index','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','describe','create','sequelize','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','UserProfileResource','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','NoOp','goto','${EXTEN:','charAt','update','body','addAgents','ids','omit','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','User','html-pdf','eml-format'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x2542,0x169));var _0x2254=function(_0x26eed4,_0x445e55){_0x26eed4=_0x26eed4-0x0;var _0x4ccdb2=_0x2542[_0x26eed4];return _0x4ccdb2;};'use strict';var pdf=require(_0x2254('0x0'));var emlformat=require(_0x2254('0x1'));var rimraf=require(_0x2254('0x2'));var zipdir=require(_0x2254('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2254('0x4'));var moment=require('moment');var BPromise=require(_0x2254('0x5'));var Mustache=require(_0x2254('0x6'));var util=require(_0x2254('0x7'));var path=require(_0x2254('0x8'));var sox=require(_0x2254('0x9'));var csv=require('to-csv');var ejs=require(_0x2254('0xa'));var fs=require('fs');var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x10'));var querystring=require(_0x2254('0x11'));var Papa=require(_0x2254('0x12'));var Redis=require(_0x2254('0x13'));var authService=require(_0x2254('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x15'));var hardwareService=require(_0x2254('0x16'));var logger=require(_0x2254('0x17'))(_0x2254('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x19'));var db=require(_0x2254('0x1a'))['db'];config[_0x2254('0x1b')]=_[_0x2254('0x1c')](config[_0x2254('0x1b')],{'host':_0x2254('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2254('0x1b')]));require(_0x2254('0x1e'))['register'](socket);function respondWithStatusCode(_0x2f4de,_0x1e582d){_0x1e582d=_0x1e582d||0xcc;return function(_0xfb23cb){if(_0xfb23cb){return _0x2f4de[_0x2254('0x1f')](_0x1e582d);}return _0x2f4de[_0x2254('0x20')](_0x1e582d)[_0x2254('0x21')]();};}function respondWithResult(_0x50f137,_0x18baf4){_0x18baf4=_0x18baf4||0xc8;return function(_0x57247a){if(_0x57247a){return _0x50f137[_0x2254('0x20')](_0x18baf4)[_0x2254('0x22')](_0x57247a);}};}function respondWithFilteredResult(_0x170ffa,_0x25f8b2){return function(_0x1ae11e){if(_0x1ae11e){var _0x34f90e=_0x1ae11e[_0x2254('0x23')],_0x497724=_0x25f8b2[_0x2254('0x24')],_0x51b395=_0x25f8b2[_0x2254('0x24')]+_0x25f8b2[_0x2254('0x25')],_0x5ec98d;if(_0x51b395>=_0x34f90e){_0x51b395=_0x34f90e;_0x5ec98d=0xc8;}else{_0x5ec98d=0xce;}_0x170ffa[_0x2254('0x20')](_0x5ec98d);return _0x170ffa[_0x2254('0x26')]('Content-Range',_0x497724+'-'+_0x51b395+'/'+_0x34f90e)[_0x2254('0x22')](_0x1ae11e);}return null;};}function patchUpdates(_0x16148d){return function(_0x906cde){try{jsonpatch['apply'](_0x906cde,_0x16148d,!![]);}catch(_0x52fedc){return BPromise['reject'](_0x52fedc);}return _0x906cde[_0x2254('0x27')]();};}function saveUpdates(_0x559af4,_0xf88b56){return function(_0x56b91e){if(_0x56b91e){return _0x56b91e['update'](_0x559af4)['then'](function(_0x540020){return _0x540020;});}return null;};}function removeEntity(_0x5e5edb,_0x4f797d){return function(_0x1aa71f){if(_0x1aa71f){return _0x1aa71f[_0x2254('0x28')]()[_0x2254('0x29')](function(){var _0x265467=_0x1aa71f[_0x2254('0x2a')]({'plain':!![]});var _0x1349c9='VoicePrefixes';return db['UserProfileResource'][_0x2254('0x28')]({'where':{'type':_0x1349c9,'resourceId':_0x265467['id']}})['then'](function(){return _0x1aa71f;});})[_0x2254('0x29')](function(){_0x5e5edb[_0x2254('0x20')](0xcc)[_0x2254('0x21')]();});}};}function handleEntityNotFound(_0x3aa0bd,_0x19043b){return function(_0x482688){if(!_0x482688){_0x3aa0bd[_0x2254('0x1f')](0x194);}return _0x482688;};}function handleError(_0x2a789b,_0x21285d){_0x21285d=_0x21285d||0x1f4;return function(_0x37af8b){logger[_0x2254('0x2b')](_0x37af8b[_0x2254('0x2c')]);if(_0x37af8b[_0x2254('0x2d')]){delete _0x37af8b[_0x2254('0x2d')];}_0x2a789b[_0x2254('0x20')](_0x21285d)[_0x2254('0x2e')](_0x37af8b);};}exports[_0x2254('0x2f')]=function(_0xad7774,_0x220f2a){var _0x27d30a={},_0x4577f4={},_0x1b16c8={'count':0x0,'rows':[]};var _0x2c929f=_[_0x2254('0x30')](db[_0x2254('0x31')]['rawAttributes'],function(_0xe29526){return{'name':_0xe29526[_0x2254('0x32')],'type':_0xe29526[_0x2254('0x33')][_0x2254('0x34')]};});_0x4577f4[_0x2254('0x35')]=_[_0x2254('0x30')](_0x2c929f,_0x2254('0x2d'));_0x4577f4[_0x2254('0x36')]=_[_0x2254('0x37')](_0xad7774['query']);_0x4577f4[_0x2254('0x38')]=_[_0x2254('0x39')](_0x4577f4['model'],_0x4577f4[_0x2254('0x36')]);_0x27d30a[_0x2254('0x3a')]=_[_0x2254('0x39')](_0x4577f4[_0x2254('0x35')],qs['fields'](_0xad7774['query'][_0x2254('0x3b')]));_0x27d30a['attributes']=_0x27d30a[_0x2254('0x3a')][_0x2254('0x3c')]?_0x27d30a[_0x2254('0x3a')]:_0x4577f4[_0x2254('0x35')];if(!_0xad7774[_0x2254('0x36')][_0x2254('0x3d')](_0x2254('0x3e'))){_0x27d30a['limit']=qs[_0x2254('0x25')](_0xad7774[_0x2254('0x36')][_0x2254('0x25')]);_0x27d30a[_0x2254('0x24')]=qs[_0x2254('0x24')](_0xad7774[_0x2254('0x36')][_0x2254('0x24')]);}_0x27d30a[_0x2254('0x3f')]=qs[_0x2254('0x40')](_0xad7774[_0x2254('0x36')]['sort']);_0x27d30a[_0x2254('0x41')]=qs[_0x2254('0x38')](_[_0x2254('0x42')](_0xad7774[_0x2254('0x36')],_0x4577f4['filters']),_0x2c929f);if(_0xad7774[_0x2254('0x36')][_0x2254('0x43')]){_0x27d30a[_0x2254('0x41')]=_[_0x2254('0x44')](_0x27d30a[_0x2254('0x41')],{'$or':_[_0x2254('0x30')](_0x2c929f,function(_0x423377){if(_0x423377[_0x2254('0x33')]!=='VIRTUAL'){var _0x362ad1={};_0x362ad1[_0x423377['name']]={'$like':'%'+_0xad7774[_0x2254('0x36')][_0x2254('0x43')]+'%'};return _0x362ad1;}})});}_0x27d30a=_[_0x2254('0x44')]({},_0x27d30a,_0xad7774[_0x2254('0x45')]);var _0x460bb3={'where':_0x27d30a[_0x2254('0x41')]};return db[_0x2254('0x31')]['count'](_0x460bb3)[_0x2254('0x29')](function(_0x2f1ff9){_0x1b16c8[_0x2254('0x23')]=_0x2f1ff9;if(_0xad7774[_0x2254('0x36')][_0x2254('0x46')]){_0x27d30a['include']=[{'all':!![]}];}return db[_0x2254('0x31')][_0x2254('0x47')](_0x27d30a);})[_0x2254('0x29')](function(_0x135ed8){_0x1b16c8[_0x2254('0x48')]=_0x135ed8;return _0x1b16c8;})['then'](respondWithFilteredResult(_0x220f2a,_0x27d30a))[_0x2254('0x49')](handleError(_0x220f2a,null));};exports['show']=function(_0x91e091,_0x1ded9a){var _0xb4d042={'raw':![],'where':{'id':_0x91e091[_0x2254('0x4a')]['id']}},_0x31c31e={};_0x31c31e[_0x2254('0x35')]=_[_0x2254('0x37')](db[_0x2254('0x31')][_0x2254('0x4b')]);_0x31c31e[_0x2254('0x36')]=_[_0x2254('0x37')](_0x91e091[_0x2254('0x36')]);_0x31c31e[_0x2254('0x38')]=_['intersection'](_0x31c31e[_0x2254('0x35')],_0x31c31e[_0x2254('0x36')]);_0xb4d042[_0x2254('0x3a')]=_['intersection'](_0x31c31e[_0x2254('0x35')],qs[_0x2254('0x3b')](_0x91e091[_0x2254('0x36')][_0x2254('0x3b')]));_0xb4d042[_0x2254('0x3a')]=_0xb4d042[_0x2254('0x3a')][_0x2254('0x3c')]?_0xb4d042[_0x2254('0x3a')]:_0x31c31e[_0x2254('0x35')];if(_0x91e091['query'][_0x2254('0x46')]){_0xb4d042[_0x2254('0x4c')]=[{'all':!![]}];}_0xb4d042=_[_0x2254('0x44')]({},_0xb4d042,_0x91e091[_0x2254('0x45')]);return db[_0x2254('0x31')][_0x2254('0x4d')](_0xb4d042)[_0x2254('0x29')](handleEntityNotFound(_0x1ded9a,null))[_0x2254('0x29')](respondWithResult(_0x1ded9a,null))[_0x2254('0x49')](handleError(_0x1ded9a,null));};exports[_0x2254('0x28')]=function(_0x5b14c5,_0x36b977){return db[_0x2254('0x31')]['find']({'where':{'id':_0x5b14c5[_0x2254('0x4a')]['id']}})[_0x2254('0x29')](handleEntityNotFound(_0x36b977,null))[_0x2254('0x29')](removeEntity(_0x36b977,null))[_0x2254('0x49')](handleError(_0x36b977,null));};exports['describe']=function(_0x102e4b,_0x4219a8){return db['VoicePrefix'][_0x2254('0x4e')]()[_0x2254('0x29')](respondWithResult(_0x4219a8,null))[_0x2254('0x49')](handleError(_0x4219a8,null));};exports[_0x2254('0x4f')]=function(_0x48abd5,_0x166d56){var _0x106282;return db[_0x2254('0x50')]['transaction'](function(_0x4cc18a){return db[_0x2254('0x31')][_0x2254('0x4f')](_0x48abd5['body'],{'transaction':_0x4cc18a})[_0x2254('0x29')](function(_0x5bc29a){_0x106282=_0x5bc29a['get']({'plain':!![]});return db[_0x2254('0x51')][_0x2254('0x4d')]({'where':{'id':_0x106282[_0x2254('0x52')]},'raw':!![]})[_0x2254('0x29')](function(_0x3c6f6c){return createVoicePrefixExtensions(_0x106282,_0x3c6f6c,_0x4cc18a);});});})['then'](function(){var _0x5eceb9=_0x48abd5[_0x2254('0x53')]['get']({'plain':!![]});if(!_0x5eceb9)throw new Error(_0x2254('0x54'));if(_0x5eceb9[_0x2254('0x55')]===_0x2254('0x53')){var _0x2fe9a7=_0x106282;return db['UserProfileSection'][_0x2254('0x4d')]({'where':{'name':_0x2254('0x56'),'userProfileId':_0x5eceb9['userProfileId']},'raw':!![]})['then'](function(_0x1a2973){if(_0x1a2973&&_0x1a2973['autoAssociation']===0x0){return db[_0x2254('0x57')][_0x2254('0x4f')]({'name':_0x2fe9a7[_0x2254('0x2d')],'resourceId':_0x2fe9a7['id'],'type':_0x1a2973[_0x2254('0x2d')],'sectionId':_0x1a2973['id']},{})[_0x2254('0x29')](function(){return _0x106282;});}else{return _0x106282;}})['catch'](function(_0x5cde3f){logger[_0x2254('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cde3f);throw _0x5cde3f;});}return _0x106282;})[_0x2254('0x29')](respondWithResult(_0x166d56,null))['catch'](handleError(_0x166d56,null));};function Extension(_0x4da493,_0x5999c8,_0x2c0063,_0x448773){this[_0x2254('0x58')]=_0x2254('0x59');this[_0x2254('0x5a')]=_0x4da493;this[_0x2254('0x5b')]=_0x2c0063;this[_0x2254('0x33')]=_0x2254('0x5c');this[_0x2254('0x5d')]=_0x2254('0x5e');this[_0x2254('0x5f')]=_0x5999c8;this[_0x2254('0x60')]=_0x448773;}function createVoicePrefixExtensions(_0x41c97d,_0x24e57a,_0x2f391d){return new BPromise(function(_0x3b81bb,_0x4659fc){var _0x399ba2=new Extension(formatPrefixName(_0x41c97d[_0x2254('0x61')]),0x1,'NoOp',_0x2254('0x62'));_0x399ba2[_0x2254('0x63')]=_0x41c97d['id'];return db[_0x2254('0x51')][_0x2254('0x4f')](_0x399ba2,{'transaction':_0x2f391d})['then'](function(_0x494347){var _0x471fdd=_0x494347[_0x2254('0x2a')]({'plain':!![]});var _0x1d73a3=_[_0x2254('0x30')](addVoicePrefixExtensions(_0x41c97d,_0x24e57a),function(_0x1021b2){_0x1021b2['VoiceExtensionId']=_0x471fdd['id'];_0x1021b2[_0x2254('0x63')]=_0x41c97d['id'];return _0x1021b2;});return db[_0x2254('0x51')][_0x2254('0x64')](_0x1d73a3,{'transaction':_0x2f391d})['then'](function(_0x5ada4c){if(!_0x5ada4c){return _0x4659fc(_0x2254('0x65'));}else{return _0x3b81bb(_0x5ada4c);}})['catch'](function(_0x294931){return _0x4659fc(_0x294931);});});;});};function addVoicePrefixExtensions(_0x232d6c,_0x5b269d){var _0x3c091e=[];var _0x1b154f=formatPrefixName(_0x232d6c['prefix']);_0x3c091e[_0x2254('0x66')](new Extension(_0x1b154f,0x2,_0x2254('0x67'),'CDR(prefix)='+_0x232d6c['name']));if(_0x232d6c[_0x2254('0x68')]){_0x3c091e[_0x2254('0x66')](new Extension(_0x1b154f,0x3,'Set','PREFIX-CALLERIDALL='+_0x232d6c[_0x2254('0x68')]));}else{_0x3c091e['push'](new Extension(_0x1b154f,0x3,_0x2254('0x69'),'No\x20callerid\x20available'));}_0x3c091e[_0x2254('0x66')](new Extension(_0x1b154f,0x4,_0x2254('0x6a'),_0x5b269d[_0x2254('0x58')]+','+_0x2254('0x6b')+(0x8+_0x232d6c['name'][_0x2254('0x3c')])+'}'+','+0x1));return _0x3c091e;}function formatPrefixName(_0x5ecf82){var _0x1c2158='_';for(var _0x33cab6=0x0;_0x33cab6<_0x5ecf82['length'];_0x33cab6++){if(_0x5ecf82[_0x2254('0x6c')](_0x33cab6)=='-'){_0x1c2158+=_0x5ecf82[_0x2254('0x6c')](_0x33cab6);}else{_0x1c2158+='['+_0x5ecf82['charAt'](_0x33cab6)+']';}}_0x1c2158+='.';return _0x1c2158;}exports[_0x2254('0x6d')]=function(_0x3b3b20,_0x28ef48,_0x3cefbe){var _0x4f77e5=_0x3b3b20[_0x2254('0x6e')];_0x4f77e5[_0x2254('0x61')]='system-'+_0x4f77e5[_0x2254('0x2d')]+'-';return db[_0x2254('0x50')]['transaction'](function(_0x242e15){return db['VoicePrefix'][_0x2254('0x6d')](_0x4f77e5,{'where':{'id':_0x4f77e5['id']},'transaction':_0x242e15})['then'](function(){return db[_0x2254('0x51')][_0x2254('0x28')]({'where':{'VoicePrefixId':_0x4f77e5['id']},'transaction':_0x242e15})['then'](function(){return db[_0x2254('0x51')]['find']({'where':{'id':_0x4f77e5[_0x2254('0x52')]},'raw':!![]})[_0x2254('0x29')](function(_0x38294d){return createVoicePrefixExtensions(_0x4f77e5,_0x38294d,_0x242e15);});});});})['then'](function(){return db[_0x2254('0x31')]['findById'](_0x4f77e5['id']);})[_0x2254('0x29')](respondWithResult(_0x28ef48,null))[_0x2254('0x49')](handleError(_0x28ef48,null));};exports['addAgents']=function(_0x58d475,_0x4115ba,_0xec9b71){return db[_0x2254('0x31')][_0x2254('0x4d')]({'where':{'id':_0x58d475['params']['id']}})[_0x2254('0x29')](handleEntityNotFound(_0x4115ba,null))[_0x2254('0x29')](function(_0x1b9dd8){if(_0x1b9dd8){return _0x1b9dd8[_0x2254('0x6f')](_0x58d475['body'][_0x2254('0x70')],_[_0x2254('0x71')](_0x58d475['body'],[_0x2254('0x70'),'id'])||{})['spread'](function(_0x19283d){for(var _0x5bb742=0x0;_0x5bb742<_0x58d475['body']['ids'][_0x2254('0x3c')];_0x5bb742+=0x1){socket['emit'](_0x2254('0x72'),{'UserId':_0x58d475[_0x2254('0x6e')]['ids'][_0x5bb742],'VoicePrefixId':_0x58d475[_0x2254('0x4a')]['id']});}return _0x19283d;});}})[_0x2254('0x29')](respondWithResult(_0x4115ba,null))[_0x2254('0x49')](handleError(_0x4115ba,null));};exports[_0x2254('0x73')]=function(_0x259e10,_0x2ed18e,_0x523b10){return db['VoicePrefix'][_0x2254('0x4d')]({'where':{'id':_0x259e10[_0x2254('0x4a')]['id']}})[_0x2254('0x29')](handleEntityNotFound(_0x2ed18e,null))[_0x2254('0x29')](function(_0x3c8c99){if(_0x3c8c99){return _0x3c8c99[_0x2254('0x73')](_0x259e10[_0x2254('0x36')][_0x2254('0x70')])[_0x2254('0x29')](function(){if(_[_0x2254('0x74')](_0x259e10['query'][_0x2254('0x70')])){for(var _0x40cd61=0x0;_0x40cd61<_0x259e10['query'][_0x2254('0x70')]['length'];_0x40cd61+=0x1){socket[_0x2254('0x75')](_0x2254('0x76'),{'UserId':Number(_0x259e10['query'][_0x2254('0x70')][_0x40cd61]),'VoicePrefixId':Number(_0x259e10['params']['id'])});}}else{socket[_0x2254('0x75')](_0x2254('0x76'),{'UserId':Number(_0x259e10[_0x2254('0x36')][_0x2254('0x70')]),'VoicePrefixId':Number(_0x259e10['params']['id'])});}});}})[_0x2254('0x29')](respondWithStatusCode(_0x2ed18e,null))[_0x2254('0x49')](handleError(_0x2ed18e,null));};exports[_0x2254('0x77')]=function(_0x3a8d4f,_0x59af45,_0x177f00){var _0x480eeb={};var _0x5a3df9={};var _0x23f9ca;var _0x240c68;return db['VoicePrefix']['findOne']({'where':{'id':_0x3a8d4f[_0x2254('0x4a')]['id']}})[_0x2254('0x29')](handleEntityNotFound(_0x59af45,null))[_0x2254('0x29')](function(_0x3058d9){if(_0x3058d9){_0x23f9ca=_0x3058d9;_0x5a3df9[_0x2254('0x35')]=_[_0x2254('0x37')](db[_0x2254('0x78')][_0x2254('0x4b')]);_0x5a3df9[_0x2254('0x36')]=_['keys'](_0x3a8d4f[_0x2254('0x36')]);_0x5a3df9['filters']=_[_0x2254('0x39')](_0x5a3df9['model'],_0x5a3df9[_0x2254('0x36')]);_0x480eeb[_0x2254('0x3a')]=_[_0x2254('0x39')](_0x5a3df9['model'],qs[_0x2254('0x3b')](_0x3a8d4f[_0x2254('0x36')][_0x2254('0x3b')]));_0x480eeb[_0x2254('0x3a')]=_0x480eeb[_0x2254('0x3a')][_0x2254('0x3c')]?_0x480eeb[_0x2254('0x3a')]:_0x5a3df9[_0x2254('0x35')];_0x480eeb[_0x2254('0x3f')]=qs[_0x2254('0x40')](_0x3a8d4f[_0x2254('0x36')][_0x2254('0x40')]);_0x480eeb[_0x2254('0x41')]=qs['filters'](_[_0x2254('0x42')](_0x3a8d4f['query'],_0x5a3df9[_0x2254('0x38')]));if(_0x3a8d4f[_0x2254('0x36')][_0x2254('0x43')]){_0x480eeb[_0x2254('0x41')]=_[_0x2254('0x44')](_0x480eeb[_0x2254('0x41')],{'$or':_[_0x2254('0x30')](_0x480eeb['attributes'],function(_0x46b528){var _0x55a603={};_0x55a603[_0x46b528]={'$like':'%'+_0x3a8d4f[_0x2254('0x36')]['filter']+'%'};return _0x55a603;})});}_0x480eeb=_[_0x2254('0x44')]({},_0x480eeb,_0x3a8d4f[_0x2254('0x45')]);return _0x23f9ca[_0x2254('0x77')](_0x480eeb);}})['then'](function(_0x435bf7){if(_0x435bf7){_0x240c68=_0x435bf7[_0x2254('0x3c')];if(!_0x3a8d4f[_0x2254('0x36')][_0x2254('0x3d')](_0x2254('0x3e'))){_0x480eeb[_0x2254('0x25')]=qs[_0x2254('0x25')](_0x3a8d4f[_0x2254('0x36')]['limit']);_0x480eeb['offset']=qs[_0x2254('0x24')](_0x3a8d4f['query'][_0x2254('0x24')]);}return _0x23f9ca[_0x2254('0x77')](_0x480eeb);}})[_0x2254('0x29')](function(_0x438c95){if(_0x438c95){return _0x438c95?{'count':_0x240c68,'rows':_0x438c95}:null;}})[_0x2254('0x29')](respondWithResult(_0x59af45,null))[_0x2254('0x49')](handleError(_0x59af45,null));}; \ No newline at end of file +var _0x2484=['rows','catch','show','find','params','describe','create','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','context','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','push','CDR(prefix)=','Set','callerIdAll','goto','${EXTEN:','charAt','body','sequelize','transaction','findById','ids','omit','emit','removeAgents','userVoicePrefix:remove','findOne','rawAttributes','pick','nolimit','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','end','stack','name','send','index','map','query','keys','filters','model','attributes','intersection','fields','length','order','sort','where','filter','merge','type','options','VoicePrefix','includeAll'];(function(_0x52bdbf,_0x4d6527){var _0x5d51c8=function(_0x2975e3){while(--_0x2975e3){_0x52bdbf['push'](_0x52bdbf['shift']());}};_0x5d51c8(++_0x4d6527);}(_0x2484,0x178));var _0x4248=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x2484[_0x1f44e4];return _0x591989;};'use strict';var pdf=require(_0x4248('0x0'));var emlformat=require(_0x4248('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4248('0x2'));var jsonpatch=require(_0x4248('0x3'));var rp=require(_0x4248('0x4'));var moment=require(_0x4248('0x5'));var BPromise=require(_0x4248('0x6'));var Mustache=require(_0x4248('0x7'));var util=require(_0x4248('0x8'));var path=require('path');var sox=require(_0x4248('0x9'));var csv=require(_0x4248('0xa'));var ejs=require(_0x4248('0xb'));var fs=require('fs');var _=require(_0x4248('0xc'));var squel=require(_0x4248('0xd'));var crypto=require(_0x4248('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4248('0xf'));var toCsv=require(_0x4248('0xa'));var querystring=require(_0x4248('0x10'));var Papa=require(_0x4248('0x11'));var Redis=require(_0x4248('0x12'));var authService=require(_0x4248('0x13'));var qs=require(_0x4248('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4248('0x15'));var logger=require('../../config/logger')(_0x4248('0x16'));var utils=require(_0x4248('0x17'));var config=require(_0x4248('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4248('0x19')]=_['defaults'](config[_0x4248('0x19')],{'host':_0x4248('0x1a'),'port':0x18eb});var socket=require(_0x4248('0x1b'))(new Redis(config[_0x4248('0x19')]));require(_0x4248('0x1c'))['register'](socket);function respondWithStatusCode(_0x8b30bb,_0xada934){_0xada934=_0xada934||0xcc;return function(_0x1ae491){if(_0x1ae491){return _0x8b30bb[_0x4248('0x1d')](_0xada934);}return _0x8b30bb[_0x4248('0x1e')](_0xada934)['end']();};}function respondWithResult(_0x46cfbb,_0xe1ab31){_0xe1ab31=_0xe1ab31||0xc8;return function(_0x3283f2){if(_0x3283f2){return _0x46cfbb[_0x4248('0x1e')](_0xe1ab31)[_0x4248('0x1f')](_0x3283f2);}};}function respondWithFilteredResult(_0x321e92,_0x46fbc9){return function(_0x45edc6){if(_0x45edc6){var _0x29f080=_0x45edc6[_0x4248('0x20')],_0xd03b87=_0x46fbc9[_0x4248('0x21')],_0x2c2a0d=_0x46fbc9[_0x4248('0x21')]+_0x46fbc9[_0x4248('0x22')],_0x2f7547;if(_0x2c2a0d>=_0x29f080){_0x2c2a0d=_0x29f080;_0x2f7547=0xc8;}else{_0x2f7547=0xce;}_0x321e92[_0x4248('0x1e')](_0x2f7547);return _0x321e92[_0x4248('0x23')]('Content-Range',_0xd03b87+'-'+_0x2c2a0d+'/'+_0x29f080)[_0x4248('0x1f')](_0x45edc6);}return null;};}function patchUpdates(_0x2e7d6e){return function(_0x2d674b){try{jsonpatch[_0x4248('0x24')](_0x2d674b,_0x2e7d6e,!![]);}catch(_0x4b6c12){return BPromise[_0x4248('0x25')](_0x4b6c12);}return _0x2d674b[_0x4248('0x26')]();};}function saveUpdates(_0x30b232,_0x57ce09){return function(_0x45b777){if(_0x45b777){return _0x45b777[_0x4248('0x27')](_0x30b232)['then'](function(_0x3bfcf2){return _0x3bfcf2;});}return null;};}function removeEntity(_0x598681,_0x18070b){return function(_0x138ac1){if(_0x138ac1){return _0x138ac1[_0x4248('0x28')]()[_0x4248('0x29')](function(){var _0x5a3938=_0x138ac1[_0x4248('0x2a')]({'plain':!![]});var _0x205382=_0x4248('0x2b');return db[_0x4248('0x2c')][_0x4248('0x28')]({'where':{'type':_0x205382,'resourceId':_0x5a3938['id']}})[_0x4248('0x29')](function(){return _0x138ac1;});})[_0x4248('0x29')](function(){_0x598681[_0x4248('0x1e')](0xcc)[_0x4248('0x2d')]();});}};}function handleEntityNotFound(_0x1f26be,_0x3b29fe){return function(_0x45e678){if(!_0x45e678){_0x1f26be[_0x4248('0x1d')](0x194);}return _0x45e678;};}function handleError(_0xf72ecc,_0xf06a1a){_0xf06a1a=_0xf06a1a||0x1f4;return function(_0x439859){logger['error'](_0x439859[_0x4248('0x2e')]);if(_0x439859[_0x4248('0x2f')]){delete _0x439859[_0x4248('0x2f')];}_0xf72ecc['status'](_0xf06a1a)[_0x4248('0x30')](_0x439859);};}exports[_0x4248('0x31')]=function(_0x5654f5,_0x45dd44){var _0x53294f={},_0x3d6bef={},_0xf8e412={'count':0x0,'rows':[]};var _0x51a1bc=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x5c2d98){return{'name':_0x5c2d98['fieldName'],'type':_0x5c2d98['type']['key']};});_0x3d6bef['model']=_[_0x4248('0x32')](_0x51a1bc,_0x4248('0x2f'));_0x3d6bef[_0x4248('0x33')]=_[_0x4248('0x34')](_0x5654f5['query']);_0x3d6bef[_0x4248('0x35')]=_['intersection'](_0x3d6bef[_0x4248('0x36')],_0x3d6bef[_0x4248('0x33')]);_0x53294f[_0x4248('0x37')]=_[_0x4248('0x38')](_0x3d6bef['model'],qs['fields'](_0x5654f5[_0x4248('0x33')][_0x4248('0x39')]));_0x53294f[_0x4248('0x37')]=_0x53294f[_0x4248('0x37')][_0x4248('0x3a')]?_0x53294f[_0x4248('0x37')]:_0x3d6bef[_0x4248('0x36')];if(!_0x5654f5[_0x4248('0x33')]['hasOwnProperty']('nolimit')){_0x53294f['limit']=qs[_0x4248('0x22')](_0x5654f5['query'][_0x4248('0x22')]);_0x53294f[_0x4248('0x21')]=qs[_0x4248('0x21')](_0x5654f5[_0x4248('0x33')][_0x4248('0x21')]);}_0x53294f[_0x4248('0x3b')]=qs[_0x4248('0x3c')](_0x5654f5[_0x4248('0x33')]['sort']);_0x53294f[_0x4248('0x3d')]=qs[_0x4248('0x35')](_['pick'](_0x5654f5[_0x4248('0x33')],_0x3d6bef[_0x4248('0x35')]),_0x51a1bc);if(_0x5654f5['query'][_0x4248('0x3e')]){_0x53294f[_0x4248('0x3d')]=_[_0x4248('0x3f')](_0x53294f[_0x4248('0x3d')],{'$or':_[_0x4248('0x32')](_0x51a1bc,function(_0x5e2f54){if(_0x5e2f54[_0x4248('0x40')]!=='VIRTUAL'){var _0x5ef913={};_0x5ef913[_0x5e2f54[_0x4248('0x2f')]]={'$like':'%'+_0x5654f5[_0x4248('0x33')][_0x4248('0x3e')]+'%'};return _0x5ef913;}})});}_0x53294f=_[_0x4248('0x3f')]({},_0x53294f,_0x5654f5[_0x4248('0x41')]);var _0x242ee6={'where':_0x53294f[_0x4248('0x3d')]};return db[_0x4248('0x42')][_0x4248('0x20')](_0x242ee6)[_0x4248('0x29')](function(_0x53ee5e){_0xf8e412[_0x4248('0x20')]=_0x53ee5e;if(_0x5654f5[_0x4248('0x33')][_0x4248('0x43')]){_0x53294f['include']=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x53294f);})[_0x4248('0x29')](function(_0x6988fb){_0xf8e412[_0x4248('0x44')]=_0x6988fb;return _0xf8e412;})[_0x4248('0x29')](respondWithFilteredResult(_0x45dd44,_0x53294f))[_0x4248('0x45')](handleError(_0x45dd44,null));};exports[_0x4248('0x46')]=function(_0x5bbe59,_0x3073f1){var _0x35a360={'raw':![],'where':{'id':_0x5bbe59['params']['id']}},_0x32bc46={};_0x32bc46[_0x4248('0x36')]=_[_0x4248('0x34')](db[_0x4248('0x42')]['rawAttributes']);_0x32bc46['query']=_[_0x4248('0x34')](_0x5bbe59[_0x4248('0x33')]);_0x32bc46[_0x4248('0x35')]=_[_0x4248('0x38')](_0x32bc46['model'],_0x32bc46[_0x4248('0x33')]);_0x35a360[_0x4248('0x37')]=_['intersection'](_0x32bc46[_0x4248('0x36')],qs['fields'](_0x5bbe59[_0x4248('0x33')][_0x4248('0x39')]));_0x35a360['attributes']=_0x35a360[_0x4248('0x37')]['length']?_0x35a360[_0x4248('0x37')]:_0x32bc46[_0x4248('0x36')];if(_0x5bbe59[_0x4248('0x33')][_0x4248('0x43')]){_0x35a360['include']=[{'all':!![]}];}_0x35a360=_['merge']({},_0x35a360,_0x5bbe59['options']);return db[_0x4248('0x42')][_0x4248('0x47')](_0x35a360)[_0x4248('0x29')](handleEntityNotFound(_0x3073f1,null))[_0x4248('0x29')](respondWithResult(_0x3073f1,null))['catch'](handleError(_0x3073f1,null));};exports[_0x4248('0x28')]=function(_0x2e9a5c,_0x79919){return db[_0x4248('0x42')]['find']({'where':{'id':_0x2e9a5c[_0x4248('0x48')]['id']}})[_0x4248('0x29')](handleEntityNotFound(_0x79919,null))[_0x4248('0x29')](removeEntity(_0x79919,null))[_0x4248('0x45')](handleError(_0x79919,null));};exports[_0x4248('0x49')]=function(_0x91f37e,_0x2680ad){return db[_0x4248('0x42')][_0x4248('0x49')]()['then'](respondWithResult(_0x2680ad,null))[_0x4248('0x45')](handleError(_0x2680ad,null));};exports[_0x4248('0x4a')]=function(_0x449760,_0x2283c6){var _0x468e11;return db['sequelize']['transaction'](function(_0x27e3a5){return db[_0x4248('0x42')][_0x4248('0x4a')](_0x449760['body'],{'transaction':_0x27e3a5})['then'](function(_0x1759bb){_0x468e11=_0x1759bb[_0x4248('0x2a')]({'plain':!![]});return db[_0x4248('0x4b')][_0x4248('0x47')]({'where':{'id':_0x468e11[_0x4248('0x4c')]},'raw':!![]})[_0x4248('0x29')](function(_0x273367){return createVoicePrefixExtensions(_0x468e11,_0x273367,_0x27e3a5);});});})['then'](function(){var _0x577657=_0x449760[_0x4248('0x4d')][_0x4248('0x2a')]({'plain':!![]});if(!_0x577657)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x577657[_0x4248('0x4e')]===_0x4248('0x4d')){var _0x5711b3=_0x468e11;return db[_0x4248('0x4f')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x577657[_0x4248('0x50')]},'raw':!![]})[_0x4248('0x29')](function(_0x2b25d1){if(_0x2b25d1&&_0x2b25d1[_0x4248('0x51')]===0x0){return db[_0x4248('0x2c')]['create']({'name':_0x5711b3['name'],'resourceId':_0x5711b3['id'],'type':_0x2b25d1[_0x4248('0x2f')],'sectionId':_0x2b25d1['id']},{})['then'](function(){return _0x468e11;});}else{return _0x468e11;}})[_0x4248('0x45')](function(_0x406d51){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x406d51);throw _0x406d51;});}return _0x468e11;})['then'](respondWithResult(_0x2283c6,null))[_0x4248('0x45')](handleError(_0x2283c6,null));};function Extension(_0x8b5f45,_0x3762a3,_0x26ba5a,_0x7fd6){this[_0x4248('0x52')]='from-sip';this[_0x4248('0x53')]=_0x8b5f45;this['app']=_0x26ba5a;this[_0x4248('0x40')]='system';this[_0x4248('0x54')]=_0x4248('0x55');this[_0x4248('0x56')]=_0x3762a3;this['appdata']=_0x7fd6;}function createVoicePrefixExtensions(_0x5f3f67,_0x57bded,_0x4bd6e3){return new BPromise(function(_0x2b4e90,_0x5d7366){var _0x47e5af=new Extension(formatPrefixName(_0x5f3f67[_0x4248('0x57')]),0x1,_0x4248('0x58'),'Voice\x20Prefix');_0x47e5af[_0x4248('0x59')]=_0x5f3f67['id'];return db['VoiceExtension'][_0x4248('0x4a')](_0x47e5af,{'transaction':_0x4bd6e3})[_0x4248('0x29')](function(_0x502de8){var _0x3c3f95=_0x502de8['get']({'plain':!![]});var _0xdc0fdc=_[_0x4248('0x32')](addVoicePrefixExtensions(_0x5f3f67,_0x57bded),function(_0xa30ddf){_0xa30ddf[_0x4248('0x4c')]=_0x3c3f95['id'];_0xa30ddf['VoicePrefixId']=_0x5f3f67['id'];return _0xa30ddf;});return db[_0x4248('0x4b')]['bulkCreate'](_0xdc0fdc,{'transaction':_0x4bd6e3})['then'](function(_0x1e7e51){if(!_0x1e7e51){return _0x5d7366('Extensions\x20creation\x20failed');}else{return _0x2b4e90(_0x1e7e51);}})[_0x4248('0x45')](function(_0x211b3f){return _0x5d7366(_0x211b3f);});});;});};function addVoicePrefixExtensions(_0x1dba00,_0x49d730){var _0x423ae8=[];var _0x2df96c=formatPrefixName(_0x1dba00[_0x4248('0x57')]);_0x423ae8[_0x4248('0x5a')](new Extension(_0x2df96c,0x2,'Set',_0x4248('0x5b')+_0x1dba00[_0x4248('0x2f')]));if(_0x1dba00['callerIdAll']){_0x423ae8[_0x4248('0x5a')](new Extension(_0x2df96c,0x3,_0x4248('0x5c'),'PREFIX-CALLERIDALL='+_0x1dba00[_0x4248('0x5d')]));}else{_0x423ae8[_0x4248('0x5a')](new Extension(_0x2df96c,0x3,_0x4248('0x58'),'No\x20callerid\x20available'));}_0x423ae8['push'](new Extension(_0x2df96c,0x4,_0x4248('0x5e'),_0x49d730[_0x4248('0x52')]+','+_0x4248('0x5f')+(0x8+_0x1dba00[_0x4248('0x2f')][_0x4248('0x3a')])+'}'+','+0x1));return _0x423ae8;}function formatPrefixName(_0xc1594e){var _0x18e1de='_';for(var _0x14b714=0x0;_0x14b714<_0xc1594e[_0x4248('0x3a')];_0x14b714++){if(_0xc1594e[_0x4248('0x60')](_0x14b714)=='-'){_0x18e1de+=_0xc1594e[_0x4248('0x60')](_0x14b714);}else{_0x18e1de+='['+_0xc1594e[_0x4248('0x60')](_0x14b714)+']';}}_0x18e1de+='.';return _0x18e1de;}exports[_0x4248('0x27')]=function(_0x16ab26,_0xe743a6,_0x432383){var _0x2e53b4=_0x16ab26[_0x4248('0x61')];_0x2e53b4['prefix']='system-'+_0x2e53b4[_0x4248('0x2f')]+'-';return db[_0x4248('0x62')][_0x4248('0x63')](function(_0x4d93b0){return db['VoicePrefix']['update'](_0x2e53b4,{'where':{'id':_0x2e53b4['id']},'transaction':_0x4d93b0})[_0x4248('0x29')](function(){return db['VoiceExtension'][_0x4248('0x28')]({'where':{'VoicePrefixId':_0x2e53b4['id']},'transaction':_0x4d93b0})[_0x4248('0x29')](function(){return db[_0x4248('0x4b')]['find']({'where':{'id':_0x2e53b4[_0x4248('0x4c')]},'raw':!![]})[_0x4248('0x29')](function(_0x259666){return createVoicePrefixExtensions(_0x2e53b4,_0x259666,_0x4d93b0);});});});})[_0x4248('0x29')](function(){return db[_0x4248('0x42')][_0x4248('0x64')](_0x2e53b4['id']);})[_0x4248('0x29')](respondWithResult(_0xe743a6,null))[_0x4248('0x45')](handleError(_0xe743a6,null));};exports['addAgents']=function(_0xd4325e,_0x3c5b3d,_0x37dc61){return db['VoicePrefix'][_0x4248('0x47')]({'where':{'id':_0xd4325e[_0x4248('0x48')]['id']}})[_0x4248('0x29')](handleEntityNotFound(_0x3c5b3d,null))[_0x4248('0x29')](function(_0x6ce29){if(_0x6ce29){return _0x6ce29['addAgents'](_0xd4325e[_0x4248('0x61')][_0x4248('0x65')],_[_0x4248('0x66')](_0xd4325e[_0x4248('0x61')],[_0x4248('0x65'),'id'])||{})['spread'](function(_0x5a5508){for(var _0xcfc0a8=0x0;_0xcfc0a8<_0xd4325e[_0x4248('0x61')][_0x4248('0x65')]['length'];_0xcfc0a8+=0x1){socket[_0x4248('0x67')]('userVoicePrefix:save',{'UserId':_0xd4325e[_0x4248('0x61')]['ids'][_0xcfc0a8],'VoicePrefixId':_0xd4325e['params']['id']});}return _0x5a5508;});}})[_0x4248('0x29')](respondWithResult(_0x3c5b3d,null))[_0x4248('0x45')](handleError(_0x3c5b3d,null));};exports[_0x4248('0x68')]=function(_0x4638de,_0x4e4d43,_0x3bd1ad){return db[_0x4248('0x42')][_0x4248('0x47')]({'where':{'id':_0x4638de[_0x4248('0x48')]['id']}})[_0x4248('0x29')](handleEntityNotFound(_0x4e4d43,null))[_0x4248('0x29')](function(_0x361636){if(_0x361636){return _0x361636[_0x4248('0x68')](_0x4638de[_0x4248('0x33')][_0x4248('0x65')])[_0x4248('0x29')](function(){if(_['isArray'](_0x4638de[_0x4248('0x33')][_0x4248('0x65')])){for(var _0x2b8126=0x0;_0x2b8126<_0x4638de['query']['ids'][_0x4248('0x3a')];_0x2b8126+=0x1){socket[_0x4248('0x67')](_0x4248('0x69'),{'UserId':Number(_0x4638de[_0x4248('0x33')][_0x4248('0x65')][_0x2b8126]),'VoicePrefixId':Number(_0x4638de[_0x4248('0x48')]['id'])});}}else{socket['emit'](_0x4248('0x69'),{'UserId':Number(_0x4638de[_0x4248('0x33')][_0x4248('0x65')]),'VoicePrefixId':Number(_0x4638de['params']['id'])});}});}})[_0x4248('0x29')](respondWithStatusCode(_0x4e4d43,null))[_0x4248('0x45')](handleError(_0x4e4d43,null));};exports['getAgents']=function(_0x449cda,_0x5b3686,_0x2b2f29){var _0x4a1d37={};var _0xdcc91f={};var _0x5e9036;var _0x62683;return db[_0x4248('0x42')][_0x4248('0x6a')]({'where':{'id':_0x449cda[_0x4248('0x48')]['id']}})[_0x4248('0x29')](handleEntityNotFound(_0x5b3686,null))[_0x4248('0x29')](function(_0x124054){if(_0x124054){_0x5e9036=_0x124054;_0xdcc91f[_0x4248('0x36')]=_['keys'](db['User'][_0x4248('0x6b')]);_0xdcc91f[_0x4248('0x33')]=_[_0x4248('0x34')](_0x449cda[_0x4248('0x33')]);_0xdcc91f[_0x4248('0x35')]=_[_0x4248('0x38')](_0xdcc91f[_0x4248('0x36')],_0xdcc91f['query']);_0x4a1d37[_0x4248('0x37')]=_[_0x4248('0x38')](_0xdcc91f[_0x4248('0x36')],qs[_0x4248('0x39')](_0x449cda[_0x4248('0x33')][_0x4248('0x39')]));_0x4a1d37[_0x4248('0x37')]=_0x4a1d37[_0x4248('0x37')]['length']?_0x4a1d37[_0x4248('0x37')]:_0xdcc91f[_0x4248('0x36')];_0x4a1d37[_0x4248('0x3b')]=qs[_0x4248('0x3c')](_0x449cda[_0x4248('0x33')][_0x4248('0x3c')]);_0x4a1d37[_0x4248('0x3d')]=qs['filters'](_[_0x4248('0x6c')](_0x449cda[_0x4248('0x33')],_0xdcc91f[_0x4248('0x35')]));if(_0x449cda[_0x4248('0x33')][_0x4248('0x3e')]){_0x4a1d37[_0x4248('0x3d')]=_[_0x4248('0x3f')](_0x4a1d37[_0x4248('0x3d')],{'$or':_[_0x4248('0x32')](_0x4a1d37['attributes'],function(_0x187ebd){var _0x474923={};_0x474923[_0x187ebd]={'$like':'%'+_0x449cda[_0x4248('0x33')][_0x4248('0x3e')]+'%'};return _0x474923;})});}_0x4a1d37=_['merge']({},_0x4a1d37,_0x449cda['options']);return _0x5e9036['getAgents'](_0x4a1d37);}})[_0x4248('0x29')](function(_0x36f9ea){if(_0x36f9ea){_0x62683=_0x36f9ea[_0x4248('0x3a')];if(!_0x449cda[_0x4248('0x33')]['hasOwnProperty'](_0x4248('0x6d'))){_0x4a1d37[_0x4248('0x22')]=qs[_0x4248('0x22')](_0x449cda['query'][_0x4248('0x22')]);_0x4a1d37[_0x4248('0x21')]=qs['offset'](_0x449cda['query']['offset']);}return _0x5e9036[_0x4248('0x6e')](_0x4a1d37);}})[_0x4248('0x29')](function(_0x5cb424){if(_0x5cb424){return _0x5cb424?{'count':_0x62683,'rows':_0x5cb424}:null;}})[_0x4248('0x29')](respondWithResult(_0x5b3686,null))[_0x4248('0x45')](handleError(_0x5b3686,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5cd291b..0b7282e 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x95c988,_0x52065a){var _0x1c90fa=function(_0x4cac6f){while(--_0x4cac6f){_0x95c988['push'](_0x95c988['shift']());}};_0x1c90fa(++_0x52065a);}(_0x70e0,0x17b));var _0x070e=function(_0x225114,_0x511719){_0x225114=_0x225114-0x0;var _0x2bb3a2=_0x70e0[_0x225114];return _0x2bb3a2;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x447924,_0x1a6ce7){_0x447924=_0x447924-0x0;var _0x10550d=_0x3e74[_0x447924];return _0x10550d;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){VoicePrefixEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);VoicePrefixEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index bdd7ec9..4274cf2 100644 --- a/server/api/voicePrefix/voicePrefix.model.js +++ b/server/api/voicePrefix/voicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb66e=['rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','bluebird','request-promise','path'];(function(_0x402aa8,_0x3bb440){var _0xf6a0ab=function(_0x2d4b12){while(--_0x2d4b12){_0x402aa8['push'](_0x402aa8['shift']());}};_0xf6a0ab(++_0x3bb440);}(_0xb66e,0xc5));var _0xeb66=function(_0x1dbbce,_0x48410a){_0x1dbbce=_0x1dbbce-0x0;var _0x30b20d=_0xb66e[_0x1dbbce];return _0x30b20d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xeb66('0x0'));var rp=require(_0xeb66('0x1'));var fs=require('fs');var path=require(_0xeb66('0x2'));var rimraf=require(_0xeb66('0x3'));var config=require(_0xeb66('0x4'));var attributes=require(_0xeb66('0x5'));module[_0xeb66('0x6')]=function(_0x2411aa,_0x2f4a7a){return _0x2411aa[_0xeb66('0x7')](_0xeb66('0x8'),attributes,{'tableName':_0xeb66('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f93=['voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','VoicePrefix'];(function(_0x3bf8a2,_0x4d8a4a){var _0x136e4e=function(_0xc2c82f){while(--_0xc2c82f){_0x3bf8a2['push'](_0x3bf8a2['shift']());}};_0x136e4e(++_0x4d8a4a);}(_0x2f93,0x85));var _0x32f9=function(_0x411a23,_0x2c019f){_0x411a23=_0x411a23-0x0;var _0x177b05=_0x2f93[_0x411a23];return _0x177b05;};'use strict';var _=require(_0x32f9('0x0'));var util=require(_0x32f9('0x1'));var logger=require(_0x32f9('0x2'))(_0x32f9('0x3'));var moment=require(_0x32f9('0x4'));var BPromise=require(_0x32f9('0x5'));var rp=require(_0x32f9('0x6'));var fs=require('fs');var path=require(_0x32f9('0x7'));var rimraf=require('rimraf');var config=require(_0x32f9('0x8'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x24b3dc,_0x2ac287){return _0x24b3dc[_0x32f9('0x9')](_0x32f9('0xa'),attributes,{'tableName':_0x32f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 14e1fdb..00d57c2 100644 --- a/server/api/voicePrefix/voicePrefix.rpc.js +++ b/server/api/voicePrefix/voicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb9e=['jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xdb9e,0x1ee));var _0xedb9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb9e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xedb9('0x0'));var util=require(_0xedb9('0x1'));var moment=require(_0xedb9('0x2'));var BPromise=require(_0xedb9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedb9('0x4'));var db=require(_0xedb9('0x5'))['db'];var utils=require(_0xedb9('0x6'));var logger=require(_0xedb9('0x7'))(_0xedb9('0x8'));var config=require(_0xedb9('0x9'));var jayson=require(_0xedb9('0xa'));var client=jayson[_0xedb9('0xb')][_0xedb9('0xc')]({'port':0x232a});config[_0xedb9('0xd')]=_[_0xedb9('0xe')](config[_0xedb9('0xd')],{'host':_0xedb9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedb9('0xd')]));require(_0xedb9('0x10'))[_0xedb9('0x11')](socket);function respondWithRpcPromise(_0x1bae33,_0x21490f,_0xd6137f){return new BPromise(function(_0x255881,_0x49e43f){return client[_0xedb9('0x12')](_0x1bae33,_0xd6137f)['then'](function(_0x5dbcc4){logger[_0xedb9('0x13')](_0xedb9('0x14'),_0x21490f,_0xedb9('0x15'));logger['debug'](_0xedb9('0x16'),_0x21490f,'request\x20sent',JSON[_0xedb9('0x17')](_0x5dbcc4));if(_0x5dbcc4[_0xedb9('0x18')]){if(_0x5dbcc4[_0xedb9('0x18')][_0xedb9('0x19')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x21490f,_0x5dbcc4['error']['message']);return _0x49e43f(_0x5dbcc4[_0xedb9('0x18')]['message']);}logger[_0xedb9('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x21490f,_0x5dbcc4[_0xedb9('0x18')][_0xedb9('0x1a')]);return _0x255881(_0x5dbcc4[_0xedb9('0x18')][_0xedb9('0x1a')]);}else{logger['info'](_0xedb9('0x14'),_0x21490f,_0xedb9('0x15'));_0x255881(_0x5dbcc4['result'][_0xedb9('0x1a')]);}})[_0xedb9('0x1b')](function(_0x24880b){logger[_0xedb9('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x21490f,_0x24880b);_0x49e43f(_0x24880b);});});} \ No newline at end of file +var _0x1ca2=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x1ca2,0x182));var _0x21ca=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x1ca2[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x21ca('0x0'));var util=require('util');var moment=require(_0x21ca('0x1'));var BPromise=require(_0x21ca('0x2'));var rs=require(_0x21ca('0x3'));var fs=require('fs');var Redis=require(_0x21ca('0x4'));var db=require(_0x21ca('0x5'))['db'];var utils=require(_0x21ca('0x6'));var logger=require('../../config/logger')(_0x21ca('0x7'));var config=require(_0x21ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21ca('0x9')][_0x21ca('0xa')]({'port':0x232a});config['redis']=_[_0x21ca('0xb')](config[_0x21ca('0xc')],{'host':_0x21ca('0xd'),'port':0x18eb});var socket=require(_0x21ca('0xe'))(new Redis(config['redis']));require(_0x21ca('0xf'))[_0x21ca('0x10')](socket);function respondWithRpcPromise(_0x586c4d,_0x48c1b6,_0x137d3f){return new BPromise(function(_0x1bede1,_0x1450f3){return client[_0x21ca('0x11')](_0x586c4d,_0x137d3f)[_0x21ca('0x12')](function(_0x39175c){logger['info'](_0x21ca('0x13'),_0x48c1b6,'request\x20sent');logger[_0x21ca('0x14')](_0x21ca('0x15'),_0x48c1b6,_0x21ca('0x16'),JSON[_0x21ca('0x17')](_0x39175c));if(_0x39175c[_0x21ca('0x18')]){if(_0x39175c['error'][_0x21ca('0x19')]===0x1f4){logger[_0x21ca('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x48c1b6,_0x39175c[_0x21ca('0x18')]['message']);return _0x1450f3(_0x39175c[_0x21ca('0x18')][_0x21ca('0x1a')]);}logger[_0x21ca('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x48c1b6,_0x39175c[_0x21ca('0x18')][_0x21ca('0x1a')]);return _0x1bede1(_0x39175c[_0x21ca('0x18')][_0x21ca('0x1a')]);}else{logger['info'](_0x21ca('0x13'),_0x48c1b6,_0x21ca('0x16'));_0x1bede1(_0x39175c[_0x21ca('0x1b')][_0x21ca('0x1a')]);}})[_0x21ca('0x1c')](function(_0x1eb230){logger[_0x21ca('0x18')](_0x21ca('0x13'),_0x48c1b6,_0x1eb230);_0x1450f3(_0x1eb230);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1356050..85f19ea 100644 --- a/server/api/voicePrefix/voicePrefix.socket.js +++ b/server/api/voicePrefix/voicePrefix.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3970=['remove','update','emit','register','length'];(function(_0x56ffb8,_0x1f24a8){var _0x490974=function(_0x39ed54){while(--_0x39ed54){_0x56ffb8['push'](_0x56ffb8['shift']());}};_0x490974(++_0x1f24a8);}(_0x3970,0x96));var _0x0397=function(_0x44d869,_0x49425f){_0x44d869=_0x44d869-0x0;var _0x1ed521=_0x3970[_0x44d869];return _0x1ed521;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x0397('0x0'),_0x0397('0x1')];function createListener(_0xcdbf,_0x360ea6){return function(_0x14de84){_0x360ea6[_0x0397('0x2')](_0xcdbf,_0x14de84);};}function removeListener(_0x36b007,_0x117913){return function(){VoicePrefixEvents['removeListener'](_0x36b007,_0x117913);};}exports[_0x0397('0x3')]=function(_0x522718){for(var _0xb66208=0x0,_0x1837aa=events[_0x0397('0x4')];_0xb66208<_0x1837aa;_0xb66208++){var _0x3a307b=events[_0xb66208];var _0x1c33e4=createListener('voicePrefix:'+_0x3a307b,_0x522718);VoicePrefixEvents['on'](_0x3a307b,_0x1c33e4);}}; \ No newline at end of file +var _0xf749=['update','emit','removeListener','register','./voicePrefix.events','save','remove'];(function(_0x448255,_0x2e681d){var _0x55d7ec=function(_0x52434e){while(--_0x52434e){_0x448255['push'](_0x448255['shift']());}};_0x55d7ec(++_0x2e681d);}(_0xf749,0xe4));var _0x9f74=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf749[_0x2c91e9];return _0x13f0ff;};'use strict';var VoicePrefixEvents=require(_0x9f74('0x0'));var events=[_0x9f74('0x1'),_0x9f74('0x2'),_0x9f74('0x3')];function createListener(_0x371c67,_0x53d271){return function(_0x1ace9b){_0x53d271[_0x9f74('0x4')](_0x371c67,_0x1ace9b);};}function removeListener(_0xa35def,_0x44b3e4){return function(){VoicePrefixEvents[_0x9f74('0x5')](_0xa35def,_0x44b3e4);};}exports[_0x9f74('0x6')]=function(_0x4667f2){for(var _0x1965f7=0x0,_0x55f059=events['length'];_0x1965f7<_0x55f059;_0x1965f7++){var _0x31906e=events[_0x1965f7];var _0x441d71=createListener('voicePrefix:'+_0x31906e,_0x4667f2);VoicePrefixEvents['on'](_0x31906e,_0x441d71);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 2936fe8..f1d67b9 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc911=['destroy','/:id/users','removeAgents','removeBlackLists','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','get','/:id','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','addTeams','addLists','addBlackLists','put','delete'];(function(_0x555938,_0x4b849e){var _0x21a35f=function(_0x148777){while(--_0x148777){_0x555938['push'](_0x555938['shift']());}};_0x21a35f(++_0x4b849e);}(_0xc911,0x10e));var _0x1c91=function(_0x4d8bc1,_0xad5dc5){_0x4d8bc1=_0x4d8bc1-0x0;var _0x5c1583=_0xc911[_0x4d8bc1];return _0x5c1583;};'use strict';var multer=require(_0x1c91('0x0'));var util=require(_0x1c91('0x1'));var path=require(_0x1c91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1c91('0x3')]();var auth=require(_0x1c91('0x4'));var interaction=require(_0x1c91('0x5'));var config=require(_0x1c91('0x6'));var controller=require(_0x1c91('0x7'));router['get']('/',auth[_0x1c91('0x8')](),controller[_0x1c91('0x9')]);router[_0x1c91('0xa')](_0x1c91('0xb'),auth[_0x1c91('0x8')](),controller['show']);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x1c91('0xc')]);router[_0x1c91('0xa')](_0x1c91('0xd'),auth[_0x1c91('0x8')](),controller[_0x1c91('0xe')]);router['get'](_0x1c91('0xf'),auth['isAuthenticated'](),controller[_0x1c91('0x10')]);router['get'](_0x1c91('0x11'),auth[_0x1c91('0x8')](),controller['getHopperBlacks']);router[_0x1c91('0xa')](_0x1c91('0x12'),auth[_0x1c91('0x8')](),controller[_0x1c91('0x13')]);router['get']('/:id/users',auth[_0x1c91('0x8')](),controller[_0x1c91('0x14')]);router[_0x1c91('0xa')](_0x1c91('0x15'),auth['isAuthenticated'](),controller[_0x1c91('0x16')]);router[_0x1c91('0xa')](_0x1c91('0x17'),auth[_0x1c91('0x8')](),controller[_0x1c91('0x18')]);router[_0x1c91('0xa')](_0x1c91('0x19'),auth[_0x1c91('0x8')](),controller['getBlackLists']);router[_0x1c91('0x1a')]('/',auth[_0x1c91('0x8')](),controller['create']);router['post'](_0x1c91('0x1b'),auth['isAuthenticated'](),controller[_0x1c91('0x1c')]);router[_0x1c91('0x1a')](_0x1c91('0x12'),auth['isAuthenticated'](),controller[_0x1c91('0x1d')]);router[_0x1c91('0x1a')]('/:id/users',auth[_0x1c91('0x8')](),controller['addAgents']);router[_0x1c91('0x1a')]('/:id/lists',auth[_0x1c91('0x8')](),controller[_0x1c91('0x1e')]);router[_0x1c91('0x1a')]('/:id/blacklists',auth[_0x1c91('0x8')](),controller[_0x1c91('0x1f')]);router[_0x1c91('0x20')](_0x1c91('0xb'),auth[_0x1c91('0x8')](),controller['update']);router[_0x1c91('0x21')](_0x1c91('0xb'),auth[_0x1c91('0x8')](),controller[_0x1c91('0x22')]);router['delete'](_0x1c91('0x12'),auth[_0x1c91('0x8')](),controller['removeTeams']);router[_0x1c91('0x21')](_0x1c91('0x23'),auth[_0x1c91('0x8')](),controller[_0x1c91('0x24')]);router[_0x1c91('0x21')](_0x1c91('0x17'),auth['isAuthenticated'](),controller['removeLists']);router[_0x1c91('0x21')](_0x1c91('0x19'),auth[_0x1c91('0x8')](),controller[_0x1c91('0x25')]);module['exports']=router; \ No newline at end of file +var _0xbff3=['getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','getBlackLists','/:id/clone','post','/:id/teams','addTeams','addAgents','addBlackLists','put','/:id','update','destroy','removeTeams','delete','removeAgents','removeBlackLists','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers'];(function(_0x26dd67,_0x3aa68c){var _0x1621eb=function(_0x15e23c){while(--_0x15e23c){_0x26dd67['push'](_0x26dd67['shift']());}};_0x1621eb(++_0x3aa68c);}(_0xbff3,0x18e));var _0x3bff=function(_0x1f2089,_0x584aad){_0x1f2089=_0x1f2089-0x0;var _0x2d74cd=_0xbff3[_0x1f2089];return _0x2d74cd;};'use strict';var multer=require('multer');var util=require(_0x3bff('0x0'));var path=require('path');var timeout=require(_0x3bff('0x1'));var express=require(_0x3bff('0x2'));var router=express[_0x3bff('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3bff('0x4'));var config=require(_0x3bff('0x5'));var controller=require(_0x3bff('0x6'));router[_0x3bff('0x7')]('/',auth[_0x3bff('0x8')](),controller[_0x3bff('0x9')]);router[_0x3bff('0x7')]('/:id',auth[_0x3bff('0x8')](),controller[_0x3bff('0xa')]);router['get'](_0x3bff('0xb'),auth['isAuthenticated'](),controller[_0x3bff('0xc')]);router[_0x3bff('0x7')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x3bff('0xd')]);router[_0x3bff('0x7')](_0x3bff('0xe'),auth[_0x3bff('0x8')](),controller[_0x3bff('0xf')]);router['get'](_0x3bff('0x10'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x11')]);router[_0x3bff('0x7')]('/:id/teams',auth[_0x3bff('0x8')](),controller[_0x3bff('0x12')]);router[_0x3bff('0x7')](_0x3bff('0x13'),auth['isAuthenticated'](),controller[_0x3bff('0x14')]);router[_0x3bff('0x7')](_0x3bff('0x15'),auth[_0x3bff('0x8')](),controller['getMembers']);router[_0x3bff('0x7')](_0x3bff('0x16'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x17')]);router['get'](_0x3bff('0x18'),auth['isAuthenticated'](),controller[_0x3bff('0x19')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3bff('0x1a'),auth['isAuthenticated'](),controller['clone']);router[_0x3bff('0x1b')](_0x3bff('0x1c'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x1d')]);router[_0x3bff('0x1b')](_0x3bff('0x13'),auth['isAuthenticated'](),controller[_0x3bff('0x1e')]);router[_0x3bff('0x1b')](_0x3bff('0x16'),auth[_0x3bff('0x8')](),controller['addLists']);router['post'](_0x3bff('0x18'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x1f')]);router[_0x3bff('0x20')](_0x3bff('0x21'),auth['isAuthenticated'](),controller[_0x3bff('0x22')]);router['delete'](_0x3bff('0x21'),auth['isAuthenticated'](),controller[_0x3bff('0x23')]);router['delete'](_0x3bff('0x1c'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x24')]);router[_0x3bff('0x25')](_0x3bff('0x13'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x26')]);router['delete'](_0x3bff('0x16'),auth[_0x3bff('0x8')](),controller['removeLists']);router[_0x3bff('0x25')](_0x3bff('0x18'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x27')]);module[_0x3bff('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 18d5bef..96f0552 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x4f3579,_0x22c620){var _0x166fdc=function(_0x219baf){while(--_0x219baf){_0x4f3579['push'](_0x4f3579['shift']());}};_0x166fdc(++_0x22c620);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x583745,_0x2d1897){var _0x4ba020=function(_0x288616){while(--_0x288616){_0x583745['push'](_0x583745['shift']());}};_0x4ba020(++_0x2d1897);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index df3d6e5..6871cf7 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc09=['VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','findAll','rows','catch','show','params','length','include','find','create','body','role','user','userProfileId','autoAssociation','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','order','options','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','flatMap','forEach','penalty','transaction','each','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','SIP/%s','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','all','union','compact','removeTeams','isEmpty','UserVoiceQueueRt','emit','addAgents','spread','push','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','insert','CmListId','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get'];(function(_0x539f98,_0x4ec63b){var _0x186a39=function(_0x1c2811){while(--_0x1c2811){_0x539f98['push'](_0x539f98['shift']());}};_0x186a39(++_0x4ec63b);}(_0xbc09,0x148));var _0x9bc0=function(_0x2db45c,_0x3e2eb4){_0x2db45c=_0x2db45c-0x0;var _0x3e23e1=_0xbc09[_0x2db45c];return _0x3e23e1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9bc0('0x0'));var rimraf=require(_0x9bc0('0x1'));var zipdir=require(_0x9bc0('0x2'));var jsonpatch=require(_0x9bc0('0x3'));var rp=require('request-promise');var moment=require(_0x9bc0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9bc0('0x5'));var util=require(_0x9bc0('0x6'));var path=require(_0x9bc0('0x7'));var sox=require(_0x9bc0('0x8'));var csv=require(_0x9bc0('0x9'));var ejs=require(_0x9bc0('0xa'));var fs=require('fs');var _=require(_0x9bc0('0xb'));var squel=require(_0x9bc0('0xc'));var crypto=require(_0x9bc0('0xd'));var jsforce=require(_0x9bc0('0xe'));var deskjs=require(_0x9bc0('0xf'));var toCsv=require(_0x9bc0('0x9'));var querystring=require(_0x9bc0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9bc0('0x11'));var as=require(_0x9bc0('0x12'));var hardwareService=require(_0x9bc0('0x13'));var logger=require(_0x9bc0('0x14'))('api');var utils=require(_0x9bc0('0x15'));var config=require(_0x9bc0('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9bc0('0x17')],{'host':_0x9bc0('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bc0('0x17')]));require(_0x9bc0('0x19'))[_0x9bc0('0x1a')](socket);function respondWithStatusCode(_0x5c8480,_0x9fd635){_0x9fd635=_0x9fd635||0xcc;return function(_0x8679f7){if(_0x8679f7){return _0x5c8480[_0x9bc0('0x1b')](_0x9fd635);}return _0x5c8480[_0x9bc0('0x1c')](_0x9fd635)[_0x9bc0('0x1d')]();};}function respondWithResult(_0x2cd237,_0x379995){_0x379995=_0x379995||0xc8;return function(_0x3f25d3){if(_0x3f25d3){return _0x2cd237[_0x9bc0('0x1c')](_0x379995)[_0x9bc0('0x1e')](_0x3f25d3);}};}function respondWithFilteredResult(_0x5b6770,_0x153962){return function(_0x9fb2){if(_0x9fb2){var _0x57ce01=_0x9fb2[_0x9bc0('0x1f')],_0x443b1e=_0x153962[_0x9bc0('0x20')],_0x37c8d3=_0x153962['offset']+_0x153962[_0x9bc0('0x21')],_0x4b4834;if(_0x37c8d3>=_0x57ce01){_0x37c8d3=_0x57ce01;_0x4b4834=0xc8;}else{_0x4b4834=0xce;}_0x5b6770[_0x9bc0('0x1c')](_0x4b4834);return _0x5b6770[_0x9bc0('0x22')]('Content-Range',_0x443b1e+'-'+_0x37c8d3+'/'+_0x57ce01)[_0x9bc0('0x1e')](_0x9fb2);}return null;};}function patchUpdates(_0x4669ba){return function(_0xfff124){try{jsonpatch[_0x9bc0('0x23')](_0xfff124,_0x4669ba,!![]);}catch(_0x44a2b5){return BPromise[_0x9bc0('0x24')](_0x44a2b5);}return _0xfff124[_0x9bc0('0x25')]();};}function saveUpdates(_0x5add9a,_0x4b2692){return function(_0xa5ab7c){if(_0xa5ab7c){return _0xa5ab7c[_0x9bc0('0x26')](_0x5add9a)[_0x9bc0('0x27')](function(_0x3830d1){return _0x3830d1;});}return null;};}function removeEntity(_0x400701,_0x4ccf61){return function(_0x575fa4){if(_0x575fa4){return _0x575fa4[_0x9bc0('0x28')]()[_0x9bc0('0x27')](function(){var _0x4c7ec0=_0x575fa4[_0x9bc0('0x29')]({'plain':!![]});var _0x43f32e=[{'name':_0x9bc0('0x2a'),'value':_0x9bc0('0x2b'),'ignore':![]},{'name':_0x9bc0('0x2c'),'value':_0x9bc0('0x2d'),'ignore':![]}];var _0x58084a=_(_0x43f32e)['filter'](_0x9bc0('0x2e'))[_0x9bc0('0x2f')]('value')[_0x9bc0('0x30')]();if(_[_0x9bc0('0x31')](_0x58084a,_0x4c7ec0[_0x9bc0('0x32')])){return;}var _0x96050=_['find'](_0x43f32e,[_0x9bc0('0x30'),_0x4c7ec0[_0x9bc0('0x32')]])[_0x9bc0('0x33')];return db[_0x9bc0('0x34')][_0x9bc0('0x28')]({'where':{'type':_0x96050,'resourceId':_0x4c7ec0['id']}})[_0x9bc0('0x27')](function(){return _0x575fa4;});})['then'](function(){_0x400701[_0x9bc0('0x1c')](0xcc)[_0x9bc0('0x1d')]();});}};}function handleEntityNotFound(_0xbf5631,_0x4b60e6){return function(_0x4243e8){if(!_0x4243e8){_0xbf5631[_0x9bc0('0x1b')](0x194);}return _0x4243e8;};}function handleError(_0x1e3e6e,_0x1e3242){_0x1e3242=_0x1e3242||0x1f4;return function(_0x5e13ad){logger[_0x9bc0('0x35')](_0x5e13ad[_0x9bc0('0x36')]);if(_0x5e13ad[_0x9bc0('0x33')]){delete _0x5e13ad['name'];}_0x1e3e6e['status'](_0x1e3242)[_0x9bc0('0x37')](_0x5e13ad);};}exports[_0x9bc0('0x38')]=function(_0x1cc5d4,_0xdcb4cb){var _0x3c367d={},_0x3d70a2={},_0x249288={'count':0x0,'rows':[]};var _0x15c3c6=_[_0x9bc0('0x2f')](db[_0x9bc0('0x39')][_0x9bc0('0x3a')],function(_0xd05fe){return{'name':_0xd05fe[_0x9bc0('0x3b')],'type':_0xd05fe['type']['key']};});_0x3d70a2['model']=_[_0x9bc0('0x2f')](_0x15c3c6,_0x9bc0('0x33'));_0x3d70a2[_0x9bc0('0x3c')]=_[_0x9bc0('0x3d')](_0x1cc5d4['query']);_0x3d70a2[_0x9bc0('0x3e')]=_[_0x9bc0('0x3f')](_0x3d70a2[_0x9bc0('0x40')],_0x3d70a2[_0x9bc0('0x3c')]);_0x3c367d['attributes']=_[_0x9bc0('0x3f')](_0x3d70a2[_0x9bc0('0x40')],qs['fields'](_0x1cc5d4[_0x9bc0('0x3c')][_0x9bc0('0x41')]));_0x3c367d['attributes']=_0x3c367d[_0x9bc0('0x42')]['length']?_0x3c367d[_0x9bc0('0x42')]:_0x3d70a2[_0x9bc0('0x40')];if(!_0x1cc5d4[_0x9bc0('0x3c')][_0x9bc0('0x43')](_0x9bc0('0x44'))){_0x3c367d['limit']=qs[_0x9bc0('0x21')](_0x1cc5d4[_0x9bc0('0x3c')][_0x9bc0('0x21')]);_0x3c367d['offset']=qs[_0x9bc0('0x20')](_0x1cc5d4[_0x9bc0('0x3c')][_0x9bc0('0x20')]);}_0x3c367d['order']=qs[_0x9bc0('0x45')](_0x1cc5d4['query'][_0x9bc0('0x45')]);_0x3c367d['where']=qs[_0x9bc0('0x3e')](_[_0x9bc0('0x46')](_0x1cc5d4[_0x9bc0('0x3c')],_0x3d70a2[_0x9bc0('0x3e')]),_0x15c3c6);if(_0x1cc5d4[_0x9bc0('0x3c')][_0x9bc0('0x47')]){_0x3c367d[_0x9bc0('0x48')]=_[_0x9bc0('0x49')](_0x3c367d[_0x9bc0('0x48')],{'$or':_['map'](_0x15c3c6,function(_0x2e58f3){if(_0x2e58f3[_0x9bc0('0x32')]!=='VIRTUAL'){var _0xe4f923={};_0xe4f923[_0x2e58f3[_0x9bc0('0x33')]]={'$like':'%'+_0x1cc5d4[_0x9bc0('0x3c')]['filter']+'%'};return _0xe4f923;}})});}_0x3c367d=_['merge']({},_0x3c367d,_0x1cc5d4['options']);var _0x50c813={'where':_0x3c367d['where']};return db[_0x9bc0('0x39')][_0x9bc0('0x1f')](_0x50c813)[_0x9bc0('0x27')](function(_0x42ab98){_0x249288[_0x9bc0('0x1f')]=_0x42ab98;if(_0x1cc5d4[_0x9bc0('0x3c')]['includeAll']){_0x3c367d['include']=[{'all':!![]}];}return db[_0x9bc0('0x39')][_0x9bc0('0x4a')](_0x3c367d);})[_0x9bc0('0x27')](function(_0x5aeb37){_0x249288[_0x9bc0('0x4b')]=_0x5aeb37;return _0x249288;})[_0x9bc0('0x27')](respondWithFilteredResult(_0xdcb4cb,_0x3c367d))[_0x9bc0('0x4c')](handleError(_0xdcb4cb,null));};exports[_0x9bc0('0x4d')]=function(_0x28eeb2,_0x10bd70){var _0x29139b={'raw':![],'where':{'id':_0x28eeb2[_0x9bc0('0x4e')]['id']}},_0x4b3bda={};_0x4b3bda['model']=_[_0x9bc0('0x3d')](db['VoiceQueue'][_0x9bc0('0x3a')]);_0x4b3bda[_0x9bc0('0x3c')]=_['keys'](_0x28eeb2['query']);_0x4b3bda[_0x9bc0('0x3e')]=_['intersection'](_0x4b3bda[_0x9bc0('0x40')],_0x4b3bda[_0x9bc0('0x3c')]);_0x29139b['attributes']=_[_0x9bc0('0x3f')](_0x4b3bda[_0x9bc0('0x40')],qs[_0x9bc0('0x41')](_0x28eeb2[_0x9bc0('0x3c')]['fields']));_0x29139b[_0x9bc0('0x42')]=_0x29139b[_0x9bc0('0x42')][_0x9bc0('0x4f')]?_0x29139b['attributes']:_0x4b3bda[_0x9bc0('0x40')];if(_0x28eeb2['query']['includeAll']){_0x29139b[_0x9bc0('0x50')]=[{'all':!![]}];}_0x29139b=_[_0x9bc0('0x49')]({},_0x29139b,_0x28eeb2['options']);return db[_0x9bc0('0x39')][_0x9bc0('0x51')](_0x29139b)[_0x9bc0('0x27')](handleEntityNotFound(_0x10bd70,null))[_0x9bc0('0x27')](respondWithResult(_0x10bd70,null))[_0x9bc0('0x4c')](handleError(_0x10bd70,null));};exports[_0x9bc0('0x52')]=function(_0x2fc51d,_0x56acab){return db['VoiceQueue']['create'](_0x2fc51d[_0x9bc0('0x53')],{})['then'](function(_0x445f04){var _0x411647=_0x2fc51d['user'][_0x9bc0('0x29')]({'plain':!![]});if(!_0x411647)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x411647[_0x9bc0('0x54')]===_0x9bc0('0x55')){var _0x46a493=_0x445f04[_0x9bc0('0x29')]({'plain':!![]});var _0x1ecfad=[{'name':_0x9bc0('0x2a'),'value':_0x9bc0('0x2b')},{'name':_0x9bc0('0x2c'),'value':_0x9bc0('0x2d')}];var _0x177ff4=_[_0x9bc0('0x51')](_0x1ecfad,[_0x9bc0('0x30'),_0x46a493[_0x9bc0('0x32')]])[_0x9bc0('0x33')];return db['UserProfileSection'][_0x9bc0('0x51')]({'where':{'name':_0x177ff4,'userProfileId':_0x411647[_0x9bc0('0x56')]},'raw':!![]})[_0x9bc0('0x27')](function(_0x543761){if(_0x543761&&_0x543761[_0x9bc0('0x57')]===0x0){return db['UserProfileResource'][_0x9bc0('0x52')]({'name':_0x46a493['name'],'resourceId':_0x46a493['id'],'type':_0x543761['name'],'sectionId':_0x543761['id']},{})[_0x9bc0('0x27')](function(){return _0x445f04;});}else{return _0x445f04;}})[_0x9bc0('0x4c')](function(_0x18cabf){logger[_0x9bc0('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18cabf);throw _0x18cabf;});}return _0x445f04;})[_0x9bc0('0x27')](respondWithResult(_0x56acab,0xc9))['catch'](handleError(_0x56acab,null));};exports[_0x9bc0('0x58')]=function(_0x3d360d,_0x416674){var _0x1ca90b={'where':{'id':_0x3d360d[_0x9bc0('0x4e')]['id']}},_0x3c80af={};_0x3c80af['model']=_['keys'](db[_0x9bc0('0x39')][_0x9bc0('0x3a')]);_0x1ca90b[_0x9bc0('0x42')]=_[_0x9bc0('0x3f')](_0x3c80af[_0x9bc0('0x40')],qs[_0x9bc0('0x41')](_0x3d360d['query'][_0x9bc0('0x41')]));_0x1ca90b[_0x9bc0('0x42')]=_0x1ca90b[_0x9bc0('0x42')][_0x9bc0('0x4f')]?_0x1ca90b['attributes']:_0x3c80af[_0x9bc0('0x40')];if(_0x3d360d['query'][_0x9bc0('0x59')]){_0x1ca90b['include']=[{'all':!![]}];}_0x1ca90b=_[_0x9bc0('0x49')]({},_0x1ca90b,_0x3d360d['options']);return db[_0x9bc0('0x39')][_0x9bc0('0x51')](_0x1ca90b)[_0x9bc0('0x27')](handleEntityNotFound(_0x416674,null))[_0x9bc0('0x27')](function(_0x432ae5){if(_0x432ae5){var _0x1f2b26=_0x432ae5[_0x9bc0('0x29')]({'plain':!![]});_0x1f2b26=qs[_0x9bc0('0x5a')](_0x1f2b26,['id','createdAt',_0x9bc0('0x5b')]);_0x3d360d[_0x9bc0('0x53')]=_['omit'](_0x3d360d[_0x9bc0('0x53')],['id',_0x9bc0('0x5c'),_0x9bc0('0x5b')]);return db[_0x9bc0('0x39')]['create'](_[_0x9bc0('0x49')](_0x1f2b26,_0x3d360d[_0x9bc0('0x53')]),{'include':_0x3d360d[_0x9bc0('0x3c')][_0x9bc0('0x59')]?[{'all':!![]}]:undefined})[_0x9bc0('0x27')](function(_0x683600){var _0x37711d=_0x3d360d[_0x9bc0('0x55')][_0x9bc0('0x29')]({'plain':!![]});if(!_0x37711d)throw new Error(_0x9bc0('0x5d'));if(_0x37711d[_0x9bc0('0x54')]===_0x9bc0('0x55')){var _0x4a8e15=_0x683600['get']({'plain':!![]});var _0x2a5a75=[{'name':_0x9bc0('0x2a'),'value':'inbound'},{'name':_0x9bc0('0x2c'),'value':'outbound'}];var _0x5cf98b=_[_0x9bc0('0x51')](_0x2a5a75,[_0x9bc0('0x30'),_0x4a8e15[_0x9bc0('0x32')]])[_0x9bc0('0x33')];return db[_0x9bc0('0x5e')][_0x9bc0('0x51')]({'where':{'name':_0x5cf98b,'userProfileId':_0x37711d[_0x9bc0('0x56')]},'raw':!![]})[_0x9bc0('0x27')](function(_0x2e2f5b){if(_0x2e2f5b&&_0x2e2f5b[_0x9bc0('0x57')]===0x0){return db[_0x9bc0('0x34')][_0x9bc0('0x52')]({'name':_0x4a8e15[_0x9bc0('0x33')],'resourceId':_0x4a8e15['id'],'type':_0x2e2f5b[_0x9bc0('0x33')],'sectionId':_0x2e2f5b['id']},{})[_0x9bc0('0x27')](function(){return _0x683600;});}else{return _0x683600;}})['catch'](function(_0x38e72d){logger[_0x9bc0('0x35')](_0x9bc0('0x5f'),_0x38e72d);throw _0x38e72d;});}return _0x683600;});}})[_0x9bc0('0x27')](respondWithResult(_0x416674,0xc9))['catch'](handleError(_0x416674,null));};exports[_0x9bc0('0x26')]=function(_0x3d45a3,_0xeb37f9){if(_0x3d45a3[_0x9bc0('0x53')]['id']){delete _0x3d45a3[_0x9bc0('0x53')]['id'];}return db[_0x9bc0('0x39')]['find']({'where':{'id':_0x3d45a3[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0xeb37f9,null))[_0x9bc0('0x27')](saveUpdates(_0x3d45a3[_0x9bc0('0x53')],null))[_0x9bc0('0x27')](respondWithResult(_0xeb37f9,null))[_0x9bc0('0x4c')](handleError(_0xeb37f9,null));};exports[_0x9bc0('0x28')]=function(_0x260c20,_0x5d0cae){return db[_0x9bc0('0x39')][_0x9bc0('0x51')]({'where':{'id':_0x260c20['params']['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0x5d0cae,null))['then'](removeEntity(_0x5d0cae,null))[_0x9bc0('0x4c')](handleError(_0x5d0cae,null));};exports[_0x9bc0('0x60')]=function(_0x2f148c,_0x20f8db,_0x9a3f19){var _0x2a57da={'raw':![],'where':{}};var _0x5c323d={};var _0x1b3fd8={'count':0x0,'rows':[]};return db[_0x9bc0('0x39')][_0x9bc0('0x61')]({'where':{'id':_0x2f148c[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0x20f8db,null))[_0x9bc0('0x27')](function(_0x1d25e7){if(_0x1d25e7){_0x5c323d[_0x9bc0('0x40')]=_[_0x9bc0('0x3d')](db[_0x9bc0('0x62')][_0x9bc0('0x3a')]);_0x5c323d[_0x9bc0('0x3c')]=_[_0x9bc0('0x3d')](_0x2f148c[_0x9bc0('0x3c')]);_0x5c323d[_0x9bc0('0x3e')]=_[_0x9bc0('0x3f')](_0x5c323d[_0x9bc0('0x40')],_0x5c323d[_0x9bc0('0x3c')]);_0x2a57da[_0x9bc0('0x42')]=_[_0x9bc0('0x3f')](_0x5c323d[_0x9bc0('0x40')],qs[_0x9bc0('0x41')](_0x2f148c[_0x9bc0('0x3c')][_0x9bc0('0x41')]));_0x2a57da[_0x9bc0('0x42')]=_0x2a57da['attributes'][_0x9bc0('0x4f')]?_0x2a57da['attributes']:_0x5c323d[_0x9bc0('0x40')];if(!_0x2f148c['query'][_0x9bc0('0x43')](_0x9bc0('0x44'))){_0x2a57da[_0x9bc0('0x21')]=qs['limit'](_0x2f148c[_0x9bc0('0x3c')][_0x9bc0('0x21')]);_0x2a57da[_0x9bc0('0x20')]=qs[_0x9bc0('0x20')](_0x2f148c[_0x9bc0('0x3c')][_0x9bc0('0x20')]);}_0x2a57da[_0x9bc0('0x63')]=qs[_0x9bc0('0x45')](_0x2f148c[_0x9bc0('0x3c')]['sort']);_0x2a57da[_0x9bc0('0x48')]=qs[_0x9bc0('0x3e')](_['pick'](_0x2f148c[_0x9bc0('0x3c')],_0x5c323d[_0x9bc0('0x3e')]));_0x2a57da[_0x9bc0('0x48')]['VoiceQueueId']=_0x1d25e7['id'];if(_0x2f148c[_0x9bc0('0x3c')][_0x9bc0('0x47')]){_0x2a57da[_0x9bc0('0x48')]=_[_0x9bc0('0x49')](_0x2a57da[_0x9bc0('0x48')],{'$or':_[_0x9bc0('0x2f')](_0x2a57da[_0x9bc0('0x42')],function(_0x34f533){var _0x167dfa={};_0x167dfa[_0x34f533]={'$like':'%'+_0x2f148c['query']['filter']+'%'};return _0x167dfa;})});}_0x2a57da=_[_0x9bc0('0x49')]({},_0x2a57da,_0x2f148c[_0x9bc0('0x64')]);return db['CmHopper'][_0x9bc0('0x1f')]({'where':_0x2a57da[_0x9bc0('0x48')]})[_0x9bc0('0x27')](function(_0x4ada45){_0x1b3fd8[_0x9bc0('0x1f')]=_0x4ada45;if(_0x2f148c[_0x9bc0('0x3c')][_0x9bc0('0x59')]){_0x2a57da[_0x9bc0('0x50')]=[{'all':!![]}];}return db[_0x9bc0('0x62')][_0x9bc0('0x4a')](_0x2a57da);})[_0x9bc0('0x27')](function(_0x3ef665){_0x1b3fd8[_0x9bc0('0x4b')]=_0x3ef665;return _0x1b3fd8;});}})[_0x9bc0('0x27')](respondWithFilteredResult(_0x20f8db,_0x2a57da))[_0x9bc0('0x4c')](handleError(_0x20f8db,null));};exports[_0x9bc0('0x65')]=function(_0x31440b,_0x37cbe4,_0x1bd153){var _0x2cd528={'raw':!![],'where':{}};var _0x30810a={};var _0x5ae4ba={'count':0x0,'rows':[]};return db[_0x9bc0('0x39')][_0x9bc0('0x61')]({'where':{'id':_0x31440b[_0x9bc0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x37cbe4,null))[_0x9bc0('0x27')](function(_0x45c3a4){if(_0x45c3a4){_0x30810a[_0x9bc0('0x40')]=_['keys'](db[_0x9bc0('0x66')][_0x9bc0('0x3a')]);_0x30810a['query']=_['keys'](_0x31440b[_0x9bc0('0x3c')]);_0x30810a[_0x9bc0('0x3e')]=_['intersection'](_0x30810a[_0x9bc0('0x40')],_0x30810a[_0x9bc0('0x3c')]);_0x2cd528[_0x9bc0('0x42')]=_[_0x9bc0('0x3f')](_0x30810a[_0x9bc0('0x40')],qs[_0x9bc0('0x41')](_0x31440b[_0x9bc0('0x3c')][_0x9bc0('0x41')]));_0x2cd528[_0x9bc0('0x42')]=_0x2cd528[_0x9bc0('0x42')][_0x9bc0('0x4f')]?_0x2cd528['attributes']:_0x30810a[_0x9bc0('0x40')];if(!_0x31440b['query'][_0x9bc0('0x43')]('nolimit')){_0x2cd528[_0x9bc0('0x21')]=qs[_0x9bc0('0x21')](_0x31440b[_0x9bc0('0x3c')]['limit']);_0x2cd528['offset']=qs[_0x9bc0('0x20')](_0x31440b[_0x9bc0('0x3c')][_0x9bc0('0x20')]);}_0x2cd528[_0x9bc0('0x63')]=qs[_0x9bc0('0x45')](_0x31440b[_0x9bc0('0x3c')]['sort']);_0x2cd528[_0x9bc0('0x48')]=qs[_0x9bc0('0x3e')](_[_0x9bc0('0x46')](_0x31440b['query'],_0x30810a[_0x9bc0('0x3e')]));_0x2cd528[_0x9bc0('0x48')][_0x9bc0('0x67')]=_0x45c3a4['id'];if(_0x31440b[_0x9bc0('0x3c')][_0x9bc0('0x47')]){_0x2cd528[_0x9bc0('0x48')]=_[_0x9bc0('0x49')](_0x2cd528[_0x9bc0('0x48')],{'$or':_[_0x9bc0('0x2f')](_0x2cd528[_0x9bc0('0x42')],function(_0x2313a0){var _0xc5c3f3={};_0xc5c3f3[_0x2313a0]={'$like':'%'+_0x31440b[_0x9bc0('0x3c')][_0x9bc0('0x47')]+'%'};return _0xc5c3f3;})});}_0x2cd528=_['merge']({},_0x2cd528,_0x31440b['options']);return db['CmHopperHistory'][_0x9bc0('0x1f')]({'where':_0x2cd528[_0x9bc0('0x48')]})[_0x9bc0('0x27')](function(_0x43ccfd){_0x5ae4ba[_0x9bc0('0x1f')]=_0x43ccfd;if(_0x31440b[_0x9bc0('0x3c')]['includeAll']){_0x2cd528[_0x9bc0('0x50')]=[{'all':!![]}];}return db[_0x9bc0('0x66')][_0x9bc0('0x4a')](_0x2cd528);})[_0x9bc0('0x27')](function(_0x2f0586){_0x5ae4ba[_0x9bc0('0x4b')]=_0x2f0586;return _0x5ae4ba;});}})[_0x9bc0('0x27')](respondWithFilteredResult(_0x37cbe4,_0x2cd528))[_0x9bc0('0x4c')](handleError(_0x37cbe4,null));};exports[_0x9bc0('0x68')]=function(_0x2ec4e8,_0x4ec2ea,_0x504c90){var _0x580624={'raw':!![],'where':{}};var _0x3f5079={};var _0x4692f4={'count':0x0,'rows':[]};return db[_0x9bc0('0x39')]['findOne']({'where':{'id':_0x2ec4e8[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0x4ec2ea,null))[_0x9bc0('0x27')](function(_0x275b9c){if(_0x275b9c){_0x3f5079['model']=_[_0x9bc0('0x3d')](db['CmHopperFinal'][_0x9bc0('0x3a')]);_0x3f5079[_0x9bc0('0x3c')]=_[_0x9bc0('0x3d')](_0x2ec4e8[_0x9bc0('0x3c')]);_0x3f5079[_0x9bc0('0x3e')]=_[_0x9bc0('0x3f')](_0x3f5079[_0x9bc0('0x40')],_0x3f5079[_0x9bc0('0x3c')]);_0x580624[_0x9bc0('0x42')]=_[_0x9bc0('0x3f')](_0x3f5079[_0x9bc0('0x40')],qs['fields'](_0x2ec4e8[_0x9bc0('0x3c')][_0x9bc0('0x41')]));_0x580624[_0x9bc0('0x42')]=_0x580624['attributes'][_0x9bc0('0x4f')]?_0x580624[_0x9bc0('0x42')]:_0x3f5079['model'];if(!_0x2ec4e8[_0x9bc0('0x3c')][_0x9bc0('0x43')](_0x9bc0('0x44'))){_0x580624[_0x9bc0('0x21')]=qs[_0x9bc0('0x21')](_0x2ec4e8[_0x9bc0('0x3c')][_0x9bc0('0x21')]);_0x580624[_0x9bc0('0x20')]=qs[_0x9bc0('0x20')](_0x2ec4e8[_0x9bc0('0x3c')]['offset']);}_0x580624[_0x9bc0('0x63')]=qs[_0x9bc0('0x45')](_0x2ec4e8[_0x9bc0('0x3c')]['sort']);_0x580624[_0x9bc0('0x48')]=qs['filters'](_[_0x9bc0('0x46')](_0x2ec4e8[_0x9bc0('0x3c')],_0x3f5079[_0x9bc0('0x3e')]));_0x580624[_0x9bc0('0x48')][_0x9bc0('0x67')]=_0x275b9c['id'];if(_0x2ec4e8[_0x9bc0('0x3c')][_0x9bc0('0x47')]){_0x580624[_0x9bc0('0x48')]=_[_0x9bc0('0x49')](_0x580624['where'],{'$or':_[_0x9bc0('0x2f')](_0x580624['attributes'],function(_0x3fe475){var _0x43a086={};_0x43a086[_0x3fe475]={'$like':'%'+_0x2ec4e8[_0x9bc0('0x3c')][_0x9bc0('0x47')]+'%'};return _0x43a086;})});}_0x580624=_[_0x9bc0('0x49')]({},_0x580624,_0x2ec4e8[_0x9bc0('0x64')]);return db[_0x9bc0('0x69')][_0x9bc0('0x1f')]({'where':_0x580624[_0x9bc0('0x48')]})[_0x9bc0('0x27')](function(_0x1f235f){_0x4692f4[_0x9bc0('0x1f')]=_0x1f235f;if(_0x2ec4e8[_0x9bc0('0x3c')][_0x9bc0('0x59')]){_0x580624['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x9bc0('0x4a')](_0x580624);})['then'](function(_0x5d9ab3){_0x4692f4[_0x9bc0('0x4b')]=_0x5d9ab3;return _0x4692f4;});}})[_0x9bc0('0x27')](respondWithFilteredResult(_0x4ec2ea,_0x580624))[_0x9bc0('0x4c')](handleError(_0x4ec2ea,null));};exports[_0x9bc0('0x6a')]=function(_0x1f3882,_0x5e1ed6,_0x82ba45){var _0x46f628={'raw':!![],'where':{}};var _0xa98c0a={};var _0x325667={'count':0x0,'rows':[]};return db[_0x9bc0('0x39')]['findOne']({'where':{'id':_0x1f3882[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0x5e1ed6,null))[_0x9bc0('0x27')](function(_0x1f031e){if(_0x1f031e){_0xa98c0a[_0x9bc0('0x40')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0xa98c0a[_0x9bc0('0x3c')]=_['keys'](_0x1f3882['query']);_0xa98c0a['filters']=_[_0x9bc0('0x3f')](_0xa98c0a[_0x9bc0('0x40')],_0xa98c0a['query']);_0x46f628[_0x9bc0('0x42')]=_[_0x9bc0('0x3f')](_0xa98c0a['model'],qs[_0x9bc0('0x41')](_0x1f3882['query'][_0x9bc0('0x41')]));_0x46f628['attributes']=_0x46f628['attributes'][_0x9bc0('0x4f')]?_0x46f628[_0x9bc0('0x42')]:_0xa98c0a[_0x9bc0('0x40')];if(!_0x1f3882[_0x9bc0('0x3c')][_0x9bc0('0x43')]('nolimit')){_0x46f628[_0x9bc0('0x21')]=qs[_0x9bc0('0x21')](_0x1f3882['query']['limit']);_0x46f628[_0x9bc0('0x20')]=qs[_0x9bc0('0x20')](_0x1f3882[_0x9bc0('0x3c')][_0x9bc0('0x20')]);}_0x46f628['order']=qs[_0x9bc0('0x45')](_0x1f3882['query'][_0x9bc0('0x45')]);_0x46f628[_0x9bc0('0x48')]=qs[_0x9bc0('0x3e')](_[_0x9bc0('0x46')](_0x1f3882[_0x9bc0('0x3c')],_0xa98c0a[_0x9bc0('0x3e')]));_0x46f628[_0x9bc0('0x48')][_0x9bc0('0x67')]=_0x1f031e['id'];if(_0x1f3882['query'][_0x9bc0('0x47')]){_0x46f628['where']=_[_0x9bc0('0x49')](_0x46f628[_0x9bc0('0x48')],{'$or':_[_0x9bc0('0x2f')](_0x46f628['attributes'],function(_0x3adc3b){var _0x12c7a0={};_0x12c7a0[_0x3adc3b]={'$like':'%'+_0x1f3882[_0x9bc0('0x3c')]['filter']+'%'};return _0x12c7a0;})});}_0x46f628=_[_0x9bc0('0x49')]({},_0x46f628,_0x1f3882[_0x9bc0('0x64')]);return db[_0x9bc0('0x6b')][_0x9bc0('0x1f')]({'where':_0x46f628[_0x9bc0('0x48')]})[_0x9bc0('0x27')](function(_0x5e06c3){_0x325667['count']=_0x5e06c3;if(_0x1f3882[_0x9bc0('0x3c')][_0x9bc0('0x59')]){_0x46f628['include']=[{'all':!![]}];}return db[_0x9bc0('0x6b')][_0x9bc0('0x4a')](_0x46f628);})[_0x9bc0('0x27')](function(_0x5d9402){_0x325667[_0x9bc0('0x4b')]=_0x5d9402;return _0x325667;});}})[_0x9bc0('0x27')](respondWithFilteredResult(_0x5e1ed6,_0x46f628))[_0x9bc0('0x4c')](handleError(_0x5e1ed6,null));};exports['getTeams']=function(_0x306dfd,_0x47e7b7,_0x503238){var _0x444aba={};var _0x405506={};var _0x156b4f;var _0x5c3e03;return db[_0x9bc0('0x39')][_0x9bc0('0x61')]({'where':{'id':_0x306dfd[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0x47e7b7,null))[_0x9bc0('0x27')](function(_0xe45ec){if(_0xe45ec){_0x156b4f=_0xe45ec;_0x405506['model']=_['keys'](db[_0x9bc0('0x6c')][_0x9bc0('0x3a')]);_0x405506[_0x9bc0('0x3c')]=_[_0x9bc0('0x3d')](_0x306dfd[_0x9bc0('0x3c')]);_0x405506['filters']=_[_0x9bc0('0x3f')](_0x405506[_0x9bc0('0x40')],_0x405506[_0x9bc0('0x3c')]);_0x444aba[_0x9bc0('0x42')]=_[_0x9bc0('0x3f')](_0x405506['model'],qs[_0x9bc0('0x41')](_0x306dfd[_0x9bc0('0x3c')][_0x9bc0('0x41')]));_0x444aba[_0x9bc0('0x42')]=_0x444aba['attributes'][_0x9bc0('0x4f')]?_0x444aba[_0x9bc0('0x42')]:_0x405506[_0x9bc0('0x40')];_0x444aba['order']=qs[_0x9bc0('0x45')](_0x306dfd[_0x9bc0('0x3c')][_0x9bc0('0x45')]);_0x444aba[_0x9bc0('0x48')]=qs[_0x9bc0('0x3e')](_['pick'](_0x306dfd['query'],_0x405506['filters']));if(_0x306dfd[_0x9bc0('0x3c')][_0x9bc0('0x47')]){_0x444aba['where']=_[_0x9bc0('0x49')](_0x444aba['where'],{'$or':_[_0x9bc0('0x2f')](_0x444aba['attributes'],function(_0x2a6df5){var _0x5d325b={};_0x5d325b[_0x2a6df5]={'$like':'%'+_0x306dfd[_0x9bc0('0x3c')][_0x9bc0('0x47')]+'%'};return _0x5d325b;})});}_0x444aba=_[_0x9bc0('0x49')]({},_0x444aba,_0x306dfd[_0x9bc0('0x64')]);return _0x156b4f[_0x9bc0('0x6d')](_0x444aba);}})['then'](function(_0x472d20){if(_0x472d20){_0x5c3e03=_0x472d20[_0x9bc0('0x4f')];if(!_0x306dfd[_0x9bc0('0x3c')][_0x9bc0('0x43')](_0x9bc0('0x44'))){_0x444aba[_0x9bc0('0x21')]=qs[_0x9bc0('0x21')](_0x306dfd['query'][_0x9bc0('0x21')]);_0x444aba[_0x9bc0('0x20')]=qs[_0x9bc0('0x20')](_0x306dfd['query'][_0x9bc0('0x20')]);}return _0x156b4f[_0x9bc0('0x6d')](_0x444aba);}})[_0x9bc0('0x27')](function(_0x394b44){if(_0x394b44){return _0x394b44?{'count':_0x5c3e03,'rows':_0x394b44}:null;}})[_0x9bc0('0x27')](respondWithResult(_0x47e7b7,null))[_0x9bc0('0x4c')](handleError(_0x47e7b7,null));};exports[_0x9bc0('0x6e')]=function(_0x3f0b9f,_0x132a6e,_0x51f866){var _0xba962d=_0x3f0b9f[_0x9bc0('0x53')][_0x9bc0('0x6f')];var _0x276b70=_['map'](_0xba962d,'id');return db['Team']['findAll']({'where':{'id':_0x276b70},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9bc0('0x70'),'attributes':['id','name',_0x9bc0('0x71'),_0x9bc0('0x72'),'interface'],'raw':!![]}]})['then'](function(_0xc81e4f){if(_0xc81e4f){var _0x20de5d=_[_0x9bc0('0x73')](_0xc81e4f,function(_0x3c639d){var _0x34357f=_0x3c639d[_0x9bc0('0x29')]({'plain':!![]});_0x34357f['Agents'][_0x9bc0('0x74')](function(_0x10efe7){_0x10efe7['penalty']=_[_0x9bc0('0x51')](_0xba962d,{'id':_0x34357f['id']})[_0x9bc0('0x75')];});return _0x34357f['Agents'];});return db[_0x9bc0('0x39')][_0x9bc0('0x51')]({'where':{'id':_0x3f0b9f[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](function(_0x2cd4a3){return db['sequelize'][_0x9bc0('0x76')](function(_0xfad8f6){return _0x2cd4a3[_0x9bc0('0x6e')](_0x276b70,{'transaction':_0xfad8f6})[_0x9bc0('0x27')](function(){return BPromise[_0x9bc0('0x77')](_0x20de5d,function(_0x320c5c){return db[_0x9bc0('0x78')][_0x9bc0('0x79')]({'where':{'UserId':_0x320c5c['id'],'VoiceQueueId':_0x3f0b9f[_0x9bc0('0x4e')]['id']},'defaults':{'penalty':_0x320c5c[_0x9bc0('0x75')]},'transaction':_0xfad8f6});});})[_0x9bc0('0x27')](function(){return BPromise['each'](_['filter'](_0x20de5d,{'online':!![]}),function(_0x2a762e){return db['UserVoiceQueueRt'][_0x9bc0('0x7a')]({'membername':_0x2a762e[_0x9bc0('0x33')],'UserId':_0x2a762e['id'],'queue_name':_0x2cd4a3['name'],'VoiceQueueId':_0x2cd4a3['id'],'interface':_[_0x9bc0('0x7b')](_0x2a762e[_0x9bc0('0x7c')])?util[_0x9bc0('0x7d')](_0x9bc0('0x7e'),_0x2a762e['name']):_0x2a762e['interface'],'paused':_0x2a762e['voicePause']||![],'penalty':_0x2a762e[_0x9bc0('0x75')]},{'transaction':_0xfad8f6});});})[_0x9bc0('0x27')](function(){_0x20de5d[_0x9bc0('0x74')](function(_0x26a810){socket['emit'](_0x9bc0('0x7f'),{'UserId':_0x26a810['id'],'VoiceQueueId':_0x2cd4a3['id']});});});});});}})[_0x9bc0('0x27')](respondWithStatusCode(_0x132a6e,null))[_0x9bc0('0x4c')](handleError(_0x132a6e,null));};exports['removeTeams']=function(_0x3ad41a,_0x3f6327,_0x4fbfee){return db[_0x9bc0('0x6c')][_0x9bc0('0x4a')]({'where':{'id':_0x3ad41a[_0x9bc0('0x3c')][_0x9bc0('0x80')]},'attributes':['id'],'include':[{'model':db[_0x9bc0('0x81')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3f6327,null))[_0x9bc0('0x27')](function(_0x161759){var _0x372a47=_[_0x9bc0('0x2f')](_0x161759,'id');var _0x252e8c=[];var _0xdc9aab=[];var _0x300fc0=squel[_0x9bc0('0x82')]();_0x300fc0[_0x9bc0('0x83')](_0x9bc0('0x84'))[_0x9bc0('0x85')]('team_has_voice_queues','tq')[_0x9bc0('0x86')](_0x9bc0('0x87'),'ut',_0x9bc0('0x88'))[_0x9bc0('0x48')](_0x9bc0('0x89'),_0x3ad41a['params']['id']);for(var _0x24a2ac=0x0;_0x24a2ac<_0x161759['length'];_0x24a2ac+=0x1){let _0x1a9fbf=_0x161759[_0x24a2ac];for(var _0x15eccb=0x0;_0x15eccb<_0x1a9fbf['Agents'][_0x9bc0('0x4f')];_0x15eccb+=0x1){let _0x5afc84=_0x1a9fbf['Agents'][_0x15eccb];var _0x3ad98b=_0x300fc0[_0x9bc0('0x58')]();_0x3ad98b['where']('ut.UserId\x20=\x20?',_0x5afc84['id']);_0xdc9aab['push'](db[_0x9bc0('0x8a')][_0x9bc0('0x3c')](_0x3ad98b[_0x9bc0('0x8b')](),{'type':db[_0x9bc0('0x8a')][_0x9bc0('0x8c')][_0x9bc0('0x8d')]})[_0x9bc0('0x27')](function(_0x3db7de){if(_0x3db7de[_0x9bc0('0x4f')]===0x1){return _0x5afc84['id'];}else{var _0xe4fbe0=_[_0x9bc0('0x8e')](_[_0x9bc0('0x2f')](_0x3db7de,'TeamId'),function(_0x2bc059){return _[_0x9bc0('0x31')](_0x372a47,_0x2bc059);});if(_0xe4fbe0){return _0x5afc84['id'];}}}));}}return BPromise[_0x9bc0('0x8f')](_0xdc9aab)['then'](function(_0x574917){_0x252e8c=_(_0x252e8c)[_0x9bc0('0x90')](_0x574917)[_0x9bc0('0x91')]()[_0x9bc0('0x30')]();return db[_0x9bc0('0x39')][_0x9bc0('0x51')]({'where':{'id':_0x3ad41a[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](function(_0x1843d7){return db['sequelize'][_0x9bc0('0x76')](function(_0x1dfb65){return _0x1843d7[_0x9bc0('0x92')](_0x3ad41a[_0x9bc0('0x3c')]['ids'],{'transaction':_0x1dfb65})[_0x9bc0('0x27')](function(){if(!_[_0x9bc0('0x93')](_0x252e8c)){return _0x1843d7['removeAgents'](_0x252e8c,{'transaction':_0x1dfb65})[_0x9bc0('0x27')](function(){return db[_0x9bc0('0x94')][_0x9bc0('0x28')]({'where':{'VoiceQueueId':_0x3ad41a['params']['id'],'UserId':_0x252e8c},'transaction':_0x1dfb65});});}})['then'](function(){_0x252e8c[_0x9bc0('0x74')](function(_0x2b4f9a){socket[_0x9bc0('0x95')]('userVoiceQueue:remove',{'UserId':_0x2b4f9a,'VoiceQueueId':_0x1843d7['id']});});});});});});})[_0x9bc0('0x27')](respondWithStatusCode(_0x3f6327,null))[_0x9bc0('0x4c')](handleError(_0x3f6327,null));};exports[_0x9bc0('0x96')]=function(_0x2aca26,_0x49312c,_0x9f6712){var _0xbd5e5e,_0x57ac28;return db['VoiceQueue']['find']({'where':{'id':_0x2aca26[_0x9bc0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49312c,null))[_0x9bc0('0x27')](function(_0x3ee100){if(_0x3ee100){_0x57ac28=_0x3ee100;return _0x3ee100[_0x9bc0('0x96')](_0x2aca26[_0x9bc0('0x53')][_0x9bc0('0x80')],_[_0x9bc0('0x5a')](_0x2aca26['body'],[_0x9bc0('0x80'),'id'])||{})[_0x9bc0('0x97')](function(_0x5ec2d7){for(var _0x42a3f5=0x0;_0x42a3f5<_0x2aca26[_0x9bc0('0x53')][_0x9bc0('0x80')]['length'];_0x42a3f5+=0x1){socket[_0x9bc0('0x95')](_0x9bc0('0x7f'),{'UserId':_0x2aca26[_0x9bc0('0x53')][_0x9bc0('0x80')][_0x42a3f5],'VoiceQueueId':_0x2aca26[_0x9bc0('0x4e')]['id']});}return _0x5ec2d7;});}})[_0x9bc0('0x27')](function(_0x316e92){_0xbd5e5e=_0x316e92||[];if(_0x57ac28){return db[_0x9bc0('0x81')][_0x9bc0('0x4a')]({'where':{'id':_0x2aca26[_0x9bc0('0x53')][_0x9bc0('0x80')]},'attributes':['id',_0x9bc0('0x33'),_0x9bc0('0x71'),_0x9bc0('0x72'),_0x9bc0('0x7c')],'raw':!![]});}})[_0x9bc0('0x27')](function(_0x3508ab){if(!_[_0x9bc0('0x93')](_0x3508ab)){var _0x47517d=[];for(var _0x14ede2=0x0;_0x14ede2<_0x3508ab[_0x9bc0('0x4f')];_0x14ede2++){if(_0x3508ab[_0x14ede2]['online']){_0x47517d[_0x9bc0('0x98')](db[_0x9bc0('0x94')][_0x9bc0('0x7a')]({'membername':_0x3508ab[_0x14ede2][_0x9bc0('0x33')],'UserId':_0x3508ab[_0x14ede2]['id'],'queue_name':_0x57ac28[_0x9bc0('0x33')],'VoiceQueueId':_0x57ac28['id'],'interface':_[_0x9bc0('0x7b')](_0x3508ab[_0x14ede2][_0x9bc0('0x7c')])?util[_0x9bc0('0x7d')](_0x9bc0('0x7e'),_0x3508ab[_0x14ede2][_0x9bc0('0x33')]):_0x3508ab[_0x14ede2][_0x9bc0('0x7c')],'paused':_0x3508ab[_0x14ede2][_0x9bc0('0x72')]||![],'penalty':_0x2aca26[_0x9bc0('0x53')][_0x9bc0('0x75')]||0x0}));}}return BPromise['all'](_0x47517d);}})[_0x9bc0('0x27')](function(){return _0xbd5e5e;})[_0x9bc0('0x27')](respondWithResult(_0x49312c,null))[_0x9bc0('0x4c')](handleError(_0x49312c,null));};exports[_0x9bc0('0x99')]=function(_0x4bb770,_0x21fab3,_0x4e3029){return db[_0x9bc0('0x39')][_0x9bc0('0x51')]({'where':{'id':_0x4bb770['params']['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0x21fab3,null))['then'](function(_0x2c67bc){if(_0x2c67bc){return _0x2c67bc[_0x9bc0('0x99')](_0x4bb770[_0x9bc0('0x3c')][_0x9bc0('0x80')])[_0x9bc0('0x27')](function(){if(_[_0x9bc0('0x9a')](_0x4bb770[_0x9bc0('0x3c')]['ids'])){for(var _0x26716f=0x0;_0x26716f<_0x4bb770[_0x9bc0('0x3c')][_0x9bc0('0x80')][_0x9bc0('0x4f')];_0x26716f+=0x1){socket[_0x9bc0('0x95')](_0x9bc0('0x9b'),{'UserId':Number(_0x4bb770[_0x9bc0('0x3c')][_0x9bc0('0x80')][_0x26716f]),'VoiceQueueId':Number(_0x4bb770[_0x9bc0('0x4e')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x4bb770[_0x9bc0('0x3c')][_0x9bc0('0x80')]),'VoiceQueueId':Number(_0x4bb770[_0x9bc0('0x4e')]['id'])});}});}})['then'](function(_0x5d4eb9){return db['UserVoiceQueueRt'][_0x9bc0('0x28')]({'where':{'VoiceQueueId':_0x4bb770[_0x9bc0('0x4e')]['id'],'UserId':_0x4bb770['query'][_0x9bc0('0x80')]}})['then'](function(){return _0x5d4eb9;});})[_0x9bc0('0x27')](respondWithStatusCode(_0x21fab3,null))['catch'](handleError(_0x21fab3,null));};exports[_0x9bc0('0x9c')]=function(_0x5ace64,_0x20c3b0,_0x205028){var _0x2376cf={};var _0x2834c3={};var _0x188971;var _0x19c7bd;return db[_0x9bc0('0x39')][_0x9bc0('0x61')]({'where':{'id':_0x5ace64[_0x9bc0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x20c3b0,null))[_0x9bc0('0x27')](function(_0x49a8cf){if(_0x49a8cf){_0x188971=_0x49a8cf;_0x2834c3[_0x9bc0('0x40')]=_[_0x9bc0('0x3d')](db[_0x9bc0('0x81')]['rawAttributes']);_0x2834c3[_0x9bc0('0x3c')]=_['keys'](_0x5ace64[_0x9bc0('0x3c')]);_0x2834c3['filters']=_[_0x9bc0('0x3f')](_0x2834c3[_0x9bc0('0x40')],_0x2834c3[_0x9bc0('0x3c')]);_0x2376cf['attributes']=_[_0x9bc0('0x3f')](_0x2834c3[_0x9bc0('0x40')],qs[_0x9bc0('0x41')](_0x5ace64[_0x9bc0('0x3c')][_0x9bc0('0x41')]));_0x2376cf[_0x9bc0('0x42')]=_0x2376cf[_0x9bc0('0x42')]['length']?_0x2376cf[_0x9bc0('0x42')]:_0x2834c3[_0x9bc0('0x40')];_0x2376cf[_0x9bc0('0x63')]=qs[_0x9bc0('0x45')](_0x5ace64[_0x9bc0('0x3c')][_0x9bc0('0x45')]);_0x2376cf[_0x9bc0('0x48')]=qs['filters'](_['pick'](_0x5ace64[_0x9bc0('0x3c')],_0x2834c3[_0x9bc0('0x3e')]));if(_0x5ace64[_0x9bc0('0x3c')][_0x9bc0('0x47')]){_0x2376cf[_0x9bc0('0x48')]=_['merge'](_0x2376cf[_0x9bc0('0x48')],{'$or':_[_0x9bc0('0x2f')](_0x2376cf[_0x9bc0('0x42')],function(_0xa52ae9){var _0x4748ab={};_0x4748ab[_0xa52ae9]={'$like':'%'+_0x5ace64[_0x9bc0('0x3c')]['filter']+'%'};return _0x4748ab;})});}_0x2376cf=_['merge']({},_0x2376cf,_0x5ace64[_0x9bc0('0x64')]);return _0x188971[_0x9bc0('0x9c')](_0x2376cf);}})[_0x9bc0('0x27')](function(_0x40a22a){if(_0x40a22a){_0x19c7bd=_0x40a22a[_0x9bc0('0x4f')];if(!_0x5ace64['query']['hasOwnProperty'](_0x9bc0('0x44'))){_0x2376cf[_0x9bc0('0x21')]=qs[_0x9bc0('0x21')](_0x5ace64[_0x9bc0('0x3c')][_0x9bc0('0x21')]);_0x2376cf['offset']=qs[_0x9bc0('0x20')](_0x5ace64[_0x9bc0('0x3c')][_0x9bc0('0x20')]);}return _0x188971[_0x9bc0('0x9c')](_0x2376cf);}})[_0x9bc0('0x27')](function(_0x236c81){if(_0x236c81){return _0x236c81?{'count':_0x19c7bd,'rows':_0x236c81}:null;}})[_0x9bc0('0x27')](respondWithResult(_0x20c3b0,null))[_0x9bc0('0x4c')](handleError(_0x20c3b0,null));};exports['getMembers']=function(_0x1634ed,_0x461a8c,_0x134108){var _0x250c48={};var _0x1a2acb={};var _0x4e3939;var _0x3188b5;return db['VoiceQueue'][_0x9bc0('0x61')]({'where':{'id':_0x1634ed[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0x461a8c,null))[_0x9bc0('0x27')](function(_0x16006c){if(_0x16006c){_0x4e3939=_0x16006c;_0x1a2acb[_0x9bc0('0x40')]=_[_0x9bc0('0x3d')](db[_0x9bc0('0x94')][_0x9bc0('0x3a')]);_0x1a2acb['query']=_[_0x9bc0('0x3d')](_0x1634ed['query']);_0x1a2acb[_0x9bc0('0x3e')]=_[_0x9bc0('0x3f')](_0x1a2acb[_0x9bc0('0x40')],_0x1a2acb[_0x9bc0('0x3c')]);_0x250c48[_0x9bc0('0x42')]=_[_0x9bc0('0x3f')](_0x1a2acb[_0x9bc0('0x40')],qs[_0x9bc0('0x41')](_0x1634ed['query'][_0x9bc0('0x41')]));_0x250c48[_0x9bc0('0x42')]=_0x250c48['attributes'][_0x9bc0('0x4f')]?_0x250c48[_0x9bc0('0x42')]:_0x1a2acb['model'];_0x250c48[_0x9bc0('0x63')]=qs[_0x9bc0('0x45')](_0x1634ed[_0x9bc0('0x3c')][_0x9bc0('0x45')]);_0x250c48[_0x9bc0('0x48')]=qs[_0x9bc0('0x3e')](_['pick'](_0x1634ed[_0x9bc0('0x3c')],_0x1a2acb[_0x9bc0('0x3e')]));if(_0x1634ed[_0x9bc0('0x3c')]['filter']){_0x250c48[_0x9bc0('0x48')]=_[_0x9bc0('0x49')](_0x250c48['where'],{'$or':_['map'](_0x250c48['attributes'],function(_0x538e4f){var _0x1ed15b={};_0x1ed15b[_0x538e4f]={'$like':'%'+_0x1634ed['query'][_0x9bc0('0x47')]+'%'};return _0x1ed15b;})});}_0x250c48=_[_0x9bc0('0x49')]({},_0x250c48,_0x1634ed[_0x9bc0('0x64')]);return _0x4e3939[_0x9bc0('0x9d')](_0x250c48);}})['then'](function(_0x4f1be3){if(_0x4f1be3){_0x3188b5=_0x4f1be3[_0x9bc0('0x4f')];if(!_0x1634ed['query'][_0x9bc0('0x43')](_0x9bc0('0x44'))){_0x250c48[_0x9bc0('0x21')]=qs['limit'](_0x1634ed[_0x9bc0('0x3c')][_0x9bc0('0x21')]);_0x250c48[_0x9bc0('0x20')]=qs[_0x9bc0('0x20')](_0x1634ed[_0x9bc0('0x3c')][_0x9bc0('0x20')]);}return _0x4e3939['getMembers'](_0x250c48);}})['then'](function(_0x53530b){return _0x53530b?{'count':_0x3188b5,'rows':_0x53530b}:null;})[_0x9bc0('0x27')](respondWithResult(_0x461a8c,null))[_0x9bc0('0x4c')](handleError(_0x461a8c,null));};exports[_0x9bc0('0x9e')]=function(_0x117977,_0xab10bf,_0x9aa7e0){var _0x20299b={};var _0x251635={};var _0x59ea8d;var _0x586e5a;return db[_0x9bc0('0x39')][_0x9bc0('0x61')]({'where':{'id':_0x117977[_0x9bc0('0x4e')]['id']}})['then'](handleEntityNotFound(_0xab10bf,null))[_0x9bc0('0x27')](function(_0x5e91a3){if(_0x5e91a3){_0x59ea8d=_0x5e91a3;_0x251635['model']=_[_0x9bc0('0x3d')](db[_0x9bc0('0x9f')][_0x9bc0('0x3a')]);_0x251635[_0x9bc0('0x3c')]=_[_0x9bc0('0x3d')](_0x117977[_0x9bc0('0x3c')]);_0x251635['filters']=_[_0x9bc0('0x3f')](_0x251635['model'],_0x251635[_0x9bc0('0x3c')]);_0x20299b[_0x9bc0('0x42')]=_[_0x9bc0('0x3f')](_0x251635[_0x9bc0('0x40')],qs[_0x9bc0('0x41')](_0x117977['query'][_0x9bc0('0x41')]));_0x20299b[_0x9bc0('0x42')]=_0x20299b[_0x9bc0('0x42')][_0x9bc0('0x4f')]?_0x20299b[_0x9bc0('0x42')]:_0x251635[_0x9bc0('0x40')];_0x20299b[_0x9bc0('0x63')]=qs['sort'](_0x117977[_0x9bc0('0x3c')][_0x9bc0('0x45')]);_0x20299b[_0x9bc0('0x48')]=qs[_0x9bc0('0x3e')](_[_0x9bc0('0x46')](_0x117977[_0x9bc0('0x3c')],_0x251635[_0x9bc0('0x3e')]));if(_0x117977[_0x9bc0('0x3c')][_0x9bc0('0x47')]){_0x20299b[_0x9bc0('0x48')]=_['merge'](_0x20299b[_0x9bc0('0x48')],{'$or':_[_0x9bc0('0x2f')](_0x20299b['attributes'],function(_0x24af5f){var _0x55b5d5={};_0x55b5d5[_0x24af5f]={'$like':'%'+_0x117977['query'][_0x9bc0('0x47')]+'%'};return _0x55b5d5;})});}_0x20299b=_[_0x9bc0('0x49')]({},_0x20299b,_0x117977[_0x9bc0('0x64')]);return _0x59ea8d[_0x9bc0('0x9e')](_0x20299b);}})['then'](function(_0x563b53){if(_0x563b53){_0x586e5a=_0x563b53[_0x9bc0('0x4f')];if(!_0x117977[_0x9bc0('0x3c')][_0x9bc0('0x43')](_0x9bc0('0x44'))){_0x20299b[_0x9bc0('0x21')]=qs[_0x9bc0('0x21')](_0x117977[_0x9bc0('0x3c')][_0x9bc0('0x21')]);_0x20299b[_0x9bc0('0x20')]=qs[_0x9bc0('0x20')](_0x117977[_0x9bc0('0x3c')]['offset']);}return _0x59ea8d[_0x9bc0('0x9e')](_0x20299b);}})[_0x9bc0('0x27')](function(_0xf44171){if(_0xf44171){return _0xf44171?{'count':_0x586e5a,'rows':_0xf44171}:null;}})[_0x9bc0('0x27')](respondWithResult(_0xab10bf,null))[_0x9bc0('0x4c')](handleError(_0xab10bf,null));};exports[_0x9bc0('0xa0')]=function(_0x5c1209,_0xdd6ad9,_0x418f57){var _0xd115da,_0x55e229;return db['VoiceQueue']['find']({'where':{'id':_0x5c1209[_0x9bc0('0x4e')]['id']}})['then'](handleEntityNotFound(_0xdd6ad9,null))[_0x9bc0('0x27')](function(_0x76dfd2){if(_0x76dfd2){_0x55e229=_0x76dfd2;return _0x76dfd2[_0x9bc0('0xa0')](_0x5c1209[_0x9bc0('0x53')][_0x9bc0('0x80')],_['omit'](_0x5c1209[_0x9bc0('0x53')],[_0x9bc0('0x80'),'id'])||{});}return null;})['spread'](function(_0x2b5a86){var _0x5b3b8c;_0xd115da=_0x2b5a86||[];var _0x51b5c7=[];if(_0x2b5a86){for(var _0x54103d=0x0;_0x54103d<_0x2b5a86[_0x9bc0('0x4f')];_0x54103d+=0x1){var _0x224d1b=_0x2b5a86[_0x54103d][_0x9bc0('0x29')]({'plain':!![]});_0x55e229[_0x9bc0('0xa1')]=_0x5c1209[_0x9bc0('0x53')][_0x9bc0('0xa1')]?_0x5c1209[_0x9bc0('0x53')][_0x9bc0('0xa1')]:_0x55e229[_0x9bc0('0xa1')];switch(_0x55e229[_0x9bc0('0xa1')]){case _0x9bc0('0xa2'):_0x5b3b8c=squel['insert']()[_0x9bc0('0xa3')](_0x9bc0('0xa4'))[_0x9bc0('0xa5')]([_0x9bc0('0xa6'),_0x9bc0('0xa7'),_0x9bc0('0xa8'),_0x9bc0('0xa9'),'VoiceQueueId',_0x9bc0('0x5c'),'updatedAt'],squel[_0x9bc0('0x82')]()['field']('phone',_0x9bc0('0xa6'))[_0x9bc0('0x83')]('NOW()',_0x9bc0('0xa7'))[_0x9bc0('0x83')]('id',_0x9bc0('0xa8'))[_0x9bc0('0x83')](_0x224d1b['CmListId'][_0x9bc0('0x8b')](),_0x9bc0('0xa9'))[_0x9bc0('0x83')](_0x5c1209[_0x9bc0('0x4e')]['id'][_0x9bc0('0x8b')](),_0x9bc0('0x67'))[_0x9bc0('0x83')](_0x9bc0('0xaa'),_0x9bc0('0x5c'))[_0x9bc0('0x83')]('NOW()',_0x9bc0('0x5b'))[_0x9bc0('0x85')](_0x9bc0('0xab'))[_0x9bc0('0x48')](_0x9bc0('0xac'))[_0x9bc0('0x48')](_0x9bc0('0xad'),_0x224d1b['CmListId'][_0x9bc0('0x8b')]())[_0x9bc0('0x48')](_0x9bc0('0xae'))[_0x9bc0('0x48')](_0x9bc0('0xaf'),squel['select']()[_0x9bc0('0x83')]('COALESCE(calleridnum,\x27\x27)')[_0x9bc0('0x85')](_0x9bc0('0xb0'))['where']('VoiceQueueId\x20=\x20?',_0x5c1209[_0x9bc0('0x4e')]['id'][_0x9bc0('0x8b')]()))['where'](_0x9bc0('0xaf'),squel[_0x9bc0('0x82')]()['field'](_0x9bc0('0xb1'))[_0x9bc0('0x85')](_0x9bc0('0xa4'))[_0x9bc0('0x48')](_0x9bc0('0x89'),_0x5c1209[_0x9bc0('0x4e')]['id'][_0x9bc0('0x8b')]())))[_0x9bc0('0x8b')]();break;case'onlyIfOpen':_0x5b3b8c=squel[_0x9bc0('0xb2')]()[_0x9bc0('0xa3')](_0x9bc0('0xa4'))['fromQuery']([_0x9bc0('0xa6'),_0x9bc0('0xa7'),_0x9bc0('0xa8'),'ListId',_0x9bc0('0x67'),_0x9bc0('0x5c'),_0x9bc0('0x5b')],squel[_0x9bc0('0x82')]()[_0x9bc0('0x83')]('phone',_0x9bc0('0xa6'))['field']('NOW()','scheduledAt')[_0x9bc0('0x83')]('id',_0x9bc0('0xa8'))[_0x9bc0('0x83')](_0x224d1b[_0x9bc0('0xb3')][_0x9bc0('0x8b')](),_0x9bc0('0xa9'))[_0x9bc0('0x83')](_0x5c1209[_0x9bc0('0x4e')]['id'][_0x9bc0('0x8b')](),_0x9bc0('0x67'))['field'](_0x9bc0('0xaa'),'createdAt')[_0x9bc0('0x83')](_0x9bc0('0xaa'),_0x9bc0('0x5b'))[_0x9bc0('0x85')]('cm_contacts')[_0x9bc0('0x48')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x224d1b[_0x9bc0('0xb3')][_0x9bc0('0x8b')]())['where'](_0x9bc0('0xae'))[_0x9bc0('0x48')](_0x9bc0('0xaf'),squel[_0x9bc0('0x82')]()[_0x9bc0('0x83')](_0x9bc0('0xb1'))[_0x9bc0('0x85')]('cm_hopper')[_0x9bc0('0x48')](_0x9bc0('0x89'),_0x5c1209[_0x9bc0('0x4e')]['id'][_0x9bc0('0x8b')]())))[_0x9bc0('0x8b')]();break;default:_0x5b3b8c=squel[_0x9bc0('0xb2')]()[_0x9bc0('0xa3')]('cm_hopper')['fromQuery']([_0x9bc0('0xa6'),_0x9bc0('0xa7'),_0x9bc0('0xa8'),'ListId',_0x9bc0('0x67'),_0x9bc0('0x5c'),_0x9bc0('0x5b')],squel[_0x9bc0('0x82')]()[_0x9bc0('0x83')](_0x9bc0('0xa6'),_0x9bc0('0xa6'))[_0x9bc0('0x83')](_0x9bc0('0xaa'),'scheduledAt')[_0x9bc0('0x83')]('id',_0x9bc0('0xa8'))['field'](_0x224d1b[_0x9bc0('0xb3')][_0x9bc0('0x8b')](),_0x9bc0('0xa9'))[_0x9bc0('0x83')](_0x5c1209[_0x9bc0('0x4e')]['id']['toString'](),'VoiceQueueId')[_0x9bc0('0x83')]('NOW()',_0x9bc0('0x5c'))[_0x9bc0('0x83')]('NOW()',_0x9bc0('0x5b'))[_0x9bc0('0x85')](_0x9bc0('0xab'))[_0x9bc0('0x48')](_0x9bc0('0xac'))[_0x9bc0('0x48')](_0x9bc0('0xad'),_0x224d1b[_0x9bc0('0xb3')][_0x9bc0('0x8b')]())[_0x9bc0('0x48')](_0x9bc0('0xae')))[_0x9bc0('0x8b')]();}_0x51b5c7[_0x9bc0('0x98')](db[_0x9bc0('0x8a')][_0x9bc0('0x3c')](_0x5b3b8c));}return BPromise['all'](_0x51b5c7);}})['then'](function(){return _0xd115da;})['then'](respondWithResult(_0xdd6ad9,null))[_0x9bc0('0x4c')](handleError(_0xdd6ad9,null));};exports[_0x9bc0('0xb4')]=function(_0x493614,_0xdf5e26,_0x2b0924){return db[_0x9bc0('0x39')][_0x9bc0('0x51')]({'where':{'id':_0x493614['params']['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0xdf5e26,null))[_0x9bc0('0x27')](function(_0x48a9ab){if(_0x48a9ab){return _0x48a9ab[_0x9bc0('0xb4')](_0x493614[_0x9bc0('0x3c')][_0x9bc0('0x80')]);}})['then'](function(_0x596f69){if(_0x596f69){return db[_0x9bc0('0x62')]['destroy']({'where':{'ListId':_0x493614[_0x9bc0('0x3c')]['ids'],'VoiceQueueId':_0x493614[_0x9bc0('0x4e')]['id']}})['then'](function(){return _0x596f69;});}})[_0x9bc0('0x27')](respondWithStatusCode(_0xdf5e26,null))['catch'](handleError(_0xdf5e26,null));};exports[_0x9bc0('0xb5')]=function(_0x25bf27,_0x4cf9fd,_0xf3d33b){var _0x2fef00={};var _0x4c359a={};var _0x434379;var _0x3bc670;return db[_0x9bc0('0x39')][_0x9bc0('0x61')]({'where':{'id':_0x25bf27[_0x9bc0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4cf9fd,null))[_0x9bc0('0x27')](function(_0x2204d3){if(_0x2204d3){_0x434379=_0x2204d3;_0x4c359a[_0x9bc0('0x40')]=_['keys'](db[_0x9bc0('0x9f')][_0x9bc0('0x3a')]);_0x4c359a[_0x9bc0('0x3c')]=_[_0x9bc0('0x3d')](_0x25bf27[_0x9bc0('0x3c')]);_0x4c359a[_0x9bc0('0x3e')]=_[_0x9bc0('0x3f')](_0x4c359a[_0x9bc0('0x40')],_0x4c359a[_0x9bc0('0x3c')]);_0x2fef00[_0x9bc0('0x42')]=_['intersection'](_0x4c359a[_0x9bc0('0x40')],qs[_0x9bc0('0x41')](_0x25bf27[_0x9bc0('0x3c')][_0x9bc0('0x41')]));_0x2fef00[_0x9bc0('0x42')]=_0x2fef00[_0x9bc0('0x42')][_0x9bc0('0x4f')]?_0x2fef00['attributes']:_0x4c359a[_0x9bc0('0x40')];_0x2fef00[_0x9bc0('0x63')]=qs[_0x9bc0('0x45')](_0x25bf27['query'][_0x9bc0('0x45')]);_0x2fef00[_0x9bc0('0x48')]=qs[_0x9bc0('0x3e')](_[_0x9bc0('0x46')](_0x25bf27['query'],_0x4c359a[_0x9bc0('0x3e')]));if(_0x25bf27[_0x9bc0('0x3c')][_0x9bc0('0x47')]){_0x2fef00[_0x9bc0('0x48')]=_[_0x9bc0('0x49')](_0x2fef00[_0x9bc0('0x48')],{'$or':_[_0x9bc0('0x2f')](_0x2fef00[_0x9bc0('0x42')],function(_0x2d61c7){var _0x5b0e7a={};_0x5b0e7a[_0x2d61c7]={'$like':'%'+_0x25bf27['query'][_0x9bc0('0x47')]+'%'};return _0x5b0e7a;})});}_0x2fef00=_['merge']({},_0x2fef00,_0x25bf27[_0x9bc0('0x64')]);return _0x434379['getBlackLists'](_0x2fef00);}})[_0x9bc0('0x27')](function(_0xcc14a4){if(_0xcc14a4){_0x3bc670=_0xcc14a4[_0x9bc0('0x4f')];if(!_0x25bf27[_0x9bc0('0x3c')][_0x9bc0('0x43')](_0x9bc0('0x44'))){_0x2fef00[_0x9bc0('0x21')]=qs[_0x9bc0('0x21')](_0x25bf27[_0x9bc0('0x3c')][_0x9bc0('0x21')]);_0x2fef00[_0x9bc0('0x20')]=qs[_0x9bc0('0x20')](_0x25bf27[_0x9bc0('0x3c')][_0x9bc0('0x20')]);}return _0x434379[_0x9bc0('0xb5')](_0x2fef00);}})[_0x9bc0('0x27')](function(_0x132cac){if(_0x132cac){return _0x132cac?{'count':_0x3bc670,'rows':_0x132cac}:null;}})[_0x9bc0('0x27')](respondWithResult(_0x4cf9fd,null))[_0x9bc0('0x4c')](handleError(_0x4cf9fd,null));};exports[_0x9bc0('0xb6')]=function(_0x4995cb,_0x53cb6b,_0x32685a){var _0x4c8d39,_0x18b49a;return db[_0x9bc0('0x39')][_0x9bc0('0x51')]({'where':{'id':_0x4995cb['params']['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0x53cb6b,null))[_0x9bc0('0x27')](function(_0x2559c1){if(_0x2559c1){_0x18b49a=_0x2559c1;return _0x2559c1[_0x9bc0('0xb6')](_0x4995cb['body'][_0x9bc0('0x80')],_[_0x9bc0('0x5a')](_0x4995cb[_0x9bc0('0x53')],['ids','id'])||{});}return null;})['spread'](function(_0x5e8e93){var _0x41aded;_0x4c8d39=_0x5e8e93||[];var _0x412773=[];if(_0x5e8e93){for(var _0x334e10=0x0;_0x334e10<_0x5e8e93[_0x9bc0('0x4f')];_0x334e10+=0x1){var _0x552179=_0x5e8e93[_0x334e10][_0x9bc0('0x29')]({'plain':!![]});_0x41aded=squel['insert']()['into'](_0x9bc0('0xb7'))[_0x9bc0('0xa5')](['phone','ContactId',_0x9bc0('0xa9'),_0x9bc0('0x67'),_0x9bc0('0x5c'),'updatedAt'],squel['select']()[_0x9bc0('0x83')](_0x9bc0('0xa6'),_0x9bc0('0xa6'))[_0x9bc0('0x83')]('id',_0x9bc0('0xa8'))['field'](_0x552179[_0x9bc0('0xb3')]['toString'](),_0x9bc0('0xa9'))['field'](_0x4995cb['params']['id'][_0x9bc0('0x8b')](),'VoiceQueueId')[_0x9bc0('0x83')](_0x9bc0('0xaa'),'createdAt')['field'](_0x9bc0('0xaa'),_0x9bc0('0x5b'))['from'](_0x9bc0('0xab'))[_0x9bc0('0x48')]('deletedAt\x20IS\x20NULL')['where'](_0x9bc0('0xad'),_0x552179[_0x9bc0('0xb3')][_0x9bc0('0x8b')]())[_0x9bc0('0x48')](_0x9bc0('0xae')))['toString']();_0x412773['push'](db[_0x9bc0('0x8a')][_0x9bc0('0x3c')](_0x41aded));}return BPromise[_0x9bc0('0x8f')](_0x412773);}})[_0x9bc0('0x27')](function(){return _0x4c8d39;})[_0x9bc0('0x27')](respondWithResult(_0x53cb6b,null))[_0x9bc0('0x4c')](handleError(_0x53cb6b,null));};exports['removeBlackLists']=function(_0xe2c3d4,_0x573f24,_0xffd24e){return db[_0x9bc0('0x39')]['find']({'where':{'id':_0xe2c3d4[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](handleEntityNotFound(_0x573f24,null))[_0x9bc0('0x27')](function(_0x481d50){if(_0x481d50){return _0x481d50[_0x9bc0('0xb8')](_0xe2c3d4[_0x9bc0('0x3c')][_0x9bc0('0x80')]);}})[_0x9bc0('0x27')](function(_0x29b0b5){if(_0x29b0b5){return db[_0x9bc0('0x6b')][_0x9bc0('0x28')]({'where':{'ListId':_0xe2c3d4[_0x9bc0('0x3c')][_0x9bc0('0x80')],'VoiceQueueId':_0xe2c3d4[_0x9bc0('0x4e')]['id']}})[_0x9bc0('0x27')](function(){return _0x29b0b5;});}})[_0x9bc0('0x27')](respondWithStatusCode(_0x573f24,null))[_0x9bc0('0x4c')](handleError(_0x573f24,null));}; \ No newline at end of file +var _0xe982=['QueueCampaigns','outbound','filter','ignore','map','value','includes','find','type','UserProfileResource','error','stack','name','send','index','VoiceQueue','rawAttributes','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','create','user','get','UserProfileSection','userProfileId','autoAssociation','clone','options','omit','createdAt','updatedAt','body','includeAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmHopper','nolimit','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','voicePause','flatMap','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','VoiceQueueId\x20=\x20?','push','SELECT','TeamId','all','union','compact','userVoiceQueue:remove','addAgents','online','isEmpty','upsert','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','insert','cm_hopper','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','inbound'];(function(_0x71a218,_0x4d23eb){var _0x2cfe7d=function(_0x4bdebf){while(--_0x4bdebf){_0x71a218['push'](_0x71a218['shift']());}};_0x2cfe7d(++_0x4d23eb);}(_0xe982,0x141));var _0x2e98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe982[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x2e98('0x0'));var emlformat=require(_0x2e98('0x1'));var rimraf=require(_0x2e98('0x2'));var zipdir=require(_0x2e98('0x3'));var jsonpatch=require(_0x2e98('0x4'));var rp=require(_0x2e98('0x5'));var moment=require(_0x2e98('0x6'));var BPromise=require(_0x2e98('0x7'));var Mustache=require(_0x2e98('0x8'));var util=require(_0x2e98('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x2e98('0xa'));var ejs=require(_0x2e98('0xb'));var fs=require('fs');var _=require(_0x2e98('0xc'));var squel=require(_0x2e98('0xd'));var crypto=require(_0x2e98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2e98('0xf'));var toCsv=require(_0x2e98('0xa'));var querystring=require(_0x2e98('0x10'));var Papa=require(_0x2e98('0x11'));var Redis=require('ioredis');var authService=require(_0x2e98('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2e98('0x13'));var hardwareService=require(_0x2e98('0x14'));var logger=require(_0x2e98('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2e98('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e98('0x17'))['db'];config[_0x2e98('0x18')]=_[_0x2e98('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2e98('0x1a'))(new Redis(config[_0x2e98('0x18')]));require(_0x2e98('0x1b'))['register'](socket);function respondWithStatusCode(_0x30e777,_0x3f2fcf){_0x3f2fcf=_0x3f2fcf||0xcc;return function(_0x163c41){if(_0x163c41){return _0x30e777[_0x2e98('0x1c')](_0x3f2fcf);}return _0x30e777[_0x2e98('0x1d')](_0x3f2fcf)[_0x2e98('0x1e')]();};}function respondWithResult(_0x39e9a1,_0x53476f){_0x53476f=_0x53476f||0xc8;return function(_0x554882){if(_0x554882){return _0x39e9a1['status'](_0x53476f)[_0x2e98('0x1f')](_0x554882);}};}function respondWithFilteredResult(_0x3584a5,_0xb024db){return function(_0x23a706){if(_0x23a706){var _0x643011=_0x23a706[_0x2e98('0x20')],_0x311ce1=_0xb024db[_0x2e98('0x21')],_0xc6cc5=_0xb024db['offset']+_0xb024db[_0x2e98('0x22')],_0xa7070e;if(_0xc6cc5>=_0x643011){_0xc6cc5=_0x643011;_0xa7070e=0xc8;}else{_0xa7070e=0xce;}_0x3584a5[_0x2e98('0x1d')](_0xa7070e);return _0x3584a5[_0x2e98('0x23')](_0x2e98('0x24'),_0x311ce1+'-'+_0xc6cc5+'/'+_0x643011)[_0x2e98('0x1f')](_0x23a706);}return null;};}function patchUpdates(_0x6dac1){return function(_0x1d892c){try{jsonpatch[_0x2e98('0x25')](_0x1d892c,_0x6dac1,!![]);}catch(_0x47cdd9){return BPromise[_0x2e98('0x26')](_0x47cdd9);}return _0x1d892c[_0x2e98('0x27')]();};}function saveUpdates(_0x180c00,_0x4477ad){return function(_0x20f12b){if(_0x20f12b){return _0x20f12b[_0x2e98('0x28')](_0x180c00)[_0x2e98('0x29')](function(_0x213a65){return _0x213a65;});}return null;};}function removeEntity(_0x482b43,_0x383feb){return function(_0x2601d3){if(_0x2601d3){return _0x2601d3[_0x2e98('0x2a')]()[_0x2e98('0x29')](function(){var _0x19efad=_0x2601d3['get']({'plain':!![]});var _0x16eb0d=[{'name':_0x2e98('0x2b'),'value':_0x2e98('0x2c'),'ignore':![]},{'name':_0x2e98('0x2d'),'value':_0x2e98('0x2e'),'ignore':![]}];var _0x1f97c5=_(_0x16eb0d)[_0x2e98('0x2f')](_0x2e98('0x30'))[_0x2e98('0x31')](_0x2e98('0x32'))[_0x2e98('0x32')]();if(_[_0x2e98('0x33')](_0x1f97c5,_0x19efad['type'])){return;}var _0x4e9a99=_[_0x2e98('0x34')](_0x16eb0d,[_0x2e98('0x32'),_0x19efad[_0x2e98('0x35')]])['name'];return db[_0x2e98('0x36')][_0x2e98('0x2a')]({'where':{'type':_0x4e9a99,'resourceId':_0x19efad['id']}})[_0x2e98('0x29')](function(){return _0x2601d3;});})[_0x2e98('0x29')](function(){_0x482b43[_0x2e98('0x1d')](0xcc)[_0x2e98('0x1e')]();});}};}function handleEntityNotFound(_0x1233fc,_0x29576b){return function(_0x871f89){if(!_0x871f89){_0x1233fc['sendStatus'](0x194);}return _0x871f89;};}function handleError(_0x265c32,_0x382c97){_0x382c97=_0x382c97||0x1f4;return function(_0x4734d0){logger[_0x2e98('0x37')](_0x4734d0[_0x2e98('0x38')]);if(_0x4734d0['name']){delete _0x4734d0[_0x2e98('0x39')];}_0x265c32['status'](_0x382c97)[_0x2e98('0x3a')](_0x4734d0);};}exports[_0x2e98('0x3b')]=function(_0x7700a1,_0x519fe5){var _0x3434b0={},_0x2ec47d={},_0x4a0616={'count':0x0,'rows':[]};var _0x330f5c=_[_0x2e98('0x31')](db[_0x2e98('0x3c')][_0x2e98('0x3d')],function(_0x25b109){return{'name':_0x25b109['fieldName'],'type':_0x25b109['type'][_0x2e98('0x3e')]};});_0x2ec47d['model']=_[_0x2e98('0x31')](_0x330f5c,_0x2e98('0x39'));_0x2ec47d['query']=_[_0x2e98('0x3f')](_0x7700a1['query']);_0x2ec47d[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x2ec47d[_0x2e98('0x42')],_0x2ec47d[_0x2e98('0x43')]);_0x3434b0[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x2ec47d[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x7700a1[_0x2e98('0x43')][_0x2e98('0x45')]));_0x3434b0['attributes']=_0x3434b0[_0x2e98('0x44')]['length']?_0x3434b0[_0x2e98('0x44')]:_0x2ec47d['model'];if(!_0x7700a1[_0x2e98('0x43')][_0x2e98('0x46')]('nolimit')){_0x3434b0[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x7700a1[_0x2e98('0x43')][_0x2e98('0x22')]);_0x3434b0[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x7700a1[_0x2e98('0x43')]['offset']);}_0x3434b0[_0x2e98('0x47')]=qs[_0x2e98('0x48')](_0x7700a1[_0x2e98('0x43')]['sort']);_0x3434b0[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_['pick'](_0x7700a1[_0x2e98('0x43')],_0x2ec47d['filters']),_0x330f5c);if(_0x7700a1[_0x2e98('0x43')][_0x2e98('0x2f')]){_0x3434b0[_0x2e98('0x49')]=_[_0x2e98('0x4a')](_0x3434b0[_0x2e98('0x49')],{'$or':_['map'](_0x330f5c,function(_0x3cbd24){if(_0x3cbd24[_0x2e98('0x35')]!==_0x2e98('0x4b')){var _0x2700a2={};_0x2700a2[_0x3cbd24[_0x2e98('0x39')]]={'$like':'%'+_0x7700a1['query']['filter']+'%'};return _0x2700a2;}})});}_0x3434b0=_[_0x2e98('0x4a')]({},_0x3434b0,_0x7700a1['options']);var _0x392704={'where':_0x3434b0[_0x2e98('0x49')]};return db[_0x2e98('0x3c')][_0x2e98('0x20')](_0x392704)[_0x2e98('0x29')](function(_0x2ae188){_0x4a0616['count']=_0x2ae188;if(_0x7700a1[_0x2e98('0x43')]['includeAll']){_0x3434b0[_0x2e98('0x4c')]=[{'all':!![]}];}return db['VoiceQueue'][_0x2e98('0x4d')](_0x3434b0);})[_0x2e98('0x29')](function(_0x90d602){_0x4a0616[_0x2e98('0x4e')]=_0x90d602;return _0x4a0616;})[_0x2e98('0x29')](respondWithFilteredResult(_0x519fe5,_0x3434b0))[_0x2e98('0x4f')](handleError(_0x519fe5,null));};exports[_0x2e98('0x50')]=function(_0x510326,_0x1554e3){var _0x106f12={'raw':![],'where':{'id':_0x510326[_0x2e98('0x51')]['id']}},_0x3d88b0={};_0x3d88b0['model']=_['keys'](db['VoiceQueue'][_0x2e98('0x3d')]);_0x3d88b0[_0x2e98('0x43')]=_['keys'](_0x510326[_0x2e98('0x43')]);_0x3d88b0[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x3d88b0[_0x2e98('0x42')],_0x3d88b0[_0x2e98('0x43')]);_0x106f12[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x3d88b0['model'],qs[_0x2e98('0x45')](_0x510326[_0x2e98('0x43')]['fields']));_0x106f12[_0x2e98('0x44')]=_0x106f12['attributes'][_0x2e98('0x52')]?_0x106f12['attributes']:_0x3d88b0['model'];if(_0x510326[_0x2e98('0x43')]['includeAll']){_0x106f12[_0x2e98('0x4c')]=[{'all':!![]}];}_0x106f12=_[_0x2e98('0x4a')]({},_0x106f12,_0x510326['options']);return db[_0x2e98('0x3c')][_0x2e98('0x34')](_0x106f12)['then'](handleEntityNotFound(_0x1554e3,null))[_0x2e98('0x29')](respondWithResult(_0x1554e3,null))[_0x2e98('0x4f')](handleError(_0x1554e3,null));};exports[_0x2e98('0x53')]=function(_0x40cfdd,_0x3125ba){return db[_0x2e98('0x3c')]['create'](_0x40cfdd['body'],{})[_0x2e98('0x29')](function(_0x2ec360){var _0x3dea45=_0x40cfdd[_0x2e98('0x54')][_0x2e98('0x55')]({'plain':!![]});if(!_0x3dea45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dea45['role']===_0x2e98('0x54')){var _0x470085=_0x2ec360[_0x2e98('0x55')]({'plain':!![]});var _0x3da7fa=[{'name':_0x2e98('0x2b'),'value':_0x2e98('0x2c')},{'name':_0x2e98('0x2d'),'value':'outbound'}];var _0x28bb29=_[_0x2e98('0x34')](_0x3da7fa,['value',_0x470085[_0x2e98('0x35')]])[_0x2e98('0x39')];return db[_0x2e98('0x56')]['find']({'where':{'name':_0x28bb29,'userProfileId':_0x3dea45[_0x2e98('0x57')]},'raw':!![]})[_0x2e98('0x29')](function(_0x471d38){if(_0x471d38&&_0x471d38[_0x2e98('0x58')]===0x0){return db[_0x2e98('0x36')][_0x2e98('0x53')]({'name':_0x470085[_0x2e98('0x39')],'resourceId':_0x470085['id'],'type':_0x471d38[_0x2e98('0x39')],'sectionId':_0x471d38['id']},{})[_0x2e98('0x29')](function(){return _0x2ec360;});}else{return _0x2ec360;}})[_0x2e98('0x4f')](function(_0x232e87){logger[_0x2e98('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x232e87);throw _0x232e87;});}return _0x2ec360;})[_0x2e98('0x29')](respondWithResult(_0x3125ba,0xc9))[_0x2e98('0x4f')](handleError(_0x3125ba,null));};exports[_0x2e98('0x59')]=function(_0x1f3879,_0x4c5d62){var _0x157099={'where':{'id':_0x1f3879['params']['id']}},_0x585aac={};_0x585aac[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db['VoiceQueue'][_0x2e98('0x3d')]);_0x157099[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x585aac[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x1f3879[_0x2e98('0x43')][_0x2e98('0x45')]));_0x157099[_0x2e98('0x44')]=_0x157099[_0x2e98('0x44')]['length']?_0x157099[_0x2e98('0x44')]:_0x585aac['model'];if(_0x1f3879['query']['includeAll']){_0x157099[_0x2e98('0x4c')]=[{'all':!![]}];}_0x157099=_['merge']({},_0x157099,_0x1f3879[_0x2e98('0x5a')]);return db[_0x2e98('0x3c')][_0x2e98('0x34')](_0x157099)[_0x2e98('0x29')](handleEntityNotFound(_0x4c5d62,null))[_0x2e98('0x29')](function(_0x52e6a2){if(_0x52e6a2){var _0x2e100a=_0x52e6a2[_0x2e98('0x55')]({'plain':!![]});_0x2e100a=qs[_0x2e98('0x5b')](_0x2e100a,['id',_0x2e98('0x5c'),_0x2e98('0x5d')]);_0x1f3879[_0x2e98('0x5e')]=_[_0x2e98('0x5b')](_0x1f3879[_0x2e98('0x5e')],['id',_0x2e98('0x5c'),_0x2e98('0x5d')]);return db[_0x2e98('0x3c')][_0x2e98('0x53')](_['merge'](_0x2e100a,_0x1f3879['body']),{'include':_0x1f3879['query'][_0x2e98('0x5f')]?[{'all':!![]}]:undefined})[_0x2e98('0x29')](function(_0x49bfbf){var _0xf02768=_0x1f3879[_0x2e98('0x54')][_0x2e98('0x55')]({'plain':!![]});if(!_0xf02768)throw new Error(_0x2e98('0x60'));if(_0xf02768[_0x2e98('0x61')]===_0x2e98('0x54')){var _0x4ee0ab=_0x49bfbf[_0x2e98('0x55')]({'plain':!![]});var _0x3e404f=[{'name':_0x2e98('0x2b'),'value':'inbound'},{'name':_0x2e98('0x2d'),'value':'outbound'}];var _0x340cf6=_[_0x2e98('0x34')](_0x3e404f,[_0x2e98('0x32'),_0x4ee0ab[_0x2e98('0x35')]])[_0x2e98('0x39')];return db['UserProfileSection']['find']({'where':{'name':_0x340cf6,'userProfileId':_0xf02768[_0x2e98('0x57')]},'raw':!![]})['then'](function(_0x5bcec6){if(_0x5bcec6&&_0x5bcec6[_0x2e98('0x58')]===0x0){return db[_0x2e98('0x36')]['create']({'name':_0x4ee0ab[_0x2e98('0x39')],'resourceId':_0x4ee0ab['id'],'type':_0x5bcec6['name'],'sectionId':_0x5bcec6['id']},{})['then'](function(){return _0x49bfbf;});}else{return _0x49bfbf;}})[_0x2e98('0x4f')](function(_0xfcfe05){logger[_0x2e98('0x37')](_0x2e98('0x62'),_0xfcfe05);throw _0xfcfe05;});}return _0x49bfbf;});}})['then'](respondWithResult(_0x4c5d62,0xc9))[_0x2e98('0x4f')](handleError(_0x4c5d62,null));};exports[_0x2e98('0x28')]=function(_0x1d0353,_0x36693b){if(_0x1d0353[_0x2e98('0x5e')]['id']){delete _0x1d0353[_0x2e98('0x5e')]['id'];}return db['VoiceQueue'][_0x2e98('0x34')]({'where':{'id':_0x1d0353['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x36693b,null))[_0x2e98('0x29')](saveUpdates(_0x1d0353[_0x2e98('0x5e')],null))[_0x2e98('0x29')](respondWithResult(_0x36693b,null))['catch'](handleError(_0x36693b,null));};exports[_0x2e98('0x2a')]=function(_0x27e686,_0x5e1576){return db['VoiceQueue'][_0x2e98('0x34')]({'where':{'id':_0x27e686['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x5e1576,null))[_0x2e98('0x29')](removeEntity(_0x5e1576,null))['catch'](handleError(_0x5e1576,null));};exports['getHoppers']=function(_0x22e675,_0x110467,_0x285b61){var _0x1c947e={'raw':![],'where':{}};var _0x37df63={};var _0xefabfe={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x22e675['params']['id']}})['then'](handleEntityNotFound(_0x110467,null))[_0x2e98('0x29')](function(_0x53b352){if(_0x53b352){_0x37df63[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db[_0x2e98('0x63')][_0x2e98('0x3d')]);_0x37df63[_0x2e98('0x43')]=_['keys'](_0x22e675[_0x2e98('0x43')]);_0x37df63[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x37df63[_0x2e98('0x42')],_0x37df63['query']);_0x1c947e[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x37df63['model'],qs[_0x2e98('0x45')](_0x22e675[_0x2e98('0x43')][_0x2e98('0x45')]));_0x1c947e[_0x2e98('0x44')]=_0x1c947e[_0x2e98('0x44')][_0x2e98('0x52')]?_0x1c947e[_0x2e98('0x44')]:_0x37df63[_0x2e98('0x42')];if(!_0x22e675[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x1c947e[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x22e675[_0x2e98('0x43')][_0x2e98('0x22')]);_0x1c947e[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x22e675[_0x2e98('0x43')]['offset']);}_0x1c947e['order']=qs[_0x2e98('0x48')](_0x22e675['query']['sort']);_0x1c947e['where']=qs[_0x2e98('0x40')](_[_0x2e98('0x65')](_0x22e675['query'],_0x37df63[_0x2e98('0x40')]));_0x1c947e[_0x2e98('0x49')][_0x2e98('0x66')]=_0x53b352['id'];if(_0x22e675[_0x2e98('0x43')]['filter']){_0x1c947e[_0x2e98('0x49')]=_[_0x2e98('0x4a')](_0x1c947e[_0x2e98('0x49')],{'$or':_['map'](_0x1c947e['attributes'],function(_0x1b460e){var _0xec1982={};_0xec1982[_0x1b460e]={'$like':'%'+_0x22e675[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0xec1982;})});}_0x1c947e=_['merge']({},_0x1c947e,_0x22e675[_0x2e98('0x5a')]);return db[_0x2e98('0x63')]['count']({'where':_0x1c947e['where']})[_0x2e98('0x29')](function(_0x4e21e5){_0xefabfe[_0x2e98('0x20')]=_0x4e21e5;if(_0x22e675[_0x2e98('0x43')][_0x2e98('0x5f')]){_0x1c947e[_0x2e98('0x4c')]=[{'all':!![]}];}return db[_0x2e98('0x63')][_0x2e98('0x4d')](_0x1c947e);})[_0x2e98('0x29')](function(_0x15459c){_0xefabfe['rows']=_0x15459c;return _0xefabfe;});}})[_0x2e98('0x29')](respondWithFilteredResult(_0x110467,_0x1c947e))[_0x2e98('0x4f')](handleError(_0x110467,null));};exports[_0x2e98('0x67')]=function(_0x2c5dcb,_0x4f393a,_0x29cd2b){var _0x151f9c={'raw':!![],'where':{}};var _0x297d1c={};var _0x32a9d6={'count':0x0,'rows':[]};return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0x2c5dcb[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x4f393a,null))['then'](function(_0x3c34f2){if(_0x3c34f2){_0x297d1c['model']=_[_0x2e98('0x3f')](db[_0x2e98('0x69')]['rawAttributes']);_0x297d1c[_0x2e98('0x43')]=_[_0x2e98('0x3f')](_0x2c5dcb[_0x2e98('0x43')]);_0x297d1c[_0x2e98('0x40')]=_['intersection'](_0x297d1c[_0x2e98('0x42')],_0x297d1c[_0x2e98('0x43')]);_0x151f9c['attributes']=_[_0x2e98('0x41')](_0x297d1c[_0x2e98('0x42')],qs['fields'](_0x2c5dcb[_0x2e98('0x43')]['fields']));_0x151f9c['attributes']=_0x151f9c[_0x2e98('0x44')][_0x2e98('0x52')]?_0x151f9c[_0x2e98('0x44')]:_0x297d1c[_0x2e98('0x42')];if(!_0x2c5dcb[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x151f9c['limit']=qs[_0x2e98('0x22')](_0x2c5dcb[_0x2e98('0x43')][_0x2e98('0x22')]);_0x151f9c[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x2c5dcb[_0x2e98('0x43')][_0x2e98('0x21')]);}_0x151f9c[_0x2e98('0x47')]=qs[_0x2e98('0x48')](_0x2c5dcb[_0x2e98('0x43')][_0x2e98('0x48')]);_0x151f9c[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_[_0x2e98('0x65')](_0x2c5dcb[_0x2e98('0x43')],_0x297d1c[_0x2e98('0x40')]));_0x151f9c[_0x2e98('0x49')]['VoiceQueueId']=_0x3c34f2['id'];if(_0x2c5dcb[_0x2e98('0x43')]['filter']){_0x151f9c[_0x2e98('0x49')]=_['merge'](_0x151f9c[_0x2e98('0x49')],{'$or':_[_0x2e98('0x31')](_0x151f9c[_0x2e98('0x44')],function(_0x57fbf0){var _0x53d984={};_0x53d984[_0x57fbf0]={'$like':'%'+_0x2c5dcb[_0x2e98('0x43')]['filter']+'%'};return _0x53d984;})});}_0x151f9c=_[_0x2e98('0x4a')]({},_0x151f9c,_0x2c5dcb[_0x2e98('0x5a')]);return db[_0x2e98('0x69')][_0x2e98('0x20')]({'where':_0x151f9c[_0x2e98('0x49')]})[_0x2e98('0x29')](function(_0x11ed77){_0x32a9d6[_0x2e98('0x20')]=_0x11ed77;if(_0x2c5dcb[_0x2e98('0x43')]['includeAll']){_0x151f9c['include']=[{'all':!![]}];}return db[_0x2e98('0x69')][_0x2e98('0x4d')](_0x151f9c);})[_0x2e98('0x29')](function(_0x3a9056){_0x32a9d6[_0x2e98('0x4e')]=_0x3a9056;return _0x32a9d6;});}})[_0x2e98('0x29')](respondWithFilteredResult(_0x4f393a,_0x151f9c))[_0x2e98('0x4f')](handleError(_0x4f393a,null));};exports[_0x2e98('0x6a')]=function(_0xf0ee1c,_0x177ccb,_0x4450ac){var _0xe22d88={'raw':!![],'where':{}};var _0x17d11e={};var _0x4d9918={'count':0x0,'rows':[]};return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0xf0ee1c[_0x2e98('0x51')]['id']}})['then'](handleEntityNotFound(_0x177ccb,null))[_0x2e98('0x29')](function(_0x549f0d){if(_0x549f0d){_0x17d11e[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db[_0x2e98('0x6b')][_0x2e98('0x3d')]);_0x17d11e[_0x2e98('0x43')]=_['keys'](_0xf0ee1c[_0x2e98('0x43')]);_0x17d11e[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x17d11e[_0x2e98('0x42')],_0x17d11e[_0x2e98('0x43')]);_0xe22d88[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x17d11e[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0xf0ee1c[_0x2e98('0x43')][_0x2e98('0x45')]));_0xe22d88['attributes']=_0xe22d88[_0x2e98('0x44')][_0x2e98('0x52')]?_0xe22d88[_0x2e98('0x44')]:_0x17d11e['model'];if(!_0xf0ee1c[_0x2e98('0x43')]['hasOwnProperty'](_0x2e98('0x64'))){_0xe22d88[_0x2e98('0x22')]=qs['limit'](_0xf0ee1c[_0x2e98('0x43')][_0x2e98('0x22')]);_0xe22d88[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0xf0ee1c[_0x2e98('0x43')][_0x2e98('0x21')]);}_0xe22d88['order']=qs['sort'](_0xf0ee1c['query'][_0x2e98('0x48')]);_0xe22d88[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_[_0x2e98('0x65')](_0xf0ee1c[_0x2e98('0x43')],_0x17d11e[_0x2e98('0x40')]));_0xe22d88[_0x2e98('0x49')][_0x2e98('0x66')]=_0x549f0d['id'];if(_0xf0ee1c['query'][_0x2e98('0x2f')]){_0xe22d88['where']=_[_0x2e98('0x4a')](_0xe22d88[_0x2e98('0x49')],{'$or':_['map'](_0xe22d88['attributes'],function(_0x142e78){var _0x4e8543={};_0x4e8543[_0x142e78]={'$like':'%'+_0xf0ee1c['query'][_0x2e98('0x2f')]+'%'};return _0x4e8543;})});}_0xe22d88=_[_0x2e98('0x4a')]({},_0xe22d88,_0xf0ee1c[_0x2e98('0x5a')]);return db[_0x2e98('0x6b')]['count']({'where':_0xe22d88['where']})[_0x2e98('0x29')](function(_0x2ef4d6){_0x4d9918['count']=_0x2ef4d6;if(_0xf0ee1c[_0x2e98('0x43')][_0x2e98('0x5f')]){_0xe22d88[_0x2e98('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0xe22d88);})['then'](function(_0x252359){_0x4d9918[_0x2e98('0x4e')]=_0x252359;return _0x4d9918;});}})[_0x2e98('0x29')](respondWithFilteredResult(_0x177ccb,_0xe22d88))[_0x2e98('0x4f')](handleError(_0x177ccb,null));};exports['getHopperBlacks']=function(_0x45b1b4,_0x55d02c,_0x4ddfb5){var _0x486d7d={'raw':!![],'where':{}};var _0x1b2caf={};var _0x57656e={'count':0x0,'rows':[]};return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0x45b1b4[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x55d02c,null))[_0x2e98('0x29')](function(_0xd6630c){if(_0xd6630c){_0x1b2caf[_0x2e98('0x42')]=_['keys'](db[_0x2e98('0x6c')][_0x2e98('0x3d')]);_0x1b2caf[_0x2e98('0x43')]=_[_0x2e98('0x3f')](_0x45b1b4[_0x2e98('0x43')]);_0x1b2caf[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x1b2caf[_0x2e98('0x42')],_0x1b2caf['query']);_0x486d7d['attributes']=_[_0x2e98('0x41')](_0x1b2caf[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x45b1b4['query'][_0x2e98('0x45')]));_0x486d7d[_0x2e98('0x44')]=_0x486d7d[_0x2e98('0x44')][_0x2e98('0x52')]?_0x486d7d[_0x2e98('0x44')]:_0x1b2caf[_0x2e98('0x42')];if(!_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x46')]('nolimit')){_0x486d7d[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x45b1b4['query'][_0x2e98('0x22')]);_0x486d7d[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x45b1b4[_0x2e98('0x43')]['offset']);}_0x486d7d['order']=qs[_0x2e98('0x48')](_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x48')]);_0x486d7d['where']=qs[_0x2e98('0x40')](_['pick'](_0x45b1b4['query'],_0x1b2caf[_0x2e98('0x40')]));_0x486d7d[_0x2e98('0x49')][_0x2e98('0x66')]=_0xd6630c['id'];if(_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x2f')]){_0x486d7d[_0x2e98('0x49')]=_['merge'](_0x486d7d[_0x2e98('0x49')],{'$or':_[_0x2e98('0x31')](_0x486d7d[_0x2e98('0x44')],function(_0x4c5f87){var _0x1459a0={};_0x1459a0[_0x4c5f87]={'$like':'%'+_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0x1459a0;})});}_0x486d7d=_[_0x2e98('0x4a')]({},_0x486d7d,_0x45b1b4[_0x2e98('0x5a')]);return db[_0x2e98('0x6c')]['count']({'where':_0x486d7d[_0x2e98('0x49')]})[_0x2e98('0x29')](function(_0x414fe2){_0x57656e[_0x2e98('0x20')]=_0x414fe2;if(_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x5f')]){_0x486d7d['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x2e98('0x4d')](_0x486d7d);})['then'](function(_0x3a4d0f){_0x57656e[_0x2e98('0x4e')]=_0x3a4d0f;return _0x57656e;});}})[_0x2e98('0x29')](respondWithFilteredResult(_0x55d02c,_0x486d7d))[_0x2e98('0x4f')](handleError(_0x55d02c,null));};exports['getTeams']=function(_0xa3c075,_0x4a24bd,_0x59a727){var _0x5c1a75={};var _0x4294ec={};var _0x498010;var _0x1e87e2;return db['VoiceQueue'][_0x2e98('0x68')]({'where':{'id':_0xa3c075['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x4a24bd,null))['then'](function(_0x3bf480){if(_0x3bf480){_0x498010=_0x3bf480;_0x4294ec['model']=_['keys'](db['Team'][_0x2e98('0x3d')]);_0x4294ec[_0x2e98('0x43')]=_[_0x2e98('0x3f')](_0xa3c075[_0x2e98('0x43')]);_0x4294ec[_0x2e98('0x40')]=_['intersection'](_0x4294ec['model'],_0x4294ec['query']);_0x5c1a75[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x4294ec[_0x2e98('0x42')],qs['fields'](_0xa3c075[_0x2e98('0x43')]['fields']));_0x5c1a75['attributes']=_0x5c1a75[_0x2e98('0x44')][_0x2e98('0x52')]?_0x5c1a75[_0x2e98('0x44')]:_0x4294ec[_0x2e98('0x42')];_0x5c1a75[_0x2e98('0x47')]=qs[_0x2e98('0x48')](_0xa3c075[_0x2e98('0x43')][_0x2e98('0x48')]);_0x5c1a75[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_['pick'](_0xa3c075['query'],_0x4294ec['filters']));if(_0xa3c075['query'][_0x2e98('0x2f')]){_0x5c1a75[_0x2e98('0x49')]=_[_0x2e98('0x4a')](_0x5c1a75['where'],{'$or':_[_0x2e98('0x31')](_0x5c1a75[_0x2e98('0x44')],function(_0x2614c0){var _0x3f091f={};_0x3f091f[_0x2614c0]={'$like':'%'+_0xa3c075[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0x3f091f;})});}_0x5c1a75=_[_0x2e98('0x4a')]({},_0x5c1a75,_0xa3c075[_0x2e98('0x5a')]);return _0x498010[_0x2e98('0x6d')](_0x5c1a75);}})[_0x2e98('0x29')](function(_0x13448b){if(_0x13448b){_0x1e87e2=_0x13448b['length'];if(!_0xa3c075[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x5c1a75[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0xa3c075[_0x2e98('0x43')]['limit']);_0x5c1a75[_0x2e98('0x21')]=qs['offset'](_0xa3c075[_0x2e98('0x43')][_0x2e98('0x21')]);}return _0x498010['getTeams'](_0x5c1a75);}})[_0x2e98('0x29')](function(_0x384c78){if(_0x384c78){return _0x384c78?{'count':_0x1e87e2,'rows':_0x384c78}:null;}})['then'](respondWithResult(_0x4a24bd,null))[_0x2e98('0x4f')](handleError(_0x4a24bd,null));};exports[_0x2e98('0x6e')]=function(_0x2c30ea,_0x27c0ce,_0x4d7980){var _0x48b479=_0x2c30ea[_0x2e98('0x5e')][_0x2e98('0x6f')];var _0x169d61=_['map'](_0x48b479,'id');return db[_0x2e98('0x70')][_0x2e98('0x4d')]({'where':{'id':_0x169d61},'attributes':['id'],'include':[{'model':db[_0x2e98('0x71')],'as':_0x2e98('0x72'),'attributes':['id',_0x2e98('0x39'),'online',_0x2e98('0x73'),'interface'],'raw':!![]}]})[_0x2e98('0x29')](function(_0x445d06){if(_0x445d06){var _0xb37ecf=_[_0x2e98('0x74')](_0x445d06,function(_0x121707){var _0x5503c2=_0x121707['get']({'plain':!![]});_0x5503c2[_0x2e98('0x72')]['forEach'](function(_0x5dfad7){_0x5dfad7[_0x2e98('0x75')]=_[_0x2e98('0x34')](_0x48b479,{'id':_0x5503c2['id']})[_0x2e98('0x75')];});return _0x5503c2['Agents'];});return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x2c30ea['params']['id']}})['then'](function(_0x5a4d7c){return db[_0x2e98('0x76')][_0x2e98('0x77')](function(_0x12d071){return _0x5a4d7c[_0x2e98('0x6e')](_0x169d61,{'transaction':_0x12d071})['then'](function(){return BPromise[_0x2e98('0x78')](_0xb37ecf,function(_0x1555d9){return db[_0x2e98('0x79')][_0x2e98('0x7a')]({'where':{'UserId':_0x1555d9['id'],'VoiceQueueId':_0x2c30ea[_0x2e98('0x51')]['id']},'defaults':{'penalty':_0x1555d9[_0x2e98('0x75')]},'transaction':_0x12d071});});})[_0x2e98('0x29')](function(){return BPromise[_0x2e98('0x78')](_['filter'](_0xb37ecf,{'online':!![]}),function(_0x23d623){return db[_0x2e98('0x7b')]['upsert']({'membername':_0x23d623[_0x2e98('0x39')],'UserId':_0x23d623['id'],'queue_name':_0x5a4d7c[_0x2e98('0x39')],'VoiceQueueId':_0x5a4d7c['id'],'interface':_[_0x2e98('0x7c')](_0x23d623[_0x2e98('0x7d')])?util[_0x2e98('0x7e')](_0x2e98('0x7f'),_0x23d623[_0x2e98('0x39')]):_0x23d623[_0x2e98('0x7d')],'paused':_0x23d623[_0x2e98('0x73')]||![],'penalty':_0x23d623[_0x2e98('0x75')]},{'transaction':_0x12d071});});})[_0x2e98('0x29')](function(){_0xb37ecf[_0x2e98('0x80')](function(_0x4b50a5){socket[_0x2e98('0x81')](_0x2e98('0x82'),{'UserId':_0x4b50a5['id'],'VoiceQueueId':_0x5a4d7c['id']});});});});});}})[_0x2e98('0x29')](respondWithStatusCode(_0x27c0ce,null))[_0x2e98('0x4f')](handleError(_0x27c0ce,null));};exports[_0x2e98('0x83')]=function(_0x2b033e,_0x17d0b2,_0x48f1cc){return db[_0x2e98('0x70')][_0x2e98('0x4d')]({'where':{'id':_0x2b033e[_0x2e98('0x43')][_0x2e98('0x84')]},'attributes':['id'],'include':[{'model':db[_0x2e98('0x71')],'as':_0x2e98('0x72'),'attributes':['id'],'raw':!![]}]})[_0x2e98('0x29')](handleEntityNotFound(_0x17d0b2,null))['then'](function(_0x18c95f){var _0x5b5db8=_[_0x2e98('0x31')](_0x18c95f,'id');var _0x1be75e=[];var _0x3dd8ed=[];var _0x5992ec=squel[_0x2e98('0x85')]();_0x5992ec[_0x2e98('0x86')](_0x2e98('0x87'))[_0x2e98('0x88')](_0x2e98('0x89'),'tq')['join'](_0x2e98('0x8a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2e98('0x49')](_0x2e98('0x8b'),_0x2b033e[_0x2e98('0x51')]['id']);for(var _0x103eee=0x0;_0x103eee<_0x18c95f['length'];_0x103eee+=0x1){let _0x364ec8=_0x18c95f[_0x103eee];for(var _0x1009b8=0x0;_0x1009b8<_0x364ec8[_0x2e98('0x72')][_0x2e98('0x52')];_0x1009b8+=0x1){let _0x2ce951=_0x364ec8[_0x2e98('0x72')][_0x1009b8];var _0x478a64=_0x5992ec[_0x2e98('0x59')]();_0x478a64[_0x2e98('0x49')]('ut.UserId\x20=\x20?',_0x2ce951['id']);_0x3dd8ed[_0x2e98('0x8c')](db[_0x2e98('0x76')]['query'](_0x478a64['toString'](),{'type':db[_0x2e98('0x76')]['QueryTypes'][_0x2e98('0x8d')]})[_0x2e98('0x29')](function(_0x50c307){if(_0x50c307[_0x2e98('0x52')]===0x1){return _0x2ce951['id'];}else{var _0x3c7407=_['every'](_[_0x2e98('0x31')](_0x50c307,_0x2e98('0x8e')),function(_0x4be8f5){return _['includes'](_0x5b5db8,_0x4be8f5);});if(_0x3c7407){return _0x2ce951['id'];}}}));}}return BPromise[_0x2e98('0x8f')](_0x3dd8ed)[_0x2e98('0x29')](function(_0x4c96c1){_0x1be75e=_(_0x1be75e)[_0x2e98('0x90')](_0x4c96c1)[_0x2e98('0x91')]()[_0x2e98('0x32')]();return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x2b033e[_0x2e98('0x51')]['id']}})['then'](function(_0x27316f){return db[_0x2e98('0x76')][_0x2e98('0x77')](function(_0x439a61){return _0x27316f[_0x2e98('0x83')](_0x2b033e[_0x2e98('0x43')][_0x2e98('0x84')],{'transaction':_0x439a61})[_0x2e98('0x29')](function(){if(!_['isEmpty'](_0x1be75e)){return _0x27316f['removeAgents'](_0x1be75e,{'transaction':_0x439a61})[_0x2e98('0x29')](function(){return db[_0x2e98('0x7b')][_0x2e98('0x2a')]({'where':{'VoiceQueueId':_0x2b033e['params']['id'],'UserId':_0x1be75e},'transaction':_0x439a61});});}})['then'](function(){_0x1be75e['forEach'](function(_0x15078c){socket[_0x2e98('0x81')](_0x2e98('0x92'),{'UserId':_0x15078c,'VoiceQueueId':_0x27316f['id']});});});});});});})['then'](respondWithStatusCode(_0x17d0b2,null))[_0x2e98('0x4f')](handleError(_0x17d0b2,null));};exports[_0x2e98('0x93')]=function(_0x342404,_0x44f80a,_0x31c537){var _0x583376,_0x5d5349;return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x342404['params']['id']}})['then'](handleEntityNotFound(_0x44f80a,null))[_0x2e98('0x29')](function(_0x51a4ba){if(_0x51a4ba){_0x5d5349=_0x51a4ba;return _0x51a4ba[_0x2e98('0x93')](_0x342404[_0x2e98('0x5e')]['ids'],_['omit'](_0x342404[_0x2e98('0x5e')],['ids','id'])||{})['spread'](function(_0x865c5){for(var _0x5a9835=0x0;_0x5a9835<_0x342404[_0x2e98('0x5e')]['ids']['length'];_0x5a9835+=0x1){socket[_0x2e98('0x81')](_0x2e98('0x82'),{'UserId':_0x342404['body'][_0x2e98('0x84')][_0x5a9835],'VoiceQueueId':_0x342404['params']['id']});}return _0x865c5;});}})[_0x2e98('0x29')](function(_0x22d240){_0x583376=_0x22d240||[];if(_0x5d5349){return db[_0x2e98('0x71')][_0x2e98('0x4d')]({'where':{'id':_0x342404['body']['ids']},'attributes':['id',_0x2e98('0x39'),_0x2e98('0x94'),_0x2e98('0x73'),_0x2e98('0x7d')],'raw':!![]});}})['then'](function(_0x5aefbf){if(!_[_0x2e98('0x95')](_0x5aefbf)){var _0x31f2cb=[];for(var _0x2445e1=0x0;_0x2445e1<_0x5aefbf[_0x2e98('0x52')];_0x2445e1++){if(_0x5aefbf[_0x2445e1][_0x2e98('0x94')]){_0x31f2cb[_0x2e98('0x8c')](db[_0x2e98('0x7b')][_0x2e98('0x96')]({'membername':_0x5aefbf[_0x2445e1][_0x2e98('0x39')],'UserId':_0x5aefbf[_0x2445e1]['id'],'queue_name':_0x5d5349[_0x2e98('0x39')],'VoiceQueueId':_0x5d5349['id'],'interface':_[_0x2e98('0x7c')](_0x5aefbf[_0x2445e1]['interface'])?util[_0x2e98('0x7e')](_0x2e98('0x7f'),_0x5aefbf[_0x2445e1][_0x2e98('0x39')]):_0x5aefbf[_0x2445e1]['interface'],'paused':_0x5aefbf[_0x2445e1][_0x2e98('0x73')]||![],'penalty':_0x342404[_0x2e98('0x5e')]['penalty']||0x0}));}}return BPromise[_0x2e98('0x8f')](_0x31f2cb);}})[_0x2e98('0x29')](function(){return _0x583376;})['then'](respondWithResult(_0x44f80a,null))[_0x2e98('0x4f')](handleError(_0x44f80a,null));};exports[_0x2e98('0x97')]=function(_0x5ceadc,_0x3a4686,_0xda43f7){return db['VoiceQueue'][_0x2e98('0x34')]({'where':{'id':_0x5ceadc[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x3a4686,null))[_0x2e98('0x29')](function(_0x365dcd){if(_0x365dcd){return _0x365dcd[_0x2e98('0x97')](_0x5ceadc['query'][_0x2e98('0x84')])[_0x2e98('0x29')](function(){if(_['isArray'](_0x5ceadc[_0x2e98('0x43')]['ids'])){for(var _0x12c6a5=0x0;_0x12c6a5<_0x5ceadc[_0x2e98('0x43')]['ids'][_0x2e98('0x52')];_0x12c6a5+=0x1){socket[_0x2e98('0x81')](_0x2e98('0x92'),{'UserId':Number(_0x5ceadc[_0x2e98('0x43')][_0x2e98('0x84')][_0x12c6a5]),'VoiceQueueId':Number(_0x5ceadc['params']['id'])});}}else{socket[_0x2e98('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x5ceadc[_0x2e98('0x43')][_0x2e98('0x84')]),'VoiceQueueId':Number(_0x5ceadc[_0x2e98('0x51')]['id'])});}});}})[_0x2e98('0x29')](function(_0x40c9d5){return db['UserVoiceQueueRt'][_0x2e98('0x2a')]({'where':{'VoiceQueueId':_0x5ceadc['params']['id'],'UserId':_0x5ceadc['query'][_0x2e98('0x84')]}})[_0x2e98('0x29')](function(){return _0x40c9d5;});})['then'](respondWithStatusCode(_0x3a4686,null))[_0x2e98('0x4f')](handleError(_0x3a4686,null));};exports[_0x2e98('0x98')]=function(_0x4da8ce,_0x8c4789,_0x51ad30){var _0x50ec89={};var _0x3096cb={};var _0x4d28b9;var _0x182ba2;return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0x4da8ce['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x8c4789,null))[_0x2e98('0x29')](function(_0x364003){if(_0x364003){_0x4d28b9=_0x364003;_0x3096cb[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db[_0x2e98('0x71')]['rawAttributes']);_0x3096cb[_0x2e98('0x43')]=_['keys'](_0x4da8ce[_0x2e98('0x43')]);_0x3096cb[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x3096cb[_0x2e98('0x42')],_0x3096cb['query']);_0x50ec89[_0x2e98('0x44')]=_['intersection'](_0x3096cb['model'],qs[_0x2e98('0x45')](_0x4da8ce['query'][_0x2e98('0x45')]));_0x50ec89[_0x2e98('0x44')]=_0x50ec89[_0x2e98('0x44')][_0x2e98('0x52')]?_0x50ec89[_0x2e98('0x44')]:_0x3096cb[_0x2e98('0x42')];_0x50ec89[_0x2e98('0x47')]=qs['sort'](_0x4da8ce[_0x2e98('0x43')][_0x2e98('0x48')]);_0x50ec89['where']=qs[_0x2e98('0x40')](_[_0x2e98('0x65')](_0x4da8ce[_0x2e98('0x43')],_0x3096cb['filters']));if(_0x4da8ce[_0x2e98('0x43')]['filter']){_0x50ec89[_0x2e98('0x49')]=_[_0x2e98('0x4a')](_0x50ec89[_0x2e98('0x49')],{'$or':_['map'](_0x50ec89[_0x2e98('0x44')],function(_0x5cb74e){var _0x529c80={};_0x529c80[_0x5cb74e]={'$like':'%'+_0x4da8ce['query'][_0x2e98('0x2f')]+'%'};return _0x529c80;})});}_0x50ec89=_['merge']({},_0x50ec89,_0x4da8ce[_0x2e98('0x5a')]);return _0x4d28b9[_0x2e98('0x98')](_0x50ec89);}})['then'](function(_0x179978){if(_0x179978){_0x182ba2=_0x179978[_0x2e98('0x52')];if(!_0x4da8ce[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x50ec89[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x4da8ce[_0x2e98('0x43')][_0x2e98('0x22')]);_0x50ec89[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x4da8ce[_0x2e98('0x43')][_0x2e98('0x21')]);}return _0x4d28b9[_0x2e98('0x98')](_0x50ec89);}})[_0x2e98('0x29')](function(_0x497eba){if(_0x497eba){return _0x497eba?{'count':_0x182ba2,'rows':_0x497eba}:null;}})['then'](respondWithResult(_0x8c4789,null))['catch'](handleError(_0x8c4789,null));};exports[_0x2e98('0x99')]=function(_0x446fcb,_0x37f02d,_0x372d54){var _0x20d809={};var _0x36678d={};var _0x1e2b17;var _0x4a2f44;return db[_0x2e98('0x3c')]['findOne']({'where':{'id':_0x446fcb[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x37f02d,null))[_0x2e98('0x29')](function(_0x24aa48){if(_0x24aa48){_0x1e2b17=_0x24aa48;_0x36678d[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db['UserVoiceQueueRt'][_0x2e98('0x3d')]);_0x36678d[_0x2e98('0x43')]=_['keys'](_0x446fcb[_0x2e98('0x43')]);_0x36678d['filters']=_[_0x2e98('0x41')](_0x36678d[_0x2e98('0x42')],_0x36678d[_0x2e98('0x43')]);_0x20d809[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x36678d[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x446fcb[_0x2e98('0x43')][_0x2e98('0x45')]));_0x20d809['attributes']=_0x20d809['attributes'][_0x2e98('0x52')]?_0x20d809[_0x2e98('0x44')]:_0x36678d[_0x2e98('0x42')];_0x20d809[_0x2e98('0x47')]=qs[_0x2e98('0x48')](_0x446fcb[_0x2e98('0x43')][_0x2e98('0x48')]);_0x20d809[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_['pick'](_0x446fcb[_0x2e98('0x43')],_0x36678d['filters']));if(_0x446fcb['query'][_0x2e98('0x2f')]){_0x20d809['where']=_['merge'](_0x20d809[_0x2e98('0x49')],{'$or':_[_0x2e98('0x31')](_0x20d809[_0x2e98('0x44')],function(_0x206cbe){var _0x2d5d35={};_0x2d5d35[_0x206cbe]={'$like':'%'+_0x446fcb[_0x2e98('0x43')]['filter']+'%'};return _0x2d5d35;})});}_0x20d809=_[_0x2e98('0x4a')]({},_0x20d809,_0x446fcb[_0x2e98('0x5a')]);return _0x1e2b17[_0x2e98('0x99')](_0x20d809);}})[_0x2e98('0x29')](function(_0x2b905c){if(_0x2b905c){_0x4a2f44=_0x2b905c['length'];if(!_0x446fcb[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x20d809[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x446fcb['query'][_0x2e98('0x22')]);_0x20d809[_0x2e98('0x21')]=qs['offset'](_0x446fcb[_0x2e98('0x43')][_0x2e98('0x21')]);}return _0x1e2b17['getMembers'](_0x20d809);}})[_0x2e98('0x29')](function(_0x4d29c5){return _0x4d29c5?{'count':_0x4a2f44,'rows':_0x4d29c5}:null;})[_0x2e98('0x29')](respondWithResult(_0x37f02d,null))[_0x2e98('0x4f')](handleError(_0x37f02d,null));};exports[_0x2e98('0x9a')]=function(_0x1b379b,_0xeab1e0,_0x40143d){var _0x36cb29={};var _0x26c214={};var _0x50d38e;var _0x138119;return db['VoiceQueue'][_0x2e98('0x68')]({'where':{'id':_0x1b379b[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0xeab1e0,null))['then'](function(_0x59753f){if(_0x59753f){_0x50d38e=_0x59753f;_0x26c214[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db[_0x2e98('0x9b')][_0x2e98('0x3d')]);_0x26c214[_0x2e98('0x43')]=_['keys'](_0x1b379b[_0x2e98('0x43')]);_0x26c214[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x26c214['model'],_0x26c214[_0x2e98('0x43')]);_0x36cb29['attributes']=_[_0x2e98('0x41')](_0x26c214[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x1b379b[_0x2e98('0x43')][_0x2e98('0x45')]));_0x36cb29['attributes']=_0x36cb29['attributes'][_0x2e98('0x52')]?_0x36cb29[_0x2e98('0x44')]:_0x26c214[_0x2e98('0x42')];_0x36cb29['order']=qs[_0x2e98('0x48')](_0x1b379b[_0x2e98('0x43')][_0x2e98('0x48')]);_0x36cb29[_0x2e98('0x49')]=qs['filters'](_[_0x2e98('0x65')](_0x1b379b['query'],_0x26c214[_0x2e98('0x40')]));if(_0x1b379b[_0x2e98('0x43')]['filter']){_0x36cb29['where']=_['merge'](_0x36cb29['where'],{'$or':_[_0x2e98('0x31')](_0x36cb29[_0x2e98('0x44')],function(_0x1d54ba){var _0x24a311={};_0x24a311[_0x1d54ba]={'$like':'%'+_0x1b379b[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0x24a311;})});}_0x36cb29=_[_0x2e98('0x4a')]({},_0x36cb29,_0x1b379b[_0x2e98('0x5a')]);return _0x50d38e[_0x2e98('0x9a')](_0x36cb29);}})[_0x2e98('0x29')](function(_0x79df28){if(_0x79df28){_0x138119=_0x79df28[_0x2e98('0x52')];if(!_0x1b379b[_0x2e98('0x43')][_0x2e98('0x46')]('nolimit')){_0x36cb29['limit']=qs[_0x2e98('0x22')](_0x1b379b['query'][_0x2e98('0x22')]);_0x36cb29[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x1b379b[_0x2e98('0x43')][_0x2e98('0x21')]);}return _0x50d38e[_0x2e98('0x9a')](_0x36cb29);}})[_0x2e98('0x29')](function(_0x19f4fb){if(_0x19f4fb){return _0x19f4fb?{'count':_0x138119,'rows':_0x19f4fb}:null;}})['then'](respondWithResult(_0xeab1e0,null))[_0x2e98('0x4f')](handleError(_0xeab1e0,null));};exports[_0x2e98('0x9c')]=function(_0x358f0e,_0x4ce6b0,_0x4ee49d){var _0x401037,_0x134ac3;return db[_0x2e98('0x3c')]['find']({'where':{'id':_0x358f0e['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x4ce6b0,null))[_0x2e98('0x29')](function(_0x381e4b){if(_0x381e4b){_0x134ac3=_0x381e4b;return _0x381e4b[_0x2e98('0x9c')](_0x358f0e[_0x2e98('0x5e')][_0x2e98('0x84')],_[_0x2e98('0x5b')](_0x358f0e[_0x2e98('0x5e')],[_0x2e98('0x84'),'id'])||{});}return null;})[_0x2e98('0x9d')](function(_0x21ebeb){var _0x47cf43;_0x401037=_0x21ebeb||[];var _0x18a157=[];if(_0x21ebeb){for(var _0x1e9ba4=0x0;_0x1e9ba4<_0x21ebeb[_0x2e98('0x52')];_0x1e9ba4+=0x1){var _0x538d9e=_0x21ebeb[_0x1e9ba4][_0x2e98('0x55')]({'plain':!![]});_0x134ac3['dialCheckDuplicateType']=_0x358f0e[_0x2e98('0x5e')][_0x2e98('0x9e')]?_0x358f0e[_0x2e98('0x5e')][_0x2e98('0x9e')]:_0x134ac3['dialCheckDuplicateType'];switch(_0x134ac3[_0x2e98('0x9e')]){case _0x2e98('0x9f'):_0x47cf43=squel['insert']()[_0x2e98('0xa0')]('cm_hopper')[_0x2e98('0xa1')]([_0x2e98('0xa2'),_0x2e98('0xa3'),_0x2e98('0xa4'),_0x2e98('0xa5'),'VoiceQueueId','createdAt',_0x2e98('0x5d')],squel['select']()[_0x2e98('0x86')](_0x2e98('0xa2'),_0x2e98('0xa2'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0xa3'))[_0x2e98('0x86')]('id',_0x2e98('0xa4'))['field'](_0x538d9e[_0x2e98('0xa7')][_0x2e98('0xa8')](),_0x2e98('0xa5'))[_0x2e98('0x86')](_0x358f0e['params']['id'][_0x2e98('0xa8')](),_0x2e98('0x66'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0x5c'))['field'](_0x2e98('0xa6'),_0x2e98('0x5d'))['from'](_0x2e98('0xa9'))['where'](_0x2e98('0xaa'))[_0x2e98('0x49')]('ListId\x20=\x20?',_0x538d9e['CmListId']['toString']())[_0x2e98('0x49')](_0x2e98('0xab'))[_0x2e98('0x49')](_0x2e98('0xac'),squel[_0x2e98('0x85')]()[_0x2e98('0x86')](_0x2e98('0xad'))[_0x2e98('0x88')](_0x2e98('0xae'))['where'](_0x2e98('0x8b'),_0x358f0e['params']['id'][_0x2e98('0xa8')]()))['where'](_0x2e98('0xac'),squel[_0x2e98('0x85')]()[_0x2e98('0x86')](_0x2e98('0xaf'))[_0x2e98('0x88')]('cm_hopper')[_0x2e98('0x49')](_0x2e98('0x8b'),_0x358f0e['params']['id']['toString']())))[_0x2e98('0xa8')]();break;case'onlyIfOpen':_0x47cf43=squel[_0x2e98('0xb0')]()[_0x2e98('0xa0')](_0x2e98('0xb1'))[_0x2e98('0xa1')]([_0x2e98('0xa2'),_0x2e98('0xa3'),_0x2e98('0xa4'),_0x2e98('0xa5'),_0x2e98('0x66'),_0x2e98('0x5c'),'updatedAt'],squel['select']()[_0x2e98('0x86')](_0x2e98('0xa2'),_0x2e98('0xa2'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0xa3'))[_0x2e98('0x86')]('id',_0x2e98('0xa4'))[_0x2e98('0x86')](_0x538d9e[_0x2e98('0xa7')][_0x2e98('0xa8')](),_0x2e98('0xa5'))[_0x2e98('0x86')](_0x358f0e[_0x2e98('0x51')]['id'][_0x2e98('0xa8')](),_0x2e98('0x66'))[_0x2e98('0x86')]('NOW()',_0x2e98('0x5c'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0x5d'))[_0x2e98('0x88')](_0x2e98('0xa9'))[_0x2e98('0x49')](_0x2e98('0xaa'))[_0x2e98('0x49')](_0x2e98('0xb2'),_0x538d9e[_0x2e98('0xa7')][_0x2e98('0xa8')]())[_0x2e98('0x49')](_0x2e98('0xab'))[_0x2e98('0x49')](_0x2e98('0xac'),squel['select']()[_0x2e98('0x86')](_0x2e98('0xaf'))[_0x2e98('0x88')]('cm_hopper')[_0x2e98('0x49')](_0x2e98('0x8b'),_0x358f0e[_0x2e98('0x51')]['id'][_0x2e98('0xa8')]())))[_0x2e98('0xa8')]();break;default:_0x47cf43=squel['insert']()['into'](_0x2e98('0xb1'))[_0x2e98('0xa1')](['phone',_0x2e98('0xa3'),_0x2e98('0xa4'),_0x2e98('0xa5'),_0x2e98('0x66'),_0x2e98('0x5c'),_0x2e98('0x5d')],squel[_0x2e98('0x85')]()[_0x2e98('0x86')](_0x2e98('0xa2'),_0x2e98('0xa2'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0xa3'))['field']('id',_0x2e98('0xa4'))[_0x2e98('0x86')](_0x538d9e['CmListId'][_0x2e98('0xa8')](),_0x2e98('0xa5'))['field'](_0x358f0e[_0x2e98('0x51')]['id'][_0x2e98('0xa8')](),_0x2e98('0x66'))['field'](_0x2e98('0xa6'),_0x2e98('0x5c'))[_0x2e98('0x86')](_0x2e98('0xa6'),'updatedAt')[_0x2e98('0x88')](_0x2e98('0xa9'))[_0x2e98('0x49')](_0x2e98('0xaa'))[_0x2e98('0x49')](_0x2e98('0xb2'),_0x538d9e[_0x2e98('0xa7')]['toString']())[_0x2e98('0x49')](_0x2e98('0xab')))['toString']();}_0x18a157[_0x2e98('0x8c')](db['sequelize'][_0x2e98('0x43')](_0x47cf43));}return BPromise[_0x2e98('0x8f')](_0x18a157);}})[_0x2e98('0x29')](function(){return _0x401037;})[_0x2e98('0x29')](respondWithResult(_0x4ce6b0,null))[_0x2e98('0x4f')](handleError(_0x4ce6b0,null));};exports['removeLists']=function(_0x39c047,_0xa82d0d,_0x3a8b67){return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x39c047[_0x2e98('0x51')]['id']}})['then'](handleEntityNotFound(_0xa82d0d,null))['then'](function(_0x119531){if(_0x119531){return _0x119531[_0x2e98('0xb3')](_0x39c047[_0x2e98('0x43')]['ids']);}})[_0x2e98('0x29')](function(_0xd6780a){if(_0xd6780a){return db[_0x2e98('0x63')][_0x2e98('0x2a')]({'where':{'ListId':_0x39c047['query']['ids'],'VoiceQueueId':_0x39c047[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](function(){return _0xd6780a;});}})[_0x2e98('0x29')](respondWithStatusCode(_0xa82d0d,null))[_0x2e98('0x4f')](handleError(_0xa82d0d,null));};exports[_0x2e98('0xb4')]=function(_0x57442e,_0x88884c,_0x8ea91b){var _0x146545={};var _0x374a2e={};var _0x1de678;var _0x5c3f64;return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0x57442e[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x88884c,null))[_0x2e98('0x29')](function(_0x313026){if(_0x313026){_0x1de678=_0x313026;_0x374a2e[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db['CmList'][_0x2e98('0x3d')]);_0x374a2e[_0x2e98('0x43')]=_[_0x2e98('0x3f')](_0x57442e[_0x2e98('0x43')]);_0x374a2e[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x374a2e[_0x2e98('0x42')],_0x374a2e[_0x2e98('0x43')]);_0x146545['attributes']=_[_0x2e98('0x41')](_0x374a2e[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x57442e[_0x2e98('0x43')][_0x2e98('0x45')]));_0x146545['attributes']=_0x146545['attributes']['length']?_0x146545[_0x2e98('0x44')]:_0x374a2e[_0x2e98('0x42')];_0x146545[_0x2e98('0x47')]=qs['sort'](_0x57442e[_0x2e98('0x43')][_0x2e98('0x48')]);_0x146545[_0x2e98('0x49')]=qs['filters'](_[_0x2e98('0x65')](_0x57442e[_0x2e98('0x43')],_0x374a2e[_0x2e98('0x40')]));if(_0x57442e[_0x2e98('0x43')][_0x2e98('0x2f')]){_0x146545[_0x2e98('0x49')]=_['merge'](_0x146545[_0x2e98('0x49')],{'$or':_['map'](_0x146545[_0x2e98('0x44')],function(_0x2b699e){var _0x5b1bfb={};_0x5b1bfb[_0x2b699e]={'$like':'%'+_0x57442e[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0x5b1bfb;})});}_0x146545=_[_0x2e98('0x4a')]({},_0x146545,_0x57442e[_0x2e98('0x5a')]);return _0x1de678['getBlackLists'](_0x146545);}})[_0x2e98('0x29')](function(_0x4b8243){if(_0x4b8243){_0x5c3f64=_0x4b8243['length'];if(!_0x57442e[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x146545[_0x2e98('0x22')]=qs['limit'](_0x57442e[_0x2e98('0x43')]['limit']);_0x146545[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x57442e[_0x2e98('0x43')]['offset']);}return _0x1de678['getBlackLists'](_0x146545);}})[_0x2e98('0x29')](function(_0x1457b6){if(_0x1457b6){return _0x1457b6?{'count':_0x5c3f64,'rows':_0x1457b6}:null;}})[_0x2e98('0x29')](respondWithResult(_0x88884c,null))[_0x2e98('0x4f')](handleError(_0x88884c,null));};exports['addBlackLists']=function(_0x4a8633,_0xd85ea4,_0x996d65){var _0x38f670,_0x327173;return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x4a8633[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0xd85ea4,null))[_0x2e98('0x29')](function(_0x2be656){if(_0x2be656){_0x327173=_0x2be656;return _0x2be656[_0x2e98('0xb5')](_0x4a8633[_0x2e98('0x5e')]['ids'],_[_0x2e98('0x5b')](_0x4a8633[_0x2e98('0x5e')],[_0x2e98('0x84'),'id'])||{});}return null;})[_0x2e98('0x9d')](function(_0x168ade){var _0x5f4715;_0x38f670=_0x168ade||[];var _0x3ec265=[];if(_0x168ade){for(var _0x744f5b=0x0;_0x744f5b<_0x168ade[_0x2e98('0x52')];_0x744f5b+=0x1){var _0x31c54d=_0x168ade[_0x744f5b]['get']({'plain':!![]});_0x5f4715=squel['insert']()['into']('cm_hopper_black')['fromQuery'](['phone',_0x2e98('0xa4'),_0x2e98('0xa5'),_0x2e98('0x66'),_0x2e98('0x5c'),_0x2e98('0x5d')],squel[_0x2e98('0x85')]()['field'](_0x2e98('0xa2'),'phone')[_0x2e98('0x86')]('id',_0x2e98('0xa4'))[_0x2e98('0x86')](_0x31c54d['CmListId'][_0x2e98('0xa8')](),_0x2e98('0xa5'))['field'](_0x4a8633[_0x2e98('0x51')]['id'][_0x2e98('0xa8')](),_0x2e98('0x66'))['field'](_0x2e98('0xa6'),_0x2e98('0x5c'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0x5d'))[_0x2e98('0x88')](_0x2e98('0xa9'))[_0x2e98('0x49')](_0x2e98('0xaa'))[_0x2e98('0x49')](_0x2e98('0xb2'),_0x31c54d[_0x2e98('0xa7')]['toString']())[_0x2e98('0x49')](_0x2e98('0xab')))['toString']();_0x3ec265[_0x2e98('0x8c')](db[_0x2e98('0x76')][_0x2e98('0x43')](_0x5f4715));}return BPromise[_0x2e98('0x8f')](_0x3ec265);}})[_0x2e98('0x29')](function(){return _0x38f670;})[_0x2e98('0x29')](respondWithResult(_0xd85ea4,null))[_0x2e98('0x4f')](handleError(_0xd85ea4,null));};exports[_0x2e98('0xb6')]=function(_0x38a26e,_0x2bf78c,_0x12c16e){return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x38a26e[_0x2e98('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bf78c,null))[_0x2e98('0x29')](function(_0x2feba4){if(_0x2feba4){return _0x2feba4[_0x2e98('0xb6')](_0x38a26e[_0x2e98('0x43')][_0x2e98('0x84')]);}})['then'](function(_0x233d6b){if(_0x233d6b){return db[_0x2e98('0x6c')][_0x2e98('0x2a')]({'where':{'ListId':_0x38a26e[_0x2e98('0x43')][_0x2e98('0x84')],'VoiceQueueId':_0x38a26e[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](function(){return _0x233d6b;});}})['then'](respondWithStatusCode(_0x2bf78c,null))[_0x2e98('0x4f')](handleError(_0x2bf78c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ccb7235..f561a04 100644 --- a/server/api/voiceQueue/voiceQueue.events.js +++ b/server/api/voiceQueue/voiceQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf29d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xb447ef,_0x18ca15){var _0x3d0d9d=function(_0x368506){while(--_0x368506){_0xb447ef['push'](_0xb447ef['shift']());}};_0x3d0d9d(++_0x18ca15);}(_0xf29d,0xc4));var _0xdf29=function(_0x433ea1,_0x30559c){_0x433ea1=_0x433ea1-0x0;var _0x4e0fae=_0xf29d[_0x433ea1];return _0x4e0fae;};'use strict';var EventEmitter=require(_0xdf29('0x0'));var VoiceQueue=require(_0xdf29('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xdf29('0x2')](0x0);var events={'afterCreate':_0xdf29('0x3'),'afterUpdate':_0xdf29('0x4'),'afterDestroy':_0xdf29('0x5')};function emitEvent(_0x360c97){return function(_0x5b3b99,_0x4debce,_0x529ef8){VoiceQueueEvents[_0xdf29('0x6')](_0x360c97+':'+_0x5b3b99['id'],_0x5b3b99);VoiceQueueEvents[_0xdf29('0x6')](_0x360c97,_0x5b3b99);_0x529ef8(null);};}for(var e in events){if(events[_0xdf29('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xdf29('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x8119=['emit','hook','events','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x10422d,_0x515afe){var _0x190867=function(_0x330ede){while(--_0x330ede){_0x10422d['push'](_0x10422d['shift']());}};_0x190867(++_0x515afe);}(_0x8119,0xda));var _0x9811=function(_0x373a54,_0x55f0cd){_0x373a54=_0x373a54-0x0;var _0x2f8134=_0x8119[_0x373a54];return _0x2f8134;};'use strict';var EventEmitter=require(_0x9811('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x9811('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9811('0x2')](0x0);var events={'afterCreate':_0x9811('0x3'),'afterUpdate':_0x9811('0x4'),'afterDestroy':_0x9811('0x5')};function emitEvent(_0x17a086){return function(_0x2fbc49,_0x1224ac,_0x440ad2){VoiceQueueEvents[_0x9811('0x6')](_0x17a086+':'+_0x2fbc49['id'],_0x2fbc49);VoiceQueueEvents[_0x9811('0x6')](_0x17a086,_0x2fbc49);_0x440ad2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x9811('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a7e3609..79ee913 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80d2=['define','voice_queues','lodash','util','api','moment','bluebird','../../config/environment','exports'];(function(_0x478e09,_0xdbb31d){var _0x12aacc=function(_0x402b83){while(--_0x402b83){_0x478e09['push'](_0x478e09['shift']());}};_0x12aacc(++_0xdbb31d);}(_0x80d2,0x146));var _0x280d=function(_0x45123d,_0x41f011){_0x45123d=_0x45123d-0x0;var _0x9c6708=_0x80d2[_0x45123d];return _0x9c6708;};'use strict';var _=require(_0x280d('0x0'));var util=require(_0x280d('0x1'));var logger=require('../../config/logger')(_0x280d('0x2'));var moment=require(_0x280d('0x3'));var BPromise=require(_0x280d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x280d('0x5'));var attributes=require('./voiceQueue.attributes');module[_0x280d('0x6')]=function(_0x398b34,_0x1e5404){return _0x398b34[_0x280d('0x7')]('VoiceQueue',attributes,{'tableName':_0x280d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fc4=['VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceQueue.attributes','exports','define'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0fc4,0x120));var _0x40fc=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x0fc4[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0x40fc('0x0'));var util=require(_0x40fc('0x1'));var logger=require(_0x40fc('0x2'))(_0x40fc('0x3'));var moment=require(_0x40fc('0x4'));var BPromise=require(_0x40fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40fc('0x6'));var rimraf=require('rimraf');var config=require(_0x40fc('0x7'));var attributes=require(_0x40fc('0x8'));module[_0x40fc('0x9')]=function(_0xcf1b9e,_0x2d645f){return _0xcf1b9e[_0x40fc('0xa')](_0x40fc('0xb'),attributes,{'tableName':_0x40fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index df3715f..1c253cc 100644 --- a/server/api/voiceQueue/voiceQueue.rpc.js +++ b/server/api/voiceQueue/voiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7272=['client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueue','stringify','ShowVoiceQueue','find','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x5c69d4,_0x309a75){var _0x312bd1=function(_0x19f7e9){while(--_0x19f7e9){_0x5c69d4['push'](_0x5c69d4['shift']());}};_0x312bd1(++_0x309a75);}(_0x7272,0xd7));var _0x2727=function(_0x19b262,_0x4dcd91){_0x19b262=_0x19b262-0x0;var _0x39b0fe=_0x7272[_0x19b262];return _0x39b0fe;};'use strict';var _=require(_0x2727('0x0'));var util=require('util');var moment=require(_0x2727('0x1'));var BPromise=require(_0x2727('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2727('0x3'));var db=require(_0x2727('0x4'))['db'];var utils=require(_0x2727('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2727('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2727('0x7')][_0x2727('0x8')]({'port':0x232a});config[_0x2727('0x9')]=_['defaults'](config['redis'],{'host':_0x2727('0xa'),'port':0x18eb});var socket=require(_0x2727('0xb'))(new Redis(config['redis']));require(_0x2727('0xc'))[_0x2727('0xd')](socket);function respondWithRpcPromise(_0x3207bc,_0x192135,_0x100767){return new BPromise(function(_0x1aa098,_0x57711d){return client['request'](_0x3207bc,_0x100767)['then'](function(_0x1636fc){logger[_0x2727('0xe')](_0x2727('0xf'),_0x192135,_0x2727('0x10'));logger[_0x2727('0x11')](_0x2727('0x12'),_0x192135,'request\x20sent',JSON['stringify'](_0x1636fc));if(_0x1636fc[_0x2727('0x13')]){if(_0x1636fc[_0x2727('0x13')][_0x2727('0x14')]===0x1f4){logger[_0x2727('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x192135,_0x1636fc[_0x2727('0x13')][_0x2727('0x15')]);return _0x57711d(_0x1636fc['error'][_0x2727('0x15')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x192135,_0x1636fc[_0x2727('0x13')]['message']);return _0x1aa098(_0x1636fc['error'][_0x2727('0x15')]);}else{logger[_0x2727('0xe')](_0x2727('0xf'),_0x192135,_0x2727('0x10'));_0x1aa098(_0x1636fc[_0x2727('0x16')]['message']);}})[_0x2727('0x17')](function(_0x41f1eb){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x192135,_0x41f1eb);_0x57711d(_0x41f1eb);});});}exports['GetVoiceQueue']=function(_0x153408){var _0x188928=this;return new Promise(function(_0x174a70,_0x5027b5){return db['VoiceQueue'][_0x2727('0x18')]({'raw':_0x153408['options']?_0x153408[_0x2727('0x19')][_0x2727('0x1a')]===undefined?!![]:![]:!![],'where':_0x153408[_0x2727('0x19')]?_0x153408[_0x2727('0x19')][_0x2727('0x1b')]||null:null,'attributes':_0x153408[_0x2727('0x19')]?_0x153408['options'][_0x2727('0x1c')]||null:null,'limit':_0x153408['options']?_0x153408[_0x2727('0x19')]['limit']||null:null,'include':_0x153408[_0x2727('0x19')]?_0x153408[_0x2727('0x19')][_0x2727('0x1d')]?_[_0x2727('0x1e')](_0x153408['options'][_0x2727('0x1d')],function(_0x321e65){return{'model':db[_0x321e65[_0x2727('0x1f')]],'as':_0x321e65['as'],'attributes':_0x321e65[_0x2727('0x1c')],'include':_0x321e65[_0x2727('0x1d')]?_[_0x2727('0x1e')](_0x321e65[_0x2727('0x1d')],function(_0x2aa9d0){return{'model':db[_0x2aa9d0[_0x2727('0x1f')]],'as':_0x2aa9d0['as'],'attributes':_0x2aa9d0['attributes'],'include':_0x2aa9d0[_0x2727('0x1d')]?_['map'](_0x2aa9d0[_0x2727('0x1d')],function(_0xdb8daa){return{'model':db[_0xdb8daa[_0x2727('0x1f')]],'as':_0xdb8daa['as'],'attributes':_0xdb8daa[_0x2727('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36748e){logger[_0x2727('0xe')](_0x2727('0x20'),_0x153408);logger[_0x2727('0x11')]('GetVoiceQueue',_0x153408,JSON[_0x2727('0x21')](_0x36748e));_0x174a70(_0x36748e);})[_0x2727('0x17')](function(_0x183ae7){logger[_0x2727('0x13')](_0x2727('0x20'),_0x183ae7[_0x2727('0x15')],_0x153408);_0x5027b5(_0x188928[_0x2727('0x13')](0x1f4,_0x183ae7[_0x2727('0x15')]));});});};exports[_0x2727('0x22')]=function(_0x616058){var _0x5e5b24=this;return new Promise(function(_0x5497c0,_0x445e41){return db['VoiceQueue'][_0x2727('0x23')]({'raw':_0x616058[_0x2727('0x19')]?_0x616058[_0x2727('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x616058[_0x2727('0x19')]?_0x616058['options']['where']||null:null,'attributes':_0x616058['options']?_0x616058[_0x2727('0x19')][_0x2727('0x1c')]||null:null,'include':_0x616058[_0x2727('0x19')]?_0x616058[_0x2727('0x19')][_0x2727('0x1d')]?_['map'](_0x616058['options']['include'],function(_0x100461){return{'model':db[_0x100461[_0x2727('0x1f')]],'as':_0x100461['as'],'attributes':_0x100461[_0x2727('0x1c')],'include':_0x100461['include']?_[_0x2727('0x1e')](_0x100461[_0x2727('0x1d')],function(_0x5d72de){return{'model':db[_0x5d72de[_0x2727('0x1f')]],'as':_0x5d72de['as'],'attributes':_0x5d72de[_0x2727('0x1c')],'include':_0x5d72de[_0x2727('0x1d')]?_[_0x2727('0x1e')](_0x5d72de[_0x2727('0x1d')],function(_0x47cd19){return{'model':db[_0x47cd19[_0x2727('0x1f')]],'as':_0x47cd19['as'],'attributes':_0x47cd19[_0x2727('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2727('0x24')](function(_0x1a7740){logger[_0x2727('0xe')]('ShowVoiceQueue',_0x616058);logger[_0x2727('0x11')]('ShowVoiceQueue',_0x616058,JSON[_0x2727('0x21')](_0x1a7740));_0x5497c0(_0x1a7740);})['catch'](function(_0xd119d5){logger[_0x2727('0x13')](_0x2727('0x22'),_0xd119d5[_0x2727('0x15')],_0x616058);_0x445e41(_0x5e5b24[_0x2727('0x13')](0x1f4,_0xd119d5['message']));});});}; \ No newline at end of file +var _0xcbd3=['limit','include','map','model','then','GetVoiceQueue','catch','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','findAll','options','raw','attributes'];(function(_0x51f900,_0x5d309f){var _0x24d395=function(_0x44b664){while(--_0x44b664){_0x51f900['push'](_0x51f900['shift']());}};_0x24d395(++_0x5d309f);}(_0xcbd3,0x1ab));var _0x3cbd=function(_0x12fb3e,_0x3e3645){_0x12fb3e=_0x12fb3e-0x0;var _0x425ec5=_0xcbd3[_0x12fb3e];return _0x425ec5;};'use strict';var _=require(_0x3cbd('0x0'));var util=require(_0x3cbd('0x1'));var moment=require(_0x3cbd('0x2'));var BPromise=require(_0x3cbd('0x3'));var rs=require(_0x3cbd('0x4'));var fs=require('fs');var Redis=require(_0x3cbd('0x5'));var db=require(_0x3cbd('0x6'))['db'];var utils=require(_0x3cbd('0x7'));var logger=require(_0x3cbd('0x8'))('rpc');var config=require(_0x3cbd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3cbd('0xa')][_0x3cbd('0xb')]({'port':0x232a});config[_0x3cbd('0xc')]=_[_0x3cbd('0xd')](config[_0x3cbd('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3cbd('0xe'))[_0x3cbd('0xf')](socket);function respondWithRpcPromise(_0x12174f,_0x19b7d8,_0x43e536){return new BPromise(function(_0x45676f,_0x3b104b){return client[_0x3cbd('0x10')](_0x12174f,_0x43e536)['then'](function(_0x155558){logger[_0x3cbd('0x11')](_0x3cbd('0x12'),_0x19b7d8,_0x3cbd('0x13'));logger[_0x3cbd('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x19b7d8,_0x3cbd('0x13'),JSON[_0x3cbd('0x15')](_0x155558));if(_0x155558['error']){if(_0x155558[_0x3cbd('0x16')]['code']===0x1f4){logger[_0x3cbd('0x16')](_0x3cbd('0x12'),_0x19b7d8,_0x155558['error'][_0x3cbd('0x17')]);return _0x3b104b(_0x155558[_0x3cbd('0x16')][_0x3cbd('0x17')]);}logger['error'](_0x3cbd('0x12'),_0x19b7d8,_0x155558['error']['message']);return _0x45676f(_0x155558[_0x3cbd('0x16')]['message']);}else{logger[_0x3cbd('0x11')](_0x3cbd('0x12'),_0x19b7d8,_0x3cbd('0x13'));_0x45676f(_0x155558[_0x3cbd('0x18')][_0x3cbd('0x17')]);}})['catch'](function(_0x2427a3){logger[_0x3cbd('0x16')](_0x3cbd('0x12'),_0x19b7d8,_0x2427a3);_0x3b104b(_0x2427a3);});});}exports['GetVoiceQueue']=function(_0x3bb353){var _0x111913=this;return new Promise(function(_0x2ce346,_0x3440dd){return db['VoiceQueue'][_0x3cbd('0x19')]({'raw':_0x3bb353[_0x3cbd('0x1a')]?_0x3bb353[_0x3cbd('0x1a')][_0x3cbd('0x1b')]===undefined?!![]:![]:!![],'where':_0x3bb353[_0x3cbd('0x1a')]?_0x3bb353['options']['where']||null:null,'attributes':_0x3bb353['options']?_0x3bb353[_0x3cbd('0x1a')][_0x3cbd('0x1c')]||null:null,'limit':_0x3bb353[_0x3cbd('0x1a')]?_0x3bb353[_0x3cbd('0x1a')][_0x3cbd('0x1d')]||null:null,'include':_0x3bb353[_0x3cbd('0x1a')]?_0x3bb353['options'][_0x3cbd('0x1e')]?_['map'](_0x3bb353[_0x3cbd('0x1a')]['include'],function(_0x338b98){return{'model':db[_0x338b98['model']],'as':_0x338b98['as'],'attributes':_0x338b98[_0x3cbd('0x1c')],'include':_0x338b98['include']?_[_0x3cbd('0x1f')](_0x338b98[_0x3cbd('0x1e')],function(_0x56a876){return{'model':db[_0x56a876['model']],'as':_0x56a876['as'],'attributes':_0x56a876[_0x3cbd('0x1c')],'include':_0x56a876[_0x3cbd('0x1e')]?_[_0x3cbd('0x1f')](_0x56a876[_0x3cbd('0x1e')],function(_0x2e44e5){return{'model':db[_0x2e44e5[_0x3cbd('0x20')]],'as':_0x2e44e5['as'],'attributes':_0x2e44e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x3cbd('0x21')](function(_0x47ab23){logger[_0x3cbd('0x11')](_0x3cbd('0x22'),_0x3bb353);logger[_0x3cbd('0x14')](_0x3cbd('0x22'),_0x3bb353,JSON[_0x3cbd('0x15')](_0x47ab23));_0x2ce346(_0x47ab23);})[_0x3cbd('0x23')](function(_0x484379){logger[_0x3cbd('0x16')](_0x3cbd('0x22'),_0x484379[_0x3cbd('0x17')],_0x3bb353);_0x3440dd(_0x111913[_0x3cbd('0x16')](0x1f4,_0x484379[_0x3cbd('0x17')]));});});};exports[_0x3cbd('0x24')]=function(_0x3fbc76){var _0x340eeb=this;return new Promise(function(_0x25dc3b,_0x178079){return db['VoiceQueue'][_0x3cbd('0x25')]({'raw':_0x3fbc76['options']?_0x3fbc76[_0x3cbd('0x1a')][_0x3cbd('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fbc76[_0x3cbd('0x1a')]?_0x3fbc76[_0x3cbd('0x1a')]['where']||null:null,'attributes':_0x3fbc76[_0x3cbd('0x1a')]?_0x3fbc76[_0x3cbd('0x1a')]['attributes']||null:null,'include':_0x3fbc76[_0x3cbd('0x1a')]?_0x3fbc76['options'][_0x3cbd('0x1e')]?_['map'](_0x3fbc76['options'][_0x3cbd('0x1e')],function(_0x44a25b){return{'model':db[_0x44a25b[_0x3cbd('0x20')]],'as':_0x44a25b['as'],'attributes':_0x44a25b[_0x3cbd('0x1c')],'include':_0x44a25b[_0x3cbd('0x1e')]?_[_0x3cbd('0x1f')](_0x44a25b[_0x3cbd('0x1e')],function(_0x39334d){return{'model':db[_0x39334d[_0x3cbd('0x20')]],'as':_0x39334d['as'],'attributes':_0x39334d[_0x3cbd('0x1c')],'include':_0x39334d['include']?_[_0x3cbd('0x1f')](_0x39334d[_0x3cbd('0x1e')],function(_0x1c2c8d){return{'model':db[_0x1c2c8d['model']],'as':_0x1c2c8d['as'],'attributes':_0x1c2c8d[_0x3cbd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3cbd('0x21')](function(_0x5039e3){logger[_0x3cbd('0x11')]('ShowVoiceQueue',_0x3fbc76);logger[_0x3cbd('0x14')]('ShowVoiceQueue',_0x3fbc76,JSON[_0x3cbd('0x15')](_0x5039e3));_0x25dc3b(_0x5039e3);})[_0x3cbd('0x23')](function(_0x5273bf){logger[_0x3cbd('0x16')]('ShowVoiceQueue',_0x5273bf[_0x3cbd('0x17')],_0x3fbc76);_0x178079(_0x340eeb[_0x3cbd('0x16')](0x1f4,_0x5273bf['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 0ff694b..d806203 100644 --- a/server/api/voiceQueue/voiceQueue.socket.js +++ b/server/api/voiceQueue/voiceQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed27=['register','length','voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener'];(function(_0x1b0c7c,_0x512e34){var _0x2b0e4c=function(_0x48c2a4){while(--_0x48c2a4){_0x1b0c7c['push'](_0x1b0c7c['shift']());}};_0x2b0e4c(++_0x512e34);}(_0xed27,0x183));var _0x7ed2=function(_0x359996,_0x430a61){_0x359996=_0x359996-0x0;var _0x16ad35=_0xed27[_0x359996];return _0x16ad35;};'use strict';var VoiceQueueEvents=require(_0x7ed2('0x0'));var events=[_0x7ed2('0x1'),_0x7ed2('0x2'),'update'];function createListener(_0x569eee,_0x2f0448){return function(_0x14d20c){_0x2f0448[_0x7ed2('0x3')](_0x569eee,_0x14d20c);};}function removeListener(_0x2ceee1,_0x4a0c79){return function(){VoiceQueueEvents[_0x7ed2('0x4')](_0x2ceee1,_0x4a0c79);};}exports[_0x7ed2('0x5')]=function(_0x12e6bb){for(var _0x26bea2=0x0,_0x38d82a=events[_0x7ed2('0x6')];_0x26bea2<_0x38d82a;_0x26bea2++){var _0x3e362f=events[_0x26bea2];var _0x1e5d9f=createListener(_0x7ed2('0x7')+_0x3e362f,_0x12e6bb);VoiceQueueEvents['on'](_0x3e362f,_0x1e5d9f);}}; \ No newline at end of file +var _0xa0e5=['register','length','./voiceQueue.events','save','update','emit','removeListener'];(function(_0x2f59f1,_0xdfe0c6){var _0x2ee114=function(_0x42a856){while(--_0x42a856){_0x2f59f1['push'](_0x2f59f1['shift']());}};_0x2ee114(++_0xdfe0c6);}(_0xa0e5,0x175));var _0x5a0e=function(_0x429e67,_0x30a281){_0x429e67=_0x429e67-0x0;var _0x1f5dab=_0xa0e5[_0x429e67];return _0x1f5dab;};'use strict';var VoiceQueueEvents=require(_0x5a0e('0x0'));var events=[_0x5a0e('0x1'),'remove',_0x5a0e('0x2')];function createListener(_0x4c7619,_0x50b02e){return function(_0x421308){_0x50b02e[_0x5a0e('0x3')](_0x4c7619,_0x421308);};}function removeListener(_0x337494,_0x15300e){return function(){VoiceQueueEvents[_0x5a0e('0x4')](_0x337494,_0x15300e);};}exports[_0x5a0e('0x5')]=function(_0x31bcb6){for(var _0x3054a4=0x0,_0x5751b6=events[_0x5a0e('0x6')];_0x3054a4<_0x5751b6;_0x3054a4++){var _0x40e228=events[_0x3054a4];var _0xae04cf=createListener('voiceQueue:'+_0x40e228,_0x31bcb6);VoiceQueueEvents['on'](_0x40e228,_0xae04cf);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e85c823..a22a722 100644 --- a/server/api/voiceQueueReport/index.js +++ b/server/api/voiceQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0f4=['post','put','update','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','getVoiceQueuesReport','/:id','show'];(function(_0x1aba9e,_0x1e31cd){var _0x57caf7=function(_0x2562f8){while(--_0x2562f8){_0x1aba9e['push'](_0x1aba9e['shift']());}};_0x57caf7(++_0x1e31cd);}(_0xf0f4,0x182));var _0x4f0f=function(_0x2db7c3,_0x5d29d4){_0x2db7c3=_0x2db7c3-0x0;var _0x5d7891=_0xf0f4[_0x2db7c3];return _0x5d7891;};'use strict';var multer=require('multer');var util=require(_0x4f0f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f0f('0x1'));var router=express[_0x4f0f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4f0f('0x3'));var config=require(_0x4f0f('0x4'));var controller=require(_0x4f0f('0x5'));router[_0x4f0f('0x6')]('/',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x8')]);router[_0x4f0f('0x6')]('/describe',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x9')]);router[_0x4f0f('0x6')]('/index',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0xa')]);router[_0x4f0f('0x6')](_0x4f0f('0xb'),auth[_0x4f0f('0x7')](),controller[_0x4f0f('0xc')]);router[_0x4f0f('0xd')]('/',auth[_0x4f0f('0x7')](),controller['create']);router[_0x4f0f('0xe')](_0x4f0f('0xb'),auth[_0x4f0f('0x7')](),controller[_0x4f0f('0xf')]);router[_0x4f0f('0x10')](_0x4f0f('0xb'),auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x11')]);module[_0x4f0f('0x12')]=router; \ No newline at end of file +var _0x3e24=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','show','update','delete','/:id','destroy','exports','multer'];(function(_0x217d51,_0x34ad3f){var _0x26dbcd=function(_0x4ecc26){while(--_0x4ecc26){_0x217d51['push'](_0x217d51['shift']());}};_0x26dbcd(++_0x34ad3f);}(_0x3e24,0x167));var _0x43e2=function(_0x39f097,_0x17116b){_0x39f097=_0x39f097-0x0;var _0x544f6a=_0x3e24[_0x39f097];return _0x544f6a;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var auth=require(_0x43e2('0x5'));var interaction=require(_0x43e2('0x6'));var config=require('../../config/environment');var controller=require(_0x43e2('0x7'));router[_0x43e2('0x8')]('/',auth[_0x43e2('0x9')](),controller[_0x43e2('0xa')]);router[_0x43e2('0x8')](_0x43e2('0xb'),auth[_0x43e2('0x9')](),controller['describe']);router[_0x43e2('0x8')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x8')]('/:id',auth[_0x43e2('0x9')](),controller[_0x43e2('0xe')]);router['post']('/',auth[_0x43e2('0x9')](),controller['create']);router['put']('/:id',auth[_0x43e2('0x9')](),controller[_0x43e2('0xf')]);router[_0x43e2('0x10')](_0x43e2('0x11'),auth[_0x43e2('0x9')](),controller[_0x43e2('0x12')]);module[_0x43e2('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ea9a2ee..e844191 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x219407,_0x36c620){var _0x240e77=function(_0x1d0a73){while(--_0x1d0a73){_0x219407['push'](_0x219407['shift']());}};_0x240e77(++_0x36c620);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x4c8f89,_0x318d19){var _0x5c5685=function(_0x28ea15){while(--_0x28ea15){_0x4c8f89['push'](_0x4c8f89['shift']());}};_0x5c5685(++_0x318d19);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index fc523a4..773108f 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x48eef4,_0x54ca8f){var _0xbcb029=function(_0x19da4c){while(--_0x19da4c){_0x48eef4['push'](_0x48eef4['shift']());}};_0xbcb029(++_0x54ca8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x42dd21,_0x277ec4){var _0x3746a1=function(_0x28aa81){while(--_0x28aa81){_0x42dd21['push'](_0x42dd21['shift']());}};_0x3746a1(++_0x277ec4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 534e6ca..51173e4 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.events.js +++ b/server/api/voiceQueueReport/voiceQueueReport.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3146=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5ad579,_0x479dad){var _0x33c479=function(_0x2b74c4){while(--_0x2b74c4){_0x5ad579['push'](_0x5ad579['shift']());}};_0x33c479(++_0x479dad);}(_0x3146,0x1a4));var _0x6314=function(_0x1fb394,_0xd1497){_0x1fb394=_0x1fb394-0x0;var _0x3c35cc=_0x3146[_0x1fb394];return _0x3c35cc;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x6314('0x0'))['db'][_0x6314('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6314('0x2')](0x0);var events={'afterCreate':_0x6314('0x3'),'afterUpdate':_0x6314('0x4'),'afterDestroy':_0x6314('0x5')};function emitEvent(_0x15aeb8){return function(_0x2a3b7b,_0x158f79,_0x3d5fec){VoiceQueueReportEvents['emit'](_0x15aeb8+':'+_0x2a3b7b['id'],_0x2a3b7b);VoiceQueueReportEvents[_0x6314('0x6')](_0x15aeb8,_0x2a3b7b);_0x3d5fec(null);};}for(var e in events){if(events[_0x6314('0x7')](e)){var event=events[e];VoiceQueueReport[_0x6314('0x8')](e,emitEvent(event));}}module[_0x6314('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x0917=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x0917,0x105));var _0x7091=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x0917[_0x330414];return _0x99dbff;};'use strict';var EventEmitter=require(_0x7091('0x0'));var VoiceQueueReport=require(_0x7091('0x1'))['db'][_0x7091('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7091('0x3')](0x0);var events={'afterCreate':_0x7091('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x46556d){return function(_0x50048f,_0x5d34f2,_0x547d70){VoiceQueueReportEvents['emit'](_0x46556d+':'+_0x50048f['id'],_0x50048f);VoiceQueueReportEvents[_0x7091('0x5')](_0x46556d,_0x50048f);_0x547d70(null);};}for(var e in events){if(events[_0x7091('0x6')](e)){var event=events[e];VoiceQueueReport[_0x7091('0x7')](e,emitEvent(event));}}module[_0x7091('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c5a7fdd..ce16285 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0x24894e,_0x5bd37c){var _0x953b99=function(_0x49f613){while(--_0x49f613){_0x24894e['push'](_0x24894e['shift']());}};_0x953b99(++_0x5bd37c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x2032,0xd9));var _0x2203=function(_0x3ad045,_0x3877d2){_0x3ad045=_0x3ad045-0x0;var _0x2e194b=_0x2032[_0x3ad045];return _0x2e194b;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6dfdfc6..5fcb113 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.rpc.js +++ b/server/api/voiceQueueReport/voiceQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc35f=['../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','catch','VoiceQueueReport','findAll','options','raw','where','limit','include','map','attributes','GetVoiceQueueReport','body','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5f1936,_0x461655){var _0x27639d=function(_0x2547b1){while(--_0x2547b1){_0x5f1936['push'](_0x5f1936['shift']());}};_0x27639d(++_0x461655);}(_0xc35f,0xeb));var _0xfc35=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xc35f[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc35('0x0'));var BPromise=require('bluebird');var rs=require(_0xfc35('0x1'));var fs=require('fs');var Redis=require(_0xfc35('0x2'));var db=require(_0xfc35('0x3'))['db'];var utils=require(_0xfc35('0x4'));var logger=require(_0xfc35('0x5'))(_0xfc35('0x6'));var config=require('../../config/environment');var jayson=require(_0xfc35('0x7'));var client=jayson['client'][_0xfc35('0x8')]({'port':0x232a});config[_0xfc35('0x9')]=_[_0xfc35('0xa')](config[_0xfc35('0x9')],{'host':_0xfc35('0xb'),'port':0x18eb});var socket=require(_0xfc35('0xc'))(new Redis(config[_0xfc35('0x9')]));require(_0xfc35('0xd'))[_0xfc35('0xe')](socket);function respondWithRpcPromise(_0x1481e4,_0x59ff96,_0x25ec4b){return new BPromise(function(_0x2709c1,_0x31e96b){return client[_0xfc35('0xf')](_0x1481e4,_0x25ec4b)[_0xfc35('0x10')](function(_0x4c5d5f){logger[_0xfc35('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x59ff96,_0xfc35('0x12'));logger[_0xfc35('0x13')](_0xfc35('0x14'),_0x59ff96,_0xfc35('0x12'),JSON[_0xfc35('0x15')](_0x4c5d5f));if(_0x4c5d5f[_0xfc35('0x16')]){if(_0x4c5d5f['error']['code']===0x1f4){logger['error'](_0xfc35('0x17'),_0x59ff96,_0x4c5d5f[_0xfc35('0x16')]['message']);return _0x31e96b(_0x4c5d5f[_0xfc35('0x16')][_0xfc35('0x18')]);}logger['error'](_0xfc35('0x17'),_0x59ff96,_0x4c5d5f['error'][_0xfc35('0x18')]);return _0x2709c1(_0x4c5d5f[_0xfc35('0x16')][_0xfc35('0x18')]);}else{logger[_0xfc35('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x59ff96,_0xfc35('0x12'));_0x2709c1(_0x4c5d5f['result'][_0xfc35('0x18')]);}})[_0xfc35('0x19')](function(_0x207c23){logger[_0xfc35('0x16')](_0xfc35('0x17'),_0x59ff96,_0x207c23);_0x31e96b(_0x207c23);});});}exports['GetVoiceQueueReport']=function(_0x2bbc46){var _0x3480ab=this;return new Promise(function(_0x35b3ea,_0x111b42){return db[_0xfc35('0x1a')][_0xfc35('0x1b')]({'raw':_0x2bbc46[_0xfc35('0x1c')]?_0x2bbc46['options'][_0xfc35('0x1d')]===undefined?!![]:![]:!![],'where':_0x2bbc46['options']?_0x2bbc46['options'][_0xfc35('0x1e')]||null:null,'attributes':_0x2bbc46[_0xfc35('0x1c')]?_0x2bbc46[_0xfc35('0x1c')]['attributes']||null:null,'limit':_0x2bbc46[_0xfc35('0x1c')]?_0x2bbc46[_0xfc35('0x1c')][_0xfc35('0x1f')]||null:null,'include':_0x2bbc46['options']?_0x2bbc46[_0xfc35('0x1c')][_0xfc35('0x20')]?_[_0xfc35('0x21')](_0x2bbc46['options'][_0xfc35('0x20')],function(_0x564e59){return{'model':db[_0x564e59['model']],'as':_0x564e59['as'],'attributes':_0x564e59['attributes'],'include':_0x564e59['include']?_[_0xfc35('0x21')](_0x564e59[_0xfc35('0x20')],function(_0x424db7){return{'model':db[_0x424db7['model']],'as':_0x424db7['as'],'attributes':_0x424db7[_0xfc35('0x22')],'include':_0x424db7[_0xfc35('0x20')]?_['map'](_0x424db7[_0xfc35('0x20')],function(_0x4a70b8){return{'model':db[_0x4a70b8['model']],'as':_0x4a70b8['as'],'attributes':_0x4a70b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc35('0x10')](function(_0x44348a){logger['info']('GetVoiceQueueReport',_0x2bbc46);logger[_0xfc35('0x13')](_0xfc35('0x23'),_0x2bbc46,JSON[_0xfc35('0x15')](_0x44348a));_0x35b3ea(_0x44348a);})[_0xfc35('0x19')](function(_0x277240){logger[_0xfc35('0x16')]('GetVoiceQueueReport',_0x277240[_0xfc35('0x18')],_0x2bbc46);_0x111b42(_0x3480ab[_0xfc35('0x16')](0x1f4,_0x277240[_0xfc35('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x2ec97f){var _0x2b1de2=this;return new Promise(function(_0xa210df,_0x51b14a){return db[_0xfc35('0x1a')]['create'](_0x2ec97f[_0xfc35('0x24')],{'raw':_0x2ec97f[_0xfc35('0x1c')]?_0x2ec97f['options'][_0xfc35('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x23bc06){logger[_0xfc35('0x11')](_0xfc35('0x25'),_0x2ec97f);logger[_0xfc35('0x13')](_0xfc35('0x25'),_0x2ec97f,JSON[_0xfc35('0x15')](_0x23bc06));_0xa210df(_0x23bc06);})[_0xfc35('0x19')](function(_0x3189d6){logger['error'](_0xfc35('0x25'),_0x3189d6[_0xfc35('0x18')],_0x2ec97f);_0x51b14a(_0x2b1de2[_0xfc35('0x16')](0x1f4,_0x3189d6[_0xfc35('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x4cf0d6){var _0x246993=this;return new Promise(function(_0x5c4ff4,_0x35f2ca){return db[_0xfc35('0x1a')][_0xfc35('0x26')](_0x4cf0d6[_0xfc35('0x24')],{'raw':_0x4cf0d6[_0xfc35('0x1c')]?_0x4cf0d6[_0xfc35('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cf0d6[_0xfc35('0x1c')]?_0x4cf0d6['options'][_0xfc35('0x1e')]||null:null,'attributes':_0x4cf0d6[_0xfc35('0x1c')]?_0x4cf0d6['options'][_0xfc35('0x22')]||null:null,'limit':_0x4cf0d6[_0xfc35('0x1c')]?_0x4cf0d6['options'][_0xfc35('0x1f')]||null:null})[_0xfc35('0x10')](function(_0x463fb2){logger[_0xfc35('0x11')](_0xfc35('0x27'),_0x4cf0d6);logger[_0xfc35('0x13')](_0xfc35('0x27'),_0x4cf0d6,JSON[_0xfc35('0x15')](_0x463fb2));_0x5c4ff4(_0x463fb2);})[_0xfc35('0x19')](function(_0xa9d488){logger[_0xfc35('0x16')](_0xfc35('0x27'),_0xa9d488[_0xfc35('0x18')],_0x4cf0d6);_0x35f2ca(_0x246993['error'](0x1f4,_0xa9d488[_0xfc35('0x18')]));});});}; \ No newline at end of file +var _0x9c2f=['request\x20sent','error','code','message','result','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','update','body','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x525e11,_0x22ba00){var _0x3179a9=function(_0xb6ab32){while(--_0xb6ab32){_0x525e11['push'](_0x525e11['shift']());}};_0x3179a9(++_0x22ba00);}(_0x9c2f,0x1e3));var _0xf9c2=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0x9c2f[_0x3f8282];return _0x50f918;};'use strict';var _=require(_0xf9c2('0x0'));var util=require(_0xf9c2('0x1'));var moment=require(_0xf9c2('0x2'));var BPromise=require(_0xf9c2('0x3'));var rs=require(_0xf9c2('0x4'));var fs=require('fs');var Redis=require(_0xf9c2('0x5'));var db=require(_0xf9c2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9c2('0x7'))('rpc');var config=require(_0xf9c2('0x8'));var jayson=require(_0xf9c2('0x9'));var client=jayson[_0xf9c2('0xa')]['http']({'port':0x232a});config[_0xf9c2('0xb')]=_[_0xf9c2('0xc')](config['redis'],{'host':_0xf9c2('0xd'),'port':0x18eb});var socket=require(_0xf9c2('0xe'))(new Redis(config[_0xf9c2('0xb')]));require(_0xf9c2('0xf'))[_0xf9c2('0x10')](socket);function respondWithRpcPromise(_0x288d73,_0xdde7be,_0x237a0f){return new BPromise(function(_0x2f4a11,_0x44d23b){return client[_0xf9c2('0x11')](_0x288d73,_0x237a0f)[_0xf9c2('0x12')](function(_0x4b8db3){logger[_0xf9c2('0x13')](_0xf9c2('0x14'),_0xdde7be,'request\x20sent');logger[_0xf9c2('0x15')](_0xf9c2('0x16'),_0xdde7be,_0xf9c2('0x17'),JSON['stringify'](_0x4b8db3));if(_0x4b8db3['error']){if(_0x4b8db3[_0xf9c2('0x18')][_0xf9c2('0x19')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0xdde7be,_0x4b8db3['error']['message']);return _0x44d23b(_0x4b8db3[_0xf9c2('0x18')][_0xf9c2('0x1a')]);}logger['error'](_0xf9c2('0x14'),_0xdde7be,_0x4b8db3[_0xf9c2('0x18')][_0xf9c2('0x1a')]);return _0x2f4a11(_0x4b8db3[_0xf9c2('0x18')][_0xf9c2('0x1a')]);}else{logger[_0xf9c2('0x13')](_0xf9c2('0x14'),_0xdde7be,_0xf9c2('0x17'));_0x2f4a11(_0x4b8db3[_0xf9c2('0x1b')][_0xf9c2('0x1a')]);}})['catch'](function(_0x481a10){logger[_0xf9c2('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0xdde7be,_0x481a10);_0x44d23b(_0x481a10);});});}exports[_0xf9c2('0x1c')]=function(_0x11b5ec){var _0x176834=this;return new Promise(function(_0x574093,_0x5653f7){return db['VoiceQueueReport'][_0xf9c2('0x1d')]({'raw':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec[_0xf9c2('0x1e')][_0xf9c2('0x1f')]===undefined?!![]:![]:!![],'where':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec['options'][_0xf9c2('0x20')]||null:null,'attributes':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec[_0xf9c2('0x1e')][_0xf9c2('0x21')]||null:null,'limit':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec[_0xf9c2('0x1e')][_0xf9c2('0x22')]||null:null,'include':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec['options'][_0xf9c2('0x23')]?_[_0xf9c2('0x24')](_0x11b5ec[_0xf9c2('0x1e')][_0xf9c2('0x23')],function(_0x20c9ed){return{'model':db[_0x20c9ed['model']],'as':_0x20c9ed['as'],'attributes':_0x20c9ed[_0xf9c2('0x21')],'include':_0x20c9ed[_0xf9c2('0x23')]?_[_0xf9c2('0x24')](_0x20c9ed[_0xf9c2('0x23')],function(_0x2c696c){return{'model':db[_0x2c696c[_0xf9c2('0x25')]],'as':_0x2c696c['as'],'attributes':_0x2c696c[_0xf9c2('0x21')],'include':_0x2c696c[_0xf9c2('0x23')]?_[_0xf9c2('0x24')](_0x2c696c[_0xf9c2('0x23')],function(_0x227fd6){return{'model':db[_0x227fd6[_0xf9c2('0x25')]],'as':_0x227fd6['as'],'attributes':_0x227fd6[_0xf9c2('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf9c2('0x12')](function(_0x353eae){logger[_0xf9c2('0x13')](_0xf9c2('0x1c'),_0x11b5ec);logger[_0xf9c2('0x15')](_0xf9c2('0x1c'),_0x11b5ec,JSON[_0xf9c2('0x26')](_0x353eae));_0x574093(_0x353eae);})['catch'](function(_0xf5a143){logger[_0xf9c2('0x18')](_0xf9c2('0x1c'),_0xf5a143[_0xf9c2('0x1a')],_0x11b5ec);_0x5653f7(_0x176834['error'](0x1f4,_0xf5a143[_0xf9c2('0x1a')]));});});};exports[_0xf9c2('0x27')]=function(_0x131f48){var _0x2824dc=this;return new Promise(function(_0x5833a7,_0x1720ad){return db[_0xf9c2('0x28')][_0xf9c2('0x29')](_0x131f48['body'],{'raw':_0x131f48[_0xf9c2('0x1e')]?_0x131f48[_0xf9c2('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x134e05){logger['info'](_0xf9c2('0x27'),_0x131f48);logger[_0xf9c2('0x15')](_0xf9c2('0x27'),_0x131f48,JSON[_0xf9c2('0x26')](_0x134e05));_0x5833a7(_0x134e05);})['catch'](function(_0x3f3583){logger[_0xf9c2('0x18')](_0xf9c2('0x27'),_0x3f3583[_0xf9c2('0x1a')],_0x131f48);_0x1720ad(_0x2824dc[_0xf9c2('0x18')](0x1f4,_0x3f3583[_0xf9c2('0x1a')]));});});};exports[_0xf9c2('0x2a')]=function(_0x206ea6){var _0x24ddf4=this;return new Promise(function(_0x305ff1,_0x1e4219){return db['VoiceQueueReport'][_0xf9c2('0x2b')](_0x206ea6[_0xf9c2('0x2c')],{'raw':_0x206ea6['options']?_0x206ea6[_0xf9c2('0x1e')][_0xf9c2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x206ea6[_0xf9c2('0x1e')]?_0x206ea6[_0xf9c2('0x1e')][_0xf9c2('0x20')]||null:null,'attributes':_0x206ea6[_0xf9c2('0x1e')]?_0x206ea6['options'][_0xf9c2('0x21')]||null:null,'limit':_0x206ea6[_0xf9c2('0x1e')]?_0x206ea6[_0xf9c2('0x1e')][_0xf9c2('0x22')]||null:null})[_0xf9c2('0x12')](function(_0x4d5f4b){logger[_0xf9c2('0x13')](_0xf9c2('0x2a'),_0x206ea6);logger['debug'](_0xf9c2('0x2a'),_0x206ea6,JSON[_0xf9c2('0x26')](_0x4d5f4b));_0x305ff1(_0x4d5f4b);})[_0xf9c2('0x2d')](function(_0x46053e){logger['error'](_0xf9c2('0x2a'),_0x46053e[_0xf9c2('0x1a')],_0x206ea6);_0x1e4219(_0x24ddf4[_0xf9c2('0x18')](0x1f4,_0x46053e[_0xf9c2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 97eac9f..590b1e6 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf410=['removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x46dfd2,_0x5528ba){var _0x3a88ee=function(_0x3e9ff8){while(--_0x3e9ff8){_0x46dfd2['push'](_0x46dfd2['shift']());}};_0x3a88ee(++_0x5528ba);}(_0xf410,0x183));var _0x0f41=function(_0x554f14,_0x4b4950){_0x554f14=_0x554f14-0x0;var _0x306476=_0xf410[_0x554f14];return _0x306476;};'use strict';var VoiceQueueReportEvents=require(_0x0f41('0x0'));var events=[_0x0f41('0x1'),_0x0f41('0x2'),_0x0f41('0x3')];function createListener(_0x4d5862,_0xeeec){return function(_0x21bdda){_0xeeec[_0x0f41('0x4')](_0x4d5862,_0x21bdda);};}function removeListener(_0xf239d9,_0x18a433){return function(){VoiceQueueReportEvents[_0x0f41('0x5')](_0xf239d9,_0x18a433);};}exports['register']=function(_0x13614e){for(var _0x6407d8=0x0,_0x50e5ad=events[_0x0f41('0x6')];_0x6407d8<_0x50e5ad;_0x6407d8++){var _0x61e03=events[_0x6407d8];var _0xc4d794=createListener(_0x0f41('0x7')+_0x61e03,_0x13614e);VoiceQueueReportEvents['on'](_0x61e03,_0xc4d794);}}; \ No newline at end of file +var _0x9f5a=['update','emit','removeListener','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0x9f5a,0x170));var _0xa9f5=function(_0x193293,_0x567c96){_0x193293=_0x193293-0x0;var _0x458c17=_0x9f5a[_0x193293];return _0x458c17;};'use strict';var VoiceQueueReportEvents=require(_0xa9f5('0x0'));var events=[_0xa9f5('0x1'),_0xa9f5('0x2'),_0xa9f5('0x3')];function createListener(_0xa8221a,_0x488bd0){return function(_0x5034b4){_0x488bd0[_0xa9f5('0x4')](_0xa8221a,_0x5034b4);};}function removeListener(_0x4e43ce,_0x300d66){return function(){VoiceQueueReportEvents[_0xa9f5('0x5')](_0x4e43ce,_0x300d66);};}exports['register']=function(_0x31486f){for(var _0x1d77f8=0x0,_0x45cf3b=events['length'];_0x1d77f8<_0x45cf3b;_0x1d77f8++){var _0x43ea4e=events[_0x1d77f8];var _0x577478=createListener(_0xa9f5('0x6')+_0x43ea4e,_0x31486f);VoiceQueueReportEvents['on'](_0x43ea4e,_0x577478);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ba77be4..7af5df3 100644 --- a/server/api/voiceQueuesLog/index.js +++ b/server/api/voiceQueuesLog/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x709e=['../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','update','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x709e,0xab));var _0xe709=function(_0x5ca1e5,_0x4f929e){_0x5ca1e5=_0x5ca1e5-0x0;var _0x5ea277=_0x709e[_0x5ca1e5];return _0x5ea277;};'use strict';var multer=require(_0xe709('0x0'));var util=require(_0xe709('0x1'));var path=require(_0xe709('0x2'));var timeout=require('connect-timeout');var express=require(_0xe709('0x3'));var router=express[_0xe709('0x4')]();var auth=require(_0xe709('0x5'));var interaction=require(_0xe709('0x6'));var config=require('../../config/environment');var controller=require(_0xe709('0x7'));router[_0xe709('0x8')]('/',auth[_0xe709('0x9')](),controller[_0xe709('0xa')]);router[_0xe709('0x8')](_0xe709('0xb'),auth['isAuthenticated'](),controller[_0xe709('0xc')]);router[_0xe709('0xd')]('/',auth['isAuthenticated'](),controller[_0xe709('0xe')]);router['put'](_0xe709('0xb'),auth[_0xe709('0x9')](),controller[_0xe709('0xf')]);router['delete'](_0xe709('0xb'),auth[_0xe709('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdf97=['express','Router','../../components/interaction/service','get','index','isAuthenticated','show','post','create','put','/:id','destroy','exports','util','path','connect-timeout'];(function(_0x5eab4b,_0x465f55){var _0x28b471=function(_0x31e7fc){while(--_0x31e7fc){_0x5eab4b['push'](_0x5eab4b['shift']());}};_0x28b471(++_0x465f55);}(_0xdf97,0x11d));var _0x7df9=function(_0x446dda,_0x2ab1c0){_0x446dda=_0x446dda-0x0;var _0x4751ff=_0xdf97[_0x446dda];return _0x4751ff;};'use strict';var multer=require('multer');var util=require(_0x7df9('0x0'));var path=require(_0x7df9('0x1'));var timeout=require(_0x7df9('0x2'));var express=require(_0x7df9('0x3'));var router=express[_0x7df9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7df9('0x5'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x7df9('0x6')]('/',auth['isAuthenticated'](),controller[_0x7df9('0x7')]);router[_0x7df9('0x6')]('/:id',auth[_0x7df9('0x8')](),controller[_0x7df9('0x9')]);router[_0x7df9('0xa')]('/',auth[_0x7df9('0x8')](),controller[_0x7df9('0xb')]);router[_0x7df9('0xc')](_0x7df9('0xd'),auth[_0x7df9('0x8')](),controller['update']);router['delete'](_0x7df9('0xd'),auth[_0x7df9('0x8')](),controller[_0x7df9('0xe')]);module[_0x7df9('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 9a2f0e1..0ecf40e 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f92=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x39cff2,_0x271c09){var _0xdd0a7a=function(_0x256ac2){while(--_0x256ac2){_0x39cff2['push'](_0x39cff2['shift']());}};_0xdd0a7a(++_0x271c09);}(_0x7f92,0x170));var _0x27f9=function(_0x285d7c,_0x114987){_0x285d7c=_0x285d7c-0x0;var _0x3bc300=_0x7f92[_0x285d7c];return _0x3bc300;};'use strict';var Sequelize=require(_0x27f9('0x0'));var moment=require(_0x27f9('0x1'));module[_0x27f9('0x2')]={'time':{'type':Sequelize[_0x27f9('0x3')]},'callid':{'type':Sequelize[_0x27f9('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x27f9('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x27f9('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x27f9('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x27f9('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x27f9('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x27f9('0x4')],'allowNull':![],'defaultValue':moment()[_0x27f9('0x5')](_0x27f9('0x6'))}}; \ No newline at end of file +var _0xc4bb=['format','sequelize','moment','STRING','DATE'];(function(_0x59ef5e,_0x34be25){var _0xe7004d=function(_0x26f549){while(--_0x26f549){_0x59ef5e['push'](_0x59ef5e['shift']());}};_0xe7004d(++_0x34be25);}(_0xc4bb,0x15a));var _0xbc4b=function(_0x528b9b,_0x58520a){_0x528b9b=_0x528b9b-0x0;var _0x5f7129=_0xc4bb[_0x528b9b];return _0x5f7129;};'use strict';var Sequelize=require(_0xbc4b('0x0'));var moment=require(_0xbc4b('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xbc4b('0x3')],'allowNull':![],'defaultValue':moment()[_0xbc4b('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 97b607a..b9a35c7 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d98=['show','params','find','create','body','catch','update','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','VoiceQueuesLog','includeAll','include','findAll','rows'];(function(_0xb473a5,_0x5078bf){var _0x313f29=function(_0x588510){while(--_0x588510){_0xb473a5['push'](_0xb473a5['shift']());}};_0x313f29(++_0x5078bf);}(_0x5d98,0x174));var _0x85d9=function(_0x2971d,_0x342364){_0x2971d=_0x2971d-0x0;var _0x3033d3=_0x5d98[_0x2971d];return _0x3033d3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85d9('0x0'));var jsonpatch=require(_0x85d9('0x1'));var rp=require(_0x85d9('0x2'));var moment=require(_0x85d9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x85d9('0x4'));var sox=require('sox');var csv=require(_0x85d9('0x5'));var ejs=require(_0x85d9('0x6'));var fs=require('fs');var _=require(_0x85d9('0x7'));var squel=require('squel');var crypto=require(_0x85d9('0x8'));var jsforce=require(_0x85d9('0x9'));var deskjs=require(_0x85d9('0xa'));var toCsv=require(_0x85d9('0x5'));var querystring=require(_0x85d9('0xb'));var Papa=require('papaparse');var Redis=require(_0x85d9('0xc'));var authService=require(_0x85d9('0xd'));var qs=require(_0x85d9('0xe'));var as=require(_0x85d9('0xf'));var hardwareService=require(_0x85d9('0x10'));var logger=require('../../config/logger')(_0x85d9('0x11'));var utils=require(_0x85d9('0x12'));var config=require(_0x85d9('0x13'));var licenseUtil=require(_0x85d9('0x14'));var db=require(_0x85d9('0x15'))['db'];function respondWithStatusCode(_0x47cb2d,_0x596fe0){_0x596fe0=_0x596fe0||0xcc;return function(_0x36e4c3){if(_0x36e4c3){return _0x47cb2d[_0x85d9('0x16')](_0x596fe0);}return _0x47cb2d[_0x85d9('0x17')](_0x596fe0)[_0x85d9('0x18')]();};}function respondWithResult(_0x489b57,_0x3b9b6e){_0x3b9b6e=_0x3b9b6e||0xc8;return function(_0x5cd881){if(_0x5cd881){return _0x489b57[_0x85d9('0x17')](_0x3b9b6e)[_0x85d9('0x19')](_0x5cd881);}};}function respondWithFilteredResult(_0x338d96,_0x959bdf){return function(_0xb740a2){if(_0xb740a2){var _0x119c56=_0xb740a2[_0x85d9('0x1a')],_0x2ec293=_0x959bdf[_0x85d9('0x1b')],_0x29d38e=_0x959bdf[_0x85d9('0x1b')]+_0x959bdf['limit'],_0x264da4;if(_0x29d38e>=_0x119c56){_0x29d38e=_0x119c56;_0x264da4=0xc8;}else{_0x264da4=0xce;}_0x338d96[_0x85d9('0x17')](_0x264da4);return _0x338d96[_0x85d9('0x1c')](_0x85d9('0x1d'),_0x2ec293+'-'+_0x29d38e+'/'+_0x119c56)[_0x85d9('0x19')](_0xb740a2);}return null;};}function patchUpdates(_0x398812){return function(_0x4e7869){try{jsonpatch[_0x85d9('0x1e')](_0x4e7869,_0x398812,!![]);}catch(_0x1a4e40){return BPromise[_0x85d9('0x1f')](_0x1a4e40);}return _0x4e7869['save']();};}function saveUpdates(_0x316a91,_0x240d2b){return function(_0x255827){if(_0x255827){return _0x255827['update'](_0x316a91)[_0x85d9('0x20')](function(_0x129512){return _0x129512;});}return null;};}function removeEntity(_0x350015,_0x5f4309){return function(_0x282b34){if(_0x282b34){return _0x282b34[_0x85d9('0x21')]()['then'](function(){_0x350015[_0x85d9('0x17')](0xcc)[_0x85d9('0x18')]();});}};}function handleEntityNotFound(_0x384224,_0x35e76d){return function(_0x5468ae){if(!_0x5468ae){_0x384224[_0x85d9('0x16')](0x194);}return _0x5468ae;};}function handleError(_0x40709e,_0x4535bc){_0x4535bc=_0x4535bc||0x1f4;return function(_0x515372){logger['error'](_0x515372[_0x85d9('0x22')]);if(_0x515372[_0x85d9('0x23')]){delete _0x515372['name'];}_0x40709e[_0x85d9('0x17')](_0x4535bc)[_0x85d9('0x24')](_0x515372);};}exports[_0x85d9('0x25')]=function(_0x497267,_0x1ff655){var _0x2e229d={},_0x143f6a={},_0x4b3df2={'count':0x0,'rows':[]};var _0xd49aab=_[_0x85d9('0x26')](db['VoiceQueuesLog'][_0x85d9('0x27')],function(_0x257f2d){return{'name':_0x257f2d[_0x85d9('0x28')],'type':_0x257f2d[_0x85d9('0x29')][_0x85d9('0x2a')]};});_0x143f6a[_0x85d9('0x2b')]=_[_0x85d9('0x26')](_0xd49aab,_0x85d9('0x23'));_0x143f6a['query']=_[_0x85d9('0x2c')](_0x497267[_0x85d9('0x2d')]);_0x143f6a[_0x85d9('0x2e')]=_['intersection'](_0x143f6a['model'],_0x143f6a[_0x85d9('0x2d')]);_0x2e229d[_0x85d9('0x2f')]=_[_0x85d9('0x30')](_0x143f6a['model'],qs[_0x85d9('0x31')](_0x497267['query'][_0x85d9('0x31')]));_0x2e229d['attributes']=_0x2e229d['attributes'][_0x85d9('0x32')]?_0x2e229d[_0x85d9('0x2f')]:_0x143f6a[_0x85d9('0x2b')];if(!_0x497267['query'][_0x85d9('0x33')](_0x85d9('0x34'))){_0x2e229d[_0x85d9('0x35')]=qs[_0x85d9('0x35')](_0x497267[_0x85d9('0x2d')][_0x85d9('0x35')]);_0x2e229d[_0x85d9('0x1b')]=qs[_0x85d9('0x1b')](_0x497267[_0x85d9('0x2d')][_0x85d9('0x1b')]);}_0x2e229d[_0x85d9('0x36')]=qs['sort'](_0x497267['query'][_0x85d9('0x37')]);_0x2e229d[_0x85d9('0x38')]=qs[_0x85d9('0x2e')](_['pick'](_0x497267[_0x85d9('0x2d')],_0x143f6a[_0x85d9('0x2e')]),_0xd49aab);if(_0x497267[_0x85d9('0x2d')][_0x85d9('0x39')]){_0x2e229d['where']=_[_0x85d9('0x3a')](_0x2e229d[_0x85d9('0x38')],{'$or':_[_0x85d9('0x26')](_0xd49aab,function(_0x23b4e5){if(_0x23b4e5['type']!==_0x85d9('0x3b')){var _0xc7b713={};_0xc7b713[_0x23b4e5[_0x85d9('0x23')]]={'$like':'%'+_0x497267[_0x85d9('0x2d')][_0x85d9('0x39')]+'%'};return _0xc7b713;}})});}_0x2e229d=_[_0x85d9('0x3a')]({},_0x2e229d,_0x497267[_0x85d9('0x3c')]);var _0x38542a={'where':_0x2e229d[_0x85d9('0x38')]};return db[_0x85d9('0x3d')]['count'](_0x38542a)['then'](function(_0x5610fb){_0x4b3df2[_0x85d9('0x1a')]=_0x5610fb;if(_0x497267['query'][_0x85d9('0x3e')]){_0x2e229d[_0x85d9('0x3f')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x85d9('0x40')](_0x2e229d);})[_0x85d9('0x20')](function(_0x57a0e7){_0x4b3df2[_0x85d9('0x41')]=_0x57a0e7;return _0x4b3df2;})[_0x85d9('0x20')](respondWithFilteredResult(_0x1ff655,_0x2e229d))['catch'](handleError(_0x1ff655,null));};exports[_0x85d9('0x42')]=function(_0x86fb2a,_0xe34e0e){var _0x1c0215={'raw':!![],'where':{'id':_0x86fb2a[_0x85d9('0x43')]['id']}},_0x3be705={};_0x3be705[_0x85d9('0x2b')]=_[_0x85d9('0x2c')](db['VoiceQueuesLog'][_0x85d9('0x27')]);_0x3be705[_0x85d9('0x2d')]=_[_0x85d9('0x2c')](_0x86fb2a[_0x85d9('0x2d')]);_0x3be705[_0x85d9('0x2e')]=_[_0x85d9('0x30')](_0x3be705[_0x85d9('0x2b')],_0x3be705[_0x85d9('0x2d')]);_0x1c0215[_0x85d9('0x2f')]=_[_0x85d9('0x30')](_0x3be705[_0x85d9('0x2b')],qs[_0x85d9('0x31')](_0x86fb2a['query']['fields']));_0x1c0215[_0x85d9('0x2f')]=_0x1c0215['attributes'][_0x85d9('0x32')]?_0x1c0215[_0x85d9('0x2f')]:_0x3be705['model'];if(_0x86fb2a['query'][_0x85d9('0x3e')]){_0x1c0215[_0x85d9('0x3f')]=[{'all':!![]}];}_0x1c0215=_[_0x85d9('0x3a')]({},_0x1c0215,_0x86fb2a[_0x85d9('0x3c')]);return db[_0x85d9('0x3d')][_0x85d9('0x44')](_0x1c0215)['then'](handleEntityNotFound(_0xe34e0e,null))['then'](respondWithResult(_0xe34e0e,null))['catch'](handleError(_0xe34e0e,null));};exports[_0x85d9('0x45')]=function(_0x465416,_0x2eacaf){return db['VoiceQueuesLog'][_0x85d9('0x45')](_0x465416[_0x85d9('0x46')],{})['then'](respondWithResult(_0x2eacaf,0xc9))[_0x85d9('0x47')](handleError(_0x2eacaf,null));};exports[_0x85d9('0x48')]=function(_0x23b93b,_0x25d271){if(_0x23b93b[_0x85d9('0x46')]['id']){delete _0x23b93b[_0x85d9('0x46')]['id'];}return db[_0x85d9('0x3d')][_0x85d9('0x44')]({'where':{'id':_0x23b93b[_0x85d9('0x43')]['id']}})[_0x85d9('0x20')](handleEntityNotFound(_0x25d271,null))['then'](saveUpdates(_0x23b93b['body'],null))[_0x85d9('0x20')](respondWithResult(_0x25d271,null))[_0x85d9('0x47')](handleError(_0x25d271,null));};exports[_0x85d9('0x21')]=function(_0x871316,_0x20de9f){return db['VoiceQueuesLog']['find']({'where':{'id':_0x871316[_0x85d9('0x43')]['id']}})['then'](handleEntityNotFound(_0x20de9f,null))[_0x85d9('0x20')](removeEntity(_0x20de9f,null))[_0x85d9('0x47')](handleError(_0x20de9f,null));}; \ No newline at end of file +var _0x0e6a=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VoiceQueuesLog','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','filters','filter','where','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x55d09d,_0x49994a){var _0x8f45c5=function(_0x4c5e6c){while(--_0x4c5e6c){_0x55d09d['push'](_0x55d09d['shift']());}};_0x8f45c5(++_0x49994a);}(_0x0e6a,0x1a7));var _0xa0e6=function(_0x5f1431,_0x49bea0){_0x5f1431=_0x5f1431-0x0;var _0x165500=_0x0e6a[_0x5f1431];return _0x165500;};'use strict';var pdf=require(_0xa0e6('0x0'));var emlformat=require(_0xa0e6('0x1'));var rimraf=require(_0xa0e6('0x2'));var zipdir=require(_0xa0e6('0x3'));var jsonpatch=require(_0xa0e6('0x4'));var rp=require(_0xa0e6('0x5'));var moment=require(_0xa0e6('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa0e6('0x7'));var util=require(_0xa0e6('0x8'));var path=require(_0xa0e6('0x9'));var sox=require(_0xa0e6('0xa'));var csv=require(_0xa0e6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa0e6('0xc'));var squel=require(_0xa0e6('0xd'));var crypto=require(_0xa0e6('0xe'));var jsforce=require(_0xa0e6('0xf'));var deskjs=require(_0xa0e6('0x10'));var toCsv=require(_0xa0e6('0xb'));var querystring=require(_0xa0e6('0x11'));var Papa=require(_0xa0e6('0x12'));var Redis=require('ioredis');var authService=require(_0xa0e6('0x13'));var qs=require(_0xa0e6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0e6('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa0e6('0x16'));var config=require(_0xa0e6('0x17'));var licenseUtil=require(_0xa0e6('0x18'));var db=require(_0xa0e6('0x19'))['db'];function respondWithStatusCode(_0x3f2e3b,_0x35194e){_0x35194e=_0x35194e||0xcc;return function(_0x513db8){if(_0x513db8){return _0x3f2e3b[_0xa0e6('0x1a')](_0x35194e);}return _0x3f2e3b[_0xa0e6('0x1b')](_0x35194e)[_0xa0e6('0x1c')]();};}function respondWithResult(_0x22be7b,_0x1b1f5a){_0x1b1f5a=_0x1b1f5a||0xc8;return function(_0x59615f){if(_0x59615f){return _0x22be7b[_0xa0e6('0x1b')](_0x1b1f5a)['json'](_0x59615f);}};}function respondWithFilteredResult(_0x22047c,_0xd7e58d){return function(_0xd38df5){if(_0xd38df5){var _0x4f05f9=_0xd38df5['count'],_0x4588c2=_0xd7e58d['offset'],_0xc4d22c=_0xd7e58d['offset']+_0xd7e58d[_0xa0e6('0x1d')],_0x22b924;if(_0xc4d22c>=_0x4f05f9){_0xc4d22c=_0x4f05f9;_0x22b924=0xc8;}else{_0x22b924=0xce;}_0x22047c['status'](_0x22b924);return _0x22047c[_0xa0e6('0x1e')](_0xa0e6('0x1f'),_0x4588c2+'-'+_0xc4d22c+'/'+_0x4f05f9)['json'](_0xd38df5);}return null;};}function patchUpdates(_0x1c91b8){return function(_0x476644){try{jsonpatch[_0xa0e6('0x20')](_0x476644,_0x1c91b8,!![]);}catch(_0x511f69){return BPromise[_0xa0e6('0x21')](_0x511f69);}return _0x476644[_0xa0e6('0x22')]();};}function saveUpdates(_0x2ed02c,_0x530772){return function(_0x5dedbc){if(_0x5dedbc){return _0x5dedbc[_0xa0e6('0x23')](_0x2ed02c)['then'](function(_0x1a6d11){return _0x1a6d11;});}return null;};}function removeEntity(_0x45e089,_0x189de9){return function(_0x990a0b){if(_0x990a0b){return _0x990a0b['destroy']()[_0xa0e6('0x24')](function(){_0x45e089[_0xa0e6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b01db,_0x1b780b){return function(_0x18639b){if(!_0x18639b){_0x3b01db['sendStatus'](0x194);}return _0x18639b;};}function handleError(_0x2feced,_0x4e3b84){_0x4e3b84=_0x4e3b84||0x1f4;return function(_0xfc7841){logger[_0xa0e6('0x25')](_0xfc7841[_0xa0e6('0x26')]);if(_0xfc7841[_0xa0e6('0x27')]){delete _0xfc7841[_0xa0e6('0x27')];}_0x2feced[_0xa0e6('0x1b')](_0x4e3b84)['send'](_0xfc7841);};}exports[_0xa0e6('0x28')]=function(_0x57c0e4,_0x4ecee1){var _0x2deb17={},_0x28056c={},_0x200f8e={'count':0x0,'rows':[]};var _0x2f8a71=_[_0xa0e6('0x29')](db[_0xa0e6('0x2a')]['rawAttributes'],function(_0x3ce43f){return{'name':_0x3ce43f[_0xa0e6('0x2b')],'type':_0x3ce43f['type'][_0xa0e6('0x2c')]};});_0x28056c[_0xa0e6('0x2d')]=_['map'](_0x2f8a71,_0xa0e6('0x27'));_0x28056c[_0xa0e6('0x2e')]=_[_0xa0e6('0x2f')](_0x57c0e4[_0xa0e6('0x2e')]);_0x28056c['filters']=_['intersection'](_0x28056c['model'],_0x28056c['query']);_0x2deb17['attributes']=_[_0xa0e6('0x30')](_0x28056c[_0xa0e6('0x2d')],qs[_0xa0e6('0x31')](_0x57c0e4['query']['fields']));_0x2deb17[_0xa0e6('0x32')]=_0x2deb17[_0xa0e6('0x32')]['length']?_0x2deb17[_0xa0e6('0x32')]:_0x28056c[_0xa0e6('0x2d')];if(!_0x57c0e4[_0xa0e6('0x2e')][_0xa0e6('0x33')](_0xa0e6('0x34'))){_0x2deb17[_0xa0e6('0x1d')]=qs['limit'](_0x57c0e4[_0xa0e6('0x2e')]['limit']);_0x2deb17[_0xa0e6('0x35')]=qs['offset'](_0x57c0e4[_0xa0e6('0x2e')][_0xa0e6('0x35')]);}_0x2deb17['order']=qs[_0xa0e6('0x36')](_0x57c0e4[_0xa0e6('0x2e')][_0xa0e6('0x36')]);_0x2deb17['where']=qs[_0xa0e6('0x37')](_['pick'](_0x57c0e4[_0xa0e6('0x2e')],_0x28056c['filters']),_0x2f8a71);if(_0x57c0e4['query'][_0xa0e6('0x38')]){_0x2deb17[_0xa0e6('0x39')]=_['merge'](_0x2deb17[_0xa0e6('0x39')],{'$or':_[_0xa0e6('0x29')](_0x2f8a71,function(_0x443911){if(_0x443911['type']!==_0xa0e6('0x3a')){var _0x34f390={};_0x34f390[_0x443911['name']]={'$like':'%'+_0x57c0e4['query'][_0xa0e6('0x38')]+'%'};return _0x34f390;}})});}_0x2deb17=_[_0xa0e6('0x3b')]({},_0x2deb17,_0x57c0e4[_0xa0e6('0x3c')]);var _0x4849ed={'where':_0x2deb17[_0xa0e6('0x39')]};return db[_0xa0e6('0x2a')][_0xa0e6('0x3d')](_0x4849ed)[_0xa0e6('0x24')](function(_0x17fd9b){_0x200f8e['count']=_0x17fd9b;if(_0x57c0e4[_0xa0e6('0x2e')][_0xa0e6('0x3e')]){_0x2deb17['include']=[{'all':!![]}];}return db[_0xa0e6('0x2a')][_0xa0e6('0x3f')](_0x2deb17);})[_0xa0e6('0x24')](function(_0x14e730){_0x200f8e[_0xa0e6('0x40')]=_0x14e730;return _0x200f8e;})['then'](respondWithFilteredResult(_0x4ecee1,_0x2deb17))[_0xa0e6('0x41')](handleError(_0x4ecee1,null));};exports[_0xa0e6('0x42')]=function(_0x1d69d7,_0x259ffc){var _0x128ccf={'raw':!![],'where':{'id':_0x1d69d7[_0xa0e6('0x43')]['id']}},_0x151014={};_0x151014['model']=_['keys'](db[_0xa0e6('0x2a')]['rawAttributes']);_0x151014[_0xa0e6('0x2e')]=_[_0xa0e6('0x2f')](_0x1d69d7['query']);_0x151014[_0xa0e6('0x37')]=_['intersection'](_0x151014[_0xa0e6('0x2d')],_0x151014[_0xa0e6('0x2e')]);_0x128ccf[_0xa0e6('0x32')]=_[_0xa0e6('0x30')](_0x151014[_0xa0e6('0x2d')],qs[_0xa0e6('0x31')](_0x1d69d7['query'][_0xa0e6('0x31')]));_0x128ccf[_0xa0e6('0x32')]=_0x128ccf['attributes']['length']?_0x128ccf[_0xa0e6('0x32')]:_0x151014[_0xa0e6('0x2d')];if(_0x1d69d7[_0xa0e6('0x2e')][_0xa0e6('0x3e')]){_0x128ccf[_0xa0e6('0x44')]=[{'all':!![]}];}_0x128ccf=_[_0xa0e6('0x3b')]({},_0x128ccf,_0x1d69d7[_0xa0e6('0x3c')]);return db[_0xa0e6('0x2a')][_0xa0e6('0x45')](_0x128ccf)[_0xa0e6('0x24')](handleEntityNotFound(_0x259ffc,null))[_0xa0e6('0x24')](respondWithResult(_0x259ffc,null))[_0xa0e6('0x41')](handleError(_0x259ffc,null));};exports[_0xa0e6('0x46')]=function(_0x31d186,_0x3a9436){return db[_0xa0e6('0x2a')][_0xa0e6('0x46')](_0x31d186[_0xa0e6('0x47')],{})[_0xa0e6('0x24')](respondWithResult(_0x3a9436,0xc9))[_0xa0e6('0x41')](handleError(_0x3a9436,null));};exports[_0xa0e6('0x23')]=function(_0x22bfac,_0x54c437){if(_0x22bfac['body']['id']){delete _0x22bfac[_0xa0e6('0x47')]['id'];}return db['VoiceQueuesLog'][_0xa0e6('0x45')]({'where':{'id':_0x22bfac[_0xa0e6('0x43')]['id']}})[_0xa0e6('0x24')](handleEntityNotFound(_0x54c437,null))[_0xa0e6('0x24')](saveUpdates(_0x22bfac[_0xa0e6('0x47')],null))[_0xa0e6('0x24')](respondWithResult(_0x54c437,null))[_0xa0e6('0x41')](handleError(_0x54c437,null));};exports[_0xa0e6('0x48')]=function(_0x23294d,_0x4522b4){return db[_0xa0e6('0x2a')]['find']({'where':{'id':_0x23294d[_0xa0e6('0x43')]['id']}})[_0xa0e6('0x24')](handleEntityNotFound(_0x4522b4,null))[_0xa0e6('0x24')](removeEntity(_0x4522b4,null))[_0xa0e6('0x41')](handleError(_0x4522b4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index f51e0a6..f4d87d7 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.model.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ee4=['define','VoiceQueuesLog','event_dtm','dtm','util','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x53cc0a,_0x30848e){var _0x58044c=function(_0x5ac32a){while(--_0x5ac32a){_0x53cc0a['push'](_0x53cc0a['shift']());}};_0x58044c(++_0x30848e);}(_0x5ee4,0xea));var _0x45ee=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5ee4[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x45ee('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x45ee('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x45ee('0x2'));var rimraf=require(_0x45ee('0x3'));var config=require(_0x45ee('0x4'));var attributes=require(_0x45ee('0x5'));module['exports']=function(_0x5bcf73,_0x490468){return _0x5bcf73[_0x45ee('0x6')](_0x45ee('0x7'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x45ee('0x8'),'fields':['event',_0x45ee('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0xbf04=['define','voice_queues_log','event_dtm','event','lodash','util','api','moment','bluebird','path','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x4c7080,_0x30ec5d){var _0x33ceb7=function(_0x4ce10d){while(--_0x4ce10d){_0x4c7080['push'](_0x4c7080['shift']());}};_0x33ceb7(++_0x30ec5d);}(_0xbf04,0x108));var _0x4bf0=function(_0x4d73d8,_0x3ee19d){_0x4d73d8=_0x4d73d8-0x0;var _0x9f83bd=_0xbf04[_0x4d73d8];return _0x9f83bd;};'use strict';var _=require(_0x4bf0('0x0'));var util=require(_0x4bf0('0x1'));var logger=require('../../config/logger')(_0x4bf0('0x2'));var moment=require(_0x4bf0('0x3'));var BPromise=require(_0x4bf0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bf0('0x5'));var rimraf=require('rimraf');var config=require(_0x4bf0('0x6'));var attributes=require(_0x4bf0('0x7'));module[_0x4bf0('0x8')]=function(_0x38ca87,_0x384f5c){return _0x38ca87[_0x4bf0('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x4bf0('0xa'),'paranoid':![],'indexes':[{'name':_0x4bf0('0xb'),'fields':[_0x4bf0('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3f2f564..b213f2b 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ae2=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x2a5fdc,_0x1119cf){_0x2a5fdc=_0x2a5fdc-0x0;var _0x83d8de=_0x6ae2[_0x2a5fdc];return _0x83d8de;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var moment=require(_0x26ae('0x2'));var BPromise=require(_0x26ae('0x3'));var rs=require(_0x26ae('0x4'));var fs=require('fs');var Redis=require(_0x26ae('0x5'));var db=require(_0x26ae('0x6'))['db'];var utils=require(_0x26ae('0x7'));var logger=require(_0x26ae('0x8'))('rpc');var config=require(_0x26ae('0x9'));var jayson=require(_0x26ae('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13cb27,_0xde4226,_0x473907){return new BPromise(function(_0x151de3,_0x3bc9de){return client[_0x26ae('0xb')](_0x13cb27,_0x473907)[_0x26ae('0xc')](function(_0x4b3eca){logger[_0x26ae('0xd')](_0x26ae('0xe'),_0xde4226,_0x26ae('0xf'));logger[_0x26ae('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0xde4226,_0x26ae('0xf'),JSON['stringify'](_0x4b3eca));if(_0x4b3eca[_0x26ae('0x11')]){if(_0x4b3eca['error']['code']===0x1f4){logger[_0x26ae('0x11')](_0x26ae('0xe'),_0xde4226,_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);return _0x3bc9de(_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);}logger[_0x26ae('0x11')](_0x26ae('0xe'),_0xde4226,_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);return _0x151de3(_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);}else{logger['info'](_0x26ae('0xe'),_0xde4226,_0x26ae('0xf'));_0x151de3(_0x4b3eca['result'][_0x26ae('0x12')]);}})[_0x26ae('0x13')](function(_0x4f71d8){logger[_0x26ae('0x11')](_0x26ae('0xe'),_0xde4226,_0x4f71d8);_0x3bc9de(_0x4f71d8);});});} \ No newline at end of file +var _0xe493=['../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x667c6a,_0x2155cd){var _0x36396a=function(_0x29d602){while(--_0x29d602){_0x667c6a['push'](_0x667c6a['shift']());}};_0x36396a(++_0x2155cd);}(_0xe493,0x7e));var _0x3e49=function(_0x146e85,_0x4309a3){_0x146e85=_0x146e85-0x0;var _0x2de913=_0xe493[_0x146e85];return _0x2de913;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7821,_0x12dd84,_0x3626b6){return new BPromise(function(_0x4e96ac,_0x56b767){return client['request'](_0x3f7821,_0x3626b6)[_0x3e49('0xb')](function(_0x8b8c0e){logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));logger[_0x3e49('0xf')](_0x3e49('0x10'),_0x12dd84,_0x3e49('0xe'),JSON[_0x3e49('0x11')](_0x8b8c0e));if(_0x8b8c0e[_0x3e49('0x12')]){if(_0x8b8c0e[_0x3e49('0x12')]['code']===0x1f4){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x56b767(_0x8b8c0e[_0x3e49('0x12')]['message']);}logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x4e96ac(_0x8b8c0e[_0x3e49('0x12')][_0x3e49('0x13')]);}else{logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));_0x4e96ac(_0x8b8c0e[_0x3e49('0x14')][_0x3e49('0x13')]);}})[_0x3e49('0x15')](function(_0x1d9cce){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x1d9cce);_0x56b767(_0x1d9cce);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 01c5d95..14aead8 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ef8=['delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','/:id/downloads','downloads','post','create','/:id/transcribe','runTranscribe','update'];(function(_0x59d544,_0x3f84c8){var _0x5dd3ca=function(_0x279971){while(--_0x279971){_0x59d544['push'](_0x59d544['shift']());}};_0x5dd3ca(++_0x3f84c8);}(_0x0ef8,0x1de));var _0x80ef=function(_0x102158,_0x4ed0ae){_0x102158=_0x102158-0x0;var _0x220000=_0x0ef8[_0x102158];return _0x220000;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x80ef('0x0'));var express=require(_0x80ef('0x1'));var router=express[_0x80ef('0x2')]();var auth=require(_0x80ef('0x3'));var interaction=require(_0x80ef('0x4'));var config=require(_0x80ef('0x5'));var controller=require('./voiceRecording.controller');router[_0x80ef('0x6')]('/',auth['isAuthenticated'](),controller[_0x80ef('0x7')]);router[_0x80ef('0x6')](_0x80ef('0x8'),auth['isAuthenticated'](),controller[_0x80ef('0x9')]);router['get'](_0x80ef('0xa'),auth[_0x80ef('0xb')](),controller[_0x80ef('0xc')]);router[_0x80ef('0x6')](_0x80ef('0xd'),auth[_0x80ef('0xb')](),controller[_0x80ef('0xe')]);router[_0x80ef('0x6')](_0x80ef('0xf'),controller[_0x80ef('0x10')]);router[_0x80ef('0x6')]('/:id/transcribe',auth[_0x80ef('0xb')](),controller['downloadTranscribe']);router[_0x80ef('0x11')]('/',auth[_0x80ef('0xb')](),controller[_0x80ef('0x12')]);router[_0x80ef('0x11')](_0x80ef('0x13'),auth['isAuthenticated'](),controller[_0x80ef('0x14')]);router['put'](_0x80ef('0xa'),auth['isAuthenticated'](),controller[_0x80ef('0x15')]);router[_0x80ef('0x16')]('/:id',auth[_0x80ef('0xb')](),controller[_0x80ef('0x17')]);module[_0x80ef('0x18')]=router; \ No newline at end of file +var _0xcfac=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','download'];(function(_0x1c1da2,_0x536524){var _0x23d8fd=function(_0x53ff29){while(--_0x53ff29){_0x1c1da2['push'](_0x1c1da2['shift']());}};_0x23d8fd(++_0x536524);}(_0xcfac,0x177));var _0xccfa=function(_0xa1e21d,_0xf93601){_0xa1e21d=_0xa1e21d-0x0;var _0x5455ea=_0xcfac[_0xa1e21d];return _0x5455ea;};'use strict';var multer=require(_0xccfa('0x0'));var util=require(_0xccfa('0x1'));var path=require(_0xccfa('0x2'));var timeout=require(_0xccfa('0x3'));var express=require(_0xccfa('0x4'));var router=express[_0xccfa('0x5')]();var auth=require(_0xccfa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xccfa('0x7'));var controller=require(_0xccfa('0x8'));router[_0xccfa('0x9')]('/',auth['isAuthenticated'](),controller[_0xccfa('0xa')]);router[_0xccfa('0x9')](_0xccfa('0xb'),auth[_0xccfa('0xc')](),controller[_0xccfa('0xd')]);router[_0xccfa('0x9')](_0xccfa('0xe'),auth[_0xccfa('0xc')](),controller['show']);router['get'](_0xccfa('0xf'),auth[_0xccfa('0xc')](),controller[_0xccfa('0x10')]);router['get'](_0xccfa('0x11'),controller[_0xccfa('0x12')]);router[_0xccfa('0x9')](_0xccfa('0x13'),auth[_0xccfa('0xc')](),controller[_0xccfa('0x14')]);router['post']('/',auth[_0xccfa('0xc')](),controller['create']);router[_0xccfa('0x15')]('/:id/transcribe',auth[_0xccfa('0xc')](),controller[_0xccfa('0x16')]);router[_0xccfa('0x17')](_0xccfa('0xe'),auth[_0xccfa('0xc')](),controller[_0xccfa('0x18')]);router[_0xccfa('0x19')](_0xccfa('0xe'),auth[_0xccfa('0xc')](),controller[_0xccfa('0x1a')]);module[_0xccfa('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index cdb5090..d85288e 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2287=['setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','createdAt','format','toString','DATE','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','exports','VIRTUAL','value','extname','getDataValue','STRING'];(function(_0x1e5050,_0x22fa1c){var _0x27acfb=function(_0x90fd93){while(--_0x90fd93){_0x1e5050['push'](_0x1e5050['shift']());}};_0x27acfb(++_0x22fa1c);}(_0x2287,0x17e));var _0x7228=function(_0x30b20b,_0x5add70){_0x30b20b=_0x30b20b-0x0;var _0x576f84=_0x2287[_0x30b20b];return _0x576f84;};'use strict';var Sequelize=require(_0x7228('0x0'));var moment=require(_0x7228('0x1'));var path=require(_0x7228('0x2'));module[_0x7228('0x3')]={'format':{'type':Sequelize[_0x7228('0x4')],'get':function(){return this['getDataValue'](_0x7228('0x5'))?path[_0x7228('0x6')](this[_0x7228('0x7')](_0x7228('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7228('0x8')],'set':function(_0x3a0e94){if(_0x3a0e94){this[_0x7228('0x9')](_0x7228('0xa'),_0x3a0e94);this[_0x7228('0x9')](_0x7228('0xb'),_0x3a0e94[_0x7228('0xc')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x7228('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7228('0x8')]},'connectedlinenum':{'type':Sequelize[_0x7228('0x8')]},'connectedlinename':{'type':Sequelize[_0x7228('0x8')]},'accountcode':{'type':Sequelize[_0x7228('0x8')]},'context':{'type':Sequelize[_0x7228('0x8')]},'exten':{'type':Sequelize[_0x7228('0x8')]},'value':{'type':Sequelize[_0x7228('0x8')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x7228('0xd')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x7228('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x7228('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x7228('0x8')]},'location':{'type':Sequelize[_0x7228('0xe')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x7228('0x8')],'defaultValue':_0x7228('0xf')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x7228('0xe')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x7228('0x8')]},'sPositive':{'type':Sequelize[_0x7228('0x10')]},'sNegative':{'type':Sequelize[_0x7228('0x10')]},'sNeutral':{'type':Sequelize[_0x7228('0x10')]},'sMixed':{'type':Sequelize[_0x7228('0x10')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7228('0x7')](_0x7228('0x11')))[_0x7228('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x7228('0x13')]();}},'updatedAt':{'type':Sequelize[_0x7228('0x14')],'get':function(){return moment(this[_0x7228('0x7')](_0x7228('0x15')))[_0x7228('0x12')](_0x7228('0x16'))[_0x7228('0x13')]();}}}; \ No newline at end of file +var _0xe518=['toString','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','value','STRING','setDataValue','channel','membername','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','getDataValue','createdAt','format'];(function(_0x4ff72c,_0x2de6af){var _0x266738=function(_0x2e4157){while(--_0x2e4157){_0x4ff72c['push'](_0x4ff72c['shift']());}};_0x266738(++_0x2de6af);}(_0xe518,0xe7));var _0x8e51=function(_0x92bc78,_0x1cb7bd){_0x92bc78=_0x92bc78-0x0;var _0x11cca1=_0xe518[_0x92bc78];return _0x11cca1;};'use strict';var Sequelize=require(_0x8e51('0x0'));var moment=require(_0x8e51('0x1'));var path=require('path');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x8e51('0x2'))?path['extname'](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x8e51('0x3')]},'channel':{'type':Sequelize[_0x8e51('0x3')],'set':function(_0x3f94bc){if(_0x3f94bc){this[_0x8e51('0x4')](_0x8e51('0x5'),_0x3f94bc);this[_0x8e51('0x4')](_0x8e51('0x6'),_0x3f94bc['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x8e51('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8e51('0x3')]},'connectedlinenum':{'type':Sequelize[_0x8e51('0x3')]},'connectedlinename':{'type':Sequelize[_0x8e51('0x3')]},'accountcode':{'type':Sequelize[_0x8e51('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x8e51('0x3')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x8e51('0x7')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x8e51('0x3')]},'location':{'type':Sequelize[_0x8e51('0x8')]},'transcribeName':{'type':Sequelize[_0x8e51('0x3')]},'transcribeStatus':{'type':Sequelize[_0x8e51('0x3')],'defaultValue':_0x8e51('0x9')},'fileUri':{'type':Sequelize[_0x8e51('0x8')]},'fileText':{'type':Sequelize[_0x8e51('0x8')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0x8e51('0xa')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x8e51('0xa')]},'sMixed':{'type':Sequelize[_0x8e51('0xa')]},'tempSentiment':{'type':Sequelize[_0x8e51('0xb')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x8e51('0xc')],'get':function(){return moment(this[_0x8e51('0xd')](_0x8e51('0xe')))[_0x8e51('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x8e51('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8e51('0xd')](_0x8e51('0x11')))[_0x8e51('0xf')](_0x8e51('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index bdb125c..189ae37 100644 --- a/server/api/voiceRecording/voiceRecording.controller.js +++ b/server/api/voiceRecording/voiceRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbb6=['transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentRegion','CloudProvider','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','fieldName','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','catch','params','rawAttributes','length','merge','find','create','body','update','../../components/encryptor','value','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','uniqueid','$and','push','recording','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting'];(function(_0x400031,_0x1bb1cb){var _0x1e5bfc=function(_0x1f6653){while(--_0x1f6653){_0x400031['push'](_0x400031['shift']());}};_0x1e5bfc(++_0x1bb1cb);}(_0xbbb6,0x13d));var _0x6bbb=function(_0xfd9097,_0x18fe4c){_0xfd9097=_0xfd9097-0x0;var _0x646a2b=_0xbbb6[_0xfd9097];return _0x646a2b;};'use strict';var pdf=require(_0x6bbb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6bbb('0x1'));var zipdir=require(_0x6bbb('0x2'));var jsonpatch=require(_0x6bbb('0x3'));var rp=require('request-promise');var moment=require(_0x6bbb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6bbb('0x5'));var util=require(_0x6bbb('0x6'));var path=require('path');var sox=require(_0x6bbb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6bbb('0x8'));var squel=require(_0x6bbb('0x9'));var crypto=require(_0x6bbb('0xa'));var jsforce=require(_0x6bbb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6bbb('0xc'));var querystring=require('querystring');var Papa=require(_0x6bbb('0xd'));var AWS=require(_0x6bbb('0xe'));var uuidv4=require(_0x6bbb('0xf'));var Redis=require('ioredis');var authService=require(_0x6bbb('0x10'));var qs=require(_0x6bbb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6bbb('0x12'));var logger=require(_0x6bbb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6bbb('0x14'));var licenseUtil=require(_0x6bbb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x661c5c,_0x36003d){_0x36003d=_0x36003d||0xcc;return function(_0x375264){if(_0x375264){return _0x661c5c[_0x6bbb('0x16')](_0x36003d);}return _0x661c5c['status'](_0x36003d)[_0x6bbb('0x17')]();};}function respondWithResult(_0x281ea0,_0x3136c5){_0x3136c5=_0x3136c5||0xc8;return function(_0x117db8){if(_0x117db8){return _0x281ea0[_0x6bbb('0x18')](_0x3136c5)[_0x6bbb('0x19')](_0x117db8);}};}function respondWithFilteredResult(_0x2efc72,_0x473e55){return function(_0x346bb9){if(_0x346bb9){var _0x4ed42e=_0x346bb9[_0x6bbb('0x1a')],_0x242b8f=_0x473e55[_0x6bbb('0x1b')],_0x3521fb=_0x473e55[_0x6bbb('0x1b')]+_0x473e55[_0x6bbb('0x1c')],_0x485319;if(_0x3521fb>=_0x4ed42e){_0x3521fb=_0x4ed42e;_0x485319=0xc8;}else{_0x485319=0xce;}_0x2efc72[_0x6bbb('0x18')](_0x485319);return _0x2efc72[_0x6bbb('0x1d')](_0x6bbb('0x1e'),_0x242b8f+'-'+_0x3521fb+'/'+_0x4ed42e)[_0x6bbb('0x19')](_0x346bb9);}return null;};}function patchUpdates(_0x25327a){return function(_0x57e6fb){try{jsonpatch['apply'](_0x57e6fb,_0x25327a,!![]);}catch(_0x4c49ba){return BPromise[_0x6bbb('0x1f')](_0x4c49ba);}return _0x57e6fb[_0x6bbb('0x20')]();};}function saveUpdates(_0x5e7e85,_0x4adb56){return function(_0x48c658){if(_0x48c658){return _0x48c658['update'](_0x5e7e85)[_0x6bbb('0x21')](function(_0x5f0851){return _0x5f0851;});}return null;};}function removeEntity(_0x1217de,_0x3c47d6){return function(_0x4bc1de){if(_0x4bc1de){return _0x4bc1de[_0x6bbb('0x22')]()[_0x6bbb('0x21')](function(){_0x1217de[_0x6bbb('0x18')](0xcc)[_0x6bbb('0x17')]();});}};}function handleEntityNotFound(_0x33244d,_0xc25cfc){return function(_0x331949){if(!_0x331949){_0x33244d[_0x6bbb('0x16')](0x194);}return _0x331949;};}function handleError(_0x330f53,_0xc8b608){_0xc8b608=_0xc8b608||0x1f4;return function(_0x5263f9){logger[_0x6bbb('0x23')](_0x5263f9[_0x6bbb('0x24')]);if(_0x5263f9['name']){delete _0x5263f9[_0x6bbb('0x25')];}_0x330f53[_0x6bbb('0x18')](_0xc8b608)[_0x6bbb('0x26')](_0x5263f9);};}exports['index']=function(_0x25982e,_0x3f3042){var _0xe02798={},_0x573575={},_0x3ae35d={'count':0x0,'rows':[]};var _0x336291=_[_0x6bbb('0x27')](db['VoiceRecording']['rawAttributes'],function(_0x451178){return{'name':_0x451178[_0x6bbb('0x28')],'type':_0x451178['type']['key']};});_0x573575['model']=_['differenceBy'](_['map'](_0x336291,'name'),['format']);_0x573575[_0x6bbb('0x29')]=_[_0x6bbb('0x2a')](_0x25982e[_0x6bbb('0x29')]);_0x573575['filters']=_[_0x6bbb('0x2b')](_0x573575[_0x6bbb('0x2c')],_0x573575[_0x6bbb('0x29')]);_0xe02798['attributes']=_['intersection'](_0x573575['model'],qs[_0x6bbb('0x2d')](_0x25982e[_0x6bbb('0x29')][_0x6bbb('0x2d')]));_0xe02798[_0x6bbb('0x2e')]=_0xe02798[_0x6bbb('0x2e')]['length']?_0xe02798['attributes']:_0x573575['model'];if(!_0x25982e[_0x6bbb('0x29')][_0x6bbb('0x2f')](_0x6bbb('0x30'))){_0xe02798[_0x6bbb('0x1c')]=qs[_0x6bbb('0x1c')](_0x25982e[_0x6bbb('0x29')]['limit']);_0xe02798['offset']=qs[_0x6bbb('0x1b')](_0x25982e['query'][_0x6bbb('0x1b')]);}_0xe02798[_0x6bbb('0x31')]=qs[_0x6bbb('0x32')](_0x25982e['query']['sort']);_0xe02798[_0x6bbb('0x33')]=qs[_0x6bbb('0x34')](_[_0x6bbb('0x35')](_0x25982e['query'],_0x573575[_0x6bbb('0x34')]),_0x336291);if(_0x25982e['query'][_0x6bbb('0x36')]){_0xe02798[_0x6bbb('0x33')]=_['merge'](_0xe02798[_0x6bbb('0x33')],{'$or':_['map'](_0x336291,function(_0x42456b){if(_0x42456b[_0x6bbb('0x37')]!==_0x6bbb('0x38')){var _0xb8e994={};_0xb8e994[_0x42456b['name']]={'$like':'%'+_0x25982e[_0x6bbb('0x29')][_0x6bbb('0x36')]+'%'};return _0xb8e994;}})});}_0xe02798=_['merge']({},_0xe02798,_0x25982e[_0x6bbb('0x39')]);var _0x2a9152={'where':_0xe02798['where']};return db[_0x6bbb('0x3a')]['count'](_0x2a9152)[_0x6bbb('0x21')](function(_0x436cc4){_0x3ae35d[_0x6bbb('0x1a')]=_0x436cc4;if(_0x25982e[_0x6bbb('0x29')][_0x6bbb('0x3b')]){_0xe02798[_0x6bbb('0x3c')]=[{'all':!![]}];}return db[_0x6bbb('0x3a')][_0x6bbb('0x3d')](_0xe02798);})[_0x6bbb('0x21')](function(_0x431be7){_0x3ae35d['rows']=_0x431be7;return _0x3ae35d;})[_0x6bbb('0x21')](respondWithFilteredResult(_0x3f3042,_0xe02798))[_0x6bbb('0x3e')](handleError(_0x3f3042,null));};exports['show']=function(_0x25b7b3,_0x6e06c1){var _0x3d8cfd={'raw':![],'where':{'id':_0x25b7b3[_0x6bbb('0x3f')]['id']}},_0x5bcaf0={};_0x5bcaf0[_0x6bbb('0x2c')]=_[_0x6bbb('0x2a')](db[_0x6bbb('0x3a')][_0x6bbb('0x40')]);_0x5bcaf0[_0x6bbb('0x29')]=_[_0x6bbb('0x2a')](_0x25b7b3[_0x6bbb('0x29')]);_0x5bcaf0[_0x6bbb('0x34')]=_[_0x6bbb('0x2b')](_0x5bcaf0['model'],_0x5bcaf0['query']);_0x3d8cfd[_0x6bbb('0x2e')]=_['intersection'](_0x5bcaf0['model'],qs['fields'](_0x25b7b3[_0x6bbb('0x29')][_0x6bbb('0x2d')]));_0x3d8cfd['attributes']=_0x3d8cfd[_0x6bbb('0x2e')][_0x6bbb('0x41')]?_0x3d8cfd[_0x6bbb('0x2e')]:_0x5bcaf0[_0x6bbb('0x2c')];if(_0x25b7b3[_0x6bbb('0x29')]['includeAll']){_0x3d8cfd[_0x6bbb('0x3c')]=[{'all':!![]}];}_0x3d8cfd=_[_0x6bbb('0x42')]({},_0x3d8cfd,_0x25b7b3[_0x6bbb('0x39')]);return db[_0x6bbb('0x3a')][_0x6bbb('0x43')](_0x3d8cfd)[_0x6bbb('0x21')](handleEntityNotFound(_0x6e06c1,null))['then'](respondWithResult(_0x6e06c1,null))[_0x6bbb('0x3e')](handleError(_0x6e06c1,null));};exports['create']=function(_0x5a30cd,_0x38637d){return db[_0x6bbb('0x3a')][_0x6bbb('0x44')](_0x5a30cd[_0x6bbb('0x45')],{})[_0x6bbb('0x21')](respondWithResult(_0x38637d,0xc9))['catch'](handleError(_0x38637d,null));};exports[_0x6bbb('0x46')]=function(_0x3c5c6e,_0x529601){if(_0x3c5c6e['body']['id']){delete _0x3c5c6e[_0x6bbb('0x45')]['id'];}return db['VoiceRecording'][_0x6bbb('0x43')]({'where':{'id':_0x3c5c6e[_0x6bbb('0x3f')]['id']}})[_0x6bbb('0x21')](handleEntityNotFound(_0x529601,null))[_0x6bbb('0x21')](saveUpdates(_0x3c5c6e[_0x6bbb('0x45')],null))[_0x6bbb('0x21')](respondWithResult(_0x529601,null))[_0x6bbb('0x3e')](handleError(_0x529601,null));};exports['describe']=function(_0x37a454,_0xbf2a33){return db['VoiceRecording']['describe']()[_0x6bbb('0x21')](respondWithResult(_0xbf2a33,null))[_0x6bbb('0x3e')](handleError(_0xbf2a33,null));};exports['download']=function(_0x3e8cda,_0x326f76,_0x4a2d08){var _0x5180c6=require(_0x6bbb('0x47'));var _0x43da76=![];var _0x30cadd={};if(_0x3e8cda[_0x6bbb('0x29')][_0x6bbb('0x37')]&&_0x3e8cda['query'][_0x6bbb('0x37')]==='uniqueid'){_0x30cadd['uniqueid']=_0x3e8cda['params']['id'];}else{_0x30cadd['id']=_0x3e8cda[_0x6bbb('0x3f')]['id'];}return db[_0x6bbb('0x3a')]['find']({'where':_0x30cadd,'attributes':['id',_0x6bbb('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x326f76,null))['then'](function(_0x3d542a){if(_0x3d542a){var _0x38fdc2=_0x3d542a[_0x6bbb('0x48')];var _0x162ea2=util[_0x6bbb('0x49')](_0x6bbb('0x4a'),_0x38fdc2);if(fs[_0x6bbb('0x4b')](_0x162ea2)){_0x43da76=!![];return _0x5180c6[_0x6bbb('0x4c')](_0x162ea2,_0x38fdc2,config[_0x6bbb('0x4d')]['recording'])[_0x6bbb('0x21')](function(){return _0x3d542a;});}return _0x3d542a;}})[_0x6bbb('0x21')](function(_0x34bf67){if(_0x34bf67){var _0x2130d4=_0x34bf67[_0x6bbb('0x48')];if(!fs['existsSync'](_0x2130d4)){throw new db[(_0x6bbb('0x4e'))][(_0x6bbb('0x4f'))](_0x6bbb('0x50'));}if(_0x34bf67[_0x6bbb('0x51')]){return _0x326f76[_0x6bbb('0x52')](_0x2130d4,_0x34bf67[_0x6bbb('0x51')]+path[_0x6bbb('0x53')](_0x2130d4),function(){if(_0x43da76){fs['unlink'](_0x2130d4);}});}else{return _0x326f76[_0x6bbb('0x52')](_0x2130d4,function(_0x799a58){if(_0x43da76){fs[_0x6bbb('0x54')](_0x2130d4);}});}}})[_0x6bbb('0x3e')](function(_0x6c9d6c){if(_0x6c9d6c[_0x6bbb('0x55')]===_0x6bbb('0x50')){_0x326f76[_0x6bbb('0x18')](0x194)[_0x6bbb('0x26')](_0x6bbb('0x56'));}else{return handleError(_0x326f76,null);}});};exports[_0x6bbb('0x57')]=function(_0x669d3d,_0x43f574,_0xe04959){var _0xa83d54=require(_0x6bbb('0x47'));var _0x1861b8=![];var _0x5dcced={'$and':[db['sequelize'][_0x6bbb('0x33')](db[_0x6bbb('0x58')]['fn'](_0x6bbb('0x59'),db[_0x6bbb('0x58')][_0x6bbb('0x5a')](_0x6bbb('0x5b'))),_0x669d3d[_0x6bbb('0x29')]['token'])]};if(_0x669d3d[_0x6bbb('0x29')][_0x6bbb('0x37')]&&_0x669d3d[_0x6bbb('0x29')][_0x6bbb('0x37')]===_0x6bbb('0x5b')){_0x5dcced[_0x6bbb('0x5c')][_0x6bbb('0x5d')]({'uniqueid':_0x669d3d['params']['id']});}else{_0x5dcced['$and']['push']({'id':_0x669d3d[_0x6bbb('0x3f')]['id']});}return db['VoiceRecording'][_0x6bbb('0x43')]({'where':_0x5dcced,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x43f574,null))[_0x6bbb('0x21')](function(_0xdc4902){if(_0xdc4902){var _0x356b0f=util[_0x6bbb('0x49')](_0x6bbb('0x4a'),_0xdc4902[_0x6bbb('0x48')]);if(fs['existsSync'](_0x356b0f)){_0x1861b8=!![];return _0xa83d54[_0x6bbb('0x4c')](_0x356b0f,_0xdc4902[_0x6bbb('0x48')],config[_0x6bbb('0x4d')][_0x6bbb('0x5e')])[_0x6bbb('0x21')](function(){return _0xdc4902;});}return _0xdc4902;}})[_0x6bbb('0x21')](function(_0x21d3a4){if(_0x21d3a4){if(!fs[_0x6bbb('0x4b')](_0x21d3a4['value'])){throw new db[(_0x6bbb('0x4e'))][(_0x6bbb('0x4f'))](_0x6bbb('0x50'));}if(_0x21d3a4['filename']){return _0x43f574[_0x6bbb('0x52')](_0x21d3a4[_0x6bbb('0x48')],_0x21d3a4[_0x6bbb('0x51')]+path[_0x6bbb('0x53')](_0x21d3a4['value']),function(){if(_0x1861b8){fs[_0x6bbb('0x54')](_0x21d3a4[_0x6bbb('0x48')]);}});}else{return _0x43f574[_0x6bbb('0x52')](_0x21d3a4['value'],function(_0x186d82){if(_0x1861b8){fs[_0x6bbb('0x54')](_0x21d3a4['value']);}});}}})['catch'](handleError(_0x43f574,null));};exports[_0x6bbb('0x22')]=function(_0x3cca6d,_0x405a7c){return db['VoiceRecording'][_0x6bbb('0x43')]({'where':{'id':_0x3cca6d[_0x6bbb('0x3f')]['id']}})[_0x6bbb('0x21')](function(_0x1d896e){if(!_0x1d896e)throw new ReferenceError(_0x6bbb('0x5f'));return _0x1d896e;})[_0x6bbb('0x21')](function(_0x5f016c){var _0xadc65d=_0x5f016c[_0x6bbb('0x48')];logger[_0x6bbb('0x60')](_0x6bbb('0x61'),_0xadc65d);if(!_['isNil'](_0x5f016c[_0x6bbb('0x48')])&&fs[_0x6bbb('0x4b')](_0xadc65d)){logger[_0x6bbb('0x60')](_0x6bbb('0x62')+_0xadc65d+_0x6bbb('0x63'));fs[_0x6bbb('0x64')](_0xadc65d);}_0xadc65d=_0xadc65d+_0x6bbb('0x65');if(!_[_0x6bbb('0x66')](_0x5f016c['value'])&&fs[_0x6bbb('0x4b')](_0xadc65d)){logger[_0x6bbb('0x60')]('File:\x20\x22'+_0xadc65d+_0x6bbb('0x63'));fs[_0x6bbb('0x64')](_0xadc65d);}return _0x5f016c;})[_0x6bbb('0x21')](function(_0x2693c3){if(!_0x2693c3)throw new InternalError();return _0x2693c3[_0x6bbb('0x22')]();})[_0x6bbb('0x21')](function(){_0x405a7c[_0x6bbb('0x18')](0xcc)['end']();})[_0x6bbb('0x3e')](handleError(_0x405a7c,null));};function getBucketslist(_0x5b6124,_0x1eb584,_0x4e8233){return new Promise(function(_0x3d51d2,_0x24eb6a){var _0x5d4921=new AWS['S3']({'accessKeyId':_0x1eb584,'secretAccessKey':_0x5b6124,'region':_0x4e8233});_0x5d4921[_0x6bbb('0x67')]({},function(_0x224611,_0x39748b){if(_0x224611){return _0x24eb6a(_0x224611);}else{return _0x3d51d2(_0x39748b);}});});}function createBucket(_0x35de32,_0x3eb3a5,_0xd5f70c,_0x3b3860){return new Promise(function(_0x41d43a,_0x1dd6b5){var _0x1e63f9=new AWS['S3']({'accessKeyId':_0x3eb3a5,'secretAccessKey':_0x35de32,'region':_0xd5f70c});_0x1e63f9[_0x6bbb('0x68')]({'Bucket':_0x3b3860},function(_0x2f9994,_0x47327f){if(_0x2f9994){return _0x1dd6b5(_0x2f9994);}else{return _0x41d43a(_0x47327f);}});});}function uploadFile(_0x25ed63,_0x549dc8,_0x57c565,_0x5a0442,_0x4008e3,_0x109136){return new Promise(function(_0x19601b,_0x1bd464){var _0x191b12=new AWS['S3']({'accessKeyId':_0x549dc8,'secretAccessKey':_0x25ed63,'region':_0x57c565});_0x191b12[_0x6bbb('0x69')]({'Bucket':_0x5a0442,'Key':_0x4008e3,'Body':_0x109136},function(_0x3b0b3f,_0x5ea933){if(_0x3b0b3f){return _0x1bd464(_0x3b0b3f);}else{return _0x19601b(_0x5ea933);}});});}function startTranscribe(_0xd10b2b,_0xe4197b,_0x5f479a,_0x10286a,_0x3371f5,_0x57abf6){return new Promise(function(_0xf2aed4,_0x309670){var _0x1c1db7=new AWS[(_0x6bbb('0x6a'))]({'accessKeyId':_0xe4197b,'secretAccessKey':_0xd10b2b,'region':_0x5f479a});_0x1c1db7[_0x6bbb('0x6b')]({'TranscriptionJobName':_0x10286a,'LanguageCode':_0x3371f5,'Media':{'MediaFileUri':_0x57abf6}},function(_0x42200f,_0x42902a){if(_0x42200f){return _0x309670(_0x42200f);}else{return _0xf2aed4(_0x42902a);}});});}function transcribe(_0x4f2676,_0x339bf9,_0x3e7321,_0x570e35,_0x4fd4b9,_0xf1d0a4,_0x2835d3){return new Promise(function(_0x2c654a,_0x2483da){var _0x3b54a5={};logger[_0x6bbb('0x60')](util[_0x6bbb('0x49')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4f2676,_0x4fd4b9));return uploadFile(_0x339bf9,_0x3e7321,_0x570e35,_0x4fd4b9,path[_0x6bbb('0x6c')](_0xf1d0a4),fs[_0x6bbb('0x6d')](_0xf1d0a4))[_0x6bbb('0x21')](function(_0x431d58){logger[_0x6bbb('0x60')](util[_0x6bbb('0x49')](_0x6bbb('0x6e'),_0x4f2676,_0x4fd4b9,_0x431d58['Location']));_0x3b54a5[_0x6bbb('0x6f')]=_0x431d58['Bucket'];_0x3b54a5[_0x6bbb('0x70')]=_0x431d58['Location'];logger[_0x6bbb('0x60')](util[_0x6bbb('0x49')](_0x6bbb('0x71'),_0x4f2676));return startTranscribe(_0x339bf9,_0x3e7321,_0x570e35,uuidv4(),_0x2835d3,_0x431d58[_0x6bbb('0x72')]);})['then'](function(_0x12ba70){logger[_0x6bbb('0x60')](util[_0x6bbb('0x49')](_0x6bbb('0x73'),_0x4f2676,_0x12ba70[_0x6bbb('0x74')]['TranscriptionJobName']));_0x3b54a5[_0x6bbb('0x75')]=_0x12ba70['TranscriptionJob'][_0x6bbb('0x76')];_0x3b54a5['transcribeStatus']=_0x12ba70[_0x6bbb('0x74')][_0x6bbb('0x77')];return _0x2c654a(_0x3b54a5);})[_0x6bbb('0x3e')](function(_0x5db2fc){return _0x2483da(_0x5db2fc);});});}exports[_0x6bbb('0x78')]=function(_0x1f444e,_0x111f49,_0x5bbed7){var _0x1fe4c2;var _0x51d6e9;var _0x4f6e0e;var _0x1fb5a5=require('../../components/encryptor');return db[_0x6bbb('0x3a')][_0x6bbb('0x79')]({'where':{'id':_0x1f444e[_0x6bbb('0x3f')]['id']}})[_0x6bbb('0x21')](function(_0xcfb6ba){if(_0xcfb6ba){var _0x36818e=util['format'](_0x6bbb('0x4a'),_0xcfb6ba[_0x6bbb('0x48')]);if(fs[_0x6bbb('0x4b')](_0x36818e)){cypher=!![];return _0x1fb5a5[_0x6bbb('0x4c')](_0x36818e,_0xcfb6ba[_0x6bbb('0x48')],config['secrets'][_0x6bbb('0x5e')])[_0x6bbb('0x21')](function(){return _0xcfb6ba;});}return _0xcfb6ba;}})[_0x6bbb('0x21')](function(_0xd8b1be){if(!_0xd8b1be){throw new db[(_0x6bbb('0x4e'))][(_0x6bbb('0x4f'))](_0x6bbb('0x7a'));}_0x51d6e9=_0xd8b1be;return db[_0x6bbb('0x7b')][_0x6bbb('0x79')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x111f49,null))[_0x6bbb('0x21')](function(_0x557fd7){if(_0x557fd7){_0x1fe4c2=_0x557fd7;if(!_0x1fe4c2[_0x6bbb('0x7c')]||!_0x1fe4c2[_0x6bbb('0x7d')]||!_0x1fe4c2[_0x6bbb('0x7e')]||!_0x1fe4c2[_0x6bbb('0x7f')]||!_0x1fe4c2['bucket']){throw new db['Sequelize'][(_0x6bbb('0x4f'))](_0x6bbb('0x80'));}if(_0x1f444e[_0x6bbb('0x45')]['runSentiment']&&(!_0x1fe4c2[_0x6bbb('0x81')]||!_0x1fe4c2['sentimentAccountId']||!_0x1fe4c2[_0x6bbb('0x82')]||!_0x1fe4c2[_0x6bbb('0x7f')]||!_0x1fe4c2[_0x6bbb('0x6f')])){throw new db[(_0x6bbb('0x4e'))][(_0x6bbb('0x4f'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x6bbb('0x83')][_0x6bbb('0x79')]({'where':{'id':_0x1fe4c2['transcribeAccountId']}});}})[_0x6bbb('0x21')](function(_0x1855b8){if(!_0x1855b8){throw new db[(_0x6bbb('0x4e'))][(_0x6bbb('0x4f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1855b8[_0x6bbb('0x84')]||!_0x1855b8[_0x6bbb('0x85')]){throw new db[(_0x6bbb('0x4e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4f6e0e=_0x1855b8;return getBucketslist(_0x4f6e0e['data1'],_0x4f6e0e['data2'],_0x1fe4c2[_0x6bbb('0x7e')]);})['then'](function(_0x165f71){if(_0x165f71&&_0x165f71['Buckets']){var _0x5998b9=_[_0x6bbb('0x43')](_0x165f71[_0x6bbb('0x86')],function(_0x2c0368){return _0x2c0368[_0x6bbb('0x87')]===_0x1fe4c2['bucket'];});if(!_0x5998b9){logger[_0x6bbb('0x60')](util['format'](_0x6bbb('0x88'),_0x1f444e[_0x6bbb('0x3f')]['id'],_0x1fe4c2['bucket']));return createBucket(_0x4f6e0e[_0x6bbb('0x84')],_0x4f6e0e[_0x6bbb('0x85')],_0x1fe4c2['transcribeRegion'],_0x1fe4c2[_0x6bbb('0x6f')]);}logger['info'](util[_0x6bbb('0x49')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1f444e['params']['id'],_0x1fe4c2['bucket']));return;}})['then'](function(_0x38f058){if(_0x51d6e9['transcribeStatus']===_0x6bbb('0x89')){return transcribe(_0x1f444e['params']['id'],_0x4f6e0e[_0x6bbb('0x84')],_0x4f6e0e[_0x6bbb('0x85')],_0x1fe4c2['transcribeRegion'],_0x1fe4c2[_0x6bbb('0x6f')],_0x51d6e9[_0x6bbb('0x48')],_0x1fe4c2['language']);}else{logger[_0x6bbb('0x60')](util[_0x6bbb('0x49')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1f444e['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x6bbb('0x21')](function(_0x38d549){if(_0x38d549){_0x38d549[_0x6bbb('0x8a')]=_0x1f444e['body'][_0x6bbb('0x8b')];return _0x51d6e9[_0x6bbb('0x8c')](_0x38d549);}})[_0x6bbb('0x21')](respondWithResult(_0x111f49,null))[_0x6bbb('0x3e')](handleError(_0x111f49,null));};function writeFile(_0xfcc603,_0x5ec250){return new Promise(function(_0x2a26ac,_0x1f4a4f){fs[_0x6bbb('0x8d')](_0x5ec250,_0xfcc603,function(_0x43765a,_0x284017){if(_0x43765a){return _0x1f4a4f(_0x43765a);}else{return _0x2a26ac(_0x284017);}});});}exports[_0x6bbb('0x8e')]=function(_0x28a5c7,_0x35cb63,_0x2afb44){return db[_0x6bbb('0x3a')]['findOne']({'where':{'id':_0x28a5c7[_0x6bbb('0x3f')]['id']}})[_0x6bbb('0x21')](handleEntityNotFound(_0x35cb63))['then'](function(_0x4aed17){if(_0x4aed17&&_0x4aed17['fileText']){var _0x3459ad=_0x4aed17[_0x6bbb('0x8f')];var _0xaac0d3=config[_0x6bbb('0x90')]+_0x6bbb('0x91')+_0x4aed17['id']+_0x6bbb('0x92');if(fs['existsSync'](_0xaac0d3)){return _0xaac0d3;}return writeFile(_0x3459ad,_0xaac0d3)[_0x6bbb('0x21')](function(){return _0xaac0d3;});}else{throw new db['Sequelize'][(_0x6bbb('0x4f'))]('Transcript\x20not\x20available');}})[_0x6bbb('0x21')](function(_0x2ec53e){return _0x35cb63[_0x6bbb('0x52')](_0x2ec53e);})[_0x6bbb('0x3e')](handleError(_0x35cb63));}; \ No newline at end of file +var _0xc7ca=['[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','save','update','destroy','then','error','name','send','index','map','VoiceRecording','type','key','model','differenceBy','query','filters','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','length','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','decryptFile','secrets','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7ca,0x146));var _0xac7c=function(_0x10f8a7,_0x43bd3b){_0x10f8a7=_0x10f8a7-0x0;var _0xfc89a3=_0xc7ca[_0x10f8a7];return _0xfc89a3;};'use strict';var pdf=require(_0xac7c('0x0'));var emlformat=require(_0xac7c('0x1'));var rimraf=require(_0xac7c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac7c('0x3'));var rp=require(_0xac7c('0x4'));var moment=require(_0xac7c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xac7c('0x6'));var util=require(_0xac7c('0x7'));var path=require(_0xac7c('0x8'));var sox=require(_0xac7c('0x9'));var csv=require(_0xac7c('0xa'));var ejs=require(_0xac7c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xac7c('0xc'));var crypto=require(_0xac7c('0xd'));var jsforce=require(_0xac7c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xac7c('0xa'));var querystring=require(_0xac7c('0xf'));var Papa=require('papaparse');var AWS=require(_0xac7c('0x10'));var uuidv4=require(_0xac7c('0x11'));var Redis=require(_0xac7c('0x12'));var authService=require(_0xac7c('0x13'));var qs=require(_0xac7c('0x14'));var as=require(_0xac7c('0x15'));var hardwareService=require(_0xac7c('0x16'));var logger=require(_0xac7c('0x17'))(_0xac7c('0x18'));var utils=require(_0xac7c('0x19'));var config=require(_0xac7c('0x1a'));var licenseUtil=require(_0xac7c('0x1b'));var db=require(_0xac7c('0x1c'))['db'];function respondWithStatusCode(_0xd0606b,_0x29d932){_0x29d932=_0x29d932||0xcc;return function(_0x41aece){if(_0x41aece){return _0xd0606b[_0xac7c('0x1d')](_0x29d932);}return _0xd0606b[_0xac7c('0x1e')](_0x29d932)[_0xac7c('0x1f')]();};}function respondWithResult(_0x29b7a8,_0x2ce879){_0x2ce879=_0x2ce879||0xc8;return function(_0x4b26c5){if(_0x4b26c5){return _0x29b7a8[_0xac7c('0x1e')](_0x2ce879)['json'](_0x4b26c5);}};}function respondWithFilteredResult(_0x5f3ee5,_0xd887b6){return function(_0x31a421){if(_0x31a421){var _0x180d2c=_0x31a421[_0xac7c('0x20')],_0x266bc8=_0xd887b6[_0xac7c('0x21')],_0x2dfa1e=_0xd887b6['offset']+_0xd887b6['limit'],_0x1f8b87;if(_0x2dfa1e>=_0x180d2c){_0x2dfa1e=_0x180d2c;_0x1f8b87=0xc8;}else{_0x1f8b87=0xce;}_0x5f3ee5[_0xac7c('0x1e')](_0x1f8b87);return _0x5f3ee5[_0xac7c('0x22')]('Content-Range',_0x266bc8+'-'+_0x2dfa1e+'/'+_0x180d2c)[_0xac7c('0x23')](_0x31a421);}return null;};}function patchUpdates(_0x222033){return function(_0xdfcf74){try{jsonpatch[_0xac7c('0x24')](_0xdfcf74,_0x222033,!![]);}catch(_0x3b902a){return BPromise['reject'](_0x3b902a);}return _0xdfcf74[_0xac7c('0x25')]();};}function saveUpdates(_0x4f0fbc,_0x10b5f7){return function(_0x40e07d){if(_0x40e07d){return _0x40e07d[_0xac7c('0x26')](_0x4f0fbc)['then'](function(_0x27f967){return _0x27f967;});}return null;};}function removeEntity(_0x19b2cb,_0x26d57c){return function(_0x3e340e){if(_0x3e340e){return _0x3e340e[_0xac7c('0x27')]()[_0xac7c('0x28')](function(){_0x19b2cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a5a9,_0x1ecede){return function(_0x5d9390){if(!_0x5d9390){_0x48a5a9['sendStatus'](0x194);}return _0x5d9390;};}function handleError(_0xc4db79,_0x439384){_0x439384=_0x439384||0x1f4;return function(_0x270345){logger[_0xac7c('0x29')](_0x270345['stack']);if(_0x270345[_0xac7c('0x2a')]){delete _0x270345['name'];}_0xc4db79[_0xac7c('0x1e')](_0x439384)[_0xac7c('0x2b')](_0x270345);};}exports[_0xac7c('0x2c')]=function(_0x18a93d,_0xb5f883){var _0x47a947={},_0x38f973={},_0x527cce={'count':0x0,'rows':[]};var _0x5f531c=_[_0xac7c('0x2d')](db[_0xac7c('0x2e')]['rawAttributes'],function(_0x45dbaf){return{'name':_0x45dbaf['fieldName'],'type':_0x45dbaf[_0xac7c('0x2f')][_0xac7c('0x30')]};});_0x38f973[_0xac7c('0x31')]=_[_0xac7c('0x32')](_[_0xac7c('0x2d')](_0x5f531c,_0xac7c('0x2a')),['format']);_0x38f973[_0xac7c('0x33')]=_['keys'](_0x18a93d[_0xac7c('0x33')]);_0x38f973[_0xac7c('0x34')]=_['intersection'](_0x38f973['model'],_0x38f973['query']);_0x47a947[_0xac7c('0x35')]=_['intersection'](_0x38f973['model'],qs[_0xac7c('0x36')](_0x18a93d[_0xac7c('0x33')]['fields']));_0x47a947[_0xac7c('0x35')]=_0x47a947[_0xac7c('0x35')]['length']?_0x47a947[_0xac7c('0x35')]:_0x38f973[_0xac7c('0x31')];if(!_0x18a93d[_0xac7c('0x33')][_0xac7c('0x37')]('nolimit')){_0x47a947[_0xac7c('0x38')]=qs[_0xac7c('0x38')](_0x18a93d['query'][_0xac7c('0x38')]);_0x47a947[_0xac7c('0x21')]=qs[_0xac7c('0x21')](_0x18a93d['query'][_0xac7c('0x21')]);}_0x47a947[_0xac7c('0x39')]=qs[_0xac7c('0x3a')](_0x18a93d[_0xac7c('0x33')][_0xac7c('0x3a')]);_0x47a947[_0xac7c('0x3b')]=qs[_0xac7c('0x34')](_[_0xac7c('0x3c')](_0x18a93d['query'],_0x38f973[_0xac7c('0x34')]),_0x5f531c);if(_0x18a93d[_0xac7c('0x33')][_0xac7c('0x3d')]){_0x47a947[_0xac7c('0x3b')]=_['merge'](_0x47a947[_0xac7c('0x3b')],{'$or':_[_0xac7c('0x2d')](_0x5f531c,function(_0x5dcf15){if(_0x5dcf15[_0xac7c('0x2f')]!==_0xac7c('0x3e')){var _0x5af943={};_0x5af943[_0x5dcf15['name']]={'$like':'%'+_0x18a93d['query']['filter']+'%'};return _0x5af943;}})});}_0x47a947=_[_0xac7c('0x3f')]({},_0x47a947,_0x18a93d[_0xac7c('0x40')]);var _0x5d06c3={'where':_0x47a947[_0xac7c('0x3b')]};return db[_0xac7c('0x2e')][_0xac7c('0x20')](_0x5d06c3)[_0xac7c('0x28')](function(_0x4eca1d){_0x527cce[_0xac7c('0x20')]=_0x4eca1d;if(_0x18a93d[_0xac7c('0x33')][_0xac7c('0x41')]){_0x47a947[_0xac7c('0x42')]=[{'all':!![]}];}return db[_0xac7c('0x2e')][_0xac7c('0x43')](_0x47a947);})[_0xac7c('0x28')](function(_0xad3669){_0x527cce[_0xac7c('0x44')]=_0xad3669;return _0x527cce;})[_0xac7c('0x28')](respondWithFilteredResult(_0xb5f883,_0x47a947))[_0xac7c('0x45')](handleError(_0xb5f883,null));};exports[_0xac7c('0x46')]=function(_0x3352a6,_0x366533){var _0x991a28={'raw':![],'where':{'id':_0x3352a6[_0xac7c('0x47')]['id']}},_0xb35644={};_0xb35644[_0xac7c('0x31')]=_[_0xac7c('0x48')](db[_0xac7c('0x2e')][_0xac7c('0x49')]);_0xb35644[_0xac7c('0x33')]=_[_0xac7c('0x48')](_0x3352a6[_0xac7c('0x33')]);_0xb35644['filters']=_[_0xac7c('0x4a')](_0xb35644[_0xac7c('0x31')],_0xb35644[_0xac7c('0x33')]);_0x991a28[_0xac7c('0x35')]=_[_0xac7c('0x4a')](_0xb35644[_0xac7c('0x31')],qs[_0xac7c('0x36')](_0x3352a6[_0xac7c('0x33')][_0xac7c('0x36')]));_0x991a28['attributes']=_0x991a28[_0xac7c('0x35')][_0xac7c('0x4b')]?_0x991a28[_0xac7c('0x35')]:_0xb35644['model'];if(_0x3352a6[_0xac7c('0x33')][_0xac7c('0x41')]){_0x991a28[_0xac7c('0x42')]=[{'all':!![]}];}_0x991a28=_[_0xac7c('0x3f')]({},_0x991a28,_0x3352a6[_0xac7c('0x40')]);return db[_0xac7c('0x2e')][_0xac7c('0x4c')](_0x991a28)[_0xac7c('0x28')](handleEntityNotFound(_0x366533,null))['then'](respondWithResult(_0x366533,null))[_0xac7c('0x45')](handleError(_0x366533,null));};exports[_0xac7c('0x4d')]=function(_0xf1af7d,_0x5e7686){return db[_0xac7c('0x2e')][_0xac7c('0x4d')](_0xf1af7d[_0xac7c('0x4e')],{})[_0xac7c('0x28')](respondWithResult(_0x5e7686,0xc9))[_0xac7c('0x45')](handleError(_0x5e7686,null));};exports[_0xac7c('0x26')]=function(_0x3f77a1,_0x57b2e5){if(_0x3f77a1[_0xac7c('0x4e')]['id']){delete _0x3f77a1['body']['id'];}return db[_0xac7c('0x2e')][_0xac7c('0x4c')]({'where':{'id':_0x3f77a1[_0xac7c('0x47')]['id']}})[_0xac7c('0x28')](handleEntityNotFound(_0x57b2e5,null))['then'](saveUpdates(_0x3f77a1[_0xac7c('0x4e')],null))['then'](respondWithResult(_0x57b2e5,null))[_0xac7c('0x45')](handleError(_0x57b2e5,null));};exports['describe']=function(_0x29cc29,_0x584e4d){return db['VoiceRecording'][_0xac7c('0x4f')]()[_0xac7c('0x28')](respondWithResult(_0x584e4d,null))['catch'](handleError(_0x584e4d,null));};exports[_0xac7c('0x50')]=function(_0x2b3cba,_0x54473c,_0x13102b){var _0x1d06fe=require(_0xac7c('0x51'));var _0x3f7a39=![];var _0x5afe4b={};if(_0x2b3cba['query'][_0xac7c('0x2f')]&&_0x2b3cba[_0xac7c('0x33')][_0xac7c('0x2f')]===_0xac7c('0x52')){_0x5afe4b[_0xac7c('0x52')]=_0x2b3cba[_0xac7c('0x47')]['id'];}else{_0x5afe4b['id']=_0x2b3cba[_0xac7c('0x47')]['id'];}return db[_0xac7c('0x2e')][_0xac7c('0x4c')]({'where':_0x5afe4b,'attributes':['id',_0xac7c('0x53')],'raw':!![]})[_0xac7c('0x28')](handleEntityNotFound(_0x54473c,null))[_0xac7c('0x28')](function(_0x5cc751){if(_0x5cc751){var _0x5154c4=_0x5cc751[_0xac7c('0x53')];var _0x38747e=util[_0xac7c('0x54')]('%s.cypher',_0x5154c4);if(fs[_0xac7c('0x55')](_0x38747e)){_0x3f7a39=!![];return _0x1d06fe['decryptFile'](_0x38747e,_0x5154c4,config['secrets'][_0xac7c('0x56')])[_0xac7c('0x28')](function(){return _0x5cc751;});}return _0x5cc751;}})[_0xac7c('0x28')](function(_0xcd7820){if(_0xcd7820){var _0xa7dfe0=_0xcd7820[_0xac7c('0x53')];if(!fs[_0xac7c('0x55')](_0xa7dfe0)){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))](_0xac7c('0x59'));}if(_0xcd7820[_0xac7c('0x5a')]){return _0x54473c[_0xac7c('0x50')](_0xa7dfe0,_0xcd7820[_0xac7c('0x5a')]+path[_0xac7c('0x5b')](_0xa7dfe0),function(){if(_0x3f7a39){fs[_0xac7c('0x5c')](_0xa7dfe0);}});}else{return _0x54473c[_0xac7c('0x50')](_0xa7dfe0,function(_0x2d862a){if(_0x3f7a39){fs[_0xac7c('0x5c')](_0xa7dfe0);}});}}})[_0xac7c('0x45')](function(_0x39aecd){if(_0x39aecd[_0xac7c('0x5d')]===_0xac7c('0x59')){_0x54473c['status'](0x194)[_0xac7c('0x2b')](_0xac7c('0x5e'));}else{return handleError(_0x54473c,null);}});};exports[_0xac7c('0x5f')]=function(_0x49ffbe,_0xbf6cc6,_0x341f9d){var _0x8ee7ba=require(_0xac7c('0x51'));var _0x2996f3=![];var _0x41a421={'$and':[db[_0xac7c('0x60')][_0xac7c('0x3b')](db[_0xac7c('0x60')]['fn'](_0xac7c('0x61'),db[_0xac7c('0x60')][_0xac7c('0x62')](_0xac7c('0x52'))),_0x49ffbe[_0xac7c('0x33')][_0xac7c('0x63')])]};if(_0x49ffbe[_0xac7c('0x33')][_0xac7c('0x2f')]&&_0x49ffbe['query'][_0xac7c('0x2f')]===_0xac7c('0x52')){_0x41a421[_0xac7c('0x64')][_0xac7c('0x65')]({'uniqueid':_0x49ffbe[_0xac7c('0x47')]['id']});}else{_0x41a421[_0xac7c('0x64')][_0xac7c('0x65')]({'id':_0x49ffbe[_0xac7c('0x47')]['id']});}return db[_0xac7c('0x2e')][_0xac7c('0x4c')]({'where':_0x41a421,'attributes':['id','value'],'raw':!![]})[_0xac7c('0x28')](handleEntityNotFound(_0xbf6cc6,null))[_0xac7c('0x28')](function(_0x4f6282){if(_0x4f6282){var _0x2abc6a=util[_0xac7c('0x54')](_0xac7c('0x66'),_0x4f6282[_0xac7c('0x53')]);if(fs['existsSync'](_0x2abc6a)){_0x2996f3=!![];return _0x8ee7ba[_0xac7c('0x67')](_0x2abc6a,_0x4f6282['value'],config[_0xac7c('0x68')][_0xac7c('0x56')])[_0xac7c('0x28')](function(){return _0x4f6282;});}return _0x4f6282;}})['then'](function(_0x39046e){if(_0x39046e){if(!fs[_0xac7c('0x55')](_0x39046e[_0xac7c('0x53')])){throw new db['Sequelize'][(_0xac7c('0x58'))](_0xac7c('0x59'));}if(_0x39046e[_0xac7c('0x5a')]){return _0xbf6cc6[_0xac7c('0x50')](_0x39046e[_0xac7c('0x53')],_0x39046e[_0xac7c('0x5a')]+path['extname'](_0x39046e[_0xac7c('0x53')]),function(){if(_0x2996f3){fs['unlink'](_0x39046e['value']);}});}else{return _0xbf6cc6[_0xac7c('0x50')](_0x39046e['value'],function(_0x2c3c62){if(_0x2996f3){fs['unlink'](_0x39046e[_0xac7c('0x53')]);}});}}})['catch'](handleError(_0xbf6cc6,null));};exports['destroy']=function(_0x50c260,_0x14e09d){return db[_0xac7c('0x2e')][_0xac7c('0x4c')]({'where':{'id':_0x50c260['params']['id']}})[_0xac7c('0x28')](function(_0x256faf){if(!_0x256faf)throw new ReferenceError(_0xac7c('0x69'));return _0x256faf;})['then'](function(_0x25159c){var _0x1f4f2e=_0x25159c[_0xac7c('0x53')];logger[_0xac7c('0x6a')](_0xac7c('0x6b'),_0x1f4f2e);if(!_[_0xac7c('0x6c')](_0x25159c[_0xac7c('0x53')])&&fs[_0xac7c('0x55')](_0x1f4f2e)){logger[_0xac7c('0x6a')](_0xac7c('0x6d')+_0x1f4f2e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xac7c('0x6e')](_0x1f4f2e);}_0x1f4f2e=_0x1f4f2e+'.cypher';if(!_[_0xac7c('0x6c')](_0x25159c[_0xac7c('0x53')])&&fs[_0xac7c('0x55')](_0x1f4f2e)){logger[_0xac7c('0x6a')](_0xac7c('0x6d')+_0x1f4f2e+_0xac7c('0x6f'));fs[_0xac7c('0x6e')](_0x1f4f2e);}return _0x25159c;})[_0xac7c('0x28')](function(_0x270efc){if(!_0x270efc)throw new InternalError();return _0x270efc[_0xac7c('0x27')]();})[_0xac7c('0x28')](function(){_0x14e09d[_0xac7c('0x1e')](0xcc)[_0xac7c('0x1f')]();})[_0xac7c('0x45')](handleError(_0x14e09d,null));};function getBucketslist(_0x5e2963,_0x525b36,_0x37ec62){return new Promise(function(_0x20cf71,_0x422d83){var _0x3fa8be=new AWS['S3']({'accessKeyId':_0x525b36,'secretAccessKey':_0x5e2963,'region':_0x37ec62});_0x3fa8be[_0xac7c('0x70')]({},function(_0x45575c,_0x2b1dc5){if(_0x45575c){return _0x422d83(_0x45575c);}else{return _0x20cf71(_0x2b1dc5);}});});}function createBucket(_0x20fb8d,_0x56b23c,_0x2244ff,_0x2f10c8){return new Promise(function(_0x19cbfc,_0x20e7d7){var _0x12b106=new AWS['S3']({'accessKeyId':_0x56b23c,'secretAccessKey':_0x20fb8d,'region':_0x2244ff});_0x12b106[_0xac7c('0x71')]({'Bucket':_0x2f10c8},function(_0x57150e,_0x246697){if(_0x57150e){return _0x20e7d7(_0x57150e);}else{return _0x19cbfc(_0x246697);}});});}function uploadFile(_0x48cdce,_0x1d096a,_0x3a7397,_0x2937de,_0x1c7302,_0x4bba34){return new Promise(function(_0x42bed3,_0x596a9b){var _0x2641ef=new AWS['S3']({'accessKeyId':_0x1d096a,'secretAccessKey':_0x48cdce,'region':_0x3a7397});_0x2641ef['upload']({'Bucket':_0x2937de,'Key':_0x1c7302,'Body':_0x4bba34},function(_0x17646d,_0x2b05fa){if(_0x17646d){return _0x596a9b(_0x17646d);}else{return _0x42bed3(_0x2b05fa);}});});}function startTranscribe(_0x4273d4,_0x562105,_0x1e389d,_0x4832e2,_0x3dfc60,_0x23ec97){return new Promise(function(_0x3e9170,_0x3156dd){var _0x3be965=new AWS[(_0xac7c('0x72'))]({'accessKeyId':_0x562105,'secretAccessKey':_0x4273d4,'region':_0x1e389d});_0x3be965[_0xac7c('0x73')]({'TranscriptionJobName':_0x4832e2,'LanguageCode':_0x3dfc60,'Media':{'MediaFileUri':_0x23ec97}},function(_0x13c8ea,_0x49131d){if(_0x13c8ea){return _0x3156dd(_0x13c8ea);}else{return _0x3e9170(_0x49131d);}});});}function transcribe(_0xd92670,_0x352487,_0xeadd23,_0x5a7af5,_0x2e6484,_0x5c238d,_0x4bade4){return new Promise(function(_0x53bc05,_0x4155a6){var _0x14daf0={};logger[_0xac7c('0x6a')](util[_0xac7c('0x54')](_0xac7c('0x74'),_0xd92670,_0x2e6484));return uploadFile(_0x352487,_0xeadd23,_0x5a7af5,_0x2e6484,path[_0xac7c('0x75')](_0x5c238d),fs[_0xac7c('0x76')](_0x5c238d))[_0xac7c('0x28')](function(_0x2f6ab7){logger[_0xac7c('0x6a')](util[_0xac7c('0x54')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0xd92670,_0x2e6484,_0x2f6ab7[_0xac7c('0x77')]));_0x14daf0[_0xac7c('0x78')]=_0x2f6ab7[_0xac7c('0x79')];_0x14daf0['location']=_0x2f6ab7[_0xac7c('0x77')];logger['info'](util[_0xac7c('0x54')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xd92670));return startTranscribe(_0x352487,_0xeadd23,_0x5a7af5,uuidv4(),_0x4bade4,_0x2f6ab7['Location']);})[_0xac7c('0x28')](function(_0x5329a4){logger[_0xac7c('0x6a')](util['format'](_0xac7c('0x7a'),_0xd92670,_0x5329a4['TranscriptionJob'][_0xac7c('0x7b')]));_0x14daf0[_0xac7c('0x7c')]=_0x5329a4['TranscriptionJob'][_0xac7c('0x7b')];_0x14daf0[_0xac7c('0x7d')]=_0x5329a4[_0xac7c('0x7e')][_0xac7c('0x7f')];return _0x53bc05(_0x14daf0);})[_0xac7c('0x45')](function(_0xde831e){return _0x4155a6(_0xde831e);});});}exports[_0xac7c('0x80')]=function(_0x89a63,_0x549926,_0x4c29f1){var _0x1dc6ae;var _0x1aa6cc;var _0x10ab20;var _0x3a7dbc=require('../../components/encryptor');return db['VoiceRecording'][_0xac7c('0x81')]({'where':{'id':_0x89a63[_0xac7c('0x47')]['id']}})['then'](function(_0xa47051){if(_0xa47051){var _0x4fb718=util['format'](_0xac7c('0x66'),_0xa47051[_0xac7c('0x53')]);if(fs[_0xac7c('0x55')](_0x4fb718)){cypher=!![];return _0x3a7dbc[_0xac7c('0x67')](_0x4fb718,_0xa47051[_0xac7c('0x53')],config[_0xac7c('0x68')]['recording'])[_0xac7c('0x28')](function(){return _0xa47051;});}return _0xa47051;}})[_0xac7c('0x28')](function(_0x3698fd){if(!_0x3698fd){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))]('Voice\x20Recording\x20not\x20found');}_0x1aa6cc=_0x3698fd;return db[_0xac7c('0x82')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x549926,null))[_0xac7c('0x28')](function(_0x580c08){if(_0x580c08){_0x1dc6ae=_0x580c08;if(!_0x1dc6ae[_0xac7c('0x83')]||!_0x1dc6ae[_0xac7c('0x84')]||!_0x1dc6ae[_0xac7c('0x85')]||!_0x1dc6ae[_0xac7c('0x86')]||!_0x1dc6ae['bucket']){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))](_0xac7c('0x87'));}if(_0x89a63[_0xac7c('0x4e')][_0xac7c('0x88')]&&(!_0x1dc6ae['sentiment']||!_0x1dc6ae['sentimentAccountId']||!_0x1dc6ae[_0xac7c('0x89')]||!_0x1dc6ae[_0xac7c('0x86')]||!_0x1dc6ae[_0xac7c('0x78')])){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xac7c('0x81')]({'where':{'id':_0x1dc6ae[_0xac7c('0x84')]}});}})['then'](function(_0x34fd22){if(!_0x34fd22){throw new db['Sequelize'][(_0xac7c('0x58'))](_0xac7c('0x8a'));}if(!_0x34fd22[_0xac7c('0x8b')]||!_0x34fd22[_0xac7c('0x8c')]){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))](_0xac7c('0x8d'));}_0x10ab20=_0x34fd22;return getBucketslist(_0x10ab20[_0xac7c('0x8b')],_0x10ab20[_0xac7c('0x8c')],_0x1dc6ae['transcribeRegion']);})[_0xac7c('0x28')](function(_0x4aebb0){if(_0x4aebb0&&_0x4aebb0[_0xac7c('0x8e')]){var _0x3011b8=_[_0xac7c('0x4c')](_0x4aebb0[_0xac7c('0x8e')],function(_0x73563f){return _0x73563f[_0xac7c('0x8f')]===_0x1dc6ae[_0xac7c('0x78')];});if(!_0x3011b8){logger[_0xac7c('0x6a')](util[_0xac7c('0x54')](_0xac7c('0x90'),_0x89a63[_0xac7c('0x47')]['id'],_0x1dc6ae[_0xac7c('0x78')]));return createBucket(_0x10ab20[_0xac7c('0x8b')],_0x10ab20[_0xac7c('0x8c')],_0x1dc6ae['transcribeRegion'],_0x1dc6ae['bucket']);}logger[_0xac7c('0x6a')](util[_0xac7c('0x54')](_0xac7c('0x91'),_0x89a63[_0xac7c('0x47')]['id'],_0x1dc6ae[_0xac7c('0x78')]));return;}})[_0xac7c('0x28')](function(_0x2525ce){if(_0x1aa6cc['transcribeStatus']===_0xac7c('0x92')){return transcribe(_0x89a63[_0xac7c('0x47')]['id'],_0x10ab20[_0xac7c('0x8b')],_0x10ab20['data2'],_0x1dc6ae['transcribeRegion'],_0x1dc6ae['bucket'],_0x1aa6cc[_0xac7c('0x53')],_0x1dc6ae[_0xac7c('0x86')]);}else{logger[_0xac7c('0x6a')](util[_0xac7c('0x54')](_0xac7c('0x93'),_0x89a63[_0xac7c('0x47')]['id']));return{'transcribeStatus':_0xac7c('0x94')};}})[_0xac7c('0x28')](function(_0x55aa6c){if(_0x55aa6c){_0x55aa6c[_0xac7c('0x95')]=_0x89a63['body'][_0xac7c('0x88')];return _0x1aa6cc[_0xac7c('0x96')](_0x55aa6c);}})[_0xac7c('0x28')](respondWithResult(_0x549926,null))[_0xac7c('0x45')](handleError(_0x549926,null));};function writeFile(_0x1e1e4e,_0x438b17){return new Promise(function(_0x2b9546,_0x24c97b){fs[_0xac7c('0x97')](_0x438b17,_0x1e1e4e,function(_0x18305b,_0x8369f3){if(_0x18305b){return _0x24c97b(_0x18305b);}else{return _0x2b9546(_0x8369f3);}});});}exports[_0xac7c('0x98')]=function(_0xb376fe,_0x2e3f89,_0xefad09){return db[_0xac7c('0x2e')][_0xac7c('0x81')]({'where':{'id':_0xb376fe[_0xac7c('0x47')]['id']}})[_0xac7c('0x28')](handleEntityNotFound(_0x2e3f89))[_0xac7c('0x28')](function(_0x2529a7){if(_0x2529a7&&_0x2529a7[_0xac7c('0x99')]){var _0x52837b=_0x2529a7['fileText'];var _0xc24088=config[_0xac7c('0x9a')]+_0xac7c('0x9b')+_0x2529a7['id']+'.txt';if(fs[_0xac7c('0x55')](_0xc24088)){return _0xc24088;}return writeFile(_0x52837b,_0xc24088)['then'](function(){return _0xc24088;});}else{throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))](_0xac7c('0x9c'));}})[_0xac7c('0x28')](function(_0x34549b){return _0x2e3f89[_0xac7c('0x50')](_0x34549b);})[_0xac7c('0x45')](handleError(_0x2e3f89));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 1492bd8..df195fd 100644 --- a/server/api/voiceRecording/voiceRecording.model.js +++ b/server/api/voiceRecording/voiceRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9835=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceRecording','voice_recordings','lodash','util','../../config/logger'];(function(_0x8d5844,_0x48eb67){var _0x56726c=function(_0x4cfc1c){while(--_0x4cfc1c){_0x8d5844['push'](_0x8d5844['shift']());}};_0x56726c(++_0x48eb67);}(_0x9835,0x1eb));var _0x5983=function(_0x52f721,_0x1cf447){_0x52f721=_0x52f721-0x0;var _0x3d9909=_0x9835[_0x52f721];return _0x3d9909;};'use strict';var _=require(_0x5983('0x0'));var util=require(_0x5983('0x1'));var logger=require(_0x5983('0x2'))(_0x5983('0x3'));var moment=require(_0x5983('0x4'));var BPromise=require(_0x5983('0x5'));var rp=require(_0x5983('0x6'));var fs=require('fs');var path=require(_0x5983('0x7'));var rimraf=require('rimraf');var config=require(_0x5983('0x8'));var attributes=require('./voiceRecording.attributes');module[_0x5983('0x9')]=function(_0x5e845f,_0x402e2c){return _0x5e845f[_0x5983('0xa')](_0x5983('0xb'),attributes,{'tableName':_0x5983('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5888=['uniqueid','util','api','moment','bluebird','request-promise','../../config/environment','./voiceRecording.attributes','exports','voice_recordings'];(function(_0x5ae350,_0x24edc7){var _0x4e3073=function(_0x22cfed){while(--_0x22cfed){_0x5ae350['push'](_0x5ae350['shift']());}};_0x4e3073(++_0x24edc7);}(_0x5888,0xe7));var _0x8588=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5888[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var util=require(_0x8588('0x0'));var logger=require('../../config/logger')(_0x8588('0x1'));var moment=require(_0x8588('0x2'));var BPromise=require(_0x8588('0x3'));var rp=require(_0x8588('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8588('0x5'));var attributes=require(_0x8588('0x6'));module[_0x8588('0x7')]=function(_0x5c9a08,_0x3253c5){return _0x5c9a08['define']('VoiceRecording',attributes,{'tableName':_0x8588('0x8'),'paranoid':![],'indexes':[{'name':_0x8588('0x9'),'fields':[_0x8588('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d88b639..fa67901 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x4744b1,_0x1f53ed){var _0xa1e07=function(_0x3a1e89){while(--_0x3a1e89){_0x4744b1['push'](_0x4744b1['shift']());}};_0xa1e07(++_0x1f53ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x450a0d,_0x21839f){var _0x41e651=function(_0x174efa){while(--_0x174efa){_0x450a0d['push'](_0x450a0d['shift']());}};_0x41e651(++_0x21839f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index f39cb18..9775876 100644 --- a/server/api/voiceTransferReport/index.js +++ b/server/api/voiceTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['delete','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','put'];(function(_0x2d9621,_0x3fde03){var _0x32940a=function(_0x2b3b71){while(--_0x2b3b71){_0x2d9621['push'](_0x2d9621['shift']());}};_0x32940a(++_0x3fde03);}(_0x0295,0x1f0));var _0x5029=function(_0x542ae7,_0x57332f){_0x542ae7=_0x542ae7-0x0;var _0x5a96a6=_0x0295[_0x542ae7];return _0x5a96a6;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x5029('0x2'));var interaction=require(_0x5029('0x3'));var config=require(_0x5029('0x4'));var controller=require(_0x5029('0x5'));router[_0x5029('0x6')]('/',auth[_0x5029('0x7')](),controller[_0x5029('0x8')]);router[_0x5029('0x6')](_0x5029('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5029('0x7')](),controller['create']);router[_0x5029('0xa')]('/:id',auth[_0x5029('0x7')](),controller['update']);router[_0x5029('0xb')](_0x5029('0x9'),auth[_0x5029('0x7')](),controller['destroy']);module[_0x5029('0xc')]=router; \ No newline at end of file +var _0x9536=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x24f57f,_0x42ac25){var _0xa86432=function(_0x379453){while(--_0x379453){_0x24f57f['push'](_0x24f57f['shift']());}};_0xa86432(++_0x42ac25);}(_0x9536,0x179));var _0x6953=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0x9536[_0x259d17];return _0x407535;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6953('0x5'));var config=require(_0x6953('0x6'));var controller=require(_0x6953('0x7'));router[_0x6953('0x8')]('/',auth[_0x6953('0x9')](),controller['index']);router[_0x6953('0x8')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0xb')]);router[_0x6953('0xc')]('/',auth['isAuthenticated'](),controller[_0x6953('0xd')]);router[_0x6953('0xe')](_0x6953('0xa'),auth['isAuthenticated'](),controller[_0x6953('0xf')]);router[_0x6953('0x10')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0x11')]);module[_0x6953('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 2cd2473..54b8ff1 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.attributes.js +++ b/server/api/voiceTransferReport/voiceTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf2c=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x45e332,_0x1b2cce){var _0xfdd1fc=function(_0x230571){while(--_0x230571){_0x45e332['push'](_0x45e332['shift']());}};_0xfdd1fc(++_0x1b2cce);}(_0xbf2c,0xf7));var _0xcbf2=function(_0x454317,_0x55db03){_0x454317=_0x454317-0x0;var _0x56e7ed=_0xbf2c[_0x454317];return _0x56e7ed;};'use strict';var Sequelize=require(_0xcbf2('0x0'));var moment=require(_0xcbf2('0x1'));module[_0xcbf2('0x2')]={'type':{'type':Sequelize[_0xcbf2('0x3')](_0xcbf2('0x4'),_0xcbf2('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xcbf2('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xcbf2('0x6')]},'transferercalleridname':{'type':Sequelize[_0xcbf2('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xcbf2('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xcbf2('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xcbf2('0x6')]},'transferercontext':{'type':Sequelize[_0xcbf2('0x6')]},'transfererexten':{'type':Sequelize[_0xcbf2('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xcbf2('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xcbf2('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xcbf2('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xcbf2('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xcbf2('0x6')]},'transfereecontext':{'type':Sequelize[_0xcbf2('0x6')]},'transfereeexten':{'type':Sequelize[_0xcbf2('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xcbf2('0x6')]},'isexternal':{'type':Sequelize[_0xcbf2('0x3')](_0xcbf2('0x7'),'No')},'context':{'type':Sequelize[_0xcbf2('0x6')]},'extension':{'type':Sequelize[_0xcbf2('0x6')]}}; \ No newline at end of file +var _0x3eca=['moment','exports','ENUM','attended','STRING','Yes','sequelize'];(function(_0x47e8f8,_0x122910){var _0x296331=function(_0x430613){while(--_0x430613){_0x47e8f8['push'](_0x47e8f8['shift']());}};_0x296331(++_0x122910);}(_0x3eca,0xe6));var _0xa3ec=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x3eca[_0x5db313];return _0x36d503;};'use strict';var Sequelize=require(_0xa3ec('0x0'));var moment=require(_0xa3ec('0x1'));module[_0xa3ec('0x2')]={'type':{'type':Sequelize[_0xa3ec('0x3')]('blind',_0xa3ec('0x4'))},'result':{'type':Sequelize[_0xa3ec('0x5')]},'transfererchannel':{'type':Sequelize[_0xa3ec('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xa3ec('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xa3ec('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xa3ec('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xa3ec('0x5')]},'transferercontext':{'type':Sequelize[_0xa3ec('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xa3ec('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xa3ec('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa3ec('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa3ec('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xa3ec('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xa3ec('0x3')](_0xa3ec('0x6'),'No')},'context':{'type':Sequelize[_0xa3ec('0x5')]},'extension':{'type':Sequelize[_0xa3ec('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 33045ae..103194b 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.controller.js +++ b/server/api/voiceTransferReport/voiceTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb258=['intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','VoiceTransferReport','includeAll','include','rows','show','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','rawAttributes','type','key','model','keys','query','filters'];(function(_0x4fde83,_0x2d9011){var _0x3b33e3=function(_0x3b4214){while(--_0x3b4214){_0x4fde83['push'](_0x4fde83['shift']());}};_0x3b33e3(++_0x2d9011);}(_0xb258,0x179));var _0x8b25=function(_0x2b9006,_0x4ef206){_0x2b9006=_0x2b9006-0x0;var _0x525196=_0xb258[_0x2b9006];return _0x525196;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b25('0x0'));var rimraf=require(_0x8b25('0x1'));var zipdir=require(_0x8b25('0x2'));var jsonpatch=require(_0x8b25('0x3'));var rp=require(_0x8b25('0x4'));var moment=require(_0x8b25('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b25('0x6'));var util=require(_0x8b25('0x7'));var path=require(_0x8b25('0x8'));var sox=require(_0x8b25('0x9'));var csv=require(_0x8b25('0xa'));var ejs=require(_0x8b25('0xb'));var fs=require('fs');var _=require(_0x8b25('0xc'));var squel=require(_0x8b25('0xd'));var crypto=require(_0x8b25('0xe'));var jsforce=require(_0x8b25('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b25('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b25('0x11'));var logger=require(_0x8b25('0x12'))(_0x8b25('0x13'));var utils=require(_0x8b25('0x14'));var config=require(_0x8b25('0x15'));var licenseUtil=require(_0x8b25('0x16'));var db=require(_0x8b25('0x17'))['db'];function respondWithStatusCode(_0x382067,_0x252a57){_0x252a57=_0x252a57||0xcc;return function(_0x211839){if(_0x211839){return _0x382067[_0x8b25('0x18')](_0x252a57);}return _0x382067[_0x8b25('0x19')](_0x252a57)[_0x8b25('0x1a')]();};}function respondWithResult(_0x5a03e3,_0x1b6a5){_0x1b6a5=_0x1b6a5||0xc8;return function(_0x5562dc){if(_0x5562dc){return _0x5a03e3[_0x8b25('0x19')](_0x1b6a5)[_0x8b25('0x1b')](_0x5562dc);}};}function respondWithFilteredResult(_0x4e5fe1,_0x2e2d85){return function(_0x4d3761){if(_0x4d3761){var _0x4e0247=_0x4d3761[_0x8b25('0x1c')],_0x587c93=_0x2e2d85[_0x8b25('0x1d')],_0xf1d743=_0x2e2d85[_0x8b25('0x1d')]+_0x2e2d85['limit'],_0x588142;if(_0xf1d743>=_0x4e0247){_0xf1d743=_0x4e0247;_0x588142=0xc8;}else{_0x588142=0xce;}_0x4e5fe1[_0x8b25('0x19')](_0x588142);return _0x4e5fe1[_0x8b25('0x1e')](_0x8b25('0x1f'),_0x587c93+'-'+_0xf1d743+'/'+_0x4e0247)[_0x8b25('0x1b')](_0x4d3761);}return null;};}function patchUpdates(_0x50fa25){return function(_0x5f5c88){try{jsonpatch[_0x8b25('0x20')](_0x5f5c88,_0x50fa25,!![]);}catch(_0x2ddd80){return BPromise[_0x8b25('0x21')](_0x2ddd80);}return _0x5f5c88[_0x8b25('0x22')]();};}function saveUpdates(_0x3ccb61,_0x33c512){return function(_0x3872f7){if(_0x3872f7){return _0x3872f7[_0x8b25('0x23')](_0x3ccb61)['then'](function(_0x851ef9){return _0x851ef9;});}return null;};}function removeEntity(_0x482302,_0x4e679e){return function(_0x3b1f57){if(_0x3b1f57){return _0x3b1f57[_0x8b25('0x24')]()[_0x8b25('0x25')](function(){_0x482302[_0x8b25('0x19')](0xcc)[_0x8b25('0x1a')]();});}};}function handleEntityNotFound(_0x5b8f47,_0x2e88ab){return function(_0x3e7ba8){if(!_0x3e7ba8){_0x5b8f47['sendStatus'](0x194);}return _0x3e7ba8;};}function handleError(_0x23587e,_0x30005e){_0x30005e=_0x30005e||0x1f4;return function(_0x51baa6){logger[_0x8b25('0x26')](_0x51baa6['stack']);if(_0x51baa6[_0x8b25('0x27')]){delete _0x51baa6['name'];}_0x23587e['status'](_0x30005e)[_0x8b25('0x28')](_0x51baa6);};}exports['index']=function(_0x590b6e,_0x8e6c5c){var _0x544cad={},_0x3d3cc2={},_0x28ca94={'count':0x0,'rows':[]};var _0x533c24=_[_0x8b25('0x29')](db['VoiceTransferReport'][_0x8b25('0x2a')],function(_0x2909f3){return{'name':_0x2909f3['fieldName'],'type':_0x2909f3[_0x8b25('0x2b')][_0x8b25('0x2c')]};});_0x3d3cc2[_0x8b25('0x2d')]=_['map'](_0x533c24,_0x8b25('0x27'));_0x3d3cc2['query']=_[_0x8b25('0x2e')](_0x590b6e[_0x8b25('0x2f')]);_0x3d3cc2[_0x8b25('0x30')]=_[_0x8b25('0x31')](_0x3d3cc2[_0x8b25('0x2d')],_0x3d3cc2[_0x8b25('0x2f')]);_0x544cad['attributes']=_['intersection'](_0x3d3cc2[_0x8b25('0x2d')],qs[_0x8b25('0x32')](_0x590b6e[_0x8b25('0x2f')]['fields']));_0x544cad['attributes']=_0x544cad[_0x8b25('0x33')]['length']?_0x544cad[_0x8b25('0x33')]:_0x3d3cc2[_0x8b25('0x2d')];if(!_0x590b6e['query'][_0x8b25('0x34')](_0x8b25('0x35'))){_0x544cad[_0x8b25('0x36')]=qs[_0x8b25('0x36')](_0x590b6e[_0x8b25('0x2f')]['limit']);_0x544cad[_0x8b25('0x1d')]=qs[_0x8b25('0x1d')](_0x590b6e['query'][_0x8b25('0x1d')]);}_0x544cad[_0x8b25('0x37')]=qs[_0x8b25('0x38')](_0x590b6e[_0x8b25('0x2f')][_0x8b25('0x38')]);_0x544cad['where']=qs[_0x8b25('0x30')](_[_0x8b25('0x39')](_0x590b6e[_0x8b25('0x2f')],_0x3d3cc2[_0x8b25('0x30')]),_0x533c24);if(_0x590b6e[_0x8b25('0x2f')]['filter']){_0x544cad[_0x8b25('0x3a')]=_[_0x8b25('0x3b')](_0x544cad[_0x8b25('0x3a')],{'$or':_[_0x8b25('0x29')](_0x533c24,function(_0x32af08){if(_0x32af08[_0x8b25('0x2b')]!==_0x8b25('0x3c')){var _0x750f6f={};_0x750f6f[_0x32af08[_0x8b25('0x27')]]={'$like':'%'+_0x590b6e[_0x8b25('0x2f')]['filter']+'%'};return _0x750f6f;}})});}_0x544cad=_['merge']({},_0x544cad,_0x590b6e['options']);var _0x238071={'where':_0x544cad[_0x8b25('0x3a')]};return db[_0x8b25('0x3d')][_0x8b25('0x1c')](_0x238071)[_0x8b25('0x25')](function(_0x1b4e5d){_0x28ca94['count']=_0x1b4e5d;if(_0x590b6e[_0x8b25('0x2f')][_0x8b25('0x3e')]){_0x544cad[_0x8b25('0x3f')]=[{'all':!![]}];}return db[_0x8b25('0x3d')]['findAll'](_0x544cad);})[_0x8b25('0x25')](function(_0x45cad6){_0x28ca94[_0x8b25('0x40')]=_0x45cad6;return _0x28ca94;})[_0x8b25('0x25')](respondWithFilteredResult(_0x8e6c5c,_0x544cad))['catch'](handleError(_0x8e6c5c,null));};exports[_0x8b25('0x41')]=function(_0x48cdbb,_0x1317fa){var _0x427cf5={'raw':!![],'where':{'id':_0x48cdbb['params']['id']}},_0x49ee80={};_0x49ee80['model']=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x49ee80[_0x8b25('0x2f')]=_[_0x8b25('0x2e')](_0x48cdbb[_0x8b25('0x2f')]);_0x49ee80['filters']=_[_0x8b25('0x31')](_0x49ee80[_0x8b25('0x2d')],_0x49ee80[_0x8b25('0x2f')]);_0x427cf5[_0x8b25('0x33')]=_['intersection'](_0x49ee80['model'],qs[_0x8b25('0x32')](_0x48cdbb[_0x8b25('0x2f')]['fields']));_0x427cf5[_0x8b25('0x33')]=_0x427cf5['attributes']['length']?_0x427cf5[_0x8b25('0x33')]:_0x49ee80[_0x8b25('0x2d')];if(_0x48cdbb[_0x8b25('0x2f')][_0x8b25('0x3e')]){_0x427cf5[_0x8b25('0x3f')]=[{'all':!![]}];}_0x427cf5=_[_0x8b25('0x3b')]({},_0x427cf5,_0x48cdbb['options']);return db[_0x8b25('0x3d')]['find'](_0x427cf5)[_0x8b25('0x25')](handleEntityNotFound(_0x1317fa,null))['then'](respondWithResult(_0x1317fa,null))[_0x8b25('0x42')](handleError(_0x1317fa,null));};exports[_0x8b25('0x43')]=function(_0x21aa46,_0x5a0d82){return db[_0x8b25('0x3d')][_0x8b25('0x43')](_0x21aa46[_0x8b25('0x44')],{})[_0x8b25('0x25')](respondWithResult(_0x5a0d82,0xc9))[_0x8b25('0x42')](handleError(_0x5a0d82,null));};exports[_0x8b25('0x23')]=function(_0x4535b3,_0x171f75){if(_0x4535b3[_0x8b25('0x44')]['id']){delete _0x4535b3[_0x8b25('0x44')]['id'];}return db[_0x8b25('0x3d')][_0x8b25('0x45')]({'where':{'id':_0x4535b3[_0x8b25('0x46')]['id']}})[_0x8b25('0x25')](handleEntityNotFound(_0x171f75,null))[_0x8b25('0x25')](saveUpdates(_0x4535b3[_0x8b25('0x44')],null))[_0x8b25('0x25')](respondWithResult(_0x171f75,null))[_0x8b25('0x42')](handleError(_0x171f75,null));};exports[_0x8b25('0x24')]=function(_0x3569b2,_0x4e2713){return db['VoiceTransferReport'][_0x8b25('0x45')]({'where':{'id':_0x3569b2[_0x8b25('0x46')]['id']}})[_0x8b25('0x25')](handleEntityNotFound(_0x4e2713,null))[_0x8b25('0x25')](removeEntity(_0x4e2713,null))[_0x8b25('0x42')](handleError(_0x4e2713,null));}; \ No newline at end of file +var _0x5a4d=['map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','include','findAll','params','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','VoiceTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x38d852,_0x5ce645){var _0x105103=function(_0x5d2805){while(--_0x5d2805){_0x38d852['push'](_0x38d852['shift']());}};_0x105103(++_0x5ce645);}(_0x5a4d,0xa5));var _0xd5a4=function(_0x50e8be,_0x51a7c4){_0x50e8be=_0x50e8be-0x0;var _0x2b7ffb=_0x5a4d[_0x50e8be];return _0x2b7ffb;};'use strict';var pdf=require(_0xd5a4('0x0'));var emlformat=require(_0xd5a4('0x1'));var rimraf=require(_0xd5a4('0x2'));var zipdir=require(_0xd5a4('0x3'));var jsonpatch=require(_0xd5a4('0x4'));var rp=require(_0xd5a4('0x5'));var moment=require('moment');var BPromise=require(_0xd5a4('0x6'));var Mustache=require(_0xd5a4('0x7'));var util=require('util');var path=require(_0xd5a4('0x8'));var sox=require('sox');var csv=require(_0xd5a4('0x9'));var ejs=require(_0xd5a4('0xa'));var fs=require('fs');var _=require(_0xd5a4('0xb'));var squel=require('squel');var crypto=require(_0xd5a4('0xc'));var jsforce=require(_0xd5a4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd5a4('0x9'));var querystring=require('querystring');var Papa=require(_0xd5a4('0xe'));var Redis=require(_0xd5a4('0xf'));var authService=require(_0xd5a4('0x10'));var qs=require(_0xd5a4('0x11'));var as=require(_0xd5a4('0x12'));var hardwareService=require(_0xd5a4('0x13'));var logger=require(_0xd5a4('0x14'))(_0xd5a4('0x15'));var utils=require(_0xd5a4('0x16'));var config=require(_0xd5a4('0x17'));var licenseUtil=require(_0xd5a4('0x18'));var db=require(_0xd5a4('0x19'))['db'];function respondWithStatusCode(_0x56c1a,_0x4291aa){_0x4291aa=_0x4291aa||0xcc;return function(_0xaeb6c2){if(_0xaeb6c2){return _0x56c1a['sendStatus'](_0x4291aa);}return _0x56c1a['status'](_0x4291aa)[_0xd5a4('0x1a')]();};}function respondWithResult(_0x32870c,_0x23205e){_0x23205e=_0x23205e||0xc8;return function(_0x1238ba){if(_0x1238ba){return _0x32870c['status'](_0x23205e)[_0xd5a4('0x1b')](_0x1238ba);}};}function respondWithFilteredResult(_0x52d713,_0x3f3c2f){return function(_0x5d658f){if(_0x5d658f){var _0x341cf5=_0x5d658f[_0xd5a4('0x1c')],_0x4ebcb8=_0x3f3c2f['offset'],_0x7779f3=_0x3f3c2f[_0xd5a4('0x1d')]+_0x3f3c2f[_0xd5a4('0x1e')],_0x56d276;if(_0x7779f3>=_0x341cf5){_0x7779f3=_0x341cf5;_0x56d276=0xc8;}else{_0x56d276=0xce;}_0x52d713[_0xd5a4('0x1f')](_0x56d276);return _0x52d713[_0xd5a4('0x20')](_0xd5a4('0x21'),_0x4ebcb8+'-'+_0x7779f3+'/'+_0x341cf5)[_0xd5a4('0x1b')](_0x5d658f);}return null;};}function patchUpdates(_0x444125){return function(_0x5c81b5){try{jsonpatch[_0xd5a4('0x22')](_0x5c81b5,_0x444125,!![]);}catch(_0x15942a){return BPromise[_0xd5a4('0x23')](_0x15942a);}return _0x5c81b5[_0xd5a4('0x24')]();};}function saveUpdates(_0x293150,_0x5b1aca){return function(_0x56d34d){if(_0x56d34d){return _0x56d34d[_0xd5a4('0x25')](_0x293150)[_0xd5a4('0x26')](function(_0x219e2a){return _0x219e2a;});}return null;};}function removeEntity(_0x493260,_0x52cc67){return function(_0x7a6c70){if(_0x7a6c70){return _0x7a6c70['destroy']()['then'](function(){_0x493260[_0xd5a4('0x1f')](0xcc)[_0xd5a4('0x1a')]();});}};}function handleEntityNotFound(_0x45ce1e,_0x18807d){return function(_0x3e1e76){if(!_0x3e1e76){_0x45ce1e['sendStatus'](0x194);}return _0x3e1e76;};}function handleError(_0x5b9aed,_0x32cae9){_0x32cae9=_0x32cae9||0x1f4;return function(_0x3a91d6){logger['error'](_0x3a91d6[_0xd5a4('0x27')]);if(_0x3a91d6[_0xd5a4('0x28')]){delete _0x3a91d6[_0xd5a4('0x28')];}_0x5b9aed[_0xd5a4('0x1f')](_0x32cae9)[_0xd5a4('0x29')](_0x3a91d6);};}exports['index']=function(_0x1bae28,_0x177a6c){var _0x26d692={},_0x4fa8ae={},_0x255bf4={'count':0x0,'rows':[]};var _0x1a8f1d=_['map'](db[_0xd5a4('0x2a')][_0xd5a4('0x2b')],function(_0x1ef416){return{'name':_0x1ef416[_0xd5a4('0x2c')],'type':_0x1ef416[_0xd5a4('0x2d')][_0xd5a4('0x2e')]};});_0x4fa8ae[_0xd5a4('0x2f')]=_[_0xd5a4('0x30')](_0x1a8f1d,'name');_0x4fa8ae['query']=_[_0xd5a4('0x31')](_0x1bae28[_0xd5a4('0x32')]);_0x4fa8ae[_0xd5a4('0x33')]=_[_0xd5a4('0x34')](_0x4fa8ae[_0xd5a4('0x2f')],_0x4fa8ae[_0xd5a4('0x32')]);_0x26d692[_0xd5a4('0x35')]=_[_0xd5a4('0x34')](_0x4fa8ae[_0xd5a4('0x2f')],qs['fields'](_0x1bae28['query'][_0xd5a4('0x36')]));_0x26d692[_0xd5a4('0x35')]=_0x26d692['attributes'][_0xd5a4('0x37')]?_0x26d692[_0xd5a4('0x35')]:_0x4fa8ae[_0xd5a4('0x2f')];if(!_0x1bae28[_0xd5a4('0x32')][_0xd5a4('0x38')](_0xd5a4('0x39'))){_0x26d692[_0xd5a4('0x1e')]=qs[_0xd5a4('0x1e')](_0x1bae28[_0xd5a4('0x32')][_0xd5a4('0x1e')]);_0x26d692['offset']=qs[_0xd5a4('0x1d')](_0x1bae28[_0xd5a4('0x32')]['offset']);}_0x26d692['order']=qs['sort'](_0x1bae28[_0xd5a4('0x32')][_0xd5a4('0x3a')]);_0x26d692['where']=qs[_0xd5a4('0x33')](_[_0xd5a4('0x3b')](_0x1bae28[_0xd5a4('0x32')],_0x4fa8ae[_0xd5a4('0x33')]),_0x1a8f1d);if(_0x1bae28[_0xd5a4('0x32')][_0xd5a4('0x3c')]){_0x26d692[_0xd5a4('0x3d')]=_['merge'](_0x26d692[_0xd5a4('0x3d')],{'$or':_[_0xd5a4('0x30')](_0x1a8f1d,function(_0x163bd2){if(_0x163bd2['type']!==_0xd5a4('0x3e')){var _0x1209f8={};_0x1209f8[_0x163bd2[_0xd5a4('0x28')]]={'$like':'%'+_0x1bae28['query'][_0xd5a4('0x3c')]+'%'};return _0x1209f8;}})});}_0x26d692=_['merge']({},_0x26d692,_0x1bae28['options']);var _0x19eddc={'where':_0x26d692[_0xd5a4('0x3d')]};return db[_0xd5a4('0x2a')][_0xd5a4('0x1c')](_0x19eddc)[_0xd5a4('0x26')](function(_0x4a4cad){_0x255bf4[_0xd5a4('0x1c')]=_0x4a4cad;if(_0x1bae28[_0xd5a4('0x32')]['includeAll']){_0x26d692[_0xd5a4('0x3f')]=[{'all':!![]}];}return db[_0xd5a4('0x2a')][_0xd5a4('0x40')](_0x26d692);})[_0xd5a4('0x26')](function(_0x43ff45){_0x255bf4['rows']=_0x43ff45;return _0x255bf4;})[_0xd5a4('0x26')](respondWithFilteredResult(_0x177a6c,_0x26d692))['catch'](handleError(_0x177a6c,null));};exports['show']=function(_0x34b09b,_0x5f3093){var _0x126358={'raw':!![],'where':{'id':_0x34b09b[_0xd5a4('0x41')]['id']}},_0x331f38={};_0x331f38['model']=_[_0xd5a4('0x31')](db[_0xd5a4('0x2a')][_0xd5a4('0x2b')]);_0x331f38[_0xd5a4('0x32')]=_['keys'](_0x34b09b[_0xd5a4('0x32')]);_0x331f38[_0xd5a4('0x33')]=_[_0xd5a4('0x34')](_0x331f38[_0xd5a4('0x2f')],_0x331f38['query']);_0x126358[_0xd5a4('0x35')]=_['intersection'](_0x331f38[_0xd5a4('0x2f')],qs[_0xd5a4('0x36')](_0x34b09b['query']['fields']));_0x126358[_0xd5a4('0x35')]=_0x126358[_0xd5a4('0x35')][_0xd5a4('0x37')]?_0x126358['attributes']:_0x331f38[_0xd5a4('0x2f')];if(_0x34b09b['query']['includeAll']){_0x126358[_0xd5a4('0x3f')]=[{'all':!![]}];}_0x126358=_['merge']({},_0x126358,_0x34b09b[_0xd5a4('0x42')]);return db[_0xd5a4('0x2a')][_0xd5a4('0x43')](_0x126358)['then'](handleEntityNotFound(_0x5f3093,null))[_0xd5a4('0x26')](respondWithResult(_0x5f3093,null))[_0xd5a4('0x44')](handleError(_0x5f3093,null));};exports[_0xd5a4('0x45')]=function(_0x97df72,_0x1d2415){return db[_0xd5a4('0x2a')]['create'](_0x97df72[_0xd5a4('0x46')],{})[_0xd5a4('0x26')](respondWithResult(_0x1d2415,0xc9))['catch'](handleError(_0x1d2415,null));};exports[_0xd5a4('0x25')]=function(_0x365099,_0x2ad35a){if(_0x365099[_0xd5a4('0x46')]['id']){delete _0x365099[_0xd5a4('0x46')]['id'];}return db['VoiceTransferReport'][_0xd5a4('0x43')]({'where':{'id':_0x365099['params']['id']}})[_0xd5a4('0x26')](handleEntityNotFound(_0x2ad35a,null))[_0xd5a4('0x26')](saveUpdates(_0x365099[_0xd5a4('0x46')],null))['then'](respondWithResult(_0x2ad35a,null))[_0xd5a4('0x44')](handleError(_0x2ad35a,null));};exports['destroy']=function(_0x1a73b6,_0x5198da){return db[_0xd5a4('0x2a')]['find']({'where':{'id':_0x1a73b6['params']['id']}})[_0xd5a4('0x26')](handleEntityNotFound(_0x5198da,null))['then'](removeEntity(_0x5198da,null))['catch'](handleError(_0x5198da,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 908b545..da3d9b0 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.model.js +++ b/server/api/voiceTransferReport/voiceTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e54=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0x8e54,0x108));var _0x48e5=function(_0x30af1e,_0x4f6db5){_0x30af1e=_0x30af1e-0x0;var _0x21c1cf=_0x8e54[_0x30af1e];return _0x21c1cf;};'use strict';var _=require(_0x48e5('0x0'));var util=require(_0x48e5('0x1'));var logger=require(_0x48e5('0x2'))(_0x48e5('0x3'));var moment=require(_0x48e5('0x4'));var BPromise=require(_0x48e5('0x5'));var rp=require(_0x48e5('0x6'));var fs=require('fs');var path=require(_0x48e5('0x7'));var rimraf=require('rimraf');var config=require(_0x48e5('0x8'));var attributes=require(_0x48e5('0x9'));module[_0x48e5('0xa')]=function(_0x7112f7,_0x7b6fc6){return _0x7112f7[_0x48e5('0xb')](_0x48e5('0xc'),attributes,{'tableName':_0x48e5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa96d=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa96d,0x116));var _0xda96=function(_0x34b48c,_0xe97afa){_0x34b48c=_0x34b48c-0x0;var _0x3b9957=_0xa96d[_0x34b48c];return _0x3b9957;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xda96('0x0'));var BPromise=require(_0xda96('0x1'));var rp=require(_0xda96('0x2'));var fs=require('fs');var path=require(_0xda96('0x3'));var rimraf=require(_0xda96('0x4'));var config=require(_0xda96('0x5'));var attributes=require(_0xda96('0x6'));module['exports']=function(_0x1681ed,_0x4b890e){return _0x1681ed['define'](_0xda96('0x7'),attributes,{'tableName':_0xda96('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 8905710..fe8cecf 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.rpc.js +++ b/server/api/voiceTransferReport/voiceTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90ef=['moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','raw','stringify','lodash'];(function(_0x4f6b32,_0x17239f){var _0xddf425=function(_0x1eb3ff){while(--_0x1eb3ff){_0x4f6b32['push'](_0x4f6b32['shift']());}};_0xddf425(++_0x17239f);}(_0x90ef,0x8f));var _0xf90e=function(_0x881c21,_0x22f1ce){_0x881c21=_0x881c21-0x0;var _0xcf0b84=_0x90ef[_0x881c21];return _0xcf0b84;};'use strict';var _=require(_0xf90e('0x0'));var util=require('util');var moment=require(_0xf90e('0x1'));var BPromise=require(_0xf90e('0x2'));var rs=require(_0xf90e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf90e('0x4'));var config=require(_0xf90e('0x5'));var jayson=require(_0xf90e('0x6'));var client=jayson['client'][_0xf90e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x59086f,_0x4883ed,_0x3c65fa){return new BPromise(function(_0x21b10e,_0x1b2d7e){return client[_0xf90e('0x8')](_0x59086f,_0x3c65fa)[_0xf90e('0x9')](function(_0x1262f3){logger[_0xf90e('0xa')](_0xf90e('0xb'),_0x4883ed,_0xf90e('0xc'));logger[_0xf90e('0xd')](_0xf90e('0xe'),_0x4883ed,_0xf90e('0xc'),JSON['stringify'](_0x1262f3));if(_0x1262f3[_0xf90e('0xf')]){if(_0x1262f3['error'][_0xf90e('0x10')]===0x1f4){logger['error'](_0xf90e('0xb'),_0x4883ed,_0x1262f3[_0xf90e('0xf')][_0xf90e('0x11')]);return _0x1b2d7e(_0x1262f3[_0xf90e('0xf')][_0xf90e('0x11')]);}logger[_0xf90e('0xf')](_0xf90e('0xb'),_0x4883ed,_0x1262f3[_0xf90e('0xf')][_0xf90e('0x11')]);return _0x21b10e(_0x1262f3[_0xf90e('0xf')][_0xf90e('0x11')]);}else{logger[_0xf90e('0xa')](_0xf90e('0xb'),_0x4883ed,_0xf90e('0xc'));_0x21b10e(_0x1262f3[_0xf90e('0x12')]['message']);}})['catch'](function(_0x2abf44){logger[_0xf90e('0xf')](_0xf90e('0xb'),_0x4883ed,_0x2abf44);_0x1b2d7e(_0x2abf44);});});}exports[_0xf90e('0x13')]=function(_0x5a5593){var _0x257c8a=this;return new Promise(function(_0x57908d,_0x2b7d9b){return db[_0xf90e('0x14')][_0xf90e('0x15')](_0x5a5593['body'],{'raw':_0x5a5593['options']?_0x5a5593['options'][_0xf90e('0x16')]===undefined?!![]:![]:!![]})[_0xf90e('0x9')](function(_0x5ce523){logger['info'](_0xf90e('0x13'),_0x5a5593);logger[_0xf90e('0xd')](_0xf90e('0x13'),_0x5a5593,JSON[_0xf90e('0x17')](_0x5ce523));_0x57908d(_0x5ce523);})['catch'](function(_0x1662b3){logger[_0xf90e('0xf')](_0xf90e('0x13'),_0x1662b3['message'],_0x5a5593);_0x2b7d9b(_0x257c8a['error'](0x1f4,_0x1662b3[_0xf90e('0x11')]));});});}; \ No newline at end of file +var _0xffa2=['stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3e44c4,_0x5cb564){var _0x4d464f=function(_0xa0f897){while(--_0xa0f897){_0x3e44c4['push'](_0x3e44c4['shift']());}};_0x4d464f(++_0x5cb564);}(_0xffa2,0x150));var _0x2ffa=function(_0x1f4928,_0x5a0cd9){_0x1f4928=_0x1f4928-0x0;var _0xd726ec=_0xffa2[_0x1f4928];return _0xd726ec;};'use strict';var _=require(_0x2ffa('0x0'));var util=require(_0x2ffa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2ffa('0x2'));var fs=require('fs');var Redis=require(_0x2ffa('0x3'));var db=require(_0x2ffa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ffa('0x5'))(_0x2ffa('0x6'));var config=require(_0x2ffa('0x7'));var jayson=require(_0x2ffa('0x8'));var client=jayson[_0x2ffa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16340b,_0x7051c6,_0x4ec485){return new BPromise(function(_0x5e70e1,_0x2f592b){return client[_0x2ffa('0xa')](_0x16340b,_0x4ec485)['then'](function(_0x11dbe4){logger[_0x2ffa('0xb')](_0x2ffa('0xc'),_0x7051c6,_0x2ffa('0xd'));logger['debug'](_0x2ffa('0xe'),_0x7051c6,_0x2ffa('0xd'),JSON[_0x2ffa('0xf')](_0x11dbe4));if(_0x11dbe4[_0x2ffa('0x10')]){if(_0x11dbe4[_0x2ffa('0x10')][_0x2ffa('0x11')]===0x1f4){logger['error'](_0x2ffa('0xc'),_0x7051c6,_0x11dbe4['error']['message']);return _0x2f592b(_0x11dbe4[_0x2ffa('0x10')][_0x2ffa('0x12')]);}logger[_0x2ffa('0x10')](_0x2ffa('0xc'),_0x7051c6,_0x11dbe4[_0x2ffa('0x10')][_0x2ffa('0x12')]);return _0x5e70e1(_0x11dbe4[_0x2ffa('0x10')][_0x2ffa('0x12')]);}else{logger['info'](_0x2ffa('0xc'),_0x7051c6,'request\x20sent');_0x5e70e1(_0x11dbe4['result']['message']);}})[_0x2ffa('0x13')](function(_0x17095a){logger[_0x2ffa('0x10')](_0x2ffa('0xc'),_0x7051c6,_0x17095a);_0x2f592b(_0x17095a);});});}exports[_0x2ffa('0x14')]=function(_0xa2259a){var _0xa01024=this;return new Promise(function(_0x4c27de,_0x494b0c){return db[_0x2ffa('0x15')]['create'](_0xa2259a[_0x2ffa('0x16')],{'raw':_0xa2259a[_0x2ffa('0x17')]?_0xa2259a[_0x2ffa('0x17')][_0x2ffa('0x18')]===undefined?!![]:![]:!![]})[_0x2ffa('0x19')](function(_0x47d390){logger['info'](_0x2ffa('0x14'),_0xa2259a);logger[_0x2ffa('0x1a')](_0x2ffa('0x14'),_0xa2259a,JSON[_0x2ffa('0xf')](_0x47d390));_0x4c27de(_0x47d390);})[_0x2ffa('0x13')](function(_0x139f85){logger[_0x2ffa('0x10')]('CreateVoiceTransferReport',_0x139f85[_0x2ffa('0x12')],_0xa2259a);_0x494b0c(_0xa01024['error'](0x1f4,_0x139f85[_0x2ffa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index bfd2dc3..b86cab4 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x495e=['isAuthenticated','originate','/hangup','canUpdate','hangup','answer','/hold','hold','unhold','/calls','/transfer','transfer','exports','express','./webbar.controller','post','/originate'];(function(_0x2bf6d6,_0x198265){var _0x15a703=function(_0x5153ea){while(--_0x5153ea){_0x2bf6d6['push'](_0x2bf6d6['shift']());}};_0x15a703(++_0x198265);}(_0x495e,0xfb));var _0xe495=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x495e[_0x3e8cae];return _0x45c4d6;};'use strict';var express=require(_0xe495('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xe495('0x1'));router[_0xe495('0x2')](_0xe495('0x3'),auth[_0xe495('0x4')](),auth['canUpdate'](),controller[_0xe495('0x5')]);router[_0xe495('0x2')](_0xe495('0x6'),auth[_0xe495('0x4')](),auth[_0xe495('0x7')](),controller[_0xe495('0x8')]);router[_0xe495('0x2')]('/answer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xe495('0x9')]);router['post'](_0xe495('0xa'),auth[_0xe495('0x4')](),auth[_0xe495('0x7')](),controller[_0xe495('0xb')]);router[_0xe495('0x2')]('/unhold',auth[_0xe495('0x4')](),auth[_0xe495('0x7')](),controller[_0xe495('0xc')]);router['post'](_0xe495('0xd'),auth[_0xe495('0x4')](),auth['canUpdate'](),controller['calls']);router[_0xe495('0x2')](_0xe495('0xe'),auth['isAuthenticated'](),auth[_0xe495('0x7')](),controller[_0xe495('0xf')]);module[_0xe495('0x10')]=router; \ No newline at end of file +var _0xd64b=['exports','express','../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate','hangup','/answer','answer','hold','unhold','calls','/transfer','transfer'];(function(_0x26d325,_0x16949f){var _0x300c21=function(_0x334000){while(--_0x334000){_0x26d325['push'](_0x26d325['shift']());}};_0x300c21(++_0x16949f);}(_0xd64b,0xc1));var _0xbd64=function(_0x5760f7,_0x47f093){_0x5760f7=_0x5760f7-0x0;var _0x4a8aa0=_0xd64b[_0x5760f7];return _0x4a8aa0;};'use strict';var express=require(_0xbd64('0x0'));var router=express['Router']();var auth=require(_0xbd64('0x1'));var controller=require('./webbar.controller');router[_0xbd64('0x2')](_0xbd64('0x3'),auth[_0xbd64('0x4')](),auth[_0xbd64('0x5')](),controller[_0xbd64('0x6')]);router['post']('/hangup',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x2')](_0xbd64('0x8'),auth[_0xbd64('0x4')](),auth[_0xbd64('0x5')](),controller[_0xbd64('0x9')]);router[_0xbd64('0x2')]('/hold',auth['isAuthenticated'](),auth[_0xbd64('0x5')](),controller[_0xbd64('0xa')]);router[_0xbd64('0x2')]('/unhold',auth[_0xbd64('0x4')](),auth[_0xbd64('0x5')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x2')]('/calls',auth[_0xbd64('0x4')](),auth['canUpdate'](),controller[_0xbd64('0xc')]);router[_0xbd64('0x2')](_0xbd64('0xd'),auth[_0xbd64('0x4')](),auth[_0xbd64('0x5')](),controller[_0xbd64('0xe')]);module[_0xbd64('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 713ba32..b7e9840 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf257=['number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','request','then','message','result','User','findOne','agent','all','filter','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId','callerId','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer\x20fired:','hold','hold\x20fired:','webbar:hold','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf257,0x82));var _0x7f25=function(_0x3b8c63,_0x24a9c6){_0x3b8c63=_0x3b8c63-0x0;var _0x1a8e31=_0xf257[_0x3b8c63];return _0x1a8e31;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x7f25('0x0'))['db'];var config=require(_0x7f25('0x1'));var util=require(_0x7f25('0x2'));var BPromise=require(_0x7f25('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x7f25('0x4')][_0x7f25('0x5')]({'port':0x232a});var logger=require(_0x7f25('0x6'))(_0x7f25('0x7'));var Redis=require(_0x7f25('0x8'));config[_0x7f25('0x9')]=_[_0x7f25('0xa')](config[_0x7f25('0x9')],{'host':_0x7f25('0xb'),'port':0x18eb});var io=require(_0x7f25('0xc'))(new Redis(config[_0x7f25('0x9')]));var Schema=require(_0x7f25('0xd'));var originateValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],_0x7f25('0xf')]},'callNumber':{'type':'string','required':[!![],_0x7f25('0x10')]},'callerId':{'type':_0x7f25('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7f25('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],_0x7f25('0xf')]},'sessionId':{'type':_0x7f25('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],_0x7f25('0xf')]},'sessionId':{'type':_0x7f25('0x11'),'required':[!![],_0x7f25('0x12')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7f25('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],_0x7f25('0xf')]},'sessionId':{'type':_0x7f25('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x3b5424,_0x230ad6,_0x24a312){logger[_0x7f25('0x13')](_0x3b5424,_0x230ad6,JSON[_0x7f25('0x14')](_0x24a312));io['to'](_0x3b5424)[_0x7f25('0x15')](_0x230ad6,_0x24a312);}function handleError(_0x19ad80){return function(_0x26d4aa){console['log'](_0x7f25('0x16'),_0x26d4aa,_0x26d4aa instanceof RangeError);logger[_0x7f25('0x17')](_0x26d4aa[_0x7f25('0x18')]);if(_0x26d4aa instanceof RangeError){if(_0x26d4aa[_0x7f25('0x19')]){delete _0x26d4aa[_0x7f25('0x19')];}_0x19ad80[_0x7f25('0x1a')](0x194)['send'](_0x26d4aa);}else{if(_0x26d4aa['name']){delete _0x26d4aa[_0x7f25('0x19')];}_0x19ad80[_0x7f25('0x1a')](0x1f4)[_0x7f25('0x1b')](_0x26d4aa);}};}function checkError(){return function(_0x3dc0c7){if(!_0x3dc0c7){throw new RangeError(_0x7f25('0x1c'));}return _0x3dc0c7;};}function respondWithRpcPromise(_0x334802,_0x6cf659){return new BPromise(function(_0x225948,_0x31bf5f){var _0x4be8b8=amiClient;return _0x4be8b8[_0x7f25('0x1d')](_0x334802,_0x6cf659)[_0x7f25('0x1e')](function(_0x456d84){if(_0x456d84[_0x7f25('0x17')]){if(_0x456d84[_0x7f25('0x17')]['code']===0x1f4){return _0x31bf5f(_0x456d84[_0x7f25('0x17')][_0x7f25('0x1f')]);}return _0x225948(_0x456d84[_0x7f25('0x17')]['message']);}else{_0x225948(_0x456d84[_0x7f25('0x20')]);}})['catch'](function(_0x467650){_0x31bf5f(_0x467650);});});}function getAgent(_0x2a504e){return db[_0x7f25('0x21')][_0x7f25('0x22')]({'where':{'id':_0x2a504e,'role':_0x7f25('0x23')}})[_0x7f25('0x1e')](checkError());}function getAgentCheckSession(_0x26babd,_0x337893){return new BPromise(function(_0x44116d,_0x30c7bc){var _0x531382=respondWithRpcPromise('VoiceChannels');var _0x3a6b2f=getAgent(_0x26babd);Promise[_0x7f25('0x24')]([_0x531382,_0x3a6b2f])['then'](function(_0xa373ee){var _0x340f1b=_0xa373ee[0x0];var _0x2bc378=_0xa373ee[0x1];var _0x22ecc0=_[_0x7f25('0x25')](_0x340f1b[_0x7f25('0x26')],function(_0x574099){return _0x574099[_0x7f25('0x27')]==_0x2bc378['id']&&_0x574099['sessionId']==_0x337893;});if(_0x22ecc0[_0x7f25('0x28')]==0x1){_0x44116d(_0x2bc378);}else{_0x30c7bc(new RangeError('sessionId\x20'+_0x337893+_0x7f25('0x29')));}});});}exports[_0x7f25('0x2a')]=function(_0x1521ef,_0x5389e5){logger[_0x7f25('0x13')](_0x7f25('0x2b'),_0x1521ef[_0x7f25('0x2c')]);var _0x43a7c2=originateValidation[_0x7f25('0xd')](_0x1521ef[_0x7f25('0x2c')]);if(_0x43a7c2[_0x7f25('0x28')]>0x0){return _0x5389e5[_0x7f25('0x1a')](0x190)['json'](_0x43a7c2);}var _0xf5197e=_0x1521ef[_0x7f25('0x2c')][_0x7f25('0x2d')];var _0x161688=_0x1521ef[_0x7f25('0x2c')]['callNumber'];var _0x4cc461=_0x1521ef['body'][_0x7f25('0x2e')];var _0x46d97b=_0x1521ef[_0x7f25('0x2c')]['callbackUrl'];return getAgent(_0xf5197e)[_0x7f25('0x1e')](function(_0x152e4b){logger['info'](_0x7f25('0x2f'),_0x152e4b['name']);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x152e4b['name']),_0x7f25('0x32'),{'callNumber':_0x161688,'callerId':_0x4cc461,'callbackUrl':_0x46d97b});return _0x5389e5[_0x7f25('0x1a')](0xc8)[_0x7f25('0x33')]({'error':![],'message':_0x7f25('0x34')});})[_0x7f25('0x35')](handleError(_0x5389e5));};exports[_0x7f25('0x36')]=function(_0x4b4a23,_0x1a4118){logger[_0x7f25('0x13')](_0x7f25('0x37'),_0x4b4a23['body']);var _0x29e0ac=hangupValidation[_0x7f25('0xd')](_0x4b4a23[_0x7f25('0x2c')]);if(_0x29e0ac[_0x7f25('0x28')]>0x0){return _0x1a4118[_0x7f25('0x1a')](0x190)['json'](_0x29e0ac);}var _0x4429b2=_0x4b4a23[_0x7f25('0x2c')][_0x7f25('0x2d')];var _0x26031b=_0x4b4a23[_0x7f25('0x2c')][_0x7f25('0x38')];return getAgent(_0x4429b2)[_0x7f25('0x1e')](function(_0x32585b){logger['info'](_0x7f25('0x2f'),_0x32585b['name']);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x32585b[_0x7f25('0x19')]),_0x7f25('0x39'),{'sessionId':_0x26031b});return _0x1a4118[_0x7f25('0x1a')](0xc8)['json']({'error':![],'message':_0x7f25('0x3a')});})['catch'](handleError(_0x1a4118));};exports['answer']=function(_0x55ff2e,_0x25d4cd){logger['info'](_0x7f25('0x3b'),_0x55ff2e[_0x7f25('0x2c')]);var _0x138439=answerValidation['validate'](_0x55ff2e['body']);if(_0x138439[_0x7f25('0x28')]>0x0){return _0x25d4cd[_0x7f25('0x1a')](0x190)[_0x7f25('0x33')](_0x138439);}var _0x22eb46=_0x55ff2e['body'][_0x7f25('0x2d')];var _0x5813fa=_0x55ff2e['body']['sessionId'];return getAgent(_0x22eb46)[_0x7f25('0x1e')](function(_0x50a272){logger[_0x7f25('0x13')](_0x7f25('0x2f'),_0x50a272[_0x7f25('0x19')]);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x50a272[_0x7f25('0x19')]),'webbar:answer',{'sessionId':_0x5813fa});return _0x25d4cd[_0x7f25('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x7f25('0x35')](handleError(_0x25d4cd));};exports[_0x7f25('0x3c')]=function(_0x28a586,_0xbb90fa){logger[_0x7f25('0x13')](_0x7f25('0x3d'),_0x28a586[_0x7f25('0x2c')]);var _0x550699=holdValidation['validate'](_0x28a586[_0x7f25('0x2c')]);if(_0x550699[_0x7f25('0x28')]>0x0){return _0xbb90fa['status'](0x190)[_0x7f25('0x33')](_0x550699);}var _0xc5875a=_0x28a586[_0x7f25('0x2c')]['userId'];var _0x160af9=_0x28a586['body'][_0x7f25('0x38')];return getAgent(_0xc5875a)[_0x7f25('0x1e')](function(_0x390905){logger['info'](_0x7f25('0x2f'),_0x390905[_0x7f25('0x19')]);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x390905['name']),_0x7f25('0x3e'),{'sessionId':_0x160af9});return _0xbb90fa[_0x7f25('0x1a')](0xc8)[_0x7f25('0x33')]({'error':![],'message':'hold\x20executed!'});})[_0x7f25('0x35')](handleError(_0xbb90fa));};exports['unhold']=function(_0x4b277c,_0x5677ec){logger['info']('unhold\x20fired:',_0x4b277c[_0x7f25('0x2c')]);var _0x20b808=unholdValidation[_0x7f25('0xd')](_0x4b277c[_0x7f25('0x2c')]);if(_0x20b808['length']>0x0){return _0x5677ec[_0x7f25('0x1a')](0x190)[_0x7f25('0x33')](_0x20b808);}var _0x4454ae=_0x4b277c[_0x7f25('0x2c')]['userId'];var _0x44f7f5=_0x4b277c[_0x7f25('0x2c')][_0x7f25('0x38')];return getAgent(_0x4454ae)['then'](function(_0x4e7d40){logger[_0x7f25('0x13')](_0x7f25('0x2f'),_0x4e7d40[_0x7f25('0x19')]);emit(util[_0x7f25('0x30')]('user:%s',_0x4e7d40[_0x7f25('0x19')]),'webbar:unhold',{'sessionId':_0x44f7f5});return _0x5677ec[_0x7f25('0x1a')](0xc8)[_0x7f25('0x33')]({'error':![],'message':'unhold\x20executed!'});})[_0x7f25('0x35')](handleError(_0x5677ec));};exports['calls']=function(_0x405eaa,_0x49ffb1){logger['info']('calls\x20fired:',_0x49ffb1[_0x7f25('0x2c')]);var _0xe6598d=callsValidation['validate'](_0x405eaa[_0x7f25('0x2c')]);if(_0xe6598d[_0x7f25('0x28')]>0x0){return _0x49ffb1[_0x7f25('0x1a')](0x190)['json'](_0xe6598d);}var _0x59061f=_0x405eaa['body']['userId'];var _0x2631ed=respondWithRpcPromise(_0x7f25('0x3f'));var _0x178aed=getAgent(_0x59061f);return Promise[_0x7f25('0x24')]([_0x2631ed,_0x178aed])[_0x7f25('0x1e')](function(_0x3ae219){var _0x242911=_0x3ae219[0x0];var _0x3638ce=_0x3ae219[0x1];var _0x9f1c53=_[_0x7f25('0x25')](_0x242911[_0x7f25('0x26')],function(_0x275845){return _0x275845[_0x7f25('0x27')]==_0x3638ce['id'];});return _0x49ffb1[_0x7f25('0x1a')](0xc8)['json']({'count':_0x9f1c53[_0x7f25('0x28')],'rows':_0x9f1c53});})[_0x7f25('0x35')](handleError(_0x49ffb1));};exports[_0x7f25('0x40')]=function(_0x552a59,_0x1c97e4){logger[_0x7f25('0x13')](_0x7f25('0x41'),_0x552a59['body']);var _0x5d3659=conferenceValidation[_0x7f25('0xd')](_0x552a59['body']);if(_0x5d3659['length']>0x0){return _0x1c97e4['status'](0x190)[_0x7f25('0x33')](_0x5d3659);}var _0x355578=_0x552a59[_0x7f25('0x2c')][_0x7f25('0x2d')];return getAgent(_0x355578)['then'](function(_0x7ca2e4){logger['info'](_0x7f25('0x2f'),_0x7ca2e4[_0x7f25('0x19')]);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x7ca2e4[_0x7f25('0x19')]),_0x7f25('0x42'));return _0x1c97e4['status'](0xc8)[_0x7f25('0x33')]({'error':![],'message':_0x7f25('0x43')});})[_0x7f25('0x35')](handleError(_0x1c97e4));};exports[_0x7f25('0x44')]=function(_0x31f61d,_0xfa4bde){logger['info']('transfer\x20fired:',_0x31f61d['body']);var _0x15ad7a=transferValidation[_0x7f25('0xd')](_0x31f61d[_0x7f25('0x2c')]);if(_0x15ad7a['length']>0x0){return _0xfa4bde[_0x7f25('0x1a')](0x190)['json'](_0x15ad7a);}var _0x22602e=_0x31f61d['body'][_0x7f25('0x2d')];var _0x571385=_0x31f61d[_0x7f25('0x2c')][_0x7f25('0x38')];var _0x4784d2=_0x31f61d[_0x7f25('0x2c')][_0x7f25('0x45')];return getAgent(_0x22602e)[_0x7f25('0x1e')](function(_0x3ad975){logger[_0x7f25('0x13')](_0x7f25('0x2f'),_0x3ad975[_0x7f25('0x19')]);emit(util['format'](_0x7f25('0x31'),_0x3ad975[_0x7f25('0x19')]),_0x7f25('0x46'),{'sessionId':_0x571385,'transferNumber':_0x4784d2});return _0xfa4bde[_0x7f25('0x1a')](0xc8)['json']({'error':![],'message':_0x7f25('0x47')});})[_0x7f25('0x35')](handleError(_0xfa4bde));}; \ No newline at end of file +var _0x8ca7=['conference\x20fired:','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','path','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','stack','name','send','NotFound','request','then','code','result','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','status','json','userId','callbackUrl','entityFound:','user:%s','catch','hangup','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','all','conference'];(function(_0x396014,_0x53e39f){var _0x4cd085=function(_0x2f5532){while(--_0x2f5532){_0x396014['push'](_0x396014['shift']());}};_0x4cd085(++_0x53e39f);}(_0x8ca7,0x9b));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x78ca('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x78ca('0x1'));var BPromise=require(_0x78ca('0x2'));var jayson=require(_0x78ca('0x3'));var amiClient=jayson[_0x78ca('0x4')][_0x78ca('0x5')]({'port':0x232a});var logger=require(_0x78ca('0x6'))('webbarapi');var Redis=require(_0x78ca('0x7'));config[_0x78ca('0x8')]=_[_0x78ca('0x9')](config[_0x78ca('0x8')],{'host':_0x78ca('0xa'),'port':0x18eb});var io=require(_0x78ca('0xb'))(new Redis(config[_0x78ca('0x8')]));var Schema=require(_0x78ca('0xc'));var originateValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'callNumber':{'type':_0x78ca('0xf'),'required':[!![],_0x78ca('0x10')]},'callerId':{'type':_0x78ca('0xf')},'callbackUrl':{'type':_0x78ca('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':_0x78ca('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':_0x78ca('0xf'),'required':[!![],_0x78ca('0x11')]},'transferNumber':{'type':_0x78ca('0xf'),'required':[!![],_0x78ca('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':_0x78ca('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x78ca('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]}});function emit(_0x3ead02,_0x14f2dd,_0x424ccb){logger['info'](_0x3ead02,_0x14f2dd,JSON[_0x78ca('0x13')](_0x424ccb));io['to'](_0x3ead02)[_0x78ca('0x14')](_0x14f2dd,_0x424ccb);}function handleError(_0x3a47c1){return function(_0x3eef71){console[_0x78ca('0x15')](_0x78ca('0x16'),_0x3eef71,_0x3eef71 instanceof RangeError);logger[_0x78ca('0x17')](_0x3eef71[_0x78ca('0x18')]);if(_0x3eef71 instanceof RangeError){if(_0x3eef71[_0x78ca('0x19')]){delete _0x3eef71[_0x78ca('0x19')];}_0x3a47c1['status'](0x194)[_0x78ca('0x1a')](_0x3eef71);}else{if(_0x3eef71[_0x78ca('0x19')]){delete _0x3eef71[_0x78ca('0x19')];}_0x3a47c1['status'](0x1f4)[_0x78ca('0x1a')](_0x3eef71);}};}function checkError(){return function(_0x16c93c){if(!_0x16c93c){throw new RangeError(_0x78ca('0x1b'));}return _0x16c93c;};}function respondWithRpcPromise(_0x13e236,_0xaa22b6){return new BPromise(function(_0x330006,_0x22ec7c){var _0x8665ef=amiClient;return _0x8665ef[_0x78ca('0x1c')](_0x13e236,_0xaa22b6)[_0x78ca('0x1d')](function(_0x8c4395){if(_0x8c4395[_0x78ca('0x17')]){if(_0x8c4395['error'][_0x78ca('0x1e')]===0x1f4){return _0x22ec7c(_0x8c4395[_0x78ca('0x17')]['message']);}return _0x330006(_0x8c4395[_0x78ca('0x17')]['message']);}else{_0x330006(_0x8c4395[_0x78ca('0x1f')]);}})['catch'](function(_0x4f5a97){_0x22ec7c(_0x4f5a97);});});}function getAgent(_0x4b3a16){return db['User'][_0x78ca('0x20')]({'where':{'id':_0x4b3a16,'role':_0x78ca('0x21')}})[_0x78ca('0x1d')](checkError());}function getAgentCheckSession(_0x8781e3,_0x24c450){return new BPromise(function(_0x163062,_0x1d5a61){var _0x3a95b4=respondWithRpcPromise(_0x78ca('0x22'));var _0x2a9f56=getAgent(_0x8781e3);Promise['all']([_0x3a95b4,_0x2a9f56])[_0x78ca('0x1d')](function(_0x120f86){var _0x42a0e3=_0x120f86[0x0];var _0x5aeaff=_0x120f86[0x1];var _0x3a51bc=_[_0x78ca('0x23')](_0x42a0e3[_0x78ca('0x24')],function(_0x2cf94e){return _0x2cf94e[_0x78ca('0x25')]==_0x5aeaff['id']&&_0x2cf94e[_0x78ca('0x26')]==_0x24c450;});if(_0x3a51bc[_0x78ca('0x27')]==0x1){_0x163062(_0x5aeaff);}else{_0x1d5a61(new RangeError(_0x78ca('0x28')+_0x24c450+_0x78ca('0x29')));}});});}exports['originate']=function(_0xc55094,_0xdf32e7){logger[_0x78ca('0x2a')](_0x78ca('0x2b'),_0xc55094['body']);var _0x2b42d4=originateValidation['validate'](_0xc55094[_0x78ca('0x2c')]);if(_0x2b42d4[_0x78ca('0x27')]>0x0){return _0xdf32e7[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x2b42d4);}var _0x35684d=_0xc55094[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x43ecc5=_0xc55094['body']['callNumber'];var _0x3f9f38=_0xc55094[_0x78ca('0x2c')]['callerId'];var _0x3a45de=_0xc55094['body'][_0x78ca('0x30')];return getAgent(_0x35684d)['then'](function(_0x39f76b){logger[_0x78ca('0x2a')](_0x78ca('0x31'),_0x39f76b[_0x78ca('0x19')]);emit(util['format'](_0x78ca('0x32'),_0x39f76b[_0x78ca('0x19')]),'webbar:originate',{'callNumber':_0x43ecc5,'callerId':_0x3f9f38,'callbackUrl':_0x3a45de});return _0xdf32e7[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0x78ca('0x33')](handleError(_0xdf32e7));};exports[_0x78ca('0x34')]=function(_0xabc9a9,_0x4cb93a){logger[_0x78ca('0x2a')](_0x78ca('0x35'),_0xabc9a9[_0x78ca('0x2c')]);var _0x2e6d06=hangupValidation[_0x78ca('0xc')](_0xabc9a9[_0x78ca('0x2c')]);if(_0x2e6d06[_0x78ca('0x27')]>0x0){return _0x4cb93a[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x2e6d06);}var _0x4e74fe=_0xabc9a9['body']['userId'];var _0x19f04d=_0xabc9a9['body'][_0x78ca('0x26')];return getAgent(_0x4e74fe)['then'](function(_0x5f58e7){logger[_0x78ca('0x2a')](_0x78ca('0x31'),_0x5f58e7[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')](_0x78ca('0x32'),_0x5f58e7['name']),_0x78ca('0x37'),{'sessionId':_0x19f04d});return _0x4cb93a[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x38')});})['catch'](handleError(_0x4cb93a));};exports[_0x78ca('0x39')]=function(_0x310698,_0x4cbba8){logger['info'](_0x78ca('0x3a'),_0x310698[_0x78ca('0x2c')]);var _0x27017e=answerValidation[_0x78ca('0xc')](_0x310698[_0x78ca('0x2c')]);if(_0x27017e[_0x78ca('0x27')]>0x0){return _0x4cbba8[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x27017e);}var _0x59971a=_0x310698[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x12f1f2=_0x310698['body'][_0x78ca('0x26')];return getAgent(_0x59971a)['then'](function(_0xc34eef){logger['info'](_0x78ca('0x31'),_0xc34eef[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')]('user:%s',_0xc34eef[_0x78ca('0x19')]),_0x78ca('0x3b'),{'sessionId':_0x12f1f2});return _0x4cbba8[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x3c')});})[_0x78ca('0x33')](handleError(_0x4cbba8));};exports[_0x78ca('0x3d')]=function(_0x3b909e,_0x10df82){logger[_0x78ca('0x2a')]('hold\x20fired:',_0x3b909e['body']);var _0x173126=holdValidation['validate'](_0x3b909e[_0x78ca('0x2c')]);if(_0x173126['length']>0x0){return _0x10df82[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x173126);}var _0x19608f=_0x3b909e[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x4100b1=_0x3b909e[_0x78ca('0x2c')][_0x78ca('0x26')];return getAgent(_0x19608f)[_0x78ca('0x1d')](function(_0x557c2f){logger[_0x78ca('0x2a')]('entityFound:',_0x557c2f[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')]('user:%s',_0x557c2f['name']),'webbar:hold',{'sessionId':_0x4100b1});return _0x10df82[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x3e')});})['catch'](handleError(_0x10df82));};exports[_0x78ca('0x3f')]=function(_0x387529,_0x438154){logger[_0x78ca('0x2a')](_0x78ca('0x40'),_0x387529['body']);var _0x3c45ef=unholdValidation[_0x78ca('0xc')](_0x387529[_0x78ca('0x2c')]);if(_0x3c45ef[_0x78ca('0x27')]>0x0){return _0x438154[_0x78ca('0x2d')](0x190)['json'](_0x3c45ef);}var _0x487e39=_0x387529[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x3656d0=_0x387529['body'][_0x78ca('0x26')];return getAgent(_0x487e39)[_0x78ca('0x1d')](function(_0x179098){logger['info']('entityFound:',_0x179098[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')](_0x78ca('0x32'),_0x179098[_0x78ca('0x19')]),'webbar:unhold',{'sessionId':_0x3656d0});return _0x438154[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x41')});})[_0x78ca('0x33')](handleError(_0x438154));};exports[_0x78ca('0x42')]=function(_0x39a714,_0x2deab0){logger['info'](_0x78ca('0x43'),_0x2deab0['body']);var _0x390ed8=callsValidation[_0x78ca('0xc')](_0x39a714['body']);if(_0x390ed8[_0x78ca('0x27')]>0x0){return _0x2deab0['status'](0x190)[_0x78ca('0x2e')](_0x390ed8);}var _0x532872=_0x39a714[_0x78ca('0x2c')]['userId'];var _0x419cba=respondWithRpcPromise('VoiceChannels');var _0x58688e=getAgent(_0x532872);return Promise[_0x78ca('0x44')]([_0x419cba,_0x58688e])[_0x78ca('0x1d')](function(_0xd72ef3){var _0x2db637=_0xd72ef3[0x0];var _0x3afbf6=_0xd72ef3[0x1];var _0x106622=_[_0x78ca('0x23')](_0x2db637[_0x78ca('0x24')],function(_0x4b2e38){return _0x4b2e38[_0x78ca('0x25')]==_0x3afbf6['id'];});return _0x2deab0[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'count':_0x106622[_0x78ca('0x27')],'rows':_0x106622});})['catch'](handleError(_0x2deab0));};exports[_0x78ca('0x45')]=function(_0x2748ec,_0xd7099e){logger['info'](_0x78ca('0x46'),_0x2748ec[_0x78ca('0x2c')]);var _0x425e4b=conferenceValidation[_0x78ca('0xc')](_0x2748ec[_0x78ca('0x2c')]);if(_0x425e4b['length']>0x0){return _0xd7099e[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x425e4b);}var _0x406202=_0x2748ec[_0x78ca('0x2c')][_0x78ca('0x2f')];return getAgent(_0x406202)[_0x78ca('0x1d')](function(_0x20a11b){logger[_0x78ca('0x2a')](_0x78ca('0x31'),_0x20a11b[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')](_0x78ca('0x32'),_0x20a11b[_0x78ca('0x19')]),'webbar:conference');return _0xd7099e[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x47')});})['catch'](handleError(_0xd7099e));};exports[_0x78ca('0x48')]=function(_0x1f9121,_0x221ca9){logger['info']('transfer\x20fired:',_0x1f9121[_0x78ca('0x2c')]);var _0x21bd8e=transferValidation[_0x78ca('0xc')](_0x1f9121[_0x78ca('0x2c')]);if(_0x21bd8e[_0x78ca('0x27')]>0x0){return _0x221ca9[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x21bd8e);}var _0x3b715b=_0x1f9121[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x56c84c=_0x1f9121[_0x78ca('0x2c')][_0x78ca('0x26')];var _0x1ab40c=_0x1f9121[_0x78ca('0x2c')]['transferNumber'];return getAgent(_0x3b715b)[_0x78ca('0x1d')](function(_0x1da8dd){logger['info']('entityFound:',_0x1da8dd[_0x78ca('0x19')]);emit(util['format'](_0x78ca('0x32'),_0x1da8dd[_0x78ca('0x19')]),_0x78ca('0x49'),{'sessionId':_0x56c84c,'transferNumber':_0x1ab40c});return _0x221ca9[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x4a')});})[_0x78ca('0x33')](handleError(_0x221ca9));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index fc81950..8dc5eeb 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63a5=['isAuthenticated','/:id','show','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','send','put','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','index','/describe'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0x63a5,0x18e));var _0x563a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x63a5[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var path=require(_0x563a('0x2'));var timeout=require('connect-timeout');var express=require(_0x563a('0x3'));var router=express['Router']();var auth=require(_0x563a('0x4'));var interaction=require(_0x563a('0x5'));var config=require(_0x563a('0x6'));var controller=require(_0x563a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x563a('0x8')]);router['get'](_0x563a('0x9'),auth[_0x563a('0xa')](),controller['describe']);router['get'](_0x563a('0xb'),auth[_0x563a('0xa')](),controller[_0x563a('0xc')]);router[_0x563a('0xd')](_0x563a('0xe'),auth[_0x563a('0xa')](),controller[_0x563a('0xf')]);router[_0x563a('0xd')](_0x563a('0x10'),auth[_0x563a('0xa')](),controller[_0x563a('0x11')]);router[_0x563a('0xd')](_0x563a('0x12'),auth[_0x563a('0xa')](),controller['getAgents']);router[_0x563a('0xd')](_0x563a('0x13'),auth[_0x563a('0xa')](),controller[_0x563a('0x14')]);router[_0x563a('0x15')]('/',auth[_0x563a('0xa')](),controller['create']);router[_0x563a('0x15')](_0x563a('0xe'),auth[_0x563a('0xa')](),controller[_0x563a('0x16')]);router['post']('/:id/canned_answers',auth[_0x563a('0xa')](),controller[_0x563a('0x17')]);router['post'](_0x563a('0x12'),auth[_0x563a('0xa')](),controller[_0x563a('0x18')]);router[_0x563a('0x15')]('/:id/applications',auth['isAuthenticated'](),controller[_0x563a('0x19')]);router[_0x563a('0x15')](_0x563a('0x1a'),controller['notify']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x563a('0x1b')]);router[_0x563a('0x1c')](_0x563a('0xb'),auth[_0x563a('0xa')](),controller['update']);router['delete'](_0x563a('0xb'),auth[_0x563a('0xa')](),controller[_0x563a('0x1d')]);router[_0x563a('0x1e')](_0x563a('0xe'),auth[_0x563a('0xa')](),controller[_0x563a('0x1f')]);router[_0x563a('0x1e')]('/:id/canned_answers',auth[_0x563a('0xa')](),controller['removeAnswers']);router[_0x563a('0x1e')](_0x563a('0x12'),auth[_0x563a('0xa')](),controller[_0x563a('0x20')]);module[_0x563a('0x21')]=router; \ No newline at end of file +var _0x1c9a=['post','create','addDisposition','addAnswer','/:id/applications','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications'];(function(_0x7c3c27,_0x16c034){var _0x4a2c4b=function(_0x293b82){while(--_0x293b82){_0x7c3c27['push'](_0x7c3c27['shift']());}};_0x4a2c4b(++_0x16c034);}(_0x1c9a,0x98));var _0xa1c9=function(_0x5f53f6,_0x91157e){_0x5f53f6=_0x5f53f6-0x0;var _0xb8628=_0x1c9a[_0x5f53f6];return _0xb8628;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require('util');var path=require(_0xa1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var auth=require(_0xa1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x5'));var controller=require(_0xa1c9('0x6'));router[_0xa1c9('0x7')]('/',auth[_0xa1c9('0x8')](),controller['index']);router[_0xa1c9('0x7')]('/describe',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x9')]);router[_0xa1c9('0x7')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xa')]);router[_0xa1c9('0x7')](_0xa1c9('0xb'),auth['isAuthenticated'](),controller[_0xa1c9('0xc')]);router[_0xa1c9('0x7')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xe')]);router[_0xa1c9('0x7')](_0xa1c9('0xf'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x10')]);router[_0xa1c9('0x7')]('/:id/applications',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x11')]);router[_0xa1c9('0x12')]('/',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x13')]);router['post'](_0xa1c9('0xb'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x14')]);router[_0xa1c9('0x12')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x15')]);router[_0xa1c9('0x12')](_0xa1c9('0xf'),auth[_0xa1c9('0x8')](),controller['addAgents']);router[_0xa1c9('0x12')](_0xa1c9('0x16'),auth[_0xa1c9('0x8')](),controller['addApplications']);router[_0xa1c9('0x12')]('/:id/notify',controller[_0xa1c9('0x17')]);router[_0xa1c9('0x12')](_0xa1c9('0x18'),auth['isAuthenticated'](),controller[_0xa1c9('0x19')]);router[_0xa1c9('0x1a')](_0xa1c9('0x1b'),auth['isAuthenticated'](),controller[_0xa1c9('0x1c')]);router[_0xa1c9('0x1d')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x1e')]);router[_0xa1c9('0x1d')]('/:id/dispositions',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x1f')]);router[_0xa1c9('0x1d')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller['removeAnswers']);router['delete'](_0xa1c9('0xf'),auth['isAuthenticated'](),controller[_0xa1c9('0x20')]);module[_0xa1c9('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 02c7a25..ae72864 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f25=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x545b38,_0x190e0e){var _0x2b8ad3=function(_0xc952d8){while(--_0xc952d8){_0x545b38['push'](_0x545b38['shift']());}};_0x2b8ad3(++_0x190e0e);}(_0x6f25,0x1f3));var _0x56f2=function(_0x235191,_0x395021){_0x235191=_0x235191-0x0;var _0x1e33f8=_0x6f25[_0x235191];return _0x1e33f8;};'use strict';var Sequelize=require(_0x56f2('0x0'));var rs=require(_0x56f2('0x1'));module[_0x56f2('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x56f2('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x56f2('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x56f2('0x4')],'defaultValue':function(){return rs[_0x56f2('0x5')]();}},'phone':{'type':Sequelize[_0x56f2('0x4')]},'type':{'type':Sequelize[_0x56f2('0x6')](_0x56f2('0x7'))},'accountSid':{'type':Sequelize[_0x56f2('0x4')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x56f2('0x8')],'defaultValue':function(){return _0x56f2('0x9');}},'notificationSound':{'type':Sequelize[_0x56f2('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x56f2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x56f2('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x56f2('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x56f2('0xa')],'defaultValue':![],'comment':_0x56f2('0xd'),'set':function(_0xe6b85c){if(!_0xe6b85c){this[_0x56f2('0xe')](_0x56f2('0xf'),null);}this['setDataValue'](_0x56f2('0x10'),_0xe6b85c);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4fc7=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0xd3bcf8,_0x994fdb){var _0x296170=function(_0x2f5519){while(--_0x2f5519){_0xd3bcf8['push'](_0xd3bcf8['shift']());}};_0x296170(++_0x994fdb);}(_0x4fc7,0x12d));var _0x74fc=function(_0x21ec68,_0x175b7e){_0x21ec68=_0x21ec68-0x0;var _0x5f3249=_0x4fc7[_0x21ec68];return _0x5f3249;};'use strict';var Sequelize=require(_0x74fc('0x0'));var rs=require(_0x74fc('0x1'));module[_0x74fc('0x2')]={'name':{'type':Sequelize[_0x74fc('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x74fc('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x74fc('0x3')]},'type':{'type':Sequelize[_0x74fc('0x4')](_0x74fc('0x5'))},'accountSid':{'type':Sequelize[_0x74fc('0x3')]},'authToken':{'type':Sequelize[_0x74fc('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x74fc('0x6');}},'notificationSound':{'type':Sequelize[_0x74fc('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x74fc('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x74fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x74fc('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x74fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x74fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x74fc('0x8')],'comment':_0x74fc('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x74fc('0x7')],'defaultValue':![],'comment':_0x74fc('0xa'),'set':function(_0x1b3b1b){if(!_0x1b3b1b){this['setDataValue'](_0x74fc('0xb'),null);}this['setDataValue'](_0x74fc('0xc'),_0x1b3b1b);}},'description':{'type':Sequelize[_0x74fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 2355fce..8e6f8ab 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9107=['getApplications','notify','whatsapp','Applications','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','WhatsappMessage','ContactId','UserId','User','unshift','agent','*,*,*,*','startRouting','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','to\x20is\x20mandatory','List','DESC','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','status','end','count','offset','set','reject','update','destroy','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','options','find','create','body','get','role','user','WhatsappAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority'];(function(_0x5d2bf1,_0x571c9e){var _0x434e59=function(_0x17b4c3){while(--_0x17b4c3){_0x5d2bf1['push'](_0x5d2bf1['shift']());}};_0x434e59(++_0x571c9e);}(_0x9107,0x199));var _0x7910=function(_0x40f9e8,_0x1bff85){_0x40f9e8=_0x40f9e8-0x0;var _0x559f7e=_0x9107[_0x40f9e8];return _0x559f7e;};'use strict';var pdf=require(_0x7910('0x0'));var emlformat=require(_0x7910('0x1'));var rimraf=require(_0x7910('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7910('0x3'));var rp=require(_0x7910('0x4'));var moment=require('moment');var BPromise=require(_0x7910('0x5'));var Mustache=require(_0x7910('0x6'));var util=require(_0x7910('0x7'));var path=require(_0x7910('0x8'));var sox=require(_0x7910('0x9'));var csv=require(_0x7910('0xa'));var ejs=require(_0x7910('0xb'));var fs=require('fs');var _=require(_0x7910('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7910('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7910('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7910('0xf'));var as=require(_0x7910('0x10'));var hardwareService=require(_0x7910('0x11'));var logger=require('../../config/logger')(_0x7910('0x12'));var utils=require('../../config/utils');var config=require(_0x7910('0x13'));var licenseUtil=require(_0x7910('0x14'));var db=require(_0x7910('0x15'))['db'];config['redis']=_[_0x7910('0x16')](config['redis'],{'host':_0x7910('0x17'),'port':0x18eb});var socket=require(_0x7910('0x18'))(new Redis(config[_0x7910('0x19')]));require(_0x7910('0x1a'))[_0x7910('0x1b')](socket);var jayson=require(_0x7910('0x1c'));var client=jayson[_0x7910('0x1d')][_0x7910('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x385ba3,_0x33bc93,_0x2cebb1,_0x65c2d8){return new BPromise(function(_0x4abc6b,_0x1f669a){var _0xe21a4b=_0x65c2d8||client;return _0xe21a4b[_0x7910('0x1f')](_0x385ba3,_0x2cebb1)[_0x7910('0x20')](function(_0x5e2c18){logger[_0x7910('0x21')](_0x7910('0x22'),_0x33bc93,_0x7910('0x23'));logger[_0x7910('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x33bc93,_0x7910('0x23'),JSON[_0x7910('0x25')](_0x5e2c18));if(_0x5e2c18[_0x7910('0x26')]){if(_0x5e2c18[_0x7910('0x26')]['code']===0x1f4){logger[_0x7910('0x26')](_0x7910('0x22'),_0x33bc93,_0x5e2c18[_0x7910('0x26')][_0x7910('0x27')]);return _0x1f669a(_0x5e2c18['error'][_0x7910('0x27')]);}logger[_0x7910('0x26')](_0x7910('0x22'),_0x33bc93,_0x5e2c18['error'][_0x7910('0x27')]);return _0x4abc6b(_0x5e2c18[_0x7910('0x26')][_0x7910('0x27')]);}else{logger[_0x7910('0x21')](_0x7910('0x22'),_0x33bc93,_0x7910('0x23'));_0x4abc6b(_0x5e2c18['result'][_0x7910('0x27')]);}})['catch'](function(_0x66d607){logger[_0x7910('0x26')](_0x7910('0x22'),_0x33bc93,_0x66d607);_0x1f669a(_0x66d607);});});}function respondWithStatusCode(_0x315001,_0x2dddea){_0x2dddea=_0x2dddea||0xcc;return function(_0x86c170){if(_0x86c170){return _0x315001['sendStatus'](_0x2dddea);}return _0x315001[_0x7910('0x28')](_0x2dddea)[_0x7910('0x29')]();};}function respondWithResult(_0x59493d,_0x258607){_0x258607=_0x258607||0xc8;return function(_0x541cea){if(_0x541cea){return _0x59493d[_0x7910('0x28')](_0x258607)['json'](_0x541cea);}};}function respondWithFilteredResult(_0x48eabc,_0x3a023a){return function(_0x555c77){if(_0x555c77){var _0x577d74=_0x555c77[_0x7910('0x2a')],_0x5163bb=_0x3a023a['offset'],_0x1356c1=_0x3a023a[_0x7910('0x2b')]+_0x3a023a['limit'],_0x1cfacd;if(_0x1356c1>=_0x577d74){_0x1356c1=_0x577d74;_0x1cfacd=0xc8;}else{_0x1cfacd=0xce;}_0x48eabc[_0x7910('0x28')](_0x1cfacd);return _0x48eabc[_0x7910('0x2c')]('Content-Range',_0x5163bb+'-'+_0x1356c1+'/'+_0x577d74)['json'](_0x555c77);}return null;};}function patchUpdates(_0x2e9b30){return function(_0x1c25d8){try{jsonpatch['apply'](_0x1c25d8,_0x2e9b30,!![]);}catch(_0x3657a1){return BPromise[_0x7910('0x2d')](_0x3657a1);}return _0x1c25d8['save']();};}function saveUpdates(_0x28a7ab,_0x1745de){return function(_0x32bdb3){if(_0x32bdb3){return _0x32bdb3[_0x7910('0x2e')](_0x28a7ab)[_0x7910('0x20')](function(_0x2b686d){return _0x2b686d;});}return null;};}function removeEntity(_0x3cdf2c,_0x456095){return function(_0x523b76){if(_0x523b76){return _0x523b76[_0x7910('0x2f')]()['then'](function(){var _0x37d196=_0x523b76['get']({'plain':!![]});var _0x2a50a5='WhatsappAccounts';return db[_0x7910('0x30')][_0x7910('0x2f')]({'where':{'type':_0x2a50a5,'resourceId':_0x37d196['id']}})[_0x7910('0x20')](function(){return _0x523b76;});})[_0x7910('0x20')](function(){_0x3cdf2c[_0x7910('0x28')](0xcc)[_0x7910('0x29')]();});}};}function handleEntityNotFound(_0x333290,_0x24084a){return function(_0x563582){if(!_0x563582){_0x333290['sendStatus'](0x194);}return _0x563582;};}function handleError(_0x5be418,_0x206221){_0x206221=_0x206221||0x1f4;return function(_0x277216){logger['error'](_0x277216[_0x7910('0x31')]);if(_0x277216[_0x7910('0x32')]){delete _0x277216[_0x7910('0x32')];}_0x5be418['status'](_0x206221)[_0x7910('0x33')](_0x277216);};}exports['index']=function(_0x2fc126,_0x16c674){var _0x390bca={'include':[{'model':db[_0x7910('0x34')],'as':_0x7910('0x35')}]},_0x48297f={},_0x434ce8={'count':0x0,'rows':[]};var _0x470a31=_[_0x7910('0x36')](db[_0x7910('0x37')][_0x7910('0x38')],function(_0xc0099c){return{'name':_0xc0099c['fieldName'],'type':_0xc0099c[_0x7910('0x39')][_0x7910('0x3a')]};});_0x48297f[_0x7910('0x3b')]=_['map'](_0x470a31,_0x7910('0x32'));_0x48297f[_0x7910('0x3c')]=_[_0x7910('0x3d')](_0x2fc126[_0x7910('0x3c')]);_0x48297f[_0x7910('0x3e')]=_[_0x7910('0x3f')](_0x48297f[_0x7910('0x3b')],_0x48297f[_0x7910('0x3c')]);_0x390bca[_0x7910('0x40')]=_['intersection'](_0x48297f[_0x7910('0x3b')],qs[_0x7910('0x41')](_0x2fc126[_0x7910('0x3c')][_0x7910('0x41')]));_0x390bca[_0x7910('0x40')]=_0x390bca['attributes'][_0x7910('0x42')]?_0x390bca[_0x7910('0x40')]:_0x48297f[_0x7910('0x3b')];if(!_0x2fc126[_0x7910('0x3c')][_0x7910('0x43')](_0x7910('0x44'))){_0x390bca[_0x7910('0x45')]=qs[_0x7910('0x45')](_0x2fc126[_0x7910('0x3c')][_0x7910('0x45')]);_0x390bca[_0x7910('0x2b')]=qs[_0x7910('0x2b')](_0x2fc126[_0x7910('0x3c')][_0x7910('0x2b')]);}_0x390bca[_0x7910('0x46')]=qs[_0x7910('0x47')](_0x2fc126[_0x7910('0x3c')][_0x7910('0x47')]);_0x390bca[_0x7910('0x48')]=qs[_0x7910('0x3e')](_[_0x7910('0x49')](_0x2fc126['query'],_0x48297f[_0x7910('0x3e')]),_0x470a31);if(_0x2fc126[_0x7910('0x3c')]['filter']){_0x390bca['where']=_[_0x7910('0x4a')](_0x390bca['where'],{'$or':_['map'](_0x470a31,function(_0x45bcba){if(_0x45bcba[_0x7910('0x39')]!==_0x7910('0x4b')){var _0x1f2914={};_0x1f2914[_0x45bcba[_0x7910('0x32')]]={'$like':'%'+_0x2fc126['query'][_0x7910('0x4c')]+'%'};return _0x1f2914;}})});}_0x390bca=_[_0x7910('0x4a')]({},_0x390bca,_0x2fc126['options']);var _0x59ca3b={'where':_0x390bca[_0x7910('0x48')]};return db[_0x7910('0x37')][_0x7910('0x2a')](_0x59ca3b)[_0x7910('0x20')](function(_0x5f462f){_0x434ce8[_0x7910('0x2a')]=_0x5f462f;if(_0x2fc126[_0x7910('0x3c')][_0x7910('0x4d')]){_0x390bca[_0x7910('0x4e')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x7910('0x4f')](_0x390bca);})[_0x7910('0x20')](function(_0x5d858b){_0x434ce8[_0x7910('0x50')]=_0x5d858b;return _0x434ce8;})[_0x7910('0x20')](respondWithFilteredResult(_0x16c674,_0x390bca))[_0x7910('0x51')](handleError(_0x16c674,null));};exports['show']=function(_0x4fa0b3,_0x11207f){var _0x537a53={'raw':![],'where':{'id':_0x4fa0b3['params']['id']},'include':[{'model':db[_0x7910('0x34')],'as':'mandatoryDispositionPause'}]},_0x59faf3={};_0x59faf3[_0x7910('0x3b')]=_[_0x7910('0x3d')](db['WhatsappAccount'][_0x7910('0x38')]);_0x59faf3[_0x7910('0x3c')]=_[_0x7910('0x3d')](_0x4fa0b3[_0x7910('0x3c')]);_0x59faf3[_0x7910('0x3e')]=_[_0x7910('0x3f')](_0x59faf3['model'],_0x59faf3['query']);_0x537a53[_0x7910('0x40')]=_[_0x7910('0x3f')](_0x59faf3[_0x7910('0x3b')],qs[_0x7910('0x41')](_0x4fa0b3['query'][_0x7910('0x41')]));_0x537a53[_0x7910('0x40')]=_0x537a53[_0x7910('0x40')][_0x7910('0x42')]?_0x537a53['attributes']:_0x59faf3[_0x7910('0x3b')];if(_0x4fa0b3[_0x7910('0x3c')][_0x7910('0x4d')]){_0x537a53[_0x7910('0x4e')]=[{'all':!![]}];}_0x537a53=_[_0x7910('0x4a')]({},_0x537a53,_0x4fa0b3[_0x7910('0x52')]);return db[_0x7910('0x37')][_0x7910('0x53')](_0x537a53)[_0x7910('0x20')](handleEntityNotFound(_0x11207f,null))[_0x7910('0x20')](respondWithResult(_0x11207f,null))['catch'](handleError(_0x11207f,null));};exports[_0x7910('0x54')]=function(_0x4dbd2c,_0x3f0dd7){return db['WhatsappAccount'][_0x7910('0x54')](_0x4dbd2c[_0x7910('0x55')],{})[_0x7910('0x20')](function(_0x410039){var _0x1ab0b1=_0x4dbd2c['user'][_0x7910('0x56')]({'plain':!![]});if(!_0x1ab0b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ab0b1[_0x7910('0x57')]===_0x7910('0x58')){var _0x196265=_0x410039[_0x7910('0x56')]({'plain':!![]});var _0x5315af=_0x7910('0x59');return db[_0x7910('0x5a')][_0x7910('0x53')]({'where':{'name':_0x5315af,'userProfileId':_0x1ab0b1[_0x7910('0x5b')]},'raw':!![]})['then'](function(_0x1e2d4d){if(_0x1e2d4d&&_0x1e2d4d['autoAssociation']===0x0){return db['UserProfileResource'][_0x7910('0x54')]({'name':_0x196265[_0x7910('0x32')],'resourceId':_0x196265['id'],'type':_0x1e2d4d['name'],'sectionId':_0x1e2d4d['id']},{})[_0x7910('0x20')](function(){return _0x410039;});}else{return _0x410039;}})[_0x7910('0x51')](function(_0x1ffb62){logger[_0x7910('0x26')](_0x7910('0x5c'),_0x1ffb62);throw _0x1ffb62;});}return _0x410039;})['then'](respondWithResult(_0x3f0dd7,0xc9))[_0x7910('0x51')](handleError(_0x3f0dd7,null));};exports[_0x7910('0x2e')]=function(_0x499509,_0x1a06d0){if(_0x499509[_0x7910('0x55')]['id']){delete _0x499509[_0x7910('0x55')]['id'];}return db[_0x7910('0x37')][_0x7910('0x53')]({'where':{'id':_0x499509[_0x7910('0x5d')]['id']},'include':[{'model':db[_0x7910('0x34')],'as':_0x7910('0x35')}]})[_0x7910('0x20')](handleEntityNotFound(_0x1a06d0,null))[_0x7910('0x20')](saveUpdates(_0x499509['body'],null))[_0x7910('0x20')](respondWithResult(_0x1a06d0,null))[_0x7910('0x51')](handleError(_0x1a06d0,null));};exports[_0x7910('0x2f')]=function(_0x4f7a67,_0x586ee5){return db[_0x7910('0x37')][_0x7910('0x53')]({'where':{'id':_0x4f7a67[_0x7910('0x5d')]['id']}})[_0x7910('0x20')](handleEntityNotFound(_0x586ee5,null))[_0x7910('0x20')](removeEntity(_0x586ee5,null))[_0x7910('0x51')](handleError(_0x586ee5,null));};exports['describe']=function(_0x53ad20,_0x58ca7b){return db['WhatsappAccount'][_0x7910('0x5e')]()[_0x7910('0x20')](respondWithResult(_0x58ca7b,null))[_0x7910('0x51')](handleError(_0x58ca7b,null));};exports['addDisposition']=function(_0x145fbb,_0x24d71b,_0x2f7bdf){if(_0x145fbb[_0x7910('0x55')]['id']){delete _0x145fbb[_0x7910('0x55')]['id'];}return db[_0x7910('0x37')][_0x7910('0x53')]({'where':{'id':_0x145fbb[_0x7910('0x5d')]['id']}})[_0x7910('0x20')](handleEntityNotFound(_0x24d71b,null))['then'](function(_0x48b8ad){if(_0x48b8ad){_0x145fbb[_0x7910('0x55')][_0x7910('0x5f')]=_0x48b8ad['id'];return db[_0x7910('0x60')][_0x7910('0x54')](_0x145fbb[_0x7910('0x55')]);}})[_0x7910('0x20')](respondWithResult(_0x24d71b,null))['catch'](handleError(_0x24d71b,null));};exports[_0x7910('0x61')]=function(_0x46d332,_0x56ee01,_0x2b6341){var _0x2702a5={'raw':![],'where':{}};var _0x15fb07={};var _0x42e2e9={'count':0x0,'rows':[]};return db[_0x7910('0x37')][_0x7910('0x62')]({'where':{'id':_0x46d332[_0x7910('0x5d')]['id']}})[_0x7910('0x20')](handleEntityNotFound(_0x56ee01,null))[_0x7910('0x20')](function(_0x274aaf){if(_0x274aaf){_0x15fb07['model']=_[_0x7910('0x3d')](db[_0x7910('0x60')][_0x7910('0x38')]);_0x15fb07['query']=_[_0x7910('0x3d')](_0x46d332[_0x7910('0x3c')]);_0x15fb07[_0x7910('0x3e')]=_[_0x7910('0x3f')](_0x15fb07[_0x7910('0x3b')],_0x15fb07[_0x7910('0x3c')]);_0x2702a5[_0x7910('0x40')]=_[_0x7910('0x3f')](_0x15fb07[_0x7910('0x3b')],qs[_0x7910('0x41')](_0x46d332[_0x7910('0x3c')][_0x7910('0x41')]));_0x2702a5[_0x7910('0x40')]=_0x2702a5[_0x7910('0x40')][_0x7910('0x42')]?_0x2702a5[_0x7910('0x40')]:_0x15fb07[_0x7910('0x3b')];if(!_0x46d332[_0x7910('0x3c')][_0x7910('0x43')]('nolimit')){_0x2702a5[_0x7910('0x45')]=qs['limit'](_0x46d332[_0x7910('0x3c')][_0x7910('0x45')]);_0x2702a5['offset']=qs[_0x7910('0x2b')](_0x46d332[_0x7910('0x3c')][_0x7910('0x2b')]);}_0x2702a5[_0x7910('0x46')]=qs['sort'](_0x46d332[_0x7910('0x3c')]['sort']);_0x2702a5['where']=qs[_0x7910('0x3e')](_[_0x7910('0x49')](_0x46d332[_0x7910('0x3c')],_0x15fb07['filters']));_0x2702a5[_0x7910('0x48')][_0x7910('0x5f')]=_0x274aaf['id'];if(_0x46d332[_0x7910('0x3c')][_0x7910('0x4c')]){_0x2702a5[_0x7910('0x48')]=_[_0x7910('0x4a')](_0x2702a5[_0x7910('0x48')],{'$or':_[_0x7910('0x36')](_0x2702a5[_0x7910('0x40')],function(_0xfa1872){var _0x4d3852={};_0x4d3852[_0xfa1872]={'$like':'%'+_0x46d332['query'][_0x7910('0x4c')]+'%'};return _0x4d3852;})});}_0x2702a5=_[_0x7910('0x4a')]({},_0x2702a5,_0x46d332[_0x7910('0x52')]);return db[_0x7910('0x60')][_0x7910('0x2a')]({'where':_0x2702a5[_0x7910('0x48')]})[_0x7910('0x20')](function(_0xd3fcd4){_0x42e2e9[_0x7910('0x2a')]=_0xd3fcd4;if(_0x46d332['query'][_0x7910('0x4d')]){_0x2702a5[_0x7910('0x4e')]=[{'all':!![]}];}return db[_0x7910('0x60')]['findAll'](_0x2702a5);})[_0x7910('0x20')](function(_0x3b1248){_0x42e2e9[_0x7910('0x50')]=_0x3b1248;return _0x42e2e9;});}})[_0x7910('0x20')](respondWithFilteredResult(_0x56ee01,_0x2702a5))[_0x7910('0x51')](handleError(_0x56ee01,null));};exports['removeDispositions']=function(_0x1e99f8,_0x5cebfa,_0xbf126b){return db['WhatsappAccount']['find']({'where':{'id':_0x1e99f8[_0x7910('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5cebfa,null))[_0x7910('0x20')](function(_0x342f31){if(_0x342f31){return _0x342f31[_0x7910('0x63')](_0x1e99f8[_0x7910('0x3c')][_0x7910('0x64')]);}})[_0x7910('0x20')](respondWithStatusCode(_0x5cebfa,null))[_0x7910('0x51')](handleError(_0x5cebfa,null));};exports[_0x7910('0x65')]=function(_0x1c1c10,_0xa028fe,_0x1e8871){if(_0x1c1c10[_0x7910('0x55')]['id']){delete _0x1c1c10[_0x7910('0x55')]['id'];}return db[_0x7910('0x37')][_0x7910('0x53')]({'where':{'id':_0x1c1c10[_0x7910('0x5d')]['id']}})[_0x7910('0x20')](handleEntityNotFound(_0xa028fe,null))[_0x7910('0x20')](function(_0x3370c9){if(_0x3370c9){_0x1c1c10[_0x7910('0x55')]['WhatsappAccountId']=_0x3370c9['id'];return db[_0x7910('0x66')][_0x7910('0x54')](_0x1c1c10[_0x7910('0x55')]);}})[_0x7910('0x20')](respondWithResult(_0xa028fe,null))[_0x7910('0x51')](handleError(_0xa028fe,null));};exports[_0x7910('0x67')]=function(_0x2e1300,_0x5ceae6,_0x3f98c8){var _0xe424fa={'raw':![],'where':{}};var _0x198a99={};var _0x2febb9={'count':0x0,'rows':[]};return db[_0x7910('0x37')][_0x7910('0x62')]({'where':{'id':_0x2e1300[_0x7910('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5ceae6,null))[_0x7910('0x20')](function(_0x1dc823){if(_0x1dc823){_0x198a99[_0x7910('0x3b')]=_[_0x7910('0x3d')](db[_0x7910('0x66')][_0x7910('0x38')]);_0x198a99[_0x7910('0x3c')]=_[_0x7910('0x3d')](_0x2e1300[_0x7910('0x3c')]);_0x198a99['filters']=_[_0x7910('0x3f')](_0x198a99[_0x7910('0x3b')],_0x198a99['query']);_0xe424fa['attributes']=_['intersection'](_0x198a99[_0x7910('0x3b')],qs[_0x7910('0x41')](_0x2e1300[_0x7910('0x3c')][_0x7910('0x41')]));_0xe424fa[_0x7910('0x40')]=_0xe424fa[_0x7910('0x40')]['length']?_0xe424fa[_0x7910('0x40')]:_0x198a99[_0x7910('0x3b')];if(!_0x2e1300[_0x7910('0x3c')][_0x7910('0x43')](_0x7910('0x44'))){_0xe424fa[_0x7910('0x45')]=qs[_0x7910('0x45')](_0x2e1300['query'][_0x7910('0x45')]);_0xe424fa[_0x7910('0x2b')]=qs[_0x7910('0x2b')](_0x2e1300[_0x7910('0x3c')][_0x7910('0x2b')]);}_0xe424fa[_0x7910('0x46')]=qs[_0x7910('0x47')](_0x2e1300[_0x7910('0x3c')][_0x7910('0x47')]);_0xe424fa[_0x7910('0x48')]=qs[_0x7910('0x3e')](_[_0x7910('0x49')](_0x2e1300[_0x7910('0x3c')],_0x198a99[_0x7910('0x3e')]));_0xe424fa[_0x7910('0x48')][_0x7910('0x5f')]=_0x1dc823['id'];if(_0x2e1300[_0x7910('0x3c')][_0x7910('0x4c')]){_0xe424fa[_0x7910('0x48')]=_[_0x7910('0x4a')](_0xe424fa[_0x7910('0x48')],{'$or':_[_0x7910('0x36')](_0xe424fa[_0x7910('0x40')],function(_0x5228b5){var _0x126601={};_0x126601[_0x5228b5]={'$like':'%'+_0x2e1300[_0x7910('0x3c')]['filter']+'%'};return _0x126601;})});}_0xe424fa=_[_0x7910('0x4a')]({},_0xe424fa,_0x2e1300['options']);return db[_0x7910('0x66')][_0x7910('0x2a')]({'where':_0xe424fa[_0x7910('0x48')]})[_0x7910('0x20')](function(_0x13ce0e){_0x2febb9[_0x7910('0x2a')]=_0x13ce0e;if(_0x2e1300['query'][_0x7910('0x4d')]){_0xe424fa[_0x7910('0x4e')]=[{'all':!![]}];}return db[_0x7910('0x66')][_0x7910('0x4f')](_0xe424fa);})[_0x7910('0x20')](function(_0x5cdf5d){_0x2febb9[_0x7910('0x50')]=_0x5cdf5d;return _0x2febb9;});}})[_0x7910('0x20')](respondWithFilteredResult(_0x5ceae6,_0xe424fa))[_0x7910('0x51')](handleError(_0x5ceae6,null));};exports['removeAnswers']=function(_0x53c0e5,_0x2839a8,_0x5d6639){return db[_0x7910('0x37')][_0x7910('0x53')]({'where':{'id':_0x53c0e5['params']['id']}})[_0x7910('0x20')](handleEntityNotFound(_0x2839a8,null))[_0x7910('0x20')](function(_0x65d2b4){if(_0x65d2b4){return _0x65d2b4['removeAnswers'](_0x53c0e5[_0x7910('0x3c')][_0x7910('0x64')]);}})['then'](respondWithStatusCode(_0x2839a8,null))[_0x7910('0x51')](handleError(_0x2839a8,null));};exports[_0x7910('0x68')]=function(_0x9bbbea,_0x5ce90e,_0x24b33c){return db['WhatsappAccount']['find']({'where':{'id':_0x9bbbea['params']['id']}})[_0x7910('0x20')](handleEntityNotFound(_0x5ce90e,null))[_0x7910('0x20')](function(_0x39c861){if(_0x39c861){return _0x39c861[_0x7910('0x68')](_0x9bbbea[_0x7910('0x55')]['ids'],_[_0x7910('0x69')](_0x9bbbea[_0x7910('0x55')],[_0x7910('0x64'),'id'])||{})[_0x7910('0x6a')](function(_0x40c9d7){for(var _0x3e9a69=0x0;_0x3e9a69<_0x9bbbea[_0x7910('0x55')]['ids'][_0x7910('0x42')];_0x3e9a69+=0x1){socket[_0x7910('0x6b')](_0x7910('0x6c'),{'UserId':_0x9bbbea['body'][_0x7910('0x64')][_0x3e9a69],'WhatsappAccountId':_0x9bbbea[_0x7910('0x5d')]['id']});}return _0x40c9d7;});}})[_0x7910('0x20')](respondWithResult(_0x5ce90e,null))[_0x7910('0x51')](handleError(_0x5ce90e,null));};exports[_0x7910('0x6d')]=function(_0x11f03b,_0x2176f,_0x1f2e17){return db[_0x7910('0x37')][_0x7910('0x53')]({'where':{'id':_0x11f03b[_0x7910('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2176f,null))[_0x7910('0x20')](function(_0x518809){if(_0x518809){return _0x518809['removeAgents'](_0x11f03b[_0x7910('0x3c')][_0x7910('0x64')])['then'](function(){if(_[_0x7910('0x6e')](_0x11f03b[_0x7910('0x3c')]['ids'])){for(var _0x2ab006=0x0;_0x2ab006<_0x11f03b['query'][_0x7910('0x64')][_0x7910('0x42')];_0x2ab006+=0x1){socket[_0x7910('0x6b')](_0x7910('0x6f'),{'UserId':Number(_0x11f03b[_0x7910('0x3c')][_0x7910('0x64')][_0x2ab006]),'WhatsappAccountId':Number(_0x11f03b[_0x7910('0x5d')]['id'])});}}else{socket[_0x7910('0x6b')](_0x7910('0x6f'),{'UserId':Number(_0x11f03b[_0x7910('0x3c')][_0x7910('0x64')]),'WhatsappAccountId':Number(_0x11f03b[_0x7910('0x5d')]['id'])});}});}})[_0x7910('0x20')](respondWithStatusCode(_0x2176f,null))[_0x7910('0x51')](handleError(_0x2176f,null));};exports[_0x7910('0x70')]=function(_0x237368,_0xa8e45d,_0x279c2d){var _0x30db76={};var _0x436281={};var _0x502c08;var _0xbec5eb;return db['WhatsappAccount'][_0x7910('0x62')]({'where':{'id':_0x237368[_0x7910('0x5d')]['id']}})[_0x7910('0x20')](handleEntityNotFound(_0xa8e45d,null))[_0x7910('0x20')](function(_0x2b9fd6){if(_0x2b9fd6){_0x502c08=_0x2b9fd6;_0x436281[_0x7910('0x3b')]=_['keys'](db['User']['rawAttributes']);_0x436281[_0x7910('0x3c')]=_['keys'](_0x237368[_0x7910('0x3c')]);_0x436281[_0x7910('0x3e')]=_[_0x7910('0x3f')](_0x436281[_0x7910('0x3b')],_0x436281['query']);_0x30db76['attributes']=_[_0x7910('0x3f')](_0x436281['model'],qs['fields'](_0x237368[_0x7910('0x3c')][_0x7910('0x41')]));_0x30db76[_0x7910('0x40')]=_0x30db76[_0x7910('0x40')][_0x7910('0x42')]?_0x30db76[_0x7910('0x40')]:_0x436281[_0x7910('0x3b')];_0x30db76[_0x7910('0x46')]=qs['sort'](_0x237368[_0x7910('0x3c')][_0x7910('0x47')]);_0x30db76[_0x7910('0x48')]=qs[_0x7910('0x3e')](_[_0x7910('0x49')](_0x237368[_0x7910('0x3c')],_0x436281[_0x7910('0x3e')]));if(_0x237368[_0x7910('0x3c')][_0x7910('0x4c')]){_0x30db76[_0x7910('0x48')]=_[_0x7910('0x4a')](_0x30db76[_0x7910('0x48')],{'$or':_[_0x7910('0x36')](_0x30db76[_0x7910('0x40')],function(_0x567f57){var _0x4190f6={};_0x4190f6[_0x567f57]={'$like':'%'+_0x237368['query']['filter']+'%'};return _0x4190f6;})});}_0x30db76=_['merge']({},_0x30db76,_0x237368[_0x7910('0x52')]);return _0x502c08[_0x7910('0x70')](_0x30db76);}})['then'](function(_0x269062){if(_0x269062){_0xbec5eb=_0x269062['length'];if(!_0x237368[_0x7910('0x3c')]['hasOwnProperty'](_0x7910('0x44'))){_0x30db76[_0x7910('0x45')]=qs[_0x7910('0x45')](_0x237368['query'][_0x7910('0x45')]);_0x30db76['offset']=qs[_0x7910('0x2b')](_0x237368['query'][_0x7910('0x2b')]);}return _0x502c08[_0x7910('0x70')](_0x30db76);}})[_0x7910('0x20')](function(_0x3992c7){if(_0x3992c7){return _0x3992c7?{'count':_0xbec5eb,'rows':_0x3992c7}:null;}})['then'](respondWithResult(_0xa8e45d,null))[_0x7910('0x51')](handleError(_0xa8e45d,null));};exports[_0x7910('0x71')]=function(_0x2cccff,_0x41d83f,_0x5e7b27){return db[_0x7910('0x37')][_0x7910('0x62')]({'where':{'id':_0x2cccff[_0x7910('0x5d')]['id']}})[_0x7910('0x20')](handleEntityNotFound(_0x41d83f,null))['then'](function(_0x376cde){if(_0x376cde){return db[_0x7910('0x72')][_0x7910('0x73')](function(_0x37fe86){return db[_0x7910('0x74')][_0x7910('0x2f')]({'where':{'WhatsappAccountId':_0x2cccff[_0x7910('0x5d')]['id']},'transaction':_0x37fe86})[_0x7910('0x20')](function(_0x1cb14b){var _0x4b2125=_[_0x7910('0x36')](_0x2cccff[_0x7910('0x55')],function(_0x564cd7){_0x564cd7[_0x7910('0x5f')]=_0x2cccff[_0x7910('0x5d')]['id'];return _0x564cd7;});return db[_0x7910('0x74')][_0x7910('0x75')](_0x4b2125,{'transaction':_0x37fe86});});})[_0x7910('0x20')](function(){return db[_0x7910('0x74')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2cccff['params']['id']},'order':_0x7910('0x76')});});}})[_0x7910('0x20')](respondWithResult(_0x41d83f,null))['catch'](handleError(_0x41d83f,null));};exports[_0x7910('0x77')]=function(_0x4afc9d,_0x3f9400,_0x4ad36a){var _0x2bdc62={};var _0x3e9c88={};var _0x49493c;var _0x2b0d45;return db['WhatsappAccount'][_0x7910('0x62')]({'where':{'id':_0x4afc9d[_0x7910('0x5d')]['id']}})[_0x7910('0x20')](handleEntityNotFound(_0x3f9400,null))['then'](function(_0x50f713){if(_0x50f713){_0x49493c=_0x50f713;_0x3e9c88[_0x7910('0x3b')]=_[_0x7910('0x3d')](db[_0x7910('0x74')][_0x7910('0x38')]);_0x3e9c88[_0x7910('0x3c')]=_[_0x7910('0x3d')](_0x4afc9d[_0x7910('0x3c')]);_0x3e9c88[_0x7910('0x3e')]=_[_0x7910('0x3f')](_0x3e9c88['model'],_0x3e9c88[_0x7910('0x3c')]);_0x2bdc62['attributes']=_[_0x7910('0x3f')](_0x3e9c88[_0x7910('0x3b')],qs[_0x7910('0x41')](_0x4afc9d[_0x7910('0x3c')][_0x7910('0x41')]));_0x2bdc62[_0x7910('0x40')]=_0x2bdc62[_0x7910('0x40')][_0x7910('0x42')]?_0x2bdc62[_0x7910('0x40')]:_0x3e9c88['model'];_0x2bdc62[_0x7910('0x46')]=qs[_0x7910('0x47')](_0x4afc9d[_0x7910('0x3c')][_0x7910('0x47')]);_0x2bdc62[_0x7910('0x48')]=qs[_0x7910('0x3e')](_[_0x7910('0x49')](_0x4afc9d[_0x7910('0x3c')],_0x3e9c88['filters']));if(_0x4afc9d['query'][_0x7910('0x4c')]){_0x2bdc62[_0x7910('0x48')]=_[_0x7910('0x4a')](_0x2bdc62[_0x7910('0x48')],{'$or':_[_0x7910('0x36')](_0x2bdc62[_0x7910('0x40')],function(_0x4b235e){var _0x46e35d={};_0x46e35d[_0x4b235e]={'$like':'%'+_0x4afc9d[_0x7910('0x3c')][_0x7910('0x4c')]+'%'};return _0x46e35d;})});}_0x2bdc62=_['merge']({},_0x2bdc62,_0x4afc9d[_0x7910('0x52')]);return _0x49493c[_0x7910('0x77')](_0x2bdc62);}})[_0x7910('0x20')](function(_0x37284){if(_0x37284){_0x2b0d45=_0x37284[_0x7910('0x42')];if(!_0x4afc9d[_0x7910('0x3c')][_0x7910('0x43')]('nolimit')){_0x2bdc62['limit']=qs[_0x7910('0x45')](_0x4afc9d[_0x7910('0x3c')][_0x7910('0x45')]);_0x2bdc62[_0x7910('0x2b')]=qs[_0x7910('0x2b')](_0x4afc9d['query'][_0x7910('0x2b')]);}return _0x49493c[_0x7910('0x77')](_0x2bdc62);}})[_0x7910('0x20')](function(_0x4b6939){if(_0x4b6939){return _0x4b6939?{'count':_0x2b0d45,'rows':_0x4b6939}:null;}})[_0x7910('0x20')](respondWithResult(_0x3f9400,null))[_0x7910('0x51')](handleError(_0x3f9400,null));};exports[_0x7910('0x78')]=function(_0x21d9a5,_0x1c1420,_0x37a2ff){var _0x21bd21={'channel':_0x7910('0x79')};var _0x163945=[];var _0x5292b4=[];var _0x3b8018={};return db[_0x7910('0x37')][_0x7910('0x53')]({'where':{'id':_0x21d9a5[_0x7910('0x5d')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x7910('0x7a')}]})[_0x7910('0x20')](handleEntityNotFound(_0x1c1420,null))['then'](function(_0x316313){_0x21bd21[_0x7910('0x7b')]=_0x316313;_0x21bd21['applications']=_['orderBy'](_0x316313[_0x7910('0x7a')],[_0x7910('0x76')],['asc']);if(_0x21bd21['account'][_0x7910('0x7a')]){delete _0x21bd21[_0x7910('0x7b')][_0x7910('0x7a')];}return db[_0x7910('0x7c')][_0x7910('0x5e')]();})['then'](function(_0x2273e2){if(!_0x2273e2){throw new db['Sequelize'][(_0x7910('0x7d'))](_0x7910('0x7e'));}_0x163945=_[_0x7910('0x7f')](_[_0x7910('0x3d')](_0x2273e2),[_0x7910('0x80'),'updatedAt']);_0x5292b4=_['difference'](_[_0x7910('0x3d')](_0x2273e2),[_0x7910('0x80'),_0x7910('0x81'),_0x7910('0x82'),_0x7910('0x83')]);_0x21bd21['body']={'mapKey':'mobile'};if(_0x21bd21[_0x7910('0x7b')]['type']&&_0x21bd21[_0x7910('0x7b')][_0x7910('0x39')]===_0x7910('0x84')){_0x21bd21[_0x7910('0x55')][_0x7910('0x85')]=_0x21d9a5[_0x7910('0x55')][_0x7910('0x86')][_0x7910('0x87')](_0x7910('0x88'),'');_0x21bd21[_0x7910('0x55')]['body']=_0x21d9a5[_0x7910('0x55')][_0x7910('0x89')];_0x21bd21['body'][_0x7910('0x8a')]=_0x21d9a5['body'][_0x7910('0x8b')];}if(_0x21bd21['body']['id']){delete _0x21bd21[_0x7910('0x55')]['id'];}if(_[_0x7910('0x8c')](_0x21bd21[_0x7910('0x55')]['from'])){throw new db[(_0x7910('0x8d'))][(_0x7910('0x7d'))](_0x7910('0x8e'));}if(_[_0x7910('0x8c')](_0x21bd21[_0x7910('0x55')]['body'])||_0x21bd21[_0x7910('0x55')][_0x7910('0x55')]===''){throw new db[(_0x7910('0x8d'))][(_0x7910('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7910('0x8c')](_0x21bd21[_0x7910('0x55')][_0x7910('0x8f')])){throw new db[(_0x7910('0x8d'))][(_0x7910('0x7d'))](_0x7910('0x90')+_0x5292b4);}if(!_[_0x7910('0x91')](_0x5292b4,_0x21bd21[_0x7910('0x55')]['mapKey'])){throw new db[(_0x7910('0x8d'))][(_0x7910('0x7d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5292b4);}_0x3b8018[_0x21bd21[_0x7910('0x55')][_0x7910('0x8f')]]=_0x21bd21[_0x7910('0x55')][_0x7910('0x85')];return db[_0x7910('0x92')][_0x7910('0x53')]({'where':{'id':_0x21bd21[_0x7910('0x7b')]['ListId']},'include':[{'model':db[_0x7910('0x7c')],'as':_0x7910('0x93'),'where':_0x3b8018,'limit':0x1,'order':[[_0x7910('0x81'),'DESC']]}]});})[_0x7910('0x20')](handleEntityNotFound(_0x1c1420,null))[_0x7910('0x20')](function(_0xdfef59){if(_0xdfef59){_0x21bd21[_0x7910('0x94')]=_[_0x7910('0x69')](_0xdfef59,[_0x7910('0x93')]);if(_0xdfef59[_0x7910('0x93')][_0x7910('0x42')]){return _0xdfef59[_0x7910('0x93')][0x0];}var _0x4cb012=_[_0x7910('0x16')](_0x21bd21['body'],{'firstName':_0x21bd21['body'][_0x7910('0x85')],'ListId':_0xdfef59['id']});_0x4cb012[_0x21bd21[_0x7910('0x55')][_0x7910('0x8f')]]=_0x21bd21[_0x7910('0x55')]['from'];return db[_0x7910('0x7c')][_0x7910('0x54')](_0x4cb012,{'fields':_0x163945,'raw':!![]});}})['then'](handleEntityNotFound(_0x1c1420,null))[_0x7910('0x20')](function(_0x386243){if(_0x386243){_0x21bd21[_0x7910('0x95')]=_0x386243;var _0x326c36={'ContactId':_0x386243['id'],'phone':_0x21bd21[_0x7910('0x55')][_0x7910('0x85')],'WhatsappAccountId':_0x21d9a5['params']['id']};var _0x2711ba={'ContactId':_0x386243['id'],'WhatsappAccountId':_0x21d9a5[_0x7910('0x5d')]['id'],'closed':![]};return db[_0x7910('0x96')][_0x7910('0x53')]({'where':_0x2711ba})[_0x7910('0x20')](function(_0x1e1b72){if(_0x1e1b72){return[_0x1e1b72,![]];}return db[_0x7910('0x96')][_0x7910('0x54')](_0x326c36)['then'](function(_0x35d855){return[_0x35d855,!![]];});});}})[_0x7910('0x6a')](function(_0x5bd5a1,_0x324cfd){_0x21bd21[_0x7910('0x97')]=_0x5bd5a1['get']({'plain':!![]});_0x21bd21[_0x7910('0x97')][_0x7910('0x98')]=![];if(_0x324cfd){if(_0x21bd21['account'][_0x7910('0x99')]){_0x21bd21[_0x7910('0x9a')][_0x7910('0x9b')]({'id':0x0,'priority':_0x21bd21[_0x7910('0x9a')][_0x7910('0x42')]+0x1,'app':_0x7910('0x9c'),'appdata':_0x7910('0x9d'),'interval':'*,*,*,*'});}_0x21bd21[_0x7910('0x97')][_0x7910('0x98')]=!![];}return db[_0x7910('0x9e')][_0x7910('0x54')]({'phone':_0x21bd21['body'][_0x7910('0x85')],'messageId':_0x21bd21[_0x7910('0x55')][_0x7910('0x8a')],'body':_0x21bd21[_0x7910('0x55')][_0x7910('0x55')],'WhatsappAccountId':_0x21d9a5[_0x7910('0x5d')]['id'],'WhatsappInteractionId':_0x5bd5a1['id'],'direction':'in','ContactId':_0x5bd5a1[_0x7910('0x9f')],'AttachmentId':_0x21bd21[_0x7910('0x55')]['AttachmentId']});})[_0x7910('0x20')](function(_0xd0ed34){_0x21bd21[_0x7910('0x27')]=_0xd0ed34;if(_0x21bd21['interaction'][_0x7910('0xa0')]){return db[_0x7910('0xa1')][_0x7910('0x53')]({'attributes':['id',_0x7910('0x32')],'where':{'id':_0x21bd21['interaction'][_0x7910('0xa0')]}})['then'](function(_0x2eb4db){if(_0x2eb4db){_0x21bd21[_0x7910('0x9a')][_0x7910('0xa2')]({'id':0x0,'priority':0x0,'app':_0x7910('0xa3'),'appdata':_0x2eb4db[_0x7910('0x32')]+','+(_0x21bd21[_0x7910('0x7b')]['waitForTheAssignedAgent']||0xa),'interval':_0x7910('0xa4')});}return respondWithRpcPromise('Start',_0x7910('0xa5'),_0x21bd21);});}return respondWithRpcPromise(_0x7910('0xa6'),_0x7910('0xa5'),_0x21bd21);})[_0x7910('0x20')](function(_0x204f91){if(_0x204f91){var _0xfdf34b=0xc8;var _0x25d004='receiveMessage';logger['info'](_0x7910('0xa7'),_0x25d004,_0xfdf34b,_0x7910('0xa8'));logger[_0x7910('0x24')](_0x7910('0xa9'),_0x25d004,_0xfdf34b,_0x7910('0xa8'),JSON[_0x7910('0x25')](_0x204f91));if(_0x21bd21[_0x7910('0x7b')][_0x7910('0x39')]===_0x7910('0x84')){return _0x1c1420[_0x7910('0x28')](_0xfdf34b)[_0x7910('0x2c')](_0x7910('0xaa'),'text/xml')['send']('\x0a');}else{return _0x1c1420[_0x7910('0x28')](_0xfdf34b)['json'](_0x204f91);}}})[_0x7910('0x51')](handleError(_0x1c1420,null));};exports['send']=function(_0x2cb0e1,_0x2d934f,_0x22764c){var _0x5e2d9c,_0x4e31b4,_0x19fdbe;if(_[_0x7910('0x8c')](_0x2cb0e1['body'][_0x7910('0x55')])||_0x2cb0e1[_0x7910('0x55')][_0x7910('0x55')]===''){throw new db['Sequelize'][(_0x7910('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7910('0x8c')](_0x2cb0e1['body']['to'])){throw new db[(_0x7910('0x8d'))][(_0x7910('0x7d'))](_0x7910('0xab'));}_0x5e2d9c=_0x2cb0e1[_0x7910('0x55')]['to'];return db[_0x7910('0x37')][_0x7910('0x53')]({'where':{'id':_0x2cb0e1[_0x7910('0x5d')]['id']},'include':[{'model':db[_0x7910('0x92')],'as':_0x7910('0xac'),'include':[{'model':db['CmContact'],'as':_0x7910('0x93'),'where':{'mobile':_0x5e2d9c},'limit':0x1,'order':[[_0x7910('0x81'),_0x7910('0xad')]]}]}]})['then'](handleEntityNotFound(_0x2d934f,null))['then'](function(_0x581c20){if(_0x581c20&&_0x581c20[_0x7910('0xac')]){_0x4e31b4=_0x581c20[_0x7910('0x56')]({'plain':!![]});if(_0x4e31b4[_0x7910('0xac')]&&_0x4e31b4[_0x7910('0xac')][_0x7910('0x93')][_0x7910('0x42')]){return _0x4e31b4[_0x7910('0xac')][_0x7910('0x93')][0x0];}return db[_0x7910('0x7c')][_0x7910('0x54')](_[_0x7910('0x16')](_0x2cb0e1['body'],{'firstName':_0x5e2d9c,'mobile':_0x5e2d9c,'phone':_0x5e2d9c,'ListId':_0x4e31b4[_0x7910('0x83')]}));}})[_0x7910('0x20')](handleEntityNotFound(_0x2d934f,null))[_0x7910('0x20')](function(_0x18b2ac){if(_0x18b2ac){_0x19fdbe=_0x18b2ac;return db['WhatsappInteraction'][_0x7910('0x53')]({'where':{'ContactId':_0x19fdbe['id'],'closed':![],'WhatsappAccountId':_0x4e31b4['id']}})[_0x7910('0x20')](function(_0x18b464){if(_0x18b464){return[_0x18b464,![]];}return db[_0x7910('0x96')][_0x7910('0x54')]({'UserId':_0x2cb0e1['user']['id'],'ContactId':_0x19fdbe['id'],'WhatsappAccountId':_0x4e31b4['id'],'phone':_0x5e2d9c,'firstMsgDirection':'out','Messages':[_['merge'](_0x2cb0e1[_0x7910('0x55')],{'read':![],'body':_0x2cb0e1[_0x7910('0x55')]['body'],'phone':_0x5e2d9c,'WhatsappAccountId':_0x4e31b4['id'],'UserId':_0x2cb0e1['user']['id'],'ContactId':_0x19fdbe['id']})]},{'include':[{'model':db[_0x7910('0x9e')],'as':'Messages'}]})['then'](function(_0x271ecc){return[_0x271ecc,!![]];});});}})[_0x7910('0x6a')](function(_0x59839f,_0x220d57){if(_0x220d57){return _0x59839f;}return db[_0x7910('0x9e')][_0x7910('0x54')](_[_0x7910('0x4a')](_0x2cb0e1[_0x7910('0x55')],{'read':![],'body':_0x2cb0e1[_0x7910('0x55')][_0x7910('0x55')],'phone':_0x5e2d9c,'WhatsappAccountId':_0x4e31b4['id'],'WhatsappInteractionId':_0x59839f['id'],'UserId':_0x2cb0e1[_0x7910('0x58')]['id'],'ContactId':_0x19fdbe['id']}))[_0x7910('0x20')](function(_0x5483a5){_0x59839f['dataValues'][_0x7910('0xae')]=[];_0x59839f[_0x7910('0xaf')][_0x7910('0xae')][_0x7910('0x9b')](_0x5483a5[_0x7910('0xaf')]);return _0x59839f;});})[_0x7910('0x20')](respondWithResult(_0x2d934f,null))['catch'](handleError(_0x2d934f,null));}; \ No newline at end of file +var _0xcb80=['keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','applications','orderBy','Applications','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','*,*,*,*','Start','startRouting','entity\x20found','stringify','\x0a','List','out','Messages','dataValues','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','reject','destroy','get','stack','send','index','Pause','map','WhatsappAccount','fieldName','type','key'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0xcb80,0x1eb));var _0x0cb8=function(_0x50b48d,_0xe766bd){_0x50b48d=_0x50b48d-0x0;var _0x40ebf0=_0xcb80[_0x50b48d];return _0x40ebf0;};'use strict';var pdf=require(_0x0cb8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0cb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cb8('0x2'));var rp=require(_0x0cb8('0x3'));var moment=require(_0x0cb8('0x4'));var BPromise=require(_0x0cb8('0x5'));var Mustache=require(_0x0cb8('0x6'));var util=require(_0x0cb8('0x7'));var path=require(_0x0cb8('0x8'));var sox=require(_0x0cb8('0x9'));var csv=require(_0x0cb8('0xa'));var ejs=require(_0x0cb8('0xb'));var fs=require('fs');var _=require(_0x0cb8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0cb8('0xd'));var deskjs=require(_0x0cb8('0xe'));var toCsv=require(_0x0cb8('0xa'));var querystring=require('querystring');var Papa=require(_0x0cb8('0xf'));var Redis=require(_0x0cb8('0x10'));var authService=require(_0x0cb8('0x11'));var qs=require(_0x0cb8('0x12'));var as=require(_0x0cb8('0x13'));var hardwareService=require(_0x0cb8('0x14'));var logger=require(_0x0cb8('0x15'))(_0x0cb8('0x16'));var utils=require('../../config/utils');var config=require(_0x0cb8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cb8('0x18'))['db'];config[_0x0cb8('0x19')]=_[_0x0cb8('0x1a')](config[_0x0cb8('0x19')],{'host':_0x0cb8('0x1b'),'port':0x18eb});var socket=require(_0x0cb8('0x1c'))(new Redis(config[_0x0cb8('0x19')]));require('./whatsappAccount.socket')[_0x0cb8('0x1d')](socket);var jayson=require(_0x0cb8('0x1e'));var client=jayson[_0x0cb8('0x1f')][_0x0cb8('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x17ea11,_0x2c3d08,_0x32b4d2,_0x5689d4){return new BPromise(function(_0x358911,_0x42ec5c){var _0x5bbb49=_0x5689d4||client;return _0x5bbb49[_0x0cb8('0x21')](_0x17ea11,_0x32b4d2)[_0x0cb8('0x22')](function(_0x200fec){logger[_0x0cb8('0x23')](_0x0cb8('0x24'),_0x2c3d08,_0x0cb8('0x25'));logger[_0x0cb8('0x26')](_0x0cb8('0x27'),_0x2c3d08,_0x0cb8('0x25'),JSON['stringify'](_0x200fec));if(_0x200fec[_0x0cb8('0x28')]){if(_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x29')]===0x1f4){logger[_0x0cb8('0x28')](_0x0cb8('0x24'),_0x2c3d08,_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x2a')]);return _0x42ec5c(_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x2a')]);}logger[_0x0cb8('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x2c3d08,_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x2a')]);return _0x358911(_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x2a')]);}else{logger[_0x0cb8('0x23')](_0x0cb8('0x24'),_0x2c3d08,_0x0cb8('0x25'));_0x358911(_0x200fec[_0x0cb8('0x2b')][_0x0cb8('0x2a')]);}})['catch'](function(_0x52b74e){logger[_0x0cb8('0x28')](_0x0cb8('0x24'),_0x2c3d08,_0x52b74e);_0x42ec5c(_0x52b74e);});});}function respondWithStatusCode(_0x300fe6,_0x1faf38){_0x1faf38=_0x1faf38||0xcc;return function(_0x2092a5){if(_0x2092a5){return _0x300fe6[_0x0cb8('0x2c')](_0x1faf38);}return _0x300fe6['status'](_0x1faf38)[_0x0cb8('0x2d')]();};}function respondWithResult(_0x8d105a,_0x37ff0b){_0x37ff0b=_0x37ff0b||0xc8;return function(_0x384827){if(_0x384827){return _0x8d105a[_0x0cb8('0x2e')](_0x37ff0b)[_0x0cb8('0x2f')](_0x384827);}};}function respondWithFilteredResult(_0x3924c8,_0x469ae2){return function(_0x39c592){if(_0x39c592){var _0x2e10d7=_0x39c592[_0x0cb8('0x30')],_0x3fb69c=_0x469ae2['offset'],_0x193160=_0x469ae2[_0x0cb8('0x31')]+_0x469ae2[_0x0cb8('0x32')],_0x25b293;if(_0x193160>=_0x2e10d7){_0x193160=_0x2e10d7;_0x25b293=0xc8;}else{_0x25b293=0xce;}_0x3924c8[_0x0cb8('0x2e')](_0x25b293);return _0x3924c8[_0x0cb8('0x33')]('Content-Range',_0x3fb69c+'-'+_0x193160+'/'+_0x2e10d7)[_0x0cb8('0x2f')](_0x39c592);}return null;};}function patchUpdates(_0x13591a){return function(_0x1d2701){try{jsonpatch['apply'](_0x1d2701,_0x13591a,!![]);}catch(_0x5638b8){return BPromise[_0x0cb8('0x34')](_0x5638b8);}return _0x1d2701['save']();};}function saveUpdates(_0x4bc33b,_0x567e71){return function(_0x59210a){if(_0x59210a){return _0x59210a['update'](_0x4bc33b)[_0x0cb8('0x22')](function(_0x5e5231){return _0x5e5231;});}return null;};}function removeEntity(_0x593f55,_0x56f779){return function(_0x537e7d){if(_0x537e7d){return _0x537e7d[_0x0cb8('0x35')]()[_0x0cb8('0x22')](function(){var _0x41e1d5=_0x537e7d[_0x0cb8('0x36')]({'plain':!![]});var _0x3d6d70='WhatsappAccounts';return db['UserProfileResource'][_0x0cb8('0x35')]({'where':{'type':_0x3d6d70,'resourceId':_0x41e1d5['id']}})[_0x0cb8('0x22')](function(){return _0x537e7d;});})[_0x0cb8('0x22')](function(){_0x593f55[_0x0cb8('0x2e')](0xcc)[_0x0cb8('0x2d')]();});}};}function handleEntityNotFound(_0x42d6ba,_0x3783ac){return function(_0x3ae157){if(!_0x3ae157){_0x42d6ba[_0x0cb8('0x2c')](0x194);}return _0x3ae157;};}function handleError(_0x42a1b5,_0x15d473){_0x15d473=_0x15d473||0x1f4;return function(_0x277e0e){logger[_0x0cb8('0x28')](_0x277e0e[_0x0cb8('0x37')]);if(_0x277e0e['name']){delete _0x277e0e['name'];}_0x42a1b5['status'](_0x15d473)[_0x0cb8('0x38')](_0x277e0e);};}exports[_0x0cb8('0x39')]=function(_0x510e23,_0x10a635){var _0x5f561e={'include':[{'model':db[_0x0cb8('0x3a')],'as':'mandatoryDispositionPause'}]},_0x35c059={},_0x1ca3c1={'count':0x0,'rows':[]};var _0x1ef6d8=_[_0x0cb8('0x3b')](db[_0x0cb8('0x3c')]['rawAttributes'],function(_0x3c435d){return{'name':_0x3c435d[_0x0cb8('0x3d')],'type':_0x3c435d[_0x0cb8('0x3e')][_0x0cb8('0x3f')]};});_0x35c059['model']=_['map'](_0x1ef6d8,'name');_0x35c059['query']=_[_0x0cb8('0x40')](_0x510e23[_0x0cb8('0x41')]);_0x35c059[_0x0cb8('0x42')]=_['intersection'](_0x35c059[_0x0cb8('0x43')],_0x35c059[_0x0cb8('0x41')]);_0x5f561e[_0x0cb8('0x44')]=_[_0x0cb8('0x45')](_0x35c059[_0x0cb8('0x43')],qs[_0x0cb8('0x46')](_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x46')]));_0x5f561e[_0x0cb8('0x44')]=_0x5f561e[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x5f561e[_0x0cb8('0x44')]:_0x35c059[_0x0cb8('0x43')];if(!_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x5f561e['limit']=qs[_0x0cb8('0x32')](_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x32')]);_0x5f561e['offset']=qs[_0x0cb8('0x31')](_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x31')]);}_0x5f561e[_0x0cb8('0x4a')]=qs[_0x0cb8('0x4b')](_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x4b')]);_0x5f561e[_0x0cb8('0x4c')]=qs[_0x0cb8('0x42')](_[_0x0cb8('0x4d')](_0x510e23[_0x0cb8('0x41')],_0x35c059[_0x0cb8('0x42')]),_0x1ef6d8);if(_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x4e')]){_0x5f561e[_0x0cb8('0x4c')]=_['merge'](_0x5f561e[_0x0cb8('0x4c')],{'$or':_['map'](_0x1ef6d8,function(_0x240b16){if(_0x240b16['type']!==_0x0cb8('0x4f')){var _0x581217={};_0x581217[_0x240b16[_0x0cb8('0x50')]]={'$like':'%'+_0x510e23[_0x0cb8('0x41')]['filter']+'%'};return _0x581217;}})});}_0x5f561e=_[_0x0cb8('0x51')]({},_0x5f561e,_0x510e23[_0x0cb8('0x52')]);var _0x12f2ad={'where':_0x5f561e[_0x0cb8('0x4c')]};return db[_0x0cb8('0x3c')][_0x0cb8('0x30')](_0x12f2ad)[_0x0cb8('0x22')](function(_0x3c8709){_0x1ca3c1[_0x0cb8('0x30')]=_0x3c8709;if(_0x510e23['query']['includeAll']){_0x5f561e[_0x0cb8('0x53')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x0cb8('0x54')](_0x5f561e);})[_0x0cb8('0x22')](function(_0x1d0800){_0x1ca3c1[_0x0cb8('0x55')]=_0x1d0800;return _0x1ca3c1;})[_0x0cb8('0x22')](respondWithFilteredResult(_0x10a635,_0x5f561e))[_0x0cb8('0x56')](handleError(_0x10a635,null));};exports[_0x0cb8('0x57')]=function(_0x40295,_0x13e587){var _0x814f66={'raw':![],'where':{'id':_0x40295[_0x0cb8('0x58')]['id']},'include':[{'model':db[_0x0cb8('0x3a')],'as':'mandatoryDispositionPause'}]},_0x4d71f5={};_0x4d71f5[_0x0cb8('0x43')]=_[_0x0cb8('0x40')](db[_0x0cb8('0x3c')][_0x0cb8('0x59')]);_0x4d71f5[_0x0cb8('0x41')]=_[_0x0cb8('0x40')](_0x40295[_0x0cb8('0x41')]);_0x4d71f5[_0x0cb8('0x42')]=_[_0x0cb8('0x45')](_0x4d71f5[_0x0cb8('0x43')],_0x4d71f5['query']);_0x814f66[_0x0cb8('0x44')]=_['intersection'](_0x4d71f5[_0x0cb8('0x43')],qs[_0x0cb8('0x46')](_0x40295['query'][_0x0cb8('0x46')]));_0x814f66[_0x0cb8('0x44')]=_0x814f66[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x814f66['attributes']:_0x4d71f5[_0x0cb8('0x43')];if(_0x40295[_0x0cb8('0x41')][_0x0cb8('0x5a')]){_0x814f66[_0x0cb8('0x53')]=[{'all':!![]}];}_0x814f66=_[_0x0cb8('0x51')]({},_0x814f66,_0x40295[_0x0cb8('0x52')]);return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')](_0x814f66)[_0x0cb8('0x22')](handleEntityNotFound(_0x13e587,null))[_0x0cb8('0x22')](respondWithResult(_0x13e587,null))[_0x0cb8('0x56')](handleError(_0x13e587,null));};exports[_0x0cb8('0x5c')]=function(_0x3206dc,_0x3f00bf){return db[_0x0cb8('0x3c')][_0x0cb8('0x5c')](_0x3206dc[_0x0cb8('0x5d')],{})[_0x0cb8('0x22')](function(_0x339b1a){var _0xd56683=_0x3206dc['user'][_0x0cb8('0x36')]({'plain':!![]});if(!_0xd56683)throw new Error(_0x0cb8('0x5e'));if(_0xd56683[_0x0cb8('0x5f')]===_0x0cb8('0x60')){var _0x1b6734=_0x339b1a[_0x0cb8('0x36')]({'plain':!![]});var _0x279af6=_0x0cb8('0x61');return db[_0x0cb8('0x62')]['find']({'where':{'name':_0x279af6,'userProfileId':_0xd56683['userProfileId']},'raw':!![]})[_0x0cb8('0x22')](function(_0x428256){if(_0x428256&&_0x428256[_0x0cb8('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x1b6734[_0x0cb8('0x50')],'resourceId':_0x1b6734['id'],'type':_0x428256[_0x0cb8('0x50')],'sectionId':_0x428256['id']},{})[_0x0cb8('0x22')](function(){return _0x339b1a;});}else{return _0x339b1a;}})[_0x0cb8('0x56')](function(_0x46ce41){logger['error'](_0x0cb8('0x64'),_0x46ce41);throw _0x46ce41;});}return _0x339b1a;})[_0x0cb8('0x22')](respondWithResult(_0x3f00bf,0xc9))[_0x0cb8('0x56')](handleError(_0x3f00bf,null));};exports[_0x0cb8('0x65')]=function(_0x382a53,_0x4ba948){if(_0x382a53['body']['id']){delete _0x382a53['body']['id'];}return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x382a53[_0x0cb8('0x58')]['id']},'include':[{'model':db[_0x0cb8('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4ba948,null))['then'](saveUpdates(_0x382a53[_0x0cb8('0x5d')],null))[_0x0cb8('0x22')](respondWithResult(_0x4ba948,null))[_0x0cb8('0x56')](handleError(_0x4ba948,null));};exports[_0x0cb8('0x35')]=function(_0x1c98c5,_0x295108){return db[_0x0cb8('0x3c')]['find']({'where':{'id':_0x1c98c5[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x295108,null))[_0x0cb8('0x22')](removeEntity(_0x295108,null))['catch'](handleError(_0x295108,null));};exports[_0x0cb8('0x66')]=function(_0x3c422e,_0x5ae3c2){return db[_0x0cb8('0x3c')][_0x0cb8('0x66')]()[_0x0cb8('0x22')](respondWithResult(_0x5ae3c2,null))[_0x0cb8('0x56')](handleError(_0x5ae3c2,null));};exports[_0x0cb8('0x67')]=function(_0x4b45f5,_0x5411bb,_0x5d0013){if(_0x4b45f5[_0x0cb8('0x5d')]['id']){delete _0x4b45f5['body']['id'];}return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x4b45f5[_0x0cb8('0x58')]['id']}})['then'](handleEntityNotFound(_0x5411bb,null))[_0x0cb8('0x22')](function(_0x3e4805){if(_0x3e4805){_0x4b45f5['body'][_0x0cb8('0x68')]=_0x3e4805['id'];return db['Disposition'][_0x0cb8('0x5c')](_0x4b45f5[_0x0cb8('0x5d')]);}})[_0x0cb8('0x22')](respondWithResult(_0x5411bb,null))[_0x0cb8('0x56')](handleError(_0x5411bb,null));};exports[_0x0cb8('0x69')]=function(_0x543288,_0xec30de,_0x2346f7){var _0xfd0019={'raw':![],'where':{}};var _0x396986={};var _0x5d5513={'count':0x0,'rows':[]};return db[_0x0cb8('0x3c')][_0x0cb8('0x6a')]({'where':{'id':_0x543288[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0xec30de,null))[_0x0cb8('0x22')](function(_0xb24658){if(_0xb24658){_0x396986['model']=_[_0x0cb8('0x40')](db[_0x0cb8('0x6b')][_0x0cb8('0x59')]);_0x396986['query']=_[_0x0cb8('0x40')](_0x543288['query']);_0x396986[_0x0cb8('0x42')]=_[_0x0cb8('0x45')](_0x396986[_0x0cb8('0x43')],_0x396986['query']);_0xfd0019[_0x0cb8('0x44')]=_['intersection'](_0x396986[_0x0cb8('0x43')],qs[_0x0cb8('0x46')](_0x543288[_0x0cb8('0x41')][_0x0cb8('0x46')]));_0xfd0019[_0x0cb8('0x44')]=_0xfd0019['attributes'][_0x0cb8('0x47')]?_0xfd0019['attributes']:_0x396986[_0x0cb8('0x43')];if(!_0x543288[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0xfd0019[_0x0cb8('0x32')]=qs[_0x0cb8('0x32')](_0x543288[_0x0cb8('0x41')][_0x0cb8('0x32')]);_0xfd0019[_0x0cb8('0x31')]=qs['offset'](_0x543288[_0x0cb8('0x41')][_0x0cb8('0x31')]);}_0xfd0019['order']=qs[_0x0cb8('0x4b')](_0x543288[_0x0cb8('0x41')][_0x0cb8('0x4b')]);_0xfd0019['where']=qs['filters'](_[_0x0cb8('0x4d')](_0x543288[_0x0cb8('0x41')],_0x396986[_0x0cb8('0x42')]));_0xfd0019[_0x0cb8('0x4c')][_0x0cb8('0x68')]=_0xb24658['id'];if(_0x543288[_0x0cb8('0x41')][_0x0cb8('0x4e')]){_0xfd0019[_0x0cb8('0x4c')]=_[_0x0cb8('0x51')](_0xfd0019[_0x0cb8('0x4c')],{'$or':_[_0x0cb8('0x3b')](_0xfd0019['attributes'],function(_0x5b96c9){var _0x39cbce={};_0x39cbce[_0x5b96c9]={'$like':'%'+_0x543288['query'][_0x0cb8('0x4e')]+'%'};return _0x39cbce;})});}_0xfd0019=_[_0x0cb8('0x51')]({},_0xfd0019,_0x543288[_0x0cb8('0x52')]);return db[_0x0cb8('0x6b')][_0x0cb8('0x30')]({'where':_0xfd0019[_0x0cb8('0x4c')]})[_0x0cb8('0x22')](function(_0x12e8f6){_0x5d5513['count']=_0x12e8f6;if(_0x543288[_0x0cb8('0x41')][_0x0cb8('0x5a')]){_0xfd0019['include']=[{'all':!![]}];}return db[_0x0cb8('0x6b')][_0x0cb8('0x54')](_0xfd0019);})[_0x0cb8('0x22')](function(_0x88faf4){_0x5d5513[_0x0cb8('0x55')]=_0x88faf4;return _0x5d5513;});}})[_0x0cb8('0x22')](respondWithFilteredResult(_0xec30de,_0xfd0019))[_0x0cb8('0x56')](handleError(_0xec30de,null));};exports[_0x0cb8('0x6c')]=function(_0x136d61,_0x1277fc,_0x190aca){return db[_0x0cb8('0x3c')]['find']({'where':{'id':_0x136d61[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x1277fc,null))[_0x0cb8('0x22')](function(_0x278f7e){if(_0x278f7e){return _0x278f7e[_0x0cb8('0x6c')](_0x136d61['query'][_0x0cb8('0x6d')]);}})[_0x0cb8('0x22')](respondWithStatusCode(_0x1277fc,null))[_0x0cb8('0x56')](handleError(_0x1277fc,null));};exports[_0x0cb8('0x6e')]=function(_0x1961fc,_0x300566,_0x5fa69d){if(_0x1961fc[_0x0cb8('0x5d')]['id']){delete _0x1961fc[_0x0cb8('0x5d')]['id'];}return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x1961fc[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x300566,null))[_0x0cb8('0x22')](function(_0x140d8a){if(_0x140d8a){_0x1961fc[_0x0cb8('0x5d')]['WhatsappAccountId']=_0x140d8a['id'];return db[_0x0cb8('0x6f')][_0x0cb8('0x5c')](_0x1961fc[_0x0cb8('0x5d')]);}})[_0x0cb8('0x22')](respondWithResult(_0x300566,null))[_0x0cb8('0x56')](handleError(_0x300566,null));};exports[_0x0cb8('0x70')]=function(_0x369f5a,_0xfd73e,_0x44dfbd){var _0x17a617={'raw':![],'where':{}};var _0x2edae2={};var _0x2353d6={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x369f5a[_0x0cb8('0x58')]['id']}})['then'](handleEntityNotFound(_0xfd73e,null))[_0x0cb8('0x22')](function(_0x4aa745){if(_0x4aa745){_0x2edae2['model']=_['keys'](db[_0x0cb8('0x6f')]['rawAttributes']);_0x2edae2[_0x0cb8('0x41')]=_[_0x0cb8('0x40')](_0x369f5a[_0x0cb8('0x41')]);_0x2edae2[_0x0cb8('0x42')]=_[_0x0cb8('0x45')](_0x2edae2[_0x0cb8('0x43')],_0x2edae2[_0x0cb8('0x41')]);_0x17a617['attributes']=_[_0x0cb8('0x45')](_0x2edae2['model'],qs[_0x0cb8('0x46')](_0x369f5a[_0x0cb8('0x41')]['fields']));_0x17a617['attributes']=_0x17a617[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x17a617[_0x0cb8('0x44')]:_0x2edae2[_0x0cb8('0x43')];if(!_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x17a617[_0x0cb8('0x32')]=qs[_0x0cb8('0x32')](_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x32')]);_0x17a617[_0x0cb8('0x31')]=qs['offset'](_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x31')]);}_0x17a617[_0x0cb8('0x4a')]=qs[_0x0cb8('0x4b')](_0x369f5a['query'][_0x0cb8('0x4b')]);_0x17a617[_0x0cb8('0x4c')]=qs[_0x0cb8('0x42')](_[_0x0cb8('0x4d')](_0x369f5a[_0x0cb8('0x41')],_0x2edae2[_0x0cb8('0x42')]));_0x17a617['where'][_0x0cb8('0x68')]=_0x4aa745['id'];if(_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x4e')]){_0x17a617['where']=_[_0x0cb8('0x51')](_0x17a617[_0x0cb8('0x4c')],{'$or':_['map'](_0x17a617[_0x0cb8('0x44')],function(_0x1afbfe){var _0x411099={};_0x411099[_0x1afbfe]={'$like':'%'+_0x369f5a['query'][_0x0cb8('0x4e')]+'%'};return _0x411099;})});}_0x17a617=_[_0x0cb8('0x51')]({},_0x17a617,_0x369f5a[_0x0cb8('0x52')]);return db[_0x0cb8('0x6f')]['count']({'where':_0x17a617[_0x0cb8('0x4c')]})[_0x0cb8('0x22')](function(_0x26d2f4){_0x2353d6['count']=_0x26d2f4;if(_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x5a')]){_0x17a617[_0x0cb8('0x53')]=[{'all':!![]}];}return db[_0x0cb8('0x6f')][_0x0cb8('0x54')](_0x17a617);})['then'](function(_0x4d4122){_0x2353d6[_0x0cb8('0x55')]=_0x4d4122;return _0x2353d6;});}})[_0x0cb8('0x22')](respondWithFilteredResult(_0xfd73e,_0x17a617))['catch'](handleError(_0xfd73e,null));};exports['removeAnswers']=function(_0x480092,_0x1012aa,_0xa4b0b4){return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x480092['params']['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x1012aa,null))[_0x0cb8('0x22')](function(_0x4ce4bc){if(_0x4ce4bc){return _0x4ce4bc[_0x0cb8('0x71')](_0x480092[_0x0cb8('0x41')]['ids']);}})['then'](respondWithStatusCode(_0x1012aa,null))[_0x0cb8('0x56')](handleError(_0x1012aa,null));};exports[_0x0cb8('0x72')]=function(_0x1c7c44,_0x312333,_0x495d27){return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x1c7c44[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x312333,null))[_0x0cb8('0x22')](function(_0x16b318){if(_0x16b318){return _0x16b318[_0x0cb8('0x72')](_0x1c7c44[_0x0cb8('0x5d')]['ids'],_[_0x0cb8('0x73')](_0x1c7c44[_0x0cb8('0x5d')],[_0x0cb8('0x6d'),'id'])||{})[_0x0cb8('0x74')](function(_0x1829a1){for(var _0x57fafc=0x0;_0x57fafc<_0x1c7c44[_0x0cb8('0x5d')]['ids'][_0x0cb8('0x47')];_0x57fafc+=0x1){socket[_0x0cb8('0x75')](_0x0cb8('0x76'),{'UserId':_0x1c7c44[_0x0cb8('0x5d')][_0x0cb8('0x6d')][_0x57fafc],'WhatsappAccountId':_0x1c7c44[_0x0cb8('0x58')]['id']});}return _0x1829a1;});}})[_0x0cb8('0x22')](respondWithResult(_0x312333,null))[_0x0cb8('0x56')](handleError(_0x312333,null));};exports[_0x0cb8('0x77')]=function(_0x33841b,_0x289c33,_0x2668bc){return db[_0x0cb8('0x3c')]['find']({'where':{'id':_0x33841b[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x289c33,null))[_0x0cb8('0x22')](function(_0x31439f){if(_0x31439f){return _0x31439f[_0x0cb8('0x77')](_0x33841b[_0x0cb8('0x41')]['ids'])['then'](function(){if(_[_0x0cb8('0x78')](_0x33841b[_0x0cb8('0x41')]['ids'])){for(var _0xcdc070=0x0;_0xcdc070<_0x33841b[_0x0cb8('0x41')]['ids'][_0x0cb8('0x47')];_0xcdc070+=0x1){socket[_0x0cb8('0x75')](_0x0cb8('0x79'),{'UserId':Number(_0x33841b['query'][_0x0cb8('0x6d')][_0xcdc070]),'WhatsappAccountId':Number(_0x33841b[_0x0cb8('0x58')]['id'])});}}else{socket[_0x0cb8('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x33841b[_0x0cb8('0x41')][_0x0cb8('0x6d')]),'WhatsappAccountId':Number(_0x33841b[_0x0cb8('0x58')]['id'])});}});}})[_0x0cb8('0x22')](respondWithStatusCode(_0x289c33,null))['catch'](handleError(_0x289c33,null));};exports['getAgents']=function(_0x42db81,_0x1a8c59,_0x240219){var _0x1a26a0={};var _0x57f19d={};var _0x29a8b7;var _0xdfc370;return db[_0x0cb8('0x3c')][_0x0cb8('0x6a')]({'where':{'id':_0x42db81[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x1a8c59,null))[_0x0cb8('0x22')](function(_0x393d1a){if(_0x393d1a){_0x29a8b7=_0x393d1a;_0x57f19d[_0x0cb8('0x43')]=_[_0x0cb8('0x40')](db[_0x0cb8('0x7a')][_0x0cb8('0x59')]);_0x57f19d[_0x0cb8('0x41')]=_[_0x0cb8('0x40')](_0x42db81['query']);_0x57f19d[_0x0cb8('0x42')]=_[_0x0cb8('0x45')](_0x57f19d[_0x0cb8('0x43')],_0x57f19d[_0x0cb8('0x41')]);_0x1a26a0[_0x0cb8('0x44')]=_[_0x0cb8('0x45')](_0x57f19d['model'],qs[_0x0cb8('0x46')](_0x42db81[_0x0cb8('0x41')]['fields']));_0x1a26a0[_0x0cb8('0x44')]=_0x1a26a0[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x1a26a0[_0x0cb8('0x44')]:_0x57f19d[_0x0cb8('0x43')];_0x1a26a0['order']=qs[_0x0cb8('0x4b')](_0x42db81[_0x0cb8('0x41')]['sort']);_0x1a26a0[_0x0cb8('0x4c')]=qs['filters'](_[_0x0cb8('0x4d')](_0x42db81[_0x0cb8('0x41')],_0x57f19d[_0x0cb8('0x42')]));if(_0x42db81[_0x0cb8('0x41')][_0x0cb8('0x4e')]){_0x1a26a0[_0x0cb8('0x4c')]=_[_0x0cb8('0x51')](_0x1a26a0[_0x0cb8('0x4c')],{'$or':_[_0x0cb8('0x3b')](_0x1a26a0[_0x0cb8('0x44')],function(_0x2dfc12){var _0x17f454={};_0x17f454[_0x2dfc12]={'$like':'%'+_0x42db81['query'][_0x0cb8('0x4e')]+'%'};return _0x17f454;})});}_0x1a26a0=_[_0x0cb8('0x51')]({},_0x1a26a0,_0x42db81[_0x0cb8('0x52')]);return _0x29a8b7[_0x0cb8('0x7b')](_0x1a26a0);}})['then'](function(_0x4eb947){if(_0x4eb947){_0xdfc370=_0x4eb947[_0x0cb8('0x47')];if(!_0x42db81[_0x0cb8('0x41')][_0x0cb8('0x48')]('nolimit')){_0x1a26a0['limit']=qs[_0x0cb8('0x32')](_0x42db81['query'][_0x0cb8('0x32')]);_0x1a26a0[_0x0cb8('0x31')]=qs[_0x0cb8('0x31')](_0x42db81[_0x0cb8('0x41')][_0x0cb8('0x31')]);}return _0x29a8b7[_0x0cb8('0x7b')](_0x1a26a0);}})[_0x0cb8('0x22')](function(_0x38d666){if(_0x38d666){return _0x38d666?{'count':_0xdfc370,'rows':_0x38d666}:null;}})[_0x0cb8('0x22')](respondWithResult(_0x1a8c59,null))[_0x0cb8('0x56')](handleError(_0x1a8c59,null));};exports['addApplications']=function(_0x16db3e,_0x218708,_0x322efc){return db[_0x0cb8('0x3c')]['findOne']({'where':{'id':_0x16db3e[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x218708,null))[_0x0cb8('0x22')](function(_0x4b51d7){if(_0x4b51d7){return db[_0x0cb8('0x7c')][_0x0cb8('0x7d')](function(_0x2845a0){return db[_0x0cb8('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x16db3e[_0x0cb8('0x58')]['id']},'transaction':_0x2845a0})[_0x0cb8('0x22')](function(_0x536ba4){var _0x196daa=_[_0x0cb8('0x3b')](_0x16db3e['body'],function(_0x13b9be){_0x13b9be[_0x0cb8('0x68')]=_0x16db3e[_0x0cb8('0x58')]['id'];return _0x13b9be;});return db['WhatsappApplication'][_0x0cb8('0x7f')](_0x196daa,{'transaction':_0x2845a0});});})[_0x0cb8('0x22')](function(){return db[_0x0cb8('0x7e')][_0x0cb8('0x80')]({'where':{'WhatsappAccountId':_0x16db3e[_0x0cb8('0x58')]['id']},'order':_0x0cb8('0x81')});});}})[_0x0cb8('0x22')](respondWithResult(_0x218708,null))[_0x0cb8('0x56')](handleError(_0x218708,null));};exports[_0x0cb8('0x82')]=function(_0x3de452,_0x447eee,_0x30e566){var _0x2bbc8c={};var _0xe289a7={};var _0x9b508d;var _0x6d33c9;return db[_0x0cb8('0x3c')][_0x0cb8('0x6a')]({'where':{'id':_0x3de452[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x447eee,null))['then'](function(_0x60d90d){if(_0x60d90d){_0x9b508d=_0x60d90d;_0xe289a7['model']=_[_0x0cb8('0x40')](db[_0x0cb8('0x7e')][_0x0cb8('0x59')]);_0xe289a7[_0x0cb8('0x41')]=_[_0x0cb8('0x40')](_0x3de452[_0x0cb8('0x41')]);_0xe289a7['filters']=_[_0x0cb8('0x45')](_0xe289a7['model'],_0xe289a7[_0x0cb8('0x41')]);_0x2bbc8c[_0x0cb8('0x44')]=_[_0x0cb8('0x45')](_0xe289a7['model'],qs[_0x0cb8('0x46')](_0x3de452[_0x0cb8('0x41')][_0x0cb8('0x46')]));_0x2bbc8c[_0x0cb8('0x44')]=_0x2bbc8c[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x2bbc8c['attributes']:_0xe289a7['model'];_0x2bbc8c[_0x0cb8('0x4a')]=qs['sort'](_0x3de452[_0x0cb8('0x41')][_0x0cb8('0x4b')]);_0x2bbc8c['where']=qs[_0x0cb8('0x42')](_[_0x0cb8('0x4d')](_0x3de452[_0x0cb8('0x41')],_0xe289a7['filters']));if(_0x3de452['query'][_0x0cb8('0x4e')]){_0x2bbc8c[_0x0cb8('0x4c')]=_[_0x0cb8('0x51')](_0x2bbc8c['where'],{'$or':_[_0x0cb8('0x3b')](_0x2bbc8c[_0x0cb8('0x44')],function(_0x8d7333){var _0x320bd8={};_0x320bd8[_0x8d7333]={'$like':'%'+_0x3de452[_0x0cb8('0x41')]['filter']+'%'};return _0x320bd8;})});}_0x2bbc8c=_[_0x0cb8('0x51')]({},_0x2bbc8c,_0x3de452[_0x0cb8('0x52')]);return _0x9b508d[_0x0cb8('0x82')](_0x2bbc8c);}})[_0x0cb8('0x22')](function(_0x2a2a98){if(_0x2a2a98){_0x6d33c9=_0x2a2a98[_0x0cb8('0x47')];if(!_0x3de452[_0x0cb8('0x41')]['hasOwnProperty'](_0x0cb8('0x49'))){_0x2bbc8c[_0x0cb8('0x32')]=qs[_0x0cb8('0x32')](_0x3de452['query'][_0x0cb8('0x32')]);_0x2bbc8c[_0x0cb8('0x31')]=qs[_0x0cb8('0x31')](_0x3de452['query'][_0x0cb8('0x31')]);}return _0x9b508d[_0x0cb8('0x82')](_0x2bbc8c);}})[_0x0cb8('0x22')](function(_0x5a8b39){if(_0x5a8b39){return _0x5a8b39?{'count':_0x6d33c9,'rows':_0x5a8b39}:null;}})[_0x0cb8('0x22')](respondWithResult(_0x447eee,null))[_0x0cb8('0x56')](handleError(_0x447eee,null));};exports['notify']=function(_0x247c9a,_0x258a31,_0x27562e){var _0x118bde={'channel':'whatsapp'};var _0x1df262=[];var _0x59ac6f=[];var _0x386fef={};return db[_0x0cb8('0x3c')]['find']({'where':{'id':_0x247c9a[_0x0cb8('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x0cb8('0x22')](handleEntityNotFound(_0x258a31,null))[_0x0cb8('0x22')](function(_0x176fdd){_0x118bde['account']=_0x176fdd;_0x118bde[_0x0cb8('0x83')]=_[_0x0cb8('0x84')](_0x176fdd[_0x0cb8('0x85')],['priority'],['asc']);if(_0x118bde['account'][_0x0cb8('0x85')]){delete _0x118bde[_0x0cb8('0x86')][_0x0cb8('0x85')];}return db[_0x0cb8('0x87')]['describe']();})[_0x0cb8('0x22')](function(_0x3766ff){if(!_0x3766ff){throw new db[(_0x0cb8('0x88'))][(_0x0cb8('0x89'))](_0x0cb8('0x8a'));}_0x1df262=_['difference'](_[_0x0cb8('0x40')](_0x3766ff),[_0x0cb8('0x8b'),_0x0cb8('0x8c')]);_0x59ac6f=_[_0x0cb8('0x8d')](_[_0x0cb8('0x40')](_0x3766ff),[_0x0cb8('0x8b'),_0x0cb8('0x8c'),_0x0cb8('0x8e'),'ListId']);_0x118bde[_0x0cb8('0x5d')]={'mapKey':_0x0cb8('0x8f')};if(_0x118bde[_0x0cb8('0x86')][_0x0cb8('0x3e')]&&_0x118bde[_0x0cb8('0x86')]['type']===_0x0cb8('0x90')){_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x91')]=_0x247c9a[_0x0cb8('0x5d')][_0x0cb8('0x92')][_0x0cb8('0x93')](_0x0cb8('0x94'),'');_0x118bde['body'][_0x0cb8('0x5d')]=_0x247c9a[_0x0cb8('0x5d')][_0x0cb8('0x95')];_0x118bde['body'][_0x0cb8('0x96')]=_0x247c9a['body'][_0x0cb8('0x97')];}if(_0x118bde[_0x0cb8('0x5d')]['id']){delete _0x118bde['body']['id'];}if(_[_0x0cb8('0x98')](_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x91')])){throw new db[(_0x0cb8('0x88'))][(_0x0cb8('0x89'))](_0x0cb8('0x99'));}if(_[_0x0cb8('0x98')](_0x118bde['body'][_0x0cb8('0x5d')])||_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x5d')]===''){throw new db[(_0x0cb8('0x88'))][(_0x0cb8('0x89'))](_0x0cb8('0x9a'));}if(_['isNil'](_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x9b')])){throw new db[(_0x0cb8('0x88'))]['ValidationError'](_0x0cb8('0x9c')+_0x59ac6f);}if(!_['includes'](_0x59ac6f,_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x9b')])){throw new db[(_0x0cb8('0x88'))]['ValidationError'](_0x0cb8('0x9d')+_0x59ac6f);}_0x386fef[_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x9b')]]=_0x118bde['body'][_0x0cb8('0x91')];return db[_0x0cb8('0x9e')][_0x0cb8('0x5b')]({'where':{'id':_0x118bde['account'][_0x0cb8('0x9f')]},'include':[{'model':db['CmContact'],'as':_0x0cb8('0xa0'),'where':_0x386fef,'limit':0x1,'order':[[_0x0cb8('0x8c'),_0x0cb8('0xa1')]]}]});})[_0x0cb8('0x22')](handleEntityNotFound(_0x258a31,null))[_0x0cb8('0x22')](function(_0x3a2ef6){if(_0x3a2ef6){_0x118bde[_0x0cb8('0xa2')]=_[_0x0cb8('0x73')](_0x3a2ef6,[_0x0cb8('0xa0')]);if(_0x3a2ef6[_0x0cb8('0xa0')][_0x0cb8('0x47')]){return _0x3a2ef6[_0x0cb8('0xa0')][0x0];}var _0x140a4e=_[_0x0cb8('0x1a')](_0x118bde['body'],{'firstName':_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x91')],'ListId':_0x3a2ef6['id']});_0x140a4e[_0x118bde['body'][_0x0cb8('0x9b')]]=_0x118bde['body']['from'];return db['CmContact']['create'](_0x140a4e,{'fields':_0x1df262,'raw':!![]});}})[_0x0cb8('0x22')](handleEntityNotFound(_0x258a31,null))[_0x0cb8('0x22')](function(_0x394d85){if(_0x394d85){_0x118bde[_0x0cb8('0xa3')]=_0x394d85;var _0x2664cf={'ContactId':_0x394d85['id'],'phone':_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x91')],'WhatsappAccountId':_0x247c9a['params']['id']};var _0x864300={'ContactId':_0x394d85['id'],'WhatsappAccountId':_0x247c9a[_0x0cb8('0x58')]['id'],'closed':![]};return db[_0x0cb8('0xa4')][_0x0cb8('0x5b')]({'where':_0x864300})['then'](function(_0x3a7ead){if(_0x3a7ead){return[_0x3a7ead,![]];}return db['WhatsappInteraction'][_0x0cb8('0x5c')](_0x2664cf)[_0x0cb8('0x22')](function(_0x6d919f){return[_0x6d919f,!![]];});});}})[_0x0cb8('0x74')](function(_0x111243,_0x5234f4){_0x118bde[_0x0cb8('0xa5')]=_0x111243[_0x0cb8('0x36')]({'plain':!![]});_0x118bde[_0x0cb8('0xa5')][_0x0cb8('0xa6')]=![];if(_0x5234f4){if(_0x118bde['account'][_0x0cb8('0xa7')]){_0x118bde[_0x0cb8('0x83')][_0x0cb8('0xa8')]({'id':0x0,'priority':_0x118bde[_0x0cb8('0x83')][_0x0cb8('0x47')]+0x1,'app':'close','appdata':_0x0cb8('0xa9'),'interval':'*,*,*,*'});}_0x118bde[_0x0cb8('0xa5')][_0x0cb8('0xa6')]=!![];}return db[_0x0cb8('0xaa')][_0x0cb8('0x5c')]({'phone':_0x118bde['body'][_0x0cb8('0x91')],'messageId':_0x118bde[_0x0cb8('0x5d')]['messageId'],'body':_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x5d')],'WhatsappAccountId':_0x247c9a[_0x0cb8('0x58')]['id'],'WhatsappInteractionId':_0x111243['id'],'direction':'in','ContactId':_0x111243[_0x0cb8('0xab')],'AttachmentId':_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0xac')]});})['then'](function(_0x5a80ea){_0x118bde[_0x0cb8('0x2a')]=_0x5a80ea;if(_0x118bde[_0x0cb8('0xa5')]['UserId']){return db[_0x0cb8('0x7a')][_0x0cb8('0x5b')]({'attributes':['id',_0x0cb8('0x50')],'where':{'id':_0x118bde['interaction'][_0x0cb8('0xad')]}})['then'](function(_0x3fee16){if(_0x3fee16){_0x118bde[_0x0cb8('0x83')][_0x0cb8('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3fee16[_0x0cb8('0x50')]+','+(_0x118bde[_0x0cb8('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x0cb8('0xaf')});}return respondWithRpcPromise(_0x0cb8('0xb0'),_0x0cb8('0xb1'),_0x118bde);});}return respondWithRpcPromise(_0x0cb8('0xb0'),_0x0cb8('0xb1'),_0x118bde);})[_0x0cb8('0x22')](function(_0x5d2679){if(_0x5d2679){var _0x291dc3=0xc8;var _0x1a0845='receiveMessage';logger[_0x0cb8('0x23')](_0x0cb8('0x27'),_0x1a0845,_0x291dc3,_0x0cb8('0xb2'));logger[_0x0cb8('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a0845,_0x291dc3,_0x0cb8('0xb2'),JSON[_0x0cb8('0xb3')](_0x5d2679));if(_0x118bde[_0x0cb8('0x86')][_0x0cb8('0x3e')]===_0x0cb8('0x90')){return _0x258a31[_0x0cb8('0x2e')](_0x291dc3)[_0x0cb8('0x33')]('Content-Type','text/xml')[_0x0cb8('0x38')](_0x0cb8('0xb4'));}else{return _0x258a31[_0x0cb8('0x2e')](_0x291dc3)[_0x0cb8('0x2f')](_0x5d2679);}}})[_0x0cb8('0x56')](handleError(_0x258a31,null));};exports['send']=function(_0x59348f,_0x11490d,_0x54ef04){var _0x508695,_0x576e30,_0x242525;if(_[_0x0cb8('0x98')](_0x59348f[_0x0cb8('0x5d')]['body'])||_0x59348f[_0x0cb8('0x5d')][_0x0cb8('0x5d')]===''){throw new db[(_0x0cb8('0x88'))][(_0x0cb8('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0cb8('0x98')](_0x59348f[_0x0cb8('0x5d')]['to'])){throw new db['Sequelize'][(_0x0cb8('0x89'))]('to\x20is\x20mandatory');}_0x508695=_0x59348f[_0x0cb8('0x5d')]['to'];return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x59348f[_0x0cb8('0x58')]['id']},'include':[{'model':db[_0x0cb8('0x9e')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0cb8('0xa0'),'where':{'mobile':_0x508695},'limit':0x1,'order':[[_0x0cb8('0x8c'),_0x0cb8('0xa1')]]}]}]})[_0x0cb8('0x22')](handleEntityNotFound(_0x11490d,null))['then'](function(_0x154756){if(_0x154756&&_0x154756[_0x0cb8('0xb5')]){_0x576e30=_0x154756[_0x0cb8('0x36')]({'plain':!![]});if(_0x576e30[_0x0cb8('0xb5')]&&_0x576e30[_0x0cb8('0xb5')][_0x0cb8('0xa0')]['length']){return _0x576e30[_0x0cb8('0xb5')][_0x0cb8('0xa0')][0x0];}return db[_0x0cb8('0x87')]['create'](_['defaults'](_0x59348f[_0x0cb8('0x5d')],{'firstName':_0x508695,'mobile':_0x508695,'phone':_0x508695,'ListId':_0x576e30[_0x0cb8('0x9f')]}));}})[_0x0cb8('0x22')](handleEntityNotFound(_0x11490d,null))[_0x0cb8('0x22')](function(_0xd6b2f1){if(_0xd6b2f1){_0x242525=_0xd6b2f1;return db['WhatsappInteraction'][_0x0cb8('0x5b')]({'where':{'ContactId':_0x242525['id'],'closed':![],'WhatsappAccountId':_0x576e30['id']}})['then'](function(_0x297d37){if(_0x297d37){return[_0x297d37,![]];}return db['WhatsappInteraction'][_0x0cb8('0x5c')]({'UserId':_0x59348f[_0x0cb8('0x60')]['id'],'ContactId':_0x242525['id'],'WhatsappAccountId':_0x576e30['id'],'phone':_0x508695,'firstMsgDirection':_0x0cb8('0xb6'),'Messages':[_[_0x0cb8('0x51')](_0x59348f[_0x0cb8('0x5d')],{'read':![],'body':_0x59348f[_0x0cb8('0x5d')][_0x0cb8('0x5d')],'phone':_0x508695,'WhatsappAccountId':_0x576e30['id'],'UserId':_0x59348f[_0x0cb8('0x60')]['id'],'ContactId':_0x242525['id']})]},{'include':[{'model':db[_0x0cb8('0xaa')],'as':_0x0cb8('0xb7')}]})['then'](function(_0xabb151){return[_0xabb151,!![]];});});}})[_0x0cb8('0x74')](function(_0x5848b7,_0xa386b){if(_0xa386b){return _0x5848b7;}return db[_0x0cb8('0xaa')][_0x0cb8('0x5c')](_['merge'](_0x59348f[_0x0cb8('0x5d')],{'read':![],'body':_0x59348f['body'][_0x0cb8('0x5d')],'phone':_0x508695,'WhatsappAccountId':_0x576e30['id'],'WhatsappInteractionId':_0x5848b7['id'],'UserId':_0x59348f[_0x0cb8('0x60')]['id'],'ContactId':_0x242525['id']}))[_0x0cb8('0x22')](function(_0x302475){_0x5848b7[_0x0cb8('0xb8')][_0x0cb8('0xb7')]=[];_0x5848b7[_0x0cb8('0xb8')][_0x0cb8('0xb7')]['push'](_0x302475['dataValues']);return _0x5848b7;});})[_0x0cb8('0x22')](respondWithResult(_0x11490d,null))['catch'](handleError(_0x11490d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index d661df3..dfac756 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a5a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0x9a5a,0x194));var _0xa9a5=function(_0x2d4aff,_0x23a44f){_0x2d4aff=_0x2d4aff-0x0;var _0x33198f=_0x9a5a[_0x2d4aff];return _0x33198f;};'use strict';var EventEmitter=require(_0xa9a5('0x0'));var WhatsappAccount=require(_0xa9a5('0x1'))['db'][_0xa9a5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa9a5('0x3')](0x0);var events={'afterCreate':_0xa9a5('0x4'),'afterUpdate':'update','afterDestroy':_0xa9a5('0x5')};function emitEvent(_0x1e6fb1){return function(_0x230710,_0x1080a9,_0x31e823){WhatsappAccountEvents[_0xa9a5('0x6')](_0x1e6fb1+':'+_0x230710['id'],_0x230710);WhatsappAccountEvents['emit'](_0x1e6fb1,_0x230710);_0x31e823(null);};}for(var e in events){if(events[_0xa9a5('0x7')](e)){var event=events[e];WhatsappAccount[_0xa9a5('0x8')](e,emitEvent(event));}}module[_0xa9a5('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x35a0e2,_0x302ad1){var _0x31ea9a=function(_0x356d7d){while(--_0x356d7d){_0x35a0e2['push'](_0x35a0e2['shift']());}};_0x31ea9a(++_0x302ad1);}(_0x2ef3,0xba));var _0x32ef=function(_0xc1d0bc,_0xdb6df6){_0xc1d0bc=_0xc1d0bc-0x0;var _0x1a1a97=_0x2ef3[_0xc1d0bc];return _0x1a1a97;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var WhatsappAccount=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){WhatsappAccountEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);WhatsappAccountEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 855a7cb..0f5b55a 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a3c=['path','rimraf','../../config/environment','exports','define','WhatsappAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4bbd93,_0x205605){var _0x669c4=function(_0x12a82f){while(--_0x12a82f){_0x4bbd93['push'](_0x4bbd93['shift']());}};_0x669c4(++_0x205605);}(_0x5a3c,0xa2));var _0xc5a3=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x5a3c[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var logger=require(_0xc5a3('0x2'))(_0xc5a3('0x3'));var moment=require('moment');var BPromise=require(_0xc5a3('0x4'));var rp=require(_0xc5a3('0x5'));var fs=require('fs');var path=require(_0xc5a3('0x6'));var rimraf=require(_0xc5a3('0x7'));var config=require(_0xc5a3('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0xc5a3('0x9')]=function(_0x525f3e,_0x2de91c){return _0x525f3e[_0xc5a3('0xa')](_0xc5a3('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x338e=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash','util','../../config/logger','moment','request-promise'];(function(_0x51be3e,_0x4d2123){var _0x148d23=function(_0x7277d8){while(--_0x7277d8){_0x51be3e['push'](_0x51be3e['shift']());}};_0x148d23(++_0x4d2123);}(_0x338e,0xc1));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe338('0x0'));var util=require(_0xe338('0x1'));var logger=require(_0xe338('0x2'))('api');var moment=require(_0xe338('0x3'));var BPromise=require('bluebird');var rp=require(_0xe338('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe338('0x5'));var config=require(_0xe338('0x6'));var attributes=require(_0xe338('0x7'));module[_0xe338('0x8')]=function(_0x5e5451,_0x5c9b33){return _0x5e5451[_0xe338('0x9')](_0xe338('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 0195561..accad93 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49d9=['./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowWhatsappAccount','find','options','raw','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x36cf07,_0x59ff98){var _0x492bac=function(_0x26176c){while(--_0x26176c){_0x36cf07['push'](_0x36cf07['shift']());}};_0x492bac(++_0x59ff98);}(_0x49d9,0x13e));var _0x949d=function(_0x40a546,_0x2005f8){_0x40a546=_0x40a546-0x0;var _0xd5b22a=_0x49d9[_0x40a546];return _0xd5b22a;};'use strict';var _=require(_0x949d('0x0'));var util=require(_0x949d('0x1'));var moment=require(_0x949d('0x2'));var BPromise=require(_0x949d('0x3'));var rs=require(_0x949d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x949d('0x5'))['db'];var utils=require(_0x949d('0x6'));var logger=require(_0x949d('0x7'))(_0x949d('0x8'));var config=require(_0x949d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x949d('0xa')][_0x949d('0xb')]({'port':0x232a});config[_0x949d('0xc')]=_[_0x949d('0xd')](config[_0x949d('0xc')],{'host':_0x949d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x949d('0xc')]));require(_0x949d('0xf'))[_0x949d('0x10')](socket);function respondWithRpcPromise(_0x5314de,_0x786584,_0x30fe23){return new BPromise(function(_0x4f26c7,_0x44d55c){return client[_0x949d('0x11')](_0x5314de,_0x30fe23)[_0x949d('0x12')](function(_0x39c362){logger[_0x949d('0x13')](_0x949d('0x14'),_0x786584,_0x949d('0x15'));logger[_0x949d('0x16')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x786584,'request\x20sent',JSON[_0x949d('0x17')](_0x39c362));if(_0x39c362[_0x949d('0x18')]){if(_0x39c362[_0x949d('0x18')][_0x949d('0x19')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x786584,_0x39c362['error'][_0x949d('0x1a')]);return _0x44d55c(_0x39c362[_0x949d('0x18')][_0x949d('0x1a')]);}logger[_0x949d('0x18')](_0x949d('0x14'),_0x786584,_0x39c362[_0x949d('0x18')][_0x949d('0x1a')]);return _0x4f26c7(_0x39c362[_0x949d('0x18')][_0x949d('0x1a')]);}else{logger[_0x949d('0x13')](_0x949d('0x14'),_0x786584,_0x949d('0x15'));_0x4f26c7(_0x39c362[_0x949d('0x1b')][_0x949d('0x1a')]);}})['catch'](function(_0x2f3adf){logger[_0x949d('0x18')](_0x949d('0x14'),_0x786584,_0x2f3adf);_0x44d55c(_0x2f3adf);});});}exports[_0x949d('0x1c')]=function(_0x1d5966){var _0x2aa8b8=this;return new Promise(function(_0x1fcf26,_0x252f74){return db['WhatsappAccount'][_0x949d('0x1d')]({'raw':_0x1d5966[_0x949d('0x1e')]?_0x1d5966['options'][_0x949d('0x1f')]===undefined?!![]:![]:!![],'where':_0x1d5966[_0x949d('0x1e')]?_0x1d5966[_0x949d('0x1e')]['where']||null:null,'attributes':_0x1d5966[_0x949d('0x1e')]?_0x1d5966[_0x949d('0x1e')][_0x949d('0x20')]||null:null,'include':_0x1d5966[_0x949d('0x1e')]?_0x1d5966[_0x949d('0x1e')][_0x949d('0x21')]?_[_0x949d('0x22')](_0x1d5966[_0x949d('0x1e')][_0x949d('0x21')],function(_0x1b9bfc){return{'model':db[_0x1b9bfc[_0x949d('0x23')]],'as':_0x1b9bfc['as'],'attributes':_0x1b9bfc[_0x949d('0x20')],'include':_0x1b9bfc[_0x949d('0x21')]?_[_0x949d('0x22')](_0x1b9bfc[_0x949d('0x21')],function(_0x19f75d){return{'model':db[_0x19f75d['model']],'as':_0x19f75d['as'],'attributes':_0x19f75d[_0x949d('0x20')],'include':_0x19f75d[_0x949d('0x21')]?_[_0x949d('0x22')](_0x19f75d[_0x949d('0x21')],function(_0x4f9aa3){return{'model':db[_0x4f9aa3[_0x949d('0x23')]],'as':_0x4f9aa3['as'],'attributes':_0x4f9aa3[_0x949d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x949d('0x12')](function(_0x16e63a){logger['info']('ShowWhatsappAccount',_0x1d5966);logger[_0x949d('0x16')](_0x949d('0x1c'),_0x1d5966,JSON[_0x949d('0x17')](_0x16e63a));_0x1fcf26(_0x16e63a);})[_0x949d('0x24')](function(_0x362b0c){logger[_0x949d('0x18')](_0x949d('0x1c'),_0x362b0c[_0x949d('0x1a')],_0x1d5966);_0x252f74(_0x2aa8b8['error'](0x1f4,_0x362b0c[_0x949d('0x1a')]));});});}; \ No newline at end of file +var _0x628a=['localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis'];(function(_0x3886dc,_0x44c49b){var _0x244909=function(_0x362b29){while(--_0x362b29){_0x3886dc['push'](_0x3886dc['shift']());}};_0x244909(++_0x44c49b);}(_0x628a,0x1bb));var _0xa628=function(_0x31d930,_0x32ea96){_0x31d930=_0x31d930-0x0;var _0x26e2ef=_0x628a[_0x31d930];return _0x26e2ef;};'use strict';var _=require(_0xa628('0x0'));var util=require(_0xa628('0x1'));var moment=require('moment');var BPromise=require(_0xa628('0x2'));var rs=require(_0xa628('0x3'));var fs=require('fs');var Redis=require(_0xa628('0x4'));var db=require(_0xa628('0x5'))['db'];var utils=require(_0xa628('0x6'));var logger=require(_0xa628('0x7'))('rpc');var config=require(_0xa628('0x8'));var jayson=require(_0xa628('0x9'));var client=jayson[_0xa628('0xa')]['http']({'port':0x232a});config['redis']=_[_0xa628('0xb')](config[_0xa628('0xc')],{'host':_0xa628('0xd'),'port':0x18eb});var socket=require(_0xa628('0xe'))(new Redis(config[_0xa628('0xc')]));require(_0xa628('0xf'))[_0xa628('0x10')](socket);function respondWithRpcPromise(_0x598bdc,_0x401b5d,_0x30284c){return new BPromise(function(_0x1577d6,_0x58f628){return client[_0xa628('0x11')](_0x598bdc,_0x30284c)[_0xa628('0x12')](function(_0x1c5fbb){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x401b5d,_0xa628('0x13'));logger[_0xa628('0x14')](_0xa628('0x15'),_0x401b5d,'request\x20sent',JSON[_0xa628('0x16')](_0x1c5fbb));if(_0x1c5fbb['error']){if(_0x1c5fbb[_0xa628('0x17')]['code']===0x1f4){logger[_0xa628('0x17')](_0xa628('0x18'),_0x401b5d,_0x1c5fbb['error'][_0xa628('0x19')]);return _0x58f628(_0x1c5fbb[_0xa628('0x17')][_0xa628('0x19')]);}logger[_0xa628('0x17')](_0xa628('0x18'),_0x401b5d,_0x1c5fbb[_0xa628('0x17')][_0xa628('0x19')]);return _0x1577d6(_0x1c5fbb['error'][_0xa628('0x19')]);}else{logger[_0xa628('0x1a')](_0xa628('0x18'),_0x401b5d,_0xa628('0x13'));_0x1577d6(_0x1c5fbb[_0xa628('0x1b')][_0xa628('0x19')]);}})[_0xa628('0x1c')](function(_0x15caf9){logger[_0xa628('0x17')](_0xa628('0x18'),_0x401b5d,_0x15caf9);_0x58f628(_0x15caf9);});});}exports[_0xa628('0x1d')]=function(_0x51ba03){var _0x147aae=this;return new Promise(function(_0x18e215,_0x540a22){return db['WhatsappAccount'][_0xa628('0x1e')]({'raw':_0x51ba03[_0xa628('0x1f')]?_0x51ba03[_0xa628('0x1f')][_0xa628('0x20')]===undefined?!![]:![]:!![],'where':_0x51ba03[_0xa628('0x1f')]?_0x51ba03['options'][_0xa628('0x21')]||null:null,'attributes':_0x51ba03[_0xa628('0x1f')]?_0x51ba03[_0xa628('0x1f')][_0xa628('0x22')]||null:null,'include':_0x51ba03[_0xa628('0x1f')]?_0x51ba03['options'][_0xa628('0x23')]?_[_0xa628('0x24')](_0x51ba03[_0xa628('0x1f')][_0xa628('0x23')],function(_0x110201){return{'model':db[_0x110201['model']],'as':_0x110201['as'],'attributes':_0x110201[_0xa628('0x22')],'include':_0x110201[_0xa628('0x23')]?_[_0xa628('0x24')](_0x110201[_0xa628('0x23')],function(_0x41b4c3){return{'model':db[_0x41b4c3['model']],'as':_0x41b4c3['as'],'attributes':_0x41b4c3[_0xa628('0x22')],'include':_0x41b4c3[_0xa628('0x23')]?_[_0xa628('0x24')](_0x41b4c3['include'],function(_0x5d4107){return{'model':db[_0x5d4107[_0xa628('0x25')]],'as':_0x5d4107['as'],'attributes':_0x5d4107[_0xa628('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa628('0x12')](function(_0x4e3272){logger[_0xa628('0x1a')](_0xa628('0x1d'),_0x51ba03);logger[_0xa628('0x14')](_0xa628('0x1d'),_0x51ba03,JSON[_0xa628('0x16')](_0x4e3272));_0x18e215(_0x4e3272);})[_0xa628('0x1c')](function(_0x13c53e){logger[_0xa628('0x17')](_0xa628('0x1d'),_0x13c53e[_0xa628('0x19')],_0x51ba03);_0x540a22(_0x147aae[_0xa628('0x17')](0x1f4,_0x13c53e[_0xa628('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0850986..66062db 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaba5=['whatsappAccount:','./whatsappAccount.events','save','update','emit','removeListener','register','length'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xaba5,0x1b9));var _0x5aba=function(_0x50345a,_0x5c7bc7){_0x50345a=_0x50345a-0x0;var _0xabcaa7=_0xaba5[_0x50345a];return _0xabcaa7;};'use strict';var WhatsappAccountEvents=require(_0x5aba('0x0'));var events=[_0x5aba('0x1'),'remove',_0x5aba('0x2')];function createListener(_0x215a7a,_0x52f8b9){return function(_0x28c245){_0x52f8b9[_0x5aba('0x3')](_0x215a7a,_0x28c245);};}function removeListener(_0x519044,_0x5c58be){return function(){WhatsappAccountEvents[_0x5aba('0x4')](_0x519044,_0x5c58be);};}exports[_0x5aba('0x5')]=function(_0x1c31ef){for(var _0x28938f=0x0,_0xe503be=events[_0x5aba('0x6')];_0x28938f<_0xe503be;_0x28938f++){var _0x5d8ad0=events[_0x28938f];var _0x3eb817=createListener(_0x5aba('0x7')+_0x5d8ad0,_0x1c31ef);WhatsappAccountEvents['on'](_0x5d8ad0,_0x3eb817);}}; \ No newline at end of file +var _0x5dd2=['register','./whatsappAccount.events','save','emit','removeListener'];(function(_0x1ac1b1,_0x5f5b9e){var _0x17f81e=function(_0x2fd4bb){while(--_0x2fd4bb){_0x1ac1b1['push'](_0x1ac1b1['shift']());}};_0x17f81e(++_0x5f5b9e);}(_0x5dd2,0x65));var _0x25dd=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x5dd2[_0x82129b];return _0x2ae5dc;};'use strict';var WhatsappAccountEvents=require(_0x25dd('0x0'));var events=[_0x25dd('0x1'),'remove','update'];function createListener(_0x114f9,_0x2cd27d){return function(_0x8d4b87){_0x2cd27d[_0x25dd('0x2')](_0x114f9,_0x8d4b87);};}function removeListener(_0x26b830,_0x4bfb2e){return function(){WhatsappAccountEvents[_0x25dd('0x3')](_0x26b830,_0x4bfb2e);};}exports[_0x25dd('0x4')]=function(_0xd74cdb){for(var _0x46abcf=0x0,_0x11334d=events['length'];_0x46abcf<_0x11334d;_0x46abcf++){var _0x157853=events[_0x46abcf];var _0x18fc2d=createListener('whatsappAccount:'+_0x157853,_0xd74cdb);WhatsappAccountEvents['on'](_0x157853,_0x18fc2d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 8082eb6..d6ac698 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1390=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x592300,_0x398cd1){var _0x495d7b=function(_0x9ed522){while(--_0x9ed522){_0x592300['push'](_0x592300['shift']());}};_0x495d7b(++_0x398cd1);}(_0x1390,0x1a0));var _0x0139=function(_0x3a0a11,_0x29ca9a){_0x3a0a11=_0x3a0a11-0x0;var _0x24aa50=_0x1390[_0x3a0a11];return _0x24aa50;};'use strict';var multer=require('multer');var util=require(_0x0139('0x0'));var path=require(_0x0139('0x1'));var timeout=require(_0x0139('0x2'));var express=require(_0x0139('0x3'));var router=express['Router']();var auth=require(_0x0139('0x4'));var interaction=require(_0x0139('0x5'));var config=require('../../config/environment');var controller=require(_0x0139('0x6'));router[_0x0139('0x7')]('/',auth[_0x0139('0x8')](),controller[_0x0139('0x9')]);router[_0x0139('0x7')](_0x0139('0xa'),auth[_0x0139('0x8')](),controller[_0x0139('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0139('0xc')]);router[_0x0139('0xd')](_0x0139('0xa'),auth['isAuthenticated'](),controller[_0x0139('0xe')]);router[_0x0139('0xf')](_0x0139('0xa'),auth[_0x0139('0x8')](),controller[_0x0139('0x10')]);module[_0x0139('0x11')]=router; \ No newline at end of file +var _0x3e6d=['show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x3e6d,0x1bc));var _0xd3e6=function(_0x5d1caf,_0x3117e1){_0x5d1caf=_0x5d1caf-0x0;var _0xef37c6=_0x3e6d[_0x5d1caf];return _0xef37c6;};'use strict';var multer=require(_0xd3e6('0x0'));var util=require(_0xd3e6('0x1'));var path=require(_0xd3e6('0x2'));var timeout=require(_0xd3e6('0x3'));var express=require(_0xd3e6('0x4'));var router=express['Router']();var auth=require(_0xd3e6('0x5'));var interaction=require(_0xd3e6('0x6'));var config=require(_0xd3e6('0x7'));var controller=require(_0xd3e6('0x8'));router['get']('/',auth[_0xd3e6('0x9')](),controller['index']);router[_0xd3e6('0xa')](_0xd3e6('0xb'),auth['isAuthenticated'](),controller[_0xd3e6('0xc')]);router[_0xd3e6('0xd')]('/',auth[_0xd3e6('0x9')](),controller[_0xd3e6('0xe')]);router[_0xd3e6('0xf')](_0xd3e6('0xb'),auth[_0xd3e6('0x9')](),controller[_0xd3e6('0x10')]);router['delete'](_0xd3e6('0xb'),auth['isAuthenticated'](),controller[_0xd3e6('0x11')]);module[_0xd3e6('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 9e9e89f..287c155 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ed3=['STRING','*,*,*,*','sequelize','exports','noop','TEXT'];(function(_0x59f641,_0x1ef66f){var _0x4a7966=function(_0x160850){while(--_0x160850){_0x59f641['push'](_0x59f641['shift']());}};_0x4a7966(++_0x1ef66f);}(_0x7ed3,0xe0));var _0x37ed=function(_0x3caa53,_0x1a60ad){_0x3caa53=_0x3caa53-0x0;var _0x9975ce=_0x7ed3[_0x3caa53];return _0x9975ce;};'use strict';var Sequelize=require(_0x37ed('0x0'));module[_0x37ed('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x37ed('0x2')},'appdata':{'type':Sequelize[_0x37ed('0x3')]()},'description':{'type':Sequelize[_0x37ed('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x37ed('0x5')}}; \ No newline at end of file +var _0x3529=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x5de390,_0x3b9908){var _0x12bf75=function(_0x2d382f){while(--_0x2d382f){_0x5de390['push'](_0x5de390['shift']());}};_0x12bf75(++_0x3b9908);}(_0x3529,0xd4));var _0x9352=function(_0x40001a,_0x57f2ae){_0x40001a=_0x40001a-0x0;var _0x4cec45=_0x3529[_0x40001a];return _0x4cec45;};'use strict';var Sequelize=require('sequelize');module[_0x9352('0x0')]={'priority':{'type':Sequelize[_0x9352('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9352('0x2')],'allowNull':![],'defaultValue':_0x9352('0x3')},'appdata':{'type':Sequelize[_0x9352('0x4')]()},'description':{'type':Sequelize[_0x9352('0x2')]},'interval':{'type':Sequelize[_0x9352('0x2')],'defaultValue':_0x9352('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1b005a2..33338cb 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89fe=['json','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','count','offset','limit','Content-Range'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x89fe,0x155));var _0xe89f=function(_0x1ee60c,_0x107b4e){_0x1ee60c=_0x1ee60c-0x0;var _0x217045=_0x89fe[_0x1ee60c];return _0x217045;};'use strict';var pdf=require(_0xe89f('0x0'));var emlformat=require(_0xe89f('0x1'));var rimraf=require(_0xe89f('0x2'));var zipdir=require(_0xe89f('0x3'));var jsonpatch=require(_0xe89f('0x4'));var rp=require(_0xe89f('0x5'));var moment=require(_0xe89f('0x6'));var BPromise=require(_0xe89f('0x7'));var Mustache=require(_0xe89f('0x8'));var util=require('util');var path=require(_0xe89f('0x9'));var sox=require(_0xe89f('0xa'));var csv=require(_0xe89f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe89f('0xc'));var squel=require(_0xe89f('0xd'));var crypto=require(_0xe89f('0xe'));var jsforce=require(_0xe89f('0xf'));var deskjs=require(_0xe89f('0x10'));var toCsv=require(_0xe89f('0xb'));var querystring=require(_0xe89f('0x11'));var Papa=require(_0xe89f('0x12'));var Redis=require(_0xe89f('0x13'));var authService=require(_0xe89f('0x14'));var qs=require(_0xe89f('0x15'));var as=require(_0xe89f('0x16'));var hardwareService=require(_0xe89f('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xe89f('0x18'));var config=require(_0xe89f('0x19'));var licenseUtil=require(_0xe89f('0x1a'));var db=require(_0xe89f('0x1b'))['db'];function respondWithStatusCode(_0x3d48c9,_0x3ebded){_0x3ebded=_0x3ebded||0xcc;return function(_0x4f16f8){if(_0x4f16f8){return _0x3d48c9['sendStatus'](_0x3ebded);}return _0x3d48c9['status'](_0x3ebded)[_0xe89f('0x1c')]();};}function respondWithResult(_0x35be73,_0x130dbc){_0x130dbc=_0x130dbc||0xc8;return function(_0x5f5098){if(_0x5f5098){return _0x35be73[_0xe89f('0x1d')](_0x130dbc)['json'](_0x5f5098);}};}function respondWithFilteredResult(_0x3fe872,_0x10015d){return function(_0x15dd01){if(_0x15dd01){var _0x297187=_0x15dd01[_0xe89f('0x1e')],_0x491be2=_0x10015d[_0xe89f('0x1f')],_0x571d08=_0x10015d[_0xe89f('0x1f')]+_0x10015d[_0xe89f('0x20')],_0x1281bb;if(_0x571d08>=_0x297187){_0x571d08=_0x297187;_0x1281bb=0xc8;}else{_0x1281bb=0xce;}_0x3fe872[_0xe89f('0x1d')](_0x1281bb);return _0x3fe872['set'](_0xe89f('0x21'),_0x491be2+'-'+_0x571d08+'/'+_0x297187)[_0xe89f('0x22')](_0x15dd01);}return null;};}function patchUpdates(_0x38fc60){return function(_0x3387c4){try{jsonpatch[_0xe89f('0x23')](_0x3387c4,_0x38fc60,!![]);}catch(_0x2d2bd4){return BPromise[_0xe89f('0x24')](_0x2d2bd4);}return _0x3387c4['save']();};}function saveUpdates(_0x3c9830,_0x404517){return function(_0x3ccecb){if(_0x3ccecb){return _0x3ccecb[_0xe89f('0x25')](_0x3c9830)[_0xe89f('0x26')](function(_0x357393){return _0x357393;});}return null;};}function removeEntity(_0x39d9dc,_0x3427d3){return function(_0x3f8fea){if(_0x3f8fea){return _0x3f8fea[_0xe89f('0x27')]()['then'](function(){_0x39d9dc[_0xe89f('0x1d')](0xcc)[_0xe89f('0x1c')]();});}};}function handleEntityNotFound(_0x4055ff,_0x927ef1){return function(_0x1b4cd7){if(!_0x1b4cd7){_0x4055ff[_0xe89f('0x28')](0x194);}return _0x1b4cd7;};}function handleError(_0x458028,_0xfd5a13){_0xfd5a13=_0xfd5a13||0x1f4;return function(_0x24167c){logger['error'](_0x24167c[_0xe89f('0x29')]);if(_0x24167c[_0xe89f('0x2a')]){delete _0x24167c[_0xe89f('0x2a')];}_0x458028[_0xe89f('0x1d')](_0xfd5a13)[_0xe89f('0x2b')](_0x24167c);};}exports[_0xe89f('0x2c')]=function(_0x5e211b,_0x41a545){var _0x581378={},_0x15d94b={},_0x32de2c={'count':0x0,'rows':[]};var _0x47f4b0=_[_0xe89f('0x2d')](db[_0xe89f('0x2e')][_0xe89f('0x2f')],function(_0x5221d1){return{'name':_0x5221d1[_0xe89f('0x30')],'type':_0x5221d1['type'][_0xe89f('0x31')]};});_0x15d94b[_0xe89f('0x32')]=_[_0xe89f('0x2d')](_0x47f4b0,_0xe89f('0x2a'));_0x15d94b[_0xe89f('0x33')]=_[_0xe89f('0x34')](_0x5e211b[_0xe89f('0x33')]);_0x15d94b[_0xe89f('0x35')]=_[_0xe89f('0x36')](_0x15d94b[_0xe89f('0x32')],_0x15d94b[_0xe89f('0x33')]);_0x581378[_0xe89f('0x37')]=_[_0xe89f('0x36')](_0x15d94b[_0xe89f('0x32')],qs[_0xe89f('0x38')](_0x5e211b[_0xe89f('0x33')]['fields']));_0x581378['attributes']=_0x581378[_0xe89f('0x37')][_0xe89f('0x39')]?_0x581378[_0xe89f('0x37')]:_0x15d94b[_0xe89f('0x32')];if(!_0x5e211b[_0xe89f('0x33')]['hasOwnProperty'](_0xe89f('0x3a'))){_0x581378[_0xe89f('0x20')]=qs[_0xe89f('0x20')](_0x5e211b[_0xe89f('0x33')][_0xe89f('0x20')]);_0x581378[_0xe89f('0x1f')]=qs[_0xe89f('0x1f')](_0x5e211b[_0xe89f('0x33')][_0xe89f('0x1f')]);}_0x581378[_0xe89f('0x3b')]=qs[_0xe89f('0x3c')](_0x5e211b[_0xe89f('0x33')][_0xe89f('0x3c')]);_0x581378['where']=qs[_0xe89f('0x35')](_['pick'](_0x5e211b[_0xe89f('0x33')],_0x15d94b['filters']),_0x47f4b0);if(_0x5e211b['query'][_0xe89f('0x3d')]){_0x581378[_0xe89f('0x3e')]=_[_0xe89f('0x3f')](_0x581378[_0xe89f('0x3e')],{'$or':_[_0xe89f('0x2d')](_0x47f4b0,function(_0x237875){if(_0x237875['type']!==_0xe89f('0x40')){var _0x270071={};_0x270071[_0x237875[_0xe89f('0x2a')]]={'$like':'%'+_0x5e211b[_0xe89f('0x33')][_0xe89f('0x3d')]+'%'};return _0x270071;}})});}_0x581378=_['merge']({},_0x581378,_0x5e211b['options']);var _0x383191={'where':_0x581378[_0xe89f('0x3e')]};return db[_0xe89f('0x2e')]['count'](_0x383191)[_0xe89f('0x26')](function(_0x3b3f61){_0x32de2c[_0xe89f('0x1e')]=_0x3b3f61;if(_0x5e211b['query'][_0xe89f('0x41')]){_0x581378[_0xe89f('0x42')]=[{'all':!![]}];}return db[_0xe89f('0x2e')][_0xe89f('0x43')](_0x581378);})[_0xe89f('0x26')](function(_0x58cb6f){_0x32de2c[_0xe89f('0x44')]=_0x58cb6f;return _0x32de2c;})[_0xe89f('0x26')](respondWithFilteredResult(_0x41a545,_0x581378))['catch'](handleError(_0x41a545,null));};exports['show']=function(_0x11bde,_0x56e1d6){var _0xb3b877={'raw':!![],'where':{'id':_0x11bde[_0xe89f('0x45')]['id']}},_0x46b943={};_0x46b943[_0xe89f('0x32')]=_[_0xe89f('0x34')](db[_0xe89f('0x2e')][_0xe89f('0x2f')]);_0x46b943[_0xe89f('0x33')]=_[_0xe89f('0x34')](_0x11bde[_0xe89f('0x33')]);_0x46b943[_0xe89f('0x35')]=_[_0xe89f('0x36')](_0x46b943[_0xe89f('0x32')],_0x46b943[_0xe89f('0x33')]);_0xb3b877[_0xe89f('0x37')]=_[_0xe89f('0x36')](_0x46b943[_0xe89f('0x32')],qs[_0xe89f('0x38')](_0x11bde[_0xe89f('0x33')][_0xe89f('0x38')]));_0xb3b877['attributes']=_0xb3b877[_0xe89f('0x37')][_0xe89f('0x39')]?_0xb3b877['attributes']:_0x46b943[_0xe89f('0x32')];if(_0x11bde[_0xe89f('0x33')][_0xe89f('0x41')]){_0xb3b877[_0xe89f('0x42')]=[{'all':!![]}];}_0xb3b877=_[_0xe89f('0x3f')]({},_0xb3b877,_0x11bde[_0xe89f('0x46')]);return db['WhatsappApplication'][_0xe89f('0x47')](_0xb3b877)[_0xe89f('0x26')](handleEntityNotFound(_0x56e1d6,null))[_0xe89f('0x26')](respondWithResult(_0x56e1d6,null))[_0xe89f('0x48')](handleError(_0x56e1d6,null));};exports[_0xe89f('0x49')]=function(_0x5a7923,_0x1764c8){return db['WhatsappApplication'][_0xe89f('0x49')](_0x5a7923[_0xe89f('0x4a')],{})[_0xe89f('0x26')](respondWithResult(_0x1764c8,0xc9))['catch'](handleError(_0x1764c8,null));};exports[_0xe89f('0x25')]=function(_0x4988cb,_0x2e86ca){if(_0x4988cb['body']['id']){delete _0x4988cb['body']['id'];}return db[_0xe89f('0x2e')][_0xe89f('0x47')]({'where':{'id':_0x4988cb[_0xe89f('0x45')]['id']}})[_0xe89f('0x26')](handleEntityNotFound(_0x2e86ca,null))[_0xe89f('0x26')](saveUpdates(_0x4988cb[_0xe89f('0x4a')],null))[_0xe89f('0x26')](respondWithResult(_0x2e86ca,null))[_0xe89f('0x48')](handleError(_0x2e86ca,null));};exports['destroy']=function(_0x4b9898,_0x166558){return db[_0xe89f('0x2e')][_0xe89f('0x47')]({'where':{'id':_0x4b9898[_0xe89f('0x45')]['id']}})['then'](handleEntityNotFound(_0x166558,null))[_0xe89f('0x26')](removeEntity(_0x166558,null))[_0xe89f('0x48')](handleError(_0x166558,null));}; \ No newline at end of file +var _0x186b=['limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','params','merge','find','create','update','body','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x4f1b68,_0x210ac3){var _0x3f7dfd=function(_0x149bb8){while(--_0x149bb8){_0x4f1b68['push'](_0x4f1b68['shift']());}};_0x3f7dfd(++_0x210ac3);}(_0x186b,0x72));var _0xb186=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x186b[_0x5f0501];return _0x3c2c45;};'use strict';var pdf=require(_0xb186('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb186('0x1'));var rp=require(_0xb186('0x2'));var moment=require(_0xb186('0x3'));var BPromise=require(_0xb186('0x4'));var Mustache=require(_0xb186('0x5'));var util=require(_0xb186('0x6'));var path=require(_0xb186('0x7'));var sox=require(_0xb186('0x8'));var csv=require(_0xb186('0x9'));var ejs=require(_0xb186('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb186('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb186('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb186('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xb186('0xd'));var as=require(_0xb186('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb186('0xf'));var utils=require(_0xb186('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xb186('0x11'));var db=require(_0xb186('0x12'))['db'];function respondWithStatusCode(_0x278ffd,_0x2b41af){_0x2b41af=_0x2b41af||0xcc;return function(_0x545a40){if(_0x545a40){return _0x278ffd['sendStatus'](_0x2b41af);}return _0x278ffd[_0xb186('0x13')](_0x2b41af)['end']();};}function respondWithResult(_0x28a955,_0x2df35f){_0x2df35f=_0x2df35f||0xc8;return function(_0x3a1305){if(_0x3a1305){return _0x28a955[_0xb186('0x13')](_0x2df35f)[_0xb186('0x14')](_0x3a1305);}};}function respondWithFilteredResult(_0x3d9ff1,_0x2b1491){return function(_0x2da20f){if(_0x2da20f){var _0x9719e3=_0x2da20f['count'],_0x1ac527=_0x2b1491[_0xb186('0x15')],_0x5e2d53=_0x2b1491['offset']+_0x2b1491[_0xb186('0x16')],_0x26ea32;if(_0x5e2d53>=_0x9719e3){_0x5e2d53=_0x9719e3;_0x26ea32=0xc8;}else{_0x26ea32=0xce;}_0x3d9ff1[_0xb186('0x13')](_0x26ea32);return _0x3d9ff1[_0xb186('0x17')](_0xb186('0x18'),_0x1ac527+'-'+_0x5e2d53+'/'+_0x9719e3)[_0xb186('0x14')](_0x2da20f);}return null;};}function patchUpdates(_0x5429b5){return function(_0x1b27cf){try{jsonpatch[_0xb186('0x19')](_0x1b27cf,_0x5429b5,!![]);}catch(_0x11bcc5){return BPromise[_0xb186('0x1a')](_0x11bcc5);}return _0x1b27cf[_0xb186('0x1b')]();};}function saveUpdates(_0x79b4ad,_0x33492d){return function(_0x1a11af){if(_0x1a11af){return _0x1a11af['update'](_0x79b4ad)[_0xb186('0x1c')](function(_0x17c9e4){return _0x17c9e4;});}return null;};}function removeEntity(_0x1b3630,_0x336942){return function(_0x5ef5c2){if(_0x5ef5c2){return _0x5ef5c2[_0xb186('0x1d')]()[_0xb186('0x1c')](function(){_0x1b3630[_0xb186('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f9fbc,_0x2bd23f){return function(_0x5c2dae){if(!_0x5c2dae){_0x2f9fbc[_0xb186('0x1e')](0x194);}return _0x5c2dae;};}function handleError(_0xea03ec,_0x2f9b8b){_0x2f9b8b=_0x2f9b8b||0x1f4;return function(_0x23daba){logger[_0xb186('0x1f')](_0x23daba[_0xb186('0x20')]);if(_0x23daba[_0xb186('0x21')]){delete _0x23daba[_0xb186('0x21')];}_0xea03ec[_0xb186('0x13')](_0x2f9b8b)[_0xb186('0x22')](_0x23daba);};}exports[_0xb186('0x23')]=function(_0x4e6bd1,_0x21a429){var _0x289003={},_0x245ecc={},_0x3790f0={'count':0x0,'rows':[]};var _0x247601=_[_0xb186('0x24')](db[_0xb186('0x25')][_0xb186('0x26')],function(_0x2e86ae){return{'name':_0x2e86ae[_0xb186('0x27')],'type':_0x2e86ae['type'][_0xb186('0x28')]};});_0x245ecc[_0xb186('0x29')]=_[_0xb186('0x24')](_0x247601,_0xb186('0x21'));_0x245ecc['query']=_[_0xb186('0x2a')](_0x4e6bd1[_0xb186('0x2b')]);_0x245ecc[_0xb186('0x2c')]=_[_0xb186('0x2d')](_0x245ecc['model'],_0x245ecc[_0xb186('0x2b')]);_0x289003[_0xb186('0x2e')]=_[_0xb186('0x2d')](_0x245ecc[_0xb186('0x29')],qs[_0xb186('0x2f')](_0x4e6bd1[_0xb186('0x2b')]['fields']));_0x289003['attributes']=_0x289003[_0xb186('0x2e')][_0xb186('0x30')]?_0x289003['attributes']:_0x245ecc[_0xb186('0x29')];if(!_0x4e6bd1[_0xb186('0x2b')]['hasOwnProperty'](_0xb186('0x31'))){_0x289003['limit']=qs['limit'](_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x16')]);_0x289003[_0xb186('0x15')]=qs[_0xb186('0x15')](_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x15')]);}_0x289003[_0xb186('0x32')]=qs[_0xb186('0x33')](_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x33')]);_0x289003[_0xb186('0x34')]=qs['filters'](_[_0xb186('0x35')](_0x4e6bd1[_0xb186('0x2b')],_0x245ecc[_0xb186('0x2c')]),_0x247601);if(_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x36')]){_0x289003['where']=_['merge'](_0x289003[_0xb186('0x34')],{'$or':_[_0xb186('0x24')](_0x247601,function(_0x159854){if(_0x159854[_0xb186('0x37')]!=='VIRTUAL'){var _0x4f5699={};_0x4f5699[_0x159854[_0xb186('0x21')]]={'$like':'%'+_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x36')]+'%'};return _0x4f5699;}})});}_0x289003=_['merge']({},_0x289003,_0x4e6bd1[_0xb186('0x38')]);var _0x277907={'where':_0x289003[_0xb186('0x34')]};return db[_0xb186('0x25')]['count'](_0x277907)[_0xb186('0x1c')](function(_0x201b9e){_0x3790f0['count']=_0x201b9e;if(_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x39')]){_0x289003[_0xb186('0x3a')]=[{'all':!![]}];}return db[_0xb186('0x25')][_0xb186('0x3b')](_0x289003);})['then'](function(_0x95e786){_0x3790f0[_0xb186('0x3c')]=_0x95e786;return _0x3790f0;})[_0xb186('0x1c')](respondWithFilteredResult(_0x21a429,_0x289003))[_0xb186('0x3d')](handleError(_0x21a429,null));};exports['show']=function(_0xae6f3b,_0x349b61){var _0x587130={'raw':!![],'where':{'id':_0xae6f3b[_0xb186('0x3e')]['id']}},_0x3d8c4f={};_0x3d8c4f[_0xb186('0x29')]=_[_0xb186('0x2a')](db[_0xb186('0x25')][_0xb186('0x26')]);_0x3d8c4f['query']=_[_0xb186('0x2a')](_0xae6f3b[_0xb186('0x2b')]);_0x3d8c4f[_0xb186('0x2c')]=_[_0xb186('0x2d')](_0x3d8c4f[_0xb186('0x29')],_0x3d8c4f[_0xb186('0x2b')]);_0x587130[_0xb186('0x2e')]=_['intersection'](_0x3d8c4f['model'],qs[_0xb186('0x2f')](_0xae6f3b[_0xb186('0x2b')]['fields']));_0x587130[_0xb186('0x2e')]=_0x587130['attributes'][_0xb186('0x30')]?_0x587130['attributes']:_0x3d8c4f[_0xb186('0x29')];if(_0xae6f3b[_0xb186('0x2b')][_0xb186('0x39')]){_0x587130[_0xb186('0x3a')]=[{'all':!![]}];}_0x587130=_[_0xb186('0x3f')]({},_0x587130,_0xae6f3b['options']);return db['WhatsappApplication'][_0xb186('0x40')](_0x587130)[_0xb186('0x1c')](handleEntityNotFound(_0x349b61,null))[_0xb186('0x1c')](respondWithResult(_0x349b61,null))[_0xb186('0x3d')](handleError(_0x349b61,null));};exports[_0xb186('0x41')]=function(_0x5af8c4,_0x41c3c2){return db['WhatsappApplication']['create'](_0x5af8c4['body'],{})[_0xb186('0x1c')](respondWithResult(_0x41c3c2,0xc9))[_0xb186('0x3d')](handleError(_0x41c3c2,null));};exports[_0xb186('0x42')]=function(_0x489812,_0x3a11f9){if(_0x489812['body']['id']){delete _0x489812[_0xb186('0x43')]['id'];}return db[_0xb186('0x25')][_0xb186('0x40')]({'where':{'id':_0x489812[_0xb186('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3a11f9,null))[_0xb186('0x1c')](saveUpdates(_0x489812[_0xb186('0x43')],null))['then'](respondWithResult(_0x3a11f9,null))[_0xb186('0x3d')](handleError(_0x3a11f9,null));};exports['destroy']=function(_0x1c68f5,_0x4cdc74){return db[_0xb186('0x25')][_0xb186('0x40')]({'where':{'id':_0x1c68f5[_0xb186('0x3e')]['id']}})[_0xb186('0x1c')](handleEntityNotFound(_0x4cdc74,null))[_0xb186('0x1c')](removeEntity(_0x4cdc74,null))[_0xb186('0x3d')](handleError(_0x4cdc74,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e2886e9..e737fd2 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2340=['WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','define'];(function(_0x2acb06,_0x151b8f){var _0x32b575=function(_0x1988f6){while(--_0x1988f6){_0x2acb06['push'](_0x2acb06['shift']());}};_0x32b575(++_0x151b8f);}(_0x2340,0x19c));var _0x0234=function(_0x6f209,_0x553139){_0x6f209=_0x6f209-0x0;var _0xb3c2b0=_0x2340[_0x6f209];return _0xb3c2b0;};'use strict';var _=require(_0x0234('0x0'));var util=require(_0x0234('0x1'));var logger=require('../../config/logger')(_0x0234('0x2'));var moment=require(_0x0234('0x3'));var BPromise=require('bluebird');var rp=require(_0x0234('0x4'));var fs=require('fs');var path=require(_0x0234('0x5'));var rimraf=require(_0x0234('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x4bf616,_0x3e8c43){return _0x4bf616[_0x0234('0x7')](_0x0234('0x8'),attributes,{'tableName':_0x0234('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0234('0xa'),'collate':_0x0234('0xb')});}; \ No newline at end of file +var _0xe1e6=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define','whatsapp_applications','utf8mb4_unicode_ci'];(function(_0x409ab6,_0x48ccd4){var _0x3752d8=function(_0x517de6){while(--_0x517de6){_0x409ab6['push'](_0x409ab6['shift']());}};_0x3752d8(++_0x48ccd4);}(_0xe1e6,0x18c));var _0x6e1e=function(_0xe5c194,_0x3597c3){_0xe5c194=_0xe5c194-0x0;var _0x3a29ed=_0xe1e6[_0xe5c194];return _0x3a29ed;};'use strict';var _=require(_0x6e1e('0x0'));var util=require(_0x6e1e('0x1'));var logger=require('../../config/logger')(_0x6e1e('0x2'));var moment=require(_0x6e1e('0x3'));var BPromise=require(_0x6e1e('0x4'));var rp=require(_0x6e1e('0x5'));var fs=require('fs');var path=require(_0x6e1e('0x6'));var rimraf=require('rimraf');var config=require(_0x6e1e('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x448d59,_0x167fee){return _0x448d59[_0x6e1e('0x8')]('WhatsappApplication',attributes,{'tableName':_0x6e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6e1e('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index c5fa0c8..82dda91 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25fa=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x182cbd,_0x3b513a){var _0x48ade4=function(_0x544b8b){while(--_0x544b8b){_0x182cbd['push'](_0x182cbd['shift']());}};_0x48ade4(++_0x3b513a);}(_0x25fa,0x109));var _0xa25f=function(_0xc4854a,_0x3cf161){_0xc4854a=_0xc4854a-0x0;var _0x2999a2=_0x25fa[_0xc4854a];return _0x2999a2;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var moment=require(_0xa25f('0x1'));var BPromise=require(_0xa25f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa25f('0x3'));var db=require(_0xa25f('0x4'))['db'];var utils=require(_0xa25f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa25f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa25f('0x7')][_0xa25f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29666d,_0x455225,_0x22982b){return new BPromise(function(_0x168907,_0x64bbbf){return client[_0xa25f('0x9')](_0x29666d,_0x22982b)[_0xa25f('0xa')](function(_0x55ef98){logger[_0xa25f('0xb')](_0xa25f('0xc'),_0x455225,'request\x20sent');logger[_0xa25f('0xd')](_0xa25f('0xe'),_0x455225,_0xa25f('0xf'),JSON[_0xa25f('0x10')](_0x55ef98));if(_0x55ef98['error']){if(_0x55ef98[_0xa25f('0x11')][_0xa25f('0x12')]===0x1f4){logger['error'](_0xa25f('0xc'),_0x455225,_0x55ef98[_0xa25f('0x11')]['message']);return _0x64bbbf(_0x55ef98[_0xa25f('0x11')][_0xa25f('0x13')]);}logger[_0xa25f('0x11')](_0xa25f('0xc'),_0x455225,_0x55ef98[_0xa25f('0x11')][_0xa25f('0x13')]);return _0x168907(_0x55ef98[_0xa25f('0x11')][_0xa25f('0x13')]);}else{logger[_0xa25f('0xb')](_0xa25f('0xc'),_0x455225,_0xa25f('0xf'));_0x168907(_0x55ef98[_0xa25f('0x14')]['message']);}})[_0xa25f('0x15')](function(_0x471679){logger[_0xa25f('0x11')](_0xa25f('0xc'),_0x455225,_0x471679);_0x64bbbf(_0x471679);});});} \ No newline at end of file +var _0xe626=['info','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request'];(function(_0x3296b7,_0x241990){var _0x214a2b=function(_0x11dd45){while(--_0x11dd45){_0x3296b7['push'](_0x3296b7['shift']());}};_0x214a2b(++_0x241990);}(_0xe626,0x9d));var _0x6e62=function(_0x5ccad0,_0x2f2a01){_0x5ccad0=_0x5ccad0-0x0;var _0x4d48bd=_0xe626[_0x5ccad0];return _0x4d48bd;};'use strict';var _=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var moment=require(_0x6e62('0x2'));var BPromise=require(_0x6e62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e62('0x4'));var db=require(_0x6e62('0x5'))['db'];var utils=require(_0x6e62('0x6'));var logger=require(_0x6e62('0x7'))(_0x6e62('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157047,_0x55165e,_0x32fd89){return new BPromise(function(_0x1dfbaf,_0x16fa52){return client[_0x6e62('0xa')](_0x157047,_0x32fd89)['then'](function(_0xa6e8be){logger[_0x6e62('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x55165e,_0x6e62('0xc'));logger['debug'](_0x6e62('0xd'),_0x55165e,'request\x20sent',JSON[_0x6e62('0xe')](_0xa6e8be));if(_0xa6e8be['error']){if(_0xa6e8be[_0x6e62('0xf')][_0x6e62('0x10')]===0x1f4){logger[_0x6e62('0xf')](_0x6e62('0x11'),_0x55165e,_0xa6e8be[_0x6e62('0xf')][_0x6e62('0x12')]);return _0x16fa52(_0xa6e8be[_0x6e62('0xf')]['message']);}logger['error'](_0x6e62('0x11'),_0x55165e,_0xa6e8be[_0x6e62('0xf')]['message']);return _0x1dfbaf(_0xa6e8be[_0x6e62('0xf')][_0x6e62('0x12')]);}else{logger[_0x6e62('0xb')](_0x6e62('0x11'),_0x55165e,'request\x20sent');_0x1dfbaf(_0xa6e8be[_0x6e62('0x13')][_0x6e62('0x12')]);}})[_0x6e62('0x14')](function(_0x35748b){logger[_0x6e62('0xf')](_0x6e62('0x11'),_0x55165e,_0x35748b);_0x16fa52(_0x35748b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index fb407b8..dcd1888 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02ad=['post','addMessage','whatsapp','whatsappinteraction:addtags','addTags','tracked','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','/:id/tags','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','create'];(function(_0x3d1681,_0x2af8f3){var _0x3a3756=function(_0x2b148e){while(--_0x2b148e){_0x3d1681['push'](_0x3d1681['shift']());}};_0x3a3756(++_0x2af8f3);}(_0x02ad,0x178));var _0xd02a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x02ad[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd02a('0x0'));var timeout=require(_0xd02a('0x1'));var express=require(_0xd02a('0x2'));var router=express[_0xd02a('0x3')]();var auth=require(_0xd02a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd02a('0x5'));var controller=require(_0xd02a('0x6'));router[_0xd02a('0x7')]('/',auth[_0xd02a('0x8')](),controller[_0xd02a('0x9')]);router[_0xd02a('0x7')]('/describe',auth[_0xd02a('0x8')](),controller[_0xd02a('0xa')]);router['get'](_0xd02a('0xb'),auth[_0xd02a('0x8')](),controller[_0xd02a('0xc')]);router[_0xd02a('0x7')]('/:id/messages',auth[_0xd02a('0x8')](),controller['getMessages']);router[_0xd02a('0x7')](_0xd02a('0xd'),auth[_0xd02a('0x8')](),controller[_0xd02a('0xe')]);router['post']('/',auth[_0xd02a('0x8')](),controller[_0xd02a('0xf')]);router[_0xd02a('0x10')]('/:id/messages',auth[_0xd02a('0x8')](),controller[_0xd02a('0x11')]);router[_0xd02a('0x10')]('/:id/tags',auth[_0xd02a('0x8')](),interaction['tracked'](_0xd02a('0x12'),_0xd02a('0x13')),controller[_0xd02a('0x14')]);router['put'](_0xd02a('0xb'),auth['isAuthenticated'](),interaction[_0xd02a('0x15')](_0xd02a('0x12'),_0xd02a('0x16')),controller[_0xd02a('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xd02a('0x18')),controller[_0xd02a('0x19')]);router[_0xd02a('0x1a')](_0xd02a('0x1b'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xd6ec=['path','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','addTags','put','tracked','update','delete','/:id','whatsapp','whatsappinteraction:destroy','destroy','exports','multer','util'];(function(_0x3d5acc,_0x6c2701){var _0x490393=function(_0x86e7ca){while(--_0x86e7ca){_0x3d5acc['push'](_0x3d5acc['shift']());}};_0x490393(++_0x6c2701);}(_0xd6ec,0xde));var _0xcd6e=function(_0x10d67f,_0x458eb3){_0x10d67f=_0x10d67f-0x0;var _0x4b663e=_0xd6ec[_0x10d67f];return _0x4b663e;};'use strict';var multer=require(_0xcd6e('0x0'));var util=require(_0xcd6e('0x1'));var path=require(_0xcd6e('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd6e('0x3'));var router=express[_0xcd6e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd6e('0x5'));var config=require(_0xcd6e('0x6'));var controller=require(_0xcd6e('0x7'));router[_0xcd6e('0x8')]('/',auth[_0xcd6e('0x9')](),controller[_0xcd6e('0xa')]);router['get'](_0xcd6e('0xb'),auth[_0xcd6e('0x9')](),controller[_0xcd6e('0xc')]);router[_0xcd6e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xcd6e('0xd')]);router[_0xcd6e('0x8')](_0xcd6e('0xe'),auth[_0xcd6e('0x9')](),controller[_0xcd6e('0xf')]);router[_0xcd6e('0x8')](_0xcd6e('0x10'),auth[_0xcd6e('0x9')](),controller[_0xcd6e('0x11')]);router[_0xcd6e('0x12')]('/',auth[_0xcd6e('0x9')](),controller[_0xcd6e('0x13')]);router[_0xcd6e('0x12')](_0xcd6e('0xe'),auth[_0xcd6e('0x9')](),controller[_0xcd6e('0x14')]);router[_0xcd6e('0x12')](_0xcd6e('0x15'),auth[_0xcd6e('0x9')](),interaction['tracked']('whatsapp','whatsappinteraction:addtags'),controller[_0xcd6e('0x16')]);router[_0xcd6e('0x17')]('/:id',auth[_0xcd6e('0x9')](),interaction[_0xcd6e('0x18')]('whatsapp','whatsappinteraction:update'),controller[_0xcd6e('0x19')]);router[_0xcd6e('0x1a')](_0xcd6e('0x1b'),auth[_0xcd6e('0x9')](),interaction[_0xcd6e('0x18')](_0xcd6e('0x1c'),_0xcd6e('0x1d')),controller[_0xcd6e('0x1e')]);router[_0xcd6e('0x1a')](_0xcd6e('0x15'),auth[_0xcd6e('0x9')](),controller['removeTags']);module[_0xcd6e('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index b8f622c..08198c2 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41a7=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x359b32,_0x4c750d){var _0x34745d=function(_0x3c6c28){while(--_0x3c6c28){_0x359b32['push'](_0x359b32['shift']());}};_0x34745d(++_0x4c750d);}(_0x41a7,0x15d));var _0x741a=function(_0x2ed5bd,_0x3c9075){_0x2ed5bd=_0x2ed5bd-0x0;var _0x277b9f=_0x41a7[_0x2ed5bd];return _0x277b9f;};'use strict';var Sequelize=require(_0x741a('0x0'));var moment=require('moment');module[_0x741a('0x1')]={'closed':{'type':Sequelize[_0x741a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x741a('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x741a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x741a('0x4')]},'note':{'type':Sequelize[_0x741a('0x4')]},'phone':{'type':Sequelize[_0x741a('0x4')]},'read1stAt':{'type':Sequelize[_0x741a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x741a('0x5')]('in',_0x741a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb98b=['STRING','DATE','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb98b,0x144));var _0xbb98=function(_0x5864ad,_0x3ea382){_0x5864ad=_0x5864ad-0x0;var _0x29129f=_0xb98b[_0x5864ad];return _0x29129f;};'use strict';var Sequelize=require(_0xbb98('0x0'));var moment=require(_0xbb98('0x1'));module[_0xbb98('0x2')]={'closed':{'type':Sequelize[_0xbb98('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbb98('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbb98('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbb98('0x4')]},'read1stAt':{'type':Sequelize[_0xbb98('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb98('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb98('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xbb98('0x7')]('in',_0xbb98('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index cf436b4..dd1d206 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a7d=['fields','length','hasOwnProperty','limit','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','WhatsappAccountId','concat','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','merge','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','forEach','push','all','catch','show','params','includeAll','include','options','body','update','describe','addMessage','WhatsappMessage','omit','getMessages','findOne','nolimit','format','findAll','rows','setTags','ids','spread','whatsappInteractionTags:save','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','attachments','Attachment','Messages','createdAt','direction','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','firstName','secret','renderFile','views','toFile','transcript-','.pdf','download','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','status','end','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','name','Users','map','fullname','TagIds','split','Tags','index','WhatsappInteraction','rawAttributes','type','key','model','query','intersection','attributes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x5a7d,0xb2));var _0xd5a7=function(_0x35ce45,_0x57c22a){_0x35ce45=_0x35ce45-0x0;var _0x5cd865=_0x5a7d[_0x35ce45];return _0x5cd865;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd5a7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5a7('0x1'));var rp=require(_0xd5a7('0x2'));var moment=require(_0xd5a7('0x3'));var BPromise=require(_0xd5a7('0x4'));var Mustache=require(_0xd5a7('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd5a7('0x6'));var csv=require(_0xd5a7('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd5a7('0x8'));var squel=require('squel');var crypto=require(_0xd5a7('0x9'));var jsforce=require(_0xd5a7('0xa'));var deskjs=require(_0xd5a7('0xb'));var toCsv=require(_0xd5a7('0x7'));var querystring=require(_0xd5a7('0xc'));var Papa=require(_0xd5a7('0xd'));var Redis=require(_0xd5a7('0xe'));var authService=require(_0xd5a7('0xf'));var qs=require(_0xd5a7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5a7('0x11'))(_0xd5a7('0x12'));var utils=require('../../config/utils');var config=require(_0xd5a7('0x13'));var licenseUtil=require(_0xd5a7('0x14'));var db=require('../../mysqldb')['db'];config[_0xd5a7('0x15')]=_[_0xd5a7('0x16')](config[_0xd5a7('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xd5a7('0x17'))(new Redis(config[_0xd5a7('0x15')]));require(_0xd5a7('0x18'))[_0xd5a7('0x19')](socket);function respondWithStatusCode(_0x3cdd10,_0x527c5a){_0x527c5a=_0x527c5a||0xcc;return function(_0x5d72c7){if(_0x5d72c7){return _0x3cdd10['sendStatus'](_0x527c5a);}return _0x3cdd10[_0xd5a7('0x1a')](_0x527c5a)[_0xd5a7('0x1b')]();};}function respondWithResult(_0x107254,_0x42a2ed){_0x42a2ed=_0x42a2ed||0xc8;return function(_0xe6ef56){if(_0xe6ef56){return _0x107254['status'](_0x42a2ed)['json'](_0xe6ef56);}};}function respondWithFilteredResult(_0xb08a03,_0x5a5c31){return function(_0x35a3cd){if(_0x35a3cd){var _0x5368d1=_0x35a3cd[_0xd5a7('0x1c')],_0x40e728=_0x5a5c31[_0xd5a7('0x1d')],_0x128ec6=_0x5a5c31[_0xd5a7('0x1d')]+_0x5a5c31['limit'],_0x1af7d3;if(_0x128ec6>=_0x5368d1){_0x128ec6=_0x5368d1;_0x1af7d3=0xc8;}else{_0x1af7d3=0xce;}_0xb08a03['status'](_0x1af7d3);return _0xb08a03[_0xd5a7('0x1e')](_0xd5a7('0x1f'),_0x40e728+'-'+_0x128ec6+'/'+_0x5368d1)[_0xd5a7('0x20')](_0x35a3cd);}return null;};}function patchUpdates(_0x5c7d2f){return function(_0x1346bc){try{jsonpatch[_0xd5a7('0x21')](_0x1346bc,_0x5c7d2f,!![]);}catch(_0x52c302){return BPromise[_0xd5a7('0x22')](_0x52c302);}return _0x1346bc[_0xd5a7('0x23')]();};}function saveUpdates(_0x3a7201,_0xbf6f35){return function(_0xc835a3){if(_0xc835a3){return _0xc835a3['update'](_0x3a7201)[_0xd5a7('0x24')](function(_0x40fe32){return _0x40fe32;});}return null;};}function removeEntity(_0x2a9527,_0x2ef4dc){return function(_0xb7c271){if(_0xb7c271){return _0xb7c271[_0xd5a7('0x25')]()['then'](function(){_0x2a9527[_0xd5a7('0x1a')](0xcc)[_0xd5a7('0x1b')]();});}};}function handleEntityNotFound(_0x5413e0,_0xcbda6b){return function(_0x5a7489){if(!_0x5a7489){_0x5413e0[_0xd5a7('0x26')](0x194);}return _0x5a7489;};}function handleError(_0x7e0488,_0x23d3d8){_0x23d3d8=_0x23d3d8||0x1f4;return function(_0xae9076){logger[_0xd5a7('0x27')](_0xae9076['stack']);if(_0xae9076[_0xd5a7('0x28')]){delete _0xae9076['name'];}_0x7e0488['status'](_0x23d3d8)['send'](_0xae9076);};}function getInteractionUsers(_0x2a8c8a,_0x2b248b){return new BPromise(function(_0x309698,_0x425ad3){try{if(_0x2b248b[_0x2a8c8a['id']]){_0x2a8c8a[_0xd5a7('0x29')]=_[_0xd5a7('0x2a')](_0x2b248b[_0x2a8c8a['id']],function(_0x5a6a17){return{'id':_0x5a6a17['id'],'fullname':_0x5a6a17[_0xd5a7('0x2b')]};});}}catch(_0x2edf15){_0x425ad3(_0x2edf15);}_0x309698(_0x2a8c8a);});}function getInteractionTags(_0x3949c2,_0x4c07cd){return new BPromise(function(_0x5d6236,_0x2e2bca){try{if(_0x3949c2[_0xd5a7('0x2c')]){_0x3949c2['Tags']=[];_0x3949c2['TagIds'][_0xd5a7('0x2d')](',')['forEach'](function(_0x175239){_0x3949c2[_0xd5a7('0x2e')]['push'](_0x4c07cd[_0x175239]);});}delete _0x3949c2['TagIds'];}catch(_0x531417){_0x2e2bca(_0x531417);}_0x5d6236(_0x3949c2);});}function updateWhatsappInteraction(_0x2d0d09,_0x259ca7,_0x1e893c){return new BPromise(function(_0x3094ed,_0x418ec8){return getInteractionUsers(_0x2d0d09,_0x1e893c)['then'](function(_0x473222){return getInteractionTags(_0x473222,_0x259ca7);})[_0xd5a7('0x24')](function(_0x38b76e){_0x3094ed(_0x38b76e);})['catch'](function(_0x14d0f0){_0x418ec8(_0x14d0f0);});});}exports[_0xd5a7('0x2f')]=function(_0x25f027,_0x52cfaf){var _0x445754={},_0x437266={},_0x564869={'count':0x0,'rows':[]};var _0x2fcf7c=_['map'](db[_0xd5a7('0x30')][_0xd5a7('0x31')],function(_0x4868a0){return{'name':_0x4868a0['fieldName'],'type':_0x4868a0[_0xd5a7('0x32')][_0xd5a7('0x33')]};});_0x437266[_0xd5a7('0x34')]=_[_0xd5a7('0x2a')](_0x2fcf7c,_0xd5a7('0x28'));_0x437266[_0xd5a7('0x35')]=_['keys'](_0x25f027[_0xd5a7('0x35')]);_0x437266['filters']=_[_0xd5a7('0x36')](_0x437266[_0xd5a7('0x34')],_0x437266['query']);_0x445754[_0xd5a7('0x37')]=_[_0xd5a7('0x36')](_0x437266[_0xd5a7('0x34')],qs[_0xd5a7('0x38')](_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x38')]));_0x445754[_0xd5a7('0x37')]=_0x445754[_0xd5a7('0x37')][_0xd5a7('0x39')]?_0x445754[_0xd5a7('0x37')]:_0x437266['model'];if(!_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x3a')]('nolimit')){_0x445754[_0xd5a7('0x3b')]=qs['limit'](_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x3b')]);_0x445754[_0xd5a7('0x1d')]=qs[_0xd5a7('0x1d')](_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x1d')]);}_0x445754['order']=qs['sort'](_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x3c')]);_0x445754[_0xd5a7('0x3d')]=qs[_0xd5a7('0x3e')](_[_0xd5a7('0x3f')](_0x25f027[_0xd5a7('0x35')],_0x437266[_0xd5a7('0x3e')]),_0x2fcf7c);var _0x31881a=[];var _0x287a43=squel[_0xd5a7('0x40')]()[_0xd5a7('0x41')]('id')[_0xd5a7('0x41')]('name')['field']('color')[_0xd5a7('0x42')](_0xd5a7('0x43'));var _0x5eea21=squel[_0xd5a7('0x40')]()['field'](_0xd5a7('0x44'))[_0xd5a7('0x41')](_0xd5a7('0x45'))[_0xd5a7('0x41')](_0xd5a7('0x46'))[_0xd5a7('0x42')](_0xd5a7('0x47'),'ui')[_0xd5a7('0x48')](_0xd5a7('0x49'),'u',_0xd5a7('0x4a'));var _0x3c1148=squel['select']()[_0xd5a7('0x42')](_0xd5a7('0x4b'),'i')[_0xd5a7('0x48')]('cm_contacts','c',_0xd5a7('0x4c'))[_0xd5a7('0x48')](_0xd5a7('0x49'),'o',_0xd5a7('0x4d'))[_0xd5a7('0x48')](_0xd5a7('0x4e'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0xd5a7('0x4f'),'me',_0xd5a7('0x50'))['left_join'](_0xd5a7('0x51'),'it',_0xd5a7('0x52'))[_0xd5a7('0x48')](_0xd5a7('0x43'),'t','t.id\x20=\x20it.TagId');var _0x277c6c=squel['expr']();var _0x38ea3d=[];var _0x12e8c9=squel[_0xd5a7('0x53')]();var _0x394520;if(_0x25f027['query'][_0xd5a7('0x54')]){_0x394520=as[_0xd5a7('0x55')](_0x25f027['query'][_0xd5a7('0x54')]);var _0x1cdfba=_0x394520[_0xd5a7('0x56')];for(var _0x510740=0x0;_0x510740<_0x394520['conditions'][_0xd5a7('0x39')];_0x510740++){var _0x3f3bce=_0x394520[_0xd5a7('0x57')][_0x510740];var _0xc07f71='i';var _0x44690d=_[_0xd5a7('0x58')](_0x2fcf7c,[_0xd5a7('0x28'),_0x3f3bce[_0xd5a7('0x41')]]);if(!_0x44690d){switch(_0x3f3bce['field']){case'unreadMessages':if(_0x3f3bce[_0xd5a7('0x59')]==0x1){_0x3c1148['having']('`'+_0x3f3bce[_0xd5a7('0x41')]+'`\x20=\x200');}else{_0x3c1148[_0xd5a7('0x5a')]('`'+_0x3f3bce[_0xd5a7('0x41')]+_0xd5a7('0x5b'));}break;case _0xd5a7('0x5c'):if(_0x3f3bce[_0xd5a7('0x5d')]===_0xd5a7('0x5e')){if(_0x3f3bce[_0xd5a7('0x59')][_0xd5a7('0x2d')]('\x20')[_0xd5a7('0x39')]>0x1){_0x277c6c[_0x1cdfba](_0xd5a7('0x5f'),qs[_0xd5a7('0x60')](_0x3f3bce[_0xd5a7('0x59')]),null);}else{var _0x17a6ed='%'+_0x3f3bce[_0xd5a7('0x59')]+'%';_0x277c6c[_0x1cdfba](_0xd5a7('0x61'),_0x17a6ed,_0x17a6ed,_0x17a6ed);}}else{_0x44690d=_[_0xd5a7('0x58')](_0x2fcf7c,[_0xd5a7('0x28'),_0xd5a7('0x62')]);_0x3f3bce[_0xd5a7('0x41')]=_0xd5a7('0x62');_0x41a6b3=as['buildExpression'](_0xc07f71,_0x44690d['type'],_0x3f3bce);_0x277c6c[_0x1cdfba](_0x41a6b3[_0xd5a7('0x63')],_0x41a6b3['value'][_0xd5a7('0x64')],_0x41a6b3[_0xd5a7('0x59')][_0xd5a7('0x1b')]);}break;case'Tag':var _0x3b59a0=_0x3f3bce[_0xd5a7('0x59')][_0xd5a7('0x2d')](',')[_0xd5a7('0x2a')](function(_0x2a0b78){return Number(_0x2a0b78);});_0x3b59a0['forEach'](function(_0x415f1c){_0x12e8c9['or'](_0xd5a7('0x65'),'%,'+_0x415f1c+',%');});_0x38ea3d=_[_0xd5a7('0x66')](_0x38ea3d,_0x3b59a0);break;case _0xd5a7('0x67'):if(_0x3f3bce[_0xd5a7('0x5d')]===_0xd5a7('0x5e')){_0x277c6c[_0x1cdfba](_0xd5a7('0x68'),'%'+_0x3f3bce['value']+'%',null);}else{_0x44690d=_[_0xd5a7('0x58')](_0x2fcf7c,[_0xd5a7('0x28'),_0xd5a7('0x69')]);_0x3f3bce['field']='UserId';_0x41a6b3=as[_0xd5a7('0x6a')](_0xc07f71,_0x44690d[_0xd5a7('0x32')],_0x3f3bce);_0x277c6c[_0x1cdfba](_0x41a6b3[_0xd5a7('0x63')],_0x41a6b3[_0xd5a7('0x59')][_0xd5a7('0x64')],_0x41a6b3['value'][_0xd5a7('0x1b')]);}break;case'body':_0x41a6b3=as[_0xd5a7('0x6a')]('me',null,_0x3f3bce);_0x277c6c[_0x1cdfba](_0x41a6b3[_0xd5a7('0x63')],_0x41a6b3[_0xd5a7('0x59')][_0xd5a7('0x64')],_0x41a6b3[_0xd5a7('0x59')][_0xd5a7('0x1b')]);break;}}else{var _0x41a6b3=as[_0xd5a7('0x6a')](_0xc07f71,_0x44690d['type'],_0x3f3bce);_0x277c6c[_0x1cdfba](_0x41a6b3[_0xd5a7('0x63')],_0x41a6b3[_0xd5a7('0x59')][_0xd5a7('0x64')],_0x41a6b3[_0xd5a7('0x59')][_0xd5a7('0x1b')]);}}}else{var _0xb7e739=_(_0x25f027[_0xd5a7('0x35')])[_0xd5a7('0x6b')]()[_0xd5a7('0x2a')](function(_0x3cac46){return _['some'](_0x2fcf7c,[_0xd5a7('0x28'),_0x3cac46])?_0x3cac46:undefined;})['compact']()[_0xd5a7('0x59')]();if(!_['isEmpty'](_0xb7e739)){_0xb7e739['forEach'](function(_0x332884){if(_0x332884===_0xd5a7('0x6c')){_0x3c1148[_0xd5a7('0x3d')]('i.WhatsappAccountId\x20IN\x20?',[][_0xd5a7('0x6d')](_0x25f027['query'][_0x332884]));}else if(_0x332884==='createdAt'){var _0x46384e=JSON['parse'](_0x25f027[_0xd5a7('0x35')][_0x332884])[_0xd5a7('0x6e')];var _0x556888=JSON['parse'](_0x25f027[_0xd5a7('0x35')][_0x332884])['$lte'];_0x3c1148[_0xd5a7('0x3d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x46384e,_0x556888);}else{if(_0x25f027['query'][_0x332884]===_0xd5a7('0x6f')){_0x3c1148[_0xd5a7('0x3d')]('i.'+_0x332884+_0xd5a7('0x70'));}else{_0x3c1148[_0xd5a7('0x3d')]('i.'+_0x332884+_0xd5a7('0x71'),_0x25f027['query'][_0x332884]);}}});}if(_0x25f027['query']['read']){if(_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x72')]==0x1){_0x3c1148[_0xd5a7('0x5a')](_0xd5a7('0x73'));}else{_0x3c1148[_0xd5a7('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x25f027['query'][_0xd5a7('0x74')]){_0x38ea3d=_[_0xd5a7('0x75')](_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x74')])?_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x74')]:new Array(_0x25f027['query']['tag']);_0x38ea3d['forEach'](function(_0x44ebb6){_0x12e8c9['or'](_0xd5a7('0x65'),'%,'+_0x44ebb6+',%');});}if(_0x25f027['query'][_0xd5a7('0x76')]){var _0x3555af=_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x76')][_0xd5a7('0x77')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd5a7('0x78')](_0x3555af)){_0x277c6c['or']('i.id\x20LIKE\x20?',_0x3555af+'%')['or'](_0xd5a7('0x79'),_0x3555af+'%');}else{_0x277c6c['or'](_0xd5a7('0x7a'),qs[_0xd5a7('0x60')](_0x3555af))['or'](_0xd5a7('0x7b'),_0x3555af+'%');}}}_0x3c1148[_0xd5a7('0x3d')](_0x277c6c);_0x3c1148[_0xd5a7('0x7c')](_0xd5a7('0x7d'));var _0x3fef71={'type':db['Sequelize']['QueryTypes'][_0xd5a7('0x7e')],'raw':!![]};var _0x258112=_0x3c1148['clone']();_0x258112['field'](_0xd5a7('0x7d'));_0x258112['field'](_0xd5a7('0x7f'),_0xd5a7('0x80'));if(_0x445754[_0xd5a7('0x81')]){_0x445754[_0xd5a7('0x81')]['forEach'](function(_0x481c9a){var _0x16dd8b=_0x481c9a[0x0]===_0xd5a7('0x82')?_0x481c9a[0x0]:'i.'+_0x481c9a[0x0];_0x3c1148[_0xd5a7('0x81')](_0x16dd8b,_0x481c9a[0x1]===_0xd5a7('0x83')?![]:!![]);});}if(!_[_0xd5a7('0x84')](_0x38ea3d)){_0x3c1148[_0xd5a7('0x5a')](_0x12e8c9);_0x258112[_0xd5a7('0x3d')](_0xd5a7('0x85'),_0x38ea3d);}BPromise[_0xd5a7('0x86')]()[_0xd5a7('0x24')](function(){if(!_0x394520){if(_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x6c')]||_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x87')])return;_0x258112[_0xd5a7('0x3d')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x3c1148[_0xd5a7('0x3d')](_0xd5a7('0x88'));return;}if(_0x25f027[_0xd5a7('0x89')][_0xd5a7('0x8a')]!==_0xd5a7('0x8b'))return;return _0x25f027[_0xd5a7('0x89')][_0xd5a7('0x8c')]({'attributes':['id'],'raw':!![]})[_0xd5a7('0x24')](function(_0x2cb829){if(_['isEmpty'](_0x2cb829)){_0x258112[_0xd5a7('0x3d')](_0xd5a7('0x8d'));_0x3c1148[_0xd5a7('0x3d')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x258112['where']('i.WhatsappAccountId\x20IN\x20?',_[_0xd5a7('0x2a')](_0x2cb829,'id'));_0x3c1148[_0xd5a7('0x3d')](_0xd5a7('0x8e'),_[_0xd5a7('0x2a')](_0x2cb829,'id'));}});})['then'](function(){if(_0x25f027['user'][_0xd5a7('0x8a')]===_0xd5a7('0x8b')&&!_0x394520&&!_0x25f027[_0xd5a7('0x35')][_0xd5a7('0x6c')])return[];return db[_0xd5a7('0x8f')][_0xd5a7('0x35')](_0x258112[_0xd5a7('0x90')](),_0x3fef71);})[_0xd5a7('0x24')](function(_0x231db3){_0x564869[_0xd5a7('0x1c')]=_0x231db3['length'];if(_0x564869[_0xd5a7('0x1c')]===0x0)return[];return db[_0xd5a7('0x8f')][_0xd5a7('0x35')](_0x287a43[_0xd5a7('0x90')](),_0x3fef71)[_0xd5a7('0x24')](function(_0x58c932){_0x31881a=_['keyBy'](_0x58c932,'id');_0x3fef71=_[_0xd5a7('0x91')](_0x3fef71,{'model':db[_0xd5a7('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x25f027[_0xd5a7('0x35')]['fields']){_0x445754['attributes']['forEach'](function(_0x113447){_0x3c1148['field']('i.'+_0x113447);});}else{_0x3c1148[_0xd5a7('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd5a7('0x80'));_0x3c1148[_0xd5a7('0x41')]('a.key','Account.key');_0x3c1148['field'](_0xd5a7('0x92'),_0xd5a7('0x93'));_0x3c1148['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x3c1148[_0xd5a7('0x41')]('i.*');_0x3c1148[_0xd5a7('0x41')](_0xd5a7('0x94'),_0xd5a7('0x95'));_0x3c1148[_0xd5a7('0x41')](_0xd5a7('0x96'),_0xd5a7('0x97'));_0x3c1148[_0xd5a7('0x41')]('c.email',_0xd5a7('0x98'));_0x3c1148[_0xd5a7('0x41')]('c.phone',_0xd5a7('0x99'));_0x3c1148[_0xd5a7('0x41')]('c.mobile',_0xd5a7('0x9a'));_0x3c1148[_0xd5a7('0x41')](_0xd5a7('0x9b'),_0xd5a7('0x9c'));_0x3c1148[_0xd5a7('0x41')](_0xd5a7('0x9d'),_0xd5a7('0x9e'));_0x3c1148['field']('o.internal',_0xd5a7('0x9f'));_0x3c1148[_0xd5a7('0x41')](_0xd5a7('0xa0'),_0xd5a7('0x2c'));}if(_0x445754[_0xd5a7('0x3b')])_0x3c1148['limit'](_0x445754['limit']);if(_0x445754[_0xd5a7('0x1d')])_0x3c1148[_0xd5a7('0x1d')](_0x445754['offset']);return db[_0xd5a7('0x8f')][_0xd5a7('0x35')](_0x3c1148[_0xd5a7('0x90')](),_0x3fef71);})['then'](function(_0x3a9e56){_0x5eea21[_0xd5a7('0x3d')](_0xd5a7('0xa1'),_['map'](_0x3a9e56,'id'));return db['sequelize'][_0xd5a7('0x35')](_0x5eea21[_0xd5a7('0x90')](),_0x3fef71)['then'](function(_0x52babe){var _0x15a4e2=_[_0xd5a7('0xa2')](_0x52babe,_0xd5a7('0xa3'));var _0x502df3=[];_0x3a9e56[_0xd5a7('0xa4')](function(_0x2cb0b3){_0x502df3[_0xd5a7('0xa5')](updateWhatsappInteraction(_0x2cb0b3,_0x31881a,_0x15a4e2));});return BPromise[_0xd5a7('0xa6')](_0x502df3);});});})[_0xd5a7('0x24')](function(_0x277aa6){_0x564869['rows']=_0x277aa6;return _0x564869;})['then'](respondWithFilteredResult(_0x52cfaf,_0x445754))[_0xd5a7('0xa7')](handleError(_0x52cfaf,null));};exports[_0xd5a7('0xa8')]=function(_0x2c5275,_0xdfdf57){var _0x101941={'raw':![],'where':{'id':_0x2c5275[_0xd5a7('0xa9')]['id']}},_0x322232={};_0x322232[_0xd5a7('0x34')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x322232['query']=_['keys'](_0x2c5275[_0xd5a7('0x35')]);_0x322232[_0xd5a7('0x3e')]=_[_0xd5a7('0x36')](_0x322232[_0xd5a7('0x34')],_0x322232[_0xd5a7('0x35')]);_0x101941[_0xd5a7('0x37')]=_['intersection'](_0x322232[_0xd5a7('0x34')],qs[_0xd5a7('0x38')](_0x2c5275['query']['fields']));_0x101941[_0xd5a7('0x37')]=_0x101941['attributes'][_0xd5a7('0x39')]?_0x101941['attributes']:_0x322232[_0xd5a7('0x34')];if(_0x2c5275['query'][_0xd5a7('0xaa')]){_0x101941[_0xd5a7('0xab')]=[{'all':!![]}];}_0x101941=_[_0xd5a7('0x91')]({},_0x101941,_0x2c5275[_0xd5a7('0xac')]);return db[_0xd5a7('0x30')][_0xd5a7('0x58')](_0x101941)[_0xd5a7('0x24')](handleEntityNotFound(_0xdfdf57,null))[_0xd5a7('0x24')](respondWithResult(_0xdfdf57,null))[_0xd5a7('0xa7')](handleError(_0xdfdf57,null));};exports['create']=function(_0x57234b,_0x19159a){return db[_0xd5a7('0x30')]['create'](_0x57234b[_0xd5a7('0xad')],{})[_0xd5a7('0x24')](respondWithResult(_0x19159a,0xc9))[_0xd5a7('0xa7')](handleError(_0x19159a,null));};exports[_0xd5a7('0xae')]=function(_0x494818,_0x49f6ee){if(_0x494818['body']['id']){delete _0x494818[_0xd5a7('0xad')]['id'];}return db[_0xd5a7('0x30')][_0xd5a7('0x58')]({'where':{'id':_0x494818[_0xd5a7('0xa9')]['id']}})[_0xd5a7('0x24')](handleEntityNotFound(_0x49f6ee,null))[_0xd5a7('0x24')](saveUpdates(_0x494818['body'],null))['then'](respondWithResult(_0x49f6ee,null))[_0xd5a7('0xa7')](handleError(_0x49f6ee,null));};exports[_0xd5a7('0x25')]=function(_0x590990,_0x4d0be8){return db[_0xd5a7('0x30')][_0xd5a7('0x58')]({'where':{'id':_0x590990[_0xd5a7('0xa9')]['id']}})[_0xd5a7('0x24')](handleEntityNotFound(_0x4d0be8,null))[_0xd5a7('0x24')](removeEntity(_0x4d0be8,null))[_0xd5a7('0xa7')](handleError(_0x4d0be8,null));};exports[_0xd5a7('0xaf')]=function(_0x3cf0ef,_0x3543c3){return db[_0xd5a7('0x30')][_0xd5a7('0xaf')]()['then'](respondWithResult(_0x3543c3,null))[_0xd5a7('0xa7')](handleError(_0x3543c3,null));};exports[_0xd5a7('0xb0')]=function(_0x3bc6d5,_0x444f65,_0x2591ae){return db[_0xd5a7('0xb1')]['find']({'where':{'id':_0x3bc6d5[_0xd5a7('0xa9')]['id']}})[_0xd5a7('0x24')](handleEntityNotFound(_0x444f65,null))[_0xd5a7('0x24')](function(_0x3e0040){if(_0x3e0040){return _0x3e0040[_0xd5a7('0xb0')](_0x3bc6d5[_0xd5a7('0xad')]['ids'],_[_0xd5a7('0xb2')](_0x3bc6d5[_0xd5a7('0xad')],['ids','id'])||{});}})[_0xd5a7('0x24')](respondWithResult(_0x444f65,null))['catch'](handleError(_0x444f65,null));};exports[_0xd5a7('0xb3')]=function(_0x5c90dc,_0x56cde3,_0x60c3b){var _0x562c39={'raw':![],'where':{}};var _0x5423c9={};var _0x59222c={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xd5a7('0xb4')]({'where':{'id':_0x5c90dc[_0xd5a7('0xa9')]['id']}})[_0xd5a7('0x24')](handleEntityNotFound(_0x56cde3,null))[_0xd5a7('0x24')](function(_0x19e782){if(_0x19e782){_0x5423c9[_0xd5a7('0x34')]=_['keys'](db[_0xd5a7('0xb1')][_0xd5a7('0x31')]);_0x5423c9[_0xd5a7('0x35')]=_[_0xd5a7('0x6b')](_0x5c90dc['query']);_0x5423c9['filters']=_['intersection'](_0x5423c9['model'],_0x5423c9['query']);_0x562c39['attributes']=_[_0xd5a7('0x36')](_0x5423c9['model'],qs['fields'](_0x5c90dc['query']['fields']));_0x562c39[_0xd5a7('0x37')]=_0x562c39[_0xd5a7('0x37')][_0xd5a7('0x39')]?_0x562c39[_0xd5a7('0x37')]:_0x5423c9[_0xd5a7('0x34')];if(!_0x5c90dc[_0xd5a7('0x35')][_0xd5a7('0x3a')](_0xd5a7('0xb5'))){_0x562c39[_0xd5a7('0x3b')]=qs['limit'](_0x5c90dc[_0xd5a7('0x35')][_0xd5a7('0x3b')]);_0x562c39[_0xd5a7('0x1d')]=qs[_0xd5a7('0x1d')](_0x5c90dc[_0xd5a7('0x35')][_0xd5a7('0x1d')]);}_0x562c39[_0xd5a7('0x81')]=qs[_0xd5a7('0x3c')](_0x5c90dc[_0xd5a7('0x35')][_0xd5a7('0x3c')]);_0x562c39['where']=qs[_0xd5a7('0x3e')](_[_0xd5a7('0x3f')](_0x5c90dc['query'],_0x5423c9[_0xd5a7('0x3e')]));_0x562c39[_0xd5a7('0x3d')][_0xd5a7('0xa3')]=_0x19e782['id'];if(_0x5c90dc[_0xd5a7('0x35')]['filter']){_0x562c39[_0xd5a7('0x3d')]=_[_0xd5a7('0x91')](_0x562c39['where'],{'$or':_[_0xd5a7('0x2a')](_0x562c39[_0xd5a7('0x37')],function(_0x3147e5){var _0x376ad1={};_0x376ad1[_0x3147e5]={'$like':'%'+_0x5c90dc[_0xd5a7('0x35')]['filter']+'%'};return _0x376ad1;})});}if(_0x5c90dc[_0xd5a7('0x35')][_0xd5a7('0x6e')]){var _0x58d856=_0x5c90dc[_0xd5a7('0x35')][_0xd5a7('0x6e')]['split'](',');var _0x343b37={};_0x343b37[_0x58d856[0x0]]={'$gte':moment(_0x58d856[0x1])[_0xd5a7('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x562c39[_0xd5a7('0x3d')]=_[_0xd5a7('0x91')](_0x562c39['where'],_0x343b37);}_0x562c39=_['merge']({},_0x562c39,_0x5c90dc[_0xd5a7('0xac')]);return db[_0xd5a7('0xb1')]['count']({'where':_0x562c39[_0xd5a7('0x3d')]})[_0xd5a7('0x24')](function(_0x240d98){_0x59222c['count']=_0x240d98;if(_0x5c90dc['query']['includeAll']){_0x562c39[_0xd5a7('0xab')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xd5a7('0xb7')](_0x562c39);})['then'](function(_0x454e95){_0x59222c[_0xd5a7('0xb8')]=_0x454e95;return _0x59222c;});}})[_0xd5a7('0x24')](respondWithFilteredResult(_0x56cde3,_0x562c39))['catch'](handleError(_0x56cde3,null));};exports['addTags']=function(_0x34d1df,_0x137c2d,_0x580fc1){return db[_0xd5a7('0x30')]['find']({'where':{'id':_0x34d1df[_0xd5a7('0xa9')]['id']}})[_0xd5a7('0x24')](handleEntityNotFound(_0x137c2d,null))[_0xd5a7('0x24')](function(_0x103596){if(_0x103596){return _0x103596[_0xd5a7('0xb9')](_0x34d1df['body'][_0xd5a7('0xba')],_[_0xd5a7('0xb2')](_0x34d1df[_0xd5a7('0xad')],[_0xd5a7('0xba'),'id'])||{})[_0xd5a7('0xbb')](function(){return db['Tag']['findAll']({'attributes':['id',_0xd5a7('0x28'),'color'],'where':{'id':_0x34d1df[_0xd5a7('0xad')][_0xd5a7('0xba')]}});})['then'](function(_0x5e9e7f){socket['emit'](_0xd5a7('0xbc'),{'id':Number(_0x34d1df[_0xd5a7('0xa9')]['id']),'tags':_0x5e9e7f||[]});return{'id':Number(_0x34d1df['params']['id']),'tags':_0x5e9e7f||[]};});}})[_0xd5a7('0x24')](respondWithResult(_0x137c2d,null))[_0xd5a7('0xa7')](handleError(_0x137c2d,null));};exports['removeTags']=function(_0x3a0463,_0x5d612c,_0x501b8b){return db[_0xd5a7('0x30')][_0xd5a7('0x58')]({'where':{'id':_0x3a0463['params']['id']}})[_0xd5a7('0x24')](handleEntityNotFound(_0x5d612c,null))['then'](function(_0x5cbc47){if(_0x5cbc47){return _0x5cbc47['removeTags'](_0x3a0463['query'][_0xd5a7('0xba')]);}})['then'](respondWithStatusCode(_0x5d612c,null))['catch'](handleError(_0x5d612c,null));};exports['download']=function(_0x32b37d,_0x29176a){var _0x254ff8=moment()['unix']()[_0xd5a7('0x90')]();var _0x22f7af=path['join'](config[_0xd5a7('0xbd')],_0xd5a7('0xbe'),_0xd5a7('0xbf'),_0xd5a7('0xc0'));var _0x3169fa=path['join'](config['root'],_0xd5a7('0xbe'),_0xd5a7('0xbf'),'attachments');var _0xa54082=path[_0xd5a7('0xc1')](_0x22f7af,_0x254ff8);var _0x56c24b=util[_0xd5a7('0xb6')](_0xd5a7('0xc2'),_0x32b37d['params']['id'],_0x254ff8);var _0x13c572=path[_0xd5a7('0xc1')](_0x22f7af,_0x56c24b);var _0x2b0df7=[];_0x2b0df7[_0xd5a7('0xa5')]({'model':db[_0xd5a7('0x67')],'as':_0xd5a7('0x67'),'attributes':['id',_0xd5a7('0x2b')],'raw':!![]});_0x2b0df7[_0xd5a7('0xa5')]({'model':db[_0xd5a7('0xc3')],'as':_0xd5a7('0x5c'),'attributes':['id','firstName',_0xd5a7('0xc4')],'raw':!![]});if(_0x32b37d[_0xd5a7('0x35')][_0xd5a7('0xc5')]){_0x2b0df7[_0xd5a7('0xa5')]({'model':db['Attachment'],'as':_0xd5a7('0xc6'),'raw':!![]});}var _0x165ba7=[{'model':db[_0xd5a7('0xb1')],'as':_0xd5a7('0xc7'),'attributes':['id',_0xd5a7('0xad'),_0xd5a7('0xc8'),_0xd5a7('0xc9'),'secret',_0xd5a7('0x72')],'include':_0x2b0df7}];_0x165ba7[_0xd5a7('0xa5')]({'model':db[_0xd5a7('0xca')],'as':_0xd5a7('0xcb'),'attributes':['id',_0xd5a7('0x28')]});_0x165ba7[_0xd5a7('0xa5')]({'model':db[_0xd5a7('0x67')],'as':'Owner','attributes':['id','fullname']});return db[_0xd5a7('0x30')]['find']({'where':{'id':_0x32b37d['params']['id']},'include':_0x165ba7})['then'](handleEntityNotFound(_0x29176a,null))[_0xd5a7('0x24')](function(_0x4fbe31){if(_0x4fbe31){var _0x485452=_0x4fbe31[_0xd5a7('0xcc')]({'plain':!![]});fs[_0xd5a7('0xcd')](_0xa54082);var _0x4ee648={'format':'A4','border':'10px','header':{'height':_0xd5a7('0xce'),'contents':{'first':_0xd5a7('0xcf')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xd5a7('0xd0'),util[_0xd5a7('0xb6')](_0xd5a7('0xd1'),_0xd5a7('0xd2'),_0x485452['id']),moment()[_0xd5a7('0xb6')](_0xd5a7('0xd3'))['toString']())}}};var _0x94f927={'channel':_0xd5a7('0xd2'),'account':_0x485452[_0xd5a7('0xcb')][_0xd5a7('0x28')],'agent':_0x485452[_0xd5a7('0xd4')]?_0x485452['Owner'][_0xd5a7('0x2b')]:_0xd5a7('0xd5'),'createdAt':moment(_0x485452[_0xd5a7('0xc8')])['format'](_0xd5a7('0xd6'))[_0xd5a7('0x90')](),'closedAt':_0x485452[_0xd5a7('0xd7')]?moment(_0x485452[_0xd5a7('0xd8')])[_0xd5a7('0xb6')](_0xd5a7('0xd6'))[_0xd5a7('0x90')]():'','disposition':_0x485452[_0xd5a7('0xd9')],'messages':_(_0x485452['Messages'])['filter']({'secret':![]})[_0xd5a7('0x2a')](function(_0x435d5d){if(_0x435d5d['Attachment']){var _0x45f0d8=path[_0xd5a7('0xc1')](_0x3169fa,_0x435d5d[_0xd5a7('0xc6')][_0xd5a7('0xda')]);if(fs[_0xd5a7('0xdb')](_0x45f0d8)){fs[_0xd5a7('0xdc')](_0x45f0d8)['pipe'](fs[_0xd5a7('0xdd')](path[_0xd5a7('0xc1')](_0xa54082,_0x435d5d[_0xd5a7('0xc6')][_0xd5a7('0xda')])));}}return{'date':moment(_0x435d5d['createdAt'])[_0xd5a7('0xb6')](_0xd5a7('0xd6'))[_0xd5a7('0x90')](),'sender':_0x435d5d[_0xd5a7('0xc9')]===_0xd5a7('0xde')?_0x435d5d[_0xd5a7('0x67')]?_0x435d5d[_0xd5a7('0x67')][_0xd5a7('0x2b')]:_0xd5a7('0xdf'):_0x435d5d[_0xd5a7('0x5c')][_0xd5a7('0xe0')]+(_0x435d5d[_0xd5a7('0x5c')][_0xd5a7('0xc4')]?'\x20'+_0x435d5d[_0xd5a7('0x5c')][_0xd5a7('0xc4')]:''),'body':_0x435d5d[_0xd5a7('0xc6')]?_0x435d5d[_0xd5a7('0xc6')]['basename']:_0x435d5d[_0xd5a7('0xad')],'direction':_0x435d5d[_0xd5a7('0xc9')]===_0xd5a7('0xde')?'A':'C','secret':_0x435d5d[_0xd5a7('0xe1')],'read':_0x435d5d[_0xd5a7('0x72')],'attachment':_0x435d5d[_0xd5a7('0xc6')]};})[_0xd5a7('0x59')]()};return ejs[_0xd5a7('0xe2')](path[_0xd5a7('0xc1')](config[_0xd5a7('0xbd')],_0xd5a7('0xbe'),_0xd5a7('0xe3'),'downloadInteraction.html'),{'interaction':_0x94f927})[_0xd5a7('0x24')](function(_0x5e7bd7){return new BPromise(function(_0x32ec6e,_0x1c3713){pdf['create'](_0x5e7bd7,_0x4ee648)[_0xd5a7('0xe4')](path['join'](_0xa54082,_0xd5a7('0xe5')+_0x485452['id']+'-'+_0x254ff8+_0xd5a7('0xe6')),function(_0x598d5e,_0xb64a59){if(_0x598d5e)return _0x1c3713(_0x598d5e);_0x32ec6e(_0xb64a59);});});})[_0xd5a7('0x24')](function(){return new BPromise(function(_0x2790e3,_0x1c27b4){zipdir(_0xa54082,{'saveTo':_0x13c572},function(_0x2046c3,_0x57d466){if(_0x2046c3)return _0x1c27b4(_0x2046c3);return _0x2790e3(_0x57d466);});})[_0xd5a7('0x24')](function(){return new BPromise(function(_0x8b57ee,_0x63f362){rimraf(_0xa54082,function(_0xb7570a){if(_0xb7570a)_0x63f362(_0xb7570a);return _0x8b57ee();});});})['then'](function(){return _0x29176a[_0xd5a7('0xe7')](_0x13c572,_0x56c24b,function(_0x26e1b3){if(_0x26e1b3){console['log'](_0xd5a7('0xe8'),_0x26e1b3);}else{fs[_0xd5a7('0xe9')](_0x13c572);}});});});}else{return _0x29176a['sendStatus'](0xc8);}})['catch'](handleError(_0x29176a,null));}; \ No newline at end of file +var _0xcbd8=['then','end','sendStatus','error','stack','name','Users','fullname','Tags','TagIds','split','forEach','push','catch','index','map','WhatsappInteraction','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','field','color','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','options','create','addMessage','WhatsappMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','emit','removeTags','download','unix','root','server','tmp','join','transcript-%d-%s.zip','firstName','lastName','attachments','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','closed','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','.pdf','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x41e3e5,_0x441240){var _0x4b5b5c=function(_0x5b988a){while(--_0x5b988a){_0x41e3e5['push'](_0x41e3e5['shift']());}};_0x4b5b5c(++_0x441240);}(_0xcbd8,0xcb));var _0x8cbd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcbd8[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8cbd('0x0'));var zipdir=require(_0x8cbd('0x1'));var jsonpatch=require(_0x8cbd('0x2'));var rp=require(_0x8cbd('0x3'));var moment=require(_0x8cbd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8cbd('0x5'));var util=require(_0x8cbd('0x6'));var path=require(_0x8cbd('0x7'));var sox=require(_0x8cbd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8cbd('0x9'));var squel=require(_0x8cbd('0xa'));var crypto=require('crypto');var jsforce=require(_0x8cbd('0xb'));var deskjs=require(_0x8cbd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8cbd('0xd'));var authService=require(_0x8cbd('0xe'));var qs=require(_0x8cbd('0xf'));var as=require(_0x8cbd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8cbd('0x11'));var utils=require(_0x8cbd('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8cbd('0x13')]=_['defaults'](config[_0x8cbd('0x13')],{'host':_0x8cbd('0x14'),'port':0x18eb});var socket=require(_0x8cbd('0x15'))(new Redis(config['redis']));require(_0x8cbd('0x16'))['register'](socket);function respondWithStatusCode(_0x17cc2f,_0x502533){_0x502533=_0x502533||0xcc;return function(_0x2dff4d){if(_0x2dff4d){return _0x17cc2f['sendStatus'](_0x502533);}return _0x17cc2f[_0x8cbd('0x17')](_0x502533)['end']();};}function respondWithResult(_0x486f44,_0x4ca2bd){_0x4ca2bd=_0x4ca2bd||0xc8;return function(_0x19d3f3){if(_0x19d3f3){return _0x486f44[_0x8cbd('0x17')](_0x4ca2bd)[_0x8cbd('0x18')](_0x19d3f3);}};}function respondWithFilteredResult(_0x1f8544,_0x5d464f){return function(_0x320fcf){if(_0x320fcf){var _0x598586=_0x320fcf[_0x8cbd('0x19')],_0x21ac0a=_0x5d464f[_0x8cbd('0x1a')],_0x25306d=_0x5d464f[_0x8cbd('0x1a')]+_0x5d464f[_0x8cbd('0x1b')],_0x1cb2aa;if(_0x25306d>=_0x598586){_0x25306d=_0x598586;_0x1cb2aa=0xc8;}else{_0x1cb2aa=0xce;}_0x1f8544[_0x8cbd('0x17')](_0x1cb2aa);return _0x1f8544[_0x8cbd('0x1c')](_0x8cbd('0x1d'),_0x21ac0a+'-'+_0x25306d+'/'+_0x598586)[_0x8cbd('0x18')](_0x320fcf);}return null;};}function patchUpdates(_0x48f1de){return function(_0x3f0ef9){try{jsonpatch[_0x8cbd('0x1e')](_0x3f0ef9,_0x48f1de,!![]);}catch(_0x5425a9){return BPromise[_0x8cbd('0x1f')](_0x5425a9);}return _0x3f0ef9[_0x8cbd('0x20')]();};}function saveUpdates(_0x2ec3e0,_0x345306){return function(_0x2689bc){if(_0x2689bc){return _0x2689bc[_0x8cbd('0x21')](_0x2ec3e0)['then'](function(_0x11702e){return _0x11702e;});}return null;};}function removeEntity(_0x29afdb,_0x4efc82){return function(_0x7da18f){if(_0x7da18f){return _0x7da18f[_0x8cbd('0x22')]()[_0x8cbd('0x23')](function(){_0x29afdb['status'](0xcc)[_0x8cbd('0x24')]();});}};}function handleEntityNotFound(_0x4161ea,_0x42f2b5){return function(_0x3e5ed4){if(!_0x3e5ed4){_0x4161ea[_0x8cbd('0x25')](0x194);}return _0x3e5ed4;};}function handleError(_0x505d00,_0x5e74df){_0x5e74df=_0x5e74df||0x1f4;return function(_0x41e0da){logger[_0x8cbd('0x26')](_0x41e0da[_0x8cbd('0x27')]);if(_0x41e0da[_0x8cbd('0x28')]){delete _0x41e0da[_0x8cbd('0x28')];}_0x505d00['status'](_0x5e74df)['send'](_0x41e0da);};}function getInteractionUsers(_0xcce475,_0x5a03d2){return new BPromise(function(_0x268db3,_0x3ac113){try{if(_0x5a03d2[_0xcce475['id']]){_0xcce475[_0x8cbd('0x29')]=_['map'](_0x5a03d2[_0xcce475['id']],function(_0x33b95c){return{'id':_0x33b95c['id'],'fullname':_0x33b95c[_0x8cbd('0x2a')]};});}}catch(_0x188005){_0x3ac113(_0x188005);}_0x268db3(_0xcce475);});}function getInteractionTags(_0x2c45ac,_0x19b94b){return new BPromise(function(_0xc8849a,_0x55a666){try{if(_0x2c45ac['TagIds']){_0x2c45ac[_0x8cbd('0x2b')]=[];_0x2c45ac[_0x8cbd('0x2c')][_0x8cbd('0x2d')](',')[_0x8cbd('0x2e')](function(_0x3243a4){_0x2c45ac['Tags'][_0x8cbd('0x2f')](_0x19b94b[_0x3243a4]);});}delete _0x2c45ac[_0x8cbd('0x2c')];}catch(_0x4e59fb){_0x55a666(_0x4e59fb);}_0xc8849a(_0x2c45ac);});}function updateWhatsappInteraction(_0xa3126c,_0x2c30ca,_0x18bcf6){return new BPromise(function(_0x591b21,_0x266b40){return getInteractionUsers(_0xa3126c,_0x18bcf6)['then'](function(_0x289d86){return getInteractionTags(_0x289d86,_0x2c30ca);})['then'](function(_0x377b63){_0x591b21(_0x377b63);})[_0x8cbd('0x30')](function(_0x31efa4){_0x266b40(_0x31efa4);});});}exports[_0x8cbd('0x31')]=function(_0x1f1451,_0x4de3b6){var _0x412342={},_0x34b95e={},_0x3da33b={'count':0x0,'rows':[]};var _0x2862fe=_[_0x8cbd('0x32')](db[_0x8cbd('0x33')][_0x8cbd('0x34')],function(_0x2180bd){return{'name':_0x2180bd['fieldName'],'type':_0x2180bd[_0x8cbd('0x35')][_0x8cbd('0x36')]};});_0x34b95e[_0x8cbd('0x37')]=_['map'](_0x2862fe,_0x8cbd('0x28'));_0x34b95e[_0x8cbd('0x38')]=_[_0x8cbd('0x39')](_0x1f1451[_0x8cbd('0x38')]);_0x34b95e['filters']=_[_0x8cbd('0x3a')](_0x34b95e[_0x8cbd('0x37')],_0x34b95e[_0x8cbd('0x38')]);_0x412342['attributes']=_[_0x8cbd('0x3a')](_0x34b95e[_0x8cbd('0x37')],qs[_0x8cbd('0x3b')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x3b')]));_0x412342[_0x8cbd('0x3c')]=_0x412342[_0x8cbd('0x3c')]['length']?_0x412342['attributes']:_0x34b95e['model'];if(!_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x3d')](_0x8cbd('0x3e'))){_0x412342[_0x8cbd('0x1b')]=qs[_0x8cbd('0x1b')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x1b')]);_0x412342[_0x8cbd('0x1a')]=qs[_0x8cbd('0x1a')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x1a')]);}_0x412342[_0x8cbd('0x3f')]=qs[_0x8cbd('0x40')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x40')]);_0x412342['where']=qs[_0x8cbd('0x41')](_[_0x8cbd('0x42')](_0x1f1451[_0x8cbd('0x38')],_0x34b95e[_0x8cbd('0x41')]),_0x2862fe);var _0x5d405a=[];var _0x469d39=squel['select']()['field']('id')[_0x8cbd('0x43')](_0x8cbd('0x28'))[_0x8cbd('0x43')](_0x8cbd('0x44'))['from']('tools_tags');var _0x29417a=squel[_0x8cbd('0x45')]()[_0x8cbd('0x43')](_0x8cbd('0x46'))['field'](_0x8cbd('0x47'))[_0x8cbd('0x43')](_0x8cbd('0x48'))['from'](_0x8cbd('0x49'),'ui')[_0x8cbd('0x4a')](_0x8cbd('0x4b'),'u',_0x8cbd('0x4c'));var _0x2b2a1a=squel[_0x8cbd('0x45')]()[_0x8cbd('0x4d')]('whatsapp_interactions','i')['left_join'](_0x8cbd('0x4e'),'c',_0x8cbd('0x4f'))[_0x8cbd('0x4a')](_0x8cbd('0x4b'),'o',_0x8cbd('0x50'))['left_join'](_0x8cbd('0x51'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x8cbd('0x4a')](_0x8cbd('0x52'),'me',_0x8cbd('0x53'))['left_join'](_0x8cbd('0x54'),'it',_0x8cbd('0x55'))[_0x8cbd('0x4a')](_0x8cbd('0x56'),'t',_0x8cbd('0x57'));var _0xf77edc=squel['expr']();var _0x555267=[];var _0x351a4d=squel[_0x8cbd('0x58')]();var _0x15faf2;if(_0x1f1451['query'][_0x8cbd('0x59')]){_0x15faf2=as['parseSearch'](_0x1f1451['query'][_0x8cbd('0x59')]);var _0x451de7=_0x15faf2[_0x8cbd('0x5a')];for(var _0x30ca5a=0x0;_0x30ca5a<_0x15faf2[_0x8cbd('0x5b')][_0x8cbd('0x5c')];_0x30ca5a++){var _0x38f483=_0x15faf2['conditions'][_0x30ca5a];var _0xa0c09e='i';var _0x502e88=_[_0x8cbd('0x5d')](_0x2862fe,[_0x8cbd('0x28'),_0x38f483[_0x8cbd('0x43')]]);if(!_0x502e88){switch(_0x38f483[_0x8cbd('0x43')]){case _0x8cbd('0x5e'):if(_0x38f483[_0x8cbd('0x5f')]==0x1){_0x2b2a1a[_0x8cbd('0x60')]('`'+_0x38f483[_0x8cbd('0x43')]+'`\x20=\x200');}else{_0x2b2a1a[_0x8cbd('0x60')]('`'+_0x38f483[_0x8cbd('0x43')]+_0x8cbd('0x61'));}break;case _0x8cbd('0x62'):if(_0x38f483[_0x8cbd('0x63')]===_0x8cbd('0x64')){if(_0x38f483[_0x8cbd('0x5f')]['split']('\x20')['length']>0x1){_0xf77edc[_0x451de7](_0x8cbd('0x65'),qs['getFullTextValue'](_0x38f483[_0x8cbd('0x5f')]),null);}else{var _0x428ff6='%'+_0x38f483[_0x8cbd('0x5f')]+'%';_0xf77edc[_0x451de7](_0x8cbd('0x66'),_0x428ff6,_0x428ff6,_0x428ff6);}}else{_0x502e88=_['find'](_0x2862fe,[_0x8cbd('0x28'),_0x8cbd('0x67')]);_0x38f483[_0x8cbd('0x43')]=_0x8cbd('0x67');_0x27290d=as[_0x8cbd('0x68')](_0xa0c09e,_0x502e88['type'],_0x38f483);_0xf77edc[_0x451de7](_0x27290d[_0x8cbd('0x69')],_0x27290d[_0x8cbd('0x5f')][_0x8cbd('0x6a')],_0x27290d['value']['end']);}break;case _0x8cbd('0x6b'):var _0x1f3a9a=_0x38f483[_0x8cbd('0x5f')]['split'](',')[_0x8cbd('0x32')](function(_0x148c45){return Number(_0x148c45);});_0x1f3a9a[_0x8cbd('0x2e')](function(_0x3c43e4){_0x351a4d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c43e4+',%');});_0x555267=_[_0x8cbd('0x6c')](_0x555267,_0x1f3a9a);break;case _0x8cbd('0x6d'):if(_0x38f483['operator']===_0x8cbd('0x64')){_0xf77edc[_0x451de7](_0x8cbd('0x6e'),'%'+_0x38f483[_0x8cbd('0x5f')]+'%',null);}else{_0x502e88=_['find'](_0x2862fe,[_0x8cbd('0x28'),'UserId']);_0x38f483[_0x8cbd('0x43')]=_0x8cbd('0x6f');_0x27290d=as[_0x8cbd('0x68')](_0xa0c09e,_0x502e88['type'],_0x38f483);_0xf77edc[_0x451de7](_0x27290d[_0x8cbd('0x69')],_0x27290d['value'][_0x8cbd('0x6a')],_0x27290d[_0x8cbd('0x5f')][_0x8cbd('0x24')]);}break;case _0x8cbd('0x70'):_0x27290d=as[_0x8cbd('0x68')]('me',null,_0x38f483);_0xf77edc[_0x451de7](_0x27290d[_0x8cbd('0x69')],_0x27290d['value'][_0x8cbd('0x6a')],_0x27290d[_0x8cbd('0x5f')][_0x8cbd('0x24')]);break;}}else{var _0x27290d=as['buildExpression'](_0xa0c09e,_0x502e88[_0x8cbd('0x35')],_0x38f483);_0xf77edc[_0x451de7](_0x27290d[_0x8cbd('0x69')],_0x27290d[_0x8cbd('0x5f')][_0x8cbd('0x6a')],_0x27290d['value'][_0x8cbd('0x24')]);}}}else{var _0x912976=_(_0x1f1451['query'])[_0x8cbd('0x39')]()[_0x8cbd('0x32')](function(_0x5dd672){return _[_0x8cbd('0x71')](_0x2862fe,[_0x8cbd('0x28'),_0x5dd672])?_0x5dd672:undefined;})[_0x8cbd('0x72')]()[_0x8cbd('0x5f')]();if(!_[_0x8cbd('0x73')](_0x912976)){_0x912976[_0x8cbd('0x2e')](function(_0x358c6c){if(_0x358c6c===_0x8cbd('0x74')){_0x2b2a1a['where'](_0x8cbd('0x75'),[][_0x8cbd('0x76')](_0x1f1451['query'][_0x358c6c]));}else if(_0x358c6c===_0x8cbd('0x77')){var _0x325ae8=JSON[_0x8cbd('0x78')](_0x1f1451[_0x8cbd('0x38')][_0x358c6c])[_0x8cbd('0x79')];var _0x24eb8c=JSON[_0x8cbd('0x78')](_0x1f1451[_0x8cbd('0x38')][_0x358c6c])[_0x8cbd('0x7a')];_0x2b2a1a[_0x8cbd('0x7b')](_0x8cbd('0x7c'),_0x325ae8,_0x24eb8c);}else{if(_0x1f1451[_0x8cbd('0x38')][_0x358c6c]===_0x8cbd('0x7d')){_0x2b2a1a[_0x8cbd('0x7b')]('i.'+_0x358c6c+_0x8cbd('0x7e'));}else{_0x2b2a1a[_0x8cbd('0x7b')]('i.'+_0x358c6c+'\x20=\x20?',_0x1f1451[_0x8cbd('0x38')][_0x358c6c]);}}});}if(_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x7f')]){if(_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x7f')]==0x1){_0x2b2a1a[_0x8cbd('0x60')](_0x8cbd('0x80'));}else{_0x2b2a1a['having'](_0x8cbd('0x81'));}}if(_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x82')]){_0x555267=_[_0x8cbd('0x83')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x82')])?_0x1f1451['query'][_0x8cbd('0x82')]:new Array(_0x1f1451['query']['tag']);_0x555267[_0x8cbd('0x2e')](function(_0x10168a){_0x351a4d['or'](_0x8cbd('0x84'),'%,'+_0x10168a+',%');});}if(_0x1f1451[_0x8cbd('0x38')]['filter']){var _0x313dd9=_0x1f1451['query'][_0x8cbd('0x85')][_0x8cbd('0x86')]('\x5c','\x5c\x5c')[_0x8cbd('0x86')](/'/g,'\x27\x27');if(qs[_0x8cbd('0x87')](_0x313dd9)){_0xf77edc['or'](_0x8cbd('0x88'),_0x313dd9+'%')['or'](_0x8cbd('0x89'),_0x313dd9+'%');}else{_0xf77edc['or'](_0x8cbd('0x8a'),qs['getFullTextValue'](_0x313dd9))['or'](_0x8cbd('0x8b'),_0x313dd9+'%');}}}_0x2b2a1a[_0x8cbd('0x7b')](_0xf77edc);_0x2b2a1a[_0x8cbd('0x8c')](_0x8cbd('0x8d'));var _0x4f4187={'type':db[_0x8cbd('0x8e')][_0x8cbd('0x8f')][_0x8cbd('0x90')],'raw':!![]};var _0x559cc8=_0x2b2a1a[_0x8cbd('0x91')]();_0x559cc8[_0x8cbd('0x43')](_0x8cbd('0x8d'));_0x559cc8[_0x8cbd('0x43')](_0x8cbd('0x92'),'unreadMessages');if(_0x412342[_0x8cbd('0x3f')]){_0x412342[_0x8cbd('0x3f')]['forEach'](function(_0x4bfb66){var _0x591dae=_0x4bfb66[0x0]===_0x8cbd('0x93')?_0x4bfb66[0x0]:'i.'+_0x4bfb66[0x0];_0x2b2a1a[_0x8cbd('0x3f')](_0x591dae,_0x4bfb66[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8cbd('0x73')](_0x555267)){_0x2b2a1a[_0x8cbd('0x60')](_0x351a4d);_0x559cc8[_0x8cbd('0x7b')](_0x8cbd('0x94'),_0x555267);}BPromise[_0x8cbd('0x95')]()[_0x8cbd('0x23')](function(){if(!_0x15faf2){if(_0x1f1451[_0x8cbd('0x38')]['WhatsappAccountId']||_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x96')])return;_0x559cc8[_0x8cbd('0x7b')](_0x8cbd('0x97'));_0x2b2a1a[_0x8cbd('0x7b')](_0x8cbd('0x97'));return;}if(_0x1f1451[_0x8cbd('0x98')][_0x8cbd('0x99')]!=='agent')return;return _0x1f1451['user'][_0x8cbd('0x9a')]({'attributes':['id'],'raw':!![]})[_0x8cbd('0x23')](function(_0x43c4d5){if(_[_0x8cbd('0x73')](_0x43c4d5)){_0x559cc8[_0x8cbd('0x7b')](_0x8cbd('0x9b'));_0x2b2a1a[_0x8cbd('0x7b')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x559cc8['where'](_0x8cbd('0x75'),_[_0x8cbd('0x32')](_0x43c4d5,'id'));_0x2b2a1a[_0x8cbd('0x7b')]('i.WhatsappAccountId\x20IN\x20?',_[_0x8cbd('0x32')](_0x43c4d5,'id'));}});})[_0x8cbd('0x23')](function(){if(_0x1f1451['user'][_0x8cbd('0x99')]===_0x8cbd('0x9c')&&!_0x15faf2&&!_0x1f1451[_0x8cbd('0x38')]['WhatsappAccountId'])return[];return db[_0x8cbd('0x9d')][_0x8cbd('0x38')](_0x559cc8[_0x8cbd('0x9e')](),_0x4f4187);})['then'](function(_0x5b56c0){_0x3da33b[_0x8cbd('0x19')]=_0x5b56c0[_0x8cbd('0x5c')];if(_0x3da33b['count']===0x0)return[];return db[_0x8cbd('0x9d')][_0x8cbd('0x38')](_0x469d39['toString'](),_0x4f4187)[_0x8cbd('0x23')](function(_0x3a7d0c){_0x5d405a=_[_0x8cbd('0x9f')](_0x3a7d0c,'id');_0x4f4187=_[_0x8cbd('0xa0')](_0x4f4187,{'model':db[_0x8cbd('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f1451[_0x8cbd('0x38')]['fields']){_0x412342[_0x8cbd('0x3c')]['forEach'](function(_0x17f802){_0x2b2a1a[_0x8cbd('0x43')]('i.'+_0x17f802);});}else{_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0x92'),'unreadMessages');_0x2b2a1a['field'](_0x8cbd('0xa1'),'Account.key');_0x2b2a1a['field'](_0x8cbd('0xa2'),_0x8cbd('0xa3'));_0x2b2a1a['field'](_0x8cbd('0xa4'),_0x8cbd('0x93'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xa5'));_0x2b2a1a['field'](_0x8cbd('0xa6'),_0x8cbd('0xa7'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xa8'),_0x8cbd('0xa9'));_0x2b2a1a[_0x8cbd('0x43')]('c.email',_0x8cbd('0xaa'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xab'),_0x8cbd('0xac'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xad'),_0x8cbd('0xae'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xaf'),'Contact.fax');_0x2b2a1a['field']('o.fullname','Owner.fullname');_0x2b2a1a[_0x8cbd('0x43')]('o.internal',_0x8cbd('0xb0'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xb1'),'TagIds');}if(_0x412342[_0x8cbd('0x1b')])_0x2b2a1a[_0x8cbd('0x1b')](_0x412342['limit']);if(_0x412342[_0x8cbd('0x1a')])_0x2b2a1a['offset'](_0x412342[_0x8cbd('0x1a')]);return db[_0x8cbd('0x9d')]['query'](_0x2b2a1a[_0x8cbd('0x9e')](),_0x4f4187);})[_0x8cbd('0x23')](function(_0x71dac){_0x29417a['where'](_0x8cbd('0xb2'),_[_0x8cbd('0x32')](_0x71dac,'id'));return db[_0x8cbd('0x9d')]['query'](_0x29417a[_0x8cbd('0x9e')](),_0x4f4187)[_0x8cbd('0x23')](function(_0x214163){var _0x50f59e=_[_0x8cbd('0xb3')](_0x214163,_0x8cbd('0xb4'));var _0x4ddc2a=[];_0x71dac[_0x8cbd('0x2e')](function(_0x77cdd4){_0x4ddc2a[_0x8cbd('0x2f')](updateWhatsappInteraction(_0x77cdd4,_0x5d405a,_0x50f59e));});return BPromise[_0x8cbd('0xb5')](_0x4ddc2a);});});})[_0x8cbd('0x23')](function(_0x3ab206){_0x3da33b[_0x8cbd('0xb6')]=_0x3ab206;return _0x3da33b;})[_0x8cbd('0x23')](respondWithFilteredResult(_0x4de3b6,_0x412342))[_0x8cbd('0x30')](handleError(_0x4de3b6,null));};exports[_0x8cbd('0xb7')]=function(_0x1897ae,_0x585107){var _0x5f491f={'raw':![],'where':{'id':_0x1897ae[_0x8cbd('0xb8')]['id']}},_0x27d553={};_0x27d553[_0x8cbd('0x37')]=_[_0x8cbd('0x39')](db[_0x8cbd('0x33')][_0x8cbd('0x34')]);_0x27d553[_0x8cbd('0x38')]=_[_0x8cbd('0x39')](_0x1897ae[_0x8cbd('0x38')]);_0x27d553[_0x8cbd('0x41')]=_[_0x8cbd('0x3a')](_0x27d553[_0x8cbd('0x37')],_0x27d553['query']);_0x5f491f[_0x8cbd('0x3c')]=_[_0x8cbd('0x3a')](_0x27d553[_0x8cbd('0x37')],qs['fields'](_0x1897ae[_0x8cbd('0x38')][_0x8cbd('0x3b')]));_0x5f491f[_0x8cbd('0x3c')]=_0x5f491f[_0x8cbd('0x3c')][_0x8cbd('0x5c')]?_0x5f491f['attributes']:_0x27d553[_0x8cbd('0x37')];if(_0x1897ae[_0x8cbd('0x38')][_0x8cbd('0xb9')]){_0x5f491f[_0x8cbd('0xba')]=[{'all':!![]}];}_0x5f491f=_[_0x8cbd('0xa0')]({},_0x5f491f,_0x1897ae[_0x8cbd('0xbb')]);return db[_0x8cbd('0x33')][_0x8cbd('0x5d')](_0x5f491f)[_0x8cbd('0x23')](handleEntityNotFound(_0x585107,null))[_0x8cbd('0x23')](respondWithResult(_0x585107,null))[_0x8cbd('0x30')](handleError(_0x585107,null));};exports[_0x8cbd('0xbc')]=function(_0x2fa7dd,_0x217fda){return db[_0x8cbd('0x33')][_0x8cbd('0xbc')](_0x2fa7dd['body'],{})[_0x8cbd('0x23')](respondWithResult(_0x217fda,0xc9))['catch'](handleError(_0x217fda,null));};exports[_0x8cbd('0x21')]=function(_0x26a5ce,_0x44d18c){if(_0x26a5ce[_0x8cbd('0x70')]['id']){delete _0x26a5ce['body']['id'];}return db[_0x8cbd('0x33')][_0x8cbd('0x5d')]({'where':{'id':_0x26a5ce[_0x8cbd('0xb8')]['id']}})[_0x8cbd('0x23')](handleEntityNotFound(_0x44d18c,null))[_0x8cbd('0x23')](saveUpdates(_0x26a5ce[_0x8cbd('0x70')],null))[_0x8cbd('0x23')](respondWithResult(_0x44d18c,null))[_0x8cbd('0x30')](handleError(_0x44d18c,null));};exports[_0x8cbd('0x22')]=function(_0x5af5f7,_0x33d302){return db[_0x8cbd('0x33')][_0x8cbd('0x5d')]({'where':{'id':_0x5af5f7[_0x8cbd('0xb8')]['id']}})[_0x8cbd('0x23')](handleEntityNotFound(_0x33d302,null))[_0x8cbd('0x23')](removeEntity(_0x33d302,null))[_0x8cbd('0x30')](handleError(_0x33d302,null));};exports['describe']=function(_0x3ca120,_0x430a5c){return db[_0x8cbd('0x33')]['describe']()[_0x8cbd('0x23')](respondWithResult(_0x430a5c,null))[_0x8cbd('0x30')](handleError(_0x430a5c,null));};exports[_0x8cbd('0xbd')]=function(_0x1f71ed,_0x1e9475,_0x6d109f){return db[_0x8cbd('0xbe')][_0x8cbd('0x5d')]({'where':{'id':_0x1f71ed[_0x8cbd('0xb8')]['id']}})['then'](handleEntityNotFound(_0x1e9475,null))[_0x8cbd('0x23')](function(_0x4d1ee8){if(_0x4d1ee8){return _0x4d1ee8[_0x8cbd('0xbd')](_0x1f71ed['body'][_0x8cbd('0xbf')],_[_0x8cbd('0xc0')](_0x1f71ed[_0x8cbd('0x70')],[_0x8cbd('0xbf'),'id'])||{});}})[_0x8cbd('0x23')](respondWithResult(_0x1e9475,null))['catch'](handleError(_0x1e9475,null));};exports[_0x8cbd('0xc1')]=function(_0x5c7f51,_0x59fcc9,_0x220760){var _0x5efc53={'raw':![],'where':{}};var _0x4bccd5={};var _0xecbf06={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x5c7f51[_0x8cbd('0xb8')]['id']}})[_0x8cbd('0x23')](handleEntityNotFound(_0x59fcc9,null))[_0x8cbd('0x23')](function(_0x41c2cf){if(_0x41c2cf){_0x4bccd5['model']=_[_0x8cbd('0x39')](db[_0x8cbd('0xbe')][_0x8cbd('0x34')]);_0x4bccd5[_0x8cbd('0x38')]=_[_0x8cbd('0x39')](_0x5c7f51[_0x8cbd('0x38')]);_0x4bccd5[_0x8cbd('0x41')]=_['intersection'](_0x4bccd5[_0x8cbd('0x37')],_0x4bccd5[_0x8cbd('0x38')]);_0x5efc53['attributes']=_['intersection'](_0x4bccd5[_0x8cbd('0x37')],qs['fields'](_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x3b')]));_0x5efc53[_0x8cbd('0x3c')]=_0x5efc53[_0x8cbd('0x3c')][_0x8cbd('0x5c')]?_0x5efc53[_0x8cbd('0x3c')]:_0x4bccd5[_0x8cbd('0x37')];if(!_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x3d')](_0x8cbd('0x3e'))){_0x5efc53[_0x8cbd('0x1b')]=qs[_0x8cbd('0x1b')](_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x1b')]);_0x5efc53['offset']=qs[_0x8cbd('0x1a')](_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x1a')]);}_0x5efc53[_0x8cbd('0x3f')]=qs[_0x8cbd('0x40')](_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x40')]);_0x5efc53['where']=qs[_0x8cbd('0x41')](_[_0x8cbd('0x42')](_0x5c7f51['query'],_0x4bccd5['filters']));_0x5efc53[_0x8cbd('0x7b')]['WhatsappInteractionId']=_0x41c2cf['id'];if(_0x5c7f51['query'][_0x8cbd('0x85')]){_0x5efc53[_0x8cbd('0x7b')]=_[_0x8cbd('0xa0')](_0x5efc53[_0x8cbd('0x7b')],{'$or':_[_0x8cbd('0x32')](_0x5efc53[_0x8cbd('0x3c')],function(_0x466048){var _0x41fb86={};_0x41fb86[_0x466048]={'$like':'%'+_0x5c7f51[_0x8cbd('0x38')]['filter']+'%'};return _0x41fb86;})});}if(_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x79')]){var _0x99e7bf=_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x79')][_0x8cbd('0x2d')](',');var _0x454371={};_0x454371[_0x99e7bf[0x0]]={'$gte':moment(_0x99e7bf[0x1])[_0x8cbd('0xc2')](_0x8cbd('0xc3'))};_0x5efc53[_0x8cbd('0x7b')]=_[_0x8cbd('0xa0')](_0x5efc53['where'],_0x454371);}_0x5efc53=_[_0x8cbd('0xa0')]({},_0x5efc53,_0x5c7f51['options']);return db[_0x8cbd('0xbe')][_0x8cbd('0x19')]({'where':_0x5efc53[_0x8cbd('0x7b')]})[_0x8cbd('0x23')](function(_0x27171e){_0xecbf06[_0x8cbd('0x19')]=_0x27171e;if(_0x5c7f51[_0x8cbd('0x38')]['includeAll']){_0x5efc53[_0x8cbd('0xba')]=[{'all':!![]}];}return db[_0x8cbd('0xbe')][_0x8cbd('0xc4')](_0x5efc53);})[_0x8cbd('0x23')](function(_0xe182fb){_0xecbf06[_0x8cbd('0xb6')]=_0xe182fb;return _0xecbf06;});}})[_0x8cbd('0x23')](respondWithFilteredResult(_0x59fcc9,_0x5efc53))[_0x8cbd('0x30')](handleError(_0x59fcc9,null));};exports['addTags']=function(_0x28ae5a,_0x3f455a,_0x3d4c03){return db['WhatsappInteraction'][_0x8cbd('0x5d')]({'where':{'id':_0x28ae5a['params']['id']}})[_0x8cbd('0x23')](handleEntityNotFound(_0x3f455a,null))['then'](function(_0x5e5958){if(_0x5e5958){return _0x5e5958[_0x8cbd('0xc5')](_0x28ae5a[_0x8cbd('0x70')][_0x8cbd('0xbf')],_['omit'](_0x28ae5a[_0x8cbd('0x70')],[_0x8cbd('0xbf'),'id'])||{})['spread'](function(){return db[_0x8cbd('0x6b')][_0x8cbd('0xc4')]({'attributes':['id','name',_0x8cbd('0x44')],'where':{'id':_0x28ae5a[_0x8cbd('0x70')][_0x8cbd('0xbf')]}});})[_0x8cbd('0x23')](function(_0x5d1600){socket[_0x8cbd('0xc6')]('whatsappInteractionTags:save',{'id':Number(_0x28ae5a[_0x8cbd('0xb8')]['id']),'tags':_0x5d1600||[]});return{'id':Number(_0x28ae5a[_0x8cbd('0xb8')]['id']),'tags':_0x5d1600||[]};});}})['then'](respondWithResult(_0x3f455a,null))[_0x8cbd('0x30')](handleError(_0x3f455a,null));};exports[_0x8cbd('0xc7')]=function(_0x322739,_0x526e19,_0x30c3bb){return db[_0x8cbd('0x33')]['find']({'where':{'id':_0x322739[_0x8cbd('0xb8')]['id']}})['then'](handleEntityNotFound(_0x526e19,null))[_0x8cbd('0x23')](function(_0x5cd794){if(_0x5cd794){return _0x5cd794[_0x8cbd('0xc7')](_0x322739[_0x8cbd('0x38')][_0x8cbd('0xbf')]);}})['then'](respondWithStatusCode(_0x526e19,null))[_0x8cbd('0x30')](handleError(_0x526e19,null));};exports[_0x8cbd('0xc8')]=function(_0x5eda8f,_0x4f7d2e){var _0x3fb531=moment()[_0x8cbd('0xc9')]()[_0x8cbd('0x9e')]();var _0x3842cf=path['join'](config[_0x8cbd('0xca')],_0x8cbd('0xcb'),'files',_0x8cbd('0xcc'));var _0x4a538b=path[_0x8cbd('0xcd')](config[_0x8cbd('0xca')],_0x8cbd('0xcb'),'files','attachments');var _0xfad80e=path['join'](_0x3842cf,_0x3fb531);var _0xdbe0a7=util['format'](_0x8cbd('0xce'),_0x5eda8f['params']['id'],_0x3fb531);var _0x5b9785=path[_0x8cbd('0xcd')](_0x3842cf,_0xdbe0a7);var _0xf7d54e=[];_0xf7d54e[_0x8cbd('0x2f')]({'model':db[_0x8cbd('0x6d')],'as':_0x8cbd('0x6d'),'attributes':['id','fullname'],'raw':!![]});_0xf7d54e[_0x8cbd('0x2f')]({'model':db['CmContact'],'as':_0x8cbd('0x62'),'attributes':['id',_0x8cbd('0xcf'),_0x8cbd('0xd0')],'raw':!![]});if(_0x5eda8f[_0x8cbd('0x38')][_0x8cbd('0xd1')]){_0xf7d54e[_0x8cbd('0x2f')]({'model':db[_0x8cbd('0xd2')],'as':_0x8cbd('0xd2'),'raw':!![]});}var _0x476bae=[{'model':db[_0x8cbd('0xbe')],'as':_0x8cbd('0xd3'),'attributes':['id',_0x8cbd('0x70'),_0x8cbd('0x77'),_0x8cbd('0xd4'),_0x8cbd('0xd5'),'read'],'include':_0xf7d54e}];_0x476bae[_0x8cbd('0x2f')]({'model':db['WhatsappAccount'],'as':_0x8cbd('0xd6'),'attributes':['id',_0x8cbd('0x28')]});_0x476bae[_0x8cbd('0x2f')]({'model':db['User'],'as':_0x8cbd('0xd7'),'attributes':['id',_0x8cbd('0x2a')]});return db[_0x8cbd('0x33')][_0x8cbd('0x5d')]({'where':{'id':_0x5eda8f[_0x8cbd('0xb8')]['id']},'include':_0x476bae})[_0x8cbd('0x23')](handleEntityNotFound(_0x4f7d2e,null))['then'](function(_0x3f85da){if(_0x3f85da){var _0x41b2e3=_0x3f85da[_0x8cbd('0xd8')]({'plain':!![]});fs[_0x8cbd('0xd9')](_0xfad80e);var _0x16cd16={'format':'A4','border':_0x8cbd('0xda'),'header':{'height':_0x8cbd('0xdb'),'contents':{'first':_0x8cbd('0xdc')}},'footer':{'height':'30px','contents':{'default':util[_0x8cbd('0xc2')](_0x8cbd('0xdd'),util['format'](_0x8cbd('0xde'),_0x8cbd('0xdf'),_0x41b2e3['id']),moment()[_0x8cbd('0xc2')](_0x8cbd('0xe0'))[_0x8cbd('0x9e')]())}}};var _0x23cc14={'channel':_0x8cbd('0xdf'),'account':_0x41b2e3[_0x8cbd('0xd6')][_0x8cbd('0x28')],'agent':_0x41b2e3[_0x8cbd('0xd7')]?_0x41b2e3[_0x8cbd('0xd7')]['fullname']:_0x8cbd('0xe1'),'createdAt':moment(_0x41b2e3[_0x8cbd('0x77')])[_0x8cbd('0xc2')](_0x8cbd('0xc3'))[_0x8cbd('0x9e')](),'closedAt':_0x41b2e3[_0x8cbd('0xe2')]?moment(_0x41b2e3['closedAt'])[_0x8cbd('0xc2')](_0x8cbd('0xc3'))['toString']():'','disposition':_0x41b2e3['disposition'],'messages':_(_0x41b2e3['Messages'])[_0x8cbd('0x85')]({'secret':![]})[_0x8cbd('0x32')](function(_0x57b21c){if(_0x57b21c[_0x8cbd('0xd2')]){var _0x1b3d34=path['join'](_0x4a538b,_0x57b21c[_0x8cbd('0xd2')][_0x8cbd('0xe3')]);if(fs[_0x8cbd('0xe4')](_0x1b3d34)){fs[_0x8cbd('0xe5')](_0x1b3d34)[_0x8cbd('0xe6')](fs[_0x8cbd('0xe7')](path[_0x8cbd('0xcd')](_0xfad80e,_0x57b21c[_0x8cbd('0xd2')][_0x8cbd('0xe3')])));}}return{'date':moment(_0x57b21c['createdAt'])[_0x8cbd('0xc2')](_0x8cbd('0xc3'))[_0x8cbd('0x9e')](),'sender':_0x57b21c['direction']==='out'?_0x57b21c[_0x8cbd('0x6d')]?_0x57b21c[_0x8cbd('0x6d')][_0x8cbd('0x2a')]:'System':_0x57b21c[_0x8cbd('0x62')][_0x8cbd('0xcf')]+(_0x57b21c[_0x8cbd('0x62')][_0x8cbd('0xd0')]?'\x20'+_0x57b21c[_0x8cbd('0x62')][_0x8cbd('0xd0')]:''),'body':_0x57b21c[_0x8cbd('0xd2')]?_0x57b21c[_0x8cbd('0xd2')][_0x8cbd('0xe3')]:_0x57b21c[_0x8cbd('0x70')],'direction':_0x57b21c['direction']===_0x8cbd('0xe8')?'A':'C','secret':_0x57b21c['secret'],'read':_0x57b21c[_0x8cbd('0x7f')],'attachment':_0x57b21c[_0x8cbd('0xd2')]};})[_0x8cbd('0x5f')]()};return ejs[_0x8cbd('0xe9')](path['join'](config[_0x8cbd('0xca')],_0x8cbd('0xcb'),_0x8cbd('0xea'),_0x8cbd('0xeb')),{'interaction':_0x23cc14})[_0x8cbd('0x23')](function(_0x759d1b){return new BPromise(function(_0x2febfc,_0x19608a){pdf['create'](_0x759d1b,_0x16cd16)['toFile'](path[_0x8cbd('0xcd')](_0xfad80e,'transcript-'+_0x41b2e3['id']+'-'+_0x3fb531+_0x8cbd('0xec')),function(_0x172e89,_0x1ec83c){if(_0x172e89)return _0x19608a(_0x172e89);_0x2febfc(_0x1ec83c);});});})[_0x8cbd('0x23')](function(){return new BPromise(function(_0x4a8af1,_0x44cbc8){zipdir(_0xfad80e,{'saveTo':_0x5b9785},function(_0x42fda1,_0x52a374){if(_0x42fda1)return _0x44cbc8(_0x42fda1);return _0x4a8af1(_0x52a374);});})['then'](function(){return new BPromise(function(_0x285401,_0x5d2497){rimraf(_0xfad80e,function(_0x3079e5){if(_0x3079e5)_0x5d2497(_0x3079e5);return _0x285401();});});})['then'](function(){return _0x4f7d2e['download'](_0x5b9785,_0xdbe0a7,function(_0x4397ff){if(_0x4397ff){console['log']('err',_0x4397ff);}else{fs[_0x8cbd('0xed')](_0x5b9785);}});});});}else{return _0x4f7d2e[_0x8cbd('0x25')](0xc8);}})[_0x8cbd('0x30')](handleError(_0x4f7d2e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6ee3bb3..462169d 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29a8=['setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then'];(function(_0x6c343b,_0x34abbd){var _0x367cab=function(_0x36c820){while(--_0x36c820){_0x6c343b['push'](_0x6c343b['shift']());}};_0x367cab(++_0x34abbd);}(_0x29a8,0x13a));var _0x829a=function(_0x4f4212,_0xd01d82){_0x4f4212=_0x4f4212-0x0;var _0x1f48ae=_0x29a8[_0x4f4212];return _0x1f48ae;};'use strict';var EventEmitter=require(_0x829a('0x0'));var WhatsappInteraction=require(_0x829a('0x1'))['db'][_0x829a('0x2')];var WhatsappMessage=require(_0x829a('0x1'))['db'][_0x829a('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x829a('0x4')](0x0);var events={'afterCreate':_0x829a('0x5'),'afterUpdate':'update','afterDestroy':_0x829a('0x6')};function emitEvent(_0x108f96){return function(_0x4f76cb,_0x25d088,_0x22eeb2){_0x4f76cb[_0x829a('0x7')]({'attributes':['id'],'raw':!![]})[_0x829a('0x8')](function(_0x51c5f0){_0x4f76cb[_0x829a('0x9')](_0x829a('0xa'),_0x51c5f0['map'](function(_0x361a9a){return{'id':_0x361a9a['id']};}));return WhatsappMessage[_0x829a('0xb')]({'where':{'WhatsappInteractionId':_0x4f76cb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4f1231){_0x4f76cb['setDataValue'](_0x829a('0xc'),_0x4f1231[_0x829a('0xd')]);WhatsappInteractionEvents[_0x829a('0xe')](_0x108f96+':'+_0x4f76cb['id'],_0x4f76cb);WhatsappInteractionEvents[_0x829a('0xe')](_0x108f96,_0x4f76cb);_0x22eeb2(null);})[_0x829a('0xf')](_0x22eeb2(null));};}for(var e in events){if(events[_0x829a('0x10')](e)){var event=events[e];WhatsappInteraction[_0x829a('0x11')](e,emitEvent(event));}}module[_0x829a('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xbb45=['update','getUsers','Users','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save'];(function(_0x57fae3,_0x5b0a60){var _0x439a3d=function(_0x2e8acb){while(--_0x2e8acb){_0x57fae3['push'](_0x57fae3['shift']());}};_0x439a3d(++_0x5b0a60);}(_0xbb45,0x16a));var _0x5bb4=function(_0x1385de,_0x4111c0){_0x1385de=_0x1385de-0x0;var _0x1c2e28=_0xbb45[_0x1385de];return _0x1c2e28;};'use strict';var EventEmitter=require(_0x5bb4('0x0'));var WhatsappInteraction=require(_0x5bb4('0x1'))['db'][_0x5bb4('0x2')];var WhatsappMessage=require(_0x5bb4('0x1'))['db'][_0x5bb4('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5bb4('0x4')](0x0);var events={'afterCreate':_0x5bb4('0x5'),'afterUpdate':_0x5bb4('0x6'),'afterDestroy':'remove'};function emitEvent(_0xf01da0){return function(_0x69faf5,_0x3dafec,_0x32b766){_0x69faf5[_0x5bb4('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x7fd39c){_0x69faf5['setDataValue'](_0x5bb4('0x8'),_0x7fd39c['map'](function(_0x5aceed){return{'id':_0x5aceed['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x69faf5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x180cc9){_0x69faf5[_0x5bb4('0x9')](_0x5bb4('0xa'),_0x180cc9[_0x5bb4('0xb')]);WhatsappInteractionEvents[_0x5bb4('0xc')](_0xf01da0+':'+_0x69faf5['id'],_0x69faf5);WhatsappInteractionEvents[_0x5bb4('0xc')](_0xf01da0,_0x69faf5);_0x32b766(null);})[_0x5bb4('0xd')](_0x32b766(null));};}for(var e in events){if(events[_0x5bb4('0xe')](e)){var event=events[e];WhatsappInteraction[_0x5bb4('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 0c4d267..05d894b 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14c6=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','changed','closed','closedAt'];(function(_0x110cef,_0xfe8f0e){var _0x9a9087=function(_0x6baf43){while(--_0x6baf43){_0x110cef['push'](_0x110cef['shift']());}};_0x9a9087(++_0xfe8f0e);}(_0x14c6,0x1b1));var _0x614c=function(_0x5c0ad3,_0x6d94de){_0x5c0ad3=_0x5c0ad3-0x0;var _0x327696=_0x14c6[_0x5c0ad3];return _0x327696;};'use strict';var _=require(_0x614c('0x0'));var util=require(_0x614c('0x1'));var logger=require(_0x614c('0x2'))('api');var moment=require(_0x614c('0x3'));var BPromise=require(_0x614c('0x4'));var rp=require(_0x614c('0x5'));var fs=require('fs');var path=require(_0x614c('0x6'));var rimraf=require(_0x614c('0x7'));var config=require(_0x614c('0x8'));var attributes=require(_0x614c('0x9'));module[_0x614c('0xa')]=function(_0x3d0f41,_0x48e657){return _0x3d0f41[_0x614c('0xb')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4cb51b,_0x3e556b,_0x694329){if(_0x4cb51b[_0x614c('0xc')](_0x614c('0xd'))){_0x4cb51b[_0x614c('0xe')]=moment()['format'](_0x614c('0xf'));}_0x694329(null,_0x4cb51b);}}});}; \ No newline at end of file +var _0x9d4a=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0x1fe011,_0x1ab550){var _0xd1bb67=function(_0x29c202){while(--_0x29c202){_0x1fe011['push'](_0x1fe011['shift']());}};_0xd1bb67(++_0x1ab550);}(_0x9d4a,0x16f));var _0xa9d4=function(_0x24d6ea,_0x1f57e9){_0x24d6ea=_0x24d6ea-0x0;var _0x2ee3a3=_0x9d4a[_0x24d6ea];return _0x2ee3a3;};'use strict';var _=require(_0xa9d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa9d4('0x1'));var moment=require(_0xa9d4('0x2'));var BPromise=require(_0xa9d4('0x3'));var rp=require(_0xa9d4('0x4'));var fs=require('fs');var path=require(_0xa9d4('0x5'));var rimraf=require(_0xa9d4('0x6'));var config=require(_0xa9d4('0x7'));var attributes=require(_0xa9d4('0x8'));module[_0xa9d4('0x9')]=function(_0xb1cde,_0x386c6d){return _0xb1cde[_0xa9d4('0xa')](_0xa9d4('0xb'),attributes,{'tableName':_0xa9d4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x66de22,_0x4239b5,_0x441548){if(_0x66de22[_0xa9d4('0xd')](_0xa9d4('0xe'))){_0x66de22[_0xa9d4('0xf')]=moment()[_0xa9d4('0x10')](_0xa9d4('0x11'));}_0x441548(null,_0x66de22);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b95b743..7dc8607 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ab8=['omit','spread','AddTags','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','body','ids'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x0ab8,0x1bc));var _0x80ab=function(_0x333c0e,_0x5943e9){_0x333c0e=_0x333c0e-0x0;var _0x321cc4=_0x0ab8[_0x333c0e];return _0x321cc4;};'use strict';var _=require('lodash');var util=require(_0x80ab('0x0'));var moment=require(_0x80ab('0x1'));var BPromise=require(_0x80ab('0x2'));var rs=require(_0x80ab('0x3'));var fs=require('fs');var Redis=require(_0x80ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x80ab('0x5'));var logger=require(_0x80ab('0x6'))(_0x80ab('0x7'));var config=require(_0x80ab('0x8'));var jayson=require(_0x80ab('0x9'));var client=jayson[_0x80ab('0xa')][_0x80ab('0xb')]({'port':0x232a});config['redis']=_[_0x80ab('0xc')](config[_0x80ab('0xd')],{'host':_0x80ab('0xe'),'port':0x18eb});var socket=require(_0x80ab('0xf'))(new Redis(config[_0x80ab('0xd')]));require(_0x80ab('0x10'))[_0x80ab('0x11')](socket);function respondWithRpcPromise(_0x5b59fc,_0x7ffa95,_0x357ba0){return new BPromise(function(_0xc0a96,_0x398986){return client['request'](_0x5b59fc,_0x357ba0)[_0x80ab('0x12')](function(_0x4d0fe5){logger[_0x80ab('0x13')](_0x80ab('0x14'),_0x7ffa95,_0x80ab('0x15'));logger['debug'](_0x80ab('0x16'),_0x7ffa95,_0x80ab('0x15'),JSON[_0x80ab('0x17')](_0x4d0fe5));if(_0x4d0fe5[_0x80ab('0x18')]){if(_0x4d0fe5[_0x80ab('0x18')]['code']===0x1f4){logger[_0x80ab('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x7ffa95,_0x4d0fe5[_0x80ab('0x18')]['message']);return _0x398986(_0x4d0fe5[_0x80ab('0x18')]['message']);}logger['error'](_0x80ab('0x14'),_0x7ffa95,_0x4d0fe5[_0x80ab('0x18')]['message']);return _0xc0a96(_0x4d0fe5[_0x80ab('0x18')][_0x80ab('0x19')]);}else{logger['info'](_0x80ab('0x14'),_0x7ffa95,_0x80ab('0x15'));_0xc0a96(_0x4d0fe5[_0x80ab('0x1a')][_0x80ab('0x19')]);}})[_0x80ab('0x1b')](function(_0x1eda94){logger['error'](_0x80ab('0x14'),_0x7ffa95,_0x1eda94);_0x398986(_0x1eda94);});});}exports[_0x80ab('0x1c')]=function(_0x3764cd){var _0x526f3d=this;return new Promise(function(_0x4fa55f,_0x74a15c){return db[_0x80ab('0x1d')][_0x80ab('0x1e')](_0x3764cd['body'],{'raw':_0x3764cd[_0x80ab('0x1f')]?_0x3764cd[_0x80ab('0x1f')][_0x80ab('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3764cd[_0x80ab('0x1f')]?_0x3764cd[_0x80ab('0x1f')][_0x80ab('0x21')]||null:null,'attributes':_0x3764cd[_0x80ab('0x1f')]?_0x3764cd[_0x80ab('0x1f')][_0x80ab('0x22')]||null:null,'limit':_0x3764cd[_0x80ab('0x1f')]?_0x3764cd[_0x80ab('0x1f')][_0x80ab('0x23')]||null:null})[_0x80ab('0x12')](function(_0x3443e7){logger[_0x80ab('0x13')]('UpdateWhatsappInteraction',_0x3764cd);logger['debug'](_0x80ab('0x1c'),_0x3764cd,JSON[_0x80ab('0x17')](_0x3443e7));_0x4fa55f(_0x3443e7);})[_0x80ab('0x1b')](function(_0x436794){logger[_0x80ab('0x18')](_0x80ab('0x1c'),_0x436794[_0x80ab('0x19')],_0x3764cd);_0x74a15c(_0x526f3d[_0x80ab('0x18')](0x1f4,_0x436794['message']));});});};exports[_0x80ab('0x24')]=function(_0x4aa2f0){return new Promise(function(_0x3042e4,_0x5e44df){return db['WhatsappInteraction'][_0x80ab('0x25')]({'where':_0x4aa2f0['options']?_0x4aa2f0[_0x80ab('0x1f')][_0x80ab('0x21')]||null:null})[_0x80ab('0x12')](function(_0x10c580){if(_0x10c580){return _0x10c580['addTags'](_0x4aa2f0[_0x80ab('0x26')][_0x80ab('0x27')],_[_0x80ab('0x28')](_0x4aa2f0[_0x80ab('0x26')],[_0x80ab('0x27'),'id'])||{});}})[_0x80ab('0x29')](function(_0x24c872){logger[_0x80ab('0x13')](_0x80ab('0x2a'),_0x4aa2f0);logger[_0x80ab('0x2b')](_0x80ab('0x2a'),_0x4aa2f0,JSON[_0x80ab('0x17')](_0x24c872));_0x3042e4(_0x24c872);})[_0x80ab('0x1b')](function(_0x167ea0){logger[_0x80ab('0x18')]('AddTags',_0x167ea0[_0x80ab('0x19')],_0x4aa2f0);_0x5e44df(_this[_0x80ab('0x18')](0x1f4,_0x167ea0['message']));});});}; \ No newline at end of file +var _0x4cac=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','update','body','options','raw','where','attributes','UpdateWhatsappInteraction','omit','ids','AddTags','lodash','util'];(function(_0x5ce498,_0x5a6678){var _0x5c3537=function(_0x3617db){while(--_0x3617db){_0x5ce498['push'](_0x5ce498['shift']());}};_0x5c3537(++_0x5a6678);}(_0x4cac,0x15d));var _0xc4ca=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4cac[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc4ca('0x0'));var util=require(_0xc4ca('0x1'));var moment=require(_0xc4ca('0x2'));var BPromise=require(_0xc4ca('0x3'));var rs=require(_0xc4ca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4ca('0x6'))(_0xc4ca('0x7'));var config=require(_0xc4ca('0x8'));var jayson=require(_0xc4ca('0x9'));var client=jayson['client'][_0xc4ca('0xa')]({'port':0x232a});config[_0xc4ca('0xb')]=_[_0xc4ca('0xc')](config[_0xc4ca('0xb')],{'host':_0xc4ca('0xd'),'port':0x18eb});var socket=require(_0xc4ca('0xe'))(new Redis(config[_0xc4ca('0xb')]));require('./whatsappInteraction.socket')[_0xc4ca('0xf')](socket);function respondWithRpcPromise(_0x1c75aa,_0x410269,_0x336a45){return new BPromise(function(_0x4cd46d,_0x451eb2){return client[_0xc4ca('0x10')](_0x1c75aa,_0x336a45)[_0xc4ca('0x11')](function(_0xca659b){logger[_0xc4ca('0x12')](_0xc4ca('0x13'),_0x410269,'request\x20sent');logger[_0xc4ca('0x14')](_0xc4ca('0x15'),_0x410269,'request\x20sent',JSON[_0xc4ca('0x16')](_0xca659b));if(_0xca659b[_0xc4ca('0x17')]){if(_0xca659b[_0xc4ca('0x17')][_0xc4ca('0x18')]===0x1f4){logger['error'](_0xc4ca('0x13'),_0x410269,_0xca659b['error'][_0xc4ca('0x19')]);return _0x451eb2(_0xca659b[_0xc4ca('0x17')][_0xc4ca('0x19')]);}logger[_0xc4ca('0x17')](_0xc4ca('0x13'),_0x410269,_0xca659b[_0xc4ca('0x17')][_0xc4ca('0x19')]);return _0x4cd46d(_0xca659b['error'][_0xc4ca('0x19')]);}else{logger[_0xc4ca('0x12')](_0xc4ca('0x13'),_0x410269,_0xc4ca('0x1a'));_0x4cd46d(_0xca659b[_0xc4ca('0x1b')][_0xc4ca('0x19')]);}})[_0xc4ca('0x1c')](function(_0x2dc826){logger['error'](_0xc4ca('0x13'),_0x410269,_0x2dc826);_0x451eb2(_0x2dc826);});});}exports['UpdateWhatsappInteraction']=function(_0x240fe5){var _0x3ff0aa=this;return new Promise(function(_0x178419,_0x57ed7e){return db['WhatsappInteraction'][_0xc4ca('0x1d')](_0x240fe5[_0xc4ca('0x1e')],{'raw':_0x240fe5[_0xc4ca('0x1f')]?_0x240fe5['options'][_0xc4ca('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x240fe5[_0xc4ca('0x1f')]?_0x240fe5['options'][_0xc4ca('0x21')]||null:null,'attributes':_0x240fe5['options']?_0x240fe5[_0xc4ca('0x1f')][_0xc4ca('0x22')]||null:null,'limit':_0x240fe5[_0xc4ca('0x1f')]?_0x240fe5[_0xc4ca('0x1f')]['limit']||null:null})[_0xc4ca('0x11')](function(_0x552d0e){logger['info'](_0xc4ca('0x23'),_0x240fe5);logger[_0xc4ca('0x14')](_0xc4ca('0x23'),_0x240fe5,JSON['stringify'](_0x552d0e));_0x178419(_0x552d0e);})['catch'](function(_0x4f1b72){logger[_0xc4ca('0x17')](_0xc4ca('0x23'),_0x4f1b72[_0xc4ca('0x19')],_0x240fe5);_0x57ed7e(_0x3ff0aa[_0xc4ca('0x17')](0x1f4,_0x4f1b72[_0xc4ca('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4d7026){return new Promise(function(_0x1b46bf,_0x212e23){return db['WhatsappInteraction']['find']({'where':_0x4d7026[_0xc4ca('0x1f')]?_0x4d7026['options'][_0xc4ca('0x21')]||null:null})[_0xc4ca('0x11')](function(_0x1f0906){if(_0x1f0906){return _0x1f0906['addTags'](_0x4d7026[_0xc4ca('0x1e')]['ids'],_[_0xc4ca('0x24')](_0x4d7026['body'],[_0xc4ca('0x25'),'id'])||{});}})['spread'](function(_0x4087a2){logger[_0xc4ca('0x12')](_0xc4ca('0x26'),_0x4d7026);logger[_0xc4ca('0x14')](_0xc4ca('0x26'),_0x4d7026,JSON['stringify'](_0x4087a2));_0x1b46bf(_0x4087a2);})[_0xc4ca('0x1c')](function(_0x3c22b3){logger[_0xc4ca('0x17')](_0xc4ca('0x26'),_0x3c22b3[_0xc4ca('0x19')],_0x4d7026);_0x212e23(_this[_0xc4ca('0x17')](0x1f4,_0x3c22b3[_0xc4ca('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 29949c4..75c7b33 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7040=['register','whatsappInteraction:','save','remove','update','emit'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x7040,0x182));var _0x0704=function(_0x5b68fb,_0x33c51a){_0x5b68fb=_0x5b68fb-0x0;var _0x339476=_0x7040[_0x5b68fb];return _0x339476;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x0704('0x0'),_0x0704('0x1'),_0x0704('0x2')];function createListener(_0x3b7a0a,_0x3090fd){return function(_0x11d82e){_0x3090fd[_0x0704('0x3')](_0x3b7a0a,_0x11d82e);};}function removeListener(_0x46dfd6,_0x13574d){return function(){WhatsappInteractionEvents['removeListener'](_0x46dfd6,_0x13574d);};}exports[_0x0704('0x4')]=function(_0x327de1){for(var _0x29775f=0x0,_0xa7598b=events['length'];_0x29775f<_0xa7598b;_0x29775f++){var _0x367128=events[_0x29775f];var _0x48492f=createListener(_0x0704('0x5')+_0x367128,_0x327de1);WhatsappInteractionEvents['on'](_0x367128,_0x48492f);}}; \ No newline at end of file +var _0xec80=['./whatsappInteraction.events','remove','emit','removeListener','length','whatsappInteraction:'];(function(_0x5ba72b,_0x2857bf){var _0x5d9386=function(_0x193bdf){while(--_0x193bdf){_0x5ba72b['push'](_0x5ba72b['shift']());}};_0x5d9386(++_0x2857bf);}(_0xec80,0x1bc));var _0x0ec8=function(_0xd6bb26,_0x63ff2){_0xd6bb26=_0xd6bb26-0x0;var _0x122866=_0xec80[_0xd6bb26];return _0x122866;};'use strict';var WhatsappInteractionEvents=require(_0x0ec8('0x0'));var events=['save',_0x0ec8('0x1'),'update'];function createListener(_0x4d84d0,_0x971710){return function(_0x84c34c){_0x971710[_0x0ec8('0x2')](_0x4d84d0,_0x84c34c);};}function removeListener(_0x5ed93d,_0x285529){return function(){WhatsappInteractionEvents[_0x0ec8('0x3')](_0x5ed93d,_0x285529);};}exports['register']=function(_0x401cc4){for(var _0x551740=0x0,_0x763fe6=events[_0x0ec8('0x4')];_0x551740<_0x763fe6;_0x551740++){var _0x284634=events[_0x551740];var _0x2814c6=createListener(_0x0ec8('0x5')+_0x284634,_0x401cc4);WhatsappInteractionEvents['on'](_0x284634,_0x2814c6);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 4144766..ec3c220 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x448b=['connect-timeout','express','../../components/auth/service','./whatsappMessage.controller','isAuthenticated','index','get','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0xe988d2,_0x5a0f20){var _0x52ef42=function(_0x389306){while(--_0x389306){_0xe988d2['push'](_0xe988d2['shift']());}};_0x52ef42(++_0x5a0f20);}(_0x448b,0xa0));var _0xb448=function(_0x1baf3e,_0x207188){_0x1baf3e=_0x1baf3e-0x0;var _0x31e1da=_0x448b[_0x1baf3e];return _0x31e1da;};'use strict';var multer=require(_0xb448('0x0'));var util=require(_0xb448('0x1'));var path=require('path');var timeout=require(_0xb448('0x2'));var express=require(_0xb448('0x3'));var router=express['Router']();var auth=require(_0xb448('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb448('0x5'));router['get']('/',auth[_0xb448('0x6')](),controller[_0xb448('0x7')]);router[_0xb448('0x8')]('/describe',auth[_0xb448('0x6')](),controller[_0xb448('0x9')]);router['get'](_0xb448('0xa'),auth[_0xb448('0x6')](),controller[_0xb448('0xb')]);router[_0xb448('0xc')]('/',auth[_0xb448('0x6')](),interaction[_0xb448('0xd')](_0xb448('0xe'),_0xb448('0xf')),controller[_0xb448('0x10')]);router[_0xb448('0xc')](_0xb448('0x11'),controller[_0xb448('0x12')]);router['put'](_0xb448('0xa'),auth['isAuthenticated'](),controller[_0xb448('0x13')]);router[_0xb448('0x14')](_0xb448('0x15'),auth[_0xb448('0x6')](),controller['accept']);router[_0xb448('0x14')](_0xb448('0x16'),auth['isAuthenticated'](),controller[_0xb448('0x17')]);router[_0xb448('0x18')](_0xb448('0xa'),auth[_0xb448('0x6')](),controller[_0xb448('0x19')]);module[_0xb448('0x1a')]=router; \ No newline at end of file +var _0x163c=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','whatsapp','whatsappmessage:create','create','status','put','accept','/:id/reject','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2b9448,_0x33e0f2){var _0xfaf5ab=function(_0x4de537){while(--_0x4de537){_0x2b9448['push'](_0x2b9448['shift']());}};_0xfaf5ab(++_0x33e0f2);}(_0x163c,0x121));var _0xc163=function(_0xf2d87,_0x2808a2){_0xf2d87=_0xf2d87-0x0;var _0x5a08f9=_0x163c[_0xf2d87];return _0x5a08f9;};'use strict';var multer=require('multer');var util=require(_0xc163('0x0'));var path=require(_0xc163('0x1'));var timeout=require(_0xc163('0x2'));var express=require(_0xc163('0x3'));var router=express['Router']();var auth=require(_0xc163('0x4'));var interaction=require(_0xc163('0x5'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xc163('0x6')]('/',auth[_0xc163('0x7')](),controller[_0xc163('0x8')]);router[_0xc163('0x6')](_0xc163('0x9'),auth['isAuthenticated'](),controller[_0xc163('0xa')]);router[_0xc163('0x6')](_0xc163('0xb'),auth[_0xc163('0x7')](),controller['show']);router[_0xc163('0xc')]('/',auth[_0xc163('0x7')](),interaction['tracked'](_0xc163('0xd'),_0xc163('0xe')),controller[_0xc163('0xf')]);router[_0xc163('0xc')]('/:id/status',controller[_0xc163('0x10')]);router['put']('/:id',auth[_0xc163('0x7')](),controller['update']);router[_0xc163('0x11')]('/:id/accept',auth[_0xc163('0x7')](),controller[_0xc163('0x12')]);router[_0xc163('0x11')](_0xc163('0x13'),auth[_0xc163('0x7')](),controller['reject']);router['delete'](_0xc163('0xb'),auth[_0xc163('0x7')](),controller['destroy']);module[_0xc163('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index fac834f..31f527b 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49f9=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x49f9,0x141));var _0x949f=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x49f9[_0x237546];return _0x233e29;};'use strict';var Sequelize=require(_0x949f('0x0'));module['exports']={'body':{'type':Sequelize[_0x949f('0x1')](_0x949f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x949f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x949f('0x4')]('in',_0x949f('0x5')),'defaultValue':_0x949f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x949f('0x6')](0xbe)},'phone':{'type':Sequelize[_0x949f('0x6')]},'readAt':{'type':Sequelize[_0x949f('0x7')]},'secret':{'type':Sequelize[_0x949f('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x949f('0x6')]},'providerResponse':{'type':Sequelize[_0x949f('0x1')]}}; \ No newline at end of file +var _0xb148=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3366da,_0x4d2c3d){var _0x2407f6=function(_0x380629){while(--_0x380629){_0x3366da['push'](_0x3366da['shift']());}};_0x2407f6(++_0x4d2c3d);}(_0xb148,0x93));var _0x8b14=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0xb148[_0x3de7e0];return _0x11d0b3;};'use strict';var Sequelize=require(_0x8b14('0x0'));module[_0x8b14('0x1')]={'body':{'type':Sequelize[_0x8b14('0x2')](_0x8b14('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8b14('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b14('0x5')]('in',_0x8b14('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x8b14('0x7')]},'readAt':{'type':Sequelize[_0x8b14('0x8')]},'secret':{'type':Sequelize[_0x8b14('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index e42ffa9..ab94317 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','http','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','limit','Content-Range','json','apply','reject','save','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','findAll','keys','include','find','create','update','body','params','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','info','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','null','RejectMessage','rejectMessage','SIP/%s','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x1e9846,_0xab9a7){var _0x3f6e96=function(_0x454d39){while(--_0x454d39){_0x1e9846['push'](_0x1e9846['shift']());}};_0x3f6e96(++_0xab9a7);}(_0x1967,0x173));var _0x7196=function(_0x10a313,_0x12b09e){_0x10a313=_0x10a313-0x0;var _0x395faf=_0x1967[_0x10a313];return _0x395faf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7196('0x0'));var rimraf=require(_0x7196('0x1'));var zipdir=require(_0x7196('0x2'));var jsonpatch=require(_0x7196('0x3'));var rp=require(_0x7196('0x4'));var moment=require(_0x7196('0x5'));var BPromise=require(_0x7196('0x6'));var Mustache=require(_0x7196('0x7'));var util=require(_0x7196('0x8'));var path=require(_0x7196('0x9'));var sox=require('sox');var csv=require(_0x7196('0xa'));var ejs=require(_0x7196('0xb'));var fs=require('fs');var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0xa'));var querystring=require(_0x7196('0x10'));var Papa=require(_0x7196('0x11'));var Redis=require(_0x7196('0x12'));var authService=require(_0x7196('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x14'));var logger=require(_0x7196('0x15'))(_0x7196('0x16'));var utils=require(_0x7196('0x17'));var config=require(_0x7196('0x18'));var licenseUtil=require(_0x7196('0x19'));var db=require(_0x7196('0x1a'))['db'];config[_0x7196('0x1b')]=_[_0x7196('0x1c')](config[_0x7196('0x1b')],{'host':_0x7196('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7196('0x1b')]));require(_0x7196('0x1e'))[_0x7196('0x1f')](socket);var jayson=require(_0x7196('0x20'));var client=jayson['client'][_0x7196('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x7196('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2590a6,_0xf7e97,_0x3ed1ad,_0x12dce7){return new BPromise(function(_0x2e3e0e,_0x22bd62){var _0x1ed296=_0x12dce7||client;return _0x1ed296[_0x7196('0x22')](_0x2590a6,_0x3ed1ad)[_0x7196('0x23')](function(_0x385f2d){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xf7e97,_0x7196('0x24'));logger[_0x7196('0x25')](_0x7196('0x26'),_0xf7e97,'request\x20sent',JSON[_0x7196('0x27')](_0x385f2d));if(_0x385f2d['error']){if(_0x385f2d['error'][_0x7196('0x28')]===0x1f4){logger[_0x7196('0x29')](_0x7196('0x2a'),_0xf7e97,_0x385f2d['error']['message']);return _0x22bd62(_0x385f2d[_0x7196('0x29')][_0x7196('0x2b')]);}logger['error'](_0x7196('0x2a'),_0xf7e97,_0x385f2d[_0x7196('0x29')][_0x7196('0x2b')]);return _0x2e3e0e(_0x385f2d[_0x7196('0x29')][_0x7196('0x2b')]);}else{logger['info'](_0x7196('0x2a'),_0xf7e97,'request\x20sent');_0x2e3e0e(_0x385f2d[_0x7196('0x2c')][_0x7196('0x2b')]);}})[_0x7196('0x2d')](function(_0xa69810){logger[_0x7196('0x29')](_0x7196('0x2a'),_0xf7e97,_0xa69810);_0x22bd62(_0xa69810);});});}function respondWithStatusCode(_0x530ab5,_0x57c404){_0x57c404=_0x57c404||0xcc;return function(_0x1482e5){if(_0x1482e5){return _0x530ab5[_0x7196('0x2e')](_0x57c404);}return _0x530ab5[_0x7196('0x2f')](_0x57c404)['end']();};}function respondWithResult(_0x5aa538,_0x41cfd2){_0x41cfd2=_0x41cfd2||0xc8;return function(_0x162cfc){if(_0x162cfc){return _0x5aa538[_0x7196('0x2f')](_0x41cfd2)['json'](_0x162cfc);}};}function respondWithFilteredResult(_0x35eef9,_0x4ecea1){return function(_0x4fd339){if(_0x4fd339){var _0x59d79d=_0x4fd339['count'],_0x30151f=_0x4ecea1[_0x7196('0x30')],_0x985727=_0x4ecea1[_0x7196('0x30')]+_0x4ecea1[_0x7196('0x31')],_0x1257ad;if(_0x985727>=_0x59d79d){_0x985727=_0x59d79d;_0x1257ad=0xc8;}else{_0x1257ad=0xce;}_0x35eef9[_0x7196('0x2f')](_0x1257ad);return _0x35eef9['set'](_0x7196('0x32'),_0x30151f+'-'+_0x985727+'/'+_0x59d79d)[_0x7196('0x33')](_0x4fd339);}return null;};}function patchUpdates(_0xd07f22){return function(_0x651d7e){try{jsonpatch[_0x7196('0x34')](_0x651d7e,_0xd07f22,!![]);}catch(_0x2786f3){return BPromise[_0x7196('0x35')](_0x2786f3);}return _0x651d7e[_0x7196('0x36')]();};}function saveUpdates(_0x354175,_0xf33b59){return function(_0x1ff4b4){if(_0x1ff4b4){return _0x1ff4b4['update'](_0x354175)[_0x7196('0x23')](function(_0x4fbe57){return _0x4fbe57;});}return null;};}function removeEntity(_0x2452f6,_0x4c3365){return function(_0x372ddc){if(_0x372ddc){return _0x372ddc[_0x7196('0x37')]()['then'](function(){_0x2452f6[_0x7196('0x2f')](0xcc)[_0x7196('0x38')]();});}};}function handleEntityNotFound(_0x4531d7,_0x3a56b4){return function(_0x7547cf){if(!_0x7547cf){_0x4531d7['sendStatus'](0x194);}return _0x7547cf;};}function handleError(_0x10b8c2,_0x2f68e2){_0x2f68e2=_0x2f68e2||0x1f4;return function(_0x2174ca){logger[_0x7196('0x29')](_0x2174ca[_0x7196('0x39')]);if(_0x2174ca[_0x7196('0x3a')]){delete _0x2174ca['name'];}_0x10b8c2[_0x7196('0x2f')](_0x2f68e2)[_0x7196('0x3b')](_0x2174ca);};}exports[_0x7196('0x3c')]=function(_0x4f6b27,_0x33831a){var _0x75530e={},_0xd72bd9={},_0xa24847={'count':0x0,'rows':[]};var _0x11d4ec=_[_0x7196('0x3d')](db[_0x7196('0x3e')][_0x7196('0x3f')],function(_0x92cfb1){return{'name':_0x92cfb1[_0x7196('0x40')],'type':_0x92cfb1['type'][_0x7196('0x41')]};});_0xd72bd9[_0x7196('0x42')]=_['map'](_0x11d4ec,_0x7196('0x3a'));_0xd72bd9['query']=_['keys'](_0x4f6b27[_0x7196('0x43')]);_0xd72bd9[_0x7196('0x44')]=_['intersection'](_0xd72bd9['model'],_0xd72bd9[_0x7196('0x43')]);_0x75530e[_0x7196('0x45')]=_[_0x7196('0x46')](_0xd72bd9['model'],qs[_0x7196('0x47')](_0x4f6b27[_0x7196('0x43')][_0x7196('0x47')]));_0x75530e[_0x7196('0x45')]=_0x75530e[_0x7196('0x45')][_0x7196('0x48')]?_0x75530e[_0x7196('0x45')]:_0xd72bd9[_0x7196('0x42')];if(!_0x4f6b27['query'][_0x7196('0x49')](_0x7196('0x4a'))){_0x75530e['limit']=qs[_0x7196('0x31')](_0x4f6b27[_0x7196('0x43')]['limit']);_0x75530e[_0x7196('0x30')]=qs[_0x7196('0x30')](_0x4f6b27[_0x7196('0x43')]['offset']);}_0x75530e[_0x7196('0x4b')]=qs[_0x7196('0x4c')](_0x4f6b27['query'][_0x7196('0x4c')]);_0x75530e[_0x7196('0x4d')]=qs['filters'](_[_0x7196('0x4e')](_0x4f6b27['query'],_0xd72bd9['filters']),_0x11d4ec);if(_0x4f6b27['query']['filter']){_0x75530e['where']=_[_0x7196('0x4f')](_0x75530e['where'],{'$or':_[_0x7196('0x3d')](_0x11d4ec,function(_0x3a659f){if(_0x3a659f[_0x7196('0x50')]!==_0x7196('0x51')){var _0x522fbd={};_0x522fbd[_0x3a659f[_0x7196('0x3a')]]={'$like':'%'+_0x4f6b27['query'][_0x7196('0x52')]+'%'};return _0x522fbd;}})});}_0x75530e=_[_0x7196('0x4f')]({},_0x75530e,_0x4f6b27[_0x7196('0x53')]);var _0x5e34e8={'where':_0x75530e[_0x7196('0x4d')]};return db[_0x7196('0x3e')][_0x7196('0x54')](_0x5e34e8)['then'](function(_0x4e2aad){_0xa24847[_0x7196('0x54')]=_0x4e2aad;if(_0x4f6b27['query'][_0x7196('0x55')]){_0x75530e['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x7196('0x56')](_0x75530e);})['then'](function(_0x48f5e7){_0xa24847['rows']=_0x48f5e7;return _0xa24847;})[_0x7196('0x23')](respondWithFilteredResult(_0x33831a,_0x75530e))['catch'](handleError(_0x33831a,null));};exports['show']=function(_0x28591e,_0x182c8b){var _0x2262d8={'raw':!![],'where':{'id':_0x28591e['params']['id']}},_0x1786fa={};_0x1786fa[_0x7196('0x42')]=_['keys'](db[_0x7196('0x3e')][_0x7196('0x3f')]);_0x1786fa['query']=_[_0x7196('0x57')](_0x28591e[_0x7196('0x43')]);_0x1786fa[_0x7196('0x44')]=_['intersection'](_0x1786fa[_0x7196('0x42')],_0x1786fa['query']);_0x2262d8[_0x7196('0x45')]=_[_0x7196('0x46')](_0x1786fa[_0x7196('0x42')],qs[_0x7196('0x47')](_0x28591e[_0x7196('0x43')][_0x7196('0x47')]));_0x2262d8[_0x7196('0x45')]=_0x2262d8[_0x7196('0x45')]['length']?_0x2262d8['attributes']:_0x1786fa[_0x7196('0x42')];if(_0x28591e[_0x7196('0x43')][_0x7196('0x55')]){_0x2262d8[_0x7196('0x58')]=[{'all':!![]}];}_0x2262d8=_['merge']({},_0x2262d8,_0x28591e[_0x7196('0x53')]);return db[_0x7196('0x3e')][_0x7196('0x59')](_0x2262d8)[_0x7196('0x23')](handleEntityNotFound(_0x182c8b,null))[_0x7196('0x23')](respondWithResult(_0x182c8b,null))[_0x7196('0x2d')](handleError(_0x182c8b,null));};exports[_0x7196('0x5a')]=function(_0x18b49b,_0x1f3c60){return db[_0x7196('0x3e')][_0x7196('0x5a')](_0x18b49b['body'],{})[_0x7196('0x23')](respondWithResult(_0x1f3c60,0xc9))[_0x7196('0x2d')](handleError(_0x1f3c60,null));};exports[_0x7196('0x5b')]=function(_0x48f196,_0x1f098c){if(_0x48f196['body']['id']){delete _0x48f196[_0x7196('0x5c')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x59')]({'where':{'id':_0x48f196[_0x7196('0x5d')]['id']}})[_0x7196('0x23')](handleEntityNotFound(_0x1f098c,null))['then'](saveUpdates(_0x48f196[_0x7196('0x5c')],null))['then'](respondWithResult(_0x1f098c,null))['catch'](handleError(_0x1f098c,null));};exports['destroy']=function(_0x1bc358,_0x3be180){return db[_0x7196('0x3e')][_0x7196('0x59')]({'where':{'id':_0x1bc358[_0x7196('0x5d')]['id']}})[_0x7196('0x23')](handleEntityNotFound(_0x3be180,null))[_0x7196('0x23')](removeEntity(_0x3be180,null))['catch'](handleError(_0x3be180,null));};exports[_0x7196('0x5e')]=function(_0x14dc43,_0x2d14f4){return db[_0x7196('0x3e')][_0x7196('0x5e')]()['then'](respondWithResult(_0x2d14f4,null))['catch'](handleError(_0x2d14f4,null));};var interaction_log=require(_0x7196('0x15'))(_0x7196('0x5f'));exports[_0x7196('0x60')]=function(_0x799399,_0x14cb38,_0x43b9ac){var _0xe3fb61={'channel':_0x7196('0x61')};if(_0x799399[_0x7196('0x5c')]['id']){delete _0x799399[_0x7196('0x5c')]['id'];}_0x799399[_0x7196('0x5c')]['read']=!![];_0x799399[_0x7196('0x5c')][_0x7196('0x62')]=moment()[_0x7196('0x63')](_0x7196('0x64'));_0x799399['body'][_0x7196('0x65')]=_0x799399[_0x7196('0x5c')][_0x7196('0x65')]||_0x799399[_0x7196('0x66')]['id'];return db[_0x7196('0x3e')][_0x7196('0x59')]({'where':{'id':_0x799399[_0x7196('0x5d')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x7196('0x67')}]})[_0x7196('0x23')](handleEntityNotFound(_0x14cb38,null))[_0x7196('0x23')](saveUpdates(_0x799399[_0x7196('0x5c')],null))['then'](function(_0x418a7a){if(_0x418a7a){_0xe3fb61[_0x7196('0x2b')]=_0x418a7a[_0x7196('0x68')]({'plain':!![]});return db[_0x7196('0x69')][_0x7196('0x59')]({'where':{'id':_0x418a7a[_0x7196('0x6a')]}});}return null;})[_0x7196('0x23')](handleEntityNotFound(_0x14cb38,null))['then'](function(_0x56b2eb){if(_0x56b2eb){return _0x56b2eb['update']({'UserId':_0x799399[_0x7196('0x5c')]['UserId'],'read1stAt':_[_0x7196('0x6b')](_0x56b2eb[_0x7196('0x6c')])?moment()[_0x7196('0x63')](_0x7196('0x64')):undefined});}return null;})[_0x7196('0x23')](function(_0x30d44f){if(_0x30d44f){_0xe3fb61[_0x7196('0x6d')]=_0x30d44f[_0x7196('0x68')]({'plain':!![]});interaction_log[_0x7196('0x6e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x799399['user']['id'],_0x799399[_0x7196('0x66')][_0x7196('0x3a')],_0x799399[_0x7196('0x66')][_0x7196('0x6f')],_0xe3fb61[_0x7196('0x6d')]['id'],_0x799399[_0x7196('0x5c')]?JSON[_0x7196('0x27')](_0x799399[_0x7196('0x5c')]):'null');return respondWithRpcPromise('AcceptMessage',_0x7196('0x70'),_0xe3fb61);}return null;})['then'](function(_0x30d114){if(_0x30d114){if(_0x799399['body'][_0x7196('0x71')]){_0xe3fb61[_0x7196('0x2b')][_0x7196('0x72')]=util[_0x7196('0x63')]('SIP/%s',_0x799399['user'][_0x7196('0x3a')]);_0xe3fb61['message'][_0x7196('0x73')]=_0xe3fb61[_0x7196('0x73')];_0xe3fb61[_0x7196('0x2b')][_0x7196('0x74')]=_0x7196('0x60');return respondWithRpcPromise(_0x7196('0x75'),'EventManager',{'event':_0x7196('0x76'),'message':_0xe3fb61[_0x7196('0x2b')]},client9002)[_0x7196('0x23')](function(){return _0xe3fb61;});}return _0xe3fb61;}return null;})[_0x7196('0x23')](respondWithResult(_0x14cb38,null))[_0x7196('0x2d')](handleError(_0x14cb38,null));};var interaction_log=require(_0x7196('0x15'))(_0x7196('0x5f'));exports[_0x7196('0x35')]=function(_0x13cbe2,_0xa20de8,_0x3d3768){var _0x2181f5={'agent':{},'channel':'whatsapp'};if(_0x13cbe2[_0x7196('0x5c')]['id']){delete _0x13cbe2[_0x7196('0x5c')]['id'];}_0x13cbe2['body']['UserId']=_0x13cbe2[_0x7196('0x5c')][_0x7196('0x65')]||_0x13cbe2[_0x7196('0x66')]['id'];_0x2181f5['agent']['id']=_0x13cbe2[_0x7196('0x5c')]['UserId'];return db[_0x7196('0x3e')][_0x7196('0x59')]({'where':{'id':_0x13cbe2['params']['id'],'UserId':null}})[_0x7196('0x23')](handleEntityNotFound(_0xa20de8,null))['then'](function(_0x50d1f1){if(_0x50d1f1){_0x2181f5[_0x7196('0x2b')]=_0x50d1f1[_0x7196('0x68')]({'plain':!![]});return db[_0x7196('0x69')]['find']({'where':{'id':_0x50d1f1[_0x7196('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0xa20de8,null))[_0x7196('0x23')](function(_0x36b828){if(_0x36b828){_0x2181f5[_0x7196('0x6d')]=_0x36b828[_0x7196('0x68')]({'plain':!![]});interaction_log[_0x7196('0x6e')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x13cbe2[_0x7196('0x66')]['id'],_0x13cbe2[_0x7196('0x66')][_0x7196('0x3a')],_0x13cbe2[_0x7196('0x66')][_0x7196('0x6f')],_0x2181f5[_0x7196('0x6d')]['id'],_0x13cbe2[_0x7196('0x5c')]?JSON[_0x7196('0x27')](_0x13cbe2['body']):_0x7196('0x77'));return respondWithRpcPromise(_0x7196('0x78'),_0x7196('0x79'),_0x2181f5);}return null;})[_0x7196('0x23')](function(_0x539584){if(_0x539584){_0x539584[_0x7196('0x2b')][_0x7196('0x72')]=util['format'](_0x7196('0x7a'),_0x13cbe2['user'][_0x7196('0x3a')]);_0x539584['message'][_0x7196('0x73')]=_0x2181f5[_0x7196('0x73')];_0x539584['message'][_0x7196('0x74')]=_0x7196('0x35');respondWithRpcPromise(_0x7196('0x75'),'EventManager',{'event':'rejectmessage','message':_0x539584[_0x7196('0x2b')]},client9002);return _0x2181f5;}return null;})['then'](respondWithResult(_0xa20de8,null))['catch'](handleError(_0xa20de8,null));};exports[_0x7196('0x2f')]=function(_0x72c765,_0xd7312c,_0x509c4a){if(_0x72c765[_0x7196('0x5c')]['id']){delete _0x72c765[_0x7196('0x5c')]['id'];}var _0x8b6e77;return db[_0x7196('0x3e')][_0x7196('0x59')]({'where':{'id':_0x72c765[_0x7196('0x5d')]['id']}})[_0x7196('0x23')](handleEntityNotFound(_0xd7312c,null))[_0x7196('0x23')](function(_0x32ba47){if(_0x32ba47){_0x8b6e77=_0x32ba47;return db[_0x7196('0x7b')][_0x7196('0x59')]({'where':{'id':_0x32ba47['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0xd7312c,null))[_0x7196('0x23')](function(_0x5d52a8){if(_0x5d52a8){logger['debug'](_0x7196('0x7c'),_0x7196('0x2f'),_0x7196('0x7d'),_0x5d52a8[_0x7196('0x50')],util['inspect'](_0x72c765['body'],{'showHidden':![],'depth':null}));switch(_0x5d52a8[_0x7196('0x50')]){case _0x7196('0x7e'):if(_0x72c765[_0x7196('0x5c')][_0x7196('0x7f')]&&_0x72c765['body'][_0x7196('0x7f')]===_0x8b6e77['messageId']&&_0x72c765['body'][_0x7196('0x80')]&&_0x72c765[_0x7196('0x5c')][_0x7196('0x80')]==='read'){return _0x8b6e77[_0x7196('0x5b')]({'read':!![]});}else{logger[_0x7196('0x29')](_0x7196('0x81'),_0x7196('0x2f'),_0x7196('0x7e'),util[_0x7196('0x82')](_0x72c765[_0x7196('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x8b6e77;}})[_0x7196('0x23')](respondWithResult(_0xd7312c,null))['catch'](handleError(_0xd7312c,null));}; \ No newline at end of file +var _0x14a0=['RejectMessage','rejectMessage','interface','SIP/%s','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','WhatsappMessage','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contact','WhatsappInteractionId','UserId','isNil','read1stAt','get','user','role','interaction','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x14cb58,_0x214d62){var _0x5f097e=function(_0x5b8666){while(--_0x5b8666){_0x14cb58['push'](_0x14cb58['shift']());}};_0x5f097e(++_0x214d62);}(_0x14a0,0x8e));var _0x014a=function(_0x2aa587,_0x4b26e0){_0x2aa587=_0x2aa587-0x0;var _0x56a953=_0x14a0[_0x2aa587];return _0x56a953;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x014a('0x0'));var rimraf=require(_0x014a('0x1'));var zipdir=require(_0x014a('0x2'));var jsonpatch=require(_0x014a('0x3'));var rp=require(_0x014a('0x4'));var moment=require(_0x014a('0x5'));var BPromise=require(_0x014a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x014a('0x7'));var sox=require(_0x014a('0x8'));var csv=require(_0x014a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);var jayson=require(_0x014a('0x1a'));var client=jayson['client'][_0x014a('0x1b')]({'port':0x232c});var client9002=jayson[_0x014a('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a836f,_0x128c46,_0x59a4ea,_0x16e6fc){return new BPromise(function(_0x17e4be,_0x20f148){var _0x12da95=_0x16e6fc||client;return _0x12da95[_0x014a('0x1d')](_0x3a836f,_0x59a4ea)[_0x014a('0x1e')](function(_0x61ec9f){logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x128c46,_0x014a('0x21'),JSON[_0x014a('0x24')](_0x61ec9f));if(_0x61ec9f['error']){if(_0x61ec9f[_0x014a('0x25')][_0x014a('0x26')]===0x1f4){logger[_0x014a('0x25')](_0x014a('0x20'),_0x128c46,_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);return _0x20f148(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}logger[_0x014a('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x128c46,_0x61ec9f[_0x014a('0x25')]['message']);return _0x17e4be(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}else{logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));_0x17e4be(_0x61ec9f[_0x014a('0x28')][_0x014a('0x27')]);}})[_0x014a('0x29')](function(_0x165a42){logger['error'](_0x014a('0x20'),_0x128c46,_0x165a42);_0x20f148(_0x165a42);});});}function respondWithStatusCode(_0x5358e9,_0x39a432){_0x39a432=_0x39a432||0xcc;return function(_0x28701e){if(_0x28701e){return _0x5358e9['sendStatus'](_0x39a432);}return _0x5358e9['status'](_0x39a432)[_0x014a('0x2a')]();};}function respondWithResult(_0x3f9719,_0x143346){_0x143346=_0x143346||0xc8;return function(_0x5ed71b){if(_0x5ed71b){return _0x3f9719[_0x014a('0x2b')](_0x143346)[_0x014a('0x2c')](_0x5ed71b);}};}function respondWithFilteredResult(_0x598179,_0x31dc95){return function(_0x2560a6){if(_0x2560a6){var _0x496040=_0x2560a6[_0x014a('0x2d')],_0x4f9c1c=_0x31dc95[_0x014a('0x2e')],_0x397850=_0x31dc95['offset']+_0x31dc95[_0x014a('0x2f')],_0x3e5a0a;if(_0x397850>=_0x496040){_0x397850=_0x496040;_0x3e5a0a=0xc8;}else{_0x3e5a0a=0xce;}_0x598179[_0x014a('0x2b')](_0x3e5a0a);return _0x598179[_0x014a('0x30')](_0x014a('0x31'),_0x4f9c1c+'-'+_0x397850+'/'+_0x496040)[_0x014a('0x2c')](_0x2560a6);}return null;};}function patchUpdates(_0x1eb007){return function(_0x354f4c){try{jsonpatch[_0x014a('0x32')](_0x354f4c,_0x1eb007,!![]);}catch(_0xc802d5){return BPromise[_0x014a('0x33')](_0xc802d5);}return _0x354f4c[_0x014a('0x34')]();};}function saveUpdates(_0x4ed54e,_0x105d4a){return function(_0x41ead8){if(_0x41ead8){return _0x41ead8[_0x014a('0x35')](_0x4ed54e)[_0x014a('0x1e')](function(_0x5f1022){return _0x5f1022;});}return null;};}function removeEntity(_0x39b3b8,_0x211d18){return function(_0x4dd025){if(_0x4dd025){return _0x4dd025[_0x014a('0x36')]()[_0x014a('0x1e')](function(){_0x39b3b8['status'](0xcc)[_0x014a('0x2a')]();});}};}function handleEntityNotFound(_0x12de94,_0x40738f){return function(_0x467032){if(!_0x467032){_0x12de94[_0x014a('0x37')](0x194);}return _0x467032;};}function handleError(_0xa8fcfb,_0x26a5e8){_0x26a5e8=_0x26a5e8||0x1f4;return function(_0x1cff0f){logger['error'](_0x1cff0f[_0x014a('0x38')]);if(_0x1cff0f[_0x014a('0x39')]){delete _0x1cff0f[_0x014a('0x39')];}_0xa8fcfb[_0x014a('0x2b')](_0x26a5e8)['send'](_0x1cff0f);};}exports[_0x014a('0x3a')]=function(_0x978870,_0x27ee0c){var _0x157bd0={},_0x35e527={},_0x309925={'count':0x0,'rows':[]};var _0x128fb9=_[_0x014a('0x3b')](db[_0x014a('0x3c')]['rawAttributes'],function(_0x1b34f8){return{'name':_0x1b34f8['fieldName'],'type':_0x1b34f8[_0x014a('0x3d')][_0x014a('0x3e')]};});_0x35e527[_0x014a('0x3f')]=_[_0x014a('0x3b')](_0x128fb9,_0x014a('0x39'));_0x35e527['query']=_[_0x014a('0x40')](_0x978870[_0x014a('0x41')]);_0x35e527['filters']=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],_0x35e527[_0x014a('0x41')]);_0x157bd0[_0x014a('0x43')]=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x978870[_0x014a('0x41')][_0x014a('0x44')]));_0x157bd0['attributes']=_0x157bd0[_0x014a('0x43')][_0x014a('0x45')]?_0x157bd0[_0x014a('0x43')]:_0x35e527[_0x014a('0x3f')];if(!_0x978870['query'][_0x014a('0x46')](_0x014a('0x47'))){_0x157bd0[_0x014a('0x2f')]=qs[_0x014a('0x2f')](_0x978870[_0x014a('0x41')][_0x014a('0x2f')]);_0x157bd0['offset']=qs[_0x014a('0x2e')](_0x978870[_0x014a('0x41')]['offset']);}_0x157bd0[_0x014a('0x48')]=qs[_0x014a('0x49')](_0x978870[_0x014a('0x41')]['sort']);_0x157bd0[_0x014a('0x4a')]=qs['filters'](_['pick'](_0x978870[_0x014a('0x41')],_0x35e527[_0x014a('0x4b')]),_0x128fb9);if(_0x978870['query'][_0x014a('0x4c')]){_0x157bd0[_0x014a('0x4a')]=_[_0x014a('0x4d')](_0x157bd0[_0x014a('0x4a')],{'$or':_[_0x014a('0x3b')](_0x128fb9,function(_0xbaf8c6){if(_0xbaf8c6['type']!==_0x014a('0x4e')){var _0xb0d8e0={};_0xb0d8e0[_0xbaf8c6[_0x014a('0x39')]]={'$like':'%'+_0x978870['query']['filter']+'%'};return _0xb0d8e0;}})});}_0x157bd0=_[_0x014a('0x4d')]({},_0x157bd0,_0x978870['options']);var _0x489590={'where':_0x157bd0[_0x014a('0x4a')]};return db['WhatsappMessage'][_0x014a('0x2d')](_0x489590)[_0x014a('0x1e')](function(_0x36372d){_0x309925['count']=_0x36372d;if(_0x978870[_0x014a('0x41')][_0x014a('0x4f')]){_0x157bd0[_0x014a('0x50')]=[{'all':!![]}];}return db[_0x014a('0x3c')][_0x014a('0x51')](_0x157bd0);})[_0x014a('0x1e')](function(_0x559954){_0x309925[_0x014a('0x52')]=_0x559954;return _0x309925;})[_0x014a('0x1e')](respondWithFilteredResult(_0x27ee0c,_0x157bd0))['catch'](handleError(_0x27ee0c,null));};exports[_0x014a('0x53')]=function(_0x29345b,_0x20bb0c){var _0x324df7={'raw':!![],'where':{'id':_0x29345b[_0x014a('0x54')]['id']}},_0x40a9c1={};_0x40a9c1[_0x014a('0x3f')]=_[_0x014a('0x40')](db['WhatsappMessage'][_0x014a('0x55')]);_0x40a9c1[_0x014a('0x41')]=_[_0x014a('0x40')](_0x29345b[_0x014a('0x41')]);_0x40a9c1[_0x014a('0x4b')]=_['intersection'](_0x40a9c1[_0x014a('0x3f')],_0x40a9c1['query']);_0x324df7[_0x014a('0x43')]=_[_0x014a('0x42')](_0x40a9c1[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x29345b[_0x014a('0x41')]['fields']));_0x324df7['attributes']=_0x324df7['attributes']['length']?_0x324df7[_0x014a('0x43')]:_0x40a9c1['model'];if(_0x29345b[_0x014a('0x41')]['includeAll']){_0x324df7['include']=[{'all':!![]}];}_0x324df7=_[_0x014a('0x4d')]({},_0x324df7,_0x29345b['options']);return db[_0x014a('0x3c')][_0x014a('0x56')](_0x324df7)[_0x014a('0x1e')](handleEntityNotFound(_0x20bb0c,null))[_0x014a('0x1e')](respondWithResult(_0x20bb0c,null))[_0x014a('0x29')](handleError(_0x20bb0c,null));};exports[_0x014a('0x57')]=function(_0x35a421,_0x46fa9d){return db[_0x014a('0x3c')][_0x014a('0x57')](_0x35a421['body'],{})['then'](respondWithResult(_0x46fa9d,0xc9))[_0x014a('0x29')](handleError(_0x46fa9d,null));};exports[_0x014a('0x35')]=function(_0x237345,_0x4cc246){if(_0x237345['body']['id']){delete _0x237345[_0x014a('0x58')]['id'];}return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x237345[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x4cc246,null))[_0x014a('0x1e')](saveUpdates(_0x237345['body'],null))[_0x014a('0x1e')](respondWithResult(_0x4cc246,null))[_0x014a('0x29')](handleError(_0x4cc246,null));};exports[_0x014a('0x36')]=function(_0x56c09b,_0xbaeb5f){return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x56c09b[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0xbaeb5f,null))[_0x014a('0x1e')](removeEntity(_0xbaeb5f,null))[_0x014a('0x29')](handleError(_0xbaeb5f,null));};exports[_0x014a('0x59')]=function(_0x4e9260,_0x889080){return db[_0x014a('0x3c')][_0x014a('0x59')]()['then'](respondWithResult(_0x889080,null))[_0x014a('0x29')](handleError(_0x889080,null));};var interaction_log=require(_0x014a('0xf'))(_0x014a('0x5a'));exports[_0x014a('0x5b')]=function(_0x11bf5c,_0x5da1f7,_0x8ac9cd){var _0x46168d={'channel':_0x014a('0x5c')};if(_0x11bf5c[_0x014a('0x58')]['id']){delete _0x11bf5c[_0x014a('0x58')]['id'];}_0x11bf5c[_0x014a('0x58')][_0x014a('0x5d')]=!![];_0x11bf5c[_0x014a('0x58')][_0x014a('0x5e')]=moment()[_0x014a('0x5f')](_0x014a('0x60'));_0x11bf5c[_0x014a('0x58')]['UserId']=_0x11bf5c[_0x014a('0x58')]['UserId']||_0x11bf5c['user']['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x11bf5c['params']['id'],'UserId':null},'include':[{'model':db[_0x014a('0x61')],'as':_0x014a('0x62')}]})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))['then'](saveUpdates(_0x11bf5c[_0x014a('0x58')],null))[_0x014a('0x1e')](function(_0x3071c8){if(_0x3071c8){_0x46168d[_0x014a('0x27')]=_0x3071c8['get']({'plain':!![]});return db['WhatsappInteraction'][_0x014a('0x56')]({'where':{'id':_0x3071c8[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))[_0x014a('0x1e')](function(_0x34c0b2){if(_0x34c0b2){return _0x34c0b2[_0x014a('0x35')]({'UserId':_0x11bf5c[_0x014a('0x58')][_0x014a('0x64')],'read1stAt':_[_0x014a('0x65')](_0x34c0b2[_0x014a('0x66')])?moment()[_0x014a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x014a('0x1e')](function(_0x25a53b){if(_0x25a53b){_0x46168d['interaction']=_0x25a53b[_0x014a('0x67')]({'plain':!![]});interaction_log[_0x014a('0x1f')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11bf5c[_0x014a('0x68')]['id'],_0x11bf5c['user'][_0x014a('0x39')],_0x11bf5c[_0x014a('0x68')][_0x014a('0x69')],_0x46168d[_0x014a('0x6a')]['id'],_0x11bf5c[_0x014a('0x58')]?JSON['stringify'](_0x11bf5c[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x6c'),_0x014a('0x6d'),_0x46168d);}return null;})[_0x014a('0x1e')](function(_0x52e79e){if(_0x52e79e){if(_0x11bf5c[_0x014a('0x58')][_0x014a('0x6e')]){_0x46168d[_0x014a('0x27')]['interface']=util[_0x014a('0x5f')]('SIP/%s',_0x11bf5c[_0x014a('0x68')][_0x014a('0x39')]);_0x46168d[_0x014a('0x27')][_0x014a('0x6f')]=_0x46168d[_0x014a('0x6f')];_0x46168d[_0x014a('0x27')][_0x014a('0x70')]='accept';return respondWithRpcPromise('EventManager',_0x014a('0x71'),{'event':'acceptmessage','message':_0x46168d[_0x014a('0x27')]},client9002)['then'](function(){return _0x46168d;});}return _0x46168d;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5da1f7,null))[_0x014a('0x29')](handleError(_0x5da1f7,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x014a('0x33')]=function(_0x8234ee,_0x5f391d,_0x882fc9){var _0x42e4e9={'agent':{},'channel':'whatsapp'};if(_0x8234ee['body']['id']){delete _0x8234ee[_0x014a('0x58')]['id'];}_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]=_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]||_0x8234ee[_0x014a('0x68')]['id'];_0x42e4e9['agent']['id']=_0x8234ee[_0x014a('0x58')]['UserId'];return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x8234ee[_0x014a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x43165e){if(_0x43165e){_0x42e4e9[_0x014a('0x27')]=_0x43165e[_0x014a('0x67')]({'plain':!![]});return db[_0x014a('0x72')]['find']({'where':{'id':_0x43165e[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x163fa2){if(_0x163fa2){_0x42e4e9['interaction']=_0x163fa2[_0x014a('0x67')]({'plain':!![]});interaction_log['info'](_0x014a('0x73'),_0x8234ee[_0x014a('0x68')]['id'],_0x8234ee[_0x014a('0x68')][_0x014a('0x39')],_0x8234ee[_0x014a('0x68')][_0x014a('0x69')],_0x42e4e9['interaction']['id'],_0x8234ee[_0x014a('0x58')]?JSON[_0x014a('0x24')](_0x8234ee[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x74'),_0x014a('0x75'),_0x42e4e9);}return null;})[_0x014a('0x1e')](function(_0x28a8a9){if(_0x28a8a9){_0x28a8a9['message'][_0x014a('0x76')]=util[_0x014a('0x5f')](_0x014a('0x77'),_0x8234ee['user'][_0x014a('0x39')]);_0x28a8a9[_0x014a('0x27')][_0x014a('0x6f')]=_0x42e4e9[_0x014a('0x6f')];_0x28a8a9[_0x014a('0x27')][_0x014a('0x70')]=_0x014a('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x28a8a9['message']},client9002);return _0x42e4e9;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5f391d,null))[_0x014a('0x29')](handleError(_0x5f391d,null));};exports[_0x014a('0x2b')]=function(_0x3804e1,_0xe1b5ed,_0x7cd599){if(_0x3804e1[_0x014a('0x58')]['id']){delete _0x3804e1['body']['id'];}var _0x24ffb0;return db[_0x014a('0x3c')][_0x014a('0x56')]({'where':{'id':_0x3804e1[_0x014a('0x54')]['id']}})['then'](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x13e2fc){if(_0x13e2fc){_0x24ffb0=_0x13e2fc;return db[_0x014a('0x78')]['find']({'where':{'id':_0x13e2fc['WhatsappAccountId']}});}})[_0x014a('0x1e')](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x5d4099){if(_0x5d4099){logger[_0x014a('0x22')](_0x014a('0x79'),'status',_0x014a('0x7a'),_0x5d4099[_0x014a('0x3d')],util[_0x014a('0x7b')](_0x3804e1[_0x014a('0x58')],{'showHidden':![],'depth':null}));switch(_0x5d4099[_0x014a('0x3d')]){case _0x014a('0x7c'):if(_0x3804e1[_0x014a('0x58')][_0x014a('0x7d')]&&_0x3804e1['body']['MessageSid']===_0x24ffb0[_0x014a('0x7e')]&&_0x3804e1['body']['MessageStatus']&&_0x3804e1['body'][_0x014a('0x7f')]===_0x014a('0x5d')){return _0x24ffb0[_0x014a('0x35')]({'read':!![]});}else{logger['error'](_0x014a('0x80'),_0x014a('0x2b'),_0x014a('0x7c'),util[_0x014a('0x7b')](_0x3804e1['body'],{'showHidden':![],'depth':null}));}break;}return _0x24ffb0;}})[_0x014a('0x1e')](respondWithResult(_0xe1b5ed,null))[_0x014a('0x29')](handleError(_0xe1b5ed,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0e11ced..387deb0 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x6aa02c,_0x1157f0){var _0x506310=function(_0x5b5188){while(--_0x5b5188){_0x6aa02c['push'](_0x6aa02c['shift']());}};_0x506310(++_0x1157f0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1a8506,_0x4f55a8){_0x1a8506=_0x1a8506-0x0;var _0x2648b5=_0x5f2f[_0x1a8506];return _0x2648b5;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x318849,_0x5d7a96){var _0x46c9f9=function(_0x37fdba){while(--_0x37fdba){_0x318849['push'](_0x318849['shift']());}};_0x46c9f9(++_0x5d7a96);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12e914,_0x247211){_0x12e914=_0x12e914-0x0;var _0x4de2a3=_0x5f2f[_0x12e914];return _0x4de2a3;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0c22c58..de75218 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcaa2=['fti_whatsapp_messages','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','createdAt','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','./whatsappMessage.attributes','whatsapp_messages','messageId'];(function(_0x14e85d,_0xc5cd52){var _0x5566ae=function(_0x41a49b){while(--_0x41a49b){_0x14e85d['push'](_0x14e85d['shift']());}};_0x5566ae(++_0xc5cd52);}(_0xcaa2,0x166));var _0x2caa=function(_0xf3d4dd,_0x3d1208){_0xf3d4dd=_0xf3d4dd-0x0;var _0x1f4e7b=_0xcaa2[_0xf3d4dd];return _0x1f4e7b;};'use strict';var _=require(_0x2caa('0x0'));var util=require(_0x2caa('0x1'));var logger=require(_0x2caa('0x2'))(_0x2caa('0x3'));var moment=require(_0x2caa('0x4'));var BPromise=require(_0x2caa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2caa('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2caa('0x7'));module['exports']=function(_0x3de367,_0x28b752){return _0x3de367['define']('WhatsappMessage',attributes,{'tableName':_0x2caa('0x8'),'paranoid':![],'indexes':[{'name':_0x2caa('0x9'),'fields':['messageId']},{'name':_0x2caa('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c1af7,_0x39faa3,_0x47e9ee){var _0x5da4e8=_0x3de367[_0x2caa('0xb')];var _0x11462e=_0x3c1af7['get']({'plain':!![]});if(_0x11462e[_0x2caa('0xc')][_0x2caa('0xd')]()==='in'||_0x11462e['direction'][_0x2caa('0xd')]()===_0x2caa('0xe')&&!_0x11462e[_0x2caa('0xf')]&&!_[_0x2caa('0x10')](_0x11462e[_0x2caa('0x11')])){_0x5da4e8[_0x2caa('0x12')][_0x2caa('0x13')]({'where':{'id':_0x11462e['WhatsappInteractionId']}})[_0x2caa('0x14')](function(_0x3ab051){if(_0x3ab051){_0x3ab051['update']({'lastMsgAt':_0x11462e[_0x2caa('0x15')],'lastMsgDirection':_0x11462e[_0x2caa('0xc')][_0x2caa('0xd')]()});}})['catch'](function(_0x73f15d){console['error'](_0x73f15d);});}if(_0x11462e[_0x2caa('0xc')]==='out'&&!_0x11462e[_0x2caa('0xf')]){var _0x5a8f55;_0x5da4e8[_0x2caa('0x16')]['find']({'where':{'id':_0x11462e[_0x2caa('0x17')]},'raw':!![]})['then'](function(_0x3c0c12){_0x5a8f55=_0x3c0c12;if(_0x5a8f55&&_0x5a8f55[_0x2caa('0x18')]){switch(_0x5a8f55[_0x2caa('0x18')]){case _0x2caa('0x19'):var _0x4da5b7=require('twilio');if(_0x5a8f55[_0x2caa('0x1a')]&&_0x5a8f55[_0x2caa('0x1b')]&&_0x5a8f55[_0x2caa('0x1c')]){var _0x100054=new _0x4da5b7(_0x5a8f55[_0x2caa('0x1a')],_0x5a8f55[_0x2caa('0x1b')]);_0x100054['messages'][_0x2caa('0x1d')]({'body':_0x11462e[_0x2caa('0x1e')],'to':_0x2caa('0x1f')+_0x11462e['phone'],'from':_0x2caa('0x1f')+_0x5a8f55[_0x2caa('0x1c')],'statusCallback':_0x5a8f55[_0x2caa('0x20')]+_0x2caa('0x21')+_0x11462e['id']+_0x2caa('0x22')+_0x5a8f55[_0x2caa('0x23')]})[_0x2caa('0x14')](function(_0x11e9a2){if(_0x11e9a2[_0x2caa('0x24')]){return _0x3c1af7[_0x2caa('0x25')]({'messageId':_0x11e9a2[_0x2caa('0x24')]});}})[_0x2caa('0x26')](function(_0x31090b){logger['error'](_0x2caa('0x27'),_0x2caa('0x28'),_0x2caa('0x19'),util[_0x2caa('0x29')](_0x31090b,{'showHidden':![],'depth':null}));});}else{logger[_0x2caa('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x2caa('0x2b'));}break;}}})[_0x2caa('0x2c')](function(){_0x47e9ee();});}else{_0x47e9ee();}}},'charset':_0x2caa('0x2d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4ab1=['secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','isNil','UserId','WhatsappInteraction','then','update','createdAt','catch','error','out'];(function(_0x2d18b4,_0x3eaf9a){var _0x596083=function(_0x23592b){while(--_0x23592b){_0x2d18b4['push'](_0x2d18b4['shift']());}};_0x596083(++_0x3eaf9a);}(_0x4ab1,0x120));var _0x14ab=function(_0x413b19,_0x299538){_0x413b19=_0x413b19-0x0;var _0xb73bb6=_0x4ab1[_0x413b19];return _0xb73bb6;};'use strict';var _=require(_0x14ab('0x0'));var util=require(_0x14ab('0x1'));var logger=require(_0x14ab('0x2'))(_0x14ab('0x3'));var moment=require(_0x14ab('0x4'));var BPromise=require(_0x14ab('0x5'));var rp=require(_0x14ab('0x6'));var fs=require('fs');var path=require(_0x14ab('0x7'));var rimraf=require(_0x14ab('0x8'));var config=require(_0x14ab('0x9'));var attributes=require(_0x14ab('0xa'));module[_0x14ab('0xb')]=function(_0x40b660,_0x400e2c){return _0x40b660['define'](_0x14ab('0xc'),attributes,{'tableName':_0x14ab('0xd'),'paranoid':![],'indexes':[{'name':_0x14ab('0xe'),'fields':[_0x14ab('0xe')]},{'name':_0x14ab('0xf'),'fields':[_0x14ab('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c11d7,_0x46683b,_0x147db5){var _0x4329c2=_0x40b660[_0x14ab('0x11')];var _0x37ed23=_0x2c11d7[_0x14ab('0x12')]({'plain':!![]});if(_0x37ed23[_0x14ab('0x13')][_0x14ab('0x14')]()==='in'||_0x37ed23[_0x14ab('0x13')]['toLowerCase']()==='out'&&!_0x37ed23['secret']&&!_[_0x14ab('0x15')](_0x37ed23[_0x14ab('0x16')])){_0x4329c2[_0x14ab('0x17')]['findOne']({'where':{'id':_0x37ed23['WhatsappInteractionId']}})[_0x14ab('0x18')](function(_0x39127c){if(_0x39127c){_0x39127c[_0x14ab('0x19')]({'lastMsgAt':_0x37ed23[_0x14ab('0x1a')],'lastMsgDirection':_0x37ed23[_0x14ab('0x13')][_0x14ab('0x14')]()});}})[_0x14ab('0x1b')](function(_0x27b539){console[_0x14ab('0x1c')](_0x27b539);});}if(_0x37ed23[_0x14ab('0x13')]===_0x14ab('0x1d')&&!_0x37ed23[_0x14ab('0x1e')]){var _0x19b70f;_0x4329c2[_0x14ab('0x1f')][_0x14ab('0x20')]({'where':{'id':_0x37ed23[_0x14ab('0x21')]},'raw':!![]})['then'](function(_0x509167){_0x19b70f=_0x509167;if(_0x19b70f&&_0x19b70f[_0x14ab('0x22')]){switch(_0x19b70f[_0x14ab('0x22')]){case _0x14ab('0x23'):var _0x36ee02=require(_0x14ab('0x23'));if(_0x19b70f[_0x14ab('0x24')]&&_0x19b70f[_0x14ab('0x25')]&&_0x19b70f[_0x14ab('0x26')]){var _0x2d9e31=new _0x36ee02(_0x19b70f['accountSid'],_0x19b70f[_0x14ab('0x25')]);_0x2d9e31[_0x14ab('0x27')][_0x14ab('0x28')]({'body':_0x37ed23[_0x14ab('0x10')],'to':_0x14ab('0x29')+_0x37ed23['phone'],'from':_0x14ab('0x29')+_0x19b70f[_0x14ab('0x26')],'statusCallback':_0x19b70f[_0x14ab('0x2a')]+_0x14ab('0x2b')+_0x37ed23['id']+_0x14ab('0x2c')+_0x19b70f[_0x14ab('0x2d')]})[_0x14ab('0x18')](function(_0x276ef1){if(_0x276ef1[_0x14ab('0x2e')]){return _0x2c11d7[_0x14ab('0x19')]({'messageId':_0x276ef1['sid']});}})[_0x14ab('0x1b')](function(_0x33d9e0){logger[_0x14ab('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x14ab('0x2f'),_0x14ab('0x23'),util['inspect'](_0x33d9e0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x14ab('0x30'),_0x14ab('0x2f'),_0x14ab('0x23'),_0x14ab('0x31'));}break;}}})[_0x14ab('0x32')](function(){_0x147db5();});}else{_0x147db5();}}},'charset':_0x14ab('0x33'),'collate':_0x14ab('0x34')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 6a59aaa..6b1d5bf 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1851=['stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x320e1f,_0x1ada5e){var _0x1c7ae2=function(_0x13e28c){while(--_0x13e28c){_0x320e1f['push'](_0x320e1f['shift']());}};_0x1c7ae2(++_0x1ada5e);}(_0x1851,0x1a4));var _0x1185=function(_0x44cec2,_0x4aaaf0){_0x44cec2=_0x44cec2-0x0;var _0x271c32=_0x1851[_0x44cec2];return _0x271c32;};'use strict';var _=require('lodash');var util=require(_0x1185('0x0'));var moment=require('moment');var BPromise=require(_0x1185('0x1'));var rs=require(_0x1185('0x2'));var fs=require('fs');var Redis=require(_0x1185('0x3'));var db=require(_0x1185('0x4'))['db'];var utils=require(_0x1185('0x5'));var logger=require(_0x1185('0x6'))(_0x1185('0x7'));var config=require('../../config/environment');var jayson=require(_0x1185('0x8'));var client=jayson[_0x1185('0x9')][_0x1185('0xa')]({'port':0x232a});config[_0x1185('0xb')]=_[_0x1185('0xc')](config['redis'],{'host':_0x1185('0xd'),'port':0x18eb});var socket=require(_0x1185('0xe'))(new Redis(config[_0x1185('0xb')]));require(_0x1185('0xf'))[_0x1185('0x10')](socket);function respondWithRpcPromise(_0x47cd8e,_0x18b2c9,_0x1d57e3){return new BPromise(function(_0x53ee08,_0x2a4e7e){return client[_0x1185('0x11')](_0x47cd8e,_0x1d57e3)['then'](function(_0x5ad685){logger[_0x1185('0x12')](_0x1185('0x13'),_0x18b2c9,'request\x20sent');logger[_0x1185('0x14')](_0x1185('0x15'),_0x18b2c9,'request\x20sent',JSON[_0x1185('0x16')](_0x5ad685));if(_0x5ad685[_0x1185('0x17')]){if(_0x5ad685[_0x1185('0x17')][_0x1185('0x18')]===0x1f4){logger[_0x1185('0x17')](_0x1185('0x13'),_0x18b2c9,_0x5ad685[_0x1185('0x17')][_0x1185('0x19')]);return _0x2a4e7e(_0x5ad685['error'][_0x1185('0x19')]);}logger[_0x1185('0x17')](_0x1185('0x13'),_0x18b2c9,_0x5ad685[_0x1185('0x17')]['message']);return _0x53ee08(_0x5ad685[_0x1185('0x17')][_0x1185('0x19')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x18b2c9,'request\x20sent');_0x53ee08(_0x5ad685[_0x1185('0x1a')][_0x1185('0x19')]);}})['catch'](function(_0x40bc7e){logger['error'](_0x1185('0x13'),_0x18b2c9,_0x40bc7e);_0x2a4e7e(_0x40bc7e);});});}exports[_0x1185('0x1b')]=function(_0x1fef85){var _0xdde224=this;return new Promise(function(_0x37aa7a,_0xbea836){return db[_0x1185('0x1c')][_0x1185('0x1d')](_0x1fef85[_0x1185('0x1e')],{'raw':_0x1fef85[_0x1185('0x1f')]?_0x1fef85[_0x1185('0x1f')][_0x1185('0x20')]===undefined?!![]:![]:!![]})[_0x1185('0x21')](function(_0x154807){logger['info'](_0x1185('0x1b'),_0x1fef85);logger[_0x1185('0x14')](_0x1185('0x1b'),_0x1fef85,JSON[_0x1185('0x16')](_0x154807));_0x37aa7a(_0x154807);})['catch'](function(_0x593edc){logger[_0x1185('0x17')](_0x1185('0x1b'),_0x593edc[_0x1185('0x19')],_0x1fef85);_0xbea836(_0xdde224[_0x1185('0x17')](0x1f4,_0x593edc[_0x1185('0x19')]));});});}; \ No newline at end of file +var _0xf986=['create','body','options','debug','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappMessage'];(function(_0x1f2b1b,_0x32bdd3){var _0xb62f47=function(_0x264001){while(--_0x264001){_0x1f2b1b['push'](_0x1f2b1b['shift']());}};_0xb62f47(++_0x32bdd3);}(_0xf986,0x11c));var _0x6f98=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf986[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x6f98('0x0'));var moment=require(_0x6f98('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f98('0x2'));var fs=require('fs');var Redis=require(_0x6f98('0x3'));var db=require(_0x6f98('0x4'))['db'];var utils=require(_0x6f98('0x5'));var logger=require(_0x6f98('0x6'))('rpc');var config=require(_0x6f98('0x7'));var jayson=require(_0x6f98('0x8'));var client=jayson[_0x6f98('0x9')]['http']({'port':0x232a});config[_0x6f98('0xa')]=_['defaults'](config[_0x6f98('0xa')],{'host':_0x6f98('0xb'),'port':0x18eb});var socket=require(_0x6f98('0xc'))(new Redis(config[_0x6f98('0xa')]));require(_0x6f98('0xd'))[_0x6f98('0xe')](socket);function respondWithRpcPromise(_0x2c8e12,_0x5e0f3a,_0x4fc4ee){return new BPromise(function(_0x348ac7,_0x586cdf){return client[_0x6f98('0xf')](_0x2c8e12,_0x4fc4ee)[_0x6f98('0x10')](function(_0x32d279){logger[_0x6f98('0x11')](_0x6f98('0x12'),_0x5e0f3a,_0x6f98('0x13'));logger['debug'](_0x6f98('0x14'),_0x5e0f3a,_0x6f98('0x13'),JSON[_0x6f98('0x15')](_0x32d279));if(_0x32d279[_0x6f98('0x16')]){if(_0x32d279[_0x6f98('0x16')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5e0f3a,_0x32d279[_0x6f98('0x16')][_0x6f98('0x17')]);return _0x586cdf(_0x32d279[_0x6f98('0x16')][_0x6f98('0x17')]);}logger[_0x6f98('0x16')](_0x6f98('0x12'),_0x5e0f3a,_0x32d279[_0x6f98('0x16')][_0x6f98('0x17')]);return _0x348ac7(_0x32d279[_0x6f98('0x16')][_0x6f98('0x17')]);}else{logger[_0x6f98('0x11')](_0x6f98('0x12'),_0x5e0f3a,_0x6f98('0x13'));_0x348ac7(_0x32d279[_0x6f98('0x18')][_0x6f98('0x17')]);}})['catch'](function(_0x493862){logger[_0x6f98('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x5e0f3a,_0x493862);_0x586cdf(_0x493862);});});}exports[_0x6f98('0x19')]=function(_0x54fb46){var _0x18ae16=this;return new Promise(function(_0x1d4da5,_0x2cfd21){return db['WhatsappMessage'][_0x6f98('0x1a')](_0x54fb46[_0x6f98('0x1b')],{'raw':_0x54fb46[_0x6f98('0x1c')]?_0x54fb46[_0x6f98('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1c1dac){logger[_0x6f98('0x11')](_0x6f98('0x19'),_0x54fb46);logger[_0x6f98('0x1d')](_0x6f98('0x19'),_0x54fb46,JSON[_0x6f98('0x15')](_0x1c1dac));_0x1d4da5(_0x1c1dac);})[_0x6f98('0x1e')](function(_0x325707){logger[_0x6f98('0x16')](_0x6f98('0x19'),_0x325707['message'],_0x54fb46);_0x2cfd21(_0x18ae16[_0x6f98('0x16')](0x1f4,_0x325707[_0x6f98('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 29cf762..f19a7c7 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4304=['./whatsappMessage.events','save','remove','update','removeListener','register','length'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4304,0xee));var _0x4430=function(_0x324e03,_0x5959d6){_0x324e03=_0x324e03-0x0;var _0x5f8aa8=_0x4304[_0x324e03];return _0x5f8aa8;};'use strict';var WhatsappMessageEvents=require(_0x4430('0x0'));var events=[_0x4430('0x1'),_0x4430('0x2'),_0x4430('0x3')];function createListener(_0x52bc3b,_0x3af4bd){return function(_0x201b35){_0x3af4bd['emit'](_0x52bc3b,_0x201b35);};}function removeListener(_0x570a35,_0x406ec0){return function(){WhatsappMessageEvents[_0x4430('0x4')](_0x570a35,_0x406ec0);};}exports[_0x4430('0x5')]=function(_0x49c14c){for(var _0x5dac22=0x0,_0x3697bd=events[_0x4430('0x6')];_0x5dac22<_0x3697bd;_0x5dac22++){var _0x5015a1=events[_0x5dac22];var _0xfe8dbc=createListener('whatsappMessage:'+_0x5015a1,_0x49c14c);WhatsappMessageEvents['on'](_0x5015a1,_0xfe8dbc);}}; \ No newline at end of file +var _0x28e4=['update','removeListener','register','length','./whatsappMessage.events','save','remove'];(function(_0x25cdcf,_0x490484){var _0x4ed305=function(_0x4302af){while(--_0x4302af){_0x25cdcf['push'](_0x25cdcf['shift']());}};_0x4ed305(++_0x490484);}(_0x28e4,0x11c));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x428e('0x0'));var events=[_0x428e('0x1'),_0x428e('0x2'),_0x428e('0x3')];function createListener(_0x39da09,_0x253594){return function(_0x46e41e){_0x253594['emit'](_0x39da09,_0x46e41e);};}function removeListener(_0x4b2d9b,_0x18d91d){return function(){WhatsappMessageEvents[_0x428e('0x4')](_0x4b2d9b,_0x18d91d);};}exports[_0x428e('0x5')]=function(_0x5052f7){for(var _0x3ab35a=0x0,_0x4cdc6f=events[_0x428e('0x6')];_0x3ab35a<_0x4cdc6f;_0x3ab35a++){var _0x5b0d72=events[_0x3ab35a];var _0x516f8c=createListener('whatsappMessage:'+_0x5b0d72,_0x5052f7);WhatsappMessageEvents['on'](_0x5b0d72,_0x516f8c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index b0fa9ac..4ec3454 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6671=['/:id/users','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x6671,0xce));var _0x1667=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0x6671[_0x172948];return _0x4aeaa9;};'use strict';var multer=require(_0x1667('0x0'));var util=require(_0x1667('0x1'));var path=require(_0x1667('0x2'));var timeout=require(_0x1667('0x3'));var express=require('express');var router=express[_0x1667('0x4')]();var auth=require(_0x1667('0x5'));var interaction=require(_0x1667('0x6'));var config=require(_0x1667('0x7'));var controller=require(_0x1667('0x8'));router[_0x1667('0x9')]('/',auth[_0x1667('0xa')](),controller[_0x1667('0xb')]);router[_0x1667('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1667('0xc')]);router[_0x1667('0x9')](_0x1667('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x1667('0x9')](_0x1667('0xe'),auth[_0x1667('0xa')](),controller[_0x1667('0xf')]);router[_0x1667('0x9')](_0x1667('0x10'),auth[_0x1667('0xa')](),controller[_0x1667('0x11')]);router['get'](_0x1667('0x12'),auth[_0x1667('0xa')](),controller['getAgents']);router[_0x1667('0x13')]('/',auth[_0x1667('0xa')](),controller[_0x1667('0x14')]);router[_0x1667('0x13')](_0x1667('0x10'),auth[_0x1667('0xa')](),controller[_0x1667('0x15')]);router[_0x1667('0x13')]('/:id/users',auth[_0x1667('0xa')](),controller[_0x1667('0x16')]);router[_0x1667('0x17')](_0x1667('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x1667('0x18')](_0x1667('0xd'),auth[_0x1667('0xa')](),controller[_0x1667('0x19')]);router['delete'](_0x1667('0x10'),auth[_0x1667('0xa')](),controller[_0x1667('0x1a')]);router[_0x1667('0x18')](_0x1667('0x12'),auth[_0x1667('0xa')](),controller['removeAgents']);module[_0x1667('0x1b')]=router; \ No newline at end of file +var _0x19be=['/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','describe','/:id','get'];(function(_0x436849,_0x430b00){var _0x5c5f73=function(_0x5bdf78){while(--_0x5bdf78){_0x436849['push'](_0x436849['shift']());}};_0x5c5f73(++_0x430b00);}(_0x19be,0x1ab));var _0xe19b=function(_0x29f4e8,_0x321a81){_0x29f4e8=_0x29f4e8-0x0;var _0x58c50f=_0x19be[_0x29f4e8];return _0x58c50f;};'use strict';var multer=require(_0xe19b('0x0'));var util=require('util');var path=require(_0xe19b('0x1'));var timeout=require('connect-timeout');var express=require(_0xe19b('0x2'));var router=express['Router']();var auth=require(_0xe19b('0x3'));var interaction=require(_0xe19b('0x4'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xe19b('0x5')](),controller['index']);router['get'](_0xe19b('0x6'),auth['isAuthenticated'](),controller[_0xe19b('0x7')]);router['get'](_0xe19b('0x8'),auth[_0xe19b('0x5')](),controller['show']);router[_0xe19b('0x9')](_0xe19b('0xa'),auth['isAuthenticated'](),controller['getMembers']);router[_0xe19b('0x9')](_0xe19b('0xb'),auth[_0xe19b('0x5')](),controller[_0xe19b('0xc')]);router[_0xe19b('0x9')](_0xe19b('0xd'),auth[_0xe19b('0x5')](),controller[_0xe19b('0xe')]);router[_0xe19b('0xf')]('/',auth[_0xe19b('0x5')](),controller[_0xe19b('0x10')]);router[_0xe19b('0xf')]('/:id/teams',auth[_0xe19b('0x5')](),controller['addTeams']);router[_0xe19b('0xf')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xe19b('0x11')](_0xe19b('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xe19b('0x12')](_0xe19b('0x8'),auth['isAuthenticated'](),controller[_0xe19b('0x13')]);router[_0xe19b('0x12')](_0xe19b('0xb'),auth[_0xe19b('0x5')](),controller[_0xe19b('0x14')]);router['delete'](_0xe19b('0xd'),auth[_0xe19b('0x5')](),controller[_0xe19b('0x15')]);module[_0xe19b('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5ad145d..a4b2bbc 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7545=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x7545,0x1ab));var _0x5754=function(_0x12a3e1,_0x1db935){_0x12a3e1=_0x12a3e1-0x0;var _0x339fe7=_0x7545[_0x12a3e1];return _0x339fe7;};'use strict';var Sequelize=require(_0x5754('0x0'));module[_0x5754('0x1')]={'name':{'type':Sequelize[_0x5754('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5754('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5754('0x4')](_0x5754('0x5'),'beepall',_0x5754('0x6'))},'description':{'type':Sequelize[_0x5754('0x2')]}}; \ No newline at end of file +var _0xd66f=['sequelize','exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0xa72fc9,_0x42a752){var _0x3e7c45=function(_0x20a129){while(--_0x20a129){_0xa72fc9['push'](_0xa72fc9['shift']());}};_0x3e7c45(++_0x42a752);}(_0xd66f,0xa1));var _0xfd66=function(_0x4ece40,_0x28a245){_0x4ece40=_0x4ece40-0x0;var _0x41d4de=_0xd66f[_0x4ece40];return _0x41d4de;};'use strict';var Sequelize=require(_0xfd66('0x0'));module[_0xfd66('0x1')]={'name':{'type':Sequelize[_0xfd66('0x2')],'unique':_0xfd66('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xfd66('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfd66('0x5'),'beepall',_0xfd66('0x6'))},'description':{'type':Sequelize[_0xfd66('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index da24254..905ebd3 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa90b=['WhatsappQueueId','findAll','User','UserId','whatsappPause','updatedAt','createdAt','SIP','getTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','compact','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','index','map','WhatsappQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','filter','count','includeAll','include','rows','catch','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','nolimit'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xa90b,0xb4));var _0xba90=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0xa90b[_0x5ce3c8];return _0xa76867;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba90('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba90('0x1'));var moment=require(_0xba90('0x2'));var BPromise=require(_0xba90('0x3'));var Mustache=require(_0xba90('0x4'));var util=require('util');var path=require(_0xba90('0x5'));var sox=require(_0xba90('0x6'));var csv=require(_0xba90('0x7'));var ejs=require(_0xba90('0x8'));var fs=require('fs');var _=require(_0xba90('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba90('0xa'));var toCsv=require('to-csv');var querystring=require(_0xba90('0xb'));var Papa=require(_0xba90('0xc'));var Redis=require(_0xba90('0xd'));var authService=require(_0xba90('0xe'));var qs=require(_0xba90('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xba90('0x10'))(_0xba90('0x11'));var utils=require(_0xba90('0x12'));var config=require(_0xba90('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xba90('0x14'))['db'];config['redis']=_[_0xba90('0x15')](config[_0xba90('0x16')],{'host':_0xba90('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba90('0x16')]));require(_0xba90('0x18'))['register'](socket);function respondWithStatusCode(_0x19c33d,_0x4ecf5e){_0x4ecf5e=_0x4ecf5e||0xcc;return function(_0x27d747){if(_0x27d747){return _0x19c33d[_0xba90('0x19')](_0x4ecf5e);}return _0x19c33d[_0xba90('0x1a')](_0x4ecf5e)[_0xba90('0x1b')]();};}function respondWithResult(_0x272a7e,_0x3dbfa6){_0x3dbfa6=_0x3dbfa6||0xc8;return function(_0x5e7317){if(_0x5e7317){return _0x272a7e[_0xba90('0x1a')](_0x3dbfa6)[_0xba90('0x1c')](_0x5e7317);}};}function respondWithFilteredResult(_0x347fa7,_0x543071){return function(_0x1588b9){if(_0x1588b9){var _0x1eda19=_0x1588b9['count'],_0x5e4548=_0x543071[_0xba90('0x1d')],_0x24d20b=_0x543071[_0xba90('0x1d')]+_0x543071['limit'],_0x545f20;if(_0x24d20b>=_0x1eda19){_0x24d20b=_0x1eda19;_0x545f20=0xc8;}else{_0x545f20=0xce;}_0x347fa7[_0xba90('0x1a')](_0x545f20);return _0x347fa7[_0xba90('0x1e')](_0xba90('0x1f'),_0x5e4548+'-'+_0x24d20b+'/'+_0x1eda19)['json'](_0x1588b9);}return null;};}function patchUpdates(_0x31e07c){return function(_0x593501){try{jsonpatch[_0xba90('0x20')](_0x593501,_0x31e07c,!![]);}catch(_0x241ac2){return BPromise[_0xba90('0x21')](_0x241ac2);}return _0x593501[_0xba90('0x22')]();};}function saveUpdates(_0xae1567,_0x186327){return function(_0x144b7c){if(_0x144b7c){return _0x144b7c[_0xba90('0x23')](_0xae1567)[_0xba90('0x24')](function(_0x54c7e7){return _0x54c7e7;});}return null;};}function removeEntity(_0x5ba4d7,_0x595167){return function(_0x3f4f1b){if(_0x3f4f1b){return _0x3f4f1b[_0xba90('0x25')]()[_0xba90('0x24')](function(){var _0x27f3c7=_0x3f4f1b[_0xba90('0x26')]({'plain':!![]});var _0x442710=_0xba90('0x27');return db[_0xba90('0x28')]['destroy']({'where':{'type':_0x442710,'resourceId':_0x27f3c7['id']}})[_0xba90('0x24')](function(){return _0x3f4f1b;});})[_0xba90('0x24')](function(){_0x5ba4d7[_0xba90('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x86387f,_0x1a4b56){return function(_0x2fd399){if(!_0x2fd399){_0x86387f[_0xba90('0x19')](0x194);}return _0x2fd399;};}function handleError(_0x32bc14,_0x18bbb8){_0x18bbb8=_0x18bbb8||0x1f4;return function(_0x326303){logger['error'](_0x326303[_0xba90('0x29')]);if(_0x326303['name']){delete _0x326303[_0xba90('0x2a')];}_0x32bc14[_0xba90('0x1a')](_0x18bbb8)['send'](_0x326303);};}exports[_0xba90('0x2b')]=function(_0x397c81,_0x48affa){var _0x24e04a={},_0x2b7da4={},_0x4d8df0={'count':0x0,'rows':[]};var _0x57f377=_[_0xba90('0x2c')](db[_0xba90('0x2d')][_0xba90('0x2e')],function(_0xf943c6){return{'name':_0xf943c6['fieldName'],'type':_0xf943c6[_0xba90('0x2f')][_0xba90('0x30')]};});_0x2b7da4[_0xba90('0x31')]=_[_0xba90('0x2c')](_0x57f377,_0xba90('0x2a'));_0x2b7da4[_0xba90('0x32')]=_[_0xba90('0x33')](_0x397c81['query']);_0x2b7da4[_0xba90('0x34')]=_[_0xba90('0x35')](_0x2b7da4[_0xba90('0x31')],_0x2b7da4[_0xba90('0x32')]);_0x24e04a[_0xba90('0x36')]=_[_0xba90('0x35')](_0x2b7da4['model'],qs[_0xba90('0x37')](_0x397c81[_0xba90('0x32')][_0xba90('0x37')]));_0x24e04a[_0xba90('0x36')]=_0x24e04a['attributes'][_0xba90('0x38')]?_0x24e04a[_0xba90('0x36')]:_0x2b7da4[_0xba90('0x31')];if(!_0x397c81[_0xba90('0x32')][_0xba90('0x39')]('nolimit')){_0x24e04a[_0xba90('0x3a')]=qs[_0xba90('0x3a')](_0x397c81[_0xba90('0x32')][_0xba90('0x3a')]);_0x24e04a[_0xba90('0x1d')]=qs[_0xba90('0x1d')](_0x397c81['query'][_0xba90('0x1d')]);}_0x24e04a[_0xba90('0x3b')]=qs[_0xba90('0x3c')](_0x397c81['query'][_0xba90('0x3c')]);_0x24e04a[_0xba90('0x3d')]=qs[_0xba90('0x34')](_[_0xba90('0x3e')](_0x397c81[_0xba90('0x32')],_0x2b7da4['filters']),_0x57f377);if(_0x397c81['query']['filter']){_0x24e04a[_0xba90('0x3d')]=_[_0xba90('0x3f')](_0x24e04a[_0xba90('0x3d')],{'$or':_[_0xba90('0x2c')](_0x57f377,function(_0x1cd3c6){if(_0x1cd3c6[_0xba90('0x2f')]!=='VIRTUAL'){var _0x24f41f={};_0x24f41f[_0x1cd3c6[_0xba90('0x2a')]]={'$like':'%'+_0x397c81[_0xba90('0x32')][_0xba90('0x40')]+'%'};return _0x24f41f;}})});}_0x24e04a=_[_0xba90('0x3f')]({},_0x24e04a,_0x397c81['options']);var _0x1c6b62={'where':_0x24e04a[_0xba90('0x3d')]};return db[_0xba90('0x2d')]['count'](_0x1c6b62)[_0xba90('0x24')](function(_0x58df95){_0x4d8df0[_0xba90('0x41')]=_0x58df95;if(_0x397c81[_0xba90('0x32')][_0xba90('0x42')]){_0x24e04a[_0xba90('0x43')]=[{'all':!![]}];}return db[_0xba90('0x2d')]['findAll'](_0x24e04a);})[_0xba90('0x24')](function(_0x5d4bc6){_0x4d8df0[_0xba90('0x44')]=_0x5d4bc6;return _0x4d8df0;})[_0xba90('0x24')](respondWithFilteredResult(_0x48affa,_0x24e04a))[_0xba90('0x45')](handleError(_0x48affa,null));};exports['show']=function(_0x35a1c5,_0x2eb440){var _0x2024e3={'raw':!![],'where':{'id':_0x35a1c5['params']['id']}},_0x2eae88={};_0x2eae88[_0xba90('0x31')]=_[_0xba90('0x33')](db[_0xba90('0x2d')][_0xba90('0x2e')]);_0x2eae88['query']=_['keys'](_0x35a1c5[_0xba90('0x32')]);_0x2eae88['filters']=_['intersection'](_0x2eae88['model'],_0x2eae88[_0xba90('0x32')]);_0x2024e3[_0xba90('0x36')]=_[_0xba90('0x35')](_0x2eae88[_0xba90('0x31')],qs[_0xba90('0x37')](_0x35a1c5[_0xba90('0x32')][_0xba90('0x37')]));_0x2024e3[_0xba90('0x36')]=_0x2024e3['attributes'][_0xba90('0x38')]?_0x2024e3['attributes']:_0x2eae88[_0xba90('0x31')];if(_0x35a1c5['query'][_0xba90('0x42')]){_0x2024e3[_0xba90('0x43')]=[{'all':!![]}];}_0x2024e3=_['merge']({},_0x2024e3,_0x35a1c5[_0xba90('0x46')]);return db['WhatsappQueue']['find'](_0x2024e3)['then'](handleEntityNotFound(_0x2eb440,null))[_0xba90('0x24')](respondWithResult(_0x2eb440,null))[_0xba90('0x45')](handleError(_0x2eb440,null));};exports[_0xba90('0x47')]=function(_0x341151,_0x4575b0){return db[_0xba90('0x2d')][_0xba90('0x47')](_0x341151[_0xba90('0x48')],{})[_0xba90('0x24')](function(_0x8d2721){var _0xeb4ab0=_0x341151[_0xba90('0x49')][_0xba90('0x26')]({'plain':!![]});if(!_0xeb4ab0)throw new Error(_0xba90('0x4a'));if(_0xeb4ab0[_0xba90('0x4b')]==='user'){var _0x4e821b=_0x8d2721[_0xba90('0x26')]({'plain':!![]});var _0x2d81ce=_0xba90('0x27');return db[_0xba90('0x4c')][_0xba90('0x4d')]({'where':{'name':_0x2d81ce,'userProfileId':_0xeb4ab0[_0xba90('0x4e')]},'raw':!![]})[_0xba90('0x24')](function(_0x2903ab){if(_0x2903ab&&_0x2903ab['autoAssociation']===0x0){return db['UserProfileResource'][_0xba90('0x47')]({'name':_0x4e821b[_0xba90('0x2a')],'resourceId':_0x4e821b['id'],'type':_0x2903ab[_0xba90('0x2a')],'sectionId':_0x2903ab['id']},{})[_0xba90('0x24')](function(){return _0x8d2721;});}else{return _0x8d2721;}})['catch'](function(_0x39559f){logger['error'](_0xba90('0x4f'),_0x39559f);throw _0x39559f;});}return _0x8d2721;})[_0xba90('0x24')](respondWithResult(_0x4575b0,0xc9))[_0xba90('0x45')](handleError(_0x4575b0,null));};exports['update']=function(_0x1641ab,_0x247f04){if(_0x1641ab[_0xba90('0x48')]['id']){delete _0x1641ab[_0xba90('0x48')]['id'];}return db[_0xba90('0x2d')][_0xba90('0x4d')]({'where':{'id':_0x1641ab[_0xba90('0x50')]['id']}})['then'](handleEntityNotFound(_0x247f04,null))[_0xba90('0x24')](saveUpdates(_0x1641ab[_0xba90('0x48')],null))['then'](respondWithResult(_0x247f04,null))[_0xba90('0x45')](handleError(_0x247f04,null));};exports[_0xba90('0x25')]=function(_0x128559,_0x1a2fd1){return db[_0xba90('0x2d')][_0xba90('0x4d')]({'where':{'id':_0x128559[_0xba90('0x50')]['id']}})[_0xba90('0x24')](handleEntityNotFound(_0x1a2fd1,null))[_0xba90('0x24')](removeEntity(_0x1a2fd1,null))[_0xba90('0x45')](handleError(_0x1a2fd1,null));};exports[_0xba90('0x51')]=function(_0x1ec55d,_0x2a84f2){return db[_0xba90('0x2d')][_0xba90('0x51')]()[_0xba90('0x24')](respondWithResult(_0x2a84f2,null))[_0xba90('0x45')](handleError(_0x2a84f2,null));};exports[_0xba90('0x52')]=function(_0x479c6d,_0x3f072d,_0x784a9f){var _0x5c0a94={'raw':!![],'where':{}},_0x4d91d1={},_0x4317fd;return db['WhatsappQueue'][_0xba90('0x53')]({'where':{'id':_0x479c6d[_0xba90('0x50')]['id']}})['then'](handleEntityNotFound(_0x3f072d,null))[_0xba90('0x24')](function(_0x3f37da){if(_0x3f37da){_0x4317fd=_0x3f37da[_0xba90('0x26')]({'plain':!![]});_0x4d91d1['model']=_[_0xba90('0x33')](db[_0xba90('0x54')][_0xba90('0x2e')]);_0x4d91d1['query']=_[_0xba90('0x33')](_0x479c6d[_0xba90('0x32')]);_0x4d91d1[_0xba90('0x34')]=_[_0xba90('0x35')](_0x4d91d1[_0xba90('0x31')],_0x4d91d1[_0xba90('0x32')]);_0x5c0a94[_0xba90('0x36')]=_[_0xba90('0x35')](_0x4d91d1[_0xba90('0x31')],qs['fields'](_0x479c6d[_0xba90('0x32')]['fields']));_0x5c0a94['attributes']=_0x5c0a94[_0xba90('0x36')][_0xba90('0x38')]?_0x5c0a94[_0xba90('0x36')]:_0x4d91d1[_0xba90('0x31')];if(!_0x479c6d[_0xba90('0x32')][_0xba90('0x39')](_0xba90('0x55'))){_0x5c0a94['limit']=qs[_0xba90('0x3a')](_0x479c6d[_0xba90('0x32')]['limit']);_0x5c0a94['offset']=qs[_0xba90('0x1d')](_0x479c6d[_0xba90('0x32')][_0xba90('0x1d')]);}_0x5c0a94[_0xba90('0x3b')]=qs['sort'](_0x479c6d[_0xba90('0x32')]['sort']);_0x5c0a94[_0xba90('0x3d')]=qs[_0xba90('0x34')](_[_0xba90('0x3e')](_0x479c6d[_0xba90('0x32')],_0x4d91d1[_0xba90('0x34')]));_0x5c0a94[_0xba90('0x3d')][_0xba90('0x56')]=_0x3f37da['id'];if(_0x479c6d['query']['filter']){_0x5c0a94[_0xba90('0x3d')]=_[_0xba90('0x3f')](_0x5c0a94['where'],{'$or':_['map'](_0x5c0a94['attributes'],function(_0x1ccf69){var _0x305584={};_0x305584[_0x1ccf69]={'$like':'%'+_0x479c6d['query'][_0xba90('0x40')]+'%'};return _0x305584;})});}_0x5c0a94=_[_0xba90('0x3f')]({},_0x5c0a94,_0x479c6d[_0xba90('0x46')]);return db[_0xba90('0x54')][_0xba90('0x57')](_0x5c0a94);}})[_0xba90('0x24')](function(_0x267aba){if(_0x267aba){return db[_0xba90('0x58')]['findAndCountAll']({'where':{'id':_[_0xba90('0x2c')](_0x267aba,_0xba90('0x59')),'role':'agent'},'attributes':['id','name',_0xba90('0x5a'),_0xba90('0x5b'),_0xba90('0x5c')]});}})[_0xba90('0x24')](function(_0x5196f3){if(_0x5196f3){return{'count':_0x5196f3[_0xba90('0x41')],'rows':_['map'](_0x5196f3[_0xba90('0x44')],function(_0xd8a5e9){return{'membername':_0xd8a5e9[_0xba90('0x2a')],'UserId':_0xd8a5e9['id'],'queue_name':_0x4317fd[_0xba90('0x2a')],'WhatsappQueueId':_0x4317fd['id'],'interface':util['format']('%s/%s',_0xba90('0x5d'),_0xd8a5e9[_0xba90('0x2a')]),'penalty':0x0,'paused':_0xd8a5e9['whatsappPause'],'createdAt':_0xd8a5e9[_0xba90('0x5c')],'updatedAt':_0xd8a5e9[_0xba90('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xba90('0x24')](respondWithFilteredResult(_0x3f072d,_0x5c0a94))[_0xba90('0x45')](handleError(_0x3f072d,null));};exports['getTeams']=function(_0x3f23a9,_0x5532f6,_0x49d4fc){var _0x1df8c7={};var _0x572630={};var _0x1ddc4d;var _0x413d9f;return db['WhatsappQueue'][_0xba90('0x53')]({'where':{'id':_0x3f23a9[_0xba90('0x50')]['id']}})[_0xba90('0x24')](handleEntityNotFound(_0x5532f6,null))[_0xba90('0x24')](function(_0x123b97){if(_0x123b97){_0x1ddc4d=_0x123b97;_0x572630['model']=_[_0xba90('0x33')](db['Team']['rawAttributes']);_0x572630[_0xba90('0x32')]=_[_0xba90('0x33')](_0x3f23a9['query']);_0x572630[_0xba90('0x34')]=_[_0xba90('0x35')](_0x572630['model'],_0x572630[_0xba90('0x32')]);_0x1df8c7[_0xba90('0x36')]=_[_0xba90('0x35')](_0x572630['model'],qs[_0xba90('0x37')](_0x3f23a9[_0xba90('0x32')][_0xba90('0x37')]));_0x1df8c7[_0xba90('0x36')]=_0x1df8c7[_0xba90('0x36')]['length']?_0x1df8c7[_0xba90('0x36')]:_0x572630[_0xba90('0x31')];_0x1df8c7['order']=qs['sort'](_0x3f23a9['query']['sort']);_0x1df8c7[_0xba90('0x3d')]=qs['filters'](_['pick'](_0x3f23a9[_0xba90('0x32')],_0x572630[_0xba90('0x34')]));if(_0x3f23a9[_0xba90('0x32')][_0xba90('0x40')]){_0x1df8c7[_0xba90('0x3d')]=_[_0xba90('0x3f')](_0x1df8c7[_0xba90('0x3d')],{'$or':_[_0xba90('0x2c')](_0x1df8c7[_0xba90('0x36')],function(_0x154ae5){var _0x23d6ff={};_0x23d6ff[_0x154ae5]={'$like':'%'+_0x3f23a9['query'][_0xba90('0x40')]+'%'};return _0x23d6ff;})});}_0x1df8c7=_['merge']({},_0x1df8c7,_0x3f23a9['options']);return _0x1ddc4d['getTeams'](_0x1df8c7);}})[_0xba90('0x24')](function(_0x27461e){if(_0x27461e){_0x413d9f=_0x27461e['length'];if(!_0x3f23a9[_0xba90('0x32')][_0xba90('0x39')](_0xba90('0x55'))){_0x1df8c7[_0xba90('0x3a')]=qs[_0xba90('0x3a')](_0x3f23a9[_0xba90('0x32')]['limit']);_0x1df8c7[_0xba90('0x1d')]=qs[_0xba90('0x1d')](_0x3f23a9[_0xba90('0x32')][_0xba90('0x1d')]);}return _0x1ddc4d[_0xba90('0x5e')](_0x1df8c7);}})[_0xba90('0x24')](function(_0xd7f7c6){if(_0xd7f7c6){return _0xd7f7c6?{'count':_0x413d9f,'rows':_0xd7f7c6}:null;}})[_0xba90('0x24')](respondWithResult(_0x5532f6,null))[_0xba90('0x45')](handleError(_0x5532f6,null));};exports['addTeams']=function(_0x3bad14,_0x575398,_0x300cb7){var _0xd6186d=_0x3bad14[_0xba90('0x48')][_0xba90('0x5f')];return db[_0xba90('0x60')][_0xba90('0x57')]({'where':{'id':_0xd6186d},'attributes':['id'],'include':[{'model':db[_0xba90('0x58')],'as':_0xba90('0x61'),'attributes':['id',_0xba90('0x2a'),_0xba90('0x62'),'voicePause',_0xba90('0x63')],'raw':!![]}]})[_0xba90('0x24')](function(_0x3c7e2f){if(_0x3c7e2f){var _0x1f55aa=_[_0xba90('0x64')](_0x3c7e2f,function(_0x3b907e){var _0x93d5d5=_0x3b907e['get']({'plain':!![]});return _0x93d5d5[_0xba90('0x61')];});return db[_0xba90('0x2d')][_0xba90('0x4d')]({'where':{'id':_0x3bad14['params']['id']}})['then'](function(_0x21262c){return db[_0xba90('0x65')][_0xba90('0x66')](function(_0x48ea19){return _0x21262c[_0xba90('0x67')](_0xd6186d,{'transaction':_0x48ea19})[_0xba90('0x24')](function(){return BPromise[_0xba90('0x68')](_0x1f55aa,function(_0x3ba284){return db[_0xba90('0x54')]['findOrCreate']({'where':{'UserId':_0x3ba284['id'],'WhatsappQueueId':_0x3bad14[_0xba90('0x50')]['id']},'transaction':_0x48ea19});});})['then'](function(){_0x1f55aa[_0xba90('0x69')](function(_0x133e6e){socket[_0xba90('0x6a')]('userWhatsappQueue:save',{'UserId':_0x133e6e['id'],'WhatsappQueueId':_0x21262c['id']});});});});});}})[_0xba90('0x24')](respondWithStatusCode(_0x575398,null))[_0xba90('0x45')](handleError(_0x575398,null));};exports['removeTeams']=function(_0x2d1256,_0x1710e4,_0x3372e8){return db[_0xba90('0x60')][_0xba90('0x57')]({'where':{'id':_0x2d1256['query'][_0xba90('0x5f')]},'attributes':['id'],'include':[{'model':db[_0xba90('0x58')],'as':_0xba90('0x61'),'attributes':['id'],'raw':!![]}]})[_0xba90('0x24')](handleEntityNotFound(_0x1710e4,null))[_0xba90('0x24')](function(_0x31a8bb){var _0x1580ec=_['map'](_0x31a8bb,'id');var _0x26318b=[];var _0x49bbc9=[];var _0x42fb5f=squel[_0xba90('0x6b')]();_0x42fb5f[_0xba90('0x6c')](_0xba90('0x6d'))[_0xba90('0x6e')](_0xba90('0x6f'),'tq')[_0xba90('0x70')](_0xba90('0x71'),'ut',_0xba90('0x72'))[_0xba90('0x3d')](_0xba90('0x73'),_0x2d1256['params']['id']);for(var _0xb036e5=0x0;_0xb036e5<_0x31a8bb['length'];_0xb036e5+=0x1){let _0x17e62e=_0x31a8bb[_0xb036e5];for(var _0x25707e=0x0;_0x25707e<_0x17e62e['Agents'][_0xba90('0x38')];_0x25707e+=0x1){let _0x42edaa=_0x17e62e['Agents'][_0x25707e];var _0x699811=_0x42fb5f[_0xba90('0x74')]();_0x699811['where'](_0xba90('0x75'),_0x42edaa['id']);_0x49bbc9[_0xba90('0x76')](db['sequelize']['query'](_0x699811['toString'](),{'type':db['sequelize'][_0xba90('0x77')]['SELECT']})[_0xba90('0x24')](function(_0x3052c9){if(_0x3052c9['length']===0x1){return _0x42edaa['id'];}else{var _0x1c973e=_[_0xba90('0x78')](_[_0xba90('0x2c')](_0x3052c9,_0xba90('0x79')),function(_0x493355){return _[_0xba90('0x7a')](_0x1580ec,_0x493355);});if(_0x1c973e){return _0x42edaa['id'];}}}));}}return BPromise[_0xba90('0x7b')](_0x49bbc9)[_0xba90('0x24')](function(_0x4fe28a){_0x26318b=_(_0x26318b)['union'](_0x4fe28a)[_0xba90('0x7c')]()['value']();return db[_0xba90('0x2d')][_0xba90('0x4d')]({'where':{'id':_0x2d1256['params']['id']}})['then'](function(_0x3b1039){return db[_0xba90('0x65')][_0xba90('0x66')](function(_0x4ed122){return _0x3b1039['removeTeams'](_0x2d1256['query'][_0xba90('0x5f')],{'transaction':_0x4ed122})[_0xba90('0x24')](function(){if(!_[_0xba90('0x7d')](_0x26318b)){return _0x3b1039['removeAgents'](_0x26318b,{'transaction':_0x4ed122});}})['then'](function(){_0x26318b['forEach'](function(_0x5d9b2d){socket[_0xba90('0x6a')](_0xba90('0x7e'),{'UserId':_0x5d9b2d,'WhatsappQueueId':_0x3b1039['id']});});});});});});})[_0xba90('0x24')](respondWithStatusCode(_0x1710e4,null))[_0xba90('0x45')](handleError(_0x1710e4,null));};exports['addAgents']=function(_0x41e306,_0x455f6c,_0x15021a){return db[_0xba90('0x2d')]['find']({'where':{'id':_0x41e306[_0xba90('0x50')]['id']}})[_0xba90('0x24')](handleEntityNotFound(_0x455f6c,null))['then'](function(_0x49dc3f){if(_0x49dc3f){return _0x49dc3f[_0xba90('0x7f')](_0x41e306['body'][_0xba90('0x5f')],_[_0xba90('0x80')](_0x41e306[_0xba90('0x48')],[_0xba90('0x5f'),'id'])||{})[_0xba90('0x81')](function(_0x3a2478){for(var _0x553698=0x0;_0x553698<_0x41e306[_0xba90('0x48')][_0xba90('0x5f')][_0xba90('0x38')];_0x553698+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':_0x41e306[_0xba90('0x48')][_0xba90('0x5f')][_0x553698],'WhatsappQueueId':_0x41e306[_0xba90('0x50')]['id']});}return _0x3a2478;});}})[_0xba90('0x24')](respondWithResult(_0x455f6c,null))[_0xba90('0x45')](handleError(_0x455f6c,null));};exports[_0xba90('0x82')]=function(_0x136b6d,_0x410be1,_0x2c6d17){return db[_0xba90('0x2d')][_0xba90('0x4d')]({'where':{'id':_0x136b6d[_0xba90('0x50')]['id']}})[_0xba90('0x24')](handleEntityNotFound(_0x410be1,null))['then'](function(_0x5042e4){if(_0x5042e4){return _0x5042e4['removeAgents'](_0x136b6d['query'][_0xba90('0x5f')])[_0xba90('0x24')](function(){if(_[_0xba90('0x83')](_0x136b6d['query'][_0xba90('0x5f')])){for(var _0x2817ee=0x0;_0x2817ee<_0x136b6d[_0xba90('0x32')][_0xba90('0x5f')][_0xba90('0x38')];_0x2817ee+=0x1){socket[_0xba90('0x6a')]('userWhatsappQueue:remove',{'UserId':Number(_0x136b6d[_0xba90('0x32')]['ids'][_0x2817ee]),'WhatsappQueueId':Number(_0x136b6d[_0xba90('0x50')]['id'])});}}else{socket[_0xba90('0x6a')](_0xba90('0x7e'),{'UserId':Number(_0x136b6d['query'][_0xba90('0x5f')]),'WhatsappQueueId':Number(_0x136b6d[_0xba90('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x410be1,null))[_0xba90('0x45')](handleError(_0x410be1,null));};exports[_0xba90('0x84')]=function(_0x271615,_0x55a86d,_0x171b8f){var _0x517abd={};var _0x311866={};var _0x40c7bd;var _0x2eb48f;return db[_0xba90('0x2d')]['findOne']({'where':{'id':_0x271615[_0xba90('0x50')]['id']}})[_0xba90('0x24')](handleEntityNotFound(_0x55a86d,null))[_0xba90('0x24')](function(_0xa70060){if(_0xa70060){_0x40c7bd=_0xa70060;_0x311866[_0xba90('0x31')]=_[_0xba90('0x33')](db[_0xba90('0x58')][_0xba90('0x2e')]);_0x311866['query']=_[_0xba90('0x33')](_0x271615['query']);_0x311866[_0xba90('0x34')]=_['intersection'](_0x311866[_0xba90('0x31')],_0x311866['query']);_0x517abd['attributes']=_[_0xba90('0x35')](_0x311866[_0xba90('0x31')],qs[_0xba90('0x37')](_0x271615[_0xba90('0x32')][_0xba90('0x37')]));_0x517abd['attributes']=_0x517abd[_0xba90('0x36')][_0xba90('0x38')]?_0x517abd[_0xba90('0x36')]:_0x311866['model'];_0x517abd[_0xba90('0x3b')]=qs[_0xba90('0x3c')](_0x271615[_0xba90('0x32')][_0xba90('0x3c')]);_0x517abd[_0xba90('0x3d')]=qs[_0xba90('0x34')](_['pick'](_0x271615[_0xba90('0x32')],_0x311866['filters']));if(_0x271615[_0xba90('0x32')][_0xba90('0x40')]){_0x517abd['where']=_['merge'](_0x517abd[_0xba90('0x3d')],{'$or':_[_0xba90('0x2c')](_0x517abd[_0xba90('0x36')],function(_0x3b6b74){var _0x20a322={};_0x20a322[_0x3b6b74]={'$like':'%'+_0x271615[_0xba90('0x32')][_0xba90('0x40')]+'%'};return _0x20a322;})});}_0x517abd=_['merge']({},_0x517abd,_0x271615['options']);return _0x40c7bd[_0xba90('0x84')](_0x517abd);}})['then'](function(_0x1d6a13){if(_0x1d6a13){_0x2eb48f=_0x1d6a13['length'];if(!_0x271615['query'][_0xba90('0x39')](_0xba90('0x55'))){_0x517abd[_0xba90('0x3a')]=qs[_0xba90('0x3a')](_0x271615['query']['limit']);_0x517abd['offset']=qs[_0xba90('0x1d')](_0x271615[_0xba90('0x32')]['offset']);}return _0x40c7bd[_0xba90('0x84')](_0x517abd);}})[_0xba90('0x24')](function(_0x60313f){if(_0x60313f){return _0x60313f?{'count':_0x2eb48f,'rows':_0x60313f}:null;}})[_0xba90('0x24')](respondWithResult(_0x55a86d,null))['catch'](handleError(_0x55a86d,null));}; \ No newline at end of file +var _0xe8a6=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','UserProfileResource','name','index','map','WhatsappQueue','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','params','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','filter','User','findAndCountAll','UserId','whatsappPause','format','createdAt','getTeams','Team','ids','Agents','online','interface','sequelize','transaction','addTeams','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','userWhatsappQueue:remove','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring'];(function(_0x27f7b3,_0x46aaef){var _0x2e8598=function(_0x3396e0){while(--_0x3396e0){_0x27f7b3['push'](_0x27f7b3['shift']());}};_0x2e8598(++_0x46aaef);}(_0xe8a6,0xf4));var _0x6e8a=function(_0x134839,_0x2ed2fa){_0x134839=_0x134839-0x0;var _0x4fa9a9=_0xe8a6[_0x134839];return _0x4fa9a9;};'use strict';var pdf=require(_0x6e8a('0x0'));var emlformat=require(_0x6e8a('0x1'));var rimraf=require(_0x6e8a('0x2'));var zipdir=require(_0x6e8a('0x3'));var jsonpatch=require(_0x6e8a('0x4'));var rp=require(_0x6e8a('0x5'));var moment=require(_0x6e8a('0x6'));var BPromise=require(_0x6e8a('0x7'));var Mustache=require(_0x6e8a('0x8'));var util=require(_0x6e8a('0x9'));var path=require(_0x6e8a('0xa'));var sox=require(_0x6e8a('0xb'));var csv=require(_0x6e8a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6e8a('0xd'));var crypto=require(_0x6e8a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6e8a('0xc'));var querystring=require(_0x6e8a('0xf'));var Papa=require(_0x6e8a('0x10'));var Redis=require(_0x6e8a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6e8a('0x12'));var as=require(_0x6e8a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6e8a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6e8a('0x15'));var db=require('../../mysqldb')['db'];config[_0x6e8a('0x16')]=_['defaults'](config['redis'],{'host':_0x6e8a('0x17'),'port':0x18eb});var socket=require(_0x6e8a('0x18'))(new Redis(config[_0x6e8a('0x16')]));require('./whatsappQueue.socket')[_0x6e8a('0x19')](socket);function respondWithStatusCode(_0x5d1fd4,_0x13feeb){_0x13feeb=_0x13feeb||0xcc;return function(_0x4bdd8a){if(_0x4bdd8a){return _0x5d1fd4[_0x6e8a('0x1a')](_0x13feeb);}return _0x5d1fd4[_0x6e8a('0x1b')](_0x13feeb)[_0x6e8a('0x1c')]();};}function respondWithResult(_0xff2cf0,_0x437363){_0x437363=_0x437363||0xc8;return function(_0x5f4918){if(_0x5f4918){return _0xff2cf0[_0x6e8a('0x1b')](_0x437363)[_0x6e8a('0x1d')](_0x5f4918);}};}function respondWithFilteredResult(_0x32cbdc,_0x2210cd){return function(_0x419b87){if(_0x419b87){var _0x3a2d45=_0x419b87['count'],_0x23bdda=_0x2210cd[_0x6e8a('0x1e')],_0x2fd71c=_0x2210cd[_0x6e8a('0x1e')]+_0x2210cd[_0x6e8a('0x1f')],_0x2b96b0;if(_0x2fd71c>=_0x3a2d45){_0x2fd71c=_0x3a2d45;_0x2b96b0=0xc8;}else{_0x2b96b0=0xce;}_0x32cbdc['status'](_0x2b96b0);return _0x32cbdc[_0x6e8a('0x20')](_0x6e8a('0x21'),_0x23bdda+'-'+_0x2fd71c+'/'+_0x3a2d45)[_0x6e8a('0x1d')](_0x419b87);}return null;};}function patchUpdates(_0x3f6249){return function(_0x58728a){try{jsonpatch['apply'](_0x58728a,_0x3f6249,!![]);}catch(_0x3f8f5d){return BPromise[_0x6e8a('0x22')](_0x3f8f5d);}return _0x58728a[_0x6e8a('0x23')]();};}function saveUpdates(_0x31489e,_0x1fafb4){return function(_0x42b36f){if(_0x42b36f){return _0x42b36f['update'](_0x31489e)[_0x6e8a('0x24')](function(_0x510c3f){return _0x510c3f;});}return null;};}function removeEntity(_0xffa1db,_0x5d87ba){return function(_0x1d21ef){if(_0x1d21ef){return _0x1d21ef[_0x6e8a('0x25')]()[_0x6e8a('0x24')](function(){var _0x534404=_0x1d21ef['get']({'plain':!![]});var _0x3c6a53='WhatsappQueues';return db[_0x6e8a('0x26')]['destroy']({'where':{'type':_0x3c6a53,'resourceId':_0x534404['id']}})['then'](function(){return _0x1d21ef;});})[_0x6e8a('0x24')](function(){_0xffa1db[_0x6e8a('0x1b')](0xcc)[_0x6e8a('0x1c')]();});}};}function handleEntityNotFound(_0xa295aa,_0x36c4f0){return function(_0x4b18ed){if(!_0x4b18ed){_0xa295aa[_0x6e8a('0x1a')](0x194);}return _0x4b18ed;};}function handleError(_0x4f7f88,_0x16dbdf){_0x16dbdf=_0x16dbdf||0x1f4;return function(_0xe09d0b){logger['error'](_0xe09d0b['stack']);if(_0xe09d0b[_0x6e8a('0x27')]){delete _0xe09d0b[_0x6e8a('0x27')];}_0x4f7f88[_0x6e8a('0x1b')](_0x16dbdf)['send'](_0xe09d0b);};}exports[_0x6e8a('0x28')]=function(_0x1c12b3,_0x3c2e73){var _0x432bf1={},_0x32d40f={},_0x56f7b2={'count':0x0,'rows':[]};var _0x2046f3=_[_0x6e8a('0x29')](db[_0x6e8a('0x2a')][_0x6e8a('0x2b')],function(_0xd88a95){return{'name':_0xd88a95['fieldName'],'type':_0xd88a95['type'][_0x6e8a('0x2c')]};});_0x32d40f[_0x6e8a('0x2d')]=_['map'](_0x2046f3,_0x6e8a('0x27'));_0x32d40f[_0x6e8a('0x2e')]=_[_0x6e8a('0x2f')](_0x1c12b3[_0x6e8a('0x2e')]);_0x32d40f[_0x6e8a('0x30')]=_['intersection'](_0x32d40f['model'],_0x32d40f[_0x6e8a('0x2e')]);_0x432bf1[_0x6e8a('0x31')]=_[_0x6e8a('0x32')](_0x32d40f['model'],qs[_0x6e8a('0x33')](_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x33')]));_0x432bf1[_0x6e8a('0x31')]=_0x432bf1[_0x6e8a('0x31')][_0x6e8a('0x34')]?_0x432bf1[_0x6e8a('0x31')]:_0x32d40f[_0x6e8a('0x2d')];if(!_0x1c12b3['query'][_0x6e8a('0x35')](_0x6e8a('0x36'))){_0x432bf1['limit']=qs['limit'](_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x1f')]);_0x432bf1[_0x6e8a('0x1e')]=qs[_0x6e8a('0x1e')](_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x1e')]);}_0x432bf1[_0x6e8a('0x37')]=qs[_0x6e8a('0x38')](_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x38')]);_0x432bf1[_0x6e8a('0x39')]=qs['filters'](_[_0x6e8a('0x3a')](_0x1c12b3[_0x6e8a('0x2e')],_0x32d40f[_0x6e8a('0x30')]),_0x2046f3);if(_0x1c12b3[_0x6e8a('0x2e')]['filter']){_0x432bf1[_0x6e8a('0x39')]=_[_0x6e8a('0x3b')](_0x432bf1[_0x6e8a('0x39')],{'$or':_[_0x6e8a('0x29')](_0x2046f3,function(_0x4abc4f){if(_0x4abc4f['type']!=='VIRTUAL'){var _0x99709a={};_0x99709a[_0x4abc4f[_0x6e8a('0x27')]]={'$like':'%'+_0x1c12b3[_0x6e8a('0x2e')]['filter']+'%'};return _0x99709a;}})});}_0x432bf1=_['merge']({},_0x432bf1,_0x1c12b3['options']);var _0x1acb12={'where':_0x432bf1['where']};return db[_0x6e8a('0x2a')]['count'](_0x1acb12)[_0x6e8a('0x24')](function(_0x375a1a){_0x56f7b2['count']=_0x375a1a;if(_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x3c')]){_0x432bf1[_0x6e8a('0x3d')]=[{'all':!![]}];}return db[_0x6e8a('0x2a')][_0x6e8a('0x3e')](_0x432bf1);})[_0x6e8a('0x24')](function(_0x2a324a){_0x56f7b2[_0x6e8a('0x3f')]=_0x2a324a;return _0x56f7b2;})[_0x6e8a('0x24')](respondWithFilteredResult(_0x3c2e73,_0x432bf1))[_0x6e8a('0x40')](handleError(_0x3c2e73,null));};exports['show']=function(_0x3bdc5f,_0x7218ec){var _0x1df28d={'raw':!![],'where':{'id':_0x3bdc5f[_0x6e8a('0x41')]['id']}},_0x247a44={};_0x247a44[_0x6e8a('0x2d')]=_['keys'](db[_0x6e8a('0x2a')][_0x6e8a('0x2b')]);_0x247a44[_0x6e8a('0x2e')]=_[_0x6e8a('0x2f')](_0x3bdc5f[_0x6e8a('0x2e')]);_0x247a44[_0x6e8a('0x30')]=_['intersection'](_0x247a44['model'],_0x247a44[_0x6e8a('0x2e')]);_0x1df28d[_0x6e8a('0x31')]=_['intersection'](_0x247a44[_0x6e8a('0x2d')],qs[_0x6e8a('0x33')](_0x3bdc5f['query'][_0x6e8a('0x33')]));_0x1df28d[_0x6e8a('0x31')]=_0x1df28d['attributes']['length']?_0x1df28d['attributes']:_0x247a44['model'];if(_0x3bdc5f[_0x6e8a('0x2e')][_0x6e8a('0x3c')]){_0x1df28d[_0x6e8a('0x3d')]=[{'all':!![]}];}_0x1df28d=_[_0x6e8a('0x3b')]({},_0x1df28d,_0x3bdc5f[_0x6e8a('0x42')]);return db['WhatsappQueue'][_0x6e8a('0x43')](_0x1df28d)[_0x6e8a('0x24')](handleEntityNotFound(_0x7218ec,null))[_0x6e8a('0x24')](respondWithResult(_0x7218ec,null))[_0x6e8a('0x40')](handleError(_0x7218ec,null));};exports[_0x6e8a('0x44')]=function(_0x38eb60,_0x36413c){return db[_0x6e8a('0x2a')][_0x6e8a('0x44')](_0x38eb60['body'],{})[_0x6e8a('0x24')](function(_0x40a34c){var _0x43bc8f=_0x38eb60['user'][_0x6e8a('0x45')]({'plain':!![]});if(!_0x43bc8f)throw new Error(_0x6e8a('0x46'));if(_0x43bc8f[_0x6e8a('0x47')]==='user'){var _0x4046ee=_0x40a34c[_0x6e8a('0x45')]({'plain':!![]});var _0x4f31d8=_0x6e8a('0x48');return db[_0x6e8a('0x49')][_0x6e8a('0x43')]({'where':{'name':_0x4f31d8,'userProfileId':_0x43bc8f[_0x6e8a('0x4a')]},'raw':!![]})[_0x6e8a('0x24')](function(_0x4a2466){if(_0x4a2466&&_0x4a2466[_0x6e8a('0x4b')]===0x0){return db[_0x6e8a('0x26')][_0x6e8a('0x44')]({'name':_0x4046ee[_0x6e8a('0x27')],'resourceId':_0x4046ee['id'],'type':_0x4a2466[_0x6e8a('0x27')],'sectionId':_0x4a2466['id']},{})[_0x6e8a('0x24')](function(){return _0x40a34c;});}else{return _0x40a34c;}})[_0x6e8a('0x40')](function(_0x444ed3){logger[_0x6e8a('0x4c')](_0x6e8a('0x4d'),_0x444ed3);throw _0x444ed3;});}return _0x40a34c;})[_0x6e8a('0x24')](respondWithResult(_0x36413c,0xc9))[_0x6e8a('0x40')](handleError(_0x36413c,null));};exports[_0x6e8a('0x4e')]=function(_0x10433d,_0x287521){if(_0x10433d['body']['id']){delete _0x10433d[_0x6e8a('0x4f')]['id'];}return db[_0x6e8a('0x2a')][_0x6e8a('0x43')]({'where':{'id':_0x10433d[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x287521,null))['then'](saveUpdates(_0x10433d[_0x6e8a('0x4f')],null))['then'](respondWithResult(_0x287521,null))['catch'](handleError(_0x287521,null));};exports['destroy']=function(_0x4a0530,_0x27edf8){return db[_0x6e8a('0x2a')]['find']({'where':{'id':_0x4a0530[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x27edf8,null))['then'](removeEntity(_0x27edf8,null))[_0x6e8a('0x40')](handleError(_0x27edf8,null));};exports[_0x6e8a('0x50')]=function(_0x24ee0b,_0x2f8e4b){return db[_0x6e8a('0x2a')]['describe']()[_0x6e8a('0x24')](respondWithResult(_0x2f8e4b,null))[_0x6e8a('0x40')](handleError(_0x2f8e4b,null));};exports[_0x6e8a('0x51')]=function(_0x512cfa,_0x250c08,_0x5d6834){var _0x3a0683={'raw':!![],'where':{}},_0x472853={},_0x47c199;return db[_0x6e8a('0x2a')]['findOne']({'where':{'id':_0x512cfa[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x250c08,null))[_0x6e8a('0x24')](function(_0x17d3a3){if(_0x17d3a3){_0x47c199=_0x17d3a3[_0x6e8a('0x45')]({'plain':!![]});_0x472853['model']=_[_0x6e8a('0x2f')](db[_0x6e8a('0x52')]['rawAttributes']);_0x472853['query']=_[_0x6e8a('0x2f')](_0x512cfa['query']);_0x472853[_0x6e8a('0x30')]=_[_0x6e8a('0x32')](_0x472853[_0x6e8a('0x2d')],_0x472853[_0x6e8a('0x2e')]);_0x3a0683[_0x6e8a('0x31')]=_[_0x6e8a('0x32')](_0x472853[_0x6e8a('0x2d')],qs[_0x6e8a('0x33')](_0x512cfa['query'][_0x6e8a('0x33')]));_0x3a0683[_0x6e8a('0x31')]=_0x3a0683[_0x6e8a('0x31')]['length']?_0x3a0683[_0x6e8a('0x31')]:_0x472853[_0x6e8a('0x2d')];if(!_0x512cfa[_0x6e8a('0x2e')][_0x6e8a('0x35')](_0x6e8a('0x36'))){_0x3a0683[_0x6e8a('0x1f')]=qs[_0x6e8a('0x1f')](_0x512cfa['query'][_0x6e8a('0x1f')]);_0x3a0683[_0x6e8a('0x1e')]=qs[_0x6e8a('0x1e')](_0x512cfa[_0x6e8a('0x2e')][_0x6e8a('0x1e')]);}_0x3a0683['order']=qs[_0x6e8a('0x38')](_0x512cfa['query'][_0x6e8a('0x38')]);_0x3a0683[_0x6e8a('0x39')]=qs[_0x6e8a('0x30')](_[_0x6e8a('0x3a')](_0x512cfa[_0x6e8a('0x2e')],_0x472853[_0x6e8a('0x30')]));_0x3a0683[_0x6e8a('0x39')][_0x6e8a('0x53')]=_0x17d3a3['id'];if(_0x512cfa[_0x6e8a('0x2e')][_0x6e8a('0x54')]){_0x3a0683['where']=_[_0x6e8a('0x3b')](_0x3a0683[_0x6e8a('0x39')],{'$or':_['map'](_0x3a0683[_0x6e8a('0x31')],function(_0x21f035){var _0x5726de={};_0x5726de[_0x21f035]={'$like':'%'+_0x512cfa[_0x6e8a('0x2e')]['filter']+'%'};return _0x5726de;})});}_0x3a0683=_[_0x6e8a('0x3b')]({},_0x3a0683,_0x512cfa['options']);return db[_0x6e8a('0x52')][_0x6e8a('0x3e')](_0x3a0683);}})['then'](function(_0x42182c){if(_0x42182c){return db[_0x6e8a('0x55')][_0x6e8a('0x56')]({'where':{'id':_['map'](_0x42182c,_0x6e8a('0x57')),'role':'agent'},'attributes':['id',_0x6e8a('0x27'),_0x6e8a('0x58'),'updatedAt','createdAt']});}})[_0x6e8a('0x24')](function(_0x5147aa){if(_0x5147aa){return{'count':_0x5147aa['count'],'rows':_[_0x6e8a('0x29')](_0x5147aa['rows'],function(_0x4c91c9){return{'membername':_0x4c91c9['name'],'UserId':_0x4c91c9['id'],'queue_name':_0x47c199[_0x6e8a('0x27')],'WhatsappQueueId':_0x47c199['id'],'interface':util[_0x6e8a('0x59')]('%s/%s','SIP',_0x4c91c9[_0x6e8a('0x27')]),'penalty':0x0,'paused':_0x4c91c9['whatsappPause'],'createdAt':_0x4c91c9[_0x6e8a('0x5a')],'updatedAt':_0x4c91c9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6e8a('0x24')](respondWithFilteredResult(_0x250c08,_0x3a0683))['catch'](handleError(_0x250c08,null));};exports[_0x6e8a('0x5b')]=function(_0x529b4e,_0x9eb014,_0x3c3c26){var _0x3c2580={};var _0x28e5af={};var _0xa5c9b3;var _0x58f61d;return db[_0x6e8a('0x2a')]['findOne']({'where':{'id':_0x529b4e[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x9eb014,null))['then'](function(_0x455fff){if(_0x455fff){_0xa5c9b3=_0x455fff;_0x28e5af[_0x6e8a('0x2d')]=_[_0x6e8a('0x2f')](db[_0x6e8a('0x5c')]['rawAttributes']);_0x28e5af['query']=_[_0x6e8a('0x2f')](_0x529b4e[_0x6e8a('0x2e')]);_0x28e5af[_0x6e8a('0x30')]=_['intersection'](_0x28e5af[_0x6e8a('0x2d')],_0x28e5af[_0x6e8a('0x2e')]);_0x3c2580[_0x6e8a('0x31')]=_[_0x6e8a('0x32')](_0x28e5af[_0x6e8a('0x2d')],qs['fields'](_0x529b4e['query'][_0x6e8a('0x33')]));_0x3c2580[_0x6e8a('0x31')]=_0x3c2580['attributes'][_0x6e8a('0x34')]?_0x3c2580[_0x6e8a('0x31')]:_0x28e5af[_0x6e8a('0x2d')];_0x3c2580[_0x6e8a('0x37')]=qs[_0x6e8a('0x38')](_0x529b4e['query']['sort']);_0x3c2580[_0x6e8a('0x39')]=qs[_0x6e8a('0x30')](_[_0x6e8a('0x3a')](_0x529b4e[_0x6e8a('0x2e')],_0x28e5af['filters']));if(_0x529b4e['query']['filter']){_0x3c2580[_0x6e8a('0x39')]=_[_0x6e8a('0x3b')](_0x3c2580[_0x6e8a('0x39')],{'$or':_[_0x6e8a('0x29')](_0x3c2580[_0x6e8a('0x31')],function(_0x4cb49b){var _0xf5460f={};_0xf5460f[_0x4cb49b]={'$like':'%'+_0x529b4e[_0x6e8a('0x2e')][_0x6e8a('0x54')]+'%'};return _0xf5460f;})});}_0x3c2580=_[_0x6e8a('0x3b')]({},_0x3c2580,_0x529b4e[_0x6e8a('0x42')]);return _0xa5c9b3[_0x6e8a('0x5b')](_0x3c2580);}})['then'](function(_0x2b9529){if(_0x2b9529){_0x58f61d=_0x2b9529['length'];if(!_0x529b4e[_0x6e8a('0x2e')][_0x6e8a('0x35')](_0x6e8a('0x36'))){_0x3c2580[_0x6e8a('0x1f')]=qs['limit'](_0x529b4e[_0x6e8a('0x2e')]['limit']);_0x3c2580[_0x6e8a('0x1e')]=qs[_0x6e8a('0x1e')](_0x529b4e[_0x6e8a('0x2e')][_0x6e8a('0x1e')]);}return _0xa5c9b3['getTeams'](_0x3c2580);}})[_0x6e8a('0x24')](function(_0x14fec6){if(_0x14fec6){return _0x14fec6?{'count':_0x58f61d,'rows':_0x14fec6}:null;}})[_0x6e8a('0x24')](respondWithResult(_0x9eb014,null))[_0x6e8a('0x40')](handleError(_0x9eb014,null));};exports['addTeams']=function(_0x1916db,_0x325e21,_0x5d22d6){var _0x510bd5=_0x1916db['body'][_0x6e8a('0x5d')];return db['Team'][_0x6e8a('0x3e')]({'where':{'id':_0x510bd5},'attributes':['id'],'include':[{'model':db[_0x6e8a('0x55')],'as':_0x6e8a('0x5e'),'attributes':['id',_0x6e8a('0x27'),_0x6e8a('0x5f'),'voicePause',_0x6e8a('0x60')],'raw':!![]}]})[_0x6e8a('0x24')](function(_0x524bc3){if(_0x524bc3){var _0x4e24db=_['flatMap'](_0x524bc3,function(_0x2a6271){var _0x340528=_0x2a6271['get']({'plain':!![]});return _0x340528[_0x6e8a('0x5e')];});return db[_0x6e8a('0x2a')]['find']({'where':{'id':_0x1916db[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](function(_0x24c1e0){return db[_0x6e8a('0x61')][_0x6e8a('0x62')](function(_0x294c0a){return _0x24c1e0[_0x6e8a('0x63')](_0x510bd5,{'transaction':_0x294c0a})['then'](function(){return BPromise[_0x6e8a('0x64')](_0x4e24db,function(_0x3cbbf5){return db[_0x6e8a('0x52')][_0x6e8a('0x65')]({'where':{'UserId':_0x3cbbf5['id'],'WhatsappQueueId':_0x1916db[_0x6e8a('0x41')]['id']},'transaction':_0x294c0a});});})[_0x6e8a('0x24')](function(){_0x4e24db['forEach'](function(_0x2bdb5b){socket[_0x6e8a('0x66')](_0x6e8a('0x67'),{'UserId':_0x2bdb5b['id'],'WhatsappQueueId':_0x24c1e0['id']});});});});});}})[_0x6e8a('0x24')](respondWithStatusCode(_0x325e21,null))[_0x6e8a('0x40')](handleError(_0x325e21,null));};exports[_0x6e8a('0x68')]=function(_0x125b00,_0x5d316a,_0x313aa4){return db[_0x6e8a('0x5c')]['findAll']({'where':{'id':_0x125b00[_0x6e8a('0x2e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6e8a('0x55')],'as':_0x6e8a('0x5e'),'attributes':['id'],'raw':!![]}]})[_0x6e8a('0x24')](handleEntityNotFound(_0x5d316a,null))[_0x6e8a('0x24')](function(_0x2dcf22){var _0x179ae9=_['map'](_0x2dcf22,'id');var _0x4f7717=[];var _0x1e91d8=[];var _0x157686=squel[_0x6e8a('0x69')]();_0x157686[_0x6e8a('0x6a')]('tq.TeamId')[_0x6e8a('0x6b')](_0x6e8a('0x6c'),'tq')[_0x6e8a('0x6d')](_0x6e8a('0x6e'),'ut',_0x6e8a('0x6f'))['where'](_0x6e8a('0x70'),_0x125b00[_0x6e8a('0x41')]['id']);for(var _0x14525c=0x0;_0x14525c<_0x2dcf22[_0x6e8a('0x34')];_0x14525c+=0x1){let _0x3a96ec=_0x2dcf22[_0x14525c];for(var _0x2aec6e=0x0;_0x2aec6e<_0x3a96ec[_0x6e8a('0x5e')][_0x6e8a('0x34')];_0x2aec6e+=0x1){let _0x202cf1=_0x3a96ec[_0x6e8a('0x5e')][_0x2aec6e];var _0x9e0a78=_0x157686[_0x6e8a('0x71')]();_0x9e0a78[_0x6e8a('0x39')]('ut.UserId\x20=\x20?',_0x202cf1['id']);_0x1e91d8[_0x6e8a('0x72')](db['sequelize'][_0x6e8a('0x2e')](_0x9e0a78[_0x6e8a('0x73')](),{'type':db[_0x6e8a('0x61')][_0x6e8a('0x74')]['SELECT']})['then'](function(_0x44ce50){if(_0x44ce50['length']===0x1){return _0x202cf1['id'];}else{var _0x2f82c7=_[_0x6e8a('0x75')](_['map'](_0x44ce50,_0x6e8a('0x76')),function(_0x3b6d98){return _['includes'](_0x179ae9,_0x3b6d98);});if(_0x2f82c7){return _0x202cf1['id'];}}}));}}return BPromise[_0x6e8a('0x77')](_0x1e91d8)[_0x6e8a('0x24')](function(_0x291b94){_0x4f7717=_(_0x4f7717)['union'](_0x291b94)[_0x6e8a('0x78')]()[_0x6e8a('0x79')]();return db[_0x6e8a('0x2a')]['find']({'where':{'id':_0x125b00[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](function(_0x197930){return db[_0x6e8a('0x61')]['transaction'](function(_0x7df211){return _0x197930[_0x6e8a('0x68')](_0x125b00['query'][_0x6e8a('0x5d')],{'transaction':_0x7df211})['then'](function(){if(!_[_0x6e8a('0x7a')](_0x4f7717)){return _0x197930[_0x6e8a('0x7b')](_0x4f7717,{'transaction':_0x7df211});}})[_0x6e8a('0x24')](function(){_0x4f7717[_0x6e8a('0x7c')](function(_0x48ed12){socket[_0x6e8a('0x66')]('userWhatsappQueue:remove',{'UserId':_0x48ed12,'WhatsappQueueId':_0x197930['id']});});});});});});})[_0x6e8a('0x24')](respondWithStatusCode(_0x5d316a,null))[_0x6e8a('0x40')](handleError(_0x5d316a,null));};exports[_0x6e8a('0x7d')]=function(_0x49f99f,_0x57d3da,_0x354148){return db[_0x6e8a('0x2a')][_0x6e8a('0x43')]({'where':{'id':_0x49f99f[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x57d3da,null))['then'](function(_0x436244){if(_0x436244){return _0x436244[_0x6e8a('0x7d')](_0x49f99f['body'][_0x6e8a('0x5d')],_[_0x6e8a('0x7e')](_0x49f99f[_0x6e8a('0x4f')],[_0x6e8a('0x5d'),'id'])||{})['spread'](function(_0xa88338){for(var _0x40b116=0x0;_0x40b116<_0x49f99f[_0x6e8a('0x4f')][_0x6e8a('0x5d')]['length'];_0x40b116+=0x1){socket[_0x6e8a('0x66')](_0x6e8a('0x67'),{'UserId':_0x49f99f['body'][_0x6e8a('0x5d')][_0x40b116],'WhatsappQueueId':_0x49f99f[_0x6e8a('0x41')]['id']});}return _0xa88338;});}})[_0x6e8a('0x24')](respondWithResult(_0x57d3da,null))[_0x6e8a('0x40')](handleError(_0x57d3da,null));};exports[_0x6e8a('0x7b')]=function(_0x5d6912,_0x51c34f,_0x44ab30){return db[_0x6e8a('0x2a')]['find']({'where':{'id':_0x5d6912['params']['id']}})['then'](handleEntityNotFound(_0x51c34f,null))[_0x6e8a('0x24')](function(_0xa0c7e1){if(_0xa0c7e1){return _0xa0c7e1['removeAgents'](_0x5d6912[_0x6e8a('0x2e')][_0x6e8a('0x5d')])[_0x6e8a('0x24')](function(){if(_['isArray'](_0x5d6912[_0x6e8a('0x2e')]['ids'])){for(var _0x2fd0b8=0x0;_0x2fd0b8<_0x5d6912[_0x6e8a('0x2e')][_0x6e8a('0x5d')][_0x6e8a('0x34')];_0x2fd0b8+=0x1){socket[_0x6e8a('0x66')]('userWhatsappQueue:remove',{'UserId':Number(_0x5d6912[_0x6e8a('0x2e')][_0x6e8a('0x5d')][_0x2fd0b8]),'WhatsappQueueId':Number(_0x5d6912[_0x6e8a('0x41')]['id'])});}}else{socket[_0x6e8a('0x66')](_0x6e8a('0x7f'),{'UserId':Number(_0x5d6912[_0x6e8a('0x2e')][_0x6e8a('0x5d')]),'WhatsappQueueId':Number(_0x5d6912[_0x6e8a('0x41')]['id'])});}});}})[_0x6e8a('0x24')](respondWithStatusCode(_0x51c34f,null))['catch'](handleError(_0x51c34f,null));};exports[_0x6e8a('0x80')]=function(_0x3e77ab,_0x108e63,_0x56c7c9){var _0x2f89dd={};var _0x51c0b5={};var _0x4ac2a9;var _0x2e583a;return db[_0x6e8a('0x2a')][_0x6e8a('0x81')]({'where':{'id':_0x3e77ab[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x108e63,null))['then'](function(_0x3a7150){if(_0x3a7150){_0x4ac2a9=_0x3a7150;_0x51c0b5['model']=_['keys'](db[_0x6e8a('0x55')][_0x6e8a('0x2b')]);_0x51c0b5[_0x6e8a('0x2e')]=_[_0x6e8a('0x2f')](_0x3e77ab[_0x6e8a('0x2e')]);_0x51c0b5['filters']=_[_0x6e8a('0x32')](_0x51c0b5[_0x6e8a('0x2d')],_0x51c0b5[_0x6e8a('0x2e')]);_0x2f89dd['attributes']=_['intersection'](_0x51c0b5[_0x6e8a('0x2d')],qs[_0x6e8a('0x33')](_0x3e77ab['query'][_0x6e8a('0x33')]));_0x2f89dd[_0x6e8a('0x31')]=_0x2f89dd[_0x6e8a('0x31')][_0x6e8a('0x34')]?_0x2f89dd[_0x6e8a('0x31')]:_0x51c0b5[_0x6e8a('0x2d')];_0x2f89dd['order']=qs['sort'](_0x3e77ab['query'][_0x6e8a('0x38')]);_0x2f89dd['where']=qs[_0x6e8a('0x30')](_[_0x6e8a('0x3a')](_0x3e77ab['query'],_0x51c0b5['filters']));if(_0x3e77ab['query'][_0x6e8a('0x54')]){_0x2f89dd[_0x6e8a('0x39')]=_[_0x6e8a('0x3b')](_0x2f89dd[_0x6e8a('0x39')],{'$or':_['map'](_0x2f89dd[_0x6e8a('0x31')],function(_0x2f3f70){var _0x5bbdff={};_0x5bbdff[_0x2f3f70]={'$like':'%'+_0x3e77ab['query'][_0x6e8a('0x54')]+'%'};return _0x5bbdff;})});}_0x2f89dd=_['merge']({},_0x2f89dd,_0x3e77ab[_0x6e8a('0x42')]);return _0x4ac2a9[_0x6e8a('0x80')](_0x2f89dd);}})[_0x6e8a('0x24')](function(_0x3a2d0a){if(_0x3a2d0a){_0x2e583a=_0x3a2d0a[_0x6e8a('0x34')];if(!_0x3e77ab[_0x6e8a('0x2e')][_0x6e8a('0x35')](_0x6e8a('0x36'))){_0x2f89dd[_0x6e8a('0x1f')]=qs[_0x6e8a('0x1f')](_0x3e77ab[_0x6e8a('0x2e')][_0x6e8a('0x1f')]);_0x2f89dd[_0x6e8a('0x1e')]=qs[_0x6e8a('0x1e')](_0x3e77ab[_0x6e8a('0x2e')][_0x6e8a('0x1e')]);}return _0x4ac2a9[_0x6e8a('0x80')](_0x2f89dd);}})[_0x6e8a('0x24')](function(_0x5cdb2b){if(_0x5cdb2b){return _0x5cdb2b?{'count':_0x2e583a,'rows':_0x5cdb2b}:null;}})[_0x6e8a('0x24')](respondWithResult(_0x108e63,null))[_0x6e8a('0x40')](handleError(_0x108e63,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6a4ffde..e51c415 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc2a=['hook','exports','../../mysqldb','WhatsappQueue','save','update','emit','hasOwnProperty'];(function(_0x4513b1,_0x186315){var _0x53f5f3=function(_0x248bfb){while(--_0x248bfb){_0x4513b1['push'](_0x4513b1['shift']());}};_0x53f5f3(++_0x186315);}(_0xbc2a,0x10a));var _0xabc2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc2a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xabc2('0x0'))['db'][_0xabc2('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xabc2('0x2'),'afterUpdate':_0xabc2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x21914b){return function(_0x2baed4,_0xdf0b31,_0x23ce66){WhatsappQueueEvents[_0xabc2('0x4')](_0x21914b+':'+_0x2baed4['id'],_0x2baed4);WhatsappQueueEvents[_0xabc2('0x4')](_0x21914b,_0x2baed4);_0x23ce66(null);};}for(var e in events){if(events[_0xabc2('0x5')](e)){var event=events[e];WhatsappQueue[_0xabc2('0x6')](e,emitEvent(event));}}module[_0xabc2('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x2928=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x2928,0x115));var _0x8292=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x2928[_0x2d89ce];return _0x3fad10;};'use strict';var EventEmitter=require(_0x8292('0x0'));var WhatsappQueue=require(_0x8292('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8292('0x2')](0x0);var events={'afterCreate':_0x8292('0x3'),'afterUpdate':_0x8292('0x4'),'afterDestroy':_0x8292('0x5')};function emitEvent(_0x3c3abc){return function(_0xb651d8,_0x449436,_0x1e776b){WhatsappQueueEvents['emit'](_0x3c3abc+':'+_0xb651d8['id'],_0xb651d8);WhatsappQueueEvents[_0x8292('0x6')](_0x3c3abc,_0xb651d8);_0x1e776b(null);};}for(var e in events){if(events[_0x8292('0x7')](e)){var event=events[e];WhatsappQueue[_0x8292('0x8')](e,emitEvent(event));}}module[_0x8292('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 22640e9..923bba6 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48db=['request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x160248,_0x2a57e6){var _0x4e589d=function(_0x1ba722){while(--_0x1ba722){_0x160248['push'](_0x160248['shift']());}};_0x4e589d(++_0x2a57e6);}(_0x48db,0xf2));var _0xb48d=function(_0x289737,_0x3c9cb9){_0x289737=_0x289737-0x0;var _0x32311c=_0x48db[_0x289737];return _0x32311c;};'use strict';var _=require(_0xb48d('0x0'));var util=require(_0xb48d('0x1'));var logger=require(_0xb48d('0x2'))(_0xb48d('0x3'));var moment=require(_0xb48d('0x4'));var BPromise=require('bluebird');var rp=require(_0xb48d('0x5'));var fs=require('fs');var path=require(_0xb48d('0x6'));var rimraf=require('rimraf');var config=require(_0xb48d('0x7'));var attributes=require(_0xb48d('0x8'));module[_0xb48d('0x9')]=function(_0x36969d,_0x1c6621){return _0x36969d[_0xb48d('0xa')](_0xb48d('0xb'),attributes,{'tableName':_0xb48d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6796=['whatsapp_queues','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x6796,0x1d5));var _0x6679=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x6796[_0x53b53e];return _0xbb6179;};'use strict';var _=require(_0x6679('0x0'));var util=require('util');var logger=require(_0x6679('0x1'))(_0x6679('0x2'));var moment=require('moment');var BPromise=require(_0x6679('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6679('0x4'));var rimraf=require(_0x6679('0x5'));var config=require(_0x6679('0x6'));var attributes=require(_0x6679('0x7'));module[_0x6679('0x8')]=function(_0x4868a7,_0x4767ef){return _0x4868a7[_0x6679('0x9')](_0x6679('0xa'),attributes,{'tableName':_0x6679('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index b162dfe..bf48dd3 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8659=['rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','map','include','model','attributes','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5968f2,_0x142cdc){var _0x5007f2=function(_0x15f23c){while(--_0x15f23c){_0x5968f2['push'](_0x5968f2['shift']());}};_0x5007f2(++_0x142cdc);}(_0x8659,0x157));var _0x9865=function(_0x554344,_0x212a67){_0x554344=_0x554344-0x0;var _0x32e498=_0x8659[_0x554344];return _0x32e498;};'use strict';var _=require(_0x9865('0x0'));var util=require(_0x9865('0x1'));var moment=require(_0x9865('0x2'));var BPromise=require(_0x9865('0x3'));var rs=require(_0x9865('0x4'));var fs=require('fs');var Redis=require(_0x9865('0x5'));var db=require(_0x9865('0x6'))['db'];var utils=require(_0x9865('0x7'));var logger=require(_0x9865('0x8'))(_0x9865('0x9'));var config=require('../../config/environment');var jayson=require(_0x9865('0xa'));var client=jayson['client'][_0x9865('0xb')]({'port':0x232a});config[_0x9865('0xc')]=_[_0x9865('0xd')](config[_0x9865('0xc')],{'host':_0x9865('0xe'),'port':0x18eb});var socket=require(_0x9865('0xf'))(new Redis(config[_0x9865('0xc')]));require(_0x9865('0x10'))[_0x9865('0x11')](socket);function respondWithRpcPromise(_0x5d5847,_0xc415a,_0x284bb7){return new BPromise(function(_0x10a7ad,_0x3bb178){return client[_0x9865('0x12')](_0x5d5847,_0x284bb7)[_0x9865('0x13')](function(_0xdbb51d){logger[_0x9865('0x14')](_0x9865('0x15'),_0xc415a,_0x9865('0x16'));logger[_0x9865('0x17')](_0x9865('0x18'),_0xc415a,_0x9865('0x16'),JSON[_0x9865('0x19')](_0xdbb51d));if(_0xdbb51d[_0x9865('0x1a')]){if(_0xdbb51d[_0x9865('0x1a')][_0x9865('0x1b')]===0x1f4){logger['error'](_0x9865('0x15'),_0xc415a,_0xdbb51d[_0x9865('0x1a')][_0x9865('0x1c')]);return _0x3bb178(_0xdbb51d['error'][_0x9865('0x1c')]);}logger[_0x9865('0x1a')]('WhatsappQueue,\x20%s,\x20%s',_0xc415a,_0xdbb51d[_0x9865('0x1a')][_0x9865('0x1c')]);return _0x10a7ad(_0xdbb51d['error']['message']);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0xc415a,_0x9865('0x16'));_0x10a7ad(_0xdbb51d[_0x9865('0x1d')][_0x9865('0x1c')]);}})[_0x9865('0x1e')](function(_0x5d419b){logger[_0x9865('0x1a')](_0x9865('0x15'),_0xc415a,_0x5d419b);_0x3bb178(_0x5d419b);});});}exports[_0x9865('0x1f')]=function(_0x1cd1bf){var _0x3cd893=this;return new Promise(function(_0x4845f9,_0x3cd894){return db[_0x9865('0x20')][_0x9865('0x21')]({'raw':_0x1cd1bf[_0x9865('0x22')]?_0x1cd1bf[_0x9865('0x22')][_0x9865('0x23')]===undefined?!![]:![]:!![],'where':_0x1cd1bf[_0x9865('0x22')]?_0x1cd1bf['options'][_0x9865('0x24')]||null:null,'attributes':_0x1cd1bf['options']?_0x1cd1bf['options']['attributes']||null:null,'limit':_0x1cd1bf['options']?_0x1cd1bf[_0x9865('0x22')][_0x9865('0x25')]||null:null,'include':_0x1cd1bf[_0x9865('0x22')]?_0x1cd1bf[_0x9865('0x22')]['include']?_[_0x9865('0x26')](_0x1cd1bf['options'][_0x9865('0x27')],function(_0x50c3fe){return{'model':db[_0x50c3fe[_0x9865('0x28')]],'as':_0x50c3fe['as'],'attributes':_0x50c3fe[_0x9865('0x29')],'include':_0x50c3fe[_0x9865('0x27')]?_[_0x9865('0x26')](_0x50c3fe[_0x9865('0x27')],function(_0x221cf1){return{'model':db[_0x221cf1[_0x9865('0x28')]],'as':_0x221cf1['as'],'attributes':_0x221cf1[_0x9865('0x29')],'include':_0x221cf1[_0x9865('0x27')]?_[_0x9865('0x26')](_0x221cf1[_0x9865('0x27')],function(_0x6b3d43){return{'model':db[_0x6b3d43['model']],'as':_0x6b3d43['as'],'attributes':_0x6b3d43[_0x9865('0x29')]};}):[]};}):[]};}):[]:[]})[_0x9865('0x13')](function(_0x5207d4){logger[_0x9865('0x14')](_0x9865('0x1f'),_0x1cd1bf);logger[_0x9865('0x17')](_0x9865('0x1f'),_0x1cd1bf,JSON[_0x9865('0x19')](_0x5207d4));_0x4845f9(_0x5207d4);})[_0x9865('0x1e')](function(_0x1a4a3a){logger['error'](_0x9865('0x1f'),_0x1a4a3a['message'],_0x1cd1bf);_0x3cd894(_0x3cd893[_0x9865('0x1a')](0x1f4,_0x1a4a3a[_0x9865('0x1c')]));});});};exports[_0x9865('0x2a')]=function(_0xead1d6){var _0xaebf75=this;return new Promise(function(_0x2685fc,_0x269858){return db[_0x9865('0x20')][_0x9865('0x2b')]({'raw':_0xead1d6[_0x9865('0x22')]?_0xead1d6[_0x9865('0x22')][_0x9865('0x23')]===undefined?!![]:![]:!![],'where':_0xead1d6[_0x9865('0x22')]?_0xead1d6[_0x9865('0x22')][_0x9865('0x24')]||null:null,'attributes':_0xead1d6[_0x9865('0x22')]?_0xead1d6[_0x9865('0x22')][_0x9865('0x29')]||null:null,'include':_0xead1d6[_0x9865('0x22')]?_0xead1d6[_0x9865('0x22')][_0x9865('0x27')]?_[_0x9865('0x26')](_0xead1d6[_0x9865('0x22')][_0x9865('0x27')],function(_0x5d6f69){return{'model':db[_0x5d6f69[_0x9865('0x28')]],'as':_0x5d6f69['as'],'attributes':_0x5d6f69[_0x9865('0x29')],'include':_0x5d6f69[_0x9865('0x27')]?_[_0x9865('0x26')](_0x5d6f69[_0x9865('0x27')],function(_0x56ff88){return{'model':db[_0x56ff88[_0x9865('0x28')]],'as':_0x56ff88['as'],'attributes':_0x56ff88[_0x9865('0x29')],'include':_0x56ff88['include']?_[_0x9865('0x26')](_0x56ff88[_0x9865('0x27')],function(_0x3a766a){return{'model':db[_0x3a766a['model']],'as':_0x3a766a['as'],'attributes':_0x3a766a[_0x9865('0x29')]};}):[]};}):[]};}):[]:[]})[_0x9865('0x13')](function(_0x2aff35){logger[_0x9865('0x14')]('ShowWhatsappQueue',_0xead1d6);logger[_0x9865('0x17')](_0x9865('0x2a'),_0xead1d6,JSON[_0x9865('0x19')](_0x2aff35));_0x2685fc(_0x2aff35);})[_0x9865('0x1e')](function(_0x4278ba){logger[_0x9865('0x1a')](_0x9865('0x2a'),_0x4278ba['message'],_0xead1d6);_0x269858(_0xaebf75[_0x9865('0x1a')](0x1f4,_0x4278ba[_0x9865('0x1c')]));});});}; \ No newline at end of file +var _0x4c0a=['WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','options','raw','where','limit','include','map','model','attributes','then','info','GetWhatsappQueue','debug','ShowWhatsappQueue','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request'];(function(_0x1daf25,_0x456459){var _0x4cbf26=function(_0x27991e){while(--_0x27991e){_0x1daf25['push'](_0x1daf25['shift']());}};_0x4cbf26(++_0x456459);}(_0x4c0a,0x163));var _0xa4c0=function(_0x4210fa,_0x52b098){_0x4210fa=_0x4210fa-0x0;var _0x395294=_0x4c0a[_0x4210fa];return _0x395294;};'use strict';var _=require(_0xa4c0('0x0'));var util=require(_0xa4c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4c0('0x2'))['db'];var utils=require(_0xa4c0('0x3'));var logger=require('../../config/logger')(_0xa4c0('0x4'));var config=require(_0xa4c0('0x5'));var jayson=require(_0xa4c0('0x6'));var client=jayson[_0xa4c0('0x7')][_0xa4c0('0x8')]({'port':0x232a});config[_0xa4c0('0x9')]=_[_0xa4c0('0xa')](config[_0xa4c0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4c0('0xb'))(new Redis(config['redis']));require(_0xa4c0('0xc'))[_0xa4c0('0xd')](socket);function respondWithRpcPromise(_0x802543,_0x16afc3,_0x484743){return new BPromise(function(_0x3e0fa5,_0x4b222a){return client[_0xa4c0('0xe')](_0x802543,_0x484743)['then'](function(_0x4ed530){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x16afc3,'request\x20sent');logger['debug'](_0xa4c0('0xf'),_0x16afc3,_0xa4c0('0x10'),JSON[_0xa4c0('0x11')](_0x4ed530));if(_0x4ed530[_0xa4c0('0x12')]){if(_0x4ed530[_0xa4c0('0x12')]['code']===0x1f4){logger[_0xa4c0('0x12')](_0xa4c0('0x13'),_0x16afc3,_0x4ed530[_0xa4c0('0x12')][_0xa4c0('0x14')]);return _0x4b222a(_0x4ed530[_0xa4c0('0x12')][_0xa4c0('0x14')]);}logger[_0xa4c0('0x12')](_0xa4c0('0x13'),_0x16afc3,_0x4ed530[_0xa4c0('0x12')][_0xa4c0('0x14')]);return _0x3e0fa5(_0x4ed530['error'][_0xa4c0('0x14')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x16afc3,'request\x20sent');_0x3e0fa5(_0x4ed530[_0xa4c0('0x15')][_0xa4c0('0x14')]);}})[_0xa4c0('0x16')](function(_0x82cf24){logger[_0xa4c0('0x12')](_0xa4c0('0x13'),_0x16afc3,_0x82cf24);_0x4b222a(_0x82cf24);});});}exports['GetWhatsappQueue']=function(_0x1e475f){var _0x240311=this;return new Promise(function(_0x3f9760,_0x196c8a){return db[_0xa4c0('0x17')]['findAll']({'raw':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')][_0xa4c0('0x19')]===undefined?!![]:![]:!![],'where':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')][_0xa4c0('0x1a')]||null:null,'attributes':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')]['attributes']||null:null,'limit':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')][_0xa4c0('0x1b')]||null:null,'include':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')][_0xa4c0('0x1c')]?_[_0xa4c0('0x1d')](_0x1e475f[_0xa4c0('0x18')]['include'],function(_0x44b7d2){return{'model':db[_0x44b7d2[_0xa4c0('0x1e')]],'as':_0x44b7d2['as'],'attributes':_0x44b7d2[_0xa4c0('0x1f')],'include':_0x44b7d2[_0xa4c0('0x1c')]?_[_0xa4c0('0x1d')](_0x44b7d2[_0xa4c0('0x1c')],function(_0x3e4eb9){return{'model':db[_0x3e4eb9[_0xa4c0('0x1e')]],'as':_0x3e4eb9['as'],'attributes':_0x3e4eb9[_0xa4c0('0x1f')],'include':_0x3e4eb9[_0xa4c0('0x1c')]?_['map'](_0x3e4eb9[_0xa4c0('0x1c')],function(_0x36f7de){return{'model':db[_0x36f7de[_0xa4c0('0x1e')]],'as':_0x36f7de['as'],'attributes':_0x36f7de[_0xa4c0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa4c0('0x20')](function(_0x4c2666){logger[_0xa4c0('0x21')](_0xa4c0('0x22'),_0x1e475f);logger[_0xa4c0('0x23')](_0xa4c0('0x22'),_0x1e475f,JSON[_0xa4c0('0x11')](_0x4c2666));_0x3f9760(_0x4c2666);})[_0xa4c0('0x16')](function(_0x4e5f84){logger[_0xa4c0('0x12')](_0xa4c0('0x22'),_0x4e5f84[_0xa4c0('0x14')],_0x1e475f);_0x196c8a(_0x240311[_0xa4c0('0x12')](0x1f4,_0x4e5f84[_0xa4c0('0x14')]));});});};exports['ShowWhatsappQueue']=function(_0x6cbc9){var _0x2226fe=this;return new Promise(function(_0xc8adf8,_0x112ca1){return db[_0xa4c0('0x17')]['find']({'raw':_0x6cbc9[_0xa4c0('0x18')]?_0x6cbc9['options'][_0xa4c0('0x19')]===undefined?!![]:![]:!![],'where':_0x6cbc9[_0xa4c0('0x18')]?_0x6cbc9[_0xa4c0('0x18')][_0xa4c0('0x1a')]||null:null,'attributes':_0x6cbc9[_0xa4c0('0x18')]?_0x6cbc9['options']['attributes']||null:null,'include':_0x6cbc9[_0xa4c0('0x18')]?_0x6cbc9['options'][_0xa4c0('0x1c')]?_[_0xa4c0('0x1d')](_0x6cbc9[_0xa4c0('0x18')][_0xa4c0('0x1c')],function(_0x214832){return{'model':db[_0x214832[_0xa4c0('0x1e')]],'as':_0x214832['as'],'attributes':_0x214832[_0xa4c0('0x1f')],'include':_0x214832[_0xa4c0('0x1c')]?_[_0xa4c0('0x1d')](_0x214832[_0xa4c0('0x1c')],function(_0x3a4309){return{'model':db[_0x3a4309['model']],'as':_0x3a4309['as'],'attributes':_0x3a4309[_0xa4c0('0x1f')],'include':_0x3a4309['include']?_['map'](_0x3a4309[_0xa4c0('0x1c')],function(_0x162281){return{'model':db[_0x162281[_0xa4c0('0x1e')]],'as':_0x162281['as'],'attributes':_0x162281[_0xa4c0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa4c0('0x20')](function(_0xc07aee){logger[_0xa4c0('0x21')](_0xa4c0('0x24'),_0x6cbc9);logger[_0xa4c0('0x23')](_0xa4c0('0x24'),_0x6cbc9,JSON[_0xa4c0('0x11')](_0xc07aee));_0xc8adf8(_0xc07aee);})[_0xa4c0('0x16')](function(_0x445bce){logger[_0xa4c0('0x12')]('ShowWhatsappQueue',_0x445bce[_0xa4c0('0x14')],_0x6cbc9);_0x112ca1(_0x2226fe[_0xa4c0('0x12')](0x1f4,_0x445bce[_0xa4c0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 735c7ba..d256028 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa15b=['update','emit','register','whatsappQueue:','./whatsappQueue.events'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xa15b,0x17b));var _0xba15=function(_0x5077cc,_0x2fa56c){_0x5077cc=_0x5077cc-0x0;var _0x4e1f79=_0xa15b[_0x5077cc];return _0x4e1f79;};'use strict';var WhatsappQueueEvents=require(_0xba15('0x0'));var events=['save','remove',_0xba15('0x1')];function createListener(_0x158a35,_0x5f06bb){return function(_0x4edcc5){_0x5f06bb[_0xba15('0x2')](_0x158a35,_0x4edcc5);};}function removeListener(_0x1a76e5,_0x2ec174){return function(){WhatsappQueueEvents['removeListener'](_0x1a76e5,_0x2ec174);};}exports[_0xba15('0x3')]=function(_0x265f01){for(var _0x3f22fb=0x0,_0x1a29e7=events['length'];_0x3f22fb<_0x1a29e7;_0x3f22fb++){var _0x1f377a=events[_0x3f22fb];var _0x82b75d=createListener(_0xba15('0x4')+_0x1f377a,_0x265f01);WhatsappQueueEvents['on'](_0x1f377a,_0x82b75d);}}; \ No newline at end of file +var _0xa42e=['remove','update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x3fbd51,_0x40b693){var _0x60db65=function(_0x2a39e9){while(--_0x2a39e9){_0x3fbd51['push'](_0x3fbd51['shift']());}};_0x60db65(++_0x40b693);}(_0xa42e,0x1ae));var _0xea42=function(_0x3a2c05,_0x35384b){_0x3a2c05=_0x3a2c05-0x0;var _0x40d510=_0xa42e[_0x3a2c05];return _0x40d510;};'use strict';var WhatsappQueueEvents=require(_0xea42('0x0'));var events=[_0xea42('0x1'),_0xea42('0x2'),_0xea42('0x3')];function createListener(_0x1347bf,_0x19b2fa){return function(_0x33816e){_0x19b2fa['emit'](_0x1347bf,_0x33816e);};}function removeListener(_0x33e4db,_0x3e9736){return function(){WhatsappQueueEvents[_0xea42('0x4')](_0x33e4db,_0x3e9736);};}exports[_0xea42('0x5')]=function(_0xae2237){for(var _0x377516=0x0,_0xd98602=events[_0xea42('0x6')];_0x377516<_0xd98602;_0x377516++){var _0x39a61b=events[_0x377516];var _0x18dcb4=createListener(_0xea42('0x7')+_0x39a61b,_0xae2237);WhatsappQueueEvents['on'](_0x39a61b,_0x18dcb4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 278e86a..28ef314 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cac=['express','Router','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1fac2f,_0x49e8bd){var _0x1ec74f=function(_0x34d286){while(--_0x34d286){_0x1fac2f['push'](_0x1fac2f['shift']());}};_0x1ec74f(++_0x49e8bd);}(_0x6cac,0xe7));var _0xc6ca=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6cac[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xc6ca('0x0'));var util=require('util');var path=require(_0xc6ca('0x1'));var timeout=require(_0xc6ca('0x2'));var express=require(_0xc6ca('0x3'));var router=express[_0xc6ca('0x4')]();var auth=require(_0xc6ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6ca('0x6'));var controller=require(_0xc6ca('0x7'));router[_0xc6ca('0x8')]('/',auth[_0xc6ca('0x9')](),controller[_0xc6ca('0xa')]);router[_0xc6ca('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xc6ca('0xb')]);router[_0xc6ca('0x8')](_0xc6ca('0xc'),auth[_0xc6ca('0x9')](),controller['show']);router[_0xc6ca('0xd')]('/',auth[_0xc6ca('0x9')](),controller[_0xc6ca('0xe')]);router['put'](_0xc6ca('0xc'),auth[_0xc6ca('0x9')](),controller['update']);router[_0xc6ca('0xf')](_0xc6ca('0xc'),auth[_0xc6ca('0x9')](),controller[_0xc6ca('0x10')]);module[_0xc6ca('0x11')]=router; \ No newline at end of file +var _0x6d41=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x2a007a,_0x2da459){var _0x27cb78=function(_0x31c1ff){while(--_0x31c1ff){_0x2a007a['push'](_0x2a007a['shift']());}};_0x27cb78(++_0x2da459);}(_0x6d41,0x123));var _0x16d4=function(_0x478c12,_0x2f587f){_0x478c12=_0x478c12-0x0;var _0xb4e359=_0x6d41[_0x478c12];return _0xb4e359;};'use strict';var multer=require(_0x16d4('0x0'));var util=require(_0x16d4('0x1'));var path=require(_0x16d4('0x2'));var timeout=require(_0x16d4('0x3'));var express=require('express');var router=express[_0x16d4('0x4')]();var auth=require(_0x16d4('0x5'));var interaction=require(_0x16d4('0x6'));var config=require(_0x16d4('0x7'));var controller=require(_0x16d4('0x8'));router[_0x16d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x16d4('0xa')]);router[_0x16d4('0x9')](_0x16d4('0xb'),auth[_0x16d4('0xc')](),controller[_0x16d4('0xd')]);router[_0x16d4('0x9')]('/:id',auth[_0x16d4('0xc')](),controller[_0x16d4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x16d4('0xf')]);router[_0x16d4('0x10')](_0x16d4('0x11'),auth[_0x16d4('0xc')](),controller['update']);router[_0x16d4('0x12')](_0x16d4('0x11'),auth[_0x16d4('0xc')](),controller[_0x16d4('0x13')]);module[_0x16d4('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 539b211..ea42899 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['sequelize','exports','STRING','DATE'];(function(_0x33bb22,_0x45dcb1){var _0x18752f=function(_0x3cd932){while(--_0x3cd932){_0x33bb22['push'](_0x33bb22['shift']());}};_0x18752f(++_0x45dcb1);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x00bb[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'uniqueid':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb00b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb00b('0x3')]},'exitAt':{'type':Sequelize[_0xb00b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4b84=['sequelize','exports','DATE','STRING'];(function(_0x4730af,_0xe149fb){var _0x396bfa=function(_0x21659f){while(--_0x21659f){_0x4730af['push'](_0x4730af['shift']());}};_0x396bfa(++_0xe149fb);}(_0x4b84,0x1cc));var _0x44b8=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x4b84[_0x146a97];return _0x259d5c;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44b8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b8('0x2')]},'reason':{'type':Sequelize[_0x44b8('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c4535bb..f49f94d 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bab=['attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','body','destroy','describe','html-pdf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','map','WhatsappQueueReport','rawAttributes','type','key','model','keys','query','filters','intersection','fields'];(function(_0x22b75a,_0x1ba2a0){var _0x39b9e4=function(_0x50dab2){while(--_0x50dab2){_0x22b75a['push'](_0x22b75a['shift']());}};_0x39b9e4(++_0x1ba2a0);}(_0x3bab,0x142));var _0xb3ba=function(_0x462d1d,_0x33e7ab){_0x462d1d=_0x462d1d-0x0;var _0x240cf7=_0x3bab[_0x462d1d];return _0x240cf7;};'use strict';var pdf=require(_0xb3ba('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb3ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3ba('0x2'));var moment=require('moment');var BPromise=require(_0xb3ba('0x3'));var Mustache=require(_0xb3ba('0x4'));var util=require(_0xb3ba('0x5'));var path=require(_0xb3ba('0x6'));var sox=require(_0xb3ba('0x7'));var csv=require(_0xb3ba('0x8'));var ejs=require(_0xb3ba('0x9'));var fs=require('fs');var _=require(_0xb3ba('0xa'));var squel=require(_0xb3ba('0xb'));var crypto=require(_0xb3ba('0xc'));var jsforce=require(_0xb3ba('0xd'));var deskjs=require(_0xb3ba('0xe'));var toCsv=require(_0xb3ba('0x8'));var querystring=require(_0xb3ba('0xf'));var Papa=require(_0xb3ba('0x10'));var Redis=require(_0xb3ba('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb3ba('0x12'));var as=require(_0xb3ba('0x13'));var hardwareService=require(_0xb3ba('0x14'));var logger=require(_0xb3ba('0x15'))(_0xb3ba('0x16'));var utils=require(_0xb3ba('0x17'));var config=require(_0xb3ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3ba('0x19'))['db'];function respondWithStatusCode(_0x15782b,_0x53c95c){_0x53c95c=_0x53c95c||0xcc;return function(_0x15e69a){if(_0x15e69a){return _0x15782b[_0xb3ba('0x1a')](_0x53c95c);}return _0x15782b[_0xb3ba('0x1b')](_0x53c95c)[_0xb3ba('0x1c')]();};}function respondWithResult(_0x288040,_0x1d2ff5){_0x1d2ff5=_0x1d2ff5||0xc8;return function(_0x5b8194){if(_0x5b8194){return _0x288040[_0xb3ba('0x1b')](_0x1d2ff5)[_0xb3ba('0x1d')](_0x5b8194);}};}function respondWithFilteredResult(_0x45ba56,_0x28a485){return function(_0x522fab){if(_0x522fab){var _0x1de911=_0x522fab[_0xb3ba('0x1e')],_0x58fee0=_0x28a485['offset'],_0x4cafc9=_0x28a485[_0xb3ba('0x1f')]+_0x28a485[_0xb3ba('0x20')],_0x28a3c6;if(_0x4cafc9>=_0x1de911){_0x4cafc9=_0x1de911;_0x28a3c6=0xc8;}else{_0x28a3c6=0xce;}_0x45ba56[_0xb3ba('0x1b')](_0x28a3c6);return _0x45ba56[_0xb3ba('0x21')](_0xb3ba('0x22'),_0x58fee0+'-'+_0x4cafc9+'/'+_0x1de911)['json'](_0x522fab);}return null;};}function patchUpdates(_0x24ebfa){return function(_0xdb4355){try{jsonpatch['apply'](_0xdb4355,_0x24ebfa,!![]);}catch(_0x373bfa){return BPromise[_0xb3ba('0x23')](_0x373bfa);}return _0xdb4355[_0xb3ba('0x24')]();};}function saveUpdates(_0x2a9505,_0x316c00){return function(_0x5ee0f2){if(_0x5ee0f2){return _0x5ee0f2[_0xb3ba('0x25')](_0x2a9505)[_0xb3ba('0x26')](function(_0x18b1b4){return _0x18b1b4;});}return null;};}function removeEntity(_0x5de5c4,_0x13dab5){return function(_0x340c32){if(_0x340c32){return _0x340c32['destroy']()[_0xb3ba('0x26')](function(){_0x5de5c4[_0xb3ba('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x431209,_0x2a1877){return function(_0x1e8ba7){if(!_0x1e8ba7){_0x431209[_0xb3ba('0x1a')](0x194);}return _0x1e8ba7;};}function handleError(_0x3e9814,_0x5d2159){_0x5d2159=_0x5d2159||0x1f4;return function(_0x5085c1){logger['error'](_0x5085c1[_0xb3ba('0x27')]);if(_0x5085c1[_0xb3ba('0x28')]){delete _0x5085c1[_0xb3ba('0x28')];}_0x3e9814['status'](_0x5d2159)[_0xb3ba('0x29')](_0x5085c1);};}exports['index']=function(_0x581da4,_0x4774a0){var _0x4bebc3={},_0x53133b={},_0x4a51e3={'count':0x0,'rows':[]};var _0xce0c35=_[_0xb3ba('0x2a')](db[_0xb3ba('0x2b')][_0xb3ba('0x2c')],function(_0x108c24){return{'name':_0x108c24['fieldName'],'type':_0x108c24[_0xb3ba('0x2d')][_0xb3ba('0x2e')]};});_0x53133b[_0xb3ba('0x2f')]=_[_0xb3ba('0x2a')](_0xce0c35,_0xb3ba('0x28'));_0x53133b['query']=_[_0xb3ba('0x30')](_0x581da4[_0xb3ba('0x31')]);_0x53133b[_0xb3ba('0x32')]=_['intersection'](_0x53133b[_0xb3ba('0x2f')],_0x53133b[_0xb3ba('0x31')]);_0x4bebc3['attributes']=_[_0xb3ba('0x33')](_0x53133b[_0xb3ba('0x2f')],qs[_0xb3ba('0x34')](_0x581da4[_0xb3ba('0x31')][_0xb3ba('0x34')]));_0x4bebc3[_0xb3ba('0x35')]=_0x4bebc3[_0xb3ba('0x35')][_0xb3ba('0x36')]?_0x4bebc3[_0xb3ba('0x35')]:_0x53133b[_0xb3ba('0x2f')];if(!_0x581da4[_0xb3ba('0x31')][_0xb3ba('0x37')](_0xb3ba('0x38'))){_0x4bebc3[_0xb3ba('0x20')]=qs[_0xb3ba('0x20')](_0x581da4[_0xb3ba('0x31')][_0xb3ba('0x20')]);_0x4bebc3['offset']=qs['offset'](_0x581da4[_0xb3ba('0x31')][_0xb3ba('0x1f')]);}_0x4bebc3[_0xb3ba('0x39')]=qs[_0xb3ba('0x3a')](_0x581da4[_0xb3ba('0x31')]['sort']);_0x4bebc3[_0xb3ba('0x3b')]=qs[_0xb3ba('0x32')](_['pick'](_0x581da4[_0xb3ba('0x31')],_0x53133b[_0xb3ba('0x32')]),_0xce0c35);if(_0x581da4[_0xb3ba('0x31')][_0xb3ba('0x3c')]){_0x4bebc3[_0xb3ba('0x3b')]=_[_0xb3ba('0x3d')](_0x4bebc3[_0xb3ba('0x3b')],{'$or':_[_0xb3ba('0x2a')](_0xce0c35,function(_0x51e79d){if(_0x51e79d['type']!==_0xb3ba('0x3e')){var _0x32c42a={};_0x32c42a[_0x51e79d['name']]={'$like':'%'+_0x581da4[_0xb3ba('0x31')][_0xb3ba('0x3c')]+'%'};return _0x32c42a;}})});}_0x4bebc3=_['merge']({},_0x4bebc3,_0x581da4[_0xb3ba('0x3f')]);var _0x274eca={'where':_0x4bebc3[_0xb3ba('0x3b')]};return db[_0xb3ba('0x2b')]['count'](_0x274eca)['then'](function(_0x1a4849){_0x4a51e3[_0xb3ba('0x1e')]=_0x1a4849;if(_0x581da4['query'][_0xb3ba('0x40')]){_0x4bebc3[_0xb3ba('0x41')]=[{'all':!![]}];}return db[_0xb3ba('0x2b')][_0xb3ba('0x42')](_0x4bebc3);})['then'](function(_0x6f4d1){_0x4a51e3[_0xb3ba('0x43')]=_0x6f4d1;return _0x4a51e3;})[_0xb3ba('0x26')](respondWithFilteredResult(_0x4774a0,_0x4bebc3))['catch'](handleError(_0x4774a0,null));};exports[_0xb3ba('0x44')]=function(_0x45e78a,_0x6925ef){var _0x470b87={'raw':!![],'where':{'id':_0x45e78a[_0xb3ba('0x45')]['id']}},_0x32d20b={};_0x32d20b[_0xb3ba('0x2f')]=_[_0xb3ba('0x30')](db[_0xb3ba('0x2b')]['rawAttributes']);_0x32d20b[_0xb3ba('0x31')]=_['keys'](_0x45e78a[_0xb3ba('0x31')]);_0x32d20b[_0xb3ba('0x32')]=_[_0xb3ba('0x33')](_0x32d20b[_0xb3ba('0x2f')],_0x32d20b[_0xb3ba('0x31')]);_0x470b87[_0xb3ba('0x35')]=_['intersection'](_0x32d20b[_0xb3ba('0x2f')],qs[_0xb3ba('0x34')](_0x45e78a['query'][_0xb3ba('0x34')]));_0x470b87[_0xb3ba('0x35')]=_0x470b87[_0xb3ba('0x35')]['length']?_0x470b87['attributes']:_0x32d20b[_0xb3ba('0x2f')];if(_0x45e78a[_0xb3ba('0x31')][_0xb3ba('0x40')]){_0x470b87[_0xb3ba('0x41')]=[{'all':!![]}];}_0x470b87=_[_0xb3ba('0x3d')]({},_0x470b87,_0x45e78a[_0xb3ba('0x3f')]);return db[_0xb3ba('0x2b')][_0xb3ba('0x46')](_0x470b87)[_0xb3ba('0x26')](handleEntityNotFound(_0x6925ef,null))[_0xb3ba('0x26')](respondWithResult(_0x6925ef,null))[_0xb3ba('0x47')](handleError(_0x6925ef,null));};exports['create']=function(_0x26b12f,_0x5d3b15){return db[_0xb3ba('0x2b')]['create'](_0x26b12f[_0xb3ba('0x48')],{})[_0xb3ba('0x26')](respondWithResult(_0x5d3b15,0xc9))[_0xb3ba('0x47')](handleError(_0x5d3b15,null));};exports['update']=function(_0xea9347,_0x288791){if(_0xea9347[_0xb3ba('0x48')]['id']){delete _0xea9347['body']['id'];}return db[_0xb3ba('0x2b')][_0xb3ba('0x46')]({'where':{'id':_0xea9347[_0xb3ba('0x45')]['id']}})[_0xb3ba('0x26')](handleEntityNotFound(_0x288791,null))['then'](saveUpdates(_0xea9347[_0xb3ba('0x48')],null))[_0xb3ba('0x26')](respondWithResult(_0x288791,null))[_0xb3ba('0x47')](handleError(_0x288791,null));};exports[_0xb3ba('0x49')]=function(_0xcd53c6,_0x5a32c4){return db[_0xb3ba('0x2b')][_0xb3ba('0x46')]({'where':{'id':_0xcd53c6[_0xb3ba('0x45')]['id']}})[_0xb3ba('0x26')](handleEntityNotFound(_0x5a32c4,null))[_0xb3ba('0x26')](removeEntity(_0x5a32c4,null))[_0xb3ba('0x47')](handleError(_0x5a32c4,null));};exports[_0xb3ba('0x4a')]=function(_0x32d47b,_0x57810a){return db[_0xb3ba('0x2b')]['describe']()[_0xb3ba('0x26')](respondWithResult(_0x57810a,null))[_0xb3ba('0x47')](handleError(_0x57810a,null));}; \ No newline at end of file +var _0x0f48=['findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include'];(function(_0x40aa31,_0x175b59){var _0x393c74=function(_0x119817){while(--_0x119817){_0x40aa31['push'](_0x40aa31['shift']());}};_0x393c74(++_0x175b59);}(_0x0f48,0xe4));var _0x80f4=function(_0x13ca25,_0x4c40dc){_0x13ca25=_0x13ca25-0x0;var _0x50730c=_0x0f48[_0x13ca25];return _0x50730c;};'use strict';var pdf=require(_0x80f4('0x0'));var emlformat=require(_0x80f4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x80f4('0x2'));var jsonpatch=require(_0x80f4('0x3'));var rp=require(_0x80f4('0x4'));var moment=require(_0x80f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x80f4('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x80f4('0x7'));var fs=require('fs');var _=require(_0x80f4('0x8'));var squel=require(_0x80f4('0x9'));var crypto=require('crypto');var jsforce=require(_0x80f4('0xa'));var deskjs=require(_0x80f4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x80f4('0xc'));var Papa=require(_0x80f4('0xd'));var Redis=require(_0x80f4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x80f4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x80f4('0x10'));var utils=require(_0x80f4('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x80f4('0x12'))['db'];function respondWithStatusCode(_0x144e37,_0x1eae35){_0x1eae35=_0x1eae35||0xcc;return function(_0x39d4ed){if(_0x39d4ed){return _0x144e37[_0x80f4('0x13')](_0x1eae35);}return _0x144e37[_0x80f4('0x14')](_0x1eae35)[_0x80f4('0x15')]();};}function respondWithResult(_0x46dafa,_0x417153){_0x417153=_0x417153||0xc8;return function(_0x52cbdc){if(_0x52cbdc){return _0x46dafa[_0x80f4('0x14')](_0x417153)[_0x80f4('0x16')](_0x52cbdc);}};}function respondWithFilteredResult(_0x2b1650,_0x43527b){return function(_0x532df9){if(_0x532df9){var _0x5504dd=_0x532df9[_0x80f4('0x17')],_0x17535a=_0x43527b[_0x80f4('0x18')],_0x17f844=_0x43527b[_0x80f4('0x18')]+_0x43527b[_0x80f4('0x19')],_0x3fa909;if(_0x17f844>=_0x5504dd){_0x17f844=_0x5504dd;_0x3fa909=0xc8;}else{_0x3fa909=0xce;}_0x2b1650[_0x80f4('0x14')](_0x3fa909);return _0x2b1650[_0x80f4('0x1a')](_0x80f4('0x1b'),_0x17535a+'-'+_0x17f844+'/'+_0x5504dd)['json'](_0x532df9);}return null;};}function patchUpdates(_0x9d047e){return function(_0x2a633e){try{jsonpatch[_0x80f4('0x1c')](_0x2a633e,_0x9d047e,!![]);}catch(_0x351233){return BPromise[_0x80f4('0x1d')](_0x351233);}return _0x2a633e[_0x80f4('0x1e')]();};}function saveUpdates(_0x51b501,_0x31af03){return function(_0x15689f){if(_0x15689f){return _0x15689f[_0x80f4('0x1f')](_0x51b501)[_0x80f4('0x20')](function(_0x495739){return _0x495739;});}return null;};}function removeEntity(_0x375f37,_0x57e907){return function(_0x3416d1){if(_0x3416d1){return _0x3416d1['destroy']()['then'](function(){_0x375f37['status'](0xcc)[_0x80f4('0x15')]();});}};}function handleEntityNotFound(_0x36b84b,_0x21b261){return function(_0x47abab){if(!_0x47abab){_0x36b84b[_0x80f4('0x13')](0x194);}return _0x47abab;};}function handleError(_0x51c4e6,_0x306f7d){_0x306f7d=_0x306f7d||0x1f4;return function(_0x202f69){logger[_0x80f4('0x21')](_0x202f69[_0x80f4('0x22')]);if(_0x202f69['name']){delete _0x202f69[_0x80f4('0x23')];}_0x51c4e6[_0x80f4('0x14')](_0x306f7d)[_0x80f4('0x24')](_0x202f69);};}exports[_0x80f4('0x25')]=function(_0x51104f,_0x2211b9){var _0x1e9721={},_0x1ac2bb={},_0x501452={'count':0x0,'rows':[]};var _0x2d7594=_[_0x80f4('0x26')](db[_0x80f4('0x27')][_0x80f4('0x28')],function(_0x20d3ed){return{'name':_0x20d3ed['fieldName'],'type':_0x20d3ed[_0x80f4('0x29')][_0x80f4('0x2a')]};});_0x1ac2bb[_0x80f4('0x2b')]=_['map'](_0x2d7594,_0x80f4('0x23'));_0x1ac2bb[_0x80f4('0x2c')]=_[_0x80f4('0x2d')](_0x51104f['query']);_0x1ac2bb['filters']=_[_0x80f4('0x2e')](_0x1ac2bb[_0x80f4('0x2b')],_0x1ac2bb[_0x80f4('0x2c')]);_0x1e9721[_0x80f4('0x2f')]=_[_0x80f4('0x2e')](_0x1ac2bb[_0x80f4('0x2b')],qs['fields'](_0x51104f['query'][_0x80f4('0x30')]));_0x1e9721[_0x80f4('0x2f')]=_0x1e9721[_0x80f4('0x2f')]['length']?_0x1e9721[_0x80f4('0x2f')]:_0x1ac2bb[_0x80f4('0x2b')];if(!_0x51104f[_0x80f4('0x2c')][_0x80f4('0x31')](_0x80f4('0x32'))){_0x1e9721[_0x80f4('0x19')]=qs[_0x80f4('0x19')](_0x51104f[_0x80f4('0x2c')]['limit']);_0x1e9721[_0x80f4('0x18')]=qs[_0x80f4('0x18')](_0x51104f[_0x80f4('0x2c')][_0x80f4('0x18')]);}_0x1e9721[_0x80f4('0x33')]=qs['sort'](_0x51104f[_0x80f4('0x2c')][_0x80f4('0x34')]);_0x1e9721['where']=qs[_0x80f4('0x35')](_['pick'](_0x51104f[_0x80f4('0x2c')],_0x1ac2bb[_0x80f4('0x35')]),_0x2d7594);if(_0x51104f['query'][_0x80f4('0x36')]){_0x1e9721['where']=_[_0x80f4('0x37')](_0x1e9721[_0x80f4('0x38')],{'$or':_[_0x80f4('0x26')](_0x2d7594,function(_0x3d2f4f){if(_0x3d2f4f[_0x80f4('0x29')]!==_0x80f4('0x39')){var _0x189674={};_0x189674[_0x3d2f4f['name']]={'$like':'%'+_0x51104f[_0x80f4('0x2c')][_0x80f4('0x36')]+'%'};return _0x189674;}})});}_0x1e9721=_['merge']({},_0x1e9721,_0x51104f[_0x80f4('0x3a')]);var _0x2410ae={'where':_0x1e9721[_0x80f4('0x38')]};return db[_0x80f4('0x27')][_0x80f4('0x17')](_0x2410ae)[_0x80f4('0x20')](function(_0x578677){_0x501452['count']=_0x578677;if(_0x51104f[_0x80f4('0x2c')]['includeAll']){_0x1e9721[_0x80f4('0x3b')]=[{'all':!![]}];}return db[_0x80f4('0x27')][_0x80f4('0x3c')](_0x1e9721);})[_0x80f4('0x20')](function(_0x53e753){_0x501452[_0x80f4('0x3d')]=_0x53e753;return _0x501452;})[_0x80f4('0x20')](respondWithFilteredResult(_0x2211b9,_0x1e9721))[_0x80f4('0x3e')](handleError(_0x2211b9,null));};exports[_0x80f4('0x3f')]=function(_0x2bbf56,_0x570b7f){var _0x4ff68a={'raw':!![],'where':{'id':_0x2bbf56[_0x80f4('0x40')]['id']}},_0x38d3a6={};_0x38d3a6[_0x80f4('0x2b')]=_['keys'](db[_0x80f4('0x27')][_0x80f4('0x28')]);_0x38d3a6['query']=_['keys'](_0x2bbf56[_0x80f4('0x2c')]);_0x38d3a6[_0x80f4('0x35')]=_['intersection'](_0x38d3a6[_0x80f4('0x2b')],_0x38d3a6[_0x80f4('0x2c')]);_0x4ff68a['attributes']=_[_0x80f4('0x2e')](_0x38d3a6[_0x80f4('0x2b')],qs[_0x80f4('0x30')](_0x2bbf56[_0x80f4('0x2c')]['fields']));_0x4ff68a['attributes']=_0x4ff68a[_0x80f4('0x2f')][_0x80f4('0x41')]?_0x4ff68a[_0x80f4('0x2f')]:_0x38d3a6[_0x80f4('0x2b')];if(_0x2bbf56[_0x80f4('0x2c')][_0x80f4('0x42')]){_0x4ff68a[_0x80f4('0x3b')]=[{'all':!![]}];}_0x4ff68a=_['merge']({},_0x4ff68a,_0x2bbf56[_0x80f4('0x3a')]);return db[_0x80f4('0x27')][_0x80f4('0x43')](_0x4ff68a)['then'](handleEntityNotFound(_0x570b7f,null))[_0x80f4('0x20')](respondWithResult(_0x570b7f,null))[_0x80f4('0x3e')](handleError(_0x570b7f,null));};exports[_0x80f4('0x44')]=function(_0x93e150,_0x2e3927){return db[_0x80f4('0x27')][_0x80f4('0x44')](_0x93e150['body'],{})['then'](respondWithResult(_0x2e3927,0xc9))['catch'](handleError(_0x2e3927,null));};exports[_0x80f4('0x1f')]=function(_0x465b4a,_0x2ea3ba){if(_0x465b4a['body']['id']){delete _0x465b4a[_0x80f4('0x45')]['id'];}return db['WhatsappQueueReport'][_0x80f4('0x43')]({'where':{'id':_0x465b4a[_0x80f4('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ea3ba,null))[_0x80f4('0x20')](saveUpdates(_0x465b4a[_0x80f4('0x45')],null))[_0x80f4('0x20')](respondWithResult(_0x2ea3ba,null))['catch'](handleError(_0x2ea3ba,null));};exports[_0x80f4('0x46')]=function(_0x5a56ec,_0x2f7e7d){return db['WhatsappQueueReport'][_0x80f4('0x43')]({'where':{'id':_0x5a56ec['params']['id']}})[_0x80f4('0x20')](handleEntityNotFound(_0x2f7e7d,null))[_0x80f4('0x20')](removeEntity(_0x2f7e7d,null))[_0x80f4('0x3e')](handleError(_0x2f7e7d,null));};exports['describe']=function(_0x579456,_0x20f2eb){return db[_0x80f4('0x27')][_0x80f4('0x47')]()[_0x80f4('0x20')](respondWithResult(_0x20f2eb,null))[_0x80f4('0x3e')](handleError(_0x20f2eb,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 329d78a..c622612 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3932=['request-promise','path','rimraf','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0x3932,0x14b));var _0x2393=function(_0x13dc1c,_0x2fb5eb){_0x13dc1c=_0x13dc1c-0x0;var _0x47f4ba=_0x3932[_0x13dc1c];return _0x47f4ba;};'use strict';var _=require(_0x2393('0x0'));var util=require(_0x2393('0x1'));var logger=require(_0x2393('0x2'))('api');var moment=require(_0x2393('0x3'));var BPromise=require(_0x2393('0x4'));var rp=require(_0x2393('0x5'));var fs=require('fs');var path=require(_0x2393('0x6'));var rimraf=require(_0x2393('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x2393('0x8')]=function(_0x3dc0f2,_0x3f6bc1){return _0x3dc0f2[_0x2393('0x9')](_0x2393('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x2393('0xb'),'fields':[_0x2393('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f63=['report_whatsapp_queue','lodash','util','bluebird','rimraf','../../config/environment','exports','define','WhatsappQueueReport'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9f63,0x1b1));var _0x39f6=function(_0xcd4f14,_0xe85fb7){_0xcd4f14=_0xcd4f14-0x0;var _0x34648a=_0x9f63[_0xcd4f14];return _0x34648a;};'use strict';var _=require(_0x39f6('0x0'));var util=require(_0x39f6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x39f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x39f6('0x3'));var config=require(_0x39f6('0x4'));var attributes=require('./whatsappQueueReport.attributes');module[_0x39f6('0x5')]=function(_0x1f113c,_0x5d4aa5){return _0x1f113c[_0x39f6('0x6')](_0x39f6('0x7'),attributes,{'tableName':_0x39f6('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 0b7b0a7..360e06e 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0297=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug'];(function(_0x385603,_0x1cf762){var _0x2e10ca=function(_0x1824c0){while(--_0x1824c0){_0x385603['push'](_0x385603['shift']());}};_0x2e10ca(++_0x1cf762);}(_0x0297,0x1a3));var _0x7029=function(_0x855b1c,_0x131bc8){_0x855b1c=_0x855b1c-0x0;var _0x5b4c9e=_0x0297[_0x855b1c];return _0x5b4c9e;};'use strict';var _=require(_0x7029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7029('0x1'));var rs=require(_0x7029('0x2'));var fs=require('fs');var Redis=require(_0x7029('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7029('0x4'));var logger=require('../../config/logger')(_0x7029('0x5'));var config=require(_0x7029('0x6'));var jayson=require(_0x7029('0x7'));var client=jayson[_0x7029('0x8')][_0x7029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bbd95,_0x135dbc,_0x4d4a3c){return new BPromise(function(_0x2b9170,_0x1566a7){return client[_0x7029('0xa')](_0x1bbd95,_0x4d4a3c)[_0x7029('0xb')](function(_0x397708){logger[_0x7029('0xc')](_0x7029('0xd'),_0x135dbc,'request\x20sent');logger[_0x7029('0xe')](_0x7029('0xf'),_0x135dbc,_0x7029('0x10'),JSON[_0x7029('0x11')](_0x397708));if(_0x397708[_0x7029('0x12')]){if(_0x397708[_0x7029('0x12')][_0x7029('0x13')]===0x1f4){logger[_0x7029('0x12')](_0x7029('0xd'),_0x135dbc,_0x397708[_0x7029('0x12')][_0x7029('0x14')]);return _0x1566a7(_0x397708['error']['message']);}logger[_0x7029('0x12')](_0x7029('0xd'),_0x135dbc,_0x397708[_0x7029('0x12')][_0x7029('0x14')]);return _0x2b9170(_0x397708[_0x7029('0x12')]['message']);}else{logger['info'](_0x7029('0xd'),_0x135dbc,_0x7029('0x10'));_0x2b9170(_0x397708['result'][_0x7029('0x14')]);}})[_0x7029('0x15')](function(_0x1518f3){logger['error'](_0x7029('0xd'),_0x135dbc,_0x1518f3);_0x1566a7(_0x1518f3);});});}exports[_0x7029('0x16')]=function(_0x44d8a5){var _0x6b6565=this;return new Promise(function(_0x270582,_0x43348d){return db[_0x7029('0x17')]['create'](_0x44d8a5[_0x7029('0x18')],{'raw':_0x44d8a5[_0x7029('0x19')]?_0x44d8a5['options'][_0x7029('0x1a')]===undefined?!![]:![]:!![]})[_0x7029('0xb')](function(_0x2cd6da){logger['info'](_0x7029('0x16'),_0x44d8a5);logger[_0x7029('0xe')](_0x7029('0x16'),_0x44d8a5,JSON[_0x7029('0x11')](_0x2cd6da));_0x270582(_0x2cd6da);})[_0x7029('0x15')](function(_0x1060c8){logger[_0x7029('0x12')](_0x7029('0x16'),_0x1060c8['message'],_0x44d8a5);_0x43348d(_0x6b6565[_0x7029('0x12')](0x1f4,_0x1060c8[_0x7029('0x14')]));});});};exports[_0x7029('0x1b')]=function(_0x171556){var _0x192db5=this;return new Promise(function(_0x142f6c,_0x979ed6){return db[_0x7029('0x17')]['update'](_0x171556['body'],{'raw':_0x171556['options']?_0x171556['options'][_0x7029('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171556[_0x7029('0x19')]?_0x171556[_0x7029('0x19')][_0x7029('0x1c')]||null:null,'attributes':_0x171556['options']?_0x171556[_0x7029('0x19')][_0x7029('0x1d')]||null:null,'limit':_0x171556[_0x7029('0x19')]?_0x171556[_0x7029('0x19')][_0x7029('0x1e')]||null:null})[_0x7029('0xb')](function(_0x45b11f){logger['info'](_0x7029('0x1b'),_0x171556);logger[_0x7029('0xe')](_0x7029('0x1b'),_0x171556,JSON[_0x7029('0x11')](_0x45b11f));_0x142f6c(_0x45b11f);})[_0x7029('0x15')](function(_0x21263f){logger[_0x7029('0x12')]('UpdateWhatsappQueueReport',_0x21263f[_0x7029('0x14')],_0x171556);_0x979ed6(_0x192db5[_0x7029('0x12')](0x1f4,_0x21263f[_0x7029('0x14')]));});});}; \ No newline at end of file +var _0xf0ea=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','debug','update','where','limit','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf0ea,0x17f));var _0xaf0e=function(_0x533b43,_0x22a265){_0x533b43=_0x533b43-0x0;var _0x5deef4=_0xf0ea[_0x533b43];return _0x5deef4;};'use strict';var _=require(_0xaf0e('0x0'));var util=require(_0xaf0e('0x1'));var moment=require('moment');var BPromise=require(_0xaf0e('0x2'));var rs=require(_0xaf0e('0x3'));var fs=require('fs');var Redis=require(_0xaf0e('0x4'));var db=require(_0xaf0e('0x5'))['db'];var utils=require(_0xaf0e('0x6'));var logger=require(_0xaf0e('0x7'))('rpc');var config=require(_0xaf0e('0x8'));var jayson=require(_0xaf0e('0x9'));var client=jayson[_0xaf0e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x364f40,_0x5f1644,_0x37fbd3){return new BPromise(function(_0x243c9d,_0x4055d7){return client[_0xaf0e('0xb')](_0x364f40,_0x37fbd3)[_0xaf0e('0xc')](function(_0x4f3434){logger[_0xaf0e('0xd')](_0xaf0e('0xe'),_0x5f1644,_0xaf0e('0xf'));logger['debug'](_0xaf0e('0x10'),_0x5f1644,_0xaf0e('0xf'),JSON[_0xaf0e('0x11')](_0x4f3434));if(_0x4f3434[_0xaf0e('0x12')]){if(_0x4f3434[_0xaf0e('0x12')][_0xaf0e('0x13')]===0x1f4){logger[_0xaf0e('0x12')](_0xaf0e('0xe'),_0x5f1644,_0x4f3434[_0xaf0e('0x12')]['message']);return _0x4055d7(_0x4f3434[_0xaf0e('0x12')][_0xaf0e('0x14')]);}logger[_0xaf0e('0x12')](_0xaf0e('0xe'),_0x5f1644,_0x4f3434[_0xaf0e('0x12')][_0xaf0e('0x14')]);return _0x243c9d(_0x4f3434[_0xaf0e('0x12')][_0xaf0e('0x14')]);}else{logger[_0xaf0e('0xd')](_0xaf0e('0xe'),_0x5f1644,_0xaf0e('0xf'));_0x243c9d(_0x4f3434[_0xaf0e('0x15')][_0xaf0e('0x14')]);}})[_0xaf0e('0x16')](function(_0x48947f){logger['error'](_0xaf0e('0xe'),_0x5f1644,_0x48947f);_0x4055d7(_0x48947f);});});}exports['CreateWhatsappQueueReport']=function(_0x4b55cd){var _0x53adb3=this;return new Promise(function(_0x141cda,_0x39ac94){return db[_0xaf0e('0x17')]['create'](_0x4b55cd[_0xaf0e('0x18')],{'raw':_0x4b55cd[_0xaf0e('0x19')]?_0x4b55cd[_0xaf0e('0x19')][_0xaf0e('0x1a')]===undefined?!![]:![]:!![]})[_0xaf0e('0xc')](function(_0x2caf8d){logger[_0xaf0e('0xd')](_0xaf0e('0x1b'),_0x4b55cd);logger[_0xaf0e('0x1c')]('CreateWhatsappQueueReport',_0x4b55cd,JSON['stringify'](_0x2caf8d));_0x141cda(_0x2caf8d);})[_0xaf0e('0x16')](function(_0x5c7388){logger[_0xaf0e('0x12')](_0xaf0e('0x1b'),_0x5c7388[_0xaf0e('0x14')],_0x4b55cd);_0x39ac94(_0x53adb3[_0xaf0e('0x12')](0x1f4,_0x5c7388['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0xd14fce){var _0x5535c5=this;return new Promise(function(_0x4966de,_0x1323d2){return db[_0xaf0e('0x17')][_0xaf0e('0x1d')](_0xd14fce[_0xaf0e('0x18')],{'raw':_0xd14fce[_0xaf0e('0x19')]?_0xd14fce[_0xaf0e('0x19')][_0xaf0e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd14fce[_0xaf0e('0x19')]?_0xd14fce[_0xaf0e('0x19')][_0xaf0e('0x1e')]||null:null,'attributes':_0xd14fce[_0xaf0e('0x19')]?_0xd14fce[_0xaf0e('0x19')]['attributes']||null:null,'limit':_0xd14fce[_0xaf0e('0x19')]?_0xd14fce[_0xaf0e('0x19')][_0xaf0e('0x1f')]||null:null})[_0xaf0e('0xc')](function(_0x1ae0d6){logger[_0xaf0e('0xd')](_0xaf0e('0x20'),_0xd14fce);logger[_0xaf0e('0x1c')](_0xaf0e('0x20'),_0xd14fce,JSON['stringify'](_0x1ae0d6));_0x4966de(_0x1ae0d6);})[_0xaf0e('0x16')](function(_0x2a7fbb){logger[_0xaf0e('0x12')](_0xaf0e('0x20'),_0x2a7fbb[_0xaf0e('0x14')],_0xd14fce);_0x1323d2(_0x5535c5[_0xaf0e('0x12')](0x1f4,_0x2a7fbb[_0xaf0e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index c9bfdad..f8706ce 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7d2=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x53c113,_0x570ee7){var _0x280a8f=function(_0x1b12d7){while(--_0x1b12d7){_0x53c113['push'](_0x53c113['shift']());}};_0x280a8f(++_0x570ee7);}(_0xe7d2,0x13c));var _0x2e7d=function(_0xa07924,_0x57d0d1){_0xa07924=_0xa07924-0x0;var _0x3b2950=_0xe7d2[_0xa07924];return _0x3b2950;};'use strict';var multer=require(_0x2e7d('0x0'));var util=require(_0x2e7d('0x1'));var path=require(_0x2e7d('0x2'));var timeout=require(_0x2e7d('0x3'));var express=require(_0x2e7d('0x4'));var router=express[_0x2e7d('0x5')]();var auth=require(_0x2e7d('0x6'));var interaction=require(_0x2e7d('0x7'));var config=require(_0x2e7d('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x2e7d('0x9')]('/',auth[_0x2e7d('0xa')](),controller['index']);router[_0x2e7d('0x9')](_0x2e7d('0xb'),auth['isAuthenticated'](),controller[_0x2e7d('0xc')]);router['get'](_0x2e7d('0xd'),auth['isAuthenticated'](),controller[_0x2e7d('0xe')]);router[_0x2e7d('0xf')]('/',auth[_0x2e7d('0xa')](),controller['create']);router[_0x2e7d('0x10')](_0x2e7d('0xd'),auth[_0x2e7d('0xa')](),controller[_0x2e7d('0x11')]);router[_0x2e7d('0x12')](_0x2e7d('0xd'),auth[_0x2e7d('0xa')](),controller[_0x2e7d('0x13')]);module[_0x2e7d('0x14')]=router; \ No newline at end of file +var _0x27d7=['update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x27d7,0xa4));var _0x727d=function(_0x300c89,_0x25fcad){_0x300c89=_0x300c89-0x0;var _0x41762e=_0x27d7[_0x300c89];return _0x41762e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x727d('0x0'));var timeout=require(_0x727d('0x1'));var express=require('express');var router=express[_0x727d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x727d('0x3'));var config=require(_0x727d('0x4'));var controller=require(_0x727d('0x5'));router[_0x727d('0x6')]('/',auth['isAuthenticated'](),controller[_0x727d('0x7')]);router['get'](_0x727d('0x8'),auth[_0x727d('0x9')](),controller[_0x727d('0xa')]);router[_0x727d('0x6')](_0x727d('0xb'),auth[_0x727d('0x9')](),controller[_0x727d('0xc')]);router[_0x727d('0xd')]('/',auth[_0x727d('0x9')](),controller[_0x727d('0xe')]);router[_0x727d('0xf')](_0x727d('0xb'),auth[_0x727d('0x9')](),controller[_0x727d('0x10')]);router[_0x727d('0x11')](_0x727d('0xb'),auth[_0x727d('0x9')](),controller[_0x727d('0x12')]);module[_0x727d('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a302d4e..4830509 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x521e8d,_0x23a290){_0x521e8d=_0x521e8d-0x0;var _0x518bbd=_0x0b0e[_0x521e8d];return _0x518bbd;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file +var _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x398205,_0x4f2b46){var _0x3fe63b=function(_0x3d73cb){while(--_0x3d73cb){_0x398205['push'](_0x398205['shift']());}};_0x3fe63b(++_0x4f2b46);}(_0xb7e7,0x121));var _0x7b7e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb7e7[_0x68ee8b];return _0x5148f7;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c21fce8..be13298 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64e5=['../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2bcda3,_0x41d1ac){var _0x26a5ca=function(_0x43bf7f){while(--_0x43bf7f){_0x2bcda3['push'](_0x2bcda3['shift']());}};_0x26a5ca(++_0x41d1ac);}(_0x64e5,0x10a));var _0x564e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x64e5[_0x433a86];return _0x23000c;};'use strict';var pdf=require(_0x564e('0x0'));var emlformat=require(_0x564e('0x1'));var rimraf=require(_0x564e('0x2'));var zipdir=require(_0x564e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x564e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x564e('0x5'));var path=require(_0x564e('0x6'));var sox=require(_0x564e('0x7'));var csv=require(_0x564e('0x8'));var ejs=require(_0x564e('0x9'));var fs=require('fs');var _=require(_0x564e('0xa'));var squel=require(_0x564e('0xb'));var crypto=require('crypto');var jsforce=require(_0x564e('0xc'));var deskjs=require(_0x564e('0xd'));var toCsv=require(_0x564e('0x8'));var querystring=require(_0x564e('0xe'));var Papa=require(_0x564e('0xf'));var Redis=require(_0x564e('0x10'));var authService=require(_0x564e('0x11'));var qs=require(_0x564e('0x12'));var as=require(_0x564e('0x13'));var hardwareService=require(_0x564e('0x14'));var logger=require(_0x564e('0x15'))('api');var utils=require(_0x564e('0x16'));var config=require(_0x564e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2798ce,_0x31f153){_0x31f153=_0x31f153||0xcc;return function(_0x198421){if(_0x198421){return _0x2798ce[_0x564e('0x18')](_0x31f153);}return _0x2798ce[_0x564e('0x19')](_0x31f153)[_0x564e('0x1a')]();};}function respondWithResult(_0x1a5576,_0x55eeec){_0x55eeec=_0x55eeec||0xc8;return function(_0x590c23){if(_0x590c23){return _0x1a5576[_0x564e('0x19')](_0x55eeec)[_0x564e('0x1b')](_0x590c23);}};}function respondWithFilteredResult(_0x420ae6,_0x219a6f){return function(_0x305c25){if(_0x305c25){var _0x5bd337=_0x305c25[_0x564e('0x1c')],_0x144793=_0x219a6f[_0x564e('0x1d')],_0x31fe4c=_0x219a6f[_0x564e('0x1d')]+_0x219a6f[_0x564e('0x1e')],_0x20aacf;if(_0x31fe4c>=_0x5bd337){_0x31fe4c=_0x5bd337;_0x20aacf=0xc8;}else{_0x20aacf=0xce;}_0x420ae6[_0x564e('0x19')](_0x20aacf);return _0x420ae6['set'](_0x564e('0x1f'),_0x144793+'-'+_0x31fe4c+'/'+_0x5bd337)[_0x564e('0x1b')](_0x305c25);}return null;};}function patchUpdates(_0x2d68af){return function(_0x504940){try{jsonpatch[_0x564e('0x20')](_0x504940,_0x2d68af,!![]);}catch(_0x527112){return BPromise[_0x564e('0x21')](_0x527112);}return _0x504940[_0x564e('0x22')]();};}function saveUpdates(_0x33e75c,_0x447460){return function(_0x9d07a0){if(_0x9d07a0){return _0x9d07a0[_0x564e('0x23')](_0x33e75c)[_0x564e('0x24')](function(_0x23608e){return _0x23608e;});}return null;};}function removeEntity(_0x48d7f3,_0x33dfaf){return function(_0x513e2d){if(_0x513e2d){return _0x513e2d[_0x564e('0x25')]()['then'](function(){_0x48d7f3[_0x564e('0x19')](0xcc)[_0x564e('0x1a')]();});}};}function handleEntityNotFound(_0x333881,_0x57f498){return function(_0x40a5d9){if(!_0x40a5d9){_0x333881[_0x564e('0x18')](0x194);}return _0x40a5d9;};}function handleError(_0x45d0c9,_0x1ea48){_0x1ea48=_0x1ea48||0x1f4;return function(_0x2ecff3){logger[_0x564e('0x26')](_0x2ecff3['stack']);if(_0x2ecff3[_0x564e('0x27')]){delete _0x2ecff3['name'];}_0x45d0c9[_0x564e('0x19')](_0x1ea48)[_0x564e('0x28')](_0x2ecff3);};}exports[_0x564e('0x29')]=function(_0x50a570,_0x3c427b){var _0x3338e5={},_0xd8e20f={},_0x34f659={'count':0x0,'rows':[]};var _0x577654=_[_0x564e('0x2a')](db[_0x564e('0x2b')]['rawAttributes'],function(_0x17087e){return{'name':_0x17087e[_0x564e('0x2c')],'type':_0x17087e[_0x564e('0x2d')][_0x564e('0x2e')]};});_0xd8e20f[_0x564e('0x2f')]=_['map'](_0x577654,_0x564e('0x27'));_0xd8e20f['query']=_[_0x564e('0x30')](_0x50a570[_0x564e('0x31')]);_0xd8e20f[_0x564e('0x32')]=_[_0x564e('0x33')](_0xd8e20f[_0x564e('0x2f')],_0xd8e20f[_0x564e('0x31')]);_0x3338e5[_0x564e('0x34')]=_[_0x564e('0x33')](_0xd8e20f[_0x564e('0x2f')],qs['fields'](_0x50a570[_0x564e('0x31')][_0x564e('0x35')]));_0x3338e5[_0x564e('0x34')]=_0x3338e5[_0x564e('0x34')]['length']?_0x3338e5[_0x564e('0x34')]:_0xd8e20f[_0x564e('0x2f')];if(!_0x50a570[_0x564e('0x31')][_0x564e('0x36')](_0x564e('0x37'))){_0x3338e5[_0x564e('0x1e')]=qs[_0x564e('0x1e')](_0x50a570['query'][_0x564e('0x1e')]);_0x3338e5['offset']=qs[_0x564e('0x1d')](_0x50a570[_0x564e('0x31')][_0x564e('0x1d')]);}_0x3338e5['order']=qs[_0x564e('0x38')](_0x50a570[_0x564e('0x31')][_0x564e('0x38')]);_0x3338e5[_0x564e('0x39')]=qs[_0x564e('0x32')](_[_0x564e('0x3a')](_0x50a570[_0x564e('0x31')],_0xd8e20f[_0x564e('0x32')]),_0x577654);if(_0x50a570[_0x564e('0x31')][_0x564e('0x3b')]){_0x3338e5['where']=_[_0x564e('0x3c')](_0x3338e5[_0x564e('0x39')],{'$or':_[_0x564e('0x2a')](_0x577654,function(_0x1c4c04){if(_0x1c4c04[_0x564e('0x2d')]!=='VIRTUAL'){var _0x42ff2a={};_0x42ff2a[_0x1c4c04['name']]={'$like':'%'+_0x50a570['query'][_0x564e('0x3b')]+'%'};return _0x42ff2a;}})});}_0x3338e5=_[_0x564e('0x3c')]({},_0x3338e5,_0x50a570['options']);var _0x7f79da={'where':_0x3338e5[_0x564e('0x39')]};return db['WhatsappTransferReport']['count'](_0x7f79da)['then'](function(_0x2047e3){_0x34f659['count']=_0x2047e3;if(_0x50a570[_0x564e('0x31')]['includeAll']){_0x3338e5[_0x564e('0x3d')]=[{'all':!![]}];}return db[_0x564e('0x2b')][_0x564e('0x3e')](_0x3338e5);})[_0x564e('0x24')](function(_0x3eb6ff){_0x34f659[_0x564e('0x3f')]=_0x3eb6ff;return _0x34f659;})[_0x564e('0x24')](respondWithFilteredResult(_0x3c427b,_0x3338e5))[_0x564e('0x40')](handleError(_0x3c427b,null));};exports['show']=function(_0xe6e7f1,_0x570537){var _0x181ba5={'raw':!![],'where':{'id':_0xe6e7f1[_0x564e('0x41')]['id']}},_0x75309b={};_0x75309b[_0x564e('0x2f')]=_[_0x564e('0x30')](db['WhatsappTransferReport'][_0x564e('0x42')]);_0x75309b[_0x564e('0x31')]=_[_0x564e('0x30')](_0xe6e7f1[_0x564e('0x31')]);_0x75309b[_0x564e('0x32')]=_[_0x564e('0x33')](_0x75309b['model'],_0x75309b[_0x564e('0x31')]);_0x181ba5[_0x564e('0x34')]=_[_0x564e('0x33')](_0x75309b['model'],qs[_0x564e('0x35')](_0xe6e7f1[_0x564e('0x31')][_0x564e('0x35')]));_0x181ba5[_0x564e('0x34')]=_0x181ba5[_0x564e('0x34')][_0x564e('0x43')]?_0x181ba5[_0x564e('0x34')]:_0x75309b['model'];if(_0xe6e7f1[_0x564e('0x31')]['includeAll']){_0x181ba5[_0x564e('0x3d')]=[{'all':!![]}];}_0x181ba5=_[_0x564e('0x3c')]({},_0x181ba5,_0xe6e7f1[_0x564e('0x44')]);return db['WhatsappTransferReport'][_0x564e('0x45')](_0x181ba5)[_0x564e('0x24')](handleEntityNotFound(_0x570537,null))[_0x564e('0x24')](respondWithResult(_0x570537,null))[_0x564e('0x40')](handleError(_0x570537,null));};exports[_0x564e('0x46')]=function(_0x58aa99,_0x2b6378){return db[_0x564e('0x2b')][_0x564e('0x46')](_0x58aa99['body'],{})[_0x564e('0x24')](respondWithResult(_0x2b6378,0xc9))[_0x564e('0x40')](handleError(_0x2b6378,null));};exports['update']=function(_0x10d12c,_0x1b9c6){if(_0x10d12c[_0x564e('0x47')]['id']){delete _0x10d12c[_0x564e('0x47')]['id'];}return db[_0x564e('0x2b')][_0x564e('0x45')]({'where':{'id':_0x10d12c[_0x564e('0x41')]['id']}})[_0x564e('0x24')](handleEntityNotFound(_0x1b9c6,null))[_0x564e('0x24')](saveUpdates(_0x10d12c[_0x564e('0x47')],null))[_0x564e('0x24')](respondWithResult(_0x1b9c6,null))[_0x564e('0x40')](handleError(_0x1b9c6,null));};exports[_0x564e('0x25')]=function(_0x27859e,_0x3419e2){return db[_0x564e('0x2b')][_0x564e('0x45')]({'where':{'id':_0x27859e[_0x564e('0x41')]['id']}})[_0x564e('0x24')](handleEntityNotFound(_0x3419e2,null))[_0x564e('0x24')](removeEntity(_0x3419e2,null))[_0x564e('0x40')](handleError(_0x3419e2,null));};exports['describe']=function(_0x298432,_0x4a043c){return db[_0x564e('0x2b')]['describe']()[_0x564e('0x24')](respondWithResult(_0x4a043c,null))[_0x564e('0x40')](handleError(_0x4a043c,null));}; \ No newline at end of file +var _0xcef6=['findAll','show','params','keys','rawAttributes','includeAll','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','count','offset','set','json','reject','save','update','then','error','name','send','map','WhatsappTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x344148,_0x4fb237){var _0x13b553=function(_0x371f4c){while(--_0x371f4c){_0x344148['push'](_0x344148['shift']());}};_0x13b553(++_0x4fb237);}(_0xcef6,0x16e));var _0x6cef=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0xcef6[_0x2053ea];return _0x2232c4;};'use strict';var pdf=require(_0x6cef('0x0'));var emlformat=require(_0x6cef('0x1'));var rimraf=require(_0x6cef('0x2'));var zipdir=require(_0x6cef('0x3'));var jsonpatch=require(_0x6cef('0x4'));var rp=require(_0x6cef('0x5'));var moment=require(_0x6cef('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cef('0x7'));var path=require(_0x6cef('0x8'));var sox=require(_0x6cef('0x9'));var csv=require(_0x6cef('0xa'));var ejs=require(_0x6cef('0xb'));var fs=require('fs');var _=require(_0x6cef('0xc'));var squel=require(_0x6cef('0xd'));var crypto=require(_0x6cef('0xe'));var jsforce=require(_0x6cef('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6cef('0xa'));var querystring=require(_0x6cef('0x10'));var Papa=require('papaparse');var Redis=require(_0x6cef('0x11'));var authService=require(_0x6cef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6cef('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6cef('0x14'));var utils=require('../../config/utils');var config=require(_0x6cef('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x587586,_0x4a9666){_0x4a9666=_0x4a9666||0xcc;return function(_0x2b6268){if(_0x2b6268){return _0x587586[_0x6cef('0x16')](_0x4a9666);}return _0x587586[_0x6cef('0x17')](_0x4a9666)[_0x6cef('0x18')]();};}function respondWithResult(_0x669ffa,_0x4b7623){_0x4b7623=_0x4b7623||0xc8;return function(_0x2c7195){if(_0x2c7195){return _0x669ffa['status'](_0x4b7623)['json'](_0x2c7195);}};}function respondWithFilteredResult(_0x3a93fe,_0x592641){return function(_0x4dbd80){if(_0x4dbd80){var _0x1483bd=_0x4dbd80[_0x6cef('0x19')],_0x5a2d4c=_0x592641[_0x6cef('0x1a')],_0x41056f=_0x592641['offset']+_0x592641['limit'],_0x8c7ce6;if(_0x41056f>=_0x1483bd){_0x41056f=_0x1483bd;_0x8c7ce6=0xc8;}else{_0x8c7ce6=0xce;}_0x3a93fe['status'](_0x8c7ce6);return _0x3a93fe[_0x6cef('0x1b')]('Content-Range',_0x5a2d4c+'-'+_0x41056f+'/'+_0x1483bd)[_0x6cef('0x1c')](_0x4dbd80);}return null;};}function patchUpdates(_0x2793b6){return function(_0x506ff2){try{jsonpatch['apply'](_0x506ff2,_0x2793b6,!![]);}catch(_0x12fe9d){return BPromise[_0x6cef('0x1d')](_0x12fe9d);}return _0x506ff2[_0x6cef('0x1e')]();};}function saveUpdates(_0x936773,_0x31932d){return function(_0x385431){if(_0x385431){return _0x385431[_0x6cef('0x1f')](_0x936773)[_0x6cef('0x20')](function(_0x1abe66){return _0x1abe66;});}return null;};}function removeEntity(_0x104f76,_0x155412){return function(_0x13fed5){if(_0x13fed5){return _0x13fed5['destroy']()[_0x6cef('0x20')](function(){_0x104f76['status'](0xcc)[_0x6cef('0x18')]();});}};}function handleEntityNotFound(_0x201607,_0x32db43){return function(_0x2220bc){if(!_0x2220bc){_0x201607[_0x6cef('0x16')](0x194);}return _0x2220bc;};}function handleError(_0x1cc8fa,_0x456acc){_0x456acc=_0x456acc||0x1f4;return function(_0x3f0406){logger[_0x6cef('0x21')](_0x3f0406['stack']);if(_0x3f0406[_0x6cef('0x22')]){delete _0x3f0406[_0x6cef('0x22')];}_0x1cc8fa['status'](_0x456acc)[_0x6cef('0x23')](_0x3f0406);};}exports['index']=function(_0x3f15d6,_0x3c81f3){var _0x42967f={},_0x466e9c={},_0x527267={'count':0x0,'rows':[]};var _0x407869=_[_0x6cef('0x24')](db[_0x6cef('0x25')]['rawAttributes'],function(_0x50027c){return{'name':_0x50027c[_0x6cef('0x26')],'type':_0x50027c[_0x6cef('0x27')][_0x6cef('0x28')]};});_0x466e9c[_0x6cef('0x29')]=_[_0x6cef('0x24')](_0x407869,'name');_0x466e9c[_0x6cef('0x2a')]=_['keys'](_0x3f15d6[_0x6cef('0x2a')]);_0x466e9c[_0x6cef('0x2b')]=_[_0x6cef('0x2c')](_0x466e9c[_0x6cef('0x29')],_0x466e9c['query']);_0x42967f[_0x6cef('0x2d')]=_[_0x6cef('0x2c')](_0x466e9c[_0x6cef('0x29')],qs['fields'](_0x3f15d6[_0x6cef('0x2a')][_0x6cef('0x2e')]));_0x42967f[_0x6cef('0x2d')]=_0x42967f[_0x6cef('0x2d')][_0x6cef('0x2f')]?_0x42967f[_0x6cef('0x2d')]:_0x466e9c['model'];if(!_0x3f15d6[_0x6cef('0x2a')][_0x6cef('0x30')](_0x6cef('0x31'))){_0x42967f[_0x6cef('0x32')]=qs[_0x6cef('0x32')](_0x3f15d6['query'][_0x6cef('0x32')]);_0x42967f['offset']=qs['offset'](_0x3f15d6[_0x6cef('0x2a')]['offset']);}_0x42967f[_0x6cef('0x33')]=qs[_0x6cef('0x34')](_0x3f15d6[_0x6cef('0x2a')][_0x6cef('0x34')]);_0x42967f[_0x6cef('0x35')]=qs[_0x6cef('0x2b')](_[_0x6cef('0x36')](_0x3f15d6[_0x6cef('0x2a')],_0x466e9c['filters']),_0x407869);if(_0x3f15d6[_0x6cef('0x2a')][_0x6cef('0x37')]){_0x42967f['where']=_[_0x6cef('0x38')](_0x42967f[_0x6cef('0x35')],{'$or':_[_0x6cef('0x24')](_0x407869,function(_0x51f450){if(_0x51f450[_0x6cef('0x27')]!==_0x6cef('0x39')){var _0x5769d3={};_0x5769d3[_0x51f450[_0x6cef('0x22')]]={'$like':'%'+_0x3f15d6[_0x6cef('0x2a')]['filter']+'%'};return _0x5769d3;}})});}_0x42967f=_['merge']({},_0x42967f,_0x3f15d6[_0x6cef('0x3a')]);var _0x576627={'where':_0x42967f['where']};return db[_0x6cef('0x25')]['count'](_0x576627)[_0x6cef('0x20')](function(_0x1cdb1f){_0x527267[_0x6cef('0x19')]=_0x1cdb1f;if(_0x3f15d6[_0x6cef('0x2a')]['includeAll']){_0x42967f[_0x6cef('0x3b')]=[{'all':!![]}];}return db[_0x6cef('0x25')][_0x6cef('0x3c')](_0x42967f);})[_0x6cef('0x20')](function(_0x1c4a3a){_0x527267['rows']=_0x1c4a3a;return _0x527267;})['then'](respondWithFilteredResult(_0x3c81f3,_0x42967f))['catch'](handleError(_0x3c81f3,null));};exports[_0x6cef('0x3d')]=function(_0x265d2e,_0x5a820a){var _0x37577a={'raw':!![],'where':{'id':_0x265d2e[_0x6cef('0x3e')]['id']}},_0x38890c={};_0x38890c[_0x6cef('0x29')]=_[_0x6cef('0x3f')](db[_0x6cef('0x25')][_0x6cef('0x40')]);_0x38890c['query']=_[_0x6cef('0x3f')](_0x265d2e[_0x6cef('0x2a')]);_0x38890c[_0x6cef('0x2b')]=_[_0x6cef('0x2c')](_0x38890c[_0x6cef('0x29')],_0x38890c[_0x6cef('0x2a')]);_0x37577a[_0x6cef('0x2d')]=_[_0x6cef('0x2c')](_0x38890c[_0x6cef('0x29')],qs['fields'](_0x265d2e[_0x6cef('0x2a')]['fields']));_0x37577a['attributes']=_0x37577a['attributes'][_0x6cef('0x2f')]?_0x37577a['attributes']:_0x38890c[_0x6cef('0x29')];if(_0x265d2e[_0x6cef('0x2a')][_0x6cef('0x41')]){_0x37577a['include']=[{'all':!![]}];}_0x37577a=_[_0x6cef('0x38')]({},_0x37577a,_0x265d2e[_0x6cef('0x3a')]);return db[_0x6cef('0x25')][_0x6cef('0x42')](_0x37577a)['then'](handleEntityNotFound(_0x5a820a,null))['then'](respondWithResult(_0x5a820a,null))[_0x6cef('0x43')](handleError(_0x5a820a,null));};exports[_0x6cef('0x44')]=function(_0x4e5553,_0x14f74a){return db['WhatsappTransferReport'][_0x6cef('0x44')](_0x4e5553[_0x6cef('0x45')],{})[_0x6cef('0x20')](respondWithResult(_0x14f74a,0xc9))[_0x6cef('0x43')](handleError(_0x14f74a,null));};exports[_0x6cef('0x1f')]=function(_0xb9d31c,_0x369d57){if(_0xb9d31c[_0x6cef('0x45')]['id']){delete _0xb9d31c[_0x6cef('0x45')]['id'];}return db['WhatsappTransferReport'][_0x6cef('0x42')]({'where':{'id':_0xb9d31c['params']['id']}})['then'](handleEntityNotFound(_0x369d57,null))[_0x6cef('0x20')](saveUpdates(_0xb9d31c['body'],null))['then'](respondWithResult(_0x369d57,null))[_0x6cef('0x43')](handleError(_0x369d57,null));};exports['destroy']=function(_0x24c224,_0x5dece6){return db[_0x6cef('0x25')]['find']({'where':{'id':_0x24c224[_0x6cef('0x3e')]['id']}})[_0x6cef('0x20')](handleEntityNotFound(_0x5dece6,null))[_0x6cef('0x20')](removeEntity(_0x5dece6,null))[_0x6cef('0x43')](handleError(_0x5dece6,null));};exports['describe']=function(_0x52d89a,_0x2a7144){return db[_0x6cef('0x25')][_0x6cef('0x46')]()[_0x6cef('0x20')](respondWithResult(_0x2a7144,null))[_0x6cef('0x43')](handleError(_0x2a7144,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e74b743..25ab27a 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5c3=['uniqueid','util','api','moment','bluebird','path','rimraf','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x3078ef,_0x4454d6){var _0x25b98a=function(_0x152b9b){while(--_0x152b9b){_0x3078ef['push'](_0x3078ef['shift']());}};_0x25b98a(++_0x4454d6);}(_0xf5c3,0x7a));var _0x3f5c=function(_0x363d74,_0x58f003){_0x363d74=_0x363d74-0x0;var _0x1c8266=_0xf5c3[_0x363d74];return _0x1c8266;};'use strict';var _=require('lodash');var util=require(_0x3f5c('0x0'));var logger=require('../../config/logger')(_0x3f5c('0x1'));var moment=require(_0x3f5c('0x2'));var BPromise=require(_0x3f5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f5c('0x4'));var rimraf=require(_0x3f5c('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x3f5c('0x6')]=function(_0x3be2bc,_0x55e114){return _0x3be2bc[_0x3f5c('0x7')](_0x3f5c('0x8'),attributes,{'tableName':_0x3f5c('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3f5c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5db7=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1ccafc,_0x131971){var _0x35e4dc=function(_0x594e60){while(--_0x594e60){_0x1ccafc['push'](_0x1ccafc['shift']());}};_0x35e4dc(++_0x131971);}(_0x5db7,0xc8));var _0x75db=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x5db7[_0x558e45];return _0x3e9075;};'use strict';var _=require(_0x75db('0x0'));var util=require('util');var logger=require(_0x75db('0x1'))(_0x75db('0x2'));var moment=require(_0x75db('0x3'));var BPromise=require('bluebird');var rp=require(_0x75db('0x4'));var fs=require('fs');var path=require(_0x75db('0x5'));var rimraf=require(_0x75db('0x6'));var config=require(_0x75db('0x7'));var attributes=require(_0x75db('0x8'));module[_0x75db('0x9')]=function(_0x4d608b,_0x9fc980){return _0x4d608b['define'](_0x75db('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x75db('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f442cda..00a63df 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f8edd,_0x61a30e){var _0x414dac=function(_0x5ee281){while(--_0x5ee281){_0x2f8edd['push'](_0x2f8edd['shift']());}};_0x414dac(++_0x61a30e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x145747,_0x501280){var _0x512565=function(_0x1e4d66){while(--_0x1e4d66){_0x145747['push'](_0x145747['shift']());}};_0x512565(++_0x501280);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3e34094..6589892 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81b7=['catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','info','start','map','filter','online','name','join','Offline\x20apps:','None','seedDB','default'];(function(_0xb6d9de,_0x1119ff){var _0x43ca50=function(_0x39dc69){while(--_0x39dc69){_0xb6d9de['push'](_0xb6d9de['shift']());}};_0x43ca50(++_0x1119ff);}(_0x81b7,0x1f2));var _0x781b=function(_0x13a08a,_0x52da1c){_0x13a08a=_0x13a08a-0x0;var _0x152014=_0x81b7[_0x13a08a];return _0x152014;};'use strict';var _=require('lodash');var mysqldb=require(_0x781b('0x0'));var rpc=require(_0x781b('0x1'));var config=require(_0x781b('0x2'));var logger=require(_0x781b('0x3'))('app');var pm2=require(_0x781b('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x781b('0x5'));var chat=require(_0x781b('0x6'));var whatsapp=require(_0x781b('0x7'));var transcribe=require(_0x781b('0x8'));function main(){return mysqldb['db']['sequelize'][_0x781b('0x9')]()[_0x781b('0xa')](function(){return rpc['listen']();})['then'](function(_0x3de3cd){logger[_0x781b('0xb')](_0x3de3cd);return chat[_0x781b('0xc')]();})[_0x781b('0xa')](function(){return whatsapp['start']();})[_0x781b('0xa')](function(){return schedule[_0x781b('0xc')]();})['then'](function(){return transcribe['start']();})[_0x781b('0xa')](function(_0x4f3356){logger[_0x781b('0xb')](_0x4f3356);return pm2['start'](pm2Config);})[_0x781b('0xa')](function(_0x4bf871){logger[_0x781b('0xb')]('Online\x20apps:',_[_0x781b('0xd')](_[_0x781b('0xe')](_0x4bf871,{'status':_0x781b('0xf')}),_0x781b('0x10'))[_0x781b('0x11')]());logger['info'](_0x781b('0x12'),_[_0x781b('0xd')](_[_0x781b('0xe')](_0x4bf871,function(_0x2315df){return _0x2315df['status']!==_0x781b('0xf');}),'name')[_0x781b('0x11')]()||_0x781b('0x13'));config[_0x781b('0x14')]&&require('./config/seedDB')[_0x781b('0x15')]();require('./config/license')['default']();})[_0x781b('0x16')](function(_0x177e18){logger[_0x781b('0x17')](_0x781b('0x18'),_0x177e18);process[_0x781b('0x19')](0x1);});}main(); \ No newline at end of file +var _0xb89c=['info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sync','then','listen'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xb89c,0x198));var _0xcb89=function(_0xe76753,_0x4f4192){_0xe76753=_0xe76753-0x0;var _0x596382=_0xb89c[_0xe76753];return _0x596382;};'use strict';var _=require(_0xcb89('0x0'));var mysqldb=require(_0xcb89('0x1'));var rpc=require(_0xcb89('0x2'));var config=require(_0xcb89('0x3'));var logger=require('./config/logger')(_0xcb89('0x4'));var pm2=require(_0xcb89('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xcb89('0x6'));var chat=require(_0xcb89('0x7'));var whatsapp=require(_0xcb89('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0xcb89('0x9')]()[_0xcb89('0xa')](function(){return rpc[_0xcb89('0xb')]();})['then'](function(_0xc7804d){logger[_0xcb89('0xc')](_0xc7804d);return chat['start']();})['then'](function(){return whatsapp[_0xcb89('0xd')]();})['then'](function(){return schedule[_0xcb89('0xd')]();})[_0xcb89('0xa')](function(){return transcribe[_0xcb89('0xd')]();})[_0xcb89('0xa')](function(_0x385353){logger[_0xcb89('0xc')](_0x385353);return pm2['start'](pm2Config);})[_0xcb89('0xa')](function(_0x5b1cdd){logger[_0xcb89('0xc')](_0xcb89('0xe'),_[_0xcb89('0xf')](_[_0xcb89('0x10')](_0x5b1cdd,{'status':_0xcb89('0x11')}),_0xcb89('0x12'))[_0xcb89('0x13')]());logger['info'](_0xcb89('0x14'),_[_0xcb89('0xf')](_['filter'](_0x5b1cdd,function(_0x335236){return _0x335236[_0xcb89('0x15')]!==_0xcb89('0x11');}),'name')[_0xcb89('0x13')]()||'None');config['seedDB']&&require(_0xcb89('0x16'))[_0xcb89('0x17')]();require(_0xcb89('0x18'))[_0xcb89('0x17')]();})[_0xcb89('0x19')](function(_0x37aece){logger[_0xcb89('0x1a')](_0xcb89('0x1b'),_0x37aece);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 16acd3f..c7c3910 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffae=['phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','use','ChatInteraction','params','then','closed','status','json','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','authenticate','pass','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','validatePasswordPattern','test','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','length','splice','unshift','encryptString','secret','payload','options','promisify','verify','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','smsPause','pauseType','lastLoginAt','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xffae,0x13a));var _0xeffa=function(_0x2651a3,_0x5a9320){_0x2651a3=_0x2651a3-0x0;var _0x4deb00=_0xffae[_0x2651a3];return _0x4deb00;};'use strict';var db=require(_0xeffa('0x0'))['db'];var config=require(_0xeffa('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xeffa('0x2'));var encryptor=require(_0xeffa('0x3'));var _=require(_0xeffa('0x4'));var jwt=require(_0xeffa('0x5'));var expressJwt=require('express-jwt');var compose=require(_0xeffa('0x6'));var basicAuth=require(_0xeffa('0x7'));var crypto=require(_0xeffa('0x8'));var BPromise=require(_0xeffa('0x9'));var util=require(_0xeffa('0xa'));var moment=require(_0xeffa('0xb'));var validateJwt=expressJwt({'secret':config[_0xeffa('0xc')]['session']});var userAttributes=['id',_0xeffa('0xd'),_0xeffa('0xe'),_0xeffa('0xf'),_0xeffa('0x10'),_0xeffa('0x11'),_0xeffa('0x12'),_0xeffa('0x13'),_0xeffa('0x14'),'voicePause',_0xeffa('0x15'),_0xeffa('0x16'),'faxPause',_0xeffa('0x17'),'openchannelPause',_0xeffa('0x18'),'showWebBar',_0xeffa('0x19'),_0xeffa('0x1a'),'crudPermissions','allowmessenger',_0xeffa('0x1b'),_0xeffa('0x1c'),'phoneBarAutoAnswer',_0xeffa('0x1d'),_0xeffa('0x1e'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xeffa('0x1f'),'phoneBarExpires','phoneBarPrefixRequired',_0xeffa('0x20'),_0xeffa('0x21'),'hotdesk',_0xeffa('0x22'),_0xeffa('0x23'),_0xeffa('0x24')];exports[_0xeffa('0x25')]=function(){return this['isAuthenticated'](!![])[_0xeffa('0x26')](function(_0xfbfaa,_0x326a44,_0x3d8b9c){if(_0xfbfaa['user']){_0x3d8b9c();}else{return db[_0xeffa('0x27')]['findOne']({'where':{'id':_0xfbfaa[_0xeffa('0x28')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xeffa('0x29')](function(_0x59a3f4){if(_0x59a3f4&&_0x59a3f4[_0xeffa('0x2a')]){return _0x326a44[_0xeffa('0x2b')](_0x59a3f4['disposition']==='unmanaged'?0x195:0x193)[_0xeffa('0x2c')]({'message':_0x59a3f4[_0xeffa('0x2d')]===_0xeffa('0x2e')?_0xeffa('0x2f'):_0xeffa('0x30')});}else{_0x3d8b9c();}})[_0xeffa('0x31')](function(_0x8cd0eb){_0x3d8b9c(_0x8cd0eb);});}});};exports['isAuthenticated']=function isAuthenticated(_0x1602f8){return compose()[_0xeffa('0x26')](function(_0x2cd421,_0x4229cd,_0x391587){var _0xb733c8;if(_0x2cd421[_0xeffa('0x32')][_0xeffa('0x33')]){if(_[_0xeffa('0x34')](_0x2cd421[_0xeffa('0x32')][_0xeffa('0x33')],'Basic')){var _0x2e72fd=basicAuth(_0x2cd421);db['User']['find']({'where':{'name':_0x2e72fd[_0xeffa('0xf')]}})['then'](function(_0x3a1c55){if(!_0x3a1c55||!_0x3a1c55[_0xeffa('0x35')](_0x2e72fd[_0xeffa('0x36')])){return _0x4229cd[_0xeffa('0x2b')](0x191)[_0xeffa('0x2c')]({'message':_0xeffa('0x37')});}_0x2cd421[_0xeffa('0x38')]={'id':_0x3a1c55['id']};_0x391587();})[_0xeffa('0x31')](function(_0x2e99c6){_0x391587(_0x2e99c6);});}else if(_[_0xeffa('0x34')](_0x2cd421[_0xeffa('0x32')][_0xeffa('0x33')],_0xeffa('0x39'))){validateJwt(_0x2cd421,_0x4229cd,_0x391587);}else{if(_0x1602f8){_0x391587();}else{return _0x4229cd['status'](0x193)[_0xeffa('0x2c')]({'message':_0xeffa('0x3a')});}}}else if(_0x2cd421[_0xeffa('0x3b')][_0xeffa('0x3c')]){try{var _0x232d24={'audience':hardwareConf[_0xeffa('0x3d')](),'issuer':hardwareConf[_0xeffa('0x3d')]()};verifyJwt(_0x2cd421[_0xeffa('0x3b')][_0xeffa('0x3c')],_0x232d24)[_0xeffa('0x29')](function(_0x286413){return db[_0xeffa('0x3e')][_0xeffa('0x3f')]({'where':{'id':_0x286413[_0xeffa('0x40')]}})['then'](function(_0x2aff81){_0xb733c8=_0x2aff81;return db[_0xeffa('0x41')][_0xeffa('0x42')]({'where':{'id':0x1},'attributes':[_0xeffa('0x43'),_0xeffa('0x44')],'raw':!![]});})['then'](function(_0x4818f3){if(!_0xb733c8||!_[_0xeffa('0x45')](_0xb733c8[_0xeffa('0x46')],_0x286413[_0xeffa('0x47')])){return _0x4229cd[_0xeffa('0x2b')](0x191)[_0xeffa('0x2c')]({'message':_0xeffa('0x48')});}if(_0xb733c8[_0xeffa('0x49')]){return _0x4229cd['status'](0x191)[_0xeffa('0x2c')]({'message':_0xeffa('0x4a')});}if(_0xb733c8['blocked']){if(_0x4818f3[_0xeffa('0x44')]>0x0){if(moment(_0xb733c8[_0xeffa('0x4b')])[_0xeffa('0x4c')](_0x4818f3[_0xeffa('0x44')],_0xeffa('0x4d'))>moment()){return _0x4229cd[_0xeffa('0x2b')](0x191)[_0xeffa('0x2c')]({'message':_0xeffa('0x4a')});}}else{return _0x4229cd[_0xeffa('0x2b')](0x191)['json']({'message':_0xeffa('0x4a')});}}_0x2cd421['user']={'id':_0xb733c8['id']};_0x391587();});})[_0xeffa('0x31')](function(){return _0x4229cd[_0xeffa('0x2b')](0x191)[_0xeffa('0x2c')]({'message':_0xeffa('0x4a')});});}catch(_0x128adc){_0x391587(_0x128adc);}}else if(_0x1602f8){_0x391587();}else{return _0x4229cd[_0xeffa('0x2b')](0x193)[_0xeffa('0x2c')]({'message':_0xeffa('0x3a')});}})[_0xeffa('0x26')](function(_0x5019f5,_0x32d8c9,_0xbfc7a1){if(_0x5019f5[_0xeffa('0x38')]){db[_0xeffa('0x3e')][_0xeffa('0x3f')]({'where':{'id':_0x5019f5['user']['id']},'attributes':userAttributes})['then'](function(_0x184105){if(!_0x184105){return _0x32d8c9['status'](0x194)[_0xeffa('0x2c')]({'message':'User\x20not\x20found.'});}_0x5019f5['user']=_0x184105;_0xbfc7a1();})[_0xeffa('0x31')](function(_0xd1100b){_0xbfc7a1(_0xd1100b);});}else if(_0x1602f8){_0xbfc7a1();}else{return _0x32d8c9[_0xeffa('0x2b')](0x194)['json']({'message':_0xeffa('0x4e')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xeffa('0x26')](function(_0x44c4b5,_0x568178,_0x3e9602){return licenseUtil[_0xeffa('0x4f')]()[_0xeffa('0x29')](function(_0x4ca699){if(_0x4ca699[_0xeffa('0x50')]){_0x3e9602();}else{return _0x568178['status'](0x193)[_0xeffa('0x2c')]({'message':_0xeffa('0x51')});}})[_0xeffa('0x31')](function(_0xd11b55){_0x3e9602(_0xd11b55);});});};exports['isMiddleware']=function(_0x46f318,_0x3c0f54,_0x4e2d22){_0x46f318[_0xeffa('0x52')]=!![];return _0x4e2d22();};exports[_0xeffa('0x53')]=function signToken(_0xb72dc5){return signJwt(_0xb72dc5);};exports[_0xeffa('0x54')]=function(_0x2e438d,_0x279046){if(!_0x2e438d[_0xeffa('0x38')]){return _0x279046[_0xeffa('0x2b')](0x194)['json']({'message':_0xeffa('0x55')});}var _0x2893e2={'payload':{'id':_0x2e438d[_0xeffa('0x38')]['id'],'role':_0x2e438d[_0xeffa('0x38')][_0xeffa('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2893e2)[_0xeffa('0x29')](function(_0x57d53d){_0x279046[_0xeffa('0x56')](_0xeffa('0x57'),_0x57d53d);_0x279046[_0xeffa('0x58')]('/dashboards/general');})[_0xeffa('0x31')](function(_0x137284){return _0x279046[_0xeffa('0x2b')](0x1f4)[_0xeffa('0x59')](_0x137284);});};exports['retrieveApiKey']=function(_0x27c937){if(_[_0xeffa('0x5a')](_0x27c937['apiKeyNonce'])||_[_0xeffa('0x5a')](_0x27c937[_0xeffa('0x5b')])){return null;}else{return createJwt(_0x27c937);}};exports[_0xeffa('0x5c')]=function(_0x460073){_0x460073['apiKeyNonce']=generateNonce();_0x460073['apiKeyIat']=generateIssuedAt();return createJwt(_0x460073);};exports['regenerateApiKey']=function(_0x5bc1f7,_0x3595b9){var _0xedcbd9=_0x5bc1f7[_0xeffa('0x3b')][_0xeffa('0x3c')];if(_0xedcbd9){var _0xfde68c={'nonce':_0x3595b9[_0xeffa('0x46')],'iat':_0x3595b9['apiKeyIat'],'audience':hardwareConf[_0xeffa('0x3d')](),'issuer':hardwareConf[_0xeffa('0x3d')]()};return verifyJwt(_0xedcbd9,_0xfde68c)[_0xeffa('0x29')](function(){return generateApiKey(_0x3595b9);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xeffa('0x5d')]=function(_0x38a443){var _0x3e46a4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3e46a4[_0xeffa('0x5e')](_0x38a443))throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x21c285,_0x3a7edf,_0x3861ec){var _0x344fbc=encryptor[_0xeffa('0x5f')](_0x3a7edf)[_0xeffa('0x60')](',');for(var _0x6c0dc7=0x0;_0x6c0dc7<_0x3861ec;_0x6c0dc7++){if(!_0x344fbc[_0x6c0dc7])break;if(_0x21c285[_0xeffa('0x61')]()===_0x344fbc[_0x6c0dc7][_0xeffa('0x61')]()){var _0x2a8381=util[_0xeffa('0x62')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x3861ec);if(_0x3861ec===0x1){_0x2a8381=_0xeffa('0x63');}throw new db[(_0xeffa('0x64'))][(_0xeffa('0x65'))](_0x2a8381);}}return;};exports['updatePasswordsHistory']=function(_0x54886b,_0x445fec){var _0x243e61=_0x445fec?encryptor[_0xeffa('0x5f')](_0x445fec)['split'](','):[];if(_0x243e61[_0xeffa('0x66')]===0x5){_0x243e61[_0xeffa('0x67')](-0x1,0x1);}_0x243e61[_0xeffa('0x68')](_0x54886b);return encryptor[_0xeffa('0x69')](_0x243e61['join'](','));};function signJwt(_0x3b2a1d){var _0x5daeef=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x301c04=_0x3b2a1d[_0xeffa('0x6a')]||config['secrets']['session'];return new BPromise(function(_0x9edf38,_0x34c952){_0x5daeef(_0x3b2a1d[_0xeffa('0x6b')],_0x301c04,_0x3b2a1d[_0xeffa('0x6c')])[_0xeffa('0x29')](function(_0x17cd03){_0x9edf38(_0x17cd03);})[_0xeffa('0x31')](function(_0x1c9f78){_0x34c952(_0x1c9f78);});});}function verifyJwt(_0x9d16ab,_0x1caa16,_0x4b3513){var _0x1d57b6=BPromise[_0xeffa('0x6d')](jwt[_0xeffa('0x6e')],{'context':jwt});var _0x5b0288=_0x4b3513||config[_0xeffa('0xc')]['session'];return new BPromise(function(_0x3b6cd2,_0x1fbbad){_0x1d57b6(_0x9d16ab,_0x5b0288,_0x1caa16)[_0xeffa('0x29')](function(_0x450298){_0x3b6cd2(_0x450298);})[_0xeffa('0x31')](function(_0x2ef4ff){_0x1fbbad(_0x2ef4ff);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0xeffa('0x6f'));}function generateIssuedAt(){return Math[_0xeffa('0x70')](Date[_0xeffa('0x71')]()/0x3e8)['toString']();}function createJwt(_0x51449b){var _0x5b4f4d={'payload':{'iat':_0x51449b[_0xeffa('0x5b')],'nonce':_0x51449b[_0xeffa('0x46')]},'options':{'algorithm':_0xeffa('0x72'),'subject':_0x51449b['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xeffa('0x3d')]()}};return signJwt(_0x5b4f4d)['then'](function(_0x29584b){return{'iat':_0x51449b[_0xeffa('0x5b')],'nonce':_0x51449b[_0xeffa('0x46')],'token':_0x29584b};});} \ No newline at end of file +var _0x8ea9=['verify','randomBytes','toString','floor','HS512','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','name','email','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','authenticate','status','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','split','length','join','promisify','sign','secret','payload','options'];(function(_0x310202,_0x4c2c3b){var _0x27497e=function(_0x428416){while(--_0x428416){_0x310202['push'](_0x310202['shift']());}};_0x27497e(++_0x4c2c3b);}(_0x8ea9,0x7d));var _0x98ea=function(_0xa86135,_0x19e49a){_0xa86135=_0xa86135-0x0;var _0x41a892=_0x8ea9[_0xa86135];return _0x41a892;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x98ea('0x0'));var hardwareConf=require(_0x98ea('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x98ea('0x2'));var _=require(_0x98ea('0x3'));var jwt=require(_0x98ea('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x98ea('0x5'));var basicAuth=require(_0x98ea('0x6'));var crypto=require(_0x98ea('0x7'));var BPromise=require(_0x98ea('0x8'));var util=require('util');var moment=require(_0x98ea('0x9'));var validateJwt=expressJwt({'secret':config[_0x98ea('0xa')][_0x98ea('0xb')]});var userAttributes=['id','role','fullname',_0x98ea('0xc'),'internal',_0x98ea('0xd'),'userpic',_0x98ea('0xe'),_0x98ea('0xf'),_0x98ea('0x10'),'chatPause',_0x98ea('0x11'),_0x98ea('0x12'),_0x98ea('0x13'),_0x98ea('0x14'),'pauseType',_0x98ea('0x15'),'lastLoginAt',_0x98ea('0x16'),_0x98ea('0x17'),_0x98ea('0x18'),_0x98ea('0x19'),_0x98ea('0x1a'),_0x98ea('0x1b'),_0x98ea('0x1c'),_0x98ea('0x1d'),_0x98ea('0x1e'),'phoneBarEnableDtmfTone',_0x98ea('0x1f'),'phoneBarExpires',_0x98ea('0x20'),_0x98ea('0x21'),_0x98ea('0x22'),_0x98ea('0x23'),_0x98ea('0x24'),_0x98ea('0x25'),_0x98ea('0x26')];exports[_0x98ea('0x27')]=function(){return this['isAuthenticated'](!![])[_0x98ea('0x28')](function(_0x58d27c,_0x567fbb,_0x315f88){if(_0x58d27c[_0x98ea('0x29')]){_0x315f88();}else{return db[_0x98ea('0x2a')][_0x98ea('0x2b')]({'where':{'id':_0x58d27c['params']['id']},'attributes':['id',_0x98ea('0x2c'),_0x98ea('0x2d')],'raw':!![]})[_0x98ea('0x2e')](function(_0x5ba18c){if(_0x5ba18c&&_0x5ba18c['closed']){return _0x567fbb['status'](_0x5ba18c[_0x98ea('0x2d')]==='unmanaged'?0x195:0x193)['json']({'message':_0x5ba18c['disposition']===_0x98ea('0x2f')?_0x98ea('0x30'):_0x98ea('0x31')});}else{_0x315f88();}})[_0x98ea('0x32')](function(_0x2b22c1){_0x315f88(_0x2b22c1);});}});};exports[_0x98ea('0x33')]=function isAuthenticated(_0x17aea4){return compose()['use'](function(_0xd15c3f,_0x273846,_0x224f10){var _0x478e3b;if(_0xd15c3f[_0x98ea('0x34')]['authorization']){if(_[_0x98ea('0x35')](_0xd15c3f[_0x98ea('0x34')][_0x98ea('0x36')],_0x98ea('0x37'))){var _0x16afaf=basicAuth(_0xd15c3f);db[_0x98ea('0x38')][_0x98ea('0x39')]({'where':{'name':_0x16afaf[_0x98ea('0xc')]}})[_0x98ea('0x2e')](function(_0x30b11b){if(!_0x30b11b||!_0x30b11b[_0x98ea('0x3a')](_0x16afaf['pass'])){return _0x273846[_0x98ea('0x3b')](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x3d')});}_0xd15c3f[_0x98ea('0x29')]={'id':_0x30b11b['id']};_0x224f10();})['catch'](function(_0x33eea2){_0x224f10(_0x33eea2);});}else if(_[_0x98ea('0x35')](_0xd15c3f[_0x98ea('0x34')][_0x98ea('0x36')],_0x98ea('0x3e'))){validateJwt(_0xd15c3f,_0x273846,_0x224f10);}else{if(_0x17aea4){_0x224f10();}else{return _0x273846[_0x98ea('0x3b')](0x193)[_0x98ea('0x3c')]({'message':_0x98ea('0x3f')});}}}else if(_0xd15c3f['query'][_0x98ea('0x40')]){try{var _0x335006={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x98ea('0x41')]()};verifyJwt(_0xd15c3f[_0x98ea('0x42')][_0x98ea('0x40')],_0x335006)[_0x98ea('0x2e')](function(_0x47e5b8){return db[_0x98ea('0x38')][_0x98ea('0x39')]({'where':{'id':_0x47e5b8[_0x98ea('0x43')]}})[_0x98ea('0x2e')](function(_0x13d294){_0x478e3b=_0x13d294;return db['Setting'][_0x98ea('0x2b')]({'where':{'id':0x1},'attributes':[_0x98ea('0x44'),_0x98ea('0x45')],'raw':!![]});})[_0x98ea('0x2e')](function(_0x5ba4e7){if(!_0x478e3b||!_[_0x98ea('0x46')](_0x478e3b[_0x98ea('0x47')],_0x47e5b8['nonce'])){return _0x273846['status'](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x48')});}if(_0x478e3b['disabled']){return _0x273846[_0x98ea('0x3b')](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x49')});}if(_0x478e3b['blocked']){if(_0x5ba4e7[_0x98ea('0x45')]>0x0){if(moment(_0x478e3b[_0x98ea('0x4a')])['add'](_0x5ba4e7[_0x98ea('0x45')],_0x98ea('0x4b'))>moment()){return _0x273846['status'](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x49')});}}else{return _0x273846[_0x98ea('0x3b')](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x49')});}}_0xd15c3f[_0x98ea('0x29')]={'id':_0x478e3b['id']};_0x224f10();});})[_0x98ea('0x32')](function(){return _0x273846[_0x98ea('0x3b')](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x49')});});}catch(_0x174b6d){_0x224f10(_0x174b6d);}}else if(_0x17aea4){_0x224f10();}else{return _0x273846[_0x98ea('0x3b')](0x193)[_0x98ea('0x3c')]({'message':_0x98ea('0x3f')});}})[_0x98ea('0x28')](function(_0x1cc558,_0x27ffc0,_0x400da9){if(_0x1cc558[_0x98ea('0x29')]){db[_0x98ea('0x38')][_0x98ea('0x39')]({'where':{'id':_0x1cc558[_0x98ea('0x29')]['id']},'attributes':userAttributes})['then'](function(_0xc3ef54){if(!_0xc3ef54){return _0x27ffc0[_0x98ea('0x3b')](0x194)[_0x98ea('0x3c')]({'message':_0x98ea('0x4c')});}_0x1cc558[_0x98ea('0x29')]=_0xc3ef54;_0x400da9();})[_0x98ea('0x32')](function(_0x41aa5e){_0x400da9(_0x41aa5e);});}else if(_0x17aea4){_0x400da9();}else{return _0x27ffc0[_0x98ea('0x3b')](0x194)['json']({'message':_0x98ea('0x4d')});}});};exports[_0x98ea('0x4e')]=function canUpdate(){return compose()[_0x98ea('0x28')](function(_0x12838b,_0x3e8f0a,_0x3ae819){return licenseUtil[_0x98ea('0x4f')]()[_0x98ea('0x2e')](function(_0x3b1741){if(_0x3b1741['update']){_0x3ae819();}else{return _0x3e8f0a[_0x98ea('0x3b')](0x193)[_0x98ea('0x3c')]({'message':_0x98ea('0x50')});}})[_0x98ea('0x32')](function(_0x328366){_0x3ae819(_0x328366);});});};exports[_0x98ea('0x51')]=function(_0x49c62a,_0x33c23d,_0x1b3f30){_0x49c62a[_0x98ea('0x51')]=!![];return _0x1b3f30();};exports[_0x98ea('0x52')]=function signToken(_0x202765){return signJwt(_0x202765);};exports[_0x98ea('0x53')]=function(_0x2f2880,_0x2cc88b){if(!_0x2f2880['user']){return _0x2cc88b[_0x98ea('0x3b')](0x194)[_0x98ea('0x3c')]({'message':_0x98ea('0x54')});}var _0x603d06={'payload':{'id':_0x2f2880[_0x98ea('0x29')]['id'],'role':_0x2f2880[_0x98ea('0x29')][_0x98ea('0x55')]},'options':{'expiresIn':0x15180}};return signJwt(_0x603d06)[_0x98ea('0x2e')](function(_0x27932c){_0x2cc88b[_0x98ea('0x56')](_0x98ea('0x57'),_0x27932c);_0x2cc88b[_0x98ea('0x58')]('/dashboards/general');})[_0x98ea('0x32')](function(_0x18db99){return _0x2cc88b[_0x98ea('0x3b')](0x1f4)[_0x98ea('0x59')](_0x18db99);});};exports[_0x98ea('0x5a')]=function(_0x422eaa){if(_['isNil'](_0x422eaa[_0x98ea('0x47')])||_['isNil'](_0x422eaa[_0x98ea('0x5b')])){return null;}else{return createJwt(_0x422eaa);}};exports[_0x98ea('0x5c')]=function(_0x176f4d){_0x176f4d['apiKeyNonce']=generateNonce();_0x176f4d['apiKeyIat']=generateIssuedAt();return createJwt(_0x176f4d);};exports[_0x98ea('0x5d')]=function(_0x53bb87,_0x31485){var _0x5d5a89=_0x53bb87[_0x98ea('0x42')]['apikey'];if(_0x5d5a89){var _0x5b3d23={'nonce':_0x31485[_0x98ea('0x47')],'iat':_0x31485[_0x98ea('0x5b')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x98ea('0x41')]()};return verifyJwt(_0x5d5a89,_0x5b3d23)[_0x98ea('0x2e')](function(){return generateApiKey(_0x31485);});}else{throw{'message':_0x98ea('0x5e')};}};exports[_0x98ea('0x5f')]=function(_0x52c90e){var _0x1748d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1748d2[_0x98ea('0x60')](_0x52c90e))throw new db[(_0x98ea('0x61'))]['ValidationError'](_0x98ea('0x62'));return;};exports[_0x98ea('0x63')]=function(_0x3afd7d,_0xbc652,_0x2034bb){var _0x127699=encryptor[_0x98ea('0x64')](_0xbc652)['split'](',');for(var _0x4e3642=0x0;_0x4e3642<_0x2034bb;_0x4e3642++){if(!_0x127699[_0x4e3642])break;if(_0x3afd7d[_0x98ea('0x65')]()===_0x127699[_0x4e3642][_0x98ea('0x65')]()){var _0x586c29=util[_0x98ea('0x66')](_0x98ea('0x67'),_0x2034bb);if(_0x2034bb===0x1){_0x586c29=_0x98ea('0x68');}throw new db[(_0x98ea('0x61'))][(_0x98ea('0x69'))](_0x586c29);}}return;};exports[_0x98ea('0x6a')]=function(_0x349356,_0x6db48d){var _0x16bf53=_0x6db48d?encryptor[_0x98ea('0x64')](_0x6db48d)[_0x98ea('0x6b')](','):[];if(_0x16bf53[_0x98ea('0x6c')]===0x5){_0x16bf53['splice'](-0x1,0x1);}_0x16bf53['unshift'](_0x349356);return encryptor['encryptString'](_0x16bf53[_0x98ea('0x6d')](','));};function signJwt(_0x3f5b42){var _0x4dab6f=BPromise[_0x98ea('0x6e')](jwt[_0x98ea('0x6f')],{'context':jwt});var _0x525d17=_0x3f5b42[_0x98ea('0x70')]||config['secrets'][_0x98ea('0xb')];return new BPromise(function(_0x59873f,_0x86532a){_0x4dab6f(_0x3f5b42[_0x98ea('0x71')],_0x525d17,_0x3f5b42[_0x98ea('0x72')])[_0x98ea('0x2e')](function(_0x5fc82e){_0x59873f(_0x5fc82e);})[_0x98ea('0x32')](function(_0x2c06c7){_0x86532a(_0x2c06c7);});});}function verifyJwt(_0x4a91bc,_0x3363ad,_0x51d691){var _0x258320=BPromise[_0x98ea('0x6e')](jwt[_0x98ea('0x73')],{'context':jwt});var _0x562704=_0x51d691||config['secrets'][_0x98ea('0xb')];return new BPromise(function(_0x47db47,_0x1e0f30){_0x258320(_0x4a91bc,_0x562704,_0x3363ad)[_0x98ea('0x2e')](function(_0x3d65bb){_0x47db47(_0x3d65bb);})[_0x98ea('0x32')](function(_0x218db7){_0x1e0f30(_0x218db7);});});}function generateNonce(){return crypto[_0x98ea('0x74')](0x10)[_0x98ea('0x75')]('hex');}function generateIssuedAt(){return Math[_0x98ea('0x76')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x48f10f){var _0x24cbf9={'payload':{'iat':_0x48f10f[_0x98ea('0x5b')],'nonce':_0x48f10f['apiKeyNonce']},'options':{'algorithm':_0x98ea('0x77'),'subject':_0x48f10f['id'][_0x98ea('0x75')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x24cbf9)[_0x98ea('0x2e')](function(_0x218d8b){return{'iat':_0x48f10f[_0x98ea('0x5b')],'nonce':_0x48f10f['apiKeyNonce'],'token':_0x218d8b};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index d4859bb..e173274 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcca7=['createDecipher','crypto','bluebird','../../config/environment','secrets','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','algorithm','data','update','write','end','binary','close','unlink','decryptFile','final','encryptString','createCipher','utf8','base64','secret'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xcca7,0x1aa));var _0x7cca=function(_0x13c66a,_0x44b2b6){_0x13c66a=_0x13c66a-0x0;var _0x78c745=_0xcca7[_0x13c66a];return _0x78c745;};'use strict';var crypto=require(_0x7cca('0x0'));var fs=require('fs');var BPromise=require(_0x7cca('0x1'));var config=require(_0x7cca('0x2'));const stringOptions={'secret':config[_0x7cca('0x3')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x7cca('0x4')};function combineOptions(_0x533b00){var _0x3b86a4={};for(var _0x9523f7 in fileOptions){if(fileOptions[_0x7cca('0x5')](_0x9523f7)){_0x3b86a4[_0x9523f7]=fileOptions[_0x9523f7];}}if(_0x533b00){for(var _0x312e98 in _0x533b00){if(_0x533b00[_0x7cca('0x5')](_0x312e98)){_0x3b86a4[_0x312e98]=_0x533b00[_0x312e98];}}}return _0x3b86a4;}exports[_0x7cca('0x6')]=function(_0x5aec51,_0x508f29,_0x937fad,_0xd7a28d){return new BPromise(function(_0x1aed1b,_0x1e8cb9){_0xd7a28d=combineOptions(_0xd7a28d);var _0x18bac4=new Buffer(_0x937fad);var _0xe800a5=fs[_0x7cca('0x7')](_0x5aec51);var _0x2b8b62=fs[_0x7cca('0x8')](_0x508f29);var _0x1a773e=crypto['createCipher'](_0xd7a28d[_0x7cca('0x9')],_0x18bac4);_0xe800a5['on'](_0x7cca('0xa'),function(_0x275ab2){var _0x34e14f=new Buffer(_0x1a773e[_0x7cca('0xb')](_0x275ab2),'binary');_0x2b8b62[_0x7cca('0xc')](_0x34e14f);});_0xe800a5['on'](_0x7cca('0xd'),function(){try{var _0x2854c7=new Buffer(_0x1a773e['final']('binary'),_0x7cca('0xe'));_0x2b8b62[_0x7cca('0xc')](_0x2854c7);_0x2b8b62[_0x7cca('0xd')]();_0x2b8b62['on'](_0x7cca('0xf'),function(){return _0x1aed1b(_0x508f29);});}catch(_0x444465){fs[_0x7cca('0x10')](_0x508f29);return _0x1e8cb9(_0x444465);}});});};exports[_0x7cca('0x11')]=function(_0x5a357d,_0x216d4b,_0x533608,_0x5cd551){return new BPromise(function(_0x4eb7fa,_0x33a466){_0x5cd551=combineOptions(_0x5cd551);var _0xbaf563=new Buffer(_0x533608);var _0x1dd043=fs[_0x7cca('0x7')](_0x5a357d);var _0x44294b=fs['createWriteStream'](_0x216d4b);var _0xb35e1d=crypto['createDecipher'](_0x5cd551['algorithm'],_0xbaf563);_0x1dd043['on']('data',function(_0x370469){var _0x25297b=new Buffer(_0xb35e1d[_0x7cca('0xb')](_0x370469),_0x7cca('0xe'));_0x44294b[_0x7cca('0xc')](_0x25297b);});_0x1dd043['on'](_0x7cca('0xd'),function(){try{var _0x2e023c=new Buffer(_0xb35e1d[_0x7cca('0x12')]('binary'),_0x7cca('0xe'));_0x44294b[_0x7cca('0xc')](_0x2e023c);_0x44294b[_0x7cca('0xd')]();_0x44294b['on'](_0x7cca('0xf'),function(){return _0x4eb7fa(_0x216d4b);});}catch(_0x55b689){fs[_0x7cca('0x10')](_0x216d4b);return _0x33a466(_0x55b689);}});});};exports[_0x7cca('0x13')]=function(_0x4367f9,_0x119d76,_0x823d7d){var _0x3fc157=_0x823d7d||stringOptions[_0x7cca('0x9')];var _0xaf9264=_0x119d76||stringOptions['secret'];var _0xfe121c=crypto[_0x7cca('0x14')](_0x3fc157,_0xaf9264);var _0x1774fc=_0xfe121c[_0x7cca('0xb')](_0x4367f9,_0x7cca('0x15'),_0x7cca('0x16'));_0x1774fc+=_0xfe121c[_0x7cca('0x12')](_0x7cca('0x16'));return _0x1774fc;};exports['decryptString']=function(_0x2cafe1,_0x5c8410,_0xc86c1b){var _0x201fbb=_0xc86c1b||stringOptions['algorithm'];var _0x17b137=_0x5c8410||stringOptions[_0x7cca('0x17')];var _0x5533fb=crypto[_0x7cca('0x18')](_0x201fbb,_0x17b137);var _0x1cd53a=_0x5533fb[_0x7cca('0xb')](_0x2cafe1,'base64','utf8');_0x1cd53a+=_0x5533fb[_0x7cca('0x12')](_0x7cca('0x15'));return _0x1cd53a;}; \ No newline at end of file +var _0x3e24=['aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','update','binary','write','end','final','close','unlink','decryptFile','createReadStream','createDecipher','algorithm','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','secrets','session'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x3e24,0x167));var _0x43e2=function(_0x40fc07,_0x2627f4){_0x40fc07=_0x40fc07-0x0;var _0x30bded=_0x3e24[_0x40fc07];return _0x30bded;};'use strict';var crypto=require(_0x43e2('0x0'));var fs=require('fs');var BPromise=require(_0x43e2('0x1'));var config=require(_0x43e2('0x2'));const stringOptions={'secret':config[_0x43e2('0x3')][_0x43e2('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x43e2('0x5')};function combineOptions(_0x1ff04b){var _0x5d2806={};for(var _0x1dd127 in fileOptions){if(fileOptions[_0x43e2('0x6')](_0x1dd127)){_0x5d2806[_0x1dd127]=fileOptions[_0x1dd127];}}if(_0x1ff04b){for(var _0x1a89fc in _0x1ff04b){if(_0x1ff04b[_0x43e2('0x6')](_0x1a89fc)){_0x5d2806[_0x1a89fc]=_0x1ff04b[_0x1a89fc];}}}return _0x5d2806;}exports[_0x43e2('0x7')]=function(_0x121e2e,_0x23b2d8,_0x59956d,_0xb75b){return new BPromise(function(_0x2357bc,_0x4bd2ce){_0xb75b=combineOptions(_0xb75b);var _0x1c96f9=new Buffer(_0x59956d);var _0x2fdf85=fs['createReadStream'](_0x121e2e);var _0x2ed387=fs[_0x43e2('0x8')](_0x23b2d8);var _0x52146c=crypto[_0x43e2('0x9')](_0xb75b['algorithm'],_0x1c96f9);_0x2fdf85['on']('data',function(_0x5847f0){var _0x103220=new Buffer(_0x52146c[_0x43e2('0xa')](_0x5847f0),_0x43e2('0xb'));_0x2ed387[_0x43e2('0xc')](_0x103220);});_0x2fdf85['on'](_0x43e2('0xd'),function(){try{var _0x68e82d=new Buffer(_0x52146c[_0x43e2('0xe')](_0x43e2('0xb')),_0x43e2('0xb'));_0x2ed387[_0x43e2('0xc')](_0x68e82d);_0x2ed387[_0x43e2('0xd')]();_0x2ed387['on'](_0x43e2('0xf'),function(){return _0x2357bc(_0x23b2d8);});}catch(_0x5ee7fc){fs[_0x43e2('0x10')](_0x23b2d8);return _0x4bd2ce(_0x5ee7fc);}});});};exports[_0x43e2('0x11')]=function(_0xb929b5,_0x2a0fb0,_0x5cea01,_0x4a6443){return new BPromise(function(_0x241da2,_0x417ce5){_0x4a6443=combineOptions(_0x4a6443);var _0x27aa89=new Buffer(_0x5cea01);var _0x3a27eb=fs[_0x43e2('0x12')](_0xb929b5);var _0x1b7cde=fs[_0x43e2('0x8')](_0x2a0fb0);var _0x15ecb5=crypto[_0x43e2('0x13')](_0x4a6443[_0x43e2('0x14')],_0x27aa89);_0x3a27eb['on']('data',function(_0x3ee34c){var _0xb99e5d=new Buffer(_0x15ecb5['update'](_0x3ee34c),_0x43e2('0xb'));_0x1b7cde['write'](_0xb99e5d);});_0x3a27eb['on'](_0x43e2('0xd'),function(){try{var _0x13610f=new Buffer(_0x15ecb5[_0x43e2('0xe')](_0x43e2('0xb')),_0x43e2('0xb'));_0x1b7cde['write'](_0x13610f);_0x1b7cde[_0x43e2('0xd')]();_0x1b7cde['on'](_0x43e2('0xf'),function(){return _0x241da2(_0x2a0fb0);});}catch(_0x272934){fs['unlink'](_0x2a0fb0);return _0x417ce5(_0x272934);}});});};exports[_0x43e2('0x15')]=function(_0x32f048,_0x43078f,_0x11b285){var _0x4f20e6=_0x11b285||stringOptions[_0x43e2('0x14')];var _0xc717d8=_0x43078f||stringOptions[_0x43e2('0x16')];var _0x3b7b22=crypto[_0x43e2('0x9')](_0x4f20e6,_0xc717d8);var _0x2a593e=_0x3b7b22[_0x43e2('0xa')](_0x32f048,_0x43e2('0x17'),_0x43e2('0x18'));_0x2a593e+=_0x3b7b22[_0x43e2('0xe')](_0x43e2('0x18'));return _0x2a593e;};exports[_0x43e2('0x19')]=function(_0x52ed49,_0x430a0e,_0x2f2bd8){var _0x545246=_0x2f2bd8||stringOptions[_0x43e2('0x14')];var _0x1883c6=_0x430a0e||stringOptions[_0x43e2('0x16')];var _0x404483=crypto[_0x43e2('0x13')](_0x545246,_0x1883c6);var _0x5a896b=_0x404483[_0x43e2('0xa')](_0x52ed49,_0x43e2('0x18'),_0x43e2('0x17'));_0x5a896b+=_0x404483[_0x43e2('0xe')](_0x43e2('0x17'));return _0x5a896b;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index a43f93e..5a38d9f 100644 --- a/server/components/export/csv.js +++ b/server/components/export/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x750a=['%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync','join','mkdirSync','each','length','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Setting','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty'];(function(_0x39bf66,_0x35c96c){var _0x431030=function(_0x4328ac){while(--_0x4328ac){_0x39bf66['push'](_0x39bf66['shift']());}};_0x431030(++_0x35c96c);}(_0x750a,0x140));var _0xa750=function(_0x47b900,_0x1a8c14){_0x47b900=_0x47b900-0x0;var _0x4eacfa=_0x750a[_0x47b900];return _0x4eacfa;};'use strict';var util=require('util');var path=require(_0xa750('0x0'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xa750('0x1'));var zipdir=require(_0xa750('0x2'));var rimraf=require(_0xa750('0x3'));var db=require(_0xa750('0x4'))['db'];var dbH=require(_0xa750('0x4'))[_0xa750('0x5')];var logger=require(_0xa750('0x6'))(_0xa750('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xa750('0x8')][0x2]);var QUERY=process[_0xa750('0x8')][0x3];var PATH=process[_0xa750('0x8')][0x4];function analyticExtractedReport(_0x1ae455,_0x3d7c43){var _0x47a4dd={'status':_0x1ae455};var _0x53f2cb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d7c43){_0x47a4dd[_0xa750('0x9')]=_0x3d7c43;}return db['AnalyticExtractedReport'][_0xa750('0xa')](_0x47a4dd,_0x53f2cb);}function main(){var _0x1760f5=0x1388;var _0x51f594;logger[_0xa750('0xb')](util[_0xa750('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xa750('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa750('0xe'),_0xa750('0xf')]})['then'](function(_0x24ec62){if(_0x24ec62){_0x51f594=_0x24ec62;_0x1760f5=_0x51f594[_0xa750('0xf')]||0x1388;}})[_0xa750('0x10')](function(){return dbH['sequelize'][_0xa750('0x11')](util[_0xa750('0xc')](_0xa750('0x12'),QUERY),{'type':dbH[_0xa750('0x13')][_0xa750('0x14')][_0xa750('0x15')]});})['then'](function(_0x3ae2a1){if(!_0x3ae2a1[0x0][_0xa750('0x16')]){return analyticExtractedReport(_0xa750('0x17'));}var _0x49fe3b=[];var _0x337095=0x0;var _0x29480c=!![];if(_0x3ae2a1&&_0x3ae2a1['length']){var _0x4afb05=_0x3ae2a1[0x0][_0xa750('0x16')]%(_0x337095+_0x1760f5);if(_0x51f594['split']){for(;_0x29480c;_0x337095+=_0x1760f5,_0x4afb05=_0x3ae2a1[0x0][_0xa750('0x16')]%(_0x337095+_0x1760f5)){if(_0x4afb05==0x0||_0x4afb05==_0x3ae2a1[0x0][_0xa750('0x16')]){_0x29480c=![];}_0x49fe3b['push'](dbH[_0xa750('0x13')]['query'](util['format'](_0xa750('0x18'),QUERY,_0x1760f5,_0x337095),{'type':dbH['sequelize'][_0xa750('0x14')]['SELECT']}));}}else{_0x49fe3b[_0xa750('0x19')](dbH['sequelize'][_0xa750('0x11')](QUERY,{'type':dbH['sequelize'][_0xa750('0x14')]['SELECT']}));}}var _0x52f166=path[_0xa750('0x1a')](PATH);var _0x52da84=path[_0xa750('0x1b')](PATH,'.csv');var _0x5c7203=_0x51f594['split']&&_0x49fe3b['length']>0x1;var _0x15d72f=[];if(!fs[_0xa750('0x1c')](path[_0xa750('0x1d')](_0x52f166,_0x52da84))&&_0x5c7203){fs[_0xa750('0x1e')](path[_0xa750('0x1d')](_0x52f166,_0x52da84));}return BPromise[_0xa750('0x1f')](_0x49fe3b,function(_0x3001bc){_0x15d72f[_0xa750('0x19')](_0x3001bc);})[_0xa750('0x10')](function(){for(var _0x94697a=0x0;_0x94697a<_0x15d72f[_0xa750('0x20')];_0x94697a+=0x1){var _0x27a5eb;var _0x31ea63=_0x15d72f[_0x94697a];if(_0x5c7203){_0x27a5eb=path[_0xa750('0x1d')](_0x52f166,_0x52da84,util[_0xa750('0xc')]('%s%d.%s',_0x52da84,_0x94697a,_0xa750('0x21')));}else{_0x27a5eb=path[_0xa750('0x1d')](_0x52f166,util[_0xa750('0xc')]('%s.%s',_0x52da84,_0xa750('0x21')));}fs[_0xa750('0x22')](_0x27a5eb,csv(_0x31ea63));}})[_0xa750('0x10')](function(){if(_0x5c7203){zipdir(path[_0xa750('0x1d')](_0x52f166,_0x52da84),{'saveTo':path['join'](_0x52f166,util[_0xa750('0xc')](_0xa750('0x23'),_0x52da84,_0xa750('0x24')))},function(_0x2aef3a,_0x2c5253){});rimraf(path['join'](_0x52f166,_0x52da84),function(){});}})[_0xa750('0x10')](function(){logger['info'](util[_0xa750('0xc')](_0xa750('0x25'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xa750('0x26'),_0x5c7203?util[_0xa750('0xc')](_0xa750('0x23'),_0x52da84,_0x5c7203?_0xa750('0x24'):_0xa750('0x21')):null);});})[_0xa750('0x27')](function(_0x31066b){logger[_0xa750('0xb')](util['format'](_0xa750('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0xa750('0x29')](_0x31066b,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa750('0x2a'));});}main(); \ No newline at end of file +var _0x6f0d=['rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','path','lodash','to-csv','bluebird'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4df3db,_0x5f66a4){_0x4df3db=_0x4df3db-0x0;var _0x322281=_0x6f0d[_0x4df3db];return _0x322281;};'use strict';var util=require('util');var path=require(_0xd6f0('0x0'));var _=require(_0xd6f0('0x1'));var csv=require(_0xd6f0('0x2'));var fs=require('fs');var BPromise=require(_0xd6f0('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xd6f0('0x4'));var db=require(_0xd6f0('0x5'))['db'];var dbH=require(_0xd6f0('0x5'))[_0xd6f0('0x6')];var logger=require(_0xd6f0('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd6f0('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd6f0('0x8')][0x4];function analyticExtractedReport(_0x1af29c,_0x8b89a9){var _0x1a48a0={'status':_0x1af29c};var _0x4c4916={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8b89a9){_0x1a48a0['savename']=_0x8b89a9;}return db[_0xd6f0('0x9')][_0xd6f0('0xa')](_0x1a48a0,_0x4c4916);}function main(){var _0x2854cd=0x1388;var _0x382a2e;logger[_0xd6f0('0xb')](util['format'](_0xd6f0('0xc'),EXTRACTED_REPORT_ID,_0xd6f0('0xd')));return db[_0xd6f0('0xe')][_0xd6f0('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd6f0('0x10')]})[_0xd6f0('0x11')](function(_0x306aad){if(_0x306aad){_0x382a2e=_0x306aad;_0x2854cd=_0x382a2e[_0xd6f0('0x10')]||0x1388;}})[_0xd6f0('0x11')](function(){return dbH[_0xd6f0('0x12')][_0xd6f0('0x13')](util[_0xd6f0('0x14')](_0xd6f0('0x15'),QUERY),{'type':dbH['sequelize'][_0xd6f0('0x16')][_0xd6f0('0x17')]});})['then'](function(_0x419b7e){if(!_0x419b7e[0x0]['num']){return analyticExtractedReport(_0xd6f0('0x18'));}var _0x154e3e=[];var _0x41bd99=0x0;var _0x472156=!![];if(_0x419b7e&&_0x419b7e[_0xd6f0('0x19')]){var _0x61defb=_0x419b7e[0x0][_0xd6f0('0x1a')]%(_0x41bd99+_0x2854cd);if(_0x382a2e[_0xd6f0('0x1b')]){for(;_0x472156;_0x41bd99+=_0x2854cd,_0x61defb=_0x419b7e[0x0][_0xd6f0('0x1a')]%(_0x41bd99+_0x2854cd)){if(_0x61defb==0x0||_0x61defb==_0x419b7e[0x0][_0xd6f0('0x1a')]){_0x472156=![];}_0x154e3e[_0xd6f0('0x1c')](dbH[_0xd6f0('0x12')][_0xd6f0('0x13')](util[_0xd6f0('0x14')](_0xd6f0('0x1d'),QUERY,_0x2854cd,_0x41bd99),{'type':dbH[_0xd6f0('0x12')]['QueryTypes']['SELECT']}));}}else{_0x154e3e[_0xd6f0('0x1c')](dbH[_0xd6f0('0x12')][_0xd6f0('0x13')](QUERY,{'type':dbH['sequelize'][_0xd6f0('0x16')][_0xd6f0('0x17')]}));}}var _0x557c9b=path[_0xd6f0('0x1e')](PATH);var _0x515687=path[_0xd6f0('0x1f')](PATH,_0xd6f0('0x20'));var _0x5dbe1c=_0x382a2e[_0xd6f0('0x1b')]&&_0x154e3e[_0xd6f0('0x19')]>0x1;var _0x5ea2dd=[];if(!fs[_0xd6f0('0x21')](path[_0xd6f0('0x22')](_0x557c9b,_0x515687))&&_0x5dbe1c){fs[_0xd6f0('0x23')](path['join'](_0x557c9b,_0x515687));}return BPromise[_0xd6f0('0x24')](_0x154e3e,function(_0x3dc166){_0x5ea2dd['push'](_0x3dc166);})[_0xd6f0('0x11')](function(){for(var _0x551be8=0x0;_0x551be8<_0x5ea2dd[_0xd6f0('0x19')];_0x551be8+=0x1){var _0x3fb5c3;var _0x1630dc=_0x5ea2dd[_0x551be8];if(_0x5dbe1c){_0x3fb5c3=path[_0xd6f0('0x22')](_0x557c9b,_0x515687,util[_0xd6f0('0x14')](_0xd6f0('0x25'),_0x515687,_0x551be8,_0xd6f0('0x26')));}else{_0x3fb5c3=path[_0xd6f0('0x22')](_0x557c9b,util['format'](_0xd6f0('0x27'),_0x515687,_0xd6f0('0x26')));}fs['writeFileSync'](_0x3fb5c3,csv(_0x1630dc));}})[_0xd6f0('0x11')](function(){if(_0x5dbe1c){zipdir(path[_0xd6f0('0x22')](_0x557c9b,_0x515687),{'saveTo':path[_0xd6f0('0x22')](_0x557c9b,util[_0xd6f0('0x14')](_0xd6f0('0x27'),_0x515687,_0xd6f0('0x28')))},function(_0x351fda,_0x3151f8){});rimraf(path[_0xd6f0('0x22')](_0x557c9b,_0x515687),function(){});}})[_0xd6f0('0x11')](function(){logger[_0xd6f0('0xb')](util[_0xd6f0('0x14')](_0xd6f0('0x29'),EXTRACTED_REPORT_ID,_0xd6f0('0xd')));return analyticExtractedReport(_0xd6f0('0x2a'),_0x5dbe1c?util[_0xd6f0('0x14')](_0xd6f0('0x27'),_0x515687,_0x5dbe1c?_0xd6f0('0x28'):_0xd6f0('0x26')):null);});})[_0xd6f0('0x2b')](function(_0x3906ca){logger[_0xd6f0('0xb')](util['format'](_0xd6f0('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x3906ca,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xd6f0('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 8895989..88a8848 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x4f3628,_0x436885){var _0xa46250=function(_0x5619a5){while(--_0x5619a5){_0x4f3628['push'](_0x4f3628['shift']());}};_0xa46250(++_0x436885);}(_0xb10b,0x12a));var _0xbb10=function(_0xf6ea70,_0x7c1c6e){_0xf6ea70=_0xf6ea70-0x0;var _0x24898a=_0xb10b[_0xf6ea70];return _0x24898a;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x1f1902,_0x52bcaf){var _0x21b04b=function(_0x2c1a17){while(--_0x2c1a17){_0x1f1902['push'](_0x1f1902['shift']());}};_0x21b04b(++_0x52bcaf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4016137..590cc20 100644 --- a/server/components/export/xlsx.js +++ b/server/components/export/xlsx.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca96=['zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT','num','Empty','length','QueryTypes','push','dirname','basename','existsSync','mkdirSync','join','each','xlsx','writeFileSync','binary','%s.%s'];(function(_0x3f62c5,_0x24f843){var _0xface7=function(_0x2e8c3a){while(--_0x2e8c3a){_0x3f62c5['push'](_0x3f62c5['shift']());}};_0xface7(++_0x24f843);}(_0xca96,0x10f));var _0x6ca9=function(_0x595ab7,_0x3a7304){_0x595ab7=_0x595ab7-0x0;var _0x1b564c=_0xca96[_0x595ab7];return _0x1b564c;};'use strict';var util=require('util');var path=require(_0x6ca9('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x6ca9('0x1'));var BPromise=require(_0x6ca9('0x2'));var zipdir=require(_0x6ca9('0x3'));var rimraf=require(_0x6ca9('0x4'));var db=require(_0x6ca9('0x5'))['db'];var dbH=require('../../mysqldb')[_0x6ca9('0x6')];var logger=require(_0x6ca9('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6ca9('0x8')][0x2]);var QUERY=process[_0x6ca9('0x8')][0x3];var PATH=process[_0x6ca9('0x8')][0x4];function analyticExtractedReport(_0x1b595e,_0x79d698){var _0x3b8ab2={'status':_0x1b595e};var _0x588307={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x79d698){_0x3b8ab2[_0x6ca9('0x9')]=_0x79d698;}return db[_0x6ca9('0xa')]['update'](_0x3b8ab2,_0x588307);}function main(){var _0xe410dc=0x1388;var _0x476b7f;logger['info'](util[_0x6ca9('0xb')](_0x6ca9('0xc'),EXTRACTED_REPORT_ID,_0x6ca9('0xd')));return db[_0x6ca9('0xe')][_0x6ca9('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6ca9('0x10'),_0x6ca9('0x11')]})[_0x6ca9('0x12')](function(_0x171e63){if(_0x171e63){_0x476b7f=_0x171e63;_0xe410dc=_0x476b7f[_0x6ca9('0x11')]||0x1388;}})['then'](function(){return dbH[_0x6ca9('0x13')][_0x6ca9('0x14')](util[_0x6ca9('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6ca9('0x13')]['QueryTypes'][_0x6ca9('0x15')]});})[_0x6ca9('0x12')](function(_0x53b7c0){if(!_0x53b7c0[0x0][_0x6ca9('0x16')]){return analyticExtractedReport(_0x6ca9('0x17'));}var _0x5c701e=[];var _0xa9b84d=0x0;var _0x104e3f=!![];if(_0x476b7f['split']){if(_0x53b7c0&&_0x53b7c0[_0x6ca9('0x18')]){var _0x3c3651=_0x53b7c0[0x0]['num']%(_0xa9b84d+_0xe410dc);for(;_0x104e3f;_0xa9b84d+=_0xe410dc,_0x3c3651=_0x53b7c0[0x0][_0x6ca9('0x16')]%(_0xa9b84d+_0xe410dc)){if(_0x3c3651==0x0||_0x3c3651==_0x53b7c0[0x0][_0x6ca9('0x16')]){_0x104e3f=![];}_0x5c701e['push'](dbH['sequelize'][_0x6ca9('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xe410dc,_0xa9b84d),{'type':dbH[_0x6ca9('0x13')][_0x6ca9('0x19')]['SELECT']}));}}}else{_0x5c701e[_0x6ca9('0x1a')](dbH['sequelize'][_0x6ca9('0x14')](QUERY,{'type':dbH[_0x6ca9('0x13')][_0x6ca9('0x19')][_0x6ca9('0x15')]}));}var _0x2013e0=path[_0x6ca9('0x1b')](PATH);var _0x4ceea0=path[_0x6ca9('0x1c')](PATH,'.xlsx');var _0x5d13f0=_0x476b7f[_0x6ca9('0x10')]&&_0x5c701e[_0x6ca9('0x18')]>0x1;var _0x148a9a=[];if(!fs[_0x6ca9('0x1d')](path['join'](_0x2013e0,_0x4ceea0))&&_0x5d13f0){fs[_0x6ca9('0x1e')](path[_0x6ca9('0x1f')](_0x2013e0,_0x4ceea0));}return BPromise[_0x6ca9('0x20')](_0x5c701e,function(_0x54e698){_0x148a9a[_0x6ca9('0x1a')](_0x54e698);})[_0x6ca9('0x12')](function(){for(var _0x39674f=0x0;_0x39674f<_0x148a9a[_0x6ca9('0x18')];_0x39674f+=0x1){var _0x1b41e6;var _0x43baee=_0x148a9a[_0x39674f];if(_0x5d13f0){_0x1b41e6=path[_0x6ca9('0x1f')](_0x2013e0,_0x4ceea0,util['format']('%s%d.%s',_0x4ceea0,_0x39674f,_0x6ca9('0x21')));}else{_0x1b41e6=path[_0x6ca9('0x1f')](_0x2013e0,util['format']('%s.%s',_0x4ceea0,_0x6ca9('0x21')));}fs[_0x6ca9('0x22')](_0x1b41e6,json2xls(_0x43baee),_0x6ca9('0x23'));}})['then'](function(){if(_0x5d13f0){zipdir(path['join'](_0x2013e0,_0x4ceea0),{'saveTo':path[_0x6ca9('0x1f')](_0x2013e0,util[_0x6ca9('0xb')](_0x6ca9('0x24'),_0x4ceea0,_0x6ca9('0x25')))},function(_0x296334,_0x5b427c){});rimraf(path[_0x6ca9('0x1f')](_0x2013e0,_0x4ceea0),function(){});}})['then'](function(){logger[_0x6ca9('0x26')](util[_0x6ca9('0xb')](_0x6ca9('0x27'),EXTRACTED_REPORT_ID,_0x6ca9('0xd')));return analyticExtractedReport(_0x6ca9('0x28'),_0x5d13f0?util[_0x6ca9('0xb')](_0x6ca9('0x24'),_0x4ceea0,_0x5d13f0?_0x6ca9('0x25'):_0x6ca9('0x21')):null);});})[_0x6ca9('0x29')](function(_0x53c8b5){logger[_0x6ca9('0x26')](util[_0x6ca9('0xb')](_0x6ca9('0x2a'),EXTRACTED_REPORT_ID,_0x6ca9('0xd')),util[_0x6ca9('0x2b')](_0x53c8b5,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xf34f=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','format','QueryTypes','length','num','query','SELECT','dirname','basename','.xlsx','existsSync','mkdirSync','join','push','xlsx','writeFileSync','binary','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','update'];(function(_0x5d5f1c,_0x6ea981){var _0x1bbd93=function(_0xe662e0){while(--_0xe662e0){_0x5d5f1c['push'](_0x5d5f1c['shift']());}};_0x1bbd93(++_0x6ea981);}(_0xf34f,0x14d));var _0xff34=function(_0x1a87ab,_0x8fcb1a){_0x1a87ab=_0x1a87ab-0x0;var _0x1ca436=_0xf34f[_0x1a87ab];return _0x1ca436;};'use strict';var util=require('util');var path=require(_0xff34('0x0'));var _=require(_0xff34('0x1'));var fs=require('fs');var json2xls=require(_0xff34('0x2'));var BPromise=require(_0xff34('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xff34('0x4'));var db=require(_0xff34('0x5'))['db'];var dbH=require('../../mysqldb')[_0xff34('0x6')];var logger=require('../../config/logger')(_0xff34('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xff34('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xff34('0x8')][0x4];function analyticExtractedReport(_0x33f6fe,_0x7be1de){var _0xdd8a98={'status':_0x33f6fe};var _0x26dcf2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x7be1de){_0xdd8a98[_0xff34('0x9')]=_0x7be1de;}return db['AnalyticExtractedReport'][_0xff34('0xa')](_0xdd8a98,_0x26dcf2);}function main(){var _0x32e715=0x1388;var _0x2e6c6b;logger['info'](util['format'](_0xff34('0xb'),EXTRACTED_REPORT_ID,_0xff34('0xc')));return db[_0xff34('0xd')][_0xff34('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xff34('0xf'),_0xff34('0x10')]})[_0xff34('0x11')](function(_0x112b9e){if(_0x112b9e){_0x2e6c6b=_0x112b9e;_0x32e715=_0x2e6c6b['splitSizeXlsx']||0x1388;}})[_0xff34('0x11')](function(){return dbH[_0xff34('0x12')]['query'](util[_0xff34('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xff34('0x12')][_0xff34('0x14')]['SELECT']});})[_0xff34('0x11')](function(_0x5805f7){if(!_0x5805f7[0x0]['num']){return analyticExtractedReport('Empty');}var _0x1d1e03=[];var _0x4361cd=0x0;var _0xa4b9be=!![];if(_0x2e6c6b['split']){if(_0x5805f7&&_0x5805f7[_0xff34('0x15')]){var _0x11b94c=_0x5805f7[0x0][_0xff34('0x16')]%(_0x4361cd+_0x32e715);for(;_0xa4b9be;_0x4361cd+=_0x32e715,_0x11b94c=_0x5805f7[0x0][_0xff34('0x16')]%(_0x4361cd+_0x32e715)){if(_0x11b94c==0x0||_0x11b94c==_0x5805f7[0x0][_0xff34('0x16')]){_0xa4b9be=![];}_0x1d1e03['push'](dbH['sequelize'][_0xff34('0x17')](util[_0xff34('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x32e715,_0x4361cd),{'type':dbH['sequelize'][_0xff34('0x14')][_0xff34('0x18')]}));}}}else{_0x1d1e03['push'](dbH[_0xff34('0x12')][_0xff34('0x17')](QUERY,{'type':dbH[_0xff34('0x12')]['QueryTypes']['SELECT']}));}var _0x3368f7=path[_0xff34('0x19')](PATH);var _0x1ba762=path[_0xff34('0x1a')](PATH,_0xff34('0x1b'));var _0x6d4226=_0x2e6c6b[_0xff34('0xf')]&&_0x1d1e03[_0xff34('0x15')]>0x1;var _0x29a02f=[];if(!fs[_0xff34('0x1c')](path['join'](_0x3368f7,_0x1ba762))&&_0x6d4226){fs[_0xff34('0x1d')](path[_0xff34('0x1e')](_0x3368f7,_0x1ba762));}return BPromise['each'](_0x1d1e03,function(_0x15375a){_0x29a02f[_0xff34('0x1f')](_0x15375a);})[_0xff34('0x11')](function(){for(var _0x303731=0x0;_0x303731<_0x29a02f[_0xff34('0x15')];_0x303731+=0x1){var _0xa6b701;var _0x515b4b=_0x29a02f[_0x303731];if(_0x6d4226){_0xa6b701=path['join'](_0x3368f7,_0x1ba762,util[_0xff34('0x13')]('%s%d.%s',_0x1ba762,_0x303731,_0xff34('0x20')));}else{_0xa6b701=path[_0xff34('0x1e')](_0x3368f7,util[_0xff34('0x13')]('%s.%s',_0x1ba762,_0xff34('0x20')));}fs[_0xff34('0x21')](_0xa6b701,json2xls(_0x515b4b),_0xff34('0x22'));}})[_0xff34('0x11')](function(){if(_0x6d4226){zipdir(path[_0xff34('0x1e')](_0x3368f7,_0x1ba762),{'saveTo':path[_0xff34('0x1e')](_0x3368f7,util[_0xff34('0x13')](_0xff34('0x23'),_0x1ba762,_0xff34('0x24')))},function(_0x46ae73,_0x36bf25){});rimraf(path[_0xff34('0x1e')](_0x3368f7,_0x1ba762),function(){});}})[_0xff34('0x11')](function(){logger[_0xff34('0x25')](util[_0xff34('0x13')](_0xff34('0x26'),EXTRACTED_REPORT_ID,_0xff34('0xc')));return analyticExtractedReport(_0xff34('0x27'),_0x6d4226?util['format']('%s.%s',_0x1ba762,_0x6d4226?_0xff34('0x24'):_0xff34('0x20')):null);});})['catch'](function(_0x4a67e1){logger[_0xff34('0x25')](util[_0xff34('0x13')](_0xff34('0x28'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xff34('0x29')](_0x4a67e1,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xff34('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 20cc532..81d1539 100644 --- a/server/components/extensions/rewrite.js +++ b/server/components/extensions/rewrite.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c00=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','Interval','findAll','then','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','filter','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='];(function(_0x56ce2c,_0x14b2de){var _0x58baeb=function(_0x5d42f6){while(--_0x5d42f6){_0x56ce2c['push'](_0x56ce2c['shift']());}};_0x58baeb(++_0x14b2de);}(_0x5c00,0x17e));var _0x05c0=function(_0x4400f7,_0xe6e042){_0x4400f7=_0x4400f7-0x0;var _0x158216=_0x5c00[_0x4400f7];return _0x158216;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));function rewrite(_0x1c3b79,_0x4e54ec){var _0x1e76da=this;return _0x1c3b79['models'][_0x05c0('0x2')][_0x05c0('0x3')]({'raw':!![]})[_0x05c0('0x4')](function(_0x28d9c7){_0x1e76da['intervals']=_0x28d9c7;return _0x1c3b79[_0x05c0('0x5')][_0x05c0('0x6')][_0x05c0('0x3')]({'where':{'IntervalId':_0x4e54ec[_0x05c0('0x7')]},'raw':!![]});})['then'](function(_0x3a3b1b){return _0x1c3b79[_0x05c0('0x5')][_0x05c0('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x05c0('0x8')](_[_0x05c0('0x9')](_0x3a3b1b,_0x05c0('0xa')))}},'order':[{'raw':_0x05c0('0xb')}],'raw':!![]});})[_0x05c0('0x4')](function(_0x1edbb){var _0x5226c5=_['filter'](_0x1edbb,{'priority':'1'});var _0x5d4de1=_['filter'](_0x1edbb,{'isApp':0x1});var _0x205cec=_[_0x05c0('0xc')](_0x5d4de1,_0x05c0('0xa'));var _0x5a3e65=[_0x05c0('0xd'),'playback'];var _0x16a290=[];var _0x49e07e=[];for(var _0x20ff48 in _0x205cec){if(_0x205cec[_0x05c0('0xe')](_0x20ff48)){_0x1e76da[_0x05c0('0xf')]=0x2;_0x1e76da[_0x05c0('0x10')]=[];_0x1e76da[_0x05c0('0x11')]=_[_0x05c0('0x12')](_0x5226c5,{'exten':_0x205cec[_0x20ff48][0x0]['exten']});_0x1e76da[_0x05c0('0x10')][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':_0x05c0('0x15'),'appdata':util[_0x05c0('0x16')](_0x05c0('0x17'),_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')]),'context':_0x205cec[_0x20ff48][0x0][_0x05c0('0x18')],'exten':_0x205cec[_0x20ff48][0x0][_0x05c0('0xa')],'priority':_0x1e76da['priority']++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});if(_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')]===_0x05c0('0x1a')){if(_0x1e76da['extension']){_0x1e76da[_0x05c0('0x10')][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':_0x05c0('0x15'),'appdata':_0x05c0('0x1b')+(_0x1e76da['extension'][_0x05c0('0x1c')]?_0x05c0('0x1d')+_0x1e76da['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x205cec[_0x20ff48][0x0][_0x05c0('0x18')],'exten':_0x205cec[_0x20ff48][0x0][_0x05c0('0xa')],'priority':_0x1e76da[_0x05c0('0xf')]++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});}_0x1e76da[_0x05c0('0x10')][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':'Set','appdata':_0x05c0('0x1e')+_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')],'context':_0x205cec[_0x20ff48][0x0]['context'],'exten':_0x205cec[_0x20ff48][0x0]['exten'],'priority':_0x1e76da['priority']++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0]['VoiceExtensionId']});var _0x56aa78=_0x1e76da[_0x05c0('0xf')]++;_0x1e76da[_0x05c0('0x10')]['push']({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':_0x05c0('0x1f'),'appdata':_0x05c0('0x20')+(_0x56aa78+0x2)+_0x05c0('0x21')+(_0x56aa78+0x1)+')','context':_0x205cec[_0x20ff48][0x0]['context'],'exten':_0x205cec[_0x20ff48][0x0][_0x05c0('0xa')],'priority':_0x56aa78,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});if(_0x1e76da[_0x05c0('0x11')]){_0x1e76da[_0x05c0('0x10')][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':'Set','appdata':_0x1e76da['extension'][_0x05c0('0x1c')]?_0x05c0('0x22')+_0x1e76da[_0x05c0('0x11')][_0x05c0('0x1c')]+'}':_0x05c0('0x23'),'context':_0x205cec[_0x20ff48][0x0][_0x05c0('0x18')],'exten':_0x205cec[_0x20ff48][0x0][_0x05c0('0xa')],'priority':_0x1e76da[_0x05c0('0xf')]++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});}_0x1e76da[_0x05c0('0x10')][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':'Set','appdata':'outboundrouteid='+_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')],'context':_0x205cec[_0x20ff48][0x0][_0x05c0('0x18')],'exten':_0x205cec[_0x20ff48][0x0][_0x05c0('0xa')],'priority':_0x1e76da['priority']++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});if(_0x1e76da[_0x05c0('0x11')]&&_0x1e76da['extension'][_0x05c0('0xe')]('recordingFormat')&&_0x1e76da[_0x05c0('0x11')][_0x05c0('0x24')]!==_0x05c0('0x25')){_0x1e76da[_0x05c0('0x10')][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':_0x05c0('0x15'),'appdata':_0x05c0('0x26'),'context':_0x205cec[_0x20ff48][0x0][_0x05c0('0x18')],'exten':_0x205cec[_0x20ff48][0x0][_0x05c0('0xa')],'priority':_0x1e76da[_0x05c0('0xf')]++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});_0x1e76da[_0x05c0('0x10')][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':_0x05c0('0x15'),'appdata':_0x05c0('0x27')+_0x1e76da[_0x05c0('0x11')][_0x05c0('0x24')]||_0x05c0('0x28'),'context':_0x205cec[_0x20ff48][0x0][_0x05c0('0x18')],'exten':_0x205cec[_0x20ff48][0x0][_0x05c0('0xa')],'priority':_0x1e76da[_0x05c0('0xf')]++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});}}_0x1e76da[_0x05c0('0x10')][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':_0x05c0('0x15'),'appdata':_0x05c0('0x29'),'context':_0x205cec[_0x20ff48][0x0][_0x05c0('0x18')],'exten':_0x205cec[_0x20ff48][0x0][_0x05c0('0xa')],'priority':_0x1e76da[_0x05c0('0xf')]++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});_0x1e76da['extensions'][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':_0x05c0('0x15'),'appdata':_0x05c0('0x2a'),'context':_0x205cec[_0x20ff48][0x0]['context'],'exten':_0x205cec[_0x20ff48][0x0]['exten'],'priority':_0x1e76da[_0x05c0('0xf')]++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});_0x1e76da[_0x05c0('0x10')]['push']({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':_0x05c0('0x15'),'appdata':_0x05c0('0x2b'),'context':_0x205cec[_0x20ff48][0x0][_0x05c0('0x18')],'exten':_0x205cec[_0x20ff48][0x0]['exten'],'priority':_0x1e76da[_0x05c0('0xf')]++,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});for(var _0x4de9c2=0x0,_0x16e5f7=0x0;_0x4de9c2<_0x205cec[_0x20ff48][_0x05c0('0x2c')];_0x4de9c2+=0x1,_0x16e5f7=0x0){var _0x4557db=_0x205cec[_0x20ff48][_0x4de9c2];if(_0x4557db[_0x05c0('0x14')]){_0x4557db[_0x05c0('0x14')]=_0x4557db[_0x05c0('0x14')][_0x05c0('0x2d')]();}var _0x5a75b4=[];var _0x595b0a=[];delete _0x4557db['id'];delete _0x4557db[_0x05c0('0x2e')];delete _0x4557db[_0x05c0('0x2f')];var _0xaa5d53=_0x4557db[_0x05c0('0x30')]!==_0x05c0('0x31')?[_0x4557db['interval']]:_0x4557db[_0x05c0('0x7')]?_[_0x05c0('0x9')](_[_0x05c0('0x32')](_0x1e76da[_0x05c0('0x33')],{'IntervalId':_0x4557db[_0x05c0('0x7')]}),_0x05c0('0x30')):[];if(_0x4557db[_0x05c0('0xe')]('tag')){if(_0x4557db[_0x05c0('0x34')]&&_0x4557db[_0x05c0('0x34')]!=='--'){_0x5a75b4[_0x05c0('0x13')]({'type':_0x4557db[_0x05c0('0x14')],'app':_0x05c0('0x15'),'appdata':_0x05c0('0x35')+_0x4557db[_0x05c0('0x34')],'context':_0x4557db[_0x05c0('0x18')],'exten':_0x4557db[_0x05c0('0xa')],'priority':_0xaa5d53[_0x05c0('0x2c')]+_0x1e76da[_0x05c0('0xf')]+_0x16e5f7++,'VoiceExtensionId':_0x4557db['VoiceExtensionId']});}}if(_0x4557db['type']===_0x05c0('0x1a')&&_0x4557db[_0x05c0('0xe')](_0x05c0('0x36'))){if(_0x4557db[_0x05c0('0x36')]){_0x5a75b4[_0x05c0('0x13')]({'type':_0x4557db[_0x05c0('0x14')],'app':'ExecIf','appdata':_0x05c0('0x37')+_0x4557db[_0x05c0('0x36')]+')','context':_0x4557db[_0x05c0('0x18')],'exten':_0x4557db[_0x05c0('0xa')],'priority':_0xaa5d53['length']+_0x1e76da[_0x05c0('0xf')]+_0x16e5f7++,'VoiceExtensionId':_0x4557db[_0x05c0('0x19')]});}else{_0x5a75b4[_0x05c0('0x13')]({'type':_0x4557db[_0x05c0('0x14')],'app':'ExecIf','appdata':_0x05c0('0x38'),'context':_0x4557db[_0x05c0('0x18')],'exten':_0x4557db[_0x05c0('0xa')],'priority':_0xaa5d53[_0x05c0('0x2c')]+_0x1e76da['priority']+_0x16e5f7++,'VoiceExtensionId':_0x4557db[_0x05c0('0x19')]});}}if(_0x4557db[_0x05c0('0xe')]('answer')){if(_0x5a3e65[_0x05c0('0x39')](_0x4557db['app']['toLowerCase']())>=0x0&&_0x4557db[_0x05c0('0x3a')]!=='custom'){if(_0x4557db[_0x05c0('0x3b')]){_0x5a75b4[_0x05c0('0x13')]({'type':_0x4557db[_0x05c0('0x14')],'app':_0x05c0('0x1f'),'appdata':_0x05c0('0x3c'),'context':_0x4557db[_0x05c0('0x18')],'exten':_0x4557db['exten'],'priority':_0xaa5d53[_0x05c0('0x2c')]+_0x1e76da['priority']+_0x16e5f7++,'VoiceExtensionId':_0x4557db[_0x05c0('0x19')]});_0x5a75b4[_0x05c0('0x13')]({'type':_0x4557db[_0x05c0('0x14')],'app':_0x05c0('0x15'),'appdata':_0x05c0('0x3d'),'context':_0x4557db[_0x05c0('0x18')],'exten':_0x4557db[_0x05c0('0xa')],'priority':_0xaa5d53['length']+_0x1e76da['priority']+_0x16e5f7++,'VoiceExtensionId':_0x4557db['VoiceExtensionId']});}else{_0x5a75b4[_0x05c0('0x13')]({'type':_0x4557db[_0x05c0('0x14')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4557db[_0x05c0('0x18')],'exten':_0x4557db[_0x05c0('0xa')],'priority':_0xaa5d53[_0x05c0('0x2c')]+_0x1e76da[_0x05c0('0xf')]+_0x16e5f7++,'VoiceExtensionId':_0x4557db[_0x05c0('0x19')]});_0x5a75b4[_0x05c0('0x13')]({'type':_0x4557db[_0x05c0('0x14')],'app':'Set','appdata':_0x05c0('0x3e'),'context':_0x4557db[_0x05c0('0x18')],'exten':_0x4557db[_0x05c0('0xa')],'priority':_0xaa5d53[_0x05c0('0x2c')]+_0x1e76da['priority']+_0x16e5f7++,'VoiceExtensionId':_0x4557db[_0x05c0('0x19')]});}}}for(var _0x4c47e5=0x0;_0x4c47e5<_0xaa5d53[_0x05c0('0x2c')];_0x4c47e5+=0x1){var _0x30bc90=_0x1e76da['priority']+_0xaa5d53[_0x05c0('0x2c')];var _0x58bf78=_0x4c47e5===_0xaa5d53[_0x05c0('0x2c')]-0x1?_0x1e76da[_0x05c0('0xf')]+_0x5a75b4[_0x05c0('0x2c')]+_0x595b0a[_0x05c0('0x2c')]+0x2:_0x1e76da[_0x05c0('0xf')]+_0x4c47e5+0x1;_0x5a75b4[_0x05c0('0x3f')](_0x4c47e5,0x0,{'type':_0x4557db['type'],'app':_0x05c0('0x40'),'appdata':_0xaa5d53[_0x4c47e5]+'?'+_0x4557db[_0x05c0('0x18')]+_0x05c0('0x41')+_0x30bc90+':'+_0x4557db[_0x05c0('0x18')]+_0x05c0('0x41')+_0x58bf78,'exten':_0x4557db[_0x05c0('0xa')],'context':_0x4557db['context'],'priority':_0x1e76da[_0x05c0('0xf')]+_0x4c47e5,'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});}_0x4557db[_0x05c0('0xf')]=_0x5a75b4[_0x05c0('0x2c')]?_[_0x05c0('0x42')](_0x5a75b4)[_0x05c0('0xf')]+0x1:_0x1e76da[_0x05c0('0xf')];_0x1e76da[_0x05c0('0xf')]=(_0x595b0a[_0x05c0('0x2c')]?_[_0x05c0('0x42')](_0x595b0a)[_0x05c0('0xf')]:_0x4557db[_0x05c0('0xf')])+0x1;_0x1e76da['extensions']=_['concat'](_0x1e76da['extensions'],_0x5a75b4,[_0x4557db],_0x595b0a);}_0x1e76da[_0x05c0('0x10')][_0x05c0('0x13')]({'type':_0x205cec[_0x20ff48][0x0][_0x05c0('0x14')],'app':'Hangup','exten':_0x205cec[_0x20ff48][0x0][_0x05c0('0xa')],'context':_0x205cec[_0x20ff48][0x0][_0x05c0('0x18')],'priority':_0x1e76da[_0x05c0('0xf')],'VoiceExtensionId':_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]});_0x16a290[_0x05c0('0x13')](_0x205cec[_0x20ff48][0x0][_0x05c0('0x19')]);_0x49e07e=_[_0x05c0('0x43')](_0x49e07e,_0x1e76da['extensions']);}}return _0x1c3b79[_0x05c0('0x44')](function(_0x27bd43){return _0x1c3b79[_0x05c0('0x5')][_0x05c0('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x16a290}},'transaction':_0x27bd43})['then'](function(_0x5e4941){return _0x1c3b79[_0x05c0('0x5')][_0x05c0('0x6')][_0x05c0('0x45')](_[_0x05c0('0x46')](_0x49e07e,_0x05c0('0xf')),{'transaction':_0x27bd43});});});})[_0x05c0('0x47')](function(_0x2d7e51){console['error'](_0x2d7e51);});}exports[_0x05c0('0x48')]=rewrite; \ No newline at end of file +var _0xae2b=['${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','cutdigits','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','length','toLowerCase','updatedAt','*,*,*,*','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','type','context','VoiceExtensionId','CDR(destination)='];(function(_0x35ba0a,_0x57eaeb){var _0x4bddb0=function(_0x4a5600){while(--_0x4a5600){_0x35ba0a['push'](_0x35ba0a['shift']());}};_0x4bddb0(++_0x57eaeb);}(_0xae2b,0xb3));var _0xbae2=function(_0x4e0091,_0xc1ffc9){_0x4e0091=_0x4e0091-0x0;var _0x4c16a9=_0xae2b[_0x4e0091];return _0x4c16a9;};'use strict';var _=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));function rewrite(_0x55ac17,_0x22b0f0){var _0x247e63=this;return _0x55ac17[_0xbae2('0x2')][_0xbae2('0x3')][_0xbae2('0x4')]({'raw':!![]})[_0xbae2('0x5')](function(_0x564f86){_0x247e63[_0xbae2('0x6')]=_0x564f86;return _0x55ac17['models'][_0xbae2('0x7')][_0xbae2('0x4')]({'where':{'IntervalId':_0x22b0f0[_0xbae2('0x8')]},'raw':!![]});})['then'](function(_0x4788c4){return _0x55ac17['models']['VoiceExtension'][_0xbae2('0x4')]({'where':{'exten':{'$in':_[_0xbae2('0x9')](_[_0xbae2('0xa')](_0x4788c4,_0xbae2('0xb')))}},'order':[{'raw':_0xbae2('0xc')}],'raw':!![]});})[_0xbae2('0x5')](function(_0x843207){var _0x5a6d1f=_['filter'](_0x843207,{'priority':'1'});var _0x5207c7=_[_0xbae2('0xd')](_0x843207,{'isApp':0x1});var _0x5d6940=_[_0xbae2('0xe')](_0x5207c7,_0xbae2('0xb'));var _0x1b28ce=['queue',_0xbae2('0xf')];var _0x7de704=[];var _0x5b5222=[];for(var _0x156edd in _0x5d6940){if(_0x5d6940[_0xbae2('0x10')](_0x156edd)){_0x247e63[_0xbae2('0x11')]=0x2;_0x247e63[_0xbae2('0x12')]=[];_0x247e63[_0xbae2('0x13')]=_[_0xbae2('0x14')](_0x5a6d1f,{'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')]});_0x247e63['extensions'][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':util[_0xbae2('0x17')]('CDR(type)=%s',_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')]),'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0]['exten'],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});if(_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')]==='outbound'){if(_0x247e63[_0xbae2('0x13')]){_0x247e63['extensions']['push']({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x1b')+(_0x247e63[_0xbae2('0x13')]['cutdigits']?_0xbae2('0x1c')+_0x247e63[_0xbae2('0x13')]['cutdigits']+'}':'${EXTEN}'),'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});}_0x247e63[_0xbae2('0x12')]['push']({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x1d')+_0x5d6940[_0x156edd][0x0]['VoiceExtensionId'],'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});var _0x5b084f=_0x247e63[_0xbae2('0x11')]++;_0x247e63['extensions'][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':_0xbae2('0x1e'),'appdata':_0xbae2('0x1f')+(_0x5b084f+0x2)+_0xbae2('0x20')+(_0x5b084f+0x1)+')','context':_0x5d6940[_0x156edd][0x0]['context'],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x5b084f,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});if(_0x247e63['extension']){_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0x247e63[_0xbae2('0x13')]['cutdigits']?_0xbae2('0x21')+_0x247e63['extension'][_0xbae2('0x22')]+'}':_0xbae2('0x23'),'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});}_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x24')+_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')],'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});if(_0x247e63['extension']&&_0x247e63[_0xbae2('0x13')][_0xbae2('0x10')]('recordingFormat')&&_0x247e63['extension'][_0xbae2('0x25')]!==_0xbae2('0x26')){_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x27'),'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':'Set','appdata':_0xbae2('0x28')+_0x247e63[_0xbae2('0x13')][_0xbae2('0x25')]||_0xbae2('0x29'),'context':_0x5d6940[_0x156edd][0x0]['context'],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});}}_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});_0x247e63['extensions'][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});_0x247e63[_0xbae2('0x12')]['push']({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});for(var _0x35be12=0x0,_0x192bd3=0x0;_0x35be12<_0x5d6940[_0x156edd][_0xbae2('0x2a')];_0x35be12+=0x1,_0x192bd3=0x0){var _0x307457=_0x5d6940[_0x156edd][_0x35be12];if(_0x307457[_0xbae2('0x18')]){_0x307457[_0xbae2('0x18')]=_0x307457[_0xbae2('0x18')][_0xbae2('0x2b')]();}var _0x566db5=[];var _0x4df97a=[];delete _0x307457['id'];delete _0x307457['createdAt'];delete _0x307457[_0xbae2('0x2c')];var _0x20e1e1=_0x307457['interval']!==_0xbae2('0x2d')?[_0x307457[_0xbae2('0x2e')]]:_0x307457[_0xbae2('0x8')]?_[_0xbae2('0xa')](_[_0xbae2('0xd')](_0x247e63['intervals'],{'IntervalId':_0x307457['IntervalId']}),_0xbae2('0x2e')):[];if(_0x307457['hasOwnProperty'](_0xbae2('0x2f'))){if(_0x307457[_0xbae2('0x2f')]&&_0x307457[_0xbae2('0x2f')]!=='--'){_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':'Set','appdata':'CDR(tag)='+_0x307457['tag'],'context':_0x307457[_0xbae2('0x19')],'exten':_0x307457['exten'],'priority':_0x20e1e1['length']+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});}}if(_0x307457['type']==='outbound'&&_0x307457['hasOwnProperty']('callerID')){if(_0x307457[_0xbae2('0x30')]){_0x566db5[_0xbae2('0x15')]({'type':_0x307457['type'],'app':_0xbae2('0x1e'),'appdata':_0xbae2('0x31')+_0x307457[_0xbae2('0x30')]+')','context':_0x307457[_0xbae2('0x19')],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1[_0xbae2('0x2a')]+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});}else{_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x1e'),'appdata':_0xbae2('0x32'),'context':_0x307457['context'],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1['length']+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457['VoiceExtensionId']});}}if(_0x307457[_0xbae2('0x10')](_0xbae2('0x33'))){if(_0x1b28ce['indexOf'](_0x307457['app'][_0xbae2('0x2b')]())>=0x0&&_0x307457[_0xbae2('0x34')]!==_0xbae2('0x35')){if(_0x307457[_0xbae2('0x33')]){_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x1e'),'appdata':_0xbae2('0x36'),'context':_0x307457['context'],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1[_0xbae2('0x2a')]+_0x247e63['priority']+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x37'),'context':_0x307457[_0xbae2('0x19')],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1['length']+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});}else{_0x566db5[_0xbae2('0x15')]({'type':_0x307457['type'],'app':_0xbae2('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x307457[_0xbae2('0x19')],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1[_0xbae2('0x2a')]+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x38'),'context':_0x307457[_0xbae2('0x19')],'exten':_0x307457['exten'],'priority':_0x20e1e1[_0xbae2('0x2a')]+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});}}}for(var _0x30baa6=0x0;_0x30baa6<_0x20e1e1[_0xbae2('0x2a')];_0x30baa6+=0x1){var _0x2472d8=_0x247e63[_0xbae2('0x11')]+_0x20e1e1[_0xbae2('0x2a')];var _0x4fce75=_0x30baa6===_0x20e1e1['length']-0x1?_0x247e63[_0xbae2('0x11')]+_0x566db5[_0xbae2('0x2a')]+_0x4df97a[_0xbae2('0x2a')]+0x2:_0x247e63['priority']+_0x30baa6+0x1;_0x566db5[_0xbae2('0x39')](_0x30baa6,0x0,{'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x3a'),'appdata':_0x20e1e1[_0x30baa6]+'?'+_0x307457[_0xbae2('0x19')]+_0xbae2('0x3b')+_0x2472d8+':'+_0x307457[_0xbae2('0x19')]+_0xbae2('0x3b')+_0x4fce75,'exten':_0x307457[_0xbae2('0xb')],'context':_0x307457['context'],'priority':_0x247e63[_0xbae2('0x11')]+_0x30baa6,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0]['VoiceExtensionId']});}_0x307457[_0xbae2('0x11')]=_0x566db5['length']?_[_0xbae2('0x3c')](_0x566db5)['priority']+0x1:_0x247e63[_0xbae2('0x11')];_0x247e63['priority']=(_0x4df97a['length']?_[_0xbae2('0x3c')](_0x4df97a)[_0xbae2('0x11')]:_0x307457['priority'])+0x1;_0x247e63[_0xbae2('0x12')]=_[_0xbae2('0x3d')](_0x247e63[_0xbae2('0x12')],_0x566db5,[_0x307457],_0x4df97a);}_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x3e'),'exten':_0x5d6940[_0x156edd][0x0]['exten'],'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'priority':_0x247e63['priority'],'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});_0x7de704[_0xbae2('0x15')](_0x5d6940[_0x156edd][0x0]['VoiceExtensionId']);_0x5b5222=_['concat'](_0x5b5222,_0x247e63[_0xbae2('0x12')]);}}return _0x55ac17[_0xbae2('0x3f')](function(_0x33888e){return _0x55ac17[_0xbae2('0x2')][_0xbae2('0x7')][_0xbae2('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x7de704}},'transaction':_0x33888e})['then'](function(_0x1e09de){return _0x55ac17[_0xbae2('0x2')][_0xbae2('0x7')][_0xbae2('0x41')](_[_0xbae2('0x42')](_0x5b5222,_0xbae2('0x11')),{'transaction':_0x33888e});});});})[_0xbae2('0x43')](function(_0x5d8aa1){console['error'](_0x5d8aa1);});}exports[_0xbae2('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d3d4925..9aaa930 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate'];(function(_0x6810d0,_0x4565c3){var _0x568796=function(_0x20bb42){while(--_0x20bb42){_0x6810d0['push'](_0x6810d0['shift']());}};_0x568796(++_0x4565c3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file +var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x37ad22,_0x9ee922){var _0x30af42=function(_0x39aacc){while(--_0x39aacc){_0x37ad22['push'](_0x37ad22['shift']());}};_0x30af42(++_0x9ee922);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xcb91[_0xa30766];return _0x24e780;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index da4e940..2910c80 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x334f=['finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','root','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.UserId','insert','into','fromQuery','ListId','updatedAt','UserId','recallme','select','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','cm_contacts.ListId','cm_contacts.updatedAt','ContactId','createdAt','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','\x20=\x20?','toString','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','error','message','errors','push','sequelize','spread','catch','main','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','createReadStream','data','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','firstName','\x20not\x20specified','length','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then'];(function(_0x5d1573,_0x4d9269){var _0xfd2774=function(_0x44d498){while(--_0x44d498){_0x5d1573['push'](_0x5d1573['shift']());}};_0xfd2774(++_0x4d9269);}(_0x334f,0x196));var _0xf334=function(_0x4efcac,_0x12567c){_0x4efcac=_0x4efcac-0x0;var _0x57800f=_0x334f[_0x4efcac];return _0x57800f;};'use strict';var fs=require('fs');var path=require(_0xf334('0x0'));var _=require('lodash');var Papa=require(_0xf334('0x1'));var util=require(_0xf334('0x2'));var BPromise=require(_0xf334('0x3'));var moment=require(_0xf334('0x4'));var squel=require(_0xf334('0x5'));var Redis=require('ioredis');var db=require(_0xf334('0x6'))['db'];var config=require(_0xf334('0x7'));var logger=require(_0xf334('0x8'))(_0xf334('0x9'));config[_0xf334('0xa')]=_['defaults'](config[_0xf334('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf334('0xb'))(new Redis(config[_0xf334('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xf334('0xc')](_0xf334('0xd'));function isEmail(_0x17fa57){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xf334('0xe')](_0x17fa57);}function selectNotIn(_0x27c7cb,_0x375a27,_0x85b04c,_0x17547e,_0x33ffa8){return squel['select']()[_0xf334('0xf')](_0xf334('0x10'))[_0xf334('0x11')](_0x17547e)[_0xf334('0x12')](_0x375a27,null,_0x375a27+_0xf334('0x13')+_0x17547e+'.'+_0x85b04c)[_0xf334('0x14')](_0x17547e+'.'+_0x85b04c+_0xf334('0x15')+_0x27c7cb+'.'+_0x85b04c)[_0xf334('0x14')](_0x375a27+'.dialCheckDuplicateType\x20IN\x20('+_0x33ffa8['join']()+')');}function insertCmHopper(_0x176b08,_0x5f5a3f,_0x694350,_0x975076,_0x309295){var _0x13e20b=[_0xf334('0x16'),'cm_contacts.scheduledat',_0xf334('0x17'),'cm_contacts.ListId',_0x5f5a3f+'.'+_0x975076,_0xf334('0x18'),'cm_contacts.updatedAt','cm_contacts.priority',_0xf334('0x19'),'\x22'+_0x309295+'\x22'];return squel[_0xf334('0x1a')]()[_0xf334('0x1b')]('cm_hopper')[_0xf334('0x1c')](['phone','scheduledat','ContactId',_0xf334('0x1d'),_0x975076,'createdAt',_0xf334('0x1e'),'priority',_0xf334('0x1f'),_0xf334('0x20')],squel[_0xf334('0x21')]()[_0xf334('0x22')](_0x13e20b)[_0xf334('0x11')](_0x5f5a3f)[_0xf334('0x12')](_0xf334('0x23'),null,'cm_contacts.ListId\x20=\x20'+_0x5f5a3f+_0xf334('0x24'))['join'](_0x694350,null,_0x694350+_0xf334('0x13')+_0x5f5a3f+'.'+_0x975076)[_0xf334('0x14')](_0x5f5a3f+_0xf334('0x25'),_0x176b08)[_0xf334('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf334('0x14')](_0xf334('0x26'),selectNotIn(_0x5f5a3f,_0x694350,_0x975076,_0xf334('0x27'),[_0xf334('0x28'),'\x22onlyIfOpen\x22']))[_0xf334('0x14')](_0xf334('0x26'),selectNotIn(_0x5f5a3f,_0x694350,_0x975076,_0xf334('0x27'),[_0xf334('0x28')])))['toString']();}function insertCmHopperBlack(_0xd71871,_0x744080,_0x5963fc,_0x4f6d67){var _0x45a9fb=[_0xf334('0x16'),'cm_contacts.id',_0xf334('0x29'),_0x744080+'.'+_0x4f6d67,_0xf334('0x18'),_0xf334('0x2a')];return squel['insert']()[_0xf334('0x1b')]('cm_hopper_black')[_0xf334('0x1c')](['phone',_0xf334('0x2b'),_0xf334('0x1d'),_0x4f6d67,_0xf334('0x2c'),'updatedAt'],squel['select']()[_0xf334('0x22')](_0x45a9fb)[_0xf334('0x11')](_0x744080)[_0xf334('0x12')](_0xf334('0x23'),null,'cm_contacts.ListId\x20=\x20'+_0x744080+_0xf334('0x24'))[_0xf334('0x12')](_0x5963fc,null,_0x5963fc+'.id\x20=\x20'+_0x744080+'.'+_0x4f6d67)[_0xf334('0x14')](_0x744080+_0xf334('0x25'),_0xd71871)[_0xf334('0x14')](_0xf334('0x2d'),NOW)[_0xf334('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf334('0x21')]()[_0xf334('0xf')](_0xf334('0x10'))[_0xf334('0x11')](_0xf334('0x2e'))['where']('ListId\x20=\x20?',_0xd71871)[_0xf334('0x14')](_0x4f6d67+_0xf334('0x2f'),_0x744080+'.'+_0x4f6d67)))[_0xf334('0x30')]();}function insertCmContact(_0x175c32,_0x1f6ce3,_0x58d283,_0x2eda27){var _0xba7878=_[_0xf334('0x31')](_[_0xf334('0x32')](_0x2eda27),[_0xf334('0x1d'),_0xf334('0x33'),_0xf334('0x2c'),_0xf334('0x1e')]);return squel[_0xf334('0x1a')]()[_0xf334('0x1b')](_0xf334('0x23'))[_0xf334('0x1c')](_0xba7878,squel['select']()[_0xf334('0x22')](_0xba7878)[_0xf334('0x11')](_0x1f6ce3)[_0xf334('0x14')]('('+_0x58d283[_0xf334('0x12')](',')+_0xf334('0x34'),squel[_0xf334('0x21')]()[_0xf334('0x22')](_0x58d283)['from']('cm_contacts')['where'](_0xf334('0x35'),_0x175c32)[_0xf334('0x14')](_0xf334('0x36')))[_0xf334('0x14')](_0xf334('0x37'),squel[_0xf334('0x21')]()[_0xf334('0xf')](_0xf334('0x38'),_0xf334('0x39'))['from'](_0x1f6ce3)['group'](_0x58d283[_0xf334('0x12')](','))))[_0xf334('0x30')]();}function handleStop(){logger[_0xf334('0x3a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xf2d8cb){logger[_0xf334('0x3b')](_0xf2d8cb[_0xf334('0x3c')]);process['exit'](0x1);}function handleError(_0x51f3d5,_0xc352e2){stats[_0xf334('0x3d')][_0xf334('0x3e')]({'name':_0xc352e2['code'],'message':_0xc352e2['message'],'row':_0x51f3d5});}function handleQuery(_0x5adba0){logger[_0xf334('0x3a')](_0x5adba0);return db[_0xf334('0x3f')]['query'](_0x5adba0)[_0xf334('0x40')](function(_0x17169c){results[_0xf334('0x3e')](_0x17169c);})[_0xf334('0x41')](function(_0x2d3986){logger[_0xf334('0x3b')](_0x2d3986['message']);});}function main(_0x150012,_0x4eb769,_0x15cbbf,_0x3e6635){logger['info'](_0xf334('0x42'),_0x150012,JSON[_0xf334('0x43')](_0x4eb769));process[_0xf334('0x44')](_0xf334('0x45'));var _0x40fb54=_0x4eb769[_0xf334('0x46')];var _0x547963=_0x4eb769[_0xf334('0x47')];var _0x8f750f=path[_0xf334('0x12')](config['root'],_0xf334('0x48'),_0x547963+_0xf334('0x49'));var _0x15ac20=_['keys'](_0x40fb54)[_0xf334('0x12')]();logger[_0xf334('0x3a')]('header',_0x15ac20);fs['writeFileSync'](_0x8f750f,_0x15ac20+'\x0a');Papa['parse'](fs[_0xf334('0x4a')](_0x150012),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2fbc0c,_0x139bb0){try{for(var _0x493e78=0x0,_0x162981=[];_0x493e78<_0x2fbc0c[_0xf334('0x4b')]['length'];_0x493e78++){stats['rows']+=0x1;if(_0x2fbc0c[_0xf334('0x3d')][_0x493e78]){handleError(_0x2fbc0c['data'][_0x493e78],_0x2fbc0c[_0xf334('0x3d')][_0x493e78]);}else{var _0x5a86d9=[];for(var _0x457757 in _0x40fb54){if(_0x40fb54[_0xf334('0x4c')](_0x457757)){if(_0x2fbc0c[_0xf334('0x4b')][_0x493e78][_0x40fb54[_0x457757]]){var _0xe009c6=_[_0xf334('0x4d')](_0x2fbc0c['data'][_0x493e78][_0x40fb54[_0x457757]][_0xf334('0x4e')](/"/g,'\x27'));switch(_0x457757){case _0xf334('0x4f'):var _0x354aa3=moment(_0xe009c6,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x354aa3[_0xf334('0x50')]()){_0x162981[_0xf334('0x3e')]('\x22'+_0xe009c6+'\x22');}else{_0x5a86d9['push'](_0xf334('0x51'));}break;case _0xf334('0x52'):var _0x56d5de=parseInt(_0xe009c6);_0xe009c6=_['isNaN'](_0x56d5de)||_0x56d5de<0x0||_0x56d5de>0x4?_0x3e6635?0x3:0x2:_0x56d5de;_0x162981['push']('\x22'+_0xe009c6+'\x22');break;case _0xf334('0x1f'):var _0x32063a=parseInt(_0xe009c6);if(_[_0xf334('0x53')](_0x32063a)&&_[_0xf334('0x54')](_0x15cbbf,_0x32063a)){_0x162981['push']('\x22'+_0x32063a+'\x22');}else{_0x5a86d9[_0xf334('0x3e')](_0xf334('0x55'));}break;case _0xf334('0x56'):if(isEmail(_0xe009c6)){_0x162981[_0xf334('0x3e')]('\x22'+_0xe009c6+'\x22');}else{_0x5a86d9[_0xf334('0x3e')](_0xf334('0x57'));}break;case _0xf334('0x58'):var _0x2d473c=moment(_0xe009c6,'YYYY-MM-DD',!![]);if(_0x2d473c[_0xf334('0x50')]()){_0x162981[_0xf334('0x3e')]('\x22'+_0xe009c6+'\x22');}else{_0x5a86d9[_0xf334('0x3e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x162981['push']('\x22'+_0xe009c6+'\x22');}}else{switch(_0x457757){case _0xf334('0x59'):case _0xf334('0x10'):_0x5a86d9[_0xf334('0x3e')](_0x457757+_0xf334('0x5a'));break;default:_0x162981[_0xf334('0x3e')]('\x22\x22');}}}}if(_0x5a86d9[_0xf334('0x5b')]){handleError(_0x2fbc0c[_0xf334('0x4b')][_0x493e78],{'code':_0xf334('0x5c'),'message':_0x5a86d9[_0xf334('0x12')]()});}else{fs[_0xf334('0x5d')](_0x8f750f,_0x162981[_0xf334('0x12')]()+'\x0a');}_0x162981=[];}if(!(stats[_0xf334('0x5e')]%0xc8)){socket[_0xf334('0x5f')](_0xf334('0x60')+_0x547963,stats);stats[_0xf334('0x3d')]=[];}}if(stopped){logger[_0xf334('0x3a')](_0xf334('0x61'));_0x139bb0[_0xf334('0x62')]();}}catch(_0x3551b7){handleError(_0x2fbc0c['data'][_0x493e78],{'code':_0xf334('0x63'),'message':_0x3551b7[_0xf334('0x3c')]});logger['error'](_0xf334('0x64'),_0x3551b7[_0xf334('0x3c')]);}},'complete':function(){try{var _0x5d0de9=[];var _0x5d6306=_0xf334('0x23');if(_0x4eb769[_0xf334('0x65')]&&_0x4eb769['duplicates']['length']){_0x5d6306=_0xf334('0x66')+_0x547963;_0x5d0de9[_0xf334('0x3e')](_0xf334('0x67')+_0x5d6306+_0xf334('0x68'));}var _0x1a405b=util[_0xf334('0xc')](_0xf334('0x69'),_0x8f750f,_0x5d6306,_0x15ac20,_0x4eb769['ListId'],_0x4eb769[_0xf334('0x33')]||null,NOW,NOW);if(_[_0xf334('0x6a')](_0x40fb54[_0xf334('0x4f')])){_0x1a405b+=_0xf334('0x6b');}_0x5d0de9[_0xf334('0x3e')](_0x1a405b);if(_0x4eb769[_0xf334('0x65')]&&_0x4eb769[_0xf334('0x65')][_0xf334('0x5b')]){_0x5d0de9['push'](insertCmContact(_0x4eb769['ListId'],_0x5d6306,_0x4eb769[_0xf334('0x65')],_0x40fb54));_0x5d0de9[_0xf334('0x3e')](_0xf334('0x6c')+_0x5d6306+';');}_0x5d0de9[_0xf334('0x3e')](insertCmHopper(_0x4eb769[_0xf334('0x1d')],_0xf334('0x6d'),_0xf334('0x6e'),'VoiceQueueId',_0x3e6635));_0x5d0de9[_0xf334('0x3e')](insertCmHopperBlack(_0x4eb769[_0xf334('0x1d')],_0xf334('0x6f'),_0xf334('0x6e'),_0xf334('0x70')));_0x5d0de9[_0xf334('0x3e')](insertCmHopper(_0x4eb769[_0xf334('0x1d')],'campaigns_has_cm_lists',_0xf334('0x71'),_0xf334('0x72'),_0x3e6635));_0x5d0de9[_0xf334('0x3e')](insertCmHopperBlack(_0x4eb769[_0xf334('0x1d')],_0xf334('0x73'),_0xf334('0x71'),_0xf334('0x72')));BPromise[_0xf334('0x74')](_0x5d0de9,handleQuery)[_0xf334('0x75')](function(_0x28027a){stats[_0xf334('0x76')]=!![];stats['affectedRows']=_0x4eb769[_0xf334('0x65')]&&_0x4eb769['duplicates'][_0xf334('0x5b')]?results[0x2][_0xf334('0x77')]:results[0x0]['affectedRows'];socket[_0xf334('0x5f')](_0xf334('0x60')+_0x547963,stats);fs[_0xf334('0x78')](_0x150012);fs[_0xf334('0x78')](_0x8f750f);process[_0xf334('0x79')](0x0);})[_0xf334('0x41')](function(_0x25041e){logger[_0xf334('0x3b')](_0x25041e[_0xf334('0x3c')]);process[_0xf334('0x79')](0x1);});}catch(_0x7202ba){logger[_0xf334('0x3b')](_0xf334('0x7a'),_0x7202ba[_0xf334('0x3c')]);process[_0xf334('0x79')](0x1);}},'error':function(_0x53eef1,_0x3f8710,_0x3e615f,_0x55ede9){throw new Error(_0x55ede9);}});}function validate(){if(process[_0xf334('0x7b')]&&process[_0xf334('0x7b')][_0xf334('0x5b')]<0x4){throw new Error(_0xf334('0x7c'));}var _0x4a2f30=path[_0xf334('0x12')](config[_0xf334('0x7d')],_0xf334('0x48'),process['argv'][0x2]);if(!fs['existsSync'](_0x4a2f30)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x21c8ec={};try{_0x21c8ec=JSON[_0xf334('0x7e')](process[_0xf334('0x7b')][0x3]);if(!_0x21c8ec[_0xf334('0x46')]){throw new Error(_0xf334('0x7f'));}if(!_0x21c8ec[_0xf334('0x46')][_0xf334('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x21c8ec['binding'][_0xf334('0x59')]){throw new Error('firstName\x20is\x20mandatory');}var _0x1879a8=0x0;if(_0x21c8ec['binding'][_0xf334('0x1f')]){_0x1879a8=0x1;}if(!_0x21c8ec[_0xf334('0x1d')]){throw new Error(_0xf334('0x80'));}}catch(_0xc35bd5){throw new Error('body\x20id\x20mandatory');}var _0x1e500c=[];try{_0x1e500c=_['map'](JSON['parse'](process[_0xf334('0x7b')][0x4]),'id');}catch(_0x160ebd){logger[_0xf334('0x3a')]('No\x20agent\x20available');}main(_0x4a2f30,_0x21c8ec,_0x1e500c,_0x1879a8);}validate();process['on'](_0xf334('0x81'),handleStop);process['on'](_0xf334('0x82'),handleUncaughtException); \ No newline at end of file +var _0x4ba9=['arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','phone','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','spread','stringify','start','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','createReadStream','data','length','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','catch','argv'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x4ba9,0x93));var _0x94ba=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0x4ba9[_0x4a7843];return _0x2c57fe;};'use strict';var fs=require('fs');var path=require(_0x94ba('0x0'));var _=require(_0x94ba('0x1'));var Papa=require('papaparse');var util=require(_0x94ba('0x2'));var BPromise=require(_0x94ba('0x3'));var moment=require(_0x94ba('0x4'));var squel=require(_0x94ba('0x5'));var Redis=require(_0x94ba('0x6'));var db=require(_0x94ba('0x7'))['db'];var config=require(_0x94ba('0x8'));var logger=require('../../../config/logger')(_0x94ba('0x9'));config[_0x94ba('0xa')]=_[_0x94ba('0xb')](config[_0x94ba('0xa')],{'host':_0x94ba('0xc'),'port':0x18eb});var socket=require(_0x94ba('0xd'))(new Redis(config[_0x94ba('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x94ba('0xe')](_0x94ba('0xf'));function isEmail(_0xaf9567){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x94ba('0x10')](_0xaf9567);}function selectNotIn(_0x4118ae,_0x329a8a,_0x5c0b97,_0x3c7266,_0x386987){return squel[_0x94ba('0x11')]()[_0x94ba('0x12')]('phone')['from'](_0x3c7266)[_0x94ba('0x13')](_0x329a8a,null,_0x329a8a+_0x94ba('0x14')+_0x3c7266+'.'+_0x5c0b97)[_0x94ba('0x15')](_0x3c7266+'.'+_0x5c0b97+_0x94ba('0x16')+_0x4118ae+'.'+_0x5c0b97)[_0x94ba('0x15')](_0x329a8a+_0x94ba('0x17')+_0x386987[_0x94ba('0x13')]()+')');}function insertCmHopper(_0x1fd0dd,_0x145113,_0x264981,_0x103dde,_0xf1f8d2){var _0x4539ad=[_0x94ba('0x18'),_0x94ba('0x19'),_0x94ba('0x1a'),_0x94ba('0x1b'),_0x145113+'.'+_0x103dde,_0x94ba('0x1c'),'cm_contacts.updatedAt',_0x94ba('0x1d'),_0x94ba('0x1e'),'\x22'+_0xf1f8d2+'\x22'];return squel[_0x94ba('0x1f')]()[_0x94ba('0x20')]('cm_hopper')[_0x94ba('0x21')](['phone',_0x94ba('0x22'),_0x94ba('0x23'),_0x94ba('0x24'),_0x103dde,_0x94ba('0x25'),_0x94ba('0x26'),_0x94ba('0x27'),_0x94ba('0x28'),_0x94ba('0x29')],squel[_0x94ba('0x11')]()[_0x94ba('0x2a')](_0x4539ad)[_0x94ba('0x2b')](_0x145113)['join'](_0x94ba('0x2c'),null,_0x94ba('0x2d')+_0x145113+'.CmListId')[_0x94ba('0x13')](_0x264981,null,_0x264981+'.id\x20=\x20'+_0x145113+'.'+_0x103dde)['where'](_0x145113+_0x94ba('0x2e'),_0x1fd0dd)[_0x94ba('0x15')](_0x94ba('0x2f'),NOW)[_0x94ba('0x15')](_0x94ba('0x30'),selectNotIn(_0x145113,_0x264981,_0x103dde,_0x94ba('0x31'),[_0x94ba('0x32'),_0x94ba('0x33')]))[_0x94ba('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x145113,_0x264981,_0x103dde,_0x94ba('0x31'),[_0x94ba('0x32')])))[_0x94ba('0x34')]();}function insertCmHopperBlack(_0x5d730f,_0x52d20c,_0x3e0236,_0x3d3fca){var _0x41d32b=['cm_contacts.phone',_0x94ba('0x1a'),_0x94ba('0x1b'),_0x52d20c+'.'+_0x3d3fca,'cm_contacts.createdAt',_0x94ba('0x35')];return squel[_0x94ba('0x1f')]()[_0x94ba('0x20')]('cm_hopper_black')[_0x94ba('0x21')]([_0x94ba('0x36'),'ContactId',_0x94ba('0x24'),_0x3d3fca,_0x94ba('0x25'),_0x94ba('0x26')],squel[_0x94ba('0x11')]()['fields'](_0x41d32b)[_0x94ba('0x2b')](_0x52d20c)[_0x94ba('0x13')](_0x94ba('0x2c'),null,_0x94ba('0x2d')+_0x52d20c+'.CmListId')[_0x94ba('0x13')](_0x3e0236,null,_0x3e0236+_0x94ba('0x14')+_0x52d20c+'.'+_0x3d3fca)[_0x94ba('0x15')](_0x52d20c+_0x94ba('0x2e'),_0x5d730f)[_0x94ba('0x15')](_0x94ba('0x2f'),NOW)[_0x94ba('0x15')](_0x94ba('0x30'),squel[_0x94ba('0x11')]()[_0x94ba('0x12')](_0x94ba('0x36'))[_0x94ba('0x2b')](_0x94ba('0x37'))[_0x94ba('0x15')](_0x94ba('0x38'),_0x5d730f)[_0x94ba('0x15')](_0x3d3fca+_0x94ba('0x39'),_0x52d20c+'.'+_0x3d3fca)))['toString']();}function insertCmContact(_0x34df43,_0x4a5167,_0x49f632,_0x565e6d){var _0x4a836a=_['concat'](_[_0x94ba('0x3a')](_0x565e6d),[_0x94ba('0x24'),'CompanyId',_0x94ba('0x25'),_0x94ba('0x26')]);return squel[_0x94ba('0x1f')]()[_0x94ba('0x20')](_0x94ba('0x2c'))[_0x94ba('0x21')](_0x4a836a,squel['select']()[_0x94ba('0x2a')](_0x4a836a)[_0x94ba('0x2b')](_0x4a5167)[_0x94ba('0x15')]('('+_0x49f632['join'](',')+_0x94ba('0x3b'),squel[_0x94ba('0x11')]()['fields'](_0x49f632)[_0x94ba('0x2b')](_0x94ba('0x2c'))['where'](_0x94ba('0x38'),_0x34df43)[_0x94ba('0x15')](_0x94ba('0x3c')))[_0x94ba('0x15')](_0x94ba('0x3d'),squel['select']()[_0x94ba('0x12')]('MIN(id)',_0x94ba('0x3e'))[_0x94ba('0x2b')](_0x4a5167)[_0x94ba('0x3f')](_0x49f632[_0x94ba('0x13')](','))))[_0x94ba('0x34')]();}function handleStop(){logger[_0x94ba('0x40')](_0x94ba('0x41'));stopped=!![];}function handleUncaughtException(_0x4efbaf){logger[_0x94ba('0x42')](_0x4efbaf[_0x94ba('0x43')]);process[_0x94ba('0x44')](0x1);}function handleError(_0x3a4d90,_0xb8d2e){stats[_0x94ba('0x45')][_0x94ba('0x46')]({'name':_0xb8d2e[_0x94ba('0x47')],'message':_0xb8d2e['message'],'row':_0x3a4d90});}function handleQuery(_0x330ec9){logger[_0x94ba('0x40')](_0x330ec9);return db[_0x94ba('0x48')]['query'](_0x330ec9)[_0x94ba('0x49')](function(_0x383da5){results[_0x94ba('0x46')](_0x383da5);})['catch'](function(_0x2dad2f){logger[_0x94ba('0x42')](_0x2dad2f[_0x94ba('0x43')]);});}function main(_0x4689c7,_0x7f18a,_0x4b6a2a,_0x186182){logger['info']('main',_0x4689c7,JSON[_0x94ba('0x4a')](_0x7f18a));process['send'](_0x94ba('0x4b'));var _0x40281e=_0x7f18a['binding'];var _0x4c8285=_0x7f18a[_0x94ba('0x4c')];var _0x27b676=path[_0x94ba('0x13')](config[_0x94ba('0x4d')],_0x94ba('0x4e'),_0x4c8285+'.csv');var _0x83a988=_[_0x94ba('0x3a')](_0x40281e)[_0x94ba('0x13')]();logger[_0x94ba('0x40')](_0x94ba('0x4f'),_0x83a988);fs[_0x94ba('0x50')](_0x27b676,_0x83a988+'\x0a');Papa[_0x94ba('0x51')](fs[_0x94ba('0x52')](_0x4689c7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x122dac,_0x3f67b5){try{for(var _0x938446=0x0,_0xace57a=[];_0x938446<_0x122dac[_0x94ba('0x53')][_0x94ba('0x54')];_0x938446++){stats['rows']+=0x1;if(_0x122dac['errors'][_0x938446]){handleError(_0x122dac[_0x94ba('0x53')][_0x938446],_0x122dac[_0x94ba('0x45')][_0x938446]);}else{var _0x293652=[];for(var _0x22bb5e in _0x40281e){if(_0x40281e[_0x94ba('0x55')](_0x22bb5e)){if(_0x122dac[_0x94ba('0x53')][_0x938446][_0x40281e[_0x22bb5e]]){var _0x3fdc05=_['trim'](_0x122dac['data'][_0x938446][_0x40281e[_0x22bb5e]][_0x94ba('0x56')](/"/g,'\x27'));switch(_0x22bb5e){case _0x94ba('0x22'):var _0x40cab8=moment(_0x3fdc05,_0x94ba('0xf'),!![]);if(_0x40cab8[_0x94ba('0x57')]()){_0xace57a[_0x94ba('0x46')]('\x22'+_0x3fdc05+'\x22');}else{_0x293652[_0x94ba('0x46')](_0x94ba('0x58'));}break;case _0x94ba('0x27'):var _0x16c81a=parseInt(_0x3fdc05);_0x3fdc05=_[_0x94ba('0x59')](_0x16c81a)||_0x16c81a<0x0||_0x16c81a>0x4?_0x186182?0x3:0x2:_0x16c81a;_0xace57a['push']('\x22'+_0x3fdc05+'\x22');break;case'UserId':var _0x1b7435=parseInt(_0x3fdc05);if(_['isNumber'](_0x1b7435)&&_[_0x94ba('0x5a')](_0x4b6a2a,_0x1b7435)){_0xace57a[_0x94ba('0x46')]('\x22'+_0x1b7435+'\x22');}else{_0x293652[_0x94ba('0x46')](_0x94ba('0x5b'));}break;case'email':if(isEmail(_0x3fdc05)){_0xace57a[_0x94ba('0x46')]('\x22'+_0x3fdc05+'\x22');}else{_0x293652['push'](_0x94ba('0x5c'));}break;case _0x94ba('0x5d'):var _0x352896=moment(_0x3fdc05,_0x94ba('0x5e'),!![]);if(_0x352896[_0x94ba('0x57')]()){_0xace57a[_0x94ba('0x46')]('\x22'+_0x3fdc05+'\x22');}else{_0x293652[_0x94ba('0x46')](_0x94ba('0x5f'));}break;default:_0xace57a[_0x94ba('0x46')]('\x22'+_0x3fdc05+'\x22');}}else{switch(_0x22bb5e){case _0x94ba('0x60'):case _0x94ba('0x36'):_0x293652[_0x94ba('0x46')](_0x22bb5e+_0x94ba('0x61'));break;default:_0xace57a['push']('\x22\x22');}}}}if(_0x293652[_0x94ba('0x54')]){handleError(_0x122dac[_0x94ba('0x53')][_0x938446],{'code':_0x94ba('0x62'),'message':_0x293652[_0x94ba('0x13')]()});}else{fs[_0x94ba('0x63')](_0x27b676,_0xace57a[_0x94ba('0x13')]()+'\x0a');}_0xace57a=[];}if(!(stats[_0x94ba('0x64')]%0xc8)){socket[_0x94ba('0x65')](_0x94ba('0x66')+_0x4c8285,stats);stats[_0x94ba('0x45')]=[];}}if(stopped){logger['info'](_0x94ba('0x67'));_0x3f67b5[_0x94ba('0x68')]();}}catch(_0x346cc4){handleError(_0x122dac[_0x94ba('0x53')][_0x938446],{'code':_0x94ba('0x69'),'message':_0x346cc4[_0x94ba('0x43')]});logger[_0x94ba('0x42')](_0x94ba('0x6a'),_0x346cc4[_0x94ba('0x43')]);}},'complete':function(){try{var _0x393d19=[];var _0x59b91b=_0x94ba('0x2c');if(_0x7f18a['duplicates']&&_0x7f18a[_0x94ba('0x6b')][_0x94ba('0x54')]){_0x59b91b=_0x94ba('0x6c')+_0x4c8285;_0x393d19[_0x94ba('0x46')]('CREATE\x20TABLE\x20'+_0x59b91b+_0x94ba('0x6d'));}var _0x13e79e=util[_0x94ba('0xe')](_0x94ba('0x6e'),_0x27b676,_0x59b91b,_0x83a988,_0x7f18a[_0x94ba('0x24')],_0x7f18a['CompanyId']||null,NOW,NOW);if(_[_0x94ba('0x6f')](_0x40281e[_0x94ba('0x22')])){_0x13e79e+=_0x94ba('0x70');}_0x393d19[_0x94ba('0x46')](_0x13e79e);if(_0x7f18a[_0x94ba('0x6b')]&&_0x7f18a['duplicates']['length']){_0x393d19['push'](insertCmContact(_0x7f18a[_0x94ba('0x24')],_0x59b91b,_0x7f18a[_0x94ba('0x6b')],_0x40281e));_0x393d19[_0x94ba('0x46')](_0x94ba('0x71')+_0x59b91b+';');}_0x393d19[_0x94ba('0x46')](insertCmHopper(_0x7f18a[_0x94ba('0x24')],_0x94ba('0x72'),_0x94ba('0x73'),_0x94ba('0x74'),_0x186182));_0x393d19['push'](insertCmHopperBlack(_0x7f18a[_0x94ba('0x24')],'voice_queues_has_cm_blacklists',_0x94ba('0x73'),'VoiceQueueId'));_0x393d19['push'](insertCmHopper(_0x7f18a[_0x94ba('0x24')],'campaigns_has_cm_lists',_0x94ba('0x75'),_0x94ba('0x76'),_0x186182));_0x393d19['push'](insertCmHopperBlack(_0x7f18a[_0x94ba('0x24')],_0x94ba('0x77'),'campaigns',_0x94ba('0x76')));BPromise[_0x94ba('0x78')](_0x393d19,handleQuery)[_0x94ba('0x79')](function(_0xde8be2){stats[_0x94ba('0x7a')]=!![];stats[_0x94ba('0x7b')]=_0x7f18a[_0x94ba('0x6b')]&&_0x7f18a['duplicates'][_0x94ba('0x54')]?results[0x2][_0x94ba('0x7b')]:results[0x0][_0x94ba('0x7b')];socket[_0x94ba('0x65')](_0x94ba('0x66')+_0x4c8285,stats);fs['unlink'](_0x4689c7);fs[_0x94ba('0x7c')](_0x27b676);process[_0x94ba('0x44')](0x0);})[_0x94ba('0x7d')](function(_0x545742){logger[_0x94ba('0x42')](_0x545742[_0x94ba('0x43')]);process[_0x94ba('0x44')](0x1);});}catch(_0x35ebc2){logger[_0x94ba('0x42')]('complete',_0x35ebc2[_0x94ba('0x43')]);process['exit'](0x1);}},'error':function(_0x4abe2e,_0xfe25,_0x3b9d00,_0x1da047){throw new Error(_0x1da047);}});}function validate(){if(process['argv']&&process[_0x94ba('0x7e')][_0x94ba('0x54')]<0x4){throw new Error(_0x94ba('0x7f'));}var _0xda99ee=path[_0x94ba('0x13')](config[_0x94ba('0x4d')],'server/files/tmp',process[_0x94ba('0x7e')][0x2]);if(!fs[_0x94ba('0x80')](_0xda99ee)){throw new Error(_0x94ba('0x81'));}var _0x42d9aa={};try{_0x42d9aa=JSON[_0x94ba('0x51')](process[_0x94ba('0x7e')][0x3]);if(!_0x42d9aa[_0x94ba('0x82')]){throw new Error(_0x94ba('0x83'));}if(!_0x42d9aa[_0x94ba('0x82')][_0x94ba('0x36')]){throw new Error(_0x94ba('0x84'));}if(!_0x42d9aa['binding'][_0x94ba('0x60')]){throw new Error('firstName\x20is\x20mandatory');}var _0x1e834f=0x0;if(_0x42d9aa[_0x94ba('0x82')][_0x94ba('0x28')]){_0x1e834f=0x1;}if(!_0x42d9aa[_0x94ba('0x24')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x35a8ed){throw new Error(_0x94ba('0x85'));}var _0xd154e3=[];try{_0xd154e3=_[_0x94ba('0x86')](JSON[_0x94ba('0x51')](process[_0x94ba('0x7e')][0x4]),'id');}catch(_0x22f3b){logger[_0x94ba('0x40')](_0x94ba('0x87'));}main(_0xda99ee,_0x42d9aa,_0xd154e3,_0x1e834f);}validate();process['on'](_0x94ba('0x88'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index e99fb36..d2018f4 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18a9=['PHONE','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','updatedAt','priority','UserId','fields','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','cm_hopper_black','ContactId','createdAt','cm_contacts','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','ListId','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','exit','errors','code','catch','main','stringify','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','keys','header','writeFileSync','parse','createReadStream','data','rows','find','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','error','message','split','filter','findOne','updated','CmContactHasItem','create'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x18a9,0x117));var _0x918a=function(_0x57b1e2,_0xe20289){_0x57b1e2=_0x57b1e2-0x0;var _0x5a8013=_0x18a9[_0x57b1e2];return _0x5a8013;};'use strict';var fs=require('fs');var path=require(_0x918a('0x0'));var _=require('lodash');var Papa=require(_0x918a('0x1'));var util=require(_0x918a('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0x918a('0x3'));var db=require(_0x918a('0x4'))['db'];var config=require(_0x918a('0x5'));var logger=require(_0x918a('0x6'))(_0x918a('0x7'));config[_0x918a('0x8')]=_[_0x918a('0x9')](config[_0x918a('0x8')],{'host':_0x918a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x918a('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x918a('0xb')](_0x918a('0xc'));var tempTableName=_0x918a('0xd')+moment()[_0x918a('0xb')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x372b3b){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x372b3b);}function selectNotIn(_0x54dfde,_0x26d750,_0x4c5123,_0x5b7503,_0x29c928){return squel[_0x918a('0xe')]()[_0x918a('0xf')](_0x918a('0x10'))[_0x918a('0x11')](_0x5b7503)[_0x918a('0x12')](_0x26d750,null,_0x26d750+'.id\x20=\x20'+_0x5b7503+'.'+_0x4c5123)[_0x918a('0x13')](_0x5b7503+'.'+_0x4c5123+_0x918a('0x14')+_0x54dfde+'.'+_0x4c5123)[_0x918a('0x13')](_0x26d750+_0x918a('0x15')+_0x29c928[_0x918a('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3167c6,_0x1758f7){promisesAdditionalPhones=[];promisesContact=[];return db[_0x918a('0x16')]['query'](_0x918a('0x17')+tempTableName)[_0x918a('0x18')](function(_0x322530){if(_0x322530!==null){var _0x47b6e0=[];for(var _0x19443c=0x0;_0x19443c<_0x322530[_0x918a('0x19')];_0x19443c++){var _0x50a9f2=_0x322530[_0x19443c];if(!_[_0x918a('0x1a')](_0x50a9f2[_0x918a('0x10')])){if(!_[_0x918a('0x1a')](_0x50a9f2[_0x918a('0x1b')]))_0x47b6e0[_0x918a('0x1c')](insertAdditionalPhones(_0x50a9f2));promisesContact['push']({'contact':_0x50a9f2});}}}Promise[_0x918a('0x1d')](_0x47b6e0)[_0x918a('0x1e')](function(){_0x3167c6({'val':0x1});});})['catch'](function(_0x4182e0){logger[_0x918a('0x1f')](_0x4182e0[_0x918a('0x20')]);});});}function insertAdditionalPhones(_0x58dc1d){return new Promise(function(_0x3c91a1,_0x4a02b1){var _0x498938=_0x58dc1d[_0x918a('0x1b')];if(_[_0x918a('0x1a')](_0x498938))_0x4a02b1({'val':0x0});else{var _0x12896e=_0x498938[_0x918a('0x21')](';');var _0x5971d5=[];orderBy=0x0;for(var _0x5d3d80=0x0;_0x5d3d80<_0x12896e[_0x918a('0x19')];_0x5d3d80++){_0x5971d5['push'](splitAdditionalPhone(_0x58dc1d['id'],_0x12896e[_0x5d3d80]));}Promise['all'](_0x5971d5)['then'](function(){_0x3c91a1({'val':_0x12896e['length']});});}});}function splitAdditionalPhone(_0x51b2d8,_0x15223c){return new Promise(function(_0x45ef8f,_0x4a7e7a){var _0x4b35af=_0x15223c['split'](':');var _0x3525b1=_0x4b35af[0x0];var _0x50eedd=_0x4b35af[0x1];if(_0x50eedd!==''){var _0x5572ca=_0x50eedd[_0x918a('0x21')]('|');var _0x32cfe5=[];for(var _0x5cb77f=0x0;_0x5cb77f<_0x5572ca[_0x918a('0x19')];_0x5cb77f++){if(_0x5572ca[_0x5cb77f]!==''){var _0x4b8885=_[_0x918a('0x22')](promisesAdditionalPhones,{'contactId':_0x51b2d8,'phone':_0x5572ca[_0x5cb77f]});if(_0x4b8885['length']==0x0){orderBy++;promisesAdditionalPhones[_0x918a('0x1c')]({'contactId':_0x51b2d8,'contactTypeId':_0x3525b1,'phone':_0x5572ca[_0x5cb77f],'orderBy':orderBy});}}}_0x45ef8f({'ok':0x1});}else _0x45ef8f({'res':0x0});});}function createAdditionalPhone(_0x13e85b,_0x53cf58,_0xd2d567,_0x25e1f0){return new Promise(function(_0x4cff02,_0x2782b5){return db['CmContactHasItem'][_0x918a('0x23')]({'where':{'CmContactId':_0x13e85b,'item':_0xd2d567}})[_0x918a('0x1e')](function(_0x3aae5a){if(_0x3aae5a){return db['CmContactHasItem']['update']({'ItemTypeId':_0x53cf58,'OrderBy':_0x25e1f0},{'where':{'CmContactId':_0x13e85b,'item':_0xd2d567}})[_0x918a('0x1e')](function(_0x340171){_0x4cff02({'res':_0x918a('0x24')});});}else{return db[_0x918a('0x25')][_0x918a('0x26')]({'CmContactId':_0x13e85b,'item':_0xd2d567,'ItemTypeId':_0x53cf58,'OrderBy':_0x25e1f0,'ItemClass':_0x918a('0x27')})[_0x918a('0x1e')](function(_0x2f53a6){_0x4cff02({'res':_0x918a('0x28')});});}});});}function updateContact(_0x5a7aca){return new Promise(function(_0xa2f99a,_0x232825){var _0x4d1241=_0x5a7aca['id'];delete _0x5a7aca['id'];return db[_0x918a('0x29')][_0x918a('0x2a')](_0x5a7aca,{'where':{'id':_0x4d1241}})['then'](function(_0xa00693){updatedRows+=0x1;return db[_0x918a('0x2b')][_0x918a('0x2a')]({'phone':_0x5a7aca['phone']},{'where':{'ContactId':_0x4d1241}})['then'](function(_0x2dd1f2){_0xa2f99a({'ret':'OK'});});});});}function insertCmHopper(_0x56dc86,_0x531b8b,_0x34e735,_0x2d3f99,_0x3b4f14){var _0x4ca88b=[_0x918a('0x2c'),_0x918a('0x2d'),_0x918a('0x2e'),_0x918a('0x2f'),_0x531b8b+'.'+_0x2d3f99,_0x918a('0x30'),_0x918a('0x31'),_0x918a('0x32'),_0x918a('0x33'),'\x22'+_0x3b4f14+'\x22'];return squel[_0x918a('0x34')]()[_0x918a('0x35')]('cm_hopper')[_0x918a('0x36')]([_0x918a('0x10'),_0x918a('0x37'),'ContactId','ListId',_0x2d3f99,'createdAt',_0x918a('0x38'),_0x918a('0x39'),_0x918a('0x3a'),'recallme'],squel[_0x918a('0xe')]()[_0x918a('0x3b')](_0x4ca88b)[_0x918a('0x11')](_0x531b8b)[_0x918a('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x531b8b+_0x918a('0x3c'))['join'](_0x34e735,null,_0x34e735+_0x918a('0x3d')+_0x531b8b+'.'+_0x2d3f99)[_0x918a('0x13')](_0x531b8b+_0x918a('0x3e'),_0x56dc86)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x918a('0x3f'),selectNotIn(_0x531b8b,_0x34e735,_0x2d3f99,'cm_hopper',[_0x918a('0x40'),_0x918a('0x41')]))[_0x918a('0x13')](_0x918a('0x3f'),selectNotIn(_0x531b8b,_0x34e735,_0x2d3f99,_0x918a('0x42'),[_0x918a('0x40')])))['toString']();}function insertCmHopperBlack(_0x253aa6,_0x19fb23,_0x2eba9b,_0x3a7595){var _0x1c0beb=[_0x918a('0x2c'),_0x918a('0x2e'),_0x918a('0x2f'),_0x19fb23+'.'+_0x3a7595,'cm_contacts.createdAt',_0x918a('0x31')];return squel[_0x918a('0x34')]()[_0x918a('0x35')](_0x918a('0x43'))[_0x918a('0x36')]([_0x918a('0x10'),_0x918a('0x44'),'ListId',_0x3a7595,_0x918a('0x45'),'updatedAt'],squel[_0x918a('0xe')]()[_0x918a('0x3b')](_0x1c0beb)[_0x918a('0x11')](_0x19fb23)[_0x918a('0x12')](_0x918a('0x46'),null,'cm_contacts.ListId\x20=\x20'+_0x19fb23+_0x918a('0x3c'))[_0x918a('0x12')](_0x2eba9b,null,_0x2eba9b+'.id\x20=\x20'+_0x19fb23+'.'+_0x3a7595)['where'](_0x19fb23+'.CmListId\x20=\x20?',_0x253aa6)[_0x918a('0x13')](_0x918a('0x47'),NOW)[_0x918a('0x13')](_0x918a('0x3f'),squel[_0x918a('0xe')]()[_0x918a('0xf')](_0x918a('0x10'))[_0x918a('0x11')](_0x918a('0x43'))[_0x918a('0x13')](_0x918a('0x48'),_0x253aa6)[_0x918a('0x13')](_0x3a7595+_0x918a('0x49'),_0x19fb23+'.'+_0x3a7595)))[_0x918a('0x4a')]();}function insertCmHopperAdditionalPhones(_0x3aa00d){var _0x4940d5=[_0x918a('0x4b'),_0x918a('0x4c'),_0x918a('0x4d'),_0x918a('0x4e'),_0x918a('0x4f')];return squel['insert']()[_0x918a('0x35')](_0x918a('0x50'))[_0x918a('0x36')]([_0x918a('0x51'),_0x918a('0x10'),_0x918a('0x52'),_0x918a('0x45'),_0x918a('0x38')],squel['select']()[_0x918a('0x3b')](_0x4940d5)[_0x918a('0x11')]('cm_hopper')[_0x918a('0x12')](_0x918a('0x46'),null,_0x918a('0x53'))[_0x918a('0x12')](_0x918a('0x54'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x918a('0x13')](_0x918a('0x55'),_0x3aa00d)[_0x918a('0x13')](_0x918a('0x47'),NOW))['toString']();}function insertCmContact(_0x2662bc,_0x518bd3,_0x1ae192,_0x15eb7e){var _0x1a7dba=_['concat'](_['keys'](_0x15eb7e),[_0x918a('0x56'),_0x918a('0x57'),_0x918a('0x45'),_0x918a('0x38')]);return squel['insert']()[_0x918a('0x35')](_0x918a('0x46'))[_0x918a('0x36')](_0x1a7dba,squel[_0x918a('0xe')]()[_0x918a('0x3b')](_0x1a7dba)['from'](_0x518bd3)[_0x918a('0x13')]('('+_0x1ae192['join'](',')+_0x918a('0x58'),squel['select']()[_0x918a('0x3b')](_0x1ae192)[_0x918a('0x11')](_0x918a('0x46'))[_0x918a('0x13')](_0x918a('0x48'),_0x2662bc))[_0x918a('0x13')](_0x918a('0x59'),squel[_0x918a('0xe')]()[_0x918a('0xf')](_0x918a('0x5a'),_0x918a('0x5b'))[_0x918a('0x11')](_0x518bd3)[_0x918a('0x5c')](_0x1ae192['join'](','))))[_0x918a('0x4a')]();}function handleStop(){logger[_0x918a('0x5d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2c0ab0){logger[_0x918a('0x1f')](_0x2c0ab0['message']);process[_0x918a('0x5e')](0x1);}function handleError(_0x2a93cf,_0x58be76){stats[_0x918a('0x5f')][_0x918a('0x1c')]({'name':_0x58be76[_0x918a('0x60')],'message':_0x58be76[_0x918a('0x20')],'row':_0x2a93cf});}function handleQuery(_0x2cc915){logger['info'](_0x2cc915);return db[_0x918a('0x16')]['query'](_0x2cc915)[_0x918a('0x18')](function(_0x35dcf0){results[_0x918a('0x1c')](_0x35dcf0);})[_0x918a('0x61')](function(_0x48542e){logger[_0x918a('0x1f')](_0x48542e[_0x918a('0x20')]);});}function main(_0x37dcce,_0x3fdf70,_0x199b0a,_0x143e93){logger[_0x918a('0x5d')](_0x918a('0x62'),_0x37dcce,JSON[_0x918a('0x63')](_0x3fdf70));process['send'](_0x918a('0x64'));var _0x10f2dc=_0x3fdf70['binding'];var _0x41c023=_[_0x918a('0x65')](_0x10f2dc);var _0x311b24=_0x3fdf70[_0x918a('0x66')];var _0x42e5d1=path[_0x918a('0x12')](config[_0x918a('0x67')],_0x918a('0x68'),_0x311b24+_0x918a('0x69'));logger[_0x918a('0x5d')](_0x918a('0x6a'),_0x3fdf70);db[_0x918a('0x6b')][_0x918a('0x6c')]({'raw':!![],'attributes':['id',_0x918a('0x6d')]})['then'](function(_0x1d7fe1){for(var _0x29d687=0x0;_0x29d687<_0x1d7fe1['length'];_0x29d687++){if(_0x1d7fe1[_0x29d687]['name']in _0x10f2dc){contactItemTypes[_0x918a('0x1c')](_0x1d7fe1[_0x29d687]);delete _0x41c023[_0x1d7fe1[_0x29d687][_0x918a('0x6d')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x41c023[_0x918a('0x1b')]='';var _0x1f3737=_[_0x918a('0x6e')](_0x41c023)[_0x918a('0x12')]();logger['info'](_0x918a('0x6f'),_0x1f3737);fs[_0x918a('0x70')](_0x42e5d1,_0x1f3737+'\x0a');Papa[_0x918a('0x71')](fs[_0x918a('0x72')](_0x37dcce),{'header':!![],'skipEmptyLines':!![],'step':function(_0x651e0b,_0x27c4d6){try{for(var _0x576724=0x0,_0x2b128a=[];_0x576724<_0x651e0b[_0x918a('0x73')][_0x918a('0x19')];_0x576724++){stats[_0x918a('0x74')]+=0x1;if(_0x651e0b[_0x918a('0x5f')][_0x576724]){handleError(_0x651e0b['data'][_0x576724],_0x651e0b[_0x918a('0x5f')][_0x576724]);}else{var _0x302c97=[];var _0x3d7df4=[];for(var _0x4b12dd in _0x10f2dc){let _0x4fcafc=contactItemTypes[_0x918a('0x75')](_0x217a5d=>_0x217a5d[_0x918a('0x6d')]===_0x4b12dd);if(_[_0x918a('0x1a')](_0x4fcafc)){if(_0x10f2dc['hasOwnProperty'](_0x4b12dd)){if(_0x651e0b[_0x918a('0x73')][_0x576724][_0x10f2dc[_0x4b12dd]]){var _0x74caf7=_[_0x918a('0x76')](_0x651e0b[_0x918a('0x73')][_0x576724][_0x10f2dc[_0x4b12dd]][_0x918a('0x77')](/"/g,'\x27'));switch(_0x4b12dd){case _0x918a('0x37'):var _0x1e8703=moment(_0x74caf7,_0x918a('0xc'),!![]);if(_0x1e8703['isValid']()){_0x2b128a[_0x918a('0x1c')]('\x22'+_0x74caf7+'\x22');}else{_0x302c97[_0x918a('0x1c')](_0x918a('0x78'));}break;case _0x918a('0x39'):var _0x200589=parseInt(_0x74caf7);_0x74caf7=_[_0x918a('0x79')](_0x200589)||_0x200589<0x0||_0x200589>0x4?_0x143e93?0x3:0x2:_0x200589;_0x2b128a[_0x918a('0x1c')]('\x22'+_0x74caf7+'\x22');break;case _0x918a('0x3a'):var _0x51e25a=parseInt(_0x74caf7);if(_['isNumber'](_0x51e25a)&&_[_0x918a('0x7a')](_0x199b0a,_0x51e25a)){_0x2b128a[_0x918a('0x1c')]('\x22'+_0x51e25a+'\x22');}else{_0x302c97['push'](_0x918a('0x7b'));}break;case _0x918a('0x7c'):if(isEmail(_0x74caf7)){_0x2b128a[_0x918a('0x1c')]('\x22'+_0x74caf7+'\x22');}else{_0x302c97[_0x918a('0x1c')](_0x918a('0x7d'));}break;case _0x918a('0x7e'):var _0x45d007=moment(_0x74caf7,_0x918a('0x7f'),!![]);if(_0x45d007[_0x918a('0x80')]()){_0x2b128a[_0x918a('0x1c')]('\x22'+_0x74caf7+'\x22');}else{_0x302c97['push'](_0x918a('0x81'));}break;default:_0x2b128a[_0x918a('0x1c')]('\x22'+_0x74caf7+'\x22');}}else{switch(_0x4b12dd){case _0x918a('0x82'):case _0x918a('0x10'):_0x302c97[_0x918a('0x1c')](_0x4b12dd+_0x918a('0x83'));break;default:_0x2b128a['push']('\x22\x22');}}}}else{var _0x152de0='';for(var _0x71a2c0=0x0;_0x71a2c0<_0x10f2dc[_0x4b12dd]['length'];_0x71a2c0++){var _0x74caf7=_[_0x918a('0x76')](_0x651e0b[_0x918a('0x73')][_0x576724][_0x10f2dc[_0x4b12dd][_0x71a2c0]][_0x918a('0x77')](/"/g,'\x27'));if(_0x152de0=='')_0x152de0=_0x74caf7;else _0x152de0+='|'+_0x74caf7;}_0x3d7df4[_0x918a('0x1c')](_0x4fcafc['id']+':'+_0x152de0);}}if(hasAdditionalPhones){_0x2b128a[_0x918a('0x1c')]('\x22'+_0x3d7df4[_0x918a('0x12')](';')+'\x22');}if(_0x302c97[_0x918a('0x19')]){handleError(_0x651e0b[_0x918a('0x73')][_0x576724],{'code':_0x918a('0x84'),'message':_0x302c97[_0x918a('0x12')]()});}else{fs[_0x918a('0x85')](_0x42e5d1,_0x2b128a[_0x918a('0x12')]()+'\x0a');}_0x2b128a=[];}if(!(stats['rows']%0xc8)){socket[_0x918a('0x86')]('contact:import:'+_0x311b24,stats);stats[_0x918a('0x5f')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x27c4d6[_0x918a('0x87')]();}}catch(_0xdbd34a){handleError(_0x651e0b['data'][_0x576724],{'code':_0x918a('0x88'),'message':_0xdbd34a[_0x918a('0x20')]});logger[_0x918a('0x1f')](_0x918a('0x89'),_0xdbd34a['message']);}},'complete':function(){try{var _0x276536=[];var _0x1eb44c=tempTableName;_0x276536[_0x918a('0x1c')](_0x918a('0x8a')+_0x1eb44c+_0x918a('0x8b'));logger[_0x918a('0x5d')](_0x918a('0x8c'),contactItemTypes[_0x918a('0x19')]);var _0x1e24b5=util['format'](_0x918a('0x8d'),_0x42e5d1,_0x1eb44c,_0x1f3737,_0x3fdf70[_0x918a('0x56')],_0x3fdf70['CompanyId']||null,NOW,NOW);if(_[_0x918a('0x1a')](_0x10f2dc[_0x918a('0x37')])){_0x1e24b5+=_0x918a('0x8e');}_0x276536[_0x918a('0x1c')](_0x1e24b5);BPromise[_0x918a('0x8f')](_0x276536,handleQuery)[_0x918a('0x1e')](function(_0x4f914f){BPromise['all']([handleAdditionalPhones()])[_0x918a('0x1e')](function(){_0x276536=[];for(var _0x6e20ac=0x0;_0x6e20ac_0x20600b[_0x0699('0x6a')]===_0x529e3f);if(_[_0x0699('0x19')](_0x1d0a47)){if(_0x473129[_0x0699('0x70')](_0x529e3f)){if(_0x39db1c[_0x0699('0x6f')][_0x54a44e][_0x473129[_0x529e3f]]){var _0x50afb6=_[_0x0699('0x71')](_0x39db1c[_0x0699('0x6f')][_0x54a44e][_0x473129[_0x529e3f]][_0x0699('0x72')](/"/g,'\x27'));switch(_0x529e3f){case'scheduledat':var _0x125116=moment(_0x50afb6,_0x0699('0xd'),!![]);if(_0x125116[_0x0699('0x73')]()){_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');}else{_0x34d091['push'](_0x0699('0x74'));}break;case _0x0699('0x38'):var _0x4b7166=parseInt(_0x50afb6);_0x50afb6=_['isNaN'](_0x4b7166)||_0x4b7166<0x0||_0x4b7166>0x4?_0x1695ea?0x3:0x2:_0x4b7166;_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');break;case _0x0699('0x39'):var _0xe5ccad=parseInt(_0x50afb6);if(_[_0x0699('0x75')](_0xe5ccad)&&_['includes'](_0xc5d2c0,_0xe5ccad)){_0x1db26f[_0x0699('0x1b')]('\x22'+_0xe5ccad+'\x22');}else{_0x34d091[_0x0699('0x1b')](_0x0699('0x76'));}break;case _0x0699('0x77'):if(isEmail(_0x50afb6)){_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');}else{_0x34d091[_0x0699('0x1b')]('email\x20wrong\x20format');}break;case _0x0699('0x78'):var _0x1e3987=moment(_0x50afb6,'YYYY-MM-DD',!![]);if(_0x1e3987[_0x0699('0x73')]()){_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');}else{_0x34d091['push'](_0x0699('0x79'));}break;default:_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');}}else{switch(_0x529e3f){case _0x0699('0x7a'):case'phone':_0x34d091[_0x0699('0x1b')](_0x529e3f+'\x20not\x20specified');break;default:_0x1db26f[_0x0699('0x1b')]('\x22\x22');}}}}else{var _0x48a75e='';for(var _0x34951d=0x0;_0x34951d<_0x473129[_0x529e3f]['length'];_0x34951d++){var _0x50afb6=_[_0x0699('0x71')](_0x39db1c[_0x0699('0x6f')][_0x54a44e][_0x473129[_0x529e3f][_0x34951d]]['replace'](/"/g,'\x27'));if(_0x48a75e=='')_0x48a75e=_0x50afb6;else _0x48a75e+='|'+_0x50afb6;}_0x57573f[_0x0699('0x1b')](_0x1d0a47['id']+':'+_0x48a75e);}}if(hasAdditionalPhones){_0x1db26f[_0x0699('0x1b')]('\x22'+_0x57573f[_0x0699('0x3e')](';')+'\x22');}if(_0x34d091['length']){handleError(_0x39db1c[_0x0699('0x6f')][_0x54a44e],{'code':_0x0699('0x7b'),'message':_0x34d091[_0x0699('0x3e')]()});}else{fs['appendFileSync'](_0x2bb439,_0x1db26f['join']()+'\x0a');}_0x1db26f=[];}if(!(stats[_0x0699('0x7c')]%0xc8)){socket[_0x0699('0x7d')](_0x0699('0x7e')+_0x2ca793,stats);stats['errors']=[];}}if(stopped){logger[_0x0699('0x5c')](_0x0699('0x7f'));_0x3eab03[_0x0699('0x80')]();}}catch(_0x44e0fa){handleError(_0x39db1c[_0x0699('0x6f')][_0x54a44e],{'code':_0x0699('0x81'),'message':_0x44e0fa[_0x0699('0x1f')]});logger['error'](_0x0699('0x82'),_0x44e0fa[_0x0699('0x1f')]);}},'complete':function(){try{var _0x499719=[];var _0x281f58=tempTableName;_0x499719[_0x0699('0x1b')](_0x0699('0x83')+_0x281f58+_0x0699('0x84'));logger[_0x0699('0x5c')]('CIS\x20len',contactItemTypes[_0x0699('0x18')]);var _0x15c36b=util[_0x0699('0xc')](_0x0699('0x85'),_0x2bb439,_0x281f58,_0xb5e903,_0x4567c6[_0x0699('0x35')],_0x4567c6[_0x0699('0x57')]||null,NOW,NOW);if(_['isNil'](_0x473129[_0x0699('0x33')])){_0x15c36b+=_0x0699('0x86');}_0x499719[_0x0699('0x1b')](_0x15c36b);BPromise['each'](_0x499719,handleQuery)[_0x0699('0x1d')](function(_0x414fbd){BPromise[_0x0699('0x1c')]([handleAdditionalPhones()])[_0x0699('0x1d')](function(){_0x499719=[];for(var _0x3147e3=0x0;_0x3147e3\x20\x20');}var _0xf0c338=path[_0x0699('0x3e')](config[_0x0699('0x91')],_0x0699('0x67'),process[_0x0699('0x90')][0x2]);if(!fs[_0x0699('0x92')](_0xf0c338)){throw new Error(_0x0699('0x93'));}var _0x2c3763={};try{_0x2c3763=JSON['parse'](process[_0x0699('0x90')][0x3]);if(!_0x2c3763[_0x0699('0x65')]){throw new Error(_0x0699('0x94'));}var _0x598d3f=0x0;if(_0x2c3763[_0x0699('0x65')][_0x0699('0x39')]){_0x598d3f=0x1;}if(!_0x2c3763['ListId']){throw new Error(_0x0699('0x95'));}}catch(_0x31e088){throw new Error(_0x0699('0x96'));}var _0x326215=[];try{_0x326215=_[_0x0699('0x97')](JSON['parse'](process[_0x0699('0x90')][0x4]),'id');}catch(_0x32f85f){logger[_0x0699('0x5c')](_0x0699('0x98'));}main(_0xf0c338,_0x2c3763,_0x326215,_0x598d3f);}validate();process['on'](_0x0699('0x99'),handleStop);process['on'](_0x0699('0x9a'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 9313eb6..2fa5b89 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84a0=['Agent\x20Complete','agentcompleteAt','holdtime','talktime','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','inbound','push','queue','variable','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','destexten','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt'];(function(_0x1b5b9a,_0x433ed8){var _0x33859b=function(_0x14877d){while(--_0x14877d){_0x1b5b9a['push'](_0x1b5b9a['shift']());}};_0x33859b(++_0x433ed8);}(_0x84a0,0x66));var _0x084a=function(_0x358deb,_0x46c2cf){_0x358deb=_0x358deb-0x0;var _0x35ca67=_0x84a0[_0x358deb];return _0x35ca67;};'use strict';exports[_0x084a('0x0')]=function(_0x1538c2,_0x209635){var _0x1fff7f=[{'type':'string','content':_0x084a('0x1'),'variableName':null}];switch(_0x1538c2[_0x084a('0x2')]()){case'voice':switch(_0x209635['toLowerCase']()){case _0x084a('0x3'):_0x1fff7f[_0x084a('0x4')]({'type':'variable','content':'','variableName':_0x084a('0x5')});_0x1fff7f[_0x084a('0x4')]({'type':_0x084a('0x6'),'content':'','variableName':_0x084a('0x7')});break;case _0x084a('0x8'):_0x1fff7f['push']({'type':_0x084a('0x9'),'content':_0x084a('0xa'),'variableName':null});_0x1fff7f[_0x084a('0x4')]({'type':_0x084a('0x6'),'content':'','variableName':_0x084a('0xb')});break;}}return _0x1fff7f;};exports['getDescriptions']=function(_0x4dd423,_0x3d9dc6){var _0x853df=[];switch(_0x4dd423[_0x084a('0x2')]()){case _0x084a('0xc'):switch(_0x3d9dc6[_0x084a('0x2')]()){case'inbound':_0x853df=[{'type':'string','content':_0x084a('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0xf'),'keyType':_0x084a('0x6'),'variableName':_0x084a('0x7')},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x10'),'keyType':_0x084a('0x6'),'variableName':'calleridname'},{'type':_0x084a('0xe'),'content':'','key':'Call\x20To','keyType':_0x084a('0x6'),'variableName':_0x084a('0x11')},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x12'),'keyType':_0x084a('0x6'),'variableName':'queue'},{'type':_0x084a('0xe'),'content':'','key':'UniqueId','keyType':_0x084a('0x6'),'variableName':_0x084a('0x13')},{'type':'keyValue','content':'','key':_0x084a('0x14'),'keyType':_0x084a('0x6'),'variableName':_0x084a('0x15')},{'type':_0x084a('0x9'),'content':_0x084a('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x17'),'keyType':_0x084a('0x6'),'variableName':_0x084a('0x18')},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x19'),'keyType':_0x084a('0x6'),'variableName':_0x084a('0xb')},{'type':_0x084a('0x9'),'content':_0x084a('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x084a('0x1b'),'keyType':_0x084a('0x6'),'variableName':_0x084a('0x15')},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x1c'),'keyType':'variable','variableName':_0x084a('0x1d')},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x1e'),'keyType':_0x084a('0x6'),'variableName':_0x084a('0x1f')},{'type':_0x084a('0xe'),'content':'','key':'Hold\x20Time','keyType':_0x084a('0x6'),'variableName':_0x084a('0x20')},{'type':_0x084a('0xe'),'content':'','key':'Talk\x20Time','keyType':_0x084a('0x6'),'variableName':_0x084a('0x21')}];break;case _0x084a('0x8'):_0x853df=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0x084a('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0x084a('0x6'),'keyContent':'','variableName':_0x084a('0x22')},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x23'),'keyType':_0x084a('0x6'),'keyContent':'','variableName':_0x084a('0x13')},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x14'),'keyType':'variable','keyContent':'','variableName':_0x084a('0x24')},{'type':_0x084a('0x9'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x25'),'keyType':_0x084a('0x6'),'keyContent':'','variableName':_0x084a('0x26')},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x27'),'keyType':_0x084a('0x6'),'keyContent':'','variableName':_0x084a('0x28')},{'type':_0x084a('0xe'),'content':'','key':_0x084a('0x29'),'keyType':_0x084a('0x6'),'keyContent':'','variableName':_0x084a('0x2a')},{'type':_0x084a('0xe'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':_0x084a('0x2b')}];break;}}return _0x853df;}; \ No newline at end of file +var _0x8f4c=['answertime','Complete\x20Time','endtime','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','variable','calleridnum','push','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','outbound','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time'];(function(_0x521cac,_0x156c6b){var _0xaa8007=function(_0x29793c){while(--_0x29793c){_0x521cac['push'](_0x521cac['shift']());}};_0xaa8007(++_0x156c6b);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2384bb,_0x39682f){_0x2384bb=_0x2384bb-0x0;var _0x299201=_0x8f4c[_0x2384bb];return _0x299201;};'use strict';exports[_0xc8f4('0x0')]=function(_0x292fb6,_0xce26f2){var _0x43926b=[{'type':_0xc8f4('0x1'),'content':_0xc8f4('0x2'),'variableName':null}];switch(_0x292fb6['toLowerCase']()){case _0xc8f4('0x3'):switch(_0xce26f2[_0xc8f4('0x4')]()){case _0xc8f4('0x5'):_0x43926b['push']({'type':_0xc8f4('0x6'),'content':'','variableName':'queue'});_0x43926b['push']({'type':'variable','content':'','variableName':_0xc8f4('0x7')});break;case'outbound':_0x43926b[_0xc8f4('0x8')]({'type':_0xc8f4('0x1'),'content':_0xc8f4('0x9'),'variableName':null});_0x43926b[_0xc8f4('0x8')]({'type':_0xc8f4('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x43926b;};exports[_0xc8f4('0xa')]=function(_0x191b92,_0x2fba62){var _0x3a2f8a=[];switch(_0x191b92['toLowerCase']()){case _0xc8f4('0x3'):switch(_0x2fba62['toLowerCase']()){case _0xc8f4('0x5'):_0x3a2f8a=[{'type':_0xc8f4('0x1'),'content':_0xc8f4('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0xd'),'keyType':'variable','variableName':_0xc8f4('0x7')},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0xe'),'keyType':_0xc8f4('0x6'),'variableName':_0xc8f4('0xf')},{'type':_0xc8f4('0xc'),'content':'','key':'Call\x20To','keyType':_0xc8f4('0x6'),'variableName':_0xc8f4('0x10')},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0x11'),'keyType':_0xc8f4('0x6'),'variableName':'queue'},{'type':_0xc8f4('0xc'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0xc8f4('0x12')},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0x13'),'keyType':_0xc8f4('0x6'),'variableName':_0xc8f4('0x14')},{'type':_0xc8f4('0x1'),'content':_0xc8f4('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0x16'),'keyType':_0xc8f4('0x6'),'variableName':_0xc8f4('0x17')},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0x18'),'keyType':'variable','variableName':_0xc8f4('0x19')},{'type':_0xc8f4('0x1'),'content':_0xc8f4('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0x1b'),'keyType':_0xc8f4('0x6'),'variableName':_0xc8f4('0x14')},{'type':_0xc8f4('0xc'),'content':'','key':'Agent\x20Connect','keyType':_0xc8f4('0x6'),'variableName':_0xc8f4('0x1c')},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0x1d'),'keyType':'variable','variableName':_0xc8f4('0x1e')},{'type':'keyValue','content':'','key':_0xc8f4('0x1f'),'keyType':'variable','variableName':_0xc8f4('0x20')},{'type':_0xc8f4('0xc'),'content':'','key':'Talk\x20Time','keyType':_0xc8f4('0x6'),'variableName':_0xc8f4('0x21')}];break;case _0xc8f4('0x22'):_0x3a2f8a=[{'type':_0xc8f4('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0x23'),'keyType':'variable','keyContent':'','variableName':_0xc8f4('0x19')},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0x24'),'keyType':_0xc8f4('0x6'),'keyContent':'','variableName':_0xc8f4('0x25')},{'type':_0xc8f4('0xc'),'content':'','key':'UniqueId','keyType':_0xc8f4('0x6'),'keyContent':'','variableName':_0xc8f4('0x12')},{'type':_0xc8f4('0xc'),'content':'','key':'Date','keyType':_0xc8f4('0x6'),'keyContent':'','variableName':_0xc8f4('0x26')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0xc8f4('0x27'),'keyType':_0xc8f4('0x6'),'keyContent':'','variableName':_0xc8f4('0x28')},{'type':_0xc8f4('0xc'),'content':'','key':_0xc8f4('0x29'),'keyType':_0xc8f4('0x6'),'keyContent':'','variableName':_0xc8f4('0x2a')},{'type':_0xc8f4('0xc'),'content':'','key':'Duration','keyType':_0xc8f4('0x6'),'keyContent':'','variableName':_0xc8f4('0x2b')},{'type':_0xc8f4('0xc'),'content':'','key':'Billable\x20Time','keyType':_0xc8f4('0x6'),'keyContent':'','variableName':_0xc8f4('0x2c')}];break;}}return _0x3a2f8a;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index f488bde..8944f50 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3561=['catch','tracked','user','query','clone','body','phone','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','then','info'];(function(_0x5b5768,_0x5cbb41){var _0x457cbc=function(_0x277b27){while(--_0x277b27){_0x5b5768['push'](_0x5b5768['shift']());}};_0x457cbc(++_0x5cbb41);}(_0x3561,0x94));var _0x1356=function(_0xadd96e,_0x53222f){_0xadd96e=_0xadd96e-0x0;var _0x137da1=_0x3561[_0xadd96e];return _0x137da1;};'use strict';var _=require(_0x1356('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x1356('0x1'))(_0x1356('0x2')),'mail':require(_0x1356('0x1'))(_0x1356('0x3')),'fax':require(_0x1356('0x1'))(_0x1356('0x4')),'sms':require(_0x1356('0x1'))(_0x1356('0x5')),'chat':require(_0x1356('0x1'))(_0x1356('0x6')),'whatsapp':require(_0x1356('0x1'))(_0x1356('0x7'))};function getInteractionId(_0x45ac56,_0x4b4527,_0x105aaf){if(_0x45ac56&&_0x45ac56[_[_0x1356('0x8')](_0x105aaf)+_0x1356('0x9')]){return _0x45ac56[_['upperFirst'](_0x105aaf)+'InteractionId'];}else if(_0x45ac56&&_0x45ac56['id']){return _0x45ac56['id'];}else if(_0x4b4527&&_0x4b4527['id']){return _0x4b4527['id'];}else{return _0x1356('0xa');}}function log(_0x101c23,_0x4f2abe,_0x46349e,_0x4b3afa,_0x301f64,_0x2d5865){loggers[_0x301f64['toLowerCase']()][_0x101c23](_0x1356('0xb'),_0x2d5865[_0x1356('0xc')](),_0x4f2abe?_0x4f2abe['id']:null,_0x4f2abe?_0x4f2abe['name']:null,_0x4f2abe?_0x4f2abe[_0x1356('0xd')]:null,getInteractionId(_0x46349e,_0x4b3afa,_0x301f64),_0x46349e?JSON[_0x1356('0xe')](_0x46349e):_0x1356('0xf'));}function updateUser(_0x31e769,_0x319af1,_0x107080,_0x70c471,_0x3c8b32){db[_[_0x1356('0x8')](_0x70c471)+_0x1356('0x10')][_0x1356('0x11')]({'where':{'id':getInteractionId(_0x319af1,_0x107080,_0x70c471)}})[_0x1356('0x12')](function(_0x58975b){if(_0x58975b){return _0x58975b['update']({'UserId':_0x31e769?_0x31e769['id']:null});}})['then'](function(_0x61991a){if(_0x61991a){log(_0x1356('0x13'),_0x31e769,_0x319af1,_0x107080,_0x70c471,_0x3c8b32);}})[_0x1356('0x14')](function(){log('error',_0x31e769,_0x319af1,_0x107080,_0x70c471,_0x3c8b32);});}exports[_0x1356('0x15')]=function(_0x3645c0,_0x39f708){return function(_0x2256e2,_0xa115de,_0x36655c){var _0x459836=_0x2256e2[_0x1356('0x16')];var _0x345b24={};var _0x370a91=_0x2256e2[_0x1356('0x17')];if(_0x345b24){_0x345b24=_[_0x1356('0x18')](_0x2256e2[_0x1356('0x19')]);_0x345b24=_['omit'](_0x345b24,[_0x1356('0x19'),'html',_0x1356('0x1a'),'fax',_0x1356('0x1b')]);}updateUser(_0x459836,_0x345b24,_0x370a91,_0x3645c0,_0x39f708);_0x36655c(null);};}; \ No newline at end of file +var _0x96aa=['then','update','info','catch','error','tracked','user','query','clone','body','omit','phone','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null'];(function(_0x5c5b64,_0x34aee8){var _0x318102=function(_0x43b112){while(--_0x43b112){_0x5c5b64['push'](_0x5c5b64['shift']());}};_0x318102(++_0x34aee8);}(_0x96aa,0x67));var _0xa96a=function(_0x335093,_0x408b1a){_0x335093=_0x335093-0x0;var _0x4ad0e7=_0x96aa[_0x335093];return _0x4ad0e7;};'use strict';var _=require(_0xa96a('0x0'));var db=require(_0xa96a('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xa96a('0x2')),'mail':require(_0xa96a('0x3'))(_0xa96a('0x4')),'fax':require(_0xa96a('0x3'))(_0xa96a('0x5')),'sms':require('../../config/logger')(_0xa96a('0x6')),'chat':require(_0xa96a('0x3'))('chat-interactions'),'whatsapp':require(_0xa96a('0x3'))(_0xa96a('0x7'))};function getInteractionId(_0x282c8c,_0x3f391e,_0x44fb9d){if(_0x282c8c&&_0x282c8c[_[_0xa96a('0x8')](_0x44fb9d)+_0xa96a('0x9')]){return _0x282c8c[_[_0xa96a('0x8')](_0x44fb9d)+_0xa96a('0x9')];}else if(_0x282c8c&&_0x282c8c['id']){return _0x282c8c['id'];}else if(_0x3f391e&&_0x3f391e['id']){return _0x3f391e['id'];}else{return _0xa96a('0xa');}}function log(_0x13321e,_0x4825fc,_0x33b786,_0x5532f2,_0x234d1a,_0x209454){loggers[_0x234d1a['toLowerCase']()][_0x13321e](_0xa96a('0xb'),_0x209454[_0xa96a('0xc')](),_0x4825fc?_0x4825fc['id']:null,_0x4825fc?_0x4825fc[_0xa96a('0xd')]:null,_0x4825fc?_0x4825fc[_0xa96a('0xe')]:null,getInteractionId(_0x33b786,_0x5532f2,_0x234d1a),_0x33b786?JSON[_0xa96a('0xf')](_0x33b786):_0xa96a('0x10'));}function updateUser(_0x225192,_0x197116,_0x3bd981,_0x1a4644,_0x431927){db[_[_0xa96a('0x8')](_0x1a4644)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x197116,_0x3bd981,_0x1a4644)}})[_0xa96a('0x11')](function(_0x4f44b0){if(_0x4f44b0){return _0x4f44b0[_0xa96a('0x12')]({'UserId':_0x225192?_0x225192['id']:null});}})['then'](function(_0x170e3d){if(_0x170e3d){log(_0xa96a('0x13'),_0x225192,_0x197116,_0x3bd981,_0x1a4644,_0x431927);}})[_0xa96a('0x14')](function(){log(_0xa96a('0x15'),_0x225192,_0x197116,_0x3bd981,_0x1a4644,_0x431927);});}exports[_0xa96a('0x16')]=function(_0x16257d,_0x5013f8){return function(_0x8d32c0,_0xbcc80a,_0x48ca06){var _0xf0dd61=_0x8d32c0[_0xa96a('0x17')];var _0x4155e5={};var _0x2e8c75=_0x8d32c0[_0xa96a('0x18')];if(_0x4155e5){_0x4155e5=_[_0xa96a('0x19')](_0x8d32c0[_0xa96a('0x1a')]);_0x4155e5=_[_0xa96a('0x1b')](_0x4155e5,[_0xa96a('0x1a'),'html',_0xa96a('0x1c'),'fax',_0xa96a('0x1d')]);}updateUser(_0xf0dd61,_0x4155e5,_0x2e8c75,_0x16257d,_0x5013f8);_0x48ca06(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 18d291a..ee8eaf6 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05c7=['isUserLimit','crypto','util','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x05c7,0x88));var _0x705c=function(_0x5a2674,_0x1c7e75){_0x5a2674=_0x5a2674-0x0;var _0x48c89c=_0x05c7[_0x5a2674];return _0x48c89c;};'use strict';var crypto=require(_0x705c('0x0'));var util=require(_0x705c('0x1'));var compose=require('composable-middleware');var db=require(_0x705c('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x561b99,_0x1d2bbb){if(_0x561b99&&_0x1d2bbb){if(_0x1d2bbb[_0x705c('0x3')]&&_0x1d2bbb[_0x705c('0x4')]){var _0x295f98=_0x1d2bbb[_0x705c('0x3')];var _0x5e547f=_0x1d2bbb['license'];var _0x3979cc=_0x295f98['split']('-')[0x4];var _0x5a6f20=_0x295f98[_0x705c('0x5')]('-')[0x0];var _0x2e7284=crypto[_0x705c('0x6')](_0x705c('0x7'),util[_0x705c('0x8')](_0x705c('0x9'),_0x3979cc,_0x295f98,_0x5a6f20));var _0x514011=_0x2e7284[_0x705c('0xa')](_0x5e547f,_0x705c('0xb'),_0x705c('0xc'));_0x514011+=_0x2e7284[_0x705c('0xd')](_0x705c('0xc'));var _0x455a40=JSON['parse'](_0x514011);return _0x455a40[_0x705c('0xe')](_0x561b99)?_0x455a40[_0x561b99]:null;}}return null;}function isLimit(_0x5257fb,_0x1cec5f,_0x496ca3,_0x4b3722){var _0x4e2b33=_0x1cec5f;return compose()['use'](function(_0x46e746,_0xe63aab,_0x2f8db9){return db[_0x705c('0xf')][_0x705c('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x4ee309){var _0x2871c5=getValueFromLicense(_0x5257fb,_0x4ee309);return _0x2871c5?_0x2871c5:_0x4e2b33;})[_0x705c('0x11')](function(_0x1de00f){_0x4e2b33=_0x1de00f;return _0x496ca3[_0x705c('0x12')](_0x4b3722);})[_0x705c('0x11')](function(_0x3c7fc3){if(_0x3c7fc3>=_0x4e2b33){return _0xe63aab['status'](0x193)[_0x705c('0x13')]({'message':util[_0x705c('0x8')](_0x705c('0x14'),_0x5257fb)});}_0x2f8db9();})[_0x705c('0x15')](function(_0x453da0){_0x2f8db9(_0x453da0);});});}function isUserLimit(){return isLimit(_0x705c('0x16'),0x1,db[_0x705c('0x17')],{'where':{'$or':[{'role':_0x705c('0x18')},{'role':_0x705c('0x19')}]}});}exports[_0x705c('0x1a')]=isUserLimit; \ No newline at end of file +var _0xed43=['admin','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','createDecipher','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0xed43,0xba));var _0x3ed4=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0xed43[_0x546aaf];return _0x1cbf6d;};'use strict';var crypto=require(_0x3ed4('0x0'));var util=require('util');var compose=require(_0x3ed4('0x1'));var db=require(_0x3ed4('0x2'))['db'];var config=require(_0x3ed4('0x3'));function getValueFromLicense(_0x5b324b,_0x1fe6db){if(_0x5b324b&&_0x1fe6db){if(_0x1fe6db[_0x3ed4('0x4')]&&_0x1fe6db[_0x3ed4('0x5')]){var _0x1e9e88=_0x1fe6db[_0x3ed4('0x4')];var _0x26ee31=_0x1fe6db['license'];var _0x36adf5=_0x1e9e88['split']('-')[0x4];var _0x100c36=_0x1e9e88['split']('-')[0x0];var _0x46caaa=crypto[_0x3ed4('0x6')]('aes-256-ctr',util['format']('%s:%s:%s',_0x36adf5,_0x1e9e88,_0x100c36));var _0x580dcb=_0x46caaa[_0x3ed4('0x7')](_0x26ee31,_0x3ed4('0x8'),_0x3ed4('0x9'));_0x580dcb+=_0x46caaa[_0x3ed4('0xa')]('utf8');var _0x2bd53d=JSON['parse'](_0x580dcb);return _0x2bd53d[_0x3ed4('0xb')](_0x5b324b)?_0x2bd53d[_0x5b324b]:null;}}return null;}function isLimit(_0x1605f3,_0x45fa76,_0x3110cf,_0x3b42c3){var _0x1d7738=_0x45fa76;return compose()[_0x3ed4('0xc')](function(_0x544cec,_0x149bad,_0x3886db){return db[_0x3ed4('0xd')][_0x3ed4('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x4bc8ca){var _0x442537=getValueFromLicense(_0x1605f3,_0x4bc8ca);return _0x442537?_0x442537:_0x1d7738;})[_0x3ed4('0xf')](function(_0x4d27aa){_0x1d7738=_0x4d27aa;return _0x3110cf[_0x3ed4('0x10')](_0x3b42c3);})[_0x3ed4('0xf')](function(_0x372b24){if(_0x372b24>=_0x1d7738){return _0x149bad[_0x3ed4('0x11')](0x193)['json']({'message':util[_0x3ed4('0x12')](_0x3ed4('0x13'),_0x1605f3)});}_0x3886db();})['catch'](function(_0x123b97){_0x3886db(_0x123b97);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x3ed4('0x14')],{'where':{'$or':[{'role':_0x3ed4('0x15')},{'role':'user'}]}});}exports[_0x3ed4('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8077e3b..26e3382 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ec1=['field','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$substring','$startsWith','$endsWith','$lt','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$notIn','start','pop','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','length','split','shift','match','forEach','filter','map','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','days','format','YYYY-MM-DD','castTo','text','CAST('];(function(_0x55e6c8,_0x1ff4f5){var _0x56dac7=function(_0x3000d9){while(--_0x3000d9){_0x55e6c8['push'](_0x55e6c8['shift']());}};_0x56dac7(++_0x1ff4f5);}(_0x6ec1,0x75));var _0x16ec=function(_0x2998a3,_0x3a380d){_0x2998a3=_0x2998a3-0x0;var _0x3ea3da=_0x6ec1[_0x2998a3];return _0x3ea3da;};'use strict';var _=require(_0x16ec('0x0'));var moment=require(_0x16ec('0x1'));exports[_0x16ec('0x2')]=function(_0x5d250b){var _0x272340={'conditions':[]};_0x272340[_0x16ec('0x3')]=_['startsWith'](_0x5d250b,_0x16ec('0x4'))?'or':_0x16ec('0x5');var _0x39db99=_0x5d250b[_0x16ec('0x6')](_0x16ec('0x7'),'')['replace']('[$or]','')['split']('||');for(var _0x343058=0x0;_0x343058<_0x39db99[_0x16ec('0x8')];_0x343058++){var _0x383ac6=_0x39db99[_0x343058][_0x16ec('0x9')](':=');var _0x317a90=_0x383ac6[0x0];var _0x563631=_0x383ac6['slice'](0x1);_0x563631['forEach'](function(_0x44cd8f){var _0x510826=_0x44cd8f[_0x16ec('0x9')]('[')[_0x16ec('0xa')]();var _0x108bba=_0x44cd8f[_0x16ec('0xb')](/\[(.*?)\]/g);_0x108bba[_0x16ec('0xc')](function(_0xdbc560){var _0x1a6655=_0xdbc560[_0x16ec('0x9')]('[')[_0x16ec('0xd')](function(_0x308435){return _0x308435['indexOf'](']')>-0x1;})[_0x16ec('0xe')](function(_0x711dc9){return _0x711dc9[_0x16ec('0x9')](']')[0x0];})[0x0];_0x272340['conditions'][_0x16ec('0xf')]({'field':_0x317a90,'operator':_0x510826,'value':_0x1a6655});});});}return _0x272340;};exports[_0x16ec('0x10')]=function(_0x4b11dc,_0x6727b1,_0x2cfab7){var _0x58ecb2={};if(_0x6727b1===_0x16ec('0x11')){if(_0x2cfab7[_0x16ec('0x12')]===_0x16ec('0x13')){_0x2cfab7['operator']=_0x16ec('0x14');_0x2cfab7[_0x16ec('0x15')]+=','+_0x2cfab7[_0x16ec('0x15')];}else if(_[_0x16ec('0x16')]([_0x16ec('0x17'),'$lte'],_0x2cfab7[_0x16ec('0x12')])){_0x2cfab7[_0x16ec('0x15')]=moment(_0x2cfab7[_0x16ec('0x15')])['add'](0x1,_0x16ec('0x18'))[_0x16ec('0x19')](_0x16ec('0x1a'));}}if(_0x2cfab7[_0x16ec('0x1b')]){_0x6727b1=_0x2cfab7[_0x16ec('0x1b')];_0x58ecb2[_0x16ec('0x1c')]=_0x16ec('0x1d')+_0x4b11dc+'.'+_0x2cfab7[_0x16ec('0x1e')]+'\x20AS\x20'+_0x2cfab7['castTo']+')\x20'+parseOperator(_0x2cfab7[_0x16ec('0x12')]);}else{_0x58ecb2[_0x16ec('0x1c')]=_0x4b11dc+'.'+_0x2cfab7[_0x16ec('0x1e')]+'\x20'+parseOperator(_0x2cfab7['operator']);}if(_['includes']([_0x16ec('0x1f'),'$notIn'],_0x2cfab7[_0x16ec('0x12')]))_0x58ecb2[_0x16ec('0x1c')]='('+_0x58ecb2[_0x16ec('0x1c')]+_0x16ec('0x20')+_0x4b11dc+'.'+_0x2cfab7[_0x16ec('0x1e')]+_0x16ec('0x21');_0x58ecb2[_0x16ec('0x15')]=parseValue(_0x6727b1,_0x2cfab7[_0x16ec('0x12')],_0x2cfab7[_0x16ec('0x15')]);return _0x58ecb2;};function parseOperator(_0x725c80){var _0x1f7b80;switch(_0x725c80){case _0x16ec('0x22'):_0x1f7b80=_0x16ec('0x23');break;case'$notIn':_0x1f7b80='NOT\x20IN\x20?';break;case _0x16ec('0x13'):_0x1f7b80='=\x20?';break;case _0x16ec('0x1f'):_0x1f7b80='<>\x20?';break;case _0x16ec('0x24'):case _0x16ec('0x25'):case _0x16ec('0x26'):_0x1f7b80='LIKE\x20?';break;case _0x16ec('0x27'):_0x1f7b80='<\x20?';break;case _0x16ec('0x17'):_0x1f7b80='>\x20?';break;case'$lte':_0x1f7b80=_0x16ec('0x28');break;case'$gte':_0x1f7b80=_0x16ec('0x29');break;case _0x16ec('0x14'):_0x1f7b80=_0x16ec('0x2a');break;}return _0x1f7b80;}function parseValue(_0xc34560,_0x3f5b7f,_0x3040cd){var _0x297314={'start':undefined,'end':undefined};switch(_0x3f5b7f){case _0x16ec('0x22'):case _0x16ec('0x2b'):_0x297314[_0x16ec('0x2c')]=_0x3040cd[_0x16ec('0x9')](',');break;case _0x16ec('0x24'):_0x297314[_0x16ec('0x2c')]='%'+_0x3040cd+'%';break;case _0x16ec('0x25'):_0x297314[_0x16ec('0x2c')]=_0x3040cd+'%';break;case _0x16ec('0x26'):_0x297314['start']='%'+_0x3040cd;break;case _0x16ec('0x14'):var _0x15af88=_0x3040cd[_0x16ec('0x9')](',');var _0x3040cd=_0x15af88[_0x16ec('0xa')]();var _0x2102d2=_0x15af88[_0x16ec('0x2d')]();if(_0xc34560===_0x16ec('0x11')){_0x3040cd=moment(_0x3040cd)['utcOffset'](0x0,!![])[_0x16ec('0x19')]();_0x2102d2=moment(_0x2102d2)['utcOffset'](0x0,!![])[_0x16ec('0x2e')](0x17,'hours')['add'](0x3b,_0x16ec('0x2f'))[_0x16ec('0x2e')](0x3b,_0x16ec('0x30'))[_0x16ec('0x19')]();}_0x297314={'start':_0x3040cd,'end':_0x2102d2};break;default:_0x297314['start']=_0x3040cd;break;}return _0x297314;} \ No newline at end of file +var _0x64f3=['hours','minutes','seconds','lodash','sqlOperator','startsWith','replace','[$and]','[$or]','split','slice','forEach','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','$ne','<>\x20?','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','shift','pop','utcOffset','add'];(function(_0xd67f28,_0x2396b3){var _0x3b7ed4=function(_0x2c0d7d){while(--_0x2c0d7d){_0xd67f28['push'](_0xd67f28['shift']());}};_0x3b7ed4(++_0x2396b3);}(_0x64f3,0x17d));var _0x364f=function(_0x59cb71,_0x218c2c){_0x59cb71=_0x59cb71-0x0;var _0x1e98f1=_0x64f3[_0x59cb71];return _0x1e98f1;};'use strict';var _=require(_0x364f('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x5a8ca1){var _0x494621={'conditions':[]};_0x494621[_0x364f('0x1')]=_[_0x364f('0x2')](_0x5a8ca1,'[$or]')?'or':'and';var _0x119f83=_0x5a8ca1[_0x364f('0x3')](_0x364f('0x4'),'')[_0x364f('0x3')](_0x364f('0x5'),'')[_0x364f('0x6')]('||');for(var _0x7f5197=0x0;_0x7f5197<_0x119f83['length'];_0x7f5197++){var _0x5799f4=_0x119f83[_0x7f5197][_0x364f('0x6')](':=');var _0x103e3a=_0x5799f4[0x0];var _0xf8aca9=_0x5799f4[_0x364f('0x7')](0x1);_0xf8aca9[_0x364f('0x8')](function(_0x2f0108){var _0xbe7777=_0x2f0108['split']('[')['shift']();var _0x551c34=_0x2f0108[_0x364f('0x9')](/\[(.*?)\]/g);_0x551c34[_0x364f('0x8')](function(_0x31e750){var _0x3a388b=_0x31e750['split']('[')[_0x364f('0xa')](function(_0x2c1bf6){return _0x2c1bf6[_0x364f('0xb')](']')>-0x1;})['map'](function(_0x25e7a1){return _0x25e7a1[_0x364f('0x6')](']')[0x0];})[0x0];_0x494621[_0x364f('0xc')][_0x364f('0xd')]({'field':_0x103e3a,'operator':_0xbe7777,'value':_0x3a388b});});});}return _0x494621;};exports[_0x364f('0xe')]=function(_0x2ec1b1,_0x4dbb64,_0x5b5f58){var _0x20c055={};if(_0x4dbb64===_0x364f('0xf')){if(_0x5b5f58[_0x364f('0x10')]===_0x364f('0x11')){_0x5b5f58[_0x364f('0x10')]=_0x364f('0x12');_0x5b5f58[_0x364f('0x13')]+=','+_0x5b5f58[_0x364f('0x13')];}else if(_[_0x364f('0x14')]([_0x364f('0x15'),_0x364f('0x16')],_0x5b5f58[_0x364f('0x10')])){_0x5b5f58[_0x364f('0x13')]=moment(_0x5b5f58['value'])['add'](0x1,_0x364f('0x17'))[_0x364f('0x18')](_0x364f('0x19'));}}if(_0x5b5f58[_0x364f('0x1a')]){_0x4dbb64=_0x5b5f58[_0x364f('0x1a')];_0x20c055[_0x364f('0x1b')]=_0x364f('0x1c')+_0x2ec1b1+'.'+_0x5b5f58[_0x364f('0x1d')]+_0x364f('0x1e')+_0x5b5f58[_0x364f('0x1a')]+')\x20'+parseOperator(_0x5b5f58[_0x364f('0x10')]);}else{_0x20c055[_0x364f('0x1b')]=_0x2ec1b1+'.'+_0x5b5f58[_0x364f('0x1d')]+'\x20'+parseOperator(_0x5b5f58[_0x364f('0x10')]);}if(_[_0x364f('0x14')](['$ne',_0x364f('0x1f')],_0x5b5f58[_0x364f('0x10')]))_0x20c055[_0x364f('0x1b')]='('+_0x20c055['text']+_0x364f('0x20')+_0x2ec1b1+'.'+_0x5b5f58[_0x364f('0x1d')]+_0x364f('0x21');_0x20c055[_0x364f('0x13')]=parseValue(_0x4dbb64,_0x5b5f58['operator'],_0x5b5f58[_0x364f('0x13')]);return _0x20c055;};function parseOperator(_0x1b115c){var _0x4626a3;switch(_0x1b115c){case'$in':_0x4626a3=_0x364f('0x22');break;case _0x364f('0x1f'):_0x4626a3=_0x364f('0x23');break;case _0x364f('0x11'):_0x4626a3='=\x20?';break;case _0x364f('0x24'):_0x4626a3=_0x364f('0x25');break;case'$substring':case'$startsWith':case _0x364f('0x26'):_0x4626a3='LIKE\x20?';break;case _0x364f('0x27'):_0x4626a3=_0x364f('0x28');break;case _0x364f('0x15'):_0x4626a3=_0x364f('0x29');break;case'$lte':_0x4626a3=_0x364f('0x2a');break;case'$gte':_0x4626a3=_0x364f('0x2b');break;case'$between':_0x4626a3=_0x364f('0x2c');break;}return _0x4626a3;}function parseValue(_0x1e9112,_0x11ec2c,_0x39ef3e){var _0x5145b5={'start':undefined,'end':undefined};switch(_0x11ec2c){case _0x364f('0x2d'):case _0x364f('0x1f'):_0x5145b5['start']=_0x39ef3e[_0x364f('0x6')](',');break;case'$substring':_0x5145b5[_0x364f('0x2e')]='%'+_0x39ef3e+'%';break;case'$startsWith':_0x5145b5[_0x364f('0x2e')]=_0x39ef3e+'%';break;case _0x364f('0x26'):_0x5145b5['start']='%'+_0x39ef3e;break;case _0x364f('0x12'):var _0x5f2b3d=_0x39ef3e[_0x364f('0x6')](',');var _0x39ef3e=_0x5f2b3d[_0x364f('0x2f')]();var _0x4bb6d3=_0x5f2b3d[_0x364f('0x30')]();if(_0x1e9112==='DATE'){_0x39ef3e=moment(_0x39ef3e)[_0x364f('0x31')](0x0,!![])[_0x364f('0x18')]();_0x4bb6d3=moment(_0x4bb6d3)[_0x364f('0x31')](0x0,!![])[_0x364f('0x32')](0x17,_0x364f('0x33'))[_0x364f('0x32')](0x3b,_0x364f('0x34'))['add'](0x3b,_0x364f('0x35'))[_0x364f('0x18')]();}_0x5145b5={'start':_0x39ef3e,'end':_0x4bb6d3};break;default:_0x5145b5[_0x364f('0x2e')]=_0x39ef3e;break;}return _0x5145b5;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index b6297ed..8ba38a8 100644 --- a/server/components/parsers/qs.js +++ b/server/components/parsers/qs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae79=['filters','find','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','$lte','subtract','isArray','limit','offset','sort','map','indexOf','priority','cast','substr','DESC','col','unsigned','ASC','isEmpty','omit','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','includes','push','join','lodash','sequelize','moment','split'];(function(_0x2ab66e,_0x99cf8b){var _0x5034ed=function(_0x256053){while(--_0x256053){_0x2ab66e['push'](_0x2ab66e['shift']());}};_0x5034ed(++_0x99cf8b);}(_0xae79,0x1bf));var _0x9ae7=function(_0x14a74e,_0x3c3334){_0x14a74e=_0x14a74e-0x0;var _0x567c9e=_0xae79[_0x14a74e];return _0x567c9e;};'use strict';var _=require(_0x9ae7('0x0'));var sequelize=require(_0x9ae7('0x1'));var moment=require(_0x9ae7('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x4dfa79){var _0x3e5908=null;if(_0x4dfa79){_0x3e5908=_0x4dfa79[_0x9ae7('0x3')](',');}return _0x3e5908;};exports[_0x9ae7('0x4')]=function(_0x2926db,_0x4762db){var _0x163bf0={};if(!_['isEmpty'](_0x2926db)){_['forOwn'](_0x2926db,function(_0x26bfe0,_0xc495f2){try{if(_0x4762db){var _0x32dbcf=_[_0x9ae7('0x5')](_0x4762db,{'name':_0xc495f2})||{};if(_0x32dbcf['type']===_0x9ae7('0x6')&&_[_0x9ae7('0x7')](_0x26bfe0)){var _0x3176c6=JSON[_0x9ae7('0x8')](_0x26bfe0);var _0x356bda={'$gte':moment(moment(_0x3176c6[_0x9ae7('0x9')])[_0x9ae7('0xa')](_0x9ae7('0xb')))['utc']()[_0x9ae7('0xa')](),'$lte':moment(moment(_0x3176c6[_0x9ae7('0xc')])[_0x9ae7('0xa')](_0x9ae7('0xb')))['utc']()[_0x9ae7('0xd')](0x1,'s')['format']()};_0x163bf0[_0xc495f2]=_0x356bda;}else{_0x163bf0[_0xc495f2]=_[_0x9ae7('0xe')](_0x26bfe0)?_0x26bfe0:JSON[_0x9ae7('0x8')](_0x26bfe0);}}else{_0x163bf0[_0xc495f2]=_[_0x9ae7('0xe')](_0x26bfe0)?_0x26bfe0:JSON['parse'](_0x26bfe0);}}catch(_0x14dd0f){_0x163bf0[_0xc495f2]=_0x26bfe0[_0x9ae7('0x3')](',');}});}return _0x163bf0;};exports[_0x9ae7('0xf')]=function(_0x4fc2c8){_0x4fc2c8=parseInt(_0x4fc2c8,0xa);if(!_0x4fc2c8||_0x4fc2c8<0x0){_0x4fc2c8=LIMIT_VALUE;}return _0x4fc2c8;};exports[_0x9ae7('0x10')]=function(_0x39e968){_0x39e968=parseInt(_0x39e968,0xa);if(!_0x39e968||_0x39e968<0x0){_0x39e968=0x0;}return _0x39e968;};exports[_0x9ae7('0x11')]=function(_0x2367f4){var _0x1ee006,_0x1c7626=null;if(_0x2367f4){_0x1ee006=_0x2367f4[_0x9ae7('0x3')](',');_0x1c7626=_[_0x9ae7('0x12')](_0x1ee006,function(_0x1f7072){if(_0x1f7072[_0x9ae7('0x13')]('-')===0x0){return[_0x1f7072===_0x9ae7('0x14')?sequelize[_0x9ae7('0x15')](sequelize['col'](_0x9ae7('0x14')),'unsigned'):_0x1f7072[_0x9ae7('0x16')](0x1),_0x9ae7('0x17')];}else{return[_0x1f7072===_0x9ae7('0x14')?sequelize['cast'](sequelize[_0x9ae7('0x18')](_0x9ae7('0x14')),_0x9ae7('0x19')):_0x1f7072,_0x9ae7('0x1a')];}});}return _0x1c7626;};exports['omit']=function(_0xb56945,_0x48933e){if(_[_0x9ae7('0x1b')](_0xb56945)){return _0xb56945;}if(_[_0x9ae7('0xe')](_0xb56945)){for(var _0x335247=0x0;_0x335247<_0xb56945['length'];_0x335247+=0x1){_0xb56945[_0x335247]=this[_0x9ae7('0x1c')](_0xb56945[_0x335247],_0x48933e);}return _0xb56945;}if(!_['isObject'](_0xb56945)){return _0xb56945;}if(_[_0x9ae7('0x1d')](_0x48933e)){_0x48933e=[_0x48933e];}if(!_[_0x9ae7('0xe')](_0x48933e)){return _0xb56945;}for(var _0x4ec2e8=0x0;_0x4ec2e8<_0x48933e[_0x9ae7('0x1e')];_0x4ec2e8+=0x1){_[_0x9ae7('0x1f')](_0xb56945,_0x48933e[_0x4ec2e8]);}for(var _0x4e65a0 in _0xb56945){if(_0xb56945[_0x9ae7('0x20')](_0x4e65a0)){_0xb56945[_0x4e65a0]=this[_0x9ae7('0x1c')](_0xb56945[_0x4e65a0],_0x48933e);}}return _0xb56945;};exports[_0x9ae7('0x21')]=function(_0xe5fb82){return _0xe5fb82[_0x9ae7('0x22')](RegExp(_0x9ae7('0x23')))?!![]:![];};exports[_0x9ae7('0x24')]=function(_0x47a3d5){return _0x47a3d5[_0x9ae7('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x9ae7('0x25')]=function(_0x14f78b){var _0x4e7877=[];_0x14f78b['split'](/[ ,]+/)['forEach'](function(_0x3b34b1){_0x3b34b1=_0x3b34b1['replace'](/([^:]")"+/g,'$1');_0x3b34b1='+'+_0x3b34b1+'*';if(_0x3b34b1[_0x9ae7('0x26')]('@'))_0x3b34b1='\x22'+_0x3b34b1+'\x22';_0x4e7877[_0x9ae7('0x27')](_0x3b34b1);});return _0x4e7877[_0x9ae7('0x28')]('\x20');}; \ No newline at end of file +var _0x2990=['join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','limit','offset','sort','map','indexOf','priority','unsigned','substr','DESC','cast','col','ASC','omit','isArray','length','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','includes','push'];(function(_0x3226b5,_0x25aeeb){var _0x4a7920=function(_0x25b98d){while(--_0x25b98d){_0x3226b5['push'](_0x3226b5['shift']());}};_0x4a7920(++_0x25aeeb);}(_0x2990,0x135));var _0x0299=function(_0x2f0fff,_0x2a412c){_0x2f0fff=_0x2f0fff-0x0;var _0x3bf658=_0x2990[_0x2f0fff];return _0x3bf658;};'use strict';var _=require(_0x0299('0x0'));var sequelize=require(_0x0299('0x1'));var moment=require(_0x0299('0x2'));var LIMIT_VALUE=0xfa;exports[_0x0299('0x3')]=function(_0x127ed2){var _0x559bd7=null;if(_0x127ed2){_0x559bd7=_0x127ed2[_0x0299('0x4')](',');}return _0x559bd7;};exports[_0x0299('0x5')]=function(_0x1e45c6,_0x5c0d13){var _0x47602e={};if(!_[_0x0299('0x6')](_0x1e45c6)){_[_0x0299('0x7')](_0x1e45c6,function(_0x3e60c3,_0x322b6c){try{if(_0x5c0d13){var _0x1f8a91=_['find'](_0x5c0d13,{'name':_0x322b6c})||{};if(_0x1f8a91[_0x0299('0x8')]===_0x0299('0x9')&&_[_0x0299('0xa')](_0x3e60c3)){var _0x4a0132=JSON[_0x0299('0xb')](_0x3e60c3);var _0xabb2b3={'$gte':moment(moment(_0x4a0132[_0x0299('0xc')])[_0x0299('0xd')](_0x0299('0xe')))[_0x0299('0xf')]()[_0x0299('0xd')](),'$lte':moment(moment(_0x4a0132[_0x0299('0x10')])[_0x0299('0xd')](_0x0299('0xe')))[_0x0299('0xf')]()[_0x0299('0x11')](0x1,'s')[_0x0299('0xd')]()};_0x47602e[_0x322b6c]=_0xabb2b3;}else{_0x47602e[_0x322b6c]=_['isArray'](_0x3e60c3)?_0x3e60c3:JSON[_0x0299('0xb')](_0x3e60c3);}}else{_0x47602e[_0x322b6c]=_['isArray'](_0x3e60c3)?_0x3e60c3:JSON[_0x0299('0xb')](_0x3e60c3);}}catch(_0xd81bba){_0x47602e[_0x322b6c]=_0x3e60c3[_0x0299('0x4')](',');}});}return _0x47602e;};exports[_0x0299('0x12')]=function(_0x136d0e){_0x136d0e=parseInt(_0x136d0e,0xa);if(!_0x136d0e||_0x136d0e<0x0){_0x136d0e=LIMIT_VALUE;}return _0x136d0e;};exports[_0x0299('0x13')]=function(_0x1cea7b){_0x1cea7b=parseInt(_0x1cea7b,0xa);if(!_0x1cea7b||_0x1cea7b<0x0){_0x1cea7b=0x0;}return _0x1cea7b;};exports[_0x0299('0x14')]=function(_0x34b6f8){var _0x23908c,_0x54a2af=null;if(_0x34b6f8){_0x23908c=_0x34b6f8[_0x0299('0x4')](',');_0x54a2af=_[_0x0299('0x15')](_0x23908c,function(_0x257523){if(_0x257523[_0x0299('0x16')]('-')===0x0){return[_0x257523===_0x0299('0x17')?sequelize['cast'](sequelize['col'](_0x0299('0x17')),_0x0299('0x18')):_0x257523[_0x0299('0x19')](0x1),_0x0299('0x1a')];}else{return[_0x257523===_0x0299('0x17')?sequelize[_0x0299('0x1b')](sequelize[_0x0299('0x1c')]('priority'),_0x0299('0x18')):_0x257523,_0x0299('0x1d')];}});}return _0x54a2af;};exports[_0x0299('0x1e')]=function(_0x106ee3,_0x3a673e){if(_[_0x0299('0x6')](_0x106ee3)){return _0x106ee3;}if(_[_0x0299('0x1f')](_0x106ee3)){for(var _0x420f68=0x0;_0x420f68<_0x106ee3[_0x0299('0x20')];_0x420f68+=0x1){_0x106ee3[_0x420f68]=this[_0x0299('0x1e')](_0x106ee3[_0x420f68],_0x3a673e);}return _0x106ee3;}if(!_['isObject'](_0x106ee3)){return _0x106ee3;}if(_['isString'](_0x3a673e)){_0x3a673e=[_0x3a673e];}if(!_[_0x0299('0x1f')](_0x3a673e)){return _0x106ee3;}for(var _0x2216a5=0x0;_0x2216a5<_0x3a673e['length'];_0x2216a5+=0x1){_[_0x0299('0x21')](_0x106ee3,_0x3a673e[_0x2216a5]);}for(var _0x373cc5 in _0x106ee3){if(_0x106ee3[_0x0299('0x22')](_0x373cc5)){_0x106ee3[_0x373cc5]=this[_0x0299('0x1e')](_0x106ee3[_0x373cc5],_0x3a673e);}}return _0x106ee3;};exports[_0x0299('0x23')]=function(_0x37e3c7){return _0x37e3c7['match'](RegExp(_0x0299('0x24')))?!![]:![];};exports[_0x0299('0x25')]=function(_0x30430c){return _0x30430c[_0x0299('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x0299('0x27')]=function(_0x59b906){var _0x290177=[];_0x59b906[_0x0299('0x4')](/[ ,]+/)[_0x0299('0x28')](function(_0x500064){_0x500064=_0x500064['replace'](/([^:]")"+/g,'$1');_0x500064='+'+_0x500064+'*';if(_0x500064[_0x0299('0x29')]('@'))_0x500064='\x22'+_0x500064+'\x22';_0x290177[_0x0299('0x2a')](_0x500064);});return _0x290177[_0x0299('0x2b')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8c7eba2..b03e66e 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8d1=['appPath','join','client','use','json\x20replacer','toISOString','split','views','/server/views','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','express','body-parser','method-override','cookie-parser','path','passport','cors','../mysqldb','default','get','env','production','set','root','development','test'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0xd8d1,0xd0));var _0x1d8d=function(_0x45e4cb,_0x7271d2){_0x45e4cb=_0x45e4cb-0x0;var _0x228924=_0xd8d1[_0x45e4cb];return _0x228924;};'use strict';var express=require(_0x1d8d('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x1d8d('0x1'));var methodOverride=require(_0x1d8d('0x2'));var cookieParser=require(_0x1d8d('0x3'));var errorHandler=require('errorhandler');var path=require(_0x1d8d('0x4'));var passport=require(_0x1d8d('0x5'));var cors=require(_0x1d8d('0x6'));var moment=require('moment');var config=require('./environment');var db=require(_0x1d8d('0x7'))['db'];exports[_0x1d8d('0x8')]=function(_0x156543){var _0x311c23=_0x156543[_0x1d8d('0x9')](_0x1d8d('0xa'));if(_0x311c23===_0x1d8d('0xb')){_0x156543[_0x1d8d('0xc')]('appPath',path['join'](config[_0x1d8d('0xd')],'public'));}if(_0x311c23===_0x1d8d('0xe')||_0x311c23===_0x1d8d('0xf')){_0x156543[_0x1d8d('0xc')](_0x1d8d('0x10'),path[_0x1d8d('0x11')](config[_0x1d8d('0xd')],_0x1d8d('0x12')));_0x156543[_0x1d8d('0x13')](errorHandler());}_0x156543[_0x1d8d('0xc')](_0x1d8d('0x14'),function(_0x59c477,_0x5680de){if(this[_0x59c477]instanceof Date){_0x5680de=this[_0x59c477][_0x1d8d('0x15')]()[_0x1d8d('0x16')]('.')[0x0]+'Z';}return _0x5680de;});_0x156543['use'](express['static'](_0x156543['get'](_0x1d8d('0x10'))));_0x156543[_0x1d8d('0xc')](_0x1d8d('0x17'),config[_0x1d8d('0xd')]+_0x1d8d('0x18'));_0x156543['engine'](_0x1d8d('0x19'),require(_0x1d8d('0x1a'))[_0x1d8d('0x1b')]);_0x156543[_0x1d8d('0xc')](_0x1d8d('0x1c'),_0x1d8d('0x19'));_0x156543[_0x1d8d('0x13')](bodyParser[_0x1d8d('0x1d')]({'limit':_0x1d8d('0x1e'),'extended':!![]}));_0x156543[_0x1d8d('0x13')](bodyParser[_0x1d8d('0x1f')]({'limit':_0x1d8d('0x1e')}));_0x156543[_0x1d8d('0x13')](cors());_0x156543[_0x1d8d('0x13')](methodOverride());_0x156543[_0x1d8d('0x13')](cookieParser());_0x156543[_0x1d8d('0x13')](passport['initialize']());}; \ No newline at end of file +var _0x7c39=['appPath','join','root','development','test','set','client','use','json\x20replacer','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','json','50mb','initialize','express','serve-favicon','method-override','cookie-parser','errorhandler','path','default','get','env','production'];(function(_0x43a638,_0x1acad1){var _0x321f13=function(_0x2784ff){while(--_0x2784ff){_0x43a638['push'](_0x43a638['shift']());}};_0x321f13(++_0x1acad1);}(_0x7c39,0x17c));var _0x97c3=function(_0xf05c0d,_0x3f8729){_0xf05c0d=_0xf05c0d-0x0;var _0x4a1a1b=_0x7c39[_0xf05c0d];return _0x4a1a1b;};'use strict';var express=require(_0x97c3('0x0'));var favicon=require(_0x97c3('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x97c3('0x2'));var cookieParser=require(_0x97c3('0x3'));var errorHandler=require(_0x97c3('0x4'));var path=require(_0x97c3('0x5'));var passport=require('passport');var cors=require('cors');var moment=require('moment');var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x97c3('0x6')]=function(_0xca3cd5){var _0x573550=_0xca3cd5[_0x97c3('0x7')](_0x97c3('0x8'));if(_0x573550===_0x97c3('0x9')){_0xca3cd5['set'](_0x97c3('0xa'),path[_0x97c3('0xb')](config[_0x97c3('0xc')],'public'));}if(_0x573550===_0x97c3('0xd')||_0x573550===_0x97c3('0xe')){_0xca3cd5[_0x97c3('0xf')]('appPath',path[_0x97c3('0xb')](config[_0x97c3('0xc')],_0x97c3('0x10')));_0xca3cd5[_0x97c3('0x11')](errorHandler());}_0xca3cd5[_0x97c3('0xf')](_0x97c3('0x12'),function(_0x53212e,_0x580f8e){if(this[_0x53212e]instanceof Date){_0x580f8e=this[_0x53212e]['toISOString']()[_0x97c3('0x13')]('.')[0x0]+'Z';}return _0x580f8e;});_0xca3cd5[_0x97c3('0x11')](express[_0x97c3('0x14')](_0xca3cd5['get'](_0x97c3('0xa'))));_0xca3cd5[_0x97c3('0xf')]('views',config[_0x97c3('0xc')]+_0x97c3('0x15'));_0xca3cd5[_0x97c3('0x16')](_0x97c3('0x17'),require(_0x97c3('0x18'))[_0x97c3('0x19')]);_0xca3cd5[_0x97c3('0xf')](_0x97c3('0x1a'),'html');_0xca3cd5[_0x97c3('0x11')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0xca3cd5[_0x97c3('0x11')](bodyParser[_0x97c3('0x1b')]({'limit':_0x97c3('0x1c')}));_0xca3cd5[_0x97c3('0x11')](cors());_0xca3cd5[_0x97c3('0x11')](methodOverride());_0xca3cd5[_0x97c3('0x11')](cookieParser());_0xca3cd5[_0x97c3('0x11')](passport[_0x97c3('0x1d')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f131afa..eaf57fc 100644 --- a/server/config/license/hardware.js +++ b/server/config/license/hardware.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d9f=['127.0.0.1','cpus','map','join','createHash','md5','update','hex','getUuid','platform','win32','utf8','replace','hostname','macAddress','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','filter','family','IPv4','concat','head','mac','address'];(function(_0x3b2421,_0xf30f91){var _0x288bde=function(_0x1d1db6){while(--_0x1d1db6){_0x3b2421['push'](_0x3b2421['shift']());}};_0x288bde(++_0xf30f91);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x1a4b42,_0x198645){_0x1a4b42=_0x1a4b42-0x0;var _0x4e78a9=_0x7d9f[_0x1a4b42];return _0x4e78a9;};'use strict';var _=require(_0xf7d9('0x0'));var os=require('os');var crypto=require(_0xf7d9('0x1'));var machine=require(_0xf7d9('0x2'));var exec=require(_0xf7d9('0x3'))[_0xf7d9('0x4')];function getInterfaces(){var _0x538e69=[];var _0x15a23b=os[_0xf7d9('0x5')]();var _0xd43b74=_[_0xf7d9('0x6')](_[_0xf7d9('0x7')](_0x15a23b));for(var _0x53fdaf=0x0;_0x53fdaf<_0xd43b74['length'];_0x53fdaf++){var _0x2eb0f1=_0x15a23b[_0xd43b74[_0x53fdaf]][_0xf7d9('0x8')](function(_0x5772b4){return _0x5772b4[_0xf7d9('0x9')]===_0xf7d9('0xa')&&_0x5772b4['internal']===![];});_0x538e69=_0x538e69[_0xf7d9('0xb')](_0x2eb0f1);}return _0x538e69;}function getFirstInterface(){var _0x4cd620=_[_0xf7d9('0xc')](getInterfaces());return{'macAddress':_0x4cd620&&_0x4cd620[_0xf7d9('0xd')]?_0x4cd620['mac']:'00:00:00:00:00:00','ipAddress':_0x4cd620&&_0x4cd620[_0xf7d9('0xe')]?_0x4cd620[_0xf7d9('0xe')]:_0xf7d9('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x480d4a=_[_0xf7d9('0x6')](os[_0xf7d9('0x10')]()[_0xf7d9('0x11')](function(_0x35e156){return _0x35e156['model'];}))[_0xf7d9('0x12')](':');return crypto[_0xf7d9('0x13')](_0xf7d9('0x14'))[_0xf7d9('0x15')](_0x480d4a)['digest'](_0xf7d9('0x16'));}exports[_0xf7d9('0x17')]=function(){switch(os[_0xf7d9('0x18')]()){case _0xf7d9('0x19'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf7d9('0x1a')})[_0xf7d9('0x1b')]('\x0d\x0a','');default:var _0x341e27=getFirstInterface();var _0x4c1972=getCPUhash();var _0x539ea7=_0x4c1972+'|'+os[_0xf7d9('0x1c')]()+'|'+_0x341e27[_0xf7d9('0x1d')]+'|'+_0x341e27[_0xf7d9('0x1e')];var _0x5d1098=crypto[_0xf7d9('0x13')](_0xf7d9('0x14'))['update'](_0x539ea7)[_0xf7d9('0x1f')]('hex');return _0x5d1098[_0xf7d9('0x20')](0x0,0x8)+'-'+_0x5d1098[_0xf7d9('0x20')](0x8,0xc)+'-'+_0x5d1098['substring'](0xc,0x10)+'-'+_0x5d1098[_0xf7d9('0x20')](0x10,0x14)+'-'+_0x5d1098[_0xf7d9('0x20')](0x14);}}; \ No newline at end of file +var _0xc23a=['map','model','join','createHash','md5','update','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','crypto','bimedia-machine-uuid','child_process','keys','length','family','IPv4','concat','head','mac','address','127.0.0.1','orderBy','cpus'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xc23a,0xd2));var _0xac23=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xc23a[_0x5cc8b9];return _0x58892e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xac23('0x0'));var machine=require(_0xac23('0x1'));var exec=require(_0xac23('0x2'))['execSync'];function getInterfaces(){var _0x99f7dc=[];var _0x4e806e=os['networkInterfaces']();var _0x35c541=_['orderBy'](_[_0xac23('0x3')](_0x4e806e));for(var _0x22a991=0x0;_0x22a991<_0x35c541[_0xac23('0x4')];_0x22a991++){var _0x4c1482=_0x4e806e[_0x35c541[_0x22a991]]['filter'](function(_0x44b7d2){return _0x44b7d2[_0xac23('0x5')]===_0xac23('0x6')&&_0x44b7d2['internal']===![];});_0x99f7dc=_0x99f7dc[_0xac23('0x7')](_0x4c1482);}return _0x99f7dc;}function getFirstInterface(){var _0x450229=_[_0xac23('0x8')](getInterfaces());return{'macAddress':_0x450229&&_0x450229[_0xac23('0x9')]?_0x450229['mac']:'00:00:00:00:00:00','ipAddress':_0x450229&&_0x450229['address']?_0x450229[_0xac23('0xa')]:_0xac23('0xb')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3fe7c6=_[_0xac23('0xc')](os[_0xac23('0xd')]()[_0xac23('0xe')](function(_0x261ee1){return _0x261ee1[_0xac23('0xf')];}))[_0xac23('0x10')](':');return crypto[_0xac23('0x11')](_0xac23('0x12'))[_0xac23('0x13')](_0x3fe7c6)['digest'](_0xac23('0x14'));}exports[_0xac23('0x15')]=function(){switch(os['platform']()){case'win32':return exec(_0xac23('0x16'),{'encoding':_0xac23('0x17')})[_0xac23('0x18')]('\x0d\x0a','');default:var _0x49fa85=getFirstInterface();var _0x138548=getCPUhash();var _0x1c117f=_0x138548+'|'+os[_0xac23('0x19')]()+'|'+_0x49fa85[_0xac23('0x1a')]+'|'+_0x49fa85['ipAddress'];var _0xca15dd=crypto[_0xac23('0x11')](_0xac23('0x12'))['update'](_0x1c117f)['digest'](_0xac23('0x14'));return _0xca15dd[_0xac23('0x1b')](0x0,0x8)+'-'+_0xca15dd[_0xac23('0x1b')](0x8,0xc)+'-'+_0xca15dd[_0xac23('0x1b')](0xc,0x10)+'-'+_0xca15dd['substring'](0x10,0x14)+'-'+_0xca15dd[_0xac23('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3d54d5a..2c99328 100644 --- a/server/config/license/index.js +++ b/server/config/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x948c=['process','https://www.xcallymotion.com','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','license'];(function(_0x24f1ff,_0x4014c9){var _0x349109=function(_0x253267){while(--_0x253267){_0x24f1ff['push'](_0x24f1ff['shift']());}};_0x349109(++_0x4014c9);}(_0x948c,0x119));var _0xc948=function(_0x342874,_0xae5304){_0x342874=_0x342874-0x0;var _0x503c39=_0x948c[_0x342874];return _0x503c39;};'use strict';var util=require(_0xc948('0x0'));var moment=require(_0xc948('0x1'));var rp=require(_0xc948('0x2'));var BPromise=require(_0xc948('0x3'));var pkginfo=require(_0xc948('0x4'))(module,_0xc948('0x5'));var db=require(_0xc948('0x6'))['db'];var encryptor=require(_0xc948('0x7'));var hardware=require('./hardware');var logger=require('../logger')(_0xc948('0x8'));var jira=require('../../api/jira/jira.controller');const {config}=require(_0xc948('0x9'));var HOST=_0xc948('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x521a72){return new BPromise(function(_0x304af1,_0x3a3de3){var _0xf9444d=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x521a72,module[_0xc948('0xb')][_0xc948('0x5')]);if(oldToken){_0xf9444d=util[_0xc948('0xc')](_0xc948('0xd'),HOST,_0x521a72,module['exports'][_0xc948('0x5')],oldToken);}var _0x2496ae={'uri':_0xf9444d,'method':_0xc948('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2496ae)[_0xc948('0xf')](function(_0x1eb873){_0x304af1(_0x1eb873);})[_0xc948('0x10')](function(_0x5e6109){_0x3a3de3(_0x5e6109);});});}function sendJiraAlert(_0x187846,_0x214c29,_0x1c55f7){var _0x2430e0=_0xc948('0x11');return db[_0xc948('0x12')][_0xc948('0x13')]({'where':{'role':_0xc948('0x14')},'attributes':[_0xc948('0x15'),_0xc948('0x16')],'raw':!![]})['then'](function(_0x15249b){ADMIN=_0x15249b;_0x2430e0+=_0xc948('0x17')+_0x1c55f7+'|\x0a';_0x2430e0+=_0xc948('0x18')+_0x187846+'|\x0a';_0x2430e0+=_0xc948('0x19')+_0x214c29+'|\x0a';_0x2430e0+=_0xc948('0x1a')+ADMIN['fullname']+'|\x0a';_0x2430e0+=_0xc948('0x1b')+ADMIN[_0xc948('0x16')]+'|\x0a';return _0x2430e0;})[_0xc948('0xf')](function(_0x58494e){var _0x39088f=hardware[_0xc948('0x1c')]()[_0xc948('0x1d')];return jira['openIssue']({'key':_0xc948('0x1e'),'summary':_0xc948('0x1f'),'description':_0x58494e,'issuetype':'Alert','oldToken':_0x187846,'newToken':_0x214c29,'email':ADMIN[_0xc948('0x16')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x39088f});});}function manageLicense(_0x855b56,_0x2537c3){var _0x4cf151=_0x2537c3[_0xc948('0x20')]({'plain':!![]});httpRequest(_0x855b56)['then'](function(_0xf216c0){if(oldToken){oldToken=undefined;}if(_0xf216c0[_0xc948('0x21')]){if(!_0x4cf151[_0xc948('0x8')]&&_0x4cf151[_0xc948('0x8')]!=_0xf216c0[_0xc948('0x8')]||_0x4cf151[_0xc948('0x8')]&&_0x4cf151[_0xc948('0x22')]){logger[_0xc948('0x23')](_0xc948('0x24'));}if(_0x4cf151[_0xc948('0x8')]&&!_0x4cf151['data2']&&_0x4cf151[_0xc948('0x8')]!=_0xf216c0[_0xc948('0x8')]){logger[_0xc948('0x23')](_0xc948('0x25'));}if(_0x4cf151[_0xc948('0x8')]&&!_0x4cf151[_0xc948('0x22')]&&_0x4cf151['license']==_0xf216c0[_0xc948('0x8')]){return _0x2537c3;}return _0x2537c3[_0xc948('0x26')]({'data1':_0x855b56,'data2':null,'license':_0xf216c0['license']});}else{if(_0xf216c0['license']||_0x4cf151[_0xc948('0x8')]){if(!_0x4cf151['data2']){if(_0x4cf151['data1']==_0x855b56){GRAY_PERIOD_REASON=_0xc948('0x27');logger[_0xc948('0x23')](_0xc948('0x28'));}else{GRAY_PERIOD_REASON=_0xc948('0x29');oldToken=_0x4cf151[_0xc948('0x2a')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4cf151[_0xc948('0x2a')],_0x855b56);}sendJiraAlert(_0x4cf151[_0xc948('0x2a')],_0xf216c0[_0xc948('0x2b')],GRAY_PERIOD_REASON);logger[_0xc948('0x23')](_0xc948('0x2c'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0xc948('0x2d')));return _0x2537c3[_0xc948('0x26')]({'data2':encryptor[_0xc948('0x2e')](moment()['format'](_0xc948('0x2d')))});}else{if(moment()[_0xc948('0x2f')](encryptor[_0xc948('0x30')](_0x4cf151[_0xc948('0x22')]),_0xc948('0x31'))>DAYS){logger[_0xc948('0x23')](_0xc948('0x32'),moment()[_0xc948('0xc')](_0xc948('0x2d')));return _0x2537c3[_0xc948('0x26')]({'data1':_0x855b56,'data2':null,'license':null});}}}else{if(_0x4cf151[_0xc948('0x2a')]!=_0x855b56){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4cf151[_0xc948('0x2a')],_0x855b56);return _0x2537c3['update']({'data1':_0x855b56,'data2':null,'license':null});}}}return _0x2537c3;})[_0xc948('0xf')](function(_0x32013a){_0x2537c3=_0x32013a;})[_0xc948('0x10')](function(_0x5592d9){logger['error'](_0x5592d9['message']);})[_0xc948('0x33')](function(){setTimeout(function(){manageLicense(hardware[_0xc948('0x34')](),_0x2537c3);},TIME);});}function defaultLicense(){var _0x5af386=hardware['getUuid']();if(_0x5af386){return db['License'][_0xc948('0x35')]({'where':{'id':0x1},'defaults':{'data1':_0x5af386}})[_0xc948('0x36')](function(_0x59814b,_0x424904){logger['info'](_0xc948('0x37'),_0x5af386);manageLicense(_0x5af386,_0x59814b);})['catch'](function(_0x514a4f){logger['error'](_0x514a4f[_0xc948('0x38')]);});}}exports[_0xc948('0x39')]=defaultLicense; \ No newline at end of file +var _0x8054=['email','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','data1','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','../../api/jira/jira.controller','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','findOne','fullname','|reason|','|uuid|','|machineUuid|','|email|'];(function(_0x2a5124,_0x3d1d8f){var _0x19cadc=function(_0x4d8b38){while(--_0x4d8b38){_0x2a5124['push'](_0x2a5124['shift']());}};_0x19cadc(++_0x3d1d8f);}(_0x8054,0x85));var _0x4805=function(_0x5ef430,_0x166a45){_0x5ef430=_0x5ef430-0x0;var _0x3bb68b=_0x8054[_0x5ef430];return _0x3bb68b;};'use strict';var util=require(_0x4805('0x0'));var moment=require(_0x4805('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x4805('0x2'))(module,_0x4805('0x3'));var db=require(_0x4805('0x4'))['db'];var encryptor=require(_0x4805('0x5'));var hardware=require('./hardware');var logger=require(_0x4805('0x6'))(_0x4805('0x7'));var jira=require(_0x4805('0x8'));const {config}=require('process');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x23c120){return new BPromise(function(_0x5dcedd,_0x58505c){var _0x1bd70c=util[_0x4805('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x23c120,module[_0x4805('0xa')][_0x4805('0x3')]);if(oldToken){_0x1bd70c=util[_0x4805('0x9')](_0x4805('0xb'),HOST,_0x23c120,module['exports'][_0x4805('0x3')],oldToken);}var _0x319176={'uri':_0x1bd70c,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x319176)[_0x4805('0xc')](function(_0x4d6af3){_0x5dcedd(_0x4d6af3);})[_0x4805('0xd')](function(_0x2bccda){_0x58505c(_0x2bccda);});});}function sendJiraAlert(_0x2f499c,_0x926e12,_0x3cc943){var _0x1ba1ea='||FIELD||VALUE||\x0a';return db['User'][_0x4805('0xe')]({'where':{'role':'admin'},'attributes':[_0x4805('0xf'),'email'],'raw':!![]})[_0x4805('0xc')](function(_0x255ba6){ADMIN=_0x255ba6;_0x1ba1ea+=_0x4805('0x10')+_0x3cc943+'|\x0a';_0x1ba1ea+=_0x4805('0x11')+_0x2f499c+'|\x0a';_0x1ba1ea+=_0x4805('0x12')+_0x926e12+'|\x0a';_0x1ba1ea+='|name|'+ADMIN[_0x4805('0xf')]+'|\x0a';_0x1ba1ea+=_0x4805('0x13')+ADMIN[_0x4805('0x14')]+'|\x0a';return _0x1ba1ea;})['then'](function(_0x272136){var _0x4c2fc9=hardware['getFirstInterface']()[_0x4805('0x15')];return jira[_0x4805('0x16')]({'key':_0x4805('0x17'),'summary':_0x4805('0x18'),'description':_0x272136,'issuetype':'Alert','oldToken':_0x2f499c,'newToken':_0x926e12,'email':ADMIN[_0x4805('0x14')],'name':ADMIN[_0x4805('0xf')],'reason':GRAY_PERIOD_REASON,'ip':_0x4c2fc9});});}function manageLicense(_0x3e00c1,_0x5a9771){var _0x2dae93=_0x5a9771[_0x4805('0x19')]({'plain':!![]});httpRequest(_0x3e00c1)[_0x4805('0xc')](function(_0x31a89c){if(oldToken){oldToken=undefined;}if(_0x31a89c[_0x4805('0x1a')]){if(!_0x2dae93['license']&&_0x2dae93[_0x4805('0x7')]!=_0x31a89c[_0x4805('0x7')]||_0x2dae93[_0x4805('0x7')]&&_0x2dae93[_0x4805('0x1b')]){logger[_0x4805('0x1c')](_0x4805('0x1d'));}if(_0x2dae93['license']&&!_0x2dae93[_0x4805('0x1b')]&&_0x2dae93[_0x4805('0x7')]!=_0x31a89c[_0x4805('0x7')]){logger[_0x4805('0x1c')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2dae93[_0x4805('0x7')]&&!_0x2dae93['data2']&&_0x2dae93[_0x4805('0x7')]==_0x31a89c[_0x4805('0x7')]){return _0x5a9771;}return _0x5a9771[_0x4805('0x1e')]({'data1':_0x3e00c1,'data2':null,'license':_0x31a89c[_0x4805('0x7')]});}else{if(_0x31a89c[_0x4805('0x7')]||_0x2dae93[_0x4805('0x7')]){if(!_0x2dae93['data2']){if(_0x2dae93[_0x4805('0x1f')]==_0x3e00c1){GRAY_PERIOD_REASON=_0x4805('0x20');logger[_0x4805('0x1c')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x4805('0x21');oldToken=_0x2dae93[_0x4805('0x1f')];logger['info'](_0x4805('0x22'),_0x2dae93['data1'],_0x3e00c1);}sendJiraAlert(_0x2dae93[_0x4805('0x1f')],_0x31a89c[_0x4805('0x23')],GRAY_PERIOD_REASON);logger[_0x4805('0x1c')](_0x4805('0x24'),GRAY_PERIOD_REASON[_0x4805('0x25')](),moment()[_0x4805('0x9')](_0x4805('0x26')));return _0x5a9771['update']({'data2':encryptor[_0x4805('0x27')](moment()[_0x4805('0x9')](_0x4805('0x26')))});}else{if(moment()[_0x4805('0x28')](encryptor['decryptString'](_0x2dae93[_0x4805('0x1b')]),_0x4805('0x29'))>DAYS){logger[_0x4805('0x1c')](_0x4805('0x2a'),moment()['format'](_0x4805('0x26')));return _0x5a9771[_0x4805('0x1e')]({'data1':_0x3e00c1,'data2':null,'license':null});}}}else{if(_0x2dae93[_0x4805('0x1f')]!=_0x3e00c1){logger[_0x4805('0x1c')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2dae93['data1'],_0x3e00c1);return _0x5a9771['update']({'data1':_0x3e00c1,'data2':null,'license':null});}}}return _0x5a9771;})['then'](function(_0x258798){_0x5a9771=_0x258798;})[_0x4805('0xd')](function(_0x4d2dd2){logger[_0x4805('0x2b')](_0x4d2dd2[_0x4805('0x2c')]);})[_0x4805('0x2d')](function(){setTimeout(function(){manageLicense(hardware[_0x4805('0x2e')](),_0x5a9771);},TIME);});}function defaultLicense(){var _0x43c7cf=hardware['getUuid']();if(_0x43c7cf){return db[_0x4805('0x2f')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x43c7cf}})[_0x4805('0x30')](function(_0x37993e,_0x316f1f){logger[_0x4805('0x1c')](_0x4805('0x31'),_0x43c7cf);manageLicense(_0x43c7cf,_0x37993e);})['catch'](function(_0x3ff7ec){logger[_0x4805('0x2b')](_0x3ff7ec['message']);});}}exports[_0x4805('0x32')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 8c68094..c8443e8 100644 --- a/server/config/license/util.js +++ b/server/config/license/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6687=['catch','license','data1','data2','split','decryptString','format','parse','demo','machineUuid','deadline','grayReason','uuid','changed','message','User','findAll','role','COUNT','sequelize','user','users','telephones','forEach','admin','count','countBy','telephone','License\x20limit\x20reached\x20for\x20users','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then'];(function(_0x210014,_0x288069){var _0x39259f=function(_0x18fb2f){while(--_0x18fb2f){_0x210014['push'](_0x210014['shift']());}};_0x39259f(++_0x288069);}(_0x6687,0x9c));var _0x7668=function(_0xdb6c2b,_0x5c6aae){_0xdb6c2b=_0xdb6c2b-0x0;var _0xc984e2=_0x6687[_0xdb6c2b];return _0xc984e2;};'use strict';var util=require(_0x7668('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x7668('0x1'));var hardware=require(_0x7668('0x2'));var encryptor=require(_0x7668('0x3'));var db=require(_0x7668('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7668('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7668('0x6'),'machineUuid':hardware[_0x7668('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7668('0x8'),'machineUuid':hardware[_0x7668('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1ceabe){return new BPromise(function(_0x3f023b,_0x3dced1){return db[_0x7668('0x9')][_0x7668('0xa')](_['defaults'](_0x1ceabe,{'raw':!![],'where':{'id':0x1}}))[_0x7668('0xb')](function(_0xc2b3a9){return checkLicense(_0xc2b3a9,null);})['then'](function(_0x43f1bc){_0x3f023b(_0x43f1bc);return;})[_0x7668('0xc')](function(_0xc79f9f){_0x3dced1(_0xc79f9f);});});}function checkLicense(_0x9977f6,_0x182dd7){if(!_0x9977f6){demoLicense['uuid']=_0x9977f6['data1'];return demoLicense;}try{var _0x31ac95=_0x182dd7||_0x9977f6[_0x7668('0xd')];if(_['isEmpty'](_0x31ac95)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x25b97b=_0x9977f6[_0x7668('0xe')];var _0x4f0eaf=_0x9977f6[_0x7668('0xf')];var _0x35cd15=_0x25b97b[_0x7668('0x10')]('-')[0x4];var _0xe390f2=_0x25b97b[_0x7668('0x10')]('-')[0x0];var _0x402cb6=encryptor[_0x7668('0x11')](_0x31ac95,util[_0x7668('0x12')]('%s:%s:%s',_0x35cd15,_0x25b97b,_0xe390f2));var _0x40e67d=JSON[_0x7668('0x13')](_0x402cb6);_0x40e67d[_0x7668('0x14')]=![];_0x40e67d['uuid']=_0x25b97b;_0x40e67d[_0x7668('0x15')]=hardware[_0x7668('0x7')]();if(_0x4f0eaf){var _0x34458c=encryptor[_0x7668('0x11')](_0x4f0eaf);_0x40e67d['gray']=_0x34458c;_0x40e67d[_0x7668('0x16')]=moment(_0x34458c)['add'](0x7,'days')[_0x7668('0x12')]();_0x40e67d[_0x7668('0x17')]=_0x40e67d[_0x7668('0x18')]!=_0x40e67d[_0x7668('0x15')]?_0x7668('0x19'):'disabled';}return _0x40e67d;}catch(_0x287369){breakingLicense[_0x7668('0x18')]=_0x9977f6[_0x7668('0xe')];breakingLicense[_0x7668('0x1a')]=_0x287369['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x241254,_0x15fb88){getLicense()['then'](function(_0x2059b9){return db[_0x7668('0x1b')][_0x7668('0x1c')]({'attributes':[_0x7668('0x1d'),[db['sequelize']['fn'](_0x7668('0x1e'),db[_0x7668('0x1f')]['col'](_0x7668('0x1d'))),'count']],'group':_0x7668('0x1d'),'where':{'role':{'$or':['admin',_0x7668('0x20'),'telephone']}},'raw':!![]})[_0x7668('0xb')](function(_0x154290){var _0x1c5806={'user':_0x2059b9[_0x7668('0x21')]||0x0,'telephone':_0x2059b9[_0x7668('0x22')]||0x0};_0x154290[_0x7668('0x23')](function(_0x3ad49c){var _0x3441ad=_0x3ad49c[_0x7668('0x1d')]===_0x7668('0x24')?_0x7668('0x20'):_0x3ad49c['role'];_0x1c5806[_0x3441ad]-=_0x3ad49c[_0x7668('0x25')];if(_0x1c5806[_0x3441ad]<0x0)_0x1c5806[_0x3441ad]=0x0;});_0x241254(_0x1c5806);return;});})[_0x7668('0xc')](function(_0x36a70c){_0x15fb88(_0x36a70c);});});}function checkUserLimits(_0x5f4733){return new BPromise(function(_0x5dccea,_0x564b9e){getLimits()[_0x7668('0xb')](function(_0x27c2a9){var _0x4ccdc5=_['pick'](_[_0x7668('0x26')](_0x5f4733,_0x7668('0x1d')),[_0x7668('0x24'),_0x7668('0x20'),'telephone']);var _0xb69f0c=(_0x4ccdc5['admin']||0x0)+(_0x4ccdc5[_0x7668('0x20')]||0x0);var _0x673f2a=_0x4ccdc5[_0x7668('0x27')]||0x0;if(_0xb69f0c>_0x27c2a9[_0x7668('0x20')])return _0x564b9e(_0x7668('0x28'));if(_0x673f2a>_0x27c2a9[_0x7668('0x27')])return _0x564b9e('License\x20limit\x20reached\x20for\x20telephones');return _0x5dccea();})['catch'](function(_0x36275a){_0x564b9e(_0x36275a);});});}module[_0x7668('0x29')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x612b=['bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','format','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','admin','user','then','users','telephones','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x612b,0x8d));var _0xb612=function(_0x168c37,_0x38f37d){_0x168c37=_0x168c37-0x0;var _0x3acaeb=_0x612b[_0x168c37];return _0x3acaeb;};'use strict';var util=require(_0xb612('0x0'));var _=require(_0xb612('0x1'));var moment=require(_0xb612('0x2'));var BPromise=require(_0xb612('0x3'));var hardware=require(_0xb612('0x4'));var encryptor=require(_0xb612('0x5'));var db=require(_0xb612('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb612('0x7'),'machineUuid':hardware[_0xb612('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb612('0x9'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb612('0xa'),'machineUuid':hardware[_0xb612('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3d7f75){return new BPromise(function(_0x2bb9f0,_0x3008db){return db[_0xb612('0xb')]['find'](_[_0xb612('0xc')](_0x3d7f75,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x20a760){return checkLicense(_0x20a760,null);})['then'](function(_0x2316d1){_0x2bb9f0(_0x2316d1);return;})[_0xb612('0xd')](function(_0x112d64){_0x3008db(_0x112d64);});});}function checkLicense(_0x444099,_0xf6bb99){if(!_0x444099){demoLicense['uuid']=_0x444099[_0xb612('0xe')];return demoLicense;}try{var _0x1ec0f8=_0xf6bb99||_0x444099[_0xb612('0xf')];if(_['isEmpty'](_0x1ec0f8)){throw new Error(_0xb612('0x10'));}var _0x579657=_0x444099[_0xb612('0xe')];var _0x130a6c=_0x444099[_0xb612('0x11')];var _0x520550=_0x579657[_0xb612('0x12')]('-')[0x4];var _0x5d09cc=_0x579657['split']('-')[0x0];var _0x3a8d41=encryptor[_0xb612('0x13')](_0x1ec0f8,util['format'](_0xb612('0x14'),_0x520550,_0x579657,_0x5d09cc));var _0x9a517c=JSON[_0xb612('0x15')](_0x3a8d41);_0x9a517c[_0xb612('0x16')]=![];_0x9a517c[_0xb612('0x17')]=_0x579657;_0x9a517c[_0xb612('0x18')]=hardware[_0xb612('0x8')]();if(_0x130a6c){var _0x359d13=encryptor[_0xb612('0x13')](_0x130a6c);_0x9a517c[_0xb612('0x19')]=_0x359d13;_0x9a517c[_0xb612('0x1a')]=moment(_0x359d13)['add'](0x7,'days')[_0xb612('0x1b')]();_0x9a517c[_0xb612('0x1c')]=_0x9a517c['uuid']!=_0x9a517c['machineUuid']?_0xb612('0x1d'):_0xb612('0x1e');}return _0x9a517c;}catch(_0x396600){breakingLicense[_0xb612('0x17')]=_0x444099['data1'];breakingLicense[_0xb612('0x1f')]=_0x396600[_0xb612('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x59ea70,_0x413329){getLicense()['then'](function(_0xf0d4bc){return db[_0xb612('0x20')][_0xb612('0x21')]({'attributes':[_0xb612('0x22'),[db[_0xb612('0x23')]['fn'](_0xb612('0x24'),db[_0xb612('0x23')]['col'](_0xb612('0x22'))),'count']],'group':_0xb612('0x22'),'where':{'role':{'$or':[_0xb612('0x25'),_0xb612('0x26'),'telephone']}},'raw':!![]})[_0xb612('0x27')](function(_0x4c42fb){var _0x84bd8f={'user':_0xf0d4bc[_0xb612('0x28')]||0x0,'telephone':_0xf0d4bc[_0xb612('0x29')]||0x0};_0x4c42fb['forEach'](function(_0x19c96c){var _0x36a2fa=_0x19c96c['role']===_0xb612('0x25')?_0xb612('0x26'):_0x19c96c[_0xb612('0x22')];_0x84bd8f[_0x36a2fa]-=_0x19c96c['count'];if(_0x84bd8f[_0x36a2fa]<0x0)_0x84bd8f[_0x36a2fa]=0x0;});_0x59ea70(_0x84bd8f);return;});})[_0xb612('0xd')](function(_0x13b20b){_0x413329(_0x13b20b);});});}function checkUserLimits(_0x3a2f3c){return new BPromise(function(_0x2c136b,_0x3bb90a){getLimits()[_0xb612('0x27')](function(_0x140942){var _0x1b4e6f=_[_0xb612('0x2a')](_[_0xb612('0x2b')](_0x3a2f3c,_0xb612('0x22')),[_0xb612('0x25'),'user',_0xb612('0x2c')]);var _0xfe4db0=(_0x1b4e6f['admin']||0x0)+(_0x1b4e6f[_0xb612('0x26')]||0x0);var _0x49f056=_0x1b4e6f[_0xb612('0x2c')]||0x0;if(_0xfe4db0>_0x140942[_0xb612('0x26')])return _0x3bb90a(_0xb612('0x2d'));if(_0x49f056>_0x140942[_0xb612('0x2c')])return _0x3bb90a(_0xb612('0x2e'));return _0x2c136b();})[_0xb612('0xd')](function(_0x1da35f){_0x3bb90a(_0x1da35f);});});}module[_0xb612('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index f77dfda..e341eaf 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eff=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4b47b8,_0x173507){var _0x4cc191=function(_0x482cbf){while(--_0x482cbf){_0x4b47b8['push'](_0x4b47b8['shift']());}};_0x4cc191(++_0x173507);}(_0x5eff,0xc8));var _0xf5ef=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x5eff[_0x17b6e3];return _0x3906f3;};'use strict';module[_0xf5ef('0x0')]={'DOMAIN':_0xf5ef('0x1'),'SESSION_SECRET':_0xf5ef('0x2'),'GOOGLE_ID':_0xf5ef('0x3'),'GOOGLE_SECRET':_0xf5ef('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xebea=['app-id','secret'];(function(_0x5dcadd,_0x444134){var _0x5e37dc=function(_0x43a732){while(--_0x43a732){_0x5dcadd['push'](_0x5dcadd['shift']());}};_0x5e37dc(++_0x444134);}(_0xebea,0xec));var _0xaebe=function(_0x2051bd,_0x4b1e3e){_0x2051bd=_0x2051bd-0x0;var _0x512fcf=_0xebea[_0x2051bd];return _0x512fcf;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xaebe('0x0'),'GOOGLE_SECRET':_0xaebe('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ef29f73..59b7886 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9bb=['winston','util','path','INFO','join','/var','log','xcally','%s-%s.log','message','replace','format','YYYY-MM-DD\x20HH:mm:ss','exports','Logger','error','transports','info','env','debugLevel','moment'];(function(_0x51f8c0,_0x2fd4da){var _0x30363b=function(_0x43d698){while(--_0x43d698){_0x51f8c0['push'](_0x51f8c0['shift']());}};_0x30363b(++_0x2fd4da);}(_0xe9bb,0x1a3));var _0xbe9b=function(_0x3ec822,_0x59a9c2){_0x3ec822=_0x3ec822-0x0;var _0x5927c6=_0xe9bb[_0x3ec822];return _0x5927c6;};'use strict';var moment=require(_0xbe9b('0x0'));var winston=require(_0xbe9b('0x1'));var util=require(_0xbe9b('0x2'));var path=require(_0xbe9b('0x3'));var debugLevel=_0xbe9b('0x4');function filename(_0x1ac1d1,_0x3d7f6c){return path[_0xbe9b('0x5')](_0xbe9b('0x6'),_0xbe9b('0x7'),_0xbe9b('0x8'),util['format'](_0xbe9b('0x9'),_0x1ac1d1,_0x3d7f6c));}function formatter(_0xf1b036,_0x1c0284){_0x1c0284[_0xbe9b('0xa')]=_0x1c0284[_0xbe9b('0xa')][_0xbe9b('0xb')](/@@{/g,'{{{')[_0xbe9b('0xb')](/}@@/g,'}}}')[_0xbe9b('0xb')](/@{/g,'{{')[_0xbe9b('0xb')](/}@/g,'}}');return util[_0xbe9b('0xc')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0xbe9b('0xd')),_0x1c0284['level']['toUpperCase'](),_0xf1b036,_0x1c0284[_0xbe9b('0xa')]);}module[_0xbe9b('0xe')]=function(_0x53275a){return new winston[(_0xbe9b('0xf'))]({'transports':[new winston['transports']['File']({'name':util[_0xbe9b('0xc')]('%s-%s',_0x53275a,_0xbe9b('0x10')),'filename':filename(_0x53275a,_0xbe9b('0x10')),'level':_0xbe9b('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5dd882){return formatter(_0x53275a,_0x5dd882);}}),new winston[(_0xbe9b('0x11'))]['File']({'name':util['format']('%s-%s',_0x53275a,_0xbe9b('0x12')),'filename':filename(_0x53275a,_0xbe9b('0x12')),'level':_0xbe9b('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e8052){return formatter(_0x53275a,_0x4e8052);}}),new winston['transports']['Console']({'level':process[_0xbe9b('0x13')][_0xbe9b('0x14')]||debugLevel,'json':![],'formatter':function(_0x59a49f){return formatter(_0x53275a,_0x59a49f);}})]});}; \ No newline at end of file +var _0x2edb=['toUpperCase','Logger','transports','File','%s-%s','error','Console','env','debugLevel','moment','winston','join','format','message','{{{','replace','}}}','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x60ae23,_0x1e438d){var _0x1cd69f=function(_0x98ae6d){while(--_0x98ae6d){_0x60ae23['push'](_0x60ae23['shift']());}};_0x1cd69f(++_0x1e438d);}(_0x2edb,0x1cb));var _0xb2ed=function(_0x14ac9e,_0x443c98){_0x14ac9e=_0x14ac9e-0x0;var _0x455527=_0x2edb[_0x14ac9e];return _0x455527;};'use strict';var moment=require(_0xb2ed('0x0'));var winston=require(_0xb2ed('0x1'));var util=require('util');var path=require('path');var debugLevel='INFO';function filename(_0x1bb64f,_0x40639e){return path[_0xb2ed('0x2')]('/var','log','xcally',util[_0xb2ed('0x3')]('%s-%s.log',_0x1bb64f,_0x40639e));}function formatter(_0x200d47,_0x4f1bfb){_0x4f1bfb[_0xb2ed('0x4')]=_0x4f1bfb[_0xb2ed('0x4')]['replace'](/@@{/g,_0xb2ed('0x5'))[_0xb2ed('0x6')](/}@@/g,_0xb2ed('0x7'))[_0xb2ed('0x6')](/@{/g,'{{')[_0xb2ed('0x6')](/}@/g,'}}');return util[_0xb2ed('0x3')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0xb2ed('0x8')),_0x4f1bfb['level'][_0xb2ed('0x9')](),_0x200d47,_0x4f1bfb[_0xb2ed('0x4')]);}module['exports']=function(_0x393b9f){return new winston[(_0xb2ed('0xa'))]({'transports':[new winston[(_0xb2ed('0xb'))][(_0xb2ed('0xc'))]({'name':util['format'](_0xb2ed('0xd'),_0x393b9f,_0xb2ed('0xe')),'filename':filename(_0x393b9f,'error'),'level':_0xb2ed('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7f3fa4){return formatter(_0x393b9f,_0x7f3fa4);}}),new winston[(_0xb2ed('0xb'))]['File']({'name':util[_0xb2ed('0x3')](_0xb2ed('0xd'),_0x393b9f,'info'),'filename':filename(_0x393b9f,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x286b2c){return formatter(_0x393b9f,_0x286b2c);}}),new winston[(_0xb2ed('0xb'))][(_0xb2ed('0xf'))]({'level':process[_0xb2ed('0x10')][_0xb2ed('0x11')]||debugLevel,'json':![],'formatter':function(_0x57928f){return formatter(_0x393b9f,_0x57928f);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d70dd36..2bf17fe 100644 --- a/server/config/pm2/config.js +++ b/server/config/pm2/config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f76=['../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0xe99756,_0x1b147a){var _0x5ab31d=function(_0xc0b7c2){while(--_0xc0b7c2){_0xe99756['push'](_0xe99756['shift']());}};_0x5ab31d(++_0x1b147a);}(_0x6f76,0x170));var _0x66f7=function(_0x26e208,_0x5a022b){_0x26e208=_0x26e208-0x0;var _0x544930=_0x6f76[_0x26e208];return _0x544930;};'use strict';var path=require(_0x66f7('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x66f7('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x66f7('0x2'),'script':path[_0x66f7('0x1')](__dirname,_0x66f7('0x3'))},{'name':_0x66f7('0x4'),'script':path['join'](__dirname,_0x66f7('0x5'))},{'name':'email','script':path[_0x66f7('0x1')](__dirname,_0x66f7('0x6'))},{'name':'routing','script':path[_0x66f7('0x1')](__dirname,_0x66f7('0x7'))},{'name':_0x66f7('0x8'),'script':path[_0x66f7('0x1')](__dirname,_0x66f7('0x9'))}]};module[_0x66f7('0xa')]=config; \ No newline at end of file +var _0x897b=['path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','xdr','exports'];(function(_0x2cc86e,_0x5e9be8){var _0x3c43e1=function(_0x522ecc){while(--_0x522ecc){_0x2cc86e['push'](_0x2cc86e['shift']());}};_0x3c43e1(++_0x5e9be8);}(_0x897b,0x90));var _0xb897=function(_0xa1f86c,_0x58da08){_0xa1f86c=_0xa1f86c-0x0;var _0x17e886=_0x897b[_0xa1f86c];return _0x17e886;};'use strict';var path=require(_0xb897('0x0'));var os=require('os');var config={'apps':[{'name':_0xb897('0x1'),'script':path[_0xb897('0x2')](__dirname,_0xb897('0x3'))},{'name':_0xb897('0x4'),'script':path[_0xb897('0x2')](__dirname,_0xb897('0x5'))},{'name':_0xb897('0x6'),'script':path[_0xb897('0x2')](__dirname,_0xb897('0x7'))},{'name':'email','script':path[_0xb897('0x2')](__dirname,_0xb897('0x8'))},{'name':_0xb897('0x9'),'script':path[_0xb897('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0xb897('0xa'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xb897('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index d74cc8c..3f3e8c7 100644 --- a/server/config/pm2/index.js +++ b/server/config/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8f1=['describe','dump','saved','pm2','bluebird','connected','start','then','disconnect','stop','restart','list'];(function(_0x4f6d9d,_0x15c242){var _0x1b599b=function(_0xc7e7b5){while(--_0xc7e7b5){_0x4f6d9d['push'](_0x4f6d9d['shift']());}};_0x1b599b(++_0x15c242);}(_0xb8f1,0x15f));var _0x1b8f=function(_0x5bb5cd,_0x3b4bdb){_0x5bb5cd=_0x5bb5cd-0x0;var _0x2807c4=_0xb8f1[_0x5bb5cd];return _0x2807c4;};'use strict';var pm2=require(_0x1b8f('0x0'));var BPromise=require(_0x1b8f('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x210bb2,_0x45e701){return pm2['connect'](function(_0x512991){if(_0x512991){return _0x45e701(_0x512991);}return _0x210bb2(_0x1b8f('0x2'));});});};exports[_0x1b8f('0x3')]=function(_0x3cceee){return connect()[_0x1b8f('0x4')](function(){return new BPromise(function(_0xf7f618,_0x63e83){return pm2[_0x1b8f('0x3')](_0x3cceee,function(_0x568a22,_0x515dac){if(_0x568a22){return _0x63e83(_0x568a22);}pm2[_0x1b8f('0x5')]();return _0xf7f618(_0x515dac);});});});};exports[_0x1b8f('0x6')]=function(_0x3cd360){return connect()['then'](function(){return new BPromise(function(_0x23e467,_0x2556aa){return pm2[_0x1b8f('0x6')](_0x3cd360,function(_0x2b5be4,_0x5a1cd1){if(_0x2b5be4){return _0x2556aa(_0x2b5be4);}pm2[_0x1b8f('0x5')]();return _0x23e467(_0x5a1cd1);});});});};exports[_0x1b8f('0x7')]=function(_0x598159){return connect()[_0x1b8f('0x4')](function(){return new BPromise(function(_0x2be8a2,_0x28c741){return pm2['restart'](_0x598159,function(_0x1743cd,_0xd2fc66){if(_0x1743cd){return _0x28c741(_0x1743cd);}pm2[_0x1b8f('0x5')]();return _0x2be8a2(_0xd2fc66);});});});};exports[_0x1b8f('0x8')]=function(){return connect()[_0x1b8f('0x4')](function(){return new BPromise(function(_0x307350,_0x4b1ce3){return pm2[_0x1b8f('0x8')](function(_0x535d57,_0x275e69){if(_0x535d57){return _0x4b1ce3(_0x535d57);}pm2[_0x1b8f('0x5')]();return _0x307350(_0x275e69);});});});};exports[_0x1b8f('0x9')]=function(_0x13d98c){return connect()['then'](function(){return new BPromise(function(_0xc3a404,_0x10af6e){return pm2[_0x1b8f('0x9')](_0x13d98c,function(_0x3fb417,_0x51127e){if(_0x3fb417){return _0x10af6e(_0x3fb417);}pm2[_0x1b8f('0x5')]();return _0xc3a404(_0x51127e);});});});};exports['delete']=function(_0x26fce6){return connect()[_0x1b8f('0x4')](function(){return new BPromise(function(_0x59351c,_0x3f8a41){return pm2['delete'](_0x26fce6,function(_0x834ad7,_0x24fabe){if(_0x834ad7){return _0x3f8a41(_0x834ad7);}pm2[_0x1b8f('0x5')]();return _0x59351c(_0x24fabe);});});});};exports[_0x1b8f('0xa')]=function(){return connect()[_0x1b8f('0x4')](function(){return new BPromise(function(_0x365d66,_0x57c695){return pm2['dump'](function(_0x56fb61){if(_0x56fb61){return _0x57c695(_0x56fb61);}return _0x365d66(_0x1b8f('0xb'));});});});}; \ No newline at end of file +var _0x432b=['dump','saved','pm2','./config','connect','start','then','disconnect','stop','restart','list','describe','delete'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0xb432('0x0'));var BPromise=require('bluebird');var config=require(_0xb432('0x1'));function connect(){return new BPromise(function(_0x37fb3d,_0x7170b6){return pm2[_0xb432('0x2')](function(_0x5173f6){if(_0x5173f6){return _0x7170b6(_0x5173f6);}return _0x37fb3d('connected');});});};exports[_0xb432('0x3')]=function(_0x4cefc4){return connect()[_0xb432('0x4')](function(){return new BPromise(function(_0x5cb510,_0x143093){return pm2[_0xb432('0x3')](_0x4cefc4,function(_0x274447,_0x45f857){if(_0x274447){return _0x143093(_0x274447);}pm2[_0xb432('0x5')]();return _0x5cb510(_0x45f857);});});});};exports[_0xb432('0x6')]=function(_0x198b71){return connect()[_0xb432('0x4')](function(){return new BPromise(function(_0x4e4302,_0x12adbe){return pm2[_0xb432('0x6')](_0x198b71,function(_0x2bc6e5,_0x4288c3){if(_0x2bc6e5){return _0x12adbe(_0x2bc6e5);}pm2[_0xb432('0x5')]();return _0x4e4302(_0x4288c3);});});});};exports[_0xb432('0x7')]=function(_0x5d0d3b){return connect()['then'](function(){return new BPromise(function(_0x3c1a43,_0x255773){return pm2['restart'](_0x5d0d3b,function(_0x659b46,_0x323ae9){if(_0x659b46){return _0x255773(_0x659b46);}pm2[_0xb432('0x5')]();return _0x3c1a43(_0x323ae9);});});});};exports['list']=function(){return connect()[_0xb432('0x4')](function(){return new BPromise(function(_0x2ce33d,_0x4f9155){return pm2[_0xb432('0x8')](function(_0xdac1e3,_0x427ad4){if(_0xdac1e3){return _0x4f9155(_0xdac1e3);}pm2[_0xb432('0x5')]();return _0x2ce33d(_0x427ad4);});});});};exports[_0xb432('0x9')]=function(_0x526330){return connect()['then'](function(){return new BPromise(function(_0x42f81d,_0x15bff1){return pm2[_0xb432('0x9')](_0x526330,function(_0x26068a,_0x27365c){if(_0x26068a){return _0x15bff1(_0x26068a);}pm2[_0xb432('0x5')]();return _0x42f81d(_0x27365c);});});});};exports[_0xb432('0xa')]=function(_0x1686a1){return connect()[_0xb432('0x4')](function(){return new BPromise(function(_0x425631,_0x4b780d){return pm2['delete'](_0x1686a1,function(_0x26c96e,_0x2b33a7){if(_0x26c96e){return _0x4b780d(_0x26c96e);}pm2[_0xb432('0x5')]();return _0x425631(_0x2b33a7);});});});};exports[_0xb432('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x34febc,_0x2bcded){return pm2[_0xb432('0xb')](function(_0x2fcbb1){if(_0x2fcbb1){return _0x2bcded(_0x2fcbb1);}return _0x34febc(_0xb432('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a171b14..ef4180c 100644 --- a/server/config/schedule/chat.js +++ b/server/config/schedule/chat.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7be3=['../logger','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','findAll','subtract','minutes','then','length','map','info','join','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','../../mysqldb'];(function(_0x5a0cb2,_0x43a6e4){var _0x32b526=function(_0x47de3c){while(--_0x47de3c){_0x5a0cb2['push'](_0x5a0cb2['shift']());}};_0x32b526(++_0x43a6e4);}(_0x7be3,0x1ce));var _0x37be=function(_0x1d7466,_0x161771){_0x1d7466=_0x1d7466-0x0;var _0x3ebbb6=_0x7be3[_0x1d7466];return _0x3ebbb6;};'use strict';var _=require('lodash');var moment=require(_0x37be('0x0'));var Redis=require(_0x37be('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0x37be('0x2'))['db'];var logger=require(_0x37be('0x3'))('schedule');config[_0x37be('0x4')]=_[_0x37be('0x5')](config[_0x37be('0x4')],{'host':_0x37be('0x6'),'port':0x18eb});var io=require(_0x37be('0x7'))(new Redis(config[_0x37be('0x4')]));function closeInteractions(){var _0x3bedee=0x0;var _0x3826c4=[];return db[_0x37be('0x8')][_0x37be('0x9')]({'raw':!![],'attributes':['id',_0x37be('0xa')],'where':{'id':0x1}})['then'](function(_0x31d6b6){_0x3bedee=_0x31d6b6[_0x37be('0xa')];if(_0x3bedee){return db['ChatInteraction'][_0x37be('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x37be('0xc')](_0x31d6b6[_0x37be('0xa')],_0x37be('0xd'))}}});}else{return[];}})[_0x37be('0xe')](function(_0x3eb4e8){if(_0x3eb4e8&&_0x3eb4e8[_0x37be('0xf')]){_0x3826c4=_[_0x37be('0x10')](_0x3eb4e8||[],'id');logger[_0x37be('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x3826c4[_0x37be('0x12')]());return db[_0x37be('0x13')][_0x37be('0x14')]({'closeReason':_0x37be('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x37be('0x16')](_0x37be('0x17'))},{'where':{'id':_0x3826c4}});}})[_0x37be('0xe')](function(){if(_0x3826c4&&_0x3826c4['length']){logger[_0x37be('0x11')](_0x37be('0x18'),_0x3826c4[_0x37be('0x12')]());for(var _0x41d2d0=0x0;_0x41d2d0<_0x3826c4[_0x37be('0xf')];_0x41d2d0++){io[_0x37be('0x19')]('chatInteraction:update',{'id':_0x3826c4[_0x41d2d0],'closed':!![]});}}})[_0x37be('0x1a')](function(_0x4a5a60){logger[_0x37be('0x1b')](_0x37be('0x1c'),_0x4a5a60?util[_0x37be('0x1d')](_0x4a5a60,{'showHidden':![],'depth':null}):'');});}exports[_0x37be('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2533=['format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0x2533,0x167));var _0x3253=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x2533[_0x2ab76b];return _0x201126;};'use strict';var _=require(_0x3253('0x0'));var moment=require(_0x3253('0x1'));var Redis=require(_0x3253('0x2'));var util=require(_0x3253('0x3'));var config=require(_0x3253('0x4'));var db=require(_0x3253('0x5'))['db'];var logger=require('../logger')(_0x3253('0x6'));config[_0x3253('0x7')]=_[_0x3253('0x8')](config[_0x3253('0x7')],{'host':_0x3253('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x47adbc=0x0;var _0x5b22d6=[];return db['Setting'][_0x3253('0xa')]({'raw':!![],'attributes':['id',_0x3253('0xb')],'where':{'id':0x1}})[_0x3253('0xc')](function(_0x1a13a0){_0x47adbc=_0x1a13a0[_0x3253('0xb')];if(_0x47adbc){return db[_0x3253('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x3253('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3253('0xf')](_0x1a13a0[_0x3253('0xb')],_0x3253('0x10'))}}});}else{return[];}})['then'](function(_0x114b0f){if(_0x114b0f&&_0x114b0f[_0x3253('0x11')]){_0x5b22d6=_[_0x3253('0x12')](_0x114b0f||[],'id');logger[_0x3253('0x13')](_0x3253('0x14'),_0x5b22d6[_0x3253('0x15')]());return db[_0x3253('0xd')][_0x3253('0x16')]({'closeReason':_0x3253('0x17'),'disposition':_0x3253('0x18'),'closed':!![],'closedAt':moment()[_0x3253('0x19')](_0x3253('0x1a'))},{'where':{'id':_0x5b22d6}});}})[_0x3253('0xc')](function(){if(_0x5b22d6&&_0x5b22d6[_0x3253('0x11')]){logger[_0x3253('0x13')](_0x3253('0x1b'),_0x5b22d6[_0x3253('0x15')]());for(var _0x1b4a60=0x0;_0x1b4a60<_0x5b22d6['length'];_0x1b4a60++){io[_0x3253('0x1c')](_0x3253('0x1d'),{'id':_0x5b22d6[_0x1b4a60],'closed':!![]});}}})[_0x3253('0x1e')](function(_0x1d5a5f){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x1d5a5f?util['inspect'](_0x1d5a5f,{'showHidden':![],'depth':null}):'');});}exports[_0x3253('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index cc4a41d..d3d5dc8 100644 --- a/server/config/schedule/index.js +++ b/server/config/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d55=['join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','error\x20mail','catch','error','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','keys','jobs','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','length','update','update\x20cron','run','path','moment','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','port','secure','auth','user','pass','name','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit'];(function(_0xd18d29,_0x530deb){var _0x445239=function(_0x34641c){while(--_0x34641c){_0xd18d29['push'](_0xd18d29['shift']());}};_0x445239(++_0x530deb);}(_0x2d55,0x8e));var _0x52d5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2d55[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x52d5('0x0'));var _=require('lodash');var moment=require(_0x52d5('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x52d5('0x2'));var logger=require(_0x52d5('0x3'))('schedule');var db=require(_0x52d5('0x4'))['db'];var analyticCustomReportController=require(_0x52d5('0x5'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x52d5('0x6')][_0x52d5('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x56f5bf,_0x49eaa3){return function(){logger[_0x52d5('0x8')](_0x52d5('0x9'),_0x56f5bf[_0x52d5('0xa')]);var _0x392fbb=!![];var _0x95cf24={'tls':{'rejectUnauthorized':![]}};if(_0x56f5bf[_0x52d5('0xb')][_0x52d5('0xc')][_0x52d5('0xd')]){_0x95cf24['service']=_0x56f5bf[_0x52d5('0xb')][_0x52d5('0xc')]['service'];}else{_0x95cf24['host']=_0x56f5bf[_0x52d5('0xb')][_0x52d5('0xc')]['host'];_0x95cf24[_0x52d5('0xe')]=_0x56f5bf[_0x52d5('0xb')][_0x52d5('0xc')][_0x52d5('0xe')];_0x95cf24[_0x52d5('0xf')]=_0x56f5bf['MailAccount']['Smtp'][_0x52d5('0xf')];}if(_0x56f5bf[_0x52d5('0xb')]['Smtp']['authentication']){_0x95cf24[_0x52d5('0x10')]={'user':_0x56f5bf[_0x52d5('0xb')][_0x52d5('0xc')][_0x52d5('0x11')],'pass':_0x56f5bf[_0x52d5('0xb')]['Smtp'][_0x52d5('0x12')]};}var _0x531a8d={'account':_0x95cf24,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x56f5bf[_0x52d5('0xb')][_0x52d5('0x13')],_0x56f5bf[_0x52d5('0xb')][_0x52d5('0xa')]||_0x56f5bf['MailAccount'][_0x52d5('0xc')][_0x52d5('0x11')]),'to':_0x56f5bf[_0x52d5('0xa')],'cc':_0x56f5bf['cc'],'bcc':_0x56f5bf['bcc'],'subject':util[_0x52d5('0x14')](_0x52d5('0x15'),_0x49eaa3['name'],_0x56f5bf[_0x52d5('0x16')],_0x56f5bf[_0x52d5('0x17')])}};var _0x27281d=path[_0x52d5('0x18')](__dirname,_0x52d5('0x19'));var _0x23f6f5=_0x49eaa3[_0x52d5('0x1a')];var _0x6d9ef6=util[_0x52d5('0x14')](_0x52d5('0x1b'),path[_0x52d5('0x1c')](_0x49eaa3['savename'],path[_0x52d5('0x1d')](_0x49eaa3[_0x52d5('0x1a')])),_0x52d5('0x1e'));var _0x5e1eee=path[_0x52d5('0x18')](_0x27281d,_0x23f6f5);var _0x4897e8=path['join'](_0x27281d,_0x6d9ef6);if(fs[_0x52d5('0x1f')](_0x5e1eee)){_0x49eaa3[_0x52d5('0x20')]=_0x52d5('0x21');_0x531a8d[_0x52d5('0x22')][_0x52d5('0x23')]=[{'filename':_0x23f6f5,'path':_0x5e1eee}];_0x531a8d[_0x52d5('0x22')][_0x52d5('0x24')]=util[_0x52d5('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x52d5('0x25')](_0x49eaa3,null,0x2));}else if(fs[_0x52d5('0x1f')](_0x4897e8)){_0x49eaa3['status']=_0x52d5('0x21');_0x531a8d[_0x52d5('0x22')][_0x52d5('0x23')]=[{'filename':_0x6d9ef6,'path':_0x4897e8}];}else{_0x531a8d['message']['text']=_0x52d5('0x26');if(!_0x56f5bf[_0x52d5('0x27')]){_0x392fbb=![];logger[_0x52d5('0x8')](_0x52d5('0x28'));}}if(_0x392fbb){return client[_0x52d5('0x29')]('SendMail',_0x531a8d)['then'](function(_0x2fa1fd){if(_0x2fa1fd['error']){return logger['error'](_0x52d5('0x2a'),JSON['stringify'](_0x2fa1fd));}return logger[_0x52d5('0x8')]('email\x20sent');})[_0x52d5('0x2b')](function(_0xfaf493){return logger[_0x52d5('0x2c')](_0x52d5('0x2a'),JSON[_0x52d5('0x25')](_0xfaf493));});}};}function handleError(){return function(_0x47ca29){return logger[_0x52d5('0x2c')](JSON[_0x52d5('0x25')](_0x47ca29));};}function handleResult(_0x8a8b98){return function(_0x459401){logger['info']('data',JSON['stringify'](_0x459401));if(_0x8a8b98[_0x52d5('0xb')]&&_0x8a8b98['MailAccount'][_0x52d5('0xc')]&&!_[_0x52d5('0x2d')](_0x8a8b98[_0x52d5('0xa')])){setTimeout(handleSendEmail(_0x8a8b98,_0x459401),0x3c*0x3e8);}};}function handleJob(_0x3be4cc){return function(){try{if(_['isNil'](_0x3be4cc['subtractNumber'])){return logger['info'](_0x52d5('0x2e'));}if(_['isNil'](_0x3be4cc[_0x52d5('0x17')])){return logger[_0x52d5('0x8')]('subtractUnit\x20null\x20or\x20undefined');}var _0x1945e8={'startDate':moment()['subtract'](_0x3be4cc[_0x52d5('0x16')],_0x3be4cc[_0x52d5('0x17')])['format'](_0x52d5('0x2f')),'endDate':moment()[_0x52d5('0x14')](_0x52d5('0x2f')),'type':_0x52d5('0x30'),'output':_0x3be4cc[_0x52d5('0x31')],'name':_0x3be4cc['name']};if(!_[_0x52d5('0x2d')](_0x3be4cc['DefaultReportId'])){logger[_0x52d5('0x8')](_0x52d5('0x32'),_0x3be4cc[_0x52d5('0x33')]);return analyticDefaultReportController['runReport']({'id':_0x3be4cc[_0x52d5('0x33')]},_0x1945e8)[_0x52d5('0x34')](handleResult(_0x3be4cc))[_0x52d5('0x2b')](handleError());}if(!_['isNil'](_0x3be4cc[_0x52d5('0x35')])){logger[_0x52d5('0x8')](_0x52d5('0x36'),_0x3be4cc[_0x52d5('0x35')]);return analyticCustomReportController['runReport']({'id':_0x3be4cc['CustomReportId']},_0x1945e8)[_0x52d5('0x34')](handleResult(_0x3be4cc))[_0x52d5('0x2b')](handleError());}}catch(_0x4c9399){logger[_0x52d5('0x2c')](JSON[_0x52d5('0x25')](_0x4c9399));}return logger[_0x52d5('0x8')](_0x52d5('0x37'));};}function getJobs(_0x281a5a){var _0x5e151c={};if(_0x281a5a){_0x5e151c['id']=_0x281a5a;}return db['Schedule'][_0x52d5('0x38')]({'where':_0x5e151c,'include':[{'model':db[_0x52d5('0xb')],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0x52d5('0x34')](function(_0xc83884){var _0x3e4995=_[_0x52d5('0x39')](manager[_0x52d5('0x3a')]);var _0x1da68e=_['map'](_0xc83884,function(_0xedce29){return _0xedce29['id'][_0x52d5('0x3b')]();});var _0xe06679=_[_0x52d5('0x3c')](_0xc83884,function(_0x37d3f5){return _0x37d3f5['id']['toString']();});var _0x16d29c=_0x281a5a?_0x1da68e:_[_0x52d5('0x3d')](_0x1da68e,_0x3e4995);var _0x2ccab1=_[_0x52d5('0x3e')](_0x1da68e,_0x3e4995);var _0xfa2a97=_['difference'](_0x3e4995,_0x1da68e);var _0x139401;var _0x2bb8bd;for(_0x139401=0x0;_0x139401<_0xfa2a97['length']&&!_0x281a5a;_0x139401+=0x1){_0x2bb8bd=_0xfa2a97[_0x139401][_0x52d5('0x3b')]();if(manager[_0x52d5('0x3f')](_0x2bb8bd)){manager[_0x52d5('0x40')](_0x2bb8bd);manager[_0x52d5('0x41')](_0x2bb8bd);logger[_0x52d5('0x8')](_0x52d5('0x42'),_0x2bb8bd);}}logger[_0x52d5('0x8')]('toRun',JSON[_0x52d5('0x25')](_0x16d29c));for(_0x139401=0x0;_0x139401<_0x16d29c['length'];_0x139401+=0x1){_0x2bb8bd=_0x16d29c[_0x139401]['toString']();logger['info'](_0x52d5('0x43'),_0x2bb8bd);if(_0x281a5a){logger['info'](_0x52d5('0x44'),_0x281a5a);logger['info'](JSON[_0x52d5('0x25')](_0xe06679[_0x2bb8bd]));BPromise['resolve']()[_0x52d5('0x34')](handleJob(_0xe06679[_0x2bb8bd]));logger[_0x52d5('0x8')](_0x52d5('0x45'),_0xe06679[_0x2bb8bd][_0x52d5('0x13')],_0xe06679[_0x2bb8bd]['cron']);}else if(_0xe06679[_0x2bb8bd][_0x52d5('0x46')]&&_0xe06679[_0x2bb8bd][_0x52d5('0x47')]&&moment()[_0x52d5('0x48')](_0xe06679[_0x2bb8bd][_0x52d5('0x49')],_0xe06679[_0x2bb8bd][_0x52d5('0x4a')])){manager[_0x52d5('0x4b')](_0x2bb8bd,_0xe06679[_0x2bb8bd][_0x52d5('0x46')],handleJob(_0xe06679[_0x2bb8bd]));manager[_0x52d5('0x4c')](_0x2bb8bd);logger[_0x52d5('0x8')](_0x52d5('0x4d'),_0xe06679[_0x2bb8bd]['name'],_0xe06679[_0x2bb8bd][_0x52d5('0x46')]);}else if(manager[_0x52d5('0x3f')](_0x2bb8bd)){manager[_0x52d5('0x40')](_0x2bb8bd);manager['deleteJob'](_0x2bb8bd);logger[_0x52d5('0x8')](_0x52d5('0x4e'),_0xe06679[_0x2bb8bd][_0x52d5('0x13')],_0xe06679[_0x2bb8bd]['cron']);}}for(_0x139401=0x0,_0x2bb8bd;_0x139401<_0x2ccab1[_0x52d5('0x4f')]&&!_0x281a5a;_0x139401+=0x1){_0x2bb8bd=_0x2ccab1[_0x139401][_0x52d5('0x3b')]();if(manager[_0x52d5('0x3f')](_0x2bb8bd)){if(_0xe06679[_0x2bb8bd][_0x52d5('0x46')]&&_0xe06679[_0x2bb8bd]['active']&&moment()[_0x52d5('0x48')](_0xe06679[_0x2bb8bd]['startAt'],_0xe06679[_0x2bb8bd][_0x52d5('0x4a')])){manager[_0x52d5('0x50')](_0x2bb8bd,_0xe06679[_0x2bb8bd][_0x52d5('0x46')],handleJob(_0xe06679[_0x2bb8bd]));logger[_0x52d5('0x8')](_0x52d5('0x51'),_0xe06679[_0x2bb8bd][_0x52d5('0x13')],_0xe06679[_0x2bb8bd][_0x52d5('0x46')]);}else{manager['stop'](_0x2bb8bd);manager[_0x52d5('0x41')](_0x2bb8bd);logger[_0x52d5('0x8')]('stop\x20cron',_0xe06679[_0x2bb8bd]['name'],_0xe06679[_0x2bb8bd][_0x52d5('0x46')]);}}}})[_0x52d5('0x2b')](function(_0x34690b){logger[_0x52d5('0x2c')](JSON[_0x52d5('0x25')](_0x34690b));});}exports[_0x52d5('0x52')]=function(_0x38718d){return getJobs(_0x38718d);};exports[_0x52d5('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0480=['YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','name','MailServerOut','keys','jobs','toString','keyBy','difference','exists','stop','deleteJob','delete\x20cron','toRun','length','resolve','run\x20job','startAt','endAt','add','start','add\x20cron','stop\x20cron','cron','active','update','update\x20cron','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','MailAccount','Smtp','service','host','secure','authentication','auth','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','stringify','data','isNil','email','subtractUnit\x20null\x20or\x20undefined','subtract'];(function(_0x1d56f2,_0x5776b0){var _0x15edbe=function(_0x42db8b){while(--_0x42db8b){_0x1d56f2['push'](_0x1d56f2['shift']());}};_0x15edbe(++_0x5776b0);}(_0x0480,0x175));var _0x0048=function(_0x1a4194,_0x1c1b15){_0x1a4194=_0x1a4194-0x0;var _0x112a86=_0x0480[_0x1a4194];return _0x112a86;};'use strict';var fs=require('fs');var util=require(_0x0048('0x0'));var path=require('path');var _=require(_0x0048('0x1'));var moment=require(_0x0048('0x2'));var CronJobManager=require(_0x0048('0x3'));var jayson=require(_0x0048('0x4'));var BPromise=require(_0x0048('0x5'));var logger=require(_0x0048('0x6'))(_0x0048('0x7'));var db=require(_0x0048('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x0048('0x9'));var client=jayson['client'][_0x0048('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x36a935,_0x1a9502){return function(){logger[_0x0048('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x36a935['email']);var _0x3040e6=!![];var _0x389016={'tls':{'rejectUnauthorized':![]}};if(_0x36a935[_0x0048('0xc')][_0x0048('0xd')]['service']){_0x389016['service']=_0x36a935['MailAccount'][_0x0048('0xd')][_0x0048('0xe')];}else{_0x389016['host']=_0x36a935[_0x0048('0xc')]['Smtp'][_0x0048('0xf')];_0x389016['port']=_0x36a935['MailAccount'][_0x0048('0xd')]['port'];_0x389016[_0x0048('0x10')]=_0x36a935[_0x0048('0xc')][_0x0048('0xd')][_0x0048('0x10')];}if(_0x36a935[_0x0048('0xc')]['Smtp'][_0x0048('0x11')]){_0x389016[_0x0048('0x12')]={'user':_0x36a935[_0x0048('0xc')][_0x0048('0xd')]['user'],'pass':_0x36a935[_0x0048('0xc')][_0x0048('0xd')]['pass']};}var _0x5f3bcc={'account':_0x389016,'message':{'from':util[_0x0048('0x13')](_0x0048('0x14'),_0x36a935[_0x0048('0xc')]['name'],_0x36a935[_0x0048('0xc')]['email']||_0x36a935[_0x0048('0xc')][_0x0048('0xd')]['user']),'to':_0x36a935['email'],'cc':_0x36a935['cc'],'bcc':_0x36a935[_0x0048('0x15')],'subject':util[_0x0048('0x13')](_0x0048('0x16'),_0x1a9502['name'],_0x36a935[_0x0048('0x17')],_0x36a935[_0x0048('0x18')])}};var _0x333529=path[_0x0048('0x19')](__dirname,'../../files/reports');var _0x39bc04=_0x1a9502[_0x0048('0x1a')];var _0xeb1c9e=util['format'](_0x0048('0x1b'),path[_0x0048('0x1c')](_0x1a9502[_0x0048('0x1a')],path[_0x0048('0x1d')](_0x1a9502['savename'])),_0x0048('0x1e'));var _0x4cc62e=path[_0x0048('0x19')](_0x333529,_0x39bc04);var _0x124ea7=path['join'](_0x333529,_0xeb1c9e);if(fs[_0x0048('0x1f')](_0x4cc62e)){_0x1a9502[_0x0048('0x20')]=_0x0048('0x21');_0x5f3bcc[_0x0048('0x22')][_0x0048('0x23')]=[{'filename':_0x39bc04,'path':_0x4cc62e}];_0x5f3bcc['message'][_0x0048('0x24')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x1a9502,null,0x2));}else if(fs[_0x0048('0x1f')](_0x124ea7)){_0x1a9502['status']='Sent';_0x5f3bcc[_0x0048('0x22')][_0x0048('0x23')]=[{'filename':_0xeb1c9e,'path':_0x124ea7}];}else{_0x5f3bcc['message'][_0x0048('0x24')]=_0x0048('0x25');if(!_0x36a935['sendIfEmpty']){_0x3040e6=![];logger[_0x0048('0xb')](_0x0048('0x26'));}}if(_0x3040e6){return client[_0x0048('0x27')](_0x0048('0x28'),_0x5f3bcc)[_0x0048('0x29')](function(_0x368914){if(_0x368914['error']){return logger[_0x0048('0x2a')](_0x0048('0x2b'),JSON['stringify'](_0x368914));}return logger['info'](_0x0048('0x2c'));})[_0x0048('0x2d')](function(_0x2f2d0c){return logger[_0x0048('0x2a')](_0x0048('0x2b'),JSON[_0x0048('0x2e')](_0x2f2d0c));});}};}function handleError(){return function(_0x1c1ffe){return logger[_0x0048('0x2a')](JSON['stringify'](_0x1c1ffe));};}function handleResult(_0x1ccf4d){return function(_0x2327c1){logger[_0x0048('0xb')](_0x0048('0x2f'),JSON[_0x0048('0x2e')](_0x2327c1));if(_0x1ccf4d[_0x0048('0xc')]&&_0x1ccf4d['MailAccount'][_0x0048('0xd')]&&!_[_0x0048('0x30')](_0x1ccf4d[_0x0048('0x31')])){setTimeout(handleSendEmail(_0x1ccf4d,_0x2327c1),0x3c*0x3e8);}};}function handleJob(_0x291298){return function(){try{if(_[_0x0048('0x30')](_0x291298[_0x0048('0x17')])){return logger[_0x0048('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x0048('0x30')](_0x291298['subtractUnit'])){return logger[_0x0048('0xb')](_0x0048('0x32'));}var _0xd48842={'startDate':moment()[_0x0048('0x33')](_0x291298[_0x0048('0x17')],_0x291298[_0x0048('0x18')])['format'](_0x0048('0x34')),'endDate':moment()[_0x0048('0x13')](_0x0048('0x34')),'type':_0x0048('0x35'),'output':_0x291298['output'],'name':_0x291298['name']};if(!_[_0x0048('0x30')](_0x291298[_0x0048('0x36')])){logger[_0x0048('0xb')](_0x0048('0x37'),_0x291298[_0x0048('0x36')]);return analyticDefaultReportController[_0x0048('0x38')]({'id':_0x291298[_0x0048('0x36')]},_0xd48842)[_0x0048('0x29')](handleResult(_0x291298))[_0x0048('0x2d')](handleError());}if(!_[_0x0048('0x30')](_0x291298[_0x0048('0x39')])){logger[_0x0048('0xb')]('exec\x20custom\x20report\x20id:%s',_0x291298['CustomReportId']);return analyticCustomReportController[_0x0048('0x38')]({'id':_0x291298['CustomReportId']},_0xd48842)[_0x0048('0x29')](handleResult(_0x291298))[_0x0048('0x2d')](handleError());}}catch(_0x3b45e1){logger['error'](JSON[_0x0048('0x2e')](_0x3b45e1));}return logger[_0x0048('0xb')](_0x0048('0x3a'));};}function getJobs(_0x570b45){var _0x4f16cc={};if(_0x570b45){_0x4f16cc['id']=_0x570b45;}return db[_0x0048('0x3b')]['findAll']({'where':_0x4f16cc,'include':[{'model':db[_0x0048('0xc')],'attributes':['id',_0x0048('0x3c'),_0x0048('0x31')],'include':[{'model':db[_0x0048('0x3d')],'as':_0x0048('0xd')}]}]})[_0x0048('0x29')](function(_0x3944b6){var _0x318260=_[_0x0048('0x3e')](manager[_0x0048('0x3f')]);var _0xe98f42=_['map'](_0x3944b6,function(_0xe84835){return _0xe84835['id'][_0x0048('0x40')]();});var _0x161016=_[_0x0048('0x41')](_0x3944b6,function(_0x54fe9f){return _0x54fe9f['id'][_0x0048('0x40')]();});var _0x143c6d=_0x570b45?_0xe98f42:_['difference'](_0xe98f42,_0x318260);var _0x12bb15=_['intersection'](_0xe98f42,_0x318260);var _0x22753d=_[_0x0048('0x42')](_0x318260,_0xe98f42);var _0x8e8229;var _0x2f0872;for(_0x8e8229=0x0;_0x8e8229<_0x22753d['length']&&!_0x570b45;_0x8e8229+=0x1){_0x2f0872=_0x22753d[_0x8e8229][_0x0048('0x40')]();if(manager[_0x0048('0x43')](_0x2f0872)){manager[_0x0048('0x44')](_0x2f0872);manager[_0x0048('0x45')](_0x2f0872);logger[_0x0048('0xb')](_0x0048('0x46'),_0x2f0872);}}logger['info'](_0x0048('0x47'),JSON[_0x0048('0x2e')](_0x143c6d));for(_0x8e8229=0x0;_0x8e8229<_0x143c6d[_0x0048('0x48')];_0x8e8229+=0x1){_0x2f0872=_0x143c6d[_0x8e8229][_0x0048('0x40')]();logger[_0x0048('0xb')]('index',_0x2f0872);if(_0x570b45){logger[_0x0048('0xb')]('my\x20id',_0x570b45);logger[_0x0048('0xb')](JSON[_0x0048('0x2e')](_0x161016[_0x2f0872]));BPromise[_0x0048('0x49')]()[_0x0048('0x29')](handleJob(_0x161016[_0x2f0872]));logger[_0x0048('0xb')](_0x0048('0x4a'),_0x161016[_0x2f0872][_0x0048('0x3c')],_0x161016[_0x2f0872]['cron']);}else if(_0x161016[_0x2f0872]['cron']&&_0x161016[_0x2f0872]['active']&&moment()['isBetween'](_0x161016[_0x2f0872][_0x0048('0x4b')],_0x161016[_0x2f0872][_0x0048('0x4c')])){manager[_0x0048('0x4d')](_0x2f0872,_0x161016[_0x2f0872]['cron'],handleJob(_0x161016[_0x2f0872]));manager[_0x0048('0x4e')](_0x2f0872);logger['info'](_0x0048('0x4f'),_0x161016[_0x2f0872][_0x0048('0x3c')],_0x161016[_0x2f0872]['cron']);}else if(manager[_0x0048('0x43')](_0x2f0872)){manager[_0x0048('0x44')](_0x2f0872);manager[_0x0048('0x45')](_0x2f0872);logger[_0x0048('0xb')](_0x0048('0x50'),_0x161016[_0x2f0872][_0x0048('0x3c')],_0x161016[_0x2f0872][_0x0048('0x51')]);}}for(_0x8e8229=0x0,_0x2f0872;_0x8e8229<_0x12bb15[_0x0048('0x48')]&&!_0x570b45;_0x8e8229+=0x1){_0x2f0872=_0x12bb15[_0x8e8229][_0x0048('0x40')]();if(manager[_0x0048('0x43')](_0x2f0872)){if(_0x161016[_0x2f0872][_0x0048('0x51')]&&_0x161016[_0x2f0872][_0x0048('0x52')]&&moment()['isBetween'](_0x161016[_0x2f0872][_0x0048('0x4b')],_0x161016[_0x2f0872][_0x0048('0x4c')])){manager[_0x0048('0x53')](_0x2f0872,_0x161016[_0x2f0872]['cron'],handleJob(_0x161016[_0x2f0872]));logger[_0x0048('0xb')](_0x0048('0x54'),_0x161016[_0x2f0872][_0x0048('0x3c')],_0x161016[_0x2f0872][_0x0048('0x51')]);}else{manager[_0x0048('0x44')](_0x2f0872);manager[_0x0048('0x45')](_0x2f0872);logger[_0x0048('0xb')](_0x0048('0x50'),_0x161016[_0x2f0872]['name'],_0x161016[_0x2f0872][_0x0048('0x51')]);}}}})[_0x0048('0x2d')](function(_0x1fb36d){logger[_0x0048('0x2a')](JSON[_0x0048('0x2e')](_0x1fb36d));});}exports['run']=function(_0xfdaa8f){return getJobs(_0xfdaa8f);};exports[_0x0048('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 319f746..6d318a7 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd361=['format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','bucket','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','Mixed','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','catch','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info'];(function(_0x5bf18d,_0x2cc7a4){var _0x7826f5=function(_0x259ad4){while(--_0x259ad4){_0x5bf18d['push'](_0x5bf18d['shift']());}};_0x7826f5(++_0x2cc7a4);}(_0xd361,0x1bc));var _0x1d36=function(_0x13d09b,_0x4bf163){_0x13d09b=_0x13d09b-0x0;var _0x40755d=_0xd361[_0x13d09b];return _0x40755d;};var _=require('lodash');var AWS=require(_0x1d36('0x0'));var rp=require(_0x1d36('0x1'));var util=require(_0x1d36('0x2'));var BPromise=require(_0x1d36('0x3'));var db=require(_0x1d36('0x4'))['db'];var logger=require(_0x1d36('0x5'))(_0x1d36('0x6'));function getTranscriptionJob(_0x29ef8a,_0x9f2c73,_0x4e80d5,_0x5d95e4){return new Promise(function(_0x22e686,_0x51d6d9){var _0x548890=new AWS['TranscribeService']({'accessKeyId':_0x9f2c73,'secretAccessKey':_0x29ef8a,'region':_0x4e80d5});_0x548890[_0x1d36('0x7')]({'TranscriptionJobName':_0x5d95e4},function(_0x54498e,_0x129259){if(_0x54498e){return _0x51d6d9(_0x54498e);}else{return _0x22e686(_0x129259);}});});}function sentiment(_0x47dfb9,_0x51d6b9,_0x233370,_0x3d179a,_0x335767){return new Promise(function(_0x2e0ae2,_0x4318a9){var _0x44accf=new AWS[(_0x1d36('0x8'))]({'accessKeyId':_0x51d6b9,'secretAccessKey':_0x47dfb9,'region':_0x233370});_0x44accf[_0x1d36('0x9')]({'Text':_0x3d179a,'LanguageCode':_0x335767[_0x1d36('0xa')](0x0,0x2)},function(_0x48c96b,_0x275b3a){if(_0x48c96b){return _0x4318a9(_0x48c96b);}else{return _0x2e0ae2(_0x275b3a);}});});}function checkTranscribeJob(_0xbfc5af,_0x12f596,_0x2654bd){var _0x32467e;return new BPromise(function(_0x3bfed1,_0x2474e9){logger[_0x1d36('0xb')](util[_0x1d36('0xc')](_0x1d36('0xd'),_0xbfc5af['id'],_0xbfc5af['transcribeName']));return getTranscriptionJob(_0x2654bd['data1'],_0x2654bd[_0x1d36('0xe')],_0x12f596[_0x1d36('0xf')],_0xbfc5af[_0x1d36('0x10')])[_0x1d36('0x11')](function(_0x2eba31){logger[_0x1d36('0xb')](util['format'](_0x1d36('0x12'),_0xbfc5af['id'],_0xbfc5af[_0x1d36('0x10')],_0x2eba31[_0x1d36('0x13')]['TranscriptionJobStatus']));if(!_0xbfc5af[_0x1d36('0x14')]){switch(_0x2eba31[_0x1d36('0x13')][_0x1d36('0x15')]){case _0x1d36('0x16'):var _0x4d736e={'transcribeStatus':_0x2eba31[_0x1d36('0x13')]['TranscriptionJobStatus'],'fileUri':_0x2eba31['TranscriptionJob'][_0x1d36('0x17')]['TranscriptFileUri']};logger[_0x1d36('0xb')](util[_0x1d36('0xc')](_0x1d36('0x18'),_0xbfc5af['id']));return rp({'uri':_0x2eba31[_0x1d36('0x13')][_0x1d36('0x17')][_0x1d36('0x19')],'json':!![]})['then'](function(_0x1345fd){logger[_0x1d36('0xb')](util[_0x1d36('0xc')](_0x1d36('0x1a'),_0xbfc5af['id']));if(_0x1345fd&&_0x1345fd[_0x1d36('0x1b')]&&_0x1345fd['results']['transcripts']&&_0x1345fd[_0x1d36('0x1b')][_0x1d36('0x1c')][_0x1d36('0x1d')]){_0x4d736e[_0x1d36('0x14')]='';for(var _0x5ccfb8=0x0;_0x5ccfb8<_0x1345fd[_0x1d36('0x1b')][_0x1d36('0x1c')][_0x1d36('0x1d')];_0x5ccfb8++){_0x4d736e['fileText']+=_0x1345fd[_0x1d36('0x1b')][_0x1d36('0x1c')][_0x5ccfb8]['transcript']+'';}}return _0xbfc5af[_0x1d36('0x1e')](_0x4d736e);})[_0x1d36('0x11')](function(){logger[_0x1d36('0xb')](util[_0x1d36('0xc')](_0x1d36('0x1f'),_0xbfc5af['id']));if(!_0xbfc5af[_0x1d36('0x20')]){throw new db[(_0x1d36('0x21'))][(_0x1d36('0x22'))](_0x1d36('0x23'));}if(!_0x12f596['sentiment']||!_0x12f596[_0x1d36('0x24')]||!_0x12f596[_0x1d36('0x25')]||!_0x12f596['language']||!_0x12f596['bucket']){throw new db[(_0x1d36('0x21'))][(_0x1d36('0x22'))](_0x1d36('0x26'));}if(!_0x4d736e[_0x1d36('0x14')]){throw new Error(_0x1d36('0x27'));}if(_0x12f596[_0x1d36('0x24')]===_0x2654bd['id']){return _0x2654bd;}else{return db[_0x1d36('0x28')][_0x1d36('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x1d36('0x11')](function(_0x3a374d){if(!_0x3a374d){throw new db[(_0x1d36('0x21'))]['ValidationError'](_0x1d36('0x2a'));}if(!_0x3a374d['data1']||!_0x3a374d[_0x1d36('0xe')]){throw new db[(_0x1d36('0x21'))][(_0x1d36('0x22'))](_0x1d36('0x2b'));}_0x32467e=_0x3a374d;logger[_0x1d36('0xb')](util[_0x1d36('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xbfc5af['id']));return sentiment(_0x32467e['data1'],_0x32467e['data2'],_0x12f596['sentimentRegion'],_0x4d736e['fileText'],_0x12f596[_0x1d36('0x2c')]);})[_0x1d36('0x11')](function(_0x47e276){logger[_0x1d36('0xb')](util[_0x1d36('0xc')](_0x1d36('0x2d'),_0xbfc5af['id']));return _0xbfc5af[_0x1d36('0x1e')]({'sentiment':_0x47e276[_0x1d36('0x2e')],'sPositive':_0x47e276[_0x1d36('0x2f')][_0x1d36('0x30')],'sNegative':_0x47e276['SentimentScore'][_0x1d36('0x31')],'sMixed':_0x47e276[_0x1d36('0x2f')]['Mixed'],'sNeutral':_0x47e276[_0x1d36('0x2f')][_0x1d36('0x32')]});})['then'](function(){logger['info'](util[_0x1d36('0xc')](_0x1d36('0x1f'),_0xbfc5af['id']));_0x3bfed1();});case _0x1d36('0x33'):return _0xbfc5af[_0x1d36('0x1e')]({'transcribeStatus':_0x1d36('0x33'),'failureReason':_0x2eba31['TranscriptionJob'][_0x1d36('0x34')]})[_0x1d36('0x11')](function(){logger[_0x1d36('0xb')](util[_0x1d36('0xc')](_0x1d36('0x1f'),_0xbfc5af['id']));_0x3bfed1();});default:logger['info'](util[_0x1d36('0xc')](_0x1d36('0x35'),_0xbfc5af['id']));break;}}else{return BPromise['resolve']()[_0x1d36('0x11')](function(){if(!_0xbfc5af[_0x1d36('0x20')]){throw new db[(_0x1d36('0x21'))][(_0x1d36('0x22'))](_0x1d36('0x23'));}if(!_0x12f596[_0x1d36('0x36')]||!_0x12f596[_0x1d36('0x24')]||!_0x12f596['sentimentRegion']||!_0x12f596[_0x1d36('0x2c')]||!_0x12f596[_0x1d36('0x37')]){throw new db[(_0x1d36('0x21'))][(_0x1d36('0x22'))](_0x1d36('0x26'));}if(!_0xbfc5af[_0x1d36('0x14')]){throw new Error(_0x1d36('0x27'));}if(_0x12f596[_0x1d36('0x24')]===_0x2654bd['id']){return _0x2654bd;}else{return db[_0x1d36('0x28')][_0x1d36('0x29')]({'where':{'id':_settings[_0x1d36('0x24')]}});}})['then'](function(_0x5d611c){if(!_0x5d611c){throw new db[(_0x1d36('0x21'))][(_0x1d36('0x22'))](_0x1d36('0x2a'));}if(!_0x5d611c['data1']||!_0x5d611c[_0x1d36('0xe')]){throw new db['Sequelize'][(_0x1d36('0x22'))](_0x1d36('0x2b'));}_0x32467e=_0x5d611c;logger['info'](util[_0x1d36('0xc')](_0x1d36('0x38'),_0xbfc5af['id']));return sentiment(_0x32467e[_0x1d36('0x39')],_0x32467e[_0x1d36('0xe')],_0x12f596[_0x1d36('0x25')],_0xbfc5af['fileText'],_0x12f596[_0x1d36('0x2c')]);})[_0x1d36('0x11')](function(_0x573a41){logger['info'](util[_0x1d36('0xc')](_0x1d36('0x2d'),_0xbfc5af['id']));return _0xbfc5af['update']({'sentiment':_0x573a41[_0x1d36('0x2e')],'sPositive':_0x573a41[_0x1d36('0x2f')][_0x1d36('0x30')],'sNegative':_0x573a41[_0x1d36('0x2f')][_0x1d36('0x31')],'sMixed':_0x573a41[_0x1d36('0x2f')][_0x1d36('0x3a')],'sNeutral':_0x573a41['SentimentScore'][_0x1d36('0x32')],'transcribeStatus':_0x1d36('0x16')});})[_0x1d36('0x11')](function(){logger[_0x1d36('0xb')](util[_0x1d36('0xc')](_0x1d36('0x1f'),_0xbfc5af['id']));_0x3bfed1();});}})['catch'](function(_0x2eab22){if(_0x2eab22){if(!_0x2eab22[_0x1d36('0x3b')]||_0x2eab22[_0x1d36('0x3b')]!==_0x1d36('0x3c')){logger[_0x1d36('0x3d')](util[_0x1d36('0xc')](_0x1d36('0x3e'),_0xbfc5af['id']),util[_0x1d36('0x3f')](_0x2eab22,{'showHidden':![],'depth':null}));}}_0x3bfed1();});});}function checkTranscribe(){var _0x425ea6;var _0x651ca3;var _0x2b17a0;return db[_0x1d36('0x40')][_0x1d36('0x41')]({'where':{'transcribeStatus':_0x1d36('0x42')}})[_0x1d36('0x11')](function(_0x5301c3){if(!_0x5301c3||!_0x5301c3[_0x1d36('0x1d')]){throw new db['Sequelize']['ValidationError'](_0x1d36('0x43'));}_0x425ea6=_0x5301c3;return db[_0x1d36('0x44')][_0x1d36('0x29')]({'where':{'id':0x1}});})[_0x1d36('0x11')](function(_0xda663a){if(!_0xda663a){throw new db['Sequelize']['ValidationError'](_0x1d36('0x45'));}_0x651ca3=_0xda663a;if(!_0x651ca3[_0x1d36('0x6')]||!_0x651ca3[_0x1d36('0x46')]||!_0x651ca3[_0x1d36('0xf')]||!_0x651ca3[_0x1d36('0x2c')]||!_0x651ca3[_0x1d36('0x37')]){throw new db['Sequelize'][(_0x1d36('0x22'))](_0x1d36('0x47'));}return db[_0x1d36('0x28')][_0x1d36('0x29')]({'where':{'id':_0x651ca3['transcribeAccountId']}});})[_0x1d36('0x11')](function(_0x1a3ea1){if(!_0x1a3ea1){throw new db[(_0x1d36('0x21'))][(_0x1d36('0x22'))](_0x1d36('0x2a'));}if(!_0x1a3ea1['data1']||!_0x1a3ea1[_0x1d36('0xe')]){throw new db[(_0x1d36('0x21'))][(_0x1d36('0x22'))](_0x1d36('0x2b'));}_0x2b17a0=_0x1a3ea1;var _0x21944a=[];_0x425ea6[_0x1d36('0x48')](function(_0x6ede3e){_0x21944a['push'](checkTranscribeJob(_0x6ede3e,_0x651ca3,_0x2b17a0));});return BPromise[_0x1d36('0x49')](_0x21944a);})[_0x1d36('0x4a')](function(_0x3d5db8){if(_0x3d5db8){if(!_0x3d5db8['name']||_0x3d5db8[_0x1d36('0x3b')]!==_0x1d36('0x3c')){logger[_0x1d36('0x3d')](util[_0x1d36('0x3f')](_0x3d5db8,{'showHidden':![],'depth':null}));}}});}exports[_0x1d36('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x5aad=['bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sequelize','Sentiment\x20Analysis\x20not\x20configured','update','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','lodash','aws-sdk','request-promise','util'];(function(_0x42ddf8,_0x264fc9){var _0x558152=function(_0x174ea2){while(--_0x174ea2){_0x42ddf8['push'](_0x42ddf8['shift']());}};_0x558152(++_0x264fc9);}(_0x5aad,0x1f4));var _0xd5aa=function(_0x181fac,_0x3b86b5){_0x181fac=_0x181fac-0x0;var _0x1edaa6=_0x5aad[_0x181fac];return _0x1edaa6;};var _=require(_0xd5aa('0x0'));var AWS=require(_0xd5aa('0x1'));var rp=require(_0xd5aa('0x2'));var util=require(_0xd5aa('0x3'));var BPromise=require(_0xd5aa('0x4'));var db=require(_0xd5aa('0x5'))['db'];var logger=require('../../config/logger')(_0xd5aa('0x6'));function getTranscriptionJob(_0x30cc8d,_0x3a9ec0,_0x3d98dc,_0x27c182){return new Promise(function(_0xbdd92f,_0x1d3274){var _0x4965a4=new AWS[(_0xd5aa('0x7'))]({'accessKeyId':_0x3a9ec0,'secretAccessKey':_0x30cc8d,'region':_0x3d98dc});_0x4965a4['getTranscriptionJob']({'TranscriptionJobName':_0x27c182},function(_0x377867,_0x31a401){if(_0x377867){return _0x1d3274(_0x377867);}else{return _0xbdd92f(_0x31a401);}});});}function sentiment(_0x41044b,_0x1c9505,_0x5bbddf,_0x2586e9,_0x3b9103){return new Promise(function(_0x59d599,_0xd99672){var _0x342c0c=new AWS[(_0xd5aa('0x8'))]({'accessKeyId':_0x1c9505,'secretAccessKey':_0x41044b,'region':_0x5bbddf});_0x342c0c[_0xd5aa('0x9')]({'Text':_0x2586e9,'LanguageCode':_0x3b9103['substring'](0x0,0x2)},function(_0x351906,_0x1e1b9a){if(_0x351906){return _0xd99672(_0x351906);}else{return _0x59d599(_0x1e1b9a);}});});}function checkTranscribeJob(_0x3d21ae,_0x7c4041,_0x38da3e){var _0x4f9a9f;return new BPromise(function(_0x500cf6,_0x2a4530){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0xc'),_0x3d21ae['id'],_0x3d21ae[_0xd5aa('0xd')]));return getTranscriptionJob(_0x38da3e['data1'],_0x38da3e['data2'],_0x7c4041[_0xd5aa('0xe')],_0x3d21ae[_0xd5aa('0xd')])[_0xd5aa('0xf')](function(_0x4817d5){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x10'),_0x3d21ae['id'],_0x3d21ae[_0xd5aa('0xd')],_0x4817d5[_0xd5aa('0x11')][_0xd5aa('0x12')]));if(!_0x3d21ae[_0xd5aa('0x13')]){switch(_0x4817d5[_0xd5aa('0x11')][_0xd5aa('0x12')]){case _0xd5aa('0x14'):var _0x403cd0={'transcribeStatus':_0x4817d5[_0xd5aa('0x11')]['TranscriptionJobStatus'],'fileUri':_0x4817d5['TranscriptionJob']['Transcript'][_0xd5aa('0x15')]};logger['info'](util[_0xd5aa('0xb')](_0xd5aa('0x16'),_0x3d21ae['id']));return rp({'uri':_0x4817d5[_0xd5aa('0x11')][_0xd5aa('0x17')][_0xd5aa('0x15')],'json':!![]})[_0xd5aa('0xf')](function(_0xf693a2){logger[_0xd5aa('0xa')](util['format'](_0xd5aa('0x18'),_0x3d21ae['id']));if(_0xf693a2&&_0xf693a2[_0xd5aa('0x19')]&&_0xf693a2[_0xd5aa('0x19')][_0xd5aa('0x1a')]&&_0xf693a2[_0xd5aa('0x19')]['transcripts']['length']){_0x403cd0['fileText']='';for(var _0x13783f=0x0;_0x13783f<_0xf693a2[_0xd5aa('0x19')][_0xd5aa('0x1a')][_0xd5aa('0x1b')];_0x13783f++){_0x403cd0[_0xd5aa('0x13')]+=_0xf693a2[_0xd5aa('0x19')][_0xd5aa('0x1a')][_0x13783f][_0xd5aa('0x1c')]+'';}}return _0x3d21ae['update'](_0x403cd0);})['then'](function(){logger['info'](util[_0xd5aa('0xb')](_0xd5aa('0x1d'),_0x3d21ae['id']));if(!_0x3d21ae[_0xd5aa('0x1e')]){throw new db['Sequelize']['ValidationError'](_0xd5aa('0x1f'));}if(!_0x7c4041[_0xd5aa('0x20')]||!_0x7c4041[_0xd5aa('0x21')]||!_0x7c4041[_0xd5aa('0x22')]||!_0x7c4041[_0xd5aa('0x23')]||!_0x7c4041[_0xd5aa('0x24')]){throw new db['Sequelize'][(_0xd5aa('0x25'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x403cd0[_0xd5aa('0x13')]){throw new Error(_0xd5aa('0x26'));}if(_0x7c4041[_0xd5aa('0x21')]===_0x38da3e['id']){return _0x38da3e;}else{return db[_0xd5aa('0x27')][_0xd5aa('0x28')]({'where':{'id':_settings[_0xd5aa('0x21')]}});}})[_0xd5aa('0xf')](function(_0x5b58ac){if(!_0x5b58ac){throw new db['Sequelize']['ValidationError'](_0xd5aa('0x29'));}if(!_0x5b58ac[_0xd5aa('0x2a')]||!_0x5b58ac[_0xd5aa('0x2b')]){throw new db['Sequelize']['ValidationError'](_0xd5aa('0x2c'));}_0x4f9a9f=_0x5b58ac;logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x2d'),_0x3d21ae['id']));return sentiment(_0x4f9a9f[_0xd5aa('0x2a')],_0x4f9a9f[_0xd5aa('0x2b')],_0x7c4041[_0xd5aa('0x22')],_0x403cd0[_0xd5aa('0x13')],_0x7c4041['language']);})[_0xd5aa('0xf')](function(_0xe857a3){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x2e'),_0x3d21ae['id']));return _0x3d21ae['update']({'sentiment':_0xe857a3[_0xd5aa('0x2f')],'sPositive':_0xe857a3[_0xd5aa('0x30')][_0xd5aa('0x31')],'sNegative':_0xe857a3['SentimentScore'][_0xd5aa('0x32')],'sMixed':_0xe857a3[_0xd5aa('0x30')][_0xd5aa('0x33')],'sNeutral':_0xe857a3[_0xd5aa('0x30')][_0xd5aa('0x34')]});})[_0xd5aa('0xf')](function(){logger[_0xd5aa('0xa')](util['format'](_0xd5aa('0x1d'),_0x3d21ae['id']));_0x500cf6();});case _0xd5aa('0x35'):return _0x3d21ae['update']({'transcribeStatus':'FAILED','failureReason':_0x4817d5[_0xd5aa('0x11')][_0xd5aa('0x36')]})[_0xd5aa('0xf')](function(){logger['info'](util['format'](_0xd5aa('0x1d'),_0x3d21ae['id']));_0x500cf6();});default:logger[_0xd5aa('0xa')](util['format'](_0xd5aa('0x37'),_0x3d21ae['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x3d21ae['tempSentiment']){throw new db[(_0xd5aa('0x38'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x7c4041[_0xd5aa('0x20')]||!_0x7c4041[_0xd5aa('0x21')]||!_0x7c4041[_0xd5aa('0x22')]||!_0x7c4041[_0xd5aa('0x23')]||!_0x7c4041['bucket']){throw new db['Sequelize'][(_0xd5aa('0x25'))](_0xd5aa('0x39'));}if(!_0x3d21ae[_0xd5aa('0x13')]){throw new Error(_0xd5aa('0x26'));}if(_0x7c4041[_0xd5aa('0x21')]===_0x38da3e['id']){return _0x38da3e;}else{return db[_0xd5aa('0x27')]['findOne']({'where':{'id':_settings[_0xd5aa('0x21')]}});}})[_0xd5aa('0xf')](function(_0x5d0849){if(!_0x5d0849){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x29'));}if(!_0x5d0849[_0xd5aa('0x2a')]||!_0x5d0849[_0xd5aa('0x2b')]){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x2c'));}_0x4f9a9f=_0x5d0849;logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3d21ae['id']));return sentiment(_0x4f9a9f[_0xd5aa('0x2a')],_0x4f9a9f['data2'],_0x7c4041[_0xd5aa('0x22')],_0x3d21ae[_0xd5aa('0x13')],_0x7c4041[_0xd5aa('0x23')]);})['then'](function(_0x37eceb){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x2e'),_0x3d21ae['id']));return _0x3d21ae[_0xd5aa('0x3a')]({'sentiment':_0x37eceb['Sentiment'],'sPositive':_0x37eceb[_0xd5aa('0x30')][_0xd5aa('0x31')],'sNegative':_0x37eceb[_0xd5aa('0x30')][_0xd5aa('0x32')],'sMixed':_0x37eceb['SentimentScore'][_0xd5aa('0x33')],'sNeutral':_0x37eceb[_0xd5aa('0x30')][_0xd5aa('0x34')],'transcribeStatus':_0xd5aa('0x14')});})['then'](function(){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x1d'),_0x3d21ae['id']));_0x500cf6();});}})[_0xd5aa('0x3b')](function(_0x1e4f30){if(_0x1e4f30){if(!_0x1e4f30[_0xd5aa('0x3c')]||_0x1e4f30[_0xd5aa('0x3c')]!==_0xd5aa('0x3d')){logger[_0xd5aa('0x3e')](util['format'](_0xd5aa('0x3f'),_0x3d21ae['id']),util[_0xd5aa('0x40')](_0x1e4f30,{'showHidden':![],'depth':null}));}}_0x500cf6();});});}function checkTranscribe(){var _0x82d8ec;var _0x76ee1;var _0x3be055;return db[_0xd5aa('0x41')][_0xd5aa('0x42')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xd5aa('0xf')](function(_0xbf3120){if(!_0xbf3120||!_0xbf3120['length']){throw new db['Sequelize'][(_0xd5aa('0x25'))]('No\x20transcribe\x20job\x20to\x20check');}_0x82d8ec=_0xbf3120;return db['Setting'][_0xd5aa('0x28')]({'where':{'id':0x1}});})[_0xd5aa('0xf')](function(_0x956e5a){if(!_0x956e5a){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x43'));}_0x76ee1=_0x956e5a;if(!_0x76ee1[_0xd5aa('0x6')]||!_0x76ee1[_0xd5aa('0x44')]||!_0x76ee1[_0xd5aa('0xe')]||!_0x76ee1[_0xd5aa('0x23')]||!_0x76ee1['bucket']){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x45'));}return db[_0xd5aa('0x27')]['findOne']({'where':{'id':_0x76ee1['transcribeAccountId']}});})[_0xd5aa('0xf')](function(_0x3caabf){if(!_0x3caabf){throw new db['Sequelize'][(_0xd5aa('0x25'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3caabf[_0xd5aa('0x2a')]||!_0x3caabf[_0xd5aa('0x2b')]){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x2c'));}_0x3be055=_0x3caabf;var _0x564471=[];_0x82d8ec['forEach'](function(_0x330f5b){_0x564471[_0xd5aa('0x46')](checkTranscribeJob(_0x330f5b,_0x76ee1,_0x3be055));});return BPromise[_0xd5aa('0x47')](_0x564471);})[_0xd5aa('0x3b')](function(_0x4ef9fb){if(_0x4ef9fb){if(!_0x4ef9fb[_0xd5aa('0x3c')]||_0x4ef9fb[_0xd5aa('0x3c')]!=='SequelizeValidationError'){logger[_0xd5aa('0x3e')](util['inspect'](_0x4ef9fb,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index c719f60..16e9381 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe024=['WhatsappInteraction','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','redis','localhost'];(function(_0x2f17d1,_0x5d37be){var _0x31756f=function(_0x1d9431){while(--_0x1d9431){_0x2f17d1['push'](_0x2f17d1['shift']());}};_0x31756f(++_0x5d37be);}(_0xe024,0x198));var _0x4e02=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0xe024[_0x558e45];return _0x3e9075;};'use strict';var _=require(_0x4e02('0x0'));var moment=require(_0x4e02('0x1'));var Redis=require(_0x4e02('0x2'));var util=require(_0x4e02('0x3'));var config=require(_0x4e02('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x4e02('0x5'))('schedule');config[_0x4e02('0x6')]=_['defaults'](config['redis'],{'host':_0x4e02('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x6e5a1d=[];return db[_0x4e02('0x8')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4e02('0x9')](0x18,'hours')}}})[_0x4e02('0xa')](function(_0x346f61){if(_0x346f61&&_0x346f61[_0x4e02('0xb')]){_0x6e5a1d=_[_0x4e02('0xc')](_0x346f61||[],'id');logger['info'](_0x4e02('0xd'),_0x6e5a1d[_0x4e02('0xe')]());return db['WhatsappInteraction'][_0x4e02('0xf')]({'closeReason':'system','disposition':_0x4e02('0x10'),'closed':!![],'closedAt':moment()['format'](_0x4e02('0x11'))},{'where':{'id':_0x6e5a1d}});}})[_0x4e02('0xa')](function(){if(_0x6e5a1d&&_0x6e5a1d[_0x4e02('0xb')]){logger['info'](_0x4e02('0x12'),_0x6e5a1d['join']());for(var _0x253b25=0x0;_0x253b25<_0x6e5a1d[_0x4e02('0xb')];_0x253b25++){io[_0x4e02('0x13')](_0x4e02('0x14'),{'id':_0x6e5a1d[_0x253b25],'closed':!![]});}}})[_0x4e02('0x15')](function(_0x2e6af1){logger[_0x4e02('0x16')](_0x4e02('0x17'),_0x2e6af1?util[_0x4e02('0x18')](_0x2e6af1,{'showHidden':![],'depth':null}):'');});}exports[_0x4e02('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x4729=['lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','lodash','moment','ioredis','util','schedule','redis','socket.io-emitter','WhatsappInteraction','findAll'];(function(_0x535a42,_0x2d3281){var _0x33d37b=function(_0x5d0cf9){while(--_0x5d0cf9){_0x535a42['push'](_0x535a42['shift']());}};_0x33d37b(++_0x2d3281);}(_0x4729,0x18f));var _0x9472=function(_0x6168fb,_0x15013f){_0x6168fb=_0x6168fb-0x0;var _0xeb7326=_0x4729[_0x6168fb];return _0xeb7326;};'use strict';var _=require(_0x9472('0x0'));var moment=require(_0x9472('0x1'));var Redis=require(_0x9472('0x2'));var util=require(_0x9472('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x9472('0x4'));config[_0x9472('0x5')]=_['defaults'](config[_0x9472('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9472('0x6'))(new Redis(config[_0x9472('0x5')]));function closeInteractions(){var _0x15c68c=[];return db[_0x9472('0x7')][_0x9472('0x8')]({'raw':!![],'attributes':['id',_0x9472('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9472('0xa')](0x18,_0x9472('0xb'))}}})[_0x9472('0xc')](function(_0x3f5273){if(_0x3f5273&&_0x3f5273[_0x9472('0xd')]){_0x15c68c=_['map'](_0x3f5273||[],'id');logger[_0x9472('0xe')](_0x9472('0xf'),_0x15c68c[_0x9472('0x10')]());return db['WhatsappInteraction'][_0x9472('0x11')]({'closeReason':_0x9472('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x9472('0x13'))},{'where':{'id':_0x15c68c}});}})['then'](function(){if(_0x15c68c&&_0x15c68c[_0x9472('0xd')]){logger['info'](_0x9472('0x14'),_0x15c68c[_0x9472('0x10')]());for(var _0x2eda6a=0x0;_0x2eda6a<_0x15c68c['length'];_0x2eda6a++){io['emit'](_0x9472('0x15'),{'id':_0x15c68c[_0x2eda6a],'closed':!![]});}}})[_0x9472('0x16')](function(_0x26aa91){logger[_0x9472('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x26aa91?util['inspect'](_0x26aa91,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6103b23..6b703ca 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa58a=['catch','util','../mysqldb','Innocenzo','innocenzo.biondo','push','now','Biondo','@xcally.com','CmContact','then','bulkCreate','finished\x20populating','contacts1','destroy','CmHopper','hopper1','log','hopper2'];(function(_0x477079,_0x143642){var _0x4c428d=function(_0x4edca9){while(--_0x4edca9){_0x477079['push'](_0x477079['shift']());}};_0x4c428d(++_0x143642);}(_0xa58a,0xac));var _0xaa58=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xa58a[_0x58e469];return _0x4c01c5;};'use strict';var util=require(_0xaa58('0x0'));var db=require(_0xaa58('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xaa58('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xaa58('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xaa58('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xaa58('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaa58('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xaa58('0x4')]({'id':i,'firstName':_0xaa58('0x2')+i,'lastName':_0xaa58('0x6')+i,'phone':0xf879fb460+i,'email':_0xaa58('0x3')+i+_0xaa58('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xaa58('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xaa58('0x5')]()});}db[_0xaa58('0x8')]['destroy']({'where':{}})[_0xaa58('0x9')](function(){return db[_0xaa58('0x8')][_0xaa58('0xa')](contacts);})[_0xaa58('0x9')](function(){console['log'](_0xaa58('0xb'),_0xaa58('0xc'));return db['CmHopper'][_0xaa58('0xd')]({'where':{}});})[_0xaa58('0x9')](function(){return db[_0xaa58('0xe')][_0xaa58('0xa')](hopper);})[_0xaa58('0x9')](function(){console['log'](_0xaa58('0xb'),_0xaa58('0xf'));return db['CmContact'][_0xaa58('0xa')](contacts2);})['then'](function(){console['log']('finished\x20populating','contacts2');return db[_0xaa58('0xe')][_0xaa58('0xa')](hopper2);})[_0xaa58('0x9')](function(){console[_0xaa58('0x10')]('finished\x20populating',_0xaa58('0x11'));})[_0xaa58('0x12')](function(_0x5b41c1){console[_0xaa58('0x10')](_0x5b41c1);}); \ No newline at end of file +var _0x1f2e=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','hopper1','finished\x20populating','contacts2','catch','util'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x1f2e,0x1da));var _0xe1f2=function(_0x4f45e6,_0x97948b){_0x4f45e6=_0x4f45e6-0x0;var _0x3d8c03=_0x1f2e[_0x4f45e6];return _0x3d8c03;};'use strict';var util=require(_0xe1f2('0x0'));var db=require(_0xe1f2('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe1f2('0x2')]({'id':i,'firstName':_0xe1f2('0x3')+i,'lastName':_0xe1f2('0x4')+i,'phone':0xf879fb460+i,'email':_0xe1f2('0x5')+i+_0xe1f2('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xe1f2('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe1f2('0x7')](),'updatedAt':Date[_0xe1f2('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xe1f2('0x3')+i,'lastName':_0xe1f2('0x4')+i,'phone':0xf879fb460+i,'email':_0xe1f2('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe1f2('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe1f2('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe1f2('0x7')](),'updatedAt':Date[_0xe1f2('0x7')]()});}db[_0xe1f2('0x8')][_0xe1f2('0x9')]({'where':{}})[_0xe1f2('0xa')](function(){return db['CmContact'][_0xe1f2('0xb')](contacts);})['then'](function(){console[_0xe1f2('0xc')]('finished\x20populating',_0xe1f2('0xd'));return db[_0xe1f2('0xe')][_0xe1f2('0x9')]({'where':{}});})[_0xe1f2('0xa')](function(){return db[_0xe1f2('0xe')][_0xe1f2('0xb')](hopper);})[_0xe1f2('0xa')](function(){console['log']('finished\x20populating',_0xe1f2('0xf'));return db['CmContact'][_0xe1f2('0xb')](contacts2);})[_0xe1f2('0xa')](function(){console['log'](_0xe1f2('0x10'),_0xe1f2('0x11'));return db[_0xe1f2('0xe')][_0xe1f2('0xb')](hopper2);})[_0xe1f2('0xa')](function(){console[_0xe1f2('0xc')]('finished\x20populating','hopper2');})[_0xe1f2('0x12')](function(_0x31a76c){console['log'](_0x31a76c);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 67bc3f3..918df39 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7952=['util','push','%s%s','format','agent','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch'];(function(_0x5b7139,_0x453298){var _0xe94df8=function(_0x19b97f){while(--_0x19b97f){_0x5b7139['push'](_0x5b7139['shift']());}};_0xe94df8(++_0x453298);}(_0x7952,0xd8));var _0x2795=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0x7952[_0x5224ba];return _0x459bd2;};'use strict';var util=require(_0x2795('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2795('0x1')]({'name':util['format'](_0x2795('0x2'),'agent',i),'fullname':util[_0x2795('0x3')](_0x2795('0x2'),_0x2795('0x4'),i),'email':util['format']('%s%s@xcally.com',_0x2795('0x4'),i),'role':_0x2795('0x4'),'password':_0x2795('0x5'),'internal':0xfa0+i,'type':_0x2795('0x6'),'transport':[_0x2795('0x7'),'ws',_0x2795('0x8')],'disallow':['all'],'allow':[_0x2795('0x9')],'defaultuser':util[_0x2795('0x3')]('%s%s',_0x2795('0x4'),i),'encryption':_0x2795('0xa'),'avpf':_0x2795('0xa'),'force_avp':_0x2795('0xa'),'icesupport':_0x2795('0xa'),'dtlsenable':_0x2795('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x2795('0xb'),'dtlssetup':'actpass','callerid':util[_0x2795('0x3')](_0x2795('0xc'),util[_0x2795('0x3')](_0x2795('0x2'),_0x2795('0x4'),i),0xfa0+i)});}db[_0x2795('0xd')]['bulkCreate'](users)[_0x2795('0xe')](function(){console[_0x2795('0xf')](_0x2795('0x10'));})[_0x2795('0x11')](function(_0x4fcc2c){console['log'](_0x4fcc2c);}); \ No newline at end of file +var _0x2be3=['\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass'];(function(_0x15d5d8,_0x622ec5){var _0x185d37=function(_0x55a6eb){while(--_0x55a6eb){_0x15d5d8['push'](_0x15d5d8['shift']());}};_0x185d37(++_0x622ec5);}(_0x2be3,0x96));var _0x32be=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x2be3[_0x433a86];return _0x23000c;};'use strict';var util=require(_0x32be('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x32be('0x1')]({'name':util[_0x32be('0x2')](_0x32be('0x3'),'agent',i),'fullname':util[_0x32be('0x2')]('%s%s',_0x32be('0x4'),i),'email':util[_0x32be('0x2')](_0x32be('0x5'),_0x32be('0x4'),i),'role':_0x32be('0x4'),'password':'password','internal':0xfa0+i,'type':_0x32be('0x6'),'transport':[_0x32be('0x7'),'ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x32be('0x2')](_0x32be('0x3'),_0x32be('0x4'),i),'encryption':_0x32be('0x8'),'avpf':'yes','force_avp':_0x32be('0x8'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x32be('0x9'),'dtlsprivatekey':_0x32be('0xa'),'dtlssetup':_0x32be('0xb'),'callerid':util[_0x32be('0x2')](_0x32be('0xc'),util[_0x32be('0x2')](_0x32be('0x3'),_0x32be('0x4'),i),0xfa0+i)});}db[_0x32be('0xd')][_0x32be('0xe')](users)[_0x32be('0xf')](function(){console[_0x32be('0x10')](_0x32be('0x11'));})['catch'](function(_0x3c7094){console[_0x32be('0x10')](_0x3c7094);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index a41588c..3e1adae 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef3a=['query','find','userProfileId','ChatInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','ChatQueue','OpenchannelQueue','WhatsappQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','mail','whatsapp','trunk:%s','campaign:%s:%s','leave','ChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','lodash','bluebird','./environment','Agents','User','name','role','agent','telephone','type','ivr','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','UserProfileResource','then','map','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','handshake'];(function(_0x2cd326,_0x1d2990){var _0x46c28e=function(_0x31594b){while(--_0x31594b){_0x2cd326['push'](_0x2cd326['shift']());}};_0x46c28e(++_0x1d2990);}(_0xef3a,0xa6));var _0xaef3=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0xef3a[_0x336ca2];return _0xda59a6;};'use strict';var _=require(_0xaef3('0x0'));var util=require('util');var BPromise=require(_0xaef3('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xaef3('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xaef3('0x3'),'model':db[_0xaef3('0x4')],'attributes':['id',_0xaef3('0x5'),_0xaef3('0x6')],'raw':!![],'where':{'role':_0xaef3('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xaef3('0x5')],'where':{'role':_0xaef3('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xaef3('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xaef3('0x5')],'where':{'role':_0xaef3('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xaef3('0x5'),_0xaef3('0x9')],'where':{'type':_0xaef3('0xa')}};function getAssociatedResources(_0x1ccd3b,_0x5afa48,_0x180c06){return db['UserProfileSection']['findOne']({'where':{'name':_0x1ccd3b,'userProfileId':_0x5afa48},'raw':!![]})['then'](function(_0x12ca45){if(_0x12ca45){if(_0x12ca45[_0xaef3('0xb')]){switch(_0x1ccd3b){case _0xaef3('0xc'):case _0xaef3('0xd'):case _0xaef3('0xe'):case _0xaef3('0xf'):case _0xaef3('0x10'):case _0xaef3('0x11'):case'WhatsappQueues':return db[_0x180c06]['findAll'](queryQueues);case _0xaef3('0x12'):return db[_0x180c06][_0xaef3('0x13')](queryTelephones);case _0xaef3('0x14'):return db[_0x180c06][_0xaef3('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x180c06][_0xaef3('0x13')](queryCampaigns);}}else{return db[_0xaef3('0x15')][_0xaef3('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x12ca45['id']},'raw':!![]})[_0xaef3('0x16')](function(_0x576ea0){if(_0x576ea0){var _0x2cd370={'where':{'id':_[_0xaef3('0x17')](_0x576ea0,_0xaef3('0x18'))},'raw':!![]};switch(_0x180c06){case _0xaef3('0x4'):_0x2cd370[_0xaef3('0x19')][_0xaef3('0x6')]=_0xaef3('0x8');break;case _0xaef3('0x1a'):_0x2cd370[_0xaef3('0x19')][_0xaef3('0x9')]=_0xaef3('0xa');break;}return db[_0x180c06][_0xaef3('0x13')](_0x2cd370);}else{return[];}});}}else{return[];}})[_0xaef3('0x16')](function(_0x4ee67d){return _0x4ee67d;});}function joinOrLeaveQueues(_0x510e80,_0x1e7be1,_0x2eae00,_0x4592bd){_0x510e80[_0x1e7be1](util[_0xaef3('0x1b')](_0xaef3('0x1c'),_0x2eae00,_0x4592bd[_0xaef3('0x5')]));if(_0x4592bd[_0xaef3('0x3')]){for(var _0x1dcbd2=0x0;_0x1dcbd2<_0x4592bd[_0xaef3('0x3')][_0xaef3('0x1d')];_0x1dcbd2+=0x1){_0x510e80[_0x1e7be1](util[_0xaef3('0x1b')](_0xaef3('0x1e'),_0x4592bd[_0xaef3('0x3')][_0x1dcbd2][_0xaef3('0x5')]));}}}function joinOrLeave(_0x1ce827,_0x47b248,_0x440d45){var _0x1233f3;if(_0x1ce827[_0xaef3('0x1f')][_0xaef3('0x20')]['id']){db['User'][_0xaef3('0x21')]({'attributes':['id',_0xaef3('0x5'),_0xaef3('0x6'),_0xaef3('0x22')],'where':{'id':_0x1ce827['handshake'][_0xaef3('0x20')]['id']},'include':[{'model':db[_0xaef3('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xaef3('0x24'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xaef3('0x25')],'as':_0xaef3('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xaef3('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xaef3('0x28')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xaef3('0x16')](function(_0x165e0c){if(_0x165e0c){_0x1233f3=_0x165e0c;_0x1ce827[_0x47b248](util[_0xaef3('0x1b')](_0xaef3('0x1e'),_0x165e0c['name']));var _0x13637b=[];switch(_0x165e0c[_0xaef3('0x6')]){case'admin':_0x1ce827[_0x47b248](_0xaef3('0x29'));_0x1ce827[_0x47b248](_0xaef3('0x2a'));if(queryQueues[_0xaef3('0x2b')](_0xaef3('0x2c'))){delete queryQueues['include'];}_0x13637b[_0xaef3('0x2d')](db[_0xaef3('0x2e')][_0xaef3('0x13')](queryQueues));_0x13637b[_0xaef3('0x2d')](db['ChatQueue'][_0xaef3('0x13')](queryQueues));_0x13637b['push'](db[_0xaef3('0x2f')]['findAll'](queryQueues));_0x13637b['push'](db[_0xaef3('0x30')][_0xaef3('0x13')](queryQueues));_0x13637b[_0xaef3('0x2d')](db[_0xaef3('0x31')][_0xaef3('0x13')](queryQueues));_0x13637b['push'](db['OpenchannelQueue'][_0xaef3('0x13')](queryQueues));_0x13637b[_0xaef3('0x2d')](db[_0xaef3('0x32')][_0xaef3('0x13')](queryQueues));_0x13637b[_0xaef3('0x2d')](db[_0xaef3('0x4')][_0xaef3('0x13')](queryTelephones));_0x13637b[_0xaef3('0x2d')](db[_0xaef3('0x33')]['findAll'](queryTrunks));_0x13637b[_0xaef3('0x2d')](db['Campaign'][_0xaef3('0x13')](queryCampaigns));_0x13637b[_0xaef3('0x2d')](db[_0xaef3('0x4')][_0xaef3('0x13')](queryAgents));break;case _0xaef3('0x34'):_0x1ce827[_0x47b248](_0xaef3('0x29'));_0x1ce827[_0x47b248](_0xaef3('0x2a'));_0x13637b[_0xaef3('0x2d')](getAssociatedResources(_0xaef3('0xc'),_0x165e0c[_0xaef3('0x22')],_0xaef3('0x2e')));_0x13637b[_0xaef3('0x2d')](getAssociatedResources(_0xaef3('0xd'),_0x165e0c['userProfileId'],_0xaef3('0x35')));_0x13637b[_0xaef3('0x2d')](getAssociatedResources(_0xaef3('0xe'),_0x165e0c[_0xaef3('0x22')],'FaxQueue'));_0x13637b[_0xaef3('0x2d')](getAssociatedResources(_0xaef3('0xf'),_0x165e0c['userProfileId'],_0xaef3('0x30')));_0x13637b[_0xaef3('0x2d')](getAssociatedResources('MailQueues',_0x165e0c[_0xaef3('0x22')],_0xaef3('0x31')));_0x13637b['push'](getAssociatedResources(_0xaef3('0x11'),_0x165e0c[_0xaef3('0x22')],_0xaef3('0x36')));_0x13637b[_0xaef3('0x2d')](getAssociatedResources(_0xaef3('0x37'),_0x165e0c[_0xaef3('0x22')],_0xaef3('0x32')));_0x13637b[_0xaef3('0x2d')](getAssociatedResources(_0xaef3('0x12'),_0x165e0c[_0xaef3('0x22')],'User'));_0x13637b[_0xaef3('0x2d')](getAssociatedResources(_0xaef3('0x14'),_0x165e0c[_0xaef3('0x22')],_0xaef3('0x33')));_0x13637b[_0xaef3('0x2d')](getAssociatedResources(_0xaef3('0x38'),_0x165e0c[_0xaef3('0x22')],'Campaign'));_0x13637b['push'](db[_0xaef3('0x4')][_0xaef3('0x13')](queryAgents));break;case _0xaef3('0x7'):_0x1ce827[_0x47b248](_0xaef3('0x29'));_0x1ce827[_0x47b248]('voice:outbound');_0x13637b[_0xaef3('0x2d')](_0x165e0c[_0xaef3('0x39')]({'attributes':['id',_0xaef3('0x5')]}));_0x13637b['push'](_0x165e0c[_0xaef3('0x3a')]({'attributes':['id',_0xaef3('0x5')]}));_0x13637b[_0xaef3('0x2d')](_0x165e0c[_0xaef3('0x3b')]({'attributes':['id',_0xaef3('0x5')]}));_0x13637b[_0xaef3('0x2d')](_0x165e0c[_0xaef3('0x3c')]({'attributes':['id',_0xaef3('0x5')]}));_0x13637b['push'](_0x165e0c['getMailQueues']({'attributes':['id','name']}));_0x13637b[_0xaef3('0x2d')](_0x165e0c[_0xaef3('0x3d')]({'attributes':['id','name']}));_0x13637b[_0xaef3('0x2d')](_0x165e0c[_0xaef3('0x3e')]({'attributes':['id',_0xaef3('0x5')]}));break;}return BPromise['all'](_0x13637b);}})['then'](function(_0x439ff5){if(_0x439ff5&&_0x439ff5['length']){for(var _0x1c6e74=0x0;_0x1c6e74<_0x439ff5['length'];_0x1c6e74+=0x1){for(var _0x3a675b=0x0;_0x3a675b<_0x439ff5[_0x1c6e74][_0xaef3('0x1d')];_0x3a675b+=0x1){switch(_0x1c6e74){case 0x0:joinOrLeaveQueues(_0x1ce827,_0x47b248,_0xaef3('0x3f'),_0x439ff5[_0x1c6e74][_0x3a675b]);break;case 0x1:joinOrLeaveQueues(_0x1ce827,_0x47b248,_0xaef3('0x40'),_0x439ff5[_0x1c6e74][_0x3a675b]);break;case 0x2:joinOrLeaveQueues(_0x1ce827,_0x47b248,_0xaef3('0x41'),_0x439ff5[_0x1c6e74][_0x3a675b]);break;case 0x3:joinOrLeaveQueues(_0x1ce827,_0x47b248,_0xaef3('0x42'),_0x439ff5[_0x1c6e74][_0x3a675b]);break;case 0x4:joinOrLeaveQueues(_0x1ce827,_0x47b248,_0xaef3('0x43'),_0x439ff5[_0x1c6e74][_0x3a675b]);break;case 0x5:joinOrLeaveQueues(_0x1ce827,_0x47b248,'openchannel',_0x439ff5[_0x1c6e74][_0x3a675b]);break;case 0x6:joinOrLeaveQueues(_0x1ce827,_0x47b248,_0xaef3('0x44'),_0x439ff5[_0x1c6e74][_0x3a675b]);break;case 0x7:_0x1ce827[_0x47b248](util[_0xaef3('0x1b')]('telephone:%s',_0x439ff5[_0x1c6e74][_0x3a675b]['name']));break;case 0x8:_0x1ce827[_0x47b248](util[_0xaef3('0x1b')](_0xaef3('0x45'),_0x439ff5[_0x1c6e74][_0x3a675b][_0xaef3('0x5')]));break;case 0x9:_0x1ce827[_0x47b248](util[_0xaef3('0x1b')](_0xaef3('0x46'),_0x439ff5[_0x1c6e74][_0x3a675b][_0xaef3('0x9')],_0x439ff5[_0x1c6e74][_0x3a675b][_0xaef3('0x5')]));break;case 0xa:_0x1ce827[_0x47b248](util['format']('user:%s',_0x439ff5[_0x1c6e74][_0x3a675b][_0xaef3('0x5')]));break;}}}}})[_0xaef3('0x16')](function(){if(_0x47b248===_0xaef3('0x47')){var _0x121b1a=_['map'](_0x1233f3[_0xaef3('0x48')],'id');return _0x1233f3['removeChatInteractions'](_0x121b1a)[_0xaef3('0x16')](function(){for(var _0x5b2a53=0x0;_0x5b2a53<_0x121b1a[_0xaef3('0x1d')];_0x5b2a53+=0x1){_0x440d45[_0xaef3('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x121b1a[_0x5b2a53]),'UserId':Number(_0x1233f3['id'])});}});}})[_0xaef3('0x16')](function(){if(_0x47b248===_0xaef3('0x47')){var _0x448714=_[_0xaef3('0x17')](_0x1233f3[_0xaef3('0x24')],'id');return _0x1233f3[_0xaef3('0x4a')](_0x448714)[_0xaef3('0x16')](function(){for(var _0x459e95=0x0;_0x459e95<_0x448714['length'];_0x459e95+=0x1){_0x440d45['emit'](_0xaef3('0x4b'),{'MailInteractionId':Number(_0x448714[_0x459e95]),'UserId':Number(_0x1233f3['id'])});}});}})['then'](function(){if(_0x47b248===_0xaef3('0x47')){var _0x596bae=_[_0xaef3('0x17')](_0x1233f3[_0xaef3('0x4c')],'id');return _0x1233f3[_0xaef3('0x4d')](_0x596bae)[_0xaef3('0x16')](function(){for(var _0x28a1e7=0x0;_0x28a1e7<_0x596bae[_0xaef3('0x1d')];_0x28a1e7+=0x1){_0x440d45[_0xaef3('0x49')](_0xaef3('0x4e'),{'FaxInteractionId':Number(_0x596bae[_0x28a1e7]),'UserId':Number(_0x1233f3['id'])});}});}})['then'](function(){if(_0x47b248===_0xaef3('0x47')){var _0x23dd95=_[_0xaef3('0x17')](_0x1233f3[_0xaef3('0x26')],'id');return _0x1233f3[_0xaef3('0x4f')](_0x23dd95)[_0xaef3('0x16')](function(){for(var _0x8f49fe=0x0;_0x8f49fe<_0x23dd95[_0xaef3('0x1d')];_0x8f49fe+=0x1){_0x440d45['emit'](_0xaef3('0x50'),{'SmsInteractionId':Number(_0x23dd95[_0x8f49fe]),'UserId':Number(_0x1233f3['id'])});}});}})['then'](function(){if(_0x47b248===_0xaef3('0x47')){var _0x7a214e=_[_0xaef3('0x17')](_0x1233f3['OpenchannelInteractions'],'id');return _0x1233f3[_0xaef3('0x51')](_0x7a214e)[_0xaef3('0x16')](function(){for(var _0x11cd94=0x0;_0x11cd94<_0x7a214e[_0xaef3('0x1d')];_0x11cd94+=0x1){_0x440d45['emit'](_0xaef3('0x52'),{'OpenchannelInteractionId':Number(_0x7a214e[_0x11cd94]),'UserId':Number(_0x1233f3['id'])});}});}})['then'](function(){if(_0x47b248===_0xaef3('0x47')){var _0x4ba237=_[_0xaef3('0x17')](_0x1233f3[_0xaef3('0x53')],'id');return _0x1233f3[_0xaef3('0x54')](_0x4ba237)[_0xaef3('0x16')](function(){for(var _0x4f5cdd=0x0;_0x4f5cdd<_0x4ba237[_0xaef3('0x1d')];_0x4f5cdd+=0x1){_0x440d45[_0xaef3('0x49')](_0xaef3('0x55'),{'WhatsappInteractionId':Number(_0x4ba237[_0x4f5cdd]),'UserId':Number(_0x1233f3['id'])});}});}})[_0xaef3('0x56')](function(_0x110dc3){_0x1ce827[_0xaef3('0x57')](_0x110dc3);});}}function onDisconnect(_0x2e90cb,_0x141b75){joinOrLeave(_0x2e90cb,_0xaef3('0x47'),_0x141b75);}function onConnect(_0xb05f00){joinOrLeave(_0xb05f00,_0xaef3('0x58'));}exports[_0xaef3('0x59')]=function(_0x12bac3){_0x12bac3['on'](_0xaef3('0x5a'),function(_0x2a1e8b){_0x2a1e8b['setMaxListeners'](0x0);_0x2a1e8b[_0xaef3('0x5b')]=_0x2a1e8b[_0xaef3('0x5c')][_0xaef3('0x5a')][_0xaef3('0x5d')]+':'+_0x2a1e8b[_0xaef3('0x5c')][_0xaef3('0x5a')][_0xaef3('0x5e')];_0x2a1e8b[_0xaef3('0x5f')]=new Date();_0x2a1e8b[_0xaef3('0x57')]=function(_0x34230a){console[_0xaef3('0x57')]('SocketIO\x20'+_0x2a1e8b[_0xaef3('0x60')][_0xaef3('0x5')]+'['+_0x2a1e8b[_0xaef3('0x5b')]+']',_0x34230a);};_0x2a1e8b['on'](_0xaef3('0x61'),function(){onDisconnect(_0x2a1e8b,_0x12bac3);_0x2a1e8b[_0xaef3('0x57')](_0xaef3('0x62'));});onConnect(_0x2a1e8b);_0x2a1e8b[_0xaef3('0x57')]('CONNECTED');});}; \ No newline at end of file +var _0x0047=['request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','name','Agents','User','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','where','role','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','voice:outbound','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','map','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','log','join','default','connection','setMaxListeners','address','remoteAddress'];(function(_0x4a81f4,_0x3e7b7f){var _0x3119d7=function(_0x277f35){while(--_0x277f35){_0x4a81f4['push'](_0x4a81f4['shift']());}};_0x3119d7(++_0x3e7b7f);}(_0x0047,0x69));var _0x7004=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x0047[_0x19115e];return _0x45bbd4;};'use strict';var _=require(_0x7004('0x0'));var util=require(_0x7004('0x1'));var BPromise=require('bluebird');var db=require(_0x7004('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7004('0x3')],'include':[{'as':_0x7004('0x4'),'model':db[_0x7004('0x5')],'attributes':['id',_0x7004('0x3'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7004('0x3')],'where':{'role':_0x7004('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7004('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x7004('0x3')],'where':{'role':_0x7004('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7004('0x3'),_0x7004('0x8')],'where':{'type':_0x7004('0x9')}};function getAssociatedResources(_0x3c09e5,_0x17f526,_0x746319){return db[_0x7004('0xa')][_0x7004('0xb')]({'where':{'name':_0x3c09e5,'userProfileId':_0x17f526},'raw':!![]})[_0x7004('0xc')](function(_0xb6e356){if(_0xb6e356){if(_0xb6e356[_0x7004('0xd')]){switch(_0x3c09e5){case _0x7004('0xe'):case _0x7004('0xf'):case _0x7004('0x10'):case _0x7004('0x11'):case _0x7004('0x12'):case'OpenchannelQueues':case _0x7004('0x13'):return db[_0x746319][_0x7004('0x14')](queryQueues);case _0x7004('0x15'):return db[_0x746319][_0x7004('0x14')](queryTelephones);case _0x7004('0x16'):return db[_0x746319]['findAll'](queryTrunks);case _0x7004('0x17'):return db[_0x746319][_0x7004('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x7004('0x14')]({'attributes':[_0x7004('0x18')],'where':{'sectionId':_0xb6e356['id']},'raw':!![]})[_0x7004('0xc')](function(_0x58ed62){if(_0x58ed62){var _0x3288ae={'where':{'id':_['map'](_0x58ed62,_0x7004('0x18'))},'raw':!![]};switch(_0x746319){case _0x7004('0x5'):_0x3288ae[_0x7004('0x19')][_0x7004('0x1a')]=_0x7004('0x6');break;case'Campaign':_0x3288ae[_0x7004('0x19')][_0x7004('0x8')]=_0x7004('0x9');break;}return db[_0x746319][_0x7004('0x14')](_0x3288ae);}else{return[];}});}}else{return[];}})[_0x7004('0xc')](function(_0x2747e9){return _0x2747e9;});}function joinOrLeaveQueues(_0x5f29c0,_0x2f4ec2,_0x236953,_0x2058ec){_0x5f29c0[_0x2f4ec2](util[_0x7004('0x1b')](_0x7004('0x1c'),_0x236953,_0x2058ec[_0x7004('0x3')]));if(_0x2058ec[_0x7004('0x4')]){for(var _0x2ade13=0x0;_0x2ade13<_0x2058ec[_0x7004('0x4')][_0x7004('0x1d')];_0x2ade13+=0x1){_0x5f29c0[_0x2f4ec2](util[_0x7004('0x1b')](_0x7004('0x1e'),_0x2058ec[_0x7004('0x4')][_0x2ade13]['name']));}}}function joinOrLeave(_0x4bd6d1,_0x4cca7f,_0x57dc42){var _0x2e98d8;if(_0x4bd6d1[_0x7004('0x1f')]['query']['id']){db[_0x7004('0x5')][_0x7004('0x20')]({'attributes':['id',_0x7004('0x3'),_0x7004('0x1a'),_0x7004('0x21')],'where':{'id':_0x4bd6d1[_0x7004('0x1f')]['query']['id']},'include':[{'model':db[_0x7004('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x23')],'as':_0x7004('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x25')],'as':_0x7004('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x27')],'as':_0x7004('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x2a')],'as':_0x7004('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x7004('0xc')](function(_0x136817){if(_0x136817){_0x2e98d8=_0x136817;_0x4bd6d1[_0x4cca7f](util[_0x7004('0x1b')](_0x7004('0x1e'),_0x136817[_0x7004('0x3')]));var _0x3e033a=[];switch(_0x136817[_0x7004('0x1a')]){case _0x7004('0x2c'):_0x4bd6d1[_0x4cca7f](_0x7004('0x2d'));_0x4bd6d1[_0x4cca7f]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x7004('0x2e'))){delete queryQueues[_0x7004('0x2e')];}_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x30')][_0x7004('0x14')](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x31')][_0x7004('0x14')](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x32')][_0x7004('0x14')](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x33')][_0x7004('0x14')](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x34')]['findAll'](queryQueues));_0x3e033a['push'](db[_0x7004('0x35')]['findAll'](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x36')]['findAll'](queryQueues));_0x3e033a['push'](db['User'][_0x7004('0x14')](queryTelephones));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x37')][_0x7004('0x14')](queryTrunks));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x38')][_0x7004('0x14')](queryCampaigns));_0x3e033a['push'](db[_0x7004('0x5')]['findAll'](queryAgents));break;case'user':_0x4bd6d1[_0x4cca7f](_0x7004('0x2d'));_0x4bd6d1[_0x4cca7f](_0x7004('0x39'));_0x3e033a[_0x7004('0x2f')](getAssociatedResources(_0x7004('0xe'),_0x136817[_0x7004('0x21')],_0x7004('0x30')));_0x3e033a['push'](getAssociatedResources(_0x7004('0xf'),_0x136817['userProfileId'],_0x7004('0x31')));_0x3e033a[_0x7004('0x2f')](getAssociatedResources('FaxQueues',_0x136817['userProfileId'],_0x7004('0x32')));_0x3e033a[_0x7004('0x2f')](getAssociatedResources(_0x7004('0x11'),_0x136817[_0x7004('0x21')],_0x7004('0x33')));_0x3e033a[_0x7004('0x2f')](getAssociatedResources(_0x7004('0x12'),_0x136817[_0x7004('0x21')],_0x7004('0x34')));_0x3e033a['push'](getAssociatedResources(_0x7004('0x3a'),_0x136817[_0x7004('0x21')],_0x7004('0x35')));_0x3e033a['push'](getAssociatedResources(_0x7004('0x13'),_0x136817['userProfileId'],'WhatsappQueue'));_0x3e033a[_0x7004('0x2f')](getAssociatedResources(_0x7004('0x15'),_0x136817[_0x7004('0x21')],'User'));_0x3e033a['push'](getAssociatedResources('Trunks',_0x136817[_0x7004('0x21')],_0x7004('0x37')));_0x3e033a['push'](getAssociatedResources(_0x7004('0x17'),_0x136817[_0x7004('0x21')],_0x7004('0x38')));_0x3e033a['push'](db[_0x7004('0x5')][_0x7004('0x14')](queryAgents));break;case _0x7004('0x7'):_0x4bd6d1[_0x4cca7f](_0x7004('0x2d'));_0x4bd6d1[_0x4cca7f](_0x7004('0x39'));_0x3e033a['push'](_0x136817[_0x7004('0x3b')]({'attributes':['id','name']}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x3c')]({'attributes':['id',_0x7004('0x3')]}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x3d')]({'attributes':['id',_0x7004('0x3')]}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x3e')]({'attributes':['id','name']}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x3f')]({'attributes':['id',_0x7004('0x3')]}));_0x3e033a[_0x7004('0x2f')](_0x136817['getOpenchannelQueues']({'attributes':['id',_0x7004('0x3')]}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x40')]({'attributes':['id',_0x7004('0x3')]}));break;}return BPromise['all'](_0x3e033a);}})[_0x7004('0xc')](function(_0x5bab21){if(_0x5bab21&&_0x5bab21[_0x7004('0x1d')]){for(var _0x10189a=0x0;_0x10189a<_0x5bab21[_0x7004('0x1d')];_0x10189a+=0x1){for(var _0x5ceb08=0x0;_0x5ceb08<_0x5bab21[_0x10189a][_0x7004('0x1d')];_0x5ceb08+=0x1){switch(_0x10189a){case 0x0:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x41'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x1:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x42'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x2:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x43'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x3:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x44'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x4:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x45'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x5:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,'openchannel',_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x6:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x46'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x7:_0x4bd6d1[_0x4cca7f](util[_0x7004('0x1b')](_0x7004('0x47'),_0x5bab21[_0x10189a][_0x5ceb08][_0x7004('0x3')]));break;case 0x8:_0x4bd6d1[_0x4cca7f](util[_0x7004('0x1b')](_0x7004('0x48'),_0x5bab21[_0x10189a][_0x5ceb08][_0x7004('0x3')]));break;case 0x9:_0x4bd6d1[_0x4cca7f](util[_0x7004('0x1b')](_0x7004('0x49'),_0x5bab21[_0x10189a][_0x5ceb08][_0x7004('0x8')],_0x5bab21[_0x10189a][_0x5ceb08][_0x7004('0x3')]));break;case 0xa:_0x4bd6d1[_0x4cca7f](util['format'](_0x7004('0x1e'),_0x5bab21[_0x10189a][_0x5ceb08]['name']));break;}}}}})['then'](function(){if(_0x4cca7f===_0x7004('0x4a')){var _0x3e8e4c=_['map'](_0x2e98d8['ChatInteractions'],'id');return _0x2e98d8[_0x7004('0x4b')](_0x3e8e4c)[_0x7004('0xc')](function(){for(var _0x53af94=0x0;_0x53af94<_0x3e8e4c[_0x7004('0x1d')];_0x53af94+=0x1){_0x57dc42['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x3e8e4c[_0x53af94]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f===_0x7004('0x4a')){var _0x37a141=_[_0x7004('0x4c')](_0x2e98d8[_0x7004('0x24')],'id');return _0x2e98d8['removeMailInteractions'](_0x37a141)['then'](function(){for(var _0x31f1a4=0x0;_0x31f1a4<_0x37a141[_0x7004('0x1d')];_0x31f1a4+=0x1){_0x57dc42[_0x7004('0x4d')](_0x7004('0x4e'),{'MailInteractionId':Number(_0x37a141[_0x31f1a4]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f==='leave'){var _0xe24989=_[_0x7004('0x4c')](_0x2e98d8[_0x7004('0x26')],'id');return _0x2e98d8[_0x7004('0x4f')](_0xe24989)[_0x7004('0xc')](function(){for(var _0x143d4f=0x0;_0x143d4f<_0xe24989['length'];_0x143d4f+=0x1){_0x57dc42['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xe24989[_0x143d4f]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f===_0x7004('0x4a')){var _0x6f8f8b=_[_0x7004('0x4c')](_0x2e98d8[_0x7004('0x28')],'id');return _0x2e98d8[_0x7004('0x50')](_0x6f8f8b)['then'](function(){for(var _0x19c371=0x0;_0x19c371<_0x6f8f8b[_0x7004('0x1d')];_0x19c371+=0x1){_0x57dc42[_0x7004('0x4d')](_0x7004('0x51'),{'SmsInteractionId':Number(_0x6f8f8b[_0x19c371]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f===_0x7004('0x4a')){var _0x50619e=_['map'](_0x2e98d8[_0x7004('0x52')],'id');return _0x2e98d8[_0x7004('0x53')](_0x50619e)[_0x7004('0xc')](function(){for(var _0x4a0589=0x0;_0x4a0589<_0x50619e['length'];_0x4a0589+=0x1){_0x57dc42[_0x7004('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x50619e[_0x4a0589]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f==='leave'){var _0x2207c3=_[_0x7004('0x4c')](_0x2e98d8[_0x7004('0x2b')],'id');return _0x2e98d8['removeWhatsappInteractions'](_0x2207c3)['then'](function(){for(var _0xd8764c=0x0;_0xd8764c<_0x2207c3[_0x7004('0x1d')];_0xd8764c+=0x1){_0x57dc42['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2207c3[_0xd8764c]),'UserId':Number(_0x2e98d8['id'])});}});}})['catch'](function(_0x14fb58){_0x4bd6d1[_0x7004('0x54')](_0x14fb58);});}}function onDisconnect(_0x40da75,_0x321566){joinOrLeave(_0x40da75,_0x7004('0x4a'),_0x321566);}function onConnect(_0x53b932){joinOrLeave(_0x53b932,_0x7004('0x55'));}exports[_0x7004('0x56')]=function(_0x5aa52a){_0x5aa52a['on'](_0x7004('0x57'),function(_0x24e658){_0x24e658[_0x7004('0x58')](0x0);_0x24e658[_0x7004('0x59')]=_0x24e658['request']['connection'][_0x7004('0x5a')]+':'+_0x24e658[_0x7004('0x5b')][_0x7004('0x57')][_0x7004('0x5c')];_0x24e658[_0x7004('0x5d')]=new Date();_0x24e658[_0x7004('0x54')]=function(_0x3da45d){console['log'](_0x7004('0x5e')+_0x24e658[_0x7004('0x5f')][_0x7004('0x3')]+'['+_0x24e658[_0x7004('0x59')]+']',_0x3da45d);};_0x24e658['on'](_0x7004('0x60'),function(){onDisconnect(_0x24e658,_0x5aa52a);_0x24e658[_0x7004('0x54')](_0x7004('0x61'));});onConnect(_0x24e658);_0x24e658[_0x7004('0x54')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a0c0dee..917e0bd 100644 --- a/server/config/triggers/index.js +++ b/server/config/triggers/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a65=['afterUpdate','SmsMessage','WhatsappInteraction','Whatsapp','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','User','find','name','interface','format','incomingmessage','opened','closed','SIP/%s','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','newmessage','Sms'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8a65,0x13c));var _0x58a6=function(_0x597992,_0x516580){_0x597992=_0x597992-0x0;var _0x2bea67=_0x8a65[_0x597992];return _0x2bea67;};'use strict';var util=require(_0x58a6('0x0'));var db=require(_0x58a6('0x1'))['db'];var jayson=require(_0x58a6('0x2'));var logger=require(_0x58a6('0x3'))(_0x58a6('0x4'));var client=jayson[_0x58a6('0x5')][_0x58a6('0x6')]({'port':0x232a});var triggers=[{'channel':_0x58a6('0x7'),'model':_0x58a6('0x8'),'event':_0x58a6('0x9'),'condition':_0x58a6('0xa'),'callback':afterCreate},{'channel':_0x58a6('0x7'),'model':_0x58a6('0x8'),'event':'afterUpdate','condition':_0x58a6('0xb'),'callback':afterUpdate},{'channel':_0x58a6('0x7'),'model':'ChatMessage','event':_0x58a6('0x9'),'condition':_0x58a6('0xc'),'callback':afterCreateMessage},{'channel':_0x58a6('0xd'),'model':'SmsInteraction','event':_0x58a6('0x9'),'condition':_0x58a6('0xa'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x58a6('0xe'),'condition':_0x58a6('0xb'),'callback':afterUpdate},{'channel':_0x58a6('0xd'),'model':_0x58a6('0xf'),'event':_0x58a6('0x9'),'condition':_0x58a6('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x58a6('0x10'),'event':_0x58a6('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x58a6('0x11'),'model':_0x58a6('0x10'),'event':'afterUpdate','condition':_0x58a6('0xb'),'callback':afterUpdate},{'channel':_0x58a6('0x11'),'model':'WhatsappMessage','event':_0x58a6('0x9'),'condition':_0x58a6('0xc'),'callback':afterCreateMessage},{'channel':_0x58a6('0x12'),'model':_0x58a6('0x13'),'event':'afterCreate','condition':_0x58a6('0xa'),'callback':afterCreate},{'channel':_0x58a6('0x12'),'model':_0x58a6('0x13'),'event':_0x58a6('0xe'),'condition':_0x58a6('0xb'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':'afterCreate','condition':_0x58a6('0xc'),'callback':afterCreateMessage},{'channel':_0x58a6('0x14'),'model':_0x58a6('0x15'),'event':_0x58a6('0x9'),'condition':_0x58a6('0xa'),'callback':afterCreate},{'channel':_0x58a6('0x14'),'model':_0x58a6('0x15'),'event':_0x58a6('0xe'),'condition':_0x58a6('0xb'),'callback':afterUpdate},{'channel':_0x58a6('0x14'),'model':_0x58a6('0x16'),'event':_0x58a6('0x9'),'condition':_0x58a6('0xc'),'callback':afterCreateMessage},{'channel':_0x58a6('0x17'),'model':_0x58a6('0x18'),'event':'afterCreate','condition':_0x58a6('0xa'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x58a6('0xe'),'condition':_0x58a6('0xb'),'callback':afterUpdate},{'channel':_0x58a6('0x17'),'model':_0x58a6('0x19'),'event':_0x58a6('0x9'),'condition':_0x58a6('0xc'),'callback':afterCreateMessage}];function request(_0xbe8b6d){return client[_0x58a6('0x1a')](_0x58a6('0x1b'),_0xbe8b6d)[_0x58a6('0x1c')](function(_0x44a328){logger[_0x58a6('0x1d')](_0x58a6('0x1e'),_0x58a6('0x1b'),_0x44a328);if(_0x44a328['error']){if(_0x44a328[_0x58a6('0x1f')][_0x58a6('0x20')]===0x1f4){logger[_0x58a6('0x1f')]('Trigger,\x20%s',_0x58a6('0x1b'),_0x44a328['error']);}}})[_0x58a6('0x21')](function(_0xb44c88){logger['error']('Trigger,\x20%s',_0x58a6('0x1b'),_0xb44c88);});}function afterCreateMessage(_0x376e88,_0x4c18e5){return function(_0x307077,_0x1bf979){_0x307077=_0x307077[_0x58a6('0x22')]({'plain':!![]});_0x307077[_0x58a6('0x23')]=_0x376e88;_0x307077[_0x58a6('0x24')]=_0x307077[_0x58a6('0x25')];if(_0x307077[_0x58a6('0x26')]){return db[_0x58a6('0x27')][_0x58a6('0x28')]({'where':{'id':_0x307077[_0x58a6('0x26')]},'attributes':['id',_0x58a6('0x29')],'raw':!![]})[_0x58a6('0x1c')](function(_0x1417e8){_0x307077[_0x58a6('0x2a')]=util[_0x58a6('0x2b')]('SIP/%s',_0x1417e8['name']);_0x307077[_0x58a6('0x23')]=_0x376e88;return request({'event':_0x58a6('0x2c'),'message':_0x307077});})['catch'](function(_0x575e9e){console['error'](_0x575e9e);});}else{return request({'event':'outgoingmessage','message':_0x307077});}};}function afterCreate(_0x47e81f,_0x3e1b4d){return function(_0x338fde,_0x2a3f3c){_0x338fde=_0x338fde[_0x58a6('0x22')]({'plain':!![]});_0x338fde['channel']=_0x47e81f;_0x338fde[_0x58a6('0x24')]=_0x58a6('0x2d');return request({'event':_0x3e1b4d,'message':_0x338fde});};}function afterUpdate(_0x1be865,_0x2d36e5){return function(_0x29100d,_0x5a1592){if(_0x29100d['changed'](_0x58a6('0x2e'))&&_0x29100d['closed']){_0x29100d=_0x29100d[_0x58a6('0x22')]({'plain':!![]});_0x29100d[_0x58a6('0x23')]=_0x1be865;_0x29100d[_0x58a6('0x24')]=_0x58a6('0x2e');if(_0x29100d['UserId']){return db[_0x58a6('0x27')][_0x58a6('0x28')]({'where':{'id':_0x29100d[_0x58a6('0x26')]},'attributes':['id','name'],'raw':!![]})['then'](function(_0x234e4b){_0x29100d[_0x58a6('0x2a')]=util[_0x58a6('0x2b')](_0x58a6('0x2f'),_0x234e4b[_0x58a6('0x29')]);return request({'event':_0x2d36e5,'message':_0x29100d});})[_0x58a6('0x21')](function(_0x9aaec3){console[_0x58a6('0x1f')](_0x9aaec3);});}else{return request({'event':_0x2d36e5,'message':_0x29100d});}}};}exports['default']=function(){for(var _0x547d84=0x0;_0x547d84=_0x109277[_0xe52f('0x13')]){throw Error(_0xe52f('0x14'));}_0x3079da(_0x50ed6b);})[_0xe52f('0x15')](function(_0x51cdbd){_0x22f462(_0x51cdbd);});});}; \ No newline at end of file +var _0xf314=['getChannels','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','./license/util','voice','mail','sms','whatsapp','openchannel'];(function(_0x1690e9,_0x5e215d){var _0xf0a481=function(_0x991150){while(--_0x991150){_0x1690e9['push'](_0x1690e9['shift']());}};_0xf0a481(++_0x5e215d);}(_0xf314,0x189));var _0x4f31=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xf314[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x4f31('0x0'));var channels=[_0x4f31('0x1'),_0x4f31('0x2'),'chat','fax',_0x4f31('0x3'),_0x4f31('0x4'),_0x4f31('0x5')];exports[_0x4f31('0x6')]=function(){return channels;};exports['isValidChannel']=function(_0x153cd0){_0x153cd0=_0x153cd0[_0x4f31('0x7')]();return _[_0x4f31('0x8')](channels,_0x153cd0);};exports[_0x4f31('0x9')]=function(_0xfcc447,_0x4b0d5c,_0x451bdb,_0x5cd70d){var _0x18c687={'loginAttempts':_0x4b0d5c,'blocked':_0x451bdb};if(!_[_0x4f31('0xa')](_0x5cd70d)){_0x18c687[_0x4f31('0xb')]=_0x5cd70d;}return _0xfcc447['updateAttributes'](_0x18c687);};exports['getLicense']=function(_0x46b969){return new BPromise(function(_0x5c77c3,_0x101793){var _0x3007b0=0x0;if(_0x46b969[_0x4f31('0xc')]!==_0x4f31('0xd')){_0x5c77c3(_0x46b969);}db[_0x4f31('0xe')][_0x4f31('0xf')]({'where':{'role':_0x4f31('0xd'),'online':!![],'id':{'$ne':_0x46b969['id']}}})[_0x4f31('0x10')](function(_0x191456){_0x3007b0=_0x191456;return util[_0x4f31('0x11')]();})[_0x4f31('0x10')](function(_0x1522c0){if(_0x1522c0&&_0x1522c0[_0x4f31('0x12')]&&_0x3007b0>=_0x1522c0[_0x4f31('0x12')]){throw Error(_0x4f31('0x13'));}_0x5c77c3(_0x46b969);})[_0x4f31('0x14')](function(_0x3d0551){_0x101793(_0x3d0551);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 07c05a1..40e1ad0 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7463=['render','send','exports','404','status'];(function(_0x2a1268,_0x4f93b8){var _0x2bf668=function(_0x50b8e5){while(--_0x50b8e5){_0x2a1268['push'](_0x2a1268['shift']());}};_0x2bf668(++_0x4f93b8);}(_0x7463,0x84));var _0x3746=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x7463[_0x478414];return _0x5eb6b9;};'use strict';module[_0x3746('0x0')][0x194]=function pageNotFound(_0x4dc211,_0x482f7d){var _0x5c4183=_0x3746('0x1');var _0x5cf19f=0x194;var _0x2bc5a4={'status':_0x5cf19f};_0x482f7d['status'](_0x2bc5a4[_0x3746('0x2')]);_0x482f7d[_0x3746('0x3')](_0x5c4183,{},function(_0x3a3388,_0x525925){if(_0x3a3388){return _0x482f7d[_0x3746('0x2')](_0x2bc5a4['status'])['json'](_0x2bc5a4);}_0x482f7d[_0x3746('0x4')](_0x525925);});}; \ No newline at end of file +var _0xaa74=['404','status','render','json','send'];(function(_0x106f5d,_0x15dcbd){var _0x1e42c7=function(_0x138a06){while(--_0x138a06){_0x106f5d['push'](_0x106f5d['shift']());}};_0x1e42c7(++_0x15dcbd);}(_0xaa74,0x1ea));var _0x4aa7=function(_0x5e046e,_0x28fb28){_0x5e046e=_0x5e046e-0x0;var _0x334cb3=_0xaa74[_0x5e046e];return _0x334cb3;};'use strict';module['exports'][0x194]=function pageNotFound(_0x6f3ffd,_0x44e265){var _0x3902ee=_0x4aa7('0x0');var _0x532dfc=0x194;var _0x4289af={'status':_0x532dfc};_0x44e265[_0x4aa7('0x1')](_0x4289af[_0x4aa7('0x1')]);_0x44e265[_0x4aa7('0x2')](_0x3902ee,{},function(_0x477867,_0x4be4d2){if(_0x477867){return _0x44e265['status'](_0x4289af[_0x4aa7('0x1')])[_0x4aa7('0x3')](_0x4289af);}_0x44e265[_0x4aa7('0x4')](_0x4be4d2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 22bdeac..6120b1a 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb55=['uniqueid','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','Applications','ListId','team_has_mail_queues','MailInteraction','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','restrict','List','Dashboard','Items','FaxAccountId','Exntensions','user_has_fax_accounts','TagId','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsAccount','user_has_sms_accounts','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','user_has_openchannel_accounts','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','OpenchannelQueueId','ChatWebsiteId','ProactiveActions','ChatMessage','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','chat_group_has_users','CompanyId','Hoppers','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopper','CampaignId','Automation','All','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','FaxApplications','SmsApplications','AnalyticDefaultReport','Mohs','AllCondition','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','DefaultReportId','MetricId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','SalesforceAccount','AccountId','Description','Field','VariableId','Configurations','SugarcrmConfiguration','int_desk_configuration_has_tags','Subject','ZohoField','ZendeskConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','FromId','ToId','SessionId','ProjectId','team_has_voice_queues','VoiceQueues','MailQueues','team_has_chat_queues','team_has_openchannel_queues','OpenchannelQueues','team_has_whatsapp_queues','TrunkBackup','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToUserId','ToChatQueueId','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','Queues','voice_queues_has_cm_lists','UserProfileSections','UserProfileSection','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappQueue','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','path','../config/environment','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','utf8_general_ci','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopperBlack','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','hasOne','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','CmContact','Contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','ChatQueues','FaxQueue','SmsQueue','SmsQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccounts','WhatsappAccounts','user_has_square_projects','cascade','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls'];(function(_0x3a64ab,_0x2d39cb){var _0x3fae04=function(_0x4f7a00){while(--_0x4f7a00){_0x3a64ab['push'](_0x3a64ab['shift']());}};_0x3fae04(++_0x2d39cb);}(_0xdb55,0x99));var _0x5db5=function(_0x57644f,_0xf89ef7){_0x57644f=_0x57644f-0x0;var _0x50d407=_0xdb55[_0x57644f];return _0x50d407;};'use strict';var path=require(_0x5db5('0x0'));var config=require(_0x5db5('0x1'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x5db5('0x2')]();config[_0x5db5('0x3')]=_[_0x5db5('0x4')](config['sequelize'],{'database':_0x5db5('0x5'),'username':_0x5db5('0x6'),'password':_0x5db5('0x7'),'options':{'host':_0x5db5('0x8'),'port':0xcea,'dialect':_0x5db5('0x9'),'dialectOptions':{'charset':_0x5db5('0xa')},'logging':![],'timezone':timezone[_0x5db5('0xb')](),'define':{'charset':_0x5db5('0xc'),'collate':'utf8_general_ci'}}});config[_0x5db5('0xd')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x5db5('0x5'),'username':_0x5db5('0x6'),'password':_0x5db5('0x7'),'options':{'host':_0x5db5('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x5db5('0xa')},'logging':![],'timezone':timezone[_0x5db5('0xb')](),'define':{'charset':'utf8','collate':_0x5db5('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5db5('0x3')]['database'],config[_0x5db5('0x3')][_0x5db5('0xf')],config[_0x5db5('0x3')][_0x5db5('0x10')],config[_0x5db5('0x3')][_0x5db5('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5db5('0xd')]['database'],config[_0x5db5('0xd')][_0x5db5('0xf')],config[_0x5db5('0xd')][_0x5db5('0x10')],config[_0x5db5('0xd')][_0x5db5('0x11')])};db[_0x5db5('0x12')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x13'));db[_0x5db5('0x14')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x16'));db[_0x5db5('0x17')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x18'));db[_0x5db5('0x19')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0x5db5('0x1a')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x1b'));db[_0x5db5('0x1c')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x1d'));db[_0x5db5('0x1e')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x1f'));db[_0x5db5('0x20')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x21'));db[_0x5db5('0x22')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x23'));db['VoiceMailMessage']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x24'));db['VoiceCallReport']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x25'));db[_0x5db5('0x26')]=db['sequelize'][_0x5db5('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0x5db5('0x27')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x28'));db[_0x5db5('0x29')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x5db5('0x2a')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x2b'));db[_0x5db5('0x2c')]=db['sequelize'][_0x5db5('0x15')]('../api/trunk/trunk.model');db[_0x5db5('0x2d')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x2e'));db[_0x5db5('0x2f')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x30'));db[_0x5db5('0x31')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x32'));db[_0x5db5('0x33')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/userChatQueue/userChatQueue.model');db[_0x5db5('0x34')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x35'));db[_0x5db5('0x36')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x37'));db[_0x5db5('0x38')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x39'));db[_0x5db5('0x3a')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x3b'));db[_0x5db5('0x3c')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x3d'));db['MailServerIn']=db['sequelize'][_0x5db5('0x15')]('../api/mailServerIn/mailServerIn.model');db[_0x5db5('0x3e')]=db['sequelize']['import']('../api/mailServerOut/mailServerOut.model');db[_0x5db5('0x3f')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x40'));db[_0x5db5('0x41')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x42'));db[_0x5db5('0x43')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x44'));db['MailInteraction']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x45'));db[_0x5db5('0x46')]=db['sequelize']['import'](_0x5db5('0x47'));db[_0x5db5('0x48')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x49'));db[_0x5db5('0x4a')]=db['sequelize'][_0x5db5('0x15')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize']['import'](_0x5db5('0x4b'));db[_0x5db5('0x4c')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x4d'));db[_0x5db5('0x4e')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/faxAccount/faxAccount.model');db[_0x5db5('0x4f')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x50'));db[_0x5db5('0x51')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0x5db5('0x52')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x53'));db['FaxQueue']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x54'));db[_0x5db5('0x55')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x56'));db['SmsAccount']=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x5db5('0x3')]['import'](_0x5db5('0x57'));db[_0x5db5('0x58')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0x5db5('0x59')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x5a'));db['SmsQueue']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x5b'));db['OpenchannelAccount']=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x5c'));db[_0x5db5('0x5d')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x5e'));db[_0x5db5('0x5f')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x5db5('0x60')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x61'));db[_0x5db5('0x62')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x63'));db[_0x5db5('0x64')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x65'));db[_0x5db5('0x66')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x5db5('0x67')]=db['sequelize'][_0x5db5('0x15')]('../api/chatApplication/chatApplication.model');db[_0x5db5('0x68')]=db['sequelize'][_0x5db5('0x15')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x69'));db[_0x5db5('0x6a')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x5db5('0x6b')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x6c'));db['ChatGroup']=db['sequelize']['import'](_0x5db5('0x6d'));db[_0x5db5('0x6e')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x6f'));db[_0x5db5('0x70')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x71'));db['CmContact']=db[_0x5db5('0x3')]['import'](_0x5db5('0x72'));db['CmHopper']=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/cmHopper/cmHopper.model');db[_0x5db5('0x73')]=db[_0x5db5('0x3')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x5db5('0x74')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x5db5('0x75')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x76'));db[_0x5db5('0x77')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x78'));db[_0x5db5('0x79')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x7a'));db[_0x5db5('0x7b')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x7c'));db['Automation']=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x7d'));db['CannedAnswer']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x7e'));db[_0x5db5('0x7f')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x80'));db[_0x5db5('0x81')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x82'));db['Interval']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x83'));db[_0x5db5('0x84')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x85'));db[_0x5db5('0x86')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/cdr/cdr.model');db[_0x5db5('0x87')]=db[_0x5db5('0x3')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x5db5('0x88')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x89'));db[_0x5db5('0x8a')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x8b'));db[_0x5db5('0x8c')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x8d'));db[_0x5db5('0x8e')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/template/template.model');db[_0x5db5('0x8f')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x90'));db[_0x5db5('0x91')]=db['sequelize'][_0x5db5('0x15')]('../api/variable/variable.model');db[_0x5db5('0x92')]=db['sequelize'][_0x5db5('0x15')]('../api/integration/integration.model');db[_0x5db5('0x93')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x94'));db[_0x5db5('0x95')]=db['sequelize'][_0x5db5('0x15')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x5db5('0x3')]['import'](_0x5db5('0x96'));db[_0x5db5('0x97')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x98'));db[_0x5db5('0x99')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x9a'));db[_0x5db5('0x9b')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x9c'));db[_0x5db5('0x9d')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x9e'));db['SalesforceAccount']=db['sequelize'][_0x5db5('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x5db5('0x9f')]=db['sequelize'][_0x5db5('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x5db5('0xa0')]=db['sequelize']['import'](_0x5db5('0xa1'));db[_0x5db5('0xa2')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xa3'));db['SugarcrmConfiguration']=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xa4'));db[_0x5db5('0xa5')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x5db5('0xa6')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xa7'));db[_0x5db5('0xa8')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xa9'));db[_0x5db5('0xaa')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xab'));db[_0x5db5('0xac')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xad'));db[_0x5db5('0xae')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xaf'));db['ZendeskAccount']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xb0'));db['ZendeskConfiguration']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xb1'));db[_0x5db5('0xb2')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xb3'));db[_0x5db5('0xb4')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x5db5('0xb5')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xb6'));db['FreshdeskField']=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xb7'));db['VtigerAccount']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xb8'));db[_0x5db5('0xb9')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize']['import'](_0x5db5('0xba'));db[_0x5db5('0xbb')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xbc'));db[_0x5db5('0xbd')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xbe'));db[_0x5db5('0xbf')]=db['sequelize'][_0x5db5('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0x5db5('0xc0')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xc1'));db[_0x5db5('0xc2')]=db[_0x5db5('0x3')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x5db5('0xc3')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xc4'));db[_0x5db5('0xc5')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xc6'));db[_0x5db5('0xc7')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xc8'));db[_0x5db5('0xc9')]=db['sequelize']['import'](_0x5db5('0xca'));db[_0x5db5('0x92')]=db[_0x5db5('0x3')]['import'](_0x5db5('0xcb'));db['Network']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xcc'));db[_0x5db5('0xcd')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xce'));db[_0x5db5('0xcf')]=db[_0x5db5('0x3')]['import'](_0x5db5('0xd0'));db[_0x5db5('0xd1')]=db[_0x5db5('0x3')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x5db5('0xd2')]=db['sequelize'][_0x5db5('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x5db5('0xd3')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xd4'));db[_0x5db5('0xd5')]=db[_0x5db5('0x3')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x5db5('0xd6')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xd7'));db['SquareDetailsReport']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xd8'));db[_0x5db5('0xd9')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/jscriptyProject/jscriptyProject.model');db[_0x5db5('0xda')]=db[_0x5db5('0x3')]['import'](_0x5db5('0xdb'));db[_0x5db5('0xdc')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xdd'));db[_0x5db5('0xde')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xdf'));db[_0x5db5('0xe0')]=db['sequelize']['import'](_0x5db5('0xe1'));db[_0x5db5('0xe2')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xe3'));db[_0x5db5('0xe4')]=db[_0x5db5('0x3')][_0x5db5('0x15')]('../api/team/team.model');db[_0x5db5('0xe5')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xe6'));db[_0x5db5('0xe7')]=db[_0x5db5('0x3')]['import'](_0x5db5('0xe8'));db[_0x5db5('0xe9')]=db[_0x5db5('0x3')]['import'](_0x5db5('0xea'));db[_0x5db5('0xeb')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xec'));db['Plugin']=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xed'));db['MailTransferReport']=db['sequelize']['import'](_0x5db5('0xee'));db[_0x5db5('0xef')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xf0'));db[_0x5db5('0xf1')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xf2'));db[_0x5db5('0xf3')]=db['sequelize']['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x5db5('0xf4')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xf5'));db[_0x5db5('0xf6')]=db['sequelize'][_0x5db5('0x15')]('../api/cmList/cmList.model');db[_0x5db5('0xf7')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xf8'));db[_0x5db5('0xf9')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xfa'));db['UserProfileSection']=db['sequelize'][_0x5db5('0x15')](_0x5db5('0xfb'));db[_0x5db5('0xfc')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xfd'));db['Notification']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0xfe'));db[_0x5db5('0xff')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x100'));db[_0x5db5('0x101')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x102'));db[_0x5db5('0x103')]=db['sequelize'][_0x5db5('0x15')](_0x5db5('0x104'));db[_0x5db5('0x105')]=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x106'));db[_0x5db5('0x107')]=db[_0x5db5('0x3')]['import'](_0x5db5('0x108'));db['WhatsappTransferReport']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x109'));db['WhatsappQueue']=db[_0x5db5('0x3')][_0x5db5('0x15')](_0x5db5('0x10a'));db[_0x5db5('0x10b')]=db['sequelize']['import']('../api/cloudProvider/cloudProvider.model');db[_0x5db5('0x12')][_0x5db5('0x10c')](db[_0x5db5('0x22')],{'as':_0x5db5('0x22'),'onDelete':'cascade','foreignKey':_0x5db5('0x10d')});db['User'][_0x5db5('0x10e')](db['VoiceRecording'],{'as':_0x5db5('0x10f'),'foreignKey':'UserId'});db[_0x5db5('0x12')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x5db5('0x110'),'foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x12')][_0x5db5('0x10e')](db[_0x5db5('0x19')],{'as':_0x5db5('0x111'),'onDelete':'cascade','hooks':!![]});db[_0x5db5('0x12')]['hasMany'](db[_0x5db5('0x74')],{'as':_0x5db5('0x112'),'foreignKey':'UserId'});db[_0x5db5('0x12')][_0x5db5('0x10e')](db[_0x5db5('0x75')],{'as':_0x5db5('0x113'),'foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x12')][_0x5db5('0x10e')](db[_0x5db5('0x77')],{'as':_0x5db5('0x77'),'foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x12')][_0x5db5('0x10e')](db[_0x5db5('0x5f')],{'as':_0x5db5('0x114'),'foreignKey':_0x5db5('0x10d')});db['User'][_0x5db5('0x10e')](db[_0x5db5('0x68')],{'as':_0x5db5('0x115'),'foreignKey':'UserId'});db[_0x5db5('0x12')][_0x5db5('0x10e')](db[_0x5db5('0x58')],{'as':_0x5db5('0x116'),'foreignKey':_0x5db5('0x10d')});db['User'][_0x5db5('0x10e')](db[_0x5db5('0x51')],{'as':_0x5db5('0x117'),'foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x12')][_0x5db5('0x10e')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'UserId'});db[_0x5db5('0x12')][_0x5db5('0x10e')](db['WhatsappInteraction'],{'as':_0x5db5('0x118'),'foreignKey':_0x5db5('0x10d')});db['User'][_0x5db5('0x10e')](db['Notification'],{'as':_0x5db5('0x119'),'foreignKey':_0x5db5('0x11a')});db['User'][_0x5db5('0x11b')](db[_0x5db5('0xf9')],{'as':_0x5db5('0xf9'),'foreignKey':_0x5db5('0x11c')});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x11e')],{'as':_0x5db5('0x11f'),'through':'chat_group_has_users'});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x120')],{'as':_0x5db5('0x121'),'through':'cm_user_has_contacts'});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0xf6')],{'as':_0x5db5('0x122'),'through':_0x5db5('0x123')});db[_0x5db5('0x12')]['belongsToMany'](db['Team'],{'through':_0x5db5('0x124')});db[_0x5db5('0x12')][_0x5db5('0x11d')](db['MailInteraction'],{'as':_0x5db5('0x125'),'through':_0x5db5('0x126')});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x68')],{'as':_0x5db5('0x115'),'through':_0x5db5('0x127')});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x51')],{'as':_0x5db5('0x117'),'through':_0x5db5('0x128')});db['User'][_0x5db5('0x11d')](db[_0x5db5('0x58')],{'as':_0x5db5('0x116'),'through':_0x5db5('0x129')});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x5f')],{'as':_0x5db5('0x114'),'through':_0x5db5('0x12a')});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x103')],{'as':'WhatsappInteractions','through':_0x5db5('0x12b')});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x1c')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User'][_0x5db5('0x11d')](db[_0x5db5('0x41')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db[_0x5db5('0x6b')],{'as':_0x5db5('0x12c'),'through':_0x5db5('0x33'),'required':![],'hooks':!![]});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x12d')],{'as':'FaxQueues','through':_0x5db5('0x36'),'required':![]});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x12e')],{'as':_0x5db5('0x12f'),'through':_0x5db5('0x38'),'required':![]});db['User'][_0x5db5('0x11d')](db[_0x5db5('0x62')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x5db5('0x12')][_0x5db5('0x11d')](db['WhatsappQueue'],{'as':_0x5db5('0x130'),'through':_0x5db5('0x3c'),'required':![]});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0xf6')],{'through':_0x5db5('0x123')});db['User'][_0x5db5('0x11d')](db[_0x5db5('0xf7')],{'as':_0x5db5('0x131'),'through':_0x5db5('0x132'),'required':![]});db['User'][_0x5db5('0x11d')](db[_0x5db5('0x64')],{'as':_0x5db5('0x133'),'through':_0x5db5('0x134')});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x4e')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x3f')],{'as':'MailAccounts','through':_0x5db5('0x135')});db[_0x5db5('0x12')][_0x5db5('0x11d')](db[_0x5db5('0x136')],{'as':_0x5db5('0x137'),'through':'user_has_openchannel_accounts'});db[_0x5db5('0x12')]['belongsToMany'](db['SmsAccount'],{'as':_0x5db5('0x138'),'through':'user_has_sms_accounts'});db['User'][_0x5db5('0x11d')](db[_0x5db5('0xff')],{'as':_0x5db5('0x139'),'through':'user_has_whatsapp_accounts'});db['User']['belongsToMany'](db[_0x5db5('0xde')],{'as':'SquareProjects','through':_0x5db5('0x13a')});db[_0x5db5('0x14')][_0x5db5('0x10e')](db[_0x5db5('0x19')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x5db5('0x17')][_0x5db5('0x10e')](db[_0x5db5('0x19')],{'onDelete':_0x5db5('0x13b')});db[_0x5db5('0x19')][_0x5db5('0x10e')](db[_0x5db5('0x19')],{'as':'Applications','onDelete':_0x5db5('0x13b')});db[_0x5db5('0x1a')][_0x5db5('0x11d')](db[_0x5db5('0x8a')],{'as':_0x5db5('0x13c'),'through':_0x5db5('0x13d')});db[_0x5db5('0x1c')][_0x5db5('0x10e')](db[_0x5db5('0x2f')],{'as':_0x5db5('0x13e'),'foreignKey':_0x5db5('0x13f')});db[_0x5db5('0x1c')][_0x5db5('0x10e')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x5db5('0x13f')});db['VoiceQueue']['hasMany'](db[_0x5db5('0x74')],{'as':_0x5db5('0x112'),'foreignKey':_0x5db5('0x13f')});db[_0x5db5('0x1c')][_0x5db5('0x10e')](db['CmHopperHistory'],{'as':_0x5db5('0x140'),'foreignKey':_0x5db5('0x13f')});db[_0x5db5('0x1c')]['hasMany'](db['ReportAgentPreview'],{'as':_0x5db5('0x77'),'foreignKey':'VoiceQueueId'});db[_0x5db5('0x1c')][_0x5db5('0x10e')](db[_0x5db5('0x73')],{'as':_0x5db5('0x141'),'foreignKey':_0x5db5('0x13f')});db[_0x5db5('0x1c')]['hasMany'](db[_0x5db5('0xd3')],{'as':_0x5db5('0x142'),'foreignKey':'VoiceQueueId'});db[_0x5db5('0x1c')][_0x5db5('0x11b')](db[_0x5db5('0x2c')],{'as':_0x5db5('0x2c'),'foreignKey':_0x5db5('0x143')});db['VoiceQueue'][_0x5db5('0x11b')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x5db5('0x144')});db[_0x5db5('0x1c')][_0x5db5('0x11b')](db[_0x5db5('0x145')],{'as':_0x5db5('0x145'),'foreignKey':_0x5db5('0x146')});db[_0x5db5('0x1c')]['belongsTo'](db['Pause'],{'as':_0x5db5('0x147'),'foreignKey':_0x5db5('0x148')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x5db5('0x122'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x5db5('0x11d')](db['User'],{'as':_0x5db5('0x149'),'through':'UserVoiceQueue'});db[_0x5db5('0x1c')][_0x5db5('0x11d')](db[_0x5db5('0xe4')],{'as':_0x5db5('0x14a'),'through':'team_has_voice_queues'});db[_0x5db5('0x1c')][_0x5db5('0x11d')](db['CmList'],{'as':_0x5db5('0x14b'),'through':'voice_queues_has_cm_blacklists'});db[_0x5db5('0x1e')][_0x5db5('0x11b')](db['User'],{'as':_0x5db5('0x12'),'foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x20')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':_0x5db5('0x12'),'foreignKey':'UserId'});db['VoiceMail'][_0x5db5('0x10e')](db[_0x5db5('0x14c')],{'as':_0x5db5('0x14d'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x14e'),'sourceKey':_0x5db5('0x14f')});db[_0x5db5('0x14c')]['belongsTo'](db[_0x5db5('0x22')],{'foreignKey':'mailboxuser','targetKey':_0x5db5('0x14f')});db[_0x5db5('0x150')][_0x5db5('0x10e')](db['VoiceQueueReport'],{'as':_0x5db5('0x151'),'foreignKey':_0x5db5('0x152'),'constraints':![]});db[_0x5db5('0x150')][_0x5db5('0x10e')](db[_0x5db5('0x27')],{'as':_0x5db5('0x153'),'foreignKey':_0x5db5('0x152'),'constraints':![]});db[_0x5db5('0x150')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':_0x5db5('0x12'),'foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x150')]['belongsTo'](db['CmContact'],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db[_0x5db5('0x156')][_0x5db5('0x11b')](db[_0x5db5('0x3f')],{'as':'MailAccount','foreignKey':_0x5db5('0x157')});db[_0x5db5('0x3e')][_0x5db5('0x11b')](db[_0x5db5('0x3f')],{'as':'MailAccount','foreignKey':_0x5db5('0x157')});db['MailAccount']['hasOne'](db[_0x5db5('0x156')],{'as':_0x5db5('0x158'),'onDelete':_0x5db5('0x13b')});db[_0x5db5('0x3f')]['hasOne'](db[_0x5db5('0x3e')],{'as':_0x5db5('0x159'),'onDelete':_0x5db5('0x13b')});db['MailAccount']['hasMany'](db[_0x5db5('0x7f')],{'as':_0x5db5('0x15a'),'foreignKey':_0x5db5('0x157')});db[_0x5db5('0x3f')][_0x5db5('0x10e')](db[_0x5db5('0x15b')],{'as':_0x5db5('0x15c'),'foreignKey':'MailAccountId'});db[_0x5db5('0x3f')][_0x5db5('0x10e')](db['MailMessage'],{'as':'Messages','foreignKey':_0x5db5('0x157')});db['MailAccount'][_0x5db5('0x10e')](db['MailInteraction'],{'as':_0x5db5('0x15d')});db['MailAccount'][_0x5db5('0x10e')](db['MailApplication'],{'as':_0x5db5('0x15e')});db['MailAccount'][_0x5db5('0x11b')](db[_0x5db5('0xf6')],{'as':'List','foreignKey':_0x5db5('0x15f')});db[_0x5db5('0x3f')][_0x5db5('0x11b')](db['Template'],{'as':_0x5db5('0x8e'),'foreignKey':'TemplateId'});db['MailAccount'][_0x5db5('0x11b')](db[_0x5db5('0x84')],{'as':_0x5db5('0x147'),'foreignKey':_0x5db5('0x148')});db[_0x5db5('0x3f')][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x149'),'through':_0x5db5('0x135')});db['MailQueue'][_0x5db5('0x11d')](db['User'],{'as':_0x5db5('0x149'),'through':_0x5db5('0x34')});db[_0x5db5('0x41')][_0x5db5('0x11d')](db[_0x5db5('0xe4')],{'through':_0x5db5('0x160'),'as':_0x5db5('0x14a')});db[_0x5db5('0x161')]['hasMany'](db[_0x5db5('0x46')],{'as':_0x5db5('0x14d'),'onDelete':'cascade','foreignKey':_0x5db5('0x162')});db[_0x5db5('0x161')]['belongsTo'](db[_0x5db5('0x3f')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x157')});db[_0x5db5('0x161')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db[_0x5db5('0x161')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':_0x5db5('0x164'),'foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x161')][_0x5db5('0x11d')](db[_0x5db5('0x8c')],{'through':_0x5db5('0x165'),'as':_0x5db5('0x166')});db[_0x5db5('0x161')][_0x5db5('0x11d')](db[_0x5db5('0x8c')],{'through':_0x5db5('0x165'),'as':_0x5db5('0x167')});db['MailInteraction'][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x168'),'through':_0x5db5('0x126'),'foreignKey':_0x5db5('0x162')});db['MailMessage'][_0x5db5('0x10e')](db['Attachment'],{'as':_0x5db5('0x169'),'onDelete':_0x5db5('0x13b')});db['MailMessage'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':_0x5db5('0x12')});db[_0x5db5('0x46')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'onDelete':_0x5db5('0x13b'),'as':_0x5db5('0x154')});db[_0x5db5('0x46')]['belongsTo'](db[_0x5db5('0x161')],{'as':_0x5db5('0x16a'),'foreignKey':_0x5db5('0x162')});db[_0x5db5('0x46')][_0x5db5('0x11b')](db['MailAccount'],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x157')});db[_0x5db5('0x48')][_0x5db5('0x11b')](db['User'],{'onDelete':_0x5db5('0x16b')});db['MailApplication'][_0x5db5('0x11b')](db[_0x5db5('0x41')],{'onDelete':_0x5db5('0x16b')});db[_0x5db5('0x48')][_0x5db5('0x11b')](db[_0x5db5('0x3f')],{'onDelete':_0x5db5('0x16b')});db[_0x5db5('0x48')][_0x5db5('0x11b')](db[_0x5db5('0x145')],{'onDelete':_0x5db5('0x16b'),'foreignKey':_0x5db5('0x146')});db[_0x5db5('0x48')][_0x5db5('0x11b')](db['Tag'],{'onDelete':_0x5db5('0x16b'),'foreignKey':'TagId'});db[_0x5db5('0x4a')][_0x5db5('0x11b')](db['MailAccount'],{});db['MailQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0xf6')],{'as':_0x5db5('0x16c'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0x4a')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5db5('0x4a')][_0x5db5('0x11b')](db[_0x5db5('0x161')],{});db[_0x5db5('0x4a')]['belongsTo'](db[_0x5db5('0x46')],{});db[_0x5db5('0x4a')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{});db[_0x5db5('0x4a')][_0x5db5('0x11b')](db[_0x5db5('0x41')],{});db[_0x5db5('0x16d')]['hasMany'](db[_0x5db5('0x4c')],{'as':_0x5db5('0x16e'),'onDelete':_0x5db5('0x13b')});db['FaxAccount'][_0x5db5('0x10e')](db[_0x5db5('0x7f')],{'as':'Dispositions','foreignKey':_0x5db5('0x16f')});db['FaxAccount'][_0x5db5('0x10e')](db[_0x5db5('0x15b')],{'as':_0x5db5('0x15c'),'foreignKey':_0x5db5('0x16f')});db[_0x5db5('0x4e')]['hasMany'](db[_0x5db5('0x51')],{'as':_0x5db5('0x15d')});db[_0x5db5('0x4e')][_0x5db5('0x10e')](db[_0x5db5('0x4f')],{'as':_0x5db5('0x15e')});db[_0x5db5('0x4e')][_0x5db5('0x10e')](db[_0x5db5('0x19')],{'as':_0x5db5('0x170'),'onDelete':_0x5db5('0x13b')});db[_0x5db5('0x4e')][_0x5db5('0x10e')](db[_0x5db5('0x52')],{'as':_0x5db5('0x14d')});db['FaxAccount']['belongsTo'](db['Trunk'],{'as':'Trunk'});db[_0x5db5('0x4e')]['belongsTo'](db[_0x5db5('0xf6')],{'as':_0x5db5('0x16c'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0x4e')][_0x5db5('0x11b')](db['Pause'],{'as':_0x5db5('0x147'),'foreignKey':_0x5db5('0x148')});db['FaxAccount'][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x149'),'through':_0x5db5('0x171')});db[_0x5db5('0x4f')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'onDelete':'restrict'});db[_0x5db5('0x4f')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x5db5('0x16b')});db[_0x5db5('0x4f')][_0x5db5('0x11b')](db[_0x5db5('0x4e')],{'onDelete':_0x5db5('0x16b')});db[_0x5db5('0x4f')][_0x5db5('0x11b')](db[_0x5db5('0x8c')],{'onDelete':_0x5db5('0x16b'),'foreignKey':_0x5db5('0x172')});db[_0x5db5('0x51')][_0x5db5('0x10e')](db[_0x5db5('0x52')],{'as':'Messages','onDelete':_0x5db5('0x13b'),'foreignKey':'FaxInteractionId'});db['FaxInteraction']['belongsTo'](db[_0x5db5('0x4e')],{'as':_0x5db5('0x163'),'foreignKey':'FaxAccountId'});db[_0x5db5('0x51')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db['FaxInteraction'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':'Owner','foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x51')]['belongsToMany'](db[_0x5db5('0x8c')],{'through':_0x5db5('0x173'),'as':_0x5db5('0x166')});db['FaxInteraction'][_0x5db5('0x11d')](db['Tag'],{'through':_0x5db5('0x173'),'as':_0x5db5('0x167')});db[_0x5db5('0x51')][_0x5db5('0x11d')](db['User'],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x5db5('0x174')});db[_0x5db5('0x52')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'onDelete':_0x5db5('0x13b'),'as':_0x5db5('0x12')});db['FaxMessage'][_0x5db5('0x11b')](db[_0x5db5('0x51')],{'as':_0x5db5('0x16a'),'foreignKey':'FaxInteractionId'});db[_0x5db5('0x52')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'onDelete':'cascade','as':_0x5db5('0x154')});db[_0x5db5('0x52')][_0x5db5('0x11b')](db[_0x5db5('0xeb')],{'as':_0x5db5('0xeb'),'foreignKey':'AttachmentId'});db[_0x5db5('0x52')][_0x5db5('0x11b')](db[_0x5db5('0x4e')],{'as':_0x5db5('0x163'),'foreignKey':'FaxAccountId'});db[_0x5db5('0x12d')]['belongsToMany'](db[_0x5db5('0x12')],{'as':_0x5db5('0x149'),'through':_0x5db5('0x36')});db[_0x5db5('0x12d')][_0x5db5('0x11d')](db[_0x5db5('0xe4')],{'through':_0x5db5('0x175'),'as':_0x5db5('0x14a')});db['FaxQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0x4e')],{});db['FaxQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0xf6')],{'as':_0x5db5('0x16c'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0x55')][_0x5db5('0x11b')](db['CmContact'],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db[_0x5db5('0x55')][_0x5db5('0x11b')](db[_0x5db5('0x51')],{});db['FaxQueueReport'][_0x5db5('0x11b')](db['FaxMessage'],{});db[_0x5db5('0x55')]['belongsTo'](db[_0x5db5('0x12')],{});db['FaxQueueReport'][_0x5db5('0x11b')](db['FaxQueue'],{});db['SmsAccount'][_0x5db5('0x10e')](db['Disposition'],{'as':_0x5db5('0x15a'),'foreignKey':_0x5db5('0x176')});db[_0x5db5('0x177')][_0x5db5('0x10e')](db[_0x5db5('0x15b')],{'as':_0x5db5('0x15c'),'foreignKey':_0x5db5('0x176')});db[_0x5db5('0x177')][_0x5db5('0x10e')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x5db5('0x176')});db['SmsAccount']['hasMany'](db[_0x5db5('0x58')],{'as':'Interactions'});db[_0x5db5('0x177')][_0x5db5('0x10e')](db['SmsApplication'],{'as':'Applications'});db['SmsAccount'][_0x5db5('0x11b')](db[_0x5db5('0xf6')],{'as':_0x5db5('0x16c'),'foreignKey':_0x5db5('0x15f')});db['SmsAccount'][_0x5db5('0x11b')](db[_0x5db5('0x84')],{'as':_0x5db5('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5db5('0x177')][_0x5db5('0x11d')](db['User'],{'as':'Agents','through':_0x5db5('0x178')});db[_0x5db5('0x179')]['belongsTo'](db[_0x5db5('0x12')],{'onDelete':'restrict'});db['SmsApplication'][_0x5db5('0x11b')](db['SmsQueue'],{'onDelete':_0x5db5('0x16b')});db[_0x5db5('0x179')]['belongsTo'](db[_0x5db5('0x177')],{'onDelete':_0x5db5('0x16b')});db[_0x5db5('0x179')][_0x5db5('0x11b')](db[_0x5db5('0x145')],{'onDelete':_0x5db5('0x16b'),'foreignKey':_0x5db5('0x146')});db[_0x5db5('0x179')][_0x5db5('0x11b')](db[_0x5db5('0x8c')],{'onDelete':_0x5db5('0x16b'),'foreignKey':_0x5db5('0x172')});db[_0x5db5('0x58')][_0x5db5('0x10e')](db['SmsMessage'],{'as':_0x5db5('0x14d'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x17a')});db[_0x5db5('0x58')][_0x5db5('0x11b')](db[_0x5db5('0x177')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x176')});db[_0x5db5('0x58')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db[_0x5db5('0x58')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':_0x5db5('0x164'),'foreignKey':_0x5db5('0x10d')});db['SmsInteraction'][_0x5db5('0x11d')](db[_0x5db5('0x8c')],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0x5db5('0x58')][_0x5db5('0x11d')](db[_0x5db5('0x8c')],{'through':_0x5db5('0x17b'),'as':_0x5db5('0x167')});db[_0x5db5('0x58')][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x168'),'through':'user_has_sms_interactions','foreignKey':_0x5db5('0x17a')});db[_0x5db5('0x59')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':'User'});db['SmsMessage'][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'onDelete':_0x5db5('0x13b'),'as':_0x5db5('0x154')});db[_0x5db5('0x59')]['belongsTo'](db[_0x5db5('0x58')],{'onDelete':_0x5db5('0x13b'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x5db5('0x59')][_0x5db5('0x11b')](db[_0x5db5('0x177')],{'as':'Account','foreignKey':_0x5db5('0x176')});db['SmsQueue'][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x149'),'through':_0x5db5('0x38'),'foreignKey':_0x5db5('0x17c')});db[_0x5db5('0x12e')][_0x5db5('0x11d')](db['Team'],{'through':'team_has_sms_queues','as':_0x5db5('0x14a')});db[_0x5db5('0x136')][_0x5db5('0x10e')](db[_0x5db5('0x7f')],{'as':'Dispositions','foreignKey':_0x5db5('0x17d')});db[_0x5db5('0x136')][_0x5db5('0x10e')](db['CannedAnswer'],{'as':_0x5db5('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0x5db5('0x136')]['hasMany'](db[_0x5db5('0x5f')],{'as':_0x5db5('0x15d'),'foreignKey':_0x5db5('0x17d')});db[_0x5db5('0x136')][_0x5db5('0x10e')](db[_0x5db5('0x60')],{'as':_0x5db5('0x14d'),'foreignKey':_0x5db5('0x17d')});db['OpenchannelAccount'][_0x5db5('0x10e')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x5db5('0x17d')});db[_0x5db5('0x136')][_0x5db5('0x11b')](db[_0x5db5('0xf6')],{'as':_0x5db5('0x16c'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0x136')][_0x5db5('0x11b')](db[_0x5db5('0x84')],{'as':_0x5db5('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5db5('0x136')]['belongsToMany'](db[_0x5db5('0x12')],{'as':_0x5db5('0x149'),'through':_0x5db5('0x17e')});db['OpenchannelApplication'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'onDelete':_0x5db5('0x16b')});db[_0x5db5('0x5d')][_0x5db5('0x11b')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x5db5('0x5d')]['belongsTo'](db[_0x5db5('0x136')],{'onDelete':_0x5db5('0x16b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x5db5('0x11b')](db[_0x5db5('0x145')],{'onDelete':'restrict','foreignKey':_0x5db5('0x146')});db[_0x5db5('0x5d')]['belongsTo'](db[_0x5db5('0x8c')],{'onDelete':_0x5db5('0x16b'),'foreignKey':_0x5db5('0x172')});db[_0x5db5('0x5f')][_0x5db5('0x10e')](db['OpenchannelMessage'],{'as':_0x5db5('0x14d'),'onDelete':_0x5db5('0x13b'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction']['belongsTo'](db[_0x5db5('0x136')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x17d')});db[_0x5db5('0x5f')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':'Contact','foreignKey':_0x5db5('0x155')});db['OpenchannelInteraction'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':_0x5db5('0x164'),'foreignKey':'UserId'});db[_0x5db5('0x5f')][_0x5db5('0x11d')](db['Tag'],{'through':_0x5db5('0x17f'),'as':_0x5db5('0x166')});db[_0x5db5('0x5f')][_0x5db5('0x11d')](db[_0x5db5('0x8c')],{'through':_0x5db5('0x17f'),'as':_0x5db5('0x167')});db[_0x5db5('0x5f')][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x168'),'through':_0x5db5('0x12a'),'foreignKey':_0x5db5('0x180')});db['OpenchannelMessage'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'onDelete':_0x5db5('0x13b'),'as':_0x5db5('0x12')});db[_0x5db5('0x60')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'onDelete':_0x5db5('0x13b'),'as':_0x5db5('0x154')});db['OpenchannelMessage'][_0x5db5('0x11b')](db[_0x5db5('0x5f')],{'onDelete':'cascade','as':_0x5db5('0x16a'),'foreignKey':_0x5db5('0x180')});db[_0x5db5('0x60')][_0x5db5('0x11b')](db['Attachment'],{'as':_0x5db5('0xeb'),'foreignKey':_0x5db5('0x181')});db[_0x5db5('0x60')][_0x5db5('0x11b')](db[_0x5db5('0x136')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x17d')});db[_0x5db5('0x62')]['belongsToMany'](db[_0x5db5('0x12')],{'as':_0x5db5('0x149'),'through':_0x5db5('0x3a'),'foreignKey':_0x5db5('0x182')});db[_0x5db5('0x62')][_0x5db5('0x11d')](db['Team'],{'through':'team_has_openchannel_queues','as':_0x5db5('0x14a')});db[_0x5db5('0x64')][_0x5db5('0x10e')](db[_0x5db5('0x7f')],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db[_0x5db5('0x64')][_0x5db5('0x10e')](db[_0x5db5('0x15b')],{'as':_0x5db5('0x15c'),'foreignKey':_0x5db5('0x183')});db[_0x5db5('0x64')][_0x5db5('0x10e')](db[_0x5db5('0x6e')],{'as':_0x5db5('0x184')});db[_0x5db5('0x64')][_0x5db5('0x10e')](db[_0x5db5('0x68')],{'as':'Interactions'});db[_0x5db5('0x64')][_0x5db5('0x10e')](db['ChatApplication'],{'as':_0x5db5('0x15e')});db[_0x5db5('0x64')]['hasMany'](db[_0x5db5('0x185')],{'as':_0x5db5('0x14d')});db['ChatWebsite'][_0x5db5('0x11b')](db[_0x5db5('0xf6')],{'as':'List','foreignKey':_0x5db5('0x15f')});db[_0x5db5('0x64')][_0x5db5('0x11b')](db[_0x5db5('0x145')],{'as':_0x5db5('0x145'),'foreignKey':_0x5db5('0x146')});db[_0x5db5('0x64')][_0x5db5('0x11b')](db[_0x5db5('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0x5db5('0x148')});db[_0x5db5('0x64')][_0x5db5('0x11d')](db['User'],{'as':'Agents','through':_0x5db5('0x134')});db[_0x5db5('0x66')][_0x5db5('0x11b')](db['OpenchannelAccount'],{});db[_0x5db5('0x66')][_0x5db5('0x11b')](db[_0x5db5('0xf6')],{'as':_0x5db5('0x16c'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0x66')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db['OpenchannelQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0x5f')],{});db[_0x5db5('0x66')][_0x5db5('0x11b')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x5db5('0x11b')](db['User'],{});db['OpenchannelQueueReport'][_0x5db5('0x11b')](db['OpenchannelQueue'],{});db['ChatApplication']['belongsTo'](db[_0x5db5('0x12')],{'as':_0x5db5('0x186'),'foreignKey':_0x5db5('0x10d'),'onDelete':'restrict'});db[_0x5db5('0x67')][_0x5db5('0x11b')](db[_0x5db5('0x6b')],{'as':_0x5db5('0x187'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x5db5('0x67')]['belongsTo'](db['ChatWebsite'],{'as':_0x5db5('0x188'),'foreignKey':_0x5db5('0x183'),'onDelete':'restrict'});db[_0x5db5('0x67')]['belongsTo'](db['Tag'],{'onDelete':_0x5db5('0x16b'),'foreignKey':_0x5db5('0x172')});db[_0x5db5('0x68')][_0x5db5('0x10e')](db[_0x5db5('0x185')],{'as':_0x5db5('0x14d'),'onDelete':'cascade','foreignKey':_0x5db5('0x189')});db[_0x5db5('0x68')][_0x5db5('0x11b')](db['ChatWebsite'],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x183')});db[_0x5db5('0x68')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db[_0x5db5('0x68')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':_0x5db5('0x164'),'foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x68')]['belongsToMany'](db[_0x5db5('0x8c')],{'through':_0x5db5('0x18a'),'as':_0x5db5('0x166')});db[_0x5db5('0x68')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x5db5('0x167')});db[_0x5db5('0x68')][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x168'),'through':_0x5db5('0x127'),'foreignKey':'ChatInteractionId'});db[_0x5db5('0x185')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'onDelete':_0x5db5('0x13b'),'as':'User'});db[_0x5db5('0x185')][_0x5db5('0x11b')](db['CmContact'],{'onDelete':'cascade','as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db['ChatMessage']['belongsTo'](db[_0x5db5('0x68')],{'onDelete':_0x5db5('0x13b'),'as':_0x5db5('0x16a'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x5db5('0x11b')](db[_0x5db5('0xeb')],{'as':_0x5db5('0xeb'),'foreignKey':_0x5db5('0x181')});db[_0x5db5('0x185')]['belongsTo'](db['ChatWebsite'],{'as':_0x5db5('0x163'),'foreignKey':'ChatWebsiteId'});db[_0x5db5('0x6a')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'onDelete':_0x5db5('0x13b'),'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db['ChatOfflineMessage']['belongsTo'](db[_0x5db5('0x64')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x183')});db['ChatQueue']['belongsToMany'](db[_0x5db5('0x12')],{'as':'Agents','through':_0x5db5('0x33'),'hooks':!![]});db['ChatQueue'][_0x5db5('0x11d')](db[_0x5db5('0xe4')],{'through':'team_has_chat_queues','as':_0x5db5('0x14a')});db['ChatGroup'][_0x5db5('0x10e')](db['ChatInternalMessage'],{'as':_0x5db5('0x14d'),'foreignKey':_0x5db5('0x18b'),'onDelete':_0x5db5('0x13b')});db['ChatGroup'][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':'Members','through':_0x5db5('0x18c')});db[_0x5db5('0x6e')]['belongsTo'](db[_0x5db5('0x64')],{'as':_0x5db5('0x188'),'foreignKey':_0x5db5('0x183')});db[_0x5db5('0x70')]['hasMany'](db[_0x5db5('0x120')],{'as':_0x5db5('0x121'),'foreignKey':_0x5db5('0x18d')});db['CmContact'][_0x5db5('0x10e')](db['CmHopper'],{'as':_0x5db5('0x18e'),'foreignKey':'ContactId'});db[_0x5db5('0x120')][_0x5db5('0x10e')](db[_0x5db5('0x74')],{'as':_0x5db5('0x112'),'foreignKey':_0x5db5('0x155')});db[_0x5db5('0x120')]['hasMany'](db[_0x5db5('0x75')],{'as':'HopperHistories','foreignKey':_0x5db5('0x155')});db[_0x5db5('0x120')]['hasMany'](db[_0x5db5('0x77')],{'as':_0x5db5('0x77'),'foreignKey':'ContactId'});db[_0x5db5('0x120')][_0x5db5('0x10e')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x5db5('0x155')});db[_0x5db5('0x120')][_0x5db5('0x10e')](db[_0x5db5('0x5f')],{'as':_0x5db5('0x114'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x5db5('0x120')][_0x5db5('0x10e')](db['ChatInteraction'],{'as':_0x5db5('0x115'),'foreignKey':_0x5db5('0x155'),'onDelete':_0x5db5('0x16b')});db[_0x5db5('0x120')][_0x5db5('0x10e')](db[_0x5db5('0x58')],{'as':_0x5db5('0x116'),'foreignKey':'ContactId','onDelete':_0x5db5('0x16b')});db[_0x5db5('0x120')][_0x5db5('0x10e')](db[_0x5db5('0x51')],{'as':'FaxInteractions','foreignKey':_0x5db5('0x155'),'onDelete':_0x5db5('0x16b')});db['CmContact'][_0x5db5('0x10e')](db[_0x5db5('0x161')],{'as':_0x5db5('0x125'),'foreignKey':'ContactId','onDelete':_0x5db5('0x16b')});db[_0x5db5('0x120')][_0x5db5('0x11b')](db[_0x5db5('0x70')],{'as':_0x5db5('0x18f'),'foreignKey':_0x5db5('0x18d')});db[_0x5db5('0x120')]['belongsTo'](db[_0x5db5('0xf6')],{'as':'List','foreignKey':_0x5db5('0x15f'),'onDelete':_0x5db5('0x13b')});db[_0x5db5('0x120')][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x168'),'through':_0x5db5('0x190')});db[_0x5db5('0x120')]['belongsToMany'](db[_0x5db5('0x8c')],{'as':'Tags','through':_0x5db5('0x191')});db['CmContact'][_0x5db5('0x11d')](db[_0x5db5('0x8c')],{'through':_0x5db5('0x191'),'as':_0x5db5('0x167')});db[_0x5db5('0x192')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':'Contact','foreignKey':_0x5db5('0x155'),'onDelete':_0x5db5('0x13b')});db[_0x5db5('0x192')][_0x5db5('0x11b')](db[_0x5db5('0xf6')],{'as':_0x5db5('0x16c'),'foreignKey':_0x5db5('0x15f'),'onDelete':_0x5db5('0x13b')});db['CmHopper'][_0x5db5('0x11b')](db['User'],{'as':_0x5db5('0x186'),'foreignKey':_0x5db5('0x10d')});db[_0x5db5('0x192')]['belongsTo'](db['VoiceQueue'],{'as':_0x5db5('0x187'),'foreignKey':_0x5db5('0x13f'),'onDelete':'cascade'});db[_0x5db5('0x192')][_0x5db5('0x11b')](db[_0x5db5('0xe7')],{'as':_0x5db5('0xe7'),'foreignKey':_0x5db5('0x193'),'onDelete':_0x5db5('0x13b')});db[_0x5db5('0x192')][_0x5db5('0x11b')](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db[_0x5db5('0x73')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155'),'onDelete':_0x5db5('0x13b')});db[_0x5db5('0x73')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x5db5('0x15f'),'onDelete':_0x5db5('0x13b')});db['CmHopperBlack'][_0x5db5('0x11b')](db[_0x5db5('0x1c')],{'as':_0x5db5('0x187'),'foreignKey':_0x5db5('0x13f'),'onDelete':'cascade'});db[_0x5db5('0x73')]['belongsTo'](db[_0x5db5('0xe7')],{'as':'Campaign','foreignKey':_0x5db5('0x193'),'onDelete':_0x5db5('0x13b')});db[_0x5db5('0x194')][_0x5db5('0x10e')](db[_0x5db5('0x81')],{'as':{'plural':_0x5db5('0x195'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x5db5('0x13b'),'hooks':!![]});db[_0x5db5('0x194')][_0x5db5('0x10e')](db[_0x5db5('0x81')],{'as':{'plural':_0x5db5('0x196'),'singular':'OneAny'},'foreignKey':_0x5db5('0x197'),'onDelete':_0x5db5('0x13b'),'hooks':!![]});db['Automation'][_0x5db5('0x10e')](db[_0x5db5('0x7b')],{'as':_0x5db5('0x198'),'foreignKey':_0x5db5('0x199'),'onDelete':_0x5db5('0x13b'),'hooks':!![]});db['Disposition'][_0x5db5('0x10e')](db[_0x5db5('0x7f')],{'as':_0x5db5('0x15a'),'foreignKey':_0x5db5('0x19a'),'onDelete':_0x5db5('0x13b')});db[_0x5db5('0x145')]['hasMany'](db[_0x5db5('0x145')],{'as':_0x5db5('0x19b'),'foreignKey':_0x5db5('0x146'),'onDelete':_0x5db5('0x13b'),'hooks':!![],'required':![]});db[_0x5db5('0x145')][_0x5db5('0x10e')](db[_0x5db5('0x19')],{'as':_0x5db5('0x111'),'foreignKey':'IntervalId','onDelete':_0x5db5('0x16b')});db[_0x5db5('0x145')][_0x5db5('0x10e')](db[_0x5db5('0x48')],{'as':'MailApplications','foreignKey':_0x5db5('0x146')});db['Interval'][_0x5db5('0x10e')](db[_0x5db5('0x67')],{'as':'ChatApplications','foreignKey':_0x5db5('0x146')});db[_0x5db5('0x145')][_0x5db5('0x10e')](db[_0x5db5('0x4f')],{'as':_0x5db5('0x19c'),'foreignKey':'IntervalId'});db[_0x5db5('0x145')][_0x5db5('0x10e')](db['SmsApplication'],{'as':_0x5db5('0x19d'),'foreignKey':'IntervalId'});db[_0x5db5('0x88')][_0x5db5('0x11b')](db['MailAccount'],{});db[_0x5db5('0x88')][_0x5db5('0x11b')](db[_0x5db5('0x19e')],{'foreignKey':'DefaultReportId'});db[_0x5db5('0x88')][_0x5db5('0x11b')](db[_0x5db5('0x95')],{'foreignKey':'CustomReportId'});db['Sound'][_0x5db5('0x11d')](db[_0x5db5('0x1a')],{'as':_0x5db5('0x19f'),'through':'moh_has_sounds','onDelete':_0x5db5('0x16b')});db[_0x5db5('0x8c')][_0x5db5('0x11d')](db[_0x5db5('0x120')],{'through':_0x5db5('0x191')});db[_0x5db5('0x8c')][_0x5db5('0x11d')](db[_0x5db5('0x68')],{'through':_0x5db5('0x18a')});db[_0x5db5('0x8c')][_0x5db5('0x11d')](db['MailInteraction'],{'through':_0x5db5('0x165')});db[_0x5db5('0x8c')][_0x5db5('0x11d')](db[_0x5db5('0x58')],{'through':'sms_interaction_has_tags'});db[_0x5db5('0x8c')]['belongsToMany'](db['FaxInteraction'],{'through':_0x5db5('0x173')});db['Tag']['belongsToMany'](db[_0x5db5('0x5f')],{'through':_0x5db5('0x17f')});db[_0x5db5('0x8c')][_0x5db5('0x11d')](db[_0x5db5('0x103')],{'through':'whatsapp_interaction_has_tags'});db[_0x5db5('0x8f')][_0x5db5('0x10e')](db[_0x5db5('0x81')],{'as':{'plural':'AllConditions','singular':_0x5db5('0x1a0')},'foreignKey':'TriggerAllId','onDelete':_0x5db5('0x13b'),'hooks':!![]});db[_0x5db5('0x8f')][_0x5db5('0x10e')](db[_0x5db5('0x81')],{'as':{'plural':'AnyConditions','singular':_0x5db5('0x1a1')},'foreignKey':_0x5db5('0x1a2'),'onDelete':_0x5db5('0x13b'),'hooks':!![]});db[_0x5db5('0x8f')][_0x5db5('0x10e')](db[_0x5db5('0x7b')],{'as':'Actions','foreignKey':_0x5db5('0x1a3'),'onDelete':_0x5db5('0x13b'),'hooks':!![]});db[_0x5db5('0x95')]['hasMany'](db[_0x5db5('0x9b')],{'as':_0x5db5('0x1a4'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1a5'),'hooks':!![]});db[_0x5db5('0x19e')][_0x5db5('0x10e')](db[_0x5db5('0x9b')],{'as':_0x5db5('0x1a4'),'onDelete':'cascade','foreignKey':_0x5db5('0x1a6')});db['AnalyticMetric'][_0x5db5('0x10e')](db[_0x5db5('0x9b')],{'as':_0x5db5('0x1a4'),'onDelete':'cascade','foreignKey':_0x5db5('0x1a7')});db[_0x5db5('0x9b')][_0x5db5('0x11b')](db['AnalyticMetric'],{'foreignKey':_0x5db5('0x1a7')});db['SalesforceAccount'][_0x5db5('0x10e')](db[_0x5db5('0x9f')],{'as':'Configurations','onDelete':_0x5db5('0x13b'),'foreignKey':'AccountId'});db[_0x5db5('0x9f')][_0x5db5('0x10e')](db[_0x5db5('0xa0')],{'as':_0x5db5('0x1a8'),'onDelete':'cascade','foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0x9f')][_0x5db5('0x10e')](db['SalesforceField'],{'as':_0x5db5('0x1aa'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0x9f')][_0x5db5('0x10e')](db[_0x5db5('0xa0')],{'as':_0x5db5('0x1a4'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0x9f')][_0x5db5('0x11b')](db[_0x5db5('0x1ad')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0xa0')][_0x5db5('0x10e')](db[_0x5db5('0xa0')],{'as':'Subject','foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0xa0')][_0x5db5('0x10e')](db[_0x5db5('0xa0')],{'as':_0x5db5('0x1af'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xa0')][_0x5db5('0x10e')](db[_0x5db5('0xa0')],{'as':_0x5db5('0x1b0'),'foreignKey':'FieldId'});db[_0x5db5('0xa0')][_0x5db5('0x11b')](db['Variable'],{'as':'Variable','foreignKey':_0x5db5('0x1b1')});db['SugarcrmAccount']['hasMany'](db['SugarcrmConfiguration'],{'as':_0x5db5('0x1b2'),'onDelete':'cascade','foreignKey':_0x5db5('0x1ae')});db['SugarcrmConfiguration'][_0x5db5('0x10e')](db[_0x5db5('0xa5')],{'as':_0x5db5('0x1a8'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0x1b3')][_0x5db5('0x10e')](db[_0x5db5('0xa5')],{'as':_0x5db5('0x1aa'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ab')});db['SugarcrmConfiguration']['hasMany'](db[_0x5db5('0xa5')],{'as':_0x5db5('0x1a4'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x5db5('0x1b3')][_0x5db5('0x11b')](db['SugarcrmAccount'],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0xa5')][_0x5db5('0x10e')](db['SugarcrmField'],{'as':'Subject','foreignKey':'SubjectId'});db['SugarcrmField'][_0x5db5('0x10e')](db[_0x5db5('0xa5')],{'as':_0x5db5('0x1af'),'foreignKey':_0x5db5('0x1ab')});db['SugarcrmField'][_0x5db5('0x10e')](db[_0x5db5('0xa5')],{'as':'Field','foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0xa5')]['belongsTo'](db['Variable'],{'as':_0x5db5('0x91'),'foreignKey':_0x5db5('0x1b1')});db[_0x5db5('0xa6')][_0x5db5('0x10e')](db['DeskConfiguration'],{'as':_0x5db5('0x1b2'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ae')});db['DeskConfiguration'][_0x5db5('0x10e')](db[_0x5db5('0xaa')],{'as':_0x5db5('0x1a8'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0xa8')]['hasMany'](db[_0x5db5('0xaa')],{'as':'Descriptions','onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xa8')]['hasMany'](db[_0x5db5('0xaa')],{'as':_0x5db5('0x1a4'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0xa8')]['belongsTo'](db['DeskAccount'],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0xa8')][_0x5db5('0x11d')](db[_0x5db5('0x8c')],{'through':_0x5db5('0x1b4')});db[_0x5db5('0xaa')]['hasMany'](db[_0x5db5('0xaa')],{'as':_0x5db5('0x1b5'),'foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0xaa')][_0x5db5('0x10e')](db[_0x5db5('0xaa')],{'as':_0x5db5('0x1af'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xaa')][_0x5db5('0x10e')](db[_0x5db5('0xaa')],{'as':_0x5db5('0x1b0'),'foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0xaa')][_0x5db5('0x11b')](db[_0x5db5('0x91')],{'as':_0x5db5('0x91'),'foreignKey':_0x5db5('0x1b1')});db[_0x5db5('0xac')]['hasMany'](db['ZohoConfiguration'],{'as':_0x5db5('0x1b2'),'onDelete':'cascade','foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0xae')][_0x5db5('0x10e')](db[_0x5db5('0x1b6')],{'as':_0x5db5('0x1a8'),'onDelete':'cascade','foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0xae')]['hasMany'](db['ZohoField'],{'as':_0x5db5('0x1aa'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xae')]['hasMany'](db[_0x5db5('0x1b6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0xae')][_0x5db5('0x11b')](db[_0x5db5('0xac')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x1ae')});db['ZohoField'][_0x5db5('0x10e')](db[_0x5db5('0x1b6')],{'as':_0x5db5('0x1b5'),'foreignKey':_0x5db5('0x1a9')});db['ZohoField'][_0x5db5('0x10e')](db[_0x5db5('0x1b6')],{'as':_0x5db5('0x1af'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0x1b6')][_0x5db5('0x10e')](db['ZohoField'],{'as':_0x5db5('0x1b0'),'foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0x1b6')][_0x5db5('0x11b')](db[_0x5db5('0x91')],{'as':_0x5db5('0x91'),'foreignKey':_0x5db5('0x1b1')});db['ZendeskAccount']['hasMany'](db[_0x5db5('0x1b7')],{'as':_0x5db5('0x1b2'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0x1b7')][_0x5db5('0x10e')](db[_0x5db5('0xb2')],{'as':_0x5db5('0x1a8'),'foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0x1b7')][_0x5db5('0x10e')](db[_0x5db5('0xb2')],{'as':_0x5db5('0x1aa'),'foreignKey':_0x5db5('0x1ab')});db['ZendeskConfiguration'][_0x5db5('0x10e')](db[_0x5db5('0xb2')],{'as':'Fields','foreignKey':'FieldId'});db[_0x5db5('0x1b7')][_0x5db5('0x11b')](db[_0x5db5('0x1b8')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0x1b7')][_0x5db5('0x11d')](db['Tag'],{'through':_0x5db5('0x1b9')});db[_0x5db5('0xb2')][_0x5db5('0x10e')](db[_0x5db5('0xb2')],{'as':_0x5db5('0x1b5'),'foreignKey':'SubjectId'});db[_0x5db5('0xb2')]['hasMany'](db[_0x5db5('0xb2')],{'as':_0x5db5('0x1af'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xb2')][_0x5db5('0x10e')](db[_0x5db5('0xb2')],{'as':_0x5db5('0x1b0'),'foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0xb2')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x5db5('0x1b1')});db[_0x5db5('0xb4')][_0x5db5('0x10e')](db[_0x5db5('0xb5')],{'as':_0x5db5('0x1b2'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ae')});db['FreshdeskConfiguration'][_0x5db5('0x10e')](db[_0x5db5('0x1ba')],{'as':_0x5db5('0x1a8'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0xb5')]['hasMany'](db['FreshdeskField'],{'as':_0x5db5('0x1aa'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x5db5('0xb5')][_0x5db5('0x10e')](db[_0x5db5('0x1ba')],{'as':_0x5db5('0x1a4'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ac')});db['FreshdeskConfiguration'][_0x5db5('0x11b')](db[_0x5db5('0xb4')],{'as':'Account','foreignKey':_0x5db5('0x1ae')});db['FreshdeskConfiguration'][_0x5db5('0x11d')](db[_0x5db5('0x8c')],{'through':_0x5db5('0x1bb')});db[_0x5db5('0x1ba')][_0x5db5('0x10e')](db[_0x5db5('0x1ba')],{'as':_0x5db5('0x1b5'),'foreignKey':_0x5db5('0x1a9')});db['FreshdeskField'][_0x5db5('0x10e')](db[_0x5db5('0x1ba')],{'as':_0x5db5('0x1af'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0x1ba')][_0x5db5('0x10e')](db[_0x5db5('0x1ba')],{'as':'Field','foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0x1ba')][_0x5db5('0x11b')](db[_0x5db5('0x91')],{'as':'Variable','foreignKey':_0x5db5('0x1b1')});db[_0x5db5('0x1bc')][_0x5db5('0x10e')](db[_0x5db5('0xb9')],{'as':_0x5db5('0x1b2'),'onDelete':'cascade','foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0xb9')][_0x5db5('0x10e')](db['VtigerField'],{'as':_0x5db5('0x1a8'),'foreignKey':'SubjectId'});db[_0x5db5('0xb9')][_0x5db5('0x10e')](db[_0x5db5('0x1bd')],{'as':_0x5db5('0x1aa'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xb9')][_0x5db5('0x10e')](db[_0x5db5('0x1bd')],{'as':_0x5db5('0x1a4'),'foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0xb9')][_0x5db5('0x11b')](db[_0x5db5('0x1bc')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0x1bd')][_0x5db5('0x10e')](db['VtigerField'],{'as':_0x5db5('0x1b5'),'foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0x1bd')][_0x5db5('0x10e')](db[_0x5db5('0x1bd')],{'as':_0x5db5('0x1af'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0x1bd')][_0x5db5('0x10e')](db['VtigerField'],{'as':_0x5db5('0x1b0'),'foreignKey':'FieldId'});db[_0x5db5('0x1bd')][_0x5db5('0x11b')](db[_0x5db5('0x91')],{'as':_0x5db5('0x91'),'foreignKey':_0x5db5('0x1b1')});db[_0x5db5('0xbb')][_0x5db5('0x10e')](db[_0x5db5('0xbd')],{'as':_0x5db5('0x1b2'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ae')});db['ServicenowConfiguration'][_0x5db5('0x10e')](db[_0x5db5('0xbf')],{'as':_0x5db5('0x1a8'),'foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0xbd')][_0x5db5('0x10e')](db[_0x5db5('0xbf')],{'as':_0x5db5('0x1aa'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x5db5('0x10e')](db['ServicenowField'],{'as':_0x5db5('0x1a4'),'foreignKey':_0x5db5('0x1ac')});db['ServicenowConfiguration'][_0x5db5('0x11b')](db[_0x5db5('0xbb')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0xbf')][_0x5db5('0x10e')](db[_0x5db5('0xbf')],{'as':_0x5db5('0x1b5'),'foreignKey':_0x5db5('0x1a9')});db['ServicenowField']['hasMany'](db[_0x5db5('0xbf')],{'as':_0x5db5('0x1af'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xbf')][_0x5db5('0x10e')](db[_0x5db5('0xbf')],{'as':_0x5db5('0x1b0'),'foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0xbf')]['belongsTo'](db['Variable'],{'as':_0x5db5('0x91'),'foreignKey':_0x5db5('0x1b1')});db['Dynamics365Account']['hasMany'](db[_0x5db5('0xc2')],{'as':_0x5db5('0x1b2'),'onDelete':_0x5db5('0x13b'),'foreignKey':'AccountId'});db['Dynamics365Configuration'][_0x5db5('0x10e')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0xc2')][_0x5db5('0x10e')](db[_0x5db5('0xc3')],{'as':_0x5db5('0x1aa'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xc2')][_0x5db5('0x10e')](db['Dynamics365Field'],{'as':_0x5db5('0x1a4'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0xc2')][_0x5db5('0x11b')](db[_0x5db5('0xc0')],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x1ae')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x5db5('0x1b5'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0x5db5('0x10e')](db[_0x5db5('0xc3')],{'as':_0x5db5('0x1af'),'foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xc3')]['hasMany'](db[_0x5db5('0xc3')],{'as':_0x5db5('0x1b0'),'foreignKey':_0x5db5('0x1ac')});db['Dynamics365Field'][_0x5db5('0x11b')](db[_0x5db5('0x91')],{'as':_0x5db5('0x91'),'foreignKey':_0x5db5('0x1b1')});db[_0x5db5('0xc5')][_0x5db5('0x10e')](db[_0x5db5('0xc7')],{'as':_0x5db5('0x1b2'),'onDelete':_0x5db5('0x13b'),'foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0xc7')][_0x5db5('0x10e')](db['FreshsalesField'],{'as':_0x5db5('0x1a8'),'foreignKey':'SubjectId'});db[_0x5db5('0xc7')][_0x5db5('0x10e')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x5db5('0xc7')][_0x5db5('0x10e')](db['FreshsalesField'],{'as':_0x5db5('0x1a4'),'foreignKey':_0x5db5('0x1ac')});db[_0x5db5('0xc7')][_0x5db5('0x11b')](db['FreshsalesAccount'],{'as':_0x5db5('0x163'),'foreignKey':_0x5db5('0x1ae')});db[_0x5db5('0xc9')][_0x5db5('0x10e')](db[_0x5db5('0xc9')],{'as':_0x5db5('0x1b5'),'foreignKey':_0x5db5('0x1a9')});db[_0x5db5('0xc9')]['hasMany'](db['FreshsalesField'],{'as':'Description','foreignKey':_0x5db5('0x1ab')});db[_0x5db5('0xc9')][_0x5db5('0x10e')](db['FreshsalesField'],{'as':_0x5db5('0x1b0'),'foreignKey':'FieldId'});db[_0x5db5('0xc9')][_0x5db5('0x11b')](db[_0x5db5('0x91')],{'as':_0x5db5('0x91'),'foreignKey':'VariableId'});db[_0x5db5('0xcd')]['belongsTo'](db[_0x5db5('0x64')],{});db[_0x5db5('0xcd')][_0x5db5('0x11b')](db[_0x5db5('0xf6')],{'as':_0x5db5('0x16c'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0xcd')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db['ChatQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0x68')],{});db[_0x5db5('0xcd')][_0x5db5('0x11b')](db['ChatMessage'],{});db['ChatQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{});db[_0x5db5('0xcd')][_0x5db5('0x11b')](db[_0x5db5('0x6b')],{});db['ChatInternalMessage'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'onDelete':'cascade','foreignKey':_0x5db5('0x1be')});db[_0x5db5('0xcf')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'onDelete':'cascade','foreignKey':_0x5db5('0x1bf')});db['JscriptySessionReport'][_0x5db5('0x10e')](db[_0x5db5('0xd2')],{'foreignKey':_0x5db5('0x1c0'),'onDelete':'cascade'});db[_0x5db5('0xd3')][_0x5db5('0x10e')](db[_0x5db5('0xd1')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x5db5('0xd5')][_0x5db5('0x11b')](db[_0x5db5('0x177')],{});db[_0x5db5('0xd5')][_0x5db5('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x5db5('0x15f')});db['SmsQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db[_0x5db5('0xd5')]['belongsTo'](db['SmsInteraction'],{});db['SmsQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0x59')],{});db['SmsQueueReport']['belongsTo'](db[_0x5db5('0x12')],{});db[_0x5db5('0xd5')]['belongsTo'](db[_0x5db5('0x12e')],{});db[_0x5db5('0xd9')]['hasMany'](db[_0x5db5('0xd3')],{'foreignKey':_0x5db5('0x1c1')});db['JscriptyProject'][_0x5db5('0x10e')](db[_0x5db5('0xd2')],{'foreignKey':'ProjectId'});db[_0x5db5('0xd9')][_0x5db5('0x10e')](db[_0x5db5('0xd1')],{'foreignKey':_0x5db5('0x1c1')});db[_0x5db5('0xde')][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':'Users','through':'user_has_square_projects'});db[_0x5db5('0xe4')][_0x5db5('0x11d')](db['User'],{'as':_0x5db5('0x149'),'through':_0x5db5('0x124')});db[_0x5db5('0xe4')][_0x5db5('0x11d')](db[_0x5db5('0x1c')],{'through':_0x5db5('0x1c2'),'as':_0x5db5('0x1c3')});db['Team'][_0x5db5('0x11d')](db[_0x5db5('0x41')],{'through':_0x5db5('0x160'),'as':_0x5db5('0x1c4')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0x5db5('0x1c5'),'as':_0x5db5('0x12c')});db[_0x5db5('0xe4')][_0x5db5('0x11d')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x5db5('0xe4')][_0x5db5('0x11d')](db[_0x5db5('0x12e')],{'through':'team_has_sms_queues','as':_0x5db5('0x12f')});db[_0x5db5('0xe4')][_0x5db5('0x11d')](db['OpenchannelQueue'],{'through':_0x5db5('0x1c6'),'as':_0x5db5('0x1c7')});db[_0x5db5('0xe4')][_0x5db5('0x11d')](db['WhatsappQueue'],{'through':_0x5db5('0x1c8'),'as':_0x5db5('0x130')});db[_0x5db5('0xe7')][_0x5db5('0x10e')](db[_0x5db5('0x192')],{'as':_0x5db5('0x18e'),'foreignKey':_0x5db5('0x193')});db[_0x5db5('0xe7')][_0x5db5('0x10e')](db[_0x5db5('0x74')],{'as':'HopperFinals','foreignKey':_0x5db5('0x193')});db[_0x5db5('0xe7')][_0x5db5('0x10e')](db[_0x5db5('0x75')],{'as':_0x5db5('0x140'),'foreignKey':_0x5db5('0x193')});db['Campaign'][_0x5db5('0x10e')](db[_0x5db5('0x73')],{'as':_0x5db5('0x141'),'foreignKey':_0x5db5('0x193')});db[_0x5db5('0xe7')]['belongsTo'](db[_0x5db5('0x2c')],{'as':_0x5db5('0x2c'),'foreignKey':'TrunkId'});db['Campaign'][_0x5db5('0x11b')](db[_0x5db5('0x2c')],{'as':_0x5db5('0x1c9'),'foreignKey':_0x5db5('0x144')});db[_0x5db5('0xe7')][_0x5db5('0x11b')](db[_0x5db5('0x145')],{'as':_0x5db5('0x145'),'foreignKey':_0x5db5('0x146')});db[_0x5db5('0xe7')][_0x5db5('0x11b')](db[_0x5db5('0xde')],{'as':_0x5db5('0xde'),'foreignKey':'SquareProjectId'});db[_0x5db5('0xe7')][_0x5db5('0x11d')](db[_0x5db5('0xf6')],{'as':_0x5db5('0x122'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x5db5('0x11d')](db[_0x5db5('0xf6')],{'as':'BlackLists','through':_0x5db5('0x1ca')});db['MailTransferReport'][_0x5db5('0x11b')](db[_0x5db5('0x46')],{});db[_0x5db5('0x1cb')][_0x5db5('0x11b')](db[_0x5db5('0x161')],{});db[_0x5db5('0x1cb')][_0x5db5('0x11b')](db[_0x5db5('0x3f')],{'foreignKey':_0x5db5('0x1cc'),'as':_0x5db5('0x1cd')});db[_0x5db5('0x1cb')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'foreignKey':_0x5db5('0x1ce'),'as':_0x5db5('0x1cf')});db['MailTransferReport'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'foreignKey':'ToUserId','as':_0x5db5('0x1d0')});db[_0x5db5('0x1cb')][_0x5db5('0x11b')](db[_0x5db5('0x41')],{'foreignKey':_0x5db5('0x1d1'),'as':_0x5db5('0x1d2')});db['MailTransferReport'][_0x5db5('0x11b')](db[_0x5db5('0x3f')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x5db5('0xef')]['belongsTo'](db[_0x5db5('0x185')],{});db['ChatTransferReport'][_0x5db5('0x11b')](db['ChatInteraction'],{});db[_0x5db5('0xef')][_0x5db5('0x11b')](db[_0x5db5('0x64')],{'foreignKey':'FromChatWebsiteId','as':_0x5db5('0x1cd')});db[_0x5db5('0xef')][_0x5db5('0x11b')](db['User'],{'foreignKey':_0x5db5('0x1ce'),'as':_0x5db5('0x1cf')});db[_0x5db5('0xef')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'foreignKey':_0x5db5('0x1d3'),'as':_0x5db5('0x1d0')});db['ChatTransferReport'][_0x5db5('0x11b')](db[_0x5db5('0x6b')],{'foreignKey':_0x5db5('0x1d4'),'as':_0x5db5('0x1d2')});db[_0x5db5('0xef')][_0x5db5('0x11b')](db[_0x5db5('0x64')],{'foreignKey':_0x5db5('0x1d5'),'as':_0x5db5('0x1d6')});db['FaxTransferReport'][_0x5db5('0x11b')](db['FaxMessage'],{});db[_0x5db5('0xf1')][_0x5db5('0x11b')](db['FaxInteraction'],{});db[_0x5db5('0xf1')]['belongsTo'](db[_0x5db5('0x4e')],{'foreignKey':_0x5db5('0x1d7'),'as':'FromAccount'});db[_0x5db5('0xf1')][_0x5db5('0x11b')](db['User'],{'foreignKey':_0x5db5('0x1ce'),'as':_0x5db5('0x1cf')});db[_0x5db5('0xf1')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'foreignKey':_0x5db5('0x1d3'),'as':_0x5db5('0x1d0')});db['FaxTransferReport'][_0x5db5('0x11b')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x5db5('0x1d2')});db[_0x5db5('0xf1')][_0x5db5('0x11b')](db[_0x5db5('0x4e')],{'foreignKey':_0x5db5('0x1d8'),'as':_0x5db5('0x1d6')});db[_0x5db5('0xf3')][_0x5db5('0x11b')](db[_0x5db5('0x60')],{});db[_0x5db5('0xf3')][_0x5db5('0x11b')](db[_0x5db5('0x5f')],{});db[_0x5db5('0xf3')][_0x5db5('0x11b')](db[_0x5db5('0x136')],{'foreignKey':'FromOpenchannelAccountId','as':_0x5db5('0x1cd')});db['OpenchannelTransferReport'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'foreignKey':_0x5db5('0x1ce'),'as':_0x5db5('0x1cf')});db[_0x5db5('0xf3')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x5db5('0x1d0')});db['OpenchannelTransferReport'][_0x5db5('0x11b')](db[_0x5db5('0x62')],{'foreignKey':_0x5db5('0x1d9'),'as':_0x5db5('0x1d2')});db[_0x5db5('0xf3')][_0x5db5('0x11b')](db[_0x5db5('0x136')],{'foreignKey':_0x5db5('0x1da'),'as':_0x5db5('0x1d6')});db[_0x5db5('0xf4')]['belongsTo'](db['SmsMessage'],{});db[_0x5db5('0xf4')][_0x5db5('0x11b')](db[_0x5db5('0x58')],{});db[_0x5db5('0xf4')][_0x5db5('0x11b')](db['SmsAccount'],{'foreignKey':_0x5db5('0x1db'),'as':_0x5db5('0x1cd')});db[_0x5db5('0xf4')]['belongsTo'](db[_0x5db5('0x12')],{'foreignKey':_0x5db5('0x1ce'),'as':_0x5db5('0x1cf')});db[_0x5db5('0xf4')]['belongsTo'](db[_0x5db5('0x12')],{'foreignKey':_0x5db5('0x1d3'),'as':_0x5db5('0x1d0')});db[_0x5db5('0xf4')][_0x5db5('0x11b')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x5db5('0x1d2')});db[_0x5db5('0xf4')]['belongsTo'](db[_0x5db5('0x177')],{'foreignKey':'ToSmsAccountId','as':_0x5db5('0x1d6')});db[_0x5db5('0xf6')][_0x5db5('0x10e')](db[_0x5db5('0x7f')],{'as':_0x5db5('0x15a'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0xf6')][_0x5db5('0x10e')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x5db5('0x15f')});db[_0x5db5('0xf6')][_0x5db5('0x10e')](db[_0x5db5('0x120')],{'as':_0x5db5('0x121'),'onDelete':'cascade','foreignKey':_0x5db5('0x15f')});db[_0x5db5('0xf6')]['hasMany'](db[_0x5db5('0x74')],{'as':_0x5db5('0x112'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0xf6')][_0x5db5('0x10e')](db[_0x5db5('0x75')],{'as':_0x5db5('0x113'),'foreignKey':'ListId'});db[_0x5db5('0xf6')][_0x5db5('0x10e')](db['ReportAgentPreview'],{'as':_0x5db5('0x77'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0xf6')][_0x5db5('0x11d')](db[_0x5db5('0x1c')],{'as':_0x5db5('0x1dc'),'through':_0x5db5('0x1dd')});db[_0x5db5('0xf6')][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x149'),'through':_0x5db5('0x123')});db[_0x5db5('0xf7')][_0x5db5('0x10e')](db[_0x5db5('0x19')],{'as':_0x5db5('0x111'),'onDelete':'cascade'});db[_0x5db5('0xf7')][_0x5db5('0x11d')](db['User'],{'as':_0x5db5('0x149'),'through':'user_has_voice_prefixes'});db['UserProfile'][_0x5db5('0x10e')](db[_0x5db5('0x12')],{'as':_0x5db5('0x168'),'foreignKey':_0x5db5('0x11c')});db[_0x5db5('0xf9')][_0x5db5('0x10e')](db['UserProfileSection'],{'as':_0x5db5('0x1de'),'foreignKey':'userProfileId','onDelete':_0x5db5('0x13b')});db[_0x5db5('0x1df')][_0x5db5('0x10e')](db[_0x5db5('0xfc')],{'as':'Resources','foreignKey':_0x5db5('0x1e0'),'onDelete':_0x5db5('0x13b')});db['WhatsappAccount'][_0x5db5('0x10e')](db[_0x5db5('0x7f')],{'as':'Dispositions','foreignKey':_0x5db5('0x1e1')});db['WhatsappAccount']['hasMany'](db[_0x5db5('0x15b')],{'as':_0x5db5('0x15c'),'foreignKey':_0x5db5('0x1e1')});db[_0x5db5('0xff')][_0x5db5('0x10e')](db[_0x5db5('0x105')],{'as':'Messages','foreignKey':_0x5db5('0x1e1')});db[_0x5db5('0xff')][_0x5db5('0x10e')](db[_0x5db5('0x103')],{'as':_0x5db5('0x15d')});db[_0x5db5('0xff')][_0x5db5('0x10e')](db['WhatsappApplication'],{'as':_0x5db5('0x15e')});db[_0x5db5('0xff')][_0x5db5('0x11b')](db['CmList'],{'as':_0x5db5('0x16c'),'foreignKey':_0x5db5('0x15f')});db[_0x5db5('0xff')][_0x5db5('0x11b')](db['Pause'],{'as':_0x5db5('0x147'),'foreignKey':_0x5db5('0x148')});db[_0x5db5('0xff')]['belongsToMany'](db[_0x5db5('0x12')],{'as':_0x5db5('0x149'),'through':_0x5db5('0x1e2')});db[_0x5db5('0x101')]['belongsTo'](db[_0x5db5('0x12')],{'onDelete':_0x5db5('0x16b')});db['WhatsappApplication'][_0x5db5('0x11b')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0x5db5('0x101')][_0x5db5('0x11b')](db['WhatsappAccount'],{'onDelete':_0x5db5('0x16b')});db[_0x5db5('0x101')]['belongsTo'](db[_0x5db5('0x145')],{'onDelete':_0x5db5('0x16b'),'foreignKey':_0x5db5('0x146')});db[_0x5db5('0x101')][_0x5db5('0x11b')](db[_0x5db5('0x8c')],{'onDelete':_0x5db5('0x16b'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x5db5('0x10e')](db['WhatsappMessage'],{'as':_0x5db5('0x14d'),'onDelete':_0x5db5('0x13b'),'foreignKey':'WhatsappInteractionId'});db[_0x5db5('0x103')][_0x5db5('0x11b')](db[_0x5db5('0xff')],{'as':_0x5db5('0x163'),'foreignKey':'WhatsappAccountId'});db[_0x5db5('0x103')]['belongsTo'](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db['WhatsappInteraction'][_0x5db5('0x11b')](db['User'],{'as':'Owner','foreignKey':_0x5db5('0x10d')});db['WhatsappInteraction'][_0x5db5('0x11d')](db['Tag'],{'through':_0x5db5('0x1e3'),'as':_0x5db5('0x166')});db['WhatsappInteraction'][_0x5db5('0x11d')](db[_0x5db5('0x8c')],{'through':_0x5db5('0x1e3'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x5db5('0x11d')](db[_0x5db5('0x12')],{'as':_0x5db5('0x168'),'through':_0x5db5('0x12b'),'foreignKey':'WhatsappInteractionId'});db[_0x5db5('0x105')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'as':_0x5db5('0x12')});db[_0x5db5('0x105')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'onDelete':'cascade','as':_0x5db5('0x154')});db[_0x5db5('0x105')][_0x5db5('0x11b')](db[_0x5db5('0x103')],{'onDelete':_0x5db5('0x13b'),'as':_0x5db5('0x16a'),'foreignKey':_0x5db5('0x1e4')});db[_0x5db5('0x105')][_0x5db5('0x11b')](db[_0x5db5('0xff')],{'as':'Account','foreignKey':_0x5db5('0x1e1')});db[_0x5db5('0x107')][_0x5db5('0x11b')](db[_0x5db5('0xff')],{});db['WhatsappQueueReport'][_0x5db5('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x5db5('0x15f')});db[_0x5db5('0x107')][_0x5db5('0x11b')](db[_0x5db5('0x120')],{'as':_0x5db5('0x154'),'foreignKey':_0x5db5('0x155')});db['WhatsappQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0x103')],{});db[_0x5db5('0x107')][_0x5db5('0x11b')](db[_0x5db5('0x1e5')],{});db['WhatsappQueueReport']['belongsTo'](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x5db5('0x11b')](db[_0x5db5('0x12')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappMessage'],{});db[_0x5db5('0x1e6')][_0x5db5('0x11b')](db[_0x5db5('0x103')],{});db['WhatsappTransferReport'][_0x5db5('0x11b')](db['WhatsappAccount'],{'foreignKey':_0x5db5('0x1e7'),'as':_0x5db5('0x1cd')});db[_0x5db5('0x1e6')]['belongsTo'](db[_0x5db5('0xff')],{'foreignKey':_0x5db5('0x1e8'),'as':_0x5db5('0x1d6')});db['WhatsappTransferReport'][_0x5db5('0x11b')](db[_0x5db5('0x1e5')],{'foreignKey':'ToQueueId','as':_0x5db5('0x1d2')});db[_0x5db5('0x1e6')]['belongsTo'](db[_0x5db5('0x12')],{'foreignKey':_0x5db5('0x1ce'),'as':_0x5db5('0x1cf')});db[_0x5db5('0x1e6')][_0x5db5('0x11b')](db[_0x5db5('0x12')],{'foreignKey':'ToUserId','as':_0x5db5('0x1d0')});db['WhatsappQueue']['belongsToMany'](db[_0x5db5('0x12')],{'as':_0x5db5('0x149'),'through':_0x5db5('0x3c'),'foreignKey':_0x5db5('0x1e9')});db[_0x5db5('0x1e5')][_0x5db5('0x11d')](db['Team'],{'through':_0x5db5('0x1c8'),'as':_0x5db5('0x14a')});module[_0x5db5('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xb594=['import','VoiceChanSpy','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceRecording','UserVoiceQueueRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteraction','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','FaxQueues','OpenchannelQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_fax_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','VoiceMusicOnHold','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','Contact','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Disposition','Dispositions','Interactions','Applications','List','ListId','TemplateId','user_has_mail_accounts','Agents','MailQueue','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Interaction','restrict','TagId','MailQueueReport','DashboardItem','Items','FaxAccountId','Exntensions','fax_interaction_has_tags','Users','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','Answers','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','cm_contact_has_tags','OneAll','AutomationAllId','OneAny','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','VariableId','SugarcrmConfiguration','Field','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshsalesAccount','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_mail_queues','MailQueues','ChatQueues','SmsQueues','CampaignId','HopperBlacks','SquareProjectId','Lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','utf8_general_ci','database','username','password','options','User'];(function(_0x327c12,_0x2874c9){var _0x4cd602=function(_0x3b82f4){while(--_0x3b82f4){_0x327c12['push'](_0x327c12['shift']());}};_0x4cd602(++_0x2874c9);}(_0xb594,0x1d0));var _0x4b59=function(_0x27671f,_0x449b6a){_0x27671f=_0x27671f-0x0;var _0x523bbf=_0xb594[_0x27671f];return _0x523bbf;};'use strict';var path=require('path');var config=require('../config/environment');var Sequelize=require(_0x4b59('0x0'));var _=require(_0x4b59('0x1'));var jstz=require(_0x4b59('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0x4b59('0x3')](config[_0x4b59('0x0')],{'database':_0x4b59('0x4'),'username':_0x4b59('0x5'),'password':_0x4b59('0x6'),'options':{'host':_0x4b59('0x7'),'port':0xcea,'dialect':_0x4b59('0x8'),'dialectOptions':{'charset':_0x4b59('0x9')},'logging':![],'timezone':timezone[_0x4b59('0xa')](),'define':{'charset':_0x4b59('0xb'),'collate':'utf8_general_ci'}}});config[_0x4b59('0xc')]=_['defaultsDeep'](config[_0x4b59('0xc')],{'database':_0x4b59('0x4'),'username':_0x4b59('0x5'),'password':_0x4b59('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4b59('0x8'),'dialectOptions':{'charset':_0x4b59('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x4b59('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4b59('0x0')][_0x4b59('0xe')],config['sequelize'][_0x4b59('0xf')],config[_0x4b59('0x0')][_0x4b59('0x10')],config[_0x4b59('0x0')][_0x4b59('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4b59('0xc')]['database'],config['sequelizeHistory'][_0x4b59('0xf')],config['sequelizeHistory']['password'],config[_0x4b59('0xc')]['options'])};db[_0x4b59('0x12')]=db['sequelize'][_0x4b59('0x13')]('../api/user/user.model');db[_0x4b59('0x14')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x15'));db[_0x4b59('0x16')]=db['sequelize'][_0x4b59('0x13')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x4b59('0x0')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x4b59('0x17')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x18'));db['VoiceRecording']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x4b59('0x19')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x1a'));db['VoiceMail']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/voiceMail/voiceMail.model');db[_0x4b59('0x1b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x1c'));db[_0x4b59('0x1d')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x1e'));db[_0x4b59('0x1f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x20'));db[_0x4b59('0x21')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x22'));db[_0x4b59('0x23')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x24'));db['MemberReport']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x25'));db[_0x4b59('0x26')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x27'));db[_0x4b59('0x28')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x29'));db['UserVoiceQueueRt']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x2a'));db[_0x4b59('0x2b')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x2c'));db[_0x4b59('0x2d')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x2e'));db[_0x4b59('0x2f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x30'));db[_0x4b59('0x31')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x32'));db[_0x4b59('0x33')]=db['sequelize']['import'](_0x4b59('0x34'));db[_0x4b59('0x35')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x36'));db[_0x4b59('0x37')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x4b59('0x38')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x39'));db['MailServerOut']=db['sequelize'][_0x4b59('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x4b59('0x3a')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x3b'));db['MailQueue']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/mailQueue/mailQueue.model');db[_0x4b59('0x3c')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x3d'));db[_0x4b59('0x3e')]=db['sequelize']['import'](_0x4b59('0x3f'));db[_0x4b59('0x40')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x41'));db[_0x4b59('0x42')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x43'));db['MailQueueReport']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x4b59('0x44')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x45'));db['DashboardItem']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x46'));db[_0x4b59('0x47')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x48'));db[_0x4b59('0x49')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x4a'));db[_0x4b59('0x4b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x4c'));db[_0x4b59('0x4d')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x4e'));db[_0x4b59('0x4f')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x50'));db[_0x4b59('0x51')]=db[_0x4b59('0x0')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x4b59('0x52')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/smsAccount/smsAccount.model');db[_0x4b59('0x53')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x54'));db['SmsInteraction']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x55'));db['SmsMessage']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x56'));db[_0x4b59('0x57')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x58'));db[_0x4b59('0x59')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x5a'));db[_0x4b59('0x5b')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x5c'));db['OpenchannelInteraction']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x5d'));db[_0x4b59('0x5e')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0x4b59('0x5f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x60'));db[_0x4b59('0x61')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x4b59('0x62')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x63'));db[_0x4b59('0x64')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/chatApplication/chatApplication.model');db[_0x4b59('0x65')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x66'));db[_0x4b59('0x67')]=db['sequelize'][_0x4b59('0x13')]('../api/chatMessage/chatMessage.model');db[_0x4b59('0x68')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x69'));db[_0x4b59('0x6a')]=db['sequelize'][_0x4b59('0x13')]('../api/chatQueue/chatQueue.model');db[_0x4b59('0x6b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x6c'));db[_0x4b59('0x6d')]=db['sequelize'][_0x4b59('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x4b59('0x6e')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/cmCompany/cmCompany.model');db[_0x4b59('0x6f')]=db['sequelize'][_0x4b59('0x13')]('../api/cmContact/cmContact.model');db[_0x4b59('0x70')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x71'));db['CmHopperBlack']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x4b59('0x72')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x73'));db[_0x4b59('0x74')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x75'));db[_0x4b59('0x76')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x77'));db[_0x4b59('0x78')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x79'));db[_0x4b59('0x7a')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x7b'));db[_0x4b59('0x7c')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x7d'));db[_0x4b59('0x7e')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize']['import'](_0x4b59('0x7f'));db[_0x4b59('0x80')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x81'));db['Interval']=db['sequelize'][_0x4b59('0x13')]('../api/interval/interval.model');db[_0x4b59('0x82')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/pause/pause.model');db['Cdr']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/cdr/cdr.model');db[_0x4b59('0x83')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x84'));db[_0x4b59('0x85')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x86'));db[_0x4b59('0x87')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/sound/sound.model');db[_0x4b59('0x88')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x89'));db[_0x4b59('0x8a')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/template/template.model');db[_0x4b59('0x8b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x8c'));db[_0x4b59('0x8d')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x8e'));db[_0x4b59('0x8f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x90'));db[_0x4b59('0x91')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/integrationReport/integrationReport.model');db[_0x4b59('0x92')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x4b59('0x93')]=db[_0x4b59('0x0')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x4b59('0x94')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x95'));db[_0x4b59('0x96')]=db['sequelize'][_0x4b59('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x4b59('0x97')]=db[_0x4b59('0x0')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x4b59('0x98')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x4b59('0x99')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x9a'));db[_0x4b59('0x9b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x9c'));db[_0x4b59('0x9d')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x9e'));db[_0x4b59('0x9f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xa0'));db['SugarcrmConfiguration']=db[_0x4b59('0x0')]['import'](_0x4b59('0xa1'));db[_0x4b59('0xa2')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xa3'));db[_0x4b59('0xa4')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xa5'));db[_0x4b59('0xa6')]=db['sequelize'][_0x4b59('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x4b59('0xa7')]=db[_0x4b59('0x0')]['import']('../api/intDeskField/intDeskField.model');db[_0x4b59('0xa8')]=db['sequelize'][_0x4b59('0x13')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xa9'));db[_0x4b59('0xaa')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xab'));db[_0x4b59('0xac')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xad'));db[_0x4b59('0xae')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize'][_0x4b59('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0x4b59('0xaf')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xb0'));db[_0x4b59('0xb1')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xb2'));db[_0x4b59('0xb3')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xb4'));db['VtigerAccount']=db[_0x4b59('0x0')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x4b59('0xb5')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xb6'));db[_0x4b59('0xb7')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xb8'));db[_0x4b59('0xb9')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xba'));db[_0x4b59('0xbb')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xbc'));db[_0x4b59('0xbd')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xbe'));db[_0x4b59('0xbf')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x4b59('0xc0')]=db['sequelize']['import'](_0x4b59('0xc1'));db[_0x4b59('0xc2')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xc3'));db['FreshsalesAccount']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xc4'));db[_0x4b59('0xc5')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xc6'));db[_0x4b59('0xc7')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x4b59('0x8f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x90'));db[_0x4b59('0xc8')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xc9'));db[_0x4b59('0xca')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xcb'));db[_0x4b59('0xcc')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xcd'));db[_0x4b59('0xce')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xcf'));db[_0x4b59('0xd0')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xd1'));db[_0x4b59('0xd2')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xd3'));db['SmsQueueReport']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xd4'));db['SquareReport']=db[_0x4b59('0x0')]['import'](_0x4b59('0xd5'));db[_0x4b59('0xd6')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xd7'));db[_0x4b59('0xd8')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xd9'));db[_0x4b59('0xda')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xdb'));db[_0x4b59('0xdc')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xdd'));db[_0x4b59('0xde')]=db['sequelize'][_0x4b59('0x13')]('../api/squareProject/squareProject.model');db[_0x4b59('0xdf')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xe0'));db[_0x4b59('0xe1')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xe2'));db['Team']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xe3'));db[_0x4b59('0xe4')]=db['sequelize']['import'](_0x4b59('0xe5'));db[_0x4b59('0xe6')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xe7'));db['Migration']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xe8'));db[_0x4b59('0xe9')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/attachment/attachment.model');db['Plugin']=db['sequelize'][_0x4b59('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize']['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x4b59('0xea')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xeb'));db[_0x4b59('0xec')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xed'));db[_0x4b59('0xee')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xef'));db[_0x4b59('0xf0')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x4b59('0xf1')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xf2'));db[_0x4b59('0xf3')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xf4'));db[_0x4b59('0xf5')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xf6'));db[_0x4b59('0xf7')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xf8'));db[_0x4b59('0xf9')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xfa'));db[_0x4b59('0xfb')]=db['sequelize']['import']('../api/notification/notification.model');db[_0x4b59('0xfc')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xfd'));db['WhatsappApplication']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xfe'));db[_0x4b59('0xff')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x100'));db[_0x4b59('0x101')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x102'));db['WhatsappQueueReport']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x103'));db[_0x4b59('0x104')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x105'));db[_0x4b59('0x106')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x107'));db['CloudProvider']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x108'));db[_0x4b59('0x12')][_0x4b59('0x109')](db['VoiceMail'],{'as':_0x4b59('0x10a'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x10c')});db['User'][_0x4b59('0x10d')](db[_0x4b59('0x10e')],{'as':'Recordings','foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x10f')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x16')],{'as':_0x4b59('0x110'),'onDelete':_0x4b59('0x10b'),'hooks':!![]});db[_0x4b59('0x12')][_0x4b59('0x10d')](db['CmHopperFinal'],{'as':_0x4b59('0x111'),'foreignKey':_0x4b59('0x10c')});db['User'][_0x4b59('0x10d')](db['CmHopperHistory'],{'as':_0x4b59('0x112'),'foreignKey':'UserId'});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x76')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db['User'][_0x4b59('0x10d')](db['OpenchannelInteraction'],{'as':_0x4b59('0x113'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db['ChatInteraction'],{'as':_0x4b59('0x114'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x115')],{'as':'SmsInteractions','foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')]['hasMany'](db['FaxInteraction'],{'as':_0x4b59('0x116'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x3e')],{'as':_0x4b59('0x117'),'foreignKey':'UserId'});db[_0x4b59('0x12')]['hasMany'](db[_0x4b59('0xff')],{'as':_0x4b59('0x118'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0xfb')],{'as':_0x4b59('0x119'),'foreignKey':'SenderId'});db['User'][_0x4b59('0x11a')](db[_0x4b59('0xf5')],{'as':_0x4b59('0xf5'),'foreignKey':_0x4b59('0x11b')});db['User'][_0x4b59('0x11c')](db[_0x4b59('0x6b')],{'as':_0x4b59('0x11d'),'through':_0x4b59('0x11e')});db['User'][_0x4b59('0x11c')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x11f'),'through':_0x4b59('0x120')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x121')],{'through':_0x4b59('0x122')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x3e')],{'as':_0x4b59('0x117'),'through':_0x4b59('0x123')});db['User']['belongsToMany'](db[_0x4b59('0x65')],{'as':_0x4b59('0x114'),'through':_0x4b59('0x124')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x4b')],{'as':_0x4b59('0x116'),'through':'user_has_fax_interactions'});db['User'][_0x4b59('0x11c')](db['SmsInteraction'],{'as':_0x4b59('0x125'),'through':_0x4b59('0x126')});db[_0x4b59('0x12')]['belongsToMany'](db[_0x4b59('0x127')],{'as':_0x4b59('0x113'),'through':_0x4b59('0x128')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0xff')],{'as':'WhatsappInteractions','through':_0x4b59('0x129')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['VoiceQueue'],{'as':_0x4b59('0x12a'),'through':_0x4b59('0x2b'),'required':![]});db[_0x4b59('0x12')]['belongsToMany'](db['MailQueue'],{'as':'MailQueues','through':_0x4b59('0x2f'),'required':![]});db[_0x4b59('0x12')]['belongsToMany'](db[_0x4b59('0x6a')],{'as':'ChatQueues','through':_0x4b59('0x2d'),'required':![],'hooks':!![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x4f')],{'as':_0x4b59('0x12b'),'through':'UserFaxQueue','required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x57')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x5f')],{'as':_0x4b59('0x12c'),'through':_0x4b59('0x35'),'required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x106')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0xf1')],{'through':_0x4b59('0x12d')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['VoicePrefix'],{'as':_0x4b59('0x12e'),'through':_0x4b59('0x12f'),'required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x61')],{'as':_0x4b59('0x130'),'through':'user_has_chat_websites'});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['FaxAccount'],{'as':_0x4b59('0x131'),'through':_0x4b59('0x132')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['MailAccount'],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x59')],{'as':_0x4b59('0x133'),'through':_0x4b59('0x134')});db[_0x4b59('0x12')]['belongsToMany'](db[_0x4b59('0x52')],{'as':_0x4b59('0x135'),'through':'user_has_sms_accounts'});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0xfc')],{'as':_0x4b59('0x136'),'through':_0x4b59('0x137')});db['User'][_0x4b59('0x11c')](db[_0x4b59('0xde')],{'as':'SquareProjects','through':_0x4b59('0x138')});db['VoiceChanSpy'][_0x4b59('0x10d')](db[_0x4b59('0x16')],{'as':_0x4b59('0x139'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x13a')});db[_0x4b59('0x13b')][_0x4b59('0x10d')](db[_0x4b59('0x16')],{'onDelete':'cascade'});db[_0x4b59('0x16')]['hasMany'](db[_0x4b59('0x16')],{'as':'Applications','onDelete':_0x4b59('0x10b')});db[_0x4b59('0x13c')]['belongsToMany'](db[_0x4b59('0x87')],{'as':'Sounds','through':_0x4b59('0x13d')});db['VoiceQueue'][_0x4b59('0x10d')](db[_0x4b59('0x10f')],{'as':_0x4b59('0x13e'),'foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')]['hasMany'](db[_0x4b59('0x70')],{'as':_0x4b59('0x140'),'foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')][_0x4b59('0x10d')](db['CmHopperFinal'],{'as':_0x4b59('0x111'),'foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')]['hasMany'](db['CmHopperHistory'],{'as':_0x4b59('0x141'),'foreignKey':'VoiceQueueId'});db[_0x4b59('0x17')][_0x4b59('0x10d')](db[_0x4b59('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')]['hasMany'](db[_0x4b59('0x142')],{'as':'HopperBlacks','foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')][_0x4b59('0x10d')](db['JscriptySessionReport'],{'as':_0x4b59('0x143'),'foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')][_0x4b59('0x11a')](db['Trunk'],{'as':'Trunk','foreignKey':_0x4b59('0x144')});db[_0x4b59('0x17')][_0x4b59('0x11a')](db['Trunk'],{'as':_0x4b59('0x145'),'foreignKey':_0x4b59('0x146')});db['VoiceQueue'][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'as':'Interval','foreignKey':_0x4b59('0x148')});db[_0x4b59('0x17')]['belongsTo'](db[_0x4b59('0x82')],{'as':_0x4b59('0x149'),'foreignKey':_0x4b59('0x14a')});db['VoiceQueue']['belongsToMany'](db[_0x4b59('0xf1')],{'as':'Lists','through':_0x4b59('0x14b')});db[_0x4b59('0x17')][_0x4b59('0x11c')](db['User'],{'as':'Agents','through':_0x4b59('0x2b')});db['VoiceQueue'][_0x4b59('0x11c')](db[_0x4b59('0x121')],{'as':_0x4b59('0x14c'),'through':_0x4b59('0x14d')});db[_0x4b59('0x17')][_0x4b59('0x11c')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x14e'),'through':_0x4b59('0x14f')});db['VoiceRecording'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x12'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x19')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x12'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x10a')][_0x4b59('0x10d')](db[_0x4b59('0x1b')],{'as':_0x4b59('0x150'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x151'),'sourceKey':_0x4b59('0x152')});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0x4b59('0x151'),'targetKey':_0x4b59('0x152')});db[_0x4b59('0x1d')]['hasMany'](db[_0x4b59('0x23')],{'as':'QueueCalls','foreignKey':_0x4b59('0x153'),'constraints':![]});db[_0x4b59('0x1d')][_0x4b59('0x10d')](db[_0x4b59('0x21')],{'as':'AgentReports','foreignKey':_0x4b59('0x153'),'constraints':![]});db['VoiceCallReport'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x12'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x1d')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x38')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'as':'MailAccount','foreignKey':_0x4b59('0x156')});db[_0x4b59('0x157')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'as':_0x4b59('0x3a'),'foreignKey':_0x4b59('0x156')});db[_0x4b59('0x3a')][_0x4b59('0x109')](db['MailServerIn'],{'as':_0x4b59('0x158'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x3a')][_0x4b59('0x109')](db['MailServerOut'],{'as':_0x4b59('0x159'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x3a')][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x156')});db[_0x4b59('0x3a')][_0x4b59('0x10d')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4b59('0x156')});db[_0x4b59('0x3a')]['hasMany'](db[_0x4b59('0x40')],{'as':_0x4b59('0x150'),'foreignKey':_0x4b59('0x156')});db[_0x4b59('0x3a')][_0x4b59('0x10d')](db[_0x4b59('0x3e')],{'as':_0x4b59('0x15c')});db[_0x4b59('0x3a')][_0x4b59('0x10d')](db[_0x4b59('0x42')],{'as':_0x4b59('0x15d')});db[_0x4b59('0x3a')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db['MailAccount'][_0x4b59('0x11a')](db[_0x4b59('0x8a')],{'as':'Template','foreignKey':_0x4b59('0x160')});db[_0x4b59('0x3a')][_0x4b59('0x11a')](db[_0x4b59('0x82')],{'as':_0x4b59('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4b59('0x3a')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':'Agents','through':_0x4b59('0x161')});db['MailQueue'][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x162'),'through':_0x4b59('0x2f')});db[_0x4b59('0x163')][_0x4b59('0x11c')](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db[_0x4b59('0x3e')][_0x4b59('0x10d')](db['MailMessage'],{'as':_0x4b59('0x150'),'onDelete':'cascade','foreignKey':_0x4b59('0x164')});db[_0x4b59('0x3e')]['belongsTo'](db[_0x4b59('0x3a')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x156')});db['MailInteraction'][_0x4b59('0x11a')](db['CmContact'],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x3e')]['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x166'),'foreignKey':_0x4b59('0x10c')});db['MailInteraction']['belongsToMany'](db[_0x4b59('0x88')],{'through':_0x4b59('0x167'),'as':_0x4b59('0x168')});db['MailInteraction'][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x167'),'as':_0x4b59('0x169')});db['MailInteraction'][_0x4b59('0x11c')](db['User'],{'as':'Users','through':_0x4b59('0x123'),'foreignKey':_0x4b59('0x164')});db[_0x4b59('0x40')][_0x4b59('0x10d')](db['Attachment'],{'as':'Attachments','onDelete':_0x4b59('0x10b')});db[_0x4b59('0x40')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':'User'});db[_0x4b59('0x40')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154')});db[_0x4b59('0x40')]['belongsTo'](db['MailInteraction'],{'as':_0x4b59('0x16a'),'foreignKey':'MailInteractionId'});db[_0x4b59('0x40')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'as':_0x4b59('0x165'),'foreignKey':'MailAccountId'});db[_0x4b59('0x42')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x42')]['belongsTo'](db['MailQueue'],{'onDelete':_0x4b59('0x16b')});db['MailApplication'][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x42')][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x148')});db['MailApplication'][_0x4b59('0x11a')](db['Tag'],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x16c')});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x16d')]['belongsTo'](db['CmContact'],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db[_0x4b59('0x3e')],{});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db['MailMessage'],{});db['MailQueueReport']['belongsTo'](db['User'],{});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db[_0x4b59('0x163')],{});db[_0x4b59('0x44')][_0x4b59('0x10d')](db[_0x4b59('0x16e')],{'as':_0x4b59('0x16f'),'onDelete':'cascade'});db['FaxAccount'][_0x4b59('0x10d')](db['Disposition'],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x170')});db[_0x4b59('0x47')][_0x4b59('0x10d')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4b59('0x170')});db[_0x4b59('0x47')]['hasMany'](db[_0x4b59('0x4b')],{'as':_0x4b59('0x15c')});db[_0x4b59('0x47')][_0x4b59('0x10d')](db[_0x4b59('0x49')],{'as':_0x4b59('0x15d')});db[_0x4b59('0x47')]['hasMany'](db[_0x4b59('0x16')],{'as':_0x4b59('0x171'),'onDelete':_0x4b59('0x10b')});db['FaxAccount'][_0x4b59('0x10d')](db['FaxMessage'],{'as':'Messages'});db[_0x4b59('0x47')][_0x4b59('0x11a')](db[_0x4b59('0x26')],{'as':_0x4b59('0x26')});db[_0x4b59('0x47')][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':'ListId'});db[_0x4b59('0x47')][_0x4b59('0x11a')](db[_0x4b59('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x4b59('0x14a')});db[_0x4b59('0x47')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':'Agents','through':_0x4b59('0x132')});db[_0x4b59('0x49')]['belongsTo'](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x49')][_0x4b59('0x11a')](db[_0x4b59('0x4f')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x49')][_0x4b59('0x11a')](db[_0x4b59('0x47')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x49')][_0x4b59('0x11a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x4b59('0x16c')});db[_0x4b59('0x4b')][_0x4b59('0x10d')](db[_0x4b59('0x4d')],{'as':_0x4b59('0x150'),'onDelete':_0x4b59('0x10b'),'foreignKey':'FaxInteractionId'});db[_0x4b59('0x4b')][_0x4b59('0x11a')](db['FaxAccount'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x170')});db['FaxInteraction'][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':'Contact','foreignKey':_0x4b59('0x155')});db[_0x4b59('0x4b')]['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x166'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x4b')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x172'),'as':'Tags'});db[_0x4b59('0x4b')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x172'),'as':_0x4b59('0x169')});db[_0x4b59('0x4b')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_fax_interactions','foreignKey':_0x4b59('0x174')});db[_0x4b59('0x4d')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x12')});db['FaxMessage']['belongsTo'](db[_0x4b59('0x4b')],{'as':_0x4b59('0x16a'),'foreignKey':_0x4b59('0x174')});db[_0x4b59('0x4d')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':_0x4b59('0xe9'),'foreignKey':_0x4b59('0x175')});db[_0x4b59('0x4d')][_0x4b59('0x11a')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x4b59('0x4f')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserFaxQueue'});db[_0x4b59('0x4f')][_0x4b59('0x11c')](db[_0x4b59('0x121')],{'through':_0x4b59('0x176'),'as':'Teams'});db['FaxQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x47')],{});db[_0x4b59('0x51')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x51')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4b59('0x51')][_0x4b59('0x11a')](db[_0x4b59('0x4b')],{});db[_0x4b59('0x51')][_0x4b59('0x11a')](db['FaxMessage'],{});db['FaxQueueReport'][_0x4b59('0x11a')](db['User'],{});db[_0x4b59('0x51')]['belongsTo'](db[_0x4b59('0x4f')],{});db['SmsAccount'][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':'Dispositions','foreignKey':_0x4b59('0x177')});db[_0x4b59('0x52')][_0x4b59('0x10d')](db[_0x4b59('0x7e')],{'as':_0x4b59('0x178'),'foreignKey':_0x4b59('0x177')});db[_0x4b59('0x52')]['hasMany'](db[_0x4b59('0x179')],{'as':_0x4b59('0x150'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x4b59('0x10d')](db[_0x4b59('0x115')],{'as':'Interactions'});db[_0x4b59('0x52')]['hasMany'](db[_0x4b59('0x53')],{'as':_0x4b59('0x15d')});db[_0x4b59('0x52')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':'List','foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x52')][_0x4b59('0x11a')](db[_0x4b59('0x82')],{'as':_0x4b59('0x149'),'foreignKey':_0x4b59('0x14a')});db['SmsAccount'][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x162'),'through':'user_has_sms_accounts'});db[_0x4b59('0x53')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db['SmsApplication'][_0x4b59('0x11a')](db[_0x4b59('0x57')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x53')][_0x4b59('0x11a')](db[_0x4b59('0x52')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x53')][_0x4b59('0x11a')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x4b59('0x148')});db['SmsApplication']['belongsTo'](db[_0x4b59('0x88')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x16c')});db[_0x4b59('0x115')]['hasMany'](db[_0x4b59('0x179')],{'as':_0x4b59('0x150'),'onDelete':'cascade','foreignKey':_0x4b59('0x17a')});db['SmsInteraction']['belongsTo'](db[_0x4b59('0x52')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x177')});db[_0x4b59('0x115')][_0x4b59('0x11a')](db['CmContact'],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db['SmsInteraction'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x166'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x115')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x17b'),'as':_0x4b59('0x168')});db[_0x4b59('0x115')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x17b'),'as':_0x4b59('0x169')});db[_0x4b59('0x115')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_sms_interactions','foreignKey':_0x4b59('0x17a')});db[_0x4b59('0x179')]['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x12')});db[_0x4b59('0x179')][_0x4b59('0x11a')](db['CmContact'],{'onDelete':'cascade','as':_0x4b59('0x154')});db[_0x4b59('0x179')][_0x4b59('0x11a')](db[_0x4b59('0x115')],{'onDelete':_0x4b59('0x10b'),'as':'Interaction','foreignKey':_0x4b59('0x17a')});db['SmsMessage'][_0x4b59('0x11a')](db[_0x4b59('0x52')],{'as':'Account','foreignKey':_0x4b59('0x177')});db[_0x4b59('0x57')][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x162'),'through':_0x4b59('0x33'),'foreignKey':_0x4b59('0x17c')});db[_0x4b59('0x57')]['belongsToMany'](db[_0x4b59('0x121')],{'through':_0x4b59('0x17d'),'as':'Teams'});db['OpenchannelAccount'][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x17e')});db['OpenchannelAccount'][_0x4b59('0x10d')](db[_0x4b59('0x7e')],{'as':_0x4b59('0x178'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x59')][_0x4b59('0x10d')](db[_0x4b59('0x127')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x4b59('0x59')][_0x4b59('0x10d')](db[_0x4b59('0x5e')],{'as':_0x4b59('0x150'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x59')][_0x4b59('0x10d')](db[_0x4b59('0x5b')],{'as':_0x4b59('0x15d'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x59')]['belongsTo'](db[_0x4b59('0xf1')],{'as':'List','foreignKey':_0x4b59('0x15f')});db['OpenchannelAccount']['belongsTo'](db[_0x4b59('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x5b')][_0x4b59('0x11a')](db[_0x4b59('0x5f')],{'onDelete':_0x4b59('0x16b'),'foreignKey':'OpenchannelQueueId'});db[_0x4b59('0x5b')][_0x4b59('0x11a')](db[_0x4b59('0x59')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x5b')][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'onDelete':'restrict','foreignKey':_0x4b59('0x148')});db['OpenchannelApplication'][_0x4b59('0x11a')](db[_0x4b59('0x88')],{'onDelete':_0x4b59('0x16b'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0x4b59('0x10d')](db[_0x4b59('0x5e')],{'as':_0x4b59('0x150'),'onDelete':'cascade','foreignKey':_0x4b59('0x17f')});db['OpenchannelInteraction'][_0x4b59('0x11a')](db['OpenchannelAccount'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x127')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4b59('0x127')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x4b59('0x127')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x180'),'as':_0x4b59('0x168')});db[_0x4b59('0x127')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x4b59('0x127')][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x173'),'through':'user_has_openchannel_interactions','foreignKey':_0x4b59('0x17f')});db['OpenchannelMessage'][_0x4b59('0x11a')](db['User'],{'onDelete':'cascade','as':_0x4b59('0x12')});db[_0x4b59('0x5e')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154')});db[_0x4b59('0x5e')][_0x4b59('0x11a')](db[_0x4b59('0x127')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x16a'),'foreignKey':_0x4b59('0x17f')});db[_0x4b59('0x5e')][_0x4b59('0x11a')](db['Attachment'],{'as':_0x4b59('0xe9'),'foreignKey':_0x4b59('0x175')});db[_0x4b59('0x5e')][_0x4b59('0x11a')](db[_0x4b59('0x59')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x5f')][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x162'),'through':'UserOpenchannelQueue','foreignKey':_0x4b59('0x181')});db[_0x4b59('0x5f')]['belongsToMany'](db[_0x4b59('0x121')],{'through':_0x4b59('0x182'),'as':_0x4b59('0x14c')});db['ChatWebsite'][_0x4b59('0x10d')](db['Disposition'],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x183')});db[_0x4b59('0x61')]['hasMany'](db[_0x4b59('0x7e')],{'as':'Answers','foreignKey':_0x4b59('0x183')});db['ChatWebsite'][_0x4b59('0x10d')](db[_0x4b59('0x6d')],{'as':_0x4b59('0x184')});db['ChatWebsite'][_0x4b59('0x10d')](db['ChatInteraction'],{'as':'Interactions'});db[_0x4b59('0x61')][_0x4b59('0x10d')](db[_0x4b59('0x64')],{'as':_0x4b59('0x15d')});db[_0x4b59('0x61')][_0x4b59('0x10d')](db[_0x4b59('0x67')],{'as':_0x4b59('0x150')});db[_0x4b59('0x61')]['belongsTo'](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x61')]['belongsTo'](db[_0x4b59('0x147')],{'as':_0x4b59('0x147'),'foreignKey':_0x4b59('0x148')});db[_0x4b59('0x61')][_0x4b59('0x11a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x4b59('0x14a')});db[_0x4b59('0x61')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':_0x4b59('0x185')});db['OpenchannelQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x59')],{});db[_0x4b59('0x62')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x62')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db['OpenchannelQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x127')],{});db[_0x4b59('0x62')][_0x4b59('0x11a')](db[_0x4b59('0x5e')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x4b59('0x12')],{});db[_0x4b59('0x62')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x4b59('0x64')]['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x186'),'foreignKey':_0x4b59('0x10c'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x64')]['belongsTo'](db['ChatQueue'],{'as':_0x4b59('0x187'),'foreignKey':_0x4b59('0x188'),'onDelete':'restrict'});db[_0x4b59('0x64')][_0x4b59('0x11a')](db['ChatWebsite'],{'as':_0x4b59('0x189'),'foreignKey':_0x4b59('0x183'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x64')][_0x4b59('0x11a')](db[_0x4b59('0x88')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x16c')});db[_0x4b59('0x65')]['hasMany'](db[_0x4b59('0x67')],{'as':_0x4b59('0x150'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x18a')});db['ChatInteraction'][_0x4b59('0x11a')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x4b59('0x183')});db[_0x4b59('0x65')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x65')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x166'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x65')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x18b'),'as':_0x4b59('0x168')});db[_0x4b59('0x65')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':'chat_interaction_has_tags','as':_0x4b59('0x169')});db[_0x4b59('0x65')]['belongsToMany'](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_chat_interactions','foreignKey':_0x4b59('0x18a')});db[_0x4b59('0x67')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x12')});db[_0x4b59('0x67')]['belongsTo'](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db['ChatMessage'][_0x4b59('0x11a')](db[_0x4b59('0x65')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x16a'),'foreignKey':_0x4b59('0x18a')});db[_0x4b59('0x67')][_0x4b59('0x11a')](db['Attachment'],{'as':'Attachment','foreignKey':_0x4b59('0x175')});db['ChatMessage'][_0x4b59('0x11a')](db['ChatWebsite'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x183')});db[_0x4b59('0x68')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x4b59('0x11a')](db[_0x4b59('0x61')],{'as':_0x4b59('0x165'),'foreignKey':'ChatWebsiteId'});db[_0x4b59('0x6a')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':'Agents','through':_0x4b59('0x2d'),'hooks':!![]});db[_0x4b59('0x6a')][_0x4b59('0x11c')](db[_0x4b59('0x121')],{'through':_0x4b59('0x18c'),'as':_0x4b59('0x14c')});db[_0x4b59('0x6b')][_0x4b59('0x10d')](db[_0x4b59('0xcc')],{'as':_0x4b59('0x150'),'foreignKey':_0x4b59('0x18d'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x6b')][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x13e'),'through':'chat_group_has_users'});db['ChatProactiveAction']['belongsTo'](db[_0x4b59('0x61')],{'as':_0x4b59('0x189'),'foreignKey':_0x4b59('0x183')});db['CmCompany'][_0x4b59('0x10d')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x11f'),'foreignKey':_0x4b59('0x18e')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x70')],{'as':_0x4b59('0x140'),'foreignKey':'ContactId'});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db['CmHopperFinal'],{'as':_0x4b59('0x111'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x74')],{'as':_0x4b59('0x141'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x6f')]['hasMany'](db[_0x4b59('0x76')],{'as':_0x4b59('0x76'),'foreignKey':_0x4b59('0x155')});db['CmContact'][_0x4b59('0x10d')](db[_0x4b59('0xd2')],{'as':_0x4b59('0x143'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x127')],{'as':_0x4b59('0x113'),'foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x16b')});db['CmContact']['hasMany'](db[_0x4b59('0x65')],{'as':_0x4b59('0x114'),'foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x115')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x4b59('0x16b')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x4b')],{'as':_0x4b59('0x116'),'foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x3e')],{'as':_0x4b59('0x117'),'foreignKey':'ContactId','onDelete':_0x4b59('0x16b')});db['CmContact'][_0x4b59('0x11a')](db[_0x4b59('0x6e')],{'as':'Company','foreignKey':_0x4b59('0x18e')});db[_0x4b59('0x6f')]['belongsTo'](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f'),'onDelete':'cascade'});db[_0x4b59('0x6f')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':'Users','through':'cm_user_has_contacts'});db[_0x4b59('0x6f')][_0x4b59('0x11c')](db['Tag'],{'as':_0x4b59('0x168'),'through':_0x4b59('0x18f')});db['CmContact'][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x18f'),'as':_0x4b59('0x169')});db[_0x4b59('0x70')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x10b')});db['CmHopper'][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x70')][_0x4b59('0x11a')](db['User'],{'as':'Agent','foreignKey':_0x4b59('0x10c')});db['CmHopper'][_0x4b59('0x11a')](db[_0x4b59('0x17')],{'as':_0x4b59('0x187'),'foreignKey':_0x4b59('0x13f'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x70')]['belongsTo'](db[_0x4b59('0xe6')],{'as':_0x4b59('0xe6'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x4b59('0x70')][_0x4b59('0x11a')](db['User'],{'as':_0x4b59('0x166'),'foreignKey':'OwnerId'});db[_0x4b59('0x142')]['belongsTo'](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x142')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':'List','foreignKey':_0x4b59('0x15f'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x142')][_0x4b59('0x11a')](db[_0x4b59('0x17')],{'as':_0x4b59('0x187'),'foreignKey':_0x4b59('0x13f'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x142')][_0x4b59('0x11a')](db[_0x4b59('0xe6')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x4b59('0x10b')});db[_0x4b59('0x7c')]['hasMany'](db[_0x4b59('0x80')],{'as':{'plural':'All','singular':_0x4b59('0x190')},'foreignKey':_0x4b59('0x191'),'onDelete':_0x4b59('0x10b'),'hooks':!![]});db[_0x4b59('0x7c')][_0x4b59('0x10d')](db[_0x4b59('0x80')],{'as':{'plural':'Any','singular':_0x4b59('0x192')},'foreignKey':'AutomationAnyId','onDelete':_0x4b59('0x10b'),'hooks':!![]});db[_0x4b59('0x7c')]['hasMany'](db[_0x4b59('0x7a')],{'as':_0x4b59('0x193'),'foreignKey':_0x4b59('0x194'),'onDelete':'cascade','hooks':!![]});db[_0x4b59('0x15a')][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x195'),'onDelete':_0x4b59('0x10b')});db['Interval']['hasMany'](db[_0x4b59('0x147')],{'as':_0x4b59('0x196'),'foreignKey':_0x4b59('0x148'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x4b59('0x147')][_0x4b59('0x10d')](db['VoiceExtension'],{'as':_0x4b59('0x110'),'foreignKey':_0x4b59('0x148'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x147')][_0x4b59('0x10d')](db[_0x4b59('0x42')],{'as':_0x4b59('0x197'),'foreignKey':_0x4b59('0x148')});db[_0x4b59('0x147')]['hasMany'](db['ChatApplication'],{'as':_0x4b59('0x198'),'foreignKey':_0x4b59('0x148')});db[_0x4b59('0x147')][_0x4b59('0x10d')](db[_0x4b59('0x49')],{'as':'FaxApplications','foreignKey':_0x4b59('0x148')});db[_0x4b59('0x147')][_0x4b59('0x10d')](db[_0x4b59('0x53')],{'as':_0x4b59('0x199'),'foreignKey':'IntervalId'});db[_0x4b59('0x85')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{});db[_0x4b59('0x85')]['belongsTo'](db[_0x4b59('0x93')],{'foreignKey':'DefaultReportId'});db[_0x4b59('0x85')][_0x4b59('0x11a')](db[_0x4b59('0x92')],{'foreignKey':_0x4b59('0x19a')});db[_0x4b59('0x87')][_0x4b59('0x11c')](db[_0x4b59('0x13c')],{'as':_0x4b59('0x19b'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0x4b59('0x88')][_0x4b59('0x11c')](db[_0x4b59('0x6f')],{'through':'cm_contact_has_tags'});db[_0x4b59('0x88')][_0x4b59('0x11c')](db[_0x4b59('0x65')],{'through':'chat_interaction_has_tags'});db[_0x4b59('0x88')][_0x4b59('0x11c')](db['MailInteraction'],{'through':_0x4b59('0x167')});db['Tag'][_0x4b59('0x11c')](db[_0x4b59('0x115')],{'through':_0x4b59('0x17b')});db['Tag'][_0x4b59('0x11c')](db[_0x4b59('0x4b')],{'through':'fax_interaction_has_tags'});db[_0x4b59('0x88')][_0x4b59('0x11c')](db[_0x4b59('0x127')],{'through':_0x4b59('0x180')});db['Tag'][_0x4b59('0x11c')](db[_0x4b59('0xff')],{'through':_0x4b59('0x19c')});db[_0x4b59('0x8b')]['hasMany'](db[_0x4b59('0x80')],{'as':{'plural':_0x4b59('0x19d'),'singular':_0x4b59('0x19e')},'foreignKey':'TriggerAllId','onDelete':_0x4b59('0x10b'),'hooks':!![]});db[_0x4b59('0x8b')][_0x4b59('0x10d')](db['Condition'],{'as':{'plural':_0x4b59('0x19f'),'singular':_0x4b59('0x1a0')},'foreignKey':_0x4b59('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x4b59('0x8b')][_0x4b59('0x10d')](db[_0x4b59('0x7a')],{'as':_0x4b59('0x193'),'foreignKey':_0x4b59('0x1a2'),'onDelete':_0x4b59('0x10b'),'hooks':!![]});db['AnalyticCustomReport'][_0x4b59('0x10d')](db[_0x4b59('0x97')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x19a'),'hooks':!![]});db['AnalyticDefaultReport'][_0x4b59('0x10d')](db[_0x4b59('0x97')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a4')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a5')});db['AnalyticFieldReport'][_0x4b59('0x11a')](db[_0x4b59('0x96')],{'foreignKey':'MetricId'});db[_0x4b59('0x99')]['hasMany'](db[_0x4b59('0x9b')],{'as':_0x4b59('0x1a6'),'onDelete':'cascade','foreignKey':_0x4b59('0x1a7')});db['SalesforceConfiguration']['hasMany'](db[_0x4b59('0x9d')],{'as':_0x4b59('0x1a8'),'onDelete':'cascade','foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x9b')][_0x4b59('0x10d')](db['SalesforceField'],{'as':_0x4b59('0x1aa'),'onDelete':_0x4b59('0x10b'),'foreignKey':'DescriptionId'});db[_0x4b59('0x9b')][_0x4b59('0x10d')](db[_0x4b59('0x9d')],{'as':_0x4b59('0x1a3'),'onDelete':'cascade','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0x9b')]['belongsTo'](db[_0x4b59('0x99')],{'as':_0x4b59('0x165'),'foreignKey':'AccountId'});db[_0x4b59('0x9d')][_0x4b59('0x10d')](db[_0x4b59('0x9d')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x9d')][_0x4b59('0x10d')](db[_0x4b59('0x9d')],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db['SalesforceField'][_0x4b59('0x10d')](db[_0x4b59('0x9d')],{'as':'Field','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0x9d')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x4b59('0x1af')});db[_0x4b59('0x9f')][_0x4b59('0x10d')](db[_0x4b59('0x1b0')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0x1b0')][_0x4b59('0x10d')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x1b0')]['hasMany'](db[_0x4b59('0xa2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0x1b0')][_0x4b59('0x10d')](db[_0x4b59('0xa2')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0x1b0')][_0x4b59('0x11a')](db[_0x4b59('0x9f')],{'as':'Account','foreignKey':_0x4b59('0x1a7')});db['SugarcrmField']['hasMany'](db[_0x4b59('0xa2')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xa2')]['hasMany'](db[_0x4b59('0xa2')],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xa2')]['hasMany'](db['SugarcrmField'],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db['SugarcrmField'][_0x4b59('0x11a')](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xa4')][_0x4b59('0x10d')](db[_0x4b59('0xa6')],{'as':_0x4b59('0x1a6'),'onDelete':'cascade','foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xa6')]['hasMany'](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1a8'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xa6')][_0x4b59('0x10d')](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1aa'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xa6')]['hasMany'](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1ab')});db['DeskConfiguration']['belongsTo'](db[_0x4b59('0xa4')],{'as':'Account','foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xa6')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x1b2')});db[_0x4b59('0xa7')]['hasMany'](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db['DeskField'][_0x4b59('0x10d')](db[_0x4b59('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField'][_0x4b59('0x10d')](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xa7')][_0x4b59('0x11a')](db[_0x4b59('0x8d')],{'as':'Variable','foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xa8')][_0x4b59('0x10d')](db[_0x4b59('0x1b3')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db['ZohoConfiguration'][_0x4b59('0x10d')](db['ZohoField'],{'as':_0x4b59('0x1a8'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x1b3')][_0x4b59('0x10d')](db[_0x4b59('0xaa')],{'as':_0x4b59('0x1aa'),'onDelete':_0x4b59('0x10b'),'foreignKey':'DescriptionId'});db['ZohoConfiguration']['hasMany'](db[_0x4b59('0xaa')],{'as':_0x4b59('0x1a3'),'onDelete':'cascade','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0x1b3')][_0x4b59('0x11a')](db[_0x4b59('0xa8')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xaa')][_0x4b59('0x10d')](db[_0x4b59('0xaa')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4b59('0xaa')][_0x4b59('0x10d')](db[_0x4b59('0xaa')],{'as':'Description','foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xaa')]['hasMany'](db['ZohoField'],{'as':'Field','foreignKey':'FieldId'});db[_0x4b59('0xaa')]['belongsTo'](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0x4b59('0x10d')](db[_0x4b59('0xae')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xae')][_0x4b59('0x10d')](db[_0x4b59('0x1b4')],{'as':_0x4b59('0x1a8'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xae')]['hasMany'](db[_0x4b59('0x1b4')],{'as':_0x4b59('0x1aa'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xae')][_0x4b59('0x10d')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x4b59('0xae')]['belongsTo'](db[_0x4b59('0xac')],{'as':'Account','foreignKey':_0x4b59('0x1a7')});db['ZendeskConfiguration'][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x1b5')});db[_0x4b59('0x1b4')][_0x4b59('0x10d')](db['ZendeskField'],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x1b4')]['hasMany'](db['ZendeskField'],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0x1b4')]['hasMany'](db[_0x4b59('0x1b4')],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db['ZendeskField'][_0x4b59('0x11a')](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':'VariableId'});db[_0x4b59('0xaf')][_0x4b59('0x10d')](db[_0x4b59('0xb1')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db['FreshdeskConfiguration'][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':'Subjects','onDelete':_0x4b59('0x10b'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1aa'),'onDelete':'cascade','foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xb1')][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':'FieldId'});db[_0x4b59('0xb1')][_0x4b59('0x11a')](db[_0x4b59('0xaf')],{'as':_0x4b59('0x165'),'foreignKey':'AccountId'});db[_0x4b59('0xb1')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x4b59('0xb3')][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xb3')][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xb3')][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1b1'),'foreignKey':'FieldId'});db[_0x4b59('0xb3')][_0x4b59('0x11a')](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x4b59('0x10d')](db[_0x4b59('0xb5')],{'as':'Configurations','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xb5')][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':_0x4b59('0x1a8'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xb5')][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':'Descriptions','foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xb5')]['hasMany'](db[_0x4b59('0xb7')],{'as':'Fields','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xb5')]['belongsTo'](db['VtigerAccount'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xb7')][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':_0x4b59('0x1ac'),'foreignKey':'SubjectId'});db[_0x4b59('0xb7')][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db['VtigerField'][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db['VtigerField'][_0x4b59('0x11a')](db['Variable'],{'as':'Variable','foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xb9')][_0x4b59('0x10d')](db[_0x4b59('0xbb')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xbb')]['hasMany'](db[_0x4b59('0xbd')],{'as':_0x4b59('0x1a8'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xbb')][_0x4b59('0x10d')](db['ServicenowField'],{'as':_0x4b59('0x1aa'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xbb')]['hasMany'](db[_0x4b59('0xbd')],{'as':_0x4b59('0x1a3'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x4b59('0x11a')](db['ServicenowAccount'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xbd')]['hasMany'](db['ServicenowField'],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xbd')][_0x4b59('0x10d')](db['ServicenowField'],{'as':_0x4b59('0x1ad'),'foreignKey':'DescriptionId'});db[_0x4b59('0xbd')][_0x4b59('0x10d')](db[_0x4b59('0xbd')],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xbd')][_0x4b59('0x11a')](db['Variable'],{'as':_0x4b59('0x8d'),'foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xbf')]['hasMany'](db[_0x4b59('0xc0')],{'as':'Configurations','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xc0')][_0x4b59('0x10d')](db[_0x4b59('0xc2')],{'as':'Subjects','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a9')});db['Dynamics365Configuration'][_0x4b59('0x10d')](db[_0x4b59('0xc2')],{'as':_0x4b59('0x1aa'),'onDelete':_0x4b59('0x10b'),'foreignKey':'DescriptionId'});db[_0x4b59('0xc0')][_0x4b59('0x10d')](db[_0x4b59('0xc2')],{'as':'Fields','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xc0')][_0x4b59('0x11a')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xc2')][_0x4b59('0x10d')](db[_0x4b59('0xc2')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xc2')]['hasMany'](db['Dynamics365Field'],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db['Dynamics365Field'][_0x4b59('0x10d')](db['Dynamics365Field'],{'as':_0x4b59('0x1b1'),'foreignKey':'FieldId'});db[_0x4b59('0xc2')][_0x4b59('0x11a')](db['Variable'],{'as':_0x4b59('0x8d'),'foreignKey':_0x4b59('0x1af')});db['FreshsalesAccount'][_0x4b59('0x10d')](db[_0x4b59('0xc5')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db['FreshsalesConfiguration'][_0x4b59('0x10d')](db['FreshsalesField'],{'as':_0x4b59('0x1a8'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x4b59('0x10d')](db[_0x4b59('0xc7')],{'as':_0x4b59('0x1aa'),'foreignKey':_0x4b59('0x1ae')});db['FreshsalesConfiguration'][_0x4b59('0x10d')](db[_0x4b59('0xc7')],{'as':_0x4b59('0x1a3'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xc5')][_0x4b59('0x11a')](db[_0x4b59('0x1b6')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xc7')]['hasMany'](db[_0x4b59('0xc7')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db['FreshsalesField'][_0x4b59('0x10d')](db['FreshsalesField'],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xc7')][_0x4b59('0x10d')](db[_0x4b59('0xc7')],{'as':'Field','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xc7')]['belongsTo'](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xca')][_0x4b59('0x11a')](db[_0x4b59('0x61')],{});db[_0x4b59('0xca')]['belongsTo'](db[_0x4b59('0xf1')],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0xca')][_0x4b59('0x11a')](db['CmContact'],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0xca')]['belongsTo'](db[_0x4b59('0x65')],{});db[_0x4b59('0xca')][_0x4b59('0x11a')](db[_0x4b59('0x67')],{});db[_0x4b59('0xca')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{});db[_0x4b59('0xca')]['belongsTo'](db[_0x4b59('0x6a')],{});db[_0x4b59('0xcc')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1b7')});db['ChatInternalMessage']['belongsTo'](db[_0x4b59('0x12')],{'onDelete':'cascade','foreignKey':_0x4b59('0x1b8')});db[_0x4b59('0xd2')][_0x4b59('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0x4b59('0x1b9'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0xd2')]['hasMany'](db[_0x4b59('0xce')],{'foreignKey':_0x4b59('0x1b9'),'onDelete':_0x4b59('0x10b')});db['SmsQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x52')],{});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':'List','foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db['SmsInteraction'],{});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db['SmsMessage'],{});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{});db['SmsQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x57')],{});db[_0x4b59('0xd8')][_0x4b59('0x10d')](db['JscriptySessionReport'],{'foreignKey':_0x4b59('0x1bb')});db[_0x4b59('0xd8')][_0x4b59('0x10d')](db[_0x4b59('0xd0')],{'foreignKey':_0x4b59('0x1bb')});db[_0x4b59('0xd8')][_0x4b59('0x10d')](db[_0x4b59('0xce')],{'foreignKey':_0x4b59('0x1bb')});db[_0x4b59('0xde')]['belongsToMany'](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_square_projects'});db[_0x4b59('0x121')]['belongsToMany'](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':'user_has_teams'});db['Team'][_0x4b59('0x11c')](db[_0x4b59('0x17')],{'through':_0x4b59('0x14d'),'as':_0x4b59('0x12a')});db['Team'][_0x4b59('0x11c')](db[_0x4b59('0x163')],{'through':_0x4b59('0x1bc'),'as':_0x4b59('0x1bd')});db[_0x4b59('0x121')][_0x4b59('0x11c')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x4b59('0x1be')});db[_0x4b59('0x121')][_0x4b59('0x11c')](db['FaxQueue'],{'through':_0x4b59('0x176'),'as':_0x4b59('0x12b')});db[_0x4b59('0x121')][_0x4b59('0x11c')](db[_0x4b59('0x57')],{'through':_0x4b59('0x17d'),'as':_0x4b59('0x1bf')});db['Team']['belongsToMany'](db[_0x4b59('0x5f')],{'through':_0x4b59('0x182'),'as':_0x4b59('0x12c')});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x4b59('0xe6')]['hasMany'](db[_0x4b59('0x70')],{'as':_0x4b59('0x140'),'foreignKey':_0x4b59('0x1c0')});db[_0x4b59('0xe6')][_0x4b59('0x10d')](db[_0x4b59('0x72')],{'as':'HopperFinals','foreignKey':_0x4b59('0x1c0')});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0x4b59('0x141'),'foreignKey':_0x4b59('0x1c0')});db[_0x4b59('0xe6')][_0x4b59('0x10d')](db[_0x4b59('0x142')],{'as':_0x4b59('0x1c1'),'foreignKey':'CampaignId'});db[_0x4b59('0xe6')][_0x4b59('0x11a')](db['Trunk'],{'as':'Trunk','foreignKey':_0x4b59('0x144')});db['Campaign'][_0x4b59('0x11a')](db[_0x4b59('0x26')],{'as':_0x4b59('0x145'),'foreignKey':'TrunkBackupId'});db[_0x4b59('0xe6')][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'as':'Interval','foreignKey':'IntervalId'});db['Campaign'][_0x4b59('0x11a')](db[_0x4b59('0xde')],{'as':_0x4b59('0xde'),'foreignKey':_0x4b59('0x1c2')});db[_0x4b59('0xe6')][_0x4b59('0x11c')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x1c3'),'through':'campaigns_has_cm_lists'});db[_0x4b59('0xe6')]['belongsToMany'](db[_0x4b59('0xf1')],{'as':_0x4b59('0x14e'),'through':_0x4b59('0x1c4')});db[_0x4b59('0x1c5')][_0x4b59('0x11a')](db[_0x4b59('0x40')],{});db[_0x4b59('0x1c5')]['belongsTo'](db['MailInteraction'],{});db[_0x4b59('0x1c5')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'foreignKey':_0x4b59('0x1c6'),'as':_0x4b59('0x1c7')});db['MailTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':_0x4b59('0x1c9')});db[_0x4b59('0x1c5')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1ca'),'as':_0x4b59('0x1cb')});db[_0x4b59('0x1c5')][_0x4b59('0x11a')](db[_0x4b59('0x163')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport'][_0x4b59('0x11a')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x4b59('0x1cc')});db[_0x4b59('0xea')]['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x65')],{});db[_0x4b59('0xea')][_0x4b59('0x11a')](db['ChatWebsite'],{'foreignKey':_0x4b59('0x1cd'),'as':_0x4b59('0x1c7')});db[_0x4b59('0xea')][_0x4b59('0x11a')](db['User'],{'foreignKey':_0x4b59('0x1c8'),'as':_0x4b59('0x1c9')});db[_0x4b59('0xea')][_0x4b59('0x11a')](db['User'],{'foreignKey':'ToUserId','as':_0x4b59('0x1cb')});db[_0x4b59('0xea')][_0x4b59('0x11a')](db['ChatQueue'],{'foreignKey':_0x4b59('0x1ce'),'as':_0x4b59('0x1cf')});db[_0x4b59('0xea')][_0x4b59('0x11a')](db[_0x4b59('0x61')],{'foreignKey':_0x4b59('0x1d0'),'as':_0x4b59('0x1cc')});db[_0x4b59('0xec')][_0x4b59('0x11a')](db['FaxMessage'],{});db[_0x4b59('0xec')][_0x4b59('0x11a')](db[_0x4b59('0x4b')],{});db['FaxTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x47')],{'foreignKey':_0x4b59('0x1d1'),'as':_0x4b59('0x1c7')});db[_0x4b59('0xec')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':_0x4b59('0x1c9')});db['FaxTransferReport'][_0x4b59('0x11a')](db['User'],{'foreignKey':_0x4b59('0x1ca'),'as':_0x4b59('0x1cb')});db[_0x4b59('0xec')][_0x4b59('0x11a')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x4b59('0x1cf')});db['FaxTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x47')],{'foreignKey':_0x4b59('0x1d2'),'as':_0x4b59('0x1cc')});db[_0x4b59('0xee')][_0x4b59('0x11a')](db['OpenchannelMessage'],{});db[_0x4b59('0xee')][_0x4b59('0x11a')](db[_0x4b59('0x127')],{});db['OpenchannelTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':_0x4b59('0x1c7')});db['OpenchannelTransferReport']['belongsTo'](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':'FromAgent'});db[_0x4b59('0xee')][_0x4b59('0x11a')](db['User'],{'foreignKey':_0x4b59('0x1ca'),'as':'ToAgent'});db[_0x4b59('0xee')][_0x4b59('0x11a')](db[_0x4b59('0x5f')],{'foreignKey':'ToOpenchannelQueueId','as':_0x4b59('0x1cf')});db[_0x4b59('0xee')][_0x4b59('0x11a')](db[_0x4b59('0x59')],{'foreignKey':_0x4b59('0x1d3'),'as':_0x4b59('0x1cc')});db[_0x4b59('0xf0')]['belongsTo'](db['SmsMessage'],{});db[_0x4b59('0xf0')][_0x4b59('0x11a')](db[_0x4b59('0x115')],{});db[_0x4b59('0xf0')][_0x4b59('0x11a')](db[_0x4b59('0x52')],{'foreignKey':_0x4b59('0x1d4'),'as':_0x4b59('0x1c7')});db['SmsTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':_0x4b59('0x1c9')});db['SmsTransferReport'][_0x4b59('0x11a')](db['User'],{'foreignKey':_0x4b59('0x1ca'),'as':_0x4b59('0x1cb')});db[_0x4b59('0xf0')]['belongsTo'](db[_0x4b59('0x57')],{'foreignKey':_0x4b59('0x1d5'),'as':_0x4b59('0x1cf')});db[_0x4b59('0xf0')][_0x4b59('0x11a')](db[_0x4b59('0x52')],{'foreignKey':_0x4b59('0x1d6'),'as':_0x4b59('0x1cc')});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db['Disposition'],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db[_0x4b59('0x78')],{'as':'CustomFields','foreignKey':'ListId'});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x11f'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x15f')});db['CmList'][_0x4b59('0x10d')](db[_0x4b59('0x72')],{'as':'HopperFinals','foreignKey':_0x4b59('0x15f')});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db[_0x4b59('0x74')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db['ReportAgentPreview'],{'as':_0x4b59('0x76'),'foreignKey':_0x4b59('0x15f')});db['CmList']['belongsToMany'](db[_0x4b59('0x17')],{'as':_0x4b59('0x1d7'),'through':_0x4b59('0x14b')});db[_0x4b59('0xf1')]['belongsToMany'](db['User'],{'as':_0x4b59('0x162'),'through':'cm_user_has_lists'});db[_0x4b59('0xf3')]['hasMany'](db[_0x4b59('0x16')],{'as':_0x4b59('0x110'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0xf3')]['belongsToMany'](db['User'],{'as':_0x4b59('0x162'),'through':'user_has_voice_prefixes'});db[_0x4b59('0xf5')]['hasMany'](db['User'],{'as':_0x4b59('0x173'),'foreignKey':_0x4b59('0x11b')});db[_0x4b59('0xf5')][_0x4b59('0x10d')](db[_0x4b59('0xf7')],{'as':_0x4b59('0x1d8'),'foreignKey':'userProfileId','onDelete':_0x4b59('0x10b')});db[_0x4b59('0xf7')][_0x4b59('0x10d')](db[_0x4b59('0xf9')],{'as':_0x4b59('0x1d9'),'foreignKey':'sectionId','onDelete':_0x4b59('0x10b')});db[_0x4b59('0xfc')][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':'Dispositions','foreignKey':_0x4b59('0x1da')});db[_0x4b59('0xfc')]['hasMany'](db[_0x4b59('0x7e')],{'as':_0x4b59('0x178'),'foreignKey':_0x4b59('0x1da')});db[_0x4b59('0xfc')][_0x4b59('0x10d')](db[_0x4b59('0x101')],{'as':_0x4b59('0x150'),'foreignKey':'WhatsappAccountId'});db[_0x4b59('0xfc')]['hasMany'](db[_0x4b59('0xff')],{'as':_0x4b59('0x15c')});db['WhatsappAccount'][_0x4b59('0x10d')](db['WhatsappApplication'],{'as':_0x4b59('0x15d')});db[_0x4b59('0xfc')][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db['WhatsappAccount']['belongsTo'](db['Pause'],{'as':_0x4b59('0x149'),'foreignKey':_0x4b59('0x14a')});db[_0x4b59('0xfc')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':'user_has_whatsapp_accounts'});db[_0x4b59('0x1db')]['belongsTo'](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x1db')]['belongsTo'](db[_0x4b59('0x106')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x1db')][_0x4b59('0x11a')](db['WhatsappAccount'],{'onDelete':_0x4b59('0x16b')});db['WhatsappApplication'][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x148')});db[_0x4b59('0x1db')][_0x4b59('0x11a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x4b59('0x16c')});db[_0x4b59('0xff')][_0x4b59('0x10d')](db[_0x4b59('0x101')],{'as':_0x4b59('0x150'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1dc')});db['WhatsappInteraction'][_0x4b59('0x11a')](db[_0x4b59('0xfc')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1da')});db['WhatsappInteraction'][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4b59('0xff')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':'Owner','foreignKey':_0x4b59('0x10c')});db[_0x4b59('0xff')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x19c'),'as':_0x4b59('0x168')});db[_0x4b59('0xff')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x19c'),'as':_0x4b59('0x169')});db[_0x4b59('0xff')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_whatsapp_interactions','foreignKey':_0x4b59('0x1dc')});db['WhatsappMessage']['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x12')});db['WhatsappMessage'][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':'Contact'});db[_0x4b59('0x101')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x16a'),'foreignKey':_0x4b59('0x1dc')});db[_0x4b59('0x101')]['belongsTo'](db[_0x4b59('0xfc')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1da')});db[_0x4b59('0x1dd')][_0x4b59('0x11a')](db[_0x4b59('0xfc')],{});db['WhatsappQueueReport'][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db['WhatsappQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db['WhatsappQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0xff')],{});db[_0x4b59('0x1dd')][_0x4b59('0x11a')](db[_0x4b59('0x106')],{});db['WhatsappQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x101')],{});db['WhatsappQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{});db[_0x4b59('0x104')][_0x4b59('0x11a')](db[_0x4b59('0x101')],{});db[_0x4b59('0x104')][_0x4b59('0x11a')](db[_0x4b59('0xff')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x4b59('0x1de'),'as':'FromAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0x4b59('0xfc')],{'foreignKey':'ToWhatsappAccountId','as':_0x4b59('0x1cc')});db[_0x4b59('0x104')][_0x4b59('0x11a')](db['WhatsappQueue'],{'foreignKey':_0x4b59('0x1df'),'as':_0x4b59('0x1cf')});db[_0x4b59('0x104')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1ca'),'as':_0x4b59('0x1cb')});db[_0x4b59('0x106')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':_0x4b59('0x37'),'foreignKey':_0x4b59('0x1e0')});db['WhatsappQueue'][_0x4b59('0x11c')](db['Team'],{'through':_0x4b59('0x1e1'),'as':_0x4b59('0x14c')});module[_0x4b59('0x1e2')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index df819b0..824d2b2 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','static','root','/apidoc','join','/www','/demo','1.0.16','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','newPassword','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','oldPassword','isArray','isPlainObject','replace','}@@','includes','path','express','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','statusCode','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','url'];(function(_0x44dcf0,_0x1402cd){var _0x206867=function(_0x15deff){while(--_0x15deff){_0x44dcf0['push'](_0x44dcf0['shift']());}};_0x206867(++_0x1402cd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var path=require(_0x0baf('0x0'));var express=require(_0x0baf('0x1'));var ewinston=require(_0x0baf('0x2'));var util=require(_0x0baf('0x3'));var errors=require(_0x0baf('0x4'));var config=require(_0x0baf('0x5'));var logger=require('./config/logger')(_0x0baf('0x6'));var authLogger=require(_0x0baf('0x7'))(_0x0baf('0x8'));exports[_0x0baf('0x9')]=function(_0xe4c3c4){_0xe4c3c4[_0x0baf('0xa')](ewinston[_0x0baf('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2dcaac,_0x1d0a0d){var _0x5f5030=_0x0baf('0xc');if(!_['isEmpty'](_0x2dcaac[_0x0baf('0xd')])){_0x5f5030+=_0x0baf('0xe');var _0x465528=_0x2dcaac[_0x0baf('0xd')];maskSensitiveData(_0x465528);}return util[_0x0baf('0xf')](_0x5f5030,_0x2dcaac[_0x0baf('0x10')],_0x2dcaac[_0x0baf('0x11')][_0x0baf('0x12')]?_0x2dcaac[_0x0baf('0x11')][_0x0baf('0x12')]:_0x2dcaac[_0x0baf('0x13')]['remoteAddress']||_0x2dcaac['ip'],_0x2dcaac['url'],_0x1d0a0d[_0x0baf('0x14')],_0x1d0a0d[_0x0baf('0x15')],_0x2dcaac[_0x0baf('0x16')]?_0x2dcaac[_0x0baf('0x16')]['id']:null,_0x2dcaac['user']?_0x2dcaac[_0x0baf('0x16')]['name']:null,_0x2dcaac[_0x0baf('0x16')]?_0x2dcaac[_0x0baf('0x16')][_0x0baf('0x17')]:null,_0x465528?util[_0x0baf('0x18')](_0x465528,![],null):'');}}));_0xe4c3c4[_0x0baf('0xa')](ewinston[_0x0baf('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4f80a8,_0x4cd79d){var _0x2312c7=_0x0baf('0x19');if(_0x4f80a8[_0x0baf('0xd')]&&_0x4f80a8[_0x0baf('0xd')][_0x0baf('0x1a')]&&_0x4f80a8[_0x0baf('0xd')]['agent_id']){_0x2312c7=_0x0baf('0x1b');}return util[_0x0baf('0xf')](_0x2312c7,_0x4f80a8[_0x0baf('0x10')],_0x4f80a8[_0x0baf('0x11')][_0x0baf('0x12')]?_0x4f80a8[_0x0baf('0x11')]['x-forwarded-for']:_0x4f80a8['connection'][_0x0baf('0x1c')]||_0x4f80a8['ip'],_0x4f80a8[_0x0baf('0x1d')],_0x4cd79d[_0x0baf('0x14')],_0x4cd79d[_0x0baf('0x15')],_0x4f80a8[_0x0baf('0x16')]?_0x4f80a8[_0x0baf('0x16')]['id']:null,_0x4f80a8[_0x0baf('0x16')]?_0x4f80a8[_0x0baf('0x16')][_0x0baf('0x1e')]:null,_0x4f80a8[_0x0baf('0x16')]?_0x4f80a8['user'][_0x0baf('0x17')]:null,_0x4f80a8['body']&&_0x4f80a8[_0x0baf('0xd')]['device']?_0x4f80a8['body'][_0x0baf('0x1a')]:'other',_0x4f80a8['body']&&_0x4f80a8[_0x0baf('0xd')][_0x0baf('0x1f')]?_0x4f80a8[_0x0baf('0xd')][_0x0baf('0x1f')]:'',_0x4f80a8[_0x0baf('0xd')]&&_0x4f80a8['body'][_0x0baf('0x20')]?_0x4f80a8[_0x0baf('0xd')][_0x0baf('0x20')]:'');},'ignoreRoute':function(_0x366e71){var _0x3843b8=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3843b8[_0x0baf('0x21')](_0x366e71[_0x0baf('0x1d')]);}}));_0xe4c3c4['use'](_0x0baf('0x22'),require(_0x0baf('0x23')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x24'),require('./api/voiceChanSpy'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x25'),require('./api/voiceContext'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x26'),require(_0x0baf('0x27')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x28'),require(_0x0baf('0x29')));_0xe4c3c4[_0x0baf('0xa')]('/api/voice/queues',require(_0x0baf('0x2a')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x2b'),require(_0x0baf('0x2c')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x2d'),require(_0x0baf('0x2e')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x2f'),require(_0x0baf('0x30')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x31'),require(_0x0baf('0x32')));_0xe4c3c4[_0x0baf('0xa')]('/api/voice/calls/reports',require(_0x0baf('0x33')));_0xe4c3c4['use'](_0x0baf('0x34'),require(_0x0baf('0x35')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x36'),require('./api/voiceAgentReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x37'),require('./api/voiceQueueReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x38'),require(_0x0baf('0x39')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x3a'),require(_0x0baf('0x3b')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x3c'),require('./api/voiceTransferReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x3d'),require('./api/mailServerOut'));_0xe4c3c4[_0x0baf('0xa')]('/api/mail/accounts',require('./api/mailAccount'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x3e'),require('./api/mailQueue'));_0xe4c3c4['use'](_0x0baf('0x3f'),require(_0x0baf('0x40')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x41'),require(_0x0baf('0x42')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x43'),require(_0x0baf('0x44')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x45'),require(_0x0baf('0x46')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x47'),require(_0x0baf('0x48')));_0xe4c3c4['use'](_0x0baf('0x49'),require(_0x0baf('0x4a')));_0xe4c3c4['use'](_0x0baf('0x4b'),require(_0x0baf('0x4c')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x4d'),require(_0x0baf('0x4e')));_0xe4c3c4[_0x0baf('0xa')]('/api/fax/applications',require(_0x0baf('0x4f')));_0xe4c3c4[_0x0baf('0xa')]('/api/fax/interactions',require(_0x0baf('0x50')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x51'),require(_0x0baf('0x52')));_0xe4c3c4['use'](_0x0baf('0x53'),require(_0x0baf('0x54')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x55'),require(_0x0baf('0x56')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x57'),require(_0x0baf('0x58')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x59'),require('./api/smsApplication'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x5a'),require(_0x0baf('0x5b')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x5c'),require('./api/smsMessage'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x5d'),require(_0x0baf('0x5e')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x5f'),require('./api/openchannelAccount'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x60'),require(_0x0baf('0x61')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x62'),require(_0x0baf('0x63')));_0xe4c3c4[_0x0baf('0xa')]('/api/openchannel/messages',require(_0x0baf('0x64')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x65'),require('./api/openchannelQueue'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x66'),require(_0x0baf('0x67')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x68'),require(_0x0baf('0x69')));_0xe4c3c4[_0x0baf('0xa')]('/api/chat/applications',require(_0x0baf('0x6a')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x6b'),require(_0x0baf('0x6c')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x6d'),require(_0x0baf('0x6e')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x6f'),require(_0x0baf('0x70')));_0xe4c3c4[_0x0baf('0xa')]('/api/chat/queues',require('./api/chatQueue'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x71'),require(_0x0baf('0x72')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x73'),require(_0x0baf('0x74')));_0xe4c3c4[_0x0baf('0xa')]('/api/cm/companies',require(_0x0baf('0x75')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x76'),require(_0x0baf('0x77')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x78'),require('./api/cmHopper'));_0xe4c3c4[_0x0baf('0xa')]('/api/cm/hopper_black',require(_0x0baf('0x79')));_0xe4c3c4['use'](_0x0baf('0x7a'),require('./api/cmHopperFinal'));_0xe4c3c4[_0x0baf('0xa')]('/api/cm/hopper_history',require(_0x0baf('0x7b')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x7c'),require(_0x0baf('0x7d')));_0xe4c3c4[_0x0baf('0xa')]('/api/actions',require(_0x0baf('0x7e')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x7f'),require(_0x0baf('0x80')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x81'),require('./api/cannedAnswer'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x82'),require(_0x0baf('0x83')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x84'),require(_0x0baf('0x85')));_0xe4c3c4[_0x0baf('0xa')]('/api/intervals',require('./api/interval'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x86'),require(_0x0baf('0x87')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x88'),require(_0x0baf('0x89')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x8a'),require(_0x0baf('0x8b')));_0xe4c3c4['use'](_0x0baf('0x8c'),require(_0x0baf('0x8d')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x8e'),require(_0x0baf('0x8f')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x90'),require('./api/tag'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x91'),require(_0x0baf('0x92')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x93'),require(_0x0baf('0x94')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x95'),require('./api/variable'));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations',require(_0x0baf('0x96')));_0xe4c3c4['use']('/api/integrations/reports',require(_0x0baf('0x97')));_0xe4c3c4['use'](_0x0baf('0x98'),require(_0x0baf('0x99')));_0xe4c3c4['use'](_0x0baf('0x9a'),require(_0x0baf('0x9b')));_0xe4c3c4[_0x0baf('0xa')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x9c'),require(_0x0baf('0x9d')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x9e'),require('./api/analyticFieldReport'));_0xe4c3c4[_0x0baf('0xa')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0xe4c3c4['use'](_0x0baf('0x9f'),require('./api/intSalesforceAccount'));_0xe4c3c4['use'](_0x0baf('0xa0'),require(_0x0baf('0xa1')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xa2'),require(_0x0baf('0xa3')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/sugarcrm/accounts',require(_0x0baf('0xa4')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xa5'),require(_0x0baf('0xa6')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xa7'),require('./api/intSugarcrmField'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xa8'),require(_0x0baf('0xa9')));_0xe4c3c4['use'](_0x0baf('0xaa'),require(_0x0baf('0xab')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xac'),require(_0x0baf('0xad')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xae'),require('./api/intZohoAccount'));_0xe4c3c4['use']('/api/integrations/zoho/configurations',require(_0x0baf('0xaf')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb0'),require(_0x0baf('0xb1')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb2'),require('./api/intZendeskAccount'));_0xe4c3c4['use'](_0x0baf('0xb3'),require('./api/intZendeskConfiguration'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb4'),require('./api/intZendeskField'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb5'),require(_0x0baf('0xb6')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb7'),require(_0x0baf('0xb8')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb9'),require(_0x0baf('0xba')));_0xe4c3c4['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0xe4c3c4['use']('/api/integrations/vtiger/configurations',require(_0x0baf('0xbb')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xbc'),require(_0x0baf('0xbd')));_0xe4c3c4['use'](_0x0baf('0xbe'),require(_0x0baf('0xbf')));_0xe4c3c4['use']('/api/integrations/servicenow/configurations',require(_0x0baf('0xc0')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xc1'),require(_0x0baf('0xc2')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xc3'),require(_0x0baf('0xc4')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/dynamics365/configurations',require(_0x0baf('0xc5')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/dynamics365/fields',require(_0x0baf('0xc6')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/freshsales/accounts',require(_0x0baf('0xc7')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xc8'),require(_0x0baf('0xc9')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xca'),require('./api/network'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xcb'),require(_0x0baf('0xcc')));_0xe4c3c4['use'](_0x0baf('0xcd'),require(_0x0baf('0xce')));_0xe4c3c4[_0x0baf('0xa')]('/api/jscripty/answers/reports',require(_0x0baf('0xcf')));_0xe4c3c4['use'](_0x0baf('0xd0'),require(_0x0baf('0xd1')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xd2'),require(_0x0baf('0xd3')));_0xe4c3c4['use'](_0x0baf('0xd4'),require(_0x0baf('0xd5')));_0xe4c3c4['use'](_0x0baf('0xd6'),require(_0x0baf('0xd7')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xd8'),require(_0x0baf('0xd9')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xda'),require(_0x0baf('0xdb')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xdc'),require(_0x0baf('0xdd')));_0xe4c3c4[_0x0baf('0xa')]('/api/square/odbc',require('./api/squareOdbc'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xde'),require(_0x0baf('0xdf')));_0xe4c3c4['use']('/api/square/recordings',require(_0x0baf('0xe0')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xe1'),require(_0x0baf('0xe2')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xe3'),require(_0x0baf('0xe4')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xe5'),require('./api/license'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xe6'),require(_0x0baf('0xe7')));_0xe4c3c4[_0x0baf('0xa')]('/api/migrations',require('./api/migration'));_0xe4c3c4['use'](_0x0baf('0xe8'),require(_0x0baf('0xe9')));_0xe4c3c4['use']('/api/plugins',require(_0x0baf('0xea')));_0xe4c3c4[_0x0baf('0xa')]('/api/mail/reports/transfer',require(_0x0baf('0xeb')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xec'),require(_0x0baf('0xed')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xee'),require(_0x0baf('0xef')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf0'),require(_0x0baf('0xf1')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf2'),require('./api/smsTransferReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf3'),require(_0x0baf('0xf4')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf5'),require(_0x0baf('0xf6')));_0xe4c3c4['use'](_0x0baf('0xf7'),require(_0x0baf('0xf8')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf9'),require(_0x0baf('0xfa')));_0xe4c3c4['use'](_0x0baf('0xfb'),require(_0x0baf('0xfc')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xfd'),require(_0x0baf('0xfe')));_0xe4c3c4['use']('/api/whatsapp/accounts',require(_0x0baf('0xff')));_0xe4c3c4['use'](_0x0baf('0x100'),require('./api/whatsappApplication'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x101'),require(_0x0baf('0x102')));_0xe4c3c4[_0x0baf('0xa')]('/api/whatsapp/messages',require(_0x0baf('0x103')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x104'),require('./api/whatsappQueueReport'));_0xe4c3c4['use']('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x105'),require(_0x0baf('0x106')));_0xe4c3c4[_0x0baf('0xa')]('/api/cloudProviders',require(_0x0baf('0x107')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x108'),require('./api/authLocal'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x109'),require('./api/authGoogle'));_0xe4c3c4[_0x0baf('0xa')]('/api/jira',require(_0x0baf('0x10a')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x10b'),require(_0x0baf('0x10c')));_0xe4c3c4['use']('/api/version',require(_0x0baf('0x10d')));_0xe4c3c4['use'](_0x0baf('0x10e'),require(_0x0baf('0x10f')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x110'),require(_0x0baf('0x111')));_0xe4c3c4['use'](_0x0baf('0x112'),require('./api/webbar'));_0xe4c3c4[_0x0baf('0xa')]('/apidoc',express[_0x0baf('0x113')](path['join'](config[_0x0baf('0x114')],_0x0baf('0x115'))));_0xe4c3c4[_0x0baf('0xa')]('/www',express['static'](path[_0x0baf('0x116')](config[_0x0baf('0x114')],_0x0baf('0x117'))));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x118'),express[_0x0baf('0x113')](path['join'](config[_0x0baf('0x114')],'/demo')));_0xe4c3c4[_0x0baf('0xa')]('/snippet',express[_0x0baf('0x113')](path[_0x0baf('0x116')](config[_0x0baf('0x114')],'snippet',_0x0baf('0x119'))));_0xe4c3c4[_0x0baf('0xa')]('/plugins',express['static'](path[_0x0baf('0x116')](config[_0x0baf('0x114')],_0x0baf('0x11a'))));_0xe4c3c4[_0x0baf('0x11b')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0xe4c3c4[_0x0baf('0x11b')]('/*')[_0x0baf('0x11c')](function(_0x116d52,_0x2c7417){_0x2c7417[_0x0baf('0x11d')](path[_0x0baf('0x11e')](_0xe4c3c4[_0x0baf('0x11c')](_0x0baf('0x11f'))+_0x0baf('0x120')));});};var sensitiveFields=[_0x0baf('0x121'),'password',_0x0baf('0x122'),'apiKey',_0x0baf('0x123'),_0x0baf('0x124'),_0x0baf('0x125'),_0x0baf('0x126'),'mobile',_0x0baf('0x127'),_0x0baf('0x128'),_0x0baf('0x129'),_0x0baf('0x12a'),_0x0baf('0x12b'),_0x0baf('0x12c'),_0x0baf('0x12d'),_0x0baf('0x12e'),_0x0baf('0x12f'),'channelSecret',_0x0baf('0x130'),_0x0baf('0x131'),'authToken',_0x0baf('0x132'),_0x0baf('0x133'),_0x0baf('0x134'),_0x0baf('0x135'),_0x0baf('0x136'),_0x0baf('0x137'),_0x0baf('0x138'),_0x0baf('0x139'),_0x0baf('0x13a'),'accesskeyid',_0x0baf('0x13b'),_0x0baf('0x13c'),_0x0baf('0x16'),_0x0baf('0x13d'),_0x0baf('0x13e'),_0x0baf('0x13f'),'dsn',_0x0baf('0x140'),_0x0baf('0x141'),_0x0baf('0x142')];function maskSensitiveData(_0x5c1760){var _0x49855a=/(?!^)[\s\S](?!$)/g;for(var _0x5adbd9 in _0x5c1760){if(_[_0x0baf('0x143')](_0x5c1760[_0x5adbd9])){for(var _0x30896e=0x0;_0x30896e<_0x5c1760[_0x5adbd9]['length'];_0x30896e++){maskSensitiveData(_0x5c1760[_0x5adbd9][_0x30896e]);}}else if(_[_0x0baf('0x144')](_0x5c1760[_0x5adbd9])){maskSensitiveData(_0x5c1760[_0x5adbd9]);}else if(_['isString'](_0x5c1760[_0x5adbd9])){_0x5c1760[_0x5adbd9]=_0x5c1760[_0x5adbd9][_0x0baf('0x145')](/{{{/g,'@@{')[_0x0baf('0x145')](/}}}/g,_0x0baf('0x146'))['replace'](/{{/g,'@{')[_0x0baf('0x145')](/}}/g,'}@');if(_[_0x0baf('0x147')](sensitiveFields,_0x5adbd9)){_0x5c1760[_0x5adbd9]=_0x5c1760[_0x5adbd9][_0x0baf('0x145')](_0x49855a,'*');}}}} \ No newline at end of file +var _0x757a=['/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','length','isPlainObject','isString','replace','path','express','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','remoteAddress','statusCode','name','agent_id','agent_name','url','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany'];(function(_0x2e0e91,_0x393e3d){var _0x173430=function(_0xd7803e){while(--_0xd7803e){_0x2e0e91['push'](_0x2e0e91['shift']());}};_0x173430(++_0x393e3d);}(_0x757a,0xde));var _0xa757=function(_0x521f88,_0x3c6750){_0x521f88=_0x521f88-0x0;var _0x45a8a8=_0x757a[_0x521f88];return _0x45a8a8;};'use strict';var _=require('lodash');var path=require(_0xa757('0x0'));var express=require(_0xa757('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require('./errors');var config=require(_0xa757('0x2'));var logger=require(_0xa757('0x3'))(_0xa757('0x4'));var authLogger=require(_0xa757('0x3'))(_0xa757('0x5'));exports[_0xa757('0x6')]=function(_0x5edca8){_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x53be0e,_0x2930fa){var _0x2f7793=_0xa757('0x9');if(!_[_0xa757('0xa')](_0x53be0e[_0xa757('0xb')])){_0x2f7793+='\x20body=%s';var _0x89c630=_0x53be0e[_0xa757('0xb')];maskSensitiveData(_0x89c630);}return util[_0xa757('0xc')](_0x2f7793,_0x53be0e[_0xa757('0xd')],_0x53be0e[_0xa757('0xe')][_0xa757('0xf')]?_0x53be0e[_0xa757('0xe')]['x-forwarded-for']:_0x53be0e['connection']['remoteAddress']||_0x53be0e['ip'],_0x53be0e['url'],_0x2930fa['statusCode'],_0x2930fa[_0xa757('0x10')],_0x53be0e['user']?_0x53be0e['user']['id']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e['user']['name']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e[_0xa757('0x11')][_0xa757('0x12')]:null,_0x89c630?util[_0xa757('0x13')](_0x89c630,![],null):'');}}));_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xf12b68,_0x2f7947){var _0x185011=_0xa757('0x14');if(_0xf12b68['body']&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]&&_0xf12b68[_0xa757('0xb')]['agent_id']){_0x185011='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa757('0xc')](_0x185011,_0xf12b68[_0xa757('0xd')],_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]?_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]:_0xf12b68['connection'][_0xa757('0x16')]||_0xf12b68['ip'],_0xf12b68['url'],_0x2f7947[_0xa757('0x17')],_0x2f7947[_0xa757('0x10')],_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')]['id']:null,_0xf12b68['user']?_0xf12b68['user'][_0xa757('0x18')]:null,_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')][_0xa757('0x12')]:null,_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]?_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]:'other',_0xf12b68[_0xa757('0xb')]&&_0xf12b68['body'][_0xa757('0x19')]?_0xf12b68['body'][_0xa757('0x19')]:'',_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')]['agent_name']?_0xf12b68[_0xa757('0xb')][_0xa757('0x1a')]:'');},'ignoreRoute':function(_0x471e84){var _0x3bf7f3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3bf7f3['test'](_0x471e84[_0xa757('0x1b')]);}}));_0x5edca8['use']('/api/users',require('./api/user'));_0x5edca8['use'](_0xa757('0x1c'),require('./api/voiceChanSpy'));_0x5edca8[_0xa757('0x7')](_0xa757('0x1d'),require('./api/voiceContext'));_0x5edca8[_0xa757('0x7')]('/api/voice/extensions',require(_0xa757('0x1e')));_0x5edca8[_0xa757('0x7')]('/api/voice/mohs',require(_0xa757('0x1f')));_0x5edca8['use'](_0xa757('0x20'),require(_0xa757('0x21')));_0x5edca8[_0xa757('0x7')](_0xa757('0x22'),require(_0xa757('0x23')));_0x5edca8[_0xa757('0x7')](_0xa757('0x24'),require(_0xa757('0x25')));_0x5edca8[_0xa757('0x7')](_0xa757('0x26'),require(_0xa757('0x27')));_0x5edca8[_0xa757('0x7')](_0xa757('0x28'),require(_0xa757('0x29')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2a'),require(_0xa757('0x2b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2c'),require(_0xa757('0x2d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2e'),require(_0xa757('0x2f')));_0x5edca8[_0xa757('0x7')]('/api/voice/queues/reports',require(_0xa757('0x30')));_0x5edca8[_0xa757('0x7')](_0xa757('0x31'),require(_0xa757('0x32')));_0x5edca8[_0xa757('0x7')]('/api/trunks',require(_0xa757('0x33')));_0x5edca8[_0xa757('0x7')](_0xa757('0x34'),require(_0xa757('0x35')));_0x5edca8[_0xa757('0x7')](_0xa757('0x36'),require('./api/mailServerOut'));_0x5edca8[_0xa757('0x7')](_0xa757('0x37'),require(_0xa757('0x38')));_0x5edca8[_0xa757('0x7')](_0xa757('0x39'),require(_0xa757('0x3a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3b'),require(_0xa757('0x3c')));_0x5edca8['use'](_0xa757('0x3d'),require(_0xa757('0x3e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3f'),require(_0xa757('0x40')));_0x5edca8[_0xa757('0x7')]('/api/mail/applications',require(_0xa757('0x41')));_0x5edca8[_0xa757('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x42'),require('./api/dashboard'));_0x5edca8['use'](_0xa757('0x43'),require(_0xa757('0x44')));_0x5edca8[_0xa757('0x7')]('/api/fax/accounts',require(_0xa757('0x45')));_0x5edca8[_0xa757('0x7')](_0xa757('0x46'),require(_0xa757('0x47')));_0x5edca8[_0xa757('0x7')]('/api/fax/interactions',require(_0xa757('0x48')));_0x5edca8['use']('/api/fax/messages',require(_0xa757('0x49')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4a'),require(_0xa757('0x4b')));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x4c'),require(_0xa757('0x4d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4e'),require(_0xa757('0x4f')));_0x5edca8['use'](_0xa757('0x50'),require(_0xa757('0x51')));_0x5edca8['use'](_0xa757('0x52'),require('./api/smsMessage'));_0x5edca8[_0xa757('0x7')](_0xa757('0x53'),require('./api/smsQueue'));_0x5edca8[_0xa757('0x7')](_0xa757('0x54'),require('./api/openchannelAccount'));_0x5edca8[_0xa757('0x7')](_0xa757('0x55'),require(_0xa757('0x56')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/interactions',require(_0xa757('0x57')));_0x5edca8[_0xa757('0x7')](_0xa757('0x58'),require(_0xa757('0x59')));_0x5edca8['use'](_0xa757('0x5a'),require('./api/openchannelQueue'));_0x5edca8['use'](_0xa757('0x5b'),require(_0xa757('0x5c')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/queue',require(_0xa757('0x5d')));_0x5edca8['use'](_0xa757('0x5e'),require(_0xa757('0x5f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x60'),require(_0xa757('0x61')));_0x5edca8[_0xa757('0x7')](_0xa757('0x62'),require(_0xa757('0x63')));_0x5edca8['use'](_0xa757('0x64'),require(_0xa757('0x65')));_0x5edca8[_0xa757('0x7')](_0xa757('0x66'),require(_0xa757('0x67')));_0x5edca8[_0xa757('0x7')](_0xa757('0x68'),require(_0xa757('0x69')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6a'),require(_0xa757('0x6b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6c'),require(_0xa757('0x6d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6e'),require('./api/cmContact'));_0x5edca8[_0xa757('0x7')]('/api/cm/hopper',require(_0xa757('0x6f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x70'),require(_0xa757('0x71')));_0x5edca8['use'](_0xa757('0x72'),require(_0xa757('0x73')));_0x5edca8[_0xa757('0x7')](_0xa757('0x74'),require('./api/cmHopperHistory'));_0x5edca8[_0xa757('0x7')](_0xa757('0x75'),require(_0xa757('0x76')));_0x5edca8[_0xa757('0x7')](_0xa757('0x77'),require(_0xa757('0x78')));_0x5edca8['use']('/api/automations',require('./api/automation'));_0x5edca8['use'](_0xa757('0x79'),require(_0xa757('0x7a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7b'),require(_0xa757('0x7c')));_0x5edca8[_0xa757('0x7')]('/api/conditions',require(_0xa757('0x7d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7e'),require(_0xa757('0x7f')));_0x5edca8['use'](_0xa757('0x80'),require(_0xa757('0x81')));_0x5edca8['use'](_0xa757('0x82'),require('./api/cdr'));_0x5edca8[_0xa757('0x7')]('/api/voiceQueuesLog',require(_0xa757('0x83')));_0x5edca8['use']('/api/schedules',require(_0xa757('0x84')));_0x5edca8[_0xa757('0x7')](_0xa757('0x85'),require(_0xa757('0x86')));_0x5edca8[_0xa757('0x7')](_0xa757('0x87'),require('./api/tag'));_0x5edca8['use'](_0xa757('0x88'),require(_0xa757('0x89')));_0x5edca8[_0xa757('0x7')]('/api/triggers',require('./api/trigger'));_0x5edca8[_0xa757('0x7')](_0xa757('0x8a'),require(_0xa757('0x8b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x8c'),require(_0xa757('0x8d')));_0x5edca8['use'](_0xa757('0x8e'),require(_0xa757('0x8f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x90'),require(_0xa757('0x91')));_0x5edca8[_0xa757('0x7')](_0xa757('0x92'),require(_0xa757('0x93')));_0x5edca8[_0xa757('0x7')](_0xa757('0x94'),require('./api/analyticExtractedReport'));_0x5edca8[_0xa757('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x5edca8[_0xa757('0x7')](_0xa757('0x95'),require(_0xa757('0x96')));_0x5edca8[_0xa757('0x7')](_0xa757('0x97'),require(_0xa757('0x98')));_0x5edca8[_0xa757('0x7')](_0xa757('0x99'),require(_0xa757('0x9a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9b'),require('./api/intSalesforceConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9c'),require('./api/intSalesforceField'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9d'),require(_0xa757('0x9e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9f'),require(_0xa757('0xa0')));_0x5edca8['use'](_0xa757('0xa1'),require('./api/intSugarcrmField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xa2'),require(_0xa757('0xa3')));_0x5edca8[_0xa757('0x7')](_0xa757('0xa4'),require('./api/intDeskConfiguration'));_0x5edca8['use'](_0xa757('0xa5'),require(_0xa757('0xa6')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zoho/accounts',require(_0xa757('0xa7')));_0x5edca8['use'](_0xa757('0xa8'),require(_0xa757('0xa9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xaa'),require(_0xa757('0xab')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/accounts',require(_0xa757('0xac')));_0x5edca8[_0xa757('0x7')](_0xa757('0xad'),require(_0xa757('0xae')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/fields',require(_0xa757('0xaf')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb0'),require(_0xa757('0xb1')));_0x5edca8[_0xa757('0x7')]('/api/integrations/freshdesk/configurations',require(_0xa757('0xb2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb3'),require('./api/intFreshdeskField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xb4'),require(_0xa757('0xb5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb6'),require(_0xa757('0xb7')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb8'),require(_0xa757('0xb9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xba'),require(_0xa757('0xbb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xbc'),require('./api/intServicenowConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbd'),require('./api/intServicenowField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbe'),require('./api/intDynamics365Account'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbf'),require(_0xa757('0xc0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc1'),require(_0xa757('0xc2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc3'),require(_0xa757('0xc4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc5'),require(_0xa757('0xc6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc7'),require(_0xa757('0xc8')));_0x5edca8[_0xa757('0x7')]('/api/networks',require(_0xa757('0xc9')));_0x5edca8['use'](_0xa757('0xca'),require(_0xa757('0xcb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xcc'),require(_0xa757('0xcd')));_0x5edca8['use'](_0xa757('0xce'),require(_0xa757('0xcf')));_0x5edca8[_0xa757('0x7')]('/api/jscripty/questions/reports',require(_0xa757('0xd0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd1'),require('./api/jscriptySessionReport'));_0x5edca8['use'](_0xa757('0xd2'),require(_0xa757('0xd3')));_0x5edca8[_0xa757('0x7')]('/api/square/reports',require(_0xa757('0xd4')));_0x5edca8['use']('/api/square/details/reports',require(_0xa757('0xd5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd6'),require('./api/jscriptyProject'));_0x5edca8[_0xa757('0x7')](_0xa757('0xd7'),require(_0xa757('0xd8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd9'),require(_0xa757('0xda')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdb'),require(_0xa757('0xdc')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdd'),require(_0xa757('0xde')));_0x5edca8['use'](_0xa757('0xdf'),require(_0xa757('0xe0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe1'),require(_0xa757('0xe2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe3'),require(_0xa757('0xe4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe5'),require(_0xa757('0xe6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe7'),require(_0xa757('0xe8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe9'),require(_0xa757('0xea')));_0x5edca8[_0xa757('0x7')](_0xa757('0xeb'),require(_0xa757('0xec')));_0x5edca8[_0xa757('0x7')](_0xa757('0xed'),require('./api/mailTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0xee'),require('./api/chatTransferReport'));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/transfer',require(_0xa757('0xef')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/transfer',require(_0xa757('0xf0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf1'),require(_0xa757('0xf2')));_0x5edca8['use'](_0xa757('0xf3'),require(_0xa757('0xf4')));_0x5edca8['use'](_0xa757('0xf5'),require(_0xa757('0xf6')));_0x5edca8['use'](_0xa757('0xf7'),require(_0xa757('0xf8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf9'),require(_0xa757('0xfa')));_0x5edca8[_0xa757('0x7')](_0xa757('0xfb'),require(_0xa757('0xfc')));_0x5edca8[_0xa757('0x7')]('/api/notifications',require('./api/notification'));_0x5edca8[_0xa757('0x7')](_0xa757('0xfd'),require(_0xa757('0xfe')));_0x5edca8[_0xa757('0x7')](_0xa757('0xff'),require(_0xa757('0x100')));_0x5edca8[_0xa757('0x7')]('/api/whatsapp/interactions',require(_0xa757('0x101')));_0x5edca8['use'](_0xa757('0x102'),require(_0xa757('0x103')));_0x5edca8[_0xa757('0x7')](_0xa757('0x104'),require(_0xa757('0x105')));_0x5edca8['use'](_0xa757('0x106'),require('./api/whatsappTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x107'),require(_0xa757('0x108')));_0x5edca8[_0xa757('0x7')]('/api/cloudProviders',require(_0xa757('0x109')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10a'),require(_0xa757('0x10b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10c'),require(_0xa757('0x10d')));_0x5edca8[_0xa757('0x7')]('/api/jira',require(_0xa757('0x10e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10f'),require(_0xa757('0x110')));_0x5edca8['use'](_0xa757('0x111'),require(_0xa757('0x112')));_0x5edca8[_0xa757('0x7')](_0xa757('0x113'),require(_0xa757('0x114')));_0x5edca8[_0xa757('0x7')](_0xa757('0x115'),require('./api/pm2'));_0x5edca8['use'](_0xa757('0x116'),require('./api/webbar'));_0x5edca8[_0xa757('0x7')]('/apidoc',express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x119'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11a'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11a'))));_0x5edca8[_0xa757('0x7')]('/demo',express[_0xa757('0x11b')](path['join'](config[_0xa757('0x118')],_0xa757('0x11c'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11d'),express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11e'),_0xa757('0x11f'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x120'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x121'))));_0x5edca8[_0xa757('0x122')](_0xa757('0x123'))[_0xa757('0x124')](errors[0x194]);_0x5edca8[_0xa757('0x122')]('/*')[_0xa757('0x124')](function(_0x56a060,_0x4af060){_0x4af060[_0xa757('0x125')](path['resolve'](_0x5edca8[_0xa757('0x124')](_0xa757('0x126'))+_0xa757('0x127')));});};var sensitiveFields=[_0xa757('0x128'),'password',_0xa757('0x129'),_0xa757('0x12a'),_0xa757('0x12b'),_0xa757('0x12c'),_0xa757('0x12d'),_0xa757('0x12e'),'mobile',_0xa757('0x12f'),_0xa757('0x130'),_0xa757('0x131'),_0xa757('0x132'),_0xa757('0x133'),'code','accessKey',_0xa757('0x134'),'token',_0xa757('0x135'),'accessToken',_0xa757('0x136'),_0xa757('0x137'),_0xa757('0x138'),_0xa757('0x139'),_0xa757('0x13a'),_0xa757('0x13b'),_0xa757('0x13c'),_0xa757('0x13d'),_0xa757('0x13e'),_0xa757('0x13f'),_0xa757('0x140'),'accesskeyid',_0xa757('0x141'),_0xa757('0x142'),_0xa757('0x11'),_0xa757('0x143'),_0xa757('0x144'),_0xa757('0x145'),'dsn',_0xa757('0x146'),_0xa757('0x147'),'oldPassword'];function maskSensitiveData(_0x133f0c){var _0x68a80b=/(?!^)[\s\S](?!$)/g;for(var _0x1f4782 in _0x133f0c){if(_['isArray'](_0x133f0c[_0x1f4782])){for(var _0x3ae3bf=0x0;_0x3ae3bf<_0x133f0c[_0x1f4782][_0xa757('0x148')];_0x3ae3bf++){maskSensitiveData(_0x133f0c[_0x1f4782][_0x3ae3bf]);}}else if(_[_0xa757('0x149')](_0x133f0c[_0x1f4782])){maskSensitiveData(_0x133f0c[_0x1f4782]);}else if(_[_0xa757('0x14a')](_0x133f0c[_0x1f4782])){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782][_0xa757('0x14b')](/{{{/g,'@@{')[_0xa757('0x14b')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa757('0x14b')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1f4782)){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782]['replace'](_0x68a80b,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index b814d3d..045f375 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a55=['../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a55,0x1ce));var _0x54a5=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x4a55[_0x17928f];return _0x500b63;};'use strict';var jayson=require(_0x54a5('0x0'));var BPromise=require(_0x54a5('0x1'));var _=require(_0x54a5('0x2'));var config=require(_0x54a5('0x3'));exports[_0x54a5('0x4')]=function(){return new BPromise(function(_0x566368,_0x138637){var _0x36fd51={};_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x5')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x7')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x8')));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x9')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0xa')));_0x36fd51=_['merge'](_0x36fd51,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0xb')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0xc')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0xd')));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0xe')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0xf')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/mailServerIn/mailServerIn.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x10')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/mailQueue/mailQueue.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/mailInteraction/mailInteraction.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x11')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/mailApplication/mailApplication.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x12')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x13')));_0x36fd51=_['merge'](_0x36fd51,require('../api/faxApplication/faxApplication.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x14')));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x15')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x16')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x17')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x18')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/smsInteraction/smsInteraction.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x19')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/smsQueue/smsQueue.rpc'));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x1a')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x1b')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x1c')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/chatInteraction/chatInteraction.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x1d')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/chatQueue/chatQueue.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x1e')));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x1f')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x20')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x21')));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x22')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x23')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/pause/pause.rpc'));_0x36fd51=_['merge'](_0x36fd51,require('../api/sound/sound.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/template/template.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x24')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x25')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x26')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x27')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x28')));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x29')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x2a')));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x2b')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x2c')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x2d')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x2e')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x2f')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x30')));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x31')));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x32')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x33')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/squareRecording/squareRecording.rpc'));_0x36fd51=_['merge'](_0x36fd51,require(_0x54a5('0x34')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/campaign/campaign.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x35')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x36')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x37')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x38')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x39')));_0x36fd51=_[_0x54a5('0x6')](_0x36fd51,require(_0x54a5('0x3a')));var _0x93ccc8=jayson['server'](_0x36fd51)[_0x54a5('0x3b')]();var _0x3bac46=config[_0x54a5('0x3c')][_0x54a5('0x3d')]||config['port']+0x1;var _0x572b51=config[_0x54a5('0x3c')]['ip']||_0x54a5('0x3e');_0x93ccc8['on'](_0x54a5('0x3f'),function(_0x179355){return _0x138637(_0x179355);});_0x93ccc8[_0x54a5('0x4')](_0x3bac46,_0x572b51,function(){console[_0x54a5('0x40')](_0x54a5('0x41'),_0x572b51,_0x3bac46);require(_0x54a5('0x42'))[_0x54a5('0x43')]();return _0x566368(_0x54a5('0x44')+_0x572b51+':'+_0x3bac46);});});}; \ No newline at end of file +var _0x605e=['../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x605e,0x139));var _0xe605=function(_0x92351,_0x3ffbd9){_0x92351=_0x92351-0x0;var _0x4c93b1=_0x605e[_0x92351];return _0x4c93b1;};'use strict';var jayson=require(_0xe605('0x0'));var BPromise=require(_0xe605('0x1'));var _=require('lodash');var config=require(_0xe605('0x2'));exports['listen']=function(){return new BPromise(function(_0x485aa1,_0x19fd84){var _0x4aa12c={};_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x4')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x5')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x6')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x7')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x8')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x9')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xa')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/trunk/trunk.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xb')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xc')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xd')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xe')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/mailQueue/mailQueue.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xf')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/mailMessage/mailMessage.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x10')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x11')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/faxAccount/faxAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/faxApplication/faxApplication.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x12')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x13')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/faxQueue/faxQueue.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x14')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x15')));_0x4aa12c=_['merge'](_0x4aa12c,require('../api/smsInteraction/smsInteraction.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x16')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x17')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x18')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x19')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x1a')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x1b')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x1c')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x1d')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/chatMessage/chatMessage.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x1e')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x1f')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x20')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x21')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x22')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x23')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x24')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/interval/interval.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require('../api/pause/pause.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x25')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/template/template.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/trigger/trigger.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x26')));_0x4aa12c=_['merge'](_0x4aa12c,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x27')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x28')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x29')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x2a')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x2b')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x2c')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x2d')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/squareReport/squareReport.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x2e')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/squareProject/squareProject.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x2f')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x30')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x31')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x32')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/plugin/plugin.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x33')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x34')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x35')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x36')));var _0x4e9742=jayson[_0xe605('0x37')](_0x4aa12c)[_0xe605('0x38')]();var _0x8d3da9=config[_0xe605('0x39')][_0xe605('0x3a')]||config['port']+0x1;var _0x23b5d3=config['rpc']['ip']||_0xe605('0x3b');_0x4e9742['on'](_0xe605('0x3c'),function(_0x5200a2){return _0x19fd84(_0x5200a2);});_0x4e9742[_0xe605('0x3d')](_0x8d3da9,_0x23b5d3,function(){console['log'](_0xe605('0x3e'),_0x23b5d3,_0x8d3da9);require(_0xe605('0x3f'))[_0xe605('0x40')]();return _0x485aa1(_0xe605('0x41')+_0x23b5d3+':'+_0x8d3da9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e2d007b..d6f8434 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s'];(function(_0x47b4c5,_0x1aab77){var _0x45d1a8=function(_0x4e9936){while(--_0x4e9936){_0x47b4c5['push'](_0x47b4c5['shift']());}};_0x45d1a8(++_0x1aab77);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3071('0x0'))[_0x3071('0x1')];var AGIReply=require(_0x3071('0x2'));var AGIError=require(_0x3071('0x3'));function AGIChannel(_0x864539){var _0x52b5fb=this,_0x2c547f=new AGIReply(),_0x7b18a4=![],_0x33a70c={};EventEmitter[_0x3071('0x4')](_0x52b5fb);_0x864539[_0x3071('0x5')](_0x3071('0x6'));_0x864539[_0x3071('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2c547f[_0x3071('0x5')](_0x3071('0x6'));_0x2c547f['on'](_0x3071('0x8'),function(_0x3e9a5e){for(var _0x2fce7a in _0x3e9a5e){_0x52b5fb[_0x2fce7a]=_0x3e9a5e[_0x2fce7a];}_0x52b5fb[_0x3071('0x9')]('ready');});_0x2c547f['on'](_0x3071('0xa'),function(_0x2610b4){if(_0x2610b4[_0x3071('0xb')]()==_0x3071('0xc')){_0x52b5fb[_0x3071('0x9')]('hangup');return;}if(_0x2610b4[_0x3071('0xd')](0x0,0xb)==_0x3071('0xe')){_0x7b18a4=!![];}if(_0x7b18a4){_0x33a70c['rx']+=_0x2610b4+'\x0a';if(_0x2610b4[_0x3071('0xf')](_0x3071('0x10'))!=-0x1){_0x7b18a4=![];}}else{_0x33a70c['rx']=_0x2610b4;}if(_0x7b18a4){return;}if(typeof _0x33a70c['cb']==_0x3071('0x11')){var _0x4a8cc7=_0x33a70c['rx']['substring'](0x0,0x3),_0x5330a8=null,_0x1826ca=null;_0x4a8cc7=parseInt(_0x4a8cc7);if(isNaN(_0x4a8cc7)){_0x33a70c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3071('0x12')});return;}if(_0x4a8cc7!=0xc8){_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':-0x1,'extra':'KO'});return;}_0x5330a8=_0x33a70c['rx'][_0x3071('0xd')](0x4)['replace'](_0x3071('0x13'),'');if(_0x5330a8['indexOf']('\x20')!=-0x1){_0x5330a8=_0x5330a8[_0x3071('0x14')](0x0,_0x5330a8[_0x3071('0x15')]('\x20'));}if(_[_0x3071('0x16')](_0x5330a8,'-1')){_0x5330a8=parseInt(_0x5330a8);}_0x1826ca=_0x33a70c['rx'][_0x3071('0x17')]('\x20');if(_0x1826ca[_0x3071('0x18')]==0x3){_0x1826ca=_0x1826ca[0x2][_0x3071('0xd')](0x1,_0x1826ca[0x2][_0x3071('0x18')]-0x1);}else if(_0x1826ca[_0x3071('0x18')]>0x3){var _0x21aad3=/\((.+)\)/;var _0x344ea6=_0x33a70c['rx']['match'](_0x21aad3);if(_0x344ea6){_0x1826ca=_0x344ea6[0x1];}else{_0x1826ca=null;}}else{_0x1826ca=null;}_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':_0x5330a8,'extra':_0x1826ca});}});_0x864539['on'](_0x3071('0x19'),function(_0x17dbda){_0x52b5fb[_0x3071('0x9')](_0x3071('0x19'),new AGIError(_0x3071('0x1a'),_0x17dbda[_0x3071('0x1b')]));});_0x864539['on'](_0x3071('0x1c'),function(){_0x52b5fb[_0x3071('0x9')]('close',new AGIError(_0x3071('0x1d')));});_0x864539['on'](_0x3071('0x1e'),function(){_0x52b5fb[_0x3071('0x9')]('timeout',new AGIError(_0x3071('0x1f')));_0x864539['destroy']();});_0x864539[_0x3071('0x20')](_0x2c547f);this[_0x3071('0x21')]=function(_0x3762d8,_0x457b57){var _0x3762d8=_0x3762d8||'',_0x457b57=typeof _0x457b57==_0x3071('0x11')?_0x457b57:new Function();_0x33a70c={'tx':_0x3762d8,'rx':'','cb':_0x457b57};_0x864539[_0x3071('0x22')](_0x3762d8+'\x0a');},this['close']=function(){_0x864539['destroy']();};}util[_0x3071('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x3071('0x24')][_0x3071('0x25')]=function(_0x13df9f){return this[_0x3071('0x21')][_0x3071('0x26')](this,_0x13df9f);};AGIChannel[_0x3071('0x24')][_0x3071('0x27')]=function(){return this[_0x3071('0x25')]('ANSWER');};AGIChannel[_0x3071('0x24')][_0x3071('0x28')]=function(_0x177138,_0x4d5c4b,_0x4fb1ca){_0x177138=_0x177138===undefined?_0x3071('0x29'):_0x177138;_0x4d5c4b=_0x4d5c4b===undefined?'5':_0x4d5c4b;_0x4fb1ca=_0x4fb1ca===undefined?'1':_0x4fb1ca;return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x2b'),_0x177138,_0x4d5c4b*0x3e8,_0x4fb1ca));};AGIChannel[_0x3071('0x24')][_0x3071('0x2c')]=function(_0x3921a1){_0x3921a1=_0x3921a1||_0x3071('0x2d');return this[_0x3071('0x25')](util[_0x3071('0x2a')]('VERBOSE\x20\x22%s\x22',_0x3921a1));};AGIChannel['prototype'][_0x3071('0x2e')]=function(_0x149e0d,_0x6ddf96){if(_[_0x3071('0x2f')](_0x6ddf96)){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x30'),_0x149e0d,_0x6ddf96[_0x3071('0x31')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x149e0d,_0x6ddf96));};AGIChannel[_0x3071('0x24')][_0x3071('0x32')]=function(_0x5b5bf1){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x33'),_0x5b5bf1));};AGIChannel[_0x3071('0x24')]['setExtension']=function(_0x218a82){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x34'),_0x218a82));};AGIChannel[_0x3071('0x24')][_0x3071('0x35')]=function(_0x3c55c){return this[_0x3071('0x25')](util['format'](_0x3071('0x36'),_0x3c55c));};AGIChannel['prototype']['hangup']=function(){return this[_0x3071('0x25')](_0x3071('0x37'));};AGIChannel['prototype'][_0x3071('0x38')]=function(_0x46e94e,_0x265d76){var _0x14ac42=_[_0x3071('0x39')](_0x265d76)||_[_0x3071('0x3a')](_0x265d76)?_0x265d76['toString']():_0x265d76;return this[_0x3071('0x25')](util[_0x3071('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x46e94e,_0x14ac42?_0x14ac42[_0x3071('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3071('0x24')][_0x3071('0x3c')]=function(_0x5733e9,_0x593c99){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x3d'),_0x5733e9,_0x593c99));};AGIChannel['prototype'][_0x3071('0x3e')]=function(_0x534a77,_0x1ac90a){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x3f'),_0x534a77,_0x1ac90a));};AGIChannel[_0x3071('0x24')][_0x3071('0x40')]=function(_0x30ab68,_0x593c9c){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x41'),_0x30ab68,_0x593c9c));};AGIChannel[_0x3071('0x24')][_0x3071('0x42')]=function(_0x525389,_0x3cfc05,_0x60549a){_0x3cfc05=_0x3cfc05||this[_0x3071('0x43')];_0x60549a=_0x60549a||0x1;this[_0x3071('0x32')](_0x525389);this[_0x3071('0x44')](_0x3cfc05);this[_0x3071('0x35')](_0x60549a);return this['noop'](util[_0x3071('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x525389,_0x3cfc05,_0x60549a));};AGIChannel['prototype']['getVariable']=function(_0x47ceaf){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x45'),_0x47ceaf));};AGIChannel[_0x3071('0x24')][_0x3071('0x46')]=function(_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1e8222,_0x1641d9){_0xa711b5=_0xa711b5||_0x3071('0x47');_0x2e6c70=_0x2e6c70||'';_0x56589e=_0x56589e===undefined?-0x1:_0x56589e==='-1'?-0x1:_0x56589e*0x3e8;_0x1e8222=_0x1e8222===undefined?'':'s='+_0x1e8222;_0x1641d9=_0x1641d9?_0x3071('0x48'):'';return this[_0x3071('0x25')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1641d9,_0x1e8222));};AGIChannel[_0x3071('0x24')][_0x3071('0x49')]=function(_0x1fe5e0,_0x5c5865){_0x5c5865=_0x5c5865||'';return this[_0x3071('0x25')](util['format'](_0x3071('0x4a'),_0x1fe5e0,_0x5c5865));};AGIChannel['prototype'][_0x3071('0x4b')]=function(_0x509178){return this['exec'](_0x3071('0x4c'),_0x509178);};AGIChannel['prototype'][_0x3071('0x4d')]=function(_0x5a0a69){return this[_0x3071('0x2e')](_0x3071('0x4e'),_0x5a0a69);};AGIChannel[_0x3071('0x24')][_0x3071('0x19')]=function(_0x554047,_0x2d70bf){this['noop'](util[_0x3071('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x554047['id'],_0x554047[_0x3071('0x4f')],_0x2d70bf));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3071('0x50')]=AGIChannel; \ No newline at end of file +var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 2c55888..a304565 100644 --- a/server/services/agi/error.js +++ b/server/services/agi/error.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe74d=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util','Undefined\x20error.'];(function(_0x16895e,_0x47624f){var _0x5cba8e=function(_0x38725f){while(--_0x38725f){_0x16895e['push'](_0x16895e['shift']());}};_0x5cba8e(++_0x47624f);}(_0xe74d,0x16e));var _0xde74=function(_0x5d99ad,_0x15d2b5){_0x5d99ad=_0x5d99ad-0x0;var _0x453124=_0xe74d[_0x5d99ad];return _0x453124;};'use strict';var util=require(_0xde74('0x0'));var error={'E_AGI_UNDEFINED':_0xde74('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xde74('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xde74('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xde74('0x4'),'E_AGI_SOCKET_ERROR':_0xde74('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xde74('0x6'),'E_AGI_COMMAND_EMPTY':_0xde74('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xde74('0x8'),'E_AGI_IVR_ENTRY':_0xde74('0x9')};function AGIError(_0x4800a3){var _0x4800a3=_0x4800a3||null,_0x2520d3=_0x2520d3||[],_0x4724a0=0x1,_0x12988d='';if(!error[_0x4800a3]){_0x4800a3=_0xde74('0xa');}_0x2520d3[_0xde74('0xb')](error[_0x4800a3]);while(arguments[_0x4724a0]){_0x2520d3[_0xde74('0xb')](arguments[_0x4724a0]);_0x4724a0++;}_0x12988d=util[_0xde74('0xc')][_0xde74('0xd')](util,_0x2520d3);this[_0xde74('0xe')]=_0x12988d;this[_0xde74('0xf')]=_0x4800a3;}module['exports']=AGIError; \ No newline at end of file +var _0x1fdc=['apply','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x1fdc[_0x20d54d];return _0x516e8b;};'use strict';var util=require(_0xc1fd('0x0'));var error={'E_AGI_UNDEFINED':_0xc1fd('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc1fd('0x2'),'E_AGI_SERVER_CLOSE':_0xc1fd('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xc1fd('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xc1fd('0x5'),'E_AGI_SOCKET_ERROR':_0xc1fd('0x6'),'E_AGI_SOCKET_CLOSE':_0xc1fd('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xc1fd('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc1fd('0x9'),'E_AGI_IVR_ENTRY':_0xc1fd('0xa')};function AGIError(_0x43cd02){var _0x43cd02=_0x43cd02||null,_0x1865d0=_0x1865d0||[],_0x3eebe6=0x1,_0x43b858='';if(!error[_0x43cd02]){_0x43cd02=_0xc1fd('0xb');}_0x1865d0[_0xc1fd('0xc')](error[_0x43cd02]);while(arguments[_0x3eebe6]){_0x1865d0[_0xc1fd('0xc')](arguments[_0x3eebe6]);_0x3eebe6++;}_0x43b858=util[_0xc1fd('0xd')][_0xc1fd('0xe')](util,_0x1865d0);this[_0xc1fd('0xf')]=_0x43b858;this['name']=_0x43cd02;}module[_0xc1fd('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 9153264..1f62fd3 100644 --- a/server/services/agi/graph/index.js +++ b/server/services/agi/graph/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94df=['info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','push','size','relations','getVertex','traverseBFS'];(function(_0x2deb5f,_0x41fe3c){var _0x3c85a5=function(_0x32c7fa){while(--_0x32c7fa){_0x2deb5f['push'](_0x2deb5f['shift']());}};_0x3c85a5(++_0x41fe3c);}(_0x94df,0xa3));var _0xf94d=function(_0x4b5f75,_0x2c8d9d){_0x4b5f75=_0x4b5f75-0x0;var _0x220f50=_0x94df[_0x4b5f75];return _0x220f50;};'use strict';var _=require(_0xf94d('0x0'));var logger=require(_0xf94d('0x1'))(_0xf94d('0x2'));var verticesWithRetry=[_0xf94d('0x3'),_0xf94d('0x4'),_0xf94d('0x5')];var Graph=function(){this['vertices']={};this[_0xf94d('0x6')]={};this[_0xf94d('0x7')]=0x0;};Graph[_0xf94d('0x8')][_0xf94d('0x9')]=function(_0x4af826){this[_0xf94d('0xa')][_0x4af826['id']]=_0x4af826;this[_0xf94d('0x6')][_0x4af826['id']]=[];};Graph[_0xf94d('0x8')][_0xf94d('0xb')]=function(_0xf285b5,_0x1832e9,_0x504670){this[_0xf94d('0x6')][_0xf285b5][_0xf94d('0xc')]({'target':_0x1832e9,'condition':_0x504670});this[_0xf94d('0x7')]+=0x1;};Graph[_0xf94d('0x8')][_0xf94d('0xd')]=function(){return _[_0xf94d('0xd')](this['vertices']);};Graph[_0xf94d('0x8')][_0xf94d('0xe')]=function(){return this[_0xf94d('0x7')];};Graph[_0xf94d('0x8')][_0xf94d('0xf')]=function(_0x509bf2){return this['vertices'][_0x509bf2];};Graph[_0xf94d('0x8')][_0xf94d('0x10')]=function(_0x2f5395,_0x28bdf8){if(!this[_0xf94d('0xa')][_0x2f5395]){return logger[_0xf94d('0x11')]('no\x20vertex\x20found');}var _0x596da8=_0x28bdf8(this[_0xf94d('0xa')][_0x2f5395]);if(!_0x596da8){return logger[_0xf94d('0x11')](_0xf94d('0x12'));}if(this[_0xf94d('0x6')][_0x2f5395][_0xf94d('0x13')]===0x0){return logger[_0xf94d('0x11')](_0xf94d('0x14'));}for(var _0x4fa8bf=0x0,_0x431b19=[],_0x5cd967=![];_0x4fa8bf\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','lodash','syncho','util','moment','../../config/logger','agi','./rpc','127.0.0.1','nextTick','stack','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','error','format','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','mxGraphModel','root','hasOwnProperty','retry','addVertex','isArray','source','addEdge','target','value','getSquareProject','then','catch','createSquareReport','indexOf','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','production','start','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','debug','vertex','agicommand','gotoc','context','extension','priority','result','response'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b1,0x105));var _0x1d8b=function(_0x572ca6,_0x491c18){_0x572ca6=_0x572ca6-0x0;var _0x3a87f7=_0xd8b1[_0x572ca6];return _0x3a87f7;};'use strict';var parser=require(_0x1d8b('0x0'));var _=require(_0x1d8b('0x1'));var syncho=require(_0x1d8b('0x2'));var util=require(_0x1d8b('0x3'));var moment=require(_0x1d8b('0x4'));var config=require('../../config/environment');var logger=require(_0x1d8b('0x5'))(_0x1d8b('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0x1d8b('0x7'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1d8b('0x6')]=_['defaults'](config[_0x1d8b('0x6')],{'ip':_0x1d8b('0x8'),'port':0x11dd});function connectionHandler(_0x2b28e2){process[_0x1d8b('0x9')](function(){syncho(function(){try{setChannelVariables(_0x2b28e2);agiHandler(_0x2b28e2);}catch(_0x51438a){logger['error'](_0x51438a[_0x1d8b('0xa')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x1d8b('0x6')]['port']);logger[_0x1d8b('0xb')](util['format'](_0x1d8b('0xc'),config[_0x1d8b('0x6')]['ip'],config[_0x1d8b('0x6')][_0x1d8b('0xd')]));}function errorHandler(_0x30de33){if(_0x30de33&&_0x30de33[_0x1d8b('0xe')]&&_0x30de33['message']){logger[_0x1d8b('0xf')](util[_0x1d8b('0x10')](_0x1d8b('0x11'),_0x30de33[_0x1d8b('0xe')],_0x30de33[_0x1d8b('0x12')]));}else{logger[_0x1d8b('0xf')](util[_0x1d8b('0x10')](_0x1d8b('0x13'),_0x30de33['stack']));}}function closeHandler(){logger[_0x1d8b('0xb')](util[_0x1d8b('0x10')](_0x1d8b('0x14'),this[_0x1d8b('0x15')],this[_0x1d8b('0x16')],this[_0x1d8b('0x17')],this[_0x1d8b('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5aeef3){logger[_0x1d8b('0xf')](_0x5aeef3[_0x1d8b('0xa')]);}}function timeoutHandler(){logger[_0x1d8b('0xb')](util[_0x1d8b('0x10')](_0x1d8b('0x19'),this['arg_1'],this[_0x1d8b('0x16')],this[_0x1d8b('0x17')],this['dnid'],this[_0x1d8b('0x1a')]));}function hangupHandler(){logger[_0x1d8b('0xb')](util[_0x1d8b('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1d8b('0x15')],this[_0x1d8b('0x16')],this[_0x1d8b('0x17')],this[_0x1d8b('0x18')],this[_0x1d8b('0x1a')]));this[_0x1d8b('0x1b')]=!![];}function getRoot(_0x3c2c78){return parser['toJson'](_0x3c2c78,{'object':!![]})[_0x1d8b('0x1c')][_0x1d8b('0x1d')];}function addVertex(_0x3d8fcb,_0x308b89,_0x5235b6){_0x308b89['agicommand']=_0x5235b6;if(_0x308b89[_0x1d8b('0x1e')](_0x1d8b('0x1f'))){_0x308b89['maxRetry']=parseInt(_0x308b89[_0x1d8b('0x1f')],0xa);}_0x3d8fcb[_0x1d8b('0x20')](_['omit'](_0x308b89,'mxCell'));}function initGraph(_0x2fdabd,_0x19b9aa){var _0x374954=new Graph();for(var _0xe76d45 in _0x2fdabd){if(_0x2fdabd[_0x1d8b('0x1e')](_0xe76d45)){if(_[_0x1d8b('0x21')](_0x2fdabd[_0xe76d45])){for(var _0x1d525f=0x0;_0x1d525f<_0x2fdabd[_0xe76d45]['length'];_0x1d525f+=0x1){addVertex(_0x374954,_0x2fdabd[_0xe76d45][_0x1d525f],_0xe76d45);}}else{addVertex(_0x374954,_0x2fdabd[_0xe76d45],_0xe76d45);}}}for(var _0x27371d=0x0;_0x27371d<_0x19b9aa['length'];_0x27371d+=0x1){if(_0x19b9aa[_0x27371d][_0x1d8b('0x22')]&&_0x19b9aa[_0x27371d]['target']){_0x374954[_0x1d8b('0x23')](_0x19b9aa[_0x27371d][_0x1d8b('0x22')],_0x19b9aa[_0x27371d][_0x1d8b('0x24')],_0x19b9aa[_0x27371d][_0x1d8b('0x25')]);}}return _0x374954;}function getSquareProject(_0x569ed4,_0x57d6df){rpc[_0x1d8b('0x26')](_0x569ed4)[_0x1d8b('0x27')](function(_0x35efca){_0x57d6df(null,_0x35efca);})[_0x1d8b('0x28')](function(_0x2305d8){_0x57d6df(null,_0x2305d8);});}function createSquareReport(_0x38a747,_0x505435){rpc[_0x1d8b('0x29')](_0x38a747)[_0x1d8b('0x27')](function(_0x23ed7f){if(_0x505435){_0x505435(null,_0x23ed7f);}})[_0x1d8b('0x28')](function(_0x408744){if(_0x505435){_0x505435(null,_0x408744);}});}function setChannelVariables(_0x1ef016){for(var _0x32a194 in _0x1ef016){if(_0x1ef016[_0x1d8b('0x1e')](_0x32a194)){if(_0x32a194[_0x1d8b('0x2a')]('agi_')===0x0){_0x1ef016[_0x32a194[_0x1d8b('0x2b')](0x4)]=_0x1ef016[_0x32a194];delete _0x1ef016[_0x32a194];}}}}function getLogFromObject(_0x57268f){return util['inspect'](_0x57268f,{'showHidden':![],'depth':null});}function agiHandler(_0x5d844a){var _0x25a4db,_0x3e76a6,_0x371223,_0x21cccb,_0x1bb354;logger['debug'](_0x1d8b('0x2c'),JSON[_0x1d8b('0x2d')](_0x5d844a,null,0x2));logger[_0x1d8b('0xb')](util[_0x1d8b('0x10')](_0x1d8b('0x2e'),_0x5d844a[_0x1d8b('0x15')],_0x5d844a[_0x1d8b('0x16')],_0x5d844a[_0x1d8b('0x17')],_0x5d844a['dnid'],_0x5d844a[_0x1d8b('0x1a')]));_0x5d844a['on']('error',errorHandler);_0x5d844a['on'](_0x1d8b('0x2f'),closeHandler);_0x5d844a['on']('timeout',timeoutHandler);_0x5d844a[_0x1d8b('0x1b')]=![];_0x5d844a['on'](_0x1d8b('0x30'),hangupHandler);var _0x10c520=getSquareProject['sync'](null,_0x5d844a[_0x1d8b('0x15')]);if(_0x10c520){if(_0x10c520[_0x1d8b('0x31')]){_0x25a4db=getRoot(_0x10c520[_0x1d8b('0x31')]);if(_0x25a4db&&_0x25a4db[_0x1d8b('0x32')]){logger['debug'](_0x1d8b('0x1d'),JSON[_0x1d8b('0x2d')](_0x25a4db,null,0x2));_0x5d844a['joinAt']=moment()[_0x1d8b('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e76a6=initGraph(_['omit'](_0x25a4db,'mxCell'),_0x25a4db[_0x1d8b('0x33')]);_0x371223=new Vertices(_0x5d844a,rpc,mailRpc);logger[_0x1d8b('0xb')](util[_0x1d8b('0x10')](_0x1d8b('0x34'),_0x5d844a[_0x1d8b('0x15')],_0x5d844a[_0x1d8b('0x16')],_0x5d844a[_0x1d8b('0x17')],_0x5d844a['dnid'],_0x5d844a[_0x1d8b('0x1a')]));_0x3e76a6['traverseBFS'](_0x25a4db[_0x1d8b('0x32')]['id'],function(_0x5da0e7){try{_0x5da0e7=_0x371223[_0x1d8b('0x35')](_0x5da0e7);logger[_0x1d8b('0x36')](_0x1d8b('0x37'),JSON[_0x1d8b('0x2d')](_0x5da0e7,null,0x2));if(_0x5da0e7[_0x1d8b('0x38')]===_0x1d8b('0x39')){logger[_0x1d8b('0xb')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5d844a['context']=_0x5da0e7[_0x1d8b('0x3a')]||_0x5d844a[_0x1d8b('0x3a')];_0x5d844a[_0x1d8b('0x3b')]=_0x5da0e7[_0x1d8b('0x3b')];_0x5d844a[_0x1d8b('0x3c')]=_0x5da0e7['priority']?_0x5da0e7[_0x1d8b('0x3c')]-0x1:0x1;return null;}else if(_0x5da0e7&&_0x371223[_0x5da0e7[_0x1d8b('0x38')]]){_0x1bb354=_0x371223[_0x5da0e7['agicommand']](_0x5da0e7);logger['info']('response',JSON[_0x1d8b('0x2d')](_0x1bb354,null,0x2));if(_0x1bb354&&_0x1bb354['code']===AGI_CODE_SUCCESS&&_0x1bb354[_0x1d8b('0x3d')]!==AGI_RESULT_ERROR&&!_0x5d844a[_0x1d8b('0x1b')]){logger['debug'](_0x1d8b('0x3e'),getLogFromObject(_0x1bb354));return _[_0x1d8b('0x3f')](_0x1bb354[_0x1d8b('0x3d')])?null:_0x1bb354[_0x1d8b('0x3d')][_0x1d8b('0x40')]();}else{logger['error']('response',getLogFromObject(_0x1bb354));return null;}}else{logger[_0x1d8b('0xf')](_0x1d8b('0x41'));return null;}}catch(_0x3c403c){logger['error'](_0x3c403c[_0x1d8b('0xa')]);return null;}});if(_0x25a4db[_0x1d8b('0x42')]){logger[_0x1d8b('0xb')](util[_0x1d8b('0x10')](_0x1d8b('0x43'),_0x5d844a[_0x1d8b('0x15')],_0x5d844a[_0x1d8b('0x16')],_0x5d844a[_0x1d8b('0x17')],_0x5d844a['dnid'],_0x5d844a[_0x1d8b('0x1a')]));_0x3e76a6[_0x1d8b('0x44')](_0x25a4db[_0x1d8b('0x42')]['id'],function(_0x3b50a2){try{_0x3b50a2=_0x371223[_0x1d8b('0x35')](_0x3b50a2);logger[_0x1d8b('0x36')](_0x1d8b('0x37'),JSON[_0x1d8b('0x2d')](_0x3b50a2,null,0x2));if(_0x3b50a2&&_0x371223[_0x3b50a2['agicommand']]){_0x1bb354=_0x371223[_0x3b50a2[_0x1d8b('0x38')]](_0x3b50a2);if(_0x1bb354){logger[_0x1d8b('0x36')]('response',getLogFromObject(_0x1bb354));return _['isUndefined'](_0x1bb354[_0x1d8b('0x3d')])?null:_0x1bb354[_0x1d8b('0x3d')][_0x1d8b('0x40')]();}else{logger[_0x1d8b('0xf')](_0x1d8b('0x3e'),getLogFromObject(_0x1bb354));return null;}}else{logger[_0x1d8b('0xf')](_0x1d8b('0x41'));return null;}}catch(_0x1e296d){logger[_0x1d8b('0xf')](_0x1e296d[_0x1d8b('0xa')]);return null;}});}logger[_0x1d8b('0xb')](util[_0x1d8b('0x10')](_0x1d8b('0x45'),_0x5d844a[_0x1d8b('0x15')],_0x5d844a[_0x1d8b('0x16')],_0x5d844a[_0x1d8b('0x17')],_0x5d844a[_0x1d8b('0x18')],_0x5d844a[_0x1d8b('0x1a')]));logger['info'](util['format'](_0x1d8b('0x46'),_0x5d844a[_0x1d8b('0x3a')],_0x5d844a['extension'],parseInt(_0x5d844a[_0x1d8b('0x3c')],0xa)+0x1));_0x5d844a['continueAt'](_0x5d844a['context'],_0x5d844a['extension'],parseInt(_0x5d844a[_0x1d8b('0x3c')],0xa)+0x1);_0x5d844a[_0x1d8b('0x2f')]();}}else{logger[_0x1d8b('0xf')](util[_0x1d8b('0x10')]('Project\x20%s\x20not\x20published',_0x5d844a[_0x1d8b('0x15')]));_0x5d844a[_0x1d8b('0x47')](_0x5d844a[_0x1d8b('0x3a')],_0x5d844a[_0x1d8b('0x3b')],parseInt(_0x5d844a[_0x1d8b('0x3c')],0xa)+0x1);_0x5d844a['close']();}}else{logger[_0x1d8b('0xf')](util[_0x1d8b('0x10')](_0x1d8b('0x48'),_0x5d844a['arg_1']));_0x5d844a[_0x1d8b('0x47')](_0x5d844a[_0x1d8b('0x3a')],_0x5d844a[_0x1d8b('0x3b')],parseInt(_0x5d844a['priority'],0xa)+0x1);_0x5d844a[_0x1d8b('0x2f')]();}}function main(){var _0x4285d9;return utilLicense['getLicense']()['then'](function(_0xe27b64){if(_0xe27b64){if(_0xe27b64[_0x1d8b('0x49')]){if(_0xe27b64[_0x1d8b('0x4a')]&&_0xe27b64[_0x1d8b('0x4a')]>0x0){logger[_0x1d8b('0xb')](util[_0x1d8b('0x10')](_0x1d8b('0x4b'),_0xe27b64[_0x1d8b('0x4a')]));_0x4285d9=_0xe27b64[_0x1d8b('0x4a')];}else{logger[_0x1d8b('0xb')](_0x1d8b('0x4c'));}}else{logger['info'](_0x1d8b('0x4d'));_0x4285d9=-0x1;}}})[_0x1d8b('0x28')](function(_0x58b0ae){logger[_0x1d8b('0xf')](_0x1d8b('0x4e'),_0x58b0ae[_0x1d8b('0xa')]);})['finally'](function(){var _0x4c044b=require(_0x1d8b('0x4f'))(config[_0x1d8b('0x6')]['port'],config[_0x1d8b('0x6')]['ip'],_0x4285d9);_0x4c044b['on'](_0x1d8b('0xf'),errorHandler);_0x4c044b['on']('listening',listeningHandler);_0x4c044b['on'](_0x1d8b('0x50'),connectionHandler);_0x4c044b['on'](_0x1d8b('0x2f'),closeHandler);});}main(); \ No newline at end of file +var _0x4d9e=['nextTick','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','agicommand','retry','maxRetry','addVertex','omit','mxCell','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','hasOwnProperty','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','gotoc','context','extension','priority','code','result','isUndefined','toString','response','agicommand\x20not\x20found','finally','traverseBFS','vertex','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]','listening','connection','xml2json','util','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults'];(function(_0x589777,_0x110424){var _0x3b067c=function(_0x59cf29){while(--_0x59cf29){_0x589777['push'](_0x589777['shift']());}};_0x3b067c(++_0x110424);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x32a7f2,_0x43ca7d){_0x32a7f2=_0x32a7f2-0x0;var _0x4c7655=_0x4d9e[_0x32a7f2];return _0x4c7655;};'use strict';var parser=require(_0xe4d9('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0xe4d9('0x1'));var moment=require('moment');var config=require(_0xe4d9('0x2'));var logger=require('../../config/logger')(_0xe4d9('0x3'));var utilLicense=require(_0xe4d9('0x4'));var rpc=require('./rpc');var mailRpc=require(_0xe4d9('0x5'));var Graph=require(_0xe4d9('0x6'));var Vertices=require(_0xe4d9('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe4d9('0x3')]=_[_0xe4d9('0x8')](config[_0xe4d9('0x3')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x36316f){process[_0xe4d9('0x9')](function(){syncho(function(){try{setChannelVariables(_0x36316f);agiHandler(_0x36316f);}catch(_0x2a7eee){logger[_0xe4d9('0xa')](_0x2a7eee[_0xe4d9('0xb')]);}});});}function listeningHandler(){console[_0xe4d9('0xc')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe4d9('0x3')][_0xe4d9('0xd')]);logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')](_0xe4d9('0x10'),config[_0xe4d9('0x3')]['ip'],config[_0xe4d9('0x3')]['port']));}function errorHandler(_0x5ee099){if(_0x5ee099&&_0x5ee099['name']&&_0x5ee099['message']){logger['error'](util['format']('[%s]\x20%s',_0x5ee099['name'],_0x5ee099[_0xe4d9('0x11')]));}else{logger[_0xe4d9('0xa')](util[_0xe4d9('0xf')]('[ERROR]\x20%s',_0x5ee099[_0xe4d9('0xb')]));}}function closeHandler(){logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')](_0xe4d9('0x12'),this['arg_1'],this[_0xe4d9('0x13')],this[_0xe4d9('0x14')],this[_0xe4d9('0x15')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4d2afd){logger[_0xe4d9('0xa')](_0x4d2afd[_0xe4d9('0xb')]);}}function timeoutHandler(){logger['info'](util[_0xe4d9('0xf')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe4d9('0x16')],this[_0xe4d9('0x13')],this[_0xe4d9('0x14')],this[_0xe4d9('0x15')],this['uniqueid']));}function hangupHandler(){logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')](_0xe4d9('0x17'),this[_0xe4d9('0x16')],this[_0xe4d9('0x13')],this[_0xe4d9('0x14')],this[_0xe4d9('0x15')],this[_0xe4d9('0x18')]));this[_0xe4d9('0x19')]=!![];}function getRoot(_0x4fed7f){return parser[_0xe4d9('0x1a')](_0x4fed7f,{'object':!![]})[_0xe4d9('0x1b')]['root'];}function addVertex(_0x189dad,_0x50d377,_0x14f3d7){_0x50d377[_0xe4d9('0x1c')]=_0x14f3d7;if(_0x50d377['hasOwnProperty'](_0xe4d9('0x1d'))){_0x50d377[_0xe4d9('0x1e')]=parseInt(_0x50d377['retry'],0xa);}_0x189dad[_0xe4d9('0x1f')](_[_0xe4d9('0x20')](_0x50d377,_0xe4d9('0x21')));}function initGraph(_0x5bb43b,_0x4ee33d){var _0x42e6a0=new Graph();for(var _0x2846e2 in _0x5bb43b){if(_0x5bb43b['hasOwnProperty'](_0x2846e2)){if(_['isArray'](_0x5bb43b[_0x2846e2])){for(var _0x4954b5=0x0;_0x4954b5<_0x5bb43b[_0x2846e2]['length'];_0x4954b5+=0x1){addVertex(_0x42e6a0,_0x5bb43b[_0x2846e2][_0x4954b5],_0x2846e2);}}else{addVertex(_0x42e6a0,_0x5bb43b[_0x2846e2],_0x2846e2);}}}for(var _0x221a61=0x0;_0x221a61<_0x4ee33d['length'];_0x221a61+=0x1){if(_0x4ee33d[_0x221a61][_0xe4d9('0x22')]&&_0x4ee33d[_0x221a61][_0xe4d9('0x23')]){_0x42e6a0[_0xe4d9('0x24')](_0x4ee33d[_0x221a61]['source'],_0x4ee33d[_0x221a61][_0xe4d9('0x23')],_0x4ee33d[_0x221a61][_0xe4d9('0x25')]);}}return _0x42e6a0;}function getSquareProject(_0x250de5,_0x45e8a3){rpc[_0xe4d9('0x26')](_0x250de5)[_0xe4d9('0x27')](function(_0x21b7a9){_0x45e8a3(null,_0x21b7a9);})[_0xe4d9('0x28')](function(_0x1fb637){_0x45e8a3(null,_0x1fb637);});}function createSquareReport(_0x3e6ea7,_0x519c18){rpc[_0xe4d9('0x29')](_0x3e6ea7)['then'](function(_0x22efd2){if(_0x519c18){_0x519c18(null,_0x22efd2);}})[_0xe4d9('0x28')](function(_0x2b716b){if(_0x519c18){_0x519c18(null,_0x2b716b);}});}function setChannelVariables(_0x3721a0){for(var _0xa444d0 in _0x3721a0){if(_0x3721a0[_0xe4d9('0x2a')](_0xa444d0)){if(_0xa444d0['indexOf']('agi_')===0x0){_0x3721a0[_0xa444d0['substring'](0x4)]=_0x3721a0[_0xa444d0];delete _0x3721a0[_0xa444d0];}}}}function getLogFromObject(_0x270cad){return util[_0xe4d9('0x2b')](_0x270cad,{'showHidden':![],'depth':null});}function agiHandler(_0x9f1acf){var _0x4f8abf,_0x5a7422,_0x5ad794,_0x5f230f,_0x2740e0;logger[_0xe4d9('0x2c')]('variables',JSON[_0xe4d9('0x2d')](_0x9f1acf,null,0x2));logger[_0xe4d9('0xe')](util['format'](_0xe4d9('0x2e'),_0x9f1acf[_0xe4d9('0x16')],_0x9f1acf[_0xe4d9('0x13')],_0x9f1acf[_0xe4d9('0x14')],_0x9f1acf[_0xe4d9('0x15')],_0x9f1acf[_0xe4d9('0x18')]));_0x9f1acf['on'](_0xe4d9('0xa'),errorHandler);_0x9f1acf['on'](_0xe4d9('0x2f'),closeHandler);_0x9f1acf['on'](_0xe4d9('0x30'),timeoutHandler);_0x9f1acf[_0xe4d9('0x19')]=![];_0x9f1acf['on'](_0xe4d9('0x31'),hangupHandler);var _0x517f24=getSquareProject[_0xe4d9('0x32')](null,_0x9f1acf[_0xe4d9('0x16')]);if(_0x517f24){if(_0x517f24['production']){_0x4f8abf=getRoot(_0x517f24[_0xe4d9('0x33')]);if(_0x4f8abf&&_0x4f8abf[_0xe4d9('0x34')]){logger[_0xe4d9('0x2c')](_0xe4d9('0x35'),JSON[_0xe4d9('0x2d')](_0x4f8abf,null,0x2));_0x9f1acf[_0xe4d9('0x36')]=moment()[_0xe4d9('0xf')](_0xe4d9('0x37'));_0x5a7422=initGraph(_[_0xe4d9('0x20')](_0x4f8abf,'mxCell'),_0x4f8abf['mxCell']);_0x5ad794=new Vertices(_0x9f1acf,rpc,mailRpc);logger['info'](util[_0xe4d9('0xf')](_0xe4d9('0x38'),_0x9f1acf[_0xe4d9('0x16')],_0x9f1acf[_0xe4d9('0x13')],_0x9f1acf[_0xe4d9('0x14')],_0x9f1acf[_0xe4d9('0x15')],_0x9f1acf[_0xe4d9('0x18')]));_0x5a7422['traverseBFS'](_0x4f8abf['start']['id'],function(_0x51824f){try{_0x51824f=_0x5ad794[_0xe4d9('0x39')](_0x51824f);logger[_0xe4d9('0x2c')]('vertex',JSON[_0xe4d9('0x2d')](_0x51824f,null,0x2));if(_0x51824f[_0xe4d9('0x1c')]===_0xe4d9('0x3a')){logger[_0xe4d9('0xe')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x9f1acf[_0xe4d9('0x3b')]=_0x51824f[_0xe4d9('0x3b')]||_0x9f1acf[_0xe4d9('0x3b')];_0x9f1acf[_0xe4d9('0x3c')]=_0x51824f[_0xe4d9('0x3c')];_0x9f1acf[_0xe4d9('0x3d')]=_0x51824f[_0xe4d9('0x3d')]?_0x51824f[_0xe4d9('0x3d')]-0x1:0x1;return null;}else if(_0x51824f&&_0x5ad794[_0x51824f[_0xe4d9('0x1c')]]){_0x2740e0=_0x5ad794[_0x51824f[_0xe4d9('0x1c')]](_0x51824f);logger[_0xe4d9('0xe')]('response',JSON[_0xe4d9('0x2d')](_0x2740e0,null,0x2));if(_0x2740e0&&_0x2740e0[_0xe4d9('0x3e')]===AGI_CODE_SUCCESS&&_0x2740e0[_0xe4d9('0x3f')]!==AGI_RESULT_ERROR&&!_0x9f1acf[_0xe4d9('0x19')]){logger[_0xe4d9('0x2c')]('response',getLogFromObject(_0x2740e0));return _[_0xe4d9('0x40')](_0x2740e0[_0xe4d9('0x3f')])?null:_0x2740e0[_0xe4d9('0x3f')][_0xe4d9('0x41')]();}else{logger[_0xe4d9('0xa')](_0xe4d9('0x42'),getLogFromObject(_0x2740e0));return null;}}else{logger[_0xe4d9('0xa')](_0xe4d9('0x43'));return null;}}catch(_0x42744d){logger[_0xe4d9('0xa')](_0x42744d['stack']);return null;}});if(_0x4f8abf[_0xe4d9('0x44')]){logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x9f1acf[_0xe4d9('0x16')],_0x9f1acf[_0xe4d9('0x13')],_0x9f1acf[_0xe4d9('0x14')],_0x9f1acf[_0xe4d9('0x15')],_0x9f1acf[_0xe4d9('0x18')]));_0x5a7422[_0xe4d9('0x45')](_0x4f8abf[_0xe4d9('0x44')]['id'],function(_0x5254b3){try{_0x5254b3=_0x5ad794[_0xe4d9('0x39')](_0x5254b3);logger[_0xe4d9('0x2c')](_0xe4d9('0x46'),JSON[_0xe4d9('0x2d')](_0x5254b3,null,0x2));if(_0x5254b3&&_0x5ad794[_0x5254b3[_0xe4d9('0x1c')]]){_0x2740e0=_0x5ad794[_0x5254b3[_0xe4d9('0x1c')]](_0x5254b3);if(_0x2740e0){logger['debug'](_0xe4d9('0x42'),getLogFromObject(_0x2740e0));return _[_0xe4d9('0x40')](_0x2740e0[_0xe4d9('0x3f')])?null:_0x2740e0[_0xe4d9('0x3f')][_0xe4d9('0x41')]();}else{logger[_0xe4d9('0xa')]('response',getLogFromObject(_0x2740e0));return null;}}else{logger[_0xe4d9('0xa')](_0xe4d9('0x43'));return null;}}catch(_0x53e7c4){logger[_0xe4d9('0xa')](_0x53e7c4['stack']);return null;}});}logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x9f1acf[_0xe4d9('0x16')],_0x9f1acf['calleridname'],_0x9f1acf[_0xe4d9('0x14')],_0x9f1acf[_0xe4d9('0x15')],_0x9f1acf[_0xe4d9('0x18')]));logger['info'](util[_0xe4d9('0xf')](_0xe4d9('0x47'),_0x9f1acf['context'],_0x9f1acf[_0xe4d9('0x3c')],parseInt(_0x9f1acf[_0xe4d9('0x3d')],0xa)+0x1));_0x9f1acf[_0xe4d9('0x48')](_0x9f1acf[_0xe4d9('0x3b')],_0x9f1acf['extension'],parseInt(_0x9f1acf['priority'],0xa)+0x1);_0x9f1acf[_0xe4d9('0x2f')]();}}else{logger[_0xe4d9('0xa')](util[_0xe4d9('0xf')](_0xe4d9('0x49'),_0x9f1acf[_0xe4d9('0x16')]));_0x9f1acf[_0xe4d9('0x48')](_0x9f1acf['context'],_0x9f1acf['extension'],parseInt(_0x9f1acf[_0xe4d9('0x3d')],0xa)+0x1);_0x9f1acf[_0xe4d9('0x2f')]();}}else{logger[_0xe4d9('0xa')](util[_0xe4d9('0xf')](_0xe4d9('0x4a'),_0x9f1acf[_0xe4d9('0x16')]));_0x9f1acf['continueAt'](_0x9f1acf[_0xe4d9('0x3b')],_0x9f1acf[_0xe4d9('0x3c')],parseInt(_0x9f1acf[_0xe4d9('0x3d')],0xa)+0x1);_0x9f1acf['close']();}}function main(){var _0x457bfb;return utilLicense[_0xe4d9('0x4b')]()[_0xe4d9('0x27')](function(_0x5ec4bc){if(_0x5ec4bc){if(_0x5ec4bc[_0xe4d9('0x4c')]){if(_0x5ec4bc['callysquare']&&_0x5ec4bc[_0xe4d9('0x4d')]>0x0){logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5ec4bc['callysquare']));_0x457bfb=_0x5ec4bc['callysquare'];}else{logger[_0xe4d9('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xe4d9('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x457bfb=-0x1;}}})['catch'](function(_0x3c2196){logger[_0xe4d9('0xa')](_0xe4d9('0x4e'),_0x3c2196[_0xe4d9('0xb')]);})[_0xe4d9('0x44')](function(){var _0x580bb4=require('./server')(config['agi']['port'],config[_0xe4d9('0x3')]['ip'],_0x457bfb);_0x580bb4['on'](_0xe4d9('0xa'),errorHandler);_0x580bb4['on'](_0xe4d9('0x4f'),listeningHandler);_0x580bb4['on'](_0xe4d9('0x50'),connectionHandler);_0x580bb4['on'](_0xe4d9('0x2f'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index d1a26d2..6b8b410 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x35a18c,_0x1e5b66){var _0x5c1c6e=function(_0x22fbf9){while(--_0x22fbf9){_0x35a18c['push'](_0x35a18c['shift']());}};_0x5c1c6e(++_0x1e5b66);}(_0x814b,0x1a2));var _0xb814=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x814b[_0x9fb081];return _0x43f8b0;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x21d5f0,_0x3f62e8){var _0x8e4d7e=function(_0x388084){while(--_0x388084){_0x21d5f0['push'](_0x21d5f0['shift']());}};_0x8e4d7e(++_0x3f62e8);}(_0x34e8,0x12c));var _0x834e=function(_0x4b06bc,_0x1579c9){_0x4b06bc=_0x4b06bc-0x0;var _0x5a4ced=_0x34e8[_0x4b06bc];return _0x5a4ced;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 244d757..4590e09 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x3c029a,_0x30fbba){var _0x619f33=function(_0x522b50){while(--_0x522b50){_0x3c029a['push'](_0x3c029a['shift']());}};_0x619f33(++_0x30fbba);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35c42c,_0x217a41){_0x35c42c=_0x35c42c-0x0;var _0x5a0b65=_0x5f2f[_0x35c42c];return _0x5a0b65;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x2c6256,_0x404ccf){var _0x4db857=function(_0x40bb9f){while(--_0x40bb9f){_0x2c6256['push'](_0x2c6256['shift']());}};_0x4db857(++_0x404ccf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x154a9f,_0x2e799d){_0x154a9f=_0x154a9f-0x0;var _0x33ac4c=_0x5f2f[_0x154a9f];return _0x33ac4c;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index fff6f6f..b56f416 100644 --- a/server/services/agi/rpc/index.js +++ b/server/services/agi/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa109=['agentLogout','LogoutUser','bluebird','lodash','util','jayson/promise','http','request','then','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser'];(function(_0x52fc63,_0x5a2f5e){var _0x5183aa=function(_0x1c3051){while(--_0x1c3051){_0x52fc63['push'](_0x52fc63['shift']());}};_0x5183aa(++_0x5a2f5e);}(_0xa109,0xf2));var _0x9a10=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa109[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x9a10('0x0'));var moment=require('moment');var _=require(_0x9a10('0x1'));var util=require(_0x9a10('0x2'));var jayson=require(_0x9a10('0x3'));var client=jayson['client'][_0x9a10('0x4')]({'port':0x2329});function request(_0x185c0a,_0x2c6556){return new BPromise(function(_0x126897,_0xaff959){return client[_0x9a10('0x5')](_0x185c0a,_0x2c6556)[_0x9a10('0x6')](function(_0x2e86bf){if(_0x2e86bf[_0x9a10('0x7')]){return _0xaff959(_0x2e86bf[_0x9a10('0x7')]['message']);}else{return _0x126897(_0x2e86bf[_0x9a10('0x8')]);}})[_0x9a10('0x9')](function(_0x2d8d46){return _0xaff959(_0x2d8d46);});});}exports[_0x9a10('0xa')]=function(_0x1ce4b1){return request(_0x9a10('0xb'),{'options':{'raw':![],'where':{'name':_0x1ce4b1},'attributes':[_0x9a10('0xc')]}});};exports[_0x9a10('0xd')]=function(_0x338ac6){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x338ac6},'include':[{'model':_0x9a10('0xe'),'as':_0x9a10('0xf')}],'attributes':['id',_0x9a10('0x10'),_0x9a10('0x11')]}});};exports[_0x9a10('0x12')]=function(_0x5774a2){return request(_0x9a10('0xb'),{'options':{'where':{'id':_0x5774a2},'attributes':[_0x9a10('0x10')]}});};exports['getVoiceQueueById']=function(_0x4c0967){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4c0967},'attributes':[_0x9a10('0x10')]}});};exports[_0x9a10('0x13')]=function(_0x1a1b13){return request(_0x9a10('0x14'),{'options':{'where':{'id':_0x1a1b13},'attributes':['name']}});};exports[_0x9a10('0x15')]=function(_0x7c366c){return request(_0x9a10('0x16'),{'options':{'where':{'id':_0x7c366c},'attributes':[_0x9a10('0x17')]}});};exports[_0x9a10('0x18')]=function(_0xe9b50e){return request(_0x9a10('0x19'),{'options':{'where':{'id':_0xe9b50e},'attributes':['name']}});};exports[_0x9a10('0x1a')]=function(_0x2ab215){return request('ShowTrunk',{'options':{'where':{'id':_0x2ab215},'attributes':[_0x9a10('0x10')]}});};exports['getSoundById']=function(_0x21ce8d){return request(_0x9a10('0x1b'),{'options':{'where':{'id':_0x21ce8d},'attributes':['save_name']}});};exports[_0x9a10('0x1c')]=function(_0x2f4ec7){return request(_0x9a10('0x1d'),{'options':{'raw':![],'where':{'id':_0x2f4ec7},'include':[{'model':_0x9a10('0x1e'),'as':_0x9a10('0x1f')}]}});};exports[_0x9a10('0x20')]=function(_0x2aaab1){return request(_0x9a10('0x21'),{'options':{'where':{'id':_0x2aaab1},'attributes':['id',_0x9a10('0x10')]}});};exports[_0x9a10('0x22')]=function(_0x504ad3){return request(_0x9a10('0x23'),{'body':_0x504ad3});};exports[_0x9a10('0x24')]=function(_0x2ea911){return request(_0x9a10('0x25'),{'body':_0x2ea911});};exports[_0x9a10('0x26')]=function(_0xbaafc0){return request(_0x9a10('0x27'),{'body':_[_0x9a10('0x28')](_0xbaafc0,{'project_name':_0xbaafc0['arg_1'],'prev_project_name':_0xbaafc0['arg_2']||'','is_subproject':_0xbaafc0[_0x9a10('0x29')]?!![]:![],'leaveAt':moment()[_0x9a10('0x2a')](_0x9a10('0x2b'))})});};exports['createSquareRecording']=function(_0x406440){return request(_0x9a10('0x2c'),{'body':_0x406440});};exports[_0x9a10('0x2d')]=function(_0x59828f){return request(_0x9a10('0x2e'),{'body':_0x59828f});};exports[_0x9a10('0x2f')]=function(_0x486b3c){return request(_0x9a10('0x30'),{'options':{'raw':![],'where':{'phone':_0x486b3c[_0x9a10('0x31')],'ListId':_0x486b3c[_0x9a10('0x32')]}}})[_0x9a10('0x6')](function(_0x2c16ae){if(_0x2c16ae){return _0x2c16ae;}return request('CreateCmContact',{'body':_0x486b3c});});};exports['getPauseById']=function(_0x39789d){return request(_0x9a10('0x33'),{'options':{'where':{'id':_0x39789d},'attributes':[_0x9a10('0x10')]}});};exports[_0x9a10('0x34')]=function(_0x169d12,_0x3a0048){return request(_0x9a10('0x35'),{'body':{'interface':_0x3a0048},'options':{'where':_0x169d12}});};exports[_0x9a10('0x36')]=function(_0x111aca,_0xa40c64,_0x1e9a0f){return request(_0x9a10('0x37'),{'body':{'type':_0xa40c64,'uniqueid':_0x1e9a0f},'options':{'where':_0x111aca}});};exports[_0x9a10('0x38')]=function(_0x2d2caa){return request(_0x9a10('0x39'),{'body':{},'options':{'where':_0x2d2caa}});};exports[_0x9a10('0x3a')]=function(_0x11d93a){return request(_0x9a10('0x3b'),{'body':{},'options':{'where':_0x11d93a}});}; \ No newline at end of file +var _0x6916=['arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash','util','http','request','then','error','message','result','catch','getSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge'];(function(_0x4b4208,_0x187660){var _0x422d7c=function(_0x45f2b2){while(--_0x45f2b2){_0x4b4208['push'](_0x4b4208['shift']());}};_0x422d7c(++_0x187660);}(_0x6916,0x86));var _0x6691=function(_0x236b40,_0x5e958e){_0x236b40=_0x236b40-0x0;var _0x212b49=_0x6916[_0x236b40];return _0x212b49;};'use strict';var BPromise=require(_0x6691('0x0'));var moment=require(_0x6691('0x1'));var _=require(_0x6691('0x2'));var util=require(_0x6691('0x3'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6691('0x4')]({'port':0x2329});function request(_0xa1ae7f,_0x55efce){return new BPromise(function(_0x20298c,_0xb35687){return client[_0x6691('0x5')](_0xa1ae7f,_0x55efce)[_0x6691('0x6')](function(_0x3e86e5){if(_0x3e86e5['error']){return _0xb35687(_0x3e86e5[_0x6691('0x7')][_0x6691('0x8')]);}else{return _0x20298c(_0x3e86e5[_0x6691('0x9')]);}})[_0x6691('0xa')](function(_0xa472f6){return _0xb35687(_0xa472f6);});});}exports[_0x6691('0xb')]=function(_0x531b6e){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x531b6e},'attributes':[_0x6691('0xc')]}});};exports['getMailAccountById']=function(_0x2fcf98){return request(_0x6691('0xd'),{'options':{'raw':![],'where':{'id':_0x2fcf98},'include':[{'model':_0x6691('0xe'),'as':_0x6691('0xf')}],'attributes':['id',_0x6691('0x10'),_0x6691('0x11')]}});};exports['getSquareProjectById']=function(_0x6963d){return request(_0x6691('0x12'),{'options':{'where':{'id':_0x6963d},'attributes':[_0x6691('0x10')]}});};exports[_0x6691('0x13')]=function(_0x4c3230){return request(_0x6691('0x14'),{'options':{'where':{'id':_0x4c3230},'attributes':[_0x6691('0x10')]}});};exports[_0x6691('0x15')]=function(_0x1153a5){return request('ShowVariable',{'options':{'where':{'id':_0x1153a5},'attributes':['name']}});};exports[_0x6691('0x16')]=function(_0x2df066){return request(_0x6691('0x17'),{'options':{'where':{'id':_0x2df066},'attributes':['dsn']}});};exports[_0x6691('0x18')]=function(_0x346c4f){return request(_0x6691('0x19'),{'options':{'where':{'id':_0x346c4f},'attributes':[_0x6691('0x10')]}});};exports[_0x6691('0x1a')]=function(_0x279b30){return request(_0x6691('0x1b'),{'options':{'where':{'id':_0x279b30},'attributes':[_0x6691('0x10')]}});};exports[_0x6691('0x1c')]=function(_0x1a0b3e){return request('ShowSound',{'options':{'where':{'id':_0x1a0b3e},'attributes':[_0x6691('0x1d')]}});};exports[_0x6691('0x1e')]=function(_0xf017f3){return request(_0x6691('0x1f'),{'options':{'raw':![],'where':{'id':_0xf017f3},'include':[{'model':_0x6691('0x20'),'as':_0x6691('0x21')}]}});};exports[_0x6691('0x22')]=function(_0x21a3e0){return request(_0x6691('0x23'),{'options':{'where':{'id':_0x21a3e0},'attributes':['id',_0x6691('0x10')]}});};exports[_0x6691('0x24')]=function(_0x26dcca){return request(_0x6691('0x25'),{'body':_0x26dcca});};exports[_0x6691('0x26')]=function(_0x1fabea){return request(_0x6691('0x27'),{'body':_0x1fabea});};exports[_0x6691('0x28')]=function(_0x3d8469){return request(_0x6691('0x29'),{'body':_[_0x6691('0x2a')](_0x3d8469,{'project_name':_0x3d8469[_0x6691('0x2b')],'prev_project_name':_0x3d8469[_0x6691('0x2c')]||'','is_subproject':_0x3d8469['arg_2']?!![]:![],'leaveAt':moment()[_0x6691('0x2d')](_0x6691('0x2e'))})});};exports[_0x6691('0x2f')]=function(_0x539779){return request(_0x6691('0x30'),{'body':_0x539779});};exports[_0x6691('0x31')]=function(_0x304379){return request(_0x6691('0x32'),{'body':_0x304379});};exports['createCmContact']=function(_0xf6f0a2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xf6f0a2['phone'],'ListId':_0xf6f0a2[_0x6691('0x33')]}}})[_0x6691('0x6')](function(_0x218355){if(_0x218355){return _0x218355;}return request('CreateCmContact',{'body':_0xf6f0a2});});};exports['getPauseById']=function(_0x4e7632){return request(_0x6691('0x34'),{'options':{'where':{'id':_0x4e7632},'attributes':['name']}});};exports['agentLogin']=function(_0x2f8441,_0x54ac6e){return request(_0x6691('0x35'),{'body':{'interface':_0x54ac6e},'options':{'where':_0x2f8441}});};exports[_0x6691('0x36')]=function(_0xd96a0e,_0x3fda20,_0x1d2ffc){return request(_0x6691('0x37'),{'body':{'type':_0x3fda20,'uniqueid':_0x1d2ffc},'options':{'where':_0xd96a0e}});};exports[_0x6691('0x38')]=function(_0x4b6396){return request('UnpauseUser',{'body':{},'options':{'where':_0x4b6396}});};exports[_0x6691('0x39')]=function(_0x3fc61f){return request(_0x6691('0x3a'),{'body':{},'options':{'where':_0x3fc61f}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index b40d40a..8d6b36f 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ce3=['./lex','./polly'];(function(_0x457346,_0x2fca41){var _0x26d882=function(_0x209fd0){while(--_0x209fd0){_0x457346['push'](_0x457346['shift']());}};_0x26d882(++_0x2fca41);}(_0x8ce3,0xc3));var _0x38ce=function(_0xea46d,_0x254082){_0xea46d=_0xea46d-0x0;var _0x1fa4c5=_0x8ce3[_0xea46d];return _0x1fa4c5;};var polly=require(_0x38ce('0x0'));var lex=require(_0x38ce('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb903=['./lex','exports','./polly'];(function(_0x46891a,_0x3e3051){var _0x4c578d=function(_0x3cf400){while(--_0x3cf400){_0x46891a['push'](_0x46891a['shift']());}};_0x4c578d(++_0x3e3051);}(_0xb903,0x185));var _0x3b90=function(_0x15bb89,_0x31f315){_0x15bb89=_0x15bb89-0x0;var _0x5c5cad=_0xb903[_0x15bb89];return _0x5c5cad;};var polly=require(_0x3b90('0x0'));var lex=require(_0x3b90('0x1'));module[_0x3b90('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 3d86bfd..55460e0 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe829=['./lib/api','exports'];(function(_0x1076d4,_0x29aafc){var _0x30633c=function(_0xfc8fee){while(--_0xfc8fee){_0x1076d4['push'](_0x1076d4['shift']());}};_0x30633c(++_0x29aafc);}(_0xe829,0x1d8));var _0x9e82=function(_0xdcb46f,_0x8f628e){_0xdcb46f=_0xdcb46f-0x0;var _0x1382d8=_0xe829[_0xdcb46f];return _0x1382d8;};'use strict';var lex=require(_0x9e82('0x0'));module[_0x9e82('0x1')]=function(_0x221edd,_0x541e02,_0x559076,_0xf56525,_0x337730,_0x1b47d8){return lex(_0x221edd,_0x541e02,_0x559076,_0xf56525,_0x337730,_0x1b47d8);}; \ No newline at end of file +var _0x089f=['exports'];(function(_0xa4c4b4,_0x45fa4f){var _0x3da88c=function(_0x2cf71d){while(--_0x2cf71d){_0xa4c4b4['push'](_0xa4c4b4['shift']());}};_0x3da88c(++_0x45fa4f);}(_0x089f,0x1c7));var _0xf089=function(_0x3f4ec8,_0x3b9f52){_0x3f4ec8=_0x3f4ec8-0x0;var _0x4366b2=_0x089f[_0x3f4ec8];return _0x4366b2;};'use strict';var lex=require('./lib/api');module[_0xf089('0x0')]=function(_0x3722ad,_0x250c0e,_0x3c38bf,_0x196df6,_0x4a5f5f,_0x2b7602){return lex(_0x3722ad,_0x250c0e,_0x3c38bf,_0x196df6,_0x4a5f5f,_0x2b7602);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index ceeb163..fc17e61 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa29e=['slot_','exports','$LATEST','aws-sdk','slots','hasOwnProperty'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xa29e,0xf3));var _0xea29=function(_0x17c10a,_0xc9ee44){_0x17c10a=_0x17c10a-0x0;var _0x149440=_0xa29e[_0x17c10a];return _0x149440;};'use strict';var BPromise=require('bluebird');var AWS=require(_0xea29('0x0'));function lexResult(_0x2285a9,_0x4a72cc){return new BPromise(function(_0x1d750f,_0x12a726){_0x2285a9['postText'](_0x4a72cc,function(_0x4bd71a,_0x28b573){if(_0x4bd71a){_0x12a726(_0x4bd71a);}if(_0x28b573[_0xea29('0x1')]){for(const _0x171256 in _0x28b573[_0xea29('0x1')]){if(_0x28b573[_0xea29('0x1')][_0xea29('0x2')](_0x171256)){var _0x59ceed=_0x28b573[_0xea29('0x1')][_0x171256];_0x28b573[_0xea29('0x3')+_0x171256]=_0x59ceed;}}}_0x1d750f(_0x28b573);});});}module[_0xea29('0x4')]=function(_0x525e70,_0x3ab5f6,_0x3c1dce,_0xd6d373,_0x316cd7,_0x53ebf9){var _0x133b80=new AWS['LexRuntime']({'accessKeyId':_0x3ab5f6,'secretAccessKey':_0x3c1dce,'region':_0xd6d373});var _0x374104={'botAlias':_0xea29('0x5'),'botName':_0x53ebf9,'inputText':_0x316cd7,'userId':_0x525e70};return lexResult(_0x133b80,_0x374104);}; \ No newline at end of file +var _0x4c8d=['postText','slots','slot_','exports','LexRuntime','bluebird','aws-sdk'];(function(_0x3396cd,_0x4047f0){var _0x2d6b4a=function(_0x389663){while(--_0x389663){_0x3396cd['push'](_0x3396cd['shift']());}};_0x2d6b4a(++_0x4047f0);}(_0x4c8d,0xa6));var _0xd4c8=function(_0x229928,_0x49778d){_0x229928=_0x229928-0x0;var _0x215743=_0x4c8d[_0x229928];return _0x215743;};'use strict';var BPromise=require(_0xd4c8('0x0'));var AWS=require(_0xd4c8('0x1'));function lexResult(_0x5959d7,_0x577e03){return new BPromise(function(_0x4170a5,_0x5e6392){_0x5959d7[_0xd4c8('0x2')](_0x577e03,function(_0x8d6383,_0x1e30d3){if(_0x8d6383){_0x5e6392(_0x8d6383);}if(_0x1e30d3['slots']){for(const _0x2312ac in _0x1e30d3[_0xd4c8('0x3')]){if(_0x1e30d3[_0xd4c8('0x3')]['hasOwnProperty'](_0x2312ac)){var _0x52be4a=_0x1e30d3['slots'][_0x2312ac];_0x1e30d3[_0xd4c8('0x4')+_0x2312ac]=_0x52be4a;}}}_0x4170a5(_0x1e30d3);});});}module[_0xd4c8('0x5')]=function(_0x341e96,_0x2de719,_0x210442,_0x5df68c,_0x5a5387,_0xedebf8){var _0x5545df=new AWS[(_0xd4c8('0x6'))]({'accessKeyId':_0x2de719,'secretAccessKey':_0x210442,'region':_0x5df68c});var _0x3e6095={'botAlias':'$LATEST','botName':_0xedebf8,'inputText':_0x5a5387,'userId':_0x341e96};return lexResult(_0x5545df,_0x3e6095);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index c98c55c..4493d4a 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x3541d2,_0x51eab1,_0x49e726,_0x4d5855,_0x48ea0f,_0x16e1ca,_0x507184){return polly(_0x3541d2,_0x51eab1,_0x49e726,_0x4d5855,_0x48ea0f,_0x16e1ca,_0x507184);}; \ No newline at end of file +var _0xf206=['exports'];(function(_0x45468d,_0x17ec6b){var _0x53cc19=function(_0x303857){while(--_0x303857){_0x45468d['push'](_0x45468d['shift']());}};_0x53cc19(++_0x17ec6b);}(_0xf206,0x1e5));var _0x6f20=function(_0x40faf2,_0x4e0e3e){_0x40faf2=_0x40faf2-0x0;var _0x17b052=_0xf206[_0x40faf2];return _0x17b052;};'use strict';var polly=require('./lib/api');module[_0x6f20('0x0')]=function(_0x521dab,_0x350078,_0x5e35d1,_0x88b743,_0x2cec99,_0x1e52ab,_0x5f0a33){return polly(_0x521dab,_0x350078,_0x5e35d1,_0x88b743,_0x2cec99,_0x1e52ab,_0x5f0a33);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index d5b1edf..bc09e32 100644 --- a/server/services/agi/scripts/aws/polly/lib/api.js +++ b/server/services/agi/scripts/aws/polly/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ea1=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x4f6626,_0x174c8b){var _0x560038=function(_0x4527ce){while(--_0x4527ce){_0x4f6626['push'](_0x4f6626['shift']());}};_0x560038(++_0x174c8b);}(_0x9ea1,0x86));var _0x19ea=function(_0x579179,_0x26fbfe){_0x579179=_0x579179-0x0;var _0x42309b=_0x9ea1[_0x579179];return _0x42309b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x19ea('0x0'));var rs=require(_0x19ea('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x5da574,_0x474ec1,_0x1f9458){return new BPromise(function(_0x3ed4d7,_0x2a0775){_0x5da574[_0x19ea('0x2')](_0x474ec1,function(_0x73082d,_0x2ed338){if(_0x73082d){_0x2a0775(_0x73082d);}else if(_0x2ed338){if(_0x2ed338[_0x19ea('0x3')]instanceof Buffer){fs[_0x19ea('0x4')](_0x1f9458,_0x2ed338['AudioStream'],function(_0x46c103){if(_0x46c103){_0x2a0775(_0x46c103);}else{_0x3ed4d7();}});}else{_0x2a0775(new Error(_0x19ea('0x5')));}}else{_0x2a0775(new Error(_0x19ea('0x6')));}});});}module['exports']=function(_0x9bb021,_0x5e5919,_0x23bbbe,_0x563662,_0x528e43,_0x5a8e3a,_0x15a06a){var _0x335f0a=new AWS[(_0x19ea('0x7'))]({'accessKeyId':_0x9bb021,'secretAccessKey':_0x5e5919,'region':_0x23bbbe});var _0xcd6427={'Text':_0x528e43,'TextType':_0x5a8e3a||_0x19ea('0x8'),'OutputFormat':_0x19ea('0x9'),'VoiceId':_0x563662};return pollyResult(_0x335f0a,_0xcd6427,_0x15a06a);}; \ No newline at end of file +var _0xf427=['randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird'];(function(_0x4184dd,_0x55c769){var _0x1f903e=function(_0x2e34c6){while(--_0x2e34c6){_0x4184dd['push'](_0x4184dd['shift']());}};_0x1f903e(++_0x55c769);}(_0xf427,0x196));var _0x7f42=function(_0x20886d,_0x32d581){_0x20886d=_0x20886d-0x0;var _0xdce575=_0xf427[_0x20886d];return _0xdce575;};'use strict';var fs=require('fs');var path=require(_0x7f42('0x0'));var BPromise=require(_0x7f42('0x1'));var rs=require(_0x7f42('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x1dab8e,_0x288c9f,_0x9f0ce3){return new BPromise(function(_0x488a34,_0x24e72e){_0x1dab8e[_0x7f42('0x3')](_0x288c9f,function(_0x2425af,_0x6a547e){if(_0x2425af){_0x24e72e(_0x2425af);}else if(_0x6a547e){if(_0x6a547e[_0x7f42('0x4')]instanceof Buffer){fs[_0x7f42('0x5')](_0x9f0ce3,_0x6a547e['AudioStream'],function(_0x16ef23){if(_0x16ef23){_0x24e72e(_0x16ef23);}else{_0x488a34();}});}else{_0x24e72e(new Error(_0x7f42('0x6')));}}else{_0x24e72e(new Error(_0x7f42('0x7')));}});});}module[_0x7f42('0x8')]=function(_0x304fb4,_0x3c9ae4,_0x38d700,_0x548e39,_0x1dd3f8,_0x50e227,_0x2592fe){var _0x46e828=new AWS[(_0x7f42('0x9'))]({'accessKeyId':_0x304fb4,'secretAccessKey':_0x3c9ae4,'region':_0x38d700});var _0x3c905c={'Text':_0x1dd3f8,'TextType':_0x50e227||_0x7f42('0xa'),'OutputFormat':_0x7f42('0xb'),'VoiceId':_0x548e39};return pollyResult(_0x46e828,_0x3c905c,_0x2592fe);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 26267f4..c399e1c 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b39=['./lib/api'];(function(_0x11a0a0,_0x4e8dcb){var _0x57d04f=function(_0x2a9973){while(--_0x2a9973){_0x11a0a0['push'](_0x11a0a0['shift']());}};_0x57d04f(++_0x4e8dcb);}(_0x8b39,0x1d5));var _0x98b3=function(_0x34aa32,_0x276e0d){_0x34aa32=_0x34aa32-0x0;var _0x524e30=_0x8b39[_0x34aa32];return _0x524e30;};'use strict';var asr=require(_0x98b3('0x0'));module['exports']=function(_0x14a144,_0x58bc1e,_0x34ab4b,_0x5c67e5){return asr(_0x14a144,_0x58bc1e,_0x34ab4b);}; \ No newline at end of file +var _0xe4af=['exports'];(function(_0x1e7e68,_0x2f0217){var _0x414c55=function(_0x41c5a5){while(--_0x41c5a5){_0x1e7e68['push'](_0x1e7e68['shift']());}};_0x414c55(++_0x2f0217);}(_0xe4af,0x13c));var _0xfe4a=function(_0xcdcf2,_0x1e6048){_0xcdcf2=_0xcdcf2-0x0;var _0x35773b=_0xe4af[_0xcdcf2];return _0x35773b;};'use strict';var asr=require('./lib/api');module[_0xfe4a('0x0')]=function(_0x21e460,_0x505e47,_0x57c28a,_0x12874e){return asr(_0x21e460,_0x505e47,_0x57c28a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index df78cc2..e42415a 100644 --- a/server/services/agi/scripts/google/asr/lib/api.js +++ b/server/services/agi/scripts/google/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb1a=['LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','/v1/speech:recognize?key='];(function(_0x71e30c,_0x44ecf7){var _0x17fd3f=function(_0x404558){while(--_0x404558){_0x71e30c['push'](_0x71e30c['shift']());}};_0x17fd3f(++_0x44ecf7);}(_0xeb1a,0x1c8));var _0xaeb1=function(_0x9f9ed5,_0x56f438){_0x9f9ed5=_0x9f9ed5-0x0;var _0xbc71e3=_0xeb1a[_0x9f9ed5];return _0xbc71e3;};'use strict';var url=require(_0xaeb1('0x0'));var BPromise=require(_0xaeb1('0x1'));var fs=require('fs');var host=_0xaeb1('0x2');module[_0xaeb1('0x3')]=function(_0x11c49c,_0x4bb11b,_0x42ecc3){return new BPromise(function(_0x21968,_0x127cab){var _0x42e157;if(typeof _0x11c49c!==_0xaeb1('0x4')||_0x11c49c['length']===0x0){return _0x127cab('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4bb11b!==_0xaeb1('0x4')||_0x4bb11b[_0xaeb1('0x5')]===0x0){return _0x127cab(_0xaeb1('0x6'));}if(typeof _0x42ecc3!==_0xaeb1('0x7')&&(typeof _0x42ecc3!=='string'||_0x42ecc3[_0xaeb1('0x5')]===0x0)){return _0x127cab(_0xaeb1('0x8'));}try{_0x42e157=fs[_0xaeb1('0x9')](_0x11c49c)['toString'](_0xaeb1('0xa'));}catch(_0xe6ad4d){return _0x127cab(_0xe6ad4d);}return _0x21968({'method':'POST','uri':host+_0xaeb1('0xb')+_0x4bb11b,'body':{'config':{'encoding':_0xaeb1('0xc'),'sampleRateHertz':'8000','languageCode':_0x42ecc3},'audio':{'content':_0x42e157}},'json':!![]});});}; \ No newline at end of file +var _0xfc8a=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','length','undefined','readFileSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc8a,0xae));var _0xafc8=function(_0x471be9,_0x359087){_0x471be9=_0x471be9-0x0;var _0x336558=_0xfc8a[_0x471be9];return _0x336558;};'use strict';var url=require(_0xafc8('0x0'));var BPromise=require(_0xafc8('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xafc8('0x2')]=function(_0x84eae7,_0x480597,_0x577c6d){return new BPromise(function(_0x45a670,_0x4f88ab){var _0xc0ecba;if(typeof _0x84eae7!==_0xafc8('0x3')||_0x84eae7['length']===0x0){return _0x4f88ab(_0xafc8('0x4'));}if(typeof _0x480597!==_0xafc8('0x3')||_0x480597[_0xafc8('0x5')]===0x0){return _0x4f88ab('key\x20should\x20be\x20a\x20string');}if(typeof _0x577c6d!==_0xafc8('0x6')&&(typeof _0x577c6d!==_0xafc8('0x3')||_0x577c6d[_0xafc8('0x5')]===0x0)){return _0x4f88ab('lang\x20should\x20be\x20a\x20string');}try{_0xc0ecba=fs[_0xafc8('0x7')](_0x84eae7)[_0xafc8('0x8')](_0xafc8('0x9'));}catch(_0x27fcca){return _0x4f88ab(_0x27fcca);}return _0x45a670({'method':_0xafc8('0xa'),'uri':host+_0xafc8('0xb')+_0x480597,'body':{'config':{'encoding':_0xafc8('0xc'),'sampleRateHertz':_0xafc8('0xd'),'languageCode':_0x577c6d},'audio':{'content':_0xc0ecba}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index c281537..acbb1fe 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc820=['exports','./asr'];(function(_0x3091eb,_0x4f7112){var _0x238639=function(_0x2616e2){while(--_0x2616e2){_0x3091eb['push'](_0x3091eb['shift']());}};_0x238639(++_0x4f7112);}(_0xc820,0x1d9));var _0x0c82=function(_0x45607d,_0x2aa4d9){_0x45607d=_0x45607d-0x0;var _0x27e0a0=_0xc820[_0x45607d];return _0x27e0a0;};var asr=require(_0x0c82('0x0'));module[_0x0c82('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1324=['./asr'];(function(_0x184486,_0x36669d){var _0x55c949=function(_0x99217a){while(--_0x99217a){_0x184486['push'](_0x184486['shift']());}};_0x55c949(++_0x36669d);}(_0x1324,0x1c3));var _0x4132=function(_0x3c0444,_0x5dad2d){_0x3c0444=_0x3c0444-0x0;var _0x456e6f=_0x1324[_0x3c0444];return _0x456e6f;};var asr=require(_0x4132('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index d8f39ec..85e6662 100644 --- a/server/services/agi/scripts/index.js +++ b/server/services/agi/scripts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb3e=['error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','https:','get','data','end','wav','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','POST','generate','.mp3','writeFile','googleCloudTTS\x20path','googleTTS','utf8','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','en-US','null','generic','log','TRY\x20TO\x20GET2','RET:','RET\x20slic:','slice','eval\x20RET\x20slic:','AFTER\x20SLICE','ERR','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','REPONSE2','buffer2','filepath','goggleTTS\x20path','destination\x20ended\x202\x20da\x20gen','googleASR','asr','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','actionIncomplete','fulfillment','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','awsPolly','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','nda','text','CustomAction','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','path','WHAT_EVER','statusCode'];(function(_0x5c5c29,_0x10ae6d){var _0x338323=function(_0x426914){while(--_0x426914){_0x5c5c29['push'](_0x5c5c29['shift']());}};_0x338323(++_0x10ae6d);}(_0xbb3e,0x116));var _0xebb3=function(_0x2707f3,_0x464f91){_0x2707f3=_0x2707f3-0x0;var _0x5b0cfa=_0xbb3e[_0x2707f3];return _0x5b0cfa;};'use strict';var apiai=require(_0xebb3('0x0'));var BPromise=require(_0xebb3('0x1'));var dialogflow=require(_0xebb3('0x2'));var fs=require('fs');var http=require(_0xebb3('0x3'));var https=require(_0xebb3('0x4'));var md5=require(_0xebb3('0x5'));var path=require('path');var querystring=require(_0xebb3('0x6'));var rp=require(_0xebb3('0x7'));var rs=require(_0xebb3('0x8'));var sox=require(_0xebb3('0x9'));var tts=require('google-tts-api');var urlParse=require(_0xebb3('0xa'))[_0xebb3('0xb')];var util=require('util');var aws=require(_0xebb3('0xc'));var google=require(_0xebb3('0xd'));var sestek=require(_0xebb3('0xe'));var tilde=require(_0xebb3('0xf'));var logger=require(_0xebb3('0x10'))(_0xebb3('0x11'));var ISPEECH_API=_0xebb3('0x12');function downloadFile(_0x3413f7,_0x23d57f){return new BPromise(function(_0x4402a3,_0x3a556f){var _0x1b3ca5=urlParse(_0x3413f7);var _0x39b3dd=_0x1b3ca5[_0xebb3('0x13')]==='https:'?https:http;var _0x4ea779={'host':_0x1b3ca5[_0xebb3('0x14')],'path':_0x1b3ca5[_0xebb3('0x15')],'headers':{'user-agent':_0xebb3('0x16')}};_0x39b3dd['get'](_0x4ea779,function(_0x1f4d93){if(_0x1f4d93[_0xebb3('0x17')]!==0xc8){logger[_0xebb3('0x18')](_0xebb3('0x19')+_0x3413f7+_0xebb3('0x1a')+_0x1f4d93[_0xebb3('0x17')]+'\x20('+_0x1f4d93['statusMessage']+')');_0x3a556f(new Error(_0xebb3('0x19')+_0x3413f7+_0xebb3('0x1a')+_0x1f4d93[_0xebb3('0x17')]+'\x20('+_0x1f4d93[_0xebb3('0x1b')]+')'));return;}var _0x1c76bc=fs[_0xebb3('0x1c')](_0x23d57f);_0x1c76bc['on']('finish',function(){logger[_0xebb3('0x1d')](_0xebb3('0x1e'));_0x1c76bc[_0xebb3('0x1f')](_0x4402a3);});_0x1c76bc['on'](_0xebb3('0x18'),function(_0x43626a){fs[_0xebb3('0x20')](_0x23d57f);logger[_0xebb3('0x18')](_0xebb3('0x21'),_0x43626a);_0x3a556f(_0x43626a);});_0x1f4d93[_0xebb3('0x22')](_0x1c76bc);})['on'](_0xebb3('0x18'),function(_0xc42b54){logger['error'](_0xc42b54);_0x3a556f(_0xc42b54);})['end']();});}function uploadFile(_0x5c72ff){return new BPromise(function(_0xd6c2d1,_0x27fc35){var _0x499573=urlParse(_0x5c72ff);var _0x248c9e=_0x499573[_0xebb3('0x13')]===_0xebb3('0x23')?https:http;var _0x3affe3={'host':_0x499573[_0xebb3('0x14')],'path':_0x499573[_0xebb3('0x15')],'headers':{'user-agent':_0xebb3('0x16')}};_0x248c9e[_0xebb3('0x24')](_0x3affe3,function(_0x199ac9){if(_0x199ac9[_0xebb3('0x17')]!==0xc8){_0x27fc35(new Error('request\x20to\x20'+_0x5c72ff+'\x20failed,\x20status\x20code\x20=\x20'+_0x199ac9[_0xebb3('0x17')]+'\x20('+_0x199ac9['statusMessage']+')'));return;}var _0x27039c='';_0x199ac9['on'](_0xebb3('0x25'),function(_0x532958){_0x27039c+=_0x532958;});_0x199ac9['on'](_0xebb3('0x26'),function(){_0xd6c2d1(_0x27039c);});})['on'](_0xebb3('0x18'),function(_0x7dbd48){_0x27fc35(_0x7dbd48);})[_0xebb3('0x26')]();});}function convertFile(_0x51ec03,_0x33ec49){return new BPromise(function(_0x3fe8c8,_0x54102f){var _0x24b1be=sox['transcode'](_0x51ec03,_0x33ec49,{'sampleRate':0x1f40,'format':_0xebb3('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x24b1be['on'](_0xebb3('0x18'),function(_0x12fe2d){logger[_0xebb3('0x18')]('error\x20convert',_0x12fe2d);_0x54102f(_0x12fe2d);});_0x24b1be['on']('end',function(){logger['info'](_0xebb3('0x28'));_0x3fe8c8();});_0x24b1be[_0xebb3('0x29')]();});}function base64Decode(_0x23a3fc,_0x4f2443){var _0x2a9f43=path[_0xebb3('0x2a')](__dirname,_0xebb3('0x2b'),rs['generate'](0x4)+_0xebb3('0x2c'));fs[_0xebb3('0x2d')](_0x2a9f43,_0x23a3fc,_0xebb3('0x2e'));return convertFile(_0x2a9f43,_0x4f2443)[_0xebb3('0x2f')](function(){try{fs[_0xebb3('0x20')](_0x2a9f43);fs[_0xebb3('0x30')](_0x4f2443,_0xebb3('0x31'));}catch(_0x1de16a){logger[_0xebb3('0x18')](_0x1de16a);}return _0x4f2443[_0xebb3('0x32')]('.')[0x0];});}function base64Encode(_0x138ced){var _0x175b28=fs[_0xebb3('0x33')](_0x138ced);return new Buffer(_0x175b28)['toString'](_0xebb3('0x2e'));}exports[_0xebb3('0x34')]=function(_0xfad6cc,_0x4ad08e,_0xe2ad14,_0x148fb9,_0x2d9c64,_0x2d1e96){var _0x292722,_0x3fc922;var _0x2f8b55=_0xebb3('0x35');var _0x11882b=_0xebb3('0x36')+_0xfad6cc;var _0x2ddfc2={};if(_0x4ad08e==='ssml'){_0x2ddfc2['input']={'ssml':_0xe2ad14};}else{_0x2ddfc2[_0xebb3('0x37')]={'text':_0xe2ad14};};_0x2ddfc2[_0xebb3('0x38')]={'languageCode':_0x148fb9,'ssmlGender':_0x2d9c64};_0x2ddfc2['audioConfig']={'audioEncoding':_0xebb3('0x39'),'sampleRateHertz':0x1f40};var _0x221d08={'url':_0x2f8b55+_0xebb3('0x3a')+_0x11882b,'method':_0xebb3('0x3b'),'json':!![],'body':_0x2ddfc2};return rp(_0x221d08)[_0xebb3('0x2f')](function(_0x3743ee){return new BPromise(function(_0x5c1ba4,_0x2627d1){_0x292722=path[_0xebb3('0x2a')](__dirname,'tmp',rs[_0xebb3('0x3c')](0x4)+_0xebb3('0x3d'));var _0x2a36fe=Buffer['from'](_0x3743ee['audioContent'],_0xebb3('0x2e'));return fs[_0xebb3('0x3e')](_0x292722,_0x2a36fe,function(_0x3e546b){_0x2627d1(_0x3e546b);},function(_0x42741e){fs['chmodSync'](_0x292722,_0xebb3('0x31'));_0x5c1ba4(_0x42741e);});});})[_0xebb3('0x2f')](function(_0x73d601){_0x3fc922=path[_0xebb3('0x2a')](__dirname,_0xebb3('0x2b'),rs['generate'](0x4)+_0xebb3('0x2c'));return convertFile(_0x292722,_0x3fc922);})['then'](function(){try{fs[_0xebb3('0x20')](_0x292722);fs[_0xebb3('0x30')](_0x3fc922,'777');}catch(_0x131003){logger[_0xebb3('0x18')](_0x131003);}logger['info'](_0xebb3('0x3f'),_0x3fc922[_0xebb3('0x32')]('.')[0x0]);return _0x3fc922[_0xebb3('0x32')]('.')[0x0];});};exports[_0xebb3('0x40')]=function(_0x2e1eb7,_0x32dacd){var _0x38e902,_0x12c995;var _0x25ed5b;var _0x19405e={'encoding':_0xebb3('0x41'),'method':'POST','timeout':0x2710,'url':_0xebb3('0x42'),'headers':{'Content-Type':_0xebb3('0x43')},'body':_0xebb3('0x44')+encodeURIComponent(JSON['stringify']([[[_0xebb3('0x45'),JSON[_0xebb3('0x46')]([_0x2e1eb7,_0x32dacd||_0xebb3('0x47'),![],_0xebb3('0x48')]),null,_0xebb3('0x49')]]]))};console[_0xebb3('0x4a')](_0xebb3('0x4b'),_0x19405e);return rp(_0x19405e)['then'](function(_0x30b57b){console['log'](_0xebb3('0x4c'),_0x30b57b);try{console[_0xebb3('0x4a')](_0xebb3('0x4d'),_0x30b57b[_0xebb3('0x4e')](0x5));console[_0xebb3('0x4a')](_0xebb3('0x4f'),eval(_0x30b57b[_0xebb3('0x4e')](0x5))[0x0][0x2]);_0x25ed5b=eval(_0x30b57b[_0xebb3('0x4e')](0x5))[0x0][0x2];console[_0xebb3('0x4a')](_0xebb3('0x50'),_0x25ed5b);}catch(_0x5d1bd2){console[_0xebb3('0x4a')](_0xebb3('0x51'),_0x5d1bd2);throw new Error('parse\x20response\x20failed:\x0a'+res[_0xebb3('0x25')]);}if(!_0x25ed5b){throw new Error('lang\x20\x22'+lang+_0xebb3('0x52'));}try{_0x25ed5b=eval(_0x25ed5b)[0x0];}catch(_0x49055d){throw new Error(_0xebb3('0x53')+res['data']);}console[_0xebb3('0x4a')](_0xebb3('0x54'),_0x25ed5b);const _0x5e5b82=_0x25ed5b;console[_0xebb3('0x4a')](_0xebb3('0x55'),_0x5e5b82);_0x38e902=path[_0xebb3('0x2a')](__dirname,_0xebb3('0x2b'),rs['generate'](0x4)+_0xebb3('0x3d'));console[_0xebb3('0x4a')](_0xebb3('0x56'),_0x38e902);fs[_0xebb3('0x2d')](_0x38e902,_0x25ed5b,{'encoding':_0xebb3('0x2e')});_0x12c995=path['resolve'](__dirname,_0xebb3('0x2b'),rs[_0xebb3('0x3c')](0x4)+_0xebb3('0x2c'));console[_0xebb3('0x4a')]('desdt',_0x12c995);return convertFile(_0x38e902,_0x12c995);})[_0xebb3('0x2f')](function(){try{console[_0xebb3('0x4a')]('desdt',_0x12c995);fs[_0xebb3('0x30')](_0x12c995,_0xebb3('0x31'));}catch(_0x1ca8d1){logger['error'](_0x1ca8d1);}logger[_0xebb3('0x1d')](_0xebb3('0x57'),_0x12c995[_0xebb3('0x32')]('.')[0x0]);console[_0xebb3('0x4a')](_0xebb3('0x58'),_0x12c995['split']('.')[0x0]);return _0x12c995[_0xebb3('0x32')]('.')[0x0];});};exports[_0xebb3('0x59')]=function(_0x570571,_0x22896d,_0x58a326){return google[_0xebb3('0x5a')](_0x570571,_0x22896d,_0x58a326)['then'](function(_0x368768){logger[_0xebb3('0x1d')](_0x368768[_0xebb3('0x5b')]);return rp(_0x368768);})[_0xebb3('0x2f')](function(_0x1ac9bd){var _0xea95d0='';var _0x153360=0x0;try{fs[_0xebb3('0x20')](_0x570571);}catch(_0x98274c){logger[_0xebb3('0x18')](_0x98274c);}if(_0x1ac9bd&&_0x1ac9bd[_0xebb3('0x5c')]){_0xea95d0=_0x1ac9bd['results']['map'](function(_0x55c244){return _0x55c244&&_0x55c244[_0xebb3('0x5d')][0x0]&&_0x55c244['alternatives'][0x0][_0xebb3('0x5e')]?_0x55c244[_0xebb3('0x5d')][0x0][_0xebb3('0x5e')]:'';})['join']('\x0a');_0x153360=_0x1ac9bd[_0xebb3('0x5c')][_0xebb3('0x5f')](function(_0x1308c1){return _0x1308c1&&_0x1308c1['alternatives'][0x0]&&_0x1308c1[_0xebb3('0x5d')][0x0][_0xebb3('0x60')]?_0x1308c1[_0xebb3('0x5d')][0x0][_0xebb3('0x60')]:0x0;})[_0xebb3('0x61')]('\x0a');}logger['info'](_0xebb3('0x62'),_0xea95d0);logger[_0xebb3('0x1d')](_0xebb3('0x63'),_0x153360);return{'transcript':_0xea95d0,'confidence':_0x153360};})[_0xebb3('0x64')](function(_0x25e76f){logger['error'](_0xebb3('0x65'),_0x25e76f[_0xebb3('0x17')],_0x25e76f[_0xebb3('0x66')],_0x25e76f[_0xebb3('0x67')]);});};exports[_0xebb3('0x68')]=function(_0x446d0e,_0x1ec2fc,_0xe0740b,_0x618133){var _0x34298e=apiai(_0x1ec2fc,{'language':_0x618133||'en'});return _0x34298e[_0xebb3('0x69')](_0xe0740b,{'sessionId':md5(_0x446d0e)})[_0xebb3('0x2f')](function(_0x3ead87){logger['info'](JSON[_0xebb3('0x46')](_0x3ead87));return{'source':_0x3ead87['result']['source'],'resolvedQuery':_0x3ead87[_0xebb3('0x6a')][_0xebb3('0x6b')],'action':_0x3ead87['result']['action'],'actionIncomplete':_0x3ead87[_0xebb3('0x6a')][_0xebb3('0x6c')],'speech':_0x3ead87[_0xebb3('0x6a')][_0xebb3('0x6d')]['speech'],'score':_0x3ead87['result']['score'],'statusCode':_0x3ead87[_0xebb3('0x6e')][_0xebb3('0x6f')],'endConversation':_0x3ead87['result'][_0xebb3('0x70')][_0xebb3('0x71')]||![],'isFallbackIntent':_0x3ead87[_0xebb3('0x6a')]['metadata'][_0xebb3('0x72')]};});};exports[_0xebb3('0x73')]=function(_0x49f6c3,_0x3f6bdd,_0x1f8cec,_0x1ef4eb,_0x58dfbb,_0x321ec0){var _0x47e13d=_0x1ef4eb[_0xebb3('0x74')](/\\n/g,'\x0a');var _0x30e5a2={'credentials':{'private_key':_0x47e13d,'client_email':_0x1f8cec}};var _0x1954be=new dialogflow[(_0xebb3('0x75'))](_0x30e5a2);var _0x32678a=_0x1954be['sessionPath'](_0x3f6bdd,md5(_0x49f6c3));var _0x36d033={'session':_0x32678a,'queryInput':{'text':{'text':_0x58dfbb,'languageCode':_0x321ec0}}};return _0x1954be[_0xebb3('0x76')](_0x36d033)[_0xebb3('0x2f')](function(_0x268959){if(_0x268959&&_0x268959[_0xebb3('0x77')]){logger['info'](_0xebb3('0x78'),JSON[_0xebb3('0x46')](_0x268959));var _0x3c740a=_0x268959[0x0];if(_0x3c740a){var _0x16fd72={'action':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x7a')],'allRequiredParamsPresent':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x7b')],'endConversation':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x7c')]&&_0x3c740a[_0xebb3('0x79')][_0xebb3('0x7c')][_0xebb3('0x7d')]?_0x3c740a[_0xebb3('0x79')][_0xebb3('0x7c')][_0xebb3('0x7d')][_0xebb3('0x7e')][_0xebb3('0x7f')]:![],'fulfillmentText':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x80')],'intentName':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x81')][_0xebb3('0x66')],'intentDisplayName':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x81')][_0xebb3('0x82')],'isFallbackIntent':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x81')][_0xebb3('0x83')],'languageCode':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x84')],'queryText':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x85')],'responseId':_0x3c740a['responseId'],'score':_0x3c740a['queryResult'][_0xebb3('0x86')],'speech':_0x3c740a[_0xebb3('0x79')][_0xebb3('0x80')],'providerResponse':JSON[_0xebb3('0x46')](_0x268959)};return _0x16fd72;}}});};exports['tildeASR']=function(_0x24c9f7,_0x2f5f7c,_0x2d4e7d,_0x2f52ae){return tilde[_0xebb3('0x5a')](_0x24c9f7,_0x2f5f7c,_0x2d4e7d,_0x2f52ae)['then'](function(_0x2e0cc2){try{fs[_0xebb3('0x20')](_0x24c9f7);}catch(_0x4d65f9){logger['error'](_0x4d65f9);}logger[_0xebb3('0x1d')]('Tilde\x20ASR\x20transcription',_0x2e0cc2[_0xebb3('0x5e')]);logger[_0xebb3('0x1d')]('Tilde\x20ASR\x20confidence',_0x2e0cc2[_0xebb3('0x60')]);return _0x2e0cc2;});};exports[_0xebb3('0x87')]=function(_0x61accc,_0x51f489,_0x49e4b0,_0x5a6480,_0x175ead,_0x16e575){var _0x53c13c=path[_0xebb3('0x2a')](__dirname,_0xebb3('0x2b'),rs[_0xebb3('0x3c')](0x4)+_0xebb3('0x3d'));var _0x13fbe9;return aws[_0xebb3('0x88')](_0x61accc,_0x51f489,_0x49e4b0,_0x5a6480,_0x175ead,_0x16e575,_0x53c13c)[_0xebb3('0x2f')](function(){_0x13fbe9=path[_0xebb3('0x2a')](__dirname,_0xebb3('0x2b'),rs[_0xebb3('0x3c')](0x4)+'.wav');return convertFile(_0x53c13c,_0x13fbe9);})['then'](function(){try{fs[_0xebb3('0x20')](_0x53c13c);fs[_0xebb3('0x30')](_0x13fbe9,'777');}catch(_0x57cd8d){logger[_0xebb3('0x18')](_0x57cd8d);}return _0x13fbe9[_0xebb3('0x32')]('.')[0x0];});};exports['awsLex']=function(_0x1854cd,_0x4d9f0b,_0x43a9f9,_0x59fac4,_0x172b7,_0x460682){return aws[_0xebb3('0x89')](_0x1854cd,_0x4d9f0b,_0x43a9f9,_0x59fac4,_0x172b7,_0x460682)[_0xebb3('0x2f')](function(_0xcc25){logger[_0xebb3('0x1d')](JSON[_0xebb3('0x46')](_0xcc25));return _0xcc25;});};exports['ispeechTTS']=function(_0x54732a,_0x5eb6c0,_0x267330,_0x2d5d64){var _0x1e19fd=util[_0xebb3('0x8a')](_0xebb3('0x8b'),ISPEECH_API,_0x54732a,encodeURIComponent(_0x5eb6c0),_0x267330,_0x2d5d64);var _0x15912b=path[_0xebb3('0x2a')](__dirname,_0xebb3('0x2b'),rs['generate'](0x4)+_0xebb3('0x3d'));var _0x3cd33a;return downloadFile(_0x1e19fd,_0x15912b)[_0xebb3('0x2f')](function(){_0x3cd33a=path[_0xebb3('0x2a')](__dirname,_0xebb3('0x2b'),rs[_0xebb3('0x3c')](0x4)+'.wav');return convertFile(_0x15912b,_0x3cd33a);})[_0xebb3('0x2f')](function(){try{fs[_0xebb3('0x20')](_0x15912b);fs['chmodSync'](_0x3cd33a,'777');}catch(_0x4009e7){logger['error'](_0x4009e7);}return _0x3cd33a[_0xebb3('0x32')]('.')[0x0];});};exports[_0xebb3('0x8c')]=function(_0x341c87,_0x3d307e,_0x4ff608,_0x2f7703){var _0x1d9d7d=util[_0xebb3('0x8a')](_0xebb3('0x8d'),ISPEECH_API,_0x3d307e,_0x4ff608,base64Encode(_0x341c87),_0x2f7703?util[_0xebb3('0x8a')]('model=%s',encodeURIComponent(_0x2f7703)):'freeform=3');return uploadFile(_0x1d9d7d)['then'](function(_0x57eeae){return querystring[_0xebb3('0xb')](_0x57eeae);});};exports['sestekNDA']=function(_0x4ad499,_0xaf53d7){return sestek[_0xebb3('0x8e')](_0x4ad499,_0xaf53d7)[_0xebb3('0x2f')](function(_0x243787){logger[_0xebb3('0x1d')](JSON[_0xebb3('0x46')](_0x243787));var _0x462070={'speech':_0x243787[_0xebb3('0x8f')],'action':_0x243787['channelData']?_0x243787['channelData'][_0xebb3('0x90')]:undefined,'actiondata':_0x243787[_0xebb3('0x91')]?_0x243787['channelData'][_0xebb3('0x92')]:undefined};if(_0x243787[_0xebb3('0x91')]&&_0x243787[_0xebb3('0x91')]['AudioFromTts']){return base64Decode(_0x243787[_0xebb3('0x91')][_0xebb3('0x93')][_0xebb3('0x94')],path[_0xebb3('0x2a')](__dirname,_0xebb3('0x2b'),rs['generate'](0x4)+_0xebb3('0x2c')))[_0xebb3('0x2f')](function(_0x5c0efd){_0x462070[_0xebb3('0x95')]=_0x5c0efd;return _0x462070;});}return _0x462070;});};exports[_0xebb3('0x96')]=function(){return __dirname;}; \ No newline at end of file +var _0x710e=['Dialogflow\x20V2\x20response:','stringify','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','protocol','https:','host','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','info','error','download\x20error','pipe','end','data','transcode','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','?key=','ssml','input','voice','text:synthesize','POST','.mp3','from','audioContent','base64','writeFile','utf8','application/x-www-form-urlencoded','jQ1olc','en-US','null','log','RET:','RET\x20slic:','eval\x20RET\x20slic:','slice','ERR','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','REPONSE2','buffer2','filepath','desdt','destination\x20ended\x202\x20da\x20gen','googleASR','asr','uri','unlink','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','status','code','metadata','SessionsClient','detectIntent','length'];(function(_0xbabc93,_0x377f32){var _0x2a29c9=function(_0x34a13a){while(--_0x34a13a){_0xbabc93['push'](_0xbabc93['shift']());}};_0x2a29c9(++_0x377f32);}(_0x710e,0x1b9));var _0xe710=function(_0x1150d3,_0x1052d3){_0x1150d3=_0x1150d3-0x0;var _0x29188d=_0x710e[_0x1150d3];return _0x29188d;};'use strict';var apiai=require(_0xe710('0x0'));var BPromise=require(_0xe710('0x1'));var dialogflow=require(_0xe710('0x2'));var fs=require('fs');var http=require(_0xe710('0x3'));var https=require(_0xe710('0x4'));var md5=require(_0xe710('0x5'));var path=require(_0xe710('0x6'));var querystring=require(_0xe710('0x7'));var rp=require('request-promise');var rs=require(_0xe710('0x8'));var sox=require(_0xe710('0x9'));var tts=require(_0xe710('0xa'));var urlParse=require(_0xe710('0xb'))[_0xe710('0xc')];var util=require(_0xe710('0xd'));var aws=require('./aws');var google=require(_0xe710('0xe'));var sestek=require('./sestek');var tilde=require(_0xe710('0xf'));var logger=require(_0xe710('0x10'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x124edd,_0x579e4d){return new BPromise(function(_0x4a3cc1,_0x393170){var _0x37fe7f=urlParse(_0x124edd);var _0x2f72f9=_0x37fe7f[_0xe710('0x11')]===_0xe710('0x12')?https:http;var _0x322084={'host':_0x37fe7f[_0xe710('0x13')],'path':_0x37fe7f[_0xe710('0x6')],'headers':{'user-agent':_0xe710('0x14')}};_0x2f72f9[_0xe710('0x15')](_0x322084,function(_0x5149da){if(_0x5149da[_0xe710('0x16')]!==0xc8){logger['error']('request\x20to\x20'+_0x124edd+_0xe710('0x17')+_0x5149da[_0xe710('0x16')]+'\x20('+_0x5149da[_0xe710('0x18')]+')');_0x393170(new Error(_0xe710('0x19')+_0x124edd+'\x20failed,\x20status\x20code\x20=\x20'+_0x5149da['statusCode']+'\x20('+_0x5149da[_0xe710('0x18')]+')'));return;}var _0x1843e4=fs[_0xe710('0x1a')](_0x579e4d);_0x1843e4['on']('finish',function(){logger[_0xe710('0x1b')]('finish\x20download\x20file');_0x1843e4['close'](_0x4a3cc1);});_0x1843e4['on'](_0xe710('0x1c'),function(_0x3ff53c){fs['unlink'](_0x579e4d);logger['error'](_0xe710('0x1d'),_0x3ff53c);_0x393170(_0x3ff53c);});_0x5149da[_0xe710('0x1e')](_0x1843e4);})['on'](_0xe710('0x1c'),function(_0xf00a2c){logger['error'](_0xf00a2c);_0x393170(_0xf00a2c);})[_0xe710('0x1f')]();});}function uploadFile(_0x110488){return new BPromise(function(_0x105dc3,_0x17c7fd){var _0x408279=urlParse(_0x110488);var _0x3d3fc7=_0x408279[_0xe710('0x11')]===_0xe710('0x12')?https:http;var _0x470b8d={'host':_0x408279[_0xe710('0x13')],'path':_0x408279[_0xe710('0x6')],'headers':{'user-agent':_0xe710('0x14')}};_0x3d3fc7[_0xe710('0x15')](_0x470b8d,function(_0x2cca13){if(_0x2cca13[_0xe710('0x16')]!==0xc8){_0x17c7fd(new Error(_0xe710('0x19')+_0x110488+_0xe710('0x17')+_0x2cca13['statusCode']+'\x20('+_0x2cca13[_0xe710('0x18')]+')'));return;}var _0x5affb3='';_0x2cca13['on'](_0xe710('0x20'),function(_0x481d88){_0x5affb3+=_0x481d88;});_0x2cca13['on']('end',function(){_0x105dc3(_0x5affb3);});})['on']('error',function(_0x1b326a){_0x17c7fd(_0x1b326a);})['end']();});}function convertFile(_0x828f88,_0x2370fe){return new BPromise(function(_0x44d588,_0x5afaf8){var _0x52dac5=sox[_0xe710('0x21')](_0x828f88,_0x2370fe,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x52dac5['on'](_0xe710('0x1c'),function(_0x278611){logger[_0xe710('0x1c')]('error\x20convert',_0x278611);_0x5afaf8(_0x278611);});_0x52dac5['on'](_0xe710('0x1f'),function(){logger[_0xe710('0x1b')]('finish\x20to\x20convert');_0x44d588();});_0x52dac5[_0xe710('0x22')]();});}function base64Decode(_0x2668de,_0x345830){var _0x2ab188=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x26'));fs[_0xe710('0x27')](_0x2ab188,_0x2668de,'base64');return convertFile(_0x2ab188,_0x345830)[_0xe710('0x28')](function(){try{fs['unlink'](_0x2ab188);fs[_0xe710('0x29')](_0x345830,_0xe710('0x2a'));}catch(_0x42b245){logger[_0xe710('0x1c')](_0x42b245);}return _0x345830[_0xe710('0x2b')]('.')[0x0];});}function base64Encode(_0x5e9872){var _0x382bf4=fs[_0xe710('0x2c')](_0x5e9872);return new Buffer(_0x382bf4)[_0xe710('0x2d')]('base64');}exports['googleCloudTTS']=function(_0x21c6aa,_0x1efcdd,_0x4304ac,_0x4ee039,_0x2d26a0,_0x514687){var _0x100dfa,_0x4b356c;var _0x1c0a8a='https://texttospeech.googleapis.com/v1/';var _0xcd2bc8=_0xe710('0x2e')+_0x21c6aa;var _0x389124={};if(_0x1efcdd===_0xe710('0x2f')){_0x389124['input']={'ssml':_0x4304ac};}else{_0x389124[_0xe710('0x30')]={'text':_0x4304ac};};_0x389124[_0xe710('0x31')]={'languageCode':_0x4ee039,'ssmlGender':_0x2d26a0};_0x389124['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1d611e={'url':_0x1c0a8a+_0xe710('0x32')+_0xcd2bc8,'method':_0xe710('0x33'),'json':!![],'body':_0x389124};return rp(_0x1d611e)[_0xe710('0x28')](function(_0x708bee){return new BPromise(function(_0x38a863,_0xec2e36){_0x100dfa=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x34'));var _0x3baf33=Buffer[_0xe710('0x35')](_0x708bee[_0xe710('0x36')],_0xe710('0x37'));return fs[_0xe710('0x38')](_0x100dfa,_0x3baf33,function(_0x145388){_0xec2e36(_0x145388);},function(_0x2990c3){fs[_0xe710('0x29')](_0x100dfa,'777');_0x38a863(_0x2990c3);});});})[_0xe710('0x28')](function(_0x1a7b58){_0x4b356c=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x26'));return convertFile(_0x100dfa,_0x4b356c);})[_0xe710('0x28')](function(){try{fs['unlink'](_0x100dfa);fs['chmodSync'](_0x4b356c,_0xe710('0x2a'));}catch(_0x3d6a78){logger[_0xe710('0x1c')](_0x3d6a78);}logger[_0xe710('0x1b')]('googleCloudTTS\x20path',_0x4b356c[_0xe710('0x2b')]('.')[0x0]);return _0x4b356c['split']('.')[0x0];});};exports['googleTTS']=function(_0x228268,_0x1a9c70){var _0xd562fd,_0x15a3c5;var _0x53a555;var _0x398c16={'encoding':_0xe710('0x39'),'method':_0xe710('0x33'),'timeout':0x2710,'url':'https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','headers':{'Content-Type':_0xe710('0x3a')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xe710('0x3b'),JSON['stringify']([_0x228268,_0x1a9c70||_0xe710('0x3c'),![],_0xe710('0x3d')]),null,'generic']]]))};console['log']('TRY\x20TO\x20GET2',_0x398c16);return rp(_0x398c16)['then'](function(_0x5af2d4){console[_0xe710('0x3e')](_0xe710('0x3f'),_0x5af2d4);try{console[_0xe710('0x3e')](_0xe710('0x40'),_0x5af2d4['slice'](0x5));console[_0xe710('0x3e')](_0xe710('0x41'),eval(_0x5af2d4['slice'](0x5))[0x0][0x2]);_0x53a555=eval(_0x5af2d4[_0xe710('0x42')](0x5))[0x0][0x2];console['log']('AFTER\x20SLICE',_0x53a555);}catch(_0x289fdc){console['log'](_0xe710('0x43'),_0x289fdc);throw new Error('parse\x20response\x20failed:\x0a'+res[_0xe710('0x20')]);}if(!_0x53a555){throw new Error(_0xe710('0x44')+lang+_0xe710('0x45'));}try{_0x53a555=eval(_0x53a555)[0x0];}catch(_0x1c3313){throw new Error(_0xe710('0x46')+res[_0xe710('0x20')]);}console[_0xe710('0x3e')](_0xe710('0x47'),_0x53a555);const _0x4f9d4c=_0x53a555;console[_0xe710('0x3e')](_0xe710('0x48'),_0x4f9d4c);_0xd562fd=path['resolve'](__dirname,'tmp',rs[_0xe710('0x25')](0x4)+_0xe710('0x34'));console['log'](_0xe710('0x49'),_0xd562fd);fs[_0xe710('0x27')](_0xd562fd,_0x53a555,{'encoding':_0xe710('0x37')});_0x15a3c5=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x26'));console[_0xe710('0x3e')](_0xe710('0x4a'),_0x15a3c5);return convertFile(_0xd562fd,_0x15a3c5);})[_0xe710('0x28')](function(){try{console[_0xe710('0x3e')](_0xe710('0x4a'),_0x15a3c5);fs[_0xe710('0x29')](_0x15a3c5,_0xe710('0x2a'));}catch(_0x20b8e4){logger[_0xe710('0x1c')](_0x20b8e4);}logger[_0xe710('0x1b')]('goggleTTS\x20path',_0x15a3c5[_0xe710('0x2b')]('.')[0x0]);console[_0xe710('0x3e')](_0xe710('0x4b'),_0x15a3c5[_0xe710('0x2b')]('.')[0x0]);return _0x15a3c5['split']('.')[0x0];});};exports[_0xe710('0x4c')]=function(_0x43b65f,_0x2ca584,_0x3acb0a){return google[_0xe710('0x4d')](_0x43b65f,_0x2ca584,_0x3acb0a)[_0xe710('0x28')](function(_0x8052bb){logger[_0xe710('0x1b')](_0x8052bb[_0xe710('0x4e')]);return rp(_0x8052bb);})[_0xe710('0x28')](function(_0x1ff72b){var _0x576c8a='';var _0x27f0bc=0x0;try{fs[_0xe710('0x4f')](_0x43b65f);}catch(_0x14dde6){logger[_0xe710('0x1c')](_0x14dde6);}if(_0x1ff72b&&_0x1ff72b[_0xe710('0x50')]){_0x576c8a=_0x1ff72b[_0xe710('0x50')][_0xe710('0x51')](function(_0xa1a771){return _0xa1a771&&_0xa1a771[_0xe710('0x52')][0x0]&&_0xa1a771[_0xe710('0x52')][0x0][_0xe710('0x53')]?_0xa1a771[_0xe710('0x52')][0x0][_0xe710('0x53')]:'';})[_0xe710('0x54')]('\x0a');_0x27f0bc=_0x1ff72b[_0xe710('0x50')][_0xe710('0x51')](function(_0x1de2bf){return _0x1de2bf&&_0x1de2bf['alternatives'][0x0]&&_0x1de2bf['alternatives'][0x0][_0xe710('0x55')]?_0x1de2bf['alternatives'][0x0][_0xe710('0x55')]:0x0;})[_0xe710('0x54')]('\x0a');}logger[_0xe710('0x1b')]('googleASR\x20transcription',_0x576c8a);logger[_0xe710('0x1b')](_0xe710('0x56'),_0x27f0bc);return{'transcript':_0x576c8a,'confidence':_0x27f0bc};})['catch'](function(_0xebded7){logger[_0xe710('0x1c')](_0xe710('0x57'),_0xebded7[_0xe710('0x16')],_0xebded7[_0xe710('0x58')],_0xebded7[_0xe710('0x59')]);});};exports[_0xe710('0x5a')]=function(_0x4a32cc,_0x4663fd,_0x40e475,_0x503907){var _0x5d7bdb=apiai(_0x4663fd,{'language':_0x503907||'en'});return _0x5d7bdb[_0xe710('0x5b')](_0x40e475,{'sessionId':md5(_0x4a32cc)})[_0xe710('0x28')](function(_0x58acf1){logger[_0xe710('0x1b')](JSON['stringify'](_0x58acf1));return{'source':_0x58acf1['result'][_0xe710('0x5c')],'resolvedQuery':_0x58acf1[_0xe710('0x5d')][_0xe710('0x5e')],'action':_0x58acf1[_0xe710('0x5d')][_0xe710('0x5f')],'actionIncomplete':_0x58acf1[_0xe710('0x5d')][_0xe710('0x60')],'speech':_0x58acf1[_0xe710('0x5d')]['fulfillment']['speech'],'score':_0x58acf1[_0xe710('0x5d')]['score'],'statusCode':_0x58acf1[_0xe710('0x61')][_0xe710('0x62')],'endConversation':_0x58acf1[_0xe710('0x5d')][_0xe710('0x63')]['endConversation']||![],'isFallbackIntent':_0x58acf1['result'][_0xe710('0x63')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x316618,_0x216dd7,_0x4fa1f9,_0x346253,_0x16e147,_0x384553){var _0x108caf=_0x346253['replace'](/\\n/g,'\x0a');var _0x262f78={'credentials':{'private_key':_0x108caf,'client_email':_0x4fa1f9}};var _0x33af8f=new dialogflow[(_0xe710('0x64'))](_0x262f78);var _0x5c9c6c=_0x33af8f['sessionPath'](_0x216dd7,md5(_0x316618));var _0x3a80c9={'session':_0x5c9c6c,'queryInput':{'text':{'text':_0x16e147,'languageCode':_0x384553}}};return _0x33af8f[_0xe710('0x65')](_0x3a80c9)[_0xe710('0x28')](function(_0x47ba2a){if(_0x47ba2a&&_0x47ba2a[_0xe710('0x66')]){logger[_0xe710('0x1b')](_0xe710('0x67'),JSON[_0xe710('0x68')](_0x47ba2a));var _0x58a64f=_0x47ba2a[0x0];if(_0x58a64f){var _0x57613a={'action':_0x58a64f[_0xe710('0x69')][_0xe710('0x5f')],'allRequiredParamsPresent':_0x58a64f[_0xe710('0x69')][_0xe710('0x6a')],'endConversation':_0x58a64f[_0xe710('0x69')][_0xe710('0x6b')]&&_0x58a64f[_0xe710('0x69')][_0xe710('0x6b')][_0xe710('0x6c')]?_0x58a64f[_0xe710('0x69')][_0xe710('0x6b')][_0xe710('0x6c')]['end_conversation'][_0xe710('0x6d')]:![],'fulfillmentText':_0x58a64f['queryResult'][_0xe710('0x6e')],'intentName':_0x58a64f[_0xe710('0x69')][_0xe710('0x6f')][_0xe710('0x58')],'intentDisplayName':_0x58a64f[_0xe710('0x69')]['intent'][_0xe710('0x70')],'isFallbackIntent':_0x58a64f[_0xe710('0x69')]['intent'][_0xe710('0x71')],'languageCode':_0x58a64f[_0xe710('0x69')][_0xe710('0x72')],'queryText':_0x58a64f[_0xe710('0x69')][_0xe710('0x73')],'responseId':_0x58a64f[_0xe710('0x74')],'score':_0x58a64f[_0xe710('0x69')][_0xe710('0x75')],'speech':_0x58a64f['queryResult'][_0xe710('0x6e')],'providerResponse':JSON[_0xe710('0x68')](_0x47ba2a)};return _0x57613a;}}});};exports['tildeASR']=function(_0xc919bc,_0x50e9c1,_0x367525,_0x45803e){return tilde['asr'](_0xc919bc,_0x50e9c1,_0x367525,_0x45803e)[_0xe710('0x28')](function(_0xbfcb8f){try{fs['unlink'](_0xc919bc);}catch(_0x37740f){logger[_0xe710('0x1c')](_0x37740f);}logger['info'](_0xe710('0x76'),_0xbfcb8f['transcript']);logger[_0xe710('0x1b')]('Tilde\x20ASR\x20confidence',_0xbfcb8f['confidence']);return _0xbfcb8f;});};exports['awsPolly']=function(_0x2ab691,_0x26d1a5,_0x255a7b,_0x3a6c20,_0x1d25b1,_0x20b3a9){var _0x35c99d=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x34'));var _0x573881;return aws[_0xe710('0x77')](_0x2ab691,_0x26d1a5,_0x255a7b,_0x3a6c20,_0x1d25b1,_0x20b3a9,_0x35c99d)[_0xe710('0x28')](function(){_0x573881=path['resolve'](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+'.wav');return convertFile(_0x35c99d,_0x573881);})[_0xe710('0x28')](function(){try{fs[_0xe710('0x4f')](_0x35c99d);fs[_0xe710('0x29')](_0x573881,_0xe710('0x2a'));}catch(_0x4f2bad){logger[_0xe710('0x1c')](_0x4f2bad);}return _0x573881[_0xe710('0x2b')]('.')[0x0];});};exports['awsLex']=function(_0x23f3b0,_0x463149,_0x22ccf7,_0x5e1797,_0x21fb68,_0x185d60){return aws[_0xe710('0x78')](_0x23f3b0,_0x463149,_0x22ccf7,_0x5e1797,_0x21fb68,_0x185d60)[_0xe710('0x28')](function(_0x5dcde1){logger[_0xe710('0x1b')](JSON[_0xe710('0x68')](_0x5dcde1));return _0x5dcde1;});};exports[_0xe710('0x79')]=function(_0x17d713,_0x5c14f5,_0x124675,_0x40a8bb){var _0x431e94=util[_0xe710('0x7a')](_0xe710('0x7b'),ISPEECH_API,_0x17d713,encodeURIComponent(_0x5c14f5),_0x124675,_0x40a8bb);var _0x57d6d0=path[_0xe710('0x23')](__dirname,'tmp',rs[_0xe710('0x25')](0x4)+'.mp3');var _0x2e944b;return downloadFile(_0x431e94,_0x57d6d0)[_0xe710('0x28')](function(){_0x2e944b=path['resolve'](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+'.wav');return convertFile(_0x57d6d0,_0x2e944b);})[_0xe710('0x28')](function(){try{fs['unlink'](_0x57d6d0);fs[_0xe710('0x29')](_0x2e944b,_0xe710('0x2a'));}catch(_0x3909c2){logger[_0xe710('0x1c')](_0x3909c2);}return _0x2e944b[_0xe710('0x2b')]('.')[0x0];});};exports[_0xe710('0x7c')]=function(_0x4a36b5,_0x3b9a97,_0x26302e,_0x2b7cef){var _0x539f90=util[_0xe710('0x7a')](_0xe710('0x7d'),ISPEECH_API,_0x3b9a97,_0x26302e,base64Encode(_0x4a36b5),_0x2b7cef?util[_0xe710('0x7a')]('model=%s',encodeURIComponent(_0x2b7cef)):_0xe710('0x7e'));return uploadFile(_0x539f90)[_0xe710('0x28')](function(_0x318cf6){return querystring['parse'](_0x318cf6);});};exports[_0xe710('0x7f')]=function(_0x5cd3aa,_0x1c81ee){return sestek[_0xe710('0x80')](_0x5cd3aa,_0x1c81ee)[_0xe710('0x28')](function(_0x136e37){logger[_0xe710('0x1b')](JSON[_0xe710('0x68')](_0x136e37));var _0x24a3a2={'speech':_0x136e37[_0xe710('0x81')],'action':_0x136e37[_0xe710('0x82')]?_0x136e37[_0xe710('0x82')][_0xe710('0x83')]:undefined,'actiondata':_0x136e37[_0xe710('0x82')]?_0x136e37['channelData']['CustomActionData']:undefined};if(_0x136e37[_0xe710('0x82')]&&_0x136e37[_0xe710('0x82')][_0xe710('0x84')]){return base64Decode(_0x136e37[_0xe710('0x82')]['AudioFromTts'][_0xe710('0x85')],path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs['generate'](0x4)+_0xe710('0x26')))[_0xe710('0x28')](function(_0x38945d){_0x24a3a2[_0xe710('0x86')]=_0x38945d;return _0x24a3a2;});}return _0x24a3a2;});};exports[_0xe710('0x87')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 388b143..b6de878 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbea5=['exports','./nda'];(function(_0x504295,_0x1c2c5d){var _0x576c77=function(_0x52e5ed){while(--_0x52e5ed){_0x504295['push'](_0x504295['shift']());}};_0x576c77(++_0x1c2c5d);}(_0xbea5,0x177));var _0x5bea=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xbea5[_0x511bd1];return _0x4c48ec;};var nda=require(_0x5bea('0x0'));module[_0x5bea('0x1')]={'nda':nda}; \ No newline at end of file +var _0x1df0=['./nda','exports'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x1df0,0x1c0));var _0x01df=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x1df0[_0x3ab9ee];return _0x82ee88;};var nda=require(_0x01df('0x0'));module[_0x01df('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index a3a1c58..c3124d4 100644 --- a/server/services/agi/scripts/sestek/nda/index.js +++ b/server/services/agi/scripts/sestek/nda/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee3c=['POST','resolve','ndauth_url','/token','password','username','then','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','project','body','ProjectName','ndagenerate_audio','channelData','audio/wav','custom_action','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports'];(function(_0x97e1c,_0x1bead7){var _0x48100b=function(_0x13e183){while(--_0x13e183){_0x97e1c['push'](_0x97e1c['shift']());}};_0x48100b(++_0x1bead7);}(_0xee3c,0x1db));var _0xcee3=function(_0x2242c3,_0x578856){_0x2242c3=_0x2242c3-0x0;var _0x318923=_0xee3c[_0x2242c3];return _0x318923;};'use strict';var rp=require(_0xcee3('0x0'));var url=require(_0xcee3('0x1'));var logger=require(_0xcee3('0x2'))(_0xcee3('0x3'));module[_0xcee3('0x4')]=function(_0x30c4cd,_0x332286){var _0xee1db1={'method':_0xcee3('0x5'),'uri':url[_0xcee3('0x6')](_0x332286[_0xcee3('0x7')],_0xcee3('0x8')),'form':{'grant_type':_0xcee3('0x9'),'username':_0x332286[_0xcee3('0xa')],'password':_0x332286[_0xcee3('0x9')]},'json':!![]};return rp(_0xee1db1)[_0xcee3('0xb')](function(_0x38d414){var _0x4f2f4c={'method':_0xcee3('0x5'),'uri':url['resolve'](_0x332286['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x332286[_0xcee3('0xc')]||_0xcee3('0xd'),'channelId':_0xcee3('0xe'),'conversation':{'id':_0x30c4cd[_0xcee3('0xf')]},'from':{'id':_0x30c4cd[_0xcee3('0x10')],'name':_0x30c4cd[_0xcee3('0x11')]},'recipient':{'id':_0x30c4cd[_0xcee3('0x12')],'name':_0x30c4cd['extension']},'text':_0x332286[_0xcee3('0x13')],'channelData':{}},'headers':{'Authorization':_0xcee3('0x14')+_0x38d414['access_token']},'json':!![]};if(_0x332286[_0xcee3('0x15')]){_0x4f2f4c[_0xcee3('0x16')]['channelData'][_0xcee3('0x17')]=_0x332286[_0xcee3('0x15')];}if(_0x332286[_0xcee3('0x18')]=='1'){_0x4f2f4c['body'][_0xcee3('0x19')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xcee3('0x1a')};}if(_0x332286[_0xcee3('0x1b')]){_0x4f2f4c[_0xcee3('0x16')][_0xcee3('0x19')]['CustomAction']=_0x332286['custom_action'];if(_0x332286['custom_action_data']){_0x4f2f4c[_0xcee3('0x16')][_0xcee3('0x19')][_0xcee3('0x1c')]=_0x332286[_0xcee3('0x1d')];}}logger[_0xcee3('0x1e')](JSON[_0xcee3('0x1f')](_0x4f2f4c));return rp(_0x4f2f4c);});}; \ No newline at end of file +var _0x3495=['custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','CustomAction'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0x3495,0xa4));var _0x5349=function(_0x1edaf6,_0x259828){_0x1edaf6=_0x1edaf6-0x0;var _0x545921=_0x3495[_0x1edaf6];return _0x545921;};'use strict';var rp=require(_0x5349('0x0'));var url=require('url');var logger=require(_0x5349('0x1'))(_0x5349('0x2'));module[_0x5349('0x3')]=function(_0x4858b0,_0x2ad46f){var _0x130145={'method':_0x5349('0x4'),'uri':url[_0x5349('0x5')](_0x2ad46f[_0x5349('0x6')],_0x5349('0x7')),'form':{'grant_type':_0x5349('0x8'),'username':_0x2ad46f['username'],'password':_0x2ad46f[_0x5349('0x8')]},'json':!![]};return rp(_0x130145)[_0x5349('0x9')](function(_0x4837c5){var _0x56471c={'method':_0x5349('0x4'),'uri':url[_0x5349('0x5')](_0x2ad46f[_0x5349('0xa')],_0x5349('0xb')),'body':{'type':_0x2ad46f[_0x5349('0xc')]||_0x5349('0xd'),'channelId':_0x5349('0xe'),'conversation':{'id':_0x4858b0[_0x5349('0xf')]},'from':{'id':_0x4858b0[_0x5349('0x10')],'name':_0x4858b0[_0x5349('0x11')]},'recipient':{'id':_0x4858b0[_0x5349('0x12')],'name':_0x4858b0[_0x5349('0x13')]},'text':_0x2ad46f['text'],'channelData':{}},'headers':{'Authorization':_0x5349('0x14')+_0x4837c5['access_token']},'json':!![]};if(_0x2ad46f[_0x5349('0x15')]){_0x56471c[_0x5349('0x16')][_0x5349('0x17')][_0x5349('0x18')]=_0x2ad46f[_0x5349('0x15')];}if(_0x2ad46f[_0x5349('0x19')]=='1'){_0x56471c['body'][_0x5349('0x17')][_0x5349('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2ad46f['custom_action']){_0x56471c['body']['channelData'][_0x5349('0x1b')]=_0x2ad46f['custom_action'];if(_0x2ad46f[_0x5349('0x1c')]){_0x56471c[_0x5349('0x16')][_0x5349('0x17')][_0x5349('0x1d')]=_0x2ad46f[_0x5349('0x1c')];}}logger[_0x5349('0x1e')](JSON[_0x5349('0x1f')](_0x56471c));return rp(_0x56471c);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 51fce02..63df261 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecea=['./lib/api','exports'];(function(_0x3e4eec,_0x55e243){var _0x4f28cc=function(_0x4ccc4d){while(--_0x4ccc4d){_0x3e4eec['push'](_0x3e4eec['shift']());}};_0x4f28cc(++_0x55e243);}(_0xecea,0xc8));var _0xaece=function(_0x43bd6a,_0x1dc010){_0x43bd6a=_0x43bd6a-0x0;var _0x209e51=_0xecea[_0x43bd6a];return _0x209e51;};'use strict';var asr=require(_0xaece('0x0'));module[_0xaece('0x1')]=function(_0x82f18f,_0x40f596,_0x443e01,_0x4562ef){return asr(_0x82f18f,_0x40f596,_0x443e01,_0x4562ef);}; \ No newline at end of file +var _0xa3b3=['exports','./lib/api'];(function(_0x40c761,_0x168092){var _0x3adb32=function(_0x46e3ae){while(--_0x46e3ae){_0x40c761['push'](_0x40c761['shift']());}};_0x3adb32(++_0x168092);}(_0xa3b3,0x81));var _0x3a3b=function(_0x5051a4,_0x5d561c){_0x5051a4=_0x5051a4-0x0;var _0xd07a19=_0xa3b3[_0x5051a4];return _0xd07a19;};'use strict';var asr=require(_0x3a3b('0x0'));module[_0x3a3b('0x1')]=function(_0x4f57a5,_0xa34a6e,_0x45218f,_0x2a496f){return asr(_0x4f57a5,_0xa34a6e,_0x45218f,_0x2a496f);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 5e882d6..3fd0e47 100644 --- a/server/services/agi/scripts/tilde/asr/lib/api.js +++ b/server/services/agi/scripts/tilde/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b03=['Close\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','crypto','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','send','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','hypotheses','transcript','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error'];(function(_0x2db9db,_0x4267f6){var _0x206e88=function(_0x5178a7){while(--_0x5178a7){_0x2db9db['push'](_0x2db9db['shift']());}};_0x206e88(++_0x4267f6);}(_0x3b03,0x124));var _0x33b0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3b03[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x33b0('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x33b0('0x1'));var crypto=require(_0x33b0('0x2'));var logger=require('../../../../../../config/logger')(_0x33b0('0x3'));module['exports']=function(_0x523888,_0x4d3b70,_0x49f707,_0x553321){return new BPromise(function(_0x28d46f,_0x2f66d1){logger[_0x33b0('0x4')](_0x33b0('0x5'),_0x553321||_0x33b0('0x6'));var _0x156b7d=new WebSocket(_0x553321||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x248a0f='';var _0xc0e171='0';var _0x5e4d3e='1';var _0x37fb50='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x31d27d(_0x294b08){var _0xad30cd=crypto[_0x33b0('0x7')](_0x33b0('0x8'));_0xad30cd['update'](_0x294b08);return _0xad30cd[_0x33b0('0x9')]('hex');}function _0x73ee5c(){try{logger[_0x33b0('0x4')](_0x33b0('0xa'));var _0x547c59=moment()['unix']();var _0x4ba2cb=_0x31d27d(_0x547c59+_0x4d3b70+_0x49f707);_0x156b7d[_0x33b0('0xb')](JSON['stringify']({'appID':_0x4d3b70,'timestamp':_0x547c59,'appKey':_0x4ba2cb}));var _0x42baf3=fs[_0x33b0('0xc')](_0x523888);_0x42baf3['on']('data',function(_0x4e72ac){_0x156b7d['send'](_0x4e72ac);});_0x42baf3['on'](_0x33b0('0xd'),function(){_0x156b7d[_0x33b0('0xb')](_0x33b0('0xe'));});}catch(_0x5e2097){logger[_0x33b0('0xf')](_0x33b0('0x10'),JSON[_0x33b0('0x11')](_0x5e2097));_0x156b7d[_0x33b0('0x12')]();}}function _0x37913f(_0x5b5000){try{if(_0x5b5000){var _0x56a4a7=JSON[_0x33b0('0x13')](_0x5b5000);switch(_0x56a4a7[_0x33b0('0x14')]){case 0x0:if(_0x56a4a7[_0x33b0('0x15')]){if(_0x56a4a7['result'][_0x33b0('0x16')]){logger[_0x33b0('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0x33b0('0x11')](_0x56a4a7[_0x33b0('0x15')][_0x33b0('0x17')]));_0x248a0f=_0x56a4a7[_0x33b0('0x15')][_0x33b0('0x17')][0x0][_0x33b0('0x18')];_0xc0e171=_0x56a4a7[_0x33b0('0x15')][_0x33b0('0x17')][0x0][_0x33b0('0x19')];_0x5e4d3e='0';_0x37fb50='Success.';_0x156b7d['terminate']();}}break;case 0x1:logger[_0x33b0('0x4')](_0x33b0('0x1a'));_0x5e4d3e='1';_0x37fb50='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x33b0('0x4')](_0x33b0('0x1b'));_0x5e4d3e='2';_0x37fb50='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x33b0('0x4')](_0x33b0('0x1c'));_0x5e4d3e='9';_0x37fb50=_0x33b0('0x1c');break;case 0xa:logger[_0x33b0('0x4')](_0x33b0('0x1d'));_0x5e4d3e='10';_0x37fb50=_0x33b0('0x1d');break;case 0xb:logger[_0x33b0('0x4')](_0x33b0('0x1e'));_0x5e4d3e='11';_0x37fb50=_0x33b0('0x1e');}}}catch(_0x1db6a3){logger['error'](_0x33b0('0x1f'),JSON['stringify'](_0x1db6a3));_0x156b7d['terminate']();}}function _0x5e522d(){logger[_0x33b0('0x4')](_0x33b0('0x20'));_0x28d46f({'transcript':_0x248a0f,'confidence':_0xc0e171,'status':_0x5e4d3e,'status_message':_0x37fb50});}function _0x2ba39b(_0x378b3d){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x33b0('0x21')](_0x378b3d)){logger['error'](_['isObject'](_0x378b3d)?JSON[_0x33b0('0x11')](_0x378b3d):_0x378b3d);}}_0x156b7d['on'](_0x33b0('0x22'),_0x73ee5c);_0x156b7d['on'](_0x33b0('0x23'),_0x37913f);_0x156b7d['on']('close',_0x5e522d);_0x156b7d['on'](_0x33b0('0xf'),_0x2ba39b);});}; \ No newline at end of file +var _0x23b6=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','Tilde\x20ASR\x20send\x20error','parse','result','hypotheses','likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0xbccd1e,_0x28f231){var _0x44ddec=function(_0x7a18c5){while(--_0x7a18c5){_0xbccd1e['push'](_0xbccd1e['shift']());}};_0x44ddec(++_0x28f231);}(_0x23b6,0x8f));var _0x623b=function(_0x59dd83,_0x573f1b){_0x59dd83=_0x59dd83-0x0;var _0x5dd0de=_0x23b6[_0x59dd83];return _0x5dd0de;};'use strict';var BPromise=require('bluebird');var _=require(_0x623b('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x623b('0x1'));var crypto=require(_0x623b('0x2'));var logger=require(_0x623b('0x3'))(_0x623b('0x4'));module[_0x623b('0x5')]=function(_0x5409b7,_0x44f9aa,_0x395dfc,_0x490ed9){return new BPromise(function(_0xe42d63,_0xdf5e1d){logger[_0x623b('0x6')](_0x623b('0x7'),_0x490ed9||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2063b3=new WebSocket(_0x490ed9||_0x623b('0x8'),{'perMessageDeflate':![]});var _0x41b552='';var _0x15bdd0='0';var _0x42b064='1';var _0x4500d2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2760ed(_0x112053){var _0x2ca7c6=crypto[_0x623b('0x9')]('sha1');_0x2ca7c6[_0x623b('0xa')](_0x112053);return _0x2ca7c6['digest']('hex');}function _0x2e3337(){try{logger[_0x623b('0x6')](_0x623b('0xb'));var _0x164eae=moment()['unix']();var _0x49316f=_0x2760ed(_0x164eae+_0x44f9aa+_0x395dfc);_0x2063b3[_0x623b('0xc')](JSON[_0x623b('0xd')]({'appID':_0x44f9aa,'timestamp':_0x164eae,'appKey':_0x49316f}));var _0x53d158=fs[_0x623b('0xe')](_0x5409b7);_0x53d158['on'](_0x623b('0xf'),function(_0x45a890){_0x2063b3[_0x623b('0xc')](_0x45a890);});_0x53d158['on'](_0x623b('0x10'),function(){_0x2063b3['send']('EOS');});}catch(_0x1db0c1){logger['error'](_0x623b('0x11'),JSON[_0x623b('0xd')](_0x1db0c1));_0x2063b3['terminate']();}}function _0x4c8ffe(_0x1d86ad){try{if(_0x1d86ad){var _0x36e82a=JSON[_0x623b('0x12')](_0x1d86ad);switch(_0x36e82a['status']){case 0x0:if(_0x36e82a['result']){if(_0x36e82a[_0x623b('0x13')]['final']){logger[_0x623b('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0x623b('0xd')](_0x36e82a[_0x623b('0x13')][_0x623b('0x14')]));_0x41b552=_0x36e82a[_0x623b('0x13')][_0x623b('0x14')][0x0]['transcript'];_0x15bdd0=_0x36e82a[_0x623b('0x13')]['hypotheses'][0x0][_0x623b('0x15')];_0x42b064='0';_0x4500d2=_0x623b('0x16');_0x2063b3[_0x623b('0x17')]();}}break;case 0x1:logger[_0x623b('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x42b064='1';_0x4500d2=_0x623b('0x18');break;case 0x2:logger[_0x623b('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x42b064='2';_0x4500d2='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x42b064='9';_0x4500d2=_0x623b('0x19');break;case 0xa:logger['info']('Authentication\x20failed.');_0x42b064='10';_0x4500d2=_0x623b('0x1a');break;case 0xb:logger[_0x623b('0x6')](_0x623b('0x1b'));_0x42b064='11';_0x4500d2=_0x623b('0x1b');}}}catch(_0x2e1189){logger[_0x623b('0x1c')](_0x623b('0x1d'),JSON[_0x623b('0xd')](_0x2e1189));_0x2063b3[_0x623b('0x17')]();}}function _0x17b914(){logger[_0x623b('0x6')](_0x623b('0x1e'));_0xe42d63({'transcript':_0x41b552,'confidence':_0x15bdd0,'status':_0x42b064,'status_message':_0x4500d2});}function _0x41f223(_0x2bed14){logger[_0x623b('0x1c')](_0x623b('0x1f'));if(!_['isNil'](_0x2bed14)){logger[_0x623b('0x1c')](_[_0x623b('0x20')](_0x2bed14)?JSON['stringify'](_0x2bed14):_0x2bed14);}}_0x2063b3['on']('open',_0x2e3337);_0x2063b3['on'](_0x623b('0x21'),_0x4c8ffe);_0x2063b3['on'](_0x623b('0x10'),_0x17b914);_0x2063b3['on'](_0x623b('0x1c'),_0x41f223);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index ee8312e..519083c 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfaa=['exports','./asr'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0xdfaa,0xa5));var _0xadfa=function(_0x49a009,_0xa3df14){_0x49a009=_0x49a009-0x0;var _0x2b7683=_0xdfaa[_0x49a009];return _0x2b7683;};var asr=require(_0xadfa('0x0'));module[_0xadfa('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0ebd=['exports','./asr'];(function(_0xdb50e1,_0x112a80){var _0x2a50fc=function(_0xd47d89){while(--_0xd47d89){_0xdb50e1['push'](_0xdb50e1['shift']());}};_0x2a50fc(++_0x112a80);}(_0x0ebd,0xa9));var _0xd0eb=function(_0x2edda3,_0x144ee7){_0x2edda3=_0x2edda3-0x0;var _0x393e1a=_0x0ebd[_0x2edda3];return _0x393e1a;};var asr=require(_0xd0eb('0x0'));module[_0xd0eb('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 326fc2f..b2a3ea7 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c76=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','code','nextTick','inherits','util','net','events','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','listen','listening'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x6c76,0x184));var _0x66c7=function(_0x20ece3,_0x4c77a7){_0x20ece3=_0x20ece3-0x0;var _0x3b6947=_0x6c76[_0x20ece3];return _0x3b6947;};'use strict';var util=require(_0x66c7('0x0'));var net=require(_0x66c7('0x1'));var EventEmitter=require(_0x66c7('0x2'))['EventEmitter'];var AGIError=require(_0x66c7('0x3'));var AGIChannel=require(_0x66c7('0x4'));var AGIServer=function(_0x519756,_0x572a2b,_0x2f6db7){var _0x2b7cf3=this,_0x519756=_0x519756||0x11dd,_0x572a2b=_0x572a2b||_0x66c7('0x5'),_0x45b0a5=null,_0x52f71b=0x0;EventEmitter['call'](_0x2b7cf3);function _0x4fa6ce(){if(!_0x519756){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0x8')));return![];}_0x45b0a5=net['createServer']();_0x45b0a5[_0x66c7('0x9')](_0x519756,_0x572a2b);_0x45b0a5['on'](_0x66c7('0xa'),function(){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0xa'));});_0x45b0a5['on']('connection',function(_0x464085){_0x45b0a5[_0x66c7('0xb')](function(_0x26c9b2,_0x187e00){if(_0x26c9b2){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0xc'),_0x26c9b2));}else if(_0x2f6db7&&_0x2f6db7<0x0){_0x2b7cf3['emit'](_0x66c7('0x7'),new AGIError(_0x66c7('0xd')));_0x464085[_0x66c7('0xe')]();}else if(_0x2f6db7&&_0x2f6db7>0x0&&_0x2f6db7<_0x187e00){_0x52f71b+=0x1;_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0xf'),_0x52f71b));_0x464085[_0x66c7('0xe')]();}else{var _0xf3b04=new AGIChannel(_0x464085);_0xf3b04['on'](_0x66c7('0x10'),function(){_0x2b7cf3['emit'](_0x66c7('0x11'),_0xf3b04);});}});});_0x45b0a5['on']('error',function(_0x208010){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0xc'),_0x208010[_0x66c7('0x12')]));});_0x45b0a5['on']('close',function(){_0x2b7cf3['emit']('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x66c7('0x13')](function(){_0x4fa6ce();});};util[_0x66c7('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x524e87,_0x256b0a,_0x9b65cf){return new AGIServer(_0x524e87,_0x256b0a,_0x9b65cf);}; \ No newline at end of file +var _0x6ddd=['connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','events','EventEmitter','./error','./channel','call','emit','error','createServer','listen','listening'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6ddd,0xae));var _0xd6dd=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6ddd[_0x126558];return _0x1f6d14;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0xd6dd('0x0'))[_0xd6dd('0x1')];var AGIError=require(_0xd6dd('0x2'));var AGIChannel=require(_0xd6dd('0x3'));var AGIServer=function(_0x5283c5,_0x3651aa,_0x5aebd8){var _0x1ab3df=this,_0x5283c5=_0x5283c5||0x11dd,_0x3651aa=_0x3651aa||'127.0.0.1',_0x27439a=null,_0x47005f=0x0;EventEmitter[_0xd6dd('0x4')](_0x1ab3df);function _0x1f0c46(){if(!_0x5283c5){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x27439a=net[_0xd6dd('0x7')]();_0x27439a[_0xd6dd('0x8')](_0x5283c5,_0x3651aa);_0x27439a['on'](_0xd6dd('0x9'),function(){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x9'));});_0x27439a['on'](_0xd6dd('0xa'),function(_0x1c5afd){_0x27439a[_0xd6dd('0xb')](function(_0x1c52dc,_0x1aaa1b){if(_0x1c52dc){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x1c52dc));}else if(_0x5aebd8&&_0x5aebd8<0x0){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError(_0xd6dd('0xc')));_0x1c5afd[_0xd6dd('0xd')]();}else if(_0x5aebd8&&_0x5aebd8>0x0&&_0x5aebd8<_0x1aaa1b){_0x47005f+=0x1;_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError(_0xd6dd('0xe'),_0x47005f));_0x1c5afd['destroy']();}else{var _0x305928=new AGIChannel(_0x1c5afd);_0x305928['on'](_0xd6dd('0xf'),function(){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0xa'),_0x305928);});}});});_0x27439a['on'](_0xd6dd('0x6'),function(_0x2c935e){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError(_0xd6dd('0x10'),_0x2c935e[_0xd6dd('0x11')]));});_0x27439a['on'](_0xd6dd('0x12'),function(){_0x1ab3df[_0xd6dd('0x5')]('close',new AGIError(_0xd6dd('0x13')));});}process[_0xd6dd('0x14')](function(){_0x1f0c46();});};util[_0xd6dd('0x15')](AGIServer,EventEmitter);module[_0xd6dd('0x16')]=function(_0x56c051,_0x4cd37d,_0x84a5d4){return new AGIServer(_0x56c051,_0x4cd37d,_0x84a5d4);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c1ffca9..b3d0b13 100644 --- a/server/services/agi/vertices.js +++ b/server/services/agi/vertices.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5266=['Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','getSmsAccount','createSquareDetailsReport','channel','agicommand','arg_1','createSquareRecording','uniqueid','callerid','context','extension','priority','dnid','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','scheduledAt','callback','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','method','timeout','includes','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','url','headers','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','agi','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20found','forEach','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','variable\x20%s[key]\x20set','menu','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','randomstring','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','getVariableById','then','name','catch','prototype','getVoiceQueue','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','getQueryOdbc','open','error'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x5266,0x1a2));var _0x6526=function(_0x4da78e,_0x13cb84){_0x4da78e=_0x4da78e-0x0;var _0x4463b1=_0x5266[_0x4da78e];return _0x4463b1;};'use strict';var fs=require('fs');var path=require(_0x6526('0x0'));var util=require(_0x6526('0x1'));var _=require(_0x6526('0x2'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x6526('0x3'));var moment=require('moment');var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x6526('0x4'))('agi');var config=require(_0x6526('0x5'));var scripts=require(_0x6526('0x6'));var FILES_PATH=_0x6526('0x7');var recursiveMapAttributes=[_0x6526('0x8'),_0x6526('0x9')];var verticesWithRetry=['menu',_0x6526('0xa'),_0x6526('0xb')];var AGIVertices=function(_0x1ea2c7,_0x8cf6d5,_0x44a4c0){this['channel']=_0x1ea2c7;this['rpc']=_0x8cf6d5;this['mailRpc']=_0x44a4c0;};AGIVertices['prototype']['getVariable']=function(_0x1b182c,_0x3d5112){this['rpc'][_0x6526('0xc')](_0x1b182c)[_0x6526('0xd')](function(_0xb06b4e){_0x3d5112(null,_0xb06b4e?_0xb06b4e[_0x6526('0xe')]:![]);})[_0x6526('0xf')](function(_0x35f0ab){_0x3d5112(_0x35f0ab);});};AGIVertices[_0x6526('0x10')][_0x6526('0x11')]=function(_0x2fca3f,_0x1fb193){this[_0x6526('0x12')]['getVoiceQueueById'](_0x2fca3f)[_0x6526('0xd')](function(_0x494503){_0x1fb193(null,_0x494503?_0x494503[_0x6526('0xe')]:![]);})[_0x6526('0xf')](function(_0x35dcd9){_0x1fb193(_0x35dcd9);});};AGIVertices[_0x6526('0x10')]['getSquareProject']=function(_0x3e295b,_0x57a9ad){this[_0x6526('0x12')][_0x6526('0x13')](_0x3e295b)['then'](function(_0x350409){_0x57a9ad(null,_0x350409?_0x350409['name']:![]);})[_0x6526('0xf')](function(_0x5b78ff){_0x57a9ad(_0x5b78ff);});};AGIVertices['prototype'][_0x6526('0x14')]=function(_0x1afa4b,_0x22c515){this['rpc'][_0x6526('0x15')](_0x1afa4b)[_0x6526('0xd')](function(_0x300552){_0x22c515(null,_0x300552?_0x300552[_0x6526('0x16')]:![]);})[_0x6526('0xf')](function(_0x20bd0f){_0x22c515(_0x20bd0f);});};AGIVertices[_0x6526('0x10')][_0x6526('0x17')]=function(_0x5da193,_0x84961f){this[_0x6526('0x12')][_0x6526('0x18')](_0x5da193)[_0x6526('0xd')](function(_0x5b84b8){_0x84961f(null,_0x5b84b8?_0x5b84b8[_0x6526('0xe')]:![]);})[_0x6526('0xf')](function(_0x148b7b){_0x84961f(_0x148b7b);});};AGIVertices['prototype'][_0x6526('0x19')]=function(_0x114700,_0x4c1628){this['rpc'][_0x6526('0x1a')](_0x114700)['then'](function(_0x4fb27d){_0x4c1628(null,_0x4fb27d?_0x4fb27d[_0x6526('0xe')]:![]);})['catch'](function(_0x13bddd){_0x4c1628(_0x13bddd);});};AGIVertices[_0x6526('0x10')][_0x6526('0x1b')]=function(_0x2aab5b,_0x34b97b){var _0x874900=this;this[_0x6526('0x12')][_0x6526('0x1c')](_0x2aab5b)['then'](function(_0x4ab606){_0x34b97b(null,_0x4ab606?_0x874900[_0x6526('0x1d')](_0x4ab606[_0x6526('0x1e')]):![]);})[_0x6526('0xf')](function(_0x2b7ad4){_0x34b97b(_0x2b7ad4);});};AGIVertices[_0x6526('0x10')][_0x6526('0x1f')]=function(_0x553c72,_0xd347fd){this[_0x6526('0x12')][_0x6526('0x20')](_0x553c72)[_0x6526('0xd')](function(_0x8b4ca){_0xd347fd(null,_0x8b4ca?_0x8b4ca:![]);})[_0x6526('0xf')](function(_0x39b2d8){_0xd347fd(_0x39b2d8);});};AGIVertices['prototype'][_0x6526('0x21')]=function(_0x507b91,_0x50eef4,_0x2e6a15){this['mailRpc'][_0x6526('0x21')](_0x507b91,_0x50eef4)['then'](function(){_0x2e6a15(null);})['catch'](function(_0x480f3c){_0x2e6a15(_0x480f3c);});};AGIVertices[_0x6526('0x10')]['getIntervals']=function(_0x124c11,_0x1068a7){this[_0x6526('0x12')]['getIntervalById'](_0x124c11)[_0x6526('0xd')](function(_0xc8099c){if(_0xc8099c){if(_0xc8099c[_0x6526('0x22')]){_0x1068a7(null,[_0xc8099c[_0x6526('0x23')]]);}else{_0x1068a7(null,_['map'](_0xc8099c[_0x6526('0x24')],'interval'));}}else{_0x1068a7(null,![]);}})['catch'](function(_0x2545c1){_0x1068a7(_0x2545c1);});};AGIVertices['prototype'][_0x6526('0x1d')]=function(_0x9b41cd){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x9b41cd);};AGIVertices[_0x6526('0x10')][_0x6526('0x25')]=function(_0x31c85b,_0x47520e,_0x3321a1){odbc[_0x6526('0x26')](_0x31c85b,function(_0x21a8fb){if(_0x21a8fb){logger[_0x6526('0x27')](_0x6526('0x28'),_0x21a8fb);_0x3321a1(_0x21a8fb);}else{logger['info'](_0x6526('0x29'));odbc[_0x6526('0x2a')](_0x47520e,function(_0x9ed894,_0x112a85){if(_0x9ed894){logger['info'](_0x6526('0x2b'),_0x47520e);_0x3321a1(_0x9ed894);}else{logger[_0x6526('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x47520e);odbc['close'](function(_0x1c7ee2){if(_0x1c7ee2){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1c7ee2);}_0x3321a1(null,_0x112a85);});}});}});};AGIVertices[_0x6526('0x10')][_0x6526('0x2d')]=function(_0x4a5dae,_0x450db9){this['rpc']['getSmsAccountById'](_0x4a5dae)[_0x6526('0xd')](function(_0xb3d688){_0x450db9(null,_0xb3d688?_0xb3d688:![]);})[_0x6526('0xf')](function(_0x404023){_0x450db9(_0x404023);});};AGIVertices[_0x6526('0x10')]['createSmsMessage']=function(_0x2d0e41,_0x1476f9){this[_0x6526('0x12')]['createSmsMessage'](_0x2d0e41)[_0x6526('0xd')](function(_0x462a3f){_0x1476f9(null,_0x462a3f);})['catch'](function(_0x36857e){_0x1476f9(_0x36857e);});};AGIVertices[_0x6526('0x10')][_0x6526('0x2e')]=function(_0x1e81c8,_0x5420da,_0x19df35){this[_0x6526('0x12')][_0x6526('0x2e')]({'uniqueid':this[_0x6526('0x2f')]['uniqueid'],'node':_0x1e81c8['label'],'application':_0x1e81c8[_0x6526('0x30')],'data':_0x5420da||null,'project_name':this[_0x6526('0x2f')][_0x6526('0x31')],'callerid':this[_0x6526('0x2f')]['callerid']})[_0x6526('0xd')](function(_0x92528a){if(_0x19df35){_0x19df35(null,_0x92528a);}})[_0x6526('0xf')](function(_0x2f5ef9){if(_0x19df35){_0x19df35(_0x2f5ef9);}});};AGIVertices[_0x6526('0x10')]['createSquareRecording']=function(_0x4b3caa,_0x3b46b6,_0x1426cd,_0x4ea3c6){this['rpc'][_0x6526('0x32')]({'uniqueid':this[_0x6526('0x2f')][_0x6526('0x33')],'callerid':this['channel'][_0x6526('0x34')],'calleridname':this['channel']['calleridname'],'context':this[_0x6526('0x2f')][_0x6526('0x35')],'extension':this['channel'][_0x6526('0x36')],'priority':this[_0x6526('0x2f')][_0x6526('0x37')],'accountcode':this[_0x6526('0x2f')]['accountcode'],'dnid':this[_0x6526('0x2f')][_0x6526('0x38')],'projectName':this[_0x6526('0x2f')][_0x6526('0x31')],'saveName':_0x3b46b6,'filename':_0x4b3caa['file']||_0x3b46b6,'savePath':_0x1426cd})[_0x6526('0xd')](function(_0x3215dd){_0x4ea3c6(null,_0x3215dd);})[_0x6526('0xf')](function(_0x575353){_0x4ea3c6(_0x575353);});};AGIVertices[_0x6526('0x10')][_0x6526('0x39')]=function(_0x157264,_0x4c779a,_0x2a8912,_0x47119c,_0x2046d5){this[_0x6526('0x12')][_0x6526('0x39')]({'uniqueid':this[_0x6526('0x2f')]['uniqueid'],'body':_0x157264,'direction':_0x4c779a,'providerName':_0x2a8912,'providerResponse':_0x47119c})[_0x6526('0xd')](function(_0x251985){if(_0x2046d5){_0x2046d5(null,_0x251985);}})[_0x6526('0xf')](function(_0xb9902d){if(_0x2046d5){_0x2046d5(_0xb9902d);}});};AGIVertices[_0x6526('0x10')][_0x6526('0x3a')]=function(_0x2823ee,_0x506386){this[_0x6526('0x12')][_0x6526('0x3a')]({'firstName':_[_0x6526('0x3b')](_0x2823ee[_0x6526('0xe')])||_[_0x6526('0x3c')](_0x2823ee[_0x6526('0xe')])?'callback_'+Math[_0x6526('0x3d')]():_0x2823ee[_0x6526('0xe')],'lastName':_[_0x6526('0x3b')](_0x2823ee[_0x6526('0x3e')])||_[_0x6526('0x3c')](_0x2823ee['lastName'])?null:_0x2823ee[_0x6526('0x3e')],'phone':_0x2823ee[_0x6526('0x3f')],'ListId':_0x2823ee['list_id'],'scheduledat':_0x2823ee[_0x6526('0x40')],'callbackUniqueid':this['channel'][_0x6526('0x33')],'tags':_0x6526('0x41'),'description':'Callback\x20scheduled\x20at\x20'+_0x2823ee[_0x6526('0x40')]['toString'](),'priority':_0x2823ee[_0x6526('0x42')]})['then'](function(_0x124a6c){_0x506386(null,_0x124a6c);})[_0x6526('0xf')](function(_0x899094){_0x506386(_0x899094);});};AGIVertices[_0x6526('0x10')][_0x6526('0x43')]=function(_0x30f4f8,_0x5110ad){this['rpc'][_0x6526('0x44')](_0x30f4f8)[_0x6526('0xd')](function(_0x8a3282){_0x5110ad(null,_0x8a3282?_0x8a3282[_0x6526('0xe')]:![]);})[_0x6526('0xf')](function(_0x2ea86e){_0x5110ad(_0x2ea86e);});};AGIVertices[_0x6526('0x10')]['agentPause']=function(_0x4535d8,_0x42bf9b,_0x1b1f4d){var _0x26f7b4={'role':_0x6526('0x45')};_0x26f7b4[_0x4535d8]=this[_0x6526('0x2f')]['callerid'];this[_0x6526('0x12')]['agentPause'](_0x26f7b4,_0x42bf9b,this['channel'][_0x6526('0x33')])[_0x6526('0xd')](function(_0x3e9327){_0x1b1f4d(null,_[_0x6526('0x3c')](_0x3e9327)?![]:!![]);})['catch'](function(_0x5068ce){logger['error'](_0x5068ce);_0x1b1f4d(null,![]);});};AGIVertices[_0x6526('0x10')][_0x6526('0x46')]=function(_0x352705,_0x1bb09e){var _0x2763ff={'role':'agent'};_0x2763ff[_0x352705]=this[_0x6526('0x2f')]['callerid'];this['rpc']['agentUnpause'](_0x2763ff)[_0x6526('0xd')](function(_0x58edbb){_0x1bb09e(null,_[_0x6526('0x3c')](_0x58edbb)?![]:!![]);})[_0x6526('0xf')](function(_0x2eb652){logger[_0x6526('0x27')](_0x2eb652);_0x1bb09e(null,![]);});};AGIVertices[_0x6526('0x10')]['agentLogout']=function(_0x2ce528,_0x273183){var _0x3f99c5={'role':'agent'};_0x3f99c5[_0x2ce528]=this[_0x6526('0x2f')][_0x6526('0x34')];this[_0x6526('0x12')][_0x6526('0x47')](_0x3f99c5)['then'](function(_0x29ff44){_0x273183(null,_[_0x6526('0x3c')](_0x29ff44)?![]:!![]);})[_0x6526('0xf')](function(_0x4159b4){logger[_0x6526('0x27')](_0x4159b4);_0x273183(null,![]);});};AGIVertices[_0x6526('0x10')][_0x6526('0x48')]=function(_0x185398,_0xc3ee9a){var _0x43130a={'role':_0x6526('0x45')};_0x43130a[_0x185398]=this[_0x6526('0x2f')]['callerid'];var _0x247946=_0x185398!=_0x6526('0x49')?util[_0x6526('0x4a')](_0x6526('0x4b'),_0x6526('0x4c'),this[_0x6526('0x2f')][_0x6526('0x34')]):undefined;this[_0x6526('0x12')][_0x6526('0x48')](_0x43130a,_0x247946)[_0x6526('0xd')](function(_0x425c52){_0xc3ee9a(null,_[_0x6526('0x3c')](_0x425c52)?![]:!![]);})[_0x6526('0xf')](function(_0xc25fcb){logger['error'](_0xc25fcb);_0xc3ee9a(null,![]);});};AGIVertices['prototype'][_0x6526('0x4d')]=function(_0x311a60,_0x52bded){sh['exec'](_[_0x6526('0x4e')](_0x311a60),function(_0x8b06ba,_0x12941d){var _0x5c4621=_0x12941d[_0x6526('0x4f')](/(\r\n|\n|\r)/gm,'');_0x52bded(null,_0x5c4621);});};AGIVertices['prototype'][_0x6526('0x50')]=function(_0x285a93,_0x5de12a){scripts[_0x6526('0x50')](_0x285a93[_0x6526('0x51')],_0x285a93[_0x6526('0x52')]||_0x6526('0x53'),_0x285a93[_0x6526('0x53')],_0x285a93[_0x6526('0x54')]||'en-US',_0x285a93[_0x6526('0x55')]||_0x6526('0x56'),_0x285a93[_0x6526('0x57')]||'MP3')[_0x6526('0xd')](function(_0x39bb85){_0x5de12a(null,_0x39bb85);})['catch'](function(_0x1273be){_0x5de12a(_0x1273be);});};AGIVertices[_0x6526('0x10')]['googleTTS']=function(_0x12db13,_0x547383){scripts[_0x6526('0x58')](_0x12db13[_0x6526('0x53')],_0x12db13[_0x6526('0x59')]||'en',0x1)['then'](function(_0x4eee53){_0x547383(null,_0x4eee53);})[_0x6526('0xf')](function(_0x5ae765){_0x547383(_0x5ae765);});};AGIVertices[_0x6526('0x10')][_0x6526('0x5a')]=function(_0x2a9874,_0xd1a143){var _0x638103={'uri':_0x2a9874['url'],'method':_0x2a9874[_0x6526('0x5b')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2a9874[_0x6526('0x5c')])==='number'&&parseInt(_0x2a9874[_0x6526('0x5c')])>=0x1?parseInt(_0x2a9874[_0x6526('0x5c')])*0x3e8:0x5*0x3e8};if(_[_0x6526('0x5d')]([_0x6526('0x5e'),'PUT'],_0x638103['method'][_0x6526('0x5f')]())){try{_0x638103[_0x6526('0x60')]=_0x2a9874[_0x6526('0x9')]?JSON[_0x6526('0x61')](_0x2a9874[_0x6526('0x9')]):{};}catch(_0x35890a){logger['error'](_0x6526('0x62'),_0x35890a);}}try{_0x638103['headers']=_0x2a9874[_0x6526('0x8')]?JSON[_0x6526('0x61')](_0x2a9874[_0x6526('0x8')]):{};}catch(_0x2b4082){logger[_0x6526('0x27')](_0x6526('0x63'),_0x2b4082);}if(_0x2a9874['computedVariables']){try{var _0x578f48=require(_0x2a9874[_0x6526('0x64')])[_0x6526('0x65')](this,_0x638103);_0x638103[_0x6526('0x66')]=Mustache['render'](_0x2a9874[_0x6526('0x67')],_0x578f48,{},['$$','$$']);if(_0x638103[_0x6526('0x68')]){_0x638103['headers']=JSON[_0x6526('0x61')](Mustache[_0x6526('0x69')](JSON[_0x6526('0x6a')](_0x638103[_0x6526('0x68')]),_0x578f48,{},['$$','$$']));}if(_0x638103['body']){_0x638103[_0x6526('0x60')]=JSON['parse'](Mustache[_0x6526('0x69')](JSON['stringify'](_0x638103[_0x6526('0x60')]),_0x578f48,{},['$$','$$']));}}catch(_0x39e6fa){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x39e6fa);}}rp(_0x638103)[_0x6526('0xd')](function(_0x313f6a){var _0x2cb313={'statusCode':_0x313f6a[_0x6526('0x6b')]||0xc8,'statusMessage':_0x313f6a[_0x6526('0x6c')]||'OK','headers':_0x313f6a[_0x6526('0x68')]||{},'body':_0x313f6a[_0x6526('0x60')]||{}};_0xd1a143(null,_0x2cb313);})['catch'](function(_0x428221){var _0x4ad3af={'statusCode':_0x428221['statusCode']||0x1f4,'statusMessage':_0x428221[_0x6526('0x6d')]||_0x6526('0x6e'),'headers':_0x428221['options'][_0x6526('0x68')]||{},'body':_0x428221[_0x6526('0x6f')][_0x6526('0x60')]||{}};_0xd1a143(null,_0x4ad3af);});};AGIVertices[_0x6526('0x10')][_0x6526('0x70')]=function(_0x533c8e,_0x305eb8){scripts[_0x6526('0x70')](this[_0x6526('0x2f')][_0x6526('0x33')],_0x533c8e[_0x6526('0x71')],_0x533c8e[_0x6526('0x53')],_0x533c8e['dialogflow_language']||'en')['then'](function(_0x31bc63){_0x305eb8(null,_0x31bc63);})[_0x6526('0xf')](function(_0x59b0ab){_0x305eb8(_0x59b0ab);});};AGIVertices['prototype'][_0x6526('0x72')]=function(_0x541cd5,_0x1bf129){scripts[_0x6526('0x72')](this['channel'][_0x6526('0x33')],_0x541cd5[_0x6526('0x73')],_0x541cd5['client_email'],_0x541cd5['private_key'],_0x541cd5['text'],_0x541cd5[_0x6526('0x74')]||'en')['then'](function(_0x2ae20f){_0x1bf129(null,_0x2ae20f);})[_0x6526('0xf')](function(_0x112f1e){_0x1bf129(_0x112f1e);});};AGIVertices[_0x6526('0x10')][_0x6526('0x75')]=function(_0x4653d7,_0x291a77){scripts[_0x6526('0x75')](this['channel'],_0x4653d7)['then'](function(_0x1d8130){_0x291a77(null,_0x1d8130);})['catch'](function(_0x4f10bb){_0x291a77(_0x4f10bb);});};AGIVertices[_0x6526('0x10')][_0x6526('0x76')]=function(_0x4b22ea,_0x501f88){scripts[_0x6526('0x76')](_0x4b22ea[_0x6526('0x71')],_0x4b22ea['text'],_0x4b22ea[_0x6526('0x77')]||_0x6526('0x78'),_0x4b22ea[_0x6526('0x79')])[_0x6526('0xd')](function(_0x33bcb2){_0x501f88(null,_0x33bcb2);})[_0x6526('0xf')](function(_0x16e86e){_0x501f88(_0x16e86e);});};AGIVertices[_0x6526('0x10')][_0x6526('0x7a')]=function(_0x340da9,_0x35bb97,_0x32b2d9){scripts[_0x6526('0x7a')](_0x35bb97,_0x340da9[_0x6526('0x71')],_0x340da9[_0x6526('0x7b')]||_0x6526('0x78'),this[_0x6526('0x7c')](_0x340da9['model'])?_0x340da9[_0x6526('0x7d')]:undefined)[_0x6526('0xd')](function(_0x40bce1){_0x32b2d9(null,_0x40bce1);})[_0x6526('0xf')](function(_0x2310f1){_0x32b2d9(_0x2310f1);});};AGIVertices[_0x6526('0x10')]['awsPolly']=function(_0x50ab45,_0x563928){scripts[_0x6526('0x7e')](_0x50ab45[_0x6526('0x7f')],_0x50ab45[_0x6526('0x80')],_0x50ab45[_0x6526('0x81')],_0x50ab45[_0x6526('0x82')]||_0x6526('0x83'),_0x50ab45[_0x6526('0x53')],_0x50ab45[_0x6526('0x84')]||_0x6526('0x53'))[_0x6526('0xd')](function(_0x2aaafc){_0x563928(null,_0x2aaafc);})['catch'](function(_0x1f4615){_0x563928(_0x1f4615);});};AGIVertices['prototype'][_0x6526('0x85')]=function(_0x2d2e3a,_0x31ba0c){scripts[_0x6526('0x85')](this[_0x6526('0x2f')][_0x6526('0x33')],_0x2d2e3a[_0x6526('0x7f')],_0x2d2e3a[_0x6526('0x80')],_0x2d2e3a[_0x6526('0x86')],_0x2d2e3a['text'],_0x2d2e3a[_0x6526('0x87')])[_0x6526('0xd')](function(_0x2374b4){_0x31ba0c(null,_0x2374b4);})[_0x6526('0xf')](function(_0x424599){_0x31ba0c(_0x424599);});};AGIVertices[_0x6526('0x10')][_0x6526('0x88')]=function(_0x279bdb,_0x2d685d,_0x1ea0ae){scripts[_0x6526('0x88')](_0x2d685d,_0x279bdb[_0x6526('0x71')],_0x279bdb[_0x6526('0x89')]||_0x6526('0x78'))['then'](function(_0x332676){_0x1ea0ae(null,_0x332676);})[_0x6526('0xf')](function(_0x3105e3){_0x1ea0ae(_0x3105e3);});};AGIVertices[_0x6526('0x10')]['tildeASR']=function(_0x32346b,_0x5a60d0,_0x1dca78){scripts[_0x6526('0x8a')](_0x5a60d0,_0x32346b['appid'],_0x32346b[_0x6526('0x8b')],_0x32346b[_0x6526('0x66')])[_0x6526('0xd')](function(_0x35d7af){_0x1dca78(null,_0x35d7af);})[_0x6526('0xf')](function(_0xa2599f){_0x1dca78(_0xa2599f);});};AGIVertices['prototype'][_0x6526('0x8c')]=function(_0x4213f){var _0x1ddcf2=_[_0x6526('0x5d')](verticesWithRetry,_0x4213f[_0x6526('0x30')])?_0x4213f:_[_0x6526('0x8d')](_0x4213f);for(var _0x15b7cb in _0x1ddcf2){if(_0x1ddcf2[_0x6526('0x8e')](_0x15b7cb)){if(_0x1ddcf2[_0x15b7cb]&&_[_0x6526('0x8f')](_0x1ddcf2[_0x15b7cb])){if(_[_0x6526('0x5d')](recursiveMapAttributes,_0x15b7cb)){_0x1ddcf2[_0x15b7cb]=this[_0x6526('0x90')](_0x1ddcf2[_0x15b7cb]);}else{_0x1ddcf2[_0x15b7cb]=this[_0x6526('0x91')](_0x1ddcf2[_0x15b7cb]);}}}}return _0x1ddcf2;};AGIVertices[_0x6526('0x10')]['recursiveNodeIndex']=function(_0x1e3514){for(var _0x49e8d8 in _0x1e3514){if(_0x1e3514[_0x6526('0x8e')](_0x49e8d8)){if(_[_0x6526('0x92')](_0x1e3514[_0x49e8d8])){this[_0x6526('0x93')](_0x1e3514[_0x49e8d8]);}else if(_[_0x6526('0x94')](_0x1e3514[_0x49e8d8])){for(var _0x160f67=0x0;_0x160f67<_0x1e3514[_0x49e8d8][_0x6526('0x95')];_0x160f67++){this[_0x6526('0x93')](_0x1e3514[_0x49e8d8][_0x160f67]);}}else if(_[_0x6526('0x8f')](_0x1e3514[_0x49e8d8])){_0x1e3514[_0x49e8d8]=this[_0x6526('0x91')](_0x1e3514[_0x49e8d8]);}}}};AGIVertices[_0x6526('0x10')][_0x6526('0x96')]=function(_0x44da8e,_0x20a394){for(var _0x49c331 in _0x44da8e){if(_0x44da8e[_0x6526('0x8e')](_0x49c331)){if(_['isPlainObject'](_0x44da8e[_0x49c331])){if(!_[_0x6526('0x3b')](_0x44da8e[_0x49c331])){this[_0x6526('0x96')](_0x44da8e[_0x49c331],util[_0x6526('0x4a')](_0x6526('0x97'),_0x20a394,_0x49c331));}}else if(_[_0x6526('0x94')](_0x44da8e[_0x49c331])){for(var _0x202eb8=0x0;_0x202eb8<_0x44da8e[_0x49c331][_0x6526('0x95')];_0x202eb8++){this[_0x6526('0x96')](_0x44da8e[_0x49c331][_0x202eb8],util[_0x6526('0x4a')](_0x6526('0x97'),_0x20a394,_0x49c331+'['+_0x202eb8+']'));}}else{if(!_[_0x6526('0x3c')](_0x44da8e[_0x49c331])){this[_0x6526('0x2f')][_0x6526('0x98')](util[_0x6526('0x4a')](_0x6526('0x97'),_0x20a394,_0x49c331),_0x44da8e[_0x49c331]);}}}}};AGIVertices[_0x6526('0x10')][_0x6526('0x90')]=function(_0x2cb2d6){try{var _0x307357=JSON[_0x6526('0x61')](_0x2cb2d6);this[_0x6526('0x93')](_0x307357);return JSON['stringify'](_0x307357);}catch(_0x3364d8){return this[_0x6526('0x91')](_0x2cb2d6);}};AGIVertices[_0x6526('0x10')]['replaceAllVariables']=function(_0x4cd28a){var _0x1aeda3=_0x4cd28a['split']('{');for(var _0x5e199a=0x1;_0x5e199a<_0x1aeda3[_0x6526('0x95')];_0x5e199a+=0x1){var _0x17d922=_0x1aeda3[_0x5e199a][_0x6526('0x99')]('}');if(_0x17d922[_0x6526('0x95')]>0x1){_0x4cd28a=_0x4cd28a[_0x6526('0x9a')]('{'+_0x17d922[0x0]+'}',this[_0x6526('0x2f')][_0x6526('0x9b')](_0x17d922[0x0])[_0x6526('0x9c')]||_0x17d922[0x0]);}}if(_0x1aeda3[_0x6526('0x95')]===0x1){return _0x4cd28a[_0x6526('0x9d')]();}return this['replaceAllVariables'](_0x4cd28a);};AGIVertices[_0x6526('0x10')][_0x6526('0x9e')]=function(_0x372132,_0x5e2d7c){var _0x83abb=this[_0x6526('0x2f')][_0x6526('0x9b')](_0x372132);if(_0x83abb['result']===-0x1){return _0x83abb;}logger[_0x6526('0x2c')](util['format'](_0x6526('0x9f'),_0x5e2d7c,_0x83abb[_0x6526('0x9c')]));return this['channel']['setVariable'](_0x5e2d7c,_0x83abb['extra']);};AGIVertices[_0x6526('0x10')][_0x6526('0x7c')]=function(_0x35918c){return _0x35918c&&_0x35918c!=='0'&&_0x35918c!=='-1'&&_0x35918c!=='';};AGIVertices[_0x6526('0x10')][_0x6526('0xa0')]=function(_0x365e99){this['createSquareDetailsReport'][_0x6526('0x65')](this,_0x365e99,'-');_0x365e99[_0x6526('0xa1')]=_0x365e99['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x6526('0xa2')]=function(_0x1997a9){logger['info'](util[_0x6526('0x4a')](_0x6526('0xa3'),_0x1997a9['label']));if(!this['isConfigured'](_0x1997a9['text'])){return this[_0x6526('0x2f')]['noop'](_0x6526('0xa4'));}var _0x445026='\x22'+_0x1997a9['text']+'\x22';if(this[_0x6526('0x7c')](_0x1997a9[_0x6526('0x6f')])){_0x445026+=','+_0x1997a9[_0x6526('0x6f')];}var _0x4e435e=this[_0x6526('0x2f')][_0x6526('0xa5')](_0x6526('0xa6'),_0x445026);if(_0x4e435e[_0x6526('0xa7')]===-0x1){return _0x4e435e;}return this['channel'][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0xa9'),_0x445026));};AGIVertices[_0x6526('0x10')][_0x6526('0xaa')]=function(_0x50009e){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0xab'),_0x50009e[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x50009e[_0x6526('0xad')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xae'));}var _0x3127a9=_0x50009e[_0x6526('0xad')];if(this[_0x6526('0x7c')](_0x50009e[_0x6526('0x6f')])){_0x3127a9+=','+_0x50009e[_0x6526('0x6f')];}var _0x1af170=this[_0x6526('0x2f')]['exec'](_0x6526('0xaf'),_0x3127a9);if(_0x1af170['result']===-0x1){return _0x1af170;}var _0x5137df=this[_0x6526('0x9e')](_0x6526('0xb0'),'MRCP_RECOG_CONFIDENCE');if(_0x5137df['result']===-0x1){return _0x5137df;}var _0x3fda03=this[_0x6526('0x9e')](_0x6526('0xb1'),_0x6526('0xb2'));if(_0x3fda03[_0x6526('0xa7')]===-0x1){return _0x3fda03;}var _0x2a0c59=this[_0x6526('0x9e')](_0x6526('0xb3'),'MRCP_RECOG_INSTANCE');if(_0x2a0c59[_0x6526('0xa7')]===-0x1){return _0x2a0c59;}return this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3127a9));};AGIVertices[_0x6526('0x10')][_0x6526('0xb4')]=function(_0x294b01){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x294b01[_0x6526('0xac')]));return this[_0x6526('0x2f')][_0x6526('0xb4')]([_0x294b01['command'],_0x294b01['args']]);};AGIVertices['prototype'][_0x6526('0xb5')]=function(_0x12cb93){logger[_0x6526('0x2c')](util['format'](_0x6526('0xb6'),_0x12cb93['label']));if(this[_0x6526('0x7c')](_0x12cb93[_0x6526('0x5c')])){logger['info'](util[_0x6526('0x4a')](_0x6526('0xb7'),_0x12cb93[_0x6526('0x5c')]));var _0x419c72=this['channel'][_0x6526('0xb8')](_0x12cb93[_0x6526('0x5c')]);if(_0x419c72[_0x6526('0xa7')]===-0x1){return _0x419c72;}}return this[_0x6526('0x2f')][_0x6526('0xb5')]();};AGIVertices[_0x6526('0x10')]['callback']=function(_0x495027){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0xb9'),_0x495027[_0x6526('0xac')]));if(!this['isConfigured'](_0x495027[_0x6526('0xba')])){return this[_0x6526('0x2f')]['error'](_0x495027,'no\x20list\x20selected');}_0x495027[_0x6526('0x40')]=moment();if(this[_0x6526('0x7c')](_0x495027[_0x6526('0xbb')])){_0x495027[_0x6526('0x40')]=moment()['add'](_0x495027['delay'],_0x6526('0xbc'));}if(!this[_0x6526('0x7c')](_0x495027[_0x6526('0x42')])){_0x495027['callback_priority']=0x2;}this[_0x6526('0x3a')][_0x6526('0x65')](this,_0x495027);return this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x495027[_0x6526('0x3f')],_0x495027['list_id'],_0x495027[_0x6526('0x40')]));};AGIVertices[_0x6526('0x10')][_0x6526('0xbd')]=function(_0x3f635b){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0xbe'),_0x3f635b[_0x6526('0xac')]));var _0x4f9304=this[_0x6526('0x2f')][_0x6526('0xa5')](_0x3f635b[_0x6526('0xbf')],_0x3f635b['options']);if(_0x4f9304['result']===-0x1){return _0x4f9304;}return this['channel']['noop'](util['format'](_0x6526('0xc0'),_0x3f635b['application'],_0x3f635b[_0x6526('0x6f')]));};AGIVertices[_0x6526('0x10')]['lumenvoxtts']=function(_0x30b4af){logger[_0x6526('0x2c')](util['format'](_0x6526('0xc1'),_0x30b4af[_0x6526('0xac')]));if(!this['isConfigured'](_0x30b4af[_0x6526('0x53')])){return this[_0x6526('0x2f')]['noop'](_0x6526('0xa4'));}var _0x4a58eb='\x22'+_0x30b4af[_0x6526('0x53')]+'\x22';if(this[_0x6526('0x7c')](_0x30b4af[_0x6526('0x6f')])){_0x4a58eb+=','+_0x30b4af[_0x6526('0x6f')];}var _0x5643bf=this['channel'][_0x6526('0xa5')]('MRCPSynth',_0x4a58eb);if(_0x5643bf[_0x6526('0xa7')]===-0x1){return _0x5643bf;}return this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')](_0x6526('0xa9'),_0x4a58eb));};AGIVertices[_0x6526('0x10')][_0x6526('0xc2')]=function(_0x5431a7){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5431a7[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x5431a7['text'])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xa4'));}var _0x2e02da='\x22'+_0x5431a7[_0x6526('0x53')]+'\x22';if(this['isConfigured'](_0x5431a7[_0x6526('0x6f')])){_0x2e02da+=','+_0x5431a7[_0x6526('0x6f')];}var _0x3c3413=this['channel']['exec']('MRCPSynth',_0x2e02da);if(_0x3c3413[_0x6526('0xa7')]===-0x1){return _0x3c3413;}return this[_0x6526('0x2f')][_0x6526('0xa8')](util['format'](_0x6526('0xa9'),_0x2e02da));};AGIVertices[_0x6526('0x10')][_0x6526('0xc3')]=function(_0x2fe8fa){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2fe8fa['label']));if(!this[_0x6526('0x7c')](_0x2fe8fa[_0x6526('0xad')])){return this[_0x6526('0x2f')][_0x6526('0xa8')]('no\x20grammar\x20configured');}var _0x883d08=_0x2fe8fa['grammar'];if(this[_0x6526('0x7c')](_0x2fe8fa['options'])){_0x883d08+=','+_0x2fe8fa[_0x6526('0x6f')];}var _0x1044db=this[_0x6526('0x2f')][_0x6526('0xa5')]('MRCPRecog',_0x883d08);if(_0x1044db[_0x6526('0xa7')]===-0x1){return _0x1044db;}var _0x51355f=this[_0x6526('0x9e')](_0x6526('0xb0'),_0x6526('0xc4'));if(_0x51355f['result']===-0x1){return _0x51355f;}var _0x386a7d=this[_0x6526('0x9e')](_0x6526('0xb1'),_0x6526('0xc5'));if(_0x386a7d[_0x6526('0xa7')]===-0x1){return _0x386a7d;}var _0x14b509=this[_0x6526('0x9e')](_0x6526('0xb3'),_0x6526('0xc6'));if(_0x14b509[_0x6526('0xa7')]===-0x1){return _0x14b509;}return this[_0x6526('0x2f')]['noop'](util['format'](_0x6526('0xc7'),_0x883d08));};AGIVertices[_0x6526('0x10')][_0x6526('0xc8')]=function(_0x5f1892){logger[_0x6526('0x2c')](util['format'](_0x6526('0xc9'),_0x5f1892[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x5f1892[_0x6526('0xad')])){return this[_0x6526('0x2f')]['noop'](_0x6526('0xae'));}var _0x2e2046=_0x5f1892['grammar'];if(this[_0x6526('0x7c')](_0x5f1892[_0x6526('0x6f')])){_0x2e2046+=','+_0x5f1892[_0x6526('0x6f')];}var _0x3e3e5a=this['channel']['exec']('MRCPRecog',_0x2e2046);if(_0x3e3e5a['result']===-0x1){return _0x3e3e5a;}var _0x5a8e8c=this['getAndSetVariable'](_0x6526('0xb0'),_0x6526('0xca'));if(_0x5a8e8c[_0x6526('0xa7')]===-0x1){return _0x5a8e8c;}var _0x6ccdd4=this['getAndSetVariable'](_0x6526('0xb1'),_0x6526('0xcb'));if(_0x6ccdd4[_0x6526('0xa7')]===-0x1){return _0x6ccdd4;}var _0x144e6e=this[_0x6526('0x9e')]('RECOG_INSTANCE()',_0x6526('0xcc'));if(_0x144e6e[_0x6526('0xa7')]===-0x1){return _0x144e6e;}return this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2e2046));};AGIVertices[_0x6526('0x10')]['database']=function(_0x501b06){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0xcd'),_0x501b06['label']));if(!this['isConfigured'](_0x501b06[_0x6526('0xce')])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x501b06,_0x6526('0xcf'));}var _0x29a421=this[_0x6526('0x14')][_0x6526('0x65')](this,_0x501b06[_0x6526('0xce')]);if(!_0x29a421){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x501b06,_0x6526('0xd0'));}if(!this[_0x6526('0x7c')](_0x501b06[_0x6526('0x2a')])){return this['channel']['error'](_0x501b06,_0x6526('0xd1'));}var _0x3179d6=_0x501b06['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x6526('0x2f')][_0x6526('0xa8')](util['format'](_0x6526('0xd2'),_0x3179d6));var _0x57e380=this[_0x6526('0x25')][_0x6526('0x65')](this,_0x29a421,_0x3179d6);this[_0x6526('0x2e')][_0x6526('0x65')](this,_0x501b06,_0x3179d6);if(!this[_0x6526('0x7c')](_0x501b06['variable_id'])){return this[_0x6526('0x2f')][_0x6526('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xad18a3=this[_0x6526('0x9b')][_0x6526('0x65')](this,_0x501b06['variable_id']);if(!_0xad18a3){return this['channel'][_0x6526('0x27')](_0x501b06,_0x6526('0xd3'));}var _0x3f238f=this;_0x57e380[_0x6526('0xd4')](function(_0x38a4a2,_0x3d66c5){Object['keys'](_0x38a4a2)[_0x6526('0xd4')](function(_0x4e38b3){_0x3f238f[_0x6526('0x2f')][_0x6526('0x98')](util['format']('%s[%s][%s]',_0xad18a3,_0x3d66c5,_0x4e38b3),_0x38a4a2[_0x4e38b3]);});});this['channel'][_0x6526('0x98')](util[_0x6526('0x4a')]('%s_ROWS_COUNT',_0xad18a3),_0x57e380[_0x6526('0x95')]);return this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')]('variable\x20%s\x20set',_0xad18a3));};AGIVertices[_0x6526('0x10')]['dial']=function(_0x2a0e40){logger[_0x6526('0xd5')](util[_0x6526('0x4a')](_0x6526('0xd6'),_0x2a0e40[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x2a0e40[_0x6526('0xd7')])){return this['channel']['error'](_0x2a0e40,_0x6526('0xd8'));}var _0xa067f1=this['getUser'][_0x6526('0x65')](this,_0x2a0e40['sip_id']);if(!_0xa067f1){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x2a0e40,_0x6526('0xd9'));}var _0x27a00a=this[_0x6526('0x2f')][_0x6526('0xa5')](_0x6526('0xda'),[util[_0x6526('0x4a')]('SIP/%s',_0xa067f1),_0x2a0e40[_0x6526('0x5c')],_0x2a0e40['opts'],_0x2a0e40[_0x6526('0x67')]]);if(_0x27a00a[_0x6526('0xa7')]===-0x1){return _0x27a00a;}return this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')](_0x6526('0xdb'),'DIAL'));};AGIVertices[_0x6526('0x10')][_0x6526('0xdc')]=function(_0x54d807){logger[_0x6526('0x2c')](util['format'](_0x6526('0xdd'),_0x54d807[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x54d807[_0x6526('0x71')])){return this['channel'][_0x6526('0xa8')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x54d807[_0x6526('0x53')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xa4'));}this['channel'][_0x6526('0xde')]=!![];this[_0x6526('0x2e')](_0x54d807);this[_0x6526('0x39')](_0x54d807['text'],'in','','');this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0xdf'),_0x54d807[_0x6526('0x53')]));var _0x56e7a9=this[_0x6526('0x70')][_0x6526('0x65')](this,_0x54d807);if(_0x56e7a9){for(var _0x46c215 in _0x56e7a9){if(_0x56e7a9[_0x6526('0x8e')](_0x46c215)){this[_0x6526('0x2f')][_0x6526('0x98')](util[_0x6526('0x4a')](_0x6526('0xe0'),_0x46c215[_0x6526('0x5f')]()),_0x56e7a9[_0x46c215]);}}this[_0x6526('0x39')](_0x56e7a9[_0x6526('0xe1')],'out','dialogflow','');return this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0xe2'),_0x56e7a9['speech']));}return this['channel']['error'](_0x54d807,_0x6526('0xe3'));};AGIVertices['prototype'][_0x6526('0xe4')]=function(_0x434c62){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0xe5'),_0x434c62['label']));if(!this[_0x6526('0x7c')](_0x434c62[_0x6526('0x73')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xe6'));}if(!this[_0x6526('0x7c')](_0x434c62[_0x6526('0xe7')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xe8'));}if(!this[_0x6526('0x7c')](_0x434c62[_0x6526('0xe9')])){return this['channel'][_0x6526('0xa8')](_0x6526('0xea'));}if(!this['isConfigured'](_0x434c62['dialogflowV2_language'])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xeb'));}if(!this[_0x6526('0x7c')](_0x434c62[_0x6526('0x53')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xa4'));}this[_0x6526('0x2f')][_0x6526('0xde')]=!![];this[_0x6526('0x2e')](_0x434c62);this['createSquareMessage'](_0x434c62['text'],'in','','');this[_0x6526('0x2f')][_0x6526('0xa8')](util['format'](_0x6526('0xec'),_0x434c62[_0x6526('0x53')]));var _0x2919ff=this[_0x6526('0x72')][_0x6526('0x65')](this,_0x434c62);if(_0x2919ff){for(var _0x473ae0 in _0x2919ff){if(_0x2919ff[_0x6526('0x8e')](_0x473ae0)){if(_0x473ae0!=='providerResponse'){this[_0x6526('0x2f')]['setVariable'](util[_0x6526('0x4a')](_0x6526('0xe0'),_0x473ae0[_0x6526('0x5f')]()),_0x2919ff[_0x473ae0]);}}}this[_0x6526('0x39')](_0x2919ff[_0x6526('0xe1')],_0x6526('0xed'),_0x6526('0xe4'),_0x2919ff[_0x6526('0xee')]);return this[_0x6526('0x2f')][_0x6526('0xa8')](util['format'](_0x6526('0xef'),_0x2919ff['speech']));}return this[_0x6526('0x2f')]['error'](_0x434c62,_0x6526('0xf0'));};AGIVertices['prototype'][_0x6526('0xf1')]=function(_0x299302){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0xf2'),_0x299302['label']));if(!this['isConfigured'](_0x299302[_0x6526('0xf3')])){return this[_0x6526('0x2f')]['noop'](_0x6526('0xf4'));}if(!this[_0x6526('0x7c')](_0x299302['username'])){return this[_0x6526('0x2f')]['noop'](_0x6526('0xf5'));}if(!this[_0x6526('0x7c')](_0x299302['password'])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xf6'));}if(!this['isConfigured'](_0x299302[_0x6526('0xf7')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xa4'));}this[_0x6526('0x2f')]['bot']=!![];this['createSquareDetailsReport'](_0x299302);this['createSquareMessage'](_0x299302[_0x6526('0x53')],'in','','');this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0xf8'),_0x299302['text']));var _0x29ed6a=this['sestekNDA'][_0x6526('0x65')](this,_0x299302);if(_0x29ed6a){for(var _0x29ffac in _0x29ed6a){if(_0x29ed6a[_0x6526('0x8e')](_0x29ffac)){this[_0x6526('0x2f')]['setVariable'](util[_0x6526('0x4a')]('SESTEK_NDA_%s',_0x29ffac['toUpperCase']()),_0x29ed6a[_0x29ffac]);}}this[_0x6526('0x39')](_0x29ed6a[_0x6526('0xe1')],_0x6526('0xed'),_0x6526('0xf1'),'');if(_0x29ed6a[_0x6526('0xf9')]){this[_0x6526('0x2f')][_0x6526('0xa8')](util['format'](_0x6526('0xfa'),_0x29ed6a['audiofile']));var _0x182088=this[_0x6526('0x2f')]['streamFile'](_0x29ed6a['audiofile']);try{fs['unlink'](_0x29ed6a[_0x6526('0xf9')]+_0x6526('0xfb'));}catch(_0x5d3748){logger['error'](_0x5d3748);}return _0x182088;}else{return this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0xfc'),_0x29ed6a[_0x6526('0xe1')]));}}return this[_0x6526('0x2f')][_0x6526('0x27')](_0x299302,_0x6526('0xfd'));};AGIVertices[_0x6526('0x10')][_0x6526('0xfe')]=function(_0x4775d1){logger['info'](util['format'](_0x6526('0xff'),_0x4775d1[_0x6526('0xac')]));return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xfe'));};AGIVertices[_0x6526('0x10')][_0x6526('0x100')]=function(_0xb8b2a2){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xb8b2a2[_0x6526('0xac')]));var _0x5766dc='';if(_0xb8b2a2[_0x6526('0x101')]){if(!this[_0x6526('0x7c')](_0xb8b2a2[_0x6526('0x101')])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0xb8b2a2,_0x6526('0x102'));}else{var _0x155639=parseInt(_0xb8b2a2[_0x6526('0x101')],0xa);if(isNaN(_0x155639)){_0x5766dc=_0xb8b2a2[_0x6526('0x101')];}else{_0x5766dc=this[_0x6526('0x19')][_0x6526('0x65')](this,_0xb8b2a2[_0x6526('0x101')]);if(!_0x5766dc){return this[_0x6526('0x2f')][_0x6526('0x27')](_0xb8b2a2,_0x6526('0x103'));}}}}else if(_0xb8b2a2[_0x6526('0x104')]){_0x5766dc=_0xb8b2a2['trunk_name'];}else{return this['channel'][_0x6526('0x27')](_0xb8b2a2,_0x6526('0x102'));}var _0x21f88a=this[_0x6526('0x2f')][_0x6526('0xa5')](_0x6526('0xda'),[util[_0x6526('0x4a')](_0x6526('0x105'),_0x5766dc,_0xb8b2a2[_0x6526('0x3f')]),_0xb8b2a2[_0x6526('0x5c')],_0xb8b2a2[_0x6526('0x106')],_0xb8b2a2['url']]);if(_0x21f88a[_0x6526('0xa7')]===-0x1){return _0x21f88a;}return this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')]('Executed\x20command\x20%s',_0x6526('0xda')));};AGIVertices[_0x6526('0x10')][_0x6526('0x107')]=function(_0x24fbad){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x24fbad[_0x6526('0xac')]));return this[_0x6526('0x2f')]['noop']('finally');};AGIVertices[_0x6526('0x10')][_0x6526('0xa')]=function(_0x5e9800){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x108'),_0x5e9800['label']));if(_0x5e9800['retry']===0x0){return this[_0x6526('0xa0')](_0x5e9800);}_0x5e9800[_0x6526('0xa1')]-=0x1;if(!this['isConfigured'](_0x5e9800[_0x6526('0x109')])){return this['channel'][_0x6526('0x27')](_0x5e9800,_0x6526('0x10a'));}var _0x212a75=this[_0x6526('0x1b')][_0x6526('0x65')](this,_0x5e9800[_0x6526('0x109')]);if(!_0x212a75){return this[_0x6526('0x2f')]['error'](_0x5e9800,_0x6526('0x10b'));}if(!this[_0x6526('0x7c')](_0x5e9800['variable_id'])){return this['channel'][_0x6526('0x27')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4f13ad=this[_0x6526('0x2f')][_0x6526('0x10c')](_0x212a75,_0x5e9800['response'],_0x5e9800[_0x6526('0x10d')]);var _0x302726=_0x4f13ad[_0x6526('0xa7')]?_0x4f13ad[_0x6526('0xa7')][_0x6526('0x9d')]():'';logger['info'](_0x6526('0x10e'),JSON[_0x6526('0x6a')](_0x4f13ad));if(_0x4f13ad[_0x6526('0xa7')]===-0x1){this[_0x6526('0x2e')][_0x6526('0x65')](this,_0x5e9800,_0x302726);return _0x4f13ad;}else if(_0x4f13ad[_0x6526('0x9c')]===_0x6526('0x5c')){_0x4f13ad[_0x6526('0xa7')]=_0x302726[_0x6526('0x95')]>=parseInt(_0x5e9800[_0x6526('0x10f')])?'x':'i';}else{_0x4f13ad[_0x6526('0xa7')]=_0x302726['length']>=parseInt(_0x5e9800[_0x6526('0x10f')])&&_0x302726[_0x6526('0x95')]<=parseInt(_0x5e9800[_0x6526('0x10d')])?'x':'i';}var _0xea88a9=this[_0x6526('0x9b')][_0x6526('0x65')](this,_0x5e9800['variable_id']);if(!_0xea88a9){return this[_0x6526('0x2f')]['error'](_0x5e9800,_0x6526('0xd3'));}this['channel']['setVariable'](_0xea88a9,_0x302726);if(this[_0x6526('0x7c')](_0x5e9800['hiddendigitsnum'])){var _0x31ce47=parseInt(_0x5e9800[_0x6526('0x110')],0xa);var _0x17c35a=rs[_0x6526('0x111')]({'charset':'*','length':_0x31ce47});var _0x52d2b5=_0x302726['length'];if(_0x52d2b5>0x0){if(_0x52d2b5>_0x31ce47){this[_0x6526('0x2e')][_0x6526('0x65')](this,_0x5e9800,_0x5e9800[_0x6526('0x112')]===_0x6526('0x113')?_0x17c35a+_0x302726[_0x6526('0x114')](_0x31ce47):_0x302726[_0x6526('0x114')](0x0,_0x52d2b5-_0x31ce47)+_0x17c35a);}else{this[_0x6526('0x2e')][_0x6526('0x65')](this,_0x5e9800,rs[_0x6526('0x111')]({'charset':'*','length':_0x52d2b5}));}}else{this[_0x6526('0x2e')][_0x6526('0x65')](this,_0x5e9800,'');}}else{this[_0x6526('0x2e')][_0x6526('0x65')](this,_0x5e9800,_0x302726);}return _0x4f13ad;};AGIVertices[_0x6526('0x10')][_0x6526('0xb')]=function(_0x2f470d){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x115'),_0x2f470d[_0x6526('0xac')]));return this['getdigits'](_0x2f470d);};AGIVertices[_0x6526('0x10')][_0x6526('0x116')]=function(_0x158592){logger[_0x6526('0x2c')](util['format'](_0x6526('0x117'),_0x158592[_0x6526('0xac')]));this[_0x6526('0x2e')][_0x6526('0x65')](this,_0x158592,_0x158592[_0x6526('0x118')]);return this['channel'][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x119'),_0x158592[_0x6526('0x118')]));};AGIVertices[_0x6526('0x10')]['awspolly']=function(_0x56a647){logger[_0x6526('0x2c')](util['format'](_0x6526('0x11a'),_0x56a647[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x56a647[_0x6526('0x7f')])||!this[_0x6526('0x7c')](_0x56a647[_0x6526('0x80')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x11b'));}if(!this['isConfigured'](_0x56a647[_0x6526('0x53')])){return this['channel'][_0x6526('0xa8')](_0x6526('0xa4'));}this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x11c'),_0x56a647[_0x6526('0x53')]));var _0x3c044d=this[_0x6526('0x7e')]['sync'](this,_0x56a647);if(_0x3c044d){this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x11d'),_0x3c044d));var _0x12edff=this[_0x6526('0x2f')]['streamFile'](_0x3c044d);try{fs['unlink'](_0x3c044d+_0x6526('0xfb'));}catch(_0x5c91b8){logger[_0x6526('0x27')](_0x5c91b8);}return _0x12edff;}return this[_0x6526('0x2f')][_0x6526('0x27')](_0x56a647,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x6526('0x11e')]=function(_0x52eb4a){logger['info'](util['format'](_0x6526('0x11f'),_0x52eb4a[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x52eb4a[_0x6526('0x7f')])||!this[_0x6526('0x7c')](_0x52eb4a[_0x6526('0x80')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x11b'));}if(!this[_0x6526('0x7c')](_0x52eb4a['aws_bot_name'])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x120'));}if(!this['isConfigured'](_0x52eb4a[_0x6526('0x53')])){return this[_0x6526('0x2f')][_0x6526('0xa8')]('no\x20text\x20configured');}this['channel'][_0x6526('0xde')]=!![];this[_0x6526('0x2e')](_0x52eb4a);this[_0x6526('0x39')](_0x52eb4a[_0x6526('0x53')],'in','','');this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x121'),_0x52eb4a[_0x6526('0x53')]));var _0x4925bf=this[_0x6526('0x85')][_0x6526('0x65')](this,_0x52eb4a);if(_0x4925bf){for(var _0x10e5d5 in _0x4925bf){if(_0x4925bf[_0x6526('0x8e')](_0x10e5d5)&&_['isString'](_0x4925bf[_0x10e5d5])){this[_0x6526('0x2f')]['setVariable'](util[_0x6526('0x4a')](_0x6526('0x122'),_0x10e5d5[_0x6526('0x5f')]()),_0x4925bf[_0x10e5d5]);}}if(_['isNil'](_0x4925bf[_0x6526('0x6d')])){return this['channel'][_0x6526('0xa8')](_0x6526('0x123'));}else{this['createSquareMessage'](_0x4925bf['message'],_0x6526('0xed'),_0x6526('0x124'),'');return this['channel'][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x125'),_0x4925bf[_0x6526('0x6d')]));}}return this[_0x6526('0x2f')][_0x6526('0x27')](_0x52eb4a,_0x6526('0x126'));};AGIVertices[_0x6526('0x10')][_0x6526('0x127')]=function(_0x249de6){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x249de6[_0x6526('0xac')],_0x249de6['timeout']));if(!this['isConfigured'](_0x249de6[_0x6526('0x71')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x128'));}var _0x23b53f=_0x6526('0x129');var _0x18e931=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2a5394=util[_0x6526('0x4a')](_0x6526('0x97'),_0x18e931,_0x23b53f);var _0x34f29f=!![];if(_0x249de6[_0x6526('0x12a')]==='NOBEEP'){_0x34f29f=![];}var _0x15459c=this['channel'][_0x6526('0x12b')](_0x18e931,_0x23b53f,_0x249de6[_0x6526('0x12c')],_0x249de6[_0x6526('0x5c')],undefined,_0x34f29f);if(_0x15459c[_0x6526('0xa7')]!==-0x1){this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x12d'),_0x2a5394));var _0x2dd3e4=this[_0x6526('0x88')]['sync'](this,_0x249de6,_0x2a5394);if(_0x2dd3e4){for(var _0x289b32 in _0x2dd3e4){if(_0x2dd3e4[_0x6526('0x8e')](_0x289b32)){this[_0x6526('0x2f')][_0x6526('0x98')](util[_0x6526('0x4a')](_0x6526('0x12e'),_0x289b32['toUpperCase']()),_0x2dd3e4[_0x289b32]);}}return this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')](_0x6526('0x12f'),JSON['stringify'](_0x2dd3e4)));}}return _0x15459c;};AGIVertices[_0x6526('0x10')][_0x6526('0x130')]=function(_0x5269ca){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x131'),_0x5269ca[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x5269ca[_0x6526('0x132')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x133'));}if(!this['isConfigured'](_0x5269ca[_0x6526('0x8b')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x134'));}var _0x237afe='wav';var _0x149ffc=util[_0x6526('0x4a')](_0x6526('0x135'),FILES_PATH,rs['generate'](0x4));var _0x26fced=util[_0x6526('0x4a')](_0x6526('0x97'),_0x149ffc,_0x237afe);var _0x1eebd1=!![];if(_0x5269ca[_0x6526('0x12a')]===_0x6526('0x136')){_0x1eebd1=![];}var _0x1ad22b=this[_0x6526('0x2f')][_0x6526('0x12b')](_0x149ffc,_0x237afe,_0x5269ca[_0x6526('0x12c')],_0x5269ca[_0x6526('0x5c')],undefined,_0x1eebd1);if(_0x1ad22b[_0x6526('0xa7')]!==-0x1){this['channel']['noop'](util[_0x6526('0x4a')](_0x6526('0x137'),_0x26fced));var _0x5326e4=this['tildeASR'][_0x6526('0x65')](this,_0x5269ca,_0x26fced);if(_0x5326e4){for(var _0x149c8d in _0x5326e4){if(_0x5326e4['hasOwnProperty'](_0x149c8d)){this['channel'][_0x6526('0x98')](util['format'](_0x6526('0x138'),_0x149c8d[_0x6526('0x5f')]()),_0x5326e4[_0x149c8d]);}}return this[_0x6526('0x2f')][_0x6526('0xa8')](util['format'](_0x6526('0x139'),JSON[_0x6526('0x6a')](_0x5326e4)));}}return _0x1ad22b;};AGIVertices[_0x6526('0x10')][_0x6526('0x13a')]=function(_0x32c12c){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x13b'),_0x32c12c[_0x6526('0xac')]));return this[_0x6526('0x2f')]['continueAt'](_0x32c12c[_0x6526('0x35')],_0x32c12c[_0x6526('0x36')],_0x32c12c[_0x6526('0x37')]);};AGIVertices[_0x6526('0x10')][_0x6526('0x13c')]=function(_0x523382){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x523382[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x523382[_0x6526('0x13d')])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x523382,_0x6526('0x13e'));}try{var _0xa1c650=eval(_0x523382[_0x6526('0x13d')])?_0x6526('0x13f'):_0x6526('0x140');this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x523382[_0x6526('0x13d')],_0xa1c650));return{'code':0xc8,'result':_0xa1c650};}catch(_0xf5836a){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x6526('0x10')][_0x6526('0x141')]=function(_0x23c07){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x23c07[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x23c07[_0x6526('0x142')])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x23c07,_0x6526('0x143'));}var _0x4fb24d=this['getIntervals'][_0x6526('0x65')](this,_0x23c07[_0x6526('0x142')]);if(!_0x4fb24d){return this['channel'][_0x6526('0x27')](_0x23c07,_0x6526('0x144'));}for(var _0x3035c0=0x0;_0x3035c0<_0x4fb24d[_0x6526('0x95')];_0x3035c0+=0x1){var _0x22612e=this['channel'][_0x6526('0x9b')](util[_0x6526('0x4a')]('IFTIME(%s?true:false)',_0x4fb24d[_0x3035c0]));if(_0x22612e[_0x6526('0xa7')]===-0x1){return _0x22612e;}logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x145'),_0x4fb24d[_0x3035c0],_0x22612e['extra']));if(_0x22612e[_0x6526('0x9c')]===_0x6526('0x13f')){logger['info'](util[_0x6526('0x4a')](_0x6526('0x145'),_0x4fb24d[_0x3035c0],'true'));this['channel']['noop'](util['format'](_0x6526('0x145'),_0x4fb24d[_0x3035c0],_0x6526('0x13f')));return{'code':0xc8,'result':_0x6526('0x13f')};}else{logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('IFTIME\x20%s\x20%s',_0x4fb24d[_0x3035c0],_0x6526('0x140')));this['channel'][_0x6526('0xa8')](util['format'](_0x6526('0x145'),_0x4fb24d[_0x3035c0],'false'));}}return{'code':0xc8,'result':_0x6526('0x140')};};AGIVertices['prototype']['hangup']=function(_0x9cebb6){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x146'),_0x9cebb6[_0x6526('0xac')]));return this[_0x6526('0x2f')][_0x6526('0x147')]();};AGIVertices[_0x6526('0x10')][_0x6526('0x148')]=function(_0x10ccf6){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x149'),_0x10ccf6[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x10ccf6[_0x6526('0x71')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x128'));}var _0x349780=_0x6526('0x129');var _0x303b27=util[_0x6526('0x4a')](_0x6526('0x135'),FILES_PATH,rs[_0x6526('0x111')](0x4));var _0x4521b1=util[_0x6526('0x4a')](_0x6526('0x97'),_0x303b27,_0x349780);var _0x2471a8=!![];if(_0x10ccf6[_0x6526('0x12a')]===_0x6526('0x136')){_0x2471a8=![];}var _0x1b2440=this['channel'][_0x6526('0x12b')](_0x303b27,_0x349780,_0x10ccf6[_0x6526('0x12c')],_0x10ccf6[_0x6526('0x5c')],undefined,_0x2471a8);if(_0x1b2440[_0x6526('0xa7')]!==-0x1){this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')](_0x6526('0x14a'),_0x4521b1));var _0x6a4e76=this['ispeechASR']['sync'](this,_0x10ccf6,_0x4521b1);if(_0x6a4e76){for(var _0x1ce965 in _0x6a4e76){if(_0x6a4e76[_0x6526('0x8e')](_0x1ce965)){this[_0x6526('0x2f')][_0x6526('0x98')](util[_0x6526('0x4a')](_0x6526('0x14b'),_0x1ce965[_0x6526('0x5f')]()),_0x6a4e76[_0x1ce965]);}}return this['channel']['noop'](util['format'](_0x6526('0x14c'),JSON[_0x6526('0x6a')](_0x6a4e76)));}}return _0x1b2440;};AGIVertices[_0x6526('0x10')]['ispeechtts']=function(_0x47250d){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x14d'),_0x47250d[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x47250d['key'])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x128'));}if(!this[_0x6526('0x7c')](_0x47250d[_0x6526('0x53')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xa4'));}this[_0x6526('0x2f')][_0x6526('0xa8')](util['format'](_0x6526('0x14e'),_0x47250d['text']));var _0xce5d9c=this['ispeechTTS'][_0x6526('0x65')](this,_0x47250d);if(_0xce5d9c){this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x14a'),_0xce5d9c));var _0x5e57fb=this[_0x6526('0x2f')][_0x6526('0x14f')](_0xce5d9c,_0x47250d[_0x6526('0x12c')]);try{fs['unlink'](_0xce5d9c+_0x6526('0xfb'));}catch(_0x224724){logger['error'](_0x224724);}return _0x5e57fb;}return this[_0x6526('0x2f')][_0x6526('0x27')](_0x47250d,_0x6526('0x150'));};AGIVertices[_0x6526('0x10')][_0x6526('0x151')]=function(_0x3e89fb){logger['info'](util[_0x6526('0x4a')](_0x6526('0x152'),_0x3e89fb['label']));if(!this['isConfigured'](_0x3e89fb['findBy'])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x3e89fb,_0x6526('0x153'));}logger['info'](util[_0x6526('0x4a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6526('0x2f')][_0x6526('0x34')],_0x3e89fb['findBy']));var _0x5641db=this[_0x6526('0x48')]['sync'](this,_0x3e89fb[_0x6526('0x154')]);if(_0x5641db){logger['info'](util[_0x6526('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6526('0x2f')][_0x6526('0x34')],_0x3e89fb[_0x6526('0x154')]));this[_0x6526('0x2f')][_0x6526('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x6526('0x2f')][_0x6526('0x34')],_0x3e89fb[_0x6526('0x154')]));return{'code':0xc8,'result':_0x6526('0x155')};}else{logger[_0x6526('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6526('0x2f')][_0x6526('0x34')],_0x3e89fb[_0x6526('0x154')]));this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x156'),this[_0x6526('0x2f')][_0x6526('0x34')],_0x3e89fb[_0x6526('0x154')]));return{'code':0xc8,'result':_0x6526('0x157')};}};AGIVertices['prototype'][_0x6526('0x158')]=function(_0x66fa5c){logger['info'](util['format'](_0x6526('0x159'),_0x66fa5c['label']));if(!this[_0x6526('0x7c')](_0x66fa5c['findBy'])){return this[_0x6526('0x2f')]['error'](_0x66fa5c,_0x6526('0x153'));}logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6526('0x2f')][_0x6526('0x34')],_0x66fa5c[_0x6526('0x154')]));var _0x9de4c9=this['agentLogout'][_0x6526('0x65')](this,_0x66fa5c[_0x6526('0x154')]);if(_0x9de4c9){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x15a'),this[_0x6526('0x2f')][_0x6526('0x34')],_0x66fa5c[_0x6526('0x154')]));this['channel'][_0x6526('0xa8')](util['format'](_0x6526('0x15a'),this['channel'][_0x6526('0x34')],_0x66fa5c[_0x6526('0x154')]));return{'code':0xc8,'result':_0x6526('0x155')};}else{logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x156'),this[_0x6526('0x2f')][_0x6526('0x34')],_0x66fa5c[_0x6526('0x154')]));this[_0x6526('0x2f')]['noop'](util['format'](_0x6526('0x156'),this[_0x6526('0x2f')][_0x6526('0x34')],_0x66fa5c[_0x6526('0x154')]));return{'code':0xc8,'result':_0x6526('0x157')};}};AGIVertices[_0x6526('0x10')][_0x6526('0x15b')]=function(_0x382572){logger[_0x6526('0x2c')](util['format'](_0x6526('0x15c'),_0x382572[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x382572[_0x6526('0x15d')])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x382572,_0x6526('0x15e'));}this['channel'][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x15f'),_0x382572[_0x6526('0x15d')]));var _0x19a3e5=eval(_0x382572[_0x6526('0x15d')]);if(!this[_0x6526('0x7c')](_0x382572[_0x6526('0x160')])){return this[_0x6526('0x2f')]['noop'](_0x6526('0x161'));}var _0x494216=this[_0x6526('0x9b')]['sync'](this,_0x382572[_0x6526('0x160')]);if(!_0x494216){return this['channel'][_0x6526('0x27')](_0x382572,_0x6526('0xd3'));}if(_['isArray'](_0x19a3e5)){var _0x190777=this;_0x19a3e5[_0x6526('0xd4')](function(_0x24f0b7,_0xdc95cf){_0x190777[_0x6526('0x2f')]['setVariable'](util[_0x6526('0x4a')]('%s[%s]',_0x494216,_0xdc95cf),_0x24f0b7);});return this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x162'),_0x494216));}else{return this[_0x6526('0x2f')][_0x6526('0x98')](_0x494216,_0x19a3e5);}};AGIVertices[_0x6526('0x10')][_0x6526('0x163')]=function(_0x4a7ac6){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4a7ac6[_0x6526('0xac')]));if(_0x4a7ac6[_0x6526('0xa1')]===0x0){return this[_0x6526('0xa0')](_0x4a7ac6);}_0x4a7ac6[_0x6526('0xa1')]-=0x1;if(!this['isConfigured'](_0x4a7ac6[_0x6526('0x109')])){return this['channel']['error'](_0x4a7ac6,_0x6526('0x10a'));}var _0x3f8ca6=this[_0x6526('0x1b')][_0x6526('0x65')](this,_0x4a7ac6[_0x6526('0x109')]);if(!_0x3f8ca6){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x4a7ac6,_0x6526('0x10b'));}var _0x23b4ec=this[_0x6526('0x2f')][_0x6526('0x10c')](_0x3f8ca6,_0x4a7ac6['response'],_0x4a7ac6[_0x6526('0x164')]);var _0xb7968e=_0x23b4ec[_0x6526('0xa7')];if(_0x23b4ec[_0x6526('0xa7')]===-0x1){this['createSquareDetailsReport'][_0x6526('0x65')](this,_0x4a7ac6,'-1');return _0x23b4ec;}else if(_0x23b4ec[_0x6526('0x9c')]===_0x6526('0x5c')){_0x23b4ec['result']=_0x23b4ec['result'][_0x6526('0x95')]>0x0?_0x23b4ec['result']:'t';}else if(_[_0x6526('0x3b')](_0x23b4ec[_0x6526('0xa7')])){_0x23b4ec[_0x6526('0xa7')]='#';_0xb7968e='#';}if(!this[_0x6526('0x7c')](_0x4a7ac6[_0x6526('0x160')])){this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x161'));}else{var _0x34fb18=this['getVariable'][_0x6526('0x65')](this,_0x4a7ac6[_0x6526('0x160')]);if(!_0x34fb18){return this['channel'][_0x6526('0x27')](_0x4a7ac6,'no\x20variable\x20found');}this[_0x6526('0x2f')]['setVariable'](_0x34fb18,_0xb7968e);}this[_0x6526('0x2e')]['sync'](this,_0x4a7ac6,_0xb7968e);return _0x23b4ec;};AGIVertices[_0x6526('0x10')]['noop']=function(_0x4455c6){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4455c6['label']));return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x4455c6['output']||_0x4455c6[_0x6526('0xac')]);};AGIVertices['prototype'][_0x6526('0x165')]=function(_0x2cebe3){logger['info'](util[_0x6526('0x4a')](_0x6526('0x166'),_0x2cebe3[_0x6526('0xac')]));if(!this['isConfigured'](_0x2cebe3['findBy'])){return this[_0x6526('0x2f')]['error'](_0x2cebe3,'no\x20find\x20by\x20configured');}logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x167'),this[_0x6526('0x2f')][_0x6526('0x34')],_0x2cebe3[_0x6526('0x154')]));var _0x1fe6f2=this[_0x6526('0x43')][_0x6526('0x65')](this,_0x2cebe3[_0x6526('0x168')]);var _0x292a30=this['agentPause'][_0x6526('0x65')](this,_0x2cebe3[_0x6526('0x154')],_0x1fe6f2);if(_0x292a30){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6526('0x2f')][_0x6526('0x34')],_0x2cebe3[_0x6526('0x154')]));this['channel'][_0x6526('0xa8')](util[_0x6526('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6526('0x2f')][_0x6526('0x34')],_0x2cebe3[_0x6526('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x156'),this[_0x6526('0x2f')][_0x6526('0x34')],_0x2cebe3[_0x6526('0x154')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x6526('0x2f')][_0x6526('0x34')],_0x2cebe3[_0x6526('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6526('0x10')][_0x6526('0x169')]=function(_0x19f717){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x16a'),_0x19f717[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x19f717[_0x6526('0x109')])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x19f717,_0x6526('0x10a'));}var _0x6c7ad8=this[_0x6526('0x1b')]['sync'](this,_0x19f717[_0x6526('0x109')]);if(!_0x6c7ad8){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x19f717,_0x6526('0x10b'));}var _0x2629b8=this['channel']['exec'](_0x6526('0x16b'),[_0x6c7ad8,_0x19f717['opts']]);if(_0x2629b8[_0x6526('0xa7')]===-0x1){return _0x2629b8;}return this['channel'][_0x6526('0xa8')](util[_0x6526('0x4a')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x6c7ad8));};AGIVertices[_0x6526('0x10')][_0x6526('0x16c')]=function(_0x48a21c){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x48a21c[_0x6526('0xac')]));if(!this['isConfigured'](_0x48a21c['queue_id'])){return this['channel']['error'](_0x48a21c,_0x6526('0x16d'));}var _0x4e077c='';var _0x2a3bb4=parseInt(_0x48a21c[_0x6526('0x16e')],0xa);if(isNaN(_0x2a3bb4)){_0x4e077c=_0x48a21c['queue_id'];}else{_0x4e077c=this[_0x6526('0x11')][_0x6526('0x65')](this,_0x48a21c[_0x6526('0x16e')]);if(!_0x4e077c){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x48a21c,_0x6526('0x16f'));}}var _0x13b87c='';if(this['isConfigured'](_0x48a21c[_0x6526('0x109')])){var _0x214f00=this[_0x6526('0x1b')]['sync'](this,_0x48a21c[_0x6526('0x109')]);if(_0x214f00){_0x13b87c=_0x214f00;}}this['createSquareDetailsReport'][_0x6526('0x65')](this,_0x48a21c,_0x4e077c);if(_0x48a21c['opts']['indexOf']('x')<0x0){_0x48a21c['opts']+='x';}if(_0x48a21c[_0x6526('0x106')][_0x6526('0x170')]('X')<0x0){_0x48a21c[_0x6526('0x106')]+='X';}this[_0x6526('0x2f')][_0x6526('0x98')](_0x6526('0x171'),_0x4e077c?_0x4e077c['toLowerCase']():'');var _0x3913e0=this['channel'][_0x6526('0xa5')]('QUEUE',[_0x4e077c,_0x48a21c['opts'],_0x48a21c[_0x6526('0x67')],_0x13b87c,_0x48a21c[_0x6526('0x5c')],_0x48a21c[_0x6526('0xb4')],_0x48a21c[_0x6526('0x172')],_0x48a21c[_0x6526('0x173')],'',_0x48a21c[_0x6526('0x174')]]);if(_0x3913e0['result']===-0x1){return _0x3913e0;}return this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0xc0'),_0x6526('0x175'),_0x4e077c));};AGIVertices[_0x6526('0x10')][_0x6526('0x176')]=function(_0x3d4ea8){logger[_0x6526('0x2c')](util['format'](_0x6526('0x177'),_0x3d4ea8[_0x6526('0xac')]));var _0x24b843=_0x3d4ea8[_0x6526('0x178')]||_0x6526('0x129');var _0x1ac650=util['format'](_0x6526('0x179'),this['channel'][_0x6526('0x33')],rs[_0x6526('0x111')](0x5));var _0x4725b2=util[_0x6526('0x4a')]('%s/recordings/%s.%s',FILES_PATH,_0x1ac650,_0x24b843);var _0x287fde=util['format'](_0x6526('0x135'),FILES_PATH,_0x1ac650);this['createSquareRecording'][_0x6526('0x65')](this,_0x3d4ea8,_0x1ac650,_0x4725b2);this[_0x6526('0x2f')][_0x6526('0x98')](_0x6526('0x17a'),_0x1ac650);logger[_0x6526('0x2c')](_0x6526('0x17b'),_0x287fde,_0x24b843,_0x3d4ea8[_0x6526('0x17c')],_0x3d4ea8['timeout']);return this[_0x6526('0x2f')]['recordFile'](_0x287fde,_0x24b843,_0x3d4ea8['escape_digits'],_0x3d4ea8[_0x6526('0x5c')],undefined,!![]);};AGIVertices[_0x6526('0x10')][_0x6526('0x17d')]=function(_0x364399){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x364399[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x364399[_0x6526('0x67')])){return this[_0x6526('0x2f')]['noop']('no\x20url\x20configured');}var _0x550a25=this[_0x6526('0x5a')][_0x6526('0x65')](this,_0x364399);logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x17e'),util[_0x6526('0x17f')](_0x550a25,{'showHidden':![],'depth':null})));if(!this[_0x6526('0x7c')](_0x364399[_0x6526('0x160')])){return this['channel'][_0x6526('0xa8')](_0x6526('0x180'));}var _0xa8044b=this[_0x6526('0x9b')][_0x6526('0x65')](this,_0x364399['variable_id']);if(!_0xa8044b){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x364399,'no\x20variable\x20found');}this[_0x6526('0x2f')][_0x6526('0x98')](util[_0x6526('0x4a')]('%s_STATUS_CODE',_0xa8044b),_0x550a25[_0x6526('0x6b')]?_0x550a25[_0x6526('0x6b')]:'200');this['channel'][_0x6526('0x98')](util['format'](_0x6526('0x181'),_0xa8044b),_0x550a25[_0x6526('0x6c')]?_0x550a25[_0x6526('0x6c')]:'OK');if(_0x550a25['body']){try{this[_0x6526('0x96')](_0x550a25['body'],_0xa8044b);}catch(_0x1312c9){logger[_0x6526('0x27')](util[_0x6526('0x4a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xa8044b));}}return this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')](_0x6526('0x182'),_0xa8044b));};AGIVertices[_0x6526('0x10')][_0x6526('0x183')]=function(_0x1199e1){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x184'),_0x1199e1[_0x6526('0xac')]));return this[_0x6526('0x2f')]['sayDigits'](_0x1199e1[_0x6526('0x185')][_0x6526('0x4f')](/\s+/g,''),_0x1199e1[_0x6526('0x17c')]);};AGIVertices[_0x6526('0x10')][_0x6526('0x186')]=function(_0x3c496a){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x187'),_0x3c496a[_0x6526('0xac')]));return this['channel'][_0x6526('0x188')](_0x3c496a[_0x6526('0x189')][_0x6526('0x4f')](/\s+/g,''),_0x3c496a[_0x6526('0x17c')]);};AGIVertices[_0x6526('0x10')][_0x6526('0x18a')]=function(_0x3973b6){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x3973b6['label']));return this[_0x6526('0x2f')][_0x6526('0x18b')](_0x3973b6['text'],_0x3973b6[_0x6526('0x17c')]);};AGIVertices[_0x6526('0x10')][_0x6526('0x18c')]=function(_0x47cdfd){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x18d'),_0x47cdfd['label']));if(!this[_0x6526('0x7c')](_0x47cdfd[_0x6526('0x18e')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x18f'));}var _0x1a8189=this[_0x6526('0x1f')][_0x6526('0x65')](this,_0x47cdfd[_0x6526('0x18e')]);if(!_0x1a8189||!_0x1a8189[_0x6526('0x190')]){return this['channel'][_0x6526('0x27')](_0x47cdfd,'no\x20mail\x20account\x20found');}var _0x43d926={'from':util[_0x6526('0x4a')](_0x6526('0x191'),_0x1a8189[_0x6526('0xe')],_0x1a8189[_0x6526('0x192')]||_0x1a8189['Smtp'][_0x6526('0x193')]),'to':_0x47cdfd['to']||'','cc':_0x47cdfd['cc']||'','bcc':_0x47cdfd[_0x6526('0x194')]||'','subject':_0x47cdfd[_0x6526('0x195')],'html':_0x47cdfd[_0x6526('0x53')],'text':_0x47cdfd['text']};var _0x4f8e03={'tls':{'rejectUnauthorized':![]}};if(_0x1a8189[_0x6526('0x190')][_0x6526('0x196')]){_0x4f8e03[_0x6526('0x196')]=_0x1a8189[_0x6526('0x190')][_0x6526('0x196')];}else{_0x4f8e03[_0x6526('0x197')]=_0x1a8189['Smtp'][_0x6526('0x197')];_0x4f8e03[_0x6526('0x198')]=_0x1a8189[_0x6526('0x190')][_0x6526('0x198')];_0x4f8e03[_0x6526('0x199')]=_0x1a8189['Smtp'][_0x6526('0x199')];}if(_0x1a8189[_0x6526('0x190')][_0x6526('0x19a')]){_0x4f8e03[_0x6526('0x19b')]={'user':_0x1a8189['Smtp']['user'],'pass':_0x1a8189[_0x6526('0x190')][_0x6526('0x19c')]};}if(this[_0x6526('0x7c')](_0x47cdfd['template_id'])){}logger[_0x6526('0xd5')]('sendMail\x20message',JSON[_0x6526('0x6a')](_0x43d926));this[_0x6526('0x2e')][_0x6526('0x65')](this,_0x47cdfd,_0x47cdfd[_0x6526('0x18e')]);this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')](_0x6526('0x19d'),_0x1a8189['name']));this[_0x6526('0x21')][_0x6526('0x65')](this,_0x4f8e03,_0x43d926);return this[_0x6526('0x2f')]['noop'](_0x6526('0x19e'));};AGIVertices[_0x6526('0x10')]['sendFax']=function(_0x47e1fc){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x19f'),_0x47e1fc[_0x6526('0xac')]));return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x1a0'));};AGIVertices[_0x6526('0x10')][_0x6526('0x1a1')]=function(_0xd0a957){logger['info'](util[_0x6526('0x4a')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xd0a957[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0xd0a957[_0x6526('0x1a2')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x1a3'));}var _0x5d8fc4=this['getSmsAccount'][_0x6526('0x65')](this,_0xd0a957[_0x6526('0x1a2')]);if(!_0x5d8fc4){return this['channel'][_0x6526('0x27')](_0xd0a957,_0x6526('0x1a4'));}var _0x4b4271={'body':_0xd0a957[_0x6526('0x1a5')],'phone':_0xd0a957['to']||'','SmsAccountId':_0x5d8fc4['id']};logger[_0x6526('0xd5')](_0x6526('0x1a6'),JSON['stringify'](_0x4b4271));this['createSquareDetailsReport']['sync'](this,_0xd0a957,_0xd0a957[_0x6526('0x1a2')]);this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')](_0x6526('0x1a7'),_0x5d8fc4[_0x6526('0xe')]));this[_0x6526('0x1a8')][_0x6526('0x65')](this,_0x4b4271);return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x1a9'));};AGIVertices['prototype'][_0x6526('0x1aa')]=function(_0x1327cd){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1327cd['label']));if(!this[_0x6526('0x7c')](_0x1327cd[_0x6526('0x160')])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x1327cd,_0x6526('0x1ab'));}var _0x14e2bc=this[_0x6526('0x9b')][_0x6526('0x65')](this,_0x1327cd['variable_id']);if(!_0x14e2bc){return this['channel']['error'](_0x1327cd,'no\x20variable\x20found');}return this[_0x6526('0x2f')][_0x6526('0x98')](_0x14e2bc,_0x1327cd[_0x6526('0x1ac')]);};AGIVertices[_0x6526('0x10')]['start']=function(_0x367d76){logger['info'](util[_0x6526('0x4a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x367d76[_0x6526('0xac')]));this[_0x6526('0x2f')]['noop']('START\x20CALLY\x20SQUARE');if(_0x367d76[_0x6526('0xb5')]===_0x6526('0x1ad')){this[_0x6526('0x2f')][_0x6526('0xa8')]('Answer');return this[_0x6526('0x2f')][_0x6526('0xb5')]();}return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0x1ae'));};AGIVertices[_0x6526('0x10')][_0x6526('0x1af')]=function(_0x2be584){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2be584[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x2be584[_0x6526('0x1b0')])){return this['channel'][_0x6526('0x27')](_0x2be584,_0x6526('0x1b1'));}var _0x3778b0=this[_0x6526('0x1b2')][_0x6526('0x65')](this,_0x2be584['project_id']);if(!this['isConfigured'](_0x3778b0)){return this[_0x6526('0x2f')]['error'](_0x2be584,util[_0x6526('0x4a')](_0x6526('0x1b3'),_0x2be584['project_id']));}if(_0x3778b0===this[_0x6526('0x2f')]['arg_1']){return this[_0x6526('0x2f')]['error'](_0x2be584,_0x6526('0x1b4'));}this['createSquareDetailsReport'][_0x6526('0x65')](this,_0x2be584,_0x3778b0);var _0x52a110=this[_0x6526('0x2f')][_0x6526('0xa5')]('AGI',util[_0x6526('0x4a')](_0x6526('0x1b5'),config[_0x6526('0xb4')][_0x6526('0x197')]||_0x6526('0x1b6'),_0x3778b0,this[_0x6526('0x2f')][_0x6526('0x31')]));if(_0x52a110[_0x6526('0xa7')]===-0x1){return _0x52a110;}return this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0xc0'),_0x6526('0x1b7'),_0x3778b0));};AGIVertices[_0x6526('0x10')][_0x6526('0x1b8')]=function(_0x1ac77a){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x1b9'),_0x1ac77a[_0x6526('0xac')]));var _0x43593f=this[_0x6526('0x4d')][_0x6526('0x65')](this,_0x1ac77a[_0x6526('0x1ba')]);this[_0x6526('0x2e')][_0x6526('0x65')](this,_0x1ac77a,_0x1ac77a[_0x6526('0x1ba')]);if(this[_0x6526('0x7c')](_0x1ac77a['variable_id'])){var _0x5914d7=this[_0x6526('0x9b')][_0x6526('0x65')](this,_0x1ac77a['variable_id']);if(_0x5914d7){this[_0x6526('0x2f')][_0x6526('0x98')](_0x5914d7,_0x43593f);return this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')](_0x6526('0x1bb'),_0x1ac77a['command'],_0x5914d7));}}return this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x1bc'),_0x1ac77a[_0x6526('0x1ba')]));};AGIVertices[_0x6526('0x10')][_0x6526('0x1bd')]=function(_0x336a39){logger['info'](util[_0x6526('0x4a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x336a39['label']));_0x336a39['text']=_0x336a39[_0x6526('0x53')][_0x6526('0x4f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6526('0x7c')](_0x336a39['apiKey'])){return this['channel'][_0x6526('0xa8')](_0x6526('0x1be'));}if(!this[_0x6526('0x7c')](_0x336a39[_0x6526('0x53')])){return this['channel'][_0x6526('0xa8')]('no\x20text\x20configured');}this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x1bf'),_0x336a39[_0x6526('0x53')]));var _0x29cf1a=this['googleCloudTTS'][_0x6526('0x65')](this,_0x336a39);if(_0x29cf1a){this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x29cf1a));var _0x167430=this[_0x6526('0x2f')][_0x6526('0x14f')](_0x29cf1a);try{fs['unlink'](_0x29cf1a+_0x6526('0xfb'));}catch(_0x173615){logger[_0x6526('0x27')](_0x173615);}return _0x167430;}return this[_0x6526('0x2f')][_0x6526('0x27')](_0x336a39,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6526('0x10')][_0x6526('0x1c0')]=function(_0xc8e1c0){logger['info'](util[_0x6526('0x4a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0xc8e1c0[_0x6526('0xac')]));_0xc8e1c0[_0x6526('0x53')]=_0xc8e1c0[_0x6526('0x53')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xc8e1c0[_0x6526('0x53')])){return this[_0x6526('0x2f')][_0x6526('0xa8')](_0x6526('0xa4'));}this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')]('Trying\x20Google\x20TTS\x20%s',_0xc8e1c0[_0x6526('0x53')]));var _0x17f19a=this[_0x6526('0x58')][_0x6526('0x65')](this,_0xc8e1c0);if(_0x17f19a){this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')]('Google\x20TTS\x20%s\x20file\x20created',_0x17f19a));var _0x282061=this[_0x6526('0x2f')][_0x6526('0x14f')](_0x17f19a);try{}catch(_0x220f9b){logger[_0x6526('0x27')](_0x220f9b);}return _0x282061;}return this[_0x6526('0x2f')]['error'](_0xc8e1c0,_0x6526('0x1c1'));};AGIVertices[_0x6526('0x10')]['unpause']=function(_0xac0fa2){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x1c2'),_0xac0fa2['label']));if(!this[_0x6526('0x7c')](_0xac0fa2[_0x6526('0x154')])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0xac0fa2,_0x6526('0x153'));}logger[_0x6526('0x2c')](util['format'](_0x6526('0x167'),this['channel'][_0x6526('0x34')],_0xac0fa2['findBy']));var _0x48640a=this[_0x6526('0x46')]['sync'](this,_0xac0fa2[_0x6526('0x154')]);if(_0x48640a){logger[_0x6526('0x2c')](util[_0x6526('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6526('0x2f')][_0x6526('0x34')],_0xac0fa2['findBy']));this['channel'][_0x6526('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x6526('0x2f')][_0x6526('0x34')],_0xac0fa2['findBy']));return{'code':0xc8,'result':_0x6526('0x155')};}else{logger[_0x6526('0x2c')](util['format'](_0x6526('0x156'),this['channel'][_0x6526('0x34')],_0xac0fa2['findBy']));this[_0x6526('0x2f')][_0x6526('0xa8')](util[_0x6526('0x4a')](_0x6526('0x156'),this['channel'][_0x6526('0x34')],_0xac0fa2[_0x6526('0x154')]));return{'code':0xc8,'result':_0x6526('0x157')};}};AGIVertices[_0x6526('0x10')]['voicemail']=function(_0x444e1c){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x1c3'),_0x444e1c[_0x6526('0xac')]));var _0x461b4d=this[_0x6526('0x2f')]['exec'](_0x6526('0x1c4'),[_0x444e1c[_0x6526('0x1c5')],_0x444e1c['options']]);if(_0x461b4d[_0x6526('0xa7')]===-0x1){return _0x461b4d;}return this[_0x6526('0x2f')]['noop'](util[_0x6526('0x4a')]('Executed\x20command\x20%s\x20%s',_0x6526('0x1c4'),_0x444e1c[_0x6526('0x1c5')]));};AGIVertices[_0x6526('0x10')][_0x6526('0x1c6')]=function(_0x4777fa){logger[_0x6526('0x2c')](util[_0x6526('0x4a')](_0x6526('0x1c7'),_0x4777fa[_0x6526('0xac')]));if(!this[_0x6526('0x7c')](_0x4777fa[_0x6526('0x160')])){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x4777fa,_0x6526('0x1ab'));}var _0x169307=this[_0x6526('0x9b')][_0x6526('0x65')](this,_0x4777fa['variable_id']);if(!_0x169307){return this[_0x6526('0x2f')][_0x6526('0x27')](_0x4777fa,'no\x20variable\x20found');}var _0x5dae80=this[_0x6526('0x2f')]['getVariable'](_0x169307);return{'code':0xc8,'result':_0x5dae80[_0x6526('0x9c')]?_0x5dae80['extra']:'-'};};String['prototype']['replaceAll']=function(_0x257a2b,_0x365541){return this[_0x6526('0x99')](_0x257a2b)[_0x6526('0x1c8')](_0x365541);};module[_0x6526('0x1c9')]=AGIVertices; \ No newline at end of file +var _0x50ad=['Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','intKey','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','success','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','exports','path','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','catch','getVoiceQueue','name','getSquareProject','then','prototype','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','dnid','createSquareMessage','createCmContact','callback_','isEmpty','isNil','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','length','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','options','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','toUpperCase','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','finally'];(function(_0x291b8c,_0x6b7ed8){var _0x22ba34=function(_0x250020){while(--_0x250020){_0x291b8c['push'](_0x291b8c['shift']());}};_0x22ba34(++_0x6b7ed8);}(_0x50ad,0xc0));var _0xd50a=function(_0x102402,_0x4eaaf8){_0x102402=_0x102402-0x0;var _0x321b44=_0x50ad[_0x102402];return _0x321b44;};'use strict';var fs=require('fs');var path=require(_0xd50a('0x0'));var util=require(_0xd50a('0x1'));var _=require(_0xd50a('0x2'));var sh=require(_0xd50a('0x3'));var odbc=require(_0xd50a('0x4'))();var rs=require('randomstring');var moment=require(_0xd50a('0x5'));var Mustache=require(_0xd50a('0x6'));var rp=require('request-promise');var logger=require(_0xd50a('0x7'))('agi');var config=require(_0xd50a('0x8'));var scripts=require('./scripts');var FILES_PATH=_0xd50a('0x9');var recursiveMapAttributes=[_0xd50a('0xa'),'rawBody'];var verticesWithRetry=[_0xd50a('0xb'),_0xd50a('0xc'),_0xd50a('0xd')];var AGIVertices=function(_0x1992c2,_0x40e310,_0x51f76f){this[_0xd50a('0xe')]=_0x1992c2;this[_0xd50a('0xf')]=_0x40e310;this[_0xd50a('0x10')]=_0x51f76f;};AGIVertices['prototype'][_0xd50a('0x11')]=function(_0x4f7df3,_0x5dcce9){this['rpc'][_0xd50a('0x12')](_0x4f7df3)['then'](function(_0x1b2f77){_0x5dcce9(null,_0x1b2f77?_0x1b2f77['name']:![]);})[_0xd50a('0x13')](function(_0x42ec68){_0x5dcce9(_0x42ec68);});};AGIVertices['prototype'][_0xd50a('0x14')]=function(_0x1fc4f0,_0x278147){this[_0xd50a('0xf')]['getVoiceQueueById'](_0x1fc4f0)['then'](function(_0x183062){_0x278147(null,_0x183062?_0x183062[_0xd50a('0x15')]:![]);})['catch'](function(_0x40286a){_0x278147(_0x40286a);});};AGIVertices['prototype'][_0xd50a('0x16')]=function(_0x15d12e,_0x5d3a89){this[_0xd50a('0xf')]['getSquareProjectById'](_0x15d12e)[_0xd50a('0x17')](function(_0x3d17e6){_0x5d3a89(null,_0x3d17e6?_0x3d17e6[_0xd50a('0x15')]:![]);})[_0xd50a('0x13')](function(_0xe548da){_0x5d3a89(_0xe548da);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x19')]=function(_0x3165fc,_0x2b0f44){this[_0xd50a('0xf')][_0xd50a('0x1a')](_0x3165fc)[_0xd50a('0x17')](function(_0x13d5ab){_0x2b0f44(null,_0x13d5ab?_0x13d5ab['dsn']:![]);})[_0xd50a('0x13')](function(_0x23e963){_0x2b0f44(_0x23e963);});};AGIVertices['prototype'][_0xd50a('0x1b')]=function(_0x1490cf,_0x395a6c){this[_0xd50a('0xf')][_0xd50a('0x1c')](_0x1490cf)[_0xd50a('0x17')](function(_0x56cb7a){_0x395a6c(null,_0x56cb7a?_0x56cb7a[_0xd50a('0x15')]:![]);})[_0xd50a('0x13')](function(_0x1a9f55){_0x395a6c(_0x1a9f55);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1d')]=function(_0x4a3124,_0x4b6108){this['rpc'][_0xd50a('0x1e')](_0x4a3124)['then'](function(_0x3149e0){_0x4b6108(null,_0x3149e0?_0x3149e0[_0xd50a('0x15')]:![]);})[_0xd50a('0x13')](function(_0x2d3004){_0x4b6108(_0x2d3004);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1f')]=function(_0x33554e,_0xbfec65){var _0xa3b9b3=this;this[_0xd50a('0xf')][_0xd50a('0x20')](_0x33554e)[_0xd50a('0x17')](function(_0x5b87ac){_0xbfec65(null,_0x5b87ac?_0xa3b9b3[_0xd50a('0x21')](_0x5b87ac[_0xd50a('0x22')]):![]);})[_0xd50a('0x13')](function(_0x5d6c52){_0xbfec65(_0x5d6c52);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x23')]=function(_0x532026,_0x53d30c){this[_0xd50a('0xf')][_0xd50a('0x24')](_0x532026)[_0xd50a('0x17')](function(_0x31b591){_0x53d30c(null,_0x31b591?_0x31b591:![]);})[_0xd50a('0x13')](function(_0xe5da51){_0x53d30c(_0xe5da51);});};AGIVertices[_0xd50a('0x18')]['sendMailMessage']=function(_0x495567,_0x24f014,_0x5a00f0){this['mailRpc'][_0xd50a('0x25')](_0x495567,_0x24f014)['then'](function(){_0x5a00f0(null);})[_0xd50a('0x13')](function(_0x38c826){_0x5a00f0(_0x38c826);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x26')]=function(_0x327d74,_0x1a69b9){this[_0xd50a('0xf')][_0xd50a('0x27')](_0x327d74)['then'](function(_0x4c9e3b){if(_0x4c9e3b){if(_0x4c9e3b['IntervalId']){_0x1a69b9(null,[_0x4c9e3b[_0xd50a('0x28')]]);}else{_0x1a69b9(null,_['map'](_0x4c9e3b['Intervals'],_0xd50a('0x28')));}}else{_0x1a69b9(null,![]);}})[_0xd50a('0x13')](function(_0x135e11){_0x1a69b9(_0x135e11);});};AGIVertices[_0xd50a('0x18')]['getSoundPath']=function(_0x2ad57f){return util[_0xd50a('0x29')](_0xd50a('0x2a'),FILES_PATH,_0x2ad57f);};AGIVertices['prototype']['getQueryOdbc']=function(_0x1d4f89,_0x43fed8,_0x1bfdb7){odbc[_0xd50a('0x2b')](_0x1d4f89,function(_0x2c36d2){if(_0x2c36d2){logger[_0xd50a('0x2c')](_0xd50a('0x2d'),_0x2c36d2);_0x1bfdb7(_0x2c36d2);}else{logger[_0xd50a('0x2e')](_0xd50a('0x2f'));odbc[_0xd50a('0x30')](_0x43fed8,function(_0x433180,_0xf5b687){if(_0x433180){logger['info']('Error\x20executing\x20query\x20%s',_0x43fed8);_0x1bfdb7(_0x433180);}else{logger[_0xd50a('0x2e')](_0xd50a('0x31'),_0x43fed8);odbc[_0xd50a('0x32')](function(_0x3f0765){if(_0x3f0765){logger[_0xd50a('0x2c')](_0xd50a('0x33'),_0x3f0765);}_0x1bfdb7(null,_0xf5b687);});}});}});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x34')]=function(_0xd6f624,_0x18cdb1){this[_0xd50a('0xf')][_0xd50a('0x35')](_0xd6f624)[_0xd50a('0x17')](function(_0x44ec93){_0x18cdb1(null,_0x44ec93?_0x44ec93:![]);})[_0xd50a('0x13')](function(_0x4a2489){_0x18cdb1(_0x4a2489);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x36')]=function(_0x51b866,_0x5d3bba){this['rpc']['createSmsMessage'](_0x51b866)['then'](function(_0x29bfc6){_0x5d3bba(null,_0x29bfc6);})[_0xd50a('0x13')](function(_0x929964){_0x5d3bba(_0x929964);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x37')]=function(_0x149b94,_0x7affde,_0x3b692a){this['rpc'][_0xd50a('0x37')]({'uniqueid':this[_0xd50a('0xe')][_0xd50a('0x38')],'node':_0x149b94[_0xd50a('0x39')],'application':_0x149b94[_0xd50a('0x3a')],'data':_0x7affde||null,'project_name':this[_0xd50a('0xe')][_0xd50a('0x3b')],'callerid':this[_0xd50a('0xe')]['callerid']})[_0xd50a('0x17')](function(_0x3a0e1c){if(_0x3b692a){_0x3b692a(null,_0x3a0e1c);}})[_0xd50a('0x13')](function(_0x5d2312){if(_0x3b692a){_0x3b692a(_0x5d2312);}});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x3c')]=function(_0x3f00ff,_0x5cafdd,_0x481ad6,_0x12834d){this[_0xd50a('0xf')][_0xd50a('0x3c')]({'uniqueid':this[_0xd50a('0xe')][_0xd50a('0x38')],'callerid':this[_0xd50a('0xe')][_0xd50a('0x3d')],'calleridname':this[_0xd50a('0xe')][_0xd50a('0x3e')],'context':this['channel'][_0xd50a('0x3f')],'extension':this['channel'][_0xd50a('0x40')],'priority':this[_0xd50a('0xe')][_0xd50a('0x41')],'accountcode':this[_0xd50a('0xe')]['accountcode'],'dnid':this[_0xd50a('0xe')][_0xd50a('0x42')],'projectName':this['channel'][_0xd50a('0x3b')],'saveName':_0x5cafdd,'filename':_0x3f00ff['file']||_0x5cafdd,'savePath':_0x481ad6})['then'](function(_0x318678){_0x12834d(null,_0x318678);})[_0xd50a('0x13')](function(_0x33915f){_0x12834d(_0x33915f);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x43')]=function(_0x3fbb62,_0x266e21,_0x537c66,_0x39021a,_0x3a8e1f){this[_0xd50a('0xf')][_0xd50a('0x43')]({'uniqueid':this[_0xd50a('0xe')]['uniqueid'],'body':_0x3fbb62,'direction':_0x266e21,'providerName':_0x537c66,'providerResponse':_0x39021a})[_0xd50a('0x17')](function(_0x4151bd){if(_0x3a8e1f){_0x3a8e1f(null,_0x4151bd);}})[_0xd50a('0x13')](function(_0x436630){if(_0x3a8e1f){_0x3a8e1f(_0x436630);}});};AGIVertices['prototype'][_0xd50a('0x44')]=function(_0x17dafe,_0xac6c3c){this[_0xd50a('0xf')]['createCmContact']({'firstName':_['isEmpty'](_0x17dafe[_0xd50a('0x15')])||_['isNil'](_0x17dafe[_0xd50a('0x15')])?_0xd50a('0x45')+Math['random']():_0x17dafe['name'],'lastName':_[_0xd50a('0x46')](_0x17dafe['lastName'])||_[_0xd50a('0x47')](_0x17dafe[_0xd50a('0x48')])?null:_0x17dafe[_0xd50a('0x48')],'phone':_0x17dafe[_0xd50a('0x49')],'ListId':_0x17dafe[_0xd50a('0x4a')],'scheduledat':_0x17dafe[_0xd50a('0x4b')],'callbackUniqueid':this[_0xd50a('0xe')][_0xd50a('0x38')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x17dafe['scheduledAt'][_0xd50a('0x4c')](),'priority':_0x17dafe[_0xd50a('0x4d')]})[_0xd50a('0x17')](function(_0x497140){_0xac6c3c(null,_0x497140);})[_0xd50a('0x13')](function(_0x1a3b76){_0xac6c3c(_0x1a3b76);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x4e')]=function(_0x246f00,_0x50055d){this['rpc'][_0xd50a('0x4f')](_0x246f00)['then'](function(_0x412d36){_0x50055d(null,_0x412d36?_0x412d36['name']:![]);})[_0xd50a('0x13')](function(_0x4e67c2){_0x50055d(_0x4e67c2);});};AGIVertices[_0xd50a('0x18')]['agentPause']=function(_0x3fd0e1,_0x44fa0c,_0x32afdb){var _0x1e4f2a={'role':_0xd50a('0x50')};_0x1e4f2a[_0x3fd0e1]=this[_0xd50a('0xe')][_0xd50a('0x3d')];this[_0xd50a('0xf')][_0xd50a('0x51')](_0x1e4f2a,_0x44fa0c,this['channel'][_0xd50a('0x38')])[_0xd50a('0x17')](function(_0x55260f){_0x32afdb(null,_[_0xd50a('0x47')](_0x55260f)?![]:!![]);})[_0xd50a('0x13')](function(_0x42e3a8){logger['error'](_0x42e3a8);_0x32afdb(null,![]);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x52')]=function(_0x325c10,_0x1b990b){var _0x263a83={'role':_0xd50a('0x50')};_0x263a83[_0x325c10]=this[_0xd50a('0xe')][_0xd50a('0x3d')];this[_0xd50a('0xf')][_0xd50a('0x52')](_0x263a83)[_0xd50a('0x17')](function(_0x440244){_0x1b990b(null,_['isNil'](_0x440244)?![]:!![]);})[_0xd50a('0x13')](function(_0x3743f6){logger[_0xd50a('0x2c')](_0x3743f6);_0x1b990b(null,![]);});};AGIVertices[_0xd50a('0x18')]['agentLogout']=function(_0x34bb1b,_0x230b94){var _0x260b53={'role':_0xd50a('0x50')};_0x260b53[_0x34bb1b]=this[_0xd50a('0xe')][_0xd50a('0x3d')];this[_0xd50a('0xf')][_0xd50a('0x53')](_0x260b53)[_0xd50a('0x17')](function(_0x3eb2db){_0x230b94(null,_[_0xd50a('0x47')](_0x3eb2db)?![]:!![]);})[_0xd50a('0x13')](function(_0xc3e316){logger[_0xd50a('0x2c')](_0xc3e316);_0x230b94(null,![]);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x54')]=function(_0x5a6e28,_0x2c5ea3){var _0x5d1717={'role':_0xd50a('0x50')};_0x5d1717[_0x5a6e28]=this[_0xd50a('0xe')][_0xd50a('0x3d')];var _0x435947=_0x5a6e28!='internal'?util[_0xd50a('0x29')]('%s/%s@from-sip/n',_0xd50a('0x55'),this['channel']['callerid']):undefined;this[_0xd50a('0xf')][_0xd50a('0x54')](_0x5d1717,_0x435947)[_0xd50a('0x17')](function(_0x44791a){_0x2c5ea3(null,_['isNil'](_0x44791a)?![]:!![]);})[_0xd50a('0x13')](function(_0x12858a){logger[_0xd50a('0x2c')](_0x12858a);_0x2c5ea3(null,![]);});};AGIVertices['prototype'][_0xd50a('0x56')]=function(_0x8a2c0c,_0x3849c5){sh[_0xd50a('0x57')](_[_0xd50a('0x58')](_0x8a2c0c),function(_0x5dbe0c,_0x3bd9cd){var _0x25f654=_0x3bd9cd[_0xd50a('0x59')](/(\r\n|\n|\r)/gm,'');_0x3849c5(null,_0x25f654);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x5a')]=function(_0x475b5a,_0x1f975b){scripts[_0xd50a('0x5a')](_0x475b5a[_0xd50a('0x5b')],_0x475b5a[_0xd50a('0x5c')]||_0xd50a('0x5d'),_0x475b5a[_0xd50a('0x5d')],_0x475b5a['languageCode']||_0xd50a('0x5e'),_0x475b5a['ssmlGender']||'MALE',_0x475b5a['audioEncoding']||_0xd50a('0x5f'))['then'](function(_0x509aae){_0x1f975b(null,_0x509aae);})[_0xd50a('0x13')](function(_0x2bfe25){_0x1f975b(_0x2bfe25);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x60')]=function(_0x11fe51,_0x52dd5d){scripts[_0xd50a('0x60')](_0x11fe51[_0xd50a('0x5d')],_0x11fe51[_0xd50a('0x61')]||'en',0x1)[_0xd50a('0x17')](function(_0x597fa9){_0x52dd5d(null,_0x597fa9);})['catch'](function(_0x1be76f){_0x52dd5d(_0x1be76f);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x62')]=function(_0x5e37c4,_0xd0a835){var _0x470cdf={'uri':_0x5e37c4[_0xd50a('0x63')],'method':_0x5e37c4[_0xd50a('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5e37c4[_0xd50a('0x65')])===_0xd50a('0x66')&&parseInt(_0x5e37c4['timeout'])>=0x1?parseInt(_0x5e37c4[_0xd50a('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xd50a('0x67')]([_0xd50a('0x68'),_0xd50a('0x69')],_0x470cdf[_0xd50a('0x64')]['toUpperCase']())){try{_0x470cdf[_0xd50a('0x6a')]=_0x5e37c4['rawBody']?JSON[_0xd50a('0x6b')](_0x5e37c4[_0xd50a('0x6c')]):{};}catch(_0x30c77a){logger[_0xd50a('0x2c')](_0xd50a('0x6d'),_0x30c77a);}}try{_0x470cdf['headers']=_0x5e37c4[_0xd50a('0xa')]?JSON[_0xd50a('0x6b')](_0x5e37c4[_0xd50a('0xa')]):{};}catch(_0x563740){logger[_0xd50a('0x2c')](_0xd50a('0x6e'),_0x563740);}if(_0x5e37c4[_0xd50a('0x6f')]){try{var _0x983732=require(_0x5e37c4['computedVariables'])['sync'](this,_0x470cdf);_0x470cdf[_0xd50a('0x70')]=Mustache[_0xd50a('0x71')](_0x5e37c4[_0xd50a('0x63')],_0x983732,{},['$$','$$']);if(_0x470cdf[_0xd50a('0x72')]){_0x470cdf[_0xd50a('0x72')]=JSON[_0xd50a('0x6b')](Mustache['render'](JSON[_0xd50a('0x73')](_0x470cdf[_0xd50a('0x72')]),_0x983732,{},['$$','$$']));}if(_0x470cdf[_0xd50a('0x6a')]){_0x470cdf[_0xd50a('0x6a')]=JSON[_0xd50a('0x6b')](Mustache['render'](JSON[_0xd50a('0x73')](_0x470cdf[_0xd50a('0x6a')]),_0x983732,{},['$$','$$']));}}catch(_0x58403f){logger[_0xd50a('0x2c')](_0xd50a('0x74'),_0x58403f);}}rp(_0x470cdf)[_0xd50a('0x17')](function(_0x44762f){var _0x5a1e5a={'statusCode':_0x44762f[_0xd50a('0x75')]||0xc8,'statusMessage':_0x44762f[_0xd50a('0x76')]||'OK','headers':_0x44762f['headers']||{},'body':_0x44762f[_0xd50a('0x6a')]||{}};_0xd0a835(null,_0x5a1e5a);})[_0xd50a('0x13')](function(_0x3f04bb){var _0x2cd6e6={'statusCode':_0x3f04bb[_0xd50a('0x75')]||0x1f4,'statusMessage':_0x3f04bb[_0xd50a('0x77')]||_0xd50a('0x78'),'headers':_0x3f04bb['options'][_0xd50a('0x72')]||{},'body':_0x3f04bb['options'][_0xd50a('0x6a')]||{}};_0xd0a835(null,_0x2cd6e6);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x79')]=function(_0x50a181,_0x5f071b){scripts[_0xd50a('0x79')](this[_0xd50a('0xe')][_0xd50a('0x38')],_0x50a181[_0xd50a('0x7a')],_0x50a181[_0xd50a('0x5d')],_0x50a181[_0xd50a('0x7b')]||'en')[_0xd50a('0x17')](function(_0x545e58){_0x5f071b(null,_0x545e58);})[_0xd50a('0x13')](function(_0x1865b2){_0x5f071b(_0x1865b2);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x7c')]=function(_0x1529b7,_0xbab9f8){scripts[_0xd50a('0x7c')](this[_0xd50a('0xe')]['uniqueid'],_0x1529b7[_0xd50a('0x7d')],_0x1529b7[_0xd50a('0x7e')],_0x1529b7['private_key'],_0x1529b7[_0xd50a('0x5d')],_0x1529b7[_0xd50a('0x7f')]||'en')[_0xd50a('0x17')](function(_0x430595){_0xbab9f8(null,_0x430595);})['catch'](function(_0x34d45b){_0xbab9f8(_0x34d45b);});};AGIVertices[_0xd50a('0x18')]['sestekNDA']=function(_0xd8dbed,_0x60a4dc){scripts[_0xd50a('0x80')](this[_0xd50a('0xe')],_0xd8dbed)[_0xd50a('0x17')](function(_0x42a5a2){_0x60a4dc(null,_0x42a5a2);})[_0xd50a('0x13')](function(_0x3faa81){_0x60a4dc(_0x3faa81);});};AGIVertices[_0xd50a('0x18')]['ispeechTTS']=function(_0x423bfc,_0x1a335d){scripts['ispeechTTS'](_0x423bfc[_0xd50a('0x7a')],_0x423bfc[_0xd50a('0x5d')],_0x423bfc[_0xd50a('0x81')]||_0xd50a('0x5e'),_0x423bfc[_0xd50a('0x82')])[_0xd50a('0x17')](function(_0x5b1356){_0x1a335d(null,_0x5b1356);})[_0xd50a('0x13')](function(_0x2d62f1){_0x1a335d(_0x2d62f1);});};AGIVertices['prototype'][_0xd50a('0x83')]=function(_0x50d821,_0x2ea038,_0xf791b3){scripts['ispeechASR'](_0x2ea038,_0x50d821[_0xd50a('0x7a')],_0x50d821[_0xd50a('0x84')]||_0xd50a('0x5e'),this[_0xd50a('0x85')](_0x50d821['model'])?_0x50d821[_0xd50a('0x86')]:undefined)[_0xd50a('0x17')](function(_0x2ff165){_0xf791b3(null,_0x2ff165);})[_0xd50a('0x13')](function(_0x1597db){_0xf791b3(_0x1597db);});};AGIVertices[_0xd50a('0x18')]['awsPolly']=function(_0x4e2c63,_0x15d00a){scripts[_0xd50a('0x87')](_0x4e2c63[_0xd50a('0x88')],_0x4e2c63['aws_secret_access_key'],_0x4e2c63['aws_polly_region'],_0x4e2c63['aws_polly_voice']||_0xd50a('0x89'),_0x4e2c63[_0xd50a('0x5d')],_0x4e2c63[_0xd50a('0x8a')]||_0xd50a('0x5d'))['then'](function(_0x16ed56){_0x15d00a(null,_0x16ed56);})[_0xd50a('0x13')](function(_0x52a292){_0x15d00a(_0x52a292);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x8b')]=function(_0x2203f4,_0x13cb78){scripts['awsLex'](this[_0xd50a('0xe')][_0xd50a('0x38')],_0x2203f4[_0xd50a('0x88')],_0x2203f4['aws_secret_access_key'],_0x2203f4['aws_lex_region'],_0x2203f4[_0xd50a('0x5d')],_0x2203f4[_0xd50a('0x8c')])['then'](function(_0x1d75fe){_0x13cb78(null,_0x1d75fe);})[_0xd50a('0x13')](function(_0x3a8b1c){_0x13cb78(_0x3a8b1c);});};AGIVertices[_0xd50a('0x18')]['googleASR']=function(_0x4123c9,_0x47755f,_0x589637){scripts[_0xd50a('0x8d')](_0x47755f,_0x4123c9[_0xd50a('0x7a')],_0x4123c9[_0xd50a('0x8e')]||_0xd50a('0x5e'))['then'](function(_0x2e288d){_0x589637(null,_0x2e288d);})[_0xd50a('0x13')](function(_0x52cb0c){_0x589637(_0x52cb0c);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x8f')]=function(_0x315bd8,_0x3af59a,_0x559597){scripts[_0xd50a('0x8f')](_0x3af59a,_0x315bd8[_0xd50a('0x90')],_0x315bd8['appsecret'],_0x315bd8[_0xd50a('0x70')])['then'](function(_0x46a5ae){_0x559597(null,_0x46a5ae);})[_0xd50a('0x13')](function(_0xc3405c){_0x559597(_0xc3405c);});};AGIVertices['prototype'][_0xd50a('0x91')]=function(_0x4ac808){var _0x5d6209=_[_0xd50a('0x67')](verticesWithRetry,_0x4ac808['agicommand'])?_0x4ac808:_[_0xd50a('0x92')](_0x4ac808);for(var _0x34cab5 in _0x5d6209){if(_0x5d6209[_0xd50a('0x93')](_0x34cab5)){if(_0x5d6209[_0x34cab5]&&_[_0xd50a('0x94')](_0x5d6209[_0x34cab5])){if(_[_0xd50a('0x67')](recursiveMapAttributes,_0x34cab5)){_0x5d6209[_0x34cab5]=this[_0xd50a('0x95')](_0x5d6209[_0x34cab5]);}else{_0x5d6209[_0x34cab5]=this[_0xd50a('0x96')](_0x5d6209[_0x34cab5]);}}}}return _0x5d6209;};AGIVertices['prototype'][_0xd50a('0x97')]=function(_0x105c92){for(var _0x34011e in _0x105c92){if(_0x105c92[_0xd50a('0x93')](_0x34011e)){if(_[_0xd50a('0x98')](_0x105c92[_0x34011e])){this[_0xd50a('0x97')](_0x105c92[_0x34011e]);}else if(_[_0xd50a('0x99')](_0x105c92[_0x34011e])){for(var _0x5e6b3b=0x0;_0x5e6b3b<_0x105c92[_0x34011e]['length'];_0x5e6b3b++){this[_0xd50a('0x97')](_0x105c92[_0x34011e][_0x5e6b3b]);}}else if(_[_0xd50a('0x94')](_0x105c92[_0x34011e])){_0x105c92[_0x34011e]=this[_0xd50a('0x96')](_0x105c92[_0x34011e]);}}}};AGIVertices['prototype'][_0xd50a('0x9a')]=function(_0x5edf7d,_0x42c597){for(var _0x41dc53 in _0x5edf7d){if(_0x5edf7d[_0xd50a('0x93')](_0x41dc53)){if(_[_0xd50a('0x98')](_0x5edf7d[_0x41dc53])){if(!_['isEmpty'](_0x5edf7d[_0x41dc53])){this[_0xd50a('0x9a')](_0x5edf7d[_0x41dc53],util[_0xd50a('0x29')]('%s.%s',_0x42c597,_0x41dc53));}}else if(_[_0xd50a('0x99')](_0x5edf7d[_0x41dc53])){for(var _0x55829b=0x0;_0x55829b<_0x5edf7d[_0x41dc53][_0xd50a('0x9b')];_0x55829b++){this[_0xd50a('0x9a')](_0x5edf7d[_0x41dc53][_0x55829b],util[_0xd50a('0x29')](_0xd50a('0x9c'),_0x42c597,_0x41dc53+'['+_0x55829b+']'));}}else{if(!_['isNil'](_0x5edf7d[_0x41dc53])){this[_0xd50a('0xe')][_0xd50a('0x9d')](util['format']('%s.%s',_0x42c597,_0x41dc53),_0x5edf7d[_0x41dc53]);}}}}};AGIVertices[_0xd50a('0x18')][_0xd50a('0x95')]=function(_0x149645){try{var _0xa0c99c=JSON[_0xd50a('0x6b')](_0x149645);this['recursiveNodeIndex'](_0xa0c99c);return JSON[_0xd50a('0x73')](_0xa0c99c);}catch(_0x4b89f3){return this['replaceAllVariables'](_0x149645);}};AGIVertices['prototype'][_0xd50a('0x96')]=function(_0x363320){var _0x14e8dc=_0x363320[_0xd50a('0x9e')]('{');for(var _0x14f237=0x1;_0x14f237<_0x14e8dc['length'];_0x14f237+=0x1){var _0x3ac69c=_0x14e8dc[_0x14f237][_0xd50a('0x9e')]('}');if(_0x3ac69c['length']>0x1){_0x363320=_0x363320[_0xd50a('0x9f')]('{'+_0x3ac69c[0x0]+'}',this['channel'][_0xd50a('0x11')](_0x3ac69c[0x0])[_0xd50a('0xa0')]||_0x3ac69c[0x0]);}}if(_0x14e8dc[_0xd50a('0x9b')]===0x1){return _0x363320[_0xd50a('0x4c')]();}return this[_0xd50a('0x96')](_0x363320);};AGIVertices[_0xd50a('0x18')][_0xd50a('0xa1')]=function(_0x48a904,_0x137719){var _0x3d84a7=this['channel'][_0xd50a('0x11')](_0x48a904);if(_0x3d84a7['result']===-0x1){return _0x3d84a7;}logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xa2'),_0x137719,_0x3d84a7[_0xd50a('0xa0')]));return this['channel'][_0xd50a('0x9d')](_0x137719,_0x3d84a7[_0xd50a('0xa0')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x85')]=function(_0x52041b){return _0x52041b&&_0x52041b!=='0'&&_0x52041b!=='-1'&&_0x52041b!=='';};AGIVertices[_0xd50a('0x18')][_0xd50a('0xa3')]=function(_0x2a84ac){this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x2a84ac,'-');_0x2a84ac[_0xd50a('0xa5')]=_0x2a84ac[_0xd50a('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd50a('0x18')][_0xd50a('0xa6')]=function(_0x5d8d95){logger['info'](util[_0xd50a('0x29')](_0xd50a('0xa7'),_0x5d8d95[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x5d8d95[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}var _0x44c211='\x22'+_0x5d8d95['text']+'\x22';if(this['isConfigured'](_0x5d8d95['options'])){_0x44c211+=','+_0x5d8d95[_0xd50a('0xaa')];}var _0x270706=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0xab'),_0x44c211);if(_0x270706[_0xd50a('0xac')]===-0x1){return _0x270706;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x44c211));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xad')]=function(_0x1016e1){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xae'),_0x1016e1[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x1016e1['grammar'])){return this['channel']['noop'](_0xd50a('0xaf'));}var _0x25db2d=_0x1016e1['grammar'];if(this['isConfigured'](_0x1016e1[_0xd50a('0xaa')])){_0x25db2d+=','+_0x1016e1[_0xd50a('0xaa')];}var _0x38497b=this['channel'][_0xd50a('0x57')](_0xd50a('0xb0'),_0x25db2d);if(_0x38497b[_0xd50a('0xac')]===-0x1){return _0x38497b;}var _0x4039bf=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xd50a('0xb1'));if(_0x4039bf[_0xd50a('0xac')]===-0x1){return _0x4039bf;}var _0x1d46af=this[_0xd50a('0xa1')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x1d46af[_0xd50a('0xac')]===-0x1){return _0x1d46af;}var _0x2864c6=this[_0xd50a('0xa1')]('RECOG_INSTANCE()',_0xd50a('0xb2'));if(_0x2864c6[_0xd50a('0xac')]===-0x1){return _0x2864c6;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xb3'),_0x25db2d));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xb4')]=function(_0x4651f1){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x4651f1[_0xd50a('0x39')]));return this['channel']['agi']([_0x4651f1[_0xd50a('0xb5')],_0x4651f1[_0xd50a('0xb6')]]);};AGIVertices[_0xd50a('0x18')]['answer']=function(_0x112104){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x112104[_0xd50a('0x39')]));if(this[_0xd50a('0x85')](_0x112104[_0xd50a('0x65')])){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xb7'),_0x112104[_0xd50a('0x65')]));var _0x31a0a4=this[_0xd50a('0xe')][_0xd50a('0xb8')](_0x112104[_0xd50a('0x65')]);if(_0x31a0a4[_0xd50a('0xac')]===-0x1){return _0x31a0a4;}}return this['channel'][_0xd50a('0xb9')]();};AGIVertices[_0xd50a('0x18')][_0xd50a('0xba')]=function(_0x5e98a8){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0xbb'),_0x5e98a8[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x5e98a8['list_id'])){return this['channel']['error'](_0x5e98a8,_0xd50a('0xbc'));}_0x5e98a8[_0xd50a('0x4b')]=moment();if(this[_0xd50a('0x85')](_0x5e98a8[_0xd50a('0xbd')])){_0x5e98a8['scheduledAt']=moment()['add'](_0x5e98a8[_0xd50a('0xbd')],'minutes');}if(!this['isConfigured'](_0x5e98a8['callback_priority'])){_0x5e98a8['callback_priority']=0x2;}this[_0xd50a('0x44')]['sync'](this,_0x5e98a8);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xbe'),_0x5e98a8[_0xd50a('0x49')],_0x5e98a8[_0xd50a('0x4a')],_0x5e98a8[_0xd50a('0x4b')]));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xbf')]=function(_0x6cc147){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0xc0'),_0x6cc147[_0xd50a('0x39')]));var _0x3156da=this[_0xd50a('0xe')]['exec'](_0x6cc147[_0xd50a('0xc1')],_0x6cc147[_0xd50a('0xaa')]);if(_0x3156da[_0xd50a('0xac')]===-0x1){return _0x3156da;}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xc2'),_0x6cc147[_0xd50a('0xc1')],_0x6cc147[_0xd50a('0xaa')]));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xc3')]=function(_0x177143){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0xc4'),_0x177143[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x177143[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}var _0x4bf0b9='\x22'+_0x177143[_0xd50a('0x5d')]+'\x22';if(this['isConfigured'](_0x177143[_0xd50a('0xaa')])){_0x4bf0b9+=','+_0x177143[_0xd50a('0xaa')];}var _0x50b92a=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0xab'),_0x4bf0b9);if(_0x50b92a[_0xd50a('0xac')]===-0x1){return _0x50b92a;}return this['channel']['noop'](util[_0xd50a('0x29')](_0xd50a('0xc5'),_0x4bf0b9));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xc6')]=function(_0x2a32a0){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xc7'),_0x2a32a0[_0xd50a('0x39')]));if(!this['isConfigured'](_0x2a32a0[_0xd50a('0x5d')])){return this[_0xd50a('0xe')]['noop'](_0xd50a('0xa9'));}var _0x5bad0d='\x22'+_0x2a32a0[_0xd50a('0x5d')]+'\x22';if(this[_0xd50a('0x85')](_0x2a32a0[_0xd50a('0xaa')])){_0x5bad0d+=','+_0x2a32a0[_0xd50a('0xaa')];}var _0x68f4dc=this[_0xd50a('0xe')][_0xd50a('0x57')]('MRCPSynth',_0x5bad0d);if(_0x68f4dc[_0xd50a('0xac')]===-0x1){return _0x68f4dc;}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xc5'),_0x5bad0d));};AGIVertices[_0xd50a('0x18')]['lumenvoxasr']=function(_0x55ff40){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xc8'),_0x55ff40[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x55ff40[_0xd50a('0xc9')])){return this['channel'][_0xd50a('0xa8')](_0xd50a('0xaf'));}var _0x556b92=_0x55ff40[_0xd50a('0xc9')];if(this[_0xd50a('0x85')](_0x55ff40[_0xd50a('0xaa')])){_0x556b92+=','+_0x55ff40[_0xd50a('0xaa')];}var _0x13694d=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0xb0'),_0x556b92);if(_0x13694d[_0xd50a('0xac')]===-0x1){return _0x13694d;}var _0x48c4cc=this[_0xd50a('0xa1')]('RECOG_CONFIDENCE()',_0xd50a('0xca'));if(_0x48c4cc[_0xd50a('0xac')]===-0x1){return _0x48c4cc;}var _0x5b0bf2=this[_0xd50a('0xa1')]('RECOG_INPUT()',_0xd50a('0xcb'));if(_0x5b0bf2['result']===-0x1){return _0x5b0bf2;}var _0x472855=this['getAndSetVariable']('RECOG_INSTANCE()',_0xd50a('0xcc'));if(_0x472855[_0xd50a('0xac')]===-0x1){return _0x472855;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x556b92));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xcd')]=function(_0x4c4177){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x4c4177[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x4c4177[_0xd50a('0xc9')])){return this[_0xd50a('0xe')]['noop'](_0xd50a('0xaf'));}var _0xb75c85=_0x4c4177[_0xd50a('0xc9')];if(this['isConfigured'](_0x4c4177[_0xd50a('0xaa')])){_0xb75c85+=','+_0x4c4177[_0xd50a('0xaa')];}var _0x38fc8a=this[_0xd50a('0xe')][_0xd50a('0x57')]('MRCPRecog',_0xb75c85);if(_0x38fc8a[_0xd50a('0xac')]===-0x1){return _0x38fc8a;}var _0x2f4ef1=this['getAndSetVariable'](_0xd50a('0xce'),_0xd50a('0xcf'));if(_0x2f4ef1[_0xd50a('0xac')]===-0x1){return _0x2f4ef1;}var _0x5a2a31=this[_0xd50a('0xa1')](_0xd50a('0xd0'),_0xd50a('0xd1'));if(_0x5a2a31[_0xd50a('0xac')]===-0x1){return _0x5a2a31;}var _0x2f6a42=this[_0xd50a('0xa1')](_0xd50a('0xd2'),'SESTEK_ASR_INSTANCE');if(_0x2f6a42['result']===-0x1){return _0x2f6a42;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xb3'),_0xb75c85));};AGIVertices[_0xd50a('0x18')]['database']=function(_0x515ad3){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xd3'),_0x515ad3[_0xd50a('0x39')]));if(!this['isConfigured'](_0x515ad3[_0xd50a('0xd4')])){return this['channel'][_0xd50a('0x2c')](_0x515ad3,_0xd50a('0xd5'));}var _0x172fd1=this[_0xd50a('0x19')][_0xd50a('0xa4')](this,_0x515ad3[_0xd50a('0xd4')]);if(!_0x172fd1){return this['channel']['error'](_0x515ad3,_0xd50a('0xd6'));}if(!this['isConfigured'](_0x515ad3['query'])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x515ad3,_0xd50a('0xd7'));}var _0x4978e7=_0x515ad3[_0xd50a('0x30')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xd8'),_0x4978e7));var _0x3c0575=this['getQueryOdbc'][_0xd50a('0xa4')](this,_0x172fd1,_0x4978e7);this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x515ad3,_0x4978e7);if(!this[_0xd50a('0x85')](_0x515ad3['variable_id'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xd9'));}var _0x39ce6b=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x515ad3[_0xd50a('0xda')]);if(!_0x39ce6b){return this[_0xd50a('0xe')]['error'](_0x515ad3,_0xd50a('0xdb'));}var _0x3bc271=this;_0x3c0575[_0xd50a('0xdc')](function(_0x125965,_0x5c6d71){Object[_0xd50a('0xdd')](_0x125965)[_0xd50a('0xdc')](function(_0x2f64a8){_0x3bc271[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')]('%s[%s][%s]',_0x39ce6b,_0x5c6d71,_0x2f64a8),_0x125965[_0x2f64a8]);});});this['channel'][_0xd50a('0x9d')](util[_0xd50a('0x29')]('%s_ROWS_COUNT',_0x39ce6b),_0x3c0575[_0xd50a('0x9b')]);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xde'),_0x39ce6b));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xdf')]=function(_0x369b9a){logger[_0xd50a('0xe0')](util[_0xd50a('0x29')](_0xd50a('0xe1'),_0x369b9a[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x369b9a[_0xd50a('0xe2')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x369b9a,_0xd50a('0xe3'));}var _0x334719=this[_0xd50a('0x1b')][_0xd50a('0xa4')](this,_0x369b9a[_0xd50a('0xe2')]);if(!_0x334719){return this['channel'][_0xd50a('0x2c')](_0x369b9a,_0xd50a('0xe4'));}var _0x33e8f0=this[_0xd50a('0xe')]['exec'](_0xd50a('0xe5'),[util[_0xd50a('0x29')](_0xd50a('0xe6'),_0x334719),_0x369b9a[_0xd50a('0x65')],_0x369b9a[_0xd50a('0xe7')],_0x369b9a['url']]);if(_0x33e8f0[_0xd50a('0xac')]===-0x1){return _0x33e8f0;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xe8'),_0xd50a('0xe5')));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xe9')]=function(_0x1f6b9a){logger['info'](util[_0xd50a('0x29')](_0xd50a('0xea'),_0x1f6b9a[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x1f6b9a[_0xd50a('0x7a')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xeb'));}if(!this[_0xd50a('0x85')](_0x1f6b9a[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}this[_0xd50a('0xe')]['bot']=!![];this[_0xd50a('0x37')](_0x1f6b9a);this['createSquareMessage'](_0x1f6b9a[_0xd50a('0x5d')],'in','','');this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')]('Trying\x20Dialogflow:\x20%s',_0x1f6b9a[_0xd50a('0x5d')]));var _0x39eaf0=this[_0xd50a('0x79')][_0xd50a('0xa4')](this,_0x1f6b9a);if(_0x39eaf0){for(var _0x1b156f in _0x39eaf0){if(_0x39eaf0[_0xd50a('0x93')](_0x1b156f)){this[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')]('DIALOGFLOW_%s',_0x1b156f[_0xd50a('0xec')]()),_0x39eaf0[_0x1b156f]);}}this[_0xd50a('0x43')](_0x39eaf0[_0xd50a('0xed')],'out',_0xd50a('0xe9'),'');return this['channel'][_0xd50a('0xa8')](util['format']('Dialogflow\x20Result\x20%s',_0x39eaf0[_0xd50a('0xed')]));}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x1f6b9a,_0xd50a('0xee'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xef')]=function(_0x175d53){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x175d53[_0xd50a('0x39')]));if(!this['isConfigured'](_0x175d53[_0xd50a('0x7d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20project_id\x20configured');}if(!this[_0xd50a('0x85')](_0x175d53[_0xd50a('0x7e')])){return this['channel'][_0xd50a('0xa8')](_0xd50a('0xf0'));}if(!this[_0xd50a('0x85')](_0x175d53[_0xd50a('0xf1')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xf2'));}if(!this[_0xd50a('0x85')](_0x175d53[_0xd50a('0x7f')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xf3'));}if(!this[_0xd50a('0x85')](_0x175d53['text'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20text\x20configured');}this['channel'][_0xd50a('0xf4')]=!![];this['createSquareDetailsReport'](_0x175d53);this[_0xd50a('0x43')](_0x175d53[_0xd50a('0x5d')],'in','','');this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x175d53['text']));var _0x2bf3a0=this[_0xd50a('0x7c')][_0xd50a('0xa4')](this,_0x175d53);if(_0x2bf3a0){for(var _0x1888a7 in _0x2bf3a0){if(_0x2bf3a0['hasOwnProperty'](_0x1888a7)){if(_0x1888a7!==_0xd50a('0xf5')){this[_0xd50a('0xe')][_0xd50a('0x9d')](util['format'](_0xd50a('0xf6'),_0x1888a7['toUpperCase']()),_0x2bf3a0[_0x1888a7]);}}}this[_0xd50a('0x43')](_0x2bf3a0[_0xd50a('0xed')],_0xd50a('0xf7'),_0xd50a('0xef'),_0x2bf3a0[_0xd50a('0xf5')]);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xf8'),_0x2bf3a0[_0xd50a('0xed')]));}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x175d53,_0xd50a('0xf9'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xfa')]=function(_0x5133a5){logger['info'](util[_0xd50a('0x29')](_0xd50a('0xfb'),_0x5133a5[_0xd50a('0x39')]));if(!this['isConfigured'](_0x5133a5['ndauth_url'])){return this[_0xd50a('0xe')]['noop'](_0xd50a('0xfc'));}if(!this['isConfigured'](_0x5133a5[_0xd50a('0xfd')])){return this[_0xd50a('0xe')]['noop'](_0xd50a('0xfe'));}if(!this[_0xd50a('0x85')](_0x5133a5[_0xd50a('0xff')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20password\x20configured');}if(!this[_0xd50a('0x85')](_0x5133a5['ndassistant_url'])){return this['channel']['noop'](_0xd50a('0xa9'));}this[_0xd50a('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x5133a5);this[_0xd50a('0x43')](_0x5133a5[_0xd50a('0x5d')],'in','','');this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format'](_0xd50a('0x100'),_0x5133a5[_0xd50a('0x5d')]));var _0x1c8226=this[_0xd50a('0x80')]['sync'](this,_0x5133a5);if(_0x1c8226){for(var _0x5d48f9 in _0x1c8226){if(_0x1c8226[_0xd50a('0x93')](_0x5d48f9)){this['channel'][_0xd50a('0x9d')](util['format'](_0xd50a('0x101'),_0x5d48f9['toUpperCase']()),_0x1c8226[_0x5d48f9]);}}this[_0xd50a('0x43')](_0x1c8226[_0xd50a('0xed')],'out',_0xd50a('0xfa'),'');if(_0x1c8226['audiofile']){this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x102'),_0x1c8226[_0xd50a('0x103')]));var _0x3d1320=this[_0xd50a('0xe')][_0xd50a('0x104')](_0x1c8226[_0xd50a('0x103')]);try{fs[_0xd50a('0x105')](_0x1c8226['audiofile']+_0xd50a('0x106'));}catch(_0x2ec6d6){logger[_0xd50a('0x2c')](_0x2ec6d6);}return _0x3d1320;}else{return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x107'),_0x1c8226[_0xd50a('0xed')]));}}return this['channel'][_0xd50a('0x2c')](_0x5133a5,_0xd50a('0x108'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x109')]=function(_0xb8a997){logger['info'](util[_0xd50a('0x29')]('Enter\x20in\x20END\x20(%s)\x20block',_0xb8a997['label']));return this['channel']['noop'](_0xd50a('0x109'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x10a')]=function(_0x155826){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x10b'),_0x155826[_0xd50a('0x39')]));var _0x202bef='';if(_0x155826[_0xd50a('0x10c')]){if(!this[_0xd50a('0x85')](_0x155826[_0xd50a('0x10c')])){return this[_0xd50a('0xe')]['error'](_0x155826,_0xd50a('0x10d'));}else{var _0x29e784=parseInt(_0x155826[_0xd50a('0x10c')],0xa);if(isNaN(_0x29e784)){_0x202bef=_0x155826['trunk_id'];}else{_0x202bef=this[_0xd50a('0x1d')][_0xd50a('0xa4')](this,_0x155826[_0xd50a('0x10c')]);if(!_0x202bef){return this[_0xd50a('0xe')]['error'](_0x155826,'no\x20trunk\x20found');}}}}else if(_0x155826[_0xd50a('0x10e')]){_0x202bef=_0x155826[_0xd50a('0x10e')];}else{return this['channel'][_0xd50a('0x2c')](_0x155826,_0xd50a('0x10d'));}var _0x5ea329=this[_0xd50a('0xe')]['exec'](_0xd50a('0xe5'),[util[_0xd50a('0x29')]('SIP/%s/%s',_0x202bef,_0x155826['phone']),_0x155826[_0xd50a('0x65')],_0x155826[_0xd50a('0xe7')],_0x155826[_0xd50a('0x63')]]);if(_0x5ea329[_0xd50a('0xac')]===-0x1){return _0x5ea329;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format'](_0xd50a('0xe8'),_0xd50a('0xe5')));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x10f')]=function(_0x27bcd4){logger['info'](util[_0xd50a('0x29')](_0xd50a('0x110'),_0x27bcd4[_0xd50a('0x39')]));return this[_0xd50a('0xe')]['noop']('finally');};AGIVertices[_0xd50a('0x18')][_0xd50a('0xc')]=function(_0x3037d8){logger['info'](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3037d8[_0xd50a('0x39')]));if(_0x3037d8[_0xd50a('0xa5')]===0x0){return this['maxRetry'](_0x3037d8);}_0x3037d8[_0xd50a('0xa5')]-=0x1;if(!this[_0xd50a('0x85')](_0x3037d8[_0xd50a('0x111')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x3037d8,_0xd50a('0x112'));}var _0x13932e=this[_0xd50a('0x1f')]['sync'](this,_0x3037d8[_0xd50a('0x111')]);if(!_0x13932e){return this['channel'][_0xd50a('0x2c')](_0x3037d8,_0xd50a('0x113'));}if(!this[_0xd50a('0x85')](_0x3037d8[_0xd50a('0xda')])){return this['channel'][_0xd50a('0x2c')](_0xd50a('0xd9'));}var _0x155eb5=this[_0xd50a('0xe')][_0xd50a('0x114')](_0x13932e,_0x3037d8[_0xd50a('0x115')],_0x3037d8['maxdigit']);var _0x31b547=_0x155eb5[_0xd50a('0xac')]?_0x155eb5[_0xd50a('0xac')]['toString']():'';logger['info'](_0xd50a('0x116'),JSON['stringify'](_0x155eb5));if(_0x155eb5[_0xd50a('0xac')]===-0x1){this[_0xd50a('0x37')]['sync'](this,_0x3037d8,_0x31b547);return _0x155eb5;}else if(_0x155eb5[_0xd50a('0xa0')]===_0xd50a('0x65')){_0x155eb5[_0xd50a('0xac')]=_0x31b547['length']>=parseInt(_0x3037d8[_0xd50a('0x117')])?'x':'i';}else{_0x155eb5[_0xd50a('0xac')]=_0x31b547[_0xd50a('0x9b')]>=parseInt(_0x3037d8['mindigit'])&&_0x31b547[_0xd50a('0x9b')]<=parseInt(_0x3037d8[_0xd50a('0x118')])?'x':'i';}var _0x5a8525=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x3037d8[_0xd50a('0xda')]);if(!_0x5a8525){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x3037d8,'no\x20variable\x20found');}this[_0xd50a('0xe')]['setVariable'](_0x5a8525,_0x31b547);if(this[_0xd50a('0x85')](_0x3037d8[_0xd50a('0x119')])){var _0x22d077=parseInt(_0x3037d8[_0xd50a('0x119')],0xa);var _0x4292d8=rs[_0xd50a('0x11a')]({'charset':'*','length':_0x22d077});var _0x2364a=_0x31b547[_0xd50a('0x9b')];if(_0x2364a>0x0){if(_0x2364a>_0x22d077){this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x3037d8,_0x3037d8[_0xd50a('0x11b')]===_0xd50a('0x11c')?_0x4292d8+_0x31b547[_0xd50a('0x11d')](_0x22d077):_0x31b547[_0xd50a('0x11d')](0x0,_0x2364a-_0x22d077)+_0x4292d8);}else{this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x3037d8,rs[_0xd50a('0x11a')]({'charset':'*','length':_0x2364a}));}}else{this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x3037d8,'');}}else{this['createSquareDetailsReport'][_0xd50a('0xa4')](this,_0x3037d8,_0x31b547);}return _0x155eb5;};AGIVertices['prototype'][_0xd50a('0xd')]=function(_0x5bb8c4){logger['info'](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5bb8c4['label']));return this[_0xd50a('0xc')](_0x5bb8c4);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x11e')]=function(_0x31f9c6){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x11f'),_0x31f9c6[_0xd50a('0x39')]));this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x31f9c6,_0x31f9c6[_0xd50a('0x120')]);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x121'),_0x31f9c6[_0xd50a('0x120')]));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x122')]=function(_0x5b3bf8){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x123'),_0x5b3bf8[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x5b3bf8[_0xd50a('0x88')])||!this[_0xd50a('0x85')](_0x5b3bf8[_0xd50a('0x124')])){return this['channel'][_0xd50a('0xa8')](_0xd50a('0x125'));}if(!this[_0xd50a('0x85')](_0x5b3bf8['text'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20text\x20configured');}this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format'](_0xd50a('0x126'),_0x5b3bf8['text']));var _0x26bf61=this[_0xd50a('0x87')][_0xd50a('0xa4')](this,_0x5b3bf8);if(_0x26bf61){this['channel'][_0xd50a('0xa8')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x26bf61));var _0x28c5d9=this[_0xd50a('0xe')][_0xd50a('0x104')](_0x26bf61);try{fs[_0xd50a('0x105')](_0x26bf61+_0xd50a('0x106'));}catch(_0x236956){logger['error'](_0x236956);}return _0x28c5d9;}return this[_0xd50a('0xe')]['error'](_0x5b3bf8,_0xd50a('0x127'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x128')]=function(_0x5bedd2){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x129'),_0x5bedd2['label']));if(!this[_0xd50a('0x85')](_0x5bedd2[_0xd50a('0x88')])||!this[_0xd50a('0x85')](_0x5bedd2[_0xd50a('0x124')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x125'));}if(!this[_0xd50a('0x85')](_0x5bedd2[_0xd50a('0x8c')])){return this['channel']['noop'](_0xd50a('0x12a'));}if(!this['isConfigured'](_0x5bedd2[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}this[_0xd50a('0xe')][_0xd50a('0xf4')]=!![];this[_0xd50a('0x37')](_0x5bedd2);this[_0xd50a('0x43')](_0x5bedd2[_0xd50a('0x5d')],'in','','');this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0x12b'),_0x5bedd2[_0xd50a('0x5d')]));var _0x4aec3e=this['awsLex'][_0xd50a('0xa4')](this,_0x5bedd2);if(_0x4aec3e){for(var _0x475214 in _0x4aec3e){if(_0x4aec3e[_0xd50a('0x93')](_0x475214)&&_[_0xd50a('0x94')](_0x4aec3e[_0x475214])){this[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')](_0xd50a('0x12c'),_0x475214[_0xd50a('0xec')]()),_0x4aec3e[_0x475214]);}}if(_[_0xd50a('0x47')](_0x4aec3e[_0xd50a('0x77')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x12d'));}else{this['createSquareMessage'](_0x4aec3e[_0xd50a('0x77')],'out',_0xd50a('0x12e'),'');return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x4aec3e[_0xd50a('0x77')]));}}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x5bedd2,_0xd50a('0x12f'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x130')]=function(_0x26a041){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x131'),_0x26a041['label'],_0x26a041['timeout']));if(!this[_0xd50a('0x85')](_0x26a041[_0xd50a('0x7a')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xeb'));}var _0x6fca59=_0xd50a('0x132');var _0x45e018=util['format'](_0xd50a('0x133'),FILES_PATH,rs[_0xd50a('0x11a')](0x4));var _0x5f549b=util[_0xd50a('0x29')](_0xd50a('0x9c'),_0x45e018,_0x6fca59);var _0x4194d7=!![];if(_0x26a041[_0xd50a('0x134')]===_0xd50a('0x135')){_0x4194d7=![];}var _0x277702=this[_0xd50a('0xe')][_0xd50a('0x136')](_0x45e018,_0x6fca59,_0x26a041['intKey'],_0x26a041['timeout'],undefined,_0x4194d7);if(_0x277702[_0xd50a('0xac')]!==-0x1){this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x137'),_0x5f549b));var _0x33ffe6=this[_0xd50a('0x8d')][_0xd50a('0xa4')](this,_0x26a041,_0x5f549b);if(_0x33ffe6){for(var _0x5c558b in _0x33ffe6){if(_0x33ffe6[_0xd50a('0x93')](_0x5c558b)){this['channel'][_0xd50a('0x9d')](util[_0xd50a('0x29')]('GOOGLE_ASR_%s',_0x5c558b[_0xd50a('0xec')]()),_0x33ffe6[_0x5c558b]);}}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x138'),JSON[_0xd50a('0x73')](_0x33ffe6)));}}return _0x277702;};AGIVertices['prototype'][_0xd50a('0x139')]=function(_0xdcaad0){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x13a'),_0xdcaad0[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0xdcaad0[_0xd50a('0x90')])){return this['channel'][_0xd50a('0xa8')]('no\x20appid\x20configured');}if(!this[_0xd50a('0x85')](_0xdcaad0[_0xd50a('0x13b')])){return this['channel'][_0xd50a('0xa8')]('no\x20appsecret\x20configured');}var _0x46c5f3=_0xd50a('0x132');var _0x1827bc=util[_0xd50a('0x29')](_0xd50a('0x133'),FILES_PATH,rs['generate'](0x4));var _0x8806e8=util['format'](_0xd50a('0x9c'),_0x1827bc,_0x46c5f3);var _0x57be8c=!![];if(_0xdcaad0[_0xd50a('0x134')]===_0xd50a('0x135')){_0x57be8c=![];}var _0xc7f232=this[_0xd50a('0xe')][_0xd50a('0x136')](_0x1827bc,_0x46c5f3,_0xdcaad0['intKey'],_0xdcaad0[_0xd50a('0x65')],undefined,_0x57be8c);if(_0xc7f232[_0xd50a('0xac')]!==-0x1){this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x13c'),_0x8806e8));var _0x47a2e5=this[_0xd50a('0x8f')]['sync'](this,_0xdcaad0,_0x8806e8);if(_0x47a2e5){for(var _0x19866a in _0x47a2e5){if(_0x47a2e5[_0xd50a('0x93')](_0x19866a)){this[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')](_0xd50a('0x13d'),_0x19866a[_0xd50a('0xec')]()),_0x47a2e5[_0x19866a]);}}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x47a2e5)));}}return _0xc7f232;};AGIVertices[_0xd50a('0x18')][_0xd50a('0x13e')]=function(_0x4c2394){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x13f'),_0x4c2394[_0xd50a('0x39')]));return this['channel'][_0xd50a('0x140')](_0x4c2394[_0xd50a('0x3f')],_0x4c2394[_0xd50a('0x40')],_0x4c2394[_0xd50a('0x41')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x141')]=function(_0x10af47){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x10af47['label']));if(!this[_0xd50a('0x85')](_0x10af47['condition'])){return this['channel'][_0xd50a('0x2c')](_0x10af47,_0xd50a('0x142'));}try{var _0x211e20=eval(_0x10af47[_0xd50a('0x143')])?'true':_0xd50a('0x144');this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x145'),_0x10af47[_0xd50a('0x143')],_0x211e20));return{'code':0xc8,'result':_0x211e20};}catch(_0xb57330){return{'code':0xc8,'result':_0xd50a('0x144')};}};AGIVertices['prototype'][_0xd50a('0x146')]=function(_0x590c51){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x590c51['label']));if(!this['isConfigured'](_0x590c51[_0xd50a('0x147')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x590c51,'no\x20interval\x20configured');}var _0x16b136=this[_0xd50a('0x26')][_0xd50a('0xa4')](this,_0x590c51[_0xd50a('0x147')]);if(!_0x16b136){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x590c51,_0xd50a('0x148'));}for(var _0x4e7428=0x0;_0x4e7428<_0x16b136['length'];_0x4e7428+=0x1){var _0xf5fdbe=this[_0xd50a('0xe')][_0xd50a('0x11')](util[_0xd50a('0x29')](_0xd50a('0x149'),_0x16b136[_0x4e7428]));if(_0xf5fdbe[_0xd50a('0xac')]===-0x1){return _0xf5fdbe;}logger['info'](util[_0xd50a('0x29')](_0xd50a('0x14a'),_0x16b136[_0x4e7428],_0xf5fdbe[_0xd50a('0xa0')]));if(_0xf5fdbe['extra']==='true'){logger[_0xd50a('0x2e')](util['format']('IFTIME\x20%s\x20%s',_0x16b136[_0x4e7428],'true'));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x14a'),_0x16b136[_0x4e7428],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x14a'),_0x16b136[_0x4e7428],_0xd50a('0x144')));this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0x14a'),_0x16b136[_0x4e7428],_0xd50a('0x144')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xd50a('0x18')][_0xd50a('0x14b')]=function(_0x85cb5f){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x14c'),_0x85cb5f['label']));return this[_0xd50a('0xe')]['hangup']();};AGIVertices['prototype'][_0xd50a('0x14d')]=function(_0x2309b5){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x2309b5[_0xd50a('0x39')]));if(!this['isConfigured'](_0x2309b5['key'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xeb'));}var _0x54b6f0=_0xd50a('0x132');var _0x8cd501=util['format'](_0xd50a('0x133'),FILES_PATH,rs[_0xd50a('0x11a')](0x4));var _0x4bef1d=util['format'](_0xd50a('0x9c'),_0x8cd501,_0x54b6f0);var _0x50b506=!![];if(_0x2309b5[_0xd50a('0x134')]===_0xd50a('0x135')){_0x50b506=![];}var _0x4e69ee=this[_0xd50a('0xe')][_0xd50a('0x136')](_0x8cd501,_0x54b6f0,_0x2309b5['intKey'],_0x2309b5['timeout'],undefined,_0x50b506);if(_0x4e69ee[_0xd50a('0xac')]!==-0x1){this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x14e'),_0x4bef1d));var _0x3fdef5=this['ispeechASR'][_0xd50a('0xa4')](this,_0x2309b5,_0x4bef1d);if(_0x3fdef5){for(var _0x4a22d3 in _0x3fdef5){if(_0x3fdef5['hasOwnProperty'](_0x4a22d3)){this[_0xd50a('0xe')]['setVariable'](util[_0xd50a('0x29')](_0xd50a('0x14f'),_0x4a22d3[_0xd50a('0xec')]()),_0x3fdef5[_0x4a22d3]);}}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x150'),JSON[_0xd50a('0x73')](_0x3fdef5)));}}return _0x4e69ee;};AGIVertices[_0xd50a('0x18')]['ispeechtts']=function(_0x5e6382){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x151'),_0x5e6382['label']));if(!this['isConfigured'](_0x5e6382[_0xd50a('0x7a')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xeb'));}if(!this['isConfigured'](_0x5e6382[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x152'),_0x5e6382[_0xd50a('0x5d')]));var _0x1d3a74=this['ispeechTTS']['sync'](this,_0x5e6382);if(_0x1d3a74){this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0x14e'),_0x1d3a74));var _0x7a6dc8=this[_0xd50a('0xe')][_0xd50a('0x104')](_0x1d3a74,_0x5e6382[_0xd50a('0x153')]);try{fs[_0xd50a('0x105')](_0x1d3a74+_0xd50a('0x106'));}catch(_0x1936b0){logger[_0xd50a('0x2c')](_0x1936b0);}return _0x7a6dc8;}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x5e6382,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd50a('0x18')][_0xd50a('0x154')]=function(_0x526a94){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x155'),_0x526a94[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x526a94[_0xd50a('0x156')])){return this[_0xd50a('0xe')]['error'](_0x526a94,_0xd50a('0x157'));}logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x158'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x526a94['findBy']));var _0x1c6747=this[_0xd50a('0x54')][_0xd50a('0xa4')](this,_0x526a94[_0xd50a('0x156')]);if(_0x1c6747){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd50a('0xe')]['callerid'],_0x526a94[_0xd50a('0x156')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x159'),this['channel'][_0xd50a('0x3d')],_0x526a94[_0xd50a('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x15a'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x526a94[_0xd50a('0x156')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format'](_0xd50a('0x15a'),this['channel']['callerid'],_0x526a94[_0xd50a('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd50a('0x18')]['logout']=function(_0x4d0912){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x15b'),_0x4d0912[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x4d0912['findBy'])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x4d0912,'no\x20find\x20by\x20configured');}logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x158'),this['channel']['callerid'],_0x4d0912[_0xd50a('0x156')]));var _0x46f31f=this['agentLogout'][_0xd50a('0xa4')](this,_0x4d0912[_0xd50a('0x156')]);if(_0x46f31f){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x4d0912[_0xd50a('0x156')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x4d0912[_0xd50a('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd50a('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xd50a('0x3d')],_0x4d0912[_0xd50a('0x156')]));this['channel'][_0xd50a('0xa8')](util['format'](_0xd50a('0x15a'),this[_0xd50a('0xe')]['callerid'],_0x4d0912[_0xd50a('0x156')]));return{'code':0xc8,'result':_0xd50a('0x15c')};}};AGIVertices[_0xd50a('0x18')]['math']=function(_0x57d4a8){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x15d'),_0x57d4a8[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x57d4a8[_0xd50a('0x15e')])){return this[_0xd50a('0xe')]['error'](_0x57d4a8,_0xd50a('0x15f'));}this['channel']['noop'](util['format']('math\x20%s',_0x57d4a8[_0xd50a('0x15e')]));var _0x3ba381=eval(_0x57d4a8['operation']);if(!this[_0xd50a('0x85')](_0x57d4a8[_0xd50a('0xda')])){return this['channel']['noop'](_0xd50a('0xd9'));}var _0x226150=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x57d4a8[_0xd50a('0xda')]);if(!_0x226150){return this['channel'][_0xd50a('0x2c')](_0x57d4a8,_0xd50a('0xdb'));}if(_[_0xd50a('0x99')](_0x3ba381)){var _0x9935b=this;_0x3ba381[_0xd50a('0xdc')](function(_0x529cd9,_0x392373){_0x9935b[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')](_0xd50a('0x160'),_0x226150,_0x392373),_0x529cd9);});return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x161'),_0x226150));}else{return this[_0xd50a('0xe')][_0xd50a('0x9d')](_0x226150,_0x3ba381);}};AGIVertices[_0xd50a('0x18')]['menu']=function(_0x3b81fb){logger['info'](util['format'](_0xd50a('0x162'),_0x3b81fb[_0xd50a('0x39')]));if(_0x3b81fb[_0xd50a('0xa5')]===0x0){return this[_0xd50a('0xa3')](_0x3b81fb);}_0x3b81fb[_0xd50a('0xa5')]-=0x1;if(!this[_0xd50a('0x85')](_0x3b81fb[_0xd50a('0x111')])){return this['channel']['error'](_0x3b81fb,_0xd50a('0x112'));}var _0x4aa54e=this[_0xd50a('0x1f')][_0xd50a('0xa4')](this,_0x3b81fb[_0xd50a('0x111')]);if(!_0x4aa54e){return this[_0xd50a('0xe')]['error'](_0x3b81fb,'no\x20file\x20audio\x20found');}var _0x12b5ed=this[_0xd50a('0xe')][_0xd50a('0x114')](_0x4aa54e,_0x3b81fb[_0xd50a('0x115')],_0x3b81fb[_0xd50a('0x163')]);var _0x5e7fd5=_0x12b5ed[_0xd50a('0xac')];if(_0x12b5ed['result']===-0x1){this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x3b81fb,'-1');return _0x12b5ed;}else if(_0x12b5ed['extra']===_0xd50a('0x65')){_0x12b5ed[_0xd50a('0xac')]=_0x12b5ed[_0xd50a('0xac')][_0xd50a('0x9b')]>0x0?_0x12b5ed[_0xd50a('0xac')]:'t';}else if(_[_0xd50a('0x46')](_0x12b5ed[_0xd50a('0xac')])){_0x12b5ed[_0xd50a('0xac')]='#';_0x5e7fd5='#';}if(!this[_0xd50a('0x85')](_0x3b81fb[_0xd50a('0xda')])){this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x25a630=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x3b81fb[_0xd50a('0xda')]);if(!_0x25a630){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x3b81fb,_0xd50a('0xdb'));}this[_0xd50a('0xe')][_0xd50a('0x9d')](_0x25a630,_0x5e7fd5);}this['createSquareDetailsReport'][_0xd50a('0xa4')](this,_0x3b81fb,_0x5e7fd5);return _0x12b5ed;};AGIVertices[_0xd50a('0x18')]['noop']=function(_0x12d731){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x164'),_0x12d731[_0xd50a('0x39')]));return this[_0xd50a('0xe')]['noop'](_0x12d731[_0xd50a('0x165')]||_0x12d731[_0xd50a('0x39')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x166')]=function(_0x24640b){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x167'),_0x24640b[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x24640b[_0xd50a('0x156')])){return this['channel'][_0xd50a('0x2c')](_0x24640b,_0xd50a('0x157'));}logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x158'),this['channel']['callerid'],_0x24640b[_0xd50a('0x156')]));var _0x839a32=this[_0xd50a('0x4e')][_0xd50a('0xa4')](this,_0x24640b[_0xd50a('0x168')]);var _0x8a96de=this['agentPause'][_0xd50a('0xa4')](this,_0x24640b[_0xd50a('0x156')],_0x839a32);if(_0x8a96de){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x159'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x24640b['findBy']));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x24640b[_0xd50a('0x156')]));return{'code':0xc8,'result':_0xd50a('0x169')};}else{logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x15a'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x24640b[_0xd50a('0x156')]));this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')]['callerid'],_0x24640b[_0xd50a('0x156')]));return{'code':0xc8,'result':_0xd50a('0x15c')};}};AGIVertices['prototype'][_0xd50a('0x16a')]=function(_0x4549ad){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x16b'),_0x4549ad['label']));if(!this[_0xd50a('0x85')](_0x4549ad['file_id'])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x4549ad,_0xd50a('0x112'));}var _0x928cef=this[_0xd50a('0x1f')][_0xd50a('0xa4')](this,_0x4549ad[_0xd50a('0x111')]);if(!_0x928cef){return this['channel'][_0xd50a('0x2c')](_0x4549ad,_0xd50a('0x113'));}var _0x4fbc9b=this['channel']['exec'](_0xd50a('0x16c'),[_0x928cef,_0x4549ad[_0xd50a('0xe7')]]);if(_0x4fbc9b[_0xd50a('0xac')]===-0x1){return _0x4fbc9b;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Executed\x20command\x20%s\x20%s',_0xd50a('0x16c'),_0x928cef));};AGIVertices[_0xd50a('0x18')]['queue']=function(_0x2f99c5){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x16d'),_0x2f99c5[_0xd50a('0x39')]));if(!this['isConfigured'](_0x2f99c5['queue_id'])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x2f99c5,_0xd50a('0x16e'));}var _0x53b77c='';var _0x15ec99=parseInt(_0x2f99c5[_0xd50a('0x16f')],0xa);if(isNaN(_0x15ec99)){_0x53b77c=_0x2f99c5[_0xd50a('0x16f')];}else{_0x53b77c=this[_0xd50a('0x14')][_0xd50a('0xa4')](this,_0x2f99c5[_0xd50a('0x16f')]);if(!_0x53b77c){return this[_0xd50a('0xe')]['error'](_0x2f99c5,_0xd50a('0x170'));}}var _0x426a25='';if(this['isConfigured'](_0x2f99c5[_0xd50a('0x111')])){var _0x329288=this[_0xd50a('0x1f')][_0xd50a('0xa4')](this,_0x2f99c5['file_id']);if(_0x329288){_0x426a25=_0x329288;}}this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x2f99c5,_0x53b77c);if(_0x2f99c5[_0xd50a('0xe7')]['indexOf']('x')<0x0){_0x2f99c5[_0xd50a('0xe7')]+='x';}if(_0x2f99c5['opts']['indexOf']('X')<0x0){_0x2f99c5['opts']+='X';}this['channel'][_0xd50a('0x9d')](_0xd50a('0x171'),_0x53b77c?_0x53b77c[_0xd50a('0x172')]():'');var _0x4d9107=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0x173'),[_0x53b77c,_0x2f99c5[_0xd50a('0xe7')],_0x2f99c5['url'],_0x426a25,_0x2f99c5[_0xd50a('0x65')],_0x2f99c5[_0xd50a('0xb4')],_0x2f99c5[_0xd50a('0x174')],_0x2f99c5[_0xd50a('0x175')],'',_0x2f99c5[_0xd50a('0x176')]]);if(_0x4d9107['result']===-0x1){return _0x4d9107;}return this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0xc2'),_0xd50a('0x173'),_0x53b77c));};AGIVertices[_0xd50a('0x18')]['record']=function(_0x12d7a0){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x177'),_0x12d7a0[_0xd50a('0x39')]));var _0x5616a2=_0x12d7a0[_0xd50a('0x178')]||_0xd50a('0x132');var _0x52f7f5=util[_0xd50a('0x29')]('%s_%s',this[_0xd50a('0xe')][_0xd50a('0x38')],rs[_0xd50a('0x11a')](0x5));var _0x2d541b=util[_0xd50a('0x29')](_0xd50a('0x179'),FILES_PATH,_0x52f7f5,_0x5616a2);var _0x4481f5=util[_0xd50a('0x29')]('%s/recordings/%s',FILES_PATH,_0x52f7f5);this[_0xd50a('0x3c')]['sync'](this,_0x12d7a0,_0x52f7f5,_0x2d541b);this['channel'][_0xd50a('0x9d')](_0xd50a('0x17a'),_0x52f7f5);logger[_0xd50a('0x2e')](_0xd50a('0x17b'),_0x4481f5,_0x5616a2,_0x12d7a0[_0xd50a('0x17c')],_0x12d7a0[_0xd50a('0x65')]);return this[_0xd50a('0xe')][_0xd50a('0x136')](_0x4481f5,_0x5616a2,_0x12d7a0[_0xd50a('0x17c')],_0x12d7a0[_0xd50a('0x65')],undefined,!![]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x17d')]=function(_0x2fd116){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x17e'),_0x2fd116[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x2fd116['url'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x17f'));}var _0x4187fb=this['restAPI']['sync'](this,_0x2fd116);logger['info'](util[_0xd50a('0x29')](_0xd50a('0x180'),util[_0xd50a('0x181')](_0x4187fb,{'showHidden':![],'depth':null})));if(!this[_0xd50a('0x85')](_0x2fd116[_0xd50a('0xda')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x182'));}var _0x257c32=this['getVariable']['sync'](this,_0x2fd116['variable_id']);if(!_0x257c32){return this[_0xd50a('0xe')]['error'](_0x2fd116,_0xd50a('0xdb'));}this[_0xd50a('0xe')]['setVariable'](util[_0xd50a('0x29')](_0xd50a('0x183'),_0x257c32),_0x4187fb['statusCode']?_0x4187fb[_0xd50a('0x75')]:_0xd50a('0x184'));this[_0xd50a('0xe')][_0xd50a('0x9d')](util['format'](_0xd50a('0x185'),_0x257c32),_0x4187fb[_0xd50a('0x76')]?_0x4187fb[_0xd50a('0x76')]:'OK');if(_0x4187fb[_0xd50a('0x6a')]){try{this[_0xd50a('0x9a')](_0x4187fb[_0xd50a('0x6a')],_0x257c32);}catch(_0x168174){logger[_0xd50a('0x2c')](util[_0xd50a('0x29')](_0xd50a('0x186'),_0x257c32));}}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xde'),_0x257c32));};AGIVertices[_0xd50a('0x18')]['saydigits']=function(_0x5535d0){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x187'),_0x5535d0[_0xd50a('0x39')]));return this['channel'][_0xd50a('0x188')](_0x5535d0[_0xd50a('0x189')][_0xd50a('0x59')](/\s+/g,''),_0x5535d0[_0xd50a('0x17c')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x18a')]=function(_0x498110){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x498110[_0xd50a('0x39')]));return this['channel'][_0xd50a('0x18b')](_0x498110[_0xd50a('0x66')][_0xd50a('0x59')](/\s+/g,''),_0x498110[_0xd50a('0x17c')]);};AGIVertices['prototype'][_0xd50a('0x18c')]=function(_0x2d1d6b){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x18d'),_0x2d1d6b[_0xd50a('0x39')]));return this[_0xd50a('0xe')][_0xd50a('0x18e')](_0x2d1d6b[_0xd50a('0x5d')],_0x2d1d6b[_0xd50a('0x17c')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x18f')]=function(_0x2a3b48){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x190'),_0x2a3b48['label']));if(!this[_0xd50a('0x85')](_0x2a3b48[_0xd50a('0x191')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x192'));}var _0x520827=this[_0xd50a('0x23')]['sync'](this,_0x2a3b48['account_id']);if(!_0x520827||!_0x520827[_0xd50a('0x193')]){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x2a3b48,_0xd50a('0x194'));}var _0x35fb94={'from':util[_0xd50a('0x29')](_0xd50a('0x195'),_0x520827['name'],_0x520827[_0xd50a('0x196')]||_0x520827[_0xd50a('0x193')][_0xd50a('0x197')]),'to':_0x2a3b48['to']||'','cc':_0x2a3b48['cc']||'','bcc':_0x2a3b48[_0xd50a('0x198')]||'','subject':_0x2a3b48[_0xd50a('0x199')],'html':_0x2a3b48[_0xd50a('0x5d')],'text':_0x2a3b48[_0xd50a('0x5d')]};var _0x7d1ab7={'tls':{'rejectUnauthorized':![]}};if(_0x520827['Smtp']['service']){_0x7d1ab7[_0xd50a('0x19a')]=_0x520827[_0xd50a('0x193')][_0xd50a('0x19a')];}else{_0x7d1ab7[_0xd50a('0x19b')]=_0x520827[_0xd50a('0x193')][_0xd50a('0x19b')];_0x7d1ab7[_0xd50a('0x19c')]=_0x520827[_0xd50a('0x193')]['port'];_0x7d1ab7[_0xd50a('0x19d')]=_0x520827[_0xd50a('0x193')][_0xd50a('0x19d')];}if(_0x520827[_0xd50a('0x193')][_0xd50a('0x19e')]){_0x7d1ab7[_0xd50a('0x19f')]={'user':_0x520827[_0xd50a('0x193')]['user'],'pass':_0x520827[_0xd50a('0x193')][_0xd50a('0x1a0')]};}if(this[_0xd50a('0x85')](_0x2a3b48[_0xd50a('0x1a1')])){}logger[_0xd50a('0xe0')](_0xd50a('0x1a2'),JSON[_0xd50a('0x73')](_0x35fb94));this[_0xd50a('0x37')]['sync'](this,_0x2a3b48,_0x2a3b48['account_id']);this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x1a3'),_0x520827[_0xd50a('0x15')]));this['sendMailMessage']['sync'](this,_0x7d1ab7,_0x35fb94);return this[_0xd50a('0xe')]['noop'](_0xd50a('0x1a4'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1a5')]=function(_0x441866){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1a6'),_0x441866['label']));return this[_0xd50a('0xe')]['noop'](_0xd50a('0x1a7'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1a8')]=function(_0x3af29d){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x1a9'),_0x3af29d[_0xd50a('0x39')]));if(!this['isConfigured'](_0x3af29d['sms_account_id'])){return this['channel'][_0xd50a('0xa8')](_0xd50a('0x1aa'));}var _0x3a8cd3=this[_0xd50a('0x34')][_0xd50a('0xa4')](this,_0x3af29d[_0xd50a('0x1ab')]);if(!_0x3a8cd3){return this['channel'][_0xd50a('0x2c')](_0x3af29d,_0xd50a('0x1ac'));}var _0xcf35d={'body':_0x3af29d['sms_text'],'phone':_0x3af29d['to']||'','SmsAccountId':_0x3a8cd3['id']};logger[_0xd50a('0xe0')](_0xd50a('0x1ad'),JSON[_0xd50a('0x73')](_0xcf35d));this['createSquareDetailsReport'][_0xd50a('0xa4')](this,_0x3af29d,_0x3af29d[_0xd50a('0x1ab')]);this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x1ae'),_0x3a8cd3['name']));this['createSmsMessage'][_0xd50a('0xa4')](this,_0xcf35d);return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x1af'));};AGIVertices[_0xd50a('0x18')]['set']=function(_0x142913){logger['info'](util['format'](_0xd50a('0x1b0'),_0x142913[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x142913[_0xd50a('0xda')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x142913,'no\x20variable\x20selected');}var _0x3dd784=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x142913['variable_id']);if(!_0x3dd784){return this[_0xd50a('0xe')]['error'](_0x142913,_0xd50a('0xdb'));}return this[_0xd50a('0xe')][_0xd50a('0x9d')](_0x3dd784,_0x142913[_0xd50a('0x1b1')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1b2')]=function(_0x2d5bf7){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1b3'),_0x2d5bf7[_0xd50a('0x39')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x1b4'));if(_0x2d5bf7['answer']===_0xd50a('0x1b5')){this['channel']['noop']('Answer');return this[_0xd50a('0xe')][_0xd50a('0xb9')]();}return this[_0xd50a('0xe')][_0xd50a('0xa8')]('Skipped\x20Answer');};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1b6')]=function(_0x191917){logger['info'](util['format'](_0xd50a('0x1b7'),_0x191917['label']));if(!this['isConfigured'](_0x191917[_0xd50a('0x1b8')])){return this['channel']['error'](_0x191917,_0xd50a('0x1b9'));}var _0x55d0d8=this['getSquareProject'][_0xd50a('0xa4')](this,_0x191917[_0xd50a('0x1b8')]);if(!this[_0xd50a('0x85')](_0x55d0d8)){return this['channel'][_0xd50a('0x2c')](_0x191917,util[_0xd50a('0x29')](_0xd50a('0x1ba'),_0x191917['project_id']));}if(_0x55d0d8===this[_0xd50a('0xe')][_0xd50a('0x3b')]){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x191917,_0xd50a('0x1bb'));}this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x191917,_0x55d0d8);var _0x4785e3=this['channel'][_0xd50a('0x57')](_0xd50a('0x1bc'),util['format'](_0xd50a('0x1bd'),config['agi'][_0xd50a('0x19b')]||'127.0.0.1',_0x55d0d8,this[_0xd50a('0xe')]['arg_1']));if(_0x4785e3[_0xd50a('0xac')]===-0x1){return _0x4785e3;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Executed\x20command\x20%s\x20%s',_0xd50a('0x1bc'),_0x55d0d8));};AGIVertices['prototype']['system']=function(_0x2bb7fb){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1be'),_0x2bb7fb[_0xd50a('0x39')]));var _0x52ecf1=this[_0xd50a('0x56')][_0xd50a('0xa4')](this,_0x2bb7fb[_0xd50a('0xb5')]);this[_0xd50a('0x37')]['sync'](this,_0x2bb7fb,_0x2bb7fb[_0xd50a('0xb5')]);if(this[_0xd50a('0x85')](_0x2bb7fb[_0xd50a('0xda')])){var _0x5075c4=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x2bb7fb[_0xd50a('0xda')]);if(_0x5075c4){this[_0xd50a('0xe')]['setVariable'](_0x5075c4,_0x52ecf1);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2bb7fb[_0xd50a('0xb5')],_0x5075c4));}}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x1bf'),_0x2bb7fb['command']));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1c0')]=function(_0x107d1f){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1c1'),_0x107d1f[_0xd50a('0x39')]));_0x107d1f['text']=_0x107d1f[_0xd50a('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x107d1f[_0xd50a('0x5b')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20apiKey\x20configured');}if(!this[_0xd50a('0x85')](_0x107d1f[_0xd50a('0x5d')])){return this[_0xd50a('0xe')]['noop']('no\x20text\x20configured');}this['channel'][_0xd50a('0xa8')](util['format'](_0xd50a('0x1c2'),_0x107d1f['text']));var _0x23c341=this['googleCloudTTS'][_0xd50a('0xa4')](this,_0x107d1f);if(_0x23c341){this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x23c341));var _0x42a6a8=this[_0xd50a('0xe')][_0xd50a('0x104')](_0x23c341);try{fs[_0xd50a('0x105')](_0x23c341+_0xd50a('0x106'));}catch(_0x2e72f4){logger[_0xd50a('0x2c')](_0x2e72f4);}return _0x42a6a8;}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x107d1f,_0xd50a('0x1c3'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1c4')]=function(_0x46d807){logger['info'](util[_0xd50a('0x29')](_0xd50a('0x1c5'),_0x46d807['label']));_0x46d807[_0xd50a('0x5d')]=_0x46d807[_0xd50a('0x5d')][_0xd50a('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd50a('0x85')](_0x46d807[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x1c6'),_0x46d807[_0xd50a('0x5d')]));var _0x13fb81=this['googleTTS']['sync'](this,_0x46d807);if(_0x13fb81){this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Google\x20TTS\x20%s\x20file\x20created',_0x13fb81));var _0xcc45f6=this[_0xd50a('0xe')]['streamFile'](_0x13fb81);try{}catch(_0x227ed8){logger['error'](_0x227ed8);}return _0xcc45f6;}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x46d807,_0xd50a('0x1c7'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1c8')]=function(_0x5d4929){logger['info'](util[_0xd50a('0x29')](_0xd50a('0x1c9'),_0x5d4929[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x5d4929[_0xd50a('0x156')])){return this[_0xd50a('0xe')]['error'](_0x5d4929,'no\x20find\x20by\x20configured');}logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x158'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x5d4929[_0xd50a('0x156')]));var _0x383d7e=this[_0xd50a('0x52')]['sync'](this,_0x5d4929[_0xd50a('0x156')]);if(_0x383d7e){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')]['callerid'],_0x5d4929['findBy']));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')]['callerid'],_0x5d4929[_0xd50a('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x15a'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x5d4929[_0xd50a('0x156')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x5d4929[_0xd50a('0x156')]));return{'code':0xc8,'result':_0xd50a('0x15c')};}};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1ca')]=function(_0x25584f){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x25584f['label']));var _0x157d01=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0x1cb'),[_0x25584f[_0xd50a('0x1cc')],_0x25584f[_0xd50a('0xaa')]]);if(_0x157d01[_0xd50a('0xac')]===-0x1){return _0x157d01;}return this['channel'][_0xd50a('0xa8')](util['format'](_0xd50a('0xc2'),_0xd50a('0x1cb'),_0x25584f[_0xd50a('0x1cc')]));};AGIVertices[_0xd50a('0x18')]['vswitch']=function(_0x43002a){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1cd'),_0x43002a[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x43002a[_0xd50a('0xda')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x43002a,_0xd50a('0x1ce'));}var _0x37ad58=this[_0xd50a('0x11')]['sync'](this,_0x43002a[_0xd50a('0xda')]);if(!_0x37ad58){return this['channel'][_0xd50a('0x2c')](_0x43002a,_0xd50a('0xdb'));}var _0x2fc51a=this[_0xd50a('0xe')]['getVariable'](_0x37ad58);return{'code':0xc8,'result':_0x2fc51a[_0xd50a('0xa0')]?_0x2fc51a[_0xd50a('0xa0')]:'-'};};String[_0xd50a('0x18')][_0xd50a('0x9f')]=function(_0x5bb11a,_0x17ab4d){return this[_0xd50a('0x9e')](_0x5bb11a)['join'](_0x17ab4d);};module[_0xd50a('0x1cf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index be6d0ee..5ccd6f0 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33c5=['Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0x33c5,0xe6));var _0x533c=function(_0x390556,_0x5b64bd){_0x390556=_0x390556-0x0;var _0x11868e=_0x33c5[_0x390556];return _0x11868e;};'use strict';var util=require('util');var _=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var ami=require('../ami');var logger=require(_0x533c('0x2'))(_0x533c('0x3'));var RpcUser=require(_0x533c('0x4'));var RpcVoiceAgentReport=require(_0x533c('0x5'));function Acw(_0x358127){this['voiceQueues']=_0x358127[_0x533c('0x6')];this[_0x533c('0x7')]=_0x358127[_0x533c('0x7')];this[_0x533c('0x8')]=_0x358127[_0x533c('0x8')];this[_0x533c('0x9')]={};ami['on'](_0x533c('0xa'),this[_0x533c('0xb')][_0x533c('0xc')](this));ami['on'](_0x533c('0xd'),this[_0x533c('0xe')][_0x533c('0xc')](this));ami['on'](_0x533c('0xf'),this[_0x533c('0x10')][_0x533c('0xc')](this));ami['on'](_0x533c('0x11'),this['syncAgentRingNoAnswer'][_0x533c('0xc')](this));ami['on'](_0x533c('0x12'),this[_0x533c('0x13')][_0x533c('0xc')](this));ami['on'](_0x533c('0x14'),this[_0x533c('0x15')]['bind'](this));ami['on'](_0x533c('0x16'),this[_0x533c('0x17')][_0x533c('0xc')](this));}function getDiff(_0x12ecae){var _0x2d5bc8=moment()[_0x533c('0x18')](0x0);var _0x8d7c66=moment(_0x12ecae)[_0x533c('0x18')](0x0);return _0x2d5bc8['diff'](_0x8d7c66,_0x533c('0x19'));}Acw[_0x533c('0x1a')][_0x533c('0x1b')]=function(_0x3e544f){try{var _0x56dfb7=this;var _0x1031e7=this[_0x533c('0x9')][_0x3e544f][_0x533c('0x1c')];var _0x311700=this[_0x533c('0x9')][_0x3e544f][_0x533c('0x1d')];var _0x1f0a72=this[_0x533c('0x6')][_0x311700];var _0x1f9f85=![];var _0x12e126=_0x533c('0x1e');if(_0x1f0a72[_0x533c('0x1f')]){if(_0x1f0a72[_0x533c('0x20')][_0x533c('0x21')]){_0x1f9f85=!![];_0x12e126=_0x1f0a72[_0x533c('0x20')][_0x533c('0x21')];}}ami[_0x533c('0x22')]({'action':_0x533c('0x23'),'interface':_0x1031e7,'paused':!![],'reason':_0x12e126})['then'](function(_0xce8d9){if(_0x56dfb7['agents'][_0x1031e7]){return RpcUser['getAgent'](_0x56dfb7[_0x533c('0x7')][_0x1031e7]['id'])[_0x533c('0x24')](function(_0x5f5090){if(_0x5f5090&&!_0x5f5090[_0x533c('0x25')]){logger[_0x533c('0x26')](_0x533c('0x27'),_0x3e544f,_0x1031e7,_0x311700);var _0x3dd249=_0x56dfb7['channels'][_0x3e544f][_0x533c('0x28')]&&_0x56dfb7[_0x533c('0x9')][_0x3e544f][_0x533c('0x29')]?_0x56dfb7[_0x533c('0x9')][_0x3e544f][_0x533c('0x29')]:_0x3e544f;return RpcUser[_0x533c('0x2a')](_0x56dfb7[_0x533c('0x7')][_0x1031e7],_0x12e126,_0x3dd249)[_0x533c('0x24')](function(_0xb1c937){if(!_0x1f9f85){_0x56dfb7[_0x533c('0x8')][_0x1031e7]={};logger['info'](_0x533c('0x2b'),_0x3e544f,_0x56dfb7[_0x533c('0x6')][_0x311700]['acwTimeout'],_0x1031e7,_0x311700);_0x56dfb7[_0x533c('0x8')][_0x1031e7]['timer']=setTimeout(_0x56dfb7[_0x533c('0x2c')][_0x533c('0xc')](_0x56dfb7,_0x1031e7),_0x56dfb7[_0x533c('0x6')][_0x311700][_0x533c('0x2d')]*0x3e8);_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x2e')]=moment()[_0x533c('0x2f')](_0x533c('0x30'));_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x31')]=_0x3e544f;_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x1d')]=_0x311700;_0x56dfb7['timers'][_0x1031e7][_0x533c('0x32')]=function(){var _0x591499=getDiff(_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x2e')]);clearTimeout(_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x33')]);_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x33')]=![];RpcVoiceAgentReport[_0x533c('0x34')]({'acwtime':_0x591499},_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x31')],_0x1031e7)[_0x533c('0x24')](function(_0x1bbcb7){logger[_0x533c('0x26')](_0x533c('0x35'),_0x3e544f,_0x591499,_0x1bbcb7);})[_0x533c('0x36')](function(_0x3803d0){logger['error'](_0x533c('0x37'),_0x3e544f,_0x3803d0);});delete _0x56dfb7[_0x533c('0x8')][_0x1031e7];};}});}else{logger[_0x533c('0x26')](_0x533c('0x38'),_0x3e544f,_0x1031e7,_0x311700);}});}})['catch'](function(_0x3f1db9){logger[_0x533c('0x39')](_0x533c('0x2b'),_0x3e544f,_0x56dfb7[_0x533c('0x6')][_0x311700][_0x533c('0x2d')],_0x1031e7,_0x311700);})['finally'](function(){delete _0x56dfb7['channels'][_0x3e544f];});}catch(_0x538bc0){logger['error']('[ACW][START]\x20%s',_0x538bc0[_0x533c('0x3a')]);}};Acw['prototype'][_0x533c('0x2c')]=function(_0x55726a){try{var _0x34243d=this;if(_0x34243d[_0x533c('0x8')][_0x55726a]){_0x34243d[_0x533c('0x8')][_0x55726a]['timer']=![];var _0x44a18d=_0x34243d[_0x533c('0x8')][_0x55726a][_0x533c('0x31')];var _0x55b010=_0x34243d[_0x533c('0x8')][_0x55726a][_0x533c('0x1d')];var _0x30e5eb=_0x34243d['voiceQueues'][_0x55b010][_0x533c('0x2d')];logger[_0x533c('0x26')](_0x533c('0x3b'),_0x55726a);RpcUser[_0x533c('0x3c')](this[_0x533c('0x7')][_0x55726a]);RpcVoiceAgentReport[_0x533c('0x34')]({'acwtime':_0x30e5eb,'agentacw':!![]},_0x44a18d,_0x55726a)[_0x533c('0x24')](function(_0x2dbd81){logger[_0x533c('0x26')](_0x533c('0x35'),_0x44a18d,_0x30e5eb,_0x2dbd81);})[_0x533c('0x36')](function(_0x55af6e){logger[_0x533c('0x39')](_0x533c('0x37'),_0x44a18d,_0x55af6e);});}else{logger[_0x533c('0x39')](_0x533c('0x3d'),_0x55726a);if(_0x34243d[_0x533c('0x8')]){logger[_0x533c('0x26')]('[ACW][TIMERS]',JSON[_0x533c('0x3e')](_0x34243d[_0x533c('0x8')]));}}}catch(_0x41f5a2){logger['error'](_0x533c('0x3f'),_0x41f5a2[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0xb')]=function(_0x502a67){try{if(this[_0x533c('0x6')][_0x502a67['queue']]&&(this[_0x533c('0x6')][_0x502a67[_0x533c('0x1d')]]['acw']||this[_0x533c('0x6')][_0x502a67[_0x533c('0x1d')]][_0x533c('0x1f')])){if(this['agents'][_0x502a67['interface']]){this['channels'][_0x502a67['uniqueid']]={'queue':_0x502a67[_0x533c('0x1d')],'interface':_0x502a67['interface'],'destlinkedid':_0x502a67[_0x533c('0x29')]};}}}catch(_0x503852){logger[_0x533c('0x39')]('[ACW][syncAgentConnect]\x20%s',_0x503852[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')]['syncAgentConnectPreview']=function(_0x132e42){try{if(this[_0x533c('0x6')][_0x132e42[_0x533c('0x1d')]]&&(this[_0x533c('0x6')][_0x132e42[_0x533c('0x1d')]]['acw']||this[_0x533c('0x6')][_0x132e42[_0x533c('0x1d')]][_0x533c('0x1f')])){if(this[_0x533c('0x7')][_0x132e42['interface']]){this[_0x533c('0x9')][_0x132e42[_0x533c('0x31')]]={'queue':_0x132e42['queue'],'interface':_0x132e42['interface']};}}}catch(_0x1dc963){logger['error'](_0x533c('0x40'),_0x1dc963[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0xe')]=function(_0xe9354a){try{if(this[_0x533c('0x9')][_0xe9354a[_0x533c('0x31')]]&&_[_0x533c('0x41')](this['channels'][_0xe9354a[_0x533c('0x31')]][_0x533c('0x28')])){logger[_0x533c('0x26')]('[%s][HANGUP:UNIQUEID]',_0xe9354a[_0x533c('0x31')]);this[_0x533c('0x1b')](_0xe9354a['uniqueid']);}else if(this[_0x533c('0x9')][_0xe9354a['linkedid']]&&_[_0x533c('0x41')](this[_0x533c('0x9')][_0xe9354a[_0x533c('0x42')]][_0x533c('0x28')])){logger[_0x533c('0x26')](_0x533c('0x43'),_0xe9354a[_0x533c('0x42')]);this['startAcw'](_0xe9354a[_0x533c('0x42')]);}}catch(_0x24c2f4){logger[_0x533c('0x39')](_0x533c('0x44'),_0x24c2f4[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0x10')]=function(_0x50d5a2){try{if(this['channels'][_0x50d5a2['uniqueid']]&&this['channels'][_0x50d5a2[_0x533c('0x31')]][_0x533c('0x28')]){logger['info'](_0x533c('0x45'),_0x50d5a2[_0x533c('0x31')]);this[_0x533c('0x1b')](_0x50d5a2['uniqueid']);}else if(this[_0x533c('0x9')][_0x50d5a2['linkedid']]&&this['channels'][_0x50d5a2[_0x533c('0x42')]][_0x533c('0x28')]){logger[_0x533c('0x26')](_0x533c('0x46'),_0x50d5a2[_0x533c('0x42')]);this[_0x533c('0x1b')](_0x50d5a2[_0x533c('0x42')]);}}catch(_0x51190c){logger[_0x533c('0x39')]('[ACW][syncHangup]\x20%s',_0x51190c[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0x13')]=function(_0x2c7600){try{if(!_[_0x533c('0x47')](this[_0x533c('0x9')][_0x2c7600[_0x533c('0x48')]])){this[_0x533c('0x1b')](_0x2c7600['transfereeuniqueid']);if(this[_0x533c('0x9')][_0x2c7600[_0x533c('0x49')]]){this[_0x533c('0x9')][_0x2c7600[_0x533c('0x49')]][_0x533c('0x28')]=!![];this[_0x533c('0x9')][_0x2c7600['transfertargetuniqueid']]=this[_0x533c('0x9')][_0x2c7600['secondtransfereruniqueid']];delete this[_0x533c('0x9')][_0x2c7600[_0x533c('0x49')]];}}else if(!_[_0x533c('0x47')](this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4a')]])){this[_0x533c('0x1b')](_0x2c7600['transfertargetuniqueid']);if(this['channels'][_0x2c7600[_0x533c('0x4b')]]){this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4b')]][_0x533c('0x28')]=!![];this['channels'][_0x2c7600[_0x533c('0x48')]]=this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4b')]];delete this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4b')]];}}}catch(_0x2f2863){logger[_0x533c('0x39')](_0x533c('0x4c'),_0x2f2863[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0x15')]=function(_0xb8a24b){try{if(this[_0x533c('0x9')][_0xb8a24b[_0x533c('0x4d')]]){logger[_0x533c('0x26')](_0x533c('0x4e'),JSON[_0x533c('0x3e')](_0xb8a24b['transfereruniqueid']));this[_0x533c('0x1b')](_0xb8a24b['transfereruniqueid']);}else if(this['channels'][_0xb8a24b[_0x533c('0x4f')]]){logger[_0x533c('0x26')](_0x533c('0x50'),JSON[_0x533c('0x3e')](_0xb8a24b[_0x533c('0x4f')]));this[_0x533c('0x1b')](_0xb8a24b[_0x533c('0x4f')]);}}catch(_0x50df3a){logger[_0x533c('0x39')](_0x533c('0x51'),_0x50df3a['message']);}};Acw[_0x533c('0x1a')][_0x533c('0x52')]=function(_0x8174d0){try{if(this[_0x533c('0x6')][_0x8174d0['queue']]&&this[_0x533c('0x6')][_0x8174d0[_0x533c('0x1d')]]['autopause']===_0x533c('0x53')){if(this[_0x533c('0x7')][_0x8174d0['interface']]){logger[_0x533c('0x26')](_0x533c('0x54'),_0x8174d0['uniqueid'],_0x8174d0[_0x533c('0x1c')],_0x8174d0['queue']);return RpcUser['savePause'](this[_0x533c('0x7')][_0x8174d0[_0x533c('0x1c')]],_0x533c('0x55'),_0x8174d0[_0x533c('0x31')]);}}}catch(_0x5f233c){logger[_0x533c('0x39')](_0x533c('0x56'),_0x5f233c[_0x533c('0x3a')]);}};module[_0x533c('0x57')]=Acw; \ No newline at end of file +var _0x207c=['syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','agents','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels'];(function(_0x3b2377,_0x1be5c4){var _0x4defd8=function(_0x1d21f0){while(--_0x1d21f0){_0x3b2377['push'](_0x3b2377['shift']());}};_0x4defd8(++_0x1be5c4);}(_0x207c,0x1e8));var _0xc207=function(_0x4b3ec4,_0x3c573c){_0x4b3ec4=_0x4b3ec4-0x0;var _0x192836=_0x207c[_0x4b3ec4];return _0x192836;};'use strict';var util=require('util');var _=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var ami=require(_0xc207('0x2'));var logger=require(_0xc207('0x3'))(_0xc207('0x4'));var RpcUser=require(_0xc207('0x5'));var RpcVoiceAgentReport=require(_0xc207('0x6'));function Acw(_0x4b9daa){this[_0xc207('0x7')]=_0x4b9daa['voiceQueues'];this['agents']=_0x4b9daa['agents'];this[_0xc207('0x8')]=_0x4b9daa[_0xc207('0x8')];this[_0xc207('0x9')]={};ami['on']('agentconnect',this[_0xc207('0xa')][_0xc207('0xb')](this));ami['on'](_0xc207('0xc'),this['syncHangupRequest'][_0xc207('0xb')](this));ami['on'](_0xc207('0xd'),this[_0xc207('0xe')][_0xc207('0xb')](this));ami['on'](_0xc207('0xf'),this[_0xc207('0x10')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xc207('0xb')](this));ami['on']('blindtransfer',this[_0xc207('0x11')][_0xc207('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0xc207('0x12')][_0xc207('0xb')](this));}function getDiff(_0x3062f5){var _0x32acbf=moment()[_0xc207('0x13')](0x0);var _0x51e967=moment(_0x3062f5)[_0xc207('0x13')](0x0);return _0x32acbf[_0xc207('0x14')](_0x51e967,_0xc207('0x15'));}Acw[_0xc207('0x16')]['startAcw']=function(_0x564cef){try{var _0x554e5c=this;var _0x1cebfa=this[_0xc207('0x9')][_0x564cef][_0xc207('0x17')];var _0x65f539=this['channels'][_0x564cef][_0xc207('0x18')];var _0x282595=this[_0xc207('0x7')][_0x65f539];var _0x5f288e=![];var _0x4129b8='ACW';if(_0x282595[_0xc207('0x19')]){if(_0x282595[_0xc207('0x1a')][_0xc207('0x1b')]){_0x5f288e=!![];_0x4129b8=_0x282595[_0xc207('0x1a')][_0xc207('0x1b')];}}ami[_0xc207('0x1c')]({'action':_0xc207('0x1d'),'interface':_0x1cebfa,'paused':!![],'reason':_0x4129b8})[_0xc207('0x1e')](function(_0x212005){if(_0x554e5c[_0xc207('0x1f')][_0x1cebfa]){return RpcUser[_0xc207('0x20')](_0x554e5c[_0xc207('0x1f')][_0x1cebfa]['id'])[_0xc207('0x1e')](function(_0x4b52a7){if(_0x4b52a7&&!_0x4b52a7[_0xc207('0x21')]){logger['info'](_0xc207('0x22'),_0x564cef,_0x1cebfa,_0x65f539);var _0x3ac142=_0x554e5c[_0xc207('0x9')][_0x564cef][_0xc207('0x23')]&&_0x554e5c[_0xc207('0x9')][_0x564cef][_0xc207('0x24')]?_0x554e5c[_0xc207('0x9')][_0x564cef][_0xc207('0x24')]:_0x564cef;return RpcUser[_0xc207('0x25')](_0x554e5c[_0xc207('0x1f')][_0x1cebfa],_0x4129b8,_0x3ac142)[_0xc207('0x1e')](function(_0x27df03){if(!_0x5f288e){_0x554e5c[_0xc207('0x8')][_0x1cebfa]={};logger[_0xc207('0x26')](_0xc207('0x27'),_0x564cef,_0x554e5c['voiceQueues'][_0x65f539][_0xc207('0x28')],_0x1cebfa,_0x65f539);_0x554e5c['timers'][_0x1cebfa]['timer']=setTimeout(_0x554e5c[_0xc207('0x29')][_0xc207('0xb')](_0x554e5c,_0x1cebfa),_0x554e5c[_0xc207('0x7')][_0x65f539][_0xc207('0x28')]*0x3e8);_0x554e5c[_0xc207('0x8')][_0x1cebfa]['lastPauseAt']=moment()[_0xc207('0x2a')](_0xc207('0x2b'));_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2c')]=_0x564cef;_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x18')]=_0x65f539;_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2d')]=function(){var _0xc6a7ce=getDiff(_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2e')]);clearTimeout(_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2f')]);_0x554e5c['timers'][_0x1cebfa][_0xc207('0x2f')]=![];RpcVoiceAgentReport[_0xc207('0x30')]({'acwtime':_0xc6a7ce},_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2c')],_0x1cebfa)[_0xc207('0x1e')](function(_0x2ce133){logger['info'](_0xc207('0x31'),_0x564cef,_0xc6a7ce,_0x2ce133);})[_0xc207('0x32')](function(_0x3899dd){logger[_0xc207('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x564cef,_0x3899dd);});delete _0x554e5c[_0xc207('0x8')][_0x1cebfa];};}});}else{logger[_0xc207('0x26')](_0xc207('0x34'),_0x564cef,_0x1cebfa,_0x65f539);}});}})[_0xc207('0x32')](function(_0x1a8359){logger[_0xc207('0x33')](_0xc207('0x27'),_0x564cef,_0x554e5c[_0xc207('0x7')][_0x65f539][_0xc207('0x28')],_0x1cebfa,_0x65f539);})['finally'](function(){delete _0x554e5c['channels'][_0x564cef];});}catch(_0x188c39){logger[_0xc207('0x33')](_0xc207('0x35'),_0x188c39[_0xc207('0x36')]);}};Acw['prototype'][_0xc207('0x29')]=function(_0x433c0f){try{var _0x20a5eb=this;if(_0x20a5eb[_0xc207('0x8')][_0x433c0f]){_0x20a5eb[_0xc207('0x8')][_0x433c0f]['timer']=![];var _0x219b0b=_0x20a5eb[_0xc207('0x8')][_0x433c0f]['uniqueid'];var _0x21dd42=_0x20a5eb['timers'][_0x433c0f][_0xc207('0x18')];var _0x1f69f9=_0x20a5eb['voiceQueues'][_0x21dd42][_0xc207('0x28')];logger[_0xc207('0x26')](_0xc207('0x37'),_0x433c0f);RpcUser['saveUnpause'](this['agents'][_0x433c0f]);RpcVoiceAgentReport[_0xc207('0x30')]({'acwtime':_0x1f69f9,'agentacw':!![]},_0x219b0b,_0x433c0f)[_0xc207('0x1e')](function(_0x41d66c){logger[_0xc207('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x219b0b,_0x1f69f9,_0x41d66c);})[_0xc207('0x32')](function(_0x47cdc4){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x219b0b,_0x47cdc4);});}else{logger['error'](_0xc207('0x38'),_0x433c0f);if(_0x20a5eb[_0xc207('0x8')]){logger[_0xc207('0x26')]('[ACW][TIMERS]',JSON[_0xc207('0x39')](_0x20a5eb[_0xc207('0x8')]));}}}catch(_0x3e7cd9){logger[_0xc207('0x33')]('[ACW][STOP]\x20%s',_0x3e7cd9[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0xa')]=function(_0x46aa9f){try{if(this[_0xc207('0x7')][_0x46aa9f['queue']]&&(this[_0xc207('0x7')][_0x46aa9f[_0xc207('0x18')]][_0xc207('0x4')]||this[_0xc207('0x7')][_0x46aa9f[_0xc207('0x18')]][_0xc207('0x19')])){if(this[_0xc207('0x1f')][_0x46aa9f[_0xc207('0x17')]]){this[_0xc207('0x9')][_0x46aa9f['uniqueid']]={'queue':_0x46aa9f[_0xc207('0x18')],'interface':_0x46aa9f[_0xc207('0x17')],'destlinkedid':_0x46aa9f['destlinkedid']};}}}catch(_0x141e34){logger[_0xc207('0x33')](_0xc207('0x3a'),_0x141e34[_0xc207('0x36')]);}};Acw[_0xc207('0x16')]['syncAgentConnectPreview']=function(_0x11989b){try{if(this[_0xc207('0x7')][_0x11989b[_0xc207('0x18')]]&&(this['voiceQueues'][_0x11989b[_0xc207('0x18')]][_0xc207('0x4')]||this[_0xc207('0x7')][_0x11989b[_0xc207('0x18')]]['mandatoryDisposition'])){if(this['agents'][_0x11989b[_0xc207('0x17')]]){this[_0xc207('0x9')][_0x11989b[_0xc207('0x2c')]]={'queue':_0x11989b[_0xc207('0x18')],'interface':_0x11989b[_0xc207('0x17')]};}}}catch(_0x31baa0){logger[_0xc207('0x33')](_0xc207('0x3b'),_0x31baa0[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0x3c')]=function(_0x2fda4f){try{if(this['channels'][_0x2fda4f['uniqueid']]&&_[_0xc207('0x3d')](this[_0xc207('0x9')][_0x2fda4f[_0xc207('0x2c')]]['attended'])){logger[_0xc207('0x26')](_0xc207('0x3e'),_0x2fda4f[_0xc207('0x2c')]);this[_0xc207('0x3f')](_0x2fda4f['uniqueid']);}else if(this[_0xc207('0x9')][_0x2fda4f['linkedid']]&&_[_0xc207('0x3d')](this['channels'][_0x2fda4f['linkedid']][_0xc207('0x23')])){logger[_0xc207('0x26')]('[%s][HANGUP:LINKEDID]',_0x2fda4f['linkedid']);this['startAcw'](_0x2fda4f[_0xc207('0x40')]);}}catch(_0x462958){logger[_0xc207('0x33')](_0xc207('0x41'),_0x462958[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0xe')]=function(_0x1dfdee){try{if(this['channels'][_0x1dfdee[_0xc207('0x2c')]]&&this[_0xc207('0x9')][_0x1dfdee['uniqueid']]['attended']){logger[_0xc207('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x1dfdee['uniqueid']);this[_0xc207('0x3f')](_0x1dfdee[_0xc207('0x2c')]);}else if(this[_0xc207('0x9')][_0x1dfdee[_0xc207('0x40')]]&&this[_0xc207('0x9')][_0x1dfdee[_0xc207('0x40')]][_0xc207('0x23')]){logger[_0xc207('0x26')](_0xc207('0x42'),_0x1dfdee[_0xc207('0x40')]);this[_0xc207('0x3f')](_0x1dfdee['linkedid']);}}catch(_0x529a21){logger[_0xc207('0x33')](_0xc207('0x43'),_0x529a21[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0x44')]=function(_0x21c12b){try{if(!_[_0xc207('0x45')](this[_0xc207('0x9')][_0x21c12b[_0xc207('0x46')]])){this['startAcw'](_0x21c12b[_0xc207('0x46')]);if(this[_0xc207('0x9')][_0x21c12b[_0xc207('0x47')]]){this[_0xc207('0x9')][_0x21c12b['secondtransfereruniqueid']][_0xc207('0x23')]=!![];this[_0xc207('0x9')][_0x21c12b[_0xc207('0x48')]]=this[_0xc207('0x9')][_0x21c12b[_0xc207('0x47')]];delete this[_0xc207('0x9')][_0x21c12b[_0xc207('0x47')]];}}else if(!_['isNil'](this[_0xc207('0x9')][_0x21c12b[_0xc207('0x48')]])){this[_0xc207('0x3f')](_0x21c12b[_0xc207('0x48')]);if(this['channels'][_0x21c12b[_0xc207('0x49')]]){this['channels'][_0x21c12b['origtransfereruniqueid']][_0xc207('0x23')]=!![];this[_0xc207('0x9')][_0x21c12b[_0xc207('0x46')]]=this[_0xc207('0x9')][_0x21c12b[_0xc207('0x49')]];delete this[_0xc207('0x9')][_0x21c12b[_0xc207('0x49')]];}}}catch(_0x33c372){logger[_0xc207('0x33')](_0xc207('0x4a'),_0x33c372[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0x11')]=function(_0x3ed4b2){try{if(this[_0xc207('0x9')][_0x3ed4b2['transfereruniqueid']]){logger[_0xc207('0x26')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xc207('0x39')](_0x3ed4b2[_0xc207('0x4b')]));this[_0xc207('0x3f')](_0x3ed4b2['transfereruniqueid']);}else if(this['channels'][_0x3ed4b2[_0xc207('0x4c')]]){logger[_0xc207('0x26')](_0xc207('0x4d'),JSON['stringify'](_0x3ed4b2[_0xc207('0x4c')]));this[_0xc207('0x3f')](_0x3ed4b2[_0xc207('0x4c')]);}}catch(_0x4967b4){logger['error'](_0xc207('0x4e'),_0x4967b4['message']);}};Acw[_0xc207('0x16')][_0xc207('0x10')]=function(_0x3cca53){try{if(this[_0xc207('0x7')][_0x3cca53[_0xc207('0x18')]]&&this[_0xc207('0x7')][_0x3cca53[_0xc207('0x18')]][_0xc207('0x4f')]==='all'){if(this[_0xc207('0x1f')][_0x3cca53[_0xc207('0x17')]]){logger[_0xc207('0x26')](_0xc207('0x50'),_0x3cca53[_0xc207('0x2c')],_0x3cca53[_0xc207('0x17')],_0x3cca53[_0xc207('0x18')]);return RpcUser[_0xc207('0x25')](this[_0xc207('0x1f')][_0x3cca53[_0xc207('0x17')]],_0xc207('0x51'),_0x3cca53['uniqueid']);}}}catch(_0x20e130){logger[_0xc207('0x33')](_0xc207('0x52'),_0x20e130[_0xc207('0x36')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f0ab2f2..d628f69 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08a1=['sippeerstatus','queuesummary','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionQueueSummary','catch','log','exports','bluebird','moment','util','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','inspect','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus'];(function(_0x1d1219,_0x23fc71){var _0x5b5b89=function(_0x3d85e5){while(--_0x3d85e5){_0x1d1219['push'](_0x1d1219['shift']());}};_0x5b5b89(++_0x23fc71);}(_0x08a1,0xb8));var _0x108a=function(_0x229d5f,_0x436b6c){_0x229d5f=_0x229d5f-0x0;var _0x15b651=_0x08a1[_0x229d5f];return _0x15b651;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x108a('0x0'));var moment=require(_0x108a('0x1'));var util=require(_0x108a('0x2'));var _=require('lodash');var logger=require('../../config/logger')(_0x108a('0x3'));var config=require(_0x108a('0x4'));var ami=new Manager(config[_0x108a('0x5')][_0x108a('0x6')],config[_0x108a('0x5')]['ip'],config[_0x108a('0x5')][_0x108a('0x7')],config['asterisk'][_0x108a('0x8')],!![]);ami[_0x108a('0x9')]();ami[_0x108a('0xa')]=BPromise[_0x108a('0xb')](ami[_0x108a('0xc')]);function error(_0x486455){logger[_0x108a('0xd')](util[_0x108a('0xe')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x108a('0x5')][_0x108a('0x7')],config[_0x108a('0x5')]['ip'],config[_0x108a('0x5')][_0x108a('0x6')],util[_0x108a('0xf')](_0x486455,![],null)));}function close(){logger[_0x108a('0xd')](util[_0x108a('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x108a('0x7')],config[_0x108a('0x5')]['ip'],config[_0x108a('0x5')]['port']));}ami[_0x108a('0x10')]=function(){return function(){return ami[_0x108a('0xa')]({'action':'sipshowregistry'});};};ami[_0x108a('0x11')]=function(){return function(){return ami[_0x108a('0xa')]({'action':_0x108a('0x12')});};};ami[_0x108a('0x13')]=function(){return function(){return ami[_0x108a('0xa')]({'action':_0x108a('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x108a('0xa')]({'action':_0x108a('0x15')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x108a('0xa')]({'action':'coreshowchannels'});};};function connect(_0x54b5f8){logger['info'](util[_0x108a('0xe')](_0x108a('0x16'),config['asterisk'][_0x108a('0x7')],config[_0x108a('0x5')]['ip'],config['asterisk']['port']));ami[_0x108a('0x17')](_0x108a('0xd'),error);ami['once'](_0x108a('0x18'),close);}ami['on'](_0x108a('0x19'),connect);ami['on'](_0x108a('0x1a'),function(_0x4d88e4){logger['info'](util[_0x108a('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x108a('0x5')][_0x108a('0x7')],config[_0x108a('0x5')]['ip'],config[_0x108a('0x5')][_0x108a('0x6')],util['inspect'](_0x4d88e4,![],null)));});ami['on'](_0x108a('0x1b'),function(_0x3e79a4){logger['info'](util[_0x108a('0xe')](_0x108a('0x1c'),config[_0x108a('0x5')][_0x108a('0x7')],config[_0x108a('0x5')]['ip'],config['asterisk']['port']));return BPromise[_0x108a('0x1d')]()['then'](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())['then'](ami[_0x108a('0x13')]())['then'](ami[_0x108a('0x1e')]())['then'](ami['actionCoreShowChannels']())[_0x108a('0x1f')](function(_0x47f224){console[_0x108a('0x20')](_0x47f224);});});ami[_0x108a('0x17')](_0x108a('0xd'),error);ami[_0x108a('0x17')](_0x108a('0x18'),close);module[_0x108a('0x21')]=ami; \ No newline at end of file +var _0x150b=['info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionSipShowRegistry','actionSipPeerStatus','catch','log','close','exports','bluebird','moment','../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels'];(function(_0x5f06f7,_0x2e62f2){var _0x5b4bf7=function(_0x99d36b){while(--_0x99d36b){_0x5f06f7['push'](_0x5f06f7['shift']());}};_0x5b4bf7(++_0x2e62f2);}(_0x150b,0x1ef));var _0xb150=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0x150b[_0x369a98];return _0x29565c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xb150('0x0'));var moment=require(_0xb150('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')('ami');var config=require(_0xb150('0x2'));var ami=new Manager(config['asterisk'][_0xb150('0x3')],config[_0xb150('0x4')]['ip'],config[_0xb150('0x4')][_0xb150('0x5')],config[_0xb150('0x4')][_0xb150('0x6')],!![]);ami[_0xb150('0x7')]();ami[_0xb150('0x8')]=BPromise[_0xb150('0x9')](ami[_0xb150('0xa')]);function error(_0x4d3d76){logger[_0xb150('0xb')](util[_0xb150('0xc')](_0xb150('0xd'),config[_0xb150('0x4')][_0xb150('0x5')],config[_0xb150('0x4')]['ip'],config['asterisk'][_0xb150('0x3')],util[_0xb150('0xe')](_0x4d3d76,![],null)));}function close(){logger[_0xb150('0xb')](util['format'](_0xb150('0xf'),config[_0xb150('0x4')][_0xb150('0x5')],config[_0xb150('0x4')]['ip'],config['asterisk'][_0xb150('0x3')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xb150('0x8')]({'action':_0xb150('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xb150('0x8')]({'action':_0xb150('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xb150('0x12')});};};ami[_0xb150('0x13')]=function(){return function(){return ami['Action']({'action':_0xb150('0x14')});};};ami[_0xb150('0x15')]=function(){return function(){return ami[_0xb150('0x8')]({'action':_0xb150('0x16')});};};function connect(_0x4bb38e){logger[_0xb150('0x17')](util['format'](_0xb150('0x18'),config['asterisk'][_0xb150('0x5')],config[_0xb150('0x4')]['ip'],config[_0xb150('0x4')][_0xb150('0x3')]));ami[_0xb150('0x19')](_0xb150('0xb'),error);ami['once']('close',close);}ami['on']('connect',connect);ami['on'](_0xb150('0x1a'),function(_0x180577){logger[_0xb150('0x17')](util[_0xb150('0xc')](_0xb150('0x1b'),config[_0xb150('0x4')][_0xb150('0x5')],config[_0xb150('0x4')]['ip'],config[_0xb150('0x4')][_0xb150('0x3')],util[_0xb150('0xe')](_0x180577,![],null)));});ami['on'](_0xb150('0x1c'),function(_0x2db9f8){logger[_0xb150('0x17')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0xb150('0x4')]['ip'],config['asterisk'][_0xb150('0x3')]));return BPromise[_0xb150('0x1d')]()[_0xb150('0x1e')](ami[_0xb150('0x1f')]())[_0xb150('0x1e')](ami['actionDeviceStateList']())[_0xb150('0x1e')](ami[_0xb150('0x20')]())[_0xb150('0x1e')](ami['actionQueueSummary']())[_0xb150('0x1e')](ami[_0xb150('0x15')]())[_0xb150('0x21')](function(_0x3db66a){console[_0xb150('0x22')](_0x3db66a);});});ami[_0xb150('0x19')](_0xb150('0xb'),error);ami[_0xb150('0x19')](_0xb150('0x23'),close);module[_0xb150('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 624f73c..2592421 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8747=['then','debug','rpc','memberReport','error','message','result','catch','exports','jayson/promise','bluebird','client','request'];(function(_0x2269ed,_0x10f072){var _0x34cc64=function(_0x3d5e69){while(--_0x3d5e69){_0x2269ed['push'](_0x2269ed['shift']());}};_0x34cc64(++_0x10f072);}(_0x8747,0x1dd));var _0x7874=function(_0x29cb88,_0x36e887){_0x29cb88=_0x29cb88-0x0;var _0x7988a7=_0x8747[_0x29cb88];return _0x7988a7;};'use strict';var jayson=require(_0x7874('0x0'));var BPromise=require(_0x7874('0x1'));var logger=require('../../config/logger')('ami');var client=jayson[_0x7874('0x2')]['http']({'port':0x2329});client['Request']=function(_0x2b0dab,_0x18bc5f){return new BPromise(function(_0x1fde6d,_0x1c691a){return client[_0x7874('0x3')](_0x2b0dab,_0x18bc5f)[_0x7874('0x4')](function(_0x4e8287){logger[_0x7874('0x5')](_0x7874('0x6'),_0x7874('0x7'),_0x2b0dab,_0x18bc5f,_0x4e8287);if(_0x4e8287['error']){logger[_0x7874('0x8')]('rpc',_0x7874('0x7'),_0x2b0dab,_0x4e8287['error'][_0x7874('0x9')],_0x18bc5f);return _0x1c691a(_0x4e8287[_0x7874('0x8')][_0x7874('0x9')]);}else{return _0x1fde6d(_0x4e8287[_0x7874('0xa')]);}})[_0x7874('0xb')](function(_0x1ab3de){logger[_0x7874('0x8')](_0x7874('0x6'),'memberReport',_0x2b0dab,_0x1ab3de,_0x18bc5f);return _0x1c691a(_0x1ab3de);});});};module[_0x7874('0xc')]=client; \ No newline at end of file +var _0xbfb8=['memberReport','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','request','then','rpc'];(function(_0xcefa34,_0x1cc682){var _0x37cfd2=function(_0xa9ce41){while(--_0xa9ce41){_0xcefa34['push'](_0xcefa34['shift']());}};_0x37cfd2(++_0x1cc682);}(_0xbfb8,0xd8));var _0x8bfb=function(_0x4d974c,_0x7cb366){_0x4d974c=_0x4d974c-0x0;var _0x402502=_0xbfb8[_0x4d974c];return _0x402502;};'use strict';var jayson=require(_0x8bfb('0x0'));var BPromise=require(_0x8bfb('0x1'));var logger=require(_0x8bfb('0x2'))('ami');var client=jayson[_0x8bfb('0x3')][_0x8bfb('0x4')]({'port':0x2329});client['Request']=function(_0x336320,_0x98d785){return new BPromise(function(_0x34cf8d,_0x403ecd){return client[_0x8bfb('0x5')](_0x336320,_0x98d785)[_0x8bfb('0x6')](function(_0x826c3c){logger['debug'](_0x8bfb('0x7'),_0x8bfb('0x8'),_0x336320,_0x98d785,_0x826c3c);if(_0x826c3c[_0x8bfb('0x9')]){logger[_0x8bfb('0x9')]('rpc',_0x8bfb('0x8'),_0x336320,_0x826c3c[_0x8bfb('0x9')][_0x8bfb('0xa')],_0x98d785);return _0x403ecd(_0x826c3c[_0x8bfb('0x9')]['message']);}else{return _0x34cf8d(_0x826c3c[_0x8bfb('0xb')]);}})[_0x8bfb('0xc')](function(_0x30cda0){logger[_0x8bfb('0x9')](_0x8bfb('0x7'),_0x8bfb('0x8'),_0x336320,_0x30cda0,_0x98d785);return _0x403ecd(_0x30cda0);});});};module[_0x8bfb('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index fe00880..4f73edf 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c7c=['number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName'];(function(_0x595e29,_0x1b39ea){var _0x1c6e81=function(_0x52a45e){while(--_0x52a45e){_0x595e29['push'](_0x595e29['shift']());}};_0x1c6e81(++_0x1b39ea);}(_0x1c7c,0x164));var _0xc1c7=function(_0x1df10e,_0x4647ba){_0x1df10e=_0x1df10e-0x0;var _0x5012f6=_0x1c7c[_0x1df10e];return _0x5012f6;};'use strict';var util=require(_0xc1c7('0x0'));var _=require(_0xc1c7('0x1'));var moment=require(_0xc1c7('0x2'));function checkNameSurname(_0x3a93f0,_0x4a232c,_0x3620e9){var _0x59ac62='';if(!_[_0xc1c7('0x3')](_0x4a232c)&&_0xc1c7('0x4')===typeof _0x4a232c){_0x59ac62+=_0x4a232c;}if(!_[_0xc1c7('0x3')](_0x3620e9)&&_0xc1c7('0x4')===typeof _0x3620e9){_0x59ac62+='\x20'+_0x3620e9;}if(_0x59ac62!==''){return _0x59ac62;}return _0x3a93f0;}function Action(_0x42e930,_0x364dde,_0x1f3e21){this[_0xc1c7('0x5')]=_0x42e930;this[_0xc1c7('0x6')]=_0x1f3e21||undefined;this[_0xc1c7('0x7')]=checkNameSurname(_0x364dde[_0xc1c7('0x8')][_0xc1c7('0x9')],_0x364dde[_0xc1c7('0x8')][_0xc1c7('0xa')],_0x364dde[_0xc1c7('0x8')][_0xc1c7('0xb')]);this[_0xc1c7('0xc')]=_0x364dde['Contact'][_0xc1c7('0x9')];this[_0xc1c7('0xd')]=_0x42e930['name'];this[_0xc1c7('0xe')]=_0x364dde[_0xc1c7('0xe')]||![];this[_0xc1c7('0xf')]=_0x42e930['type'];this[_0xc1c7('0x10')]=_0x42e930[_0xc1c7('0x10')]||0x3;this[_0xc1c7('0x11')]=_0x364dde[_0xc1c7('0x11')];this[_0xc1c7('0x12')]=_0x364dde[_0xc1c7('0x12')];this[_0xc1c7('0x13')]=_0x364dde[_0xc1c7('0x13')];this[_0xc1c7('0x14')]=_0x364dde[_0xc1c7('0x14')];this[_0xc1c7('0x15')]=_0x364dde[_0xc1c7('0x15')];this['countdropretry']=_0x364dde[_0xc1c7('0x16')];this[_0xc1c7('0x17')]=_0x364dde[_0xc1c7('0x17')];this['countmachineretry']=_0x364dde[_0xc1c7('0x18')];this[_0xc1c7('0x19')]=_0x364dde[_0xc1c7('0x19')];this[_0xc1c7('0x1a')]=_0x364dde[_0xc1c7('0x1a')];this[_0xc1c7('0x1b')]=_0x364dde[_0xc1c7('0x1b')];this[_0xc1c7('0x1c')]=_0x364dde['UserId'];this[_0xc1c7('0x1d')]=_0x364dde[_0xc1c7('0x1d')];this[_0xc1c7('0x1e')]=_0x364dde[_0xc1c7('0x1e')];this['idHopper']=_0x364dde['id'];this[_0xc1c7('0x1f')]=_0x364dde['Contact'][_0xc1c7('0xa')]||'';this[_0xc1c7('0x20')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xc1c7('0x21')]=_0x364dde[_0xc1c7('0x21')];this[_0xc1c7('0x22')]=_0x364dde['callbackuniqueid'];this[_0xc1c7('0x23')]=_0x364dde[_0xc1c7('0x23')];this[_0xc1c7('0x24')]=_0x364dde[_0xc1c7('0x24')];this[_0xc1c7('0x25')]='';this[_0xc1c7('0x26')]='';}Action[_0xc1c7('0x27')][_0xc1c7('0x28')]=function(){return util[_0xc1c7('0x29')](_0xc1c7('0x2a'),this[_0xc1c7('0x7')],this[_0xc1c7('0x5')][_0xc1c7('0x2b')]>0x0?this[_0xc1c7('0xc')][_0xc1c7('0x2c')](this[_0xc1c7('0x5')]['dialCutDigit']):this[_0xc1c7('0xc')]);};Action[_0xc1c7('0x27')]['getQueue']=function(){return this['queue'];};module[_0xc1c7('0x2d')]=Action; \ No newline at end of file +var _0x138d=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','queue','active','type'];(function(_0x36625f,_0x727bd6){var _0x135981=function(_0x1d8f24){while(--_0x1d8f24){_0x36625f['push'](_0x36625f['shift']());}};_0x135981(++_0x727bd6);}(_0x138d,0x1ab));var _0xd138=function(_0x3a4203,_0xa6ff2e){_0x3a4203=_0x3a4203-0x0;var _0x1a5661=_0x138d[_0x3a4203];return _0x1a5661;};'use strict';var util=require(_0xd138('0x0'));var _=require(_0xd138('0x1'));var moment=require('moment');function checkNameSurname(_0xefc890,_0x34325b,_0x427b74){var _0x1882b8='';if(!_[_0xd138('0x2')](_0x34325b)&&_0xd138('0x3')===typeof _0x34325b){_0x1882b8+=_0x34325b;}if(!_['isNil'](_0x427b74)&&_0xd138('0x3')===typeof _0x427b74){_0x1882b8+='\x20'+_0x427b74;}if(_0x1882b8!==''){return _0x1882b8;}return _0xefc890;}function Action(_0x31c62b,_0x343962,_0x54f02e){this[_0xd138('0x4')]=_0x31c62b;this[_0xd138('0x5')]=_0x54f02e||undefined;this[_0xd138('0x6')]=checkNameSurname(_0x343962['Contact']['phone'],_0x343962[_0xd138('0x7')][_0xd138('0x8')],_0x343962[_0xd138('0x7')]['lastName']);this[_0xd138('0x9')]=_0x343962['Contact']['phone'];this[_0xd138('0xa')]=_0x31c62b[_0xd138('0x6')];this[_0xd138('0xb')]=_0x343962[_0xd138('0xb')]||![];this['type']=_0x31c62b[_0xd138('0xc')];this['dialQueueTimeout']=_0x31c62b[_0xd138('0xd')]||0x3;this[_0xd138('0xe')]=_0x343962[_0xd138('0xe')];this[_0xd138('0xf')]=_0x343962[_0xd138('0xf')];this[_0xd138('0x10')]=_0x343962[_0xd138('0x10')];this[_0xd138('0x11')]=_0x343962[_0xd138('0x11')];this[_0xd138('0x12')]=_0x343962[_0xd138('0x12')];this[_0xd138('0x13')]=_0x343962['countdropretry'];this[_0xd138('0x14')]=_0x343962[_0xd138('0x14')];this['countmachineretry']=_0x343962['countmachineretry'];this['countagentrejectretry']=_0x343962[_0xd138('0x15')];this[_0xd138('0x16')]=_0x343962['ContactId'];this[_0xd138('0x17')]=_0x343962[_0xd138('0x17')];this[_0xd138('0x18')]=_0x343962[_0xd138('0x18')];this['VoiceQueueId']=_0x343962[_0xd138('0x19')];this[_0xd138('0x1a')]=_0x343962[_0xd138('0x1a')];this[_0xd138('0x1b')]=_0x343962['id'];this[_0xd138('0x1c')]=_0x343962[_0xd138('0x7')][_0xd138('0x8')]||'';this['starttime']=moment()[_0xd138('0x1d')](_0xd138('0x1e'));this['callback']=_0x343962['callback'];this[_0xd138('0x1f')]=_0x343962['callbackuniqueid'];this['callbackat']=_0x343962['callbackat'];this[_0xd138('0x20')]=_0x343962[_0xd138('0x20')];this[_0xd138('0x21')]='';this[_0xd138('0x22')]='';}Action['prototype'][_0xd138('0x23')]=function(){return util[_0xd138('0x1d')](_0xd138('0x24'),this[_0xd138('0x6')],this[_0xd138('0x4')][_0xd138('0x25')]>0x0?this[_0xd138('0x9')][_0xd138('0x26')](this[_0xd138('0x4')][_0xd138('0x25')]):this[_0xd138('0x9')]);};Action[_0xd138('0x27')]['getQueue']=function(){return this[_0xd138('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 8dbf97e..e055b81 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51c5=['countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum','number','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x51c5,0x10a));var _0x551c=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x51c5[_0x16b9ed];return _0x66b1f8;};'use strict';var util=require(_0x551c('0x0'));var _=require(_0x551c('0x1'));var moment=require(_0x551c('0x2'));function getSeconds(_0x1c089f,_0x301040){var _0xb34ce7=moment(_0x1c089f)[_0x551c('0x3')](0x0);var _0x814e38=moment(_0x301040)[_0x551c('0x3')](0x0);return _0xb34ce7[_0x551c('0x4')](_0x814e38,_0x551c('0x5'));}function AdditionalPhone(_0x25801e){this[_0x551c('0x6')]=_0x25801e[_0x551c('0x6')];this[_0x551c('0x7')]=_0x25801e['scheduledat']||undefined;this[_0x551c('0x8')]=_0x25801e[_0x551c('0x8')];this[_0x551c('0x9')]=_0x25801e['type']===_0x551c('0xa')?_0x551c('0xb'):_0x25801e[_0x551c('0x8')];this[_0x551c('0xc')]=_0x25801e['countbusyretry'];this['countcongestionretry']=_0x25801e[_0x551c('0xd')];this[_0x551c('0xe')]=_0x25801e[_0x551c('0xe')];this[_0x551c('0xf')]=_0x25801e[_0x551c('0xc')]+_0x25801e[_0x551c('0xd')]+_0x25801e[_0x551c('0xe')]+_0x25801e['countnosuchnumberretry']+_0x25801e[_0x551c('0x10')]+_0x25801e['countabandonedretry']+_0x25801e[_0x551c('0x11')]+_0x25801e['countagentrejectretry'];this[_0x551c('0x12')]=_0x25801e['countnosuchnumberretry'];this[_0x551c('0x10')]=_0x25801e['countdropretry'];this['countabandonedretry']=_0x25801e['countabandonedretry'];this[_0x551c('0x11')]=_0x25801e['countmachineretry'];this[_0x551c('0x13')]=_0x25801e['countagentrejectretry'];this[_0x551c('0xb')]=_0x25801e[_0x551c('0xb')];this[_0x551c('0x14')]=_0x25801e[_0x551c('0x15')];this[_0x551c('0x16')]=_0x25801e[_0x551c('0x17')];this['starttime']=_0x25801e['starttime'];this[_0x551c('0x18')]=_0x25801e[_0x551c('0x18')];this[_0x551c('0x19')]=_0x25801e['responsetime'];this['ringtime']=getSeconds(_0x25801e[_0x551c('0x18')],_0x25801e['starttime']);this[_0x551c('0x1a')]=0x0;this[_0x551c('0x1b')]=0x0;this[_0x551c('0x1c')]=_0x25801e[_0x551c('0x1c')];this[_0x551c('0x1d')]=_0x25801e[_0x551c('0x1d')];this[_0x551c('0x1e')]=_0x25801e[_0x551c('0x1e')];this[_0x551c('0x1f')]=_0x25801e[_0x551c('0x1f')];this['ContactId']=_0x25801e[_0x551c('0x20')];this[_0x551c('0x21')]=_0x25801e['ListId'];this[_0x551c('0x22')]=_0x25801e['UserId'];this[_0x551c('0x23')]=_0x25801e[_0x551c('0x23')];this[_0x551c('0x24')]=_0x25801e[_0x551c('0x24')];this[_0x551c('0x25')]=_0x25801e['originatecalleridnum']||'';this[_0x551c('0x26')]=_0x25801e[_0x551c('0x26')]||'';}module[_0x551c('0x27')]=History; \ No newline at end of file +var _0xc8d2=['campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','starttime','responsetime','endtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','uniqueid','scheduledat','type'];(function(_0x1c2cae,_0x4266b1){var _0x7fd710=function(_0x5136e0){while(--_0x5136e0){_0x1c2cae['push'](_0x1c2cae['shift']());}};_0x7fd710(++_0x4266b1);}(_0xc8d2,0xc5));var _0x2c8d=function(_0xb9627d,_0x5a6caf){_0xb9627d=_0xb9627d-0x0;var _0x3d1239=_0xc8d2[_0xb9627d];return _0x3d1239;};'use strict';var util=require(_0x2c8d('0x0'));var _=require(_0x2c8d('0x1'));var moment=require('moment');function getSeconds(_0x33d6e1,_0xbd9dd2){var _0x22f80c=moment(_0x33d6e1)[_0x2c8d('0x2')](0x0);var _0xecc571=moment(_0xbd9dd2)[_0x2c8d('0x2')](0x0);return _0x22f80c[_0x2c8d('0x3')](_0xecc571,'seconds');}function AdditionalPhone(_0x38d16f){this[_0x2c8d('0x4')]=_0x38d16f[_0x2c8d('0x4')];this['scheduledat']=_0x38d16f[_0x2c8d('0x5')]||undefined;this[_0x2c8d('0x6')]=_0x38d16f[_0x2c8d('0x6')];this[_0x2c8d('0x7')]=_0x38d16f[_0x2c8d('0x6')]==='outbound'?_0x2c8d('0x8'):_0x38d16f[_0x2c8d('0x6')];this['countbusyretry']=_0x38d16f['countbusyretry'];this[_0x2c8d('0x9')]=_0x38d16f[_0x2c8d('0x9')];this['countnoanswerretry']=_0x38d16f[_0x2c8d('0xa')];this[_0x2c8d('0xb')]=_0x38d16f[_0x2c8d('0xc')]+_0x38d16f['countcongestionretry']+_0x38d16f[_0x2c8d('0xa')]+_0x38d16f[_0x2c8d('0xd')]+_0x38d16f[_0x2c8d('0xe')]+_0x38d16f[_0x2c8d('0xf')]+_0x38d16f[_0x2c8d('0x10')]+_0x38d16f[_0x2c8d('0x11')];this[_0x2c8d('0xd')]=_0x38d16f[_0x2c8d('0xd')];this['countdropretry']=_0x38d16f[_0x2c8d('0xe')];this['countabandonedretry']=_0x38d16f[_0x2c8d('0xf')];this[_0x2c8d('0x10')]=_0x38d16f[_0x2c8d('0x10')];this[_0x2c8d('0x11')]=_0x38d16f['countagentrejectretry'];this[_0x2c8d('0x8')]=_0x38d16f[_0x2c8d('0x8')];this['calleridname']=_0x38d16f[_0x2c8d('0x12')];this[_0x2c8d('0x13')]=_0x38d16f['number'];this[_0x2c8d('0x14')]=_0x38d16f[_0x2c8d('0x14')];this[_0x2c8d('0x15')]=_0x38d16f['responsetime'];this[_0x2c8d('0x16')]=_0x38d16f[_0x2c8d('0x15')];this['ringtime']=getSeconds(_0x38d16f[_0x2c8d('0x15')],_0x38d16f[_0x2c8d('0x14')]);this[_0x2c8d('0x17')]=0x0;this['talktime']=0x0;this['callback']=_0x38d16f[_0x2c8d('0x18')];this['callbackuniqueid']=_0x38d16f[_0x2c8d('0x19')];this[_0x2c8d('0x1a')]=_0x38d16f[_0x2c8d('0x1a')];this[_0x2c8d('0x1b')]=_0x38d16f[_0x2c8d('0x1b')];this[_0x2c8d('0x1c')]=_0x38d16f[_0x2c8d('0x1c')];this[_0x2c8d('0x1d')]=_0x38d16f['ListId'];this[_0x2c8d('0x1e')]=_0x38d16f[_0x2c8d('0x1e')];this['VoiceQueueId']=_0x38d16f[_0x2c8d('0x1f')];this['CampaignId']=_0x38d16f['CampaignId'];this['originatecalleridnum']=_0x38d16f[_0x2c8d('0x20')]||'';this[_0x2c8d('0x21')]=_0x38d16f['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index fd6ed8d..681a57c 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fb8=['answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','starttime','responsetime'];(function(_0x47059b,_0x3c53f4){var _0x3aab3f=function(_0x189ada){while(--_0x189ada){_0x47059b['push'](_0x47059b['shift']());}};_0x3aab3f(++_0x3c53f4);}(_0x8fb8,0x135));var _0x88fb=function(_0x784e31,_0x51f0f1){_0x784e31=_0x784e31-0x0;var _0x221db5=_0x8fb8[_0x784e31];return _0x221db5;};'use strict';var util=require(_0x88fb('0x0'));var _=require(_0x88fb('0x1'));var moment=require(_0x88fb('0x2'));function getSeconds(_0x1c65d7,_0x49d0e0){var _0x40bb00=moment(_0x1c65d7)[_0x88fb('0x3')](0x0);var _0x441796=moment(_0x49d0e0)[_0x88fb('0x3')](0x0);return _0x40bb00[_0x88fb('0x4')](_0x441796,_0x88fb('0x5'));}function AgentComplete(_0x3c420c,_0x3feec6){this[_0x88fb('0x6')]=0x4;this[_0x88fb('0x7')]=_0x88fb('0x8');this['scheduledat']=_0x3c420c[_0x88fb('0x9')];this[_0x88fb('0xa')]=_0x3c420c[_0x88fb('0xa')];this[_0x88fb('0xb')]=_0x3c420c[_0x88fb('0xa')]===_0x88fb('0xc')?_0x88fb('0xd'):_0x3c420c['type'];this[_0x88fb('0xe')]=_0x3c420c[_0x88fb('0xe')];this[_0x88fb('0xf')]=_0x3c420c[_0x88fb('0xf')];this[_0x88fb('0x10')]=_0x3c420c[_0x88fb('0x10')];this['countglobal']=_0x3c420c[_0x88fb('0xe')]+_0x3c420c[_0x88fb('0xf')]+_0x3c420c[_0x88fb('0x10')]+_0x3c420c['countnosuchnumberretry']+_0x3c420c[_0x88fb('0x11')]+_0x3c420c[_0x88fb('0x12')]+_0x3c420c[_0x88fb('0x13')]+_0x3c420c[_0x88fb('0x14')];this['countnosuchnumberretry']=_0x3c420c[_0x88fb('0x15')];this[_0x88fb('0x11')]=_0x3c420c[_0x88fb('0x11')];this[_0x88fb('0x12')]=_0x3c420c[_0x88fb('0x12')];this[_0x88fb('0x13')]=_0x3c420c['countmachineretry'];this[_0x88fb('0x14')]=_0x3c420c[_0x88fb('0x14')];this[_0x88fb('0x16')]=_0x3feec6[_0x88fb('0x16')];this[_0x88fb('0x17')]=_0x3c420c['name'];this[_0x88fb('0x18')]=_0x3c420c['number'];this[_0x88fb('0x19')]=_0x3c420c['starttime'];this[_0x88fb('0x1a')]=_0x3c420c[_0x88fb('0x1a')];this[_0x88fb('0x1b')]=_0x3c420c[_0x88fb('0x1b')];this[_0x88fb('0x1c')]=moment()[_0x88fb('0x1d')](_0x88fb('0x1e'));this[_0x88fb('0x1f')]=getSeconds(_0x3c420c[_0x88fb('0x1a')],_0x3c420c[_0x88fb('0x19')]);this[_0x88fb('0x20')]=getSeconds(_0x3c420c[_0x88fb('0x1b')],_0x3c420c[_0x88fb('0x1a')]);this[_0x88fb('0x21')]=getSeconds(this[_0x88fb('0x1c')],_0x3c420c[_0x88fb('0x1b')]);this[_0x88fb('0xd')]=_0x3feec6['queue'];this[_0x88fb('0x22')]=_0x3feec6[_0x88fb('0x22')];this[_0x88fb('0x23')]=_0x3feec6[_0x88fb('0x23')];this['callback']=_0x3c420c[_0x88fb('0x24')];this['callbackuniqueid']=_0x3c420c[_0x88fb('0x25')];this[_0x88fb('0x26')]=_0x3c420c[_0x88fb('0x26')];this[_0x88fb('0x27')]=_0x3c420c[_0x88fb('0x27')];this[_0x88fb('0x28')]=_0x3c420c[_0x88fb('0x28')];this[_0x88fb('0x29')]=_0x3c420c['ListId'];this[_0x88fb('0x2a')]=_0x3c420c['UserId'];this[_0x88fb('0x2b')]=_0x3c420c[_0x88fb('0x2b')];this[_0x88fb('0x2c')]=_0x3c420c[_0x88fb('0x2c')];this[_0x88fb('0x2d')]=_0x3c420c[_0x88fb('0x2d')]||'';this[_0x88fb('0x2e')]=_0x3c420c[_0x88fb('0x2e')]||'';}module[_0x88fb('0x2f')]=AgentComplete; \ No newline at end of file +var _0x0f37=['queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0f37,0x193));var _0x70f3=function(_0x546496,_0x51544c){_0x546496=_0x546496-0x0;var _0x3afe5a=_0x0f37[_0x546496];return _0x3afe5a;};'use strict';var util=require(_0x70f3('0x0'));var _=require(_0x70f3('0x1'));var moment=require(_0x70f3('0x2'));function getSeconds(_0x3f1c98,_0x31c2ff){var _0x122c15=moment(_0x3f1c98)[_0x70f3('0x3')](0x0);var _0x15a471=moment(_0x31c2ff)[_0x70f3('0x3')](0x0);return _0x122c15[_0x70f3('0x4')](_0x15a471,_0x70f3('0x5'));}function AgentComplete(_0x2ef697,_0x2c250c){this[_0x70f3('0x6')]=0x4;this[_0x70f3('0x7')]='Answer';this[_0x70f3('0x8')]=_0x2ef697['scheduledat'];this['type']=_0x2ef697[_0x70f3('0x9')];this[_0x70f3('0xa')]=_0x2ef697['type']==='outbound'?_0x70f3('0xb'):_0x2ef697[_0x70f3('0x9')];this[_0x70f3('0xc')]=_0x2ef697[_0x70f3('0xc')];this['countcongestionretry']=_0x2ef697['countcongestionretry'];this[_0x70f3('0xd')]=_0x2ef697['countnoanswerretry'];this[_0x70f3('0xe')]=_0x2ef697[_0x70f3('0xc')]+_0x2ef697[_0x70f3('0xf')]+_0x2ef697['countnoanswerretry']+_0x2ef697[_0x70f3('0x10')]+_0x2ef697['countdropretry']+_0x2ef697[_0x70f3('0x11')]+_0x2ef697[_0x70f3('0x12')]+_0x2ef697[_0x70f3('0x13')];this['countnosuchnumberretry']=_0x2ef697['countnosuchnumberretry'];this[_0x70f3('0x14')]=_0x2ef697['countdropretry'];this[_0x70f3('0x11')]=_0x2ef697[_0x70f3('0x11')];this['countmachineretry']=_0x2ef697[_0x70f3('0x12')];this[_0x70f3('0x13')]=_0x2ef697[_0x70f3('0x13')];this[_0x70f3('0x15')]=_0x2c250c[_0x70f3('0x15')];this[_0x70f3('0x16')]=_0x2ef697[_0x70f3('0x17')];this['calleridnum']=_0x2ef697['number'];this[_0x70f3('0x18')]=_0x2ef697[_0x70f3('0x18')];this[_0x70f3('0x19')]=_0x2ef697[_0x70f3('0x19')];this[_0x70f3('0x1a')]=_0x2ef697[_0x70f3('0x1a')];this['endtime']=moment()[_0x70f3('0x1b')](_0x70f3('0x1c'));this['ringtime']=getSeconds(_0x2ef697[_0x70f3('0x19')],_0x2ef697['starttime']);this[_0x70f3('0x1d')]=getSeconds(_0x2ef697[_0x70f3('0x1a')],_0x2ef697[_0x70f3('0x19')]);this[_0x70f3('0x1e')]=getSeconds(this[_0x70f3('0x1f')],_0x2ef697[_0x70f3('0x1a')]);this['queue']=_0x2c250c['queue'];this[_0x70f3('0x20')]=_0x2c250c[_0x70f3('0x20')];this[_0x70f3('0x21')]=_0x2c250c[_0x70f3('0x21')];this[_0x70f3('0x22')]=_0x2ef697[_0x70f3('0x22')];this[_0x70f3('0x23')]=_0x2ef697['callbackuniqueid'];this[_0x70f3('0x24')]=_0x2ef697[_0x70f3('0x24')];this[_0x70f3('0x25')]=_0x2ef697['recallme'];this[_0x70f3('0x26')]=_0x2ef697[_0x70f3('0x26')];this[_0x70f3('0x27')]=_0x2ef697[_0x70f3('0x27')];this[_0x70f3('0x28')]=_0x2ef697[_0x70f3('0x28')];this[_0x70f3('0x29')]=_0x2ef697[_0x70f3('0x29')];this[_0x70f3('0x2a')]=_0x2ef697[_0x70f3('0x2a')];this[_0x70f3('0x2b')]=_0x2ef697[_0x70f3('0x2b')]||'';this[_0x70f3('0x2c')]=_0x2ef697[_0x70f3('0x2c')]||'';}module[_0x70f3('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 805c96b..f69a7be 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ea7=['milliseconds','diff','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment'];(function(_0xfe29f,_0x3260bc){var _0x50f05f=function(_0x4f24d5){while(--_0x4f24d5){_0xfe29f['push'](_0xfe29f['shift']());}};_0x50f05f(++_0x3260bc);}(_0x9ea7,0x179));var _0x79ea=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x9ea7[_0x1a9204];return _0x17ca68;};'use strict';var util=require(_0x79ea('0x0'));var _=require(_0x79ea('0x1'));var moment=require(_0x79ea('0x2'));function getSeconds(_0x18708b,_0x1232c7){var _0x44a8cd=moment(_0x18708b)[_0x79ea('0x3')](0x0);var _0x36868a=moment(_0x1232c7)[_0x79ea('0x3')](0x0);return _0x44a8cd[_0x79ea('0x4')](_0x36868a,'seconds');}function Final(_0x1c0a77){this['uniqueid']=_0x1c0a77[_0x79ea('0x5')];this[_0x79ea('0x6')]=_0x1c0a77[_0x79ea('0x6')];this[_0x79ea('0x7')]=_0x1c0a77[_0x79ea('0x7')];this[_0x79ea('0x8')]=_0x1c0a77[_0x79ea('0x7')]==='outbound'?_0x79ea('0x9'):_0x1c0a77[_0x79ea('0x7')];this['countbusyretry']=_0x1c0a77[_0x79ea('0xa')];this[_0x79ea('0xb')]=_0x1c0a77[_0x79ea('0xb')];this[_0x79ea('0xc')]=_0x1c0a77[_0x79ea('0xc')];this[_0x79ea('0xd')]=_0x1c0a77[_0x79ea('0xa')]+_0x1c0a77['countcongestionretry']+_0x1c0a77[_0x79ea('0xc')]+_0x1c0a77[_0x79ea('0xe')]+_0x1c0a77[_0x79ea('0xf')]+_0x1c0a77[_0x79ea('0x10')]+_0x1c0a77[_0x79ea('0x11')]+_0x1c0a77['countagentrejectretry'];this[_0x79ea('0xe')]=_0x1c0a77[_0x79ea('0xe')];this['countdropretry']=_0x1c0a77[_0x79ea('0xf')];this[_0x79ea('0x10')]=_0x1c0a77['countabandonedretry'];this[_0x79ea('0x11')]=_0x1c0a77['countmachineretry'];this[_0x79ea('0x12')]=_0x1c0a77['countagentrejectretry'];this['queue']=_0x1c0a77[_0x79ea('0x9')];this[_0x79ea('0x13')]=_0x1c0a77[_0x79ea('0x13')];this[_0x79ea('0x14')]=_0x1c0a77[_0x79ea('0x14')];this[_0x79ea('0x15')]=_0x1c0a77[_0x79ea('0x15')];this['responsetime']=_0x1c0a77[_0x79ea('0x16')];this[_0x79ea('0x17')]=_0x1c0a77[_0x79ea('0x16')];this['ringtime']=_0x1c0a77[_0x79ea('0x18')]||0x0;this[_0x79ea('0x19')]=_0x1c0a77[_0x79ea('0x19')]||0x0;this[_0x79ea('0x1a')]=_0x1c0a77['talktime']||0x0;this[_0x79ea('0x1b')]=_0x1c0a77['callback'];this[_0x79ea('0x1c')]=_0x1c0a77['callbackuniqueid'];this[_0x79ea('0x1d')]=_0x1c0a77[_0x79ea('0x1d')];this['recallme']=_0x1c0a77[_0x79ea('0x1e')];this[_0x79ea('0x1f')]=_0x1c0a77['ContactId'];this['ListId']=_0x1c0a77[_0x79ea('0x20')];this[_0x79ea('0x21')]=_0x1c0a77[_0x79ea('0x21')];this[_0x79ea('0x22')]=_0x1c0a77[_0x79ea('0x22')];this[_0x79ea('0x23')]=_0x1c0a77[_0x79ea('0x23')];this[_0x79ea('0x24')]=_0x1c0a77[_0x79ea('0x24')]||'';this[_0x79ea('0x25')]=_0x1c0a77['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file +var _0x67c5=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x4f5f08,_0x154cf1){var _0x5eb32d=function(_0x3744f4){while(--_0x3744f4){_0x4f5f08['push'](_0x4f5f08['shift']());}};_0x5eb32d(++_0x154cf1);}(_0x67c5,0x159));var _0x567c=function(_0x3b226d,_0x4f313d){_0x3b226d=_0x3b226d-0x0;var _0x30ff44=_0x67c5[_0x3b226d];return _0x30ff44;};'use strict';var util=require(_0x567c('0x0'));var _=require(_0x567c('0x1'));var moment=require(_0x567c('0x2'));function getSeconds(_0x529443,_0xa992e7){var _0x8d15da=moment(_0x529443)[_0x567c('0x3')](0x0);var _0x493da9=moment(_0xa992e7)['milliseconds'](0x0);return _0x8d15da[_0x567c('0x4')](_0x493da9,_0x567c('0x5'));}function Final(_0x50855d){this['uniqueid']=_0x50855d['uniqueid'];this[_0x567c('0x6')]=_0x50855d['scheduledat'];this[_0x567c('0x7')]=_0x50855d[_0x567c('0x7')];this['campaigntype']=_0x50855d[_0x567c('0x7')]==='outbound'?_0x567c('0x8'):_0x50855d['type'];this['countbusyretry']=_0x50855d['countbusyretry'];this[_0x567c('0x9')]=_0x50855d[_0x567c('0x9')];this[_0x567c('0xa')]=_0x50855d[_0x567c('0xa')];this[_0x567c('0xb')]=_0x50855d['countbusyretry']+_0x50855d[_0x567c('0x9')]+_0x50855d[_0x567c('0xa')]+_0x50855d[_0x567c('0xc')]+_0x50855d['countdropretry']+_0x50855d['countabandonedretry']+_0x50855d[_0x567c('0xd')]+_0x50855d[_0x567c('0xe')];this[_0x567c('0xc')]=_0x50855d[_0x567c('0xc')];this[_0x567c('0xf')]=_0x50855d[_0x567c('0xf')];this[_0x567c('0x10')]=_0x50855d['countabandonedretry'];this[_0x567c('0xd')]=_0x50855d[_0x567c('0xd')];this[_0x567c('0xe')]=_0x50855d[_0x567c('0xe')];this[_0x567c('0x8')]=_0x50855d[_0x567c('0x8')];this['calleridname']=_0x50855d[_0x567c('0x11')];this[_0x567c('0x12')]=_0x50855d[_0x567c('0x12')];this[_0x567c('0x13')]=_0x50855d[_0x567c('0x13')];this[_0x567c('0x14')]=_0x50855d[_0x567c('0x14')];this[_0x567c('0x15')]=_0x50855d[_0x567c('0x14')];this[_0x567c('0x16')]=_0x50855d[_0x567c('0x16')]||0x0;this[_0x567c('0x17')]=_0x50855d[_0x567c('0x17')]||0x0;this[_0x567c('0x18')]=_0x50855d[_0x567c('0x18')]||0x0;this['callback']=_0x50855d[_0x567c('0x19')];this[_0x567c('0x1a')]=_0x50855d['callbackuniqueid'];this[_0x567c('0x1b')]=_0x50855d[_0x567c('0x1b')];this[_0x567c('0x1c')]=_0x50855d[_0x567c('0x1c')];this[_0x567c('0x1d')]=_0x50855d[_0x567c('0x1d')];this['ListId']=_0x50855d[_0x567c('0x1e')];this[_0x567c('0x1f')]=_0x50855d[_0x567c('0x1f')];this[_0x567c('0x20')]=_0x50855d[_0x567c('0x20')];this[_0x567c('0x21')]=_0x50855d[_0x567c('0x21')];this['originatecalleridnum']=_0x50855d[_0x567c('0x22')]||'';this['originatecalleridname']=_0x50855d[_0x567c('0x23')]||'';}module[_0x567c('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 7b1ab45..e0e1f2d 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf066=['countbusyretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','uniqueid','calleridnum','number','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue'];(function(_0x153439,_0x29c50c){var _0x40072f=function(_0x2e6018){while(--_0x2e6018){_0x153439['push'](_0x153439['shift']());}};_0x40072f(++_0x29c50c);}(_0xf066,0xc1));var _0x6f06=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xf066[_0xa1e3e3];return _0xc980e9;};'use strict';var util=require(_0x6f06('0x0'));var _=require('lodash');var moment=require(_0x6f06('0x1'));function getSeconds(_0x418440,_0x4ad70d){var _0x46f6f8=moment(_0x418440)[_0x6f06('0x2')](0x0);var _0xa582c4=moment(_0x4ad70d)[_0x6f06('0x2')](0x0);return _0x46f6f8[_0x6f06('0x3')](_0xa582c4,_0x6f06('0x4'));}function Hangup(_0x520e9a,_0x9facd0){this[_0x6f06('0x5')]=0x4;this[_0x6f06('0x6')]=_0x6f06('0x7');this[_0x6f06('0x8')]=_0x520e9a[_0x6f06('0x8')];this[_0x6f06('0x9')]=_0x520e9a[_0x6f06('0x9')];this['campaigntype']=_0x520e9a[_0x6f06('0x9')]===_0x6f06('0xa')?_0x6f06('0xb'):_0x520e9a[_0x6f06('0x9')];this['countbusyretry']=_0x520e9a[_0x6f06('0xc')];this['countcongestionretry']=_0x520e9a['countcongestionretry'];this[_0x6f06('0xd')]=_0x520e9a[_0x6f06('0xd')];this[_0x6f06('0xe')]=_0x520e9a[_0x6f06('0xc')]+_0x520e9a['countcongestionretry']+_0x520e9a[_0x6f06('0xd')]+_0x520e9a['countnosuchnumberretry']+_0x520e9a[_0x6f06('0xf')]+_0x520e9a['countabandonedretry']+_0x520e9a['countmachineretry']+_0x520e9a[_0x6f06('0x10')];this[_0x6f06('0x11')]=_0x520e9a[_0x6f06('0x11')];this[_0x6f06('0xf')]=_0x520e9a[_0x6f06('0xf')];this[_0x6f06('0x12')]=_0x520e9a['countabandonedretry'];this['countmachineretry']=_0x520e9a[_0x6f06('0x13')];this[_0x6f06('0x10')]=_0x520e9a['countagentrejectretry'];this[_0x6f06('0x14')]=_0x9facd0['uniqueid'];this['calleridname']=_0x520e9a['name'];this[_0x6f06('0x15')]=_0x520e9a[_0x6f06('0x16')];this[_0x6f06('0x17')]=_0x520e9a['starttime'];this['responsetime']=_0x520e9a[_0x6f06('0x18')];this['endtime']=moment()['format'](_0x6f06('0x19'));this['ringtime']=getSeconds(_0x520e9a[_0x6f06('0x18')],_0x520e9a[_0x6f06('0x17')]);this[_0x6f06('0x1a')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x520e9a['responsetime']);this[_0x6f06('0xb')]=_0x520e9a[_0x6f06('0xb')];this[_0x6f06('0x1b')]=_0x6f06('0x1c');this[_0x6f06('0x1d')]=_0x9facd0[_0x6f06('0x1e')];this['callback']=_0x520e9a[_0x6f06('0x1f')];this[_0x6f06('0x20')]=_0x520e9a[_0x6f06('0x20')];this[_0x6f06('0x21')]=_0x520e9a[_0x6f06('0x21')];this[_0x6f06('0x22')]=_0x520e9a['recallme'];this[_0x6f06('0x23')]=_0x520e9a[_0x6f06('0x23')];this['ListId']=_0x520e9a[_0x6f06('0x24')];this[_0x6f06('0x25')]=_0x520e9a[_0x6f06('0x25')];this[_0x6f06('0x26')]=_0x520e9a[_0x6f06('0x26')];this[_0x6f06('0x27')]=_0x520e9a[_0x6f06('0x27')];}module[_0x6f06('0x28')]=Hangup; \ No newline at end of file +var _0xce83=['countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x240625,_0x24fb0a){var _0x4fba33=function(_0x4b1ddc){while(--_0x4b1ddc){_0x240625['push'](_0x240625['shift']());}};_0x4fba33(++_0x24fb0a);}(_0xce83,0xa1));var _0x3ce8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xce83[_0x1cc8fe];return _0x230054;};'use strict';var util=require(_0x3ce8('0x0'));var _=require(_0x3ce8('0x1'));var moment=require(_0x3ce8('0x2'));function getSeconds(_0x1ff39b,_0x24cf4f){var _0x159339=moment(_0x1ff39b)[_0x3ce8('0x3')](0x0);var _0x2b6de7=moment(_0x24cf4f)[_0x3ce8('0x3')](0x0);return _0x159339['diff'](_0x2b6de7,'seconds');}function Hangup(_0x3413d4,_0x2b61bc){this[_0x3ce8('0x4')]=0x4;this[_0x3ce8('0x5')]=_0x3ce8('0x6');this[_0x3ce8('0x7')]=_0x3413d4[_0x3ce8('0x7')];this['type']=_0x3413d4[_0x3ce8('0x8')];this['campaigntype']=_0x3413d4[_0x3ce8('0x8')]===_0x3ce8('0x9')?_0x3ce8('0xa'):_0x3413d4[_0x3ce8('0x8')];this[_0x3ce8('0xb')]=_0x3413d4[_0x3ce8('0xb')];this[_0x3ce8('0xc')]=_0x3413d4['countcongestionretry'];this[_0x3ce8('0xd')]=_0x3413d4[_0x3ce8('0xd')];this[_0x3ce8('0xe')]=_0x3413d4[_0x3ce8('0xb')]+_0x3413d4['countcongestionretry']+_0x3413d4[_0x3ce8('0xd')]+_0x3413d4[_0x3ce8('0xf')]+_0x3413d4[_0x3ce8('0x10')]+_0x3413d4[_0x3ce8('0x11')]+_0x3413d4[_0x3ce8('0x12')]+_0x3413d4[_0x3ce8('0x13')];this[_0x3ce8('0xf')]=_0x3413d4[_0x3ce8('0xf')];this[_0x3ce8('0x10')]=_0x3413d4[_0x3ce8('0x10')];this['countabandonedretry']=_0x3413d4[_0x3ce8('0x11')];this[_0x3ce8('0x12')]=_0x3413d4['countmachineretry'];this[_0x3ce8('0x13')]=_0x3413d4[_0x3ce8('0x13')];this[_0x3ce8('0x14')]=_0x2b61bc[_0x3ce8('0x14')];this[_0x3ce8('0x15')]=_0x3413d4[_0x3ce8('0x16')];this[_0x3ce8('0x17')]=_0x3413d4[_0x3ce8('0x18')];this['starttime']=_0x3413d4[_0x3ce8('0x19')];this[_0x3ce8('0x1a')]=_0x3413d4[_0x3ce8('0x1a')];this[_0x3ce8('0x1b')]=moment()['format'](_0x3ce8('0x1c'));this[_0x3ce8('0x1d')]=getSeconds(_0x3413d4[_0x3ce8('0x1a')],_0x3413d4['starttime']);this[_0x3ce8('0x1e')]=0x0;this[_0x3ce8('0x1f')]=getSeconds(this[_0x3ce8('0x1b')],_0x3413d4['responsetime']);this['queue']=_0x3413d4[_0x3ce8('0xa')];this[_0x3ce8('0x20')]=_0x3ce8('0x21');this[_0x3ce8('0x22')]=_0x2b61bc[_0x3ce8('0x23')];this[_0x3ce8('0x24')]=_0x3413d4[_0x3ce8('0x24')];this['callbackuniqueid']=_0x3413d4['callbackuniqueid'];this[_0x3ce8('0x25')]=_0x3413d4[_0x3ce8('0x25')];this[_0x3ce8('0x26')]=_0x3413d4['recallme'];this[_0x3ce8('0x27')]=_0x3413d4['ContactId'];this[_0x3ce8('0x28')]=_0x3413d4['ListId'];this[_0x3ce8('0x29')]=_0x3413d4[_0x3ce8('0x29')];this[_0x3ce8('0x2a')]=_0x3413d4['VoiceQueueId'];this[_0x3ce8('0x2b')]=_0x3413d4[_0x3ce8('0x2b')];}module[_0x3ce8('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 9fe6279..1ab25b3 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6782=['CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0x6782,0x1f1));var _0x2678=function(_0x2b8be0,_0xf5ed48){_0x2b8be0=_0x2b8be0-0x0;var _0x3b59ba=_0x6782[_0x2b8be0];return _0x3b59ba;};'use strict';var util=require(_0x2678('0x0'));var _=require(_0x2678('0x1'));var moment=require(_0x2678('0x2'));function getSeconds(_0x56153f,_0x502955){var _0x3f6395=moment(_0x56153f)[_0x2678('0x3')](0x0);var _0x2c48f6=moment(_0x502955)[_0x2678('0x3')](0x0);return _0x3f6395[_0x2678('0x4')](_0x2c48f6,'seconds');}function History(_0x35993c){this[_0x2678('0x5')]=_0x35993c['uniqueid'];this[_0x2678('0x6')]=_0x35993c[_0x2678('0x6')]||undefined;this[_0x2678('0x7')]=_0x35993c['type'];this[_0x2678('0x8')]=_0x35993c[_0x2678('0x7')]===_0x2678('0x9')?_0x2678('0xa'):_0x35993c['type'];this[_0x2678('0xb')]=_0x35993c[_0x2678('0xb')];this[_0x2678('0xc')]=_0x35993c[_0x2678('0xc')];this[_0x2678('0xd')]=_0x35993c[_0x2678('0xd')];this[_0x2678('0xe')]=_0x35993c[_0x2678('0xb')]+_0x35993c[_0x2678('0xc')]+_0x35993c[_0x2678('0xd')]+_0x35993c[_0x2678('0xf')]+_0x35993c[_0x2678('0x10')]+_0x35993c[_0x2678('0x11')]+_0x35993c[_0x2678('0x12')]+_0x35993c[_0x2678('0x13')];this[_0x2678('0xf')]=_0x35993c[_0x2678('0xf')];this[_0x2678('0x10')]=_0x35993c[_0x2678('0x10')];this['countabandonedretry']=_0x35993c[_0x2678('0x11')];this[_0x2678('0x12')]=_0x35993c[_0x2678('0x12')];this[_0x2678('0x13')]=_0x35993c[_0x2678('0x13')];this[_0x2678('0xa')]=_0x35993c[_0x2678('0xa')];this[_0x2678('0x14')]=_0x35993c[_0x2678('0x15')];this[_0x2678('0x16')]=_0x35993c['number'];this[_0x2678('0x17')]=_0x35993c[_0x2678('0x17')];this[_0x2678('0x18')]=_0x35993c['responsetime'];this[_0x2678('0x19')]=_0x35993c[_0x2678('0x18')];this['ringtime']=getSeconds(_0x35993c['responsetime'],_0x35993c[_0x2678('0x17')]);this['holdtime']=0x0;this[_0x2678('0x1a')]=0x0;this[_0x2678('0x1b')]=_0x35993c[_0x2678('0x1b')];this[_0x2678('0x1c')]=_0x35993c['callbackuniqueid'];this[_0x2678('0x1d')]=_0x35993c['callbackat'];this[_0x2678('0x1e')]=_0x35993c[_0x2678('0x1e')];this[_0x2678('0x1f')]=_0x35993c['ContactId'];this[_0x2678('0x20')]=_0x35993c[_0x2678('0x20')];this[_0x2678('0x21')]=_0x35993c[_0x2678('0x21')];this['VoiceQueueId']=_0x35993c[_0x2678('0x22')];this[_0x2678('0x23')]=_0x35993c[_0x2678('0x23')];this['originatecalleridnum']=_0x35993c['originatecalleridnum']||'';this[_0x2678('0x24')]=_0x35993c['originatecalleridname']||'';}module[_0x2678('0x25')]=History; \ No newline at end of file +var _0xa75b=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','number','responsetime','ringtime','starttime','holdtime','talktime','callback','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','moment','milliseconds','seconds','uniqueid','scheduledat','type'];(function(_0x391745,_0x372111){var _0x306a99=function(_0x21156b){while(--_0x21156b){_0x391745['push'](_0x391745['shift']());}};_0x306a99(++_0x372111);}(_0xa75b,0x1c1));var _0xba75=function(_0x2620ff,_0x582549){_0x2620ff=_0x2620ff-0x0;var _0x286fae=_0xa75b[_0x2620ff];return _0x286fae;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xba75('0x0'));function getSeconds(_0x22cb7c,_0x4c841c){var _0x35d607=moment(_0x22cb7c)[_0xba75('0x1')](0x0);var _0x3e364e=moment(_0x4c841c)[_0xba75('0x1')](0x0);return _0x35d607['diff'](_0x3e364e,_0xba75('0x2'));}function History(_0x2c388d){this[_0xba75('0x3')]=_0x2c388d['uniqueid'];this['scheduledat']=_0x2c388d[_0xba75('0x4')]||undefined;this[_0xba75('0x5')]=_0x2c388d[_0xba75('0x5')];this[_0xba75('0x6')]=_0x2c388d[_0xba75('0x5')]===_0xba75('0x7')?_0xba75('0x8'):_0x2c388d[_0xba75('0x5')];this[_0xba75('0x9')]=_0x2c388d['countbusyretry'];this[_0xba75('0xa')]=_0x2c388d[_0xba75('0xa')];this['countnoanswerretry']=_0x2c388d[_0xba75('0xb')];this['countglobal']=_0x2c388d[_0xba75('0x9')]+_0x2c388d['countcongestionretry']+_0x2c388d['countnoanswerretry']+_0x2c388d[_0xba75('0xc')]+_0x2c388d['countdropretry']+_0x2c388d['countabandonedretry']+_0x2c388d[_0xba75('0xd')]+_0x2c388d[_0xba75('0xe')];this[_0xba75('0xc')]=_0x2c388d[_0xba75('0xc')];this['countdropretry']=_0x2c388d[_0xba75('0xf')];this[_0xba75('0x10')]=_0x2c388d[_0xba75('0x10')];this[_0xba75('0xd')]=_0x2c388d[_0xba75('0xd')];this[_0xba75('0xe')]=_0x2c388d[_0xba75('0xe')];this[_0xba75('0x8')]=_0x2c388d['queue'];this[_0xba75('0x11')]=_0x2c388d[_0xba75('0x12')];this[_0xba75('0x13')]=_0x2c388d[_0xba75('0x14')];this['starttime']=_0x2c388d['starttime'];this[_0xba75('0x15')]=_0x2c388d[_0xba75('0x15')];this['endtime']=_0x2c388d[_0xba75('0x15')];this[_0xba75('0x16')]=getSeconds(_0x2c388d['responsetime'],_0x2c388d[_0xba75('0x17')]);this[_0xba75('0x18')]=0x0;this[_0xba75('0x19')]=0x0;this[_0xba75('0x1a')]=_0x2c388d[_0xba75('0x1a')];this['callbackuniqueid']=_0x2c388d['callbackuniqueid'];this[_0xba75('0x1b')]=_0x2c388d[_0xba75('0x1b')];this['recallme']=_0x2c388d['recallme'];this[_0xba75('0x1c')]=_0x2c388d['ContactId'];this[_0xba75('0x1d')]=_0x2c388d['ListId'];this[_0xba75('0x1e')]=_0x2c388d['UserId'];this[_0xba75('0x1f')]=_0x2c388d['VoiceQueueId'];this[_0xba75('0x20')]=_0x2c388d[_0xba75('0x20')];this['originatecalleridnum']=_0x2c388d['originatecalleridnum']||'';this['originatecalleridname']=_0x2c388d[_0xba75('0x21')]||'';}module[_0xba75('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 0feae96..2d86014 100644 --- a/server/services/ami/dialer/index.js +++ b/server/services/ami/dialer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaea0=['Action','status','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','checkIsBlackList','[checkIsBlackList]\x20','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','active','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','AMD','[syncHangupInAMD]','Machine','membername','countmachineretry','amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[syncAgentComplete][createHistory][0]','countnoanswerretry','stateGlobal','createStateFinal','reason\x2019\x20machine....','minutes','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countglobal','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridnum','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','channel','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','interval','timezones','content','command','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','originate','Contact','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','object','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','buildObj','congestion','[syncAgentComplete][createHistory][8]','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','run','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','getContactDialer','[countReScheduled]\x20','[actionOriginate]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','dialer','booked','../../../config/logger','predictive','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalErlangCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','stringify','md5','format','ivr','campaign:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','uniqueId','[uniqueid]','clearZombieChannels','undefined','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaea0,0x165));var _0x0aea=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0xaea0[_0x2867d8];return _0x3b8176;};'use strict';var util=require(_0x0aea('0x0'));var _=require(_0x0aea('0x1'));var BPromise=require(_0x0aea('0x2'));var uuid=require(_0x0aea('0x3'));var moment=require(_0x0aea('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x0aea('0x5'));var ut=require(_0x0aea('0x6'));var config=require(_0x0aea('0x7'));var logger=require('../../../config/logger')(_0x0aea('0x8'));var loggerBooked=require('../../../config/logger')(_0x0aea('0x9'));var loggerPredictive=require(_0x0aea('0xa'))(_0x0aea('0xb'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x0aea('0xc'));config[_0x0aea('0xd')]=_[_0x0aea('0xe')](config[_0x0aea('0xd')],{'host':_0x0aea('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0aea('0xd')]));var cmHopper=require(_0x0aea('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x0aea('0x11'));var voiceQueueRt=require(_0x0aea('0x12'));var Action=require(_0x0aea('0x13'));var History=require('./history');var Final=require(_0x0aea('0x14'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x0aea('0x15'));var ipAgi=process[_0x0aea('0x16')][_0x0aea('0x17')]||_0x0aea('0x18');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x0aea('0x19')][_0x0aea('0x1a')]=function(_0x2bee61){this[_0x0aea('0x1b')]=this[_0x0aea('0x1b')]?this[_0x0aea('0x1b')]['finally'](_0x2bee61):_0x2bee61();};function Dialer(_0x2a4c82,_0x2bc986){this[_0x0aea('0x1c')]=new Sequence();this['preview']=_0x2bc986;this[_0x0aea('0x1d')]=_0x2a4c82['voiceQueues'];this[_0x0aea('0x1e')]=_0x2a4c82['campaigns'];this[_0x0aea('0x1f')]=_0x2a4c82[_0x0aea('0x1f')];this['trunks']=_0x2a4c82[_0x0aea('0x20')];this[_0x0aea('0x21')]=config[_0x0aea('0x21')]||0x2;this['channels']={};this[_0x0aea('0x22')]={};this[_0x0aea('0x23')]={};this['uniqueId']={};this[_0x0aea('0x24')]={};this[_0x0aea('0x25')]={};this[_0x0aea('0x26')]={};this['ivrOriginated']={};this[_0x0aea('0x27')]={};this[_0x0aea('0x28')]={};ami['on']('agentconnect',this[_0x0aea('0x29')][_0x0aea('0x2a')](this));ami['on'](_0x0aea('0x2b'),this[_0x0aea('0x2c')]['bind'](this));ami['on'](_0x0aea('0x2d'),this[_0x0aea('0x2e')]['bind'](this));ami['on'](_0x0aea('0x2f'),this[_0x0aea('0x30')]['bind'](this));ami['on']('custom:queuesummary',this[_0x0aea('0x31')][_0x0aea('0x2a')](this));ami['on'](_0x0aea('0x32'),this[_0x0aea('0x33')][_0x0aea('0x2a')](this));ami['on'](_0x0aea('0x34'),this[_0x0aea('0x35')]['bind'](this));ami['on']('varset',this[_0x0aea('0x36')][_0x0aea('0x2a')](this));ami['on']('queuemember',this[_0x0aea('0x37')][_0x0aea('0x2a')](this));ami['on']('queuestatuscomplete',this[_0x0aea('0x38')]['bind'](this));this['loopCampaigns']();this[_0x0aea('0x39')]();}function isNotNull(_0x38216a){return _0x38216a!==null&&!_[_0x0aea('0x3a')](_0x38216a);}function checkIsLoggedIn(_0x5590a1,_0x4b5065){return function(){if(_0x4b5065<=0x0){_0x5590a1['message']=_0x0aea('0x3b');throw _0x5590a1[_0x0aea('0x3c')]+_0x0aea('0x3d');}};}function isActive(_0x3f7e68){return _0x3f7e68;}function checkIsActive(_0x43f1b0,_0x25fd40){return function(){if(!isActive(_0x25fd40)){_0x43f1b0[_0x0aea('0x3e')]=_0x0aea('0x3f');throw _0x43f1b0['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x435153){return function(){if(!isNotNull(_0x435153[_0x0aea('0x40')])){_0x435153[_0x0aea('0x3e')]=_0x0aea('0x41');throw _0x435153[_0x0aea('0x3c')]+_0x0aea('0x42');}if(!isNotNull(_0x435153['Interval']['Intervals'])){_0x435153[_0x0aea('0x3e')]=_0x0aea('0x41');throw _0x435153['name']+_0x0aea('0x42');}if(!isNotNull(_['isEmpty'](_0x435153['Interval'][_0x0aea('0x43')]))){_0x435153[_0x0aea('0x3e')]=_0x0aea('0x41');throw _0x435153[_0x0aea('0x3c')]+_0x0aea('0x42');}};}function msgResponse(_0x5df7e7,_0x501cee,_0x2c95bc){return{'action':_0x5df7e7,'response':_0x501cee,'message':_0x2c95bc,'stack':_0x2c95bc};}function myreject(_0x28390f){return function(_0x40006a){return _0x28390f(msgResponse(_0x0aea('0x44'),_0x0aea('0x45'),JSON['stringify'](_0x40006a)));};}function getSeconds(_0x2b0bc3,_0x4568d1){var _0x4ef5c4=moment(_0x2b0bc3)[_0x0aea('0x46')](0x0);var _0x2f9e5e=moment(_0x4568d1)['milliseconds'](0x0);return _0x4ef5c4[_0x0aea('0x47')](_0x2f9e5e,_0x0aea('0x48'));}function emit(_0x451f3a,_0x3d0951,_0x1b3520){io['to'](_0x451f3a)[_0x0aea('0x49')](_0x3d0951,_0x1b3520);}function emitVoiceQueueSummary(_0x5f0d48){if(_0x5f0d48[_0x0aea('0x4a')]===_0x0aea('0x4b')){var _0x72d5ce={'id':_0x5f0d48['id'],'name':_0x5f0d48[_0x0aea('0x3c')],'strategy':_0x5f0d48[_0x0aea('0x4c')],'answered':_0x5f0d48[_0x0aea('0x4d')],'available':_0x5f0d48[_0x0aea('0x4e')],'loggedIn':_0x5f0d48[_0x0aea('0x4f')],'pTalking':_0x5f0d48[_0x0aea('0x50')],'sumBillable':_0x5f0d48['sumBillable'],'sumDuration':_0x5f0d48[_0x0aea('0x51')],'sumHoldTime':_0x5f0d48[_0x0aea('0x52')]||0x0,'talking':_0x5f0d48[_0x0aea('0x53')],'total':_0x5f0d48[_0x0aea('0x54')],'type':_0x5f0d48['type'],'unmanaged':_0x5f0d48['unmanaged'],'abandoned':_0x5f0d48[_0x0aea('0x55')],'waiting':_0x5f0d48[_0x0aea('0x56')],'loggedInDb':_0x5f0d48[_0x0aea('0x57')],'dialActive':_0x5f0d48[_0x0aea('0x58')],'dialMethod':_0x5f0d48['dialMethod'],'dialOriginateCallerIdName':_0x5f0d48['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5f0d48[_0x0aea('0x59')],'dialOriginateTimeout':_0x5f0d48[_0x0aea('0x5a')],'dialPrefix':_0x5f0d48[_0x0aea('0x5b')],'outboundAnswerAgiCallsDay':_0x5f0d48[_0x0aea('0x5c')],'outboundAnswerCallsDay':_0x5f0d48['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5f0d48[_0x0aea('0x5d')],'outboundBusyCallsDay':_0x5f0d48[_0x0aea('0x5e')],'outboundCongestionCallsDay':_0x5f0d48[_0x0aea('0x5f')],'outboundDropCallsDayACS':_0x5f0d48['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x5f0d48['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5f0d48[_0x0aea('0x60')],'outboundNoAnswerCallsDay':_0x5f0d48[_0x0aea('0x61')],'outboundNoSuchCallsDay':_0x5f0d48[_0x0aea('0x62')],'outboundOriginateFailureCallsDay':_0x5f0d48[_0x0aea('0x63')],'outboundReCallsDay':_0x5f0d48['outboundReCallsDay'],'outboundRejectCallsDay':_0x5f0d48[_0x0aea('0x64')],'outboundUnknownCallsDay':_0x5f0d48['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x5f0d48['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5f0d48[_0x0aea('0x65')],'predictiveIntervalAvgTalktime':_0x5f0d48['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5f0d48['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x5f0d48['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5f0d48[_0x0aea('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x5f0d48['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5f0d48['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x5f0d48['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5f0d48[_0x0aea('0x67')],'predictiveIntervalAvailable':_0x5f0d48[_0x0aea('0x68')],'predictiveIntervalTotalCalls':_0x5f0d48[_0x0aea('0x69')],'message':_0x5f0d48[_0x0aea('0x3e')],'originated':_0x5f0d48['originated'],'erlangCalls':_0x5f0d48[_0x0aea('0x6a')],'erlangCallToSecond':_0x5f0d48[_0x0aea('0x6b')],'erlangAbandonmentRate':_0x5f0d48[_0x0aea('0x6c')],'erlangBusyFactor':_0x5f0d48[_0x0aea('0x6d')],'startPredictive':_0x5f0d48[_0x0aea('0x25')],'startProgressive':_0x5f0d48['startProgressive']};if(_0x5f0d48[_0x0aea('0x6e')]){_0x72d5ce[_0x0aea('0x6e')]={'id':_0x5f0d48[_0x0aea('0x6e')]['id'],'name':_0x5f0d48[_0x0aea('0x6e')][_0x0aea('0x3c')],'active':_0x5f0d48[_0x0aea('0x6e')]['active'],'callerid':_0x5f0d48['Trunk']['callerid']};}if(_0x5f0d48[_0x0aea('0x40')]){_0x72d5ce['Interval']={'id':_0x5f0d48[_0x0aea('0x40')]['id'],'name':_0x5f0d48[_0x0aea('0x40')][_0x0aea('0x3c')]};}var _0x14766b=md5(JSON[_0x0aea('0x6f')](_0x72d5ce));if(_0x5f0d48[_0x0aea('0x70')]!==_0x14766b){_0x5f0d48[_0x0aea('0x70')]=_0x14766b;emit(util[_0x0aea('0x71')]('voice:queue:%s',_0x72d5ce[_0x0aea('0x3c')]),'voice_queue:save',_0x72d5ce);}}}function emitCampaignSummary(_0x3cf957){if(_0x3cf957[_0x0aea('0x4a')]===_0x0aea('0x72')){emit(util[_0x0aea('0x71')]('campaign:ivr:%s',_0x3cf957[_0x0aea('0x3c')]),_0x0aea('0x73'),_0x3cf957);}}function checkGetDataPredictive(_0x5d0433){if(isNotNull(_0x5d0433)&&!_[_0x0aea('0x74')](_0x5d0433)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x0aea('0x75')](_0x0aea('0x76'),_0x5d0433[_0x0aea('0x69')]);loggerPredictive['info'](_0x0aea('0x77'),_0x5d0433[_0x0aea('0x78')]);loggerPredictive['info'](_0x0aea('0x79'),_0x5d0433['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x0aea('0x7a'),_0x5d0433[_0x0aea('0x7b')]);loggerPredictive[_0x0aea('0x75')](_0x0aea('0x7c'),_0x5d0433['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d0433[_0x0aea('0x7d')]);loggerPredictive[_0x0aea('0x75')](_0x0aea('0x7e'));if(_0x5d0433[_0x0aea('0x69')]>0x0){if(!_[_0x0aea('0x3a')](_0x5d0433[_0x0aea('0x7d')])&&_0x5d0433[_0x0aea('0x7d')]>0x0){return!![];}loggerPredictive[_0x0aea('0x75')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0aea('0x3a')](_0x5d0433[_0x0aea('0x65')])&&_0x5d0433['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0aea('0x75')](_0x0aea('0x7f'));}else{loggerPredictive[_0x0aea('0x75')](_0x0aea('0x80'));}}else{loggerPredictive['info'](_0x0aea('0x81'));}return![];}function mergeDataErlangB(_0x1fb1f7){return function(_0x1e8726){loggerPredictive[_0x0aea('0x75')](_0x0aea('0x82'));loggerPredictive[_0x0aea('0x75')](_0x0aea('0x83'),_0x1e8726[_0x0aea('0x6a')]);loggerPredictive['info'](_0x0aea('0x84'),_0x1e8726[_0x0aea('0x6b')]);loggerPredictive[_0x0aea('0x75')](_0x0aea('0x85'),_0x1e8726[_0x0aea('0x6c')]);loggerPredictive['info'](_0x0aea('0x86'),_0x1e8726[_0x0aea('0x6d')]);loggerPredictive[_0x0aea('0x75')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e8726[_0x0aea('0x6c')]);loggerPredictive['info'](_0x0aea('0x7e'));_['merge'](_0x1fb1f7,_0x1e8726);};}function getDiff(_0x52f1d1){var _0x1be9a4=moment()[_0x0aea('0x46')](0x0);var _0x1f1df8=moment(_0x52f1d1)['milliseconds'](0x0);return _0x1be9a4[_0x0aea('0x47')](_0x1f1df8,'seconds');}function ifInterval(_0x5a0f52,_0x36edfb){if(_[_0x0aea('0x3a')](_0x36edfb)){return![];}return getDiff(_0x36edfb)<_0x5a0f52*0x3c;}function freeVariablesPredictive(_0x410102){if(isNotNull(_0x410102)){if(!_['isUndefined'](_0x410102[_0x0aea('0x26')])){_0x410102[_0x0aea('0x26')]=undefined;loggerPredictive[_0x0aea('0x75')](_0x410102['name'],_0x0aea('0x87'));}if(!_[_0x0aea('0x3a')](_0x410102['startPredictive'])){_0x410102[_0x0aea('0x25')]=undefined;loggerPredictive[_0x0aea('0x75')](_0x410102[_0x0aea('0x3c')],_0x0aea('0x88'));}if(!_['isUndefined'](_0x410102[_0x0aea('0x89')])){clearInterval(_0x410102[_0x0aea('0x89')]);_0x410102[_0x0aea('0x89')]=undefined;loggerPredictive[_0x0aea('0x75')](_0x410102['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x56c69a,_0x1acc44){if(_0x1acc44===0x0){return 0x0;}var _0x461e2f=0x1;for(var _0x45012c=0x1;_0x45012c<=_0x1acc44;_0x45012c+=0x1){_0x461e2f=0x1+_0x461e2f*_0x45012c/_0x56c69a;}return 0x1/_0x461e2f;}function isVoiceQueueOutbound(_0x11df25){return _0x11df25===_0x0aea('0x4b');}function isNotPreview(_0x53ebe2){return _0x53ebe2!==_0x0aea('0x8a');}function isCampaignIvr(_0x2062fc){return _0x2062fc===_0x0aea('0x72');}function getCallerId(_0x298f03,_0x261c7e,_0x2ada3c){if(!_[_0x0aea('0x3a')](_0x2ada3c)&&typeof _0x2ada3c==='string'&&!_['isEmpty'](_0x2ada3c)){if(!_['isUndefined'](_0x261c7e)&&typeof _0x261c7e===_0x0aea('0x8b')&&!_['isEmpty'](_0x261c7e)){return util['format'](_0x0aea('0x8c'),_0x261c7e,_0x2ada3c);}return util[_0x0aea('0x71')](_0x0aea('0x8c'),_0x2ada3c,_0x2ada3c);}if(!_[_0x0aea('0x3a')](_0x298f03)&&typeof _0x298f03===_0x0aea('0x8b')&&!_[_0x0aea('0x74')](_0x298f03)){return _0x298f03;}return _0x0aea('0x8d');}function loggerCatchQueueSummary(_0x998bf7,_0x34ca53){return function(_0x1ef9ab){freeVariablesPredictive(_0x34ca53);emitVoiceQueueSummary(_0x34ca53);emitCampaignSummary(_0x34ca53);loggerSyncQueueSummary[_0x0aea('0x8e')](_0x998bf7,util['inspect'](_0x1ef9ab,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1e3bee,_0x5cbaf2){return function(_0xe1d22){loggerPredictive[_0x0aea('0x8e')](_0x5cbaf2['name'],_0x1e3bee);loggerPredictive['error'](_0xe1d22['stack']);freeVariablesPredictive(_0x5cbaf2);};}function loggerCatch(_0x4b04eb){return function(_0x26c4e7){logger[_0x0aea('0x8e')](_0x4b04eb,util['inspect'](_0x26c4e7,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4f4c8a){return _0x4f4c8a&&!_['isUndefined'](_0x4f4c8a)&&_0x4f4c8a[_0x0aea('0x8f')]>0x0;}function decremetOriginate(_0x4f5c11){if(!_[_0x0aea('0x3a')](_0x4f5c11)&&_0x4f5c11!==null){if(typeof _0x4f5c11[_0x0aea('0x90')]!=='undefined'){if(_0x4f5c11[_0x0aea('0x90')]>0x0){_0x4f5c11[_0x0aea('0x90')]-=0x1;}else{logger[_0x0aea('0x8e')](_0x0aea('0x91'));}}}else{logger['error'](_0x0aea('0x92'));}}function checkContactLowerLimitOriginate(_0x248b3f,_0x364a17,_0x5e203f){if(_0x364a17>_0x5e203f){for(var _0xc96d53=0x0;_0xc96d53<_0x364a17-_0x5e203f;_0xc96d53+=0x1){decremetOriginate(_0x248b3f);}}}function loggerGetContactDialer(_0x3e60ff,_0x170cb4,_0x97d65b){return function(_0x278440){checkContactLowerLimitOriginate(_0x170cb4,_0x97d65b,0x0);logger[_0x0aea('0x8e')](_0x3e60ff,util[_0x0aea('0x93')](_0x278440,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xcc1f32){return function(_0x39a4a4){if(isNotNull(_0x39a4a4)&&isNotNull(_0x39a4a4[0x0])){if(_0x39a4a4[0x0][_0x0aea('0x94')]>0x0){_0xcc1f32[_0x0aea('0x3e')]=_0x0aea('0x95');logger[_0x0aea('0x75')](_0x0aea('0x96')+_0xcc1f32[_0x0aea('0x3c')],_0x39a4a4[0x0][_0x0aea('0x94')],_0x0aea('0x97'));}else{_0xcc1f32[_0x0aea('0x3e')]=_0x0aea('0x98');logger[_0x0aea('0x75')](_0x0aea('0x99')+_0xcc1f32[_0x0aea('0x3c')]);}}};}function notSendMessagesQueue(_0x8e1ad5){if(_0x8e1ad5[_0x0aea('0x9a')]){freeVariablesPredictive(_0x8e1ad5);if(_0x8e1ad5['originated']===0x0&&_0x8e1ad5[_0x0aea('0x53')]===0x0&&_0x8e1ad5[_0x0aea('0x56')]===0x0&&(_0x8e1ad5[_0x0aea('0x50')]||0x0)===0x0){_0x8e1ad5[_0x0aea('0x9a')]=![];_0x8e1ad5[_0x0aea('0x4e')]=0x0;_0x8e1ad5[_0x0aea('0x3e')]=_0x0aea('0x3f');loggerSyncQueueSummary['error'](_0x0aea('0x9b'),_0x8e1ad5[_0x0aea('0x3c')],_0x0aea('0x9c'));}else{_0x8e1ad5['message']=_0x0aea('0x9d');loggerSyncQueueSummary['error'](_0x0aea('0x9b'),_0x8e1ad5[_0x0aea('0x3c')],_0x0aea('0x9e'));}emitVoiceQueueSummary(_0x8e1ad5);}}function notSendMessagesCampaign(_0x3348ae){if(_0x3348ae[_0x0aea('0x9a')]){if(_0x3348ae[_0x0aea('0x90')]===0x0){_0x3348ae[_0x0aea('0x9a')]=![];_0x3348ae[_0x0aea('0x3e')]=_0x0aea('0x3f');loggerSyncQueueSummary[_0x0aea('0x8e')](_0x0aea('0x9f'),_0x3348ae[_0x0aea('0x3c')],_0x0aea('0x9c'));}else{_0x3348ae[_0x0aea('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x0aea('0x8e')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3348ae[_0x0aea('0x3c')],_0x0aea('0x9e'));}emitCampaignSummary(_0x3348ae);}}function createObjHistory(_0x78bc2e,_0x4876b4,_0x2b1678,_0x4841ea,_0x4e92dd){_0x78bc2e[_0x0aea('0x3e')]=_0x2b1678;var _0x7493d9=new Action(_0x78bc2e,_0x4876b4);var _0x3509d6=new History(_0x7493d9);_0x3509d6[_0x0aea('0xa0')]=_0x4841ea;_0x3509d6[_0x0aea('0xa1')]=_0x4e92dd;_0x3509d6[_0x0aea('0xa2')]=_0x7493d9['starttime'];return _0x3509d6;}Dialer[_0x0aea('0x19')][_0x0aea('0x39')]=function(){var _0x4def1f=this;setInterval(function(){_0x4def1f['clearZombieChannels'](_0x4def1f[_0x0aea('0xa3')],_0x0aea('0xa4'));_0x4def1f['clearZombieChannels'](_0x4def1f[_0x0aea('0x22')],'[actions]');},0x32c8);};Dialer['prototype'][_0x0aea('0xa5')]=function(_0x442e88,_0x10cb6f){var _0x3792f3=this;for(var _0x598af3 in _0x442e88){if(typeof _0x442e88[_0x598af3]!==_0x0aea('0xa6')){this[_0x0aea('0x1c')][_0x0aea('0x1a')](function(){if(!_[_0x0aea('0xa7')](_0x442e88[_0x598af3])){return ami[_0x0aea('0xa8')]({'action':_0x0aea('0xa9'),'channel':_0x442e88[_0x598af3]['channel']})['catch'](function(_0xe86128){if(_0xe86128[_0x0aea('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x442e88[_0x598af3]&&_0x442e88[_0x598af3][_0x0aea('0x4a')]!==_0x0aea('0x72')){_0x3792f3[_0x0aea('0xaa')](_0x3792f3[_0x0aea('0x1d')][_0x442e88[_0x598af3]['queue']]);logger['error'](_0x0aea('0xab'),_0x10cb6f,_0x598af3,_0x442e88[_0x598af3][_0x0aea('0xac')]);delete _0x442e88[_0x598af3];}if(_0x442e88[_0x598af3]&&_0x442e88[_0x598af3][_0x0aea('0x4a')]==='ivr'){_0x3792f3[_0x0aea('0xaa')](_0x3792f3[_0x0aea('0x1e')][_0x442e88[_0x598af3][_0x0aea('0xac')]]);logger[_0x0aea('0x8e')](_0x0aea('0xad'),_0x10cb6f,_0x598af3,_0x442e88[_0x598af3]['queue']);delete _0x442e88[_0x598af3];}},0x2328);}});}});}}};Dialer['prototype'][_0x0aea('0xae')]=function(_0x2e4322){return BPromise['resolve']()[_0x0aea('0xaf')](cmHopper[_0x0aea('0xae')](_0x2e4322))[_0x0aea('0xb0')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x0aea('0x19')][_0x0aea('0xb1')]=function(_0x57c370){return BPromise['resolve']()[_0x0aea('0xaf')](cmHopperBlack[_0x0aea('0xb1')](_0x57c370))['catch'](loggerCatch(_0x0aea('0xb2')));};Dialer[_0x0aea('0x19')]['checkIsBlackListIvr']=function(_0x343e5f){return BPromise[_0x0aea('0xb3')]()[_0x0aea('0xaf')](cmHopperBlack[_0x0aea('0xb4')](_0x343e5f))[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xb5')));};Dialer[_0x0aea('0x19')]['averageHandleTime']=function(_0x391215){return BPromise[_0x0aea('0xb3')]()[_0x0aea('0xaf')](cmHopperHistory[_0x0aea('0xb6')](_0x391215))[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xb7')));};Dialer['prototype'][_0x0aea('0xb8')]=function(_0x52a8e){return BPromise[_0x0aea('0xb3')]()[_0x0aea('0xaf')](cmHopper['rescheduleContact'](_0x52a8e))[_0x0aea('0xb0')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x0aea('0xb9')]=function(_0x2668e5,_0x167d40,_0x29254b){return BPromise[_0x0aea('0xb3')]()[_0x0aea('0xaf')](cmHopper['unlockContact'](_0x2668e5,_0x167d40,_0x29254b))[_0x0aea('0xb0')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x0aea('0x19')]['getContactDialer']=function(_0x20c275,_0x419a6b,_0x1316be,_0x531a3a){return BPromise[_0x0aea('0xb3')]()[_0x0aea('0xaf')](cmHopper['getContactDialer'](_0x20c275,_0x419a6b,_0x1316be,_0x531a3a))['catch'](loggerCatch(_0x0aea('0xba')));};Dialer[_0x0aea('0x19')][_0x0aea('0xbb')]=function(_0x387df5,_0x49326e,_0x2a7158){return BPromise['resolve']()[_0x0aea('0xaf')](cmHopper[_0x0aea('0xbb')](_0x387df5,_0x49326e,_0x2a7158))['catch'](loggerCatch(_0x0aea('0xba')));};Dialer[_0x0aea('0x19')][_0x0aea('0xbc')]=function(_0x5e7373){return BPromise['resolve']()[_0x0aea('0xaf')](voiceQueueRt[_0x0aea('0xbc')](_0x5e7373))[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xbd')));};Dialer[_0x0aea('0x19')][_0x0aea('0xbe')]=function(_0x422490){return BPromise['resolve']()[_0x0aea('0xaf')](cmHopper['moveContactManagedDialer'](_0x422490))[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xbf')));};Dialer['prototype'][_0x0aea('0xc0')]=function(_0x46521f){return BPromise[_0x0aea('0xb3')]()[_0x0aea('0xaf')](cmHopperHistory[_0x0aea('0xc0')](_0x46521f))[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xc1')));};Dialer[_0x0aea('0x19')][_0x0aea('0xaa')]=function(_0x2197e9){if(!_[_0x0aea('0x3a')](_0x2197e9)&&_0x2197e9!==null){if(typeof _0x2197e9[_0x0aea('0x90')]!==_0x0aea('0xa6')){if(_0x2197e9[_0x0aea('0x90')]>0x0){_0x2197e9[_0x0aea('0x90')]-=0x1;}else{logger[_0x0aea('0x8e')](_0x0aea('0xc2'));}}}else{logger['error'](_0x0aea('0xc3'));}};Dialer[_0x0aea('0x19')][_0x0aea('0xc4')]=function(_0x5f7deb,_0xc243f7){var _0x13f91d=this;return function(_0xb37c6b){_0x13f91d[_0x0aea('0xaa')](_0xc243f7);logger[_0x0aea('0x8e')](_0x5f7deb,util[_0x0aea('0x93')](_0xb37c6b,{'showHidden':![],'depth':null}));};};Dialer[_0x0aea('0x19')]['emptyContact']=function(_0x322996,_0xe7c850,_0x10001e){var _0x1d2fd9={'state':0x19,'statedesc':_0x0aea('0xc5')};this[_0x0aea('0xaa')](_0xe7c850);this[_0x0aea('0xc6')](_[_0x0aea('0xc7')](_0x1d2fd9,_[_0x0aea('0xc8')](_0x10001e,[_0x0aea('0xc9'),_0x0aea('0xca'),_0x0aea('0xcb'),_0x0aea('0xcc'),_0x0aea('0xcd')])),_0x0aea('0xce'),_0x0aea('0xcf'));logger[_0x0aea('0x8e')](_0x322996);};Dialer[_0x0aea('0x19')][_0x0aea('0xd0')]=function(_0x9c776){return _0x9c776==='Success';};Dialer['prototype'][_0x0aea('0xd1')]=function(_0x5d6200){return!_[_0x0aea('0x3a')](_0x5d6200)&&_0x5d6200&&!_[_0x0aea('0x3a')](_0x5d6200['name'])&&!_[_0x0aea('0x3a')](_0x5d6200[_0x0aea('0xd2')])&&_0x5d6200[_0x0aea('0xd2')]&&(this[_0x0aea('0x20')][util[_0x0aea('0x71')](_0x0aea('0xd3'),_0x5d6200[_0x0aea('0x3c')])]['status']==='reachable'||this[_0x0aea('0x20')][util['format'](_0x0aea('0xd3'),_0x5d6200['name'])]['status']==='unmonitored');};Dialer[_0x0aea('0x19')][_0x0aea('0xc6')]=function(_0x43c09f,_0x34bb76,_0x4e6a4f){this['createHistory'](_0x43c09f)['catch'](loggerCatch(_0x34bb76));this[_0x0aea('0xbe')](_0x43c09f)[_0x0aea('0xb0')](loggerCatch(_0x4e6a4f));};Dialer['prototype'][_0x0aea('0x36')]=function(_0x42c475){var _0x1b2228=this['uniqueId'][_0x42c475[_0x0aea('0xd4')]];var _0x5e37cb;if(!_['isNil'](_0x42c475)&&!_[_0x0aea('0xa7')](_0x42c475[_0x0aea('0xd5')])&&!_[_0x0aea('0xa7')](_0x42c475[_0x0aea('0xd5')][_0x0aea('0xd6')])&&_0x42c475[_0x0aea('0xd7')]===_0x0aea('0xd8')&&_0x1b2228){if(_0x1b2228[_0x0aea('0x4a')]!=='ivr'&&this[_0x0aea('0x1d')][_0x1b2228[_0x0aea('0xac')]][_0x0aea('0xd9')]&&_0x42c475[_0x0aea('0xda')]===_0x0aea('0xdb')){delete this['uniqueId'][_0x42c475[_0x0aea('0xd4')]];this[_0x0aea('0xaa')](this[_0x0aea('0x1d')][_0x1b2228[_0x0aea('0xac')]]);this[_0x0aea('0x1d')][_0x1b2228[_0x0aea('0xac')]][_0x0aea('0xdc')]+=0x1;this['voiceQueues'][_0x1b2228['queue']][_0x0aea('0x5c')]+=0x1;_0x5e37cb=new Hangup(_0x1b2228,_0x42c475);_0x5e37cb['state']=0x12;_0x5e37cb[_0x0aea('0xa1')]='HangupInAMD';_0x5e37cb['membername']=_0x0aea('0xdd');this[_0x0aea('0xc6')](_0x5e37cb,'[syncHangupInAMD][createHistory]',_0x0aea('0xde'));}if(_0x1b2228[_0x0aea('0x4a')]!==_0x0aea('0x72')&&this[_0x0aea('0x1d')][_0x1b2228[_0x0aea('0xac')]][_0x0aea('0xd9')]&&_0x42c475[_0x0aea('0xda')]==='MACHINE'){var _0x1e4b71=this;return new BPromise(function(_0x38cb97,_0x5b234d){delete _0x1e4b71[_0x0aea('0xa3')][_0x42c475[_0x0aea('0xd4')]];_0x1e4b71[_0x0aea('0xaa')](_0x1e4b71['voiceQueues'][_0x1b2228[_0x0aea('0xac')]]);_0x1e4b71['voiceQueues'][_0x1b2228[_0x0aea('0xac')]]['outboundAnswerCallsDay']+=0x1;_0x1e4b71['voiceQueues'][_0x1b2228[_0x0aea('0xac')]][_0x0aea('0x5c')]+=0x1;var _0x534f63=_0x1e4b71['voiceQueues'][_0x1b2228[_0x0aea('0xac')]];var _0x2221e5=new Hangup(_0x1b2228,_0x42c475);_0x2221e5[_0x0aea('0xa0')]=0x13;_0x2221e5[_0x0aea('0xa1')]=_0x0aea('0xdf');_0x2221e5[_0x0aea('0xe0')]=_0x0aea('0xdd');_0x2221e5[_0x0aea('0xe1')]+=0x1;_0x2221e5['countglobal']+=0x1;_0x2221e5[_0x0aea('0xe2')]=!![];_0x1e4b71[_0x0aea('0xc0')](_0x2221e5)[_0x0aea('0xb0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2221e5[_0x0aea('0xe3')]+_0x2221e5[_0x0aea('0xe4')]+_0x2221e5['countnoanswerretry']+_0x2221e5[_0x0aea('0xe5')]+_0x2221e5[_0x0aea('0xe6')]+_0x2221e5[_0x0aea('0xe7')]+_0x2221e5[_0x0aea('0xe1')]+_0x2221e5[_0x0aea('0xe8')]>=_0x534f63[_0x0aea('0xe9')]){_0x1e4b71['stateGlobal'](_0x2221e5,_0x38cb97,_0x5b234d,_0x0aea('0xea'));}else{if(_0x2221e5['countmachineretry']>=_0x534f63[_0x0aea('0xeb')]){_0x1e4b71['createStateFinal'](_0x2221e5,_0x38cb97,_0x5b234d,'reason\x2019\x20machine....');}else{_0x1e4b71[_0x0aea('0xb8')]({'active':![],'countmachineretry':_0x2221e5['countmachineretry'],'scheduledat':moment()[_0x0aea('0xec')](_0x534f63[_0x0aea('0xed')],'minutes')[_0x0aea('0x71')](_0x0aea('0xee')),'ContactId':_0x2221e5['ContactId'],'ListId':_0x2221e5['ListId'],'VoiceQueueId':_0x2221e5[_0x0aea('0xcc')]||undefined,'CampaignId':_0x2221e5[_0x0aea('0xcd')]||undefined})[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xef')));_0x38cb97({'reschedule':0x1});}}});}if(_0x1b2228[_0x0aea('0x4a')]===_0x0aea('0x72')&&this[_0x0aea('0x1e')][_0x1b2228[_0x0aea('0xac')]][_0x0aea('0xd9')]&&_0x42c475['value']==='HANGUP'){delete this[_0x0aea('0xa3')][_0x42c475[_0x0aea('0xd4')]];this['updateOriginated'](this[_0x0aea('0x1e')][_0x1b2228[_0x0aea('0xac')]]);_0x5e37cb=new Hangup(_0x1b2228,_0x42c475);_0x5e37cb[_0x0aea('0xa0')]=0x12;_0x5e37cb[_0x0aea('0xa1')]=_0x0aea('0xf0');_0x5e37cb[_0x0aea('0xe0')]='AMD';this['saveInDb'](_0x5e37cb,_0x0aea('0xf1'),_0x0aea('0xf2'));}if(_0x1b2228[_0x0aea('0x4a')]===_0x0aea('0x72')&&this['campaigns'][_0x1b2228[_0x0aea('0xac')]]['dialAMDActive']&&_0x42c475['value']===_0x0aea('0xf3')){var _0x1e4b71=this;return new BPromise(function(_0x3d12a8,_0x5cc024){delete _0x1e4b71[_0x0aea('0xa3')][_0x42c475['uniqueid']];_0x1e4b71[_0x0aea('0xaa')](_0x1e4b71[_0x0aea('0x1e')][_0x1b2228[_0x0aea('0xac')]]);_0x1e4b71['campaigns'][_0x1b2228[_0x0aea('0xac')]][_0x0aea('0xdc')]+=0x1;_0x1e4b71[_0x0aea('0x1e')][_0x1b2228[_0x0aea('0xac')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x234b6a=_0x1e4b71['campaigns'][_0x1b2228[_0x0aea('0xac')]];var _0x1f3250=new Hangup(_0x1b2228,_0x42c475);_0x1f3250[_0x0aea('0xa0')]=0x13;_0x1f3250[_0x0aea('0xa1')]=_0x0aea('0xdf');_0x1f3250['membername']='AMD';_0x1f3250[_0x0aea('0xe1')]+=0x1;_0x1f3250['countglobal']+=0x1;_0x1f3250['amd']=!![];_0x1e4b71[_0x0aea('0xc0')](_0x1f3250)['catch'](loggerCatch(_0x0aea('0xf4')));if(_0x1f3250[_0x0aea('0xe3')]+_0x1f3250[_0x0aea('0xe4')]+_0x1f3250[_0x0aea('0xf5')]+_0x1f3250[_0x0aea('0xe5')]+_0x1f3250[_0x0aea('0xe6')]+_0x1f3250[_0x0aea('0xe7')]+_0x1f3250[_0x0aea('0xe1')]+_0x1f3250[_0x0aea('0xe8')]>=_0x234b6a[_0x0aea('0xe9')]){_0x1e4b71[_0x0aea('0xf6')](_0x1f3250,_0x3d12a8,_0x5cc024,_0x0aea('0xea'));}else{if(_0x1f3250[_0x0aea('0xe1')]>=_0x234b6a['dialMachineMaxRetry']){_0x1e4b71[_0x0aea('0xf7')](_0x1f3250,_0x3d12a8,_0x5cc024,_0x0aea('0xf8'));}else{_0x1e4b71[_0x0aea('0xb8')]({'active':![],'countmachineretry':_0x1f3250[_0x0aea('0xe1')],'scheduledat':moment()[_0x0aea('0xec')](_0x234b6a['dialMachineRetryFrequency'],_0x0aea('0xf9'))['format'](_0x0aea('0xee')),'ContactId':_0x1f3250[_0x0aea('0xc9')],'ListId':_0x1f3250[_0x0aea('0xca')],'VoiceQueueId':_0x1f3250['VoiceQueueId']||undefined,'CampaignId':_0x1f3250[_0x0aea('0xcd')]||undefined})[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xef')));_0x3d12a8({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x0aea('0x33')]=function(_0x2cd3ae){var _0x2e24ad=this[_0x0aea('0xa3')][_0x2cd3ae['uniqueid']];var _0xec9d63=this;var _0x3db939;if(_0x2e24ad&&_0x2e24ad[_0x0aea('0x4a')]===_0x0aea('0x72')){delete this['uniqueId'][_0x2cd3ae[_0x0aea('0xd4')]];this[_0x0aea('0xaa')](this[_0x0aea('0x1e')][_0x2e24ad[_0x0aea('0xac')]]);this[_0x0aea('0x1e')][_0x2e24ad[_0x0aea('0xac')]]['ivrAnswerCallsDay']+=0x1;_0x3db939=new Hangup(_0x2e24ad,_0x2cd3ae);this['createHistory'](_0x3db939)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xfa')));this[_0x0aea('0xbe')](_0x3db939)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xfb')));}if(_0x2e24ad&&_0x2e24ad[_0x0aea('0x4a')]!==_0x0aea('0x72')&&isNotNull(this[_0x0aea('0x1d')][_0x2e24ad[_0x0aea('0xac')]]['dialQueueProject'])){delete this['uniqueId'][_0x2cd3ae[_0x0aea('0xd4')]];this['updateOriginated'](this[_0x0aea('0x1d')][_0x2e24ad['queue']]);this['voiceQueues'][_0x2e24ad[_0x0aea('0xac')]][_0x0aea('0xdc')]+=0x1;this['voiceQueues'][_0x2e24ad[_0x0aea('0xac')]]['outboundAnswerAgiCallsDay']+=0x1;_0x3db939=new Hangup(_0x2e24ad,_0x2cd3ae);_0x3db939[_0x0aea('0xa0')]=0x10;_0x3db939[_0x0aea('0xa1')]=_0x0aea('0xfc');_0x3db939[_0x0aea('0xe0')]=_0x0aea('0xfd');this[_0x0aea('0xc0')](_0x3db939)[_0x0aea('0xb0')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0aea('0xbe')](_0x3db939)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xfb')));}if(_0x2e24ad&&_0x2e24ad['type']!==_0x0aea('0x72')&&!isNotNull(this['voiceQueues'][_0x2e24ad['queue']][_0x0aea('0xfe')])){delete this[_0x0aea('0xa3')][_0x2cd3ae['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x2e24ad[_0x0aea('0xac')]]);this['voiceQueues'][_0x2e24ad['queue']]['outboundUnknownCallsDay']+=0x1;_0x3db939=new Hangup(_0x2e24ad,_0x2cd3ae);_0x3db939[_0x0aea('0xa0')]=0xc;_0x3db939[_0x0aea('0xa1')]=_0x2cd3ae[_0x0aea('0xff')];_0x3db939['membername']=_0x0aea('0x100');this['createHistory'](_0x3db939)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xfa')));this[_0x0aea('0xbe')](_0x3db939)[_0x0aea('0xb0')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0x0aea('0x30')]=function(_0x2e0f5a){var _0x47dd0c=this[_0x0aea('0xa3')][_0x2e0f5a[_0x0aea('0xd4')]];var _0x15426e=this;if(this[_0x0aea('0x1d')][_0x2e0f5a[_0x0aea('0xac')]]){if(_0x47dd0c&&_0x47dd0c[_0x0aea('0x4a')]!==_0x0aea('0x72')){delete this['uniqueId'][_0x2e0f5a[_0x0aea('0xd4')]];this[_0x0aea('0x1d')][_0x2e0f5a['queue']]['outboundAnswerCallsDay']+=0x1;var _0x37339f=new AgentComplete(_0x47dd0c,_0x2e0f5a);if(_0x2e0f5a[_0x0aea('0x101')]===_0x0aea('0x102')){_0x37339f[_0x0aea('0x103')]=this['voiceQueues'][_0x2e0f5a['queue']][_0x0aea('0x104')]&&this[_0x0aea('0x1d')][_0x2e0f5a[_0x0aea('0xac')]][_0x0aea('0x105')]?moment()[_0x0aea('0x71')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x0aea('0xc0')](_0x37339f)['catch'](loggerCatch(_0x0aea('0x106')));this[_0x0aea('0xbe')](_0x37339f)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x0aea('0x19')]['syncAgentConnect']=function(_0x184a76){if(this[_0x0aea('0x1d')][_0x184a76['queue']]){if(this[_0x0aea('0xa3')][_0x184a76[_0x0aea('0xd4')]]&&this[_0x0aea('0xa3')][_0x184a76[_0x0aea('0xd4')]]['type']!=='ivr'){this['updateOriginated'](this['voiceQueues'][_0x184a76['queue']]);this[_0x0aea('0xa3')][_0x184a76[_0x0aea('0xd4')]]['answertime']=moment()[_0x0aea('0x71')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x0aea('0x19')][_0x0aea('0x107')]=function(_0x4555a4){this[_0x0aea('0xc0')](_0x4555a4)['catch'](loggerCatch(_0x0aea('0x106')));this[_0x0aea('0xbe')](_0x4555a4)['catch'](loggerCatch(_0x0aea('0x108')));};Dialer[_0x0aea('0x19')][_0x0aea('0x2c')]=function(_0x2af1f9){var _0xdbce0b=this[_0x0aea('0xa3')][_0x2af1f9[_0x0aea('0xd4')]];var _0x25186a=this;if(this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]]){if(_0xdbce0b&&_0xdbce0b[_0x0aea('0x4a')]!==_0x0aea('0x72')){delete this[_0x0aea('0xa3')][_0x2af1f9['uniqueid']];this[_0x0aea('0xaa')](this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]]);_0xdbce0b['droptime']=moment()[_0x0aea('0x71')](_0x0aea('0xee'));var _0x3cd436=new QueueCallerAbandon(_0xdbce0b,_0x2af1f9);if(getSeconds(_0xdbce0b[_0x0aea('0x109')],_0xdbce0b[_0x0aea('0x10a')])>=_0xdbce0b[_0x0aea('0x10b')]){this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]][_0x0aea('0x10c')]+=0x1;this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]][_0x0aea('0x60')]+=0x1;this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]][_0x0aea('0x10d')]+=0x1;_0x3cd436[_0x0aea('0xa0')]=0xa;_0x3cd436['statedesc']=_0x0aea('0x10e');_0x3cd436['dropreason']=_0x0aea('0x10f');_0x3cd436['agiafterat']=this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]][_0x0aea('0x104')]?moment()['format'](_0x0aea('0xee')):undefined;_0x3cd436['countdropretry']+=0x1;_0x3cd436[_0x0aea('0x110')]+=0x1;if(_0x3cd436[_0x0aea('0xe6')]>=this['voiceQueues'][_0x2af1f9[_0x0aea('0xac')]][_0x0aea('0x111')]){this[_0x0aea('0x107')](_0x3cd436);}else{this[_0x0aea('0xb8')]({'active':![],'countdropretry':_0x3cd436['countdropretry'],'scheduledat':moment()[_0x0aea('0xec')](this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]][_0x0aea('0x112')],_0x0aea('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xdbce0b['ContactId'],'ListId':_0xdbce0b[_0x0aea('0xca')],'VoiceQueueId':_0xdbce0b[_0x0aea('0xcc')]||undefined,'CampaignId':_0xdbce0b[_0x0aea('0xcd')]||undefined})['catch'](loggerCatch(_0x0aea('0x113')));var _0x3285c3=new History(_0x3cd436);_0x3285c3[_0x0aea('0xa0')]=0xa;_0x3285c3[_0x0aea('0xa1')]=_0x0aea('0x10e');_0x3285c3['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3285c3['endtime']=_0x3285c3[_0x0aea('0x114')];_0x3285c3['calleridname']=_0x3cd436['calleridname'];_0x3285c3[_0x0aea('0x115')]=_0x3cd436[_0x0aea('0x115')];this[_0x0aea('0xc0')](_0x3285c3)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x2af1f9[_0x0aea('0xac')]][_0x0aea('0x116')]+=0x1;_0x3cd436['state']=0xb;_0x3cd436[_0x0aea('0xa1')]=_0x0aea('0x117');_0x3cd436[_0x0aea('0x118')]=_0x0aea('0x119');_0x3cd436[_0x0aea('0xe7')]+=0x1;_0x3cd436[_0x0aea('0x110')]+=0x1;if(_0x3cd436['countabandonedretry']>=this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]][_0x0aea('0x11a')]){this[_0x0aea('0x107')](_0x3cd436);}else{this[_0x0aea('0xb8')]({'active':![],'countabandonedretry':_0x3cd436[_0x0aea('0xe7')],'scheduledat':moment()[_0x0aea('0xec')](this[_0x0aea('0x1d')][_0x2af1f9[_0x0aea('0xac')]]['dialAbandonedRetryFrequency'],_0x0aea('0xf9'))[_0x0aea('0x71')](_0x0aea('0xee')),'ContactId':_0xdbce0b[_0x0aea('0xc9')],'ListId':_0xdbce0b['ListId'],'VoiceQueueId':_0xdbce0b[_0x0aea('0xcc')]||undefined,'CampaignId':_0xdbce0b[_0x0aea('0xcd')]||undefined})[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x11b')));var _0x3285c3=new History(_0x3cd436);_0x3285c3[_0x0aea('0xa0')]=0xb;_0x3285c3[_0x0aea('0xa1')]=_0x0aea('0x117');_0x3285c3[_0x0aea('0x114')]=moment()[_0x0aea('0x71')](_0x0aea('0xee'));_0x3285c3[_0x0aea('0xa2')]=_0x3285c3[_0x0aea('0x114')];_0x3285c3['calleridname']=_0x3cd436['calleridname'];_0x3285c3[_0x0aea('0x115')]=_0x3cd436['calleridnum'];this[_0x0aea('0xc0')](_0x3285c3)[_0x0aea('0xb0')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0x0aea('0x35')]=function(_0x2e1392){if(this[_0x0aea('0x22')][_0x2e1392['uniqueid']]){this[_0x0aea('0x22')][_0x2e1392[_0x0aea('0xd4')]][_0x0aea('0x11c')]=_0x2e1392[_0x0aea('0x11c')];}if(this[_0x0aea('0xa3')][_0x2e1392[_0x0aea('0xd4')]]){this[_0x0aea('0xa3')][_0x2e1392['uniqueid']][_0x0aea('0x11c')]=_0x2e1392['channel'];}};Dialer[_0x0aea('0x19')][_0x0aea('0x37')]=function(_0x4a4bb9){if(strategy[this[_0x0aea('0x1d')][this['actions'][_0x4a4bb9[_0x0aea('0x11d')]][_0x0aea('0xac')]]['strategy']]==='roundrobin'){if(this[_0x0aea('0x22')][_0x4a4bb9['actionid']]&&_['isNil'](this[_0x0aea('0x22')][_0x4a4bb9[_0x0aea('0x11d')]][_0x0aea('0x11e')])&&_0x4a4bb9[_0x0aea('0xa9')]==='1'&&_0x4a4bb9[_0x0aea('0x11f')]==='0'){if(this[_0x0aea('0x1f')][_0x4a4bb9['stateinterface']]){if(!this[_0x0aea('0x1f')][_0x4a4bb9[_0x0aea('0x120')]]['locked']){this['agents'][_0x4a4bb9[_0x0aea('0x120')]][_0x0aea('0x11e')]=!![];this['actions'][_0x4a4bb9[_0x0aea('0x11d')]][_0x0aea('0x11e')]=!![];this['actions'][_0x4a4bb9[_0x0aea('0x11d')]][_0x0aea('0x120')]=_0x4a4bb9['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x0aea('0x22')][_0x4a4bb9[_0x0aea('0x11d')]][_0x0aea('0xac')]][_0x0aea('0x4c')]]||'rrmemory')===_0x0aea('0x121')){if(this['actions'][_0x4a4bb9[_0x0aea('0x11d')]]){if(this[_0x0aea('0x1f')][_0x4a4bb9['stateinterface']]){this[_0x0aea('0x22')][_0x4a4bb9[_0x0aea('0x11d')]][_0x0aea('0x120')]=_0x4a4bb9[_0x0aea('0x120')];if(_[_0x0aea('0xa7')](this[_0x0aea('0x27')][this[_0x0aea('0x22')][_0x4a4bb9['actionid']]['queue']])){this[_0x0aea('0x27')][this[_0x0aea('0x22')][_0x4a4bb9[_0x0aea('0x11d')]][_0x0aea('0xac')]]=[];}this[_0x0aea('0x27')][this[_0x0aea('0x22')][_0x4a4bb9[_0x0aea('0x11d')]][_0x0aea('0xac')]][_0x0aea('0x122')](_['merge'](_[_0x0aea('0xc8')](this[_0x0aea('0x22')][_0x4a4bb9['actionid']],[_0x0aea('0x123'),'stateinterface']),{'status':_0x4a4bb9[_0x0aea('0xa9')],'paused':_0x4a4bb9[_0x0aea('0x11f')]}));}}}};function unlockQueueStatus(_0x27a176,_0x10cf66){setTimeout(function(){if(_[_0x0aea('0x3a')](_0x27a176[_0x0aea('0x124')])){loggerBooked['error'](_0x0aea('0x125'),_0x10cf66);}_0x27a176[_0x0aea('0x124')]=!![];loggerBooked['info'](_0x0aea('0x126'),_0x10cf66,JSON[_0x0aea('0x6f')](_[_0x0aea('0xc8')](_0x27a176,[_0x0aea('0x3c'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x0aea('0x19')][_0x0aea('0x38')]=function(_0xc8f9df){var _0x5a5887=this;var _0x4d8214=_0x5a5887[_0x0aea('0x1d')][_0x5a5887[_0x0aea('0x22')][_0xc8f9df['actionid']][_0x0aea('0xac')]];if(strategy[this['voiceQueues'][this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xac')]][_0x0aea('0x4c')]]==='roundrobin'){if(this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]]&&this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0x120')]){this[_0x0aea('0x8a')]['run'](this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0x123')],this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0x120')])['catch'](function(_0x2053e3){logger[_0x0aea('0x8e')](_0x0aea('0x127'),util['inspect'](_0x2053e3,{'showHidden':![],'depth':null}));})[_0x0aea('0x128')](function(){_0x5a5887[_0x0aea('0xaa')](_0x5a5887[_0x0aea('0x1d')][_0x5a5887[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xac')]]);_0x5a5887[_0x0aea('0x1f')][_0x5a5887[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0x120')]]['locked']=![];delete _0x5a5887[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]];unlockQueueStatus(_0x4d8214);});}else{this[_0x0aea('0xaa')](this['voiceQueues'][this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xac')]]);this[_0x0aea('0xb8')]({'active':![],'ContactId':this['actions'][_0xc8f9df['actionid']]['ContactId'],'ListId':this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xca')],'VoiceQueueId':this[_0x0aea('0x22')][_0xc8f9df['actionid']][_0x0aea('0xcc')]||undefined,'CampaignId':this[_0x0aea('0x22')][_0xc8f9df['actionid']]['CampaignId']||undefined})[_0x0aea('0xb0')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x0aea('0x22')][_0xc8f9df['actionid']];unlockQueueStatus(_0x4d8214);}}else if((strategy[this[_0x0aea('0x1d')][this['actions'][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xac')]][_0x0aea('0x4c')]]||_0x0aea('0x121'))===_0x0aea('0x121')){var _0x1190d0;if(this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]]&&!_[_0x0aea('0x74')](this[_0x0aea('0x27')][this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xac')]])){if(this[_0x0aea('0x28')][_0x5a5887[_0x0aea('0x22')][_0xc8f9df['actionid']][_0x0aea('0xac')]]){this['queueBookedRR'][_0x5a5887[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xac')]]=this['queueBookedRR'][this['actions'][_0xc8f9df[_0x0aea('0x11d')]]['queue']]?this[_0x0aea('0x28')][this['actions'][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xac')]]:this[_0x0aea('0x27')][this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xac')]]?this[_0x0aea('0x27')][this[_0x0aea('0x22')][_0xc8f9df['actionid']][_0x0aea('0xac')]][_0x0aea('0x129')]||0x0:0x0;}this[_0x0aea('0x27')][this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]][_0x0aea('0xac')]]['_rr']=this[_0x0aea('0x28')][this[_0x0aea('0x22')][_0xc8f9df[_0x0aea('0x11d')]]['queue']];for(var _0xcfd534=0x0;_0xcfd534=0x0;})[_0x0aea('0xb0')](myreject(_0xc5d4bc)));}}else{_0x1a7c51[_0x0aea('0x122')](ami[_0x0aea('0xa8')]({'action':_0x0aea('0x143'),'command':util[_0x0aea('0x71')]('iftime\x20%s,%s',_0x16e44f,!_[_0x0aea('0x3a')](config['timezones'][_0x5e0dc5])?_0x5e0dc5:'')})[_0x0aea('0xaf')](function(_0x1c7569){return _0x1c7569[_0x0aea('0x142')][_0x0aea('0x144')](_0x0aea('0x145'))>=0x0;})[_0x0aea('0xb0')](myreject(_0xc5d4bc)));}BPromise[_0x0aea('0x146')](_0x1a7c51)[_0x0aea('0xaf')](function(_0x3966c2){var _0x212fda=_[_0x0aea('0x147')](_0x3966c2);if(_0x212fda){return _0x20ac93(_0x212fda);}else{_0x39d1d2[_0x0aea('0x3e')]=_0x5821af?_0x0aea('0x148'):_0x0aea('0x149');return _0xc5d4bc(msgResponse(_0x0aea('0x14a'),_0x0aea('0x13a'),_0x0aea('0x14b')+_0x5821af+'\x20'+_0x2e55eb+_0x0aea('0x14c')+util[_0x0aea('0x93')](_0x16e44f,{'showHidden':![],'depth':null})+_0x0aea('0x14d')+_0x5e0dc5));}})['catch'](function(_0x50f25f){return _0xc5d4bc(msgResponse(_0x0aea('0x139'),_0x0aea('0x13a'),JSON['stringify'](_0x50f25f)));});});};Dialer[_0x0aea('0x19')][_0x0aea('0x14e')]=function(_0x20e55f){var _0x380360=this;return function(){switch(_0x20e55f[_0x0aea('0x14f')]){case _0x0aea('0x150'):freeVariablesPredictive(_0x20e55f);_0x380360[_0x0aea('0x151')](_0x20e55f,0x1);break;case _0x0aea('0x152'):freeVariablesPredictive(_0x20e55f);_0x380360[_0x0aea('0x151')](_0x20e55f,_0x20e55f[_0x0aea('0x153')]);break;case _0x0aea('0xb'):_0x380360[_0x0aea('0xb')](_0x20e55f);break;case _0x0aea('0x9'):freeVariablesPredictive(_0x20e55f);_0x380360[_0x0aea('0x151')](_0x20e55f,0x1);break;default:freeVariablesPredictive(_0x20e55f);logger['error'](_0x0aea('0x154'),_0x20e55f[_0x0aea('0x3c')],_0x0aea('0x155'));}};};Dialer[_0x0aea('0x19')][_0x0aea('0x156')]=function(_0x50784f){var _0x20565c=this;return function(){_0x20565c['handleIvr'](_0x50784f);};};Dialer[_0x0aea('0x19')][_0x0aea('0x31')]=function(_0x45f9e1){var _0x2828ff=this;if(isNotPreview(_0x45f9e1[_0x0aea('0x14f')])){if(isVoiceQueueOutbound(_0x45f9e1[_0x0aea('0x4a')])&&isActive(_0x45f9e1[_0x0aea('0x58')])){_0x45f9e1['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x0aea('0xaf')](checkIsLoggedIn(_0x45f9e1,_0x45f9e1[_0x0aea('0x4f')]))[_0x0aea('0xaf')](checkIsActive(_0x45f9e1,_0x45f9e1[_0x0aea('0x58')]))[_0x0aea('0xaf')](checkInterval(_0x45f9e1))['then'](_0x2828ff[_0x0aea('0x133')](_0x45f9e1))['then'](_0x2828ff[_0x0aea('0x137')](_0x45f9e1[_0x0aea('0x157')],_0x45f9e1[_0x0aea('0x158')],_0x45f9e1['name'],_0x45f9e1))[_0x0aea('0xaf')](_0x2828ff['checkIfTimeIntervals'](_0x45f9e1[_0x0aea('0x40')],_0x45f9e1['dialTimezone'],_0x45f9e1[_0x0aea('0x3c')],_0x45f9e1))[_0x0aea('0xaf')](_0x2828ff[_0x0aea('0x14e')](_0x45f9e1))[_0x0aea('0xb0')](loggerCatchQueueSummary(_0x0aea('0x159'),_0x45f9e1));}else{notSendMessagesQueue(_0x45f9e1);}}else{freeVariablesPredictive(_0x45f9e1);}};Dialer[_0x0aea('0x19')][_0x0aea('0x15a')]=function(){var _0x347134=this;var _0x19f160;for(var _0xaf4be1 in this[_0x0aea('0x1e')]){if(typeof this[_0x0aea('0x1e')][_0xaf4be1]!==_0x0aea('0xa6')){_0x19f160=this[_0x0aea('0x1e')][_0xaf4be1];if(isCampaignIvr(_0x19f160[_0x0aea('0x4a')])&&isActive(_0x19f160[_0x0aea('0xd2')])){_0x19f160[_0x0aea('0x9a')]=!![];BPromise[_0x0aea('0xb3')]()['then'](checkIsActive(_0x19f160,_0x19f160[_0x0aea('0xd2')]))['then'](checkInterval(_0x19f160))['then'](_0x347134[_0x0aea('0x133')](_0x19f160))[_0x0aea('0xaf')](_0x347134[_0x0aea('0x137')](_0x19f160[_0x0aea('0x157')],_0x19f160[_0x0aea('0x158')],_0x19f160[_0x0aea('0x3c')],_0x19f160))[_0x0aea('0xaf')](_0x347134[_0x0aea('0x138')](_0x19f160[_0x0aea('0x40')],_0x19f160[_0x0aea('0x158')],_0x19f160[_0x0aea('0x3c')],_0x19f160))[_0x0aea('0xaf')](_0x347134[_0x0aea('0x156')](_0x19f160))[_0x0aea('0xb0')](loggerCatchQueueSummary(_0x0aea('0x15b'),_0x19f160));}else{notSendMessagesCampaign(_0x19f160);}}}};function getCallerIdRandom(_0x561909,_0x3b2d8c){var _0x522f65;var _0x1b214c;var _0x3ce7f0;if(_0x3b2d8c<=0x0){_0x3b2d8c=0x1;}_0x522f65=new RegExp(_0x0aea('0x15c')+_0x3b2d8c+'}$');_0x1b214c=Math['pow'](0xa,_0x3b2d8c-0x1);_0x3ce7f0=Math[_0x0aea('0x15d')](0xa,_0x3b2d8c)-0x1;return util[_0x0aea('0x71')]('%s',_['replace'](_0x561909,_0x522f65,_[_0x0aea('0x15e')](_0x1b214c,_0x3ce7f0)));}function extractCalleridName(_0x493aaf){var _0x210fbb=_0x493aaf[_0x0aea('0x15f')](/"(.*?)"/);return _0x210fbb?_0x210fbb[0x1]:_0x493aaf;}function extractCalleridNumber(_0x58afc3){var _0x3fc57b=_0x58afc3['match'](/<(.*?)>/);return _0x3fc57b?_0x3fc57b[0x1]:_0x58afc3;}Dialer['prototype'][_0x0aea('0x160')]=function(_0x4f615d,_0x24d4b5){var _0x5bf67c=this;var _0x5e979d=uuid['v4']();this['actions'][_0x5e979d]=new Action(_0x4f615d,_0x24d4b5,_0x5e979d);return new BPromise(function(_0x15739d,_0x36c11e){if(_[_0x0aea('0x3a')](_0x4f615d)&&typeof _0x4f615d!=='object'){return _0x36c11e(msgResponse(_0x0aea('0x161'),_0x0aea('0x13a'),'voiceQueue\x20is\x20undefine'));}if(_[_0x0aea('0x3a')](_0x24d4b5['Contact']['phone'])||_0x24d4b5[_0x0aea('0x162')]['phone']===null){return _0x36c11e(msgResponse(_0x0aea('0x161'),_0x0aea('0x13a'),'contact\x20is\x20undefine'));}var _0x202590={'XMD-CALLERID':_0x5bf67c['actions'][_0x5e979d][_0x0aea('0x163')](),'XMD-AGI':_0x4f615d[_0x0aea('0xfe')]?util[_0x0aea('0x71')](_0x0aea('0x164'),ipAgi,_0x4f615d['dialQueueProject']):_0x0aea('0x165'),'XMD-AGIAFTER':_0x4f615d[_0x0aea('0x104')]?util[_0x0aea('0x71')](_0x0aea('0x164'),ipAgi,_0x4f615d[_0x0aea('0x104')]):_0x0aea('0x165'),'XMD-QUEUE':_0x4f615d[_0x0aea('0x4a')]===_0x0aea('0x4b')?util[_0x0aea('0x71')](_0x0aea('0x166'),_0x4f615d[_0x0aea('0x3c')],_0x4f615d[_0x0aea('0x167')]||'',_0x4f615d[_0x0aea('0x105')]?'c':'',_0x4f615d[_0x0aea('0x10b')]||0x3):'NONE','XMD-CONTACTID':_0x24d4b5[_0x0aea('0xc9')],'XMD-CDRTYPE':_0x0aea('0x8'),'CALLERID(all)':_0x5bf67c[_0x0aea('0x22')][_0x5e979d][_0x0aea('0x163')](),'XMD-AMD':_0x4f615d[_0x0aea('0xd9')]?_0x0aea('0x168'):'NONE','XMD-DESTINATION':_0x0aea('0xd8')};if(_0x4f615d[_0x0aea('0xd9')]){_0x202590[_0x0aea('0x169')]=_0x4f615d['dialAMDInitialSilence']||0x9c4;_0x202590[_0x0aea('0x16a')]=_0x4f615d['dialAMDGreeting']||0x5dc;_0x202590['XMD-AMDAFTERGREETINGSILENCE']=_0x4f615d[_0x0aea('0x16b')]||0x320;_0x202590[_0x0aea('0x16c')]=_0x4f615d['dialAMDTotalAnalysisTime']||0x1388;_0x202590['XMD-AMDMINWORDLENGTH']=_0x4f615d[_0x0aea('0x16d')]||0x64;_0x202590[_0x0aea('0x16e')]=_0x4f615d[_0x0aea('0x16f')]||0x32;_0x202590['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4f615d[_0x0aea('0x170')]||0x3;_0x202590[_0x0aea('0x171')]=_0x4f615d['dialAMDSilenceThreshold']||0x100;_0x202590[_0x0aea('0x172')]=_0x4f615d[_0x0aea('0x173')]||0x1388;}if(_0x4f615d['type']===_0x0aea('0x4b')){_0x202590[_0x0aea('0x174')]=_0x24d4b5[_0x0aea('0xcc')];}else{_0x202590[_0x0aea('0x175')]=_0x24d4b5[_0x0aea('0xcd')];}for(var _0x27b45d in _0x24d4b5[_0x0aea('0x162')]){if(typeof _0x24d4b5[_0x0aea('0x162')][_0x27b45d]!==_0x0aea('0xa6')){if(isNotNull(_0x24d4b5['Contact'][_0x27b45d])&&_0x27b45d!=='id'&&_0x27b45d!==_0x0aea('0x176')&&_0x27b45d!==_0x0aea('0x177')&&_0x27b45d!==_0x0aea('0x178')){_0x202590[util[_0x0aea('0x71')]('%s%s',_0x0aea('0x179'),_[_0x0aea('0x17a')](_0x27b45d))]=_0x24d4b5['Contact'][_0x27b45d];}}}var _0x41508a=_0x5bf67c[_0x0aea('0xd1')](_0x4f615d[_0x0aea('0x6e')])?getCallerId(_0x4f615d['Trunk']['callerid'],_0x4f615d['dialOriginateCallerIdName'],_0x4f615d['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4f615d[_0x0aea('0x59')],_0x4f615d[_0x0aea('0x17b')]):_0x4f615d[_0x0aea('0x59')]):getCallerId(_[_0x0aea('0xa7')](_0x4f615d[_0x0aea('0x134')])?_0x4f615d[_0x0aea('0x6e')][_0x0aea('0x17c')]:_0x4f615d[_0x0aea('0x134')]['callerid'],_0x4f615d['dialOriginateCallerIdName'],_0x4f615d[_0x0aea('0x17b')]>0x0?getCallerIdRandom(_0x4f615d['dialOriginateCallerIdNumber'],_0x4f615d[_0x0aea('0x17b')]):_0x4f615d[_0x0aea('0x59')]);if(_0x41508a){_0x202590[_0x0aea('0x17d')]=_0x5bf67c[_0x0aea('0x22')][_0x5e979d][_0x0aea('0x17e')]=extractCalleridName(_0x41508a);_0x202590[_0x0aea('0x17f')]=_0x5bf67c['actions'][_0x5e979d][_0x0aea('0x180')]=extractCalleridNumber(_0x41508a);}return ami[_0x0aea('0xa8')]({'actionid':_0x5e979d,'action':_0x0aea('0x161'),'channel':_0x5bf67c[_0x0aea('0xd1')](_0x4f615d[_0x0aea('0x6e')])?util[_0x0aea('0x71')](_0x0aea('0x181'),_0x4f615d['Trunk']['name'],isNotNull(_0x4f615d[_0x0aea('0x5b')])?_0x4f615d[_0x0aea('0x5b')]['trim']()||'':'',_0x4f615d[_0x0aea('0x182')]>0x0?_0x24d4b5[_0x0aea('0x162')][_0x0aea('0x183')][_0x0aea('0x184')](_0x4f615d['dialCutDigit']):_0x24d4b5['Contact'][_0x0aea('0x183')]):util[_0x0aea('0x71')](_0x0aea('0x181'),_[_0x0aea('0xa7')](_0x4f615d[_0x0aea('0x134')])?_0x4f615d[_0x0aea('0x6e')]['name']:_0x4f615d[_0x0aea('0x134')][_0x0aea('0x3c')],isNotNull(_0x4f615d[_0x0aea('0x5b')])?_0x4f615d[_0x0aea('0x5b')][_0x0aea('0x185')]()||'':'',_0x4f615d[_0x0aea('0x182')]>0x0?_0x24d4b5[_0x0aea('0x162')]['phone']['substring'](_0x4f615d['dialCutDigit']):_0x24d4b5[_0x0aea('0x162')][_0x0aea('0x183')]),'callerid':_0x41508a,'Exten':_0x0aea('0xd8'),'Context':'from-sip','Priority':'1','variable':_0x202590,'timeout':(_0x4f615d['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5e979d})['then'](function(_0xf612a8){return _0x15739d(_0xf612a8);})[_0x0aea('0xb0')](function(_0x5be86e){_0x4f615d['outboundOriginateFailureCallsDay']+=0x1;var _0x3bc88d=new History(_0x5bf67c['actions'][_0x5e979d]);logger[_0x0aea('0x8e')](util[_0x0aea('0x71')](_0x0aea('0x186'),JSON[_0x0aea('0x6f')](_0x5be86e)));_0x3bc88d[_0x0aea('0xa0')]=0xe;_0x3bc88d[_0x0aea('0xa1')]=_0x0aea('0x187');_0x3bc88d[_0x0aea('0x114')]=moment()[_0x0aea('0x71')](_0x0aea('0xee'));_0x3bc88d[_0x0aea('0xa2')]=_0x3bc88d[_0x0aea('0x114')];_0x5bf67c[_0x0aea('0xc0')](_0x3bc88d)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x188')));_0x5bf67c[_0x0aea('0xbe')](_0x3bc88d)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x188')))[_0x0aea('0x128')](function(){delete _0x5bf67c[_0x0aea('0x22')][_0x5e979d];return _0x36c11e(msgResponse(_0x0aea('0x161'),_0x0aea('0x45'),_0x0aea('0x189')));});});});};Dialer[_0x0aea('0x19')]['syncOriginateResponse']=function(_0x161cc2){var _0x153d28=this['actions'][_0x161cc2[_0x0aea('0x11d')]];if(_0x153d28){delete this[_0x0aea('0x22')][_0x161cc2[_0x0aea('0x11d')]];_0x153d28['responsetime']=moment()[_0x0aea('0x71')]('YYYY-MM-DD\x20HH:mm:ss');var _0x24e827=_0x153d28[_0x0aea('0x4a')]===_0x0aea('0x72')?this['campaigns'][_0x153d28[_0x0aea('0xac')]]:this[_0x0aea('0x1d')][_0x153d28['getQueue']()];if(!this['isSuccess'](_0x161cc2['response'])){this[_0x0aea('0xaa')](_0x24e827);return this['callProgressDetecting'](_0x153d28,_0x24e827,_0x161cc2)[_0x0aea('0xb0')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x161cc2[_0x0aea('0xd4')]]=_0x153d28;}};Dialer[_0x0aea('0x19')][_0x0aea('0x18a')]=function(_0x48a6a2,_0x2ce9e1,_0x16c715){var _0x22f308=new History(_0x2ce9e1);if(_0x22f308['countbusyretry']+_0x22f308['countcongestionretry']+_0x22f308[_0x0aea('0xf5')]+_0x22f308['countnosuchnumberretry']+_0x22f308[_0x0aea('0xe6')]+_0x22f308[_0x0aea('0xe7')]+_0x22f308[_0x0aea('0xe1')]+_0x22f308[_0x0aea('0xe8')]>=_0x16c715[_0x0aea('0xe9')]-0x1){return!![];}switch(_0x48a6a2){case 0x3:if(_0x22f308[_0x0aea('0xf5')]>=_0x16c715['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x22f308['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x0aea('0xec')](_0x16c715[_0x0aea('0x18b')],_0x0aea('0xf9'))['format'](_0x0aea('0xee')),'ContactId':_0x22f308[_0x0aea('0xc9')],'ListId':_0x22f308[_0x0aea('0xca')],'VoiceQueueId':_0x22f308[_0x0aea('0xcc')]||undefined,'CampaignId':_0x22f308['CampaignId']||undefined})[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x18c')));break;case 0x5:if(_0x22f308[_0x0aea('0xe3')]>=_0x16c715[_0x0aea('0x18d')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x22f308[_0x0aea('0xe3')]+=0x1,'scheduledat':moment()[_0x0aea('0xec')](_0x16c715[_0x0aea('0x18e')],'minutes')[_0x0aea('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x22f308[_0x0aea('0xc9')],'ListId':_0x22f308[_0x0aea('0xca')],'VoiceQueueId':_0x22f308[_0x0aea('0xcc')]||undefined,'CampaignId':_0x22f308[_0x0aea('0xcd')]||undefined})[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x18f')));break;case 0x8:if(_0x22f308[_0x0aea('0xe4')]>=_0x16c715['dialCongestionMaxRetry']-0x1){return!![];}this[_0x0aea('0xb8')]({'active':![],'countcongestionretry':_0x22f308['countcongestionretry']+=0x1,'scheduledat':moment()[_0x0aea('0xec')](_0x16c715[_0x0aea('0x190')],_0x0aea('0xf9'))[_0x0aea('0x71')](_0x0aea('0xee')),'ContactId':_0x22f308[_0x0aea('0xc9')],'ListId':_0x22f308[_0x0aea('0xca')],'VoiceQueueId':_0x22f308[_0x0aea('0xcc')]||undefined,'CampaignId':_0x22f308['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x22f308[_0x0aea('0xe5')]>=_0x16c715[_0x0aea('0x191')]-0x1){return!![];}else{this[_0x0aea('0xb8')]({'active':![],'countnosuchnumberretry':_0x22f308[_0x0aea('0xe5')]+=0x1,'scheduledat':moment()['add'](_0x16c715['dialNoSuchNumberRetryFrequency'],_0x0aea('0xf9'))['format'](_0x0aea('0xee')),'ContactId':_0x22f308[_0x0aea('0xc9')],'ListId':_0x22f308[_0x0aea('0xca')],'VoiceQueueId':_0x22f308[_0x0aea('0xcc')]||undefined,'CampaignId':_0x22f308[_0x0aea('0xcd')]||undefined})[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x192')));}break;case 0xa:if(_0x22f308[_0x0aea('0xe6')]>=_0x16c715[_0x0aea('0x111')]-0x1){return!![];}this[_0x0aea('0xb8')]({'active':![],'countdropretry':_0x22f308['countdropretry']+=0x1,'scheduledat':moment()[_0x0aea('0xec')](_0x16c715[_0x0aea('0x112')],_0x0aea('0xf9'))[_0x0aea('0x71')](_0x0aea('0xee')),'ContactId':_0x22f308[_0x0aea('0xc9')],'ListId':_0x22f308[_0x0aea('0xca')],'VoiceQueueId':_0x22f308[_0x0aea('0xcc')]||undefined,'CampaignId':_0x22f308[_0x0aea('0xcd')]||undefined})[_0x0aea('0xb0')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x22f308[_0x0aea('0xe7')]>=_0x16c715['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x0aea('0xb8')]({'active':![],'countabandonedretry':_0x22f308[_0x0aea('0xe7')]+=0x1,'scheduledat':moment()[_0x0aea('0xec')](_0x16c715['dialAbandonedRetryFrequency'],'minutes')[_0x0aea('0x71')](_0x0aea('0xee')),'ContactId':_0x22f308[_0x0aea('0xc9')],'ListId':_0x22f308[_0x0aea('0xca')],'VoiceQueueId':_0x22f308[_0x0aea('0xcc')]||undefined,'CampaignId':_0x22f308[_0x0aea('0xcd')]||undefined})[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x11b')));break;case 0x13:if(_0x22f308[_0x0aea('0xe1')]>=_0x16c715['dialMachineMaxRetry']-0x1){return!![];}this[_0x0aea('0xb8')]({'active':![],'countmachineretry':_0x22f308['countmachineretry']+=0x1,'scheduledat':moment()[_0x0aea('0xec')](_0x16c715[_0x0aea('0xed')],'minutes')[_0x0aea('0x71')](_0x0aea('0xee')),'ContactId':_0x22f308[_0x0aea('0xc9')],'ListId':_0x22f308[_0x0aea('0xca')],'VoiceQueueId':_0x22f308[_0x0aea('0xcc')]||undefined,'CampaignId':_0x22f308[_0x0aea('0xcd')]||undefined})['catch'](loggerCatch(_0x0aea('0xef')));break;case 0x14:if(_0x22f308[_0x0aea('0xe8')]>=_0x16c715[_0x0aea('0x193')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x22f308['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x0aea('0xec')](_0x16c715[_0x0aea('0x194')],_0x0aea('0xf9'))[_0x0aea('0x71')](_0x0aea('0xee')),'ContactId':_0x22f308[_0x0aea('0xc9')],'ListId':_0x22f308['ListId'],'VoiceQueueId':_0x22f308['VoiceQueueId']||undefined,'CampaignId':_0x22f308[_0x0aea('0xcd')]||undefined})[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x195')));break;default:return!![];}};Dialer[_0x0aea('0x19')][_0x0aea('0x196')]=function(_0x2b50fe,_0x473193,_0x248f30){var _0x1393b7=this;var _0x1031f9=new History(_0x2b50fe);return new BPromise(function(_0x3c0b47,_0x4f6b50){if(_[_0x0aea('0x3a')](_0x473193)&&typeof _0x473193!=='object'){return _0x4f6b50(msgResponse(_0x0aea('0x197'),_0x0aea('0x13a'),_0x0aea('0x198')));}if(_['isUndefined'](_0x248f30)&&typeof _0x248f30!==_0x0aea('0x199')){return _0x4f6b50(msgResponse(_0x0aea('0x197'),'Failure',_0x0aea('0x19a')));}switch(_0x248f30[_0x0aea('0x101')]){case'0':_0x473193[_0x0aea('0x62')]+=0x1;_0x1031f9[_0x0aea('0xa0')]=0x0;_0x1031f9[_0x0aea('0xa1')]=_0x0aea('0x19b');_0x1031f9[_0x0aea('0xe5')]+=0x1;_0x1031f9[_0x0aea('0x110')]+=0x1;ami[_0x0aea('0x49')](_0x0aea('0x19c'),ut['buildObj'](_0x2b50fe,_0x0aea('0x19d')));_0x1393b7[_0x0aea('0xc0')](_0x1031f9)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0xf4')));if(_0x1393b7[_0x0aea('0x18a')](0x0,_0x2b50fe,_0x473193)){if(_0x1031f9[_0x0aea('0xe5')]>=_0x473193[_0x0aea('0x191')]){_0x1393b7[_0x0aea('0xf7')](_0x1031f9,_0x3c0b47,_0x4f6b50,_0x0aea('0x19e'));}else{_0x1393b7[_0x0aea('0xf6')](_0x1031f9,_0x3c0b47,_0x4f6b50,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x473193[_0x0aea('0x61')]+=0x1;_0x1031f9[_0x0aea('0xa0')]=0x3;_0x1031f9[_0x0aea('0xa1')]=_0x0aea('0x19f');_0x1031f9[_0x0aea('0xf5')]+=0x1;_0x1031f9[_0x0aea('0x110')]+=0x1;ami[_0x0aea('0x49')](_0x0aea('0x1a0'),ut['buildObj'](_0x2b50fe,'noanswer'));_0x1393b7[_0x0aea('0xc0')](_0x1031f9)['catch'](loggerCatch(_0x0aea('0x1a1')));if(_0x1393b7[_0x0aea('0x18a')](0x3,_0x2b50fe,_0x473193)){if(_0x1031f9[_0x0aea('0xf5')]>=_0x473193[_0x0aea('0x1a2')]){_0x1393b7[_0x0aea('0xf7')](_0x1031f9,_0x3c0b47,_0x4f6b50,_0x0aea('0x1a3'));}else{_0x1393b7[_0x0aea('0xf6')](_0x1031f9,_0x3c0b47,_0x4f6b50,_0x0aea('0x1a3'));}}break;case'5':_0x473193['outboundBusyCallsDay']+=0x1;_0x1031f9['state']=0x5;_0x1031f9[_0x0aea('0xa1')]=_0x0aea('0x1a4');_0x1031f9[_0x0aea('0xe3')]+=0x1;_0x1031f9['countglobal']+=0x1;ami[_0x0aea('0x49')](_0x0aea('0x1a5'),ut['buildObj'](_0x2b50fe,'busy'));_0x1393b7[_0x0aea('0xc0')](_0x1031f9)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x1a6')));if(_0x1393b7[_0x0aea('0x18a')](0x5,_0x2b50fe,_0x473193)){if(_0x1031f9['countbusyretry']>=_0x473193['dialBusyMaxRetry']){_0x1393b7[_0x0aea('0xf7')](_0x1031f9,_0x3c0b47,_0x4f6b50,'reason\x205\x20busy');}else{_0x1393b7[_0x0aea('0xf6')](_0x1031f9,_0x3c0b47,_0x4f6b50,_0x0aea('0x1a7'));}}break;case'8':_0x473193[_0x0aea('0x5f')]+=0x1;_0x1031f9[_0x0aea('0xa0')]=0x8;_0x1031f9['statedesc']=_0x0aea('0x1a8');_0x1031f9['countcongestionretry']+=0x1;_0x1031f9[_0x0aea('0x110')]+=0x1;ami[_0x0aea('0x49')](_0x0aea('0x1a9'),ut[_0x0aea('0x1aa')](_0x2b50fe,_0x0aea('0x1ab')));_0x1393b7[_0x0aea('0xc0')](_0x1031f9)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x1ac')));if(_0x1393b7[_0x0aea('0x18a')](0x8,_0x2b50fe,_0x473193)){if(_0x1031f9[_0x0aea('0xe4')]>=_0x473193['dialCongestionMaxRetry']){_0x1393b7[_0x0aea('0xf7')](_0x1031f9,_0x3c0b47,_0x4f6b50,'reason\x208\x20congestion');}else{_0x1393b7['stateGlobal'](_0x1031f9,_0x3c0b47,_0x4f6b50,'reason\x208\x20congestion');}}break;case'11':_0x473193['outboundAbandonedCallsDay']+=0x1;_0x1031f9[_0x0aea('0xa0')]=0xb;_0x1031f9['statedesc']='Abandoned';_0x1031f9[_0x0aea('0xe7')]+=0x1;_0x1031f9[_0x0aea('0x110')]+=0x1;_0x1393b7[_0x0aea('0xc0')](_0x1031f9)['catch'](loggerCatch(_0x0aea('0x1ad')));if(_0x1393b7[_0x0aea('0x18a')](0xb,_0x2b50fe,_0x473193)){if(_0x1031f9[_0x0aea('0xe7')]>=_0x473193[_0x0aea('0x11a')]){_0x1393b7[_0x0aea('0xf7')](_0x1031f9,_0x3c0b47,_0x4f6b50,_0x0aea('0x1ae'));}else{_0x1393b7[_0x0aea('0xf6')](_0x1031f9,_0x3c0b47,_0x4f6b50,_0x0aea('0x1ae'));}}break;case'20':_0x473193[_0x0aea('0x64')]+=0x1;_0x1031f9['state']=0x14;_0x1031f9[_0x0aea('0xa1')]=_0x0aea('0x1af');_0x1031f9[_0x0aea('0xe8')]+=0x1;_0x1031f9[_0x0aea('0x110')]+=0x1;ami[_0x0aea('0x49')](_0x0aea('0x1b0'),ut[_0x0aea('0x1aa')](_0x2b50fe,_0x0aea('0x1b1')));_0x1393b7[_0x0aea('0xc0')](_0x1031f9)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x1b2')));if(_0x1393b7[_0x0aea('0x18a')](0x14,_0x2b50fe,_0x473193)){if(_0x1031f9[_0x0aea('0xe8')]>=_0x473193[_0x0aea('0x193')]){_0x1393b7[_0x0aea('0xf7')](_0x1031f9,_0x3c0b47,_0x4f6b50,'reason\x2020\x20agentreject');}else{_0x1393b7[_0x0aea('0xf6')](_0x1031f9,_0x3c0b47,_0x4f6b50,'reason\x2020\x20agentreject');}}break;default:_0x473193[_0x0aea('0x1b3')]+=0x1;_0x1031f9[_0x0aea('0xa0')]=0xc;_0x1031f9[_0x0aea('0xa1')]=_0x248f30['reason'];_0x1393b7[_0x0aea('0xc0')](_0x1031f9)[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x1b4')));if(_0x1393b7[_0x0aea('0x18a')](_0x248f30[_0x0aea('0x101')],_0x2b50fe,_0x473193)){if(_0x1031f9[_0x0aea('0xe3')]+_0x1031f9[_0x0aea('0xe4')]+_0x1031f9[_0x0aea('0xf5')]+_0x1031f9['countnosuchnumberretry']+_0x1031f9[_0x0aea('0xe6')]+_0x1031f9[_0x0aea('0xe7')]+_0x1031f9[_0x0aea('0xe1')]+_0x1031f9[_0x0aea('0xe8')]>=_0x473193[_0x0aea('0xe9')]){_0x1393b7[_0x0aea('0xf6')](_0x1031f9,_0x3c0b47,_0x4f6b50,_0x248f30['reason']);}else{_0x1393b7[_0x0aea('0xf7')](_0x1031f9,_0x3c0b47,_0x4f6b50,_0x248f30['reason']);}}}});};Dialer['prototype'][_0x0aea('0xf6')]=function(_0x36cc6f,_0x46571b,_0x195796,_0x421ea1){var _0x4aa194=new Final(_0x36cc6f);_0x4aa194['state']=0xf;_0x4aa194[_0x0aea('0xa1')]=_0x0aea('0x1b5');this[_0x0aea('0xf7')](_0x4aa194,_0x46571b,_0x195796,_0x421ea1);};Dialer[_0x0aea('0x19')]['createStateFinal']=function(_0x400fbf,_0x5185eb,_0x23f41f,_0x281105){this['moveContactManagedDialer'](_0x400fbf)[_0x0aea('0xaf')](function(){return _0x5185eb(msgResponse(_0x0aea('0x197'),_0x0aea('0x1b6'),_0x281105));})[_0x0aea('0xb0')](function(){return _0x23f41f(msgResponse(_0x0aea('0x1b7'),_0x0aea('0x13a'),_0x0aea('0x1b8')));});};Dialer[_0x0aea('0x19')][_0x0aea('0xb')]=function(_0x223aee){var _0x40747b=_0x223aee[_0x0aea('0x1b9')]/0x64;var _0x5e3172=_0x223aee[_0x0aea('0x60')]/(_0x223aee[_0x0aea('0x60')]+_0x223aee[_0x0aea('0xdc')]);var _0x5ae002=Math[_0x0aea('0x1ba')](_0x223aee[_0x0aea('0x68')]*(_0x223aee['predictiveIntervalMaxThreshold']/0x64));var _0x41ca21=Math[_0x0aea('0x1ba')](_0x223aee[_0x0aea('0x68')]*(_0x223aee['predictiveIntervalMinThreshold']/0x64));var _0x257776=_0x223aee[_0x0aea('0x4e')]+_0x223aee['talking'];var _0x5e5d77=Math['floor'](_0x223aee[_0x0aea('0x6a')]*_0x223aee[_0x0aea('0x6c')]*_0x223aee[_0x0aea('0x1bb')]*_0x223aee[_0x0aea('0x1bc')]);if(_[_0x0aea('0x3a')](_0x223aee[_0x0aea('0x26')])){if(!_[_0x0aea('0x3a')](_0x223aee[_0x0aea('0x25')])){_0x223aee[_0x0aea('0x25')]=undefined;loggerPredictive['error'](_0x0aea('0x1bd'),_0x0aea('0x1be'));}if(!_['isUndefined'](_0x223aee[_0x0aea('0x89')])){loggerPredictive[_0x0aea('0x8e')]('[startMethodPredictive][StartProgressive]',_0x0aea('0x1bf'));clearInterval(_0x223aee[_0x0aea('0x89')]);_0x223aee[_0x0aea('0x89')]=undefined;}_0x223aee[_0x0aea('0x26')]=moment()[_0x0aea('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0aea('0x75')](_0x223aee[_0x0aea('0x3c')],'collection\x20data\x20in\x20progressive\x20at',_0x223aee[_0x0aea('0x26')]);this[_0x0aea('0x151')](_0x223aee,0x1);}else if(ifInterval(_0x223aee[_0x0aea('0x1c0')],_0x223aee[_0x0aea('0x26')])){this[_0x0aea('0x151')](_0x223aee,0x1);loggerPredictiveCalls['info'](_0x0aea('0x1c1'),_0x223aee['startProgressive'],_0x223aee['name']);_0x223aee[_0x0aea('0x6a')]=0x0;_0x223aee[_0x0aea('0x10d')]=0x0;}else if(_0x40747b<_0x5e3172&&_0x223aee[_0x0aea('0x1c2')]===_0x0aea('0x1c3')){freeVariablesPredictive(_0x223aee);loggerPredictive[_0x0aea('0x75')](_0x0aea('0x1c4'),_0x0aea('0x1c5'),_0x5e3172,_0x0aea('0x26'),_0x223aee['name']);}else if(_0x5e5d77<_0x223aee[_0x0aea('0x10d')]&&_0x223aee[_0x0aea('0x1c2')]===_0x0aea('0x1c3')){freeVariablesPredictive(_0x223aee);loggerPredictive[_0x0aea('0x75')](_0x0aea('0x1c6'),_0x0aea('0x1c7'),_0x5e5d77,_0x0aea('0x1c8'),_0x223aee['predictiveIntervalErlangCallsDroppedCalls'],_0x0aea('0x26'),_0x223aee[_0x0aea('0x3c')]);}else if(!ifInterval(_0x223aee['dialPredictiveInterval'],_0x223aee[_0x0aea('0x26')])&&_[_0x0aea('0x3a')](_0x223aee['startPredictive'])&&!_[_0x0aea('0x3a')](_0x223aee['startProgressive'])){_0x223aee[_0x0aea('0x25')]=moment()[_0x0aea('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0aea('0x75')](_0x223aee[_0x0aea('0x3c')],_0x0aea('0x1c9'),_0x223aee[_0x0aea('0x25')]);this[_0x0aea('0x1ca')](_0x223aee['dialPredictiveInterval'])[_0x0aea('0xaf')](this[_0x0aea('0x1cb')](_0x223aee))['then'](mergeDataErlangB(_0x223aee))['then'](this['startMethodPredictive'](_0x223aee))[_0x0aea('0xb0')](loggerCatchPredictive(_0x0aea('0x1cc'),_0x223aee));}else if(!ifInterval(_0x223aee[_0x0aea('0x1c0')],_0x223aee[_0x0aea('0x25')])){_0x223aee[_0x0aea('0x10d')]=0x0;_0x223aee[_0x0aea('0x25')]=moment()[_0x0aea('0x71')](_0x0aea('0xee'));loggerPredictive[_0x0aea('0x75')](_0x223aee[_0x0aea('0x3c')],'recalculate\x20predictive\x20at',_0x223aee[_0x0aea('0x25')]);clearInterval(_0x223aee[_0x0aea('0x89')]);_0x223aee[_0x0aea('0x89')]=undefined;this[_0x0aea('0x1ca')](_0x223aee[_0x0aea('0x1c0')])[_0x0aea('0xaf')](this[_0x0aea('0x1cb')](_0x223aee))[_0x0aea('0xaf')](mergeDataErlangB(_0x223aee))[_0x0aea('0xaf')](this[_0x0aea('0x1cd')](_0x223aee))['catch'](loggerCatchPredictive(_0x0aea('0x1ce'),_0x223aee));}else if(_0x223aee[_0x0aea('0x68')]&&_0x257776<_0x223aee[_0x0aea('0x68')]-_0x41ca21){freeVariablesPredictive(_0x223aee);loggerPredictive[_0x0aea('0x75')](_0x223aee['name'],_0x0aea('0x1cf'),_0x257776,')\x20are\x20less\x20than\x20threshold\x20(',_0x223aee['predictiveIntervalAvailable'],'-',_0x41ca21,'=',_0x223aee[_0x0aea('0x68')]-_0x41ca21,')');}else if(_0x223aee[_0x0aea('0x68')]&&_0x257776>_0x223aee[_0x0aea('0x68')]+_0x5ae002){freeVariablesPredictive(_0x223aee);loggerPredictive[_0x0aea('0x75')](_0x223aee[_0x0aea('0x3c')],_0x0aea('0x1cf'),_0x257776,')\x20are\x20more\x20than\x20threshold\x20(',_0x223aee['predictiveIntervalAvailable'],'+',_0x5ae002,'=',_0x223aee[_0x0aea('0x68')]+_0x5ae002,')');}};Dialer[_0x0aea('0x19')][_0x0aea('0x1cb')]=function(_0x26190b){var _0x5d4889=this;return function(_0x46de72){return new BPromise(function(_0x24984e,_0x5a5b4d){_[_0x0aea('0xc7')](_0x26190b,_0x46de72[0x0]);if(checkGetDataPredictive(_0x46de72[0x0])){var _0x3d0e85=_0x26190b[_0x0aea('0x68')]=_0x26190b[_0x0aea('0x53')]+_0x26190b[_0x0aea('0x4e')];var _0x408a79=_0x26190b[_0x0aea('0x1c0')]*0x3c;var _0x3d91ce=_0x46de72[0x0][_0x0aea('0x7d')]+_0x46de72[0x0]['predictiveIntervalAvgHoldtime'];var _0x1bae96=(_0x46de72[0x0]['predictiveIntervalAnsweredCalls']+_0x46de72[0x0][_0x0aea('0x10c')]+_0x46de72[0x0][_0x0aea('0x7b')])/_0x46de72[0x0][_0x0aea('0x69')];_0x26190b['predictiveIntervalHitRate']=_0x1bae96>0x0?_0x1bae96:0x1;switch(_0x26190b[_0x0aea('0x1c2')]){case _0x0aea('0x1c3'):var _0x4f6acb=_0x26190b[_0x0aea('0x1b9')]/0x64;return _0x5d4889[_0x0aea('0x1d0')](_0x3d0e85,_0x408a79,_0x3d91ce,_0x1bae96,_0x4f6acb)[_0x0aea('0xaf')](function(_0x2a99eb){return _0x24984e(_0x2a99eb);});case'agentBusyFactor':var _0x51d87d=_0x26190b[_0x0aea('0x1b9')]/0x64;return _0x5d4889['busyFactor'](_0x3d0e85,_0x408a79,_0x3d91ce,_0x1bae96,_0x51d87d)['then'](function(_0x4edc15){return _0x24984e(_0x4edc15);});default:return _0x5a5b4d(msgResponse(_0x0aea('0x1d1'),_0x0aea('0x13a'),'Unknown\x20Predictive'));}}else{return _0x5a5b4d(msgResponse(_0x0aea('0x1d1'),_0x0aea('0x13a'),_0x0aea('0x1d2')));}});};};Dialer[_0x0aea('0x19')][_0x0aea('0x1d3')]=function(_0x235bdc){var _0x43f7f1=this;return function(_0x14a022){return new BPromise(function(_0x5de24a,_0x1001ac){_[_0x0aea('0xc7')](_0x235bdc,_0x14a022[0x0]);if(checkGetDataPredictive(_0x14a022[0x0])){loggerPredictive[_0x0aea('0x75')](JSON[_0x0aea('0x6f')](_0x14a022[0x0]));if(_0x235bdc[_0x0aea('0x1c2')]===_0x0aea('0x1c3')){return _0x43f7f1[_0x0aea('0xbc')](_0x235bdc['id'])[_0x0aea('0xaf')](function(_0x21ec17){var _0x169ade=_0x235bdc[_0x0aea('0x4f')]-_0x21ec17[0x0][_0x0aea('0x1d4')];var _0x56073b=_0x235bdc[_0x0aea('0x1c0')]*0x3c;var _0x30d42c=_0x14a022[0x0][_0x0aea('0x7d')]+_0x14a022[0x0][_0x0aea('0x65')];var _0x3853a8=(_0x14a022[0x0][_0x0aea('0x78')]+_0x14a022[0x0][_0x0aea('0x10c')]+_0x14a022[0x0][_0x0aea('0x7b')])/_0x14a022[0x0][_0x0aea('0x69')];var _0x5b2b87=_0x235bdc['dialPredictiveOptimizationPercentage']/0x64;_0x235bdc[_0x0aea('0x67')]=_0x21ec17[0x0][_0x0aea('0x1d4')]||0x0;_0x235bdc[_0x0aea('0x1bb')]=_0x3853a8>0x0?_0x3853a8:0x1;return _0x43f7f1[_0x0aea('0x1d0')](_0x169ade,_0x56073b,_0x30d42c,_0x3853a8,_0x5b2b87);})['then'](function(_0xd41b84){return _0x5de24a(_0xd41b84);})[_0x0aea('0xb0')](function(_0x5239c4){return _0x1001ac(msgResponse('[CatchErlangB]',_0x0aea('0x13a'),JSON[_0x0aea('0x6f')](_0x5239c4)));});}if(_0x235bdc['dialPredictiveOptimization']==='agentBusyFactor'){return _0x43f7f1['getVoiceQueueRtPauses'](_0x235bdc['id'])['then'](function(_0x266afe){var _0x339dfd=_0x235bdc[_0x0aea('0x4f')]-_0x266afe[0x0][_0x0aea('0x1d4')];var _0x59b44f=_0x235bdc[_0x0aea('0x1c0')]*0x3c;var _0x215933=_0x14a022[0x0][_0x0aea('0x7d')]+_0x14a022[0x0][_0x0aea('0x65')];var _0x4ba5f1=(_0x14a022[0x0][_0x0aea('0x78')]+_0x14a022[0x0][_0x0aea('0x10c')]+_0x14a022[0x0][_0x0aea('0x7b')])/_0x14a022[0x0][_0x0aea('0x69')];var _0x105e2d=_0x235bdc['dialPredictiveOptimizationPercentage']/0x64;_0x235bdc[_0x0aea('0x67')]=_0x266afe[0x0][_0x0aea('0x1d4')]||0x0;_0x235bdc[_0x0aea('0x1bb')]=_0x4ba5f1>0x0?_0x4ba5f1:0x1;return _0x43f7f1[_0x0aea('0x1d5')](_0x339dfd,_0x59b44f,_0x215933,_0x4ba5f1,_0x105e2d);})['then'](function(_0x5005e8){return _0x5de24a(_0x5005e8);})[_0x0aea('0xb0')](function(_0x1a189b){return _0x1001ac(msgResponse('[CatchErlangB]','Failure',JSON[_0x0aea('0x6f')](_0x1a189b)));});}}else{return _0x1001ac(msgResponse(_0x0aea('0x1d1'),_0x0aea('0x13a'),_0x0aea('0x1d2')));}});};};Dialer[_0x0aea('0x19')][_0x0aea('0x1cd')]=function(_0x19b5d4){var _0x2247bd=this;return function(){var _0x47ae80=0x0;var _0x4b1d54=Math['floor'](_0x19b5d4[_0x0aea('0x6b')]*0x3e8);if(_0x4b1d54>0x0){_0x4b1d54=_0x4b1d54<0x64?0x64:_0x4b1d54;loggerPredictive[_0x0aea('0x75')](_0x19b5d4[_0x0aea('0x3c')],_0x0aea('0x1d6'),_0x4b1d54,_0x0aea('0x46'));_0x19b5d4[_0x0aea('0x89')]=setInterval(function(){_0x2247bd['handlePredictive'](_0x19b5d4);loggerPredictiveCalls[_0x0aea('0x75')](_0x0aea('0x1d7'),_0x47ae80+=0x1);},_0x4b1d54);}else{loggerPredictive[_0x0aea('0x75')](_0x19b5d4[_0x0aea('0x3c')],_0x0aea('0x1d8'));}};};Dialer[_0x0aea('0x19')][_0x0aea('0x1d9')]=function(_0x15006f,_0x4f85b6){var _0x38f7ab=this;return function(_0x1f43d0){if(_[_0x0aea('0x74')](_0x1f43d0)){if(_[_0x0aea('0xa7')](_0x4f85b6[_0x0aea('0xcb')])||!_0x4f85b6[_0x0aea('0x1da')]){if(_0x15006f[_0x0aea('0x14f')]===_0x0aea('0x9')){_0x15006f['queueStatusComplete']=_['isUndefined'](_0x15006f[_0x0aea('0x124')])?!![]:_0x15006f[_0x0aea('0x124')];var _0x26fd5d=uuid['v4']();_0x38f7ab['actions'][_0x26fd5d]=new Action(_0x15006f,_0x4f85b6,_0x26fd5d);loggerBooked[_0x0aea('0x75')](_0x0aea('0x1db'),_0x26fd5d,_0x0aea('0x1dc'),JSON[_0x0aea('0x6f')](_0x15006f[_0x0aea('0x124')]),_0x0aea('0x1dd'),_0x15006f[_0x0aea('0x3c')]);if(_0x15006f[_0x0aea('0x124')]){_0x15006f[_0x0aea('0x124')]=![];_0x38f7ab['queueBooked'][_0x38f7ab[_0x0aea('0x22')][_0x26fd5d]['queue']]=[];ami['Action']({'actionid':_0x26fd5d,'action':_0x0aea('0x1de'),'queue':_0x15006f[_0x0aea('0x3c')]})[_0x0aea('0xb0')](function(){_0x38f7ab['updateOriginated'](_0x15006f);_0x38f7ab['rescheduleContact']({'active':![],'ContactId':_0x38f7ab['actions'][_0x26fd5d][_0x0aea('0xc9')],'ListId':_0x38f7ab[_0x0aea('0x22')][_0x26fd5d][_0x0aea('0xca')],'VoiceQueueId':_0x38f7ab[_0x0aea('0x22')][_0x26fd5d][_0x0aea('0xcc')]||undefined,'CampaignId':_0x38f7ab[_0x0aea('0x22')][_0x26fd5d]['CampaignId']||undefined})['catch'](loggerCatch(_0x0aea('0x1df')));delete _0x38f7ab[_0x0aea('0x22')][_0x26fd5d];});}else{loggerBooked[_0x0aea('0x75')](_0x0aea('0x1e0'),JSON[_0x0aea('0x6f')](_0x15006f['queueStatusComplete']),_0x0aea('0x1dd'),_0x15006f[_0x0aea('0x3c')]);_0x38f7ab['updateOriginated'](_0x15006f);_0x38f7ab[_0x0aea('0xb8')]({'active':![],'ContactId':_0x38f7ab[_0x0aea('0x22')][_0x26fd5d][_0x0aea('0xc9')],'ListId':_0x38f7ab[_0x0aea('0x22')][_0x26fd5d][_0x0aea('0xca')],'VoiceQueueId':_0x38f7ab[_0x0aea('0x22')][_0x26fd5d][_0x0aea('0xcc')]||undefined,'CampaignId':_0x38f7ab[_0x0aea('0x22')][_0x26fd5d][_0x0aea('0xcd')]||undefined})['catch'](loggerCatch(_0x0aea('0x1df')));delete _0x38f7ab[_0x0aea('0x22')][_0x26fd5d];}}else{return _0x38f7ab[_0x0aea('0x160')](_0x15006f,_0x4f85b6);}}else{if(getDiff(_0x4f85b6['scheduledat'])<_0x15006f[_0x0aea('0x1e1')]*0x3c){if(_0x4f85b6[_0x0aea('0x1e2')]&&!_0x4f85b6[_0x0aea('0x1e2')]['voicePause']){_0x38f7ab[_0x0aea('0x8a')][_0x0aea('0x1e3')](_0x4f85b6['id'])[_0x0aea('0x128')](function(){_0x38f7ab['updateOriginated'](_0x15006f);});}else{_0x38f7ab[_0x0aea('0xb9')]({'active':![]},_0x4f85b6['id'],0x1)[_0x0aea('0x128')](function(){_0x38f7ab[_0x0aea('0xaa')](_0x15006f);});}}else{_0x15006f[_0x0aea('0x1e4')]+=0x1;_0x38f7ab[_0x0aea('0xaa')](_0x15006f);if(_0x15006f[_0x0aea('0x1e5')]){_0x38f7ab[_0x0aea('0xb8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4f85b6[_0x0aea('0xc9')],'ListId':_0x4f85b6[_0x0aea('0xca')],'VoiceQueueId':_0x4f85b6[_0x0aea('0xcc')]||undefined,'CampaignId':_0x4f85b6['CampaignId']||undefined})[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x1e6')));_0x38f7ab[_0x0aea('0xc0')](createObjHistory(_0x15006f,_0x4f85b6,'RECALLINQUEUE',0x17,_0x0aea('0x1e7')))[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x1e8')));}else{_0x38f7ab[_0x0aea('0xc6')](createObjHistory(_0x15006f,_0x4f85b6,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x15006f[_0x0aea('0x5d')]+=0x1;_0x38f7ab[_0x0aea('0xc6')](createObjHistory(_0x15006f,_0x4f85b6,_0x0aea('0x1e9'),0xd,'Blacklist'),_0x0aea('0x1ea'),_0x0aea('0x1eb'));throw _0x0aea('0x1ec');}};};Dialer[_0x0aea('0x19')]['handleIvr']=function(_0x292c49){var _0x1cccf0=this;var _0x505478=_0x292c49['limitCalls']-_0x292c49[_0x0aea('0x90')]-_0x292c49[_0x0aea('0x1ed')];emitCampaignSummary(_0x292c49);if(_0x505478>0x0){if(_0x505478>this[_0x0aea('0x21')]){_0x505478=this[_0x0aea('0x21')];}_0x292c49[_0x0aea('0x1ed')]+=_0x505478;this[_0x0aea('0xbb')](_0x292c49['id'],_0x505478,_0x292c49[_0x0aea('0x1ee')])[_0x0aea('0xaf')](function(_0x28460b){_0x292c49[_0x0aea('0x1ed')]-=_0x505478;_0x292c49[_0x0aea('0x1ed')]=_0x292c49[_0x0aea('0x1ed')]>0x0?_0x292c49[_0x0aea('0x1ed')]:0x0;if(!checkContactEmpty(_0x28460b)){_0x292c49[_0x0aea('0x3e')]=_0x0aea('0x98');logger['info'](_0x0aea('0x1ef')+_0x292c49[_0x0aea('0x3c')]);}else{_0x292c49['originated']+=_0x28460b[_0x0aea('0x8f')];_0x292c49[_0x0aea('0x3e')]=_0x0aea('0x1f0');for(var _0x5bc724=0x0;_0x5bc724<_0x28460b[_0x0aea('0x8f')];_0x5bc724+=0x1){_0x292c49[_0x0aea('0x1f1')]+=0x1;if(_[_0x0aea('0xa7')](_0x28460b[_0x5bc724])||_[_0x0aea('0xa7')](_0x28460b[_0x5bc724]['Contact'])||_['isNil'](_0x28460b[_0x5bc724]['Contact']['phone'])){_0x1cccf0[_0x0aea('0x1f2')]('[actionOriginate]\x20',_0x292c49,_0x28460b[_0x5bc724]);}else{_0x1cccf0[_0x0aea('0xb4')](_[_0x0aea('0xc8')](_0x28460b[_0x5bc724],['CampaignId',_0x0aea('0x1f3')]))[_0x0aea('0xaf')](_0x1cccf0[_0x0aea('0x1d9')](_0x292c49,_0x28460b[_0x5bc724]))['catch'](_0x1cccf0['loggerHandler'](_0x0aea('0x1f4'),_0x292c49));}}}})['catch'](loggerGetContactDialer(_0x0aea('0x1f5'),_0x292c49,_0x505478));}};Dialer[_0x0aea('0x19')][_0x0aea('0x151')]=function(_0x1940f9,_0x4abbfc){var _0x219d45=this;var _0x327eb2=[];var _0x567e93=_0x4abbfc>=0x1?_0x4abbfc:0x1;if(_0x1940f9['dialMethod']===_0x0aea('0x9')){_0x567e93=0x1;}var _0xb067c9=Math['floor'](_0x1940f9['available']*_0x567e93)-_0x1940f9[_0x0aea('0x90')]-_0x1940f9[_0x0aea('0x1ed')];emitVoiceQueueSummary(_0x1940f9);if(_0x1940f9[_0x0aea('0x1f6')]>0x0){var _0x57169b=_0x1940f9[_0x0aea('0x1f6')]-_0x1940f9['originated']-_0x1940f9[_0x0aea('0x53')]-_0x1940f9['temp']-_0x1940f9[_0x0aea('0x50')];if(_0xb067c9>_0x57169b){_0xb067c9=_0x57169b;}}if(_0xb067c9>0x0){if(_0x1940f9[_0x0aea('0x14f')]===_0x0aea('0x9')){_0xb067c9=0x1;}if(_0xb067c9>this['maxNumberOriginate']){_0xb067c9=this[_0x0aea('0x21')];}_0x1940f9['temp']+=_0xb067c9;for(var _0x54bae9 in this[_0x0aea('0x1f')]){if(typeof this[_0x0aea('0x1f')][_0x54bae9]!=='undefined'){if(this['agents'][_0x54bae9][_0x0aea('0xa0')]===_0x0aea('0x1f7')&&this[_0x0aea('0x1f')][_0x54bae9][_0x0aea('0xa9')]===_0x0aea('0x1f8')){_0x327eb2['push'](this[_0x0aea('0x1f')][_0x54bae9]['id']);}}}this[_0x0aea('0x1f9')](_0x1940f9['id'],_0x327eb2,_0xb067c9,_0x1940f9[_0x0aea('0x1ee')])[_0x0aea('0xaf')](function(_0x3e7a05){_0x1940f9['temp']-=_0xb067c9;_0x1940f9[_0x0aea('0x1ed')]=_0x1940f9[_0x0aea('0x1ed')]>0x0?_0x1940f9[_0x0aea('0x1ed')]:0x0;if(!checkContactEmpty(_0x3e7a05)){_0x219d45[_0x0aea('0xae')](_0x1940f9)[_0x0aea('0xaf')](sendMessageReschedule(_0x1940f9))[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x1fa')));}else{_0x1940f9[_0x0aea('0x90')]+=_0x3e7a05[_0x0aea('0x8f')];_0x1940f9[_0x0aea('0x3e')]=_0x1940f9[_0x0aea('0x14f')]===_0x0aea('0x9')?_0x0aea('0x168'):_0x0aea('0x1f0');for(var _0x5c5773=0x0;_0x5c5773<_0x3e7a05[_0x0aea('0x8f')];_0x5c5773+=0x1){if(_[_0x0aea('0xa7')](_0x3e7a05[_0x5c5773])||_[_0x0aea('0xa7')](_0x3e7a05[_0x5c5773][_0x0aea('0x162')])||_[_0x0aea('0xa7')](_0x3e7a05[_0x5c5773]['Contact'][_0x0aea('0x183')])){_0x219d45['emptyContact']('[actionOriginate]\x20',_0x1940f9,_0x3e7a05[_0x5c5773]);}else{_0x219d45[_0x0aea('0xb1')](_[_0x0aea('0xc8')](_0x3e7a05[_0x5c5773],[_0x0aea('0xcc'),'Contact.phone']))[_0x0aea('0xaf')](_0x219d45[_0x0aea('0x1d9')](_0x1940f9,_0x3e7a05[_0x5c5773]))[_0x0aea('0xb0')](_0x219d45[_0x0aea('0xc4')](_0x0aea('0x1fb'),_0x1940f9));}}}})[_0x0aea('0xb0')](loggerGetContactDialer('[getContactDialer2]',_0x1940f9,_0xb067c9));}};Dialer[_0x0aea('0x19')][_0x0aea('0x89')]=function(_0x210636){if(_0x210636[_0x0aea('0x1f6')]>0x0){var _0x534e74=_0x210636['dialLimitQueue']-_0x210636['originated']-_0x210636[_0x0aea('0x53')];if(_0x534e74>0x0){this[_0x0aea('0x1fc')](_0x210636);}else{loggerPredictiveCalls[_0x0aea('0x75')](_0x0aea('0x1fd'));}}else{this['tryOriginatePredictive'](_0x210636);}};Dialer[_0x0aea('0x19')][_0x0aea('0x1fc')]=function(_0x474c73){var _0x43f56d=this;var _0x504750=[];_0x474c73[_0x0aea('0x90')]+=0x1;for(var _0x87f03c in this[_0x0aea('0x1f')]){if(typeof this['agents'][_0x87f03c]!==_0x0aea('0xa6')){if(this[_0x0aea('0x1f')][_0x87f03c][_0x0aea('0xa0')]===_0x0aea('0x1f7')&&this[_0x0aea('0x1f')][_0x87f03c][_0x0aea('0xa9')]===_0x0aea('0x1f8')){_0x504750[_0x0aea('0x122')](this[_0x0aea('0x1f')][_0x87f03c]['id']);}}}this[_0x0aea('0x1f9')](_0x474c73['id'],_0x504750,0x1,_0x474c73[_0x0aea('0x1ee')])['then'](function(_0x1b6dd4){if(!checkContactEmpty(_0x1b6dd4)){checkContactLowerLimitOriginate(_0x474c73,0x1,0x0);_0x43f56d[_0x0aea('0xae')](_0x474c73)[_0x0aea('0xaf')](sendMessageReschedule(_0x474c73))[_0x0aea('0xb0')](loggerCatch(_0x0aea('0x1fa')));}else{_0x474c73[_0x0aea('0x3e')]=_0x0aea('0x1f0');if(_[_0x0aea('0xa7')](_0x1b6dd4[0x0])||_[_0x0aea('0xa7')](_0x1b6dd4[0x0][_0x0aea('0x162')])||_['isNil'](_0x1b6dd4[0x0][_0x0aea('0x162')][_0x0aea('0x183')])){_0x43f56d[_0x0aea('0x1f2')]('[actionOriginate]\x20',_0x474c73,_0x1b6dd4[0x0]);}else{_0x43f56d['checkIsBlackList'](_[_0x0aea('0xc8')](_0x1b6dd4[0x0],['VoiceQueueId',_0x0aea('0x1f3')]))[_0x0aea('0xaf')](_0x43f56d[_0x0aea('0x1d9')](_0x474c73,_0x1b6dd4[0x0]))[_0x0aea('0xb0')](_0x43f56d[_0x0aea('0xc4')]('[actionOriginatePredictive]\x20',_0x474c73));}}})[_0x0aea('0xb0')](loggerGetContactDialer(_0x0aea('0x1fe'),_0x474c73,0x1));emitVoiceQueueSummary(_0x474c73);};Dialer[_0x0aea('0x19')][_0x0aea('0x1d0')]=function(_0x548462,_0x4c6069,_0x166250,_0x47b3b2,_0x35f5a7,_0x1076f2){loggerPredictive[_0x0aea('0x75')](_0x0aea('0x1ff'));loggerPredictive['info'](_0x0aea('0x200'),_0x548462);loggerPredictive[_0x0aea('0x75')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c6069);loggerPredictive['info'](_0x0aea('0x201'),_0x166250);loggerPredictive[_0x0aea('0x75')](_0x0aea('0x202'),_0x47b3b2);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35f5a7);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x241104,_0x3f6012){if(_0x548462<=0x0||isNaN(_0x548462)){return _0x3f6012(msgResponse(_0x0aea('0x203'),'Error',_0x0aea('0x204')+_0x548462));}if(_0x166250<=0x0||isNaN(_0x166250)){return _0x3f6012(msgResponse(_0x0aea('0x203'),_0x0aea('0x45'),_0x0aea('0x205')+_0x166250));}if(_0x47b3b2<=0x0||isNaN(_0x47b3b2)){return _0x3f6012(msgResponse(_0x0aea('0x203'),_0x0aea('0x45'),_0x0aea('0x206')+_0x47b3b2));}if(_0x4c6069<=0x0||isNaN(_0x4c6069)){return _0x3f6012(msgResponse('[abandonmentRate]','Error',_0x0aea('0x207')+_0x4c6069));}if(_0x35f5a7<=0x0||isNaN(_0x35f5a7)){return _0x3f6012(msgResponse(_0x0aea('0x203'),_0x0aea('0x45'),'Amax\x20=\x20'+_0x35f5a7));}_0x1076f2=_0x1076f2||0x0;var _0x452bf3=0x1/_0x166250;var _0x261f07=0x0;var _0x35f934=0x0;var _0x498780=0x0;var _0x1c81f7=0x0;for(var _0x22b5a6=0x0;_0x498780<_0x35f5a7;_0x22b5a6+=0x1){_0x35f934=_0x22b5a6/_0x4c6069;_0x261f07=(_0x47b3b2*_0x35f934+_0x1076f2)/_0x452bf3;_0x498780=erlangb(_0x261f07,_0x548462);_0x1c81f7=_0x261f07/_0x548462*(0x1-erlangb(_0x261f07,_0x548462));}return _0x241104({'erlangCalls':_0x22b5a6,'erlangCallToSecond':_0x4c6069/_0x22b5a6,'erlangAbandonmentRate':_0x498780,'erlangBusyFactor':_0x1c81f7});});};Dialer[_0x0aea('0x19')][_0x0aea('0x1d5')]=function(_0x370d81,_0x2da924,_0x381209,_0x1b02fc,_0x3f509e,_0x59e5ee){loggerPredictive[_0x0aea('0x75')](_0x0aea('0x208'));loggerPredictive[_0x0aea('0x75')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x370d81);loggerPredictive['info'](_0x0aea('0x209'),_0x2da924);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x381209);loggerPredictive['info'](_0x0aea('0x202'),_0x1b02fc);loggerPredictive[_0x0aea('0x75')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f509e);loggerPredictive[_0x0aea('0x75')]('---------------------------');return new BPromise(function(_0x5679eb,_0x5883f3){if(_0x370d81<=0x0||isNaN(_0x370d81)){return _0x5883f3(msgResponse('[busyFactor]',_0x0aea('0x45'),_0x0aea('0x204')+_0x370d81));}if(_0x381209<=0x0||isNaN(_0x381209)){return _0x5883f3(msgResponse('[busyFactor]',_0x0aea('0x45'),'Ts\x20=\x20'+_0x381209));}if(_0x1b02fc<=0x0||isNaN(_0x1b02fc)){return _0x5883f3(msgResponse(_0x0aea('0x20a'),_0x0aea('0x45'),_0x0aea('0x206')+_0x1b02fc));}if(_0x2da924<=0x0||isNaN(_0x2da924)){return _0x5883f3(msgResponse('[busyFactor]',_0x0aea('0x45'),_0x0aea('0x207')+_0x2da924));}if(_0x3f509e<=0x0||isNaN(_0x3f509e)){return _0x5883f3(msgResponse('[busyFactor]',_0x0aea('0x45'),_0x0aea('0x20b')+_0x3f509e));}_0x59e5ee=_0x59e5ee||0x0;var _0x112a1d=0x1/_0x381209;var _0x239e72=0x0;var _0x29c08b=0x0;var _0x1c06a2=0x0;var _0x1a0dff=0x0;for(var _0x3fb6d8=0x0;_0x1a0dff<_0x3f509e;_0x3fb6d8+=0x1){_0x29c08b=_0x3fb6d8/_0x2da924;_0x239e72=(_0x1b02fc*_0x29c08b+_0x59e5ee)/_0x112a1d;_0x1c06a2=erlangb(_0x239e72,_0x370d81);_0x1a0dff=_0x239e72/_0x370d81*(0x1-erlangb(_0x239e72,_0x370d81));}return _0x5679eb({'erlangCalls':_0x3fb6d8,'erlangCallToSecond':_0x2da924/_0x3fb6d8,'erlangAbandonmentRate':_0x1c06a2,'erlangBusyFactor':_0x1a0dff});});};module[_0x0aea('0x20c')]=Dialer; \ No newline at end of file +var _0xb872=['is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','uniqueId','[uniqueid]','clearZombieChannels','[actions]','undefined','enqueue','isNil','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','status','SIP/%s','unmonitored','uniqueid','variable','amdstatus','value','HANGUP','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','dialAMDActive','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','amd','countabandonedretry','stateGlobal','createStateFinal','add','syncHangup','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','Drop','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','dropreason','CALLEREXIT','dialAbandonedMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Abandoned]','Abandoned','calleridnum','syncNewExten','actionid','roundrobin','locked','stateinterface','push','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','Action','iftime\x20%s,%s','interval','content','indexOf','true','command','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','predictive','booked','Queue','method\x20not\x20recognized','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','getCaller','NONE','outbound','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','startProgressive','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','busyFactor','floor','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','reachable','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','ivrOriginated','queueBooked','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','isEmpty','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','milliseconds','diff','seconds','type','strategy','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','startPredictive','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','error','stack','inspect','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb872,0x16d));var _0x2b87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb872[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x2b87('0x0'));var BPromise=require(_0x2b87('0x1'));var uuid=require('uuid');var moment=require(_0x2b87('0x2'));var rr=require('rr');var md5=require(_0x2b87('0x3'));var Redis=require(_0x2b87('0x4'));var ut=require(_0x2b87('0x5'));var config=require(_0x2b87('0x6'));var logger=require(_0x2b87('0x7'))(_0x2b87('0x8'));var loggerBooked=require(_0x2b87('0x7'))('booked');var loggerPredictive=require(_0x2b87('0x7'))('predictive');var loggerPredictiveCalls=require(_0x2b87('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x2b87('0x7'))(_0x2b87('0x9'));var ami=require(_0x2b87('0xa'));config['redis']=_[_0x2b87('0xb')](config['redis'],{'host':_0x2b87('0xc'),'port':0x18eb});var io=require(_0x2b87('0xd'))(new Redis(config[_0x2b87('0xe')]));var cmHopper=require(_0x2b87('0xf'));var cmHopperHistory=require(_0x2b87('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x2b87('0x11'));var Action=require('./action');var History=require(_0x2b87('0x12'));var Final=require('./final');var AgentComplete=require(_0x2b87('0x13'));var QueueCallerAbandon=require(_0x2b87('0x14'));var Hangup=require(_0x2b87('0x15'));var ipAgi=process[_0x2b87('0x16')]['XCALLY_IP_AGI']||_0x2b87('0x17');var strategy={'rrmemory':_0x2b87('0x18'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x2b87('0x19')]['enqueue']=function(_0x423a86){this[_0x2b87('0x1a')]=this[_0x2b87('0x1a')]?this[_0x2b87('0x1a')][_0x2b87('0x1b')](_0x423a86):_0x423a86();};function Dialer(_0x223b4d,_0x233ea7){this[_0x2b87('0x1c')]=new Sequence();this[_0x2b87('0x1d')]=_0x233ea7;this[_0x2b87('0x1e')]=_0x223b4d[_0x2b87('0x1e')];this['campaigns']=_0x223b4d[_0x2b87('0x1f')];this[_0x2b87('0x20')]=_0x223b4d[_0x2b87('0x20')];this[_0x2b87('0x21')]=_0x223b4d['trunks'];this['maxNumberOriginate']=config[_0x2b87('0x22')]||0x2;this['channels']={};this[_0x2b87('0x23')]={};this[_0x2b87('0x24')]={};this['uniqueId']={};this[_0x2b87('0x25')]={};this['startPredictive']={};this['startProgressive']={};this[_0x2b87('0x26')]={};this[_0x2b87('0x27')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x2b87('0x28')][_0x2b87('0x29')](this));ami['on']('queuecallerabandon',this[_0x2b87('0x2a')][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x2b'),this[_0x2b87('0x2c')][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x2d'),this[_0x2b87('0x2e')]['bind'](this));ami['on'](_0x2b87('0x2f'),this[_0x2b87('0x9')]['bind'](this));ami['on'](_0x2b87('0x30'),this['syncHangup'][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x31'),this['syncNewExten']['bind'](this));ami['on'](_0x2b87('0x32'),this[_0x2b87('0x33')][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x34'),this[_0x2b87('0x35')][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x36'),this[_0x2b87('0x37')][_0x2b87('0x29')](this));this[_0x2b87('0x38')]();this['loopClearZombieChannels']();}function isNotNull(_0xb0bbf4){return _0xb0bbf4!==null&&!_[_0x2b87('0x39')](_0xb0bbf4);}function checkIsLoggedIn(_0x234882,_0x36d948){return function(){if(_0x36d948<=0x0){_0x234882['message']=_0x2b87('0x3a');throw _0x234882[_0x2b87('0x3b')]+_0x2b87('0x3c');}};}function isActive(_0x596a96){return _0x596a96;}function checkIsActive(_0x204ee0,_0x4807b9){return function(){if(!isActive(_0x4807b9)){_0x204ee0[_0x2b87('0x3d')]=_0x2b87('0x3e');throw _0x204ee0[_0x2b87('0x3b')]+_0x2b87('0x3f');}};}function checkInterval(_0x52b34d){return function(){if(!isNotNull(_0x52b34d[_0x2b87('0x40')])){_0x52b34d['message']=_0x2b87('0x41');throw _0x52b34d[_0x2b87('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x52b34d[_0x2b87('0x40')][_0x2b87('0x42')])){_0x52b34d[_0x2b87('0x3d')]=_0x2b87('0x41');throw _0x52b34d[_0x2b87('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x2b87('0x43')](_0x52b34d[_0x2b87('0x40')][_0x2b87('0x42')]))){_0x52b34d[_0x2b87('0x3d')]='INTERVAL_IS_NULL';throw _0x52b34d[_0x2b87('0x3b')]+_0x2b87('0x44');}};}function msgResponse(_0x20f85e,_0x45f4b2,_0x104bfc){return{'action':_0x20f85e,'response':_0x45f4b2,'message':_0x104bfc,'stack':_0x104bfc};}function myreject(_0x1d6501){return function(_0x4a46a7){return _0x1d6501(msgResponse(_0x2b87('0x45'),_0x2b87('0x46'),JSON['stringify'](_0x4a46a7)));};}function getSeconds(_0xcceba5,_0x3d0a77){var _0x17dadd=moment(_0xcceba5)[_0x2b87('0x47')](0x0);var _0x2a8e68=moment(_0x3d0a77)[_0x2b87('0x47')](0x0);return _0x17dadd[_0x2b87('0x48')](_0x2a8e68,_0x2b87('0x49'));}function emit(_0x4995f1,_0x5b4ee2,_0x5f34a9){io['to'](_0x4995f1)['emit'](_0x5b4ee2,_0x5f34a9);}function emitVoiceQueueSummary(_0x16cb13){if(_0x16cb13[_0x2b87('0x4a')]==='outbound'){var _0x48ced6={'id':_0x16cb13['id'],'name':_0x16cb13['name'],'strategy':_0x16cb13[_0x2b87('0x4b')],'answered':_0x16cb13['answered'],'available':_0x16cb13['available'],'loggedIn':_0x16cb13['loggedIn'],'pTalking':_0x16cb13['pTalking'],'sumBillable':_0x16cb13['sumBillable'],'sumDuration':_0x16cb13[_0x2b87('0x4c')],'sumHoldTime':_0x16cb13[_0x2b87('0x4d')]||0x0,'talking':_0x16cb13[_0x2b87('0x4e')],'total':_0x16cb13[_0x2b87('0x4f')],'type':_0x16cb13[_0x2b87('0x4a')],'unmanaged':_0x16cb13[_0x2b87('0x50')],'abandoned':_0x16cb13['abandoned'],'waiting':_0x16cb13[_0x2b87('0x51')],'loggedInDb':_0x16cb13[_0x2b87('0x52')],'dialActive':_0x16cb13[_0x2b87('0x53')],'dialMethod':_0x16cb13[_0x2b87('0x54')],'dialOriginateCallerIdName':_0x16cb13[_0x2b87('0x55')],'dialOriginateCallerIdNumber':_0x16cb13['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x16cb13[_0x2b87('0x56')],'dialPrefix':_0x16cb13[_0x2b87('0x57')],'outboundAnswerAgiCallsDay':_0x16cb13[_0x2b87('0x58')],'outboundAnswerCallsDay':_0x16cb13[_0x2b87('0x59')],'outboundBlacklistCallsDay':_0x16cb13[_0x2b87('0x5a')],'outboundBusyCallsDay':_0x16cb13[_0x2b87('0x5b')],'outboundCongestionCallsDay':_0x16cb13[_0x2b87('0x5c')],'outboundDropCallsDayACS':_0x16cb13[_0x2b87('0x5d')],'outboundDropCallsDayCallersExit':_0x16cb13[_0x2b87('0x5e')],'outboundDropCallsDayTimeout':_0x16cb13[_0x2b87('0x5f')],'outboundNoAnswerCallsDay':_0x16cb13[_0x2b87('0x60')],'outboundNoSuchCallsDay':_0x16cb13[_0x2b87('0x61')],'outboundOriginateFailureCallsDay':_0x16cb13[_0x2b87('0x62')],'outboundReCallsDay':_0x16cb13[_0x2b87('0x63')],'outboundRejectCallsDay':_0x16cb13[_0x2b87('0x64')],'outboundUnknownCallsDay':_0x16cb13[_0x2b87('0x65')],'predictiveIntervalAnsweredCalls':_0x16cb13[_0x2b87('0x66')],'predictiveIntervalAvgHoldtime':_0x16cb13[_0x2b87('0x67')],'predictiveIntervalAvgTalktime':_0x16cb13[_0x2b87('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x16cb13[_0x2b87('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x16cb13[_0x2b87('0x6a')],'predictiveIntervalErlangCalls':_0x16cb13[_0x2b87('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x16cb13[_0x2b87('0x6c')],'predictiveIntervalHitRate':_0x16cb13[_0x2b87('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x16cb13[_0x2b87('0x6e')],'predictiveIntervalPauses':_0x16cb13[_0x2b87('0x6f')],'predictiveIntervalAvailable':_0x16cb13[_0x2b87('0x70')],'predictiveIntervalTotalCalls':_0x16cb13[_0x2b87('0x71')],'message':_0x16cb13[_0x2b87('0x3d')],'originated':_0x16cb13['originated'],'erlangCalls':_0x16cb13[_0x2b87('0x72')],'erlangCallToSecond':_0x16cb13[_0x2b87('0x73')],'erlangAbandonmentRate':_0x16cb13['erlangAbandonmentRate'],'erlangBusyFactor':_0x16cb13['erlangBusyFactor'],'startPredictive':_0x16cb13[_0x2b87('0x74')],'startProgressive':_0x16cb13['startProgressive']};if(_0x16cb13['Trunk']){_0x48ced6[_0x2b87('0x75')]={'id':_0x16cb13['Trunk']['id'],'name':_0x16cb13['Trunk'][_0x2b87('0x3b')],'active':_0x16cb13['Trunk'][_0x2b87('0x76')],'callerid':_0x16cb13[_0x2b87('0x75')][_0x2b87('0x77')]};}if(_0x16cb13[_0x2b87('0x40')]){_0x48ced6['Interval']={'id':_0x16cb13[_0x2b87('0x40')]['id'],'name':_0x16cb13[_0x2b87('0x40')]['name']};}var _0xff5da9=md5(JSON[_0x2b87('0x78')](_0x48ced6));if(_0x16cb13[_0x2b87('0x3')]!==_0xff5da9){_0x16cb13[_0x2b87('0x3')]=_0xff5da9;emit(util[_0x2b87('0x79')](_0x2b87('0x7a'),_0x48ced6[_0x2b87('0x3b')]),_0x2b87('0x7b'),_0x48ced6);}}}function emitCampaignSummary(_0x387312){if(_0x387312['type']==='ivr'){emit(util['format'](_0x2b87('0x7c'),_0x387312['name']),_0x2b87('0x7d'),_0x387312);}}function checkGetDataPredictive(_0x124a65){if(isNotNull(_0x124a65)&&!_[_0x2b87('0x43')](_0x124a65)){loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x7f'));loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x80'),_0x124a65[_0x2b87('0x71')]);loggerPredictive['info'](_0x2b87('0x81'),_0x124a65[_0x2b87('0x66')]);loggerPredictive['info'](_0x2b87('0x82'),_0x124a65[_0x2b87('0x6a')]);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x83'),_0x124a65[_0x2b87('0x69')]);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x84'),_0x124a65['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x85'),_0x124a65[_0x2b87('0x68')]);loggerPredictive[_0x2b87('0x7e')]('---------------------------');if(_0x124a65[_0x2b87('0x71')]>0x0){if(!_['isUndefined'](_0x124a65['predictiveIntervalAvgTalktime'])&&_0x124a65[_0x2b87('0x68')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x2b87('0x39')](_0x124a65[_0x2b87('0x67')])&&_0x124a65[_0x2b87('0x67')]>0x0){return!![];}loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x86'));}else{loggerPredictive['info'](_0x2b87('0x87'));}}else{loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x88'));}return![];}function mergeDataErlangB(_0x16ca0f){return function(_0x28c9f3){loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x89'));loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x8a'),_0x28c9f3[_0x2b87('0x72')]);loggerPredictive['info'](_0x2b87('0x8b'),_0x28c9f3[_0x2b87('0x73')]);loggerPredictive['info'](_0x2b87('0x8c'),_0x28c9f3[_0x2b87('0x8d')]);loggerPredictive['info'](_0x2b87('0x8e'),_0x28c9f3[_0x2b87('0x8f')]);loggerPredictive['info'](_0x2b87('0x8c'),_0x28c9f3[_0x2b87('0x8d')]);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x90'));_['merge'](_0x16ca0f,_0x28c9f3);};}function getDiff(_0x5a472b){var _0x12cd74=moment()[_0x2b87('0x47')](0x0);var _0xc725d6=moment(_0x5a472b)[_0x2b87('0x47')](0x0);return _0x12cd74[_0x2b87('0x48')](_0xc725d6,'seconds');}function ifInterval(_0x1954a9,_0x2fe08b){if(_['isUndefined'](_0x2fe08b)){return![];}return getDiff(_0x2fe08b)<_0x1954a9*0x3c;}function freeVariablesPredictive(_0x382b74){if(isNotNull(_0x382b74)){if(!_['isUndefined'](_0x382b74['startProgressive'])){_0x382b74['startProgressive']=undefined;loggerPredictive[_0x2b87('0x7e')](_0x382b74[_0x2b87('0x3b')],_0x2b87('0x91'));}if(!_[_0x2b87('0x39')](_0x382b74[_0x2b87('0x74')])){_0x382b74[_0x2b87('0x74')]=undefined;loggerPredictive[_0x2b87('0x7e')](_0x382b74['name'],_0x2b87('0x92'));}if(!_[_0x2b87('0x39')](_0x382b74['handlePredictive'])){clearInterval(_0x382b74[_0x2b87('0x93')]);_0x382b74[_0x2b87('0x93')]=undefined;loggerPredictive[_0x2b87('0x7e')](_0x382b74[_0x2b87('0x3b')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x19507e,_0x81adce){if(_0x81adce===0x0){return 0x0;}var _0x2b9c77=0x1;for(var _0x4062ae=0x1;_0x4062ae<=_0x81adce;_0x4062ae+=0x1){_0x2b9c77=0x1+_0x2b9c77*_0x4062ae/_0x19507e;}return 0x1/_0x2b9c77;}function isVoiceQueueOutbound(_0x7b8196){return _0x7b8196==='outbound';}function isNotPreview(_0xfc2fa2){return _0xfc2fa2!==_0x2b87('0x1d');}function isCampaignIvr(_0x314448){return _0x314448===_0x2b87('0x94');}function getCallerId(_0x274086,_0x141ab1,_0xd0cc53){if(!_[_0x2b87('0x39')](_0xd0cc53)&&typeof _0xd0cc53==='string'&&!_[_0x2b87('0x43')](_0xd0cc53)){if(!_[_0x2b87('0x39')](_0x141ab1)&&typeof _0x141ab1===_0x2b87('0x95')&&!_[_0x2b87('0x43')](_0x141ab1)){return util[_0x2b87('0x79')]('\x22%s\x22\x20<%s>',_0x141ab1,_0xd0cc53);}return util[_0x2b87('0x79')](_0x2b87('0x96'),_0xd0cc53,_0xd0cc53);}if(!_[_0x2b87('0x39')](_0x274086)&&typeof _0x274086==='string'&&!_[_0x2b87('0x43')](_0x274086)){return _0x274086;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x45f225,_0x2f6994){return function(_0x3d09ff){freeVariablesPredictive(_0x2f6994);emitVoiceQueueSummary(_0x2f6994);emitCampaignSummary(_0x2f6994);loggerSyncQueueSummary[_0x2b87('0x97')](_0x45f225,util['inspect'](_0x3d09ff,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xc5e0f8,_0x1b2bda){return function(_0xe7f5b7){loggerPredictive['error'](_0x1b2bda['name'],_0xc5e0f8);loggerPredictive['error'](_0xe7f5b7[_0x2b87('0x98')]);freeVariablesPredictive(_0x1b2bda);};}function loggerCatch(_0x259c99){return function(_0x3624e2){logger[_0x2b87('0x97')](_0x259c99,util[_0x2b87('0x99')](_0x3624e2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1a610f){return _0x1a610f&&!_[_0x2b87('0x39')](_0x1a610f)&&_0x1a610f['length']>0x0;}function decremetOriginate(_0x3fb056){if(!_[_0x2b87('0x39')](_0x3fb056)&&_0x3fb056!==null){if(typeof _0x3fb056[_0x2b87('0x9a')]!=='undefined'){if(_0x3fb056[_0x2b87('0x9a')]>0x0){_0x3fb056[_0x2b87('0x9a')]-=0x1;}else{logger[_0x2b87('0x97')](_0x2b87('0x9b'));}}}else{logger[_0x2b87('0x97')](_0x2b87('0x9c'));}}function checkContactLowerLimitOriginate(_0x5da036,_0x3b9858,_0x561e06){if(_0x3b9858>_0x561e06){for(var _0x31b33b=0x0;_0x31b33b<_0x3b9858-_0x561e06;_0x31b33b+=0x1){decremetOriginate(_0x5da036);}}}function loggerGetContactDialer(_0x30a3b4,_0x8cac5d,_0x580f27){return function(_0x3af832){checkContactLowerLimitOriginate(_0x8cac5d,_0x580f27,0x0);logger['error'](_0x30a3b4,util[_0x2b87('0x99')](_0x3af832,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5805bb){return function(_0x2d5173){if(isNotNull(_0x2d5173)&&isNotNull(_0x2d5173[0x0])){if(_0x2d5173[0x0][_0x2b87('0x9d')]>0x0){_0x5805bb[_0x2b87('0x3d')]='RESCHEDULED_CONTACTS';logger[_0x2b87('0x7e')](_0x2b87('0x9e')+_0x5805bb[_0x2b87('0x3b')],_0x2d5173[0x0][_0x2b87('0x9d')],_0x2b87('0x9f'));}else{_0x5805bb[_0x2b87('0x3d')]=_0x2b87('0xa0');logger[_0x2b87('0x7e')](_0x2b87('0xa1')+_0x5805bb[_0x2b87('0x3b')]);}}};}function notSendMessagesQueue(_0x5d9e8d){if(_0x5d9e8d[_0x2b87('0xa2')]){freeVariablesPredictive(_0x5d9e8d);if(_0x5d9e8d[_0x2b87('0x9a')]===0x0&&_0x5d9e8d[_0x2b87('0x4e')]===0x0&&_0x5d9e8d[_0x2b87('0x51')]===0x0&&(_0x5d9e8d[_0x2b87('0xa3')]||0x0)===0x0){_0x5d9e8d[_0x2b87('0xa2')]=![];_0x5d9e8d[_0x2b87('0xa4')]=0x0;_0x5d9e8d[_0x2b87('0x3d')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x2b87('0xa5'),_0x5d9e8d[_0x2b87('0x3b')],_0x2b87('0xa6'));}else{_0x5d9e8d[_0x2b87('0x3d')]=_0x2b87('0xa7');loggerSyncQueueSummary['error'](_0x2b87('0xa5'),_0x5d9e8d[_0x2b87('0x3b')],_0x2b87('0xa8'));}emitVoiceQueueSummary(_0x5d9e8d);}}function notSendMessagesCampaign(_0xe12568){if(_0xe12568['sendMessageOneNotActive']){if(_0xe12568['originated']===0x0){_0xe12568[_0x2b87('0xa2')]=![];_0xe12568[_0x2b87('0x3d')]=_0x2b87('0x3e');loggerSyncQueueSummary['error'](_0x2b87('0xa9'),_0xe12568[_0x2b87('0x3b')],_0x2b87('0xa6'));}else{_0xe12568[_0x2b87('0x3d')]=_0x2b87('0xa7');loggerSyncQueueSummary['error'](_0x2b87('0xa9'),_0xe12568[_0x2b87('0x3b')],_0x2b87('0xa8'));}emitCampaignSummary(_0xe12568);}}function createObjHistory(_0x27073e,_0x1b6d6f,_0x4313fb,_0x57e7c1,_0x22f2e6){_0x27073e[_0x2b87('0x3d')]=_0x4313fb;var _0x2b24dc=new Action(_0x27073e,_0x1b6d6f);var _0x23050d=new History(_0x2b24dc);_0x23050d[_0x2b87('0xaa')]=_0x57e7c1;_0x23050d[_0x2b87('0xab')]=_0x22f2e6;_0x23050d[_0x2b87('0xac')]=_0x2b24dc[_0x2b87('0xad')];return _0x23050d;}Dialer[_0x2b87('0x19')][_0x2b87('0xae')]=function(){var _0x379264=this;setInterval(function(){_0x379264['clearZombieChannels'](_0x379264[_0x2b87('0xaf')],_0x2b87('0xb0'));_0x379264[_0x2b87('0xb1')](_0x379264[_0x2b87('0x23')],_0x2b87('0xb2'));},0x32c8);};Dialer[_0x2b87('0x19')][_0x2b87('0xb1')]=function(_0x4e2ba1,_0x2e5f0f){var _0x24aff4=this;for(var _0x5a1be3 in _0x4e2ba1){if(typeof _0x4e2ba1[_0x5a1be3]!==_0x2b87('0xb3')){this[_0x2b87('0x1c')][_0x2b87('0xb4')](function(){if(!_[_0x2b87('0xb5')](_0x4e2ba1[_0x5a1be3])){return ami['Action']({'action':'status','channel':_0x4e2ba1[_0x5a1be3][_0x2b87('0xb6')]})[_0x2b87('0xb7')](function(_0x2f22b5){if(_0x2f22b5[_0x2b87('0x3d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4e2ba1[_0x5a1be3]&&_0x4e2ba1[_0x5a1be3][_0x2b87('0x4a')]!=='ivr'){_0x24aff4[_0x2b87('0xb8')](_0x24aff4[_0x2b87('0x1e')][_0x4e2ba1[_0x5a1be3][_0x2b87('0xb9')]]);logger[_0x2b87('0x97')]('[Dialer][checkChannel]',_0x2e5f0f,_0x5a1be3,_0x4e2ba1[_0x5a1be3][_0x2b87('0xb9')]);delete _0x4e2ba1[_0x5a1be3];}if(_0x4e2ba1[_0x5a1be3]&&_0x4e2ba1[_0x5a1be3][_0x2b87('0x4a')]===_0x2b87('0x94')){_0x24aff4[_0x2b87('0xb8')](_0x24aff4['campaigns'][_0x4e2ba1[_0x5a1be3]['queue']]);logger['error'](_0x2b87('0xba'),_0x2e5f0f,_0x5a1be3,_0x4e2ba1[_0x5a1be3][_0x2b87('0xb9')]);delete _0x4e2ba1[_0x5a1be3];}},0x2328);}});}});}}};Dialer[_0x2b87('0x19')][_0x2b87('0xbb')]=function(_0x12d877){return BPromise['resolve']()[_0x2b87('0xbc')](cmHopper[_0x2b87('0xbb')](_0x12d877))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xbd')));};Dialer[_0x2b87('0x19')][_0x2b87('0xbe')]=function(_0x13f448){return BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](cmHopperBlack[_0x2b87('0xbe')](_0x13f448))[_0x2b87('0xb7')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x2b87('0xc0')]=function(_0x590315){return BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](cmHopperBlack['checkIsBlackListIvr'](_0x590315))['catch'](loggerCatch(_0x2b87('0xc1')));};Dialer[_0x2b87('0x19')][_0x2b87('0xc2')]=function(_0x34a9c0){return BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](cmHopperHistory[_0x2b87('0xc3')](_0x34a9c0))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xc4')));};Dialer[_0x2b87('0x19')][_0x2b87('0xc5')]=function(_0x58bdc0){return BPromise['resolve']()['then'](cmHopper[_0x2b87('0xc5')](_0x58bdc0))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xc6')));};Dialer[_0x2b87('0x19')]['unlockContact']=function(_0x4c65df,_0x72e2ee,_0x1d61c2){return BPromise[_0x2b87('0xbf')]()['then'](cmHopper[_0x2b87('0xc7')](_0x4c65df,_0x72e2ee,_0x1d61c2))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xc8')));};Dialer[_0x2b87('0x19')][_0x2b87('0xc9')]=function(_0x14aea4,_0x6145aa,_0x3b3d2f,_0x31b690){return BPromise['resolve']()[_0x2b87('0xbc')](cmHopper[_0x2b87('0xc9')](_0x14aea4,_0x6145aa,_0x3b3d2f,_0x31b690))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xca')));};Dialer['prototype'][_0x2b87('0xcb')]=function(_0x1c1668,_0x453457,_0x2b367d){return BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](cmHopper[_0x2b87('0xcb')](_0x1c1668,_0x453457,_0x2b367d))['catch'](loggerCatch(_0x2b87('0xca')));};Dialer['prototype'][_0x2b87('0xcc')]=function(_0x38ebbd){return BPromise['resolve']()[_0x2b87('0xbc')](voiceQueueRt['getVoiceQueueRtPauses'](_0x38ebbd))['catch'](loggerCatch(_0x2b87('0xcd')));};Dialer[_0x2b87('0x19')][_0x2b87('0xce')]=function(_0x410b6a){return BPromise[_0x2b87('0xbf')]()['then'](cmHopper[_0x2b87('0xce')](_0x410b6a))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xcf')));};Dialer[_0x2b87('0x19')]['createHistory']=function(_0x1c66cc){return BPromise['resolve']()['then'](cmHopperHistory[_0x2b87('0xd0')](_0x1c66cc))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xd1')));};Dialer[_0x2b87('0x19')][_0x2b87('0xb8')]=function(_0x42798c){if(!_[_0x2b87('0x39')](_0x42798c)&&_0x42798c!==null){if(typeof _0x42798c[_0x2b87('0x9a')]!==_0x2b87('0xb3')){if(_0x42798c[_0x2b87('0x9a')]>0x0){_0x42798c[_0x2b87('0x9a')]-=0x1;}else{logger['error'](_0x2b87('0xd2'));}}}else{logger[_0x2b87('0x97')](_0x2b87('0xd3'));}};Dialer[_0x2b87('0x19')][_0x2b87('0xd4')]=function(_0x1b4640,_0x1496c6){var _0x2526ea=this;return function(_0x3fe2a9){_0x2526ea[_0x2b87('0xb8')](_0x1496c6);logger[_0x2b87('0x97')](_0x1b4640,util[_0x2b87('0x99')](_0x3fe2a9,{'showHidden':![],'depth':null}));};};Dialer[_0x2b87('0x19')][_0x2b87('0xd5')]=function(_0x3ebed6,_0x2164e9,_0x457009){var _0x3613ec={'state':0x19,'statedesc':_0x2b87('0xd6')};this['updateOriginated'](_0x2164e9);this[_0x2b87('0xd7')](_[_0x2b87('0xd8')](_0x3613ec,_[_0x2b87('0xd9')](_0x457009,[_0x2b87('0xda'),_0x2b87('0xdb'),'UserId','VoiceQueueId','CampaignId'])),_0x2b87('0xdc'),_0x2b87('0xdd'));logger[_0x2b87('0x97')](_0x3ebed6);};Dialer[_0x2b87('0x19')][_0x2b87('0xde')]=function(_0x8d592c){return _0x8d592c==='Success';};Dialer[_0x2b87('0x19')][_0x2b87('0xdf')]=function(_0x2fa1dd){return!_[_0x2b87('0x39')](_0x2fa1dd)&&_0x2fa1dd&&!_[_0x2b87('0x39')](_0x2fa1dd[_0x2b87('0x3b')])&&!_[_0x2b87('0x39')](_0x2fa1dd['active'])&&_0x2fa1dd[_0x2b87('0x76')]&&(this[_0x2b87('0x21')][util[_0x2b87('0x79')]('SIP/%s',_0x2fa1dd[_0x2b87('0x3b')])][_0x2b87('0xe0')]==='reachable'||this['trunks'][util['format'](_0x2b87('0xe1'),_0x2fa1dd[_0x2b87('0x3b')])][_0x2b87('0xe0')]===_0x2b87('0xe2'));};Dialer[_0x2b87('0x19')][_0x2b87('0xd7')]=function(_0x20e22e,_0x49e2c8,_0x5b625a){this['createHistory'](_0x20e22e)['catch'](loggerCatch(_0x49e2c8));this[_0x2b87('0xce')](_0x20e22e)[_0x2b87('0xb7')](loggerCatch(_0x5b625a));};Dialer[_0x2b87('0x19')][_0x2b87('0x33')]=function(_0x4a1b1c){var _0x375a22=this['uniqueId'][_0x4a1b1c[_0x2b87('0xe3')]];var _0x42b076;if(!_['isNil'](_0x4a1b1c)&&!_[_0x2b87('0xb5')](_0x4a1b1c[_0x2b87('0xe4')])&&!_[_0x2b87('0xb5')](_0x4a1b1c['variable'][_0x2b87('0xe5')])&&_0x4a1b1c['exten']==='xcally-motion-dialer'&&_0x375a22){if(_0x375a22[_0x2b87('0x4a')]!==_0x2b87('0x94')&&this['voiceQueues'][_0x375a22['queue']]['dialAMDActive']&&_0x4a1b1c[_0x2b87('0xe6')]===_0x2b87('0xe7')){delete this[_0x2b87('0xaf')][_0x4a1b1c['uniqueid']];this[_0x2b87('0xb8')](this['voiceQueues'][_0x375a22[_0x2b87('0xb9')]]);this['voiceQueues'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0x59')]+=0x1;this['voiceQueues'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0x58')]+=0x1;_0x42b076=new Hangup(_0x375a22,_0x4a1b1c);_0x42b076[_0x2b87('0xaa')]=0x12;_0x42b076['statedesc']='HangupInAMD';_0x42b076[_0x2b87('0xe8')]='AMD';this['saveInDb'](_0x42b076,_0x2b87('0xe9'),_0x2b87('0xea'));}if(_0x375a22[_0x2b87('0x4a')]!==_0x2b87('0x94')&&this['voiceQueues'][_0x375a22[_0x2b87('0xb9')]]['dialAMDActive']&&_0x4a1b1c['value']===_0x2b87('0xeb')){var _0x321d84=this;return new BPromise(function(_0x5edd51,_0x38c215){delete _0x321d84[_0x2b87('0xaf')][_0x4a1b1c[_0x2b87('0xe3')]];_0x321d84[_0x2b87('0xb8')](_0x321d84[_0x2b87('0x1e')][_0x375a22[_0x2b87('0xb9')]]);_0x321d84[_0x2b87('0x1e')][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0x59')]+=0x1;_0x321d84[_0x2b87('0x1e')][_0x375a22['queue']][_0x2b87('0x58')]+=0x1;var _0x3b8c4f=_0x321d84[_0x2b87('0x1e')][_0x375a22['queue']];var _0x2dc72e=new Hangup(_0x375a22,_0x4a1b1c);_0x2dc72e['state']=0x13;_0x2dc72e[_0x2b87('0xab')]=_0x2b87('0xec');_0x2dc72e[_0x2b87('0xe8')]=_0x2b87('0xed');_0x2dc72e[_0x2b87('0xee')]+=0x1;_0x2dc72e[_0x2b87('0xef')]+=0x1;_0x2dc72e['amd']=!![];_0x321d84[_0x2b87('0xd0')](_0x2dc72e)[_0x2b87('0xb7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2dc72e[_0x2b87('0xf0')]+_0x2dc72e[_0x2b87('0xf1')]+_0x2dc72e[_0x2b87('0xf2')]+_0x2dc72e[_0x2b87('0xf3')]+_0x2dc72e[_0x2b87('0xf4')]+_0x2dc72e['countabandonedretry']+_0x2dc72e[_0x2b87('0xee')]+_0x2dc72e[_0x2b87('0xf5')]>=_0x3b8c4f[_0x2b87('0xf6')]){_0x321d84['stateGlobal'](_0x2dc72e,_0x5edd51,_0x38c215,_0x2b87('0xf7'));}else{if(_0x2dc72e[_0x2b87('0xee')]>=_0x3b8c4f['dialMachineMaxRetry']){_0x321d84['createStateFinal'](_0x2dc72e,_0x5edd51,_0x38c215,'reason\x2019\x20machine....');}else{_0x321d84[_0x2b87('0xc5')]({'active':![],'countmachineretry':_0x2dc72e[_0x2b87('0xee')],'scheduledat':moment()['add'](_0x3b8c4f[_0x2b87('0xf8')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x2dc72e[_0x2b87('0xda')],'ListId':_0x2dc72e[_0x2b87('0xdb')],'VoiceQueueId':_0x2dc72e[_0x2b87('0xfb')]||undefined,'CampaignId':_0x2dc72e[_0x2b87('0xfc')]||undefined})['catch'](loggerCatch(_0x2b87('0xfd')));_0x5edd51({'reschedule':0x1});}}});}if(_0x375a22[_0x2b87('0x4a')]===_0x2b87('0x94')&&this['campaigns'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0xfe')]&&_0x4a1b1c[_0x2b87('0xe6')]===_0x2b87('0xe7')){delete this[_0x2b87('0xaf')][_0x4a1b1c[_0x2b87('0xe3')]];this[_0x2b87('0xb8')](this[_0x2b87('0x1f')][_0x375a22[_0x2b87('0xb9')]]);_0x42b076=new Hangup(_0x375a22,_0x4a1b1c);_0x42b076['state']=0x12;_0x42b076[_0x2b87('0xab')]=_0x2b87('0xff');_0x42b076[_0x2b87('0xe8')]='AMD';this[_0x2b87('0xd7')](_0x42b076,_0x2b87('0x100'),_0x2b87('0x101'));}if(_0x375a22[_0x2b87('0x4a')]===_0x2b87('0x94')&&this['campaigns'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0xfe')]&&_0x4a1b1c[_0x2b87('0xe6')]==='MACHINE'){var _0x321d84=this;return new BPromise(function(_0x32354a,_0x17d61a){delete _0x321d84[_0x2b87('0xaf')][_0x4a1b1c['uniqueid']];_0x321d84[_0x2b87('0xb8')](_0x321d84[_0x2b87('0x1f')][_0x375a22['queue']]);_0x321d84[_0x2b87('0x1f')][_0x375a22['queue']][_0x2b87('0x59')]+=0x1;_0x321d84['campaigns'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0x58')]+=0x1;var _0x18aac9=_0x321d84['campaigns'][_0x375a22[_0x2b87('0xb9')]];var _0x5d2782=new Hangup(_0x375a22,_0x4a1b1c);_0x5d2782[_0x2b87('0xaa')]=0x13;_0x5d2782[_0x2b87('0xab')]=_0x2b87('0xec');_0x5d2782[_0x2b87('0xe8')]=_0x2b87('0xed');_0x5d2782[_0x2b87('0xee')]+=0x1;_0x5d2782[_0x2b87('0xef')]+=0x1;_0x5d2782[_0x2b87('0x102')]=!![];_0x321d84[_0x2b87('0xd0')](_0x5d2782)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5d2782[_0x2b87('0xf0')]+_0x5d2782[_0x2b87('0xf1')]+_0x5d2782[_0x2b87('0xf2')]+_0x5d2782[_0x2b87('0xf3')]+_0x5d2782['countdropretry']+_0x5d2782[_0x2b87('0x103')]+_0x5d2782[_0x2b87('0xee')]+_0x5d2782[_0x2b87('0xf5')]>=_0x18aac9[_0x2b87('0xf6')]){_0x321d84[_0x2b87('0x104')](_0x5d2782,_0x32354a,_0x17d61a,'reason19\x20machine....');}else{if(_0x5d2782[_0x2b87('0xee')]>=_0x18aac9['dialMachineMaxRetry']){_0x321d84[_0x2b87('0x105')](_0x5d2782,_0x32354a,_0x17d61a,'reason\x2019\x20machine....');}else{_0x321d84['rescheduleContact']({'active':![],'countmachineretry':_0x5d2782[_0x2b87('0xee')],'scheduledat':moment()[_0x2b87('0x106')](_0x18aac9[_0x2b87('0xf8')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x5d2782['ContactId'],'ListId':_0x5d2782['ListId'],'VoiceQueueId':_0x5d2782['VoiceQueueId']||undefined,'CampaignId':_0x5d2782[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xfd')));_0x32354a({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x2b87('0x107')]=function(_0x4a46d0){var _0x5717b5=this[_0x2b87('0xaf')][_0x4a46d0[_0x2b87('0xe3')]];var _0x468ce0=this;var _0x901b93;if(_0x5717b5&&_0x5717b5[_0x2b87('0x4a')]===_0x2b87('0x94')){delete this['uniqueId'][_0x4a46d0[_0x2b87('0xe3')]];this[_0x2b87('0xb8')](this[_0x2b87('0x1f')][_0x5717b5['queue']]);this[_0x2b87('0x1f')][_0x5717b5[_0x2b87('0xb9')]]['ivrAnswerCallsDay']+=0x1;_0x901b93=new Hangup(_0x5717b5,_0x4a46d0);this[_0x2b87('0xd0')](_0x901b93)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x108')));this[_0x2b87('0xce')](_0x901b93)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x109')));}if(_0x5717b5&&_0x5717b5['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x5717b5['queue']]['dialQueueProject'])){delete this[_0x2b87('0xaf')][_0x4a46d0['uniqueid']];this[_0x2b87('0xb8')](this['voiceQueues'][_0x5717b5['queue']]);this[_0x2b87('0x1e')][_0x5717b5[_0x2b87('0xb9')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x5717b5[_0x2b87('0xb9')]][_0x2b87('0x58')]+=0x1;_0x901b93=new Hangup(_0x5717b5,_0x4a46d0);_0x901b93[_0x2b87('0xaa')]=0x10;_0x901b93[_0x2b87('0xab')]='AnswerAGI';_0x901b93['membername']='AGI';this[_0x2b87('0xd0')](_0x901b93)['catch'](loggerCatch(_0x2b87('0x108')));this[_0x2b87('0xce')](_0x901b93)[_0x2b87('0xb7')](loggerCatch('[syncHangupIvr]'));}if(_0x5717b5&&_0x5717b5[_0x2b87('0x4a')]!==_0x2b87('0x94')&&!isNotNull(this[_0x2b87('0x1e')][_0x5717b5[_0x2b87('0xb9')]][_0x2b87('0x10a')])){delete this[_0x2b87('0xaf')][_0x4a46d0[_0x2b87('0xe3')]];this[_0x2b87('0xb8')](this[_0x2b87('0x1e')][_0x5717b5[_0x2b87('0xb9')]]);this['voiceQueues'][_0x5717b5[_0x2b87('0xb9')]][_0x2b87('0x65')]+=0x1;_0x901b93=new Hangup(_0x5717b5,_0x4a46d0);_0x901b93[_0x2b87('0xaa')]=0xc;_0x901b93[_0x2b87('0xab')]=_0x4a46d0[_0x2b87('0x10b')];_0x901b93[_0x2b87('0xe8')]=_0x2b87('0x10c');this[_0x2b87('0xd0')](_0x901b93)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x108')));this[_0x2b87('0xce')](_0x901b93)[_0x2b87('0xb7')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0x2b87('0x2e')]=function(_0x21efbd){var _0x41c3c1=this[_0x2b87('0xaf')][_0x21efbd[_0x2b87('0xe3')]];var _0x4931a5=this;if(this[_0x2b87('0x1e')][_0x21efbd['queue']]){if(_0x41c3c1&&_0x41c3c1[_0x2b87('0x4a')]!==_0x2b87('0x94')){delete this[_0x2b87('0xaf')][_0x21efbd[_0x2b87('0xe3')]];this[_0x2b87('0x1e')][_0x21efbd[_0x2b87('0xb9')]][_0x2b87('0x59')]+=0x1;var _0x4f502f=new AgentComplete(_0x41c3c1,_0x21efbd);if(_0x21efbd[_0x2b87('0x10d')]===_0x2b87('0x10e')){_0x4f502f[_0x2b87('0x10f')]=this[_0x2b87('0x1e')][_0x21efbd[_0x2b87('0xb9')]][_0x2b87('0x110')]&&this['voiceQueues'][_0x21efbd[_0x2b87('0xb9')]][_0x2b87('0x111')]?moment()['format'](_0x2b87('0xfa')):undefined;}this['createHistory'](_0x4f502f)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x112')));this['moveContactManagedDialer'](_0x4f502f)['catch'](loggerCatch(_0x2b87('0x113')));}}};Dialer['prototype']['syncAgentConnect']=function(_0xb75a94){if(this[_0x2b87('0x1e')][_0xb75a94[_0x2b87('0xb9')]]){if(this['uniqueId'][_0xb75a94[_0x2b87('0xe3')]]&&this[_0x2b87('0xaf')][_0xb75a94[_0x2b87('0xe3')]][_0x2b87('0x4a')]!==_0x2b87('0x94')){this['updateOriginated'](this['voiceQueues'][_0xb75a94['queue']]);this['uniqueId'][_0xb75a94['uniqueid']][_0x2b87('0x114')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));}}};Dialer[_0x2b87('0x19')]['queueCallerAbandonCreateState']=function(_0x1a10f7){this['createHistory'](_0x1a10f7)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x112')));this[_0x2b87('0xce')](_0x1a10f7)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x115')));};Dialer[_0x2b87('0x19')][_0x2b87('0x2a')]=function(_0x30eb81){var _0x5c2d1b=this[_0x2b87('0xaf')][_0x30eb81[_0x2b87('0xe3')]];var _0x37f164=this;if(this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]){if(_0x5c2d1b&&_0x5c2d1b['type']!==_0x2b87('0x94')){delete this[_0x2b87('0xaf')][_0x30eb81['uniqueid']];this[_0x2b87('0xb8')](this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]);_0x5c2d1b['droptime']=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));var _0x2b2db0=new QueueCallerAbandon(_0x5c2d1b,_0x30eb81);if(getSeconds(_0x5c2d1b['droptime'],_0x5c2d1b[_0x2b87('0x116')])>=_0x5c2d1b[_0x2b87('0x117')]){this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2b87('0x1e')][_0x30eb81['queue']][_0x2b87('0x5f')]+=0x1;this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x6c')]+=0x1;_0x2b2db0['state']=0xa;_0x2b2db0[_0x2b87('0xab')]=_0x2b87('0x118');_0x2b2db0['dropreason']='TIMEOUT';_0x2b2db0[_0x2b87('0x10f')]=this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]['dialQueueProject2']?moment()['format'](_0x2b87('0xfa')):undefined;_0x2b2db0['countdropretry']+=0x1;_0x2b2db0[_0x2b87('0xef')]+=0x1;if(_0x2b2db0[_0x2b87('0xf4')]>=this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x119')]){this['queueCallerAbandonCreateState'](_0x2b2db0);}else{this[_0x2b87('0xc5')]({'active':![],'countdropretry':_0x2b2db0['countdropretry'],'scheduledat':moment()[_0x2b87('0x106')](this['voiceQueues'][_0x30eb81[_0x2b87('0xb9')]]['dialDropRetryFrequency'],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x5c2d1b['ContactId'],'ListId':_0x5c2d1b['ListId'],'VoiceQueueId':_0x5c2d1b[_0x2b87('0xfb')]||undefined,'CampaignId':_0x5c2d1b[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x11a')));var _0x4394c8=new History(_0x2b2db0);_0x4394c8['state']=0xa;_0x4394c8[_0x2b87('0xab')]=_0x2b87('0x118');_0x4394c8[_0x2b87('0xad')]=moment()['format'](_0x2b87('0xfa'));_0x4394c8[_0x2b87('0xac')]=_0x4394c8['starttime'];_0x4394c8[_0x2b87('0x11b')]=_0x2b2db0[_0x2b87('0x11b')];_0x4394c8['calleridnum']=_0x2b2db0['calleridnum'];this[_0x2b87('0xd0')](_0x4394c8)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x11c')));}}else{this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x69')]+=0x1;this['voiceQueues'][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x5e')]+=0x1;_0x2b2db0[_0x2b87('0xaa')]=0xb;_0x2b2db0[_0x2b87('0xab')]='Abandoned';_0x2b2db0[_0x2b87('0x11d')]=_0x2b87('0x11e');_0x2b2db0[_0x2b87('0x103')]+=0x1;_0x2b2db0[_0x2b87('0xef')]+=0x1;if(_0x2b2db0['countabandonedretry']>=this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x11f')]){this[_0x2b87('0x120')](_0x2b2db0);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x2b2db0[_0x2b87('0x103')],'scheduledat':moment()['add'](this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]['dialAbandonedRetryFrequency'],_0x2b87('0xf9'))[_0x2b87('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5c2d1b['ContactId'],'ListId':_0x5c2d1b[_0x2b87('0xdb')],'VoiceQueueId':_0x5c2d1b[_0x2b87('0xfb')]||undefined,'CampaignId':_0x5c2d1b['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x121')));var _0x4394c8=new History(_0x2b2db0);_0x4394c8['state']=0xb;_0x4394c8['statedesc']=_0x2b87('0x122');_0x4394c8[_0x2b87('0xad')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));_0x4394c8[_0x2b87('0xac')]=_0x4394c8[_0x2b87('0xad')];_0x4394c8[_0x2b87('0x11b')]=_0x2b2db0[_0x2b87('0x11b')];_0x4394c8[_0x2b87('0x123')]=_0x2b2db0['calleridnum'];this['createHistory'](_0x4394c8)[_0x2b87('0xb7')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0x2b87('0x124')]=function(_0x514786){if(this[_0x2b87('0x23')][_0x514786[_0x2b87('0xe3')]]){this[_0x2b87('0x23')][_0x514786[_0x2b87('0xe3')]]['channel']=_0x514786[_0x2b87('0xb6')];}if(this[_0x2b87('0xaf')][_0x514786['uniqueid']]){this['uniqueId'][_0x514786[_0x2b87('0xe3')]][_0x2b87('0xb6')]=_0x514786[_0x2b87('0xb6')];}};Dialer[_0x2b87('0x19')]['syncQueueMember']=function(_0x1a329a){if(strategy[this[_0x2b87('0x1e')][this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0xb9')]][_0x2b87('0x4b')]]===_0x2b87('0x126')){if(this[_0x2b87('0x23')][_0x1a329a['actionid']]&&_['isNil'](this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0x127')])&&_0x1a329a['status']==='1'&&_0x1a329a['paused']==='0'){if(this[_0x2b87('0x20')][_0x1a329a[_0x2b87('0x128')]]){if(!this['agents'][_0x1a329a['stateinterface']][_0x2b87('0x127')]){this['agents'][_0x1a329a['stateinterface']]['locked']=!![];this['actions'][_0x1a329a[_0x2b87('0x125')]]['locked']=!![];this[_0x2b87('0x23')][_0x1a329a['actionid']][_0x2b87('0x128')]=_0x1a329a['stateinterface'];}}}}else if((strategy[this[_0x2b87('0x1e')][this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0xb9')]]['strategy']]||_0x2b87('0x18'))===_0x2b87('0x18')){if(this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]]){if(this[_0x2b87('0x20')][_0x1a329a[_0x2b87('0x128')]]){this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0x128')]=_0x1a329a['stateinterface'];if(_['isNil'](this[_0x2b87('0x27')][this[_0x2b87('0x23')][_0x1a329a['actionid']][_0x2b87('0xb9')]])){this['queueBooked'][this[_0x2b87('0x23')][_0x1a329a['actionid']]['queue']]=[];}this[_0x2b87('0x27')][this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0xb9')]][_0x2b87('0x129')](_[_0x2b87('0xd8')](_[_0x2b87('0xd9')](this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]],['idHopper',_0x2b87('0x128')]),{'status':_0x1a329a[_0x2b87('0xe0')],'paused':_0x1a329a[_0x2b87('0x12a')]}));}}}};function unlockQueueStatus(_0x1e50af,_0x3b488f){setTimeout(function(){if(_[_0x2b87('0x39')](_0x1e50af[_0x2b87('0x12b')])){loggerBooked[_0x2b87('0x97')](_0x2b87('0x12c'),_0x3b488f);}_0x1e50af[_0x2b87('0x12b')]=!![];loggerBooked[_0x2b87('0x7e')](_0x2b87('0x12d'),_0x3b488f,JSON['stringify'](_[_0x2b87('0xd9')](_0x1e50af,['name',_0x2b87('0x12b')])));},0x1f3);}Dialer[_0x2b87('0x19')]['syncQueueStatusComplete']=function(_0x49f266){var _0x5af457=this;var _0x44e611=_0x5af457[_0x2b87('0x1e')][_0x5af457['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]];if(strategy[this['voiceQueues'][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]]['queue']][_0x2b87('0x4b')]]===_0x2b87('0x126')){if(this[_0x2b87('0x23')][_0x49f266['actionid']]&&this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0x128')]){this[_0x2b87('0x1d')][_0x2b87('0x12e')](this[_0x2b87('0x23')][_0x49f266['actionid']][_0x2b87('0x12f')],this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0x128')])[_0x2b87('0xb7')](function(_0x524eb6){logger[_0x2b87('0x97')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x2b87('0x99')](_0x524eb6,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5af457[_0x2b87('0xb8')](_0x5af457[_0x2b87('0x1e')][_0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]);_0x5af457[_0x2b87('0x20')][_0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0x128')]][_0x2b87('0x127')]=![];delete _0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]];unlockQueueStatus(_0x44e611);});}else{this[_0x2b87('0xb8')](this[_0x2b87('0x1e')][this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xda')],'ListId':this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xdb')],'VoiceQueueId':this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xfb')]||undefined,'CampaignId':this[_0x2b87('0x23')][_0x49f266['actionid']]['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x130')));delete this[_0x2b87('0x23')][_0x49f266['actionid']];unlockQueueStatus(_0x44e611);}}else if((strategy[this[_0x2b87('0x1e')][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]][_0x2b87('0x4b')]]||_0x2b87('0x18'))===_0x2b87('0x18')){var _0x49b37b;if(this['actions'][_0x49f266[_0x2b87('0x125')]]&&!_[_0x2b87('0x43')](this['queueBooked'][this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]])){if(this[_0x2b87('0x131')][_0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]){this[_0x2b87('0x131')][_0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]=this[_0x2b87('0x131')][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]?this[_0x2b87('0x131')][this[_0x2b87('0x23')][_0x49f266['actionid']][_0x2b87('0xb9')]]:this[_0x2b87('0x27')][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]?this[_0x2b87('0x27')][this['actions'][_0x49f266['actionid']][_0x2b87('0xb9')]]['_rr']||0x0:0x0;}this[_0x2b87('0x27')][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]['_rr']=this['queueBookedRR'][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]];for(var _0x2ffe67=0x0;_0x2ffe67=0x0;})['catch'](myreject(_0x50a0cf)));}}else{_0xe5d72a[_0x2b87('0x129')](ami[_0x2b87('0x14b')]({'action':_0x2b87('0x151'),'command':util['format'](_0x2b87('0x14c'),_0x34b495,!_['isUndefined'](config['timezones'][_0x3b3db4])?_0x3b3db4:'')})[_0x2b87('0xbc')](function(_0x35b418){return _0x35b418[_0x2b87('0x14e')][_0x2b87('0x14f')](_0x2b87('0x150'))>=0x0;})[_0x2b87('0xb7')](myreject(_0x50a0cf)));}BPromise[_0x2b87('0x152')](_0xe5d72a)[_0x2b87('0xbc')](function(_0x564e8f){var _0x56201f=_[_0x2b87('0x153')](_0x564e8f);if(_0x56201f){return _0x90d5a9(_0x56201f);}else{_0x39977e[_0x2b87('0x3d')]=_0x33dc70?_0x2b87('0x154'):_0x2b87('0x155');return _0x50a0cf(msgResponse('[ifTime][promiseAll]',_0x2b87('0x145'),'Global:\x20'+_0x33dc70+'\x20'+_0xc17d80+_0x2b87('0x156')+util[_0x2b87('0x99')](_0x34b495,{'showHidden':![],'depth':null})+_0x2b87('0x157')+_0x3b3db4));}})['catch'](function(_0x4d84f6){return _0x50a0cf(msgResponse(_0x2b87('0x142'),_0x2b87('0x145'),JSON[_0x2b87('0x78')](_0x4d84f6)));});});};Dialer[_0x2b87('0x19')][_0x2b87('0x158')]=function(_0x572523){var _0x36da65=this;return function(){switch(_0x572523[_0x2b87('0x54')]){case'progressive':freeVariablesPredictive(_0x572523);_0x36da65[_0x2b87('0x159')](_0x572523,0x1);break;case _0x2b87('0x15a'):freeVariablesPredictive(_0x572523);_0x36da65[_0x2b87('0x159')](_0x572523,_0x572523['dialPowerLevel']);break;case _0x2b87('0x15b'):_0x36da65['predictive'](_0x572523);break;case _0x2b87('0x15c'):freeVariablesPredictive(_0x572523);_0x36da65['handlePower'](_0x572523,0x1);break;default:freeVariablesPredictive(_0x572523);logger[_0x2b87('0x97')](_0x2b87('0x15d'),_0x572523[_0x2b87('0x3b')],_0x2b87('0x15e'));}};};Dialer[_0x2b87('0x19')][_0x2b87('0x15f')]=function(_0x4f1148){var _0x1ba29f=this;return function(){_0x1ba29f['handleIvr'](_0x4f1148);};};Dialer[_0x2b87('0x19')][_0x2b87('0x9')]=function(_0x3c9ea1){var _0x242874=this;if(isNotPreview(_0x3c9ea1[_0x2b87('0x54')])){if(isVoiceQueueOutbound(_0x3c9ea1['type'])&&isActive(_0x3c9ea1[_0x2b87('0x53')])){_0x3c9ea1['sendMessageOneNotActive']=!![];BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](checkIsLoggedIn(_0x3c9ea1,_0x3c9ea1['loggedIn']))[_0x2b87('0xbc')](checkIsActive(_0x3c9ea1,_0x3c9ea1[_0x2b87('0x53')]))[_0x2b87('0xbc')](checkInterval(_0x3c9ea1))[_0x2b87('0xbc')](_0x242874[_0x2b87('0x13d')](_0x3c9ea1))['then'](_0x242874['checkIfTime'](_0x3c9ea1[_0x2b87('0x160')],_0x3c9ea1[_0x2b87('0x161')],_0x3c9ea1[_0x2b87('0x3b')],_0x3c9ea1))['then'](_0x242874['checkIfTimeIntervals'](_0x3c9ea1[_0x2b87('0x40')],_0x3c9ea1[_0x2b87('0x161')],_0x3c9ea1['name'],_0x3c9ea1))['then'](_0x242874['checkDialMethod'](_0x3c9ea1))[_0x2b87('0xb7')](loggerCatchQueueSummary(_0x2b87('0x162'),_0x3c9ea1));}else{notSendMessagesQueue(_0x3c9ea1);}}else{freeVariablesPredictive(_0x3c9ea1);}};Dialer[_0x2b87('0x19')][_0x2b87('0x13c')]=function(){var _0xd1295e=this;var _0x23a0f4;for(var _0x464165 in this[_0x2b87('0x1f')]){if(typeof this['campaigns'][_0x464165]!=='undefined'){_0x23a0f4=this[_0x2b87('0x1f')][_0x464165];if(isCampaignIvr(_0x23a0f4[_0x2b87('0x4a')])&&isActive(_0x23a0f4[_0x2b87('0x76')])){_0x23a0f4[_0x2b87('0xa2')]=!![];BPromise[_0x2b87('0xbf')]()['then'](checkIsActive(_0x23a0f4,_0x23a0f4[_0x2b87('0x76')]))['then'](checkInterval(_0x23a0f4))[_0x2b87('0xbc')](_0xd1295e[_0x2b87('0x13d')](_0x23a0f4))[_0x2b87('0xbc')](_0xd1295e[_0x2b87('0x141')](_0x23a0f4[_0x2b87('0x160')],_0x23a0f4[_0x2b87('0x161')],_0x23a0f4['name'],_0x23a0f4))['then'](_0xd1295e[_0x2b87('0x143')](_0x23a0f4[_0x2b87('0x40')],_0x23a0f4[_0x2b87('0x161')],_0x23a0f4[_0x2b87('0x3b')],_0x23a0f4))[_0x2b87('0xbc')](_0xd1295e[_0x2b87('0x15f')](_0x23a0f4))[_0x2b87('0xb7')](loggerCatchQueueSummary(_0x2b87('0x163'),_0x23a0f4));}else{notSendMessagesCampaign(_0x23a0f4);}}}};function getCallerIdRandom(_0x5808b6,_0x20f25f){var _0x113818;var _0x3ad6c4;var _0x1093fe;if(_0x20f25f<=0x0){_0x20f25f=0x1;}_0x113818=new RegExp(_0x2b87('0x164')+_0x20f25f+'}$');_0x3ad6c4=Math['pow'](0xa,_0x20f25f-0x1);_0x1093fe=Math['pow'](0xa,_0x20f25f)-0x1;return util[_0x2b87('0x79')]('%s',_[_0x2b87('0x165')](_0x5808b6,_0x113818,_[_0x2b87('0x166')](_0x3ad6c4,_0x1093fe)));}function extractCalleridName(_0x5b01e6){var _0x3ea9e4=_0x5b01e6['match'](/"(.*?)"/);return _0x3ea9e4?_0x3ea9e4[0x1]:_0x5b01e6;}function extractCalleridNumber(_0x4b8950){var _0xa7d1=_0x4b8950[_0x2b87('0x167')](/<(.*?)>/);return _0xa7d1?_0xa7d1[0x1]:_0x4b8950;}Dialer['prototype']['actionOriginate']=function(_0x3c78ac,_0x18f407){var _0x392496=this;var _0x55f3d7=uuid['v4']();this[_0x2b87('0x23')][_0x55f3d7]=new Action(_0x3c78ac,_0x18f407,_0x55f3d7);return new BPromise(function(_0x5abcb3,_0x52cba8){if(_[_0x2b87('0x39')](_0x3c78ac)&&typeof _0x3c78ac!==_0x2b87('0x168')){return _0x52cba8(msgResponse(_0x2b87('0x169'),_0x2b87('0x145'),_0x2b87('0x16a')));}if(_[_0x2b87('0x39')](_0x18f407['Contact'][_0x2b87('0x16b')])||_0x18f407[_0x2b87('0x16c')]['phone']===null){return _0x52cba8(msgResponse('originate',_0x2b87('0x145'),'contact\x20is\x20undefine'));}var _0x546817={'XMD-CALLERID':_0x392496[_0x2b87('0x23')][_0x55f3d7][_0x2b87('0x16d')](),'XMD-AGI':_0x3c78ac[_0x2b87('0x10a')]?util[_0x2b87('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c78ac[_0x2b87('0x10a')]):_0x2b87('0x16e'),'XMD-AGIAFTER':_0x3c78ac[_0x2b87('0x110')]?util[_0x2b87('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c78ac[_0x2b87('0x110')]):'NONE','XMD-QUEUE':_0x3c78ac['type']===_0x2b87('0x16f')?util[_0x2b87('0x79')]('\x22%s,%s%s,,,%s\x22',_0x3c78ac[_0x2b87('0x3b')],_0x3c78ac['dialQueueOptions']||'',_0x3c78ac['dialAgiAfterHangupAgent']?'c':'',_0x3c78ac[_0x2b87('0x117')]||0x3):'NONE','XMD-CONTACTID':_0x18f407[_0x2b87('0xda')],'XMD-CDRTYPE':_0x2b87('0x8'),'CALLERID(all)':_0x392496['actions'][_0x55f3d7][_0x2b87('0x16d')](),'XMD-AMD':_0x3c78ac[_0x2b87('0xfe')]?_0x2b87('0x170'):_0x2b87('0x16e'),'XMD-DESTINATION':_0x2b87('0x171')};if(_0x3c78ac[_0x2b87('0xfe')]){_0x546817[_0x2b87('0x172')]=_0x3c78ac['dialAMDInitialSilence']||0x9c4;_0x546817[_0x2b87('0x173')]=_0x3c78ac[_0x2b87('0x174')]||0x5dc;_0x546817['XMD-AMDAFTERGREETINGSILENCE']=_0x3c78ac['dialAMDAfterGreetingSilence']||0x320;_0x546817[_0x2b87('0x175')]=_0x3c78ac[_0x2b87('0x176')]||0x1388;_0x546817[_0x2b87('0x177')]=_0x3c78ac[_0x2b87('0x178')]||0x64;_0x546817['XMD-AMDBETWEENWORDSSILENCE']=_0x3c78ac[_0x2b87('0x179')]||0x32;_0x546817['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x3c78ac[_0x2b87('0x17a')]||0x3;_0x546817[_0x2b87('0x17b')]=_0x3c78ac['dialAMDSilenceThreshold']||0x100;_0x546817[_0x2b87('0x17c')]=_0x3c78ac[_0x2b87('0x17d')]||0x1388;}if(_0x3c78ac[_0x2b87('0x4a')]==='outbound'){_0x546817[_0x2b87('0x17e')]=_0x18f407['VoiceQueueId'];}else{_0x546817[_0x2b87('0x17f')]=_0x18f407[_0x2b87('0xfc')];}for(var _0x4a263e in _0x18f407[_0x2b87('0x16c')]){if(typeof _0x18f407[_0x2b87('0x16c')][_0x4a263e]!==_0x2b87('0xb3')){if(isNotNull(_0x18f407[_0x2b87('0x16c')][_0x4a263e])&&_0x4a263e!=='id'&&_0x4a263e!==_0x2b87('0x180')&&_0x4a263e!==_0x2b87('0x181')&&_0x4a263e!==_0x2b87('0x182')){_0x546817[util[_0x2b87('0x79')]('%s%s',_0x2b87('0x183'),_['toUpper'](_0x4a263e))]=_0x18f407[_0x2b87('0x16c')][_0x4a263e];}}}var _0x500029=_0x392496[_0x2b87('0xdf')](_0x3c78ac[_0x2b87('0x75')])?getCallerId(_0x3c78ac[_0x2b87('0x75')][_0x2b87('0x77')],_0x3c78ac[_0x2b87('0x55')],_0x3c78ac[_0x2b87('0x184')]>0x0?getCallerIdRandom(_0x3c78ac[_0x2b87('0x185')],_0x3c78ac[_0x2b87('0x184')]):_0x3c78ac[_0x2b87('0x185')]):getCallerId(_[_0x2b87('0xb5')](_0x3c78ac['TrunkBackup'])?_0x3c78ac['Trunk'][_0x2b87('0x77')]:_0x3c78ac['TrunkBackup'][_0x2b87('0x77')],_0x3c78ac[_0x2b87('0x55')],_0x3c78ac['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3c78ac[_0x2b87('0x185')],_0x3c78ac[_0x2b87('0x184')]):_0x3c78ac[_0x2b87('0x185')]);if(_0x500029){_0x546817['XMD-ORIGINATECALLERIDNAME']=_0x392496[_0x2b87('0x23')][_0x55f3d7][_0x2b87('0x186')]=extractCalleridName(_0x500029);_0x546817[_0x2b87('0x187')]=_0x392496[_0x2b87('0x23')][_0x55f3d7][_0x2b87('0x188')]=extractCalleridNumber(_0x500029);}return ami[_0x2b87('0x14b')]({'actionid':_0x55f3d7,'action':_0x2b87('0x169'),'channel':_0x392496[_0x2b87('0xdf')](_0x3c78ac['Trunk'])?util[_0x2b87('0x79')]('SIP/%s/%s%s',_0x3c78ac[_0x2b87('0x75')][_0x2b87('0x3b')],isNotNull(_0x3c78ac['dialPrefix'])?_0x3c78ac[_0x2b87('0x57')][_0x2b87('0x189')]()||'':'',_0x3c78ac[_0x2b87('0x18a')]>0x0?_0x18f407[_0x2b87('0x16c')][_0x2b87('0x16b')][_0x2b87('0x18b')](_0x3c78ac['dialCutDigit']):_0x18f407['Contact'][_0x2b87('0x16b')]):util[_0x2b87('0x79')](_0x2b87('0x18c'),_[_0x2b87('0xb5')](_0x3c78ac['TrunkBackup'])?_0x3c78ac[_0x2b87('0x75')][_0x2b87('0x3b')]:_0x3c78ac[_0x2b87('0x13e')]['name'],isNotNull(_0x3c78ac[_0x2b87('0x57')])?_0x3c78ac[_0x2b87('0x57')]['trim']()||'':'',_0x3c78ac[_0x2b87('0x18a')]>0x0?_0x18f407[_0x2b87('0x16c')][_0x2b87('0x16b')][_0x2b87('0x18b')](_0x3c78ac[_0x2b87('0x18a')]):_0x18f407[_0x2b87('0x16c')][_0x2b87('0x16b')]),'callerid':_0x500029,'Exten':'xcally-motion-dialer','Context':_0x2b87('0x18d'),'Priority':'1','variable':_0x546817,'timeout':(_0x3c78ac['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x55f3d7})['then'](function(_0x1f17d4){return _0x5abcb3(_0x1f17d4);})[_0x2b87('0xb7')](function(_0x1ebf5b){_0x3c78ac['outboundOriginateFailureCallsDay']+=0x1;var _0x1698c5=new History(_0x392496[_0x2b87('0x23')][_0x55f3d7]);logger[_0x2b87('0x97')](util[_0x2b87('0x79')](_0x2b87('0x18e'),JSON[_0x2b87('0x78')](_0x1ebf5b)));_0x1698c5['state']=0xe;_0x1698c5[_0x2b87('0xab')]=_0x2b87('0x18f');_0x1698c5[_0x2b87('0xad')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1698c5['endtime']=_0x1698c5[_0x2b87('0xad')];_0x392496['createHistory'](_0x1698c5)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x190')));_0x392496['moveContactManagedDialer'](_0x1698c5)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x190')))['finally'](function(){delete _0x392496['actions'][_0x55f3d7];return _0x52cba8(msgResponse(_0x2b87('0x169'),'Error',_0x2b87('0x191')));});});});};Dialer[_0x2b87('0x19')][_0x2b87('0x2c')]=function(_0x2c925a){var _0x53ce35=this['actions'][_0x2c925a[_0x2b87('0x125')]];if(_0x53ce35){delete this[_0x2b87('0x23')][_0x2c925a[_0x2b87('0x125')]];_0x53ce35[_0x2b87('0x116')]=moment()['format'](_0x2b87('0xfa'));var _0x1c6dfb=_0x53ce35[_0x2b87('0x4a')]===_0x2b87('0x94')?this[_0x2b87('0x1f')][_0x53ce35['queue']]:this['voiceQueues'][_0x53ce35[_0x2b87('0x192')]()];if(!this[_0x2b87('0xde')](_0x2c925a['response'])){this['updateOriginated'](_0x1c6dfb);return this[_0x2b87('0x193')](_0x53ce35,_0x1c6dfb,_0x2c925a)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x194')));}this[_0x2b87('0xaf')][_0x2c925a['uniqueid']]=_0x53ce35;}};Dialer[_0x2b87('0x19')][_0x2b87('0x195')]=function(_0x27c6cf,_0x58a29a,_0x27c562){var _0x20defb=new History(_0x58a29a);if(_0x20defb[_0x2b87('0xf0')]+_0x20defb['countcongestionretry']+_0x20defb[_0x2b87('0xf2')]+_0x20defb[_0x2b87('0xf3')]+_0x20defb['countdropretry']+_0x20defb[_0x2b87('0x103')]+_0x20defb[_0x2b87('0xee')]+_0x20defb[_0x2b87('0xf5')]>=_0x27c562[_0x2b87('0xf6')]-0x1){return!![];}switch(_0x27c6cf){case 0x3:if(_0x20defb[_0x2b87('0xf2')]>=_0x27c562[_0x2b87('0x196')]-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countnoanswerretry':_0x20defb[_0x2b87('0xf2')]+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562['dialNoAnswerRetryFrequency'],_0x2b87('0xf9'))[_0x2b87('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20defb['ContactId'],'ListId':_0x20defb['ListId'],'VoiceQueueId':_0x20defb['VoiceQueueId']||undefined,'CampaignId':_0x20defb['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x20defb['countbusyretry']>=_0x27c562[_0x2b87('0x197')]-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countbusyretry':_0x20defb['countbusyretry']+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562[_0x2b87('0x198')],'minutes')[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb['ContactId'],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x199')));break;case 0x8:if(_0x20defb[_0x2b87('0xf1')]>=_0x27c562['dialCongestionMaxRetry']-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countcongestionretry':_0x20defb[_0x2b87('0xf1')]+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562[_0x2b87('0x19a')],'minutes')[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})['catch'](loggerCatch(_0x2b87('0x19b')));break;case 0x0:if(_0x20defb[_0x2b87('0xf3')]>=_0x27c562[_0x2b87('0x19c')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x20defb['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562['dialNoSuchNumberRetryFrequency'],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})['catch'](loggerCatch(_0x2b87('0x19d')));}break;case 0xa:if(_0x20defb[_0x2b87('0xf4')]>=_0x27c562[_0x2b87('0x119')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x20defb[_0x2b87('0xf4')]+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562['dialDropRetryFrequency'],'minutes')[_0x2b87('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb['ListId'],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x20defb[_0x2b87('0x103')]>=_0x27c562['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x20defb[_0x2b87('0x103')]+=0x1,'scheduledat':moment()['add'](_0x27c562[_0x2b87('0x19e')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb['ContactId'],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x121')));break;case 0x13:if(_0x20defb[_0x2b87('0xee')]>=_0x27c562['dialMachineMaxRetry']-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countmachineretry':_0x20defb[_0x2b87('0xee')]+=0x1,'scheduledat':moment()['add'](_0x27c562[_0x2b87('0xf8')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})['catch'](loggerCatch(_0x2b87('0xfd')));break;case 0x14:if(_0x20defb[_0x2b87('0xf5')]>=_0x27c562[_0x2b87('0x19f')]-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countagentrejectretry':_0x20defb['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562[_0x2b87('0x1a0')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1a1')));break;default:return!![];}};Dialer[_0x2b87('0x19')][_0x2b87('0x193')]=function(_0x1a777d,_0x5cb604,_0x459014){var _0x9acdaa=this;var _0x57b758=new History(_0x1a777d);return new BPromise(function(_0x18f732,_0x36922c){if(_[_0x2b87('0x39')](_0x5cb604)&&typeof _0x5cb604!=='object'){return _0x36922c(msgResponse(_0x2b87('0x1a2'),'Failure',_0x2b87('0x1a3')));}if(_['isUndefined'](_0x459014)&&typeof _0x459014!==_0x2b87('0x168')){return _0x36922c(msgResponse(_0x2b87('0x1a2'),_0x2b87('0x145'),'evt\x20is\x20undefine'));}switch(_0x459014[_0x2b87('0x10d')]){case'0':_0x5cb604[_0x2b87('0x61')]+=0x1;_0x57b758[_0x2b87('0xaa')]=0x0;_0x57b758[_0x2b87('0xab')]=_0x2b87('0x1a4');_0x57b758[_0x2b87('0xf3')]+=0x1;_0x57b758[_0x2b87('0xef')]+=0x1;ami[_0x2b87('0x1a5')](_0x2b87('0x1a6'),ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1a8')));_0x9acdaa['createHistory'](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1a9')));if(_0x9acdaa['checkRetriveMax'](0x0,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf3')]>=_0x5cb604[_0x2b87('0x19c')]){_0x9acdaa[_0x2b87('0x105')](_0x57b758,_0x18f732,_0x36922c,'reason\x200\x20no\x20such\x20number....');}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1aa'));}}break;case'3':_0x5cb604[_0x2b87('0x60')]+=0x1;_0x57b758['state']=0x3;_0x57b758[_0x2b87('0xab')]=_0x2b87('0x1ab');_0x57b758['countnoanswerretry']+=0x1;_0x57b758[_0x2b87('0xef')]+=0x1;ami[_0x2b87('0x1a5')](_0x2b87('0x1ac'),ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1ad')));_0x9acdaa[_0x2b87('0xd0')](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1ae')));if(_0x9acdaa[_0x2b87('0x195')](0x3,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf2')]>=_0x5cb604['dialNoAnswerMaxRetry']){_0x9acdaa[_0x2b87('0x105')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1af'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1af'));}}break;case'5':_0x5cb604['outboundBusyCallsDay']+=0x1;_0x57b758['state']=0x5;_0x57b758['statedesc']=_0x2b87('0x1b0');_0x57b758['countbusyretry']+=0x1;_0x57b758[_0x2b87('0xef')]+=0x1;ami[_0x2b87('0x1a5')]('custom:agentbusy',ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1b1')));_0x9acdaa[_0x2b87('0xd0')](_0x57b758)['catch'](loggerCatch(_0x2b87('0x1b2')));if(_0x9acdaa[_0x2b87('0x195')](0x5,_0x1a777d,_0x5cb604)){if(_0x57b758['countbusyretry']>=_0x5cb604[_0x2b87('0x197')]){_0x9acdaa[_0x2b87('0x105')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1b3'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1b3'));}}break;case'8':_0x5cb604['outboundCongestionCallsDay']+=0x1;_0x57b758[_0x2b87('0xaa')]=0x8;_0x57b758[_0x2b87('0xab')]=_0x2b87('0x1b4');_0x57b758['countcongestionretry']+=0x1;_0x57b758[_0x2b87('0xef')]+=0x1;ami[_0x2b87('0x1a5')](_0x2b87('0x1b5'),ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1b6')));_0x9acdaa[_0x2b87('0xd0')](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1b7')));if(_0x9acdaa['checkRetriveMax'](0x8,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf1')]>=_0x5cb604['dialCongestionMaxRetry']){_0x9acdaa['createStateFinal'](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1b8'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1b8'));}}break;case'11':_0x5cb604[_0x2b87('0x1b9')]+=0x1;_0x57b758[_0x2b87('0xaa')]=0xb;_0x57b758[_0x2b87('0xab')]=_0x2b87('0x122');_0x57b758[_0x2b87('0x103')]+=0x1;_0x57b758['countglobal']+=0x1;_0x9acdaa[_0x2b87('0xd0')](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1ba')));if(_0x9acdaa['checkRetriveMax'](0xb,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0x103')]>=_0x5cb604[_0x2b87('0x11f')]){_0x9acdaa['createStateFinal'](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1bb'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,'reason\x2011\x20abandoned');}}break;case'20':_0x5cb604[_0x2b87('0x64')]+=0x1;_0x57b758[_0x2b87('0xaa')]=0x14;_0x57b758['statedesc']=_0x2b87('0x1bc');_0x57b758[_0x2b87('0xf5')]+=0x1;_0x57b758['countglobal']+=0x1;ami['emit'](_0x2b87('0x1bd'),ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1be')));_0x9acdaa[_0x2b87('0xd0')](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1bf')));if(_0x9acdaa['checkRetriveMax'](0x14,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf5')]>=_0x5cb604[_0x2b87('0x19f')]){_0x9acdaa[_0x2b87('0x105')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1c0'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1c0'));}}break;default:_0x5cb604[_0x2b87('0x65')]+=0x1;_0x57b758['state']=0xc;_0x57b758[_0x2b87('0xab')]=_0x459014[_0x2b87('0x10d')];_0x9acdaa['createHistory'](_0x57b758)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x9acdaa[_0x2b87('0x195')](_0x459014[_0x2b87('0x10d')],_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf0')]+_0x57b758[_0x2b87('0xf1')]+_0x57b758[_0x2b87('0xf2')]+_0x57b758['countnosuchnumberretry']+_0x57b758['countdropretry']+_0x57b758['countabandonedretry']+_0x57b758[_0x2b87('0xee')]+_0x57b758['countagentrejectretry']>=_0x5cb604[_0x2b87('0xf6')]){_0x9acdaa['stateGlobal'](_0x57b758,_0x18f732,_0x36922c,_0x459014[_0x2b87('0x10d')]);}else{_0x9acdaa['createStateFinal'](_0x57b758,_0x18f732,_0x36922c,_0x459014[_0x2b87('0x10d')]);}}}});};Dialer['prototype'][_0x2b87('0x104')]=function(_0x115e21,_0x4835ba,_0x15c072,_0x124db3){var _0x4b02da=new Final(_0x115e21);_0x4b02da[_0x2b87('0xaa')]=0xf;_0x4b02da[_0x2b87('0xab')]='Global';this['createStateFinal'](_0x4b02da,_0x4835ba,_0x15c072,_0x124db3);};Dialer[_0x2b87('0x19')]['createStateFinal']=function(_0x20704d,_0x3053c5,_0x1c4572,_0x43d31e){this[_0x2b87('0xce')](_0x20704d)['then'](function(){return _0x3053c5(msgResponse(_0x2b87('0x1a2'),_0x2b87('0x1c1'),_0x43d31e));})[_0x2b87('0xb7')](function(){return _0x1c4572(msgResponse(_0x2b87('0x1c2'),_0x2b87('0x145'),_0x2b87('0x1c3')));});};Dialer[_0x2b87('0x19')][_0x2b87('0x15b')]=function(_0x196e03){var _0x2d07b0=_0x196e03[_0x2b87('0x1c4')]/0x64;var _0x5c7eb0=_0x196e03[_0x2b87('0x5f')]/(_0x196e03[_0x2b87('0x5f')]+_0x196e03[_0x2b87('0x59')]);var _0x254930=Math[_0x2b87('0x1c5')](_0x196e03[_0x2b87('0x70')]*(_0x196e03[_0x2b87('0x1c6')]/0x64));var _0x53a68f=Math[_0x2b87('0x1c5')](_0x196e03[_0x2b87('0x70')]*(_0x196e03['predictiveIntervalMinThreshold']/0x64));var _0x192b1d=_0x196e03[_0x2b87('0xa4')]+_0x196e03[_0x2b87('0x4e')];var _0x427abe=Math['floor'](_0x196e03[_0x2b87('0x72')]*_0x196e03[_0x2b87('0x8d')]*_0x196e03['predictiveIntervalHitRate']*_0x196e03[_0x2b87('0x6e')]);if(_[_0x2b87('0x39')](_0x196e03['startProgressive'])){if(!_['isUndefined'](_0x196e03[_0x2b87('0x74')])){_0x196e03['startPredictive']=undefined;loggerPredictive[_0x2b87('0x97')](_0x2b87('0x1c7'),_0x2b87('0x1c8'));}if(!_[_0x2b87('0x39')](_0x196e03[_0x2b87('0x93')])){loggerPredictive[_0x2b87('0x97')](_0x2b87('0x1c7'),_0x2b87('0x1c9'));clearInterval(_0x196e03[_0x2b87('0x93')]);_0x196e03['handlePredictive']=undefined;}_0x196e03[_0x2b87('0x1ca')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));loggerPredictive[_0x2b87('0x7e')](_0x196e03[_0x2b87('0x3b')],'collection\x20data\x20in\x20progressive\x20at',_0x196e03[_0x2b87('0x1ca')]);this[_0x2b87('0x159')](_0x196e03,0x1);}else if(ifInterval(_0x196e03[_0x2b87('0x1cb')],_0x196e03[_0x2b87('0x1ca')])){this[_0x2b87('0x159')](_0x196e03,0x1);loggerPredictiveCalls['info'](_0x2b87('0x1cc'),_0x196e03['startProgressive'],_0x196e03[_0x2b87('0x3b')]);_0x196e03['erlangCalls']=0x0;_0x196e03[_0x2b87('0x6c')]=0x0;}else if(_0x2d07b0<_0x5c7eb0&&_0x196e03[_0x2b87('0x1cd')]===_0x2b87('0x1ce')){freeVariablesPredictive(_0x196e03);loggerPredictive[_0x2b87('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x5c7eb0,_0x2b87('0x1ca'),_0x196e03['name']);}else if(_0x427abe<_0x196e03[_0x2b87('0x6c')]&&_0x196e03[_0x2b87('0x1cd')]===_0x2b87('0x1ce')){freeVariablesPredictive(_0x196e03);loggerPredictive[_0x2b87('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x2b87('0x1cf'),_0x427abe,_0x2b87('0x1d0'),_0x196e03['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x196e03[_0x2b87('0x3b')]);}else if(!ifInterval(_0x196e03[_0x2b87('0x1cb')],_0x196e03['startProgressive'])&&_[_0x2b87('0x39')](_0x196e03[_0x2b87('0x74')])&&!_['isUndefined'](_0x196e03[_0x2b87('0x1ca')])){_0x196e03[_0x2b87('0x74')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));loggerPredictive['info'](_0x196e03[_0x2b87('0x3b')],_0x2b87('0x1d1'),_0x196e03[_0x2b87('0x74')]);this[_0x2b87('0xc2')](_0x196e03[_0x2b87('0x1cb')])['then'](this[_0x2b87('0x1d2')](_0x196e03))[_0x2b87('0xbc')](mergeDataErlangB(_0x196e03))[_0x2b87('0xbc')](this[_0x2b87('0x1d3')](_0x196e03))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x196e03));}else if(!ifInterval(_0x196e03['dialPredictiveInterval'],_0x196e03['startPredictive'])){_0x196e03[_0x2b87('0x6c')]=0x0;_0x196e03[_0x2b87('0x74')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));loggerPredictive[_0x2b87('0x7e')](_0x196e03[_0x2b87('0x3b')],_0x2b87('0x1d4'),_0x196e03['startPredictive']);clearInterval(_0x196e03[_0x2b87('0x93')]);_0x196e03[_0x2b87('0x93')]=undefined;this[_0x2b87('0xc2')](_0x196e03[_0x2b87('0x1cb')])['then'](this['getDataPredictive'](_0x196e03))[_0x2b87('0xbc')](mergeDataErlangB(_0x196e03))['then'](this[_0x2b87('0x1d3')](_0x196e03))[_0x2b87('0xb7')](loggerCatchPredictive(_0x2b87('0x1d5'),_0x196e03));}else if(_0x196e03['predictiveIntervalAvailable']&&_0x192b1d<_0x196e03[_0x2b87('0x70')]-_0x53a68f){freeVariablesPredictive(_0x196e03);loggerPredictive['info'](_0x196e03['name'],_0x2b87('0x1d6'),_0x192b1d,')\x20are\x20less\x20than\x20threshold\x20(',_0x196e03[_0x2b87('0x70')],'-',_0x53a68f,'=',_0x196e03[_0x2b87('0x70')]-_0x53a68f,')');}else if(_0x196e03['predictiveIntervalAvailable']&&_0x192b1d>_0x196e03[_0x2b87('0x70')]+_0x254930){freeVariablesPredictive(_0x196e03);loggerPredictive['info'](_0x196e03[_0x2b87('0x3b')],_0x2b87('0x1d6'),_0x192b1d,_0x2b87('0x1d7'),_0x196e03['predictiveIntervalAvailable'],'+',_0x254930,'=',_0x196e03[_0x2b87('0x70')]+_0x254930,')');}};Dialer['prototype'][_0x2b87('0x1d2')]=function(_0x1dcb17){var _0x1b17fb=this;return function(_0x56c616){return new BPromise(function(_0x206c6d,_0x1ec5d5){_[_0x2b87('0xd8')](_0x1dcb17,_0x56c616[0x0]);if(checkGetDataPredictive(_0x56c616[0x0])){var _0x1d6760=_0x1dcb17[_0x2b87('0x70')]=_0x1dcb17[_0x2b87('0x4e')]+_0x1dcb17['available'];var _0x11daf5=_0x1dcb17[_0x2b87('0x1cb')]*0x3c;var _0x4627a7=_0x56c616[0x0][_0x2b87('0x68')]+_0x56c616[0x0][_0x2b87('0x67')];var _0x385c00=(_0x56c616[0x0][_0x2b87('0x66')]+_0x56c616[0x0][_0x2b87('0x6a')]+_0x56c616[0x0][_0x2b87('0x69')])/_0x56c616[0x0][_0x2b87('0x71')];_0x1dcb17[_0x2b87('0x6d')]=_0x385c00>0x0?_0x385c00:0x1;switch(_0x1dcb17[_0x2b87('0x1cd')]){case _0x2b87('0x1ce'):var _0x27c85c=_0x1dcb17[_0x2b87('0x1c4')]/0x64;return _0x1b17fb[_0x2b87('0x1d8')](_0x1d6760,_0x11daf5,_0x4627a7,_0x385c00,_0x27c85c)[_0x2b87('0xbc')](function(_0x297d39){return _0x206c6d(_0x297d39);});case'agentBusyFactor':var _0x18db8d=_0x1dcb17[_0x2b87('0x1c4')]/0x64;return _0x1b17fb['busyFactor'](_0x1d6760,_0x11daf5,_0x4627a7,_0x385c00,_0x18db8d)[_0x2b87('0xbc')](function(_0x44318d){return _0x206c6d(_0x44318d);});default:return _0x1ec5d5(msgResponse('[getDataPredictive]',_0x2b87('0x145'),_0x2b87('0x1d9')));}}else{return _0x1ec5d5(msgResponse(_0x2b87('0x1da'),_0x2b87('0x145'),_0x2b87('0x1db')));}});};};Dialer[_0x2b87('0x19')][_0x2b87('0x1dc')]=function(_0x1e4e7a){var _0x384b33=this;return function(_0x3c75f8){return new BPromise(function(_0x2317d2,_0x51a944){_[_0x2b87('0xd8')](_0x1e4e7a,_0x3c75f8[0x0]);if(checkGetDataPredictive(_0x3c75f8[0x0])){loggerPredictive[_0x2b87('0x7e')](JSON[_0x2b87('0x78')](_0x3c75f8[0x0]));if(_0x1e4e7a[_0x2b87('0x1cd')]===_0x2b87('0x1ce')){return _0x384b33[_0x2b87('0xcc')](_0x1e4e7a['id'])[_0x2b87('0xbc')](function(_0x9e247){var _0x366225=_0x1e4e7a[_0x2b87('0x1dd')]-_0x9e247[0x0]['outboundQueuePauses'];var _0x290d35=_0x1e4e7a[_0x2b87('0x1cb')]*0x3c;var _0x304600=_0x3c75f8[0x0][_0x2b87('0x68')]+_0x3c75f8[0x0][_0x2b87('0x67')];var _0x153cb8=(_0x3c75f8[0x0][_0x2b87('0x66')]+_0x3c75f8[0x0][_0x2b87('0x6a')]+_0x3c75f8[0x0][_0x2b87('0x69')])/_0x3c75f8[0x0]['predictiveIntervalTotalCalls'];var _0x546c3e=_0x1e4e7a['dialPredictiveOptimizationPercentage']/0x64;_0x1e4e7a[_0x2b87('0x6f')]=_0x9e247[0x0][_0x2b87('0x1de')]||0x0;_0x1e4e7a[_0x2b87('0x6d')]=_0x153cb8>0x0?_0x153cb8:0x1;return _0x384b33[_0x2b87('0x1d8')](_0x366225,_0x290d35,_0x304600,_0x153cb8,_0x546c3e);})['then'](function(_0x77e35d){return _0x2317d2(_0x77e35d);})[_0x2b87('0xb7')](function(_0x3fe90e){return _0x51a944(msgResponse(_0x2b87('0x1df'),'Failure',JSON[_0x2b87('0x78')](_0x3fe90e)));});}if(_0x1e4e7a[_0x2b87('0x1cd')]===_0x2b87('0x1e0')){return _0x384b33[_0x2b87('0xcc')](_0x1e4e7a['id'])['then'](function(_0x102b79){var _0x3c6ada=_0x1e4e7a[_0x2b87('0x1dd')]-_0x102b79[0x0][_0x2b87('0x1de')];var _0x2a3a0f=_0x1e4e7a[_0x2b87('0x1cb')]*0x3c;var _0x4c2ee=_0x3c75f8[0x0][_0x2b87('0x68')]+_0x3c75f8[0x0][_0x2b87('0x67')];var _0x37950f=(_0x3c75f8[0x0][_0x2b87('0x66')]+_0x3c75f8[0x0][_0x2b87('0x6a')]+_0x3c75f8[0x0][_0x2b87('0x69')])/_0x3c75f8[0x0][_0x2b87('0x71')];var _0x50a9ce=_0x1e4e7a['dialPredictiveOptimizationPercentage']/0x64;_0x1e4e7a['predictiveIntervalPauses']=_0x102b79[0x0][_0x2b87('0x1de')]||0x0;_0x1e4e7a[_0x2b87('0x6d')]=_0x37950f>0x0?_0x37950f:0x1;return _0x384b33[_0x2b87('0x1e1')](_0x3c6ada,_0x2a3a0f,_0x4c2ee,_0x37950f,_0x50a9ce);})[_0x2b87('0xbc')](function(_0x48122d){return _0x2317d2(_0x48122d);})[_0x2b87('0xb7')](function(_0x5a54ff){return _0x51a944(msgResponse(_0x2b87('0x1df'),_0x2b87('0x145'),JSON[_0x2b87('0x78')](_0x5a54ff)));});}}else{return _0x51a944(msgResponse(_0x2b87('0x1da'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0x2b87('0x1d3')]=function(_0x3ecdf8){var _0x292a42=this;return function(){var _0x47a350=0x0;var _0x5d08f8=Math[_0x2b87('0x1e2')](_0x3ecdf8[_0x2b87('0x73')]*0x3e8);if(_0x5d08f8>0x0){_0x5d08f8=_0x5d08f8<0x64?0x64:_0x5d08f8;loggerPredictive[_0x2b87('0x7e')](_0x3ecdf8['name'],'one\x20call\x20every:',_0x5d08f8,_0x2b87('0x47'));_0x3ecdf8[_0x2b87('0x93')]=setInterval(function(){_0x292a42[_0x2b87('0x93')](_0x3ecdf8);loggerPredictiveCalls[_0x2b87('0x7e')](_0x2b87('0x1e3'),_0x47a350+=0x1);},_0x5d08f8);}else{loggerPredictive[_0x2b87('0x7e')](_0x3ecdf8[_0x2b87('0x3b')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x2b87('0x19')][_0x2b87('0x1e4')]=function(_0x2443ce,_0x1f1692){var _0x404fc6=this;return function(_0x3597ea){if(_[_0x2b87('0x43')](_0x3597ea)){if(_[_0x2b87('0xb5')](_0x1f1692['UserId'])||!_0x1f1692['recallme']){if(_0x2443ce[_0x2b87('0x54')]===_0x2b87('0x15c')){_0x2443ce['queueStatusComplete']=_['isUndefined'](_0x2443ce['queueStatusComplete'])?!![]:_0x2443ce['queueStatusComplete'];var _0x198c30=uuid['v4']();_0x404fc6[_0x2b87('0x23')][_0x198c30]=new Action(_0x2443ce,_0x1f1692,_0x198c30);loggerBooked[_0x2b87('0x7e')](_0x2b87('0x1e5'),_0x198c30,'queueStatusComplete:\x20',JSON[_0x2b87('0x78')](_0x2443ce['queueStatusComplete']),_0x2b87('0x1e6'),_0x2443ce['name']);if(_0x2443ce[_0x2b87('0x12b')]){_0x2443ce[_0x2b87('0x12b')]=![];_0x404fc6[_0x2b87('0x27')][_0x404fc6[_0x2b87('0x23')][_0x198c30]['queue']]=[];ami['Action']({'actionid':_0x198c30,'action':_0x2b87('0x1e7'),'queue':_0x2443ce[_0x2b87('0x3b')]})[_0x2b87('0xb7')](function(){_0x404fc6['updateOriginated'](_0x2443ce);_0x404fc6[_0x2b87('0xc5')]({'active':![],'ContactId':_0x404fc6[_0x2b87('0x23')][_0x198c30]['ContactId'],'ListId':_0x404fc6[_0x2b87('0x23')][_0x198c30]['ListId'],'VoiceQueueId':_0x404fc6[_0x2b87('0x23')][_0x198c30][_0x2b87('0xfb')]||undefined,'CampaignId':_0x404fc6['actions'][_0x198c30]['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1e8')));delete _0x404fc6[_0x2b87('0x23')][_0x198c30];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x2b87('0x78')](_0x2443ce['queueStatusComplete']),_0x2b87('0x1e6'),_0x2443ce[_0x2b87('0x3b')]);_0x404fc6[_0x2b87('0xb8')](_0x2443ce);_0x404fc6[_0x2b87('0xc5')]({'active':![],'ContactId':_0x404fc6[_0x2b87('0x23')][_0x198c30][_0x2b87('0xda')],'ListId':_0x404fc6['actions'][_0x198c30]['ListId'],'VoiceQueueId':_0x404fc6[_0x2b87('0x23')][_0x198c30][_0x2b87('0xfb')]||undefined,'CampaignId':_0x404fc6['actions'][_0x198c30]['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1e8')));delete _0x404fc6[_0x2b87('0x23')][_0x198c30];}}else{return _0x404fc6[_0x2b87('0x1e9')](_0x2443ce,_0x1f1692);}}else{if(getDiff(_0x1f1692[_0x2b87('0x1ea')])<_0x2443ce[_0x2b87('0x1eb')]*0x3c){if(_0x1f1692[_0x2b87('0x1ec')]&&!_0x1f1692['Agent'][_0x2b87('0x1ed')]){_0x404fc6[_0x2b87('0x1d')][_0x2b87('0x12e')](_0x1f1692['id'])[_0x2b87('0x1b')](function(){_0x404fc6['updateOriginated'](_0x2443ce);});}else{_0x404fc6[_0x2b87('0xc7')]({'active':![]},_0x1f1692['id'],0x1)[_0x2b87('0x1b')](function(){_0x404fc6[_0x2b87('0xb8')](_0x2443ce);});}}else{_0x2443ce['outboundReCallsDay']+=0x1;_0x404fc6['updateOriginated'](_0x2443ce);if(_0x2443ce[_0x2b87('0x1ee')]){_0x404fc6[_0x2b87('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1f1692['ContactId'],'ListId':_0x1f1692[_0x2b87('0xdb')],'VoiceQueueId':_0x1f1692[_0x2b87('0xfb')]||undefined,'CampaignId':_0x1f1692[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x404fc6['createHistory'](createObjHistory(_0x2443ce,_0x1f1692,_0x2b87('0x1ef'),0x17,_0x2b87('0x1f0')))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1f1')));}else{_0x404fc6[_0x2b87('0xd7')](createObjHistory(_0x2443ce,_0x1f1692,_0x2b87('0x1f2'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x2b87('0x1f3'));}}}}else{_0x2443ce['outboundBlacklistCallsDay']+=0x1;_0x404fc6[_0x2b87('0xd7')](createObjHistory(_0x2443ce,_0x1f1692,'BLACKLIST',0xd,_0x2b87('0x1f4')),_0x2b87('0x1f5'),_0x2b87('0x1f6'));throw _0x2b87('0x1f7');}};};Dialer[_0x2b87('0x19')]['handleIvr']=function(_0xa1b0aa){var _0x24d844=this;var _0x3d3b3d=_0xa1b0aa['limitCalls']-_0xa1b0aa['originated']-_0xa1b0aa[_0x2b87('0x1f8')];emitCampaignSummary(_0xa1b0aa);if(_0x3d3b3d>0x0){if(_0x3d3b3d>this['maxNumberOriginate']){_0x3d3b3d=this[_0x2b87('0x22')];}_0xa1b0aa[_0x2b87('0x1f8')]+=_0x3d3b3d;this[_0x2b87('0xcb')](_0xa1b0aa['id'],_0x3d3b3d,_0xa1b0aa[_0x2b87('0x1f9')])[_0x2b87('0xbc')](function(_0x345284){_0xa1b0aa[_0x2b87('0x1f8')]-=_0x3d3b3d;_0xa1b0aa['temp']=_0xa1b0aa['temp']>0x0?_0xa1b0aa[_0x2b87('0x1f8')]:0x0;if(!checkContactEmpty(_0x345284)){_0xa1b0aa[_0x2b87('0x3d')]=_0x2b87('0xa0');logger[_0x2b87('0x7e')]('[getContactCampaign2][Empty]'+_0xa1b0aa[_0x2b87('0x3b')]);}else{_0xa1b0aa[_0x2b87('0x9a')]+=_0x345284['length'];_0xa1b0aa[_0x2b87('0x3d')]=_0x2b87('0x1fa');for(var _0x4a2333=0x0;_0x4a2333<_0x345284[_0x2b87('0x14a')];_0x4a2333+=0x1){_0xa1b0aa['ivrTotalCallsDays']+=0x1;if(_[_0x2b87('0xb5')](_0x345284[_0x4a2333])||_[_0x2b87('0xb5')](_0x345284[_0x4a2333][_0x2b87('0x16c')])||_['isNil'](_0x345284[_0x4a2333][_0x2b87('0x16c')][_0x2b87('0x16b')])){_0x24d844[_0x2b87('0xd5')](_0x2b87('0x1fb'),_0xa1b0aa,_0x345284[_0x4a2333]);}else{_0x24d844[_0x2b87('0xc0')](_[_0x2b87('0xd9')](_0x345284[_0x4a2333],[_0x2b87('0xfc'),_0x2b87('0x1fc')]))[_0x2b87('0xbc')](_0x24d844['checkContactBlack'](_0xa1b0aa,_0x345284[_0x4a2333]))['catch'](_0x24d844['loggerHandler']('[actionOriginateIvr]\x20',_0xa1b0aa));}}}})[_0x2b87('0xb7')](loggerGetContactDialer(_0x2b87('0x1fd'),_0xa1b0aa,_0x3d3b3d));}};Dialer['prototype'][_0x2b87('0x159')]=function(_0x523a21,_0x791f97){var _0x5c4d7d=this;var _0x48129a=[];var _0x182ae2=_0x791f97>=0x1?_0x791f97:0x1;if(_0x523a21[_0x2b87('0x54')]==='booked'){_0x182ae2=0x1;}var _0x263e5d=Math[_0x2b87('0x1e2')](_0x523a21['available']*_0x182ae2)-_0x523a21[_0x2b87('0x9a')]-_0x523a21['temp'];emitVoiceQueueSummary(_0x523a21);if(_0x523a21[_0x2b87('0x1fe')]>0x0){var _0x188031=_0x523a21[_0x2b87('0x1fe')]-_0x523a21[_0x2b87('0x9a')]-_0x523a21[_0x2b87('0x4e')]-_0x523a21[_0x2b87('0x1f8')]-_0x523a21['pTalking'];if(_0x263e5d>_0x188031){_0x263e5d=_0x188031;}}if(_0x263e5d>0x0){if(_0x523a21[_0x2b87('0x54')]===_0x2b87('0x15c')){_0x263e5d=0x1;}if(_0x263e5d>this['maxNumberOriginate']){_0x263e5d=this[_0x2b87('0x22')];}_0x523a21[_0x2b87('0x1f8')]+=_0x263e5d;for(var _0x5ddd63 in this[_0x2b87('0x20')]){if(typeof this[_0x2b87('0x20')][_0x5ddd63]!==_0x2b87('0xb3')){if(this[_0x2b87('0x20')][_0x5ddd63][_0x2b87('0xaa')]===_0x2b87('0x1ff')&&this[_0x2b87('0x20')][_0x5ddd63][_0x2b87('0xe0')]==='reachable'){_0x48129a[_0x2b87('0x129')](this[_0x2b87('0x20')][_0x5ddd63]['id']);}}}this[_0x2b87('0xc9')](_0x523a21['id'],_0x48129a,_0x263e5d,_0x523a21[_0x2b87('0x1f9')])[_0x2b87('0xbc')](function(_0x304954){_0x523a21[_0x2b87('0x1f8')]-=_0x263e5d;_0x523a21[_0x2b87('0x1f8')]=_0x523a21[_0x2b87('0x1f8')]>0x0?_0x523a21[_0x2b87('0x1f8')]:0x0;if(!checkContactEmpty(_0x304954)){_0x5c4d7d[_0x2b87('0xbb')](_0x523a21)[_0x2b87('0xbc')](sendMessageReschedule(_0x523a21))['catch'](loggerCatch(_0x2b87('0xbd')));}else{_0x523a21[_0x2b87('0x9a')]+=_0x304954['length'];_0x523a21[_0x2b87('0x3d')]=_0x523a21['dialMethod']==='booked'?_0x2b87('0x170'):_0x2b87('0x1fa');for(var _0x572369=0x0;_0x572369<_0x304954[_0x2b87('0x14a')];_0x572369+=0x1){if(_[_0x2b87('0xb5')](_0x304954[_0x572369])||_[_0x2b87('0xb5')](_0x304954[_0x572369][_0x2b87('0x16c')])||_['isNil'](_0x304954[_0x572369][_0x2b87('0x16c')][_0x2b87('0x16b')])){_0x5c4d7d['emptyContact'](_0x2b87('0x1fb'),_0x523a21,_0x304954[_0x572369]);}else{_0x5c4d7d[_0x2b87('0xbe')](_[_0x2b87('0xd9')](_0x304954[_0x572369],['VoiceQueueId',_0x2b87('0x1fc')]))[_0x2b87('0xbc')](_0x5c4d7d[_0x2b87('0x1e4')](_0x523a21,_0x304954[_0x572369]))[_0x2b87('0xb7')](_0x5c4d7d['loggerHandler'](_0x2b87('0x1fb'),_0x523a21));}}}})['catch'](loggerGetContactDialer(_0x2b87('0x200'),_0x523a21,_0x263e5d));}};Dialer[_0x2b87('0x19')][_0x2b87('0x93')]=function(_0x1120d9){if(_0x1120d9[_0x2b87('0x1fe')]>0x0){var _0x507b08=_0x1120d9['dialLimitQueue']-_0x1120d9[_0x2b87('0x9a')]-_0x1120d9[_0x2b87('0x4e')];if(_0x507b08>0x0){this[_0x2b87('0x201')](_0x1120d9);}else{loggerPredictiveCalls[_0x2b87('0x7e')](_0x2b87('0x202'));}}else{this['tryOriginatePredictive'](_0x1120d9);}};Dialer[_0x2b87('0x19')][_0x2b87('0x201')]=function(_0x1597e9){var _0x566316=this;var _0x4a6271=[];_0x1597e9['originated']+=0x1;for(var _0x31db7b in this['agents']){if(typeof this['agents'][_0x31db7b]!==_0x2b87('0xb3')){if(this[_0x2b87('0x20')][_0x31db7b][_0x2b87('0xaa')]===_0x2b87('0x1ff')&&this[_0x2b87('0x20')][_0x31db7b][_0x2b87('0xe0')]===_0x2b87('0x203')){_0x4a6271[_0x2b87('0x129')](this['agents'][_0x31db7b]['id']);}}}this[_0x2b87('0xc9')](_0x1597e9['id'],_0x4a6271,0x1,_0x1597e9[_0x2b87('0x1f9')])[_0x2b87('0xbc')](function(_0x1115ac){if(!checkContactEmpty(_0x1115ac)){checkContactLowerLimitOriginate(_0x1597e9,0x1,0x0);_0x566316[_0x2b87('0xbb')](_0x1597e9)[_0x2b87('0xbc')](sendMessageReschedule(_0x1597e9))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xbd')));}else{_0x1597e9['message']=_0x2b87('0x1fa');if(_[_0x2b87('0xb5')](_0x1115ac[0x0])||_[_0x2b87('0xb5')](_0x1115ac[0x0][_0x2b87('0x16c')])||_[_0x2b87('0xb5')](_0x1115ac[0x0][_0x2b87('0x16c')][_0x2b87('0x16b')])){_0x566316['emptyContact'](_0x2b87('0x1fb'),_0x1597e9,_0x1115ac[0x0]);}else{_0x566316[_0x2b87('0xbe')](_[_0x2b87('0xd9')](_0x1115ac[0x0],[_0x2b87('0xfb'),_0x2b87('0x1fc')]))[_0x2b87('0xbc')](_0x566316[_0x2b87('0x1e4')](_0x1597e9,_0x1115ac[0x0]))[_0x2b87('0xb7')](_0x566316[_0x2b87('0xd4')](_0x2b87('0x204'),_0x1597e9));}}})[_0x2b87('0xb7')](loggerGetContactDialer(_0x2b87('0x205'),_0x1597e9,0x1));emitVoiceQueueSummary(_0x1597e9);};Dialer[_0x2b87('0x19')][_0x2b87('0x1d8')]=function(_0xef1713,_0xffcb1a,_0x345cf9,_0x168bae,_0x5939ec,_0x2db5f6){loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x206'));loggerPredictive[_0x2b87('0x7e')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xef1713);loggerPredictive['info'](_0x2b87('0x207'),_0xffcb1a);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x208'),_0x345cf9);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x209'),_0x168bae);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x20a'),_0x5939ec);loggerPredictive[_0x2b87('0x7e')]('---------------------------');return new BPromise(function(_0x3555f1,_0x22086b){if(_0xef1713<=0x0||isNaN(_0xef1713)){return _0x22086b(msgResponse(_0x2b87('0x20b'),'Error',_0x2b87('0x20c')+_0xef1713));}if(_0x345cf9<=0x0||isNaN(_0x345cf9)){return _0x22086b(msgResponse(_0x2b87('0x20b'),_0x2b87('0x46'),_0x2b87('0x20d')+_0x345cf9));}if(_0x168bae<=0x0||isNaN(_0x168bae)){return _0x22086b(msgResponse(_0x2b87('0x20b'),_0x2b87('0x46'),_0x2b87('0x20e')+_0x168bae));}if(_0xffcb1a<=0x0||isNaN(_0xffcb1a)){return _0x22086b(msgResponse('[abandonmentRate]',_0x2b87('0x46'),_0x2b87('0x20f')+_0xffcb1a));}if(_0x5939ec<=0x0||isNaN(_0x5939ec)){return _0x22086b(msgResponse(_0x2b87('0x20b'),_0x2b87('0x46'),'Amax\x20=\x20'+_0x5939ec));}_0x2db5f6=_0x2db5f6||0x0;var _0x4743d2=0x1/_0x345cf9;var _0x2afef8=0x0;var _0x15c4bf=0x0;var _0x1badcb=0x0;var _0x3c74b9=0x0;for(var _0x2bd312=0x0;_0x1badcb<_0x5939ec;_0x2bd312+=0x1){_0x15c4bf=_0x2bd312/_0xffcb1a;_0x2afef8=(_0x168bae*_0x15c4bf+_0x2db5f6)/_0x4743d2;_0x1badcb=erlangb(_0x2afef8,_0xef1713);_0x3c74b9=_0x2afef8/_0xef1713*(0x1-erlangb(_0x2afef8,_0xef1713));}return _0x3555f1({'erlangCalls':_0x2bd312,'erlangCallToSecond':_0xffcb1a/_0x2bd312,'erlangAbandonmentRate':_0x1badcb,'erlangBusyFactor':_0x3c74b9});});};Dialer['prototype'][_0x2b87('0x1e1')]=function(_0x5d9fea,_0x2ef5da,_0x1d095e,_0xe656e9,_0x42ebce,_0x557e30){loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x210'));loggerPredictive[_0x2b87('0x7e')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d9fea);loggerPredictive[_0x2b87('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ef5da);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x208'),_0x1d095e);loggerPredictive['info'](_0x2b87('0x209'),_0xe656e9);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x211'),_0x42ebce);loggerPredictive[_0x2b87('0x7e')]('---------------------------');return new BPromise(function(_0x1491f3,_0x4b8f12){if(_0x5d9fea<=0x0||isNaN(_0x5d9fea)){return _0x4b8f12(msgResponse(_0x2b87('0x212'),_0x2b87('0x46'),_0x2b87('0x20c')+_0x5d9fea));}if(_0x1d095e<=0x0||isNaN(_0x1d095e)){return _0x4b8f12(msgResponse(_0x2b87('0x212'),_0x2b87('0x46'),_0x2b87('0x20d')+_0x1d095e));}if(_0xe656e9<=0x0||isNaN(_0xe656e9)){return _0x4b8f12(msgResponse('[busyFactor]',_0x2b87('0x46'),_0x2b87('0x20e')+_0xe656e9));}if(_0x2ef5da<=0x0||isNaN(_0x2ef5da)){return _0x4b8f12(msgResponse('[busyFactor]',_0x2b87('0x46'),_0x2b87('0x20f')+_0x2ef5da));}if(_0x42ebce<=0x0||isNaN(_0x42ebce)){return _0x4b8f12(msgResponse(_0x2b87('0x212'),'Error',_0x2b87('0x213')+_0x42ebce));}_0x557e30=_0x557e30||0x0;var _0x5c82a5=0x1/_0x1d095e;var _0x32a8e0=0x0;var _0x456b6e=0x0;var _0x366ecf=0x0;var _0x410579=0x0;for(var _0x37acb7=0x0;_0x410579<_0x42ebce;_0x37acb7+=0x1){_0x456b6e=_0x37acb7/_0x2ef5da;_0x32a8e0=(_0xe656e9*_0x456b6e+_0x557e30)/_0x5c82a5;_0x366ecf=erlangb(_0x32a8e0,_0x5d9fea);_0x410579=_0x32a8e0/_0x5d9fea*(0x1-erlangb(_0x32a8e0,_0x5d9fea));}return _0x1491f3({'erlangCalls':_0x37acb7,'erlangCallToSecond':_0x2ef5da/_0x37acb7,'erlangAbandonmentRate':_0x366ecf,'erlangBusyFactor':_0x410579});});};module[_0x2b87('0x214')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index a43c7aa..a33e7b2 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb12f=['recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0x5b9231,_0x43077){var _0x250dd9=function(_0xed36bb){while(--_0xed36bb){_0x5b9231['push'](_0x5b9231['shift']());}};_0x250dd9(++_0x43077);}(_0xb12f,0x182));var _0xfb12=function(_0x2009e2,_0x171a59){_0x2009e2=_0x2009e2-0x0;var _0x32731c=_0xb12f[_0x2009e2];return _0x32731c;};'use strict';var util=require(_0xfb12('0x0'));var _=require(_0xfb12('0x1'));var moment=require(_0xfb12('0x2'));function getSeconds(_0xd88a49,_0x51c7b7){var _0xacc33=moment(_0xd88a49)[_0xfb12('0x3')](0x0);var _0x42796a=moment(_0x51c7b7)[_0xfb12('0x3')](0x0);return _0xacc33[_0xfb12('0x4')](_0x42796a,_0xfb12('0x5'));}function QueueCallerAbandon(_0x49fc90,_0x2cd1a5){this[_0xfb12('0x6')]=_0x49fc90[_0xfb12('0x6')];this[_0xfb12('0x7')]=_0x49fc90['type'];this[_0xfb12('0x8')]=_0x49fc90[_0xfb12('0x7')]===_0xfb12('0x9')?_0xfb12('0xa'):_0x49fc90[_0xfb12('0x7')];this[_0xfb12('0xb')]=_0x49fc90[_0xfb12('0xb')];this[_0xfb12('0xc')]=_0x49fc90[_0xfb12('0xc')];this[_0xfb12('0xd')]=_0x49fc90[_0xfb12('0xd')];this[_0xfb12('0xe')]=_0x49fc90['countbusyretry']+_0x49fc90[_0xfb12('0xc')]+_0x49fc90['countnoanswerretry']+_0x49fc90['countnosuchnumberretry']+_0x49fc90[_0xfb12('0xf')]+_0x49fc90[_0xfb12('0x10')]+_0x49fc90[_0xfb12('0x11')]+_0x49fc90['countagentrejectretry'];this[_0xfb12('0x12')]=_0x49fc90[_0xfb12('0x12')];this[_0xfb12('0xf')]=_0x49fc90[_0xfb12('0xf')];this['countabandonedretry']=_0x49fc90[_0xfb12('0x10')];this[_0xfb12('0x11')]=_0x49fc90[_0xfb12('0x11')];this['countagentrejectretry']=_0x49fc90[_0xfb12('0x13')];this[_0xfb12('0x14')]=_0x2cd1a5[_0xfb12('0x14')];this[_0xfb12('0x15')]=_0x49fc90[_0xfb12('0x16')];this[_0xfb12('0x17')]=_0x49fc90['number'];this[_0xfb12('0x18')]=_0x49fc90[_0xfb12('0x18')];this[_0xfb12('0x19')]=_0x49fc90[_0xfb12('0x19')];this['droptime']=_0x49fc90[_0xfb12('0x1a')];this['endtime']=this[_0xfb12('0x1a')];this['ringtime']=getSeconds(_0x49fc90['responsetime'],_0x49fc90['starttime']);this[_0xfb12('0x1b')]=getSeconds(this[_0xfb12('0x1a')],_0x49fc90[_0xfb12('0x19')]);this[_0xfb12('0x1c')]=0x0;this['queue']=_0x2cd1a5['queue'];this['membername']=_0x2cd1a5[_0xfb12('0x1d')];this[_0xfb12('0x1e')]=_0x2cd1a5['reason'];this['callback']=_0x49fc90[_0xfb12('0x1f')];this[_0xfb12('0x20')]=_0x49fc90[_0xfb12('0x20')];this[_0xfb12('0x21')]=_0x49fc90[_0xfb12('0x21')];this[_0xfb12('0x22')]=_0x49fc90[_0xfb12('0x22')];this['ContactId']=_0x49fc90['ContactId'];this['ListId']=_0x49fc90[_0xfb12('0x23')];this[_0xfb12('0x24')]=_0x49fc90[_0xfb12('0x24')];this[_0xfb12('0x25')]=_0x49fc90['VoiceQueueId'];this[_0xfb12('0x26')]=_0x49fc90['CampaignId'];this[_0xfb12('0x27')]=_0x49fc90[_0xfb12('0x27')]||'';this['originatecalleridname']=_0x49fc90[_0xfb12('0x28')]||'';}module[_0xfb12('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x0393=['diff','seconds','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0393,0x1ca));var _0x3039=function(_0x35b637,_0x43c488){_0x35b637=_0x35b637-0x0;var _0x115a86=_0x0393[_0x35b637];return _0x115a86;};'use strict';var util=require(_0x3039('0x0'));var _=require(_0x3039('0x1'));var moment=require(_0x3039('0x2'));function getSeconds(_0x1c4aab,_0x5f5342){var _0x27425a=moment(_0x1c4aab)[_0x3039('0x3')](0x0);var _0xbdd7b5=moment(_0x5f5342)[_0x3039('0x3')](0x0);return _0x27425a[_0x3039('0x4')](_0xbdd7b5,_0x3039('0x5'));}function QueueCallerAbandon(_0x2cff92,_0x1b230f){this['scheduledat']=_0x2cff92[_0x3039('0x6')];this['type']=_0x2cff92['type'];this[_0x3039('0x7')]=_0x2cff92[_0x3039('0x8')]===_0x3039('0x9')?_0x3039('0xa'):_0x2cff92[_0x3039('0x8')];this['countbusyretry']=_0x2cff92[_0x3039('0xb')];this[_0x3039('0xc')]=_0x2cff92['countcongestionretry'];this['countnoanswerretry']=_0x2cff92['countnoanswerretry'];this[_0x3039('0xd')]=_0x2cff92[_0x3039('0xb')]+_0x2cff92['countcongestionretry']+_0x2cff92[_0x3039('0xe')]+_0x2cff92[_0x3039('0xf')]+_0x2cff92[_0x3039('0x10')]+_0x2cff92[_0x3039('0x11')]+_0x2cff92[_0x3039('0x12')]+_0x2cff92[_0x3039('0x13')];this[_0x3039('0xf')]=_0x2cff92[_0x3039('0xf')];this['countdropretry']=_0x2cff92[_0x3039('0x10')];this['countabandonedretry']=_0x2cff92[_0x3039('0x11')];this[_0x3039('0x12')]=_0x2cff92[_0x3039('0x12')];this[_0x3039('0x13')]=_0x2cff92[_0x3039('0x13')];this[_0x3039('0x14')]=_0x1b230f['uniqueid'];this['calleridname']=_0x2cff92[_0x3039('0x15')];this[_0x3039('0x16')]=_0x2cff92[_0x3039('0x17')];this[_0x3039('0x18')]=_0x2cff92['starttime'];this['responsetime']=_0x2cff92[_0x3039('0x19')];this[_0x3039('0x1a')]=_0x2cff92[_0x3039('0x1a')];this[_0x3039('0x1b')]=this[_0x3039('0x1a')];this['ringtime']=getSeconds(_0x2cff92[_0x3039('0x19')],_0x2cff92['starttime']);this[_0x3039('0x1c')]=getSeconds(this[_0x3039('0x1a')],_0x2cff92[_0x3039('0x19')]);this[_0x3039('0x1d')]=0x0;this[_0x3039('0xa')]=_0x1b230f[_0x3039('0xa')];this[_0x3039('0x1e')]=_0x1b230f[_0x3039('0x1f')];this[_0x3039('0x20')]=_0x1b230f[_0x3039('0x20')];this[_0x3039('0x21')]=_0x2cff92['callback'];this[_0x3039('0x22')]=_0x2cff92[_0x3039('0x22')];this[_0x3039('0x23')]=_0x2cff92[_0x3039('0x23')];this[_0x3039('0x24')]=_0x2cff92[_0x3039('0x24')];this['ContactId']=_0x2cff92[_0x3039('0x25')];this['ListId']=_0x2cff92['ListId'];this[_0x3039('0x26')]=_0x2cff92[_0x3039('0x26')];this['VoiceQueueId']=_0x2cff92['VoiceQueueId'];this['CampaignId']=_0x2cff92['CampaignId'];this['originatecalleridnum']=_0x2cff92[_0x3039('0x27')]||'';this[_0x3039('0x28')]=_0x2cff92[_0x3039('0x28')]||'';}module[_0x3039('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5cef62f..8bc5540 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1ac=['tech','Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports','lodash','uniqueid','channel','format','%s/%s/%s'];(function(_0x34c566,_0x5ad300){var _0x1433e1=function(_0x12ef06){while(--_0x12ef06){_0x34c566['push'](_0x34c566['shift']());}};_0x1433e1(++_0x5ad300);}(_0xb1ac,0xf2));var _0xcb1a=function(_0x565dd2,_0x540d46){_0x565dd2=_0x565dd2-0x0;var _0x3305a1=_0xb1ac[_0x565dd2];return _0x3305a1;};'use strict';var util=require('util');var _=require(_0xcb1a('0x0'));var moment=require('moment');function Action(_0x4268c3,_0x134f95,_0x46b103){this[_0xcb1a('0x1')]=_0x4268c3||undefined;this[_0xcb1a('0x2')]=util[_0xcb1a('0x3')](_0xcb1a('0x4'),_0x134f95[_0xcb1a('0x5')],_0x134f95[_0xcb1a('0x6')]['name'],_0x46b103[_0xcb1a('0x7')]);this[_0xcb1a('0x8')]=_0x134f95[_0xcb1a('0x8')];this[_0xcb1a('0x9')]=_0x134f95['headerinfo'];this[_0xcb1a('0xa')]=_0x46b103[_0xcb1a('0xa')];this[_0xcb1a('0xb')]=_0x46b103[_0xcb1a('0xb')];}module[_0xcb1a('0xc')]=Action; \ No newline at end of file +var _0xc7e8=['util','uniqueid','format','%s/%s/%s','tech','Trunk','name','localstationid','headerinfo','AttachmentId'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xc7e8,0x1e0));var _0x8c7e=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0xc7e8[_0x1f3aec];return _0x409f0d;};'use strict';var util=require(_0x8c7e('0x0'));var _=require('lodash');var moment=require('moment');function Action(_0x48bdbf,_0xe8e0e,_0x1447af){this[_0x8c7e('0x1')]=_0x48bdbf||undefined;this['channel']=util[_0x8c7e('0x2')](_0x8c7e('0x3'),_0xe8e0e[_0x8c7e('0x4')],_0xe8e0e[_0x8c7e('0x5')][_0x8c7e('0x6')],_0x1447af['fax']);this['localstationid']=_0xe8e0e[_0x8c7e('0x7')];this[_0x8c7e('0x8')]=_0xe8e0e[_0x8c7e('0x8')];this['path']=_0x1447af['path'];this[_0x8c7e('0x9')]=_0x1447af[_0x8c7e('0x9')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 901ca91..24fe145 100644 --- a/server/services/ami/fax/index.js +++ b/server/services/ami/fax/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98b0=['Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','util','lodash','bluebird','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','bind','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','localstationid','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x98b0,0x79));var _0x098b=function(_0x4ee881,_0x10ddc8){_0x4ee881=_0x4ee881-0x0;var _0x305f48=_0x98b0[_0x4ee881];return _0x305f48;};'use strict';var util=require(_0x098b('0x0'));var _=require(_0x098b('0x1'));var BPromise=require(_0x098b('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x098b('0x3'));var tiff2pdf=require(_0x098b('0x4'));var gs=require(_0x098b('0x5'));var logger=require(_0x098b('0x6'))(_0x098b('0x7'));var ami=require(_0x098b('0x8'));var rpcDb=require(_0x098b('0x9'));var Channel=require('./channel');var ut=require(_0x098b('0xa'));var Action=require(_0x098b('0xb'));var faxAccount=require(_0x098b('0xc'));var attachment=require(_0x098b('0xd'));var faxMessage=require(_0x098b('0xe'));function Fax(_0xc47934){this['channels']={};this[_0x098b('0xf')]=_0xc47934[_0x098b('0xf')];this[_0x098b('0x10')]=_0xc47934[_0x098b('0x10')];this[_0x098b('0x11')]={};ami['on']('newchannel',this[_0x098b('0x12')]['bind'](this));ami['on'](_0x098b('0x13'),this[_0x098b('0x14')][_0x098b('0x15')](this));ami['on']('newstate',this['syncNewState'][_0x098b('0x15')](this));ami['on'](_0x098b('0x16'),this[_0x098b('0x17')][_0x098b('0x15')](this));ami['on'](_0x098b('0x18'),this[_0x098b('0x19')][_0x098b('0x15')](this));ami['on']('receivefax',this[_0x098b('0x1a')][_0x098b('0x15')](this));ami['on'](_0x098b('0x1b'),this[_0x098b('0x1c')]['bind'](this));ami['on']('originateresponse',this[_0x098b('0x1d')]['bind'](this));}Fax[_0x098b('0x1e')][_0x098b('0x12')]=function(_0x129133){if(_0x129133[_0x098b('0x1f')]===_0x098b('0x20')){for(var _0xfe6a90 in this[_0x098b('0xf')]){if(this[_0x098b('0xf')]['hasOwnProperty'](_0xfe6a90)){if(_0x129133[_0x098b('0x21')]===this[_0x098b('0xf')][_0xfe6a90]['localstationid']){this[_0x098b('0x22')][_0x129133[_0x098b('0x23')]]={};this['channels'][_0x129133[_0x098b('0x23')]][_0x098b('0x24')]=_0x129133[_0x098b('0x24')];this['channels'][_0x129133[_0x098b('0x23')]]['id']=this['faxAccounts'][_0xfe6a90]['id'];this[_0x098b('0x22')][_0x129133[_0x098b('0x23')]][_0x098b('0x25')]=this[_0x098b('0xf')][_0xfe6a90][_0x098b('0x25')];logger[_0x098b('0x26')](_0x129133['uniqueid'],_0x098b('0x27'));}}}}if(this[_0x098b('0x11')][_0x129133[_0x098b('0x23')]]){this[_0x098b('0x22')][_0x129133['uniqueid']]={};this[_0x098b('0x22')][_0x129133[_0x098b('0x23')]][_0x098b('0x24')]=_0x129133[_0x098b('0x24')];logger[_0x098b('0x26')](_0x129133[_0x098b('0x23')],_0x098b('0x27'));}};Fax['prototype'][_0x098b('0x14')]=function(_0x37a5d8){if(this[_0x098b('0x22')][_0x37a5d8[_0x098b('0x23')]]){for(var _0xcfa24d in _0x37a5d8[_0x098b('0x28')]){if(_0x37a5d8[_0x098b('0x28')][_0x098b('0x29')](_0xcfa24d)){this[_0x098b('0x22')][_0x37a5d8['uniqueid']][_0xcfa24d]=_0x37a5d8[_0x098b('0x2a')];}}}};Fax[_0x098b('0x1e')][_0x098b('0x2b')]=function(_0x37f1ab){if(this[_0x098b('0x22')][_0x37f1ab['uniqueid']]){this[_0x098b('0x22')][_0x37f1ab['uniqueid']][_0x098b('0x2c')]=_0x37f1ab[_0x098b('0x2c')];this[_0x098b('0x22')][_0x37f1ab[_0x098b('0x23')]][_0x098b('0x2d')]=_0x37f1ab[_0x098b('0x2d')];}};Fax['prototype']['syncNewExten']=function(_0x529d52){if(this[_0x098b('0x22')][_0x529d52['uniqueid']]){for(var _0x49bac7 in _0x529d52[_0x098b('0x28')]){if(_0x529d52[_0x098b('0x28')][_0x098b('0x29')](_0x49bac7)){this[_0x098b('0x22')][_0x529d52[_0x098b('0x23')]][_0x49bac7]=_0x529d52['value'];}}}};Fax[_0x098b('0x1e')][_0x098b('0x19')]=function(_0x39e0b1){if(this[_0x098b('0x22')][_0x39e0b1[_0x098b('0x23')]]){this[_0x098b('0x22')][_0x39e0b1[_0x098b('0x23')]][_0x098b('0x2e')]=_0x39e0b1[_0x098b('0x2e')];this[_0x098b('0x22')][_0x39e0b1[_0x098b('0x23')]][_0x098b('0x2f')]=_0x39e0b1[_0x098b('0x2f')];this[_0x098b('0x22')][_0x39e0b1['uniqueid']]['localstationid']=_0x39e0b1['localstationid'];this['channels'][_0x39e0b1[_0x098b('0x23')]][_0x098b('0x30')]=_0x39e0b1[_0x098b('0x30')];logger[_0x098b('0x26')](_0x39e0b1[_0x098b('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0x098b('0x1e')][_0x098b('0x1a')]=function(_0x193f61){var _0x33f8bf=this;if(this[_0x098b('0x22')][_0x193f61[_0x098b('0x23')]]){var _0x43bd79=this[_0x098b('0x22')][_0x193f61[_0x098b('0x23')]]['id'];this['channels'][_0x193f61[_0x098b('0x23')]][_0x098b('0x31')]=_0x193f61['remotestationid'];this[_0x098b('0x22')][_0x193f61[_0x098b('0x23')]][_0x098b('0x32')]=_0x193f61[_0x098b('0x32')];this[_0x098b('0x22')][_0x193f61[_0x098b('0x23')]][_0x098b('0x33')]=_0x193f61['localstationid'];this[_0x098b('0x22')][_0x193f61[_0x098b('0x23')]][_0x098b('0x34')]=_0x193f61[_0x098b('0x34')];this[_0x098b('0x22')][_0x193f61[_0x098b('0x23')]]['transferrate']=_0x193f61[_0x098b('0x35')];this['channels'][_0x193f61['uniqueid']][_0x098b('0x30')]=_0x193f61['filename'];this[_0x098b('0x22')][_0x193f61[_0x098b('0x23')]][_0x098b('0x36')]=_0x193f61[_0x098b('0x36')];if(this[_0x098b('0x22')][_0x193f61[_0x098b('0x23')]][_0x098b('0x32')]>0x0){tiff2pdf(_0x193f61[_0x098b('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x5975cf){logger['info'](_0x193f61[_0x098b('0x23')],_0x098b('0x37'),_0x5975cf[_0x098b('0x38')]);attachment['create']({'name':path[_0x098b('0x39')](_0x193f61['filename'])[_0x098b('0x25')],'basename':path[_0x098b('0x39')](_0x193f61[_0x098b('0x30')])[_0x098b('0x25')]+_0x098b('0x3a'),'type':_0x098b('0x3b')})[_0x098b('0x3c')](function(_0x1d960d){faxAccount[_0x098b('0x3d')](_0x43bd79,{'from':_0x193f61[_0x098b('0x36')],'mapKey':'fax','body':path[_0x098b('0x39')](_0x193f61[_0x098b('0x30')])[_0x098b('0x25')]+_0x098b('0x3a'),'AttachmentId':_0x1d960d['id']})[_0x098b('0x3e')](function(_0x4f8a73){logger[_0x098b('0x3f')](_0x193f61['uniqueid'],_0x098b('0x40'),JSON[_0x098b('0x41')](_0x4f8a73));});})[_0x098b('0x3e')](function(_0x3753b0){logger[_0x098b('0x3f')](_0x193f61[_0x098b('0x23')],_0x098b('0x42'),JSON[_0x098b('0x41')](_0x3753b0));});});}logger[_0x098b('0x26')](_0x193f61[_0x098b('0x23')],_0x098b('0x42'));}};Fax[_0x098b('0x1e')][_0x098b('0x1d')]=function(_0x5df563){if(this[_0x098b('0x11')][_0x5df563[_0x098b('0x23')]]){_['merge'](this[_0x098b('0x22')][_0x5df563['uniqueid']],_[_0x098b('0x43')](_0x5df563,[_0x098b('0x44'),'reason']));}};function updateStatus(_0x2c6d72){if(_0x2c6d72[_0x098b('0x45')]){faxMessage[_0x098b('0x46')](_0x2c6d72[_0x098b('0x45')],{'failMessage':_0x098b('0x47')})[_0x098b('0x3c')](function(_0x38e29f){ut[_0x098b('0x48')](_0x098b('0x49'),_0x38e29f);})[_0x098b('0x3e')](function(_0x4f5a88){ut[_0x098b('0x48')](_0x098b('0x4a'),_0x4f5a88);});}else{ut[_0x098b('0x48')](_0x098b('0x4b'));}}Fax[_0x098b('0x1e')][_0x098b('0x4c')]=function(_0x28e788,_0x3425d8,_0x171a44){var _0x5c67b9=this;var _0x459ad8={};if(_0x3425d8){_0x459ad8={'read':_0x3425d8};}else{_0x459ad8={'failMessage':_0x171a44};}if(this[_0x098b('0x11')][_0x28e788][_0x098b('0x45')]){faxMessage[_0x098b('0x46')](this['actions'][_0x28e788][_0x098b('0x45')],_0x459ad8)[_0x098b('0x3c')](function(_0x3ca344){ut[_0x098b('0x48')](_0x098b('0x4d'),_0x3ca344);})['catch'](function(_0x40a32c){ut[_0x098b('0x48')]('[Fax][Message][NoUpdate1]',_0x40a32c);})[_0x098b('0x4e')](function(){delete _0x5c67b9[_0x098b('0x22')][_0x28e788];delete _0x5c67b9[_0x098b('0x11')][_0x28e788];});}else{ut[_0x098b('0x48')](_0x098b('0x4f'));delete this[_0x098b('0x22')][_0x28e788];delete this[_0x098b('0x11')][_0x28e788];}};Fax[_0x098b('0x1e')]['syncHangup']=function(_0x51eb1e){var _0x51e894=this;if(this[_0x098b('0x22')][_0x51eb1e[_0x098b('0x23')]]){if(this[_0x098b('0x11')][_0x51eb1e[_0x098b('0x23')]]){this[_0x098b('0x22')][_0x51eb1e[_0x098b('0x23')]]['id']=this[_0x098b('0x11')][_0x51eb1e[_0x098b('0x23')]]['id'];this[_0x098b('0x22')][_0x51eb1e[_0x098b('0x23')]][_0x098b('0x25')]=this[_0x098b('0x11')][_0x51eb1e[_0x098b('0x23')]]['name'];}logger[_0x098b('0x26')](_0x51eb1e[_0x098b('0x23')],this['actions'][_0x51eb1e[_0x098b('0x23')]]?_0x098b('0x50'):_0x098b('0x51'),JSON['stringify'](this[_0x098b('0x22')][_0x51eb1e[_0x098b('0x23')]]));if(this['actions'][_0x51eb1e[_0x098b('0x23')]]){if(this[_0x098b('0x22')][_0x51eb1e['uniqueid']][_0x098b('0x52')]>0x0&&this[_0x098b('0x22')][_0x51eb1e[_0x098b('0x23')]][_0x098b('0x18')]===_0x098b('0x53')){this['updateStatus'](_0x51eb1e['uniqueid'],!![]);}else{this[_0x098b('0x4c')](_0x51eb1e[_0x098b('0x23')],![],this[_0x098b('0x22')][_0x51eb1e[_0x098b('0x23')]][_0x098b('0x54')]?_0x098b('0x55')+this[_0x098b('0x22')][_0x51eb1e['uniqueid']]['faxstatusstring']:_0x098b('0x56'));}}}};Fax[_0x098b('0x1e')][_0x098b('0x57')]=function(_0x55cbd8){var _0x365155=this;return new BPromise(function(_0x21ca5d,_0x395a2f){_0x365155[_0x098b('0x58')](_0x55cbd8,_0x365155['faxAccounts'][_0x55cbd8[_0x098b('0x59')]])[_0x098b('0x3c')](function(_0x49b394){ut['logger'](_0x098b('0x5a'),_0x49b394);_0x21ca5d(ut[_0x098b('0x38')](_0x098b('0x5b')));})[_0x098b('0x3e')](function(_0x4a41ad){ut[_0x098b('0x48')](_0x098b('0x5c'),_0x4a41ad);updateStatus(_0x55cbd8);_0x395a2f(ut['message'](_0x098b('0x5d')));});});};Fax[_0x098b('0x1e')][_0x098b('0x5e')]=function(_0xb69ea3){var _0xa64a93=this;return new BPromise(function(_0x11ed8f,_0x345d48){var _0x5efbb1=_0xa64a93['checkTrunk'](_0xa64a93[_0x098b('0xf')][_0xb69ea3[_0x098b('0x59')]][_0x098b('0x5f')],_0xb69ea3);if(_0x5efbb1[_0x098b('0x60')]){_0x11ed8f(ut[_0x098b('0x38')]('Trunk\x20Reachable'));}else{_0x345d48(ut[_0x098b('0x38')](_0x5efbb1['message']));}});};function originate(_0x16f68b,_0x247ed2,_0xc999cf){return new BPromise(function(_0x541ba6,_0x237f54){if(_0xc999cf){var _0xc93be8=util[_0x098b('0x61')](_0x098b('0x62'),path[_0x098b('0x39')](_0x16f68b[_0x098b('0x3')])[_0x098b('0x25')],_0x16f68b[_0x098b('0x3')]);gs[_0x098b('0x63')](_0xc93be8)['then'](function(){_0x16f68b[_0x098b('0x3')]=util[_0x098b('0x61')]('%s/%s.tif',path[_0x098b('0x39')](_0x16f68b['path'])[_0x098b('0x64')],path[_0x098b('0x39')](_0x16f68b[_0x098b('0x3')])[_0x098b('0x25')]);_0x247ed2['XMF-PATH']=_0x16f68b['path'];ut[_0x098b('0x48')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0x098b('0x65')](_0x16f68b,_0x247ed2))[_0x098b('0x3c')](function(_0x3c26a6){_0x541ba6(_0x3c26a6);})[_0x098b('0x3e')](function(_0x2c87ec){_0x237f54(_0x2c87ec);});})[_0x098b('0x3e')](function(_0x14df50){_0x237f54(_0x14df50);});}else{ami['Action'](ut[_0x098b('0x65')](_0x16f68b,_0x247ed2))[_0x098b('0x3c')](function(_0x38ce37){_0x541ba6(_0x38ce37);})[_0x098b('0x3e')](function(_0x3698ea){_0x237f54(_0x3698ea);});}});}Fax['prototype']['execOriginate']=function(_0x43ac89,_0x4cbdcb){var _0xd7199f=this;return new BPromise(function(_0x58ff35,_0x129870){var _0x1267ce=uuid['v4']();var _0x4dc1ce=ut['addVariables'](_0x43ac89,_0x4cbdcb);_0xd7199f[_0x098b('0x11')][_0x1267ce]=new Action(_0x1267ce,_0x4cbdcb,_0x43ac89);var _0x3ccfbd=_0xd7199f['actions'][_0x1267ce];if(path['parse'](_0x43ac89[_0x098b('0x3')])[_0x098b('0x66')]===_0x098b('0x3a')){originate(_0x3ccfbd,_0x4dc1ce,!![])[_0x098b('0x3c')](function(_0x1147ff){_0x58ff35(_0x1147ff);})['catch'](function(_0x3a738b){_0x129870(_0x3a738b);});}else{originate(_0x3ccfbd,_0x4dc1ce,![])['then'](function(_0x52d5ce){_0x58ff35(_0x52d5ce);})[_0x098b('0x3e')](function(_0x10483d){_0x129870(_0x10483d);});}});};Fax[_0x098b('0x1e')][_0x098b('0x67')]=function(_0x5fc00c){return!_[_0x098b('0x68')](_0x5fc00c)&&!_[_0x098b('0x68')](_0x5fc00c[_0x098b('0x25')])&&!_['isNil'](_0x5fc00c[_0x098b('0x69')])&&_0x5fc00c[_0x098b('0x69')]&&!_[_0x098b('0x68')](this[_0x098b('0x10')][util[_0x098b('0x61')]('SIP/%s',_0x5fc00c[_0x098b('0x25')])])&&!_[_0x098b('0x68')](this[_0x098b('0x10')][util['format'](_0x098b('0x6a'),_0x5fc00c[_0x098b('0x25')])][_0x098b('0x2f')])&&(this[_0x098b('0x10')][util['format'](_0x098b('0x6a'),_0x5fc00c[_0x098b('0x25')])][_0x098b('0x2f')]===_0x098b('0x6b')||this[_0x098b('0x10')][util[_0x098b('0x61')](_0x098b('0x6a'),_0x5fc00c[_0x098b('0x25')])]['status']===_0x098b('0x6c'));};Fax[_0x098b('0x1e')][_0x098b('0x6d')]=function(_0x4a72f0,_0x44b74a){if(!this['isTrunkReachable'](_0x4a72f0)){ut[_0x098b('0x48')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x4a72f0)?'':_0x4a72f0[_0x098b('0x25')]+_0x098b('0x6e'));return{'isValid':![],'message':_0x098b('0x6f')};}if(_['isNil'](_0x44b74a[_0x098b('0x7')])){ut[_0x098b('0x48')](_0x098b('0x70'),JSON['stringify'](_0x44b74a));return{'isValid':![],'message':_0x098b('0x71')};}if(_[_0x098b('0x68')](_0x44b74a[_0x098b('0x3')])){ut[_0x098b('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x098b('0x41')](_0x44b74a));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x098b('0x72')};};module[_0x098b('0x73')]=Fax; \ No newline at end of file +var _0xa99e=['[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','Trunk','isValid','Trunk\x20Reachable','format','execute','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','newstate','syncNewState','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','info','create','parse','.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId'];(function(_0x18c9ed,_0x31132a){var _0xc245fa=function(_0x2c846f){while(--_0x2c846f){_0x18c9ed['push'](_0x18c9ed['shift']());}};_0xc245fa(++_0x31132a);}(_0xa99e,0x182));var _0xea99=function(_0x4db38c,_0x351db3){_0x4db38c=_0x4db38c-0x0;var _0xe83a7f=_0xa99e[_0x4db38c];return _0xe83a7f;};'use strict';var util=require(_0xea99('0x0'));var _=require(_0xea99('0x1'));var BPromise=require(_0xea99('0x2'));var uuid=require(_0xea99('0x3'));var moment=require(_0xea99('0x4'));var path=require(_0xea99('0x5'));var tiff2pdf=require(_0xea99('0x6'));var gs=require(_0xea99('0x7'));var logger=require(_0xea99('0x8'))('fax');var ami=require(_0xea99('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xea99('0xa'));var ut=require(_0xea99('0xb'));var Action=require(_0xea99('0xc'));var faxAccount=require(_0xea99('0xd'));var attachment=require(_0xea99('0xe'));var faxMessage=require(_0xea99('0xf'));function Fax(_0x2e78bc){this[_0xea99('0x10')]={};this[_0xea99('0x11')]=_0x2e78bc[_0xea99('0x11')];this[_0xea99('0x12')]=_0x2e78bc[_0xea99('0x12')];this[_0xea99('0x13')]={};ami['on'](_0xea99('0x14'),this['syncNewchannel'][_0xea99('0x15')](this));ami['on'](_0xea99('0x16'),this['syncVarSet'][_0xea99('0x15')](this));ami['on'](_0xea99('0x17'),this[_0xea99('0x18')][_0xea99('0x15')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xea99('0x19'),this[_0xea99('0x1a')][_0xea99('0x15')](this));ami['on'](_0xea99('0x1b'),this[_0xea99('0x1c')]['bind'](this));ami['on'](_0xea99('0x1d'),this[_0xea99('0x1e')][_0xea99('0x15')](this));ami['on'](_0xea99('0x1f'),this[_0xea99('0x20')][_0xea99('0x15')](this));}Fax['prototype'][_0xea99('0x21')]=function(_0xc145c5){if(_0xc145c5[_0xea99('0x22')]===_0xea99('0x23')){for(var _0x585481 in this[_0xea99('0x11')]){if(this[_0xea99('0x11')][_0xea99('0x24')](_0x585481)){if(_0xc145c5[_0xea99('0x25')]===this[_0xea99('0x11')][_0x585481][_0xea99('0x26')]){this['channels'][_0xc145c5[_0xea99('0x27')]]={};this[_0xea99('0x10')][_0xc145c5[_0xea99('0x27')]]['channel']=_0xc145c5[_0xea99('0x28')];this[_0xea99('0x10')][_0xc145c5[_0xea99('0x27')]]['id']=this[_0xea99('0x11')][_0x585481]['id'];this[_0xea99('0x10')][_0xc145c5[_0xea99('0x27')]][_0xea99('0x29')]=this[_0xea99('0x11')][_0x585481]['name'];logger['info'](_0xc145c5[_0xea99('0x27')],_0xea99('0x2a'));}}}}if(this['actions'][_0xc145c5['uniqueid']]){this[_0xea99('0x10')][_0xc145c5[_0xea99('0x27')]]={};this['channels'][_0xc145c5[_0xea99('0x27')]]['channel']=_0xc145c5[_0xea99('0x28')];logger['info'](_0xc145c5[_0xea99('0x27')],_0xea99('0x2a'));}};Fax[_0xea99('0x2b')][_0xea99('0x2c')]=function(_0x97dba1){if(this['channels'][_0x97dba1[_0xea99('0x27')]]){for(var _0x502a23 in _0x97dba1['variable']){if(_0x97dba1[_0xea99('0x2d')][_0xea99('0x24')](_0x502a23)){this[_0xea99('0x10')][_0x97dba1[_0xea99('0x27')]][_0x502a23]=_0x97dba1[_0xea99('0x2e')];}}}};Fax[_0xea99('0x2b')][_0xea99('0x18')]=function(_0x5d996d){if(this[_0xea99('0x10')][_0x5d996d[_0xea99('0x27')]]){this[_0xea99('0x10')][_0x5d996d[_0xea99('0x27')]][_0xea99('0x2f')]=_0x5d996d[_0xea99('0x2f')];this['channels'][_0x5d996d[_0xea99('0x27')]][_0xea99('0x30')]=_0x5d996d[_0xea99('0x30')];}};Fax[_0xea99('0x2b')][_0xea99('0x31')]=function(_0x1332bc){if(this['channels'][_0x1332bc[_0xea99('0x27')]]){for(var _0x373bb5 in _0x1332bc[_0xea99('0x2d')]){if(_0x1332bc['variable']['hasOwnProperty'](_0x373bb5)){this[_0xea99('0x10')][_0x1332bc[_0xea99('0x27')]][_0x373bb5]=_0x1332bc[_0xea99('0x2e')];}}}};Fax['prototype'][_0xea99('0x1a')]=function(_0x3d4e6d){if(this[_0xea99('0x10')][_0x3d4e6d[_0xea99('0x27')]]){this[_0xea99('0x10')][_0x3d4e6d[_0xea99('0x27')]]['operation']=_0x3d4e6d[_0xea99('0x32')];this[_0xea99('0x10')][_0x3d4e6d['uniqueid']][_0xea99('0x33')]=_0x3d4e6d[_0xea99('0x33')];this[_0xea99('0x10')][_0x3d4e6d[_0xea99('0x27')]]['localstationid']=_0x3d4e6d[_0xea99('0x26')];this['channels'][_0x3d4e6d[_0xea99('0x27')]][_0xea99('0x34')]=_0x3d4e6d[_0xea99('0x34')];logger['info'](_0x3d4e6d[_0xea99('0x27')],_0xea99('0x35'));}};Fax[_0xea99('0x2b')][_0xea99('0x1c')]=function(_0x1ec540){var _0x1dc34a=this;if(this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]]){var _0x267720=this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]]['id'];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]]['remotestationid']=_0x1ec540['remotestationid'];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]][_0xea99('0x36')]=_0x1ec540[_0xea99('0x36')];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]][_0xea99('0x26')]=_0x1ec540[_0xea99('0x26')];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]][_0xea99('0x37')]=_0x1ec540[_0xea99('0x37')];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]][_0xea99('0x38')]=_0x1ec540['transferrate'];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]]['filename']=_0x1ec540[_0xea99('0x34')];this['channels'][_0x1ec540['uniqueid']][_0xea99('0x39')]=_0x1ec540['calleridnum'];if(this[_0xea99('0x10')][_0x1ec540['uniqueid']][_0xea99('0x36')]>0x0){tiff2pdf(_0x1ec540[_0xea99('0x34')],_0xea99('0x3a'),function(_0x3f97de){logger[_0xea99('0x3b')](_0x1ec540[_0xea99('0x27')],'\x20result\x20conversion\x20file\x20',_0x3f97de['message']);attachment[_0xea99('0x3c')]({'name':path[_0xea99('0x3d')](_0x1ec540[_0xea99('0x34')])[_0xea99('0x29')],'basename':path[_0xea99('0x3d')](_0x1ec540[_0xea99('0x34')])[_0xea99('0x29')]+_0xea99('0x3e'),'type':_0xea99('0x3f')})['then'](function(_0x2afc5b){faxAccount[_0xea99('0x40')](_0x267720,{'from':_0x1ec540[_0xea99('0x39')],'mapKey':_0xea99('0x41'),'body':path['parse'](_0x1ec540[_0xea99('0x34')])[_0xea99('0x29')]+'.pdf','AttachmentId':_0x2afc5b['id']})[_0xea99('0x42')](function(_0x23e3d4){logger[_0xea99('0x43')](_0x1ec540['uniqueid'],_0xea99('0x44'),JSON[_0xea99('0x45')](_0x23e3d4));});})[_0xea99('0x42')](function(_0x1a195b){logger[_0xea99('0x43')](_0x1ec540[_0xea99('0x27')],_0xea99('0x46'),JSON[_0xea99('0x45')](_0x1a195b));});});}logger[_0xea99('0x3b')](_0x1ec540['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0xea99('0x20')]=function(_0x47e30f){if(this[_0xea99('0x13')][_0x47e30f[_0xea99('0x27')]]){_['merge'](this[_0xea99('0x10')][_0x47e30f[_0xea99('0x27')]],_[_0xea99('0x47')](_0x47e30f,[_0xea99('0x48'),_0xea99('0x49')]));}};function updateStatus(_0x128c46){if(_0x128c46[_0xea99('0x4a')]){faxMessage[_0xea99('0x4b')](_0x128c46[_0xea99('0x4a')],{'failMessage':_0xea99('0x4c')})[_0xea99('0x4d')](function(_0x1a61ce){ut['logger'](_0xea99('0x4e'),_0x1a61ce);})['catch'](function(_0x1e2d78){ut[_0xea99('0x4f')](_0xea99('0x50'),_0x1e2d78);});}else{ut['logger'](_0xea99('0x51'));}}Fax[_0xea99('0x2b')][_0xea99('0x52')]=function(_0x4bf6bf,_0x3ccf40,_0x51f249){var _0x3f3317=this;var _0x32da68={};if(_0x3ccf40){_0x32da68={'read':_0x3ccf40};}else{_0x32da68={'failMessage':_0x51f249};}if(this[_0xea99('0x13')][_0x4bf6bf][_0xea99('0x4a')]){faxMessage[_0xea99('0x4b')](this[_0xea99('0x13')][_0x4bf6bf][_0xea99('0x4a')],_0x32da68)[_0xea99('0x4d')](function(_0x4b0c0c){ut[_0xea99('0x4f')](_0xea99('0x53'),_0x4b0c0c);})[_0xea99('0x42')](function(_0x14bb4d){ut[_0xea99('0x4f')]('[Fax][Message][NoUpdate1]',_0x14bb4d);})[_0xea99('0x54')](function(){delete _0x3f3317['channels'][_0x4bf6bf];delete _0x3f3317[_0xea99('0x13')][_0x4bf6bf];});}else{ut[_0xea99('0x4f')]('[Fax][Message][NoUpdate2]');delete this[_0xea99('0x10')][_0x4bf6bf];delete this['actions'][_0x4bf6bf];}};Fax['prototype'][_0xea99('0x1e')]=function(_0x45fa46){var _0x2a2bb6=this;if(this[_0xea99('0x10')][_0x45fa46['uniqueid']]){if(this[_0xea99('0x13')][_0x45fa46[_0xea99('0x27')]]){this['channels'][_0x45fa46[_0xea99('0x27')]]['id']=this['actions'][_0x45fa46[_0xea99('0x27')]]['id'];this[_0xea99('0x10')][_0x45fa46[_0xea99('0x27')]]['name']=this[_0xea99('0x13')][_0x45fa46['uniqueid']][_0xea99('0x29')];}logger[_0xea99('0x3b')](_0x45fa46[_0xea99('0x27')],this['actions'][_0x45fa46[_0xea99('0x27')]]?_0xea99('0x55'):_0xea99('0x56'),JSON[_0xea99('0x45')](this['channels'][_0x45fa46[_0xea99('0x27')]]));if(this[_0xea99('0x13')][_0x45fa46['uniqueid']]){if(this[_0xea99('0x10')][_0x45fa46[_0xea99('0x27')]]['faxpages']>0x0&&this[_0xea99('0x10')][_0x45fa46[_0xea99('0x27')]]['faxstatus']===_0xea99('0x57')){this['updateStatus'](_0x45fa46['uniqueid'],!![]);}else{this[_0xea99('0x52')](_0x45fa46[_0xea99('0x27')],![],this['channels'][_0x45fa46[_0xea99('0x27')]][_0xea99('0x58')]?_0xea99('0x59')+this[_0xea99('0x10')][_0x45fa46[_0xea99('0x27')]][_0xea99('0x58')]:_0xea99('0x5a'));}}}};Fax[_0xea99('0x2b')][_0xea99('0x5b')]=function(_0x3229e2){var _0xdd67fc=this;return new BPromise(function(_0x42a508,_0x40c4a8){_0xdd67fc[_0xea99('0x5c')](_0x3229e2,_0xdd67fc[_0xea99('0x11')][_0x3229e2[_0xea99('0x5d')]])[_0xea99('0x4d')](function(_0x1679e5){ut[_0xea99('0x4f')](_0xea99('0x5e'),_0x1679e5);_0x42a508(ut['message'](_0xea99('0x5f')));})['catch'](function(_0x38a23b){ut[_0xea99('0x4f')](_0xea99('0x60'),_0x38a23b);updateStatus(_0x3229e2);_0x40c4a8(ut[_0xea99('0x61')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x548e74){var _0xe180ba=this;return new BPromise(function(_0x218303,_0x631a80){var _0x28873e=_0xe180ba['checkTrunk'](_0xe180ba[_0xea99('0x11')][_0x548e74[_0xea99('0x5d')]][_0xea99('0x62')],_0x548e74);if(_0x28873e[_0xea99('0x63')]){_0x218303(ut[_0xea99('0x61')](_0xea99('0x64')));}else{_0x631a80(ut[_0xea99('0x61')](_0x28873e[_0xea99('0x61')]));}});};function originate(_0x5b623c,_0x5b7fe1,_0x3552e9){return new BPromise(function(_0x3e257c,_0x542727){if(_0x3552e9){var _0x2a913d=util[_0xea99('0x65')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xea99('0x3d')](_0x5b623c[_0xea99('0x5')])[_0xea99('0x29')],_0x5b623c[_0xea99('0x5')]);gs[_0xea99('0x66')](_0x2a913d)[_0xea99('0x4d')](function(){_0x5b623c[_0xea99('0x5')]=util[_0xea99('0x65')]('%s/%s.tif',path[_0xea99('0x3d')](_0x5b623c[_0xea99('0x5')])[_0xea99('0x67')],path[_0xea99('0x3d')](_0x5b623c[_0xea99('0x5')])[_0xea99('0x29')]);_0x5b7fe1[_0xea99('0x68')]=_0x5b623c['path'];ut[_0xea99('0x4f')]('Convert\x20pdf\x20to\x20tif','');ami[_0xea99('0x69')](ut[_0xea99('0x6a')](_0x5b623c,_0x5b7fe1))[_0xea99('0x4d')](function(_0x12b6d6){_0x3e257c(_0x12b6d6);})['catch'](function(_0x4ded73){_0x542727(_0x4ded73);});})[_0xea99('0x42')](function(_0xdfe208){_0x542727(_0xdfe208);});}else{ami[_0xea99('0x69')](ut[_0xea99('0x6a')](_0x5b623c,_0x5b7fe1))[_0xea99('0x4d')](function(_0x575b6f){_0x3e257c(_0x575b6f);})[_0xea99('0x42')](function(_0x1a9b63){_0x542727(_0x1a9b63);});}});}Fax['prototype'][_0xea99('0x5c')]=function(_0x4b0ef7,_0x2f6848){var _0x5df70e=this;return new BPromise(function(_0x20f090,_0x563c5f){var _0x5521e2=uuid['v4']();var _0x1d81c8=ut[_0xea99('0x6b')](_0x4b0ef7,_0x2f6848);_0x5df70e[_0xea99('0x13')][_0x5521e2]=new Action(_0x5521e2,_0x2f6848,_0x4b0ef7);var _0x3a7e04=_0x5df70e['actions'][_0x5521e2];if(path[_0xea99('0x3d')](_0x4b0ef7[_0xea99('0x5')])[_0xea99('0x6c')]===_0xea99('0x3e')){originate(_0x3a7e04,_0x1d81c8,!![])[_0xea99('0x4d')](function(_0x20a804){_0x20f090(_0x20a804);})['catch'](function(_0x535470){_0x563c5f(_0x535470);});}else{originate(_0x3a7e04,_0x1d81c8,![])[_0xea99('0x4d')](function(_0x1993f1){_0x20f090(_0x1993f1);})[_0xea99('0x42')](function(_0x258129){_0x563c5f(_0x258129);});}});};Fax[_0xea99('0x2b')]['isTrunkReachable']=function(_0x21895a){return!_[_0xea99('0x6d')](_0x21895a)&&!_['isNil'](_0x21895a[_0xea99('0x29')])&&!_['isNil'](_0x21895a[_0xea99('0x6e')])&&_0x21895a[_0xea99('0x6e')]&&!_[_0xea99('0x6d')](this['trunks'][util[_0xea99('0x65')](_0xea99('0x6f'),_0x21895a[_0xea99('0x29')])])&&!_[_0xea99('0x6d')](this[_0xea99('0x12')][util['format'](_0xea99('0x6f'),_0x21895a[_0xea99('0x29')])][_0xea99('0x33')])&&(this['trunks'][util[_0xea99('0x65')](_0xea99('0x6f'),_0x21895a['name'])][_0xea99('0x33')]===_0xea99('0x70')||this[_0xea99('0x12')][util['format'](_0xea99('0x6f'),_0x21895a['name'])][_0xea99('0x33')]==='unmonitored');};Fax[_0xea99('0x2b')]['checkTrunk']=function(_0x52ed80,_0x2f418c){if(!this['isTrunkReachable'](_0x52ed80)){ut[_0xea99('0x4f')](_0xea99('0x71'),_[_0xea99('0x6d')](_0x52ed80)?'':_0x52ed80[_0xea99('0x29')]+_0xea99('0x72'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x2f418c['fax'])){ut['logger'](_0xea99('0x73'),JSON[_0xea99('0x45')](_0x2f418c));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x2f418c[_0xea99('0x5')])){ut[_0xea99('0x4f')](_0xea99('0x74'),JSON[_0xea99('0x45')](_0x2f418c));return{'isValid':![],'message':_0xea99('0x75')};}return{'isValid':!![],'message':_0xea99('0x76')};};module[_0xea99('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d9bf0ad..3062917 100644 --- a/server/services/ami/fax/rpcDb.js +++ b/server/services/ami/fax/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43b0=['catch','[Notify]\x20','util','bluebird','../../../config/logger','error','inspect','notify','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43b0,0x92));var _0x043b=function(_0x17cbae,_0x242ac2){_0x17cbae=_0x17cbae-0x0;var _0x4d2a4e=_0x43b0[_0x17cbae];return _0x4d2a4e;};'use strict';var util=require(_0x043b('0x0'));var BPromise=require(_0x043b('0x1'));var logger=require(_0x043b('0x2'))('preview');var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x524633){return function(_0x51f6ed){logger[_0x043b('0x3')](_0x524633,util[_0x043b('0x4')](_0x51f6ed,{'showHidden':![],'depth':null}));};}exports[_0x043b('0x5')]=function(_0x1b5257,_0x5bdfb0){return BPromise['resolve']()[_0x043b('0x6')](faxAccount[_0x043b('0x5')](_0x1b5257,_0x5bdfb0))[_0x043b('0x7')](loggerCatch(_0x043b('0x8')));}; \ No newline at end of file +var _0xed2a=['util','bluebird','../../../config/logger','preview','error','inspect','notify','resolve','then','[Notify]\x20'];(function(_0x2c944e,_0x26f659){var _0x2cc529=function(_0x3fbc4b){while(--_0x3fbc4b){_0x2c944e['push'](_0x2c944e['shift']());}};_0x2cc529(++_0x26f659);}(_0xed2a,0x1e0));var _0xaed2=function(_0x3d6911,_0x45449d){_0x3d6911=_0x3d6911-0x0;var _0x46aed8=_0xed2a[_0x3d6911];return _0x46aed8;};'use strict';var util=require(_0xaed2('0x0'));var BPromise=require(_0xaed2('0x1'));var logger=require(_0xaed2('0x2'))(_0xaed2('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x1d9ec3){return function(_0x4f33ae){logger[_0xaed2('0x4')](_0x1d9ec3,util[_0xaed2('0x5')](_0x4f33ae,{'showHidden':![],'depth':null}));};}exports[_0xaed2('0x6')]=function(_0x3546da,_0x5d3d61){return BPromise[_0xaed2('0x7')]()[_0xaed2('0x8')](faxAccount['notify'](_0x3546da,_0x5d3d61))['catch'](loggerCatch(_0xaed2('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 2ab33c0..b37ad2d 100644 --- a/server/services/ami/fax/util/gs.js +++ b/server/services/ami/fax/util/gs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x538e=['Exec\x20gs','\x20Error\x20:','inspect','bluebird','child_process','exec'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x538e,0xe7));var _0xe538=function(_0x232fa3,_0xd41896){_0x232fa3=_0x232fa3-0x0;var _0x54a72d=_0x538e[_0x232fa3];return _0x54a72d;};'use strict';var util=require('util');var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xe538('0x0'));var exec=require(_0xe538('0x1'))[_0xe538('0x2')];exports['execute']=function(_0x4813ad){return new BPromise(function(_0x1c1ac0,_0x26501a){exec(_0x4813ad,function(_0xfe7cb6,_0x480872,_0x4ab887){logger['info'](_0xe538('0x3'),_0x480872);if(_0xfe7cb6){logger['info'](_0xe538('0x3'),_0xe538('0x4'),util[_0xe538('0x5')](_0xfe7cb6,{'showHidden':![],'depth':null}),_0x480872,_0x4ab887);_0x26501a(_0xfe7cb6);}_0x1c1ac0(_0x480872);});});}; \ No newline at end of file +var _0xab7a=['inspect','util','bluebird','child_process','execute','Exec\x20gs'];(function(_0x262c58,_0x1e78b8){var _0x22f896=function(_0x4e2176){while(--_0x4e2176){_0x262c58['push'](_0x262c58['shift']());}};_0x22f896(++_0x1e78b8);}(_0xab7a,0x67));var _0xaab7=function(_0x484209,_0x202d7d){_0x484209=_0x484209-0x0;var _0x5cc99f=_0xab7a[_0x484209];return _0x5cc99f;};'use strict';var util=require(_0xaab7('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xaab7('0x1'));var exec=require(_0xaab7('0x2'))['exec'];exports[_0xaab7('0x3')]=function(_0x114653){return new BPromise(function(_0x131c26,_0x3657e0){exec(_0x114653,function(_0xb8931d,_0x48147b,_0x21e4e6){logger['info'](_0xaab7('0x4'),_0x48147b);if(_0xb8931d){logger['info']('Exec\x20gs','\x20Error\x20:',util[_0xaab7('0x5')](_0xb8931d,{'showHidden':![],'depth':null}),_0x48147b,_0x21e4e6);_0x3657e0(_0xb8931d);}_0x131c26(_0x48147b);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index aaffcef..c79fb36 100644 --- a/server/services/ami/fax/util/util.js +++ b/server/services/ami/fax/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6d8=['path','variablesAction','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','uniqueid','util','moment','fax','info','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x277dff,_0x1bdc8d){var _0x3e584a=function(_0x5eb9a9){while(--_0x5eb9a9){_0x277dff['push'](_0x277dff['shift']());}};_0x3e584a(++_0x1bdc8d);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x58b6c7,_0x3bf35e){_0x58b6c7=_0x58b6c7-0x0;var _0x5f50d0=_0xc6d8[_0x58b6c7];return _0x5f50d0;};'use strict';var util=require(_0x8c6d('0x0'));var _=require('lodash');var moment=require(_0x8c6d('0x1'));var logger=require('../../../../config/logger')(_0x8c6d('0x2'));exports['message']=function(_0x292852){return{'message':_0x292852};};exports['logger']=function(_0x5b6b04,_0x352b8c){logger[_0x8c6d('0x3')](_0x5b6b04,util[_0x8c6d('0x4')](_0x352b8c,{'showHidden':![],'depth':null}));};exports[_0x8c6d('0x5')]=function(_0x3c265c,_0x2dbb52){var _0x98cae4={'XMF-ECM':_0x2dbb52['ecm'],'XMF-HEADERINFO':_0x2dbb52[_0x8c6d('0x6')],'XMF-MINRATE':_0x2dbb52[_0x8c6d('0x7')],'XMF-MAXRATE':_0x2dbb52[_0x8c6d('0x8')],'XMF-MODEM':util['format'](_0x8c6d('0x9'),_0x2dbb52[_0x8c6d('0xa')]),'XMF-GATEWAY':_0x2dbb52[_0x8c6d('0xb')],'XMF-FAXDETECT':_0x2dbb52[_0x8c6d('0xc')],'XMF-T38TIMEOUT':_0x2dbb52[_0x8c6d('0xd')],'XMF-LOCALSTATIONID':_0x2dbb52[_0x8c6d('0xe')],'XMF-PATH':_0x3c265c[_0x8c6d('0xf')]};return _0x98cae4;};exports[_0x8c6d('0x10')]=function(_0x50af75,_0x36d6fb){return{'actionid':_0x50af75['uniqueid'],'action':'originate','channel':_0x50af75[_0x8c6d('0x11')],'Exten':_0x8c6d('0x12'),'Context':_0x8c6d('0x13'),'Priority':'1','callerid':util[_0x8c6d('0x14')](_0x8c6d('0x15'),_0x50af75[_0x8c6d('0x6')]?_0x50af75[_0x8c6d('0x6')]:'',_0x50af75[_0x8c6d('0xe')]),'variable':_0x36d6fb,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x50af75[_0x8c6d('0x16')]};}; \ No newline at end of file +var _0xb903=['minrate','maxrate','localstationid','path','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','ecm','headerinfo'];(function(_0x39d1d3,_0x55a11f){var _0x54ce17=function(_0x595b32){while(--_0x595b32){_0x39d1d3['push'](_0x39d1d3['shift']());}};_0x54ce17(++_0x55a11f);}(_0xb903,0x185));var _0x3b90=function(_0x1232e3,_0x57f194){_0x1232e3=_0x1232e3-0x0;var _0x1b9a1d=_0xb903[_0x1232e3];return _0x1b9a1d;};'use strict';var util=require(_0x3b90('0x0'));var _=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var logger=require(_0x3b90('0x3'))('fax');exports[_0x3b90('0x4')]=function(_0xf414f4){return{'message':_0xf414f4};};exports[_0x3b90('0x5')]=function(_0x1cd5d8,_0x30d8db){logger[_0x3b90('0x6')](_0x1cd5d8,util[_0x3b90('0x7')](_0x30d8db,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x15b68f,_0x5e845a){var _0x55792c={'XMF-ECM':_0x5e845a[_0x3b90('0x8')],'XMF-HEADERINFO':_0x5e845a[_0x3b90('0x9')],'XMF-MINRATE':_0x5e845a[_0x3b90('0xa')],'XMF-MAXRATE':_0x5e845a[_0x3b90('0xb')],'XMF-MODEM':util['format']('\x22%s\x22',_0x5e845a['modem']),'XMF-GATEWAY':_0x5e845a['gateway'],'XMF-FAXDETECT':_0x5e845a['faxdetect'],'XMF-T38TIMEOUT':_0x5e845a['t38timeout'],'XMF-LOCALSTATIONID':_0x5e845a[_0x3b90('0xc')],'XMF-PATH':_0x15b68f[_0x3b90('0xd')]};return _0x55792c;};exports['variablesAction']=function(_0x30c49c,_0x233509){return{'actionid':_0x30c49c['uniqueid'],'action':_0x3b90('0xe'),'channel':_0x30c49c[_0x3b90('0xf')],'Exten':_0x3b90('0x10'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x3b90('0x11'),_0x30c49c['headerinfo']?_0x30c49c['headerinfo']:'',_0x30c49c[_0x3b90('0xc')]),'variable':_0x233509,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x30c49c[_0x3b90('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 1aa827b..448bc0a 100644 --- a/server/services/ami/index.js +++ b/server/services/ami/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbea0=['initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','log','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','getVoiceQueueHopperHistory'];(function(_0x46bef9,_0x25746a){var _0x514f30=function(_0xe95390){while(--_0xe95390){_0x46bef9['push'](_0x46bef9['shift']());}};_0x514f30(++_0x25746a);}(_0xbea0,0x1a6));var _0x0bea=function(_0x56a3bb,_0x1bffb9){_0x56a3bb=_0x56a3bb-0x0;var _0x3cf2b8=_0xbea0[_0x56a3bb];return _0x3cf2b8;};'use strict';var BPromise=require(_0x0bea('0x0'));var util=require(_0x0bea('0x1'));var moment=require(_0x0bea('0x2'));var server=require(_0x0bea('0x3'));var Realtime=require(_0x0bea('0x4'));var Report=require(_0x0bea('0x5'));var Acw=require('./acw');var Trigger=require(_0x0bea('0x6'));var Dialer=require(_0x0bea('0x7'));var Preview=require(_0x0bea('0x8'));var Fax=require(_0x0bea('0x9'));var user=require(_0x0bea('0xa'));var voiceQueue=require(_0x0bea('0xb'));var voiceQueueReport=require(_0x0bea('0xc'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x0bea('0xd'));var cmHopperHistory=require(_0x0bea('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x0bea('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x0bea('0x10'));var salesforce=require(_0x0bea('0x11'));var sugarcrm=require(_0x0bea('0x12'));var freshdesk=require(_0x0bea('0x13'));var desk=require(_0x0bea('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x0bea('0x15'));var freshsales=require(_0x0bea('0x16'));var servicenow=require(_0x0bea('0x17'));var dynamics365=require(_0x0bea('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x0bea('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0bea('0x1a')](_0x0bea('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x0bea('0x1b')](user[_0x0bea('0x1c')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x1d')]())[_0x0bea('0x1b')](user[_0x0bea('0x1e')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x1f')]())[_0x0bea('0x1b')](trunk[_0x0bea('0x20')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x21')]())['then'](voiceQueue[_0x0bea('0x22')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x23')]())['then'](trigger['getTriggers']())[_0x0bea('0x1b')](realtime[_0x0bea('0x24')]())[_0x0bea('0x1b')](template[_0x0bea('0x25')]())['then'](realtime[_0x0bea('0x26')]())[_0x0bea('0x1b')](zendesk[_0x0bea('0x27')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x28')]())[_0x0bea('0x1b')](salesforce[_0x0bea('0x29')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x2a')]())[_0x0bea('0x1b')](sugarcrm['getSugarcrmAccounts']())['then'](realtime['initSugarcrmAccounts']())[_0x0bea('0x1b')](freshdesk[_0x0bea('0x2b')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x2c')]())[_0x0bea('0x1b')](desk[_0x0bea('0x2d')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x2e')]())[_0x0bea('0x1b')](zoho['getZohoAccounts']())[_0x0bea('0x1b')](realtime['initZohoAccounts']())[_0x0bea('0x1b')](vtiger[_0x0bea('0x2f')]())[_0x0bea('0x1b')](realtime['initVtigerAccounts']())[_0x0bea('0x1b')](freshsales[_0x0bea('0x30')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x31')]())['then'](servicenow[_0x0bea('0x32')]())[_0x0bea('0x1b')](realtime['initServicenowAccounts']())['then'](dynamics365['getDynamics365Accounts']())[_0x0bea('0x1b')](realtime[_0x0bea('0x33')]())[_0x0bea('0x1b')](campaign[_0x0bea('0x34')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x35')]())[_0x0bea('0x1b')](voiceExtension[_0x0bea('0x36')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x37')]())['then'](faxAccount[_0x0bea('0x38')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x39')]())[_0x0bea('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x0bea('0x3a')]()[_0x0bea('0x1b')](voiceQueueReport[_0x0bea('0x3b')]())[_0x0bea('0x1b')](realtime['initVoiceQueueReports']())[_0x0bea('0x1b')](cmHopperHistory[_0x0bea('0x3c')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x3d')]())['then'](cmHopperHistory[_0x0bea('0x3e')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x3f')]())[_0x0bea('0x1b')](voiceCallReport[_0x0bea('0x40')]())[_0x0bea('0x1b')](realtime[_0x0bea('0x41')]())[_0x0bea('0x1b')](function(_0x13236b){})[_0x0bea('0x42')](function(_0x128839){console['log'](_0x128839);});}function main(){return server[_0x0bea('0x43')](realtime,preview,fax)['then'](function(_0xf61de4){return initRealtime();})[_0x0bea('0x1b')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x0bea('0x42')](function(_0x4d5caf){console[_0x0bea('0x44')](_0x4d5caf);});}main(); \ No newline at end of file +var _0x27fe=['initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','moment','./server','./realtime','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','resolve','then','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts'];(function(_0x14f0de,_0x49a73f){var _0x5686e6=function(_0xcb50c5){while(--_0xcb50c5){_0x14f0de['push'](_0x14f0de['shift']());}};_0x5686e6(++_0x49a73f);}(_0x27fe,0x1f3));var _0xe27f=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x27fe[_0x3899d1];return _0xeb4a7d;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0xe27f('0x0'));var server=require(_0xe27f('0x1'));var Realtime=require(_0xe27f('0x2'));var Report=require('./report');var Acw=require(_0xe27f('0x3'));var Trigger=require(_0xe27f('0x4'));var Dialer=require(_0xe27f('0x5'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0xe27f('0x6'));var voiceQueue=require(_0xe27f('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xe27f('0x8'));var trunk=require(_0xe27f('0x9'));var trigger=require(_0xe27f('0xa'));var template=require(_0xe27f('0xb'));var cmHopperHistory=require(_0xe27f('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xe27f('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe27f('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe27f('0xf'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xe27f('0x10'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xe27f('0x11'));var servicenow=require(_0xe27f('0x12'));var dynamics365=require(_0xe27f('0x13'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe27f('0x14')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe27f('0x14')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe27f('0x15')]()[_0xe27f('0x16')](user['getAgents']())[_0xe27f('0x16')](realtime['initAgents']())['then'](user['getTelephones']())[_0xe27f('0x16')](realtime[_0xe27f('0x17')]())[_0xe27f('0x16')](trunk[_0xe27f('0x18')]())[_0xe27f('0x16')](realtime[_0xe27f('0x19')]())[_0xe27f('0x16')](voiceQueue['getVoiceQueues']())[_0xe27f('0x16')](realtime[_0xe27f('0x1a')]())[_0xe27f('0x16')](trigger[_0xe27f('0x1b')]())[_0xe27f('0x16')](realtime['initTriggers']())[_0xe27f('0x16')](template[_0xe27f('0x1c')]())[_0xe27f('0x16')](realtime[_0xe27f('0x1d')]())[_0xe27f('0x16')](zendesk[_0xe27f('0x1e')]())[_0xe27f('0x16')](realtime[_0xe27f('0x1f')]())['then'](salesforce['getSalesforceAccounts']())[_0xe27f('0x16')](realtime[_0xe27f('0x20')]())[_0xe27f('0x16')](sugarcrm[_0xe27f('0x21')]())['then'](realtime['initSugarcrmAccounts']())[_0xe27f('0x16')](freshdesk[_0xe27f('0x22')]())[_0xe27f('0x16')](realtime[_0xe27f('0x23')]())[_0xe27f('0x16')](desk[_0xe27f('0x24')]())[_0xe27f('0x16')](realtime[_0xe27f('0x25')]())[_0xe27f('0x16')](zoho[_0xe27f('0x26')]())[_0xe27f('0x16')](realtime[_0xe27f('0x27')]())[_0xe27f('0x16')](vtiger[_0xe27f('0x28')]())[_0xe27f('0x16')](realtime[_0xe27f('0x29')]())[_0xe27f('0x16')](freshsales[_0xe27f('0x2a')]())[_0xe27f('0x16')](realtime[_0xe27f('0x2b')]())['then'](servicenow[_0xe27f('0x2c')]())[_0xe27f('0x16')](realtime[_0xe27f('0x2d')]())[_0xe27f('0x16')](dynamics365['getDynamics365Accounts']())[_0xe27f('0x16')](realtime[_0xe27f('0x2e')]())[_0xe27f('0x16')](campaign['getCampaigns']())[_0xe27f('0x16')](realtime[_0xe27f('0x2f')]())[_0xe27f('0x16')](voiceExtension['getVoiceExtensions']())[_0xe27f('0x16')](realtime['initVoiceExtensions']())[_0xe27f('0x16')](faxAccount[_0xe27f('0x30')]())[_0xe27f('0x16')](realtime['initFaxAccounts']())[_0xe27f('0x16')](function(){return realtime;});}function initParams(){return BPromise[_0xe27f('0x15')]()[_0xe27f('0x16')](voiceQueueReport[_0xe27f('0x31')]())[_0xe27f('0x16')](realtime[_0xe27f('0x32')]())['then'](cmHopperHistory[_0xe27f('0x33')]())[_0xe27f('0x16')](realtime[_0xe27f('0x34')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xe27f('0x16')](realtime[_0xe27f('0x35')]())[_0xe27f('0x16')](voiceCallReport[_0xe27f('0x36')]())[_0xe27f('0x16')](realtime[_0xe27f('0x37')]())['then'](function(_0x5d3e4f){})[_0xe27f('0x38')](function(_0xf63b82){console[_0xe27f('0x39')](_0xf63b82);});}function main(){return server[_0xe27f('0x3a')](realtime,preview,fax)[_0xe27f('0x16')](function(_0x508563){return initRealtime();})[_0xe27f('0x16')](function(){return initParams();})['then'](function(){report[_0xe27f('0x3b')]();setInterval(initRealtime,0x1388);})[_0xe27f('0x38')](function(_0x5746d5){console[_0xe27f('0x39')](_0x5746d5);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 22251b9..cec117c 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd54=['stringify','user:%s','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','accountcode','fullname','unknown','phone','mobile','online','voiceStatusTime','voiceStatusQueue','onhold','updateStatusRealtime','talking','voiceStatus','statePause','toNumber','format','email','stateTime','status','address','voiceStatusCallerIdNumber','interface'];(function(_0x329397,_0x102228){var _0x126bf9=function(_0x54215c){while(--_0x54215c){_0x329397['push'](_0x329397['shift']());}};_0x126bf9(++_0x102228);}(_0xfd54,0x1ef));var _0x4fd5=function(_0x56fcf6,_0x401b3c){_0x56fcf6=_0x56fcf6-0x0;var _0x2078a7=_0xfd54[_0x56fcf6];return _0x2078a7;};'use strict';var _=require(_0x4fd5('0x0'));var util=require('util');var moment=require(_0x4fd5('0x1'));var md5=require(_0x4fd5('0x2'));var Redis=require(_0x4fd5('0x3'));var config=require(_0x4fd5('0x4'));config[_0x4fd5('0x5')]=_[_0x4fd5('0x6')](config['redis'],{'host':_0x4fd5('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4fd5('0x5')]));function Agent(_0x330d8a){this['id']=_0x330d8a['id']||0x0;this[_0x4fd5('0x8')]=_0x330d8a[_0x4fd5('0x8')]||'';this['email']=_0x330d8a['email']||'';this[_0x4fd5('0x9')]=_0x330d8a['accountcode']||'';this['fullname']=_0x330d8a[_0x4fd5('0xa')]||'';this['state']=_0x4fd5('0xb');this['stateTime']=0x0;this['status']=_0x4fd5('0xb');this['address']='';this[_0x4fd5('0xc')]='';this[_0x4fd5('0xd')]='';this['interface']='';this['online']=_0x330d8a[_0x4fd5('0xe')]||![];this['voiceStatus']=_0x4fd5('0xb');this[_0x4fd5('0xf')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x4fd5('0x10')]='';this[_0x4fd5('0x11')]=![];this['local']=![];this[_0x4fd5('0x2')]='';}Agent['prototype'][_0x4fd5('0x12')]=function(_0x364a59){var _0xc7f5d6;if(_0x364a59&&_0x364a59['state']){_0xc7f5d6=_0x364a59['state']['toLowerCase']();switch(_0xc7f5d6){case'not_inuse':_0xc7f5d6='idle';break;case'inuse':_0xc7f5d6=_0x4fd5('0x13');break;}}if(_0xc7f5d6&&this[_0x4fd5('0x14')]!==_0xc7f5d6||_0x364a59[_0x4fd5('0x15')]){this['voiceStatusTime']=_[_0x4fd5('0x16')](moment()[_0x4fd5('0x17')]('x'));}if(_0xc7f5d6){this['voiceStatus']=_0xc7f5d6;}var _0x3d26a3={'id':this['id'],'name':this['name'],'email':this[_0x4fd5('0x18')],'accountcode':this[_0x4fd5('0x9')],'fullname':this[_0x4fd5('0xa')],'state':this['state'],'stateTime':this[_0x4fd5('0x19')],'status':this[_0x4fd5('0x1a')],'address':this[_0x4fd5('0x1b')],'online':this[_0x4fd5('0xe')],'voiceStatus':this[_0x4fd5('0x14')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x4fd5('0x1c')],'voiceStatusQueue':this[_0x4fd5('0x10')],'interface':this[_0x4fd5('0x1d')],'onhold':this[_0x4fd5('0x11')]};var _0xdb1514=md5(JSON[_0x4fd5('0x1e')](_0x3d26a3));if(this['md5']!==_0xdb1514){this[_0x4fd5('0x2')]=_0xdb1514;io['to'](util[_0x4fd5('0x17')](_0x4fd5('0x1f'),_0x3d26a3['name']))[_0x4fd5('0x20')](_0x4fd5('0x21'),_0x3d26a3);}};module[_0x4fd5('0x22')]=Agent; \ No newline at end of file +var _0xebf4=['voiceStatusQueue','local','prototype','not_inuse','inuse','talking','voiceStatus','voiceStatusTime','toNumber','format','stateTime','status','onhold','stringify','user:%s','emit','exports','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','phone','mobile','interface','online','voiceStatusCallerIdNumber'];(function(_0x58df23,_0x3e9eb9){var _0x2fcd18=function(_0x5f4e06){while(--_0x5f4e06){_0x58df23['push'](_0x58df23['shift']());}};_0x2fcd18(++_0x3e9eb9);}(_0xebf4,0x179));var _0x4ebf=function(_0x372259,_0x2f67a1){_0x372259=_0x372259-0x0;var _0x5442b0=_0xebf4[_0x372259];return _0x5442b0;};'use strict';var _=require('lodash');var util=require(_0x4ebf('0x0'));var moment=require(_0x4ebf('0x1'));var md5=require(_0x4ebf('0x2'));var Redis=require(_0x4ebf('0x3'));var config=require('../../../config/environment');config[_0x4ebf('0x4')]=_[_0x4ebf('0x5')](config[_0x4ebf('0x4')],{'host':_0x4ebf('0x6'),'port':0x18eb});var io=require(_0x4ebf('0x7'))(new Redis(config[_0x4ebf('0x4')]));function Agent(_0xc6b7e1){this['id']=_0xc6b7e1['id']||0x0;this['name']=_0xc6b7e1[_0x4ebf('0x8')]||'';this[_0x4ebf('0x9')]=_0xc6b7e1[_0x4ebf('0x9')]||'';this[_0x4ebf('0xa')]=_0xc6b7e1[_0x4ebf('0xa')]||'';this['fullname']=_0xc6b7e1[_0x4ebf('0xb')]||'';this[_0x4ebf('0xc')]=_0x4ebf('0xd');this['stateTime']=0x0;this['status']=_0x4ebf('0xd');this['address']='';this[_0x4ebf('0xe')]='';this[_0x4ebf('0xf')]='';this[_0x4ebf('0x10')]='';this[_0x4ebf('0x11')]=_0xc6b7e1[_0x4ebf('0x11')]||![];this['voiceStatus']=_0x4ebf('0xd');this['voiceStatusTime']=0x0;this[_0x4ebf('0x12')]='';this[_0x4ebf('0x13')]='';this['onhold']=![];this[_0x4ebf('0x14')]=![];this[_0x4ebf('0x2')]='';}Agent[_0x4ebf('0x15')]['updateStatusRealtime']=function(_0xf2e3d8){var _0x50a402;if(_0xf2e3d8&&_0xf2e3d8[_0x4ebf('0xc')]){_0x50a402=_0xf2e3d8[_0x4ebf('0xc')]['toLowerCase']();switch(_0x50a402){case _0x4ebf('0x16'):_0x50a402='idle';break;case _0x4ebf('0x17'):_0x50a402=_0x4ebf('0x18');break;}}if(_0x50a402&&this[_0x4ebf('0x19')]!==_0x50a402||_0xf2e3d8['statePause']){this[_0x4ebf('0x1a')]=_[_0x4ebf('0x1b')](moment()[_0x4ebf('0x1c')]('x'));}if(_0x50a402){this[_0x4ebf('0x19')]=_0x50a402;}var _0x3b496b={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x4ebf('0xa')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x4ebf('0x1d')],'status':this[_0x4ebf('0x1e')],'address':this['address'],'online':this[_0x4ebf('0x11')],'voiceStatus':this[_0x4ebf('0x19')],'voiceStatusTime':this[_0x4ebf('0x1a')],'voiceStatusCallerIdNumber':this[_0x4ebf('0x12')],'voiceStatusQueue':this[_0x4ebf('0x13')],'interface':this[_0x4ebf('0x10')],'onhold':this[_0x4ebf('0x1f')]};var _0x167f92=md5(JSON[_0x4ebf('0x20')](_0x3b496b));if(this['md5']!==_0x167f92){this[_0x4ebf('0x2')]=_0x167f92;io['to'](util[_0x4ebf('0x1c')](_0x4ebf('0x21'),_0x3b496b[_0x4ebf('0x8')]))[_0x4ebf('0x22')]('user:save',_0x3b496b);}};module[_0x4ebf('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ba5cd0f..ff5b736 100644 --- a/server/services/ami/model/campaign.js +++ b/server/services/ami/model/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb81c=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0xb81c,0x11f));var _0xcb81=function(_0x27827d,_0x532b61){_0x27827d=_0x27827d-0x0;var _0x11a545=_0xb81c[_0x27827d];return _0x11a545;};'use strict';function Campaign(_0x1ddd5e){this['id']=_0x1ddd5e['id']||0x0;this[_0xcb81('0x0')]=_0x1ddd5e[_0xcb81('0x0')]||'';this[_0xcb81('0x1')]=_0x1ddd5e[_0xcb81('0x1')]||'campaign';this[_0xcb81('0x2')]=0x0;this[_0xcb81('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xcb81('0x4')]=0x0;this[_0xcb81('0x5')]='';this[_0xcb81('0x6')]=!![];this[_0xcb81('0x7')]=_0x1ddd5e[_0xcb81('0x7')];this[_0xcb81('0x8')]=_0x1ddd5e[_0xcb81('0x8')];this[_0xcb81('0x9')]=_0x1ddd5e[_0xcb81('0x9')]||null;this['dialGlobalInterval']=_0x1ddd5e[_0xcb81('0xa')]?_0x1ddd5e[_0xcb81('0xa')]:null;this[_0xcb81('0xb')]=_0x1ddd5e[_0xcb81('0xb')];this[_0xcb81('0xc')]=_0x1ddd5e[_0xcb81('0xc')];this['dialOriginateTimeout']=_0x1ddd5e[_0xcb81('0xd')]||0x1e;this[_0xcb81('0xe')]=_0x1ddd5e[_0xcb81('0xe')];this['dialCongestionRetryFrequency']=_0x1ddd5e[_0xcb81('0xf')];this[_0xcb81('0x10')]=_0x1ddd5e[_0xcb81('0x10')];this[_0xcb81('0x11')]=_0x1ddd5e[_0xcb81('0x11')];this[_0xcb81('0x12')]=_0x1ddd5e['dialNoAnswerMaxRetry'];this[_0xcb81('0x13')]=_0x1ddd5e[_0xcb81('0x13')];this[_0xcb81('0x14')]=_0x1ddd5e['dialGlobalMaxRetry'];this[_0xcb81('0x15')]=_0x1ddd5e[_0xcb81('0x15')]||0x3;this[_0xcb81('0x16')]=_0x1ddd5e[_0xcb81('0x16')]||0x96;this[_0xcb81('0x17')]=_0x1ddd5e[_0xcb81('0x17')]||0x3;this[_0xcb81('0x18')]=_0x1ddd5e[_0xcb81('0x18')]||0x96;this[_0xcb81('0x19')]=_0x1ddd5e[_0xcb81('0x19')]||0x3;this[_0xcb81('0x1a')]=_0x1ddd5e['dialAbandonedRetryFrequency']||0x96;this[_0xcb81('0x1b')]=_0x1ddd5e['dialMachineMaxRetry']||0x3;this[_0xcb81('0x1c')]=_0x1ddd5e['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x1ddd5e[_0xcb81('0x1d')]||0x3;this[_0xcb81('0x1e')]=_0x1ddd5e['dialAgentRejectRetryFrequency']||0x96;this[_0xcb81('0x1f')]=_0x1ddd5e['dialOrderByScheduledAt']||_0xcb81('0x20');this[_0xcb81('0x21')]=_0x1ddd5e[_0xcb81('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1ddd5e[_0xcb81('0x22')]||undefined;this[_0xcb81('0x23')]=_0x1ddd5e['dialCutDigit']||undefined;this[_0xcb81('0x24')]=_0x1ddd5e[_0xcb81('0x24')]?_0x1ddd5e[_0xcb81('0x24')]:undefined;this[_0xcb81('0x25')]=_0x1ddd5e[_0xcb81('0x25')]?_0x1ddd5e[_0xcb81('0x25')]:undefined;this[_0xcb81('0x26')]=_0x1ddd5e[_0xcb81('0x26')]?_0x1ddd5e[_0xcb81('0x26')]:undefined;this['SquareProject']=_0x1ddd5e[_0xcb81('0x27')]?_0x1ddd5e[_0xcb81('0x27')]:undefined;this[_0xcb81('0x28')]=_0x1ddd5e[_0xcb81('0x27')]?_0x1ddd5e[_0xcb81('0x27')][_0xcb81('0x0')]:undefined;this[_0xcb81('0x29')]=_0x1ddd5e[_0xcb81('0x29')]||![];this[_0xcb81('0x2a')]=_0x1ddd5e['dialAMDInitialSilence'];this[_0xcb81('0x2b')]=_0x1ddd5e['dialAMDGreeting'];this[_0xcb81('0x2c')]=_0x1ddd5e[_0xcb81('0x2c')];this[_0xcb81('0x2d')]=_0x1ddd5e['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x1ddd5e['dialAMDMinWordLength'];this[_0xcb81('0x2e')]=_0x1ddd5e['dialAMDBetweenWordsSilence'];this[_0xcb81('0x2f')]=_0x1ddd5e[_0xcb81('0x2f')];this[_0xcb81('0x30')]=_0x1ddd5e['dialAMDSilenceThreshold'];this[_0xcb81('0x31')]=_0x1ddd5e[_0xcb81('0x31')];}module[_0xcb81('0x32')]=Campaign; \ No newline at end of file +var _0x1c30=['Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0x1c30,0x107));var _0x01c3=function(_0x2c9e61,_0x2d13f5){_0x2c9e61=_0x2c9e61-0x0;var _0x4d55d6=_0x1c30[_0x2c9e61];return _0x4d55d6;};'use strict';function Campaign(_0x184eb5){this['id']=_0x184eb5['id']||0x0;this[_0x01c3('0x0')]=_0x184eb5[_0x01c3('0x0')]||'';this[_0x01c3('0x1')]=_0x184eb5['type']||_0x01c3('0x2');this[_0x01c3('0x3')]=0x0;this[_0x01c3('0x4')]=0x0;this[_0x01c3('0x5')]=0x0;this[_0x01c3('0x6')]=0x0;this[_0x01c3('0x7')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x184eb5[_0x01c3('0x8')];this[_0x01c3('0x9')]=_0x184eb5[_0x01c3('0x9')];this[_0x01c3('0xa')]=_0x184eb5['dialTimezone']||null;this['dialGlobalInterval']=_0x184eb5[_0x01c3('0xb')]?_0x184eb5[_0x01c3('0xb')]:null;this[_0x01c3('0xc')]=_0x184eb5[_0x01c3('0xc')];this[_0x01c3('0xd')]=_0x184eb5['dialOriginateCallerIdNumber'];this[_0x01c3('0xe')]=_0x184eb5[_0x01c3('0xe')]||0x1e;this[_0x01c3('0xf')]=_0x184eb5['dialCongestionMaxRetry'];this[_0x01c3('0x10')]=_0x184eb5[_0x01c3('0x10')];this[_0x01c3('0x11')]=_0x184eb5['dialBusyMaxRetry'];this[_0x01c3('0x12')]=_0x184eb5[_0x01c3('0x12')];this['dialNoAnswerMaxRetry']=_0x184eb5[_0x01c3('0x13')];this[_0x01c3('0x14')]=_0x184eb5[_0x01c3('0x14')];this[_0x01c3('0x15')]=_0x184eb5['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x184eb5[_0x01c3('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x184eb5[_0x01c3('0x17')]||0x96;this[_0x01c3('0x18')]=_0x184eb5['dialDropMaxRetry']||0x3;this[_0x01c3('0x19')]=_0x184eb5[_0x01c3('0x19')]||0x96;this[_0x01c3('0x1a')]=_0x184eb5[_0x01c3('0x1a')]||0x3;this[_0x01c3('0x1b')]=_0x184eb5['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x184eb5['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x184eb5[_0x01c3('0x1c')]||0x96;this[_0x01c3('0x1d')]=_0x184eb5[_0x01c3('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x184eb5[_0x01c3('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x184eb5[_0x01c3('0x1f')]||'DESC';this[_0x01c3('0x20')]=_0x184eb5[_0x01c3('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x184eb5[_0x01c3('0x21')]||undefined;this[_0x01c3('0x22')]=_0x184eb5[_0x01c3('0x22')]||undefined;this[_0x01c3('0x23')]=_0x184eb5[_0x01c3('0x23')]?_0x184eb5[_0x01c3('0x23')]:undefined;this[_0x01c3('0x24')]=_0x184eb5[_0x01c3('0x24')]?_0x184eb5[_0x01c3('0x24')]:undefined;this[_0x01c3('0x25')]=_0x184eb5[_0x01c3('0x25')]?_0x184eb5['Interval']:undefined;this['SquareProject']=_0x184eb5[_0x01c3('0x26')]?_0x184eb5[_0x01c3('0x26')]:undefined;this[_0x01c3('0x27')]=_0x184eb5[_0x01c3('0x26')]?_0x184eb5[_0x01c3('0x26')][_0x01c3('0x0')]:undefined;this[_0x01c3('0x28')]=_0x184eb5[_0x01c3('0x28')]||![];this['dialAMDInitialSilence']=_0x184eb5[_0x01c3('0x29')];this[_0x01c3('0x2a')]=_0x184eb5[_0x01c3('0x2a')];this['dialAMDAfterGreetingSilence']=_0x184eb5['dialAMDAfterGreetingSilence'];this[_0x01c3('0x2b')]=_0x184eb5[_0x01c3('0x2b')];this['dialAMDMinWordLength']=_0x184eb5[_0x01c3('0x2c')];this[_0x01c3('0x2d')]=_0x184eb5[_0x01c3('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x184eb5[_0x01c3('0x2e')];this[_0x01c3('0x2f')]=_0x184eb5[_0x01c3('0x2f')];this[_0x01c3('0x30')]=_0x184eb5['dialAMDMaximumWordLength'];}module[_0x01c3('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 4d3ab1f..e1dd377 100644 --- a/server/services/ami/model/channel.js +++ b/server/services/ami/model/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3445=['mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','uniqueid','linkedid','exten','answered','lastapplication','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum'];(function(_0x4685f9,_0x5d2764){var _0x1cb296=function(_0x2a4a94){while(--_0x2a4a94){_0x4685f9['push'](_0x4685f9['shift']());}};_0x1cb296(++_0x5d2764);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this[_0x5344('0x0')]=null;this[_0x5344('0x1')]='';this[_0x5344('0x2')]='';this[_0x5344('0x3')]=0x0;this[_0x5344('0x4')]='';this[_0x5344('0x5')]=undefined;this[_0x5344('0x6')]=undefined;this['accountcode']=0x0;this['context']='';this[_0x5344('0x7')]=0x0;this[_0x5344('0x8')]=0x0;this[_0x5344('0x9')]=0x0;this[_0x5344('0xa')]=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this['abandoned']=![];this[_0x5344('0xb')]='';this['lastdata']='';this['duration']=0x0;this[_0x5344('0xc')]=0x0;this[_0x5344('0xd')]=0x0;this[_0x5344('0xe')]=null;this['tag']=null;this[_0x5344('0xf')]=null;this[_0x5344('0x10')]=![];this[_0x5344('0x11')]=null;this[_0x5344('0x12')]=null;this[_0x5344('0x13')]=[];this[_0x5344('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x5344('0x15')]=0x0;}module[_0x5344('0x16')]=Channel; \ No newline at end of file +var _0x7275=['tag','disposition','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','uniqueid','linkedid','endtime','abandoned','lastdata','billableseconds','holdtime'];(function(_0x184cfe,_0x1b1785){var _0x24b8e4=function(_0x5f2c3c){while(--_0x5f2c3c){_0x184cfe['push'](_0x184cfe['shift']());}};_0x24b8e4(++_0x1b1785);}(_0x7275,0x143));var _0x5727=function(_0x1568e3,_0x5f1e35){_0x1568e3=_0x1568e3-0x0;var _0x6ab428=_0x7275[_0x1568e3];return _0x6ab428;};'use strict';function Channel(){this[_0x5727('0x0')]=null;this[_0x5727('0x1')]='';this[_0x5727('0x2')]='';this['calleridnum']=0x0;this[_0x5727('0x3')]='';this['connectedlinenum']=undefined;this[_0x5727('0x4')]=undefined;this[_0x5727('0x5')]=0x0;this['context']='';this[_0x5727('0x6')]=0x0;this[_0x5727('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0x5727('0x8')]=null;this['unmanaged']=![];this[_0x5727('0x9')]=![];this['lastapplication']='';this[_0x5727('0xa')]='';this['duration']=0x0;this[_0x5727('0xb')]=0x0;this[_0x5727('0xc')]=0x0;this['type']=null;this[_0x5727('0xd')]=null;this[_0x5727('0xe')]=null;this['monitor']=![];this[_0x5727('0xf')]=null;this[_0x5727('0x10')]=null;this['monitors']=[];this[_0x5727('0x11')]=undefined;this[_0x5727('0x12')]=undefined;this[_0x5727('0x13')]=0x0;}module[_0x5727('0x14')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index af915c4..bce1878 100644 --- a/server/services/ami/model/deskAccount.js +++ b/server/services/ami/model/deskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f5a=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x255510,_0x7b7aef){var _0x3666b4=function(_0x46d851){while(--_0x46d851){_0x255510['push'](_0x255510['shift']());}};_0x3666b4(++_0x7b7aef);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x510be6,_0x14f636){_0x510be6=_0x510be6-0x0;var _0x3446bd=_0x9f5a[_0x510be6];return _0x3446bd;};'use strict';function DeskAccount(_0x41f045){this['id']=_0x41f045['id']||0x0;this[_0xa9f5('0x0')]=_0x41f045[_0xa9f5('0x0')]||'';this[_0xa9f5('0x1')]=_0x41f045['username']||'';this[_0xa9f5('0x2')]=_0x41f045[_0xa9f5('0x2')]||'';this[_0xa9f5('0x3')]=_0x41f045['authType']||'';this[_0xa9f5('0x4')]=_0x41f045['password']||'';this[_0xa9f5('0x5')]=_0x41f045[_0xa9f5('0x5')]||'';this['consumerSecret']=_0x41f045[_0xa9f5('0x6')]||'';this[_0xa9f5('0x7')]=_0x41f045[_0xa9f5('0x7')]||'';this[_0xa9f5('0x8')]=_0x41f045[_0xa9f5('0x8')]||'';this[_0xa9f5('0x9')]=_0x41f045[_0xa9f5('0x9')]||'';this['serverUrl']=_0x41f045[_0xa9f5('0xa')]||'';this[_0xa9f5('0xb')]=_0x41f045['Configurations']||{};}module[_0xa9f5('0xc')]=DeskAccount; \ No newline at end of file +var _0xfd6e=['serverUrl','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret','token','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd6e,0x16e));var _0xefd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd6e[_0x2641f9];return _0x585741;};'use strict';function DeskAccount(_0x501204){this['id']=_0x501204['id']||0x0;this['name']=_0x501204[_0xefd6('0x0')]||'';this['username']=_0x501204[_0xefd6('0x1')]||'';this[_0xefd6('0x2')]=_0x501204['remoteUri']||'';this['authType']=_0x501204['authType']||'';this[_0xefd6('0x3')]=_0x501204['password']||'';this['consumerKey']=_0x501204[_0xefd6('0x4')]||'';this[_0xefd6('0x5')]=_0x501204[_0xefd6('0x5')]||'';this[_0xefd6('0x6')]=_0x501204[_0xefd6('0x6')]||'';this['tokenSecret']=_0x501204['tokenSecret']||'';this[_0xefd6('0x7')]=_0x501204[_0xefd6('0x7')]||'';this[_0xefd6('0x8')]=_0x501204['serverUrl']||'';this[_0xefd6('0x9')]=_0x501204[_0xefd6('0x9')]||{};}module[_0xefd6('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d4223a7..90af6a4 100644 --- a/server/services/ami/model/dynamics365Account.js +++ b/server/services/ami/model/dynamics365Account.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7256=['tenantId','clientSecret','serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7256,0x84));var _0x6725=function(_0x2af5cf,_0x484065){_0x2af5cf=_0x2af5cf-0x0;var _0x38a31c=_0x7256[_0x2af5cf];return _0x38a31c;};'use strict';function Dynamics365Account(_0x49692f){this['id']=_0x49692f['id']||0x0;this[_0x6725('0x0')]=_0x49692f[_0x6725('0x0')]||'';this['username']=_0x49692f[_0x6725('0x1')]||'';this['password']=_0x49692f[_0x6725('0x2')]||'';this[_0x6725('0x3')]=_0x49692f[_0x6725('0x3')]||'';this[_0x6725('0x4')]=_0x49692f[_0x6725('0x4')]||'';this['clientId']=_0x49692f['clientId']||'';this[_0x6725('0x5')]=_0x49692f[_0x6725('0x5')]||{};this[_0x6725('0x6')]=_0x49692f[_0x6725('0x6')]||'';this[_0x6725('0x7')]=_0x49692f['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xa7ae=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x21552f,_0x4e7281){var _0x4f5c43=function(_0x11cd07){while(--_0x11cd07){_0x21552f['push'](_0x21552f['shift']());}};_0x4f5c43(++_0x4e7281);}(_0xa7ae,0x19d));var _0xea7a=function(_0xff5a26,_0xbc3d7f){_0xff5a26=_0xff5a26-0x0;var _0x22fb80=_0xa7ae[_0xff5a26];return _0x22fb80;};'use strict';function Dynamics365Account(_0x11cb50){this['id']=_0x11cb50['id']||0x0;this[_0xea7a('0x0')]=_0x11cb50['name']||'';this[_0xea7a('0x1')]=_0x11cb50['username']||'';this[_0xea7a('0x2')]=_0x11cb50[_0xea7a('0x2')]||'';this[_0xea7a('0x3')]=_0x11cb50[_0xea7a('0x3')]||'';this[_0xea7a('0x4')]=_0x11cb50[_0xea7a('0x4')]||'';this['clientId']=_0x11cb50[_0xea7a('0x5')]||'';this[_0xea7a('0x6')]=_0x11cb50['clientSecret']||{};this[_0xea7a('0x7')]=_0x11cb50[_0xea7a('0x7')]||'';this[_0xea7a('0x8')]=_0x11cb50['Configurations']||{};}module[_0xea7a('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 731bb2c..9b343ed 100644 --- a/server/services/ami/model/faxAccount.js +++ b/server/services/ami/model/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x366b=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0x334307,_0x59264a){var _0x157333=function(_0x373bbb){while(--_0x373bbb){_0x334307['push'](_0x334307['shift']());}};_0x157333(++_0x59264a);}(_0x366b,0x14f));var _0xb366=function(_0x1f05b5,_0x170c5f){_0x1f05b5=_0x1f05b5-0x0;var _0x5ce8a1=_0x366b[_0x1f05b5];return _0x5ce8a1;};'use strict';function FaxAccount(_0x14464c){this['id']=_0x14464c['id']||0x0;this[_0xb366('0x0')]=_0x14464c[_0xb366('0x0')]||'';this[_0xb366('0x1')]=_0x14464c['description'];this[_0xb366('0x2')]=_0x14464c['ecm'];this['headerinfo']=_0x14464c[_0xb366('0x3')];this[_0xb366('0x4')]=_0x14464c[_0xb366('0x4')];this[_0xb366('0x5')]=_0x14464c['minrate']||0x960;this[_0xb366('0x6')]=_0x14464c['maxrate']||0x3840;this[_0xb366('0x7')]=_0x14464c['modem']||'v17,v27,v29';this['gateway']=_0x14464c[_0xb366('0x8')]||'no';this[_0xb366('0x9')]=_0x14464c[_0xb366('0x9')]||'no';this[_0xb366('0xa')]=_0x14464c[_0xb366('0xa')]||0x1388;this[_0xb366('0xb')]=_0x14464c[_0xb366('0xb')]||_0xb366('0xc');this[_0xb366('0xd')]=_0x14464c[_0xb366('0xd')]?_0x14464c[_0xb366('0xd')]:undefined;this[_0xb366('0xe')]=_0x14464c[_0xb366('0xe')];this[_0xb366('0xf')]=_0x14464c[_0xb366('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x57db=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm'];(function(_0x27c74e,_0x44edc0){var _0x2957f0=function(_0x3c3ef5){while(--_0x3c3ef5){_0x27c74e['push'](_0x27c74e['shift']());}};_0x2957f0(++_0x44edc0);}(_0x57db,0xda));var _0xb57d=function(_0x67501f,_0x48a297){_0x67501f=_0x67501f-0x0;var _0x28d524=_0x57db[_0x67501f];return _0x28d524;};'use strict';function FaxAccount(_0x2eaa8f){this['id']=_0x2eaa8f['id']||0x0;this[_0xb57d('0x0')]=_0x2eaa8f['name']||'';this[_0xb57d('0x1')]=_0x2eaa8f['description'];this[_0xb57d('0x2')]=_0x2eaa8f[_0xb57d('0x2')];this[_0xb57d('0x3')]=_0x2eaa8f[_0xb57d('0x3')];this[_0xb57d('0x4')]=_0x2eaa8f['localstationid'];this[_0xb57d('0x5')]=_0x2eaa8f[_0xb57d('0x5')]||0x960;this['maxrate']=_0x2eaa8f[_0xb57d('0x6')]||0x3840;this[_0xb57d('0x7')]=_0x2eaa8f[_0xb57d('0x7')]||_0xb57d('0x8');this[_0xb57d('0x9')]=_0x2eaa8f[_0xb57d('0x9')]||'no';this['faxdetect']=_0x2eaa8f[_0xb57d('0xa')]||'no';this[_0xb57d('0xb')]=_0x2eaa8f[_0xb57d('0xb')]||0x1388;this[_0xb57d('0xc')]=_0x2eaa8f[_0xb57d('0xc')]||_0xb57d('0xd');this[_0xb57d('0xe')]=_0x2eaa8f[_0xb57d('0xe')]?_0x2eaa8f[_0xb57d('0xe')]:undefined;this[_0xb57d('0xf')]=_0x2eaa8f[_0xb57d('0xf')];this[_0xb57d('0x10')]=_0x2eaa8f[_0xb57d('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 3036e0b..163f786 100644 --- a/server/services/ami/model/freshdeskAccount.js +++ b/server/services/ami/model/freshdeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3d1=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xe3d1,0x116));var _0x1e3d=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xe3d1[_0x2601b4];return _0x3e3661;};'use strict';function FreshdeskAccount(_0x4ab00a){this['id']=_0x4ab00a['id']||0x0;this[_0x1e3d('0x0')]=_0x4ab00a[_0x1e3d('0x0')]||'';this[_0x1e3d('0x1')]=_0x4ab00a[_0x1e3d('0x1')]||'';this[_0x1e3d('0x2')]=_0x4ab00a[_0x1e3d('0x3')]||'';this[_0x1e3d('0x4')]=_0x4ab00a[_0x1e3d('0x4')]||'';this[_0x1e3d('0x5')]=_0x4ab00a['serverUrl']||'';this[_0x1e3d('0x6')]=_0x4ab00a[_0x1e3d('0x6')]||{};}module[_0x1e3d('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xa296=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x51398e,_0x4affb5){var _0x154376=function(_0x7dcc64){while(--_0x7dcc64){_0x51398e['push'](_0x51398e['shift']());}};_0x154376(++_0x4affb5);}(_0xa296,0x1e8));var _0x6a29=function(_0x1d13c8,_0x1554e6){_0x1d13c8=_0x1d13c8-0x0;var _0x3a3b03=_0xa296[_0x1d13c8];return _0x3a3b03;};'use strict';function FreshdeskAccount(_0x497b53){this['id']=_0x497b53['id']||0x0;this[_0x6a29('0x0')]=_0x497b53[_0x6a29('0x0')]||'';this['username']=_0x497b53[_0x6a29('0x1')]||'';this[_0x6a29('0x2')]=_0x497b53[_0x6a29('0x3')]||'';this[_0x6a29('0x4')]=_0x497b53['remoteUri']||'';this[_0x6a29('0x5')]=_0x497b53[_0x6a29('0x5')]||'';this['Configurations']=_0x497b53[_0x6a29('0x6')]||{};}module[_0x6a29('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 9b72966..2362122 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa415=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0xa415,0x185));var _0x5a41=function(_0x1d6b1f,_0xa3425d){_0x1d6b1f=_0x1d6b1f-0x0;var _0x301453=_0xa415[_0x1d6b1f];return _0x301453;};'use strict';function FreshsalesAccount(_0x1fd35a){this['id']=_0x1fd35a['id']||0x0;this[_0x5a41('0x0')]=_0x1fd35a[_0x5a41('0x0')]||'';this['username']=_0x1fd35a[_0x5a41('0x1')]||'';this[_0x5a41('0x2')]=_0x1fd35a[_0x5a41('0x3')]||'';this[_0x5a41('0x4')]=_0x1fd35a[_0x5a41('0x4')]||'';this[_0x5a41('0x5')]=_0x1fd35a[_0x5a41('0x5')]||'';this[_0x5a41('0x6')]=_0x1fd35a[_0x5a41('0x6')]||{};}module[_0x5a41('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x88b3=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x14460d,_0x690de0){var _0x497f91=function(_0x143a56){while(--_0x143a56){_0x14460d['push'](_0x14460d['shift']());}};_0x497f91(++_0x690de0);}(_0x88b3,0x101));var _0x388b=function(_0xb6bd60,_0x48e4a3){_0xb6bd60=_0xb6bd60-0x0;var _0x36d0dd=_0x88b3[_0xb6bd60];return _0x36d0dd;};'use strict';function FreshsalesAccount(_0x114863){this['id']=_0x114863['id']||0x0;this[_0x388b('0x0')]=_0x114863[_0x388b('0x0')]||'';this[_0x388b('0x1')]=_0x114863[_0x388b('0x1')]||'';this[_0x388b('0x2')]=_0x114863[_0x388b('0x3')]||'';this[_0x388b('0x4')]=_0x114863['remoteUri']||'';this[_0x388b('0x5')]=_0x114863[_0x388b('0x5')]||'';this[_0x388b('0x6')]=_0x114863[_0x388b('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 79598b8..f2aff9e 100644 --- a/server/services/ami/model/queueReport.js +++ b/server/services/ami/model/queueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8eed=['inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context','priority','lastAssignedTo','mohtime','variables','exports','type'];(function(_0x1a478e,_0x106c62){var _0x43b4dc=function(_0x530b11){while(--_0x530b11){_0x1a478e['push'](_0x1a478e['shift']());}};_0x43b4dc(++_0x106c62);}(_0x8eed,0x1af));var _0xd8ee=function(_0x2c20e3,_0x4013fc){_0x2c20e3=_0x2c20e3-0x0;var _0x38288c=_0x8eed[_0x2c20e3];return _0x38288c;};'use strict';function QueueReport(){this[_0xd8ee('0x0')]=_0xd8ee('0x1');this[_0xd8ee('0x2')]='';this[_0xd8ee('0x3')]='';this[_0xd8ee('0x4')]='';this[_0xd8ee('0x5')]='';this[_0xd8ee('0x6')]=null;this[_0xd8ee('0x7')]=null;this[_0xd8ee('0x8')]=0x1;this[_0xd8ee('0x9')]=0x1;this['queuecallerabandon']=![];this[_0xd8ee('0xa')]=null;this[_0xd8ee('0xb')]=![];this[_0xd8ee('0xc')]=null;this[_0xd8ee('0xd')]=![];this[_0xd8ee('0xe')]=null;this[_0xd8ee('0xf')]=0x1;this[_0xd8ee('0x10')]='';this[_0xd8ee('0x11')]='';this['connectedlinename']='';this['accountcode']='';this[_0xd8ee('0x12')]='';this['exten']='';this[_0xd8ee('0x13')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xd8ee('0x14')]='';this[_0xd8ee('0x15')]=0x0;this[_0xd8ee('0x16')]={};}module[_0xd8ee('0x17')]=QueueReport; \ No newline at end of file +var _0x9321=['queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','holdtime','lastAssignedTo','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x3bf02c,_0x48cd24){var _0x1af28d=function(_0x1732b7){while(--_0x1732b7){_0x3bf02c['push'](_0x3bf02c['shift']());}};_0x1af28d(++_0x48cd24);}(_0x9321,0xec));var _0x1932=function(_0x549d64,_0x506360){_0x549d64=_0x549d64-0x0;var _0x572bb1=_0x9321[_0x549d64];return _0x572bb1;};'use strict';function QueueReport(){this[_0x1932('0x0')]='inbound';this[_0x1932('0x1')]='';this[_0x1932('0x2')]='';this[_0x1932('0x3')]='';this[_0x1932('0x4')]='';this[_0x1932('0x5')]=null;this[_0x1932('0x6')]=null;this[_0x1932('0x7')]=0x1;this[_0x1932('0x8')]=0x1;this[_0x1932('0x9')]=![];this[_0x1932('0xa')]=null;this[_0x1932('0xb')]=![];this[_0x1932('0xc')]=null;this[_0x1932('0xd')]=![];this[_0x1932('0xe')]=null;this['originalposition']=0x1;this[_0x1932('0xf')]='';this[_0x1932('0x10')]='';this[_0x1932('0x11')]='';this['accountcode']='';this[_0x1932('0x12')]='';this[_0x1932('0x13')]='';this['priority']='';this[_0x1932('0x14')]=0x0;this['assigned']=![];this[_0x1932('0x15')]='';this[_0x1932('0x16')]=0x0;this[_0x1932('0x17')]={};}module[_0x1932('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1d9a302..98322c1 100644 --- a/server/services/ami/model/salesforceAccount.js +++ b/server/services/ami/model/salesforceAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8aae=['securityToken','type','serverUrl','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x415604,_0x2a030d){var _0x3e4ae9=function(_0x13a697){while(--_0x13a697){_0x415604['push'](_0x415604['shift']());}};_0x3e4ae9(++_0x2a030d);}(_0x8aae,0xd6));var _0xe8aa=function(_0x33e171,_0x3e1c5d){_0x33e171=_0x33e171-0x0;var _0x19def9=_0x8aae[_0x33e171];return _0x19def9;};'use strict';function SalesforceAccount(_0x47bc29){this['id']=_0x47bc29['id']||0x0;this[_0xe8aa('0x0')]=_0x47bc29[_0xe8aa('0x0')]||'';this[_0xe8aa('0x1')]=_0x47bc29[_0xe8aa('0x1')]||'';this[_0xe8aa('0x2')]=_0x47bc29[_0xe8aa('0x2')]||'';this[_0xe8aa('0x3')]=_0x47bc29[_0xe8aa('0x3')]||'';this[_0xe8aa('0x4')]=_0x47bc29['clientId']||'';this[_0xe8aa('0x5')]=_0x47bc29['clientSecret']||'';this[_0xe8aa('0x6')]=_0x47bc29['securityToken']||'';this[_0xe8aa('0x7')]=_0x47bc29[_0xe8aa('0x7')]||'integrationTab';this[_0xe8aa('0x8')]=_0x47bc29[_0xe8aa('0x8')]||'';this['Configurations']=_0x47bc29['Configurations']||{};}module[_0xe8aa('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x8f4f=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x4da93f,_0x51a0f9){var _0x2e6326=function(_0x37e0f5){while(--_0x37e0f5){_0x4da93f['push'](_0x4da93f['shift']());}};_0x2e6326(++_0x51a0f9);}(_0x8f4f,0x1f3));var _0xf8f4=function(_0x2718b3,_0x1c7521){_0x2718b3=_0x2718b3-0x0;var _0x50378d=_0x8f4f[_0x2718b3];return _0x50378d;};'use strict';function SalesforceAccount(_0x343752){this['id']=_0x343752['id']||0x0;this[_0xf8f4('0x0')]=_0x343752[_0xf8f4('0x0')]||'';this[_0xf8f4('0x1')]=_0x343752['username']||'';this[_0xf8f4('0x2')]=_0x343752[_0xf8f4('0x2')]||'';this['password']=_0x343752[_0xf8f4('0x3')]||'';this[_0xf8f4('0x4')]=_0x343752['clientId']||'';this[_0xf8f4('0x5')]=_0x343752[_0xf8f4('0x5')]||'';this['securityToken']=_0x343752[_0xf8f4('0x6')]||'';this[_0xf8f4('0x7')]=_0x343752['type']||_0xf8f4('0x8');this[_0xf8f4('0x9')]=_0x343752['serverUrl']||'';this[_0xf8f4('0xa')]=_0x343752[_0xf8f4('0xa')]||{};}module[_0xf8f4('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 5197b5b..f4af72d 100644 --- a/server/services/ami/model/servicenowAccount.js +++ b/server/services/ami/model/servicenowAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cb2=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x3cb2,0xf0));var _0x23cb=function(_0xdb50e1,_0x112a80){_0xdb50e1=_0xdb50e1-0x0;var _0x2a50fc=_0x3cb2[_0xdb50e1];return _0x2a50fc;};'use strict';function ServicenowAccount(_0x2e2a68){this['id']=_0x2e2a68['id']||0x0;this[_0x23cb('0x0')]=_0x2e2a68['name']||'';this[_0x23cb('0x1')]=_0x2e2a68[_0x23cb('0x1')]||'';this[_0x23cb('0x2')]=_0x2e2a68[_0x23cb('0x2')]||'';this[_0x23cb('0x3')]=_0x2e2a68['remoteUri']||'';this['serverUrl']=_0x2e2a68[_0x23cb('0x4')]||'';this[_0x23cb('0x5')]=_0x2e2a68['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x86bd=['name','password','serverUrl','Configurations'];(function(_0x1b5a53,_0x10a94){var _0x3d1475=function(_0x3033db){while(--_0x3033db){_0x1b5a53['push'](_0x1b5a53['shift']());}};_0x3d1475(++_0x10a94);}(_0x86bd,0x198));var _0xd86b=function(_0x41161b,_0x55d659){_0x41161b=_0x41161b-0x0;var _0xf5f3b4=_0x86bd[_0x41161b];return _0xf5f3b4;};'use strict';function ServicenowAccount(_0x7dc19f){this['id']=_0x7dc19f['id']||0x0;this[_0xd86b('0x0')]=_0x7dc19f[_0xd86b('0x0')]||'';this['username']=_0x7dc19f['username']||'';this[_0xd86b('0x1')]=_0x7dc19f[_0xd86b('0x1')]||'';this['remoteUri']=_0x7dc19f['remoteUri']||'';this[_0xd86b('0x2')]=_0x7dc19f[_0xd86b('0x2')]||'';this[_0xd86b('0x3')]=_0x7dc19f[_0xd86b('0x3')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 0072abe..fa6389c 100644 --- a/server/services/ami/model/sugarcrmAccount.js +++ b/server/services/ami/model/sugarcrmAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1c3=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1c3,0x15b));var _0x3d1c=function(_0x57e7bc,_0xfa09f1){_0x57e7bc=_0x57e7bc-0x0;var _0x5c327e=_0xd1c3[_0x57e7bc];return _0x5c327e;};'use strict';function SugarcrmAccount(_0x2c40bd){this['id']=_0x2c40bd['id']||0x0;this[_0x3d1c('0x0')]=_0x2c40bd['name']||'';this[_0x3d1c('0x1')]=_0x2c40bd['username']||'';this['password']=_0x2c40bd[_0x3d1c('0x2')]||'';this[_0x3d1c('0x3')]=_0x2c40bd[_0x3d1c('0x3')]||'';this[_0x3d1c('0x4')]=_0x2c40bd['serverUrl']||'';this[_0x3d1c('0x5')]=_0x2c40bd[_0x3d1c('0x5')]||{};}module[_0x3d1c('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x9564=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9564,0x1ad));var _0x4956=function(_0x8d9399,_0x490955){_0x8d9399=_0x8d9399-0x0;var _0x5a0645=_0x9564[_0x8d9399];return _0x5a0645;};'use strict';function SugarcrmAccount(_0x541ec4){this['id']=_0x541ec4['id']||0x0;this[_0x4956('0x0')]=_0x541ec4[_0x4956('0x0')]||'';this[_0x4956('0x1')]=_0x541ec4[_0x4956('0x1')]||'';this[_0x4956('0x2')]=_0x541ec4['password']||'';this[_0x4956('0x3')]=_0x541ec4[_0x4956('0x3')]||'';this[_0x4956('0x4')]=_0x541ec4['serverUrl']||'';this[_0x4956('0x5')]=_0x541ec4[_0x4956('0x5')]||{};}module[_0x4956('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index f89b0ff..644c391 100644 --- a/server/services/ami/model/telephone.js +++ b/server/services/ami/model/telephone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72a9=['name','accountcode','unknown','stateTime','status'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x72a9,0x69));var _0x972a=function(_0x384dda,_0x21f1c5){_0x384dda=_0x384dda-0x0;var _0x4e4b90=_0x72a9[_0x384dda];return _0x4e4b90;};'use strict';function Telephone(_0x39935a){this['id']=_0x39935a['id']||0x0;this[_0x972a('0x0')]=_0x39935a[_0x972a('0x0')]||'';this[_0x972a('0x1')]=_0x39935a[_0x972a('0x1')]||'';this['state']=_0x972a('0x2');this[_0x972a('0x3')]=0x0;this[_0x972a('0x4')]=_0x972a('0x2');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xa10e=['name','state','unknown','stateTime','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa10e,0xa0));var _0xea10=function(_0x46e9d5,_0xd919f6){_0x46e9d5=_0x46e9d5-0x0;var _0x39181f=_0xa10e[_0x46e9d5];return _0x39181f;};'use strict';function Telephone(_0x4a2535){this['id']=_0x4a2535['id']||0x0;this[_0xea10('0x0')]=_0x4a2535[_0xea10('0x0')]||'';this['accountcode']=_0x4a2535['accountcode']||'';this[_0xea10('0x1')]=_0xea10('0x2');this[_0xea10('0x3')]=0x0;this['status']=_0xea10('0x2');this['address']='';}module[_0xea10('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 04ad8bc..3c25281 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8a7=['html','exports','name'];(function(_0x4a4309,_0x26f8da){var _0xac7185=function(_0x92cff5){while(--_0x92cff5){_0x4a4309['push'](_0x4a4309['shift']());}};_0xac7185(++_0x26f8da);}(_0xd8a7,0x15e));var _0x7d8a=function(_0x1277f8,_0x72f74a){_0x1277f8=_0x1277f8-0x0;var _0x1ad3b9=_0xd8a7[_0x1277f8];return _0x1ad3b9;};'use strict';function template(_0x423191){this['id']=_0x423191['id']||0x0;this['name']=_0x423191[_0x7d8a('0x0')]||'';this[_0x7d8a('0x1')]=_0x423191[_0x7d8a('0x1')]||'';}module[_0x7d8a('0x2')]=template; \ No newline at end of file +var _0xf7c4=['html','exports','name'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf7c4,0xc2));var _0x4f7c=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xf7c4[_0x1caf6a];return _0x1bf493;};'use strict';function template(_0x359199){this['id']=_0x359199['id']||0x0;this[_0x4f7c('0x0')]=_0x359199[_0x4f7c('0x0')]||'';this['html']=_0x359199[_0x4f7c('0x1')]||'';}module[_0x4f7c('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 0c4b6eb..7bfad7d 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x56ecbf,_0x4527f7){var _0xaebbcc=function(_0x456b9c){while(--_0x456b9c){_0x56ecbf['push'](_0x56ecbf['shift']());}};_0xaebbcc(++_0x4527f7);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x68359d,_0x51477f){_0x68359d=_0x68359d-0x0;var _0x15d875=_0xf3cd[_0x68359d];return _0x15d875;};'use strict';function Trigger(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||_0xdf3c('0x2');this['status']=_0x13cb67[_0xdf3c('0x3')]||![];this[_0xdf3c('0x4')]=_0x13cb67[_0xdf3c('0x4')]||[];this['AnyConditions']=_0x13cb67[_0xdf3c('0x5')]||[];this[_0xdf3c('0x6')]=_0x13cb67[_0xdf3c('0x6')]||[];}module[_0xdf3c('0x7')]=Trigger; \ No newline at end of file +var _0xa41a=['AnyConditions','Actions','name','channel','voice','status','AllConditions'];(function(_0x3df34f,_0xa135f4){var _0x5144eb=function(_0x3f0b46){while(--_0x3f0b46){_0x3df34f['push'](_0x3df34f['shift']());}};_0x5144eb(++_0xa135f4);}(_0xa41a,0x6b));var _0xaa41=function(_0x5a7e1d,_0x4595db){_0x5a7e1d=_0x5a7e1d-0x0;var _0x2ddba6=_0xa41a[_0x5a7e1d];return _0x2ddba6;};'use strict';function Trigger(_0x33e667){this['id']=_0x33e667['id']||0x0;this[_0xaa41('0x0')]=_0x33e667['name']||'';this[_0xaa41('0x1')]=_0x33e667[_0xaa41('0x1')]||_0xaa41('0x2');this[_0xaa41('0x3')]=_0x33e667[_0xaa41('0x3')]||![];this[_0xaa41('0x4')]=_0x33e667[_0xaa41('0x4')]||[];this[_0xaa41('0x5')]=_0x33e667['AnyConditions']||[];this[_0xaa41('0x6')]=_0x33e667[_0xaa41('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 082f45d..bb8800a 100644 --- a/server/services/ami/model/trunk.js +++ b/server/services/ami/model/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd00d=['name','state','stateTime','status','unknown','registry','indexOf','split','port','domainport','refresh','stateRegistry','registrationtime','exports'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0xd00d,0x150));var _0xdd00=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0xd00d[_0x2fd69d];return _0x5d5ef3;};'use strict';function Trunk(_0xc65b8e){this['id']=_0xc65b8e['id']||0x0;this['active']=_0xc65b8e['active']||![];this[_0xdd00('0x0')]=_0xc65b8e['name']||'';this[_0xdd00('0x1')]='unknown';this[_0xdd00('0x2')]=0x0;this[_0xdd00('0x3')]=_0xdd00('0x4');this[_0xdd00('0x5')]=_0xc65b8e['registry']&&_0xc65b8e[_0xdd00('0x5')][_0xdd00('0x6')](':')?_0xc65b8e[_0xdd00('0x5')][_0xdd00('0x7')](':')[0x0]:'';this['host']='';this[_0xdd00('0x8')]='';this['domain']='';this[_0xdd00('0x9')]='';this[_0xdd00('0xa')]='';this[_0xdd00('0xb')]=_0xdd00('0x4');this[_0xdd00('0xc')]='';this['address']='';}module[_0xdd00('0xd')]=Trunk; \ No newline at end of file +var _0xfacc=['registrationtime','exports','active','name','state','unknown','stateTime','registry','indexOf','split','port','domain'];(function(_0x217631,_0x12dbbd){var _0x242bba=function(_0x50aeec){while(--_0x50aeec){_0x217631['push'](_0x217631['shift']());}};_0x242bba(++_0x12dbbd);}(_0xfacc,0x1be));var _0xcfac=function(_0x31d217,_0xa38636){_0x31d217=_0x31d217-0x0;var _0x3eaacb=_0xfacc[_0x31d217];return _0x3eaacb;};'use strict';function Trunk(_0x14f0ab){this['id']=_0x14f0ab['id']||0x0;this[_0xcfac('0x0')]=_0x14f0ab[_0xcfac('0x0')]||![];this[_0xcfac('0x1')]=_0x14f0ab[_0xcfac('0x1')]||'';this[_0xcfac('0x2')]=_0xcfac('0x3');this[_0xcfac('0x4')]=0x0;this['status']=_0xcfac('0x3');this[_0xcfac('0x5')]=_0x14f0ab['registry']&&_0x14f0ab[_0xcfac('0x5')][_0xcfac('0x6')](':')?_0x14f0ab['registry'][_0xcfac('0x7')](':')[0x0]:'';this['host']='';this[_0xcfac('0x8')]='';this[_0xcfac('0x9')]='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0xcfac('0x3');this[_0xcfac('0xa')]='';this['address']='';}module[_0xcfac('0xb')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 1315f11..b4ffdcb 100644 --- a/server/services/ami/model/voiceExtension.js +++ b/server/services/ami/model/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f80=['exten','none','mandatoryDisposition','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f80,0x138));var _0x07f8=function(_0x8952b5,_0x1bb20e){_0x8952b5=_0x8952b5-0x0;var _0x2a938b=_0x7f80[_0x8952b5];return _0x2a938b;};'use strict';function voiceExtension(_0x1a351f){this['id']=_0x1a351f['id']||0x0;this[_0x07f8('0x0')]=_0x1a351f['exten']||'';this['recordingFormat']=_0x1a351f['recordingFormat']||_0x07f8('0x1');this[_0x07f8('0x2')]=_0x1a351f[_0x07f8('0x2')]||![];}module[_0x07f8('0x3')]=voiceExtension; \ No newline at end of file +var _0xb4c0=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x56a591,_0x3982c0){var _0x3f029c=function(_0x1a49cc){while(--_0x1a49cc){_0x56a591['push'](_0x56a591['shift']());}};_0x3f029c(++_0x3982c0);}(_0xb4c0,0xa8));var _0x0b4c=function(_0x32c648,_0x12b359){_0x32c648=_0x32c648-0x0;var _0x55f4e6=_0xb4c0[_0x32c648];return _0x55f4e6;};'use strict';function voiceExtension(_0x46912f){this['id']=_0x46912f['id']||0x0;this[_0x0b4c('0x0')]=_0x46912f[_0x0b4c('0x0')]||'';this[_0x0b4c('0x1')]=_0x46912f[_0x0b4c('0x1')]||_0x0b4c('0x2');this['mandatoryDisposition']=_0x46912f[_0x0b4c('0x3')]||![];}module[_0x0b4c('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 2407058..cca8aef 100644 --- a/server/services/ami/model/voiceQueue.js +++ b/server/services/ami/model/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37a8=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','unavailable','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous'];(function(_0x2b88ba,_0x296c9e){var _0x400318=function(_0x43ecb0){while(--_0x43ecb0){_0x2b88ba['push'](_0x2b88ba['shift']());}};_0x400318(++_0x296c9e);}(_0x37a8,0x13f));var _0x837a=function(_0x5950e7,_0x43a5bb){_0x5950e7=_0x5950e7-0x0;var _0x47494d=_0x37a8[_0x5950e7];return _0x47494d;};'use strict';var statusDesc=['unknown',_0x837a('0x0'),_0x837a('0x1'),_0x837a('0x2'),'invalid',_0x837a('0x3'),'ringing','ringinuse','onhold'];var monitorFormat={'wav':_0x837a('0x4'),'wav49':_0x837a('0x5'),'gsm':_0x837a('0x6')};var strategy={'rrmemory':_0x837a('0x7'),'roundrobin':_0x837a('0x8')};function VoiceQueue(_0x1f64b8){this['id']=_0x1f64b8['id']||0x0;this['name']=_0x1f64b8[_0x837a('0x9')]||'';this[_0x837a('0xa')]=_0x1f64b8[_0x837a('0xa')]||'';this[_0x837a('0xb')]=_0x1f64b8[_0x837a('0xb')]||'inbound';this[_0x837a('0xc')]=0x0;this['talking']=0x0;this[_0x837a('0xd')]=0x0;this[_0x837a('0xe')]=0x0;this[_0x837a('0xf')]=0x0;this[_0x837a('0x10')]=0x0;this[_0x837a('0x11')]=0x0;this[_0x837a('0x12')]=0x0;this[_0x837a('0x13')]=0x0;this[_0x837a('0x14')]=0x0;this[_0x837a('0x15')]=0x0;this[_0x837a('0x16')]=_0x1f64b8[_0x837a('0x16')]||![];this[_0x837a('0x17')]=_0x1f64b8[_0x837a('0x17')]||0xa;this[_0x837a('0x18')]=_0x1f64b8[_0x837a('0x18')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this['originated']=0x0;this[_0x837a('0x19')]=0x0;this[_0x837a('0x1a')]=_0x1f64b8[_0x837a('0x1a')]||null;this[_0x837a('0x1b')]=_0x1f64b8[_0x837a('0x1b')]?_0x1f64b8['dialGlobalInterval']:null;this['dialActive']=_0x1f64b8['dialActive'];this[_0x837a('0x1c')]=_0x1f64b8[_0x837a('0x1c')]||_0x837a('0x1d');this[_0x837a('0x1e')]=_0x1f64b8[_0x837a('0x1e')]||0x0;this['dialLimitQueue']=_0x1f64b8[_0x837a('0x1f')]||0x0;this[_0x837a('0x20')]=_0x1f64b8[_0x837a('0x20')]||0x1;this[_0x837a('0x21')]=_0x1f64b8['dialPredictiveOptimization']||'dropRate';this[_0x837a('0x22')]=_0x1f64b8['dialPredictiveOptimizationPercentage']||0.03;this[_0x837a('0x23')]=_0x1f64b8['dialPredictiveInterval']||0x258;this[_0x837a('0x24')]=_0x1f64b8[_0x837a('0x24')]||_0x837a('0x25');this[_0x837a('0x26')]=_0x1f64b8[_0x837a('0x26')]||'anonymous';this[_0x837a('0x27')]=_0x1f64b8['dialOriginateTimeout']||0x1e;this[_0x837a('0x28')]=_0x1f64b8[_0x837a('0x28')]||_0x837a('0x29');this['dialQueueTimeout']=_0x1f64b8[_0x837a('0x2a')]||0x3;this[_0x837a('0x2b')]=_0x1f64b8[_0x837a('0x2b')]||undefined;this[_0x837a('0x2c')]=_0x1f64b8['dialCongestionMaxRetry']||0x3;this[_0x837a('0x2d')]=_0x1f64b8[_0x837a('0x2d')]||0x96;this[_0x837a('0x2e')]=_0x1f64b8[_0x837a('0x2e')]||0x3;this[_0x837a('0x2f')]=_0x1f64b8[_0x837a('0x2f')]||0x96;this[_0x837a('0x30')]=_0x1f64b8[_0x837a('0x30')]||0x3;this[_0x837a('0x31')]=_0x1f64b8[_0x837a('0x31')]||0x96;this[_0x837a('0x32')]=_0x1f64b8[_0x837a('0x32')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1f64b8['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x1f64b8['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x1f64b8['dialDropRetryFrequency']||0x96;this[_0x837a('0x33')]=_0x1f64b8['dialAbandonedMaxRetry']||0x3;this[_0x837a('0x34')]=_0x1f64b8['dialAbandonedRetryFrequency']||0x96;this[_0x837a('0x35')]=_0x1f64b8[_0x837a('0x35')]||0x3;this[_0x837a('0x36')]=_0x1f64b8['dialMachineRetryFrequency']||0x96;this[_0x837a('0x37')]=_0x1f64b8['dialAgentRejectMaxRetry']||0x3;this[_0x837a('0x38')]=_0x1f64b8[_0x837a('0x38')]||0x96;this[_0x837a('0x39')]=_0x1f64b8[_0x837a('0x39')]||0x4;this[_0x837a('0x3a')]=_0x1f64b8[_0x837a('0x3a')]?_0x1f64b8[_0x837a('0x3a')]:undefined;this[_0x837a('0x3b')]=_0x1f64b8[_0x837a('0x3b')]?_0x1f64b8[_0x837a('0x3b')]:undefined;this[_0x837a('0x3c')]=_0x1f64b8[_0x837a('0x3c')]||undefined;this[_0x837a('0x3d')]=_0x1f64b8[_0x837a('0x3d')]?_0x1f64b8[_0x837a('0x3d')]:undefined;this[_0x837a('0x3e')]=_0x1f64b8[_0x837a('0x3e')]||_0x837a('0x3f');this['dialRandomLastDigitCallerIdNumber']=_0x1f64b8[_0x837a('0x40')]||undefined;this[_0x837a('0x41')]=_0x1f64b8['dialCutDigit']||undefined;this[_0x837a('0x42')]=strategy[_0x1f64b8[_0x837a('0x42')]]||_0x837a('0x7');this[_0x837a('0x43')]=!![];this[_0x837a('0x44')]=_0x1f64b8[_0x837a('0x44')]||![];this[_0x837a('0x45')]=_0x1f64b8[_0x837a('0x45')];this[_0x837a('0x46')]=_0x1f64b8[_0x837a('0x46')];this['dialAMDAfterGreetingSilence']=_0x1f64b8[_0x837a('0x47')];this[_0x837a('0x48')]=_0x1f64b8[_0x837a('0x48')];this[_0x837a('0x49')]=_0x1f64b8[_0x837a('0x49')];this[_0x837a('0x4a')]=_0x1f64b8[_0x837a('0x4a')];this['dialAMDMaximumNumberOfWords']=_0x1f64b8[_0x837a('0x4b')];this[_0x837a('0x4c')]=_0x1f64b8[_0x837a('0x4c')];this[_0x837a('0x4d')]=_0x1f64b8[_0x837a('0x4d')];this[_0x837a('0x4e')]=0x0;this[_0x837a('0x4f')]=0x0;this[_0x837a('0x50')]=_0x1f64b8['timeout'];this[_0x837a('0x51')]=0x0;this[_0x837a('0x52')]=0x0;this[_0x837a('0x53')]=0x0;this[_0x837a('0x54')]=0x0;this[_0x837a('0x55')]=0x0;this[_0x837a('0x56')]=0x0;this[_0x837a('0x57')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x837a('0x58')]=0x0;this[_0x837a('0x59')]=0x0;this[_0x837a('0x5a')]=0x0;this[_0x837a('0x5b')]=0x0;this[_0x837a('0x5c')]=0x0;this[_0x837a('0x5d')]=0x0;this[_0x837a('0x5e')]=undefined;this['startPredictive']=undefined;this[_0x837a('0x5f')]=undefined;this[_0x837a('0x60')]=1.05;this[_0x837a('0x61')]=0x0;this[_0x837a('0x62')]=0x0;this[_0x837a('0x63')]=0x0;this[_0x837a('0x64')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x837a('0x65')]=0x0;this[_0x837a('0x66')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x837a('0x67')]=_0x1f64b8[_0x837a('0x68')]||0x14;this[_0x837a('0x69')]=_0x1f64b8[_0x837a('0x68')]||0xa;this[_0x837a('0x6a')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x837a('0x6b')]=0x1;this[_0x837a('0x6c')]=0x0;this[_0x837a('0x6d')]=0x0;this[_0x837a('0x6e')]=0x0;this['erlangBusyFactor']=0x0;this[_0x837a('0x6f')]=_0x1f64b8['dialRecallMeTimeout']||0x1e;this[_0x837a('0x70')]=_0x1f64b8['dialRecallInQueue']||![];this[_0x837a('0x71')]=_0x1f64b8[_0x837a('0x71')]||undefined;this[_0x837a('0x72')]=_0x1f64b8[_0x837a('0x72')]||![];this[_0x837a('0x73')]=_0x1f64b8[_0x837a('0x73')]||![];this[_0x837a('0xa')]=monitorFormat[_0x1f64b8[_0x837a('0xa')]]?monitorFormat[_0x1f64b8['monitor_format']]:undefined;this[_0x837a('0x74')]=_0x1f64b8[_0x837a('0x74')]||![];this[_0x837a('0x75')]=_0x1f64b8[_0x837a('0x75')]?_0x1f64b8[_0x837a('0x75')]:undefined;}module[_0x837a('0x76')]=VoiceQueue; \ No newline at end of file +var _0x4c48=['dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient'];(function(_0x5d128a,_0x364c5d){var _0x15d9e5=function(_0x276df8){while(--_0x276df8){_0x5d128a['push'](_0x5d128a['shift']());}};_0x15d9e5(++_0x364c5d);}(_0x4c48,0x15d));var _0x84c4=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x4c48[_0x25662e];return _0x59b7bc;};'use strict';var statusDesc=[_0x84c4('0x0'),_0x84c4('0x1'),'inuse','busy',_0x84c4('0x2'),_0x84c4('0x3'),_0x84c4('0x4'),_0x84c4('0x5'),'onhold'];var monitorFormat={'wav':_0x84c4('0x6'),'wav49':_0x84c4('0x7'),'gsm':_0x84c4('0x8')};var strategy={'rrmemory':_0x84c4('0x9'),'roundrobin':_0x84c4('0xa')};function VoiceQueue(_0x3a153d){this['id']=_0x3a153d['id']||0x0;this[_0x84c4('0xb')]=_0x3a153d['name']||'';this[_0x84c4('0xc')]=_0x3a153d[_0x84c4('0xc')]||'';this[_0x84c4('0xd')]=_0x3a153d[_0x84c4('0xd')]||'inbound';this[_0x84c4('0xe')]=0x0;this['talking']=0x0;this[_0x84c4('0xf')]=0x0;this[_0x84c4('0x10')]=0x0;this['sumDuration']=0x0;this[_0x84c4('0x11')]=0x0;this[_0x84c4('0x12')]=0x0;this[_0x84c4('0x13')]=0x0;this[_0x84c4('0x14')]=0x0;this[_0x84c4('0x15')]=0x0;this['available']=0x0;this['acw']=_0x3a153d[_0x84c4('0x16')]||![];this[_0x84c4('0x17')]=_0x3a153d['acwTimeout']||0xa;this['autopause']=_0x3a153d['autopause']||'no';this[_0x84c4('0x18')]=!![];this[_0x84c4('0x19')]='';this[_0x84c4('0x1a')]=0x0;this[_0x84c4('0x1b')]=0x0;this[_0x84c4('0x1c')]=_0x3a153d[_0x84c4('0x1c')]||null;this[_0x84c4('0x1d')]=_0x3a153d[_0x84c4('0x1d')]?_0x3a153d[_0x84c4('0x1d')]:null;this[_0x84c4('0x1e')]=_0x3a153d['dialActive'];this[_0x84c4('0x1f')]=_0x3a153d['dialMethod']||_0x84c4('0x20');this[_0x84c4('0x21')]=_0x3a153d[_0x84c4('0x21')]||0x0;this[_0x84c4('0x22')]=_0x3a153d[_0x84c4('0x22')]||0x0;this[_0x84c4('0x23')]=_0x3a153d[_0x84c4('0x23')]||0x1;this[_0x84c4('0x24')]=_0x3a153d['dialPredictiveOptimization']||_0x84c4('0x25');this[_0x84c4('0x26')]=_0x3a153d[_0x84c4('0x26')]||0.03;this[_0x84c4('0x27')]=_0x3a153d[_0x84c4('0x27')]||0x258;this[_0x84c4('0x28')]=_0x3a153d['dialOriginateCallerIdName']||_0x84c4('0x29');this['dialOriginateCallerIdNumber']=_0x3a153d[_0x84c4('0x2a')]||'anonymous';this['dialOriginateTimeout']=_0x3a153d[_0x84c4('0x2b')]||0x1e;this['dialQueueOptions']=_0x3a153d['dialQueueOptions']||'tTxX';this[_0x84c4('0x2c')]=_0x3a153d['dialQueueTimeout']||0x3;this[_0x84c4('0x2d')]=_0x3a153d[_0x84c4('0x2d')]||undefined;this[_0x84c4('0x2e')]=_0x3a153d[_0x84c4('0x2e')]||0x3;this[_0x84c4('0x2f')]=_0x3a153d[_0x84c4('0x2f')]||0x96;this[_0x84c4('0x30')]=_0x3a153d['dialBusyMaxRetry']||0x3;this[_0x84c4('0x31')]=_0x3a153d[_0x84c4('0x31')]||0x96;this[_0x84c4('0x32')]=_0x3a153d['dialNoAnswerMaxRetry']||0x3;this[_0x84c4('0x33')]=_0x3a153d['dialNoAnswerRetryFrequency']||0x96;this[_0x84c4('0x34')]=_0x3a153d[_0x84c4('0x34')]||0x3;this[_0x84c4('0x35')]=_0x3a153d[_0x84c4('0x35')]||0x96;this[_0x84c4('0x36')]=_0x3a153d[_0x84c4('0x36')]||0x3;this['dialDropRetryFrequency']=_0x3a153d['dialDropRetryFrequency']||0x96;this[_0x84c4('0x37')]=_0x3a153d[_0x84c4('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0x3a153d[_0x84c4('0x38')]||0x96;this[_0x84c4('0x39')]=_0x3a153d[_0x84c4('0x39')]||0x3;this[_0x84c4('0x3a')]=_0x3a153d[_0x84c4('0x3a')]||0x96;this[_0x84c4('0x3b')]=_0x3a153d[_0x84c4('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3a153d[_0x84c4('0x3c')]||0x96;this[_0x84c4('0x3d')]=_0x3a153d[_0x84c4('0x3d')]||0x4;this[_0x84c4('0x3e')]=_0x3a153d[_0x84c4('0x3e')]?_0x3a153d[_0x84c4('0x3e')]:undefined;this[_0x84c4('0x3f')]=_0x3a153d['TrunkBackup']?_0x3a153d[_0x84c4('0x3f')]:undefined;this[_0x84c4('0x40')]=_0x3a153d['dialPrefix']||undefined;this[_0x84c4('0x41')]=_0x3a153d['Interval']?_0x3a153d[_0x84c4('0x41')]:undefined;this['dialOrderByScheduledAt']=_0x3a153d[_0x84c4('0x42')]||_0x84c4('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x3a153d[_0x84c4('0x44')]||undefined;this['dialCutDigit']=_0x3a153d[_0x84c4('0x45')]||undefined;this['strategy']=strategy[_0x3a153d['strategy']]||'rrmemory';this[_0x84c4('0x46')]=!![];this[_0x84c4('0x47')]=_0x3a153d[_0x84c4('0x47')]||![];this[_0x84c4('0x48')]=_0x3a153d[_0x84c4('0x48')];this[_0x84c4('0x49')]=_0x3a153d[_0x84c4('0x49')];this[_0x84c4('0x4a')]=_0x3a153d[_0x84c4('0x4a')];this[_0x84c4('0x4b')]=_0x3a153d[_0x84c4('0x4b')];this[_0x84c4('0x4c')]=_0x3a153d[_0x84c4('0x4c')];this[_0x84c4('0x4d')]=_0x3a153d[_0x84c4('0x4d')];this[_0x84c4('0x4e')]=_0x3a153d[_0x84c4('0x4e')];this[_0x84c4('0x4f')]=_0x3a153d['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x3a153d[_0x84c4('0x50')];this[_0x84c4('0x51')]=0x0;this['pTalking']=0x0;this[_0x84c4('0x52')]=_0x3a153d[_0x84c4('0x52')];this[_0x84c4('0x53')]=0x0;this[_0x84c4('0x54')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x84c4('0x55')]=0x0;this[_0x84c4('0x56')]=0x0;this[_0x84c4('0x57')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x84c4('0x58')]=0x0;this[_0x84c4('0x59')]=0x0;this[_0x84c4('0x5a')]=0x0;this[_0x84c4('0x5b')]=undefined;this['startPredictive']=undefined;this[_0x84c4('0x5c')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x84c4('0x5d')]=0x0;this[_0x84c4('0x5e')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x84c4('0x5f')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x84c4('0x60')]=0x0;this[_0x84c4('0x61')]=0x0;this[_0x84c4('0x62')]=0x0;this[_0x84c4('0x63')]=_0x3a153d[_0x84c4('0x64')]||0x14;this[_0x84c4('0x65')]=_0x3a153d[_0x84c4('0x64')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x84c4('0x66')]=0x0;this[_0x84c4('0x67')]=0x1;this[_0x84c4('0x68')]=0x0;this[_0x84c4('0x69')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x84c4('0x6a')]=0x0;this['dialRecallMeTimeout']=_0x3a153d[_0x84c4('0x6b')]||0x1e;this['dialRecallInQueue']=_0x3a153d[_0x84c4('0x6c')]||![];this[_0x84c4('0x6d')]=_0x3a153d[_0x84c4('0x6d')]||undefined;this[_0x84c4('0x6e')]=_0x3a153d[_0x84c4('0x6e')]||![];this[_0x84c4('0x6f')]=_0x3a153d[_0x84c4('0x6f')]||![];this[_0x84c4('0xc')]=monitorFormat[_0x3a153d['monitor_format']]?monitorFormat[_0x3a153d[_0x84c4('0xc')]]:undefined;this[_0x84c4('0x70')]=_0x3a153d[_0x84c4('0x70')]||![];this[_0x84c4('0x71')]=_0x3a153d['mandatoryDispositionPause']?_0x3a153d[_0x84c4('0x71')]:undefined;}module[_0x84c4('0x72')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a155272..dda4e28 100644 --- a/server/services/ami/model/vtigerAccount.js +++ b/server/services/ami/model/vtigerAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x694c=['remoteUri','Configurations','exports','name','username','accessKey'];(function(_0x15b213,_0x4d360e){var _0x1a42c4=function(_0x4f9ef0){while(--_0x4f9ef0){_0x15b213['push'](_0x15b213['shift']());}};_0x1a42c4(++_0x4d360e);}(_0x694c,0x171));var _0xc694=function(_0x1e4500,_0x276da6){_0x1e4500=_0x1e4500-0x0;var _0xd6d61d=_0x694c[_0x1e4500];return _0xd6d61d;};'use strict';function VtigerAccount(_0x5bae04){this['id']=_0x5bae04['id']||0x0;this['name']=_0x5bae04[_0xc694('0x0')]||'';this[_0xc694('0x1')]=_0x5bae04['username']||'';this['accessKey']=_0x5bae04[_0xc694('0x2')]||'';this[_0xc694('0x3')]=_0x5bae04[_0xc694('0x3')]||'';this['serverUrl']=_0x5bae04['serverUrl']||'';this[_0xc694('0x4')]=_0x5bae04['Configurations']||{};}module[_0xc694('0x5')]=VtigerAccount; \ No newline at end of file +var _0x25f8=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x471730,_0x39555d){var _0x3a4834=function(_0xad6c6d){while(--_0xad6c6d){_0x471730['push'](_0x471730['shift']());}};_0x3a4834(++_0x39555d);}(_0x25f8,0xdd));var _0x825f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x25f8[_0x27af45];return _0x18df21;};'use strict';function VtigerAccount(_0x4a5c5c){this['id']=_0x4a5c5c['id']||0x0;this[_0x825f('0x0')]=_0x4a5c5c[_0x825f('0x0')]||'';this[_0x825f('0x1')]=_0x4a5c5c[_0x825f('0x1')]||'';this[_0x825f('0x2')]=_0x4a5c5c['accessKey']||'';this[_0x825f('0x3')]=_0x4a5c5c['remoteUri']||'';this[_0x825f('0x4')]=_0x4a5c5c[_0x825f('0x4')]||'';this[_0x825f('0x5')]=_0x4a5c5c[_0x825f('0x5')]||{};}module[_0x825f('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 087731e..79fcb34 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x353211,_0x2dffa5){var _0x48a365=function(_0x165744){while(--_0x165744){_0x353211['push'](_0x353211['shift']());}};_0x48a365(++_0x2dffa5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x4e700e,_0x4ae3ac){_0x4e700e=_0x4e700e-0x0;var _0xb9a1c2=_0xadb5[_0x4e700e];return _0xb9a1c2;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 5736693..1952f16 100644 --- a/server/services/ami/model/zohoAccount.js +++ b/server/services/ami/model/zohoAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf6e=['clientId','clientSecret','code','refreshToken','Configurations','exports','description','host','zone'];(function(_0x6bdc24,_0x27d241){var _0x138f23=function(_0x1fcf1c){while(--_0x1fcf1c){_0x6bdc24['push'](_0x6bdc24['shift']());}};_0x138f23(++_0x27d241);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x13447f,_0x3d731d){_0x13447f=_0x13447f-0x0;var _0x4f6ed9=_0xaf6e[_0x13447f];return _0x4f6ed9;};'use strict';function ZohoAccount(_0x1232ff){this['id']=_0x1232ff['id']||0x0;this['name']=_0x1232ff['name']||'';this[_0xeaf6('0x0')]=_0x1232ff[_0xeaf6('0x0')]||'';this[_0xeaf6('0x1')]=_0x1232ff[_0xeaf6('0x1')]||'';this['zone']=_0x1232ff[_0xeaf6('0x2')]||'';this[_0xeaf6('0x3')]=_0x1232ff[_0xeaf6('0x3')]||'';this[_0xeaf6('0x4')]=_0x1232ff[_0xeaf6('0x4')]||'';this['serverUrl']=_0x1232ff['serverUrl']||'';this['code']=_0x1232ff[_0xeaf6('0x5')]||'';this['refreshToken']=_0x1232ff[_0xeaf6('0x6')]||'';this['Configurations']=_0x1232ff[_0xeaf6('0x7')]||{};}module[_0xeaf6('0x8')]=ZohoAccount; \ No newline at end of file +var _0xcf2f=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x3c24a6,_0x33313a){var _0x2e90ae=function(_0x23322e){while(--_0x23322e){_0x3c24a6['push'](_0x3c24a6['shift']());}};_0x2e90ae(++_0x33313a);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x1397f8,_0x4b6acc){_0x1397f8=_0x1397f8-0x0;var _0x112f22=_0xcf2f[_0x1397f8];return _0x112f22;};'use strict';function ZohoAccount(_0xc60f9d){this['id']=_0xc60f9d['id']||0x0;this[_0xfcf2('0x0')]=_0xc60f9d[_0xfcf2('0x0')]||'';this[_0xfcf2('0x1')]=_0xc60f9d[_0xfcf2('0x1')]||'';this['host']=_0xc60f9d[_0xfcf2('0x2')]||'';this[_0xfcf2('0x3')]=_0xc60f9d[_0xfcf2('0x3')]||'';this[_0xfcf2('0x4')]=_0xc60f9d[_0xfcf2('0x4')]||'';this[_0xfcf2('0x5')]=_0xc60f9d[_0xfcf2('0x5')]||'';this[_0xfcf2('0x6')]=_0xc60f9d[_0xfcf2('0x6')]||'';this[_0xfcf2('0x7')]=_0xc60f9d[_0xfcf2('0x7')]||'';this[_0xfcf2('0x8')]=_0xc60f9d[_0xfcf2('0x8')]||'';this[_0xfcf2('0x9')]=_0xc60f9d['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index adb8e65..ed0bc61 100644 --- a/server/services/ami/preview/action.js +++ b/server/services/ami/preview/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4602=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','isNil','string','uniqueid','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry'];(function(_0x16178c,_0x263478){var _0x322ddd=function(_0x5ed120){while(--_0x5ed120){_0x16178c['push'](_0x16178c['shift']());}};_0x322ddd(++_0x263478);}(_0x4602,0x1d2));var _0x2460=function(_0x49a4b9,_0x415504){_0x49a4b9=_0x49a4b9-0x0;var _0x264052=_0x4602[_0x49a4b9];return _0x264052;};'use strict';var util=require(_0x2460('0x0'));var _=require(_0x2460('0x1'));var moment=require(_0x2460('0x2'));function checkNameSurname(_0x3444b5,_0x38491b,_0x2ae54b){var _0x3df9f6='';if(!_[_0x2460('0x3')](_0x38491b)&&_0x2460('0x4')===typeof _0x38491b){_0x3df9f6+=_0x38491b;}if(!_[_0x2460('0x3')](_0x2ae54b)&&_0x2460('0x4')===typeof _0x2ae54b){_0x3df9f6+='\x20'+_0x2ae54b;}if(_0x3df9f6!==''){return _0x3df9f6;}return _0x3444b5;}function Action(_0x470a1b,_0x3ae98d,_0x4888d7,_0x57b754,_0x2ef07c){this[_0x2460('0x5')]=_0x4888d7||undefined;this['idContact']=_0x470a1b['id'];this['queue']=_0x3ae98d[_0x2460('0x6')];this[_0x2460('0x7')]=_0x3ae98d['type'];this['campaigntype']='queue';this[_0x2460('0x8')]=![];this[_0x2460('0x9')]=_[_0x2460('0x3')](_0x470a1b[_0x2460('0xa')])?undefined:_0x470a1b[_0x2460('0xa')][_0x2460('0x6')];this[_0x2460('0xb')]=this[_0x2460('0x9')]?util[_0x2460('0xc')](_0x2460('0xd'),this[_0x2460('0x9')]):_0x57b754||undefined;this[_0x2460('0xe')]=checkNameSurname(_0x470a1b[_0x2460('0xf')][_0x2460('0x10')],_0x470a1b['Contact'][_0x2460('0x11')],_0x470a1b[_0x2460('0xf')][_0x2460('0x12')]);this[_0x2460('0x13')]=_0x470a1b[_0x2460('0x13')]||![];this[_0x2460('0x14')]=_0x470a1b[_0x2460('0xf')]['phone'];this[_0x2460('0x15')]=_0x470a1b[_0x2460('0x15')];this[_0x2460('0x16')]=_0x470a1b[_0x2460('0x16')]||0x0;this[_0x2460('0x17')]=_0x470a1b[_0x2460('0x17')]||0x0;this[_0x2460('0x18')]=_0x470a1b[_0x2460('0x18')]||0x0;this['countglobal']=(_0x470a1b[_0x2460('0x16')]||0x0)+(_0x470a1b[_0x2460('0x17')]||0x0)+(_0x470a1b['countnoanswerretry']||0x0)+(_0x470a1b['countnosuchnumberretry']||0x0)+(_0x470a1b[_0x2460('0x19')]||0x0)+(_0x470a1b[_0x2460('0x1a')]||0x0)+(_0x470a1b[_0x2460('0x1b')]||0x0)+(_0x470a1b[_0x2460('0x1c')]||0x0);this['countnosuchnumberretry']=_0x470a1b[_0x2460('0x1d')]||0x0;this[_0x2460('0x19')]=_0x470a1b[_0x2460('0x19')]||0x0;this['countabandonedretry']=_0x470a1b[_0x2460('0x1a')]||0x0;this[_0x2460('0x1b')]=_0x470a1b[_0x2460('0x1b')]||0x0;this[_0x2460('0x1c')]=_0x470a1b[_0x2460('0x1c')]||0x0;this['callback']=_0x470a1b[_0x2460('0x1e')];this[_0x2460('0x1f')]=_0x470a1b[_0x2460('0x1f')];this[_0x2460('0x20')]=_0x470a1b[_0x2460('0x20')];this[_0x2460('0x21')]=_0x470a1b[_0x2460('0x21')];this['ContactId']=_0x470a1b[_0x2460('0x22')];this[_0x2460('0x23')]=_0x470a1b[_0x2460('0x23')];this[_0x2460('0x24')]=_[_0x2460('0x3')](_0x470a1b[_0x2460('0xa')])?_0x470a1b[_0x2460('0x24')]:_0x470a1b[_0x2460('0xa')]['id'];this['VoiceQueueId']=_0x470a1b[_0x2460('0x25')];this[_0x2460('0x26')]='';this[_0x2460('0x27')]='';}Action['prototype']['getCaller']=function(){return util[_0x2460('0xc')]('\x22%s\x22\x20<%s>',this[_0x2460('0xe')],this['number']);};module[_0x2460('0x28')]=Action; \ No newline at end of file +var _0x1300=['number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','callback','callbackuniqueid','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>'];(function(_0x2b1237,_0xc671da){var _0x4c61d8=function(_0x36bfa5){while(--_0x36bfa5){_0x2b1237['push'](_0x2b1237['shift']());}};_0x4c61d8(++_0xc671da);}(_0x1300,0x86));var _0x0130=function(_0x3e743d,_0x28947f){_0x3e743d=_0x3e743d-0x0;var _0x4a327c=_0x1300[_0x3e743d];return _0x4a327c;};'use strict';var util=require(_0x0130('0x0'));var _=require(_0x0130('0x1'));var moment=require(_0x0130('0x2'));function checkNameSurname(_0x42c4d9,_0x54170a,_0x2456dd){var _0x119f42='';if(!_['isNil'](_0x54170a)&&'string'===typeof _0x54170a){_0x119f42+=_0x54170a;}if(!_[_0x0130('0x3')](_0x2456dd)&&_0x0130('0x4')===typeof _0x2456dd){_0x119f42+='\x20'+_0x2456dd;}if(_0x119f42!==''){return _0x119f42;}return _0x42c4d9;}function Action(_0x33ea92,_0x3afb31,_0x53076a,_0x203add,_0x109a36){this[_0x0130('0x5')]=_0x53076a||undefined;this[_0x0130('0x6')]=_0x33ea92['id'];this['queue']=_0x3afb31[_0x0130('0x7')];this[_0x0130('0x8')]=_0x3afb31[_0x0130('0x8')];this[_0x0130('0x9')]=_0x0130('0xa');this[_0x0130('0xb')]=![];this[_0x0130('0xc')]=_[_0x0130('0x3')](_0x33ea92[_0x0130('0xd')])?undefined:_0x33ea92[_0x0130('0xd')][_0x0130('0x7')];this[_0x0130('0xe')]=this[_0x0130('0xc')]?util[_0x0130('0xf')]('SIP/%s',this[_0x0130('0xc')]):_0x203add||undefined;this['calleridname']=checkNameSurname(_0x33ea92[_0x0130('0x10')][_0x0130('0x11')],_0x33ea92[_0x0130('0x10')][_0x0130('0x12')],_0x33ea92[_0x0130('0x10')][_0x0130('0x13')]);this[_0x0130('0x14')]=_0x33ea92[_0x0130('0x14')]||![];this['calleridnum']=_0x33ea92[_0x0130('0x10')][_0x0130('0x11')];this['scheduledat']=_0x33ea92[_0x0130('0x15')];this['countbusyretry']=_0x33ea92[_0x0130('0x16')]||0x0;this[_0x0130('0x17')]=_0x33ea92[_0x0130('0x17')]||0x0;this['countnoanswerretry']=_0x33ea92[_0x0130('0x18')]||0x0;this[_0x0130('0x19')]=(_0x33ea92[_0x0130('0x16')]||0x0)+(_0x33ea92[_0x0130('0x17')]||0x0)+(_0x33ea92[_0x0130('0x18')]||0x0)+(_0x33ea92['countnosuchnumberretry']||0x0)+(_0x33ea92['countdropretry']||0x0)+(_0x33ea92[_0x0130('0x1a')]||0x0)+(_0x33ea92['countmachineretry']||0x0)+(_0x33ea92[_0x0130('0x1b')]||0x0);this[_0x0130('0x1c')]=_0x33ea92[_0x0130('0x1c')]||0x0;this['countdropretry']=_0x33ea92[_0x0130('0x1d')]||0x0;this[_0x0130('0x1a')]=_0x33ea92[_0x0130('0x1a')]||0x0;this['countmachineretry']=_0x33ea92[_0x0130('0x1e')]||0x0;this[_0x0130('0x1b')]=_0x33ea92[_0x0130('0x1b')]||0x0;this[_0x0130('0x1f')]=_0x33ea92[_0x0130('0x1f')];this[_0x0130('0x20')]=_0x33ea92['callbackuniqueid'];this['callbackat']=_0x33ea92['callbackat'];this[_0x0130('0x21')]=_0x33ea92[_0x0130('0x21')];this['ContactId']=_0x33ea92['ContactId'];this[_0x0130('0x22')]=_0x33ea92[_0x0130('0x22')];this[_0x0130('0x23')]=_[_0x0130('0x3')](_0x33ea92[_0x0130('0xd')])?_0x33ea92[_0x0130('0x23')]:_0x33ea92[_0x0130('0xd')]['id'];this[_0x0130('0x24')]=_0x33ea92[_0x0130('0x24')];this[_0x0130('0x25')]='';this[_0x0130('0x26')]='';}Action[_0x0130('0x27')][_0x0130('0x28')]=function(){return util[_0x0130('0xf')](_0x0130('0x29'),this['calleridname'],this[_0x0130('0x2a')]);};module[_0x0130('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 079c6b6..f3da1a6 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','BUSY','outboundBusyCallsDay','countglobal','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','starttime','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','responsetime','isFailure','response','idContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','dialstatus','variables','filterKey','keys','addVariable','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','bind','hanguprequest','syncDialEnd','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','pTalking','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','name','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','originated','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','logger2','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','[syncHangup][talking][increment]'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xe706,0xa3));var _0x6e70=function(_0x554a48,_0x3b0b29){_0x554a48=_0x554a48-0x0;var _0x4cd1dc=_0xe706[_0x554a48];return _0x4cd1dc;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var uuid=require('uuid');var moment=require(_0x6e70('0x3'));var md5=require(_0x6e70('0x4'));var Redis=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var loggerAction=require(_0x6e70('0x7'))(_0x6e70('0x9'));var ami=require(_0x6e70('0xa'));var rpcDb=require(_0x6e70('0xb'));var Action=require(_0x6e70('0xc'));var ut=require(_0x6e70('0xd'));config[_0x6e70('0xe')]=_[_0x6e70('0xf')](config[_0x6e70('0xe')],{'host':_0x6e70('0x10'),'port':0x18eb});var io=require(_0x6e70('0x11'))(new Redis(config[_0x6e70('0xe')]));var Sequence=function(){};Sequence[_0x6e70('0x12')][_0x6e70('0x13')]=function(_0x743eb5){this[_0x6e70('0x14')]=this[_0x6e70('0x14')]?this[_0x6e70('0x14')]['finally'](_0x743eb5):_0x743eb5();};function Preview(_0x47f6b2){this[_0x6e70('0x15')]=new Sequence();this[_0x6e70('0x16')]=_0x47f6b2[_0x6e70('0x17')];this[_0x6e70('0x18')]=_0x47f6b2[_0x6e70('0x18')];this[_0x6e70('0x19')]={};this[_0x6e70('0x1a')]=_0x47f6b2[_0x6e70('0x1a')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x6e70('0x1b')](this));ami['on']('hangup',this['syncHangup'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1c'),this['syncHangupRequest'][_0x6e70('0x1b')](this));ami['on']('dialend',this[_0x6e70('0x1d')][_0x6e70('0x1b')](this));ami['on']('newexten',this['syncNewExten'][_0x6e70('0x1b')](this));ami['on']('varset',this[_0x6e70('0x1e')][_0x6e70('0x1b')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1f'),this[_0x6e70('0x20')][_0x6e70('0x1b')](this));this[_0x6e70('0x21')](this[_0x6e70('0x16')]);}function emit(_0x1b2453,_0x44a49f,_0x29326f){io['to'](_0x1b2453)[_0x6e70('0x22')](_0x44a49f,_0x29326f);}function emitCampaignPreview(_0x4a0cfe){if(_0x4a0cfe[_0x6e70('0x23')]===_0x6e70('0x24')){var _0x27b294={'id':_0x4a0cfe['id'],'name':_0x4a0cfe['name'],'strategy':_0x4a0cfe[_0x6e70('0x25')],'answered':_0x4a0cfe[_0x6e70('0x26')],'available':_0x4a0cfe[_0x6e70('0x27')],'loggedIn':_0x4a0cfe['loggedIn'],'pTalking':_0x4a0cfe[_0x6e70('0x28')],'sumBillable':_0x4a0cfe['sumBillable'],'sumDuration':_0x4a0cfe['sumDuration'],'sumHoldTime':_0x4a0cfe['sumHoldTime']||0x0,'talking':_0x4a0cfe[_0x6e70('0x29')],'total':_0x4a0cfe[_0x6e70('0x2a')],'type':_0x4a0cfe['type'],'unmanaged':_0x4a0cfe[_0x6e70('0x2b')],'abandoned':_0x4a0cfe[_0x6e70('0x2c')],'waiting':_0x4a0cfe['waiting'],'loggedInDb':_0x4a0cfe[_0x6e70('0x2d')],'dialActive':_0x4a0cfe[_0x6e70('0x2e')],'dialMethod':_0x4a0cfe[_0x6e70('0x2f')],'dialOriginateCallerIdName':_0x4a0cfe['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4a0cfe['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4a0cfe[_0x6e70('0x30')],'dialPrefix':_0x4a0cfe[_0x6e70('0x31')],'outboundAnswerAgiCallsDay':_0x4a0cfe[_0x6e70('0x32')],'outboundAnswerCallsDay':_0x4a0cfe[_0x6e70('0x33')],'outboundBlacklistCallsDay':_0x4a0cfe[_0x6e70('0x34')],'outboundBusyCallsDay':_0x4a0cfe['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4a0cfe[_0x6e70('0x35')],'outboundDropCallsDayACS':_0x4a0cfe[_0x6e70('0x36')],'outboundDropCallsDayCallersExit':_0x4a0cfe[_0x6e70('0x37')],'outboundDropCallsDayTimeout':_0x4a0cfe[_0x6e70('0x38')],'outboundNoAnswerCallsDay':_0x4a0cfe[_0x6e70('0x39')],'outboundNoSuchCallsDay':_0x4a0cfe[_0x6e70('0x3a')],'outboundOriginateFailureCallsDay':_0x4a0cfe[_0x6e70('0x3b')],'outboundReCallsDay':_0x4a0cfe[_0x6e70('0x3c')],'outboundRejectCallsDay':_0x4a0cfe[_0x6e70('0x3d')],'outboundUnknownCallsDay':_0x4a0cfe[_0x6e70('0x3e')],'outboundAbandonedCallsDay':_0x4a0cfe['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4a0cfe[_0x6e70('0x3f')],'predictiveIntervalAvgHoldtime':_0x4a0cfe['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4a0cfe[_0x6e70('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x4a0cfe['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4a0cfe[_0x6e70('0x41')],'predictiveIntervalErlangCalls':_0x4a0cfe[_0x6e70('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x4a0cfe[_0x6e70('0x43')],'predictiveIntervalHitRate':_0x4a0cfe['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4a0cfe[_0x6e70('0x44')],'predictiveIntervalPauses':_0x4a0cfe[_0x6e70('0x45')],'predictiveIntervalAvailable':_0x4a0cfe['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4a0cfe[_0x6e70('0x46')],'message':_0x4a0cfe[_0x6e70('0x47')],'originated':_0x4a0cfe['originated'],'erlangCalls':_0x4a0cfe[_0x6e70('0x48')],'erlangCallToSecond':_0x4a0cfe[_0x6e70('0x49')],'erlangAbandonmentRate':_0x4a0cfe[_0x6e70('0x4a')],'erlangBusyFactor':_0x4a0cfe[_0x6e70('0x4b')],'startPredictive':_0x4a0cfe[_0x6e70('0x4c')],'startProgressive':_0x4a0cfe[_0x6e70('0x4d')]};if(_0x4a0cfe[_0x6e70('0x4e')]){_0x27b294[_0x6e70('0x4e')]={'id':_0x4a0cfe[_0x6e70('0x4e')]['id'],'name':_0x4a0cfe[_0x6e70('0x4e')]['name'],'active':_0x4a0cfe[_0x6e70('0x4e')]['active'],'callerid':_0x4a0cfe[_0x6e70('0x4e')][_0x6e70('0x4f')]};}if(_0x4a0cfe[_0x6e70('0x50')]){_0x27b294[_0x6e70('0x50')]={'id':_0x4a0cfe[_0x6e70('0x50')]['id'],'name':_0x4a0cfe[_0x6e70('0x50')][_0x6e70('0x51')]};}var _0xdd0bee=md5(JSON[_0x6e70('0x52')](_0x27b294));if(_0x4a0cfe[_0x6e70('0x4')]!==_0xdd0bee){_0x4a0cfe[_0x6e70('0x4')]=_0xdd0bee;emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x27b294['name']),'voice_queue:save',_0x27b294);}}}function emitVoiceQueueChannelRemove(_0x5424eb){logger[_0x6e70('0x55')](_0x6e70('0x56'),JSON[_0x6e70('0x52')](_0x5424eb));emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x5424eb[_0x6e70('0x51')]),'voice_queue_channel:remove',_0x5424eb);}function notSendMessagesQueue(_0x3b508c){if(_0x3b508c[_0x6e70('0x57')]){if(_0x3b508c[_0x6e70('0x58')]===0x0&&_0x3b508c[_0x6e70('0x28')]===0x0){_0x3b508c[_0x6e70('0x57')]=![];_0x3b508c[_0x6e70('0x27')]=0x0;_0x3b508c[_0x6e70('0x59')]=0x0;_0x3b508c[_0x6e70('0x47')]='NOT_ACTIVE';ut[_0x6e70('0x5a')](_0x6e70('0x5b'),_0x3b508c[_0x6e70('0x51')]+_0x6e70('0x5c'));}else{_0x3b508c[_0x6e70('0x47')]=_0x6e70('0x5d');ut[_0x6e70('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3b508c['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x3b508c);}}Preview[_0x6e70('0x12')][_0x6e70('0x21')]=function(){var _0x83847b=this;setInterval(function(){_0x83847b[_0x6e70('0x5e')]();},0x7cf);};Preview[_0x6e70('0x12')]['syncCampaigns']=function(){var _0x225d44=this[_0x6e70('0x16')];this[_0x6e70('0x5f')]+=0x1;for(var _0x52b197 in _0x225d44){if(_0x225d44['hasOwnProperty'](_0x52b197)&&(_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x8')||_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x60'))&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(this[_0x6e70('0x5f')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x6e70('0x61')]();}}if(_0x225d44['hasOwnProperty'](_0x52b197)&&_0x225d44[_0x52b197][_0x6e70('0x2f')]===_0x6e70('0x8')&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(_0x225d44[_0x52b197]['dialActive']){this[_0x6e70('0x62')](_0x225d44[_0x52b197]);this[_0x6e70('0x63')](_0x225d44[_0x52b197]);}else{notSendMessagesQueue(_0x225d44[_0x52b197]);}}}};Preview[_0x6e70('0x12')][_0x6e70('0x64')]=function(_0x8f243d){var _0x3fcb2d=this;this[_0x6e70('0x15')]['enqueue'](function(){if(!_[_0x6e70('0x65')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d])){loggerAction[_0x6e70('0x55')](_0x6e70('0x66'),_0x8f243d,_0x6e70('0x67'),_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')],'originated:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d['campaignsPreview'][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]]['originated']),'pTalking:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']]['pTalking']),JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x69')]),JSON[_0x6e70('0x52')](_[_0x6e70('0x6a')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d],['contactId',_0x6e70('0x6b'),_0x6e70('0x6c'),_0x6e70('0x6d')])));return ami[_0x6e70('0x6e')]({'action':_0x6e70('0x6f'),'channel':_0x3fcb2d['actions'][_0x8f243d]['channel']})[_0x6e70('0x70')](function(_0x2e3ea6){if(_0x2e3ea6[_0x6e70('0x47')]===_0x6e70('0x71')){setTimeout(function(){if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]){ut['updateOriginated'](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['dialAnswer']===!![]){ut[_0x6e70('0x73')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));ut[_0x6e70('0x74')]('[Dialer][checkChannel][pTalking][Preview]'+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]);}ut['loggerError'](_0x6e70('0x75')+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']);delete _0x3fcb2d[_0x6e70('0x19')][_0x8f243d];}},0x2328);}});}});};Preview[_0x6e70('0x12')][_0x6e70('0x61')]=function(){var _0x46d536=this;loggerAction[_0x6e70('0x55')]('[action]',_[_0x6e70('0x76')](this[_0x6e70('0x19')]));for(var _0x10d655 in this[_0x6e70('0x19')]){if(_0x46d536[_0x6e70('0x19')][_0x6e70('0x77')](_0x10d655)){_0x46d536[_0x6e70('0x64')](_0x10d655);}}};Preview[_0x6e70('0x12')][_0x6e70('0x63')]=function(_0x344676){var _0x13dd17=this;rpcDb[_0x6e70('0x78')](_0x344676['id'],ut[_0x6e70('0x79')](this[_0x6e70('0x1a')]))[_0x6e70('0x7a')](function(_0x2240a1){if(!_[_0x6e70('0x65')](_0x2240a1)){for(var _0x4329a6=0x0;_0x4329a6<_0x2240a1[_0x6e70('0x7b')];_0x4329a6+=0x1){if(ut[_0x6e70('0x7c')](_0x2240a1[_0x4329a6]['scheduledat'])<_0x344676[_0x6e70('0x7d')]*0x3c){if(_0x2240a1[_0x4329a6][_0x6e70('0x7e')]&&!_0x2240a1[_0x4329a6][_0x6e70('0x7e')][_0x6e70('0x7f')]){_0x13dd17[_0x6e70('0x80')](_0x2240a1[_0x4329a6]['id'])[_0x6e70('0x7a')](ut['logger2'](_0x6e70('0x81')))[_0x6e70('0x70')](ut['logger2'](_0x6e70('0x81')));}else{rpcDb[_0x6e70('0x82')](_0x2240a1[_0x4329a6]['id']);}}else{var _0x459a30=new Action(_0x2240a1[_0x4329a6],_0x344676);_0x459a30['starttime']=moment()['format'](_0x6e70('0x83'));_0x344676[_0x6e70('0x3c')]+=0x1;ut[_0x6e70('0x84')](_0x459a30,0x17,_0x6e70('0x85'));if(_0x344676[_0x6e70('0x86')]){rpcDb[_0x6e70('0x87')](ut[_0x6e70('0x88')](_0x2240a1[_0x4329a6]));rpcDb['createCustomerHistory'](_0x459a30,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6e70('0x84')](_0x459a30,0x16,_0x6e70('0x89'));rpcDb[_0x6e70('0x8a')](_0x459a30,_0x6e70('0x8b'));rpcDb['createCustomerFinal'](_0x459a30,'[HistoryRecallClose]');}}}}})[_0x6e70('0x70')](ut[_0x6e70('0x8c')]('[getContactRecallMe]'));};Preview['prototype'][_0x6e70('0x62')]=function(_0x47fbed){_0x47fbed[_0x6e70('0x57')]=!![];if(ut[_0x6e70('0x8d')](_0x47fbed[_0x6e70('0x8e')])){_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x8f');}else if(!ut[_0x6e70('0x90')](_0x47fbed[_0x6e70('0x2e')])){_0x47fbed[_0x6e70('0x47')]='NOT_ACTIVE';}else if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x4e')])){if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x92')])){_0x47fbed[_0x6e70('0x47')]='TRUNK_IS_NOT_REACHABLE';}else{_0x47fbed['message']='ACTIVE';}}else{_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x93');}emitCampaignPreview(_0x47fbed);};Preview[_0x6e70('0x12')]['callProgressDetectingCustomer']=function(_0x58cf1c,_0x2fc2a2,_0x3dae08){var _0x3c2830=this;var _0x195166=this[_0x6e70('0x19')][_0x2fc2a2];var _0x32b884=this['campaignsPreview'][_0x195166[_0x6e70('0x68')]];var _0x3f5896;if(_0x32b884){switch(_0x3dae08){case'1':_0x32b884[_0x6e70('0x3a')]+=0x1;_0x195166[_0x6e70('0x94')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x0,'NoSuchNumber');ami[_0x6e70('0x22')](_0x6e70('0x96'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0x98')));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0x99'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0x9e'));}else{if(_0x195166[_0x6e70('0x94')]>=_0x32b884[_0x6e70('0x9f')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0x9e'));}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0x94'),_0x32b884[_0x6e70('0xa1')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xa4'):var _0x25e685=moment()[_0x6e70('0x53')](_0x6e70('0x83'));_0x195166['responsetime']=_0x25e685;_0x195166['answertime']=_0x25e685;_0x195166[_0x6e70('0x69')]=!![];_0x32b884[_0x6e70('0x28')]+=0x1;logger['info'](_0x6e70('0xa5'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);ami[_0x6e70('0x22')](_0x6e70('0xa9'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0xaa'),this[_0x6e70('0x16')][_0x195166[_0x6e70('0x68')]]));if(_0x32b884[_0x6e70('0xab')]){ami[_0x6e70('0x22')]('custom:agentConnectPreview',ut['buildAcw'](_0x195166));}break;case'16':ami[_0x6e70('0x22')]('custom:agentcomplete',ut[_0x6e70('0x97')](_0x195166,'complete',this['campaignsPreview'][_0x195166[_0x6e70('0x68')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x195166,'complete'));_0x32b884[_0x6e70('0x33')]+=0x1;_0x32b884[_0x6e70('0x2a')]+=0x1;_0x32b884[_0x6e70('0x26')]+=0x1;ut['decrementTalkink'](_0x32b884,'[16]');_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xad'));rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xae'));rpcDb[_0x6e70('0xaf')](_0x195166);_0x32b884[_0x6e70('0xb0')]+=_0x195166['talktime'];_0x32b884[_0x6e70('0xb1')]+=_0x195166[_0x6e70('0xb2')];logger[_0x6e70('0x55')]('[syncHangup][talking][decrement]',_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xb3'):_0x32b884[_0x6e70('0xb4')]+=0x1;_0x195166['countbusyretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x5,_0x6e70('0xb6'));ami[_0x6e70('0x22')]('custom:agentbusy',ut['buildObj'](_0x195166,_0x6e70('0xb7')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xb8'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xb9'));}else{if(_0x195166[_0x6e70('0xba')]>=_0x32b884[_0x6e70('0xbb')]){rpcDb['createCustomerFinal'](_0x195166,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0xba'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case'NOANSWER':_0x32b884[_0x6e70('0x39')]+=0x1;_0x195166['countnoanswerretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x3,_0x6e70('0xbe'));ami[_0x6e70('0x22')](_0x6e70('0xbf'),ut[_0x6e70('0x97')](_0x195166,'noanswer'));rpcDb[_0x6e70('0x8a')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884['dialGlobalMaxRetry']){_0x3f5896=ut['cloneAction'](_0x195166,0xf,'Global');rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xc0'));}else{if(_0x195166[_0x6e70('0xc1')]>=_0x32b884[_0x6e70('0xc2')]){rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countnoanswerretry',_0x32b884[_0x6e70('0xc4')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case'CONGESTION':_0x32b884['outboundCongestionCallsDay']+=0x1;_0x195166[_0x6e70('0xc5')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x8,_0x6e70('0xc6'));ami[_0x6e70('0x22')](_0x6e70('0xc7'),ut['buildObj'](_0x195166,_0x6e70('0xc8')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xc9'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xca'));}else{if(_0x195166['countcongestionretry']>=_0x32b884[_0x6e70('0xcb')]){rpcDb['createCustomerFinal'](_0x195166,_0x6e70('0xc9'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xc5'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xcc'):_0x32b884[_0x6e70('0x3d')]+=0x1;_0x195166[_0x6e70('0xcd')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x14,_0x6e70('0xce'));ami[_0x6e70('0x22')](_0x6e70('0xcf'),ut['buildObj'](_0x195166,'agentreject'));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xd0'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0x14,_0x6e70('0xce'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xd1'));}else{if(_0x195166[_0x6e70('0xcd')]>=_0x32b884[_0x6e70('0xd2')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd1'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xcd'),_0x32b884[_0x6e70('0xd3')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xd4'):_0x32b884[_0x6e70('0xd5')]+=0x1;_0x195166[_0x6e70('0xd6')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0xb,'Abandoned');rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xd7'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x195166[_0x6e70('0xd8')]>=_0x32b884['dialAbandonedMaxRety']){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd7'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countabandonedretry',_0x32b884[_0x6e70('0xd9')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}break;default:if(_0x195166[_0x6e70('0x69')]){ut['decrementTalkink'](_0x32b884,_0x6e70('0xda'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x32b884[_0x6e70('0x51')],_0x58cf1c);}_0x32b884[_0x6e70('0x3e')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut['totalGlobal'](_0x195166);ut[_0x6e70('0x84')](_0x195166,0xc,_0x58cf1c[_0x6e70('0xdb')]||_0x58cf1c['dialstatus']);rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xdc'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xdd'));}else{rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];}if(!(_0x195166['dialAnswer']&&_0x3dae08==='16')){ut[_0x6e70('0xde')](_0x32b884,_0x6e70('0xdf'));logger['info'](_0x6e70('0xe0'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884['name'],_0x6e70('0xe1'),_0x32b884[_0x6e70('0x58')]);}if(_0x3dae08!==_0x6e70('0xa4')){delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xe2')]];}}};Preview[_0x6e70('0x12')][_0x6e70('0xe3')]=function(_0x33a93c,_0x273ed6,_0x41b70a){if(_[_0x6e70('0xe4')](_0x273ed6)&&'object'!==typeof _0x273ed6){return;}if(_[_0x6e70('0xe4')](_0x41b70a)&&_0x6e70('0xe5')!==typeof _0x41b70a){return;}switch(_0x41b70a[_0x6e70('0xe6')]){case'0':ut[_0x6e70('0xe7')](_0x33a93c,0x0,_0x6e70('0xe8'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xe9'));break;case'3':ut[_0x6e70('0xe7')](_0x33a93c,0x3,_0x6e70('0xbe'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xea'));break;case'5':ut['logAgent'](_0x33a93c,0x5,'Busy');rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xec'));break;case'8':ut[_0x6e70('0xe7')](_0x33a93c,0x8,_0x6e70('0xc6'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xed'));break;case'22':ut[_0x6e70('0xe7')](_0x33a93c,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x33a93c,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x6e70('0xe7')](_0x33a93c,0xc,_0x41b70a[_0x6e70('0xe6')]);rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xed'));}ut[_0x6e70('0xde')](_0x273ed6,_0x6e70('0xee'));logger[_0x6e70('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x33a93c[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x273ed6[_0x6e70('0x51')],_0x6e70('0xe1'),_0x273ed6[_0x6e70('0x58')]);delete this[_0x6e70('0x19')][_0x33a93c[_0x6e70('0xa6')]];};Preview[_0x6e70('0x12')][_0x6e70('0xef')]=function(_0x541c25,_0x1a2a44,_0x321da8,_0x5b4a66,_0x2a1205){var _0x1f1b96=this;return new BPromise(function(_0x397289,_0x551c7e){if(_[_0x6e70('0x65')](_0x1a2a44)||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')])||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')][_0x6e70('0xf1')])||_['isNil'](_0x1a2a44['VoiceQueueId'])){_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0xf2'),_0x5b4a66,_0x2a1205));return;}var _0xc93d60=uuid['v4']();var _0x432794=_0x1f1b96[_0x6e70('0x16')][_0x1a2a44[_0x6e70('0x67')]['name']];var _0x3df7bd=_0x321da8?_0x1f1b96[_0x6e70('0x1a')][_0x321da8]['id']:undefined;_0x1f1b96[_0x6e70('0x19')][_0xc93d60]=new Action(_0x1a2a44,_0x432794,_0xc93d60,_0x321da8,_0x3df7bd);var _0x154697=_0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x154697[_0x6e70('0xa2')]=_0x5b4a66;_0x154697[_0x6e70('0xbd')]=_0x2a1205;_0x154697[_0x6e70('0xf3')]=_0x321da8;if(_[_0x6e70('0xf4')](_0x541c25)){_0x1f1b96[_0x6e70('0xf5')](_0x154697,_0x432794,_0x1a2a44,_0x321da8)[_0x6e70('0x7a')](function(_0x8b237a){logger[_0x6e70('0x55')](_0x6e70('0xf6'),_0x6e70('0xf7')+_0x154697[_0x6e70('0x68')]+_0x6e70('0xf8')+_0x154697['idContact'],JSON['stringify'](_0x8b237a));ami[_0x6e70('0x22')](_0x6e70('0xf9'),ut[_0x6e70('0x97')](_0x154697,_0x6e70('0xfa'),_0x1f1b96[_0x6e70('0x16')][_0x154697[_0x6e70('0x68')]]));_0x397289(ut['message'](_0x6e70('0xfb')));})['catch'](function(_0x2f05b2){ut['logger'](_0x6e70('0xfc'),_0x2f05b2);_0x551c7e(ut['message'](_0x6e70('0xfd'),_0x5b4a66,_0x2a1205));});}else{_0x432794[_0x6e70('0x34')]+=0x1;ut[_0x6e70('0xfe')](_0x154697);rpcDb['createHistory'](_0x154697,_0x6e70('0xff'));delete _0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0x100'),_0x5b4a66,_0x2a1205));}});};Preview[_0x6e70('0x12')][_0x6e70('0x91')]=function(_0x1e8bfd){return!_['isNil'](_0x1e8bfd)&&!_[_0x6e70('0x65')](_0x1e8bfd[_0x6e70('0x51')])&&!_['isNil'](_0x1e8bfd[_0x6e70('0x101')])&&_0x1e8bfd[_0x6e70('0x101')]&&!_['isNil'](this['trunks'][util[_0x6e70('0x53')]('SIP/%s',_0x1e8bfd[_0x6e70('0x51')])])&&!_[_0x6e70('0x65')](this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')])&&(this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x103')||this['trunks'][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x104'));};Preview[_0x6e70('0x12')][_0x6e70('0x80')]=function(_0xac161,_0x44ebd6){var _0x568799=this;return new BPromise(function(_0x4bdcc,_0xa512d1){_0x568799[_0x6e70('0x105')](_0xac161,_0x44ebd6)['then'](function(_0x88522){_0x4bdcc(_[_0x6e70('0x6a')](_0x88522,[_0x6e70('0x47')]));})[_0x6e70('0x70')](function(_0x4af0bc){if(_0x4af0bc['unlock']){rpcDb[_0x6e70('0x106')](_0xac161);}if(_0x4af0bc['active']){rpcDb['disableContact'](_0xac161);}_0xa512d1(_[_0x6e70('0x6a')](_0x4af0bc,[_0x6e70('0x47')]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x105')]=function(_0x3bc12b,_0x22827){var _0xf7e813=this;return new BPromise(function(_0x3fef9d,_0x20fe70){var _0x41df1b,_0x484806;rpcDb[_0x6e70('0x107')](_0x3bc12b)[_0x6e70('0x7a')](function(_0xad1b46){if(!_[_0x6e70('0x65')](_0xad1b46[0x0])){_0x484806=_0xad1b46[0x0][_0x6e70('0x108')]?![]:!![];_0x41df1b=_0xad1b46[0x0][_0x6e70('0x108')]?!![]:![];_0x41df1b=_0x22827?!![]:_0x41df1b;}var _0x2033fa=_0xf7e813[_0x6e70('0x109')](_0xad1b46);if(_0x2033fa[_0x6e70('0x10a')]){rpcDb[_0x6e70('0x10b')](_['pick'](_0xad1b46[0x0],['VoiceQueueId','Contact.phone']))['then'](function(_0x2198fa){_0xf7e813[_0x6e70('0xef')](_0x2198fa,_0xad1b46[0x0],_0x22827,_0x484806,_0x41df1b)[_0x6e70('0x7a')](function(_0x596bbd){_0x3fef9d(_0x596bbd);})[_0x6e70('0x70')](function(_0x5c8b78){_0x20fe70(_0x5c8b78);});})[_0x6e70('0x70')](function(_0x59e8bf){ut['logger'](_0x6e70('0x10c'),_0x59e8bf);_0x20fe70(ut[_0x6e70('0x47')](_0x6e70('0x10d'),_0x484806,_0x41df1b));});}else{_0x20fe70(ut[_0x6e70('0x47')](_0x2033fa[_0x6e70('0x47')],_0x484806,_0x41df1b));}})[_0x6e70('0x70')](function(_0x2cfb23){ut['logger'](_0x6e70('0x10e'),_0x2cfb23);_0x20fe70(ut[_0x6e70('0x47')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x109')]=function(_0x151c30){if(_['isNil'](_0x151c30)||_[_0x6e70('0xf4')](_0x151c30)||!_[_0x6e70('0x65')](_0x151c30[0x0]['Agent'])&&_['isNil'](_0x151c30[0x0][_0x6e70('0x7e')][_0x6e70('0x51')])){ut[_0x6e70('0x5a')](_0x6e70('0x10f'),_0x151c30);return{'isValid':![],'message':_0x6e70('0x110')};}var _0x48556b=this['campaignsPreview'][_0x151c30[0x0][_0x6e70('0x67')][_0x6e70('0x51')]];_0x48556b[_0x6e70('0x47')]='ACTIVE';if(_[_0x6e70('0x65')](_0x48556b)){ut[_0x6e70('0x5a')](_0x6e70('0x111'),_0x48556b);return{'isValid':![],'message':_0x6e70('0x112')};}if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x4e')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x6e70('0x114')+_0x48556b[_0x6e70('0x51')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x92')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x48556b['name']+_0x6e70('0x115'));return{'isValid':![],'message':_0x6e70('0x116')};}}if(!ut[_0x6e70('0x90')](_0x48556b['dialActive'])){ut[_0x6e70('0x5a')](_0x6e70('0x117'),_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118')};}return{'isValid':!![],'message':_0x6e70('0x119')};};Preview[_0x6e70('0x12')][_0x6e70('0xf5')]=function(_0x24ebf4,_0xa08f5,_0x28bc96,_0x2eb49f){var _0x46a4c2=this;return new BPromise(function(_0x4e0788,_0x53f283){var _0x11b784=_0x24ebf4[_0x6e70('0xa6')];var _0x323887=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?util[_0x6e70('0x53')](_0x6e70('0x11a'),_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x31')])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')]['phone'][_0x6e70('0x11d')](_0xa08f5[_0x6e70('0x11c')]):_0x28bc96[_0x6e70('0xf0')]['phone']):util[_0x6e70('0x53')](_0x6e70('0x11a'),_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')]:_0xa08f5['TrunkBackup'][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5['dialPrefix'])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')][_0x6e70('0xf1')]['substring'](_0xa08f5['dialCutDigit']):_0x28bc96[_0x6e70('0xf0')]['phone']);var _0x337b18=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?ut[_0x6e70('0x11e')](_0xa08f5[_0x6e70('0x4e')]['callerid'],_0xa08f5[_0x6e70('0x11f')],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5[_0x6e70('0x122')],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]):ut['getCallerId'](_['isNil'](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x4f')]:_0xa08f5[_0x6e70('0x92')]['callerid'],_0xa08f5['dialOriginateCallerIdName'],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5['dialOriginateCallerIdNumber'],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]);if(_0x337b18){_0x24ebf4[_0x6e70('0x123')]=ut['extractCalleridName'](_0x337b18);_0x24ebf4[_0x6e70('0x124')]=ut[_0x6e70('0x125')](_0x337b18);}var _0x4b28d2=ut[_0x6e70('0x126')](_0xa08f5,_0x28bc96,_0x323887,_0x337b18,_0x11b784,_0x24ebf4);_['merge'](_0x24ebf4,ut[_0x6e70('0x127')](_0x4b28d2));_0x24ebf4[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x6e70('0x6e')](ut[_0x6e70('0x129')](_0x24ebf4,_0xa08f5,_0x4b28d2,_0x24ebf4[_0x6e70('0xbd')],_0x2eb49f))[_0x6e70('0x7a')](function(_0x1da95e){_0xa08f5['originated']+=0x1;logger[_0x6e70('0x55')]('[originated][increment]',_0x11b784,_0x6e70('0xa7'),_0xa08f5[_0x6e70('0x51')],_0x6e70('0xe1'),_0xa08f5[_0x6e70('0x58')]);_0x4e0788(_0x1da95e);})[_0x6e70('0x70')](function(_0x26a56c){ut[_0x6e70('0xe7')](_0x24ebf4,0xe,_0x6e70('0x12a'));rpcDb['createAgentHistory'](_0x24ebf4,_0x6e70('0x12b'));_0x53f283(_0x26a56c);});});};Preview['prototype'][_0x6e70('0x12c')]=function(_0x35e889){if(this[_0x6e70('0x19')][_0x35e889[_0x6e70('0xa3')]]){this['actions'][_0x35e889[_0x6e70('0xa3')]]['channel']=_0x35e889['channel'];}};Preview[_0x6e70('0x12')]['syncOriginateResponse']=function(_0x114df8){var _0x19cc83=this;var _0x14bdfb=this['actions'][_0x114df8['actionid']];if(_0x14bdfb){if(_0x14bdfb[_0x6e70('0xf3')]&&this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]){ut[_0x6e70('0x12d')](_0x14bdfb,this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]['name'],this[_0x6e70('0x1a')][_0x14bdfb['lookAgent']]['id']);}var _0x5771e5=_['clone'](_0x14bdfb);_0x5771e5[_0x6e70('0x12e')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e479d=_0x19cc83['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]];if(ut[_0x6e70('0x12f')](_0x114df8[_0x6e70('0x130')])){if(_0x14bdfb[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x14bdfb[_0x6e70('0x131')]);}if(_0x14bdfb[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x14bdfb[_0x6e70('0x131')]);}ami[_0x6e70('0x22')](_0x6e70('0x132'),ut[_0x6e70('0x97')](_0x14bdfb,'rejected',this['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]]));this[_0x6e70('0xe3')](_0x5771e5,_0x1e479d,_0x114df8);}else{_0x14bdfb[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x5771e5,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0xeb')](_0x5771e5,_0x6e70('0x133'));}}};Preview[_0x6e70('0x12')]['syncHangup']=function(_0x25b5ce){var _0x4a7ce3=this;var _0x44799d=this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]];var _0x4605e5;if(_0x44799d){_0x4605e5=this[_0x6e70('0x16')][_0x44799d['queue']];logger[_0x6e70('0x55')](_0x6e70('0x134'),_0x25b5ce[_0x6e70('0xa3')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);}if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]&&_0x25b5ce[_0x6e70('0xa3')]!==_0x25b5ce[_0x6e70('0xa6')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){this[_0x6e70('0x136')](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],'pTalking:\x20',_0x4605e5['pTalking']);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}}else if(_0x44799d&&_[_0x6e70('0x65')](_0x44799d[_0x6e70('0x138')])&&_0x4605e5[_0x6e70('0x139')]&&_0x25b5ce[_0x6e70('0xa3')]===_0x25b5ce[_0x6e70('0xa6')]&&_[_0x6e70('0x65')](_0x25b5ce['reason'])&&_0x25b5ce[_0x6e70('0x135')]==='16'&&_0x25b5ce[_0x6e70('0x13a')]==='6'&&_['isUndefined'](_0x44799d['transfer'])){if(_0x44799d[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x44799d[_0x6e70('0x131')]);}if(_0x44799d[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x44799d['idContact']);}_0x25b5ce['reason']='22';this[_0x6e70('0xe3')](_0x44799d,_0x4605e5,_0x25b5ce);}else if(_0x44799d&&_0x44799d[_0x6e70('0x13b')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this['actions'][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')]('[syncHangup][talking][transfer]',_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')],_0x6e70('0xa7'),_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]['dialAnswer']){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce['cause'],_0x6e70('0xa7'),_0x4605e5['name'],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}}};Preview['prototype'][_0x6e70('0x1d')]=function(_0x2e8a43){if(this[_0x6e70('0x19')][_0x2e8a43[_0x6e70('0xe2')]]&&_0x2e8a43[_0x6e70('0xe2')]!==_0x2e8a43[_0x6e70('0x13c')]){this[_0x6e70('0x136')](_0x2e8a43,_0x2e8a43[_0x6e70('0xe2')],_0x2e8a43[_0x6e70('0x13d')]);}};Preview[_0x6e70('0x12')]['syncHangupRequest']=function(_0x52ce1a){if(this[_0x6e70('0x19')][_0x52ce1a['linkedid']]&&_0x52ce1a[_0x6e70('0xa3')]!==_0x52ce1a[_0x6e70('0xa6')]&&!this[_0x6e70('0x19')][_0x52ce1a[_0x6e70('0xa3')]][_0x6e70('0x69')]){if(_0x52ce1a[_0x6e70('0x135')]==='1'){this[_0x6e70('0x136')](_0x52ce1a,_0x52ce1a[_0x6e70('0xa3')],_0x52ce1a[_0x6e70('0x135')]);}}};Preview['prototype']['addVariable']=function(_0x4f8e39,_0x2bab68,_0x5f208c){if(this[_0x6e70('0x19')][_0x4f8e39]){if(_[_0x6e70('0x65')](this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')])){this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')]={};}this['actions'][_0x4f8e39][_0x6e70('0x13e')][_0x2bab68]=_0x5f208c;}};Preview[_0x6e70('0x12')][_0x6e70('0x1e')]=function(_0x2bafad){try{if(!_[_0x6e70('0x65')](_0x2bafad)){if(ut[_0x6e70('0x13f')](_[_0x6e70('0x140')](_0x2bafad['variable'])[0x0])){this[_0x6e70('0x141')](_0x2bafad[_0x6e70('0xa6')],_['keys'](_0x2bafad[_0x6e70('0x142')])[0x0],_0x2bafad[_0x6e70('0x143')]);}}}catch(_0x5734d6){logger['error'](_0x6e70('0x144'),util[_0x6e70('0x145')](_0x5734d6,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x6e70('0x146')]=function(_0x1bc156){if(_0x1bc156){if(this[_0x6e70('0x19')][_0x1bc156[_0x6e70('0x147')]]){this[_0x6e70('0x19')][_0x1bc156['transfertargetlinkedid']][_0x6e70('0x13b')]=!![];}}};Preview[_0x6e70('0x12')]['syncBlindTransfer']=function(_0x2e7e4a){if(_0x2e7e4a){if(this['actions'][_0x2e7e4a['transfererlinkedid']]){this['actions'][_0x2e7e4a[_0x6e70('0x148')]][_0x6e70('0x13b')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x9c44=['Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','unlockContact','disableContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','destuniqueid','addVariable','variables','syncVarSet','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','strategy','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','originated','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','preview','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','logCustomer','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','rescheduleContact','scheduledAt','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','unlockAgent','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','Global','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','pick','Contact.phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact'];(function(_0x506ae6,_0x1a3a48){var _0x2bbc5c=function(_0x63ba84){while(--_0x63ba84){_0x506ae6['push'](_0x506ae6['shift']());}};_0x2bbc5c(++_0x1a3a48);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x49c4('0x0'));var uuid=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var md5=require(_0x49c4('0x3'));var Redis=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x49c4('0x6'))('actionPreview');var ami=require(_0x49c4('0x7'));var rpcDb=require(_0x49c4('0x8'));var Action=require(_0x49c4('0x9'));var ut=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitCampaignPreview(_0x46e475){if(_0x46e475[_0x49c4('0x24')]==='outbound'){var _0x527126={'id':_0x46e475['id'],'name':_0x46e475['name'],'strategy':_0x46e475[_0x49c4('0x25')],'answered':_0x46e475['answered'],'available':_0x46e475['available'],'loggedIn':_0x46e475[_0x49c4('0x26')],'pTalking':_0x46e475[_0x49c4('0x27')],'sumBillable':_0x46e475[_0x49c4('0x28')],'sumDuration':_0x46e475[_0x49c4('0x29')],'sumHoldTime':_0x46e475['sumHoldTime']||0x0,'talking':_0x46e475['talking'],'total':_0x46e475[_0x49c4('0x2a')],'type':_0x46e475[_0x49c4('0x24')],'unmanaged':_0x46e475['unmanaged'],'abandoned':_0x46e475[_0x49c4('0x2b')],'waiting':_0x46e475[_0x49c4('0x2c')],'loggedInDb':_0x46e475[_0x49c4('0x2d')],'dialActive':_0x46e475[_0x49c4('0x2e')],'dialMethod':_0x46e475['dialMethod'],'dialOriginateCallerIdName':_0x46e475['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x46e475[_0x49c4('0x2f')],'dialOriginateTimeout':_0x46e475['dialOriginateTimeout'],'dialPrefix':_0x46e475[_0x49c4('0x30')],'outboundAnswerAgiCallsDay':_0x46e475[_0x49c4('0x31')],'outboundAnswerCallsDay':_0x46e475[_0x49c4('0x32')],'outboundBlacklistCallsDay':_0x46e475[_0x49c4('0x33')],'outboundBusyCallsDay':_0x46e475['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x46e475[_0x49c4('0x34')],'outboundDropCallsDayACS':_0x46e475[_0x49c4('0x35')],'outboundDropCallsDayCallersExit':_0x46e475[_0x49c4('0x36')],'outboundDropCallsDayTimeout':_0x46e475[_0x49c4('0x37')],'outboundNoAnswerCallsDay':_0x46e475[_0x49c4('0x38')],'outboundNoSuchCallsDay':_0x46e475[_0x49c4('0x39')],'outboundOriginateFailureCallsDay':_0x46e475[_0x49c4('0x3a')],'outboundReCallsDay':_0x46e475[_0x49c4('0x3b')],'outboundRejectCallsDay':_0x46e475[_0x49c4('0x3c')],'outboundUnknownCallsDay':_0x46e475[_0x49c4('0x3d')],'outboundAbandonedCallsDay':_0x46e475[_0x49c4('0x3e')],'predictiveIntervalAnsweredCalls':_0x46e475['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x46e475['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x46e475['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x46e475[_0x49c4('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x46e475[_0x49c4('0x40')],'predictiveIntervalErlangCalls':_0x46e475[_0x49c4('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x46e475[_0x49c4('0x42')],'predictiveIntervalHitRate':_0x46e475[_0x49c4('0x43')],'predictiveIntervalMultiplicativeFactor':_0x46e475['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x46e475[_0x49c4('0x44')],'predictiveIntervalAvailable':_0x46e475[_0x49c4('0x45')],'predictiveIntervalTotalCalls':_0x46e475[_0x49c4('0x46')],'message':_0x46e475[_0x49c4('0x47')],'originated':_0x46e475['originated'],'erlangCalls':_0x46e475['erlangCalls'],'erlangCallToSecond':_0x46e475[_0x49c4('0x48')],'erlangAbandonmentRate':_0x46e475[_0x49c4('0x49')],'erlangBusyFactor':_0x46e475[_0x49c4('0x4a')],'startPredictive':_0x46e475[_0x49c4('0x4b')],'startProgressive':_0x46e475[_0x49c4('0x4c')]};if(_0x46e475['Trunk']){_0x527126[_0x49c4('0x4d')]={'id':_0x46e475[_0x49c4('0x4d')]['id'],'name':_0x46e475[_0x49c4('0x4d')]['name'],'active':_0x46e475['Trunk'][_0x49c4('0x4e')],'callerid':_0x46e475[_0x49c4('0x4d')][_0x49c4('0x4f')]};}if(_0x46e475[_0x49c4('0x50')]){_0x527126[_0x49c4('0x50')]={'id':_0x46e475[_0x49c4('0x50')]['id'],'name':_0x46e475[_0x49c4('0x50')][_0x49c4('0x51')]};}var _0x3209cd=md5(JSON['stringify'](_0x527126));if(_0x46e475[_0x49c4('0x3')]!==_0x3209cd){_0x46e475['md5']=_0x3209cd;emit(util[_0x49c4('0x52')](_0x49c4('0x53'),_0x527126[_0x49c4('0x51')]),_0x49c4('0x54'),_0x527126);}}}function emitVoiceQueueChannelRemove(_0x4ed4f8){logger[_0x49c4('0x55')](_0x49c4('0x56'),JSON[_0x49c4('0x57')](_0x4ed4f8));emit(util['format'](_0x49c4('0x53'),_0x4ed4f8[_0x49c4('0x51')]),_0x49c4('0x58'),_0x4ed4f8);}function notSendMessagesQueue(_0x5e5366){if(_0x5e5366[_0x49c4('0x59')]){if(_0x5e5366[_0x49c4('0x5a')]===0x0&&_0x5e5366[_0x49c4('0x27')]===0x0){_0x5e5366[_0x49c4('0x59')]=![];_0x5e5366[_0x49c4('0x5b')]=0x0;_0x5e5366[_0x49c4('0x5c')]=0x0;_0x5e5366[_0x49c4('0x47')]='NOT_ACTIVE';ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x5f'));}else{_0x5e5366[_0x49c4('0x47')]=_0x49c4('0x60');ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x61'));}emitCampaignPreview(_0x5e5366);}}Preview[_0x49c4('0x62')][_0x49c4('0x22')]=function(){var _0x326142=this;setInterval(function(){_0x326142['syncCampaigns']();},0x7cf);};Preview[_0x49c4('0x62')]['syncCampaigns']=function(){var _0x104efb=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x1480da in _0x104efb){if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&(_0x104efb[_0x1480da][_0x49c4('0x64')]==='preview'||_0x104efb[_0x1480da]['dialMethod']===_0x49c4('0x65'))&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x67')]();}}if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&_0x104efb[_0x1480da][_0x49c4('0x64')]===_0x49c4('0x68')&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(_0x104efb[_0x1480da][_0x49c4('0x2e')]){this[_0x49c4('0x69')](_0x104efb[_0x1480da]);this[_0x49c4('0x6a')](_0x104efb[_0x1480da]);}else{notSendMessagesQueue(_0x104efb[_0x1480da]);}}}};Preview['prototype'][_0x49c4('0x6b')]=function(_0x4d27d0){var _0x33696e=this;this[_0x49c4('0x6c')][_0x49c4('0x6d')](function(){if(!_[_0x49c4('0x6e')](_0x33696e[_0x49c4('0x13')][_0x4d27d0])){loggerAction['info'](_0x49c4('0x6f'),_0x4d27d0,_0x49c4('0x70'),_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')],_0x49c4('0x72'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e['actions'][_0x4d27d0][_0x49c4('0x71')]]['originated']),_0x49c4('0x73'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]][_0x49c4('0x27')]),JSON[_0x49c4('0x57')](_0x33696e['actions'][_0x4d27d0][_0x49c4('0x74')]),JSON[_0x49c4('0x57')](_['pick'](_0x33696e[_0x49c4('0x13')][_0x4d27d0],[_0x49c4('0x75'),_0x49c4('0x76'),_0x49c4('0x77'),'ListId'])));return ami['Action']({'action':_0x49c4('0x78'),'channel':_0x33696e['actions'][_0x4d27d0][_0x49c4('0x79')]})[_0x49c4('0x7a')](function(_0x3811b2){if(_0x3811b2[_0x49c4('0x47')]===_0x49c4('0x7b')){setTimeout(function(){if(_0x33696e[_0x49c4('0x13')][_0x4d27d0]){ut[_0x49c4('0x7c')](_0x33696e['campaignsPreview'][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));if(_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x74')]===!![]){ut[_0x49c4('0x7e')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0]['queue']);delete _0x33696e['actions'][_0x4d27d0];}},0x2328);}});}});};Preview[_0x49c4('0x62')][_0x49c4('0x67')]=function(){var _0x4a0a93=this;loggerAction[_0x49c4('0x55')](_0x49c4('0x7f'),_[_0x49c4('0x80')](this[_0x49c4('0x13')]));for(var _0x50798e in this[_0x49c4('0x13')]){if(_0x4a0a93[_0x49c4('0x13')][_0x49c4('0x63')](_0x50798e)){_0x4a0a93[_0x49c4('0x6b')](_0x50798e);}}};Preview[_0x49c4('0x62')][_0x49c4('0x6a')]=function(_0x5d24f3){var _0x5c7ddd=this;rpcDb[_0x49c4('0x81')](_0x5d24f3['id'],ut[_0x49c4('0x82')](this[_0x49c4('0x14')]))[_0x49c4('0x83')](function(_0x23288e){if(!_[_0x49c4('0x6e')](_0x23288e)){for(var _0xc2033f=0x0;_0xc2033f<_0x23288e['length'];_0xc2033f+=0x1){if(ut[_0x49c4('0x84')](_0x23288e[_0xc2033f][_0x49c4('0x85')])<_0x5d24f3['dialRecallMeTimeout']*0x3c){if(_0x23288e[_0xc2033f][_0x49c4('0x86')]&&!_0x23288e[_0xc2033f]['Agent'][_0x49c4('0x87')]){_0x5c7ddd[_0x49c4('0x88')](_0x23288e[_0xc2033f]['id'])[_0x49c4('0x83')](ut[_0x49c4('0x89')](_0x49c4('0x8a')))[_0x49c4('0x7a')](ut[_0x49c4('0x89')](_0x49c4('0x8a')));}else{rpcDb['disableContact'](_0x23288e[_0xc2033f]['id']);}}else{var _0x3894e0=new Action(_0x23288e[_0xc2033f],_0x5d24f3);_0x3894e0[_0x49c4('0x8b')]=moment()['format'](_0x49c4('0x8c'));_0x5d24f3[_0x49c4('0x3b')]+=0x1;ut['logCustomer'](_0x3894e0,0x17,_0x49c4('0x8d'));if(_0x5d24f3[_0x49c4('0x8e')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x23288e[_0xc2033f]));rpcDb['createCustomerHistory'](_0x3894e0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x49c4('0x8f')](_0x3894e0,0x16,'RecallFailedTimeout');rpcDb[_0x49c4('0x90')](_0x3894e0,_0x49c4('0x91'));rpcDb['createCustomerFinal'](_0x3894e0,_0x49c4('0x91'));}}}}})[_0x49c4('0x7a')](ut['logger2'](_0x49c4('0x92')));};Preview[_0x49c4('0x62')][_0x49c4('0x69')]=function(_0x35f46f){_0x35f46f['sendMessageOneNotActive']=!![];if(ut[_0x49c4('0x93')](_0x35f46f[_0x49c4('0x26')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x94');}else if(!ut['isActive'](_0x35f46f[_0x49c4('0x2e')])){_0x35f46f['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x35f46f['Trunk'])){if(!this[_0x49c4('0x95')](_0x35f46f[_0x49c4('0x96')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x97');}else{_0x35f46f['message']='ACTIVE';}}else{_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x98');}emitCampaignPreview(_0x35f46f);};Preview[_0x49c4('0x62')][_0x49c4('0x99')]=function(_0x102c15,_0x404f98,_0x3ba0d6){var _0x3b949d=this;var _0x4d49e0=this[_0x49c4('0x13')][_0x404f98];var _0x55e2ba=this[_0x49c4('0x10')][_0x4d49e0[_0x49c4('0x71')]];var _0x1a5d4c;if(_0x55e2ba){switch(_0x3ba0d6){case'1':_0x55e2ba[_0x49c4('0x39')]+=0x1;_0x4d49e0[_0x49c4('0x9a')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x0,_0x49c4('0x9d'));ami[_0x49c4('0x23')](_0x49c4('0x9e'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xa0')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xa1'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xa4'));}else{if(_0x4d49e0[_0x49c4('0x9a')]>=_0x55e2ba['dialNoSuchNumberMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xa4'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countnosuchnumberretry',_0x55e2ba['dialNoSuchNumberRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case _0x49c4('0xaa'):var _0x118fc4=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));_0x4d49e0[_0x49c4('0xab')]=_0x118fc4;_0x4d49e0[_0x49c4('0xac')]=_0x118fc4;_0x4d49e0['dialAnswer']=!![];_0x55e2ba[_0x49c4('0x27')]+=0x1;logger[_0x49c4('0x55')](_0x49c4('0xad'),_0x4d49e0['uniqueid'],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba[_0x49c4('0x27')]);ami[_0x49c4('0x23')](_0x49c4('0xaf'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb0'),this['campaignsPreview'][_0x4d49e0[_0x49c4('0x71')]]));if(_0x55e2ba[_0x49c4('0xb1')]){ami[_0x49c4('0x23')](_0x49c4('0xb2'),ut[_0x49c4('0xb3')](_0x4d49e0));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x49c4('0x9f')](_0x4d49e0,'complete',this[_0x49c4('0x10')][_0x4d49e0['queue']]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb4')));_0x55e2ba[_0x49c4('0x32')]+=0x1;_0x55e2ba[_0x49c4('0x2a')]+=0x1;_0x55e2ba['answered']+=0x1;ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xb5'));_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xb7'));rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xb8'));rpcDb['crateCustomerReportQueue'](_0x4d49e0);_0x55e2ba[_0x49c4('0x29')]+=_0x4d49e0[_0x49c4('0xb9')];_0x55e2ba['sumBillable']+=_0x4d49e0[_0x49c4('0xb9')];logger['info'](_0x49c4('0xba'),_0x4d49e0[_0x49c4('0xbb')],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba['pTalking']);delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case'BUSY':_0x55e2ba[_0x49c4('0xbc')]+=0x1;_0x4d49e0[_0x49c4('0xbd')]+=0x1;_0x4d49e0['countglobal']=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x5,'Busy');ami[_0x49c4('0x23')](_0x49c4('0xbe'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xbf')));rpcDb['createCustomerHistory'](_0x4d49e0,_0x49c4('0xc0'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xc1'));}else{if(_0x4d49e0['countbusyretry']>=_0x55e2ba['dialBusyMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xc0'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,'countbusyretry',_0x55e2ba['dialBusyRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc2'):_0x55e2ba[_0x49c4('0x38')]+=0x1;_0x4d49e0[_0x49c4('0xc3')]+=0x1;_0x4d49e0['countglobal']=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x3,'NoAnswer');ami[_0x49c4('0x23')]('custom:agentnoanswer',ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xc4')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xc5'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xc6'));}else{if(_0x4d49e0[_0x49c4('0xc3')]>=_0x55e2ba[_0x49c4('0xc7')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc3'),_0x55e2ba['dialNoAnswerRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc8'):_0x55e2ba[_0x49c4('0x34')]+=0x1;_0x4d49e0[_0x49c4('0xc9')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x8,_0x49c4('0xca'));ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut['buildObj'](_0x4d49e0,'congestion'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xcc'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xcd'));}else{if(_0x4d49e0[_0x49c4('0xc9')]>=_0x55e2ba[_0x49c4('0xce')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc9'),_0x55e2ba[_0x49c4('0xcf')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0['activeContact']);}}break;case'CANCEL':_0x55e2ba[_0x49c4('0x3c')]+=0x1;_0x4d49e0['countagentrejectretry']+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x14,_0x49c4('0xd1'));ami[_0x49c4('0x23')](_0x49c4('0xd2'),ut['buildObj'](_0x4d49e0,'agentreject'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xd3'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0x14,_0x49c4('0xd1'));rpcDb['createCustomerFinal'](_0x1a5d4c,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4d49e0[_0x49c4('0xd4')]>=_0x55e2ba['dialAgentRejectMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xd5'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xd4'),_0x55e2ba['dialAgentRejectRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case'ABANDONED':_0x55e2ba[_0x49c4('0x3e')]+=0x1;_0x4d49e0[_0x49c4('0xd6')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xb,_0x49c4('0xd7'));rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,_0x49c4('0xd8'));rpcDb[_0x49c4('0xa5')](_0x1a5d4c,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4d49e0[_0x49c4('0xd9')]>=_0x55e2ba['dialAbandonedMaxRety']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xda'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countabandonedretry',_0x55e2ba[_0x49c4('0xdb')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0[_0x49c4('0xa8')]);}}break;default:if(_0x4d49e0[_0x49c4('0x74')]){ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xdc'));ut['loggerError'](_0x49c4('0xdd')+_0x55e2ba['name'],_0x102c15);}_0x55e2ba[_0x49c4('0x3d')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xc,_0x102c15['cause-txt']||_0x102c15[_0x49c4('0xde')]);rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xdf'));}else{rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xdf'));}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];}if(!(_0x4d49e0[_0x49c4('0x74')]&&_0x3ba0d6==='16')){ut[_0x49c4('0x7c')](_0x55e2ba,_0x49c4('0xe0'));logger[_0x49c4('0x55')](_0x49c4('0xe1'),_0x4d49e0['uniqueid'],'\x20Queue',_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x72'),_0x55e2ba[_0x49c4('0x5a')]);}if(_0x3ba0d6!=='ANSWER'){delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];delete this['actions'][_0x102c15[_0x49c4('0xe2')]];}}};Preview['prototype'][_0x49c4('0xe3')]=function(_0x308b45,_0x2adf4f,_0x941b9d){if(_['isUndefined'](_0x2adf4f)&&_0x49c4('0xe4')!==typeof _0x2adf4f){return;}if(_[_0x49c4('0xe5')](_0x941b9d)&&_0x49c4('0xe4')!==typeof _0x941b9d){return;}switch(_0x941b9d[_0x49c4('0xe6')]){case'0':ut[_0x49c4('0xe7')](_0x308b45,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x308b45,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x49c4('0xe7')](_0x308b45,0x3,_0x49c4('0xe8'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xea'));break;case'5':ut[_0x49c4('0xe7')](_0x308b45,0x5,'Busy');rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xeb'));break;case'8':ut[_0x49c4('0xe7')](_0x308b45,0x8,_0x49c4('0xca'));rpcDb['createAgentHistory'](_0x308b45,_0x49c4('0xec'));break;case'22':ut[_0x49c4('0xe7')](_0x308b45,0x16,_0x49c4('0xed'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xee'));break;default:ut['logAgent'](_0x308b45,0xc,_0x941b9d[_0x49c4('0xe6')]);rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xec'));}ut['updateOriginated'](_0x2adf4f,_0x49c4('0xef'));logger[_0x49c4('0x55')](_0x49c4('0xf0'),_0x308b45['uniqueid'],_0x49c4('0xae'),_0x2adf4f['name'],'originated:\x20',_0x2adf4f[_0x49c4('0x5a')]);delete this[_0x49c4('0x13')][_0x308b45['uniqueid']];};Preview[_0x49c4('0x62')][_0x49c4('0xf1')]=function(_0xf0bb4f,_0x1ffc9a,_0x10f5fc,_0x3a7559,_0x148619){var _0x219133=this;return new BPromise(function(_0x59dbef,_0x56ed92){if(_[_0x49c4('0x6e')](_0x1ffc9a)||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0xf2')])||_['isNil'](_0x1ffc9a['Contact'][_0x49c4('0xf3')])||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0x77')])){_0x56ed92(ut[_0x49c4('0x47')](_0x49c4('0xf4'),_0x3a7559,_0x148619));return;}var _0x14f2fc=uuid['v4']();var _0xbabd3b=_0x219133[_0x49c4('0x10')][_0x1ffc9a[_0x49c4('0x70')][_0x49c4('0x51')]];var _0xa42e74=_0x10f5fc?_0x219133[_0x49c4('0x14')][_0x10f5fc]['id']:undefined;_0x219133[_0x49c4('0x13')][_0x14f2fc]=new Action(_0x1ffc9a,_0xbabd3b,_0x14f2fc,_0x10f5fc,_0xa42e74);var _0xbfb25b=_0x219133['actions'][_0x14f2fc];_0xbfb25b[_0x49c4('0xd0')]=_0x3a7559;_0xbfb25b[_0x49c4('0xa8')]=_0x148619;_0xbfb25b[_0x49c4('0xf5')]=_0x10f5fc;if(_[_0x49c4('0xf6')](_0xf0bb4f)){_0x219133['execCall'](_0xbfb25b,_0xbabd3b,_0x1ffc9a,_0x10f5fc)['then'](function(_0xb4a33d){logger['info'](_0x49c4('0xf7'),_0x49c4('0xf8')+_0xbfb25b[_0x49c4('0x71')]+_0x49c4('0xf9')+_0xbfb25b[_0x49c4('0xfa')],JSON[_0x49c4('0x57')](_0xb4a33d));ami[_0x49c4('0x23')](_0x49c4('0xfb'),ut[_0x49c4('0x9f')](_0xbfb25b,_0x49c4('0xfc'),_0x219133[_0x49c4('0x10')][_0xbfb25b[_0x49c4('0x71')]]));_0x59dbef(ut['message'](_0x49c4('0xfd')));})[_0x49c4('0x7a')](function(_0x405c63){ut['logger'](_0x49c4('0xfe'),_0x405c63);_0x56ed92(ut['message'](_0x49c4('0xff'),_0x3a7559,_0x148619));});}else{_0xbabd3b[_0x49c4('0x33')]+=0x1;ut[_0x49c4('0x100')](_0xbfb25b);rpcDb[_0x49c4('0x101')](_0xbfb25b,'[Blacklist][error]');delete _0x219133[_0x49c4('0x13')][_0x14f2fc];_0x56ed92(ut['message']('Contact\x20in\x20black\x20List',_0x3a7559,_0x148619));}});};Preview[_0x49c4('0x62')][_0x49c4('0x95')]=function(_0x1c38a5){return!_['isNil'](_0x1c38a5)&&!_['isNil'](_0x1c38a5[_0x49c4('0x51')])&&!_[_0x49c4('0x6e')](_0x1c38a5[_0x49c4('0x4e')])&&_0x1c38a5[_0x49c4('0x4e')]&&!_[_0x49c4('0x6e')](this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5[_0x49c4('0x51')])])&&!_['isNil'](this[_0x49c4('0x12')][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5['name'])][_0x49c4('0x78')])&&(this['trunks'][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5[_0x49c4('0x51')])]['status']===_0x49c4('0x103')||this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5['name'])]['status']===_0x49c4('0x104'));};Preview[_0x49c4('0x62')][_0x49c4('0x88')]=function(_0x5737b4,_0x367d3d){var _0x1814c4=this;return new BPromise(function(_0x5ae29d,_0x5f2411){_0x1814c4[_0x49c4('0x105')](_0x5737b4,_0x367d3d)[_0x49c4('0x83')](function(_0xa0698d){_0x5ae29d(_['pick'](_0xa0698d,[_0x49c4('0x47')]));})[_0x49c4('0x7a')](function(_0x278225){if(_0x278225[_0x49c4('0x106')]){rpcDb['unlockContact'](_0x5737b4);}if(_0x278225[_0x49c4('0x4e')]){rpcDb['disableContact'](_0x5737b4);}_0x5f2411(_['pick'](_0x278225,[_0x49c4('0x47')]));});});};Preview[_0x49c4('0x62')][_0x49c4('0x105')]=function(_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new BPromise(function(_0x947dd8,_0xa6f48){var _0x37dd25,_0x52a022;rpcDb[_0x49c4('0x107')](_0x24ff20)['then'](function(_0x54db51){if(!_[_0x49c4('0x6e')](_0x54db51[0x0])){_0x52a022=_0x54db51[0x0][_0x49c4('0x108')]?![]:!![];_0x37dd25=_0x54db51[0x0][_0x49c4('0x108')]?!![]:![];_0x37dd25=_0x5adb90?!![]:_0x37dd25;}var _0x56a631=_0x32b6e4[_0x49c4('0x109')](_0x54db51);if(_0x56a631['isValid']){rpcDb[_0x49c4('0x10a')](_[_0x49c4('0x10b')](_0x54db51[0x0],[_0x49c4('0x77'),_0x49c4('0x10c')]))[_0x49c4('0x83')](function(_0x2a5743){_0x32b6e4[_0x49c4('0xf1')](_0x2a5743,_0x54db51[0x0],_0x5adb90,_0x52a022,_0x37dd25)['then'](function(_0x3808e6){_0x947dd8(_0x3808e6);})[_0x49c4('0x7a')](function(_0x2f3c7e){_0xa6f48(_0x2f3c7e);});})[_0x49c4('0x7a')](function(_0x4f30d4){ut['logger']('[Preview][checkIsBlackList]',_0x4f30d4);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),_0x52a022,_0x37dd25));});}else{_0xa6f48(ut[_0x49c4('0x47')](_0x56a631[_0x49c4('0x47')],_0x52a022,_0x37dd25));}})[_0x49c4('0x7a')](function(_0x40c7ab){ut[_0x49c4('0x5d')]('[Preview][getContactPreview]',_0x40c7ab);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x4dbb25){if(_[_0x49c4('0x6e')](_0x4dbb25)||_[_0x49c4('0xf6')](_0x4dbb25)||!_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')])&&_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')][_0x49c4('0x51')])){ut['logger'](_0x49c4('0x10e'),_0x4dbb25);return{'isValid':![],'message':_0x49c4('0x10f')};}var _0x2f8042=this[_0x49c4('0x10')][_0x4dbb25[0x0]['Queue'][_0x49c4('0x51')]];_0x2f8042[_0x49c4('0x47')]=_0x49c4('0x98');if(_[_0x49c4('0x6e')](_0x2f8042)){ut[_0x49c4('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f8042);return{'isValid':![],'message':_0x49c4('0x110')};}if(!this['isTrunkReachable'](_0x2f8042['Trunk'])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x113'));if(!this['isTrunkReachable'](_0x2f8042[_0x49c4('0x96')])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x2f8042['name']+_0x49c4('0x114'));return{'isValid':![],'message':_0x49c4('0x115')};}}if(!ut['isActive'](_0x2f8042[_0x49c4('0x2e')])){ut[_0x49c4('0x5d')](_0x49c4('0x116'),_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x117'));return{'isValid':![],'message':_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x49c4('0x118')};};Preview[_0x49c4('0x62')][_0x49c4('0x119')]=function(_0xc7501c,_0x3d9fa7,_0x49c583,_0x34ce60){var _0x39dc83=this;return new BPromise(function(_0x28b1d0,_0x3f62a2){var _0xa2c8cf=_0xc7501c['uniqueid'];var _0x2582e3=_0x39dc83[_0x49c4('0x95')](_0x3d9fa7[_0x49c4('0x4d')])?util[_0x49c4('0x52')](_0x49c4('0x11a'),_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x30')])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')][_0x49c4('0x11c')](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact']['phone']):util[_0x49c4('0x52')](_0x49c4('0x11a'),_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')]:_0x3d9fa7['TrunkBackup'][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7['dialPrefix'])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')]['substring'](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact'][_0x49c4('0xf3')]);var _0x5025ee=_0x39dc83['isTrunkReachable'](_0x3d9fa7[_0x49c4('0x4d')])?ut[_0x49c4('0x11d')](_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')],_0x3d9fa7[_0x49c4('0x11e')],_0x3d9fa7[_0x49c4('0x11f')]>0x0?ut['getCallerIdRandom'](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]):ut[_0x49c4('0x11d')](_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')]:_0x3d9fa7['TrunkBackup']['callerid'],_0x3d9fa7['dialOriginateCallerIdName'],_0x3d9fa7['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x49c4('0x120')](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]);if(_0x5025ee){_0xc7501c[_0x49c4('0x121')]=ut['extractCalleridName'](_0x5025ee);_0xc7501c['originatecalleridnum']=ut[_0x49c4('0x122')](_0x5025ee);}var _0x50088b=ut['addVariables'](_0x3d9fa7,_0x49c583,_0x2582e3,_0x5025ee,_0xa2c8cf,_0xc7501c);_[_0x49c4('0x123')](_0xc7501c,ut[_0x49c4('0x124')](_0x50088b));_0xc7501c[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));ami[_0x49c4('0x125')](ut['variablesAction'](_0xc7501c,_0x3d9fa7,_0x50088b,_0xc7501c[_0x49c4('0xa8')],_0x34ce60))[_0x49c4('0x83')](function(_0x234848){_0x3d9fa7['originated']+=0x1;logger[_0x49c4('0x55')](_0x49c4('0x126'),_0xa2c8cf,_0x49c4('0xae'),_0x3d9fa7[_0x49c4('0x51')],_0x49c4('0x72'),_0x3d9fa7[_0x49c4('0x5a')]);_0x28b1d0(_0x234848);})[_0x49c4('0x7a')](function(_0x414410){ut['logAgent'](_0xc7501c,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xe9')](_0xc7501c,_0x49c4('0x128'));_0x3f62a2(_0x414410);});});};Preview[_0x49c4('0x62')][_0x49c4('0x1e')]=function(_0x471ec6){if(this['actions'][_0x471ec6[_0x49c4('0xa9')]]){this[_0x49c4('0x13')][_0x471ec6[_0x49c4('0xa9')]][_0x49c4('0x79')]=_0x471ec6[_0x49c4('0x79')];}};Preview[_0x49c4('0x62')][_0x49c4('0x17')]=function(_0x1642fd){var _0x4806ac=this;var _0xc641bc=this[_0x49c4('0x13')][_0x1642fd[_0x49c4('0x129')]];if(_0xc641bc){if(_0xc641bc[_0x49c4('0xf5')]&&this[_0x49c4('0x14')][_0xc641bc['lookAgent']]){ut['logLookAgent'](_0xc641bc,this[_0x49c4('0x14')][_0xc641bc[_0x49c4('0xf5')]]['name'],this['agents'][_0xc641bc[_0x49c4('0xf5')]]['id']);}var _0x57062c=_[_0x49c4('0x12a')](_0xc641bc);_0x57062c[_0x49c4('0xab')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));var _0x2a24bf=_0x4806ac[_0x49c4('0x10')][_0xc641bc[_0x49c4('0x71')]];if(ut[_0x49c4('0x12b')](_0x1642fd['response'])){if(_0xc641bc[_0x49c4('0xd0')]){rpcDb[_0x49c4('0x12c')](_0xc641bc[_0x49c4('0xfa')]);}if(_0xc641bc[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0xc641bc['idContact']);}ami[_0x49c4('0x23')](_0x49c4('0x12e'),ut['buildObj'](_0xc641bc,_0x49c4('0x12f'),this[_0x49c4('0x10')][_0xc641bc['queue']]));this[_0x49c4('0xe3')](_0x57062c,_0x2a24bf,_0x1642fd);}else{_0xc641bc[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x49c4('0xe7')](_0x57062c,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0xe9')](_0x57062c,_0x49c4('0x130'));}}};Preview['prototype'][_0x49c4('0x1a')]=function(_0x5786a4){var _0x3508b7=this;var _0x20f67e=this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]];var _0x5a28cc;if(_0x20f67e){_0x5a28cc=this[_0x49c4('0x10')][_0x20f67e[_0x49c4('0x71')]];logger[_0x49c4('0x55')](_0x49c4('0x131'),_0x5786a4[_0x49c4('0xa9')],_0x49c4('0xae'),_0x5a28cc['name'],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);}if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]&&_0x5786a4[_0x49c4('0xa9')]!==_0x5786a4[_0x49c4('0xbb')]){if(_0x5786a4[_0x49c4('0x132')]==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this['actions'][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger['info'](_0x49c4('0x133'),_0x5786a4['linkedid'],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc['name'],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}}else if(_0x20f67e&&_['isNil'](_0x20f67e[_0x49c4('0x134')])&&_0x5a28cc['dialQueueProject']&&_0x5786a4[_0x49c4('0xa9')]===_0x5786a4[_0x49c4('0xbb')]&&_[_0x49c4('0x6e')](_0x5786a4['reason'])&&_0x5786a4[_0x49c4('0x132')]==='16'&&_0x5786a4[_0x49c4('0x135')]==='6'&&_[_0x49c4('0xe5')](_0x20f67e['transfer'])){if(_0x20f67e['unlockAgent']){rpcDb[_0x49c4('0x12c')](_0x20f67e[_0x49c4('0xfa')]);}if(_0x20f67e[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0x20f67e[_0x49c4('0xfa')]);}_0x5786a4[_0x49c4('0xe6')]='22';this['callProgressDetectingAgent'](_0x20f67e,_0x5a28cc,_0x5786a4);}else if(_0x20f67e&&_0x20f67e['transfer']){if(_0x5786a4['cause']==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger[_0x49c4('0x55')]('[syncHangup][talking][transfer]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]['dialAnswer']){logger[_0x49c4('0x55')]('[syncHangup][talking][cause]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);this['callProgressDetectingCustomer'](_0x5786a4,_0x5786a4['linkedid'],_0x5786a4['cause']);}}};Preview[_0x49c4('0x62')][_0x49c4('0x1d')]=function(_0x3f2b3a){if(this['actions'][_0x3f2b3a[_0x49c4('0xe2')]]&&_0x3f2b3a['destlinkedid']!==_0x3f2b3a[_0x49c4('0x136')]){this[_0x49c4('0x99')](_0x3f2b3a,_0x3f2b3a[_0x49c4('0xe2')],_0x3f2b3a['dialstatus']);}};Preview[_0x49c4('0x62')][_0x49c4('0x1b')]=function(_0x2028e5){if(this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]]&&_0x2028e5['linkedid']!==_0x2028e5[_0x49c4('0xbb')]&&!this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]][_0x49c4('0x74')]){if(_0x2028e5['cause']==='1'){this['callProgressDetectingCustomer'](_0x2028e5,_0x2028e5[_0x49c4('0xa9')],_0x2028e5[_0x49c4('0x132')]);}}};Preview['prototype'][_0x49c4('0x137')]=function(_0x2fd09b,_0x10a39c,_0x2e1a4e){if(this['actions'][_0x2fd09b]){if(_[_0x49c4('0x6e')](this[_0x49c4('0x13')][_0x2fd09b]['variables'])){this['actions'][_0x2fd09b][_0x49c4('0x138')]={};}this[_0x49c4('0x13')][_0x2fd09b][_0x49c4('0x138')][_0x10a39c]=_0x2e1a4e;}};Preview[_0x49c4('0x62')][_0x49c4('0x139')]=function(_0x5ee9f1){try{if(!_[_0x49c4('0x6e')](_0x5ee9f1)){if(ut['filterKey'](_[_0x49c4('0x13a')](_0x5ee9f1[_0x49c4('0x13b')])[0x0])){this[_0x49c4('0x137')](_0x5ee9f1[_0x49c4('0xbb')],_['keys'](_0x5ee9f1['variable'])[0x0],_0x5ee9f1['value']);}}}catch(_0x3ed327){logger[_0x49c4('0x13c')](_0x49c4('0x13d'),util[_0x49c4('0x13e')](_0x3ed327,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x7f9737){if(_0x7f9737){if(this['actions'][_0x7f9737[_0x49c4('0x13f')]]){this[_0x49c4('0x13')][_0x7f9737['transfertargetlinkedid']][_0x49c4('0x140')]=!![];}}};Preview[_0x49c4('0x62')][_0x49c4('0x141')]=function(_0x5529f6){if(_0x5529f6){if(this[_0x49c4('0x13')][_0x5529f6[_0x49c4('0x142')]]){this[_0x49c4('0x13')][_0x5529f6['transfererlinkedid']][_0x49c4('0x140')]=!![];}}};module[_0x49c4('0x143')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 56b61e1..1642db1 100644 --- a/server/services/ami/preview/rpcDb.js +++ b/server/services/ami/preview/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','membername','context','from-sip','exten','holdtime','assigned','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0xaa55c0,_0x432353){var _0xe597e0=function(_0x2fb6b9){while(--_0x2fb6b9){_0xaa55c0['push'](_0xaa55c0['shift']());}};_0xe597e0(++_0x432353);}(_0x8ef6,0xf2));var _0x68ef=function(_0x348640,_0x5eded7){_0x348640=_0x348640-0x0;var _0x1e8017=_0x8ef6[_0x348640];return _0x1e8017;};'use strict';var util=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var _=require(_0x68ef('0x4'));var cmHopper=require(_0x68ef('0x5'));var cmHopperFinal=require(_0x68ef('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x68ef('0x7'));var voiceQueueRt=require(_0x68ef('0x8'));var agentReportPreview=require(_0x68ef('0x9'));var voiceQueueReport=require(_0x68ef('0xa'));function loggerCatch(_0x4d26e3){return function(_0x4f77f3){logger[_0x68ef('0xb')](_0x4d26e3,util[_0x68ef('0xc')](_0x4f77f3,{'showHidden':![],'depth':null}));};}function create(_0x2de776){return BPromise['resolve']()[_0x68ef('0xd')](cmHopperHistory[_0x68ef('0xe')](_0x2de776))[_0x68ef('0xf')](loggerCatch(_0x68ef('0x10')));}function createAgent(_0x112b18){return BPromise[_0x68ef('0x11')]()[_0x68ef('0xd')](agentReportPreview[_0x68ef('0xe')](_0x112b18))[_0x68ef('0xf')](loggerCatch(_0x68ef('0x10')));}function moveContact(_0x3afc1d){return BPromise[_0x68ef('0x11')]()['then'](cmHopper[_0x68ef('0x12')](_0x3afc1d,!![]))[_0x68ef('0xf')](loggerCatch(_0x68ef('0x13')));}exports[_0x68ef('0x14')]=function(_0x40f253){return BPromise[_0x68ef('0x11')]()['then'](cmHopperBlack[_0x68ef('0x14')](_0x40f253))[_0x68ef('0xf')](loggerCatch(_0x68ef('0x15')));};exports['getContactPreview']=function(_0x22fe96){return BPromise[_0x68ef('0x11')]()[_0x68ef('0xd')](cmHopper['getContactPreview'](_0x22fe96))[_0x68ef('0xf')](loggerCatch(_0x68ef('0x16')));};exports[_0x68ef('0xe')]=function(_0x3780a4,_0x5c4456){create(_0x3780a4)[_0x68ef('0xf')](loggerCatch(_0x5c4456));moveContact(_0x3780a4)['catch'](loggerCatch(_0x5c4456));};exports['createAgentHistory']=function(_0x2633c1,_0x404870){createAgent(_0x2633c1)['catch'](loggerCatch(_0x404870));};exports['createCustomerHistory']=function(_0x3c4c1f,_0x2cd92c){create(_0x3c4c1f)[_0x68ef('0xf')](loggerCatch(_0x2cd92c));};exports['createCustomerFinal']=function(_0x1dc49c,_0x36a4cb){moveContact(_0x1dc49c)[_0x68ef('0xf')](loggerCatch(_0x36a4cb));};exports['rescheduleContact']=function(_0x3c46d4,_0x3be4c0,_0x5af19f){if(_0x3be4c0){_0x3c46d4[_0x68ef('0x17')]=null;}if(_0x5af19f){_0x3c46d4[_0x68ef('0x18')]=![];}return BPromise[_0x68ef('0x11')]()['then'](cmHopper['rescheduleContact'](_0x3c46d4))['catch'](loggerCatch(_0x68ef('0x19')));};exports[_0x68ef('0x1a')]=function(_0x312cc9){return BPromise[_0x68ef('0x11')]()[_0x68ef('0xd')](cmHopper[_0x68ef('0x1a')](_0x312cc9))[_0x68ef('0xf')](loggerCatch(_0x68ef('0x1b')));};exports[_0x68ef('0x1c')]=function(_0x13280b){return BPromise['resolve']()[_0x68ef('0xd')](cmHopper['unlockContact']({'UserId':null},_0x13280b,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x68ef('0x1d')]=function(_0x268f32){return BPromise[_0x68ef('0x11')]()[_0x68ef('0xd')](cmHopper['unlockContact']({'active':![]},_0x268f32,0x1))['catch'](loggerCatch(_0x68ef('0x1e')));};exports[_0x68ef('0x1f')]=function(_0x7bf96){var _0x263b30={};_0x263b30[_0x68ef('0x20')]=_0x7bf96[_0x68ef('0x20')];_0x263b30[_0x68ef('0x21')]=_0x7bf96[_0x68ef('0x21')];_0x263b30['calleridnum']=_0x7bf96[_0x68ef('0x22')];_0x263b30[_0x68ef('0x23')]=_0x7bf96[_0x68ef('0x23')];_0x263b30['queue']=_0x7bf96[_0x68ef('0x24')];_0x263b30['queuecallerjoinAt']=_0x7bf96[_0x68ef('0x25')];_0x263b30[_0x68ef('0x26')]=_0x7bf96['answertime'];_0x263b30['queuecallercomplete']=0x1;_0x263b30[_0x68ef('0x27')]=_0x7bf96[_0x68ef('0x28')];_0x263b30['connectedlinename']=_0x7bf96[_0x68ef('0x29')];_0x263b30[_0x68ef('0x2a')]=_0x68ef('0x2b');_0x263b30[_0x68ef('0x2c')]='xcally-motion-preview';_0x263b30[_0x68ef('0x2d')]=0x0;_0x263b30[_0x68ef('0x2e')]=0x1;_0x263b30['lastAssignedTo']=_0x7bf96[_0x68ef('0x29')];_0x263b30['queuecallerexitreason']=_0x68ef('0x2f');return BPromise[_0x68ef('0x11')]()['then'](voiceQueueReport[_0x68ef('0x30')](_0x263b30))['catch'](loggerCatch(_0x68ef('0x31')));};exports['getContactRecallMe']=function(_0x2fbb0d,_0x1444e0){return BPromise[_0x68ef('0x11')]()['then'](cmHopper[_0x68ef('0x32')](_0x2fbb0d,_0x1444e0))['catch'](loggerCatch(_0x68ef('0x33')));};exports['rescheduleContactInQueue']=function(_0x474ffa){return BPromise[_0x68ef('0x11')]()[_0x68ef('0xd')](cmHopper[_0x68ef('0x34')](_0x474ffa,!![],!![]))[_0x68ef('0xf')](loggerCatch(_0x68ef('0x35')));}; \ No newline at end of file +var _0xdbf5=['../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','catch','[createHistory]\x20','resolve','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','lodash','../rpc/cmHopper'];(function(_0x4d598f,_0x4a5cb9){var _0x44a541=function(_0x3ed9e9){while(--_0x3ed9e9){_0x4d598f['push'](_0x4d598f['shift']());}};_0x44a541(++_0x4a5cb9);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x353630,_0x4f4402){_0x353630=_0x353630-0x0;var _0x3fb134=_0xdbf5[_0x353630];return _0x3fb134;};'use strict';var util=require('util');var BPromise=require(_0x5dbf('0x0'));var logger=require('../../../config/logger')('preview');var _=require(_0x5dbf('0x1'));var cmHopper=require(_0x5dbf('0x2'));var cmHopperFinal=require(_0x5dbf('0x3'));var cmHopperHistory=require(_0x5dbf('0x4'));var cmHopperBlack=require(_0x5dbf('0x5'));var voiceQueueRt=require(_0x5dbf('0x6'));var agentReportPreview=require(_0x5dbf('0x7'));var voiceQueueReport=require(_0x5dbf('0x8'));function loggerCatch(_0x3f8628){return function(_0x3f8222){logger[_0x5dbf('0x9')](_0x3f8628,util[_0x5dbf('0xa')](_0x3f8222,{'showHidden':![],'depth':null}));};}function create(_0x93e657){return BPromise['resolve']()[_0x5dbf('0xb')](cmHopperHistory['createHistory'](_0x93e657))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0xd')));}function createAgent(_0x264007){return BPromise[_0x5dbf('0xe')]()['then'](agentReportPreview[_0x5dbf('0xf')](_0x264007))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x1c7389){return BPromise['resolve']()['then'](cmHopper[_0x5dbf('0x10')](_0x1c7389,!![]))['catch'](loggerCatch(_0x5dbf('0x11')));}exports[_0x5dbf('0x12')]=function(_0x1453a9){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopperBlack['checkIsBlackList'](_0x1453a9))['catch'](loggerCatch(_0x5dbf('0x13')));};exports[_0x5dbf('0x14')]=function(_0x48e7fd){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x14')](_0x48e7fd))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x15')));};exports[_0x5dbf('0xf')]=function(_0x2d32cc,_0x50ef1d){create(_0x2d32cc)['catch'](loggerCatch(_0x50ef1d));moveContact(_0x2d32cc)[_0x5dbf('0xc')](loggerCatch(_0x50ef1d));};exports[_0x5dbf('0x16')]=function(_0x39c7aa,_0x14abf7){createAgent(_0x39c7aa)[_0x5dbf('0xc')](loggerCatch(_0x14abf7));};exports['createCustomerHistory']=function(_0x11cd00,_0x4dd03c){create(_0x11cd00)['catch'](loggerCatch(_0x4dd03c));};exports['createCustomerFinal']=function(_0x23d1e7,_0x3cedac){moveContact(_0x23d1e7)[_0x5dbf('0xc')](loggerCatch(_0x3cedac));};exports[_0x5dbf('0x17')]=function(_0x1e3cce,_0x5b2518,_0x2764ea){if(_0x5b2518){_0x1e3cce['UserId']=null;}if(_0x2764ea){_0x1e3cce[_0x5dbf('0x18')]=![];}return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x17')](_0x1e3cce))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x19')));};exports['countReScheduled']=function(_0x4027c3){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x1a')](_0x4027c3))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x1b')));};exports[_0x5dbf('0x1c')]=function(_0x20ab1b){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x1c')]({'UserId':null},_0x20ab1b,0x1))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x1d')));};exports[_0x5dbf('0x1e')]=function(_0x729d8f){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x1c')]({'active':![]},_0x729d8f,0x1))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x1f')));};exports[_0x5dbf('0x20')]=function(_0x471027){var _0x21cd00={};_0x21cd00['type']=_0x471027[_0x5dbf('0x21')];_0x21cd00[_0x5dbf('0x22')]=_0x471027[_0x5dbf('0x22')];_0x21cd00[_0x5dbf('0x23')]=_0x471027[_0x5dbf('0x23')];_0x21cd00[_0x5dbf('0x24')]=_0x471027[_0x5dbf('0x24')];_0x21cd00[_0x5dbf('0x25')]=_0x471027[_0x5dbf('0x25')];_0x21cd00[_0x5dbf('0x26')]=_0x471027[_0x5dbf('0x27')];_0x21cd00['queuecallerleaveAt']=_0x471027['answertime'];_0x21cd00[_0x5dbf('0x28')]=0x1;_0x21cd00[_0x5dbf('0x29')]=_0x471027[_0x5dbf('0x2a')];_0x21cd00[_0x5dbf('0x2b')]=_0x471027[_0x5dbf('0x2c')];_0x21cd00['context']='from-sip';_0x21cd00[_0x5dbf('0x2d')]=_0x5dbf('0x2e');_0x21cd00['holdtime']=0x0;_0x21cd00[_0x5dbf('0x2f')]=0x1;_0x21cd00[_0x5dbf('0x30')]=_0x471027[_0x5dbf('0x2c')];_0x21cd00[_0x5dbf('0x31')]=_0x5dbf('0x32');return BPromise['resolve']()[_0x5dbf('0xb')](voiceQueueReport[_0x5dbf('0x33')](_0x21cd00))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x34')));};exports[_0x5dbf('0x35')]=function(_0x4e4518,_0x252d54){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x35')](_0x4e4518,_0x252d54))['catch'](loggerCatch(_0x5dbf('0x36')));};exports[_0x5dbf('0x37')]=function(_0x302dda){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x17')](_0x302dda,!![],!![]))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x38')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 0324d6c..6da7e29 100644 --- a/server/services/ami/preview/util/util.js +++ b/server/services/ami/preview/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb102=['pTalking','error','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','interface','buildAcw','queue','agentReadyId','not_inuse','status','push','getDiff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','channelAgent','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','endtime','logLookAgent','membername','logCustomer','ringtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','state','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink'];(function(_0x5406f7,_0x1f47df){var _0xe67c01=function(_0x4bd359){while(--_0x4bd359){_0x5406f7['push'](_0x5406f7['shift']());}};_0xe67c01(++_0x1f47df);}(_0xb102,0xc7));var _0x2b10=function(_0x165ed7,_0x28468a){_0x165ed7=_0x165ed7-0x0;var _0x569ddb=_0xb102[_0x165ed7];return _0x569ddb;};'use strict';var util=require(_0x2b10('0x0'));var _=require(_0x2b10('0x1'));var moment=require(_0x2b10('0x2'));var logger=require(_0x2b10('0x3'))(_0x2b10('0x4'));var ipAgi=process[_0x2b10('0x5')][_0x2b10('0x6')]||'127.0.0.1';function getSeconds(_0x5c73cf,_0xe2f6cd){var _0x38a52c=moment(_0x5c73cf)[_0x2b10('0x7')](0x0);var _0x371a9c=moment(_0xe2f6cd)[_0x2b10('0x7')](0x0);return _0x38a52c[_0x2b10('0x8')](_0x371a9c,_0x2b10('0x9'));}exports['loggerCatch']=function(_0x412c19){return function(_0x4b4993){logger['error'](_0x412c19,util[_0x2b10('0xa')](_0x4b4993,{'showHidden':![],'depth':null}));};};exports[_0x2b10('0xb')]=function(_0x37a9cf,_0x5b98c5){logger[_0x2b10('0xc')](_0x37a9cf,util[_0x2b10('0xa')](_0x5b98c5,{'showHidden':![],'depth':null}));};exports[_0x2b10('0xd')]=function(_0xf54003,_0x860d03){logger['error'](_0xf54003,util['inspect'](_0x860d03,{'showHidden':![],'depth':null}));};exports[_0x2b10('0xe')]=function(_0x46ad86){return function(_0x4c9c6b){logger[_0x2b10('0xc')](_0x46ad86,util[_0x2b10('0xa')](_0x4c9c6b,{'showHidden':![],'depth':null}));};};exports[_0x2b10('0xf')]=function(_0x4fae1b,_0x49def1,_0x50ba94){return{'message':_0x4fae1b,'unlock':_0x49def1,'active':_0x50ba94};};exports[_0x2b10('0x10')]=function(_0x298f41,_0x149e46,_0x97321c){if(!_[_0x2b10('0x11')](_0x97321c)&&_0x2b10('0x12')===typeof _0x97321c&&!_[_0x2b10('0x13')](_0x97321c)){if(!_[_0x2b10('0x11')](_0x149e46)&&_0x2b10('0x12')===typeof _0x149e46&&!_['isEmpty'](_0x149e46)){return util['format'](_0x2b10('0x14'),_0x149e46,_0x97321c);}return util[_0x2b10('0x15')]('\x22%s\x22\x20<%s>',_0x97321c,_0x97321c);}if(!_[_0x2b10('0x11')](_0x298f41)&&'string'===typeof _0x298f41&&!_['isEmpty'](_0x298f41)){return _0x298f41;}return _0x2b10('0x16');};exports[_0x2b10('0x17')]=function(_0x2a19c8){if(_['isNil'](_0x2a19c8)){return![];}return _0x2a19c8;};exports[_0x2b10('0x18')]=function(_0x4d779f,_0x156e23,_0x270c7f,_0x17e167,_0x25690c,_0x25d88c){var _0x34c8e2={'XMD-QUEUE':_0x156e23[_0x2b10('0x19')]?_0x156e23['Queue']['name']:'','XMD-CALLERID':_0x17e167,'XMD-CALLERID-PREVIEW':_0x25d88c?util[_0x2b10('0x15')]('\x22%s\x22\x20<%s>',_0x25d88c[_0x2b10('0x1a')],_0x25d88c[_0x2b10('0x1b')]):_0x17e167,'XMD-DIALID':_0x25690c,'XMD-CONTACTID':_0x156e23[_0x2b10('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x17e167,'XMD-VOICEQUEUEID':_0x156e23['VoiceQueueId'],'XMD-DIALCHANNEL':_0x270c7f,'XMD-DIALTIMEOUT':_0x4d779f[_0x2b10('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x2b10('0x15')]('\x22rtTxX%s%s\x22',_0x4d779f[_0x2b10('0x1e')]?'g':'',_[_0x2b10('0x13')](_0x4d779f[_0x2b10('0x1f')])?'':_0x2b10('0x20')),'XMD-DIALURL':_0x4d779f['dialPreviewUrl']||'','XMD-AGI':_0x4d779f[_0x2b10('0x21')]?util['format'](_0x2b10('0x22'),ipAgi,_0x4d779f[_0x2b10('0x21')]):_0x2b10('0x23'),'XMD-AGIAFTER':_0x4d779f[_0x2b10('0x1e')]?util[_0x2b10('0x15')](_0x2b10('0x22'),ipAgi,_0x4d779f[_0x2b10('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x25d88c?_0x25d88c[_0x2b10('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x25d88c?_0x25d88c[_0x2b10('0x25')]:'','XMD-DESTINATION':_0x2b10('0x26')};if(!_['isEmpty'](_0x4d779f[_0x2b10('0x1f')])){_0x34c8e2[util[_0x2b10('0x15')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4d779f[_0x2b10('0x1f')];_0x34c8e2[util[_0x2b10('0x15')]('%s',_0x2b10('0x27'))]=_0x25690c;}if(_0x156e23&&_0x156e23[_0x2b10('0x28')]){for(var _0x30b7ca in _0x156e23[_0x2b10('0x28')]){if(_0x156e23['Contact'][_0x2b10('0x29')](_0x30b7ca)){if(!_[_0x2b10('0x2a')](_0x156e23[_0x2b10('0x28')][_0x30b7ca])&&_0x30b7ca!=='id'&&_0x30b7ca!=='tags'&&_0x30b7ca!==_0x2b10('0x2b')&&_0x30b7ca!=='updatedAt'){_0x34c8e2[util[_0x2b10('0x15')](_0x2b10('0x2c'),_0x2b10('0x2d'),_[_0x2b10('0x2e')](_0x30b7ca))]=_0x156e23[_0x2b10('0x28')][_0x30b7ca];}}}}return _0x34c8e2;};exports[_0x2b10('0x2f')]=function(_0x1e58ac){var _0x50b6c2={};for(var _0x21adc5 in _0x1e58ac){if(_0x1e58ac[_0x2b10('0x29')](_0x21adc5)){_0x50b6c2[util[_0x2b10('0x15')]('%s',_[_0x2b10('0x30')](_0x21adc5))]=_0x1e58ac[_0x21adc5];}}return{'variables':_0x50b6c2};};exports[_0x2b10('0x31')]=function(_0x119948,_0x52dd97){if(!_[_0x2b10('0x2a')](_0x119948)){if(_0x119948['hasOwnProperty'](_0x2b10('0x32'))){if(_0x119948['originated']>0x0){_0x119948[_0x2b10('0x32')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x52dd97);}}}else{logger['error'](_0x2b10('0x33'),_0x52dd97);}};exports[_0x2b10('0x34')]=function(_0x49fb4b){var _0x408069=moment()[_0x2b10('0x15')](_0x2b10('0x35'));_0x49fb4b['state']=0xd;_0x49fb4b[_0x2b10('0x36')]='Blacklist';_0x49fb4b[_0x2b10('0x37')]=_0x408069;_0x49fb4b[_0x2b10('0x38')]=_0x408069;_0x49fb4b[_0x2b10('0x39')]=_0x408069;};exports['logAgent']=function(_0x39e168,_0x394c4f,_0x1f3b71){var _0x584e48=moment()[_0x2b10('0x15')](_0x2b10('0x35'));_0x39e168['state']=_0x394c4f;_0x39e168['statedesc']=_0x1f3b71;_0x39e168[_0x2b10('0x38')]=_0x584e48;_0x39e168['ringtime']=getSeconds(_0x39e168[_0x2b10('0x38')],_0x39e168[_0x2b10('0x37')]);};exports[_0x2b10('0x3a')]=function(_0x2a7231,_0x136063,_0x35fba6){_0x2a7231[_0x2b10('0x3b')]=_0x136063;_0x2a7231['UserId']=_0x35fba6;};exports[_0x2b10('0x3c')]=function(_0x537332,_0x3121df,_0x3181ff){var _0x1df243=moment()['format'](_0x2b10('0x35'));_0x537332['state']=_0x3121df;_0x537332[_0x2b10('0x36')]=_0x3181ff;_0x537332[_0x2b10('0x38')]=_0x537332['responsetime']?_0x537332[_0x2b10('0x38')]:_0x1df243;_0x537332[_0x2b10('0x39')]=_0x537332[_0x2b10('0x39')]?_0x537332[_0x2b10('0x39')]:_0x1df243;_0x537332[_0x2b10('0x3d')]=getSeconds(_0x537332[_0x2b10('0x38')]||0x0,_0x537332['starttime']||0x0);_0x537332[_0x2b10('0x3e')]=_0x537332[_0x2b10('0x3f')]?getSeconds(_0x537332[_0x2b10('0x39')],_0x537332['answertime']):0x0;};exports[_0x2b10('0x40')]=function(_0xb0dbf7){return _0xb0dbf7===_0x2b10('0x41');};exports['variablesAction']=function(_0x339e17,_0x24b451,_0x378a48,_0x350460,_0x1189e5){var _0x36e731=_0x350460?_0x2b10('0x42'):_0x339e17['calleridname'];_0x36e731=_0x1189e5?_0x2b10('0x43'):_0x36e731;return{'actionid':_0x339e17[_0x2b10('0x44')],'action':_0x2b10('0x45'),'channel':_0x339e17['channelAgent'],'callerid':util[_0x2b10('0x15')](_0x2b10('0x14'),_0x36e731,_0x339e17[_0x2b10('0x1b')]),'Exten':_0x2b10('0x26'),'Context':'from-sip','Priority':'1','variable':_0x378a48,'timeout':(_0x24b451['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x339e17[_0x2b10('0x44')]};};exports[_0x2b10('0x46')]=function(_0x3e6528){return _0x3e6528[_0x2b10('0x47')]+_0x3e6528[_0x2b10('0x48')]+_0x3e6528[_0x2b10('0x49')]+_0x3e6528[_0x2b10('0x4a')]+_0x3e6528[_0x2b10('0x4b')];};exports[_0x2b10('0x4c')]=function(_0x1e299c){var _0x137cd3=_['clone'](_0x1e299c);_0x137cd3[_0x2b10('0x4d')]=0xf;_0x137cd3[_0x2b10('0x36')]='Global';return _0x137cd3;};exports['scheduledAt']=function(_0x548f74,_0x4579b6,_0x4d4b00){var _0xbfa5b1={};_0xbfa5b1[_0x4579b6]=_0x548f74[_0x4579b6];_0xbfa5b1[_0x2b10('0x4e')]=![];_0xbfa5b1[_0x2b10('0x4f')]=moment()[_0x2b10('0x50')](_0x4d4b00,_0x2b10('0x51'))[_0x2b10('0x15')](_0x2b10('0x35'));_0xbfa5b1[_0x2b10('0x1c')]=_0x548f74[_0x2b10('0x1c')];_0xbfa5b1['ListId']=_0x548f74[_0x2b10('0x52')];_0xbfa5b1[_0x2b10('0x53')]=_0x548f74['VoiceQueueId']||undefined;return _0xbfa5b1;};exports[_0x2b10('0x54')]=function(_0x19ccf5,_0x4fbbbe){if(!_[_0x2b10('0x2a')](_0x19ccf5)){if(_0x19ccf5[_0x2b10('0x55')]>0x0){_0x19ccf5[_0x2b10('0x55')]-=0x1;}else{logger[_0x2b10('0x56')](_0x4fbbbe,_0x2b10('0x57'));}}else{logger['error'](_0x4fbbbe,_0x2b10('0x58'));}};exports[_0x2b10('0x59')]=function(_0x434580){if(_0x434580<=0x0){return!![];}return![];};exports[_0x2b10('0x5a')]=function(_0x29896a,_0x4b44bb,_0x33c513){_0x29896a[_0x2b10('0x5b')]=_0x4b44bb;_0x29896a[_0x2b10('0x5c')]=_0x29896a['queue'];_0x29896a[_0x2b10('0x5d')]=_0x29896a['channelAgent'];if(_0x33c513){_0x29896a['mandatoryDisposition']=_0x33c513['mandatoryDisposition'];}return _0x29896a;};exports[_0x2b10('0x5e')]=function(_0x5059fc){var _0x455c1b={};_0x455c1b['queue']=_0x5059fc[_0x2b10('0x5f')];_0x455c1b[_0x2b10('0x5d')]=_0x5059fc['channelAgent'];_0x455c1b['uniqueid']=_0x5059fc['uniqueid'];return _0x455c1b;};exports[_0x2b10('0x60')]=function(_0x581d33){var _0x3ff37c=[];for(var _0x4e1b6e in _0x581d33){if(_0x581d33[_0x2b10('0x29')](_0x4e1b6e)){if(!_[_0x2b10('0x2a')](_0x581d33[_0x4e1b6e])&&_0x581d33[_0x4e1b6e]['state']===_0x2b10('0x61')&&_0x581d33[_0x4e1b6e][_0x2b10('0x62')]==='reachable'){_0x3ff37c[_0x2b10('0x63')](_0x581d33[_0x4e1b6e]['id']);}}}return _0x3ff37c;};exports[_0x2b10('0x64')]=function(_0x2a1159){var _0x6c5966=moment()[_0x2b10('0x7')](0x0);var _0xd903d1=moment(_0x2a1159)[_0x2b10('0x7')](0x0);return _0x6c5966[_0x2b10('0x8')](_0xd903d1,'seconds');};exports[_0x2b10('0x65')]=function(_0x2d4c8f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2d4c8f[_0x2b10('0x1c')],'ListId':_0x2d4c8f[_0x2b10('0x52')],'VoiceQueueId':_0x2d4c8f[_0x2b10('0x53')]||undefined,'CampaignId':_0x2d4c8f['CampaignId']||undefined};};exports[_0x2b10('0x66')]=function(_0x58a3b1){if(_0x58a3b1===_0x2b10('0x44')||_0x58a3b1===_0x2b10('0x67')||_0x58a3b1===_0x2b10('0x5f')||_0x58a3b1===_0x2b10('0x68')||_0x58a3b1===_0x2b10('0x69')||_0x58a3b1===_0x2b10('0x6a')||_0x58a3b1===_0x2b10('0x3b')||_0x58a3b1===_0x2b10('0x6b')||_0x58a3b1==='calleridname'||_0x58a3b1===_0x2b10('0x4e')||_0x58a3b1===_0x2b10('0x1b')||_0x58a3b1===_0x2b10('0x4f')||_0x58a3b1==='countbusyretry'||_0x58a3b1===_0x2b10('0x48')||_0x58a3b1==='countnoanswerretry'||_0x58a3b1===_0x2b10('0x6c')||_0x58a3b1===_0x2b10('0x6d')||_0x58a3b1===_0x2b10('0x6e')||_0x58a3b1===_0x2b10('0x6f')||_0x58a3b1===_0x2b10('0x70')||_0x58a3b1===_0x2b10('0x1c')||_0x58a3b1===_0x2b10('0x52')||_0x58a3b1===_0x2b10('0x71')||_0x58a3b1==='VoiceQueueId'||_0x58a3b1===_0x2b10('0x72')||_0x58a3b1===_0x2b10('0x73')||_0x58a3b1===_0x2b10('0x74')||_0x58a3b1===_0x2b10('0x75')||_0x58a3b1===_0x2b10('0x76')||_0x58a3b1===_0x2b10('0x77')||_0x58a3b1===_0x2b10('0x78')||_0x58a3b1==='xmd-dialoptions'||_0x58a3b1===_0x2b10('0x79')||_0x58a3b1===_0x2b10('0x7a')||_0x58a3b1===_0x2b10('0x7b')||_0x58a3b1===_0x2b10('0x7c')||_0x58a3b1==='xmd-callerid'||_0x58a3b1===_0x2b10('0x7d')||_0x58a3b1===_0x2b10('0x7e')||_0x58a3b1===_0x2b10('0x7f')||_0x58a3b1==='rtpaudioqosbridged'||_0x58a3b1==='rtpaudioqosjitter'||_0x58a3b1===_0x2b10('0x80')||_0x58a3b1===_0x2b10('0x81')||_0x58a3b1===_0x2b10('0x82')||_0x58a3b1===_0x2b10('0x83')||_0x58a3b1==='rtpaudioqosrttbridged'||_0x58a3b1===_0x2b10('0x7f')||_0x58a3b1===_0x2b10('0x84')||_0x58a3b1==='rtpaudioqosjitter'||_0x58a3b1===_0x2b10('0x80')||_0x58a3b1===_0x2b10('0x81')||_0x58a3b1==='rtpaudioqoslossbridged'||_0x58a3b1===_0x2b10('0x83')||_0x58a3b1===_0x2b10('0x85')||_0x58a3b1===_0x2b10('0x86')||_0x58a3b1===_0x2b10('0x87')||_0x58a3b1===_0x2b10('0x4d')||_0x58a3b1==='statedesc'){return![];}return!![];};exports[_0x2b10('0x88')]=function(_0xa3a97c,_0x48c2a7){var _0x2185be,_0x2d2638,_0x1dccd6;if(_0x48c2a7<=0x0){_0x48c2a7=0x1;}_0x2185be=new RegExp(_0x2b10('0x89')+_0x48c2a7+'}$');_0x2d2638=Math['pow'](0xa,_0x48c2a7-0x1);_0x1dccd6=Math[_0x2b10('0x8a')](0xa,_0x48c2a7)-0x1;return util[_0x2b10('0x15')]('%s',_['replace'](_0xa3a97c,_0x2185be,_[_0x2b10('0x8b')](_0x2d2638,_0x1dccd6)));};exports['extractCalleridName']=function(_0x3aa7bc){var _0x56612a=_0x3aa7bc[_0x2b10('0x8c')](/"(.*?)"/);return _0x56612a?_0x56612a[0x1]:_0x3aa7bc;};exports[_0x2b10('0x8d')]=function(_0x2c6925){var _0x259fa9=_0x2c6925[_0x2b10('0x8c')](/<(.*?)>/);return _0x259fa9?_0x259fa9[0x1]:_0x2c6925;}; \ No newline at end of file +var _0xc325=['answertime','isFailure','Failure','RECALL','calleridname','BOOKED','uniqueid','calleridnum','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','add','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','not_inuse','reachable','push','createBody','CampaignId','idContact','dialAnswer','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','format','isActive','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','ringtime','logLookAgent','UserId','logCustomer','starttime'];(function(_0x11a500,_0xaa37fd){var _0x2196a8=function(_0x3f31c0){while(--_0x3f31c0){_0x11a500['push'](_0x11a500['shift']());}};_0x2196a8(++_0xaa37fd);}(_0xc325,0x1d0));var _0x5c32=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc325[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0x5c32('0x0'));var _=require(_0x5c32('0x1'));var moment=require(_0x5c32('0x2'));var logger=require(_0x5c32('0x3'))(_0x5c32('0x4'));var ipAgi=process[_0x5c32('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x5f3371,_0x4b0385){var _0x468205=moment(_0x5f3371)[_0x5c32('0x6')](0x0);var _0x2db8ca=moment(_0x4b0385)[_0x5c32('0x6')](0x0);return _0x468205[_0x5c32('0x7')](_0x2db8ca,_0x5c32('0x8'));}exports[_0x5c32('0x9')]=function(_0xe1202c){return function(_0x559865){logger[_0x5c32('0xa')](_0xe1202c,util[_0x5c32('0xb')](_0x559865,{'showHidden':![],'depth':null}));};};exports[_0x5c32('0xc')]=function(_0x5cd3f9,_0x1e3f46){logger[_0x5c32('0xd')](_0x5cd3f9,util[_0x5c32('0xb')](_0x1e3f46,{'showHidden':![],'depth':null}));};exports[_0x5c32('0xe')]=function(_0x3fc366,_0x1268da){logger[_0x5c32('0xa')](_0x3fc366,util[_0x5c32('0xb')](_0x1268da,{'showHidden':![],'depth':null}));};exports[_0x5c32('0xf')]=function(_0x649a2d){return function(_0x34d53d){logger[_0x5c32('0xd')](_0x649a2d,util[_0x5c32('0xb')](_0x34d53d,{'showHidden':![],'depth':null}));};};exports[_0x5c32('0x10')]=function(_0x2d78b3,_0x23fc6c,_0x4e9f60){return{'message':_0x2d78b3,'unlock':_0x23fc6c,'active':_0x4e9f60};};exports[_0x5c32('0x11')]=function(_0x3c873e,_0xdb9f55,_0x308d49){if(!_[_0x5c32('0x12')](_0x308d49)&&'string'===typeof _0x308d49&&!_[_0x5c32('0x13')](_0x308d49)){if(!_[_0x5c32('0x12')](_0xdb9f55)&&_0x5c32('0x14')===typeof _0xdb9f55&&!_[_0x5c32('0x13')](_0xdb9f55)){return util['format']('\x22%s\x22\x20<%s>',_0xdb9f55,_0x308d49);}return util[_0x5c32('0x15')]('\x22%s\x22\x20<%s>',_0x308d49,_0x308d49);}if(!_[_0x5c32('0x12')](_0x3c873e)&&_0x5c32('0x14')===typeof _0x3c873e&&!_[_0x5c32('0x13')](_0x3c873e)){return _0x3c873e;}return'\x22\x22\x20<>';};exports[_0x5c32('0x16')]=function(_0x298d72){if(_[_0x5c32('0x17')](_0x298d72)){return![];}return _0x298d72;};exports[_0x5c32('0x18')]=function(_0x3943c6,_0x1dcc0b,_0x3c9099,_0xd34202,_0x26d8f5,_0x151503){var _0x39cc1f={'XMD-QUEUE':_0x1dcc0b[_0x5c32('0x19')]?_0x1dcc0b[_0x5c32('0x19')][_0x5c32('0x1a')]:'','XMD-CALLERID':_0xd34202,'XMD-CALLERID-PREVIEW':_0x151503?util[_0x5c32('0x15')](_0x5c32('0x1b'),_0x151503['calleridname'],_0x151503['calleridnum']):_0xd34202,'XMD-DIALID':_0x26d8f5,'XMD-CONTACTID':_0x1dcc0b['ContactId'],'XMD-CDRTYPE':_0x5c32('0x1c'),'CALLERID(all)':_0xd34202,'XMD-VOICEQUEUEID':_0x1dcc0b[_0x5c32('0x1d')],'XMD-DIALCHANNEL':_0x3c9099,'XMD-DIALTIMEOUT':_0x3943c6[_0x5c32('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x5c32('0x15')](_0x5c32('0x1f'),_0x3943c6[_0x5c32('0x20')]?'g':'',_['isEmpty'](_0x3943c6[_0x5c32('0x21')])?'':_0x5c32('0x22')),'XMD-DIALURL':_0x3943c6[_0x5c32('0x23')]||'','XMD-AGI':_0x3943c6[_0x5c32('0x24')]?util[_0x5c32('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3943c6[_0x5c32('0x24')]):'NONE','XMD-AGIAFTER':_0x3943c6[_0x5c32('0x20')]?util[_0x5c32('0x15')](_0x5c32('0x25'),ipAgi,_0x3943c6[_0x5c32('0x20')]):_0x5c32('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x151503?_0x151503['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x151503?_0x151503[_0x5c32('0x27')]:'','XMD-DESTINATION':_0x5c32('0x28')};if(!_[_0x5c32('0x13')](_0x3943c6[_0x5c32('0x21')])){_0x39cc1f[util['format']('%s',_0x5c32('0x29'))]=_0x3943c6[_0x5c32('0x21')];_0x39cc1f[util[_0x5c32('0x15')]('%s',_0x5c32('0x2a'))]=_0x26d8f5;}if(_0x1dcc0b&&_0x1dcc0b['Contact']){for(var _0x143d1c in _0x1dcc0b[_0x5c32('0x2b')]){if(_0x1dcc0b[_0x5c32('0x2b')][_0x5c32('0x2c')](_0x143d1c)){if(!_['isNil'](_0x1dcc0b[_0x5c32('0x2b')][_0x143d1c])&&_0x143d1c!=='id'&&_0x143d1c!=='tags'&&_0x143d1c!==_0x5c32('0x2d')&&_0x143d1c!==_0x5c32('0x2e')){_0x39cc1f[util['format'](_0x5c32('0x2f'),_0x5c32('0x30'),_['toUpper'](_0x143d1c))]=_0x1dcc0b[_0x5c32('0x2b')][_0x143d1c];}}}}return _0x39cc1f;};exports[_0x5c32('0x31')]=function(_0x18309f){var _0x41a0b6={};for(var _0x134228 in _0x18309f){if(_0x18309f['hasOwnProperty'](_0x134228)){_0x41a0b6[util[_0x5c32('0x15')]('%s',_[_0x5c32('0x32')](_0x134228))]=_0x18309f[_0x134228];}}return{'variables':_0x41a0b6};};exports[_0x5c32('0x33')]=function(_0x5f9b8f,_0x41f708){if(!_[_0x5c32('0x17')](_0x5f9b8f)){if(_0x5f9b8f['hasOwnProperty'](_0x5c32('0x34'))){if(_0x5f9b8f[_0x5c32('0x34')]>0x0){_0x5f9b8f[_0x5c32('0x34')]-=0x1;}else{logger[_0x5c32('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x41f708);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x41f708);}};exports['logBlacklist']=function(_0x945f0a){var _0x56de4f=moment()[_0x5c32('0x15')](_0x5c32('0x35'));_0x945f0a[_0x5c32('0x36')]=0xd;_0x945f0a[_0x5c32('0x37')]=_0x5c32('0x38');_0x945f0a['starttime']=_0x56de4f;_0x945f0a[_0x5c32('0x39')]=_0x56de4f;_0x945f0a[_0x5c32('0x3a')]=_0x56de4f;};exports['logAgent']=function(_0x1c6a26,_0x1f9f0a,_0x2d460d){var _0x48acf6=moment()[_0x5c32('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c6a26[_0x5c32('0x36')]=_0x1f9f0a;_0x1c6a26[_0x5c32('0x37')]=_0x2d460d;_0x1c6a26['responsetime']=_0x48acf6;_0x1c6a26[_0x5c32('0x3b')]=getSeconds(_0x1c6a26[_0x5c32('0x39')],_0x1c6a26['starttime']);};exports[_0x5c32('0x3c')]=function(_0x579138,_0x93354b,_0xe330b1){_0x579138['membername']=_0x93354b;_0x579138[_0x5c32('0x3d')]=_0xe330b1;};exports[_0x5c32('0x3e')]=function(_0x2185aa,_0x13ccbb,_0x12ab7b){var _0x5d02a1=moment()[_0x5c32('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x2185aa[_0x5c32('0x36')]=_0x13ccbb;_0x2185aa['statedesc']=_0x12ab7b;_0x2185aa[_0x5c32('0x39')]=_0x2185aa[_0x5c32('0x39')]?_0x2185aa[_0x5c32('0x39')]:_0x5d02a1;_0x2185aa[_0x5c32('0x3a')]=_0x2185aa['endtime']?_0x2185aa['endtime']:_0x5d02a1;_0x2185aa['ringtime']=getSeconds(_0x2185aa[_0x5c32('0x39')]||0x0,_0x2185aa[_0x5c32('0x3f')]||0x0);_0x2185aa['talktime']=_0x2185aa[_0x5c32('0x40')]?getSeconds(_0x2185aa[_0x5c32('0x3a')],_0x2185aa[_0x5c32('0x40')]):0x0;};exports[_0x5c32('0x41')]=function(_0x15a8f6){return _0x15a8f6===_0x5c32('0x42');};exports['variablesAction']=function(_0x20527f,_0x39f3a8,_0x1871a1,_0x297d9b,_0x366da9){var _0x1cfc6f=_0x297d9b?_0x5c32('0x43'):_0x20527f[_0x5c32('0x44')];_0x1cfc6f=_0x366da9?_0x5c32('0x45'):_0x1cfc6f;return{'actionid':_0x20527f[_0x5c32('0x46')],'action':'originate','channel':_0x20527f['channelAgent'],'callerid':util[_0x5c32('0x15')]('\x22%s\x22\x20<%s>',_0x1cfc6f,_0x20527f[_0x5c32('0x47')]),'Exten':'xcally-motion-preview','Context':_0x5c32('0x48'),'Priority':'1','variable':_0x1871a1,'timeout':(_0x39f3a8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x20527f[_0x5c32('0x46')]};};exports[_0x5c32('0x49')]=function(_0x38e5f7){return _0x38e5f7[_0x5c32('0x4a')]+_0x38e5f7[_0x5c32('0x4b')]+_0x38e5f7[_0x5c32('0x4c')]+_0x38e5f7[_0x5c32('0x4d')]+_0x38e5f7[_0x5c32('0x4e')];};exports[_0x5c32('0x4f')]=function(_0x4e6dca){var _0x7d5ee3=_['clone'](_0x4e6dca);_0x7d5ee3[_0x5c32('0x36')]=0xf;_0x7d5ee3[_0x5c32('0x37')]=_0x5c32('0x50');return _0x7d5ee3;};exports[_0x5c32('0x51')]=function(_0x3759d1,_0x28969f,_0xa0fdc0){var _0x323005={};_0x323005[_0x28969f]=_0x3759d1[_0x28969f];_0x323005[_0x5c32('0x52')]=![];_0x323005[_0x5c32('0x53')]=moment()[_0x5c32('0x54')](_0xa0fdc0,'minutes')['format'](_0x5c32('0x35'));_0x323005[_0x5c32('0x55')]=_0x3759d1[_0x5c32('0x55')];_0x323005[_0x5c32('0x56')]=_0x3759d1[_0x5c32('0x56')];_0x323005[_0x5c32('0x1d')]=_0x3759d1[_0x5c32('0x1d')]||undefined;return _0x323005;};exports['decrementTalkink']=function(_0x5ce82a,_0x6c90df){if(!_[_0x5c32('0x17')](_0x5ce82a)){if(_0x5ce82a['pTalking']>0x0){_0x5ce82a[_0x5c32('0x57')]-=0x1;}else{logger[_0x5c32('0xa')](_0x6c90df,_0x5c32('0x58'));}}else{logger[_0x5c32('0xa')](_0x6c90df,_0x5c32('0x59'));}};exports[_0x5c32('0x5a')]=function(_0x412fce){if(_0x412fce<=0x0){return!![];}return![];};exports[_0x5c32('0x5b')]=function(_0xabf321,_0x538fe0,_0x89b6c0){_0xabf321[_0x5c32('0x5c')]=_0x538fe0;_0xabf321[_0x5c32('0x1a')]=_0xabf321[_0x5c32('0x5d')];_0xabf321[_0x5c32('0x5e')]=_0xabf321[_0x5c32('0x5f')];if(_0x89b6c0){_0xabf321[_0x5c32('0x60')]=_0x89b6c0[_0x5c32('0x60')];}return _0xabf321;};exports['buildAcw']=function(_0x4fe396){var _0x306f28={};_0x306f28['queue']=_0x4fe396[_0x5c32('0x5d')];_0x306f28[_0x5c32('0x5e')]=_0x4fe396[_0x5c32('0x5f')];_0x306f28[_0x5c32('0x46')]=_0x4fe396['uniqueid'];return _0x306f28;};exports['agentReadyId']=function(_0x1df51c){var _0x2361b0=[];for(var _0x154760 in _0x1df51c){if(_0x1df51c[_0x5c32('0x2c')](_0x154760)){if(!_[_0x5c32('0x17')](_0x1df51c[_0x154760])&&_0x1df51c[_0x154760][_0x5c32('0x36')]===_0x5c32('0x61')&&_0x1df51c[_0x154760]['status']===_0x5c32('0x62')){_0x2361b0[_0x5c32('0x63')](_0x1df51c[_0x154760]['id']);}}}return _0x2361b0;};exports['getDiff']=function(_0xb7b51){var _0x5aa980=moment()['milliseconds'](0x0);var _0x34395e=moment(_0xb7b51)[_0x5c32('0x6')](0x0);return _0x5aa980['diff'](_0x34395e,_0x5c32('0x8'));};exports[_0x5c32('0x64')]=function(_0x4e37a3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e37a3['ContactId'],'ListId':_0x4e37a3[_0x5c32('0x56')],'VoiceQueueId':_0x4e37a3[_0x5c32('0x1d')]||undefined,'CampaignId':_0x4e37a3[_0x5c32('0x65')]||undefined};};exports['filterKey']=function(_0x47779f){if(_0x47779f===_0x5c32('0x46')||_0x47779f===_0x5c32('0x66')||_0x47779f==='queue'||_0x47779f==='type'||_0x47779f==='campaigntype'||_0x47779f===_0x5c32('0x67')||_0x47779f==='membername'||_0x47779f==='channelAgent'||_0x47779f==='calleridname'||_0x47779f===_0x5c32('0x52')||_0x47779f===_0x5c32('0x47')||_0x47779f===_0x5c32('0x53')||_0x47779f==='countbusyretry'||_0x47779f===_0x5c32('0x4b')||_0x47779f==='countnoanswerretry'||_0x47779f===_0x5c32('0x68')||_0x47779f==='callback'||_0x47779f===_0x5c32('0x69')||_0x47779f===_0x5c32('0x6a')||_0x47779f==='recallme'||_0x47779f==='ContactId'||_0x47779f===_0x5c32('0x56')||_0x47779f==='UserId'||_0x47779f==='VoiceQueueId'||_0x47779f===_0x5c32('0x6b')||_0x47779f==='xmd-voicequeueid'||_0x47779f==='xmd-queue'||_0x47779f===_0x5c32('0x6c')||_0x47779f==='xmd-listid'||_0x47779f===_0x5c32('0x6d')||_0x47779f==='xmd-dialtimeout'||_0x47779f===_0x5c32('0x6e')||_0x47779f===_0x5c32('0x6f')||_0x47779f===_0x5c32('0x70')||_0x47779f===_0x5c32('0x71')||_0x47779f===_0x5c32('0x72')||_0x47779f===_0x5c32('0x73')||_0x47779f===_0x5c32('0x74')||_0x47779f===_0x5c32('0x75')||_0x47779f==='rtpaudioqos'||_0x47779f==='rtpaudioqosbridged'||_0x47779f===_0x5c32('0x76')||_0x47779f===_0x5c32('0x77')||_0x47779f===_0x5c32('0x78')||_0x47779f==='rtpaudioqoslossbridged'||_0x47779f===_0x5c32('0x79')||_0x47779f===_0x5c32('0x7a')||_0x47779f==='rtpaudioqos'||_0x47779f===_0x5c32('0x7b')||_0x47779f==='rtpaudioqosjitter'||_0x47779f===_0x5c32('0x77')||_0x47779f==='rtpaudioqosloss'||_0x47779f===_0x5c32('0x7c')||_0x47779f===_0x5c32('0x79')||_0x47779f===_0x5c32('0x7a')||_0x47779f===_0x5c32('0x7d')||_0x47779f===_0x5c32('0x7e')||_0x47779f===_0x5c32('0x36')||_0x47779f===_0x5c32('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x11be29,_0x186602){var _0x494d06,_0x3181b8,_0x92e365;if(_0x186602<=0x0){_0x186602=0x1;}_0x494d06=new RegExp('\x5cw{0,'+_0x186602+'}$');_0x3181b8=Math[_0x5c32('0x7f')](0xa,_0x186602-0x1);_0x92e365=Math[_0x5c32('0x7f')](0xa,_0x186602)-0x1;return util[_0x5c32('0x15')]('%s',_[_0x5c32('0x80')](_0x11be29,_0x494d06,_[_0x5c32('0x81')](_0x3181b8,_0x92e365)));};exports['extractCalleridName']=function(_0x1eb134){var _0x46d75c=_0x1eb134[_0x5c32('0x82')](/"(.*?)"/);return _0x46d75c?_0x46d75c[0x1]:_0x1eb134;};exports[_0x5c32('0x83')]=function(_0x2d3cd3){var _0x10914c=_0x2d3cd3[_0x5c32('0x82')](/<(.*?)>/);return _0x10914c?_0x10914c[0x1]:_0x2d3cd3;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 7d41ccc..de52ed4 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x4128ea,_0x38c497){var _0x68081=function(_0x3c3d61){while(--_0x3c3d61){_0x4128ea['push'](_0x4128ea['shift']());}};_0x68081(++_0x38c497);}(_0x5f2f,0x73));var _0xf5f2=function(_0x49c731,_0x35db5c){_0x49c731=_0x49c731-0x0;var _0x35d3fb=_0x5f2f[_0x49c731];return _0x35d3fb;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x595267,_0x571349){var _0x58d166=function(_0x3a5606){while(--_0x3a5606){_0x595267['push'](_0x595267['shift']());}};_0x58d166(++_0x571349);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0xb10b[_0x1a595a];return _0x33f008;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index f0db844..f4147eb 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a8d=['initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallerjoinAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','faxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initTrunks','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initZohoAccounts','zohoAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts'];(function(_0x58fc72,_0x200c34){var _0x6daa8c=function(_0x541715){while(--_0x541715){_0x58fc72['push'](_0x58fc72['shift']());}};_0x6daa8c(++_0x200c34);}(_0x3a8d,0x150));var _0xd3a8=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0x3a8d[_0x40d8d7];return _0x3454cc;};'use strict';var BPromise=require(_0xd3a8('0x0'));var util=require('util');var _=require(_0xd3a8('0x1'));var moment=require(_0xd3a8('0x2'));var Agent=require(_0xd3a8('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0xd3a8('0x4'));var VoiceQueue=require(_0xd3a8('0x5'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0xd3a8('0x6'));var VoiceExtension=require(_0xd3a8('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xd3a8('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xd3a8('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xd3a8('0xa'));var VtigerAccount=require(_0xd3a8('0xb'));var ServicenowAccount=require(_0xd3a8('0xc'));var Dynamics365Account=require(_0xd3a8('0xd'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xd3a8('0xe'));var Realtime=function(){this[_0xd3a8('0xf')]={};this[_0xd3a8('0x10')]={};this[_0xd3a8('0x11')]={};this['voiceQueues']={};this[_0xd3a8('0x12')]={};this['campaigns']={};this[_0xd3a8('0x13')]={};this[_0xd3a8('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd3a8('0x15')]={};this[_0xd3a8('0x16')]={};this[_0xd3a8('0x17')]={};this[_0xd3a8('0x18')]={};this['timers']={};this[_0xd3a8('0x19')]={};this['salesforceAccounts']={};this[_0xd3a8('0x1a')]={};this[_0xd3a8('0x1b')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xd3a8('0x1c')]={};this[_0xd3a8('0x1d')]={};this[_0xd3a8('0x1e')]={};this[_0xd3a8('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x556394,_0x3011f7,_0x3cce0b){var _0x42e4c3=_[_0xd3a8('0x20')](_0x556394,function(_0x1cb46e,_0x423e37){return _0x1cb46e[_0x3cce0b];});for(var _0x173ed7 in _0x3011f7){if(_0x3011f7[_0xd3a8('0x21')](_0x173ed7)){if(!_0x42e4c3[_0x173ed7]){delete _0x3011f7[_0x173ed7];}}}}function freeIsNotKeySip(_0x30bdd1,_0x5bf840){var _0x44a1b8=_[_0xd3a8('0x20')](_0x30bdd1,function(_0x2adc6c,_0x7d038){return util[_0xd3a8('0x22')](_0xd3a8('0x23'),_0x2adc6c[_0xd3a8('0x24')]);});for(var _0x2fd808 in _0x5bf840){if(_0x5bf840[_0xd3a8('0x21')](_0x2fd808)){if(!_0x44a1b8[_0x2fd808]){delete _0x5bf840[_0x2fd808];}}}}function freeIsNotKeyAgent(_0x40333d,_0x438912){var _0x184bc1=_[_0xd3a8('0x20')](_0x40333d,function(_0x1ebf33,_0x38937b){var _0x26e375=_[_0xd3a8('0x25')](_0x1ebf33[_0xd3a8('0x26')])?util[_0xd3a8('0x22')](_0xd3a8('0x23'),_0x1ebf33[_0xd3a8('0x24')]):_0x1ebf33[_0xd3a8('0x26')];return _0x26e375;});for(var _0x4f524c in _0x438912){if(_0x438912[_0xd3a8('0x21')](_0x4f524c)){if(!_0x184bc1[_0x4f524c]){delete _0x438912[_0x4f524c];}}}}function clearVoiceCallReports(_0x32b2a9){_0x32b2a9[_0xd3a8('0x27')]=0x0;_0x32b2a9['answered']=0x0;_0x32b2a9[_0xd3a8('0x28')]=0x0;_0x32b2a9[_0xd3a8('0x29')]=0x0;_0x32b2a9[_0xd3a8('0x2a')]=0x0;}function clearCampaigns(_0x24958a){if(!_[_0xd3a8('0x2b')](_0x24958a)){for(var _0x4d2fea in _0x24958a){if(_0x24958a['hasOwnProperty'](_0x4d2fea)){_0x24958a[_0x4d2fea][_0xd3a8('0x2c')]=0x0;_0x24958a[_0x4d2fea]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xa1fad6){if(!_['isEmpty'](_0xa1fad6)){for(var _0x88125f in _0xa1fad6){if(_0xa1fad6[_0xd3a8('0x21')](_0x88125f)){_0xa1fad6[_0x88125f]['total']=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x2d')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x2e')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x2f')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x28')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x29')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x2a')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x30')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x31')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x32')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x33')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x34')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x35')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x36')]=0x0;_0xa1fad6[_0x88125f]['outboundDropCallsDayCallersExit']=0x0;_0xa1fad6[_0x88125f]['outboundBlacklistCallsDay']=0x0;_0xa1fad6[_0x88125f]['outboundOriginateFailureCallsDay']=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x37')]=0x0;_0xa1fad6[_0x88125f]['outboundReCallsDay']=0x0;_0xa1fad6[_0x88125f]['outboundAnswerAgiCallsDay']=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x38')]=0x0;_0xa1fad6[_0x88125f][_0xd3a8('0x39')]=!![];}}}}Realtime['prototype'][_0xd3a8('0x3a')]=function(_0x136106,_0x4c4338){for(var _0x4bfe19 in _0x4c4338){if(_0x136106[_0xd3a8('0x21')](_0x4bfe19)){_0x136106[_0x4bfe19]=_0x4c4338[_0x4bfe19];}}};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x3c')]=function(){var _0x4a9056=this;return function(_0x251e67){if(_0x251e67){freeIsNotKeyAgent(_0x251e67,_0x4a9056[_0xd3a8('0xf')]);for(var _0x338f63=0x0,_0x97032e={},_0x3288d8={};_0x338f63<_0x251e67[_0xd3a8('0x3d')];_0x338f63+=0x1){_0x97032e=_0x251e67[_0x338f63];var _0x480659=_[_0xd3a8('0x25')](_0x97032e[_0xd3a8('0x26')])?util[_0xd3a8('0x22')]('SIP/%s',_0x97032e[_0xd3a8('0x24')]):_0x97032e[_0xd3a8('0x26')];if(_[_0xd3a8('0x3e')](_0x4a9056[_0xd3a8('0xf')][_0x480659])){_0x4a9056[_0xd3a8('0xf')][_0x480659]=new Agent(_0x97032e);}else{_0x4a9056[_0xd3a8('0x3a')](_0x4a9056[_0xd3a8('0xf')][_0x480659],_0x97032e);}}}return _0x4a9056[_0xd3a8('0xf')];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x3f')]=function(){var _0x5878b2=this;return function(_0x55c417){if(_0x55c417){freeIsNotKeySip(_0x55c417,_0x5878b2[_0xd3a8('0x10')]);for(var _0x50c5fa=0x0,_0x19b117={},_0x190a1b={};_0x50c5fa<_0x55c417['length'];_0x50c5fa+=0x1){_0x19b117=_0x55c417[_0x50c5fa];if(_[_0xd3a8('0x3e')](_0x5878b2[_0xd3a8('0x10')][util['format'](_0xd3a8('0x23'),_0x19b117[_0xd3a8('0x24')])])){_0x5878b2['telephones'][util['format'](_0xd3a8('0x23'),_0x19b117[_0xd3a8('0x24')])]=new Telephone(_0x19b117);}else{_0x5878b2[_0xd3a8('0x3a')](_0x5878b2['telephones'][util[_0xd3a8('0x22')](_0xd3a8('0x23'),_0x19b117['name'])],_0x19b117);}}}return _0x5878b2[_0xd3a8('0x10')];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x40')]=function(){var _0xed7b7d=this;return function(_0x3dcc1c){if(_0x3dcc1c){freeIsNotKeySip(_0x3dcc1c,_0xed7b7d[_0xd3a8('0x11')]);for(var _0x597701=0x0,_0x2a2b7d={},_0x1bd7cf={};_0x597701<_0x3dcc1c[_0xd3a8('0x3d')];_0x597701+=0x1){_0x2a2b7d=_0x3dcc1c[_0x597701];if(_[_0xd3a8('0x3e')](_0xed7b7d[_0xd3a8('0x11')][util[_0xd3a8('0x22')](_0xd3a8('0x23'),_0x2a2b7d['name'])])){_0xed7b7d[_0xd3a8('0x11')][util[_0xd3a8('0x22')](_0xd3a8('0x23'),_0x2a2b7d[_0xd3a8('0x24')])]=new Trunk(_0x2a2b7d);}else{_0xed7b7d[_0xd3a8('0x3a')](_0xed7b7d[_0xd3a8('0x11')][util['format'](_0xd3a8('0x23'),_0x2a2b7d[_0xd3a8('0x24')])],_0x2a2b7d);}}}return _0xed7b7d[_0xd3a8('0x11')];};};Realtime[_0xd3a8('0x3b')]['initVoiceQueues']=function(){var _0x6af5e8=this;return function(_0x11d53f){if(_0x11d53f){freeIsNotKey(_0x11d53f,_0x6af5e8[_0xd3a8('0x41')],_0xd3a8('0x24'));for(var _0x226b3a=0x0,_0x4b36d8={},_0x2e2a32={};_0x226b3a<_0x11d53f['length'];_0x226b3a+=0x1){_0x4b36d8=_0x11d53f[_0x226b3a];if(_[_0xd3a8('0x3e')](_0x6af5e8['voiceQueues'][_0x4b36d8['name']])){_0x6af5e8[_0xd3a8('0x41')][_0x4b36d8['name']]=new VoiceQueue(_0x4b36d8);}else{_0x6af5e8[_0xd3a8('0x3a')](_0x6af5e8[_0xd3a8('0x41')][_0x4b36d8[_0xd3a8('0x24')]],_0x4b36d8);}}}return _0x6af5e8['voiceQueues'];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x42')]=function(){var _0x49c80b=this;return function(_0x33deb7){if(_0x33deb7){freeIsNotKey(_0x33deb7,_0x49c80b[_0xd3a8('0x12')],'id');for(var _0x5f5337=0x0,_0x1c5507={},_0x49e3d0={};_0x5f5337<_0x33deb7[_0xd3a8('0x3d')];_0x5f5337+=0x1){_0x1c5507=_0x33deb7[_0x5f5337];if(_[_0xd3a8('0x3e')](_0x49c80b[_0xd3a8('0x12')][_0x1c5507['id']])){_0x49c80b[_0xd3a8('0x12')][_0x1c5507['id']]=new Trigger(_0x1c5507);}else{_0x49c80b[_0xd3a8('0x3a')](_0x49c80b[_0xd3a8('0x12')][_0x1c5507['id']],_0x1c5507);}}}return _0x49c80b[_0xd3a8('0x12')];};};Realtime['prototype'][_0xd3a8('0x43')]=function(){var _0x58971c=this;return function(_0x3a399a){if(_0x3a399a){freeIsNotKey(_0x3a399a,_0x58971c[_0xd3a8('0x13')],'id');for(var _0x4fd8c7=0x0,_0x44aaa2={},_0x2c420c={};_0x4fd8c7<_0x3a399a[_0xd3a8('0x3d')];_0x4fd8c7+=0x1){_0x44aaa2=_0x3a399a[_0x4fd8c7];if(_[_0xd3a8('0x3e')](_0x58971c[_0xd3a8('0x13')][_0x44aaa2['id']])){_0x58971c['templates'][_0x44aaa2['id']]=new Template(_0x44aaa2);}else{_0x58971c[_0xd3a8('0x3a')](_0x58971c[_0xd3a8('0x13')][_0x44aaa2['id']],_0x44aaa2);}}}return _0x58971c[_0xd3a8('0x13')];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x44')]=function(){var _0x2ca0df=this;return function(_0x5698a9){if(_0x5698a9){freeIsNotKey(_0x5698a9,_0x2ca0df[_0xd3a8('0x19')],'id');for(var _0x3fa7f3=0x0,_0x1dfa9c={},_0x70d6b3={};_0x3fa7f3<_0x5698a9[_0xd3a8('0x3d')];_0x3fa7f3+=0x1){_0x1dfa9c=_0x5698a9[_0x3fa7f3];if(_[_0xd3a8('0x3e')](_0x2ca0df[_0xd3a8('0x19')][_0x1dfa9c['id']])){_0x2ca0df[_0xd3a8('0x19')][_0x1dfa9c['id']]=new ZendeskAccount(_0x1dfa9c);}else{_0x2ca0df['mergeFromDatabase'](_0x2ca0df[_0xd3a8('0x19')][_0x1dfa9c['id']],_0x1dfa9c);}}}return _0x2ca0df[_0xd3a8('0x19')];};};Realtime['prototype'][_0xd3a8('0x45')]=function(){var _0x567c60=this;return function(_0x1ff839){if(_0x1ff839){freeIsNotKey(_0x1ff839,_0x567c60['salesforceAccounts'],'id');for(var _0x4d974d=0x0,_0x4d04ba={},_0x570d75={};_0x4d974d<_0x1ff839[_0xd3a8('0x3d')];_0x4d974d+=0x1){_0x4d04ba=_0x1ff839[_0x4d974d];if(_[_0xd3a8('0x3e')](_0x567c60['salesforceAccounts'][_0x4d04ba['id']])){_0x567c60['salesforceAccounts'][_0x4d04ba['id']]=new SalesforceAccount(_0x4d04ba);}else{_0x567c60[_0xd3a8('0x3a')](_0x567c60['salesforceAccounts'][_0x4d04ba['id']],_0x4d04ba);}}}return _0x567c60[_0xd3a8('0x46')];};};Realtime[_0xd3a8('0x3b')]['initFreshdeskAccounts']=function(){var _0x2aba45=this;return function(_0x4f2eaa){if(_0x4f2eaa){freeIsNotKey(_0x4f2eaa,_0x2aba45[_0xd3a8('0x1b')],'id');for(var _0x3fd1c0=0x0,_0x2bed7a={},_0x343674={};_0x3fd1c0<_0x4f2eaa['length'];_0x3fd1c0+=0x1){_0x2bed7a=_0x4f2eaa[_0x3fd1c0];if(_[_0xd3a8('0x3e')](_0x2aba45[_0xd3a8('0x1b')][_0x2bed7a['id']])){_0x2aba45[_0xd3a8('0x1b')][_0x2bed7a['id']]=new FreshdeskAccount(_0x2bed7a);}else{_0x2aba45[_0xd3a8('0x3a')](_0x2aba45[_0xd3a8('0x1b')][_0x2bed7a['id']],_0x2bed7a);}}}return _0x2aba45[_0xd3a8('0x1b')];};};Realtime['prototype'][_0xd3a8('0x47')]=function(){var _0x29619b=this;return function(_0x4cfe6c){if(_0x4cfe6c){freeIsNotKey(_0x4cfe6c,_0x29619b['zohoAccounts'],'id');for(var _0x3a59e3=0x0,_0x2b73f2={},_0x3a0e74={};_0x3a59e3<_0x4cfe6c[_0xd3a8('0x3d')];_0x3a59e3+=0x1){_0x2b73f2=_0x4cfe6c[_0x3a59e3];if(_[_0xd3a8('0x3e')](_0x29619b['zohoAccounts'][_0x2b73f2['id']])){_0x29619b['zohoAccounts'][_0x2b73f2['id']]=new ZohoAccount(_0x2b73f2);}else{_0x29619b[_0xd3a8('0x3a')](_0x29619b[_0xd3a8('0x48')][_0x2b73f2['id']],_0x2b73f2);}}}return _0x29619b[_0xd3a8('0x48')];};};Realtime[_0xd3a8('0x3b')]['initDeskAccounts']=function(){var _0x33f17c=this;return function(_0x2e5726){if(_0x2e5726){freeIsNotKey(_0x2e5726,_0x33f17c[_0xd3a8('0x49')],'id');for(var _0x17675d=0x0,_0x71e0f2={},_0x47bdcc={};_0x17675d<_0x2e5726[_0xd3a8('0x3d')];_0x17675d+=0x1){_0x71e0f2=_0x2e5726[_0x17675d];if(_[_0xd3a8('0x3e')](_0x33f17c[_0xd3a8('0x49')][_0x71e0f2['id']])){_0x33f17c['deskAccounts'][_0x71e0f2['id']]=new DeskAccount(_0x71e0f2);}else{_0x33f17c[_0xd3a8('0x3a')](_0x33f17c['deskAccounts'][_0x71e0f2['id']],_0x71e0f2);}}}return _0x33f17c[_0xd3a8('0x49')];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x4a')]=function(){var _0x4d49b5=this;return function(_0x4afdeb){if(_0x4afdeb){freeIsNotKey(_0x4afdeb,_0x4d49b5[_0xd3a8('0x1a')],'id');for(var _0x18776f=0x0,_0x32a31a={},_0x918cf4={};_0x18776f<_0x4afdeb['length'];_0x18776f+=0x1){_0x32a31a=_0x4afdeb[_0x18776f];if(_['isUndefined'](_0x4d49b5[_0xd3a8('0x1a')][_0x32a31a['id']])){_0x4d49b5[_0xd3a8('0x1a')][_0x32a31a['id']]=new SugarcrmAccount(_0x32a31a);}else{_0x4d49b5[_0xd3a8('0x3a')](_0x4d49b5[_0xd3a8('0x1a')][_0x32a31a['id']],_0x32a31a);}}}return _0x4d49b5[_0xd3a8('0x1a')];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x4b')]=function(){var _0x31708b=this;return function(_0x290333){if(_0x290333){freeIsNotKey(_0x290333,_0x31708b[_0xd3a8('0x1c')],'id');for(var _0x403ec8=0x0,_0x5129a8={},_0x29017e={};_0x403ec8<_0x290333[_0xd3a8('0x3d')];_0x403ec8+=0x1){_0x5129a8=_0x290333[_0x403ec8];if(_['isUndefined'](_0x31708b[_0xd3a8('0x1c')][_0x5129a8['id']])){_0x31708b['vtigerAccounts'][_0x5129a8['id']]=new VtigerAccount(_0x5129a8);}else{_0x31708b['mergeFromDatabase'](_0x31708b[_0xd3a8('0x1c')][_0x5129a8['id']],_0x5129a8);}}}return _0x31708b['vtigerAccounts'];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x4c')]=function(){var _0xbeacad=this;return function(_0xa84794){if(_0xa84794){freeIsNotKey(_0xa84794,_0xbeacad['servicenowAccounts'],'id');for(var _0x3792c6=0x0,_0x2622f4={},_0x4a06df={};_0x3792c6<_0xa84794[_0xd3a8('0x3d')];_0x3792c6+=0x1){_0x2622f4=_0xa84794[_0x3792c6];if(_['isUndefined'](_0xbeacad[_0xd3a8('0x1d')][_0x2622f4['id']])){_0xbeacad[_0xd3a8('0x1d')][_0x2622f4['id']]=new ServicenowAccount(_0x2622f4);}else{_0xbeacad[_0xd3a8('0x3a')](_0xbeacad[_0xd3a8('0x1d')][_0x2622f4['id']],_0x2622f4);}}}return _0xbeacad[_0xd3a8('0x1d')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x1ef34a=this;return function(_0x107a9b){if(_0x107a9b){freeIsNotKey(_0x107a9b,_0x1ef34a[_0xd3a8('0x1e')],'id');for(var _0x436585=0x0,_0x261ac1={},_0x4eb682={};_0x436585<_0x107a9b[_0xd3a8('0x3d')];_0x436585+=0x1){_0x261ac1=_0x107a9b[_0x436585];if(_['isUndefined'](_0x1ef34a[_0xd3a8('0x1e')][_0x261ac1['id']])){_0x1ef34a[_0xd3a8('0x1e')][_0x261ac1['id']]=new Dynamics365Account(_0x261ac1);}else{_0x1ef34a[_0xd3a8('0x3a')](_0x1ef34a[_0xd3a8('0x1e')][_0x261ac1['id']],_0x261ac1);}}}return _0x1ef34a[_0xd3a8('0x1e')];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x4d')]=function(){var _0xfcbdfc=this;return function(_0x312fd8){if(_0x312fd8){freeIsNotKey(_0x312fd8,_0xfcbdfc[_0xd3a8('0x1f')],'id');for(var _0x4ea57e=0x0,_0x3ee8d8={},_0x2a5ce9={};_0x4ea57e<_0x312fd8[_0xd3a8('0x3d')];_0x4ea57e+=0x1){_0x3ee8d8=_0x312fd8[_0x4ea57e];if(_[_0xd3a8('0x3e')](_0xfcbdfc[_0xd3a8('0x1f')][_0x3ee8d8['id']])){_0xfcbdfc[_0xd3a8('0x1f')][_0x3ee8d8['id']]=new FreshsalesAccount(_0x3ee8d8);}else{_0xfcbdfc['mergeFromDatabase'](_0xfcbdfc['freshsalesAccounts'][_0x3ee8d8['id']],_0x3ee8d8);}}}return _0xfcbdfc['freshsalesAccounts'];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x4e')]=function(){var _0x73b25b=this;return function(_0x59da9e){for(var _0x12577b=0x0;_0x12577b<_0x59da9e[_0xd3a8('0x3d')];_0x12577b+=0x1){_[_0xd3a8('0x4f')](_0x73b25b[_0xd3a8('0x41')][_0x59da9e[_0x12577b][_0xd3a8('0x24')]],_0x59da9e[_0x12577b]);}return _0x73b25b[_0xd3a8('0x41')];};};Realtime['prototype'][_0xd3a8('0x50')]=function(){var _0x45cbe3=this;return function(_0x2ff8e2){clearVoiceQueues(_0x45cbe3[_0xd3a8('0x41')]);if(_0x2ff8e2){_0x2ff8e2=_[_0xd3a8('0x51')](_0x2ff8e2,_0xd3a8('0x52'));for(var _0x3252b0 in _0x2ff8e2){if(_0x2ff8e2['hasOwnProperty'](_0x3252b0)){var _0x242f70={};for(var _0x1b851e=0x0;_0x1b851e<_0x2ff8e2[_0x3252b0][_0xd3a8('0x3d')];_0x1b851e+=0x1){var _0x593154=_0x2ff8e2[_0x3252b0][_0x1b851e][_0xd3a8('0x53')];if(_0x45cbe3[_0xd3a8('0x41')][_0x593154]){if(_0x2ff8e2[_0x3252b0][_0x1b851e]['queuecallerexit']){_0x45cbe3[_0xd3a8('0x41')][_0x593154][_0xd3a8('0x2e')]+=0x1;}if(_0x2ff8e2[_0x3252b0][_0x1b851e]['queuecallerabandon']){_0x45cbe3['voiceQueues'][_0x593154][_0xd3a8('0x2f')]+=0x1;}_0x45cbe3['voiceQueues'][_0x593154][_0xd3a8('0x28')]+=moment(_0x2ff8e2[_0x3252b0][_0x1b851e][_0xd3a8('0x54')])['diff'](moment(_0x2ff8e2[_0x3252b0][_0x1b851e]['queuecallerjoinAt']),_0xd3a8('0x55'))||0x0;if(_0x1b851e===_0x2ff8e2[_0x3252b0][_0xd3a8('0x3d')]-0x1){_0x45cbe3[_0xd3a8('0x41')][_0x593154][_0xd3a8('0x29')]+=moment(_0x2ff8e2[_0x3252b0][_0x1b851e][_0xd3a8('0x56')]||_0x2ff8e2[_0x3252b0][_0x1b851e][_0xd3a8('0x57')]||_0x2ff8e2[_0x3252b0][_0x1b851e][_0xd3a8('0x58')])[_0xd3a8('0x59')](moment(_0x2ff8e2[_0x3252b0][_0x1b851e][_0xd3a8('0x5a')]),'seconds')||0x0;_0x45cbe3[_0xd3a8('0x41')][_0x593154][_0xd3a8('0x27')]+=0x1;if(_0x2ff8e2[_0x3252b0][_0x1b851e]['queuecallercomplete']){_0x45cbe3['voiceQueues'][_0x593154][_0xd3a8('0x2d')]+=0x1;_0x45cbe3[_0xd3a8('0x41')][_0x593154]['sumBillable']+=moment(_0x2ff8e2[_0x3252b0][_0x1b851e][_0xd3a8('0x56')])[_0xd3a8('0x59')](moment(_0x2ff8e2[_0x3252b0][_0x1b851e][_0xd3a8('0x54')]),_0xd3a8('0x55'))||0x0;}}else{_0x45cbe3[_0xd3a8('0x41')][_0x593154][_0xd3a8('0x29')]+=_0x45cbe3[_0xd3a8('0x41')][_0x593154][_0xd3a8('0x28')]||0x0;}}}}}}return _0x45cbe3[_0xd3a8('0x41')];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x5b')]=function(){var _0x28dcfd=this;return function(_0x5f5942){clearVoiceCallReports(_0x28dcfd[_0xd3a8('0x14')]);if(_0x5f5942){for(var _0x4757e8=0x0;_0x4757e8<_0x5f5942['length'];_0x4757e8+=0x1){_0x28dcfd['outbound']['total']+=0x1;_0x28dcfd['outbound']['sumDuration']+=_0x5f5942[_0x4757e8][_0xd3a8('0x5c')];if(_0x5f5942[_0x4757e8][_0xd3a8('0x5d')]===_0xd3a8('0x5e')){_0x28dcfd['outbound'][_0xd3a8('0x2d')]+=0x1;_0x28dcfd['outbound'][_0xd3a8('0x28')]+=_0x5f5942[_0x4757e8][_0xd3a8('0x5c')]-_0x5f5942[_0x4757e8][_0xd3a8('0x5f')]||0x0;_0x28dcfd[_0xd3a8('0x14')][_0xd3a8('0x2a')]+=_0x5f5942[_0x4757e8]['billableseconds'];}}}return _0x28dcfd[_0xd3a8('0x14')];};};Realtime['prototype'][_0xd3a8('0x60')]=function(){var _0x25d32b=this;return function(_0x5749e6){if(_0x5749e6){freeIsNotKey(_0x5749e6,_0x25d32b[_0xd3a8('0x61')],_0xd3a8('0x24'));for(var _0x5b1864=0x0,_0x228189={};_0x5b1864<_0x5749e6['length'];_0x5b1864+=0x1){_0x228189=_0x5749e6[_0x5b1864];if(_[_0xd3a8('0x3e')](_0x25d32b[_0xd3a8('0x61')][_0x228189[_0xd3a8('0x24')]])){_0x25d32b[_0xd3a8('0x61')][_0x228189['name']]=new Campaign(_0x228189);}else{_0x25d32b[_0xd3a8('0x3a')](_0x25d32b[_0xd3a8('0x61')][_0x228189[_0xd3a8('0x24')]],_0x228189);_0x25d32b[_0xd3a8('0x61')][_0x228189['name']]['dialQueueProject']=_0x228189[_0xd3a8('0x62')]?_0x228189[_0xd3a8('0x62')][_0xd3a8('0x24')]:undefined;}}}return _0x25d32b[_0xd3a8('0x61')];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x63')]=function(){var _0x42dd71=this;return function(_0x5d5595){if(_0x5d5595){freeIsNotKey(_0x5d5595,_0x42dd71[_0xd3a8('0x15')],'id');for(var _0xfafd14=0x0,_0x29c1ea={};_0xfafd14<_0x5d5595['length'];_0xfafd14+=0x1){_0x29c1ea=_0x5d5595[_0xfafd14];if(_['isUndefined'](_0x42dd71[_0xd3a8('0x15')][_0x29c1ea['id']])){_0x42dd71[_0xd3a8('0x15')][_0x29c1ea['id']]=new VoiceExtension(_0x29c1ea);}else{_0x42dd71[_0xd3a8('0x3a')](_0x42dd71[_0xd3a8('0x15')][_0x29c1ea['id']],_0x29c1ea);}}}return _0x42dd71[_0xd3a8('0x15')];};};Realtime[_0xd3a8('0x3b')][_0xd3a8('0x64')]=function(){var _0x4bbce7=this;return function(_0x5e0416){clearCampaigns(_0x4bbce7[_0xd3a8('0x61')]);for(var _0x3bfa24=0x0;_0x3bfa24<_0x5e0416[_0xd3a8('0x3d')];_0x3bfa24+=0x1){_[_0xd3a8('0x4f')](_0x4bbce7[_0xd3a8('0x61')][_0x5e0416[_0x3bfa24][_0xd3a8('0x24')]],_0x5e0416[_0x3bfa24]);}return _0x4bbce7[_0xd3a8('0x61')];};};Realtime[_0xd3a8('0x3b')]['initFaxAccounts']=function(){var _0x3aa108=this;return function(_0x59f1b6){if(_0x59f1b6){freeIsNotKey(_0x59f1b6,_0x3aa108['faxAccounts'],'id');for(var _0x4872af=0x0,_0x443684={},_0x145def={};_0x4872af<_0x59f1b6[_0xd3a8('0x3d')];_0x4872af+=0x1){_0x443684=_0x59f1b6[_0x4872af];if(_[_0xd3a8('0x3e')](_0x3aa108[_0xd3a8('0x65')][_0x443684['id']])){_0x3aa108[_0xd3a8('0x65')][_0x443684['id']]=new FaxAccount(_0x443684);}else{_0x3aa108[_0xd3a8('0x3a')](_0x3aa108[_0xd3a8('0x65')][_0x443684['id']],_0x443684);}}}return _0x3aa108[_0xd3a8('0x65')];};};module[_0xd3a8('0x66')]=Realtime; \ No newline at end of file +var _0x3ce5=['faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','isNil','name','interface','answered','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','agents','isUndefined','initTelephones','telephones','length','initTrunks','initVoiceQueues','initTriggers','triggers','initZendeskAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','merge','initVoiceQueueReports','queuecallerexit','unmanaged','queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/campaign','../model/voiceExtension','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x3ce5,0x176));var _0x53ce=function(_0x2e8351,_0x5ef0d3){_0x2e8351=_0x2e8351-0x0;var _0x171f32=_0x3ce5[_0x2e8351];return _0x171f32;};'use strict';var BPromise=require(_0x53ce('0x0'));var util=require(_0x53ce('0x1'));var _=require(_0x53ce('0x2'));var moment=require(_0x53ce('0x3'));var Agent=require(_0x53ce('0x4'));var Telephone=require(_0x53ce('0x5'));var Trunk=require(_0x53ce('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0x53ce('0x7'));var VoiceExtension=require(_0x53ce('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x53ce('0x9'));var ZohoAccount=require(_0x53ce('0xa'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x53ce('0xb'));var ServicenowAccount=require(_0x53ce('0xc'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x53ce('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this['telephones']={};this[_0x53ce('0xe')]={};this[_0x53ce('0xf')]={};this['triggers']={};this[_0x53ce('0x10')]={};this[_0x53ce('0x11')]={};this[_0x53ce('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x53ce('0x13')]={};this[_0x53ce('0x14')]={};this[_0x53ce('0x15')]={};this[_0x53ce('0x16')]={};this['timers']={};this[_0x53ce('0x17')]={};this['salesforceAccounts']={};this[_0x53ce('0x18')]={};this['freshdeskAccounts']={};this[_0x53ce('0x19')]={};this[_0x53ce('0x1a')]={};this['vtigerAccounts']={};this[_0x53ce('0x1b')]={};this[_0x53ce('0x1c')]={};this[_0x53ce('0x1d')]={};this[_0x53ce('0x1e')]={};};function freeIsNotKey(_0x52adef,_0x205b0b,_0x1cbf92){var _0x4cde0b=_[_0x53ce('0x1f')](_0x52adef,function(_0x61aafb,_0x4e69cb){return _0x61aafb[_0x1cbf92];});for(var _0x2876af in _0x205b0b){if(_0x205b0b[_0x53ce('0x20')](_0x2876af)){if(!_0x4cde0b[_0x2876af]){delete _0x205b0b[_0x2876af];}}}}function freeIsNotKeySip(_0x217b8f,_0x11acd9){var _0x1425b1=_['mapKeys'](_0x217b8f,function(_0x5e920b,_0x924bee){return util[_0x53ce('0x21')](_0x53ce('0x22'),_0x5e920b['name']);});for(var _0x36f2f2 in _0x11acd9){if(_0x11acd9[_0x53ce('0x20')](_0x36f2f2)){if(!_0x1425b1[_0x36f2f2]){delete _0x11acd9[_0x36f2f2];}}}}function freeIsNotKeyAgent(_0x170bbd,_0x44e2b0){var _0x3875d1=_[_0x53ce('0x1f')](_0x170bbd,function(_0x3b6489,_0x31332e){var _0x4c7f07=_[_0x53ce('0x23')](_0x3b6489['interface'])?util[_0x53ce('0x21')](_0x53ce('0x22'),_0x3b6489[_0x53ce('0x24')]):_0x3b6489[_0x53ce('0x25')];return _0x4c7f07;});for(var _0xc7f66d in _0x44e2b0){if(_0x44e2b0['hasOwnProperty'](_0xc7f66d)){if(!_0x3875d1[_0xc7f66d]){delete _0x44e2b0[_0xc7f66d];}}}}function clearVoiceCallReports(_0x37f758){_0x37f758['total']=0x0;_0x37f758[_0x53ce('0x26')]=0x0;_0x37f758['sumHoldTime']=0x0;_0x37f758[_0x53ce('0x27')]=0x0;_0x37f758[_0x53ce('0x28')]=0x0;}function clearCampaigns(_0x24c819){if(!_[_0x53ce('0x29')](_0x24c819)){for(var _0x39ac2a in _0x24c819){if(_0x24c819[_0x53ce('0x20')](_0x39ac2a)){_0x24c819[_0x39ac2a]['ivrTotalCallsDays']=0x0;_0x24c819[_0x39ac2a][_0x53ce('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x3a8bb2){if(!_[_0x53ce('0x29')](_0x3a8bb2)){for(var _0x361bbc in _0x3a8bb2){if(_0x3a8bb2[_0x53ce('0x20')](_0x361bbc)){_0x3a8bb2[_0x361bbc][_0x53ce('0x2b')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x26')]=0x0;_0x3a8bb2[_0x361bbc]['unmanaged']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x2c')]=0x0;_0x3a8bb2[_0x361bbc]['sumHoldTime']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x27')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x28')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x2d')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x2e')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x2f')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x30')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x31')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x32')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x33')]=0x0;_0x3a8bb2[_0x361bbc]['outboundDropCallsDayCallersExit']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x34')]=0x0;_0x3a8bb2[_0x361bbc]['outboundOriginateFailureCallsDay']=0x0;_0x3a8bb2[_0x361bbc]['outboundRejectCallsDay']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x35')]=0x0;_0x3a8bb2[_0x361bbc]['outboundAnswerAgiCallsDay']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x36')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x37')]=!![];}}}}Realtime['prototype'][_0x53ce('0x38')]=function(_0xf81b49,_0x5101a9){for(var _0x2861cf in _0x5101a9){if(_0xf81b49[_0x53ce('0x20')](_0x2861cf)){_0xf81b49[_0x2861cf]=_0x5101a9[_0x2861cf];}}};Realtime[_0x53ce('0x39')]['initAgents']=function(){var _0x4c9fae=this;return function(_0x34497c){if(_0x34497c){freeIsNotKeyAgent(_0x34497c,_0x4c9fae[_0x53ce('0x3a')]);for(var _0x486259=0x0,_0x4ab0e7={},_0x229aa6={};_0x486259<_0x34497c['length'];_0x486259+=0x1){_0x4ab0e7=_0x34497c[_0x486259];var _0x40a21a=_[_0x53ce('0x23')](_0x4ab0e7[_0x53ce('0x25')])?util['format'](_0x53ce('0x22'),_0x4ab0e7[_0x53ce('0x24')]):_0x4ab0e7[_0x53ce('0x25')];if(_[_0x53ce('0x3b')](_0x4c9fae[_0x53ce('0x3a')][_0x40a21a])){_0x4c9fae[_0x53ce('0x3a')][_0x40a21a]=new Agent(_0x4ab0e7);}else{_0x4c9fae['mergeFromDatabase'](_0x4c9fae[_0x53ce('0x3a')][_0x40a21a],_0x4ab0e7);}}}return _0x4c9fae[_0x53ce('0x3a')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x3c')]=function(){var _0x5d49b2=this;return function(_0xeada0e){if(_0xeada0e){freeIsNotKeySip(_0xeada0e,_0x5d49b2[_0x53ce('0x3d')]);for(var _0x49b592=0x0,_0x1f3098={},_0x3f0b9d={};_0x49b592<_0xeada0e[_0x53ce('0x3e')];_0x49b592+=0x1){_0x1f3098=_0xeada0e[_0x49b592];if(_['isUndefined'](_0x5d49b2[_0x53ce('0x3d')][util[_0x53ce('0x21')](_0x53ce('0x22'),_0x1f3098[_0x53ce('0x24')])])){_0x5d49b2[_0x53ce('0x3d')][util['format'](_0x53ce('0x22'),_0x1f3098['name'])]=new Telephone(_0x1f3098);}else{_0x5d49b2[_0x53ce('0x38')](_0x5d49b2['telephones'][util[_0x53ce('0x21')](_0x53ce('0x22'),_0x1f3098[_0x53ce('0x24')])],_0x1f3098);}}}return _0x5d49b2[_0x53ce('0x3d')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x3f')]=function(){var _0x2cb27d=this;return function(_0x1c495d){if(_0x1c495d){freeIsNotKeySip(_0x1c495d,_0x2cb27d[_0x53ce('0xe')]);for(var _0x39fa67=0x0,_0x403cf4={},_0x482193={};_0x39fa67<_0x1c495d['length'];_0x39fa67+=0x1){_0x403cf4=_0x1c495d[_0x39fa67];if(_[_0x53ce('0x3b')](_0x2cb27d[_0x53ce('0xe')][util[_0x53ce('0x21')]('SIP/%s',_0x403cf4[_0x53ce('0x24')])])){_0x2cb27d[_0x53ce('0xe')][util[_0x53ce('0x21')](_0x53ce('0x22'),_0x403cf4[_0x53ce('0x24')])]=new Trunk(_0x403cf4);}else{_0x2cb27d['mergeFromDatabase'](_0x2cb27d['trunks'][util[_0x53ce('0x21')](_0x53ce('0x22'),_0x403cf4['name'])],_0x403cf4);}}}return _0x2cb27d[_0x53ce('0xe')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x40')]=function(){var _0x1fa097=this;return function(_0x673d69){if(_0x673d69){freeIsNotKey(_0x673d69,_0x1fa097[_0x53ce('0xf')],_0x53ce('0x24'));for(var _0xfa9724=0x0,_0x5d20e4={},_0x17ee60={};_0xfa9724<_0x673d69[_0x53ce('0x3e')];_0xfa9724+=0x1){_0x5d20e4=_0x673d69[_0xfa9724];if(_[_0x53ce('0x3b')](_0x1fa097['voiceQueues'][_0x5d20e4['name']])){_0x1fa097[_0x53ce('0xf')][_0x5d20e4['name']]=new VoiceQueue(_0x5d20e4);}else{_0x1fa097['mergeFromDatabase'](_0x1fa097[_0x53ce('0xf')][_0x5d20e4[_0x53ce('0x24')]],_0x5d20e4);}}}return _0x1fa097[_0x53ce('0xf')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x41')]=function(){var _0x10eb32=this;return function(_0x76aa33){if(_0x76aa33){freeIsNotKey(_0x76aa33,_0x10eb32[_0x53ce('0x42')],'id');for(var _0x2a9df6=0x0,_0x556420={},_0x4b1058={};_0x2a9df6<_0x76aa33['length'];_0x2a9df6+=0x1){_0x556420=_0x76aa33[_0x2a9df6];if(_['isUndefined'](_0x10eb32[_0x53ce('0x42')][_0x556420['id']])){_0x10eb32[_0x53ce('0x42')][_0x556420['id']]=new Trigger(_0x556420);}else{_0x10eb32[_0x53ce('0x38')](_0x10eb32[_0x53ce('0x42')][_0x556420['id']],_0x556420);}}}return _0x10eb32[_0x53ce('0x42')];};};Realtime[_0x53ce('0x39')]['initTemplates']=function(){var _0x2e2ebc=this;return function(_0x249b87){if(_0x249b87){freeIsNotKey(_0x249b87,_0x2e2ebc['templates'],'id');for(var _0xad789e=0x0,_0x320fff={},_0x1d5c29={};_0xad789e<_0x249b87['length'];_0xad789e+=0x1){_0x320fff=_0x249b87[_0xad789e];if(_[_0x53ce('0x3b')](_0x2e2ebc[_0x53ce('0x11')][_0x320fff['id']])){_0x2e2ebc[_0x53ce('0x11')][_0x320fff['id']]=new Template(_0x320fff);}else{_0x2e2ebc['mergeFromDatabase'](_0x2e2ebc['templates'][_0x320fff['id']],_0x320fff);}}}return _0x2e2ebc[_0x53ce('0x11')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x43')]=function(){var _0x25eb1a=this;return function(_0x1abeb5){if(_0x1abeb5){freeIsNotKey(_0x1abeb5,_0x25eb1a[_0x53ce('0x17')],'id');for(var _0x16b12d=0x0,_0x230183={},_0x581cac={};_0x16b12d<_0x1abeb5[_0x53ce('0x3e')];_0x16b12d+=0x1){_0x230183=_0x1abeb5[_0x16b12d];if(_['isUndefined'](_0x25eb1a[_0x53ce('0x17')][_0x230183['id']])){_0x25eb1a[_0x53ce('0x17')][_0x230183['id']]=new ZendeskAccount(_0x230183);}else{_0x25eb1a[_0x53ce('0x38')](_0x25eb1a[_0x53ce('0x17')][_0x230183['id']],_0x230183);}}}return _0x25eb1a[_0x53ce('0x17')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x69910f=this;return function(_0x1ea579){if(_0x1ea579){freeIsNotKey(_0x1ea579,_0x69910f[_0x53ce('0x44')],'id');for(var _0x208ea6=0x0,_0x2cedd4={},_0x2419cc={};_0x208ea6<_0x1ea579['length'];_0x208ea6+=0x1){_0x2cedd4=_0x1ea579[_0x208ea6];if(_['isUndefined'](_0x69910f[_0x53ce('0x44')][_0x2cedd4['id']])){_0x69910f['salesforceAccounts'][_0x2cedd4['id']]=new SalesforceAccount(_0x2cedd4);}else{_0x69910f[_0x53ce('0x38')](_0x69910f[_0x53ce('0x44')][_0x2cedd4['id']],_0x2cedd4);}}}return _0x69910f['salesforceAccounts'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x45')]=function(){var _0x204702=this;return function(_0x2d35f1){if(_0x2d35f1){freeIsNotKey(_0x2d35f1,_0x204702[_0x53ce('0x46')],'id');for(var _0x13fd8d=0x0,_0x3d8dbd={},_0x699355={};_0x13fd8d<_0x2d35f1[_0x53ce('0x3e')];_0x13fd8d+=0x1){_0x3d8dbd=_0x2d35f1[_0x13fd8d];if(_[_0x53ce('0x3b')](_0x204702[_0x53ce('0x46')][_0x3d8dbd['id']])){_0x204702[_0x53ce('0x46')][_0x3d8dbd['id']]=new FreshdeskAccount(_0x3d8dbd);}else{_0x204702['mergeFromDatabase'](_0x204702[_0x53ce('0x46')][_0x3d8dbd['id']],_0x3d8dbd);}}}return _0x204702[_0x53ce('0x46')];};};Realtime['prototype'][_0x53ce('0x47')]=function(){var _0x44194e=this;return function(_0xae5186){if(_0xae5186){freeIsNotKey(_0xae5186,_0x44194e['zohoAccounts'],'id');for(var _0x344e38=0x0,_0x160b1e={},_0x3c3187={};_0x344e38<_0xae5186[_0x53ce('0x3e')];_0x344e38+=0x1){_0x160b1e=_0xae5186[_0x344e38];if(_['isUndefined'](_0x44194e[_0x53ce('0x19')][_0x160b1e['id']])){_0x44194e[_0x53ce('0x19')][_0x160b1e['id']]=new ZohoAccount(_0x160b1e);}else{_0x44194e[_0x53ce('0x38')](_0x44194e[_0x53ce('0x19')][_0x160b1e['id']],_0x160b1e);}}}return _0x44194e[_0x53ce('0x19')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x48')]=function(){var _0x337c3f=this;return function(_0x305491){if(_0x305491){freeIsNotKey(_0x305491,_0x337c3f[_0x53ce('0x1a')],'id');for(var _0x497738=0x0,_0x3a7a62={},_0x5621e2={};_0x497738<_0x305491[_0x53ce('0x3e')];_0x497738+=0x1){_0x3a7a62=_0x305491[_0x497738];if(_['isUndefined'](_0x337c3f[_0x53ce('0x1a')][_0x3a7a62['id']])){_0x337c3f[_0x53ce('0x1a')][_0x3a7a62['id']]=new DeskAccount(_0x3a7a62);}else{_0x337c3f[_0x53ce('0x38')](_0x337c3f[_0x53ce('0x1a')][_0x3a7a62['id']],_0x3a7a62);}}}return _0x337c3f[_0x53ce('0x1a')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x49')]=function(){var _0x2c119e=this;return function(_0x4b7753){if(_0x4b7753){freeIsNotKey(_0x4b7753,_0x2c119e[_0x53ce('0x18')],'id');for(var _0x1a148d=0x0,_0x31dd0d={},_0x49bf40={};_0x1a148d<_0x4b7753[_0x53ce('0x3e')];_0x1a148d+=0x1){_0x31dd0d=_0x4b7753[_0x1a148d];if(_[_0x53ce('0x3b')](_0x2c119e[_0x53ce('0x18')][_0x31dd0d['id']])){_0x2c119e[_0x53ce('0x18')][_0x31dd0d['id']]=new SugarcrmAccount(_0x31dd0d);}else{_0x2c119e[_0x53ce('0x38')](_0x2c119e[_0x53ce('0x18')][_0x31dd0d['id']],_0x31dd0d);}}}return _0x2c119e[_0x53ce('0x18')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x4a')]=function(){var _0x183a6b=this;return function(_0x50631c){if(_0x50631c){freeIsNotKey(_0x50631c,_0x183a6b[_0x53ce('0x4b')],'id');for(var _0xda23bc=0x0,_0xa3379a={},_0x39d670={};_0xda23bc<_0x50631c[_0x53ce('0x3e')];_0xda23bc+=0x1){_0xa3379a=_0x50631c[_0xda23bc];if(_[_0x53ce('0x3b')](_0x183a6b[_0x53ce('0x4b')][_0xa3379a['id']])){_0x183a6b[_0x53ce('0x4b')][_0xa3379a['id']]=new VtigerAccount(_0xa3379a);}else{_0x183a6b[_0x53ce('0x38')](_0x183a6b[_0x53ce('0x4b')][_0xa3379a['id']],_0xa3379a);}}}return _0x183a6b[_0x53ce('0x4b')];};};Realtime['prototype'][_0x53ce('0x4c')]=function(){var _0x5ed378=this;return function(_0x3f12c8){if(_0x3f12c8){freeIsNotKey(_0x3f12c8,_0x5ed378[_0x53ce('0x1b')],'id');for(var _0xaed23f=0x0,_0x20c6c0={},_0xe344f1={};_0xaed23f<_0x3f12c8[_0x53ce('0x3e')];_0xaed23f+=0x1){_0x20c6c0=_0x3f12c8[_0xaed23f];if(_[_0x53ce('0x3b')](_0x5ed378[_0x53ce('0x1b')][_0x20c6c0['id']])){_0x5ed378[_0x53ce('0x1b')][_0x20c6c0['id']]=new ServicenowAccount(_0x20c6c0);}else{_0x5ed378[_0x53ce('0x38')](_0x5ed378[_0x53ce('0x1b')][_0x20c6c0['id']],_0x20c6c0);}}}return _0x5ed378[_0x53ce('0x1b')];};};Realtime[_0x53ce('0x39')]['initDynamics365Accounts']=function(){var _0x535c90=this;return function(_0x23a48c){if(_0x23a48c){freeIsNotKey(_0x23a48c,_0x535c90['dynamics365Accounts'],'id');for(var _0x39c385=0x0,_0x158fc4={},_0x4912cf={};_0x39c385<_0x23a48c[_0x53ce('0x3e')];_0x39c385+=0x1){_0x158fc4=_0x23a48c[_0x39c385];if(_['isUndefined'](_0x535c90[_0x53ce('0x1c')][_0x158fc4['id']])){_0x535c90[_0x53ce('0x1c')][_0x158fc4['id']]=new Dynamics365Account(_0x158fc4);}else{_0x535c90[_0x53ce('0x38')](_0x535c90[_0x53ce('0x1c')][_0x158fc4['id']],_0x158fc4);}}}return _0x535c90['dynamics365Accounts'];};};Realtime['prototype'][_0x53ce('0x4d')]=function(){var _0x357901=this;return function(_0x4f13a1){if(_0x4f13a1){freeIsNotKey(_0x4f13a1,_0x357901[_0x53ce('0x1d')],'id');for(var _0x2aec9a=0x0,_0x27574d={},_0x5d1633={};_0x2aec9a<_0x4f13a1[_0x53ce('0x3e')];_0x2aec9a+=0x1){_0x27574d=_0x4f13a1[_0x2aec9a];if(_[_0x53ce('0x3b')](_0x357901[_0x53ce('0x1d')][_0x27574d['id']])){_0x357901[_0x53ce('0x1d')][_0x27574d['id']]=new FreshsalesAccount(_0x27574d);}else{_0x357901[_0x53ce('0x38')](_0x357901[_0x53ce('0x1d')][_0x27574d['id']],_0x27574d);}}}return _0x357901['freshsalesAccounts'];};};Realtime[_0x53ce('0x39')]['initVoiceQueueHopperHistory']=function(){var _0x394771=this;return function(_0x563d4c){for(var _0x1330a8=0x0;_0x1330a8<_0x563d4c[_0x53ce('0x3e')];_0x1330a8+=0x1){_[_0x53ce('0x4e')](_0x394771[_0x53ce('0xf')][_0x563d4c[_0x1330a8][_0x53ce('0x24')]],_0x563d4c[_0x1330a8]);}return _0x394771['voiceQueues'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x4f')]=function(){var _0x5f4064=this;return function(_0x562895){clearVoiceQueues(_0x5f4064[_0x53ce('0xf')]);if(_0x562895){_0x562895=_['groupBy'](_0x562895,'uniqueid');for(var _0x48a113 in _0x562895){if(_0x562895[_0x53ce('0x20')](_0x48a113)){var _0x510a68={};for(var _0xf602f7=0x0;_0xf602f7<_0x562895[_0x48a113][_0x53ce('0x3e')];_0xf602f7+=0x1){var _0x3e1346=_0x562895[_0x48a113][_0xf602f7]['queue'];if(_0x5f4064[_0x53ce('0xf')][_0x3e1346]){if(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x50')]){_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x51')]+=0x1;}if(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x52')]){_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x2c')]+=0x1;}_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x53')]+=moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x54')])[_0x53ce('0x55')](moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x56')]),_0x53ce('0x57'))||0x0;if(_0xf602f7===_0x562895[_0x48a113][_0x53ce('0x3e')]-0x1){_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x27')]+=moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x58')]||_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x59')]||_0x562895[_0x48a113][_0xf602f7]['queuecallerexitAt'])[_0x53ce('0x55')](moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x56')]),_0x53ce('0x57'))||0x0;_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x2b')]+=0x1;if(_0x562895[_0x48a113][_0xf602f7]['queuecallercomplete']){_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x26')]+=0x1;_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x28')]+=moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x58')])[_0x53ce('0x55')](moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x54')]),'seconds')||0x0;}}else{_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x27')]+=_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x53')]||0x0;}}}}}}return _0x5f4064['voiceQueues'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x5a')]=function(){var _0x5f69aa=this;return function(_0x1b7593){clearVoiceCallReports(_0x5f69aa['outbound']);if(_0x1b7593){for(var _0x424694=0x0;_0x424694<_0x1b7593[_0x53ce('0x3e')];_0x424694+=0x1){_0x5f69aa[_0x53ce('0x12')][_0x53ce('0x2b')]+=0x1;_0x5f69aa[_0x53ce('0x12')][_0x53ce('0x27')]+=_0x1b7593[_0x424694][_0x53ce('0x5b')];if(_0x1b7593[_0x424694][_0x53ce('0x5c')]===_0x53ce('0x5d')){_0x5f69aa['outbound'][_0x53ce('0x26')]+=0x1;_0x5f69aa[_0x53ce('0x12')]['sumHoldTime']+=_0x1b7593[_0x424694][_0x53ce('0x5b')]-_0x1b7593[_0x424694][_0x53ce('0x5e')]||0x0;_0x5f69aa[_0x53ce('0x12')][_0x53ce('0x28')]+=_0x1b7593[_0x424694][_0x53ce('0x5e')];}}}return _0x5f69aa[_0x53ce('0x12')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x5f')]=function(){var _0x2c83f5=this;return function(_0x40f0b0){if(_0x40f0b0){freeIsNotKey(_0x40f0b0,_0x2c83f5[_0x53ce('0x10')],'name');for(var _0x3c0c14=0x0,_0x186d99={};_0x3c0c14<_0x40f0b0[_0x53ce('0x3e')];_0x3c0c14+=0x1){_0x186d99=_0x40f0b0[_0x3c0c14];if(_['isUndefined'](_0x2c83f5[_0x53ce('0x10')][_0x186d99['name']])){_0x2c83f5[_0x53ce('0x10')][_0x186d99[_0x53ce('0x24')]]=new Campaign(_0x186d99);}else{_0x2c83f5[_0x53ce('0x38')](_0x2c83f5[_0x53ce('0x10')][_0x186d99[_0x53ce('0x24')]],_0x186d99);_0x2c83f5[_0x53ce('0x10')][_0x186d99['name']][_0x53ce('0x60')]=_0x186d99[_0x53ce('0x61')]?_0x186d99['SquareProject']['name']:undefined;}}}return _0x2c83f5['campaigns'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x62')]=function(){var _0x12c963=this;return function(_0x58fe80){if(_0x58fe80){freeIsNotKey(_0x58fe80,_0x12c963['voiceExtensions'],'id');for(var _0x15270a=0x0,_0x3fb19c={};_0x15270a<_0x58fe80['length'];_0x15270a+=0x1){_0x3fb19c=_0x58fe80[_0x15270a];if(_['isUndefined'](_0x12c963[_0x53ce('0x13')][_0x3fb19c['id']])){_0x12c963[_0x53ce('0x13')][_0x3fb19c['id']]=new VoiceExtension(_0x3fb19c);}else{_0x12c963[_0x53ce('0x38')](_0x12c963[_0x53ce('0x13')][_0x3fb19c['id']],_0x3fb19c);}}}return _0x12c963[_0x53ce('0x13')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x63')]=function(){var _0x277dba=this;return function(_0x14c9cf){clearCampaigns(_0x277dba[_0x53ce('0x10')]);for(var _0x3f65d8=0x0;_0x3f65d8<_0x14c9cf[_0x53ce('0x3e')];_0x3f65d8+=0x1){_[_0x53ce('0x4e')](_0x277dba[_0x53ce('0x10')][_0x14c9cf[_0x3f65d8][_0x53ce('0x24')]],_0x14c9cf[_0x3f65d8]);}return _0x277dba['campaigns'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x64')]=function(){var _0x204f5a=this;return function(_0xc1863){if(_0xc1863){freeIsNotKey(_0xc1863,_0x204f5a[_0x53ce('0x1e')],'id');for(var _0x1a5dae=0x0,_0x4b36d5={},_0x439934={};_0x1a5dae<_0xc1863[_0x53ce('0x3e')];_0x1a5dae+=0x1){_0x4b36d5=_0xc1863[_0x1a5dae];if(_[_0x53ce('0x3b')](_0x204f5a[_0x53ce('0x1e')][_0x4b36d5['id']])){_0x204f5a['faxAccounts'][_0x4b36d5['id']]=new FaxAccount(_0x4b36d5);}else{_0x204f5a[_0x53ce('0x38')](_0x204f5a[_0x53ce('0x1e')][_0x4b36d5['id']],_0x4b36d5);}}}return _0x204f5a[_0x53ce('0x1e')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index ea3cc3a..e7876f4 100644 --- a/server/services/ami/report/index.js +++ b/server/services/ami/report/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7c3=['length','connectedlinenum','accountcode','assigned','lastAssignedTo','interface','isNil','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match','destination','exten','type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','blindTransfer','create','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','forEach','substring','indexOf','phone','lastIndexOf','attendedTransfer','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','findAgent','find','name','SIP/%s','voiceQueueReport'];(function(_0xa9430,_0x14f536){var _0x220b68=function(_0x591147){while(--_0x591147){_0xa9430['push'](_0xa9430['shift']());}};_0x220b68(++_0x14f536);}(_0xc7c3,0xdd));var _0x3c7c=function(_0x1d7e64,_0x5e093f){_0x1d7e64=_0x1d7e64-0x0;var _0x10dcda=_0xc7c3[_0x1d7e64];return _0x10dcda;};'use strict';var _=require(_0x3c7c('0x0'));var moment=require(_0x3c7c('0x1'));var util=require('util');var config=require(_0x3c7c('0x2'));var ami=require(_0x3c7c('0x3'));var RpcVoiceAgentReport=require(_0x3c7c('0x4'));var RpcVoiceCallReport=require(_0x3c7c('0x5'));var RpcVoiceDialReport=require(_0x3c7c('0x6'));var RpcMemberReport=require(_0x3c7c('0x7'));var RpcVoiceQueueReport=require(_0x3c7c('0x8'));var RpcVoiceRecording=require(_0x3c7c('0x9'));var RpcVoiceTransferReport=require(_0x3c7c('0xa'));var VoiceQueueReport=require(_0x3c7c('0xb'));var VoiceCallReport=require(_0x3c7c('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x3c7c('0xd'));var UserReport=require(_0x3c7c('0xe'));function Report(_0x106749){this[_0x3c7c('0xf')]=_0x106749;this[_0x3c7c('0x10')]=_0x106749[_0x3c7c('0x10')];this[_0x3c7c('0x11')]=_0x106749[_0x3c7c('0x11')];}Report[_0x3c7c('0x12')][_0x3c7c('0x13')]=function(_0x411281){var _0xf21dfc=new VoiceQueueReport(this[_0x3c7c('0xf')]);var _0x45ded5=new VoiceAgentReport(this['realtime']);var _0x1df09a=new VoiceDialReport(this[_0x3c7c('0xf')]);var _0x48aca7=new VoiceCallReport(this[_0x3c7c('0xf')]);var _0x51b79f=new UserReport(this[_0x3c7c('0xf')]);if(config[_0x3c7c('0x14')]&&config[_0x3c7c('0x14')]['disabled']){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x3c7c('0x15')](this));ami['on'](_0x3c7c('0x16'),this[_0x3c7c('0x17')][_0x3c7c('0x15')](this));ami['on'](_0x3c7c('0x18'),this['voiceAgentReport']['bind'](this));ami['on'](_0x3c7c('0x19'),this[_0x3c7c('0x1a')][_0x3c7c('0x15')](this));ami['on'](_0x3c7c('0x1b'),this['blindTransfer'][_0x3c7c('0x15')](this));ami['on'](_0x3c7c('0x1c'),this['attendedTransfer']['bind'](this));}};Report[_0x3c7c('0x12')][_0x3c7c('0x1d')]=function(_0x8449b3){var _0x26178f;_0x26178f=_[_0x3c7c('0x1e')](this[_0x3c7c('0x10')],function(_0x1eb422){return _0x1eb422['accountcode']==_0x8449b3||_0x1eb422[_0x3c7c('0x1f')]==_0x8449b3;});if(_['isNil'](_0x26178f)){var _0x1f3dd8=_['find'](this[_0x3c7c('0x11')],function(_0x195d09){return _0x195d09['accountcode']==_0x8449b3||_0x195d09[_0x3c7c('0x1f')]==_0x8449b3;});if(_0x1f3dd8){_0x26178f=_[_0x3c7c('0x1e')](this[_0x3c7c('0x10')],function(_0x22a82d){return _0x22a82d['interface']==util['format'](_0x3c7c('0x20'),_0x1f3dd8[_0x3c7c('0x1f')]);});}}return _0x26178f;};Report[_0x3c7c('0x12')][_0x3c7c('0x21')]=function(_0x380b8e){for(var _0x217589=0x0;_0x217589<_0x380b8e[_0x3c7c('0x22')];_0x217589+=0x1){var _0x1c8249=this[_0x3c7c('0x1d')](_0x380b8e[_0x217589][_0x3c7c('0x23')]);if(_0x1c8249){_0x380b8e[_0x217589][_0x3c7c('0x24')]=_0x1c8249[_0x3c7c('0x24')];_0x380b8e[_0x217589][_0x3c7c('0x25')]=!![];_0x380b8e[_0x217589][_0x3c7c('0x26')]=_0x1c8249[_0x3c7c('0x1f')];_0x380b8e[_0x217589][_0x3c7c('0x27')]=_[_0x3c7c('0x28')](_0x1c8249[_0x3c7c('0x27')])?util[_0x3c7c('0x29')]('SIP/%s',_0x1c8249[_0x3c7c('0x1f')]):_0x1c8249['interface'];if(_0x380b8e[_0x217589][_0x3c7c('0x2a')]){_0x380b8e[_0x217589][_0x3c7c('0x2b')]=moment()[_0x3c7c('0x29')](_0x3c7c('0x2c'));}if(_0x380b8e[_0x217589][_0x3c7c('0x2d')]){_0x380b8e[_0x217589]['queuecallerexitAt']=moment()[_0x3c7c('0x29')](_0x3c7c('0x2c'));}RpcMemberReport[_0x3c7c('0x21')](_0x380b8e[_0x217589]);}RpcVoiceQueueReport['create'](_0x380b8e[_0x217589]);}};function extractCalleridNumber(_0x468b14){var _0x4f7902=_0x468b14[_0x3c7c('0x2e')](/<(.*?)>/);return _0x4f7902?_0x4f7902[0x1]:_0x468b14;}Report[_0x3c7c('0x12')][_0x3c7c('0x17')]=function(_0x23d1f5){_0x23d1f5[_0x3c7c('0x2f')]=_0x23d1f5[_0x3c7c('0x2f')]||_0x23d1f5[_0x3c7c('0x30')];if(_0x23d1f5[_0x3c7c('0x31')]==_0x3c7c('0x32')){_0x23d1f5[_0x3c7c('0x33')]=_0x3c7c('0x34');_0x23d1f5[_0x3c7c('0x35')]=_0x23d1f5['queue'];if(_0x23d1f5['context']==_0x3c7c('0x36')){_0x23d1f5['accountcode']='';_0x23d1f5[_0x3c7c('0x2f')]=extractCalleridNumber(_0x23d1f5[_0x3c7c('0x37')]);}else if(_0x23d1f5[_0x3c7c('0x38')]=='from-sip'){if(_0x23d1f5[_0x3c7c('0x2f')]==_0x3c7c('0x39')){_0x23d1f5['destination']=extractCalleridNumber(_0x23d1f5[_0x3c7c('0x3a')]);_0x23d1f5[_0x3c7c('0x3b')]=_0x23d1f5[_0x3c7c('0x3c')];_0x23d1f5[_0x3c7c('0x3d')]=[_0x23d1f5[_0x3c7c('0x3e')],_0x23d1f5['channel']=_0x23d1f5[_0x3c7c('0x3d')]][0x0];_0x23d1f5[_0x3c7c('0x37')]=_0x23d1f5[_0x3c7c('0x3a')];}else{_0x23d1f5[_0x3c7c('0x2f')]=_0x23d1f5[_0x3c7c('0x3b')];_0x23d1f5[_0x3c7c('0x3b')]=_0x23d1f5[_0x3c7c('0x3c')];if(_0x23d1f5[_0x3c7c('0x3f')]==_0x3c7c('0x40')){_0x23d1f5[_0x3c7c('0x24')]=_0x23d1f5[_0x3c7c('0x23')];}else{_0x23d1f5[_0x3c7c('0x24')]='';}}}}else{_0x23d1f5[_0x3c7c('0x37')]=util[_0x3c7c('0x29')](_0x3c7c('0x41'),_0x23d1f5[_0x3c7c('0x42')],_0x23d1f5['calleridnum']);}if(RpcVoiceTransferReport[_0x3c7c('0x43')][_0x23d1f5[_0x3c7c('0x44')]]){var _0x47bb5a=RpcVoiceTransferReport[_0x3c7c('0x43')][_0x23d1f5[_0x3c7c('0x44')]];_0x47bb5a['transfereelinkedid']=_0x23d1f5['uniqueid'];RpcVoiceTransferReport[_0x3c7c('0x45')](_0x47bb5a);delete RpcVoiceTransferReport[_0x3c7c('0x43')][_0x23d1f5[_0x3c7c('0x44')]];}RpcVoiceCallReport[_0x3c7c('0x46')](_0x23d1f5);if(_0x23d1f5[_0x3c7c('0x47')]){for(var _0x2eddb3=0x0;_0x2eddb3<_0x23d1f5[_0x3c7c('0x48')][_0x3c7c('0x22')];_0x2eddb3+=0x1){_0x23d1f5[_0x3c7c('0x49')]=_0x23d1f5['monitors'][_0x2eddb3]['filename'];_0x23d1f5[_0x3c7c('0x4a')]=_0x23d1f5[_0x3c7c('0x48')][_0x2eddb3][_0x3c7c('0x4a')];if(_0x23d1f5[_0x3c7c('0x30')]==_0x3c7c('0x39')){_0x23d1f5[_0x3c7c('0x3b')]=_0x23d1f5[_0x3c7c('0x23')];_0x23d1f5[_0x3c7c('0x42')]=_0x23d1f5[_0x3c7c('0x4b')];_0x23d1f5[_0x3c7c('0x23')]=_0x23d1f5[_0x3c7c('0x24')];_0x23d1f5[_0x3c7c('0x4b')]=_0x23d1f5[_0x3c7c('0x4c')];_0x23d1f5['exten']=_0x23d1f5['originatecalleridnum'];}else if(_0x23d1f5[_0x3c7c('0x30')]==_0x3c7c('0x4d')){_0x23d1f5[_0x3c7c('0x3b')]=_0x23d1f5[_0x3c7c('0x2f')];_0x23d1f5[_0x3c7c('0x30')]=_0x23d1f5['originatecalleridnum'];}RpcVoiceRecording[_0x3c7c('0x46')](_0x23d1f5);}}};Report['prototype'][_0x3c7c('0x4e')]=function(_0x12e44c){if(_['isArray'](_0x12e44c)){_0x12e44c[_0x3c7c('0x4f')](function(_0xa99fc6){RpcVoiceAgentReport[_0x3c7c('0x46')](_0xa99fc6);});}else{RpcVoiceAgentReport['create'](_0x12e44c);}};Report[_0x3c7c('0x12')][_0x3c7c('0x1a')]=function(_0x27a4a0){RpcVoiceDialReport[_0x3c7c('0x46')](_0x27a4a0);var _0x17266c;var _0x4edb70;var _0x18f7a9=_0x27a4a0[_0x3c7c('0x3e')];if(_['startsWith'](_0x18f7a9,'Local')){_0x4edb70=_0x18f7a9[_0x3c7c('0x50')](_0x18f7a9[_0x3c7c('0x51')]('/')+0x1,_0x18f7a9['indexOf']('@'));_0x17266c=_[_0x3c7c('0x1e')](this[_0x3c7c('0x10')],function(_0x47df74){return _0x47df74['mobile']==_0x4edb70||_0x47df74[_0x3c7c('0x52')]==_0x4edb70||_0x47df74[_0x3c7c('0x24')]==_0x4edb70;});}else{_0x4edb70=_0x18f7a9[_0x3c7c('0x50')](_0x18f7a9[_0x3c7c('0x51')]('/')+0x1,_0x18f7a9[_0x3c7c('0x53')]('-'));_0x17266c=this[_0x3c7c('0x1d')](_0x4edb70);}if(_0x17266c){_0x27a4a0[_0x3c7c('0x27')]=_[_0x3c7c('0x28')](_0x17266c[_0x3c7c('0x27')])?util[_0x3c7c('0x29')](_0x3c7c('0x20'),_0x17266c['name']):_0x17266c[_0x3c7c('0x27')];_0x27a4a0['membername']=_0x17266c[_0x3c7c('0x1f')];_0x27a4a0[_0x3c7c('0x24')]=_0x17266c['accountcode'];RpcMemberReport['voiceDialReport'](_0x27a4a0);}};Report['prototype'][_0x3c7c('0x45')]=function(_0x20b315){RpcVoiceTransferReport[_0x3c7c('0x43')][_0x20b315['transfererlinkedid']]=_0x20b315;};Report['prototype'][_0x3c7c('0x54')]=function(_0x2cfe46){RpcVoiceTransferReport['attendedTransfer'](_0x2cfe46);};module['exports']=Report; \ No newline at end of file +var _0xe211=['custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','type','dialer','lastapplication','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','originatecalleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitorFilename','monitors','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','startsWith','Local','indexOf','phone','substring','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind'];(function(_0x241ca4,_0x349ba1){var _0x105c03=function(_0x1e5c91){while(--_0x1e5c91){_0x241ca4['push'](_0x241ca4['shift']());}};_0x105c03(++_0x349ba1);}(_0xe211,0x19a));var _0x1e21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe211[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require(_0x1e21('0x0'));var util=require(_0x1e21('0x1'));var config=require(_0x1e21('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x1e21('0x3'));var RpcVoiceDialReport=require(_0x1e21('0x4'));var RpcMemberReport=require(_0x1e21('0x5'));var RpcVoiceQueueReport=require(_0x1e21('0x6'));var RpcVoiceRecording=require(_0x1e21('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x1e21('0x8'));var VoiceCallReport=require(_0x1e21('0x9'));var VoiceAgentReport=require(_0x1e21('0xa'));var VoiceDialReport=require(_0x1e21('0xb'));var UserReport=require(_0x1e21('0xc'));function Report(_0x25fe8c){this['realtime']=_0x25fe8c;this[_0x1e21('0xd')]=_0x25fe8c['agents'];this[_0x1e21('0xe')]=_0x25fe8c[_0x1e21('0xe')];}Report[_0x1e21('0xf')][_0x1e21('0x10')]=function(_0x590ba5){var _0xf50e64=new VoiceQueueReport(this[_0x1e21('0x11')]);var _0x5d989e=new VoiceAgentReport(this[_0x1e21('0x11')]);var _0x4474da=new VoiceDialReport(this[_0x1e21('0x11')]);var _0x590837=new VoiceCallReport(this['realtime']);var _0x1e61f9=new UserReport(this[_0x1e21('0x11')]);if(config['xdr']&&config[_0x1e21('0x12')][_0x1e21('0x13')]){ami['on'](_0x1e21('0x14'),this[_0x1e21('0x15')]['bind'](this));ami['on'](_0x1e21('0x16'),this[_0x1e21('0x17')][_0x1e21('0x18')](this));ami['on'](_0x1e21('0x19'),this[_0x1e21('0x1a')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x1e21('0x1b')]['bind'](this));ami['on'](_0x1e21('0x1c'),this[_0x1e21('0x1d')][_0x1e21('0x18')](this));ami['on']('attendedtransfer',this[_0x1e21('0x1e')][_0x1e21('0x18')](this));}};Report['prototype'][_0x1e21('0x1f')]=function(_0x45773f){var _0x16d571;_0x16d571=_[_0x1e21('0x20')](this[_0x1e21('0xd')],function(_0x15aa1b){return _0x15aa1b[_0x1e21('0x21')]==_0x45773f||_0x15aa1b[_0x1e21('0x22')]==_0x45773f;});if(_[_0x1e21('0x23')](_0x16d571)){var _0x2fb8b7=_[_0x1e21('0x20')](this[_0x1e21('0xe')],function(_0x313c17){return _0x313c17[_0x1e21('0x21')]==_0x45773f||_0x313c17[_0x1e21('0x22')]==_0x45773f;});if(_0x2fb8b7){_0x16d571=_[_0x1e21('0x20')](this[_0x1e21('0xd')],function(_0x593949){return _0x593949[_0x1e21('0x24')]==util[_0x1e21('0x25')](_0x1e21('0x26'),_0x2fb8b7[_0x1e21('0x22')]);});}}return _0x16d571;};Report[_0x1e21('0xf')][_0x1e21('0x15')]=function(_0x1753ea){for(var _0x808a9b=0x0;_0x808a9b<_0x1753ea[_0x1e21('0x27')];_0x808a9b+=0x1){var _0x4c7b10=this[_0x1e21('0x1f')](_0x1753ea[_0x808a9b][_0x1e21('0x28')]);if(_0x4c7b10){_0x1753ea[_0x808a9b]['accountcode']=_0x4c7b10[_0x1e21('0x21')];_0x1753ea[_0x808a9b]['assigned']=!![];_0x1753ea[_0x808a9b][_0x1e21('0x29')]=_0x4c7b10[_0x1e21('0x22')];_0x1753ea[_0x808a9b][_0x1e21('0x24')]=_[_0x1e21('0x23')](_0x4c7b10[_0x1e21('0x24')])?util['format'](_0x1e21('0x26'),_0x4c7b10[_0x1e21('0x22')]):_0x4c7b10[_0x1e21('0x24')];if(_0x1753ea[_0x808a9b][_0x1e21('0x2a')]){_0x1753ea[_0x808a9b][_0x1e21('0x2b')]=moment()[_0x1e21('0x25')](_0x1e21('0x2c'));}if(_0x1753ea[_0x808a9b][_0x1e21('0x2d')]){_0x1753ea[_0x808a9b]['queuecallerexitAt']=moment()[_0x1e21('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x1e21('0x15')](_0x1753ea[_0x808a9b]);}RpcVoiceQueueReport[_0x1e21('0x2e')](_0x1753ea[_0x808a9b]);}};function extractCalleridNumber(_0x5c76f6){var _0x393b52=_0x5c76f6[_0x1e21('0x2f')](/<(.*?)>/);return _0x393b52?_0x393b52[0x1]:_0x5c76f6;}Report[_0x1e21('0xf')][_0x1e21('0x17')]=function(_0x20699a){_0x20699a[_0x1e21('0x30')]=_0x20699a['destination']||_0x20699a['exten'];if(_0x20699a[_0x1e21('0x31')]==_0x1e21('0x32')){_0x20699a[_0x1e21('0x33')]='queue';_0x20699a['lastdata']=_0x20699a[_0x1e21('0x34')];if(_0x20699a[_0x1e21('0x35')]=='from-voip-provider'){_0x20699a[_0x1e21('0x21')]='';_0x20699a['destination']=extractCalleridNumber(_0x20699a[_0x1e21('0x36')]);}else if(_0x20699a[_0x1e21('0x35')]==_0x1e21('0x37')){if(_0x20699a[_0x1e21('0x30')]==_0x1e21('0x38')){_0x20699a[_0x1e21('0x30')]=extractCalleridNumber(_0x20699a[_0x1e21('0x39')]);_0x20699a[_0x1e21('0x3a')]=_0x20699a['originatecalleridnum'];_0x20699a[_0x1e21('0x3b')]=[_0x20699a[_0x1e21('0x3c')],_0x20699a[_0x1e21('0x3c')]=_0x20699a[_0x1e21('0x3b')]][0x0];_0x20699a[_0x1e21('0x36')]=_0x20699a[_0x1e21('0x39')];}else{_0x20699a[_0x1e21('0x30')]=_0x20699a[_0x1e21('0x3a')];_0x20699a[_0x1e21('0x3a')]=_0x20699a[_0x1e21('0x3d')];if(_0x20699a['disposition']==_0x1e21('0x3e')){_0x20699a['accountcode']=_0x20699a[_0x1e21('0x28')];}else{_0x20699a[_0x1e21('0x21')]='';}}}}else{_0x20699a[_0x1e21('0x36')]=util[_0x1e21('0x25')](_0x1e21('0x3f'),_0x20699a[_0x1e21('0x40')],_0x20699a[_0x1e21('0x3a')]);}if(RpcVoiceTransferReport[_0x1e21('0x41')][_0x20699a[_0x1e21('0x42')]]){var _0xf92570=RpcVoiceTransferReport[_0x1e21('0x41')][_0x20699a[_0x1e21('0x42')]];_0xf92570[_0x1e21('0x43')]=_0x20699a[_0x1e21('0x44')];RpcVoiceTransferReport['blindTransfer'](_0xf92570);delete RpcVoiceTransferReport[_0x1e21('0x41')][_0x20699a[_0x1e21('0x42')]];}RpcVoiceCallReport[_0x1e21('0x2e')](_0x20699a);if(_0x20699a[_0x1e21('0x45')]){for(var _0x17099d=0x0;_0x17099d<_0x20699a['monitors'][_0x1e21('0x27')];_0x17099d+=0x1){_0x20699a[_0x1e21('0x46')]=_0x20699a[_0x1e21('0x47')][_0x17099d][_0x1e21('0x48')];_0x20699a[_0x1e21('0x49')]=_0x20699a[_0x1e21('0x47')][_0x17099d][_0x1e21('0x49')];if(_0x20699a[_0x1e21('0x4a')]==_0x1e21('0x38')){_0x20699a[_0x1e21('0x3a')]=_0x20699a[_0x1e21('0x28')];_0x20699a[_0x1e21('0x40')]=_0x20699a[_0x1e21('0x4b')];_0x20699a['connectedlinenum']=_0x20699a[_0x1e21('0x21')];_0x20699a[_0x1e21('0x4b')]=_0x20699a[_0x1e21('0x4c')];_0x20699a[_0x1e21('0x4a')]=_0x20699a[_0x1e21('0x3d')];}else if(_0x20699a[_0x1e21('0x4a')]==_0x1e21('0x4d')){_0x20699a[_0x1e21('0x3a')]=_0x20699a[_0x1e21('0x30')];_0x20699a[_0x1e21('0x4a')]=_0x20699a[_0x1e21('0x3d')];}RpcVoiceRecording['create'](_0x20699a);}}};Report['prototype'][_0x1e21('0x1a')]=function(_0x576252){if(_[_0x1e21('0x4e')](_0x576252)){_0x576252['forEach'](function(_0x4c7286){RpcVoiceAgentReport[_0x1e21('0x2e')](_0x4c7286);});}else{RpcVoiceAgentReport[_0x1e21('0x2e')](_0x576252);}};Report['prototype'][_0x1e21('0x1b')]=function(_0x2c0700){RpcVoiceDialReport[_0x1e21('0x2e')](_0x2c0700);var _0x27fb31;var _0x2aefe4;var _0x4ddeee=_0x2c0700[_0x1e21('0x3c')];if(_[_0x1e21('0x4f')](_0x4ddeee,_0x1e21('0x50'))){_0x2aefe4=_0x4ddeee['substring'](_0x4ddeee[_0x1e21('0x51')]('/')+0x1,_0x4ddeee[_0x1e21('0x51')]('@'));_0x27fb31=_[_0x1e21('0x20')](this['agents'],function(_0x5093aa){return _0x5093aa['mobile']==_0x2aefe4||_0x5093aa[_0x1e21('0x52')]==_0x2aefe4||_0x5093aa[_0x1e21('0x21')]==_0x2aefe4;});}else{_0x2aefe4=_0x4ddeee[_0x1e21('0x53')](_0x4ddeee[_0x1e21('0x51')]('/')+0x1,_0x4ddeee[_0x1e21('0x54')]('-'));_0x27fb31=this['findAgent'](_0x2aefe4);}if(_0x27fb31){_0x2c0700['interface']=_[_0x1e21('0x23')](_0x27fb31[_0x1e21('0x24')])?util[_0x1e21('0x25')](_0x1e21('0x26'),_0x27fb31['name']):_0x27fb31[_0x1e21('0x24')];_0x2c0700[_0x1e21('0x4c')]=_0x27fb31[_0x1e21('0x22')];_0x2c0700[_0x1e21('0x21')]=_0x27fb31[_0x1e21('0x21')];RpcMemberReport['voiceDialReport'](_0x2c0700);}};Report[_0x1e21('0xf')]['blindTransfer']=function(_0x4eb743){RpcVoiceTransferReport[_0x1e21('0x41')][_0x4eb743[_0x1e21('0x55')]]=_0x4eb743;};Report[_0x1e21('0xf')][_0x1e21('0x1e')]=function(_0x432eef){RpcVoiceTransferReport[_0x1e21('0x1e')](_0x432eef);};module[_0x1e21('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 45b31d7..b82507e 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcf8=['../../../config/environment','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','syncDeviceState','peerstatus','syncPeerStatus','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','debug','[userReport][registry]','stateRegistry','merge','omit','username','state','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','Local','indexOf','find','mobile','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:%s','exports','lodash','moment','util','ioredis','bluebird'];(function(_0x5e17e3,_0x18a1d8){var _0x4d2325=function(_0x4dcf5c){while(--_0x4dcf5c){_0x5e17e3['push'](_0x5e17e3['shift']());}};_0x4d2325(++_0x18a1d8);}(_0xfcf8,0x8f));var _0x8fcf=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xfcf8[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x8fcf('0x0'));var moment=require(_0x8fcf('0x1'));var util=require(_0x8fcf('0x2'));var Redis=require(_0x8fcf('0x3'));var BPromise=require(_0x8fcf('0x4'));var config=require(_0x8fcf('0x5'));var logger=require('../../../config/logger')(_0x8fcf('0x6'));var ami=require(_0x8fcf('0x7'));config['redis']=_['defaults'](config[_0x8fcf('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x8fcf('0x9'))(new Redis(config[_0x8fcf('0x8')]));function UserReport(_0x1d05d4){this[_0x8fcf('0xa')]=_0x1d05d4[_0x8fcf('0xa')];this[_0x8fcf('0xb')]=_0x1d05d4[_0x8fcf('0xb')];this['telephones']=_0x1d05d4[_0x8fcf('0xc')];ami['on'](_0x8fcf('0xd'),this[_0x8fcf('0xe')][_0x8fcf('0xf')](this));ami['on']('registry',this[_0x8fcf('0xe')][_0x8fcf('0xf')](this));ami['on']('devicestatechange',this[_0x8fcf('0x10')]['bind'](this));ami['on'](_0x8fcf('0x11'),this[_0x8fcf('0x12')][_0x8fcf('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0x8fcf('0x13')](ami[_0x8fcf('0x14')]())[_0x8fcf('0x15')](function(_0x41db9b){logger[_0x8fcf('0x16')](_0x8fcf('0x17'),util[_0x8fcf('0x18')](_0x41db9b,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8fcf('0x19')]()[_0x8fcf('0x13')](ami[_0x8fcf('0x1a')]())[_0x8fcf('0x15')](function(_0x4e5064){logger[_0x8fcf('0x16')](_0x8fcf('0x1b'),util[_0x8fcf('0x18')](_0x4e5064,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0x8fcf('0x1c')]())[_0x8fcf('0x15')](function(_0x13008a){logger[_0x8fcf('0x16')](_0x8fcf('0x1d'),util['inspect'](_0x13008a,{'showHidden':![],'depth':null}));});}UserReport[_0x8fcf('0x1e')][_0x8fcf('0x1f')]=function(){setInterval(function(){BPromise[_0x8fcf('0x19')]()[_0x8fcf('0x13')](showSipRegistrations())[_0x8fcf('0x13')](listDeviceStates())[_0x8fcf('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x8fcf('0x1e')][_0x8fcf('0x20')]=function(_0x1673f6){return _0x1673f6!==null&&!_[_0x8fcf('0x21')](_0x1673f6);};UserReport[_0x8fcf('0x1e')][_0x8fcf('0x22')]=function(_0x2842a8,_0x338662,_0x255b35){io['to'](_0x2842a8)['emit'](_0x338662,_0x255b35);};UserReport[_0x8fcf('0x1e')][_0x8fcf('0xe')]=function(_0x4ac8fc){try{if(this[_0x8fcf('0x20')](_0x4ac8fc)){logger['info'](_0x8fcf('0x23'),_0x4ac8fc['username'],_0x4ac8fc['state']);logger[_0x8fcf('0x24')](_0x8fcf('0x25'),util['inspect'](_0x4ac8fc,{'showHidden':![],'depth':null}));var _0x4c3235=_['find'](this['trunks'],{'registry':_0x4ac8fc['username']});if(_0x4c3235){_0x4ac8fc[_0x8fcf('0x26')]=_0x4ac8fc['state'];_[_0x8fcf('0x27')](_0x4c3235,_[_0x8fcf('0x28')](_0x4ac8fc,['event','actionid',_0x8fcf('0x29'),_0x8fcf('0x2a')]));logger[_0x8fcf('0x24')](_0x8fcf('0x2b'),util[_0x8fcf('0x18')](_0x4c3235,{'showHidden':![],'depth':null}));this['emit'](util[_0x8fcf('0x2c')]('trunk:%s',_0x4c3235[_0x8fcf('0x2d')]),'trunk:save',_0x4c3235);}}}catch(_0x2df8ef){logger['error']('[userReport][registry]',util[_0x8fcf('0x18')](_0x2df8ef,{'showHidden':![],'depth':null}));}};UserReport[_0x8fcf('0x1e')]['syncDeviceState']=function(_0xf950ae){try{if(this[_0x8fcf('0x20')](_0xf950ae)){logger[_0x8fcf('0x2e')](_0x8fcf('0x2f'),_0xf950ae['device'],_0xf950ae['state']);logger[_0x8fcf('0x24')]('[userReport][devicestatechange]',util[_0x8fcf('0x18')](_0xf950ae,{'showHidden':![],'depth':null}));if(this[_0x8fcf('0xb')][_0xf950ae[_0x8fcf('0x30')]]){if(!this[_0x8fcf('0xb')][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x31')]||_0xf950ae['state'][_0x8fcf('0x32')]()=='inuse'){this[_0x8fcf('0xb')][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x31')]=![];if(this['agents'][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x2a')]!==_0xf950ae[_0x8fcf('0x2a')][_0x8fcf('0x32')]()){this[_0x8fcf('0xb')][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x33')]=_[_0x8fcf('0x34')](moment()['format']('x'));}this[_0x8fcf('0xb')][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x2a')]=_0xf950ae['state'][_0x8fcf('0x32')]();this[_0x8fcf('0xb')][_0xf950ae['device']][_0x8fcf('0x35')](_0xf950ae);}}else if(this['telephones'][_0xf950ae[_0x8fcf('0x30')]]){if(this[_0x8fcf('0xc')][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x2a')]!==_0xf950ae[_0x8fcf('0x2a')]['toLowerCase']()){this[_0x8fcf('0xc')][_0xf950ae['device']]['stateTime']=_[_0x8fcf('0x34')](moment()['format']('x'));}this[_0x8fcf('0xc')][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x2a')]=_0xf950ae['state'][_0x8fcf('0x32')]();logger['debug'](_0x8fcf('0x36'),util[_0x8fcf('0x18')](this[_0x8fcf('0xc')][_0xf950ae[_0x8fcf('0x30')]],{'showHidden':![],'depth':null}));this[_0x8fcf('0x22')](util[_0x8fcf('0x2c')](_0x8fcf('0x37'),this[_0x8fcf('0xc')][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x2d')]),_0x8fcf('0x38'),this[_0x8fcf('0xc')][_0xf950ae[_0x8fcf('0x30')]]);}else if(this[_0x8fcf('0xa')][_0xf950ae[_0x8fcf('0x30')]]){if(this[_0x8fcf('0xa')][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x2a')]!==_0xf950ae[_0x8fcf('0x2a')][_0x8fcf('0x32')]()){this[_0x8fcf('0xa')][_0xf950ae[_0x8fcf('0x30')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0x8fcf('0xa')][_0xf950ae['device']][_0x8fcf('0x2a')]=_0xf950ae['state'][_0x8fcf('0x32')]();logger[_0x8fcf('0x24')](_0x8fcf('0x39'),util['inspect'](this[_0x8fcf('0xa')][_0xf950ae[_0x8fcf('0x30')]],{'showHidden':![],'depth':null}));this[_0x8fcf('0x22')](util[_0x8fcf('0x2c')]('trunk:%s',this['trunks'][_0xf950ae[_0x8fcf('0x30')]][_0x8fcf('0x2d')]),_0x8fcf('0x3a'),this[_0x8fcf('0xa')][_0xf950ae[_0x8fcf('0x30')]]);}else if(_['startsWith'](_0xf950ae[_0x8fcf('0x30')],_0x8fcf('0x3b'))){var _0x533be6=_0xf950ae[_0x8fcf('0x30')];var _0x1488cd=_0x533be6['substring'](_0x533be6[_0x8fcf('0x3c')]('/')+0x1,_0x533be6[_0x8fcf('0x3c')]('@'));var _0x2808bd=_[_0x8fcf('0x3d')](this['agents'],function(_0x22d2e3){return _0x22d2e3[_0x8fcf('0x3e')]==_0x1488cd||_0x22d2e3['phone']==_0x1488cd||_0x22d2e3[_0x8fcf('0x3f')]==_0x1488cd;});if(_0x2808bd){if(_0x2808bd[_0x8fcf('0x2a')]!==_0xf950ae[_0x8fcf('0x2a')]['toLowerCase']()){_0x2808bd[_0x8fcf('0x33')]=_[_0x8fcf('0x34')](moment()['format']('x'));}_0x2808bd[_0x8fcf('0x2a')]=_0xf950ae['state'][_0x8fcf('0x32')]();_0x2808bd[_0x8fcf('0x31')]=!![];_0x2808bd['updateStatusRealtime'](_0xf950ae);}}}}catch(_0x4007a3){logger[_0x8fcf('0x16')](_0x8fcf('0x40'),util[_0x8fcf('0x18')](_0x4007a3,{'showHidden':![],'depth':null}));}};UserReport[_0x8fcf('0x1e')][_0x8fcf('0x12')]=function(_0x5ceb47){try{if(this[_0x8fcf('0x20')](_0x5ceb47)&&this[_0x8fcf('0x20')](_0x5ceb47[_0x8fcf('0x11')])){logger[_0x8fcf('0x2e')](_0x8fcf('0x41'),_0x5ceb47[_0x8fcf('0x42')],_0x5ceb47[_0x8fcf('0x43')],_0x5ceb47[_0x8fcf('0x11')]);logger[_0x8fcf('0x24')](_0x8fcf('0x44'),util['inspect'](_0x5ceb47,{'showHidden':![],'depth':null}));if(this[_0x8fcf('0xb')][_0x5ceb47['peer']]){if(!this[_0x8fcf('0xb')][_0x5ceb47['peer']][_0x8fcf('0x31')]||_0x5ceb47['peerstatus'][_0x8fcf('0x32')]()==_0x8fcf('0x45')){this[_0x8fcf('0xb')][_0x5ceb47['peer']][_0x8fcf('0x31')]=![];this['agents'][_0x5ceb47[_0x8fcf('0x42')]][_0x8fcf('0x46')]=_0x5ceb47[_0x8fcf('0x11')][_0x8fcf('0x32')]();this[_0x8fcf('0xb')][_0x5ceb47['peer']]['address']=_0x5ceb47['address'];this[_0x8fcf('0xb')][_0x5ceb47[_0x8fcf('0x42')]][_0x8fcf('0x35')](_0x5ceb47);}}else if(this['telephones'][_0x5ceb47[_0x8fcf('0x42')]]){this[_0x8fcf('0xc')][_0x5ceb47[_0x8fcf('0x42')]]['status']=_0x5ceb47['peerstatus']['toLowerCase']();this[_0x8fcf('0xc')][_0x5ceb47[_0x8fcf('0x42')]][_0x8fcf('0x43')]=_0x5ceb47[_0x8fcf('0x43')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x8fcf('0x18')](this[_0x8fcf('0xc')][_0x5ceb47[_0x8fcf('0x42')]],{'showHidden':![],'depth':null}));this[_0x8fcf('0x22')](util[_0x8fcf('0x2c')](_0x8fcf('0x37'),this['telephones'][_0x5ceb47[_0x8fcf('0x42')]][_0x8fcf('0x2d')]),'telephone:save',this['telephones'][_0x5ceb47[_0x8fcf('0x42')]]);}else if(this[_0x8fcf('0xa')][_0x5ceb47[_0x8fcf('0x42')]]){this[_0x8fcf('0xa')][_0x5ceb47[_0x8fcf('0x42')]]['status']=_0x5ceb47[_0x8fcf('0x11')][_0x8fcf('0x32')]();this[_0x8fcf('0xa')][_0x5ceb47[_0x8fcf('0x42')]]['address']=_0x5ceb47[_0x8fcf('0x43')];logger['debug'](_0x8fcf('0x47'),util['inspect'](this[_0x8fcf('0xa')][_0x5ceb47['peer']],{'showHidden':![],'depth':null}));this[_0x8fcf('0x22')](util['format'](_0x8fcf('0x48'),this[_0x8fcf('0xa')][_0x5ceb47['peer']]['name']),_0x8fcf('0x3a'),this[_0x8fcf('0xa')][_0x5ceb47[_0x8fcf('0x42')]]);}}}catch(_0x2acdac){logger[_0x8fcf('0x16')]('[userReport][peerstatus]',util['inspect'](_0x2acdac,{'showHidden':![],'depth':null}));}};module[_0x8fcf('0x49')]=UserReport; \ No newline at end of file +var _0xef2a=['localhost','trunks','telephones','registryentry','syncRegistry','bind','registry','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','[userReport][devicestatelist]','inspect','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','agents','local','toLowerCase','stateTime','toNumber','format','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','startsWith','Local','substring','indexOf','phone','peerstatus','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xef2a,0x1a0));var _0xaef2=function(_0x5228cd,_0x268079){_0x5228cd=_0x5228cd-0x0;var _0x184e51=_0xef2a[_0x5228cd];return _0x184e51;};'use strict';var _=require(_0xaef2('0x0'));var moment=require(_0xaef2('0x1'));var util=require(_0xaef2('0x2'));var Redis=require(_0xaef2('0x3'));var BPromise=require(_0xaef2('0x4'));var config=require(_0xaef2('0x5'));var logger=require(_0xaef2('0x6'))(_0xaef2('0x7'));var ami=require('../ami');config[_0xaef2('0x8')]=_[_0xaef2('0x9')](config['redis'],{'host':_0xaef2('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaef2('0x8')]));function UserReport(_0x50be70){this[_0xaef2('0xb')]=_0x50be70['trunks'];this['agents']=_0x50be70['agents'];this['telephones']=_0x50be70[_0xaef2('0xc')];ami['on'](_0xaef2('0xd'),this[_0xaef2('0xe')][_0xaef2('0xf')](this));ami['on'](_0xaef2('0x10'),this[_0xaef2('0xe')][_0xaef2('0xf')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0xaef2('0xf')](this));ami['on']('peerstatus',this[_0xaef2('0x11')][_0xaef2('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xaef2('0x12')]()[_0xaef2('0x13')](ami[_0xaef2('0x14')]())[_0xaef2('0x15')](function(_0x2deaf1){logger[_0xaef2('0x16')](_0xaef2('0x17'),util['inspect'](_0x2deaf1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xaef2('0x12')]()[_0xaef2('0x13')](ami['actionDeviceStateList']())[_0xaef2('0x15')](function(_0x55e95b){logger['error'](_0xaef2('0x18'),util[_0xaef2('0x19')](_0x55e95b,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xaef2('0x12')]()[_0xaef2('0x13')](ami['actionSipPeerStatus']())['catch'](function(_0x22e732){logger[_0xaef2('0x16')](_0xaef2('0x1a'),util['inspect'](_0x22e732,{'showHidden':![],'depth':null}));});}UserReport[_0xaef2('0x1b')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xaef2('0x12')]()[_0xaef2('0x13')](showSipRegistrations())[_0xaef2('0x13')](listDeviceStates())[_0xaef2('0x13')](showPeersStatus());},0x32c8);};UserReport[_0xaef2('0x1b')][_0xaef2('0x1c')]=function(_0x2a2038){return _0x2a2038!==null&&!_[_0xaef2('0x1d')](_0x2a2038);};UserReport[_0xaef2('0x1b')][_0xaef2('0x1e')]=function(_0x1ca561,_0x46c5c7,_0xaba580){io['to'](_0x1ca561)[_0xaef2('0x1e')](_0x46c5c7,_0xaba580);};UserReport[_0xaef2('0x1b')][_0xaef2('0xe')]=function(_0x4f0984){try{if(this[_0xaef2('0x1c')](_0x4f0984)){logger[_0xaef2('0x1f')](_0xaef2('0x20'),_0x4f0984[_0xaef2('0x21')],_0x4f0984[_0xaef2('0x22')]);logger['debug'](_0xaef2('0x23'),util[_0xaef2('0x19')](_0x4f0984,{'showHidden':![],'depth':null}));var _0x5d8c80=_[_0xaef2('0x24')](this[_0xaef2('0xb')],{'registry':_0x4f0984[_0xaef2('0x21')]});if(_0x5d8c80){_0x4f0984[_0xaef2('0x25')]=_0x4f0984[_0xaef2('0x22')];_[_0xaef2('0x26')](_0x5d8c80,_[_0xaef2('0x27')](_0x4f0984,[_0xaef2('0x28'),_0xaef2('0x29'),'username',_0xaef2('0x22')]));logger[_0xaef2('0x2a')](_0xaef2('0x2b'),util['inspect'](_0x5d8c80,{'showHidden':![],'depth':null}));this[_0xaef2('0x1e')](util['format'](_0xaef2('0x2c'),_0x5d8c80[_0xaef2('0x2d')]),_0xaef2('0x2e'),_0x5d8c80);}}}catch(_0x3d5054){logger['error'](_0xaef2('0x23'),util[_0xaef2('0x19')](_0x3d5054,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x46346e){try{if(this[_0xaef2('0x1c')](_0x46346e)){logger[_0xaef2('0x1f')](_0xaef2('0x2f'),_0x46346e[_0xaef2('0x30')],_0x46346e[_0xaef2('0x22')]);logger[_0xaef2('0x2a')](_0xaef2('0x31'),util['inspect'](_0x46346e,{'showHidden':![],'depth':null}));if(this[_0xaef2('0x32')][_0x46346e['device']]){if(!this['agents'][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x33')]||_0x46346e[_0xaef2('0x22')][_0xaef2('0x34')]()=='inuse'){this['agents'][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x33')]=![];if(this['agents'][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x22')]!==_0x46346e['state'][_0xaef2('0x34')]()){this[_0xaef2('0x32')][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x35')]=_[_0xaef2('0x36')](moment()[_0xaef2('0x37')]('x'));}this[_0xaef2('0x32')][_0x46346e['device']]['state']=_0x46346e[_0xaef2('0x22')]['toLowerCase']();this[_0xaef2('0x32')][_0x46346e['device']][_0xaef2('0x38')](_0x46346e);}}else if(this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]]){if(this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x22')]!==_0x46346e[_0xaef2('0x22')][_0xaef2('0x34')]()){this[_0xaef2('0xc')][_0x46346e['device']]['stateTime']=_[_0xaef2('0x36')](moment()[_0xaef2('0x37')]('x'));}this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x22')]=_0x46346e[_0xaef2('0x22')][_0xaef2('0x34')]();logger[_0xaef2('0x2a')](_0xaef2('0x39'),util['inspect'](this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]],{'showHidden':![],'depth':null}));this[_0xaef2('0x1e')](util[_0xaef2('0x37')]('telephone:%s',this[_0xaef2('0xc')][_0x46346e['device']][_0xaef2('0x2d')]),'telephone:save',this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]]);}else if(this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]]){if(this[_0xaef2('0xb')][_0x46346e['device']][_0xaef2('0x22')]!==_0x46346e['state'][_0xaef2('0x34')]()){this[_0xaef2('0xb')][_0x46346e['device']][_0xaef2('0x35')]=_[_0xaef2('0x36')](moment()['format']('x'));}this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]]['state']=_0x46346e['state']['toLowerCase']();logger[_0xaef2('0x2a')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xaef2('0x19')](this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xaef2('0x37')]('trunk:%s',this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x2d')]),_0xaef2('0x2e'),this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]]);}else if(_[_0xaef2('0x3a')](_0x46346e[_0xaef2('0x30')],_0xaef2('0x3b'))){var _0x599fb6=_0x46346e['device'];var _0x59699d=_0x599fb6[_0xaef2('0x3c')](_0x599fb6[_0xaef2('0x3d')]('/')+0x1,_0x599fb6[_0xaef2('0x3d')]('@'));var _0x24f706=_['find'](this[_0xaef2('0x32')],function(_0x1bd4e3){return _0x1bd4e3['mobile']==_0x59699d||_0x1bd4e3[_0xaef2('0x3e')]==_0x59699d||_0x1bd4e3['accountcode']==_0x59699d;});if(_0x24f706){if(_0x24f706['state']!==_0x46346e['state']['toLowerCase']()){_0x24f706[_0xaef2('0x35')]=_[_0xaef2('0x36')](moment()[_0xaef2('0x37')]('x'));}_0x24f706[_0xaef2('0x22')]=_0x46346e[_0xaef2('0x22')][_0xaef2('0x34')]();_0x24f706[_0xaef2('0x33')]=!![];_0x24f706['updateStatusRealtime'](_0x46346e);}}}}catch(_0x272cbb){logger['error'](_0xaef2('0x31'),util['inspect'](_0x272cbb,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xaef2('0x11')]=function(_0x5e4dd7){try{if(this[_0xaef2('0x1c')](_0x5e4dd7)&&this[_0xaef2('0x1c')](_0x5e4dd7[_0xaef2('0x3f')])){logger[_0xaef2('0x1f')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x5e4dd7['peer'],_0x5e4dd7[_0xaef2('0x40')],_0x5e4dd7[_0xaef2('0x3f')]);logger[_0xaef2('0x2a')](_0xaef2('0x41'),util[_0xaef2('0x19')](_0x5e4dd7,{'showHidden':![],'depth':null}));if(this[_0xaef2('0x32')][_0x5e4dd7[_0xaef2('0x42')]]){if(!this[_0xaef2('0x32')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x33')]||_0x5e4dd7[_0xaef2('0x3f')][_0xaef2('0x34')]()==_0xaef2('0x43')){this['agents'][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x33')]=![];this[_0xaef2('0x32')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x44')]=_0x5e4dd7[_0xaef2('0x3f')][_0xaef2('0x34')]();this['agents'][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x40')]=_0x5e4dd7[_0xaef2('0x40')];this[_0xaef2('0x32')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x38')](_0x5e4dd7);}}else if(this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]]){this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x44')]=_0x5e4dd7[_0xaef2('0x3f')][_0xaef2('0x34')]();this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x40')]=_0x5e4dd7[_0xaef2('0x40')];logger[_0xaef2('0x2a')](_0xaef2('0x45'),util[_0xaef2('0x19')](this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]],{'showHidden':![],'depth':null}));this[_0xaef2('0x1e')](util[_0xaef2('0x37')]('telephone:%s',this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x2d')]),'telephone:save',this[_0xaef2('0xc')][_0x5e4dd7['peer']]);}else if(this[_0xaef2('0xb')][_0x5e4dd7[_0xaef2('0x42')]]){this[_0xaef2('0xb')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x44')]=_0x5e4dd7[_0xaef2('0x3f')]['toLowerCase']();this[_0xaef2('0xb')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x40')]=_0x5e4dd7[_0xaef2('0x40')];logger[_0xaef2('0x2a')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xaef2('0x19')](this[_0xaef2('0xb')][_0x5e4dd7['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xaef2('0x37')]('trunk:%s',this['trunks'][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x2d')]),_0xaef2('0x2e'),this[_0xaef2('0xb')][_0x5e4dd7[_0xaef2('0x42')]]);}}}catch(_0x23d977){logger[_0xaef2('0x16')](_0xaef2('0x41'),util[_0xaef2('0x19')](_0x23d977,{'showHidden':![],'depth':null}));}};module[_0xaef2('0x46')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 44496bb..4049622 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x730f=['syncAgentComplete','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','syncAgentCalled','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','channels','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','agentcomplete','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','talktime','acwTimeout','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','variables','agentcalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x730f,0x11a));var _0xf730=function(_0x367bef,_0x3d5c00){_0x367bef=_0x367bef-0x0;var _0x215d1c=_0x730f[_0x367bef];return _0x215d1c;};'use strict';var _=require(_0xf730('0x0'));var moment=require(_0xf730('0x1'));var util=require(_0xf730('0x2'));var Redis=require(_0xf730('0x3'));var config=require(_0xf730('0x4'));var logger=require(_0xf730('0x5'))('ami');var ami=require(_0xf730('0x6'));config[_0xf730('0x7')]=_[_0xf730('0x8')](config[_0xf730('0x7')],{'host':_0xf730('0x9'),'port':0x18eb});var io=require(_0xf730('0xa'))(new Redis(config[_0xf730('0x7')]));function VoiceAgentReport(_0x8b27b5){this['channels']={};this[_0xf730('0xb')]=_0x8b27b5['voiceQueues'];this[_0xf730('0xc')]=_0x8b27b5[_0xf730('0xc')];this[_0xf730('0xd')]={};ami['on'](_0xf730('0xe'),this['syncAgentCalled'][_0xf730('0xf')](this));ami['on'](_0xf730('0x10'),this['syncAgentConnect'][_0xf730('0xf')](this));ami['on'](_0xf730('0x11'),this[_0xf730('0x12')]['bind'](this));ami['on']('queuecallerabandon',this[_0xf730('0x13')][_0xf730('0xf')](this));ami['on']('agentcomplete',this[_0xf730('0x14')][_0xf730('0xf')](this));ami['on']('varset',this['syncVarSet'][_0xf730('0xf')](this));ami['on']('hangup',this[_0xf730('0x15')][_0xf730('0xf')](this));ami['on'](_0xf730('0x16'),this[_0xf730('0x17')][_0xf730('0xf')](this));ami['on'](_0xf730('0x18'),this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0xf730('0x19'),this[_0xf730('0x1a')][_0xf730('0xf')](this));ami['on'](_0xf730('0x1b'),this[_0xf730('0x1c')]['bind'](this));}VoiceAgentReport[_0xf730('0x1d')][_0xf730('0x1e')]=function(_0x1be406,_0x18e971,_0x46cce0){io['to'](_0x1be406)[_0xf730('0x1e')](_0x18e971,_0x46cce0);};VoiceAgentReport[_0xf730('0x1d')]['isNotNull']=function(_0x453b4e){return _0x453b4e!==null&&!_['isUndefined'](_0x453b4e);};VoiceAgentReport['prototype'][_0xf730('0x1f')]=function(_0x557756){try{if(this[_0xf730('0x20')](_0x557756)){logger[_0xf730('0x21')](_0xf730('0x22'),_0x557756[_0xf730('0x23')],_0x557756['membername'],_0x557756['destuniqueid']);logger[_0xf730('0x24')](_0xf730('0x25'),_0x557756[_0xf730('0x23')],util[_0xf730('0x26')](_0x557756,{'showHidden':![],'depth':null}));if(_[_0xf730('0x27')](this[_0xf730('0x28')][_0x557756[_0xf730('0x23')]])){this[_0xf730('0x28')][_0x557756[_0xf730('0x23')]]={};}if(_['isUndefined'](this[_0xf730('0x28')][_0x557756[_0xf730('0x23')]][_0x557756[_0xf730('0x29')]])){this[_0xf730('0x28')][_0x557756[_0xf730('0x23')]][_0x557756[_0xf730('0x29')]]={'agentcalledAt':moment()[_0xf730('0x2a')](_0xf730('0x2b')),'lastevent':_0xf730('0x2c'),'mandatoryDisposition':this['voiceQueues'][_0x557756[_0xf730('0x2d')]]?this[_0xf730('0xb')][_0x557756['queue']][_0xf730('0x2e')]||![]:![],'type':this[_0xf730('0xb')][_0x557756[_0xf730('0x2d')]]?this[_0xf730('0xb')][_0x557756[_0xf730('0x2d')]][_0xf730('0x2f')]||_0xf730('0x30'):_0xf730('0x30'),'variables':this[_0xf730('0xd')][_0x557756['uniqueid']]};}_[_0xf730('0x31')](this['channels'][_0x557756['uniqueid']][_0x557756[_0xf730('0x29')]],_['omit'](_0x557756,['event','privilege']));logger['debug'](_0xf730('0x32'),_0x557756[_0xf730('0x23')],util[_0xf730('0x26')](this['channels'][_0x557756[_0xf730('0x23')]][_0x557756['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xf730('0x33'),this[_0xf730('0x28')][_0x557756[_0xf730('0x23')]][_0x557756[_0xf730('0x29')]]);logger[_0xf730('0x24')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x557756[_0xf730('0x23')],util[_0xf730('0x26')](this[_0xf730('0x28')][_0x557756[_0xf730('0x23')]][_0x557756[_0xf730('0x29')]],{'showHidden':![],'depth':null}));this[_0xf730('0x1e')](util['format']('user:%s',_0x557756[_0xf730('0x34')]),_0xf730('0x35'),this['channels'][_0x557756['uniqueid']][_0x557756[_0xf730('0x29')]]);}}catch(_0x480d1e){logger[_0xf730('0x36')](_0xf730('0x37'),_0x557756[_0xf730('0x23')],util[_0xf730('0x26')](_0x480d1e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf730('0x1d')][_0xf730('0x38')]=function(_0x2f2fd6){try{if(this[_0xf730('0x20')](_0x2f2fd6)){if(this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]]){logger['debug']('[%s][voiceAgentReport][agentconnect]\x20event:',_0x2f2fd6[_0xf730('0x23')],util[_0xf730('0x26')](_0x2f2fd6,{'showHidden':![],'depth':null}));for(var _0x4c2e24 in this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]]){if(this['channels'][_0x2f2fd6[_0xf730('0x23')]][_0xf730('0x39')](_0x4c2e24)){if(_0x2f2fd6['destuniqueid']===_0x4c2e24){logger['info'](_0xf730('0x3a'),_0x2f2fd6[_0xf730('0x23')],_0x2f2fd6[_0xf730('0x34')],_0x2f2fd6[_0xf730('0x29')]);this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24][_0xf730('0x3b')]=moment()[_0xf730('0x2a')](_0xf730('0x2b'));this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24][_0xf730('0x3c')]=_0x2f2fd6[_0xf730('0x3c')];this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24][_0xf730('0x3d')]=_0x2f2fd6[_0xf730('0x3d')];this[_0xf730('0x28')][_0x2f2fd6['uniqueid']][_0x4c2e24][_0xf730('0x3e')]=_0x2f2fd6[_0xf730('0x3e')];this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24][_0xf730('0x3f')]=_0x2f2fd6[_0xf730('0x3f')];this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24][_0xf730('0x40')]=_0x2f2fd6[_0xf730('0x40')];this['channels'][_0x2f2fd6['uniqueid']][_0x4c2e24][_0xf730('0x41')]=_0xf730('0x42');_[_0xf730('0x31')](this['agents'][_0x2f2fd6['interface']],_[_0xf730('0x43')](_0x2f2fd6,[_0xf730('0x2d'),_0xf730('0x44')]));logger[_0xf730('0x24')](_0xf730('0x45'),_0x2f2fd6[_0xf730('0x23')],util['inspect'](this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x2f2fd6['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xf730('0x1e')](_0xf730('0x46'),this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x2f2fd6['destuniqueid']]);logger['debug'](_0xf730('0x47'),_0x2f2fd6[_0xf730('0x23')],util[_0xf730('0x26')](this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x2f2fd6[_0xf730('0x29')]],{'showHidden':![],'depth':null}));this[_0xf730('0x1e')](util[_0xf730('0x2a')](_0xf730('0x48'),_0x2f2fd6[_0xf730('0x34')]),'user:agentconnect',this['channels'][_0x2f2fd6['uniqueid']][_0x2f2fd6['destuniqueid']]);}else if(!this['channels'][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24][_0xf730('0x11')]&&!this[_0xf730('0x28')][_0x2f2fd6['uniqueid']][_0x4c2e24]['agentcomplete']){logger[_0xf730('0x21')](_0xf730('0x49'),_0x2f2fd6[_0xf730('0x23')],this[_0xf730('0x28')][_0x2f2fd6['uniqueid']][_0x4c2e24][_0xf730('0x34')],_0x4c2e24);this['channels'][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24]['agentringnoanswer']=!![];this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24][_0xf730('0x4a')]=moment()[_0xf730('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24]['answeredelsewheredestinationuniqueid']=_0x2f2fd6[_0xf730('0x29')];this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24][_0xf730('0x4b')]=_0x2f2fd6[_0xf730('0x34')];this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24]['lastevent']=_0xf730('0x4c');this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24]['reason']='answered_elsewhere';logger[_0xf730('0x24')](_0xf730('0x4d'),_0x2f2fd6[_0xf730('0x23')],util[_0xf730('0x26')](this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24],{'showHidden':![],'depth':null}));ami[_0xf730('0x1e')]('custom:agentansweredelsewhere',this[_0xf730('0x28')][_0x2f2fd6[_0xf730('0x23')]][_0x4c2e24]);}}}}}}catch(_0x4ad7b4){logger[_0xf730('0x36')](_0xf730('0x4e'),_0x2f2fd6['uniqueid'],util['inspect'](_0x4ad7b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf730('0x1d')][_0xf730('0x12')]=function(_0x1e5c28){try{if(this['isNotNull'](_0x1e5c28)){logger[_0xf730('0x24')](_0xf730('0x4f'),_0x1e5c28[_0xf730('0x23')],util[_0xf730('0x26')](_0x1e5c28,{'showHidden':![],'depth':null}));if(this[_0xf730('0x28')][_0x1e5c28['uniqueid']]&&this['channels'][_0x1e5c28['uniqueid']][_0x1e5c28[_0xf730('0x29')]]){logger[_0xf730('0x21')](_0xf730('0x50'),_0x1e5c28[_0xf730('0x23')],_0x1e5c28[_0xf730('0x34')],_0x1e5c28[_0xf730('0x29')]);this[_0xf730('0x28')][_0x1e5c28[_0xf730('0x23')]][_0x1e5c28['destuniqueid']][_0xf730('0x11')]=!![];this[_0xf730('0x28')][_0x1e5c28[_0xf730('0x23')]][_0x1e5c28['destuniqueid']][_0xf730('0x4a')]=moment()['format'](_0xf730('0x2b'));this[_0xf730('0x28')][_0x1e5c28[_0xf730('0x23')]][_0x1e5c28[_0xf730('0x29')]][_0xf730('0x41')]=_0xf730('0x51');this[_0xf730('0x28')][_0x1e5c28[_0xf730('0x23')]][_0x1e5c28[_0xf730('0x29')]]['reason']=_0xf730('0x51');logger[_0xf730('0x24')](_0xf730('0x52'),_0x1e5c28[_0xf730('0x23')],util['inspect'](this[_0xf730('0x28')][_0x1e5c28[_0xf730('0x23')]][_0x1e5c28['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xf730('0x1e')](_0xf730('0x53'),this[_0xf730('0x28')][_0x1e5c28[_0xf730('0x23')]][_0x1e5c28[_0xf730('0x29')]]);}}}catch(_0x4a8106){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x1e5c28[_0xf730('0x23')],util[_0xf730('0x26')](_0x4a8106,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0xdbf299){try{if(this[_0xf730('0x20')](_0xdbf299)){logger[_0xf730('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0xdbf299[_0xf730('0x23')],util[_0xf730('0x26')](_0xdbf299,{'showHidden':![],'depth':null}));if(this[_0xf730('0x28')][_0xdbf299[_0xf730('0x23')]]){for(var _0x3492c3 in this[_0xf730('0x28')][_0xdbf299[_0xf730('0x23')]]){if(this[_0xf730('0x28')][_0xdbf299['uniqueid']][_0xf730('0x39')](_0x3492c3)&&!this[_0xf730('0x28')][_0xdbf299[_0xf730('0x23')]][_0x3492c3][_0xf730('0x11')]&&!this[_0xf730('0x28')][_0xdbf299[_0xf730('0x23')]][_0x3492c3][_0xf730('0x54')]){logger[_0xf730('0x21')](_0xf730('0x55'),_0xdbf299[_0xf730('0x23')],this['channels'][_0xdbf299[_0xf730('0x23')]][_0x3492c3][_0xf730('0x34')],_0x3492c3);this['channels'][_0xdbf299['uniqueid']][_0x3492c3][_0xf730('0x11')]=!![];this[_0xf730('0x28')][_0xdbf299[_0xf730('0x23')]][_0x3492c3][_0xf730('0x4a')]=moment()[_0xf730('0x2a')](_0xf730('0x2b'));this['channels'][_0xdbf299['uniqueid']][_0x3492c3]['lastevent']=_0xf730('0x56');this['channels'][_0xdbf299[_0xf730('0x23')]][_0x3492c3][_0xf730('0x57')]=_0xf730('0x56');logger[_0xf730('0x24')](_0xf730('0x58'),_0xdbf299[_0xf730('0x23')],util[_0xf730('0x26')](this[_0xf730('0x28')][_0xdbf299[_0xf730('0x23')]][_0x3492c3],{'showHidden':![],'depth':null}));ami['emit'](_0xf730('0x59'),this[_0xf730('0x28')][_0xdbf299[_0xf730('0x23')]][_0x3492c3]);}}}}}catch(_0x4560ea){logger[_0xf730('0x36')](_0xf730('0x5a'),_0xdbf299[_0xf730('0x23')],util[_0xf730('0x26')](_0x4560ea,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xf730('0x14')]=function(_0x4c2bb2){try{if(this[_0xf730('0x20')](_0x4c2bb2)){logger[_0xf730('0x24')](_0xf730('0x5b'),_0x4c2bb2[_0xf730('0x23')],util['inspect'](_0x4c2bb2,{'showHidden':![],'depth':null}));if(this['channels'][_0x4c2bb2['uniqueid']]){for(var _0x594d18 in this[_0xf730('0x28')][_0x4c2bb2[_0xf730('0x23')]]){if(this[_0xf730('0x28')][_0x4c2bb2[_0xf730('0x23')]][_0xf730('0x39')](_0x594d18)){if(this['channels'][_0x4c2bb2[_0xf730('0x23')]][_0x594d18][_0xf730('0x3b')]&&!this[_0xf730('0x28')][_0x4c2bb2[_0xf730('0x23')]][_0x594d18][_0xf730('0x54')]){logger[_0xf730('0x21')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4c2bb2['uniqueid'],this[_0xf730('0x28')][_0x4c2bb2[_0xf730('0x23')]][_0x594d18][_0xf730('0x34')],_0x594d18);this[_0xf730('0x28')][_0x4c2bb2[_0xf730('0x23')]][_0x594d18][_0xf730('0x54')]=!![];this[_0xf730('0x28')][_0x4c2bb2['uniqueid']][_0x594d18][_0xf730('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xf730('0x28')][_0x4c2bb2['uniqueid']][_0x594d18][_0xf730('0x41')]=_0xf730('0x5d');this[_0xf730('0x28')][_0x4c2bb2['uniqueid']][_0x594d18]['reason']=_0x4c2bb2[_0xf730('0x57')]=='transfer'?'agent':_0x4c2bb2[_0xf730('0x57')];this[_0xf730('0x28')][_0x4c2bb2[_0xf730('0x23')]][_0x594d18][_0xf730('0x5e')]=_0x4c2bb2[_0xf730('0x5e')];if(this[_0xf730('0xb')][_0x4c2bb2[_0xf730('0x2d')]]&&this[_0xf730('0xb')][_0x4c2bb2[_0xf730('0x2d')]]['acw']){this[_0xf730('0x28')][_0x4c2bb2[_0xf730('0x23')]][_0x594d18]['acwtime']=this['voiceQueues'][_0x4c2bb2[_0xf730('0x2d')]][_0xf730('0x5f')];this[_0xf730('0x28')][_0x4c2bb2[_0xf730('0x23')]][_0x594d18]['agentacw']=!![];}this[_0xf730('0xc')][_0x4c2bb2[_0xf730('0x60')]]=_['omit'](this['agents'][_0x4c2bb2[_0xf730('0x60')]],[_0xf730('0x2d'),_0xf730('0x44')]);logger[_0xf730('0x24')](_0xf730('0x61'),_0x4c2bb2[_0xf730('0x23')],util[_0xf730('0x26')](this['channels'][_0x4c2bb2[_0xf730('0x23')]][_0x594d18],{'showHidden':![],'depth':null}));ami[_0xf730('0x1e')](_0xf730('0x62'),this['channels'][_0x4c2bb2['uniqueid']][_0x594d18]);logger[_0xf730('0x24')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x4c2bb2[_0xf730('0x23')],util['inspect'](this[_0xf730('0x28')][_0x4c2bb2[_0xf730('0x23')]][_0x594d18],{'showHidden':![],'depth':null}));this['emit'](util[_0xf730('0x2a')](_0xf730('0x48'),_0x4c2bb2['membername']),'user:agentcomplete',this['channels'][_0x4c2bb2[_0xf730('0x23')]][_0x594d18]);}}}}}}catch(_0x9b9c0a){logger[_0xf730('0x36')](_0xf730('0x63'),_0x4c2bb2[_0xf730('0x23')],util['inspect'](_0x9b9c0a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xf730('0x64')]=function(_0x5e489c){try{if(this[_0xf730('0x20')](_0x5e489c)){logger['debug'](_0xf730('0x65'),_0x5e489c[_0xf730('0x23')],util[_0xf730('0x26')](_0x5e489c,{'showHidden':![],'depth':null}));this[_0xf730('0x66')](_0x5e489c['uniqueid'],_[_0xf730('0x67')](_0x5e489c['variable'])[0x0],_0x5e489c[_0xf730('0x68')]);if(this[_0xf730('0x28')][_0x5e489c[_0xf730('0x23')]]){for(var _0x5a2ce0 in this['channels'][_0x5e489c[_0xf730('0x23')]]){if(this['channels'][_0x5e489c['uniqueid']][_0xf730('0x39')](_0x5a2ce0)){logger[_0xf730('0x21')](_0xf730('0x69'),_0x5e489c[_0xf730('0x23')],_0x5a2ce0,_['keys'](_0x5e489c[_0xf730('0x6a')])[0x0],_0x5e489c['value']);if(_[_0xf730('0x27')](this[_0xf730('0x28')][_0x5e489c[_0xf730('0x23')]][_0x5a2ce0][_0xf730('0xd')])){this[_0xf730('0x28')][_0x5e489c['uniqueid']][_0x5a2ce0][_0xf730('0xd')]={};}this[_0xf730('0x28')][_0x5e489c['uniqueid']][_0x5a2ce0][_0xf730('0xd')]=this['variables'][_0x5e489c['uniqueid']];}}}}}catch(_0x44067b){logger[_0xf730('0x36')](_0xf730('0x6b'),_0x5e489c[_0xf730('0x23')],util[_0xf730('0x26')](_0x44067b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf730('0x1d')][_0xf730('0x66')]=function(_0x529275,_0x3e666f,_0x1f0b74){var _0x7b0a9a=[_0xf730('0x6c'),_0xf730('0x6d'),'rtpaudioqosjitter',_0xf730('0x6e'),'rtpaudioqosloss',_0xf730('0x6f'),_0xf730('0x70'),_0xf730('0x71'),_0xf730('0x72'),_0xf730('0x73'),_0xf730('0x74'),_0xf730('0x75'),_0xf730('0x76'),_0xf730('0x77'),_0xf730('0x78'),_0xf730('0x79'),_0xf730('0x34'),_0xf730('0x7a'),_0xf730('0x7b')];if(!_[_0xf730('0x7c')](_0x3e666f)&&!_[_0xf730('0x7d')](_0x7b0a9a,_0x3e666f)){if(_['isUndefined'](this[_0xf730('0xd')][_0x529275])){this[_0xf730('0xd')][_0x529275]={};}this['variables'][_0x529275][_0x3e666f]=_0x1f0b74;}};VoiceAgentReport[_0xf730('0x1d')][_0xf730('0x15')]=function(_0x3bb0be){try{if(this[_0xf730('0x20')](_0x3bb0be)){logger[_0xf730('0x24')](_0xf730('0x7e'),_0x3bb0be['uniqueid'],util[_0xf730('0x26')](_0x3bb0be,{'showHidden':![],'depth':null}));if(this[_0xf730('0x28')][_0x3bb0be['uniqueid']]){for(var _0x1870b5 in this[_0xf730('0x28')][_0x3bb0be[_0xf730('0x23')]]){if(this[_0xf730('0x28')][_0x3bb0be['uniqueid']][_0xf730('0x39')](_0x1870b5)){if(this[_0xf730('0x28')][_0x3bb0be[_0xf730('0x23')]][_0x1870b5]['reason']==_0xf730('0x7f')&&this[_0xf730('0x28')][_0x3bb0be[_0xf730('0x23')]][_0x1870b5][_0xf730('0x54')]){logger[_0xf730('0x21')](_0xf730('0x80'),_0x3bb0be[_0xf730('0x23')],_0x1870b5);this[_0xf730('0x28')][_0x3bb0be[_0xf730('0x23')]][_0x1870b5][_0xf730('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x3bb0be[_0xf730('0x23')],util[_0xf730('0x26')](_[_0xf730('0x81')](this['channels'][_0x3bb0be['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit'](_0xf730('0x82'),_[_0xf730('0x81')](this[_0xf730('0x28')][_0x3bb0be[_0xf730('0x23')]]));delete this[_0xf730('0x28')][_0x3bb0be[_0xf730('0x23')]];}if(this[_0xf730('0xd')][_0x3bb0be['uniqueid']]){delete this[_0xf730('0xd')][_0x3bb0be[_0xf730('0x23')]];}}}catch(_0x5313fd){logger['error'](_0xf730('0x83'),_0x3bb0be[_0xf730('0x23')],util[_0xf730('0x26')](_0x5313fd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xf730('0x1a')]=function(_0xe06487){try{if(this['isNotNull'](_0xe06487)){logger['debug'](_0xf730('0x84'),_0xe06487['uniqueid'],util[_0xf730('0x26')](_0xe06487,{'showHidden':![],'depth':null}));if(this[_0xf730('0x28')][_0xe06487[_0xf730('0x85')]]){for(var _0x37e9e6 in this['channels'][_0xe06487[_0xf730('0x85')]]){if(this['channels'][_0xe06487[_0xf730('0x85')]][_0xf730('0x39')](_0x37e9e6)){if(_0xe06487[_0xf730('0x86')]===_0x37e9e6){logger[_0xf730('0x21')](_0xf730('0x87'),_0xe06487[_0xf730('0x23')],this['channels'][_0xe06487[_0xf730('0x85')]][_0x37e9e6]['membername'],_0x37e9e6);var _0x248fad=moment();this['channels'][_0xe06487[_0xf730('0x85')]][_0x37e9e6][_0xf730('0x54')]=!![];this[_0xf730('0x28')][_0xe06487[_0xf730('0x85')]][_0x37e9e6][_0xf730('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xf730('0x28')][_0xe06487[_0xf730('0x85')]][_0x37e9e6][_0xf730('0x41')]=_0xf730('0x5d');this[_0xf730('0x28')][_0xe06487[_0xf730('0x85')]][_0x37e9e6]['reason']=_0xf730('0x7f');this[_0xf730('0x28')][_0xe06487['transfereeuniqueid']][_0x37e9e6]['talktime']=_0x248fad[_0xf730('0x88')](this['channels'][_0xe06487[_0xf730('0x85')]][_0x37e9e6][_0xf730('0x3b')],_0xf730('0x89'));}}}}if(this[_0xf730('0x28')][_0xe06487[_0xf730('0x8a')]]){var _0x3d1164=this[_0xf730('0x28')][_0xe06487['secondtransfereruniqueid']];this[_0xf730('0x28')][_0xe06487[_0xf730('0x8a')]]=this[_0xf730('0x28')][_0xe06487['transfereeuniqueid']];this[_0xf730('0x28')][_0xe06487['transfereeuniqueid']]=_0x3d1164;}}}catch(_0x5b1250){logger[_0xf730('0x36')]('[%s][voiceAgentReport][attendedtransfer]',_0xe06487[_0xf730('0x23')],util[_0xf730('0x26')](_0x5b1250,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf730('0x1d')][_0xf730('0x1c')]=function(_0x36975e){try{if(this['isNotNull'](_0x36975e)){logger['debug'](_0xf730('0x8b'),_0x36975e[_0xf730('0x23')],util[_0xf730('0x26')](_0x36975e,{'showHidden':![],'depth':null}));if(this[_0xf730('0x28')][_0x36975e['transfereeuniqueid']]){for(var _0x416ab0 in this['channels'][_0x36975e[_0xf730('0x85')]]){if(this['channels'][_0x36975e[_0xf730('0x85')]][_0xf730('0x39')](_0x416ab0)){if(_0x36975e[_0xf730('0x8c')]===_0x416ab0){logger['info'](_0xf730('0x8d'),_0x36975e['uniqueid'],this['channels'][_0x36975e[_0xf730('0x85')]][_0x416ab0][_0xf730('0x34')],_0x416ab0);var _0x2a5db5=moment();this[_0xf730('0x28')][_0x36975e[_0xf730('0x85')]][_0x416ab0]['agentcomplete']=!![];this[_0xf730('0x28')][_0x36975e[_0xf730('0x85')]][_0x416ab0]['agentcompleteAt']=_0x2a5db5;this[_0xf730('0x28')][_0x36975e[_0xf730('0x85')]][_0x416ab0]['lastevent']=_0xf730('0x5d');this[_0xf730('0x28')][_0x36975e[_0xf730('0x85')]][_0x416ab0][_0xf730('0x57')]=_0xf730('0x7f');this[_0xf730('0x28')][_0x36975e[_0xf730('0x85')]][_0x416ab0][_0xf730('0x5e')]=_0x2a5db5[_0xf730('0x88')](this[_0xf730('0x28')][_0x36975e['transfereeuniqueid']][_0x416ab0][_0xf730('0x3b')],_0xf730('0x89'));}}}}}}catch(_0x281492){logger[_0xf730('0x36')]('[%s][voiceAgentReport][blindtransfer]',_0x36975e[_0xf730('0x23')],util['inspect'](_0x281492,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf730('0x1d')][_0xf730('0x17')]=function(_0x230ce0){var _0x256788='';try{if(this[_0xf730('0x20')](_0x230ce0)){logger[_0xf730('0x24')](_0xf730('0x8e'),_0x230ce0[_0xf730('0x23')],util[_0xf730('0x26')](_0x230ce0,{'showHidden':![],'depth':null}));if(_0x230ce0[_0xf730('0x8f')]){_0x256788=_0x230ce0[_0xf730('0x8f')][_0xf730('0x90')](0x0,_0x230ce0[_0xf730('0x8f')][_0xf730('0x91')]('-'));if(this[_0xf730('0xc')][_0x256788]){logger[_0xf730('0x21')](_0xf730('0x92'),_0x230ce0[_0xf730('0x23')],_0x256788);this[_0xf730('0xc')][_0x256788]['onhold']=!![];}}}}catch(_0x3af6a7){logger[_0xf730('0x36')](_0xf730('0x93'),_0x230ce0['uniqueid'],util[_0xf730('0x26')](_0x3af6a7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x125e53){var _0x15f84b='';try{if(this[_0xf730('0x20')](_0x125e53)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x125e53[_0xf730('0x23')],util['inspect'](_0x125e53,{'showHidden':![],'depth':null}));if(_0x125e53[_0xf730('0x8f')]){_0x15f84b=_0x125e53['channel'][_0xf730('0x90')](0x0,_0x125e53[_0xf730('0x8f')][_0xf730('0x91')]('-'));if(this[_0xf730('0xc')][_0x15f84b]){logger['info'](_0xf730('0x94'),_0x125e53[_0xf730('0x23')],_0x15f84b);this['agents'][_0x15f84b]['onhold']=![];}}}}catch(_0x5037a5){logger[_0xf730('0x36')](_0xf730('0x95'),_0x125e53['uniqueid'],util[_0xf730('0x26')](_0x5037a5,{'showHidden':![],'depth':null}));}};module[_0xf730('0x96')]=VoiceAgentReport; \ No newline at end of file +var _0x632d=['uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','connectedlinename','connectedlinenum','destchannelstate','holdtime','connect','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswerAt','answeredelsewheremembername','lastevent','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','agentconnectAt','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','util','ioredis','../../../config/environment','ami','../ami','redis','localhost','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','info'];(function(_0x5b50f2,_0x432356){var _0x55b60a=function(_0x53e584){while(--_0x53e584){_0x5b50f2['push'](_0x5b50f2['shift']());}};_0x55b60a(++_0x432356);}(_0x632d,0x10d));var _0xd632=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x632d[_0x574617];return _0x29de90;};'use strict';var _=require(_0xd632('0x0'));var moment=require('moment');var util=require(_0xd632('0x1'));var Redis=require(_0xd632('0x2'));var config=require(_0xd632('0x3'));var logger=require('../../../config/logger')(_0xd632('0x4'));var ami=require(_0xd632('0x5'));config[_0xd632('0x6')]=_['defaults'](config['redis'],{'host':_0xd632('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd632('0x6')]));function VoiceAgentReport(_0x3983a5){this['channels']={};this[_0xd632('0x8')]=_0x3983a5[_0xd632('0x8')];this[_0xd632('0x9')]=_0x3983a5['agents'];this[_0xd632('0xa')]={};ami['on'](_0xd632('0xb'),this[_0xd632('0xc')][_0xd632('0xd')](this));ami['on'](_0xd632('0xe'),this['syncAgentConnect']['bind'](this));ami['on'](_0xd632('0xf'),this[_0xd632('0x10')][_0xd632('0xd')](this));ami['on'](_0xd632('0x11'),this[_0xd632('0x12')][_0xd632('0xd')](this));ami['on'](_0xd632('0x13'),this['syncAgentComplete'][_0xd632('0xd')](this));ami['on']('varset',this['syncVarSet'][_0xd632('0xd')](this));ami['on'](_0xd632('0x14'),this[_0xd632('0x15')][_0xd632('0xd')](this));ami['on']('musiconholdstart',this[_0xd632('0x16')]['bind'](this));ami['on'](_0xd632('0x17'),this[_0xd632('0x18')][_0xd632('0xd')](this));ami['on'](_0xd632('0x19'),this[_0xd632('0x1a')][_0xd632('0xd')](this));ami['on'](_0xd632('0x1b'),this['syncBlindTransfer'][_0xd632('0xd')](this));}VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x1d')]=function(_0x2937ef,_0x5aba8c,_0x1635ed){io['to'](_0x2937ef)['emit'](_0x5aba8c,_0x1635ed);};VoiceAgentReport['prototype'][_0xd632('0x1e')]=function(_0x27595c){return _0x27595c!==null&&!_[_0xd632('0x1f')](_0x27595c);};VoiceAgentReport[_0xd632('0x1c')]['syncAgentCalled']=function(_0x4c22e3){try{if(this[_0xd632('0x1e')](_0x4c22e3)){logger[_0xd632('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4c22e3[_0xd632('0x21')],_0x4c22e3['membername'],_0x4c22e3[_0xd632('0x22')]);logger[_0xd632('0x23')](_0xd632('0x24'),_0x4c22e3[_0xd632('0x21')],util['inspect'](_0x4c22e3,{'showHidden':![],'depth':null}));if(_[_0xd632('0x1f')](this['channels'][_0x4c22e3[_0xd632('0x21')]])){this[_0xd632('0x25')][_0x4c22e3['uniqueid']]={};}if(_[_0xd632('0x1f')](this[_0xd632('0x25')][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]])){this['channels'][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3['destuniqueid']]={'agentcalledAt':moment()[_0xd632('0x26')](_0xd632('0x27')),'lastevent':_0xd632('0x28'),'mandatoryDisposition':this[_0xd632('0x8')][_0x4c22e3[_0xd632('0x29')]]?this[_0xd632('0x8')][_0x4c22e3[_0xd632('0x29')]][_0xd632('0x2a')]||![]:![],'type':this['voiceQueues'][_0x4c22e3[_0xd632('0x29')]]?this[_0xd632('0x8')][_0x4c22e3['queue']][_0xd632('0x2b')]||_0xd632('0x2c'):_0xd632('0x2c'),'variables':this['variables'][_0x4c22e3[_0xd632('0x21')]]};}_[_0xd632('0x2d')](this[_0xd632('0x25')][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]],_[_0xd632('0x2e')](_0x4c22e3,[_0xd632('0x2f'),_0xd632('0x30')]));logger[_0xd632('0x23')](_0xd632('0x31'),_0x4c22e3[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x4c22e3['uniqueid']][_0x4c22e3['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x33'),this['channels'][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]]);logger['debug'](_0xd632('0x34'),_0x4c22e3[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]],{'showHidden':![],'depth':null}));this[_0xd632('0x1d')](util[_0xd632('0x26')](_0xd632('0x35'),_0x4c22e3[_0xd632('0x36')]),_0xd632('0x37'),this['channels'][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]]);}}catch(_0x3592b4){logger[_0xd632('0x38')](_0xd632('0x39'),_0x4c22e3[_0xd632('0x21')],util[_0xd632('0x32')](_0x3592b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd632('0x3a')]=function(_0x3660a4){try{if(this[_0xd632('0x1e')](_0x3660a4)){if(this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]]){logger[_0xd632('0x23')](_0xd632('0x3b'),_0x3660a4[_0xd632('0x21')],util['inspect'](_0x3660a4,{'showHidden':![],'depth':null}));for(var _0x44c761 in this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]]){if(this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0xd632('0x3c')](_0x44c761)){if(_0x3660a4[_0xd632('0x22')]===_0x44c761){logger[_0xd632('0x20')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3660a4[_0xd632('0x21')],_0x3660a4[_0xd632('0x36')],_0x3660a4[_0xd632('0x22')]);this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]['agentconnectAt']=moment()[_0xd632('0x26')](_0xd632('0x27'));this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x3d')]=_0x3660a4[_0xd632('0x3d')];this['channels'][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x3e')]=_0x3660a4['connectedlinenum'];this['channels'][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x3f')]=_0x3660a4[_0xd632('0x3f')];this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]['destchannelstatedesc']=_0x3660a4['destchannelstatedesc'];this['channels'][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x40')]=_0x3660a4[_0xd632('0x40')];this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]['lastevent']=_0xd632('0x41');_[_0xd632('0x2d')](this[_0xd632('0x9')][_0x3660a4[_0xd632('0x42')]],_[_0xd632('0x43')](_0x3660a4,['queue',_0xd632('0x44')]));logger[_0xd632('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x3660a4[_0xd632('0x21')],util['inspect'](this['channels'][_0x3660a4[_0xd632('0x21')]][_0x3660a4[_0xd632('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd632('0x45'),this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x3660a4[_0xd632('0x22')]]);logger[_0xd632('0x23')](_0xd632('0x46'),_0x3660a4[_0xd632('0x21')],util['inspect'](this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x3660a4[_0xd632('0x22')]],{'showHidden':![],'depth':null}));this[_0xd632('0x1d')](util[_0xd632('0x26')](_0xd632('0x35'),_0x3660a4[_0xd632('0x36')]),'user:agentconnect',this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x3660a4['destuniqueid']]);}else if(!this['channels'][_0x3660a4['uniqueid']][_0x44c761][_0xd632('0xf')]&&!this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x44c761]['agentcomplete']){logger[_0xd632('0x20')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x3660a4[_0xd632('0x21')],this['channels'][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x36')],_0x44c761);this['channels'][_0x3660a4['uniqueid']][_0x44c761][_0xd632('0xf')]=!![];this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x44c761][_0xd632('0x47')]=moment()[_0xd632('0x26')](_0xd632('0x27'));this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]['answeredelsewheredestinationuniqueid']=_0x3660a4[_0xd632('0x22')];this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x44c761][_0xd632('0x48')]=_0x3660a4[_0xd632('0x36')];this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x49')]='answered_elsewhere';this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x4a')]='answered_elsewhere';logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x3660a4[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x44c761],{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x4b'),this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]);}}}}}}catch(_0x37ac33){logger[_0xd632('0x38')](_0xd632('0x4c'),_0x3660a4['uniqueid'],util[_0xd632('0x32')](_0x37ac33,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x10')]=function(_0x1736bf){try{if(this['isNotNull'](_0x1736bf)){logger[_0xd632('0x23')](_0xd632('0x4d'),_0x1736bf[_0xd632('0x21')],util['inspect'](_0x1736bf,{'showHidden':![],'depth':null}));if(this['channels'][_0x1736bf[_0xd632('0x21')]]&&this[_0xd632('0x25')][_0x1736bf['uniqueid']][_0x1736bf[_0xd632('0x22')]]){logger['info'](_0xd632('0x4e'),_0x1736bf[_0xd632('0x21')],_0x1736bf[_0xd632('0x36')],_0x1736bf[_0xd632('0x22')]);this['channels'][_0x1736bf[_0xd632('0x21')]][_0x1736bf[_0xd632('0x22')]]['agentringnoanswer']=!![];this[_0xd632('0x25')][_0x1736bf[_0xd632('0x21')]][_0x1736bf[_0xd632('0x22')]][_0xd632('0x47')]=moment()[_0xd632('0x26')](_0xd632('0x27'));this[_0xd632('0x25')][_0x1736bf[_0xd632('0x21')]][_0x1736bf[_0xd632('0x22')]][_0xd632('0x49')]=_0xd632('0x4f');this[_0xd632('0x25')][_0x1736bf['uniqueid']][_0x1736bf[_0xd632('0x22')]][_0xd632('0x4a')]=_0xd632('0x4f');logger[_0xd632('0x23')](_0xd632('0x50'),_0x1736bf[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x1736bf['uniqueid']][_0x1736bf['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this[_0xd632('0x25')][_0x1736bf[_0xd632('0x21')]][_0x1736bf[_0xd632('0x22')]]);}}}catch(_0x30be77){logger['error'](_0xd632('0x51'),_0x1736bf[_0xd632('0x21')],util[_0xd632('0x32')](_0x30be77,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x2f69fc){try{if(this[_0xd632('0x1e')](_0x2f69fc)){logger[_0xd632('0x23')](_0xd632('0x52'),_0x2f69fc[_0xd632('0x21')],util[_0xd632('0x32')](_0x2f69fc,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]]){for(var _0x4174c7 in this['channels'][_0x2f69fc['uniqueid']]){if(this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]]['hasOwnProperty'](_0x4174c7)&&!this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]][_0x4174c7][_0xd632('0xf')]&&!this['channels'][_0x2f69fc[_0xd632('0x21')]][_0x4174c7]['agentcomplete']){logger[_0xd632('0x20')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2f69fc[_0xd632('0x21')],this['channels'][_0x2f69fc['uniqueid']][_0x4174c7][_0xd632('0x36')],_0x4174c7);this['channels'][_0x2f69fc['uniqueid']][_0x4174c7][_0xd632('0xf')]=!![];this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]][_0x4174c7]['agentringnoanswerAt']=moment()[_0xd632('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2f69fc[_0xd632('0x21')]][_0x4174c7][_0xd632('0x49')]=_0xd632('0x53');this['channels'][_0x2f69fc[_0xd632('0x21')]][_0x4174c7][_0xd632('0x4a')]=_0xd632('0x53');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x2f69fc['uniqueid'],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]][_0x4174c7],{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x54'),this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]][_0x4174c7]);}}}}}catch(_0x453cab){logger[_0xd632('0x38')](_0xd632('0x55'),_0x2f69fc[_0xd632('0x21')],util['inspect'](_0x453cab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x56')]=function(_0x5ad373){try{if(this[_0xd632('0x1e')](_0x5ad373)){logger[_0xd632('0x23')](_0xd632('0x57'),_0x5ad373['uniqueid'],util['inspect'](_0x5ad373,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]]){for(var _0x2c706b in this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]]){if(this[_0xd632('0x25')][_0x5ad373['uniqueid']][_0xd632('0x3c')](_0x2c706b)){if(this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]['agentconnectAt']&&!this['channels'][_0x5ad373['uniqueid']][_0x2c706b][_0xd632('0x13')]){logger[_0xd632('0x20')](_0xd632('0x58'),_0x5ad373[_0xd632('0x21')],this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b][_0xd632('0x36')],_0x2c706b);this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b][_0xd632('0x13')]=!![];this[_0xd632('0x25')][_0x5ad373['uniqueid']][_0x2c706b][_0xd632('0x59')]=moment()['format'](_0xd632('0x27'));this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b][_0xd632('0x49')]=_0xd632('0x5a');this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]['reason']=_0x5ad373['reason']=='transfer'?_0xd632('0x5b'):_0x5ad373[_0xd632('0x4a')];this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]['talktime']=_0x5ad373[_0xd632('0x5c')];if(this['voiceQueues'][_0x5ad373['queue']]&&this[_0xd632('0x8')][_0x5ad373['queue']][_0xd632('0x5d')]){this[_0xd632('0x25')][_0x5ad373['uniqueid']][_0x2c706b][_0xd632('0x5e')]=this[_0xd632('0x8')][_0x5ad373[_0xd632('0x29')]][_0xd632('0x5f')];this['channels'][_0x5ad373['uniqueid']][_0x2c706b][_0xd632('0x60')]=!![];}this[_0xd632('0x9')][_0x5ad373[_0xd632('0x42')]]=_[_0xd632('0x2e')](this[_0xd632('0x9')][_0x5ad373['interface']],[_0xd632('0x29'),'destconnectedlinenum']);logger[_0xd632('0x23')](_0xd632('0x61'),_0x5ad373[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b],{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x62'),this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]);logger[_0xd632('0x23')](_0xd632('0x63'),_0x5ad373[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b],{'showHidden':![],'depth':null}));this[_0xd632('0x1d')](util[_0xd632('0x26')]('user:%s',_0x5ad373[_0xd632('0x36')]),_0xd632('0x64'),this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]);}}}}}}catch(_0x527c4c){logger['error'](_0xd632('0x65'),_0x5ad373[_0xd632('0x21')],util[_0xd632('0x32')](_0x527c4c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x66')]=function(_0x5d56fa){try{if(this[_0xd632('0x1e')](_0x5d56fa)){logger[_0xd632('0x23')](_0xd632('0x67'),_0x5d56fa['uniqueid'],util['inspect'](_0x5d56fa,{'showHidden':![],'depth':null}));this[_0xd632('0x68')](_0x5d56fa[_0xd632('0x21')],_[_0xd632('0x69')](_0x5d56fa[_0xd632('0x6a')])[0x0],_0x5d56fa['value']);if(this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]]){for(var _0x1aaa8c in this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]]){if(this[_0xd632('0x25')][_0x5d56fa['uniqueid']][_0xd632('0x3c')](_0x1aaa8c)){logger[_0xd632('0x20')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x5d56fa[_0xd632('0x21')],_0x1aaa8c,_[_0xd632('0x69')](_0x5d56fa[_0xd632('0x6a')])[0x0],_0x5d56fa[_0xd632('0x6b')]);if(_['isUndefined'](this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]][_0x1aaa8c][_0xd632('0xa')])){this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]][_0x1aaa8c][_0xd632('0xa')]={};}this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]][_0x1aaa8c]['variables']=this[_0xd632('0xa')][_0x5d56fa['uniqueid']];}}}}}catch(_0x5c27b9){logger[_0xd632('0x38')](_0xd632('0x6c'),_0x5d56fa['uniqueid'],util['inspect'](_0x5c27b9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x5b9e5e,_0x2f3b03,_0x36d261){var _0x1be70f=[_0xd632('0x6d'),'rtpaudioqosbridged',_0xd632('0x6e'),_0xd632('0x6f'),'rtpaudioqosloss',_0xd632('0x70'),_0xd632('0x71'),_0xd632('0x72'),_0xd632('0x73'),_0xd632('0x74'),_0xd632('0x75'),'bridgepvtcallid',_0xd632('0x76'),_0xd632('0x77'),'memberinterface','memberlastcall',_0xd632('0x36'),'memberpenalty',_0xd632('0x78')];if(!_[_0xd632('0x79')](_0x2f3b03)&&!_[_0xd632('0x7a')](_0x1be70f,_0x2f3b03)){if(_['isUndefined'](this['variables'][_0x5b9e5e])){this['variables'][_0x5b9e5e]={};}this['variables'][_0x5b9e5e][_0x2f3b03]=_0x36d261;}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x15')]=function(_0x853729){try{if(this[_0xd632('0x1e')](_0x853729)){logger[_0xd632('0x23')](_0xd632('0x7b'),_0x853729['uniqueid'],util['inspect'](_0x853729,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]]){for(var _0x90615c in this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]]){if(this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]][_0xd632('0x3c')](_0x90615c)){if(this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]][_0x90615c][_0xd632('0x4a')]==_0xd632('0x7c')&&this[_0xd632('0x25')][_0x853729['uniqueid']][_0x90615c][_0xd632('0x13')]){logger[_0xd632('0x20')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x853729[_0xd632('0x21')],_0x90615c);this[_0xd632('0x25')][_0x853729['uniqueid']][_0x90615c][_0xd632('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xd632('0x23')](_0xd632('0x7d'),_0x853729[_0xd632('0x21')],util[_0xd632('0x32')](_[_0xd632('0x7e')](this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]]),{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x7f'),_[_0xd632('0x7e')](this['channels'][_0x853729[_0xd632('0x21')]]));delete this[_0xd632('0x25')][_0x853729['uniqueid']];}if(this[_0xd632('0xa')][_0x853729['uniqueid']]){delete this[_0xd632('0xa')][_0x853729['uniqueid']];}}}catch(_0x446b6b){logger[_0xd632('0x38')](_0xd632('0x80'),_0x853729[_0xd632('0x21')],util[_0xd632('0x32')](_0x446b6b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x1a')]=function(_0x514b41){try{if(this[_0xd632('0x1e')](_0x514b41)){logger[_0xd632('0x23')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x514b41[_0xd632('0x21')],util[_0xd632('0x32')](_0x514b41,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]]){for(var _0x445fd7 in this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]]){if(this[_0xd632('0x25')][_0x514b41['transfereeuniqueid']][_0xd632('0x3c')](_0x445fd7)){if(_0x514b41[_0xd632('0x82')]===_0x445fd7){logger[_0xd632('0x20')](_0xd632('0x83'),_0x514b41['uniqueid'],this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]][_0x445fd7]['membername'],_0x445fd7);var _0x1618bd=moment();this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]][_0x445fd7][_0xd632('0x13')]=!![];this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]][_0x445fd7][_0xd632('0x59')]=moment()['format'](_0xd632('0x27'));this['channels'][_0x514b41[_0xd632('0x81')]][_0x445fd7][_0xd632('0x49')]=_0xd632('0x5a');this[_0xd632('0x25')][_0x514b41['transfereeuniqueid']][_0x445fd7][_0xd632('0x4a')]=_0xd632('0x7c');this['channels'][_0x514b41[_0xd632('0x81')]][_0x445fd7]['talktime']=_0x1618bd['diff'](this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]][_0x445fd7]['agentconnectAt'],_0xd632('0x84'));}}}}if(this['channels'][_0x514b41['secondtransfereruniqueid']]){var _0x1d77df=this[_0xd632('0x25')][_0x514b41[_0xd632('0x85')]];this['channels'][_0x514b41[_0xd632('0x85')]]=this[_0xd632('0x25')][_0x514b41['transfereeuniqueid']];this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]]=_0x1d77df;}}}catch(_0x2ac3ea){logger['error'](_0xd632('0x86'),_0x514b41[_0xd632('0x21')],util['inspect'](_0x2ac3ea,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd632('0x87')]=function(_0x4a6a26){try{if(this[_0xd632('0x1e')](_0x4a6a26)){logger[_0xd632('0x23')](_0xd632('0x88'),_0x4a6a26[_0xd632('0x21')],util[_0xd632('0x32')](_0x4a6a26,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]]){for(var _0x95f073 in this['channels'][_0x4a6a26[_0xd632('0x81')]]){if(this[_0xd632('0x25')][_0x4a6a26['transfereeuniqueid']][_0xd632('0x3c')](_0x95f073)){if(_0x4a6a26[_0xd632('0x89')]===_0x95f073){logger['info'](_0xd632('0x8a'),_0x4a6a26[_0xd632('0x21')],this['channels'][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x36')],_0x95f073);var _0x2886ab=moment();this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x13')]=!![];this[_0xd632('0x25')][_0x4a6a26['transfereeuniqueid']][_0x95f073][_0xd632('0x59')]=_0x2886ab;this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x49')]=_0xd632('0x5a');this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073]['reason']=_0xd632('0x7c');this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x5c')]=_0x2886ab[_0xd632('0x8b')](this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x8c')],_0xd632('0x84'));}}}}}}catch(_0x32bf72){logger[_0xd632('0x38')](_0xd632('0x8d'),_0x4a6a26[_0xd632('0x21')],util[_0xd632('0x32')](_0x32bf72,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd632('0x16')]=function(_0x506f2a){var _0x97c290='';try{if(this[_0xd632('0x1e')](_0x506f2a)){logger[_0xd632('0x23')](_0xd632('0x8e'),_0x506f2a[_0xd632('0x21')],util[_0xd632('0x32')](_0x506f2a,{'showHidden':![],'depth':null}));if(_0x506f2a[_0xd632('0x8f')]){_0x97c290=_0x506f2a['channel']['substring'](0x0,_0x506f2a[_0xd632('0x8f')]['lastIndexOf']('-'));if(this['agents'][_0x97c290]){logger[_0xd632('0x20')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x506f2a[_0xd632('0x21')],_0x97c290);this[_0xd632('0x9')][_0x97c290][_0xd632('0x90')]=!![];}}}}catch(_0x117294){logger[_0xd632('0x38')](_0xd632('0x91'),_0x506f2a[_0xd632('0x21')],util[_0xd632('0x32')](_0x117294,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x18')]=function(_0x5b5470){var _0x1fc315='';try{if(this[_0xd632('0x1e')](_0x5b5470)){logger[_0xd632('0x23')](_0xd632('0x92'),_0x5b5470[_0xd632('0x21')],util['inspect'](_0x5b5470,{'showHidden':![],'depth':null}));if(_0x5b5470[_0xd632('0x8f')]){_0x1fc315=_0x5b5470[_0xd632('0x8f')][_0xd632('0x93')](0x0,_0x5b5470[_0xd632('0x8f')][_0xd632('0x94')]('-'));if(this[_0xd632('0x9')][_0x1fc315]){logger[_0xd632('0x20')](_0xd632('0x95'),_0x5b5470[_0xd632('0x21')],_0x1fc315);this[_0xd632('0x9')][_0x1fc315][_0xd632('0x90')]=![];}}}}catch(_0x1ae7e7){logger[_0xd632('0x38')]('[%s][voiceAgentReport][musiconholdstop]',_0x5b5470[_0xd632('0x21')],util[_0xd632('0x32')](_0x1ae7e7,{'showHidden':![],'depth':null}));}};module[_0xd632('0x96')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e3231bf..c4016b3 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb545=['calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','inspect','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','context','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','format','user:%s','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','duration','subtract','seconds','includes','lastdata','startsWith','cdr(','channelstate','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','name','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','.WAV','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','outbound','blindTransfers','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BlindTransfer','transfererchannel','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','busy','invalid','unavailable','ringing','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s'];(function(_0x2488a2,_0x50f57a){var _0x58e303=function(_0x46ddf1){while(--_0x46ddf1){_0x2488a2['push'](_0x2488a2['shift']());}};_0x58e303(++_0x50f57a);}(_0xb545,0x135));var _0x5b54=function(_0x11c736,_0x153889){_0x11c736=_0x11c736-0x0;var _0x2f64c6=_0xb545[_0x11c736];return _0x2f64c6;};'use strict';var BPromise=require(_0x5b54('0x0'));var _=require(_0x5b54('0x1'));var moment=require(_0x5b54('0x2'));var util=require(_0x5b54('0x3'));var path=require(_0x5b54('0x4'));var Redis=require(_0x5b54('0x5'));var config=require(_0x5b54('0x6'));var logger=require(_0x5b54('0x7'))(_0x5b54('0x8'));var ami=require(_0x5b54('0x9'));var Channel=require(_0x5b54('0xa'));var statusDesc=[_0x5b54('0xb'),'not_inuse','inuse',_0x5b54('0xc'),_0x5b54('0xd'),_0x5b54('0xe'),_0x5b54('0xf'),'ringinuse','onhold'];var applications=[_0x5b54('0x10'),_0x5b54('0x11'),_0x5b54('0x12'),_0x5b54('0x13'),_0x5b54('0x14'),_0x5b54('0x15')];var dispositions=[_0x5b54('0x16'),_0x5b54('0x17'),_0x5b54('0x17'),_0x5b54('0x16'),_0x5b54('0x16'),'NO\x20ANSWER',_0x5b54('0x18'),'BUSY',_0x5b54('0x17'),'FAILED',_0x5b54('0x17')];var actions={};config['redis']=_[_0x5b54('0x19')](config[_0x5b54('0x1a')],{'host':_0x5b54('0x1b'),'port':0x18eb});var io=require(_0x5b54('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x4bbe1d){this[_0x5b54('0x1d')]=_0x4bbe1d[_0x5b54('0x1d')];this[_0x5b54('0x1e')]=_0x4bbe1d[_0x5b54('0x1e')];this['blindTransfers']={};ami['on'](_0x5b54('0x1f'),this['syncNewExten'][_0x5b54('0x20')](this));ami['on'](_0x5b54('0x21'),this[_0x5b54('0x22')][_0x5b54('0x20')](this));ami['on'](_0x5b54('0x23'),this[_0x5b54('0x24')][_0x5b54('0x20')](this));ami['on'](_0x5b54('0x25'),this[_0x5b54('0x26')][_0x5b54('0x20')](this));ami['on']('varset',this[_0x5b54('0x27')][_0x5b54('0x20')](this));ami['on']('hangup',this[_0x5b54('0x28')][_0x5b54('0x20')](this));ami['on'](_0x5b54('0x29'),this[_0x5b54('0x2a')][_0x5b54('0x20')](this));ami['on'](_0x5b54('0x2b'),this[_0x5b54('0x2c')]['bind'](this));ami['on']('blindtransfer',this[_0x5b54('0x2d')][_0x5b54('0x20')](this));ami['on'](_0x5b54('0x2e'),this[_0x5b54('0x2f')][_0x5b54('0x20')](this));ami['on'](_0x5b54('0x30'),this[_0x5b54('0x31')][_0x5b54('0x20')](this));try{logger['info'](_0x5b54('0x32'));ami['actionCoreShowChannels']();}catch(_0x5d6aaf){logger[_0x5b54('0x33')](_0x5b54('0x34'),util['inspect'](_0x5d6aaf,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x5b54('0x35')][_0x5b54('0x36')]=function(_0x33d354){return _0x33d354!==null&&!_[_0x5b54('0x37')](_0x33d354);};VoiceCallReport[_0x5b54('0x35')][_0x5b54('0x38')]=function(_0x5e21b1,_0x1cf8a5,_0x1a0021){io['to'](_0x5e21b1)[_0x5b54('0x38')](_0x1cf8a5,_0x1a0021);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x2ef0a3){try{if(this[_0x5b54('0x36')](_0x2ef0a3)){logger[_0x5b54('0x39')](_0x5b54('0x3a'),_0x2ef0a3['uniqueid'],_0x2ef0a3[_0x5b54('0x3b')],_0x2ef0a3['calleridnum']);logger[_0x5b54('0x3c')](_0x5b54('0x3d'),_0x2ef0a3[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x2ef0a3,{'showHidden':![],'depth':null}));if(_0x2ef0a3[_0x5b54('0x3e')]===_0x2ef0a3[_0x5b54('0x40')]){if(!_['isUndefined'](this[_0x5b54('0x1d')][_0x2ef0a3[_0x5b54('0x3e')]])){_[_0x5b54('0x41')](this[_0x5b54('0x1d')][_0x2ef0a3['uniqueid']],_[_0x5b54('0x42')](_0x2ef0a3,_[_0x5b54('0x43')](this['channels'][_0x2ef0a3[_0x5b54('0x3e')]])));}}}}catch(_0x41caf6){logger[_0x5b54('0x33')](_0x5b54('0x44'),_0x2ef0a3[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x41caf6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x3b0e1c){try{if(this[_0x5b54('0x36')](_0x3b0e1c)){logger[_0x5b54('0x3c')](_0x5b54('0x45'),_0x3b0e1c[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x3b0e1c,{'showHidden':![],'depth':null}));if(_0x3b0e1c['uniqueid']===_0x3b0e1c[_0x5b54('0x40')]&&_0x3b0e1c[_0x5b54('0x46')]!=_0x5b54('0x47')){if(_[_0x5b54('0x37')](this[_0x5b54('0x1d')][_0x3b0e1c[_0x5b54('0x3e')]])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3b0e1c[_0x5b54('0x3e')],_0x3b0e1c[_0x5b54('0x48')],_0x3b0e1c[_0x5b54('0x49')]);this[_0x5b54('0x1d')][_0x3b0e1c['uniqueid']]=new Channel();this['channels'][_0x3b0e1c[_0x5b54('0x3e')]][_0x5b54('0x4a')]=moment()['format'](_0x5b54('0x4b'));this[_0x5b54('0x1d')][_0x3b0e1c[_0x5b54('0x3e')]][_0x5b54('0x4c')]=dispositions[_[_0x5b54('0x4d')](_0x3b0e1c['channelstate'])];_[_0x5b54('0x41')](this[_0x5b54('0x1d')][_0x3b0e1c[_0x5b54('0x3e')]],_[_0x5b54('0x42')](_0x3b0e1c,_['keys'](this['channels'][_0x3b0e1c['uniqueid']])));if(_0x3b0e1c['context']===_0x5b54('0x4e')){if(this[_0x5b54('0x1e')][_0x3b0e1c['channel']['split']('-')[0x0]]){this[_0x5b54('0x1e')][_0x3b0e1c[_0x5b54('0x46')][_0x5b54('0x4f')]('-')[0x0]][_0x5b54('0x50')]=_0x3b0e1c[_0x5b54('0x49')];logger['debug'](_0x5b54('0x51'),_0x3b0e1c[_0x5b54('0x3e')],util[_0x5b54('0x3f')]({'destaccountcode':this[_0x5b54('0x1e')][_0x3b0e1c[_0x5b54('0x46')]['split']('-')[0x0]][_0x5b54('0x52')],'destconnectedlinenum':_0x3b0e1c[_0x5b54('0x49')]},{'showHidden':![],'depth':null}));this[_0x5b54('0x38')](util[_0x5b54('0x53')](_0x5b54('0x54'),this[_0x5b54('0x1e')][_0x3b0e1c[_0x5b54('0x46')]['split']('-')[0x0]]['name']),_0x5b54('0x55'),{'destaccountcode':this[_0x5b54('0x1e')][_0x3b0e1c[_0x5b54('0x46')][_0x5b54('0x4f')]('-')[0x0]][_0x5b54('0x52')],'destconnectedlinenum':_0x3b0e1c[_0x5b54('0x49')]});}}}}}}catch(_0x40b9b2){logger['error']('[%s][voiceCallReport][newchannel]',_0x3b0e1c[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x40b9b2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b54('0x35')]['syncNewExten']=function(_0x2093db){try{if(this[_0x5b54('0x36')](_0x2093db)){logger[_0x5b54('0x3c')](_0x5b54('0x56'),_0x2093db[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x2093db,{'showHidden':![],'depth':null}));if(_0x2093db[_0x5b54('0x3e')]===_0x2093db[_0x5b54('0x40')]&&_0x2093db[_0x5b54('0x49')]!='h'&&_0x2093db[_0x5b54('0x46')]!=_0x5b54('0x47')){_0x2093db[_0x5b54('0x57')]=_0x2093db[_0x5b54('0x57')][_0x5b54('0x58')]();_0x2093db['applicationdata']=(_0x2093db['appdata']||_0x2093db['applicationdata'])[_0x5b54('0x58')]();logger['info'](_0x5b54('0x59'),_0x2093db[_0x5b54('0x3e')],_0x2093db['application'],_0x2093db[_0x5b54('0x5a')]);if(_[_0x5b54('0x37')](this[_0x5b54('0x1d')][_0x2093db['uniqueid']])){this[_0x5b54('0x1d')][_0x2093db[_0x5b54('0x3e')]]=new Channel();this[_0x5b54('0x1d')][_0x2093db[_0x5b54('0x3e')]]['starttime']=_0x2093db[_0x5b54('0x5b')]?moment()[_0x5b54('0x5c')](moment['duration'](_0x2093db['duration'])['seconds'](),_0x5b54('0x5d'))[_0x5b54('0x53')](_0x5b54('0x4b')):moment()['format'](_0x5b54('0x4b'));this[_0x5b54('0x1d')][_0x2093db[_0x5b54('0x3e')]][_0x5b54('0x4c')]='NO\x20ANSWER';}_['merge'](this[_0x5b54('0x1d')][_0x2093db[_0x5b54('0x3e')]],_[_0x5b54('0x42')](_0x2093db,_[_0x5b54('0x43')](this[_0x5b54('0x1d')][_0x2093db[_0x5b54('0x3e')]])));if(_[_0x5b54('0x5e')](applications,_0x2093db[_0x5b54('0x57')])){this[_0x5b54('0x1d')][_0x2093db[_0x5b54('0x3e')]]['lastapplication']=_0x2093db[_0x5b54('0x57')];this[_0x5b54('0x1d')][_0x2093db[_0x5b54('0x3e')]][_0x5b54('0x5f')]=_0x2093db[_0x5b54('0x5a')];if(_0x2093db[_0x5b54('0x57')]==='set'&&_[_0x5b54('0x60')](_0x2093db[_0x5b54('0x5a')],_0x5b54('0x61'))){var _0xdc68f8=_0x2093db[_0x5b54('0x5a')][_0x5b54('0x4f')]('=');var _0x5c1464=_0xdc68f8[0x0]['match'](/cdr\((.*)\)/);if(_0x5c1464){this[_0x5b54('0x1d')][_0x2093db[_0x5b54('0x3e')]][_0x5c1464[0x1]]=_0xdc68f8[0x1];}}else if(_0x2093db[_0x5b54('0x57')]===_0x5b54('0x11')){this[_0x5b54('0x1d')][_0x2093db[_0x5b54('0x3e')]][_0x5b54('0x11')]=_0x2093db[_0x5b54('0x5a')][_0x5b54('0x4f')](',')[0x0];}}}}}catch(_0x56e81d){logger['error']('[%s][voiceCallReport][newexten]',_0x2093db[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x56e81d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b54('0x35')][_0x5b54('0x26')]=function(_0x46995c){try{if(this[_0x5b54('0x36')](_0x46995c)){logger[_0x5b54('0x39')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x46995c[_0x5b54('0x3e')],_0x46995c[_0x5b54('0x40')],_0x46995c[_0x5b54('0x3b')],_0x46995c['calleridnum']);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x46995c[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x46995c,{'showHidden':![],'depth':null}));if(_0x46995c['uniqueid']!==_0x46995c['linkedid']){if(this[_0x5b54('0x1d')][_0x46995c[_0x5b54('0x40')]]){if(_0x46995c[_0x5b54('0x62')]==='6'){if(!this[_0x5b54('0x1d')][_0x46995c[_0x5b54('0x40')]][_0x5b54('0x63')]){var _0x294e4c=moment();this['channels'][_0x46995c[_0x5b54('0x40')]][_0x5b54('0x63')]=!![];this[_0x5b54('0x1d')][_0x46995c[_0x5b54('0x40')]][_0x5b54('0x64')]=_0x294e4c[_0x5b54('0x53')](_0x5b54('0x4b'));if(this[_0x5b54('0x1d')][_0x46995c[_0x5b54('0x40')]][_0x5b54('0x4a')]){this['channels'][_0x46995c['linkedid']]['holdtime']=_0x294e4c[_0x5b54('0x65')](this[_0x5b54('0x1d')][_0x46995c['linkedid']][_0x5b54('0x4a')],'seconds');}}this[_0x5b54('0x1d')][_0x46995c[_0x5b54('0x40')]][_0x5b54('0x40')]=_0x46995c[_0x5b54('0x3e')];if(_0x46995c[_0x5b54('0x66')]!==_0x5b54('0x67')){this[_0x5b54('0x1d')][_0x46995c['linkedid']][_0x5b54('0x68')]=_0x46995c[_0x5b54('0x66')];}this['channels'][_0x46995c['linkedid']][_0x5b54('0x69')]=_0x46995c[_0x5b54('0x3b')];this['channels'][_0x46995c[_0x5b54('0x40')]][_0x5b54('0x6a')]=_0x46995c['channel'];this['channels'][_0x46995c[_0x5b54('0x40')]][_0x5b54('0x4c')]=dispositions[_[_0x5b54('0x4d')](_0x46995c['channelstate'])];if(this['agents'][_0x46995c[_0x5b54('0x46')][_0x5b54('0x4f')]('-')[0x0]]){this[_0x5b54('0x1d')][_0x46995c['linkedid']][_0x5b54('0x6b')]=this[_0x5b54('0x1e')][_0x46995c['channel']['split']('-')[0x0]]['id'];this[_0x5b54('0x1d')][_0x46995c['linkedid']]['membername']=this[_0x5b54('0x1e')][_0x46995c['channel']['split']('-')[0x0]][_0x5b54('0x6c')];}}}}else{if(this[_0x5b54('0x1d')][_0x46995c[_0x5b54('0x3e')]]){if(_0x46995c[_0x5b54('0x62')]==='6'){if(this[_0x5b54('0x1e')][_0x46995c[_0x5b54('0x46')][_0x5b54('0x4f')]('-')[0x0]]){this[_0x5b54('0x1d')][_0x46995c[_0x5b54('0x3e')]][_0x5b54('0x6b')]=this[_0x5b54('0x1e')][_0x46995c['channel'][_0x5b54('0x4f')]('-')[0x0]]['id'];this[_0x5b54('0x1d')][_0x46995c[_0x5b54('0x3e')]][_0x5b54('0x6d')]=this['agents'][_0x46995c[_0x5b54('0x46')][_0x5b54('0x4f')]('-')[0x0]][_0x5b54('0x6c')];}}}}}}catch(_0x370137){logger['error'](_0x5b54('0x6e'),_0x46995c[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x370137,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5b54('0x6f')]=function(_0x26d619,_0x4c676f){try{if(this[_0x5b54('0x1d')][_0x26d619]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x26d619,_0x4c676f);this[_0x5b54('0x1d')][_0x26d619][_0x5b54('0x70')]=!![];if(_[_0x5b54('0x71')](_0x4c676f,_0x5b54('0x72'))){_0x4c676f=_0x4c676f['replace']('.wav49',_0x5b54('0x73'));}this[_0x5b54('0x1d')][_0x26d619]['monitorFilename']=_0x4c676f;var _0xed7681=_[_0x5b54('0x74')](this[_0x5b54('0x1d')][_0x26d619][_0x5b54('0x75')],{'filename':_0x4c676f});if(_['isNil'](_0xed7681)){this[_0x5b54('0x1d')][_0x26d619][_0x5b54('0x75')][_0x5b54('0x76')]({'filename':_0x4c676f,'createdAt':moment()[_0x5b54('0x53')](_0x5b54('0x4b')),'mixmonitorid':'','status':_0x5b54('0x77')});}}}catch(_0x1e03ca){logger[_0x5b54('0x33')](_0x5b54('0x78'),_0x26d619,util['inspect'](_0x1e03ca,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b54('0x35')][_0x5b54('0x27')]=function(_0x591863){try{if(this[_0x5b54('0x36')](_0x591863)){logger[_0x5b54('0x3c')](_0x5b54('0x79'),_0x591863[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x591863,{'showHidden':![],'depth':null}));if(this[_0x5b54('0x1d')][_0x591863[_0x5b54('0x3e')]]&&_0x591863[_0x5b54('0x46')]!=_0x5b54('0x47')){if(this[_0x5b54('0x36')](_0x591863['variable'])){if(this[_0x5b54('0x36')](_0x591863[_0x5b54('0x7a')][_0x5b54('0x7b')])){logger['info'](_0x5b54('0x7c'),_0x591863[_0x5b54('0x3e')],_0x591863[_0x5b54('0x7d')]);this[_0x5b54('0x6f')](_0x591863[_0x5b54('0x3e')],_0x591863[_0x5b54('0x7d')]);}else if(this[_0x5b54('0x36')](_0x591863['variable'][_0x5b54('0x7e')])){logger['info'](_0x5b54('0x7f'),_0x591863[_0x5b54('0x3e')],_0x591863[_0x5b54('0x7d')]);this[_0x5b54('0x1d')][_0x591863['uniqueid']][_0x5b54('0x66')]=_0x591863['value'];}else if(this[_0x5b54('0x36')](_0x591863[_0x5b54('0x7a')][_0x5b54('0x80')])){logger['info'](_0x5b54('0x81'),_0x591863[_0x5b54('0x3e')],_0x591863[_0x5b54('0x7d')]);this['channels'][_0x591863[_0x5b54('0x3e')]][_0x5b54('0x82')]=_0x591863['value'];}else if(this[_0x5b54('0x36')](_0x591863[_0x5b54('0x7a')][_0x5b54('0x83')])){logger[_0x5b54('0x39')](_0x5b54('0x84'),_0x591863['uniqueid'],_0x591863['value']);this[_0x5b54('0x1d')][_0x591863[_0x5b54('0x3e')]][_0x5b54('0x85')]=_0x591863[_0x5b54('0x7d')];}else if(this['isNotNull'](_0x591863[_0x5b54('0x7a')]['xmd-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x591863[_0x5b54('0x3e')],_0x591863['value'][_0x5b54('0x4f')](',')[0x0]);this[_0x5b54('0x1d')][_0x591863[_0x5b54('0x3e')]][_0x5b54('0x11')]=_0x591863[_0x5b54('0x7d')][_0x5b54('0x4f')](',')[0x0];}else if(this[_0x5b54('0x36')](_0x591863['variable'][_0x5b54('0x86')])){logger[_0x5b54('0x39')](_0x5b54('0x87'),_0x591863[_0x5b54('0x3e')],_0x591863['value']);this[_0x5b54('0x1d')][_0x591863[_0x5b54('0x3e')]][_0x5b54('0x88')]=_0x591863[_0x5b54('0x7d')];}else if(this[_0x5b54('0x36')](_0x591863[_0x5b54('0x7a')][_0x5b54('0x89')])){logger[_0x5b54('0x39')](_0x5b54('0x8a'),_0x591863['uniqueid'],_0x591863[_0x5b54('0x7d')]);this[_0x5b54('0x1d')][_0x591863[_0x5b54('0x3e')]][_0x5b54('0x8b')]=_0x591863[_0x5b54('0x7d')];}else if(this[_0x5b54('0x36')](_0x591863[_0x5b54('0x7a')][_0x5b54('0x8c')])){logger[_0x5b54('0x39')](_0x5b54('0x8d'),_0x591863['uniqueid'],_0x591863[_0x5b54('0x7d')]);this['channels'][_0x591863[_0x5b54('0x3e')]][_0x5b54('0x8e')]=_0x591863[_0x5b54('0x7d')];}else if(this['isNotNull'](_0x591863[_0x5b54('0x7a')][_0x5b54('0x8f')])){logger[_0x5b54('0x39')](_0x5b54('0x90'),_0x591863[_0x5b54('0x3e')],_0x591863[_0x5b54('0x7d')]);this[_0x5b54('0x1d')][_0x591863[_0x5b54('0x3e')]][_0x5b54('0x11')]=_0x591863[_0x5b54('0x7d')];}else if(this['isNotNull'](_0x591863[_0x5b54('0x7a')][_0x5b54('0x91')])){logger['info'](_0x5b54('0x92'),_0x591863['uniqueid'],_0x591863[_0x5b54('0x7d')]);this[_0x5b54('0x1d')][_0x591863[_0x5b54('0x3e')]][_0x5b54('0x93')]=_0x591863[_0x5b54('0x7d')];}}}else if(this[_0x5b54('0x36')](_0x591863[_0x5b54('0x7a')]['mixmonitor_filename'])){if(_0x591863[_0x5b54('0x7d')]){var _0x287e63=path['parse'](_0x591863['value'])[_0x5b54('0x6c')];logger[_0x5b54('0x39')](_0x5b54('0x7c'),_0x287e63,_0x591863[_0x5b54('0x7d')]);this['syncMixMonitorFilename'](_0x287e63,_0x591863[_0x5b54('0x7d')]);}}else if(this[_0x5b54('0x1d')][_0x591863[_0x5b54('0x40')]]){if(this[_0x5b54('0x36')](_0x591863[_0x5b54('0x7a')])){if(this[_0x5b54('0x36')](_0x591863[_0x5b54('0x7a')][_0x5b54('0x91')])){logger[_0x5b54('0x39')](_0x5b54('0x92'),_0x591863[_0x5b54('0x40')],_0x591863['value']);this[_0x5b54('0x1d')][_0x591863['linkedid']][_0x5b54('0x94')]=_0x591863[_0x5b54('0x7d')];}}}}}catch(_0x56bf7f){logger['error']('[%s][voiceCallReport][varset]',_0x591863['uniqueid'],util[_0x5b54('0x3f')](_0x56bf7f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b54('0x35')][_0x5b54('0x28')]=function(_0x38ba6a){try{if(this[_0x5b54('0x36')](_0x38ba6a)){logger[_0x5b54('0x3c')](_0x5b54('0x95'),_0x38ba6a[_0x5b54('0x3e')],util['inspect'](_0x38ba6a,{'showHidden':![],'depth':null}));if(this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]]){logger[_0x5b54('0x39')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x38ba6a[_0x5b54('0x3e')],_0x38ba6a[_0x5b54('0x96')]);var _0x5325dc=moment();this['channels'][_0x38ba6a[_0x5b54('0x3e')]]['endtime']=_0x5325dc[_0x5b54('0x53')](_0x5b54('0x4b'));this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]]['duration']=_0x5325dc[_0x5b54('0x65')](this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]][_0x5b54('0x4a')],_0x5b54('0x5d'));if(this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]][_0x5b54('0x63')]){this['channels'][_0x38ba6a[_0x5b54('0x3e')]][_0x5b54('0x97')]=_0x5325dc[_0x5b54('0x65')](this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]][_0x5b54('0x64')],_0x5b54('0x5d'));this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]]['holdtime']=this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]][_0x5b54('0x5b')]-this[_0x5b54('0x1d')][_0x38ba6a['uniqueid']]['billableseconds'];}if(_0x38ba6a['context']===_0x5b54('0x4e')){if(this['agents'][_0x38ba6a[_0x5b54('0x46')][_0x5b54('0x4f')]('-')[0x0]]){this[_0x5b54('0x1e')][_0x38ba6a['channel'][_0x5b54('0x4f')]('-')[0x0]]=_[_0x5b54('0x98')](this[_0x5b54('0x1e')][_0x38ba6a[_0x5b54('0x46')][_0x5b54('0x4f')]('-')[0x0]],[_0x5b54('0x50')]);logger[_0x5b54('0x3c')](_0x5b54('0x99'),_0x38ba6a['uniqueid'],util[_0x5b54('0x3f')]({'destaccountcode':this[_0x5b54('0x1e')][_0x38ba6a['channel']['split']('-')[0x0]][_0x5b54('0x52')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x5b54('0x53')](_0x5b54('0x54'),this['agents'][_0x38ba6a[_0x5b54('0x46')][_0x5b54('0x4f')]('-')[0x0]][_0x5b54('0x6c')]),_0x5b54('0x9a'),{'destaccountcode':this['agents'][_0x38ba6a[_0x5b54('0x46')][_0x5b54('0x4f')]('-')[0x0]]['accountcode']});}}if(_0x38ba6a[_0x5b54('0x9b')]==='BlindTransfer'){this['blindTransfers'][_0x38ba6a[_0x5b54('0x3e')]]=this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]];}else{if(this[_0x5b54('0x1d')][_0x38ba6a['uniqueid']]['type']===_0x5b54('0x9c')&&this[_0x5b54('0x9d')][_0x38ba6a[_0x5b54('0x3e')]]){this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]][_0x5b54('0x3e')]=[this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]][_0x5b54('0x40')],this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]][_0x5b54('0x40')]=this[_0x5b54('0x1d')][_0x38ba6a['uniqueid']][_0x5b54('0x3e')]][0x0];delete this['blindTransfers'][_0x38ba6a[_0x5b54('0x3e')]];}}logger[_0x5b54('0x3c')](_0x5b54('0x9e'),_0x38ba6a[_0x5b54('0x3e')],util[_0x5b54('0x3f')](this[_0x5b54('0x1d')][_0x38ba6a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x5b54('0x38')]('custom:voiceCallReport',this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]]);delete this[_0x5b54('0x1d')][_0x38ba6a[_0x5b54('0x3e')]];}}}catch(_0x173399){logger[_0x5b54('0x33')](_0x5b54('0x9f'),_0x38ba6a[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x173399,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b54('0x35')]['syncAttendedTransfer']=function(_0x214cc1){try{if(this[_0x5b54('0x36')](_0x214cc1)){logger['info'](_0x5b54('0xa0'),_0x214cc1[_0x5b54('0x3e')],_0x214cc1[_0x5b54('0xa1')],_0x214cc1[_0x5b54('0xa2')]);logger['debug'](_0x5b54('0xa3'),_0x214cc1[_0x5b54('0x3e')],util['inspect'](_0x214cc1,{'showHidden':![],'depth':null}));if(this[_0x5b54('0x1d')][_0x214cc1['transfereeuniqueid']]){this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa4')]][_0x5b54('0xa5')]=_0x214cc1[_0x5b54('0xa1')];this['channels'][_0x214cc1[_0x5b54('0xa4')]][_0x5b54('0xa6')]=_0x214cc1[_0x5b54('0xa2')];if(this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa7')]]){var _0x5d438d=this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa7')]];this['channels'][_0x214cc1[_0x5b54('0xa7')]]=this['channels'][_0x214cc1[_0x5b54('0xa4')]];this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa4')]]=_0x5d438d;}}else if(this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa8')]]){this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa8')]][_0x5b54('0xa5')]=_0x214cc1[_0x5b54('0xa1')];this['channels'][_0x214cc1[_0x5b54('0xa8')]][_0x5b54('0xa6')]=_0x214cc1[_0x5b54('0xa2')];if(this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa9')]]){var _0x5d438d=this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa9')]];this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa9')]]=this['channels'][_0x214cc1[_0x5b54('0xa8')]];this[_0x5b54('0x1d')][_0x214cc1[_0x5b54('0xa8')]]=_0x5d438d;}}}}catch(_0x251b0d){logger['error']('[%s][voiceCallReport][attendedtransfer]',_0x214cc1['uniqueid'],util['inspect'](_0x251b0d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b54('0x35')][_0x5b54('0x2d')]=function(_0x10fbd6){try{if(this[_0x5b54('0x36')](_0x10fbd6)){logger[_0x5b54('0x39')](_0x5b54('0xaa'),_0x10fbd6[_0x5b54('0x3e')],_0x10fbd6[_0x5b54('0xab')],_0x10fbd6[_0x5b54('0xac')]);logger[_0x5b54('0x3c')](_0x5b54('0xad'),_0x10fbd6[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x10fbd6,{'showHidden':![],'depth':null}));if(this[_0x5b54('0x1d')][_0x10fbd6[_0x5b54('0xa4')]]){this[_0x5b54('0x1d')][_0x10fbd6[_0x5b54('0xa4')]][_0x5b54('0xa5')]=_0x10fbd6['transfereecalleridnum'];this[_0x5b54('0x1d')][_0x10fbd6['transfereeuniqueid']][_0x5b54('0xa6')]=_0x10fbd6[_0x5b54('0xac')];this[_0x5b54('0x28')]({'event':_0x5b54('0xae'),'uniqueid':_0x10fbd6[_0x5b54('0xa4')],'context':_0x10fbd6[_0x5b54('0x48')],'channel':_0x10fbd6[_0x5b54('0xaf')]});}}}catch(_0x5d76d7){logger[_0x5b54('0x33')]('[%s][voiceCallReport][blindtransfer]',_0x10fbd6[_0x5b54('0x3e')],util['inspect'](_0x5d76d7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5b54('0x2f')]=function(_0x32190f){try{if(this[_0x5b54('0x36')](_0x32190f)){logger[_0x5b54('0x3c')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x32190f['uniqueid'],util['inspect'](_0x32190f,{'showHidden':![],'depth':null}));if(this[_0x5b54('0x1d')][_0x32190f[_0x5b54('0x3e')]]){if(!_[_0x5b54('0xb0')](this[_0x5b54('0x1d')][_0x32190f[_0x5b54('0x3e')]][_0x5b54('0x64')])){this[_0x5b54('0x1d')][_0x32190f[_0x5b54('0x3e')]][_0x5b54('0xb1')]=moment()['format'](_0x5b54('0x4b'));logger[_0x5b54('0x39')](_0x5b54('0xb2'),_0x32190f[_0x5b54('0x3e')],this['channels'][_0x32190f['uniqueid']]['mohstarttime']);}}}}catch(_0xf0f730){logger[_0x5b54('0x33')]('[%s][voiceCallReport][musiconholdstart]',_0x32190f['uniqueid'],util[_0x5b54('0x3f')](_0xf0f730,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b54('0x35')][_0x5b54('0x31')]=function(_0xbb9986){try{if(this[_0x5b54('0x36')](_0xbb9986)){logger[_0x5b54('0x3c')](_0x5b54('0xb3'),_0xbb9986[_0x5b54('0x3e')],util['inspect'](_0xbb9986,{'showHidden':![],'depth':null}));if(this[_0x5b54('0x1d')][_0xbb9986['uniqueid']]){if(!_[_0x5b54('0xb0')](this[_0x5b54('0x1d')][_0xbb9986[_0x5b54('0x3e')]][_0x5b54('0xb1')])){this['channels'][_0xbb9986[_0x5b54('0x3e')]][_0x5b54('0xb4')]+=moment()[_0x5b54('0xb5')](0x0)['diff'](this[_0x5b54('0x1d')][_0xbb9986[_0x5b54('0x3e')]][_0x5b54('0xb1')],_0x5b54('0x5d'));logger[_0x5b54('0x39')](_0x5b54('0xb6'),_0xbb9986[_0x5b54('0x3e')],this[_0x5b54('0x1d')][_0xbb9986[_0x5b54('0x3e')]]['mohtime']);delete this['channels'][_0xbb9986[_0x5b54('0x3e')]]['mohstarttime'];}}}}catch(_0x5e3952){logger[_0x5b54('0x33')](_0x5b54('0xb7'),_0xbb9986[_0x5b54('0x3e')],util[_0x5b54('0x3f')](_0x5e3952,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x7f60=['lastapplication','lastdata','cdr(','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','xcally-motion-preview','connectedlinenum','connectedlinename','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.WAV','monitorFilename','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','diff','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','name','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','secondtransfereruniqueid','transfercalleridnum','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','bind','newexten','syncNewExten','newchannel','newstate','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','linkedid','pick','[%s][voiceCallReport][newcallerid]','syncNewChannel','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','exten','emit','user:%s','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','appdata','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','merge'];(function(_0x2d3134,_0x477c10){var _0x2dd03e=function(_0x434841){while(--_0x434841){_0x2d3134['push'](_0x2d3134['shift']());}};_0x2dd03e(++_0x477c10);}(_0x7f60,0x1c9));var _0x07f6=function(_0x5d9067,_0x42f3ea){_0x5d9067=_0x5d9067-0x0;var _0x256093=_0x7f60[_0x5d9067];return _0x256093;};'use strict';var BPromise=require('bluebird');var _=require(_0x07f6('0x0'));var moment=require(_0x07f6('0x1'));var util=require(_0x07f6('0x2'));var path=require(_0x07f6('0x3'));var Redis=require(_0x07f6('0x4'));var config=require('../../../config/environment');var logger=require(_0x07f6('0x5'))(_0x07f6('0x6'));var ami=require(_0x07f6('0x7'));var Channel=require(_0x07f6('0x8'));var statusDesc=[_0x07f6('0x9'),_0x07f6('0xa'),'inuse',_0x07f6('0xb'),_0x07f6('0xc'),_0x07f6('0xd'),'ringing',_0x07f6('0xe'),_0x07f6('0xf')];var applications=[_0x07f6('0x10'),_0x07f6('0x11'),_0x07f6('0x12'),_0x07f6('0x13'),_0x07f6('0x14'),_0x07f6('0x15')];var dispositions=[_0x07f6('0x16'),_0x07f6('0x17'),_0x07f6('0x17'),_0x07f6('0x16'),'NO\x20ANSWER',_0x07f6('0x16'),_0x07f6('0x18'),_0x07f6('0x19'),_0x07f6('0x17'),_0x07f6('0x17'),'FAILED'];var actions={};config['redis']=_[_0x07f6('0x1a')](config[_0x07f6('0x1b')],{'host':_0x07f6('0x1c'),'port':0x18eb});var io=require(_0x07f6('0x1d'))(new Redis(config[_0x07f6('0x1b')]));function VoiceCallReport(_0x595afa){this[_0x07f6('0x1e')]=_0x595afa[_0x07f6('0x1e')];this[_0x07f6('0x1f')]=_0x595afa[_0x07f6('0x1f')];this['blindTransfers']={};ami['on']('coreshowchannel',this['syncNewExten'][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x21'),this[_0x07f6('0x22')][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x23'),this['syncNewChannel']['bind'](this));ami['on'](_0x07f6('0x24'),this['syncNewState']['bind'](this));ami['on']('varset',this['syncVarSet'][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x25'),this[_0x07f6('0x26')][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x27'),this[_0x07f6('0x28')][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x29'),this['syncAttendedTransfer'][_0x07f6('0x20')](this));ami['on']('blindtransfer',this[_0x07f6('0x2a')][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x2b'),this['syncMusicOnHoldStart'][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x2c'),this[_0x07f6('0x2d')][_0x07f6('0x20')](this));try{logger[_0x07f6('0x2e')](_0x07f6('0x2f'));ami[_0x07f6('0x30')]();}catch(_0x21b904){logger[_0x07f6('0x31')](_0x07f6('0x32'),util[_0x07f6('0x33')](_0x21b904,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x07f6('0x34')]['isNotNull']=function(_0x54fcba){return _0x54fcba!==null&&!_[_0x07f6('0x35')](_0x54fcba);};VoiceCallReport[_0x07f6('0x34')]['emit']=function(_0xf73e29,_0x2d60e0,_0x359ab4){io['to'](_0xf73e29)['emit'](_0x2d60e0,_0x359ab4);};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x28')]=function(_0x2d5c10){try{if(this['isNotNull'](_0x2d5c10)){logger[_0x07f6('0x2e')](_0x07f6('0x36'),_0x2d5c10[_0x07f6('0x37')],_0x2d5c10[_0x07f6('0x38')],_0x2d5c10['calleridnum']);logger[_0x07f6('0x39')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x2d5c10[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x2d5c10,{'showHidden':![],'depth':null}));if(_0x2d5c10[_0x07f6('0x37')]===_0x2d5c10[_0x07f6('0x3a')]){if(!_['isUndefined'](this[_0x07f6('0x1e')][_0x2d5c10[_0x07f6('0x37')]])){_['merge'](this[_0x07f6('0x1e')][_0x2d5c10[_0x07f6('0x37')]],_[_0x07f6('0x3b')](_0x2d5c10,_['keys'](this['channels'][_0x2d5c10['uniqueid']])));}}}}catch(_0x5bc9bd){logger[_0x07f6('0x31')](_0x07f6('0x3c'),_0x2d5c10[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x5bc9bd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x3d')]=function(_0x4fc60b){try{if(this[_0x07f6('0x3e')](_0x4fc60b)){logger['debug'](_0x07f6('0x3f'),_0x4fc60b['uniqueid'],util[_0x07f6('0x33')](_0x4fc60b,{'showHidden':![],'depth':null}));if(_0x4fc60b['uniqueid']===_0x4fc60b[_0x07f6('0x3a')]&&_0x4fc60b[_0x07f6('0x40')]!='OutgoingSpoolFailed'){if(_[_0x07f6('0x35')](this[_0x07f6('0x1e')][_0x4fc60b[_0x07f6('0x37')]])){logger[_0x07f6('0x2e')](_0x07f6('0x41'),_0x4fc60b[_0x07f6('0x37')],_0x4fc60b[_0x07f6('0x42')],_0x4fc60b['exten']);this[_0x07f6('0x1e')][_0x4fc60b[_0x07f6('0x37')]]=new Channel();this['channels'][_0x4fc60b[_0x07f6('0x37')]][_0x07f6('0x43')]=moment()[_0x07f6('0x44')](_0x07f6('0x45'));this[_0x07f6('0x1e')][_0x4fc60b['uniqueid']][_0x07f6('0x46')]=dispositions[_[_0x07f6('0x47')](_0x4fc60b['channelstate'])];_['merge'](this['channels'][_0x4fc60b['uniqueid']],_['pick'](_0x4fc60b,_['keys'](this[_0x07f6('0x1e')][_0x4fc60b['uniqueid']])));if(_0x4fc60b[_0x07f6('0x42')]===_0x07f6('0x48')){if(this[_0x07f6('0x1f')][_0x4fc60b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]){this[_0x07f6('0x1f')][_0x4fc60b['channel']['split']('-')[0x0]][_0x07f6('0x4a')]=_0x4fc60b['exten'];logger['debug'](_0x07f6('0x4b'),_0x4fc60b[_0x07f6('0x37')],util['inspect']({'destaccountcode':this[_0x07f6('0x1f')][_0x4fc60b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]][_0x07f6('0x4c')],'destconnectedlinenum':_0x4fc60b[_0x07f6('0x4d')]},{'showHidden':![],'depth':null}));this[_0x07f6('0x4e')](util['format'](_0x07f6('0x4f'),this[_0x07f6('0x1f')][_0x4fc60b[_0x07f6('0x40')]['split']('-')[0x0]]['name']),_0x07f6('0x50'),{'destaccountcode':this[_0x07f6('0x1f')][_0x4fc60b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]][_0x07f6('0x4c')],'destconnectedlinenum':_0x4fc60b[_0x07f6('0x4d')]});}}}}}}catch(_0x428b55){logger[_0x07f6('0x31')]('[%s][voiceCallReport][newchannel]',_0x4fc60b[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x428b55,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x07f6('0x22')]=function(_0x44dd70){try{if(this[_0x07f6('0x3e')](_0x44dd70)){logger[_0x07f6('0x39')](_0x07f6('0x51'),_0x44dd70[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x44dd70,{'showHidden':![],'depth':null}));if(_0x44dd70['uniqueid']===_0x44dd70[_0x07f6('0x3a')]&&_0x44dd70[_0x07f6('0x4d')]!='h'&&_0x44dd70[_0x07f6('0x40')]!=_0x07f6('0x52')){_0x44dd70[_0x07f6('0x53')]=_0x44dd70['application']['toLowerCase']();_0x44dd70['applicationdata']=(_0x44dd70[_0x07f6('0x54')]||_0x44dd70[_0x07f6('0x55')])[_0x07f6('0x56')]();logger[_0x07f6('0x2e')](_0x07f6('0x57'),_0x44dd70['uniqueid'],_0x44dd70['application'],_0x44dd70[_0x07f6('0x55')]);if(_[_0x07f6('0x35')](this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]])){this['channels'][_0x44dd70[_0x07f6('0x37')]]=new Channel();this[_0x07f6('0x1e')][_0x44dd70['uniqueid']]['starttime']=_0x44dd70[_0x07f6('0x58')]?moment()[_0x07f6('0x59')](moment[_0x07f6('0x58')](_0x44dd70[_0x07f6('0x58')])['seconds'](),_0x07f6('0x5a'))[_0x07f6('0x44')](_0x07f6('0x45')):moment()[_0x07f6('0x44')](_0x07f6('0x45'));this['channels'][_0x44dd70[_0x07f6('0x37')]]['disposition']=_0x07f6('0x16');}_[_0x07f6('0x5b')](this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]],_[_0x07f6('0x3b')](_0x44dd70,_['keys'](this['channels'][_0x44dd70[_0x07f6('0x37')]])));if(_['includes'](applications,_0x44dd70[_0x07f6('0x53')])){this[_0x07f6('0x1e')][_0x44dd70['uniqueid']][_0x07f6('0x5c')]=_0x44dd70[_0x07f6('0x53')];this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]][_0x07f6('0x5d')]=_0x44dd70[_0x07f6('0x55')];if(_0x44dd70[_0x07f6('0x53')]==='set'&&_['startsWith'](_0x44dd70[_0x07f6('0x55')],_0x07f6('0x5e'))){var _0x381fc5=_0x44dd70[_0x07f6('0x55')][_0x07f6('0x49')]('=');var _0xdb0009=_0x381fc5[0x0]['match'](/cdr\((.*)\)/);if(_0xdb0009){this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]][_0xdb0009[0x1]]=_0x381fc5[0x1];}}else if(_0x44dd70['application']==='queue'){this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]][_0x07f6('0x11')]=_0x44dd70[_0x07f6('0x55')][_0x07f6('0x49')](',')[0x0];}}}}}catch(_0x41ca05){logger[_0x07f6('0x31')](_0x07f6('0x5f'),_0x44dd70[_0x07f6('0x37')],util['inspect'](_0x41ca05,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x07f6('0x60')]=function(_0x59a4b2){try{if(this[_0x07f6('0x3e')](_0x59a4b2)){logger['info'](_0x07f6('0x61'),_0x59a4b2[_0x07f6('0x37')],_0x59a4b2[_0x07f6('0x3a')],_0x59a4b2[_0x07f6('0x38')],_0x59a4b2[_0x07f6('0x62')]);logger[_0x07f6('0x39')](_0x07f6('0x63'),_0x59a4b2[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x59a4b2,{'showHidden':![],'depth':null}));if(_0x59a4b2[_0x07f6('0x37')]!==_0x59a4b2[_0x07f6('0x3a')]){if(this[_0x07f6('0x1e')][_0x59a4b2['linkedid']]){if(_0x59a4b2[_0x07f6('0x64')]==='6'){if(!this['channels'][_0x59a4b2[_0x07f6('0x3a')]]['answered']){var _0x405771=moment();this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x65')]=!![];this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x66')]=_0x405771[_0x07f6('0x44')](_0x07f6('0x45'));if(this[_0x07f6('0x1e')][_0x59a4b2['linkedid']][_0x07f6('0x43')]){this[_0x07f6('0x1e')][_0x59a4b2['linkedid']][_0x07f6('0x67')]=_0x405771['diff'](this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x43')],_0x07f6('0x5a'));}}this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x3a')]=_0x59a4b2[_0x07f6('0x37')];if(_0x59a4b2[_0x07f6('0x62')]!==_0x07f6('0x68')){this[_0x07f6('0x1e')][_0x59a4b2['linkedid']][_0x07f6('0x69')]=_0x59a4b2[_0x07f6('0x62')];}this['channels'][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x6a')]=_0x59a4b2[_0x07f6('0x38')];this['channels'][_0x59a4b2[_0x07f6('0x3a')]]['destinationchannel']=_0x59a4b2['channel'];this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x46')]=dispositions[_[_0x07f6('0x47')](_0x59a4b2[_0x07f6('0x64')])];if(this[_0x07f6('0x1f')][_0x59a4b2[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]){this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x6b')]=this[_0x07f6('0x1f')][_0x59a4b2[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['id'];this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x6c')]=this['agents'][_0x59a4b2[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['name'];}}}}else{if(this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x37')]]){if(_0x59a4b2[_0x07f6('0x64')]==='6'){if(this[_0x07f6('0x1f')][_0x59a4b2['channel'][_0x07f6('0x49')]('-')[0x0]]){this[_0x07f6('0x1e')][_0x59a4b2['uniqueid']][_0x07f6('0x6b')]=this[_0x07f6('0x1f')][_0x59a4b2[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['id'];this[_0x07f6('0x1e')][_0x59a4b2['uniqueid']][_0x07f6('0x6c')]=this[_0x07f6('0x1f')][_0x59a4b2['channel']['split']('-')[0x0]]['name'];}}}}}}catch(_0xd8e624){logger[_0x07f6('0x31')](_0x07f6('0x6d'),_0x59a4b2[_0x07f6('0x37')],util['inspect'](_0xd8e624,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x6e')]=function(_0x39916b,_0x56cf2e){try{if(this[_0x07f6('0x1e')][_0x39916b]){logger[_0x07f6('0x2e')](_0x07f6('0x6f'),_0x39916b,_0x56cf2e);this[_0x07f6('0x1e')][_0x39916b][_0x07f6('0x70')]=!![];if(_[_0x07f6('0x71')](_0x56cf2e,'.wav49')){_0x56cf2e=_0x56cf2e[_0x07f6('0x72')]('.wav49',_0x07f6('0x73'));}this[_0x07f6('0x1e')][_0x39916b][_0x07f6('0x74')]=_0x56cf2e;var _0x16a691=_['find'](this['channels'][_0x39916b]['monitors'],{'filename':_0x56cf2e});if(_[_0x07f6('0x75')](_0x16a691)){this[_0x07f6('0x1e')][_0x39916b]['monitors'][_0x07f6('0x76')]({'filename':_0x56cf2e,'createdAt':moment()[_0x07f6('0x44')](_0x07f6('0x45')),'mixmonitorid':'','status':_0x07f6('0x77')});}}}catch(_0x4bbaf0){logger['error'](_0x07f6('0x78'),_0x39916b,util[_0x07f6('0x33')](_0x4bbaf0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x79')]=function(_0x232ea7){try{if(this[_0x07f6('0x3e')](_0x232ea7)){logger[_0x07f6('0x39')](_0x07f6('0x7a'),_0x232ea7[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x232ea7,{'showHidden':![],'depth':null}));if(this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]]&&_0x232ea7[_0x07f6('0x40')]!=_0x07f6('0x52')){if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')])){if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x7c')])){logger[_0x07f6('0x2e')](_0x07f6('0x7d'),_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this[_0x07f6('0x6e')](_0x232ea7['uniqueid'],_0x232ea7[_0x07f6('0x7e')]);}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')]['xmd-phone'])){logger[_0x07f6('0x2e')](_0x07f6('0x7f'),_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this['channels'][_0x232ea7['uniqueid']][_0x07f6('0x62')]=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x80')])){logger[_0x07f6('0x2e')](_0x07f6('0x81'),_0x232ea7['uniqueid'],_0x232ea7[_0x07f6('0x7e')]);this['channels'][_0x232ea7[_0x07f6('0x37')]]['callerid']=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x82')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this['channels'][_0x232ea7[_0x07f6('0x37')]][_0x07f6('0x83')]=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x84')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')][_0x07f6('0x49')](',')[0x0]);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]]['queue']=_0x232ea7[_0x07f6('0x7e')]['split'](',')[0x0];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x85')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this['channels'][_0x232ea7['uniqueid']][_0x07f6('0x86')]=_0x232ea7['value'];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')]['xmd-destination'])){logger[_0x07f6('0x2e')](_0x07f6('0x87'),_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]][_0x07f6('0x88')]=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x89')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7['value']);this[_0x07f6('0x1e')][_0x232ea7['uniqueid']][_0x07f6('0x8a')]=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x8b')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7['value']);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]][_0x07f6('0x11')]=_0x232ea7['value'];}else if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x8c')])){logger[_0x07f6('0x2e')](_0x07f6('0x8d'),_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]]['sipcalluniqueid']=_0x232ea7[_0x07f6('0x7e')];}}}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x7c')])){if(_0x232ea7[_0x07f6('0x7e')]){var _0x316500=path['parse'](_0x232ea7[_0x07f6('0x7e')])['name'];logger[_0x07f6('0x2e')](_0x07f6('0x7d'),_0x316500,_0x232ea7[_0x07f6('0x7e')]);this[_0x07f6('0x6e')](_0x316500,_0x232ea7[_0x07f6('0x7e')]);}}else if(this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x3a')]]){if(this['isNotNull'](_0x232ea7[_0x07f6('0x7b')])){if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x8c')])){logger['info'](_0x07f6('0x8d'),_0x232ea7[_0x07f6('0x3a')],_0x232ea7['value']);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x3a')]][_0x07f6('0x8e')]=_0x232ea7[_0x07f6('0x7e')];}}}}}catch(_0x3735f7){logger[_0x07f6('0x31')](_0x07f6('0x8f'),_0x232ea7[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x3735f7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x07f6('0x26')]=function(_0x54e90b){try{if(this[_0x07f6('0x3e')](_0x54e90b)){logger[_0x07f6('0x39')](_0x07f6('0x90'),_0x54e90b[_0x07f6('0x37')],util['inspect'](_0x54e90b,{'showHidden':![],'depth':null}));if(this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]]){logger['info'](_0x07f6('0x91'),_0x54e90b[_0x07f6('0x37')],_0x54e90b['cause-txt']);var _0x35cca4=moment();this['channels'][_0x54e90b['uniqueid']]['endtime']=_0x35cca4[_0x07f6('0x44')](_0x07f6('0x45'));this['channels'][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x58')]=_0x35cca4['diff'](this[_0x07f6('0x1e')][_0x54e90b['uniqueid']]['starttime'],_0x07f6('0x5a'));if(this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x65')]){this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x92')]=_0x35cca4[_0x07f6('0x93')](this['channels'][_0x54e90b['uniqueid']]['answertime'],'seconds');this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x67')]=this[_0x07f6('0x1e')][_0x54e90b['uniqueid']][_0x07f6('0x58')]-this['channels'][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x92')];}if(_0x54e90b[_0x07f6('0x42')]===_0x07f6('0x48')){if(this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')]['split']('-')[0x0]]){this[_0x07f6('0x1f')][_0x54e90b['channel'][_0x07f6('0x49')]('-')[0x0]]=_[_0x07f6('0x94')](this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]],['destconnectedlinenum']);logger[_0x07f6('0x39')](_0x07f6('0x95'),_0x54e90b[_0x07f6('0x37')],util[_0x07f6('0x33')]({'destaccountcode':this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x07f6('0x4e')](util[_0x07f6('0x44')](_0x07f6('0x4f'),this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')]['split']('-')[0x0]][_0x07f6('0x96')]),'user:agentcomplete',{'destaccountcode':this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['accountcode']});}}if(_0x54e90b[_0x07f6('0x97')]===_0x07f6('0x98')){this[_0x07f6('0x99')][_0x54e90b['uniqueid']]=this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]];}else{if(this[_0x07f6('0x1e')][_0x54e90b['uniqueid']]['type']===_0x07f6('0x9a')&&this['blindTransfers'][_0x54e90b['uniqueid']]){this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x37')]=[this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x3a')],this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x3a')]=this['channels'][_0x54e90b[_0x07f6('0x37')]]['uniqueid']][0x0];delete this['blindTransfers'][_0x54e90b[_0x07f6('0x37')]];}}logger[_0x07f6('0x39')](_0x07f6('0x9b'),_0x54e90b[_0x07f6('0x37')],util[_0x07f6('0x33')](this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]],{'showHidden':![],'depth':null}));ami['emit'](_0x07f6('0x9c'),this['channels'][_0x54e90b[_0x07f6('0x37')]]);delete this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]];}}}catch(_0x585d86){logger[_0x07f6('0x31')](_0x07f6('0x9d'),_0x54e90b['uniqueid'],util['inspect'](_0x585d86,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x07f6('0x9e')]=function(_0x1c02fe){try{if(this[_0x07f6('0x3e')](_0x1c02fe)){logger[_0x07f6('0x2e')](_0x07f6('0x9f'),_0x1c02fe[_0x07f6('0x37')],_0x1c02fe[_0x07f6('0xa0')],_0x1c02fe[_0x07f6('0xa1')]);logger[_0x07f6('0x39')](_0x07f6('0xa2'),_0x1c02fe['uniqueid'],util[_0x07f6('0x33')](_0x1c02fe,{'showHidden':![],'depth':null}));if(this['channels'][_0x1c02fe[_0x07f6('0xa3')]]){this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa3')]]['transfercalleridnum']=_0x1c02fe[_0x07f6('0xa0')];this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa3')]]['transferconnectedlinenum']=_0x1c02fe['transfertargetcalleridnum'];if(this['channels'][_0x1c02fe[_0x07f6('0xa4')]]){var _0x40f3b1=this['channels'][_0x1c02fe[_0x07f6('0xa4')]];this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa4')]]=this[_0x07f6('0x1e')][_0x1c02fe['transfereeuniqueid']];this['channels'][_0x1c02fe[_0x07f6('0xa3')]]=_0x40f3b1;}}else if(this[_0x07f6('0x1e')][_0x1c02fe['transfertargetuniqueid']]){this[_0x07f6('0x1e')][_0x1c02fe['transfertargetuniqueid']][_0x07f6('0xa5')]=_0x1c02fe[_0x07f6('0xa0')];this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa6')]]['transferconnectedlinenum']=_0x1c02fe[_0x07f6('0xa1')];if(this[_0x07f6('0x1e')][_0x1c02fe['origtransfereruniqueid']]){var _0x40f3b1=this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa7')]];this[_0x07f6('0x1e')][_0x1c02fe['origtransfereruniqueid']]=this[_0x07f6('0x1e')][_0x1c02fe['transfertargetuniqueid']];this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa6')]]=_0x40f3b1;}}}}catch(_0x2743b6){logger[_0x07f6('0x31')](_0x07f6('0xa8'),_0x1c02fe[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x2743b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x2a')]=function(_0xf08ae3){try{if(this[_0x07f6('0x3e')](_0xf08ae3)){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0xf08ae3[_0x07f6('0x37')],_0xf08ae3[_0x07f6('0xa9')],_0xf08ae3['extension']);logger[_0x07f6('0x39')](_0x07f6('0xaa'),_0xf08ae3[_0x07f6('0x37')],util[_0x07f6('0x33')](_0xf08ae3,{'showHidden':![],'depth':null}));if(this[_0x07f6('0x1e')][_0xf08ae3[_0x07f6('0xa3')]]){this[_0x07f6('0x1e')][_0xf08ae3[_0x07f6('0xa3')]][_0x07f6('0xa5')]=_0xf08ae3[_0x07f6('0xa9')];this[_0x07f6('0x1e')][_0xf08ae3[_0x07f6('0xa3')]]['transferconnectedlinenum']=_0xf08ae3[_0x07f6('0xab')];this[_0x07f6('0x26')]({'event':_0x07f6('0x98'),'uniqueid':_0xf08ae3[_0x07f6('0xa3')],'context':_0xf08ae3[_0x07f6('0x42')],'channel':_0xf08ae3[_0x07f6('0xac')]});}}}catch(_0x596e66){logger['error'](_0x07f6('0xad'),_0xf08ae3['uniqueid'],util[_0x07f6('0x33')](_0x596e66,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')]['syncMusicOnHoldStart']=function(_0x48b8cc){try{if(this[_0x07f6('0x3e')](_0x48b8cc)){logger['debug'](_0x07f6('0xae'),_0x48b8cc[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x48b8cc,{'showHidden':![],'depth':null}));if(this['channels'][_0x48b8cc[_0x07f6('0x37')]]){if(!_[_0x07f6('0x75')](this[_0x07f6('0x1e')][_0x48b8cc['uniqueid']][_0x07f6('0x66')])){this[_0x07f6('0x1e')][_0x48b8cc[_0x07f6('0x37')]][_0x07f6('0xaf')]=moment()[_0x07f6('0x44')](_0x07f6('0x45'));logger[_0x07f6('0x2e')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x48b8cc[_0x07f6('0x37')],this[_0x07f6('0x1e')][_0x48b8cc[_0x07f6('0x37')]][_0x07f6('0xaf')]);}}}}catch(_0x4eb8ee){logger[_0x07f6('0x31')](_0x07f6('0xb0'),_0x48b8cc[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x4eb8ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x2d')]=function(_0x2a81de){try{if(this[_0x07f6('0x3e')](_0x2a81de)){logger[_0x07f6('0x39')](_0x07f6('0xb1'),_0x2a81de[_0x07f6('0x37')],util['inspect'](_0x2a81de,{'showHidden':![],'depth':null}));if(this[_0x07f6('0x1e')][_0x2a81de['uniqueid']]){if(!_[_0x07f6('0x75')](this['channels'][_0x2a81de[_0x07f6('0x37')]][_0x07f6('0xaf')])){this[_0x07f6('0x1e')][_0x2a81de[_0x07f6('0x37')]][_0x07f6('0xb2')]+=moment()[_0x07f6('0xb3')](0x0)['diff'](this[_0x07f6('0x1e')][_0x2a81de[_0x07f6('0x37')]][_0x07f6('0xaf')],_0x07f6('0x5a'));logger[_0x07f6('0x2e')](_0x07f6('0xb4'),_0x2a81de['uniqueid'],this[_0x07f6('0x1e')][_0x2a81de['uniqueid']]['mohtime']);delete this['channels'][_0x2a81de['uniqueid']][_0x07f6('0xaf')];}}}}catch(_0x46ca11){logger[_0x07f6('0x31')](_0x07f6('0xb5'),_0x2a81de['uniqueid'],util[_0x07f6('0x33')](_0x46ca11,{'showHidden':![],'depth':null}));}};module[_0x07f6('0xb6')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index a0657a2..62f3b81 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4835=['[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','addVariable','keys','variable','value','outboundrouteid','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','endtime','diff','starttime','seconds','complete','total','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','moment','util','ioredis','ami','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','bind','syncDialEnd','varset','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','syncDialBegin','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface'];(function(_0x3f676c,_0x119cfd){var _0x5a091a=function(_0x44e068){while(--_0x44e068){_0x3f676c['push'](_0x3f676c['shift']());}};_0x5a091a(++_0x119cfd);}(_0x4835,0x1c3));var _0x5483=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x4835[_0x557fd2];return _0x1b54a2;};'use strict';var _=require('lodash');var moment=require(_0x5483('0x0'));var util=require(_0x5483('0x1'));var Redis=require(_0x5483('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x5483('0x3'));var ami=require(_0x5483('0x4'));config[_0x5483('0x5')]=_[_0x5483('0x6')](config['redis'],{'host':_0x5483('0x7'),'port':0x18eb});var io=require(_0x5483('0x8'))(new Redis(config[_0x5483('0x5')]));function VoiceDialReport(_0x1d62c4){this['channels']=_0x1d62c4[_0x5483('0x9')];this[_0x5483('0xa')]=_0x1d62c4[_0x5483('0xa')];this['variables']={};ami['on']('dialbegin',this['syncDialBegin'][_0x5483('0xb')](this));ami['on']('dialend',this[_0x5483('0xc')][_0x5483('0xb')](this));ami['on'](_0x5483('0xd'),this[_0x5483('0xe')][_0x5483('0xb')](this));ami['on']('hangup',this[_0x5483('0xf')][_0x5483('0xb')](this));}VoiceDialReport[_0x5483('0x10')][_0x5483('0x11')]=function(_0x18c1d5){return _0x18c1d5!==null&&!_[_0x5483('0x12')](_0x18c1d5);};VoiceDialReport[_0x5483('0x10')][_0x5483('0x13')]=function(_0x29d9c7,_0x4cbf61,_0x5dc252){io['to'](_0x29d9c7)[_0x5483('0x13')](_0x4cbf61,_0x5dc252);};VoiceDialReport[_0x5483('0x10')][_0x5483('0x14')]=function(_0x265b3e){try{if(this[_0x5483('0x11')](_0x265b3e)){logger[_0x5483('0x15')](_0x5483('0x16'),_0x265b3e[_0x5483('0x17')],util[_0x5483('0x18')](_0x265b3e,{'showHidden':![],'depth':null}));if(this[_0x5483('0x19')][_0x265b3e[_0x5483('0x17')]]){_[_0x5483('0x1a')](this[_0x5483('0x19')][_0x265b3e[_0x5483('0x17')]],{'starttime':moment()[_0x5483('0x1b')](_0x5483('0x1c')),'lastevent':_0x5483('0x1d'),'interface':_0x265b3e[_0x5483('0x1e')][_0x5483('0x1f')](0x0,_0x265b3e[_0x5483('0x1e')][_0x5483('0x20')]('-')),'membername':_0x265b3e[_0x5483('0x1e')][_0x5483('0x1f')](_0x265b3e[_0x5483('0x1e')][_0x5483('0x20')]('/')+0x1,_0x265b3e[_0x5483('0x1e')][_0x5483('0x20')]('-'))},_['omit'](_0x265b3e,[_0x5483('0x21'),_0x5483('0x22')]));logger[_0x5483('0x23')](_0x5483('0x24'),_0x265b3e[_0x5483('0x17')],this[_0x5483('0x19')][_0x265b3e[_0x5483('0x17')]][_0x5483('0x25')],this[_0x5483('0x19')][_0x265b3e[_0x5483('0x17')]][_0x5483('0x26')]);logger[_0x5483('0x15')](_0x5483('0x27'),_0x265b3e[_0x5483('0x17')],util['inspect'](this['channels'][_0x265b3e[_0x5483('0x17')]],{'showHidden':![],'depth':null}));this[_0x5483('0x13')]('voice:outbound',_0x5483('0x28'),this[_0x5483('0x19')][_0x265b3e['uniqueid']]);logger[_0x5483('0x15')](_0x5483('0x29'),_0x265b3e[_0x5483('0x17')],util[_0x5483('0x18')](this[_0x5483('0x19')][_0x265b3e[_0x5483('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5483('0x13')](_0x5483('0x2a'),this[_0x5483('0x19')][_0x265b3e[_0x5483('0x17')]]);}}}catch(_0x369847){logger[_0x5483('0x2b')]('[%s][voiceDialReport][dialbegin]',_0x265b3e['uniqueid'],util[_0x5483('0x18')](_0x369847,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5483('0x10')][_0x5483('0xc')]=function(_0xfab225){try{if(this[_0x5483('0x11')](_0xfab225)){logger[_0x5483('0x15')](_0x5483('0x2c'),_0xfab225[_0x5483('0x17')],util[_0x5483('0x18')](_0xfab225,{'showHidden':![],'depth':null}));if(this[_0x5483('0x19')][_0xfab225[_0x5483('0x17')]]){this['channels'][_0xfab225[_0x5483('0x17')]][_0x5483('0x2d')]=_0xfab225[_0x5483('0x2d')];if(_0xfab225[_0x5483('0x2d')]==='ANSWER'){this['channels'][_0xfab225[_0x5483('0x17')]][_0x5483('0x2e')]=_0xfab225[_0x5483('0x2e')];this[_0x5483('0x19')][_0xfab225['uniqueid']][_0x5483('0x2f')]=_0xfab225[_0x5483('0x2f')];this[_0x5483('0x19')][_0xfab225[_0x5483('0x17')]][_0x5483('0x30')]=moment()[_0x5483('0x1b')](_0x5483('0x1c'));this[_0x5483('0x19')][_0xfab225[_0x5483('0x17')]][_0x5483('0x31')]=_0x5483('0x32');logger[_0x5483('0x23')](_0x5483('0x33'),_0xfab225[_0x5483('0x17')],_0xfab225[_0x5483('0x1e')][_0x5483('0x1f')](_0xfab225[_0x5483('0x1e')][_0x5483('0x20')]('/')+0x1,_0xfab225[_0x5483('0x1e')][_0x5483('0x20')]('-')));logger[_0x5483('0x15')](_0x5483('0x34'),_0xfab225[_0x5483('0x17')],util[_0x5483('0x18')](this[_0x5483('0x19')][_0xfab225['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x5483('0x13')]('custom:dialconnect',this[_0x5483('0x19')][_0xfab225[_0x5483('0x17')]]);}logger[_0x5483('0x15')](_0x5483('0x35'),_0xfab225[_0x5483('0x17')],util[_0x5483('0x18')](this[_0x5483('0x19')][_0xfab225[_0x5483('0x17')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x5483('0x28'),this[_0x5483('0x19')][_0xfab225[_0x5483('0x17')]]);}}}catch(_0x2fefb4){logger[_0x5483('0x2b')]('[%s][voiceDialReport][dialend]',_0xfab225[_0x5483('0x17')],util[_0x5483('0x18')](_0x2fefb4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5483('0x10')]['syncVarSet']=function(_0x3e2aae){try{if(this[_0x5483('0x11')](_0x3e2aae)){logger['debug']('[%s][voiceDialReport][varset]\x20event:',_0x3e2aae['uniqueid'],util[_0x5483('0x18')](_0x3e2aae,{'showHidden':![],'depth':null}));this[_0x5483('0x36')](_0x3e2aae[_0x5483('0x17')],_[_0x5483('0x37')](_0x3e2aae[_0x5483('0x38')])[0x0],_0x3e2aae[_0x5483('0x39')]);if(this[_0x5483('0x11')](_0x3e2aae[_0x5483('0x38')])&&this[_0x5483('0x11')](_0x3e2aae[_0x5483('0x38')][_0x5483('0x3a')])){if(_[_0x5483('0x12')](this[_0x5483('0x19')][_0x3e2aae[_0x5483('0x17')]])){this[_0x5483('0x19')][_0x3e2aae[_0x5483('0x17')]]={'routeId':_0x3e2aae['value'],'variables':this[_0x5483('0x3b')][_0x3e2aae[_0x5483('0x17')]]};logger[_0x5483('0x23')](_0x5483('0x3c'),_0x3e2aae[_0x5483('0x17')],_0x3e2aae[_0x5483('0x38')][_0x5483('0x3a')],_['keys'](_0x3e2aae[_0x5483('0x38')])[0x0],_0x3e2aae[_0x5483('0x39')]);logger[_0x5483('0x15')](_0x5483('0x3d'),_0x3e2aae[_0x5483('0x17')],util[_0x5483('0x18')](this['channels'][_0x3e2aae[_0x5483('0x17')]],{'showHidden':![],'depth':null}));this[_0x5483('0x13')]('voice:outbound',_0x5483('0x28'),this[_0x5483('0x19')][_0x3e2aae['uniqueid']]);}}}}catch(_0x4f5360){logger['error'](_0x5483('0x3e'),_0x3e2aae[_0x5483('0x17')],util[_0x5483('0x18')](_0x4f5360,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5483('0x10')]['addVariable']=function(_0x5d2346,_0x414476,_0x4688e7){var _0x53ffa0=['rtpaudioqos',_0x5483('0x3f'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x5483('0x40'),'rtpaudioqoslossbridged',_0x5483('0x41'),_0x5483('0x42'),_0x5483('0x43'),_0x5483('0x44'),_0x5483('0x45'),_0x5483('0x46'),_0x5483('0x47'),_0x5483('0x48'),_0x5483('0x49'),'memberlastcall',_0x5483('0x25'),_0x5483('0x4a'),_0x5483('0x4b')];if(!_[_0x5483('0x4c')](_0x414476)&&!_[_0x5483('0x4d')](_0x53ffa0,_0x414476)){if(_[_0x5483('0x12')](this[_0x5483('0x3b')][_0x5d2346])){this[_0x5483('0x3b')][_0x5d2346]={};}this['variables'][_0x5d2346][_0x414476]=_0x4688e7;}};VoiceDialReport['prototype']['syncHangup']=function(_0x188f3a){try{if(this[_0x5483('0x11')](_0x188f3a)){logger[_0x5483('0x15')]('[%s][voiceDialReport][hangup]\x20event:',_0x188f3a[_0x5483('0x17')],util[_0x5483('0x18')](_0x188f3a,{'showHidden':![],'depth':null}));if(this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]]){logger[_0x5483('0x23')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x188f3a[_0x5483('0x17')],_0x188f3a['cause-txt']);this[_0x5483('0x19')][_0x188f3a['uniqueid']][_0x5483('0x4e')]=moment()[_0x5483('0x1b')](_0x5483('0x1c'));this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]]['duration']=moment(this['channels'][_0x188f3a[_0x5483('0x17')]]['endtime'])[_0x5483('0x4f')](this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]][_0x5483('0x50')],_0x5483('0x51'));this['channels'][_0x188f3a['uniqueid']][_0x5483('0x31')]=_0x5483('0x52');this['outbound'][_0x5483('0x53')]+=0x1;if(this[_0x5483('0x19')][_0x188f3a['uniqueid']][_0x5483('0x30')]){this['outbound']['answered']+=0x1;this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]][_0x5483('0x54')]=moment(this['channels'][_0x188f3a[_0x5483('0x17')]]['answertime'])['diff'](this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]][_0x5483('0x50')],_0x5483('0x51'));this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]][_0x5483('0x55')]=moment(this['channels'][_0x188f3a[_0x5483('0x17')]][_0x5483('0x4e')])[_0x5483('0x4f')](this['channels'][_0x188f3a['uniqueid']][_0x5483('0x30')],_0x5483('0x51'));this['outbound'][_0x5483('0x56')]+=this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]][_0x5483('0x54')]||0x0;this['outbound'][_0x5483('0x57')]+=this['channels'][_0x188f3a[_0x5483('0x17')]][_0x5483('0x55')];}this[_0x5483('0xa')][_0x5483('0x58')]+=this['channels'][_0x188f3a[_0x5483('0x17')]][_0x5483('0x59')];logger['debug'](_0x5483('0x5a'),_0x188f3a[_0x5483('0x17')],util['inspect'](this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5483('0x13')](_0x5483('0x5b'),this['channels'][_0x188f3a[_0x5483('0x17')]]);logger[_0x5483('0x15')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x188f3a[_0x5483('0x17')],util['inspect'](this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]],{'showHidden':![],'depth':null}));ami['emit'](_0x5483('0x5c'),this[_0x5483('0x19')][_0x188f3a['uniqueid']]);logger[_0x5483('0x15')](_0x5483('0x5d'),_0x188f3a[_0x5483('0x17')],util[_0x5483('0x18')](this['channels'][_0x188f3a[_0x5483('0x17')]],{'showHidden':![],'depth':null}));this[_0x5483('0x13')]('voice:outbound','voice_outbound:save',this[_0x5483('0xa')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]]));logger[_0x5483('0x15')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x188f3a[_0x5483('0x17')],util[_0x5483('0x18')](this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]],{'showHidden':![],'depth':null}));this[_0x5483('0x13')]('voice:outbound','voice_outbound_channel:remove',this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]]);delete this[_0x5483('0x19')][_0x188f3a[_0x5483('0x17')]];}else if(this[_0x5483('0x19')][_0x188f3a[_0x5483('0x5e')]]){this[_0x5483('0x19')][_0x188f3a['linkedid']][_0x5483('0x17')]=this[_0x5483('0x19')][_0x188f3a[_0x5483('0x5e')]][_0x5483('0x5f')];}if(this[_0x5483('0x3b')][_0x188f3a[_0x5483('0x17')]]){delete this['variables'][_0x188f3a[_0x5483('0x17')]];}}}catch(_0x17d18a){logger[_0x5483('0x2b')](_0x5483('0x60'),_0x188f3a[_0x5483('0x17')],util[_0x5483('0x18')](_0x17d18a,{'showHidden':![],'depth':null}));}};module[_0x5483('0x61')]=VoiceDialReport; \ No newline at end of file +var _0xb477=['[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','variables','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','channels','uniqueid','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0xb477,0x1be));var _0x7b47=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xb477[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x7b47('0x0'));var moment=require(_0x7b47('0x1'));var util=require(_0x7b47('0x2'));var Redis=require(_0x7b47('0x3'));var config=require(_0x7b47('0x4'));var logger=require(_0x7b47('0x5'))('ami');var ami=require(_0x7b47('0x6'));config[_0x7b47('0x7')]=_[_0x7b47('0x8')](config[_0x7b47('0x7')],{'host':_0x7b47('0x9'),'port':0x18eb});var io=require(_0x7b47('0xa'))(new Redis(config['redis']));function VoiceDialReport(_0x3f499c){this['channels']=_0x3f499c[_0x7b47('0xb')];this['outbound']=_0x3f499c[_0x7b47('0xc')];this['variables']={};ami['on']('dialbegin',this[_0x7b47('0xd')][_0x7b47('0xe')](this));ami['on']('dialend',this[_0x7b47('0xf')]['bind'](this));ami['on'](_0x7b47('0x10'),this[_0x7b47('0x11')][_0x7b47('0xe')](this));ami['on'](_0x7b47('0x12'),this[_0x7b47('0x13')]['bind'](this));}VoiceDialReport[_0x7b47('0x14')]['isNotNull']=function(_0x54ef4d){return _0x54ef4d!==null&&!_[_0x7b47('0x15')](_0x54ef4d);};VoiceDialReport[_0x7b47('0x14')]['emit']=function(_0x47e52e,_0x46c44c,_0x31c182){io['to'](_0x47e52e)[_0x7b47('0x16')](_0x46c44c,_0x31c182);};VoiceDialReport[_0x7b47('0x14')]['syncDialBegin']=function(_0x2f6144){try{if(this[_0x7b47('0x17')](_0x2f6144)){logger[_0x7b47('0x18')](_0x7b47('0x19'),_0x2f6144['uniqueid'],util[_0x7b47('0x1a')](_0x2f6144,{'showHidden':![],'depth':null}));if(this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]]){_['merge'](this['channels'][_0x2f6144['uniqueid']],{'starttime':moment()['format'](_0x7b47('0x1d')),'lastevent':'called','interface':_0x2f6144[_0x7b47('0x1e')][_0x7b47('0x1f')](0x0,_0x2f6144[_0x7b47('0x1e')][_0x7b47('0x20')]('-')),'membername':_0x2f6144[_0x7b47('0x1e')][_0x7b47('0x1f')](_0x2f6144[_0x7b47('0x1e')]['lastIndexOf']('/')+0x1,_0x2f6144[_0x7b47('0x1e')][_0x7b47('0x20')]('-'))},_[_0x7b47('0x21')](_0x2f6144,['event',_0x7b47('0x22')]));logger[_0x7b47('0x23')](_0x7b47('0x24'),_0x2f6144['uniqueid'],this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]][_0x7b47('0x25')],this[_0x7b47('0x1b')][_0x2f6144['uniqueid']][_0x7b47('0x26')]);logger[_0x7b47('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2f6144[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));this[_0x7b47('0x16')](_0x7b47('0x27'),_0x7b47('0x28'),this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]]);logger[_0x7b47('0x18')](_0x7b47('0x29'),_0x2f6144['uniqueid'],util[_0x7b47('0x1a')](this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x7b47('0x16')](_0x7b47('0x2a'),this[_0x7b47('0x1b')][_0x2f6144['uniqueid']]);}}}catch(_0x3fa1a3){logger[_0x7b47('0x2b')](_0x7b47('0x2c'),_0x2f6144[_0x7b47('0x1c')],util[_0x7b47('0x1a')](_0x3fa1a3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b47('0x14')][_0x7b47('0xf')]=function(_0x13914c){try{if(this[_0x7b47('0x17')](_0x13914c)){logger[_0x7b47('0x18')](_0x7b47('0x2d'),_0x13914c[_0x7b47('0x1c')],util[_0x7b47('0x1a')](_0x13914c,{'showHidden':![],'depth':null}));if(this[_0x7b47('0x1b')][_0x13914c['uniqueid']]){this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]]['dialstatus']=_0x13914c['dialstatus'];if(_0x13914c[_0x7b47('0x2e')]===_0x7b47('0x2f')){this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]][_0x7b47('0x30')]=_0x13914c[_0x7b47('0x30')];this[_0x7b47('0x1b')][_0x13914c['uniqueid']][_0x7b47('0x31')]=_0x13914c[_0x7b47('0x31')];this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]][_0x7b47('0x32')]=moment()[_0x7b47('0x33')](_0x7b47('0x1d'));this['channels'][_0x13914c[_0x7b47('0x1c')]][_0x7b47('0x34')]=_0x7b47('0x35');logger['info'](_0x7b47('0x36'),_0x13914c[_0x7b47('0x1c')],_0x13914c[_0x7b47('0x1e')][_0x7b47('0x1f')](_0x13914c[_0x7b47('0x1e')][_0x7b47('0x20')]('/')+0x1,_0x13914c[_0x7b47('0x1e')][_0x7b47('0x20')]('-')));logger[_0x7b47('0x18')](_0x7b47('0x37'),_0x13914c[_0x7b47('0x1c')],util['inspect'](this[_0x7b47('0x1b')][_0x13914c['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x7b47('0x16')](_0x7b47('0x38'),this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]]);}logger[_0x7b47('0x18')](_0x7b47('0x39'),_0x13914c[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));this[_0x7b47('0x16')]('voice:outbound','voice_outbound_channel:save',this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]]);}}}catch(_0x4b66f0){logger['error'](_0x7b47('0x3a'),_0x13914c[_0x7b47('0x1c')],util['inspect'](_0x4b66f0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b47('0x14')][_0x7b47('0x11')]=function(_0x369a6){try{if(this[_0x7b47('0x17')](_0x369a6)){logger['debug'](_0x7b47('0x3b'),_0x369a6[_0x7b47('0x1c')],util['inspect'](_0x369a6,{'showHidden':![],'depth':null}));this[_0x7b47('0x3c')](_0x369a6[_0x7b47('0x1c')],_[_0x7b47('0x3d')](_0x369a6[_0x7b47('0x3e')])[0x0],_0x369a6[_0x7b47('0x3f')]);if(this['isNotNull'](_0x369a6[_0x7b47('0x3e')])&&this[_0x7b47('0x17')](_0x369a6[_0x7b47('0x3e')]['outboundrouteid'])){if(_[_0x7b47('0x15')](this[_0x7b47('0x1b')][_0x369a6['uniqueid']])){this['channels'][_0x369a6['uniqueid']]={'routeId':_0x369a6[_0x7b47('0x3f')],'variables':this['variables'][_0x369a6['uniqueid']]};logger['info'](_0x7b47('0x40'),_0x369a6[_0x7b47('0x1c')],_0x369a6[_0x7b47('0x3e')]['outboundrouteid'],_[_0x7b47('0x3d')](_0x369a6['variable'])[0x0],_0x369a6['value']);logger[_0x7b47('0x18')](_0x7b47('0x41'),_0x369a6['uniqueid'],util['inspect'](this[_0x7b47('0x1b')][_0x369a6[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));this[_0x7b47('0x16')]('voice:outbound',_0x7b47('0x28'),this[_0x7b47('0x1b')][_0x369a6[_0x7b47('0x1c')]]);}}}}catch(_0x3c7b73){logger[_0x7b47('0x2b')](_0x7b47('0x42'),_0x369a6[_0x7b47('0x1c')],util[_0x7b47('0x1a')](_0x3c7b73,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b47('0x14')][_0x7b47('0x3c')]=function(_0x499cbf,_0x5dd2cb,_0x2f948b){var _0xaced59=[_0x7b47('0x43'),_0x7b47('0x44'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x7b47('0x45'),_0x7b47('0x46'),_0x7b47('0x47'),_0x7b47('0x48'),_0x7b47('0x49'),_0x7b47('0x4a'),_0x7b47('0x4b'),'bridgepvtcallid',_0x7b47('0x4c'),_0x7b47('0x4d'),_0x7b47('0x4e'),'memberlastcall',_0x7b47('0x25'),'memberpenalty',_0x7b47('0x4f')];if(!_[_0x7b47('0x50')](_0x5dd2cb)&&!_[_0x7b47('0x51')](_0xaced59,_0x5dd2cb)){if(_['isUndefined'](this['variables'][_0x499cbf])){this['variables'][_0x499cbf]={};}this['variables'][_0x499cbf][_0x5dd2cb]=_0x2f948b;}};VoiceDialReport[_0x7b47('0x14')][_0x7b47('0x13')]=function(_0x110891){try{if(this[_0x7b47('0x17')](_0x110891)){logger[_0x7b47('0x18')](_0x7b47('0x52'),_0x110891['uniqueid'],util[_0x7b47('0x1a')](_0x110891,{'showHidden':![],'depth':null}));if(this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]){logger[_0x7b47('0x23')](_0x7b47('0x53'),_0x110891[_0x7b47('0x1c')],_0x110891[_0x7b47('0x54')]);this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x55')]=moment()[_0x7b47('0x33')](_0x7b47('0x1d'));this['channels'][_0x110891['uniqueid']][_0x7b47('0x56')]=moment(this['channels'][_0x110891[_0x7b47('0x1c')]]['endtime'])[_0x7b47('0x57')](this['channels'][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x58')],_0x7b47('0x59'));this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x34')]='complete';this[_0x7b47('0xc')][_0x7b47('0x5a')]+=0x1;if(this[_0x7b47('0x1b')][_0x110891['uniqueid']]['answertime']){this[_0x7b47('0xc')][_0x7b47('0x5b')]+=0x1;this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x5c')]=moment(this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x32')])[_0x7b47('0x57')](this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]['starttime'],_0x7b47('0x59'));this['channels'][_0x110891['uniqueid']][_0x7b47('0x5d')]=moment(this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x55')])[_0x7b47('0x57')](this['channels'][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x32')],_0x7b47('0x59'));this['outbound'][_0x7b47('0x5e')]+=this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x5c')]||0x0;this['outbound'][_0x7b47('0x5f')]+=this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]['billableseconds'];}this[_0x7b47('0xc')][_0x7b47('0x60')]+=this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x56')];logger['debug'](_0x7b47('0x61'),_0x110891[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this['channels'][_0x110891[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x7b47('0x16')](_0x7b47('0x62'),this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]);logger[_0x7b47('0x18')](_0x7b47('0x63'),_0x110891[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]);logger[_0x7b47('0x18')](_0x7b47('0x64'),_0x110891['uniqueid'],util['inspect'](this[_0x7b47('0x1b')][_0x110891['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x7b47('0x27'),'voice_outbound:save',this[_0x7b47('0xc')]);logger[_0x7b47('0x23')](_0x7b47('0x65'),JSON[_0x7b47('0x66')](this['channels'][_0x110891[_0x7b47('0x1c')]]));logger[_0x7b47('0x18')](_0x7b47('0x67'),_0x110891[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this['channels'][_0x110891[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x7b47('0x27'),_0x7b47('0x68'),this[_0x7b47('0x1b')][_0x110891['uniqueid']]);delete this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]];}else if(this['channels'][_0x110891[_0x7b47('0x69')]]){this[_0x7b47('0x1b')][_0x110891['linkedid']][_0x7b47('0x1c')]=this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x69')]][_0x7b47('0x6a')];}if(this['variables'][_0x110891['uniqueid']]){delete this[_0x7b47('0x6b')][_0x110891[_0x7b47('0x1c')]];}}}catch(_0x51cd05){logger[_0x7b47('0x2b')]('[%s][voiceDialReport][hangup]',_0x110891[_0x7b47('0x1c')],util['inspect'](_0x51cd05,{'showHidden':![],'depth':null}));}};module[_0x7b47('0x6c')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index ed55429..4486e3c 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ccd=['queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','Action','catch','message','error','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','voice_queue_channel:save','emitVoiceQueueChannelRemove','debug','name','type','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isUndefined','queues','queuesummary','then','[voiceQueueReport][queuesummary]','syncQueueSummary','isNotNull','queue','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','uniqueid','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexit','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','channel','local/','linkedid','queuecallerexitAt','add','seconds','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','variable','value','queuestatus','lastevent','timeout','custom:timeout','queuecallerabandonAt','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberrealtime','includes','[%s][voiceQueueReport][hangup]','diff','milliseconds','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','exports','lodash','util','md5','../../../config/logger','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon'];(function(_0x54fb4b,_0x1e4ea0){var _0x3828d8=function(_0x3d50fb){while(--_0x3d50fb){_0x54fb4b['push'](_0x54fb4b['shift']());}};_0x3828d8(++_0x1e4ea0);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd9cc('0x0'));var moment=require('moment');var util=require(_0xd9cc('0x1'));var md5=require(_0xd9cc('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xd9cc('0x3'))('ami');var ami=require(_0xd9cc('0x4'));var QueueReport=require(_0xd9cc('0x5'));config[_0xd9cc('0x6')]=_[_0xd9cc('0x7')](config[_0xd9cc('0x6')],{'host':_0xd9cc('0x8'),'port':0x18eb});var io=require(_0xd9cc('0x9'))(new Redis(config[_0xd9cc('0x6')]));var Sequence=function(){};Sequence[_0xd9cc('0xa')][_0xd9cc('0xb')]=function(_0x20282c){this[_0xd9cc('0xc')]=this[_0xd9cc('0xc')]?this[_0xd9cc('0xc')][_0xd9cc('0xd')](_0x20282c):_0x20282c();};function VoiceQueueReport(_0x383bd4){this['sequence']=new Sequence();this[_0xd9cc('0xe')]={};this[_0xd9cc('0xf')]=_0x383bd4[_0xd9cc('0xf')];this[_0xd9cc('0x10')]=_0x383bd4[_0xd9cc('0x11')];this[_0xd9cc('0x12')]=_0x383bd4[_0xd9cc('0x12')];this[_0xd9cc('0x13')]=!![];this['campaigns']=_0x383bd4[_0xd9cc('0x14')];this['variables']={};ami['on']('queuesummary',this['syncQueueSummary']['bind'](this));ami['on']('queuesummarycomplete',this[_0xd9cc('0x15')][_0xd9cc('0x16')](this));ami['on'](_0xd9cc('0x17'),this[_0xd9cc('0x18')][_0xd9cc('0x16')](this));ami['on'](_0xd9cc('0x19'),this[_0xd9cc('0x1a')]['bind'](this));ami['on'](_0xd9cc('0x1b'),this[_0xd9cc('0x1c')]['bind'](this));ami['on'](_0xd9cc('0x1d'),this[_0xd9cc('0x1e')][_0xd9cc('0x16')](this));ami['on'](_0xd9cc('0x1f'),this['syncAgentConnect'][_0xd9cc('0x16')](this));ami['on'](_0xd9cc('0x20'),this['syncVarSet'][_0xd9cc('0x16')](this));ami['on'](_0xd9cc('0x21'),this[_0xd9cc('0x22')][_0xd9cc('0x16')](this));ami['on'](_0xd9cc('0x23'),this[_0xd9cc('0x24')]['bind'](this));ami['on']('musiconholdstart',this[_0xd9cc('0x25')][_0xd9cc('0x16')](this));ami['on'](_0xd9cc('0x26'),this[_0xd9cc('0x27')][_0xd9cc('0x16')](this));ami['on'](_0xd9cc('0x28'),this[_0xd9cc('0x29')][_0xd9cc('0x16')](this));ami['on'](_0xd9cc('0x2a'),this[_0xd9cc('0x2b')][_0xd9cc('0x16')](this));this[_0xd9cc('0x2c')]();this[_0xd9cc('0x2d')]();}function clearChannels(_0x35fb49){if(!_['isEmpty'](_0x35fb49)){for(var _0xc74622 in _0x35fb49){if(_0x35fb49[_0xd9cc('0x2e')](_0xc74622)){delete _0x35fb49[_0xc74622];}}}}function clearCampaigns(_0x5e913b){if(!_[_0xd9cc('0x2f')](_0x5e913b)){for(var _0x1f2727 in _0x5e913b){if(_0x5e913b[_0xd9cc('0x2e')](_0x1f2727)){_0x5e913b[_0x1f2727][_0xd9cc('0x30')]=0x0;}}}}function clearVoiceQueues(_0x3dff40){if(!_[_0xd9cc('0x2f')](_0x3dff40)){for(var _0x13a163 in _0x3dff40){if(_0x3dff40[_0xd9cc('0x2e')](_0x13a163)){_0x3dff40[_0x13a163][_0xd9cc('0x30')]=0x0;_0x3dff40[_0x13a163]['talking']=0x0;_0x3dff40[_0x13a163][_0xd9cc('0x31')]=0x0;_0x3dff40[_0x13a163][_0xd9cc('0x32')]=0x0;_0x3dff40[_0x13a163][_0xd9cc('0x33')]=!![];}}}}function clearAgentBooked(_0x381b83){if(!_[_0xd9cc('0x2f')](_0x381b83)){for(var _0xef1497 in _0x381b83){if(_0x381b83[_0xd9cc('0x2e')](_0xef1497)){_0x381b83[_0xef1497][_0xd9cc('0x34')]=!![];}}}}VoiceQueueReport['prototype'][_0xd9cc('0x35')]=function(){var _0x2369e4=this;for(var _0x42d185 in this[_0xd9cc('0x10')]){if(this[_0xd9cc('0x10')][_0xd9cc('0x2e')](_0x42d185)&&!this['channels'][_0x42d185][_0xd9cc('0x36')]){this['sequence']['enqueue'](function(){if(!_[_0xd9cc('0x37')](_0x2369e4[_0xd9cc('0x10')][_0x42d185])){return ami[_0xd9cc('0x38')]({'action':'status','channel':_0x2369e4[_0xd9cc('0x10')][_0x42d185]['channel']})[_0xd9cc('0x39')](function(_0x9e35d2){if(_0x9e35d2[_0xd9cc('0x3a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2369e4[_0xd9cc('0x10')][_0x42d185]){delete _0x2369e4[_0xd9cc('0x10')][_0x42d185];logger[_0xd9cc('0x3b')]('[%s][voiceQueueReport][checkChannel]',_0x42d185,util[_0xd9cc('0x3c')](_0x9e35d2,{'showHidden':![],'depth':null}));}if(_0x2369e4[_0xd9cc('0xe')][_0x42d185]){delete _0x2369e4[_0xd9cc('0xe')][_0x42d185];logger[_0xd9cc('0x3b')](_0xd9cc('0x3d'),_0x42d185,util[_0xd9cc('0x3c')](_0x9e35d2,{'showHidden':![],'depth':null}));}if(_0x2369e4[_0xd9cc('0x3e')][_0x42d185]){delete _0x2369e4['variables'][_0x42d185];logger[_0xd9cc('0x3b')](_0xd9cc('0x3f'),_0x42d185,util[_0xd9cc('0x3c')](_0x9e35d2,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xd9cc('0x24')]=function(){logger[_0xd9cc('0x3b')](_0xd9cc('0x40'));clearChannels(this[_0xd9cc('0x10')]);this['clearQueueReport'](this[_0xd9cc('0xe')]);clearAgentBooked(this[_0xd9cc('0xf')]);clearVoiceQueues(this[_0xd9cc('0x12')]);clearCampaigns(this[_0xd9cc('0x14')]);};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x41')]=function(_0x4261e5){var _0x105815=this;if(!_[_0xd9cc('0x2f')](_0x4261e5)){for(var _0x1b27e6 in _0x4261e5){if(_0x4261e5[_0xd9cc('0x2e')](_0x1b27e6)){_0x105815['emitVoiceQueueChannelRemove'](_0x4261e5[_0x1b27e6],_0xd9cc('0x42'));delete _0x4261e5[_0x1b27e6];}}}};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x43')]=function(_0x1667c3,_0x171e49,_0x2e5e71){io['to'](_0x1667c3)['emit'](_0x171e49,_0x2e5e71);};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x44')]=function(_0x18fa2c,_0x191e6d){logger['debug'](_0xd9cc('0x45')+_0x191e6d+_0xd9cc('0x46'),_0x18fa2c['uniqueid'],util[_0xd9cc('0x3c')](_0x18fa2c,{'showHidden':![],'depth':null}));this[_0xd9cc('0x43')](util[_0xd9cc('0x47')](_0xd9cc('0x48'),_0x18fa2c['name']),_0xd9cc('0x49'),_0x18fa2c);};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x4a')]=function(_0x19b71f,_0x3e7090){logger[_0xd9cc('0x4b')]('[%s][voiceQueueReport]['+_0x3e7090+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x19b71f['uniqueid'],util[_0xd9cc('0x3c')](_0x19b71f,{'showHidden':![],'depth':null}));this['emit'](util['format']('voice:queue:%s',_0x19b71f[_0xd9cc('0x4c')]),'voice_queue_channel:remove',_0x19b71f);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0x42d105,_0x1ffdd5){if(_0x42d105[_0xd9cc('0x4d')]==='inbound'){var _0x4eeb9d={'id':_0x42d105['id'],'name':_0x42d105[_0xd9cc('0x4c')],'strategy':_0x42d105[_0xd9cc('0x4e')],'answered':_0x42d105[_0xd9cc('0x4f')],'available':_0x42d105[_0xd9cc('0x50')],'loggedIn':_0x42d105[_0xd9cc('0x51')],'pTalking':_0x42d105[_0xd9cc('0x31')],'sumBillable':_0x42d105[_0xd9cc('0x52')],'sumDuration':_0x42d105[_0xd9cc('0x53')],'sumHoldTime':_0x42d105[_0xd9cc('0x54')]||0x0,'talking':_0x42d105[_0xd9cc('0x55')],'total':_0x42d105[_0xd9cc('0x56')],'type':_0x42d105[_0xd9cc('0x4d')],'unmanaged':_0x42d105[_0xd9cc('0x57')],'abandoned':_0x42d105[_0xd9cc('0x58')],'waiting':_0x42d105['waiting']};if(_0x42d105[_0xd9cc('0x59')]){_0x4eeb9d[_0xd9cc('0x59')]={'id':_0x42d105[_0xd9cc('0x59')]['id'],'name':_0x42d105[_0xd9cc('0x59')]['name'],'active':_0x42d105[_0xd9cc('0x59')][_0xd9cc('0x5a')],'callerid':_0x42d105['Trunk'][_0xd9cc('0x5b')]};}if(_0x42d105[_0xd9cc('0x5c')]){_0x4eeb9d[_0xd9cc('0x5c')]={'id':_0x42d105['Interval']['id'],'name':_0x42d105[_0xd9cc('0x5c')][_0xd9cc('0x4c')]};}var _0x544a43=md5(JSON[_0xd9cc('0x5d')](_0x4eeb9d));if(_0x42d105['md5']!==_0x544a43){_0x42d105[_0xd9cc('0x2')]=_0x544a43;logger['debug'](_0xd9cc('0x5e')+_0x1ffdd5+_0xd9cc('0x5f'),util[_0xd9cc('0x3c')](_0x4eeb9d,{'showHidden':![],'depth':null}));this[_0xd9cc('0x43')](util[_0xd9cc('0x47')](_0xd9cc('0x48'),_0x4eeb9d[_0xd9cc('0x4c')]),_0xd9cc('0x60'),_0x4eeb9d);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x2b8f00){return _0x2b8f00!==null&&!_[_0xd9cc('0x61')](_0x2b8f00);};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x2d')]=function(){var _0x42bbd8=this;setInterval(function(){_0x42bbd8[_0xd9cc('0x35')]();ami[_0xd9cc('0x38')]({'action':_0xd9cc('0x62')})[_0xd9cc('0x39')](function(_0x28db6c){logger[_0xd9cc('0x3b')]('[voiceQueueReport][queues]',util['inspect'](_0x28db6c,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xd9cc('0xa')]['loopQueueSummary']=function(){var _0x39900a=this;setInterval(function(){if(_0x39900a['flagQueueSummary']){return ami['Action']({'action':_0xd9cc('0x63')})[_0xd9cc('0x64')](function(_0x38e80a){_0x39900a[_0xd9cc('0x13')]=![];})[_0xd9cc('0x39')](function(_0x3af8fb){logger[_0xd9cc('0x3b')](_0xd9cc('0x65'),util['inspect'](_0x3af8fb,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x66')]=function(_0x51565f){try{if(this[_0xd9cc('0x67')](_0x51565f)&&this[_0xd9cc('0x67')](_0x51565f[_0xd9cc('0x68')])){logger[_0xd9cc('0x4b')](_0xd9cc('0x69'),util['inspect'](_0x51565f,{'showHidden':![],'depth':null}));if(this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]]){logger['info'](_0xd9cc('0x6a'),_0x51565f[_0xd9cc('0x68')]);var _0x551dad=_[_0xd9cc('0x6b')](this[_0xd9cc('0x10')],_0xd9cc('0x68'))[_0x51565f[_0xd9cc('0x68')]]||0x0;var _0x508166=_0x551dad-_0x51565f[_0xd9cc('0x6c')];if(this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]][_0xd9cc('0x32')]!==_[_0xd9cc('0x6d')](_0x51565f[_0xd9cc('0x6c')])||this['voiceQueues'][_0x51565f[_0xd9cc('0x68')]][_0xd9cc('0x51')]!==_[_0xd9cc('0x6d')](_0x51565f['loggedin'])||this['voiceQueues'][_0x51565f[_0xd9cc('0x68')]][_0xd9cc('0x50')]!==_['toNumber'](_0x51565f[_0xd9cc('0x50')])||this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]][_0xd9cc('0x55')]!==_0x508166){this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]][_0xd9cc('0x32')]=_[_0xd9cc('0x6d')](_0x51565f[_0xd9cc('0x6c')]);this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]][_0xd9cc('0x51')]=_[_0xd9cc('0x6d')](_0x51565f[_0xd9cc('0x6e')]);this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]]['available']=_[_0xd9cc('0x6d')](_0x51565f[_0xd9cc('0x50')]);this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]][_0xd9cc('0x55')]=_0x508166>0x0?_0x508166:0x0;this[_0xd9cc('0x12')][_0x51565f['queue']]['talking']=this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]]['talking']>_['toNumber'](_0x51565f[_0xd9cc('0x6e')])?_['toNumber'](_0x51565f[_0xd9cc('0x6e')]):this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]][_0xd9cc('0x55')];this[_0xd9cc('0x6f')](this[_0xd9cc('0x12')][_0x51565f['queue']],_0xd9cc('0x63'));}logger[_0xd9cc('0x4b')](_0xd9cc('0x70'),util[_0xd9cc('0x3c')](this['voiceQueues'][_0x51565f[_0xd9cc('0x68')]],{'showHidden':![],'depth':null}));ami[_0xd9cc('0x43')]('custom:queuesummary',this[_0xd9cc('0x12')][_0x51565f[_0xd9cc('0x68')]]);}}}catch(_0x426dd2){logger[_0xd9cc('0x3b')](_0xd9cc('0x65'),util[_0xd9cc('0x3c')](_0x426dd2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x15')]=function(_0x313c37){logger[_0xd9cc('0x4b')](_0xd9cc('0x71'),util['inspect'](_0x313c37,{'showHidden':![],'depth':null}));this[_0xd9cc('0x13')]=!![];};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x18')]=function(_0x140623){try{if(this['isNotNull'](_0x140623)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x140623[_0xd9cc('0x72')],util[_0xd9cc('0x3c')](_0x140623,{'showHidden':![],'depth':null}));if(_[_0xd9cc('0x61')](this[_0xd9cc('0xe')][_0x140623[_0xd9cc('0x72')]])){this['queueReports'][_0x140623['uniqueid']]=[];this[_0xd9cc('0x10')][_0x140623[_0xd9cc('0x72')]]={};}var _0x180480=new QueueReport();_0x180480[_0xd9cc('0x4c')]=_0x140623[_0xd9cc('0x68')];_0x180480['type']=this[_0xd9cc('0x12')][_0x180480[_0xd9cc('0x4c')]]&&this['voiceQueues'][_0x180480['name']][_0xd9cc('0x4d')]?this[_0xd9cc('0x12')][_0x180480['name']][_0xd9cc('0x4d')]||_0xd9cc('0x73'):_0xd9cc('0x73');_0x180480[_0xd9cc('0x68')]=_0x140623[_0xd9cc('0x68')];_0x180480[_0xd9cc('0x74')]=moment()[_0xd9cc('0x47')](_0xd9cc('0x75'));_0x180480[_0xd9cc('0x76')]=_0x140623['position'];_0x180480[_0xd9cc('0x77')]=_0x140623[_0xd9cc('0x77')];_0x180480[_0xd9cc('0x72')]=_0x140623['uniqueid'];logger[_0xd9cc('0x78')](_0xd9cc('0x79'),_0x180480[_0xd9cc('0x4c')],_0x180480[_0xd9cc('0x4d')]);_[_0xd9cc('0x7a')](_0x180480,_[_0xd9cc('0x7b')](_0x140623,_[_0xd9cc('0x7c')](_0x180480)));this[_0xd9cc('0xe')][_0x140623[_0xd9cc('0x72')]]['push'](_0x180480);this['channels'][_0x140623['uniqueid']]=_0x180480;this[_0xd9cc('0x44')](_0x180480,_0xd9cc('0x17'));}}catch(_0x4cde02){logger[_0xd9cc('0x3b')](_0xd9cc('0x7d'),_0x140623[_0xd9cc('0x72')],util[_0xd9cc('0x3c')](_0x4cde02,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x1a')]=function(_0x3166d6){try{if(this[_0xd9cc('0x67')](_0x3166d6)){logger[_0xd9cc('0x4b')](_0xd9cc('0x7e'),_0x3166d6['uniqueid'],util['inspect'](_0x3166d6,{'showHidden':![],'depth':null}));if(this[_0xd9cc('0xe')][_0x3166d6[_0xd9cc('0x72')]]){var _0x42db8a=_[_0xd9cc('0x7f')](this['queueReports'][_0x3166d6[_0xd9cc('0x72')]]);_0x42db8a[_0xd9cc('0x80')]=![];_0x42db8a['queuecallercompleteAt']=null;_0x42db8a[_0xd9cc('0x81')]=_0x3166d6[_0xd9cc('0x81')];_0x42db8a[_0xd9cc('0x82')]=_0x3166d6[_0xd9cc('0x82')];_0x42db8a[_0xd9cc('0x19')]=!![];_0x42db8a['queuecallerabandonAt']=moment()[_0xd9cc('0x47')](_0xd9cc('0x75'));_0x42db8a[_0xd9cc('0x83')]=_0xd9cc('0x84');_0x42db8a[_0xd9cc('0x85')]=null;logger['info'](_0xd9cc('0x86'),_0x42db8a[_0xd9cc('0x4c')],_0x42db8a[_0xd9cc('0x4d')]);this[_0xd9cc('0x10')][_0x3166d6[_0xd9cc('0x72')]]=_0x42db8a;this[_0xd9cc('0x4a')](_0x42db8a,_0xd9cc('0x19'));}}}catch(_0x240387){logger['error'](_0xd9cc('0x7e'),_0x3166d6['uniqueid'],util['inspect'](_0x240387,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x1c')]=function(_0x25f4b3){try{if(this[_0xd9cc('0x67')](_0x25f4b3)){logger[_0xd9cc('0x4b')](_0xd9cc('0x87'),_0x25f4b3[_0xd9cc('0x72')],util[_0xd9cc('0x3c')](_0x25f4b3,{'showHidden':![],'depth':null}));if(this[_0xd9cc('0xe')][_0x25f4b3[_0xd9cc('0x72')]]){var _0x271c1f=_[_0xd9cc('0x7f')](this['queueReports'][_0x25f4b3[_0xd9cc('0x72')]]);_0x271c1f[_0xd9cc('0x88')]=moment()['format'](_0xd9cc('0x75'));_0x271c1f[_0xd9cc('0x89')]=_0x25f4b3[_0xd9cc('0x89')];_0x271c1f[_0xd9cc('0x8a')]=_0x25f4b3[_0xd9cc('0x8a')];logger['info'](_0xd9cc('0x8b'),_0x271c1f['name'],_0x271c1f[_0xd9cc('0x4d')],_0x25f4b3['connectedlinenum'],_0x25f4b3['connectedlinename']);this[_0xd9cc('0x10')][_0x25f4b3['uniqueid']]=_0x271c1f;this[_0xd9cc('0x44')](_0x271c1f,_0xd9cc('0x1b'));}}}catch(_0x1d1401){logger[_0xd9cc('0x3b')](_0xd9cc('0x87'),_0x25f4b3[_0xd9cc('0x72')],util['inspect'](_0x1d1401,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x138fe2){try{if(this[_0xd9cc('0x67')](_0x138fe2)){logger[_0xd9cc('0x4b')](_0xd9cc('0x8c'),_0x138fe2[_0xd9cc('0x72')],util['inspect'](_0x138fe2,{'showHidden':![],'depth':null}));if(this[_0xd9cc('0xe')][_0x138fe2[_0xd9cc('0x72')]]){var _0x3d90d5=_[_0xd9cc('0x7f')](this[_0xd9cc('0xe')][_0x138fe2[_0xd9cc('0x72')]]);_0x3d90d5[_0xd9cc('0x80')]=!![];_0x3d90d5['queuecallerexitreason']=_0xd9cc('0x8d');logger[_0xd9cc('0x78')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3d90d5[_0xd9cc('0x4c')],_0x3d90d5['type']);}}}catch(_0x54fbe7){logger[_0xd9cc('0x3b')](_0xd9cc('0x8c'),_0x138fe2[_0xd9cc('0x72')],util[_0xd9cc('0x3c')](_0x54fbe7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x1e')]=function(_0x46c2ff){try{if(this['isNotNull'](_0x46c2ff)){logger[_0xd9cc('0x4b')](_0xd9cc('0x8e'),_0x46c2ff[_0xd9cc('0x72')],util['inspect'](_0x46c2ff,{'showHidden':![],'depth':null}));if(this[_0xd9cc('0xe')][_0x46c2ff[_0xd9cc('0x72')]]){var _0x4de625=_['last'](this['queueReports'][_0x46c2ff['uniqueid']]);_0x4de625['queuecallerabandon']=![];_0x4de625['queuecallerabandonAt']=null;_0x4de625[_0xd9cc('0x8f')]=!![];_0x4de625[_0xd9cc('0x85')]=_0x46c2ff['membername'];_0x4de625[_0xd9cc('0x81')]=_0x46c2ff[_0xd9cc('0x81')];_0x4de625['queuecallercomplete']=!![];_0x4de625[_0xd9cc('0x90')]=![];_0x4de625['queuecallerexitAt']=null;if(!_0x4de625[_0xd9cc('0x91')]){if(_0x46c2ff['reason']==_0xd9cc('0x91')){_0x4de625[_0xd9cc('0x83')]=_0xd9cc('0x92');logger[_0xd9cc('0x78')](_0xd9cc('0x93'),_0x4de625[_0xd9cc('0x4c')],_0x4de625[_0xd9cc('0x4d')]);}else{if(_['startsWith'](_0x46c2ff[_0xd9cc('0x94')]['toLowerCase'](),_0xd9cc('0x95'))){if(this['queueReports'][_0x46c2ff[_0xd9cc('0x96')]]){var _0x1d32d6=_[_0xd9cc('0x7f')](this[_0xd9cc('0xe')][_0x46c2ff[_0xd9cc('0x96')]]);_0x1d32d6['queuecallercomplete']=![];_0x1d32d6[_0xd9cc('0x90')]=!![];_0x1d32d6[_0xd9cc('0x97')]=moment(_0x4de625[_0xd9cc('0x74')])[_0xd9cc('0x98')](_0x46c2ff[_0xd9cc('0x81')],_0xd9cc('0x99'))['format'](_0xd9cc('0x75'));_0x1d32d6[_0xd9cc('0x83')]='FORWARDTRANSFER';_0x1d32d6[_0xd9cc('0x91')]=!![];_0x1d32d6[_0xd9cc('0x9a')]=_0xd9cc('0x9b');_0x1d32d6[_0xd9cc('0x9c')]=_0x46c2ff[_0xd9cc('0x9d')];_0x1d32d6[_0xd9cc('0x9e')]=_0x46c2ff[_0xd9cc('0x72')];logger['info'](_0xd9cc('0x9f'),_0x1d32d6['name'],_0x1d32d6['type']);var _0x5cf002=this[_0xd9cc('0xe')][_0x46c2ff[_0xd9cc('0x96')]];this[_0xd9cc('0xe')][_0x46c2ff[_0xd9cc('0x96')]]=this[_0xd9cc('0xe')][_0x46c2ff[_0xd9cc('0x72')]];this[_0xd9cc('0xe')][_0x46c2ff[_0xd9cc('0x72')]]=_0x5cf002;}}else{_0x4de625['queuecallerexitreason']=_0xd9cc('0xa0')+_0x46c2ff[_0xd9cc('0xa1')][_0xd9cc('0xa2')]();logger[_0xd9cc('0x78')](_0xd9cc('0xa3'),_0x4de625[_0xd9cc('0x4c')],_0x4de625['type'],_0x4de625[_0xd9cc('0x83')]);}}}this[_0xd9cc('0x10')][_0x46c2ff[_0xd9cc('0x72')]]=_0x4de625;this[_0xd9cc('0x4a')](_0x4de625,_0xd9cc('0x1d'));}}}catch(_0x261e46){logger['error'](_0xd9cc('0x8e'),_0x46c2ff['uniqueid'],util[_0xd9cc('0x3c')](_0x261e46,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0xa4')]=function(_0x2273cf){try{if(this[_0xd9cc('0x67')](_0x2273cf)){logger['debug'](_0xd9cc('0xa5'),_0x2273cf[_0xd9cc('0x72')],util['inspect'](_0x2273cf,{'showHidden':![],'depth':null}));this['addVariable'](_0x2273cf[_0xd9cc('0x72')],_['keys'](_0x2273cf[_0xd9cc('0xa6')])[0x0],_0x2273cf[_0xd9cc('0xa7')]);if(this['queueReports'][_0x2273cf[_0xd9cc('0x72')]]){var _0x253f58=_[_0xd9cc('0x7f')](this[_0xd9cc('0xe')][_0x2273cf[_0xd9cc('0x72')]]);if(_0x253f58){if(this[_0xd9cc('0x67')](_0x2273cf['variable'])&&this['isNotNull'](_0x2273cf[_0xd9cc('0xa6')][_0xd9cc('0xa8')])){switch(_0x2273cf['value']){case'CONTINUE':_0x253f58[_0xd9cc('0x90')]=![];_0x253f58[_0xd9cc('0x97')]=null;break;case'TIMEOUT':_0x253f58[_0xd9cc('0xa9')]=_0xd9cc('0xaa');_0x253f58[_0xd9cc('0x90')]=!![];_0x253f58[_0xd9cc('0x97')]=moment()['format'](_0xd9cc('0x75'));_0x253f58[_0xd9cc('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x2273cf[_0xd9cc('0x72')],util[_0xd9cc('0x3c')](_0x253f58,{'showHidden':![],'depth':null}));ami[_0xd9cc('0x43')](_0xd9cc('0xab'),_0x253f58);break;default:_0x253f58[_0xd9cc('0x90')]=!![];_0x253f58[_0xd9cc('0x97')]=moment()[_0xd9cc('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x253f58[_0xd9cc('0x88')]=moment()[_0xd9cc('0x47')](_0xd9cc('0x75'));}_0x253f58[_0xd9cc('0x19')]=![];_0x253f58[_0xd9cc('0xac')]=null;_0x253f58['queuecallerexitreason']=_0x2273cf['value'];this[_0xd9cc('0x10')][_0x2273cf[_0xd9cc('0x72')]]=_0x253f58;this['emitVoiceQueueChannelRemove'](_0x253f58,_0xd9cc('0x20'));}else if(this[_0xd9cc('0x67')](_0x2273cf[_0xd9cc('0xa6')])&&this[_0xd9cc('0x67')](_0x2273cf[_0xd9cc('0xa6')][_0xd9cc('0xad')])){if(!_0x253f58['queuecallerabandon']){_0x253f58[_0xd9cc('0x90')]=!![];_0x253f58['queuecallerexitAt']=moment()[_0xd9cc('0x47')](_0xd9cc('0x75'));_0x253f58['queuecallerexitreason']=_0xd9cc('0xae');_0x253f58[_0xd9cc('0x88')]=moment()[_0xd9cc('0x47')](_0xd9cc('0x75'));this['channels'][_0x2273cf[_0xd9cc('0x72')]]=_0x253f58;}}logger[_0xd9cc('0x78')](_0xd9cc('0xaf'),_0x2273cf['uniqueid'],_0x253f58[_0xd9cc('0x4c')],_0x253f58[_0xd9cc('0x4d')],_['keys'](_0x2273cf[_0xd9cc('0xa6')])[0x0],_0x2273cf[_0xd9cc('0xa7')]);_0x253f58[_0xd9cc('0x3e')]=this[_0xd9cc('0x3e')][_0x2273cf[_0xd9cc('0x72')]];}}}}catch(_0x1add96){logger[_0xd9cc('0x3b')](_0xd9cc('0xa5'),_0x2273cf[_0xd9cc('0x72')],util[_0xd9cc('0x3c')](_0x1add96,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd9cc('0xa')]['addVariable']=function(_0x5214b2,_0x37556f,_0x4b5de7){var _0x22c0a4=[_0xd9cc('0xb0'),'rtpaudioqosbridged',_0xd9cc('0xb1'),_0xd9cc('0xb2'),_0xd9cc('0xb3'),_0xd9cc('0xb4'),_0xd9cc('0xb5'),_0xd9cc('0xb6'),_0xd9cc('0xb7'),'sipuri',_0xd9cc('0xb8'),_0xd9cc('0xb9'),_0xd9cc('0xba'),_0xd9cc('0xbb'),_0xd9cc('0xbc'),_0xd9cc('0xbd'),_0xd9cc('0xbe'),'memberpenalty',_0xd9cc('0xbf')];if(!_[_0xd9cc('0x37')](_0x37556f)&&!_[_0xd9cc('0xc0')](_0x22c0a4,_0x37556f)){if(_['isUndefined'](this[_0xd9cc('0x3e')][_0x5214b2])){this['variables'][_0x5214b2]={};}this['variables'][_0x5214b2][_0x37556f]=_0x4b5de7;}};VoiceQueueReport[_0xd9cc('0xa')][_0xd9cc('0x22')]=function(_0x47ad59){try{if(this[_0xd9cc('0x67')](_0x47ad59)){logger[_0xd9cc('0x4b')](_0xd9cc('0xc1'),_0x47ad59[_0xd9cc('0x72')],util['inspect'](_0x47ad59,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x47ad59[_0xd9cc('0x72')]]){for(var _0x5c5e03=0x0,_0x48b288={};_0x5c5e030x0?_0x299710:0x0;this['voiceQueues'][_0x97f9f7['queue']][_0x9726('0x31')]=this['voiceQueues'][_0x97f9f7[_0x9726('0x69')]][_0x9726('0x31')]>_[_0x9726('0x6e')](_0x97f9f7['loggedin'])?_[_0x9726('0x6e')](_0x97f9f7[_0x9726('0x70')]):this[_0x9726('0x13')][_0x97f9f7[_0x9726('0x69')]][_0x9726('0x31')];this[_0x9726('0x4f')](this['voiceQueues'][_0x97f9f7[_0x9726('0x69')]],_0x9726('0x16'));}logger[_0x9726('0x46')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this[_0x9726('0x13')][_0x97f9f7[_0x9726('0x69')]],{'showHidden':![],'depth':null}));ami[_0x9726('0x44')]('custom:queuesummary',this['voiceQueues'][_0x97f9f7[_0x9726('0x69')]]);}}}catch(_0xf0c2a3){logger['error'](_0x9726('0x66'),util[_0x9726('0x3e')](_0xf0c2a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x19')]=function(_0x50679b){logger[_0x9726('0x46')](_0x9726('0x71'),util[_0x9726('0x3e')](_0x50679b,{'showHidden':![],'depth':null}));this[_0x9726('0x14')]=!![];};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x1a')]=function(_0x322c77){try{if(this[_0x9726('0x68')](_0x322c77)){logger[_0x9726('0x46')](_0x9726('0x72'),_0x322c77[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x322c77,{'showHidden':![],'depth':null}));if(_[_0x9726('0x73')](this['queueReports'][_0x322c77[_0x9726('0x4d')]])){this[_0x9726('0xf')][_0x322c77[_0x9726('0x4d')]]=[];this[_0x9726('0x11')][_0x322c77[_0x9726('0x4d')]]={};}var _0x3fd95f=new QueueReport();_0x3fd95f[_0x9726('0x4a')]=_0x322c77['queue'];_0x3fd95f[_0x9726('0x50')]=this[_0x9726('0x13')][_0x3fd95f[_0x9726('0x4a')]]&&this['voiceQueues'][_0x3fd95f[_0x9726('0x4a')]][_0x9726('0x50')]?this['voiceQueues'][_0x3fd95f[_0x9726('0x4a')]][_0x9726('0x50')]||'inbound':'inbound';_0x3fd95f['queue']=_0x322c77[_0x9726('0x69')];_0x3fd95f[_0x9726('0x74')]=moment()[_0x9726('0x61')](_0x9726('0x75'));_0x3fd95f[_0x9726('0x76')]=_0x322c77[_0x9726('0x76')];_0x3fd95f['count']=_0x322c77[_0x9726('0x77')];_0x3fd95f[_0x9726('0x4d')]=_0x322c77[_0x9726('0x4d')];logger[_0x9726('0x78')](_0x9726('0x79'),_0x3fd95f[_0x9726('0x4a')],_0x3fd95f[_0x9726('0x50')]);_[_0x9726('0x7a')](_0x3fd95f,_[_0x9726('0x7b')](_0x322c77,_[_0x9726('0x7c')](_0x3fd95f)));this[_0x9726('0xf')][_0x322c77[_0x9726('0x4d')]][_0x9726('0x7d')](_0x3fd95f);this['channels'][_0x322c77['uniqueid']]=_0x3fd95f;this[_0x9726('0x45')](_0x3fd95f,'queuecallerjoin');}}catch(_0x24e5be){logger[_0x9726('0x3c')](_0x9726('0x72'),_0x322c77[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x24e5be,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9726('0x1c')]=function(_0x4badff){try{if(this[_0x9726('0x68')](_0x4badff)){logger[_0x9726('0x46')](_0x9726('0x7e'),_0x4badff[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x4badff,{'showHidden':![],'depth':null}));if(this[_0x9726('0xf')][_0x4badff['uniqueid']]){var _0x4853de=_[_0x9726('0x7f')](this['queueReports'][_0x4badff[_0x9726('0x4d')]]);_0x4853de[_0x9726('0x80')]=![];_0x4853de['queuecallercompleteAt']=null;_0x4853de['holdtime']=_0x4badff[_0x9726('0x81')];_0x4853de[_0x9726('0x82')]=_0x4badff[_0x9726('0x82')];_0x4853de[_0x9726('0x1b')]=!![];_0x4853de['queuecallerabandonAt']=moment()['format'](_0x9726('0x75'));_0x4853de[_0x9726('0x83')]='ABANDONED';_0x4853de[_0x9726('0x84')]=null;logger[_0x9726('0x78')](_0x9726('0x85'),_0x4853de['name'],_0x4853de[_0x9726('0x50')]);this[_0x9726('0x11')][_0x4badff[_0x9726('0x4d')]]=_0x4853de;this['emitVoiceQueueChannelRemove'](_0x4853de,'queuecallerabandon');}}}catch(_0x5b4b9e){logger[_0x9726('0x3c')](_0x9726('0x7e'),_0x4badff[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x5b4b9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9726('0x1e')]=function(_0x30389e){try{if(this[_0x9726('0x68')](_0x30389e)){logger['debug'](_0x9726('0x86'),_0x30389e[_0x9726('0x4d')],util['inspect'](_0x30389e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x30389e['uniqueid']]){var _0x355c21=_[_0x9726('0x7f')](this[_0x9726('0xf')][_0x30389e[_0x9726('0x4d')]]);_0x355c21[_0x9726('0x87')]=moment()['format'](_0x9726('0x75'));_0x355c21[_0x9726('0x88')]=_0x30389e['connectedlinenum'];_0x355c21['connectedlinename']=_0x30389e[_0x9726('0x89')];logger['info'](_0x9726('0x8a'),_0x355c21[_0x9726('0x4a')],_0x355c21[_0x9726('0x50')],_0x30389e[_0x9726('0x88')],_0x30389e[_0x9726('0x89')]);this[_0x9726('0x11')][_0x30389e[_0x9726('0x4d')]]=_0x355c21;this[_0x9726('0x45')](_0x355c21,'queuecallerleave');}}}catch(_0x122e71){logger[_0x9726('0x3c')](_0x9726('0x86'),_0x30389e[_0x9726('0x4d')],util['inspect'](_0x122e71,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x21')]=function(_0x2463e4){try{if(this[_0x9726('0x68')](_0x2463e4)){logger[_0x9726('0x46')](_0x9726('0x8b'),_0x2463e4['uniqueid'],util['inspect'](_0x2463e4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2463e4[_0x9726('0x4d')]]){var _0xd556cd=_[_0x9726('0x7f')](this[_0x9726('0xf')][_0x2463e4[_0x9726('0x4d')]]);_0xd556cd['queuecallercomplete']=!![];_0xd556cd[_0x9726('0x83')]='COMPLETEDBYAGENT';logger[_0x9726('0x78')](_0x9726('0x8c'),_0xd556cd['name'],_0xd556cd['type']);}}}catch(_0x37f9b3){logger[_0x9726('0x3c')](_0x9726('0x8b'),_0x2463e4[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x37f9b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x1f')]=function(_0x463db1){try{if(this[_0x9726('0x68')](_0x463db1)){logger[_0x9726('0x46')](_0x9726('0x8d'),_0x463db1['uniqueid'],util[_0x9726('0x3e')](_0x463db1,{'showHidden':![],'depth':null}));if(this[_0x9726('0xf')][_0x463db1['uniqueid']]){var _0x3c90b9=_['last'](this[_0x9726('0xf')][_0x463db1[_0x9726('0x4d')]]);_0x3c90b9[_0x9726('0x1b')]=![];_0x3c90b9[_0x9726('0x8e')]=null;_0x3c90b9['assigned']=!![];_0x3c90b9[_0x9726('0x84')]=_0x463db1[_0x9726('0x8f')];_0x3c90b9[_0x9726('0x81')]=_0x463db1[_0x9726('0x81')];_0x3c90b9[_0x9726('0x80')]=!![];_0x3c90b9[_0x9726('0x90')]=![];_0x3c90b9[_0x9726('0x91')]=null;if(!_0x3c90b9['transfer']){if(_0x463db1[_0x9726('0x92')]==_0x9726('0x93')){_0x3c90b9['queuecallerexitreason']=_0x9726('0x94');logger[_0x9726('0x78')](_0x9726('0x95'),_0x3c90b9[_0x9726('0x4a')],_0x3c90b9[_0x9726('0x50')]);}else{if(_[_0x9726('0x96')](_0x463db1[_0x9726('0x39')]['toLowerCase'](),_0x9726('0x97'))){if(this['queueReports'][_0x463db1[_0x9726('0x98')]]){var _0x288d52=_[_0x9726('0x7f')](this[_0x9726('0xf')][_0x463db1[_0x9726('0x98')]]);_0x288d52[_0x9726('0x80')]=![];_0x288d52[_0x9726('0x90')]=!![];_0x288d52['queuecallerexitAt']=moment(_0x3c90b9['queuecallerjoinAt'])[_0x9726('0x99')](_0x463db1['holdtime'],_0x9726('0x9a'))[_0x9726('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x288d52[_0x9726('0x83')]=_0x9726('0x9b');_0x288d52[_0x9726('0x93')]=!![];_0x288d52[_0x9726('0x9c')]='FORWARD';_0x288d52[_0x9726('0x9d')]=_0x463db1[_0x9726('0x9e')];_0x288d52[_0x9726('0x9f')]=_0x463db1[_0x9726('0x4d')];logger[_0x9726('0x78')](_0x9726('0xa0'),_0x288d52[_0x9726('0x4a')],_0x288d52['type']);var _0x53a094=this['queueReports'][_0x463db1[_0x9726('0x98')]];this[_0x9726('0xf')][_0x463db1[_0x9726('0x98')]]=this[_0x9726('0xf')][_0x463db1['uniqueid']];this[_0x9726('0xf')][_0x463db1[_0x9726('0x4d')]]=_0x53a094;}}else{_0x3c90b9['queuecallerexitreason']='COMPLETEDBY'+_0x463db1[_0x9726('0x92')][_0x9726('0xa1')]();logger[_0x9726('0x78')](_0x9726('0xa2'),_0x3c90b9[_0x9726('0x4a')],_0x3c90b9[_0x9726('0x50')],_0x3c90b9[_0x9726('0x83')]);}}}this[_0x9726('0x11')][_0x463db1['uniqueid']]=_0x3c90b9;this[_0x9726('0x42')](_0x3c90b9,_0x9726('0xa3'));}}}catch(_0x45c71a){logger[_0x9726('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x463db1['uniqueid'],util[_0x9726('0x3e')](_0x45c71a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9726('0xa4')]=function(_0x454d6a){try{if(this[_0x9726('0x68')](_0x454d6a)){logger['debug']('[%s][voiceQueueReport][varset]',_0x454d6a[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x454d6a,{'showHidden':![],'depth':null}));this[_0x9726('0xa5')](_0x454d6a[_0x9726('0x4d')],_['keys'](_0x454d6a['variable'])[0x0],_0x454d6a[_0x9726('0xa6')]);if(this['queueReports'][_0x454d6a[_0x9726('0x4d')]]){var _0x5cc265=_['last'](this[_0x9726('0xf')][_0x454d6a[_0x9726('0x4d')]]);if(_0x5cc265){if(this[_0x9726('0x68')](_0x454d6a[_0x9726('0xa7')])&&this[_0x9726('0x68')](_0x454d6a[_0x9726('0xa7')][_0x9726('0xa8')])){switch(_0x454d6a[_0x9726('0xa6')]){case'CONTINUE':_0x5cc265[_0x9726('0x90')]=![];_0x5cc265[_0x9726('0x91')]=null;break;case _0x9726('0xa9'):_0x5cc265[_0x9726('0xaa')]='timeout';_0x5cc265['queuecallerexit']=!![];_0x5cc265[_0x9726('0x91')]=moment()[_0x9726('0x61')](_0x9726('0x75'));_0x5cc265[_0x9726('0x87')]=moment()[_0x9726('0x61')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x9726('0xab'),_0x454d6a['uniqueid'],util['inspect'](_0x5cc265,{'showHidden':![],'depth':null}));ami[_0x9726('0x44')](_0x9726('0xac'),_0x5cc265);break;default:_0x5cc265[_0x9726('0x90')]=!![];_0x5cc265[_0x9726('0x91')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5cc265[_0x9726('0x87')]=moment()['format'](_0x9726('0x75'));}_0x5cc265[_0x9726('0x1b')]=![];_0x5cc265[_0x9726('0x8e')]=null;_0x5cc265[_0x9726('0x83')]=_0x454d6a[_0x9726('0xa6')];this[_0x9726('0x11')][_0x454d6a[_0x9726('0x4d')]]=_0x5cc265;this[_0x9726('0x42')](_0x5cc265,_0x9726('0x22'));}else if(this[_0x9726('0x68')](_0x454d6a[_0x9726('0xa7')])&&this[_0x9726('0x68')](_0x454d6a[_0x9726('0xa7')]['queueposition'])){if(!_0x5cc265['queuecallerabandon']){_0x5cc265[_0x9726('0x90')]=!![];_0x5cc265['queuecallerexitAt']=moment()[_0x9726('0x61')](_0x9726('0x75'));_0x5cc265[_0x9726('0x83')]=_0x9726('0xad');_0x5cc265[_0x9726('0x87')]=moment()['format'](_0x9726('0x75'));this['channels'][_0x454d6a['uniqueid']]=_0x5cc265;}}logger[_0x9726('0x78')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x454d6a[_0x9726('0x4d')],_0x5cc265[_0x9726('0x4a')],_0x5cc265[_0x9726('0x50')],_[_0x9726('0x7c')](_0x454d6a[_0x9726('0xa7')])[0x0],_0x454d6a[_0x9726('0xa6')]);_0x5cc265[_0x9726('0x15')]=this['variables'][_0x454d6a['uniqueid']];}}}}catch(_0x410583){logger[_0x9726('0x3c')]('[%s][voiceQueueReport][varset]',_0x454d6a[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x410583,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0xa5')]=function(_0x56df7d,_0x153dd9,_0x5e76aa){var _0x5e68f0=['rtpaudioqos',_0x9726('0xae'),'rtpaudioqosjitter',_0x9726('0xaf'),'rtpaudioqosloss',_0x9726('0xb0'),'rtpaudioqosrtt',_0x9726('0xb1'),_0x9726('0xb2'),_0x9726('0xb3'),_0x9726('0xb4'),_0x9726('0xb5'),_0x9726('0xb6'),_0x9726('0xb7'),_0x9726('0xb8'),_0x9726('0xb9'),_0x9726('0x8f'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x153dd9)&&!_['includes'](_0x5e68f0,_0x153dd9)){if(_[_0x9726('0x73')](this[_0x9726('0x15')][_0x56df7d])){this[_0x9726('0x15')][_0x56df7d]={};}this[_0x9726('0x15')][_0x56df7d][_0x153dd9]=_0x5e76aa;}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x24')]=function(_0x5cf2d7){try{if(this['isNotNull'](_0x5cf2d7)){logger['debug']('[%s][voiceQueueReport][hangup]',_0x5cf2d7[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x5cf2d7,{'showHidden':![],'depth':null}));if(this[_0x9726('0xf')][_0x5cf2d7[_0x9726('0x4d')]]){for(var _0xc88e02=0x0,_0x2c0c10={};_0xc88e02=0x0?moment(_0x3b70c2[_0xbf09('0x18')])[_0xbf09('0xb')](_0x3b70c2[_0xbf09('0x17')],_0xbf09('0x19')):null,'data1':_0xbf09('0x1a'),'data2':_0x3b70c2['accountcode'],'data3':_0x3b70c2[_0xbf09('0xe')],'data4':_0x3b70c2[_0xbf09('0x1b')]||null,'role':'agent','internal':_0x3b70c2[_0xbf09('0x10')]?_[_0xbf09('0x11')](_0x3b70c2[_0xbf09('0x10')]):undefined,'uniqueid':_0x3b70c2['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x8a62=['membername','starttime','endtime','seconds','outbound','accountcode','dialstring','uniqueid','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','exten','agent','toNumber','CreateMemberReport','voiceDialReport','voice'];(function(_0x478e2f,_0xcc2041){var _0x4b088d=function(_0x1d262b){while(--_0x1d262b){_0x478e2f['push'](_0x478e2f['shift']());}};_0x4b088d(++_0xcc2041);}(_0x8a62,0x12a));var _0x28a6=function(_0x40befd,_0xd9733f){_0x40befd=_0x40befd-0x0;var _0x10be75=_0x8a62[_0x40befd];return _0x10be75;};'use strict';var moment=require('moment');var _=require(_0x28a6('0x0'));var util=require('util');var client=require(_0x28a6('0x1'));exports[_0x28a6('0x2')]=function(_0x278dda){var _0x49f9a1=_0x278dda[_0x28a6('0x3')]||_0x278dda[_0x28a6('0x4')];return client[_0x28a6('0x5')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x278dda[_0x28a6('0x6')],'interface':_[_0x28a6('0x7')](_0x278dda[_0x28a6('0x8')])?util[_0x28a6('0x9')](_0x28a6('0xa'),_0x278dda[_0x28a6('0x6')]):_0x278dda[_0x28a6('0x8')],'type':_0x28a6('0xb'),'enterAt':_0x278dda[_0x28a6('0xc')],'exitAt':_0x49f9a1,'duration':moment(_0x49f9a1)[_0x28a6('0xd')](_0x278dda[_0x28a6('0xc')],'seconds'),'data1':_0x28a6('0xe'),'data2':_0x278dda['calleridnum'],'data3':_0x278dda[_0x28a6('0xf')],'data4':null,'data5':_0x278dda['queue'],'role':_0x28a6('0x10'),'internal':_0x278dda['accountcode']?_[_0x28a6('0x11')](_0x278dda['accountcode']):undefined,'uniqueid':_0x278dda['uniqueid']},'log':_0x28a6('0x12')});};exports[_0x28a6('0x13')]=function(_0x3b70e1){return client[_0x28a6('0x5')]('CreateMemberReport',{'body':{'channel':_0x28a6('0x14'),'membername':_0x3b70e1[_0x28a6('0x15')],'interface':_0x3b70e1['interface'],'type':_0x28a6('0xb'),'enterAt':_0x3b70e1[_0x28a6('0x16')],'exitAt':_0x3b70e1[_0x28a6('0x17')],'duration':moment(_0x3b70e1[_0x28a6('0x17')])['diff'](_0x3b70e1[_0x28a6('0x16')],_0x28a6('0x18'))>=0x0?moment(_0x3b70e1[_0x28a6('0x17')])[_0x28a6('0xd')](_0x3b70e1[_0x28a6('0x16')],'seconds'):null,'data1':_0x28a6('0x19'),'data2':_0x3b70e1[_0x28a6('0x1a')],'data3':_0x3b70e1[_0x28a6('0xf')],'data4':_0x3b70e1[_0x28a6('0x1b')]||null,'role':_0x28a6('0x10'),'internal':_0x3b70e1[_0x28a6('0x1a')]?_['toNumber'](_0x3b70e1[_0x28a6('0x1a')]):undefined,'uniqueid':_0x3b70e1[_0x28a6('0x1c')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a8097d9..5bb566e 100644 --- a/server/services/ami/rpc/template.js +++ b/server/services/ami/rpc/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0565=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x0565,0xf2));var _0x5056=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0565[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0x5056('0x0'));exports[_0x5056('0x1')]=function(_0x2790a7){return function(_0x2e0694){return client[_0x5056('0x2')](_0x5056('0x3'),{'options':{'raw':!![],'attributes':['id',_0x5056('0x4'),_0x5056('0x5')]},'log':_0x5056('0x3')});};}; \ No newline at end of file +var _0x5423=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0x39da98,_0x48559a){var _0x34dcbb=function(_0x4bcf1a){while(--_0x4bcf1a){_0x39da98['push'](_0x39da98['shift']());}};_0x34dcbb(++_0x48559a);}(_0x5423,0xe3));var _0x3542=function(_0x39cb25,_0x58c8d3){_0x39cb25=_0x39cb25-0x0;var _0x41d36d=_0x5423[_0x39cb25];return _0x41d36d;};'use strict';var client=require(_0x3542('0x0'));exports[_0x3542('0x1')]=function(_0x511bd3){return function(_0x331a98){return client[_0x3542('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x3542('0x3'),_0x3542('0x4')]},'log':_0x3542('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5d09f40..7521f6e 100644 --- a/server/services/ami/rpc/trigger.js +++ b/server/services/ami/rpc/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa967=['action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','Action','Actions'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa967,0xc5));var _0x7a96=function(_0x1307e3,_0x14bc2d){_0x1307e3=_0x1307e3-0x0;var _0x36ed19=_0xa967[_0x1307e3];return _0x36ed19;};'use strict';var client=require(_0x7a96('0x0'));exports[_0x7a96('0x1')]=function(_0x3f8337){return function(_0x1eba92){return client[_0x7a96('0x2')](_0x7a96('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7a96('0x4'),_0x7a96('0x5')],'include':[{'model':_0x7a96('0x6'),'as':_0x7a96('0x7'),'attributes':['id',_0x7a96('0x8'),_0x7a96('0x9'),_0x7a96('0xa')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x7a96('0x8'),_0x7a96('0x9'),'value']},{'model':_0x7a96('0xb'),'as':_0x7a96('0xc'),'attributes':['id',_0x7a96('0xd'),_0x7a96('0xe'),_0x7a96('0xf'),_0x7a96('0x10'),_0x7a96('0x11'),_0x7a96('0x12'),_0x7a96('0x13'),_0x7a96('0x14')]}]},'log':_0x7a96('0x3')});};}; \ No newline at end of file +var _0x1b3e=['action','data1','data2','data4','data5','data6','data7','GetTrigger','channel','status','Condition','AllConditions','value','field','operator','Action','Actions'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1b3e,0x128));var _0xe1b3=function(_0x23f626,_0x55c5d){_0x23f626=_0x23f626-0x0;var _0x4b96c7=_0x1b3e[_0x23f626];return _0x4b96c7;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x53ec55){return function(_0x13e1fc){return client['Request'](_0xe1b3('0x0'),{'options':{'raw':![],'attributes':['id','name',_0xe1b3('0x1'),_0xe1b3('0x2')],'include':[{'model':_0xe1b3('0x3'),'as':_0xe1b3('0x4'),'attributes':['id','field','operator',_0xe1b3('0x5')]},{'model':_0xe1b3('0x3'),'as':'AnyConditions','attributes':['id',_0xe1b3('0x6'),_0xe1b3('0x7'),_0xe1b3('0x5')]},{'model':_0xe1b3('0x8'),'as':_0xe1b3('0x9'),'attributes':['id',_0xe1b3('0xa'),_0xe1b3('0xb'),_0xe1b3('0xc'),'data3',_0xe1b3('0xd'),_0xe1b3('0xe'),_0xe1b3('0xf'),_0xe1b3('0x10')]}]},'log':_0xe1b3('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 0dd79cb..7fe885e 100644 --- a/server/services/ami/rpc/trunk.js +++ b/server/services/ami/rpc/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f41=['Request','GetTrunk','name','registry','../client','getTrunks'];(function(_0x3d5e06,_0x41f3da){var _0x50a63e=function(_0x59a1c9){while(--_0x59a1c9){_0x3d5e06['push'](_0x3d5e06['shift']());}};_0x50a63e(++_0x41f3da);}(_0x7f41,0x15a));var _0x17f4=function(_0x57f2d2,_0x10bb2d){_0x57f2d2=_0x57f2d2-0x0;var _0x26e8b6=_0x7f41[_0x57f2d2];return _0x26e8b6;};'use strict';var client=require(_0x17f4('0x0'));exports[_0x17f4('0x1')]=function(_0x138229){return function(_0x1a346b){return client[_0x17f4('0x2')](_0x17f4('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x17f4('0x4'),_0x17f4('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xa470=['registry','getTrunks','Request','GetTrunk'];(function(_0xd40536,_0xd6f24){var _0x4ac571=function(_0x42863a){while(--_0x42863a){_0xd40536['push'](_0xd40536['shift']());}};_0x4ac571(++_0xd6f24);}(_0xa470,0x1d5));var _0x0a47=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa470[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x0a47('0x0')]=function(_0x42022d){return function(_0x24cf27){return client[_0x0a47('0x1')](_0x0a47('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x0a47('0x3')]},'log':_0x0a47('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d49602f..2bedcdc 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f57=['telephone','savePause','Request','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','interface','../client','getAgents','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','getTelephones'];(function(_0xfc14b5,_0x22be08){var _0x37ba74=function(_0x280945){while(--_0x280945){_0xfc14b5['push'](_0xfc14b5['shift']());}};_0x37ba74(++_0x22be08);}(_0x3f57,0x81));var _0x73f5=function(_0x1496e6,_0x493cf7){_0x1496e6=_0x1496e6-0x0;var _0x2771c4=_0x3f57[_0x1496e6];return _0x2771c4;};'use strict';var client=require(_0x73f5('0x0'));exports[_0x73f5('0x1')]=function(){return function(){return client['Request'](_0x73f5('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x73f5('0x3'),_0x73f5('0x4'),_0x73f5('0x5'),_0x73f5('0x6'),_0x73f5('0x7'),_0x73f5('0x8'),_0x73f5('0x9'),_0x73f5('0xa'),_0x73f5('0xb'),_0x73f5('0xc'),_0x73f5('0xd'),'interface']},'log':'getAgents'});};};exports[_0x73f5('0xe')]=function(){return function(){return client['Request'](_0x73f5('0x2'),{'options':{'raw':!![],'where':{'role':_0x73f5('0xf')},'attributes':['id','name','accountcode','internal']},'log':'getTelephones'});};};exports[_0x73f5('0x10')]=function(_0x5920f6,_0x3cae81,_0x5070c3){return client[_0x73f5('0x11')](_0x73f5('0x12'),{'body':{'type':_0x3cae81,'uniqueid':_0x5070c3},'options':{'where':{'id':_0x5920f6['id']}},'log':_0x73f5('0x10')});};exports[_0x73f5('0x13')]=function(_0x28f013){return client['Request'](_0x73f5('0x14'),{'body':{},'options':{'where':{'id':_0x28f013['id']}},'log':'savePause'});};exports[_0x73f5('0x15')]=function(_0x5cf7cb){return client[_0x73f5('0x11')](_0x73f5('0x16'),{'options':{'raw':![],'where':{'role':'agent','id':_0x5cf7cb},'attributes':['id','name','email',_0x73f5('0x5'),_0x73f5('0x6'),_0x73f5('0x7'),_0x73f5('0x8'),_0x73f5('0x9'),'lastPauseAt',_0x73f5('0xb'),_0x73f5('0x17')]},'log':_0x73f5('0x15')});}; \ No newline at end of file +var _0x7cb3=['accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','interface','getTelephones','telephone','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','getAgents','Request','agent','name','email'];(function(_0x49366b,_0x58e79a){var _0x3287eb=function(_0x402a6b){while(--_0x402a6b){_0x49366b['push'](_0x49366b['shift']());}};_0x3287eb(++_0x58e79a);}(_0x7cb3,0x18a));var _0x37cb=function(_0x57ef6f,_0x555d7c){_0x57ef6f=_0x57ef6f-0x0;var _0x52b688=_0x7cb3[_0x57ef6f];return _0x52b688;};'use strict';var client=require('../client');exports[_0x37cb('0x0')]=function(){return function(){return client[_0x37cb('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0x37cb('0x2')},'attributes':['id',_0x37cb('0x3'),_0x37cb('0x4'),_0x37cb('0x5'),_0x37cb('0x6'),_0x37cb('0x7'),_0x37cb('0x8'),_0x37cb('0x9'),_0x37cb('0xa'),_0x37cb('0xb'),_0x37cb('0xc'),'mobile',_0x37cb('0xd')]},'log':_0x37cb('0x0')});};};exports[_0x37cb('0xe')]=function(){return function(){return client[_0x37cb('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x37cb('0xf')},'attributes':['id','name',_0x37cb('0x5'),'internal']},'log':_0x37cb('0xe')});};};exports[_0x37cb('0x10')]=function(_0x16a683,_0x9b99f9,_0x24d7d0){return client['Request']('PauseUser',{'body':{'type':_0x9b99f9,'uniqueid':_0x24d7d0},'options':{'where':{'id':_0x16a683['id']}},'log':'savePause'});};exports[_0x37cb('0x11')]=function(_0x3b3dba){return client[_0x37cb('0x1')](_0x37cb('0x12'),{'body':{},'options':{'where':{'id':_0x3b3dba['id']}},'log':'savePause'});};exports[_0x37cb('0x13')]=function(_0x1dd584){return client[_0x37cb('0x1')](_0x37cb('0x14'),{'options':{'raw':![],'where':{'role':_0x37cb('0x2'),'id':_0x1dd584},'attributes':['id',_0x37cb('0x3'),_0x37cb('0x4'),_0x37cb('0x5'),_0x37cb('0x6'),_0x37cb('0x7'),_0x37cb('0x8'),_0x37cb('0x9'),_0x37cb('0xa'),_0x37cb('0xb'),_0x37cb('0xd')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index cbcc7cf..784d12e 100644 --- a/server/services/ami/rpc/voiceAgentReport.js +++ b/server/services/ami/rpc/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb819=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xb819,0x137));var _0x9b81=function(_0x4e3b88,_0x3c3d96){_0x4e3b88=_0x4e3b88-0x0;var _0x6be081=_0xb819[_0x4e3b88];return _0x6be081;};'use strict';var client=require(_0x9b81('0x0'));exports['create']=function(_0x34b06e){return client[_0x9b81('0x1')]('CreateVoiceAgentReport',{'body':_0x34b06e,'log':_0x9b81('0x2')});};exports[_0x9b81('0x3')]=function(_0xa967d1,_0x5fade4,_0x4fca6b){return client[_0x9b81('0x1')]('UpdateVoiceAgentReport',{'body':_0xa967d1,'options':{'where':{'uniqueid':_0x5fade4,'interface':_0x4fca6b,'agentcomplete':!![]}},'log':_0x9b81('0x4')});}; \ No newline at end of file +var _0x3148=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x3148,0x172));var _0x8314=function(_0xbc0b4d,_0x48d139){_0xbc0b4d=_0xbc0b4d-0x0;var _0x5920d7=_0x3148[_0xbc0b4d];return _0x5920d7;};'use strict';var client=require('../client');exports[_0x8314('0x0')]=function(_0x56ce4b){return client[_0x8314('0x1')](_0x8314('0x2'),{'body':_0x56ce4b,'log':_0x8314('0x2')});};exports[_0x8314('0x3')]=function(_0x279cf5,_0x3d81ee,_0x4bcda2){return client[_0x8314('0x1')](_0x8314('0x4'),{'body':_0x279cf5,'options':{'where':{'uniqueid':_0x3d81ee,'interface':_0x4bcda2,'agentcomplete':!![]}},'log':_0x8314('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 91bbced..9f3f6cb 100644 --- a/server/services/ami/rpc/voiceCallReport.js +++ b/server/services/ami/rpc/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f5a=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','context','DOCUMENTATION','GetVoiceCallReport','startOf'];(function(_0x44017f,_0x2a698f){var _0x28c84f=function(_0x25ac72){while(--_0x25ac72){_0x44017f['push'](_0x44017f['shift']());}};_0x28c84f(++_0x2a698f);}(_0x9f5a,0x100));var _0xa9f5=function(_0x14edc0,_0x4dca65){_0x14edc0=_0x14edc0-0x0;var _0x261c9a=_0x9f5a[_0x14edc0];return _0x261c9a;};'use strict';var moment=require('moment');var util=require(_0xa9f5('0x0'));var _=require(_0xa9f5('0x1'));var client=require(_0xa9f5('0x2'));exports[_0xa9f5('0x3')]=function(_0x4ab404){return client[_0xa9f5('0x4')](_0xa9f5('0x5'),{'body':_['merge'](_0x4ab404,{'source':_0x4ab404['calleridnum'],'destinationcontext':_0x4ab404[_0xa9f5('0x6')],'callerid':_0x4ab404['callerid'],'amaflags':_0xa9f5('0x7')}),'log':_0xa9f5('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xa9f5('0x4')](_0xa9f5('0x8'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xa9f5('0x9')](_0xa9f5('0xa'))[_0xa9f5('0xb')](_0xa9f5('0xc')),moment()[_0xa9f5('0xd')](_0xa9f5('0xa'))[_0xa9f5('0xb')](_0xa9f5('0xc'))]}},'attributes':[_0xa9f5('0xe'),_0xa9f5('0xf'),_0xa9f5('0x10'),_0xa9f5('0x11')]},'log':_0xa9f5('0x12')});};}; \ No newline at end of file +var _0x19d1=['util','lodash','../client','create','Request','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19d1,0x117));var _0x119d=function(_0x1c8ea5,_0x25d5e4){_0x1c8ea5=_0x1c8ea5-0x0;var _0x36d439=_0x19d1[_0x1c8ea5];return _0x36d439;};'use strict';var moment=require(_0x119d('0x0'));var util=require(_0x119d('0x1'));var _=require(_0x119d('0x2'));var client=require(_0x119d('0x3'));exports[_0x119d('0x4')]=function(_0x2dbabe){return client[_0x119d('0x5')]('CreateVoiceCallReport',{'body':_['merge'](_0x2dbabe,{'source':_0x2dbabe[_0x119d('0x6')],'destinationcontext':_0x2dbabe[_0x119d('0x7')],'callerid':_0x2dbabe[_0x119d('0x8')],'amaflags':_0x119d('0x9')}),'log':_0x119d('0xa')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x119d('0x5')](_0x119d('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x119d('0xc'))[_0x119d('0xd')](_0x119d('0xe')),moment()[_0x119d('0xf')](_0x119d('0xc'))[_0x119d('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x119d('0x10'),_0x119d('0x11'),'duration',_0x119d('0x12')]},'log':_0x119d('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8b34169..fcc040e 100644 --- a/server/services/ami/rpc/voiceDialReport.js +++ b/server/services/ami/rpc/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe183=['CreateVoiceDialReport','../client','create','Request'];(function(_0x129479,_0x256c7e){var _0x3fa0ce=function(_0x35401f){while(--_0x35401f){_0x129479['push'](_0x129479['shift']());}};_0x3fa0ce(++_0x256c7e);}(_0xe183,0xe1));var _0x3e18=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0xe183[_0x2d61ac];return _0x3f7d3c;};'use strict';var client=require(_0x3e18('0x0'));exports[_0x3e18('0x1')]=function(_0x25223a){return client[_0x3e18('0x2')]('CreateVoiceDialReport',{'body':_0x25223a,'log':_0x3e18('0x3')});}; \ No newline at end of file +var _0x1aab=['Request','CreateVoiceDialReport','create'];(function(_0x439c63,_0x3cb62d){var _0xc9cde5=function(_0x494a5a){while(--_0x494a5a){_0x439c63['push'](_0x439c63['shift']());}};_0xc9cde5(++_0x3cb62d);}(_0x1aab,0xbf));var _0xb1aa=function(_0x3056d0,_0x3ce8a0){_0x3056d0=_0x3056d0-0x0;var _0x3e29d8=_0x1aab[_0x3056d0];return _0x3e29d8;};'use strict';var client=require('../client');exports[_0xb1aa('0x0')]=function(_0x3913e2){return client[_0xb1aa('0x1')]('CreateVoiceDialReport',{'body':_0x3913e2,'log':_0xb1aa('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ce3c8c5..bdd3944 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf60=['Request','recordingFormat','../client','getVoiceExtensions'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xaf60,0x82));var _0x0af6=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xaf60[_0x411add];return _0x238242;};'use strict';var client=require(_0x0af6('0x0'));exports[_0x0af6('0x1')]=function(){return function(){return client[_0x0af6('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x0af6('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x1a5c=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x3c2cb6,_0x2453f7){var _0x4e1ea5=function(_0x2db43a){while(--_0x2db43a){_0x3c2cb6['push'](_0x3c2cb6['shift']());}};_0x4e1ea5(++_0x2453f7);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x1a5c[_0x243b2f];return _0xcb3c2d;};'use strict';var client=require(_0xc1a5('0x0'));exports[_0xc1a5('0x1')]=function(){return function(){return client[_0xc1a5('0x2')](_0xc1a5('0x3'),{'options':{'raw':!![],'attributes':['id',_0xc1a5('0x4'),_0xc1a5('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xc1a5('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7ec8470..ad93388 100644 --- a/server/services/ami/rpc/voiceQueue.js +++ b/server/services/ami/rpc/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ca9=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','active','Pause','mandatoryDispositionPause','Trunk','TrunkBackup','callerid','Interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x4c8de4,_0x1ef7ec){var _0x1f0b6c=function(_0x3ffd17){while(--_0x3ffd17){_0x4c8de4['push'](_0x4c8de4['shift']());}};_0x1f0b6c(++_0x1ef7ec);}(_0x8ca9,0x19b));var _0x98ca=function(_0x5c0e26,_0x3444d6){_0x5c0e26=_0x5c0e26-0x0;var _0x521b13=_0x8ca9[_0x5c0e26];return _0x521b13;};'use strict';var client=require(_0x98ca('0x0'));exports[_0x98ca('0x1')]=function(){return function(){return client[_0x98ca('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x98ca('0x3'),_0x98ca('0x4'),_0x98ca('0x5'),_0x98ca('0x6'),_0x98ca('0x7'),_0x98ca('0x8'),_0x98ca('0x9'),'dialMethod',_0x98ca('0xa'),_0x98ca('0xb'),'dialPowerLevel',_0x98ca('0xc'),_0x98ca('0xd'),_0x98ca('0xe'),_0x98ca('0xf'),_0x98ca('0x10'),_0x98ca('0x11'),_0x98ca('0x12'),'dialQueueTimeout',_0x98ca('0x13'),_0x98ca('0x14'),_0x98ca('0x15'),_0x98ca('0x16'),_0x98ca('0x17'),_0x98ca('0x18'),'dialNoAnswerRetryFrequency',_0x98ca('0x19'),_0x98ca('0x1a'),_0x98ca('0x1b'),_0x98ca('0x1c'),_0x98ca('0x1d'),_0x98ca('0x1e'),_0x98ca('0x1f'),_0x98ca('0x20'),_0x98ca('0x21'),_0x98ca('0x22'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x98ca('0x23'),_0x98ca('0x24'),_0x98ca('0x25'),_0x98ca('0x26'),'dialRecallInQueue',_0x98ca('0x27'),_0x98ca('0x28'),_0x98ca('0x29'),_0x98ca('0x2a'),_0x98ca('0x7'),_0x98ca('0x2b'),_0x98ca('0x2c'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0x98ca('0x2d'),_0x98ca('0x2e'),_0x98ca('0x2f'),_0x98ca('0x30'),_0x98ca('0x31'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x98ca('0x32'),_0x98ca('0x33'),_0x98ca('0x34'),_0x98ca('0x35'),_0x98ca('0x36')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x98ca('0x3'),'callerid',_0x98ca('0x37')]},{'model':_0x98ca('0x38'),'as':_0x98ca('0x39'),'attributes':['id',_0x98ca('0x3')]},{'model':_0x98ca('0x3a'),'as':_0x98ca('0x3b'),'attributes':['id','name',_0x98ca('0x3c'),_0x98ca('0x37')]},{'model':_0x98ca('0x3d'),'as':_0x98ca('0x3d'),'attributes':['id','name'],'include':[{'model':_0x98ca('0x3d'),'as':'Intervals','attributes':['id',_0x98ca('0x3'),'interval']}]}]},'log':_0x98ca('0x1')});};}; \ No newline at end of file +var _0xd22e=['callerid','active','Interval','Intervals','interval','getVoiceQueues','Request','name','acw','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','Pause','mandatoryDispositionPause','TrunkBackup'];(function(_0x13e334,_0x71cc68){var _0x394246=function(_0x354eb6){while(--_0x354eb6){_0x13e334['push'](_0x13e334['shift']());}};_0x394246(++_0x71cc68);}(_0xd22e,0x1a2));var _0xed22=function(_0x33effb,_0x1bd00d){_0x33effb=_0x33effb-0x0;var _0x1471e7=_0xd22e[_0x33effb];return _0x1471e7;};'use strict';var client=require('../client');exports[_0xed22('0x0')]=function(){return function(){return client[_0xed22('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xed22('0x2'),_0xed22('0x3'),'acwTimeout','autopause',_0xed22('0x4'),'type','dialActive',_0xed22('0x5'),_0xed22('0x6'),_0xed22('0x7'),_0xed22('0x8'),'dialPredictiveOptimization',_0xed22('0x9'),'dialPredictiveInterval',_0xed22('0xa'),_0xed22('0xb'),_0xed22('0xc'),_0xed22('0xd'),_0xed22('0xe'),_0xed22('0xf'),_0xed22('0x10'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0xed22('0x11'),_0xed22('0x12'),_0xed22('0x13'),_0xed22('0x14'),_0xed22('0x15'),_0xed22('0x16'),_0xed22('0x17'),'dialCheckDuplicateType','dialAMDActive',_0xed22('0x18'),_0xed22('0x19'),_0xed22('0x1a'),_0xed22('0x1b'),_0xed22('0x1c'),_0xed22('0x1d'),_0xed22('0x1e'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout',_0xed22('0x1f'),_0xed22('0x20'),_0xed22('0x21'),_0xed22('0x22'),_0xed22('0x23'),_0xed22('0x4'),'strategy',_0xed22('0x24'),_0xed22('0x25'),_0xed22('0x26'),_0xed22('0x27'),_0xed22('0x28'),_0xed22('0x29'),_0xed22('0x2a'),_0xed22('0x2b'),'dialMachineMaxRetry',_0xed22('0x2c'),_0xed22('0x2d'),_0xed22('0x2e'),_0xed22('0x2f'),_0xed22('0x30'),_0xed22('0x31')],'include':[{'model':_0xed22('0x32'),'as':_0xed22('0x32'),'attributes':['id','name','callerid','active']},{'model':_0xed22('0x33'),'as':_0xed22('0x34'),'attributes':['id',_0xed22('0x2')]},{'model':_0xed22('0x32'),'as':_0xed22('0x35'),'attributes':['id',_0xed22('0x2'),_0xed22('0x36'),_0xed22('0x37')]},{'model':_0xed22('0x38'),'as':'Interval','attributes':['id',_0xed22('0x2')],'include':[{'model':'Interval','as':_0xed22('0x39'),'attributes':['id',_0xed22('0x2'),_0xed22('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7e9c668..c91aff5 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafe6=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day'];(function(_0x2713f5,_0x382adb){var _0x4e6249=function(_0x2e2565){while(--_0x2e2565){_0x2713f5['push'](_0x2713f5['shift']());}};_0x4e6249(++_0x382adb);}(_0xafe6,0xa7));var _0x6afe=function(_0x15477e,_0x26282a){_0x15477e=_0x15477e-0x0;var _0x364a91=_0xafe6[_0x15477e];return _0x364a91;};'use strict';var moment=require(_0x6afe('0x0'));var _=require(_0x6afe('0x1'));var client=require(_0x6afe('0x2'));exports[_0x6afe('0x3')]=function(_0x450768){return client['Request'](_0x6afe('0x4'),{'body':_0x450768,'log':_0x6afe('0x4')});};exports[_0x6afe('0x5')]=function(){return function(){return client['Request'](_0x6afe('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6afe('0x7')](_0x6afe('0x8'))[_0x6afe('0x9')](_0x6afe('0xa')),moment()[_0x6afe('0xb')]('day')[_0x6afe('0x9')](_0x6afe('0xa'))]}},'attributes':[_0x6afe('0xc'),_0x6afe('0xd'),_0x6afe('0xe'),'queuecallerleaveAt',_0x6afe('0xf'),_0x6afe('0x10'),_0x6afe('0x11'),_0x6afe('0x12'),_0x6afe('0x13'),_0x6afe('0x14')]},'log':_0x6afe('0x15')});};}; \ No newline at end of file +var _0xb0cf=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x4c8b16,_0x3ca21c){var _0x2ba188=function(_0x3e128e){while(--_0x3e128e){_0x4c8b16['push'](_0x4c8b16['shift']());}};_0x2ba188(++_0x3ca21c);}(_0xb0cf,0xc3));var _0xfb0c=function(_0x2fd0ec,_0x34a4e0){_0x2fd0ec=_0x2fd0ec-0x0;var _0x1a0601=_0xb0cf[_0x2fd0ec];return _0x1a0601;};'use strict';var moment=require(_0xfb0c('0x0'));var _=require(_0xfb0c('0x1'));var client=require(_0xfb0c('0x2'));exports[_0xfb0c('0x3')]=function(_0x216da9){return client[_0xfb0c('0x4')](_0xfb0c('0x5'),{'body':_0x216da9,'log':'CreateVoiceQueueReport'});};exports[_0xfb0c('0x6')]=function(){return function(){return client[_0xfb0c('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xfb0c('0x7'))[_0xfb0c('0x8')](_0xfb0c('0x9')),moment()[_0xfb0c('0xa')](_0xfb0c('0x7'))[_0xfb0c('0x8')](_0xfb0c('0x9'))]}},'attributes':['uniqueid',_0xfb0c('0xb'),_0xfb0c('0xc'),_0xfb0c('0xd'),_0xfb0c('0xe'),_0xfb0c('0xf'),'queuecallerexit',_0xfb0c('0x10'),_0xfb0c('0x11'),_0xfb0c('0x12')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index f5b6b3d..f94a8f0 100644 --- a/server/services/ami/rpc/voiceQueueRt.js +++ b/server/services/ami/rpc/voiceQueueRt.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4116=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0x4116,0x1cb));var _0x6411=function(_0x15b6d2,_0x3bf4be){_0x15b6d2=_0x15b6d2-0x0;var _0x36a1e2=_0x4116[_0x15b6d2];return _0x36a1e2;};'use strict';var client=require(_0x6411('0x0'));exports[_0x6411('0x1')]=function(_0x44210f){return function(){return client[_0x6411('0x2')](_0x6411('0x3'),{'options':{'where':{'VoiceQueueId':_0x44210f,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x4fe8=['getVoiceQueueRtPauses','Request','../client'];(function(_0x120295,_0x103efe){var _0x13a826=function(_0x5308be){while(--_0x5308be){_0x120295['push'](_0x120295['shift']());}};_0x13a826(++_0x103efe);}(_0x4fe8,0x167));var _0x84fe=function(_0x2d0ffa,_0x26fad7){_0x2d0ffa=_0x2d0ffa-0x0;var _0x20ee83=_0x4fe8[_0x2d0ffa];return _0x20ee83;};'use strict';var client=require(_0x84fe('0x0'));exports[_0x84fe('0x1')]=function(_0x506c11){return function(){return client[_0x84fe('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x506c11,'paused':!![]},'raw':!![]},'log':_0x84fe('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c68fa3f..f556976 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5143=['lodash','create','CreateVoiceRecording','merge','monitorFilename'];(function(_0x46f76e,_0x5b923b){var _0x426ce4=function(_0x5eab19){while(--_0x5eab19){_0x46f76e['push'](_0x46f76e['shift']());}};_0x426ce4(++_0x5b923b);}(_0x5143,0xaa));var _0x3514=function(_0x41e7f3,_0x2bb337){_0x41e7f3=_0x41e7f3-0x0;var _0x28eb99=_0x5143[_0x41e7f3];return _0x28eb99;};'use strict';var _=require(_0x3514('0x0'));var client=require('../client');exports[_0x3514('0x1')]=function(_0x509267){return client['Request'](_0x3514('0x2'),{'body':_[_0x3514('0x3')](_0x509267,{'value':_0x509267[_0x3514('0x4')]}),'log':_0x3514('0x2')});}; \ No newline at end of file +var _0xe652=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create','Request'];(function(_0x184926,_0x2984ee){var _0x51fa36=function(_0x23d11a){while(--_0x23d11a){_0x184926['push'](_0x184926['shift']());}};_0x51fa36(++_0x2984ee);}(_0xe652,0xb2));var _0x2e65=function(_0x589bac,_0x56768a){_0x589bac=_0x589bac-0x0;var _0x26a374=_0xe652[_0x589bac];return _0x26a374;};'use strict';var _=require(_0x2e65('0x0'));var client=require(_0x2e65('0x1'));exports[_0x2e65('0x2')]=function(_0x187c76){return client[_0x2e65('0x3')](_0x2e65('0x4'),{'body':_[_0x2e65('0x5')](_0x187c76,{'value':_0x187c76[_0x2e65('0x6')]}),'log':_0x2e65('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 5010219..f554c51 100644 --- a/server/services/ami/rpc/voiceTransferReport.js +++ b/server/services/ami/rpc/voiceTransferReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6547=['transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','origtransferercontext','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten'];(function(_0x4df1df,_0xe40373){var _0x29d671=function(_0x268bbd){while(--_0x268bbd){_0x4df1df['push'](_0x4df1df['shift']());}};_0x29d671(++_0xe40373);}(_0x6547,0xb8));var _0x7654=function(_0x2e35eb,_0x34a5f1){_0x2e35eb=_0x2e35eb-0x0;var _0xae60fc=_0x6547[_0x2e35eb];return _0xae60fc;};'use strict';var client=require('../client');exports[_0x7654('0x0')]={};exports[_0x7654('0x1')]=function(_0x372a0b){return client[_0x7654('0x2')](_0x7654('0x3'),{'body':{'result':_0x372a0b['result'],'transfererchannel':_0x372a0b[_0x7654('0x4')],'transferercalleridnum':_0x372a0b[_0x7654('0x5')],'transferercalleridname':_0x372a0b[_0x7654('0x6')],'transfererconnectedlinenum':_0x372a0b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x372a0b[_0x7654('0x7')],'transfereraccountcode':_0x372a0b[_0x7654('0x8')],'transferercontext':_0x372a0b[_0x7654('0x9')],'transfererexten':_0x372a0b[_0x7654('0xa')],'transfererlinkedid':_0x372a0b[_0x7654('0xb')],'transfereechannel':_0x372a0b[_0x7654('0xc')],'transfereecalleridnum':_0x372a0b[_0x7654('0xd')],'transfereecalleridname':_0x372a0b['transfereecalleridname'],'transfereeconnectedlinenum':_0x372a0b[_0x7654('0xe')],'transfereeconnectedlinename':_0x372a0b[_0x7654('0xf')],'transfereeaccountcode':_0x372a0b[_0x7654('0x10')],'transfereecontext':_0x372a0b['transfereecontext'],'transfereeexten':_0x372a0b[_0x7654('0x11')],'transfereelinkedid':_0x372a0b[_0x7654('0x12')],'isexternal':_0x372a0b[_0x7654('0x13')],'context':_0x372a0b[_0x7654('0x14')],'extension':_0x372a0b[_0x7654('0x15')],'type':'blind'},'log':_0x7654('0x3')});};exports[_0x7654('0x16')]=function(_0x4e5a79){return client[_0x7654('0x2')](_0x7654('0x3'),{'body':{'result':_0x4e5a79[_0x7654('0x17')],'transfererchannel':_0x4e5a79['origtransfererchannel'],'transferercalleridnum':_0x4e5a79[_0x7654('0x18')],'transferercalleridname':_0x4e5a79[_0x7654('0x19')],'transfererconnectedlinenum':_0x4e5a79[_0x7654('0x1a')],'transfererconnectedlinename':_0x4e5a79[_0x7654('0x1b')],'transfereraccountcode':_0x4e5a79[_0x7654('0x1c')],'transferercontext':_0x4e5a79[_0x7654('0x1d')],'transfererexten':_0x4e5a79[_0x7654('0x1e')],'transfererlinkedid':_0x4e5a79['origtransfererlinkedid'],'transfereechannel':_0x4e5a79[_0x7654('0x1f')],'transfereecalleridnum':_0x4e5a79[_0x7654('0x20')],'transfereecalleridname':_0x4e5a79[_0x7654('0x21')],'transfereeconnectedlinenum':_0x4e5a79[_0x7654('0x22')],'transfereeconnectedlinename':_0x4e5a79['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4e5a79['transfertargetaccountcode'],'transfereecontext':_0x4e5a79[_0x7654('0x23')],'transfereeexten':_0x4e5a79[_0x7654('0x24')],'transfereelinkedid':_0x4e5a79['transfertargetlinkedid'],'isexternal':_0x4e5a79[_0x7654('0x13')],'context':_0x4e5a79[_0x7654('0x25')],'extension':_0x4e5a79['origtransfererexten'],'type':_0x7654('0x26')},'log':_0x7654('0x3')});}; \ No newline at end of file +var _0x97fd=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x97fd,0x81));var _0xd97f=function(_0x590abd,_0x10735a){_0x590abd=_0x590abd-0x0;var _0x116a72=_0x97fd[_0x590abd];return _0x116a72;};'use strict';var client=require(_0xd97f('0x0'));exports[_0xd97f('0x1')]={};exports[_0xd97f('0x2')]=function(_0x402734){return client[_0xd97f('0x3')](_0xd97f('0x4'),{'body':{'result':_0x402734['result'],'transfererchannel':_0x402734[_0xd97f('0x5')],'transferercalleridnum':_0x402734[_0xd97f('0x6')],'transferercalleridname':_0x402734[_0xd97f('0x7')],'transfererconnectedlinenum':_0x402734['transfererconnectedlinenum'],'transfererconnectedlinename':_0x402734[_0xd97f('0x8')],'transfereraccountcode':_0x402734[_0xd97f('0x9')],'transferercontext':_0x402734[_0xd97f('0xa')],'transfererexten':_0x402734[_0xd97f('0xb')],'transfererlinkedid':_0x402734['transfererlinkedid'],'transfereechannel':_0x402734[_0xd97f('0xc')],'transfereecalleridnum':_0x402734[_0xd97f('0xd')],'transfereecalleridname':_0x402734[_0xd97f('0xe')],'transfereeconnectedlinenum':_0x402734[_0xd97f('0xf')],'transfereeconnectedlinename':_0x402734[_0xd97f('0x10')],'transfereeaccountcode':_0x402734[_0xd97f('0x11')],'transfereecontext':_0x402734['transfereecontext'],'transfereeexten':_0x402734['transfereeexten'],'transfereelinkedid':_0x402734[_0xd97f('0x12')],'isexternal':_0x402734[_0xd97f('0x13')],'context':_0x402734[_0xd97f('0x14')],'extension':_0x402734[_0xd97f('0x15')],'type':_0xd97f('0x16')},'log':_0xd97f('0x4')});};exports[_0xd97f('0x17')]=function(_0x5d2909){return client[_0xd97f('0x3')](_0xd97f('0x4'),{'body':{'result':_0x5d2909[_0xd97f('0x18')],'transfererchannel':_0x5d2909['origtransfererchannel'],'transferercalleridnum':_0x5d2909[_0xd97f('0x19')],'transferercalleridname':_0x5d2909[_0xd97f('0x1a')],'transfererconnectedlinenum':_0x5d2909[_0xd97f('0x1b')],'transfererconnectedlinename':_0x5d2909[_0xd97f('0x1c')],'transfereraccountcode':_0x5d2909[_0xd97f('0x1d')],'transferercontext':_0x5d2909[_0xd97f('0x1e')],'transfererexten':_0x5d2909['secondtransfererexten'],'transfererlinkedid':_0x5d2909[_0xd97f('0x1f')],'transfereechannel':_0x5d2909[_0xd97f('0x20')],'transfereecalleridnum':_0x5d2909['transfertargetcalleridnum'],'transfereecalleridname':_0x5d2909['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5d2909[_0xd97f('0x21')],'transfereeconnectedlinename':_0x5d2909[_0xd97f('0x22')],'transfereeaccountcode':_0x5d2909[_0xd97f('0x23')],'transfereecontext':_0x5d2909[_0xd97f('0x24')],'transfereeexten':_0x5d2909[_0xd97f('0x25')],'transfereelinkedid':_0x5d2909[_0xd97f('0x26')],'isexternal':_0x5d2909[_0xd97f('0x13')],'context':_0x5d2909[_0xd97f('0x27')],'extension':_0x5d2909['origtransfererexten'],'type':_0xd97f('0x28')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index a1e1b50..b4c53af 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe059=['queueChannels','voicequeuechannel','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','validate','bluebird','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','error','asterisk','username','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','talking','total','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','length','isConnected','ami\x20disconnected','voicechannel','map','find','channels','uniqueid','format','%s.%s','filename','wav','channel','ai(mixmonitorid)','monitors','isNil','push','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','destinationchannel','StopMixMonitor','status','stop','/var/spool/asterisk/monitor/','values'];(function(_0x68fcae,_0x2d1f8f){var _0x5e4ff1=function(_0x116ca8){while(--_0x116ca8){_0x68fcae['push'](_0x68fcae['shift']());}};_0x5e4ff1(++_0x2d1f8f);}(_0xe059,0x125));var _0x9e05=function(_0x545e7c,_0x7cee70){_0x545e7c=_0x545e7c-0x0;var _0x5c9897=_0xe059[_0x545e7c];return _0x5c9897;};'use strict';var _=require('lodash');var util=require(_0x9e05('0x0'));var jayson=require('jayson/promise');var schema=require(_0x9e05('0x1'));var BPromise=require(_0x9e05('0x2'));var moment=require('moment');var config=require(_0x9e05('0x3'));var properties=require(_0x9e05('0x4'));var ami=require(_0x9e05('0x5'));exports[_0x9e05('0x6')]=function(_0x476800,_0x41ea82,_0x2032c3){return new BPromise(function(_0x522534,_0x41e6c9){var _0x366a2d={'QueuePause':function(_0x4761dd){return new Promise(function(_0x511766,_0x47344e){var _0x25ae3c=util['format'](_0x9e05('0x7'),_0x9e05('0x8'),_0x4761dd[_0x9e05('0x9')]);if(_0x476800[_0x9e05('0xa')]&&_0x476800['timers'][_0x25ae3c]&&_0x476800[_0x9e05('0xa')][_0x25ae3c][_0x9e05('0xb')]){_0x476800[_0x9e05('0xa')][_0x25ae3c][_0x9e05('0xc')]();}if(_0x476800['agents'][_0x25ae3c]){_0x476800[_0x9e05('0xd')][_0x25ae3c]['updateStatusRealtime']({'statePause':_0x4761dd[_0x9e05('0xe')]?!![]:![]});}_0x511766({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x6ed231){var _0x17a532=this;return new Promise(function(_0x4351f7,_0x21e4fe){if(ami['isConnected']()==![]){return _0x21e4fe(_0x17a532[_0x9e05('0xf')](0x1f4,[config[_0x9e05('0x10')]['ip'],config['asterisk'][_0x9e05('0x11')],'ami\x20disconnected'][_0x9e05('0x12')]('\x20')));}_0x6ed231=_[_0x9e05('0x13')](_0x6ed231,_[_0x9e05('0x14')](properties[_0x9e05('0x15')]));_0x6ed231[_0x9e05('0x16')]=_0x9e05('0x17');return ami[_0x9e05('0x18')](_0x6ed231)[_0x9e05('0x19')](function(_0x4df91a){_0x4351f7({'code':0xc8,'message':_0x4df91a[_0x9e05('0x1a')]});})[_0x9e05('0x1b')](function(_0x5e9ca5){_0x21e4fe(_0x17a532[_0x9e05('0xf')](0x1f5,_0x5e9ca5[_0x9e05('0x1a')]));});});},'Command':function(_0x1d7e6a){var _0x810740=this;return new Promise(function(_0x4a9ea3,_0x28530d){if(ami['isConnected']()==![]){return _0x28530d(_0x810740[_0x9e05('0xf')](0x1f4,[config[_0x9e05('0x10')]['ip'],config['asterisk'][_0x9e05('0x11')],'ami\x20disconnected'][_0x9e05('0x12')]('\x20')));}_0x1d7e6a=_[_0x9e05('0x13')](_0x1d7e6a,_0x9e05('0x1c'));_0x1d7e6a[_0x9e05('0x16')]=_0x9e05('0x1d');return ami['Action'](_0x1d7e6a)['then'](function(_0x223974){_0x4a9ea3({'code':0xc8,'message':_0x223974[_0x9e05('0x1e')]});})[_0x9e05('0x1b')](function(_0x4bd5dd){_0x28530d(_0x810740['error'](0x1f5,_0x4bd5dd['message']));});});},'VoiceQueues':function(_0x47997f){return new Promise(function(_0x392f74,_0x1ac29f){var _0x4f657e=[];for(var _0x3fd0d7 in _0x476800[_0x9e05('0x1f')]){if(_0x476800[_0x9e05('0x1f')][_0x9e05('0x20')](_0x3fd0d7)){var _0x545f0b=_0x476800[_0x9e05('0x1f')][_0x3fd0d7];var _0x3079bf={'id':_0x545f0b['id'],'name':_0x545f0b[_0x9e05('0x9')],'strategy':_0x545f0b[_0x9e05('0x21')],'answered':_0x545f0b[_0x9e05('0x22')],'available':_0x545f0b[_0x9e05('0x23')],'loggedIn':_0x545f0b[_0x9e05('0x24')],'pTalking':_0x545f0b[_0x9e05('0x25')],'sumBillable':_0x545f0b['sumBillable'],'sumDuration':_0x545f0b[_0x9e05('0x26')],'sumHoldTime':_0x545f0b['sumHoldTime']||0x0,'talking':_0x545f0b[_0x9e05('0x27')],'total':_0x545f0b[_0x9e05('0x28')],'type':_0x545f0b['type'],'unmanaged':_0x545f0b['unmanaged'],'abandoned':_0x545f0b[_0x9e05('0x29')],'waiting':_0x545f0b['waiting'],'loggedInDb':_0x545f0b[_0x9e05('0x2a')]};if(_0x545f0b['type']===_0x9e05('0x2b')){_0x3079bf[_0x9e05('0x2c')]=_0x545f0b['dialActive'];_0x3079bf['dialMethod']=_0x545f0b[_0x9e05('0x2d')];_0x3079bf['dialOriginateCallerIdName']=_0x545f0b[_0x9e05('0x2e')];_0x3079bf[_0x9e05('0x2f')]=_0x545f0b[_0x9e05('0x2f')];_0x3079bf['dialOriginateTimeout']=_0x545f0b['dialOriginateTimeout'];_0x3079bf['dialPrefix']=_0x545f0b[_0x9e05('0x30')];_0x3079bf[_0x9e05('0x31')]=_0x545f0b[_0x9e05('0x31')];_0x3079bf['outboundAnswerCallsDay']=_0x545f0b[_0x9e05('0x32')];_0x3079bf[_0x9e05('0x33')]=_0x545f0b[_0x9e05('0x33')];_0x3079bf[_0x9e05('0x34')]=_0x545f0b[_0x9e05('0x34')];_0x3079bf[_0x9e05('0x35')]=_0x545f0b[_0x9e05('0x35')];_0x3079bf[_0x9e05('0x36')]=_0x545f0b[_0x9e05('0x36')];_0x3079bf[_0x9e05('0x37')]=_0x545f0b[_0x9e05('0x37')];_0x3079bf[_0x9e05('0x38')]=_0x545f0b['outboundDropCallsDayTimeout'];_0x3079bf[_0x9e05('0x39')]=_0x545f0b[_0x9e05('0x39')];_0x3079bf[_0x9e05('0x3a')]=_0x545f0b[_0x9e05('0x3a')];_0x3079bf[_0x9e05('0x3b')]=_0x545f0b[_0x9e05('0x3b')];_0x3079bf[_0x9e05('0x3c')]=_0x545f0b[_0x9e05('0x3c')];_0x3079bf[_0x9e05('0x3d')]=_0x545f0b[_0x9e05('0x3d')];_0x3079bf[_0x9e05('0x3e')]=_0x545f0b[_0x9e05('0x3e')];_0x3079bf[_0x9e05('0x3f')]=_0x545f0b['predictiveIntervalAnsweredCalls'];_0x3079bf['predictiveIntervalAvgHoldtime']=_0x545f0b['predictiveIntervalAvgHoldtime'];_0x3079bf[_0x9e05('0x40')]=_0x545f0b[_0x9e05('0x40')];_0x3079bf['predictiveIntervalDroppedCallsCallersExit']=_0x545f0b[_0x9e05('0x41')];_0x3079bf[_0x9e05('0x42')]=_0x545f0b[_0x9e05('0x42')];_0x3079bf[_0x9e05('0x43')]=_0x545f0b[_0x9e05('0x43')];_0x3079bf[_0x9e05('0x44')]=_0x545f0b[_0x9e05('0x44')];_0x3079bf[_0x9e05('0x45')]=_0x545f0b[_0x9e05('0x45')];_0x3079bf['predictiveIntervalMultiplicativeFactor']=_0x545f0b[_0x9e05('0x46')];_0x3079bf[_0x9e05('0x47')]=_0x545f0b['predictiveIntervalPauses'];_0x3079bf[_0x9e05('0x48')]=_0x545f0b['predictiveIntervalAvailable'];_0x3079bf[_0x9e05('0x49')]=_0x545f0b[_0x9e05('0x49')];_0x3079bf[_0x9e05('0x1a')]=_0x545f0b[_0x9e05('0x1a')];_0x3079bf[_0x9e05('0x4a')]=_0x545f0b[_0x9e05('0x4a')];_0x3079bf[_0x9e05('0x4b')]=_0x545f0b[_0x9e05('0x4b')];_0x3079bf['erlangCallToSecond']=_0x545f0b['erlangCallToSecond'];_0x3079bf[_0x9e05('0x4c')]=_0x545f0b[_0x9e05('0x4c')];_0x3079bf['erlangBusyFactor']=_0x545f0b[_0x9e05('0x4d')];_0x3079bf['startPredictive']=_0x545f0b[_0x9e05('0x4e')];_0x3079bf[_0x9e05('0x4f')]=_0x545f0b[_0x9e05('0x4f')];}if(_0x545f0b[_0x9e05('0x50')]){_0x3079bf[_0x9e05('0x50')]={'id':_0x545f0b['Trunk']['id'],'name':_0x545f0b[_0x9e05('0x50')][_0x9e05('0x9')],'active':_0x545f0b[_0x9e05('0x50')]['active'],'callerid':_0x545f0b[_0x9e05('0x50')][_0x9e05('0x51')]};}if(_0x545f0b[_0x9e05('0x52')]){_0x3079bf[_0x9e05('0x52')]={'id':_0x545f0b[_0x9e05('0x52')]['id'],'name':_0x545f0b[_0x9e05('0x52')]['name']};}_0x4f657e['push'](_0x3079bf);}}_0x392f74({'count':_0x4f657e[_0x9e05('0x53')],'rows':_0x4f657e});});},'VoiceChannels':function(_0x3f1489){return new Promise(function(_0x16aa1a,_0x567ee6){var _0x2f046c=_['values'](_0x476800['channels']);_0x16aa1a({'count':_0x2f046c[_0x9e05('0x53')],'rows':_0x2f046c});});},'VoiceChannelMixMonitor':function(_0x48a9dd){var _0x496761=this;return new Promise(function(_0x388a97,_0xf9c50e){if(ami[_0x9e05('0x54')]()==![]){return _0xf9c50e(_0x496761[_0x9e05('0xf')](0x1f4,[config[_0x9e05('0x10')]['ip'],config[_0x9e05('0x10')][_0x9e05('0x11')],_0x9e05('0x55')][_0x9e05('0x12')]('\x20')));}var _0x1b02ce=schema(properties[_0x9e05('0x56')])['validate'](_0x48a9dd);if(_0x1b02ce[_0x9e05('0x53')]>0x0){return _0xf9c50e(_0x496761[_0x9e05('0xf')](0x1f4,_[_0x9e05('0x57')](_0x1b02ce,_0x9e05('0x1a'))['join'](',\x20')));}var _0x3c1d6c=_[_0x9e05('0x58')](_0x476800[_0x9e05('0x59')],{'uniqueid':_0x48a9dd[_0x9e05('0x5a')]});if(_0x3c1d6c&&_0x3c1d6c['channel']){var _0x573b18=util[_0x9e05('0x5b')](_0x9e05('0x5c'),_0x48a9dd[_0x9e05('0x5d')]||_0x48a9dd['uniqueid'],_0x48a9dd[_0x9e05('0x5b')]||_0x9e05('0x5e'));return ami[_0x9e05('0x18')]({'action':'MixMonitor','channel':_0x3c1d6c[_0x9e05('0x5f')],'file':_0x573b18,'options':_0x9e05('0x60')})[_0x9e05('0x19')](function(_0x3ebde1){var _0x592c67=_[_0x9e05('0x58')](_0x3c1d6c[_0x9e05('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x573b18['toLowerCase']()});if(_[_0x9e05('0x62')](_0x592c67)){_0x3c1d6c[_0x9e05('0x61')][_0x9e05('0x63')]({'filename':'/var/spool/asterisk/monitor/'+_0x573b18[_0x9e05('0x64')](),'createdAt':moment()[_0x9e05('0x5b')](_0x9e05('0x65')),'mixmonitorid':_0x3ebde1[_0x9e05('0x66')],'status':_0x9e05('0x67')});}else{_0x592c67['mixmonitorid']=_0x3ebde1['mixmonitorid'];_0x592c67['status']=_0x9e05('0x67');}_0x388a97({'code':0xc8,'message':[_0x48a9dd[_0x9e05('0x5a')],_0x9e05('0x68'),_0x3ebde1[_0x9e05('0x66')]]['join']('\x20'),'mixmonitorid':_0x3ebde1[_0x9e05('0x66')]});})[_0x9e05('0x1b')](function(_0x30bfea){_0xf9c50e(_0x496761[_0x9e05('0xf')](0x1f5,[_0x48a9dd[_0x9e05('0x5a')],_0x30bfea[_0x9e05('0x1a')][_0x9e05('0x64')]()]['join']('\x20')));});}else{return _0xf9c50e(_0x496761[_0x9e05('0xf')](0x1f5,_0x9e05('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x189b59){var _0x4f931f=this;return new Promise(function(_0x8d7a74,_0x22f7d9){if(ami[_0x9e05('0x54')]()==![]){return _0x22f7d9(_0x4f931f[_0x9e05('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x9e05('0x10')][_0x9e05('0x11')],'ami\x20disconnected']['join']('\x20')));}var _0x4b5887=schema(properties[_0x9e05('0x56')])[_0x9e05('0x1')](_0x189b59);if(_0x4b5887[_0x9e05('0x53')]>0x0){return _0x22f7d9(_0x4f931f[_0x9e05('0xf')](0x1f4,_[_0x9e05('0x57')](_0x4b5887,'message')['join'](',\x20')));}var _0x3d8a93=_['find'](_0x476800[_0x9e05('0x59')],{'uniqueid':_0x189b59['uniqueid']});if(_0x3d8a93){return BPromise['resolve']()[_0x9e05('0x19')](function(){if(_0x3d8a93[_0x9e05('0x5f')]){return ami[_0x9e05('0x18')]({'action':'StopMixMonitor','channel':_0x3d8a93['channel'],'mixmonitorid':_0x189b59['mixmonitorid']})['catch'](function(_0x4961ab){});}})[_0x9e05('0x19')](function(){if(_0x3d8a93[_0x9e05('0x6a')]){return ami[_0x9e05('0x18')]({'action':_0x9e05('0x6b'),'channel':_0x3d8a93[_0x9e05('0x6a')],'mixmonitorid':_0x189b59[_0x9e05('0x66')]})['catch'](function(_0xe2facf){});}})['then'](function(_0x5240fc){var _0x10f6d8=_[_0x9e05('0x58')](_0x3d8a93[_0x9e05('0x61')],{'mixmonitorid':_0x189b59[_0x9e05('0x66')]});if(_0x10f6d8){_0x10f6d8[_0x9e05('0x6c')]=_0x9e05('0x6d');}})['then'](function(){var _0x48b4b7=util[_0x9e05('0x5b')]('%s.%s',_0x189b59['filename']||_0x189b59['uniqueid'],_0x189b59['format']||_0x9e05('0x5e'));var _0x129a3c=_[_0x9e05('0x58')](_0x3d8a93[_0x9e05('0x61')],{'filename':_0x9e05('0x6e')+_0x48b4b7['toLowerCase']()});if(_0x129a3c){_0x129a3c['status']=_0x9e05('0x6d');}})[_0x9e05('0x19')](function(){_0x8d7a74({'code':0xc8,'message':[_0x189b59[_0x9e05('0x5a')],'StopMixMonitor\x20Success'][_0x9e05('0x12')]('\x20')});})[_0x9e05('0x1b')](function(_0x32b104){_0x22f7d9(_0x4f931f[_0x9e05('0xf')](0x1f5,[_0x189b59[_0x9e05('0x5a')],_0x32b104[_0x9e05('0x1a')][_0x9e05('0x64')]()]['join']('\x20')));});}else{return _0x22f7d9(_0x4f931f[_0x9e05('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1d1a7e){return new Promise(function(_0x100ada,_0x203f2e){var _0x281f63=_[_0x9e05('0x6f')](_0x476800[_0x9e05('0x70')]);_0x100ada({'count':_0x281f63['length'],'rows':_0x281f63});});},'VoiceQueuesChannel':function(_0x581906){var _0x1830f0=this;return new Promise(function(_0x454c15,_0x66375b){var _0x354f65=schema(properties[_0x9e05('0x71')])[_0x9e05('0x1')](_0x581906);if(_0x354f65[_0x9e05('0x53')]>0x0){return _0x66375b(_0x1830f0['error'](0x1f4,_[_0x9e05('0x57')](_0x354f65,'message')[_0x9e05('0x12')](',\x20')));}var _0x2591b1=_[_0x9e05('0x58')](_0x476800[_0x9e05('0x70')],{'uniqueid':_0x581906[_0x9e05('0x5a')]});if(_0x2591b1){_0x454c15(_0x2591b1);}else{return _0x66375b(_0x1830f0[_0x9e05('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x421516){var _0x5883ee=this;return new Promise(function(_0x963a1a,_0x251ce4){if(ami[_0x9e05('0x54')]()==![]){return _0x251ce4(_0x5883ee[_0x9e05('0xf')](0x1f4,[config[_0x9e05('0x10')]['ip'],config[_0x9e05('0x10')][_0x9e05('0x11')],_0x9e05('0x55')]['join']('\x20')));}var _0x520541=schema(properties['voicequeuechannelhangup'])['validate'](_0x421516);if(_0x520541[_0x9e05('0x53')]>0x0){return _0x251ce4(_0x5883ee['error'](0x1f4,_[_0x9e05('0x57')](_0x520541,_0x9e05('0x1a'))['join'](',\x20')));}var _0x2032c2=_[_0x9e05('0x58')](_0x476800[_0x9e05('0x70')],{'uniqueid':_0x421516[_0x9e05('0x5a')]});if(_0x2032c2&&_0x2032c2[_0x9e05('0x5f')]){return ami['Action']({'action':'Hangup','channel':_0x2032c2[_0x9e05('0x5f')]})[_0x9e05('0x19')](function(_0x34e78b){_0x963a1a({'code':0xc8,'message':[_0x421516[_0x9e05('0x5a')],_0x34e78b[_0x9e05('0x1a')][_0x9e05('0x64')]()][_0x9e05('0x12')]('\x20')});})[_0x9e05('0x1b')](function(_0xc7c7fb){_0x251ce4(_0x5883ee[_0x9e05('0xf')](0x1f5,[_0x421516['uniqueid'],_0xc7c7fb[_0x9e05('0x1a')][_0x9e05('0x64')]()][_0x9e05('0x12')]('\x20')));});}else{return _0x251ce4(_0x5883ee['error'](0x1f5,_0x9e05('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x53dcd3){var _0x19c11c=this;return new Promise(function(_0xc92c63,_0x5db17b){if(ami['isConnected']()==![]){return _0x5db17b(_0x19c11c[_0x9e05('0xf')](0x1f4,[config[_0x9e05('0x10')]['ip'],config[_0x9e05('0x10')]['username'],_0x9e05('0x55')]['join']('\x20')));}var _0x179a3b=schema(properties[_0x9e05('0x72')])[_0x9e05('0x1')](_0x53dcd3);if(_0x179a3b[_0x9e05('0x53')]>0x0){return _0x5db17b(_0x19c11c['error'](0x1f4,_[_0x9e05('0x57')](_0x179a3b,_0x9e05('0x1a'))[_0x9e05('0x12')](',\x20')));}var _0x3c573b=_['find'](_0x476800['queueChannels'],{'uniqueid':_0x53dcd3[_0x9e05('0x5a')]});if(_0x3c573b&&_0x3c573b[_0x9e05('0x5f')]){return ami[_0x9e05('0x18')]({'action':'Redirect','channel':_0x3c573b[_0x9e05('0x5f')],'exten':_0x53dcd3[_0x9e05('0x73')],'context':_0x53dcd3[_0x9e05('0x74')]||_0x3c573b[_0x9e05('0x74')],'priority':0x1})[_0x9e05('0x19')](function(_0x175dbf){_0xc92c63({'code':0xc8,'message':[_0x53dcd3['uniqueid'],_0x175dbf['message']['toLowerCase']()][_0x9e05('0x12')]('\x20')});})[_0x9e05('0x1b')](function(_0xf4113e){_0x5db17b(_0x19c11c[_0x9e05('0xf')](0x1f5,[_0x53dcd3[_0x9e05('0x5a')],_0xf4113e[_0x9e05('0x1a')][_0x9e05('0x64')]()][_0x9e05('0x12')]('\x20')));});}else{return _0x5db17b(_0x19c11c['error'](0x1f5,_0x9e05('0x69')));}});},'Agents':function(_0x56588d){return new Promise(function(_0x3b52a4,_0xd42c55){var _0x1416d4=_[_0x9e05('0x6f')](_0x476800[_0x9e05('0xd')]);_0x3b52a4({'count':_0x1416d4[_0x9e05('0x53')],'rows':_0x1416d4});});},'Telephones':function(_0x4b501d){return new Promise(function(_0x49f85c,_0x583860){var _0x2705df=_[_0x9e05('0x6f')](_0x476800[_0x9e05('0x75')]);_0x49f85c({'count':_0x2705df['length'],'rows':_0x2705df});});},'Trunks':function(_0x4ecfec){return new Promise(function(_0x3621ef,_0x6409b7){var _0xd3a0bb=_[_0x9e05('0x6f')](_0x476800[_0x9e05('0x76')]);_0x3621ef({'count':_0xd3a0bb[_0x9e05('0x53')],'rows':_0xd3a0bb});});},'OutboundChannels':function(_0x309b1e){return new Promise(function(_0x25ed83,_0x9caf46){var _0x1ac8e8=_[_0x9e05('0x6f')](_0x476800[_0x9e05('0x77')]);_0x25ed83({'count':_0x1ac8e8['length'],'rows':_0x1ac8e8});});},'Outbound':function(_0x11eaaf){return new Promise(function(_0x5f1388,_0x319dc6){_0x5f1388(_0x476800[_0x9e05('0x2b')]);});},'Campaigns':function(_0x2ebbdb){return new Promise(function(_0x303c0e,_0xc37c2b){var _0x12c21b=_['values'](_0x476800[_0x9e05('0x78')]);_0x303c0e({'count':_0x12c21b[_0x9e05('0x53')],'rows':_0x12c21b});});},'VoiceQueuesPreview':function(_0x16a822){var _0x341c50=this;return new Promise(function(_0x2dc28f,_0x489e79){_0x41ea82[_0x9e05('0x79')](_0x16a822['id'])['then'](function(_0x4ff7b8){_0x2dc28f({'code':0xc8,'message':_0x4ff7b8[_0x9e05('0x1a')]});})['catch'](function(_0x559483){_0x489e79(_0x341c50[_0x9e05('0xf')](0x1f4,_0x559483[_0x9e05('0x1a')]));});});},'EventManager':function(_0x233e12){var _0x19a930=this;return new Promise(function(_0x1a14b3,_0x2221e3){if(!_0x233e12[_0x9e05('0x7a')]){return _0x2221e3(_0x19a930['error'](0x1f4,_0x9e05('0x7b')));}ami[_0x9e05('0x7c')](_0x9e05('0x7d')+_0x233e12[_0x9e05('0x7a')],_0x233e12[_0x9e05('0x1a')]);_0x1a14b3({'code':0xc8,'message':_0x233e12});});},'FaxAccounts':function(_0x346bbc){return new Promise(function(_0x26a239,_0x13b3b9){var _0x2c65b9=_[_0x9e05('0x6f')](_0x476800[_0x9e05('0x7e')]);_0x26a239({'count':_0x2c65b9[_0x9e05('0x53')],'rows':_0x2c65b9});});},'SendFax':function(_0x175f95){var _0x3d5d19=this;return new Promise(function(_0x3577c4,_0x200d25){_0x2032c3[_0x9e05('0x7f')](_0x175f95)[_0x9e05('0x19')](function(_0x9db9d7){_0x3577c4({'code':0xc8,'message':_0x9db9d7[_0x9e05('0x1a')]});})[_0x9e05('0x1b')](function(_0x581648){_0x200d25(_0x3d5d19[_0x9e05('0xf')](0x1f4,_0x581648[_0x9e05('0x1a')]));});});},'CheckAfterSend':function(_0x33fe4e){var _0x2a9f6d=this;return new Promise(function(_0x557b2c,_0x17e2c3){_0x2032c3[_0x9e05('0x80')](_0x33fe4e)[_0x9e05('0x19')](function(_0x3e6d78){_0x557b2c({'code':0xc8,'message':_0x3e6d78[_0x9e05('0x1a')]});})[_0x9e05('0x1b')](function(_0x33e120){_0x17e2c3(_0x2a9f6d['error'](0x1f4,_0x33e120[_0x9e05('0x1a')]));});});}};var _0x25b94a=jayson[_0x9e05('0x81')](_0x366a2d)[_0x9e05('0x82')]();_0x25b94a['on']('error',function(_0x28c4b5){return _0x41e6c9(_0x28c4b5);});_0x25b94a['listen'](0x232a,_0x9e05('0x83'),function(){console[_0x9e05('0x84')](_0x9e05('0x85'),0x232a);return _0x522534(_0x9e05('0x86')+0x232a);});});}; \ No newline at end of file +var _0x99cc=['status','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','module','Reload','Action','message','catch','command','action','Command','then','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','type','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','push','values','join','map','find','channels','uniqueid','channel','%s.%s','wav','MixMonitor','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','voicechannel','length','StopMixMonitor','destinationchannel'];(function(_0x3580ba,_0x22f579){var _0xb5ce9b=function(_0x6dc66b){while(--_0x6dc66b){_0x3580ba['push'](_0x3580ba['shift']());}};_0xb5ce9b(++_0x22f579);}(_0x99cc,0x1b1));var _0xc99c=function(_0x12d496,_0x3c52e0){_0x12d496=_0x12d496-0x0;var _0x5d26dc=_0x99cc[_0x12d496];return _0x5d26dc;};'use strict';var _=require(_0xc99c('0x0'));var util=require(_0xc99c('0x1'));var jayson=require(_0xc99c('0x2'));var schema=require(_0xc99c('0x3'));var BPromise=require(_0xc99c('0x4'));var moment=require(_0xc99c('0x5'));var config=require(_0xc99c('0x6'));var properties=require(_0xc99c('0x7'));var ami=require('../ami');exports[_0xc99c('0x8')]=function(_0x332d54,_0x185a9e,_0x201d6c){return new BPromise(function(_0x1e1030,_0xa2a2d7){var _0x5cd0f1={'QueuePause':function(_0x1dfda6){return new Promise(function(_0x2b1ea4,_0x424761){var _0xcbe027=util[_0xc99c('0x9')](_0xc99c('0xa'),_0xc99c('0xb'),_0x1dfda6[_0xc99c('0xc')]);if(_0x332d54[_0xc99c('0xd')]&&_0x332d54[_0xc99c('0xd')][_0xcbe027]&&_0x332d54[_0xc99c('0xd')][_0xcbe027][_0xc99c('0xe')]){_0x332d54[_0xc99c('0xd')][_0xcbe027][_0xc99c('0xf')]();}if(_0x332d54[_0xc99c('0x10')][_0xcbe027]){_0x332d54[_0xc99c('0x10')][_0xcbe027][_0xc99c('0x11')]({'statePause':_0x1dfda6[_0xc99c('0x12')]?!![]:![]});}_0x2b1ea4({'code':0xc8,'message':_0xc99c('0x13')});});},'Reload':function(_0x12568b){var _0x18fd8d=this;return new Promise(function(_0xb1d02b,_0x9171fd){if(ami[_0xc99c('0x14')]()==![]){return _0x9171fd(_0x18fd8d[_0xc99c('0x15')](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')][_0xc99c('0x17')],_0xc99c('0x18')]['join']('\x20')));}_0x12568b=_[_0xc99c('0x19')](_0x12568b,_[_0xc99c('0x1a')](properties[_0xc99c('0x1b')]));_0x12568b['action']=_0xc99c('0x1c');return ami[_0xc99c('0x1d')](_0x12568b)['then'](function(_0x472aeb){_0xb1d02b({'code':0xc8,'message':_0x472aeb[_0xc99c('0x1e')]});})[_0xc99c('0x1f')](function(_0x376ad7){_0x9171fd(_0x18fd8d['error'](0x1f5,_0x376ad7['message']));});});},'Command':function(_0x327989){var _0x339afb=this;return new Promise(function(_0x30c0dd,_0x224fa6){if(ami[_0xc99c('0x14')]()==![]){return _0x224fa6(_0x339afb['error'](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')][_0xc99c('0x17')],_0xc99c('0x18')]['join']('\x20')));}_0x327989=_[_0xc99c('0x19')](_0x327989,_0xc99c('0x20'));_0x327989[_0xc99c('0x21')]=_0xc99c('0x22');return ami['Action'](_0x327989)[_0xc99c('0x23')](function(_0x467ae0){_0x30c0dd({'code':0xc8,'message':_0x467ae0[_0xc99c('0x24')]});})[_0xc99c('0x1f')](function(_0x514fea){_0x224fa6(_0x339afb[_0xc99c('0x15')](0x1f5,_0x514fea[_0xc99c('0x1e')]));});});},'VoiceQueues':function(_0x267aae){return new Promise(function(_0x3f6203,_0x611f69){var _0x518efe=[];for(var _0x278f85 in _0x332d54[_0xc99c('0x25')]){if(_0x332d54[_0xc99c('0x25')]['hasOwnProperty'](_0x278f85)){var _0x1a42ca=_0x332d54[_0xc99c('0x25')][_0x278f85];var _0x547d21={'id':_0x1a42ca['id'],'name':_0x1a42ca['name'],'strategy':_0x1a42ca[_0xc99c('0x26')],'answered':_0x1a42ca[_0xc99c('0x27')],'available':_0x1a42ca[_0xc99c('0x28')],'loggedIn':_0x1a42ca[_0xc99c('0x29')],'pTalking':_0x1a42ca[_0xc99c('0x2a')],'sumBillable':_0x1a42ca['sumBillable'],'sumDuration':_0x1a42ca[_0xc99c('0x2b')],'sumHoldTime':_0x1a42ca[_0xc99c('0x2c')]||0x0,'talking':_0x1a42ca['talking'],'total':_0x1a42ca[_0xc99c('0x2d')],'type':_0x1a42ca[_0xc99c('0x2e')],'unmanaged':_0x1a42ca[_0xc99c('0x2f')],'abandoned':_0x1a42ca['abandoned'],'waiting':_0x1a42ca[_0xc99c('0x30')],'loggedInDb':_0x1a42ca['loggedInDb']};if(_0x1a42ca[_0xc99c('0x2e')]===_0xc99c('0x31')){_0x547d21[_0xc99c('0x32')]=_0x1a42ca[_0xc99c('0x32')];_0x547d21['dialMethod']=_0x1a42ca[_0xc99c('0x33')];_0x547d21[_0xc99c('0x34')]=_0x1a42ca[_0xc99c('0x34')];_0x547d21['dialOriginateCallerIdNumber']=_0x1a42ca[_0xc99c('0x35')];_0x547d21[_0xc99c('0x36')]=_0x1a42ca[_0xc99c('0x36')];_0x547d21[_0xc99c('0x37')]=_0x1a42ca[_0xc99c('0x37')];_0x547d21[_0xc99c('0x38')]=_0x1a42ca[_0xc99c('0x38')];_0x547d21[_0xc99c('0x39')]=_0x1a42ca[_0xc99c('0x39')];_0x547d21['outboundBlacklistCallsDay']=_0x1a42ca[_0xc99c('0x3a')];_0x547d21['outboundBusyCallsDay']=_0x1a42ca[_0xc99c('0x3b')];_0x547d21[_0xc99c('0x3c')]=_0x1a42ca[_0xc99c('0x3c')];_0x547d21[_0xc99c('0x3d')]=_0x1a42ca['outboundDropCallsDayACS'];_0x547d21['outboundDropCallsDayCallersExit']=_0x1a42ca[_0xc99c('0x3e')];_0x547d21[_0xc99c('0x3f')]=_0x1a42ca['outboundDropCallsDayTimeout'];_0x547d21['outboundNoAnswerCallsDay']=_0x1a42ca[_0xc99c('0x40')];_0x547d21[_0xc99c('0x41')]=_0x1a42ca[_0xc99c('0x41')];_0x547d21[_0xc99c('0x42')]=_0x1a42ca['outboundOriginateFailureCallsDay'];_0x547d21[_0xc99c('0x43')]=_0x1a42ca[_0xc99c('0x43')];_0x547d21[_0xc99c('0x44')]=_0x1a42ca[_0xc99c('0x44')];_0x547d21['outboundUnknownCallsDay']=_0x1a42ca['outboundUnknownCallsDay'];_0x547d21[_0xc99c('0x45')]=_0x1a42ca[_0xc99c('0x45')];_0x547d21[_0xc99c('0x46')]=_0x1a42ca[_0xc99c('0x46')];_0x547d21[_0xc99c('0x47')]=_0x1a42ca['predictiveIntervalAvgTalktime'];_0x547d21[_0xc99c('0x48')]=_0x1a42ca[_0xc99c('0x48')];_0x547d21[_0xc99c('0x49')]=_0x1a42ca['predictiveIntervalDroppedCallsTimeout'];_0x547d21[_0xc99c('0x4a')]=_0x1a42ca[_0xc99c('0x4a')];_0x547d21['predictiveIntervalErlangCallsDroppedCalls']=_0x1a42ca[_0xc99c('0x4b')];_0x547d21['predictiveIntervalHitRate']=_0x1a42ca[_0xc99c('0x4c')];_0x547d21[_0xc99c('0x4d')]=_0x1a42ca['predictiveIntervalMultiplicativeFactor'];_0x547d21[_0xc99c('0x4e')]=_0x1a42ca[_0xc99c('0x4e')];_0x547d21['predictiveIntervalAvailable']=_0x1a42ca['predictiveIntervalAvailable'];_0x547d21[_0xc99c('0x4f')]=_0x1a42ca[_0xc99c('0x4f')];_0x547d21[_0xc99c('0x1e')]=_0x1a42ca[_0xc99c('0x1e')];_0x547d21['originated']=_0x1a42ca[_0xc99c('0x50')];_0x547d21['erlangCalls']=_0x1a42ca[_0xc99c('0x51')];_0x547d21[_0xc99c('0x52')]=_0x1a42ca[_0xc99c('0x52')];_0x547d21['erlangAbandonmentRate']=_0x1a42ca['erlangAbandonmentRate'];_0x547d21[_0xc99c('0x53')]=_0x1a42ca[_0xc99c('0x53')];_0x547d21['startPredictive']=_0x1a42ca[_0xc99c('0x54')];_0x547d21[_0xc99c('0x55')]=_0x1a42ca[_0xc99c('0x55')];}if(_0x1a42ca[_0xc99c('0x56')]){_0x547d21['Trunk']={'id':_0x1a42ca[_0xc99c('0x56')]['id'],'name':_0x1a42ca['Trunk'][_0xc99c('0xc')],'active':_0x1a42ca[_0xc99c('0x56')]['active'],'callerid':_0x1a42ca[_0xc99c('0x56')]['callerid']};}if(_0x1a42ca[_0xc99c('0x57')]){_0x547d21[_0xc99c('0x57')]={'id':_0x1a42ca[_0xc99c('0x57')]['id'],'name':_0x1a42ca[_0xc99c('0x57')][_0xc99c('0xc')]};}_0x518efe[_0xc99c('0x58')](_0x547d21);}}_0x3f6203({'count':_0x518efe['length'],'rows':_0x518efe});});},'VoiceChannels':function(_0x2071d9){return new Promise(function(_0x215b85,_0x2b40b0){var _0x2a1d37=_[_0xc99c('0x59')](_0x332d54['channels']);_0x215b85({'count':_0x2a1d37['length'],'rows':_0x2a1d37});});},'VoiceChannelMixMonitor':function(_0xc90184){var _0x56d13f=this;return new Promise(function(_0x29e659,_0x5971a9){if(ami[_0xc99c('0x14')]()==![]){return _0x5971a9(_0x56d13f[_0xc99c('0x15')](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')]['username'],_0xc99c('0x18')][_0xc99c('0x5a')]('\x20')));}var _0x369c26=schema(properties['voicechannel'])[_0xc99c('0x3')](_0xc90184);if(_0x369c26['length']>0x0){return _0x5971a9(_0x56d13f[_0xc99c('0x15')](0x1f4,_[_0xc99c('0x5b')](_0x369c26,'message')[_0xc99c('0x5a')](',\x20')));}var _0x25810f=_[_0xc99c('0x5c')](_0x332d54[_0xc99c('0x5d')],{'uniqueid':_0xc90184[_0xc99c('0x5e')]});if(_0x25810f&&_0x25810f[_0xc99c('0x5f')]){var _0x1e86f4=util['format'](_0xc99c('0x60'),_0xc90184['filename']||_0xc90184[_0xc99c('0x5e')],_0xc90184['format']||_0xc99c('0x61'));return ami[_0xc99c('0x1d')]({'action':_0xc99c('0x62'),'channel':_0x25810f['channel'],'file':_0x1e86f4,'options':'ai(mixmonitorid)'})[_0xc99c('0x23')](function(_0x59ed20){var _0x32f99c=_[_0xc99c('0x5c')](_0x25810f['monitors'],{'filename':_0xc99c('0x63')+_0x1e86f4[_0xc99c('0x64')]()});if(_[_0xc99c('0x65')](_0x32f99c)){_0x25810f[_0xc99c('0x66')][_0xc99c('0x58')]({'filename':_0xc99c('0x63')+_0x1e86f4[_0xc99c('0x64')](),'createdAt':moment()['format'](_0xc99c('0x67')),'mixmonitorid':_0x59ed20[_0xc99c('0x68')],'status':_0xc99c('0x69')});}else{_0x32f99c['mixmonitorid']=_0x59ed20[_0xc99c('0x68')];_0x32f99c['status']=_0xc99c('0x69');}_0x29e659({'code':0xc8,'message':[_0xc90184[_0xc99c('0x5e')],'MixMonitor\x20Success',_0x59ed20[_0xc99c('0x68')]][_0xc99c('0x5a')]('\x20'),'mixmonitorid':_0x59ed20[_0xc99c('0x68')]});})[_0xc99c('0x1f')](function(_0x795113){_0x5971a9(_0x56d13f['error'](0x1f5,[_0xc90184[_0xc99c('0x5e')],_0x795113[_0xc99c('0x1e')][_0xc99c('0x64')]()][_0xc99c('0x5a')]('\x20')));});}else{return _0x5971a9(_0x56d13f[_0xc99c('0x15')](0x1f5,_0xc99c('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x1c9568){var _0x3e800f=this;return new Promise(function(_0x2f38dd,_0x57fd8b){if(ami[_0xc99c('0x14')]()==![]){return _0x57fd8b(_0x3e800f[_0xc99c('0x15')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xc99c('0x18')][_0xc99c('0x5a')]('\x20')));}var _0x1890f6=schema(properties[_0xc99c('0x6b')])['validate'](_0x1c9568);if(_0x1890f6[_0xc99c('0x6c')]>0x0){return _0x57fd8b(_0x3e800f[_0xc99c('0x15')](0x1f4,_[_0xc99c('0x5b')](_0x1890f6,_0xc99c('0x1e'))[_0xc99c('0x5a')](',\x20')));}var _0x1decb1=_[_0xc99c('0x5c')](_0x332d54['channels'],{'uniqueid':_0x1c9568[_0xc99c('0x5e')]});if(_0x1decb1){return BPromise['resolve']()[_0xc99c('0x23')](function(){if(_0x1decb1[_0xc99c('0x5f')]){return ami['Action']({'action':_0xc99c('0x6d'),'channel':_0x1decb1[_0xc99c('0x5f')],'mixmonitorid':_0x1c9568[_0xc99c('0x68')]})['catch'](function(_0x5994e9){});}})[_0xc99c('0x23')](function(){if(_0x1decb1[_0xc99c('0x6e')]){return ami[_0xc99c('0x1d')]({'action':_0xc99c('0x6d'),'channel':_0x1decb1[_0xc99c('0x6e')],'mixmonitorid':_0x1c9568['mixmonitorid']})['catch'](function(_0x596796){});}})[_0xc99c('0x23')](function(_0x19e8c6){var _0x506ce0=_[_0xc99c('0x5c')](_0x1decb1[_0xc99c('0x66')],{'mixmonitorid':_0x1c9568['mixmonitorid']});if(_0x506ce0){_0x506ce0[_0xc99c('0x6f')]=_0xc99c('0x70');}})['then'](function(){var _0x1fc31f=util[_0xc99c('0x9')](_0xc99c('0x60'),_0x1c9568[_0xc99c('0x71')]||_0x1c9568[_0xc99c('0x5e')],_0x1c9568['format']||_0xc99c('0x61'));var _0x4af40b=_[_0xc99c('0x5c')](_0x1decb1[_0xc99c('0x66')],{'filename':'/var/spool/asterisk/monitor/'+_0x1fc31f[_0xc99c('0x64')]()});if(_0x4af40b){_0x4af40b[_0xc99c('0x6f')]=_0xc99c('0x70');}})[_0xc99c('0x23')](function(){_0x2f38dd({'code':0xc8,'message':[_0x1c9568['uniqueid'],_0xc99c('0x72')][_0xc99c('0x5a')]('\x20')});})['catch'](function(_0x4fd5a8){_0x57fd8b(_0x3e800f[_0xc99c('0x15')](0x1f5,[_0x1c9568[_0xc99c('0x5e')],_0x4fd5a8['message'][_0xc99c('0x64')]()][_0xc99c('0x5a')]('\x20')));});}else{return _0x57fd8b(_0x3e800f['error'](0x1f5,_0xc99c('0x6a')));}});},'VoiceQueuesChannels':function(_0xad5a84){return new Promise(function(_0x185123,_0x4cead0){var _0x144a67=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x73')]);_0x185123({'count':_0x144a67[_0xc99c('0x6c')],'rows':_0x144a67});});},'VoiceQueuesChannel':function(_0x48c228){var _0x5abcd9=this;return new Promise(function(_0x281e78,_0x158e67){var _0x3d8629=schema(properties[_0xc99c('0x74')])[_0xc99c('0x3')](_0x48c228);if(_0x3d8629[_0xc99c('0x6c')]>0x0){return _0x158e67(_0x5abcd9['error'](0x1f4,_['map'](_0x3d8629,_0xc99c('0x1e'))[_0xc99c('0x5a')](',\x20')));}var _0x5f52db=_[_0xc99c('0x5c')](_0x332d54[_0xc99c('0x73')],{'uniqueid':_0x48c228['uniqueid']});if(_0x5f52db){_0x281e78(_0x5f52db);}else{return _0x158e67(_0x5abcd9[_0xc99c('0x15')](0x1f5,_0xc99c('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x5855c7){var _0xda8500=this;return new Promise(function(_0x20a9cc,_0x2d7d20){if(ami['isConnected']()==![]){return _0x2d7d20(_0xda8500[_0xc99c('0x15')](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')][_0xc99c('0x17')],_0xc99c('0x18')][_0xc99c('0x5a')]('\x20')));}var _0x1f5212=schema(properties[_0xc99c('0x75')])[_0xc99c('0x3')](_0x5855c7);if(_0x1f5212['length']>0x0){return _0x2d7d20(_0xda8500[_0xc99c('0x15')](0x1f4,_['map'](_0x1f5212,_0xc99c('0x1e'))[_0xc99c('0x5a')](',\x20')));}var _0x4b31ef=_['find'](_0x332d54[_0xc99c('0x73')],{'uniqueid':_0x5855c7[_0xc99c('0x5e')]});if(_0x4b31ef&&_0x4b31ef[_0xc99c('0x5f')]){return ami[_0xc99c('0x1d')]({'action':_0xc99c('0x76'),'channel':_0x4b31ef[_0xc99c('0x5f')]})[_0xc99c('0x23')](function(_0x293ba9){_0x20a9cc({'code':0xc8,'message':[_0x5855c7[_0xc99c('0x5e')],_0x293ba9[_0xc99c('0x1e')][_0xc99c('0x64')]()]['join']('\x20')});})[_0xc99c('0x1f')](function(_0x168583){_0x2d7d20(_0xda8500[_0xc99c('0x15')](0x1f5,[_0x5855c7[_0xc99c('0x5e')],_0x168583[_0xc99c('0x1e')][_0xc99c('0x64')]()][_0xc99c('0x5a')]('\x20')));});}else{return _0x2d7d20(_0xda8500['error'](0x1f5,_0xc99c('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x174e7f){var _0x132bd9=this;return new Promise(function(_0x35d0ef,_0x44b7b9){if(ami[_0xc99c('0x14')]()==![]){return _0x44b7b9(_0x132bd9[_0xc99c('0x15')](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')][_0xc99c('0x17')],_0xc99c('0x18')][_0xc99c('0x5a')]('\x20')));}var _0x932fe0=schema(properties[_0xc99c('0x77')])[_0xc99c('0x3')](_0x174e7f);if(_0x932fe0['length']>0x0){return _0x44b7b9(_0x132bd9['error'](0x1f4,_[_0xc99c('0x5b')](_0x932fe0,'message')['join'](',\x20')));}var _0x3dc321=_[_0xc99c('0x5c')](_0x332d54['queueChannels'],{'uniqueid':_0x174e7f['uniqueid']});if(_0x3dc321&&_0x3dc321[_0xc99c('0x5f')]){return ami[_0xc99c('0x1d')]({'action':'Redirect','channel':_0x3dc321[_0xc99c('0x5f')],'exten':_0x174e7f['exten'],'context':_0x174e7f[_0xc99c('0x78')]||_0x3dc321[_0xc99c('0x78')],'priority':0x1})[_0xc99c('0x23')](function(_0xa746ce){_0x35d0ef({'code':0xc8,'message':[_0x174e7f[_0xc99c('0x5e')],_0xa746ce[_0xc99c('0x1e')][_0xc99c('0x64')]()]['join']('\x20')});})[_0xc99c('0x1f')](function(_0xee0ea6){_0x44b7b9(_0x132bd9[_0xc99c('0x15')](0x1f5,[_0x174e7f[_0xc99c('0x5e')],_0xee0ea6['message'][_0xc99c('0x64')]()]['join']('\x20')));});}else{return _0x44b7b9(_0x132bd9['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x71a73f){return new Promise(function(_0x2767ad,_0x34447c){var _0xbdb7=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x10')]);_0x2767ad({'count':_0xbdb7[_0xc99c('0x6c')],'rows':_0xbdb7});});},'Telephones':function(_0x147e39){return new Promise(function(_0x5796cd,_0x1eeaa1){var _0x156353=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x79')]);_0x5796cd({'count':_0x156353[_0xc99c('0x6c')],'rows':_0x156353});});},'Trunks':function(_0x3bb277){return new Promise(function(_0x5a675c,_0x209b6e){var _0x5198cc=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x7a')]);_0x5a675c({'count':_0x5198cc[_0xc99c('0x6c')],'rows':_0x5198cc});});},'OutboundChannels':function(_0x1c03f0){return new Promise(function(_0x11f5c6,_0x56696f){var _0x4f4540=_['values'](_0x332d54[_0xc99c('0x7b')]);_0x11f5c6({'count':_0x4f4540[_0xc99c('0x6c')],'rows':_0x4f4540});});},'Outbound':function(_0x444ee9){return new Promise(function(_0x4e2816,_0x3fbff3){_0x4e2816(_0x332d54[_0xc99c('0x31')]);});},'Campaigns':function(_0x36c652){return new Promise(function(_0x3cd6da,_0xa3a9a8){var _0x373666=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x7c')]);_0x3cd6da({'count':_0x373666[_0xc99c('0x6c')],'rows':_0x373666});});},'VoiceQueuesPreview':function(_0x1f7ea4){var _0xefe89f=this;return new Promise(function(_0xf883c6,_0x9c8135){_0x185a9e[_0xc99c('0x7d')](_0x1f7ea4['id'])['then'](function(_0x3f3466){_0xf883c6({'code':0xc8,'message':_0x3f3466[_0xc99c('0x1e')]});})[_0xc99c('0x1f')](function(_0x1648d2){_0x9c8135(_0xefe89f['error'](0x1f4,_0x1648d2[_0xc99c('0x1e')]));});});},'EventManager':function(_0x315b38){var _0x367597=this;return new Promise(function(_0x3161ad,_0x343771){if(!_0x315b38[_0xc99c('0x7e')]){return _0x343771(_0x367597[_0xc99c('0x15')](0x1f4,_0xc99c('0x7f')));}ami[_0xc99c('0x80')](_0xc99c('0x81')+_0x315b38[_0xc99c('0x7e')],_0x315b38[_0xc99c('0x1e')]);_0x3161ad({'code':0xc8,'message':_0x315b38});});},'FaxAccounts':function(_0x27f389){return new Promise(function(_0x47f2cb,_0x568c41){var _0x3f061e=_[_0xc99c('0x59')](_0x332d54['faxAccounts']);_0x47f2cb({'count':_0x3f061e[_0xc99c('0x6c')],'rows':_0x3f061e});});},'SendFax':function(_0x44da75){var _0x4eedc1=this;return new Promise(function(_0x1bce8a,_0x1ac82f){_0x201d6c[_0xc99c('0x82')](_0x44da75)[_0xc99c('0x23')](function(_0x170672){_0x1bce8a({'code':0xc8,'message':_0x170672['message']});})[_0xc99c('0x1f')](function(_0xd0ff){_0x1ac82f(_0x4eedc1[_0xc99c('0x15')](0x1f4,_0xd0ff['message']));});});},'CheckAfterSend':function(_0x1dbcc8){var _0x14b65c=this;return new Promise(function(_0x26b986,_0x4d27b6){_0x201d6c['checkAfterSend'](_0x1dbcc8)['then'](function(_0x5838dd){_0x26b986({'code':0xc8,'message':_0x5838dd['message']});})['catch'](function(_0x57f445){_0x4d27b6(_0x14b65c[_0xc99c('0x15')](0x1f4,_0x57f445[_0xc99c('0x1e')]));});});}};var _0x30c293=jayson[_0xc99c('0x83')](_0x5cd0f1)[_0xc99c('0x84')]();_0x30c293['on']('error',function(_0x51484e){return _0xa2a2d7(_0x51484e);});_0x30c293[_0xc99c('0x8')](0x232a,'127.0.0.1',function(){console[_0xc99c('0x85')](_0xc99c('0x86'),0x232a);return _0x1e1030(_0xc99c('0x87')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index a352800..430078c 100644 --- a/server/services/ami/trigger/cmContact/index.js +++ b/server/services/ami/trigger/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x293b=['ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','name','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data2','xmd-contactid'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x293b,0x134));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb293('0x0'));var BPromise=require(_0xb293('0x1'));var Redis=require('ioredis');var util=require(_0xb293('0x2'));var config=require(_0xb293('0x3'));var logger=require(_0xb293('0x4'))('trigger');var cmContactRpc=require(_0xb293('0x5'));config[_0xb293('0x6')]=_[_0xb293('0x7')](config[_0xb293('0x6')],{'host':_0xb293('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb293('0x6')]));function emit(_0x1d985e,_0x3e8312,_0x59d053,_0x5035d6,_0x5b7d9a){logger[_0xb293('0x9')](_0xb293('0xa'),_0x1d985e,_0x3e8312['id'],_0x59d053,_0x5035d6,JSON[_0xb293('0xb')](_0x5b7d9a));io['to'](_0x59d053)[_0xb293('0xc')](_0x5035d6,_0x5b7d9a);}exports[_0xb293('0xd')]=function(_0xfcdc5c,_0x9c7d41,_0xc3059c,_0x120ca3){var _0x5b305b,_0x3cd434;var _0x1ae9ee={};var _0x4da371=Number(_0xc3059c['data1']);var _0x1f7430=_0xc3059c[_0xb293('0xe')]?Boolean(Number(_0xc3059c[_0xb293('0xe')])):![];var _0x8b7929;if(_0x120ca3[_0xb293('0xf')]){_0x1ae9ee['id']=_0x120ca3[_0xb293('0xf')];}if(!_0x1ae9ee['id']){_0x1ae9ee[_0xb293('0x10')]=_0x4da371;_0x8b7929=_0xc3059c[_0xb293('0x11')]&&_0xc3059c['data3']!=='0'?_0xc3059c[_0xb293('0x11')][_0xb293('0x12')](','):[_0xb293('0x13')];_0x1ae9ee[_0xb293('0x14')]=_['map'](_0x8b7929,function(_0x3dd3d1){var _0x5ab02b={};_0x5ab02b[_0x3dd3d1]=_0x120ca3[_0xb293('0x15')]?_0x120ca3[_0xb293('0x16')]:_0x120ca3[_0xb293('0x17')];return _0x5ab02b;});}var _0x12daf=['id',_0xb293('0x18'),_0xb293('0x19'),_0xb293('0x13'),_0xb293('0x1a'),'fax',_0xb293('0x10'),_0xb293('0x1b'),_0xb293('0x1c'),_0xb293('0x1d')];var _0x21fd4e=_['union'](_0x12daf,_0x8b7929);BPromise[_0xb293('0x1e')]()[_0xb293('0x1f')](cmContactRpc[_0xb293('0x20')]({'attributes':_0x21fd4e,'where':_0x1ae9ee}))[_0xb293('0x1f')](function(_0x35d7cb){_0x3cd434=_0x35d7cb;if(!_[_0xb293('0x21')](_0x3cd434)){if(_0x3cd434[_0xb293('0x22')]===0x1){_0x5b305b=_0x3cd434[0x0];logger[_0xb293('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x120ca3[_0xb293('0x23')],_0x9c7d41['id'],_0x5b305b['id']);}else{logger['info'](_0xb293('0x24'),_0x120ca3[_0xb293('0x23')],_0x9c7d41['id'],_['map'](_0x3cd434,'id')[_0xb293('0x25')](','));}return;}else{logger[_0xb293('0x9')](_0xb293('0x26'),_0x120ca3['uniqueid'],_0x9c7d41['id']);var _0xc8063d={'ListId':_0x4da371};var _0x43d86a=_0xc3059c['data4']&&_0xc3059c[_0xb293('0x27')]!=='0'?_0xc3059c[_0xb293('0x27')]:_0xb293('0x13');if(_0x1f7430){logger['info'](_0xb293('0x28'),_0x120ca3[_0xb293('0x23')],_0x9c7d41['id']);_0xc8063d[_0x43d86a]=_[_0xb293('0x29')](_0x120ca3[_0xb293('0x15')])?_0x120ca3[_0xb293('0x17')]:_0x120ca3[_0xb293('0x16')];if(_['isNil'](_0x120ca3[_0xb293('0x15')])){_0xc8063d[_0xb293('0x18')]=_0x120ca3[_0xb293('0x2a')]&&_0x120ca3['calleridname']!==''?_0x120ca3[_0xb293('0x2a')]:_0xb293('0x2b');}else{_0xc8063d['firstName']=_0x120ca3[_0xb293('0x2c')]&&_0x120ca3[_0xb293('0x2c')]!==_0xb293('0x2d')?_0x120ca3[_0xb293('0x2c')]:'Unknown';}return BPromise[_0xb293('0x1e')]()[_0xb293('0x1f')](cmContactRpc[_0xb293('0x2e')](_0xc8063d))['then'](function(_0x523b2a){_0x5b305b=_0x523b2a;_0x3cd434[_0xb293('0x2f')](_0x523b2a);if(_0x5b305b){logger[_0xb293('0x9')](_0xb293('0x30'),_0x120ca3['uniqueid'],_0x9c7d41['id'],_0x5b305b['id']);}return;});}else{logger[_0xb293('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x120ca3[_0xb293('0x23')],_0x9c7d41['id']);_0xc8063d[_0x43d86a]=_[_0xb293('0x29')](_0x120ca3[_0xb293('0x15')])?_0x120ca3[_0xb293('0x17')]:_0x120ca3[_0xb293('0x16')];if(_['isNil'](_0x120ca3[_0xb293('0x15')])){_0xc8063d[_0xb293('0x18')]=_0x120ca3[_0xb293('0x2a')]&&_0x120ca3[_0xb293('0x2a')]!==_0xb293('0x2d')?_0x120ca3['calleridname']:_0xb293('0x2b');}else{_0xc8063d[_0xb293('0x18')]=_0x120ca3['destcalleridname']&&_0x120ca3['destcalleridname']!==_0xb293('0x2d')?_0x120ca3['destcalleridname']:_0xb293('0x2b');}_0x5b305b=_0xc8063d;_0x3cd434['push'](_0xc8063d);return;}}})[_0xb293('0x1f')](function(){if(_0xfcdc5c){emit(_0x120ca3[_0xb293('0x23')],_0x9c7d41,util[_0xb293('0x31')]('user:%s',_0xfcdc5c[_0xb293('0x32')]),util[_0xb293('0x31')]('trigger:%s',_0xc3059c[_0xb293('0x33')][_0xb293('0x34')]()),{'evt':_[_0xb293('0x35')](_0x120ca3,{'autoCreate':_0x1f7430}),'contact':_0x5b305b===undefined?{}:_0x5b305b,'contacts':_0x3cd434[_0xb293('0x22')]===0x0?undefined:_0x3cd434});}});}; \ No newline at end of file +var _0x9131=['push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','exec','data1','data2','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','','Unknown','destcalleridname','then','createContact'];(function(_0x3dea7d,_0x2cd4ea){var _0x53919a=function(_0x1554e2){while(--_0x1554e2){_0x3dea7d['push'](_0x3dea7d['shift']());}};_0x53919a(++_0x2cd4ea);}(_0x9131,0x1a0));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1913('0x0'));var BPromise=require(_0x1913('0x1'));var Redis=require('ioredis');var util=require(_0x1913('0x2'));var config=require(_0x1913('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x1913('0x4'));config[_0x1913('0x5')]=_[_0x1913('0x6')](config[_0x1913('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1913('0x7'))(new Redis(config['redis']));function emit(_0x506d52,_0xd90bd4,_0xbdb879,_0x111f19,_0x2f1fc1){logger['info'](_0x1913('0x8'),_0x506d52,_0xd90bd4['id'],_0xbdb879,_0x111f19,JSON[_0x1913('0x9')](_0x2f1fc1));io['to'](_0xbdb879)['emit'](_0x111f19,_0x2f1fc1);}exports[_0x1913('0xa')]=function(_0x52358f,_0x133592,_0x5771b8,_0x42bb9a){var _0x2b18a8,_0x48a187;var _0x47c037={};var _0x3f722a=Number(_0x5771b8[_0x1913('0xb')]);var _0x38efb9=_0x5771b8[_0x1913('0xc')]?Boolean(Number(_0x5771b8[_0x1913('0xc')])):![];var _0xe8457e;if(_0x42bb9a[_0x1913('0xd')]){_0x47c037['id']=_0x42bb9a['xmd-contactid'];}if(!_0x47c037['id']){_0x47c037[_0x1913('0xe')]=_0x3f722a;_0xe8457e=_0x5771b8[_0x1913('0xf')]&&_0x5771b8['data3']!=='0'?_0x5771b8[_0x1913('0xf')]['split'](','):[_0x1913('0x10')];_0x47c037[_0x1913('0x11')]=_[_0x1913('0x12')](_0xe8457e,function(_0xa73611){var _0x233253={};_0x233253[_0xa73611]=_0x42bb9a[_0x1913('0x13')]?_0x42bb9a[_0x1913('0x14')]:_0x42bb9a['calleridnum'];return _0x233253;});}var _0x489ccf=['id',_0x1913('0x15'),_0x1913('0x16'),'phone',_0x1913('0x17'),_0x1913('0x18'),_0x1913('0xe'),_0x1913('0x19'),_0x1913('0x1a'),_0x1913('0x1b')];var _0x90ddf4=_[_0x1913('0x1c')](_0x489ccf,_0xe8457e);BPromise[_0x1913('0x1d')]()['then'](cmContactRpc[_0x1913('0x1e')]({'attributes':_0x90ddf4,'where':_0x47c037}))['then'](function(_0x399857){_0x48a187=_0x399857;if(!_['isEmpty'](_0x48a187)){if(_0x48a187[_0x1913('0x1f')]===0x1){_0x2b18a8=_0x48a187[0x0];logger[_0x1913('0x20')](_0x1913('0x21'),_0x42bb9a[_0x1913('0x22')],_0x133592['id'],_0x2b18a8['id']);}else{logger[_0x1913('0x20')](_0x1913('0x23'),_0x42bb9a[_0x1913('0x22')],_0x133592['id'],_[_0x1913('0x12')](_0x48a187,'id')[_0x1913('0x24')](','));}return;}else{logger[_0x1913('0x20')](_0x1913('0x25'),_0x42bb9a[_0x1913('0x22')],_0x133592['id']);var _0xb4af9b={'ListId':_0x3f722a};var _0x529f8e=_0x5771b8['data4']&&_0x5771b8['data4']!=='0'?_0x5771b8[_0x1913('0x26')]:'phone';if(_0x38efb9){logger[_0x1913('0x20')](_0x1913('0x27'),_0x42bb9a[_0x1913('0x22')],_0x133592['id']);_0xb4af9b[_0x529f8e]=_[_0x1913('0x28')](_0x42bb9a[_0x1913('0x13')])?_0x42bb9a[_0x1913('0x29')]:_0x42bb9a[_0x1913('0x14')];if(_[_0x1913('0x28')](_0x42bb9a[_0x1913('0x13')])){_0xb4af9b[_0x1913('0x15')]=_0x42bb9a[_0x1913('0x2a')]&&_0x42bb9a[_0x1913('0x2a')]!==_0x1913('0x2b')?_0x42bb9a[_0x1913('0x2a')]:_0x1913('0x2c');}else{_0xb4af9b['firstName']=_0x42bb9a[_0x1913('0x2d')]&&_0x42bb9a['destcalleridname']!==''?_0x42bb9a[_0x1913('0x2d')]:_0x1913('0x2c');}return BPromise['resolve']()[_0x1913('0x2e')](cmContactRpc[_0x1913('0x2f')](_0xb4af9b))[_0x1913('0x2e')](function(_0x4087c6){_0x2b18a8=_0x4087c6;_0x48a187[_0x1913('0x30')](_0x4087c6);if(_0x2b18a8){logger['info'](_0x1913('0x31'),_0x42bb9a[_0x1913('0x22')],_0x133592['id'],_0x2b18a8['id']);}return;});}else{logger[_0x1913('0x20')](_0x1913('0x32'),_0x42bb9a[_0x1913('0x22')],_0x133592['id']);_0xb4af9b[_0x529f8e]=_[_0x1913('0x28')](_0x42bb9a['routeId'])?_0x42bb9a[_0x1913('0x29')]:_0x42bb9a[_0x1913('0x14')];if(_[_0x1913('0x28')](_0x42bb9a['routeId'])){_0xb4af9b[_0x1913('0x15')]=_0x42bb9a[_0x1913('0x2a')]&&_0x42bb9a[_0x1913('0x2a')]!==_0x1913('0x2b')?_0x42bb9a[_0x1913('0x2a')]:_0x1913('0x2c');}else{_0xb4af9b[_0x1913('0x15')]=_0x42bb9a[_0x1913('0x2d')]&&_0x42bb9a[_0x1913('0x2d')]!==_0x1913('0x2b')?_0x42bb9a[_0x1913('0x2d')]:_0x1913('0x2c');}_0x2b18a8=_0xb4af9b;_0x48a187[_0x1913('0x30')](_0xb4af9b);return;}}})[_0x1913('0x2e')](function(){if(_0x52358f){emit(_0x42bb9a[_0x1913('0x22')],_0x133592,util[_0x1913('0x33')](_0x1913('0x34'),_0x52358f[_0x1913('0x35')]),util[_0x1913('0x33')](_0x1913('0x36'),_0x5771b8[_0x1913('0x37')][_0x1913('0x38')]()),{'evt':_[_0x1913('0x39')](_0x42bb9a,{'autoCreate':_0x38efb9}),'contact':_0x2b18a8===undefined?{}:_0x2b18a8,'contacts':_0x48a187[_0x1913('0x1f')]===0x0?undefined:_0x48a187});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f13c6c1..9586b10 100644 --- a/server/services/ami/trigger/index.js +++ b/server/services/ami/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd605=['event','queue','membername','lastevent','exports','util','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','defaults','localhost','socket.io-emitter','redis','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','checkTriggers','hasOwnProperty','status','checkTrigger','merge','Actions','length','action','toLowerCase','contactmanager','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data4','location','data5','800','windowHeight','data6','600','winApplication','winArguments','format','interface','name','data1','trigger:%s','user:%s','exec','integration','accounts','routeId','script','query','search','AllConditions','every','AnyConditions','some','checkConditions','channel','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId'];(function(_0x29ce01,_0x50d262){var _0x596c78=function(_0x2e53a7){while(--_0x2e53a7){_0x29ce01['push'](_0x29ce01['shift']());}};_0x596c78(++_0x50d262);}(_0xd605,0x1c1));var _0x5d60=function(_0x2be847,_0x50e1e6){_0x2be847=_0x2be847-0x0;var _0xc34303=_0xd605[_0x2be847];return _0xc34303;};'use strict';var util=require(_0x5d60('0x0'));var _=require('lodash');var url=require(_0x5d60('0x1'));var Mustache=require(_0x5d60('0x2'));var Redis=require(_0x5d60('0x3'));var urlforward=require(_0x5d60('0x4'));var integration=require(_0x5d60('0x5'));var cmContact=require(_0x5d60('0x6'));var script=require(_0x5d60('0x7'));var config=require(_0x5d60('0x8'));var logger=require(_0x5d60('0x9'))('trigger');var ami=require(_0x5d60('0xa'));config['redis']=_[_0x5d60('0xb')](config['redis'],{'host':_0x5d60('0xc'),'port':0x18eb});var io=require(_0x5d60('0xd'))(new Redis(config[_0x5d60('0xe')]));var operators={'equals':function(_0x1f4718,_0x4670d5){return _0x1f4718==_0x4670d5;},'not_equals':function(_0x2566a5,_0x461b6c){return _0x2566a5!=_0x461b6c;}};var barAndWebActions=['popup',_0x5d60('0x1'),_0x5d60('0xf')];function Trigger(_0x266266){this[_0x5d60('0x10')]=_0x266266['triggers'];this[_0x5d60('0x11')]=_0x266266[_0x5d60('0x11')];this[_0x5d60('0x12')]=_0x266266[_0x5d60('0x12')];this[_0x5d60('0x13')]=_0x266266[_0x5d60('0x13')];this['voiceExtensions']=_0x266266[_0x5d60('0x14')];this[_0x5d60('0x15')]=_0x266266['zendeskAccounts'];this[_0x5d60('0x16')]=_0x266266[_0x5d60('0x16')];this[_0x5d60('0x17')]=_0x266266['salesforceAccounts'];this[_0x5d60('0x18')]=_0x266266[_0x5d60('0x18')];this[_0x5d60('0x19')]=_0x266266['zohoAccounts'];this[_0x5d60('0x1a')]=_0x266266[_0x5d60('0x1a')];this[_0x5d60('0x1b')]=_0x266266[_0x5d60('0x1b')];this[_0x5d60('0x1c')]=_0x266266[_0x5d60('0x1c')];this['dynamics365Accounts']=_0x266266[_0x5d60('0x1d')];this[_0x5d60('0x1e')]=_0x266266[_0x5d60('0x1e')];this['accounts']={'zendesk':this[_0x5d60('0x15')],'salesforce':this[_0x5d60('0x17')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x5d60('0x18')],'zoho':this[_0x5d60('0x19')],'desk':this[_0x5d60('0x1a')],'vtiger':this[_0x5d60('0x1b')],'dynamics365':this[_0x5d60('0x1d')],'freshsales':this[_0x5d60('0x1e')],'servicenow':this[_0x5d60('0x1c')]};ami['on'](_0x5d60('0x1f'),this[_0x5d60('0x20')][_0x5d60('0x21')](this));ami['on'](_0x5d60('0x22'),this[_0x5d60('0x20')][_0x5d60('0x21')](this));ami['on'](_0x5d60('0x23'),this[_0x5d60('0x20')]['bind'](this));ami['on'](_0x5d60('0x24'),this[_0x5d60('0x20')][_0x5d60('0x21')](this));ami['on'](_0x5d60('0x25'),this[_0x5d60('0x20')]['bind'](this));ami['on'](_0x5d60('0x26'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5d60('0x27'),this[_0x5d60('0x20')][_0x5d60('0x21')](this));ami['on']('custom:agentcongestion',this[_0x5d60('0x20')][_0x5d60('0x21')](this));ami['on'](_0x5d60('0x28'),this[_0x5d60('0x20')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0x5d60('0x20')][_0x5d60('0x21')](this));ami['on']('custom:timeout',this[_0x5d60('0x20')][_0x5d60('0x21')](this));ami['on']('custom:dialbegin',this[_0x5d60('0x29')]['bind'](this));ami['on'](_0x5d60('0x2a'),this[_0x5d60('0x29')][_0x5d60('0x21')](this));ami['on'](_0x5d60('0x2b'),this[_0x5d60('0x29')]['bind'](this));ami['on'](_0x5d60('0x2c'),this['syncCustomEvent'][_0x5d60('0x21')](this));ami['on'](_0x5d60('0x2d'),this['syncCustomEvent']['bind'](this));ami['on']('custom:incomingmessage',this['syncCustomEvent']['bind'](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0x5d60('0x21')](this));ami['on'](_0x5d60('0x2e'),this['syncCustomEvent'][_0x5d60('0x21')](this));ami['on'](_0x5d60('0x2f'),this[_0x5d60('0x20')][_0x5d60('0x21')](this));}Trigger[_0x5d60('0x30')][_0x5d60('0x31')]=function(_0x51e78b,_0x37060c,_0x58be36){logger['info'](_0x51e78b,_0x37060c,JSON[_0x5d60('0x32')](_0x58be36));io['to'](_0x51e78b)[_0x5d60('0x31')](_0x37060c,_0x58be36);};Trigger['prototype'][_0x5d60('0x20')]=function(_0x2eec0a){var _0x3a6a16=_['clone'](_0x2eec0a);this[_0x5d60('0x33')](_0x3a6a16);};Trigger[_0x5d60('0x30')]['syncAgentDial']=function(_0x189bd1){if(this['agents'][_0x189bd1['interface']]){this[_0x5d60('0x20')](_0x189bd1);}};Trigger[_0x5d60('0x30')][_0x5d60('0x33')]=function(_0x1b9cf7){var _0x2cacef;for(var _0x1c3b70 in this['triggers']){if(this[_0x5d60('0x10')][_0x5d60('0x34')](_0x1c3b70)){if(this[_0x5d60('0x10')][_0x1c3b70][_0x5d60('0x35')]){_0x2cacef=this[_0x5d60('0x36')](this[_0x5d60('0x10')][_0x1c3b70],_0x1b9cf7);if(_0x2cacef){_[_0x5d60('0x37')](_0x1b9cf7,_0x1b9cf7['variables']);for(var _0x4d1bfc=0x0,_0x49a19b,_0x88653d,_0x569c2e;_0x4d1bfc0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 96d8cce..2ed8898 100644 --- a/server/services/ami/trigger/integration/dynamics365.js +++ b/server/services/ami/trigger/integration/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc37f=['format','trigger:browser:url','stripTrailingSlash','serverUrl','remoteUri','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','util','./util','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','POST','clientId','username','password','clientSecret','access_token','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','catch','toLowerCase','outbound','contacts','/systemusers(','headers','substring','lastIndexOf','contacts?$select=telephone1','value','destcalleridnum','calleridnum','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','phonecalls','callDirection','queue','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s'];(function(_0x1a55a3,_0x151033){var _0x4b98a5=function(_0x2fbcef){while(--_0x2fbcef){_0x1a55a3['push'](_0x1a55a3['shift']());}};_0x4b98a5(++_0x151033);}(_0xc37f,0x17d));var _0xfc37=function(_0x5669b2,_0x282d33){_0x5669b2=_0x5669b2-0x0;var _0x4ec269=_0xc37f[_0x5669b2];return _0x4ec269;};'use strict';var _=require(_0xfc37('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0xfc37('0x1'));var intUtil=require(_0xfc37('0x2'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0xfc37('0x3'))(_0xfc37('0x4'));var config=require(_0xfc37('0x5'));config[_0xfc37('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfc37('0x7'))(new Redis(config[_0xfc37('0x6')]));function getAuthToken(_0x3b84c2,_0x476a75,_0x2995fc){var _0x259184={'method':_0xfc37('0x8'),'uri':_0x476a75,'form':{'client_id':_0x3b84c2[_0xfc37('0x9')],'resource':_0x3b84c2['remoteUri'],'username':_0x3b84c2[_0xfc37('0xa')],'password':_0x3b84c2['password'],'grant_type':_0xfc37('0xb'),'client_secret':_0x3b84c2[_0xfc37('0xc')]},'json':!![]};return rp(_0x259184)['then'](function(_0x38834f){return _0x38834f[_0xfc37('0xd')];})['catch'](function(_0x2abf85){logger[_0xfc37('0xe')]('['+[_0x2995fc['toUpperCase']()]+_0xfc37('0xf'));return _0x2abf85[_0xfc37('0x10')];});}function getUser(_0x28a0d2,_0x4e5b26,_0x259f21,_0x4b88f0,_0x2affc3,_0x3f82e4){return new BPromise(function(_0x33a2ed,_0x820e60){return getAuthToken(_0x4e5b26,_0x4b88f0,_0x3f82e4)[_0xfc37('0x11')](function(_0x54588f){var _0x21e460={'method':_0xfc37('0x12'),'uri':_0x2affc3+_0xfc37('0x13'),'headers':{'Authorization':_0xfc37('0x14')+_0x54588f,'OData-Version':_0xfc37('0x15')},'json':!![]};return rp(_0x21e460);})[_0xfc37('0x11')](function(_0x35052e){var _0x2fa828=_0x35052e['value'];var _0x194f69=![];var _0x66ba91=null;if(!_[_0xfc37('0x16')](_0x259f21)){if(intUtil[_0xfc37('0x17')](_0x259f21[_0xfc37('0x18')])){_0x28a0d2[_0xfc37('0x19')]=_0x259f21['email'];for(_0x66ba91=0x0;_0x66ba91<_0x2fa828[_0xfc37('0x1a')];_0x66ba91++){if(_0x2fa828[_0x66ba91][_0xfc37('0x1b')]===_0x259f21['email']&&!_0x2fa828[_0x66ba91]['isdisabled']){_0x194f69=!![];logger[_0xfc37('0x1c')]('['+[_0x3f82e4[_0xfc37('0x1d')]()]+_0xfc37('0x1e')+_0x2fa828[_0x66ba91][_0xfc37('0x1f')]+'!');_0x28a0d2[_0xfc37('0x20')]=_0x2fa828[_0x66ba91][_0xfc37('0x1f')];}}}}if(!_0x194f69){logger['info']('['+[_0x3f82e4[_0xfc37('0x1d')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x28a0d2['userEmail']=_0x4e5b26[_0xfc37('0xa')];for(_0x66ba91=0x0;_0x66ba91<_0x2fa828['length'];_0x66ba91++){if(_0x2fa828[_0x66ba91][_0xfc37('0x1b')]===_0x4e5b26[_0xfc37('0xa')]){_0x28a0d2[_0xfc37('0x20')]=_0x2fa828[_0x66ba91][_0xfc37('0x1f')];}}}_0x33a2ed(_0x28a0d2);})[_0xfc37('0x21')](function(_0x4a6f7b){_0x820e60(_0x4a6f7b['message']);});});}function createEndUser(_0xfcbc74,_0xeb1fea,_0x189a2e,_0x109606,_0x190ee9,_0x57cc31){return new BPromise(function(_0x2d1c4b,_0x1bd515){return getAuthToken(_0xeb1fea,_0x189a2e,_0x57cc31)['then'](function(_0x384125){var _0xf73a9d=_0x57cc31[_0xfc37('0x22')]()===_0xfc37('0x23')?_0x190ee9['destcalleridnum']:_0x190ee9['calleridnum'];var _0x5a3cc7={'method':'POST','uri':_0x109606+_0xfc37('0x24'),'body':{'telephone1':_0xf73a9d,'fullname':_0xf73a9d,'firstname':_0xf73a9d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xfc37('0x25')+_0xfcbc74[_0xfc37('0x20')]+')'},'headers':{'Authorization':_0xfc37('0x14')+_0x384125,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5a3cc7);})[_0xfc37('0x11')](function(_0x3b503e){var _0x14d3fa=_0x3b503e[_0xfc37('0x26')]['odata-entityid'];var _0x193102=_0x14d3fa[_0xfc37('0x27')](_0x14d3fa[_0xfc37('0x28')]('(')+0x1,_0x14d3fa[_0xfc37('0x28')](')'));_0xfcbc74['enduserId']=_0x193102;_0x2d1c4b(_0xfcbc74);})[_0xfc37('0x21')](function(_0xe1c3cb){_0x1bd515(_0xe1c3cb['message']);});});}function getEndUser(_0x64b27c,_0x282fb1,_0x2d8687,_0x4af504,_0x11415b,_0x177cdc){return new BPromise(function(_0x1b430b,_0x5ff5b3){return getAuthToken(_0x282fb1,_0x2d8687,_0x177cdc)[_0xfc37('0x11')](function(_0x4739fc){var _0x5b9a0d={'method':_0xfc37('0x12'),'uri':_0x4af504+_0xfc37('0x29'),'headers':{'Authorization':_0xfc37('0x14')+_0x4739fc,'If-None-Match':null,'OData-Version':_0xfc37('0x15')},'json':!![]};return rp(_0x5b9a0d);})[_0xfc37('0x11')](function(_0x2aa6ee){var _0x1d976f=null;if(_0x2aa6ee){var _0x2ad96c=_0x2aa6ee[_0xfc37('0x2a')];var _0x1771ab=![];for(_0x1d976f=0x0;_0x1d976f<_0x2ad96c['length'];_0x1d976f++){var _0xc8b23=_0x177cdc['toLowerCase']()==='outbound'?_0x11415b[_0xfc37('0x2b')]:_0x11415b[_0xfc37('0x2c')];if(_0x2ad96c[_0x1d976f][_0xfc37('0x2d')]===_0xc8b23){_0x1771ab=!![];_0x64b27c[_0xfc37('0x2e')]=_0x2ad96c[_0x1d976f][_0xfc37('0x2f')];}}if(_0x1771ab){_0x1b430b(_0x64b27c);}else{return createEndUser(_0x64b27c,_0x282fb1,_0x2d8687,_0x4af504,_0x11415b,_0x177cdc)['then'](function(_0x3b62cd){logger[_0xfc37('0x1c')]('['+[_0x177cdc[_0xfc37('0x1d')]()]+_0xfc37('0x30'),_0x3b62cd[_0xfc37('0x2e')]);_0x1b430b(_0x3b62cd);});}}else{return createEndUser(_0x64b27c,_0x282fb1,_0x2d8687,_0x4af504,_0x11415b,_0x177cdc)[_0xfc37('0x11')](function(_0x5bb0ff){logger[_0xfc37('0x1c')]('['+[_0x177cdc[_0xfc37('0x1d')]()]+_0xfc37('0x31'),_0x5bb0ff[_0xfc37('0x2e')]);_0x1b430b(_0x5bb0ff);});}});});}function getCustomFields(_0xd69e4e,_0x321420,_0x185357){var _0x33a2a4={};if(_0xd69e4e[_0xfc37('0x1a')]>0x0){_[_0xfc37('0x32')](_0xd69e4e,function(_0x4d9cbf){if(_0x4d9cbf[_0xfc37('0x33')]==='string'&&_0x4d9cbf[_0xfc37('0x34')]&&!_0x4d9cbf[_0xfc37('0x35')]){var _0x6e1a91=_0x4d9cbf[_0xfc37('0x36')][_0xfc37('0x22')]();var _0x37bc17=_0x6e1a91[_0xfc37('0x27')](0x0,_0x6e1a91[_0xfc37('0x37')]('_'));var _0x1eb3fe=_0x6e1a91[_0xfc37('0x27')](_0x6e1a91['indexOf']('_')+0x1);if(_0x37bc17===_0x185357){_0x33a2a4[_0x1eb3fe]=_0x4d9cbf[_0xfc37('0x38')];}}});}return _0x33a2a4;}function getTicket(_0x19f152,_0x2b0e2a,_0x435a0f,_0x4df326,_0x2756aa,_0x3641ad,_0x59c03a){return new BPromise(function(_0x42205a,_0x80b5a7){var _0x459b8b;return getAuthToken(_0x2b0e2a,_0x435a0f,_0x59c03a)[_0xfc37('0x11')](function(_0x4c7978){if(_0x3641ad[_0xfc37('0x39')]===_0xfc37('0x3a')){_0x459b8b={'method':_0xfc37('0x8'),'uri':_0x4df326+'incidents','body':Object[_0xfc37('0x3b')]({},{'title':intUtil[_0xfc37('0x3c')](_0x3641ad[_0xfc37('0x3d')],_0x2756aa,'\x20'),'description':intUtil['getString'](_0x3641ad[_0xfc37('0x3e')],_0x2756aa,'\x0a'),'customerid_contact@odata.bind':_0xfc37('0x3f')+_0x19f152[_0xfc37('0x2e')]+')','ownerid@odata.bind':_0xfc37('0x25')+_0x19f152[_0xfc37('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x3641ad['Fields'],_0x2756aa,_0x3641ad[_0xfc37('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x4c7978,'OData-Version':_0xfc37('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3641ad[_0xfc37('0x39')]==='phonecall'){_0x459b8b={'method':_0xfc37('0x8'),'uri':_0x4df326+_0xfc37('0x40'),'body':Object[_0xfc37('0x3b')]({},{'subject':intUtil[_0xfc37('0x3c')](_0x3641ad[_0xfc37('0x3d')],_0x2756aa,'\x20'),'phonenumber':String(_0x2756aa[_0xfc37('0x2c')]),'description':intUtil[_0xfc37('0x3c')](_0x3641ad[_0xfc37('0x3e')],_0x2756aa,'\x0a'),'regardingobjectid_contact@odata.bind':_0xfc37('0x3f')+_0x19f152['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x19f152[_0xfc37('0x20')]+')','directioncode':_0x19f152[_0xfc37('0x41')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x19f152['userId']+')','participationtypemask':_0x19f152[_0xfc37('0x41')]===_0xfc37('0x42')?0x2:0x1},{'partyid_contact@odata.bind':_0xfc37('0x3f')+_0x19f152[_0xfc37('0x2e')]+')','participationtypemask':_0x19f152[_0xfc37('0x41')]===_0xfc37('0x42')?0x1:0x2}]},getCustomFields(_0x3641ad['Fields'],_0x2756aa,_0x3641ad[_0xfc37('0x39')])),'headers':{'Authorization':_0xfc37('0x14')+_0x4c7978,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x459b8b);})['then'](function(_0x18b3f9){var _0x28464a=_0x18b3f9[_0xfc37('0x26')]['odata-entityid'];var _0x21157f=_0x28464a['substring'](_0x28464a['lastIndexOf']('(')+0x1,_0x28464a[_0xfc37('0x28')](')'));_0x19f152[_0xfc37('0x43')]=_0x21157f;_0x42205a(_0x19f152);})['catch'](function(_0x447de3){_0x80b5a7(_0x447de3[_0xfc37('0x10')]);});});}function emit(_0x47d667,_0x2b32f2,_0x23a161,_0x1fb6e7){var _0x57bff1={'uri':util['format'](_0xfc37('0x44'),_0x47d667,_0x23a161,_0x1fb6e7)};io['to'](util[_0xfc37('0x45')]('user:%s',_0x2b32f2))['emit'](_0xfc37('0x46'),_0x57bff1);}exports['cs']=function(_0x2d1e07,_0x5bc56b,_0x34dc20,_0x567c85,_0x2b0491,_0x2b6e47,_0x51210b,_0x4272b8){var _0x49e15b={};_0x2b6e47['remoteUri']=intUtil[_0xfc37('0x47')](_0x2b6e47['remoteUri']);_0x2b6e47['serverUrl']=intUtil[_0xfc37('0x47')](_0x2b6e47[_0xfc37('0x48')]);_0x49e15b['callDirection']=_0x4272b8===_0xfc37('0x42')||_0x4272b8==='unmanaged'?_0xfc37('0x42'):'outbound';var _0x29e2fe=util[_0xfc37('0x45')]('%s/api/data/v9.0/',_0x2b6e47[_0xfc37('0x49')]);var _0x375d8c=util[_0xfc37('0x45')](_0xfc37('0x4a'),_0x2b6e47[_0xfc37('0x4b')]);var _0x3d514b=util[_0xfc37('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b6e47[_0xfc37('0x48')],_0x5bc56b[_0xfc37('0x4c')],md5(_0x5bc56b['uniqueid']));if(_0x2b0491&&_0x2b0491[_0xfc37('0x4d')]){logger[_0xfc37('0x1c')](_0xfc37('0x4e'),_0xfc37('0x4f'));_0x5bc56b[_0xfc37('0x50')]=_0x3d514b;}else if(_0x51210b&&_0x51210b[_0xfc37('0x51')]&&_0x51210b[_0xfc37('0x51')]!=='none'){logger['info'](_0xfc37('0x52'),'Recording\x20is\x20enabled!');_0x5bc56b[_0xfc37('0x50')]=_0x3d514b;}else{_0x5bc56b['recordingURL']='';}return getUser(_0x49e15b,_0x2b6e47,_0x567c85,_0x375d8c,_0x29e2fe,_0x4272b8)[_0xfc37('0x11')](function(_0x3b7522){logger[_0xfc37('0x1c')]('['+_0x4272b8['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x3b7522[_0xfc37('0x20')]);logger['info']('['+_0x4272b8[_0xfc37('0x1d')]()+_0xfc37('0x53'),_0x3b7522[_0xfc37('0x19')]);return getEndUser(_0x3b7522,_0x2b6e47,_0x375d8c,_0x29e2fe,_0x5bc56b,_0x4272b8);})[_0xfc37('0x11')](function(_0x52fc45){logger['info']('['+_0x4272b8['toUpperCase']()+_0xfc37('0x54'),_0x52fc45[_0xfc37('0x2e')]);logger['info']('['+_0x4272b8[_0xfc37('0x1d')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x5bc56b[_0xfc37('0x2c')]);return getTicket(_0x52fc45,_0x2b6e47,_0x375d8c,_0x29e2fe,_0x5bc56b,_0x34dc20,_0x4272b8);})['then'](function(_0x2a69de){logger[_0xfc37('0x1c')](util[_0xfc37('0x45')]('['+_0x4272b8[_0xfc37('0x1d')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x34dc20[_0xfc37('0x39')],_0x2a69de[_0xfc37('0x43')]));logger[_0xfc37('0x1c')](util[_0xfc37('0x45')]('['+_0x4272b8[_0xfc37('0x1d')]()+_0xfc37('0x55'),_0x4272b8));if(_0x4272b8!==_0xfc37('0x56')){logger[_0xfc37('0x1c')]('['+_0x4272b8[_0xfc37('0x1d')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2b6e47['remoteUri'],_0x567c85[_0xfc37('0x57')],_0x34dc20['ticketType'],_0x2a69de[_0xfc37('0x43')]);}})[_0xfc37('0x21')](function(_0x459b7d){logger[_0xfc37('0xe')]('['+_0x4272b8[_0xfc37('0x1d')]()+_0xfc37('0x58'),util[_0xfc37('0x59')](_0x459b7d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x484b=[']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','outbound','calleridnum','/systemusers(','headers','odata-entityid','lastIndexOf','contacts?$select=telephone1','value','toLowerCase','destcalleridnum','telephone1','enduserId',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','assign','callDirection','queue','substring','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','remoteUri','password','clientSecret','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','isNil','validateEmail','length','internalemailaddress','isdisabled','info'];(function(_0x5bcca7,_0x3d99d2){var _0x23cd64=function(_0x3778a8){while(--_0x3778a8){_0x5bcca7['push'](_0x5bcca7['shift']());}};_0x23cd64(++_0x3d99d2);}(_0x484b,0x165));var _0xb484=function(_0x5981a2,_0x5f260e){_0x5981a2=_0x5981a2-0x0;var _0xd68e00=_0x484b[_0x5981a2];return _0xd68e00;};'use strict';var _=require(_0xb484('0x0'));var BPromise=require('bluebird');var rp=require(_0xb484('0x1'));var util=require('util');var intUtil=require('./util');var md5=require(_0xb484('0x2'));var Redis=require(_0xb484('0x3'));var logger=require('../../../../config/logger')(_0xb484('0x4'));var config=require(_0xb484('0x5'));config[_0xb484('0x6')]=_[_0xb484('0x7')](config[_0xb484('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb484('0x8'))(new Redis(config['redis']));function getAuthToken(_0x16cc40,_0x57fbc3,_0x582065){var _0x5b4ea1={'method':_0xb484('0x9'),'uri':_0x57fbc3,'form':{'client_id':_0x16cc40['clientId'],'resource':_0x16cc40[_0xb484('0xa')],'username':_0x16cc40['username'],'password':_0x16cc40[_0xb484('0xb')],'grant_type':'password','client_secret':_0x16cc40[_0xb484('0xc')]},'json':!![]};return rp(_0x5b4ea1)[_0xb484('0xd')](function(_0x4fb105){return _0x4fb105['access_token'];})[_0xb484('0xe')](function(_0x24bd60){logger['error']('['+[_0x582065[_0xb484('0xf')]()]+_0xb484('0x10'));return _0x24bd60[_0xb484('0x11')];});}function getUser(_0xe3cabb,_0x3ca760,_0x35b535,_0x4875cb,_0x33c741,_0x59fb8f){return new BPromise(function(_0x367d5f,_0x11a272){return getAuthToken(_0x3ca760,_0x4875cb,_0x59fb8f)[_0xb484('0xd')](function(_0x15e5f3){var _0x1582e4={'method':_0xb484('0x12'),'uri':_0x33c741+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xb484('0x13')+_0x15e5f3,'OData-Version':_0xb484('0x14')},'json':!![]};return rp(_0x1582e4);})[_0xb484('0xd')](function(_0x2136c3){var _0x23cdc5=_0x2136c3['value'];var _0x1a6eb4=![];var _0x1b1176=null;if(!_[_0xb484('0x15')](_0x35b535)){if(intUtil[_0xb484('0x16')](_0x35b535['email'])){_0xe3cabb['userEmail']=_0x35b535['email'];for(_0x1b1176=0x0;_0x1b1176<_0x23cdc5[_0xb484('0x17')];_0x1b1176++){if(_0x23cdc5[_0x1b1176][_0xb484('0x18')]===_0x35b535['email']&&!_0x23cdc5[_0x1b1176][_0xb484('0x19')]){_0x1a6eb4=!![];logger[_0xb484('0x1a')]('['+[_0x59fb8f[_0xb484('0xf')]()]+_0xb484('0x1b')+_0x23cdc5[_0x1b1176][_0xb484('0x1c')]+'!');_0xe3cabb[_0xb484('0x1d')]=_0x23cdc5[_0x1b1176]['systemuserid'];}}}}if(!_0x1a6eb4){logger[_0xb484('0x1a')]('['+[_0x59fb8f['toUpperCase']()]+_0xb484('0x1e'));_0xe3cabb[_0xb484('0x1f')]=_0x3ca760['username'];for(_0x1b1176=0x0;_0x1b1176<_0x23cdc5[_0xb484('0x17')];_0x1b1176++){if(_0x23cdc5[_0x1b1176][_0xb484('0x18')]===_0x3ca760[_0xb484('0x20')]){_0xe3cabb[_0xb484('0x1d')]=_0x23cdc5[_0x1b1176][_0xb484('0x1c')];}}}_0x367d5f(_0xe3cabb);})[_0xb484('0xe')](function(_0x5c2099){_0x11a272(_0x5c2099[_0xb484('0x11')]);});});}function createEndUser(_0x2b6d18,_0x321d55,_0x1d205d,_0x39d5bd,_0x5a02b3,_0x593663){return new BPromise(function(_0x149910,_0x3a8548){return getAuthToken(_0x321d55,_0x1d205d,_0x593663)[_0xb484('0xd')](function(_0x46ff2b){var _0x37041e=_0x593663['toLowerCase']()===_0xb484('0x21')?_0x5a02b3['destcalleridnum']:_0x5a02b3[_0xb484('0x22')];var _0x44b8bf={'method':'POST','uri':_0x39d5bd+'contacts','body':{'telephone1':_0x37041e,'fullname':_0x37041e,'firstname':_0x37041e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb484('0x23')+_0x2b6d18[_0xb484('0x1d')]+')'},'headers':{'Authorization':_0xb484('0x13')+_0x46ff2b,'OData-Version':_0xb484('0x14')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x44b8bf);})[_0xb484('0xd')](function(_0xa469a6){var _0x5c2359=_0xa469a6[_0xb484('0x24')][_0xb484('0x25')];var _0x4f9a90=_0x5c2359['substring'](_0x5c2359[_0xb484('0x26')]('(')+0x1,_0x5c2359[_0xb484('0x26')](')'));_0x2b6d18['enduserId']=_0x4f9a90;_0x149910(_0x2b6d18);})['catch'](function(_0x1a0353){_0x3a8548(_0x1a0353[_0xb484('0x11')]);});});}function getEndUser(_0x3ccb60,_0x5c5fe5,_0x5cbd20,_0x2e2690,_0xdd5344,_0x3e7e13){return new BPromise(function(_0x4554f7,_0x496fa5){return getAuthToken(_0x5c5fe5,_0x5cbd20,_0x3e7e13)['then'](function(_0x522801){var _0x3a64ad={'method':_0xb484('0x12'),'uri':_0x2e2690+_0xb484('0x27'),'headers':{'Authorization':_0xb484('0x13')+_0x522801,'If-None-Match':null,'OData-Version':_0xb484('0x14')},'json':!![]};return rp(_0x3a64ad);})[_0xb484('0xd')](function(_0x21ccae){var _0x4e9f8c=null;if(_0x21ccae){var _0x1022e0=_0x21ccae[_0xb484('0x28')];var _0x1e7fd6=![];for(_0x4e9f8c=0x0;_0x4e9f8c<_0x1022e0[_0xb484('0x17')];_0x4e9f8c++){var _0x60c585=_0x3e7e13[_0xb484('0x29')]()==='outbound'?_0xdd5344[_0xb484('0x2a')]:_0xdd5344['calleridnum'];if(_0x1022e0[_0x4e9f8c][_0xb484('0x2b')]===_0x60c585){_0x1e7fd6=!![];_0x3ccb60[_0xb484('0x2c')]=_0x1022e0[_0x4e9f8c]['contactid'];}}if(_0x1e7fd6){_0x4554f7(_0x3ccb60);}else{return createEndUser(_0x3ccb60,_0x5c5fe5,_0x5cbd20,_0x2e2690,_0xdd5344,_0x3e7e13)[_0xb484('0xd')](function(_0x168eb5){logger['info']('['+[_0x3e7e13[_0xb484('0xf')]()]+_0xb484('0x2d'),_0x168eb5[_0xb484('0x2c')]);_0x4554f7(_0x168eb5);});}}else{return createEndUser(_0x3ccb60,_0x5c5fe5,_0x5cbd20,_0x2e2690,_0xdd5344,_0x3e7e13)[_0xb484('0xd')](function(_0x2f0e59){logger[_0xb484('0x1a')]('['+[_0x3e7e13['toUpperCase']()]+_0xb484('0x2e'),_0x2f0e59[_0xb484('0x2c')]);_0x4554f7(_0x2f0e59);});}});});}function getCustomFields(_0x335f84,_0x2576cf,_0x592b3e){var _0x15cab3={};if(_0x335f84[_0xb484('0x17')]>0x0){_[_0xb484('0x2f')](_0x335f84,function(_0xedef63){if(_0xedef63[_0xb484('0x30')]===_0xb484('0x31')&&_0xedef63[_0xb484('0x32')]&&!_0xedef63[_0xb484('0x33')]){var _0x2bef6c=_0xedef63[_0xb484('0x34')][_0xb484('0x29')]();var _0x35448c=_0x2bef6c['substring'](0x0,_0x2bef6c['indexOf']('_'));var _0x30f98f=_0x2bef6c['substring'](_0x2bef6c[_0xb484('0x35')]('_')+0x1);if(_0x35448c===_0x592b3e){_0x15cab3[_0x30f98f]=_0xedef63[_0xb484('0x36')];}}});}return _0x15cab3;}function getTicket(_0x44e7e3,_0xd6580c,_0x3812c4,_0x477cf6,_0x2ca9fb,_0x4b62e,_0x463be0){return new BPromise(function(_0x50ff71,_0x526880){var _0x54a3a4;return getAuthToken(_0xd6580c,_0x3812c4,_0x463be0)['then'](function(_0x4a8740){if(_0x4b62e[_0xb484('0x37')]===_0xb484('0x38')){_0x54a3a4={'method':'POST','uri':_0x477cf6+_0xb484('0x39'),'body':Object['assign']({},{'title':intUtil[_0xb484('0x3a')](_0x4b62e[_0xb484('0x3b')],_0x2ca9fb,'\x20'),'description':intUtil[_0xb484('0x3a')](_0x4b62e[_0xb484('0x3c')],_0x2ca9fb,'\x0a'),'customerid_contact@odata.bind':_0xb484('0x3d')+_0x44e7e3[_0xb484('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x44e7e3[_0xb484('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x4b62e[_0xb484('0x3e')],_0x2ca9fb,_0x4b62e[_0xb484('0x37')])),'headers':{'Authorization':_0xb484('0x13')+_0x4a8740,'OData-Version':_0xb484('0x14')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4b62e[_0xb484('0x37')]===_0xb484('0x3f')){_0x54a3a4={'method':_0xb484('0x9'),'uri':_0x477cf6+_0xb484('0x40'),'body':Object[_0xb484('0x41')]({},{'subject':intUtil[_0xb484('0x3a')](_0x4b62e[_0xb484('0x3b')],_0x2ca9fb,'\x20'),'phonenumber':String(_0x2ca9fb[_0xb484('0x22')]),'description':intUtil[_0xb484('0x3a')](_0x4b62e[_0xb484('0x3c')],_0x2ca9fb,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x44e7e3[_0xb484('0x2c')]+')','ownerid@odata.bind':_0xb484('0x23')+_0x44e7e3['userId']+')','directioncode':_0x44e7e3['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xb484('0x23')+_0x44e7e3[_0xb484('0x1d')]+')','participationtypemask':_0x44e7e3[_0xb484('0x42')]===_0xb484('0x43')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x44e7e3[_0xb484('0x2c')]+')','participationtypemask':_0x44e7e3[_0xb484('0x42')]===_0xb484('0x43')?0x1:0x2}]},getCustomFields(_0x4b62e[_0xb484('0x3e')],_0x2ca9fb,_0x4b62e[_0xb484('0x37')])),'headers':{'Authorization':_0xb484('0x13')+_0x4a8740,'OData-Version':_0xb484('0x14')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x54a3a4);})[_0xb484('0xd')](function(_0x378a44){var _0x41d35f=_0x378a44[_0xb484('0x24')][_0xb484('0x25')];var _0x453502=_0x41d35f[_0xb484('0x44')](_0x41d35f['lastIndexOf']('(')+0x1,_0x41d35f[_0xb484('0x26')](')'));_0x44e7e3[_0xb484('0x45')]=_0x453502;_0x50ff71(_0x44e7e3);})[_0xb484('0xe')](function(_0x5d0d1b){_0x526880(_0x5d0d1b['message']);});});}function emit(_0x190621,_0x3e3a79,_0x3ce2ae,_0x442c66){var _0x8f68c1={'uri':util[_0xb484('0x46')](_0xb484('0x47'),_0x190621,_0x3ce2ae,_0x442c66)};io['to'](util['format'](_0xb484('0x48'),_0x3e3a79))[_0xb484('0x49')](_0xb484('0x4a'),_0x8f68c1);}exports['cs']=function(_0x230286,_0xacf400,_0x17680a,_0x3b473f,_0x2d7749,_0x39ea28,_0x4da989,_0x68f87c){var _0xe65f71={};_0x39ea28[_0xb484('0xa')]=intUtil['stripTrailingSlash'](_0x39ea28[_0xb484('0xa')]);_0x39ea28[_0xb484('0x4b')]=intUtil[_0xb484('0x4c')](_0x39ea28['serverUrl']);_0xe65f71[_0xb484('0x42')]=_0x68f87c===_0xb484('0x43')||_0x68f87c===_0xb484('0x4d')?_0xb484('0x43'):_0xb484('0x21');var _0x475552=util[_0xb484('0x46')](_0xb484('0x4e'),_0x39ea28[_0xb484('0xa')]);var _0x4e2b71=util[_0xb484('0x46')](_0xb484('0x4f'),_0x39ea28[_0xb484('0x50')]);var _0x12b611=util[_0xb484('0x46')](_0xb484('0x51'),_0x39ea28['serverUrl'],_0xacf400[_0xb484('0x52')],md5(_0xacf400[_0xb484('0x52')]));if(_0x2d7749&&_0x2d7749[_0xb484('0x53')]){logger[_0xb484('0x1a')]('[QUEUE]',_0xb484('0x54'));_0xacf400[_0xb484('0x55')]=_0x12b611;}else if(_0x4da989&&_0x4da989[_0xb484('0x56')]&&_0x4da989[_0xb484('0x56')]!==_0xb484('0x57')){logger[_0xb484('0x1a')]('[OUTBOUND]',_0xb484('0x54'));_0xacf400['recordingURL']=_0x12b611;}else{_0xacf400[_0xb484('0x55')]='';}return getUser(_0xe65f71,_0x39ea28,_0x3b473f,_0x4e2b71,_0x475552,_0x68f87c)[_0xb484('0xd')](function(_0xdcfd45){logger['info']('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x58'),_0xdcfd45[_0xb484('0x1d')]);logger[_0xb484('0x1a')]('['+_0x68f87c['toUpperCase']()+_0xb484('0x59'),_0xdcfd45[_0xb484('0x1f')]);return getEndUser(_0xdcfd45,_0x39ea28,_0x4e2b71,_0x475552,_0xacf400,_0x68f87c);})[_0xb484('0xd')](function(_0x3a8089){logger['info']('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x5a'),_0x3a8089[_0xb484('0x2c')]);logger[_0xb484('0x1a')]('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x5b'),_0xacf400[_0xb484('0x22')]);return getTicket(_0x3a8089,_0x39ea28,_0x4e2b71,_0x475552,_0xacf400,_0x17680a,_0x68f87c);})[_0xb484('0xd')](function(_0x23e0b6){logger['info'](util[_0xb484('0x46')]('['+_0x68f87c[_0xb484('0xf')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x17680a['ticketType'],_0x23e0b6[_0xb484('0x45')]));logger[_0xb484('0x1a')](util[_0xb484('0x46')]('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x5c'),_0x68f87c));if(_0x68f87c!==_0xb484('0x4d')){logger['info']('['+_0x68f87c[_0xb484('0xf')]()+']',_0xb484('0x5d'));emit(_0x39ea28[_0xb484('0xa')],_0x3b473f['name'],_0x17680a[_0xb484('0x37')],_0x23e0b6[_0xb484('0x45')]);}})['catch'](function(_0x426f59){logger['error']('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x5e'),util[_0xb484('0x5f')](_0x426f59,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 0316f34..b5862e9 100644 --- a/server/services/ami/trigger/integration/freshdesk.js +++ b/server/services/ami/trigger/integration/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe77f=['%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/helpdesk/tickets/%d','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','lastevent','toUpperCase','uniqueid','The\x20User\x20ID\x20is:','request-promise','md5','ioredis','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','format'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xe77f,0x1f1));var _0xfe77=function(_0x3d2694,_0xe662b0){_0x3d2694=_0x3d2694-0x0;var _0x120ba6=_0xe77f[_0x3d2694];return _0x120ba6;};'use strict';var _=require('lodash');var rp=require(_0xfe77('0x0'));var md5=require(_0xfe77('0x1'));var util=require('util');var Redis=require(_0xfe77('0x2'));var intUtil=require('./util');var config=require(_0xfe77('0x3'));var logger=require('../../../../config/logger')(_0xfe77('0x4'));config[_0xfe77('0x5')]=_['defaults'](config[_0xfe77('0x5')],{'host':_0xfe77('0x6'),'port':0x18eb});var io=require(_0xfe77('0x7'))(new Redis(config[_0xfe77('0x5')]));var headers={'Content-Type':_0xfe77('0x8'),'Accept':_0xfe77('0x8')};function emit(_0x323fe0,_0x50b78c,_0x27f9f7){io['to'](_0x323fe0)[_0xfe77('0x9')](_0x50b78c,_0x27f9f7);}function getTicket(_0x39399d,_0x486dfe,_0x52537d,_0x28feab,_0xc4587e){logger[_0xfe77('0xa')]('Creating\x20new\x20ticket...');var _0x277d02=_[_0xfe77('0xb')]({'responder_id':_0x486dfe['id'],'requester_id':_0x52537d['id'],'name':util['format'](_0xfe77('0xc'),_0xc4587e['calleridname']),'phone':_0xc4587e[_0xfe77('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x28feab[_0xfe77('0xe')],_0xc4587e,'\x20'),'description':intUtil[_0xfe77('0xf')](_0x28feab[_0xfe77('0x10')],_0xc4587e,_0xfe77('0x11')),'tags':getTags(_0x28feab[_0xfe77('0x12')],_0xfe77('0x13'))},getCustomFields(_0x28feab[_0xfe77('0x14')],_0xc4587e));_0x277d02[_0xfe77('0x15')]=_[_0xfe77('0x16')](_[_0xfe77('0x17')](_0x277d02[_0xfe77('0x15')],'id'),'value');return request({'uri':util[_0xfe77('0x18')](_0xfe77('0x19'),_0x39399d[_0xfe77('0x1a')]),'method':'POST','body':_0x277d02})[_0xfe77('0x1b')](function(_0x245d32){logger[_0xfe77('0xa')](_0xfe77('0x1c'));return _0x245d32;});}function getUser(_0x3043ed,_0x8dfd9f){if(intUtil[_0xfe77('0x1d')](_0x8dfd9f)){return request({'uri':util[_0xfe77('0x18')](_0xfe77('0x1e'),_0x3043ed[_0xfe77('0x1a')]),'qs':{'email':_0x8dfd9f}})['then'](function(_0x1c667f){if(_0x1c667f[_0xfe77('0x1f')]){logger[_0xfe77('0xa')](_0xfe77('0x20'));return _[_0xfe77('0x21')](_0x1c667f,function(_0x4fbaa7){return _0x4fbaa7[_0xfe77('0x22')]['email']===_0x8dfd9f;});}else{logger[_0xfe77('0xa')](_0xfe77('0x23'));return request({'uri':util['format'](_0xfe77('0x24'),_0x3043ed['remoteUri'])})[_0xfe77('0x1b')](function(_0x31c68b){logger[_0xfe77('0xa')](_0xfe77('0x25'));return _0x31c68b;});}});}else{logger['info'](_0xfe77('0x26'));return request({'uri':util[_0xfe77('0x18')](_0xfe77('0x24'),_0x3043ed[_0xfe77('0x1a')])})[_0xfe77('0x1b')](function(_0xddc554){logger[_0xfe77('0xa')](_0xfe77('0x25'));return _0xddc554;});}}function getEndUser(_0x6018ca,_0x4846f1,_0x114c5b){logger[_0xfe77('0xa')]('Searching\x20enduser\x20with\x20phone',_0x114c5b);return request({'uri':util['format'](_0xfe77('0x27'),_0x6018ca[_0xfe77('0x1a')]),'qs':{'phone':_0x114c5b}})['then'](function(_0x4b3eb8){if(_0x4b3eb8[_0xfe77('0x1f')]){logger[_0xfe77('0xa')]('Enduser\x20found!');return _[_0xfe77('0x21')](_0x4b3eb8,{'phone':_0x114c5b});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xfe77('0x27'),_0x6018ca[_0xfe77('0x1a')]),'method':'POST','body':{'name':_0x4846f1,'phone':_0x114c5b}})[_0xfe77('0x1b')](function(_0x2ea648){logger['info']('Enduser\x20created.');return _0x2ea648;});}});}function getAuth(_0x2c894d){return util[_0xfe77('0x18')](_0xfe77('0x28'),new Buffer(_0x2c894d[_0xfe77('0x29')]+':X')[_0xfe77('0x2a')](_0xfe77('0x2b')));}function request(_0x640558){logger[_0xfe77('0x2c')](_0xfe77('0x2d'),JSON[_0xfe77('0x2e')](_0x640558));return rp(_[_0xfe77('0x2f')](_0x640558,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x10cd22,_0x20b800){var _0x2f6583=[];if(_0x10cd22&&_0x10cd22[_0xfe77('0x1f')]>0x0){_0x2f6583=_[_0xfe77('0x30')](_0x10cd22,_0x20b800);}return _0x2f6583;}function getCustomFields(_0x248688,_0x54983a){var _0x950830=[];var _0x98be16={'custom_fields':[]};if(_0x248688['length']>0x0){_[_0xfe77('0x31')](_0x248688,function(_0x22d2b0){if(_0x22d2b0[_0xfe77('0x32')]===_0xfe77('0x33')&&_0x22d2b0[_0xfe77('0x34')]&&!_0x22d2b0[_0xfe77('0x35')]){_0x98be16[_0x22d2b0['nameField'][_0xfe77('0x36')]()]=_0x22d2b0[_0xfe77('0x37')][_0xfe77('0x2a')]();}else if(_0x22d2b0['type']===_0xfe77('0x33')&&_0x22d2b0[_0xfe77('0x38')]&&_0x22d2b0['customField']){_0x98be16[_0xfe77('0x15')][_0xfe77('0x39')]({'id':_0x22d2b0[_0xfe77('0x38')],'value':_0x22d2b0['content'][_0xfe77('0x2a')]()});}else if(_0x22d2b0[_0xfe77('0x32')]===_0xfe77('0x3a')&&_0x22d2b0['variableName']&&_0x22d2b0[_0xfe77('0x38')]&&_0x22d2b0[_0xfe77('0x35')]){_0x54983a[_0x22d2b0['variableName']]&&_0x98be16['custom_fields'][_0xfe77('0x39')]({'id':_0x22d2b0[_0xfe77('0x38')],'value':_0x54983a[_0x22d2b0[_0xfe77('0x3b')]]['toString']()});}else if(_0x22d2b0[_0xfe77('0x32')]===_0xfe77('0x3c')&&_0x22d2b0['Variable']&&_0x22d2b0[_0xfe77('0x3d')]['name']&&_0x22d2b0['idField']&&_0x22d2b0[_0xfe77('0x35')]){_0x54983a[_0x22d2b0[_0xfe77('0x3d')][_0xfe77('0x13')]['toLowerCase']()]&&_0x98be16['custom_fields'][_0xfe77('0x39')]({'id':_0x22d2b0['idField'],'value':_0x54983a[_0x22d2b0[_0xfe77('0x3d')][_0xfe77('0x13')]['toLowerCase']()]['toString']()});}});}return _0x98be16;}exports['queue']=function(_0x191f9f,_0x4267cb,_0x10f9e2,_0x3e71a3,_0x34cefd,_0x5d016b){var _0x3493c5,_0x1dd8b0;_0x5d016b[_0xfe77('0x1a')]=intUtil[_0xfe77('0x3e')](_0x5d016b['remoteUri']);_0x5d016b[_0xfe77('0x3f')]=intUtil[_0xfe77('0x3e')](_0x5d016b[_0xfe77('0x3f')]);if(_0x34cefd&&_0x34cefd[_0xfe77('0x40')]){logger[_0xfe77('0xa')](_0xfe77('0x41'),'Recording\x20is\x20enabled!');_0x4267cb[_0xfe77('0x42')]=util[_0xfe77('0x18')](_0xfe77('0x43'),_0x5d016b[_0xfe77('0x3f')],_0x4267cb['uniqueid'],md5(_0x4267cb['uniqueid']));}else{_0x4267cb['recordingURL']='';}headers['Authorization']=getAuth(_0x5d016b);return getUser(_0x5d016b,_0x3e71a3[_0xfe77('0x44')])['then'](function(_0x5a5fe9){_0x3493c5=_0x5a5fe9;logger[_0xfe77('0xa')]('The\x20User\x20ID\x20is:',_0x3493c5['id']);return getEndUser(_0x5d016b,_0x4267cb[_0xfe77('0x45')],_0x4267cb[_0xfe77('0xd')]);})[_0xfe77('0x1b')](function(_0x44646a){_0x1dd8b0=_0x44646a;logger[_0xfe77('0xa')](_0xfe77('0x46'),_0x1dd8b0['id']);return getTicket(_0x5d016b,_0x3493c5,_0x1dd8b0,_0x10f9e2,_0x4267cb);})[_0xfe77('0x1b')](function(_0x1e58a3){if(_0x1e58a3&&_0x1e58a3['id']){logger[_0xfe77('0xa')](_0xfe77('0x1c'));logger['info'](_0xfe77('0x47'),_0x1e58a3['id']);logger[_0xfe77('0xa')](_0xfe77('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfe77('0x18')]('user:%s',_0x3e71a3[_0xfe77('0x13')]),'trigger:browser:url',{'uri':util['format'](_0xfe77('0x48'),_0x5d016b[_0xfe77('0x1a')],_0x1e58a3['id'])});}})['catch'](function(_0x500d99){logger[_0xfe77('0x49')](_0xfe77('0x41'),JSON[_0xfe77('0x2e')](_0x500d99));});};exports['outbound']=function(_0x744a5a,_0x4239c9,_0x3de699,_0x3ec01f,_0x112820,_0x381467,_0x270209){var _0x3e632c,_0x35feb7;_0x381467['remoteUri']=intUtil[_0xfe77('0x3e')](_0x381467[_0xfe77('0x1a')]);_0x381467['serverUrl']=intUtil[_0xfe77('0x3e')](_0x381467[_0xfe77('0x3f')]);if(_0x270209&&_0x270209[_0xfe77('0x4a')]&&_0x270209[_0xfe77('0x4a')]!==_0xfe77('0x4b')){logger[_0xfe77('0xa')](_0xfe77('0x4c'),_0xfe77('0x4d'));_0x4239c9[_0xfe77('0x42')]=util['format'](_0xfe77('0x43'),_0x381467[_0xfe77('0x3f')],_0x4239c9['uniqueid'],md5(_0x4239c9['uniqueid']));}headers['Authorization']=getAuth(_0x381467);return getUser(_0x381467,_0x3ec01f['email'])[_0xfe77('0x1b')](function(_0x343c08){_0x3e632c=_0x343c08;logger['info']('The\x20User\x20ID\x20is:',_0x3e632c['id']);return getEndUser(_0x381467,_0x4239c9[_0xfe77('0x4e')],_0x4239c9[_0xfe77('0x4f')]);})[_0xfe77('0x1b')](function(_0x16b39d){_0x35feb7=_0x16b39d;logger[_0xfe77('0xa')](_0xfe77('0x46'),_0x35feb7['id']);return getTicket(_0x381467,_0x3e632c,_0x35feb7,_0x3de699,_0x4239c9);})[_0xfe77('0x1b')](function(_0x11c9c8){if(_0x11c9c8&&_0x11c9c8['id']){logger[_0xfe77('0xa')](_0xfe77('0x1c'));logger[_0xfe77('0xa')](_0xfe77('0x47'),_0x11c9c8['id']);logger[_0xfe77('0xa')](_0xfe77('0x4c'),_0xfe77('0x50'));emit(util[_0xfe77('0x18')]('user:%s',_0x3ec01f[_0xfe77('0x13')]),_0xfe77('0x51'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x381467['remoteUri'],_0x11c9c8['id'])});}})[_0xfe77('0x52')](function(_0x43f9f7){logger[_0xfe77('0x49')](_0xfe77('0x4c'),JSON[_0xfe77('0x2e')](_0x43f9f7));});};exports['unmanaged']=function(_0x2fec15,_0x5c80f0,_0x18c38b,_0x2f8b14,_0x209e45,_0x18cd5f){var _0xa1d7be,_0x3ae22b;_0x18cd5f['remoteUri']=intUtil[_0xfe77('0x3e')](_0x18cd5f[_0xfe77('0x1a')]);_0x18cd5f['serverUrl']=intUtil[_0xfe77('0x3e')](_0x18cd5f[_0xfe77('0x3f')]);if(_0x209e45&&_0x209e45[_0xfe77('0x40')]){logger[_0xfe77('0xa')]('['+_0x5c80f0[_0xfe77('0x53')][_0xfe77('0x54')]()+']',_0xfe77('0x4d'));_0x5c80f0[_0xfe77('0x42')]=util[_0xfe77('0x18')](_0xfe77('0x43'),_0x18cd5f[_0xfe77('0x3f')],_0x5c80f0[_0xfe77('0x55')],md5(_0x5c80f0[_0xfe77('0x55')]));}else{_0x5c80f0[_0xfe77('0x42')]='';}headers['Authorization']=getAuth(_0x18cd5f);return getUser(_0x18cd5f,'')['then'](function(_0x4c0f64){_0xa1d7be=_0x4c0f64;logger[_0xfe77('0xa')](_0xfe77('0x56'),_0xa1d7be['id']);return getEndUser(_0x18cd5f,_0x5c80f0['calleridname'],_0x5c80f0[_0xfe77('0xd')]);})['then'](function(_0x2d6fa9){_0x3ae22b=_0x2d6fa9;logger[_0xfe77('0xa')](_0xfe77('0x46'),_0x3ae22b['id']);return getTicket(_0x18cd5f,_0xa1d7be,_0x3ae22b,_0x18c38b,_0x5c80f0);})[_0xfe77('0x1b')](function(_0x49f781){if(_0x49f781){logger[_0xfe77('0xa')](_0xfe77('0x1c'));logger['info'](_0xfe77('0x47'),_0x49f781['id']);}})[_0xfe77('0x52')](function(_0x2e3a9d){logger[_0xfe77('0x49')]('['+_0x5c80f0['lastevent'][_0xfe77('0x54')]()+']',JSON['stringify'](_0x2e3a9d));});}; \ No newline at end of file +var _0xc91a=['[OUTBOUND]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','defaults','GET','map','forEach','type','string','nameField','customField','toLowerCase','idField','content','variable','variableName','push','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','stringify','outbound','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x3c5b3b,_0x4f8041){var _0x4ea5e5=function(_0x2fdf2b){while(--_0x2fdf2b){_0x3c5b3b['push'](_0x3c5b3b['shift']());}};_0x4ea5e5(++_0x4f8041);}(_0xc91a,0x128));var _0xac91=function(_0x751c5a,_0x18dc27){_0x751c5a=_0x751c5a-0x0;var _0x5d2292=_0xc91a[_0x751c5a];return _0x5d2292;};'use strict';var _=require(_0xac91('0x0'));var rp=require(_0xac91('0x1'));var md5=require(_0xac91('0x2'));var util=require(_0xac91('0x3'));var Redis=require(_0xac91('0x4'));var intUtil=require('./util');var config=require(_0xac91('0x5'));var logger=require(_0xac91('0x6'))(_0xac91('0x7'));config[_0xac91('0x8')]=_['defaults'](config['redis'],{'host':_0xac91('0x9'),'port':0x18eb});var io=require(_0xac91('0xa'))(new Redis(config[_0xac91('0x8')]));var headers={'Content-Type':_0xac91('0xb'),'Accept':'application/json'};function emit(_0x4b3a8b,_0x3133f1,_0x30a8ea){io['to'](_0x4b3a8b)[_0xac91('0xc')](_0x3133f1,_0x30a8ea);}function getTicket(_0x2bc21f,_0x3a9bb2,_0x5c70b4,_0x48b065,_0x4c53be){logger[_0xac91('0xd')]('Creating\x20new\x20ticket...');var _0x35fb98=_[_0xac91('0xe')]({'responder_id':_0x3a9bb2['id'],'requester_id':_0x5c70b4['id'],'name':util[_0xac91('0xf')](_0xac91('0x10'),_0x4c53be[_0xac91('0x11')]),'phone':_0x4c53be[_0xac91('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xac91('0x13')](_0x48b065[_0xac91('0x14')],_0x4c53be,'\x20'),'description':intUtil['getString'](_0x48b065[_0xac91('0x15')],_0x4c53be,_0xac91('0x16')),'tags':getTags(_0x48b065[_0xac91('0x17')],_0xac91('0x18'))},getCustomFields(_0x48b065[_0xac91('0x19')],_0x4c53be));_0x35fb98[_0xac91('0x1a')]=_[_0xac91('0x1b')](_[_0xac91('0x1c')](_0x35fb98[_0xac91('0x1a')],'id'),_0xac91('0x1d'));return request({'uri':util[_0xac91('0xf')](_0xac91('0x1e'),_0x2bc21f[_0xac91('0x1f')]),'method':_0xac91('0x20'),'body':_0x35fb98})[_0xac91('0x21')](function(_0x4acebc){logger['info'](_0xac91('0x22'));return _0x4acebc;});}function getUser(_0x3c3952,_0x45bd5a){if(intUtil[_0xac91('0x23')](_0x45bd5a)){return request({'uri':util[_0xac91('0xf')]('%s/api/v2/agents',_0x3c3952[_0xac91('0x1f')]),'qs':{'email':_0x45bd5a}})[_0xac91('0x21')](function(_0x31e512){if(_0x31e512[_0xac91('0x24')]){logger[_0xac91('0xd')](_0xac91('0x25'));return _['find'](_0x31e512,function(_0x594ef7){return _0x594ef7['contact'][_0xac91('0x26')]===_0x45bd5a;});}else{logger[_0xac91('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xac91('0xf')]('%s/api/v2/agents/me',_0x3c3952[_0xac91('0x1f')])})[_0xac91('0x21')](function(_0x48e99a){logger[_0xac91('0xd')](_0xac91('0x27'));return _0x48e99a;});}});}else{logger[_0xac91('0xd')](_0xac91('0x28'));return request({'uri':util[_0xac91('0xf')](_0xac91('0x29'),_0x3c3952[_0xac91('0x1f')])})['then'](function(_0x42915d){logger[_0xac91('0xd')](_0xac91('0x27'));return _0x42915d;});}}function getEndUser(_0x1a188f,_0x59e059,_0x419642){logger[_0xac91('0xd')](_0xac91('0x2a'),_0x419642);return request({'uri':util[_0xac91('0xf')](_0xac91('0x2b'),_0x1a188f[_0xac91('0x1f')]),'qs':{'phone':_0x419642}})[_0xac91('0x21')](function(_0x2221d6){if(_0x2221d6[_0xac91('0x24')]){logger[_0xac91('0xd')](_0xac91('0x2c'));return _['find'](_0x2221d6,{'phone':_0x419642});}else{logger['info'](_0xac91('0x2d'));return request({'uri':util[_0xac91('0xf')](_0xac91('0x2b'),_0x1a188f[_0xac91('0x1f')]),'method':_0xac91('0x20'),'body':{'name':_0x59e059,'phone':_0x419642}})[_0xac91('0x21')](function(_0x847edb){logger[_0xac91('0xd')](_0xac91('0x2e'));return _0x847edb;});}});}function getAuth(_0x329599){return util[_0xac91('0xf')](_0xac91('0x2f'),new Buffer(_0x329599[_0xac91('0x30')]+':X')[_0xac91('0x31')](_0xac91('0x32')));}function request(_0x1fc6f5){logger[_0xac91('0x33')](_0xac91('0x34'),JSON['stringify'](_0x1fc6f5));return rp(_[_0xac91('0x35')](_0x1fc6f5,{'method':_0xac91('0x36'),'headers':headers,'json':!![]}));}function getTags(_0xd36cec,_0x251482){var _0x1f3155=[];if(_0xd36cec&&_0xd36cec[_0xac91('0x24')]>0x0){_0x1f3155=_[_0xac91('0x37')](_0xd36cec,_0x251482);}return _0x1f3155;}function getCustomFields(_0x138b56,_0x36838b){var _0x548c03=[];var _0x4808e8={'custom_fields':[]};if(_0x138b56['length']>0x0){_[_0xac91('0x38')](_0x138b56,function(_0x3cff71){if(_0x3cff71[_0xac91('0x39')]===_0xac91('0x3a')&&_0x3cff71[_0xac91('0x3b')]&&!_0x3cff71[_0xac91('0x3c')]){_0x4808e8[_0x3cff71[_0xac91('0x3b')][_0xac91('0x3d')]()]=_0x3cff71['content'][_0xac91('0x31')]();}else if(_0x3cff71[_0xac91('0x39')]===_0xac91('0x3a')&&_0x3cff71[_0xac91('0x3e')]&&_0x3cff71[_0xac91('0x3c')]){_0x4808e8[_0xac91('0x1a')]['push']({'id':_0x3cff71[_0xac91('0x3e')],'value':_0x3cff71[_0xac91('0x3f')]['toString']()});}else if(_0x3cff71[_0xac91('0x39')]===_0xac91('0x40')&&_0x3cff71[_0xac91('0x41')]&&_0x3cff71['idField']&&_0x3cff71[_0xac91('0x3c')]){_0x36838b[_0x3cff71['variableName']]&&_0x4808e8[_0xac91('0x1a')][_0xac91('0x42')]({'id':_0x3cff71[_0xac91('0x3e')],'value':_0x36838b[_0x3cff71[_0xac91('0x41')]][_0xac91('0x31')]()});}else if(_0x3cff71['type']==='customVariable'&&_0x3cff71['Variable']&&_0x3cff71['Variable']['name']&&_0x3cff71['idField']&&_0x3cff71[_0xac91('0x3c')]){_0x36838b[_0x3cff71['Variable'][_0xac91('0x18')]['toLowerCase']()]&&_0x4808e8[_0xac91('0x1a')][_0xac91('0x42')]({'id':_0x3cff71[_0xac91('0x3e')],'value':_0x36838b[_0x3cff71[_0xac91('0x43')][_0xac91('0x18')][_0xac91('0x3d')]()][_0xac91('0x31')]()});}});}return _0x4808e8;}exports['queue']=function(_0x5dead6,_0x32ec06,_0x5b3b68,_0x361c69,_0x54cb82,_0x5bbc07){var _0x386dfe,_0x1b1513;_0x5bbc07[_0xac91('0x1f')]=intUtil['stripTrailingSlash'](_0x5bbc07[_0xac91('0x1f')]);_0x5bbc07[_0xac91('0x44')]=intUtil[_0xac91('0x45')](_0x5bbc07[_0xac91('0x44')]);if(_0x54cb82&&_0x54cb82[_0xac91('0x46')]){logger[_0xac91('0xd')](_0xac91('0x47'),_0xac91('0x48'));_0x32ec06[_0xac91('0x49')]=util[_0xac91('0xf')](_0xac91('0x4a'),_0x5bbc07['serverUrl'],_0x32ec06[_0xac91('0x4b')],md5(_0x32ec06[_0xac91('0x4b')]));}else{_0x32ec06[_0xac91('0x49')]='';}headers['Authorization']=getAuth(_0x5bbc07);return getUser(_0x5bbc07,_0x361c69[_0xac91('0x26')])[_0xac91('0x21')](function(_0x1baaf1){_0x386dfe=_0x1baaf1;logger[_0xac91('0xd')](_0xac91('0x4c'),_0x386dfe['id']);return getEndUser(_0x5bbc07,_0x32ec06[_0xac91('0x11')],_0x32ec06[_0xac91('0x12')]);})[_0xac91('0x21')](function(_0x506c72){_0x1b1513=_0x506c72;logger[_0xac91('0xd')]('The\x20Enduser\x20ID\x20is:',_0x1b1513['id']);return getTicket(_0x5bbc07,_0x386dfe,_0x1b1513,_0x5b3b68,_0x32ec06);})[_0xac91('0x21')](function(_0x4b4ec8){if(_0x4b4ec8&&_0x4b4ec8['id']){logger[_0xac91('0xd')](_0xac91('0x22'));logger[_0xac91('0xd')](_0xac91('0x4d'),_0x4b4ec8['id']);logger[_0xac91('0xd')](_0xac91('0x47'),_0xac91('0x4e'));emit(util[_0xac91('0xf')]('user:%s',_0x361c69[_0xac91('0x18')]),'trigger:browser:url',{'uri':util[_0xac91('0xf')]('%s/helpdesk/tickets/%d',_0x5bbc07[_0xac91('0x1f')],_0x4b4ec8['id'])});}})[_0xac91('0x4f')](function(_0x83437e){logger['error'](_0xac91('0x47'),JSON[_0xac91('0x50')](_0x83437e));});};exports[_0xac91('0x51')]=function(_0x99b594,_0x238968,_0x538720,_0xe80b63,_0x5d2ee3,_0x4fc1ce,_0x38e434){var _0x133ce6,_0x1fb467;_0x4fc1ce[_0xac91('0x1f')]=intUtil[_0xac91('0x45')](_0x4fc1ce['remoteUri']);_0x4fc1ce[_0xac91('0x44')]=intUtil[_0xac91('0x45')](_0x4fc1ce[_0xac91('0x44')]);if(_0x38e434&&_0x38e434[_0xac91('0x52')]&&_0x38e434[_0xac91('0x52')]!==_0xac91('0x53')){logger[_0xac91('0xd')]('[OUTBOUND]',_0xac91('0x48'));_0x238968[_0xac91('0x49')]=util['format'](_0xac91('0x4a'),_0x4fc1ce['serverUrl'],_0x238968[_0xac91('0x4b')],md5(_0x238968[_0xac91('0x4b')]));}headers[_0xac91('0x54')]=getAuth(_0x4fc1ce);return getUser(_0x4fc1ce,_0xe80b63[_0xac91('0x26')])['then'](function(_0x3e9799){_0x133ce6=_0x3e9799;logger[_0xac91('0xd')](_0xac91('0x4c'),_0x133ce6['id']);return getEndUser(_0x4fc1ce,_0x238968[_0xac91('0x55')],_0x238968[_0xac91('0x56')]);})[_0xac91('0x21')](function(_0x257095){_0x1fb467=_0x257095;logger['info'](_0xac91('0x57'),_0x1fb467['id']);return getTicket(_0x4fc1ce,_0x133ce6,_0x1fb467,_0x538720,_0x238968);})[_0xac91('0x21')](function(_0x928ae4){if(_0x928ae4&&_0x928ae4['id']){logger[_0xac91('0xd')]('Ticket\x20created!');logger['info'](_0xac91('0x4d'),_0x928ae4['id']);logger[_0xac91('0xd')](_0xac91('0x58'),_0xac91('0x4e'));emit(util[_0xac91('0xf')](_0xac91('0x59'),_0xe80b63[_0xac91('0x18')]),_0xac91('0x5a'),{'uri':util[_0xac91('0xf')](_0xac91('0x5b'),_0x4fc1ce[_0xac91('0x1f')],_0x928ae4['id'])});}})[_0xac91('0x4f')](function(_0x206be0){logger[_0xac91('0x5c')]('[OUTBOUND]',JSON[_0xac91('0x50')](_0x206be0));});};exports[_0xac91('0x5d')]=function(_0x420d5a,_0xf370f5,_0x3dfaf3,_0x221ac6,_0x46ddbc,_0x5b3a41){var _0x333f7d,_0x5a3533;_0x5b3a41[_0xac91('0x1f')]=intUtil[_0xac91('0x45')](_0x5b3a41[_0xac91('0x1f')]);_0x5b3a41[_0xac91('0x44')]=intUtil[_0xac91('0x45')](_0x5b3a41[_0xac91('0x44')]);if(_0x46ddbc&&_0x46ddbc['monitor_format']){logger[_0xac91('0xd')]('['+_0xf370f5[_0xac91('0x5e')][_0xac91('0x5f')]()+']','Recording\x20is\x20enabled!');_0xf370f5[_0xac91('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b3a41[_0xac91('0x44')],_0xf370f5[_0xac91('0x4b')],md5(_0xf370f5[_0xac91('0x4b')]));}else{_0xf370f5[_0xac91('0x49')]='';}headers[_0xac91('0x54')]=getAuth(_0x5b3a41);return getUser(_0x5b3a41,'')[_0xac91('0x21')](function(_0x334151){_0x333f7d=_0x334151;logger[_0xac91('0xd')](_0xac91('0x4c'),_0x333f7d['id']);return getEndUser(_0x5b3a41,_0xf370f5['calleridname'],_0xf370f5[_0xac91('0x12')]);})[_0xac91('0x21')](function(_0x374441){_0x5a3533=_0x374441;logger['info'](_0xac91('0x57'),_0x5a3533['id']);return getTicket(_0x5b3a41,_0x333f7d,_0x5a3533,_0x3dfaf3,_0xf370f5);})['then'](function(_0x41aecd){if(_0x41aecd){logger[_0xac91('0xd')](_0xac91('0x22'));logger['info'](_0xac91('0x4d'),_0x41aecd['id']);}})[_0xac91('0x4f')](function(_0x263d42){logger[_0xac91('0x5c')]('['+_0xf370f5[_0xac91('0x5e')][_0xac91('0x5f')]()+']',JSON[_0xac91('0x50')](_0x263d42));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 1192268..1cfccbf 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7579=['moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','toUpperCase','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','/api/tasks','getString','Descriptions','Contact','add','Task\x20created:','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','outbound','destcalleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util'];(function(_0xd4b806,_0x2b8195){var _0x5cf7e7=function(_0x14a3a2){while(--_0x14a3a2){_0xd4b806['push'](_0xd4b806['shift']());}};_0x5cf7e7(++_0x2b8195);}(_0x7579,0x1e2));var _0x9757=function(_0x537065,_0x32b04f){_0x537065=_0x537065-0x0;var _0x1f9924=_0x7579[_0x537065];return _0x1f9924;};'use strict';var _=require(_0x9757('0x0'));var rp=require(_0x9757('0x1'));var md5=require(_0x9757('0x2'));var util=require(_0x9757('0x3'));var moment=require(_0x9757('0x4'));var Promise=require(_0x9757('0x5'));var Redis=require('ioredis');var intUtil=require(_0x9757('0x6'));var config=require(_0x9757('0x7'));var logger=require(_0x9757('0x8'))(_0x9757('0x9'));config['redis']=_[_0x9757('0xa')](config[_0x9757('0xb')],{'host':_0x9757('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9757('0xb')]));function getAdminId(_0x51a1c8,_0x2d65dd,_0x2f9867,_0x1b4bf0){return new Promise(function(_0x5b5749,_0x375d91){var _0x13f01a=![];var _0x271207={'method':_0x9757('0xd'),'uri':_0x1b4bf0+_0x9757('0xe'),'json':!![]};_0x271207[_0x9757('0xf')]=_0x2f9867;logger[_0x9757('0x10')](_0x9757('0x11'));return rp(_0x271207)[_0x9757('0x12')](function(_0x141e64){if(_0x141e64){var _0x7491ea=_0x141e64['users'];var _0x2f2200=null;for(_0x2f2200=0x0;_0x2f2200<_0x7491ea[_0x9757('0x13')];_0x2f2200++){if(_0x7491ea[_0x2f2200][_0x9757('0x14')]===_0x51a1c8['adminEmail']){_0x51a1c8[_0x9757('0x15')]=_0x7491ea[_0x2f2200]['id'];_0x13f01a=!![];}}if(_0x13f01a){logger[_0x9757('0x10')](_0x9757('0x16'),_0x51a1c8[_0x9757('0x15')]);_0x5b5749(_0x51a1c8);}else{_0x375d91({'statusCode':0x194,'message':_0x9757('0x17')});}}else{_0x375d91({'statusCode':0x194,'message':_0x9757('0x17')});}})[_0x9757('0x18')](function(_0x4b994d){logger[_0x9757('0x19')]('['+[_0x2d65dd['toUpperCase']()]+']',_0x4b994d[_0x9757('0x1a')]);_0x375d91(_0x4b994d);});});}function getUser(_0xcc8f94,_0xad2a22,_0x1e4000){return function(_0x3f6be9){return new Promise(function(_0x377390,_0x57e309){var _0x9ee1f6={'method':_0x9757('0xd'),'uri':_0x1e4000+_0x9757('0xe'),'json':!![]};_0x9ee1f6[_0x9757('0xf')]=_0xad2a22;logger[_0x9757('0x10')](_0x9757('0x1b'));return rp(_0x9ee1f6)[_0x9757('0x12')](function(_0x593e43){if(_0x593e43){var _0x185506=_0x593e43['users'];var _0x517504=![];var _0x37c889=null;if(_0x3f6be9[_0x9757('0x1c')]!==null){logger[_0x9757('0x10')](_0x9757('0x1d'),_0x3f6be9['agentEmail']);_0x3f6be9['userEmail']=_0x3f6be9['agentEmail'];for(_0x37c889=0x0;_0x37c889<_0x185506[_0x9757('0x13')];_0x37c889++){if(_0x185506[_0x37c889][_0x9757('0x14')]===_0x3f6be9[_0x9757('0x1c')]){_0x517504=!![];_0x3f6be9[_0x9757('0x1e')]=_0x185506[_0x37c889]['id'];logger['info'](_0x9757('0x1f'),_0x3f6be9[_0x9757('0x1e')]);}}}if(!_0x517504){logger['info'](_0x9757('0x20'));_0x3f6be9[_0x9757('0x21')]=_0x3f6be9['adminEmail'];_0x3f6be9[_0x9757('0x1e')]=_0x3f6be9[_0x9757('0x15')];_0x517504=!![];}if(_0x517504){_0x377390(_0x3f6be9);}else{_0x57e309({'statusCode':0x194,'message':_0x9757('0x17')});}}else{_0x57e309({'statusCode':0x194,'message':_0x9757('0x17')});}})[_0x9757('0x18')](function(_0x19588f){logger['error']('['+[_0xcc8f94[_0x9757('0x22')]()]+']',_0x19588f['message']);_0x57e309(_0x19588f);});});};}function searchContact(_0x2f2fe7,_0x398c48,_0x58ae5e,_0x490e10){return new Promise(function(_0x2f0ae8,_0x21a4bd){var _0xc81976={'method':_0x9757('0xd'),'headers':_0x398c48,'uri':_0x2f2fe7+'/api/lookup?q='+_0x490e10+_0x9757('0x23')+_0x58ae5e+_0x9757('0x24'),'json':!![]};rp(_0xc81976)[_0x9757('0x12')](function(_0x41318a){var _0x815c25=_[_0x9757('0x25')](_0x41318a['contacts'][_0x9757('0x26')],[_0x58ae5e,_0x490e10]);_0x2f0ae8(_0x815c25);})[_0x9757('0x18')](function(_0x36eb37){_0x21a4bd(_0x36eb37);});});}function getEndUser(_0x35edcc,_0x478199,_0x328c9e){return function(_0x115d93){return new Promise(function(_0x586e71,_0x335212){logger[_0x9757('0x10')](util[_0x9757('0x27')](_0x9757('0x28'),_0x115d93[_0x9757('0x29')]));searchContact(_0x328c9e,_0x478199,_0x9757('0x2a'),_0x115d93[_0x9757('0x29')])[_0x9757('0x12')](function(_0x56c2a2){if(_0x56c2a2){_0x115d93[_0x9757('0x2b')]=_0x56c2a2['id'];logger['info'](_0x9757('0x2c'),_0x115d93[_0x9757('0x2b')]);return _0x586e71(_0x115d93);}searchContact(_0x328c9e,_0x478199,'work_number',_0x115d93[_0x9757('0x29')])[_0x9757('0x12')](function(_0x584017){if(_0x584017){_0x115d93[_0x9757('0x2b')]=_0x584017['id'];logger[_0x9757('0x10')](_0x9757('0x2d'),_0x115d93[_0x9757('0x2b')]);return _0x586e71(_0x115d93);}createEndUser(_0x115d93,_0x35edcc,_0x478199,_0x328c9e)[_0x9757('0x12')](function(_0x1e3b74){logger[_0x9757('0x10')]('Contact\x20created:',_0x1e3b74[_0x9757('0x2b')]);return _0x586e71(_0x1e3b74);});});})[_0x9757('0x18')](function(_0x457d6c){_0x335212(_0x457d6c);});});};}function createEndUser(_0x4f2ea4,_0x3c4b9c,_0x2c2e5f,_0x1317d6){return new Promise(function(_0x43209b,_0x278adf){var _0x959db3=moment();var _0x241a81={'method':_0x9757('0x2e'),'uri':_0x1317d6+_0x9757('0x2f'),'body':{'contact':{'last_name':_0x4f2ea4['contactNumber'],'work_number':_0x4f2ea4['contactNumber'],'mobile_number':_0x4f2ea4[_0x9757('0x29')],'owner_id':_0x4f2ea4[_0x9757('0x1e')],'created_at':_0x959db3[_0x9757('0x27')](_0x9757('0x30'))}},'json':!![]};_0x241a81['headers']=_0x2c2e5f;logger[_0x9757('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x241a81)[_0x9757('0x12')](function(_0x337dcc){_0x4f2ea4[_0x9757('0x2b')]=_0x337dcc['contact']['id'];_0x43209b(_0x4f2ea4);})[_0x9757('0x18')](function(_0x221f6f){logger[_0x9757('0x19')]('['+[_0x3c4b9c['toUpperCase']()]+']',_0x221f6f[_0x9757('0x1a')]);_0x278adf(_0x221f6f['message']);});});}function getTicket(_0x50f0e4,_0x3aea44,_0x1e28a7,_0x3765e7,_0x23b08c){return function(_0xb90596){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x4f1cdd,_0x6761e9){var _0x184ae3=moment();var _0x23fd63={'method':'POST','uri':_0x1e28a7+_0x9757('0x31'),'body':{'title':intUtil[_0x9757('0x32')](_0x3765e7['Subjects'],_0x23b08c,'\x20'),'description':intUtil[_0x9757('0x32')](_0x3765e7[_0x9757('0x33')],_0x23b08c,'\x0a'),'owner_id':_0xb90596[_0x9757('0x1e')],'creater_id':_0xb90596[_0x9757('0x15')],'targetable_id':_0xb90596['endUserId'],'targetable_type':_0x9757('0x34'),'created_at':_0x184ae3[_0x9757('0x27')](_0x9757('0x30')),'due_date':_0x184ae3[_0x9757('0x35')](0x1e,'m')[_0x9757('0x27')](_0x9757('0x30'))},'json':!![]};_0x23fd63[_0x9757('0xf')]=_0x3aea44;return rp(_0x23fd63)[_0x9757('0x12')](function(_0x22b3d4){_0xb90596['ticketId']=_0x22b3d4['task']['id'];logger[_0x9757('0x10')](_0x9757('0x36'),_0xb90596[_0x9757('0x37')]);_0x4f1cdd(_0xb90596);})['catch'](function(_0x229f8a){logger[_0x9757('0x19')]('['+[_0x50f0e4[_0x9757('0x22')]()]+']',_0x229f8a['message']);_0x6761e9(_0x229f8a[_0x9757('0x1a')]);});});};}function emit(_0x33e418,_0x497542,_0x4c5597){var _0x4e613d={'uri':_0x33e418+_0x9757('0x38')+_0x4c5597};io['to'](util[_0x9757('0x27')](_0x9757('0x39'),_0x497542))['emit'](_0x9757('0x3a'),_0x4e613d);}exports['cs']=function(_0x5aaadf,_0xf2f0dc,_0x173f0f,_0x5e4430,_0x877e84,_0x2933f5,_0xc1bb11,_0x4487a4){var _0x118d02={};var _0x5c8b70={'Authorization':_0x9757('0x3b')+_0x2933f5[_0x9757('0x3c')]};_0x2933f5[_0x9757('0x3d')]=intUtil[_0x9757('0x3e')](_0x2933f5[_0x9757('0x3d')]);_0x2933f5[_0x9757('0x3f')]=intUtil[_0x9757('0x3e')](_0x2933f5['serverUrl']);var _0x484fc5=_0x2933f5[_0x9757('0x3d')];_0x118d02['adminEmail']=_0x2933f5['username'];_0x118d02[_0x9757('0x29')]=_0x4487a4['toLowerCase']()===_0x9757('0x40')?_0xf2f0dc[_0x9757('0x41')]:_0xf2f0dc['calleridnum'];_0x118d02['callDirection']=_0x4487a4===_0x9757('0x42')||_0x4487a4==='unmanaged'?_0x9757('0x42'):'outbound';if(_0x5e4430){_0x118d02[_0x9757('0x1c')]=_0x5e4430['email'];}var _0x3ce556=util[_0x9757('0x27')](_0x9757('0x43'),_0x2933f5[_0x9757('0x3f')],_0xf2f0dc[_0x9757('0x44')],md5(_0xf2f0dc[_0x9757('0x44')]));if(_0x877e84&&_0x877e84[_0x9757('0x45')]){logger[_0x9757('0x10')]('[QUEUE]',_0x9757('0x46'));_0xf2f0dc[_0x9757('0x47')]=_0x3ce556;}else if(_0xc1bb11&&_0xc1bb11[_0x9757('0x48')]&&_0xc1bb11[_0x9757('0x48')]!==_0x9757('0x49')){logger[_0x9757('0x10')](_0x9757('0x4a'),_0x9757('0x46'));_0xf2f0dc[_0x9757('0x47')]=_0x3ce556;}else{_0xf2f0dc[_0x9757('0x47')]='';}return getAdminId(_0x118d02,_0x4487a4,_0x5c8b70,_0x484fc5)[_0x9757('0x12')](getUser(_0x4487a4,_0x5c8b70,_0x484fc5))[_0x9757('0x12')](getEndUser(_0x4487a4,_0x5c8b70,_0x484fc5))[_0x9757('0x12')](getTicket(_0x4487a4,_0x5c8b70,_0x484fc5,_0x173f0f,_0xf2f0dc))['then'](function(_0x4f831a){logger[_0x9757('0x10')](util['format'](_0x9757('0x4b'),_0x4f831a[_0x9757('0x37')]));if(_0x4487a4!==_0x9757('0x4c')){logger['info']('['+[_0x4487a4[_0x9757('0x22')]()]+']',_0x9757('0x4d'));emit(_0x484fc5,_0x5e4430[_0x9757('0x4e')],_0x4f831a[_0x9757('0x2b')]);}})[_0x9757('0x18')](function(_0x333268){logger[_0x9757('0x19')]('['+[_0x4487a4[_0x9757('0x22')]()]+_0x9757('0x4f'),util[_0x9757('0x50')](_0x333268,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1134=['then','users','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','length','email','User\x20found:','userId','Admin\x20selected','catch','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','Subjects','Contact','add','ticketId','Task\x20created:','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','ioredis','./util','../../../../config/logger','redis','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information'];(function(_0x3aa330,_0x253250){var _0x1801cb=function(_0x476cf8){while(--_0x476cf8){_0x3aa330['push'](_0x3aa330['shift']());}};_0x1801cb(++_0x253250);}(_0x1134,0x19c));var _0x4113=function(_0x41c72f,_0x40edae){_0x41c72f=_0x41c72f-0x0;var _0x10d1ba=_0x1134[_0x41c72f];return _0x10d1ba;};'use strict';var _=require(_0x4113('0x0'));var rp=require(_0x4113('0x1'));var md5=require('md5');var util=require(_0x4113('0x2'));var moment=require(_0x4113('0x3'));var Promise=require('bluebird');var Redis=require(_0x4113('0x4'));var intUtil=require(_0x4113('0x5'));var config=require('../../../../config/environment');var logger=require(_0x4113('0x6'))('freshsales');config[_0x4113('0x7')]=_['defaults'](config[_0x4113('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x4113('0x8'))(new Redis(config[_0x4113('0x7')]));function getAdminId(_0x3b6cc4,_0x11153c,_0x25fd0f,_0xfc133b){return new Promise(function(_0x19c657,_0x19b6f2){var _0x5e635c=![];var _0x85a9dd={'method':_0x4113('0x9'),'uri':_0xfc133b+_0x4113('0xa'),'json':!![]};_0x85a9dd[_0x4113('0xb')]=_0x25fd0f;logger[_0x4113('0xc')](_0x4113('0xd'));return rp(_0x85a9dd)[_0x4113('0xe')](function(_0x459605){if(_0x459605){var _0x308b59=_0x459605[_0x4113('0xf')];var _0x53720f=null;for(_0x53720f=0x0;_0x53720f<_0x308b59['length'];_0x53720f++){if(_0x308b59[_0x53720f]['email']===_0x3b6cc4[_0x4113('0x10')]){_0x3b6cc4[_0x4113('0x11')]=_0x308b59[_0x53720f]['id'];_0x5e635c=!![];}}if(_0x5e635c){logger['info']('Admin\x20found:',_0x3b6cc4[_0x4113('0x11')]);_0x19c657(_0x3b6cc4);}else{_0x19b6f2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x19b6f2({'statusCode':0x194,'message':_0x4113('0x12')});}})['catch'](function(_0x59f69b){logger[_0x4113('0x13')]('['+[_0x11153c[_0x4113('0x14')]()]+']',_0x59f69b[_0x4113('0x15')]);_0x19b6f2(_0x59f69b);});});}function getUser(_0x3de530,_0x21d732,_0x76ec16){return function(_0x405849){return new Promise(function(_0xa7f33d,_0x1051d4){var _0x1cd9ae={'method':'GET','uri':_0x76ec16+_0x4113('0xa'),'json':!![]};_0x1cd9ae[_0x4113('0xb')]=_0x21d732;logger[_0x4113('0xc')](_0x4113('0x16'));return rp(_0x1cd9ae)[_0x4113('0xe')](function(_0x9608c3){if(_0x9608c3){var _0x18c627=_0x9608c3[_0x4113('0xf')];var _0x37bf1e=![];var _0x57540a=null;if(_0x405849[_0x4113('0x17')]!==null){logger[_0x4113('0xc')]('Getting\x20user\x20with\x20email',_0x405849['agentEmail']);_0x405849[_0x4113('0x18')]=_0x405849['agentEmail'];for(_0x57540a=0x0;_0x57540a<_0x18c627[_0x4113('0x19')];_0x57540a++){if(_0x18c627[_0x57540a][_0x4113('0x1a')]===_0x405849[_0x4113('0x17')]){_0x37bf1e=!![];_0x405849['userId']=_0x18c627[_0x57540a]['id'];logger[_0x4113('0xc')](_0x4113('0x1b'),_0x405849[_0x4113('0x1c')]);}}}if(!_0x37bf1e){logger[_0x4113('0xc')](_0x4113('0x1d'));_0x405849[_0x4113('0x18')]=_0x405849[_0x4113('0x10')];_0x405849[_0x4113('0x1c')]=_0x405849[_0x4113('0x11')];_0x37bf1e=!![];}if(_0x37bf1e){_0xa7f33d(_0x405849);}else{_0x1051d4({'statusCode':0x194,'message':_0x4113('0x12')});}}else{_0x1051d4({'statusCode':0x194,'message':_0x4113('0x12')});}})[_0x4113('0x1e')](function(_0x56c343){logger[_0x4113('0x13')]('['+[_0x3de530[_0x4113('0x14')]()]+']',_0x56c343['message']);_0x1051d4(_0x56c343);});});};}function searchContact(_0x34d8b4,_0x98d652,_0x3f9819,_0x177a6a){return new Promise(function(_0x2d9cc6,_0x180fed){var _0x234543={'method':_0x4113('0x9'),'headers':_0x98d652,'uri':_0x34d8b4+_0x4113('0x1f')+_0x177a6a+_0x4113('0x20')+_0x3f9819+_0x4113('0x21'),'json':!![]};rp(_0x234543)[_0x4113('0xe')](function(_0x25e422){var _0x24a487=_['find'](_0x25e422[_0x4113('0x22')][_0x4113('0x22')],[_0x3f9819,_0x177a6a]);_0x2d9cc6(_0x24a487);})['catch'](function(_0x201966){_0x180fed(_0x201966);});});}function getEndUser(_0x36e868,_0x2d83de,_0x1d2841){return function(_0x4e3450){return new Promise(function(_0x3fac56,_0x237740){logger[_0x4113('0xc')](util[_0x4113('0x23')](_0x4113('0x24'),_0x4e3450[_0x4113('0x25')]));searchContact(_0x1d2841,_0x2d83de,_0x4113('0x26'),_0x4e3450[_0x4113('0x25')])[_0x4113('0xe')](function(_0x4de3a8){if(_0x4de3a8){_0x4e3450[_0x4113('0x27')]=_0x4de3a8['id'];logger['info'](_0x4113('0x28'),_0x4e3450[_0x4113('0x27')]);return _0x3fac56(_0x4e3450);}searchContact(_0x1d2841,_0x2d83de,_0x4113('0x29'),_0x4e3450[_0x4113('0x25')])[_0x4113('0xe')](function(_0x453d70){if(_0x453d70){_0x4e3450['endUserId']=_0x453d70['id'];logger[_0x4113('0xc')]('Contact\x20found\x20work_number:',_0x4e3450[_0x4113('0x27')]);return _0x3fac56(_0x4e3450);}createEndUser(_0x4e3450,_0x36e868,_0x2d83de,_0x1d2841)[_0x4113('0xe')](function(_0x227498){logger['info'](_0x4113('0x2a'),_0x227498['endUserId']);return _0x3fac56(_0x227498);});});})[_0x4113('0x1e')](function(_0x580434){_0x237740(_0x580434);});});};}function createEndUser(_0x13d161,_0x384a32,_0x51874a,_0x588a16){return new Promise(function(_0x183b14,_0xe129b1){var _0xb2adf0=moment();var _0x4b2739={'method':'POST','uri':_0x588a16+_0x4113('0x2b'),'body':{'contact':{'last_name':_0x13d161[_0x4113('0x25')],'work_number':_0x13d161[_0x4113('0x25')],'mobile_number':_0x13d161[_0x4113('0x25')],'owner_id':_0x13d161[_0x4113('0x1c')],'created_at':_0xb2adf0['format'](_0x4113('0x2c'))}},'json':!![]};_0x4b2739[_0x4113('0xb')]=_0x51874a;logger[_0x4113('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4b2739)[_0x4113('0xe')](function(_0x42c7c6){_0x13d161[_0x4113('0x27')]=_0x42c7c6['contact']['id'];_0x183b14(_0x13d161);})[_0x4113('0x1e')](function(_0x5b8aeb){logger[_0x4113('0x13')]('['+[_0x384a32['toUpperCase']()]+']',_0x5b8aeb[_0x4113('0x15')]);_0xe129b1(_0x5b8aeb[_0x4113('0x15')]);});});}function getTicket(_0x18b491,_0x9adb1f,_0x8606c,_0x2c832f,_0x3c0887){return function(_0x37d0bf){logger['info'](_0x4113('0x2d'));return new Promise(function(_0x38b7ae,_0x55bcba){var _0x1e341c=moment();var _0x541db8={'method':'POST','uri':_0x8606c+_0x4113('0x2e'),'body':{'title':intUtil['getString'](_0x2c832f[_0x4113('0x2f')],_0x3c0887,'\x20'),'description':intUtil['getString'](_0x2c832f['Descriptions'],_0x3c0887,'\x0a'),'owner_id':_0x37d0bf[_0x4113('0x1c')],'creater_id':_0x37d0bf['adminId'],'targetable_id':_0x37d0bf[_0x4113('0x27')],'targetable_type':_0x4113('0x30'),'created_at':_0x1e341c['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1e341c[_0x4113('0x31')](0x1e,'m')[_0x4113('0x23')](_0x4113('0x2c'))},'json':!![]};_0x541db8[_0x4113('0xb')]=_0x9adb1f;return rp(_0x541db8)['then'](function(_0x19dbaa){_0x37d0bf[_0x4113('0x32')]=_0x19dbaa['task']['id'];logger['info'](_0x4113('0x33'),_0x37d0bf['ticketId']);_0x38b7ae(_0x37d0bf);})[_0x4113('0x1e')](function(_0x157300){logger[_0x4113('0x13')]('['+[_0x18b491[_0x4113('0x14')]()]+']',_0x157300['message']);_0x55bcba(_0x157300[_0x4113('0x15')]);});});};}function emit(_0x5d5668,_0x479965,_0x362a72){var _0x2986f1={'uri':_0x5d5668+'/contacts/'+_0x362a72};io['to'](util[_0x4113('0x23')]('user:%s',_0x479965))[_0x4113('0x34')](_0x4113('0x35'),_0x2986f1);}exports['cs']=function(_0x23ebab,_0x48e515,_0x16206a,_0x1ef8b2,_0x437115,_0x1a7173,_0xbdf60d,_0x160431){var _0x33e739={};var _0x110097={'Authorization':'Token\x20token='+_0x1a7173['apiKey']};_0x1a7173[_0x4113('0x36')]=intUtil['stripTrailingSlash'](_0x1a7173['remoteUri']);_0x1a7173['serverUrl']=intUtil[_0x4113('0x37')](_0x1a7173[_0x4113('0x38')]);var _0x2a7d1d=_0x1a7173['remoteUri'];_0x33e739[_0x4113('0x10')]=_0x1a7173[_0x4113('0x39')];_0x33e739[_0x4113('0x25')]=_0x160431['toLowerCase']()===_0x4113('0x3a')?_0x48e515[_0x4113('0x3b')]:_0x48e515[_0x4113('0x3c')];_0x33e739[_0x4113('0x3d')]=_0x160431===_0x4113('0x3e')||_0x160431==='unmanaged'?_0x4113('0x3e'):_0x4113('0x3a');if(_0x1ef8b2){_0x33e739['agentEmail']=_0x1ef8b2['email'];}var _0x488425=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a7173[_0x4113('0x38')],_0x48e515[_0x4113('0x3f')],md5(_0x48e515[_0x4113('0x3f')]));if(_0x437115&&_0x437115['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x48e515[_0x4113('0x40')]=_0x488425;}else if(_0xbdf60d&&_0xbdf60d[_0x4113('0x41')]&&_0xbdf60d[_0x4113('0x41')]!=='none'){logger[_0x4113('0xc')](_0x4113('0x42'),'Recording\x20is\x20enabled!');_0x48e515[_0x4113('0x40')]=_0x488425;}else{_0x48e515[_0x4113('0x40')]='';}return getAdminId(_0x33e739,_0x160431,_0x110097,_0x2a7d1d)[_0x4113('0xe')](getUser(_0x160431,_0x110097,_0x2a7d1d))['then'](getEndUser(_0x160431,_0x110097,_0x2a7d1d))[_0x4113('0xe')](getTicket(_0x160431,_0x110097,_0x2a7d1d,_0x16206a,_0x48e515))[_0x4113('0xe')](function(_0x4585e6){logger[_0x4113('0xc')](util[_0x4113('0x23')](_0x4113('0x43'),_0x4585e6[_0x4113('0x32')]));if(_0x160431!==_0x4113('0x44')){logger['info']('['+[_0x160431[_0x4113('0x14')]()]+']',_0x4113('0x45'));emit(_0x2a7d1d,_0x1ef8b2['name'],_0x4585e6[_0x4113('0x27')]);}})['catch'](function(_0x1f5f57){logger['error']('['+[_0x160431[_0x4113('0x14')]()]+_0x4113('0x46'),util['inspect'](_0x1f5f57,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 7744ede..4e014e5 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0abf=['error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','lodash','./zendesk','./salesforce','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','freshsales','unknown\x20integration','../../../../config/logger'];(function(_0x5b3ce1,_0xedd65b){var _0x38b358=function(_0x154aa6){while(--_0x154aa6){_0x5b3ce1['push'](_0x5b3ce1['shift']());}};_0x38b358(++_0xedd65b);}(_0x0abf,0xe8));var _0xf0ab=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0abf[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var zendesk=require(_0xf0ab('0x1'));var salesforce=require(_0xf0ab('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xf0ab('0x3'));var desk=require('./desk');var vtiger=require(_0xf0ab('0x4'));var servicenow=require(_0xf0ab('0x5'));var dynamics365=require(_0xf0ab('0x6'));var freshsales=require(_0xf0ab('0x7'));var integrations=[_0xf0ab('0x8'),_0xf0ab('0x9'),_0xf0ab('0xa'),'freshdesk',_0xf0ab('0xb'),_0xf0ab('0xc'),_0xf0ab('0xd'),_0xf0ab('0xe'),'freshsales',_0xf0ab('0xf')];exports[_0xf0ab('0x10')]=function(_0x1e7887,_0x4ab8e7,_0x5d25a0,_0x30042c,_0x53a03f,_0x19e9e7){if(_0x5d25a0){if(_[_0xf0ab('0x11')](integrations,_0x1e7887[_0xf0ab('0x12')][_0xf0ab('0x13')]())){try{var _0x2dc4f8=null;var _0x38ca67='';var _0x34ccdc=_0x5d25a0[_0x1e7887['data1'][_0xf0ab('0x13')]()];if(_0x34ccdc){var _0x2cc002=_0x34ccdc[_0x1e7887[_0xf0ab('0x14')]];if(_0x2cc002){var _0x35c75f=_[_0xf0ab('0x15')](_0x2cc002[_0xf0ab('0x16')],{'id':parseInt(_0x1e7887[_0xf0ab('0x17')],0xa)});if(_0x35c75f){if(_0x30042c){if(_0x53a03f&&_0x4ab8e7[_0xf0ab('0x18')]){_0x38ca67=_0xf0ab('0x18');}else if(_0x4ab8e7[_0xf0ab('0x19')]){_0x38ca67=_0xf0ab('0x1a');}else{console[_0xf0ab('0x1b')](_0xf0ab('0x1c'),_0x4ab8e7);}}else{_0x38ca67=_0xf0ab('0x1d');}switch(_0x1e7887[_0xf0ab('0x12')]['toLowerCase']()){case _0xf0ab('0x8'):zendesk[_0x38ca67](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7);break;case _0xf0ab('0x9'):salesforce[_0x38ca67](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7);break;case _0xf0ab('0xa'):sugarcrm[_0x38ca67](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7);break;case _0xf0ab('0x1e'):freshdesk[_0x38ca67](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7);break;case _0xf0ab('0xb'):zoho[_0x38ca67](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7);break;case _0xf0ab('0xc'):desk[_0x38ca67](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7);break;case _0xf0ab('0xd'):vtiger[_0x38ca67](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7);break;case _0xf0ab('0x1f'):freshsales['cs'](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7,_0x38ca67);break;case _0xf0ab('0xf'):servicenow['cs'](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7,_0x38ca67);break;case _0xf0ab('0xe'):dynamics365['cs'](_0x1e7887,_0x4ab8e7,_0x35c75f,_0x30042c,_0x53a03f,_0x2cc002,_0x19e9e7,_0x38ca67);break;default:console[_0xf0ab('0x1b')](_0xf0ab('0x20'));}}else{_0x2dc4f8=require(_0xf0ab('0x21'))(_0x1e7887[_0xf0ab('0x12')][_0xf0ab('0x13')]());_0x2dc4f8[_0xf0ab('0x22')]('[EXEC]',util[_0xf0ab('0x23')](_0xf0ab('0x24'),_0x1e7887[_0xf0ab('0x12')][_0xf0ab('0x13')](),_0x1e7887[_0xf0ab('0x17')]));}}else{_0x2dc4f8=require(_0xf0ab('0x21'))(_0x1e7887[_0xf0ab('0x12')][_0xf0ab('0x13')]());_0x2dc4f8[_0xf0ab('0x22')](_0xf0ab('0x25'),util[_0xf0ab('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x1e7887['data1']['toLowerCase'](),_0x1e7887[_0xf0ab('0x14')]));}}else{}}catch(_0x4f0caf){console[_0xf0ab('0x22')](_0x4f0caf);}}}}; \ No newline at end of file +var _0xb688=['[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data3','queue','log','unmanaged','zendesk','sugarcrm','unknown\x20integration','../../../../config/logger','error'];(function(_0x34ec44,_0x988a08){var _0x57edce=function(_0x19f1a6){while(--_0x19f1a6){_0x34ec44['push'](_0x34ec44['shift']());}};_0x57edce(++_0x988a08);}(_0xb688,0xcf));var _0x8b68=function(_0x2d997e,_0x1bba1d){_0x2d997e=_0x2d997e-0x0;var _0x4b564a=_0xb688[_0x2d997e];return _0x4b564a;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var zendesk=require(_0x8b68('0x1'));var salesforce=require(_0x8b68('0x2'));var sugarcrm=require(_0x8b68('0x3'));var freshdesk=require(_0x8b68('0x4'));var zoho=require(_0x8b68('0x5'));var desk=require('./desk');var vtiger=require(_0x8b68('0x6'));var servicenow=require(_0x8b68('0x7'));var dynamics365=require(_0x8b68('0x8'));var freshsales=require(_0x8b68('0x9'));var integrations=['zendesk',_0x8b68('0xa'),'sugarcrm',_0x8b68('0xb'),_0x8b68('0xc'),_0x8b68('0xd'),_0x8b68('0xe'),_0x8b68('0xf'),_0x8b68('0x10'),_0x8b68('0x11')];exports[_0x8b68('0x12')]=function(_0x24e0b0,_0x2f2e3c,_0x418775,_0x317d01,_0x2a852a,_0x502727){if(_0x418775){if(_[_0x8b68('0x13')](integrations,_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]())){try{var _0x2d8472=null;var _0x1965cf='';var _0x2f3af4=_0x418775[_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]()];if(_0x2f3af4){var _0x2686c7=_0x2f3af4[_0x24e0b0['data2']];if(_0x2686c7){var _0xb2df35=_['find'](_0x2686c7['Configurations'],{'id':parseInt(_0x24e0b0[_0x8b68('0x16')],0xa)});if(_0xb2df35){if(_0x317d01){if(_0x2a852a&&_0x2f2e3c[_0x8b68('0x17')]){_0x1965cf=_0x8b68('0x17');}else if(_0x2f2e3c['routeId']){_0x1965cf='outbound';}else{console[_0x8b68('0x18')]('EVENT\x20UNKNOWN',_0x2f2e3c);}}else{_0x1965cf=_0x8b68('0x19');}switch(_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]()){case _0x8b68('0x1a'):zendesk[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case'salesforce':salesforce[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0x1b'):sugarcrm[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0xb'):freshdesk[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case'zoho':zoho[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0xd'):desk[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0xe'):vtiger[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0x10'):freshsales['cs'](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727,_0x1965cf);break;case _0x8b68('0x11'):servicenow['cs'](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727,_0x1965cf);break;case _0x8b68('0xf'):dynamics365['cs'](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727,_0x1965cf);break;default:console['log'](_0x8b68('0x1c'));}}else{_0x2d8472=require(_0x8b68('0x1d'))(_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]());_0x2d8472[_0x8b68('0x1e')](_0x8b68('0x1f'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x24e0b0[_0x8b68('0x14')]['toLowerCase'](),_0x24e0b0[_0x8b68('0x16')]));}}else{_0x2d8472=require(_0x8b68('0x1d'))(_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]());_0x2d8472[_0x8b68('0x1e')](_0x8b68('0x1f'),util['format'](_0x8b68('0x20'),_0x24e0b0[_0x8b68('0x14')]['toLowerCase'](),_0x24e0b0[_0x8b68('0x21')]));}}else{}}catch(_0x3cf8d2){console[_0x8b68('0x1e')](_0x3cf8d2);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 84887ba..421ea59 100644 --- a/server/services/ami/trigger/integration/salesforce.js +++ b/server/services/ami/trigger/integration/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef1=['Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','forEach','idField','toString','variableName','type','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','ticketType','Task','assign','getString','Subjects','Descriptions','ContactId','sobject','isNil','validateEmail','User','find','execute','then','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','moduleSearch','contact_lead','Contact','length','Lead','lead','Case','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Phone'];(function(_0x25e4cd,_0x2e6b77){var _0x610be6=function(_0x598844){while(--_0x598844){_0x25e4cd['push'](_0x25e4cd['shift']());}};_0x610be6(++_0x2e6b77);}(_0x8ef1,0x113));var _0x18ef=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x8ef1[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x18ef('0x0'));var rp=require(_0x18ef('0x1'));var moment=require('moment');var BPromise=require(_0x18ef('0x2'));var md5=require(_0x18ef('0x3'));var jsforce=require('jsforce');var util=require(_0x18ef('0x4'));var Redis=require(_0x18ef('0x5'));var intUtil=require(_0x18ef('0x6'));var config=require(_0x18ef('0x7'));var logger=require(_0x18ef('0x8'))('salesforce');config[_0x18ef('0x9')]=_[_0x18ef('0xa')](config[_0x18ef('0x9')],{'host':_0x18ef('0xb'),'port':0x18eb});var io=require(_0x18ef('0xc'))(new Redis(config['redis']));function emit(_0x10f0a6,_0xc257a0,_0x3317ae){io['to'](_0x10f0a6)['emit'](_0xc257a0,_0x3317ae);}function getTicket(_0x17d039,_0x5b94a2,_0x44ecc1,_0xa4b75a,_0x5b9603,_0x59a772,_0x5c2bb2,_0x7abea0){var _0x1fd9c4={};if(_0xa4b75a[_0x18ef('0xd')]===_0x18ef('0xe')){_0x1fd9c4=Object[_0x18ef('0xf')]({},{'OwnerId':_0x5b94a2['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x18ef('0x10')](_0xa4b75a[_0x18ef('0x11')],_0x5b9603,'\x20'),'Description':intUtil[_0x18ef('0x10')](_0xa4b75a[_0x18ef('0x12')],_0x5b9603,'\x0a')},getCustomFields(_0x59a772,_0x5b9603));if(_0x44ecc1){_0x1fd9c4['WhoId']=_0x44ecc1['id'];}}else if(_0xa4b75a['ticketType']==='Case'){_0x1fd9c4=Object['assign']({},{'OwnerId':_0x5b94a2['id'],'Subject':intUtil[_0x18ef('0x10')](_0xa4b75a[_0x18ef('0x11')],_0x5b9603,'\x20'),'Description':intUtil[_0x18ef('0x10')](_0xa4b75a[_0x18ef('0x12')],_0x5b9603,'\x0a')},getCustomFields(_0x59a772,_0x5b9603));if(_0x44ecc1){_0x1fd9c4[_0x18ef('0x13')]=_0x44ecc1['id'];}}return _0x5c2bb2[_0x18ef('0x14')](_0xa4b75a['ticketType'])['create'](_0x1fd9c4);}function getUser(_0x3aed54,_0x2fe2db,_0x184dda){if(!_[_0x18ef('0x15')](_0x2fe2db)&&intUtil[_0x18ef('0x16')](_0x2fe2db)){var _0x4a086f={'Email':_0x2fe2db};var _0x6b0c8f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x184dda[_0x18ef('0x14')](_0x18ef('0x17'))[_0x18ef('0x18')](_0x4a086f,_0x6b0c8f)[_0x18ef('0x19')]()[_0x18ef('0x1a')](function(_0x2db7b8){if(_0x2db7b8['length']){var _0x411b41=_[_0x18ef('0x18')](_0x2db7b8,function(_0x53dd2f){return _0x53dd2f[_0x18ef('0x1b')]===_0x2fe2db;});if(_0x411b41){logger[_0x18ef('0x1c')](_0x18ef('0x1d'),_0x2fe2db);return BPromise[_0x18ef('0x1e')]({'id':_0x411b41['Id'],'name':_0x411b41[_0x18ef('0x1f')]});}}else{logger[_0x18ef('0x1c')](_0x18ef('0x20'),_0x2fe2db);return _0x184dda['identity']()[_0x18ef('0x1a')](function(_0x1a77bb){return BPromise['resolve']({'id':_0x1a77bb[_0x18ef('0x21')],'name':_0x1a77bb['display_name']});});}});}else{logger[_0x18ef('0x1c')](_0x18ef('0x20'),_0x2fe2db);return _0x184dda['identity']()[_0x18ef('0x1a')](function(_0x524f66){return BPromise[_0x18ef('0x1e')]({'id':_0x524f66[_0x18ef('0x21')],'name':_0x524f66['display_name']});});}}function getEndUser(_0x159008,_0x580a9b,_0x22d79f,_0x19d911,_0xbf60d6){var _0x23e74c={'Phone':_0x19d911};var _0x430aa8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){if(_0x580a9b[_0x18ef('0xd')]==='Task'){logger[_0x18ef('0x1c')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x19d911,_0x580a9b[_0x18ef('0x22')]);switch(_0x580a9b[_0x18ef('0x22')]){case _0x18ef('0x23'):return _0xbf60d6[_0x18ef('0x14')](_0x18ef('0x24'))[_0x18ef('0x18')](_0x23e74c,_0x430aa8)[_0x18ef('0x19')]()[_0x18ef('0x1a')](function(_0x3e477b){if(_0x3e477b&&_0x3e477b[_0x18ef('0x25')]){return _0x3e477b;}else{return _0xbf60d6[_0x18ef('0x14')](_0x18ef('0x26'))[_0x18ef('0x18')](_0x23e74c,_0x430aa8);}});case'contact':return _0xbf60d6[_0x18ef('0x14')](_0x18ef('0x24'))['find'](_0x23e74c,_0x430aa8)[_0x18ef('0x19')]();case _0x18ef('0x27'):return _0xbf60d6[_0x18ef('0x14')](_0x18ef('0x26'))[_0x18ef('0x18')](_0x23e74c,_0x430aa8);default:return null;}}else if(_0x580a9b[_0x18ef('0xd')]===_0x18ef('0x28')){logger[_0x18ef('0x1c')](_0x18ef('0x29'),_0x19d911,'contact');return _0xbf60d6[_0x18ef('0x14')](_0x18ef('0x24'))['find'](_0x23e74c,_0x430aa8)[_0x18ef('0x19')]();}})[_0x18ef('0x1a')](function(_0x32adb0){if(_0x32adb0&&_0x32adb0['length']){var _0x1ddc2d=_['find'](_0x32adb0,function(_0x928854){return _0x928854['Phone']===_0x19d911;});if(_0x1ddc2d){return BPromise[_0x18ef('0x1e')]({'id':_0x1ddc2d['Id'],'name':_0x1ddc2d['Name'],'phone':_0x1ddc2d[_0x18ef('0x2a')]});}}})[_0x18ef('0x1a')](function(_0x2732c5){if(_0x2732c5){logger[_0x18ef('0x1c')](_0x18ef('0x2b'),_0x19d911);return BPromise['resolve'](_0x2732c5);}else{logger[_0x18ef('0x1c')](_0x18ef('0x2c'),_0x19d911);var _0x113270={'LastName':_0x22d79f!==''?_0x22d79f:util[_0x18ef('0x2d')]('Caller\x20-\x20%s',_0x19d911),'Phone':_0x19d911};if(_0x580a9b[_0x18ef('0x2e')]){if(_0x580a9b[_0x18ef('0x2e')]===_0x18ef('0x2f')){logger['info'](_0x18ef('0x30'),_0x19d911,_0x580a9b[_0x18ef('0x2e')]);}else if(_0x580a9b[_0x18ef('0x2e')]===_0x18ef('0x27')&&_0x580a9b[_0x18ef('0xd')]===_0x18ef('0xe')){logger[_0x18ef('0x1c')](_0x18ef('0x30'),_0x19d911,_0x580a9b['moduleCreate']);_0x113270[_0x18ef('0x31')]=_0x18ef('0x32');}else{return null;}}return _0xbf60d6[_0x18ef('0x14')](_[_0x18ef('0x33')](_0x580a9b[_0x18ef('0x2e')]))[_0x18ef('0x34')](_0x113270);}});}function getCustomFields(_0x4f1287,_0x158b1f){var _0x60c1b5={};if(_0x4f1287['length']>0x0){_[_0x18ef('0x35')](_0x4f1287,function(_0x585585){if(_0x585585['type']==='string'&&_0x585585[_0x18ef('0x36')]){_0x60c1b5[_0x585585[_0x18ef('0x36')]]=_0x585585['content'][_0x18ef('0x37')]();}else if(_0x585585['type']==='variable'&&_0x585585[_0x18ef('0x38')]&&_0x585585[_0x18ef('0x36')]){_0x158b1f[_0x585585[_0x18ef('0x38')]]&&(_0x60c1b5[_0x585585[_0x18ef('0x36')]]=_0x158b1f[_0x585585[_0x18ef('0x38')]]['toString']());}else if(_0x585585[_0x18ef('0x39')]==='customVariable'&&_0x585585['Variable']&&_0x585585[_0x18ef('0x3a')][_0x18ef('0x3b')]&&_0x585585[_0x18ef('0x36')]){_0x158b1f[_0x585585[_0x18ef('0x3a')]['name'][_0x18ef('0x3c')]()]&&(_0x60c1b5[_0x585585[_0x18ef('0x36')]]=_0x158b1f[_0x585585[_0x18ef('0x3a')][_0x18ef('0x3b')][_0x18ef('0x3c')]()][_0x18ef('0x37')]());}});}return _0x60c1b5;}function getConnection(_0x2c6c9c){var _0x57364c=_0x2c6c9c[_0x18ef('0x3d')]['concat'](_0x2c6c9c[_0x18ef('0x3e')]);var _0x4d6c20=new jsforce[(_0x18ef('0x3f'))]({'oauth2':{'loginUrl':_0x2c6c9c[_0x18ef('0x40')]||_0x18ef('0x41'),'clientId':_0x2c6c9c[_0x18ef('0x42')],'clientSecret':_0x2c6c9c[_0x18ef('0x43')]}});return _0x4d6c20[_0x18ef('0x44')](_0x2c6c9c[_0x18ef('0x45')],_0x57364c)[_0x18ef('0x1a')](function(){logger['info'](_0x18ef('0x46'));return _0x4d6c20;});}exports['queue']=function(_0x460586,_0x558401,_0x1a80fb,_0x1b16fe,_0xd6d282,_0x3a51b5){var _0x417ed8,_0x52c683,_0x2ee68e,_0x2337fb;_0x3a51b5[_0x18ef('0x47')]=intUtil['stripTrailingSlash'](_0x3a51b5[_0x18ef('0x47')]);_0x3a51b5[_0x18ef('0x40')]=intUtil[_0x18ef('0x48')](_0x3a51b5[_0x18ef('0x40')]);if(_0xd6d282&&_0xd6d282[_0x18ef('0x49')]){logger[_0x18ef('0x1c')](_0x18ef('0x4a'),_0x18ef('0x4b'));_0x558401[_0x18ef('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a51b5[_0x18ef('0x47')],_0x558401['uniqueid'],md5(_0x558401[_0x18ef('0x4d')]));}else{_0x558401['recordingURL']='';}return getConnection(_0x3a51b5)['then'](function(_0x53f0e6){_0x2337fb=_0x53f0e6;return getUser(_0x3a51b5,_0x1b16fe[_0x18ef('0x4e')],_0x2337fb);})['then'](function(_0x1e6d99){_0x417ed8=_0x1e6d99;return getEndUser(_0x3a51b5,_0x1a80fb,_0x558401[_0x18ef('0x4f')],_0x558401[_0x18ef('0x50')],_0x2337fb);})[_0x18ef('0x1a')](function(_0x1c86a0){_0x52c683=_0x1c86a0;return getTicket(_0x3a51b5,_0x417ed8,_0x52c683,_0x1a80fb,_0x558401,_0x1a80fb[_0x18ef('0x51')],_0x2337fb,_0x18ef('0x52'));})[_0x18ef('0x1a')](function(_0x5864aa){_0x2ee68e=_0x5864aa;logger[_0x18ef('0x1c')](_0x18ef('0x53'),_0x2ee68e['id']);logger[_0x18ef('0x1c')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2ee68e['id'],_0x1b16fe[_0x18ef('0x3b')],_0x3a51b5[_0x18ef('0x39')]);switch(_0x3a51b5[_0x18ef('0x39')]){case'integrationTab':emit(util[_0x18ef('0x2d')](_0x18ef('0x54'),_0x1b16fe['name']),'trigger:salesforce:display',{'recordId':_0x2ee68e['id']});break;case _0x18ef('0x55'):emit(util[_0x18ef('0x2d')](_0x18ef('0x54'),_0x1b16fe[_0x18ef('0x3b')]),_0x18ef('0x56'),{'uri':util[_0x18ef('0x2d')](_0x18ef('0x57'),_0x2337fb[_0x18ef('0x58')],_0x2ee68e['id'])});break;default:logger[_0x18ef('0x59')](_0x18ef('0x5a'));}})[_0x18ef('0x5b')](function(_0x6fe862){logger[_0x18ef('0x59')](_0x18ef('0x4a'),JSON[_0x18ef('0x5c')](_0x6fe862));});};exports[_0x18ef('0x5d')]=function(_0x49a0cd,_0x44442f,_0x2c43d8,_0x2f9e7c,_0x211ef6,_0x46264c,_0x5f0cea){var _0x3b09ce,_0x27cf59,_0x49f5fb,_0x3aa263;_0x46264c['serverUrl']=intUtil[_0x18ef('0x48')](_0x46264c[_0x18ef('0x47')]);_0x46264c['remoteUri']=intUtil[_0x18ef('0x48')](_0x46264c[_0x18ef('0x40')]);if(_0x5f0cea&&_0x5f0cea['recordingFormat']&&_0x5f0cea[_0x18ef('0x5e')]!=='none'){logger[_0x18ef('0x1c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x44442f[_0x18ef('0x4c')]=util[_0x18ef('0x2d')](_0x18ef('0x5f'),_0x46264c[_0x18ef('0x47')],_0x44442f['uniqueid'],md5(_0x44442f[_0x18ef('0x4d')]));}return getConnection(_0x46264c)[_0x18ef('0x1a')](function(_0x193f3b){_0x3aa263=_0x193f3b;return getUser(_0x46264c,_0x2f9e7c['email'],_0x3aa263);})[_0x18ef('0x1a')](function(_0x1f1319){_0x3b09ce=_0x1f1319;return getEndUser(_0x46264c,_0x2c43d8,_0x44442f['destcalleridname'],_0x44442f['destcalleridnum'],_0x3aa263);})[_0x18ef('0x1a')](function(_0x1b0b38){_0x27cf59=_0x1b0b38;return getTicket(_0x46264c,_0x3b09ce,_0x27cf59,_0x2c43d8,_0x44442f,_0x2c43d8['Fields'],_0x3aa263,'outbound');})['then'](function(_0x2779cf){_0x49f5fb=_0x2779cf;logger['info'](_0x18ef('0x60'),_0x49f5fb['id']);logger[_0x18ef('0x1c')](_0x18ef('0x61'),_0x49f5fb['id'],_0x2f9e7c['name'],_0x46264c[_0x18ef('0x39')]);switch(_0x46264c['type']){case _0x18ef('0x62'):emit(util[_0x18ef('0x2d')](_0x18ef('0x54'),_0x2f9e7c[_0x18ef('0x3b')]),'trigger:salesforce:display',{'recordId':_0x49f5fb['id']});break;case _0x18ef('0x55'):emit(util[_0x18ef('0x2d')]('user:%s',_0x2f9e7c['name']),_0x18ef('0x56'),{'uri':util[_0x18ef('0x2d')](_0x18ef('0x57'),_0x3aa263[_0x18ef('0x58')],_0x49f5fb['id'])});break;default:logger['error'](_0x18ef('0x63'),_0x18ef('0x64'));}})[_0x18ef('0x5b')](function(_0x45f0ef){logger[_0x18ef('0x59')](_0x18ef('0x63'),JSON['stringify'](_0x45f0ef));});};exports[_0x18ef('0x65')]=function(_0x5b86be,_0x1d2b50,_0x388807,_0x5a2fde,_0x3bcdfb,_0x161da5){var _0x49824c,_0x20d526,_0x4c5672,_0xe7a53d;_0x161da5[_0x18ef('0x47')]=intUtil['stripTrailingSlash'](_0x161da5[_0x18ef('0x47')]);_0x161da5[_0x18ef('0x40')]=intUtil[_0x18ef('0x48')](_0x161da5['remoteUri']);if(_0x3bcdfb&&_0x3bcdfb[_0x18ef('0x49')]){logger[_0x18ef('0x1c')]('['+_0x1d2b50[_0x18ef('0x66')][_0x18ef('0x67')]()+']',_0x18ef('0x4b'));_0x1d2b50['recordingURL']=util[_0x18ef('0x2d')](_0x18ef('0x5f'),_0x161da5[_0x18ef('0x47')],_0x1d2b50[_0x18ef('0x4d')],md5(_0x1d2b50[_0x18ef('0x4d')]));}else{_0x1d2b50['recordingURL']='';}return getConnection(_0x161da5)[_0x18ef('0x1a')](function(_0x30b102){_0xe7a53d=_0x30b102;if(!_[_0x18ef('0x15')](_0x5a2fde)){return getUser(_0x161da5,_0x5a2fde[_0x18ef('0x3b')],_0xe7a53d);}else{return getUser(_0x161da5,null,_0xe7a53d);}})['then'](function(_0x371a11){_0x49824c=_0x371a11;return getEndUser(_0x161da5,_0x388807,_0x1d2b50[_0x18ef('0x4f')],_0x1d2b50[_0x18ef('0x50')],_0xe7a53d);})[_0x18ef('0x1a')](function(_0x5d277a){_0x20d526=_0x5d277a;return getTicket(_0x161da5,_0x49824c,_0x20d526,_0x388807,_0x1d2b50,_0x388807['Fields'],_0xe7a53d);})[_0x18ef('0x1a')](function(_0x441950){_0x4c5672=_0x441950;logger[_0x18ef('0x1c')]('['+_0x1d2b50[_0x18ef('0x66')][_0x18ef('0x67')]()+_0x18ef('0x68'),_0x4c5672['id']);logger['info']('['+_0x1d2b50['lastevent'][_0x18ef('0x67')]()+_0x18ef('0x69'),_0x161da5[_0x18ef('0x39')]);})[_0x18ef('0x5b')](function(_0x25ade6){logger['error']('['+_0x1d2b50['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x25ade6));});}; \ No newline at end of file +var _0x67e0=['integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','outbound','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','monitor_format','lastevent','calleridname','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','redis','localhost','socket.io-emitter','emit','ticketType','assign','getString','Descriptions','WhoId','ContactId','sobject','create','isNil','find','execute','length','info','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','lead','Case','contact','Phone','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','forEach','string','idField','content','type','variableName','toString','customVariable','Variable','name','remoteUri','https://login.salesforce.com','clientId','queue','serverUrl','stripTrailingSlash','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x3e5870,_0x2c8112){var _0x5a398e=function(_0x4a382f){while(--_0x4a382f){_0x3e5870['push'](_0x3e5870['shift']());}};_0x5a398e(++_0x2c8112);}(_0x67e0,0xdc));var _0x067e=function(_0x4bf17a,_0x24d74c){_0x4bf17a=_0x4bf17a-0x0;var _0xe22657=_0x67e0[_0x4bf17a];return _0xe22657;};'use strict';var _=require(_0x067e('0x0'));var rp=require(_0x067e('0x1'));var moment=require(_0x067e('0x2'));var BPromise=require(_0x067e('0x3'));var md5=require('md5');var jsforce=require(_0x067e('0x4'));var util=require(_0x067e('0x5'));var Redis=require(_0x067e('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('salesforce');config['redis']=_['defaults'](config[_0x067e('0x7')],{'host':_0x067e('0x8'),'port':0x18eb});var io=require(_0x067e('0x9'))(new Redis(config[_0x067e('0x7')]));function emit(_0x37cde8,_0xda4a9f,_0x43dd13){io['to'](_0x37cde8)[_0x067e('0xa')](_0xda4a9f,_0x43dd13);}function getTicket(_0x298632,_0x3276db,_0x3e764f,_0x5c9fa1,_0x505dde,_0x935e2,_0x1c2364,_0xff6453){var _0x5878b4={};if(_0x5c9fa1[_0x067e('0xb')]==='Task'){_0x5878b4=Object[_0x067e('0xc')]({},{'OwnerId':_0x3276db['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x067e('0xd')](_0x5c9fa1['Subjects'],_0x505dde,'\x20'),'Description':intUtil[_0x067e('0xd')](_0x5c9fa1[_0x067e('0xe')],_0x505dde,'\x0a')},getCustomFields(_0x935e2,_0x505dde));if(_0x3e764f){_0x5878b4[_0x067e('0xf')]=_0x3e764f['id'];}}else if(_0x5c9fa1[_0x067e('0xb')]==='Case'){_0x5878b4=Object[_0x067e('0xc')]({},{'OwnerId':_0x3276db['id'],'Subject':intUtil[_0x067e('0xd')](_0x5c9fa1['Subjects'],_0x505dde,'\x20'),'Description':intUtil[_0x067e('0xd')](_0x5c9fa1[_0x067e('0xe')],_0x505dde,'\x0a')},getCustomFields(_0x935e2,_0x505dde));if(_0x3e764f){_0x5878b4[_0x067e('0x10')]=_0x3e764f['id'];}}return _0x1c2364[_0x067e('0x11')](_0x5c9fa1[_0x067e('0xb')])[_0x067e('0x12')](_0x5878b4);}function getUser(_0x1a1bfb,_0x3ad223,_0x5b5281){if(!_[_0x067e('0x13')](_0x3ad223)&&intUtil['validateEmail'](_0x3ad223)){var _0x5e8bf8={'Email':_0x3ad223};var _0x533942={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5b5281[_0x067e('0x11')]('User')[_0x067e('0x14')](_0x5e8bf8,_0x533942)[_0x067e('0x15')]()['then'](function(_0x5b878f){if(_0x5b878f[_0x067e('0x16')]){var _0x81e0f3=_['find'](_0x5b878f,function(_0x37086d){return _0x37086d['Email']===_0x3ad223;});if(_0x81e0f3){logger[_0x067e('0x17')](_0x067e('0x18'),_0x3ad223);return BPromise[_0x067e('0x19')]({'id':_0x81e0f3['Id'],'name':_0x81e0f3['Name']});}}else{logger[_0x067e('0x17')](_0x067e('0x1a'),_0x3ad223);return _0x5b5281['identity']()[_0x067e('0x1b')](function(_0x2b6baf){return BPromise[_0x067e('0x19')]({'id':_0x2b6baf[_0x067e('0x1c')],'name':_0x2b6baf[_0x067e('0x1d')]});});}});}else{logger['info'](_0x067e('0x1a'),_0x3ad223);return _0x5b5281[_0x067e('0x1e')]()[_0x067e('0x1b')](function(_0x13f159){return BPromise[_0x067e('0x19')]({'id':_0x13f159[_0x067e('0x1c')],'name':_0x13f159['display_name']});});}}function getEndUser(_0x487ac9,_0x316e98,_0x2a1f52,_0x4158c8,_0x46ff01){var _0x25a6d6={'Phone':_0x4158c8};var _0x491b9b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x067e('0x19')]()[_0x067e('0x1b')](function(){if(_0x316e98[_0x067e('0xb')]===_0x067e('0x1f')){logger[_0x067e('0x17')](_0x067e('0x20'),_0x4158c8,_0x316e98[_0x067e('0x21')]);switch(_0x316e98[_0x067e('0x21')]){case _0x067e('0x22'):return _0x46ff01[_0x067e('0x11')](_0x067e('0x23'))[_0x067e('0x14')](_0x25a6d6,_0x491b9b)['execute']()[_0x067e('0x1b')](function(_0x1b2606){if(_0x1b2606&&_0x1b2606['length']){return _0x1b2606;}else{return _0x46ff01['sobject'](_0x067e('0x24'))['find'](_0x25a6d6,_0x491b9b);}});case'contact':return _0x46ff01[_0x067e('0x11')](_0x067e('0x23'))['find'](_0x25a6d6,_0x491b9b)[_0x067e('0x15')]();case _0x067e('0x25'):return _0x46ff01[_0x067e('0x11')](_0x067e('0x24'))['find'](_0x25a6d6,_0x491b9b);default:return null;}}else if(_0x316e98[_0x067e('0xb')]===_0x067e('0x26')){logger[_0x067e('0x17')](_0x067e('0x20'),_0x4158c8,_0x067e('0x27'));return _0x46ff01[_0x067e('0x11')](_0x067e('0x23'))[_0x067e('0x14')](_0x25a6d6,_0x491b9b)['execute']();}})['then'](function(_0x3e8307){if(_0x3e8307&&_0x3e8307[_0x067e('0x16')]){var _0x102174=_[_0x067e('0x14')](_0x3e8307,function(_0x3b5516){return _0x3b5516['Phone']===_0x4158c8;});if(_0x102174){return BPromise[_0x067e('0x19')]({'id':_0x102174['Id'],'name':_0x102174['Name'],'phone':_0x102174[_0x067e('0x28')]});}}})['then'](function(_0x4950e9){if(_0x4950e9){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x4158c8);return BPromise[_0x067e('0x19')](_0x4950e9);}else{logger[_0x067e('0x17')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x4158c8);var _0x4f5d9e={'LastName':_0x2a1f52!==_0x067e('0x29')?_0x2a1f52:util[_0x067e('0x2a')](_0x067e('0x2b'),_0x4158c8),'Phone':_0x4158c8};if(_0x316e98[_0x067e('0x2c')]){if(_0x316e98[_0x067e('0x2c')]===_0x067e('0x27')){logger[_0x067e('0x17')](_0x067e('0x2d'),_0x4158c8,_0x316e98[_0x067e('0x2c')]);}else if(_0x316e98['moduleCreate']==='lead'&&_0x316e98[_0x067e('0xb')]===_0x067e('0x1f')){logger[_0x067e('0x17')](_0x067e('0x2d'),_0x4158c8,_0x316e98[_0x067e('0x2c')]);_0x4f5d9e[_0x067e('0x2e')]='No\x20Company';}else{return null;}}return _0x46ff01['sobject'](_[_0x067e('0x2f')](_0x316e98[_0x067e('0x2c')]))[_0x067e('0x12')](_0x4f5d9e);}});}function getCustomFields(_0x342986,_0xb4ca44){var _0x406709={};if(_0x342986[_0x067e('0x16')]>0x0){_[_0x067e('0x30')](_0x342986,function(_0x1d9731){if(_0x1d9731['type']===_0x067e('0x31')&&_0x1d9731['idField']){_0x406709[_0x1d9731[_0x067e('0x32')]]=_0x1d9731[_0x067e('0x33')]['toString']();}else if(_0x1d9731[_0x067e('0x34')]==='variable'&&_0x1d9731[_0x067e('0x35')]&&_0x1d9731[_0x067e('0x32')]){_0xb4ca44[_0x1d9731[_0x067e('0x35')]]&&(_0x406709[_0x1d9731[_0x067e('0x32')]]=_0xb4ca44[_0x1d9731['variableName']][_0x067e('0x36')]());}else if(_0x1d9731[_0x067e('0x34')]===_0x067e('0x37')&&_0x1d9731['Variable']&&_0x1d9731[_0x067e('0x38')]['name']&&_0x1d9731[_0x067e('0x32')]){_0xb4ca44[_0x1d9731['Variable'][_0x067e('0x39')]['toLowerCase']()]&&(_0x406709[_0x1d9731['idField']]=_0xb4ca44[_0x1d9731[_0x067e('0x38')][_0x067e('0x39')]['toLowerCase']()][_0x067e('0x36')]());}});}return _0x406709;}function getConnection(_0x468305){var _0xc54164=_0x468305['password']['concat'](_0x468305['securityToken']);var _0x4df572=new jsforce['Connection']({'oauth2':{'loginUrl':_0x468305[_0x067e('0x3a')]||_0x067e('0x3b'),'clientId':_0x468305[_0x067e('0x3c')],'clientSecret':_0x468305['clientSecret']}});return _0x4df572['login'](_0x468305['username'],_0xc54164)[_0x067e('0x1b')](function(){logger[_0x067e('0x17')]('Connection\x20established.');return _0x4df572;});}exports[_0x067e('0x3d')]=function(_0x154c6a,_0x3c9efb,_0x2fcedd,_0x458a72,_0x1e4c4d,_0x247e2c){var _0x5500ed,_0x55a343,_0x1d4eb7,_0x26bddd;_0x247e2c[_0x067e('0x3e')]=intUtil['stripTrailingSlash'](_0x247e2c[_0x067e('0x3e')]);_0x247e2c['remoteUri']=intUtil[_0x067e('0x3f')](_0x247e2c['remoteUri']);if(_0x1e4c4d&&_0x1e4c4d['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x3c9efb['recordingURL']=util['format'](_0x067e('0x40'),_0x247e2c[_0x067e('0x3e')],_0x3c9efb[_0x067e('0x41')],md5(_0x3c9efb[_0x067e('0x41')]));}else{_0x3c9efb[_0x067e('0x42')]='';}return getConnection(_0x247e2c)[_0x067e('0x1b')](function(_0x12c70f){_0x26bddd=_0x12c70f;return getUser(_0x247e2c,_0x458a72['email'],_0x26bddd);})[_0x067e('0x1b')](function(_0x2534d8){_0x5500ed=_0x2534d8;return getEndUser(_0x247e2c,_0x2fcedd,_0x3c9efb['calleridname'],_0x3c9efb[_0x067e('0x43')],_0x26bddd);})[_0x067e('0x1b')](function(_0xb320d2){_0x55a343=_0xb320d2;return getTicket(_0x247e2c,_0x5500ed,_0x55a343,_0x2fcedd,_0x3c9efb,_0x2fcedd[_0x067e('0x44')],_0x26bddd,_0x067e('0x3d'));})[_0x067e('0x1b')](function(_0xc39d15){_0x1d4eb7=_0xc39d15;logger[_0x067e('0x17')](_0x067e('0x45'),_0x1d4eb7['id']);logger['info'](_0x067e('0x46'),_0x1d4eb7['id'],_0x458a72[_0x067e('0x39')],_0x247e2c[_0x067e('0x34')]);switch(_0x247e2c[_0x067e('0x34')]){case _0x067e('0x47'):emit(util['format']('user:%s',_0x458a72['name']),_0x067e('0x48'),{'recordId':_0x1d4eb7['id']});break;case _0x067e('0x49'):emit(util[_0x067e('0x2a')](_0x067e('0x4a'),_0x458a72[_0x067e('0x39')]),_0x067e('0x4b'),{'uri':util['format']('%s/%s/e',_0x26bddd[_0x067e('0x4c')],_0x1d4eb7['id'])});break;default:logger[_0x067e('0x4d')](_0x067e('0x4e'));}})[_0x067e('0x4f')](function(_0x4e3e8a){logger[_0x067e('0x4d')](_0x067e('0x50'),JSON['stringify'](_0x4e3e8a));});};exports['outbound']=function(_0x36f3c9,_0x2a1798,_0x21a17c,_0x2be1ca,_0x49746f,_0x4bf6ae,_0x22beef){var _0x3b6b37,_0x5ed521,_0xa806cc,_0x5df241;_0x4bf6ae[_0x067e('0x3e')]=intUtil[_0x067e('0x3f')](_0x4bf6ae['serverUrl']);_0x4bf6ae[_0x067e('0x3a')]=intUtil[_0x067e('0x3f')](_0x4bf6ae[_0x067e('0x3a')]);if(_0x22beef&&_0x22beef[_0x067e('0x51')]&&_0x22beef['recordingFormat']!==_0x067e('0x52')){logger[_0x067e('0x17')](_0x067e('0x53'),_0x067e('0x54'));_0x2a1798['recordingURL']=util[_0x067e('0x2a')](_0x067e('0x40'),_0x4bf6ae['serverUrl'],_0x2a1798[_0x067e('0x41')],md5(_0x2a1798[_0x067e('0x41')]));}return getConnection(_0x4bf6ae)['then'](function(_0x411c4e){_0x5df241=_0x411c4e;return getUser(_0x4bf6ae,_0x2be1ca['email'],_0x5df241);})[_0x067e('0x1b')](function(_0x145227){_0x3b6b37=_0x145227;return getEndUser(_0x4bf6ae,_0x21a17c,_0x2a1798[_0x067e('0x55')],_0x2a1798[_0x067e('0x56')],_0x5df241);})[_0x067e('0x1b')](function(_0x1754ec){_0x5ed521=_0x1754ec;return getTicket(_0x4bf6ae,_0x3b6b37,_0x5ed521,_0x21a17c,_0x2a1798,_0x21a17c[_0x067e('0x44')],_0x5df241,_0x067e('0x57'));})[_0x067e('0x1b')](function(_0x25ce2e){_0xa806cc=_0x25ce2e;logger[_0x067e('0x17')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xa806cc['id']);logger[_0x067e('0x17')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xa806cc['id'],_0x2be1ca[_0x067e('0x39')],_0x4bf6ae[_0x067e('0x34')]);switch(_0x4bf6ae[_0x067e('0x34')]){case'integrationTab':emit(util[_0x067e('0x2a')](_0x067e('0x4a'),_0x2be1ca[_0x067e('0x39')]),_0x067e('0x48'),{'recordId':_0xa806cc['id']});break;case _0x067e('0x49'):emit(util[_0x067e('0x2a')]('user:%s',_0x2be1ca[_0x067e('0x39')]),_0x067e('0x4b'),{'uri':util[_0x067e('0x2a')](_0x067e('0x58'),_0x5df241[_0x067e('0x4c')],_0xa806cc['id'])});break;default:logger[_0x067e('0x4d')](_0x067e('0x53'),_0x067e('0x59'));}})[_0x067e('0x4f')](function(_0x4a9b5f){logger[_0x067e('0x4d')]('[OUTBOUND]',JSON[_0x067e('0x5a')](_0x4a9b5f));});};exports[_0x067e('0x5b')]=function(_0x144bcc,_0x3c5426,_0x4023eb,_0x5eb6e1,_0x3b3d2a,_0x573fd1){var _0x3f7d6e,_0x2af501,_0x359434,_0x3d5dc1;_0x573fd1[_0x067e('0x3e')]=intUtil[_0x067e('0x3f')](_0x573fd1[_0x067e('0x3e')]);_0x573fd1[_0x067e('0x3a')]=intUtil[_0x067e('0x3f')](_0x573fd1[_0x067e('0x3a')]);if(_0x3b3d2a&&_0x3b3d2a[_0x067e('0x5c')]){logger[_0x067e('0x17')]('['+_0x3c5426[_0x067e('0x5d')]['toUpperCase']()+']',_0x067e('0x54'));_0x3c5426[_0x067e('0x42')]=util[_0x067e('0x2a')](_0x067e('0x40'),_0x573fd1[_0x067e('0x3e')],_0x3c5426[_0x067e('0x41')],md5(_0x3c5426[_0x067e('0x41')]));}else{_0x3c5426['recordingURL']='';}return getConnection(_0x573fd1)[_0x067e('0x1b')](function(_0x277967){_0x3d5dc1=_0x277967;if(!_[_0x067e('0x13')](_0x5eb6e1)){return getUser(_0x573fd1,_0x5eb6e1[_0x067e('0x39')],_0x3d5dc1);}else{return getUser(_0x573fd1,null,_0x3d5dc1);}})[_0x067e('0x1b')](function(_0x2e73ff){_0x3f7d6e=_0x2e73ff;return getEndUser(_0x573fd1,_0x4023eb,_0x3c5426[_0x067e('0x5e')],_0x3c5426[_0x067e('0x43')],_0x3d5dc1);})[_0x067e('0x1b')](function(_0x58b4b9){_0x2af501=_0x58b4b9;return getTicket(_0x573fd1,_0x3f7d6e,_0x2af501,_0x4023eb,_0x3c5426,_0x4023eb[_0x067e('0x44')],_0x3d5dc1);})['then'](function(_0xd36537){_0x359434=_0xd36537;logger[_0x067e('0x17')]('['+_0x3c5426[_0x067e('0x5d')][_0x067e('0x5f')]()+_0x067e('0x60'),_0x359434['id']);logger[_0x067e('0x17')]('['+_0x3c5426[_0x067e('0x5d')][_0x067e('0x5f')]()+']\x20Integration\x20account\x20type\x20%s.',_0x573fd1[_0x067e('0x34')]);})[_0x067e('0x4f')](function(_0x4965ad){logger[_0x067e('0x4d')]('['+_0x3c5426['lastevent'][_0x067e('0x5f')]()+']',JSON[_0x067e('0x5a')](_0x4965ad));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index a797462..1a37986 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x3a65f6,_0x58863a){var _0x111bf6=function(_0x514a8c){while(--_0x514a8c){_0x3a65f6['push'](_0x3a65f6['shift']());}};_0x111bf6(++_0x58863a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0x5fc3[_0x1f5887];return _0x21774b;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x39f5b,_0x224393){var _0x29c795=function(_0x16284b){while(--_0x16284b){_0x39f5b['push'](_0x39f5b['shift']());}};_0x29c795(++_0x224393);}(_0x1261,0x144));var _0x1126=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x1261[_0x538c70];return _0x42ae01;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index cbbd97f..e6a45f7 100644 --- a/server/services/ami/trigger/integration/sugarcrm.js +++ b/server/services/ami/trigger/integration/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0ae=['%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Fields','Inbound','Ticket\x20created!','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','users','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','calleridname','error','lastevent','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','name','direction','length','variableName','push','JSON','stringify','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','get_entry_list','Employees','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','forEach','string','nameField','customField','content','type','idField','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x5e50e1,_0x3414a3){var _0x12fb8c=function(_0x202650){while(--_0x202650){_0x5e50e1['push'](_0x5e50e1['shift']());}};_0x12fb8c(++_0x3414a3);}(_0xe0ae,0x18d));var _0xee0a=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xe0ae[_0x3f7598];return _0x51fb16;};'use strict';var _=require('lodash');var rp=require(_0xee0a('0x0'));var BPromise=require(_0xee0a('0x1'));var md5=require(_0xee0a('0x2'));var util=require(_0xee0a('0x3'));var Redis=require(_0xee0a('0x4'));var intUtil=require('./util');var config=require(_0xee0a('0x5'));var logger=require('../../../../config/logger')(_0xee0a('0x6'));config[_0xee0a('0x7')]=_['defaults'](config[_0xee0a('0x7')],{'host':_0xee0a('0x8'),'port':0x18eb});var io=require(_0xee0a('0x9'))(new Redis(config[_0xee0a('0x7')]));var def={'method':_0xee0a('0xa'),'json':!![]};function emit(_0x23bdd8,_0x136b3b,_0x11e959){io['to'](_0x23bdd8)[_0xee0a('0xb')](_0x136b3b,_0x11e959);}function getTicket(_0x17d471,_0x11aa25,_0x4392a6,_0x1ca872,_0x951fd5,_0x163953,_0x8312b9,_0x137ad8){logger[_0xee0a('0xc')](_0xee0a('0xd'));var _0x293a34=new Date();var _0x56dbfc=[{'name':'name','value':intUtil[_0xee0a('0xe')](_0x1ca872[_0xee0a('0xf')],_0x951fd5,'\x20')},{'name':_0xee0a('0x10'),'value':_0x11aa25['id']},{'name':'created_by','value':_0x11aa25['id']},{'name':'description','value':intUtil[_0xee0a('0xe')](_0x1ca872[_0xee0a('0x11')],_0x951fd5,'\x0a')},{'name':_0xee0a('0x12'),'value':_0x293a34[_0xee0a('0x13')]()['slice'](0x0,0x13)[_0xee0a('0x14')]('T','\x20')},{'name':_0xee0a('0x15'),'value':'0'},{'name':_0xee0a('0x16'),'value':'15'},{'name':_0xee0a('0x17'),'value':_0x4392a6['id']},{'name':'parent_type','value':_0xee0a('0x18')},{'name':_0xee0a('0x19'),'value':_0x4392a6[_0xee0a('0x1a')]},{'name':_0xee0a('0x1b'),'value':_0x137ad8}];if(_0x163953[_0xee0a('0x1c')]){_['forEach'](_0x163953,function(_0x4a76dd){if(_0x951fd5[_0x4a76dd[_0xee0a('0x1d')]]){_0x56dbfc[_0xee0a('0x1e')]({'name':_0x4a76dd['idField'],'value':_0x951fd5[_0x4a76dd[_0xee0a('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xee0a('0x1f'),'response_type':_0xee0a('0x1f'),'rest_data':JSON[_0xee0a('0x20')]({'session':_0x8312b9['id'],'module_name':'Calls','name_value_list':_0x56dbfc})}});}function getAuth(_0x4c3034){return util[_0xee0a('0x21')](_0xee0a('0x22'),new Buffer(_0x4c3034[_0xee0a('0x23')]+':X')[_0xee0a('0x24')]('base64'));}function getServerInfo(_0x3fca79){return request({'form':{'method':_0xee0a('0x25'),'input_type':_0xee0a('0x1f'),'response_type':'JSON','rest_data':JSON[_0xee0a('0x20')]({'session':_0x3fca79['id']})}});}function getUser(_0x2a9310,_0x33e798,_0x25af37){if(!_[_0xee0a('0x26')](_0x33e798)){logger['info']('Getting\x20agent\x20with\x20name',_0x33e798);return request({'form':{'method':_0xee0a('0x27'),'input_type':_0xee0a('0x1f'),'response_type':_0xee0a('0x1f'),'rest_data':JSON[_0xee0a('0x20')]({'session':_0x25af37['id'],'module_name':_0xee0a('0x28'),'query':util[_0xee0a('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x33e798),'order_by':'','offset':'0','select_fields':['id','name',_0xee0a('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xee0a('0x2a')](function(_0x47ef0f){if(_0x47ef0f[_0xee0a('0x2b')][_0xee0a('0x1c')]){var _0x46576e=_[_0xee0a('0x2c')](_0x47ef0f[_0xee0a('0x2b')],function(_0x2dd2b1){return _0x2dd2b1[_0xee0a('0x2d')][_0xee0a('0x29')][_0xee0a('0x2e')]===_0x33e798;});if(_0x46576e){logger[_0xee0a('0xc')](_0xee0a('0x2f'));return BPromise[_0xee0a('0x30')]({'id':_0x46576e[_0xee0a('0x2d')]['id'][_0xee0a('0x2e')],'name':_0x46576e[_0xee0a('0x2d')][_0xee0a('0x1a')]['value']});}}logger[_0xee0a('0xc')](_0xee0a('0x31'));return BPromise[_0xee0a('0x30')]({'id':_0x25af37[_0xee0a('0x2d')][_0xee0a('0x32')][_0xee0a('0x2e')],'name':_0x25af37[_0xee0a('0x2d')][_0xee0a('0x29')]['value']});});}else{logger[_0xee0a('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xee0a('0x30')]({'id':_0x25af37[_0xee0a('0x2d')][_0xee0a('0x32')][_0xee0a('0x2e')],'name':_0x25af37[_0xee0a('0x2d')]['user_name']['value']});}}function getEndUser(_0x28311a,_0x43aad6,_0xe5e476,_0x3b2f77){logger[_0xee0a('0xc')](_0xee0a('0x33'),_0xe5e476);return request({'form':{'method':_0xee0a('0x27'),'input_type':_0xee0a('0x1f'),'response_type':_0xee0a('0x1f'),'rest_data':JSON[_0xee0a('0x20')]({'session':_0x3b2f77['id'],'module_name':_0xee0a('0x18'),'query':util[_0xee0a('0x21')]('contacts.phone_home\x20=\x20\x22%s\x22',_0xe5e476),'order_by':'','offset':'0','select_fields':['id',_0xee0a('0x1a'),_0xee0a('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xee0a('0x2a')](function(_0x3b03ac){if(_0x3b03ac[_0xee0a('0x2b')]['length']){var _0x25f861=_[_0xee0a('0x2c')](_0x3b03ac[_0xee0a('0x2b')],function(_0x2451d4){return _0x2451d4[_0xee0a('0x2d')][_0xee0a('0x34')][_0xee0a('0x2e')]===_0xe5e476;});if(_0x25f861){logger[_0xee0a('0xc')](_0xee0a('0x35'));return BPromise[_0xee0a('0x30')]({'id':_0x25f861[_0xee0a('0x2d')]['id']['value'],'name':_0x25f861['name_value_list'][_0xee0a('0x1a')]['value'],'phone':_0x25f861[_0xee0a('0x2d')][_0xee0a('0x34')][_0xee0a('0x2e')]});}}else{logger['info'](_0xee0a('0x36'));return request({'form':{'method':'set_entry','input_type':_0xee0a('0x1f'),'response_type':_0xee0a('0x1f'),'rest_data':JSON[_0xee0a('0x20')]({'session':_0x3b2f77['id'],'module_name':'Contacts','name_value_list':[{'name':_0xee0a('0x37'),'value':_0x43aad6!==_0xee0a('0x38')?_0x43aad6:util[_0xee0a('0x21')](_0xee0a('0x39'),_0xe5e476)},{'name':_0xee0a('0x34'),'value':_0xe5e476}]})}})[_0xee0a('0x2a')](function(_0x5ce00c){logger['info']('Enduser\x20created.');return BPromise[_0xee0a('0x30')]({'id':_0x5ce00c['id'],'name':_0x5ce00c[_0xee0a('0x2b')][_0xee0a('0x37')][_0xee0a('0x2e')],'phone':_0x5ce00c[_0xee0a('0x2b')]['phone_home']['value']});});}});}function request(_0x16829e){logger[_0xee0a('0x3a')](_0xee0a('0x3b'),JSON[_0xee0a('0x20')](_0x16829e));return rp(_[_0xee0a('0x3c')](def,_0x16829e));}function getTags(_0x2b0f43,_0x445858){var _0x37e5d0=[];if(_0x2b0f43&&_0x2b0f43[_0xee0a('0x1c')]>0x0){_0x37e5d0=_[_0xee0a('0x3d')](_0x2b0f43,_0x445858);}return _0x37e5d0;}function getCustomFields(_0x5cf742,_0x1d5144){var _0x18f686=[];var _0x303e76={'custom_fields':[]};if(_0x5cf742[_0xee0a('0x1c')]>0x0){_[_0xee0a('0x3e')](_0x5cf742,function(_0x47b0ec){if(_0x47b0ec['type']===_0xee0a('0x3f')&&_0x47b0ec[_0xee0a('0x40')]&&!_0x47b0ec[_0xee0a('0x41')]){_0x303e76[_0x47b0ec[_0xee0a('0x40')]['toLowerCase']()]=_0x47b0ec[_0xee0a('0x42')]['toString']();}else if(_0x47b0ec[_0xee0a('0x43')]===_0xee0a('0x3f')&&_0x47b0ec[_0xee0a('0x44')]&&_0x47b0ec[_0xee0a('0x41')]){_0x303e76[_0xee0a('0x45')][_0xee0a('0x1e')]({'id':_0x47b0ec['idField'],'value':_0x47b0ec['content'][_0xee0a('0x24')]()});}else if(_0x47b0ec[_0xee0a('0x43')]===_0xee0a('0x46')&&_0x47b0ec['variableName']&&_0x47b0ec[_0xee0a('0x44')]&&_0x47b0ec['customField']){_0x1d5144[_0x47b0ec['variableName']]&&_0x303e76[_0xee0a('0x45')][_0xee0a('0x1e')]({'id':_0x47b0ec[_0xee0a('0x44')],'value':_0x1d5144[_0x47b0ec[_0xee0a('0x1d')]]['toString']()});}else if(_0x47b0ec[_0xee0a('0x43')]===_0xee0a('0x47')&&_0x47b0ec[_0xee0a('0x48')]&&_0x47b0ec['Variable'][_0xee0a('0x1a')]&&_0x47b0ec[_0xee0a('0x44')]&&_0x47b0ec['customField']){_0x1d5144[_0x47b0ec[_0xee0a('0x48')]['name'][_0xee0a('0x49')]()]&&_0x303e76[_0xee0a('0x45')][_0xee0a('0x1e')]({'id':_0x47b0ec['idField'],'value':_0x1d5144[_0x47b0ec[_0xee0a('0x48')][_0xee0a('0x1a')]['toLowerCase']()][_0xee0a('0x24')]()});}});}return _0x303e76;}function getConnection(_0x3a3637){return request({'method':_0xee0a('0xa'),'form':{'method':_0xee0a('0x4a'),'input_type':_0xee0a('0x1f'),'response_type':_0xee0a('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3a3637[_0xee0a('0x4b')],'password':_0x3a3637[_0xee0a('0x4c')],'encryption':_0xee0a('0x4d')},'application':_0xee0a('0x4e')})}})[_0xee0a('0x2a')](function(_0x20cb11){var _0x3bde69=_0x20cb11;if(_0x3bde69['id']){def[_0xee0a('0x4f')]=_0x3bde69['id'];return BPromise[_0xee0a('0x30')](_0x3bde69);}else{throw new Error(util[_0xee0a('0x21')](_0xee0a('0x50'),_0x3a3637['id']));}});}function setRelationship(_0x5bcb40,_0x4cff6c,_0x4c26d1,_0x141993){return request({'form':{'method':_0xee0a('0x51'),'input_type':_0xee0a('0x1f'),'response_type':'JSON','rest_data':JSON[_0xee0a('0x20')]({'session':_0x5bcb40['id'],'module_name':_0xee0a('0x52'),'module_id':_0x4c26d1['id'],'link_field_name':_0x141993,'related_ids':[_0x4cff6c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xee0a('0x53')]=function(_0x34b834,_0x1dc7bb,_0x3f016d,_0x96d2ad,_0xf5a3a6,_0x43e146){var _0x4e2402,_0xd15bb9,_0x5a8762,_0x1e9d59;_0x43e146[_0xee0a('0x54')]=intUtil[_0xee0a('0x55')](_0x43e146[_0xee0a('0x54')]);_0x43e146['serverUrl']=intUtil[_0xee0a('0x55')](_0x43e146[_0xee0a('0x56')]);def['uri']=util[_0xee0a('0x21')](_0xee0a('0x57'),_0x43e146[_0xee0a('0x54')]);if(_0xf5a3a6&&_0xf5a3a6[_0xee0a('0x58')]){logger[_0xee0a('0xc')](_0xee0a('0x59'),_0xee0a('0x5a'));_0x1dc7bb[_0xee0a('0x5b')]=util[_0xee0a('0x21')](_0xee0a('0x5c'),_0x43e146[_0xee0a('0x56')],_0x1dc7bb[_0xee0a('0x5d')],md5(_0x1dc7bb[_0xee0a('0x5d')]));}else{_0x1dc7bb[_0xee0a('0x5b')]='';}return getConnection(_0x43e146)[_0xee0a('0x2a')](function(_0x599971){_0x1e9d59=_0x599971;return getUser(_0x43e146,_0x96d2ad['name'],_0x1e9d59);})[_0xee0a('0x2a')](function(_0xe9a978){_0x4e2402=_0xe9a978;logger[_0xee0a('0xc')](_0xee0a('0x5e'),_0x4e2402['id']);return getEndUser(_0x43e146,_0x1dc7bb['calleridname'],_0x1dc7bb[_0xee0a('0x5f')],_0x1e9d59);})[_0xee0a('0x2a')](function(_0x51af48){_0xd15bb9=_0x51af48;logger[_0xee0a('0xc')]('The\x20Enduser\x20ID\x20is:',_0xd15bb9['id']);return getTicket(_0x43e146,_0x4e2402,_0xd15bb9,_0x3f016d,_0x1dc7bb,_0x3f016d[_0xee0a('0x60')],_0x1e9d59,_0xee0a('0x61'));})['then'](function(_0x52eeb9){_0x5a8762=_0x52eeb9;logger['info'](_0xee0a('0x62'));logger[_0xee0a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5a8762['id']);return setRelationship(_0x1e9d59,_0x4e2402,_0x5a8762,'users');})[_0xee0a('0x2a')](function(){return setRelationship(_0x1e9d59,_0xd15bb9,_0x5a8762,_0xee0a('0x63'));})['then'](function(){return getServerInfo(_0x1e9d59);})[_0xee0a('0x2a')](function(_0x112fd2){var _0x5477e9=parseInt(_0x112fd2['version']['charAt'](0x0));var _0x220edf=util['format'](_0xee0a('0x64'),_0x43e146['remoteUri'],_0x5a8762['id']);if(_0x5477e9>0x6){_0x220edf=util[_0xee0a('0x21')](_0xee0a('0x65'),_0x43e146[_0xee0a('0x54')],_0x5a8762['id']);}logger[_0xee0a('0xc')](_0xee0a('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xee0a('0x21')](_0xee0a('0x66'),_0x96d2ad[_0xee0a('0x1a')]),_0xee0a('0x67'),{'uri':_0x220edf});})[_0xee0a('0x68')](function(_0x40f232){logger['error']('[QUEUE]',JSON['stringify'](_0x40f232));});};exports['outbound']=function(_0x57e83a,_0x4435dd,_0x57b4ad,_0x253847,_0x15f691,_0x54a559,_0x27f125){var _0x1fbdfc,_0x56139d,_0x20e57a,_0x5ac8a3;_0x54a559['remoteUri']=intUtil[_0xee0a('0x55')](_0x54a559[_0xee0a('0x54')]);_0x54a559[_0xee0a('0x56')]=intUtil[_0xee0a('0x55')](_0x54a559['serverUrl']);def['uri']=util[_0xee0a('0x21')](_0xee0a('0x57'),_0x54a559[_0xee0a('0x54')]);if(_0x27f125&&_0x27f125[_0xee0a('0x69')]&&_0x27f125['recordingFormat']!==_0xee0a('0x6a')){logger[_0xee0a('0xc')](_0xee0a('0x6b'),_0xee0a('0x5a'));_0x4435dd['recordingURL']=util[_0xee0a('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54a559[_0xee0a('0x56')],_0x4435dd[_0xee0a('0x5d')],md5(_0x4435dd[_0xee0a('0x5d')]));}return getConnection(_0x54a559)[_0xee0a('0x2a')](function(_0x33a9f1){_0x5ac8a3=_0x33a9f1;return getUser(_0x54a559,_0x253847[_0xee0a('0x1a')],_0x5ac8a3);})['then'](function(_0x295a3f){_0x1fbdfc=_0x295a3f;logger[_0xee0a('0xc')](_0xee0a('0x5e'),_0x1fbdfc['id']);return getEndUser(_0x54a559,_0x4435dd[_0xee0a('0x6c')],_0x4435dd[_0xee0a('0x6d')],_0x5ac8a3);})[_0xee0a('0x2a')](function(_0xafd604){_0x56139d=_0xafd604;logger[_0xee0a('0xc')](_0xee0a('0x6e'),_0x56139d['id']);return getTicket(_0x54a559,_0x1fbdfc,_0x56139d,_0x57b4ad,_0x4435dd,_0x57b4ad[_0xee0a('0x60')],_0x5ac8a3,_0xee0a('0x6f'));})[_0xee0a('0x2a')](function(_0x4037f7){_0x20e57a=_0x4037f7;logger[_0xee0a('0xc')]('Ticket\x20created!');logger[_0xee0a('0xc')](_0xee0a('0x70'),_0x20e57a['id']);return setRelationship(_0x5ac8a3,_0x1fbdfc,_0x20e57a,_0xee0a('0x71'));})[_0xee0a('0x2a')](function(){return setRelationship(_0x5ac8a3,_0x56139d,_0x20e57a,'contacts');})[_0xee0a('0x2a')](function(){return getServerInfo(_0x5ac8a3);})[_0xee0a('0x2a')](function(_0x7178f7){var _0x4dc237=parseInt(_0x7178f7[_0xee0a('0x72')]['charAt'](0x0));var _0x249a1a=util[_0xee0a('0x21')](_0xee0a('0x64'),_0x54a559[_0xee0a('0x54')],_0x20e57a['id']);if(_0x4dc237>0x6){_0x249a1a=util[_0xee0a('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x54a559[_0xee0a('0x54')],_0x20e57a['id']);}logger[_0xee0a('0xc')](_0xee0a('0x6b'),_0xee0a('0x73'));emit(util[_0xee0a('0x21')]('user:%s',_0x253847[_0xee0a('0x1a')]),_0xee0a('0x67'),{'uri':_0x249a1a});})['catch'](function(_0x12e41a){logger['error'](_0xee0a('0x6b'),JSON[_0xee0a('0x20')](_0x12e41a));});};exports[_0xee0a('0x74')]=function(_0x1cfc1d,_0xa244c9,_0x35ca7d,_0x2a92e6,_0x5a959e,_0xa3fa38){var _0x195082,_0xb126ee,_0x5667cd,_0x5cbde9;_0xa3fa38['remoteUri']=intUtil['stripTrailingSlash'](_0xa3fa38[_0xee0a('0x54')]);_0xa3fa38[_0xee0a('0x56')]=intUtil[_0xee0a('0x55')](_0xa3fa38[_0xee0a('0x56')]);def['uri']=util['format'](_0xee0a('0x57'),_0xa3fa38[_0xee0a('0x54')]);if(_0x5a959e&&_0x5a959e[_0xee0a('0x58')]){logger[_0xee0a('0xc')]('['+_0xa244c9['lastevent'][_0xee0a('0x75')]()+']',_0xee0a('0x5a'));_0xa244c9[_0xee0a('0x5b')]=util[_0xee0a('0x21')](_0xee0a('0x5c'),_0xa3fa38['serverUrl'],_0xa244c9[_0xee0a('0x5d')],md5(_0xa244c9['uniqueid']));}else{_0xa244c9[_0xee0a('0x5b')]='';}return getConnection(_0xa3fa38)['then'](function(_0x549ddd){_0x5cbde9=_0x549ddd;if(!_[_0xee0a('0x26')](_0x2a92e6)){return getUser(_0xa3fa38,_0x2a92e6[_0xee0a('0x1a')],_0x5cbde9);}else{return getUser(_0xa3fa38,null,_0x5cbde9);}})[_0xee0a('0x2a')](function(_0x50f182){_0x195082=_0x50f182;logger['info']('The\x20User\x20ID\x20is:',_0x195082['id']);return getEndUser(_0xa3fa38,_0xa244c9[_0xee0a('0x76')],_0xa244c9[_0xee0a('0x5f')],_0x5cbde9);})[_0xee0a('0x2a')](function(_0x547919){_0xb126ee=_0x547919;logger[_0xee0a('0xc')](_0xee0a('0x6e'),_0xb126ee['id']);return getTicket(_0xa3fa38,_0x195082,_0xb126ee,_0x35ca7d,_0xa244c9,_0x35ca7d[_0xee0a('0x60')],_0x5cbde9,_0xee0a('0x61'));})[_0xee0a('0x2a')](function(_0x554e23){_0x5667cd=_0x554e23;logger[_0xee0a('0xc')](_0xee0a('0x62'));logger[_0xee0a('0xc')](_0xee0a('0x70'),_0x5667cd['id']);return setRelationship(_0x5cbde9,_0x195082,_0x5667cd,_0xee0a('0x71'));})[_0xee0a('0x2a')](function(){return setRelationship(_0x5cbde9,_0xb126ee,_0x5667cd,'contacts');})['then'](function(){return getServerInfo(_0x5cbde9);})[_0xee0a('0x68')](function(_0x375f45){logger[_0xee0a('0x77')]('['+_0xa244c9[_0xee0a('0x78')][_0xee0a('0x75')]()+']',JSON[_0xee0a('0x20')](_0x375f45));});}; \ No newline at end of file +var _0xaa10=['nameField','customField','toLowerCase','content','variable','custom_fields','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum','Fields','Outbound','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','Inbound','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','name','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','user_id','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string'];(function(_0x1ba051,_0x3a9f59){var _0x237ad2=function(_0x30ffc5){while(--_0x30ffc5){_0x1ba051['push'](_0x1ba051['shift']());}};_0x237ad2(++_0x3a9f59);}(_0xaa10,0x1ac));var _0x0aa1=function(_0x306fc9,_0x420385){_0x306fc9=_0x306fc9-0x0;var _0x4971ad=_0xaa10[_0x306fc9];return _0x4971ad;};'use strict';var _=require(_0x0aa1('0x0'));var rp=require(_0x0aa1('0x1'));var BPromise=require(_0x0aa1('0x2'));var md5=require(_0x0aa1('0x3'));var util=require(_0x0aa1('0x4'));var Redis=require('ioredis');var intUtil=require(_0x0aa1('0x5'));var config=require(_0x0aa1('0x6'));var logger=require('../../../../config/logger')(_0x0aa1('0x7'));config[_0x0aa1('0x8')]=_['defaults'](config[_0x0aa1('0x8')],{'host':_0x0aa1('0x9'),'port':0x18eb});var io=require(_0x0aa1('0xa'))(new Redis(config[_0x0aa1('0x8')]));var def={'method':_0x0aa1('0xb'),'json':!![]};function emit(_0x5399b2,_0xd31a04,_0x54bb0c){io['to'](_0x5399b2)[_0x0aa1('0xc')](_0xd31a04,_0x54bb0c);}function getTicket(_0x1c803d,_0x746171,_0x5bfa75,_0x4b9c45,_0xd6205c,_0x635aab,_0x556e21,_0x4a00b5){logger[_0x0aa1('0xd')](_0x0aa1('0xe'));var _0x9f0da0=new Date();var _0x3b17b2=[{'name':'name','value':intUtil[_0x0aa1('0xf')](_0x4b9c45[_0x0aa1('0x10')],_0xd6205c,'\x20')},{'name':_0x0aa1('0x11'),'value':_0x746171['id']},{'name':_0x0aa1('0x12'),'value':_0x746171['id']},{'name':_0x0aa1('0x13'),'value':intUtil['getString'](_0x4b9c45[_0x0aa1('0x14')],_0xd6205c,'\x0a')},{'name':'date_start','value':_0x9f0da0[_0x0aa1('0x15')]()[_0x0aa1('0x16')](0x0,0x13)[_0x0aa1('0x17')]('T','\x20')},{'name':_0x0aa1('0x18'),'value':'0'},{'name':_0x0aa1('0x19'),'value':'15'},{'name':_0x0aa1('0x1a'),'value':_0x5bfa75['id']},{'name':_0x0aa1('0x1b'),'value':_0x0aa1('0x1c')},{'name':'parent_name','value':_0x5bfa75[_0x0aa1('0x1d')]},{'name':'direction','value':_0x4a00b5}];if(_0x635aab[_0x0aa1('0x1e')]){_[_0x0aa1('0x1f')](_0x635aab,function(_0x40a7d9){if(_0xd6205c[_0x40a7d9[_0x0aa1('0x20')]]){_0x3b17b2[_0x0aa1('0x21')]({'name':_0x40a7d9[_0x0aa1('0x22')],'value':_0xd6205c[_0x40a7d9['variableName']]});}});}return request({'form':{'method':_0x0aa1('0x23'),'input_type':'JSON','response_type':_0x0aa1('0x24'),'rest_data':JSON['stringify']({'session':_0x556e21['id'],'module_name':_0x0aa1('0x25'),'name_value_list':_0x3b17b2})}});}function getAuth(_0x78794c){return util[_0x0aa1('0x26')](_0x0aa1('0x27'),new Buffer(_0x78794c[_0x0aa1('0x28')]+':X')[_0x0aa1('0x29')](_0x0aa1('0x2a')));}function getServerInfo(_0x62e132){return request({'form':{'method':_0x0aa1('0x2b'),'input_type':_0x0aa1('0x24'),'response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x62e132['id']})}});}function getUser(_0x50486d,_0x1810d6,_0x411e6b){if(!_[_0x0aa1('0x2d')](_0x1810d6)){logger[_0x0aa1('0xd')](_0x0aa1('0x2e'),_0x1810d6);return request({'form':{'method':_0x0aa1('0x2f'),'input_type':'JSON','response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x411e6b['id'],'module_name':_0x0aa1('0x30'),'query':util[_0x0aa1('0x26')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1810d6),'order_by':'','offset':'0','select_fields':['id',_0x0aa1('0x1d'),_0x0aa1('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0aa1('0x32')](function(_0x4ffc9a){if(_0x4ffc9a[_0x0aa1('0x33')]['length']){var _0x3550db=_[_0x0aa1('0x34')](_0x4ffc9a['entry_list'],function(_0x3a72d4){return _0x3a72d4[_0x0aa1('0x35')][_0x0aa1('0x31')]['value']===_0x1810d6;});if(_0x3550db){logger[_0x0aa1('0xd')](_0x0aa1('0x36'));return BPromise[_0x0aa1('0x37')]({'id':_0x3550db['name_value_list']['id']['value'],'name':_0x3550db[_0x0aa1('0x35')][_0x0aa1('0x1d')]['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0aa1('0x37')]({'id':_0x411e6b['name_value_list'][_0x0aa1('0x38')][_0x0aa1('0x39')],'name':_0x411e6b[_0x0aa1('0x35')]['user_name'][_0x0aa1('0x39')]});});}else{logger[_0x0aa1('0xd')](_0x0aa1('0x3a'));return BPromise[_0x0aa1('0x37')]({'id':_0x411e6b[_0x0aa1('0x35')][_0x0aa1('0x38')][_0x0aa1('0x39')],'name':_0x411e6b[_0x0aa1('0x35')][_0x0aa1('0x31')][_0x0aa1('0x39')]});}}function getEndUser(_0x3d5767,_0x2f9320,_0x40c99f,_0x1b0387){logger['info'](_0x0aa1('0x3b'),_0x40c99f);return request({'form':{'method':'get_entry_list','input_type':_0x0aa1('0x24'),'response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x1b0387['id'],'module_name':_0x0aa1('0x1c'),'query':util[_0x0aa1('0x26')](_0x0aa1('0x3c'),_0x40c99f),'order_by':'','offset':'0','select_fields':['id',_0x0aa1('0x1d'),_0x0aa1('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0aa1('0x32')](function(_0x165dd7){if(_0x165dd7['entry_list']['length']){var _0x142155=_['find'](_0x165dd7['entry_list'],function(_0x329ebf){return _0x329ebf[_0x0aa1('0x35')][_0x0aa1('0x3d')][_0x0aa1('0x39')]===_0x40c99f;});if(_0x142155){logger['info'](_0x0aa1('0x3e'));return BPromise[_0x0aa1('0x37')]({'id':_0x142155['name_value_list']['id'][_0x0aa1('0x39')],'name':_0x142155[_0x0aa1('0x35')][_0x0aa1('0x1d')]['value'],'phone':_0x142155[_0x0aa1('0x35')]['phone_home']['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x0aa1('0x24'),'response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x1b0387['id'],'module_name':'Contacts','name_value_list':[{'name':_0x0aa1('0x3f'),'value':_0x2f9320!==_0x0aa1('0x40')?_0x2f9320:util['format'](_0x0aa1('0x41'),_0x40c99f)},{'name':_0x0aa1('0x3d'),'value':_0x40c99f}]})}})[_0x0aa1('0x32')](function(_0xbd617c){logger[_0x0aa1('0xd')](_0x0aa1('0x42'));return BPromise[_0x0aa1('0x37')]({'id':_0xbd617c['id'],'name':_0xbd617c[_0x0aa1('0x33')][_0x0aa1('0x3f')][_0x0aa1('0x39')],'phone':_0xbd617c[_0x0aa1('0x33')][_0x0aa1('0x3d')][_0x0aa1('0x39')]});});}});}function request(_0x5873e1){logger[_0x0aa1('0x43')]('[HTTP]',JSON[_0x0aa1('0x2c')](_0x5873e1));return rp(_[_0x0aa1('0x44')](def,_0x5873e1));}function getTags(_0x5ccd2e,_0x41e0a7){var _0x518be1=[];if(_0x5ccd2e&&_0x5ccd2e[_0x0aa1('0x1e')]>0x0){_0x518be1=_[_0x0aa1('0x45')](_0x5ccd2e,_0x41e0a7);}return _0x518be1;}function getCustomFields(_0x19f0f1,_0x4c83d6){var _0x23b8aa=[];var _0x4a7215={'custom_fields':[]};if(_0x19f0f1[_0x0aa1('0x1e')]>0x0){_[_0x0aa1('0x1f')](_0x19f0f1,function(_0x322df0){if(_0x322df0[_0x0aa1('0x46')]===_0x0aa1('0x47')&&_0x322df0[_0x0aa1('0x48')]&&!_0x322df0[_0x0aa1('0x49')]){_0x4a7215[_0x322df0[_0x0aa1('0x48')][_0x0aa1('0x4a')]()]=_0x322df0[_0x0aa1('0x4b')][_0x0aa1('0x29')]();}else if(_0x322df0[_0x0aa1('0x46')]===_0x0aa1('0x47')&&_0x322df0[_0x0aa1('0x22')]&&_0x322df0[_0x0aa1('0x49')]){_0x4a7215['custom_fields']['push']({'id':_0x322df0[_0x0aa1('0x22')],'value':_0x322df0[_0x0aa1('0x4b')][_0x0aa1('0x29')]()});}else if(_0x322df0[_0x0aa1('0x46')]===_0x0aa1('0x4c')&&_0x322df0[_0x0aa1('0x20')]&&_0x322df0[_0x0aa1('0x22')]&&_0x322df0[_0x0aa1('0x49')]){_0x4c83d6[_0x322df0[_0x0aa1('0x20')]]&&_0x4a7215[_0x0aa1('0x4d')][_0x0aa1('0x21')]({'id':_0x322df0[_0x0aa1('0x22')],'value':_0x4c83d6[_0x322df0[_0x0aa1('0x20')]][_0x0aa1('0x29')]()});}else if(_0x322df0['type']===_0x0aa1('0x4e')&&_0x322df0[_0x0aa1('0x4f')]&&_0x322df0[_0x0aa1('0x4f')][_0x0aa1('0x1d')]&&_0x322df0[_0x0aa1('0x22')]&&_0x322df0[_0x0aa1('0x49')]){_0x4c83d6[_0x322df0['Variable'][_0x0aa1('0x1d')][_0x0aa1('0x4a')]()]&&_0x4a7215[_0x0aa1('0x4d')][_0x0aa1('0x21')]({'id':_0x322df0[_0x0aa1('0x22')],'value':_0x4c83d6[_0x322df0[_0x0aa1('0x4f')][_0x0aa1('0x1d')][_0x0aa1('0x4a')]()][_0x0aa1('0x29')]()});}});}return _0x4a7215;}function getConnection(_0x51053a){return request({'method':_0x0aa1('0xb'),'form':{'method':_0x0aa1('0x50'),'input_type':_0x0aa1('0x24'),'response_type':'JSON','rest_data':JSON[_0x0aa1('0x2c')]({'user_auth':{'user_name':_0x51053a[_0x0aa1('0x51')],'password':_0x51053a[_0x0aa1('0x52')],'encryption':'PLAIN'},'application':_0x0aa1('0x53')})}})[_0x0aa1('0x32')](function(_0xc886ef){var _0x374983=_0xc886ef;if(_0x374983['id']){def[_0x0aa1('0x54')]=_0x374983['id'];return BPromise[_0x0aa1('0x37')](_0x374983);}else{throw new Error(util['format'](_0x0aa1('0x55'),_0x51053a['id']));}});}function setRelationship(_0x8276b1,_0x3f058f,_0x5cfdf7,_0x51fca1){return request({'form':{'method':_0x0aa1('0x56'),'input_type':_0x0aa1('0x24'),'response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x8276b1['id'],'module_name':_0x0aa1('0x25'),'module_id':_0x5cfdf7['id'],'link_field_name':_0x51fca1,'related_ids':[_0x3f058f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0aa1('0x57')]=function(_0x12d895,_0x3a55c5,_0x3427d2,_0x2d5f2c,_0x305d98,_0x273215){var _0x158ec1,_0x37a50a,_0x411abe,_0x54c49e;_0x273215[_0x0aa1('0x58')]=intUtil[_0x0aa1('0x59')](_0x273215['remoteUri']);_0x273215['serverUrl']=intUtil[_0x0aa1('0x59')](_0x273215[_0x0aa1('0x5a')]);def[_0x0aa1('0x5b')]=util[_0x0aa1('0x26')](_0x0aa1('0x5c'),_0x273215[_0x0aa1('0x58')]);if(_0x305d98&&_0x305d98[_0x0aa1('0x5d')]){logger[_0x0aa1('0xd')](_0x0aa1('0x5e'),'Recording\x20is\x20enabled!');_0x3a55c5[_0x0aa1('0x5f')]=util[_0x0aa1('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x273215['serverUrl'],_0x3a55c5[_0x0aa1('0x60')],md5(_0x3a55c5[_0x0aa1('0x60')]));}else{_0x3a55c5[_0x0aa1('0x5f')]='';}return getConnection(_0x273215)['then'](function(_0x192cf6){_0x54c49e=_0x192cf6;return getUser(_0x273215,_0x2d5f2c['name'],_0x54c49e);})[_0x0aa1('0x32')](function(_0x42ad37){_0x158ec1=_0x42ad37;logger[_0x0aa1('0xd')]('The\x20User\x20ID\x20is:',_0x158ec1['id']);return getEndUser(_0x273215,_0x3a55c5[_0x0aa1('0x61')],_0x3a55c5[_0x0aa1('0x62')],_0x54c49e);})['then'](function(_0x1e09a3){_0x37a50a=_0x1e09a3;logger['info'](_0x0aa1('0x63'),_0x37a50a['id']);return getTicket(_0x273215,_0x158ec1,_0x37a50a,_0x3427d2,_0x3a55c5,_0x3427d2['Fields'],_0x54c49e,'Inbound');})[_0x0aa1('0x32')](function(_0x5bc4af){_0x411abe=_0x5bc4af;logger[_0x0aa1('0xd')](_0x0aa1('0x64'));logger['info'](_0x0aa1('0x65'),_0x411abe['id']);return setRelationship(_0x54c49e,_0x158ec1,_0x411abe,_0x0aa1('0x66'));})[_0x0aa1('0x32')](function(){return setRelationship(_0x54c49e,_0x37a50a,_0x411abe,'contacts');})[_0x0aa1('0x32')](function(){return getServerInfo(_0x54c49e);})[_0x0aa1('0x32')](function(_0x558057){var _0xac8207=parseInt(_0x558057['version'][_0x0aa1('0x67')](0x0));var _0x4411ee=util[_0x0aa1('0x26')](_0x0aa1('0x68'),_0x273215[_0x0aa1('0x58')],_0x411abe['id']);if(_0xac8207>0x6){_0x4411ee=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x273215[_0x0aa1('0x58')],_0x411abe['id']);}logger[_0x0aa1('0xd')](_0x0aa1('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0aa1('0x26')](_0x0aa1('0x69'),_0x2d5f2c[_0x0aa1('0x1d')]),_0x0aa1('0x6a'),{'uri':_0x4411ee});})[_0x0aa1('0x6b')](function(_0xad6836){logger[_0x0aa1('0x6c')](_0x0aa1('0x5e'),JSON[_0x0aa1('0x2c')](_0xad6836));});};exports[_0x0aa1('0x6d')]=function(_0x520dfc,_0x33095c,_0x3efbc5,_0x584e9b,_0x57caf1,_0x796d77,_0x419a6b){var _0x40b17d,_0x57ae02,_0xf5712f,_0x55df70;_0x796d77[_0x0aa1('0x58')]=intUtil[_0x0aa1('0x59')](_0x796d77[_0x0aa1('0x58')]);_0x796d77[_0x0aa1('0x5a')]=intUtil[_0x0aa1('0x59')](_0x796d77[_0x0aa1('0x5a')]);def['uri']=util[_0x0aa1('0x26')](_0x0aa1('0x5c'),_0x796d77[_0x0aa1('0x58')]);if(_0x419a6b&&_0x419a6b['recordingFormat']&&_0x419a6b[_0x0aa1('0x6e')]!==_0x0aa1('0x6f')){logger['info']('[OUTBOUND]',_0x0aa1('0x70'));_0x33095c[_0x0aa1('0x5f')]=util['format'](_0x0aa1('0x71'),_0x796d77['serverUrl'],_0x33095c[_0x0aa1('0x60')],md5(_0x33095c[_0x0aa1('0x60')]));}return getConnection(_0x796d77)[_0x0aa1('0x32')](function(_0xe5123c){_0x55df70=_0xe5123c;return getUser(_0x796d77,_0x584e9b[_0x0aa1('0x1d')],_0x55df70);})['then'](function(_0xd0a751){_0x40b17d=_0xd0a751;logger[_0x0aa1('0xd')](_0x0aa1('0x72'),_0x40b17d['id']);return getEndUser(_0x796d77,_0x33095c['destcalleridname'],_0x33095c[_0x0aa1('0x73')],_0x55df70);})[_0x0aa1('0x32')](function(_0x33e098){_0x57ae02=_0x33e098;logger[_0x0aa1('0xd')]('The\x20Enduser\x20ID\x20is:',_0x57ae02['id']);return getTicket(_0x796d77,_0x40b17d,_0x57ae02,_0x3efbc5,_0x33095c,_0x3efbc5[_0x0aa1('0x74')],_0x55df70,_0x0aa1('0x75'));})[_0x0aa1('0x32')](function(_0x245ac2){_0xf5712f=_0x245ac2;logger[_0x0aa1('0xd')]('Ticket\x20created!');logger['info'](_0x0aa1('0x65'),_0xf5712f['id']);return setRelationship(_0x55df70,_0x40b17d,_0xf5712f,_0x0aa1('0x66'));})[_0x0aa1('0x32')](function(){return setRelationship(_0x55df70,_0x57ae02,_0xf5712f,_0x0aa1('0x76'));})['then'](function(){return getServerInfo(_0x55df70);})[_0x0aa1('0x32')](function(_0x3b1977){var _0x2c896a=parseInt(_0x3b1977[_0x0aa1('0x77')][_0x0aa1('0x67')](0x0));var _0x4e853f=util[_0x0aa1('0x26')](_0x0aa1('0x68'),_0x796d77[_0x0aa1('0x58')],_0xf5712f['id']);if(_0x2c896a>0x6){_0x4e853f=util[_0x0aa1('0x26')](_0x0aa1('0x78'),_0x796d77[_0x0aa1('0x58')],_0xf5712f['id']);}logger[_0x0aa1('0xd')](_0x0aa1('0x79'),_0x0aa1('0x7a'));emit(util[_0x0aa1('0x26')](_0x0aa1('0x69'),_0x584e9b[_0x0aa1('0x1d')]),_0x0aa1('0x6a'),{'uri':_0x4e853f});})[_0x0aa1('0x6b')](function(_0x150021){logger[_0x0aa1('0x6c')]('[OUTBOUND]',JSON[_0x0aa1('0x2c')](_0x150021));});};exports['unmanaged']=function(_0x245972,_0x58d9a9,_0x271ea2,_0x1dd172,_0x560f2a,_0x2e90c6){var _0x3bf6f8,_0x1f04e1,_0x2bc22a,_0x2c8892;_0x2e90c6['remoteUri']=intUtil[_0x0aa1('0x59')](_0x2e90c6[_0x0aa1('0x58')]);_0x2e90c6[_0x0aa1('0x5a')]=intUtil['stripTrailingSlash'](_0x2e90c6[_0x0aa1('0x5a')]);def[_0x0aa1('0x5b')]=util['format'](_0x0aa1('0x5c'),_0x2e90c6['remoteUri']);if(_0x560f2a&&_0x560f2a['monitor_format']){logger[_0x0aa1('0xd')]('['+_0x58d9a9[_0x0aa1('0x7b')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x58d9a9[_0x0aa1('0x5f')]=util[_0x0aa1('0x26')](_0x0aa1('0x71'),_0x2e90c6[_0x0aa1('0x5a')],_0x58d9a9['uniqueid'],md5(_0x58d9a9[_0x0aa1('0x60')]));}else{_0x58d9a9['recordingURL']='';}return getConnection(_0x2e90c6)[_0x0aa1('0x32')](function(_0x26ffec){_0x2c8892=_0x26ffec;if(!_['isNil'](_0x1dd172)){return getUser(_0x2e90c6,_0x1dd172['name'],_0x2c8892);}else{return getUser(_0x2e90c6,null,_0x2c8892);}})[_0x0aa1('0x32')](function(_0x13ac09){_0x3bf6f8=_0x13ac09;logger[_0x0aa1('0xd')](_0x0aa1('0x72'),_0x3bf6f8['id']);return getEndUser(_0x2e90c6,_0x58d9a9[_0x0aa1('0x61')],_0x58d9a9[_0x0aa1('0x62')],_0x2c8892);})[_0x0aa1('0x32')](function(_0x787d4f){_0x1f04e1=_0x787d4f;logger[_0x0aa1('0xd')](_0x0aa1('0x63'),_0x1f04e1['id']);return getTicket(_0x2e90c6,_0x3bf6f8,_0x1f04e1,_0x271ea2,_0x58d9a9,_0x271ea2['Fields'],_0x2c8892,_0x0aa1('0x7c'));})['then'](function(_0x4d35d8){_0x2bc22a=_0x4d35d8;logger['info'](_0x0aa1('0x64'));logger[_0x0aa1('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2bc22a['id']);return setRelationship(_0x2c8892,_0x3bf6f8,_0x2bc22a,_0x0aa1('0x66'));})['then'](function(){return setRelationship(_0x2c8892,_0x1f04e1,_0x2bc22a,_0x0aa1('0x76'));})[_0x0aa1('0x32')](function(){return getServerInfo(_0x2c8892);})[_0x0aa1('0x6b')](function(_0x4bbc75){logger['error']('['+_0x58d9a9[_0x0aa1('0x7b')]['toUpperCase']()+']',JSON[_0x0aa1('0x2c')](_0x4bbc75));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 5bd0d8b..a709f4f 100644 --- a/server/services/ami/trigger/integration/util.js +++ b/server/services/ami/trigger/integration/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa992=['keyType','key','format','variable','%s:\x20%s','join','slice','substring','lastIndexOf','isNil','getString','length','type','string','push','variableName','toString','Variable','name','toLowerCase','keyValue'];(function(_0x1b4877,_0x11e2fc){var _0x33026f=function(_0x2828ed){while(--_0x2828ed){_0x1b4877['push'](_0x1b4877['shift']());}};_0x33026f(++_0x11e2fc);}(_0xa992,0x1ed));var _0x2a99=function(_0x72529a,_0x3330fc){_0x72529a=_0x72529a-0x0;var _0x3d1279=_0xa992[_0x72529a];return _0x3d1279;};'use strict';var _=require('lodash');var util=require('util');exports[_0x2a99('0x0')]=function(_0x7202b3,_0x532e2b,_0x53da4d){var _0x44449d=[];if(_0x7202b3[_0x2a99('0x1')]>0x0){var _0x5e795e=_['sortBy'](_0x7202b3,['id']);for(var _0x1f312e=0x0;_0x1f312e<_0x5e795e[_0x2a99('0x1')];_0x1f312e++){var _0x525381=_0x5e795e[_0x1f312e];if(_0x525381[_0x2a99('0x2')]===_0x2a99('0x3')){_0x44449d[_0x2a99('0x4')](_0x525381['content']);}else if(_0x525381[_0x2a99('0x2')]==='variable'&&_0x525381[_0x2a99('0x5')]){_0x532e2b[_0x525381[_0x2a99('0x5')]]&&_0x44449d[_0x2a99('0x4')](_0x532e2b[_0x525381[_0x2a99('0x5')]][_0x2a99('0x6')]());}else if(_0x525381[_0x2a99('0x2')]==='customVariable'&&_0x525381[_0x2a99('0x7')]&&_0x525381[_0x2a99('0x7')]['name']){_0x532e2b[_0x525381[_0x2a99('0x7')][_0x2a99('0x8')]['toLowerCase']()]&&_0x44449d[_0x2a99('0x4')](_0x532e2b[_0x525381[_0x2a99('0x7')]['name'][_0x2a99('0x9')]()][_0x2a99('0x6')]());}else if(_0x525381['type']===_0x2a99('0xa')){if(_0x525381[_0x2a99('0xb')]===_0x2a99('0x3')&&_0x525381[_0x2a99('0xc')]){_0x44449d[_0x2a99('0x4')](util[_0x2a99('0xd')]('%s:\x20%s',_0x525381[_0x2a99('0xc')],_0x525381['keyContent']));}else if(_0x525381[_0x2a99('0xb')]===_0x2a99('0xe')&&_0x525381[_0x2a99('0x5')]&&_0x525381[_0x2a99('0xc')]){_0x532e2b[_0x525381[_0x2a99('0x5')]]&&_0x44449d[_0x2a99('0x4')](util['format'](_0x2a99('0xf'),_0x525381[_0x2a99('0xc')],_0x532e2b[_0x525381[_0x2a99('0x5')]]));}else if(_0x525381[_0x2a99('0xb')]==='customVariable'&&_0x525381[_0x2a99('0x7')]&&_0x525381[_0x2a99('0x7')][_0x2a99('0x8')]&&_0x525381[_0x2a99('0xc')]){_0x532e2b[_0x525381[_0x2a99('0x7')][_0x2a99('0x8')][_0x2a99('0x9')]()]&&_0x44449d[_0x2a99('0x4')](util[_0x2a99('0xd')](_0x2a99('0xf'),_0x525381[_0x2a99('0xc')],_0x532e2b[_0x525381[_0x2a99('0x7')][_0x2a99('0x8')]['toLowerCase']()]));}}}}return _0x44449d[_0x2a99('0x10')](_0x53da4d);};exports['stripTrailingSlash']=function(_0x4d50c5){var _0x227906=_0x4d50c5[_0x2a99('0x11')](-0x1);if(_0x227906==='/'){_0x4d50c5=_0x4d50c5[_0x2a99('0x12')](0x0,_0x4d50c5[_0x2a99('0x13')](_0x227906));}return _0x4d50c5;};exports['validateEmail']=function(_0x144b12){if(!_[_0x2a99('0x14')](_0x144b12)&&_0x144b12!==''){var _0x3643e5=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x3643e5['test'](String(_0x144b12)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x5d69=['Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','variable','join','stripTrailingSlash','slice','test','lodash','util','getString','sortBy','length','type','string','push','variableName'];(function(_0x31a3eb,_0x1f7522){var _0x295914=function(_0x4312b1){while(--_0x4312b1){_0x31a3eb['push'](_0x31a3eb['shift']());}};_0x295914(++_0x1f7522);}(_0x5d69,0x1af));var _0x95d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5d69[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x95d6('0x0'));var util=require(_0x95d6('0x1'));exports[_0x95d6('0x2')]=function(_0x5982b5,_0x394b3f,_0x40bf2d){var _0x1571c4=[];if(_0x5982b5['length']>0x0){var _0x1d752c=_[_0x95d6('0x3')](_0x5982b5,['id']);for(var _0x5d9c7a=0x0;_0x5d9c7a<_0x1d752c[_0x95d6('0x4')];_0x5d9c7a++){var _0x49b4f5=_0x1d752c[_0x5d9c7a];if(_0x49b4f5[_0x95d6('0x5')]===_0x95d6('0x6')){_0x1571c4[_0x95d6('0x7')](_0x49b4f5['content']);}else if(_0x49b4f5[_0x95d6('0x5')]==='variable'&&_0x49b4f5[_0x95d6('0x8')]){_0x394b3f[_0x49b4f5[_0x95d6('0x8')]]&&_0x1571c4['push'](_0x394b3f[_0x49b4f5[_0x95d6('0x8')]]['toString']());}else if(_0x49b4f5[_0x95d6('0x5')]==='customVariable'&&_0x49b4f5['Variable']&&_0x49b4f5[_0x95d6('0x9')][_0x95d6('0xa')]){_0x394b3f[_0x49b4f5[_0x95d6('0x9')]['name'][_0x95d6('0xb')]()]&&_0x1571c4[_0x95d6('0x7')](_0x394b3f[_0x49b4f5[_0x95d6('0x9')]['name'][_0x95d6('0xb')]()]['toString']());}else if(_0x49b4f5[_0x95d6('0x5')]==='keyValue'){if(_0x49b4f5[_0x95d6('0xc')]===_0x95d6('0x6')&&_0x49b4f5['key']){_0x1571c4[_0x95d6('0x7')](util[_0x95d6('0xd')](_0x95d6('0xe'),_0x49b4f5[_0x95d6('0xf')],_0x49b4f5[_0x95d6('0x10')]));}else if(_0x49b4f5[_0x95d6('0xc')]===_0x95d6('0x11')&&_0x49b4f5[_0x95d6('0x8')]&&_0x49b4f5['key']){_0x394b3f[_0x49b4f5['variableName']]&&_0x1571c4['push'](util['format'](_0x95d6('0xe'),_0x49b4f5['key'],_0x394b3f[_0x49b4f5['variableName']]));}else if(_0x49b4f5[_0x95d6('0xc')]==='customVariable'&&_0x49b4f5['Variable']&&_0x49b4f5[_0x95d6('0x9')][_0x95d6('0xa')]&&_0x49b4f5[_0x95d6('0xf')]){_0x394b3f[_0x49b4f5[_0x95d6('0x9')][_0x95d6('0xa')][_0x95d6('0xb')]()]&&_0x1571c4[_0x95d6('0x7')](util['format'](_0x95d6('0xe'),_0x49b4f5['key'],_0x394b3f[_0x49b4f5[_0x95d6('0x9')]['name']['toLowerCase']()]));}}}}return _0x1571c4[_0x95d6('0x12')](_0x40bf2d);};exports[_0x95d6('0x13')]=function(_0x239ca8){var _0x970a55=_0x239ca8[_0x95d6('0x14')](-0x1);if(_0x970a55==='/'){_0x239ca8=_0x239ca8['substring'](0x0,_0x239ca8['lastIndexOf'](_0x970a55));}return _0x239ca8;};exports['validateEmail']=function(_0x4c5ca4){if(!_['isNil'](_0x4c5ca4)&&_0x4c5ca4!==''){var _0x3c3b17=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x3c3b17[_0x95d6('0x15')](String(_0x4c5ca4)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 966f09b..73edec4 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bf1=['Contacts','phone','getEndUser','getchallenge','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','emit','length','string','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','then','success','result','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','resolve','email1','last_name','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x2738d6,_0x2936bb){var _0x364b3e=function(_0x4e6604){while(--_0x4e6604){_0x2738d6['push'](_0x2738d6['shift']());}};_0x364b3e(++_0x2936bb);}(_0x1bf1,0x1a8));var _0x11bf=function(_0x4fabd8,_0x3be1df){_0x4fabd8=_0x4fabd8-0x0;var _0x245b41=_0x1bf1[_0x4fabd8];return _0x245b41;};'use strict';var _=require(_0x11bf('0x0'));var rp=require('request-promise');var BPromise=require(_0x11bf('0x1'));var md5=require(_0x11bf('0x2'));var util=require(_0x11bf('0x3'));var Redis=require('ioredis');var intUtil=require(_0x11bf('0x4'));var config=require(_0x11bf('0x5'));var logger=require(_0x11bf('0x6'))(_0x11bf('0x7'));config[_0x11bf('0x8')]=_[_0x11bf('0x9')](config[_0x11bf('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x11bf('0x8')]));function emit(_0x44790d,_0x12102b,_0xb948f7){io['to'](_0x44790d)[_0x11bf('0xa')](_0x12102b,_0xb948f7);}function getCustomFields(_0x45af71,_0x483173){var _0x1837de={};if(_0x45af71[_0x11bf('0xb')]>0x0){_['forEach'](_0x45af71,function(_0x3d3c1e){if(_0x3d3c1e['type']===_0x11bf('0xc')&&_0x3d3c1e[_0x11bf('0xd')]){_0x1837de[_0x3d3c1e[_0x11bf('0xd')]]=_0x3d3c1e[_0x11bf('0xe')][_0x11bf('0xf')]();}else if(_0x3d3c1e[_0x11bf('0x10')]==='variable'&&_0x3d3c1e[_0x11bf('0x11')]&&_0x3d3c1e[_0x11bf('0xd')]&&_0x483173[_0x3d3c1e[_0x11bf('0x11')]]){_0x1837de[_0x3d3c1e['idField']]=_0x483173[_0x3d3c1e[_0x11bf('0x11')]][_0x11bf('0xf')]();}else if(_0x3d3c1e[_0x11bf('0x10')]===_0x11bf('0x12')&&_0x3d3c1e[_0x11bf('0x13')]&&_0x3d3c1e[_0x11bf('0x13')][_0x11bf('0x14')]&&_0x3d3c1e['idField']&&_0x483173[_0x3d3c1e[_0x11bf('0x13')][_0x11bf('0x14')]['toLowerCase']()]){_0x1837de[_0x3d3c1e['idField']]=_0x483173[_0x3d3c1e[_0x11bf('0x13')]['name'][_0x11bf('0x15')]()][_0x11bf('0xf')]();}});}return _0x1837de;}function createTicket(_0x22dcac,_0x127058,_0x5d1a9c,_0x297e5b,_0x5bc40f,_0x46397a,_0x83844e){logger[_0x11bf('0x16')](_0x11bf('0x17'));var _0x523b9c=_[_0x11bf('0x18')]({'parent_id':'','assigned_user_id':_0x127058['id'],'ticketpriorities':_0x11bf('0x19'),'ticketstatus':_0x11bf('0x1a'),'ticket_title':intUtil['getString'](_0x297e5b['Subjects'],_0x5bc40f,'\x20'),'description':intUtil['getString'](_0x297e5b[_0x11bf('0x1b')],_0x5bc40f,'\x0a'),'contact_id':_0x5d1a9c['id']},getCustomFields(_0x46397a,_0x5bc40f));var _0x3a0c0f={'method':_0x11bf('0x1c'),'uri':util[_0x11bf('0x1d')](_0x11bf('0x1e'),_0x22dcac[_0x11bf('0x1f')]),'form':{'operation':_0x11bf('0x20'),'username':_0x22dcac[_0x11bf('0x21')],'sessionName':_0x83844e[_0x11bf('0x22')],'elementType':_0x11bf('0x23'),'element':JSON[_0x11bf('0x24')](_0x523b9c)},'json':!![]};return request(_0x3a0c0f)[_0x11bf('0x25')](function(_0x4a3313){if(_0x4a3313[_0x11bf('0x26')]){return BPromise['resolve']({'id':_0x4a3313[_0x11bf('0x27')]['id']});}else{throw new Error(util[_0x11bf('0x1d')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x11bf('0x24')](_0x4a3313[_0x11bf('0x28')])));}})[_0x11bf('0x29')](function(_0xe1ff6f){var _0xa9bd79=_0xe1ff6f[_0x11bf('0x2a')]||0x1f4;logger[_0x11bf('0x28')](_0x11bf('0x2b'),_0x11bf('0x2c'),_0xa9bd79,JSON['stringify'](_0xe1ff6f));});}function getUser(_0x3f3955,_0x4e8b5d,_0x44133c){if(intUtil[_0x11bf('0x2d')](_0x4e8b5d)){logger[_0x11bf('0x16')](_0x11bf('0x2e'),_0x4e8b5d);return request({'method':_0x11bf('0x2f'),'uri':util['format']('%s/webservice.php',_0x3f3955[_0x11bf('0x1f')]),'qs':{'operation':'query','username':_0x3f3955[_0x11bf('0x21')],'sessionName':_0x44133c[_0x11bf('0x22')],'query':util[_0x11bf('0x1d')](_0x11bf('0x30'),_0x4e8b5d)},'json':!![]})[_0x11bf('0x25')](function(_0xcd1331){if(_0xcd1331[_0x11bf('0x26')]&&_0xcd1331[_0x11bf('0x27')][_0x11bf('0xb')]){logger['info'](_0x11bf('0x31'));return BPromise[_0x11bf('0x32')]({'id':_0xcd1331[_0x11bf('0x27')][0x0]['id'],'email':_0xcd1331[_0x11bf('0x27')][0x0][_0x11bf('0x33')],'name':_0xcd1331['result'][0x0]['first_name']+'\x20'+_0xcd1331[_0x11bf('0x27')][_0x11bf('0x34')]});}else{logger[_0x11bf('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x11bf('0x32')]({'id':_0x44133c['userId'],'email':_0x3f3955[_0x11bf('0x21')],'name':'admin'});}})[_0x11bf('0x29')](function(_0x4bdfc9){var _0x160984=_0x4bdfc9[_0x11bf('0x2a')]||0x1f4;logger['error'](_0x11bf('0x2b'),'getUser',_0x160984,JSON[_0x11bf('0x24')](_0x4bdfc9));});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x11bf('0x32')]({'id':_0x44133c[_0x11bf('0x35')],'email':_0x3f3955[_0x11bf('0x21')],'name':_0x11bf('0x36')})['catch'](function(_0x38c99a){var _0x30b3b9=_0x38c99a[_0x11bf('0x2a')]||0x1f4;logger[_0x11bf('0x28')](_0x11bf('0x2b'),_0x11bf('0x37'),_0x30b3b9,JSON[_0x11bf('0x24')](_0x38c99a));});}}function getEndUser(_0x5f253b,_0x30e34e,_0x1c2681,_0x530744){logger['info'](_0x11bf('0x38'),_0x1c2681);return request({'method':_0x11bf('0x2f'),'uri':util[_0x11bf('0x1d')](_0x11bf('0x1e'),_0x5f253b['remoteUri']),'qs':{'operation':_0x11bf('0x39'),'username':_0x5f253b[_0x11bf('0x21')],'sessionName':_0x530744['sessionName'],'query':util[_0x11bf('0x1d')](_0x11bf('0x3a'),_0x1c2681,_0x1c2681,_0x1c2681,_0x1c2681,_0x1c2681)},'json':!![]})[_0x11bf('0x25')](function(_0x464595){if(_0x464595['success']&&_0x464595[_0x11bf('0x27')][_0x11bf('0xb')]){logger[_0x11bf('0x16')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x464595[_0x11bf('0x27')][0x0]['id'],'name':_0x464595[_0x11bf('0x27')][0x0]['firstname']+'\x20'+_0x464595['result'][0x0][_0x11bf('0x3b')],'phone':_0x1c2681});}else{logger[_0x11bf('0x16')](_0x11bf('0x3c'));return request({'method':_0x11bf('0x1c'),'uri':util[_0x11bf('0x1d')]('%s/webservice.php',_0x5f253b[_0x11bf('0x1f')]),'form':{'operation':'create','sessionName':_0x530744[_0x11bf('0x22')],'elementType':_0x11bf('0x3d'),'element':JSON[_0x11bf('0x24')]({'lastname':_0x30e34e,'phone':_0x1c2681,'assigned_user_id':'\x20'})},'json':!![]})[_0x11bf('0x25')](function(_0x38af2f){logger[_0x11bf('0x16')]('Enduser\x20created.');return BPromise[_0x11bf('0x32')]({'id':_0x38af2f[_0x11bf('0x27')]['id'],'name':_0x38af2f[_0x11bf('0x27')]['lastname'],'phone':_0x38af2f[_0x11bf('0x27')][_0x11bf('0x3e')]});})[_0x11bf('0x29')](function(_0x51a266){var _0x5f2789=_0x51a266[_0x11bf('0x2a')]||0x1f4;logger[_0x11bf('0x28')](_0x11bf('0x2b'),_0x11bf('0x3f'),_0x5f2789,JSON[_0x11bf('0x24')](_0x51a266));});}});}function getConnection(_0x1c14c2){var _0x2ff765=_0x1c14c2['username'];var _0x90e5c5=_0x1c14c2['accessKey'];return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x1c14c2[_0x11bf('0x1f')]),'qs':{'operation':_0x11bf('0x40'),'username':_0x2ff765},'json':!![]})['then'](function(_0x1ca5a5){if(_0x1ca5a5[_0x11bf('0x26')]){return request({'method':'POST','uri':util[_0x11bf('0x1d')](_0x11bf('0x1e'),_0x1c14c2['remoteUri']),'form':{'operation':'login','username':_0x2ff765,'accessKey':md5(_0x1ca5a5[_0x11bf('0x27')]['token']+_0x90e5c5)},'json':!![]});}})[_0x11bf('0x25')](function(_0x30a36e){if(_0x30a36e[_0x11bf('0x26')]){return BPromise[_0x11bf('0x32')](_0x30a36e['result']);}else{throw new Error(util[_0x11bf('0x1d')](_0x11bf('0x41'),_0x1c14c2['id']));}})['catch'](function(_0x21ada3){var _0x512a0e=_0x21ada3[_0x11bf('0x2a')]||0x1f4;logger['error'](_0x11bf('0x2b'),_0x11bf('0x42'),_0x512a0e,JSON[_0x11bf('0x24')](_0x21ada3));});}function request(_0x26833e){logger[_0x11bf('0x16')](_0x11bf('0x43'),JSON[_0x11bf('0x24')](_0x26833e));return rp(_0x26833e);}exports['queue']=function(_0x330306,_0x2cb185,_0x320311,_0x4a5924,_0x146c99,_0x1c9e76){var _0x35af24,_0x3641bb,_0x211a04,_0x390ef5;_0x1c9e76[_0x11bf('0x1f')]=intUtil[_0x11bf('0x44')](_0x1c9e76[_0x11bf('0x1f')]);if(_0x146c99&&_0x146c99[_0x11bf('0x45')]){logger[_0x11bf('0x16')](_0x11bf('0x46'),_0x11bf('0x47'));_0x2cb185[_0x11bf('0x48')]=util[_0x11bf('0x1d')](_0x11bf('0x49'),_0x1c9e76[_0x11bf('0x4a')],_0x2cb185[_0x11bf('0x4b')],md5(_0x2cb185[_0x11bf('0x4b')]));}else{_0x2cb185[_0x11bf('0x48')]='';}return getConnection(_0x1c9e76)[_0x11bf('0x25')](function(_0x2e47eb){_0x390ef5=_0x2e47eb;return getUser(_0x1c9e76,_0x4a5924[_0x11bf('0x4c')],_0x390ef5);})[_0x11bf('0x25')](function(_0x365fb6){_0x35af24=_0x365fb6;logger[_0x11bf('0x16')](_0x11bf('0x4d'),_0x35af24['id']);return getEndUser(_0x1c9e76,_0x2cb185[_0x11bf('0x4e')],_0x2cb185[_0x11bf('0x4f')],_0x390ef5);})['then'](function(_0x41c162){_0x3641bb=_0x41c162;logger[_0x11bf('0x16')](_0x11bf('0x50'),_0x3641bb['id']);return createTicket(_0x1c9e76,_0x35af24,_0x3641bb,_0x320311,_0x2cb185,_0x320311[_0x11bf('0x51')],_0x390ef5);})[_0x11bf('0x25')](function(_0x4ab674){_0x211a04=_0x4ab674;logger[_0x11bf('0x16')](_0x11bf('0x52'));logger[_0x11bf('0x16')](_0x11bf('0x53'),_0x211a04['id']);var _0x20684c=util[_0x11bf('0x1d')](_0x11bf('0x54'),_0x1c9e76[_0x11bf('0x1f')],_[_0x11bf('0x55')](_0x211a04['id'],'x')[0x1]);logger[_0x11bf('0x16')](_0x11bf('0x46'),_0x11bf('0x56'));emit(util[_0x11bf('0x1d')]('user:%s',_0x4a5924[_0x11bf('0x14')]),'trigger:browser:url',{'uri':_0x20684c});})[_0x11bf('0x29')](function(_0x1f9ccf){logger[_0x11bf('0x28')](_0x11bf('0x46'),JSON[_0x11bf('0x24')](_0x1f9ccf));});};exports[_0x11bf('0x57')]=function(_0xcdb5be,_0x46f8bb,_0x5b2e12,_0x507726,_0x316b3a,_0xe6168c,_0x296e6a){var _0x9a69f,_0x39e72f,_0x182158,_0x14bcf5;_0xe6168c[_0x11bf('0x1f')]=intUtil[_0x11bf('0x44')](_0xe6168c['remoteUri']);_0xe6168c[_0x11bf('0x4a')]=intUtil[_0x11bf('0x44')](_0xe6168c[_0x11bf('0x4a')]);if(_0x296e6a&&_0x296e6a[_0x11bf('0x58')]&&_0x296e6a[_0x11bf('0x58')]!==_0x11bf('0x59')){logger[_0x11bf('0x16')](_0x11bf('0x5a'),'Recording\x20is\x20enabled!');_0x46f8bb['recordingURL']=util[_0x11bf('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe6168c[_0x11bf('0x4a')],_0x46f8bb[_0x11bf('0x4b')],md5(_0x46f8bb['uniqueid']));}return getConnection(_0xe6168c)[_0x11bf('0x25')](function(_0x1ed98f){_0x14bcf5=_0x1ed98f;return getUser(_0xe6168c,_0x507726[_0x11bf('0x4c')],_0x14bcf5);})['then'](function(_0x2720e2){_0x9a69f=_0x2720e2;logger[_0x11bf('0x16')](_0x11bf('0x4d'),_0x9a69f['id']);return getEndUser(_0xe6168c,_0x46f8bb[_0x11bf('0x5b')],_0x46f8bb['destcalleridnum'],_0x14bcf5);})[_0x11bf('0x25')](function(_0x4ec70f){_0x39e72f=_0x4ec70f;logger[_0x11bf('0x16')](_0x11bf('0x50'),_0x39e72f['id']);return createTicket(_0xe6168c,_0x9a69f,_0x39e72f,_0x5b2e12,_0x46f8bb,_0x5b2e12[_0x11bf('0x51')],_0x14bcf5);})[_0x11bf('0x25')](function(_0x49af03){_0x182158=_0x49af03;logger['info'](_0x11bf('0x52'));logger[_0x11bf('0x16')](_0x11bf('0x53'),_0x182158['id']);var _0x5115d6=util['format'](_0x11bf('0x54'),_0xe6168c[_0x11bf('0x1f')],_[_0x11bf('0x55')](_0x182158['id'],'x')[0x1]);logger[_0x11bf('0x16')](_0x11bf('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x11bf('0x5c'),_0x507726['name']),_0x11bf('0x5d'),{'uri':_0x5115d6});})[_0x11bf('0x29')](function(_0x56fcc8){logger['error'](_0x11bf('0x5a'),JSON[_0x11bf('0x24')](_0x56fcc8));});};exports[_0x11bf('0x5e')]=function(_0x1e1c9c,_0x41887b,_0x577c0f,_0x247db7,_0x1a69c9,_0x1d2af9){var _0x1a5ad0,_0x53de59,_0x512791,_0x326309;_0x1d2af9[_0x11bf('0x1f')]=intUtil[_0x11bf('0x44')](_0x1d2af9[_0x11bf('0x1f')]);_0x1d2af9[_0x11bf('0x4a')]=intUtil[_0x11bf('0x44')](_0x1d2af9[_0x11bf('0x4a')]);if(_0x1a69c9&&_0x1a69c9[_0x11bf('0x45')]){logger[_0x11bf('0x16')]('['+_0x41887b[_0x11bf('0x5f')][_0x11bf('0x60')]()+']','Recording\x20is\x20enabled!');_0x41887b[_0x11bf('0x48')]=util[_0x11bf('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d2af9['serverUrl'],_0x41887b[_0x11bf('0x4b')],md5(_0x41887b[_0x11bf('0x4b')]));}else{_0x41887b[_0x11bf('0x48')]='';}return getConnection(_0x1d2af9)['then'](function(_0xc3dcf7){_0x326309=_0xc3dcf7;return getUser(_0x1d2af9,'',_0x326309);})[_0x11bf('0x25')](function(_0x38d5c2){_0x1a5ad0=_0x38d5c2;logger[_0x11bf('0x16')](_0x11bf('0x4d'),_0x1a5ad0['id']);return getEndUser(_0x1d2af9,_0x41887b[_0x11bf('0x4e')],_0x41887b[_0x11bf('0x4f')],_0x326309);})[_0x11bf('0x25')](function(_0x3d3b75){_0x53de59=_0x3d3b75;logger[_0x11bf('0x16')]('The\x20Enduser\x20ID\x20is:',_0x53de59['id']);return createTicket(_0x1d2af9,_0x1a5ad0,_0x53de59,_0x577c0f,_0x41887b,_0x577c0f[_0x11bf('0x51')],_0x326309);})[_0x11bf('0x25')](function(_0xd497fc){_0x512791=_0xd497fc;logger[_0x11bf('0x16')]('Ticket\x20created!');logger[_0x11bf('0x16')](_0x11bf('0x53'),_0x512791['id']);})['catch'](function(_0x4c93dc){logger['error']('['+_0x41887b[_0x11bf('0x5f')]['toUpperCase']()+']',JSON[_0x11bf('0x24')](_0x4c93dc));});}; \ No newline at end of file +var _0xd00a=['error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','remoteUri','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','userId','admin','catch','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','query','sessionName','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','success','firstname','lastname','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','getConnection','[HTTP]','stripTrailingSlash','monitor_format','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','[QUEUE]','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','request-promise','bluebird','util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','socket.io-emitter','emit','length','type','idField','content','toString','variableName','Variable','name','toLowerCase','info','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','create','username','HelpDesk','stringify','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s'];(function(_0x314c7a,_0x3efd8e){var _0x3a6b81=function(_0x18ae60){while(--_0x18ae60){_0x314c7a['push'](_0x314c7a['shift']());}};_0x3a6b81(++_0x3efd8e);}(_0xd00a,0x9c));var _0xad00=function(_0x7e86fe,_0x104153){_0x7e86fe=_0x7e86fe-0x0;var _0x28263a=_0xd00a[_0x7e86fe];return _0x28263a;};'use strict';var _=require('lodash');var rp=require(_0xad00('0x0'));var BPromise=require(_0xad00('0x1'));var md5=require('md5');var util=require(_0xad00('0x2'));var Redis=require('ioredis');var intUtil=require(_0xad00('0x3'));var config=require(_0xad00('0x4'));var logger=require(_0xad00('0x5'))(_0xad00('0x6'));config[_0xad00('0x7')]=_[_0xad00('0x8')](config[_0xad00('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xad00('0x9'))(new Redis(config['redis']));function emit(_0x1e0e7a,_0xf064d2,_0x3648b6){io['to'](_0x1e0e7a)[_0xad00('0xa')](_0xf064d2,_0x3648b6);}function getCustomFields(_0x3e3a4f,_0x5f1c10){var _0x240236={};if(_0x3e3a4f[_0xad00('0xb')]>0x0){_['forEach'](_0x3e3a4f,function(_0x2c1787){if(_0x2c1787[_0xad00('0xc')]==='string'&&_0x2c1787[_0xad00('0xd')]){_0x240236[_0x2c1787[_0xad00('0xd')]]=_0x2c1787[_0xad00('0xe')][_0xad00('0xf')]();}else if(_0x2c1787['type']==='variable'&&_0x2c1787[_0xad00('0x10')]&&_0x2c1787[_0xad00('0xd')]&&_0x5f1c10[_0x2c1787[_0xad00('0x10')]]){_0x240236[_0x2c1787['idField']]=_0x5f1c10[_0x2c1787['variableName']][_0xad00('0xf')]();}else if(_0x2c1787[_0xad00('0xc')]==='customVariable'&&_0x2c1787[_0xad00('0x11')]&&_0x2c1787[_0xad00('0x11')][_0xad00('0x12')]&&_0x2c1787[_0xad00('0xd')]&&_0x5f1c10[_0x2c1787['Variable'][_0xad00('0x12')][_0xad00('0x13')]()]){_0x240236[_0x2c1787[_0xad00('0xd')]]=_0x5f1c10[_0x2c1787[_0xad00('0x11')][_0xad00('0x12')][_0xad00('0x13')]()]['toString']();}});}return _0x240236;}function createTicket(_0x4568a3,_0x55e10e,_0x161a2d,_0x52592e,_0x307331,_0x5e71f7,_0x2f7843){logger[_0xad00('0x14')]('Creating\x20new\x20ticket...');var _0x44f03b=_[_0xad00('0x15')]({'parent_id':'','assigned_user_id':_0x55e10e['id'],'ticketpriorities':_0xad00('0x16'),'ticketstatus':_0xad00('0x17'),'ticket_title':intUtil[_0xad00('0x18')](_0x52592e[_0xad00('0x19')],_0x307331,'\x20'),'description':intUtil[_0xad00('0x18')](_0x52592e[_0xad00('0x1a')],_0x307331,'\x0a'),'contact_id':_0x161a2d['id']},getCustomFields(_0x5e71f7,_0x307331));var _0x242dd9={'method':_0xad00('0x1b'),'uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x4568a3['remoteUri']),'form':{'operation':_0xad00('0x1e'),'username':_0x4568a3[_0xad00('0x1f')],'sessionName':_0x2f7843['sessionName'],'elementType':_0xad00('0x20'),'element':JSON[_0xad00('0x21')](_0x44f03b)},'json':!![]};return request(_0x242dd9)[_0xad00('0x22')](function(_0x551424){if(_0x551424['success']){return BPromise[_0xad00('0x23')]({'id':_0x551424[_0xad00('0x24')]['id']});}else{throw new Error(util['format'](_0xad00('0x25'),JSON[_0xad00('0x21')](_0x551424[_0xad00('0x26')])));}})['catch'](function(_0x273317){var _0x321187=_0x273317[_0xad00('0x27')]||0x1f4;logger[_0xad00('0x26')](_0xad00('0x28'),'createTicket',_0x321187,JSON[_0xad00('0x21')](_0x273317));});}function getUser(_0x3d8723,_0x355680,_0x533cdf){if(intUtil[_0xad00('0x29')](_0x355680)){logger[_0xad00('0x14')]('Getting\x20agent\x20with\x20email',_0x355680);return request({'method':_0xad00('0x2a'),'uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x3d8723[_0xad00('0x2b')]),'qs':{'operation':'query','username':_0x3d8723[_0xad00('0x1f')],'sessionName':_0x533cdf['sessionName'],'query':util['format'](_0xad00('0x2c'),_0x355680)},'json':!![]})[_0xad00('0x22')](function(_0x474594){if(_0x474594['success']&&_0x474594[_0xad00('0x24')][_0xad00('0xb')]){logger[_0xad00('0x14')](_0xad00('0x2d'));return BPromise['resolve']({'id':_0x474594['result'][0x0]['id'],'email':_0x474594[_0xad00('0x24')][0x0][_0xad00('0x2e')],'name':_0x474594[_0xad00('0x24')][0x0][_0xad00('0x2f')]+'\x20'+_0x474594['result']['last_name']});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x533cdf[_0xad00('0x30')],'email':_0x3d8723[_0xad00('0x1f')],'name':_0xad00('0x31')});}})[_0xad00('0x32')](function(_0x565df3){var _0x3db323=_0x565df3[_0xad00('0x27')]||0x1f4;logger[_0xad00('0x26')](_0xad00('0x28'),_0xad00('0x33'),_0x3db323,JSON[_0xad00('0x21')](_0x565df3));});}else{logger['info'](_0xad00('0x34'));return BPromise[_0xad00('0x23')]({'id':_0x533cdf[_0xad00('0x30')],'email':_0x3d8723[_0xad00('0x1f')],'name':_0xad00('0x31')})[_0xad00('0x32')](function(_0x12e7ed){var _0x18cbd4=_0x12e7ed['statusCode']||0x1f4;logger[_0xad00('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xad00('0x33'),_0x18cbd4,JSON[_0xad00('0x21')](_0x12e7ed));});}}function getEndUser(_0x429250,_0x4644ea,_0x107109,_0x441c63){logger[_0xad00('0x14')](_0xad00('0x35'),_0x107109);return request({'method':'GET','uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x429250[_0xad00('0x2b')]),'qs':{'operation':_0xad00('0x36'),'username':_0x429250['username'],'sessionName':_0x441c63[_0xad00('0x37')],'query':util[_0xad00('0x1c')](_0xad00('0x38'),_0x107109,_0x107109,_0x107109,_0x107109,_0x107109)},'json':!![]})[_0xad00('0x22')](function(_0x8c7b52){if(_0x8c7b52[_0xad00('0x39')]&&_0x8c7b52[_0xad00('0x24')]['length']){logger['info']('Enduser\x20found!');return BPromise[_0xad00('0x23')]({'id':_0x8c7b52['result'][0x0]['id'],'name':_0x8c7b52['result'][0x0][_0xad00('0x3a')]+'\x20'+_0x8c7b52[_0xad00('0x24')][0x0][_0xad00('0x3b')],'phone':_0x107109});}else{logger[_0xad00('0x14')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xad00('0x1b'),'uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x429250[_0xad00('0x2b')]),'form':{'operation':_0xad00('0x1e'),'sessionName':_0x441c63['sessionName'],'elementType':_0xad00('0x3c'),'element':JSON['stringify']({'lastname':_0x4644ea,'phone':_0x107109,'assigned_user_id':'\x20'})},'json':!![]})[_0xad00('0x22')](function(_0x43b196){logger['info'](_0xad00('0x3d'));return BPromise[_0xad00('0x23')]({'id':_0x43b196[_0xad00('0x24')]['id'],'name':_0x43b196[_0xad00('0x24')][_0xad00('0x3b')],'phone':_0x43b196[_0xad00('0x24')][_0xad00('0x3e')]});})[_0xad00('0x32')](function(_0x599e06){var _0x4ff86c=_0x599e06[_0xad00('0x27')]||0x1f4;logger[_0xad00('0x26')](_0xad00('0x28'),_0xad00('0x3f'),_0x4ff86c,JSON[_0xad00('0x21')](_0x599e06));});}});}function getConnection(_0x3421ac){var _0x51add3=_0x3421ac[_0xad00('0x1f')];var _0x8f48a2=_0x3421ac[_0xad00('0x40')];return request({'method':_0xad00('0x2a'),'uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x3421ac[_0xad00('0x2b')]),'qs':{'operation':_0xad00('0x41'),'username':_0x51add3},'json':!![]})[_0xad00('0x22')](function(_0x4d1757){if(_0x4d1757[_0xad00('0x39')]){return request({'method':_0xad00('0x1b'),'uri':util['format'](_0xad00('0x1d'),_0x3421ac['remoteUri']),'form':{'operation':_0xad00('0x42'),'username':_0x51add3,'accessKey':md5(_0x4d1757[_0xad00('0x24')][_0xad00('0x43')]+_0x8f48a2)},'json':!![]});}})[_0xad00('0x22')](function(_0x2e36a0){if(_0x2e36a0[_0xad00('0x39')]){return BPromise[_0xad00('0x23')](_0x2e36a0[_0xad00('0x24')]);}else{throw new Error(util[_0xad00('0x1c')]('Account\x20%d\x20is\x20not\x20valid',_0x3421ac['id']));}})[_0xad00('0x32')](function(_0x324073){var _0xff5b74=_0x324073[_0xad00('0x27')]||0x1f4;logger[_0xad00('0x26')](_0xad00('0x28'),_0xad00('0x44'),_0xff5b74,JSON['stringify'](_0x324073));});}function request(_0x5e903b){logger[_0xad00('0x14')](_0xad00('0x45'),JSON[_0xad00('0x21')](_0x5e903b));return rp(_0x5e903b);}exports['queue']=function(_0x57ed47,_0x4ede89,_0x3fc470,_0xde6511,_0x19d089,_0x1adb64){var _0x42c530,_0x619ff3,_0x5dabc5,_0x288242;_0x1adb64['remoteUri']=intUtil[_0xad00('0x46')](_0x1adb64[_0xad00('0x2b')]);if(_0x19d089&&_0x19d089[_0xad00('0x47')]){logger[_0xad00('0x14')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4ede89['recordingURL']=util[_0xad00('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1adb64[_0xad00('0x48')],_0x4ede89[_0xad00('0x49')],md5(_0x4ede89[_0xad00('0x49')]));}else{_0x4ede89[_0xad00('0x4a')]='';}return getConnection(_0x1adb64)[_0xad00('0x22')](function(_0x39f6a5){_0x288242=_0x39f6a5;return getUser(_0x1adb64,_0xde6511[_0xad00('0x4b')],_0x288242);})[_0xad00('0x22')](function(_0x1080f1){_0x42c530=_0x1080f1;logger['info'](_0xad00('0x4c'),_0x42c530['id']);return getEndUser(_0x1adb64,_0x4ede89[_0xad00('0x4d')],_0x4ede89[_0xad00('0x4e')],_0x288242);})[_0xad00('0x22')](function(_0x2831cf){_0x619ff3=_0x2831cf;logger['info']('The\x20Enduser\x20ID\x20is:',_0x619ff3['id']);return createTicket(_0x1adb64,_0x42c530,_0x619ff3,_0x3fc470,_0x4ede89,_0x3fc470[_0xad00('0x4f')],_0x288242);})['then'](function(_0x240fc1){_0x5dabc5=_0x240fc1;logger['info'](_0xad00('0x50'));logger['info'](_0xad00('0x51'),_0x5dabc5['id']);var _0xc52416=util[_0xad00('0x1c')](_0xad00('0x52'),_0x1adb64[_0xad00('0x2b')],_[_0xad00('0x53')](_0x5dabc5['id'],'x')[0x1]);logger[_0xad00('0x14')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xad00('0x1c')](_0xad00('0x54'),_0xde6511[_0xad00('0x12')]),_0xad00('0x55'),{'uri':_0xc52416});})[_0xad00('0x32')](function(_0x17e6c9){logger[_0xad00('0x26')](_0xad00('0x56'),JSON[_0xad00('0x21')](_0x17e6c9));});};exports['outbound']=function(_0x1c4f7f,_0x30cf3b,_0x3e089a,_0x190874,_0x2c55d1,_0x179a76,_0x251d92){var _0x285ec3,_0x579cec,_0x41b9b0,_0x2fa5d4;_0x179a76[_0xad00('0x2b')]=intUtil['stripTrailingSlash'](_0x179a76['remoteUri']);_0x179a76[_0xad00('0x48')]=intUtil[_0xad00('0x46')](_0x179a76['serverUrl']);if(_0x251d92&&_0x251d92[_0xad00('0x57')]&&_0x251d92[_0xad00('0x57')]!==_0xad00('0x58')){logger[_0xad00('0x14')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x30cf3b[_0xad00('0x4a')]=util[_0xad00('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x179a76[_0xad00('0x48')],_0x30cf3b[_0xad00('0x49')],md5(_0x30cf3b[_0xad00('0x49')]));}return getConnection(_0x179a76)[_0xad00('0x22')](function(_0xc92b42){_0x2fa5d4=_0xc92b42;return getUser(_0x179a76,_0x190874[_0xad00('0x4b')],_0x2fa5d4);})[_0xad00('0x22')](function(_0x1acbf7){_0x285ec3=_0x1acbf7;logger[_0xad00('0x14')](_0xad00('0x4c'),_0x285ec3['id']);return getEndUser(_0x179a76,_0x30cf3b[_0xad00('0x59')],_0x30cf3b[_0xad00('0x5a')],_0x2fa5d4);})[_0xad00('0x22')](function(_0x774862){_0x579cec=_0x774862;logger[_0xad00('0x14')](_0xad00('0x5b'),_0x579cec['id']);return createTicket(_0x179a76,_0x285ec3,_0x579cec,_0x3e089a,_0x30cf3b,_0x3e089a[_0xad00('0x4f')],_0x2fa5d4);})['then'](function(_0x574c40){_0x41b9b0=_0x574c40;logger[_0xad00('0x14')](_0xad00('0x50'));logger[_0xad00('0x14')](_0xad00('0x51'),_0x41b9b0['id']);var _0x12303f=util[_0xad00('0x1c')](_0xad00('0x52'),_0x179a76['remoteUri'],_[_0xad00('0x53')](_0x41b9b0['id'],'x')[0x1]);logger['info'](_0xad00('0x5c'),_0xad00('0x5d'));emit(util[_0xad00('0x1c')]('user:%s',_0x190874[_0xad00('0x12')]),_0xad00('0x55'),{'uri':_0x12303f});})[_0xad00('0x32')](function(_0x3878a2){logger[_0xad00('0x26')](_0xad00('0x5c'),JSON[_0xad00('0x21')](_0x3878a2));});};exports['unmanaged']=function(_0x184fe2,_0x1261ec,_0x3b6771,_0x5ee88a,_0x562970,_0x437705){var _0x178954,_0x96cc3c,_0x3fd607,_0x22ddbd;_0x437705[_0xad00('0x2b')]=intUtil['stripTrailingSlash'](_0x437705['remoteUri']);_0x437705[_0xad00('0x48')]=intUtil[_0xad00('0x46')](_0x437705['serverUrl']);if(_0x562970&&_0x562970[_0xad00('0x47')]){logger[_0xad00('0x14')]('['+_0x1261ec[_0xad00('0x5e')][_0xad00('0x5f')]()+']','Recording\x20is\x20enabled!');_0x1261ec[_0xad00('0x4a')]=util[_0xad00('0x1c')](_0xad00('0x60'),_0x437705[_0xad00('0x48')],_0x1261ec[_0xad00('0x49')],md5(_0x1261ec[_0xad00('0x49')]));}else{_0x1261ec['recordingURL']='';}return getConnection(_0x437705)[_0xad00('0x22')](function(_0x211dde){_0x22ddbd=_0x211dde;return getUser(_0x437705,'',_0x22ddbd);})[_0xad00('0x22')](function(_0x364a4b){_0x178954=_0x364a4b;logger['info']('The\x20User\x20ID\x20is:',_0x178954['id']);return getEndUser(_0x437705,_0x1261ec['calleridname'],_0x1261ec[_0xad00('0x4e')],_0x22ddbd);})[_0xad00('0x22')](function(_0x588b42){_0x96cc3c=_0x588b42;logger[_0xad00('0x14')](_0xad00('0x5b'),_0x96cc3c['id']);return createTicket(_0x437705,_0x178954,_0x96cc3c,_0x3b6771,_0x1261ec,_0x3b6771[_0xad00('0x4f')],_0x22ddbd);})[_0xad00('0x22')](function(_0x44786e){_0x3fd607=_0x44786e;logger['info'](_0xad00('0x50'));logger['info'](_0xad00('0x51'),_0x3fd607['id']);})[_0xad00('0x32')](function(_0x11dc32){logger['error']('['+_0x1261ec[_0xad00('0x5e')][_0xad00('0x5f')]()+']',JSON['stringify'](_0x11dc32));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index ddd5da4..ca5e681 100644 --- a/server/services/ami/trigger/integration/zendesk.js +++ b/server/services/ami/trigger/integration/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x963e=['Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','base64','debug','[HTTP]','GET','map','forEach','nameField','customField','toLowerCase','content','toString','type','string','idField','custom_fields','push','variableName','customVariable','Variable','name','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','/api/v2','catch','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST'];(function(_0x2db2c1,_0x491b11){var _0x3b787f=function(_0x1487c1){while(--_0x1487c1){_0x2db2c1['push'](_0x2db2c1['shift']());}};_0x3b787f(++_0x491b11);}(_0x963e,0xad));var _0xe963=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x963e[_0x529f1c];return _0x4d57ab;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xe963('0x0'));var util=require(_0xe963('0x1'));var Redis=require('ioredis');var intUtil=require(_0xe963('0x2'));var config=require(_0xe963('0x3'));var logger=require(_0xe963('0x4'))('zendesk');config[_0xe963('0x5')]=_[_0xe963('0x6')](config['redis'],{'host':_0xe963('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0xaf8b0b,_0x13325d,_0x32ace8){io['to'](_0xaf8b0b)[_0xe963('0x8')](_0x13325d,_0x32ace8);}var headers={'Content-Type':_0xe963('0x9'),'Accept':'application/json'};function getTicket(_0x1ddf2d,_0x5265ae,_0x4dd607,_0x20e8a2,_0x4fe5bc){logger[_0xe963('0xa')](_0xe963('0xb'));return request({'uri':util[_0xe963('0xc')](_0xe963('0xd'),_0x1ddf2d[_0xe963('0xe')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x4dd607['id'],'submitter_id':_0x5265ae?_0x5265ae['id']:undefined,'assignee_id':_0x5265ae?_0x5265ae['id']:undefined,'tags':getTags(_0x20e8a2[_0xe963('0xf')],'name'),'subject':intUtil[_0xe963('0x10')](_0x20e8a2[_0xe963('0x11')],_0x4fe5bc,'\x20'),'description':intUtil[_0xe963('0x10')](_0x20e8a2[_0xe963('0x12')],_0x4fe5bc,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe963('0x10')](_0x20e8a2[_0xe963('0x12')],_0x4fe5bc,'\x0a')}},getCustomFields(_0x20e8a2[_0xe963('0x13')],_0x4fe5bc))}})['then'](function(_0x125b8d){logger['info'](_0xe963('0x14'));return _0x125b8d[_0xe963('0x15')];});}function getUser(_0x3bf916,_0x2d2239){if(intUtil[_0xe963('0x16')](_0x2d2239)){logger[_0xe963('0xa')](_0xe963('0x17'),_0x2d2239);return request({'uri':util[_0xe963('0xc')](_0xe963('0x18'),_0x3bf916[_0xe963('0xe')]),'qs':{'query':util[_0xe963('0xc')](_0xe963('0x19'),_0x2d2239)}})[_0xe963('0x1a')](function(_0x2ea639){if(_0x2ea639[_0xe963('0x1b')]){logger['info'](_0xe963('0x1c'));return _[_0xe963('0x1d')](_0x2ea639['results'],{'email':_0x2d2239,'role':_0xe963('0x1e')});}else{logger[_0xe963('0xa')](_0xe963('0x1f'));return request({'uri':util[_0xe963('0xc')](_0xe963('0x20'),_0x3bf916[_0xe963('0xe')])})[_0xe963('0x1a')](function(_0x1438cf){logger[_0xe963('0xa')](_0xe963('0x21'));return _0x1438cf['user'];});}});}else{logger[_0xe963('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe963('0xc')](_0xe963('0x20'),_0x3bf916[_0xe963('0xe')])})[_0xe963('0x1a')](function(_0x2cd37e){logger['info']('Admin\x20account\x20selected.');return _0x2cd37e[_0xe963('0x22')];});}}function getEndUser(_0x5e1c69,_0x38de38,_0x49ee8e){logger[_0xe963('0xa')](_0xe963('0x23'),_0x49ee8e);return request({'uri':util[_0xe963('0xc')](_0xe963('0x18'),_0x5e1c69['remoteUri']),'qs':{'query':util['format'](_0xe963('0x24'),_0x49ee8e)}})[_0xe963('0x1a')](function(_0x5a5cec){var _0x45c591;if(_0x5a5cec[_0xe963('0x25')][_0xe963('0x26')]){_0x5a5cec[_0xe963('0x25')]=_[_0xe963('0x27')](_0x5a5cec[_0xe963('0x25')],{'suspended':![],'role':_0xe963('0x28')});if(_0x5a5cec[_0xe963('0x25')]['length']){_0x45c591=_[_0xe963('0x29')](_0x5a5cec[_0xe963('0x25')]);}}if(_0x45c591){logger[_0xe963('0xa')]('Enduser\x20found!');return _0x45c591;}else{logger['info'](_0xe963('0x2a'));return request({'uri':util[_0xe963('0xc')](_0xe963('0x2b'),_0x5e1c69[_0xe963('0xe')]),'method':_0xe963('0x2c'),'body':{'user':{'role':_0xe963('0x28'),'name':util[_0xe963('0xc')](_0xe963('0x2d'),_0x38de38||_0x49ee8e),'phone':_0x49ee8e}}})[_0xe963('0x1a')](function(_0x3bbcc6){logger['info'](_0xe963('0x2e'));return _0x3bbcc6[_0xe963('0x22')];});}});}function getAuth(_0x59552e){var _0x124789;if(_0x59552e[_0xe963('0x2f')]===_0xe963('0x30')){_0x124789=util[_0xe963('0xc')](_0xe963('0x31'),_0x59552e[_0xe963('0x32')],_0x59552e['password']);}else if(_0x59552e['authType']===_0xe963('0x33')){_0x124789=util['format']('%s/token:%s',_0x59552e[_0xe963('0x32')],_0x59552e[_0xe963('0x33')]);}return util[_0xe963('0xc')]('Basic\x20%s',new Buffer(_0x124789)['toString'](_0xe963('0x34')));}function request(_0x227709){logger[_0xe963('0x35')](_0xe963('0x36'),JSON['stringify'](_0x227709));return rp(_[_0xe963('0x6')](_0x227709,{'method':_0xe963('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x5e47f6,_0x3810a9){var _0x3ef49b=[];if(_0x5e47f6&&_0x5e47f6[_0xe963('0x26')]>0x0){_0x3ef49b=_[_0xe963('0x38')](_0x5e47f6,_0x3810a9);}return _0x3ef49b;}function getCustomFields(_0x1f3966,_0x2dc498){var _0x3f20d6=[];var _0x524799={'custom_fields':[]};if(_0x1f3966[_0xe963('0x26')]>0x0){_[_0xe963('0x39')](_0x1f3966,function(_0x2fdeef){if(_0x2fdeef['type']==='string'&&_0x2fdeef[_0xe963('0x3a')]&&!_0x2fdeef[_0xe963('0x3b')]){_0x524799[_0x2fdeef[_0xe963('0x3a')][_0xe963('0x3c')]()]=_0x2fdeef[_0xe963('0x3d')][_0xe963('0x3e')]();}else if(_0x2fdeef[_0xe963('0x3f')]===_0xe963('0x40')&&_0x2fdeef[_0xe963('0x41')]&&_0x2fdeef[_0xe963('0x3b')]){_0x524799[_0xe963('0x42')][_0xe963('0x43')]({'id':_0x2fdeef['idField'],'value':_0x2fdeef[_0xe963('0x3d')]['toString']()});}else if(_0x2fdeef['type']==='variable'&&_0x2fdeef[_0xe963('0x44')]&&_0x2fdeef[_0xe963('0x41')]&&_0x2fdeef[_0xe963('0x3b')]){_0x2dc498[_0x2fdeef[_0xe963('0x44')]]&&_0x524799[_0xe963('0x42')][_0xe963('0x43')]({'id':_0x2fdeef[_0xe963('0x41')],'value':_0x2dc498[_0x2fdeef[_0xe963('0x44')]]['toString']()});}else if(_0x2fdeef[_0xe963('0x3f')]===_0xe963('0x45')&&_0x2fdeef['Variable']&&_0x2fdeef[_0xe963('0x46')][_0xe963('0x47')]&&_0x2fdeef['idField']&&_0x2fdeef[_0xe963('0x3b')]){_0x2dc498[_0x2fdeef[_0xe963('0x46')][_0xe963('0x47')][_0xe963('0x3c')]()]&&_0x524799[_0xe963('0x42')][_0xe963('0x43')]({'id':_0x2fdeef[_0xe963('0x41')],'value':_0x2dc498[_0x2fdeef['Variable'][_0xe963('0x47')][_0xe963('0x3c')]()][_0xe963('0x3e')]()});}});}return _0x524799;}exports['queue']=function(_0x3022fa,_0x59a8c8,_0x3365c5,_0x308ae,_0x3bd633,_0x4807e6){var _0x220cca,_0x455145;_0x4807e6['remoteUri']=intUtil[_0xe963('0x48')](_0x4807e6[_0xe963('0xe')]);_0x4807e6[_0xe963('0x49')]=intUtil['stripTrailingSlash'](_0x4807e6[_0xe963('0x49')]);if(_0x3bd633&&_0x3bd633['monitor_format']){logger[_0xe963('0xa')]('[QUEUE]',_0xe963('0x4a'));_0x59a8c8[_0xe963('0x4b')]=util[_0xe963('0xc')](_0xe963('0x4c'),_0x4807e6[_0xe963('0x49')],_0x59a8c8[_0xe963('0x4d')],md5(_0x59a8c8[_0xe963('0x4d')]));}else{_0x59a8c8[_0xe963('0x4b')]='';}headers['Authorization']=getAuth(_0x4807e6);return getUser(_0x4807e6,_0x308ae['email'])[_0xe963('0x1a')](function(_0x13fc50){_0x220cca=_0x13fc50;logger[_0xe963('0xa')]('The\x20User\x20ID\x20is:',_0x220cca['id']);return getEndUser(_0x4807e6,_0x59a8c8[_0xe963('0x4e')],_0x59a8c8[_0xe963('0x4f')]);})[_0xe963('0x1a')](function(_0x307fd8){_0x455145=_0x307fd8;logger[_0xe963('0xa')](_0xe963('0x50'),_0x455145['id']);return getTicket(_0x4807e6,_0x220cca,_0x455145,_0x3365c5,_0x59a8c8);})[_0xe963('0x1a')](function(_0x5f29e6){if(_0x5f29e6){logger[_0xe963('0xa')](_0xe963('0x51'),_0x5f29e6['id']);switch(_0x4807e6[_0xe963('0x3f')]){case _0xe963('0x52'):logger[_0xe963('0xa')](_0xe963('0x53'),_0xe963('0x54'));return request({'uri':util['format'](_0xe963('0x55'),_0x4807e6[_0xe963('0xe')],_0x220cca['id'],_0x5f29e6['id']),'method':_0xe963('0x2c')});case _0xe963('0x56'):logger[_0xe963('0xa')]('[QUEUE]',_0xe963('0x57'));emit(util[_0xe963('0xc')](_0xe963('0x58'),_0x308ae[_0xe963('0x47')]),'trigger:browser:url',{'uri':util['format'](_0xe963('0x59'),_0x4807e6[_0xe963('0xe')][_0xe963('0x5a')]('/api/v2',''),_0x5f29e6['id'])});break;default:logger['error'](_0xe963('0x53'),_0xe963('0x5b'));}}})['catch'](function(_0x34c453){logger['error'](_0xe963('0x5c'),util[_0xe963('0x5d')](_0x34c453,{'showHidden':!![],'depth':null}));});};exports[_0xe963('0x5e')]=function(_0x5dc785,_0x495fae,_0x3b946d,_0x522e47,_0x220742,_0x1077ac,_0x4318a3){var _0x29c191,_0x3a6a1;_0x1077ac[_0xe963('0xe')]=intUtil[_0xe963('0x48')](_0x1077ac[_0xe963('0xe')]);_0x1077ac[_0xe963('0x49')]=intUtil['stripTrailingSlash'](_0x1077ac[_0xe963('0x49')]);if(_0x4318a3&&_0x4318a3[_0xe963('0x5f')]&&_0x4318a3[_0xe963('0x5f')]!==_0xe963('0x60')){logger[_0xe963('0xa')](_0xe963('0x61'),_0xe963('0x4a'));_0x495fae[_0xe963('0x4b')]=util[_0xe963('0xc')](_0xe963('0x4c'),_0x1077ac[_0xe963('0x49')],_0x495fae['uniqueid'],md5(_0x495fae[_0xe963('0x4d')]));}headers['Authorization']=getAuth(_0x1077ac);return getUser(_0x1077ac,_0x522e47['email'])[_0xe963('0x1a')](function(_0x1d0a12){_0x29c191=_0x1d0a12;logger['info'](_0xe963('0x62'),_0x29c191['id']);return getEndUser(_0x1077ac,_0x495fae[_0xe963('0x63')],_0x495fae[_0xe963('0x64')]);})[_0xe963('0x1a')](function(_0xb9bc8d){_0x3a6a1=_0xb9bc8d;logger[_0xe963('0xa')](_0xe963('0x50'),_0x3a6a1['id']);return getTicket(_0x1077ac,_0x29c191,_0x3a6a1,_0x3b946d,_0x495fae);})[_0xe963('0x1a')](function(_0x29f1bb){if(_0x29f1bb){logger['info'](_0xe963('0x51'),_0x29f1bb['id']);switch(_0x1077ac[_0xe963('0x3f')]){case'integrationTab':logger[_0xe963('0xa')](_0xe963('0x61'),_0xe963('0x54'));return request({'uri':util[_0xe963('0xc')](_0xe963('0x55'),_0x1077ac[_0xe963('0xe')],_0x29c191['id'],_0x29f1bb['id']),'method':_0xe963('0x2c')});case _0xe963('0x56'):logger['info'](_0xe963('0x61'),_0xe963('0x57'));emit(util[_0xe963('0xc')]('user:%s',_0x522e47[_0xe963('0x47')]),'trigger:browser:url',{'uri':util[_0xe963('0xc')](_0xe963('0x59'),_0x1077ac[_0xe963('0xe')][_0xe963('0x5a')](_0xe963('0x65'),''),_0x29f1bb['id'])});break;default:logger['error'](_0xe963('0x61'),_0xe963('0x5b'));}}})[_0xe963('0x66')](function(_0x510054){logger[_0xe963('0x67')](_0xe963('0x68'),util[_0xe963('0x5d')](_0x510054,{'showHidden':!![],'depth':null}));});};exports[_0xe963('0x69')]=function(_0x440a6e,_0x318d58,_0xadd23c,_0x3ff07c,_0x17c821,_0x4a783a){var _0x338b3a,_0x51ce54;_0x4a783a[_0xe963('0xe')]=intUtil[_0xe963('0x48')](_0x4a783a[_0xe963('0xe')]);_0x4a783a[_0xe963('0x49')]=intUtil[_0xe963('0x48')](_0x4a783a[_0xe963('0x49')]);if(_0x17c821&&_0x17c821['monitor_format']){logger['info']('['+_0x318d58[_0xe963('0x6a')][_0xe963('0x6b')]()+']',_0xe963('0x4a'));_0x318d58['recordingURL']=util[_0xe963('0xc')](_0xe963('0x4c'),_0x4a783a['serverUrl'],_0x318d58['uniqueid'],md5(_0x318d58[_0xe963('0x4d')]));}else{_0x318d58[_0xe963('0x4b')]='';}headers['Authorization']=getAuth(_0x4a783a);return getUser(_0x4a783a)[_0xe963('0x1a')](function(_0x52f110){_0x338b3a=_0x52f110;logger[_0xe963('0xa')](_0xe963('0x62'),_0x338b3a['id']);return getEndUser(_0x4a783a,_0x318d58[_0xe963('0x4e')],_0x318d58[_0xe963('0x4f')]);})[_0xe963('0x1a')](function(_0x28914c){_0x51ce54=_0x28914c;logger['info'](_0xe963('0x50'),_0x51ce54['id']);return getTicket(_0x4a783a,_0x338b3a,_0x51ce54,_0xadd23c,_0x318d58);})[_0xe963('0x1a')](function(_0x362736){if(_0x362736){logger[_0xe963('0xa')]('The\x20Ticket\x20ID\x20is:',_0x362736['id']);}})[_0xe963('0x66')](function(_0x31285e){logger['error']('['+_0x318d58[_0xe963('0x6a')][_0xe963('0x6b')]()+']'+_0xe963('0x6c'),util[_0xe963('0x5d')](_0x31285e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x055c=['content','idField','custom_fields','push','variableName','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','trigger:browser:url','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','Tags','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','defaults','GET','forEach','type','string','nameField','customField','toLowerCase'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x055c,0x1ee));var _0xc055=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0x055c[_0x25a0b9];return _0x30b9ab;};'use strict';var _=require('lodash');var rp=require(_0xc055('0x0'));var md5=require(_0xc055('0x1'));var util=require(_0xc055('0x2'));var Redis=require(_0xc055('0x3'));var intUtil=require('./util');var config=require(_0xc055('0x4'));var logger=require(_0xc055('0x5'))(_0xc055('0x6'));config[_0xc055('0x7')]=_['defaults'](config[_0xc055('0x7')],{'host':_0xc055('0x8'),'port':0x18eb});var io=require(_0xc055('0x9'))(new Redis(config['redis']));function emit(_0xe8d9c1,_0x2b7eb3,_0xf809af){io['to'](_0xe8d9c1)[_0xc055('0xa')](_0x2b7eb3,_0xf809af);}var headers={'Content-Type':_0xc055('0xb'),'Accept':_0xc055('0xb')};function getTicket(_0x80236e,_0x4ba522,_0x4a11c7,_0x3ff5a4,_0x5c2d4a){logger[_0xc055('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xc055('0xd')](_0xc055('0xe'),_0x80236e[_0xc055('0xf')]),'method':_0xc055('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x4a11c7['id'],'submitter_id':_0x4ba522?_0x4ba522['id']:undefined,'assignee_id':_0x4ba522?_0x4ba522['id']:undefined,'tags':getTags(_0x3ff5a4[_0xc055('0x11')],'name'),'subject':intUtil['getString'](_0x3ff5a4[_0xc055('0x12')],_0x5c2d4a,'\x20'),'description':intUtil[_0xc055('0x13')](_0x3ff5a4[_0xc055('0x14')],_0x5c2d4a,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc055('0x13')](_0x3ff5a4[_0xc055('0x14')],_0x5c2d4a,'\x0a')}},getCustomFields(_0x3ff5a4[_0xc055('0x15')],_0x5c2d4a))}})[_0xc055('0x16')](function(_0x297ba5){logger[_0xc055('0xc')](_0xc055('0x17'));return _0x297ba5[_0xc055('0x18')];});}function getUser(_0x2920fd,_0x3ff256){if(intUtil[_0xc055('0x19')](_0x3ff256)){logger[_0xc055('0xc')]('Getting\x20agent\x20with\x20email',_0x3ff256);return request({'uri':util[_0xc055('0xd')](_0xc055('0x1a'),_0x2920fd[_0xc055('0xf')]),'qs':{'query':util['format'](_0xc055('0x1b'),_0x3ff256)}})[_0xc055('0x16')](function(_0x557e52){if(_0x557e52[_0xc055('0x1c')]){logger[_0xc055('0xc')](_0xc055('0x1d'));return _[_0xc055('0x1e')](_0x557e52[_0xc055('0x1f')],{'email':_0x3ff256,'role':'agent'});}else{logger[_0xc055('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc055('0xd')]('%s/users/me.json',_0x2920fd['remoteUri'])})['then'](function(_0x57838e){logger[_0xc055('0xc')](_0xc055('0x20'));return _0x57838e[_0xc055('0x21')];});}});}else{logger[_0xc055('0xc')](_0xc055('0x22'));return request({'uri':util[_0xc055('0xd')](_0xc055('0x23'),_0x2920fd[_0xc055('0xf')])})[_0xc055('0x16')](function(_0x599cfa){logger['info']('Admin\x20account\x20selected.');return _0x599cfa[_0xc055('0x21')];});}}function getEndUser(_0x2d6679,_0xdec75b,_0x31b2bb){logger[_0xc055('0xc')]('Searching\x20enduser\x20with\x20phone',_0x31b2bb);return request({'uri':util[_0xc055('0xd')](_0xc055('0x1a'),_0x2d6679['remoteUri']),'qs':{'query':util[_0xc055('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x31b2bb)}})[_0xc055('0x16')](function(_0x3e56ba){var _0x5c77c6;if(_0x3e56ba[_0xc055('0x1f')][_0xc055('0x24')]){_0x3e56ba[_0xc055('0x1f')]=_[_0xc055('0x25')](_0x3e56ba['results'],{'suspended':![],'role':_0xc055('0x26')});if(_0x3e56ba['results'][_0xc055('0x24')]){_0x5c77c6=_[_0xc055('0x27')](_0x3e56ba[_0xc055('0x1f')]);}}if(_0x5c77c6){logger[_0xc055('0xc')]('Enduser\x20found!');return _0x5c77c6;}else{logger[_0xc055('0xc')](_0xc055('0x28'));return request({'uri':util['format'](_0xc055('0x29'),_0x2d6679[_0xc055('0xf')]),'method':_0xc055('0x10'),'body':{'user':{'role':_0xc055('0x26'),'name':util[_0xc055('0xd')](_0xc055('0x2a'),_0xdec75b||_0x31b2bb),'phone':_0x31b2bb}}})[_0xc055('0x16')](function(_0x874047){logger['info'](_0xc055('0x2b'));return _0x874047[_0xc055('0x21')];});}});}function getAuth(_0x14ab71){var _0x198ef3;if(_0x14ab71[_0xc055('0x2c')]===_0xc055('0x2d')){_0x198ef3=util['format']('%s:%s',_0x14ab71[_0xc055('0x2e')],_0x14ab71[_0xc055('0x2d')]);}else if(_0x14ab71[_0xc055('0x2c')]===_0xc055('0x2f')){_0x198ef3=util['format'](_0xc055('0x30'),_0x14ab71[_0xc055('0x2e')],_0x14ab71[_0xc055('0x2f')]);}return util[_0xc055('0xd')](_0xc055('0x31'),new Buffer(_0x198ef3)[_0xc055('0x32')](_0xc055('0x33')));}function request(_0x1514b3){logger['debug'](_0xc055('0x34'),JSON['stringify'](_0x1514b3));return rp(_[_0xc055('0x35')](_0x1514b3,{'method':_0xc055('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x40a84e,_0x38a51f){var _0x539435=[];if(_0x40a84e&&_0x40a84e[_0xc055('0x24')]>0x0){_0x539435=_['map'](_0x40a84e,_0x38a51f);}return _0x539435;}function getCustomFields(_0x15852e,_0x206759){var _0x375a85=[];var _0x436705={'custom_fields':[]};if(_0x15852e[_0xc055('0x24')]>0x0){_[_0xc055('0x37')](_0x15852e,function(_0x335848){if(_0x335848[_0xc055('0x38')]===_0xc055('0x39')&&_0x335848[_0xc055('0x3a')]&&!_0x335848[_0xc055('0x3b')]){_0x436705[_0x335848['nameField'][_0xc055('0x3c')]()]=_0x335848[_0xc055('0x3d')][_0xc055('0x32')]();}else if(_0x335848[_0xc055('0x38')]==='string'&&_0x335848[_0xc055('0x3e')]&&_0x335848[_0xc055('0x3b')]){_0x436705[_0xc055('0x3f')]['push']({'id':_0x335848[_0xc055('0x3e')],'value':_0x335848['content']['toString']()});}else if(_0x335848[_0xc055('0x38')]==='variable'&&_0x335848['variableName']&&_0x335848[_0xc055('0x3e')]&&_0x335848['customField']){_0x206759[_0x335848['variableName']]&&_0x436705[_0xc055('0x3f')][_0xc055('0x40')]({'id':_0x335848[_0xc055('0x3e')],'value':_0x206759[_0x335848[_0xc055('0x41')]]['toString']()});}else if(_0x335848[_0xc055('0x38')]===_0xc055('0x42')&&_0x335848[_0xc055('0x43')]&&_0x335848[_0xc055('0x43')][_0xc055('0x44')]&&_0x335848['idField']&&_0x335848[_0xc055('0x3b')]){_0x206759[_0x335848[_0xc055('0x43')][_0xc055('0x44')][_0xc055('0x3c')]()]&&_0x436705[_0xc055('0x3f')][_0xc055('0x40')]({'id':_0x335848['idField'],'value':_0x206759[_0x335848['Variable']['name'][_0xc055('0x3c')]()][_0xc055('0x32')]()});}});}return _0x436705;}exports[_0xc055('0x45')]=function(_0x31dc1e,_0x3b9cb0,_0x53fd55,_0x46cde7,_0x4e0b0c,_0x3de08b){var _0x42379e,_0x1817a4;_0x3de08b[_0xc055('0xf')]=intUtil['stripTrailingSlash'](_0x3de08b[_0xc055('0xf')]);_0x3de08b[_0xc055('0x46')]=intUtil[_0xc055('0x47')](_0x3de08b[_0xc055('0x46')]);if(_0x4e0b0c&&_0x4e0b0c[_0xc055('0x48')]){logger[_0xc055('0xc')](_0xc055('0x49'),_0xc055('0x4a'));_0x3b9cb0[_0xc055('0x4b')]=util[_0xc055('0xd')](_0xc055('0x4c'),_0x3de08b[_0xc055('0x46')],_0x3b9cb0['uniqueid'],md5(_0x3b9cb0[_0xc055('0x4d')]));}else{_0x3b9cb0['recordingURL']='';}headers[_0xc055('0x4e')]=getAuth(_0x3de08b);return getUser(_0x3de08b,_0x46cde7[_0xc055('0x4f')])[_0xc055('0x16')](function(_0x17f7c1){_0x42379e=_0x17f7c1;logger[_0xc055('0xc')](_0xc055('0x50'),_0x42379e['id']);return getEndUser(_0x3de08b,_0x3b9cb0[_0xc055('0x51')],_0x3b9cb0[_0xc055('0x52')]);})['then'](function(_0x87f471){_0x1817a4=_0x87f471;logger['info'](_0xc055('0x53'),_0x1817a4['id']);return getTicket(_0x3de08b,_0x42379e,_0x1817a4,_0x53fd55,_0x3b9cb0);})[_0xc055('0x16')](function(_0x3688f4){if(_0x3688f4){logger[_0xc055('0xc')](_0xc055('0x54'),_0x3688f4['id']);switch(_0x3de08b['type']){case _0xc055('0x55'):logger['info'](_0xc055('0x49'),_0xc055('0x56'));return request({'uri':util[_0xc055('0xd')](_0xc055('0x57'),_0x3de08b[_0xc055('0xf')],_0x42379e['id'],_0x3688f4['id']),'method':_0xc055('0x10')});case _0xc055('0x58'):logger[_0xc055('0xc')](_0xc055('0x49'),_0xc055('0x59'));emit(util[_0xc055('0xd')](_0xc055('0x5a'),_0x46cde7[_0xc055('0x44')]),'trigger:browser:url',{'uri':util['format'](_0xc055('0x5b'),_0x3de08b[_0xc055('0xf')][_0xc055('0x5c')](_0xc055('0x5d'),''),_0x3688f4['id'])});break;default:logger[_0xc055('0x5e')](_0xc055('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xc055('0x5f')](function(_0x851750){logger[_0xc055('0x5e')](_0xc055('0x60'),util['inspect'](_0x851750,{'showHidden':!![],'depth':null}));});};exports[_0xc055('0x61')]=function(_0x57ff0c,_0x1c71fe,_0x229063,_0x1bf858,_0x1ef4d9,_0x3b18d3,_0xc39f84){var _0x593911,_0x5073ca;_0x3b18d3['remoteUri']=intUtil[_0xc055('0x47')](_0x3b18d3[_0xc055('0xf')]);_0x3b18d3[_0xc055('0x46')]=intUtil['stripTrailingSlash'](_0x3b18d3[_0xc055('0x46')]);if(_0xc39f84&&_0xc39f84[_0xc055('0x62')]&&_0xc39f84[_0xc055('0x62')]!==_0xc055('0x63')){logger['info'](_0xc055('0x64'),'Recording\x20is\x20enabled!');_0x1c71fe[_0xc055('0x4b')]=util[_0xc055('0xd')](_0xc055('0x4c'),_0x3b18d3[_0xc055('0x46')],_0x1c71fe[_0xc055('0x4d')],md5(_0x1c71fe[_0xc055('0x4d')]));}headers[_0xc055('0x4e')]=getAuth(_0x3b18d3);return getUser(_0x3b18d3,_0x1bf858[_0xc055('0x4f')])[_0xc055('0x16')](function(_0x1d53f0){_0x593911=_0x1d53f0;logger[_0xc055('0xc')](_0xc055('0x50'),_0x593911['id']);return getEndUser(_0x3b18d3,_0x1c71fe[_0xc055('0x65')],_0x1c71fe[_0xc055('0x66')]);})['then'](function(_0x6a402f){_0x5073ca=_0x6a402f;logger[_0xc055('0xc')](_0xc055('0x53'),_0x5073ca['id']);return getTicket(_0x3b18d3,_0x593911,_0x5073ca,_0x229063,_0x1c71fe);})['then'](function(_0x1fc116){if(_0x1fc116){logger[_0xc055('0xc')](_0xc055('0x54'),_0x1fc116['id']);switch(_0x3b18d3[_0xc055('0x38')]){case _0xc055('0x55'):logger['info']('[OUTBOUND]',_0xc055('0x56'));return request({'uri':util['format'](_0xc055('0x57'),_0x3b18d3['remoteUri'],_0x593911['id'],_0x1fc116['id']),'method':_0xc055('0x10')});case _0xc055('0x58'):logger[_0xc055('0xc')](_0xc055('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc055('0xd')]('user:%s',_0x1bf858[_0xc055('0x44')]),_0xc055('0x67'),{'uri':util[_0xc055('0xd')](_0xc055('0x5b'),_0x3b18d3[_0xc055('0xf')]['replace'](_0xc055('0x5d'),''),_0x1fc116['id'])});break;default:logger[_0xc055('0x5e')](_0xc055('0x64'),_0xc055('0x68'));}}})[_0xc055('0x5f')](function(_0x11577d){logger[_0xc055('0x5e')](_0xc055('0x69'),util[_0xc055('0x6a')](_0x11577d,{'showHidden':!![],'depth':null}));});};exports[_0xc055('0x6b')]=function(_0x241f92,_0x10642e,_0x31f815,_0x478846,_0x45cfbc,_0x50922d){var _0x50a273,_0x3b4d3b;_0x50922d['remoteUri']=intUtil['stripTrailingSlash'](_0x50922d[_0xc055('0xf')]);_0x50922d['serverUrl']=intUtil[_0xc055('0x47')](_0x50922d[_0xc055('0x46')]);if(_0x45cfbc&&_0x45cfbc[_0xc055('0x48')]){logger[_0xc055('0xc')]('['+_0x10642e[_0xc055('0x6c')]['toUpperCase']()+']',_0xc055('0x4a'));_0x10642e['recordingURL']=util['format'](_0xc055('0x4c'),_0x50922d[_0xc055('0x46')],_0x10642e[_0xc055('0x4d')],md5(_0x10642e['uniqueid']));}else{_0x10642e[_0xc055('0x4b')]='';}headers[_0xc055('0x4e')]=getAuth(_0x50922d);return getUser(_0x50922d)['then'](function(_0x5c39a0){_0x50a273=_0x5c39a0;logger['info']('The\x20User\x20ID\x20is:',_0x50a273['id']);return getEndUser(_0x50922d,_0x10642e[_0xc055('0x51')],_0x10642e[_0xc055('0x52')]);})['then'](function(_0x25beda){_0x3b4d3b=_0x25beda;logger[_0xc055('0xc')](_0xc055('0x53'),_0x3b4d3b['id']);return getTicket(_0x50922d,_0x50a273,_0x3b4d3b,_0x31f815,_0x10642e);})[_0xc055('0x16')](function(_0x246194){if(_0x246194){logger['info'](_0xc055('0x54'),_0x246194['id']);}})[_0xc055('0x5f')](function(_0x5731c3){logger[_0xc055('0x5e')]('['+_0x10642e[_0xc055('0x6c')][_0xc055('0x6d')]()+']'+_0xc055('0x6e'),util[_0xc055('0x6a')](_0x5731c3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index e6c0237..f9fa561 100644 --- a/server/services/ami/trigger/integration/zoho.js +++ b/server/services/ami/trigger/integration/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa742=['Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','connect','Call_Result','Answered','Rejected','Abandoned','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','log','err','host','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/api/voice/recordings/','com','destcalleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','unmanaged','toUpperCase','util','./util','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','email','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','/crm/v2/','startCase','role','first_name','last_name','data','code','SUCCESS','details','enduserType','moduleCreate','Error:\x20','Zoho-oauthtoken\x20','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Subject','getString','Subjects'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0xa742,0xc7));var _0x2a74=function(_0x450c7b,_0x4b7a6a){_0x450c7b=_0x450c7b-0x0;var _0x179fc5=_0xa742[_0x450c7b];return _0x179fc5;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x2a74('0x0'));var intUtil=require(_0x2a74('0x1'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x2a74('0x2'));var config=require('../../../../config/environment');var logger=require(_0x2a74('0x3'))(_0x2a74('0x4'));config[_0x2a74('0x5')]=_[_0x2a74('0x6')](config[_0x2a74('0x5')],{'host':_0x2a74('0x7'),'port':0x18eb});var io=require(_0x2a74('0x8'))(new Redis(config[_0x2a74('0x5')]));function emit(_0x20e347,_0x2ad653,_0x4d84d1){io['to'](_0x20e347)[_0x2a74('0x9')](_0x2ad653,_0x4d84d1);}function request(_0x5ca328){logger['debug'](_0x2a74('0xa'),JSON[_0x2a74('0xb')](_0x5ca328));return rp(_0x5ca328);}function getCustomFields(_0x17e2d0,_0x17b39b){var _0x5a9656={};if(_0x17e2d0[_0x2a74('0xc')]>0x0){_['forEach'](_0x17e2d0,function(_0x4f852f){if(_0x4f852f['type']==='string'&&_0x4f852f[_0x2a74('0xd')]){_0x5a9656[_0x4f852f['idField']]=_0x4f852f['content'][_0x2a74('0xe')]();}else if(_0x4f852f[_0x2a74('0xf')]===_0x2a74('0x10')&&_0x4f852f[_0x2a74('0x11')]&&_0x4f852f[_0x2a74('0xd')]&&_0x17b39b[_0x4f852f[_0x2a74('0x11')]]){_0x5a9656[_0x4f852f[_0x2a74('0xd')]]=_0x17b39b[_0x4f852f[_0x2a74('0x11')]][_0x2a74('0xe')]();}else if(_0x4f852f[_0x2a74('0xf')]===_0x2a74('0x12')&&_0x4f852f[_0x2a74('0x13')]&&_0x4f852f[_0x2a74('0x13')]['name']&&_0x4f852f[_0x2a74('0xd')]&&_0x17b39b[_0x4f852f['Variable'][_0x2a74('0x14')][_0x2a74('0x15')]()]){_0x5a9656[_0x4f852f[_0x2a74('0xd')]]=_0x17b39b[_0x4f852f[_0x2a74('0x13')][_0x2a74('0x14')][_0x2a74('0x15')]()][_0x2a74('0xe')]();}});}return _0x5a9656;}function getName(_0x4ce5b1){if(_0x4ce5b1['indexOf']('\x20')>0x0){var _0x3be33=_0x4ce5b1['split'](/ (.+)/);if(_0x3be33[0x1]){return _0x3be33;}}return[_0x4ce5b1,_0x4ce5b1];}var accountsTokens={};function getAccessToken(_0x21a859){return new Promise(function(_0x10b264,_0x2ac5ed){if(!_[_0x2a74('0x16')](accountsTokens[_0x21a859['id']])&&!_[_0x2a74('0x16')](accountsTokens[_0x21a859['id']][_0x2a74('0x17')])){if(moment()[_0x2a74('0x18')](accountsTokens[_0x21a859['id']][_0x2a74('0x19')])){_0x10b264(accountsTokens[_0x21a859['id']][_0x2a74('0x17')]);}}var _0x3c6bb2;switch(_0x21a859['zone']){case'US':_0x3c6bb2='https://accounts.zoho.com';break;case'AU':_0x3c6bb2=_0x2a74('0x1a');break;case'EU':_0x3c6bb2=_0x2a74('0x1b');break;case'IN':_0x3c6bb2=_0x2a74('0x1c');break;case'CN':_0x3c6bb2='https://accounts.zoho.com.cn';break;default:_0x3c6bb2='https://accounts.zoho.eu';break;}var _0x3367d8={'method':_0x2a74('0x1d'),'uri':_0x3c6bb2+_0x2a74('0x1e'),'qs':{'refresh_token':_0x21a859['refreshToken'],'client_id':_0x21a859[_0x2a74('0x1f')],'client_secret':_0x21a859[_0x2a74('0x20')],'grant_type':_0x2a74('0x21')},'json':!![]};return rp(_0x3367d8)[_0x2a74('0x22')](function(_0x2149e9){accountsTokens[_0x21a859['id']]={'access_token':_0x2149e9['access_token'],'expires_in':moment()['add'](_0x2149e9[_0x2a74('0x19')],_0x2a74('0x23'))};_0x10b264(_0x2149e9['access_token']);})[_0x2a74('0x24')](function(_0x86e836){logger[_0x2a74('0x25')](_0x2a74('0x26'),_0x86e836['stack']);_0x2ac5ed(_0x86e836);});});}function getUser(_0x221179,_0x191e15,_0x3087eb,_0x417039){logger[_0x2a74('0x27')](_0x2a74('0x28'));return request({'method':_0x2a74('0x29'),'uri':util[_0x2a74('0x2a')](_0x2a74('0x2b'),_0x191e15),'qs':{'type':_0x2a74('0x2c')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x221179},'json':!![]})[_0x2a74('0x22')](function(_0x206f90){if(_0x206f90[_0x2a74('0x2d')]){var _0x396106=-0x1;if(_['isArrayLikeObject'](_0x206f90['users'])){if(!_[_0x2a74('0x16')](_0x417039)){_0x396106=_['findIndex'](_0x206f90[_0x2a74('0x2d')],function(_0x5ca94d){return _0x5ca94d[_0x2a74('0x2e')]===_0x417039;});}if(_0x396106>=0x0){logger[_0x2a74('0x27')]('Agent\x20found!');}else{logger[_0x2a74('0x27')](_0x2a74('0x2f'));_0x396106=_[_0x2a74('0x30')](_0x206f90['users'],function(_0xd2e0c9){return _0xd2e0c9[_0x2a74('0x31')][_0x2a74('0x14')]===_0x2a74('0x32');});}return _0x206f90['users'][_0x396106];}else{if(_0x206f90['user'][_0x2a74('0x31')]['name']===_0x2a74('0x32')){logger['info'](_0x2a74('0x2f'));user=_0x206f90[_0x2a74('0x33')];return user;}else{logger[_0x2a74('0x25')](_0x2a74('0x34'),JSON[_0x2a74('0xb')](_0x206f90));throw new Error(_0x2a74('0x35')+JSON[_0x2a74('0xb')](_0x206f90));}}}else{logger['error'](_0x2a74('0x34'),JSON[_0x2a74('0xb')](_0x206f90));throw new Error(_0x2a74('0x35')+JSON['stringify'](_0x206f90));}})[_0x2a74('0x24')](function(_0x568c30){console[_0x2a74('0x25')](_0x568c30);});}function getZohoUser(_0x522df6,_0x47c41f){return new BPromise(function(_0x2cef59,_0x3fd012){request(_0x522df6)[_0x2a74('0x22')](function(_0x5f0faf){var _0x104c79=null;if(_0x5f0faf){_0x104c79=_0x5f0faf['data'][0x0];_0x104c79['enduserType']=_0x47c41f;}_0x2cef59(_0x104c79);})[_0x2a74('0x24')](function(_0x2d9735){_0x3fd012(_0x2d9735);});});}function createEndUser(_0x2ce582,_0x3cb69f,_0x41aca2,_0x595107,_0x16905c,_0x9b92d9){var _0x41aca2=getName(_0x41aca2);return request({'method':_0x2a74('0x1d'),'uri':'https://www.zohoapis.'+_0x3cb69f+_0x2a74('0x36')+_[_0x2a74('0x37')](_0x9b92d9['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x41aca2[0x1],'First_Name':_0x41aca2[0x0],'Phone':_0x595107,'Owner':{'name':!_[_0x2a74('0x16')](_0x16905c[_0x2a74('0x38')][_0x2a74('0x14')])?_0x16905c['role'][_0x2a74('0x14')]:!_[_0x2a74('0x16')](_0x16905c[_0x2a74('0x39')])?_0x16905c[_0x2a74('0x39')]+'\x20'+_0x16905c[_0x2a74('0x3a')]:_0x16905c['last_name'],'id':_0x16905c['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2ce582},'json':!![]})['then'](function(_0x220ff2){if(_0x220ff2&&_0x220ff2[_0x2a74('0x3b')][0x0][_0x2a74('0x3c')]===_0x2a74('0x3d')){var _0x1c95a3=_0x220ff2[_0x2a74('0x3b')][0x0][_0x2a74('0x3e')];_0x1c95a3[_0x2a74('0x3f')]=_['startCase'](_0x9b92d9[_0x2a74('0x40')])+'s';return _0x1c95a3;}logger[_0x2a74('0x25')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x2a74('0x41')+JSON[_0x2a74('0xb')](data));})[_0x2a74('0x24')](function(_0x493ef7){console['log']('CREATE\x20ERROR',_0x493ef7);});}function getEndUser(_0x40e5e1,_0x5a84c2,_0x35ac6d,_0x3ddc78,_0x45782c,_0x5a21e1,_0x346f0d){var _0x504f12={'method':_0x2a74('0x29'),'uri':'','headers':{'Authorization':_0x2a74('0x42')+_0x40e5e1},'json':!![]};switch(_0x346f0d['moduleSearch']){case'contact_lead':_0x504f12['uri']=_0x2a74('0x43')+_0x5a84c2+_0x2a74('0x44')+_0x45782c+'))';return getZohoUser(_0x504f12,_0x2a74('0x45'))[_0x2a74('0x22')](function(_0x34d37c){if(_0x34d37c)return _0x34d37c;_0x504f12[_0x2a74('0x46')]='https://www.zohoapis.'+_0x5a84c2+_0x2a74('0x47')+_0x45782c+'))';return getZohoUser(_0x504f12,'Leads')[_0x2a74('0x22')](function(_0xb2468b){if(_0xb2468b)return _0xb2468b;if(_0x346f0d[_0x2a74('0x40')]!='nothing'){return createEndUser(_0x40e5e1,_0x5a84c2,_0x3ddc78,_0x45782c,_0x5a21e1,_0x346f0d);}else{return{};}});});break;case'contact':_0x504f12['uri']=_0x2a74('0x43')+_0x5a84c2+_0x2a74('0x44')+_0x45782c+'))';return getZohoUser(_0x504f12,_0x2a74('0x45'))[_0x2a74('0x22')](function(_0x534a35){if(_0x534a35)return _0x534a35;if(_0x346f0d[_0x2a74('0x40')]!='nothing'){return createEndUser(_0x40e5e1,_0x5a84c2,_0x3ddc78,_0x45782c,_0x5a21e1,_0x346f0d);}else{return{};}});break;case _0x2a74('0x48'):_0x504f12[_0x2a74('0x46')]=_0x2a74('0x43')+_0x5a84c2+_0x2a74('0x47')+_0x45782c+'))';return getZohoUser(_0x504f12,'Leads')[_0x2a74('0x22')](function(_0x2dbfa6){if(_0x2dbfa6)return _0x2dbfa6;if(_0x346f0d[_0x2a74('0x40')]!='nothing'){return createEndUser(_0x40e5e1,_0x5a84c2,_0x3ddc78,_0x45782c,_0x5a21e1,_0x346f0d);}else{return{};}});break;}}function getCall(_0x1499fb,_0x5e2f72,_0x2da443,_0xab593,_0x9898a0,_0x491565,_0xa69d2b,_0x5d3453){logger[_0x2a74('0x27')](_0x2a74('0x49'));var _0x1fa304={};_0x1fa304['Owner']={'name':!_[_0x2a74('0x16')](_0xab593[_0x2a74('0x38')]['name'])&&!_[_0x2a74('0x16')](_0xab593[_0x2a74('0x31')][_0x2a74('0x14')])&&_0xab593['profile'][_0x2a74('0x14')]==='administrator'?_0xab593[_0x2a74('0x38')][_0x2a74('0x14')]:!_[_0x2a74('0x16')](_0xab593[_0x2a74('0x39')])?_0xab593[_0x2a74('0x39')]+'\x20'+_0xab593['last_name']:_0xab593[_0x2a74('0x3a')],'id':_0xab593['id']};_0x1fa304[_0x2a74('0x4a')]=intUtil[_0x2a74('0x4b')](_0x491565[_0x2a74('0x4c')],_0xa69d2b,'\x20');_0x1fa304['Description']=intUtil[_0x2a74('0x4b')](_0x491565['Descriptions'],_0xa69d2b,'\x0a');if(_0x9898a0[_0x2a74('0x3f')]==='Contacts'){_0x1fa304[_0x2a74('0x4d')]={'name':!_[_0x2a74('0x16')](_0x9898a0[_0x2a74('0x4e')])?_0x9898a0['Full_Name']:!_[_0x2a74('0x16')](_0x9898a0[_0x2a74('0x4f')])?_0x9898a0[_0x2a74('0x4f')]+'\x20'+_0x9898a0[_0x2a74('0x50')]:_0x9898a0[_0x2a74('0x50')],'id':_0x9898a0['id']};}if(_0x9898a0[_0x2a74('0x3f')]===_0x2a74('0x51')){_0x1fa304[_0x2a74('0x52')]={'name':!_[_0x2a74('0x16')](_0x9898a0[_0x2a74('0x4e')])?_0x9898a0['Full_Name']:!_[_0x2a74('0x16')](_0x9898a0[_0x2a74('0x4f')])?_0x9898a0[_0x2a74('0x4f')]+'\x20'+_0x9898a0[_0x2a74('0x50')]:_0x9898a0[_0x2a74('0x50')],'id':_0x9898a0['id']};_0x1fa304['$se_module']=_[_0x2a74('0x37')](_0x9898a0['enduserType']);}if(_0xa69d2b[_0x2a74('0x53')]){_0x1fa304[_0x2a74('0x54')]=moment[_0x2a74('0x55')](parseInt(_0xa69d2b[_0x2a74('0x53')])*0x3e8)[_0x2a74('0x2a')](_0x2a74('0x56'));}else if(_0xa69d2b[_0x2a74('0x57')]&&_0xa69d2b[_0x2a74('0x58')]){_0x1fa304[_0x2a74('0x54')]=moment['utc'](moment(_0xa69d2b[_0x2a74('0x58')],'YYYY-MM-DDTHH:mm:ss')[_0x2a74('0x59')](moment(_0xa69d2b[_0x2a74('0x5a')],_0x2a74('0x5b'))))['format'](_0x2a74('0x56'));}switch(_0xa69d2b[_0x2a74('0x5c')]){case _0x2a74('0x5d'):_0x1fa304['Call_Result']=_0x2a74('0x5e');break;case _0x2a74('0x5f'):case _0x2a74('0x60'):_0x1fa304[_0x2a74('0x61')]=_0x2a74('0x62');break;case'rejected':_0x1fa304[_0x2a74('0x61')]=_0x2a74('0x63');break;case'abandoned':_0x1fa304['Call_Result']=_0x2a74('0x64');break;case'timeout':_0x1fa304['Call_Result']='Timeout';default:}_0x1fa304[_0x2a74('0x65')]=(_0x5d3453===_0x2a74('0x66')?moment(_0xa69d2b[_0x2a74('0x5a')])[_0x2a74('0x2a')](_0x2a74('0x5b')):moment(_0xa69d2b[_0x2a74('0x67')])['format'](_0x2a74('0x5b')))||moment()[_0x2a74('0x2a')](_0x2a74('0x5b'));_0x1fa304[_0x2a74('0x68')]=_0x5d3453||_0x2a74('0x69');_0x1fa304=_[_0x2a74('0x6a')](_0x1fa304,getCustomFields(_0x491565[_0x2a74('0x6b')],_0xa69d2b));return request({'method':'POST','uri':_0x2a74('0x43')+_0x5e2f72+_0x2a74('0x6c'),'headers':{'Authorization':_0x2a74('0x42')+_0x1499fb},'body':{'data':[_0x1fa304]},'json':!![]})[_0x2a74('0x22')](function(_0x4b9f6b){if(_0x4b9f6b&&_0x4b9f6b[_0x2a74('0x3b')][0x0][_0x2a74('0x3c')]===_0x2a74('0x3d')){logger['info'](_0x2a74('0x6d'));return{'id':_0x4b9f6b[_0x2a74('0x3b')][0x0][_0x2a74('0x3e')]['id']};}})[_0x2a74('0x24')](function(_0x588829){logger[_0x2a74('0x27')]('err',_0x588829['stack']);console[_0x2a74('0x6e')](_0x2a74('0x6f'),_0x588829);});}exports['queue']=function(_0x59596c,_0x14427f,_0x511e18,_0x43ef13,_0x1feb01,_0x599b6f){var _0xd84c27,_0x3590d2,_0x2b9179;_0x599b6f[_0x2a74('0x70')]=intUtil['stripTrailingSlash'](_0x599b6f[_0x2a74('0x70')]);_0x599b6f[_0x2a74('0x71')]=intUtil[_0x2a74('0x72')](_0x599b6f[_0x2a74('0x71')]);if(_0x1feb01&&_0x1feb01['monitor_format']){logger[_0x2a74('0x27')](_0x2a74('0x73'),_0x2a74('0x74'));_0x14427f[_0x2a74('0x75')]=_0x599b6f['serverUrl']+'/api/voice/recordings/'+_0x14427f['uniqueid']+_0x2a74('0x76')+md5(_0x14427f[_0x2a74('0x77')]);}else{_0x14427f[_0x2a74('0x75')]='';}var _0x3ca9ae=_0x599b6f['host']===_0x2a74('0x78')?'eu':'com';return getAccessToken(_0x599b6f)['then'](function(_0x505ec3){_0x2b9179=_0x505ec3;return getUser(_0x2b9179,_0x3ca9ae,_0x599b6f,_0x43ef13['email']);})[_0x2a74('0x22')](function(_0x2ec230){_0xd84c27=_0x2ec230;logger[_0x2a74('0x27')](_0x2a74('0x79'),_0xd84c27['id']);return getEndUser(_0x2b9179,_0x3ca9ae,_0x599b6f,_0x14427f[_0x2a74('0x7a')],_0x14427f[_0x2a74('0x7b')],_0xd84c27,_0x511e18);})['then'](function(_0x216cbd){_0x3590d2=_0x216cbd;return getCall(_0x2b9179,_0x3ca9ae,_0x599b6f,_0xd84c27,_0x3590d2,_0x511e18,_0x14427f,_0x2a74('0x69'));})[_0x2a74('0x22')](function(_0x433fd2){if(_0x433fd2){logger[_0x2a74('0x27')]('The\x20Call\x20ID\x20is:',_0x433fd2['id']);logger['info'](_0x2a74('0x73'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2a74('0x2a')](_0x2a74('0x7c'),_0x43ef13[_0x2a74('0x14')]),_0x2a74('0x7d'),{'uri':_0x2a74('0x7e')+_0x599b6f[_0x2a74('0x70')]+_0x2a74('0x7f')+_0x433fd2['id']});}})[_0x2a74('0x24')](function(_0x417b08){logger['error'](_0x2a74('0x73'),JSON[_0x2a74('0xb')](_0x417b08));});};exports[_0x2a74('0x66')]=function(_0x59497f,_0x202d16,_0x3efa32,_0x1eed53,_0x54d654,_0x24f4a3,_0x1f33cf){var _0x59d1d0,_0x4b706d,_0x53b638;_0x24f4a3['host']=intUtil[_0x2a74('0x72')](_0x24f4a3[_0x2a74('0x70')]);_0x24f4a3['serverUrl']=intUtil[_0x2a74('0x72')](_0x24f4a3[_0x2a74('0x71')]);if(_0x1f33cf&&_0x1f33cf[_0x2a74('0x80')]&&_0x1f33cf['recordingFormat']!==_0x2a74('0x81')){logger[_0x2a74('0x27')]('[OUTBOUND]',_0x2a74('0x74'));_0x202d16[_0x2a74('0x75')]=_0x24f4a3[_0x2a74('0x71')]+_0x2a74('0x82')+_0x202d16[_0x2a74('0x77')]+_0x2a74('0x76')+md5(_0x202d16[_0x2a74('0x77')]);}var _0x4fd55f=_0x24f4a3[_0x2a74('0x70')]===_0x2a74('0x78')?'eu':_0x2a74('0x83');return getAccessToken(_0x24f4a3)[_0x2a74('0x22')](function(_0x58b1d5){_0x53b638=_0x58b1d5;return getUser(_0x53b638,_0x4fd55f,_0x24f4a3,_0x1eed53[_0x2a74('0x2e')]);})['then'](function(_0x512768){_0x59d1d0=_0x512768;logger['info']('The\x20User\x20ID\x20is:',_0x59d1d0['id']);return getEndUser(_0x53b638,_0x4fd55f,_0x24f4a3,_0x202d16['destcalleridname'],_0x202d16[_0x2a74('0x84')],_0x59d1d0,_0x3efa32);})[_0x2a74('0x22')](function(_0x3537c9){_0x4b706d=_0x3537c9;return getCall(_0x53b638,_0x4fd55f,_0x24f4a3,_0x59d1d0,_0x4b706d,_0x3efa32,_0x202d16,'Outbound');})[_0x2a74('0x22')](function(_0x509315){if(_0x509315){logger['info'](_0x2a74('0x85'),_0x509315['id']);logger[_0x2a74('0x27')]('[OUTBOUND]',_0x2a74('0x86'));emit(util['format']('user:%s',_0x1eed53[_0x2a74('0x14')]),_0x2a74('0x7d'),{'uri':_0x2a74('0x7e')+_0x24f4a3['host']+_0x2a74('0x7f')+_0x509315['id']});}})[_0x2a74('0x24')](function(_0x1a4dfc){logger['error'](_0x2a74('0x87'),JSON[_0x2a74('0xb')](_0x1a4dfc));});};exports[_0x2a74('0x88')]=function(_0x58aaf6,_0x107975,_0x16345a,_0x305948,_0x3f3490,_0x2b73a5){var _0x27f18b,_0x2934fa,_0x1a0af6;_0x2b73a5['host']=intUtil['stripTrailingSlash'](_0x2b73a5[_0x2a74('0x70')]);_0x2b73a5['serverUrl']=intUtil['stripTrailingSlash'](_0x2b73a5[_0x2a74('0x71')]);if(_0x3f3490&&_0x3f3490['monitor_format']){logger[_0x2a74('0x27')]('['+_0x107975[_0x2a74('0x5c')][_0x2a74('0x89')]()+']',_0x2a74('0x74'));_0x107975[_0x2a74('0x75')]=_0x2b73a5['serverUrl']+_0x2a74('0x82')+_0x107975[_0x2a74('0x77')]+_0x2a74('0x76')+md5(_0x107975[_0x2a74('0x77')]);}else{_0x107975['recordingURL']='';}var _0x3503b4=_0x2b73a5[_0x2a74('0x70')]===_0x2a74('0x78')?'eu':_0x2a74('0x83');return getAccessToken(_0x2b73a5)['then'](function(_0x144343){_0x1a0af6=_0x144343;return getUser(_0x1a0af6,_0x3503b4,_0x2b73a5);})['then'](function(_0x283bd6){_0x27f18b=_0x283bd6;logger[_0x2a74('0x27')]('The\x20User\x20ID\x20is:',_0x27f18b['id']);return getEndUser(_0x1a0af6,_0x3503b4,_0x2b73a5,_0x107975[_0x2a74('0x7a')],_0x107975[_0x2a74('0x7b')],_0x27f18b,_0x16345a);})[_0x2a74('0x22')](function(_0x5c6d14){_0x2934fa=_0x5c6d14;return getCall(_0x1a0af6,_0x3503b4,_0x2b73a5,_0x27f18b,_0x2934fa,_0x16345a,_0x107975,_0x2a74('0x69'));})[_0x2a74('0x22')](function(_0x4eb9ed){if(_0x4eb9ed){logger[_0x2a74('0x27')](_0x2a74('0x85'),_0x4eb9ed['id']);}})['catch'](function(_0x1604e7){logger[_0x2a74('0x25')]('['+_0x107975[_0x2a74('0x5c')][_0x2a74('0x89')]()+']',JSON[_0x2a74('0xb')](_0x1604e7));});}; \ No newline at end of file +var _0xbbce=['/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','com','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','user:%s','unmanaged','toUpperCase','calleridname','lodash','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','localhost','emit','debug','stringify','length','type','string','idField','content','variableName','Variable','name','toString','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Owner','administrator','Subject','getString','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','mm:ss','answertime','utc','endtime','starttime','format','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','Fields'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xbbce,0xb0));var _0xebbc=function(_0x1240ee,_0x50fdf8){_0x1240ee=_0x1240ee-0x0;var _0x9ebe4e=_0xbbce[_0x1240ee];return _0x9ebe4e;};'use strict';var _=require(_0xebbc('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xebbc('0x1'));var intUtil=require(_0xebbc('0x2'));var moment=require(_0xebbc('0x3'));var Redis=require(_0xebbc('0x4'));var BPromise=require(_0xebbc('0x5'));var config=require(_0xebbc('0x6'));var logger=require('../../../../config/logger')(_0xebbc('0x7'));config['redis']=_['defaults'](config[_0xebbc('0x8')],{'host':_0xebbc('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xebbc('0x8')]));function emit(_0x2c5e72,_0x4bc47b,_0x355c54){io['to'](_0x2c5e72)[_0xebbc('0xa')](_0x4bc47b,_0x355c54);}function request(_0x6a9ee9){logger[_0xebbc('0xb')]('[HTTP]',JSON[_0xebbc('0xc')](_0x6a9ee9));return rp(_0x6a9ee9);}function getCustomFields(_0x290b6f,_0x58fe71){var _0x3427aa={};if(_0x290b6f[_0xebbc('0xd')]>0x0){_['forEach'](_0x290b6f,function(_0x5c5763){if(_0x5c5763[_0xebbc('0xe')]===_0xebbc('0xf')&&_0x5c5763[_0xebbc('0x10')]){_0x3427aa[_0x5c5763[_0xebbc('0x10')]]=_0x5c5763[_0xebbc('0x11')]['toString']();}else if(_0x5c5763[_0xebbc('0xe')]==='variable'&&_0x5c5763[_0xebbc('0x12')]&&_0x5c5763[_0xebbc('0x10')]&&_0x58fe71[_0x5c5763[_0xebbc('0x12')]]){_0x3427aa[_0x5c5763[_0xebbc('0x10')]]=_0x58fe71[_0x5c5763[_0xebbc('0x12')]]['toString']();}else if(_0x5c5763[_0xebbc('0xe')]==='customVariable'&&_0x5c5763[_0xebbc('0x13')]&&_0x5c5763[_0xebbc('0x13')]['name']&&_0x5c5763[_0xebbc('0x10')]&&_0x58fe71[_0x5c5763['Variable'][_0xebbc('0x14')]['toLowerCase']()]){_0x3427aa[_0x5c5763[_0xebbc('0x10')]]=_0x58fe71[_0x5c5763[_0xebbc('0x13')][_0xebbc('0x14')]['toLowerCase']()][_0xebbc('0x15')]();}});}return _0x3427aa;}function getName(_0x311aa2){if(_0x311aa2[_0xebbc('0x16')]('\x20')>0x0){var _0x26d227=_0x311aa2['split'](/ (.+)/);if(_0x26d227[0x1]){return _0x26d227;}}return[_0x311aa2,_0x311aa2];}var accountsTokens={};function getAccessToken(_0x3bb1ae){return new Promise(function(_0x254599,_0x2c1843){if(!_[_0xebbc('0x17')](accountsTokens[_0x3bb1ae['id']])&&!_[_0xebbc('0x17')](accountsTokens[_0x3bb1ae['id']][_0xebbc('0x18')])){if(moment()['isBefore'](accountsTokens[_0x3bb1ae['id']][_0xebbc('0x19')])){_0x254599(accountsTokens[_0x3bb1ae['id']]['access_token']);}}var _0x226766;switch(_0x3bb1ae[_0xebbc('0x1a')]){case'US':_0x226766=_0xebbc('0x1b');break;case'AU':_0x226766=_0xebbc('0x1c');break;case'EU':_0x226766=_0xebbc('0x1d');break;case'IN':_0x226766='https://accounts.zoho.in';break;case'CN':_0x226766='https://accounts.zoho.com.cn';break;default:_0x226766=_0xebbc('0x1d');break;}var _0x4f0552={'method':_0xebbc('0x1e'),'uri':_0x226766+_0xebbc('0x1f'),'qs':{'refresh_token':_0x3bb1ae[_0xebbc('0x20')],'client_id':_0x3bb1ae[_0xebbc('0x21')],'client_secret':_0x3bb1ae[_0xebbc('0x22')],'grant_type':_0xebbc('0x23')},'json':!![]};return rp(_0x4f0552)[_0xebbc('0x24')](function(_0x10f122){accountsTokens[_0x3bb1ae['id']]={'access_token':_0x10f122[_0xebbc('0x18')],'expires_in':moment()['add'](_0x10f122[_0xebbc('0x19')],_0xebbc('0x25'))};_0x254599(_0x10f122[_0xebbc('0x18')]);})[_0xebbc('0x26')](function(_0x507bfd){logger['error']('Failing\x20creating\x20the\x20access_token',_0x507bfd[_0xebbc('0x27')]);_0x2c1843(_0x507bfd);});});}function getUser(_0x46b9b5,_0x1c2740,_0x4bdd30,_0x3f6049){logger[_0xebbc('0x28')](_0xebbc('0x29'));return request({'method':_0xebbc('0x2a'),'uri':util['format'](_0xebbc('0x2b'),_0x1c2740),'qs':{'type':_0xebbc('0x2c')},'headers':{'Authorization':_0xebbc('0x2d')+_0x46b9b5},'json':!![]})['then'](function(_0xacc0ea){if(_0xacc0ea[_0xebbc('0x2e')]){var _0x193c7f=-0x1;if(_['isArrayLikeObject'](_0xacc0ea[_0xebbc('0x2e')])){if(!_[_0xebbc('0x17')](_0x3f6049)){_0x193c7f=_[_0xebbc('0x2f')](_0xacc0ea[_0xebbc('0x2e')],function(_0x18f293){return _0x18f293[_0xebbc('0x30')]===_0x3f6049;});}if(_0x193c7f>=0x0){logger[_0xebbc('0x28')](_0xebbc('0x31'));}else{logger[_0xebbc('0x28')](_0xebbc('0x32'));_0x193c7f=_['findIndex'](_0xacc0ea[_0xebbc('0x2e')],function(_0x1509cd){return _0x1509cd[_0xebbc('0x33')][_0xebbc('0x14')]===_0xebbc('0x34');});}return _0xacc0ea[_0xebbc('0x2e')][_0x193c7f];}else{if(_0xacc0ea['user']['profile'][_0xebbc('0x14')]==='Administrator'){logger['info']('Using\x20the\x20admin\x20account!');user=_0xacc0ea[_0xebbc('0x35')];return user;}else{logger[_0xebbc('0x36')](_0xebbc('0x37'),JSON['stringify'](_0xacc0ea));throw new Error(_0xebbc('0x38')+JSON[_0xebbc('0xc')](_0xacc0ea));}}}else{logger[_0xebbc('0x36')]('The\x20failing\x20result\x20is',JSON[_0xebbc('0xc')](_0xacc0ea));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0xacc0ea));}})[_0xebbc('0x26')](function(_0x4f138c){console[_0xebbc('0x36')](_0x4f138c);});}function getZohoUser(_0x985455,_0x1d2015){return new BPromise(function(_0xf79530,_0x1cb4d8){request(_0x985455)[_0xebbc('0x24')](function(_0x4e44ac){var _0x4054c0=null;if(_0x4e44ac){_0x4054c0=_0x4e44ac[_0xebbc('0x39')][0x0];_0x4054c0['enduserType']=_0x1d2015;}_0xf79530(_0x4054c0);})['catch'](function(_0x1de654){_0x1cb4d8(_0x1de654);});});}function createEndUser(_0x5bd92d,_0x327cbb,_0x5f497d,_0x553f4e,_0x11c46b,_0x29b065){var _0x5f497d=getName(_0x5f497d);return request({'method':_0xebbc('0x1e'),'uri':_0xebbc('0x3a')+_0x327cbb+_0xebbc('0x3b')+_[_0xebbc('0x3c')](_0x29b065['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5f497d[0x1],'First_Name':_0x5f497d[0x0],'Phone':_0x553f4e,'Owner':{'name':!_[_0xebbc('0x17')](_0x11c46b[_0xebbc('0x3d')][_0xebbc('0x14')])?_0x11c46b[_0xebbc('0x3d')][_0xebbc('0x14')]:!_[_0xebbc('0x17')](_0x11c46b['first_name'])?_0x11c46b[_0xebbc('0x3e')]+'\x20'+_0x11c46b[_0xebbc('0x3f')]:_0x11c46b[_0xebbc('0x3f')],'id':_0x11c46b['id']}}]},'headers':{'Authorization':_0xebbc('0x2d')+_0x5bd92d},'json':!![]})[_0xebbc('0x24')](function(_0x33d692){if(_0x33d692&&_0x33d692[_0xebbc('0x39')][0x0][_0xebbc('0x40')]===_0xebbc('0x41')){var _0x2ebb66=_0x33d692[_0xebbc('0x39')][0x0][_0xebbc('0x42')];_0x2ebb66[_0xebbc('0x43')]=_[_0xebbc('0x3c')](_0x29b065[_0xebbc('0x44')])+'s';return _0x2ebb66;}logger[_0xebbc('0x36')]('The\x20failing\x20result\x20is',JSON[_0xebbc('0xc')](data));throw new Error(_0xebbc('0x45')+JSON[_0xebbc('0xc')](data));})[_0xebbc('0x26')](function(_0x4440e6){console[_0xebbc('0x46')](_0xebbc('0x47'),_0x4440e6);});}function getEndUser(_0x5973de,_0x388956,_0x59de00,_0x4ef959,_0x3612ac,_0x282734,_0xcca842){var _0x49fe77={'method':_0xebbc('0x2a'),'uri':'','headers':{'Authorization':_0xebbc('0x2d')+_0x5973de},'json':!![]};switch(_0xcca842['moduleSearch']){case'contact_lead':_0x49fe77[_0xebbc('0x48')]='https://www.zohoapis.'+_0x388956+_0xebbc('0x49')+_0x3612ac+'))';return getZohoUser(_0x49fe77,_0xebbc('0x4a'))[_0xebbc('0x24')](function(_0x2836f9){if(_0x2836f9)return _0x2836f9;_0x49fe77[_0xebbc('0x48')]=_0xebbc('0x3a')+_0x388956+_0xebbc('0x4b')+_0x3612ac+'))';return getZohoUser(_0x49fe77,_0xebbc('0x4c'))['then'](function(_0x324a7d){if(_0x324a7d)return _0x324a7d;if(_0xcca842[_0xebbc('0x44')]!='nothing'){return createEndUser(_0x5973de,_0x388956,_0x4ef959,_0x3612ac,_0x282734,_0xcca842);}else{return{};}});});break;case _0xebbc('0x4d'):_0x49fe77[_0xebbc('0x48')]=_0xebbc('0x3a')+_0x388956+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3612ac+'))';return getZohoUser(_0x49fe77,'Contacts')[_0xebbc('0x24')](function(_0x340a4e){if(_0x340a4e)return _0x340a4e;if(_0xcca842[_0xebbc('0x44')]!=_0xebbc('0x4e')){return createEndUser(_0x5973de,_0x388956,_0x4ef959,_0x3612ac,_0x282734,_0xcca842);}else{return{};}});break;case _0xebbc('0x4f'):_0x49fe77['uri']=_0xebbc('0x3a')+_0x388956+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3612ac+'))';return getZohoUser(_0x49fe77,'Leads')[_0xebbc('0x24')](function(_0x54467a){if(_0x54467a)return _0x54467a;if(_0xcca842[_0xebbc('0x44')]!='nothing'){return createEndUser(_0x5973de,_0x388956,_0x4ef959,_0x3612ac,_0x282734,_0xcca842);}else{return{};}});break;}}function getCall(_0x2bfe51,_0x499300,_0x1c4286,_0x15ba57,_0x1be6f8,_0x579ebc,_0x49e1eb,_0x28aa2d){logger['info']('Creating\x20new\x20call...');var _0x44ae84={};_0x44ae84[_0xebbc('0x50')]={'name':!_[_0xebbc('0x17')](_0x15ba57[_0xebbc('0x3d')][_0xebbc('0x14')])&&!_['isNil'](_0x15ba57['profile'][_0xebbc('0x14')])&&_0x15ba57[_0xebbc('0x33')]['name']===_0xebbc('0x51')?_0x15ba57[_0xebbc('0x3d')][_0xebbc('0x14')]:!_['isNil'](_0x15ba57[_0xebbc('0x3e')])?_0x15ba57[_0xebbc('0x3e')]+'\x20'+_0x15ba57[_0xebbc('0x3f')]:_0x15ba57[_0xebbc('0x3f')],'id':_0x15ba57['id']};_0x44ae84[_0xebbc('0x52')]=intUtil['getString'](_0x579ebc['Subjects'],_0x49e1eb,'\x20');_0x44ae84['Description']=intUtil[_0xebbc('0x53')](_0x579ebc['Descriptions'],_0x49e1eb,'\x0a');if(_0x1be6f8[_0xebbc('0x43')]==='Contacts'){_0x44ae84['Who_Id']={'name':!_[_0xebbc('0x17')](_0x1be6f8[_0xebbc('0x54')])?_0x1be6f8[_0xebbc('0x54')]:!_['isNil'](_0x1be6f8['First_Name'])?_0x1be6f8[_0xebbc('0x55')]+'\x20'+_0x1be6f8[_0xebbc('0x56')]:_0x1be6f8[_0xebbc('0x56')],'id':_0x1be6f8['id']};}if(_0x1be6f8['enduserType']===_0xebbc('0x4c')){_0x44ae84[_0xebbc('0x57')]={'name':!_[_0xebbc('0x17')](_0x1be6f8['Full_Name'])?_0x1be6f8['Full_Name']:!_['isNil'](_0x1be6f8['First_Name'])?_0x1be6f8[_0xebbc('0x55')]+'\x20'+_0x1be6f8[_0xebbc('0x56')]:_0x1be6f8[_0xebbc('0x56')],'id':_0x1be6f8['id']};_0x44ae84['$se_module']=_[_0xebbc('0x3c')](_0x1be6f8[_0xebbc('0x43')]);}if(_0x49e1eb[_0xebbc('0x58')]){_0x44ae84[_0xebbc('0x59')]=moment['utc'](parseInt(_0x49e1eb[_0xebbc('0x58')])*0x3e8)['format'](_0xebbc('0x5a'));}else if(_0x49e1eb[_0xebbc('0x5b')]&&_0x49e1eb['endtime']){_0x44ae84[_0xebbc('0x59')]=moment[_0xebbc('0x5c')](moment(_0x49e1eb[_0xebbc('0x5d')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x49e1eb[_0xebbc('0x5e')],'YYYY-MM-DDTHH:mm:ss')))[_0xebbc('0x5f')](_0xebbc('0x5a'));}switch(_0x49e1eb[_0xebbc('0x60')]){case _0xebbc('0x61'):_0x44ae84[_0xebbc('0x62')]=_0xebbc('0x63');break;case _0xebbc('0x64'):case _0xebbc('0x65'):_0x44ae84[_0xebbc('0x62')]=_0xebbc('0x66');break;case _0xebbc('0x67'):_0x44ae84['Call_Result']=_0xebbc('0x68');break;case _0xebbc('0x69'):_0x44ae84['Call_Result']=_0xebbc('0x6a');break;case _0xebbc('0x6b'):_0x44ae84[_0xebbc('0x62')]='Timeout';default:}_0x44ae84['Call_Start_Time']=(_0x28aa2d===_0xebbc('0x6c')?moment(_0x49e1eb[_0xebbc('0x5e')])[_0xebbc('0x5f')](_0xebbc('0x6d')):moment(_0x49e1eb[_0xebbc('0x6e')])[_0xebbc('0x5f')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xebbc('0x6d'));_0x44ae84[_0xebbc('0x6f')]=_0x28aa2d||_0xebbc('0x70');_0x44ae84=_['merge'](_0x44ae84,getCustomFields(_0x579ebc[_0xebbc('0x71')],_0x49e1eb));return request({'method':_0xebbc('0x1e'),'uri':_0xebbc('0x3a')+_0x499300+_0xebbc('0x72'),'headers':{'Authorization':_0xebbc('0x2d')+_0x2bfe51},'body':{'data':[_0x44ae84]},'json':!![]})[_0xebbc('0x24')](function(_0x5a2438){if(_0x5a2438&&_0x5a2438[_0xebbc('0x39')][0x0]['code']==='SUCCESS'){logger[_0xebbc('0x28')](_0xebbc('0x73'));return{'id':_0x5a2438['data'][0x0]['details']['id']};}})[_0xebbc('0x26')](function(_0x22e551){logger[_0xebbc('0x28')](_0xebbc('0x74'),_0x22e551['stack']);console[_0xebbc('0x46')](_0xebbc('0x74'),_0x22e551);});}exports[_0xebbc('0x75')]=function(_0x5dfd0d,_0x1c8dce,_0x56c7f1,_0x37fae3,_0x36e704,_0x3e9554){var _0x431395,_0x1fc55b,_0x4d1008;_0x3e9554[_0xebbc('0x76')]=intUtil[_0xebbc('0x77')](_0x3e9554['host']);_0x3e9554[_0xebbc('0x78')]=intUtil[_0xebbc('0x77')](_0x3e9554[_0xebbc('0x78')]);if(_0x36e704&&_0x36e704[_0xebbc('0x79')]){logger[_0xebbc('0x28')](_0xebbc('0x7a'),'Recording\x20is\x20enabled!');_0x1c8dce[_0xebbc('0x7b')]=_0x3e9554[_0xebbc('0x78')]+_0xebbc('0x7c')+_0x1c8dce[_0xebbc('0x7d')]+_0xebbc('0x7e')+md5(_0x1c8dce[_0xebbc('0x7d')]);}else{_0x1c8dce[_0xebbc('0x7b')]='';}var _0x201e57=_0x3e9554[_0xebbc('0x76')]===_0xebbc('0x7f')?'eu':'com';return getAccessToken(_0x3e9554)[_0xebbc('0x24')](function(_0x24508d){_0x4d1008=_0x24508d;return getUser(_0x4d1008,_0x201e57,_0x3e9554,_0x37fae3[_0xebbc('0x30')]);})[_0xebbc('0x24')](function(_0xc2f4f3){_0x431395=_0xc2f4f3;logger[_0xebbc('0x28')](_0xebbc('0x80'),_0x431395['id']);return getEndUser(_0x4d1008,_0x201e57,_0x3e9554,_0x1c8dce['calleridname'],_0x1c8dce[_0xebbc('0x81')],_0x431395,_0x56c7f1);})['then'](function(_0x3c733e){_0x1fc55b=_0x3c733e;return getCall(_0x4d1008,_0x201e57,_0x3e9554,_0x431395,_0x1fc55b,_0x56c7f1,_0x1c8dce,_0xebbc('0x70'));})['then'](function(_0x4cbb0c){if(_0x4cbb0c){logger[_0xebbc('0x28')]('The\x20Call\x20ID\x20is:',_0x4cbb0c['id']);logger[_0xebbc('0x28')](_0xebbc('0x7a'),_0xebbc('0x82'));emit(util['format']('user:%s',_0x37fae3[_0xebbc('0x14')]),'trigger:browser:url',{'uri':_0xebbc('0x83')+_0x3e9554['host']+_0xebbc('0x84')+_0x4cbb0c['id']});}})[_0xebbc('0x26')](function(_0x4be4bb){logger[_0xebbc('0x36')](_0xebbc('0x7a'),JSON[_0xebbc('0xc')](_0x4be4bb));});};exports[_0xebbc('0x6c')]=function(_0x453c60,_0x4f989a,_0x54063b,_0x32e328,_0xd84dc3,_0x26674f,_0x12e0e7){var _0xa24fa1,_0x118e58,_0x476a9d;_0x26674f[_0xebbc('0x76')]=intUtil[_0xebbc('0x77')](_0x26674f[_0xebbc('0x76')]);_0x26674f[_0xebbc('0x78')]=intUtil[_0xebbc('0x77')](_0x26674f[_0xebbc('0x78')]);if(_0x12e0e7&&_0x12e0e7[_0xebbc('0x85')]&&_0x12e0e7[_0xebbc('0x85')]!==_0xebbc('0x86')){logger['info'](_0xebbc('0x87'),_0xebbc('0x88'));_0x4f989a[_0xebbc('0x7b')]=_0x26674f[_0xebbc('0x78')]+'/api/voice/recordings/'+_0x4f989a[_0xebbc('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x4f989a[_0xebbc('0x7d')]);}var _0x2f3298=_0x26674f[_0xebbc('0x76')]===_0xebbc('0x7f')?'eu':_0xebbc('0x89');return getAccessToken(_0x26674f)[_0xebbc('0x24')](function(_0x4d8f21){_0x476a9d=_0x4d8f21;return getUser(_0x476a9d,_0x2f3298,_0x26674f,_0x32e328[_0xebbc('0x30')]);})['then'](function(_0x44b8d6){_0xa24fa1=_0x44b8d6;logger['info']('The\x20User\x20ID\x20is:',_0xa24fa1['id']);return getEndUser(_0x476a9d,_0x2f3298,_0x26674f,_0x4f989a[_0xebbc('0x8a')],_0x4f989a[_0xebbc('0x8b')],_0xa24fa1,_0x54063b);})['then'](function(_0x36abdb){_0x118e58=_0x36abdb;return getCall(_0x476a9d,_0x2f3298,_0x26674f,_0xa24fa1,_0x118e58,_0x54063b,_0x4f989a,'Outbound');})['then'](function(_0x3407fb){if(_0x3407fb){logger['info'](_0xebbc('0x8c'),_0x3407fb['id']);logger[_0xebbc('0x28')]('[OUTBOUND]',_0xebbc('0x82'));emit(util[_0xebbc('0x5f')](_0xebbc('0x8d'),_0x32e328[_0xebbc('0x14')]),'trigger:browser:url',{'uri':_0xebbc('0x83')+_0x26674f[_0xebbc('0x76')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3407fb['id']});}})[_0xebbc('0x26')](function(_0x1b5db6){logger[_0xebbc('0x36')](_0xebbc('0x87'),JSON[_0xebbc('0xc')](_0x1b5db6));});};exports[_0xebbc('0x8e')]=function(_0x4356a4,_0x3d56c8,_0x646a3c,_0x47086e,_0x137e51,_0x2e39e7){var _0x34a2c9,_0x59f50a,_0xcf128f;_0x2e39e7[_0xebbc('0x76')]=intUtil[_0xebbc('0x77')](_0x2e39e7[_0xebbc('0x76')]);_0x2e39e7[_0xebbc('0x78')]=intUtil[_0xebbc('0x77')](_0x2e39e7[_0xebbc('0x78')]);if(_0x137e51&&_0x137e51[_0xebbc('0x79')]){logger[_0xebbc('0x28')]('['+_0x3d56c8[_0xebbc('0x60')][_0xebbc('0x8f')]()+']',_0xebbc('0x88'));_0x3d56c8[_0xebbc('0x7b')]=_0x2e39e7['serverUrl']+_0xebbc('0x7c')+_0x3d56c8[_0xebbc('0x7d')]+_0xebbc('0x7e')+md5(_0x3d56c8['uniqueid']);}else{_0x3d56c8['recordingURL']='';}var _0x3cdea4=_0x2e39e7[_0xebbc('0x76')]===_0xebbc('0x7f')?'eu':_0xebbc('0x89');return getAccessToken(_0x2e39e7)['then'](function(_0x5e7d23){_0xcf128f=_0x5e7d23;return getUser(_0xcf128f,_0x3cdea4,_0x2e39e7);})[_0xebbc('0x24')](function(_0x190a28){_0x34a2c9=_0x190a28;logger[_0xebbc('0x28')]('The\x20User\x20ID\x20is:',_0x34a2c9['id']);return getEndUser(_0xcf128f,_0x3cdea4,_0x2e39e7,_0x3d56c8[_0xebbc('0x90')],_0x3d56c8[_0xebbc('0x81')],_0x34a2c9,_0x646a3c);})['then'](function(_0x362836){_0x59f50a=_0x362836;return getCall(_0xcf128f,_0x3cdea4,_0x2e39e7,_0x34a2c9,_0x59f50a,_0x646a3c,_0x3d56c8,_0xebbc('0x70'));})[_0xebbc('0x24')](function(_0x402651){if(_0x402651){logger[_0xebbc('0x28')](_0xebbc('0x8c'),_0x402651['id']);}})[_0xebbc('0x26')](function(_0x4684bb){logger[_0xebbc('0x36')]('['+_0x3d56c8[_0xebbc('0x60')][_0xebbc('0x8f')]()+']',JSON[_0xebbc('0xc')](_0x4684bb));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index f7cd832..1765c05 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x38ae49,_0x2623ff){var _0x3641db=function(_0x413385){while(--_0x413385){_0x38ae49['push'](_0x38ae49['shift']());}};_0x3641db(++_0x2623ff);}(_0x7a54,0x106));var _0x47a5=function(_0x25a7ff,_0xe2cc27){_0x25a7ff=_0x25a7ff-0x0;var _0x35d367=_0x7a54[_0x25a7ff];return _0x35d367;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x4a0157,_0x8c95d9){var _0x2c25fd=function(_0x567c8f){while(--_0x567c8f){_0x4a0157['push'](_0x4a0157['shift']());}};_0x2c25fd(++_0x8c95d9);}(_0x7a54,0x106));var _0x47a5=function(_0x5a2c90,_0x4b890d){_0x5a2c90=_0x5a2c90-0x0;var _0x134b85=_0x7a54[_0x5a2c90];return _0x134b85;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 7082673..2e072d0 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x2a2537,_0x406050){var _0x3950ee=function(_0x550475){while(--_0x550475){_0x2a2537['push'](_0x2a2537['shift']());}};_0x3950ee(++_0x406050);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29914d,_0x2c8f0d){_0x29914d=_0x29914d-0x0;var _0x573a7c=_0x5f2f[_0x29914d];return _0x573a7c;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x110efa,_0x199f70){var _0x2164fb=function(_0x2aaeef){while(--_0x2aaeef){_0x110efa['push'](_0x110efa['shift']());}};_0x2164fb(++_0x199f70);}(_0x5f2f,0x73));var _0xf5f2=function(_0x152198,_0x61c7d0){_0x152198=_0x152198-0x0;var _0x53fce3=_0x5f2f[_0x152198];return _0x53fce3;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8515b25..e07874b 100644 --- a/server/services/email/client.js +++ b/server/services/email/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50b9=['then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','../../config/logger','client','http','Request','request'];(function(_0x26a2bd,_0x26eba2){var _0x40410e=function(_0x49d342){while(--_0x49d342){_0x26a2bd['push'](_0x26a2bd['shift']());}};_0x40410e(++_0x26eba2);}(_0x50b9,0x171));var _0x950b=function(_0x17f145,_0x3422bb){_0x17f145=_0x17f145-0x0;var _0x2d5420=_0x50b9[_0x17f145];return _0x2d5420;};'use strict';var jayson=require(_0x950b('0x0'));var BPromise=require('bluebird');var logger=require(_0x950b('0x1'))('routing');var client=jayson[_0x950b('0x2')][_0x950b('0x3')]({'port':0x2329});client[_0x950b('0x4')]=function(_0x3f68be,_0x237b83){return new BPromise(function(_0x986b16,_0x23b70f){return client[_0x950b('0x5')](_0x3f68be,_0x237b83)[_0x950b('0x6')](function(_0x56ce3f){logger[_0x950b('0x7')](_0x950b('0x8'),_0x950b('0x9'),_0x3f68be,_0x237b83,_0x56ce3f);if(_0x56ce3f['error']){logger['error']('rpc',_0x950b('0x9'),_0x3f68be,_0x56ce3f[_0x950b('0xa')][_0x950b('0xb')],_0x237b83);return _0x23b70f(_0x56ce3f[_0x950b('0xa')][_0x950b('0xb')]);}else{return _0x986b16(_0x56ce3f[_0x950b('0xc')]);}})[_0x950b('0xd')](function(_0x585c89){logger[_0x950b('0xa')](_0x950b('0x8'),'routing',_0x3f68be,_0x585c89,_0x237b83);return _0x23b70f(_0x585c89);});});};module[_0x950b('0xe')]=client; \ No newline at end of file +var _0xa348=['then','debug','rpc','error','routing','message','result','catch','exports','jayson/promise','../../config/logger','Request','request'];(function(_0x2d971e,_0x1cff17){var _0x555a96=function(_0x3bbd23){while(--_0x3bbd23){_0x2d971e['push'](_0x2d971e['shift']());}};_0x555a96(++_0x1cff17);}(_0xa348,0xb2));var _0x8a34=function(_0xab35e1,_0x48b46b){_0xab35e1=_0xab35e1-0x0;var _0x1dbb70=_0xa348[_0xab35e1];return _0x1dbb70;};'use strict';var jayson=require(_0x8a34('0x0'));var BPromise=require('bluebird');var logger=require(_0x8a34('0x1'))('routing');var client=jayson['client']['http']({'port':0x2329});client[_0x8a34('0x2')]=function(_0x3b1db5,_0x1419a4){return new BPromise(function(_0x283895,_0x2d134d){return client[_0x8a34('0x3')](_0x3b1db5,_0x1419a4)[_0x8a34('0x4')](function(_0xe67e06){logger[_0x8a34('0x5')](_0x8a34('0x6'),'routing',_0x3b1db5,_0x1419a4,_0xe67e06);if(_0xe67e06[_0x8a34('0x7')]){logger[_0x8a34('0x7')](_0x8a34('0x6'),_0x8a34('0x8'),_0x3b1db5,_0xe67e06['error'][_0x8a34('0x9')],_0x1419a4);return _0x2d134d(_0xe67e06[_0x8a34('0x7')]['message']);}else{return _0x283895(_0xe67e06[_0x8a34('0xa')]);}})[_0x8a34('0xb')](function(_0x1c21e0){logger[_0x8a34('0x7')](_0x8a34('0x6'),_0x8a34('0x8'),_0x3b1db5,_0x1c21e0,_0x1419a4);return _0x2d134d(_0x1c21e0);});});};module[_0x8a34('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 4f12f42..a2f3923 100644 --- a/server/services/email/index.js +++ b/server/services/email/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4677=['resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','findOne','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4677,0x155));var _0x7467=function(_0x15941d,_0x46c520){_0x15941d=_0x15941d-0x0;var _0x482dca=_0x4677[_0x15941d];return _0x482dca;};'use strict';var BPromise=require(_0x7467('0x0'));var server=require('./server');var Realtime=require(_0x7467('0x1'));var EmailChannel=require(_0x7467('0x2'));var mailAccount=require(_0x7467('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0x7467('0x4')]()[_0x7467('0x5')](mailAccount[_0x7467('0x6')]())[_0x7467('0x5')](realtime[_0x7467('0x7')]())[_0x7467('0x5')](function(){email[_0x7467('0x8')](realtime[_0x7467('0x9')]);return realtime;});}function main(){return server[_0x7467('0xa')](realtime,email)['then'](function(_0x588489){return initRealtime();})[_0x7467('0x5')](function(_0x1cc835){return db['Setting'][_0x7467('0xb')]({'attributes':['id',_0x7467('0xc')],'raw':!![]});})['then'](function(_0x468134){return setInterval(initRealtime,_0x468134['loginMailFrequency']*0x3e8);})[_0x7467('0xd')](function(_0x1185e8){console[_0x7467('0xe')](_0x1185e8);});}main(); \ No newline at end of file +var _0x018c=['refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime','../../mysqldb','then','getMailAccounts','initMailAccounts'];(function(_0x538e71,_0x458b52){var _0xf320c9=function(_0x137c50){while(--_0x137c50){_0x538e71['push'](_0x538e71['shift']());}};_0xf320c9(++_0x458b52);}(_0x018c,0xda));var _0xc018=function(_0x5de5aa,_0x4b006b){_0x5de5aa=_0x5de5aa-0x0;var _0x3c2ec1=_0x018c[_0x5de5aa];return _0x3c2ec1;};'use strict';var BPromise=require(_0xc018('0x0'));var server=require(_0xc018('0x1'));var Realtime=require(_0xc018('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xc018('0x3'))['db'];function initRealtime(){return BPromise['resolve']()[_0xc018('0x4')](mailAccount[_0xc018('0x5')]())[_0xc018('0x4')](realtime[_0xc018('0x6')]())['then'](function(){email[_0xc018('0x7')](realtime[_0xc018('0x8')]);return realtime;});}function main(){return server[_0xc018('0x9')](realtime,email)[_0xc018('0x4')](function(_0x29a572){return initRealtime();})[_0xc018('0x4')](function(_0x638610){return db[_0xc018('0xa')][_0xc018('0xb')]({'attributes':['id',_0xc018('0xc')],'raw':!![]});})[_0xc018('0x4')](function(_0x2ef3a3){return setInterval(initRealtime,_0x2ef3a3[_0xc018('0xc')]*0x3e8);})[_0xc018('0xd')](function(_0x254baf){console[_0xc018('0xe')](_0x254baf);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3bba658..e346be6 100644 --- a/server/services/email/lib/email.js +++ b/server/services/email/lib/email.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8458=['handleImapError','sendMail','smtp','send','verifySmtp','isNil','Smtp','verify','verified','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','active','status','messageStatus','Imap','total','md5','mailAccount:update','prototype','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','connected','messages','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8458,0xb8));var _0x8845=function(_0x856833,_0x279998){_0x856833=_0x856833-0x0;var _0x561077=_0x8458[_0x856833];return _0x561077;};'use strict';var _=require(_0x8845('0x0'));var moment=require(_0x8845('0x1'));var BPromise=require(_0x8845('0x2'));var md5=require('md5');var Redis=require(_0x8845('0x3'));var config=require(_0x8845('0x4'));var logger=require(_0x8845('0x5'))(_0x8845('0x6'));config[_0x8845('0x7')]=_[_0x8845('0x8')](config[_0x8845('0x7')],{'host':_0x8845('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0x8845('0xa'));var EmailSmtp=require(_0x8845('0xb'));var mailAccount=require(_0x8845('0xc'));var md5Accounts={};function EmailChannel(_0x331add){logger[_0x8845('0xd')](_0x8845('0xe'));this['mailAccounts']=_0x331add[_0x8845('0xf')];this[_0x8845('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x8845('0x11')]=function(_0x11ce39){var _0x3316a2=this[_0x8845('0xf')][_0x11ce39];var _0x409b30={'id':_0x3316a2['id'],'name':_0x3316a2[_0x8845('0x12')],'key':_0x3316a2[_0x8845('0x13')],'active':_0x3316a2[_0x8845('0x14')],'Imap':{'status':_0x3316a2['Imap'][_0x8845('0x15')],'messageStatus':_0x3316a2['Imap'][_0x8845('0x16')],'total':_0x3316a2[_0x8845('0x17')][_0x8845('0x18')]}};if(_['isNil'](md5Accounts[_0x11ce39])){md5Accounts[_0x11ce39]={};}var _0x200c68=md5(JSON['stringify'](_0x409b30));if(md5Accounts[_0x11ce39][_0x8845('0x19')]!==_0x200c68){md5Accounts[_0x11ce39][_0x8845('0x19')]=_0x200c68;io[_0x8845('0x11')](_0x8845('0x1a'),_0x409b30);}};EmailChannel[_0x8845('0x1b')][_0x8845('0x1c')]=function(_0x4d3119){for(var _0x241e2a in _0x4d3119){if(_0x4d3119[_0x8845('0x1d')](_0x241e2a)){if(_0x4d3119[_0x241e2a][_0x8845('0x17')]&&_0x4d3119[_0x241e2a][_0x8845('0x14')]){var _0xacaca5=_0x4d3119[_0x241e2a]['Imap'];if(!this[_0x8845('0x10')]['hasOwnProperty'](_0xacaca5['id'])){this[_0x8845('0x10')][_0xacaca5['id']]=new EmailImap(_0xacaca5,_0x4d3119[_0x241e2a][_0x8845('0x6')]);this['imapAccounts'][_0xacaca5['id']]['on'](_0x8845('0x1e'),this[_0x8845('0x1f')][_0x8845('0x20')](this,_0x241e2a));this[_0x8845('0x10')][_0xacaca5['id']]['on'](_0x8845('0x6'),this[_0x8845('0x21')][_0x8845('0x20')](this,_0x241e2a));this[_0x8845('0x10')][_0xacaca5['id']]['on'](_0x8845('0x22'),this[_0x8845('0x23')][_0x8845('0x20')](this,_0x241e2a));this[_0x8845('0x10')][_0xacaca5['id']]['on'](_0x8845('0x24'),this['handleImapError'][_0x8845('0x20')](this,_0x241e2a));}}else{if(_['isNil'](this[_0x8845('0xf')][_0x241e2a]['Imap'])){this[_0x8845('0xf')][_0x241e2a]['Imap']={};}this[_0x8845('0xf')][_0x241e2a]['Imap'][_0x8845('0x15')]=_0x8845('0x25');this[_0x8845('0xf')][_0x241e2a]['Imap'][_0x8845('0x16')]='';this[_0x8845('0x11')](_0x241e2a);}}}};EmailChannel[_0x8845('0x1b')]['handleImapBox']=function(_0x4ca1b8,_0x3e2c1e){if(this[_0x8845('0xf')][_0x4ca1b8]){this['mailAccounts'][_0x4ca1b8][_0x8845('0x17')][_0x8845('0x15')]=_0x8845('0x26');this[_0x8845('0xf')][_0x4ca1b8][_0x8845('0x17')]['messageStatus']=_0x3e2c1e[_0x8845('0x12')];if(_0x3e2c1e[_0x8845('0x27')]){this[_0x8845('0xf')][_0x4ca1b8][_0x8845('0x17')][_0x8845('0x18')]=_0x3e2c1e[_0x8845('0x27')][_0x8845('0x18')];}return this[_0x8845('0x11')](_0x4ca1b8);}};EmailChannel[_0x8845('0x1b')][_0x8845('0x21')]=function(_0x25c31e,_0x1d0b94){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x1d0b94[_0x8845('0x28')],_0x1d0b94[_0x8845('0x29')],_0x1d0b94[_0x8845('0x2a')],_0x25c31e);if(this[_0x8845('0xf')][_0x25c31e]){return mailAccount[_0x8845('0x2b')](_0x25c31e,_0x1d0b94)[_0x8845('0x2c')](function(_0x375e7f){if(_0x375e7f){logger[_0x8845('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0x8845('0x2d')](function(_0x5630d8){logger[_0x8845('0x24')](_0x8845('0x2e'),JSON['stringify'](_0x5630d8));});}};EmailChannel[_0x8845('0x1b')][_0x8845('0x23')]=function(_0x5e868d){if(this['mailAccounts'][_0x5e868d]&&this[_0x8845('0xf')][_0x5e868d][_0x8845('0x17')]){if(this[_0x8845('0x10')][this[_0x8845('0xf')][_0x5e868d][_0x8845('0x17')]['id']]){delete this[_0x8845('0x10')][this[_0x8845('0xf')][_0x5e868d][_0x8845('0x17')]['id']];}this[_0x8845('0xf')][_0x5e868d][_0x8845('0x17')][_0x8845('0x2f')]=moment();this[_0x8845('0x11')](_0x5e868d);}};EmailChannel[_0x8845('0x1b')][_0x8845('0x30')]=function(_0x3ecdd1,_0x1c2b29){if(this[_0x8845('0xf')][_0x3ecdd1]){this['mailAccounts'][_0x3ecdd1]['Imap'][_0x8845('0x15')]=_0x8845('0x24');this[_0x8845('0xf')][_0x3ecdd1][_0x8845('0x17')][_0x8845('0x16')]=_0x1c2b29;return this['emit'](_0x3ecdd1);}};EmailChannel[_0x8845('0x1b')][_0x8845('0x31')]=function(_0x3b887a,_0x497811){return this[_0x8845('0x32')][_0x8845('0x33')](_0x3b887a,_0x497811);};EmailChannel[_0x8845('0x1b')][_0x8845('0x34')]=function(_0x5b612f){var _0x1bd49c=this;if(this[_0x8845('0xf')][_0x5b612f['id']]){if(_[_0x8845('0x35')](this[_0x8845('0xf')][_0x5b612f['id']][_0x8845('0x36')])){this[_0x8845('0xf')][_0x5b612f['id']]['Smtp']={};}this[_0x8845('0xf')][_0x5b612f['id']][_0x8845('0x36')][_0x8845('0x2f')]=moment();return new BPromise(function(_0x5acb33,_0x3bd70d){return _0x1bd49c[_0x8845('0x32')][_0x8845('0x37')](_0x5b612f)[_0x8845('0x2c')](function(_0x2b5c59){_0x1bd49c[_0x8845('0xf')][_0x5b612f['id']][_0x8845('0x36')][_0x8845('0x15')]=_0x8845('0x38');_0x1bd49c[_0x8845('0xf')][_0x5b612f['id']]['Smtp'][_0x8845('0x16')]='';_0x1bd49c[_0x8845('0x11')](_0x5b612f['id']);_0x5acb33(_0x2b5c59);})[_0x8845('0x2d')](function(_0x23b2bf){_0x1bd49c[_0x8845('0xf')][_0x5b612f['id']][_0x8845('0x36')]['status']=_0x8845('0x24');_0x1bd49c[_0x8845('0xf')][_0x5b612f['id']][_0x8845('0x36')][_0x8845('0x16')]=_0x23b2bf;_0x1bd49c[_0x8845('0x11')](_0x5b612f['id']);_0x3bd70d(_0x23b2bf);});});}return this[_0x8845('0x32')][_0x8845('0x37')](_0x5b612f);};module[_0x8845('0x39')]=EmailChannel; \ No newline at end of file +var _0x9659=['verifySmtp','Smtp','lastSync','verify','verified','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','status','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','sendMail','smtp'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x9659,0x6b));var _0x9965=function(_0x1773d8,_0x551063){_0x1773d8=_0x1773d8-0x0;var _0x33914b=_0x9659[_0x1773d8];return _0x33914b;};'use strict';var _=require(_0x9965('0x0'));var moment=require(_0x9965('0x1'));var BPromise=require(_0x9965('0x2'));var md5=require(_0x9965('0x3'));var Redis=require('ioredis');var config=require(_0x9965('0x4'));var logger=require(_0x9965('0x5'))(_0x9965('0x6'));config[_0x9965('0x7')]=_['defaults'](config['redis'],{'host':_0x9965('0x8'),'port':0x18eb});var io=require(_0x9965('0x9'))(new Redis(config[_0x9965('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x9965('0xa'));var mailAccount=require(_0x9965('0xb'));var md5Accounts={};function EmailChannel(_0x2bda51){logger[_0x9965('0xc')](_0x9965('0xd'));this[_0x9965('0xe')]=_0x2bda51[_0x9965('0xe')];this[_0x9965('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x9965('0x10')][_0x9965('0x11')]=function(_0x56a107){var _0x30ec8a=this[_0x9965('0xe')][_0x56a107];var _0x19b29d={'id':_0x30ec8a['id'],'name':_0x30ec8a[_0x9965('0x12')],'key':_0x30ec8a['key'],'active':_0x30ec8a['active'],'Imap':{'status':_0x30ec8a['Imap']['status'],'messageStatus':_0x30ec8a[_0x9965('0x13')][_0x9965('0x14')],'total':_0x30ec8a[_0x9965('0x13')][_0x9965('0x15')]}};if(_[_0x9965('0x16')](md5Accounts[_0x56a107])){md5Accounts[_0x56a107]={};}var _0x127a12=md5(JSON[_0x9965('0x17')](_0x19b29d));if(md5Accounts[_0x56a107][_0x9965('0x3')]!==_0x127a12){md5Accounts[_0x56a107][_0x9965('0x3')]=_0x127a12;io[_0x9965('0x11')](_0x9965('0x18'),_0x19b29d);}};EmailChannel[_0x9965('0x10')][_0x9965('0x19')]=function(_0x387dba){for(var _0xd2e3d2 in _0x387dba){if(_0x387dba[_0x9965('0x1a')](_0xd2e3d2)){if(_0x387dba[_0xd2e3d2][_0x9965('0x13')]&&_0x387dba[_0xd2e3d2][_0x9965('0x1b')]){var _0x1026f2=_0x387dba[_0xd2e3d2][_0x9965('0x13')];if(!this[_0x9965('0xf')][_0x9965('0x1a')](_0x1026f2['id'])){this[_0x9965('0xf')][_0x1026f2['id']]=new EmailImap(_0x1026f2,_0x387dba[_0xd2e3d2][_0x9965('0x6')]);this[_0x9965('0xf')][_0x1026f2['id']]['on'](_0x9965('0x1c'),this[_0x9965('0x1d')][_0x9965('0x1e')](this,_0xd2e3d2));this[_0x9965('0xf')][_0x1026f2['id']]['on']('email',this[_0x9965('0x1f')][_0x9965('0x1e')](this,_0xd2e3d2));this[_0x9965('0xf')][_0x1026f2['id']]['on'](_0x9965('0x20'),this['handleImapEnd'][_0x9965('0x1e')](this,_0xd2e3d2));this[_0x9965('0xf')][_0x1026f2['id']]['on'](_0x9965('0x21'),this[_0x9965('0x22')][_0x9965('0x1e')](this,_0xd2e3d2));}}else{if(_[_0x9965('0x16')](this['mailAccounts'][_0xd2e3d2][_0x9965('0x13')])){this[_0x9965('0xe')][_0xd2e3d2][_0x9965('0x13')]={};}this[_0x9965('0xe')][_0xd2e3d2][_0x9965('0x13')][_0x9965('0x23')]='disabled';this[_0x9965('0xe')][_0xd2e3d2][_0x9965('0x13')]['messageStatus']='';this[_0x9965('0x11')](_0xd2e3d2);}}}};EmailChannel[_0x9965('0x10')][_0x9965('0x1d')]=function(_0x426fd7,_0x66b4ba){if(this[_0x9965('0xe')][_0x426fd7]){this[_0x9965('0xe')][_0x426fd7][_0x9965('0x13')]['status']=_0x9965('0x24');this[_0x9965('0xe')][_0x426fd7][_0x9965('0x13')][_0x9965('0x14')]=_0x66b4ba[_0x9965('0x12')];if(_0x66b4ba['messages']){this[_0x9965('0xe')][_0x426fd7][_0x9965('0x13')][_0x9965('0x15')]=_0x66b4ba['messages'][_0x9965('0x15')];}return this[_0x9965('0x11')](_0x426fd7);}};EmailChannel[_0x9965('0x10')]['handleImapEmail']=function(_0x193897,_0x393219){logger[_0x9965('0xc')](_0x9965('0x25'),_0x393219[_0x9965('0x26')],_0x393219[_0x9965('0x27')],_0x393219['from'],_0x193897);if(this['mailAccounts'][_0x193897]){return mailAccount['notify'](_0x193897,_0x393219)['then'](function(_0x1a9796){if(_0x1a9796){logger[_0x9965('0xc')](_0x9965('0x28'));}})[_0x9965('0x29')](function(_0x256928){logger[_0x9965('0x21')](_0x9965('0x2a'),JSON[_0x9965('0x17')](_0x256928));});}};EmailChannel['prototype'][_0x9965('0x2b')]=function(_0x4e5699){if(this['mailAccounts'][_0x4e5699]&&this[_0x9965('0xe')][_0x4e5699][_0x9965('0x13')]){if(this[_0x9965('0xf')][this[_0x9965('0xe')][_0x4e5699][_0x9965('0x13')]['id']]){delete this[_0x9965('0xf')][this[_0x9965('0xe')][_0x4e5699][_0x9965('0x13')]['id']];}this[_0x9965('0xe')][_0x4e5699][_0x9965('0x13')]['lastSync']=moment();this[_0x9965('0x11')](_0x4e5699);}};EmailChannel[_0x9965('0x10')]['handleImapError']=function(_0x12bdc6,_0x536d0b){if(this[_0x9965('0xe')][_0x12bdc6]){this[_0x9965('0xe')][_0x12bdc6][_0x9965('0x13')]['status']=_0x9965('0x21');this['mailAccounts'][_0x12bdc6][_0x9965('0x13')][_0x9965('0x14')]=_0x536d0b;return this['emit'](_0x12bdc6);}};EmailChannel[_0x9965('0x10')][_0x9965('0x2c')]=function(_0x222d12,_0xdb22b5){return this[_0x9965('0x2d')]['send'](_0x222d12,_0xdb22b5);};EmailChannel[_0x9965('0x10')][_0x9965('0x2e')]=function(_0x5d9d60){var _0x3351b6=this;if(this[_0x9965('0xe')][_0x5d9d60['id']]){if(_[_0x9965('0x16')](this[_0x9965('0xe')][_0x5d9d60['id']][_0x9965('0x2f')])){this[_0x9965('0xe')][_0x5d9d60['id']]['Smtp']={};}this[_0x9965('0xe')][_0x5d9d60['id']][_0x9965('0x2f')][_0x9965('0x30')]=moment();return new BPromise(function(_0x5a1a27,_0x530130){return _0x3351b6[_0x9965('0x2d')][_0x9965('0x31')](_0x5d9d60)['then'](function(_0x5338a9){_0x3351b6[_0x9965('0xe')][_0x5d9d60['id']]['Smtp']['status']=_0x9965('0x32');_0x3351b6['mailAccounts'][_0x5d9d60['id']]['Smtp'][_0x9965('0x14')]='';_0x3351b6[_0x9965('0x11')](_0x5d9d60['id']);_0x5a1a27(_0x5338a9);})[_0x9965('0x29')](function(_0x45ec6b){_0x3351b6[_0x9965('0xe')][_0x5d9d60['id']][_0x9965('0x2f')]['status']=_0x9965('0x21');_0x3351b6[_0x9965('0xe')][_0x5d9d60['id']][_0x9965('0x2f')][_0x9965('0x14')]=_0x45ec6b;_0x3351b6['emit'](_0x5d9d60['id']);_0x530130(_0x45ec6b);});});}return this[_0x9965('0x2d')][_0x9965('0x31')](_0x5d9d60);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index b47ff46..ddf9a4e 100644 --- a/server/services/email/lib/imap.js +++ b/server/services/email/lib/imap.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7506=['attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','handleFetchError','handleEnd','textCode','upperFirst','path','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','getAccount','account','once','ready','handleReady','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','handleFetchEnd','closeBox','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7506,0x13a));var _0x6750=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7506[_0x2a6809];return _0x11c371;};'use strict';var fs=require('fs');var path=require(_0x6750('0x0'));var util=require('util');var Imap=require(_0x6750('0x1'));var _=require(_0x6750('0x2'));var rs=require(_0x6750('0x3'));var simpleParser=require(_0x6750('0x4'))[_0x6750('0x5')];var Iconv=require(_0x6750('0x6'))[_0x6750('0x7')];var EventEmitter=require(_0x6750('0x8'))[_0x6750('0x9')];var utils=require(_0x6750('0xa'));var logger=require(_0x6750('0xb'))(_0x6750('0xc'));function EmailImap(_0x3a5662,_0x244a0c){this['mailbox']=_0x6750('0xd');this['account']=this[_0x6750('0xe')](_0x3a5662,_0x244a0c);this['imap']=new Imap(this[_0x6750('0xf')]);this[_0x6750('0x1')][_0x6750('0x10')](_0x6750('0x11'),this[_0x6750('0x12')]['bind'](this));this[_0x6750('0x1')][_0x6750('0x10')]('end',this['handleEnd'][_0x6750('0x13')](this));this[_0x6750('0x1')]['on'](_0x6750('0x14'),this[_0x6750('0x15')][_0x6750('0x13')](this));this[_0x6750('0x1')][_0x6750('0x16')]();}util[_0x6750('0x17')](EmailImap,EventEmitter);EmailImap[_0x6750('0x18')][_0x6750('0xe')]=function(_0xa06962,_0x484513){var _0x3aa57c={'connTimeout':_0xa06962['connTimeout']?_0xa06962[_0x6750('0x19')]*0x3e8:0x2710,'authTimeout':_0xa06962[_0x6750('0x1a')]?_0xa06962[_0x6750('0x1a')]*0x3e8:0x1388};if(_[_0x6750('0x1b')](_0xa06962[_0x6750('0x1c')])){if(_0xa06962[_0x6750('0x1d')]){_0x3aa57c[_0x6750('0x1e')]=_0xa06962[_0x6750('0x1e')];_0x3aa57c['password']=_0xa06962[_0x6750('0x1f')];}_0x3aa57c[_0x6750('0x20')]=_0xa06962[_0x6750('0x20')];_0x3aa57c[_0x6750('0x21')]=_0xa06962['port']||0x3e1;if(_0xa06962['tls']){_0x3aa57c[_0x6750('0x22')]=!![];}else{_0x3aa57c[_0x6750('0x22')]=![];_0x3aa57c[_0x6750('0x23')]='required';}}else{_0x3aa57c['user']=_0xa06962[_0x6750('0x1e')];_0x3aa57c[_0x6750('0x1f')]=_0xa06962[_0x6750('0x1f')];_0x3aa57c[_0x6750('0x20')]=utils['getHost'](_0xa06962[_0x6750('0x1c')]);_0x3aa57c[_0x6750('0x21')]=0x3e1;_0x3aa57c[_0x6750('0x22')]=!![];}_0x3aa57c[_0x6750('0xc')]=_0x484513||_0xa06962[_0x6750('0x1e')]||_0x6750('0x24');return _0x3aa57c;};EmailImap['prototype'][_0x6750('0x12')]=function(){this['imap'][_0x6750('0x25')](this['mailbox'],![],this['handleOpenBox'][_0x6750('0x13')](this));};EmailImap[_0x6750('0x18')][_0x6750('0x26')]=function(_0xb15410,_0x1c55a3){if(_0xb15410){this[_0x6750('0x15')](_0xb15410,!![]);}else{this[_0x6750('0x27')](_0x6750('0x28'),_0x1c55a3);this[_0x6750('0x29')]();}};EmailImap[_0x6750('0x18')][_0x6750('0x2a')]=function(_0x53052f){if(_0x53052f){this[_0x6750('0x15')](_0x53052f,!![]);}else{this[_0x6750('0x1')][_0x6750('0x2b')]();}};EmailImap[_0x6750('0x18')]['readUnseen']=function(){this['imap'][_0x6750('0x2c')]([_0x6750('0x2d')],this[_0x6750('0x2e')]['bind'](this));};EmailImap[_0x6750('0x18')]['handleReadUnseen']=function(_0x3413d2,_0x36ad4a){if(_0x3413d2){this[_0x6750('0x15')](_0x3413d2,!![]);}else{if(_0x36ad4a['length']){try{var _0x4b6275=this[_0x6750('0x1')]['fetch'](_0x36ad4a,{'bodies':'','markSeen':!![]});_0x4b6275['on'](_0x6750('0x2f'),this[_0x6750('0x30')][_0x6750('0x13')](this));_0x4b6275[_0x6750('0x10')](_0x6750('0x14'),this['handleFetchError']['bind'](this));_0x4b6275[_0x6750('0x10')](_0x6750('0x2b'),this[_0x6750('0x31')][_0x6750('0x13')](this));}catch(_0x115069){logger[_0x6750('0x14')](_0x115069);}}else{this[_0x6750('0x1')][_0x6750('0x32')](!![],this['handleCloseBox'][_0x6750('0x13')](this));}}};EmailImap[_0x6750('0x18')][_0x6750('0x30')]=function(_0x51e3d6,_0x4cb354){_0x51e3d6['on'](_0x6750('0x33'),this['handleMessageBody'][_0x6750('0x13')](this));_0x51e3d6['once'](_0x6750('0x34'),this['handleMessageAttributes'][_0x6750('0x13')](this));_0x51e3d6[_0x6750('0x10')](_0x6750('0x2b'),this[_0x6750('0x35')]['bind'](this));};EmailImap['prototype']['handleMessageBody']=function(_0x130805,_0x24788b){simpleParser(_0x130805,{'Iconv':Iconv},this[_0x6750('0x36')]['bind'](this));};EmailImap[_0x6750('0x18')][_0x6750('0x37')]=function(_0x4d0a75){};EmailImap[_0x6750('0x18')][_0x6750('0x35')]=function(){};EmailImap['prototype'][_0x6750('0x36')]=function(_0x40517f,_0x2dc4f1){if(_0x40517f){logger[_0x6750('0x14')](_0x40517f);}else{var _0x22eeb4=this;utils[_0x6750('0x38')](this[_0x6750('0xf')],_0x2dc4f1,function(_0x316fcf){_0x22eeb4[_0x6750('0x27')](_0x6750('0xc'),_0x316fcf);});}};EmailImap['prototype'][_0x6750('0x31')]=function(){this['imap'][_0x6750('0x32')](!![],this[_0x6750('0x2a')]['bind'](this));};EmailImap[_0x6750('0x18')][_0x6750('0x39')]=function(_0x19965f){this['handleError'](_0x19965f);this[_0x6750('0x1')]['closeBox'](!![],this[_0x6750('0x2a')]['bind'](this));};EmailImap[_0x6750('0x18')][_0x6750('0x3a')]=function(){this['emit'](_0x6750('0x2b'));};EmailImap['prototype'][_0x6750('0x15')]=function(_0x104079,_0x2ac120){logger['error']('handleError',this['account'][_0x6750('0xc')],JSON['stringify'](_0x104079));var _0x385c7d='';if(_0x104079){if(_0x104079[_0x6750('0x3b')]){_0x385c7d=_0x104079['textCode'];}else{for(var _0x3d5f67 in _0x104079){if(_0x104079['hasOwnProperty'](_0x3d5f67)){_0x385c7d+=_[_0x6750('0x3c')](_0x3d5f67)+':\x20'+_0x104079[_0x3d5f67]+'\x0a';}}}}if(_0x2ac120){this[_0x6750('0x1')][_0x6750('0x2b')]();}else{this[_0x6750('0x27')]('error',_0x385c7d);this[_0x6750('0x27')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0xcca4=['connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','handleCloseBox','handleError','end','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','handleFetchEnd','handleEnd','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','mailparser','simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','error','inherits','prototype'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xcca4,0x11c));var _0x4cca=function(_0x15db2c,_0x2929ae){_0x15db2c=_0x15db2c-0x0;var _0xc19a4d=_0xcca4[_0x15db2c];return _0xc19a4d;};'use strict';var fs=require('fs');var path=require(_0x4cca('0x0'));var util=require(_0x4cca('0x1'));var Imap=require(_0x4cca('0x2'));var _=require(_0x4cca('0x3'));var rs=require('randomstring');var simpleParser=require(_0x4cca('0x4'))[_0x4cca('0x5')];var Iconv=require('iconv')[_0x4cca('0x6')];var EventEmitter=require('events')[_0x4cca('0x7')];var utils=require(_0x4cca('0x8'));var logger=require(_0x4cca('0x9'))(_0x4cca('0xa'));function EmailImap(_0x5bbb66,_0x2d07a2){this[_0x4cca('0xb')]='INBOX';this[_0x4cca('0xc')]=this[_0x4cca('0xd')](_0x5bbb66,_0x2d07a2);this[_0x4cca('0x2')]=new Imap(this[_0x4cca('0xc')]);this[_0x4cca('0x2')][_0x4cca('0xe')](_0x4cca('0xf'),this[_0x4cca('0x10')][_0x4cca('0x11')](this));this[_0x4cca('0x2')][_0x4cca('0xe')]('end',this['handleEnd']['bind'](this));this[_0x4cca('0x2')]['on'](_0x4cca('0x12'),this['handleError'][_0x4cca('0x11')](this));this['imap']['connect']();}util[_0x4cca('0x13')](EmailImap,EventEmitter);EmailImap[_0x4cca('0x14')][_0x4cca('0xd')]=function(_0x218d37,_0x4f8f4d){var _0x437c15={'connTimeout':_0x218d37[_0x4cca('0x15')]?_0x218d37[_0x4cca('0x15')]*0x3e8:0x2710,'authTimeout':_0x218d37[_0x4cca('0x16')]?_0x218d37[_0x4cca('0x16')]*0x3e8:0x1388};if(_[_0x4cca('0x17')](_0x218d37[_0x4cca('0x18')])){if(_0x218d37['authentication']){_0x437c15['user']=_0x218d37[_0x4cca('0x19')];_0x437c15['password']=_0x218d37[_0x4cca('0x1a')];}_0x437c15[_0x4cca('0x1b')]=_0x218d37['host'];_0x437c15[_0x4cca('0x1c')]=_0x218d37[_0x4cca('0x1c')]||0x3e1;if(_0x218d37[_0x4cca('0x1d')]){_0x437c15['tls']=!![];}else{_0x437c15[_0x4cca('0x1d')]=![];_0x437c15[_0x4cca('0x1e')]=_0x4cca('0x1f');}}else{_0x437c15['user']=_0x218d37[_0x4cca('0x19')];_0x437c15[_0x4cca('0x1a')]=_0x218d37[_0x4cca('0x1a')];_0x437c15[_0x4cca('0x1b')]=utils[_0x4cca('0x20')](_0x218d37[_0x4cca('0x18')]);_0x437c15[_0x4cca('0x1c')]=0x3e1;_0x437c15[_0x4cca('0x1d')]=!![];}_0x437c15['email']=_0x4f8f4d||_0x218d37[_0x4cca('0x19')]||_0x4cca('0x21');return _0x437c15;};EmailImap['prototype'][_0x4cca('0x10')]=function(){this[_0x4cca('0x2')][_0x4cca('0x22')](this[_0x4cca('0xb')],![],this[_0x4cca('0x23')]['bind'](this));};EmailImap[_0x4cca('0x14')][_0x4cca('0x23')]=function(_0x147ade,_0x3afc63){if(_0x147ade){this['handleError'](_0x147ade,!![]);}else{this[_0x4cca('0x24')](_0x4cca('0x25'),_0x3afc63);this['readUnseen']();}};EmailImap[_0x4cca('0x14')][_0x4cca('0x26')]=function(_0x285cdb){if(_0x285cdb){this[_0x4cca('0x27')](_0x285cdb,!![]);}else{this[_0x4cca('0x2')][_0x4cca('0x28')]();}};EmailImap[_0x4cca('0x14')]['readUnseen']=function(){this['imap'][_0x4cca('0x29')](['UNSEEN'],this['handleReadUnseen'][_0x4cca('0x11')](this));};EmailImap[_0x4cca('0x14')][_0x4cca('0x2a')]=function(_0x2aaa7c,_0x101510){if(_0x2aaa7c){this[_0x4cca('0x27')](_0x2aaa7c,!![]);}else{if(_0x101510['length']){try{var _0x1f7d4a=this[_0x4cca('0x2')][_0x4cca('0x2b')](_0x101510,{'bodies':'','markSeen':!![]});_0x1f7d4a['on'](_0x4cca('0x2c'),this[_0x4cca('0x2d')][_0x4cca('0x11')](this));_0x1f7d4a[_0x4cca('0xe')](_0x4cca('0x12'),this[_0x4cca('0x2e')][_0x4cca('0x11')](this));_0x1f7d4a[_0x4cca('0xe')](_0x4cca('0x28'),this['handleFetchEnd'][_0x4cca('0x11')](this));}catch(_0x1eeeb1){logger['error'](_0x1eeeb1);}}else{this['imap'][_0x4cca('0x2f')](!![],this[_0x4cca('0x26')][_0x4cca('0x11')](this));}}};EmailImap[_0x4cca('0x14')][_0x4cca('0x2d')]=function(_0x5b1462,_0x57daa4){_0x5b1462['on'](_0x4cca('0x30'),this[_0x4cca('0x31')][_0x4cca('0x11')](this));_0x5b1462[_0x4cca('0xe')](_0x4cca('0x32'),this[_0x4cca('0x33')][_0x4cca('0x11')](this));_0x5b1462[_0x4cca('0xe')]('end',this['handleMessageEnd'][_0x4cca('0x11')](this));};EmailImap[_0x4cca('0x14')]['handleMessageBody']=function(_0x22a633,_0x22b9ea){simpleParser(_0x22a633,{'Iconv':Iconv},this[_0x4cca('0x34')][_0x4cca('0x11')](this));};EmailImap[_0x4cca('0x14')][_0x4cca('0x33')]=function(_0x9b6f88){};EmailImap[_0x4cca('0x14')][_0x4cca('0x35')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x49f899,_0x104b4b){if(_0x49f899){logger[_0x4cca('0x12')](_0x49f899);}else{var _0x2a3d0c=this;utils[_0x4cca('0x36')](this[_0x4cca('0xc')],_0x104b4b,function(_0xcaeaa6){_0x2a3d0c[_0x4cca('0x24')](_0x4cca('0xa'),_0xcaeaa6);});}};EmailImap[_0x4cca('0x14')][_0x4cca('0x37')]=function(){this[_0x4cca('0x2')]['closeBox'](!![],this[_0x4cca('0x26')][_0x4cca('0x11')](this));};EmailImap['prototype'][_0x4cca('0x2e')]=function(_0x4d85ee){this[_0x4cca('0x27')](_0x4d85ee);this[_0x4cca('0x2')]['closeBox'](!![],this[_0x4cca('0x26')]['bind'](this));};EmailImap['prototype'][_0x4cca('0x38')]=function(){this[_0x4cca('0x24')]('end');};EmailImap[_0x4cca('0x14')]['handleError']=function(_0x28b84b,_0x3b0402){logger['error'](_0x4cca('0x27'),this[_0x4cca('0xc')][_0x4cca('0xa')],JSON['stringify'](_0x28b84b));var _0xb3d21e='';if(_0x28b84b){if(_0x28b84b[_0x4cca('0x39')]){_0xb3d21e=_0x28b84b[_0x4cca('0x39')];}else{for(var _0x498664 in _0x28b84b){if(_0x28b84b[_0x4cca('0x3a')](_0x498664)){_0xb3d21e+=_[_0x4cca('0x3b')](_0x498664)+':\x20'+_0x28b84b[_0x498664]+'\x0a';}}}}if(_0x3b0402){this[_0x4cca('0x2')]['end']();}else{this[_0x4cca('0x24')](_0x4cca('0x12'),_0xb3d21e);this['emit'](_0x4cca('0x28'));}};module[_0x4cca('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 986896e..f62749d 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77ca=['nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports'];(function(_0x16eadc,_0x3fc953){var _0x5b05c8=function(_0xd8b9cf){while(--_0xd8b9cf){_0x16eadc['push'](_0x16eadc['shift']());}};_0x5b05c8(++_0x3fc953);}(_0x77ca,0xbb));var _0xa77c=function(_0x114e95,_0x5ef65c){_0x114e95=_0x114e95-0x0;var _0x45d249=_0x77ca[_0x114e95];return _0x45d249;};'use strict';var nodemailer=require(_0xa77c('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xa77c('0x1'));function EmailSmtp(){}EmailSmtp[_0xa77c('0x2')][_0xa77c('0x3')]=function(_0x35e6a6,_0x3de3d2){return new BPromise(function(_0x6967c,_0x33ad03){var _0x10c54f=nodemailer[_0xa77c('0x4')](_0x35e6a6);_0x10c54f['use'](_0xa77c('0x5'),inlineBase64());_0x10c54f[_0xa77c('0x6')](_0x3de3d2,function(_0x76c3a7,_0x4789c3){if(_0x76c3a7){_0x33ad03(_0x76c3a7[_0xa77c('0x7')]());}else{_0x6967c(_0x4789c3);}});});};EmailSmtp[_0xa77c('0x2')][_0xa77c('0x8')]=function(_0x3420bd){return new BPromise(function(_0x1aae94,_0x10fff9){var _0x169ff1=nodemailer['createTransport'](_0x3420bd);_0x169ff1[_0xa77c('0x8')](function(_0xba4bbe,_0x181c29){if(_0xba4bbe){_0x10fff9(_0xba4bbe[_0xa77c('0x7')]());}else{if(_0x181c29){_0x1aae94(_0x181c29);}else{_0x10fff9(_0xa77c('0x9'));}}});});};module[_0xa77c('0xa')]=EmailSmtp; \ No newline at end of file +var _0x1993=['sendMail','toString','verify','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1993,0x10d));var _0x3199=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1993[_0x5ddb1c];return _0x354adc;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x3199('0x0'));var inlineBase64=require(_0x3199('0x1'));function EmailSmtp(){}EmailSmtp[_0x3199('0x2')][_0x3199('0x3')]=function(_0x4aca2a,_0x3235d2){return new BPromise(function(_0x2b8fe5,_0x3e9a76){var _0xd923d5=nodemailer[_0x3199('0x4')](_0x4aca2a);_0xd923d5[_0x3199('0x5')](_0x3199('0x6'),inlineBase64());_0xd923d5[_0x3199('0x7')](_0x3235d2,function(_0x103013,_0x34a27a){if(_0x103013){_0x3e9a76(_0x103013[_0x3199('0x8')]());}else{_0x2b8fe5(_0x34a27a);}});});};EmailSmtp[_0x3199('0x2')]['verify']=function(_0x29f6e3){return new BPromise(function(_0x2791a5,_0x1b55b0){var _0x55d441=nodemailer[_0x3199('0x4')](_0x29f6e3);_0x55d441[_0x3199('0x9')](function(_0x215cfd,_0x526a2e){if(_0x215cfd){_0x1b55b0(_0x215cfd['toString']());}else{if(_0x526a2e){_0x2791a5(_0x526a2e);}else{_0x1b55b0(_0x3199('0xa'));}}});});};module[_0x3199('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e25bdfc..73f312b 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0422=['push','contentType','parser','from','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','value','split','length','name','isEmpty','test','html','replace','body','textAsHtml','0x1?_0x528f39['pop']():'';}return'';}function getMails(_0x11528a,_0x1709f4){var _0xc56143='';for(var _0x1a965b=0x0;_0x1a965b<_0x1709f4['value']['length'];_0x1a965b+=0x1){if(_0x1709f4[_0x2042('0xb')][_0x1a965b][_0x2042('0x8')]!==_0x11528a){if(!_[_0x2042('0xf')](_0xc56143)){_0xc56143+=',';}_0xc56143+=_0x1709f4[_0x2042('0xb')][_0x1a965b][_0x2042('0xe')]||_0x1709f4[_0x2042('0xb')][_0x1a965b][_0x2042('0x8')]||'';_0xc56143+='\x20<';_0xc56143+=_0x1709f4[_0x2042('0xb')][_0x1a965b][_0x2042('0x8')]?_0x1709f4[_0x2042('0xb')][_0x1a965b][_0x2042('0x8')]:_0x2042('0x9')+random[_0x2042('0xa')](0x6)+'@xcally.com';_0xc56143+='>';}}return _0xc56143;}function parseEmail(_0x340c41,_0x3086c3,_0x27dcd5){if(_0x3086c3['html']){var _0x38cc01=/)<[^<]*)*<\/script>/gi;while(_0x38cc01[_0x2042('0x10')](_0x3086c3[_0x2042('0x11')])){_0x3086c3['html']=_0x3086c3[_0x2042('0x11')][_0x2042('0x12')](_0x38cc01,'');}_0x27dcd5[_0x2042('0x13')]=_0x3086c3[_0x2042('0x11')];}else{_0x27dcd5[_0x2042('0x13')]=_0x3086c3[_0x2042('0x14')];}if(_0x27dcd5[_0x2042('0x13')]){_0x27dcd5['body']=_0x27dcd5[_0x2042('0x13')][_0x2042('0x12')](/Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','split','slice','join','name','Anonymous','length','isEmpty','@xcally.com','html','test','replace','body','textAsHtml','0x1?_0x55136b['pop']():'';}return'';}function getMails(_0x5152a3,_0x24304c){var _0xee670d='';for(var _0x459d25=0x0;_0x459d25<_0x24304c[_0x0dea('0x9')][_0x0dea('0x12')];_0x459d25+=0x1){if(_0x24304c['value'][_0x459d25][_0x0dea('0xa')]!==_0x5152a3){if(!_[_0x0dea('0x13')](_0xee670d)){_0xee670d+=',';}_0xee670d+=_0x24304c[_0x0dea('0x9')][_0x459d25][_0x0dea('0x10')]||_0x24304c[_0x0dea('0x9')][_0x459d25][_0x0dea('0xa')]||'';_0xee670d+='\x20<';_0xee670d+=_0x24304c[_0x0dea('0x9')][_0x459d25][_0x0dea('0xa')]?_0x24304c[_0x0dea('0x9')][_0x459d25][_0x0dea('0xa')]:_0x0dea('0xb')+random['generate'](0x6)+_0x0dea('0x14');_0xee670d+='>';}}return _0xee670d;}function parseEmail(_0x26d8ae,_0x4b7897,_0x4e33c0){if(_0x4b7897[_0x0dea('0x15')]){var _0x67f152=/)<[^<]*)*<\/script>/gi;while(_0x67f152[_0x0dea('0x16')](_0x4b7897[_0x0dea('0x15')])){_0x4b7897[_0x0dea('0x15')]=_0x4b7897[_0x0dea('0x15')][_0x0dea('0x17')](_0x67f152,'');}_0x4e33c0[_0x0dea('0x18')]=_0x4b7897[_0x0dea('0x15')];}else{_0x4e33c0['body']=_0x4b7897[_0x0dea('0x19')];}if(_0x4e33c0[_0x0dea('0x18')]){_0x4e33c0['body']=_0x4e33c0[_0x0dea('0x18')]['replace'](/0x0){if(this[_0x5e61ed+'Capacity']>0x0&&this[_0x5e61ed+'CurrentCapacity']>=this[_0x5e61ed+'Capacity']){return _0xfc2a('0x29');}else{return'working';}}else{return'idle';}};Agent[_0xfc2a('0x26')][_0xfc2a('0x25')]=function(){var _0x2c732c=[_0xfc2a('0x2a'),'chat',_0xfc2a('0x2b'),_0xfc2a('0x2c'),_0xfc2a('0x2d'),'whatsapp'];for(var _0xc3fc44=0x0;_0xc3fc44<_0x2c732c[_0xfc2a('0x2e')];_0xc3fc44+=0x1){var _0x542c9e=this['getChannelStatus'](_0x2c732c[_0xc3fc44]);if(this[_0x2c732c[_0xc3fc44]+_0xfc2a('0x2f')]!==_0x542c9e){this[_0x2c732c[_0xc3fc44]+'StatusTime']=_[_0xfc2a('0x30')](moment()[_0xfc2a('0x31')]('x'));}this[_0x2c732c[_0xc3fc44]+_0xfc2a('0x2f')]=_0x542c9e;}var _0x23504d={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0xfc2a('0xa')],'mailPause':this[_0xfc2a('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0xfc2a('0xc')],'openchannelPause':this[_0xfc2a('0xe')],'chatStatus':this[_0xfc2a('0xf')],'chatStatusTime':this[_0xfc2a('0x32')],'chatCapacity':this[_0xfc2a('0x10')],'chatCurrentCapacity':this[_0xfc2a('0x11')],'mailStatus':this[_0xfc2a('0x12')],'mailStatusTime':this[_0xfc2a('0x14')],'mailCapacity':this[_0xfc2a('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xfc2a('0x33')],'faxStatusTime':this[_0xfc2a('0x17')],'faxCapacity':this[_0xfc2a('0x18')],'faxCurrentCapacity':this[_0xfc2a('0x19')],'smsStatus':this[_0xfc2a('0x1a')],'smsStatusTime':this[_0xfc2a('0x1b')],'smsCapacity':this[_0xfc2a('0x1c')],'smsCurrentCapacity':this[_0xfc2a('0x1d')],'whatsappStatus':this[_0xfc2a('0x1e')],'whatsappStatusTime':this[_0xfc2a('0x1f')],'whatsappCapacity':this[_0xfc2a('0x20')],'whatsappCurrentCapacity':this[_0xfc2a('0x21')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xfc2a('0x22')],'openchannelCapacity':this[_0xfc2a('0x23')],'openchannelCurrentCapacity':this[_0xfc2a('0x34')],'busy':this[_0xfc2a('0x35')],'busyQueue':this['busyQueue']};var _0x314f01=md5(JSON['stringify'](_0x23504d));if(this[_0xfc2a('0x1')]!==_0x314f01){this['md5']=_0x314f01;io[_0xfc2a('0x36')](_0xfc2a('0x37'),_0x23504d);}};module['exports']=Agent; \ No newline at end of file +var _0x980c=['updateRealtime','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','faxCurrentCapacity','openchannelStatusTime','stringify','emit','user:save','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','idle'];(function(_0x380823,_0x51666c){var _0x599e97=function(_0x1cf5ef){while(--_0x1cf5ef){_0x380823['push'](_0x380823['shift']());}};_0x599e97(++_0x51666c);}(_0x980c,0x100));var _0xc980=function(_0x467a11,_0x4e057a){_0x467a11=_0x467a11-0x0;var _0x139519=_0x980c[_0x467a11];return _0x139519;};'use strict';var _=require(_0xc980('0x0'));var moment=require(_0xc980('0x1'));var md5=require(_0xc980('0x2'));var Redis=require(_0xc980('0x3'));var config=require(_0xc980('0x4'));config[_0xc980('0x5')]=_[_0xc980('0x6')](config[_0xc980('0x5')],{'host':_0xc980('0x7'),'port':0x18eb});var io=require(_0xc980('0x8'))(new Redis(config[_0xc980('0x5')]));function Agent(_0x5793bf){this['id']=_0x5793bf['id']||0x0;this[_0xc980('0x9')]=_0x5793bf[_0xc980('0x9')]||'';this[_0xc980('0xa')]=_0x5793bf[_0xc980('0xa')]||!![];this[_0xc980('0xb')]=_0x5793bf[_0xc980('0xb')]||![];this[_0xc980('0xc')]=_0x5793bf['chatPause']||![];this['mailPause']=_0x5793bf['mailPause']||![];this[_0xc980('0xd')]=_0x5793bf['faxPause']||![];this[_0xc980('0xe')]=_0x5793bf[_0xc980('0xe')]||![];this[_0xc980('0xf')]=_0x5793bf['openchannelPause']||![];this[_0xc980('0x10')]=_0xc980('0x11');this[_0xc980('0x12')]=0x0;this['chatCapacity']=_0x5793bf[_0xc980('0x13')]||0x0;this[_0xc980('0x14')]=0x0;this[_0xc980('0x15')]=_0xc980('0x11');this[_0xc980('0x16')]=0x0;this[_0xc980('0x17')]=_0x5793bf[_0xc980('0x17')]||0x0;this[_0xc980('0x18')]=0x0;this[_0xc980('0x19')]=_0xc980('0x11');this[_0xc980('0x1a')]=0x0;this[_0xc980('0x1b')]=_0x5793bf[_0xc980('0x1b')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0xc980('0x11');this['smsStatusTime']=0x0;this['smsCapacity']=_0x5793bf[_0xc980('0x1c')]||0x0;this[_0xc980('0x1d')]=0x0;this[_0xc980('0x1e')]=_0xc980('0x11');this[_0xc980('0x1f')]=0x0;this[_0xc980('0x20')]=_0x5793bf['whatsappCapacity']||0x0;this[_0xc980('0x21')]=0x0;this[_0xc980('0x22')]=_0xc980('0x11');this['openchannelStatusTime']=0x0;this[_0xc980('0x23')]=_0x5793bf[_0xc980('0x23')]||0x0;this[_0xc980('0x24')]=0x0;this[_0xc980('0x25')]=![];this[_0xc980('0x26')]=undefined;this[_0xc980('0x2')]='';this['updateRealtime']();}Agent[_0xc980('0x27')][_0xc980('0x28')]=function(_0x49c2bc){if(this[_0x49c2bc+_0xc980('0x29')]>0x0){if(this[_0x49c2bc+_0xc980('0x2a')]>0x0&&this[_0x49c2bc+_0xc980('0x29')]>=this[_0x49c2bc+_0xc980('0x2a')]){return'maxcapacity';}else{return'working';}}else{return _0xc980('0x2b');}};Agent[_0xc980('0x27')][_0xc980('0x2c')]=function(){var _0x3368a2=[_0xc980('0x2d'),_0xc980('0x2e'),'openchannel',_0xc980('0x2f'),_0xc980('0x30'),_0xc980('0x31')];for(var _0x2f4fd5=0x0;_0x2f4fd5<_0x3368a2[_0xc980('0x32')];_0x2f4fd5+=0x1){var _0x384373=this[_0xc980('0x28')](_0x3368a2[_0x2f4fd5]);if(this[_0x3368a2[_0x2f4fd5]+_0xc980('0x33')]!==_0x384373){this[_0x3368a2[_0x2f4fd5]+_0xc980('0x34')]=_[_0xc980('0x35')](moment()[_0xc980('0x36')]('x'));}this[_0x3368a2[_0x2f4fd5]+_0xc980('0x33')]=_0x384373;}var _0x177ef6={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xc980('0xb')],'chatPause':this[_0xc980('0xc')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xc980('0xf')],'chatStatus':this[_0xc980('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xc980('0x13')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xc980('0x15')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xc980('0x17')],'mailCurrentCapacity':this[_0xc980('0x18')],'faxStatus':this[_0xc980('0x19')],'faxStatusTime':this[_0xc980('0x1a')],'faxCapacity':this[_0xc980('0x1b')],'faxCurrentCapacity':this[_0xc980('0x37')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xc980('0x1c')],'smsCurrentCapacity':this[_0xc980('0x1d')],'whatsappStatus':this[_0xc980('0x1e')],'whatsappStatusTime':this[_0xc980('0x1f')],'whatsappCapacity':this[_0xc980('0x20')],'whatsappCurrentCapacity':this[_0xc980('0x21')],'openchannelStatus':this[_0xc980('0x22')],'openchannelStatusTime':this[_0xc980('0x38')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xc980('0x24')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x20b896=md5(JSON[_0xc980('0x39')](_0x177ef6));if(this[_0xc980('0x2')]!==_0x20b896){this[_0xc980('0x2')]=_0x20b896;io[_0xc980('0x3a')](_0xc980('0x3b'),_0x177ef6);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 92f70f1..46bf3b1 100644 --- a/server/services/routing/model/chatQueue.js +++ b/server/services/routing/model/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83d4=['map','prototype','updateRealtime','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr'];(function(_0xad2478,_0x23379b){var _0x1f741f=function(_0x1827c1){while(--_0x1827c1){_0xad2478['push'](_0xad2478['shift']());}};_0x1f741f(++_0x23379b);}(_0x83d4,0xdf));var _0x483d=function(_0x44d6b0,_0x1e3ceb){_0x44d6b0=_0x44d6b0-0x0;var _0x3b0071=_0x83d4[_0x44d6b0];return _0x3b0071;};'use strict';var _=require(_0x483d('0x0'));var md5=require(_0x483d('0x1'));var util=require(_0x483d('0x2'));var Redis=require(_0x483d('0x3'));var config=require(_0x483d('0x4'));config[_0x483d('0x5')]=_['defaults'](config[_0x483d('0x5')],{'host':_0x483d('0x6'),'port':0x18eb});var io=require(_0x483d('0x7'))(new Redis(config[_0x483d('0x5')]));function ChatQueue(_0x299924){this['id']=_0x299924['id']||0x0;this[_0x483d('0x8')]=_0x299924[_0x483d('0x8')]||'';this[_0x483d('0x9')]=_0x299924[_0x483d('0x9')]||0xa;this['strategy']=_0x299924[_0x483d('0xa')]||_0x483d('0xb');this[_0x483d('0xc')]=_0x299924['Agents'];this[_0x483d('0xd')]={};this[_0x483d('0xe')]=0x0;this['md5']='';this[_0x483d('0xf')]();this['updateRealtime']();}ChatQueue['prototype'][_0x483d('0xf')]=function(){var _0x165445=this[_0x483d('0xd')][_0x483d('0x10')];this[_0x483d('0xd')]=_[_0x483d('0x11')](this['Agents'],'id');this[_0x483d('0xd')][_0x483d('0x10')]=_0x165445;};ChatQueue[_0x483d('0x12')][_0x483d('0x13')]=function(){this[_0x483d('0x14')]=0x0;this[_0x483d('0x15')]=0x0;for(var _0x530c97=0x0;_0x530c97=0x0?this[_0x483d('0x19')]:0x0;var _0x400a65={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x483d('0x8')],'paused':this[_0x483d('0x15')],'waiting':this[_0x483d('0xe')]};var _0x3fe3b9=md5(JSON[_0x483d('0x1a')](_0x400a65));if(this[_0x483d('0x1')]!==_0x3fe3b9){this[_0x483d('0x1')]=_0x3fe3b9;io['to'](util[_0x483d('0x1b')](_0x483d('0x1c'),_0x400a65[_0x483d('0x8')]))[_0x483d('0x1d')]('chat_queue:save',_0x400a65);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x1b05=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','md5','util','ioredis','redis','localhost','name','timeout'];(function(_0x2ad08e,_0xf49111){var _0xc1b283=function(_0xcd90cf){while(--_0xcd90cf){_0x2ad08e['push'](_0x2ad08e['shift']());}};_0xc1b283(++_0xf49111);}(_0x1b05,0x107));var _0x51b0=function(_0x1a063d,_0x4a5e4e){_0x1a063d=_0x1a063d-0x0;var _0x47ad56=_0x1b05[_0x1a063d];return _0x47ad56;};'use strict';var _=require('lodash');var md5=require(_0x51b0('0x0'));var util=require(_0x51b0('0x1'));var Redis=require(_0x51b0('0x2'));var config=require('../../../config/environment');config[_0x51b0('0x3')]=_['defaults'](config['redis'],{'host':_0x51b0('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x51b0('0x3')]));function ChatQueue(_0x103271){this['id']=_0x103271['id']||0x0;this[_0x51b0('0x5')]=_0x103271[_0x51b0('0x5')]||'';this[_0x51b0('0x6')]=_0x103271[_0x51b0('0x6')]||0xa;this['strategy']=_0x103271[_0x51b0('0x7')]||_0x51b0('0x8');this[_0x51b0('0x9')]=_0x103271[_0x51b0('0x9')];this[_0x51b0('0xa')]={};this[_0x51b0('0xb')]=0x0;this[_0x51b0('0x0')]='';this[_0x51b0('0xc')]();this[_0x51b0('0xd')]();}ChatQueue[_0x51b0('0xe')][_0x51b0('0xc')]=function(){var _0x48072a=this[_0x51b0('0xa')]['_rr'];this['mapAgentsId']=_[_0x51b0('0xf')](this[_0x51b0('0x9')],'id');this['mapAgentsId'][_0x51b0('0x10')]=_0x48072a;};ChatQueue['prototype'][_0x51b0('0xd')]=function(){this[_0x51b0('0x11')]=0x0;this[_0x51b0('0x12')]=0x0;for(var _0x949ac1=0x0;_0x949ac1=0x0?this['available']:0x0;var _0x1d5d61={'id':this['id'],'available':this[_0x51b0('0x16')],'loggedIn':this[_0x51b0('0x11')],'name':this[_0x51b0('0x5')],'paused':this[_0x51b0('0x12')],'waiting':this[_0x51b0('0xb')]};var _0x4e2777=md5(JSON[_0x51b0('0x17')](_0x1d5d61));if(this[_0x51b0('0x0')]!==_0x4e2777){this[_0x51b0('0x0')]=_0x4e2777;io['to'](util[_0x51b0('0x18')](_0x51b0('0x19'),_0x1d5d61[_0x51b0('0x5')]))['emit'](_0x51b0('0x1a'),_0x1d5d61);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 1619489..d44ba0a 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x9f744e,_0xcc546d){var _0x36f5e6=function(_0x246300){while(--_0x246300){_0x9f744e['push'](_0x9f744e['shift']());}};_0x36f5e6(++_0xcc546d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x28f35a,_0x39055b){var _0x46ddbe=function(_0x14396d){while(--_0x14396d){_0x28f35a['push'](_0x28f35a['shift']());}};_0x46ddbe(++_0x39055b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index da54c5d..da3f49d 100644 --- a/server/services/routing/model/interval.js +++ b/server/services/routing/model/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb3e=['name','Intervals','exports'];(function(_0x2137c4,_0x364116){var _0x59f3f9=function(_0x326562){while(--_0x326562){_0x2137c4['push'](_0x2137c4['shift']());}};_0x59f3f9(++_0x364116);}(_0xeb3e,0x90));var _0xeeb3=function(_0x1dbaaa,_0x44f783){_0x1dbaaa=_0x1dbaaa-0x0;var _0x1151f7=_0xeb3e[_0x1dbaaa];return _0x1151f7;};'use strict';function Interval(_0x455f29){this['id']=_0x455f29['id']||0x0;this[_0xeeb3('0x0')]=_0x455f29[_0xeeb3('0x0')]||'';this[_0xeeb3('0x1')]=_0x455f29[_0xeeb3('0x1')]||{};}module[_0xeeb3('0x2')]=Interval; \ No newline at end of file +var _0xc49e=['name','Intervals','exports'];(function(_0x1090f8,_0xd83a11){var _0x180524=function(_0x109ab8){while(--_0x109ab8){_0x1090f8['push'](_0x1090f8['shift']());}};_0x180524(++_0xd83a11);}(_0xc49e,0x72));var _0xec49=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xc49e[_0x68ee8b];return _0x5148f7;};'use strict';function Interval(_0x1cc5f2){this['id']=_0x1cc5f2['id']||0x0;this[_0xec49('0x0')]=_0x1cc5f2['name']||'';this[_0xec49('0x1')]=_0x1cc5f2[_0xec49('0x1')]||{};}module[_0xec49('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e960e50..ebfbed9 100644 --- a/server/services/routing/model/mailQueue.js +++ b/server/services/routing/model/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ad9=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','_rr','updateRealtime','loggedIn','paused','length','online','available','format','emit','mail_queue:save','lodash'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x9ad9,0xbc));var _0x99ad=function(_0x2650de,_0x12c23e){_0x2650de=_0x2650de-0x0;var _0x2db8c0=_0x9ad9[_0x2650de];return _0x2db8c0;};'use strict';var _=require(_0x99ad('0x0'));var md5=require('md5');var util=require(_0x99ad('0x1'));var Redis=require(_0x99ad('0x2'));var config=require(_0x99ad('0x3'));config[_0x99ad('0x4')]=_[_0x99ad('0x5')](config['redis'],{'host':_0x99ad('0x6'),'port':0x18eb});var io=require(_0x99ad('0x7'))(new Redis(config[_0x99ad('0x4')]));function MailQueue(_0x25a580){this['id']=_0x25a580['id']||0x0;this['name']=_0x25a580[_0x99ad('0x8')]||'';this[_0x99ad('0x9')]=_0x25a580[_0x99ad('0x9')]||0xa;this[_0x99ad('0xa')]=_0x25a580[_0x99ad('0xa')]||_0x99ad('0xb');this[_0x99ad('0xc')]=_0x25a580[_0x99ad('0xc')];this[_0x99ad('0xd')]={};this[_0x99ad('0xe')]=0x0;this[_0x99ad('0xf')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x99ad('0x10')]['updateRouting']=function(){var _0x3221c8=this[_0x99ad('0xd')][_0x99ad('0x11')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x99ad('0x11')]=_0x3221c8;};MailQueue[_0x99ad('0x10')][_0x99ad('0x12')]=function(){this[_0x99ad('0x13')]=0x0;this[_0x99ad('0x14')]=0x0;for(var _0x88a2f8=0x0;_0x88a2f8=0x0?this[_0x99ad('0x17')]:0x0;var _0x1b7aee={'id':this['id'],'available':this['available'],'loggedIn':this[_0x99ad('0x13')],'name':this[_0x99ad('0x8')],'paused':this['paused'],'waiting':this[_0x99ad('0xe')]};var _0x104b06=md5(JSON['stringify'](_0x1b7aee));if(this[_0x99ad('0xf')]!==_0x104b06){this['md5']=_0x104b06;io['to'](util[_0x99ad('0x18')]('mail:queue:%s',_0x1b7aee['name']))[_0x99ad('0x19')](_0x99ad('0x1a'),_0x1b7aee);}};module['exports']=MailQueue; \ No newline at end of file +var _0x626d=['length','online','loggedIn','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','map','_rr','paused'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x626d,0xa0));var _0xd626=function(_0x12f91c,_0x3906fd){_0x12f91c=_0x12f91c-0x0;var _0x3be958=_0x626d[_0x12f91c];return _0x3be958;};'use strict';var _=require(_0xd626('0x0'));var md5=require('md5');var util=require(_0xd626('0x1'));var Redis=require(_0xd626('0x2'));var config=require(_0xd626('0x3'));config['redis']=_[_0xd626('0x4')](config[_0xd626('0x5')],{'host':_0xd626('0x6'),'port':0x18eb});var io=require(_0xd626('0x7'))(new Redis(config[_0xd626('0x5')]));function MailQueue(_0x48c737){this['id']=_0x48c737['id']||0x0;this[_0xd626('0x8')]=_0x48c737['name']||'';this['timeout']=_0x48c737[_0xd626('0x9')]||0xa;this['strategy']=_0x48c737['strategy']||_0xd626('0xa');this[_0xd626('0xb')]=_0x48c737['Agents'];this[_0xd626('0xc')]={};this['waiting']=0x0;this[_0xd626('0xd')]='';this['updateRouting']();this[_0xd626('0xe')]();}MailQueue[_0xd626('0xf')][_0xd626('0x10')]=function(){var _0x48467c=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xd626('0x11')](this[_0xd626('0xb')],'id');this[_0xd626('0xc')][_0xd626('0x12')]=_0x48467c;};MailQueue[_0xd626('0xf')][_0xd626('0xe')]=function(){this['loggedIn']=0x0;this[_0xd626('0x13')]=0x0;for(var _0x1004bb=0x0;_0x1004bb=0x0?this['available']:0x0;var _0x1213b4={'id':this['id'],'available':this[_0xd626('0x17')],'loggedIn':this[_0xd626('0x16')],'name':this['name'],'paused':this[_0xd626('0x13')],'waiting':this[_0xd626('0x18')]};var _0x20edf7=md5(JSON[_0xd626('0x19')](_0x1213b4));if(this[_0xd626('0xd')]!==_0x20edf7){this[_0xd626('0xd')]=_0x20edf7;io['to'](util[_0xd626('0x1a')](_0xd626('0x1b'),_0x1213b4['name']))[_0xd626('0x1c')](_0xd626('0x1d'),_0x1213b4);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 6758350..18c4289 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fb0=['format','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','map','_rr','prototype','loggedIn','paused','length','online','available','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0fb0,0x7c));var _0x00fb=function(_0x2850a1,_0x13d54d){_0x2850a1=_0x2850a1-0x0;var _0x3307fc=_0x0fb0[_0x2850a1];return _0x3307fc;};'use strict';var _=require(_0x00fb('0x0'));var md5=require(_0x00fb('0x1'));var util=require(_0x00fb('0x2'));var Redis=require(_0x00fb('0x3'));var config=require('../../../config/environment');config[_0x00fb('0x4')]=_[_0x00fb('0x5')](config[_0x00fb('0x4')],{'host':_0x00fb('0x6'),'port':0x18eb});var io=require(_0x00fb('0x7'))(new Redis(config[_0x00fb('0x4')]));function OpenchannelQueue(_0x150511){this['id']=_0x150511['id']||0x0;this[_0x00fb('0x8')]=_0x150511['name']||'';this[_0x00fb('0x9')]=_0x150511[_0x00fb('0x9')]||0xa;this[_0x00fb('0xa')]=_0x150511[_0x00fb('0xa')]||_0x00fb('0xb');this[_0x00fb('0xc')]=_0x150511[_0x00fb('0xc')];this['mapAgentsId']={};this[_0x00fb('0xd')]=0x0;this['md5']='';this[_0x00fb('0xe')]();this[_0x00fb('0xf')]();}OpenchannelQueue['prototype'][_0x00fb('0xe')]=function(){var _0x5aea47=this[_0x00fb('0x10')]['_rr'];this[_0x00fb('0x10')]=_[_0x00fb('0x11')](this[_0x00fb('0xc')],'id');this['mapAgentsId'][_0x00fb('0x12')]=_0x5aea47;};OpenchannelQueue[_0x00fb('0x13')][_0x00fb('0xf')]=function(){this[_0x00fb('0x14')]=0x0;this[_0x00fb('0x15')]=0x0;for(var _0x4814e0=0x0;_0x4814e0=0x0?this[_0x00fb('0x18')]:0x0;var _0x4597f1={'id':this['id'],'available':this[_0x00fb('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x00fb('0x8')],'paused':this[_0x00fb('0x15')],'waiting':this[_0x00fb('0xd')]};var _0x494260=md5(JSON[_0x00fb('0x19')](_0x4597f1));if(this[_0x00fb('0x1')]!==_0x494260){this['md5']=_0x494260;io['to'](util[_0x00fb('0x1a')]('openchannel:queue:%s',_0x4597f1[_0x00fb('0x8')]))[_0x00fb('0x1b')](_0x00fb('0x1c'),_0x4597f1);}};module[_0x00fb('0x1d')]=OpenchannelQueue; \ No newline at end of file +var _0x7936=['length','online','openchannelPause','available','stringify','format','emit','openchannel_queue:save','exports','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused'];(function(_0x48e439,_0x44a26f){var _0x53a249=function(_0x4799e8){while(--_0x4799e8){_0x48e439['push'](_0x48e439['shift']());}};_0x53a249(++_0x44a26f);}(_0x7936,0x191));var _0x6793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7936[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x6793('0x0'));var config=require(_0x6793('0x1'));config['redis']=_[_0x6793('0x2')](config[_0x6793('0x3')],{'host':_0x6793('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x365c69){this['id']=_0x365c69['id']||0x0;this[_0x6793('0x5')]=_0x365c69['name']||'';this[_0x6793('0x6')]=_0x365c69[_0x6793('0x6')]||0xa;this['strategy']=_0x365c69[_0x6793('0x7')]||'beepall';this[_0x6793('0x8')]=_0x365c69[_0x6793('0x8')];this[_0x6793('0x9')]={};this[_0x6793('0xa')]=0x0;this[_0x6793('0xb')]='';this[_0x6793('0xc')]();this[_0x6793('0xd')]();}OpenchannelQueue[_0x6793('0xe')][_0x6793('0xc')]=function(){var _0x5620a3=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x6793('0xf')](this[_0x6793('0x8')],'id');this[_0x6793('0x9')][_0x6793('0x10')]=_0x5620a3;};OpenchannelQueue[_0x6793('0xe')][_0x6793('0xd')]=function(){this[_0x6793('0x11')]=0x0;this[_0x6793('0x12')]=0x0;for(var _0x395875=0x0;_0x395875=0x0?this[_0x6793('0x16')]:0x0;var _0x1caf66={'id':this['id'],'available':this[_0x6793('0x16')],'loggedIn':this[_0x6793('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x6793('0xa')]};var _0xbe996c=md5(JSON[_0x6793('0x17')](_0x1caf66));if(this['md5']!==_0xbe996c){this[_0x6793('0xb')]=_0xbe996c;io['to'](util[_0x6793('0x18')]('openchannel:queue:%s',_0x1caf66['name']))[_0x6793('0x19')](_0x6793('0x1a'),_0x1caf66);}};module[_0x6793('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 5514080..c20b965 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x5d949e,_0x555707){var _0x445c1e=function(_0x160f2a){while(--_0x160f2a){_0x5d949e['push'](_0x5d949e['shift']());}};_0x445c1e(++_0x555707);}(_0x757a,0xde));var _0xa757=function(_0x174cb5,_0x4dd679){_0x174cb5=_0x174cb5-0x0;var _0x2181fb=_0x757a[_0x174cb5];return _0x2181fb;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x26d55a,_0xf35d61){var _0x108326=function(_0x7f9422){while(--_0x7f9422){_0x26d55a['push'](_0x26d55a['shift']());}};_0x108326(++_0xf35d61);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb7e7[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 0c95729..4182d50 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00c5=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','loggedIn','paused','length','online','whatsappPause','available','format','emit','whatsapp_queue:save','exports','md5','util','ioredis','redis','defaults','localhost'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x00c5,0x14a));var _0x500c=function(_0x59b448,_0x4175e7){_0x59b448=_0x59b448-0x0;var _0x4bd079=_0x00c5[_0x59b448];return _0x4bd079;};'use strict';var _=require('lodash');var md5=require(_0x500c('0x0'));var util=require(_0x500c('0x1'));var Redis=require(_0x500c('0x2'));var config=require('../../../config/environment');config[_0x500c('0x3')]=_[_0x500c('0x4')](config[_0x500c('0x3')],{'host':_0x500c('0x5'),'port':0x18eb});var io=require(_0x500c('0x6'))(new Redis(config[_0x500c('0x3')]));function WhatsappQueue(_0x49ebf6){this['id']=_0x49ebf6['id']||0x0;this[_0x500c('0x7')]=_0x49ebf6[_0x500c('0x7')]||'';this['timeout']=_0x49ebf6[_0x500c('0x8')]||0xa;this[_0x500c('0x9')]=_0x49ebf6[_0x500c('0x9')]||_0x500c('0xa');this['Agents']=_0x49ebf6[_0x500c('0xb')];this[_0x500c('0xc')]={};this[_0x500c('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x500c('0xe')]();}WhatsappQueue[_0x500c('0xf')][_0x500c('0x10')]=function(){var _0x1c36bf=this[_0x500c('0xc')]['_rr'];this[_0x500c('0xc')]=_[_0x500c('0x11')](this[_0x500c('0xb')],'id');this[_0x500c('0xc')]['_rr']=_0x1c36bf;};WhatsappQueue[_0x500c('0xf')][_0x500c('0xe')]=function(){this[_0x500c('0x12')]=0x0;this[_0x500c('0x13')]=0x0;for(var _0x4af002=0x0;_0x4af002=0x0?this[_0x500c('0x17')]:0x0;var _0x369e9f={'id':this['id'],'available':this[_0x500c('0x17')],'loggedIn':this[_0x500c('0x12')],'name':this[_0x500c('0x7')],'paused':this[_0x500c('0x13')],'waiting':this[_0x500c('0xd')]};var _0x175392=md5(JSON['stringify'](_0x369e9f));if(this[_0x500c('0x0')]!==_0x175392){this[_0x500c('0x0')]=_0x175392;io['to'](util[_0x500c('0x18')]('whatsapp:queue:%s',_0x369e9f['name']))[_0x500c('0x19')](_0x500c('0x1a'),_0x369e9f);}};module[_0x500c('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x6e71=['emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','online','whatsappPause','available','name','format','whatsapp:queue:%s'];(function(_0x16322c,_0x3a434e){var _0x453777=function(_0x420061){while(--_0x420061){_0x16322c['push'](_0x16322c['shift']());}};_0x453777(++_0x3a434e);}(_0x6e71,0xbd));var _0x16e7=function(_0x5ef0a7,_0x448741){_0x5ef0a7=_0x5ef0a7-0x0;var _0x5d640b=_0x6e71[_0x5ef0a7];return _0x5d640b;};'use strict';var _=require(_0x16e7('0x0'));var md5=require(_0x16e7('0x1'));var util=require(_0x16e7('0x2'));var Redis=require(_0x16e7('0x3'));var config=require(_0x16e7('0x4'));config[_0x16e7('0x5')]=_[_0x16e7('0x6')](config[_0x16e7('0x5')],{'host':_0x16e7('0x7'),'port':0x18eb});var io=require(_0x16e7('0x8'))(new Redis(config[_0x16e7('0x5')]));function WhatsappQueue(_0x476b51){this['id']=_0x476b51['id']||0x0;this['name']=_0x476b51['name']||'';this[_0x16e7('0x9')]=_0x476b51['timeout']||0xa;this[_0x16e7('0xa')]=_0x476b51[_0x16e7('0xa')]||_0x16e7('0xb');this[_0x16e7('0xc')]=_0x476b51[_0x16e7('0xc')];this[_0x16e7('0xd')]={};this[_0x16e7('0xe')]=0x0;this[_0x16e7('0x1')]='';this['updateRouting']();this[_0x16e7('0xf')]();}WhatsappQueue[_0x16e7('0x10')][_0x16e7('0x11')]=function(){var _0x48991e=this[_0x16e7('0xd')][_0x16e7('0x12')];this[_0x16e7('0xd')]=_[_0x16e7('0x13')](this['Agents'],'id');this[_0x16e7('0xd')][_0x16e7('0x12')]=_0x48991e;};WhatsappQueue[_0x16e7('0x10')][_0x16e7('0xf')]=function(){this[_0x16e7('0x14')]=0x0;this[_0x16e7('0x15')]=0x0;for(var _0x10c05f=0x0;_0x10c05f=0x0?this[_0x16e7('0x18')]:0x0;var _0x221eb7={'id':this['id'],'available':this[_0x16e7('0x18')],'loggedIn':this[_0x16e7('0x14')],'name':this[_0x16e7('0x19')],'paused':this[_0x16e7('0x15')],'waiting':this[_0x16e7('0xe')]};var _0x5312b2=md5(JSON['stringify'](_0x221eb7));if(this[_0x16e7('0x1')]!==_0x5312b2){this['md5']=_0x5312b2;io['to'](util[_0x16e7('0x1a')](_0x16e7('0x1b'),_0x221eb7[_0x16e7('0x19')]))[_0x16e7('0x1c')](_0x16e7('0x1d'),_0x221eb7);}};module[_0x16e7('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index bdcccc2..454ead7 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['mergeFromDatabase','initAgents','length','agents','intervals','isUndefined','updateRouting','initChatQueues','updateRealtime','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1bccb6,_0x33fb13){_0x1bccb6=_0x1bccb6-0x0;var _0x10ba6a=_0x8ef6[_0x1bccb6];return _0x10ba6a;};'use strict';var BPromise=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var moment=require(_0x68ef('0x3'));var Agent=require(_0x68ef('0x4'));var Interval=require(_0x68ef('0x5'));var OpenchannelQueue=require(_0x68ef('0x6'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0x68ef('0x7'));var MailQueue=require(_0x68ef('0x8'));var FaxQueue=require(_0x68ef('0x9'));var WhatsappQueue=require(_0x68ef('0xa'));var Realtime=function(){this['agents']={};this['intervals']={};this[_0x68ef('0xb')]={};this[_0x68ef('0xc')]={};this[_0x68ef('0xd')]={};this['mailQueues']={};this[_0x68ef('0xe')]={};this[_0x68ef('0xf')]={};this[_0x68ef('0x10')]={};this[_0x68ef('0x11')]={};this[_0x68ef('0x12')]={};this[_0x68ef('0x13')]={};this[_0x68ef('0x14')]={};this[_0x68ef('0x15')]={};};function freeIsNotKey(_0x1f6747,_0x255c85,_0x3afc1d){var _0xfa6763=_['mapKeys'](_0x1f6747,function(_0x1aa045,_0x46356f){return _0x1aa045[_0x3afc1d];});for(var _0x1e117a in _0x255c85){if(_0x255c85[_0x68ef('0x16')](_0x1e117a)){if(!_0xfa6763[_0x1e117a]){delete _0x255c85[_0x1e117a];}}}}Realtime[_0x68ef('0x17')][_0x68ef('0x18')]=function(_0x508671,_0x3b48dd){for(var _0xc50cce in _0x3b48dd){if(_0x508671[_0x68ef('0x16')](_0xc50cce)){_0x508671[_0xc50cce]=_0x3b48dd[_0xc50cce];}}};Realtime['prototype'][_0x68ef('0x19')]=function(){var _0x1764de=this;return function(_0x24682d){if(_0x24682d){freeIsNotKey(_0x24682d,_0x1764de['agents'],'id');for(var _0x35493d=0x0,_0x37c4cc={},_0x3d1e90={};_0x35493d<_0x24682d[_0x68ef('0x1a')];_0x35493d+=0x1){_0x37c4cc=_0x24682d[_0x35493d];if(_['isUndefined'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']])){_0x1764de['agents'][_0x37c4cc['id']]=new Agent(_0x37c4cc);}else{_0x1764de['mergeFromDatabase'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']],_0x37c4cc);}}}return _0x1764de[_0x68ef('0x1b')];};};Realtime['prototype']['initIntervals']=function(){var _0x3c4c1f=this;return function(_0x2cd92c){if(_0x2cd92c){freeIsNotKey(_0x2cd92c,_0x3c4c1f[_0x68ef('0x1c')],'id');for(var _0x4fad1c=0x0,_0x1dc49c={},_0x36a4cb={};_0x4fad1c<_0x2cd92c[_0x68ef('0x1a')];_0x4fad1c+=0x1){_0x1dc49c=_0x2cd92c[_0x4fad1c];if(_['isUndefined'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']])){_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']]=new Interval(_0x1dc49c);}else{_0x3c4c1f['mergeFromDatabase'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']],_0x1dc49c);}}}return _0x3c4c1f[_0x68ef('0x1c')];};};Realtime[_0x68ef('0x17')]['initOpenchannelQueues']=function(){var _0x59723c=this;return function(_0x59bebc){if(_0x59bebc){freeIsNotKey(_0x59bebc,_0x59723c[_0x68ef('0xb')],'id');for(var _0x2023f2=0x0,_0x312cc9={},_0x2e6e39={};_0x2023f2<_0x59bebc[_0x68ef('0x1a')];_0x2023f2+=0x1){_0x312cc9=_0x59bebc[_0x2023f2];if(_[_0x68ef('0x1d')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']])){_0x59723c[_0x68ef('0xb')][_0x312cc9['id']]=new OpenchannelQueue(_0x312cc9);}else{_0x59723c[_0x68ef('0x18')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']],_0x312cc9);}_0x59723c['openchannelQueues'][_0x312cc9['id']][_0x68ef('0x1e')]();_0x59723c['openchannelQueues'][_0x312cc9['id']]['updateRealtime']();}}return _0x59723c['openchannelQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x1f')]=function(){var _0x123041=this;return function(_0x29518e){if(_0x29518e){freeIsNotKey(_0x29518e,_0x123041['chatQueues'],'id');for(var _0x4a0550=0x0,_0x1cbe4f={},_0x28907a={};_0x4a0550<_0x29518e[_0x68ef('0x1a')];_0x4a0550+=0x1){_0x1cbe4f=_0x29518e[_0x4a0550];if(_[_0x68ef('0x1d')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']])){_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']]=new ChatQueue(_0x1cbe4f);}else{_0x123041[_0x68ef('0x18')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']],_0x1cbe4f);}_0x123041['chatQueues'][_0x1cbe4f['id']][_0x68ef('0x1e')]();_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']][_0x68ef('0x20')]();}}return _0x123041['chatQueues'];};};Realtime[_0x68ef('0x17')]['initSmsQueues']=function(){var _0x133788=this;return function(_0x17588a){if(_0x17588a){freeIsNotKey(_0x17588a,_0x133788['smsQueues'],'id');for(var _0x5e1e1b=0x0,_0x159395={},_0x5fa72a={};_0x5e1e1b<_0x17588a['length'];_0x5e1e1b+=0x1){_0x159395=_0x17588a[_0x5e1e1b];if(_[_0x68ef('0x1d')](_0x133788[_0x68ef('0xd')][_0x159395['id']])){_0x133788[_0x68ef('0xd')][_0x159395['id']]=new SmsQueue(_0x159395);}else{_0x133788[_0x68ef('0x18')](_0x133788['smsQueues'][_0x159395['id']],_0x159395);}_0x133788[_0x68ef('0xd')][_0x159395['id']][_0x68ef('0x1e')]();_0x133788['smsQueues'][_0x159395['id']][_0x68ef('0x20')]();}}return _0x133788['smsQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x21')]=function(){var _0x4973c2=this;return function(_0x24c2c9){if(_0x24c2c9){freeIsNotKey(_0x24c2c9,_0x4973c2['mailQueues'],'id');for(var _0x38c2f8=0x0,_0x575f43={},_0x2fbb0d={};_0x38c2f8<_0x24c2c9[_0x68ef('0x1a')];_0x38c2f8+=0x1){_0x575f43=_0x24c2c9[_0x38c2f8];if(_[_0x68ef('0x1d')](_0x4973c2['mailQueues'][_0x575f43['id']])){_0x4973c2[_0x68ef('0x22')][_0x575f43['id']]=new MailQueue(_0x575f43);}else{_0x4973c2['mergeFromDatabase'](_0x4973c2[_0x68ef('0x22')][_0x575f43['id']],_0x575f43);}_0x4973c2['mailQueues'][_0x575f43['id']][_0x68ef('0x1e')]();_0x4973c2[_0x68ef('0x22')][_0x575f43['id']][_0x68ef('0x20')]();}}return _0x4973c2[_0x68ef('0x22')];};};Realtime[_0x68ef('0x17')][_0x68ef('0x23')]=function(){var _0x51ba3d=this;return function(_0x294fba){if(_0x294fba){freeIsNotKey(_0x294fba,_0x51ba3d[_0x68ef('0xe')],'id');for(var _0x32074a=0x0,_0x52a8b9={},_0x32eddd={};_0x32074a<_0x294fba[_0x68ef('0x1a')];_0x32074a+=0x1){_0x52a8b9=_0x294fba[_0x32074a];if(_[_0x68ef('0x1d')](_0x51ba3d['faxQueues'][_0x52a8b9['id']])){_0x51ba3d['faxQueues'][_0x52a8b9['id']]=new FaxQueue(_0x52a8b9);}else{_0x51ba3d[_0x68ef('0x18')](_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']],_0x52a8b9);}_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x1e')]();_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x20')]();}}return _0x51ba3d[_0x68ef('0xe')];};};Realtime['prototype'][_0x68ef('0x24')]=function(){var _0xd7f9ca=this;return function(_0x2f6ee0){if(_0x2f6ee0){freeIsNotKey(_0x2f6ee0,_0xd7f9ca[_0x68ef('0xf')],'id');for(var _0x492b74=0x0,_0x3cb156={},_0x3a2f53={};_0x492b74<_0x2f6ee0[_0x68ef('0x1a')];_0x492b74+=0x1){_0x3cb156=_0x2f6ee0[_0x492b74];if(_[_0x68ef('0x1d')](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']])){_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']]=new WhatsappQueue(_0x3cb156);}else{_0xd7f9ca['mergeFromDatabase'](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']],_0x3cb156);}_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x1e')]();_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x20')]();}}return _0xd7f9ca[_0x68ef('0xf')];};};module[_0x68ef('0x25')]=Realtime; \ No newline at end of file +var _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x2d44f9,_0x2814c5){var _0x4a8bb4=function(_0x39b8ff){while(--_0x39b8ff){_0x2d44f9['push'](_0x2d44f9['shift']());}};_0x4a8bb4(++_0x2814c5);}(_0xa41a,0x6b));var _0xaa41=function(_0x59006c,_0x4c8bde){_0x59006c=_0x59006c-0x0;var _0x1b5b2f=_0xa41a[_0x59006c];return _0x1b5b2f;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index f2be5a3..2bb02d9 100644 --- a/server/services/routing/rpc/chatInteraction.js +++ b/server/services/routing/rpc/chatInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa22a=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x49157b,_0x5d8601){var _0x3ea5d4=function(_0x4c2905){while(--_0x4c2905){_0x49157b['push'](_0x49157b['shift']());}};_0x3ea5d4(++_0x5d8601);}(_0xa22a,0x158));var _0xaa22=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa22a[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xaa22('0x0'));exports[_0xaa22('0x1')]=function(_0x4d3c76,_0x335065){return client[_0xaa22('0x2')](_0xaa22('0x3'),{'body':_0x335065,'options':{'where':{'id':_0x4d3c76}},'log':_0xaa22('0x4')});};exports[_0xaa22('0x5')]=function(_0x4d0471,_0x3dd122){return client[_0xaa22('0x2')](_0xaa22('0x6'),{'body':_0x3dd122,'options':{'where':{'id':_0x4d0471}},'log':_0xaa22('0x7')});}; \ No newline at end of file +var _0xb2df=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x217a65,_0x3344f6){var _0x135aa4=function(_0x17ad20){while(--_0x17ad20){_0x217a65['push'](_0x217a65['shift']());}};_0x135aa4(++_0x3344f6);}(_0xb2df,0x132));var _0xfb2d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb2df[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xfb2d('0x0'));exports[_0xfb2d('0x1')]=function(_0x883059,_0x469a2c){return client[_0xfb2d('0x2')]('UpdateChatInteraction',{'body':_0x469a2c,'options':{'where':{'id':_0x883059}},'log':_0xfb2d('0x3')});};exports[_0xfb2d('0x4')]=function(_0x4e40b1,_0x3a4b21){return client[_0xfb2d('0x2')](_0xfb2d('0x5'),{'body':_0x3a4b21,'options':{'where':{'id':_0x4e40b1}},'log':_0xfb2d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2efc115..5f9244a 100644 --- a/server/services/routing/rpc/chatMessage.js +++ b/server/services/routing/rpc/chatMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x459c=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x3050ca,_0x3e36b0){var _0x1eed1d=function(_0x195e8f){while(--_0x195e8f){_0x3050ca['push'](_0x3050ca['shift']());}};_0x1eed1d(++_0x3e36b0);}(_0x459c,0x126));var _0xc459=function(_0x295d2b,_0x5c267a){_0x295d2b=_0x295d2b-0x0;var _0x5ec948=_0x459c[_0x295d2b];return _0x5ec948;};'use strict';var client=require(_0xc459('0x0'));exports[_0xc459('0x1')]=function(_0x5a6687){return client[_0xc459('0x2')](_0xc459('0x3'),{'body':_0x5a6687,'log':_0xc459('0x4')});}; \ No newline at end of file +var _0xfdfa=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0xfdfa,0x190));var _0xafdf=function(_0x25f0d5,_0xc2dbf1){_0x25f0d5=_0x25f0d5-0x0;var _0x3dac6b=_0xfdfa[_0x25f0d5];return _0x3dac6b;};'use strict';var client=require(_0xafdf('0x0'));exports[_0xafdf('0x1')]=function(_0x2d9c8a){return client[_0xafdf('0x2')](_0xafdf('0x3'),{'body':_0x2d9c8a,'log':_0xafdf('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0af49bd..0ae034e 100644 --- a/server/services/routing/rpc/chatQueue.js +++ b/server/services/routing/rpc/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x749d=['Request','strategy','User','Agents','name','online','../client','getChatQueues'];(function(_0x4ef83d,_0x34aac3){var _0x138672=function(_0x120ef2){while(--_0x120ef2){_0x4ef83d['push'](_0x4ef83d['shift']());}};_0x138672(++_0x34aac3);}(_0x749d,0x19e));var _0xd749=function(_0x5ca38b,_0x4041d8){_0x5ca38b=_0x5ca38b-0x0;var _0xbb19ec=_0x749d[_0x5ca38b];return _0xbb19ec;};'use strict';var client=require(_0xd749('0x0'));exports[_0xd749('0x1')]=function(){return function(){return client[_0xd749('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xd749('0x3')],'include':[{'model':_0xd749('0x4'),'as':_0xd749('0x5'),'attributes':['id',_0xd749('0x6'),_0xd749('0x7'),'chatPause']}]},'log':_0xd749('0x1')});};}; \ No newline at end of file +var _0x7686=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7686,0x1ae));var _0x6768=function(_0x1e9bf1,_0x4627c9){_0x1e9bf1=_0x1e9bf1-0x0;var _0x1e509d=_0x7686[_0x1e9bf1];return _0x1e509d;};'use strict';var client=require(_0x6768('0x0'));exports[_0x6768('0x1')]=function(){return function(){return client[_0x6768('0x2')](_0x6768('0x3'),{'options':{'raw':![],'attributes':['id',_0x6768('0x4'),_0x6768('0x5'),_0x6768('0x6')],'include':[{'model':_0x6768('0x7'),'as':_0x6768('0x8'),'attributes':['id',_0x6768('0x4'),_0x6768('0x9'),_0x6768('0xa')]}]},'log':_0x6768('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index f095fa5..a6dd6c9 100644 --- a/server/services/routing/rpc/chatQueueReport.js +++ b/server/services/routing/rpc/chatQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x740a=['UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x4dfe3d,_0x3b9249){var _0x4d3f92=function(_0x2387e2){while(--_0x2387e2){_0x4dfe3d['push'](_0x4dfe3d['shift']());}};_0x4d3f92(++_0x3b9249);}(_0x740a,0x175));var _0xa740=function(_0x59ca41,_0x27cab0){_0x59ca41=_0x59ca41-0x0;var _0x46b259=_0x740a[_0x59ca41];return _0x46b259;};'use strict';var client=require(_0xa740('0x0'));exports[_0xa740('0x1')]=function(_0x4a2de4){return client[_0xa740('0x2')](_0xa740('0x3'),{'body':_0x4a2de4,'log':_0xa740('0x3')});};exports[_0xa740('0x4')]=function(_0xd73d1e,_0x4e3da6){return client[_0xa740('0x2')]('UpdateChatQueueReport',{'body':_0x4e3da6,'options':{'where':{'uniqueid':_0xd73d1e},'order':[['id','DESC']],'limit':0x1},'log':_0xa740('0x5')});}; \ No newline at end of file +var _0x79a8=['UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79a8,0x1d0));var _0x879a=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0x79a8[_0x58803c];return _0xf95b9b;};'use strict';var client=require(_0x879a('0x0'));exports['create']=function(_0x244704){return client[_0x879a('0x1')](_0x879a('0x2'),{'body':_0x244704,'log':'CreateChatQueueReport'});};exports[_0x879a('0x3')]=function(_0x49b7c0,_0x46ee67){return client[_0x879a('0x1')](_0x879a('0x4'),{'body':_0x46ee67,'options':{'where':{'uniqueid':_0x49b7c0},'order':[['id',_0x879a('0x5')]],'limit':0x1},'log':_0x879a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8edc59a..4cc6238 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ec2=['update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0x5ec2,0x18c));var _0x25ec=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0x5ec2[_0x54c10d];return _0x1fa703;};'use strict';var client=require('../client');exports[_0x25ec('0x0')]=function(_0x2e860a,_0x63deb8){return client[_0x25ec('0x1')](_0x25ec('0x2'),{'body':_0x63deb8,'options':{'where':{'id':_0x2e860a}},'log':_0x25ec('0x3')});};exports[_0x25ec('0x4')]=function(_0x5c0d18,_0x4558f6){return client['Request'](_0x25ec('0x5'),{'body':_0x4558f6,'options':{'where':{'id':_0x5c0d18}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xae04=['update','updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x5b9429,_0xe8d8f1){var _0x2aae0f=function(_0x3a203d){while(--_0x3a203d){_0x5b9429['push'](_0x5b9429['shift']());}};_0x2aae0f(++_0xe8d8f1);}(_0xae04,0x179));var _0x4ae0=function(_0x55bd38,_0x48eacf){_0x55bd38=_0x55bd38-0x0;var _0x444323=_0xae04[_0x55bd38];return _0x444323;};'use strict';var client=require(_0x4ae0('0x0'));exports[_0x4ae0('0x1')]=function(_0x1b9cab,_0x5b22ea){return client['Request']('UpdateFaxInteraction',{'body':_0x5b22ea,'options':{'where':{'id':_0x1b9cab}},'log':_0x4ae0('0x2')});};exports[_0x4ae0('0x3')]=function(_0x38275f,_0x5119a4){return client[_0x4ae0('0x4')](_0x4ae0('0x5'),{'body':_0x5119a4,'options':{'where':{'id':_0x38275f}},'log':_0x4ae0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index b48f913..20e7721 100644 --- a/server/services/routing/rpc/faxMessage.js +++ b/server/services/routing/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3668=['CreateFaxMessage','../client','create','Request'];(function(_0x5ddacf,_0x49edd0){var _0x5eff5f=function(_0x2265a5){while(--_0x2265a5){_0x5ddacf['push'](_0x5ddacf['shift']());}};_0x5eff5f(++_0x49edd0);}(_0x3668,0xc5));var _0x8366=function(_0x115610,_0x5bfa9b){_0x115610=_0x115610-0x0;var _0x465985=_0x3668[_0x115610];return _0x465985;};'use strict';var client=require(_0x8366('0x0'));exports[_0x8366('0x1')]=function(_0x47a071){return client[_0x8366('0x2')](_0x8366('0x3'),{'body':_0x47a071,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x1ea7=['Request','CreateFaxMessage','../client','create'];(function(_0x3a2f92,_0xe5bc3b){var _0xe8a6d=function(_0x1ed7f1){while(--_0x1ed7f1){_0x3a2f92['push'](_0x3a2f92['shift']());}};_0xe8a6d(++_0xe5bc3b);}(_0x1ea7,0xb2));var _0x71ea=function(_0xf10ab2,_0x4139fa){_0xf10ab2=_0xf10ab2-0x0;var _0x4c6629=_0x1ea7[_0xf10ab2];return _0x4c6629;};'use strict';var client=require(_0x71ea('0x0'));exports[_0x71ea('0x1')]=function(_0x3f46c8){return client[_0x71ea('0x2')](_0x71ea('0x3'),{'body':_0x3f46c8,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 34fd800..e905b2e 100644 --- a/server/services/routing/rpc/faxQueue.js +++ b/server/services/routing/rpc/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa498=['GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause','getFaxQueues','Request'];(function(_0x5631e5,_0x373f18){var _0x477444=function(_0xc373a7){while(--_0xc373a7){_0x5631e5['push'](_0x5631e5['shift']());}};_0x477444(++_0x373f18);}(_0xa498,0xe4));var _0x8a49=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0xa498[_0x219d87];return _0x22823d;};'use strict';var client=require('../client');exports[_0x8a49('0x0')]=function(){return function(){return client[_0x8a49('0x1')](_0x8a49('0x2'),{'options':{'raw':![],'attributes':['id',_0x8a49('0x3'),_0x8a49('0x4'),_0x8a49('0x5')],'include':[{'model':_0x8a49('0x6'),'as':_0x8a49('0x7'),'attributes':['id','name',_0x8a49('0x8'),_0x8a49('0x9')]}]},'log':_0x8a49('0x0')});};}; \ No newline at end of file +var _0x99c5=['name','timeout','strategy','User','Agents','online','../client','getFaxQueues','GetFaxQueue'];(function(_0x22016f,_0x790dbf){var _0xbb5702=function(_0x4c3fa3){while(--_0x4c3fa3){_0x22016f['push'](_0x22016f['shift']());}};_0xbb5702(++_0x790dbf);}(_0x99c5,0xde));var _0x599c=function(_0x321546,_0x41b964){_0x321546=_0x321546-0x0;var _0xfea202=_0x99c5[_0x321546];return _0xfea202;};'use strict';var client=require(_0x599c('0x0'));exports[_0x599c('0x1')]=function(){return function(){return client['Request'](_0x599c('0x2'),{'options':{'raw':![],'attributes':['id',_0x599c('0x3'),_0x599c('0x4'),_0x599c('0x5')],'include':[{'model':_0x599c('0x6'),'as':_0x599c('0x7'),'attributes':['id',_0x599c('0x3'),_0x599c('0x8'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 402f71c..499e69d 100644 --- a/server/services/routing/rpc/faxQueueReport.js +++ b/server/services/routing/rpc/faxQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5692=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x468837,_0x5f0a68){var _0x7c161e=function(_0x340946){while(--_0x340946){_0x468837['push'](_0x468837['shift']());}};_0x7c161e(++_0x5f0a68);}(_0x5692,0x14a));var _0x2569=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5692[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x2569('0x0'));exports[_0x2569('0x1')]=function(_0x615966){return client[_0x2569('0x2')]('CreateFaxQueueReport',{'body':_0x615966,'log':_0x2569('0x3')});};exports[_0x2569('0x4')]=function(_0x3513e9,_0x304540){return client[_0x2569('0x2')](_0x2569('0x5'),{'body':_0x304540,'options':{'where':{'uniqueid':_0x3513e9},'order':[['id','DESC']],'limit':0x1},'log':_0x2569('0x5')});}; \ No newline at end of file +var _0xe068=['DESC','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x15fe68,_0xddc145){var _0x1d144c=function(_0x408370){while(--_0x408370){_0x15fe68['push'](_0x15fe68['shift']());}};_0x1d144c(++_0xddc145);}(_0xe068,0xeb));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x8e06('0x0')]=function(_0x3aebc5){return client[_0x8e06('0x1')](_0x8e06('0x2'),{'body':_0x3aebc5,'log':_0x8e06('0x2')});};exports[_0x8e06('0x3')]=function(_0x3a4f13,_0x44c96b){return client[_0x8e06('0x1')](_0x8e06('0x4'),{'body':_0x44c96b,'options':{'where':{'uniqueid':_0x3a4f13},'order':[['id',_0x8e06('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 34e6e1d..43ddc2d 100644 --- a/server/services/routing/rpc/interval.js +++ b/server/services/routing/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e6b=['name','interval','../client','getIntervals','GetInterval','Intervals'];(function(_0xfd0960,_0x5cdc54){var _0x2df480=function(_0x56f6b5){while(--_0x56f6b5){_0xfd0960['push'](_0xfd0960['shift']());}};_0x2df480(++_0x5cdc54);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9e6b[_0x5d6456];return _0x4d66c1;};'use strict';var client=require(_0xb9e6('0x0'));exports[_0xb9e6('0x1')]=function(){return function(){return client['Request'](_0xb9e6('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0xb9e6('0x3'),'attributes':['id',_0xb9e6('0x4'),_0xb9e6('0x5')]}]},'log':_0xb9e6('0x1')});};}; \ No newline at end of file +var _0x3266=['Intervals','interval','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x552e59,_0x5c4591){var _0x5e15ad=function(_0x1af238){while(--_0x1af238){_0x552e59['push'](_0x552e59['shift']());}};_0x5e15ad(++_0x5c4591);}(_0x3266,0x6a));var _0x6326=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3266[_0x53ccf2];return _0x5a2964;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(){return function(){return client[_0x6326('0x2')](_0x6326('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6326('0x4')],'include':[{'model':_0x6326('0x5'),'as':_0x6326('0x6'),'attributes':['id',_0x6326('0x4'),_0x6326('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8ccce17..eb8b2bd 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07ff=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x46dd33,_0x492982){var _0x979584=function(_0x5a414b){while(--_0x5a414b){_0x46dd33['push'](_0x46dd33['shift']());}};_0x979584(++_0x492982);}(_0x07ff,0x1ea));var _0xf07f=function(_0x3ef86f,_0x4c3c8c){_0x3ef86f=_0x3ef86f-0x0;var _0x2b9b50=_0x07ff[_0x3ef86f];return _0x2b9b50;};'use strict';var client=require('../client');exports[_0xf07f('0x0')]=function(_0x3ba2fe,_0x194bc2){return client[_0xf07f('0x1')](_0xf07f('0x2'),{'body':_0x194bc2,'options':{'where':{'id':_0x3ba2fe}},'log':_0xf07f('0x3')});};exports[_0xf07f('0x4')]=function(_0x143aac,_0x4e5e29){return client[_0xf07f('0x1')](_0xf07f('0x5'),{'body':_0x4e5e29,'options':{'where':{'id':_0x143aac}},'log':_0xf07f('0x6')});}; \ No newline at end of file +var _0xcc26=['Request','addTags','addTagsToChatInteraction','update'];(function(_0x1ae0db,_0x24c96f){var _0x110350=function(_0x5afbb1){while(--_0x5afbb1){_0x1ae0db['push'](_0x1ae0db['shift']());}};_0x110350(++_0x24c96f);}(_0xcc26,0x6b));var _0x6cc2=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0xcc26[_0x246148];return _0x453d94;};'use strict';var client=require('../client');exports[_0x6cc2('0x0')]=function(_0x1919d0,_0x31c98c){return client[_0x6cc2('0x1')]('UpdateMailInteraction',{'body':_0x31c98c,'options':{'where':{'id':_0x1919d0}},'log':'updateMailInteraction'});};exports[_0x6cc2('0x2')]=function(_0x379530,_0x3c681a){return client[_0x6cc2('0x1')]('AddTagsToMailInteraction',{'body':_0x3c681a,'options':{'where':{'id':_0x379530}},'log':_0x6cc2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index cdfef90..bcd6813 100644 --- a/server/services/routing/rpc/mailMessage.js +++ b/server/services/routing/rpc/mailMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfab8=['createMailMessage','../client','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfab8,0x1a2));var _0x8fab=function(_0x5850b9,_0x4d26a4){_0x5850b9=_0x5850b9-0x0;var _0x33ee6a=_0xfab8[_0x5850b9];return _0x33ee6a;};'use strict';var client=require(_0x8fab('0x0'));exports[_0x8fab('0x1')]=function(_0x50d819){return client['Request']('CreateMailMessage',{'body':_0x50d819,'log':_0x8fab('0x2')});}; \ No newline at end of file +var _0x715d=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x715d,0xba));var _0xd715=function(_0x12097a,_0x2a0706){_0x12097a=_0x12097a-0x0;var _0x13ff9a=_0x715d[_0x12097a];return _0x13ff9a;};'use strict';var client=require(_0xd715('0x0'));exports[_0xd715('0x1')]=function(_0x30a51e){return client['Request'](_0xd715('0x2'),{'body':_0x30a51e,'log':_0xd715('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 89ae5e5..d1a8f04 100644 --- a/server/services/routing/rpc/mailQueue.js +++ b/server/services/routing/rpc/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89f3=['name','timeout','strategy','User','Agents','online','mailPause','getMailQueues','Request'];(function(_0x4eb747,_0x2a8d80){var _0x166652=function(_0x57854c){while(--_0x57854c){_0x4eb747['push'](_0x4eb747['shift']());}};_0x166652(++_0x2a8d80);}(_0x89f3,0x1ed));var _0x389f=function(_0x2912d0,_0x3439f9){_0x2912d0=_0x2912d0-0x0;var _0x56b8c8=_0x89f3[_0x2912d0];return _0x56b8c8;};'use strict';var client=require('../client');exports[_0x389f('0x0')]=function(){return function(){return client[_0x389f('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x389f('0x2'),_0x389f('0x3'),_0x389f('0x4')],'include':[{'model':_0x389f('0x5'),'as':_0x389f('0x6'),'attributes':['id',_0x389f('0x2'),_0x389f('0x7'),_0x389f('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x81a1=['GetMailQueue','name','timeout','User','Agents','online','mailPause','getMailQueues'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x81a1,0xf7));var _0x181a=function(_0x247751,_0x2ea801){_0x247751=_0x247751-0x0;var _0x211cd1=_0x81a1[_0x247751];return _0x211cd1;};'use strict';var client=require('../client');exports[_0x181a('0x0')]=function(){return function(){return client['Request'](_0x181a('0x1'),{'options':{'raw':![],'attributes':['id',_0x181a('0x2'),_0x181a('0x3'),'strategy'],'include':[{'model':_0x181a('0x4'),'as':_0x181a('0x5'),'attributes':['id','name',_0x181a('0x6'),_0x181a('0x7')]}]},'log':_0x181a('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 8870951..c94f506 100644 --- a/server/services/routing/rpc/mailQueueReport.js +++ b/server/services/routing/rpc/mailQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x361d=['UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x361d,0x110));var _0xd361=function(_0x32f1b2,_0x235f2f){_0x32f1b2=_0x32f1b2-0x0;var _0x57e3a0=_0x361d[_0x32f1b2];return _0x57e3a0;};'use strict';var client=require(_0xd361('0x0'));exports[_0xd361('0x1')]=function(_0x221c65){return client['Request']('CreateMailQueueReport',{'body':_0x221c65,'log':_0xd361('0x2')});};exports['update']=function(_0x396b8d,_0x1c3088){return client[_0xd361('0x3')](_0xd361('0x4'),{'body':_0x1c3088,'options':{'where':{'uniqueid':_0x396b8d},'order':[['id',_0xd361('0x5')]],'limit':0x1},'log':_0xd361('0x4')});}; \ No newline at end of file +var _0xc9ea=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0xc9ea,0x150));var _0xac9e=function(_0x2789a7,_0x115aa0){_0x2789a7=_0x2789a7-0x0;var _0x3be8d7=_0xc9ea[_0x2789a7];return _0x3be8d7;};'use strict';var client=require('../client');exports[_0xac9e('0x0')]=function(_0x79883d){return client[_0xac9e('0x1')](_0xac9e('0x2'),{'body':_0x79883d,'log':_0xac9e('0x2')});};exports[_0xac9e('0x3')]=function(_0x89e4fb,_0x4dd510){return client[_0xac9e('0x1')](_0xac9e('0x4'),{'body':_0x4dd510,'options':{'where':{'uniqueid':_0x89e4fb},'order':[['id',_0xac9e('0x5')]],'limit':0x1},'log':_0xac9e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ec78ad0..c750137 100644 --- a/server/services/routing/rpc/openchannelInteraction.js +++ b/server/services/routing/rpc/openchannelInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4863=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x250c41,_0x48fbb1){var _0x1e2e32=function(_0x5e50b5){while(--_0x5e50b5){_0x250c41['push'](_0x250c41['shift']());}};_0x1e2e32(++_0x48fbb1);}(_0x4863,0x17d));var _0x3486=function(_0x5730c4,_0x1b8d02){_0x5730c4=_0x5730c4-0x0;var _0x4dc48d=_0x4863[_0x5730c4];return _0x4dc48d;};'use strict';var client=require(_0x3486('0x0'));exports[_0x3486('0x1')]=function(_0xc5c585,_0x2e2ec7){return client[_0x3486('0x2')](_0x3486('0x3'),{'body':_0x2e2ec7,'options':{'where':{'id':_0xc5c585}},'log':_0x3486('0x4')});};exports[_0x3486('0x5')]=function(_0x1ba34e,_0x59439e){return client[_0x3486('0x2')](_0x3486('0x6'),{'body':_0x59439e,'options':{'where':{'id':_0x1ba34e}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x7f7a=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x54a191,_0x3381cf){var _0x39b21f=function(_0x23b03f){while(--_0x23b03f){_0x54a191['push'](_0x54a191['shift']());}};_0x39b21f(++_0x3381cf);}(_0x7f7a,0x14f));var _0xa7f7=function(_0x3c8e71,_0x5d7506){_0x3c8e71=_0x3c8e71-0x0;var _0x5414e2=_0x7f7a[_0x3c8e71];return _0x5414e2;};'use strict';var client=require('../client');exports[_0xa7f7('0x0')]=function(_0x1f2a14,_0x50aa87){return client[_0xa7f7('0x1')](_0xa7f7('0x2'),{'body':_0x50aa87,'options':{'where':{'id':_0x1f2a14}},'log':'updateOpenchannelInteraction'});};exports[_0xa7f7('0x3')]=function(_0x32c7b4,_0x13b76c){return client[_0xa7f7('0x1')](_0xa7f7('0x4'),{'body':_0x13b76c,'options':{'where':{'id':_0x32c7b4}},'log':_0xa7f7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 1da7cc0..e2c1cf2 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a19=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x1db653,_0x3a9940){var _0x156348=function(_0x5ec560){while(--_0x5ec560){_0x1db653['push'](_0x1db653['shift']());}};_0x156348(++_0x3a9940);}(_0x9a19,0x114));var _0x99a1=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x9a19[_0x2aa0e7];return _0x1472c0;};'use strict';var client=require(_0x99a1('0x0'));exports[_0x99a1('0x1')]=function(_0x3d860b){return client['Request'](_0x99a1('0x2'),{'body':_0x3d860b,'log':_0x99a1('0x3')});}; \ No newline at end of file +var _0x34e8=['../client','create','Request','createOpenchannelMessage'];(function(_0x2e3967,_0x251916){var _0x5d2cd9=function(_0x5b199d){while(--_0x5b199d){_0x2e3967['push'](_0x2e3967['shift']());}};_0x5d2cd9(++_0x251916);}(_0x34e8,0x12c));var _0x834e=function(_0x4095e4,_0x36b9e9){_0x4095e4=_0x4095e4-0x0;var _0x462b94=_0x34e8[_0x4095e4];return _0x462b94;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateOpenchannelMessage',{'body':_0x8b339,'log':_0x834e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6107b45..22767a3 100644 --- a/server/services/routing/rpc/openchannelQueue.js +++ b/server/services/routing/rpc/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1330=['Agents','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x59b0d7,_0x6e4e95){var _0x2e57fc=function(_0x45fa44){while(--_0x45fa44){_0x59b0d7['push'](_0x59b0d7['shift']());}};_0x2e57fc(++_0x6e4e95);}(_0x1330,0xbf));var _0x0133=function(_0x101094,_0x5d3900){_0x101094=_0x101094-0x0;var _0x3d6d75=_0x1330[_0x101094];return _0x3d6d75;};'use strict';var client=require('../client');exports[_0x0133('0x0')]=function(){return function(){return client[_0x0133('0x1')](_0x0133('0x2'),{'options':{'raw':![],'attributes':['id',_0x0133('0x3'),_0x0133('0x4'),_0x0133('0x5')],'include':[{'model':_0x0133('0x6'),'as':_0x0133('0x7'),'attributes':['id',_0x0133('0x3'),'online',_0x0133('0x8')]}]},'log':_0x0133('0x0')});};}; \ No newline at end of file +var _0x7d37=['name','timeout','strategy','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x27f1e2,_0x40bb34){var _0x5e1307=function(_0x22dc6b){while(--_0x22dc6b){_0x27f1e2['push'](_0x27f1e2['shift']());}};_0x5e1307(++_0x40bb34);}(_0x7d37,0x138));var _0x77d3=function(_0x2af97a,_0x45cac9){_0x2af97a=_0x2af97a-0x0;var _0x24ca13=_0x7d37[_0x2af97a];return _0x24ca13;};'use strict';var client=require('../client');exports[_0x77d3('0x0')]=function(){return function(){return client[_0x77d3('0x1')](_0x77d3('0x2'),{'options':{'raw':![],'attributes':['id',_0x77d3('0x3'),_0x77d3('0x4'),_0x77d3('0x5')],'include':[{'model':'User','as':_0x77d3('0x6'),'attributes':['id',_0x77d3('0x3'),_0x77d3('0x7'),_0x77d3('0x8')]}]},'log':_0x77d3('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 9c8682e..9b541fd 100644 --- a/server/services/routing/rpc/openchannelQueueReport.js +++ b/server/services/routing/rpc/openchannelQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9df=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9df,0xae));var _0xfe9d=function(_0x573ef3,_0x5744c7){_0x573ef3=_0x573ef3-0x0;var _0x29880d=_0xe9df[_0x573ef3];return _0x29880d;};'use strict';var client=require(_0xfe9d('0x0'));exports[_0xfe9d('0x1')]=function(_0xf2124b){return client[_0xfe9d('0x2')](_0xfe9d('0x3'),{'body':_0xf2124b,'log':_0xfe9d('0x3')});};exports[_0xfe9d('0x4')]=function(_0x21bc30,_0x30d38a){return client[_0xfe9d('0x2')](_0xfe9d('0x5'),{'body':_0x30d38a,'options':{'where':{'uniqueid':_0x21bc30},'order':[['id','DESC']],'limit':0x1},'log':_0xfe9d('0x5')});}; \ No newline at end of file +var _0xe0a1=['UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0xe0a1,0x10a));var _0x1e0a=function(_0x58b6fe,_0x1b20c4){_0x58b6fe=_0x58b6fe-0x0;var _0x12d78e=_0xe0a1[_0x58b6fe];return _0x12d78e;};'use strict';var client=require('../client');exports[_0x1e0a('0x0')]=function(_0x534556){return client[_0x1e0a('0x1')](_0x1e0a('0x2'),{'body':_0x534556,'log':'CreateOpenchannelQueueReport'});};exports[_0x1e0a('0x3')]=function(_0x248c57,_0x2de6da){return client['Request'](_0x1e0a('0x4'),{'body':_0x2de6da,'options':{'where':{'uniqueid':_0x248c57},'order':[['id',_0x1e0a('0x5')]],'limit':0x1},'log':_0x1e0a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 965a449..4c45ebe 100644 --- a/server/services/routing/rpc/smsInteraction.js +++ b/server/services/routing/rpc/smsInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c47=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request'];(function(_0x5ce662,_0x32e96d){var _0x1d72bf=function(_0x4cc6ba){while(--_0x4cc6ba){_0x5ce662['push'](_0x5ce662['shift']());}};_0x1d72bf(++_0x32e96d);}(_0x4c47,0x7b));var _0x74c4=function(_0x43aca0,_0x4ef4b0){_0x43aca0=_0x43aca0-0x0;var _0x5cf180=_0x4c47[_0x43aca0];return _0x5cf180;};'use strict';var client=require(_0x74c4('0x0'));exports[_0x74c4('0x1')]=function(_0x40caa4,_0x53819f){return client[_0x74c4('0x2')](_0x74c4('0x3'),{'body':_0x53819f,'options':{'where':{'id':_0x40caa4}},'log':_0x74c4('0x4')});};exports[_0x74c4('0x5')]=function(_0x35acac,_0x30b6b8){return client[_0x74c4('0x2')](_0x74c4('0x6'),{'body':_0x30b6b8,'options':{'where':{'id':_0x35acac}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xfe54=['AddTagsToSmsInteraction','addTagsToSmsInteraction','update','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xfe54,0x1ec));var _0x4fe5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfe54[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0x4fe5('0x0')]=function(_0x91d2c1,_0x1c72ee){return client['Request'](_0x4fe5('0x1'),{'body':_0x1c72ee,'options':{'where':{'id':_0x91d2c1}},'log':_0x4fe5('0x2')});};exports['addTags']=function(_0x2c2d9d,_0x2b6dac){return client['Request'](_0x4fe5('0x3'),{'body':_0x2b6dac,'options':{'where':{'id':_0x2c2d9d}},'log':_0x4fe5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2e70cb7..d2ec808 100644 --- a/server/services/routing/rpc/smsMessage.js +++ b/server/services/routing/rpc/smsMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa273=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x5f10ae,_0x23f475){var _0x26b008=function(_0x18c153){while(--_0x18c153){_0x5f10ae['push'](_0x5f10ae['shift']());}};_0x26b008(++_0x23f475);}(_0xa273,0x1d5));var _0x3a27=function(_0x24d6f4,_0x4eb2c5){_0x24d6f4=_0x24d6f4-0x0;var _0x17f98e=_0xa273[_0x24d6f4];return _0x17f98e;};'use strict';var client=require(_0x3a27('0x0'));exports[_0x3a27('0x1')]=function(_0x380828){return client[_0x3a27('0x2')](_0x3a27('0x3'),{'body':_0x380828,'log':_0x3a27('0x4')});}; \ No newline at end of file +var _0x973b=['createSmsMessage','../client','create','Request'];(function(_0xab6961,_0x34eeab){var _0x22da33=function(_0x729226){while(--_0x729226){_0xab6961['push'](_0xab6961['shift']());}};_0x22da33(++_0x34eeab);}(_0x973b,0xb9));var _0xb973=function(_0x1b232b,_0x3d1740){_0x1b232b=_0x1b232b-0x0;var _0x157cf4=_0x973b[_0x1b232b];return _0x157cf4;};'use strict';var client=require(_0xb973('0x0'));exports[_0xb973('0x1')]=function(_0x105a4f){return client[_0xb973('0x2')]('CreateSmsMessage',{'body':_0x105a4f,'log':_0xb973('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index fdc6547..3bd2c42 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdc1=['User','online','smsPause','../client','Request','GetSmsQueue','name','timeout','strategy'];(function(_0x464554,_0x290237){var _0x2ab542=function(_0x24f073){while(--_0x24f073){_0x464554['push'](_0x464554['shift']());}};_0x2ab542(++_0x290237);}(_0xbdc1,0x147));var _0x1bdc=function(_0x38c010,_0x2367ed){_0x38c010=_0x38c010-0x0;var _0x1b9281=_0xbdc1[_0x38c010];return _0x1b9281;};'use strict';var client=require(_0x1bdc('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x1bdc('0x1')](_0x1bdc('0x2'),{'options':{'raw':![],'attributes':['id',_0x1bdc('0x3'),_0x1bdc('0x4'),_0x1bdc('0x5')],'include':[{'model':_0x1bdc('0x6'),'as':'Agents','attributes':['id','name',_0x1bdc('0x7'),_0x1bdc('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x4af9=['strategy','User','Agents','online','../client','getSmsQueues','name','timeout'];(function(_0x53edc6,_0x5cc3f0){var _0x4e5c8a=function(_0xa5a22f){while(--_0xa5a22f){_0x53edc6['push'](_0x53edc6['shift']());}};_0x4e5c8a(++_0x5cc3f0);}(_0x4af9,0x12c));var _0x94af=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4af9[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x94af('0x0'));exports[_0x94af('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x94af('0x2'),_0x94af('0x3'),_0x94af('0x4')],'include':[{'model':_0x94af('0x5'),'as':_0x94af('0x6'),'attributes':['id',_0x94af('0x2'),_0x94af('0x7'),'smsPause']}]},'log':_0x94af('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 54fae5d..6cf8a1f 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc64b=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xc64b,0xaf));var _0xbc64=function(_0x45b1ad,_0x215b03){_0x45b1ad=_0x45b1ad-0x0;var _0x3d5696=_0xc64b[_0x45b1ad];return _0x3d5696;};'use strict';var client=require(_0xbc64('0x0'));exports[_0xbc64('0x1')]=function(_0x279679){return client[_0xbc64('0x2')](_0xbc64('0x3'),{'body':_0x279679,'log':_0xbc64('0x3')});};exports[_0xbc64('0x4')]=function(_0x16038a,_0x376c52){return client['Request'](_0xbc64('0x5'),{'body':_0x376c52,'options':{'where':{'uniqueid':_0x16038a},'order':[['id',_0xbc64('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x3134=['Request','UpdateSmsQueueReport','DESC','../client','CreateSmsQueueReport','update'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x3134,0x99));var _0x4313=function(_0x3551ba,_0x2ddd9a){_0x3551ba=_0x3551ba-0x0;var _0x3a79f6=_0x3134[_0x3551ba];return _0x3a79f6;};'use strict';var client=require(_0x4313('0x0'));exports['create']=function(_0x36da89){return client['Request'](_0x4313('0x1'),{'body':_0x36da89,'log':_0x4313('0x1')});};exports[_0x4313('0x2')]=function(_0x3f1434,_0x28f52e){return client[_0x4313('0x3')](_0x4313('0x4'),{'body':_0x28f52e,'options':{'where':{'uniqueid':_0x3f1434},'order':[['id',_0x4313('0x5')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2358ac7..c17d832 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa367=['voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','agent','name','online','pauseType','lastPauseAt'];(function(_0x263efa,_0x10b02c){var _0x5a0699=function(_0x2ed832){while(--_0x2ed832){_0x263efa['push'](_0x263efa['shift']());}};_0x5a0699(++_0x10b02c);}(_0xa367,0x12c));var _0x7a36=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xa367[_0x9729d7];return _0x3c4ac6;};'use strict';var client=require('../client');exports[_0x7a36('0x0')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x7a36('0x1')},'attributes':['id',_0x7a36('0x2'),_0x7a36('0x3'),_0x7a36('0x4'),_0x7a36('0x5'),_0x7a36('0x6'),_0x7a36('0x7'),_0x7a36('0x8'),_0x7a36('0x9'),_0x7a36('0xa'),'whatsappPause',_0x7a36('0xb'),_0x7a36('0xc'),'mailCapacity',_0x7a36('0xd'),_0x7a36('0xe'),_0x7a36('0xf'),_0x7a36('0x10')]},'log':_0x7a36('0x0')});};}; \ No newline at end of file +var _0x80f2=['whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','mailPause','faxPause','openchannelPause','mailCapacity','faxCapacity'];(function(_0x1106e0,_0x3b3f2e){var _0x12e020=function(_0x3b0e10){while(--_0x3b0e10){_0x1106e0['push'](_0x1106e0['shift']());}};_0x12e020(++_0x3b3f2e);}(_0x80f2,0x142));var _0x280f=function(_0x357500,_0x16ebef){_0x357500=_0x357500-0x0;var _0x5611e0=_0x80f2[_0x357500];return _0x5611e0;};'use strict';var client=require('../client');exports[_0x280f('0x0')]=function(){return function(){return client[_0x280f('0x1')](_0x280f('0x2'),{'options':{'raw':!![],'where':{'role':_0x280f('0x3')},'attributes':['id',_0x280f('0x4'),_0x280f('0x5'),_0x280f('0x6'),_0x280f('0x7'),_0x280f('0x8'),'chatPause',_0x280f('0x9'),_0x280f('0xa'),'smsPause','whatsappPause',_0x280f('0xb'),'chatCapacity',_0x280f('0xc'),_0x280f('0xd'),'smsCapacity',_0x280f('0xe'),_0x280f('0xf')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 0bfdf55..0348095 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd2f=['../client','update','Request','updateWhatsappInteraction','addTags'];(function(_0x2b2ec4,_0x39fcf2){var _0x544271=function(_0x31e756){while(--_0x31e756){_0x2b2ec4['push'](_0x2b2ec4['shift']());}};_0x544271(++_0x39fcf2);}(_0xfd2f,0x14a));var _0xffd2=function(_0x1a864a,_0x56f4aa){_0x1a864a=_0x1a864a-0x0;var _0x5f27d6=_0xfd2f[_0x1a864a];return _0x5f27d6;};'use strict';var client=require(_0xffd2('0x0'));exports[_0xffd2('0x1')]=function(_0x296e43,_0x5204b6){return client[_0xffd2('0x2')]('UpdateWhatsappInteraction',{'body':_0x5204b6,'options':{'where':{'id':_0x296e43}},'log':_0xffd2('0x3')});};exports[_0xffd2('0x4')]=function(_0x492c33,_0x983987){return client[_0xffd2('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x983987,'options':{'where':{'id':_0x492c33}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x97a2=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x212000,_0x248ef4){var _0x37a58e=function(_0x34e646){while(--_0x34e646){_0x212000['push'](_0x212000['shift']());}};_0x37a58e(++_0x248ef4);}(_0x97a2,0x1b1));var _0x297a=function(_0x462e42,_0x58397e){_0x462e42=_0x462e42-0x0;var _0x556819=_0x97a2[_0x462e42];return _0x556819;};'use strict';var client=require(_0x297a('0x0'));exports['update']=function(_0x46f976,_0x41ac57){return client[_0x297a('0x1')](_0x297a('0x2'),{'body':_0x41ac57,'options':{'where':{'id':_0x46f976}},'log':_0x297a('0x3')});};exports[_0x297a('0x4')]=function(_0x2cf730,_0x42a0a0){return client['Request'](_0x297a('0x5'),{'body':_0x42a0a0,'options':{'where':{'id':_0x2cf730}},'log':_0x297a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2ddd03f..3638d72 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba3a=['create','Request','createWhatsappMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba3a,0x8f));var _0xaba3=function(_0x5d8cb7,_0x2851f7){_0x5d8cb7=_0x5d8cb7-0x0;var _0xece05d=_0xba3a[_0x5d8cb7];return _0xece05d;};'use strict';var client=require(_0xaba3('0x0'));exports[_0xaba3('0x1')]=function(_0xa65135){return client[_0xaba3('0x2')]('CreateWhatsappMessage',{'body':_0xa65135,'log':_0xaba3('0x3')});}; \ No newline at end of file +var _0xf369=['../client','create','Request','CreateWhatsappMessage'];(function(_0x327f2a,_0x599148){var _0x368867=function(_0x25d9c4){while(--_0x25d9c4){_0x327f2a['push'](_0x327f2a['shift']());}};_0x368867(++_0x599148);}(_0xf369,0x1c8));var _0x9f36=function(_0x2bb1c6,_0xc5eea9){_0x2bb1c6=_0x2bb1c6-0x0;var _0x33155b=_0xf369[_0x2bb1c6];return _0x33155b;};'use strict';var client=require(_0x9f36('0x0'));exports[_0x9f36('0x1')]=function(_0x2eba33){return client[_0x9f36('0x2')](_0x9f36('0x3'),{'body':_0x2eba33,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d9bd950..dfa8794 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd914=['timeout','strategy','User','Agents','online','../client','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0xd914,0x17f));var _0x4d91=function(_0x2731f0,_0x126b1b){_0x2731f0=_0x2731f0-0x0;var _0x36a180=_0xd914[_0x2731f0];return _0x36a180;};'use strict';var client=require(_0x4d91('0x0'));exports[_0x4d91('0x1')]=function(){return function(){return client['Request'](_0x4d91('0x2'),{'options':{'raw':![],'attributes':['id',_0x4d91('0x3'),_0x4d91('0x4'),_0x4d91('0x5')],'include':[{'model':_0x4d91('0x6'),'as':_0x4d91('0x7'),'attributes':['id','name',_0x4d91('0x8'),'whatsappPause']}]},'log':_0x4d91('0x1')});};}; \ No newline at end of file +var _0xbee3=['User','Agents','whatsappPause','getWhatsappQueues','name','timeout'];(function(_0x161e72,_0x581c2c){var _0x37ec7d=function(_0x5acc24){while(--_0x5acc24){_0x161e72['push'](_0x161e72['shift']());}};_0x37ec7d(++_0x581c2c);}(_0xbee3,0xd5));var _0x3bee=function(_0x433f3a,_0x4b0a44){_0x433f3a=_0x433f3a-0x0;var _0x3ffefa=_0xbee3[_0x433f3a];return _0x3ffefa;};'use strict';var client=require('../client');exports[_0x3bee('0x0')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x3bee('0x1'),_0x3bee('0x2'),'strategy'],'include':[{'model':_0x3bee('0x3'),'as':_0x3bee('0x4'),'attributes':['id',_0x3bee('0x1'),'online',_0x3bee('0x5')]}]},'log':_0x3bee('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index f4aef5b..532723b 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ba0=['UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x32502f,_0x343f64){var _0x575852=function(_0x4d84e9){while(--_0x4d84e9){_0x32502f['push'](_0x32502f['shift']());}};_0x575852(++_0x343f64);}(_0x8ba0,0x1a6));var _0x08ba=function(_0x37eb6c,_0x19956e){_0x37eb6c=_0x37eb6c-0x0;var _0x6353f8=_0x8ba0[_0x37eb6c];return _0x6353f8;};'use strict';var client=require(_0x08ba('0x0'));exports['create']=function(_0x322a00){return client[_0x08ba('0x1')](_0x08ba('0x2'),{'body':_0x322a00,'log':_0x08ba('0x2')});};exports[_0x08ba('0x3')]=function(_0x460452,_0x228c65){return client[_0x08ba('0x1')](_0x08ba('0x4'),{'body':_0x228c65,'options':{'where':{'uniqueid':_0x460452},'order':[['id',_0x08ba('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x34a7=['create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','../client'];(function(_0x285321,_0x47d0fb){var _0x40b9b6=function(_0x22669a){while(--_0x22669a){_0x285321['push'](_0x285321['shift']());}};_0x40b9b6(++_0x47d0fb);}(_0x34a7,0x1df));var _0x734a=function(_0x3588f5,_0x1bfc86){_0x3588f5=_0x3588f5-0x0;var _0x5a0809=_0x34a7[_0x3588f5];return _0x5a0809;};'use strict';var client=require(_0x734a('0x0'));exports[_0x734a('0x1')]=function(_0x2ab07f){return client['Request'](_0x734a('0x2'),{'body':_0x2ab07f,'log':_0x734a('0x2')});};exports[_0x734a('0x3')]=function(_0x62f10c,_0x51d32e){return client[_0x734a('0x4')](_0x734a('0x5'),{'body':_0x51d32e,'options':{'where':{'uniqueid':_0x62f10c},'order':[['id','DESC']],'limit':0x1},'log':_0x734a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 2d26fec..c6d279f 100644 --- a/server/services/routing/server/applications/agent.js +++ b/server/services/routing/server/applications/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f59=['[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','createQueue','atimeout','channel','rules'];(function(_0x12189a,_0x5ac6a7){var _0x44143d=function(_0x5eec89){while(--_0x5eec89){_0x12189a['push'](_0x12189a['shift']());}};_0x44143d(++_0x5ac6a7);}(_0x8f59,0x1dd));var _0x98f5=function(_0x1a2635,_0x2a33a8){_0x1a2635=_0x1a2635-0x0;var _0x2ccd92=_0x8f59[_0x1a2635];return _0x2ccd92;};'use strict';var schema=require('validate');var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var seqqueue=require(_0x98f5('0x2'));var logger=require(_0x98f5('0x3'))(_0x98f5('0x4'));var strategy=require(_0x98f5('0x5'));var queue=schema({'name':{'type':_0x98f5('0x6'),'required':!![],'message':_0x98f5('0x7')},'timeout':{'type':'number','message':_0x98f5('0x8')}});function writeLog(_0x21793e,_0x4dbb23,_0xb94148){return logger[_0x98f5('0x9')](util[_0x98f5('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x21793e,_0x4dbb23[_0x98f5('0xb')],_0xb94148));}function handleFindAgent(_0x1019ed){return function(_0x4af109){return _0x4af109[_0x98f5('0xb')][_0x98f5('0xc')]()===_0x1019ed['toLowerCase']();};}exports[_0x98f5('0xd')]=function(_0x3fddbb,_0x5a6c04,_0x4be09b,_0x5e87db){return function(_0x1e5f4a){try{var _0x42dd7b={'name':_0x5a6c04[0x0],'timeout':_0x5a6c04[0x1]};var _0x9f5019=queue[_0x98f5('0xe')](_0x42dd7b,{'typecast':!![]});if(_0x9f5019[_0x98f5('0xf')]){logger['error'](_0x98f5('0x10'),_0x3fddbb,_[_0x98f5('0x11')](_0x9f5019,_0x98f5('0x12'))[_0x98f5('0x13')](',\x20'));_0x1e5f4a[_0x98f5('0x14')]();}else{var _0x13eb46=_[_0x98f5('0x15')](_0x4be09b[_0x98f5('0x16')],handleFindAgent(_0x42dd7b[_0x98f5('0xb')]));if(_0x13eb46){var _0x358f4a=(_0x42dd7b['timeout']||0xa)*0x3e8;var _0xc5e8c9,_0x597913;var _0x130c1b=seqqueue[_0x98f5('0x17')](_0x358f4a);_0x130c1b['id']=_0x3fddbb;_0x130c1b[_0x98f5('0x18')]=_0x358f4a;_0x130c1b[_0x98f5('0x19')]=_0x5e87db['channel'];writeLog(_0x3fddbb,_0x13eb46,util[_0x98f5('0xa')]('START:%s',_0x358f4a));_0x4be09b[_0x98f5('0x1a')][_0x3fddbb]['on']('end',function(){logger[_0x98f5('0x9')](_0x98f5('0x1b'),_0x3fddbb);clearTimeout(_0x597913);_0x597913=undefined;_0x130c1b[_0x98f5('0x1c')]();if(_0x4be09b[_0x98f5('0x1a')][_0x3fddbb]){delete _0x4be09b[_0x98f5('0x1a')][_0x3fddbb];}_0x1e5f4a['stop']();});_0x4be09b['rules'][_0x3fddbb]['on'](_0x98f5('0x1d'),function(){if(_0x4be09b[_0x98f5('0x1a')][_0x3fddbb]){delete _0x4be09b[_0x98f5('0x1a')][_0x3fddbb];}});_0x597913=setTimeout(function(){logger[_0x98f5('0x9')](_0x98f5('0x1e'),_0x3fddbb);clearTimeout(_0x597913);_0x130c1b['close']();_0x1e5f4a['next']();},_0x358f4a);strategy[_0x98f5('0x1f')](_0x130c1b,_0x13eb46,_0x4be09b,_0x5e87db);}else{logger[_0x98f5('0x20')](_0x98f5('0x21'),_0x3fddbb,_0x42dd7b[_0x98f5('0xb')]);_0x1e5f4a[_0x98f5('0x14')]();}}}catch(_0x3bf2b5){console[_0x98f5('0x22')](_0x3bf2b5);logger[_0x98f5('0x20')](_0x98f5('0x23'),_0x3fddbb,_0x3bf2b5['stack']);_0x1e5f4a[_0x98f5('0x14')]();}};}; \ No newline at end of file +var _0xa393=['routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','agents','timeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger'];(function(_0xb043f7,_0x33645d){var _0x57c072=function(_0x4fbb3a){while(--_0x4fbb3a){_0xb043f7['push'](_0xb043f7['shift']());}};_0x57c072(++_0x33645d);}(_0xa393,0x171));var _0x3a39=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xa393[_0x68c979];return _0x4f0001;};'use strict';var schema=require(_0x3a39('0x0'));var _=require(_0x3a39('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x3a39('0x2'))(_0x3a39('0x3'));var strategy=require(_0x3a39('0x4'));var queue=schema({'name':{'type':_0x3a39('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x3a39('0x6')}});function writeLog(_0x4235b8,_0x3c96d8,_0x49e5df){return logger[_0x3a39('0x7')](util[_0x3a39('0x8')](_0x3a39('0x9'),_0x4235b8,_0x3c96d8[_0x3a39('0xa')],_0x49e5df));}function handleFindAgent(_0x21a6d0){return function(_0x4e5a8f){return _0x4e5a8f['name'][_0x3a39('0xb')]()===_0x21a6d0[_0x3a39('0xb')]();};}exports[_0x3a39('0xc')]=function(_0x195d8d,_0x218c09,_0x31bc6f,_0x207f01){return function(_0x105d15){try{var _0x2f467e={'name':_0x218c09[0x0],'timeout':_0x218c09[0x1]};var _0x4987b7=queue['validate'](_0x2f467e,{'typecast':!![]});if(_0x4987b7[_0x3a39('0xd')]){logger[_0x3a39('0xe')]('[%s][AGENT]\x20%s',_0x195d8d,_[_0x3a39('0xf')](_0x4987b7,_0x3a39('0x10'))[_0x3a39('0x11')](',\x20'));_0x105d15[_0x3a39('0x12')]();}else{var _0x358992=_['find'](_0x31bc6f[_0x3a39('0x13')],handleFindAgent(_0x2f467e['name']));if(_0x358992){var _0x53cb61=(_0x2f467e[_0x3a39('0x14')]||0xa)*0x3e8;var _0x426de8,_0x1a5905;var _0x4a2dcf=seqqueue['createQueue'](_0x53cb61);_0x4a2dcf['id']=_0x195d8d;_0x4a2dcf['atimeout']=_0x53cb61;_0x4a2dcf[_0x3a39('0x15')]=_0x207f01['channel'];writeLog(_0x195d8d,_0x358992,util[_0x3a39('0x8')](_0x3a39('0x16'),_0x53cb61));_0x31bc6f[_0x3a39('0x17')][_0x195d8d]['on'](_0x3a39('0x18'),function(){logger[_0x3a39('0x7')](_0x3a39('0x19'),_0x195d8d);clearTimeout(_0x1a5905);_0x1a5905=undefined;_0x4a2dcf[_0x3a39('0x1a')]();if(_0x31bc6f[_0x3a39('0x17')][_0x195d8d]){delete _0x31bc6f['rules'][_0x195d8d];}_0x105d15[_0x3a39('0x12')]();});_0x31bc6f[_0x3a39('0x17')][_0x195d8d]['on']('complete',function(){if(_0x31bc6f[_0x3a39('0x17')][_0x195d8d]){delete _0x31bc6f[_0x3a39('0x17')][_0x195d8d];}});_0x1a5905=setTimeout(function(){logger[_0x3a39('0x7')](_0x3a39('0x1b'),_0x195d8d);clearTimeout(_0x1a5905);_0x4a2dcf[_0x3a39('0x1a')]();_0x105d15['next']();},_0x53cb61);strategy[_0x3a39('0x1c')](_0x4a2dcf,_0x358992,_0x31bc6f,_0x207f01);}else{logger[_0x3a39('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x195d8d,_0x2f467e[_0x3a39('0xa')]);_0x105d15[_0x3a39('0x12')]();}}}catch(_0x4db703){console['log'](_0x4db703);logger['error'](_0x3a39('0x1d'),_0x195d8d,_0x4db703[_0x3a39('0x1e')]);_0x105d15[_0x3a39('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index fb8cbaf..1cced1b 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8754=['info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','error','amazonlex','providerName','providerResponse','stringify','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction'];(function(_0x5daefa,_0x4b521a){var _0x23240f=function(_0x277ae6){while(--_0x277ae6){_0x5daefa['push'](_0x5daefa['shift']());}};_0x23240f(++_0x4b521a);}(_0x8754,0x175));var _0x4875=function(_0x27b64a,_0x522049){_0x27b64a=_0x27b64a-0x0;var _0x36a247=_0x8754[_0x27b64a];return _0x36a247;};'use strict';var _=require(_0x4875('0x0'));var moment=require(_0x4875('0x1'));var AWS=require(_0x4875('0x2'));var utils=require(_0x4875('0x3'));var logger=require(_0x4875('0x4'))(_0x4875('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4875('0x6')),'smsMessage':require(_0x4875('0x7')),'faxMessage':require(_0x4875('0x8')),'whatsappMessage':require(_0x4875('0x9'))};exports['consequence']=function(_0x54e1e8,_0x33097c){return function(_0x1a14bd){try{if(!_['isNil'](this[_0x4875('0xa')]['UserId'])){logger[_0x4875('0xb')](_0x4875('0xc'),_0x54e1e8,_0x4875('0xd'));return _0x1a14bd[_0x4875('0xe')]();}var _0x53ccec={'ContactId':this[_0x4875('0xf')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x4875('0x10')]===_0x4875('0x11')||this[_0x4875('0x10')]===_0x4875('0x12')){_0x53ccec[_0x4875('0x13')]=this['interaction'][_0x4875('0x13')];}var _0x12f75c=this[_0x4875('0x10')];if(_0x12f75c===_0x4875('0x14')){_0x53ccec[_0x4875('0x15')]=this[_0x4875('0x16')]['id'];}else{_0x53ccec[_[_0x4875('0x17')](_0x12f75c)+_0x4875('0x18')]=this[_0x4875('0x16')]['id'];}_0x53ccec[_[_0x4875('0x17')](_0x12f75c)+_0x4875('0x19')]=this[_0x4875('0xa')]['id'];if(this[_0x4875('0xa')][_0x4875('0x1a')]){var _0x31b716=_0x33097c[0x4];if(!_[_0x4875('0x1b')](_0x31b716)){_0x53ccec[_0x4875('0x1c')]=utils[_0x4875('0x1d')](_0x31b716,this);return rpc[_0x12f75c+_0x4875('0x1e')][_0x4875('0x1f')](_0x53ccec)[_0x4875('0x20')](function(_0x33700d){logger[_0x4875('0xb')](_0x4875('0xc'),_0x54e1e8,_0x53ccec[_0x4875('0x1c')]);})[_0x4875('0x21')](function(_0x139e18){logger['error'](_0x4875('0xc'),_0x54e1e8,JSON['stringify'](_0x139e18));})[_0x4875('0x22')](function(){logger[_0x4875('0xb')](_0x4875('0x23'),_0x54e1e8);_0x1a14bd[_0x4875('0x24')]();});}else{logger[_0x4875('0xb')](_0x4875('0x25'),_0x54e1e8);_0x1a14bd[_0x4875('0x24')]();}}else{var _0x1a627a=this;var _0x561c9f=new AWS[(_0x4875('0x26'))]({'accessKeyId':_0x33097c[0x0],'secretAccessKey':_0x33097c[0x1],'region':_0x33097c[0x2]});var _0x41aa7a={'botAlias':_0x4875('0x27'),'botName':_0x33097c[0x3],'inputText':this[_0x4875('0x28')][_0x4875('0x1c')],'userId':this[_0x4875('0x10')]+':'+this['interaction']['id'][_0x4875('0x29')]()};_0x561c9f['postText'](_0x41aa7a,function(_0x139c96,_0x43dff8){if(_0x139c96){logger[_0x4875('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x54e1e8,_0x139c96[_0x4875('0x28')]);_0x1a14bd['next']();}else if(_0x43dff8&&_0x43dff8['message']){_0x1a627a[_0x4875('0x1c')][_0x4875('0x2b')]=_0x43dff8;_0x53ccec[_0x4875('0x1c')]=_0x43dff8['message'];_0x53ccec[_0x4875('0x2c')]='amazonlex';_0x53ccec[_0x4875('0x2d')]=JSON[_0x4875('0x2e')](_0x43dff8);return rpc[_0x12f75c+_0x4875('0x1e')][_0x4875('0x1f')](_0x53ccec)['then'](function(_0x5d70bc){logger[_0x4875('0xb')](_0x4875('0xc'),_0x54e1e8,_0x53ccec[_0x4875('0x1c')]);if(_0x43dff8['dialogState']==_0x4875('0x2f')){_0x1a14bd['next']();}else{_0x1a14bd[_0x4875('0x24')]();}})[_0x4875('0x21')](function(_0x482f9e){logger[_0x4875('0x2a')](_0x4875('0xc'),_0x54e1e8,JSON['stringify'](_0x482f9e));_0x1a14bd[_0x4875('0xe')]();});}else{_0x1a14bd['next']();}});}}catch(_0x286946){logger[_0x4875('0x2a')](_0x4875('0xc'),_0x54e1e8,JSON[_0x4875('0x2e')](_0x286946));_0x1a14bd[_0x4875('0x24')]();}};}; \ No newline at end of file +var _0x6f58=['postText','amazonlex','providerName','providerResponse','stringify','Failed','error','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','create','then','[%s][AMAZONLEX]\x20%s','body','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString'];(function(_0x5e1321,_0x5826eb){var _0x556c86=function(_0x1c5d94){while(--_0x1c5d94){_0x5e1321['push'](_0x5e1321['shift']());}};_0x556c86(++_0x5826eb);}(_0x6f58,0xf7));var _0x86f5=function(_0x34f9e8,_0x2018ac){_0x34f9e8=_0x34f9e8-0x0;var _0x3dcfa7=_0x6f58[_0x34f9e8];return _0x3dcfa7;};'use strict';var _=require(_0x86f5('0x0'));var moment=require(_0x86f5('0x1'));var AWS=require('aws-sdk');var utils=require(_0x86f5('0x2'));var logger=require(_0x86f5('0x3'))('routing');var rpc={'chatMessage':require(_0x86f5('0x4')),'openchannelMessage':require(_0x86f5('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x86f5('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x86f5('0x7'))};exports[_0x86f5('0x8')]=function(_0x199e71,_0x2c5581){return function(_0x43c422){try{if(!_[_0x86f5('0x9')](this[_0x86f5('0xa')][_0x86f5('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x199e71,_0x86f5('0xc'));return _0x43c422[_0x86f5('0xd')]();}var _0x3905b9={'ContactId':this[_0x86f5('0xe')]['id'],'sentAt':moment()[_0x86f5('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x86f5('0x10')};if(this[_0x86f5('0x11')]===_0x86f5('0x12')||this[_0x86f5('0x11')]===_0x86f5('0x13')){_0x3905b9['phone']=this['interaction'][_0x86f5('0x14')];}var _0x895efc=this[_0x86f5('0x11')];if(_0x895efc===_0x86f5('0x15')){_0x3905b9[_0x86f5('0x16')]=this['account']['id'];}else{_0x3905b9[_[_0x86f5('0x17')](_0x895efc)+_0x86f5('0x18')]=this[_0x86f5('0x19')]['id'];}_0x3905b9[_[_0x86f5('0x17')](_0x895efc)+_0x86f5('0x1a')]=this[_0x86f5('0xa')]['id'];if(this[_0x86f5('0xa')][_0x86f5('0x1b')]){var _0x1272e4=_0x2c5581[0x4];if(!_[_0x86f5('0x1c')](_0x1272e4)){_0x3905b9['body']=utils['getMustacheRender'](_0x1272e4,this);return rpc[_0x895efc+'Message'][_0x86f5('0x1d')](_0x3905b9)[_0x86f5('0x1e')](function(_0x406d37){logger['info'](_0x86f5('0x1f'),_0x199e71,_0x3905b9[_0x86f5('0x20')]);})['catch'](function(_0x5cd2d3){logger['error'](_0x86f5('0x1f'),_0x199e71,JSON['stringify'](_0x5cd2d3));})[_0x86f5('0x21')](function(){logger[_0x86f5('0x22')](_0x86f5('0x23'),_0x199e71);_0x43c422[_0x86f5('0x24')]();});}else{logger[_0x86f5('0x22')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x199e71);_0x43c422[_0x86f5('0x24')]();}}else{var _0x5c7935=this;var _0x1ee307=new AWS[(_0x86f5('0x25'))]({'accessKeyId':_0x2c5581[0x0],'secretAccessKey':_0x2c5581[0x1],'region':_0x2c5581[0x2]});var _0x12c91c={'botAlias':_0x86f5('0x26'),'botName':_0x2c5581[0x3],'inputText':this[_0x86f5('0x27')][_0x86f5('0x20')],'userId':this[_0x86f5('0x11')]+':'+this[_0x86f5('0xa')]['id'][_0x86f5('0x28')]()};_0x1ee307[_0x86f5('0x29')](_0x12c91c,function(_0x4de15a,_0x56f6f4){if(_0x4de15a){logger['error'](_0x86f5('0x1f'),_0x199e71,_0x4de15a[_0x86f5('0x27')]);_0x43c422['next']();}else if(_0x56f6f4&&_0x56f6f4[_0x86f5('0x27')]){_0x5c7935['body'][_0x86f5('0x2a')]=_0x56f6f4;_0x3905b9[_0x86f5('0x20')]=_0x56f6f4[_0x86f5('0x27')];_0x3905b9[_0x86f5('0x2b')]=_0x86f5('0x2a');_0x3905b9[_0x86f5('0x2c')]=JSON[_0x86f5('0x2d')](_0x56f6f4);return rpc[_0x895efc+'Message'][_0x86f5('0x1d')](_0x3905b9)[_0x86f5('0x1e')](function(_0x308389){logger[_0x86f5('0x22')](_0x86f5('0x1f'),_0x199e71,_0x3905b9[_0x86f5('0x20')]);if(_0x56f6f4['dialogState']==_0x86f5('0x2e')){_0x43c422['next']();}else{_0x43c422[_0x86f5('0x24')]();}})['catch'](function(_0x1817b1){logger[_0x86f5('0x2f')]('[%s][AMAZONLEX]\x20%s',_0x199e71,JSON[_0x86f5('0x2d')](_0x1817b1));_0x43c422['next']();});}else{_0x43c422[_0x86f5('0xd')]();}});}}catch(_0x647e5b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x199e71,JSON['stringify'](_0x647e5b));_0x43c422[_0x86f5('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 8a6338b..5299240 100644 --- a/server/services/routing/server/applications/autoreply.js +++ b/server/services/routing/server/applications/autoreply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53b3=['read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','channel','AccountId','upperFirst','mail','Smtp','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','replace','body','','All','auto_reply','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','create','finally','lodash','moment','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone'];(function(_0x372fef,_0x5cec4c){var _0xa57ab8=function(_0x96fc7a){while(--_0x96fc7a){_0x372fef['push'](_0x372fef['shift']());}};_0xa57ab8(++_0x5cec4c);}(_0x53b3,0x197));var _0x353b=function(_0x1f337b,_0x5512fb){_0x1f337b=_0x1f337b-0x0;var _0x5eb800=_0x53b3[_0x1f337b];return _0x5eb800;};'use strict';var _=require(_0x353b('0x0'));var moment=require(_0x353b('0x1'));var utils=require('./utils');var logger=require(_0x353b('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x353b('0x3')),'smsMessage':require(_0x353b('0x4')),'faxMessage':require(_0x353b('0x5')),'whatsappMessage':require(_0x353b('0x6'))};var mailRpc=require(_0x353b('0x7'));exports['consequence']=function(_0x1bc17e,_0x4a1590){return function(_0xfeee7f){try{if(_0x4a1590[0x0]==='1'&&(_[_0x353b('0x8')](this[_0x353b('0x9')][_0x353b('0xa')])||!this[_0x353b('0x9')]['created'])){logger['info'](_0x353b('0xb'),_0x1bc17e,_0x353b('0xc'));return _0xfeee7f[_0x353b('0xd')]();}var _0x63782e=this['channel'];var _0x38382d={'body':utils['getMustacheRender'](_0x4a1590[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0x353b('0xe')](_0x353b('0xf')),'direction':_0x353b('0x10')};if(this['message']){_0x38382d['to']=this[_0x353b('0x11')][_0x353b('0x12')]||'';_0x38382d['cc']=this[_0x353b('0x11')]['cc']||'';_0x38382d['from']=this[_0x353b('0x11')]['to']||'';_0x38382d[_0x353b('0x13')]=this[_0x353b('0x11')][_0x353b('0x13')]||'';_0x38382d[_0x353b('0x14')]=!![];if(this['message'][_0x353b('0x15')]){_0x38382d[_0x353b('0x15')]='';_0x38382d[_0x353b('0x15')]+=_[_0x353b('0x16')](this[_0x353b('0x11')]['subject'],'Re:')?'':_0x353b('0x17');_0x38382d[_0x353b('0x15')]+=this[_0x353b('0x11')][_0x353b('0x15')];}}if(this['channel']===_0x353b('0x18')){_0x38382d[_0x353b('0x19')]=this[_0x353b('0x1a')]['id'];}else{_0x38382d[_['upperFirst'](this[_0x353b('0x1b')])+_0x353b('0x1c')]=this['account']['id'];}_0x38382d[_[_0x353b('0x1d')](this[_0x353b('0x1b')])+'InteractionId']=this[_0x353b('0x9')]['id'];if(rpc[this[_0x353b('0x1b')]+'Message']){if(this['channel']===_0x353b('0x1e')){var _0x5df8df={'tls':{'rejectUnauthorized':![]}};if(this[_0x353b('0x1a')]['Smtp']['service']){_0x5df8df['service']=this[_0x353b('0x1a')][_0x353b('0x1f')]['service'];}else{_0x5df8df[_0x353b('0x20')]=this[_0x353b('0x1a')]['Smtp'][_0x353b('0x20')];_0x5df8df[_0x353b('0x21')]=this[_0x353b('0x1a')][_0x353b('0x1f')][_0x353b('0x21')];_0x5df8df['secure']=this[_0x353b('0x1a')]['Smtp'][_0x353b('0x22')];}if(this[_0x353b('0x1a')][_0x353b('0x1f')][_0x353b('0x23')]){_0x5df8df[_0x353b('0x24')]={'user':this[_0x353b('0x1a')]['Smtp'][_0x353b('0x25')],'pass':this[_0x353b('0x1a')][_0x353b('0x1f')][_0x353b('0x26')]};}_0x38382d[_0x353b('0x27')]=this['message'][_0x353b('0x28')];_0x38382d[_0x353b('0x29')]=_0x353b('0x2a')+_[_0x353b('0x2b')](_0x38382d[_0x353b('0x2c')],_0x353b('0x2d'),_0x353b('0x2e'))+_0x353b('0x2f');_0x38382d['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x353b('0x30'),'Precedence':_0x353b('0x31')};return mailRpc[_0x353b('0x32')](_0x5df8df,_0x38382d)[_0x353b('0x33')](function(_0x1baada){logger[_0x353b('0x34')](_0x353b('0x35'),_0x1bc17e);_0x38382d[_0x353b('0x28')]=_0x1baada[_0x353b('0x11')]['messageId'];return rpc[_0x63782e+_0x353b('0x36')]['create'](_0x38382d);})[_0x353b('0x33')](function(_0x4454e1){logger[_0x353b('0x34')]('[%s][AUTOREPLY]\x20%s',_0x1bc17e,JSON[_0x353b('0x37')](_0x4454e1));})[_0x353b('0x38')](function(_0x315e85){logger[_0x353b('0x39')](_0x353b('0x3a'),_0x1bc17e,JSON[_0x353b('0x37')](_0x315e85));})['finally'](function(){_0xfeee7f[_0x353b('0xd')]();});}else{return rpc[this[_0x353b('0x1b')]+_0x353b('0x36')][_0x353b('0x3b')](_0x38382d)['then'](function(_0x4e0f79){logger[_0x353b('0x34')]('[%s][AUTOREPLY]\x20%s',_0x1bc17e,_0x38382d[_0x353b('0x2c')]);})[_0x353b('0x38')](function(_0x5160b3){logger['error']('[%s][AUTOREPLY]\x20%s',_0x1bc17e,JSON[_0x353b('0x37')](_0x5160b3));})[_0x353b('0x3c')](function(){_0xfeee7f['next']();});}}}catch(_0x4bc81e){logger[_0x353b('0x39')](_0x353b('0xb'),_0x1bc17e,JSON[_0x353b('0x37')](_0x4bc81e));_0xfeee7f['stop']();}};}; \ No newline at end of file +var _0xb5b9=['../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','mail','service','host','Smtp','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','','headers','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','next','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x4d9a8d,_0x14808f){var _0x31324b=function(_0x559123){while(--_0x559123){_0x4d9a8d['push'](_0x4d9a8d['shift']());}};_0x31324b(++_0x14808f);}(_0xb5b9,0x19a));var _0x9b5b=function(_0x2ec8b0,_0x7169b){_0x2ec8b0=_0x2ec8b0-0x0;var _0x565201=_0xb5b9[_0x2ec8b0];return _0x565201;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require('./utils');var logger=require(_0x9b5b('0x0'))(_0x9b5b('0x1'));var rpc={'chatMessage':require(_0x9b5b('0x2')),'openchannelMessage':require(_0x9b5b('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9b5b('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9b5b('0x5'))};var mailRpc=require('../../mailRpc');exports[_0x9b5b('0x6')]=function(_0x1216d8,_0x388267){return function(_0x17d2bb){try{if(_0x388267[0x0]==='1'&&(_[_0x9b5b('0x7')](this[_0x9b5b('0x8')][_0x9b5b('0x9')])||!this[_0x9b5b('0x8')]['created'])){logger[_0x9b5b('0xa')](_0x9b5b('0xb'),_0x1216d8,'Autoreply\x20already\x20sent');return _0x17d2bb['next']();}var _0x666ac=this[_0x9b5b('0xc')];var _0x1ac3c5={'body':utils[_0x9b5b('0xd')](_0x388267[0x1],this),'ContactId':this[_0x9b5b('0xe')]['id'],'sentAt':moment()[_0x9b5b('0xf')](_0x9b5b('0x10')),'direction':_0x9b5b('0x11')};if(this[_0x9b5b('0x12')]){_0x1ac3c5['to']=this[_0x9b5b('0x12')][_0x9b5b('0x13')]||'';_0x1ac3c5['cc']=this['message']['cc']||'';_0x1ac3c5[_0x9b5b('0x13')]=this[_0x9b5b('0x12')]['to']||'';_0x1ac3c5['phone']=this['message'][_0x9b5b('0x14')]||'';_0x1ac3c5[_0x9b5b('0x15')]=!![];if(this[_0x9b5b('0x12')][_0x9b5b('0x16')]){_0x1ac3c5[_0x9b5b('0x16')]='';_0x1ac3c5[_0x9b5b('0x16')]+=_['startsWith'](this[_0x9b5b('0x12')][_0x9b5b('0x16')],_0x9b5b('0x17'))?'':_0x9b5b('0x18');_0x1ac3c5['subject']+=this[_0x9b5b('0x12')][_0x9b5b('0x16')];}}if(this[_0x9b5b('0xc')]===_0x9b5b('0x19')){_0x1ac3c5[_0x9b5b('0x1a')]=this[_0x9b5b('0x1b')]['id'];}else{_0x1ac3c5[_[_0x9b5b('0x1c')](this['channel'])+'AccountId']=this['account']['id'];}_0x1ac3c5[_['upperFirst'](this['channel'])+_0x9b5b('0x1d')]=this[_0x9b5b('0x8')]['id'];if(rpc[this[_0x9b5b('0xc')]+_0x9b5b('0x1e')]){if(this[_0x9b5b('0xc')]===_0x9b5b('0x1f')){var _0x583d03={'tls':{'rejectUnauthorized':![]}};if(this[_0x9b5b('0x1b')]['Smtp'][_0x9b5b('0x20')]){_0x583d03[_0x9b5b('0x20')]=this[_0x9b5b('0x1b')]['Smtp'][_0x9b5b('0x20')];}else{_0x583d03[_0x9b5b('0x21')]=this['account'][_0x9b5b('0x22')][_0x9b5b('0x21')];_0x583d03['port']=this[_0x9b5b('0x1b')]['Smtp'][_0x9b5b('0x23')];_0x583d03['secure']=this[_0x9b5b('0x1b')][_0x9b5b('0x22')][_0x9b5b('0x24')];}if(this[_0x9b5b('0x1b')][_0x9b5b('0x22')]['authentication']){_0x583d03[_0x9b5b('0x25')]={'user':this[_0x9b5b('0x1b')]['Smtp'][_0x9b5b('0x26')],'pass':this[_0x9b5b('0x1b')][_0x9b5b('0x22')][_0x9b5b('0x27')]};}_0x1ac3c5[_0x9b5b('0x28')]=this[_0x9b5b('0x12')][_0x9b5b('0x29')];_0x1ac3c5[_0x9b5b('0x2a')]=_0x9b5b('0x2b')+_[_0x9b5b('0x2c')](_0x1ac3c5['body'],_0x9b5b('0x2d'),']+(>|$)/g,''),'priorityTrue':_0x3435ce[0x1],'priorityFalse':_0x3435ce[0x2]};var _0x28b4b0=gotoif['validate'](_0x36d6d3,{'typecast':!![]});if(_0x28b4b0[_0x363f('0xb')]){logger[_0x363f('0xc')](_0x363f('0xd'),_0x12c36e,_[_0x363f('0xe')](_0x28b4b0,_0x363f('0xf'))[_0x363f('0x10')](',\x20'));_0x44a1a4[_0x363f('0x11')]();}else{try{var _0x4d5948=eval('('+_0x36d6d3[_0x363f('0x12')]+')');var _0x548615=_0x4d5948?_0x36d6d3['priorityTrue']:_0x36d6d3[_0x363f('0x13')];logger[_0x363f('0x14')](_0x363f('0x15'),_0x12c36e,_0x36d6d3[_0x363f('0x12')],_0x4d5948,_0x548615||_0x363f('0x16'));if(_0x548615){var _0x99dd6f=_['findIndex'](_0x44a1a4['rules'](),{'p':_0x548615});if(_0x99dd6f>=0x0){logger[_0x363f('0x14')](_0x363f('0x17'),_0x12c36e,_0x548615||_0x363f('0x16'),_0x99dd6f);_0x44a1a4[_0x363f('0x16')](_0x99dd6f);}else{logger[_0x363f('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x12c36e,_0x548615||_0x363f('0x16'));_0x44a1a4[_0x363f('0x11')]();}}else{_0x44a1a4[_0x363f('0x16')]();}}catch(_0x58b89f){logger[_0x363f('0xc')](_0x363f('0x18'),_0x12c36e,_0x58b89f['message']);_0x44a1a4['stop']();}}}catch(_0x310cf7){logger[_0x363f('0xc')](_0x363f('0xd'),_0x12c36e,JSON['stringify'](_0x310cf7));_0x44a1a4['stop']();}};}; \ No newline at end of file +var _0x7edc=['html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate'];(function(_0x5647eb,_0x29940c){var _0x10879c=function(_0x2d106b){while(--_0x2d106b){_0x5647eb['push'](_0x5647eb['shift']());}};_0x10879c(++_0x29940c);}(_0x7edc,0x179));var _0xc7ed=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x7edc[_0x5d7227];return _0x15ac55;};'use strict';var schema=require(_0xc7ed('0x0'));var _=require('lodash');var htmlToText=require(_0xc7ed('0x1'));var utils=require(_0xc7ed('0x2'));var logger=require(_0xc7ed('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xc7ed('0x4'),'required':!![],'message':_0xc7ed('0x5')},'priorityTrue':{'type':_0xc7ed('0x6'),'message':_0xc7ed('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xc7ed('0x8')]=function(_0x2cb8c8,_0x3285a8){return function(_0x2ee4fb){try{var _0x2ddb7a={'condition':htmlToText[_0xc7ed('0x9')](utils['getMustacheRender'](_0x3285a8[0x0],this),{'wordwrap':![]})[_0xc7ed('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3285a8[0x1],'priorityFalse':_0x3285a8[0x2]};var _0x535aeb=gotoif[_0xc7ed('0x0')](_0x2ddb7a,{'typecast':!![]});if(_0x535aeb[_0xc7ed('0xb')]){logger[_0xc7ed('0xc')](_0xc7ed('0xd'),_0x2cb8c8,_[_0xc7ed('0xe')](_0x535aeb,_0xc7ed('0xf'))[_0xc7ed('0x10')](',\x20'));_0x2ee4fb[_0xc7ed('0x11')]();}else{try{var _0x3d911f=eval('('+_0x2ddb7a[_0xc7ed('0x12')]+')');var _0xf9f8e9=_0x3d911f?_0x2ddb7a[_0xc7ed('0x13')]:_0x2ddb7a['priorityFalse'];logger[_0xc7ed('0x14')](_0xc7ed('0x15'),_0x2cb8c8,_0x2ddb7a['condition'],_0x3d911f,_0xf9f8e9||_0xc7ed('0x16'));if(_0xf9f8e9){var _0xd96383=_['findIndex'](_0x2ee4fb['rules'](),{'p':_0xf9f8e9});if(_0xd96383>=0x0){logger[_0xc7ed('0x14')](_0xc7ed('0x17'),_0x2cb8c8,_0xf9f8e9||'next',_0xd96383);_0x2ee4fb['next'](_0xd96383);}else{logger[_0xc7ed('0x14')](_0xc7ed('0x18'),_0x2cb8c8,_0xf9f8e9||_0xc7ed('0x16'));_0x2ee4fb[_0xc7ed('0x11')]();}}else{_0x2ee4fb[_0xc7ed('0x16')]();}}catch(_0x28d1c1){logger[_0xc7ed('0xc')](_0xc7ed('0x19'),_0x2cb8c8,_0x28d1c1[_0xc7ed('0xf')]);_0x2ee4fb[_0xc7ed('0x11')]();}}}catch(_0x132fca){logger[_0xc7ed('0xc')]('[%s][GOTOIF]\x20%s',_0x2cb8c8,JSON[_0xc7ed('0x1a')](_0x132fca));_0x2ee4fb['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 1c65605..7717a15 100644 --- a/server/services/routing/server/applications/gotop.js +++ b/server/services/routing/server/applications/gotop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfb7=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x5a8f77,_0x378d84){var _0x5ef5e5=function(_0x59e891){while(--_0x59e891){_0x5a8f77['push'](_0x5a8f77['shift']());}};_0x5ef5e5(++_0x378d84);}(_0xbfb7,0x1c5));var _0x7bfb=function(_0x1b664d,_0x1d8695){_0x1b664d=_0x1b664d-0x0;var _0x43af6b=_0xbfb7[_0x1b664d];return _0x43af6b;};'use strict';var schema=require(_0x7bfb('0x0'));var _=require(_0x7bfb('0x1'));var logger=require('../../../../config/logger')(_0x7bfb('0x2'));var gotop=schema({'priority':{'type':_0x7bfb('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x7bfb('0x4')]=function(_0x552f82,_0x1a34fc){return function(_0x5c6945){try{var _0x1c30bc={'priority':_0x1a34fc[0x0]};var _0x3771b1=gotop['validate'](_0x1c30bc,{'typecast':!![]});if(_0x3771b1[_0x7bfb('0x5')]){logger[_0x7bfb('0x6')](_0x7bfb('0x7'),_0x552f82,_[_0x7bfb('0x8')](_0x3771b1,'message')[_0x7bfb('0x9')](',\x20'));_0x5c6945[_0x7bfb('0xa')]();}else{logger[_0x7bfb('0xb')](_0x7bfb('0xc'),_0x552f82,_0x1c30bc[_0x7bfb('0xd')]);if(_0x1c30bc[_0x7bfb('0xd')]){var _0x16cdad=_[_0x7bfb('0xe')](_0x5c6945['rules'](),{'p':_0x1c30bc[_0x7bfb('0xd')]});if(_0x16cdad>=0x0){logger[_0x7bfb('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x552f82,_0x1c30bc[_0x7bfb('0xd')]||_0x7bfb('0xf'),_0x16cdad);_0x5c6945[_0x7bfb('0xf')](_0x16cdad);}else{logger[_0x7bfb('0xb')](_0x7bfb('0x10'),_0x552f82,_0x1c30bc[_0x7bfb('0xd')]||_0x7bfb('0xf'));_0x5c6945['stop']();}}else{_0x5c6945[_0x7bfb('0xf')]();}}}catch(_0x50a4ef){logger[_0x7bfb('0x6')](_0x7bfb('0x7'),_0x552f82,JSON[_0x7bfb('0x11')](_0x50a4ef));_0x5c6945[_0x7bfb('0xa')]();}};}; \ No newline at end of file +var _0x6767=['info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','number','length','error','[%s][GOTOP]\x20%s','map','message'];(function(_0x35d5d6,_0x3a580d){var _0x131132=function(_0x51ed54){while(--_0x51ed54){_0x35d5d6['push'](_0x35d5d6['shift']());}};_0x131132(++_0x3a580d);}(_0x6767,0xab));var _0x7676=function(_0x5e218a,_0x52be84){_0x5e218a=_0x5e218a-0x0;var _0x2a1564=_0x6767[_0x5e218a];return _0x2a1564;};'use strict';var schema=require(_0x7676('0x0'));var _=require(_0x7676('0x1'));var logger=require(_0x7676('0x2'))('routing');var gotop=schema({'priority':{'type':_0x7676('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x19dd1c,_0x2b2700){return function(_0x4c45c8){try{var _0x3c752c={'priority':_0x2b2700[0x0]};var _0x33fe5f=gotop[_0x7676('0x0')](_0x3c752c,{'typecast':!![]});if(_0x33fe5f[_0x7676('0x4')]){logger[_0x7676('0x5')](_0x7676('0x6'),_0x19dd1c,_[_0x7676('0x7')](_0x33fe5f,_0x7676('0x8'))['join'](',\x20'));_0x4c45c8['stop']();}else{logger[_0x7676('0x9')](_0x7676('0xa'),_0x19dd1c,_0x3c752c[_0x7676('0xb')]);if(_0x3c752c[_0x7676('0xb')]){var _0x56e8f6=_[_0x7676('0xc')](_0x4c45c8[_0x7676('0xd')](),{'p':_0x3c752c['priority']});if(_0x56e8f6>=0x0){logger[_0x7676('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x19dd1c,_0x3c752c[_0x7676('0xb')]||_0x7676('0xe'),_0x56e8f6);_0x4c45c8[_0x7676('0xe')](_0x56e8f6);}else{logger['info'](_0x7676('0xf'),_0x19dd1c,_0x3c752c[_0x7676('0xb')]||_0x7676('0xe'));_0x4c45c8[_0x7676('0x10')]();}}else{_0x4c45c8[_0x7676('0xe')]();}}}catch(_0x4473d1){logger[_0x7676('0x5')](_0x7676('0x6'),_0x19dd1c,JSON[_0x7676('0x11')](_0x4473d1));_0x4c45c8[_0x7676('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index e1f50f2..1370757 100644 --- a/server/services/routing/server/applications/message.js +++ b/server/services/routing/server/applications/message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d77=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','getMustacheRender','contact','channel'];(function(_0x57bb74,_0x4755ac){var _0x44e0eb=function(_0x19e800){while(--_0x19e800){_0x57bb74['push'](_0x57bb74['shift']());}};_0x44e0eb(++_0x4755ac);}(_0x6d77,0x160));var _0x76d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6d77[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var utils=require(_0x76d7('0x0'));var logger=require('../../../../config/logger')(_0x76d7('0x1'));var rpc={'chatMessage':require(_0x76d7('0x2')),'openchannelMessage':require(_0x76d7('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x76d7('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x42ec86,_0x913720){return function(_0x5c0325){try{var _0x4c99d0={'body':utils[_0x76d7('0x5')](_0x913720[0x0],this),'ContactId':this[_0x76d7('0x6')]['id']};if(this[_0x76d7('0x7')]===_0x76d7('0x8')){_0x4c99d0[_0x76d7('0x9')]=this[_0x76d7('0xa')]['id'];}else{_0x4c99d0[_[_0x76d7('0xb')](this[_0x76d7('0x7')])+_0x76d7('0xc')]=this[_0x76d7('0xa')]['id'];}_0x4c99d0[_['upperFirst'](this[_0x76d7('0x7')])+_0x76d7('0xd')]=this[_0x76d7('0xe')]['id'];if(rpc[this[_0x76d7('0x7')]+'Message']){return rpc[this[_0x76d7('0x7')]+_0x76d7('0xf')]['create'](_0x4c99d0)[_0x76d7('0x10')](function(_0x1c5723){logger[_0x76d7('0x11')](_0x76d7('0x12'),_0x42ec86,_0x4c99d0[_0x76d7('0x13')]);_0x5c0325[_0x76d7('0x14')]();})['catch'](function(_0x535be0){logger[_0x76d7('0x15')](_0x76d7('0x12'),_0x42ec86,JSON[_0x76d7('0x16')](_0x535be0));_0x5c0325[_0x76d7('0x17')]();});}}catch(_0x129127){logger[_0x76d7('0x15')](_0x76d7('0x12'),_0x42ec86,JSON['stringify'](_0x129127));_0x5c0325[_0x76d7('0x17')]();}};}; \ No newline at end of file +var _0x67e5=['./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify','stop','error'];(function(_0xf69009,_0x279b8d){var _0x4e3226=function(_0x2a9952){while(--_0x2a9952){_0xf69009['push'](_0xf69009['shift']());}};_0x4e3226(++_0x279b8d);}(_0x67e5,0xfd));var _0x567e=function(_0x42221e,_0xf6a32e){_0x42221e=_0x42221e-0x0;var _0x436d0f=_0x67e5[_0x42221e];return _0x436d0f;};'use strict';var _=require('lodash');var utils=require(_0x567e('0x0'));var logger=require(_0x567e('0x1'))('routing');var rpc={'chatMessage':require(_0x567e('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x567e('0x3')),'faxMessage':require(_0x567e('0x4')),'whatsappMessage':require(_0x567e('0x5'))};exports['consequence']=function(_0x2255ce,_0x2df44a){return function(_0x88fe16){try{var _0x1a6005={'body':utils['getMustacheRender'](_0x2df44a[0x0],this),'ContactId':this[_0x567e('0x6')]['id']};if(this[_0x567e('0x7')]==='chat'){_0x1a6005[_0x567e('0x8')]=this['account']['id'];}else{_0x1a6005[_[_0x567e('0x9')](this[_0x567e('0x7')])+_0x567e('0xa')]=this[_0x567e('0xb')]['id'];}_0x1a6005[_[_0x567e('0x9')](this['channel'])+_0x567e('0xc')]=this[_0x567e('0xd')]['id'];if(rpc[this[_0x567e('0x7')]+'Message']){return rpc[this[_0x567e('0x7')]+'Message'][_0x567e('0xe')](_0x1a6005)[_0x567e('0xf')](function(_0x5371df){logger[_0x567e('0x10')](_0x567e('0x11'),_0x2255ce,_0x1a6005['body']);_0x88fe16[_0x567e('0x12')]();})[_0x567e('0x13')](function(_0x14ec7b){logger['error'](_0x567e('0x11'),_0x2255ce,JSON[_0x567e('0x14')](_0x14ec7b));_0x88fe16[_0x567e('0x15')]();});}}catch(_0x2b5763){logger[_0x567e('0x16')](_0x567e('0x11'),_0x2255ce,JSON[_0x567e('0x14')](_0x2b5763));_0x88fe16[_0x567e('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 3c1e7c6..69f438d 100644 --- a/server/services/routing/server/applications/noop.js +++ b/server/services/routing/server/applications/noop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc265=['getMustacheRender','error','stringify','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s'];(function(_0x4c9627,_0x2af9a7){var _0x42105b=function(_0x43760c){while(--_0x43760c){_0x4c9627['push'](_0x4c9627['shift']());}};_0x42105b(++_0x2af9a7);}(_0xc265,0xeb));var _0x5c26=function(_0x49f18b,_0x160a8d){_0x49f18b=_0x49f18b-0x0;var _0x4675f8=_0xc265[_0x49f18b];return _0x4675f8;};'use strict';var utils=require(_0x5c26('0x0'));var logger=require(_0x5c26('0x1'))('routing');exports[_0x5c26('0x2')]=function(_0x46b7b2,_0x344487){return function(_0x7e5cfa){try{logger[_0x5c26('0x3')](_0x5c26('0x4'),_0x46b7b2,utils[_0x5c26('0x5')](_0x344487[0x0],this));_0x7e5cfa['next']();}catch(_0x2d69e7){logger[_0x5c26('0x6')]('[%s][NOOP]\x20%s',_0x46b7b2,JSON[_0x5c26('0x7')](_0x2d69e7));_0x7e5cfa['stop']();}};}; \ No newline at end of file +var _0x530e=['./utils','routing','consequence','info','getMustacheRender','error','[%s][NOOP]\x20%s'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x530e,0xa8));var _0xe530=function(_0x3cde60,_0x2cd24d){_0x3cde60=_0x3cde60-0x0;var _0x5178f0=_0x530e[_0x3cde60];return _0x5178f0;};'use strict';var utils=require(_0xe530('0x0'));var logger=require('../../../../config/logger')(_0xe530('0x1'));exports[_0xe530('0x2')]=function(_0x3537f4,_0x1e7db1){return function(_0x20db5c){try{logger[_0xe530('0x3')]('[%s][NOOP]\x20%s',_0x3537f4,utils[_0xe530('0x4')](_0x1e7db1[0x0],this));_0x20db5c['next']();}catch(_0x379611){logger[_0xe530('0x5')](_0xe530('0x6'),_0x3537f4,JSON['stringify'](_0x379611));_0x20db5c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 1f6795b..e0aaced 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4e739f,_0x9a0532){var _0x4c5fbd=function(_0x5632ce){while(--_0x5632ce){_0x4e739f['push'](_0x4e739f['shift']());}};_0x4c5fbd(++_0x9a0532);}(_0x008c,0x188));var _0xc008=function(_0x161d41,_0x306119){_0x161d41=_0x161d41-0x0;var _0x21daf6=_0x008c[_0x161d41];return _0x21daf6;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ No newline at end of file +var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x73fe0e,_0x294d53){var _0x3872e4=function(_0xf7a774){while(--_0xf7a774){_0x73fe0e['push'](_0x73fe0e['shift']());}};_0x3872e4(++_0x294d53);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 9d64298..c6dd953 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1294=['prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','writeLog','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','busyQueue','STOP','TIMEOUT','exports','lodash','./util','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0x55db0d,_0x35285c){var _0x4a9e63=function(_0x32eaba){while(--_0x32eaba){_0x55db0d['push'](_0x55db0d['shift']());}};_0x4a9e63(++_0x35285c);}(_0x1294,0xb8));var _0x4129=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x1294[_0x40df5f];return _0x1573f1;};'use strict';var _=require(_0x4129('0x0'));var uuid=require('uuid');var util=require(_0x4129('0x1'));var logger=require('../../../../../config/logger')(_0x4129('0x2'));var Agent=function(_0x461b4e,_0x56ce8d,_0x27422b,_0xbd37d4){this[_0x4129('0x3')]=uuid['v4']();this[_0x4129('0x4')]=_0x461b4e;this[_0x4129('0x5')]=_0x56ce8d;this[_0x4129('0x6')]=_0x27422b;this[_0x4129('0x2')]=_0xbd37d4;this[_0x4129('0x4')][_0x4129('0x7')](this[_0x4129('0x8')][_0x4129('0x9')](this),this[_0x4129('0xa')]['bind'](this));this[_0x4129('0x4')]['on'](_0x4129('0xb'),this[_0x4129('0xa')]['bind'](this));this['squeue']['on'](_0x4129('0xc'),this[_0x4129('0xd')]['bind'](this));};Agent['prototype']['push']=function(){this['squeue']['push'](this['handleRun'][_0x4129('0x9')](this),this['handleTimeout'][_0x4129('0x9')](this));};Agent[_0x4129('0xe')][_0x4129('0xd')]=function(){this[_0x4129('0xa')](!![]);};Agent[_0x4129('0xe')][_0x4129('0x8')]=function(_0x3fd124){logger[_0x4129('0xf')](_0x4129('0x10'),this[_0x4129('0x4')]['id'],this['agent']['id']);if(_[_0x4129('0x11')](this['realtime'][_0x4129('0x12')][this[_0x4129('0x5')]['id']])){logger[_0x4129('0xf')](_0x4129('0x13'),this[_0x4129('0x4')]['id'],this[_0x4129('0x5')]['id']);setTimeout(this[_0x4129('0x7')]['bind'](this),0x3e8);}else{if(this[_0x4129('0x2')][_0x4129('0x14')]||util[_0x4129('0x15')](this[_0x4129('0x4')]['id'],this[_0x4129('0x6')]['agents'][this[_0x4129('0x5')]['id']],this[_0x4129('0x4')][_0x4129('0x16')],![])){this[_0x4129('0x6')][_0x4129('0x12')][this[_0x4129('0x5')]['id']]['busy']=!![];this[_0x4129('0x6')][_0x4129('0x12')][this[_0x4129('0x5')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0x4129('0x3')],this[_0x4129('0x4')]['id'],this[_0x4129('0x6')][_0x4129('0x12')][this[_0x4129('0x5')]['id']],null,this['routing']);util[_0x4129('0x17')](this[_0x4129('0x4')]['id'],this[_0x4129('0x6')][_0x4129('0x12')][this[_0x4129('0x5')]['id']],_0x4129('0x18')+(this[_0x4129('0x2')][_0x4129('0x14')]?_0x4129('0x19'):''));}else{logger[_0x4129('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x4129('0x4')]['id'],this[_0x4129('0x5')]['id']);setTimeout(this[_0x4129('0x7')][_0x4129('0x9')](this),0x3e8);}}};Agent[_0x4129('0xe')]['handleTimeout']=function(_0x286227){if(_[_0x4129('0x11')](this[_0x4129('0x6')]['agents'][this[_0x4129('0x5')]['id']])){return logger[_0x4129('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x4129('0x5')]['id']);}else{logger[_0x4129('0xf')](_0x4129('0x1a'),this['squeue']['id'],this['agent']['id']);util[_0x4129('0x1b')](this['notificationId'],this[_0x4129('0x4')]['id'],this[_0x4129('0x6')]['agents'][this['agent']['id']],null,this[_0x4129('0x2')]);this[_0x4129('0x6')][_0x4129('0x12')][this['agent']['id']][_0x4129('0x1c')]=![];this[_0x4129('0x6')][_0x4129('0x12')][this[_0x4129('0x5')]['id']][_0x4129('0x1d')]=undefined;util[_0x4129('0x17')](this[_0x4129('0x4')]['id'],this[_0x4129('0x6')]['agents'][this[_0x4129('0x5')]['id']],_0x286227?_0x4129('0x1e'):_0x4129('0x1f'));}if(!_0x286227){setTimeout(this['push'][_0x4129('0x9')](this),0x3e8);}};function agent(_0xa67970,_0x117053,_0x10119b,_0x3e8b38){return new Agent(_0xa67970,_0x117053,_0x10119b,_0x3e8b38);}module[_0x4129('0x20')]=agent; \ No newline at end of file +var _0x1858=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','exports','lodash','./util','routing','notificationId','squeue','realtime','bind','handleTimeout','drained','prototype','push','handleDrained','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x1858,0x184));var _0x8185=function(_0x44b540,_0x327031){_0x44b540=_0x44b540-0x0;var _0x18b970=_0x1858[_0x44b540];return _0x18b970;};'use strict';var _=require(_0x8185('0x0'));var uuid=require('uuid');var util=require(_0x8185('0x1'));var logger=require('../../../../../config/logger')(_0x8185('0x2'));var Agent=function(_0x167229,_0x50929d,_0x47391f,_0x389aa5){this[_0x8185('0x3')]=uuid['v4']();this[_0x8185('0x4')]=_0x167229;this['agent']=_0x50929d;this[_0x8185('0x5')]=_0x47391f;this[_0x8185('0x2')]=_0x389aa5;this[_0x8185('0x4')]['push'](this['handleRun'][_0x8185('0x6')](this),this[_0x8185('0x7')]['bind'](this));this[_0x8185('0x4')]['on']('timeout',this[_0x8185('0x7')][_0x8185('0x6')](this));this['squeue']['on'](_0x8185('0x8'),this['handleDrained'][_0x8185('0x6')](this));};Agent[_0x8185('0x9')][_0x8185('0xa')]=function(){this[_0x8185('0x4')][_0x8185('0xa')](this['handleRun'][_0x8185('0x6')](this),this[_0x8185('0x7')][_0x8185('0x6')](this));};Agent[_0x8185('0x9')][_0x8185('0xb')]=function(){this[_0x8185('0x7')](!![]);};Agent['prototype'][_0x8185('0xc')]=function(_0x17851d){logger[_0x8185('0xd')](_0x8185('0xe'),this['squeue']['id'],this[_0x8185('0xf')]['id']);if(_[_0x8185('0x10')](this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']])){logger[_0x8185('0xd')](_0x8185('0x12'),this['squeue']['id'],this[_0x8185('0xf')]['id']);setTimeout(this[_0x8185('0xa')][_0x8185('0x6')](this),0x3e8);}else{if(this[_0x8185('0x2')][_0x8185('0x13')]||util['isAgentAvailable'](this[_0x8185('0x4')]['id'],this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']],this['squeue'][_0x8185('0x14')],![])){this[_0x8185('0x5')][_0x8185('0x11')][this[_0x8185('0xf')]['id']][_0x8185('0x15')]=!![];this[_0x8185('0x5')][_0x8185('0x11')][this[_0x8185('0xf')]['id']][_0x8185('0x16')]=undefined;util['showNotification'](this[_0x8185('0x3')],this['squeue']['id'],this[_0x8185('0x5')]['agents'][this['agent']['id']],null,this[_0x8185('0x2')]);util['writeLog'](this[_0x8185('0x4')]['id'],this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']],_0x8185('0x17')+(this[_0x8185('0x2')][_0x8185('0x13')]?_0x8185('0x18'):''));}else{logger[_0x8185('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x8185('0x9')][_0x8185('0x7')]=function(_0xba5f91){if(_[_0x8185('0x10')](this[_0x8185('0x5')]['agents'][this[_0x8185('0xf')]['id']])){return logger[_0x8185('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8185('0x4')]['id'],this[_0x8185('0xf')]['id']);}else{logger['info'](_0x8185('0x19'),this[_0x8185('0x4')]['id'],this[_0x8185('0xf')]['id']);util[_0x8185('0x1a')](this[_0x8185('0x3')],this[_0x8185('0x4')]['id'],this[_0x8185('0x5')][_0x8185('0x11')][this[_0x8185('0xf')]['id']],null,this[_0x8185('0x2')]);this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']][_0x8185('0x15')]=![];this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']]['busyQueue']=undefined;util[_0x8185('0x1b')](this[_0x8185('0x4')]['id'],this[_0x8185('0x5')][_0x8185('0x11')][this[_0x8185('0xf')]['id']],_0xba5f91?'STOP':'TIMEOUT');}if(!_0xba5f91){setTimeout(this[_0x8185('0xa')]['bind'](this),0x3e8);}};function agent(_0x49ed9d,_0x4c6f01,_0x559e5f,_0x4d9a85){return new Agent(_0x49ed9d,_0x4c6f01,_0x559e5f,_0x4d9a85);}module[_0x8185('0x1c')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 159e651..a88495d 100644 --- a/server/services/routing/server/applications/strategy/beepall.js +++ b/server/services/routing/server/applications/strategy/beepall.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7a4=['RINGING','busy','busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','lodash','./util','../../../../../config/logger','routing','squeue','push','bind','handleTimeout','timeout','drained','prototype','handleRun','handleDrained','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','realtime','writeLog'];(function(_0x2f33ed,_0x5c9be8){var _0x594bf2=function(_0x38a58a){while(--_0x38a58a){_0x2f33ed['push'](_0x2f33ed['shift']());}};_0x594bf2(++_0x5c9be8);}(_0xa7a4,0x1aa));var _0x4a7a=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0xa7a4[_0x2136a6];return _0x55b948;};'use strict';var _=require(_0x4a7a('0x0'));var uuid=require('uuid');var util=require(_0x4a7a('0x1'));var logger=require(_0x4a7a('0x2'))(_0x4a7a('0x3'));var Beepall=function(_0x246d41,_0x3bb151,_0x509f07,_0x1b21e3){this['notificationId']=uuid['v4']();this[_0x4a7a('0x4')]=_0x246d41;this['queue']=_0x3bb151;this['realtime']=_0x509f07;this[_0x4a7a('0x3')]=_0x1b21e3;this[_0x4a7a('0x4')][_0x4a7a('0x5')](this['handleRun'][_0x4a7a('0x6')](this),this[_0x4a7a('0x7')][_0x4a7a('0x6')](this));this['squeue']['on'](_0x4a7a('0x8'),this[_0x4a7a('0x7')][_0x4a7a('0x6')](this));this[_0x4a7a('0x4')]['on'](_0x4a7a('0x9'),this['handleDrained'][_0x4a7a('0x6')](this));};Beepall[_0x4a7a('0xa')][_0x4a7a('0x5')]=function(){this[_0x4a7a('0x4')][_0x4a7a('0x5')](this[_0x4a7a('0xb')][_0x4a7a('0x6')](this),this['handleTimeout']['bind'](this));};Beepall[_0x4a7a('0xa')][_0x4a7a('0xc')]=function(_0x6db0bf){this['handleTimeout'](!![]);};Beepall['prototype'][_0x4a7a('0xb')]=function(_0xb938f4){var _0x30434b=!![];if(!_[_0x4a7a('0xd')](this[_0x4a7a('0xe')])&&!_[_0x4a7a('0xd')](this[_0x4a7a('0xe')][_0x4a7a('0xf')])&&this['queue']['Agents'][_0x4a7a('0x10')]>0x0){for(var _0x5b860d=0x0,_0x153639;_0x5b860d0x0){for(var _0x102393=0x0,_0x1075b7;_0x1023930x0&&_0x1d7725[_0x2bebdc+'CurrentCapacity']>=_0x1d7725[_0x2bebdc+_0x6de4('0x25')]){writeLog(_0x32b237,_0x1d7725,_0x2bebdc[_0x6de4('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6de4('0x28')]=function(_0x3850fc,_0x3ae2eb,_0x267e29,_0x205c44,_0x51ab85){return sendNotification(!![],_0x3850fc,_0x3ae2eb,_0x267e29,_0x205c44,_0x51ab85);};exports[_0x6de4('0x29')]=function(_0x3fa433,_0x2baed2,_0x3a8537,_0x3c2f1c,_0x1332a9){return sendNotification(![],_0x3fa433,_0x2baed2,_0x3a8537,_0x3c2f1c,_0x1332a9);};exports[_0x6de4('0x2a')]=writeLog; \ No newline at end of file +var _0x8c7a=['remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','format','user:%s','name','emit','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save'];(function(_0x492210,_0x958354){var _0x2a8f8d=function(_0x3ea385){while(--_0x3ea385){_0x492210['push'](_0x492210['shift']());}};_0x2a8f8d(++_0x958354);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x382d9b,_0x341518){_0x382d9b=_0x382d9b-0x0;var _0x5cda42=_0x8c7a[_0x382d9b];return _0x5cda42;};'use strict';var _=require(_0xa8c7('0x0'));var util=require('util');var utils=require('../utils');var Mustache=require(_0xa8c7('0x1'));var Redis=require('ioredis');var config=require(_0xa8c7('0x2'));var logger=require(_0xa8c7('0x3'))(_0xa8c7('0x4'));config['redis']=_['defaults'](config[_0xa8c7('0x5')],{'host':_0xa8c7('0x6'),'port':0x18eb});var io=require(_0xa8c7('0x7'))(new Redis(config[_0xa8c7('0x5')]));function emit(_0x416db0,_0x4ce345,_0x37d743){io['to'](_0x416db0)['emit'](_0x4ce345,_0x37d743);}function sendNotification(_0x1338c6,_0x3bec48,_0x3e9fe9,_0x31e479,_0x15e0a1,_0x57bd28){io['to'](util[_0xa8c7('0x8')](_0xa8c7('0x9'),_0x31e479[_0xa8c7('0xa')]))[_0xa8c7('0xb')]('user:save',_0x31e479);var _0x4e2809=_0x57bd28||{};var _0x57baf7=_0x3e9fe9[_0xa8c7('0xc')]('.');var _0x19892c={'uniqueid':_0x3bec48,'channel':_0x57baf7[0x0],'id':_0x57baf7[0x1],'title':_0x57baf7[0x0]+_0xa8c7('0xd'),'interactionId':_0x57baf7[0x2],'queue':_0x15e0a1?_0x15e0a1[_0xa8c7('0xa')]:null,'sound':_0x4e2809[_0xa8c7('0xe')][_0xa8c7('0xf')],'shake':_0x4e2809[_0xa8c7('0xe')][_0xa8c7('0x10')]};try{if(!_0x4e2809['body']){_0x4e2809[_0xa8c7('0x11')]={};}if(_0x15e0a1){_0x4e2809[_0xa8c7('0x11')][_0xa8c7('0x12')]=_0x15e0a1;}else if(_0x4e2809[_0xa8c7('0x11')][_0xa8c7('0x12')]){delete _0x4e2809[_0xa8c7('0x11')][_0xa8c7('0x12')];}_0x19892c[_0xa8c7('0x13')]=utils[_0xa8c7('0x14')](_0x4e2809[_0xa8c7('0xe')][_0xa8c7('0x15')],_0x4e2809);}catch(_0x45ed68){_0x19892c['msg']=_0xa8c7('0x16');logger[_0xa8c7('0x17')](util[_0xa8c7('0x8')](_0xa8c7('0x18'),_0x3bec48,_0x45ed68[_0xa8c7('0x19')]));}io['to'](util[_0xa8c7('0x8')]('user:%s',_0x31e479[_0xa8c7('0xa')]))[_0xa8c7('0xb')](util[_0xa8c7('0x8')](_0xa8c7('0x1a'),_0x1338c6?_0xa8c7('0x1b'):_0xa8c7('0x1c')),_0x19892c);}function writeLog(_0x39cca8,_0xc26020,_0x11e250){return logger['info'](util['format'](_0xa8c7('0x1d'),_0x39cca8,_0xc26020[_0xa8c7('0xa')],_0x11e250));}exports[_0xa8c7('0x1e')]=function(_0x1e6c00,_0x2b1b7f,_0x2797d3,_0x114aea){if(_0x2b1b7f[_0xa8c7('0x1f')]){writeLog(_0x1e6c00,_0x2b1b7f,_0xa8c7('0x20'));return![];}if(!_0x2b1b7f[_0xa8c7('0x21')]){writeLog(_0x1e6c00,_0x2b1b7f,_0xa8c7('0x22'));return![];}if(_0x2b1b7f[_0x2797d3+'Pause']){writeLog(_0x1e6c00,_0x2b1b7f,_0xa8c7('0x23'));return![];}if(_0x114aea&&_0x2b1b7f[_0xa8c7('0x24')](_0x2797d3+'Capacity')&&_0x2b1b7f[_0xa8c7('0x24')](_0x2797d3+_0xa8c7('0x25'))){if(_0x2b1b7f[_0x2797d3+'Capacity']>0x0&&_0x2b1b7f[_0x2797d3+_0xa8c7('0x25')]>=_0x2b1b7f[_0x2797d3+'Capacity']){writeLog(_0x1e6c00,_0x2b1b7f,_0x2797d3[_0xa8c7('0x26')]()+_0xa8c7('0x27'));return![];}}return!![];};exports['showNotification']=function(_0xa4dbd5,_0x1f6be3,_0x230f36,_0x49b0bb,_0x3fbf68){return sendNotification(!![],_0xa4dbd5,_0x1f6be3,_0x230f36,_0x49b0bb,_0x3fbf68);};exports[_0xa8c7('0x28')]=function(_0x4d7bdf,_0x4a632c,_0x5c36f2,_0x5add5e,_0x372887){return sendNotification(![],_0x4d7bdf,_0x4a632c,_0x5c36f2,_0x5add5e,_0x372887);};exports[_0xa8c7('0x29')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index fd54166..662b18a 100644 --- a/server/services/routing/server/applications/system.js +++ b/server/services/routing/server/applications/system.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2af=['stringify','validate','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x15bc21,_0x4a7381){var _0x20b09e=function(_0x58ee11){while(--_0x58ee11){_0x15bc21['push'](_0x15bc21['shift']());}};_0x20b09e(++_0x4a7381);}(_0xd2af,0xb7));var _0xfd2a=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0xd2af[_0x43026b];return _0x4a96cd;};'use strict';var schema=require(_0xfd2a('0x0'));var sh=require('shelljs');var _=require(_0xfd2a('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xfd2a('0x2'));var system=schema({'command':{'type':_0xfd2a('0x3'),'required':!![],'message':_0xfd2a('0x4')}});exports[_0xfd2a('0x5')]=function(_0x390f8b,_0x1bcec2){return function(_0x2b8c63){try{var _0x573114={'command':_0x1bcec2[0x0]};var _0x247d5f=system[_0xfd2a('0x0')](_0x573114,{'typecast':!![]});if(_0x247d5f[_0xfd2a('0x6')]){logger[_0xfd2a('0x7')](_0xfd2a('0x8'),_0x390f8b,_[_0xfd2a('0x9')](_0x247d5f,_0xfd2a('0xa'))[_0xfd2a('0xb')](',\x20'));logger[_0xfd2a('0xc')](_0xfd2a('0xd'),_0x390f8b);_0x2b8c63[_0xfd2a('0xe')]();}else{var _0x34f446=this;var _0xf5039=utils[_0xfd2a('0xf')](_0x1bcec2[0x0],this);logger[_0xfd2a('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x390f8b,_0xf5039);sh[_0xfd2a('0x10')](_[_0xfd2a('0x11')](_0xf5039),function(_0x1771ab,_0x415b6b){logger['info'](_0xfd2a('0x12'),_0x390f8b,_0x1771ab);if(_0x1771ab==0x0){var _0x415d14=_0x415b6b[_0xfd2a('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xfd2a('0x14')](_0x1bcec2[0x1])||_[_0xfd2a('0x15')](_0x1bcec2[0x1])){logger[_0xfd2a('0xc')](_0xfd2a('0x16'),_0x390f8b);_0x34f446[_0xfd2a('0x17')][_0x1bcec2[0x1]]=_0x415d14;}else{logger[_0xfd2a('0xc')](_0xfd2a('0x18'),_0x390f8b,_0x1bcec2[0x1],_0x415d14);_0x34f446[_0xfd2a('0x17')][_0x1bcec2[0x1]]=_0x415d14;}}_0x2b8c63[_0xfd2a('0xe')]();});}}catch(_0x4e2b49){logger['error'](_0xfd2a('0x8'),_0x390f8b,_['isObject'](_0x4e2b49)?JSON[_0xfd2a('0x19')](_0x4e2b49):_0x4e2b49);logger[_0xfd2a('0xc')](_0xfd2a('0xd'),_0x390f8b);_0x2b8c63[_0xfd2a('0xe')]();}};}; \ No newline at end of file +var _0x1260=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify'];(function(_0x401afa,_0x2120c7){var _0x446804=function(_0x83642c){while(--_0x83642c){_0x401afa['push'](_0x401afa['shift']());}};_0x446804(++_0x2120c7);}(_0x1260,0x65));var _0x0126=function(_0x54abc2,_0x9b8f7f){_0x54abc2=_0x54abc2-0x0;var _0x34b33c=_0x1260[_0x54abc2];return _0x34b33c;};'use strict';var schema=require('validate');var sh=require(_0x0126('0x0'));var _=require(_0x0126('0x1'));var utils=require('./utils');var logger=require(_0x0126('0x2'))(_0x0126('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x0126('0x4')}});exports[_0x0126('0x5')]=function(_0x21d2ae,_0x21d9d0){return function(_0x4b8c3a){try{var _0x456057={'command':_0x21d9d0[0x0]};var _0x15d440=system['validate'](_0x456057,{'typecast':!![]});if(_0x15d440[_0x0126('0x6')]){logger[_0x0126('0x7')](_0x0126('0x8'),_0x21d2ae,_[_0x0126('0x9')](_0x15d440,'message')[_0x0126('0xa')](',\x20'));logger[_0x0126('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x21d2ae);_0x4b8c3a[_0x0126('0xc')]();}else{var _0xc2e109=this;var _0x422a8c=utils[_0x0126('0xd')](_0x21d9d0[0x0],this);logger[_0x0126('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x21d2ae,_0x422a8c);sh[_0x0126('0xe')](_[_0x0126('0xf')](_0x422a8c),function(_0x456288,_0x4da65b){logger[_0x0126('0xb')](_0x0126('0x10'),_0x21d2ae,_0x456288);if(_0x456288==0x0){var _0x89416=_0x4da65b[_0x0126('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x0126('0x12')](_0x21d9d0[0x1])||_['isEmpty'](_0x21d9d0[0x1])){logger[_0x0126('0xb')](_0x0126('0x13'),_0x21d2ae);_0xc2e109['body'][_0x21d9d0[0x1]]=_0x89416;}else{logger[_0x0126('0xb')](_0x0126('0x14'),_0x21d2ae,_0x21d9d0[0x1],_0x89416);_0xc2e109[_0x0126('0x15')][_0x21d9d0[0x1]]=_0x89416;}}_0x4b8c3a[_0x0126('0xc')]();});}}catch(_0xb40810){logger['error'](_0x0126('0x8'),_0x21d2ae,_[_0x0126('0x16')](_0xb40810)?JSON[_0x0126('0x17')](_0xb40810):_0xb40810);logger[_0x0126('0xb')](_0x0126('0x18'),_0x21d2ae);_0x4b8c3a[_0x0126('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 73ec351..887bd6b 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8996=['interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','message','join','next','channel','Interaction'];(function(_0x37f19a,_0x338973){var _0x5518cd=function(_0x442ff3){while(--_0x442ff3){_0x37f19a['push'](_0x37f19a['shift']());}};_0x5518cd(++_0x338973);}(_0x8996,0x19e));var _0x6899=function(_0x15d53b,_0x31c05a){_0x15d53b=_0x15d53b-0x0;var _0x31a0a8=_0x8996[_0x15d53b];return _0x31a0a8;};'use strict';var schema=require(_0x6899('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x6899('0x1')),'openchannelInteraction':require(_0x6899('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x6899('0x3')),'faxInteraction':require(_0x6899('0x4')),'whatsappInteraction':require(_0x6899('0x5'))};var logger=require(_0x6899('0x6'))(_0x6899('0x7'));var tag=schema({'tag':{'type':_0x6899('0x8'),'required':!![],'message':_0x6899('0x9')}});exports['consequence']=function(_0x36fff6,_0x2d1b7f,_0x5e528a,_0x3aca56){return function(_0x24182a){try{var _0x4a2141={'tag':_0x2d1b7f[0x0]};var _0x30d238=tag[_0x6899('0x0')](_0x4a2141,{'typecast':!![]});if(_0x30d238[_0x6899('0xa')]){logger[_0x6899('0xb')](_0x6899('0xc'),_0x36fff6,_['map'](_0x30d238,_0x6899('0xd'))[_0x6899('0xe')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x36fff6);_0x24182a[_0x6899('0xf')]();}else{var _0x39bc08={'ids':[_0x2d1b7f[0x0]]};if(rpc[_0x3aca56[_0x6899('0x10')]+_0x6899('0x11')]){rpc[_0x3aca56[_0x6899('0x10')]+'Interaction']['addTags'](_0x3aca56[_0x6899('0x12')]['id'],_0x39bc08)[_0x6899('0x13')](function(_0x21ff5d){logger[_0x6899('0x14')](_0x6899('0x15'),_0x36fff6,_0x2d1b7f[0x1],_0x3aca56[_0x6899('0x10')],_0x3aca56[_0x6899('0x12')]['id']);})[_0x6899('0x16')](function(_0xff37bf){logger[_0x6899('0xb')]('[%s][TAG]\x20%s',_0x36fff6,JSON[_0x6899('0x17')](_0xff37bf));logger[_0x6899('0x14')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x36fff6);})[_0x6899('0x18')](function(){_0x24182a[_0x6899('0xf')]();});}}}catch(_0x22b2ae){logger['error']('[%s][TAG]\x20%s',_0x36fff6,_[_0x6899('0x19')](_0x22b2ae)?JSON[_0x6899('0x17')](_0x22b2ae):_0x22b2ae);logger[_0x6899('0x14')](_0x6899('0x1a'),_0x36fff6);_0x24182a[_0x6899('0xf')]();}};}; \ No newline at end of file +var _0xa130=['error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0xa130,0x68));var _0x0a13=function(_0x8595e6,_0x370da1){_0x8595e6=_0x8595e6-0x0;var _0x3449d1=_0xa130[_0x8595e6];return _0x3449d1;};'use strict';var schema=require(_0x0a13('0x0'));var _=require(_0x0a13('0x1'));var rpc={'chatInteraction':require(_0x0a13('0x2')),'openchannelInteraction':require(_0x0a13('0x3')),'smsInteraction':require(_0x0a13('0x4')),'mailInteraction':require(_0x0a13('0x5')),'faxInteraction':require(_0x0a13('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x0a13('0x7'));var tag=schema({'tag':{'type':_0x0a13('0x8'),'required':!![],'message':_0x0a13('0x9')}});exports[_0x0a13('0xa')]=function(_0xf610e3,_0x7b76ca,_0x243223,_0x104671){return function(_0xe23dd4){try{var _0x291a41={'tag':_0x7b76ca[0x0]};var _0x58b20b=tag[_0x0a13('0x0')](_0x291a41,{'typecast':!![]});if(_0x58b20b[_0x0a13('0xb')]){logger[_0x0a13('0xc')](_0x0a13('0xd'),_0xf610e3,_[_0x0a13('0xe')](_0x58b20b,'message')[_0x0a13('0xf')](',\x20'));logger[_0x0a13('0x10')](_0x0a13('0x11'),_0xf610e3);_0xe23dd4['next']();}else{var _0x51a93c={'ids':[_0x7b76ca[0x0]]};if(rpc[_0x104671[_0x0a13('0x12')]+_0x0a13('0x13')]){rpc[_0x104671[_0x0a13('0x12')]+_0x0a13('0x13')][_0x0a13('0x14')](_0x104671['interaction']['id'],_0x51a93c)[_0x0a13('0x15')](function(_0x4ab56b){logger[_0x0a13('0x10')](_0x0a13('0x16'),_0xf610e3,_0x7b76ca[0x1],_0x104671['channel'],_0x104671[_0x0a13('0x17')]['id']);})[_0x0a13('0x18')](function(_0x59a771){logger[_0x0a13('0xc')](_0x0a13('0xd'),_0xf610e3,JSON[_0x0a13('0x19')](_0x59a771));logger[_0x0a13('0x10')](_0x0a13('0x11'),_0xf610e3);})[_0x0a13('0x1a')](function(){_0xe23dd4[_0x0a13('0x1b')]();});}}}catch(_0x3cad30){logger['error'](_0x0a13('0xd'),_0xf610e3,_[_0x0a13('0x1c')](_0x3cad30)?JSON['stringify'](_0x3cad30):_0x3cad30);logger['info'](_0x0a13('0x11'),_0xf610e3);_0xe23dd4[_0x0a13('0x1b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index a7c9faf..060cb64 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81bd=['exports','render','merge','contact','message','account','list','mustache','lodash'];(function(_0x3f3514,_0x4dbfea){var _0x1203de=function(_0x3e4603){while(--_0x3e4603){_0x3f3514['push'](_0x3f3514['shift']());}};_0x1203de(++_0x4dbfea);}(_0x81bd,0x7c));var _0xd81b=function(_0x3ad46a,_0x420179){_0x3ad46a=_0x3ad46a-0x0;var _0x1f6cfc=_0x81bd[_0x3ad46a];return _0x1f6cfc;};'use strict';var Mustache=require(_0xd81b('0x0'));var _=require(_0xd81b('0x1'));module[_0xd81b('0x2')]={'getMustacheRender':function(_0x2337b1,_0x2d27cb){return Mustache[_0xd81b('0x3')](_0x2337b1,_[_0xd81b('0x4')](_0x2d27cb['body'],{'contact':_0x2d27cb[_0xd81b('0x5')],'message':_0x2d27cb[_0xd81b('0x6')],'account':_0x2d27cb[_0xd81b('0x7')],'interaction':_0x2d27cb['interaction'],'list':_0x2d27cb[_0xd81b('0x8')]}))||'';}}; \ No newline at end of file +var _0xa44a=['mustache','render','merge','body','contact','interaction','list'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0xa44a,0x9a));var _0xaa44=function(_0x5ad171,_0x14a45b){_0x5ad171=_0x5ad171-0x0;var _0x4c9d82=_0xa44a[_0x5ad171];return _0x4c9d82;};'use strict';var Mustache=require(_0xaa44('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x4565e9,_0x1962a1){return Mustache[_0xaa44('0x1')](_0x4565e9,_[_0xaa44('0x2')](_0x1962a1[_0xaa44('0x3')],{'contact':_0x1962a1[_0xaa44('0x4')],'message':_0x1962a1['message'],'account':_0x1962a1['account'],'interaction':_0x1962a1[_0xaa44('0x5')],'list':_0x1962a1[_0xaa44('0x6')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 63996b2..8ed5570 100644 --- a/server/services/routing/server/index.js +++ b/server/services/routing/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf42c=['split','appdata','push','slice','dialogflowv2','amazonlex','tag','TagId','format','%s:%s:%s','./interval','intervals','./applications/','consequence','Push\x20new\x20rule','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','emit','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','busy','busyQueue','agents','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply'];(function(_0x5dbf4b,_0x25e076){var _0x7a636a=function(_0x29eff9){while(--_0x29eff9){_0x5dbf4b['push'](_0x5dbf4b['shift']());}};_0x7a636a(++_0x25e076);}(_0xf42c,0x15d));var _0xcf42=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0xf42c[_0x9b2bb0];return _0x2cdb3b;};'use strict';var _=require(_0xcf42('0x0'));var util=require(_0xcf42('0x1'));var path=require(_0xcf42('0x2'));var fs=require('fs');var jayson=require(_0xcf42('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var config=require(_0xcf42('0x4'));var logger=require(_0xcf42('0x5'))(_0xcf42('0x6'));var rpc={'openchannelQueueReport':require(_0xcf42('0x7')),'mailQueueReport':require(_0xcf42('0x8')),'chatQueueReport':require(_0xcf42('0x9')),'smsQueueReport':require(_0xcf42('0xa')),'faxQueueReport':require(_0xcf42('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x3f3a96,_0x569984,_0x3370d5){return util['format'](_0xcf42('0xc'),_0x3f3a96,_0x569984||0x0,_0x3370d5||0x0);}function getIntervals(_0x205057,_0x4b1227){var _0xf3da2b=[];if(!_[_0xcf42('0xd')](_0x4b1227[_0xcf42('0xe')])&&!_[_0xcf42('0xd')](_0x205057[_0x4b1227[_0xcf42('0xe')]])&&!_[_0xcf42('0xd')](_0x205057[_0x4b1227[_0xcf42('0xe')]][_0xcf42('0xf')])){_0xf3da2b=_[_0xcf42('0x10')](_0x205057[_0x4b1227[_0xcf42('0xe')]][_0xcf42('0xf')],_0xcf42('0x11'));}else if(!_['isNil'](_0x4b1227['interval'])){_0xf3da2b=[_0x4b1227[_0xcf42('0x11')]];}return _0xf3da2b;}exports[_0xcf42('0x12')]=function(_0x365051){_0x365051[_0xcf42('0x13')]={};return new BPromise(function(_0x22f766,_0x360639){var _0x3b6a63={'Start':function(_0x24a95a){var _0x1a057f=this;return new Promise(function(_0x4e5260,_0x12e478){if(_0x24a95a){try{var _0x219e89=[];var _0x4eb32e=getId(_0x24a95a[_0xcf42('0x14')],_0x24a95a[_0xcf42('0x15')]?_0x24a95a[_0xcf42('0x15')]['id']:0x0,_0x24a95a[_0xcf42('0x16')]?_0x24a95a[_0xcf42('0x16')]['id']:0x0);if(_0x24a95a[_0xcf42('0x17')]&&_['isArray'](_0x24a95a[_0xcf42('0x17')])&&_0x24a95a[_0xcf42('0x17')][_0xcf42('0x18')]){for(var _0x4875a3=0x0;_0x4875a3<_0x24a95a[_0xcf42('0x17')][_0xcf42('0x18')];_0x4875a3+=0x1){var _0x38a217=_0x24a95a[_0xcf42('0x17')][_0x4875a3];if(fs[_0xcf42('0x19')](path[_0xcf42('0x1a')](__dirname,'applications',_0x38a217[_0xcf42('0x1b')]+_0xcf42('0x1c')))){var _0x5f567e=[];switch(_0x38a217[_0xcf42('0x1b')][_0xcf42('0x1d')]()){case _0xcf42('0x1e'):var _0x2f8491=_0x38a217['appdata'][_0xcf42('0x1f')](',');_0x5f567e['push'](_0x2f8491[0x0]);_0x5f567e['push'](_0x2f8491['slice'](0x1,_0x2f8491[_0xcf42('0x18')])[_0xcf42('0x1a')](','));break;case'dialogflow':var _0x47dcec=_0x38a217[_0xcf42('0x20')][_0xcf42('0x1f')](',');_0x5f567e[_0xcf42('0x21')](_0x47dcec[0x0]);_0x5f567e[_0xcf42('0x21')](_0x47dcec[0x1]);_0x5f567e[_0xcf42('0x21')](_0x47dcec[_0xcf42('0x22')](0x2,_0x47dcec[_0xcf42('0x18')])['join'](','));break;case _0xcf42('0x23'):var _0x2caa6f=_0x38a217[_0xcf42('0x20')][_0xcf42('0x1f')](',');_0x5f567e[_0xcf42('0x21')](_0x2caa6f[0x0]);_0x5f567e[_0xcf42('0x21')](_0x2caa6f[0x1]);_0x5f567e[_0xcf42('0x21')](_0x2caa6f[0x2]);_0x5f567e[_0xcf42('0x21')](_0x2caa6f[0x3]);_0x5f567e[_0xcf42('0x21')](_0x2caa6f['slice'](0x4,_0x2caa6f[_0xcf42('0x18')])[_0xcf42('0x1a')](','));break;case _0xcf42('0x24'):var _0x255df2=_0x38a217['appdata'][_0xcf42('0x1f')](',');_0x5f567e[_0xcf42('0x21')](_0x255df2[0x0]);_0x5f567e['push'](_0x255df2[0x1]);_0x5f567e[_0xcf42('0x21')](_0x255df2[0x2]);_0x5f567e[_0xcf42('0x21')](_0x255df2[0x3]);_0x5f567e[_0xcf42('0x21')](_0x255df2['slice'](0x4,_0x255df2['length'])[_0xcf42('0x1a')](','));break;case _0xcf42('0x15'):_0x5f567e['push'](_0x38a217[_0xcf42('0x20')]);break;case _0xcf42('0x25'):_0x5f567e[_0xcf42('0x21')](_0x38a217[_0xcf42('0x26')]);_0x5f567e[_0xcf42('0x21')](_0x38a217[_0xcf42('0x20')]);break;default:_0x5f567e=_[_0xcf42('0xd')](_0x38a217['appdata'])?[]:_0x38a217[_0xcf42('0x20')]['split'](',');}var _0x5195ed={'id':util[_0xcf42('0x27')](_0xcf42('0x28'),_0x4eb32e,_0x38a217['id'],_0x38a217[_0xcf42('0x1b')]),'condition':require(_0xcf42('0x29'))['condition'](_0x4eb32e,getIntervals(_0x365051[_0xcf42('0x2a')],_0x38a217),_0x365051),'consequence':require(_0xcf42('0x2b')+_0x38a217[_0xcf42('0x1b')])[_0xcf42('0x2c')](_0x4eb32e,_0x5f567e,_0x365051,_0x24a95a),'p':_0x38a217['priority']||0x0};logger['info'](_0xcf42('0x2d'),_0x5195ed['id'],'on\x20interval',getIntervals(_0x365051[_0xcf42('0x2a')],_0x38a217)[_0xcf42('0x1a')](_0xcf42('0x2e')));_0x219e89['push'](_0x5195ed);}else{logger['error'](_0xcf42('0x2f'),path['join'](__dirname,_0xcf42('0x17'),_0x38a217['app']+_0xcf42('0x1c')));}}_0x365051[_0xcf42('0x13')][_0x4eb32e]=new RuleEngine(_0x219e89);_0x365051[_0xcf42('0x13')][_0x4eb32e][_0xcf42('0x30')](_0x24a95a,function(_0x1e32ac){logger[_0xcf42('0x31')](_0xcf42('0x32'),JSON[_0xcf42('0x33')](_0x1e32ac[_0xcf42('0x34')]));if(_0x365051[_0xcf42('0x13')][_0x4eb32e]){_0x365051['rules'][_0x4eb32e]['emit'](_0xcf42('0x35'));}});return _0x4e5260({'code':0xc8,'message':_0x24a95a});}else{logger[_0xcf42('0x31')](_0xcf42('0x36'));return _0x4e5260({'code':0xc8,'message':_0x24a95a});}}catch(_0x3d1858){logger[_0xcf42('0x37')](_0x3d1858['stack']);return _0x12e478(_0x1a057f[_0xcf42('0x37')](0x1f4,_0x3d1858));}}return _0x12e478(_0xcf42('0x38'));});},'AcceptMessage':function(_0x57fe36){var _0x18c400=this;return new Promise(function(_0x1e5fda,_0x476203){if(_0x57fe36[_0xcf42('0x15')]&&_0x57fe36[_0xcf42('0x15')]['id']){try{var _0x5bfee0=getId(_0x57fe36[_0xcf42('0x14')],_0x57fe36[_0xcf42('0x15')]?_0x57fe36['message']['id']:0x0,_0x57fe36[_0xcf42('0x16')]?_0x57fe36['interaction']['id']:0x0);if(_0x365051['rules'][_0x5bfee0]){_0x365051[_0xcf42('0x13')][_0x5bfee0][_0xcf42('0x39')](_0xcf42('0x3a'));if(rpc[_0x57fe36['channel']+_0xcf42('0x3b')]){rpc[_0x57fe36[_0xcf42('0x14')]+'QueueReport'][_0xcf42('0x3c')](_0x5bfee0,{'UserId':_0x57fe36[_0xcf42('0x15')][_0xcf42('0x3d')]})['catch'](function(_0x4ea324){logger[_0xcf42('0x37')](_0xcf42('0x3e'));});}}return _0x1e5fda({'code':0xc8,'message':_0x57fe36});}catch(_0x191739){logger[_0xcf42('0x37')](_0x191739[_0xcf42('0x3f')]);return _0x476203(_0x18c400['error'](0x1f4,_0x191739));}}logger['error'](_0xcf42('0x40'));return _0x476203(_0x18c400['error'](0x1f4,_0xcf42('0x40')));});},'RejectMessage':function(_0x144b45){var _0x4587c6=this;return new Promise(function(_0xa5305b,_0x391069){if(_0x144b45[_0xcf42('0x41')]&&_0x144b45['agent']['id']){try{if(_0x365051['agents'][_0x144b45[_0xcf42('0x41')]['id']]){_0x365051['agents'][_0x144b45[_0xcf42('0x41')]['id']][_0xcf42('0x42')]=![];_0x365051['agents'][_0x144b45[_0xcf42('0x41')]['id']][_0xcf42('0x43')]=undefined;}return _0xa5305b({'code':0xc8,'message':_0x144b45});}catch(_0x56b517){logger[_0xcf42('0x37')](_0x56b517[_0xcf42('0x3f')]);return _0x391069(_0x4587c6[_0xcf42('0x37')](0x1f4,_0x56b517));}}logger[_0xcf42('0x37')](_0xcf42('0x40'));return _0x391069(_0x4587c6[_0xcf42('0x37')](0x1f4,_0xcf42('0x40')));});},'AbandonInteraction':function(_0x10ba64){var _0x5aa3b3=this;return new Promise(function(_0x4a1f75,_0x543bd7){if(_0x10ba64['channel']&&_0x10ba64[_0xcf42('0x16')]&&_0x10ba64[_0xcf42('0x16')]['id']){try{var _0x4111c1=getId(_0x10ba64[_0xcf42('0x14')],_0x10ba64['message']?_0x10ba64[_0xcf42('0x15')]['id']:0x0,_0x10ba64[_0xcf42('0x16')]?_0x10ba64[_0xcf42('0x16')]['id']:0x0);if(_0x365051[_0xcf42('0x13')][_0x4111c1]){_0x365051['rules'][_0x4111c1]['emit'](_0xcf42('0x3a'));}return _0x4a1f75({'code':0xc8,'message':_0x10ba64});}catch(_0x432646){logger[_0xcf42('0x37')](_0x432646[_0xcf42('0x3f')]);return _0x543bd7(_0x5aa3b3[_0xcf42('0x37')](0x1f4,_0x432646));}}logger['error'](_0xcf42('0x40'));return _0x543bd7(_0x5aa3b3[_0xcf42('0x37')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x510744){var _0x52a8d4=this;return new Promise(function(_0x4663fb,_0x40f5e8){if(_0x365051[_0xcf42('0x44')]['hasOwnProperty'](_0x510744['id'])){for(var _0x5bcfa0 in _0x510744[_0xcf42('0x45')]){if(_0x510744[_0xcf42('0x45')][_0xcf42('0x46')](_0x5bcfa0)){if(_0x365051['agents'][_0x510744['id']][_0xcf42('0x46')](_0x5bcfa0+_0xcf42('0x47'))){_0x365051[_0xcf42('0x44')][_0x510744['id']][_0x5bcfa0+_0xcf42('0x47')]=parseInt(_0x510744['capacity'][_0x5bcfa0],0xa);}}}_0x365051['agents'][_0x510744['id']][_0xcf42('0x48')]();return _0x4663fb({'code':0xc8,'message':_0x365051[_0xcf42('0x44')][_0x510744['id']]});}else{return _0x40f5e8(_0x52a8d4['error'](0x1f4,_0xcf42('0x49')));}});},'Agents':function(_0x409b76){return new Promise(function(_0x3c7702,_0x2fc024){var _0x11cd3d=_[_0xcf42('0x4a')](_0x365051[_0xcf42('0x44')]);_0x3c7702({'count':_0x11cd3d['length'],'rows':_0x11cd3d});});},'ChatQueues':function(_0x549296){return new Promise(function(_0x115cd3,_0x5aaf0c){var _0x44c819=[];for(var _0x54a184 in _0x365051['chatQueues']){if(_0x365051[_0xcf42('0x4b')]['hasOwnProperty'](_0x54a184)){var _0x3416d5=_0x365051['chatQueues'][_0x54a184];var _0x290e87={'id':_0x3416d5['id'],'available':_0x3416d5[_0xcf42('0x4c')],'loggedIn':_0x3416d5[_0xcf42('0x4d')],'name':_0x3416d5[_0xcf42('0x4e')],'paused':_0x3416d5[_0xcf42('0x4f')],'waiting':_0x3416d5[_0xcf42('0x50')]};_0x44c819[_0xcf42('0x21')](_0x290e87);}}_0x115cd3({'count':_0x44c819[_0xcf42('0x18')],'rows':_0x44c819});});},'MailQueues':function(_0x4045ad){return new Promise(function(_0x12e12f,_0x80e264){var _0x5e1d3c=[];for(var _0x47015c in _0x365051[_0xcf42('0x51')]){if(_0x365051[_0xcf42('0x51')][_0xcf42('0x46')](_0x47015c)){var _0x3c002c=_0x365051[_0xcf42('0x51')][_0x47015c];var _0x47c6c8={'id':_0x3c002c['id'],'available':_0x3c002c[_0xcf42('0x4c')],'loggedIn':_0x3c002c[_0xcf42('0x4d')],'name':_0x3c002c['name'],'paused':_0x3c002c[_0xcf42('0x4f')],'waiting':_0x3c002c['waiting']};_0x5e1d3c[_0xcf42('0x21')](_0x47c6c8);}}_0x12e12f({'count':_0x5e1d3c[_0xcf42('0x18')],'rows':_0x5e1d3c});});},'OpenchannelQueues':function(_0xbf4708){return new Promise(function(_0x775e8b,_0x2c195e){var _0x162473=[];for(var _0xe1fd9 in _0x365051[_0xcf42('0x52')]){if(_0x365051[_0xcf42('0x52')]['hasOwnProperty'](_0xe1fd9)){var _0x158a27=_0x365051[_0xcf42('0x52')][_0xe1fd9];var _0x29effd={'id':_0x158a27['id'],'available':_0x158a27[_0xcf42('0x4c')],'loggedIn':_0x158a27[_0xcf42('0x4d')],'name':_0x158a27['name'],'paused':_0x158a27[_0xcf42('0x4f')],'waiting':_0x158a27['waiting']};_0x162473['push'](_0x29effd);}}_0x775e8b({'count':_0x162473[_0xcf42('0x18')],'rows':_0x162473});});},'SmsQueues':function(_0x4c8876){return new Promise(function(_0x5ec950,_0x3fa941){var _0x60f819=[];for(var _0x4e7a15 in _0x365051['smsQueues']){if(_0x365051[_0xcf42('0x53')][_0xcf42('0x46')](_0x4e7a15)){var _0x114e21=_0x365051[_0xcf42('0x53')][_0x4e7a15];var _0x48e228={'id':_0x114e21['id'],'available':_0x114e21['available'],'loggedIn':_0x114e21[_0xcf42('0x4d')],'name':_0x114e21[_0xcf42('0x4e')],'paused':_0x114e21[_0xcf42('0x4f')],'waiting':_0x114e21[_0xcf42('0x50')]};_0x60f819[_0xcf42('0x21')](_0x48e228);}}_0x5ec950({'count':_0x60f819['length'],'rows':_0x60f819});});},'FaxQueues':function(_0x351214){return new Promise(function(_0x515e31,_0xd53161){var _0x78b121=[];for(var _0x13c033 in _0x365051['faxQueues']){if(_0x365051[_0xcf42('0x54')][_0xcf42('0x46')](_0x13c033)){var _0x56e670=_0x365051[_0xcf42('0x54')][_0x13c033];var _0x119a58={'id':_0x56e670['id'],'available':_0x56e670[_0xcf42('0x4c')],'loggedIn':_0x56e670['loggedIn'],'name':_0x56e670[_0xcf42('0x4e')],'paused':_0x56e670['paused'],'waiting':_0x56e670[_0xcf42('0x50')]};_0x78b121[_0xcf42('0x21')](_0x119a58);}}_0x515e31({'count':_0x78b121['length'],'rows':_0x78b121});});},'WhatsappQueues':function(_0x53b65c){return new Promise(function(_0x1ce4ae,_0x1aa908){var _0x6701e3=[];for(var _0x35bc6b in _0x365051[_0xcf42('0x55')]){if(_0x365051['whatsappQueues'][_0xcf42('0x46')](_0x35bc6b)){var _0x2880be=_0x365051[_0xcf42('0x55')][_0x35bc6b];var _0x53b95f={'id':_0x2880be['id'],'available':_0x2880be[_0xcf42('0x4c')],'loggedIn':_0x2880be[_0xcf42('0x4d')],'name':_0x2880be[_0xcf42('0x4e')],'paused':_0x2880be[_0xcf42('0x4f')],'waiting':_0x2880be[_0xcf42('0x50')]};_0x6701e3['push'](_0x53b95f);}}_0x1ce4ae({'count':_0x6701e3[_0xcf42('0x18')],'rows':_0x6701e3});});},'ChatQueuesWaitingInteractions':function(_0x1858bc){return new Promise(function(_0x84125d,_0x176461){var _0xa4c6c6=_[_0xcf42('0x4a')](_0x365051[_0xcf42('0x56')]);_0x84125d({'count':_0xa4c6c6['length'],'rows':_0xa4c6c6});});},'MailQueuesWaitingInteractions':function(_0x55c077){return new Promise(function(_0x266275,_0x1ee0a4){var _0xe65e64=_[_0xcf42('0x4a')](_0x365051[_0xcf42('0x57')]);_0x266275({'count':_0xe65e64[_0xcf42('0x18')],'rows':_0xe65e64});});},'OpenchannelQueuesWaitingInteractions':function(_0x226377){return new Promise(function(_0x485e44,_0x556c40){var _0xb9c01b=_[_0xcf42('0x4a')](_0x365051[_0xcf42('0x58')]);_0x485e44({'count':_0xb9c01b['length'],'rows':_0xb9c01b});});},'SmsQueuesWaitingInteractions':function(_0x57895c){return new Promise(function(_0x32a73f,_0x4d04da){var _0x38df6e=_['values'](_0x365051['smsQueuesWaitingInteractions']);_0x32a73f({'count':_0x38df6e[_0xcf42('0x18')],'rows':_0x38df6e});});},'FaxQueuesWaitingInteractions':function(_0x47a91e){return new Promise(function(_0x1d611b,_0x49a398){var _0x22a044=_[_0xcf42('0x4a')](_0x365051[_0xcf42('0x59')]);_0x1d611b({'count':_0x22a044[_0xcf42('0x18')],'rows':_0x22a044});});},'WhatsappQueuesWaitingInteractions':function(_0x184b3a){return new Promise(function(_0xbd7683,_0x525b8b){var _0x255a30=_['values'](_0x365051[_0xcf42('0x5a')]);_0xbd7683({'count':_0x255a30[_0xcf42('0x18')],'rows':_0x255a30});});}};var _0x1c493d=jayson[_0xcf42('0x5b')](_0x3b6a63)[_0xcf42('0x5c')]();_0x1c493d['on'](_0xcf42('0x37'),function(_0xf6ffed){logger[_0xcf42('0x37')](JSON[_0xcf42('0x33')](_0xf6ffed));return _0x360639(_0xf6ffed);});_0x1c493d['listen'](0x232c,_0xcf42('0x5d'),function(){console['log'](_0xcf42('0x5e'),0x232c);return _0x22f766('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x7437=['mailQueues','loggedIn','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','uuid','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','split','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','app','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','name','paused','waiting'];(function(_0x5c8a61,_0x5583ca){var _0x2439fb=function(_0x393457){while(--_0x393457){_0x5c8a61['push'](_0x5c8a61['shift']());}};_0x2439fb(++_0x5583ca);}(_0x7437,0x17c));var _0x7743=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0x7437[_0x5538d5];return _0x323b1a;};'use strict';var _=require(_0x7743('0x0'));var util=require(_0x7743('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x7743('0x2'));var BPromise=require('bluebird');var uuid=require(_0x7743('0x3'));var config=require('../../../config/environment');var logger=require(_0x7743('0x4'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7743('0x5')),'chatQueueReport':require(_0x7743('0x6')),'smsQueueReport':require(_0x7743('0x7')),'faxQueueReport':require(_0x7743('0x8')),'whatsappQueueReport':require(_0x7743('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1362d3,_0x21009a,_0x400150){return util[_0x7743('0xa')](_0x7743('0xb'),_0x1362d3,_0x21009a||0x0,_0x400150||0x0);}function getIntervals(_0x57332c,_0x3c45ee){var _0x1e626f=[];if(!_[_0x7743('0xc')](_0x3c45ee[_0x7743('0xd')])&&!_[_0x7743('0xc')](_0x57332c[_0x3c45ee[_0x7743('0xd')]])&&!_[_0x7743('0xc')](_0x57332c[_0x3c45ee['IntervalId']][_0x7743('0xe')])){_0x1e626f=_[_0x7743('0xf')](_0x57332c[_0x3c45ee[_0x7743('0xd')]][_0x7743('0xe')],_0x7743('0x10'));}else if(!_[_0x7743('0xc')](_0x3c45ee['interval'])){_0x1e626f=[_0x3c45ee[_0x7743('0x10')]];}return _0x1e626f;}exports[_0x7743('0x11')]=function(_0x58149a){_0x58149a[_0x7743('0x12')]={};return new BPromise(function(_0x35aebc,_0x69efcd){var _0x305acc={'Start':function(_0x48fc65){var _0x37fd71=this;return new Promise(function(_0x215cc2,_0xa5db49){if(_0x48fc65){try{var _0x37fed7=[];var _0x5e8d0a=getId(_0x48fc65[_0x7743('0x13')],_0x48fc65[_0x7743('0x14')]?_0x48fc65[_0x7743('0x14')]['id']:0x0,_0x48fc65[_0x7743('0x15')]?_0x48fc65[_0x7743('0x15')]['id']:0x0);if(_0x48fc65[_0x7743('0x16')]&&_[_0x7743('0x17')](_0x48fc65[_0x7743('0x16')])&&_0x48fc65['applications'][_0x7743('0x18')]){for(var _0x2bd109=0x0;_0x2bd109<_0x48fc65[_0x7743('0x16')][_0x7743('0x18')];_0x2bd109+=0x1){var _0x148174=_0x48fc65[_0x7743('0x16')][_0x2bd109];if(fs[_0x7743('0x19')](path[_0x7743('0x1a')](__dirname,_0x7743('0x16'),_0x148174['app']+_0x7743('0x1b')))){var _0x15a9c2=[];switch(_0x148174['app']['toLowerCase']()){case'autoreply':var _0x55fc6e=_0x148174['appdata'][_0x7743('0x1c')](',');_0x15a9c2['push'](_0x55fc6e[0x0]);_0x15a9c2[_0x7743('0x1d')](_0x55fc6e[_0x7743('0x1e')](0x1,_0x55fc6e[_0x7743('0x18')])[_0x7743('0x1a')](','));break;case _0x7743('0x1f'):var _0x5b7926=_0x148174[_0x7743('0x20')][_0x7743('0x1c')](',');_0x15a9c2['push'](_0x5b7926[0x0]);_0x15a9c2[_0x7743('0x1d')](_0x5b7926[0x1]);_0x15a9c2['push'](_0x5b7926['slice'](0x2,_0x5b7926[_0x7743('0x18')])[_0x7743('0x1a')](','));break;case _0x7743('0x21'):var _0x13b264=_0x148174[_0x7743('0x20')][_0x7743('0x1c')](',');_0x15a9c2['push'](_0x13b264[0x0]);_0x15a9c2[_0x7743('0x1d')](_0x13b264[0x1]);_0x15a9c2[_0x7743('0x1d')](_0x13b264[0x2]);_0x15a9c2['push'](_0x13b264[0x3]);_0x15a9c2['push'](_0x13b264[_0x7743('0x1e')](0x4,_0x13b264['length'])['join'](','));break;case _0x7743('0x22'):var _0x4e3e88=_0x148174[_0x7743('0x20')][_0x7743('0x1c')](',');_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[0x0]);_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[0x1]);_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[0x2]);_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[0x3]);_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[_0x7743('0x1e')](0x4,_0x4e3e88[_0x7743('0x18')])[_0x7743('0x1a')](','));break;case _0x7743('0x14'):_0x15a9c2['push'](_0x148174[_0x7743('0x20')]);break;case _0x7743('0x23'):_0x15a9c2['push'](_0x148174['TagId']);_0x15a9c2[_0x7743('0x1d')](_0x148174[_0x7743('0x20')]);break;default:_0x15a9c2=_[_0x7743('0xc')](_0x148174[_0x7743('0x20')])?[]:_0x148174[_0x7743('0x20')][_0x7743('0x1c')](',');}var _0x4b57d3={'id':util[_0x7743('0xa')](_0x7743('0x24'),_0x5e8d0a,_0x148174['id'],_0x148174['app']),'condition':require(_0x7743('0x25'))[_0x7743('0x26')](_0x5e8d0a,getIntervals(_0x58149a[_0x7743('0x27')],_0x148174),_0x58149a),'consequence':require(_0x7743('0x28')+_0x148174['app'])['consequence'](_0x5e8d0a,_0x15a9c2,_0x58149a,_0x48fc65),'p':_0x148174[_0x7743('0x29')]||0x0};logger[_0x7743('0x2a')]('Push\x20new\x20rule',_0x4b57d3['id'],_0x7743('0x2b'),getIntervals(_0x58149a[_0x7743('0x27')],_0x148174)[_0x7743('0x1a')](_0x7743('0x2c')));_0x37fed7[_0x7743('0x1d')](_0x4b57d3);}else{logger[_0x7743('0x2d')](_0x7743('0x2e'),path[_0x7743('0x1a')](__dirname,'applications',_0x148174[_0x7743('0x2f')]+_0x7743('0x1b')));}}_0x58149a['rules'][_0x5e8d0a]=new RuleEngine(_0x37fed7);_0x58149a[_0x7743('0x12')][_0x5e8d0a]['execute'](_0x48fc65,function(_0x543b32){logger[_0x7743('0x2a')]('Applications\x20executed',JSON[_0x7743('0x30')](_0x543b32[_0x7743('0x31')]));if(_0x58149a[_0x7743('0x12')][_0x5e8d0a]){_0x58149a[_0x7743('0x12')][_0x5e8d0a][_0x7743('0x32')](_0x7743('0x33'));}});return _0x215cc2({'code':0xc8,'message':_0x48fc65});}else{logger[_0x7743('0x2a')](_0x7743('0x34'));return _0x215cc2({'code':0xc8,'message':_0x48fc65});}}catch(_0x2d8bc5){logger[_0x7743('0x2d')](_0x2d8bc5[_0x7743('0x35')]);return _0xa5db49(_0x37fd71['error'](0x1f4,_0x2d8bc5));}}return _0xa5db49(_0x7743('0x36'));});},'AcceptMessage':function(_0x29ca7b){var _0x5808d6=this;return new Promise(function(_0x343ff5,_0x3b4d57){if(_0x29ca7b[_0x7743('0x14')]&&_0x29ca7b['message']['id']){try{var _0x4dfadb=getId(_0x29ca7b[_0x7743('0x13')],_0x29ca7b[_0x7743('0x14')]?_0x29ca7b['message']['id']:0x0,_0x29ca7b['interaction']?_0x29ca7b[_0x7743('0x15')]['id']:0x0);if(_0x58149a[_0x7743('0x12')][_0x4dfadb]){_0x58149a[_0x7743('0x12')][_0x4dfadb][_0x7743('0x32')](_0x7743('0x37'));if(rpc[_0x29ca7b['channel']+_0x7743('0x38')]){rpc[_0x29ca7b[_0x7743('0x13')]+_0x7743('0x38')][_0x7743('0x39')](_0x4dfadb,{'UserId':_0x29ca7b[_0x7743('0x14')][_0x7743('0x3a')]})[_0x7743('0x3b')](function(_0x8523d5){logger[_0x7743('0x2d')](_0x7743('0x3c'));});}}return _0x343ff5({'code':0xc8,'message':_0x29ca7b});}catch(_0x22212b){logger['error'](_0x22212b[_0x7743('0x35')]);return _0x3b4d57(_0x5808d6[_0x7743('0x2d')](0x1f4,_0x22212b));}}logger['error'](_0x7743('0x3d'));return _0x3b4d57(_0x5808d6['error'](0x1f4,_0x7743('0x3d')));});},'RejectMessage':function(_0x7f47bc){var _0x370e57=this;return new Promise(function(_0x17eb8d,_0x325997){if(_0x7f47bc[_0x7743('0x3e')]&&_0x7f47bc['agent']['id']){try{if(_0x58149a[_0x7743('0x3f')][_0x7f47bc[_0x7743('0x3e')]['id']]){_0x58149a[_0x7743('0x3f')][_0x7f47bc[_0x7743('0x3e')]['id']][_0x7743('0x40')]=![];_0x58149a['agents'][_0x7f47bc['agent']['id']][_0x7743('0x41')]=undefined;}return _0x17eb8d({'code':0xc8,'message':_0x7f47bc});}catch(_0x2fdd1e){logger[_0x7743('0x2d')](_0x2fdd1e[_0x7743('0x35')]);return _0x325997(_0x370e57[_0x7743('0x2d')](0x1f4,_0x2fdd1e));}}logger[_0x7743('0x2d')](_0x7743('0x3d'));return _0x325997(_0x370e57[_0x7743('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1df025){var _0x5c7262=this;return new Promise(function(_0x14f621,_0x559867){if(_0x1df025[_0x7743('0x13')]&&_0x1df025['interaction']&&_0x1df025[_0x7743('0x15')]['id']){try{var _0x4ad3cf=getId(_0x1df025[_0x7743('0x13')],_0x1df025[_0x7743('0x14')]?_0x1df025[_0x7743('0x14')]['id']:0x0,_0x1df025[_0x7743('0x15')]?_0x1df025[_0x7743('0x15')]['id']:0x0);if(_0x58149a[_0x7743('0x12')][_0x4ad3cf]){_0x58149a['rules'][_0x4ad3cf][_0x7743('0x32')](_0x7743('0x37'));}return _0x14f621({'code':0xc8,'message':_0x1df025});}catch(_0x45b8e6){logger[_0x7743('0x2d')](_0x45b8e6[_0x7743('0x35')]);return _0x559867(_0x5c7262[_0x7743('0x2d')](0x1f4,_0x45b8e6));}}logger[_0x7743('0x2d')](_0x7743('0x3d'));return _0x559867(_0x5c7262['error'](0x1f4,_0x7743('0x3d')));});},'AgentCapacity':function(_0x542ad4){var _0x977cea=this;return new Promise(function(_0x5a3925,_0x5dd959){if(_0x58149a[_0x7743('0x3f')][_0x7743('0x42')](_0x542ad4['id'])){for(var _0x27320b in _0x542ad4[_0x7743('0x43')]){if(_0x542ad4[_0x7743('0x43')][_0x7743('0x42')](_0x27320b)){if(_0x58149a['agents'][_0x542ad4['id']][_0x7743('0x42')](_0x27320b+'CurrentCapacity')){_0x58149a[_0x7743('0x3f')][_0x542ad4['id']][_0x27320b+_0x7743('0x44')]=parseInt(_0x542ad4[_0x7743('0x43')][_0x27320b],0xa);}}}_0x58149a[_0x7743('0x3f')][_0x542ad4['id']]['updateRealtime']();return _0x5a3925({'code':0xc8,'message':_0x58149a[_0x7743('0x3f')][_0x542ad4['id']]});}else{return _0x5dd959(_0x977cea[_0x7743('0x2d')](0x1f4,_0x7743('0x45')));}});},'Agents':function(_0x53a6eb){return new Promise(function(_0x20bdf5,_0x3eac04){var _0x5c1d3d=_[_0x7743('0x46')](_0x58149a[_0x7743('0x3f')]);_0x20bdf5({'count':_0x5c1d3d['length'],'rows':_0x5c1d3d});});},'ChatQueues':function(_0x12c050){return new Promise(function(_0x2e9e41,_0x3f3d8){var _0x2239ac=[];for(var _0x2a209a in _0x58149a[_0x7743('0x47')]){if(_0x58149a[_0x7743('0x47')][_0x7743('0x42')](_0x2a209a)){var _0x5aa0d3=_0x58149a['chatQueues'][_0x2a209a];var _0x5875ba={'id':_0x5aa0d3['id'],'available':_0x5aa0d3['available'],'loggedIn':_0x5aa0d3['loggedIn'],'name':_0x5aa0d3[_0x7743('0x48')],'paused':_0x5aa0d3[_0x7743('0x49')],'waiting':_0x5aa0d3[_0x7743('0x4a')]};_0x2239ac[_0x7743('0x1d')](_0x5875ba);}}_0x2e9e41({'count':_0x2239ac[_0x7743('0x18')],'rows':_0x2239ac});});},'MailQueues':function(_0x3a00ae){return new Promise(function(_0x30a58b,_0x4dc3d7){var _0x4111dd=[];for(var _0x35c001 in _0x58149a['mailQueues']){if(_0x58149a[_0x7743('0x4b')][_0x7743('0x42')](_0x35c001)){var _0xc42eba=_0x58149a[_0x7743('0x4b')][_0x35c001];var _0x3fe718={'id':_0xc42eba['id'],'available':_0xc42eba['available'],'loggedIn':_0xc42eba[_0x7743('0x4c')],'name':_0xc42eba[_0x7743('0x48')],'paused':_0xc42eba['paused'],'waiting':_0xc42eba[_0x7743('0x4a')]};_0x4111dd['push'](_0x3fe718);}}_0x30a58b({'count':_0x4111dd['length'],'rows':_0x4111dd});});},'OpenchannelQueues':function(_0x71d1e3){return new Promise(function(_0x134c36,_0xef890d){var _0x413c89=[];for(var _0x14a30e in _0x58149a['openchannelQueues']){if(_0x58149a[_0x7743('0x4d')][_0x7743('0x42')](_0x14a30e)){var _0x17b5ca=_0x58149a['openchannelQueues'][_0x14a30e];var _0x4f1a7c={'id':_0x17b5ca['id'],'available':_0x17b5ca[_0x7743('0x4e')],'loggedIn':_0x17b5ca[_0x7743('0x4c')],'name':_0x17b5ca['name'],'paused':_0x17b5ca['paused'],'waiting':_0x17b5ca[_0x7743('0x4a')]};_0x413c89[_0x7743('0x1d')](_0x4f1a7c);}}_0x134c36({'count':_0x413c89['length'],'rows':_0x413c89});});},'SmsQueues':function(_0x24e0f5){return new Promise(function(_0x2096c2,_0x34c8b2){var _0x2f2de4=[];for(var _0xcfd3cf in _0x58149a[_0x7743('0x4f')]){if(_0x58149a[_0x7743('0x4f')][_0x7743('0x42')](_0xcfd3cf)){var _0x4beaad=_0x58149a['smsQueues'][_0xcfd3cf];var _0x36a823={'id':_0x4beaad['id'],'available':_0x4beaad[_0x7743('0x4e')],'loggedIn':_0x4beaad[_0x7743('0x4c')],'name':_0x4beaad[_0x7743('0x48')],'paused':_0x4beaad['paused'],'waiting':_0x4beaad['waiting']};_0x2f2de4[_0x7743('0x1d')](_0x36a823);}}_0x2096c2({'count':_0x2f2de4[_0x7743('0x18')],'rows':_0x2f2de4});});},'FaxQueues':function(_0x6dddad){return new Promise(function(_0x3adf01,_0xc8afc2){var _0x50e02f=[];for(var _0x2856df in _0x58149a[_0x7743('0x50')]){if(_0x58149a['faxQueues']['hasOwnProperty'](_0x2856df)){var _0x2ee468=_0x58149a[_0x7743('0x50')][_0x2856df];var _0x55bff2={'id':_0x2ee468['id'],'available':_0x2ee468[_0x7743('0x4e')],'loggedIn':_0x2ee468[_0x7743('0x4c')],'name':_0x2ee468['name'],'paused':_0x2ee468[_0x7743('0x49')],'waiting':_0x2ee468[_0x7743('0x4a')]};_0x50e02f[_0x7743('0x1d')](_0x55bff2);}}_0x3adf01({'count':_0x50e02f['length'],'rows':_0x50e02f});});},'WhatsappQueues':function(_0x3290da){return new Promise(function(_0x1a47a1,_0x2521fd){var _0x13020c=[];for(var _0x25dfad in _0x58149a[_0x7743('0x51')]){if(_0x58149a[_0x7743('0x51')]['hasOwnProperty'](_0x25dfad)){var _0x362e17=_0x58149a[_0x7743('0x51')][_0x25dfad];var _0x3e41da={'id':_0x362e17['id'],'available':_0x362e17[_0x7743('0x4e')],'loggedIn':_0x362e17[_0x7743('0x4c')],'name':_0x362e17[_0x7743('0x48')],'paused':_0x362e17[_0x7743('0x49')],'waiting':_0x362e17[_0x7743('0x4a')]};_0x13020c['push'](_0x3e41da);}}_0x1a47a1({'count':_0x13020c[_0x7743('0x18')],'rows':_0x13020c});});},'ChatQueuesWaitingInteractions':function(_0xd33ef5){return new Promise(function(_0x4ad70d,_0x215397){var _0x110661=_[_0x7743('0x46')](_0x58149a['chatQueuesWaitingInteractions']);_0x4ad70d({'count':_0x110661[_0x7743('0x18')],'rows':_0x110661});});},'MailQueuesWaitingInteractions':function(_0x2910a1){return new Promise(function(_0x17f190,_0x297bb3){var _0x6b2aeb=_['values'](_0x58149a['mailQueuesWaitingInteractions']);_0x17f190({'count':_0x6b2aeb[_0x7743('0x18')],'rows':_0x6b2aeb});});},'OpenchannelQueuesWaitingInteractions':function(_0x523212){return new Promise(function(_0x479cbd,_0x2a7fdd){var _0x29a498=_[_0x7743('0x46')](_0x58149a[_0x7743('0x52')]);_0x479cbd({'count':_0x29a498['length'],'rows':_0x29a498});});},'SmsQueuesWaitingInteractions':function(_0x2017d4){return new Promise(function(_0x2e9603,_0x370453){var _0x47ff52=_[_0x7743('0x46')](_0x58149a['smsQueuesWaitingInteractions']);_0x2e9603({'count':_0x47ff52[_0x7743('0x18')],'rows':_0x47ff52});});},'FaxQueuesWaitingInteractions':function(_0x58732d){return new Promise(function(_0xd7b672,_0x3d47c5){var _0x33df0e=_[_0x7743('0x46')](_0x58149a[_0x7743('0x53')]);_0xd7b672({'count':_0x33df0e[_0x7743('0x18')],'rows':_0x33df0e});});},'WhatsappQueuesWaitingInteractions':function(_0x5ebac4){return new Promise(function(_0x225cee,_0x55940e){var _0x38adc6=_['values'](_0x58149a[_0x7743('0x54')]);_0x225cee({'count':_0x38adc6['length'],'rows':_0x38adc6});});}};var _0xbc0e92=jayson[_0x7743('0x55')](_0x305acc)[_0x7743('0x56')]();_0xbc0e92['on'](_0x7743('0x2d'),function(_0x377830){logger[_0x7743('0x2d')](JSON['stringify'](_0x377830));return _0x69efcd(_0x377830);});_0xbc0e92[_0x7743('0x11')](0x232c,_0x7743('0x57'),function(){console[_0x7743('0x58')](_0x7743('0x59'),0x232c);return _0x35aebc(_0x7743('0x5a')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8e1ea94..efcb8eb 100644 --- a/server/services/routing/server/interval.js +++ b/server/services/routing/server/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f25=['[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','stop','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','then','indexOf','true','catch','[%s][INTERVAL]\x20%s','some'];(function(_0x19d482,_0x4f3600){var _0x593018=function(_0x13ebfa){while(--_0x13ebfa){_0x19d482['push'](_0x19d482['shift']());}};_0x593018(++_0x4f3600);}(_0x2f25,0xb5));var _0x52f2=function(_0x3fdf28,_0x2822c7){_0x3fdf28=_0x3fdf28-0x0;var _0x1c648b=_0x2f25[_0x3fdf28];return _0x1c648b;};'use strict';var util=require('util');var BPromise=require(_0x52f2('0x0'));var jayson=require(_0x52f2('0x1'));var _=require('lodash');var logger=require(_0x52f2('0x2'))(_0x52f2('0x3'));var client=jayson[_0x52f2('0x4')][_0x52f2('0x5')]({'port':0x232a});function request(_0x11bb16,_0x2cdf41){return new BPromise(function(_0x30387d,_0x3abfcb){return client[_0x52f2('0x6')](_0x11bb16,_0x2cdf41)['then'](function(_0x43f7ef){if(_0x43f7ef[_0x52f2('0x7')]){return _0x3abfcb(_0x43f7ef['error'][_0x52f2('0x8')]);}else{return _0x30387d(_0x43f7ef[_0x52f2('0x9')]);}})['catch'](function(_0x71aa12){return _0x3abfcb(_0x71aa12);});});}exports[_0x52f2('0xa')]=function(_0x4c569f,_0x5e91ee,_0x4f2f69){return function(_0x45ff87){if(_0x4f2f69[_0x52f2('0xb')]&&!_0x4f2f69[_0x52f2('0xb')][_0x4c569f]){logger[_0x52f2('0xc')](_0x52f2('0xd'),_0x4c569f);return _0x45ff87['stop']();}var _0x12e7c7=[];for(var _0x2ff105=0x0;_0x2ff105<_0x5e91ee['length'];_0x2ff105+=0x1){_0x12e7c7[_0x52f2('0xe')](request(_0x52f2('0xf'),{'command':util['format']('iftime\x20%s',_0x5e91ee[_0x2ff105])})[_0x52f2('0x10')](function(_0xdc0f42){return _0xdc0f42&&_0xdc0f42['message']&&_0xdc0f42[_0x52f2('0x8')][_0x52f2('0x11')](_0x52f2('0x12'))>=0x0?!![]:![];})[_0x52f2('0x13')](function(_0x4ff25a){logger[_0x52f2('0x7')](_0x52f2('0x14'),_0x4c569f,_0x5e91ee[_0x2ff105]);}));}BPromise['all'](_0x12e7c7)['then'](function(_0x4fb8b6){var _0x5727ba=_[_0x52f2('0x15')](_0x4fb8b6);logger['info'](_0x52f2('0x16'),_0x4c569f,_0x5e91ee['join'](_0x52f2('0x17')),_0x5727ba);_0x45ff87[_0x52f2('0x18')](_0x5727ba);})[_0x52f2('0x13')](function(_0x3d4b0f){console[_0x52f2('0x19')](_0x3d4b0f);logger[_0x52f2('0x7')](_0x52f2('0x16'),_0x4c569f,_0x5e91ee[_0x52f2('0x1a')](_0x52f2('0x17')),_0x3d4b0f[_0x52f2('0x1b')]);_0x45ff87[_0x52f2('0x1c')]();});};}; \ No newline at end of file +var _0xb311=['stack','util','bluebird','lodash','../../../config/logger','routing','http','request','then','error','catch','condition','rules','info','length','Command','format','iftime\x20%s','message','indexOf','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20'];(function(_0x42dd06,_0x4d928b){var _0x121e9a=function(_0x2e79c4){while(--_0x2e79c4){_0x42dd06['push'](_0x42dd06['shift']());}};_0x121e9a(++_0x4d928b);}(_0xb311,0x105));var _0x1b31=function(_0x341faa,_0x56dd3e){_0x341faa=_0x341faa-0x0;var _0x247243=_0xb311[_0x341faa];return _0x247243;};'use strict';var util=require(_0x1b31('0x0'));var BPromise=require(_0x1b31('0x1'));var jayson=require('jayson/promise');var _=require(_0x1b31('0x2'));var logger=require(_0x1b31('0x3'))(_0x1b31('0x4'));var client=jayson['client'][_0x1b31('0x5')]({'port':0x232a});function request(_0x45cbe2,_0x4a65c7){return new BPromise(function(_0x3b81df,_0x12bd6e){return client[_0x1b31('0x6')](_0x45cbe2,_0x4a65c7)[_0x1b31('0x7')](function(_0x23c4c9){if(_0x23c4c9['error']){return _0x12bd6e(_0x23c4c9[_0x1b31('0x8')]['message']);}else{return _0x3b81df(_0x23c4c9['result']);}})[_0x1b31('0x9')](function(_0x564e73){return _0x12bd6e(_0x564e73);});});}exports[_0x1b31('0xa')]=function(_0x2b8f35,_0x52b5cc,_0x416dc8){return function(_0x4c4d23){if(_0x416dc8[_0x1b31('0xb')]&&!_0x416dc8[_0x1b31('0xb')][_0x2b8f35]){logger[_0x1b31('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2b8f35);return _0x4c4d23['stop']();}var _0x70ddc8=[];for(var _0x9f1422=0x0;_0x9f1422<_0x52b5cc[_0x1b31('0xd')];_0x9f1422+=0x1){_0x70ddc8['push'](request(_0x1b31('0xe'),{'command':util[_0x1b31('0xf')](_0x1b31('0x10'),_0x52b5cc[_0x9f1422])})['then'](function(_0xbac521){return _0xbac521&&_0xbac521[_0x1b31('0x11')]&&_0xbac521[_0x1b31('0x11')][_0x1b31('0x12')]('true')>=0x0?!![]:![];})['catch'](function(_0x5b03da){logger[_0x1b31('0x8')](_0x1b31('0x13'),_0x2b8f35,_0x52b5cc[_0x9f1422]);}));}BPromise['all'](_0x70ddc8)['then'](function(_0x1f8067){var _0x8f3aac=_[_0x1b31('0x14')](_0x1f8067);logger[_0x1b31('0xc')](_0x1b31('0x15'),_0x2b8f35,_0x52b5cc[_0x1b31('0x16')]('\x20|\x20'),_0x8f3aac);_0x4c4d23['when'](_0x8f3aac);})[_0x1b31('0x9')](function(_0x424c23){console[_0x1b31('0x17')](_0x424c23);logger[_0x1b31('0x8')](_0x1b31('0x15'),_0x2b8f35,_0x52b5cc[_0x1b31('0x16')](_0x1b31('0x18')),_0x424c23[_0x1b31('0x19')]);_0x4c4d23['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 8c4e508..4ee21c0 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bd2=['holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','reason','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transferexten','transferuniqueid','transfereeuniqueid','clone','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','calleridname','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','destuniqueid','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout'];(function(_0x1b0d65,_0x3deb10){var _0x2407a1=function(_0x311dd6){while(--_0x311dd6){_0x1b0d65['push'](_0x1b0d65['shift']());}};_0x2407a1(++_0x3deb10);}(_0x1bd2,0x135));var _0x21bd=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x1bd2[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x21bd('0x0'));var util=require(_0x21bd('0x1'));var utils=require(_0x21bd('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x52d47d,_0x1de65a){utils[_0x21bd('0x3')](util[_0x21bd('0x4')](_0x21bd('0x5'),_0x52d47d[_0x21bd('0x6')],_0x52d47d[_0x21bd('0x7')],_0x52d47d[_0x21bd('0x8')],_0x52d47d[_0x21bd('0x9')],_0x52d47d[_0x21bd('0xa')],_0x52d47d[_0x21bd('0xb')],_0x52d47d[_0x21bd('0xc')],_0x52d47d['lastevent']));if(_0x52d47d['queue']){utils[_0x21bd('0xd')](_0x52d47d[_0x21bd('0x8')])[_0x21bd('0xe')](function(_0x203280){if(_0x203280){_0x52d47d[_0x21bd('0xf')]=_0x203280[_0x21bd('0xf')];_0x52d47d[_0x21bd('0x10')]=_0x52d47d[_0x21bd('0x11')]?_0x203280[_0x21bd('0x12')]:![];_0x52d47d[_0x21bd('0x13')]=_0x52d47d['agentacw']?_0x203280[_0x21bd('0x14')]:0x0;}utils[_0x21bd('0x15')](_0x21bd('0x16'),_0x52d47d);});}else{utils[_0x21bd('0x15')](_0x21bd('0x16'),_0x52d47d);}if(_0x1de65a){delete transfers[_0x52d47d['uniqueid']];}else{delete agents[_0x52d47d['destuniqueid']];}}exports[_0x21bd('0x17')]=function(_0x5275d2){try{utils['debug'](util[_0x21bd('0x4')](_0x21bd('0x18'),_0x5275d2['uniqueid']),_0x5275d2);agents[_0x5275d2['destuniqueid']]=_0x5275d2;agents[_0x5275d2[_0x21bd('0x19')]]['agentcalledAt']=utils[_0x21bd('0x1a')]();agents[_0x5275d2[_0x21bd('0x19')]][_0x21bd('0x1b')]=_0x21bd('0x1c');agents[_0x5275d2[_0x21bd('0x19')]]['connectedlinenum']=null;agents[_0x5275d2[_0x21bd('0x19')]][_0x21bd('0x1d')]=null;utils[_0x21bd('0x3')](util[_0x21bd('0x4')](_0x21bd('0x1e'),_0x5275d2[_0x21bd('0x6')],agents[_0x5275d2[_0x21bd('0x19')]][_0x21bd('0x9')],_0x5275d2[_0x21bd('0x19')]));}catch(_0x22e46e){utils[_0x21bd('0x1f')](util[_0x21bd('0x4')]('[%s][agents][agentcalled]',_0x5275d2[_0x21bd('0x6')]),_0x22e46e);}};exports['agentringnoanswer']=function(_0x5c4369){try{if(!_[_0x21bd('0x20')](agents[_0x5c4369[_0x21bd('0x19')]])){utils[_0x21bd('0x21')](util[_0x21bd('0x4')](_0x21bd('0x22'),_0x5c4369['uniqueid']),_0x5c4369);utils[_0x21bd('0x3')](util[_0x21bd('0x4')](_0x21bd('0x23'),_0x5c4369[_0x21bd('0x6')],agents[_0x5c4369['destuniqueid']][_0x21bd('0x9')],_0x5c4369[_0x21bd('0x19')]));agents[_0x5c4369[_0x21bd('0x19')]][_0x21bd('0x24')]=!![];agents[_0x5c4369[_0x21bd('0x19')]][_0x21bd('0x25')]=utils['now']();agents[_0x5c4369[_0x21bd('0x19')]][_0x21bd('0x1b')]=_0x21bd('0x26');agents[_0x5c4369[_0x21bd('0x19')]]['reason']=_0x21bd('0x26');agents[_0x5c4369[_0x21bd('0x19')]][_0x21bd('0x27')]=_0x5c4369[_0x21bd('0x28')]?parseInt(_0x5c4369[_0x21bd('0x28')])/0x3e8:0x0;agents[_0x5c4369[_0x21bd('0x19')]][_0x21bd('0x29')]=0x0;unanswered['push'](_0x5c4369[_0x21bd('0x19')]);}}catch(_0xbd50e7){utils[_0x21bd('0x1f')](util[_0x21bd('0x4')](_0x21bd('0x22'),_0x5c4369[_0x21bd('0x6')]),_0xbd50e7);}};exports[_0x21bd('0x2a')]=function(_0x354267){try{_[_0x21bd('0x2b')](agents,function(_0x538149,_0x47cb3c){if(_0x538149['uniqueid']==_0x354267[_0x21bd('0x6')]&&!_[_0x21bd('0x2c')](unanswered,_0x538149[_0x21bd('0x19')])){utils[_0x21bd('0x21')](util['format'](_0x21bd('0x2d'),_0x354267[_0x21bd('0x6')]),_0x354267);utils['info'](util[_0x21bd('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x354267[_0x21bd('0x6')],_0x538149['membername'],_0x538149[_0x21bd('0x19')]));_0x538149[_0x21bd('0x24')]=!![];_0x538149[_0x21bd('0x25')]=utils[_0x21bd('0x1a')]();_0x538149[_0x21bd('0x1b')]=_0x21bd('0x2e');_0x538149['reason']='abandoned';_0x538149[_0x21bd('0x27')]=_0x354267[_0x21bd('0x27')];_0x538149['talktime']=0x0;writeDB(_0x538149);}});}catch(_0x3d8c12){utils['error'](util[_0x21bd('0x4')](_0x21bd('0x2d'),_0x354267[_0x21bd('0x6')]),_0x3d8c12);}};exports[_0x21bd('0x2f')]=function(_0x1508b7){try{if(agents[_0x1508b7['destuniqueid']]){utils[_0x21bd('0x21')](util[_0x21bd('0x4')](_0x21bd('0x30'),_0x1508b7['uniqueid']),_0x1508b7);utils[_0x21bd('0x3')](util[_0x21bd('0x4')](_0x21bd('0x31'),_0x1508b7[_0x21bd('0x6')],agents[_0x1508b7[_0x21bd('0x19')]][_0x21bd('0x9')],_0x1508b7['destuniqueid']));agents[_0x1508b7['destuniqueid']][_0x21bd('0x32')]=utils[_0x21bd('0x1a')]();agents[_0x1508b7[_0x21bd('0x19')]][_0x21bd('0xc')]=_0x1508b7[_0x21bd('0xc')];agents[_0x1508b7[_0x21bd('0x19')]][_0x21bd('0x1d')]=_0x1508b7[_0x21bd('0x1d')];agents[_0x1508b7[_0x21bd('0x19')]][_0x21bd('0x27')]=_0x1508b7['ringtime'];agents[_0x1508b7[_0x21bd('0x19')]][_0x21bd('0x1b')]=_0x21bd('0x33');_['forIn'](agents,function(_0x12af13,_0x736acb){if(_0x12af13[_0x21bd('0x19')]!=_0x1508b7[_0x21bd('0x19')]&&_0x12af13[_0x21bd('0x6')]==_0x1508b7[_0x21bd('0x6')]){_0x12af13[_0x21bd('0x29')]=0x0;_0x12af13[_0x21bd('0x27')]=_0x1508b7[_0x21bd('0x28')];_0x12af13['agentringnoanswer']=!![];_0x12af13[_0x21bd('0x25')]=utils[_0x21bd('0x1a')]();_0x12af13[_0x21bd('0x1b')]='answered_elsewhere';_0x12af13['reason']=_0x21bd('0x34');_0x12af13[_0x21bd('0x35')]=_0x1508b7[_0x21bd('0x19')];_0x12af13[_0x21bd('0x36')]=_0x1508b7[_0x21bd('0x9')];writeDB(_0x12af13);}});}}catch(_0x292002){utils[_0x21bd('0x1f')](util[_0x21bd('0x4')]('[%s][agents][agentconnect]',_0x1508b7[_0x21bd('0x6')]),_0x292002);}};exports[_0x21bd('0x11')]=function(_0x45f875){try{if(!_['isNil'](agents[_0x45f875[_0x21bd('0x19')]])){utils[_0x21bd('0x21')](util[_0x21bd('0x4')]('[%s][agents][agentcomplete]',_0x45f875[_0x21bd('0x6')]),_0x45f875);utils['info'](util[_0x21bd('0x4')](_0x21bd('0x37'),_0x45f875[_0x21bd('0x6')],agents[_0x45f875['destuniqueid']]['membername'],_0x45f875[_0x21bd('0x19')]));agents[_0x45f875['destuniqueid']][_0x21bd('0x11')]=!![];agents[_0x45f875['destuniqueid']][_0x21bd('0x38')]=utils['now']();agents[_0x45f875[_0x21bd('0x19')]][_0x21bd('0x29')]=utils[_0x21bd('0x39')](agents[_0x45f875[_0x21bd('0x19')]][_0x21bd('0x38')],agents[_0x45f875[_0x21bd('0x19')]]['agentconnectAt']);agents[_0x45f875['destuniqueid']][_0x21bd('0x3a')]=_0x45f875[_0x21bd('0x3a')];agents[_0x45f875[_0x21bd('0x19')]][_0x21bd('0x1b')]=_0x21bd('0x3b');writeDB(agents[_0x45f875[_0x21bd('0x19')]]);}}catch(_0x30cb99){utils[_0x21bd('0x1f')](util[_0x21bd('0x4')]('[%s][agents][agentcomplete]',_0x45f875['uniqueid']),_0x30cb99);}};exports[_0x21bd('0x3c')]=function(_0x4768e6){try{if(!_[_0x21bd('0x20')](agents[_0x4768e6[_0x21bd('0x3d')]])){utils['debug'](util['format'](_0x21bd('0x3e'),_0x4768e6[_0x21bd('0x6')]),_0x4768e6);utils[_0x21bd('0x3')](util[_0x21bd('0x4')](_0x21bd('0x3f'),_0x4768e6[_0x21bd('0x6')],agents[_0x4768e6[_0x21bd('0x3d')]][_0x21bd('0x9')],agents[_0x4768e6['transfereruniqueid']][_0x21bd('0x6')]));agents[_0x4768e6[_0x21bd('0x3d')]][_0x21bd('0x40')]=!![];agents[_0x4768e6[_0x21bd('0x3d')]][_0x21bd('0x41')]=_0x21bd('0x42');agents[_0x4768e6['transfereruniqueid']]['transferexten']=_0x4768e6['extension'];agents[_0x4768e6[_0x21bd('0x3d')]]['transferuniqueid']=agents[_0x4768e6['transfereruniqueid']][_0x21bd('0x6')];}}catch(_0x1c4f6c){utils[_0x21bd('0x1f')](util[_0x21bd('0x4')]('[%s][agents][blindtransfer]',_0x4768e6['uniqueid']),_0x1c4f6c);}};exports[_0x21bd('0x43')]=function(_0x1da1c0){try{utils[_0x21bd('0x21')](util[_0x21bd('0x4')](_0x21bd('0x44'),_0x1da1c0[_0x21bd('0x45')]),_0x1da1c0);if(_0x1da1c0[_0x21bd('0x45')]==_0x1da1c0[_0x21bd('0x46')]){if(!_[_0x21bd('0x20')](agents[_0x1da1c0[_0x21bd('0x47')]])){utils['info'](util[_0x21bd('0x4')](_0x21bd('0x48'),_0x1da1c0[_0x21bd('0x45')],agents[_0x1da1c0[_0x21bd('0x47')]][_0x21bd('0x9')]));agents[_0x1da1c0[_0x21bd('0x47')]][_0x21bd('0x40')]=!![];agents[_0x1da1c0[_0x21bd('0x47')]][_0x21bd('0x41')]='ATTENDED';agents[_0x1da1c0[_0x21bd('0x47')]][_0x21bd('0x49')]=_0x1da1c0['origtransfererexten'];agents[_0x1da1c0['secondtransfereruniqueid']][_0x21bd('0x4a')]=_0x1da1c0[_0x21bd('0x45')];}if(_0x1da1c0[_0x21bd('0x4b')]&&agents[_0x1da1c0['transfereeuniqueid']]){agents[_0x1da1c0['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x1da1c0['transfereeuniqueid']]=_[_0x21bd('0x4c')](agents[_0x1da1c0[_0x21bd('0x4b')]]);transfers[_0x1da1c0['transfereeuniqueid']][_0x21bd('0xb')]=agents[_0x1da1c0[_0x21bd('0x47')]][_0x21bd('0xb')];transfers[_0x1da1c0['transfereeuniqueid']]['calleridname']=agents[_0x1da1c0[_0x21bd('0x47')]]['calleridname'];transfers[_0x1da1c0[_0x21bd('0x4b')]][_0x21bd('0x4d')]=utils[_0x21bd('0x1a')]();transfers[_0x1da1c0['transfereeuniqueid']][_0x21bd('0x32')]=utils[_0x21bd('0x1a')]();transfers[_0x1da1c0[_0x21bd('0x4b')]][_0x21bd('0x27')]=0x0;transfers[_0x1da1c0[_0x21bd('0x4b')]][_0x21bd('0x4e')]=0x2;}}else if(_0x1da1c0[_0x21bd('0x47')]==_0x1da1c0[_0x21bd('0x4f')]){if(!_[_0x21bd('0x20')](agents[_0x1da1c0[_0x21bd('0x45')]])){utils[_0x21bd('0x3')](util[_0x21bd('0x4')](_0x21bd('0x48'),_0x1da1c0[_0x21bd('0x45')],agents[_0x1da1c0[_0x21bd('0x45')]][_0x21bd('0x9')]));agents[_0x1da1c0[_0x21bd('0x45')]][_0x21bd('0x40')]=!![];agents[_0x1da1c0[_0x21bd('0x45')]][_0x21bd('0x41')]=_0x21bd('0x50');agents[_0x1da1c0['origtransfereruniqueid']]['transferexten']=_0x1da1c0['secondtransfererexten'];agents[_0x1da1c0[_0x21bd('0x45')]][_0x21bd('0x4a')]=_0x1da1c0[_0x21bd('0x47')];}if(_0x1da1c0['transfertargetuniqueid']&&agents[_0x1da1c0[_0x21bd('0x51')]]){agents[_0x1da1c0['transfertargetuniqueid']][_0x21bd('0x4e')]=0x1;transfers[_0x1da1c0['transfertargetuniqueid']]=_[_0x21bd('0x4c')](agents[_0x1da1c0['transfertargetuniqueid']]);transfers[_0x1da1c0[_0x21bd('0x51')]][_0x21bd('0xb')]=agents[_0x1da1c0['origtransfereruniqueid']][_0x21bd('0xb')];transfers[_0x1da1c0[_0x21bd('0x51')]][_0x21bd('0x52')]=agents[_0x1da1c0[_0x21bd('0x45')]][_0x21bd('0x52')];transfers[_0x1da1c0[_0x21bd('0x51')]][_0x21bd('0x4d')]=utils['now']();transfers[_0x1da1c0['transfertargetuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x1da1c0[_0x21bd('0x51')]][_0x21bd('0x27')]=0x0;transfers[_0x1da1c0[_0x21bd('0x51')]]['agententerreason']=0x2;}}}catch(_0x5dfa6f){utils['error'](util[_0x21bd('0x4')]('[%s][agents][attendedtransfer]',_0x1da1c0['origtransfereruniqueid']),_0x5dfa6f);}};exports[_0x21bd('0x53')]=function(_0x46cda7){try{utils[_0x21bd('0x21')](util['format'](_0x21bd('0x54'),_0x46cda7[_0x21bd('0x6')]),_0x46cda7);if(agents[_0x46cda7[_0x21bd('0x6')]]&&agents[_0x46cda7['uniqueid']]['reason']===_0x21bd('0x26')){if(_0x46cda7[_0x21bd('0x55')]==='21'){agents[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x3a')]='rejected';agents[_0x46cda7['uniqueid']][_0x21bd('0x1b')]='rejected';}utils['info'](util[_0x21bd('0x4')](_0x21bd('0x56'),_0x46cda7[_0x21bd('0x6')],agents[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x9')],agents[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x3a')],agents[_0x46cda7[_0x21bd('0x6')]]['lastevent']));writeDB(agents[_0x46cda7[_0x21bd('0x6')]]);var _0x478db4=unanswered['indexOf'](_0x46cda7['uniqueid']);if(_0x478db4>-0x1){unanswered['splice'](_0x478db4,0x1);}}if(transfers[_0x46cda7['uniqueid']]){transfers[_0x46cda7['uniqueid']][_0x21bd('0x11')]=!![];transfers[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x38')]=utils[_0x21bd('0x1a')]();transfers[_0x46cda7[_0x21bd('0x6')]]['talktime']=utils[_0x21bd('0x39')](transfers[_0x46cda7[_0x21bd('0x6')]]['agentcompleteAt'],transfers[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x32')]);transfers[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x3a')]='agent';transfers[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x1b')]='complete';utils[_0x21bd('0x3')](util[_0x21bd('0x4')](_0x21bd('0x56'),_0x46cda7[_0x21bd('0x6')],transfers[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x9')],transfers[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x3a')],transfers[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x1b')]));writeDB(transfers[_0x46cda7[_0x21bd('0x6')]],!![]);}if(agents[_0x46cda7[_0x21bd('0x6')]]&&agents[_0x46cda7['uniqueid']][_0x21bd('0x32')]){agents[_0x46cda7[_0x21bd('0x6')]]['agentcomplete']=!![];agents[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x38')]=utils[_0x21bd('0x1a')]();agents[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x29')]=utils[_0x21bd('0x39')](agents[_0x46cda7['uniqueid']][_0x21bd('0x38')],agents[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x32')]);agents[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x3a')]=agents[_0x46cda7['uniqueid']][_0x21bd('0x40')]?_0x21bd('0x40'):'agent';agents[_0x46cda7[_0x21bd('0x6')]]['lastevent']='complete';utils[_0x21bd('0x3')](util[_0x21bd('0x4')](_0x21bd('0x56'),_0x46cda7[_0x21bd('0x6')],agents[_0x46cda7[_0x21bd('0x6')]]['membername'],agents[_0x46cda7['uniqueid']][_0x21bd('0x3a')],agents[_0x46cda7[_0x21bd('0x6')]][_0x21bd('0x1b')]));writeDB(agents[_0x46cda7[_0x21bd('0x6')]]);}}catch(_0x4660b9){utils['error'](util[_0x21bd('0x4')](_0x21bd('0x54'),_0x46cda7['uniqueid']),_0x4660b9);}}; \ No newline at end of file +var _0xbd4c=['blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','reason','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype'];(function(_0x2f58ee,_0x5460f2){var _0x275d54=function(_0x24c2c5){while(--_0x24c2c5){_0x2f58ee['push'](_0x2f58ee['shift']());}};_0x275d54(++_0x5460f2);}(_0xbd4c,0x74));var _0xcbd4=function(_0x1793fd,_0x454586){_0x1793fd=_0x1793fd-0x0;var _0x367dbf=_0xbd4c[_0x1793fd];return _0x367dbf;};'use strict';var _=require(_0xcbd4('0x0'));var util=require('util');var utils=require(_0xcbd4('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x56ba84,_0x236579){utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x4'),_0x56ba84[_0xcbd4('0x5')],_0x56ba84[_0xcbd4('0x6')],_0x56ba84[_0xcbd4('0x7')],_0x56ba84[_0xcbd4('0x8')],_0x56ba84[_0xcbd4('0x9')],_0x56ba84[_0xcbd4('0xa')],_0x56ba84[_0xcbd4('0xb')],_0x56ba84[_0xcbd4('0xc')]));if(_0x56ba84[_0xcbd4('0x7')]){utils[_0xcbd4('0xd')](_0x56ba84[_0xcbd4('0x7')])['then'](function(_0x3a0280){if(_0x3a0280){_0x56ba84[_0xcbd4('0xe')]=_0x3a0280[_0xcbd4('0xe')];_0x56ba84[_0xcbd4('0xf')]=_0x56ba84[_0xcbd4('0x10')]?_0x3a0280[_0xcbd4('0x11')]:![];_0x56ba84['acwtime']=_0x56ba84[_0xcbd4('0xf')]?_0x3a0280[_0xcbd4('0x12')]:0x0;}utils[_0xcbd4('0x13')](_0xcbd4('0x14'),_0x56ba84);});}else{utils[_0xcbd4('0x13')](_0xcbd4('0x14'),_0x56ba84);}if(_0x236579){delete transfers[_0x56ba84[_0xcbd4('0x5')]];}else{delete agents[_0x56ba84[_0xcbd4('0x15')]];}}exports[_0xcbd4('0x16')]=function(_0x5857d8){try{utils[_0xcbd4('0x17')](util[_0xcbd4('0x3')](_0xcbd4('0x18'),_0x5857d8['uniqueid']),_0x5857d8);agents[_0x5857d8[_0xcbd4('0x15')]]=_0x5857d8;agents[_0x5857d8[_0xcbd4('0x15')]][_0xcbd4('0x19')]=utils[_0xcbd4('0x1a')]();agents[_0x5857d8[_0xcbd4('0x15')]][_0xcbd4('0xc')]=_0xcbd4('0x1b');agents[_0x5857d8[_0xcbd4('0x15')]]['connectedlinenum']=null;agents[_0x5857d8[_0xcbd4('0x15')]][_0xcbd4('0x1c')]=null;utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x1d'),_0x5857d8['uniqueid'],agents[_0x5857d8[_0xcbd4('0x15')]][_0xcbd4('0x8')],_0x5857d8[_0xcbd4('0x15')]));}catch(_0x2d03bb){utils[_0xcbd4('0x1e')](util['format'](_0xcbd4('0x18'),_0x5857d8['uniqueid']),_0x2d03bb);}};exports[_0xcbd4('0x1f')]=function(_0x4ed7e8){try{if(!_[_0xcbd4('0x20')](agents[_0x4ed7e8[_0xcbd4('0x15')]])){utils[_0xcbd4('0x17')](util[_0xcbd4('0x3')](_0xcbd4('0x21'),_0x4ed7e8['uniqueid']),_0x4ed7e8);utils[_0xcbd4('0x2')](util['format'](_0xcbd4('0x22'),_0x4ed7e8[_0xcbd4('0x5')],agents[_0x4ed7e8[_0xcbd4('0x15')]]['membername'],_0x4ed7e8[_0xcbd4('0x15')]));agents[_0x4ed7e8[_0xcbd4('0x15')]][_0xcbd4('0x1f')]=!![];agents[_0x4ed7e8[_0xcbd4('0x15')]]['agentringnoanswerAt']=utils[_0xcbd4('0x1a')]();agents[_0x4ed7e8[_0xcbd4('0x15')]][_0xcbd4('0xc')]=_0xcbd4('0x23');agents[_0x4ed7e8[_0xcbd4('0x15')]]['reason']='timeout';agents[_0x4ed7e8[_0xcbd4('0x15')]][_0xcbd4('0x24')]=_0x4ed7e8[_0xcbd4('0x25')]?parseInt(_0x4ed7e8['ringtime'])/0x3e8:0x0;agents[_0x4ed7e8['destuniqueid']][_0xcbd4('0x26')]=0x0;unanswered[_0xcbd4('0x27')](_0x4ed7e8[_0xcbd4('0x15')]);}}catch(_0x5711d0){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')](_0xcbd4('0x21'),_0x4ed7e8[_0xcbd4('0x5')]),_0x5711d0);}};exports[_0xcbd4('0x28')]=function(_0x2e5519){try{_[_0xcbd4('0x29')](agents,function(_0x82083d,_0x21ee1f){if(_0x82083d[_0xcbd4('0x5')]==_0x2e5519['uniqueid']&&!_[_0xcbd4('0x2a')](unanswered,_0x82083d[_0xcbd4('0x15')])){utils[_0xcbd4('0x17')](util[_0xcbd4('0x3')](_0xcbd4('0x2b'),_0x2e5519[_0xcbd4('0x5')]),_0x2e5519);utils[_0xcbd4('0x2')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e5519[_0xcbd4('0x5')],_0x82083d[_0xcbd4('0x8')],_0x82083d['destuniqueid']));_0x82083d[_0xcbd4('0x1f')]=!![];_0x82083d['agentringnoanswerAt']=utils['now']();_0x82083d[_0xcbd4('0xc')]=_0xcbd4('0x2c');_0x82083d[_0xcbd4('0x2d')]=_0xcbd4('0x2c');_0x82083d['holdtime']=_0x2e5519[_0xcbd4('0x24')];_0x82083d[_0xcbd4('0x26')]=0x0;writeDB(_0x82083d);}});}catch(_0x5cd001){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')](_0xcbd4('0x2b'),_0x2e5519['uniqueid']),_0x5cd001);}};exports[_0xcbd4('0x2e')]=function(_0x2aea14){try{if(agents[_0x2aea14[_0xcbd4('0x15')]]){utils[_0xcbd4('0x17')](util[_0xcbd4('0x3')](_0xcbd4('0x2f'),_0x2aea14[_0xcbd4('0x5')]),_0x2aea14);utils['info'](util[_0xcbd4('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2aea14['uniqueid'],agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0x8')],_0x2aea14[_0xcbd4('0x15')]));agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0x30')]=utils['now']();agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0xb')]=_0x2aea14[_0xcbd4('0xb')];agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0x1c')]=_0x2aea14['connectedlinename'];agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0x24')]=_0x2aea14[_0xcbd4('0x25')];agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0xc')]=_0xcbd4('0x31');_['forIn'](agents,function(_0xc396d,_0x11af90){if(_0xc396d['destuniqueid']!=_0x2aea14[_0xcbd4('0x15')]&&_0xc396d[_0xcbd4('0x5')]==_0x2aea14['uniqueid']){_0xc396d[_0xcbd4('0x26')]=0x0;_0xc396d[_0xcbd4('0x24')]=_0x2aea14['ringtime'];_0xc396d[_0xcbd4('0x1f')]=!![];_0xc396d[_0xcbd4('0x32')]=utils['now']();_0xc396d[_0xcbd4('0xc')]=_0xcbd4('0x33');_0xc396d[_0xcbd4('0x2d')]=_0xcbd4('0x33');_0xc396d['answeredelsewheredestinationuniqueid']=_0x2aea14[_0xcbd4('0x15')];_0xc396d[_0xcbd4('0x34')]=_0x2aea14[_0xcbd4('0x8')];writeDB(_0xc396d);}});}}catch(_0x4b1973){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')](_0xcbd4('0x2f'),_0x2aea14['uniqueid']),_0x4b1973);}};exports[_0xcbd4('0x10')]=function(_0x213578){try{if(!_[_0xcbd4('0x20')](agents[_0x213578[_0xcbd4('0x15')]])){utils['debug'](util[_0xcbd4('0x3')](_0xcbd4('0x35'),_0x213578[_0xcbd4('0x5')]),_0x213578);utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x36'),_0x213578[_0xcbd4('0x5')],agents[_0x213578[_0xcbd4('0x15')]]['membername'],_0x213578['destuniqueid']));agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x10')]=!![];agents[_0x213578['destuniqueid']][_0xcbd4('0x37')]=utils[_0xcbd4('0x1a')]();agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x26')]=utils[_0xcbd4('0x38')](agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x37')],agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x30')]);agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x2d')]=_0x213578[_0xcbd4('0x2d')];agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0xc')]=_0xcbd4('0x39');writeDB(agents[_0x213578['destuniqueid']]);}}catch(_0x5c0a41){utils[_0xcbd4('0x1e')](util['format']('[%s][agents][agentcomplete]',_0x213578[_0xcbd4('0x5')]),_0x5c0a41);}};exports[_0xcbd4('0x3a')]=function(_0x162506){try{if(!_[_0xcbd4('0x20')](agents[_0x162506['transfereruniqueid']])){utils[_0xcbd4('0x17')](util['format'](_0xcbd4('0x3b'),_0x162506[_0xcbd4('0x5')]),_0x162506);utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x3c'),_0x162506[_0xcbd4('0x5')],agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x8')],agents[_0x162506[_0xcbd4('0x3d')]]['uniqueid']));agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x3e')]=!![];agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x3f')]=_0xcbd4('0x40');agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x41')]=_0x162506[_0xcbd4('0x42')];agents[_0x162506[_0xcbd4('0x3d')]]['transferuniqueid']=agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x5')];}}catch(_0x2ce2af){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')](_0xcbd4('0x3b'),_0x162506[_0xcbd4('0x5')]),_0x2ce2af);}};exports[_0xcbd4('0x43')]=function(_0x316076){try{utils[_0xcbd4('0x17')](util['format'](_0xcbd4('0x44'),_0x316076['origtransfereruniqueid']),_0x316076);if(_0x316076[_0xcbd4('0x45')]==_0x316076[_0xcbd4('0x46')]){if(!_['isNil'](agents[_0x316076[_0xcbd4('0x47')]])){utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x48'),_0x316076[_0xcbd4('0x45')],agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0x8')]));agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0x3e')]=!![];agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0x3f')]=_0xcbd4('0x49');agents[_0x316076[_0xcbd4('0x47')]]['transferexten']=_0x316076[_0xcbd4('0x4a')];agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0x4b')]=_0x316076[_0xcbd4('0x45')];}if(_0x316076[_0xcbd4('0x4c')]&&agents[_0x316076[_0xcbd4('0x4c')]]){agents[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x4d')]=0x1;transfers[_0x316076[_0xcbd4('0x4c')]]=_[_0xcbd4('0x4e')](agents[_0x316076[_0xcbd4('0x4c')]]);transfers[_0x316076[_0xcbd4('0x4c')]]['calleridnum']=agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0xa')];transfers[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x4f')]=agents[_0x316076[_0xcbd4('0x47')]]['calleridname'];transfers[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x19')]=utils[_0xcbd4('0x1a')]();transfers[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x30')]=utils[_0xcbd4('0x1a')]();transfers[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x24')]=0x0;transfers[_0x316076[_0xcbd4('0x4c')]]['agententerreason']=0x2;}}else if(_0x316076[_0xcbd4('0x47')]==_0x316076[_0xcbd4('0x50')]){if(!_[_0xcbd4('0x20')](agents[_0x316076[_0xcbd4('0x45')]])){utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x48'),_0x316076[_0xcbd4('0x45')],agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x8')]));agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x3e')]=!![];agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x3f')]=_0xcbd4('0x49');agents[_0x316076[_0xcbd4('0x45')]]['transferexten']=_0x316076[_0xcbd4('0x51')];agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x4b')]=_0x316076[_0xcbd4('0x47')];}if(_0x316076['transfertargetuniqueid']&&agents[_0x316076[_0xcbd4('0x52')]]){agents[_0x316076[_0xcbd4('0x52')]][_0xcbd4('0x4d')]=0x1;transfers[_0x316076[_0xcbd4('0x52')]]=_[_0xcbd4('0x4e')](agents[_0x316076[_0xcbd4('0x52')]]);transfers[_0x316076[_0xcbd4('0x52')]]['calleridnum']=agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0xa')];transfers[_0x316076[_0xcbd4('0x52')]][_0xcbd4('0x4f')]=agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x4f')];transfers[_0x316076['transfertargetuniqueid']][_0xcbd4('0x19')]=utils['now']();transfers[_0x316076[_0xcbd4('0x52')]][_0xcbd4('0x30')]=utils[_0xcbd4('0x1a')]();transfers[_0x316076[_0xcbd4('0x52')]]['holdtime']=0x0;transfers[_0x316076[_0xcbd4('0x52')]][_0xcbd4('0x4d')]=0x2;}}}catch(_0xa2e555){utils[_0xcbd4('0x1e')](util['format']('[%s][agents][attendedtransfer]',_0x316076[_0xcbd4('0x45')]),_0xa2e555);}};exports[_0xcbd4('0x53')]=function(_0x1cdf15){try{utils[_0xcbd4('0x17')](util['format'](_0xcbd4('0x54'),_0x1cdf15['uniqueid']),_0x1cdf15);if(agents[_0x1cdf15[_0xcbd4('0x5')]]&&agents[_0x1cdf15[_0xcbd4('0x5')]]['reason']===_0xcbd4('0x23')){if(_0x1cdf15[_0xcbd4('0x55')]==='21'){agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x2d')]=_0xcbd4('0x56');agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]=_0xcbd4('0x56');}utils['info'](util[_0xcbd4('0x3')](_0xcbd4('0x57'),_0x1cdf15[_0xcbd4('0x5')],agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x8')],agents[_0x1cdf15[_0xcbd4('0x5')]]['reason'],agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]));writeDB(agents[_0x1cdf15[_0xcbd4('0x5')]]);var _0x5dfe5=unanswered[_0xcbd4('0x58')](_0x1cdf15[_0xcbd4('0x5')]);if(_0x5dfe5>-0x1){unanswered[_0xcbd4('0x59')](_0x5dfe5,0x1);}}if(transfers[_0x1cdf15[_0xcbd4('0x5')]]){transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x10')]=!![];transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x37')]=utils['now']();transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x26')]=utils[_0xcbd4('0x38')](transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x37')],transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x30')]);transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x2d')]='agent';transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]=_0xcbd4('0x39');utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x57'),_0x1cdf15[_0xcbd4('0x5')],transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x8')],transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x2d')],transfers[_0x1cdf15['uniqueid']]['lastevent']));writeDB(transfers[_0x1cdf15['uniqueid']],!![]);}if(agents[_0x1cdf15[_0xcbd4('0x5')]]&&agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x30')]){agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x10')]=!![];agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x37')]=utils[_0xcbd4('0x1a')]();agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x26')]=utils[_0xcbd4('0x38')](agents[_0x1cdf15['uniqueid']][_0xcbd4('0x37')],agents[_0x1cdf15[_0xcbd4('0x5')]]['agentconnectAt']);agents[_0x1cdf15[_0xcbd4('0x5')]]['reason']=agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x3e')]?_0xcbd4('0x3e'):'agent';agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]='complete';utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x57'),_0x1cdf15[_0xcbd4('0x5')],agents[_0x1cdf15[_0xcbd4('0x5')]]['membername'],agents[_0x1cdf15[_0xcbd4('0x5')]]['reason'],agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]));writeDB(agents[_0x1cdf15[_0xcbd4('0x5')]]);}}catch(_0x1cace7){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')]('[%s][agents][hangup]',_0x1cdf15[_0xcbd4('0x5')]),_0x1cace7);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 6154038..918e350 100644 --- a/server/services/xdr/calls.controller.js +++ b/server/services/xdr/calls.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf676=['callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','noop','gotoif','[%s][calls][newexten]','lodash','util','FAILED','NO\x20ANSWER','BUSY','channel','membername','interface','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','info','format','context','calleridnum','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','channelstate','ANSWERED','hangup'];(function(_0xf75999,_0x40f070){var _0x3e6d35=function(_0x4d0b2f){while(--_0x4d0b2f){_0xf75999['push'](_0xf75999['shift']());}};_0x3e6d35(++_0x40f070);}(_0xf676,0x161));var _0x6f67=function(_0x26271e,_0x117dd8){_0x26271e=_0x26271e-0x0;var _0x3c7ac7=_0xf676[_0x26271e];return _0x3c7ac7;};'use strict';var _=require(_0x6f67('0x0'));var util=require(_0x6f67('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0x6f67('0x2'),_0x6f67('0x2'),_0x6f67('0x3'),_0x6f67('0x3'),'NO\x20ANSWER','ANSWERED',_0x6f67('0x4'),_0x6f67('0x2'),_0x6f67('0x2'),'FAILED'];var channels={};function writeDB(_0x4d9776){utils['info'](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x4d9776['uniqueid'],_0x4d9776[_0x6f67('0x5')],_0x4d9776['queue'],_0x4d9776[_0x6f67('0x6')],_0x4d9776[_0x6f67('0x7')],_0x4d9776['calleridnum'],_0x4d9776['connectedlinenum'],_0x4d9776['lastevent']));if(_0x4d9776[_0x6f67('0x8')]){utils[_0x6f67('0x9')](_0x4d9776[_0x6f67('0x8')])[_0x6f67('0xa')](function(_0x35e397){if(_0x35e397){_0x4d9776[_0x6f67('0xb')]=_0x35e397['id'];}utils[_0x6f67('0xc')](_0x6f67('0xd'),_0x4d9776);});}else{utils[_0x6f67('0xc')](_0x6f67('0xd'),_0x4d9776);}if(channels[_0x4d9776[_0x6f67('0xe')]]){delete channels[_0x4d9776[_0x6f67('0xe')]];}}exports[_0x6f67('0xf')]=function(_0x52faa9){try{utils[_0x6f67('0x10')](util['format'](_0x6f67('0x11'),_0x52faa9[_0x6f67('0xe')]),_0x52faa9);if(_0x52faa9[_0x6f67('0xe')]==_0x52faa9['linkedid']&&_0x52faa9['channel']!='OutgoingSpoolFailed'){utils[_0x6f67('0x12')](util[_0x6f67('0x13')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x52faa9['uniqueid'],_0x52faa9[_0x6f67('0x14')],_0x52faa9['exten']));channels[_0x52faa9[_0x6f67('0xe')]]={'uniqueid':_0x52faa9[_0x6f67('0xe')],'accountcode':_0x52faa9[_0x6f67('0x8')],'source':_0x52faa9[_0x6f67('0x15')],'destination':_0x52faa9[_0x6f67('0x16')],'destinationcontext':_0x52faa9[_0x6f67('0x14')],'channel':_0x52faa9[_0x6f67('0x5')],'starttime':utils[_0x6f67('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x6f67('0x18')};}}catch(_0x188886){utils[_0x6f67('0x19')](util['format'](_0x6f67('0x11'),_0x52faa9[_0x6f67('0xe')]),_0x188886);}};exports[_0x6f67('0x1a')]=function(_0xa48459){try{utils[_0x6f67('0x10')](util[_0x6f67('0x13')](_0x6f67('0x1b'),_0xa48459['uniqueid']),_0xa48459);if(!_[_0x6f67('0x1c')](channels[_0xa48459['uniqueid']])&&_0xa48459['channelstate']==0x6){utils['info'](util[_0x6f67('0x13')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0xa48459[_0x6f67('0xe')],_0xa48459['context'],_0xa48459[_0x6f67('0x5')]));if(_['isNil'](channels[_0xa48459[_0x6f67('0xe')]]['systemanswertime'])){channels[_0xa48459[_0x6f67('0xe')]][_0x6f67('0x1d')]=utils['now']();}}else if(!_[_0x6f67('0x1c')](channels[_0xa48459['linkedid']])&&_0xa48459['channelstate']==0x6&&_0xa48459['context']!='transfer'){utils[_0x6f67('0x12')](util[_0x6f67('0x13')](_0x6f67('0x1e'),_0xa48459[_0x6f67('0xe')],_0xa48459[_0x6f67('0x1f')],_0xa48459[_0x6f67('0x14')],_0xa48459['channel']));channels[_0xa48459[_0x6f67('0x1f')]][_0x6f67('0x8')]=_0xa48459[_0x6f67('0x8')];channels[_0xa48459[_0x6f67('0x1f')]][_0x6f67('0x20')]=_0xa48459[_0x6f67('0x5')];if(_['isNil'](channels[_0xa48459[_0x6f67('0x1f')]][_0x6f67('0x21')])){channels[_0xa48459['linkedid']][_0x6f67('0x21')]=utils['now']();}channels[_0xa48459[_0x6f67('0x1f')]][_0x6f67('0x22')]=dispositions[_[_0x6f67('0x23')](_0xa48459[_0x6f67('0x24')])]||_0x6f67('0x25');}}catch(_0xd3d5a3){utils[_0x6f67('0x19')](util[_0x6f67('0x13')](_0x6f67('0x1b'),_0xa48459[_0x6f67('0xe')]),_0xd3d5a3);}};exports[_0x6f67('0x26')]=function(_0xdf0ed1){try{if(!_[_0x6f67('0x1c')](channels[_0xdf0ed1[_0x6f67('0xe')]])){utils['debug'](util[_0x6f67('0x13')]('[%s][calls][hangup]',_0xdf0ed1[_0x6f67('0xe')]),_0xdf0ed1);if(_[_0x6f67('0x1c')](channels[_0xdf0ed1[_0x6f67('0xe')]][_0x6f67('0x27')])){channels[_0xdf0ed1[_0x6f67('0xe')]][_0x6f67('0x27')]=_0xdf0ed1[_0x6f67('0x28')]+'\x20<'+_0xdf0ed1[_0x6f67('0x15')]+'>';}utils[_0x6f67('0x12')](util[_0x6f67('0x13')](_0x6f67('0x29'),_0xdf0ed1[_0x6f67('0xe')],channels[_0xdf0ed1['uniqueid']][_0x6f67('0x27')],_0xdf0ed1['cause-txt']));channels[_0xdf0ed1['uniqueid']][_0x6f67('0x2a')]=utils[_0x6f67('0x17')]();channels[_0xdf0ed1['uniqueid']][_0x6f67('0x2b')]=utils[_0x6f67('0x2c')](channels[_0xdf0ed1[_0x6f67('0xe')]][_0x6f67('0x2a')],channels[_0xdf0ed1[_0x6f67('0xe')]][_0x6f67('0x2d')]);channels[_0xdf0ed1[_0x6f67('0xe')]][_0x6f67('0x2e')]=channels[_0xdf0ed1[_0x6f67('0xe')]][_0x6f67('0x21')]?utils['diffTime'](channels[_0xdf0ed1[_0x6f67('0xe')]][_0x6f67('0x2a')],channels[_0xdf0ed1[_0x6f67('0xe')]][_0x6f67('0x21')]):0x0;writeDB(channels[_0xdf0ed1[_0x6f67('0xe')]]);}}catch(_0x46dd58){utils[_0x6f67('0x19')](util[_0x6f67('0x13')]('[%s][calls][hangup]',_0xdf0ed1[_0x6f67('0xe')]),_0x46dd58);}};exports[_0x6f67('0x2f')]=function(_0x4dd291){try{if(!_[_0x6f67('0x1c')](channels[_0x4dd291['localtwolinkedid']])){utils[_0x6f67('0x10')](util[_0x6f67('0x13')](_0x6f67('0x30'),_0x4dd291[_0x6f67('0x31')]),_0x4dd291);if(channels[_0x4dd291[_0x6f67('0x32')]][_0x6f67('0x5')]==_0x4dd291[_0x6f67('0x33')]){utils[_0x6f67('0x12')](util[_0x6f67('0x13')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4dd291[_0x6f67('0x31')],_0x4dd291['localtwolinkedid'],_0x4dd291[_0x6f67('0x34')]));channels[_0x4dd291[_0x6f67('0x32')]][_0x6f67('0x20')]=_0x4dd291['secondtransfererchannel'];channels[_0x4dd291['localtwolinkedid']][_0x6f67('0x35')]=_0x6f67('0x36');}else if(channels[_0x4dd291[_0x6f67('0x32')]]['channel']=_0x4dd291[_0x6f67('0x37')]){utils['info'](util['format'](_0x6f67('0x38'),_0x4dd291[_0x6f67('0x31')],_0x4dd291[_0x6f67('0x32')],_0x4dd291[_0x6f67('0x39')]));channels[_0x4dd291[_0x6f67('0x32')]]['destinationchannel']=_0x4dd291[_0x6f67('0x39')];channels[_0x4dd291['localtwolinkedid']][_0x6f67('0x35')]=_0x6f67('0x36');}}}catch(_0x3b870a){utils[_0x6f67('0x19')](util[_0x6f67('0x13')](_0x6f67('0x30'),_0x4dd291[_0x6f67('0x31')]),_0x3b870a);}};exports['musiconholdstart']=function(_0x3a6847){try{if(!_['isNil'](channels[_0x3a6847['uniqueid']])){utils[_0x6f67('0x10')](util[_0x6f67('0x13')](_0x6f67('0x3a'),_0x3a6847[_0x6f67('0xe')]),_0x3a6847);channels[_0x3a6847[_0x6f67('0xe')]][_0x6f67('0x3b')]=utils['now']();utils['info'](util[_0x6f67('0x13')](_0x6f67('0x3c'),_0x3a6847[_0x6f67('0xe')],channels[_0x3a6847[_0x6f67('0xe')]][_0x6f67('0x3b')]));}}catch(_0x1f78fb){utils['error'](util[_0x6f67('0x13')](_0x6f67('0x3a'),_0x3a6847[_0x6f67('0xe')]),_0x1f78fb);}};exports['musiconholdstop']=function(_0x2661ed){try{if(!_[_0x6f67('0x1c')](channels[_0x2661ed['uniqueid']])){utils['debug'](util['format'](_0x6f67('0x3d'),_0x2661ed[_0x6f67('0xe')]),_0x2661ed);if(!_[_0x6f67('0x1c')](channels[_0x2661ed[_0x6f67('0xe')]][_0x6f67('0x3b')])){channels[_0x2661ed[_0x6f67('0xe')]][_0x6f67('0x3e')]+=utils[_0x6f67('0x2c')](utils[_0x6f67('0x17')](),channels[_0x2661ed[_0x6f67('0xe')]][_0x6f67('0x3b')]);utils[_0x6f67('0x12')](util[_0x6f67('0x13')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2661ed[_0x6f67('0xe')],channels[_0x2661ed[_0x6f67('0xe')]][_0x6f67('0x3e')]));delete channels[_0x2661ed['uniqueid']][_0x6f67('0x3b')];}}}catch(_0x199be5){utils[_0x6f67('0x19')](util[_0x6f67('0x13')](_0x6f67('0x3d'),_0x2661ed[_0x6f67('0xe')]),_0x199be5);}};exports['varset']=function(_0xdc029a){try{if(!_['isNil'](channels[_0xdc029a[_0x6f67('0xe')]])){utils[_0x6f67('0x10')](util[_0x6f67('0x13')](_0x6f67('0x3f'),_0xdc029a[_0x6f67('0xe')]),_0xdc029a);if(!_[_0x6f67('0x1c')](_0xdc029a[_0x6f67('0x40')][_0x6f67('0x41')])){utils[_0x6f67('0x12')](util[_0x6f67('0x13')](_0x6f67('0x42'),_0xdc029a['uniqueid'],_0xdc029a['value']));channels[_0xdc029a[_0x6f67('0xe')]][_0x6f67('0x43')]=_0xdc029a[_0x6f67('0x44')];}if(!_[_0x6f67('0x1c')](_0xdc029a['variable'][_0x6f67('0x45')])){utils[_0x6f67('0x12')](util[_0x6f67('0x13')](_0x6f67('0x46'),_0xdc029a[_0x6f67('0xe')],_0xdc029a[_0x6f67('0x44')]));channels[_0xdc029a[_0x6f67('0xe')]][_0x6f67('0x47')]=_0xdc029a[_0x6f67('0x44')];channels[_0xdc029a[_0x6f67('0xe')]][_0x6f67('0x27')]='\x22'+_0xdc029a[_0x6f67('0x44')]+_0x6f67('0x48')+_0xdc029a[_0x6f67('0x44')]+'>';}if(!_[_0x6f67('0x1c')](_0xdc029a['variable'][_0x6f67('0x49')])||!_[_0x6f67('0x1c')](_0xdc029a['variable'][_0x6f67('0x4a')])){utils[_0x6f67('0x12')](util[_0x6f67('0x13')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xdc029a['uniqueid'],!_[_0x6f67('0x1c')](_0xdc029a[_0x6f67('0x40')][_0x6f67('0x49')])?'xmd-callerid-preview':_0x6f67('0x4a'),_0xdc029a[_0x6f67('0x44')]));channels[_0xdc029a[_0x6f67('0xe')]][_0x6f67('0x27')]=_0xdc029a[_0x6f67('0x44')];}if(!_[_0x6f67('0x1c')](_0xdc029a[_0x6f67('0x40')][_0x6f67('0x4b')])||!_['isNil'](_0xdc029a['variable']['xmcs-queue'])){utils[_0x6f67('0x12')](util[_0x6f67('0x13')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xdc029a[_0x6f67('0xe')],!_[_0x6f67('0x1c')](_0xdc029a[_0x6f67('0x40')]['xmd-queue'])?_0x6f67('0x4b'):_0x6f67('0x4c'),_0xdc029a[_0x6f67('0x44')]));channels[_0xdc029a[_0x6f67('0xe')]][_0x6f67('0x4d')]='Queue';channels[_0xdc029a[_0x6f67('0xe')]][_0x6f67('0x4e')]=_0xdc029a[_0x6f67('0x44')];channels[_0xdc029a[_0x6f67('0xe')]]['queue']=!![];}if(!_[_0x6f67('0x1c')](_0xdc029a['variable'][_0x6f67('0x4f')])){utils[_0x6f67('0x12')](util['format'](_0x6f67('0x50'),_0xdc029a[_0x6f67('0xe')],_0xdc029a['value']));channels[_0xdc029a[_0x6f67('0xe')]]['ContactId']=_0xdc029a[_0x6f67('0x44')];}if(!_[_0x6f67('0x1c')](_0xdc029a[_0x6f67('0x40')]['xmd-cdrtype'])){utils[_0x6f67('0x12')](util[_0x6f67('0x13')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xdc029a[_0x6f67('0xe')],_0xdc029a['value']));channels[_0xdc029a[_0x6f67('0xe')]]['type']=_0xdc029a['value'];}if(!_[_0x6f67('0x1c')](_0xdc029a[_0x6f67('0x40')]['outboundrouteid'])){utils[_0x6f67('0x12')](util['format'](_0x6f67('0x51'),_0xdc029a[_0x6f67('0xe')],_0xdc029a[_0x6f67('0x44')]));channels[_0xdc029a[_0x6f67('0xe')]][_0x6f67('0x52')]=_0xdc029a['value'];}if(!_[_0x6f67('0x1c')](_0xdc029a[_0x6f67('0x40')][_0x6f67('0x53')])){utils[_0x6f67('0x12')](util['format'](_0x6f67('0x54'),_0xdc029a['uniqueid'],_0xdc029a[_0x6f67('0x44')]));channels[_0xdc029a['uniqueid']][_0x6f67('0x53')]=_0xdc029a['value'];}}}catch(_0xf20b59){utils['error'](util[_0x6f67('0x13')]('[%s][calls][varset]',_0xdc029a[_0x6f67('0xe')]),_0xf20b59);}};exports[_0x6f67('0x55')]=function(_0x4e1f30){try{if(!_[_0x6f67('0x1c')](channels[_0x4e1f30['uniqueid']])){utils[_0x6f67('0x10')](util[_0x6f67('0x13')]('[%s][calls][newexten]',_0x4e1f30[_0x6f67('0xe')]),_0x4e1f30);utils[_0x6f67('0x12')](util[_0x6f67('0x13')](_0x6f67('0x56'),_0x4e1f30[_0x6f67('0xe')],_0x4e1f30['application'],_0x4e1f30[_0x6f67('0x57')]));if(_0x4e1f30[_0x6f67('0x58')][_0x6f67('0x59')]()==_0x6f67('0x5a')&&_[_0x6f67('0x5b')](_0x4e1f30['appdata'][_0x6f67('0x59')](),_0x6f67('0x5c'))){var _0x5cf3d6=_0x4e1f30[_0x6f67('0x57')]['split']('=');var _0x49a575=_0x5cf3d6[0x0][_0x6f67('0x5d')](_0x5cf3d6[0x0][_0x6f67('0x5e')]('(')+0x1,_0x5cf3d6[0x0]['lastIndexOf'](')'));var _0x5e664b=_0x5cf3d6[0x1];channels[_0x4e1f30['uniqueid']][_0x49a575]=_0x5e664b;}if(!_['includes']([_0x6f67('0x26'),_0x6f67('0x5f'),'execif',_0x6f67('0x5a'),_0x6f67('0x60')],_0x4e1f30['application']['toLowerCase']())){channels[_0x4e1f30[_0x6f67('0xe')]][_0x6f67('0x4d')]=_0x4e1f30[_0x6f67('0x58')];channels[_0x4e1f30[_0x6f67('0xe')]][_0x6f67('0x4e')]=_0x4e1f30[_0x6f67('0x57')];}}}catch(_0x52238c){utils[_0x6f67('0x19')](util['format'](_0x6f67('0x61'),_0x4e1f30[_0x6f67('0xe')]),_0x52238c);}}; \ No newline at end of file +var _0xa8f6=['info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','connectedlinenum','lastevent','accountcode','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','now','DOCUMENTATION','error','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','origtransfererchannel','userfield','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','destination','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastdata','[%s][calls][newexten]','lodash','./utils','FAILED','NO\x20ANSWER','ANSWERED'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa8f6,0x11b));var _0x6a8f=function(_0x4214b1,_0x517af6){_0x4214b1=_0x4214b1-0x0;var _0x245197=_0xa8f6[_0x4214b1];return _0x245197;};'use strict';var _=require(_0x6a8f('0x0'));var util=require('util');var utils=require(_0x6a8f('0x1'));var dispositions=['NO\x20ANSWER','FAILED',_0x6a8f('0x2'),_0x6a8f('0x3'),_0x6a8f('0x3'),_0x6a8f('0x3'),_0x6a8f('0x4'),'BUSY',_0x6a8f('0x2'),'FAILED',_0x6a8f('0x2')];var channels={};function writeDB(_0x4291db){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x7'),_0x4291db[_0x6a8f('0x8')],_0x4291db[_0x6a8f('0x9')],_0x4291db[_0x6a8f('0xa')],_0x4291db['membername'],_0x4291db[_0x6a8f('0xb')],_0x4291db['calleridnum'],_0x4291db[_0x6a8f('0xc')],_0x4291db[_0x6a8f('0xd')]));if(_0x4291db[_0x6a8f('0xe')]){utils['getUserByInternal'](_0x4291db[_0x6a8f('0xe')])[_0x6a8f('0xf')](function(_0x4f32ee){if(_0x4f32ee){_0x4291db['UserId']=_0x4f32ee['id'];}utils[_0x6a8f('0x10')](_0x6a8f('0x11'),_0x4291db);});}else{utils[_0x6a8f('0x10')]('CreateVoiceCallReport',_0x4291db);}if(channels[_0x4291db[_0x6a8f('0x8')]]){delete channels[_0x4291db[_0x6a8f('0x8')]];}}exports['newchannel']=function(_0x33f5cf){try{utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x13'),_0x33f5cf['uniqueid']),_0x33f5cf);if(_0x33f5cf[_0x6a8f('0x8')]==_0x33f5cf[_0x6a8f('0x14')]&&_0x33f5cf[_0x6a8f('0x9')]!=_0x6a8f('0x15')){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x16'),_0x33f5cf[_0x6a8f('0x8')],_0x33f5cf[_0x6a8f('0x17')],_0x33f5cf['exten']));channels[_0x33f5cf[_0x6a8f('0x8')]]={'uniqueid':_0x33f5cf['uniqueid'],'accountcode':_0x33f5cf[_0x6a8f('0xe')],'source':_0x33f5cf[_0x6a8f('0x18')],'destination':_0x33f5cf['exten'],'destinationcontext':_0x33f5cf[_0x6a8f('0x17')],'channel':_0x33f5cf[_0x6a8f('0x9')],'starttime':utils[_0x6a8f('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6a8f('0x3'),'amaflags':_0x6a8f('0x1a')};}}catch(_0x30505d){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x13'),_0x33f5cf['uniqueid']),_0x30505d);}};exports['newstate']=function(_0x44a186){try{utils[_0x6a8f('0x12')](util['format']('[%s][calls][newstate]',_0x44a186[_0x6a8f('0x8')]),_0x44a186);if(!_[_0x6a8f('0x1c')](channels[_0x44a186['uniqueid']])&&_0x44a186[_0x6a8f('0x1d')]==0x6){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x1e'),_0x44a186[_0x6a8f('0x8')],_0x44a186['context'],_0x44a186['channel']));if(_[_0x6a8f('0x1c')](channels[_0x44a186[_0x6a8f('0x8')]][_0x6a8f('0x1f')])){channels[_0x44a186[_0x6a8f('0x8')]][_0x6a8f('0x1f')]=utils[_0x6a8f('0x19')]();}}else if(!_[_0x6a8f('0x1c')](channels[_0x44a186[_0x6a8f('0x14')]])&&_0x44a186['channelstate']==0x6&&_0x44a186[_0x6a8f('0x17')]!=_0x6a8f('0x20')){utils['info'](util['format'](_0x6a8f('0x21'),_0x44a186[_0x6a8f('0x8')],_0x44a186[_0x6a8f('0x14')],_0x44a186[_0x6a8f('0x17')],_0x44a186[_0x6a8f('0x9')]));channels[_0x44a186[_0x6a8f('0x14')]]['accountcode']=_0x44a186[_0x6a8f('0xe')];channels[_0x44a186['linkedid']][_0x6a8f('0x22')]=_0x44a186['channel'];if(_[_0x6a8f('0x1c')](channels[_0x44a186[_0x6a8f('0x14')]][_0x6a8f('0x23')])){channels[_0x44a186[_0x6a8f('0x14')]][_0x6a8f('0x23')]=utils['now']();}channels[_0x44a186['linkedid']][_0x6a8f('0x24')]=dispositions[_[_0x6a8f('0x25')](_0x44a186[_0x6a8f('0x1d')])]||_0x6a8f('0x4');}}catch(_0x587817){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x26'),_0x44a186[_0x6a8f('0x8')]),_0x587817);}};exports['hangup']=function(_0x493660){try{if(!_[_0x6a8f('0x1c')](channels[_0x493660[_0x6a8f('0x8')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x27'),_0x493660[_0x6a8f('0x8')]),_0x493660);if(_[_0x6a8f('0x1c')](channels[_0x493660[_0x6a8f('0x8')]]['callerid'])){channels[_0x493660['uniqueid']][_0x6a8f('0x28')]=_0x493660[_0x6a8f('0x29')]+'\x20<'+_0x493660['calleridnum']+'>';}utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x2a'),_0x493660['uniqueid'],channels[_0x493660['uniqueid']][_0x6a8f('0x28')],_0x493660[_0x6a8f('0x2b')]));channels[_0x493660[_0x6a8f('0x8')]]['endtime']=utils[_0x6a8f('0x19')]();channels[_0x493660['uniqueid']]['duration']=utils[_0x6a8f('0x2c')](channels[_0x493660[_0x6a8f('0x8')]][_0x6a8f('0x2d')],channels[_0x493660[_0x6a8f('0x8')]][_0x6a8f('0x2e')]);channels[_0x493660[_0x6a8f('0x8')]][_0x6a8f('0x2f')]=channels[_0x493660[_0x6a8f('0x8')]]['answertime']?utils[_0x6a8f('0x2c')](channels[_0x493660['uniqueid']][_0x6a8f('0x2d')],channels[_0x493660[_0x6a8f('0x8')]][_0x6a8f('0x23')]):0x0;writeDB(channels[_0x493660[_0x6a8f('0x8')]]);}}catch(_0x3b2d99){utils[_0x6a8f('0x1b')](util['format'](_0x6a8f('0x27'),_0x493660[_0x6a8f('0x8')]),_0x3b2d99);}};exports[_0x6a8f('0x30')]=function(_0x17373f){try{if(!_[_0x6a8f('0x1c')](channels[_0x17373f[_0x6a8f('0x31')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x32'),_0x17373f[_0x6a8f('0x33')]),_0x17373f);if(channels[_0x17373f[_0x6a8f('0x31')]][_0x6a8f('0x9')]==_0x17373f['transfereechannel']){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x34'),_0x17373f[_0x6a8f('0x33')],_0x17373f[_0x6a8f('0x31')],_0x17373f[_0x6a8f('0x35')]));channels[_0x17373f[_0x6a8f('0x31')]][_0x6a8f('0x22')]=_0x17373f[_0x6a8f('0x35')];channels[_0x17373f['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x17373f['localtwolinkedid']][_0x6a8f('0x9')]=_0x17373f['transfertargetchannel']){utils['info'](util[_0x6a8f('0x6')](_0x6a8f('0x34'),_0x17373f['origtransfereruniqueid'],_0x17373f[_0x6a8f('0x31')],_0x17373f[_0x6a8f('0x36')]));channels[_0x17373f['localtwolinkedid']][_0x6a8f('0x22')]=_0x17373f[_0x6a8f('0x36')];channels[_0x17373f[_0x6a8f('0x31')]][_0x6a8f('0x37')]=_0x6a8f('0x38');}}}catch(_0x504a44){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x32'),_0x17373f['origtransfereruniqueid']),_0x504a44);}};exports['musiconholdstart']=function(_0x52ed18){try{if(!_[_0x6a8f('0x1c')](channels[_0x52ed18[_0x6a8f('0x8')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x39'),_0x52ed18[_0x6a8f('0x8')]),_0x52ed18);channels[_0x52ed18['uniqueid']][_0x6a8f('0x3a')]=utils[_0x6a8f('0x19')]();utils['info'](util[_0x6a8f('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x52ed18['uniqueid'],channels[_0x52ed18[_0x6a8f('0x8')]][_0x6a8f('0x3a')]));}}catch(_0x1d1518){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')]('[%s][calls][musiconholdstart]',_0x52ed18[_0x6a8f('0x8')]),_0x1d1518);}};exports[_0x6a8f('0x3b')]=function(_0x3867bd){try{if(!_[_0x6a8f('0x1c')](channels[_0x3867bd[_0x6a8f('0x8')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x3c'),_0x3867bd['uniqueid']),_0x3867bd);if(!_[_0x6a8f('0x1c')](channels[_0x3867bd[_0x6a8f('0x8')]]['musiconholdstartAt'])){channels[_0x3867bd['uniqueid']][_0x6a8f('0x3d')]+=utils[_0x6a8f('0x2c')](utils[_0x6a8f('0x19')](),channels[_0x3867bd[_0x6a8f('0x8')]]['musiconholdstartAt']);utils['info'](util[_0x6a8f('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3867bd[_0x6a8f('0x8')],channels[_0x3867bd['uniqueid']][_0x6a8f('0x3d')]));delete channels[_0x3867bd[_0x6a8f('0x8')]][_0x6a8f('0x3a')];}}}catch(_0x2c0abb){utils[_0x6a8f('0x1b')](util['format']('[%s][calls][musiconholdstop]',_0x3867bd[_0x6a8f('0x8')]),_0x2c0abb);}};exports[_0x6a8f('0x3e')]=function(_0x5b0a61){try{if(!_[_0x6a8f('0x1c')](channels[_0x5b0a61[_0x6a8f('0x8')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x3f'),_0x5b0a61[_0x6a8f('0x8')]),_0x5b0a61);if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x41')])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61['uniqueid']][_0x6a8f('0x43')]=_0x5b0a61[_0x6a8f('0x42')];}if(!_['isNil'](_0x5b0a61[_0x6a8f('0x40')]['xmd-phone'])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x44')]=_0x5b0a61['value'];channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x28')]='\x22'+_0x5b0a61[_0x6a8f('0x42')]+_0x6a8f('0x45')+_0x5b0a61[_0x6a8f('0x42')]+'>';}if(!_['isNil'](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x46')])||!_['isNil'](_0x5b0a61[_0x6a8f('0x40')]['xmd-callerid'])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')]['xmd-callerid-preview'])?_0x6a8f('0x46'):'xmd-callerid',_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]]['callerid']=_0x5b0a61[_0x6a8f('0x42')];}if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x47')])||!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x48')])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x49'),_0x5b0a61[_0x6a8f('0x8')],!_[_0x6a8f('0x1c')](_0x5b0a61['variable'][_0x6a8f('0x47')])?'xmd-queue':'xmcs-queue',_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x4a')]=_0x6a8f('0x4b');channels[_0x5b0a61[_0x6a8f('0x8')]]['lastdata']=_0x5b0a61[_0x6a8f('0x42')];channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0xa')]=!![];}if(!_['isNil'](_0x5b0a61[_0x6a8f('0x40')]['xmd-contactid'])){utils['info'](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5b0a61['uniqueid'],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x4c')]=_0x5b0a61['value'];}if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')]['xmd-cdrtype'])){utils['info'](util[_0x6a8f('0x6')](_0x6a8f('0x4d'),_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x4e')]=_0x5b0a61[_0x6a8f('0x42')];}if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x4f')])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61['uniqueid']][_0x6a8f('0x50')]=_0x5b0a61['value'];}if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x51')])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x51')]=_0x5b0a61['value'];}}}catch(_0x17298e){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x3f'),_0x5b0a61['uniqueid']),_0x17298e);}};exports['newexten']=function(_0x501f3e){try{if(!_[_0x6a8f('0x1c')](channels[_0x501f3e[_0x6a8f('0x8')]])){utils['debug'](util['format']('[%s][calls][newexten]',_0x501f3e[_0x6a8f('0x8')]),_0x501f3e);utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x501f3e[_0x6a8f('0x8')],_0x501f3e[_0x6a8f('0x52')],_0x501f3e[_0x6a8f('0x53')]));if(_0x501f3e[_0x6a8f('0x52')][_0x6a8f('0x54')]()=='set'&&_['startsWith'](_0x501f3e[_0x6a8f('0x53')]['toLowerCase'](),_0x6a8f('0x55'))){var _0x124f9a=_0x501f3e[_0x6a8f('0x53')][_0x6a8f('0x56')]('=');var _0x2cef22=_0x124f9a[0x0][_0x6a8f('0x57')](_0x124f9a[0x0][_0x6a8f('0x58')]('(')+0x1,_0x124f9a[0x0][_0x6a8f('0x58')](')'));var _0x2e0542=_0x124f9a[0x1];channels[_0x501f3e['uniqueid']][_0x2cef22]=_0x2e0542;}if(!_[_0x6a8f('0x59')]([_0x6a8f('0x5a'),_0x6a8f('0x5b'),_0x6a8f('0x5c'),'set',_0x6a8f('0x5d')],_0x501f3e[_0x6a8f('0x52')][_0x6a8f('0x54')]())){channels[_0x501f3e[_0x6a8f('0x8')]][_0x6a8f('0x4a')]=_0x501f3e['application'];channels[_0x501f3e['uniqueid']][_0x6a8f('0x5e')]=_0x501f3e['appdata'];}}}catch(_0x17cb48){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x5f'),_0x501f3e[_0x6a8f('0x8')]),_0x17cb48);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3a4842b..4aa6753 100644 --- a/server/services/xdr/core.controller.js +++ b/server/services/xdr/core.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0490=['close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0x0490,0x9e));var _0x0049=function(_0x4712b6,_0x1f6ad1){_0x4712b6=_0x4712b6-0x0;var _0x542f1d=_0x0490[_0x4712b6];return _0x542f1d;};'use strict';var utils=require(_0x0049('0x0'));exports[_0x0049('0x1')]=function(){utils[_0x0049('0x2')](_0x0049('0x3'));};exports[_0x0049('0x4')]=function(){utils['info'](_0x0049('0x5'));};exports[_0x0049('0x6')]=function(){utils[_0x0049('0x2')](_0x0049('0x7'));};exports[_0x0049('0x8')]=function(_0x5507c6){utils['error'](_0x0049('0x9'),_0x5507c6);};exports[_0x0049('0xa')]=function(){utils[_0x0049('0x2')]('[core]\x20close');};exports[_0x0049('0xb')]=function(_0x3bfa2e){}; \ No newline at end of file +var _0xb0ad=['./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent'];(function(_0x59a0e4,_0x492f2c){var _0x64e2f9=function(_0x42df1e){while(--_0x42df1e){_0x59a0e4['push'](_0x59a0e4['shift']());}};_0x64e2f9(++_0x492f2c);}(_0xb0ad,0x108));var _0xdb0a=function(_0x176754,_0x5d697b){_0x176754=_0x176754-0x0;var _0x438829=_0xb0ad[_0x176754];return _0x438829;};'use strict';var utils=require(_0xdb0a('0x0'));exports[_0xdb0a('0x1')]=function(){utils[_0xdb0a('0x2')](_0xdb0a('0x3'));};exports[_0xdb0a('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0xdb0a('0x5')]=function(){utils[_0xdb0a('0x2')](_0xdb0a('0x6'));};exports[_0xdb0a('0x7')]=function(_0x3ef715){utils[_0xdb0a('0x7')](_0xdb0a('0x8'),_0x3ef715);};exports[_0xdb0a('0x9')]=function(){utils[_0xdb0a('0x2')]('[core]\x20close');};exports[_0xdb0a('0xa')]=function(_0x5976c7){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 3f105be..0671fb3 100644 --- a/server/services/xdr/dials.controller.js +++ b/server/services/xdr/dials.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6835=['value','[%s][dials][dialbegin]','assign','starttime','lastevent','called','dialend','isNil','dialstatus','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','endtime','holdtime','diffTime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6835,0x15e));var _0x5683=function(_0x24071b,_0x10bfe1){_0x24071b=_0x24071b-0x0;var _0xaf3abd=_0x6835[_0x24071b];return _0xaf3abd;};'use strict';var _=require(_0x5683('0x0'));var util=require(_0x5683('0x1'));var utils=require(_0x5683('0x2'));var dials={};function writeDB(_0xc08b54){utils[_0x5683('0x3')](util[_0x5683('0x4')](_0x5683('0x5'),_0xc08b54[_0x5683('0x6')],_0xc08b54[_0x5683('0x7')],_0xc08b54[_0x5683('0x8')],_0xc08b54[_0x5683('0x9')],_0xc08b54[_0x5683('0xa')],_0xc08b54['dialstatus']));utils[_0x5683('0xb')](_0x5683('0xc'),_0xc08b54);delete dials[_0xc08b54[_0x5683('0x6')]];}exports[_0x5683('0xd')]=function(_0x24ac75){try{utils[_0x5683('0xe')](util[_0x5683('0x4')](_0x5683('0xf'),_0x24ac75['uniqueid']),_0x24ac75);utils[_0x5683('0x3')](util[_0x5683('0x4')](_0x5683('0x10'),_0x24ac75[_0x5683('0x6')],_0x24ac75[_0x5683('0x11')],_0x24ac75[_0x5683('0x12')]));if(_0x24ac75['application'][_0x5683('0x13')]()=='set'&&_[_0x5683('0x14')](_0x24ac75[_0x5683('0x12')][_0x5683('0x13')](),_0x5683('0x15'))){var _0x4dcaaf=_0x24ac75[_0x5683('0x12')]['split']('=');dials[_0x24ac75[_0x5683('0x6')]]={'routeId':_0x4dcaaf[0x1]};}}catch(_0x21d73e){utils[_0x5683('0x16')](util[_0x5683('0x4')](_0x5683('0xf'),_0x24ac75[_0x5683('0x6')]),_0x21d73e);}};exports[_0x5683('0x17')]=function(_0xee1353){try{utils[_0x5683('0xe')](util['format'](_0x5683('0x18'),_0xee1353[_0x5683('0x6')]),_0xee1353);if(!_['isNil'](_0xee1353[_0x5683('0x19')][_0x5683('0x1a')])){utils[_0x5683('0x3')](util[_0x5683('0x4')](_0x5683('0x1b'),_0xee1353[_0x5683('0x6')],_0xee1353[_0x5683('0x1c')]));dials[_0xee1353[_0x5683('0x6')]]={'routeId':_0xee1353[_0x5683('0x1c')]};}}catch(_0x2554f4){utils[_0x5683('0x16')](util[_0x5683('0x4')](_0x5683('0x18'),_0xee1353[_0x5683('0x6')]),_0x2554f4);}};exports['dialbegin']=function(_0x3c8189){try{if(!_['isNil'](dials[_0x3c8189[_0x5683('0x6')]])){utils[_0x5683('0xe')](util[_0x5683('0x4')](_0x5683('0x1d'),_0x3c8189[_0x5683('0x6')]),_0x3c8189);dials[_0x3c8189[_0x5683('0x6')]]=_[_0x5683('0x1e')](dials[_0x3c8189['uniqueid']],_0x3c8189);dials[_0x3c8189['uniqueid']][_0x5683('0x1f')]=utils['now']();dials[_0x3c8189[_0x5683('0x6')]][_0x5683('0x20')]=_0x5683('0x21');utils[_0x5683('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3c8189[_0x5683('0x6')],dials[_0x3c8189[_0x5683('0x6')]][_0x5683('0x1f')]));}}catch(_0xca7ba9){utils[_0x5683('0x16')](util['format'](_0x5683('0x1d'),_0x3c8189['uniqueid']),_0xca7ba9);}};exports[_0x5683('0x22')]=function(_0x2eb110){try{if(!_[_0x5683('0x23')](dials[_0x2eb110[_0x5683('0x6')]])){utils[_0x5683('0xe')](util[_0x5683('0x4')]('[%s][dials][dialend]',_0x2eb110[_0x5683('0x6')]),_0x2eb110);dials[_0x2eb110[_0x5683('0x6')]]['dialstatus']=_0x2eb110[_0x5683('0x24')];if(_0x2eb110['dialstatus']==_0x5683('0x25')){dials[_0x2eb110[_0x5683('0x6')]]=_[_0x5683('0x1e')](dials[_0x2eb110[_0x5683('0x6')]],_0x2eb110);dials[_0x2eb110[_0x5683('0x6')]][_0x5683('0x26')]=utils[_0x5683('0x27')]();dials[_0x2eb110[_0x5683('0x6')]][_0x5683('0x20')]=_0x5683('0x28');utils[_0x5683('0x3')](util[_0x5683('0x4')](_0x5683('0x29'),_0x2eb110['uniqueid'],_0x2eb110[_0x5683('0x24')],dials[_0x2eb110[_0x5683('0x6')]][_0x5683('0x26')]));}else{utils[_0x5683('0x3')](util[_0x5683('0x4')](_0x5683('0x2a'),_0x2eb110[_0x5683('0x6')],_0x2eb110[_0x5683('0x24')]));}}}catch(_0x4513cc){utils['error'](util[_0x5683('0x4')](_0x5683('0x2b'),_0x2eb110[_0x5683('0x6')]),_0x4513cc);}};exports[_0x5683('0x2c')]=function(_0x391667){try{if(!_['isNil'](dials[_0x391667[_0x5683('0x6')]])){utils[_0x5683('0xe')](util[_0x5683('0x4')](_0x5683('0x2d'),_0x391667['uniqueid']),_0x391667);utils[_0x5683('0x3')](util[_0x5683('0x4')](_0x5683('0x2e'),_0x391667[_0x5683('0x6')],_0x391667[_0x5683('0x9')],_0x391667[_0x5683('0x2f')],_0x391667[_0x5683('0x30')]));dials[_0x391667[_0x5683('0x6')]]=_['assign'](dials[_0x391667[_0x5683('0x6')]],{'endtime':utils[_0x5683('0x27')](),'lastevent':_0x5683('0x31')});dials[_0x391667[_0x5683('0x6')]]['duration']=utils['diffTime'](dials[_0x391667[_0x5683('0x6')]][_0x5683('0x32')],dials[_0x391667[_0x5683('0x6')]][_0x5683('0x1f')]);dials[_0x391667[_0x5683('0x6')]][_0x5683('0x33')]=utils[_0x5683('0x34')](dials[_0x391667[_0x5683('0x6')]][_0x5683('0x26')]||dials[_0x391667[_0x5683('0x6')]]['endtime'],dials[_0x391667[_0x5683('0x6')]]['starttime']);dials[_0x391667[_0x5683('0x6')]][_0x5683('0x35')]=dials[_0x391667['uniqueid']]['answertime']?utils[_0x5683('0x34')](dials[_0x391667[_0x5683('0x6')]]['endtime'],dials[_0x391667[_0x5683('0x6')]][_0x5683('0x26')]):0x0;writeDB(dials[_0x391667['uniqueid']]);}}catch(_0x4019d6){utils[_0x5683('0x16')](util[_0x5683('0x4')](_0x5683('0x2d'),_0x391667[_0x5683('0x6')]),_0x4019d6);}}; \ No newline at end of file +var _0x55e1=['dialbegin','isNil','[%s][dials][dialbegin]','assign','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','endtime','holdtime','billableseconds','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','info','application','appdata','toLowerCase','startsWith','split','error','varset','[%s][dials][varset]','variable','value'];(function(_0x4b662d,_0x5b8058){var _0x3b9fd4=function(_0x326ed9){while(--_0x326ed9){_0x4b662d['push'](_0x4b662d['shift']());}};_0x3b9fd4(++_0x5b8058);}(_0x55e1,0x166));var _0x155e=function(_0x27db19,_0x41debc){_0x27db19=_0x27db19-0x0;var _0x437fa8=_0x55e1[_0x27db19];return _0x437fa8;};'use strict';var _=require('lodash');var util=require(_0x155e('0x0'));var utils=require(_0x155e('0x1'));var dials={};function writeDB(_0x31f7d6){utils['info'](util[_0x155e('0x2')](_0x155e('0x3'),_0x31f7d6['uniqueid'],_0x31f7d6[_0x155e('0x4')],_0x31f7d6[_0x155e('0x5')],_0x31f7d6[_0x155e('0x6')],_0x31f7d6[_0x155e('0x7')],_0x31f7d6[_0x155e('0x8')]));utils[_0x155e('0x9')](_0x155e('0xa'),_0x31f7d6);delete dials[_0x31f7d6[_0x155e('0xb')]];}exports[_0x155e('0xc')]=function(_0x22f101){try{utils[_0x155e('0xd')](util[_0x155e('0x2')](_0x155e('0xe'),_0x22f101['uniqueid']),_0x22f101);utils[_0x155e('0xf')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x22f101[_0x155e('0xb')],_0x22f101[_0x155e('0x10')],_0x22f101[_0x155e('0x11')]));if(_0x22f101[_0x155e('0x10')][_0x155e('0x12')]()=='set'&&_[_0x155e('0x13')](_0x22f101[_0x155e('0x11')][_0x155e('0x12')](),'cdr(routeid)')){var _0x30a6c7=_0x22f101['appdata'][_0x155e('0x14')]('=');dials[_0x22f101['uniqueid']]={'routeId':_0x30a6c7[0x1]};}}catch(_0x92f88c){utils[_0x155e('0x15')](util['format'](_0x155e('0xe'),_0x22f101[_0x155e('0xb')]),_0x92f88c);}};exports[_0x155e('0x16')]=function(_0x1b062e){try{utils[_0x155e('0xd')](util['format'](_0x155e('0x17'),_0x1b062e[_0x155e('0xb')]),_0x1b062e);if(!_['isNil'](_0x1b062e[_0x155e('0x18')]['outboundrouteid'])){utils[_0x155e('0xf')](util[_0x155e('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x1b062e[_0x155e('0xb')],_0x1b062e[_0x155e('0x19')]));dials[_0x1b062e[_0x155e('0xb')]]={'routeId':_0x1b062e[_0x155e('0x19')]};}}catch(_0x10a208){utils[_0x155e('0x15')](util[_0x155e('0x2')]('[%s][dials][varset]',_0x1b062e[_0x155e('0xb')]),_0x10a208);}};exports[_0x155e('0x1a')]=function(_0x18d0c2){try{if(!_[_0x155e('0x1b')](dials[_0x18d0c2[_0x155e('0xb')]])){utils[_0x155e('0xd')](util[_0x155e('0x2')](_0x155e('0x1c'),_0x18d0c2[_0x155e('0xb')]),_0x18d0c2);dials[_0x18d0c2[_0x155e('0xb')]]=_[_0x155e('0x1d')](dials[_0x18d0c2[_0x155e('0xb')]],_0x18d0c2);dials[_0x18d0c2[_0x155e('0xb')]]['starttime']=utils[_0x155e('0x1e')]();dials[_0x18d0c2['uniqueid']][_0x155e('0x1f')]='called';utils[_0x155e('0xf')](util[_0x155e('0x2')](_0x155e('0x20'),_0x18d0c2['uniqueid'],dials[_0x18d0c2[_0x155e('0xb')]][_0x155e('0x21')]));}}catch(_0x5445ca){utils[_0x155e('0x15')](util[_0x155e('0x2')](_0x155e('0x1c'),_0x18d0c2[_0x155e('0xb')]),_0x5445ca);}};exports[_0x155e('0x22')]=function(_0x16d90c){try{if(!_[_0x155e('0x1b')](dials[_0x16d90c[_0x155e('0xb')]])){utils[_0x155e('0xd')](util['format'](_0x155e('0x23'),_0x16d90c[_0x155e('0xb')]),_0x16d90c);dials[_0x16d90c[_0x155e('0xb')]]['dialstatus']=_0x16d90c[_0x155e('0x8')];if(_0x16d90c[_0x155e('0x8')]==_0x155e('0x24')){dials[_0x16d90c[_0x155e('0xb')]]=_[_0x155e('0x1d')](dials[_0x16d90c[_0x155e('0xb')]],_0x16d90c);dials[_0x16d90c['uniqueid']][_0x155e('0x25')]=utils[_0x155e('0x1e')]();dials[_0x16d90c[_0x155e('0xb')]][_0x155e('0x1f')]='connect';utils[_0x155e('0xf')](util['format'](_0x155e('0x26'),_0x16d90c[_0x155e('0xb')],_0x16d90c[_0x155e('0x8')],dials[_0x16d90c[_0x155e('0xb')]]['answertime']));}else{utils[_0x155e('0xf')](util[_0x155e('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x16d90c[_0x155e('0xb')],_0x16d90c[_0x155e('0x8')]));}}}catch(_0x43cc33){utils['error'](util[_0x155e('0x2')](_0x155e('0x23'),_0x16d90c[_0x155e('0xb')]),_0x43cc33);}};exports[_0x155e('0x27')]=function(_0x5e91f2){try{if(!_['isNil'](dials[_0x5e91f2['uniqueid']])){utils['debug'](util[_0x155e('0x2')](_0x155e('0x28'),_0x5e91f2[_0x155e('0xb')]),_0x5e91f2);utils['info'](util[_0x155e('0x2')](_0x155e('0x29'),_0x5e91f2[_0x155e('0xb')],_0x5e91f2[_0x155e('0x6')],_0x5e91f2[_0x155e('0x2a')],_0x5e91f2[_0x155e('0x2b')]));dials[_0x5e91f2[_0x155e('0xb')]]=_[_0x155e('0x1d')](dials[_0x5e91f2[_0x155e('0xb')]],{'endtime':utils[_0x155e('0x1e')](),'lastevent':_0x155e('0x2c')});dials[_0x5e91f2[_0x155e('0xb')]]['duration']=utils['diffTime'](dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x2d')],dials[_0x5e91f2['uniqueid']][_0x155e('0x21')]);dials[_0x5e91f2['uniqueid']][_0x155e('0x2e')]=utils['diffTime'](dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x25')]||dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x2d')],dials[_0x5e91f2['uniqueid']][_0x155e('0x21')]);dials[_0x5e91f2['uniqueid']][_0x155e('0x2f')]=dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x25')]?utils['diffTime'](dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x2d')],dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x25')]):0x0;writeDB(dials[_0x5e91f2[_0x155e('0xb')]]);}}catch(_0x2abfa9){utils['error'](util[_0x155e('0x2')](_0x155e('0x28'),_0x5e91f2[_0x155e('0xb')]),_0x2abfa9);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b826a83..44602d0 100644 --- a/server/services/xdr/index.js +++ b/server/services/xdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6804=['queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','port','password','keepConnected','xdr','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete'];(function(_0x1c14f6,_0x1d8db5){var _0x875925=function(_0x2bcb3c){while(--_0x2bcb3c){_0x1c14f6['push'](_0x1c14f6['shift']());}};_0x875925(++_0x1d8db5);}(_0x6804,0x1aa));var _0x4680=function(_0x58a8d8,_0x197c07){_0x58a8d8=_0x58a8d8-0x0;var _0x287b9a=_0x6804[_0x58a8d8];return _0x287b9a;};var AsteriskManager=require(_0x4680('0x0'));var config=require(_0x4680('0x1'));var utils=require(_0x4680('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0x4680('0x3')][_0x4680('0x4')],config[_0x4680('0x3')]['ip'],config[_0x4680('0x3')]['username'],config['asterisk'][_0x4680('0x5')],!![]);ami[_0x4680('0x6')]();if(config[_0x4680('0x7')]&&config['xdr']['disabled']){utils[_0x4680('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x4680('0x9'));var calls=require(_0x4680('0xa'));var queues=require(_0x4680('0xb'));var recordings=require(_0x4680('0xc'));var members=require(_0x4680('0xd'));var dials=require(_0x4680('0xe'));var transfers=require(_0x4680('0xf'));var core=require(_0x4680('0x10'));ami['on'](_0x4680('0x11'),core['connect']);ami['on'](_0x4680('0x12'),core[_0x4680('0x12')]);ami['on'](_0x4680('0x13'),core[_0x4680('0x13')]);ami['on']('error',core[_0x4680('0x14')]);ami['on']('close',core[_0x4680('0x15')]);ami['on'](_0x4680('0x16'),core['managerevent']);ami['on'](_0x4680('0x17'),function(_0x210d31){try{utils[_0x4680('0x18')](util['format'](_0x4680('0x19'),_0x210d31[_0x4680('0x1a')]),_0x210d31);members[_0x4680('0x17')](_0x210d31);}catch(_0x3b095d){utils[_0x4680('0x14')](util[_0x4680('0x1b')]('[%s][index][devicestatechange]',_0x210d31[_0x4680('0x1a')]),_0x3b095d);}});ami['on'](_0x4680('0x1c'),function(_0x1f7e65){try{utils[_0x4680('0x18')](util[_0x4680('0x1b')]('[%s][index][agentcalled]',_0x1f7e65[_0x4680('0x1d')]),_0x1f7e65);agents[_0x4680('0x1c')](_0x1f7e65);}catch(_0x189bbd){utils[_0x4680('0x14')](util[_0x4680('0x1b')]('[%s][index][agentcalled]',_0x1f7e65['uniqueid']),_0x189bbd);}});ami['on'](_0x4680('0x1e'),function(_0x4de284){try{utils[_0x4680('0x18')](util['format'](_0x4680('0x1f'),_0x4de284[_0x4680('0x1d')]),_0x4de284);agents['agentringnoanswer'](_0x4de284);}catch(_0x1d7322){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x1f'),_0x4de284[_0x4680('0x1d')]),_0x1d7322);}});ami['on']('agentconnect',function(_0x28b8ed){try{utils['debug'](util['format'](_0x4680('0x20'),_0x28b8ed[_0x4680('0x1d')]),_0x28b8ed);agents[_0x4680('0x21')](_0x28b8ed);queues['agentconnect'](_0x28b8ed);}catch(_0x4c789e){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x20'),_0x28b8ed['uniqueid']),_0x4c789e);}});ami['on']('agentcomplete',function(_0x49097b){try{utils[_0x4680('0x18')](util[_0x4680('0x1b')](_0x4680('0x22'),_0x49097b[_0x4680('0x1d')]),_0x49097b);agents[_0x4680('0x23')](_0x49097b);queues[_0x4680('0x23')](_0x49097b);members[_0x4680('0x23')](_0x49097b);}catch(_0x2b6ecb){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x22'),_0x49097b[_0x4680('0x1d')]),_0x2b6ecb);}});ami['on'](_0x4680('0x24'),function(_0x3525e1){try{utils[_0x4680('0x18')](util['format'](_0x4680('0x25'),_0x3525e1[_0x4680('0x1d')]),_0x3525e1);agents[_0x4680('0x24')](_0x3525e1);queues[_0x4680('0x24')](_0x3525e1);}catch(_0x9868c9){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x25'),_0x3525e1[_0x4680('0x1d')]),_0x9868c9);}});ami['on']('queuecallerjoin',function(_0x4797ad){try{utils[_0x4680('0x18')](util['format'](_0x4680('0x26'),_0x4797ad[_0x4680('0x1d')]),_0x4797ad);queues[_0x4680('0x27')](_0x4797ad);recordings[_0x4680('0x27')](_0x4797ad);}catch(_0x26a889){utils[_0x4680('0x14')](util[_0x4680('0x1b')]('[%s][index][queuecallerjoin]',_0x4797ad['uniqueid']),_0x26a889);}});ami['on']('queuecallerleave',function(_0x413de3){try{utils['debug'](util[_0x4680('0x1b')]('[%s][index][queuecallerleave]',_0x413de3[_0x4680('0x1d')]),_0x413de3);queues[_0x4680('0x28')](_0x413de3);}catch(_0x3537aa){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x29'),_0x413de3[_0x4680('0x1d')]),_0x3537aa);}});ami['on'](_0x4680('0x2a'),function(_0x4b52ab){try{utils[_0x4680('0x18')](util[_0x4680('0x1b')]('[%s][index][musiconholdstart]',_0x4b52ab[_0x4680('0x1d')]),_0x4b52ab);queues[_0x4680('0x2a')](_0x4b52ab);calls['musiconholdstart'](_0x4b52ab);}catch(_0x14ce55){utils[_0x4680('0x14')](util[_0x4680('0x1b')]('[%s][index][musiconholdstart]',_0x4b52ab[_0x4680('0x1d')]),_0x14ce55);}});ami['on'](_0x4680('0x2b'),function(_0x57627f){try{utils['debug'](util[_0x4680('0x1b')](_0x4680('0x2c'),_0x57627f[_0x4680('0x1d')]),_0x57627f);queues[_0x4680('0x2b')](_0x57627f);calls[_0x4680('0x2b')](_0x57627f);}catch(_0x4ca034){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x2c'),_0x57627f['uniqueid']),_0x4ca034);}});ami['on'](_0x4680('0x2d'),function(_0xc2e28c){try{utils[_0x4680('0x18')](util[_0x4680('0x1b')](_0x4680('0x2e'),_0xc2e28c['uniqueid']),_0xc2e28c);calls['newstate'](_0xc2e28c);recordings['newstate'](_0xc2e28c);}catch(_0x484d88){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x2e'),_0xc2e28c[_0x4680('0x1d')]),_0x484d88);}});ami['on']('hangup',function(_0x206ff0){try{utils['debug'](util[_0x4680('0x1b')](_0x4680('0x2f'),_0x206ff0[_0x4680('0x1d')]),_0x206ff0);calls[_0x4680('0x30')](_0x206ff0);recordings['hangup'](_0x206ff0);dials[_0x4680('0x30')](_0x206ff0);agents['hangup'](_0x206ff0);queues['hangup'](_0x206ff0);}catch(_0x30bd0e){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x2f'),_0x206ff0[_0x4680('0x1d')]),_0x30bd0e);}});ami['on'](_0x4680('0x31'),function(_0x29f95c){try{utils[_0x4680('0x18')](util[_0x4680('0x1b')](_0x4680('0x32'),_0x29f95c[_0x4680('0x1d')]),_0x29f95c);members['cdr'](_0x29f95c);}catch(_0x146b07){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x32'),_0x29f95c[_0x4680('0x1d')]),_0x146b07);}});ami['on'](_0x4680('0x33'),function(_0x350bad){try{utils[_0x4680('0x18')](util[_0x4680('0x1b')](_0x4680('0x34'),_0x350bad['uniqueid']),_0x350bad);queues[_0x4680('0x33')](_0x350bad);agents[_0x4680('0x33')](_0x350bad);transfers[_0x4680('0x33')](_0x350bad);}catch(_0x5e72a0){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x34'),_0x350bad[_0x4680('0x1d')]),_0x5e72a0);}});ami['on'](_0x4680('0x35'),function(_0x10802f){try{utils[_0x4680('0x18')](util[_0x4680('0x1b')](_0x4680('0x36'),_0x10802f[_0x4680('0x37')]),_0x10802f);queues['attendedtransfer'](_0x10802f);transfers[_0x4680('0x35')](_0x10802f);agents[_0x4680('0x35')](_0x10802f);calls[_0x4680('0x35')](_0x10802f);}catch(_0x36a0fc){utils[_0x4680('0x14')](util[_0x4680('0x1b')]('[%s][index][attendedtransfer]',_0x10802f[_0x4680('0x37')]),_0x36a0fc);}});ami['on']('varset',function(_0xe3370d){try{utils[_0x4680('0x18')](util['format'](_0x4680('0x38'),_0xe3370d[_0x4680('0x1d')]),_0xe3370d);queues[_0x4680('0x39')](_0xe3370d);recordings['varset'](_0xe3370d);calls['varset'](_0xe3370d);dials['varset'](_0xe3370d);}catch(_0x3d690d){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x38'),_0xe3370d['uniqueid']),_0x3d690d);}});ami['on']('newexten',function(_0x7f0f9){try{utils[_0x4680('0x18')](util[_0x4680('0x1b')]('[%s][index][newexten]',_0x7f0f9['uniqueid']),_0x7f0f9);calls['newexten'](_0x7f0f9);recordings[_0x4680('0x3a')](_0x7f0f9);dials[_0x4680('0x3a')](_0x7f0f9);}catch(_0x5806fb){utils[_0x4680('0x14')](util['format'](_0x4680('0x3b'),_0x7f0f9['uniqueid']),_0x5806fb);}});ami['on'](_0x4680('0x3c'),function(_0x193382){try{utils[_0x4680('0x18')](util['format'](_0x4680('0x3d'),_0x193382['uniqueid']),_0x193382);calls[_0x4680('0x3c')](_0x193382);recordings[_0x4680('0x3c')](_0x193382);}catch(_0x1305ef){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x3d'),_0x193382['uniqueid']),_0x1305ef);}});ami['on'](_0x4680('0x3e'),function(_0x1b764b){try{utils['debug'](util['format']('[%s][index][dialbegin]',_0x1b764b[_0x4680('0x1d')]),_0x1b764b);dials[_0x4680('0x3e')](_0x1b764b);}catch(_0x9c32c){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x3f'),_0x1b764b[_0x4680('0x1d')]),_0x9c32c);}});ami['on'](_0x4680('0x40'),function(_0x588758){try{utils[_0x4680('0x18')](util[_0x4680('0x1b')](_0x4680('0x41'),_0x588758['uniqueid']),_0x588758);dials[_0x4680('0x40')](_0x588758);}catch(_0xaf0c89){utils[_0x4680('0x14')](util[_0x4680('0x1b')](_0x4680('0x41'),_0x588758[_0x4680('0x1d')]),_0xaf0c89);}});} \ No newline at end of file +var _0xe9b9=['[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','port','asterisk','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]'];(function(_0xad8fea,_0x358e38){var _0x567519=function(_0x11dd75){while(--_0x11dd75){_0xad8fea['push'](_0xad8fea['shift']());}};_0x567519(++_0x358e38);}(_0xe9b9,0x120));var _0x9e9b=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xe9b9[_0x1d87fc];return _0x492b56;};var AsteriskManager=require('asterisk-manager');var config=require(_0x9e9b('0x0'));var utils=require(_0x9e9b('0x1'));var util=require(_0x9e9b('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x9e9b('0x3')],config[_0x9e9b('0x4')]['ip'],config[_0x9e9b('0x4')][_0x9e9b('0x5')],config[_0x9e9b('0x4')]['password'],!![]);ami[_0x9e9b('0x6')]();if(config['xdr']&&config[_0x9e9b('0x7')][_0x9e9b('0x8')]){utils[_0x9e9b('0x9')](_0x9e9b('0xa'));}else{var agents=require(_0x9e9b('0xb'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x9e9b('0xc'));var members=require(_0x9e9b('0xd'));var dials=require(_0x9e9b('0xe'));var transfers=require('./transfers.controller');var core=require(_0x9e9b('0xf'));ami['on'](_0x9e9b('0x10'),core['connect']);ami['on']('shutdown',core[_0x9e9b('0x11')]);ami['on']('fullybooted',core[_0x9e9b('0x12')]);ami['on']('error',core[_0x9e9b('0x13')]);ami['on'](_0x9e9b('0x14'),core['close']);ami['on']('managerevent',core[_0x9e9b('0x15')]);ami['on'](_0x9e9b('0x16'),function(_0x84f9db){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')]('[%s][index][devicestatechange]',_0x84f9db[_0x9e9b('0x19')]),_0x84f9db);members['devicestatechange'](_0x84f9db);}catch(_0x113635){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x1a'),_0x84f9db[_0x9e9b('0x19')]),_0x113635);}});ami['on']('agentcalled',function(_0x4493a5){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x1b'),_0x4493a5[_0x9e9b('0x1c')]),_0x4493a5);agents['agentcalled'](_0x4493a5);}catch(_0x40f5d2){utils['error'](util['format'](_0x9e9b('0x1b'),_0x4493a5[_0x9e9b('0x1c')]),_0x40f5d2);}});ami['on']('agentringnoanswer',function(_0x53409b){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')]('[%s][index][agentringnoanswer]',_0x53409b[_0x9e9b('0x1c')]),_0x53409b);agents[_0x9e9b('0x1d')](_0x53409b);}catch(_0x277ca4){utils['error'](util['format'](_0x9e9b('0x1e'),_0x53409b[_0x9e9b('0x1c')]),_0x277ca4);}});ami['on']('agentconnect',function(_0x4efce6){try{utils[_0x9e9b('0x17')](util['format'](_0x9e9b('0x1f'),_0x4efce6[_0x9e9b('0x1c')]),_0x4efce6);agents['agentconnect'](_0x4efce6);queues[_0x9e9b('0x20')](_0x4efce6);}catch(_0xc9ab0b){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x1f'),_0x4efce6[_0x9e9b('0x1c')]),_0xc9ab0b);}});ami['on'](_0x9e9b('0x21'),function(_0x54ba99){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x22'),_0x54ba99[_0x9e9b('0x1c')]),_0x54ba99);agents[_0x9e9b('0x21')](_0x54ba99);queues[_0x9e9b('0x21')](_0x54ba99);members[_0x9e9b('0x21')](_0x54ba99);}catch(_0x581ba0){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x22'),_0x54ba99[_0x9e9b('0x1c')]),_0x581ba0);}});ami['on'](_0x9e9b('0x23'),function(_0x529363){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x24'),_0x529363[_0x9e9b('0x1c')]),_0x529363);agents[_0x9e9b('0x23')](_0x529363);queues[_0x9e9b('0x23')](_0x529363);}catch(_0x4e556e){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')]('[%s][index][queuecallerabandon]',_0x529363[_0x9e9b('0x1c')]),_0x4e556e);}});ami['on']('queuecallerjoin',function(_0x5127b9){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x25'),_0x5127b9[_0x9e9b('0x1c')]),_0x5127b9);queues[_0x9e9b('0x26')](_0x5127b9);recordings['queuecallerjoin'](_0x5127b9);}catch(_0x3c3548){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')]('[%s][index][queuecallerjoin]',_0x5127b9[_0x9e9b('0x1c')]),_0x3c3548);}});ami['on'](_0x9e9b('0x27'),function(_0x2d9e9a){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x28'),_0x2d9e9a[_0x9e9b('0x1c')]),_0x2d9e9a);queues[_0x9e9b('0x27')](_0x2d9e9a);}catch(_0x1cdef9){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x28'),_0x2d9e9a['uniqueid']),_0x1cdef9);}});ami['on'](_0x9e9b('0x29'),function(_0x326654){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x2a'),_0x326654[_0x9e9b('0x1c')]),_0x326654);queues['musiconholdstart'](_0x326654);calls[_0x9e9b('0x29')](_0x326654);}catch(_0x5e100c){utils[_0x9e9b('0x13')](util['format'](_0x9e9b('0x2a'),_0x326654[_0x9e9b('0x1c')]),_0x5e100c);}});ami['on'](_0x9e9b('0x2b'),function(_0x45789d){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x2c'),_0x45789d[_0x9e9b('0x1c')]),_0x45789d);queues[_0x9e9b('0x2b')](_0x45789d);calls[_0x9e9b('0x2b')](_0x45789d);}catch(_0x3ded22){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x2c'),_0x45789d['uniqueid']),_0x3ded22);}});ami['on'](_0x9e9b('0x2d'),function(_0x190333){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x2e'),_0x190333['uniqueid']),_0x190333);calls[_0x9e9b('0x2d')](_0x190333);recordings['newstate'](_0x190333);}catch(_0x3ca2fb){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x2e'),_0x190333[_0x9e9b('0x1c')]),_0x3ca2fb);}});ami['on']('hangup',function(_0xa1cdec){try{utils[_0x9e9b('0x17')](util['format'](_0x9e9b('0x2f'),_0xa1cdec[_0x9e9b('0x1c')]),_0xa1cdec);calls['hangup'](_0xa1cdec);recordings['hangup'](_0xa1cdec);dials[_0x9e9b('0x30')](_0xa1cdec);agents[_0x9e9b('0x30')](_0xa1cdec);queues[_0x9e9b('0x30')](_0xa1cdec);}catch(_0x3dfc8c){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x2f'),_0xa1cdec[_0x9e9b('0x1c')]),_0x3dfc8c);}});ami['on'](_0x9e9b('0x31'),function(_0x497cc6){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x32'),_0x497cc6['uniqueid']),_0x497cc6);members['cdr'](_0x497cc6);}catch(_0x3626d6){utils[_0x9e9b('0x13')](util['format'](_0x9e9b('0x32'),_0x497cc6[_0x9e9b('0x1c')]),_0x3626d6);}});ami['on'](_0x9e9b('0x33'),function(_0x70f0c0){try{utils[_0x9e9b('0x17')](util['format'](_0x9e9b('0x34'),_0x70f0c0[_0x9e9b('0x1c')]),_0x70f0c0);queues[_0x9e9b('0x33')](_0x70f0c0);agents[_0x9e9b('0x33')](_0x70f0c0);transfers[_0x9e9b('0x33')](_0x70f0c0);}catch(_0x36a86d){utils['error'](util['format'](_0x9e9b('0x34'),_0x70f0c0[_0x9e9b('0x1c')]),_0x36a86d);}});ami['on']('attendedtransfer',function(_0x5186c5){try{utils[_0x9e9b('0x17')](util['format']('[%s][index][attendedtransfer]',_0x5186c5[_0x9e9b('0x35')]),_0x5186c5);queues[_0x9e9b('0x36')](_0x5186c5);transfers['attendedtransfer'](_0x5186c5);agents[_0x9e9b('0x36')](_0x5186c5);calls[_0x9e9b('0x36')](_0x5186c5);}catch(_0x22f877){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x37'),_0x5186c5[_0x9e9b('0x35')]),_0x22f877);}});ami['on'](_0x9e9b('0x38'),function(_0x59534c){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x39'),_0x59534c[_0x9e9b('0x1c')]),_0x59534c);queues['varset'](_0x59534c);recordings['varset'](_0x59534c);calls[_0x9e9b('0x38')](_0x59534c);dials[_0x9e9b('0x38')](_0x59534c);}catch(_0x3b2f78){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x39'),_0x59534c[_0x9e9b('0x1c')]),_0x3b2f78);}});ami['on'](_0x9e9b('0x3a'),function(_0x3d7608){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x3b'),_0x3d7608[_0x9e9b('0x1c')]),_0x3d7608);calls[_0x9e9b('0x3a')](_0x3d7608);recordings['newexten'](_0x3d7608);dials[_0x9e9b('0x3a')](_0x3d7608);}catch(_0x17544f){utils['error'](util[_0x9e9b('0x18')]('[%s][index][newexten]',_0x3d7608[_0x9e9b('0x1c')]),_0x17544f);}});ami['on'](_0x9e9b('0x3c'),function(_0x5d92ad){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x3d'),_0x5d92ad[_0x9e9b('0x1c')]),_0x5d92ad);calls['newchannel'](_0x5d92ad);recordings['newchannel'](_0x5d92ad);}catch(_0x3d972c){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x3d'),_0x5d92ad[_0x9e9b('0x1c')]),_0x3d972c);}});ami['on']('dialbegin',function(_0x52bdf1){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x3e'),_0x52bdf1[_0x9e9b('0x1c')]),_0x52bdf1);dials[_0x9e9b('0x3f')](_0x52bdf1);}catch(_0x44c099){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x40'),_0x52bdf1[_0x9e9b('0x1c')]),_0x44c099);}});ami['on'](_0x9e9b('0x41'),function(_0x2c4405){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x42'),_0x2c4405[_0x9e9b('0x1c')]),_0x2c4405);dials['dialend'](_0x2c4405);}catch(_0x3b0e7b){utils[_0x9e9b('0x13')](util['format'](_0x9e9b('0x42'),_0x2c4405[_0x9e9b('0x1c')]),_0x3b0e7b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index dbbdfb9..c2d484a 100644 --- a/server/services/xdr/members.controller.js +++ b/server/services/xdr/members.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x304b=['assign','cdr','debug','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','[%s][members][cdr]','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','type','interface','getUserByInterface','then','membername','internal','request','CreateMemberReport','getUserByName','split','name','catch','error','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','agent','exitAt','now','duration','diffTime','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue'];(function(_0xf3045b,_0x59987b){var _0x2d0959=function(_0x5c2a43){while(--_0x5c2a43){_0xf3045b['push'](_0xf3045b['shift']());}};_0x2d0959(++_0x59987b);}(_0x304b,0xa9));var _0xb304=function(_0x5c926c,_0x3a165a){_0x5c926c=_0x5c926c-0x0;var _0x7fbffd=_0x304b[_0x5c926c];return _0x7fbffd;};'use strict';var _=require(_0xb304('0x0'));var util=require(_0xb304('0x1'));var utils=require('./utils');var members={};var exclude=[_0xb304('0x2'),_0xb304('0x3')];function writeDB(_0x38b198){utils['info'](util[_0xb304('0x4')](_0xb304('0x5'),_0x38b198[_0xb304('0x6')],_0x38b198['interface'],_0x38b198[_0xb304('0x7')],_0x38b198[_0xb304('0x8')],_0x38b198['membername'],_0x38b198[_0xb304('0x9')]));if(_0x38b198[_0xb304('0xa')]){utils[_0xb304('0xb')](_0x38b198[_0xb304('0xa')])[_0xb304('0xc')](function(_0xed320d){if(_0xed320d){_0x38b198[_0xb304('0xd')]=_0xed320d['name'];_0x38b198['internal']=_0xed320d[_0xb304('0xe')];utils[_0xb304('0xf')](_0xb304('0x10'),_0x38b198);}else{utils[_0xb304('0x11')](_0x38b198[_0xb304('0xa')][_0xb304('0x12')]('/')[0x1])[_0xb304('0xc')](function(_0x504529){if(_0x504529){_0x38b198[_0xb304('0xd')]=_0x504529[_0xb304('0x13')];_0x38b198[_0xb304('0xe')]=_0x504529['internal'];utils['request']('CreateMemberReport',_0x38b198);}});}})[_0xb304('0x14')](function(_0x508e37){utils[_0xb304('0x15')](util[_0xb304('0x4')]('[%s][members][writeDB]',_0x38b198[_0xb304('0x6')]),_0x508e37);});}delete members[_0x38b198[_0xb304('0xa')]];}function startsWith(_0x1e0b6b,_0x41b3a7){return _[_0xb304('0x16')](_0x1e0b6b,function(_0xa4c4d9){return _[_0xb304('0x17')](_0x41b3a7,_0xa4c4d9);});}exports[_0xb304('0x18')]=function(_0x424a51){try{utils['debug'](util['format'](_0xb304('0x19'),members[_0x424a51[_0xb304('0x1a')]]?members[_0x424a51[_0xb304('0x1a')]][_0xb304('0x6')]:_0x424a51[_0xb304('0x1a')]),_0x424a51);utils[_0xb304('0x1b')](util[_0xb304('0x4')](_0xb304('0x1c'),members[_0x424a51[_0xb304('0x1a')]]?members[_0x424a51[_0xb304('0x1a')]]['uniqueid']:_0x424a51[_0xb304('0x1a')],_0x424a51[_0xb304('0x1d')],_0x424a51[_0xb304('0x1a')]));switch(_0x424a51[_0xb304('0x1d')]){case'INUSE':case _0xb304('0x1e'):if(!startsWith(exclude,_0x424a51[_0xb304('0x1a')])){members[_0x424a51[_0xb304('0x1a')]]={'channel':_0xb304('0x1f'),'interface':_0x424a51[_0xb304('0x1a')],'type':_0xb304('0x20'),'enterAt':utils['now'](),'role':_0xb304('0x21')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x424a51[_0xb304('0x1a')]])){members[_0x424a51['device']][_0xb304('0x22')]=utils[_0xb304('0x23')]();members[_0x424a51[_0xb304('0x1a')]][_0xb304('0x24')]=utils[_0xb304('0x25')](members[_0x424a51[_0xb304('0x1a')]][_0xb304('0x22')],members[_0x424a51[_0xb304('0x1a')]]['enterAt']);if(members[_0x424a51['device']]['uniqueid']){writeDB(members[_0x424a51[_0xb304('0x1a')]]);}}break;default:break;}}catch(_0x2c2965){utils[_0xb304('0x15')](util[_0xb304('0x4')](_0xb304('0x19'),members[_0x424a51[_0xb304('0x1a')]]?members[_0x424a51['device']][_0xb304('0x6')]:_0x424a51[_0xb304('0x1a')]),_0x2c2965);}};exports[_0xb304('0x26')]=function(_0x360cd2){try{if(!_[_0xb304('0x27')](members[_0x360cd2[_0xb304('0xa')]])){utils['debug'](util[_0xb304('0x4')](_0xb304('0x28'),_0x360cd2[_0xb304('0x6')]),_0x360cd2);utils[_0xb304('0x1b')](util[_0xb304('0x4')](_0xb304('0x29'),_0x360cd2[_0xb304('0x6')],_0x360cd2[_0xb304('0xa')],_0x360cd2[_0xb304('0x2a')]));members[_0x360cd2[_0xb304('0xa')]]=_[_0xb304('0x2b')](members[_0x360cd2['interface']],{'data4':_0x360cd2[_0xb304('0x2a')],'uniqueid':_0x360cd2[_0xb304('0x6')]});}}catch(_0x3eda57){utils[_0xb304('0x15')](util[_0xb304('0x4')]('[%s][members][agentcomplete]',_0x360cd2['uniqueid']),_0x3eda57);}};exports[_0xb304('0x2c')]=function(_0x415bee){try{utils[_0xb304('0x2d')](util[_0xb304('0x4')]('[%s][members][cdr]',_0x415bee[_0xb304('0x6')]),_0x415bee);if(_0x415bee['channel']){var _0x188b04=_0x415bee['channel'][_0xb304('0x12')]('-')[0x0];if(!_[_0xb304('0x27')](members[_0x188b04])){members[_0x188b04]=_[_0xb304('0x2b')](members[_0x188b04],{'data1':members[_0x188b04]['data1']||_0x415bee[_0xb304('0x9')],'data2':members[_0x188b04]['data2']||_0x415bee[_0xb304('0x2e')],'data3':members[_0x188b04][_0xb304('0x2f')]||_0x415bee[_0xb304('0x30')],'uniqueid':members[_0x188b04][_0xb304('0x6')]||_0x415bee[_0xb304('0x6')]});utils[_0xb304('0x1b')](util[_0xb304('0x4')](_0xb304('0x31'),_0x415bee['uniqueid'],members[_0x188b04][_0xb304('0x32')],members[_0x188b04][_0xb304('0x8')],members[_0x188b04][_0xb304('0x2f')]));if(members[_0x188b04][_0xb304('0x22')]){writeDB(members[_0x188b04]);}}}if(_0x415bee[_0xb304('0x33')]){var _0x29cc5c=_0x415bee[_0xb304('0x33')]['split']('-')[0x0];if(!_[_0xb304('0x27')](members[_0x29cc5c])){members[_0x29cc5c]=_[_0xb304('0x2b')](members[_0x29cc5c],{'data1':members[_0x29cc5c][_0xb304('0x32')]||_0x415bee[_0xb304('0x9')],'data2':members[_0x29cc5c][_0xb304('0x8')]||_0x415bee[_0xb304('0x2e')],'data3':members[_0x29cc5c][_0xb304('0x2f')]||_0x415bee[_0xb304('0x30')],'uniqueid':members[_0x29cc5c]['uniqueid']||_0x415bee['uniqueid']});utils[_0xb304('0x1b')](util['format'](_0xb304('0x31'),_0x415bee[_0xb304('0x6')],members[_0x29cc5c][_0xb304('0x32')],members[_0x29cc5c]['data2'],members[_0x29cc5c]['data3']));if(members[_0x29cc5c][_0xb304('0x22')]){writeDB(members[_0x29cc5c]);}}}}catch(_0x14d94d){utils['error'](util[_0xb304('0x4')](_0xb304('0x34'),_0x415bee[_0xb304('0x6')]),_0x14d94d);}}; \ No newline at end of file +var _0xd1cd=['split','request','CreateMemberReport','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','agent','exitAt','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][cdr]','data1','data3','destination','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','type','getUserByInterface','then','membername','name','internal','getUserByName'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd1cd,0xb6));var _0xdd1c=function(_0x464abf,_0x538896){_0x464abf=_0x464abf-0x0;var _0xe59c36=_0xd1cd[_0x464abf];return _0xe59c36;};'use strict';var _=require(_0xdd1c('0x0'));var util=require(_0xdd1c('0x1'));var utils=require(_0xdd1c('0x2'));var members={};var exclude=[_0xdd1c('0x3'),_0xdd1c('0x4')];function writeDB(_0x42c407){utils[_0xdd1c('0x5')](util[_0xdd1c('0x6')](_0xdd1c('0x7'),_0x42c407['uniqueid'],_0x42c407[_0xdd1c('0x8')],_0x42c407[_0xdd1c('0x9')],_0x42c407[_0xdd1c('0xa')],_0x42c407['membername'],_0x42c407[_0xdd1c('0xb')]));if(_0x42c407[_0xdd1c('0x8')]){utils[_0xdd1c('0xc')](_0x42c407[_0xdd1c('0x8')])[_0xdd1c('0xd')](function(_0x497b82){if(_0x497b82){_0x42c407[_0xdd1c('0xe')]=_0x497b82[_0xdd1c('0xf')];_0x42c407[_0xdd1c('0x10')]=_0x497b82[_0xdd1c('0x10')];utils['request']('CreateMemberReport',_0x42c407);}else{utils[_0xdd1c('0x11')](_0x42c407[_0xdd1c('0x8')][_0xdd1c('0x12')]('/')[0x1])[_0xdd1c('0xd')](function(_0x590699){if(_0x590699){_0x42c407[_0xdd1c('0xe')]=_0x590699[_0xdd1c('0xf')];_0x42c407['internal']=_0x590699['internal'];utils[_0xdd1c('0x13')](_0xdd1c('0x14'),_0x42c407);}});}})[_0xdd1c('0x15')](function(_0x48e6f9){utils[_0xdd1c('0x16')](util[_0xdd1c('0x6')](_0xdd1c('0x17'),_0x42c407['uniqueid']),_0x48e6f9);});}delete members[_0x42c407['interface']];}function startsWith(_0x1a7762,_0x37a8d3){return _['some'](_0x1a7762,function(_0x2e8efd){return _[_0xdd1c('0x18')](_0x37a8d3,_0x2e8efd);});}exports[_0xdd1c('0x19')]=function(_0x2d52df){try{utils[_0xdd1c('0x1a')](util[_0xdd1c('0x6')]('[%s][members][devicestatechange]',members[_0x2d52df[_0xdd1c('0x1b')]]?members[_0x2d52df['device']][_0xdd1c('0x1c')]:_0x2d52df[_0xdd1c('0x1b')]),_0x2d52df);utils[_0xdd1c('0x5')](util[_0xdd1c('0x6')](_0xdd1c('0x1d'),members[_0x2d52df[_0xdd1c('0x1b')]]?members[_0x2d52df[_0xdd1c('0x1b')]][_0xdd1c('0x1c')]:_0x2d52df[_0xdd1c('0x1b')],_0x2d52df[_0xdd1c('0x1e')],_0x2d52df[_0xdd1c('0x1b')]));switch(_0x2d52df['state']){case _0xdd1c('0x1f'):case _0xdd1c('0x20'):if(!startsWith(exclude,_0x2d52df[_0xdd1c('0x1b')])){members[_0x2d52df[_0xdd1c('0x1b')]]={'channel':'voice','interface':_0x2d52df[_0xdd1c('0x1b')],'type':_0xdd1c('0x21'),'enterAt':utils['now'](),'role':_0xdd1c('0x22')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x2d52df['device']])){members[_0x2d52df[_0xdd1c('0x1b')]][_0xdd1c('0x23')]=utils['now']();members[_0x2d52df[_0xdd1c('0x1b')]]['duration']=utils[_0xdd1c('0x24')](members[_0x2d52df[_0xdd1c('0x1b')]]['exitAt'],members[_0x2d52df['device']][_0xdd1c('0x25')]);if(members[_0x2d52df[_0xdd1c('0x1b')]][_0xdd1c('0x1c')]){writeDB(members[_0x2d52df[_0xdd1c('0x1b')]]);}}break;default:break;}}catch(_0x33ef9f){utils['error'](util['format'](_0xdd1c('0x26'),members[_0x2d52df['device']]?members[_0x2d52df[_0xdd1c('0x1b')]]['uniqueid']:_0x2d52df[_0xdd1c('0x1b')]),_0x33ef9f);}};exports[_0xdd1c('0x27')]=function(_0x2333ab){try{if(!_['isNil'](members[_0x2333ab[_0xdd1c('0x8')]])){utils[_0xdd1c('0x1a')](util[_0xdd1c('0x6')](_0xdd1c('0x28'),_0x2333ab[_0xdd1c('0x1c')]),_0x2333ab);utils['info'](util[_0xdd1c('0x6')](_0xdd1c('0x29'),_0x2333ab['uniqueid'],_0x2333ab[_0xdd1c('0x8')],_0x2333ab['queue']));members[_0x2333ab[_0xdd1c('0x8')]]=_[_0xdd1c('0x2a')](members[_0x2333ab[_0xdd1c('0x8')]],{'data4':_0x2333ab[_0xdd1c('0x2b')],'uniqueid':_0x2333ab[_0xdd1c('0x1c')]});}}catch(_0x30aad1){utils[_0xdd1c('0x16')](util['format'](_0xdd1c('0x28'),_0x2333ab['uniqueid']),_0x30aad1);}};exports['cdr']=function(_0x27c059){try{utils[_0xdd1c('0x1a')](util[_0xdd1c('0x6')](_0xdd1c('0x2c'),_0x27c059[_0xdd1c('0x1c')]),_0x27c059);if(_0x27c059[_0xdd1c('0x9')]){var _0xdfe625=_0x27c059[_0xdd1c('0x9')][_0xdd1c('0x12')]('-')[0x0];if(!_['isNil'](members[_0xdfe625])){members[_0xdfe625]=_[_0xdd1c('0x2a')](members[_0xdfe625],{'data1':members[_0xdfe625][_0xdd1c('0x2d')]||_0x27c059[_0xdd1c('0xb')],'data2':members[_0xdfe625][_0xdd1c('0xa')]||_0x27c059['source'],'data3':members[_0xdfe625][_0xdd1c('0x2e')]||_0x27c059[_0xdd1c('0x2f')],'uniqueid':members[_0xdfe625][_0xdd1c('0x1c')]||_0x27c059[_0xdd1c('0x1c')]});utils[_0xdd1c('0x5')](util[_0xdd1c('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x27c059[_0xdd1c('0x1c')],members[_0xdfe625]['data1'],members[_0xdfe625][_0xdd1c('0xa')],members[_0xdfe625][_0xdd1c('0x2e')]));if(members[_0xdfe625][_0xdd1c('0x23')]){writeDB(members[_0xdfe625]);}}}if(_0x27c059[_0xdd1c('0x30')]){var _0x30e191=_0x27c059[_0xdd1c('0x30')][_0xdd1c('0x12')]('-')[0x0];if(!_['isNil'](members[_0x30e191])){members[_0x30e191]=_[_0xdd1c('0x2a')](members[_0x30e191],{'data1':members[_0x30e191]['data1']||_0x27c059[_0xdd1c('0xb')],'data2':members[_0x30e191][_0xdd1c('0xa')]||_0x27c059[_0xdd1c('0x31')],'data3':members[_0x30e191]['data3']||_0x27c059['destination'],'uniqueid':members[_0x30e191][_0xdd1c('0x1c')]||_0x27c059[_0xdd1c('0x1c')]});utils[_0xdd1c('0x5')](util[_0xdd1c('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x27c059[_0xdd1c('0x1c')],members[_0x30e191]['data1'],members[_0x30e191][_0xdd1c('0xa')],members[_0x30e191][_0xdd1c('0x2e')]));if(members[_0x30e191][_0xdd1c('0x23')]){writeDB(members[_0x30e191]);}}}}catch(_0x3f1112){utils[_0xdd1c('0x16')](util[_0xdd1c('0x6')](_0xdd1c('0x2c'),_0x27c059[_0xdd1c('0x1c')]),_0x3f1112);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6820ceb..c04f1bb 100644 --- a/server/services/xdr/queues.controller.js +++ b/server/services/xdr/queues.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x419f=['debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','error','varset','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','variable','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','connectedlinenum','connectedlinename','holdtime','count','agentconnect','membername','destaccountcode','[%s][queues][agentconnect]','reason','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfer','transfertype','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin'];(function(_0x315bb3,_0x3788f4){var _0x5a406c=function(_0x46963a){while(--_0x46963a){_0x315bb3['push'](_0x315bb3['shift']());}};_0x5a406c(++_0x3788f4);}(_0x419f,0x176));var _0xf419=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x419f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf419('0x0'));var util=require(_0xf419('0x1'));var utils=require(_0xf419('0x2'));var queues={};function writeDB(_0x101564){utils[_0xf419('0x3')](util[_0xf419('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x101564[_0xf419('0x5')],_0x101564['channel'],_0x101564[_0xf419('0x6')],_0x101564[_0xf419('0x7')],_0x101564[_0xf419('0x8')],_0x101564[_0xf419('0x9')],_0x101564[_0xf419('0xa')]));if(_0x101564[_0xf419('0x6')]){utils[_0xf419('0xb')](_0x101564[_0xf419('0x6')])[_0xf419('0xc')](function(_0x4bb5fd){if(_0x4bb5fd){_0x101564[_0xf419('0xd')]=_0x4bb5fd[_0xf419('0xd')];}utils['request'](_0xf419('0xe'),_0x101564);});}else{utils[_0xf419('0xf')](_0xf419('0xe'),_0x101564);}if(_0x101564['transfereduniqueid']){delete queues[_0x101564[_0xf419('0x10')]];}else{delete queues[_0x101564[_0xf419('0x5')]];}}exports[_0xf419('0x11')]=function(_0xa39136){try{utils[_0xf419('0x12')](util['format']('[%s][queues][queuecallerjoin]',_0xa39136[_0xf419('0x5')]),_0xa39136);utils[_0xf419('0x3')](util[_0xf419('0x4')](_0xf419('0x13'),_0xa39136[_0xf419('0x5')],_0xa39136['queue'],_0xa39136[_0xf419('0x14')]));queues[_0xa39136[_0xf419('0x5')]]=_[_0xf419('0x15')](_0xa39136,{'originalposition':_0xa39136[_0xf419('0x14')],'queuecallerjoinAt':utils[_0xf419('0x16')](),'mohtime':0x0});}catch(_0x2554ef){utils['error'](util[_0xf419('0x4')](_0xf419('0x17'),_0xa39136['uniqueid']),_0x2554ef);}};exports[_0xf419('0x18')]=function(_0x19660e){try{if(!_[_0xf419('0x19')](queues[_0x19660e['uniqueid']])){utils['debug'](util['format'](_0xf419('0x1a'),_0x19660e['uniqueid']),_0x19660e);if(queues[_0x19660e[_0xf419('0x5')]][_0xf419('0x1b')]){if(!queues[_0x19660e[_0xf419('0x5')]][_0xf419('0x1c')]&&!queues[_0x19660e['uniqueid']][_0xf419('0x1d')]){queues[_0x19660e['uniqueid']][_0xf419('0x1e')]=!![];queues[_0x19660e[_0xf419('0x5')]][_0xf419('0x1f')]=utils['now']();queues[_0x19660e['uniqueid']][_0xf419('0xa')]=_0xf419('0x20');}utils[_0xf419('0x3')](util[_0xf419('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x19660e[_0xf419('0x5')],queues[_0x19660e[_0xf419('0x5')]]['name'],queues[_0x19660e['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x19660e[_0xf419('0x5')]]);}else if(queues[_0x19660e[_0xf419('0x5')]][_0xf419('0x10')]){utils[_0xf419('0x3')](util[_0xf419('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x19660e[_0xf419('0x5')],queues[_0x19660e[_0xf419('0x5')]]['name'],queues[_0x19660e[_0xf419('0x5')]]['transfereduniqueid']));queues[queues[_0x19660e[_0xf419('0x5')]][_0xf419('0x10')]]=queues[_0x19660e[_0xf419('0x5')]];queues[queues[_0x19660e['uniqueid']][_0xf419('0x10')]][_0xf419('0x21')]=0x2;delete queues[_0x19660e[_0xf419('0x5')]];}}}catch(_0x1630cc){utils[_0xf419('0x22')](util[_0xf419('0x4')](_0xf419('0x1a'),_0x19660e['uniqueid']),_0x1630cc);}};exports[_0xf419('0x23')]=function(_0xae7ac5){try{utils[_0xf419('0x12')](util[_0xf419('0x4')]('[%s][queues][varset]',_0xae7ac5[_0xf419('0x5')]),_0xae7ac5);if(!_[_0xf419('0x19')](_0xae7ac5['variable'][_0xf419('0x24')])&&_0xae7ac5['value']['toUpperCase']()!==_0xf419('0x25')){if(!_[_0xf419('0x19')](queues[_0xae7ac5['uniqueid']])){queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0x1c')]=![];queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0x26')]=null;queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0x1d')]=!![];queues[_0xae7ac5['uniqueid']][_0xf419('0x27')]=utils[_0xf419('0x16')]();queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0xa')]=_0xae7ac5[_0xf419('0x28')][_0xf419('0x29')]();utils[_0xf419('0x3')](util[_0xf419('0x4')](_0xf419('0x2a'),_0xae7ac5['uniqueid'],queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0x2b')],_0xae7ac5[_0xf419('0x28')],queues[_0xae7ac5['uniqueid']][_0xf419('0xa')]));writeDB(queues[_0xae7ac5[_0xf419('0x5')]]);}}else if(!_[_0xf419('0x19')](_0xae7ac5[_0xf419('0x2c')]['queueposition'])){if(!_[_0xf419('0x19')](queues[_0xae7ac5[_0xf419('0x5')]])&&!queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0x1c')]){queues[_0xae7ac5[_0xf419('0x5')]]['queuecallerabandon']=![];queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0x26')]=null;queues[_0xae7ac5['uniqueid']][_0xf419('0x1d')]=!![];queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0x27')]=utils[_0xf419('0x16')]();queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0xa')]='EXITWITHKEY';utils[_0xf419('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xae7ac5[_0xf419('0x5')],queues[_0xae7ac5['uniqueid']][_0xf419('0x2b')],_0xae7ac5['value'],queues[_0xae7ac5[_0xf419('0x5')]][_0xf419('0xa')]));}}}catch(_0x33933a){utils[_0xf419('0x22')](util[_0xf419('0x4')]('[%s][queues][varset]',_0xae7ac5[_0xf419('0x5')]),_0x33933a);}};exports[_0xf419('0x1c')]=function(_0x618473){try{if(!_[_0xf419('0x19')](queues[_0x618473[_0xf419('0x5')]])){utils[_0xf419('0x12')](util[_0xf419('0x4')]('[%s][queues][queuecallerabandon]',_0x618473[_0xf419('0x5')]),_0x618473);queues[_0x618473[_0xf419('0x5')]][_0xf419('0x1d')]=![];queues[_0x618473[_0xf419('0x5')]]['queuecallerexitAt']=null;queues[_0x618473['uniqueid']][_0xf419('0x1c')]=!![];queues[_0x618473[_0xf419('0x5')]]['queuecallerabandonAt']=utils['now']();queues[_0x618473[_0xf419('0x5')]]['queuecallerexitreason']=_0xf419('0x2d');utils['info'](util[_0xf419('0x4')](_0xf419('0x2e'),_0x618473[_0xf419('0x5')],queues[_0x618473['uniqueid']][_0xf419('0x2b')],queues[_0x618473[_0xf419('0x5')]][_0xf419('0xa')]));}}catch(_0x13da45){utils['error'](util[_0xf419('0x4')](_0xf419('0x2f'),_0x618473['uniqueid']),_0x13da45);}};exports[_0xf419('0x30')]=function(_0x48eafb){try{if(!_[_0xf419('0x19')](queues[_0x48eafb[_0xf419('0x5')]])){utils['debug'](util['format']('[%s][queues][queuecallerleave]',_0x48eafb[_0xf419('0x5')]),_0x48eafb);utils[_0xf419('0x3')](util[_0xf419('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x48eafb[_0xf419('0x5')],queues[_0x48eafb[_0xf419('0x5')]]['name'],_0x48eafb[_0xf419('0x31')],_0x48eafb[_0xf419('0x32')]));queues[_0x48eafb[_0xf419('0x5')]][_0xf419('0x30')]=!![];queues[_0x48eafb[_0xf419('0x5')]]['queuecallerleaveAt']=utils['now']();queues[_0x48eafb[_0xf419('0x5')]][_0xf419('0x33')]=utils['diffTime'](queues[_0x48eafb['uniqueid']]['queuecallerleaveAt'],queues[_0x48eafb[_0xf419('0x5')]]['queuecallerjoinAt']);queues[_0x48eafb[_0xf419('0x5')]][_0xf419('0x14')]=_0x48eafb[_0xf419('0x14')];queues[_0x48eafb[_0xf419('0x5')]][_0xf419('0x34')]=_0x48eafb[_0xf419('0x34')];queues[_0x48eafb[_0xf419('0x5')]][_0xf419('0x31')]=_0x48eafb['connectedlinenum'];queues[_0x48eafb[_0xf419('0x5')]]['connectedlinename']=_0x48eafb['connectedlinename'];}}catch(_0x3a1793){utils[_0xf419('0x22')](util[_0xf419('0x4')]('[%s][queues][queuecallerleave]',_0x48eafb[_0xf419('0x5')]),_0x3a1793);}};exports[_0xf419('0x35')]=function(_0x3588c5){try{if(!_[_0xf419('0x19')](queues[_0x3588c5[_0xf419('0x5')]])){utils['debug'](util[_0xf419('0x4')]('[%s][queues][agentconnect]',_0x3588c5['uniqueid']),_0x3588c5);utils[_0xf419('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3588c5[_0xf419('0x5')],queues[_0x3588c5[_0xf419('0x5')]][_0xf419('0x2b')],_0x3588c5[_0xf419('0x36')],_0x3588c5['destaccountcode']));queues[_0x3588c5[_0xf419('0x5')]][_0xf419('0x1c')]=![];queues[_0x3588c5[_0xf419('0x5')]][_0xf419('0x1c')]=![];queues[_0x3588c5['uniqueid']][_0xf419('0x26')]=null;queues[_0x3588c5[_0xf419('0x5')]][_0xf419('0x1d')]=![];queues[_0x3588c5[_0xf419('0x5')]][_0xf419('0xa')]=null;queues[_0x3588c5['uniqueid']][_0xf419('0x27')]=null;queues[_0x3588c5[_0xf419('0x5')]]['assigned']=!![];queues[_0x3588c5[_0xf419('0x5')]][_0xf419('0x9')]=_0x3588c5[_0xf419('0x37')];queues[_0x3588c5[_0xf419('0x5')]][_0xf419('0x7')]=_0x3588c5['membername'];}}catch(_0x294b16){utils['error'](util[_0xf419('0x4')](_0xf419('0x38'),_0x3588c5['uniqueid']),_0x294b16);}};exports['agentcomplete']=function(_0x481400){try{if(!_['isNil'](queues[_0x481400[_0xf419('0x5')]])){if(queues[_0x481400['uniqueid']][_0xf419('0x1b')]){utils['debug'](util[_0xf419('0x4')]('[%s][queues][agentcomplete]',_0x481400['uniqueid']),_0x481400);queues[_0x481400[_0xf419('0x5')]][_0xf419('0x1c')]=![];queues[_0x481400[_0xf419('0x5')]][_0xf419('0x1c')]=![];queues[_0x481400['uniqueid']]['queuecallerabandonAt']=null;queues[_0x481400[_0xf419('0x5')]][_0xf419('0x1d')]=![];queues[_0x481400[_0xf419('0x5')]]['queuecallerexitAt']=null;queues[_0x481400[_0xf419('0x5')]]['assigned']=!![];queues[_0x481400[_0xf419('0x5')]][_0xf419('0x7')]=_0x481400['membername'];queues[_0x481400['uniqueid']]['queuecallercomplete']=!![];queues[_0x481400[_0xf419('0x5')]][_0xf419('0x1f')]=utils[_0xf419('0x16')]();if(_0x481400[_0xf419('0x39')]=='transfer'){if(!queues[_0x481400['uniqueid']]['transfer']){queues[_0x481400['uniqueid']][_0xf419('0xa')]=_0xf419('0x3a');}}else{queues[_0x481400[_0xf419('0x5')]]['queuecallerexitreason']=_0xf419('0x3b')+_0x481400[_0xf419('0x39')][_0xf419('0x29')]();}utils['info'](util[_0xf419('0x4')](_0xf419('0x3c'),_0x481400[_0xf419('0x5')],queues[_0x481400[_0xf419('0x5')]]['name'],_0x481400['membername'],queues[_0x481400['uniqueid']][_0xf419('0xa')]));writeDB(queues[_0x481400[_0xf419('0x5')]]);}}}catch(_0x2d7a8b){utils[_0xf419('0x22')](util[_0xf419('0x4')]('[%s][queues][agentcomplete]',_0x481400[_0xf419('0x5')]),_0x2d7a8b);}};exports[_0xf419('0x3d')]=function(_0x13a197){try{if(!_[_0xf419('0x19')](queues[_0x13a197[_0xf419('0x3e')]])){utils[_0xf419('0x12')](util['format']('[%s][queues][blindtransfer]',_0x13a197[_0xf419('0x5')]),_0x13a197);queues[_0x13a197['transfereeuniqueid']][_0xf419('0x3f')]=!![];queues[_0x13a197[_0xf419('0x3e')]][_0xf419('0x40')]=_0xf419('0x41');queues[_0x13a197[_0xf419('0x3e')]]['transferexten']=_0x13a197[_0xf419('0x42')];queues[_0x13a197[_0xf419('0x3e')]][_0xf419('0x43')]=_0x13a197['transfereeuniqueid'];queues[_0x13a197[_0xf419('0x3e')]][_0xf419('0xa')]='BLINDTRANSFER';utils[_0xf419('0x3')](util[_0xf419('0x4')](_0xf419('0x44'),_0x13a197[_0xf419('0x5')],queues[_0x13a197[_0xf419('0x3e')]][_0xf419('0x2b')],_0x13a197[_0xf419('0x3e')],_0x13a197['extension']));}}catch(_0xeda639){utils[_0xf419('0x22')](util[_0xf419('0x4')](_0xf419('0x45'),_0x13a197[_0xf419('0x5')]),_0xeda639);}};exports[_0xf419('0x46')]=function(_0x36ddff){try{utils['debug'](util[_0xf419('0x4')](_0xf419('0x47'),_0x36ddff[_0xf419('0x48')]),_0x36ddff);if(_0x36ddff[_0xf419('0x48')]==_0x36ddff[_0xf419('0x49')]){if(!_[_0xf419('0x19')](queues[_0x36ddff[_0xf419('0x4a')]])){utils[_0xf419('0x3')](util[_0xf419('0x4')](_0xf419('0x4b'),_0x36ddff[_0xf419('0x48')],queues[_0x36ddff[_0xf419('0x4a')]]['name'],_0x36ddff[_0xf419('0x4c')]));queues[_0x36ddff[_0xf419('0x4a')]][_0xf419('0x3f')]=!![];queues[_0x36ddff[_0xf419('0x4a')]][_0xf419('0x40')]=_0xf419('0x4d');queues[_0x36ddff[_0xf419('0x4a')]][_0xf419('0x4e')]=_0x36ddff[_0xf419('0x4c')];queues[_0x36ddff[_0xf419('0x4a')]][_0xf419('0x43')]=_0x36ddff[_0xf419('0x48')];queues[_0x36ddff[_0xf419('0x4a')]]['queuecallerexitreason']=_0xf419('0x4f');}if(!_[_0xf419('0x19')](queues[_0x36ddff[_0xf419('0x49')]])){if(_0x36ddff[_0xf419('0x50')]&&queues[_0x36ddff[_0xf419('0x50')]]){queues[_0x36ddff['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x36ddff[_0xf419('0x3e')]]=_['clone'](queues[_0x36ddff[_0xf419('0x50')]]);queues[_0x36ddff[_0xf419('0x3e')]][_0xf419('0x10')]=_0x36ddff[_0xf419('0x51')];queues[_0x36ddff[_0xf419('0x3e')]][_0xf419('0x21')]=0x2;queues[_0x36ddff['transfereeuniqueid']][_0xf419('0x8')]=queues[_0x36ddff['secondtransfererlinkedid']][_0xf419('0x8')];queues[_0x36ddff['transfereeuniqueid']][_0xf419('0x52')]=queues[_0x36ddff[_0xf419('0x4a')]][_0xf419('0x52')];queues[_0x36ddff[_0xf419('0x3e')]]['queuecallerjoinAt']=utils['now']();queues[_0x36ddff[_0xf419('0x3e')]][_0xf419('0x1b')]=utils[_0xf419('0x16')]();queues[_0x36ddff[_0xf419('0x3e')]][_0xf419('0x33')]=0x0;queues[_0x36ddff[_0xf419('0x3e')]][_0xf419('0x53')]=0x0;utils[_0xf419('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x36ddff[_0xf419('0x48')],queues[_0x36ddff[_0xf419('0x3e')]]['name'],queues[_0x36ddff[_0xf419('0x3e')]][_0xf419('0x8')],queues[_0x36ddff[_0xf419('0x3e')]][_0xf419('0x52')]));}else{utils[_0xf419('0x3')](util[_0xf419('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x36ddff[_0xf419('0x48')],queues[_0x36ddff[_0xf419('0x49')]]['name'],_0x36ddff[_0xf419('0x4a')]));queues[_0x36ddff[_0xf419('0x49')]][_0xf419('0x10')]=_0x36ddff[_0xf419('0x4a')];}}}else if(_0x36ddff[_0xf419('0x54')]==_0x36ddff[_0xf419('0x4a')]){if(!_[_0xf419('0x19')](queues[_0x36ddff[_0xf419('0x49')]])){utils[_0xf419('0x3')](util[_0xf419('0x4')](_0xf419('0x55'),_0x36ddff[_0xf419('0x48')],queues[_0x36ddff['origtransfererlinkedid']][_0xf419('0x2b')],_0x36ddff[_0xf419('0x54')],_0x36ddff['secondtransfererexten']));queues[_0x36ddff['origtransfererlinkedid']][_0xf419('0x3f')]=!![];queues[_0x36ddff['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x36ddff[_0xf419('0x49')]][_0xf419('0x4e')]=_0x36ddff[_0xf419('0x56')];queues[_0x36ddff[_0xf419('0x49')]][_0xf419('0x43')]=_0x36ddff[_0xf419('0x54')];queues[_0x36ddff[_0xf419('0x49')]][_0xf419('0xa')]=_0xf419('0x4f');}if(!_[_0xf419('0x19')](queues[_0x36ddff['secondtransfererlinkedid']])){if(_0x36ddff[_0xf419('0x57')]&&queues[_0x36ddff[_0xf419('0x57')]]){queues[_0x36ddff[_0xf419('0x57')]][_0xf419('0x21')]=0x1;queues[_0x36ddff[_0xf419('0x51')]]=_[_0xf419('0x58')](queues[_0x36ddff[_0xf419('0x57')]]);queues[_0x36ddff[_0xf419('0x51')]][_0xf419('0x10')]=_0x36ddff['transfertargetuniqueid'];queues[_0x36ddff[_0xf419('0x51')]][_0xf419('0x21')]=0x2;queues[_0x36ddff[_0xf419('0x51')]]['calleridnum']=queues[_0x36ddff[_0xf419('0x49')]][_0xf419('0x8')];queues[_0x36ddff[_0xf419('0x51')]][_0xf419('0x52')]=queues[_0x36ddff[_0xf419('0x49')]][_0xf419('0x52')];queues[_0x36ddff[_0xf419('0x51')]][_0xf419('0x59')]=utils[_0xf419('0x16')]();queues[_0x36ddff[_0xf419('0x51')]][_0xf419('0x1b')]=utils[_0xf419('0x16')]();queues[_0x36ddff[_0xf419('0x51')]]['holdtime']=0x0;queues[_0x36ddff[_0xf419('0x51')]][_0xf419('0x53')]=0x0;utils[_0xf419('0x3')](util[_0xf419('0x4')](_0xf419('0x5a'),_0x36ddff['origtransfereruniqueid'],queues[_0x36ddff[_0xf419('0x51')]][_0xf419('0x2b')],queues[_0x36ddff['transfertargetuniqueid']][_0xf419('0x10')],queues[_0x36ddff['transfertargetuniqueid']][_0xf419('0x8')],queues[_0x36ddff[_0xf419('0x51')]][_0xf419('0x52')]));}else{utils[_0xf419('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x36ddff[_0xf419('0x48')],queues[_0x36ddff[_0xf419('0x4a')]][_0xf419('0x2b')],_0x36ddff[_0xf419('0x49')]));queues[_0x36ddff[_0xf419('0x4a')]][_0xf419('0x10')]=_0x36ddff[_0xf419('0x49')];}}}}catch(_0x43637d){utils['error'](util[_0xf419('0x4')](_0xf419('0x47'),_0x36ddff[_0xf419('0x48')]),_0x43637d);}};exports[_0xf419('0x5b')]=function(_0x5b5aaa){try{if(!_['isNil'](queues[_0x5b5aaa[_0xf419('0x5')]])){utils[_0xf419('0x12')](util[_0xf419('0x4')](_0xf419('0x5c'),_0x5b5aaa['uniqueid']),_0x5b5aaa);queues[_0x5b5aaa[_0xf419('0x5')]]['musiconholdstartAt']=utils[_0xf419('0x16')]();utils['info'](util['format'](_0xf419('0x5d'),_0x5b5aaa[_0xf419('0x5')],queues[_0x5b5aaa['uniqueid']][_0xf419('0x2b')],queues[_0x5b5aaa[_0xf419('0x5')]][_0xf419('0x5e')]));}}catch(_0x362ced){utils['error'](util['format'](_0xf419('0x5c'),_0x5b5aaa[_0xf419('0x5')]),_0x362ced);}};exports['musiconholdstop']=function(_0x5da3fc){try{if(!_[_0xf419('0x19')](queues[_0x5da3fc[_0xf419('0x5')]])){if(!_['isNil'](queues[_0x5da3fc[_0xf419('0x5')]][_0xf419('0x5e')])){utils[_0xf419('0x12')](util[_0xf419('0x4')](_0xf419('0x5f'),_0x5da3fc[_0xf419('0x5')]),_0x5da3fc);queues[_0x5da3fc[_0xf419('0x5')]]['mohtime']+=utils[_0xf419('0x60')](utils[_0xf419('0x16')](),queues[_0x5da3fc[_0xf419('0x5')]][_0xf419('0x5e')]);utils[_0xf419('0x3')](util[_0xf419('0x4')](_0xf419('0x61'),_0x5da3fc['uniqueid'],queues[_0x5da3fc[_0xf419('0x5')]][_0xf419('0x2b')],queues[_0x5da3fc[_0xf419('0x5')]][_0xf419('0x53')]));delete queues[_0x5da3fc[_0xf419('0x5')]]['musiconholdstartAt'];}}}catch(_0x304839){utils[_0xf419('0x22')](util[_0xf419('0x4')](_0xf419('0x5f'),_0x5da3fc[_0xf419('0x5')]),_0x304839);}}; \ No newline at end of file +var _0xa413=['variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','transfertype','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','format','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','uniqueid','position','assign','now','error','hangup','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil'];(function(_0x2efe3d,_0x1f5e3e){var _0x52117c=function(_0x7b6e52){while(--_0x7b6e52){_0x2efe3d['push'](_0x2efe3d['shift']());}};_0x52117c(++_0x1f5e3e);}(_0xa413,0x1e5));var _0x3a41=function(_0x58f91f,_0x4f2095){_0x58f91f=_0x58f91f-0x0;var _0x56edbe=_0xa413[_0x58f91f];return _0x56edbe;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var utils=require(_0x3a41('0x1'));var queues={};function writeDB(_0x592e77){utils[_0x3a41('0x2')](util[_0x3a41('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x592e77['uniqueid'],_0x592e77[_0x3a41('0x4')],_0x592e77[_0x3a41('0x5')],_0x592e77[_0x3a41('0x6')],_0x592e77[_0x3a41('0x7')],_0x592e77[_0x3a41('0x8')],_0x592e77[_0x3a41('0x9')]));if(_0x592e77[_0x3a41('0x5')]){utils[_0x3a41('0xa')](_0x592e77[_0x3a41('0x5')])[_0x3a41('0xb')](function(_0x27c2e5){if(_0x27c2e5){_0x592e77['type']=_0x27c2e5[_0x3a41('0xc')];}utils['request']('CreateVoiceQueueReport',_0x592e77);});}else{utils['request'](_0x3a41('0xd'),_0x592e77);}if(_0x592e77['transfereduniqueid']){delete queues[_0x592e77[_0x3a41('0xe')]];}else{delete queues[_0x592e77['uniqueid']];}}exports[_0x3a41('0xf')]=function(_0xccd84e){try{utils['debug'](util[_0x3a41('0x3')](_0x3a41('0x10'),_0xccd84e[_0x3a41('0x11')]),_0xccd84e);utils[_0x3a41('0x2')](util[_0x3a41('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0xccd84e[_0x3a41('0x11')],_0xccd84e[_0x3a41('0x5')],_0xccd84e[_0x3a41('0x12')]));queues[_0xccd84e[_0x3a41('0x11')]]=_[_0x3a41('0x13')](_0xccd84e,{'originalposition':_0xccd84e[_0x3a41('0x12')],'queuecallerjoinAt':utils[_0x3a41('0x14')](),'mohtime':0x0});}catch(_0xebcca6){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x10'),_0xccd84e['uniqueid']),_0xebcca6);}};exports[_0x3a41('0x16')]=function(_0x30d675){try{if(!_['isNil'](queues[_0x30d675['uniqueid']])){utils[_0x3a41('0x17')](util[_0x3a41('0x3')](_0x3a41('0x18'),_0x30d675[_0x3a41('0x11')]),_0x30d675);if(queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x19')]){if(!queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x1a')]&&!queues[_0x30d675['uniqueid']]['queuecallerexit']){queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x1b')]=!![];queues[_0x30d675['uniqueid']]['queuecallercompleteAt']=utils['now']();queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x3a41('0x1c');}utils[_0x3a41('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x30d675[_0x3a41('0x11')],queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x1d')],queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x9')]));writeDB(queues[_0x30d675[_0x3a41('0x11')]]);}else if(queues[_0x30d675['uniqueid']][_0x3a41('0xe')]){utils[_0x3a41('0x2')](util['format'](_0x3a41('0x1e'),_0x30d675[_0x3a41('0x11')],queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x1d')],queues[_0x30d675[_0x3a41('0x11')]]['transfereduniqueid']));queues[queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0xe')]]=queues[_0x30d675['uniqueid']];queues[queues[_0x30d675[_0x3a41('0x11')]]['transfereduniqueid']][_0x3a41('0x1f')]=0x2;delete queues[_0x30d675['uniqueid']];}}}catch(_0x201507){utils['error'](util[_0x3a41('0x3')](_0x3a41('0x18'),_0x30d675[_0x3a41('0x11')]),_0x201507);}};exports[_0x3a41('0x20')]=function(_0x169c22){try{utils[_0x3a41('0x17')](util[_0x3a41('0x3')](_0x3a41('0x21'),_0x169c22[_0x3a41('0x11')]),_0x169c22);if(!_[_0x3a41('0x22')](_0x169c22[_0x3a41('0x23')][_0x3a41('0x24')])&&_0x169c22[_0x3a41('0x25')][_0x3a41('0x26')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x169c22['uniqueid']])){queues[_0x169c22['uniqueid']][_0x3a41('0x1a')]=![];queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x27')]=null;queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x28')]=!![];queues[_0x169c22['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x169c22['value'][_0x3a41('0x26')]();utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x29'),_0x169c22[_0x3a41('0x11')],queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x1d')],_0x169c22[_0x3a41('0x25')],queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x9')]));writeDB(queues[_0x169c22[_0x3a41('0x11')]]);}}else if(!_[_0x3a41('0x22')](_0x169c22[_0x3a41('0x23')][_0x3a41('0x2a')])){if(!_[_0x3a41('0x22')](queues[_0x169c22['uniqueid']])&&!queues[_0x169c22['uniqueid']][_0x3a41('0x1a')]){queues[_0x169c22[_0x3a41('0x11')]]['queuecallerabandon']=![];queues[_0x169c22[_0x3a41('0x11')]]['queuecallerabandonAt']=null;queues[_0x169c22['uniqueid']]['queuecallerexit']=!![];queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x2b')]=utils['now']();queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x9')]='EXITWITHKEY';utils[_0x3a41('0x2')](util[_0x3a41('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x169c22[_0x3a41('0x11')],queues[_0x169c22['uniqueid']]['name'],_0x169c22['value'],queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x9')]));}}}catch(_0x58ce30){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x21'),_0x169c22[_0x3a41('0x11')]),_0x58ce30);}};exports[_0x3a41('0x1a')]=function(_0x6d7a2b){try{if(!_[_0x3a41('0x22')](queues[_0x6d7a2b[_0x3a41('0x11')]])){utils[_0x3a41('0x17')](util[_0x3a41('0x3')](_0x3a41('0x2c'),_0x6d7a2b[_0x3a41('0x11')]),_0x6d7a2b);queues[_0x6d7a2b[_0x3a41('0x11')]]['queuecallerexit']=![];queues[_0x6d7a2b['uniqueid']]['queuecallerexitAt']=null;queues[_0x6d7a2b[_0x3a41('0x11')]][_0x3a41('0x1a')]=!![];queues[_0x6d7a2b['uniqueid']][_0x3a41('0x27')]=utils['now']();queues[_0x6d7a2b[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x3a41('0x2d');utils['info'](util[_0x3a41('0x3')](_0x3a41('0x2e'),_0x6d7a2b[_0x3a41('0x11')],queues[_0x6d7a2b['uniqueid']][_0x3a41('0x1d')],queues[_0x6d7a2b[_0x3a41('0x11')]][_0x3a41('0x9')]));}}catch(_0x3504cd){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x2c'),_0x6d7a2b['uniqueid']),_0x3504cd);}};exports[_0x3a41('0x2f')]=function(_0x457f6c){try{if(!_[_0x3a41('0x22')](queues[_0x457f6c[_0x3a41('0x11')]])){utils['debug'](util[_0x3a41('0x3')](_0x3a41('0x30'),_0x457f6c['uniqueid']),_0x457f6c);utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x31'),_0x457f6c[_0x3a41('0x11')],queues[_0x457f6c[_0x3a41('0x11')]]['name'],_0x457f6c[_0x3a41('0x32')],_0x457f6c['connectedlinename']));queues[_0x457f6c['uniqueid']][_0x3a41('0x2f')]=!![];queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x19')]=utils[_0x3a41('0x14')]();queues[_0x457f6c['uniqueid']]['holdtime']=utils['diffTime'](queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x19')],queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x33')]);queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x12')]=_0x457f6c[_0x3a41('0x12')];queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x34')]=_0x457f6c[_0x3a41('0x34')];queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x32')]=_0x457f6c[_0x3a41('0x32')];queues[_0x457f6c[_0x3a41('0x11')]]['connectedlinename']=_0x457f6c[_0x3a41('0x35')];}}catch(_0x4aa033){utils[_0x3a41('0x15')](util['format'](_0x3a41('0x30'),_0x457f6c['uniqueid']),_0x4aa033);}};exports[_0x3a41('0x36')]=function(_0x1c3b79){try{if(!_[_0x3a41('0x22')](queues[_0x1c3b79[_0x3a41('0x11')]])){utils['debug'](util[_0x3a41('0x3')]('[%s][queues][agentconnect]',_0x1c3b79[_0x3a41('0x11')]),_0x1c3b79);utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x37'),_0x1c3b79[_0x3a41('0x11')],queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x1d')],_0x1c3b79[_0x3a41('0x38')],_0x1c3b79[_0x3a41('0x39')]));queues[_0x1c3b79['uniqueid']][_0x3a41('0x1a')]=![];queues[_0x1c3b79['uniqueid']][_0x3a41('0x1a')]=![];queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x27')]=null;queues[_0x1c3b79['uniqueid']][_0x3a41('0x28')]=![];queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x9')]=null;queues[_0x1c3b79['uniqueid']][_0x3a41('0x2b')]=null;queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x3a')]=!![];queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x8')]=_0x1c3b79[_0x3a41('0x39')];queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x6')]=_0x1c3b79[_0x3a41('0x38')];}}catch(_0x26d80f){utils['error'](util[_0x3a41('0x3')](_0x3a41('0x3b'),_0x1c3b79[_0x3a41('0x11')]),_0x26d80f);}};exports[_0x3a41('0x3c')]=function(_0x462dcd){try{if(!_[_0x3a41('0x22')](queues[_0x462dcd[_0x3a41('0x11')]])){if(queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x19')]){utils['debug'](util[_0x3a41('0x3')]('[%s][queues][agentcomplete]',_0x462dcd[_0x3a41('0x11')]),_0x462dcd);queues[_0x462dcd['uniqueid']][_0x3a41('0x1a')]=![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x1a')]=![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x27')]=null;queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x28')]=![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x2b')]=null;queues[_0x462dcd[_0x3a41('0x11')]]['assigned']=!![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x6')]=_0x462dcd['membername'];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x1b')]=!![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x3d')]=utils[_0x3a41('0x14')]();if(_0x462dcd[_0x3a41('0x3e')]=='transfer'){if(!queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x3f')]){queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x3a41('0x40');}}else{queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x3a41('0x41')+_0x462dcd['reason']['toUpperCase']();}utils[_0x3a41('0x2')](util[_0x3a41('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x462dcd['uniqueid'],queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x1d')],_0x462dcd[_0x3a41('0x38')],queues[_0x462dcd[_0x3a41('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x462dcd['uniqueid']]);}}}catch(_0x2e5108){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x42'),_0x462dcd[_0x3a41('0x11')]),_0x2e5108);}};exports[_0x3a41('0x43')]=function(_0x4adab2){try{if(!_[_0x3a41('0x22')](queues[_0x4adab2['transfereeuniqueid']])){utils[_0x3a41('0x17')](util[_0x3a41('0x3')](_0x3a41('0x44'),_0x4adab2[_0x3a41('0x11')]),_0x4adab2);queues[_0x4adab2[_0x3a41('0x45')]]['transfer']=!![];queues[_0x4adab2[_0x3a41('0x45')]]['transfertype']=_0x3a41('0x46');queues[_0x4adab2[_0x3a41('0x45')]][_0x3a41('0x47')]=_0x4adab2[_0x3a41('0x48')];queues[_0x4adab2[_0x3a41('0x45')]][_0x3a41('0x49')]=_0x4adab2[_0x3a41('0x45')];queues[_0x4adab2[_0x3a41('0x45')]][_0x3a41('0x9')]='BLINDTRANSFER';utils['info'](util[_0x3a41('0x3')](_0x3a41('0x4a'),_0x4adab2[_0x3a41('0x11')],queues[_0x4adab2[_0x3a41('0x45')]][_0x3a41('0x1d')],_0x4adab2['transfereeuniqueid'],_0x4adab2['extension']));}}catch(_0x39108a){utils['error'](util[_0x3a41('0x3')]('[%s][queues][blindtransfer]',_0x4adab2[_0x3a41('0x11')]),_0x39108a);}};exports[_0x3a41('0x4b')]=function(_0xa1cece){try{utils['debug'](util[_0x3a41('0x3')](_0x3a41('0x4c'),_0xa1cece[_0x3a41('0x4d')]),_0xa1cece);if(_0xa1cece['origtransfereruniqueid']==_0xa1cece[_0x3a41('0x4e')]){if(!_['isNil'](queues[_0xa1cece[_0x3a41('0x4f')]])){utils[_0x3a41('0x2')](util['format'](_0x3a41('0x50'),_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece[_0x3a41('0x4f')]][_0x3a41('0x1d')],_0xa1cece[_0x3a41('0x51')]));queues[_0xa1cece[_0x3a41('0x4f')]]['transfer']=!![];queues[_0xa1cece[_0x3a41('0x4f')]]['transfertype']=_0x3a41('0x52');queues[_0xa1cece['secondtransfererlinkedid']][_0x3a41('0x47')]=_0xa1cece[_0x3a41('0x51')];queues[_0xa1cece['secondtransfererlinkedid']][_0x3a41('0x49')]=_0xa1cece['origtransfereruniqueid'];queues[_0xa1cece[_0x3a41('0x4f')]][_0x3a41('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x3a41('0x22')](queues[_0xa1cece[_0x3a41('0x4e')]])){if(_0xa1cece[_0x3a41('0x53')]&&queues[_0xa1cece[_0x3a41('0x53')]]){queues[_0xa1cece[_0x3a41('0x53')]]['queuecallerenterreason']=0x1;queues[_0xa1cece[_0x3a41('0x45')]]=_[_0x3a41('0x54')](queues[_0xa1cece[_0x3a41('0x53')]]);queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0xe')]=_0xa1cece['transfertargetuniqueid'];queues[_0xa1cece[_0x3a41('0x45')]]['queuecallerenterreason']=0x2;queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x7')]=queues[_0xa1cece[_0x3a41('0x4f')]][_0x3a41('0x7')];queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x55')]=queues[_0xa1cece['secondtransfererlinkedid']][_0x3a41('0x55')];queues[_0xa1cece['transfereeuniqueid']][_0x3a41('0x33')]=utils[_0x3a41('0x14')]();queues[_0xa1cece[_0x3a41('0x45')]]['queuecallerleaveAt']=utils['now']();queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x56')]=0x0;queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x57')]=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x1d')],queues[_0xa1cece['transfereeuniqueid']][_0x3a41('0x7')],queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x55')]));}else{utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x58'),_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece[_0x3a41('0x4e')]]['name'],_0xa1cece[_0x3a41('0x4f')]));queues[_0xa1cece[_0x3a41('0x4e')]][_0x3a41('0xe')]=_0xa1cece[_0x3a41('0x4f')];}}}else if(_0xa1cece[_0x3a41('0x59')]==_0xa1cece[_0x3a41('0x4f')]){if(!_['isNil'](queues[_0xa1cece['origtransfererlinkedid']])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece['origtransfererlinkedid']][_0x3a41('0x1d')],_0xa1cece['secondtransfereruniqueid'],_0xa1cece['secondtransfererexten']));queues[_0xa1cece[_0x3a41('0x4e')]][_0x3a41('0x3f')]=!![];queues[_0xa1cece[_0x3a41('0x4e')]][_0x3a41('0x5a')]=_0x3a41('0x52');queues[_0xa1cece['origtransfererlinkedid']]['transferexten']=_0xa1cece[_0x3a41('0x5b')];queues[_0xa1cece[_0x3a41('0x4e')]]['transferuniqueid']=_0xa1cece['secondtransfereruniqueid'];queues[_0xa1cece[_0x3a41('0x4e')]][_0x3a41('0x9')]=_0x3a41('0x5c');}if(!_[_0x3a41('0x22')](queues[_0xa1cece[_0x3a41('0x4f')]])){if(_0xa1cece[_0x3a41('0x5d')]&&queues[_0xa1cece[_0x3a41('0x5d')]]){queues[_0xa1cece['transfertargetlinkedid']][_0x3a41('0x1f')]=0x1;queues[_0xa1cece[_0x3a41('0x5e')]]=_[_0x3a41('0x54')](queues[_0xa1cece[_0x3a41('0x5d')]]);queues[_0xa1cece[_0x3a41('0x5e')]]['transfereduniqueid']=_0xa1cece['transfertargetuniqueid'];queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x1f')]=0x2;queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x7')]=queues[_0xa1cece['origtransfererlinkedid']][_0x3a41('0x7')];queues[_0xa1cece[_0x3a41('0x5e')]]['calleridname']=queues[_0xa1cece[_0x3a41('0x4e')]]['calleridname'];queues[_0xa1cece['transfertargetuniqueid']][_0x3a41('0x33')]=utils['now']();queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x19')]=utils[_0x3a41('0x14')]();queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x56')]=0x0;queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x57')]=0x0;utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x5f'),_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x1d')],queues[_0xa1cece['transfertargetuniqueid']][_0x3a41('0xe')],queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x7')],queues[_0xa1cece['transfertargetuniqueid']]['calleridname']));}else{utils['info'](util[_0x3a41('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xa1cece['origtransfereruniqueid'],queues[_0xa1cece[_0x3a41('0x4f')]][_0x3a41('0x1d')],_0xa1cece[_0x3a41('0x4e')]));queues[_0xa1cece[_0x3a41('0x4f')]]['transfereduniqueid']=_0xa1cece['origtransfererlinkedid'];}}}}catch(_0x4d0afe){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x4c'),_0xa1cece['origtransfereruniqueid']),_0x4d0afe);}};exports[_0x3a41('0x60')]=function(_0x25d868){try{if(!_['isNil'](queues[_0x25d868[_0x3a41('0x11')]])){utils['debug'](util[_0x3a41('0x3')](_0x3a41('0x61'),_0x25d868['uniqueid']),_0x25d868);queues[_0x25d868[_0x3a41('0x11')]]['musiconholdstartAt']=utils[_0x3a41('0x14')]();utils['info'](util[_0x3a41('0x3')](_0x3a41('0x62'),_0x25d868[_0x3a41('0x11')],queues[_0x25d868[_0x3a41('0x11')]][_0x3a41('0x1d')],queues[_0x25d868['uniqueid']]['musiconholdstartAt']));}}catch(_0x3e5337){utils[_0x3a41('0x15')](util['format']('[%s][queues][musiconholdstart]',_0x25d868[_0x3a41('0x11')]),_0x3e5337);}};exports[_0x3a41('0x63')]=function(_0x44a3b7){try{if(!_['isNil'](queues[_0x44a3b7[_0x3a41('0x11')]])){if(!_[_0x3a41('0x22')](queues[_0x44a3b7['uniqueid']][_0x3a41('0x64')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x44a3b7[_0x3a41('0x11')]),_0x44a3b7);queues[_0x44a3b7[_0x3a41('0x11')]][_0x3a41('0x57')]+=utils[_0x3a41('0x65')](utils['now'](),queues[_0x44a3b7[_0x3a41('0x11')]][_0x3a41('0x64')]);utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x66'),_0x44a3b7[_0x3a41('0x11')],queues[_0x44a3b7['uniqueid']][_0x3a41('0x1d')],queues[_0x44a3b7[_0x3a41('0x11')]]['mohtime']));delete queues[_0x44a3b7[_0x3a41('0x11')]][_0x3a41('0x64')];}}}catch(_0x258130){utils['error'](util[_0x3a41('0x3')](_0x3a41('0x67'),_0x44a3b7[_0x3a41('0x11')]),_0x258130);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 497a448..10c55d3 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd89a=['[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','type','connectedlinename','forEach','clone','newexten','application','set','startsWith','appdata','toLowerCase','cdr','split','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','membername','name','request','CreateVoiceRecording','newchannel','debug','format'];(function(_0xfd6d1f,_0x298d54){var _0x31fc37=function(_0x1623f2){while(--_0x1623f2){_0xfd6d1f['push'](_0xfd6d1f['shift']());}};_0x31fc37(++_0x298d54);}(_0xd89a,0x6b));var _0xad89=function(_0x3d197f,_0x3186d3){_0x3d197f=_0x3d197f-0x0;var _0x37c656=_0xd89a[_0x3d197f];return _0x37c656;};'use strict';var _=require(_0xad89('0x0'));var util=require('util');var utils=require(_0xad89('0x1'));var recordings={};function writeDB(_0x1e85af){utils[_0xad89('0x2')](util['format'](_0xad89('0x3'),_0x1e85af[_0xad89('0x4')]));if(_0x1e85af['accountcode']){utils[_0xad89('0x5')](_0x1e85af[_0xad89('0x6')])[_0xad89('0x7')](function(_0xd4dfac){if(_0xd4dfac){_0x1e85af[_0xad89('0x8')]=_0xd4dfac[_0xad89('0x9')];_0x1e85af['UserId']=_0xd4dfac['id'];}utils[_0xad89('0xa')](_0xad89('0xb'),_0x1e85af);});}else{utils[_0xad89('0xa')](_0xad89('0xb'),_0x1e85af);}}exports[_0xad89('0xc')]=function(_0x2124a6){try{utils[_0xad89('0xd')](util[_0xad89('0xe')](_0xad89('0xf'),_0x2124a6[_0xad89('0x4')]),_0x2124a6);if(_0x2124a6[_0xad89('0x4')]==_0x2124a6[_0xad89('0x10')]){utils[_0xad89('0x2')](util[_0xad89('0xe')](_0xad89('0x11'),_0x2124a6[_0xad89('0x4')],_0x2124a6[_0xad89('0x12')],_0x2124a6[_0xad89('0x13')]));recordings[_0x2124a6[_0xad89('0x4')]]={'uniqueid':_0x2124a6[_0xad89('0x4')],'accountcode':_0x2124a6[_0xad89('0x6')],'exten':_0x2124a6['exten'],'context':_0x2124a6['context'],'channel':_0x2124a6[_0xad89('0x14')],'monitors':[]};}}catch(_0x3e939f){utils[_0xad89('0x15')](util[_0xad89('0xe')](_0xad89('0xf'),_0x2124a6['uniqueid']),_0x3e939f);}};exports[_0xad89('0x16')]=function(_0x5b59e9){try{utils[_0xad89('0xd')](util[_0xad89('0xe')](_0xad89('0x17'),_0x5b59e9[_0xad89('0x4')]),_0x5b59e9);if(!_[_0xad89('0x18')](recordings[_0x5b59e9[_0xad89('0x4')]])&&_0x5b59e9[_0xad89('0x19')]==0x6){utils[_0xad89('0x2')](util[_0xad89('0xe')](_0xad89('0x1a'),_0x5b59e9['uniqueid'],_0x5b59e9[_0xad89('0x12')],_0x5b59e9[_0xad89('0x14')]));}else if(!_[_0xad89('0x18')](recordings[_0x5b59e9[_0xad89('0x10')]])&&_0x5b59e9[_0xad89('0x19')]==0x6&&_0x5b59e9[_0xad89('0x12')]!='transfer'){utils[_0xad89('0x2')](util[_0xad89('0xe')](_0xad89('0x1b'),_0x5b59e9[_0xad89('0x4')],_0x5b59e9[_0xad89('0x10')],_0x5b59e9['context'],_0x5b59e9[_0xad89('0x14')]));recordings[_0x5b59e9['linkedid']][_0xad89('0x6')]=_0x5b59e9['accountcode'];}}catch(_0x2c9bf4){utils[_0xad89('0x15')](util[_0xad89('0xe')]('[%s][recordings][newstate]',_0x5b59e9[_0xad89('0x4')]),_0x2c9bf4);}};exports[_0xad89('0x1c')]=function(_0x15588e){try{if(!_[_0xad89('0x18')](_0x15588e[_0xad89('0x1d')])&&!_[_0xad89('0x18')](_0x15588e[_0xad89('0x1d')][_0xad89('0x1e')])){utils[_0xad89('0xd')](util[_0xad89('0xe')](_0xad89('0x1f'),_0x15588e[_0xad89('0x4')]),_0x15588e);utils[_0xad89('0x2')](util[_0xad89('0xe')](_0xad89('0x20'),_0x15588e[_0xad89('0x4')],_0x15588e[_0xad89('0x1d')],_0x15588e[_0xad89('0x21')]));if(_[_0xad89('0x22')](_0x15588e[_0xad89('0x21')],_0xad89('0x23'))){_0x15588e[_0xad89('0x21')]=_0x15588e[_0xad89('0x21')][_0xad89('0x24')](_0xad89('0x23'),'.WAV');}if(recordings[_0x15588e[_0xad89('0x10')]]){var _0x6e872c=_[_0xad89('0x25')](recordings[_0x15588e[_0xad89('0x10')]][_0xad89('0x26')],{'value':_0x15588e[_0xad89('0x21')]});if(_[_0xad89('0x18')](_0x6e872c)){recordings[_0x15588e[_0xad89('0x10')]][_0xad89('0x26')][_0xad89('0x27')]({'value':_0x15588e['value']});}}}}catch(_0x429b52){utils[_0xad89('0x15')](util[_0xad89('0xe')](_0xad89('0x1f'),_0x15588e[_0xad89('0x4')]),_0x429b52);}};exports['hangup']=function(_0x4e9b61){try{if(!_['isNil'](recordings[_0x4e9b61['uniqueid']])){utils[_0xad89('0xd')](util['format'](_0xad89('0x28'),_0x4e9b61[_0xad89('0x4')]),_0x4e9b61);utils[_0xad89('0x2')](util[_0xad89('0xe')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4e9b61[_0xad89('0x4')],_0x4e9b61[_0xad89('0x29')],_0x4e9b61['calleridname'],_0x4e9b61['cause-txt']));recordings[_0x4e9b61[_0xad89('0x4')]][_0xad89('0x29')]=_0x4e9b61[_0xad89('0x29')];recordings[_0x4e9b61[_0xad89('0x4')]][_0xad89('0x2a')]=_0x4e9b61[_0xad89('0x2a')];recordings[_0x4e9b61['uniqueid']][_0xad89('0x2b')]=_0x4e9b61[_0xad89('0x2b')];recordings[_0x4e9b61[_0xad89('0x4')]]['connectedlinename']=_0x4e9b61['connectedlinename'];if(recordings[_0x4e9b61[_0xad89('0x4')]][_0xad89('0x2c')]=='outbound'&&recordings[_0x4e9b61[_0xad89('0x4')]][_0xad89('0x6')]){recordings[_0x4e9b61[_0xad89('0x4')]][_0xad89('0x2b')]=recordings[_0x4e9b61[_0xad89('0x4')]][_0xad89('0x6')];recordings[_0x4e9b61[_0xad89('0x4')]][_0xad89('0x2d')]='';}recordings[_0x4e9b61[_0xad89('0x4')]][_0xad89('0x26')][_0xad89('0x2e')](function(_0x57befe){var _0x22f3b3=_[_0xad89('0x2f')](recordings[_0x4e9b61[_0xad89('0x4')]]);_0x22f3b3[_0xad89('0x21')]=_0x57befe[_0xad89('0x21')];writeDB(_0x22f3b3);});delete recordings[_0x4e9b61['uniqueid']];}}catch(_0x9b2fa7){utils[_0xad89('0x15')](util[_0xad89('0xe')](_0xad89('0x28'),_0x4e9b61[_0xad89('0x4')]),_0x9b2fa7);}};exports[_0xad89('0x30')]=function(_0x4140fd){try{if(!_[_0xad89('0x18')](recordings[_0x4140fd[_0xad89('0x4')]])){utils[_0xad89('0xd')](util['format']('[%s][recordings][newexten]',_0x4140fd[_0xad89('0x4')]),_0x4140fd);utils[_0xad89('0x2')](util[_0xad89('0xe')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4140fd[_0xad89('0x4')],_0x4140fd[_0xad89('0x31')],_0x4140fd['appdata']));if(_0x4140fd[_0xad89('0x31')]['toLowerCase']()==_0xad89('0x32')&&_[_0xad89('0x33')](_0x4140fd[_0xad89('0x34')][_0xad89('0x35')](),_0xad89('0x36'))){var _0x49617f=_0x4140fd[_0xad89('0x34')][_0xad89('0x37')]('=');var _0x273788=_0x49617f[0x0]['substring'](_0x49617f[0x0][_0xad89('0x38')]('(')+0x1,_0x49617f[0x0][_0xad89('0x38')](')'));var _0x3aa0cf=_0x49617f[0x1];recordings[_0x4140fd['uniqueid']][_0x273788]=_0x3aa0cf;}}}catch(_0x3a0cd0){utils[_0xad89('0x15')](util[_0xad89('0xe')](_0xad89('0x39'),_0x4140fd[_0xad89('0x4')]),_0x3a0cd0);}};exports['queuecallerjoin']=function(_0x45699f){try{if(!_[_0xad89('0x18')](recordings[_0x45699f[_0xad89('0x4')]])){utils[_0xad89('0xd')](util[_0xad89('0xe')](_0xad89('0x3a'),_0x45699f[_0xad89('0x4')]),_0x45699f);utils['info'](util[_0xad89('0xe')](_0xad89('0x3b'),_0x45699f['uniqueid'],_0x45699f[_0xad89('0x3c')]));recordings[_0x45699f[_0xad89('0x4')]][_0xad89('0x3c')]=_0x45699f[_0xad89('0x3c')];}}catch(_0xa02e76){utils[_0xad89('0x15')](util[_0xad89('0xe')](_0xad89('0x3a'),_0x45699f['uniqueid']),_0xa02e76);}}; \ No newline at end of file +var _0xac7f=['[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','format','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]'];(function(_0x49d7ab,_0x113754){var _0x258c0f=function(_0x1dc315){while(--_0x1dc315){_0x49d7ab['push'](_0x49d7ab['shift']());}};_0x258c0f(++_0x113754);}(_0xac7f,0x1e2));var _0xfac7=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xac7f[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xfac7('0x0'));var util=require('util');var utils=require(_0xfac7('0x1'));var recordings={};function writeDB(_0x44bdc1){utils[_0xfac7('0x2')](util['format'](_0xfac7('0x3'),_0x44bdc1[_0xfac7('0x4')]));if(_0x44bdc1[_0xfac7('0x5')]){utils[_0xfac7('0x6')](_0x44bdc1[_0xfac7('0x5')])[_0xfac7('0x7')](function(_0x523494){if(_0x523494){_0x44bdc1[_0xfac7('0x8')]=_0x523494['name'];_0x44bdc1[_0xfac7('0x9')]=_0x523494['id'];}utils[_0xfac7('0xa')]('CreateVoiceRecording',_0x44bdc1);});}else{utils[_0xfac7('0xa')](_0xfac7('0xb'),_0x44bdc1);}}exports[_0xfac7('0xc')]=function(_0x529223){try{utils[_0xfac7('0xd')](util[_0xfac7('0xe')]('[%s][recordings][newchannel]',_0x529223['uniqueid']),_0x529223);if(_0x529223[_0xfac7('0x4')]==_0x529223[_0xfac7('0xf')]){utils[_0xfac7('0x2')](util[_0xfac7('0xe')](_0xfac7('0x10'),_0x529223['uniqueid'],_0x529223[_0xfac7('0x11')],_0x529223[_0xfac7('0x12')]));recordings[_0x529223[_0xfac7('0x4')]]={'uniqueid':_0x529223[_0xfac7('0x4')],'accountcode':_0x529223[_0xfac7('0x5')],'exten':_0x529223[_0xfac7('0x12')],'context':_0x529223['context'],'channel':_0x529223['channel'],'monitors':[]};}}catch(_0x11a5fd){utils['error'](util[_0xfac7('0xe')](_0xfac7('0x13'),_0x529223['uniqueid']),_0x11a5fd);}};exports[_0xfac7('0x14')]=function(_0xc7a913){try{utils['debug'](util[_0xfac7('0xe')](_0xfac7('0x15'),_0xc7a913[_0xfac7('0x4')]),_0xc7a913);if(!_[_0xfac7('0x16')](recordings[_0xc7a913['uniqueid']])&&_0xc7a913[_0xfac7('0x17')]==0x6){utils[_0xfac7('0x2')](util[_0xfac7('0xe')](_0xfac7('0x18'),_0xc7a913[_0xfac7('0x4')],_0xc7a913[_0xfac7('0x11')],_0xc7a913[_0xfac7('0x19')]));}else if(!_[_0xfac7('0x16')](recordings[_0xc7a913[_0xfac7('0xf')]])&&_0xc7a913['channelstate']==0x6&&_0xc7a913['context']!=_0xfac7('0x1a')){utils[_0xfac7('0x2')](util['format'](_0xfac7('0x1b'),_0xc7a913[_0xfac7('0x4')],_0xc7a913[_0xfac7('0xf')],_0xc7a913[_0xfac7('0x11')],_0xc7a913[_0xfac7('0x19')]));recordings[_0xc7a913[_0xfac7('0xf')]][_0xfac7('0x5')]=_0xc7a913[_0xfac7('0x5')];}}catch(_0x2229aa){utils[_0xfac7('0x1c')](util['format'](_0xfac7('0x15'),_0xc7a913[_0xfac7('0x4')]),_0x2229aa);}};exports[_0xfac7('0x1d')]=function(_0x334e72){try{if(!_[_0xfac7('0x16')](_0x334e72['variable'])&&!_[_0xfac7('0x16')](_0x334e72[_0xfac7('0x1e')][_0xfac7('0x1f')])){utils[_0xfac7('0xd')](util[_0xfac7('0xe')](_0xfac7('0x20'),_0x334e72['uniqueid']),_0x334e72);utils[_0xfac7('0x2')](util[_0xfac7('0xe')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x334e72[_0xfac7('0x4')],_0x334e72[_0xfac7('0x1e')],_0x334e72[_0xfac7('0x21')]));if(_[_0xfac7('0x22')](_0x334e72[_0xfac7('0x21')],_0xfac7('0x23'))){_0x334e72['value']=_0x334e72[_0xfac7('0x21')]['replace'](_0xfac7('0x23'),'.WAV');}if(recordings[_0x334e72[_0xfac7('0xf')]]){var _0x32fb2c=_[_0xfac7('0x24')](recordings[_0x334e72['linkedid']][_0xfac7('0x25')],{'value':_0x334e72[_0xfac7('0x21')]});if(_[_0xfac7('0x16')](_0x32fb2c)){recordings[_0x334e72[_0xfac7('0xf')]][_0xfac7('0x25')][_0xfac7('0x26')]({'value':_0x334e72[_0xfac7('0x21')]});}}}}catch(_0x43738c){utils[_0xfac7('0x1c')](util['format'](_0xfac7('0x20'),_0x334e72[_0xfac7('0x4')]),_0x43738c);}};exports['hangup']=function(_0x1d7993){try{if(!_[_0xfac7('0x16')](recordings[_0x1d7993[_0xfac7('0x4')]])){utils[_0xfac7('0xd')](util[_0xfac7('0xe')](_0xfac7('0x27'),_0x1d7993[_0xfac7('0x4')]),_0x1d7993);utils['info'](util['format'](_0xfac7('0x28'),_0x1d7993['uniqueid'],_0x1d7993['calleridnum'],_0x1d7993['calleridname'],_0x1d7993[_0xfac7('0x29')]));recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2a')]=_0x1d7993[_0xfac7('0x2a')];recordings[_0x1d7993[_0xfac7('0x4')]]['calleridname']=_0x1d7993[_0xfac7('0x2b')];recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2c')]=_0x1d7993['connectedlinenum'];recordings[_0x1d7993[_0xfac7('0x4')]]['connectedlinename']=_0x1d7993[_0xfac7('0x2d')];if(recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2e')]==_0xfac7('0x2f')&&recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x5')]){recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2c')]=recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x5')];recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2d')]='';}recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x25')][_0xfac7('0x30')](function(_0x410f53){var _0x50ead2=_['clone'](recordings[_0x1d7993[_0xfac7('0x4')]]);_0x50ead2['value']=_0x410f53[_0xfac7('0x21')];writeDB(_0x50ead2);});delete recordings[_0x1d7993[_0xfac7('0x4')]];}}catch(_0x4c9025){utils[_0xfac7('0x1c')](util[_0xfac7('0xe')](_0xfac7('0x27'),_0x1d7993[_0xfac7('0x4')]),_0x4c9025);}};exports[_0xfac7('0x31')]=function(_0x58792b){try{if(!_['isNil'](recordings[_0x58792b[_0xfac7('0x4')]])){utils['debug'](util['format'](_0xfac7('0x32'),_0x58792b[_0xfac7('0x4')]),_0x58792b);utils[_0xfac7('0x2')](util[_0xfac7('0xe')](_0xfac7('0x33'),_0x58792b[_0xfac7('0x4')],_0x58792b[_0xfac7('0x34')],_0x58792b[_0xfac7('0x35')]));if(_0x58792b[_0xfac7('0x34')]['toLowerCase']()=='set'&&_['startsWith'](_0x58792b['appdata']['toLowerCase'](),'cdr')){var _0x24a13f=_0x58792b['appdata'][_0xfac7('0x36')]('=');var _0xd65e98=_0x24a13f[0x0]['substring'](_0x24a13f[0x0][_0xfac7('0x37')]('(')+0x1,_0x24a13f[0x0][_0xfac7('0x37')](')'));var _0x5096f3=_0x24a13f[0x1];recordings[_0x58792b[_0xfac7('0x4')]][_0xd65e98]=_0x5096f3;}}}catch(_0x1f5c3c){utils['error'](util[_0xfac7('0xe')](_0xfac7('0x32'),_0x58792b[_0xfac7('0x4')]),_0x1f5c3c);}};exports[_0xfac7('0x38')]=function(_0x579392){try{if(!_[_0xfac7('0x16')](recordings[_0x579392['uniqueid']])){utils[_0xfac7('0xd')](util[_0xfac7('0xe')](_0xfac7('0x39'),_0x579392[_0xfac7('0x4')]),_0x579392);utils[_0xfac7('0x2')](util[_0xfac7('0xe')](_0xfac7('0x3a'),_0x579392[_0xfac7('0x4')],_0x579392[_0xfac7('0x3b')]));recordings[_0x579392[_0xfac7('0x4')]][_0xfac7('0x3b')]=_0x579392[_0xfac7('0x3b')];}}catch(_0x7aaa95){utils[_0xfac7('0x1c')](util[_0xfac7('0xe')](_0xfac7('0x39'),_0x579392[_0xfac7('0x4')]),_0x7aaa95);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 38162f3..b37ae93 100644 --- a/server/services/xdr/transfers.controller.js +++ b/server/services/xdr/transfers.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eef=['request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid'];(function(_0x57c802,_0x5d83eb){var _0x3e2bfb=function(_0x6a5b5){while(--_0x6a5b5){_0x57c802['push'](_0x57c802['shift']());}};_0x3e2bfb(++_0x5d83eb);}(_0x3eef,0x179));var _0xf3ee=function(_0xb11b0c,_0x2ca4bb){_0xb11b0c=_0xb11b0c-0x0;var _0x4673ea=_0x3eef[_0xb11b0c];return _0x4673ea;};'use strict';var _=require(_0xf3ee('0x0'));var util=require(_0xf3ee('0x1'));var utils=require(_0xf3ee('0x2'));function writeDB(_0x5e5181){utils[_0xf3ee('0x3')](util[_0xf3ee('0x4')](_0xf3ee('0x5'),_0x5e5181[_0xf3ee('0x6')]===_0xf3ee('0x7')?_0x5e5181[_0xf3ee('0x8')]:_0x5e5181[_0xf3ee('0x9')],_0x5e5181[_0xf3ee('0x6')]));utils[_0xf3ee('0xa')](_0xf3ee('0xb'),_0x5e5181);}exports['blindtransfer']=function(_0x139bdb){try{utils[_0xf3ee('0xc')](util[_0xf3ee('0x4')](_0xf3ee('0xd'),_0x139bdb[_0xf3ee('0x9')]),_0x139bdb);utils[_0xf3ee('0x3')](util[_0xf3ee('0x4')](_0xf3ee('0xe'),_0x139bdb[_0xf3ee('0x9')],_0x139bdb[_0xf3ee('0xf')],_0x139bdb[_0xf3ee('0x10')],_0x139bdb[_0xf3ee('0x11')],_0x139bdb[_0xf3ee('0x12')]));_0x139bdb['type']=_0xf3ee('0x13');writeDB(_0x139bdb);}catch(_0x18d2e1){utils[_0xf3ee('0x14')](util[_0xf3ee('0x4')](_0xf3ee('0xd'),_0x139bdb[_0xf3ee('0x9')]),_0x18d2e1);}};exports[_0xf3ee('0x15')]=function(_0x493ebd){try{utils[_0xf3ee('0xc')](util[_0xf3ee('0x4')](_0xf3ee('0x16'),_0x493ebd[_0xf3ee('0x8')]),_0x493ebd);utils[_0xf3ee('0x3')](util['format'](_0xf3ee('0x17'),_0x493ebd['origtransfereruniqueid'],_0x493ebd[_0xf3ee('0x18')],_0x493ebd[_0xf3ee('0x19')],_0x493ebd['transfertargetcalleridnum'],_0x493ebd[_0xf3ee('0x1a')]));_0x493ebd=_[_0xf3ee('0x1b')](_0x493ebd,{'transfererchannel':_0x493ebd[_0xf3ee('0x1c')],'transferercalleridnum':_0x493ebd[_0xf3ee('0x18')],'transferercalleridname':_0x493ebd[_0xf3ee('0x19')],'transfererconnectedlinenum':_0x493ebd[_0xf3ee('0x1d')],'transfererconnectedlinename':_0x493ebd[_0xf3ee('0x1e')],'transfereraccountcode':_0x493ebd[_0xf3ee('0x1f')],'transferercontext':_0x493ebd[_0xf3ee('0x20')],'transfererexten':_0x493ebd[_0xf3ee('0x21')],'transfererlinkedid':_0x493ebd[_0xf3ee('0x22')],'context':_0x493ebd[_0xf3ee('0x23')],'extension':_0x493ebd['origtransfererexten'],'type':'attended'});if(_[_0xf3ee('0x24')](_0x493ebd[_0xf3ee('0x25')])){_0x493ebd=_[_0xf3ee('0x1b')](_0x493ebd,{'transfereechannel':_0x493ebd[_0xf3ee('0x26')],'transfereecalleridnum':_0x493ebd['transfertargetcalleridnum'],'transfereecalleridname':_0x493ebd[_0xf3ee('0x1a')],'transfereeconnectedlinenum':_0x493ebd[_0xf3ee('0x27')],'transfereeconnectedlinename':_0x493ebd['transfertargetconnectedlinename'],'transfereeaccountcode':_0x493ebd[_0xf3ee('0x28')],'transfereecontext':_0x493ebd['transfertargetcontext'],'transfereeexten':_0x493ebd[_0xf3ee('0x29')],'transfereelinkedid':_0x493ebd[_0xf3ee('0x2a')]});}writeDB(_0x493ebd);}catch(_0x46178c){utils['error'](util[_0xf3ee('0x4')]('[%s][transfers][attendedtransfer]',_0x493ebd[_0xf3ee('0x8')]),_0x46178c);}}; \ No newline at end of file +var _0xeff8=['request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid'];(function(_0x50da86,_0x5bc463){var _0x3a312b=function(_0x41be88){while(--_0x41be88){_0x50da86['push'](_0x50da86['shift']());}};_0x3a312b(++_0x5bc463);}(_0xeff8,0x8f));var _0x8eff=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xeff8[_0x2a56ad];return _0x425175;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');function writeDB(_0x5c018e){utils[_0x8eff('0x0')](util[_0x8eff('0x1')](_0x8eff('0x2'),_0x5c018e[_0x8eff('0x3')]==='attended'?_0x5c018e['origtransfereruniqueid']:_0x5c018e[_0x8eff('0x4')],_0x5c018e[_0x8eff('0x3')]));utils[_0x8eff('0x5')](_0x8eff('0x6'),_0x5c018e);}exports[_0x8eff('0x7')]=function(_0x23091e){try{utils[_0x8eff('0x8')](util[_0x8eff('0x1')]('[%s][transfers][blindtransfer]',_0x23091e['uniqueid']),_0x23091e);utils[_0x8eff('0x0')](util['format'](_0x8eff('0x9'),_0x23091e[_0x8eff('0x4')],_0x23091e[_0x8eff('0xa')],_0x23091e[_0x8eff('0xb')],_0x23091e['transfereecalleridnum'],_0x23091e['transfereecalleridname']));_0x23091e['type']=_0x8eff('0xc');writeDB(_0x23091e);}catch(_0x4a09a2){utils[_0x8eff('0xd')](util['format'](_0x8eff('0xe'),_0x23091e['uniqueid']),_0x4a09a2);}};exports['attendedtransfer']=function(_0x28acb6){try{utils[_0x8eff('0x8')](util[_0x8eff('0x1')](_0x8eff('0xf'),_0x28acb6[_0x8eff('0x10')]),_0x28acb6);utils[_0x8eff('0x0')](util[_0x8eff('0x1')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x28acb6[_0x8eff('0x10')],_0x28acb6[_0x8eff('0x11')],_0x28acb6['origtransferercalleridname'],_0x28acb6[_0x8eff('0x12')],_0x28acb6['transfertargetcalleridname']));_0x28acb6=_[_0x8eff('0x13')](_0x28acb6,{'transfererchannel':_0x28acb6['origtransfererchannel'],'transferercalleridnum':_0x28acb6[_0x8eff('0x11')],'transferercalleridname':_0x28acb6[_0x8eff('0x14')],'transfererconnectedlinenum':_0x28acb6[_0x8eff('0x15')],'transfererconnectedlinename':_0x28acb6[_0x8eff('0x16')],'transfereraccountcode':_0x28acb6[_0x8eff('0x17')],'transferercontext':_0x28acb6['secondtransferercontext'],'transfererexten':_0x28acb6[_0x8eff('0x18')],'transfererlinkedid':_0x28acb6[_0x8eff('0x19')],'context':_0x28acb6['origtransferercontext'],'extension':_0x28acb6[_0x8eff('0x1a')],'type':_0x8eff('0x1b')});if(_[_0x8eff('0x1c')](_0x28acb6[_0x8eff('0x1d')])){_0x28acb6=_[_0x8eff('0x13')](_0x28acb6,{'transfereechannel':_0x28acb6[_0x8eff('0x1e')],'transfereecalleridnum':_0x28acb6['transfertargetcalleridnum'],'transfereecalleridname':_0x28acb6[_0x8eff('0x1f')],'transfereeconnectedlinenum':_0x28acb6[_0x8eff('0x20')],'transfereeconnectedlinename':_0x28acb6['transfertargetconnectedlinename'],'transfereeaccountcode':_0x28acb6[_0x8eff('0x21')],'transfereecontext':_0x28acb6[_0x8eff('0x22')],'transfereeexten':_0x28acb6[_0x8eff('0x23')],'transfereelinkedid':_0x28acb6[_0x8eff('0x24')]});}writeDB(_0x28acb6);}catch(_0x4b5e5a){utils[_0x8eff('0xd')](util[_0x8eff('0x1')]('[%s][transfers][attendedtransfer]',_0x28acb6[_0x8eff('0x10')]),_0x4b5e5a);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 44526c2..390ef6e 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x539b71,_0x4daf0b){var _0x3d1a59=function(_0x1a59ed){while(--_0x1a59ed){_0x539b71['push'](_0x539b71['shift']());}};_0x3d1a59(++_0x4daf0b);}(_0x7a54,0x106));var _0x47a5=function(_0x292b7b,_0x317f1f){_0x292b7b=_0x292b7b-0x0;var _0x4f8ad0=_0x7a54[_0x292b7b];return _0x4f8ad0;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fe5b5,_0x41efab){_0x4fe5b5=_0x4fe5b5-0x0;var _0x221fbe=_0xb10b[_0x4fe5b5];return _0x221fbe;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file